From: Andrea Bianco Date: Fri, 19 Nov 2021 16:52:17 +0000 (+0100) Subject: Built motion from commit 14588770.|2.5.38 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=32b9c442a2bebed601b44c1fe01fdd266a334026;p=motion2.git Built motion from commit 14588770.|2.5.38 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 077d881..7190b61 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.5.37", + "version": "2.5.38", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-11T09:11:44.663Z", + "time": "2021-11-19T16:43:57.636Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a985d15..958e650 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.5.37", + "version": "2.5.38", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-11T09:11:44.663Z", + "time": "2021-11-19T16:43:57.636Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/package.json b/package.json index cc37218..8e477c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.5.37", + "version": "2.5.38", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 2a4d032..c565554 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 _0xa54c=['contactManager','integration','jscripty','urlForward','browser','bot','script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','action'];(function(_0x326679,_0x2b5c01){var _0x43188a=function(_0x5d2746){while(--_0x5d2746){_0x326679['push'](_0x326679['shift']());}};_0x43188a(++_0x2b5c01);}(_0xa54c,0xee));var _0xca54=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xa54c[_0x34843e];return _0x598f7f;};'use strict';var Sequelize=require('sequelize');module[_0xca54('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xb1af3e){return this['getDataValue'](_0xca54('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xca54('0x2'),_0xca54('0x3'),'motionbar',_0xca54('0x4'),_0xca54('0x5'),_0xca54('0x6'),_0xca54('0x7'),_0xca54('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xca54('0x9')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xca54('0x9')](0x1000),'comment':_0xca54('0xa')},'data3':{'type':Sequelize[_0xca54('0x9')](0x1000),'comment':_0xca54('0xb')},'data4':{'type':Sequelize[_0xca54('0x9')](0x1000),'comments':_0xca54('0xc')},'data5':{'type':Sequelize[_0xca54('0x9')](0x1000),'comments':_0xca54('0xd')},'data6':{'type':Sequelize['STRING'],'comments':_0xca54('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0xca54('0xf')}}; \ No newline at end of file +var _0x0cc9=['urlForward[body]','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x144ce4,_0x27528a){var _0x42a6b1=function(_0x1f948d){while(--_0x1f948d){_0x144ce4['push'](_0x144ce4['shift']());}};_0x42a6b1(++_0x27528a);}(_0x0cc9,0x121));var _0x90cc=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x0cc9[_0x146a97];return _0x259d5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x90cc('0x0')],'get':function(_0x161b34){return this[_0x90cc('0x1')](_0x90cc('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x90cc('0x3'),_0x90cc('0x4'),_0x90cc('0x5'),'jscripty',_0x90cc('0x6'),_0x90cc('0x7'),_0x90cc('0x8'),'script']],'msg':_0x90cc('0x9')}},'comment':_0x90cc('0x9')},'data1':{'type':Sequelize[_0x90cc('0xa')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x90cc('0xa')](0x1000),'comment':_0x90cc('0xb')},'data3':{'type':Sequelize[_0x90cc('0xa')](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[_0x90cc('0xa')](0x1000),'comments':_0x90cc('0xc')},'data5':{'type':Sequelize[_0x90cc('0xa')](0x1000),'comments':_0x90cc('0xd')},'data6':{'type':Sequelize[_0x90cc('0xa')],'comments':_0x90cc('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0x90cc('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 01bc5c7..4e0b1c7 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 _0xde2b=['update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xde2b,0x72));var _0xbde2=function(_0x183492,_0xaa45f6){_0x183492=_0x183492-0x0;var _0x55d035=_0xde2b[_0x183492];return _0x55d035;};'use strict';var emlformat=require(_0xbde2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbde2('0x1'));var jsonpatch=require(_0xbde2('0x2'));var rp=require(_0xbde2('0x3'));var moment=require('moment');var BPromise=require(_0xbde2('0x4'));var Mustache=require(_0xbde2('0x5'));var util=require(_0xbde2('0x6'));var path=require(_0xbde2('0x7'));var sox=require(_0xbde2('0x8'));var csv=require(_0xbde2('0x9'));var ejs=require(_0xbde2('0xa'));var fs=require('fs');var fs_extra=require(_0xbde2('0xb'));var _=require(_0xbde2('0xc'));var squel=require(_0xbde2('0xd'));var crypto=require(_0xbde2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbde2('0xf'));var toCsv=require(_0xbde2('0x9'));var querystring=require(_0xbde2('0x10'));var Papa=require('papaparse');var Redis=require(_0xbde2('0x11'));var authService=require(_0xbde2('0x12'));var qs=require(_0xbde2('0x13'));var as=require(_0xbde2('0x14'));var hardwareService=require(_0xbde2('0x15'));var logger=require(_0xbde2('0x16'))(_0xbde2('0x17'));var utils=require(_0xbde2('0x18'));var config=require(_0xbde2('0x19'));var licenseUtil=require(_0xbde2('0x1a'));var db=require(_0xbde2('0x1b'))['db'];function respondWithStatusCode(_0x142663,_0x16d9a0){_0x16d9a0=_0x16d9a0||0xcc;return function(_0x130fa0){if(_0x130fa0){return _0x142663[_0xbde2('0x1c')](_0x16d9a0);}return _0x142663[_0xbde2('0x1d')](_0x16d9a0)[_0xbde2('0x1e')]();};}function respondWithResult(_0x512ba5,_0x153c12){_0x153c12=_0x153c12||0xc8;return function(_0x550c18){if(_0x550c18){return _0x512ba5[_0xbde2('0x1d')](_0x153c12)['json'](_0x550c18);}};}function respondWithFilteredResult(_0x1bd7b9,_0x5d6fa1){return function(_0x46e88a){if(_0x46e88a){var _0x40e538=typeof _0x5d6fa1[_0xbde2('0x1f')]===_0xbde2('0x20')&&typeof _0x5d6fa1[_0xbde2('0x21')]===_0xbde2('0x20');var _0x22cf88=_0x46e88a[_0xbde2('0x22')];var _0x17de7e=_0x40e538?0x0:_0x5d6fa1['offset'];var _0x46eb1d=_0x40e538?_0x46e88a['count']:_0x5d6fa1[_0xbde2('0x1f')]+_0x5d6fa1[_0xbde2('0x21')];var _0x463804;if(_0x46eb1d>=_0x22cf88){_0x46eb1d=_0x22cf88;_0x463804=0xc8;}else{_0x463804=0xce;}_0x1bd7b9['status'](_0x463804);return _0x1bd7b9['set'](_0xbde2('0x23'),_0x17de7e+'-'+_0x46eb1d+'/'+_0x22cf88)[_0xbde2('0x24')](_0x46e88a);}return null;};}function patchUpdates(_0x52c500){return function(_0xe49a44){try{jsonpatch[_0xbde2('0x25')](_0xe49a44,_0x52c500,!![]);}catch(_0x39c980){return BPromise['reject'](_0x39c980);}return _0xe49a44[_0xbde2('0x26')]();};}function saveUpdates(_0x4cc383,_0x510cd5){return function(_0x313cfe){if(_0x313cfe){return _0x313cfe[_0xbde2('0x27')](_0x4cc383)[_0xbde2('0x28')](function(_0x546b49){return _0x546b49;});}return null;};}function removeEntity(_0x54c07d,_0x5ed4f9){return function(_0x157498){if(_0x157498){return _0x157498[_0xbde2('0x29')]()['then'](function(){_0x54c07d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6883,_0x5a62a5){return function(_0x1c16a3){if(!_0x1c16a3){_0x1a6883[_0xbde2('0x1c')](0x194);}return _0x1c16a3;};}function handleError(_0x39274f,_0x53c232){_0x53c232=_0x53c232||0x1f4;return function(_0x5ed965){logger[_0xbde2('0x2a')](_0x5ed965[_0xbde2('0x2b')]);if(_0x5ed965[_0xbde2('0x2c')]){delete _0x5ed965[_0xbde2('0x2c')];}_0x39274f[_0xbde2('0x1d')](_0x53c232)[_0xbde2('0x2d')](_0x5ed965);};}exports[_0xbde2('0x27')]=function(_0x5cc866,_0x58e697){if(_0x5cc866['body']['id']){delete _0x5cc866[_0xbde2('0x2e')]['id'];}return db[_0xbde2('0x2f')][_0xbde2('0x30')]({'where':{'id':_0x5cc866[_0xbde2('0x31')]['id']}})['then'](handleEntityNotFound(_0x58e697,null))[_0xbde2('0x28')](saveUpdates(_0x5cc866[_0xbde2('0x2e')],null))['then'](respondWithResult(_0x58e697,null))[_0xbde2('0x32')](handleError(_0x58e697,null));};exports[_0xbde2('0x29')]=function(_0x35fa4b,_0x28d917){return db[_0xbde2('0x2f')][_0xbde2('0x30')]({'where':{'id':_0x35fa4b[_0xbde2('0x31')]['id']}})[_0xbde2('0x28')](handleEntityNotFound(_0x28d917,null))[_0xbde2('0x28')](removeEntity(_0x28d917,null))[_0xbde2('0x32')](handleError(_0x28d917,null));}; \ No newline at end of file +var _0x77ce=['send','body','Action','find','params','destroy','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name'];(function(_0x29a17a,_0x1456dd){var _0x2ea5bf=function(_0x9bd0ee){while(--_0x9bd0ee){_0x29a17a['push'](_0x29a17a['shift']());}};_0x2ea5bf(++_0x1456dd);}(_0x77ce,0x1c9));var _0xe77c=function(_0x409c7e,_0x223319){_0x409c7e=_0x409c7e-0x0;var _0x45cff9=_0x77ce[_0x409c7e];return _0x45cff9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe77c('0x0'));var jsonpatch=require(_0xe77c('0x1'));var rp=require(_0xe77c('0x2'));var moment=require(_0xe77c('0x3'));var BPromise=require(_0xe77c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe77c('0x5'));var sox=require(_0xe77c('0x6'));var csv=require('to-csv');var ejs=require(_0xe77c('0x7'));var fs=require('fs');var fs_extra=require(_0xe77c('0x8'));var _=require(_0xe77c('0x9'));var squel=require(_0xe77c('0xa'));var crypto=require(_0xe77c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe77c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe77c('0xd'));var Papa=require('papaparse');var Redis=require(_0xe77c('0xe'));var authService=require(_0xe77c('0xf'));var qs=require(_0xe77c('0x10'));var as=require(_0xe77c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe77c('0x12'));var utils=require(_0xe77c('0x13'));var config=require(_0xe77c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe77c('0x15'))['db'];function respondWithStatusCode(_0x2d242f,_0xefebd4){_0xefebd4=_0xefebd4||0xcc;return function(_0x2c4792){if(_0x2c4792){return _0x2d242f[_0xe77c('0x16')](_0xefebd4);}return _0x2d242f[_0xe77c('0x17')](_0xefebd4)[_0xe77c('0x18')]();};}function respondWithResult(_0x200f81,_0x1256ff){_0x1256ff=_0x1256ff||0xc8;return function(_0x53f161){if(_0x53f161){return _0x200f81['status'](_0x1256ff)[_0xe77c('0x19')](_0x53f161);}};}function respondWithFilteredResult(_0x16ef43,_0x51f340){return function(_0x5e770b){if(_0x5e770b){var _0x282d8d=typeof _0x51f340[_0xe77c('0x1a')]===_0xe77c('0x1b')&&typeof _0x51f340[_0xe77c('0x1c')]===_0xe77c('0x1b');var _0x2c6bd8=_0x5e770b[_0xe77c('0x1d')];var _0x11a5da=_0x282d8d?0x0:_0x51f340['offset'];var _0x49d1c1=_0x282d8d?_0x5e770b[_0xe77c('0x1d')]:_0x51f340[_0xe77c('0x1a')]+_0x51f340[_0xe77c('0x1c')];var _0x233d00;if(_0x49d1c1>=_0x2c6bd8){_0x49d1c1=_0x2c6bd8;_0x233d00=0xc8;}else{_0x233d00=0xce;}_0x16ef43[_0xe77c('0x17')](_0x233d00);return _0x16ef43[_0xe77c('0x1e')](_0xe77c('0x1f'),_0x11a5da+'-'+_0x49d1c1+'/'+_0x2c6bd8)['json'](_0x5e770b);}return null;};}function patchUpdates(_0x5eac1d){return function(_0x14f139){try{jsonpatch[_0xe77c('0x20')](_0x14f139,_0x5eac1d,!![]);}catch(_0x3c8572){return BPromise[_0xe77c('0x21')](_0x3c8572);}return _0x14f139['save']();};}function saveUpdates(_0x16656e,_0x43b5e9){return function(_0x12c0d9){if(_0x12c0d9){return _0x12c0d9[_0xe77c('0x22')](_0x16656e)['then'](function(_0x1a4b76){return _0x1a4b76;});}return null;};}function removeEntity(_0x365c8a,_0x200284){return function(_0x5b9148){if(_0x5b9148){return _0x5b9148['destroy']()[_0xe77c('0x23')](function(){_0x365c8a[_0xe77c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4352bc,_0x19c31b){return function(_0x22da48){if(!_0x22da48){_0x4352bc[_0xe77c('0x16')](0x194);}return _0x22da48;};}function handleError(_0x4544ed,_0x87bd75){_0x87bd75=_0x87bd75||0x1f4;return function(_0x3748f8){logger[_0xe77c('0x24')](_0x3748f8['stack']);if(_0x3748f8[_0xe77c('0x25')]){delete _0x3748f8[_0xe77c('0x25')];}_0x4544ed[_0xe77c('0x17')](_0x87bd75)[_0xe77c('0x26')](_0x3748f8);};}exports[_0xe77c('0x22')]=function(_0x4289d4,_0x4cd02c){if(_0x4289d4[_0xe77c('0x27')]['id']){delete _0x4289d4[_0xe77c('0x27')]['id'];}return db[_0xe77c('0x28')][_0xe77c('0x29')]({'where':{'id':_0x4289d4[_0xe77c('0x2a')]['id']}})[_0xe77c('0x23')](handleEntityNotFound(_0x4cd02c,null))[_0xe77c('0x23')](saveUpdates(_0x4289d4[_0xe77c('0x27')],null))[_0xe77c('0x23')](respondWithResult(_0x4cd02c,null))['catch'](handleError(_0x4cd02c,null));};exports[_0xe77c('0x2b')]=function(_0x2f9ed1,_0x247733){return db[_0xe77c('0x28')][_0xe77c('0x29')]({'where':{'id':_0x2f9ed1[_0xe77c('0x2a')]['id']}})[_0xe77c('0x23')](handleEntityNotFound(_0x247733,null))[_0xe77c('0x23')](removeEntity(_0x247733,null))[_0xe77c('0x2c')](handleError(_0x247733,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7864068..cac87ab 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 _0xc895=['path','../../config/environment','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xf7d1f2,_0x39ac65){var _0xf4ba06=function(_0x5cf3b7){while(--_0x5cf3b7){_0xf7d1f2['push'](_0xf7d1f2['shift']());}};_0xf4ba06(++_0x39ac65);}(_0xc895,0x18b));var _0x5c89=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0xc895[_0x197043];return _0x233e33;};'use strict';var _=require(_0x5c89('0x0'));var util=require(_0x5c89('0x1'));var logger=require(_0x5c89('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5c89('0x3'));var rp=require(_0x5c89('0x4'));var fs=require('fs');var path=require(_0x5c89('0x5'));var rimraf=require('rimraf');var config=require(_0x5c89('0x6'));var attributes=require(_0x5c89('0x7'));module[_0x5c89('0x8')]=function(_0x21ade6,_0x479ecf){return _0x21ade6['define']('Action',attributes,{'tableName':_0x5c89('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb276=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x446158,_0x554222){var _0x3dab01=function(_0x3712e4){while(--_0x3712e4){_0x446158['push'](_0x446158['shift']());}};_0x3dab01(++_0x554222);}(_0xb276,0x1f2));var _0x6b27=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xb276[_0x51fe5f];return _0x4abce9;};'use strict';var _=require('lodash');var util=require(_0x6b27('0x0'));var logger=require(_0x6b27('0x1'))(_0x6b27('0x2'));var moment=require(_0x6b27('0x3'));var BPromise=require(_0x6b27('0x4'));var rp=require(_0x6b27('0x5'));var fs=require('fs');var path=require(_0x6b27('0x6'));var rimraf=require(_0x6b27('0x7'));var config=require(_0x6b27('0x8'));var attributes=require(_0x6b27('0x9'));module[_0x6b27('0xa')]=function(_0x41a4c9,_0x2f6278){return _0x41a4c9[_0x6b27('0xb')](_0x6b27('0xc'),attributes,{'tableName':_0x6b27('0xd'),'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 367b8c1..1e9d6e6 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2df2f0,_0x5ec74a){var _0x5aa896=function(_0x642966){while(--_0x642966){_0x2df2f0['push'](_0x2df2f0['shift']());}};_0x5aa896(++_0x5ec74a);}(_0x1261,0x144));var _0x1126=function(_0x422994,_0x99047b){_0x422994=_0x422994-0x0;var _0x43ad8f=_0x1261[_0x422994];return _0x43ad8f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1cb9,0x14e));var _0x91cb=function(_0xa740ba,_0x3b2daa){_0xa740ba=_0xa740ba-0x0;var _0x3e2367=_0x1cb9[_0xa740ba];return _0x3e2367;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 08e0418..ef83758 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 _0x3ef4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','delete','/:id','isAuthenticated','destroy','exports','util','path'];(function(_0x406fda,_0x40c073){var _0xb2bdd9=function(_0x4f1b9d){while(--_0x4f1b9d){_0x406fda['push'](_0x406fda['shift']());}};_0xb2bdd9(++_0x40c073);}(_0x3ef4,0xc1));var _0x43ef=function(_0x1c7386,_0x298a93){_0x1c7386=_0x1c7386-0x0;var _0x2b6b71=_0x3ef4[_0x1c7386];return _0x2b6b71;};'use strict';var multer=require('multer');var util=require(_0x43ef('0x0'));var path=require(_0x43ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x43ef('0x2'));var router=express[_0x43ef('0x3')]();var fs_extra=require(_0x43ef('0x4'));var auth=require(_0x43ef('0x5'));var interaction=require(_0x43ef('0x6'));var config=require(_0x43ef('0x7'));var controller=require(_0x43ef('0x8'));router[_0x43ef('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x43ef('0xa')](_0x43ef('0xb'),auth[_0x43ef('0xc')](),controller[_0x43ef('0xd')]);module[_0x43ef('0xe')]=router; \ No newline at end of file +var _0x571c=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x1c9626,_0x48f3ec){var _0x5ec34f=function(_0xd2fca3){while(--_0xd2fca3){_0x1c9626['push'](_0x1c9626['shift']());}};_0x5ec34f(++_0x48f3ec);}(_0x571c,0x6f));var _0xc571=function(_0x121656,_0x244e66){_0x121656=_0x121656-0x0;var _0x890b97=_0x571c[_0x121656];return _0x890b97;};'use strict';var multer=require(_0xc571('0x0'));var util=require(_0xc571('0x1'));var path=require(_0xc571('0x2'));var timeout=require(_0xc571('0x3'));var express=require(_0xc571('0x4'));var router=express[_0xc571('0x5')]();var fs_extra=require(_0xc571('0x6'));var auth=require(_0xc571('0x7'));var interaction=require(_0xc571('0x8'));var config=require(_0xc571('0x9'));var controller=require(_0xc571('0xa'));router[_0xc571('0xb')](_0xc571('0xc'),auth[_0xc571('0xd')](),controller[_0xc571('0xe')]);router[_0xc571('0xf')](_0xc571('0xc'),auth['isAuthenticated'](),controller[_0xc571('0x10')]);module[_0xc571('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 10ee517..c3e380c 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 _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x1865f3,_0x5154be){var _0xb69290=function(_0x12e20b){while(--_0x12e20b){_0x1865f3['push'](_0x1865f3['shift']());}};_0xb69290(++_0x5154be);}(_0x2bd8,0x130));var _0x82bd=function(_0x50c32f,_0x28b18e){_0x50c32f=_0x50c32f-0x0;var _0x2f4a45=_0x2bd8[_0x50c32f];return _0x2f4a45;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0x24ca,0x1bc));var _0xa24c=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x24ca[_0x519c88];return _0x4668d7;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 4c5f8c4..b11b42e 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 _0x8a6d=['value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','field','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','select','function','output','web','fullPath','%s-%s.%s','generate','csv','custom','cdr','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','count','run','runReport','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','length','rules','operator','group','condition'];(function(_0x376489,_0x9ac1a4){var _0x54d58e=function(_0x15b8b2){while(--_0x15b8b2){_0x376489['push'](_0x376489['shift']());}};_0x54d58e(++_0x9ac1a4);}(_0x8a6d,0xe4));var _0xd8a6=function(_0x4ba5fa,_0x1a936f){_0x4ba5fa=_0x4ba5fa-0x0;var _0x372377=_0x8a6d[_0x4ba5fa];return _0x372377;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8a6('0x0'));var zipdir=require(_0xd8a6('0x1'));var jsonpatch=require(_0xd8a6('0x2'));var rp=require(_0xd8a6('0x3'));var moment=require('moment');var BPromise=require(_0xd8a6('0x4'));var Mustache=require(_0xd8a6('0x5'));var util=require(_0xd8a6('0x6'));var path=require('path');var sox=require(_0xd8a6('0x7'));var csv=require(_0xd8a6('0x8'));var ejs=require(_0xd8a6('0x9'));var fs=require('fs');var fs_extra=require(_0xd8a6('0xa'));var _=require(_0xd8a6('0xb'));var squel=require(_0xd8a6('0xc'));var crypto=require(_0xd8a6('0xd'));var jsforce=require(_0xd8a6('0xe'));var deskjs=require(_0xd8a6('0xf'));var toCsv=require(_0xd8a6('0x8'));var querystring=require(_0xd8a6('0x10'));var Papa=require(_0xd8a6('0x11'));var Redis=require('ioredis');var authService=require(_0xd8a6('0x12'));var qs=require(_0xd8a6('0x13'));var as=require(_0xd8a6('0x14'));var hardwareService=require(_0xd8a6('0x15'));var logger=require(_0xd8a6('0x16'))(_0xd8a6('0x17'));var utils=require(_0xd8a6('0x18'));var config=require(_0xd8a6('0x19'));var licenseUtil=require(_0xd8a6('0x1a'));var db=require(_0xd8a6('0x1b'))['db'];var dbH=require(_0xd8a6('0x1b'))[_0xd8a6('0x1c')];function respondWithStatusCode(_0x4391b8,_0x1a2820){_0x1a2820=_0x1a2820||0xcc;return function(_0x2a973d){if(_0x2a973d){return _0x4391b8[_0xd8a6('0x1d')](_0x1a2820);}return _0x4391b8[_0xd8a6('0x1e')](_0x1a2820)[_0xd8a6('0x1f')]();};}function respondWithResult(_0x498d7b,_0x2ff518){_0x2ff518=_0x2ff518||0xc8;return function(_0x1d33a8){if(_0x1d33a8){return _0x498d7b[_0xd8a6('0x1e')](_0x2ff518)['json'](_0x1d33a8);}};}function respondWithFilteredResult(_0x75ed5,_0x2f1965){return function(_0x2c81ee){if(_0x2c81ee){var _0x693fc0=typeof _0x2f1965[_0xd8a6('0x20')]===_0xd8a6('0x21')&&typeof _0x2f1965[_0xd8a6('0x22')]===_0xd8a6('0x21');var _0x19b55e=_0x2c81ee['count'];var _0x43f27d=_0x693fc0?0x0:_0x2f1965[_0xd8a6('0x20')];var _0x51839c=_0x693fc0?_0x2c81ee['count']:_0x2f1965[_0xd8a6('0x20')]+_0x2f1965['limit'];var _0x2284bd;if(_0x51839c>=_0x19b55e){_0x51839c=_0x19b55e;_0x2284bd=0xc8;}else{_0x2284bd=0xce;}_0x75ed5[_0xd8a6('0x1e')](_0x2284bd);return _0x75ed5[_0xd8a6('0x23')](_0xd8a6('0x24'),_0x43f27d+'-'+_0x51839c+'/'+_0x19b55e)[_0xd8a6('0x25')](_0x2c81ee);}return null;};}function patchUpdates(_0x46f11d){return function(_0x313187){try{jsonpatch[_0xd8a6('0x26')](_0x313187,_0x46f11d,!![]);}catch(_0x2db89d){return BPromise['reject'](_0x2db89d);}return _0x313187[_0xd8a6('0x27')]();};}function saveUpdates(_0x490a27,_0x1ad47c){return function(_0x431432){if(_0x431432){return _0x431432['update'](_0x490a27)[_0xd8a6('0x28')](function(_0x1e8904){return _0x1e8904;});}return null;};}function removeEntity(_0x2cdf6f,_0x23fbbd){return function(_0x744629){if(_0x744629){return _0x744629[_0xd8a6('0x29')]()[_0xd8a6('0x28')](function(){var _0x21def5=_0x744629[_0xd8a6('0x2a')]({'plain':!![]});var _0x15a7b0=_0xd8a6('0x2b');return db[_0xd8a6('0x2c')][_0xd8a6('0x29')]({'where':{'type':_0x15a7b0,'resourceId':_0x21def5['id']}})[_0xd8a6('0x28')](function(){return _0x744629;});})[_0xd8a6('0x28')](function(){_0x2cdf6f[_0xd8a6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56635a,_0x423c2f){return function(_0x4de7ca){if(!_0x4de7ca){_0x56635a[_0xd8a6('0x1d')](0x194);}return _0x4de7ca;};}function handleError(_0x59bbbe,_0x19e08e){_0x19e08e=_0x19e08e||0x1f4;return function(_0x52410a){logger[_0xd8a6('0x2d')](_0x52410a[_0xd8a6('0x2e')]);if(_0x52410a[_0xd8a6('0x2f')]){delete _0x52410a[_0xd8a6('0x2f')];}_0x59bbbe[_0xd8a6('0x1e')](_0x19e08e)[_0xd8a6('0x30')](_0x52410a);};}exports[_0xd8a6('0x31')]=function(_0xf8e71,_0x25db1a){var _0x2c2d84={},_0x123533={},_0x279bac={'count':0x0,'rows':[]};var _0x5286af=_[_0xd8a6('0x32')](db[_0xd8a6('0x33')][_0xd8a6('0x34')],function(_0x3fa6f0){return{'name':_0x3fa6f0[_0xd8a6('0x35')],'type':_0x3fa6f0['type'][_0xd8a6('0x36')]};});_0x123533[_0xd8a6('0x37')]=_[_0xd8a6('0x32')](_0x5286af,_0xd8a6('0x2f'));_0x123533[_0xd8a6('0x38')]=_[_0xd8a6('0x39')](_0xf8e71[_0xd8a6('0x38')]);_0x123533[_0xd8a6('0x3a')]=_[_0xd8a6('0x3b')](_0x123533[_0xd8a6('0x37')],_0x123533[_0xd8a6('0x38')]);_0x2c2d84['attributes']=_[_0xd8a6('0x3b')](_0x123533[_0xd8a6('0x37')],qs[_0xd8a6('0x3c')](_0xf8e71['query']['fields']));_0x2c2d84[_0xd8a6('0x3d')]=_0x2c2d84[_0xd8a6('0x3d')]['length']?_0x2c2d84['attributes']:_0x123533[_0xd8a6('0x37')];if(!_0xf8e71['query'][_0xd8a6('0x3e')](_0xd8a6('0x3f'))){_0x2c2d84[_0xd8a6('0x22')]=qs['limit'](_0xf8e71[_0xd8a6('0x38')][_0xd8a6('0x22')]);_0x2c2d84[_0xd8a6('0x20')]=qs[_0xd8a6('0x20')](_0xf8e71[_0xd8a6('0x38')][_0xd8a6('0x20')]);}_0x2c2d84[_0xd8a6('0x40')]=qs[_0xd8a6('0x41')](_0xf8e71[_0xd8a6('0x38')][_0xd8a6('0x41')]);_0x2c2d84['where']=qs[_0xd8a6('0x3a')](_['pick'](_0xf8e71[_0xd8a6('0x38')],_0x123533[_0xd8a6('0x3a')]),_0x5286af);if(_0xf8e71[_0xd8a6('0x38')][_0xd8a6('0x42')]){_0x2c2d84['where']=_[_0xd8a6('0x43')](_0x2c2d84[_0xd8a6('0x44')],{'$or':_[_0xd8a6('0x32')](_0x5286af,function(_0x45def2){if(_0x45def2[_0xd8a6('0x45')]!==_0xd8a6('0x46')){var _0x435f28={};_0x435f28[_0x45def2[_0xd8a6('0x2f')]]={'$like':'%'+_0xf8e71[_0xd8a6('0x38')][_0xd8a6('0x42')]+'%'};return _0x435f28;}})});}_0x2c2d84=_[_0xd8a6('0x43')]({},_0x2c2d84,_0xf8e71[_0xd8a6('0x47')]);var _0x21c513={'where':_0x2c2d84['where']};return db[_0xd8a6('0x33')]['count'](_0x21c513)['then'](function(_0x534dc3){_0x279bac['count']=_0x534dc3;if(_0xf8e71[_0xd8a6('0x38')][_0xd8a6('0x48')]){_0x2c2d84[_0xd8a6('0x49')]=[{'all':!![]}];}return db[_0xd8a6('0x33')]['findAll'](_0x2c2d84);})[_0xd8a6('0x28')](function(_0x128ca4){_0x279bac[_0xd8a6('0x4a')]=_0x128ca4;return _0x279bac;})['then'](respondWithFilteredResult(_0x25db1a,_0x2c2d84))[_0xd8a6('0x4b')](handleError(_0x25db1a,null));};exports['show']=function(_0x1a38b1,_0x16f533){var _0x36a06f={'raw':![],'where':{'id':_0x1a38b1[_0xd8a6('0x4c')]['id']}},_0x57afbc={};_0x57afbc[_0xd8a6('0x37')]=_[_0xd8a6('0x39')](db[_0xd8a6('0x33')][_0xd8a6('0x34')]);_0x57afbc[_0xd8a6('0x38')]=_[_0xd8a6('0x39')](_0x1a38b1[_0xd8a6('0x38')]);_0x57afbc['filters']=_['intersection'](_0x57afbc[_0xd8a6('0x37')],_0x57afbc[_0xd8a6('0x38')]);_0x36a06f[_0xd8a6('0x3d')]=_[_0xd8a6('0x3b')](_0x57afbc[_0xd8a6('0x37')],qs[_0xd8a6('0x3c')](_0x1a38b1[_0xd8a6('0x38')][_0xd8a6('0x3c')]));_0x36a06f['attributes']=_0x36a06f['attributes']['length']?_0x36a06f[_0xd8a6('0x3d')]:_0x57afbc[_0xd8a6('0x37')];if(_0x1a38b1[_0xd8a6('0x38')][_0xd8a6('0x48')]){_0x36a06f[_0xd8a6('0x49')]=[{'all':!![]}];}_0x36a06f=_[_0xd8a6('0x43')]({},_0x36a06f,_0x1a38b1['options']);return db[_0xd8a6('0x33')][_0xd8a6('0x4d')](_0x36a06f)[_0xd8a6('0x28')](handleEntityNotFound(_0x16f533,null))[_0xd8a6('0x28')](respondWithResult(_0x16f533,null))['catch'](handleError(_0x16f533,null));};exports[_0xd8a6('0x4e')]=function(_0x35fe95,_0x336d8f){return db['AnalyticCustomReport']['create'](_0x35fe95['body'],{})[_0xd8a6('0x28')](function(_0x5b337b){var _0x411e89=_0x35fe95[_0xd8a6('0x4f')][_0xd8a6('0x2a')]({'plain':!![]});if(!_0x411e89)throw new Error(_0xd8a6('0x50'));if(_0x411e89[_0xd8a6('0x51')]===_0xd8a6('0x4f')){var _0x5b24d5=_0x5b337b['get']({'plain':!![]});var _0x4c29ae='Reports';return db[_0xd8a6('0x52')][_0xd8a6('0x4d')]({'where':{'name':_0x4c29ae,'userProfileId':_0x411e89['userProfileId']},'raw':!![]})[_0xd8a6('0x28')](function(_0x14e3f6){if(_0x14e3f6&&_0x14e3f6[_0xd8a6('0x53')]===0x0){return db[_0xd8a6('0x2c')][_0xd8a6('0x4e')]({'name':_0x5b24d5[_0xd8a6('0x2f')],'resourceId':_0x5b24d5['id'],'type':_0xd8a6('0x2b'),'sectionId':_0x14e3f6['id']},{})['then'](function(){return _0x5b337b;});}else{return _0x5b337b;}})['catch'](function(_0x32b819){logger[_0xd8a6('0x2d')](_0xd8a6('0x54'),_0x32b819);throw _0x32b819;});}return _0x5b337b;})[_0xd8a6('0x28')](respondWithResult(_0x336d8f,0xc9))[_0xd8a6('0x4b')](handleError(_0x336d8f,null));};exports[_0xd8a6('0x55')]=function(_0x762d97,_0x4f8b76){if(_0x762d97['body']['id']){delete _0x762d97[_0xd8a6('0x56')]['id'];}return db['AnalyticCustomReport'][_0xd8a6('0x4d')]({'where':{'id':_0x762d97[_0xd8a6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f8b76,null))[_0xd8a6('0x28')](saveUpdates(_0x762d97['body'],null))['then'](respondWithResult(_0x4f8b76,null))[_0xd8a6('0x4b')](handleError(_0x4f8b76,null));};exports[_0xd8a6('0x29')]=function(_0x3bf1bd,_0x20c40c){return db[_0xd8a6('0x33')]['find']({'where':{'id':_0x3bf1bd[_0xd8a6('0x4c')]['id']}})[_0xd8a6('0x28')](handleEntityNotFound(_0x20c40c,null))[_0xd8a6('0x28')](removeEntity(_0x20c40c,null))[_0xd8a6('0x4b')](handleError(_0x20c40c,null));};exports[_0xd8a6('0x57')]=function(_0x2f32f5,_0x2fa7fb){var _0x574d14=0xa;var _0x27cd4e=['join',_0xd8a6('0x58'),_0xd8a6('0x59'),_0xd8a6('0x5a')];var _0xa433d6={'SUM':_0xd8a6('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd8a6('0x5c'),'MAX':_0xd8a6('0x5d'),'MIN':_0xd8a6('0x5e'),'AVG':_0xd8a6('0x5f'),'GROUP_CONCAT':_0xd8a6('0x60'),'GROUP_CONCAT ASC':_0xd8a6('0x61'),'GROUP_CONCAT DESC':_0xd8a6('0x62')};var _0x1600b6={'SEC_TO_TIME':_0xd8a6('0x63'),'DATE':_0xd8a6('0x64'),'HOUR':_0xd8a6('0x65'),'ROUND':_0xd8a6('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x20ec8e=function(_0x3ff123){return!_[_0xd8a6('0x67')]([_0xd8a6('0x68'),'IS\x20NOT\x20NULL',_0xd8a6('0x69'),_0xd8a6('0x6a')],_0x3ff123);};var _0x711e73=function(_0x563bc8){if(!_0x563bc8||!_0x563bc8['rules'][_0xd8a6('0x6b')]){return'';}for(var _0x348143='(',_0x13963e=0x0;_0x13963e<_0x563bc8[_0xd8a6('0x6c')][_0xd8a6('0x6b')];_0x13963e+=0x1){_0x13963e>0x0&&(_0x348143+='\x20'+_0x563bc8[_0xd8a6('0x6d')]+'\x20');_0x348143+=_0x563bc8['rules'][_0x13963e][_0xd8a6('0x6e')]?_0x711e73(_0x563bc8['rules'][_0x13963e][_0xd8a6('0x6e')]):_0x563bc8[_0xd8a6('0x6c')][_0x13963e]['field']+'\x20'+_0x563bc8[_0xd8a6('0x6c')][_0x13963e]['condition']+(_0x20ec8e(_0x563bc8[_0xd8a6('0x6c')][_0x13963e][_0xd8a6('0x6f')])?'\x20'+_0x563bc8[_0xd8a6('0x6c')][_0x13963e][_0xd8a6('0x70')]:'');}return _0x348143+')';};var _0x1541fa={'where':{'id':_0x2f32f5[_0xd8a6('0x4c')]['id']}},_0x2b25c7,_0x59b1d9,_0x21a75b,_0x2c0c5a,_0x562e13;_0x1541fa=_[_0xd8a6('0x43')]({},_0x1541fa,_0x2f32f5[_0xd8a6('0x47')]);return db[_0xd8a6('0x33')]['find'](_0x1541fa)[_0xd8a6('0x28')](function(_0x10e2ef){if(_0x10e2ef){_0x2b25c7=_0x10e2ef;return _0x10e2ef[_0xd8a6('0x71')]();}return null;})[_0xd8a6('0x28')](function(_0x115666){if(_0x115666){if(!_0x115666['length']){throw new db[(_0xd8a6('0x72'))][(_0xd8a6('0x73'))](_0xd8a6('0x74'),0x193);}_0x59b1d9=_0x115666;return db[_0xd8a6('0x75')][_0xd8a6('0x76')]({'raw':!![]});}return null;})[_0xd8a6('0x28')](function(_0x35c6f5){if(_0x35c6f5){_0x21a75b=_[_0xd8a6('0x77')](_0x35c6f5,'id');var _0x5c58fe;var _0x141df9=squel['select']();_0x141df9[_0xd8a6('0x78')](_0x2b25c7[_0xd8a6('0x79')]);for(var _0xe37ac7=0x0;_0xe37ac7<_0x59b1d9[_0xd8a6('0x6b')];_0xe37ac7+=0x1){_0x5c58fe=_0x59b1d9[_0xe37ac7][_0xd8a6('0x7a')]?_0x21a75b[_0x59b1d9[_0xe37ac7][_0xd8a6('0x7a')]][_0xd8a6('0x7b')]:_0x59b1d9[_0xe37ac7][_0xd8a6('0x7c')];_0x5c58fe=_0x59b1d9[_0xe37ac7]['function']?_['replace'](_0xa433d6[_0x59b1d9[_0xe37ac7]['function']],'%s',_0x5c58fe):_0x5c58fe;_0x5c58fe=_0x59b1d9[_0xe37ac7][_0xd8a6('0x7d')]?_[_0xd8a6('0x7e')](_0x1600b6[_0x59b1d9[_0xe37ac7]['format']],'%s',_0x5c58fe):_0x5c58fe;if(_0x59b1d9[_0xe37ac7][_0xd8a6('0x7f')]){_0x141df9[_0xd8a6('0x6e')](_0x5c58fe);}_0x59b1d9[_0xe37ac7][_0xd8a6('0x80')]&&_0x141df9[_0xd8a6('0x40')](_0x5c58fe,_0x59b1d9[_0xe37ac7][_0xd8a6('0x80')]===_0xd8a6('0x81')?![]:!![]);_0x141df9[_0xd8a6('0x7c')](_0x5c58fe,_0x59b1d9[_0xe37ac7][_0xd8a6('0x82')]||_0x5c58fe);}if(_0x2b25c7[_0xd8a6('0x83')]){_0x2b25c7[_0xd8a6('0x83')]=JSON[_0xd8a6('0x84')](_0x2b25c7['joins']);for(var _0x5d68c3=0x0;_0x5d68c3<_0x2b25c7['joins'][_0xd8a6('0x6b')];_0x5d68c3+=0x1){if(_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x45')]&&_[_0xd8a6('0x67')](_0x27cd4e,_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3]['type'])&&_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x85')]&&_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x86')]&&_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x87')]){_0x141df9[_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x45')]](_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x86')],null,util[_0xd8a6('0x7d')](_0xd8a6('0x88'),_0x2b25c7[_0xd8a6('0x79')],_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x85')],_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x86')],_0x2b25c7[_0xd8a6('0x83')][_0x5d68c3][_0xd8a6('0x87')]));}}}if(_0x2b25c7[_0xd8a6('0x89')]){_0x2b25c7[_0xd8a6('0x89')]=JSON[_0xd8a6('0x84')](_0x2b25c7[_0xd8a6('0x89')]);_0x141df9[_0xd8a6('0x44')](_0x711e73(_0x2b25c7[_0xd8a6('0x89')][_0xd8a6('0x6e')]));}_0x562e13=_0x141df9[_0xd8a6('0x8a')]();_0x141df9[_0xd8a6('0x22')](_0x574d14);_0x141df9[_0xd8a6('0x20')](0x0);logger[_0xd8a6('0x8b')]('Limited\x20Query:',_0x141df9['toString']());return dbH[_0xd8a6('0x8c')][_0xd8a6('0x38')](_0x141df9[_0xd8a6('0x8d')](),{'type':dbH['sequelize'][_0xd8a6('0x8e')][_0xd8a6('0x8f')]});}})[_0xd8a6('0x28')](respondWithResult(_0x2fa7fb,null))[_0xd8a6('0x4b')](handleError(_0x2fa7fb,null));};function runReport(_0x175f26,_0x41ac2a,_0x1fff2b){var _0x5f6345=_0x41ac2a['name'];var _0x5e4422=0xa;var _0x4af92c=[_0xd8a6('0x90'),_0xd8a6('0x58'),_0xd8a6('0x59'),_0xd8a6('0x5a')];var _0x7c95d9={'SUM':_0xd8a6('0x5b'),'COUNT':_0xd8a6('0x91'),'COUNT DISTINCT':_0xd8a6('0x5c'),'MAX':_0xd8a6('0x5d'),'MIN':_0xd8a6('0x5e'),'AVG':_0xd8a6('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd8a6('0x61'),'GROUP_CONCAT DESC':_0xd8a6('0x62')};var _0x60ac43={'SEC_TO_TIME':_0xd8a6('0x63'),'DATE':'DATE(%s)','HOUR':_0xd8a6('0x65'),'ROUND':_0xd8a6('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c5817=function(_0x45dc7f){return!_[_0xd8a6('0x67')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xd8a6('0x69'),_0xd8a6('0x6a')],_0x45dc7f);};var _0x161e6f=function(_0x14f75b){if(!_0x14f75b||!_0x14f75b[_0xd8a6('0x6c')][_0xd8a6('0x6b')]){return'';}for(var _0x1685a7='(',_0x1ca32f=0x0;_0x1ca32f<_0x14f75b[_0xd8a6('0x6c')][_0xd8a6('0x6b')];_0x1ca32f+=0x1){_0x1ca32f>0x0&&(_0x1685a7+='\x20'+_0x14f75b[_0xd8a6('0x6d')]+'\x20');_0x1685a7+=_0x14f75b[_0xd8a6('0x6c')][_0x1ca32f][_0xd8a6('0x6e')]?_0x161e6f(_0x14f75b['rules'][_0x1ca32f]['group']):_0x14f75b[_0xd8a6('0x6c')][_0x1ca32f][_0xd8a6('0x7c')]+'\x20'+_0x14f75b[_0xd8a6('0x6c')][_0x1ca32f][_0xd8a6('0x6f')]+(_0x1c5817(_0x14f75b['rules'][_0x1ca32f][_0xd8a6('0x6f')])?'\x20'+_0x14f75b[_0xd8a6('0x6c')][_0x1ca32f][_0xd8a6('0x70')]:'');}return _0x1685a7+')';};var _0x1f22ed={'where':{'id':_0x175f26['id']}},_0x59e550,_0xe5cad6,_0x116e0f,_0x5c82f5,_0x1e37f1;_0x1f22ed=_[_0xd8a6('0x43')]({},_0x1f22ed,_0x1fff2b);return db[_0xd8a6('0x33')][_0xd8a6('0x4d')](_0x1f22ed)[_0xd8a6('0x28')](function(_0x4bfbde){if(_0x4bfbde){_0x59e550=_0x4bfbde;return _0x4bfbde['getFields']();}return null;})[_0xd8a6('0x28')](function(_0x5d987f){if(_0x5d987f){if(!_0x5d987f[_0xd8a6('0x6b')]){throw new db[(_0xd8a6('0x72'))][(_0xd8a6('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe5cad6=_0x5d987f;return db[_0xd8a6('0x75')][_0xd8a6('0x76')]({'raw':!![]});}return null;})[_0xd8a6('0x28')](function(_0x31d144){if(_0x31d144){_0x116e0f=_[_0xd8a6('0x77')](_0x31d144,'id');var _0x361e9c;var _0xe2d4ff=squel[_0xd8a6('0x92')]();_0xe2d4ff[_0xd8a6('0x78')](_0x59e550[_0xd8a6('0x79')]);for(var _0x188502=0x0;_0x188502<_0xe5cad6[_0xd8a6('0x6b')];_0x188502+=0x1){_0x361e9c=_0xe5cad6[_0x188502][_0xd8a6('0x7a')]?_0x116e0f[_0xe5cad6[_0x188502][_0xd8a6('0x7a')]][_0xd8a6('0x7b')]:_0xe5cad6[_0x188502][_0xd8a6('0x7c')];_0x361e9c=_0xe5cad6[_0x188502][_0xd8a6('0x93')]?_[_0xd8a6('0x7e')](_0x7c95d9[_0xe5cad6[_0x188502]['function']],'%s',_0x361e9c):_0x361e9c;_0x361e9c=_0xe5cad6[_0x188502][_0xd8a6('0x7d')]?_[_0xd8a6('0x7e')](_0x60ac43[_0xe5cad6[_0x188502][_0xd8a6('0x7d')]],'%s',_0x361e9c):_0x361e9c;if(_0xe5cad6[_0x188502][_0xd8a6('0x7f')]){_0xe2d4ff[_0xd8a6('0x6e')](_0x361e9c);}_0xe5cad6[_0x188502][_0xd8a6('0x80')]&&_0xe2d4ff[_0xd8a6('0x40')](_0x361e9c,_0xe5cad6[_0x188502][_0xd8a6('0x80')]==='DESC'?![]:!![]);_0xe2d4ff[_0xd8a6('0x7c')](_0x361e9c,_0xe5cad6[_0x188502][_0xd8a6('0x82')]||_0x361e9c);}if(_0x59e550[_0xd8a6('0x83')]){_0x59e550[_0xd8a6('0x83')]=JSON['parse'](_0x59e550[_0xd8a6('0x83')]);for(var _0x1fb924=0x0;_0x1fb924<_0x59e550[_0xd8a6('0x83')][_0xd8a6('0x6b')];_0x1fb924+=0x1){if(_0x59e550[_0xd8a6('0x83')][_0x1fb924][_0xd8a6('0x45')]&&_[_0xd8a6('0x67')](_0x4af92c,_0x59e550[_0xd8a6('0x83')][_0x1fb924][_0xd8a6('0x45')])&&_0x59e550['joins'][_0x1fb924][_0xd8a6('0x85')]&&_0x59e550[_0xd8a6('0x83')][_0x1fb924][_0xd8a6('0x86')]&&_0x59e550['joins'][_0x1fb924][_0xd8a6('0x87')]){_0xe2d4ff[_0x59e550[_0xd8a6('0x83')][_0x1fb924][_0xd8a6('0x45')]](_0x59e550['joins'][_0x1fb924][_0xd8a6('0x86')],null,util[_0xd8a6('0x7d')](_0xd8a6('0x88'),_0x59e550['table'],_0x59e550[_0xd8a6('0x83')][_0x1fb924][_0xd8a6('0x85')],_0x59e550[_0xd8a6('0x83')][_0x1fb924]['foreignTable'],_0x59e550[_0xd8a6('0x83')][_0x1fb924][_0xd8a6('0x87')]));}}}if(_0x59e550[_0xd8a6('0x89')]){_0x59e550[_0xd8a6('0x89')]=JSON[_0xd8a6('0x84')](_0x59e550['conditions']);_0xe2d4ff['where'](_0x161e6f(_0x59e550[_0xd8a6('0x89')][_0xd8a6('0x6e')]));}_0x1e37f1=_0xe2d4ff[_0xd8a6('0x8a')]();_0xe2d4ff[_0xd8a6('0x22')](_0x5e4422);_0xe2d4ff[_0xd8a6('0x20')](0x0);return;}})['then'](function(){if(_0x41ac2a[_0xd8a6('0x94')]===_0xd8a6('0x95')){return null;}var _0x2dee06=_[_0xd8a6('0x43')](_0x41ac2a,{'name':_0x41ac2a[_0xd8a6('0x96')]||_0x41ac2a[_0xd8a6('0x2f')]||_0x59e550[_0xd8a6('0x2f')],'basename':_0x5f6345,'savename':util[_0xd8a6('0x7d')](_0xd8a6('0x97'),_0x41ac2a[_0xd8a6('0x2f')]||_0x59e550[_0xd8a6('0x2f')],require('randomstring')[_0xd8a6('0x98')](0x4),_0x41ac2a[_0xd8a6('0x94')]||_0xd8a6('0x99')),'reportId':_0x59e550['id'],'reportType':_0xd8a6('0x9a')});return db['AnalyticExtractedReport'][_0xd8a6('0x4e')](_0x2dee06,{'raw':!![]});})[_0xd8a6('0x28')](function(_0x4d95cd){if(_0x59e550[_0xd8a6('0x79')]===_0xd8a6('0x9b')){_0x1e37f1['where'](_0x59e550['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x41ac2a[_0xd8a6('0x9c')],_0x41ac2a[_0xd8a6('0x9d')]);}else{_0x1e37f1['where'](_0x59e550[_0xd8a6('0x79')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x41ac2a[_0xd8a6('0x9c')],_0x41ac2a['endDate']);}if(_0x4d95cd){logger['info'](_0xd8a6('0x9e'),_0x1e37f1[_0xd8a6('0x8d')]());require(_0xd8a6('0x9f'))[_0xd8a6('0xa0')](path[_0xd8a6('0x90')](__dirname,_0xd8a6('0xa1'),_0x4d95cd[_0xd8a6('0x94')]),[_0x4d95cd['id'],_0x1e37f1[_0xd8a6('0x8d')](),path[_0xd8a6('0x90')](__dirname,_0xd8a6('0xa2'),_0x4d95cd[_0xd8a6('0xa3')]),_0x5f6345]);return _0x4d95cd;}else{var _0x439113=squel['select']();_0x439113[_0xd8a6('0x78')]('('+_0x1e37f1['toString']()+')',_0xd8a6('0xa4'));_0x439113[_0xd8a6('0x7c')](_0xd8a6('0xa5'),_0xd8a6('0xa6'));_0x1e37f1['limit'](_0x41ac2a[_0xd8a6('0x22')]||_0x5e4422);_0x1e37f1[_0xd8a6('0x20')](_0x41ac2a['offset']||0x0);return dbH[_0xd8a6('0x8c')][_0xd8a6('0x38')](_0x439113['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xd8a6('0x8f')]})[_0xd8a6('0x28')](function(_0xf3a3da){if(!_0xf3a3da[_0xd8a6('0x6b')]){_0x5c82f5=0x0;}else{_0x5c82f5=_0xf3a3da[0x0][_0xd8a6('0xa6')]||0x0;}return dbH[_0xd8a6('0x8c')]['query'](_0x1e37f1[_0xd8a6('0x8d')](),{'type':dbH[_0xd8a6('0x8c')][_0xd8a6('0x8e')]['SELECT']});})[_0xd8a6('0x28')](function(_0x4da13e){return{'rows':_0x4da13e||[],'count':_0x5c82f5};});}});}exports[_0xd8a6('0xa7')]=function(_0x15f7a6,_0x2e6834){return runReport(_0x15f7a6[_0xd8a6('0x4c')],_0x15f7a6[_0xd8a6('0x38')],_0x15f7a6['options'])[_0xd8a6('0x28')](respondWithResult(_0x2e6834,null))[_0xd8a6('0x4b')](handleError(_0x2e6834,null));};exports[_0xd8a6('0xa8')]=runReport;exports[_0xd8a6('0x38')]=function(_0x312159,_0xa3944d){var _0x407e40=0xa;var _0x5a4e69=[_0xd8a6('0x90'),_0xd8a6('0x58'),_0xd8a6('0x59'),_0xd8a6('0x5a')];var _0x1ae66a={'SUM':_0xd8a6('0x5b'),'COUNT':_0xd8a6('0x91'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xd8a6('0x5f'),'GROUP_CONCAT':_0xd8a6('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4482fa={'SEC_TO_TIME':_0xd8a6('0x63'),'DATE':'DATE(%s)','HOUR':_0xd8a6('0x65'),'ROUND':_0xd8a6('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45a5dc=function(_0x1b8127){return!_['includes']([_0xd8a6('0x68'),'IS\x20NOT\x20NULL',_0xd8a6('0x69'),_0xd8a6('0x6a')],_0x1b8127);};var _0x64f9c7=function(_0x57bc8a){if(!_0x57bc8a||!_0x57bc8a[_0xd8a6('0x6c')][_0xd8a6('0x6b')]){return'';}for(var _0xbfff0e='(',_0x592082=0x0;_0x592082<_0x57bc8a[_0xd8a6('0x6c')][_0xd8a6('0x6b')];_0x592082+=0x1){_0x592082>0x0&&(_0xbfff0e+='\x20'+_0x57bc8a[_0xd8a6('0x6d')]+'\x20');_0xbfff0e+=_0x57bc8a['rules'][_0x592082][_0xd8a6('0x6e')]?_0x64f9c7(_0x57bc8a['rules'][_0x592082][_0xd8a6('0x6e')]):_0x57bc8a[_0xd8a6('0x6c')][_0x592082]['field']+'\x20'+_0x57bc8a[_0xd8a6('0x6c')][_0x592082][_0xd8a6('0x6f')]+(_0x45a5dc(_0x57bc8a['rules'][_0x592082][_0xd8a6('0x6f')])?'\x20'+_0x57bc8a['rules'][_0x592082][_0xd8a6('0x70')]:'');}return _0xbfff0e+')';};var _0x11412f={'where':{'id':_0x312159['params']['id']}},_0x54f597,_0x166342,_0x277c86,_0x252138,_0x17c6d7;_0x11412f=_[_0xd8a6('0x43')]({},_0x11412f,_0x312159[_0xd8a6('0x47')]);return db['AnalyticCustomReport'][_0xd8a6('0x4d')](_0x11412f)[_0xd8a6('0x28')](function(_0x3e6ae8){if(_0x3e6ae8){_0x54f597=_0x3e6ae8;return _0x3e6ae8[_0xd8a6('0x71')]();}return null;})[_0xd8a6('0x28')](function(_0x1562e6){if(_0x1562e6){if(!_0x1562e6[_0xd8a6('0x6b')]){throw new db['Sequelize'][(_0xd8a6('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x166342=_0x1562e6;return db[_0xd8a6('0x75')][_0xd8a6('0x76')]({'raw':!![]});}return null;})['then'](function(_0x3a063f){if(_0x3a063f){_0x277c86=_[_0xd8a6('0x77')](_0x3a063f,'id');var _0x46ad3c;var _0x5c30cb=squel['select']();_0x5c30cb[_0xd8a6('0x78')](_0x54f597[_0xd8a6('0x79')]);for(var _0x5521d3=0x0;_0x5521d3<_0x166342[_0xd8a6('0x6b')];_0x5521d3+=0x1){_0x46ad3c=_0x166342[_0x5521d3][_0xd8a6('0x7a')]?_0x277c86[_0x166342[_0x5521d3]['MetricId']][_0xd8a6('0x7b')]:_0x166342[_0x5521d3]['field'];_0x46ad3c=_0x166342[_0x5521d3][_0xd8a6('0x93')]?_['replace'](_0x1ae66a[_0x166342[_0x5521d3][_0xd8a6('0x93')]],'%s',_0x46ad3c):_0x46ad3c;_0x46ad3c=_0x166342[_0x5521d3]['format']?_[_0xd8a6('0x7e')](_0x4482fa[_0x166342[_0x5521d3][_0xd8a6('0x7d')]],'%s',_0x46ad3c):_0x46ad3c;if(_0x166342[_0x5521d3][_0xd8a6('0x7f')]){_0x5c30cb['group'](_0x46ad3c);}_0x166342[_0x5521d3]['orderBy']&&_0x5c30cb[_0xd8a6('0x40')](_0x46ad3c,_0x166342[_0x5521d3][_0xd8a6('0x80')]==='DESC'?![]:!![]);_0x5c30cb['field'](_0x46ad3c,_0x166342[_0x5521d3][_0xd8a6('0x82')]||_0x46ad3c);}if(_0x54f597[_0xd8a6('0x83')]){_0x54f597[_0xd8a6('0x83')]=JSON[_0xd8a6('0x84')](_0x54f597[_0xd8a6('0x83')]);for(var _0x34bcec=0x0;_0x34bcec<_0x54f597[_0xd8a6('0x83')][_0xd8a6('0x6b')];_0x34bcec+=0x1){if(_0x54f597['joins'][_0x34bcec][_0xd8a6('0x45')]&&_[_0xd8a6('0x67')](_0x5a4e69,_0x54f597['joins'][_0x34bcec][_0xd8a6('0x45')])&&_0x54f597['joins'][_0x34bcec][_0xd8a6('0x85')]&&_0x54f597[_0xd8a6('0x83')][_0x34bcec]['foreignTable']&&_0x54f597['joins'][_0x34bcec][_0xd8a6('0x87')]){_0x5c30cb[_0x54f597[_0xd8a6('0x83')][_0x34bcec][_0xd8a6('0x45')]](_0x54f597[_0xd8a6('0x83')][_0x34bcec][_0xd8a6('0x86')],null,util[_0xd8a6('0x7d')](_0xd8a6('0x88'),_0x54f597[_0xd8a6('0x79')],_0x54f597[_0xd8a6('0x83')][_0x34bcec]['parentKey'],_0x54f597[_0xd8a6('0x83')][_0x34bcec][_0xd8a6('0x86')],_0x54f597[_0xd8a6('0x83')][_0x34bcec][_0xd8a6('0x87')]));}}}if(_0x54f597[_0xd8a6('0x89')]){_0x54f597[_0xd8a6('0x89')]=JSON[_0xd8a6('0x84')](_0x54f597['conditions']);_0x5c30cb[_0xd8a6('0x44')](_0x64f9c7(_0x54f597[_0xd8a6('0x89')][_0xd8a6('0x6e')]));}_0x17c6d7=_0x5c30cb[_0xd8a6('0x8a')]();_0x5c30cb['limit'](_0x407e40);_0x5c30cb[_0xd8a6('0x20')](0x0);logger[_0xd8a6('0x8b')](_0xd8a6('0xa9'),_0x5c30cb[_0xd8a6('0x8d')]());return dbH['sequelize'][_0xd8a6('0x38')](_0x5c30cb[_0xd8a6('0x8d')](),{'type':dbH[_0xd8a6('0x8c')][_0xd8a6('0x8e')][_0xd8a6('0x8f')]});}})[_0xd8a6('0x28')](function(){return{'sql':_0x17c6d7[_0xd8a6('0x8d')]()};})[_0xd8a6('0x28')](respondWithResult(_0xa3944d,null))[_0xd8a6('0x4b')](handleError(_0xa3944d,null));}; \ No newline at end of file +var _0x012b=['limit','set','Content-Range','apply','reject','save','update','then','CustomReports','UserProfileResource','destroy','error','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','nolimit','sort','where','filter','merge','options','includeAll','show','params','keys','include','find','catch','create','user','get','role','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','IS\x20NOT\x20NULL','findAll','output','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','run','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x10c44f,_0x46c752){var _0x3065c1=function(_0x422238){while(--_0x422238){_0x10c44f['push'](_0x10c44f['shift']());}};_0x3065c1(++_0x46c752);}(_0x012b,0x11c));var _0xb012=function(_0x190792,_0x1b93ea){_0x190792=_0x190792-0x0;var _0xa63f9b=_0x012b[_0x190792];return _0xa63f9b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb012('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb012('0x1'));var moment=require(_0xb012('0x2'));var BPromise=require(_0xb012('0x3'));var Mustache=require(_0xb012('0x4'));var util=require(_0xb012('0x5'));var path=require(_0xb012('0x6'));var sox=require(_0xb012('0x7'));var csv=require(_0xb012('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb012('0x9'));var _=require('lodash');var squel=require(_0xb012('0xa'));var crypto=require(_0xb012('0xb'));var jsforce=require(_0xb012('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb012('0xd'));var authService=require(_0xb012('0xe'));var qs=require(_0xb012('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb012('0x10'));var logger=require(_0xb012('0x11'))(_0xb012('0x12'));var utils=require(_0xb012('0x13'));var config=require(_0xb012('0x14'));var licenseUtil=require(_0xb012('0x15'));var db=require(_0xb012('0x16'))['db'];var dbH=require(_0xb012('0x16'))['dbH'];function respondWithStatusCode(_0x3ac288,_0x2ac644){_0x2ac644=_0x2ac644||0xcc;return function(_0x997d21){if(_0x997d21){return _0x3ac288[_0xb012('0x17')](_0x2ac644);}return _0x3ac288[_0xb012('0x18')](_0x2ac644)[_0xb012('0x19')]();};}function respondWithResult(_0x1645dd,_0x4b282e){_0x4b282e=_0x4b282e||0xc8;return function(_0xac2575){if(_0xac2575){return _0x1645dd['status'](_0x4b282e)[_0xb012('0x1a')](_0xac2575);}};}function respondWithFilteredResult(_0xaf9581,_0x476306){return function(_0x23e7e0){if(_0x23e7e0){var _0x3f98f1=typeof _0x476306[_0xb012('0x1b')]===_0xb012('0x1c')&&typeof _0x476306['limit']===_0xb012('0x1c');var _0x315ad6=_0x23e7e0['count'];var _0x574e64=_0x3f98f1?0x0:_0x476306[_0xb012('0x1b')];var _0x1e814f=_0x3f98f1?_0x23e7e0[_0xb012('0x1d')]:_0x476306[_0xb012('0x1b')]+_0x476306[_0xb012('0x1e')];var _0x6de4ae;if(_0x1e814f>=_0x315ad6){_0x1e814f=_0x315ad6;_0x6de4ae=0xc8;}else{_0x6de4ae=0xce;}_0xaf9581[_0xb012('0x18')](_0x6de4ae);return _0xaf9581[_0xb012('0x1f')](_0xb012('0x20'),_0x574e64+'-'+_0x1e814f+'/'+_0x315ad6)[_0xb012('0x1a')](_0x23e7e0);}return null;};}function patchUpdates(_0x48ecf0){return function(_0x5c1cf7){try{jsonpatch[_0xb012('0x21')](_0x5c1cf7,_0x48ecf0,!![]);}catch(_0x32ea0b){return BPromise[_0xb012('0x22')](_0x32ea0b);}return _0x5c1cf7[_0xb012('0x23')]();};}function saveUpdates(_0x48b7d8,_0x4f5254){return function(_0x1221f1){if(_0x1221f1){return _0x1221f1[_0xb012('0x24')](_0x48b7d8)[_0xb012('0x25')](function(_0x20f61d){return _0x20f61d;});}return null;};}function removeEntity(_0x16285b,_0x53e906){return function(_0x6e42a1){if(_0x6e42a1){return _0x6e42a1['destroy']()[_0xb012('0x25')](function(){var _0x43b794=_0x6e42a1['get']({'plain':!![]});var _0x3247cd=_0xb012('0x26');return db[_0xb012('0x27')][_0xb012('0x28')]({'where':{'type':_0x3247cd,'resourceId':_0x43b794['id']}})[_0xb012('0x25')](function(){return _0x6e42a1;});})[_0xb012('0x25')](function(){_0x16285b[_0xb012('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e777,_0x280dfd){return function(_0x367ed8){if(!_0x367ed8){_0x23e777[_0xb012('0x17')](0x194);}return _0x367ed8;};}function handleError(_0x4f8892,_0x2e98b2){_0x2e98b2=_0x2e98b2||0x1f4;return function(_0x4fad8b){logger[_0xb012('0x29')](_0x4fad8b['stack']);if(_0x4fad8b[_0xb012('0x2a')]){delete _0x4fad8b[_0xb012('0x2a')];}_0x4f8892[_0xb012('0x18')](_0x2e98b2)[_0xb012('0x2b')](_0x4fad8b);};}exports[_0xb012('0x2c')]=function(_0x16891e,_0x6b08da){var _0x5d3a87={},_0x3bb248={},_0xbd3364={'count':0x0,'rows':[]};var _0x204bec=_['map'](db[_0xb012('0x2d')][_0xb012('0x2e')],function(_0x109a67){return{'name':_0x109a67[_0xb012('0x2f')],'type':_0x109a67[_0xb012('0x30')]['key']};});_0x3bb248[_0xb012('0x31')]=_[_0xb012('0x32')](_0x204bec,_0xb012('0x2a'));_0x3bb248[_0xb012('0x33')]=_['keys'](_0x16891e['query']);_0x3bb248[_0xb012('0x34')]=_['intersection'](_0x3bb248['model'],_0x3bb248['query']);_0x5d3a87[_0xb012('0x35')]=_[_0xb012('0x36')](_0x3bb248['model'],qs[_0xb012('0x37')](_0x16891e[_0xb012('0x33')][_0xb012('0x37')]));_0x5d3a87['attributes']=_0x5d3a87[_0xb012('0x35')]['length']?_0x5d3a87[_0xb012('0x35')]:_0x3bb248['model'];if(!_0x16891e['query']['hasOwnProperty'](_0xb012('0x38'))){_0x5d3a87[_0xb012('0x1e')]=qs[_0xb012('0x1e')](_0x16891e[_0xb012('0x33')][_0xb012('0x1e')]);_0x5d3a87[_0xb012('0x1b')]=qs[_0xb012('0x1b')](_0x16891e['query'][_0xb012('0x1b')]);}_0x5d3a87['order']=qs[_0xb012('0x39')](_0x16891e['query'][_0xb012('0x39')]);_0x5d3a87[_0xb012('0x3a')]=qs[_0xb012('0x34')](_['pick'](_0x16891e[_0xb012('0x33')],_0x3bb248[_0xb012('0x34')]),_0x204bec);if(_0x16891e['query'][_0xb012('0x3b')]){_0x5d3a87[_0xb012('0x3a')]=_[_0xb012('0x3c')](_0x5d3a87['where'],{'$or':_['map'](_0x204bec,function(_0x38be76){if(_0x38be76[_0xb012('0x30')]!=='VIRTUAL'){var _0x10feab={};_0x10feab[_0x38be76[_0xb012('0x2a')]]={'$like':'%'+_0x16891e['query']['filter']+'%'};return _0x10feab;}})});}_0x5d3a87=_[_0xb012('0x3c')]({},_0x5d3a87,_0x16891e[_0xb012('0x3d')]);var _0x3e24b9={'where':_0x5d3a87[_0xb012('0x3a')]};return db[_0xb012('0x2d')][_0xb012('0x1d')](_0x3e24b9)[_0xb012('0x25')](function(_0x117f41){_0xbd3364[_0xb012('0x1d')]=_0x117f41;if(_0x16891e[_0xb012('0x33')][_0xb012('0x3e')]){_0x5d3a87['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x5d3a87);})[_0xb012('0x25')](function(_0x18379e){_0xbd3364['rows']=_0x18379e;return _0xbd3364;})[_0xb012('0x25')](respondWithFilteredResult(_0x6b08da,_0x5d3a87))['catch'](handleError(_0x6b08da,null));};exports[_0xb012('0x3f')]=function(_0x24381b,_0x50afd5){var _0x4a0dde={'raw':![],'where':{'id':_0x24381b[_0xb012('0x40')]['id']}},_0x5a93ca={};_0x5a93ca[_0xb012('0x31')]=_['keys'](db[_0xb012('0x2d')][_0xb012('0x2e')]);_0x5a93ca[_0xb012('0x33')]=_[_0xb012('0x41')](_0x24381b[_0xb012('0x33')]);_0x5a93ca[_0xb012('0x34')]=_[_0xb012('0x36')](_0x5a93ca[_0xb012('0x31')],_0x5a93ca[_0xb012('0x33')]);_0x4a0dde[_0xb012('0x35')]=_[_0xb012('0x36')](_0x5a93ca['model'],qs[_0xb012('0x37')](_0x24381b['query'][_0xb012('0x37')]));_0x4a0dde[_0xb012('0x35')]=_0x4a0dde[_0xb012('0x35')]['length']?_0x4a0dde[_0xb012('0x35')]:_0x5a93ca[_0xb012('0x31')];if(_0x24381b['query']['includeAll']){_0x4a0dde[_0xb012('0x42')]=[{'all':!![]}];}_0x4a0dde=_[_0xb012('0x3c')]({},_0x4a0dde,_0x24381b['options']);return db[_0xb012('0x2d')][_0xb012('0x43')](_0x4a0dde)['then'](handleEntityNotFound(_0x50afd5,null))[_0xb012('0x25')](respondWithResult(_0x50afd5,null))[_0xb012('0x44')](handleError(_0x50afd5,null));};exports[_0xb012('0x45')]=function(_0x22c654,_0x56ee4d){return db['AnalyticCustomReport']['create'](_0x22c654['body'],{})[_0xb012('0x25')](function(_0x43e7f4){var _0x2d8103=_0x22c654[_0xb012('0x46')][_0xb012('0x47')]({'plain':!![]});if(!_0x2d8103)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d8103[_0xb012('0x48')]===_0xb012('0x46')){var _0xf9e00f=_0x43e7f4[_0xb012('0x47')]({'plain':!![]});var _0x1e2d55=_0xb012('0x49');return db[_0xb012('0x4a')][_0xb012('0x43')]({'where':{'name':_0x1e2d55,'userProfileId':_0x2d8103['userProfileId']},'raw':!![]})[_0xb012('0x25')](function(_0x5ad1aa){if(_0x5ad1aa&&_0x5ad1aa[_0xb012('0x4b')]===0x0){return db[_0xb012('0x27')][_0xb012('0x45')]({'name':_0xf9e00f[_0xb012('0x2a')],'resourceId':_0xf9e00f['id'],'type':'CustomReports','sectionId':_0x5ad1aa['id']},{})[_0xb012('0x25')](function(){return _0x43e7f4;});}else{return _0x43e7f4;}})['catch'](function(_0xc9ad5b){logger['error'](_0xb012('0x4c'),_0xc9ad5b);throw _0xc9ad5b;});}return _0x43e7f4;})[_0xb012('0x25')](respondWithResult(_0x56ee4d,0xc9))['catch'](handleError(_0x56ee4d,null));};exports[_0xb012('0x24')]=function(_0x27aad0,_0x6b4407){if(_0x27aad0[_0xb012('0x4d')]['id']){delete _0x27aad0[_0xb012('0x4d')]['id'];}return db[_0xb012('0x2d')][_0xb012('0x43')]({'where':{'id':_0x27aad0[_0xb012('0x40')]['id']}})[_0xb012('0x25')](handleEntityNotFound(_0x6b4407,null))[_0xb012('0x25')](saveUpdates(_0x27aad0[_0xb012('0x4d')],null))[_0xb012('0x25')](respondWithResult(_0x6b4407,null))[_0xb012('0x44')](handleError(_0x6b4407,null));};exports[_0xb012('0x28')]=function(_0x21751f,_0x197e4f){return db[_0xb012('0x2d')][_0xb012('0x43')]({'where':{'id':_0x21751f[_0xb012('0x40')]['id']}})[_0xb012('0x25')](handleEntityNotFound(_0x197e4f,null))[_0xb012('0x25')](removeEntity(_0x197e4f,null))[_0xb012('0x44')](handleError(_0x197e4f,null));};exports[_0xb012('0x4e')]=function(_0x2db06,_0x165ea3){var _0x5abb2d=0xa;var _0x23c6fc=[_0xb012('0x4f'),'left_join',_0xb012('0x50'),_0xb012('0x51')];var _0x52f1b7={'SUM':_0xb012('0x52'),'COUNT':_0xb012('0x53'),'COUNT DISTINCT':_0xb012('0x54'),'MAX':_0xb012('0x55'),'MIN':'MIN(%s)','AVG':_0xb012('0x56'),'GROUP_CONCAT':_0xb012('0x57'),'GROUP_CONCAT ASC':_0xb012('0x58'),'GROUP_CONCAT DESC':_0xb012('0x59')};var _0x508be6={'SEC_TO_TIME':_0xb012('0x5a'),'DATE':_0xb012('0x5b'),'HOUR':_0xb012('0x5c'),'ROUND':_0xb012('0x5d'),'UNIX_TIMESTAMP':_0xb012('0x5e')};var _0x2e1067=function(_0x152f22){return!_[_0xb012('0x5f')]([_0xb012('0x60'),'IS\x20NOT\x20NULL',_0xb012('0x61'),_0xb012('0x62')],_0x152f22);};var _0x3c213e=function(_0x48502f){if(!_0x48502f||!_0x48502f[_0xb012('0x63')][_0xb012('0x64')]){return'';}for(var _0xe12621='(',_0x56b467=0x0;_0x56b467<_0x48502f[_0xb012('0x63')][_0xb012('0x64')];_0x56b467+=0x1){_0x56b467>0x0&&(_0xe12621+='\x20'+_0x48502f[_0xb012('0x65')]+'\x20');_0xe12621+=_0x48502f['rules'][_0x56b467][_0xb012('0x66')]?_0x3c213e(_0x48502f['rules'][_0x56b467][_0xb012('0x66')]):_0x48502f[_0xb012('0x63')][_0x56b467]['field']+'\x20'+_0x48502f['rules'][_0x56b467][_0xb012('0x67')]+(_0x2e1067(_0x48502f['rules'][_0x56b467]['condition'])?'\x20'+_0x48502f[_0xb012('0x63')][_0x56b467][_0xb012('0x68')]:'');}return _0xe12621+')';};var _0x4e2985={'where':{'id':_0x2db06[_0xb012('0x40')]['id']}},_0x267e46,_0x56a6f2,_0x1c9e3d,_0x5fbc55,_0x2ed666;_0x4e2985=_[_0xb012('0x3c')]({},_0x4e2985,_0x2db06['options']);return db[_0xb012('0x2d')]['find'](_0x4e2985)[_0xb012('0x25')](function(_0x5ed1bf){if(_0x5ed1bf){_0x267e46=_0x5ed1bf;return _0x5ed1bf['getFields']();}return null;})[_0xb012('0x25')](function(_0x233b3b){if(_0x233b3b){if(!_0x233b3b[_0xb012('0x64')]){throw new db[(_0xb012('0x69'))][(_0xb012('0x6a'))](_0xb012('0x6b'),0x193);}_0x56a6f2=_0x233b3b;return db[_0xb012('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xb012('0x25')](function(_0x2b9b29){if(_0x2b9b29){_0x1c9e3d=_[_0xb012('0x6d')](_0x2b9b29,'id');var _0x44a89d;var _0x5286d0=squel[_0xb012('0x6e')]();_0x5286d0[_0xb012('0x6f')](_0x267e46[_0xb012('0x70')]);for(var _0x2e6128=0x0;_0x2e6128<_0x56a6f2['length'];_0x2e6128+=0x1){_0x44a89d=_0x56a6f2[_0x2e6128][_0xb012('0x71')]?_0x1c9e3d[_0x56a6f2[_0x2e6128]['MetricId']][_0xb012('0x72')]:_0x56a6f2[_0x2e6128][_0xb012('0x73')];_0x44a89d=_0x56a6f2[_0x2e6128]['function']?_['replace'](_0x52f1b7[_0x56a6f2[_0x2e6128][_0xb012('0x74')]],'%s',_0x44a89d):_0x44a89d;_0x44a89d=_0x56a6f2[_0x2e6128][_0xb012('0x75')]?_[_0xb012('0x76')](_0x508be6[_0x56a6f2[_0x2e6128][_0xb012('0x75')]],'%s',_0x44a89d):_0x44a89d;if(_0x56a6f2[_0x2e6128][_0xb012('0x77')]){_0x5286d0[_0xb012('0x66')](_0x44a89d);}_0x56a6f2[_0x2e6128][_0xb012('0x78')]&&_0x5286d0[_0xb012('0x79')](_0x44a89d,_0x56a6f2[_0x2e6128][_0xb012('0x78')]===_0xb012('0x7a')?![]:!![]);_0x5286d0[_0xb012('0x73')](_0x44a89d,_0x56a6f2[_0x2e6128][_0xb012('0x7b')]||_0x44a89d);}if(_0x267e46[_0xb012('0x7c')]){_0x267e46[_0xb012('0x7c')]=JSON[_0xb012('0x7d')](_0x267e46[_0xb012('0x7c')]);for(var _0x5aeed8=0x0;_0x5aeed8<_0x267e46[_0xb012('0x7c')][_0xb012('0x64')];_0x5aeed8+=0x1){if(_0x267e46[_0xb012('0x7c')][_0x5aeed8]['type']&&_['includes'](_0x23c6fc,_0x267e46['joins'][_0x5aeed8][_0xb012('0x30')])&&_0x267e46[_0xb012('0x7c')][_0x5aeed8][_0xb012('0x7e')]&&_0x267e46[_0xb012('0x7c')][_0x5aeed8]['foreignTable']&&_0x267e46['joins'][_0x5aeed8][_0xb012('0x7f')]){_0x5286d0[_0x267e46[_0xb012('0x7c')][_0x5aeed8][_0xb012('0x30')]](_0x267e46[_0xb012('0x7c')][_0x5aeed8][_0xb012('0x80')],null,util[_0xb012('0x75')](_0xb012('0x81'),_0x267e46['table'],_0x267e46['joins'][_0x5aeed8][_0xb012('0x7e')],_0x267e46['joins'][_0x5aeed8][_0xb012('0x80')],_0x267e46[_0xb012('0x7c')][_0x5aeed8][_0xb012('0x7f')]));}}}if(_0x267e46['conditions']){_0x267e46[_0xb012('0x82')]=JSON[_0xb012('0x7d')](_0x267e46['conditions']);_0x5286d0[_0xb012('0x3a')](_0x3c213e(_0x267e46[_0xb012('0x82')][_0xb012('0x66')]));}_0x2ed666=_0x5286d0[_0xb012('0x83')]();_0x5286d0[_0xb012('0x1e')](_0x5abb2d);_0x5286d0[_0xb012('0x1b')](0x0);logger['debug'](_0xb012('0x84'),_0x5286d0[_0xb012('0x85')]());return dbH[_0xb012('0x86')][_0xb012('0x33')](_0x5286d0['toString'](),{'type':dbH[_0xb012('0x86')][_0xb012('0x87')][_0xb012('0x88')]});}})[_0xb012('0x25')](respondWithResult(_0x165ea3,null))[_0xb012('0x44')](handleError(_0x165ea3,null));};function runReport(_0x5d2c4d,_0x229517,_0xa91891){var _0x10bf1c=_0x229517['name'];var _0x3559d8=0xa;var _0x10c9a0=[_0xb012('0x4f'),_0xb012('0x89'),_0xb012('0x50'),_0xb012('0x51')];var _0x301fa5={'SUM':'SUM(%s)','COUNT':_0xb012('0x53'),'COUNT DISTINCT':_0xb012('0x54'),'MAX':_0xb012('0x55'),'MIN':'MIN(%s)','AVG':_0xb012('0x56'),'GROUP_CONCAT':_0xb012('0x57'),'GROUP_CONCAT ASC':_0xb012('0x58'),'GROUP_CONCAT DESC':_0xb012('0x59')};var _0xde636b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb012('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xb012('0x5d'),'UNIX_TIMESTAMP':_0xb012('0x5e')};var _0x3b582b=function(_0x36efe1){return!_['includes']([_0xb012('0x60'),_0xb012('0x8a'),_0xb012('0x61'),_0xb012('0x62')],_0x36efe1);};var _0x45e890=function(_0x4d9c67){if(!_0x4d9c67||!_0x4d9c67['rules'][_0xb012('0x64')]){return'';}for(var _0x31e835='(',_0x2fae49=0x0;_0x2fae49<_0x4d9c67[_0xb012('0x63')][_0xb012('0x64')];_0x2fae49+=0x1){_0x2fae49>0x0&&(_0x31e835+='\x20'+_0x4d9c67[_0xb012('0x65')]+'\x20');_0x31e835+=_0x4d9c67[_0xb012('0x63')][_0x2fae49][_0xb012('0x66')]?_0x45e890(_0x4d9c67[_0xb012('0x63')][_0x2fae49]['group']):_0x4d9c67[_0xb012('0x63')][_0x2fae49][_0xb012('0x73')]+'\x20'+_0x4d9c67[_0xb012('0x63')][_0x2fae49]['condition']+(_0x3b582b(_0x4d9c67[_0xb012('0x63')][_0x2fae49][_0xb012('0x67')])?'\x20'+_0x4d9c67[_0xb012('0x63')][_0x2fae49][_0xb012('0x68')]:'');}return _0x31e835+')';};var _0x35c1bb={'where':{'id':_0x5d2c4d['id']}},_0x19b9f9,_0x5deb65,_0x46a67d,_0x21efb7,_0x28a7c6;_0x35c1bb=_[_0xb012('0x3c')]({},_0x35c1bb,_0xa91891);return db['AnalyticCustomReport']['find'](_0x35c1bb)[_0xb012('0x25')](function(_0x3ac25e){if(_0x3ac25e){_0x19b9f9=_0x3ac25e;return _0x3ac25e['getFields']();}return null;})['then'](function(_0x27391f){if(_0x27391f){if(!_0x27391f[_0xb012('0x64')]){throw new db[(_0xb012('0x69'))][(_0xb012('0x6a'))](_0xb012('0x6b'),0x193);}_0x5deb65=_0x27391f;return db['AnalyticMetric'][_0xb012('0x8b')]({'raw':!![]});}return null;})[_0xb012('0x25')](function(_0x25aa8e){if(_0x25aa8e){_0x46a67d=_['keyBy'](_0x25aa8e,'id');var _0x137af8;var _0x3fe241=squel[_0xb012('0x6e')]();_0x3fe241[_0xb012('0x6f')](_0x19b9f9['table']);for(var _0x375732=0x0;_0x375732<_0x5deb65[_0xb012('0x64')];_0x375732+=0x1){_0x137af8=_0x5deb65[_0x375732][_0xb012('0x71')]?_0x46a67d[_0x5deb65[_0x375732][_0xb012('0x71')]][_0xb012('0x72')]:_0x5deb65[_0x375732][_0xb012('0x73')];_0x137af8=_0x5deb65[_0x375732][_0xb012('0x74')]?_[_0xb012('0x76')](_0x301fa5[_0x5deb65[_0x375732][_0xb012('0x74')]],'%s',_0x137af8):_0x137af8;_0x137af8=_0x5deb65[_0x375732][_0xb012('0x75')]?_[_0xb012('0x76')](_0xde636b[_0x5deb65[_0x375732][_0xb012('0x75')]],'%s',_0x137af8):_0x137af8;if(_0x5deb65[_0x375732]['groupBy']){_0x3fe241['group'](_0x137af8);}_0x5deb65[_0x375732][_0xb012('0x78')]&&_0x3fe241[_0xb012('0x79')](_0x137af8,_0x5deb65[_0x375732][_0xb012('0x78')]===_0xb012('0x7a')?![]:!![]);_0x3fe241[_0xb012('0x73')](_0x137af8,_0x5deb65[_0x375732][_0xb012('0x7b')]||_0x137af8);}if(_0x19b9f9[_0xb012('0x7c')]){_0x19b9f9[_0xb012('0x7c')]=JSON[_0xb012('0x7d')](_0x19b9f9[_0xb012('0x7c')]);for(var _0x53d9f4=0x0;_0x53d9f4<_0x19b9f9[_0xb012('0x7c')][_0xb012('0x64')];_0x53d9f4+=0x1){if(_0x19b9f9[_0xb012('0x7c')][_0x53d9f4][_0xb012('0x30')]&&_[_0xb012('0x5f')](_0x10c9a0,_0x19b9f9[_0xb012('0x7c')][_0x53d9f4][_0xb012('0x30')])&&_0x19b9f9[_0xb012('0x7c')][_0x53d9f4][_0xb012('0x7e')]&&_0x19b9f9[_0xb012('0x7c')][_0x53d9f4][_0xb012('0x80')]&&_0x19b9f9[_0xb012('0x7c')][_0x53d9f4][_0xb012('0x7f')]){_0x3fe241[_0x19b9f9[_0xb012('0x7c')][_0x53d9f4][_0xb012('0x30')]](_0x19b9f9[_0xb012('0x7c')][_0x53d9f4][_0xb012('0x80')],null,util[_0xb012('0x75')](_0xb012('0x81'),_0x19b9f9[_0xb012('0x70')],_0x19b9f9[_0xb012('0x7c')][_0x53d9f4]['parentKey'],_0x19b9f9['joins'][_0x53d9f4][_0xb012('0x80')],_0x19b9f9['joins'][_0x53d9f4]['foreignKey']));}}}if(_0x19b9f9[_0xb012('0x82')]){_0x19b9f9['conditions']=JSON[_0xb012('0x7d')](_0x19b9f9[_0xb012('0x82')]);_0x3fe241[_0xb012('0x3a')](_0x45e890(_0x19b9f9[_0xb012('0x82')][_0xb012('0x66')]));}_0x28a7c6=_0x3fe241[_0xb012('0x83')]();_0x3fe241['limit'](_0x3559d8);_0x3fe241[_0xb012('0x1b')](0x0);return;}})[_0xb012('0x25')](function(){if(_0x229517[_0xb012('0x8c')]==='web'){return null;}var _0x4ee182=_['merge'](_0x229517,{'name':_0x229517[_0xb012('0x8d')]||_0x229517[_0xb012('0x2a')]||_0x19b9f9[_0xb012('0x2a')],'basename':_0x10bf1c,'savename':util['format'](_0xb012('0x8e'),_0x229517[_0xb012('0x2a')]||_0x19b9f9[_0xb012('0x2a')],require('randomstring')[_0xb012('0x8f')](0x4),_0x229517[_0xb012('0x8c')]||_0xb012('0x90')),'reportId':_0x19b9f9['id'],'reportType':'custom'});return db[_0xb012('0x91')]['create'](_0x4ee182,{'raw':!![]});})[_0xb012('0x25')](function(_0x1a826e){if(_0x19b9f9[_0xb012('0x70')]===_0xb012('0x92')){_0x28a7c6['where'](_0x19b9f9[_0xb012('0x70')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x229517[_0xb012('0x93')],_0x229517[_0xb012('0x94')]);}else{_0x28a7c6[_0xb012('0x3a')](_0x19b9f9[_0xb012('0x70')]+_0xb012('0x95'),_0x229517[_0xb012('0x93')],_0x229517[_0xb012('0x94')]);}if(_0x1a826e){logger[_0xb012('0x96')](_0xb012('0x97'),_0x28a7c6[_0xb012('0x85')]());require('child_process')[_0xb012('0x98')](path[_0xb012('0x4f')](__dirname,_0xb012('0x99'),_0x1a826e[_0xb012('0x8c')]),[_0x1a826e['id'],_0x28a7c6[_0xb012('0x85')](),path[_0xb012('0x4f')](__dirname,_0xb012('0x9a'),_0x1a826e[_0xb012('0x9b')]),_0x10bf1c]);return _0x1a826e;}else{var _0x527ff8=squel[_0xb012('0x6e')]();_0x527ff8[_0xb012('0x6f')]('('+_0x28a7c6[_0xb012('0x85')]()+')','countTable');_0x527ff8['field']('COUNT(*)',_0xb012('0x1d'));_0x28a7c6[_0xb012('0x1e')](_0x229517[_0xb012('0x1e')]||_0x3559d8);_0x28a7c6['offset'](_0x229517['offset']||0x0);return dbH[_0xb012('0x86')][_0xb012('0x33')](_0x527ff8[_0xb012('0x85')](),{'type':dbH[_0xb012('0x86')]['QueryTypes']['SELECT']})[_0xb012('0x25')](function(_0x2343bc){if(!_0x2343bc[_0xb012('0x64')]){_0x21efb7=0x0;}else{_0x21efb7=_0x2343bc[0x0][_0xb012('0x1d')]||0x0;}return dbH[_0xb012('0x86')][_0xb012('0x33')](_0x28a7c6[_0xb012('0x85')](),{'type':dbH[_0xb012('0x86')]['QueryTypes'][_0xb012('0x88')]});})[_0xb012('0x25')](function(_0x4484cb){return{'rows':_0x4484cb||[],'count':_0x21efb7};});}});}exports[_0xb012('0x9c')]=function(_0x20e555,_0x36c999){return runReport(_0x20e555['params'],_0x20e555['query'],_0x20e555[_0xb012('0x3d')])[_0xb012('0x25')](respondWithResult(_0x36c999,null))[_0xb012('0x44')](handleError(_0x36c999,null));};exports['runReport']=runReport;exports[_0xb012('0x33')]=function(_0x326955,_0x5cfcd7){var _0x5ded9a=0xa;var _0xca4849=['join','left_join',_0xb012('0x50'),'cross_join'];var _0x809313={'SUM':_0xb012('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb012('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xb012('0x56'),'GROUP_CONCAT':_0xb012('0x57'),'GROUP_CONCAT ASC':_0xb012('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x42bb62={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb012('0x5b'),'HOUR':_0xb012('0x5c'),'ROUND':_0xb012('0x5d'),'UNIX_TIMESTAMP':_0xb012('0x5e')};var _0x4d83f4=function(_0x471732){return!_[_0xb012('0x5f')]([_0xb012('0x60'),_0xb012('0x8a'),_0xb012('0x61'),'IS\x20NOT\x20EMPTY'],_0x471732);};var _0x422665=function(_0x43d694){if(!_0x43d694||!_0x43d694[_0xb012('0x63')]['length']){return'';}for(var _0x3e9902='(',_0x1bbc2b=0x0;_0x1bbc2b<_0x43d694[_0xb012('0x63')][_0xb012('0x64')];_0x1bbc2b+=0x1){_0x1bbc2b>0x0&&(_0x3e9902+='\x20'+_0x43d694[_0xb012('0x65')]+'\x20');_0x3e9902+=_0x43d694[_0xb012('0x63')][_0x1bbc2b][_0xb012('0x66')]?_0x422665(_0x43d694[_0xb012('0x63')][_0x1bbc2b][_0xb012('0x66')]):_0x43d694[_0xb012('0x63')][_0x1bbc2b][_0xb012('0x73')]+'\x20'+_0x43d694['rules'][_0x1bbc2b][_0xb012('0x67')]+(_0x4d83f4(_0x43d694['rules'][_0x1bbc2b][_0xb012('0x67')])?'\x20'+_0x43d694['rules'][_0x1bbc2b][_0xb012('0x68')]:'');}return _0x3e9902+')';};var _0x30e334={'where':{'id':_0x326955[_0xb012('0x40')]['id']}},_0x2a4e96,_0x43376d,_0x4910f6,_0xa08599,_0x4a3932;_0x30e334=_[_0xb012('0x3c')]({},_0x30e334,_0x326955[_0xb012('0x3d')]);return db[_0xb012('0x2d')][_0xb012('0x43')](_0x30e334)[_0xb012('0x25')](function(_0x1d5c32){if(_0x1d5c32){_0x2a4e96=_0x1d5c32;return _0x1d5c32['getFields']();}return null;})[_0xb012('0x25')](function(_0x3ec7f3){if(_0x3ec7f3){if(!_0x3ec7f3[_0xb012('0x64')]){throw new db['Sequelize']['ValidationErrorItem'](_0xb012('0x6b'),0x193);}_0x43376d=_0x3ec7f3;return db[_0xb012('0x6c')][_0xb012('0x8b')]({'raw':!![]});}return null;})[_0xb012('0x25')](function(_0x10fbbf){if(_0x10fbbf){_0x4910f6=_[_0xb012('0x6d')](_0x10fbbf,'id');var _0x501cfc;var _0x3f0c85=squel['select']();_0x3f0c85[_0xb012('0x6f')](_0x2a4e96[_0xb012('0x70')]);for(var _0x4ec41b=0x0;_0x4ec41b<_0x43376d[_0xb012('0x64')];_0x4ec41b+=0x1){_0x501cfc=_0x43376d[_0x4ec41b][_0xb012('0x71')]?_0x4910f6[_0x43376d[_0x4ec41b][_0xb012('0x71')]][_0xb012('0x72')]:_0x43376d[_0x4ec41b]['field'];_0x501cfc=_0x43376d[_0x4ec41b][_0xb012('0x74')]?_[_0xb012('0x76')](_0x809313[_0x43376d[_0x4ec41b][_0xb012('0x74')]],'%s',_0x501cfc):_0x501cfc;_0x501cfc=_0x43376d[_0x4ec41b][_0xb012('0x75')]?_[_0xb012('0x76')](_0x42bb62[_0x43376d[_0x4ec41b][_0xb012('0x75')]],'%s',_0x501cfc):_0x501cfc;if(_0x43376d[_0x4ec41b][_0xb012('0x77')]){_0x3f0c85[_0xb012('0x66')](_0x501cfc);}_0x43376d[_0x4ec41b][_0xb012('0x78')]&&_0x3f0c85[_0xb012('0x79')](_0x501cfc,_0x43376d[_0x4ec41b][_0xb012('0x78')]==='DESC'?![]:!![]);_0x3f0c85['field'](_0x501cfc,_0x43376d[_0x4ec41b][_0xb012('0x7b')]||_0x501cfc);}if(_0x2a4e96[_0xb012('0x7c')]){_0x2a4e96[_0xb012('0x7c')]=JSON['parse'](_0x2a4e96[_0xb012('0x7c')]);for(var _0x58a7a2=0x0;_0x58a7a2<_0x2a4e96['joins'][_0xb012('0x64')];_0x58a7a2+=0x1){if(_0x2a4e96[_0xb012('0x7c')][_0x58a7a2]['type']&&_[_0xb012('0x5f')](_0xca4849,_0x2a4e96[_0xb012('0x7c')][_0x58a7a2][_0xb012('0x30')])&&_0x2a4e96[_0xb012('0x7c')][_0x58a7a2]['parentKey']&&_0x2a4e96['joins'][_0x58a7a2]['foreignTable']&&_0x2a4e96[_0xb012('0x7c')][_0x58a7a2][_0xb012('0x7f')]){_0x3f0c85[_0x2a4e96[_0xb012('0x7c')][_0x58a7a2]['type']](_0x2a4e96[_0xb012('0x7c')][_0x58a7a2][_0xb012('0x80')],null,util[_0xb012('0x75')]('%s.%s\x20=\x20%s.%s',_0x2a4e96[_0xb012('0x70')],_0x2a4e96[_0xb012('0x7c')][_0x58a7a2][_0xb012('0x7e')],_0x2a4e96[_0xb012('0x7c')][_0x58a7a2][_0xb012('0x80')],_0x2a4e96[_0xb012('0x7c')][_0x58a7a2][_0xb012('0x7f')]));}}}if(_0x2a4e96['conditions']){_0x2a4e96[_0xb012('0x82')]=JSON[_0xb012('0x7d')](_0x2a4e96['conditions']);_0x3f0c85[_0xb012('0x3a')](_0x422665(_0x2a4e96[_0xb012('0x82')]['group']));}_0x4a3932=_0x3f0c85[_0xb012('0x83')]();_0x3f0c85['limit'](_0x5ded9a);_0x3f0c85['offset'](0x0);logger['debug'](_0xb012('0x84'),_0x3f0c85[_0xb012('0x85')]());return dbH[_0xb012('0x86')][_0xb012('0x33')](_0x3f0c85[_0xb012('0x85')](),{'type':dbH[_0xb012('0x86')][_0xb012('0x87')][_0xb012('0x88')]});}})['then'](function(){return{'sql':_0x4a3932[_0xb012('0x85')]()};})[_0xb012('0x25')](respondWithResult(_0x5cfcd7,null))[_0xb012('0x44')](handleError(_0x5cfcd7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 92fb2d9..ee27d6d 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 _0xd1aa=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment','bluebird','path'];(function(_0x48e500,_0x19629f){var _0x4f2ec4=function(_0xe86fa4){while(--_0xe86fa4){_0x48e500['push'](_0x48e500['shift']());}};_0x4f2ec4(++_0x19629f);}(_0xd1aa,0x13f));var _0xad1a=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0xd1aa[_0x2125f0];return _0x12d6eb;};'use strict';var _=require(_0xad1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad1a('0x1'));var moment=require(_0xad1a('0x2'));var BPromise=require(_0xad1a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad1a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad1a('0x5'));module['exports']=function(_0x1efc05,_0x8b8043){return _0x1efc05[_0xad1a('0x6')](_0xad1a('0x7'),attributes,{'tableName':_0xad1a('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa216=['analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport'];(function(_0x5bc013,_0x448989){var _0xe6a3b9=function(_0x1fdf0d){while(--_0x1fdf0d){_0x5bc013['push'](_0x5bc013['shift']());}};_0xe6a3b9(++_0x448989);}(_0xa216,0x1a5));var _0x6a21=function(_0xa7c7be,_0x2df0cf){_0xa7c7be=_0xa7c7be-0x0;var _0x38496e=_0xa216[_0xa7c7be];return _0x38496e;};'use strict';var _=require('lodash');var util=require(_0x6a21('0x0'));var logger=require(_0x6a21('0x1'))(_0x6a21('0x2'));var moment=require(_0x6a21('0x3'));var BPromise=require(_0x6a21('0x4'));var rp=require(_0x6a21('0x5'));var fs=require('fs');var path=require(_0x6a21('0x6'));var rimraf=require('rimraf');var config=require(_0x6a21('0x7'));var attributes=require(_0x6a21('0x8'));module[_0x6a21('0x9')]=function(_0x5d3bf6,_0x2b3c8e){return _0x5d3bf6['define'](_0x6a21('0xa'),attributes,{'tableName':_0x6a21('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 5ccab30..1a7b795 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 _0x2179=['AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x19b9f9,_0x4fee0d){var _0x55d556=function(_0x2f4cd0){while(--_0x2f4cd0){_0x19b9f9['push'](_0x19b9f9['shift']());}};_0x55d556(++_0x4fee0d);}(_0x2179,0xc0));var _0x9217=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x2179[_0x3653c7];return _0x58a021;};'use strict';var _=require(_0x9217('0x0'));var util=require(_0x9217('0x1'));var moment=require(_0x9217('0x2'));var BPromise=require(_0x9217('0x3'));var rs=require(_0x9217('0x4'));var fs=require('fs');var Redis=require(_0x9217('0x5'));var db=require(_0x9217('0x6'))['db'];var utils=require(_0x9217('0x7'));var logger=require(_0x9217('0x8'))(_0x9217('0x9'));var config=require(_0x9217('0xa'));var jayson=require(_0x9217('0xb'));var client=jayson[_0x9217('0xc')][_0x9217('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ed3f7,_0x4b4344,_0x1a0b98){return new BPromise(function(_0x38127f,_0x23b2e7){return client[_0x9217('0xe')](_0x1ed3f7,_0x1a0b98)[_0x9217('0xf')](function(_0x5e7d99){logger['info'](_0x9217('0x10'),_0x4b4344,'request\x20sent');logger[_0x9217('0x11')](_0x9217('0x12'),_0x4b4344,_0x9217('0x13'),JSON['stringify'](_0x5e7d99));if(_0x5e7d99[_0x9217('0x14')]){if(_0x5e7d99[_0x9217('0x14')][_0x9217('0x15')]===0x1f4){logger[_0x9217('0x14')](_0x9217('0x10'),_0x4b4344,_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);return _0x23b2e7(_0x5e7d99[_0x9217('0x14')]['message']);}logger[_0x9217('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4b4344,_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);return _0x38127f(_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);}else{logger[_0x9217('0x17')](_0x9217('0x10'),_0x4b4344,_0x9217('0x13'));_0x38127f(_0x5e7d99[_0x9217('0x18')][_0x9217('0x16')]);}})[_0x9217('0x19')](function(_0x3b367b){logger[_0x9217('0x14')](_0x9217('0x10'),_0x4b4344,_0x3b367b);_0x23b2e7(_0x3b367b);});});} \ No newline at end of file +var _0x3c96=['http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1565e3,_0x39e7cb){var _0x25be7e=function(_0x382081){while(--_0x382081){_0x1565e3['push'](_0x1565e3['shift']());}};_0x25be7e(++_0x39e7cb);}(_0x3c96,0x1f1));var _0x63c9=function(_0x8152f9,_0x488273){_0x8152f9=_0x8152f9-0x0;var _0x2bcd1f=_0x3c96[_0x8152f9];return _0x2bcd1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x63c9('0x0'));var BPromise=require(_0x63c9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63c9('0x2'))['db'];var utils=require(_0x63c9('0x3'));var logger=require(_0x63c9('0x4'))(_0x63c9('0x5'));var config=require(_0x63c9('0x6'));var jayson=require(_0x63c9('0x7'));var client=jayson[_0x63c9('0x8')][_0x63c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x274056,_0x1d14ee,_0x8066d4){return new BPromise(function(_0x57d25c,_0x459a1f){return client[_0x63c9('0xa')](_0x274056,_0x8066d4)[_0x63c9('0xb')](function(_0x357c1b){logger[_0x63c9('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1d14ee,_0x63c9('0xd'));logger[_0x63c9('0xe')](_0x63c9('0xf'),_0x1d14ee,_0x63c9('0xd'),JSON[_0x63c9('0x10')](_0x357c1b));if(_0x357c1b[_0x63c9('0x11')]){if(_0x357c1b[_0x63c9('0x11')][_0x63c9('0x12')]===0x1f4){logger[_0x63c9('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1d14ee,_0x357c1b[_0x63c9('0x11')][_0x63c9('0x13')]);return _0x459a1f(_0x357c1b[_0x63c9('0x11')]['message']);}logger['error'](_0x63c9('0x14'),_0x1d14ee,_0x357c1b['error']['message']);return _0x57d25c(_0x357c1b['error']['message']);}else{logger[_0x63c9('0xc')](_0x63c9('0x14'),_0x1d14ee,_0x63c9('0xd'));_0x57d25c(_0x357c1b[_0x63c9('0x15')][_0x63c9('0x13')]);}})[_0x63c9('0x16')](function(_0x54ea7c){logger[_0x63c9('0x11')](_0x63c9('0x14'),_0x1d14ee,_0x54ea7c);_0x459a1f(_0x54ea7c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 90d41c4..dd16863 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 _0x7a30=['/:id/run','/:id/query','query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview'];(function(_0x2c21fa,_0x5f0a10){var _0x5aafc6=function(_0x1eb171){while(--_0x1eb171){_0x2c21fa['push'](_0x2c21fa['shift']());}};_0x5aafc6(++_0x5f0a10);}(_0x7a30,0x1a1));var _0x07a3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a30[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x07a3('0x0'));var path=require(_0x07a3('0x1'));var timeout=require(_0x07a3('0x2'));var express=require(_0x07a3('0x3'));var router=express['Router']();var fs_extra=require(_0x07a3('0x4'));var auth=require(_0x07a3('0x5'));var interaction=require(_0x07a3('0x6'));var config=require(_0x07a3('0x7'));var controller=require(_0x07a3('0x8'));router[_0x07a3('0x9')]('/',auth[_0x07a3('0xa')](),controller[_0x07a3('0xb')]);router['get'](_0x07a3('0xc'),auth[_0x07a3('0xa')](),controller['show']);router['get'](_0x07a3('0xd'),auth[_0x07a3('0xa')](),controller[_0x07a3('0xe')]);router[_0x07a3('0x9')](_0x07a3('0xf'),auth[_0x07a3('0xa')](),controller['run']);router[_0x07a3('0x9')](_0x07a3('0x10'),auth[_0x07a3('0xa')](),controller[_0x07a3('0x11')]);router[_0x07a3('0x12')]('/',auth[_0x07a3('0xa')](),controller[_0x07a3('0x13')]);router[_0x07a3('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x07a3('0x15')]);router[_0x07a3('0x16')]('/:id',auth[_0x07a3('0xa')](),controller[_0x07a3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x09c1=['/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','isAuthenticated','show'];(function(_0x5ee1d8,_0x13a1fe){var _0x39a397=function(_0x4ca75d){while(--_0x4ca75d){_0x5ee1d8['push'](_0x5ee1d8['shift']());}};_0x39a397(++_0x13a1fe);}(_0x09c1,0x174));var _0x109c=function(_0x26e312,_0x4c0fed){_0x26e312=_0x26e312-0x0;var _0x3d73ce=_0x09c1[_0x26e312];return _0x3d73ce;};'use strict';var multer=require('multer');var util=require(_0x109c('0x0'));var path=require(_0x109c('0x1'));var timeout=require(_0x109c('0x2'));var express=require('express');var router=express[_0x109c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x109c('0x4'));var interaction=require(_0x109c('0x5'));var config=require(_0x109c('0x6'));var controller=require(_0x109c('0x7'));router[_0x109c('0x8')]('/',auth['isAuthenticated'](),controller[_0x109c('0x9')]);router[_0x109c('0x8')]('/:id',auth[_0x109c('0xa')](),controller[_0x109c('0xb')]);router[_0x109c('0x8')](_0x109c('0xc'),auth['isAuthenticated'](),controller[_0x109c('0xd')]);router[_0x109c('0x8')](_0x109c('0xe'),auth['isAuthenticated'](),controller['run']);router[_0x109c('0x8')](_0x109c('0xf'),auth[_0x109c('0xa')](),controller[_0x109c('0x10')]);router[_0x109c('0x11')]('/',auth['isAuthenticated'](),controller[_0x109c('0x12')]);router[_0x109c('0x13')](_0x109c('0x14'),auth['isAuthenticated'](),controller[_0x109c('0x15')]);router['delete'](_0x109c('0x14'),auth[_0x109c('0xa')](),controller[_0x109c('0x16')]);module[_0x109c('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 672d847..467548e 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x882f78,_0x51863e){var _0x4a5db0=function(_0x378dd2){while(--_0x378dd2){_0x882f78['push'](_0x882f78['shift']());}};_0x4a5db0(++_0x51863e);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x14589a,_0x4c9401){var _0x37a045=function(_0x1fff2b){while(--_0x1fff2b){_0x14589a['push'](_0x14589a['shift']());}};_0x37a045(++_0x4c9401);}(_0x5fc3,0xa8));var _0x35fc=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x5fc3[_0x25662e];return _0x59b7bc;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0b513f4..3c56e38 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(_0x55a50f,_0x2cf749){var _0x1ab641=function(_0x316a12){while(--_0x316a12){_0x55a50f['push'](_0x55a50f['shift']());}};_0x1ab641(++_0x2cf749);}(_0xda19,0xd5));var _0x9da1=function(_0x3d1998,_0x3f9a16){_0x3d1998=_0x3d1998-0x0;var _0x3fe000=_0xda19[_0x3d1998];return _0x3fe000;};'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 _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x44c995,_0x216bdb){var _0x1a5409=function(_0x499262){while(--_0x499262){_0x44c995['push'](_0x44c995['shift']());}};_0x1a5409(++_0x216bdb);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xbc3542,_0x4de021){_0xbc3542=_0xbc3542-0x0;var _0x1c88ff=_0x3f8a[_0xbc3542];return _0x1c88ff;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 60feb17..c8a620a 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 _0xfae6=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x2336ea,_0x46e872){var _0x216bf9=function(_0x14a50d){while(--_0x14a50d){_0x2336ea['push'](_0x2336ea['shift']());}};_0x216bf9(++_0x46e872);}(_0xfae6,0x1df));var _0x6fae=function(_0x58f3bd,_0x48efdf){_0x58f3bd=_0x58f3bd-0x0;var _0x13e0bb=_0xfae6[_0x58f3bd];return _0x13e0bb;};'use strict';var _=require(_0x6fae('0x0'));var util=require(_0x6fae('0x1'));var logger=require(_0x6fae('0x2'))(_0x6fae('0x3'));var moment=require(_0x6fae('0x4'));var BPromise=require('bluebird');var rp=require(_0x6fae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fae('0x6'));var config=require(_0x6fae('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x6fae('0x8')]=function(_0xbb2125,_0x445849){return _0xbb2125[_0x6fae('0x9')](_0x6fae('0xa'),attributes,{'tableName':_0x6fae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ce=['../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x2f40c0,_0x2cb92b){var _0x58c9d4=function(_0x2d5d55){while(--_0x2d5d55){_0x2f40c0['push'](_0x2f40c0['shift']());}};_0x58c9d4(++_0x2cb92b);}(_0xd4ce,0x180));var _0xed4c=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xd4ce[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0xed4c('0x0'));var util=require(_0xed4c('0x1'));var logger=require(_0xed4c('0x2'))(_0xed4c('0x3'));var moment=require('moment');var BPromise=require(_0xed4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed4c('0x5'));var config=require(_0xed4c('0x6'));var attributes=require(_0xed4c('0x7'));module['exports']=function(_0xc5a338,_0x24ed47){return _0xc5a338['define'](_0xed4c('0x8'),attributes,{'tableName':_0xed4c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index b92614d..8ccff40 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 _0x184c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x1297d8,_0x503014){var _0x2abe42=function(_0x516c6e){while(--_0x516c6e){_0x1297d8['push'](_0x1297d8['shift']());}};_0x2abe42(++_0x503014);}(_0x184c,0x69));var _0xc184=function(_0x1cf4e0,_0x3de9f4){_0x1cf4e0=_0x1cf4e0-0x0;var _0x23f60a=_0x184c[_0x1cf4e0];return _0x23f60a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc184('0x0'));var BPromise=require(_0xc184('0x1'));var rs=require(_0xc184('0x2'));var fs=require('fs');var Redis=require(_0xc184('0x3'));var db=require(_0xc184('0x4'))['db'];var utils=require(_0xc184('0x5'));var logger=require(_0xc184('0x6'))(_0xc184('0x7'));var config=require(_0xc184('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc184('0x9')][_0xc184('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x378881,_0x126dbb,_0x4a8463){return new BPromise(function(_0x31e1ae,_0x55f267){return client['request'](_0x378881,_0x4a8463)['then'](function(_0x2283e5){logger[_0xc184('0xb')](_0xc184('0xc'),_0x126dbb,_0xc184('0xd'));logger[_0xc184('0xe')](_0xc184('0xf'),_0x126dbb,_0xc184('0xd'),JSON['stringify'](_0x2283e5));if(_0x2283e5['error']){if(_0x2283e5[_0xc184('0x10')][_0xc184('0x11')]===0x1f4){logger[_0xc184('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x126dbb,_0x2283e5[_0xc184('0x10')][_0xc184('0x12')]);return _0x55f267(_0x2283e5['error']['message']);}logger[_0xc184('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x126dbb,_0x2283e5['error'][_0xc184('0x12')]);return _0x31e1ae(_0x2283e5[_0xc184('0x10')]['message']);}else{logger[_0xc184('0xb')](_0xc184('0xc'),_0x126dbb,_0xc184('0xd'));_0x31e1ae(_0x2283e5[_0xc184('0x13')]['message']);}})[_0xc184('0x14')](function(_0x4ff74){logger[_0xc184('0x10')](_0xc184('0xc'),_0x126dbb,_0x4ff74);_0x55f267(_0x4ff74);});});} \ No newline at end of file +var _0x285e=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x285e,0xf0));var _0xe285=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x285e[_0x585d81];return _0x1aca0d;};'use strict';var _=require(_0xe285('0x0'));var util=require(_0xe285('0x1'));var moment=require(_0xe285('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe285('0x3'));var db=require(_0xe285('0x4'))['db'];var utils=require(_0xe285('0x5'));var logger=require(_0xe285('0x6'))(_0xe285('0x7'));var config=require('../../config/environment');var jayson=require(_0xe285('0x8'));var client=jayson[_0xe285('0x9')][_0xe285('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aac9f,_0x134bc4,_0x37707c){return new BPromise(function(_0x1755fe,_0x3fca32){return client[_0xe285('0xb')](_0x5aac9f,_0x37707c)[_0xe285('0xc')](function(_0x15ec7f){logger[_0xe285('0xd')](_0xe285('0xe'),_0x134bc4,'request\x20sent');logger['debug'](_0xe285('0xf'),_0x134bc4,_0xe285('0x10'),JSON[_0xe285('0x11')](_0x15ec7f));if(_0x15ec7f['error']){if(_0x15ec7f[_0xe285('0x12')][_0xe285('0x13')]===0x1f4){logger[_0xe285('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x134bc4,_0x15ec7f[_0xe285('0x12')]['message']);return _0x3fca32(_0x15ec7f[_0xe285('0x12')][_0xe285('0x14')]);}logger['error'](_0xe285('0xe'),_0x134bc4,_0x15ec7f[_0xe285('0x12')][_0xe285('0x14')]);return _0x1755fe(_0x15ec7f[_0xe285('0x12')][_0xe285('0x14')]);}else{logger[_0xe285('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x134bc4,_0xe285('0x10'));_0x1755fe(_0x15ec7f['result']['message']);}})[_0xe285('0x15')](function(_0x5e926f){logger['error'](_0xe285('0xe'),_0x134bc4,_0x5e926f);_0x3fca32(_0x5e926f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c6a52f5..16675ba 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 _0x7f11=['../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','show','preview','/:id/run','/:id/query','query','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7f11,0x10c));var _0x17f1=function(_0x154d16,_0x529bb8){_0x154d16=_0x154d16-0x0;var _0x1e86ac=_0x7f11[_0x154d16];return _0x1e86ac;};'use strict';var multer=require(_0x17f1('0x0'));var util=require(_0x17f1('0x1'));var path=require(_0x17f1('0x2'));var timeout=require(_0x17f1('0x3'));var express=require(_0x17f1('0x4'));var router=express[_0x17f1('0x5')]();var fs_extra=require(_0x17f1('0x6'));var auth=require(_0x17f1('0x7'));var interaction=require(_0x17f1('0x8'));var config=require('../../config/environment');var controller=require(_0x17f1('0x9'));router[_0x17f1('0xa')]('/',auth[_0x17f1('0xb')](),controller[_0x17f1('0xc')]);router[_0x17f1('0xa')]('/:id',auth[_0x17f1('0xb')](),controller[_0x17f1('0xd')]);router[_0x17f1('0xa')]('/:id/preview',auth['isAuthenticated'](),controller[_0x17f1('0xe')]);router['get'](_0x17f1('0xf'),auth['isAuthenticated'](),controller['run']);router[_0x17f1('0xa')](_0x17f1('0x10'),auth[_0x17f1('0xb')](),controller[_0x17f1('0x11')]);router['post']('/',auth[_0x17f1('0xb')](),controller[_0x17f1('0x12')]);router[_0x17f1('0x13')]('/:id',auth[_0x17f1('0xb')](),controller[_0x17f1('0x14')]);router[_0x17f1('0x15')](_0x17f1('0x16'),auth['isAuthenticated'](),controller[_0x17f1('0x17')]);module[_0x17f1('0x18')]=router; \ No newline at end of file +var _0xf4e6=['post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xf4e6,0xd5));var _0x6f4e=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0xf4e6[_0x33bcdb];return _0x18a9bf;};'use strict';var multer=require('multer');var util=require(_0x6f4e('0x0'));var path=require(_0x6f4e('0x1'));var timeout=require(_0x6f4e('0x2'));var express=require('express');var router=express[_0x6f4e('0x3')]();var fs_extra=require(_0x6f4e('0x4'));var auth=require(_0x6f4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6f4e('0x6'));var controller=require(_0x6f4e('0x7'));router[_0x6f4e('0x8')]('/',auth[_0x6f4e('0x9')](),controller[_0x6f4e('0xa')]);router[_0x6f4e('0x8')](_0x6f4e('0xb'),auth[_0x6f4e('0x9')](),controller['show']);router['get'](_0x6f4e('0xc'),auth['isAuthenticated'](),controller[_0x6f4e('0xd')]);router['get'](_0x6f4e('0xe'),auth[_0x6f4e('0x9')](),controller[_0x6f4e('0xf')]);router[_0x6f4e('0x8')]('/:id/query',auth[_0x6f4e('0x9')](),controller[_0x6f4e('0x10')]);router[_0x6f4e('0x11')]('/',auth[_0x6f4e('0x9')](),controller['create']);router[_0x6f4e('0x12')](_0x6f4e('0xb'),auth['isAuthenticated'](),controller[_0x6f4e('0x13')]);router[_0x6f4e('0x14')](_0x6f4e('0xb'),auth[_0x6f4e('0x9')](),controller[_0x6f4e('0x15')]);module[_0x6f4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a2c631c..9a96623 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 _0x4aca=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled'];(function(_0x48545b,_0x24df30){var _0x3279a5=function(_0x127d03){while(--_0x127d03){_0x48545b['push'](_0x48545b['shift']());}};_0x3279a5(++_0x24df30);}(_0x4aca,0x120));var _0xa4ac=function(_0x49e0d2,_0x5809c0){_0x49e0d2=_0x49e0d2-0x0;var _0x4fcb5c=_0x4aca[_0x49e0d2];return _0x4fcb5c;};'use strict';var Sequelize=require(_0xa4ac('0x0'));var moment=require(_0xa4ac('0x1'));module[_0xa4ac('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa4ac('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa4ac('0x4')](_0xa4ac('0x5'),_0xa4ac('0x6'),_0xa4ac('0x7')),'allowNull':![],'defaultValue':_0xa4ac('0x5')},'savename':{'type':Sequelize[_0xa4ac('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xa4ac('0x8')]},'status':{'type':Sequelize[_0xa4ac('0x3')],'defaultValue':_0xa4ac('0x9')},'type':{'type':Sequelize[_0xa4ac('0x4')]('manual',_0xa4ac('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xa4ac('0xb')](0xb)[_0xa4ac('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca27=['DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','moment','STRING','ENUM','csv','pdf','xlsx'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xca27,0xde));var _0x7ca2=function(_0x3e5f7e,_0x10d3d4){_0x3e5f7e=_0x3e5f7e-0x0;var _0x589674=_0xca27[_0x3e5f7e];return _0x589674;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7ca2('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ca2('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x7ca2('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x7ca2('0x2')](_0x7ca2('0x3'),_0x7ca2('0x4'),_0x7ca2('0x5')),'allowNull':![],'defaultValue':_0x7ca2('0x3')},'savename':{'type':Sequelize[_0x7ca2('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7ca2('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x7ca2('0x1')],'defaultValue':_0x7ca2('0x7')},'type':{'type':Sequelize['ENUM'](_0x7ca2('0x8'),_0x7ca2('0x9')),'allowNull':![],'defaultValue':_0x7ca2('0x8')},'reportId':{'type':Sequelize[_0x7ca2('0xa')](0xb)[_0x7ca2('0xb')]},'reportType':{'type':Sequelize[_0x7ca2('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 3aaa364..a745bc6 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 _0xc681=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','find','userProfileId','download','basename','savename','output','existsSync','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','AnalyticExtractedReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x4cf4f2,_0x112e2c){var _0x14d014=function(_0x26dbe4){while(--_0x26dbe4){_0x4cf4f2['push'](_0x4cf4f2['shift']());}};_0x14d014(++_0x112e2c);}(_0xc681,0xc9));var _0x1c68=function(_0x52cc97,_0x349da3){_0x52cc97=_0x52cc97-0x0;var _0x10b2df=_0xc681[_0x52cc97];return _0x10b2df;};'use strict';var emlformat=require(_0x1c68('0x0'));var rimraf=require(_0x1c68('0x1'));var zipdir=require(_0x1c68('0x2'));var jsonpatch=require(_0x1c68('0x3'));var rp=require('request-promise');var moment=require(_0x1c68('0x4'));var BPromise=require(_0x1c68('0x5'));var Mustache=require(_0x1c68('0x6'));var util=require('util');var path=require(_0x1c68('0x7'));var sox=require(_0x1c68('0x8'));var csv=require(_0x1c68('0x9'));var ejs=require(_0x1c68('0xa'));var fs=require('fs');var fs_extra=require(_0x1c68('0xb'));var _=require(_0x1c68('0xc'));var squel=require(_0x1c68('0xd'));var crypto=require('crypto');var jsforce=require(_0x1c68('0xe'));var deskjs=require(_0x1c68('0xf'));var toCsv=require(_0x1c68('0x9'));var querystring=require(_0x1c68('0x10'));var Papa=require(_0x1c68('0x11'));var Redis=require('ioredis');var authService=require(_0x1c68('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c68('0x13'));var logger=require(_0x1c68('0x14'))(_0x1c68('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c68('0x16'))['db'];function respondWithStatusCode(_0x6997df,_0x1708d5){_0x1708d5=_0x1708d5||0xcc;return function(_0x1965bb){if(_0x1965bb){return _0x6997df[_0x1c68('0x17')](_0x1708d5);}return _0x6997df[_0x1c68('0x18')](_0x1708d5)[_0x1c68('0x19')]();};}function respondWithResult(_0x515627,_0x21c18){_0x21c18=_0x21c18||0xc8;return function(_0x2a43d0){if(_0x2a43d0){return _0x515627['status'](_0x21c18)[_0x1c68('0x1a')](_0x2a43d0);}};}function respondWithFilteredResult(_0x31d51f,_0x40160d){return function(_0x3dff7e){if(_0x3dff7e){var _0x3d0656=typeof _0x40160d[_0x1c68('0x1b')]===_0x1c68('0x1c')&&typeof _0x40160d[_0x1c68('0x1d')]===_0x1c68('0x1c');var _0x5aa947=_0x3dff7e['count'];var _0x56e168=_0x3d0656?0x0:_0x40160d['offset'];var _0x11dc68=_0x3d0656?_0x3dff7e[_0x1c68('0x1e')]:_0x40160d[_0x1c68('0x1b')]+_0x40160d['limit'];var _0x4609f7;if(_0x11dc68>=_0x5aa947){_0x11dc68=_0x5aa947;_0x4609f7=0xc8;}else{_0x4609f7=0xce;}_0x31d51f[_0x1c68('0x18')](_0x4609f7);return _0x31d51f['set'](_0x1c68('0x1f'),_0x56e168+'-'+_0x11dc68+'/'+_0x5aa947)[_0x1c68('0x1a')](_0x3dff7e);}return null;};}function patchUpdates(_0x41103d){return function(_0x45132b){try{jsonpatch['apply'](_0x45132b,_0x41103d,!![]);}catch(_0x92746a){return BPromise[_0x1c68('0x20')](_0x92746a);}return _0x45132b[_0x1c68('0x21')]();};}function saveUpdates(_0x3ec35f,_0x10a4df){return function(_0x7acb9b){if(_0x7acb9b){return _0x7acb9b[_0x1c68('0x22')](_0x3ec35f)[_0x1c68('0x23')](function(_0x22274f){return _0x22274f;});}return null;};}function removeEntity(_0x164329,_0x7b7b11){return function(_0x2b255b){if(_0x2b255b){return _0x2b255b[_0x1c68('0x24')]()[_0x1c68('0x23')](function(){var _0xe51da1=_0x2b255b[_0x1c68('0x25')]({'plain':!![]});var _0x584f3a='ExtractedReports';return db[_0x1c68('0x26')][_0x1c68('0x24')]({'where':{'type':_0x584f3a,'resourceId':_0xe51da1['id']}})[_0x1c68('0x23')](function(){return _0x2b255b;});})[_0x1c68('0x23')](function(){_0x164329[_0x1c68('0x18')](0xcc)[_0x1c68('0x19')]();});}};}function handleEntityNotFound(_0x118b22,_0x7cbd34){return function(_0x473d2e){if(!_0x473d2e){_0x118b22[_0x1c68('0x17')](0x194);}return _0x473d2e;};}function handleError(_0x146371,_0x509b27){_0x509b27=_0x509b27||0x1f4;return function(_0x37b343){logger[_0x1c68('0x27')](_0x37b343['stack']);if(_0x37b343[_0x1c68('0x28')]){delete _0x37b343[_0x1c68('0x28')];}_0x146371[_0x1c68('0x18')](_0x509b27)[_0x1c68('0x29')](_0x37b343);};}exports['index']=function(_0x5081ce,_0x57c208){var _0x3a2c0d={},_0x559143={},_0x344ca2={'count':0x0,'rows':[]};var _0x4c8fe2=_[_0x1c68('0x2a')](db[_0x1c68('0x2b')][_0x1c68('0x2c')],function(_0x21f693){return{'name':_0x21f693['fieldName'],'type':_0x21f693['type'][_0x1c68('0x2d')]};});_0x559143['model']=_[_0x1c68('0x2a')](_0x4c8fe2,_0x1c68('0x28'));_0x559143[_0x1c68('0x2e')]=_[_0x1c68('0x2f')](_0x5081ce[_0x1c68('0x2e')]);_0x559143[_0x1c68('0x30')]=_[_0x1c68('0x31')](_0x559143[_0x1c68('0x32')],_0x559143['query']);_0x3a2c0d[_0x1c68('0x33')]=_['intersection'](_0x559143[_0x1c68('0x32')],qs['fields'](_0x5081ce['query'][_0x1c68('0x34')]));_0x3a2c0d[_0x1c68('0x33')]=_0x3a2c0d[_0x1c68('0x33')][_0x1c68('0x35')]?_0x3a2c0d['attributes']:_0x559143[_0x1c68('0x32')];if(!_0x5081ce[_0x1c68('0x2e')]['hasOwnProperty'](_0x1c68('0x36'))){_0x3a2c0d[_0x1c68('0x1d')]=qs['limit'](_0x5081ce[_0x1c68('0x2e')][_0x1c68('0x1d')]);_0x3a2c0d[_0x1c68('0x1b')]=qs[_0x1c68('0x1b')](_0x5081ce['query'][_0x1c68('0x1b')]);}_0x3a2c0d[_0x1c68('0x37')]=qs[_0x1c68('0x38')](_0x5081ce[_0x1c68('0x2e')][_0x1c68('0x38')]);_0x3a2c0d[_0x1c68('0x39')]=qs[_0x1c68('0x30')](_[_0x1c68('0x3a')](_0x5081ce['query'],_0x559143[_0x1c68('0x30')]),_0x4c8fe2);if(_0x5081ce[_0x1c68('0x2e')][_0x1c68('0x3b')]){_0x3a2c0d[_0x1c68('0x39')]=_[_0x1c68('0x3c')](_0x3a2c0d['where'],{'$or':_[_0x1c68('0x2a')](_0x4c8fe2,function(_0x65394d){if(_0x65394d['type']!==_0x1c68('0x3d')){var _0x5ec9e7={};_0x5ec9e7[_0x65394d[_0x1c68('0x28')]]={'$like':'%'+_0x5081ce[_0x1c68('0x2e')][_0x1c68('0x3b')]+'%'};return _0x5ec9e7;}})});}_0x3a2c0d=_[_0x1c68('0x3c')]({},_0x3a2c0d,_0x5081ce[_0x1c68('0x3e')]);var _0x24277d={'where':_0x3a2c0d[_0x1c68('0x39')]};return db[_0x1c68('0x2b')]['count'](_0x24277d)[_0x1c68('0x23')](function(_0x5cbdb8){_0x344ca2['count']=_0x5cbdb8;if(_0x5081ce['query'][_0x1c68('0x3f')]){_0x3a2c0d[_0x1c68('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x1c68('0x41')](_0x3a2c0d);})[_0x1c68('0x23')](function(_0x5bc330){_0x344ca2[_0x1c68('0x42')]=_0x5bc330;return _0x344ca2;})[_0x1c68('0x23')](respondWithFilteredResult(_0x57c208,_0x3a2c0d))[_0x1c68('0x43')](handleError(_0x57c208,null));};exports[_0x1c68('0x44')]=function(_0x4ff938,_0x4dc5e3){var _0x49e10b={'raw':!![],'where':{'id':_0x4ff938[_0x1c68('0x45')]['id']}},_0x1e0a8a={};_0x1e0a8a[_0x1c68('0x32')]=_[_0x1c68('0x2f')](db[_0x1c68('0x2b')][_0x1c68('0x2c')]);_0x1e0a8a[_0x1c68('0x2e')]=_[_0x1c68('0x2f')](_0x4ff938[_0x1c68('0x2e')]);_0x1e0a8a[_0x1c68('0x30')]=_[_0x1c68('0x31')](_0x1e0a8a[_0x1c68('0x32')],_0x1e0a8a[_0x1c68('0x2e')]);_0x49e10b[_0x1c68('0x33')]=_['intersection'](_0x1e0a8a[_0x1c68('0x32')],qs[_0x1c68('0x34')](_0x4ff938['query'][_0x1c68('0x34')]));_0x49e10b[_0x1c68('0x33')]=_0x49e10b['attributes']['length']?_0x49e10b[_0x1c68('0x33')]:_0x1e0a8a[_0x1c68('0x32')];if(_0x4ff938[_0x1c68('0x2e')][_0x1c68('0x3f')]){_0x49e10b[_0x1c68('0x40')]=[{'all':!![]}];}_0x49e10b=_['merge']({},_0x49e10b,_0x4ff938['options']);return db[_0x1c68('0x2b')]['find'](_0x49e10b)[_0x1c68('0x23')](handleEntityNotFound(_0x4dc5e3,null))[_0x1c68('0x23')](respondWithResult(_0x4dc5e3,null))['catch'](handleError(_0x4dc5e3,null));};exports['create']=function(_0x3f68d3,_0x47f6fd){return db['AnalyticExtractedReport'][_0x1c68('0x46')](_0x3f68d3[_0x1c68('0x47')],{})['then'](function(_0x3320a6){var _0xe98bb0=_0x3f68d3['user'][_0x1c68('0x25')]({'plain':!![]});if(!_0xe98bb0)throw new Error(_0x1c68('0x48'));if(_0xe98bb0['role']==='user'){var _0xbd2e48=_0x3320a6[_0x1c68('0x25')]({'plain':!![]});var _0x49304e=_0x1c68('0x49');return db[_0x1c68('0x4a')][_0x1c68('0x4b')]({'where':{'name':_0x49304e,'userProfileId':_0xe98bb0[_0x1c68('0x4c')]},'raw':!![]})[_0x1c68('0x23')](function(_0x193960){if(_0x193960&&_0x193960['autoAssociation']===0x0){return db[_0x1c68('0x26')][_0x1c68('0x46')]({'name':_0xbd2e48['name'],'resourceId':_0xbd2e48['id'],'type':_0x193960['name'],'sectionId':_0x193960['id']},{})[_0x1c68('0x23')](function(){return _0x3320a6;});}else{return _0x3320a6;}})[_0x1c68('0x43')](function(_0x3a89d1){logger[_0x1c68('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a89d1);throw _0x3a89d1;});}return _0x3320a6;})['then'](respondWithResult(_0x47f6fd,0xc9))[_0x1c68('0x43')](handleError(_0x47f6fd,null));};exports['update']=function(_0x3d9940,_0x467e42){if(_0x3d9940['body']['id']){delete _0x3d9940[_0x1c68('0x47')]['id'];}return db[_0x1c68('0x2b')][_0x1c68('0x4b')]({'where':{'id':_0x3d9940['params']['id']}})[_0x1c68('0x23')](handleEntityNotFound(_0x467e42,null))[_0x1c68('0x23')](saveUpdates(_0x3d9940[_0x1c68('0x47')],null))[_0x1c68('0x23')](respondWithResult(_0x467e42,null))[_0x1c68('0x43')](handleError(_0x467e42,null));};exports[_0x1c68('0x24')]=function(_0x4f65c4,_0x3d0668){return db[_0x1c68('0x2b')]['find']({'where':{'id':_0x4f65c4[_0x1c68('0x45')]['id']}})[_0x1c68('0x23')](handleEntityNotFound(_0x3d0668,null))[_0x1c68('0x23')](removeEntity(_0x3d0668,null))['catch'](handleError(_0x3d0668,null));};exports[_0x1c68('0x4d')]=function(_0x448231,_0xae3e77,_0x4a710b){return db[_0x1c68('0x2b')][_0x1c68('0x4b')]({'where':{'id':_0x448231[_0x1c68('0x45')]['id']},'attributes':[_0x1c68('0x28'),_0x1c68('0x4e'),_0x1c68('0x4f'),_0x1c68('0x50')],'raw':!![]})[_0x1c68('0x23')](handleEntityNotFound(_0xae3e77,null))[_0x1c68('0x23')](function(_0x34d0d5){if(_0x34d0d5){if(!fs[_0x1c68('0x51')](path[_0x1c68('0x52')](config[_0x1c68('0x53')],'server/files/reports',_0x34d0d5[_0x1c68('0x4f')]))){throw new db['Sequelize'][(_0x1c68('0x54'))](_0x1c68('0x55'));}if(_0x448231['query']['exists']){return _0xae3e77['sendStatus'](0xc8);}return _0xae3e77[_0x1c68('0x4d')](path[_0x1c68('0x52')](config['root'],'server/files/reports',_0x34d0d5['savename']),util['format'](_0x1c68('0x56'),_0x34d0d5[_0x1c68('0x4e')]||_0x34d0d5[_0x1c68('0x28')],_0x34d0d5[_0x1c68('0x50')]['toLowerCase']()));}})[_0x1c68('0x43')](handleError(_0xae3e77,null));}; \ No newline at end of file +var _0x216b=['Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','AnalyticExtractedReport','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports'];(function(_0x1a1a1f,_0x58833e){var _0x51962f=function(_0xf669db){while(--_0xf669db){_0x1a1a1f['push'](_0x1a1a1f['shift']());}};_0x51962f(++_0x58833e);}(_0x216b,0xce));var _0xb216=function(_0x4c4224,_0x26fac9){_0x4c4224=_0x4c4224-0x0;var _0xb88301=_0x216b[_0x4c4224];return _0xb88301;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb216('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb216('0x1'));var rp=require(_0xb216('0x2'));var moment=require(_0xb216('0x3'));var BPromise=require(_0xb216('0x4'));var Mustache=require(_0xb216('0x5'));var util=require(_0xb216('0x6'));var path=require(_0xb216('0x7'));var sox=require(_0xb216('0x8'));var csv=require(_0xb216('0x9'));var ejs=require(_0xb216('0xa'));var fs=require('fs');var fs_extra=require(_0xb216('0xb'));var _=require('lodash');var squel=require(_0xb216('0xc'));var crypto=require(_0xb216('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb216('0xe'));var toCsv=require(_0xb216('0x9'));var querystring=require(_0xb216('0xf'));var Papa=require('papaparse');var Redis=require(_0xb216('0x10'));var authService=require(_0xb216('0x11'));var qs=require(_0xb216('0x12'));var as=require(_0xb216('0x13'));var hardwareService=require(_0xb216('0x14'));var logger=require(_0xb216('0x15'))(_0xb216('0x16'));var utils=require(_0xb216('0x17'));var config=require(_0xb216('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ef0ea,_0x63b46){_0x63b46=_0x63b46||0xcc;return function(_0x39f955){if(_0x39f955){return _0x1ef0ea['sendStatus'](_0x63b46);}return _0x1ef0ea[_0xb216('0x19')](_0x63b46)[_0xb216('0x1a')]();};}function respondWithResult(_0x8be3bc,_0x3c56ad){_0x3c56ad=_0x3c56ad||0xc8;return function(_0x5cdc77){if(_0x5cdc77){return _0x8be3bc['status'](_0x3c56ad)['json'](_0x5cdc77);}};}function respondWithFilteredResult(_0x4ae6a7,_0x2bfd10){return function(_0x487eab){if(_0x487eab){var _0x344477=typeof _0x2bfd10[_0xb216('0x1b')]==='undefined'&&typeof _0x2bfd10[_0xb216('0x1c')]===_0xb216('0x1d');var _0x1d01ec=_0x487eab['count'];var _0x4453a5=_0x344477?0x0:_0x2bfd10[_0xb216('0x1b')];var _0x480427=_0x344477?_0x487eab[_0xb216('0x1e')]:_0x2bfd10[_0xb216('0x1b')]+_0x2bfd10[_0xb216('0x1c')];var _0x1b2c9a;if(_0x480427>=_0x1d01ec){_0x480427=_0x1d01ec;_0x1b2c9a=0xc8;}else{_0x1b2c9a=0xce;}_0x4ae6a7[_0xb216('0x19')](_0x1b2c9a);return _0x4ae6a7[_0xb216('0x1f')](_0xb216('0x20'),_0x4453a5+'-'+_0x480427+'/'+_0x1d01ec)[_0xb216('0x21')](_0x487eab);}return null;};}function patchUpdates(_0x2ddec0){return function(_0x4f9c9a){try{jsonpatch[_0xb216('0x22')](_0x4f9c9a,_0x2ddec0,!![]);}catch(_0x19d65d){return BPromise[_0xb216('0x23')](_0x19d65d);}return _0x4f9c9a[_0xb216('0x24')]();};}function saveUpdates(_0x30290f,_0x497c89){return function(_0x8cf5f3){if(_0x8cf5f3){return _0x8cf5f3[_0xb216('0x25')](_0x30290f)[_0xb216('0x26')](function(_0x26f4b5){return _0x26f4b5;});}return null;};}function removeEntity(_0x542244,_0x42b266){return function(_0x4decb7){if(_0x4decb7){return _0x4decb7[_0xb216('0x27')]()['then'](function(){var _0x1b6441=_0x4decb7['get']({'plain':!![]});var _0x560906='ExtractedReports';return db[_0xb216('0x28')]['destroy']({'where':{'type':_0x560906,'resourceId':_0x1b6441['id']}})[_0xb216('0x26')](function(){return _0x4decb7;});})['then'](function(){_0x542244[_0xb216('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x239851,_0xf0a8f){return function(_0x4573ab){if(!_0x4573ab){_0x239851[_0xb216('0x29')](0x194);}return _0x4573ab;};}function handleError(_0xdfb865,_0x222548){_0x222548=_0x222548||0x1f4;return function(_0x3d5611){logger['error'](_0x3d5611[_0xb216('0x2a')]);if(_0x3d5611['name']){delete _0x3d5611[_0xb216('0x2b')];}_0xdfb865[_0xb216('0x19')](_0x222548)[_0xb216('0x2c')](_0x3d5611);};}exports[_0xb216('0x2d')]=function(_0x1b9fa2,_0x3c0a11){var _0x3a3cbc={},_0x52ce48={},_0x2cff58={'count':0x0,'rows':[]};var _0x27991d=_['map'](db[_0xb216('0x2e')][_0xb216('0x2f')],function(_0x58cf2e){return{'name':_0x58cf2e['fieldName'],'type':_0x58cf2e['type'][_0xb216('0x30')]};});_0x52ce48[_0xb216('0x31')]=_[_0xb216('0x32')](_0x27991d,_0xb216('0x2b'));_0x52ce48['query']=_[_0xb216('0x33')](_0x1b9fa2[_0xb216('0x34')]);_0x52ce48[_0xb216('0x35')]=_[_0xb216('0x36')](_0x52ce48[_0xb216('0x31')],_0x52ce48['query']);_0x3a3cbc[_0xb216('0x37')]=_['intersection'](_0x52ce48[_0xb216('0x31')],qs[_0xb216('0x38')](_0x1b9fa2[_0xb216('0x34')][_0xb216('0x38')]));_0x3a3cbc[_0xb216('0x37')]=_0x3a3cbc[_0xb216('0x37')][_0xb216('0x39')]?_0x3a3cbc[_0xb216('0x37')]:_0x52ce48[_0xb216('0x31')];if(!_0x1b9fa2['query'][_0xb216('0x3a')]('nolimit')){_0x3a3cbc[_0xb216('0x1c')]=qs[_0xb216('0x1c')](_0x1b9fa2[_0xb216('0x34')][_0xb216('0x1c')]);_0x3a3cbc[_0xb216('0x1b')]=qs[_0xb216('0x1b')](_0x1b9fa2['query'][_0xb216('0x1b')]);}_0x3a3cbc[_0xb216('0x3b')]=qs['sort'](_0x1b9fa2[_0xb216('0x34')][_0xb216('0x3c')]);_0x3a3cbc[_0xb216('0x3d')]=qs[_0xb216('0x35')](_[_0xb216('0x3e')](_0x1b9fa2[_0xb216('0x34')],_0x52ce48['filters']),_0x27991d);if(_0x1b9fa2[_0xb216('0x34')][_0xb216('0x3f')]){_0x3a3cbc[_0xb216('0x3d')]=_[_0xb216('0x40')](_0x3a3cbc[_0xb216('0x3d')],{'$or':_[_0xb216('0x32')](_0x27991d,function(_0x25b4a0){if(_0x25b4a0['type']!==_0xb216('0x41')){var _0x2dc1dc={};_0x2dc1dc[_0x25b4a0[_0xb216('0x2b')]]={'$like':'%'+_0x1b9fa2['query'][_0xb216('0x3f')]+'%'};return _0x2dc1dc;}})});}_0x3a3cbc=_['merge']({},_0x3a3cbc,_0x1b9fa2[_0xb216('0x42')]);var _0x15ecbf={'where':_0x3a3cbc['where']};return db[_0xb216('0x2e')][_0xb216('0x1e')](_0x15ecbf)['then'](function(_0x5c73e7){_0x2cff58[_0xb216('0x1e')]=_0x5c73e7;if(_0x1b9fa2[_0xb216('0x34')][_0xb216('0x43')]){_0x3a3cbc[_0xb216('0x44')]=[{'all':!![]}];}return db[_0xb216('0x2e')][_0xb216('0x45')](_0x3a3cbc);})['then'](function(_0x3ab135){_0x2cff58[_0xb216('0x46')]=_0x3ab135;return _0x2cff58;})[_0xb216('0x26')](respondWithFilteredResult(_0x3c0a11,_0x3a3cbc))[_0xb216('0x47')](handleError(_0x3c0a11,null));};exports[_0xb216('0x48')]=function(_0x2ba10f,_0x5af221){var _0x21ba68={'raw':!![],'where':{'id':_0x2ba10f[_0xb216('0x49')]['id']}},_0x591c2b={};_0x591c2b[_0xb216('0x31')]=_['keys'](db[_0xb216('0x2e')][_0xb216('0x2f')]);_0x591c2b[_0xb216('0x34')]=_['keys'](_0x2ba10f[_0xb216('0x34')]);_0x591c2b[_0xb216('0x35')]=_[_0xb216('0x36')](_0x591c2b['model'],_0x591c2b[_0xb216('0x34')]);_0x21ba68[_0xb216('0x37')]=_[_0xb216('0x36')](_0x591c2b['model'],qs[_0xb216('0x38')](_0x2ba10f[_0xb216('0x34')][_0xb216('0x38')]));_0x21ba68[_0xb216('0x37')]=_0x21ba68[_0xb216('0x37')][_0xb216('0x39')]?_0x21ba68[_0xb216('0x37')]:_0x591c2b[_0xb216('0x31')];if(_0x2ba10f[_0xb216('0x34')][_0xb216('0x43')]){_0x21ba68[_0xb216('0x44')]=[{'all':!![]}];}_0x21ba68=_['merge']({},_0x21ba68,_0x2ba10f[_0xb216('0x42')]);return db[_0xb216('0x2e')][_0xb216('0x4a')](_0x21ba68)['then'](handleEntityNotFound(_0x5af221,null))['then'](respondWithResult(_0x5af221,null))['catch'](handleError(_0x5af221,null));};exports[_0xb216('0x4b')]=function(_0x18fc92,_0x35716a){return db[_0xb216('0x2e')][_0xb216('0x4b')](_0x18fc92[_0xb216('0x4c')],{})['then'](function(_0x181038){var _0x1bf6f1=_0x18fc92['user'][_0xb216('0x4d')]({'plain':!![]});if(!_0x1bf6f1)throw new Error(_0xb216('0x4e'));if(_0x1bf6f1[_0xb216('0x4f')]===_0xb216('0x50')){var _0x4cfad9=_0x181038[_0xb216('0x4d')]({'plain':!![]});var _0x40a736='ExtractedReports';return db[_0xb216('0x51')][_0xb216('0x4a')]({'where':{'name':_0x40a736,'userProfileId':_0x1bf6f1[_0xb216('0x52')]},'raw':!![]})[_0xb216('0x26')](function(_0xa86bda){if(_0xa86bda&&_0xa86bda[_0xb216('0x53')]===0x0){return db[_0xb216('0x28')][_0xb216('0x4b')]({'name':_0x4cfad9[_0xb216('0x2b')],'resourceId':_0x4cfad9['id'],'type':_0xa86bda[_0xb216('0x2b')],'sectionId':_0xa86bda['id']},{})[_0xb216('0x26')](function(){return _0x181038;});}else{return _0x181038;}})[_0xb216('0x47')](function(_0x2b1587){logger[_0xb216('0x54')](_0xb216('0x55'),_0x2b1587);throw _0x2b1587;});}return _0x181038;})[_0xb216('0x26')](respondWithResult(_0x35716a,0xc9))[_0xb216('0x47')](handleError(_0x35716a,null));};exports[_0xb216('0x25')]=function(_0x15f9fb,_0x316c1a){if(_0x15f9fb[_0xb216('0x4c')]['id']){delete _0x15f9fb[_0xb216('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0xb216('0x4a')]({'where':{'id':_0x15f9fb[_0xb216('0x49')]['id']}})[_0xb216('0x26')](handleEntityNotFound(_0x316c1a,null))[_0xb216('0x26')](saveUpdates(_0x15f9fb['body'],null))[_0xb216('0x26')](respondWithResult(_0x316c1a,null))[_0xb216('0x47')](handleError(_0x316c1a,null));};exports[_0xb216('0x27')]=function(_0x36a132,_0x439fa3){return db[_0xb216('0x2e')][_0xb216('0x4a')]({'where':{'id':_0x36a132['params']['id']}})['then'](handleEntityNotFound(_0x439fa3,null))[_0xb216('0x26')](removeEntity(_0x439fa3,null))[_0xb216('0x47')](handleError(_0x439fa3,null));};exports[_0xb216('0x56')]=function(_0x1175a1,_0x53ce48,_0x164a04){return db[_0xb216('0x2e')][_0xb216('0x4a')]({'where':{'id':_0x1175a1[_0xb216('0x49')]['id']},'attributes':[_0xb216('0x2b'),_0xb216('0x57'),_0xb216('0x58'),_0xb216('0x59')],'raw':!![]})[_0xb216('0x26')](handleEntityNotFound(_0x53ce48,null))[_0xb216('0x26')](function(_0x53d2d2){if(_0x53d2d2){if(!fs[_0xb216('0x5a')](path[_0xb216('0x5b')](config[_0xb216('0x5c')],_0xb216('0x5d'),_0x53d2d2[_0xb216('0x58')]))){throw new db[(_0xb216('0x5e'))][(_0xb216('0x5f'))](_0xb216('0x60'));}if(_0x1175a1[_0xb216('0x34')][_0xb216('0x61')]){return _0x53ce48[_0xb216('0x29')](0xc8);}return _0x53ce48[_0xb216('0x56')](path[_0xb216('0x5b')](config[_0xb216('0x5c')],_0xb216('0x5d'),_0x53d2d2[_0xb216('0x58')]),util['format'](_0xb216('0x62'),_0x53d2d2[_0xb216('0x57')]||_0x53d2d2['name'],_0x53d2d2[_0xb216('0x59')][_0xb216('0x63')]()));}})['catch'](handleError(_0x53ce48,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5d1e13f..ff5a21b 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 _0xd284=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird'];(function(_0x317014,_0x5f56df){var _0x94bc4b=function(_0x3aeb99){while(--_0x3aeb99){_0x317014['push'](_0x317014['shift']());}};_0x94bc4b(++_0x5f56df);}(_0xd284,0xf2));var _0x4d28=function(_0x350097,_0x312009){_0x350097=_0x350097-0x0;var _0x40d93b=_0xd284[_0x350097];return _0x40d93b;};'use strict';var _=require(_0x4d28('0x0'));var util=require(_0x4d28('0x1'));var logger=require('../../config/logger')(_0x4d28('0x2'));var moment=require(_0x4d28('0x3'));var BPromise=require(_0x4d28('0x4'));var rp=require(_0x4d28('0x5'));var fs=require('fs');var path=require(_0x4d28('0x6'));var rimraf=require(_0x4d28('0x7'));var config=require(_0x4d28('0x8'));var attributes=require(_0x4d28('0x9'));module[_0x4d28('0xa')]=function(_0x52945f,_0x294582){return _0x52945f['define'](_0x4d28('0xb'),attributes,{'tableName':_0x4d28('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x448c=['request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','api','moment','bluebird'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x448c,0x1db));var _0xc448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x448c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc448('0x0'));var util=require(_0xc448('0x1'));var logger=require('../../config/logger')(_0xc448('0x2'));var moment=require(_0xc448('0x3'));var BPromise=require(_0xc448('0x4'));var rp=require(_0xc448('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc448('0x6'));var config=require(_0xc448('0x7'));var attributes=require(_0xc448('0x8'));module[_0xc448('0x9')]=function(_0x5eadad,_0x4a4487){return _0x5eadad[_0xc448('0xa')](_0xc448('0xb'),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 060247a..cfea2b9 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 _0x46af=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x901b0e,_0x171d04){var _0x50bbf3=function(_0x263499){while(--_0x263499){_0x901b0e['push'](_0x901b0e['shift']());}};_0x50bbf3(++_0x171d04);}(_0x46af,0x1a9));var _0xf46a=function(_0x5f0bee,_0xbba723){_0x5f0bee=_0x5f0bee-0x0;var _0x100370=_0x46af[_0x5f0bee];return _0x100370;};'use strict';var _=require(_0xf46a('0x0'));var util=require('util');var moment=require(_0xf46a('0x1'));var BPromise=require(_0xf46a('0x2'));var rs=require(_0xf46a('0x3'));var fs=require('fs');var Redis=require(_0xf46a('0x4'));var db=require(_0xf46a('0x5'))['db'];var utils=require(_0xf46a('0x6'));var logger=require(_0xf46a('0x7'))(_0xf46a('0x8'));var config=require(_0xf46a('0x9'));var jayson=require(_0xf46a('0xa'));var client=jayson[_0xf46a('0xb')][_0xf46a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc365c2,_0x7f199d,_0x644040){return new BPromise(function(_0x2539d7,_0xf65018){return client[_0xf46a('0xd')](_0xc365c2,_0x644040)[_0xf46a('0xe')](function(_0x4c2732){logger[_0xf46a('0xf')](_0xf46a('0x10'),_0x7f199d,_0xf46a('0x11'));logger['debug'](_0xf46a('0x12'),_0x7f199d,_0xf46a('0x11'),JSON[_0xf46a('0x13')](_0x4c2732));if(_0x4c2732[_0xf46a('0x14')]){if(_0x4c2732[_0xf46a('0x14')]['code']===0x1f4){logger['error'](_0xf46a('0x10'),_0x7f199d,_0x4c2732[_0xf46a('0x14')][_0xf46a('0x15')]);return _0xf65018(_0x4c2732[_0xf46a('0x14')][_0xf46a('0x15')]);}logger[_0xf46a('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x7f199d,_0x4c2732[_0xf46a('0x14')][_0xf46a('0x15')]);return _0x2539d7(_0x4c2732['error'][_0xf46a('0x15')]);}else{logger[_0xf46a('0xf')](_0xf46a('0x10'),_0x7f199d,_0xf46a('0x11'));_0x2539d7(_0x4c2732[_0xf46a('0x16')][_0xf46a('0x15')]);}})[_0xf46a('0x17')](function(_0x26ccc6){logger[_0xf46a('0x14')](_0xf46a('0x10'),_0x7f199d,_0x26ccc6);_0xf65018(_0x26ccc6);});});} \ No newline at end of file +var _0xf3e2=['rpc','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf3e2,0x168));var _0x2f3e=function(_0x2594ef,_0xeeffc0){_0x2594ef=_0x2594ef-0x0;var _0x1faa38=_0xf3e2[_0x2594ef];return _0x1faa38;};'use strict';var _=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var moment=require(_0x2f3e('0x2'));var BPromise=require(_0x2f3e('0x3'));var rs=require(_0x2f3e('0x4'));var fs=require('fs');var Redis=require(_0x2f3e('0x5'));var db=require(_0x2f3e('0x6'))['db'];var utils=require(_0x2f3e('0x7'));var logger=require('../../config/logger')(_0x2f3e('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f3e('0x9'));var client=jayson[_0x2f3e('0xa')][_0x2f3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392f91,_0x3b556b,_0x1ac142){return new BPromise(function(_0x30f939,_0x46ec1b){return client['request'](_0x392f91,_0x1ac142)[_0x2f3e('0xc')](function(_0x4d7f7d){logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));logger[_0x2f3e('0x10')](_0x2f3e('0x11'),_0x3b556b,_0x2f3e('0xf'),JSON[_0x2f3e('0x12')](_0x4d7f7d));if(_0x4d7f7d[_0x2f3e('0x13')]){if(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x14')]===0x1f4){logger[_0x2f3e('0x13')](_0x2f3e('0xe'),_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x46ec1b(_0x4d7f7d['error'][_0x2f3e('0x15')]);}logger[_0x2f3e('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x30f939(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x15')]);}else{logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));_0x30f939(_0x4d7f7d['result'][_0x2f3e('0x15')]);}})[_0x2f3e('0x16')](function(_0x15398d){logger[_0x2f3e('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3b556b,_0x15398d);_0x46ec1b(_0x15398d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 41b2d7d..3567507 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 _0xcd94=['show','/:id/download','download','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xcd94,0x1c1));var _0x4cd9=function(_0x5c08cb,_0x456960){_0x5c08cb=_0x5c08cb-0x0;var _0x147907=_0xcd94[_0x5c08cb];return _0x147907;};'use strict';var multer=require(_0x4cd9('0x0'));var util=require(_0x4cd9('0x1'));var path=require(_0x4cd9('0x2'));var timeout=require(_0x4cd9('0x3'));var express=require('express');var router=express[_0x4cd9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4cd9('0x5'));var interaction=require(_0x4cd9('0x6'));var config=require(_0x4cd9('0x7'));var controller=require(_0x4cd9('0x8'));router['get']('/',auth[_0x4cd9('0x9')](),controller[_0x4cd9('0xa')]);router[_0x4cd9('0xb')](_0x4cd9('0xc'),auth[_0x4cd9('0x9')](),controller[_0x4cd9('0xd')]);router[_0x4cd9('0xb')](_0x4cd9('0xe'),auth[_0x4cd9('0x9')](),controller[_0x4cd9('0xf')]);router[_0x4cd9('0x10')]('/',auth['isAuthenticated'](),controller[_0x4cd9('0x11')]);router[_0x4cd9('0x12')](_0x4cd9('0xc'),auth[_0x4cd9('0x9')](),controller['update']);router[_0x4cd9('0x13')]('/:id',auth[_0x4cd9('0x9')](),controller['destroy']);module[_0x4cd9('0x14')]=router; \ No newline at end of file +var _0x9c38=['index','/:id/download','download','create','put','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x9c38,0x1d0));var _0x89c3=function(_0x106cde,_0x32718d){_0x106cde=_0x106cde-0x0;var _0x39605f=_0x9c38[_0x106cde];return _0x39605f;};'use strict';var multer=require(_0x89c3('0x0'));var util=require(_0x89c3('0x1'));var path=require(_0x89c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x89c3('0x3'));var router=express[_0x89c3('0x4')]();var fs_extra=require(_0x89c3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x89c3('0x6'));var config=require(_0x89c3('0x7'));var controller=require(_0x89c3('0x8'));router[_0x89c3('0x9')]('/',auth[_0x89c3('0xa')](),controller[_0x89c3('0xb')]);router[_0x89c3('0x9')]('/:id',auth[_0x89c3('0xa')](),controller['show']);router[_0x89c3('0x9')](_0x89c3('0xc'),auth[_0x89c3('0xa')](),controller[_0x89c3('0xd')]);router['post']('/',auth[_0x89c3('0xa')](),controller[_0x89c3('0xe')]);router[_0x89c3('0xf')]('/:id',auth[_0x89c3('0xa')](),controller['update']);router['delete'](_0x89c3('0x10'),auth[_0x89c3('0xa')](),controller[_0x89c3('0x11')]);module[_0x89c3('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6db3a89..4dfb27a 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 _0x53d6=['BOOLEAN','TEXT','STRING'];(function(_0x5db407,_0x5cbaaa){var _0x5e7d38=function(_0x7d76b5){while(--_0x7d76b5){_0x5db407['push'](_0x5db407['shift']());}};_0x5e7d38(++_0x5cbaaa);}(_0x53d6,0x16f));var _0x653d=function(_0x4e1119,_0x32dc78){_0x4e1119=_0x4e1119-0x0;var _0x35f53d=_0x53d6[_0x4e1119];return _0x35f53d;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x653d('0x0')]},'alias':{'type':Sequelize[_0x653d('0x1')]},'function':{'type':Sequelize[_0x653d('0x1')]},'format':{'type':Sequelize[_0x653d('0x1')]},'groupBy':{'type':Sequelize[_0x653d('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x653d('0x1')]},'custom':{'type':Sequelize[_0x653d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x60a6=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3e33d3,_0xa30c3){var _0x3ce611=function(_0x20055b){while(--_0x20055b){_0x3e33d3['push'](_0x3e33d3['shift']());}};_0x3ce611(++_0xa30c3);}(_0x60a6,0x14c));var _0x660a=function(_0x38742e,_0x41444d){_0x38742e=_0x38742e-0x0;var _0x12e8f4=_0x60a6[_0x38742e];return _0x12e8f4;};'use strict';var Sequelize=require(_0x660a('0x0'));module[_0x660a('0x1')]={'field':{'type':Sequelize[_0x660a('0x2')]},'alias':{'type':Sequelize[_0x660a('0x3')]},'function':{'type':Sequelize[_0x660a('0x3')]},'format':{'type':Sequelize[_0x660a('0x3')]},'groupBy':{'type':Sequelize[_0x660a('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x660a('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 1a16f7c..5ed5f18 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 _0xf4d3=['attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x30b7d3,_0x2fa247){var _0x3c23d2=function(_0x7536bc){while(--_0x7536bc){_0x30b7d3['push'](_0x30b7d3['shift']());}};_0x3c23d2(++_0x2fa247);}(_0xf4d3,0x10a));var _0x3f4d=function(_0x395a48,_0x5d63c9){_0x395a48=_0x395a48-0x0;var _0x378ee3=_0xf4d3[_0x395a48];return _0x378ee3;};'use strict';var emlformat=require(_0x3f4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f4d('0x1'));var jsonpatch=require(_0x3f4d('0x2'));var rp=require(_0x3f4d('0x3'));var moment=require(_0x3f4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f4d('0x5'));var util=require(_0x3f4d('0x6'));var path=require(_0x3f4d('0x7'));var sox=require(_0x3f4d('0x8'));var csv=require(_0x3f4d('0x9'));var ejs=require(_0x3f4d('0xa'));var fs=require('fs');var fs_extra=require(_0x3f4d('0xb'));var _=require('lodash');var squel=require(_0x3f4d('0xc'));var crypto=require(_0x3f4d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f4d('0xe'));var toCsv=require(_0x3f4d('0x9'));var querystring=require(_0x3f4d('0xf'));var Papa=require(_0x3f4d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f4d('0x11'));var as=require(_0x3f4d('0x12'));var hardwareService=require(_0x3f4d('0x13'));var logger=require(_0x3f4d('0x14'))(_0x3f4d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f4d('0x16'));var db=require(_0x3f4d('0x17'))['db'];function respondWithStatusCode(_0x1e279f,_0x6ce2ab){_0x6ce2ab=_0x6ce2ab||0xcc;return function(_0x169d68){if(_0x169d68){return _0x1e279f[_0x3f4d('0x18')](_0x6ce2ab);}return _0x1e279f[_0x3f4d('0x19')](_0x6ce2ab)[_0x3f4d('0x1a')]();};}function respondWithResult(_0x1cebc4,_0x40f832){_0x40f832=_0x40f832||0xc8;return function(_0x46dba2){if(_0x46dba2){return _0x1cebc4[_0x3f4d('0x19')](_0x40f832)['json'](_0x46dba2);}};}function respondWithFilteredResult(_0x46d4a6,_0x55d34b){return function(_0x5d3552){if(_0x5d3552){var _0x3a6b21=typeof _0x55d34b[_0x3f4d('0x1b')]===_0x3f4d('0x1c')&&typeof _0x55d34b['limit']==='undefined';var _0x1bd92f=_0x5d3552[_0x3f4d('0x1d')];var _0xc77996=_0x3a6b21?0x0:_0x55d34b[_0x3f4d('0x1b')];var _0x463589=_0x3a6b21?_0x5d3552[_0x3f4d('0x1d')]:_0x55d34b[_0x3f4d('0x1b')]+_0x55d34b[_0x3f4d('0x1e')];var _0x2d32dc;if(_0x463589>=_0x1bd92f){_0x463589=_0x1bd92f;_0x2d32dc=0xc8;}else{_0x2d32dc=0xce;}_0x46d4a6[_0x3f4d('0x19')](_0x2d32dc);return _0x46d4a6[_0x3f4d('0x1f')](_0x3f4d('0x20'),_0xc77996+'-'+_0x463589+'/'+_0x1bd92f)['json'](_0x5d3552);}return null;};}function patchUpdates(_0x4a255a){return function(_0xb34558){try{jsonpatch['apply'](_0xb34558,_0x4a255a,!![]);}catch(_0x12afef){return BPromise[_0x3f4d('0x21')](_0x12afef);}return _0xb34558[_0x3f4d('0x22')]();};}function saveUpdates(_0x106c97,_0x61af55){return function(_0x48f782){if(_0x48f782){return _0x48f782[_0x3f4d('0x23')](_0x106c97)[_0x3f4d('0x24')](function(_0xdf88ef){return _0xdf88ef;});}return null;};}function removeEntity(_0x308803,_0x54dd30){return function(_0x4d3f21){if(_0x4d3f21){return _0x4d3f21[_0x3f4d('0x25')]()[_0x3f4d('0x24')](function(){_0x308803[_0x3f4d('0x19')](0xcc)[_0x3f4d('0x1a')]();});}};}function handleEntityNotFound(_0x321e4b,_0x146f6b){return function(_0x2084d1){if(!_0x2084d1){_0x321e4b[_0x3f4d('0x18')](0x194);}return _0x2084d1;};}function handleError(_0x1a569a,_0x22b7f9){_0x22b7f9=_0x22b7f9||0x1f4;return function(_0x561d11){logger[_0x3f4d('0x26')](_0x561d11['stack']);if(_0x561d11['name']){delete _0x561d11[_0x3f4d('0x27')];}_0x1a569a[_0x3f4d('0x19')](_0x22b7f9)['send'](_0x561d11);};}exports['index']=function(_0x21d421,_0x1984d7){var _0x32dea0={},_0x3027a4={},_0x73b990={'count':0x0,'rows':[]};var _0x30b8bc=_[_0x3f4d('0x28')](db[_0x3f4d('0x29')][_0x3f4d('0x2a')],function(_0x9faa01){return{'name':_0x9faa01[_0x3f4d('0x2b')],'type':_0x9faa01[_0x3f4d('0x2c')][_0x3f4d('0x2d')]};});_0x3027a4[_0x3f4d('0x2e')]=_[_0x3f4d('0x28')](_0x30b8bc,'name');_0x3027a4[_0x3f4d('0x2f')]=_[_0x3f4d('0x30')](_0x21d421[_0x3f4d('0x2f')]);_0x3027a4[_0x3f4d('0x31')]=_['intersection'](_0x3027a4[_0x3f4d('0x2e')],_0x3027a4[_0x3f4d('0x2f')]);_0x32dea0[_0x3f4d('0x32')]=_['intersection'](_0x3027a4[_0x3f4d('0x2e')],qs[_0x3f4d('0x33')](_0x21d421[_0x3f4d('0x2f')][_0x3f4d('0x33')]));_0x32dea0[_0x3f4d('0x32')]=_0x32dea0[_0x3f4d('0x32')][_0x3f4d('0x34')]?_0x32dea0[_0x3f4d('0x32')]:_0x3027a4[_0x3f4d('0x2e')];if(!_0x21d421[_0x3f4d('0x2f')][_0x3f4d('0x35')]('nolimit')){_0x32dea0[_0x3f4d('0x1e')]=qs[_0x3f4d('0x1e')](_0x21d421[_0x3f4d('0x2f')][_0x3f4d('0x1e')]);_0x32dea0['offset']=qs[_0x3f4d('0x1b')](_0x21d421[_0x3f4d('0x2f')]['offset']);}_0x32dea0['order']=qs[_0x3f4d('0x36')](_0x21d421['query'][_0x3f4d('0x36')]);_0x32dea0['where']=qs[_0x3f4d('0x31')](_[_0x3f4d('0x37')](_0x21d421['query'],_0x3027a4[_0x3f4d('0x31')]),_0x30b8bc);if(_0x21d421[_0x3f4d('0x2f')][_0x3f4d('0x38')]){_0x32dea0['where']=_['merge'](_0x32dea0[_0x3f4d('0x39')],{'$or':_[_0x3f4d('0x28')](_0x30b8bc,function(_0x21efc8){if(_0x21efc8[_0x3f4d('0x2c')]!=='VIRTUAL'){var _0x33566d={};_0x33566d[_0x21efc8['name']]={'$like':'%'+_0x21d421[_0x3f4d('0x2f')][_0x3f4d('0x38')]+'%'};return _0x33566d;}})});}_0x32dea0=_[_0x3f4d('0x3a')]({},_0x32dea0,_0x21d421[_0x3f4d('0x3b')]);var _0x1767da={'where':_0x32dea0[_0x3f4d('0x39')]};return db[_0x3f4d('0x29')][_0x3f4d('0x1d')](_0x1767da)['then'](function(_0x2e36a8){_0x73b990['count']=_0x2e36a8;if(_0x21d421['query'][_0x3f4d('0x3c')]){_0x32dea0[_0x3f4d('0x3d')]=[{'all':!![]}];}return db[_0x3f4d('0x29')][_0x3f4d('0x3e')](_0x32dea0);})[_0x3f4d('0x24')](function(_0x76e11a){_0x73b990[_0x3f4d('0x3f')]=_0x76e11a;return _0x73b990;})[_0x3f4d('0x24')](respondWithFilteredResult(_0x1984d7,_0x32dea0))[_0x3f4d('0x40')](handleError(_0x1984d7,null));};exports[_0x3f4d('0x41')]=function(_0x4a4762,_0x42f8eb){var _0x592782={'raw':![],'where':{'id':_0x4a4762[_0x3f4d('0x42')]['id']}},_0x36e1a7={};_0x36e1a7['model']=_[_0x3f4d('0x30')](db[_0x3f4d('0x29')][_0x3f4d('0x2a')]);_0x36e1a7[_0x3f4d('0x2f')]=_[_0x3f4d('0x30')](_0x4a4762[_0x3f4d('0x2f')]);_0x36e1a7[_0x3f4d('0x31')]=_[_0x3f4d('0x43')](_0x36e1a7['model'],_0x36e1a7['query']);_0x592782[_0x3f4d('0x32')]=_[_0x3f4d('0x43')](_0x36e1a7[_0x3f4d('0x2e')],qs['fields'](_0x4a4762[_0x3f4d('0x2f')][_0x3f4d('0x33')]));_0x592782[_0x3f4d('0x32')]=_0x592782['attributes'][_0x3f4d('0x34')]?_0x592782['attributes']:_0x36e1a7[_0x3f4d('0x2e')];if(_0x4a4762[_0x3f4d('0x2f')][_0x3f4d('0x3c')]){_0x592782[_0x3f4d('0x3d')]=[{'all':!![]}];}_0x592782=_['merge']({},_0x592782,_0x4a4762['options']);return db[_0x3f4d('0x29')][_0x3f4d('0x44')](_0x592782)[_0x3f4d('0x24')](handleEntityNotFound(_0x42f8eb,null))[_0x3f4d('0x24')](respondWithResult(_0x42f8eb,null))['catch'](handleError(_0x42f8eb,null));};exports[_0x3f4d('0x45')]=function(_0xdd0d48,_0x5af71c){return db[_0x3f4d('0x29')][_0x3f4d('0x45')](_0xdd0d48[_0x3f4d('0x46')],{})[_0x3f4d('0x24')](respondWithResult(_0x5af71c,0xc9))['catch'](handleError(_0x5af71c,null));};exports[_0x3f4d('0x47')]=function(_0x5670f4,_0x41125e){return db[_0x3f4d('0x29')]['bulkCreate'](_0x5670f4[_0x3f4d('0x46')],{'raw':![],'individualHooks':!![]})[_0x3f4d('0x24')](respondWithResult(_0x41125e,0xc9))['catch'](handleError(_0x41125e,null));};exports[_0x3f4d('0x23')]=function(_0x52374d,_0x4cf5f2){if(_0x52374d[_0x3f4d('0x46')]['id']){delete _0x52374d[_0x3f4d('0x46')]['id'];}return db[_0x3f4d('0x29')]['find']({'where':{'id':_0x52374d[_0x3f4d('0x42')]['id']}})[_0x3f4d('0x24')](handleEntityNotFound(_0x4cf5f2,null))['then'](saveUpdates(_0x52374d[_0x3f4d('0x46')],null))[_0x3f4d('0x24')](respondWithResult(_0x4cf5f2,null))['catch'](handleError(_0x4cf5f2,null));};exports[_0x3f4d('0x25')]=function(_0x5ba110,_0x30f4f8){return db[_0x3f4d('0x29')][_0x3f4d('0x44')]({'where':{'id':_0x5ba110['params']['id']}})['then'](handleEntityNotFound(_0x30f4f8,null))[_0x3f4d('0x24')](removeEntity(_0x30f4f8,null))['catch'](handleError(_0x30f4f8,null));};exports[_0x3f4d('0x48')]=function(_0x181113,_0x2aa678){return db[_0x3f4d('0x29')][_0x3f4d('0x25')]({'where':{'id':_0x181113[_0x3f4d('0x2f')][_0x3f4d('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x3f4d('0x24')](respondWithResult(_0x2aa678,0xcc))[_0x3f4d('0x40')](handleError(_0x2aa678,null));};exports['addFields']=function(_0x665788,_0x57a36e,_0xdaf412){return db[_0x3f4d('0x4a')][_0x3f4d('0x4b')]({'where':{'id':_0x665788[_0x3f4d('0x42')]['id']}})[_0x3f4d('0x24')](handleEntityNotFound(_0x57a36e,null))[_0x3f4d('0x24')](function(_0x3e005f){if(_0x3e005f){return db[_0x3f4d('0x4c')][_0x3f4d('0x4d')](function(_0x5253f6){return db[_0x3f4d('0x29')][_0x3f4d('0x25')]({'where':{'CustomReportId':_0x665788[_0x3f4d('0x42')]['id']},'transaction':_0x5253f6})[_0x3f4d('0x24')](function(_0xb88963){var _0x45b5fa=_[_0x3f4d('0x28')](_0x665788[_0x3f4d('0x46')],function(_0x155841){delete _0x155841['id'];_0x155841[_0x3f4d('0x4e')]=_0x665788[_0x3f4d('0x42')]['id'];return _0x155841;});return db[_0x3f4d('0x29')][_0x3f4d('0x47')](_0x45b5fa,{'transaction':_0x5253f6});});})['then'](function(){return db[_0x3f4d('0x29')]['findAll']({'where':{'CustomReportId':_0x665788[_0x3f4d('0x42')]['id']}});});}})[_0x3f4d('0x24')](respondWithResult(_0x57a36e,null))[_0x3f4d('0x40')](handleError(_0x57a36e,null));}; \ No newline at end of file +var _0xc903=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','attributes','intersection','length','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','params','keys','fields','include','catch','create','body','bulkCreate','find','bulkDestroy','addFields','AnalyticCustomReport','findOne','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1c2193,_0x56984a){var _0x320d58=function(_0x5b8fb6){while(--_0x5b8fb6){_0x1c2193['push'](_0x1c2193['shift']());}};_0x320d58(++_0x56984a);}(_0xc903,0x128));var _0x3c90=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0xc903[_0x27c068];return _0xe5a67f;};'use strict';var emlformat=require(_0x3c90('0x0'));var rimraf=require(_0x3c90('0x1'));var zipdir=require(_0x3c90('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c90('0x3'));var moment=require(_0x3c90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c90('0x5'));var util=require(_0x3c90('0x6'));var path=require(_0x3c90('0x7'));var sox=require(_0x3c90('0x8'));var csv=require(_0x3c90('0x9'));var ejs=require(_0x3c90('0xa'));var fs=require('fs');var fs_extra=require(_0x3c90('0xb'));var _=require(_0x3c90('0xc'));var squel=require(_0x3c90('0xd'));var crypto=require(_0x3c90('0xe'));var jsforce=require(_0x3c90('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c90('0x10'));var Papa=require('papaparse');var Redis=require(_0x3c90('0x11'));var authService=require(_0x3c90('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3c90('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c90('0x14'))('api');var utils=require(_0x3c90('0x15'));var config=require(_0x3c90('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x83d9d8,_0x3c8ac1){_0x3c8ac1=_0x3c8ac1||0xcc;return function(_0x55ea07){if(_0x55ea07){return _0x83d9d8[_0x3c90('0x17')](_0x3c8ac1);}return _0x83d9d8[_0x3c90('0x18')](_0x3c8ac1)[_0x3c90('0x19')]();};}function respondWithResult(_0x14a5a2,_0x43eef){_0x43eef=_0x43eef||0xc8;return function(_0xdcab3b){if(_0xdcab3b){return _0x14a5a2[_0x3c90('0x18')](_0x43eef)[_0x3c90('0x1a')](_0xdcab3b);}};}function respondWithFilteredResult(_0x1d6eb9,_0x3e925e){return function(_0x4d792a){if(_0x4d792a){var _0x57d5b9=typeof _0x3e925e[_0x3c90('0x1b')]===_0x3c90('0x1c')&&typeof _0x3e925e[_0x3c90('0x1d')]===_0x3c90('0x1c');var _0x179c68=_0x4d792a[_0x3c90('0x1e')];var _0x469d11=_0x57d5b9?0x0:_0x3e925e['offset'];var _0x37fd6f=_0x57d5b9?_0x4d792a['count']:_0x3e925e['offset']+_0x3e925e['limit'];var _0x287670;if(_0x37fd6f>=_0x179c68){_0x37fd6f=_0x179c68;_0x287670=0xc8;}else{_0x287670=0xce;}_0x1d6eb9[_0x3c90('0x18')](_0x287670);return _0x1d6eb9[_0x3c90('0x1f')](_0x3c90('0x20'),_0x469d11+'-'+_0x37fd6f+'/'+_0x179c68)['json'](_0x4d792a);}return null;};}function patchUpdates(_0x5b158e){return function(_0x4b1d57){try{jsonpatch[_0x3c90('0x21')](_0x4b1d57,_0x5b158e,!![]);}catch(_0xfc2cd5){return BPromise[_0x3c90('0x22')](_0xfc2cd5);}return _0x4b1d57[_0x3c90('0x23')]();};}function saveUpdates(_0xcc511c,_0x44f6b5){return function(_0x49626b){if(_0x49626b){return _0x49626b[_0x3c90('0x24')](_0xcc511c)[_0x3c90('0x25')](function(_0x3c48b8){return _0x3c48b8;});}return null;};}function removeEntity(_0x1bad47,_0x73d4a5){return function(_0x3a6eb1){if(_0x3a6eb1){return _0x3a6eb1[_0x3c90('0x26')]()[_0x3c90('0x25')](function(){_0x1bad47[_0x3c90('0x18')](0xcc)[_0x3c90('0x19')]();});}};}function handleEntityNotFound(_0x45a39d,_0x4ce97f){return function(_0x1eef67){if(!_0x1eef67){_0x45a39d[_0x3c90('0x17')](0x194);}return _0x1eef67;};}function handleError(_0x4197d3,_0x770762){_0x770762=_0x770762||0x1f4;return function(_0xed1e1c){logger[_0x3c90('0x27')](_0xed1e1c[_0x3c90('0x28')]);if(_0xed1e1c[_0x3c90('0x29')]){delete _0xed1e1c[_0x3c90('0x29')];}_0x4197d3[_0x3c90('0x18')](_0x770762)[_0x3c90('0x2a')](_0xed1e1c);};}exports[_0x3c90('0x2b')]=function(_0x49f727,_0x28256d){var _0x5adfd0={},_0x1373a1={},_0x2985e7={'count':0x0,'rows':[]};var _0x52bdc0=_['map'](db['AnalyticFieldReport'][_0x3c90('0x2c')],function(_0x5829e6){return{'name':_0x5829e6[_0x3c90('0x2d')],'type':_0x5829e6[_0x3c90('0x2e')]['key']};});_0x1373a1[_0x3c90('0x2f')]=_[_0x3c90('0x30')](_0x52bdc0,_0x3c90('0x29'));_0x1373a1[_0x3c90('0x31')]=_['keys'](_0x49f727[_0x3c90('0x31')]);_0x1373a1['filters']=_['intersection'](_0x1373a1[_0x3c90('0x2f')],_0x1373a1[_0x3c90('0x31')]);_0x5adfd0[_0x3c90('0x32')]=_[_0x3c90('0x33')](_0x1373a1[_0x3c90('0x2f')],qs['fields'](_0x49f727['query']['fields']));_0x5adfd0[_0x3c90('0x32')]=_0x5adfd0['attributes'][_0x3c90('0x34')]?_0x5adfd0[_0x3c90('0x32')]:_0x1373a1[_0x3c90('0x2f')];if(!_0x49f727[_0x3c90('0x31')]['hasOwnProperty'](_0x3c90('0x35'))){_0x5adfd0[_0x3c90('0x1d')]=qs[_0x3c90('0x1d')](_0x49f727[_0x3c90('0x31')][_0x3c90('0x1d')]);_0x5adfd0[_0x3c90('0x1b')]=qs[_0x3c90('0x1b')](_0x49f727['query'][_0x3c90('0x1b')]);}_0x5adfd0['order']=qs[_0x3c90('0x36')](_0x49f727[_0x3c90('0x31')]['sort']);_0x5adfd0['where']=qs[_0x3c90('0x37')](_[_0x3c90('0x38')](_0x49f727[_0x3c90('0x31')],_0x1373a1['filters']),_0x52bdc0);if(_0x49f727[_0x3c90('0x31')]['filter']){_0x5adfd0[_0x3c90('0x39')]=_[_0x3c90('0x3a')](_0x5adfd0[_0x3c90('0x39')],{'$or':_[_0x3c90('0x30')](_0x52bdc0,function(_0x6b9994){if(_0x6b9994[_0x3c90('0x2e')]!==_0x3c90('0x3b')){var _0x50fc76={};_0x50fc76[_0x6b9994[_0x3c90('0x29')]]={'$like':'%'+_0x49f727['query'][_0x3c90('0x3c')]+'%'};return _0x50fc76;}})});}_0x5adfd0=_['merge']({},_0x5adfd0,_0x49f727[_0x3c90('0x3d')]);var _0x32568d={'where':_0x5adfd0['where']};return db[_0x3c90('0x3e')][_0x3c90('0x1e')](_0x32568d)[_0x3c90('0x25')](function(_0x3fca58){_0x2985e7['count']=_0x3fca58;if(_0x49f727['query'][_0x3c90('0x3f')]){_0x5adfd0['include']=[{'all':!![]}];}return db[_0x3c90('0x3e')]['findAll'](_0x5adfd0);})[_0x3c90('0x25')](function(_0x262408){_0x2985e7['rows']=_0x262408;return _0x2985e7;})['then'](respondWithFilteredResult(_0x28256d,_0x5adfd0))['catch'](handleError(_0x28256d,null));};exports['show']=function(_0x24239f,_0x1e0c81){var _0x42b8b2={'raw':![],'where':{'id':_0x24239f[_0x3c90('0x40')]['id']}},_0x47b43f={};_0x47b43f[_0x3c90('0x2f')]=_[_0x3c90('0x41')](db[_0x3c90('0x3e')][_0x3c90('0x2c')]);_0x47b43f[_0x3c90('0x31')]=_[_0x3c90('0x41')](_0x24239f[_0x3c90('0x31')]);_0x47b43f[_0x3c90('0x37')]=_[_0x3c90('0x33')](_0x47b43f['model'],_0x47b43f[_0x3c90('0x31')]);_0x42b8b2[_0x3c90('0x32')]=_['intersection'](_0x47b43f[_0x3c90('0x2f')],qs[_0x3c90('0x42')](_0x24239f[_0x3c90('0x31')][_0x3c90('0x42')]));_0x42b8b2[_0x3c90('0x32')]=_0x42b8b2[_0x3c90('0x32')][_0x3c90('0x34')]?_0x42b8b2[_0x3c90('0x32')]:_0x47b43f[_0x3c90('0x2f')];if(_0x24239f['query'][_0x3c90('0x3f')]){_0x42b8b2[_0x3c90('0x43')]=[{'all':!![]}];}_0x42b8b2=_[_0x3c90('0x3a')]({},_0x42b8b2,_0x24239f[_0x3c90('0x3d')]);return db[_0x3c90('0x3e')]['find'](_0x42b8b2)[_0x3c90('0x25')](handleEntityNotFound(_0x1e0c81,null))[_0x3c90('0x25')](respondWithResult(_0x1e0c81,null))[_0x3c90('0x44')](handleError(_0x1e0c81,null));};exports[_0x3c90('0x45')]=function(_0x9dc570,_0x23d3b4){return db[_0x3c90('0x3e')][_0x3c90('0x45')](_0x9dc570[_0x3c90('0x46')],{})['then'](respondWithResult(_0x23d3b4,0xc9))['catch'](handleError(_0x23d3b4,null));};exports[_0x3c90('0x47')]=function(_0xf0a6a6,_0x1fbea0){return db[_0x3c90('0x3e')]['bulkCreate'](_0xf0a6a6['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1fbea0,0xc9))[_0x3c90('0x44')](handleError(_0x1fbea0,null));};exports[_0x3c90('0x24')]=function(_0x240a97,_0x41d3e8){if(_0x240a97[_0x3c90('0x46')]['id']){delete _0x240a97[_0x3c90('0x46')]['id'];}return db[_0x3c90('0x3e')][_0x3c90('0x48')]({'where':{'id':_0x240a97['params']['id']}})[_0x3c90('0x25')](handleEntityNotFound(_0x41d3e8,null))[_0x3c90('0x25')](saveUpdates(_0x240a97[_0x3c90('0x46')],null))[_0x3c90('0x25')](respondWithResult(_0x41d3e8,null))[_0x3c90('0x44')](handleError(_0x41d3e8,null));};exports[_0x3c90('0x26')]=function(_0x145e35,_0x26991a){return db['AnalyticFieldReport'][_0x3c90('0x48')]({'where':{'id':_0x145e35['params']['id']}})[_0x3c90('0x25')](handleEntityNotFound(_0x26991a,null))[_0x3c90('0x25')](removeEntity(_0x26991a,null))[_0x3c90('0x44')](handleError(_0x26991a,null));};exports[_0x3c90('0x49')]=function(_0x2ec936,_0x498e63){return db[_0x3c90('0x3e')][_0x3c90('0x26')]({'where':{'id':_0x2ec936[_0x3c90('0x31')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3c90('0x25')](respondWithResult(_0x498e63,0xcc))[_0x3c90('0x44')](handleError(_0x498e63,null));};exports[_0x3c90('0x4a')]=function(_0x5ba8a7,_0x4325f8,_0x1bcf04){return db[_0x3c90('0x4b')][_0x3c90('0x4c')]({'where':{'id':_0x5ba8a7['params']['id']}})[_0x3c90('0x25')](handleEntityNotFound(_0x4325f8,null))[_0x3c90('0x25')](function(_0x2d0f96){if(_0x2d0f96){return db['sequelize']['transaction'](function(_0x11473c){return db[_0x3c90('0x3e')][_0x3c90('0x26')]({'where':{'CustomReportId':_0x5ba8a7['params']['id']},'transaction':_0x11473c})[_0x3c90('0x25')](function(_0x2d0ebb){var _0x438997=_[_0x3c90('0x30')](_0x5ba8a7[_0x3c90('0x46')],function(_0x51b119){delete _0x51b119['id'];_0x51b119[_0x3c90('0x4d')]=_0x5ba8a7[_0x3c90('0x40')]['id'];return _0x51b119;});return db['AnalyticFieldReport']['bulkCreate'](_0x438997,{'transaction':_0x11473c});});})[_0x3c90('0x25')](function(){return db[_0x3c90('0x3e')]['findAll']({'where':{'CustomReportId':_0x5ba8a7['params']['id']}});});}})['then'](respondWithResult(_0x4325f8,null))[_0x3c90('0x44')](handleError(_0x4325f8,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0d27185..dd26614 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 _0x31e6=['request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_fields','util','../../config/logger','bluebird'];(function(_0x4d247c,_0x3dff9e){var _0x42c60c=function(_0x399acd){while(--_0x399acd){_0x4d247c['push'](_0x4d247c['shift']());}};_0x42c60c(++_0x3dff9e);}(_0x31e6,0x183));var _0x631e=function(_0x17d5c1,_0x4215c2){_0x17d5c1=_0x17d5c1-0x0;var _0x40cd71=_0x31e6[_0x17d5c1];return _0x40cd71;};'use strict';var _=require('lodash');var util=require(_0x631e('0x0'));var logger=require(_0x631e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x631e('0x2'));var rp=require(_0x631e('0x3'));var fs=require('fs');var path=require(_0x631e('0x4'));var rimraf=require(_0x631e('0x5'));var config=require(_0x631e('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x631e('0x7')]=function(_0x399310,_0x58b6e7){return _0x399310[_0x631e('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x631e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a83=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x30ebcb,_0x1ea3ec){var _0x608417=function(_0x33b10b){while(--_0x33b10b){_0x30ebcb['push'](_0x30ebcb['shift']());}};_0x608417(++_0x1ea3ec);}(_0x5a83,0x11e));var _0x35a8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5a83[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x35a8('0x0'));var util=require('util');var logger=require(_0x35a8('0x1'))(_0x35a8('0x2'));var moment=require(_0x35a8('0x3'));var BPromise=require('bluebird');var rp=require(_0x35a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35a8('0x5'));var config=require(_0x35a8('0x6'));var attributes=require(_0x35a8('0x7'));module['exports']=function(_0x36d785,_0x40ef66){return _0x36d785[_0x35a8('0x8')](_0x35a8('0x9'),attributes,{'tableName':_0x35a8('0xa'),'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 a2c068a..175f4fe 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 _0xc56e=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2578cc,_0x34d47e){var _0xe2fc82=function(_0x26ab0b){while(--_0x26ab0b){_0x2578cc['push'](_0x2578cc['shift']());}};_0xe2fc82(++_0x34d47e);}(_0xc56e,0x184));var _0xec56=function(_0xe8f52a,_0x4693a7){_0xe8f52a=_0xe8f52a-0x0;var _0x37a320=_0xc56e[_0xe8f52a];return _0x37a320;};'use strict';var _=require(_0xec56('0x0'));var util=require('util');var moment=require(_0xec56('0x1'));var BPromise=require(_0xec56('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec56('0x3'))['db'];var utils=require(_0xec56('0x4'));var logger=require(_0xec56('0x5'))(_0xec56('0x6'));var config=require(_0xec56('0x7'));var jayson=require(_0xec56('0x8'));var client=jayson['client'][_0xec56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebf14,_0x13d3a3,_0x1d5a39){return new BPromise(function(_0x45dc04,_0x3ccf93){return client[_0xec56('0xa')](_0x3ebf14,_0x1d5a39)[_0xec56('0xb')](function(_0x14aabc){logger[_0xec56('0xc')](_0xec56('0xd'),_0x13d3a3,_0xec56('0xe'));logger['debug'](_0xec56('0xf'),_0x13d3a3,_0xec56('0xe'),JSON[_0xec56('0x10')](_0x14aabc));if(_0x14aabc['error']){if(_0x14aabc['error']['code']===0x1f4){logger[_0xec56('0x11')](_0xec56('0xd'),_0x13d3a3,_0x14aabc[_0xec56('0x11')]['message']);return _0x3ccf93(_0x14aabc[_0xec56('0x11')][_0xec56('0x12')]);}logger[_0xec56('0x11')](_0xec56('0xd'),_0x13d3a3,_0x14aabc[_0xec56('0x11')]['message']);return _0x45dc04(_0x14aabc[_0xec56('0x11')][_0xec56('0x12')]);}else{logger['info'](_0xec56('0xd'),_0x13d3a3,_0xec56('0xe'));_0x45dc04(_0x14aabc[_0xec56('0x13')][_0xec56('0x12')]);}})[_0xec56('0x14')](function(_0x269ccd){logger[_0xec56('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x13d3a3,_0x269ccd);_0x3ccf93(_0x269ccd);});});} \ No newline at end of file +var _0x41d0=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x594db0,_0x4b53ee){var _0x9ae1a6=function(_0x4bbc25){while(--_0x4bbc25){_0x594db0['push'](_0x594db0['shift']());}};_0x9ae1a6(++_0x4b53ee);}(_0x41d0,0x1f3));var _0x041d=function(_0x5cb9fb,_0x2d5c2d){_0x5cb9fb=_0x5cb9fb-0x0;var _0x414c1f=_0x41d0[_0x5cb9fb];return _0x414c1f;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var moment=require(_0x041d('0x2'));var BPromise=require(_0x041d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x041d('0x4'));var db=require(_0x041d('0x5'))['db'];var utils=require(_0x041d('0x6'));var logger=require(_0x041d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x041d('0x8'));var client=jayson['client'][_0x041d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a2141,_0x32444f,_0x585952){return new BPromise(function(_0x552076,_0x69f193){return client[_0x041d('0xa')](_0x2a2141,_0x585952)[_0x041d('0xb')](function(_0x16095a){logger['info'](_0x041d('0xc'),_0x32444f,_0x041d('0xd'));logger[_0x041d('0xe')](_0x041d('0xf'),_0x32444f,_0x041d('0xd'),JSON[_0x041d('0x10')](_0x16095a));if(_0x16095a[_0x041d('0x11')]){if(_0x16095a['error'][_0x041d('0x12')]===0x1f4){logger[_0x041d('0x11')](_0x041d('0xc'),_0x32444f,_0x16095a[_0x041d('0x11')][_0x041d('0x13')]);return _0x69f193(_0x16095a[_0x041d('0x11')][_0x041d('0x13')]);}logger[_0x041d('0x11')](_0x041d('0xc'),_0x32444f,_0x16095a[_0x041d('0x11')][_0x041d('0x13')]);return _0x552076(_0x16095a[_0x041d('0x11')][_0x041d('0x13')]);}else{logger['info'](_0x041d('0xc'),_0x32444f,_0x041d('0xd'));_0x552076(_0x16095a['result']['message']);}})[_0x041d('0x14')](function(_0x25fb30){logger[_0x041d('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32444f,_0x25fb30);_0x69f193(_0x25fb30);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 29aa77f..e10e29f 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(_0x309348,_0x137607){var _0x2de8e4=function(_0x494ea7){while(--_0x494ea7){_0x309348['push'](_0x309348['shift']());}};_0x2de8e4(++_0x137607);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x3f3cc8,_0x17e46f){var _0x44b2dd=function(_0x2a6fb2){while(--_0x2a6fb2){_0x3f3cc8['push'](_0x3f3cc8['shift']());}};_0x44b2dd(++_0x17e46f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 8ea9397..9504f20 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 _0xce25=['STRING'];(function(_0x4f750b,_0x4e3e43){var _0x918b39=function(_0x106d8f){while(--_0x106d8f){_0x4f750b['push'](_0x4f750b['shift']());}};_0x918b39(++_0x4e3e43);}(_0xce25,0x196));var _0x5ce2=function(_0x1cdc50,_0x37da93){_0x1cdc50=_0x1cdc50-0x0;var _0x438904=_0xce25[_0x1cdc50];return _0x438904;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5ce2('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x5ce2('0x0')]}}; \ No newline at end of file +var _0x705f=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x705f,0x75));var _0xf705=function(_0xcfe0ed,_0x3feab1){_0xcfe0ed=_0xcfe0ed-0x0;var _0x15bdec=_0x705f[_0xcfe0ed];return _0x15bdec;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf705('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xf705('0x0')]},'metric':{'type':Sequelize[_0xf705('0x1')]},'description':{'type':Sequelize[_0xf705('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index cdc6f91..8a1c5ad 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 _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x460350,_0x3f13bb){var _0x41e612=function(_0x3bef43){while(--_0x3bef43){_0x460350['push'](_0x460350['shift']());}};_0x41e612(++_0x3f13bb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4c7843,_0x279f2d){_0x4c7843=_0x4c7843-0x0;var _0x331c5e=_0x8ef6[_0x4c7843];return _0x331c5e;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file +var _0x7fbe=['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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5b25d8,_0x3cbcd0){var _0x27a4da=function(_0xad312f){while(--_0xad312f){_0x5b25d8['push'](_0x5b25d8['shift']());}};_0x27a4da(++_0x3cbcd0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57ebed,_0xfac0ac){_0x57ebed=_0x57ebed-0x0;var _0x3a0874=_0x7fbe[_0x57ebed];return _0x3a0874;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d933edd..3f090dc 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 _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x885a,0x180));var _0xa885=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x885a[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf69d=['analytics_metrics','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0xf69d,0xd3));var _0xdf69=function(_0x2b634f,_0xa6c86b){_0x2b634f=_0x2b634f-0x0;var _0x48be3c=_0xf69d[_0x2b634f];return _0x48be3c;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var moment=require(_0xdf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf69('0x5'));var fs=require('fs');var path=require(_0xdf69('0x6'));var rimraf=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var attributes=require(_0xdf69('0x9'));module[_0xdf69('0xa')]=function(_0x2d456f,_0x465b1b){return _0x2d456f[_0xdf69('0xb')](_0xdf69('0xc'),attributes,{'tableName':_0xdf69('0xd'),'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 9f2e5cf..5a6794f 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 _0xeb55=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x560e69,_0x3551da){var _0x19a0d5=function(_0x4f0635){while(--_0x4f0635){_0x560e69['push'](_0x560e69['shift']());}};_0x19a0d5(++_0x3551da);}(_0xeb55,0x177));var _0x5eb5=function(_0xdd1d6c,_0x46a472){_0xdd1d6c=_0xdd1d6c-0x0;var _0x26cd1e=_0xeb55[_0xdd1d6c];return _0x26cd1e;};'use strict';var _=require(_0x5eb5('0x0'));var util=require(_0x5eb5('0x1'));var moment=require('moment');var BPromise=require(_0x5eb5('0x2'));var rs=require(_0x5eb5('0x3'));var fs=require('fs');var Redis=require(_0x5eb5('0x4'));var db=require(_0x5eb5('0x5'))['db'];var utils=require(_0x5eb5('0x6'));var logger=require(_0x5eb5('0x7'))(_0x5eb5('0x8'));var config=require('../../config/environment');var jayson=require(_0x5eb5('0x9'));var client=jayson[_0x5eb5('0xa')][_0x5eb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x350d2d,_0x3a6e66,_0x57ab72){return new BPromise(function(_0x3bf146,_0x2df5c5){return client[_0x5eb5('0xc')](_0x350d2d,_0x57ab72)[_0x5eb5('0xd')](function(_0x513712){logger[_0x5eb5('0xe')](_0x5eb5('0xf'),_0x3a6e66,_0x5eb5('0x10'));logger[_0x5eb5('0x11')](_0x5eb5('0x12'),_0x3a6e66,_0x5eb5('0x10'),JSON[_0x5eb5('0x13')](_0x513712));if(_0x513712[_0x5eb5('0x14')]){if(_0x513712[_0x5eb5('0x14')][_0x5eb5('0x15')]===0x1f4){logger[_0x5eb5('0x14')](_0x5eb5('0xf'),_0x3a6e66,_0x513712[_0x5eb5('0x14')][_0x5eb5('0x16')]);return _0x2df5c5(_0x513712[_0x5eb5('0x14')][_0x5eb5('0x16')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3a6e66,_0x513712[_0x5eb5('0x14')]['message']);return _0x3bf146(_0x513712[_0x5eb5('0x14')][_0x5eb5('0x16')]);}else{logger[_0x5eb5('0xe')](_0x5eb5('0xf'),_0x3a6e66,'request\x20sent');_0x3bf146(_0x513712['result']['message']);}})['catch'](function(_0x59178e){logger[_0x5eb5('0x14')](_0x5eb5('0xf'),_0x3a6e66,_0x59178e);_0x2df5c5(_0x59178e);});});} \ No newline at end of file +var _0xa2a7=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','result','catch','util'];(function(_0xe2f7a5,_0x4a83e0){var _0x344b7e=function(_0x1d49a7){while(--_0x1d49a7){_0xe2f7a5['push'](_0xe2f7a5['shift']());}};_0x344b7e(++_0x4a83e0);}(_0xa2a7,0x179));var _0x7a2a=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xa2a7[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require(_0x7a2a('0x0'));var moment=require('moment');var BPromise=require(_0x7a2a('0x1'));var rs=require(_0x7a2a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a2a('0x3'))['db'];var utils=require(_0x7a2a('0x4'));var logger=require(_0x7a2a('0x5'))(_0x7a2a('0x6'));var config=require(_0x7a2a('0x7'));var jayson=require(_0x7a2a('0x8'));var client=jayson[_0x7a2a('0x9')][_0x7a2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dce7c,_0x402ca5,_0x3abe28){return new BPromise(function(_0x4e68f1,_0x208c2d){return client[_0x7a2a('0xb')](_0x3dce7c,_0x3abe28)['then'](function(_0xb35bfa){logger[_0x7a2a('0xc')](_0x7a2a('0xd'),_0x402ca5,_0x7a2a('0xe'));logger[_0x7a2a('0xf')](_0x7a2a('0x10'),_0x402ca5,_0x7a2a('0xe'),JSON['stringify'](_0xb35bfa));if(_0xb35bfa[_0x7a2a('0x11')]){if(_0xb35bfa[_0x7a2a('0x11')]['code']===0x1f4){logger['error'](_0x7a2a('0xd'),_0x402ca5,_0xb35bfa[_0x7a2a('0x11')]['message']);return _0x208c2d(_0xb35bfa[_0x7a2a('0x11')]['message']);}logger[_0x7a2a('0x11')](_0x7a2a('0xd'),_0x402ca5,_0xb35bfa[_0x7a2a('0x11')][_0x7a2a('0x12')]);return _0x4e68f1(_0xb35bfa['error'][_0x7a2a('0x12')]);}else{logger['info'](_0x7a2a('0xd'),_0x402ca5,'request\x20sent');_0x4e68f1(_0xb35bfa[_0x7a2a('0x13')][_0x7a2a('0x12')]);}})[_0x7a2a('0x14')](function(_0x31a66d){logger[_0x7a2a('0x11')](_0x7a2a('0xd'),_0x402ca5,_0x31a66d);_0x208c2d(_0x31a66d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8b96fc8..d4b47c6 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 _0x53ec=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','get','/:id','show','post','create','put'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x53ec,0x192));var _0xc53e=function(_0x5d2637,_0x4de66a){_0x5d2637=_0x5d2637-0x0;var _0x197d8d=_0x53ec[_0x5d2637];return _0x197d8d;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')](_0xc53e('0xb'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4a25=['get','isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller'];(function(_0x5b1202,_0x4b735d){var _0x159df3=function(_0xa8343a){while(--_0xa8343a){_0x5b1202['push'](_0x5b1202['shift']());}};_0x159df3(++_0x4b735d);}(_0x4a25,0x1d4));var _0x54a2=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x4a25[_0x257495];return _0x3849aa;};'use strict';var multer=require(_0x54a2('0x0'));var util=require('util');var path=require(_0x54a2('0x1'));var timeout=require('connect-timeout');var express=require(_0x54a2('0x2'));var router=express[_0x54a2('0x3')]();var fs_extra=require(_0x54a2('0x4'));var auth=require(_0x54a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x54a2('0x6'));var controller=require(_0x54a2('0x7'));router[_0x54a2('0x8')]('/',auth[_0x54a2('0x9')](),controller[_0x54a2('0xa')]);router['get'](_0x54a2('0xb'),auth[_0x54a2('0x9')](),controller[_0x54a2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x54a2('0xd')]);router['put'](_0x54a2('0xb'),auth[_0x54a2('0x9')](),controller['update']);router[_0x54a2('0xe')](_0x54a2('0xb'),auth['isAuthenticated'](),controller[_0x54a2('0xf')]);module[_0x54a2('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 864a41d..a8cf5db 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 _0xba78=['TEXT','sequelize'];(function(_0x262a0b,_0x20d859){var _0x15f521=function(_0x317318){while(--_0x317318){_0x262a0b['push'](_0x262a0b['shift']());}};_0x15f521(++_0x20d859);}(_0xba78,0x159));var _0x8ba7=function(_0x223e94,_0x1b18b9){_0x223e94=_0x223e94-0x0;var _0x5f14fc=_0xba78[_0x223e94];return _0x5f14fc;};'use strict';var Sequelize=require(_0x8ba7('0x0'));module['exports']={'tree':{'type':Sequelize[_0x8ba7('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xca2e=['TEXT','sequelize','exports'];(function(_0xfdc127,_0x7a17f5){var _0x1e5f97=function(_0x26b29d){while(--_0x26b29d){_0xfdc127['push'](_0xfdc127['shift']());}};_0x1e5f97(++_0x7a17f5);}(_0xca2e,0x15d));var _0xeca2=function(_0x5a9d3b,_0x20dcee){_0x5a9d3b=_0x5a9d3b-0x0;var _0x7ee2b2=_0xca2e[_0x5a9d3b];return _0x7ee2b2;};'use strict';var Sequelize=require(_0xeca2('0x0'));module[_0xeca2('0x1')]={'tree':{'type':Sequelize[_0xeca2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index e7f1423..7267d78 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 _0x7ef7=['jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','reject','save','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','length','include','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel'];(function(_0x8374e6,_0x13fd16){var _0x2e2d8f=function(_0x148686){while(--_0x148686){_0x8374e6['push'](_0x8374e6['shift']());}};_0x2e2d8f(++_0x13fd16);}(_0x7ef7,0x84));var _0x77ef=function(_0x20d4ad,_0x16dbf6){_0x20d4ad=_0x20d4ad-0x0;var _0x6bba91=_0x7ef7[_0x20d4ad];return _0x6bba91;};'use strict';var emlformat=require(_0x77ef('0x0'));var rimraf=require(_0x77ef('0x1'));var zipdir=require(_0x77ef('0x2'));var jsonpatch=require(_0x77ef('0x3'));var rp=require(_0x77ef('0x4'));var moment=require(_0x77ef('0x5'));var BPromise=require(_0x77ef('0x6'));var Mustache=require(_0x77ef('0x7'));var util=require('util');var path=require(_0x77ef('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77ef('0x9'));var _=require(_0x77ef('0xa'));var squel=require(_0x77ef('0xb'));var crypto=require('crypto');var jsforce=require(_0x77ef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x77ef('0xd'));var querystring=require(_0x77ef('0xe'));var Papa=require(_0x77ef('0xf'));var Redis=require('ioredis');var authService=require(_0x77ef('0x10'));var qs=require(_0x77ef('0x11'));var as=require(_0x77ef('0x12'));var hardwareService=require(_0x77ef('0x13'));var logger=require(_0x77ef('0x14'))(_0x77ef('0x15'));var utils=require('../../config/utils');var config=require(_0x77ef('0x16'));var licenseUtil=require(_0x77ef('0x17'));var db=require(_0x77ef('0x18'))['db'];function respondWithStatusCode(_0x1dfe25,_0x315894){_0x315894=_0x315894||0xcc;return function(_0x23ac4e){if(_0x23ac4e){return _0x1dfe25[_0x77ef('0x19')](_0x315894);}return _0x1dfe25[_0x77ef('0x1a')](_0x315894)['end']();};}function respondWithResult(_0x15d96b,_0x4ad219){_0x4ad219=_0x4ad219||0xc8;return function(_0x250109){if(_0x250109){return _0x15d96b[_0x77ef('0x1a')](_0x4ad219)[_0x77ef('0x1b')](_0x250109);}};}function respondWithFilteredResult(_0x39fece,_0xe6944){return function(_0x580f8a){if(_0x580f8a){var _0x3c218e=typeof _0xe6944['offset']===_0x77ef('0x1c')&&typeof _0xe6944[_0x77ef('0x1d')]===_0x77ef('0x1c');var _0x3631c4=_0x580f8a[_0x77ef('0x1e')];var _0xf20419=_0x3c218e?0x0:_0xe6944[_0x77ef('0x1f')];var _0x199af1=_0x3c218e?_0x580f8a[_0x77ef('0x1e')]:_0xe6944[_0x77ef('0x1f')]+_0xe6944[_0x77ef('0x1d')];var _0x3f7935;if(_0x199af1>=_0x3631c4){_0x199af1=_0x3631c4;_0x3f7935=0xc8;}else{_0x3f7935=0xce;}_0x39fece[_0x77ef('0x1a')](_0x3f7935);return _0x39fece['set']('Content-Range',_0xf20419+'-'+_0x199af1+'/'+_0x3631c4)['json'](_0x580f8a);}return null;};}function patchUpdates(_0xac2d64){return function(_0x5ea388){try{jsonpatch['apply'](_0x5ea388,_0xac2d64,!![]);}catch(_0x39e48d){return BPromise[_0x77ef('0x20')](_0x39e48d);}return _0x5ea388[_0x77ef('0x21')]();};}function saveUpdates(_0x563611,_0x281f76){return function(_0x47c92c){if(_0x47c92c){return _0x47c92c['update'](_0x563611)[_0x77ef('0x22')](function(_0x495d3f){return _0x495d3f;});}return null;};}function removeEntity(_0x1235a7,_0x25326c){return function(_0x2bc539){if(_0x2bc539){return _0x2bc539[_0x77ef('0x23')]()[_0x77ef('0x22')](function(){_0x1235a7[_0x77ef('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x522d98,_0x854aee){return function(_0x1b7ef7){if(!_0x1b7ef7){_0x522d98[_0x77ef('0x19')](0x194);}return _0x1b7ef7;};}function handleError(_0x5d1123,_0x28f3a8){_0x28f3a8=_0x28f3a8||0x1f4;return function(_0x1c5f66){logger['error'](_0x1c5f66[_0x77ef('0x24')]);if(_0x1c5f66[_0x77ef('0x25')]){delete _0x1c5f66[_0x77ef('0x25')];}_0x5d1123['status'](_0x28f3a8)[_0x77ef('0x26')](_0x1c5f66);};}exports[_0x77ef('0x27')]=function(_0xed6c3e,_0x45ba02){var _0x520c1b={},_0x227242={},_0x116e61={'count':0x0,'rows':[]};var _0x3c59a9=_[_0x77ef('0x28')](db[_0x77ef('0x29')][_0x77ef('0x2a')],function(_0x48e99a){return{'name':_0x48e99a[_0x77ef('0x2b')],'type':_0x48e99a['type'][_0x77ef('0x2c')]};});_0x227242[_0x77ef('0x2d')]=_[_0x77ef('0x28')](_0x3c59a9,'name');_0x227242[_0x77ef('0x2e')]=_['keys'](_0xed6c3e[_0x77ef('0x2e')]);_0x227242[_0x77ef('0x2f')]=_['intersection'](_0x227242[_0x77ef('0x2d')],_0x227242[_0x77ef('0x2e')]);_0x520c1b[_0x77ef('0x30')]=_[_0x77ef('0x31')](_0x227242[_0x77ef('0x2d')],qs['fields'](_0xed6c3e['query'][_0x77ef('0x32')]));_0x520c1b[_0x77ef('0x30')]=_0x520c1b[_0x77ef('0x30')]['length']?_0x520c1b[_0x77ef('0x30')]:_0x227242['model'];if(!_0xed6c3e[_0x77ef('0x2e')][_0x77ef('0x33')](_0x77ef('0x34'))){_0x520c1b['limit']=qs[_0x77ef('0x1d')](_0xed6c3e[_0x77ef('0x2e')][_0x77ef('0x1d')]);_0x520c1b[_0x77ef('0x1f')]=qs['offset'](_0xed6c3e[_0x77ef('0x2e')][_0x77ef('0x1f')]);}_0x520c1b[_0x77ef('0x35')]=qs[_0x77ef('0x36')](_0xed6c3e['query']['sort']);_0x520c1b[_0x77ef('0x37')]=qs[_0x77ef('0x2f')](_['pick'](_0xed6c3e[_0x77ef('0x2e')],_0x227242[_0x77ef('0x2f')]),_0x3c59a9);if(_0xed6c3e[_0x77ef('0x2e')][_0x77ef('0x38')]){_0x520c1b[_0x77ef('0x37')]=_[_0x77ef('0x39')](_0x520c1b[_0x77ef('0x37')],{'$or':_[_0x77ef('0x28')](_0x3c59a9,function(_0x267387){if(_0x267387['type']!==_0x77ef('0x3a')){var _0x13628a={};_0x13628a[_0x267387[_0x77ef('0x25')]]={'$like':'%'+_0xed6c3e[_0x77ef('0x2e')][_0x77ef('0x38')]+'%'};return _0x13628a;}})});}_0x520c1b=_[_0x77ef('0x39')]({},_0x520c1b,_0xed6c3e[_0x77ef('0x3b')]);var _0x137bcd={'where':_0x520c1b[_0x77ef('0x37')]};return db[_0x77ef('0x29')][_0x77ef('0x1e')](_0x137bcd)[_0x77ef('0x22')](function(_0x36571c){_0x116e61['count']=_0x36571c;if(_0xed6c3e['query'][_0x77ef('0x3c')]){_0x520c1b['include']=[{'all':!![]}];}return db[_0x77ef('0x29')][_0x77ef('0x3d')](_0x520c1b);})[_0x77ef('0x22')](function(_0x2b0729){_0x116e61['rows']=_0x2b0729;return _0x116e61;})[_0x77ef('0x22')](respondWithFilteredResult(_0x45ba02,_0x520c1b))[_0x77ef('0x3e')](handleError(_0x45ba02,null));};exports[_0x77ef('0x3f')]=function(_0x357748,_0x53b2a3){var _0x50064a={'raw':!![],'where':{'id':_0x357748[_0x77ef('0x40')]['id']}},_0x35d126={};_0x35d126['model']=_[_0x77ef('0x41')](db[_0x77ef('0x29')][_0x77ef('0x2a')]);_0x35d126[_0x77ef('0x2e')]=_[_0x77ef('0x41')](_0x357748[_0x77ef('0x2e')]);_0x35d126['filters']=_['intersection'](_0x35d126[_0x77ef('0x2d')],_0x35d126[_0x77ef('0x2e')]);_0x50064a[_0x77ef('0x30')]=_[_0x77ef('0x31')](_0x35d126[_0x77ef('0x2d')],qs[_0x77ef('0x32')](_0x357748[_0x77ef('0x2e')][_0x77ef('0x32')]));_0x50064a[_0x77ef('0x30')]=_0x50064a[_0x77ef('0x30')][_0x77ef('0x42')]?_0x50064a[_0x77ef('0x30')]:_0x35d126[_0x77ef('0x2d')];if(_0x357748[_0x77ef('0x2e')][_0x77ef('0x3c')]){_0x50064a[_0x77ef('0x43')]=[{'all':!![]}];}_0x50064a=_[_0x77ef('0x39')]({},_0x50064a,_0x357748['options']);return db[_0x77ef('0x29')]['find'](_0x50064a)[_0x77ef('0x22')](handleEntityNotFound(_0x53b2a3,null))['then'](respondWithResult(_0x53b2a3,null))[_0x77ef('0x3e')](handleError(_0x53b2a3,null));};exports[_0x77ef('0x44')]=function(_0x412815,_0x48dae2){return db[_0x77ef('0x29')][_0x77ef('0x44')](_0x412815[_0x77ef('0x45')],{})['then'](respondWithResult(_0x48dae2,0xc9))[_0x77ef('0x3e')](handleError(_0x48dae2,null));};exports[_0x77ef('0x46')]=function(_0x1c750f,_0x5e95b3){if(_0x1c750f[_0x77ef('0x45')]['id']){delete _0x1c750f[_0x77ef('0x45')]['id'];}return db[_0x77ef('0x29')][_0x77ef('0x47')]({'where':{'id':_0x1c750f[_0x77ef('0x40')]['id']}})[_0x77ef('0x22')](handleEntityNotFound(_0x5e95b3,null))[_0x77ef('0x22')](saveUpdates(_0x1c750f[_0x77ef('0x45')],null))[_0x77ef('0x22')](respondWithResult(_0x5e95b3,null))[_0x77ef('0x3e')](handleError(_0x5e95b3,null));};exports[_0x77ef('0x23')]=function(_0xe13297,_0x1f9213){return db[_0x77ef('0x29')]['find']({'where':{'id':_0xe13297[_0x77ef('0x40')]['id']}})[_0x77ef('0x22')](handleEntityNotFound(_0x1f9213,null))['then'](removeEntity(_0x1f9213,null))[_0x77ef('0x3e')](handleError(_0x1f9213,null));}; \ No newline at end of file +var _0x58e5=['limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x989152,_0x8f136a){var _0x5f4744=function(_0x38af46){while(--_0x38af46){_0x989152['push'](_0x989152['shift']());}};_0x5f4744(++_0x8f136a);}(_0x58e5,0x70));var _0x558e=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x58e5[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0x558e('0x0'));var rimraf=require(_0x558e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x558e('0x2'));var rp=require('request-promise');var moment=require(_0x558e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x558e('0x4'));var util=require('util');var path=require(_0x558e('0x5'));var sox=require(_0x558e('0x6'));var csv=require(_0x558e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x558e('0x8'));var squel=require(_0x558e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x558e('0x7'));var querystring=require(_0x558e('0xa'));var Papa=require('papaparse');var Redis=require(_0x558e('0xb'));var authService=require(_0x558e('0xc'));var qs=require(_0x558e('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x558e('0xe'));var logger=require(_0x558e('0xf'))(_0x558e('0x10'));var utils=require(_0x558e('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x558e('0x12'));var db=require(_0x558e('0x13'))['db'];function respondWithStatusCode(_0x178f53,_0x2fc95f){_0x2fc95f=_0x2fc95f||0xcc;return function(_0x3d841e){if(_0x3d841e){return _0x178f53[_0x558e('0x14')](_0x2fc95f);}return _0x178f53[_0x558e('0x15')](_0x2fc95f)[_0x558e('0x16')]();};}function respondWithResult(_0x39c819,_0x397cc5){_0x397cc5=_0x397cc5||0xc8;return function(_0x2a846f){if(_0x2a846f){return _0x39c819[_0x558e('0x15')](_0x397cc5)[_0x558e('0x17')](_0x2a846f);}};}function respondWithFilteredResult(_0x2039b5,_0x242340){return function(_0x4aa591){if(_0x4aa591){var _0x88bd05=typeof _0x242340[_0x558e('0x18')]===_0x558e('0x19')&&typeof _0x242340[_0x558e('0x1a')]===_0x558e('0x19');var _0x252c32=_0x4aa591[_0x558e('0x1b')];var _0x2c0714=_0x88bd05?0x0:_0x242340[_0x558e('0x18')];var _0x5062ad=_0x88bd05?_0x4aa591[_0x558e('0x1b')]:_0x242340[_0x558e('0x18')]+_0x242340[_0x558e('0x1a')];var _0x47f475;if(_0x5062ad>=_0x252c32){_0x5062ad=_0x252c32;_0x47f475=0xc8;}else{_0x47f475=0xce;}_0x2039b5[_0x558e('0x15')](_0x47f475);return _0x2039b5[_0x558e('0x1c')](_0x558e('0x1d'),_0x2c0714+'-'+_0x5062ad+'/'+_0x252c32)[_0x558e('0x17')](_0x4aa591);}return null;};}function patchUpdates(_0x29858c){return function(_0x2e7a2a){try{jsonpatch[_0x558e('0x1e')](_0x2e7a2a,_0x29858c,!![]);}catch(_0x3494a2){return BPromise[_0x558e('0x1f')](_0x3494a2);}return _0x2e7a2a['save']();};}function saveUpdates(_0x54e4d1,_0x11bcae){return function(_0x4ca54a){if(_0x4ca54a){return _0x4ca54a[_0x558e('0x20')](_0x54e4d1)[_0x558e('0x21')](function(_0x2dcb44){return _0x2dcb44;});}return null;};}function removeEntity(_0x44f257,_0x2abae8){return function(_0xdd8ba){if(_0xdd8ba){return _0xdd8ba[_0x558e('0x22')]()[_0x558e('0x21')](function(){_0x44f257['status'](0xcc)[_0x558e('0x16')]();});}};}function handleEntityNotFound(_0x3e7add,_0x4b614c){return function(_0x198b55){if(!_0x198b55){_0x3e7add[_0x558e('0x14')](0x194);}return _0x198b55;};}function handleError(_0x4c763a,_0x3a1550){_0x3a1550=_0x3a1550||0x1f4;return function(_0x5cad93){logger[_0x558e('0x23')](_0x5cad93['stack']);if(_0x5cad93[_0x558e('0x24')]){delete _0x5cad93[_0x558e('0x24')];}_0x4c763a[_0x558e('0x15')](_0x3a1550)[_0x558e('0x25')](_0x5cad93);};}exports[_0x558e('0x26')]=function(_0x2ce1e5,_0x2fb9d6){var _0x83fcd={},_0x2feac9={},_0xd4cc41={'count':0x0,'rows':[]};var _0x332c1=_[_0x558e('0x27')](db[_0x558e('0x28')][_0x558e('0x29')],function(_0x3b5a36){return{'name':_0x3b5a36[_0x558e('0x2a')],'type':_0x3b5a36[_0x558e('0x2b')][_0x558e('0x2c')]};});_0x2feac9['model']=_[_0x558e('0x27')](_0x332c1,_0x558e('0x24'));_0x2feac9[_0x558e('0x2d')]=_[_0x558e('0x2e')](_0x2ce1e5[_0x558e('0x2d')]);_0x2feac9[_0x558e('0x2f')]=_['intersection'](_0x2feac9[_0x558e('0x30')],_0x2feac9['query']);_0x83fcd[_0x558e('0x31')]=_[_0x558e('0x32')](_0x2feac9[_0x558e('0x30')],qs[_0x558e('0x33')](_0x2ce1e5[_0x558e('0x2d')]['fields']));_0x83fcd[_0x558e('0x31')]=_0x83fcd['attributes'][_0x558e('0x34')]?_0x83fcd[_0x558e('0x31')]:_0x2feac9[_0x558e('0x30')];if(!_0x2ce1e5['query'][_0x558e('0x35')](_0x558e('0x36'))){_0x83fcd[_0x558e('0x1a')]=qs[_0x558e('0x1a')](_0x2ce1e5['query'][_0x558e('0x1a')]);_0x83fcd[_0x558e('0x18')]=qs[_0x558e('0x18')](_0x2ce1e5[_0x558e('0x2d')][_0x558e('0x18')]);}_0x83fcd['order']=qs[_0x558e('0x37')](_0x2ce1e5['query'][_0x558e('0x37')]);_0x83fcd[_0x558e('0x38')]=qs['filters'](_[_0x558e('0x39')](_0x2ce1e5['query'],_0x2feac9[_0x558e('0x2f')]),_0x332c1);if(_0x2ce1e5['query'][_0x558e('0x3a')]){_0x83fcd['where']=_[_0x558e('0x3b')](_0x83fcd[_0x558e('0x38')],{'$or':_['map'](_0x332c1,function(_0x183e76){if(_0x183e76[_0x558e('0x2b')]!=='VIRTUAL'){var _0x3ea585={};_0x3ea585[_0x183e76[_0x558e('0x24')]]={'$like':'%'+_0x2ce1e5[_0x558e('0x2d')][_0x558e('0x3a')]+'%'};return _0x3ea585;}})});}_0x83fcd=_['merge']({},_0x83fcd,_0x2ce1e5[_0x558e('0x3c')]);var _0x173a0b={'where':_0x83fcd[_0x558e('0x38')]};return db[_0x558e('0x28')][_0x558e('0x1b')](_0x173a0b)[_0x558e('0x21')](function(_0x18810a){_0xd4cc41[_0x558e('0x1b')]=_0x18810a;if(_0x2ce1e5[_0x558e('0x2d')][_0x558e('0x3d')]){_0x83fcd['include']=[{'all':!![]}];}return db[_0x558e('0x28')]['findAll'](_0x83fcd);})[_0x558e('0x21')](function(_0x51d806){_0xd4cc41['rows']=_0x51d806;return _0xd4cc41;})[_0x558e('0x21')](respondWithFilteredResult(_0x2fb9d6,_0x83fcd))[_0x558e('0x3e')](handleError(_0x2fb9d6,null));};exports[_0x558e('0x3f')]=function(_0x5e757c,_0x563011){var _0x2687ea={'raw':!![],'where':{'id':_0x5e757c[_0x558e('0x40')]['id']}},_0x333e08={};_0x333e08[_0x558e('0x30')]=_[_0x558e('0x2e')](db[_0x558e('0x28')][_0x558e('0x29')]);_0x333e08['query']=_['keys'](_0x5e757c['query']);_0x333e08[_0x558e('0x2f')]=_[_0x558e('0x32')](_0x333e08['model'],_0x333e08[_0x558e('0x2d')]);_0x2687ea[_0x558e('0x31')]=_[_0x558e('0x32')](_0x333e08['model'],qs[_0x558e('0x33')](_0x5e757c['query'][_0x558e('0x33')]));_0x2687ea[_0x558e('0x31')]=_0x2687ea['attributes'][_0x558e('0x34')]?_0x2687ea[_0x558e('0x31')]:_0x333e08[_0x558e('0x30')];if(_0x5e757c[_0x558e('0x2d')]['includeAll']){_0x2687ea[_0x558e('0x41')]=[{'all':!![]}];}_0x2687ea=_[_0x558e('0x3b')]({},_0x2687ea,_0x5e757c[_0x558e('0x3c')]);return db[_0x558e('0x28')][_0x558e('0x42')](_0x2687ea)[_0x558e('0x21')](handleEntityNotFound(_0x563011,null))[_0x558e('0x21')](respondWithResult(_0x563011,null))[_0x558e('0x3e')](handleError(_0x563011,null));};exports[_0x558e('0x43')]=function(_0x478632,_0x47d3fa){return db[_0x558e('0x28')]['create'](_0x478632[_0x558e('0x44')],{})[_0x558e('0x21')](respondWithResult(_0x47d3fa,0xc9))[_0x558e('0x3e')](handleError(_0x47d3fa,null));};exports[_0x558e('0x20')]=function(_0x99865f,_0x3aba1d){if(_0x99865f[_0x558e('0x44')]['id']){delete _0x99865f['body']['id'];}return db[_0x558e('0x28')][_0x558e('0x42')]({'where':{'id':_0x99865f[_0x558e('0x40')]['id']}})[_0x558e('0x21')](handleEntityNotFound(_0x3aba1d,null))[_0x558e('0x21')](saveUpdates(_0x99865f[_0x558e('0x44')],null))['then'](respondWithResult(_0x3aba1d,null))[_0x558e('0x3e')](handleError(_0x3aba1d,null));};exports[_0x558e('0x22')]=function(_0x40d09f,_0x16122c){return db['AnalyticTreeReport']['find']({'where':{'id':_0x40d09f[_0x558e('0x40')]['id']}})['then'](handleEntityNotFound(_0x16122c,null))[_0x558e('0x21')](removeEntity(_0x16122c,null))[_0x558e('0x3e')](handleError(_0x16122c,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 81643d4..fcd0a87 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 _0xe79d=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees'];(function(_0x2a2ba6,_0x333e8f){var _0xe91ffb=function(_0x512466){while(--_0x512466){_0x2a2ba6['push'](_0x2a2ba6['shift']());}};_0xe91ffb(++_0x333e8f);}(_0xe79d,0x8f));var _0xde79=function(_0x3d9c93,_0x5e9c47){_0x3d9c93=_0x3d9c93-0x0;var _0x1d7bd8=_0xe79d[_0x3d9c93];return _0x1d7bd8;};'use strict';var _=require(_0xde79('0x0'));var util=require(_0xde79('0x1'));var logger=require(_0xde79('0x2'))(_0xde79('0x3'));var moment=require(_0xde79('0x4'));var BPromise=require('bluebird');var rp=require(_0xde79('0x5'));var fs=require('fs');var path=require(_0xde79('0x6'));var rimraf=require(_0xde79('0x7'));var config=require(_0xde79('0x8'));var attributes=require(_0xde79('0x9'));module[_0xde79('0xa')]=function(_0x10b80e,_0x34ac63){return _0x10b80e['define'](_0xde79('0xb'),attributes,{'tableName':_0xde79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bde=['define','analytics_report_trees','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes','exports'];(function(_0x4fd187,_0x363783){var _0xee32b6=function(_0x365cd3){while(--_0x365cd3){_0x4fd187['push'](_0x4fd187['shift']());}};_0xee32b6(++_0x363783);}(_0x6bde,0x1c4));var _0xe6bd=function(_0x433241,_0x299e79){_0x433241=_0x433241-0x0;var _0x16cfb2=_0x6bde[_0x433241];return _0x16cfb2;};'use strict';var _=require(_0xe6bd('0x0'));var util=require('util');var logger=require(_0xe6bd('0x1'))('api');var moment=require(_0xe6bd('0x2'));var BPromise=require(_0xe6bd('0x3'));var rp=require(_0xe6bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6bd('0x5'));var config=require('../../config/environment');var attributes=require(_0xe6bd('0x6'));module[_0xe6bd('0x7')]=function(_0xfaed61,_0x32ad09){return _0xfaed61[_0xe6bd('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0xe6bd('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 16064fc..f18199c 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x39bf1,_0x2e4694){var _0x1b2876=function(_0x2920f1){while(--_0x2920f1){_0x39bf1['push'](_0x39bf1['shift']());}};_0x1b2876(++_0x2e4694);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5390a3,_0x4d60f7){_0x5390a3=_0x5390a3-0x0;var _0x45d220=_0x5f2f[_0x5390a3];return _0x45d220;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x423858,_0xfb3779){var _0x1b89b6=function(_0x3bba9b){while(--_0x3bba9b){_0x423858['push'](_0x423858['shift']());}};_0x1b89b6(++_0xfb3779);}(_0x1261,0x144));var _0x1126=function(_0x34357e,_0x5af72a){_0x34357e=_0x34357e-0x0;var _0x488189=_0x1261[_0x34357e];return _0x488189;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1be34c2..0b0c465 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 _0xc49b=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xc49b,0x1b7));var _0xbc49=function(_0x49a70a,_0xee3a2d){_0x49a70a=_0x49a70a-0x0;var _0x41d02d=_0xc49b[_0x49a70a];return _0x41d02d;};'use strict';var multer=require('multer');var util=require(_0xbc49('0x0'));var path=require(_0xbc49('0x1'));var timeout=require(_0xbc49('0x2'));var express=require('express');var router=express[_0xbc49('0x3')]();var fs_extra=require(_0xbc49('0x4'));var auth=require(_0xbc49('0x5'));var interaction=require(_0xbc49('0x6'));var config=require(_0xbc49('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xbc49('0x8')]('/',auth[_0xbc49('0x9')](),controller[_0xbc49('0xa')]);router[_0xbc49('0x8')](_0xbc49('0xb'),auth[_0xbc49('0x9')](),controller[_0xbc49('0xc')]);router[_0xbc49('0xd')]('/',auth[_0xbc49('0x9')](),controller[_0xbc49('0xe')]);router[_0xbc49('0xf')](_0xbc49('0xb'),auth[_0xbc49('0x9')](),controller['update']);router[_0xbc49('0x10')]('/:id',auth[_0xbc49('0x9')](),controller[_0xbc49('0x11')]);module[_0xbc49('0x12')]=router; \ No newline at end of file +var _0x0d56=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3a4691,_0x275798){var _0xc93bb3=function(_0x28f7ce){while(--_0x28f7ce){_0x3a4691['push'](_0x3a4691['shift']());}};_0xc93bb3(++_0x275798);}(_0x0d56,0xad));var _0x60d5=function(_0x4b6497,_0x322554){_0x4b6497=_0x4b6497-0x0;var _0x24f604=_0x0d56[_0x4b6497];return _0x24f604;};'use strict';var multer=require(_0x60d5('0x0'));var util=require(_0x60d5('0x1'));var path=require(_0x60d5('0x2'));var timeout=require(_0x60d5('0x3'));var express=require(_0x60d5('0x4'));var router=express[_0x60d5('0x5')]();var fs_extra=require(_0x60d5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x60d5('0x7'));var config=require(_0x60d5('0x8'));var controller=require(_0x60d5('0x9'));router['get']('/',auth[_0x60d5('0xa')](),controller['index']);router[_0x60d5('0xb')]('/:id',auth[_0x60d5('0xa')](),controller[_0x60d5('0xc')]);router[_0x60d5('0xd')]('/',auth[_0x60d5('0xa')](),controller[_0x60d5('0xe')]);router[_0x60d5('0xf')](_0x60d5('0x10'),auth[_0x60d5('0xa')](),controller[_0x60d5('0x11')]);router['delete'](_0x60d5('0x10'),auth[_0x60d5('0xa')](),controller[_0x60d5('0x12')]);module[_0x60d5('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ec1608f..852d7e3 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 _0x394e=['STRING','sequelize','exports'];(function(_0x25c398,_0x13284b){var _0x3311bc=function(_0x383d58){while(--_0x383d58){_0x25c398['push'](_0x25c398['shift']());}};_0x3311bc(++_0x13284b);}(_0x394e,0x88));var _0xe394=function(_0x25949d,_0x49889d){_0x25949d=_0x25949d-0x0;var _0x321fac=_0x394e[_0x25949d];return _0x321fac;};'use strict';var Sequelize=require(_0xe394('0x0'));module[_0xe394('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xe394('0x2')]},'type':{'type':Sequelize[_0xe394('0x2')]}}; \ No newline at end of file +var _0xb0b9=['STRING','sequelize'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0xa301c1,_0x39fa21){_0xa301c1=_0xa301c1-0x0;var _0x16e2fb=_0xb0b9[_0xa301c1];return _0x16e2fb;};'use strict';var Sequelize=require(_0x9b0b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9b0b('0x1')]},'type':{'type':Sequelize[_0x9b0b('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 65189f7..2c59a52 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 _0xe7ee=['status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','Attachment','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','keys','include','find','clone','rawAttributes','get','omit','createdAt','updatedAt','create','body','params','file','basename','filename','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xe7ee,0x91));var _0xee7e=function(_0x351d21,_0x34f81b){_0x351d21=_0x351d21-0x0;var _0x5f479a=_0xe7ee[_0x351d21];return _0x5f479a;};'use strict';var emlformat=require(_0xee7e('0x0'));var rimraf=require(_0xee7e('0x1'));var zipdir=require(_0xee7e('0x2'));var jsonpatch=require(_0xee7e('0x3'));var rp=require('request-promise');var moment=require(_0xee7e('0x4'));var BPromise=require(_0xee7e('0x5'));var Mustache=require(_0xee7e('0x6'));var util=require('util');var path=require(_0xee7e('0x7'));var sox=require('sox');var csv=require(_0xee7e('0x8'));var ejs=require(_0xee7e('0x9'));var fs=require('fs');var fs_extra=require(_0xee7e('0xa'));var _=require(_0xee7e('0xb'));var squel=require(_0xee7e('0xc'));var crypto=require(_0xee7e('0xd'));var jsforce=require(_0xee7e('0xe'));var deskjs=require(_0xee7e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xee7e('0x10'));var authService=require(_0xee7e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee7e('0x12'));var logger=require(_0xee7e('0x13'))('api');var utils=require(_0xee7e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee7e('0x15'));var db=require(_0xee7e('0x16'))['db'];function respondWithStatusCode(_0x2e69be,_0x2ea294){_0x2ea294=_0x2ea294||0xcc;return function(_0x957bed){if(_0x957bed){return _0x2e69be[_0xee7e('0x17')](_0x2ea294);}return _0x2e69be['status'](_0x2ea294)['end']();};}function respondWithResult(_0x23495d,_0x3badb4){_0x3badb4=_0x3badb4||0xc8;return function(_0x262c62){if(_0x262c62){return _0x23495d['status'](_0x3badb4)[_0xee7e('0x18')](_0x262c62);}};}function respondWithFilteredResult(_0x4b7d8e,_0x5331c2){return function(_0x5e086c){if(_0x5e086c){var _0x269a97=typeof _0x5331c2[_0xee7e('0x19')]===_0xee7e('0x1a')&&typeof _0x5331c2[_0xee7e('0x1b')]===_0xee7e('0x1a');var _0x435f8f=_0x5e086c[_0xee7e('0x1c')];var _0x2f6c89=_0x269a97?0x0:_0x5331c2[_0xee7e('0x19')];var _0x1d9c41=_0x269a97?_0x5e086c[_0xee7e('0x1c')]:_0x5331c2[_0xee7e('0x19')]+_0x5331c2[_0xee7e('0x1b')];var _0x2dab3d;if(_0x1d9c41>=_0x435f8f){_0x1d9c41=_0x435f8f;_0x2dab3d=0xc8;}else{_0x2dab3d=0xce;}_0x4b7d8e[_0xee7e('0x1d')](_0x2dab3d);return _0x4b7d8e[_0xee7e('0x1e')](_0xee7e('0x1f'),_0x2f6c89+'-'+_0x1d9c41+'/'+_0x435f8f)[_0xee7e('0x18')](_0x5e086c);}return null;};}function patchUpdates(_0x2890bb){return function(_0x43473b){try{jsonpatch[_0xee7e('0x20')](_0x43473b,_0x2890bb,!![]);}catch(_0x301ece){return BPromise[_0xee7e('0x21')](_0x301ece);}return _0x43473b[_0xee7e('0x22')]();};}function saveUpdates(_0x40b270,_0x526222){return function(_0x19eba7){if(_0x19eba7){return _0x19eba7[_0xee7e('0x23')](_0x40b270)[_0xee7e('0x24')](function(_0x31e84e){return _0x31e84e;});}return null;};}function removeEntity(_0x4d283c,_0xce73bb){return function(_0x37e2f9){if(_0x37e2f9){return _0x37e2f9[_0xee7e('0x25')]()[_0xee7e('0x24')](function(){_0x4d283c[_0xee7e('0x1d')](0xcc)[_0xee7e('0x26')]();});}};}function handleEntityNotFound(_0x14458f,_0x4f905c){return function(_0x4e5ce7){if(!_0x4e5ce7){_0x14458f[_0xee7e('0x17')](0x194);}return _0x4e5ce7;};}function handleError(_0x1da04a,_0x128d3a){_0x128d3a=_0x128d3a||0x1f4;return function(_0x558df0){logger[_0xee7e('0x27')](_0x558df0['stack']);if(_0x558df0['name']){delete _0x558df0[_0xee7e('0x28')];}_0x1da04a['status'](_0x128d3a)[_0xee7e('0x29')](_0x558df0);};}exports['index']=function(_0x5e9288,_0x59be40){var _0x50c77c={},_0x3aadc1={},_0x454c2e={'count':0x0,'rows':[]};var _0x4fe3e3=_[_0xee7e('0x2a')](db[_0xee7e('0x2b')]['rawAttributes'],function(_0xec70b6){return{'name':_0xec70b6['fieldName'],'type':_0xec70b6[_0xee7e('0x2c')][_0xee7e('0x2d')]};});_0x3aadc1['model']=_[_0xee7e('0x2a')](_0x4fe3e3,_0xee7e('0x28'));_0x3aadc1[_0xee7e('0x2e')]=_['keys'](_0x5e9288[_0xee7e('0x2e')]);_0x3aadc1[_0xee7e('0x2f')]=_[_0xee7e('0x30')](_0x3aadc1[_0xee7e('0x31')],_0x3aadc1['query']);_0x50c77c[_0xee7e('0x32')]=_[_0xee7e('0x30')](_0x3aadc1[_0xee7e('0x31')],qs[_0xee7e('0x33')](_0x5e9288[_0xee7e('0x2e')]['fields']));_0x50c77c[_0xee7e('0x32')]=_0x50c77c[_0xee7e('0x32')][_0xee7e('0x34')]?_0x50c77c['attributes']:_0x3aadc1[_0xee7e('0x31')];if(!_0x5e9288['query'][_0xee7e('0x35')](_0xee7e('0x36'))){_0x50c77c['limit']=qs[_0xee7e('0x1b')](_0x5e9288['query'][_0xee7e('0x1b')]);_0x50c77c[_0xee7e('0x19')]=qs[_0xee7e('0x19')](_0x5e9288['query'][_0xee7e('0x19')]);}_0x50c77c['order']=qs[_0xee7e('0x37')](_0x5e9288[_0xee7e('0x2e')]['sort']);_0x50c77c[_0xee7e('0x38')]=qs[_0xee7e('0x2f')](_[_0xee7e('0x39')](_0x5e9288[_0xee7e('0x2e')],_0x3aadc1[_0xee7e('0x2f')]),_0x4fe3e3);if(_0x5e9288[_0xee7e('0x2e')][_0xee7e('0x3a')]){_0x50c77c[_0xee7e('0x38')]=_[_0xee7e('0x3b')](_0x50c77c[_0xee7e('0x38')],{'$or':_['map'](_0x4fe3e3,function(_0x356d36){if(_0x356d36[_0xee7e('0x2c')]!==_0xee7e('0x3c')){var _0x45ea03={};_0x45ea03[_0x356d36[_0xee7e('0x28')]]={'$like':'%'+_0x5e9288[_0xee7e('0x2e')][_0xee7e('0x3a')]+'%'};return _0x45ea03;}})});}_0x50c77c=_['merge']({},_0x50c77c,_0x5e9288[_0xee7e('0x3d')]);var _0x30f305={'where':_0x50c77c['where']};return db[_0xee7e('0x2b')][_0xee7e('0x1c')](_0x30f305)['then'](function(_0x3a3fc3){_0x454c2e[_0xee7e('0x1c')]=_0x3a3fc3;if(_0x5e9288[_0xee7e('0x2e')][_0xee7e('0x3e')]){_0x50c77c['include']=[{'all':!![]}];}return db['Attachment']['findAll'](_0x50c77c);})[_0xee7e('0x24')](function(_0x1ec363){_0x454c2e['rows']=_0x1ec363;return _0x454c2e;})[_0xee7e('0x24')](respondWithFilteredResult(_0x59be40,_0x50c77c))[_0xee7e('0x3f')](handleError(_0x59be40,null));};exports[_0xee7e('0x40')]=function(_0x47d049,_0x4c2faa){var _0x4c1f60={'raw':!![],'where':{'id':_0x47d049['params']['id']}},_0x2a63a5={};_0x2a63a5[_0xee7e('0x31')]=_['keys'](db['Attachment']['rawAttributes']);_0x2a63a5[_0xee7e('0x2e')]=_[_0xee7e('0x41')](_0x47d049[_0xee7e('0x2e')]);_0x2a63a5['filters']=_[_0xee7e('0x30')](_0x2a63a5['model'],_0x2a63a5[_0xee7e('0x2e')]);_0x4c1f60[_0xee7e('0x32')]=_[_0xee7e('0x30')](_0x2a63a5[_0xee7e('0x31')],qs[_0xee7e('0x33')](_0x47d049['query'][_0xee7e('0x33')]));_0x4c1f60[_0xee7e('0x32')]=_0x4c1f60[_0xee7e('0x32')]['length']?_0x4c1f60[_0xee7e('0x32')]:_0x2a63a5[_0xee7e('0x31')];if(_0x47d049['query'][_0xee7e('0x3e')]){_0x4c1f60[_0xee7e('0x42')]=[{'all':!![]}];}_0x4c1f60=_[_0xee7e('0x3b')]({},_0x4c1f60,_0x47d049[_0xee7e('0x3d')]);return db[_0xee7e('0x2b')][_0xee7e('0x43')](_0x4c1f60)['then'](handleEntityNotFound(_0x4c2faa,null))['then'](respondWithResult(_0x4c2faa,null))[_0xee7e('0x3f')](handleError(_0x4c2faa,null));};exports[_0xee7e('0x44')]=function(_0x28e09e,_0x1868df){var _0x51275c={'where':{'id':_0x28e09e['params']['id']}},_0x2ff136={};_0x2ff136['model']=_[_0xee7e('0x41')](db[_0xee7e('0x2b')][_0xee7e('0x45')]);_0x51275c[_0xee7e('0x32')]=_['intersection'](_0x2ff136[_0xee7e('0x31')],qs[_0xee7e('0x33')](_0x28e09e[_0xee7e('0x2e')][_0xee7e('0x33')]));_0x51275c[_0xee7e('0x32')]=_0x51275c[_0xee7e('0x32')]['length']?_0x51275c[_0xee7e('0x32')]:_0x2ff136[_0xee7e('0x31')];if(_0x28e09e['query'][_0xee7e('0x3e')]){_0x51275c[_0xee7e('0x42')]=[{'all':!![]}];}_0x51275c=_['merge']({},_0x51275c,_0x28e09e[_0xee7e('0x3d')]);return db[_0xee7e('0x2b')][_0xee7e('0x43')](_0x51275c)[_0xee7e('0x24')](handleEntityNotFound(_0x1868df,null))['then'](function(_0x5822ad){if(_0x5822ad){var _0x103d14=_0x5822ad[_0xee7e('0x46')]({'plain':!![]});_0x103d14=qs[_0xee7e('0x47')](_0x103d14,['id',_0xee7e('0x48'),_0xee7e('0x49')]);_0x28e09e['body']=_[_0xee7e('0x47')](_0x28e09e['body'],['id',_0xee7e('0x48'),'updatedAt']);return db[_0xee7e('0x2b')][_0xee7e('0x4a')](_[_0xee7e('0x3b')](_0x103d14,_0x28e09e['body']),{'include':_0x28e09e[_0xee7e('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xee7e('0x24')](respondWithResult(_0x1868df,0xc9))[_0xee7e('0x3f')](handleError(_0x1868df,null));};exports['update']=function(_0x9cc743,_0x2453ac){if(_0x9cc743[_0xee7e('0x4b')]['id']){delete _0x9cc743['body']['id'];}return db[_0xee7e('0x2b')][_0xee7e('0x43')]({'where':{'id':_0x9cc743[_0xee7e('0x4c')]['id']}})[_0xee7e('0x24')](handleEntityNotFound(_0x2453ac,null))[_0xee7e('0x24')](saveUpdates(_0x9cc743[_0xee7e('0x4b')],null))['then'](respondWithResult(_0x2453ac,null))['catch'](handleError(_0x2453ac,null));};exports[_0xee7e('0x25')]=function(_0x1526da,_0x1f0f1c){return db[_0xee7e('0x2b')]['find']({'where':{'id':_0x1526da[_0xee7e('0x4c')]['id']}})[_0xee7e('0x24')](handleEntityNotFound(_0x1f0f1c,null))[_0xee7e('0x24')](removeEntity(_0x1f0f1c,null))['catch'](handleError(_0x1f0f1c,null));};exports[_0xee7e('0x4a')]=function(_0x4a4072,_0x53de92,_0x2b3ef5){_0x4a4072[_0xee7e('0x4b')][_0xee7e('0x28')]=_0x4a4072[_0xee7e('0x4d')]['originalname'];_0x4a4072[_0xee7e('0x4b')][_0xee7e('0x4e')]=_0x4a4072[_0xee7e('0x4d')][_0xee7e('0x4f')];_0x4a4072['body'][_0xee7e('0x2c')]=_0x4a4072['file']['mimetype'];return db[_0xee7e('0x2b')][_0xee7e('0x4a')](_0x4a4072[_0xee7e('0x4b')])[_0xee7e('0x24')](respondWithResult(_0x53de92,0xc9))['catch'](handleError(_0x53de92,null));};exports[_0xee7e('0x50')]=function(_0xa0a1d3,_0xe01e63,_0x3d14b0){return db['Attachment'][_0xee7e('0x51')]({'where':{'id':_0xa0a1d3['params']['id']},'raw':!![]})[_0xee7e('0x24')](handleEntityNotFound(_0xe01e63,null))[_0xee7e('0x24')](function(_0x471ee7){if(_0x471ee7){var _0x1beb46=_0x471ee7[_0xee7e('0x52')]!==null;var _0x46a96b=path['join'](config[_0xee7e('0x53')],_0xee7e('0x54'));if(_0x1beb46){_0x46a96b=path[_0xee7e('0x55')](_0x46a96b,_0xee7e('0x56'));}var _0x50b174=path['join'](_0x46a96b,_0x471ee7[_0xee7e('0x4e')]);return _0xe01e63[_0xee7e('0x50')](_0x50b174);}})[_0xee7e('0x3f')](handleError(_0xe01e63,null));}; \ No newline at end of file +var _0x411b=['save','update','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','then','include','findAll','rows','catch','show','keys','fields','find','clone','params','includeAll','updatedAt','body','createdAt','create','file','basename','mimetype','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x411b,0xe5));var _0xb411=function(_0x3ff315,_0x549060){_0x3ff315=_0x3ff315-0x0;var _0x56ad63=_0x411b[_0x3ff315];return _0x56ad63;};'use strict';var emlformat=require(_0xb411('0x0'));var rimraf=require(_0xb411('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb411('0x2'));var moment=require(_0xb411('0x3'));var BPromise=require(_0xb411('0x4'));var Mustache=require(_0xb411('0x5'));var util=require('util');var path=require(_0xb411('0x6'));var sox=require(_0xb411('0x7'));var csv=require('to-csv');var ejs=require(_0xb411('0x8'));var fs=require('fs');var fs_extra=require(_0xb411('0x9'));var _=require(_0xb411('0xa'));var squel=require(_0xb411('0xb'));var crypto=require(_0xb411('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb411('0xd'));var toCsv=require(_0xb411('0xe'));var querystring=require(_0xb411('0xf'));var Papa=require(_0xb411('0x10'));var Redis=require(_0xb411('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb411('0x12'));var as=require(_0xb411('0x13'));var hardwareService=require(_0xb411('0x14'));var logger=require('../../config/logger')(_0xb411('0x15'));var utils=require(_0xb411('0x16'));var config=require(_0xb411('0x17'));var licenseUtil=require(_0xb411('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ad452,_0x1f161e){_0x1f161e=_0x1f161e||0xcc;return function(_0x505551){if(_0x505551){return _0x2ad452[_0xb411('0x19')](_0x1f161e);}return _0x2ad452[_0xb411('0x1a')](_0x1f161e)['end']();};}function respondWithResult(_0x20d6db,_0x2f475a){_0x2f475a=_0x2f475a||0xc8;return function(_0x53ebb6){if(_0x53ebb6){return _0x20d6db[_0xb411('0x1a')](_0x2f475a)[_0xb411('0x1b')](_0x53ebb6);}};}function respondWithFilteredResult(_0x5b8c61,_0x66e96e){return function(_0x5769f9){if(_0x5769f9){var _0x432d29=typeof _0x66e96e['offset']===_0xb411('0x1c')&&typeof _0x66e96e[_0xb411('0x1d')]===_0xb411('0x1c');var _0x2aa6b5=_0x5769f9[_0xb411('0x1e')];var _0x497fbb=_0x432d29?0x0:_0x66e96e[_0xb411('0x1f')];var _0x2d7881=_0x432d29?_0x5769f9['count']:_0x66e96e[_0xb411('0x1f')]+_0x66e96e[_0xb411('0x1d')];var _0x1ed263;if(_0x2d7881>=_0x2aa6b5){_0x2d7881=_0x2aa6b5;_0x1ed263=0xc8;}else{_0x1ed263=0xce;}_0x5b8c61[_0xb411('0x1a')](_0x1ed263);return _0x5b8c61[_0xb411('0x20')]('Content-Range',_0x497fbb+'-'+_0x2d7881+'/'+_0x2aa6b5)[_0xb411('0x1b')](_0x5769f9);}return null;};}function patchUpdates(_0x1968c4){return function(_0x345c52){try{jsonpatch[_0xb411('0x21')](_0x345c52,_0x1968c4,!![]);}catch(_0x2bd214){return BPromise[_0xb411('0x22')](_0x2bd214);}return _0x345c52[_0xb411('0x23')]();};}function saveUpdates(_0x4dfb34,_0x27f004){return function(_0x4a4736){if(_0x4a4736){return _0x4a4736[_0xb411('0x24')](_0x4dfb34)['then'](function(_0x542891){return _0x542891;});}return null;};}function removeEntity(_0x442548,_0x5e21a7){return function(_0x537d66){if(_0x537d66){return _0x537d66[_0xb411('0x25')]()['then'](function(){_0x442548[_0xb411('0x1a')](0xcc)[_0xb411('0x26')]();});}};}function handleEntityNotFound(_0x3d023c,_0x2810fd){return function(_0x24871d){if(!_0x24871d){_0x3d023c['sendStatus'](0x194);}return _0x24871d;};}function handleError(_0x52e63b,_0x17eff1){_0x17eff1=_0x17eff1||0x1f4;return function(_0x3e9e80){logger[_0xb411('0x27')](_0x3e9e80[_0xb411('0x28')]);if(_0x3e9e80[_0xb411('0x29')]){delete _0x3e9e80[_0xb411('0x29')];}_0x52e63b[_0xb411('0x1a')](_0x17eff1)[_0xb411('0x2a')](_0x3e9e80);};}exports[_0xb411('0x2b')]=function(_0x4e2133,_0xa96a38){var _0x1cd8e6={},_0x37e43c={},_0x291184={'count':0x0,'rows':[]};var _0xb2a135=_[_0xb411('0x2c')](db[_0xb411('0x2d')][_0xb411('0x2e')],function(_0x396373){return{'name':_0x396373[_0xb411('0x2f')],'type':_0x396373[_0xb411('0x30')][_0xb411('0x31')]};});_0x37e43c[_0xb411('0x32')]=_[_0xb411('0x2c')](_0xb2a135,_0xb411('0x29'));_0x37e43c[_0xb411('0x33')]=_['keys'](_0x4e2133['query']);_0x37e43c[_0xb411('0x34')]=_[_0xb411('0x35')](_0x37e43c[_0xb411('0x32')],_0x37e43c[_0xb411('0x33')]);_0x1cd8e6['attributes']=_[_0xb411('0x35')](_0x37e43c[_0xb411('0x32')],qs['fields'](_0x4e2133[_0xb411('0x33')]['fields']));_0x1cd8e6['attributes']=_0x1cd8e6[_0xb411('0x36')][_0xb411('0x37')]?_0x1cd8e6[_0xb411('0x36')]:_0x37e43c['model'];if(!_0x4e2133[_0xb411('0x33')][_0xb411('0x38')](_0xb411('0x39'))){_0x1cd8e6[_0xb411('0x1d')]=qs['limit'](_0x4e2133[_0xb411('0x33')]['limit']);_0x1cd8e6[_0xb411('0x1f')]=qs[_0xb411('0x1f')](_0x4e2133[_0xb411('0x33')][_0xb411('0x1f')]);}_0x1cd8e6['order']=qs[_0xb411('0x3a')](_0x4e2133[_0xb411('0x33')][_0xb411('0x3a')]);_0x1cd8e6[_0xb411('0x3b')]=qs[_0xb411('0x34')](_[_0xb411('0x3c')](_0x4e2133[_0xb411('0x33')],_0x37e43c[_0xb411('0x34')]),_0xb2a135);if(_0x4e2133['query']['filter']){_0x1cd8e6['where']=_[_0xb411('0x3d')](_0x1cd8e6['where'],{'$or':_[_0xb411('0x2c')](_0xb2a135,function(_0x105bc3){if(_0x105bc3[_0xb411('0x30')]!=='VIRTUAL'){var _0x134813={};_0x134813[_0x105bc3['name']]={'$like':'%'+_0x4e2133[_0xb411('0x33')][_0xb411('0x3e')]+'%'};return _0x134813;}})});}_0x1cd8e6=_['merge']({},_0x1cd8e6,_0x4e2133[_0xb411('0x3f')]);var _0x287517={'where':_0x1cd8e6['where']};return db[_0xb411('0x2d')][_0xb411('0x1e')](_0x287517)[_0xb411('0x40')](function(_0xd2af7){_0x291184[_0xb411('0x1e')]=_0xd2af7;if(_0x4e2133[_0xb411('0x33')]['includeAll']){_0x1cd8e6[_0xb411('0x41')]=[{'all':!![]}];}return db['Attachment'][_0xb411('0x42')](_0x1cd8e6);})[_0xb411('0x40')](function(_0x104b6f){_0x291184[_0xb411('0x43')]=_0x104b6f;return _0x291184;})['then'](respondWithFilteredResult(_0xa96a38,_0x1cd8e6))[_0xb411('0x44')](handleError(_0xa96a38,null));};exports[_0xb411('0x45')]=function(_0x41653f,_0x27bc3f){var _0x34f8f1={'raw':!![],'where':{'id':_0x41653f['params']['id']}},_0x5e5c38={};_0x5e5c38[_0xb411('0x32')]=_[_0xb411('0x46')](db['Attachment'][_0xb411('0x2e')]);_0x5e5c38[_0xb411('0x33')]=_[_0xb411('0x46')](_0x41653f['query']);_0x5e5c38[_0xb411('0x34')]=_['intersection'](_0x5e5c38[_0xb411('0x32')],_0x5e5c38[_0xb411('0x33')]);_0x34f8f1[_0xb411('0x36')]=_[_0xb411('0x35')](_0x5e5c38[_0xb411('0x32')],qs[_0xb411('0x47')](_0x41653f[_0xb411('0x33')]['fields']));_0x34f8f1['attributes']=_0x34f8f1['attributes'][_0xb411('0x37')]?_0x34f8f1[_0xb411('0x36')]:_0x5e5c38[_0xb411('0x32')];if(_0x41653f[_0xb411('0x33')]['includeAll']){_0x34f8f1[_0xb411('0x41')]=[{'all':!![]}];}_0x34f8f1=_[_0xb411('0x3d')]({},_0x34f8f1,_0x41653f[_0xb411('0x3f')]);return db[_0xb411('0x2d')][_0xb411('0x48')](_0x34f8f1)[_0xb411('0x40')](handleEntityNotFound(_0x27bc3f,null))[_0xb411('0x40')](respondWithResult(_0x27bc3f,null))[_0xb411('0x44')](handleError(_0x27bc3f,null));};exports[_0xb411('0x49')]=function(_0x31506b,_0x276388){var _0x3146b9={'where':{'id':_0x31506b[_0xb411('0x4a')]['id']}},_0x53beb1={};_0x53beb1['model']=_[_0xb411('0x46')](db[_0xb411('0x2d')][_0xb411('0x2e')]);_0x3146b9[_0xb411('0x36')]=_[_0xb411('0x35')](_0x53beb1[_0xb411('0x32')],qs[_0xb411('0x47')](_0x31506b[_0xb411('0x33')][_0xb411('0x47')]));_0x3146b9[_0xb411('0x36')]=_0x3146b9[_0xb411('0x36')][_0xb411('0x37')]?_0x3146b9[_0xb411('0x36')]:_0x53beb1['model'];if(_0x31506b[_0xb411('0x33')][_0xb411('0x4b')]){_0x3146b9[_0xb411('0x41')]=[{'all':!![]}];}_0x3146b9=_[_0xb411('0x3d')]({},_0x3146b9,_0x31506b['options']);return db[_0xb411('0x2d')][_0xb411('0x48')](_0x3146b9)['then'](handleEntityNotFound(_0x276388,null))[_0xb411('0x40')](function(_0x40392c){if(_0x40392c){var _0x3f84ed=_0x40392c['get']({'plain':!![]});_0x3f84ed=qs['omit'](_0x3f84ed,['id','createdAt',_0xb411('0x4c')]);_0x31506b['body']=_['omit'](_0x31506b[_0xb411('0x4d')],['id',_0xb411('0x4e'),_0xb411('0x4c')]);return db[_0xb411('0x2d')]['create'](_[_0xb411('0x3d')](_0x3f84ed,_0x31506b['body']),{'include':_0x31506b[_0xb411('0x33')][_0xb411('0x4b')]?[{'all':!![]}]:undefined});}})[_0xb411('0x40')](respondWithResult(_0x276388,0xc9))[_0xb411('0x44')](handleError(_0x276388,null));};exports[_0xb411('0x24')]=function(_0x30630f,_0x156e06){if(_0x30630f[_0xb411('0x4d')]['id']){delete _0x30630f[_0xb411('0x4d')]['id'];}return db[_0xb411('0x2d')][_0xb411('0x48')]({'where':{'id':_0x30630f[_0xb411('0x4a')]['id']}})[_0xb411('0x40')](handleEntityNotFound(_0x156e06,null))['then'](saveUpdates(_0x30630f[_0xb411('0x4d')],null))[_0xb411('0x40')](respondWithResult(_0x156e06,null))[_0xb411('0x44')](handleError(_0x156e06,null));};exports[_0xb411('0x25')]=function(_0x1e50e2,_0x4c523e){return db[_0xb411('0x2d')]['find']({'where':{'id':_0x1e50e2[_0xb411('0x4a')]['id']}})[_0xb411('0x40')](handleEntityNotFound(_0x4c523e,null))['then'](removeEntity(_0x4c523e,null))[_0xb411('0x44')](handleError(_0x4c523e,null));};exports[_0xb411('0x4f')]=function(_0x1d2223,_0x589e0e,_0x1ea884){_0x1d2223[_0xb411('0x4d')][_0xb411('0x29')]=_0x1d2223[_0xb411('0x50')]['originalname'];_0x1d2223['body'][_0xb411('0x51')]=_0x1d2223['file']['filename'];_0x1d2223[_0xb411('0x4d')][_0xb411('0x30')]=_0x1d2223['file'][_0xb411('0x52')];return db[_0xb411('0x2d')][_0xb411('0x4f')](_0x1d2223[_0xb411('0x4d')])['then'](respondWithResult(_0x589e0e,0xc9))['catch'](handleError(_0x589e0e,null));};exports['download']=function(_0x1e44fe,_0x4ae7b7,_0x5387f1){return db['Attachment']['findOne']({'where':{'id':_0x1e44fe[_0xb411('0x4a')]['id']},'raw':!![]})[_0xb411('0x40')](handleEntityNotFound(_0x4ae7b7,null))[_0xb411('0x40')](function(_0x46dc57){if(_0x46dc57){var _0x2e1412=_0x46dc57[_0xb411('0x53')]!==null;var _0x5e5890=path[_0xb411('0x54')](config['root'],_0xb411('0x55'));if(_0x2e1412){_0x5e5890=path[_0xb411('0x54')](_0x5e5890,_0xb411('0x56'));}var _0x2d21c4=path[_0xb411('0x54')](_0x5e5890,_0x46dc57[_0xb411('0x51')]);return _0x4ae7b7[_0xb411('0x57')](_0x2d21c4);}})['catch'](handleError(_0x4ae7b7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7ae4aa2..11f3ed8 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 _0xd87d=['exports','define','Attachment','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0xa81fc8,_0x322694){var _0x4c3337=function(_0x515406){while(--_0x515406){_0xa81fc8['push'](_0xa81fc8['shift']());}};_0x4c3337(++_0x322694);}(_0xd87d,0x16b));var _0xdd87=function(_0x51cef4,_0x3734b1){_0x51cef4=_0x51cef4-0x0;var _0x36477a=_0xd87d[_0x51cef4];return _0x36477a;};'use strict';var _=require(_0xdd87('0x0'));var util=require('util');var logger=require(_0xdd87('0x1'))('api');var moment=require(_0xdd87('0x2'));var BPromise=require(_0xdd87('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd87('0x4'));var config=require(_0xdd87('0x5'));var attributes=require('./attachment.attributes');module[_0xdd87('0x6')]=function(_0x1f0cbd,_0x449f50){return _0x1f0cbd[_0xdd87('0x7')](_0xdd87('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6a8=['attachments','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','Attachment'];(function(_0x138366,_0x3df607){var _0x466de6=function(_0x4ba446){while(--_0x4ba446){_0x138366['push'](_0x138366['shift']());}};_0x466de6(++_0x3df607);}(_0xa6a8,0x1e5));var _0x8a6a=function(_0x3c35fe,_0x3d6f11){_0x3c35fe=_0x3c35fe-0x0;var _0x546e20=_0xa6a8[_0x3c35fe];return _0x546e20;};'use strict';var _=require(_0x8a6a('0x0'));var util=require(_0x8a6a('0x1'));var logger=require(_0x8a6a('0x2'))(_0x8a6a('0x3'));var moment=require(_0x8a6a('0x4'));var BPromise=require(_0x8a6a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a6a('0x6'));var config=require(_0x8a6a('0x7'));var attributes=require('./attachment.attributes');module['exports']=function(_0x8069e6,_0xee6f36){return _0x8069e6[_0x8a6a('0x8')](_0x8a6a('0x9'),attributes,{'tableName':_0x8a6a('0xa'),'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 3de1449..35b9f6e 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 _0xc5ba=['catch','CreateAttachment','Attachment','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x100fcf,_0x51209b){var _0x1e056e=function(_0x5e45ab){while(--_0x5e45ab){_0x100fcf['push'](_0x100fcf['shift']());}};_0x1e056e(++_0x51209b);}(_0xc5ba,0xb9));var _0xac5b=function(_0x86bed5,_0xa2634d){_0x86bed5=_0x86bed5-0x0;var _0x252d3a=_0xc5ba[_0x86bed5];return _0x252d3a;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var BPromise=require(_0xac5b('0x3'));var rs=require(_0xac5b('0x4'));var fs=require('fs');var Redis=require(_0xac5b('0x5'));var db=require(_0xac5b('0x6'))['db'];var utils=require(_0xac5b('0x7'));var logger=require(_0xac5b('0x8'))(_0xac5b('0x9'));var config=require(_0xac5b('0xa'));var jayson=require(_0xac5b('0xb'));var client=jayson[_0xac5b('0xc')][_0xac5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38602a,_0xc09fbc,_0xc193a7){return new BPromise(function(_0x4a7fc7,_0x525e20){return client[_0xac5b('0xe')](_0x38602a,_0xc193a7)['then'](function(_0x3c5bd3){logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));logger[_0xac5b('0x12')](_0xac5b('0x13'),_0xc09fbc,_0xac5b('0x11'),JSON[_0xac5b('0x14')](_0x3c5bd3));if(_0x3c5bd3[_0xac5b('0x15')]){if(_0x3c5bd3['error'][_0xac5b('0x16')]===0x1f4){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x525e20(_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);}logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x4a7fc7(_0x3c5bd3[_0xac5b('0x15')]['message']);}else{logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));_0x4a7fc7(_0x3c5bd3[_0xac5b('0x18')][_0xac5b('0x17')]);}})[_0xac5b('0x19')](function(_0x363de5){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x363de5);_0x525e20(_0x363de5);});});}exports[_0xac5b('0x1a')]=function(_0x11e6fa){var _0x551ccf=this;return new Promise(function(_0x2db8d1,_0x4c46e5){return db[_0xac5b('0x1b')]['create'](_0x11e6fa[_0xac5b('0x1c')],{'raw':_0x11e6fa[_0xac5b('0x1d')]?_0x11e6fa['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3dbc5b){logger['info'](_0xac5b('0x1a'),_0x11e6fa);logger[_0xac5b('0x12')](_0xac5b('0x1a'),_0x11e6fa,JSON[_0xac5b('0x14')](_0x3dbc5b));_0x2db8d1(_0x3dbc5b);})[_0xac5b('0x19')](function(_0x5a4b94){logger['error']('CreateAttachment',_0x5a4b94[_0xac5b('0x17')],_0x11e6fa);_0x4c46e5(_0x551ccf['error'](0x1f4,_0x5a4b94[_0xac5b('0x17')]));});});}; \ No newline at end of file +var _0xeddd=['../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateAttachment','Attachment','create','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0xeddd,0x69));var _0xdedd=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xeddd[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var moment=require(_0xdedd('0x2'));var BPromise=require(_0xdedd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdedd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdedd('0x5'));var logger=require(_0xdedd('0x6'))('rpc');var config=require(_0xdedd('0x7'));var jayson=require(_0xdedd('0x8'));var client=jayson[_0xdedd('0x9')][_0xdedd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x102b00,_0x41d72f,_0x2aa946){return new BPromise(function(_0x260839,_0x3cc017){return client[_0xdedd('0xb')](_0x102b00,_0x2aa946)[_0xdedd('0xc')](function(_0x429585){logger['info'](_0xdedd('0xd'),_0x41d72f,_0xdedd('0xe'));logger[_0xdedd('0xf')](_0xdedd('0x10'),_0x41d72f,'request\x20sent',JSON[_0xdedd('0x11')](_0x429585));if(_0x429585[_0xdedd('0x12')]){if(_0x429585[_0xdedd('0x12')][_0xdedd('0x13')]===0x1f4){logger[_0xdedd('0x12')](_0xdedd('0xd'),_0x41d72f,_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);return _0x3cc017(_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);}logger[_0xdedd('0x12')](_0xdedd('0xd'),_0x41d72f,_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);return _0x260839(_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);}else{logger[_0xdedd('0x15')](_0xdedd('0xd'),_0x41d72f,_0xdedd('0xe'));_0x260839(_0x429585['result'][_0xdedd('0x14')]);}})[_0xdedd('0x16')](function(_0x588ce7){logger[_0xdedd('0x12')](_0xdedd('0xd'),_0x41d72f,_0x588ce7);_0x3cc017(_0x588ce7);});});}exports[_0xdedd('0x17')]=function(_0x4b16bb){var _0x43611b=this;return new Promise(function(_0x24e331,_0x4054b0){return db[_0xdedd('0x18')][_0xdedd('0x19')](_0x4b16bb['body'],{'raw':_0x4b16bb[_0xdedd('0x1a')]?_0x4b16bb[_0xdedd('0x1a')][_0xdedd('0x1b')]===undefined?!![]:![]:!![]})[_0xdedd('0xc')](function(_0x1213d6){logger[_0xdedd('0x15')](_0xdedd('0x17'),_0x4b16bb);logger[_0xdedd('0xf')](_0xdedd('0x17'),_0x4b16bb,JSON['stringify'](_0x1213d6));_0x24e331(_0x1213d6);})['catch'](function(_0x538dc1){logger['error'](_0xdedd('0x17'),_0x538dc1[_0xdedd('0x14')],_0x4b16bb);_0x4054b0(_0x43611b[_0xdedd('0x12')](0x1f4,_0x538dc1[_0xdedd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 115f85e..a5e9cac 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(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x46f6b6,_0x1c51d2){_0x46f6b6=_0x46f6b6-0x0;var _0xfa24fe=_0xdb28[_0x46f6b6];return _0xfa24fe;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 880f84e..368c590 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 _0x1a62=['login','authenticate','google','/login','profile','callback','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','User','find','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','getLicense','then','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','signToken'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x1a62,0xcb));var _0x21a6=function(_0x2fc5d4,_0x514199){_0x2fc5d4=_0x2fc5d4-0x0;var _0x3b273c=_0x1a62[_0x2fc5d4];return _0x3b273c;};'use strict';var _=require(_0x21a6('0x0'));var passport=require(_0x21a6('0x1'));var GoogleStrategy=require(_0x21a6('0x2'))[_0x21a6('0x3')];var moment=require('moment');var db=require(_0x21a6('0x4'))['db'];var config=require(_0x21a6('0x5'));var signToken=require('../../components/auth/service')[_0x21a6('0x6')];var utils=require('../../config/utils');exports[_0x21a6('0x7')]=passport[_0x21a6('0x8')](_0x21a6('0x9'),{'failureRedirect':_0x21a6('0xa'),'scope':[_0x21a6('0xb'),'email'],'session':![]});exports[_0x21a6('0xc')]=passport[_0x21a6('0x8')](_0x21a6('0x9'),{'failureRedirect':_0x21a6('0xa'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x21a6('0x9')]?config[_0x21a6('0x9')][_0x21a6('0xd')]:'id','clientSecret':config['google']?config['google'][_0x21a6('0xe')]:_0x21a6('0xf'),'callbackURL':config[_0x21a6('0x9')]?config['google']['callbackURL']:''},function(_0xc6b273,_0x113de4,_0x123fff,_0x331dc6){var _0x954d2f,_0x335910;return db[_0x21a6('0x10')][_0x21a6('0x11')]({'where':{'id':0x1},'attributes':[_0x21a6('0x12'),_0x21a6('0x13')],'raw':!![]})['then'](function(_0x590f6b){_0x954d2f=_0x590f6b;return db[_0x21a6('0x14')][_0x21a6('0x15')]({'where':{'email':_[_0x21a6('0x16')](_0x123fff[_0x21a6('0x17')],_0x21a6('0x18')),'role':{'$or':[_0x21a6('0x19'),_0x21a6('0x1a'),_0x21a6('0x1b')]}}});})['then'](function(_0x4bc225){_0x335910=_0x4bc225;if(_0x335910){if(_0x335910[_0x21a6('0x1c')]){return _0x331dc6(_0x21a6('0x1d'));}else if(_0x954d2f[_0x21a6('0x13')]>0x0){if(_0x335910[_0x21a6('0x1e')]){if(moment(_0x335910['blockedAt'])[_0x21a6('0x1f')](_0x954d2f[_0x21a6('0x13')],'minutes')>moment()){return _0x331dc6(_0x21a6('0x1d'));}else{return utils[_0x21a6('0x20')](_0x335910,0x0,![],null)['then'](function(){return utils[_0x21a6('0x21')](_0x335910);})[_0x21a6('0x22')](function(){return _0x331dc6(null,_0x335910);});}}else{return utils['getLicense'](_0x335910)['then'](function(){return _0x331dc6(null,_0x335910);});}}else{return utils[_0x21a6('0x21')](_0x335910)[_0x21a6('0x22')](function(){return _0x331dc6(null,_0x335910);});}}return _0x331dc6(_0x21a6('0x1d'));})['catch'](function(_0x3705b3){_0x331dc6(_0x3705b3);});})); \ No newline at end of file +var _0x42ba=['allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','profile','email','/login','use','clientID','clientSecret','Setting','findOne'];(function(_0x581aae,_0x2b18ee){var _0x539df2=function(_0xbbcb64){while(--_0xbbcb64){_0x581aae['push'](_0x581aae['shift']());}};_0x539df2(++_0x2b18ee);}(_0x42ba,0x123));var _0xa42b=function(_0x408911,_0x870406){_0x408911=_0x408911-0x0;var _0x3bbd74=_0x42ba[_0x408911];return _0x3bbd74;};'use strict';var _=require(_0xa42b('0x0'));var passport=require(_0xa42b('0x1'));var GoogleStrategy=require(_0xa42b('0x2'))[_0xa42b('0x3')];var moment=require(_0xa42b('0x4'));var db=require(_0xa42b('0x5'))['db'];var config=require(_0xa42b('0x6'));var signToken=require(_0xa42b('0x7'))[_0xa42b('0x8')];var utils=require(_0xa42b('0x9'));exports[_0xa42b('0xa')]=passport[_0xa42b('0xb')](_0xa42b('0xc'),{'failureRedirect':'/login','scope':[_0xa42b('0xd'),_0xa42b('0xe')],'session':![]});exports['callback']=passport['authenticate']('google',{'failureRedirect':_0xa42b('0xf'),'session':![]});passport[_0xa42b('0x10')](new GoogleStrategy({'clientID':config[_0xa42b('0xc')]?config[_0xa42b('0xc')][_0xa42b('0x11')]:'id','clientSecret':config[_0xa42b('0xc')]?config[_0xa42b('0xc')][_0xa42b('0x12')]:'secret','callbackURL':config[_0xa42b('0xc')]?config[_0xa42b('0xc')]['callbackURL']:''},function(_0x2a263b,_0x5b7128,_0x185a86,_0x3bc3f0){var _0xdc97e1,_0x850bde;return db[_0xa42b('0x13')][_0xa42b('0x14')]({'where':{'id':0x1},'attributes':[_0xa42b('0x15'),_0xa42b('0x16')],'raw':!![]})[_0xa42b('0x17')](function(_0x48edb5){_0xdc97e1=_0x48edb5;return db[_0xa42b('0x18')][_0xa42b('0x19')]({'where':{'email':_[_0xa42b('0x1a')](_0x185a86[_0xa42b('0x1b')],_0xa42b('0x1c')),'role':{'$or':['admin',_0xa42b('0x1d'),_0xa42b('0x1e')]}}});})[_0xa42b('0x17')](function(_0x1409f4){_0x850bde=_0x1409f4;if(_0x850bde){if(_0x850bde[_0xa42b('0x1f')]){return _0x3bc3f0(_0xa42b('0x20'));}else if(_0xdc97e1[_0xa42b('0x16')]>0x0){if(_0x850bde[_0xa42b('0x21')]){if(moment(_0x850bde['blockedAt'])[_0xa42b('0x22')](_0xdc97e1[_0xa42b('0x16')],_0xa42b('0x23'))>moment()){return _0x3bc3f0(_0xa42b('0x20'));}else{return utils[_0xa42b('0x24')](_0x850bde,0x0,![],null)[_0xa42b('0x17')](function(){return utils[_0xa42b('0x25')](_0x850bde);})['then'](function(){return _0x3bc3f0(null,_0x850bde);});}}else{return utils[_0xa42b('0x25')](_0x850bde)['then'](function(){return _0x3bc3f0(null,_0x850bde);});}}else{return utils[_0xa42b('0x25')](_0x850bde)['then'](function(){return _0x3bc3f0(null,_0x850bde);});}}return _0x3bc3f0(_0xa42b('0x20'));})[_0xa42b('0x26')](function(_0xf435aa){_0x3bc3f0(_0xf435aa);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 62daeb3..7995c82 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 _0x4680=['Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','express','passport'];(function(_0x1f7cf3,_0x180719){var _0x25b236=function(_0x1c1ec3){while(--_0x1c1ec3){_0x1f7cf3['push'](_0x1f7cf3['shift']());}};_0x25b236(++_0x180719);}(_0x4680,0x106));var _0x0468=function(_0x5474d7,_0x1a0f97){_0x5474d7=_0x5474d7-0x0;var _0x3981e5=_0x4680[_0x5474d7];return _0x3981e5;};'use strict';var express=require(_0x0468('0x0'));var passport=require(_0x0468('0x1'));var router=express[_0x0468('0x2')]();var controller=require(_0x0468('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x0468('0x4'));router[_0x0468('0x5')]('/',controller[_0x0468('0x6')]);router[_0x0468('0x5')](_0x0468('0x7'),controller[_0x0468('0x8')],authService[_0x0468('0x9')],userController[_0x0468('0x6')],authService[_0x0468('0xa')]);module['exports']=router; \ No newline at end of file +var _0x3066=['passport','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x3066,0x136));var _0x6306=function(_0x5cf2c3,_0x5cb357){_0x5cf2c3=_0x5cf2c3-0x0;var _0x26e94a=_0x3066[_0x5cf2c3];return _0x26e94a;};'use strict';var express=require('express');var passport=require(_0x6306('0x0'));var router=express[_0x6306('0x1')]();var controller=require(_0x6306('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x6306('0x3'));router[_0x6306('0x4')]('/',controller[_0x6306('0x5')]);router[_0x6306('0x4')](_0x6306('0x6'),controller[_0x6306('0x7')],authService[_0x6306('0x8')],userController['login'],authService[_0x6306('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d60b4e2..f9ed876 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 _0xe80c=['host','port','secure','authentication','pass','merge','\x22%s\x22\x20<%s>','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','local','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','token','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','resetPasswordExpires','save','use','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','blockedAt','add','blockDuration','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service'];(function(_0x3e8e6f,_0x2f53e9){var _0x52a03e=function(_0x37c629){while(--_0x37c629){_0x3e8e6f['push'](_0x3e8e6f['shift']());}};_0x52a03e(++_0x2f53e9);}(_0xe80c,0x1c2));var _0xce80=function(_0x7630ca,_0x58d3a2){_0x7630ca=_0x7630ca-0x0;var _0x4aa29b=_0xe80c[_0x7630ca];return _0x4aa29b;};'use strict';var util=require('util');var passport=require(_0xce80('0x0'));var LocalStrategy=require(_0xce80('0x1'))[_0xce80('0x2')];var jayson=require(_0xce80('0x3'));var _=require(_0xce80('0x4'));var rs=require('randomstring');var moment=require(_0xce80('0x5'));var db=require(_0xce80('0x6'))['db'];var authService=require(_0xce80('0x7'));var utils=require(_0xce80('0x8'));var client=jayson['client'][_0xce80('0x9')]({'port':0x232b});function localAuthenticate(_0x150f6a,_0xd8b88e,_0x53574f,_0x2e1dc6){var _0x4c2e58,_0x40ee29;return db['Setting'][_0xce80('0xa')]({'where':{'id':0x1},'attributes':[_0xce80('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x2d7bf3){_0x4c2e58=_0x2d7bf3;return _0x150f6a[_0xce80('0xa')]({'attributes':['id',_0xce80('0xc'),_0xce80('0xd'),_0xce80('0xe'),_0xce80('0xf'),_0xce80('0x10'),_0xce80('0x11'),'blockedAt',_0xce80('0x12')],'where':{'name':_0xd8b88e,'role':{'$or':[_0xce80('0x13'),_0xce80('0x14'),'agent']}}});})['then'](function(_0x3ab0e2){if(!_0x3ab0e2||_0x3ab0e2&&_0x3ab0e2[_0xce80('0xc')]!==_0xd8b88e){throw new Error(_0xce80('0x15'));}else{_0x40ee29=_0x3ab0e2;return _0x40ee29;}})[_0xce80('0x16')](function(){_0x40ee29['authenticate'](_0x53574f,function(_0x2cd5b3,_0x5d134e){var _0x9402b9=_0x40ee29['loginAttempts']+0x1;if(_0x2cd5b3){return _0x2e1dc6(_0x2cd5b3);}else if(!_0x5d134e){if(_0x40ee29[_0xce80('0x10')]){return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});}else if(_0x4c2e58['allowedLoginAttempts']>0x0){if(_0x40ee29['blocked']){if(_0x4c2e58['blockDuration']>0x0){if(moment(_0x40ee29[_0xce80('0x17')])[_0xce80('0x18')](_0x4c2e58[_0xce80('0x19')],_0xce80('0x1a'))>moment()){return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});}else{return utils['clearBlockUser'](_0x40ee29,_0x9402b9,![],null)[_0xce80('0x16')](function(){return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});});}}else{return _0x2e1dc6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x9402b9>=_0x4c2e58['allowedLoginAttempts']){return utils['clearBlockUser'](_0x40ee29,0x0,!![],moment())[_0xce80('0x16')](function(){return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});});}else{return utils[_0xce80('0x1b')](_0x40ee29,_0x9402b9,![],null)[_0xce80('0x16')](function(){return _0x2e1dc6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});}}else{if(_0x40ee29[_0xce80('0x10')]){return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});}else if(_0x4c2e58['allowedLoginAttempts']>0x0){if(_0x40ee29['blocked']){if(_0x4c2e58[_0xce80('0x19')]>0x0){if(moment(_0x40ee29['blockedAt'])[_0xce80('0x18')](_0x4c2e58[_0xce80('0x19')],_0xce80('0x1a'))>moment()){return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});}else{return utils['clearBlockUser'](_0x40ee29,0x0,![],null)[_0xce80('0x16')](function(){return utils['getLicense'](_0x40ee29);})[_0xce80('0x16')](function(){return _0x2e1dc6(null,_0x40ee29);});}}else{return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});}}else{return utils['clearBlockUser'](_0x40ee29,0x0,![],null)['then'](function(){return utils[_0xce80('0x1c')](_0x40ee29);})['then'](function(){return _0x2e1dc6(null,_0x40ee29);})[_0xce80('0x1d')](function(_0x1017f1){return _0x2e1dc6(null,![],_0x1017f1);});}}else{if(_0x40ee29[_0xce80('0x11')]){return _0x2e1dc6(null,![],{'message':_0xce80('0x15')});}else{return utils['getLicense'](_0x40ee29)[_0xce80('0x16')](function(){return _0x2e1dc6(null,_0x40ee29);});}}}});})[_0xce80('0x1d')](function(_0x1fec80){return _0x2e1dc6(null,![],_0x1fec80);});}function sendServiceMail(_0x3d7c49){return db[_0xce80('0x1e')][_0xce80('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xce80('0xc'),_0xce80('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xce80('0x21')}]})[_0xce80('0x16')](function(_0xa861d8){if(!_0xa861d8){throw new Error(_0xce80('0x22'));}var _0x279931={'tls':{'rejectUnauthorized':![]}};if(_0xa861d8[_0xce80('0x21')][_0xce80('0x23')]){_0x279931['service']=_0xa861d8[_0xce80('0x21')]['service'];}else{_0x279931['host']=_0xa861d8[_0xce80('0x21')][_0xce80('0x24')];_0x279931[_0xce80('0x25')]=_0xa861d8[_0xce80('0x21')][_0xce80('0x25')];_0x279931[_0xce80('0x26')]=_0xa861d8[_0xce80('0x21')][_0xce80('0x26')];}if(_0xa861d8['Smtp'][_0xce80('0x27')]){_0x279931['auth']={'user':_0xa861d8[_0xce80('0x21')][_0xce80('0x14')],'pass':_0xa861d8[_0xce80('0x21')][_0xce80('0x28')]};}var _0xa3a711={'account':_0x279931,'message':_[_0xce80('0x29')]({'from':util['format'](_0xce80('0x2a'),_0xa861d8[_0xce80('0xc')],_0xa861d8[_0xce80('0x20')]||_0xa861d8[_0xce80('0x21')][_0xce80('0x14')])},_0x3d7c49)};return client[_0xce80('0x2b')]('SendMail',_0xa3a711);})['then'](function(_0x21243e){if(_0x21243e[_0xce80('0x2c')]){throw new Error(util[_0xce80('0x2d')](_0xce80('0x2e'),_0x21243e[_0xce80('0x2c')]['message']||JSON[_0xce80('0x2f')](_0x21243e[_0xce80('0x2c')])));}return!![];});}function handleError(_0x3b8166,_0x16bf83,_0x29839a){return _0x3b8166[_0xce80('0x30')](_0x16bf83||0x1f4)[_0xce80('0x31')]({'message':_0x29839a?_0x29839a[_0xce80('0x32')]||_0x29839a:''});}exports[_0xce80('0x33')]=function(_0x45e175,_0x5ddb23,_0xd8dc54){passport['authenticate'](_0xce80('0x34'),function(_0x10a2ae,_0x3111a9,_0x2c87ce){var _0x222b08=_0x10a2ae||_0x2c87ce;if(_0x222b08){return handleError(_0x5ddb23,0x191,_0x222b08);}if(!_0x3111a9){return handleError(_0x5ddb23,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x25c36c={'payload':{'id':_0x3111a9['id'],'role':_0x3111a9[_0xce80('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xce80('0x35')](_0x25c36c)['then'](function(_0x1d2dbe){_0x5ddb23['json']({'id':_0x3111a9['id'],'token':_0x1d2dbe,'statusCall':'','isAlreadyLogged':_0x3111a9[_0xce80('0x36')]});});}})(_0x45e175,_0x5ddb23,_0xd8dc54);};exports[_0xce80('0x37')]=function(_0x3a5b0e,_0x48a169,_0x34a494){if(!_0x3a5b0e[_0xce80('0x38')]['email']){return handleError(_0x48a169,0x1f4,{'message':_0xce80('0x39')});}var _0x3226a4=rs[_0xce80('0x3a')]();_0x3a5b0e[_0xce80('0x38')]['email']=_0x3a5b0e[_0xce80('0x38')]['email'][_0xce80('0x3b')]()[_0xce80('0x3c')]();var _0x3e2edd;return db[_0xce80('0x3d')][_0xce80('0xa')]({'where':{'id':0x1},'attributes':[_0xce80('0xb'),_0xce80('0x19')],'raw':!![]})[_0xce80('0x16')](function(_0x2d3580){_0x3e2edd=_0x2d3580;return db['User'][_0xce80('0x1f')]({'where':{'email':_0x3a5b0e[_0xce80('0x38')][_0xce80('0x20')]}});})['then'](function(_0x35801b){if(!_0x35801b){throw new Error(_0xce80('0x3e'));}if(_0x35801b[_0xce80('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x35801b[_0xce80('0x11')]){if(moment(_0x35801b['blockedAt'])[_0xce80('0x18')](_0x3e2edd[_0xce80('0x19')],_0xce80('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x35801b[_0xce80('0x11')]=![];_0x35801b[_0xce80('0x17')]=null;}}_0x35801b[_0xce80('0x3f')]=_0x3226a4;_0x35801b['resetPasswordExpires']=Date[_0xce80('0x40')]()+0x36ee80;return _0x35801b['save']();})['then'](function(){return sendServiceMail({'to':_0x3a5b0e[_0xce80('0x38')][_0xce80('0x20')],'subject':_0xce80('0x41'),'text':_0xce80('0x42')+_0xce80('0x43')+_0xce80('0x44')+_0x3a5b0e[_0xce80('0x45')][_0xce80('0x24')]+'/reset/'+_0x3226a4+'\x0a\x0a'+_0xce80('0x46')});})['then'](function(){_0x48a169[_0xce80('0x30')](0xc8)[_0xce80('0x31')]({'message':_0xce80('0x47')});})[_0xce80('0x1d')](function(_0x3db547){return handleError(_0x48a169,0x1f4,_0x3db547);});};exports[_0xce80('0x48')]=function(_0x595662,_0x445985,_0x5b8342){return db[_0xce80('0x49')]['find']({'where':{'resetPasswordToken':_0x595662['params'][_0xce80('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xce80('0x40')]()}}})[_0xce80('0x16')](function(_0x3cb994){if(!_0x3cb994){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xce80('0x3d')][_0xce80('0xa')]({'attributes':['id','securePassword',_0xce80('0x4b'),_0xce80('0x4c')]})[_0xce80('0x16')](function(_0x62d2ee){if(_0x62d2ee['securePassword'])authService['validatePasswordPattern'](_0x595662['body'][_0xce80('0xd')]);if(!_0x62d2ee[_0xce80('0x4b')]||!_0x3cb994[_0xce80('0x4d')])return _0x3cb994;authService['validatePasswordHistory'](_0x595662['body'][_0xce80('0xd')],_0x3cb994['previousPasswords'],_0x62d2ee[_0xce80('0x4c')]);return _0x3cb994;})[_0xce80('0x16')](function(){_0x3cb994[_0xce80('0xd')]=_0x595662[_0xce80('0x38')][_0xce80('0xd')];_0x3cb994[_0xce80('0x3f')]=null;_0x3cb994[_0xce80('0x4e')]=null;return _0x3cb994[_0xce80('0x4f')]();});})[_0xce80('0x16')](function(){_0x445985[_0xce80('0x30')](0xc8)[_0xce80('0x31')]({'message':'Password\x20reset!'});})[_0xce80('0x1d')](function(_0x965320){return handleError(_0x445985,0x1f4,_0x965320);});};passport[_0xce80('0x50')](new LocalStrategy({'usernameField':_0xce80('0xc'),'passwordField':'password'},function(_0x7c2f63,_0x48eb27,_0x46a4ad){return localAuthenticate(db[_0xce80('0x49')],_0x7c2f63,_0x48eb27,_0x46a4ad);})); \ No newline at end of file +var _0x0203=['toLowerCase','findOne','User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','now','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','body','Email\x20parameter\x20is\x20missing','generate'];(function(_0x237560,_0x7db97e){var _0x5b2ed6=function(_0x1a4c54){while(--_0x1a4c54){_0x237560['push'](_0x237560['shift']());}};_0x5b2ed6(++_0x7db97e);}(_0x0203,0x164));var _0x3020=function(_0x3881b9,_0x29c3f1){_0x3881b9=_0x3881b9-0x0;var _0x98e9cb=_0x0203[_0x3881b9];return _0x98e9cb;};'use strict';var util=require(_0x3020('0x0'));var passport=require(_0x3020('0x1'));var LocalStrategy=require(_0x3020('0x2'))[_0x3020('0x3')];var jayson=require(_0x3020('0x4'));var _=require(_0x3020('0x5'));var rs=require(_0x3020('0x6'));var moment=require('moment');var db=require(_0x3020('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x3020('0x8'));var client=jayson[_0x3020('0x9')][_0x3020('0xa')]({'port':0x232b});function localAuthenticate(_0x3d28eb,_0x248470,_0x36f76d,_0x107094){var _0x621af6,_0x5b4ac2;return db[_0x3020('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x3020('0xc'),_0x3020('0xd')],'raw':!![]})[_0x3020('0xe')](function(_0x117c57){_0x621af6=_0x117c57;return _0x3d28eb['findOne']({'attributes':['id',_0x3020('0xf'),_0x3020('0x10'),_0x3020('0x11'),'role','disabled',_0x3020('0x12'),'blockedAt','loginAttempts'],'where':{'name':_0x248470,'role':{'$or':[_0x3020('0x13'),_0x3020('0x14'),_0x3020('0x15')]}}});})[_0x3020('0xe')](function(_0x2927c5){if(!_0x2927c5||_0x2927c5&&_0x2927c5[_0x3020('0xf')]!==_0x248470){throw new Error(_0x3020('0x16'));}else{_0x5b4ac2=_0x2927c5;return _0x5b4ac2;}})[_0x3020('0xe')](function(){_0x5b4ac2[_0x3020('0x17')](_0x36f76d,function(_0xea3221,_0x30671a){var _0x630636=_0x5b4ac2[_0x3020('0x18')]+0x1;if(_0xea3221){return _0x107094(_0xea3221);}else if(!_0x30671a){if(_0x5b4ac2[_0x3020('0x19')]){return _0x107094(null,![],{'message':_0x3020('0x16')});}else if(_0x621af6[_0x3020('0xc')]>0x0){if(_0x5b4ac2[_0x3020('0x12')]){if(_0x621af6[_0x3020('0xd')]>0x0){if(moment(_0x5b4ac2[_0x3020('0x1a')])[_0x3020('0x1b')](_0x621af6[_0x3020('0xd')],_0x3020('0x1c'))>moment()){return _0x107094(null,![],{'message':_0x3020('0x16')});}else{return utils[_0x3020('0x1d')](_0x5b4ac2,_0x630636,![],null)[_0x3020('0xe')](function(){return _0x107094(null,![],{'message':_0x3020('0x16')});});}}else{return _0x107094(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x630636>=_0x621af6[_0x3020('0xc')]){return utils[_0x3020('0x1d')](_0x5b4ac2,0x0,!![],moment())[_0x3020('0xe')](function(){return _0x107094(null,![],{'message':_0x3020('0x16')});});}else{return utils['clearBlockUser'](_0x5b4ac2,_0x630636,![],null)['then'](function(){return _0x107094(null,![],{'message':_0x3020('0x16')});});}}}else{return _0x107094(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5b4ac2['disabled']){return _0x107094(null,![],{'message':_0x3020('0x16')});}else if(_0x621af6['allowedLoginAttempts']>0x0){if(_0x5b4ac2[_0x3020('0x12')]){if(_0x621af6[_0x3020('0xd')]>0x0){if(moment(_0x5b4ac2['blockedAt'])[_0x3020('0x1b')](_0x621af6[_0x3020('0xd')],'minutes')>moment()){return _0x107094(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3020('0x1d')](_0x5b4ac2,0x0,![],null)[_0x3020('0xe')](function(){return utils[_0x3020('0x1e')](_0x5b4ac2);})[_0x3020('0xe')](function(){return _0x107094(null,_0x5b4ac2);});}}else{return _0x107094(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x5b4ac2,0x0,![],null)['then'](function(){return utils[_0x3020('0x1e')](_0x5b4ac2);})[_0x3020('0xe')](function(){return _0x107094(null,_0x5b4ac2);})[_0x3020('0x1f')](function(_0x3d09cb){return _0x107094(null,![],_0x3d09cb);});}}else{if(_0x5b4ac2[_0x3020('0x12')]){return _0x107094(null,![],{'message':_0x3020('0x16')});}else{return utils[_0x3020('0x1e')](_0x5b4ac2)[_0x3020('0xe')](function(){return _0x107094(null,_0x5b4ac2);});}}}});})['catch'](function(_0x32cf0a){return _0x107094(null,![],_0x32cf0a);});}function sendServiceMail(_0x5f1f2d){return db[_0x3020('0x20')][_0x3020('0x21')]({'where':{'service':!![]},'attributes':['id',_0x3020('0xf'),_0x3020('0x22')],'include':[{'model':db['MailServerOut'],'as':_0x3020('0x23')}]})[_0x3020('0xe')](function(_0x137717){if(!_0x137717){throw new Error(_0x3020('0x24'));}var _0xb8719={'tls':{'rejectUnauthorized':![]}};if(_0x137717[_0x3020('0x23')][_0x3020('0x25')]){_0xb8719[_0x3020('0x25')]=_0x137717[_0x3020('0x23')]['service'];}else{_0xb8719[_0x3020('0x26')]=_0x137717[_0x3020('0x23')][_0x3020('0x26')];_0xb8719[_0x3020('0x27')]=_0x137717[_0x3020('0x23')][_0x3020('0x27')];_0xb8719[_0x3020('0x28')]=_0x137717[_0x3020('0x23')][_0x3020('0x28')];}if(_0x137717[_0x3020('0x23')]['authentication']){_0xb8719[_0x3020('0x29')]={'user':_0x137717[_0x3020('0x23')][_0x3020('0x14')],'pass':_0x137717[_0x3020('0x23')][_0x3020('0x2a')]};}var _0x1150f6={'account':_0xb8719,'message':_['merge']({'from':util[_0x3020('0x2b')](_0x3020('0x2c'),_0x137717[_0x3020('0xf')],_0x137717['email']||_0x137717[_0x3020('0x23')][_0x3020('0x14')])},_0x5f1f2d)};return client['request'](_0x3020('0x2d'),_0x1150f6);})['then'](function(_0x47875c){if(_0x47875c[_0x3020('0x2e')]){throw new Error(util[_0x3020('0x2b')](_0x3020('0x2f'),_0x47875c[_0x3020('0x2e')][_0x3020('0x30')]||JSON[_0x3020('0x31')](_0x47875c[_0x3020('0x2e')])));}return!![];});}function handleError(_0x3be69f,_0xcff491,_0x29d9fd){return _0x3be69f[_0x3020('0x32')](_0xcff491||0x1f4)['send']({'message':_0x29d9fd?_0x29d9fd[_0x3020('0x30')]||_0x29d9fd:''});}exports[_0x3020('0x33')]=function(_0x6e9ecf,_0xdb15fd,_0x4077b4){passport[_0x3020('0x17')](_0x3020('0x34'),function(_0x16d309,_0x26b500,_0x14a54b){var _0x515ed5=_0x16d309||_0x14a54b;if(_0x515ed5){return handleError(_0xdb15fd,0x191,_0x515ed5);}if(!_0x26b500){return handleError(_0xdb15fd,0x194,{'message':_0x3020('0x35')});}else{var _0x3c50d7={'payload':{'id':_0x26b500['id'],'role':_0x26b500[_0x3020('0x36')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3c50d7)[_0x3020('0xe')](function(_0x5d3950){_0xdb15fd[_0x3020('0x37')]({'id':_0x26b500['id'],'token':_0x5d3950,'statusCall':'','isAlreadyLogged':_0x26b500['online']});});}})(_0x6e9ecf,_0xdb15fd,_0x4077b4);};exports['forgot']=function(_0x4178dc,_0x202403,_0x3fef1c){if(!_0x4178dc[_0x3020('0x38')][_0x3020('0x22')]){return handleError(_0x202403,0x1f4,{'message':_0x3020('0x39')});}var _0x586a5f=rs[_0x3020('0x3a')]();_0x4178dc[_0x3020('0x38')]['email']=_0x4178dc[_0x3020('0x38')]['email']['trim']()[_0x3020('0x3b')]();var _0xe8e9f1;return db[_0x3020('0xb')][_0x3020('0x3c')]({'where':{'id':0x1},'attributes':[_0x3020('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x32d9e9){_0xe8e9f1=_0x32d9e9;return db[_0x3020('0x3d')]['find']({'where':{'email':_0x4178dc[_0x3020('0x38')][_0x3020('0x22')]}});})[_0x3020('0xe')](function(_0x3351c0){if(!_0x3351c0){throw new Error(_0x3020('0x3e'));}if(_0x3351c0[_0x3020('0x19')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3351c0[_0x3020('0x12')]){if(moment(_0x3351c0[_0x3020('0x1a')])[_0x3020('0x1b')](_0xe8e9f1[_0x3020('0xd')],_0x3020('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3351c0[_0x3020('0x12')]=![];_0x3351c0['blockedAt']=null;}}_0x3351c0[_0x3020('0x3f')]=_0x586a5f;_0x3351c0[_0x3020('0x40')]=Date['now']()+0x36ee80;return _0x3351c0[_0x3020('0x41')]();})[_0x3020('0xe')](function(){return sendServiceMail({'to':_0x4178dc[_0x3020('0x38')][_0x3020('0x22')],'subject':_0x3020('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x3020('0x43')+'https://'+_0x4178dc['headers'][_0x3020('0x26')]+_0x3020('0x44')+_0x586a5f+'\x0a\x0a'+_0x3020('0x45')});})[_0x3020('0xe')](function(){_0x202403[_0x3020('0x32')](0xc8)[_0x3020('0x46')]({'message':_0x3020('0x47')});})[_0x3020('0x1f')](function(_0x4a740f){return handleError(_0x202403,0x1f4,_0x4a740f);});};exports[_0x3020('0x48')]=function(_0x23fcff,_0x5ba210,_0x558e8a){return db[_0x3020('0x3d')][_0x3020('0x21')]({'where':{'resetPasswordToken':_0x23fcff[_0x3020('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0x3020('0x4a')]()}}})['then'](function(_0x4fdc74){if(!_0x4fdc74){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x3020('0x3c')]({'attributes':['id','securePassword',_0x3020('0x4b'),_0x3020('0x4c')]})['then'](function(_0x55dd9){if(_0x55dd9[_0x3020('0x4d')])authService[_0x3020('0x4e')](_0x23fcff[_0x3020('0x38')][_0x3020('0x10')]);if(!_0x55dd9[_0x3020('0x4b')]||!_0x4fdc74['previousPasswords'])return _0x4fdc74;authService[_0x3020('0x4f')](_0x23fcff[_0x3020('0x38')]['password'],_0x4fdc74[_0x3020('0x50')],_0x55dd9[_0x3020('0x4c')]);return _0x4fdc74;})['then'](function(){_0x4fdc74[_0x3020('0x10')]=_0x23fcff[_0x3020('0x38')]['password'];_0x4fdc74[_0x3020('0x3f')]=null;_0x4fdc74[_0x3020('0x40')]=null;return _0x4fdc74[_0x3020('0x41')]();});})[_0x3020('0xe')](function(){_0x5ba210['status'](0xc8)['send']({'message':_0x3020('0x51')});})[_0x3020('0x1f')](function(_0xe205d2){return handleError(_0x5ba210,0x1f4,_0xe205d2);});};passport[_0x3020('0x52')](new LocalStrategy({'usernameField':_0x3020('0xf'),'passwordField':_0x3020('0x10')},function(_0x51b42a,_0x5270db,_0x461fac){return localAuthenticate(db['User'],_0x51b42a,_0x5270db,_0x461fac);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 82a415b..5a26d37 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 _0x2021=['exports','express','Router','./authLocal.controller','post','login','/forgot','reset'];(function(_0x3f6443,_0x2ffcf5){var _0x1210c9=function(_0x8a4f01){while(--_0x8a4f01){_0x3f6443['push'](_0x3f6443['shift']());}};_0x1210c9(++_0x2ffcf5);}(_0x2021,0x189));var _0x1202=function(_0x2c7e54,_0x232d24){_0x2c7e54=_0x2c7e54-0x0;var _0x65006=_0x2021[_0x2c7e54];return _0x65006;};'use strict';var express=require(_0x1202('0x0'));var router=express[_0x1202('0x1')]();var controller=require(_0x1202('0x2'));router[_0x1202('0x3')]('/',controller[_0x1202('0x4')]);router['post'](_0x1202('0x5'),controller['forgot']);router['post']('/reset/:token',controller[_0x1202('0x6')]);module[_0x1202('0x7')]=router; \ No newline at end of file +var _0x3f29=['post','/forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x3d6d8e,_0x554695){var _0x568be6=function(_0x3ebadf){while(--_0x3ebadf){_0x3d6d8e['push'](_0x3d6d8e['shift']());}};_0x568be6(++_0x554695);}(_0x3f29,0x1ed));var _0x93f2=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3f29[_0xbb091];return _0x467a04;};'use strict';var express=require(_0x93f2('0x0'));var router=express[_0x93f2('0x1')]();var controller=require(_0x93f2('0x2'));router[_0x93f2('0x3')]('/',controller['login']);router[_0x93f2('0x3')](_0x93f2('0x4'),controller['forgot']);router['post'](_0x93f2('0x5'),controller[_0x93f2('0x6')]);module[_0x93f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index a637dde..f26154b 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 _0x47d8=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x1a340f,_0x4b9893){var _0xbcb1c0=function(_0x181be6){while(--_0x181be6){_0x1a340f['push'](_0x1a340f['shift']());}};_0xbcb1c0(++_0x4b9893);}(_0x47d8,0x146));var _0x847d=function(_0x20814e,_0x1724e3){_0x20814e=_0x20814e-0x0;var _0x4c7004=_0x47d8[_0x20814e];return _0x4c7004;};'use strict';var Sequelize=require(_0x847d('0x0'));module[_0x847d('0x1')]={'name':{'type':Sequelize[_0x847d('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x847d('0x2')]},'status':{'type':Sequelize[_0x847d('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x847d('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0812=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x3bb6e7,_0xf762d3){var _0x692c41=function(_0x3fabbf){while(--_0x3fabbf){_0x3bb6e7['push'](_0x3bb6e7['shift']());}};_0x692c41(++_0xf762d3);}(_0x0812,0x106));var _0x2081=function(_0x360e65,_0x6dcd38){_0x360e65=_0x360e65-0x0;var _0x523758=_0x0812[_0x360e65];return _0x523758;};'use strict';var Sequelize=require(_0x2081('0x0'));module[_0x2081('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x2081('0x2')]},'description':{'type':Sequelize[_0x2081('0x2')]},'status':{'type':Sequelize[_0x2081('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2081('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 24fe4a7..cadd082 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 _0x9e84=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','Automation','findAll','rows','catch','show','params','length','find','create','body','addConditions','Condition','omit','ids','getConditions','order','options','Action','addActions','getActions','findOne','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e84,0x100));var _0x49e8=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x9e84[_0x52f1e6];return _0x21f104;};'use strict';var emlformat=require(_0x49e8('0x0'));var rimraf=require(_0x49e8('0x1'));var zipdir=require(_0x49e8('0x2'));var jsonpatch=require(_0x49e8('0x3'));var rp=require('request-promise');var moment=require(_0x49e8('0x4'));var BPromise=require(_0x49e8('0x5'));var Mustache=require(_0x49e8('0x6'));var util=require(_0x49e8('0x7'));var path=require(_0x49e8('0x8'));var sox=require(_0x49e8('0x9'));var csv=require(_0x49e8('0xa'));var ejs=require(_0x49e8('0xb'));var fs=require('fs');var fs_extra=require(_0x49e8('0xc'));var _=require(_0x49e8('0xd'));var squel=require(_0x49e8('0xe'));var crypto=require('crypto');var jsforce=require(_0x49e8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x49e8('0xa'));var querystring=require(_0x49e8('0x10'));var Papa=require('papaparse');var Redis=require(_0x49e8('0x11'));var authService=require(_0x49e8('0x12'));var qs=require(_0x49e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49e8('0x14'));var logger=require(_0x49e8('0x15'))(_0x49e8('0x16'));var utils=require(_0x49e8('0x17'));var config=require(_0x49e8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x49e8('0x19'))['db'];function respondWithStatusCode(_0x1c999e,_0x23b263){_0x23b263=_0x23b263||0xcc;return function(_0x121a70){if(_0x121a70){return _0x1c999e[_0x49e8('0x1a')](_0x23b263);}return _0x1c999e[_0x49e8('0x1b')](_0x23b263)[_0x49e8('0x1c')]();};}function respondWithResult(_0x357c06,_0x47c442){_0x47c442=_0x47c442||0xc8;return function(_0x571f46){if(_0x571f46){return _0x357c06['status'](_0x47c442)['json'](_0x571f46);}};}function respondWithFilteredResult(_0x2c7be2,_0x1157d4){return function(_0x18b28f){if(_0x18b28f){var _0x1c8295=typeof _0x1157d4['offset']===_0x49e8('0x1d')&&typeof _0x1157d4['limit']===_0x49e8('0x1d');var _0x1a4159=_0x18b28f[_0x49e8('0x1e')];var _0x467290=_0x1c8295?0x0:_0x1157d4[_0x49e8('0x1f')];var _0x4c3078=_0x1c8295?_0x18b28f['count']:_0x1157d4[_0x49e8('0x1f')]+_0x1157d4[_0x49e8('0x20')];var _0x10d679;if(_0x4c3078>=_0x1a4159){_0x4c3078=_0x1a4159;_0x10d679=0xc8;}else{_0x10d679=0xce;}_0x2c7be2[_0x49e8('0x1b')](_0x10d679);return _0x2c7be2[_0x49e8('0x21')](_0x49e8('0x22'),_0x467290+'-'+_0x4c3078+'/'+_0x1a4159)['json'](_0x18b28f);}return null;};}function patchUpdates(_0x5bcd4b){return function(_0x39f680){try{jsonpatch[_0x49e8('0x23')](_0x39f680,_0x5bcd4b,!![]);}catch(_0x574c0b){return BPromise['reject'](_0x574c0b);}return _0x39f680[_0x49e8('0x24')]();};}function saveUpdates(_0x1db5b1,_0x3cd28b){return function(_0x5dc2c4){if(_0x5dc2c4){return _0x5dc2c4[_0x49e8('0x25')](_0x1db5b1)[_0x49e8('0x26')](function(_0x147050){return _0x147050;});}return null;};}function removeEntity(_0x2650f1,_0x10bfb9){return function(_0x17e798){if(_0x17e798){return _0x17e798[_0x49e8('0x27')]()[_0x49e8('0x26')](function(){_0x2650f1[_0x49e8('0x1b')](0xcc)[_0x49e8('0x1c')]();});}};}function handleEntityNotFound(_0x54a9fc,_0x902911){return function(_0x281c09){if(!_0x281c09){_0x54a9fc[_0x49e8('0x1a')](0x194);}return _0x281c09;};}function handleError(_0x183f82,_0x25f3b3){_0x25f3b3=_0x25f3b3||0x1f4;return function(_0x103d7b){logger[_0x49e8('0x28')](_0x103d7b['stack']);if(_0x103d7b[_0x49e8('0x29')]){delete _0x103d7b['name'];}_0x183f82['status'](_0x25f3b3)[_0x49e8('0x2a')](_0x103d7b);};}exports[_0x49e8('0x2b')]=function(_0x5ef147,_0xc4d2f0){var _0x114904={},_0x2aa346={},_0xeb6fcf={'count':0x0,'rows':[]};var _0x4d0237=_['map'](db['Automation'][_0x49e8('0x2c')],function(_0x490163){return{'name':_0x490163[_0x49e8('0x2d')],'type':_0x490163['type'][_0x49e8('0x2e')]};});_0x2aa346[_0x49e8('0x2f')]=_[_0x49e8('0x30')](_0x4d0237,_0x49e8('0x29'));_0x2aa346['query']=_[_0x49e8('0x31')](_0x5ef147[_0x49e8('0x32')]);_0x2aa346[_0x49e8('0x33')]=_[_0x49e8('0x34')](_0x2aa346[_0x49e8('0x2f')],_0x2aa346['query']);_0x114904['attributes']=_[_0x49e8('0x34')](_0x2aa346[_0x49e8('0x2f')],qs[_0x49e8('0x35')](_0x5ef147[_0x49e8('0x32')]['fields']));_0x114904['attributes']=_0x114904['attributes']['length']?_0x114904[_0x49e8('0x36')]:_0x2aa346[_0x49e8('0x2f')];if(!_0x5ef147[_0x49e8('0x32')][_0x49e8('0x37')](_0x49e8('0x38'))){_0x114904[_0x49e8('0x20')]=qs[_0x49e8('0x20')](_0x5ef147[_0x49e8('0x32')][_0x49e8('0x20')]);_0x114904[_0x49e8('0x1f')]=qs[_0x49e8('0x1f')](_0x5ef147[_0x49e8('0x32')][_0x49e8('0x1f')]);}_0x114904['order']=qs[_0x49e8('0x39')](_0x5ef147[_0x49e8('0x32')][_0x49e8('0x39')]);_0x114904[_0x49e8('0x3a')]=qs['filters'](_[_0x49e8('0x3b')](_0x5ef147['query'],_0x2aa346['filters']),_0x4d0237);if(_0x5ef147[_0x49e8('0x32')][_0x49e8('0x3c')]){_0x114904[_0x49e8('0x3a')]=_[_0x49e8('0x3d')](_0x114904[_0x49e8('0x3a')],{'$or':_['map'](_0x4d0237,function(_0x2b2e20){if(_0x2b2e20[_0x49e8('0x3e')]!==_0x49e8('0x3f')){var _0x35cb5a={};_0x35cb5a[_0x2b2e20[_0x49e8('0x29')]]={'$like':'%'+_0x5ef147[_0x49e8('0x32')]['filter']+'%'};return _0x35cb5a;}})});}_0x114904=_[_0x49e8('0x3d')]({},_0x114904,_0x5ef147['options']);var _0x12ec72={'where':_0x114904[_0x49e8('0x3a')]};return db['Automation']['count'](_0x12ec72)[_0x49e8('0x26')](function(_0x165df8){_0xeb6fcf['count']=_0x165df8;if(_0x5ef147[_0x49e8('0x32')][_0x49e8('0x40')]){_0x114904['include']=[{'all':!![]}];}return db[_0x49e8('0x41')][_0x49e8('0x42')](_0x114904);})[_0x49e8('0x26')](function(_0x2a4ea8){_0xeb6fcf[_0x49e8('0x43')]=_0x2a4ea8;return _0xeb6fcf;})[_0x49e8('0x26')](respondWithFilteredResult(_0xc4d2f0,_0x114904))[_0x49e8('0x44')](handleError(_0xc4d2f0,null));};exports[_0x49e8('0x45')]=function(_0x4b749d,_0x332504){var _0x293c1d={'raw':![],'where':{'id':_0x4b749d[_0x49e8('0x46')]['id']}},_0x2a769e={};_0x2a769e['model']=_[_0x49e8('0x31')](db[_0x49e8('0x41')][_0x49e8('0x2c')]);_0x2a769e[_0x49e8('0x32')]=_['keys'](_0x4b749d['query']);_0x2a769e[_0x49e8('0x33')]=_['intersection'](_0x2a769e[_0x49e8('0x2f')],_0x2a769e[_0x49e8('0x32')]);_0x293c1d[_0x49e8('0x36')]=_[_0x49e8('0x34')](_0x2a769e[_0x49e8('0x2f')],qs['fields'](_0x4b749d[_0x49e8('0x32')]['fields']));_0x293c1d[_0x49e8('0x36')]=_0x293c1d[_0x49e8('0x36')][_0x49e8('0x47')]?_0x293c1d[_0x49e8('0x36')]:_0x2a769e[_0x49e8('0x2f')];if(_0x4b749d[_0x49e8('0x32')][_0x49e8('0x40')]){_0x293c1d['include']=[{'all':!![]}];}_0x293c1d=_[_0x49e8('0x3d')]({},_0x293c1d,_0x4b749d['options']);return db['Automation'][_0x49e8('0x48')](_0x293c1d)[_0x49e8('0x26')](handleEntityNotFound(_0x332504,null))[_0x49e8('0x26')](respondWithResult(_0x332504,null))['catch'](handleError(_0x332504,null));};exports[_0x49e8('0x49')]=function(_0x2d8995,_0x2cee30){return db[_0x49e8('0x41')][_0x49e8('0x49')](_0x2d8995['body'],{})['then'](respondWithResult(_0x2cee30,0xc9))[_0x49e8('0x44')](handleError(_0x2cee30,null));};exports[_0x49e8('0x25')]=function(_0x5cdab4,_0x3cd3e7){if(_0x5cdab4[_0x49e8('0x4a')]['id']){delete _0x5cdab4['body']['id'];}return db[_0x49e8('0x41')][_0x49e8('0x48')]({'where':{'id':_0x5cdab4['params']['id']}})[_0x49e8('0x26')](handleEntityNotFound(_0x3cd3e7,null))[_0x49e8('0x26')](saveUpdates(_0x5cdab4['body'],null))[_0x49e8('0x26')](respondWithResult(_0x3cd3e7,null))[_0x49e8('0x44')](handleError(_0x3cd3e7,null));};exports[_0x49e8('0x27')]=function(_0x4d985d,_0x1e8420){return db[_0x49e8('0x41')]['find']({'where':{'id':_0x4d985d['params']['id']}})[_0x49e8('0x26')](handleEntityNotFound(_0x1e8420,null))[_0x49e8('0x26')](removeEntity(_0x1e8420,null))['catch'](handleError(_0x1e8420,null));};exports[_0x49e8('0x4b')]=function(_0x4bd9a6,_0x264f67,_0x324f12){return db[_0x49e8('0x4c')][_0x49e8('0x48')]({'where':{'id':_0x4bd9a6[_0x49e8('0x46')]['id']}})[_0x49e8('0x26')](handleEntityNotFound(_0x264f67,null))[_0x49e8('0x26')](function(_0x506e03){if(_0x506e03){return _0x506e03[_0x49e8('0x4b')](_0x4bd9a6[_0x49e8('0x4a')]['ids'],_[_0x49e8('0x4d')](_0x4bd9a6[_0x49e8('0x4a')],[_0x49e8('0x4e'),'id'])||{});}})[_0x49e8('0x26')](respondWithResult(_0x264f67,null))[_0x49e8('0x44')](handleError(_0x264f67,null));};exports[_0x49e8('0x4f')]=function(_0x19d9b5,_0x4408a0,_0x5f53e6){var _0x47ddef={};var _0x3a7cf3={};var _0x1e924c;var _0xe04747;return db['Automation']['findOne']({'where':{'id':_0x19d9b5[_0x49e8('0x46')]['id']}})['then'](handleEntityNotFound(_0x4408a0,null))[_0x49e8('0x26')](function(_0x1ecfec){if(_0x1ecfec){_0x1e924c=_0x1ecfec;_0x3a7cf3[_0x49e8('0x2f')]=_[_0x49e8('0x31')](db['Condition'][_0x49e8('0x2c')]);_0x3a7cf3[_0x49e8('0x32')]=_['keys'](_0x19d9b5[_0x49e8('0x32')]);_0x3a7cf3[_0x49e8('0x33')]=_[_0x49e8('0x34')](_0x3a7cf3[_0x49e8('0x2f')],_0x3a7cf3[_0x49e8('0x32')]);_0x47ddef[_0x49e8('0x36')]=_['intersection'](_0x3a7cf3[_0x49e8('0x2f')],qs[_0x49e8('0x35')](_0x19d9b5['query'][_0x49e8('0x35')]));_0x47ddef['attributes']=_0x47ddef[_0x49e8('0x36')]['length']?_0x47ddef['attributes']:_0x3a7cf3[_0x49e8('0x2f')];_0x47ddef[_0x49e8('0x50')]=qs[_0x49e8('0x39')](_0x19d9b5[_0x49e8('0x32')][_0x49e8('0x39')]);_0x47ddef[_0x49e8('0x3a')]=qs['filters'](_['pick'](_0x19d9b5[_0x49e8('0x32')],_0x3a7cf3[_0x49e8('0x33')]));if(_0x19d9b5[_0x49e8('0x32')][_0x49e8('0x3c')]){_0x47ddef[_0x49e8('0x3a')]=_['merge'](_0x47ddef[_0x49e8('0x3a')],{'$or':_[_0x49e8('0x30')](_0x47ddef[_0x49e8('0x36')],function(_0x4c9683){var _0x2db6f9={};_0x2db6f9[_0x4c9683]={'$like':'%'+_0x19d9b5[_0x49e8('0x32')]['filter']+'%'};return _0x2db6f9;})});}_0x47ddef=_[_0x49e8('0x3d')]({},_0x47ddef,_0x19d9b5[_0x49e8('0x51')]);return _0x1e924c[_0x49e8('0x4f')](_0x47ddef);}})[_0x49e8('0x26')](function(_0x1fab57){if(_0x1fab57){_0xe04747=_0x1fab57[_0x49e8('0x47')];if(!_0x19d9b5[_0x49e8('0x32')][_0x49e8('0x37')](_0x49e8('0x38'))){_0x47ddef[_0x49e8('0x20')]=qs[_0x49e8('0x20')](_0x19d9b5[_0x49e8('0x32')][_0x49e8('0x20')]);_0x47ddef[_0x49e8('0x1f')]=qs[_0x49e8('0x1f')](_0x19d9b5[_0x49e8('0x32')][_0x49e8('0x1f')]);}return _0x1e924c['getConditions'](_0x47ddef);}})[_0x49e8('0x26')](function(_0x313fca){if(_0x313fca){return _0x313fca?{'count':_0xe04747,'rows':_0x313fca}:null;}})['then'](respondWithResult(_0x4408a0,null))[_0x49e8('0x44')](handleError(_0x4408a0,null));};exports['addActions']=function(_0x1aa0ec,_0x2581df,_0x21e526){return db[_0x49e8('0x52')][_0x49e8('0x48')]({'where':{'id':_0x1aa0ec['params']['id']}})[_0x49e8('0x26')](handleEntityNotFound(_0x2581df,null))['then'](function(_0x421019){if(_0x421019){return _0x421019[_0x49e8('0x53')](_0x1aa0ec[_0x49e8('0x4a')]['ids'],_[_0x49e8('0x4d')](_0x1aa0ec[_0x49e8('0x4a')],[_0x49e8('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x2581df,null))[_0x49e8('0x44')](handleError(_0x2581df,null));};exports[_0x49e8('0x54')]=function(_0x19a3d9,_0xffb1bd,_0x4f5dae){var _0xcf922f={};var _0x4e83d1={};var _0x38fa5b;var _0x1f3613;return db[_0x49e8('0x41')][_0x49e8('0x55')]({'where':{'id':_0x19a3d9[_0x49e8('0x46')]['id']}})[_0x49e8('0x26')](handleEntityNotFound(_0xffb1bd,null))[_0x49e8('0x26')](function(_0x5f1724){if(_0x5f1724){_0x38fa5b=_0x5f1724;_0x4e83d1['model']=_['keys'](db[_0x49e8('0x52')]['rawAttributes']);_0x4e83d1[_0x49e8('0x32')]=_[_0x49e8('0x31')](_0x19a3d9[_0x49e8('0x32')]);_0x4e83d1[_0x49e8('0x33')]=_[_0x49e8('0x34')](_0x4e83d1[_0x49e8('0x2f')],_0x4e83d1[_0x49e8('0x32')]);_0xcf922f[_0x49e8('0x36')]=_[_0x49e8('0x34')](_0x4e83d1[_0x49e8('0x2f')],qs['fields'](_0x19a3d9[_0x49e8('0x32')][_0x49e8('0x35')]));_0xcf922f[_0x49e8('0x36')]=_0xcf922f[_0x49e8('0x36')][_0x49e8('0x47')]?_0xcf922f[_0x49e8('0x36')]:_0x4e83d1[_0x49e8('0x2f')];_0xcf922f['order']=qs[_0x49e8('0x39')](_0x19a3d9[_0x49e8('0x32')][_0x49e8('0x39')]);_0xcf922f[_0x49e8('0x3a')]=qs[_0x49e8('0x33')](_[_0x49e8('0x3b')](_0x19a3d9[_0x49e8('0x32')],_0x4e83d1['filters']));if(_0x19a3d9[_0x49e8('0x32')]['filter']){_0xcf922f[_0x49e8('0x3a')]=_[_0x49e8('0x3d')](_0xcf922f[_0x49e8('0x3a')],{'$or':_[_0x49e8('0x30')](_0xcf922f[_0x49e8('0x36')],function(_0xfba7a4){var _0x52e789={};_0x52e789[_0xfba7a4]={'$like':'%'+_0x19a3d9[_0x49e8('0x32')][_0x49e8('0x3c')]+'%'};return _0x52e789;})});}_0xcf922f=_[_0x49e8('0x3d')]({},_0xcf922f,_0x19a3d9['options']);return _0x38fa5b[_0x49e8('0x54')](_0xcf922f);}})['then'](function(_0x7cfc96){if(_0x7cfc96){_0x1f3613=_0x7cfc96[_0x49e8('0x47')];if(!_0x19a3d9[_0x49e8('0x32')][_0x49e8('0x37')](_0x49e8('0x38'))){_0xcf922f[_0x49e8('0x20')]=qs['limit'](_0x19a3d9[_0x49e8('0x32')][_0x49e8('0x20')]);_0xcf922f[_0x49e8('0x1f')]=qs[_0x49e8('0x1f')](_0x19a3d9[_0x49e8('0x32')][_0x49e8('0x1f')]);}return _0x38fa5b[_0x49e8('0x54')](_0xcf922f);}})[_0x49e8('0x26')](function(_0x252056){if(_0x252056){return _0x252056?{'count':_0x1f3613,'rows':_0x252056}:null;}})[_0x49e8('0x26')](respondWithResult(_0xffb1bd,null))[_0x49e8('0x44')](handleError(_0xffb1bd,null));}; \ No newline at end of file +var _0xd803=['type','options','Automation','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x4a80de,_0x5286e3){var _0x19c3a9=function(_0x3134f5){while(--_0x3134f5){_0x4a80de['push'](_0x4a80de['shift']());}};_0x19c3a9(++_0x5286e3);}(_0xd803,0x162));var _0x3d80=function(_0x219bde,_0x157d97){_0x219bde=_0x219bde-0x0;var _0x38aa0=_0xd803[_0x219bde];return _0x38aa0;};'use strict';var emlformat=require(_0x3d80('0x0'));var rimraf=require(_0x3d80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d80('0x2'));var rp=require(_0x3d80('0x3'));var moment=require(_0x3d80('0x4'));var BPromise=require(_0x3d80('0x5'));var Mustache=require(_0x3d80('0x6'));var util=require(_0x3d80('0x7'));var path=require(_0x3d80('0x8'));var sox=require(_0x3d80('0x9'));var csv=require(_0x3d80('0xa'));var ejs=require(_0x3d80('0xb'));var fs=require('fs');var fs_extra=require(_0x3d80('0xc'));var _=require(_0x3d80('0xd'));var squel=require(_0x3d80('0xe'));var crypto=require(_0x3d80('0xf'));var jsforce=require(_0x3d80('0x10'));var deskjs=require(_0x3d80('0x11'));var toCsv=require(_0x3d80('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3d80('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3d80('0x13'));var as=require(_0x3d80('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d80('0x15'));var utils=require(_0x3d80('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d80('0x17'))['db'];function respondWithStatusCode(_0x59acdf,_0x1e43a3){_0x1e43a3=_0x1e43a3||0xcc;return function(_0x51e549){if(_0x51e549){return _0x59acdf[_0x3d80('0x18')](_0x1e43a3);}return _0x59acdf[_0x3d80('0x19')](_0x1e43a3)['end']();};}function respondWithResult(_0x2d7d45,_0x48b502){_0x48b502=_0x48b502||0xc8;return function(_0x7b19ee){if(_0x7b19ee){return _0x2d7d45[_0x3d80('0x19')](_0x48b502)[_0x3d80('0x1a')](_0x7b19ee);}};}function respondWithFilteredResult(_0x3b858b,_0x563a9b){return function(_0x51d989){if(_0x51d989){var _0x2af523=typeof _0x563a9b[_0x3d80('0x1b')]===_0x3d80('0x1c')&&typeof _0x563a9b[_0x3d80('0x1d')]===_0x3d80('0x1c');var _0x348454=_0x51d989[_0x3d80('0x1e')];var _0x1b8440=_0x2af523?0x0:_0x563a9b[_0x3d80('0x1b')];var _0x189f64=_0x2af523?_0x51d989[_0x3d80('0x1e')]:_0x563a9b[_0x3d80('0x1b')]+_0x563a9b[_0x3d80('0x1d')];var _0x4a40ec;if(_0x189f64>=_0x348454){_0x189f64=_0x348454;_0x4a40ec=0xc8;}else{_0x4a40ec=0xce;}_0x3b858b['status'](_0x4a40ec);return _0x3b858b[_0x3d80('0x1f')](_0x3d80('0x20'),_0x1b8440+'-'+_0x189f64+'/'+_0x348454)[_0x3d80('0x1a')](_0x51d989);}return null;};}function patchUpdates(_0x288962){return function(_0x2d484a){try{jsonpatch['apply'](_0x2d484a,_0x288962,!![]);}catch(_0x2a597d){return BPromise[_0x3d80('0x21')](_0x2a597d);}return _0x2d484a['save']();};}function saveUpdates(_0x598013,_0x2e1e04){return function(_0x1f0e96){if(_0x1f0e96){return _0x1f0e96[_0x3d80('0x22')](_0x598013)[_0x3d80('0x23')](function(_0x127d24){return _0x127d24;});}return null;};}function removeEntity(_0x41f08e,_0x890e6b){return function(_0x24452f){if(_0x24452f){return _0x24452f[_0x3d80('0x24')]()[_0x3d80('0x23')](function(){_0x41f08e[_0x3d80('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf2cead,_0x20d004){return function(_0x500a40){if(!_0x500a40){_0xf2cead[_0x3d80('0x18')](0x194);}return _0x500a40;};}function handleError(_0x6319ae,_0x4c1eff){_0x4c1eff=_0x4c1eff||0x1f4;return function(_0x407a48){logger[_0x3d80('0x25')](_0x407a48[_0x3d80('0x26')]);if(_0x407a48['name']){delete _0x407a48[_0x3d80('0x27')];}_0x6319ae[_0x3d80('0x19')](_0x4c1eff)['send'](_0x407a48);};}exports[_0x3d80('0x28')]=function(_0x34be71,_0x18b62d){var _0x308e7a={},_0x45cae3={},_0x46423f={'count':0x0,'rows':[]};var _0x3b38c5=_[_0x3d80('0x29')](db['Automation'][_0x3d80('0x2a')],function(_0x37bc08){return{'name':_0x37bc08[_0x3d80('0x2b')],'type':_0x37bc08['type'][_0x3d80('0x2c')]};});_0x45cae3[_0x3d80('0x2d')]=_[_0x3d80('0x29')](_0x3b38c5,_0x3d80('0x27'));_0x45cae3[_0x3d80('0x2e')]=_[_0x3d80('0x2f')](_0x34be71[_0x3d80('0x2e')]);_0x45cae3[_0x3d80('0x30')]=_[_0x3d80('0x31')](_0x45cae3[_0x3d80('0x2d')],_0x45cae3[_0x3d80('0x2e')]);_0x308e7a[_0x3d80('0x32')]=_[_0x3d80('0x31')](_0x45cae3[_0x3d80('0x2d')],qs[_0x3d80('0x33')](_0x34be71[_0x3d80('0x2e')]['fields']));_0x308e7a[_0x3d80('0x32')]=_0x308e7a[_0x3d80('0x32')][_0x3d80('0x34')]?_0x308e7a[_0x3d80('0x32')]:_0x45cae3[_0x3d80('0x2d')];if(!_0x34be71[_0x3d80('0x2e')][_0x3d80('0x35')](_0x3d80('0x36'))){_0x308e7a[_0x3d80('0x1d')]=qs[_0x3d80('0x1d')](_0x34be71[_0x3d80('0x2e')][_0x3d80('0x1d')]);_0x308e7a[_0x3d80('0x1b')]=qs['offset'](_0x34be71['query']['offset']);}_0x308e7a[_0x3d80('0x37')]=qs[_0x3d80('0x38')](_0x34be71[_0x3d80('0x2e')][_0x3d80('0x38')]);_0x308e7a['where']=qs['filters'](_[_0x3d80('0x39')](_0x34be71['query'],_0x45cae3[_0x3d80('0x30')]),_0x3b38c5);if(_0x34be71[_0x3d80('0x2e')][_0x3d80('0x3a')]){_0x308e7a[_0x3d80('0x3b')]=_[_0x3d80('0x3c')](_0x308e7a['where'],{'$or':_[_0x3d80('0x29')](_0x3b38c5,function(_0x571dd3){if(_0x571dd3[_0x3d80('0x3d')]!=='VIRTUAL'){var _0x1a554b={};_0x1a554b[_0x571dd3[_0x3d80('0x27')]]={'$like':'%'+_0x34be71[_0x3d80('0x2e')][_0x3d80('0x3a')]+'%'};return _0x1a554b;}})});}_0x308e7a=_[_0x3d80('0x3c')]({},_0x308e7a,_0x34be71[_0x3d80('0x3e')]);var _0x102b8b={'where':_0x308e7a['where']};return db[_0x3d80('0x3f')][_0x3d80('0x1e')](_0x102b8b)['then'](function(_0x157444){_0x46423f[_0x3d80('0x1e')]=_0x157444;if(_0x34be71[_0x3d80('0x2e')][_0x3d80('0x40')]){_0x308e7a[_0x3d80('0x41')]=[{'all':!![]}];}return db[_0x3d80('0x3f')][_0x3d80('0x42')](_0x308e7a);})['then'](function(_0x92135){_0x46423f[_0x3d80('0x43')]=_0x92135;return _0x46423f;})[_0x3d80('0x23')](respondWithFilteredResult(_0x18b62d,_0x308e7a))[_0x3d80('0x44')](handleError(_0x18b62d,null));};exports[_0x3d80('0x45')]=function(_0x303724,_0x4d28a0){var _0x32c315={'raw':![],'where':{'id':_0x303724[_0x3d80('0x46')]['id']}},_0x29ea5d={};_0x29ea5d[_0x3d80('0x2d')]=_[_0x3d80('0x2f')](db[_0x3d80('0x3f')]['rawAttributes']);_0x29ea5d[_0x3d80('0x2e')]=_[_0x3d80('0x2f')](_0x303724[_0x3d80('0x2e')]);_0x29ea5d[_0x3d80('0x30')]=_[_0x3d80('0x31')](_0x29ea5d[_0x3d80('0x2d')],_0x29ea5d[_0x3d80('0x2e')]);_0x32c315['attributes']=_[_0x3d80('0x31')](_0x29ea5d[_0x3d80('0x2d')],qs[_0x3d80('0x33')](_0x303724[_0x3d80('0x2e')][_0x3d80('0x33')]));_0x32c315['attributes']=_0x32c315[_0x3d80('0x32')][_0x3d80('0x34')]?_0x32c315['attributes']:_0x29ea5d[_0x3d80('0x2d')];if(_0x303724['query'][_0x3d80('0x40')]){_0x32c315[_0x3d80('0x41')]=[{'all':!![]}];}_0x32c315=_['merge']({},_0x32c315,_0x303724[_0x3d80('0x3e')]);return db['Automation'][_0x3d80('0x47')](_0x32c315)[_0x3d80('0x23')](handleEntityNotFound(_0x4d28a0,null))[_0x3d80('0x23')](respondWithResult(_0x4d28a0,null))[_0x3d80('0x44')](handleError(_0x4d28a0,null));};exports[_0x3d80('0x48')]=function(_0x2b4ea2,_0x5013c7){return db['Automation'][_0x3d80('0x48')](_0x2b4ea2['body'],{})[_0x3d80('0x23')](respondWithResult(_0x5013c7,0xc9))[_0x3d80('0x44')](handleError(_0x5013c7,null));};exports['update']=function(_0x54869e,_0x4f4936){if(_0x54869e[_0x3d80('0x49')]['id']){delete _0x54869e[_0x3d80('0x49')]['id'];}return db[_0x3d80('0x3f')][_0x3d80('0x47')]({'where':{'id':_0x54869e['params']['id']}})[_0x3d80('0x23')](handleEntityNotFound(_0x4f4936,null))[_0x3d80('0x23')](saveUpdates(_0x54869e[_0x3d80('0x49')],null))[_0x3d80('0x23')](respondWithResult(_0x4f4936,null))['catch'](handleError(_0x4f4936,null));};exports[_0x3d80('0x24')]=function(_0x32832d,_0xb6bd9){return db[_0x3d80('0x3f')][_0x3d80('0x47')]({'where':{'id':_0x32832d['params']['id']}})[_0x3d80('0x23')](handleEntityNotFound(_0xb6bd9,null))[_0x3d80('0x23')](removeEntity(_0xb6bd9,null))[_0x3d80('0x44')](handleError(_0xb6bd9,null));};exports[_0x3d80('0x4a')]=function(_0x20bcb,_0x1c9a2a,_0x2cee65){return db[_0x3d80('0x4b')][_0x3d80('0x47')]({'where':{'id':_0x20bcb[_0x3d80('0x46')]['id']}})[_0x3d80('0x23')](handleEntityNotFound(_0x1c9a2a,null))[_0x3d80('0x23')](function(_0x3bcdae){if(_0x3bcdae){return _0x3bcdae[_0x3d80('0x4a')](_0x20bcb['body'][_0x3d80('0x4c')],_[_0x3d80('0x4d')](_0x20bcb['body'],[_0x3d80('0x4c'),'id'])||{});}})[_0x3d80('0x23')](respondWithResult(_0x1c9a2a,null))[_0x3d80('0x44')](handleError(_0x1c9a2a,null));};exports[_0x3d80('0x4e')]=function(_0x5507e4,_0x139c15,_0x55d45a){var _0x1004da={};var _0xb6d7a4={};var _0x2b570b;var _0x33ba6a;return db[_0x3d80('0x3f')][_0x3d80('0x4f')]({'where':{'id':_0x5507e4[_0x3d80('0x46')]['id']}})[_0x3d80('0x23')](handleEntityNotFound(_0x139c15,null))['then'](function(_0x5404bb){if(_0x5404bb){_0x2b570b=_0x5404bb;_0xb6d7a4['model']=_[_0x3d80('0x2f')](db[_0x3d80('0x4b')]['rawAttributes']);_0xb6d7a4[_0x3d80('0x2e')]=_[_0x3d80('0x2f')](_0x5507e4['query']);_0xb6d7a4[_0x3d80('0x30')]=_['intersection'](_0xb6d7a4['model'],_0xb6d7a4['query']);_0x1004da['attributes']=_['intersection'](_0xb6d7a4['model'],qs[_0x3d80('0x33')](_0x5507e4[_0x3d80('0x2e')][_0x3d80('0x33')]));_0x1004da[_0x3d80('0x32')]=_0x1004da['attributes'][_0x3d80('0x34')]?_0x1004da[_0x3d80('0x32')]:_0xb6d7a4[_0x3d80('0x2d')];_0x1004da[_0x3d80('0x37')]=qs[_0x3d80('0x38')](_0x5507e4['query'][_0x3d80('0x38')]);_0x1004da['where']=qs[_0x3d80('0x30')](_[_0x3d80('0x39')](_0x5507e4[_0x3d80('0x2e')],_0xb6d7a4[_0x3d80('0x30')]));if(_0x5507e4[_0x3d80('0x2e')][_0x3d80('0x3a')]){_0x1004da['where']=_[_0x3d80('0x3c')](_0x1004da[_0x3d80('0x3b')],{'$or':_[_0x3d80('0x29')](_0x1004da[_0x3d80('0x32')],function(_0x44dfa5){var _0x101cb8={};_0x101cb8[_0x44dfa5]={'$like':'%'+_0x5507e4['query'][_0x3d80('0x3a')]+'%'};return _0x101cb8;})});}_0x1004da=_[_0x3d80('0x3c')]({},_0x1004da,_0x5507e4[_0x3d80('0x3e')]);return _0x2b570b[_0x3d80('0x4e')](_0x1004da);}})[_0x3d80('0x23')](function(_0x57dc1f){if(_0x57dc1f){_0x33ba6a=_0x57dc1f[_0x3d80('0x34')];if(!_0x5507e4['query'][_0x3d80('0x35')](_0x3d80('0x36'))){_0x1004da[_0x3d80('0x1d')]=qs['limit'](_0x5507e4['query'][_0x3d80('0x1d')]);_0x1004da[_0x3d80('0x1b')]=qs[_0x3d80('0x1b')](_0x5507e4[_0x3d80('0x2e')][_0x3d80('0x1b')]);}return _0x2b570b[_0x3d80('0x4e')](_0x1004da);}})['then'](function(_0x5d4c53){if(_0x5d4c53){return _0x5d4c53?{'count':_0x33ba6a,'rows':_0x5d4c53}:null;}})[_0x3d80('0x23')](respondWithResult(_0x139c15,null))[_0x3d80('0x44')](handleError(_0x139c15,null));};exports[_0x3d80('0x50')]=function(_0x5b23b4,_0x9435ed,_0x528a96){return db[_0x3d80('0x51')][_0x3d80('0x47')]({'where':{'id':_0x5b23b4['params']['id']}})[_0x3d80('0x23')](handleEntityNotFound(_0x9435ed,null))[_0x3d80('0x23')](function(_0x584257){if(_0x584257){return _0x584257['addActions'](_0x5b23b4['body'][_0x3d80('0x4c')],_[_0x3d80('0x4d')](_0x5b23b4[_0x3d80('0x49')],[_0x3d80('0x4c'),'id'])||{});}})[_0x3d80('0x23')](respondWithResult(_0x9435ed,null))[_0x3d80('0x44')](handleError(_0x9435ed,null));};exports[_0x3d80('0x52')]=function(_0x4ae4ff,_0x17b9fb,_0x48552d){var _0x34a902={};var _0x237738={};var _0x950cd9;var _0x1a46fc;return db[_0x3d80('0x3f')][_0x3d80('0x4f')]({'where':{'id':_0x4ae4ff['params']['id']}})[_0x3d80('0x23')](handleEntityNotFound(_0x17b9fb,null))[_0x3d80('0x23')](function(_0x4b83f4){if(_0x4b83f4){_0x950cd9=_0x4b83f4;_0x237738['model']=_['keys'](db['Action'][_0x3d80('0x2a')]);_0x237738[_0x3d80('0x2e')]=_[_0x3d80('0x2f')](_0x4ae4ff[_0x3d80('0x2e')]);_0x237738['filters']=_[_0x3d80('0x31')](_0x237738[_0x3d80('0x2d')],_0x237738[_0x3d80('0x2e')]);_0x34a902[_0x3d80('0x32')]=_[_0x3d80('0x31')](_0x237738[_0x3d80('0x2d')],qs[_0x3d80('0x33')](_0x4ae4ff[_0x3d80('0x2e')][_0x3d80('0x33')]));_0x34a902[_0x3d80('0x32')]=_0x34a902[_0x3d80('0x32')][_0x3d80('0x34')]?_0x34a902['attributes']:_0x237738['model'];_0x34a902[_0x3d80('0x37')]=qs['sort'](_0x4ae4ff[_0x3d80('0x2e')][_0x3d80('0x38')]);_0x34a902[_0x3d80('0x3b')]=qs[_0x3d80('0x30')](_[_0x3d80('0x39')](_0x4ae4ff['query'],_0x237738[_0x3d80('0x30')]));if(_0x4ae4ff['query'][_0x3d80('0x3a')]){_0x34a902[_0x3d80('0x3b')]=_[_0x3d80('0x3c')](_0x34a902[_0x3d80('0x3b')],{'$or':_[_0x3d80('0x29')](_0x34a902[_0x3d80('0x32')],function(_0x3b475b){var _0x17ecd7={};_0x17ecd7[_0x3b475b]={'$like':'%'+_0x4ae4ff[_0x3d80('0x2e')]['filter']+'%'};return _0x17ecd7;})});}_0x34a902=_[_0x3d80('0x3c')]({},_0x34a902,_0x4ae4ff[_0x3d80('0x3e')]);return _0x950cd9[_0x3d80('0x52')](_0x34a902);}})[_0x3d80('0x23')](function(_0x581fb4){if(_0x581fb4){_0x1a46fc=_0x581fb4[_0x3d80('0x34')];if(!_0x4ae4ff[_0x3d80('0x2e')][_0x3d80('0x35')](_0x3d80('0x36'))){_0x34a902[_0x3d80('0x1d')]=qs[_0x3d80('0x1d')](_0x4ae4ff[_0x3d80('0x2e')][_0x3d80('0x1d')]);_0x34a902[_0x3d80('0x1b')]=qs['offset'](_0x4ae4ff[_0x3d80('0x2e')]['offset']);}return _0x950cd9[_0x3d80('0x52')](_0x34a902);}})[_0x3d80('0x23')](function(_0x3a775f){if(_0x3a775f){return _0x3a775f?{'count':_0x1a46fc,'rows':_0x3a775f}:null;}})[_0x3d80('0x23')](respondWithResult(_0x17b9fb,null))[_0x3d80('0x44')](handleError(_0x17b9fb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8cfcce8..ba04efe 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 _0x6164=['define','Automation','tools_automations','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./automation.attributes','exports'];(function(_0x421752,_0x20f492){var _0x23ed3e=function(_0x3a9e19){while(--_0x3a9e19){_0x421752['push'](_0x421752['shift']());}};_0x23ed3e(++_0x20f492);}(_0x6164,0x14d));var _0x4616=function(_0x270e46,_0x122174){_0x270e46=_0x270e46-0x0;var _0x18ca4e=_0x6164[_0x270e46];return _0x18ca4e;};'use strict';var _=require(_0x4616('0x0'));var util=require('util');var logger=require(_0x4616('0x1'))('api');var moment=require(_0x4616('0x2'));var BPromise=require(_0x4616('0x3'));var rp=require(_0x4616('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4616('0x5'));var attributes=require(_0x4616('0x6'));module[_0x4616('0x7')]=function(_0x1a8d24,_0x354d63){return _0x1a8d24[_0x4616('0x8')](_0x4616('0x9'),attributes,{'tableName':_0x4616('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x427a=['tools_automations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x427a,0xaa));var _0xa427=function(_0x1cc46d,_0x4ec74d){_0x1cc46d=_0x1cc46d-0x0;var _0x312723=_0x427a[_0x1cc46d];return _0x312723;};'use strict';var _=require('lodash');var util=require(_0xa427('0x0'));var logger=require(_0xa427('0x1'))(_0xa427('0x2'));var moment=require(_0xa427('0x3'));var BPromise=require(_0xa427('0x4'));var rp=require(_0xa427('0x5'));var fs=require('fs');var path=require(_0xa427('0x6'));var rimraf=require(_0xa427('0x7'));var config=require(_0xa427('0x8'));var attributes=require(_0xa427('0x9'));module[_0xa427('0xa')]=function(_0x1275a7,_0x59011b){return _0x1275a7['define'](_0xa427('0xb'),attributes,{'tableName':_0xa427('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0f939b0..3c7eef7 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 _0x80c4=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x80c4,0xa3));var _0x480c=function(_0x29987d,_0x14bc0e){_0x29987d=_0x29987d-0x0;var _0x3fc3f7=_0x80c4[_0x29987d];return _0x3fc3f7;};'use strict';var _=require(_0x480c('0x0'));var util=require('util');var moment=require(_0x480c('0x1'));var BPromise=require(_0x480c('0x2'));var rs=require(_0x480c('0x3'));var fs=require('fs');var Redis=require(_0x480c('0x4'));var db=require(_0x480c('0x5'))['db'];var utils=require(_0x480c('0x6'));var logger=require('../../config/logger')(_0x480c('0x7'));var config=require(_0x480c('0x8'));var jayson=require(_0x480c('0x9'));var client=jayson[_0x480c('0xa')][_0x480c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40a5a6,_0x3a69ec,_0x277efe){return new BPromise(function(_0x21545d,_0x510038){return client[_0x480c('0xc')](_0x40a5a6,_0x277efe)[_0x480c('0xd')](function(_0x292aca){logger[_0x480c('0xe')](_0x480c('0xf'),_0x3a69ec,_0x480c('0x10'));logger[_0x480c('0x11')](_0x480c('0x12'),_0x3a69ec,_0x480c('0x10'),JSON[_0x480c('0x13')](_0x292aca));if(_0x292aca[_0x480c('0x14')]){if(_0x292aca[_0x480c('0x14')][_0x480c('0x15')]===0x1f4){logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);return _0x510038(_0x292aca[_0x480c('0x14')]['message']);}logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca['error'][_0x480c('0x16')]);return _0x21545d(_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3a69ec,_0x480c('0x10'));_0x21545d(_0x292aca[_0x480c('0x17')][_0x480c('0x16')]);}})[_0x480c('0x18')](function(_0x93d6c5){logger['error']('Automation,\x20%s,\x20%s',_0x3a69ec,_0x93d6c5);_0x510038(_0x93d6c5);});});} \ No newline at end of file +var _0x6a55=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x6a55,0xdb));var _0x56a5=function(_0x316efa,_0x20a1e1){_0x316efa=_0x316efa-0x0;var _0x4d96cc=_0x6a55[_0x316efa];return _0x4d96cc;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 16eace1..cc6123d 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 _0xd67b=['create','addConditions','addActions','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post'];(function(_0x54f675,_0x38f8e4){var _0x354855=function(_0x398b8d){while(--_0x398b8d){_0x54f675['push'](_0x54f675['shift']());}};_0x354855(++_0x38f8e4);}(_0xd67b,0x133));var _0xbd67=function(_0x4d82ee,_0xfdae5c){_0x4d82ee=_0x4d82ee-0x0;var _0x43faa5=_0xd67b[_0x4d82ee];return _0x43faa5;};'use strict';var multer=require('multer');var util=require(_0xbd67('0x0'));var path=require('path');var timeout=require(_0xbd67('0x1'));var express=require(_0xbd67('0x2'));var router=express[_0xbd67('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbd67('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbd67('0x5'));var controller=require('./automation.controller');router[_0xbd67('0x6')]('/',auth[_0xbd67('0x7')](),controller[_0xbd67('0x8')]);router[_0xbd67('0x6')](_0xbd67('0x9'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xa')]);router[_0xbd67('0x6')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xc')]);router[_0xbd67('0x6')](_0xbd67('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0xbd67('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd67('0xf')]);router[_0xbd67('0xe')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0x10')]);router[_0xbd67('0xe')](_0xbd67('0xd'),auth[_0xbd67('0x7')](),controller[_0xbd67('0x11')]);router[_0xbd67('0x12')]('/:id',auth[_0xbd67('0x7')](),controller[_0xbd67('0x13')]);router[_0xbd67('0x14')](_0xbd67('0x9'),auth[_0xbd67('0x7')](),controller[_0xbd67('0x15')]);module[_0xbd67('0x16')]=router; \ No newline at end of file +var _0x92f0=['get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addActions','put','update','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./automation.controller'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x92f0,0x10d));var _0x092f=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x92f0[_0x59d89e];return _0x554e93;};'use strict';var multer=require('multer');var util=require(_0x092f('0x0'));var path=require(_0x092f('0x1'));var timeout=require('connect-timeout');var express=require(_0x092f('0x2'));var router=express[_0x092f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x092f('0x4'));var config=require(_0x092f('0x5'));var controller=require(_0x092f('0x6'));router[_0x092f('0x7')]('/',auth[_0x092f('0x8')](),controller[_0x092f('0x9')]);router['get'](_0x092f('0xa'),auth['isAuthenticated'](),controller[_0x092f('0xb')]);router['get'](_0x092f('0xc'),auth['isAuthenticated'](),controller[_0x092f('0xd')]);router['get'](_0x092f('0xe'),auth[_0x092f('0x8')](),controller[_0x092f('0xf')]);router['post']('/',auth[_0x092f('0x8')](),controller[_0x092f('0x10')]);router[_0x092f('0x11')](_0x092f('0xc'),auth[_0x092f('0x8')](),controller['addConditions']);router[_0x092f('0x11')](_0x092f('0xe'),auth['isAuthenticated'](),controller[_0x092f('0x12')]);router[_0x092f('0x13')](_0x092f('0xa'),auth[_0x092f('0x8')](),controller[_0x092f('0x14')]);router[_0x092f('0x15')](_0x092f('0xa'),auth[_0x092f('0x8')](),controller['destroy']);module[_0x092f('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 623450d..e7b9bc8 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 _0x8731=['sequelize','exports','name','ENUM','Active/Disactive\x20Campaign','STRING','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x171414,_0x378e1a){var _0x5eadb5=function(_0x5e9823){while(--_0x5e9823){_0x171414['push'](_0x171414['shift']());}};_0x5eadb5(++_0x378e1a);}(_0x8731,0x193));var _0x1873=function(_0x4d813a,_0x352a0c){_0x4d813a=_0x4d813a-0x0;var _0x20c364=_0x8731[_0x4d813a];return _0x20c364;};'use strict';var Sequelize=require(_0x1873('0x0'));module[_0x1873('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1873('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1873('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1873('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1873('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1873('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x1873('0x6')](0x3)[_0x1873('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1873('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1873('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1873('0x6')](0x5)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1873('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x1873('0x6')](0x3)[_0x1873('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1873('0x6')](0x5)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1873('0x6')](0x3)[_0x1873('0x7')],'defaultValue':0x3,'comment':_0x1873('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1873('0x6')](0x5)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1873('0xb')},'dialTimezone':{'type':Sequelize[_0x1873('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1873('0x5')],'defaultValue':_0x1873('0xc')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1873('0xd'),_0x1873('0xe'),_0x1873('0xf')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1873('0x10')],'defaultValue':0x0,'comment':_0x1873('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x1873('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1873('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1873('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1873('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1873('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1873('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1873('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1873('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1873('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1873('0x6')](0x9)[_0x1873('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1873('0x6')](0x5)[_0x1873('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1873('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1873('0x6')](0x9)[_0x1873('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1873('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1873('0x3')](_0x1873('0x17'),'ASC'),'defaultValue':_0x1873('0x17')},'dialPrefix':{'type':Sequelize[_0x1873('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1873('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1873('0x18')},'dialCutDigit':{'type':Sequelize[_0x1873('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1873('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1873('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1873('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1873('0x6')](0x3)[_0x1873('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1873('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x1873('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1873('0x6')](0x3)[_0x1873('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1873('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1873('0x6')](0x5)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1873('0x6')](0x3)[_0x1873('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1873('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1873('0x6')](0x5)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1873('0x6')](0x5)[_0x1873('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1873('0x1e')}}; \ No newline at end of file +var _0xdb10=['UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER'];(function(_0xab2afb,_0x546bfb){var _0x25262b=function(_0x3bd92d){while(--_0x3bd92d){_0xab2afb['push'](_0xab2afb['shift']());}};_0x25262b(++_0x546bfb);}(_0xdb10,0x18f));var _0x0db1=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xdb10[_0x420b24];return _0x4da552;};'use strict';var Sequelize=require(_0x0db1('0x0'));module[_0x0db1('0x1')]={'name':{'type':Sequelize[_0x0db1('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0db1('0x3')](_0x0db1('0x4')),'allowNull':![],'defaultValue':_0x0db1('0x4')},'description':{'type':Sequelize[_0x0db1('0x2')]},'active':{'type':Sequelize[_0x0db1('0x5')],'defaultValue':0x0,'comment':_0x0db1('0x6')},'limitCalls':{'type':Sequelize[_0x0db1('0x7')](0x4)[_0x0db1('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0db1('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0db1('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0db1('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0db1('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0db1('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0db1('0x7')](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0db1('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0db1('0x7')](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0db1('0x8')],'defaultValue':0x3,'comment':_0x0db1('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0db1('0x7')](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0db1('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0db1('0xf')},'dialTimezone':{'type':Sequelize[_0x0db1('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0db1('0x2')],'defaultValue':_0x0db1('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x0db1('0x3')](_0x0db1('0x11'),_0x0db1('0x12'),_0x0db1('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0db1('0x5')],'defaultValue':0x0,'comment':_0x0db1('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0db1('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0db1('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0db1('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0db1('0x7')](0x9)[_0x0db1('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0db1('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0db1('0x7')](0x9)[_0x0db1('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0db1('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0db1('0x7')](0x9)[_0x0db1('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0db1('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0db1('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0db1('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0db1('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0db1('0x7')](0x9)[_0x0db1('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0db1('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0db1('0x3')](_0x0db1('0x1b'),_0x0db1('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0db1('0x7')](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0db1('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0db1('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0db1('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0db1('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0db1('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0db1('0x7')](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0db1('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0db1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0db1('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0db1('0x7')](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0db1('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0db1('0x7')](0x3)[_0x0db1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0db1('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0db1('0x7')](0x5)[_0x0db1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0db1('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4d353ac..25f567c 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 _0x87b1=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','include','rows','show','params','rawAttributes','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','createdAt','updatedAt','omit','getHoppers','CmHopper','filters','CampaignId','filter','findAll','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ListId','select','field','phone','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','fromQuery','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','name','send','map','Campaign','fieldName','type','key','model','query','keys','intersection'];(function(_0x353e35,_0xebabe0){var _0x667e4c=function(_0xfeccc6){while(--_0xfeccc6){_0x353e35['push'](_0x353e35['shift']());}};_0x667e4c(++_0xebabe0);}(_0x87b1,0x1e2));var _0x187b=function(_0x111478,_0x5557c1){_0x111478=_0x111478-0x0;var _0x3c103d=_0x87b1[_0x111478];return _0x3c103d;};'use strict';var emlformat=require(_0x187b('0x0'));var rimraf=require(_0x187b('0x1'));var zipdir=require(_0x187b('0x2'));var jsonpatch=require(_0x187b('0x3'));var rp=require('request-promise');var moment=require(_0x187b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x187b('0x5'));var path=require('path');var sox=require(_0x187b('0x6'));var csv=require(_0x187b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x187b('0x8'));var _=require(_0x187b('0x9'));var squel=require('squel');var crypto=require(_0x187b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x187b('0xb'));var toCsv=require(_0x187b('0x7'));var querystring=require(_0x187b('0xc'));var Papa=require(_0x187b('0xd'));var Redis=require('ioredis');var authService=require(_0x187b('0xe'));var qs=require(_0x187b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x187b('0x10'))(_0x187b('0x11'));var utils=require(_0x187b('0x12'));var config=require(_0x187b('0x13'));var licenseUtil=require(_0x187b('0x14'));var db=require(_0x187b('0x15'))['db'];function respondWithStatusCode(_0xb27c66,_0x39336c){_0x39336c=_0x39336c||0xcc;return function(_0x52ad81){if(_0x52ad81){return _0xb27c66[_0x187b('0x16')](_0x39336c);}return _0xb27c66[_0x187b('0x17')](_0x39336c)[_0x187b('0x18')]();};}function respondWithResult(_0x12da8f,_0x138b04){_0x138b04=_0x138b04||0xc8;return function(_0x4f3c7b){if(_0x4f3c7b){return _0x12da8f[_0x187b('0x17')](_0x138b04)[_0x187b('0x19')](_0x4f3c7b);}};}function respondWithFilteredResult(_0x57fa00,_0x1df576){return function(_0xc7d55e){if(_0xc7d55e){var _0x5d27b5=typeof _0x1df576[_0x187b('0x1a')]===_0x187b('0x1b')&&typeof _0x1df576[_0x187b('0x1c')]===_0x187b('0x1b');var _0x59eba8=_0xc7d55e[_0x187b('0x1d')];var _0x36753d=_0x5d27b5?0x0:_0x1df576[_0x187b('0x1a')];var _0x5f7dd2=_0x5d27b5?_0xc7d55e[_0x187b('0x1d')]:_0x1df576[_0x187b('0x1a')]+_0x1df576[_0x187b('0x1c')];var _0x398f86;if(_0x5f7dd2>=_0x59eba8){_0x5f7dd2=_0x59eba8;_0x398f86=0xc8;}else{_0x398f86=0xce;}_0x57fa00['status'](_0x398f86);return _0x57fa00[_0x187b('0x1e')](_0x187b('0x1f'),_0x36753d+'-'+_0x5f7dd2+'/'+_0x59eba8)['json'](_0xc7d55e);}return null;};}function patchUpdates(_0x2bab85){return function(_0x91de12){try{jsonpatch[_0x187b('0x20')](_0x91de12,_0x2bab85,!![]);}catch(_0x561463){return BPromise['reject'](_0x561463);}return _0x91de12[_0x187b('0x21')]();};}function saveUpdates(_0x12860d,_0x5ab5f6){return function(_0x2735dd){if(_0x2735dd){return _0x2735dd[_0x187b('0x22')](_0x12860d)[_0x187b('0x23')](function(_0x50c583){return _0x50c583;});}return null;};}function removeEntity(_0x560361,_0x4ca3e0){return function(_0x4c92fe){if(_0x4c92fe){return _0x4c92fe['destroy']()['then'](function(){var _0x38e5a3=_0x4c92fe[_0x187b('0x24')]({'plain':!![]});var _0x55a2c1='IvrCampaigns';return db['UserProfileResource'][_0x187b('0x25')]({'where':{'type':_0x55a2c1,'resourceId':_0x38e5a3['id']}})[_0x187b('0x23')](function(){return _0x4c92fe;});})[_0x187b('0x23')](function(){_0x560361['status'](0xcc)[_0x187b('0x18')]();});}};}function handleEntityNotFound(_0x4ae1f1,_0x552d15){return function(_0x3790c7){if(!_0x3790c7){_0x4ae1f1[_0x187b('0x16')](0x194);}return _0x3790c7;};}function handleError(_0x26f5fd,_0x1b1cd7){_0x1b1cd7=_0x1b1cd7||0x1f4;return function(_0x539a0b){logger[_0x187b('0x26')](_0x539a0b['stack']);if(_0x539a0b[_0x187b('0x27')]){delete _0x539a0b[_0x187b('0x27')];}_0x26f5fd[_0x187b('0x17')](_0x1b1cd7)[_0x187b('0x28')](_0x539a0b);};}exports['index']=function(_0x4e39cb,_0x1c5c4b){var _0x3bab92={},_0x3cbe8b={},_0x5d0398={'count':0x0,'rows':[]};var _0x4e92bc=_[_0x187b('0x29')](db[_0x187b('0x2a')]['rawAttributes'],function(_0x443a10){return{'name':_0x443a10[_0x187b('0x2b')],'type':_0x443a10[_0x187b('0x2c')][_0x187b('0x2d')]};});_0x3cbe8b[_0x187b('0x2e')]=_['map'](_0x4e92bc,_0x187b('0x27'));_0x3cbe8b[_0x187b('0x2f')]=_[_0x187b('0x30')](_0x4e39cb[_0x187b('0x2f')]);_0x3cbe8b['filters']=_[_0x187b('0x31')](_0x3cbe8b[_0x187b('0x2e')],_0x3cbe8b[_0x187b('0x2f')]);_0x3bab92[_0x187b('0x32')]=_[_0x187b('0x31')](_0x3cbe8b[_0x187b('0x2e')],qs[_0x187b('0x33')](_0x4e39cb[_0x187b('0x2f')][_0x187b('0x33')]));_0x3bab92[_0x187b('0x32')]=_0x3bab92[_0x187b('0x32')][_0x187b('0x34')]?_0x3bab92[_0x187b('0x32')]:_0x3cbe8b[_0x187b('0x2e')];if(!_0x4e39cb[_0x187b('0x2f')][_0x187b('0x35')](_0x187b('0x36'))){_0x3bab92[_0x187b('0x1c')]=qs[_0x187b('0x1c')](_0x4e39cb['query'][_0x187b('0x1c')]);_0x3bab92[_0x187b('0x1a')]=qs[_0x187b('0x1a')](_0x4e39cb[_0x187b('0x2f')]['offset']);}_0x3bab92[_0x187b('0x37')]=qs[_0x187b('0x38')](_0x4e39cb[_0x187b('0x2f')]['sort']);_0x3bab92[_0x187b('0x39')]=qs['filters'](_[_0x187b('0x3a')](_0x4e39cb[_0x187b('0x2f')],_0x3cbe8b['filters']),_0x4e92bc);if(_0x4e39cb[_0x187b('0x2f')]['filter']){_0x3bab92[_0x187b('0x39')]=_[_0x187b('0x3b')](_0x3bab92[_0x187b('0x39')],{'$or':_[_0x187b('0x29')](_0x4e92bc,function(_0x315486){if(_0x315486[_0x187b('0x2c')]!==_0x187b('0x3c')){var _0x17ee8a={};_0x17ee8a[_0x315486['name']]={'$like':'%'+_0x4e39cb[_0x187b('0x2f')]['filter']+'%'};return _0x17ee8a;}})});}_0x3bab92=_['merge']({},_0x3bab92,_0x4e39cb['options']);var _0x12e68c={'where':_0x3bab92['where']};return db['Campaign']['count'](_0x12e68c)[_0x187b('0x23')](function(_0x51a0a9){_0x5d0398[_0x187b('0x1d')]=_0x51a0a9;if(_0x4e39cb[_0x187b('0x2f')]['includeAll']){_0x3bab92[_0x187b('0x3d')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x3bab92);})[_0x187b('0x23')](function(_0x53a290){_0x5d0398[_0x187b('0x3e')]=_0x53a290;return _0x5d0398;})[_0x187b('0x23')](respondWithFilteredResult(_0x1c5c4b,_0x3bab92))['catch'](handleError(_0x1c5c4b,null));};exports[_0x187b('0x3f')]=function(_0x35589e,_0x44c542){var _0x10759f={'raw':![],'where':{'id':_0x35589e[_0x187b('0x40')]['id']}},_0x4444c0={};_0x4444c0['model']=_[_0x187b('0x30')](db['Campaign'][_0x187b('0x41')]);_0x4444c0[_0x187b('0x2f')]=_[_0x187b('0x30')](_0x35589e['query']);_0x4444c0['filters']=_[_0x187b('0x31')](_0x4444c0[_0x187b('0x2e')],_0x4444c0['query']);_0x10759f[_0x187b('0x32')]=_[_0x187b('0x31')](_0x4444c0[_0x187b('0x2e')],qs['fields'](_0x35589e[_0x187b('0x2f')][_0x187b('0x33')]));_0x10759f[_0x187b('0x32')]=_0x10759f['attributes'][_0x187b('0x34')]?_0x10759f[_0x187b('0x32')]:_0x4444c0['model'];if(_0x35589e[_0x187b('0x2f')][_0x187b('0x42')]){_0x10759f[_0x187b('0x3d')]=[{'all':!![]}];}_0x10759f=_[_0x187b('0x3b')]({},_0x10759f,_0x35589e[_0x187b('0x43')]);return db[_0x187b('0x2a')]['find'](_0x10759f)[_0x187b('0x23')](handleEntityNotFound(_0x44c542,null))[_0x187b('0x23')](respondWithResult(_0x44c542,null))['catch'](handleError(_0x44c542,null));};exports[_0x187b('0x44')]=function(_0x5cd93c,_0x42905f){return db[_0x187b('0x2a')][_0x187b('0x44')](_0x5cd93c[_0x187b('0x45')],{})[_0x187b('0x23')](function(_0x519c87){var _0x60d121=_0x5cd93c[_0x187b('0x46')][_0x187b('0x24')]({'plain':!![]});if(!_0x60d121)throw new Error(_0x187b('0x47'));if(_0x60d121[_0x187b('0x48')]===_0x187b('0x46')){var _0x556537=_0x519c87[_0x187b('0x24')]({'plain':!![]});var _0x9a5252=_0x187b('0x49');return db[_0x187b('0x4a')]['find']({'where':{'name':_0x9a5252,'userProfileId':_0x60d121['userProfileId']},'raw':!![]})['then'](function(_0x45db7e){if(_0x45db7e&&_0x45db7e[_0x187b('0x4b')]===0x0){return db[_0x187b('0x4c')][_0x187b('0x44')]({'name':_0x556537[_0x187b('0x27')],'resourceId':_0x556537['id'],'type':_0x45db7e['name'],'sectionId':_0x45db7e['id']},{})[_0x187b('0x23')](function(){return _0x519c87;});}else{return _0x519c87;}})[_0x187b('0x4d')](function(_0x7dfd0a){logger[_0x187b('0x26')](_0x187b('0x4e'),_0x7dfd0a);throw _0x7dfd0a;});}return _0x519c87;})[_0x187b('0x23')](respondWithResult(_0x42905f,0xc9))[_0x187b('0x4d')](handleError(_0x42905f,null));};exports[_0x187b('0x4f')]=function(_0x38d30a,_0x57386f){var _0x1bc55c={'where':{'id':_0x38d30a['params']['id']}},_0x5e2f7e={};_0x5e2f7e['model']=_[_0x187b('0x30')](db['Campaign'][_0x187b('0x41')]);_0x1bc55c['attributes']=_[_0x187b('0x31')](_0x5e2f7e['model'],qs['fields'](_0x38d30a[_0x187b('0x2f')][_0x187b('0x33')]));_0x1bc55c[_0x187b('0x32')]=_0x1bc55c[_0x187b('0x32')][_0x187b('0x34')]?_0x1bc55c[_0x187b('0x32')]:_0x5e2f7e[_0x187b('0x2e')];if(_0x38d30a[_0x187b('0x2f')][_0x187b('0x42')]){_0x1bc55c[_0x187b('0x3d')]=[{'all':!![]}];}_0x1bc55c=_[_0x187b('0x3b')]({},_0x1bc55c,_0x38d30a[_0x187b('0x43')]);return db[_0x187b('0x2a')][_0x187b('0x50')](_0x1bc55c)[_0x187b('0x23')](handleEntityNotFound(_0x57386f,null))['then'](function(_0x106a1d){if(_0x106a1d){var _0x5e28aa=_0x106a1d[_0x187b('0x24')]({'plain':!![]});_0x5e28aa=qs['omit'](_0x5e28aa,['id',_0x187b('0x51'),_0x187b('0x52')]);_0x38d30a[_0x187b('0x45')]=_[_0x187b('0x53')](_0x38d30a[_0x187b('0x45')],['id',_0x187b('0x51'),'updatedAt']);return db[_0x187b('0x2a')]['create'](_[_0x187b('0x3b')](_0x5e28aa,_0x38d30a[_0x187b('0x45')]),{'include':_0x38d30a[_0x187b('0x2f')][_0x187b('0x42')]?[{'all':!![]}]:undefined})[_0x187b('0x23')](function(_0x36ba2d){var _0x1b1d35=_0x38d30a[_0x187b('0x46')]['get']({'plain':!![]});if(!_0x1b1d35)throw new Error(_0x187b('0x47'));if(_0x1b1d35[_0x187b('0x48')]===_0x187b('0x46')){var _0x30946f=_0x36ba2d[_0x187b('0x24')]({'plain':!![]});var _0x821a45=_0x187b('0x49');return db['UserProfileSection'][_0x187b('0x50')]({'where':{'name':_0x821a45,'userProfileId':_0x1b1d35['userProfileId']},'raw':!![]})['then'](function(_0x3de2d8){if(_0x3de2d8&&_0x3de2d8['autoAssociation']===0x0){return db[_0x187b('0x4c')][_0x187b('0x44')]({'name':_0x30946f[_0x187b('0x27')],'resourceId':_0x30946f['id'],'type':_0x3de2d8[_0x187b('0x27')],'sectionId':_0x3de2d8['id']},{})[_0x187b('0x23')](function(){return _0x36ba2d;});}else{return _0x36ba2d;}})[_0x187b('0x4d')](function(_0x4a9e03){logger[_0x187b('0x26')](_0x187b('0x4e'),_0x4a9e03);throw _0x4a9e03;});}return _0x36ba2d;});}})[_0x187b('0x23')](respondWithResult(_0x57386f,0xc9))[_0x187b('0x4d')](handleError(_0x57386f,null));};exports['update']=function(_0x4fa174,_0x36183e){if(_0x4fa174[_0x187b('0x45')]['id']){delete _0x4fa174[_0x187b('0x45')]['id'];}return db[_0x187b('0x2a')]['find']({'where':{'id':_0x4fa174[_0x187b('0x40')]['id']}})[_0x187b('0x23')](handleEntityNotFound(_0x36183e,null))[_0x187b('0x23')](saveUpdates(_0x4fa174['body'],null))['then'](respondWithResult(_0x36183e,null))['catch'](handleError(_0x36183e,null));};exports[_0x187b('0x25')]=function(_0x729fdf,_0x29ce94){return db[_0x187b('0x2a')][_0x187b('0x50')]({'where':{'id':_0x729fdf[_0x187b('0x40')]['id']}})['then'](handleEntityNotFound(_0x29ce94,null))['then'](removeEntity(_0x29ce94,null))['catch'](handleError(_0x29ce94,null));};exports[_0x187b('0x54')]=function(_0x4c101a,_0x32d3e7,_0x4e4d43){var _0x1997c2={'raw':!![],'where':{}};var _0x59a58b={};var _0x51680b={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4c101a[_0x187b('0x40')]['id']}})[_0x187b('0x23')](handleEntityNotFound(_0x32d3e7,null))[_0x187b('0x23')](function(_0x260580){if(_0x260580){_0x59a58b[_0x187b('0x2e')]=_[_0x187b('0x30')](db[_0x187b('0x55')][_0x187b('0x41')]);_0x59a58b[_0x187b('0x2f')]=_[_0x187b('0x30')](_0x4c101a[_0x187b('0x2f')]);_0x59a58b[_0x187b('0x56')]=_[_0x187b('0x31')](_0x59a58b['model'],_0x59a58b['query']);_0x1997c2[_0x187b('0x32')]=_[_0x187b('0x31')](_0x59a58b[_0x187b('0x2e')],qs['fields'](_0x4c101a[_0x187b('0x2f')]['fields']));_0x1997c2[_0x187b('0x32')]=_0x1997c2[_0x187b('0x32')][_0x187b('0x34')]?_0x1997c2[_0x187b('0x32')]:_0x59a58b[_0x187b('0x2e')];if(!_0x4c101a[_0x187b('0x2f')][_0x187b('0x35')](_0x187b('0x36'))){_0x1997c2[_0x187b('0x1c')]=qs[_0x187b('0x1c')](_0x4c101a['query']['limit']);_0x1997c2[_0x187b('0x1a')]=qs[_0x187b('0x1a')](_0x4c101a[_0x187b('0x2f')][_0x187b('0x1a')]);}_0x1997c2[_0x187b('0x37')]=qs[_0x187b('0x38')](_0x4c101a[_0x187b('0x2f')][_0x187b('0x38')]);_0x1997c2['where']=qs['filters'](_[_0x187b('0x3a')](_0x4c101a[_0x187b('0x2f')],_0x59a58b[_0x187b('0x56')]));_0x1997c2[_0x187b('0x39')][_0x187b('0x57')]=_0x260580['id'];if(_0x4c101a[_0x187b('0x2f')][_0x187b('0x58')]){_0x1997c2['where']=_[_0x187b('0x3b')](_0x1997c2[_0x187b('0x39')],{'$or':_['map'](_0x1997c2[_0x187b('0x32')],function(_0x37e52c){var _0xa225a6={};_0xa225a6[_0x37e52c]={'$like':'%'+_0x4c101a[_0x187b('0x2f')]['filter']+'%'};return _0xa225a6;})});}_0x1997c2=_[_0x187b('0x3b')]({},_0x1997c2,_0x4c101a[_0x187b('0x43')]);return db['CmHopper']['count']({'where':_0x1997c2[_0x187b('0x39')]})[_0x187b('0x23')](function(_0x4fcb06){_0x51680b[_0x187b('0x1d')]=_0x4fcb06;if(_0x4c101a[_0x187b('0x2f')]['includeAll']){_0x1997c2[_0x187b('0x3d')]=[{'all':!![]}];}return db[_0x187b('0x55')][_0x187b('0x59')](_0x1997c2);})[_0x187b('0x23')](function(_0x14c595){_0x51680b[_0x187b('0x3e')]=_0x14c595;return _0x51680b;});}})[_0x187b('0x23')](respondWithFilteredResult(_0x32d3e7,_0x1997c2))[_0x187b('0x4d')](handleError(_0x32d3e7,null));};exports[_0x187b('0x5a')]=function(_0x517afe,_0x352b99,_0x41f498){var _0x349e71={'raw':!![],'where':{}};var _0x447a8a={};var _0x5e89d1={'count':0x0,'rows':[]};return db[_0x187b('0x2a')][_0x187b('0x5b')]({'where':{'id':_0x517afe['params']['id']}})['then'](handleEntityNotFound(_0x352b99,null))[_0x187b('0x23')](function(_0x463d68){if(_0x463d68){_0x447a8a[_0x187b('0x2e')]=_[_0x187b('0x30')](db[_0x187b('0x5c')][_0x187b('0x41')]);_0x447a8a['query']=_[_0x187b('0x30')](_0x517afe[_0x187b('0x2f')]);_0x447a8a['filters']=_[_0x187b('0x31')](_0x447a8a['model'],_0x447a8a[_0x187b('0x2f')]);_0x349e71[_0x187b('0x32')]=_['intersection'](_0x447a8a[_0x187b('0x2e')],qs['fields'](_0x517afe[_0x187b('0x2f')][_0x187b('0x33')]));_0x349e71['attributes']=_0x349e71[_0x187b('0x32')][_0x187b('0x34')]?_0x349e71[_0x187b('0x32')]:_0x447a8a['model'];if(!_0x517afe[_0x187b('0x2f')]['hasOwnProperty'](_0x187b('0x36'))){_0x349e71['limit']=qs[_0x187b('0x1c')](_0x517afe[_0x187b('0x2f')][_0x187b('0x1c')]);_0x349e71[_0x187b('0x1a')]=qs[_0x187b('0x1a')](_0x517afe[_0x187b('0x2f')][_0x187b('0x1a')]);}_0x349e71['order']=qs['sort'](_0x517afe[_0x187b('0x2f')]['sort']);_0x349e71[_0x187b('0x39')]=qs[_0x187b('0x56')](_[_0x187b('0x3a')](_0x517afe['query'],_0x447a8a[_0x187b('0x56')]));_0x349e71[_0x187b('0x39')][_0x187b('0x57')]=_0x463d68['id'];if(_0x517afe[_0x187b('0x2f')][_0x187b('0x58')]){_0x349e71[_0x187b('0x39')]=_[_0x187b('0x3b')](_0x349e71[_0x187b('0x39')],{'$or':_[_0x187b('0x29')](_0x349e71[_0x187b('0x32')],function(_0x28760a){var _0x452e33={};_0x452e33[_0x28760a]={'$like':'%'+_0x517afe['query'][_0x187b('0x58')]+'%'};return _0x452e33;})});}_0x349e71=_[_0x187b('0x3b')]({},_0x349e71,_0x517afe[_0x187b('0x43')]);return db[_0x187b('0x5c')][_0x187b('0x1d')]({'where':_0x349e71['where']})['then'](function(_0xe2d981){_0x5e89d1[_0x187b('0x1d')]=_0xe2d981;if(_0x517afe[_0x187b('0x2f')][_0x187b('0x42')]){_0x349e71[_0x187b('0x3d')]=[{'all':!![]}];}return db[_0x187b('0x5c')][_0x187b('0x59')](_0x349e71);})[_0x187b('0x23')](function(_0x5a30e3){_0x5e89d1[_0x187b('0x3e')]=_0x5a30e3;return _0x5e89d1;});}})['then'](respondWithFilteredResult(_0x352b99,_0x349e71))[_0x187b('0x4d')](handleError(_0x352b99,null));};exports[_0x187b('0x5d')]=function(_0x594c96,_0x5d6181,_0x415123){var _0x2daa39={'raw':!![],'where':{}};var _0x231efc={};var _0x29e3a9={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x594c96['params']['id']}})['then'](handleEntityNotFound(_0x5d6181,null))[_0x187b('0x23')](function(_0x324fa7){if(_0x324fa7){_0x231efc['model']=_[_0x187b('0x30')](db[_0x187b('0x5e')][_0x187b('0x41')]);_0x231efc[_0x187b('0x2f')]=_[_0x187b('0x30')](_0x594c96[_0x187b('0x2f')]);_0x231efc['filters']=_[_0x187b('0x31')](_0x231efc[_0x187b('0x2e')],_0x231efc['query']);_0x2daa39[_0x187b('0x32')]=_[_0x187b('0x31')](_0x231efc[_0x187b('0x2e')],qs['fields'](_0x594c96[_0x187b('0x2f')][_0x187b('0x33')]));_0x2daa39[_0x187b('0x32')]=_0x2daa39['attributes'][_0x187b('0x34')]?_0x2daa39[_0x187b('0x32')]:_0x231efc[_0x187b('0x2e')];if(!_0x594c96[_0x187b('0x2f')]['hasOwnProperty'](_0x187b('0x36'))){_0x2daa39[_0x187b('0x1c')]=qs[_0x187b('0x1c')](_0x594c96['query']['limit']);_0x2daa39['offset']=qs[_0x187b('0x1a')](_0x594c96['query'][_0x187b('0x1a')]);}_0x2daa39[_0x187b('0x37')]=qs[_0x187b('0x38')](_0x594c96[_0x187b('0x2f')]['sort']);_0x2daa39[_0x187b('0x39')]=qs[_0x187b('0x56')](_[_0x187b('0x3a')](_0x594c96[_0x187b('0x2f')],_0x231efc[_0x187b('0x56')]));_0x2daa39[_0x187b('0x39')][_0x187b('0x57')]=_0x324fa7['id'];if(_0x594c96[_0x187b('0x2f')][_0x187b('0x58')]){_0x2daa39[_0x187b('0x39')]=_[_0x187b('0x3b')](_0x2daa39[_0x187b('0x39')],{'$or':_[_0x187b('0x29')](_0x2daa39['attributes'],function(_0x344c7c){var _0x29982c={};_0x29982c[_0x344c7c]={'$like':'%'+_0x594c96[_0x187b('0x2f')][_0x187b('0x58')]+'%'};return _0x29982c;})});}_0x2daa39=_['merge']({},_0x2daa39,_0x594c96['options']);return db[_0x187b('0x5e')][_0x187b('0x1d')]({'where':_0x2daa39[_0x187b('0x39')]})[_0x187b('0x23')](function(_0x9416f7){_0x29e3a9[_0x187b('0x1d')]=_0x9416f7;if(_0x594c96['query'][_0x187b('0x42')]){_0x2daa39['include']=[{'all':!![]}];}return db[_0x187b('0x5e')]['findAll'](_0x2daa39);})[_0x187b('0x23')](function(_0x38220a){_0x29e3a9['rows']=_0x38220a;return _0x29e3a9;});}})['then'](respondWithFilteredResult(_0x5d6181,_0x2daa39))[_0x187b('0x4d')](handleError(_0x5d6181,null));};exports['getHopperBlacks']=function(_0x17683b,_0x8268e1,_0x1c1881){var _0x5d2857={'raw':!![],'where':{}};var _0x43bf58={};var _0x5bb3f5={'count':0x0,'rows':[]};return db[_0x187b('0x2a')]['findOne']({'where':{'id':_0x17683b[_0x187b('0x40')]['id']}})['then'](handleEntityNotFound(_0x8268e1,null))[_0x187b('0x23')](function(_0x214d56){if(_0x214d56){_0x43bf58[_0x187b('0x2e')]=_[_0x187b('0x30')](db[_0x187b('0x5f')]['rawAttributes']);_0x43bf58[_0x187b('0x2f')]=_[_0x187b('0x30')](_0x17683b[_0x187b('0x2f')]);_0x43bf58[_0x187b('0x56')]=_['intersection'](_0x43bf58[_0x187b('0x2e')],_0x43bf58['query']);_0x5d2857[_0x187b('0x32')]=_['intersection'](_0x43bf58['model'],qs[_0x187b('0x33')](_0x17683b[_0x187b('0x2f')][_0x187b('0x33')]));_0x5d2857[_0x187b('0x32')]=_0x5d2857[_0x187b('0x32')][_0x187b('0x34')]?_0x5d2857[_0x187b('0x32')]:_0x43bf58[_0x187b('0x2e')];if(!_0x17683b['query']['hasOwnProperty'](_0x187b('0x36'))){_0x5d2857['limit']=qs[_0x187b('0x1c')](_0x17683b[_0x187b('0x2f')][_0x187b('0x1c')]);_0x5d2857[_0x187b('0x1a')]=qs[_0x187b('0x1a')](_0x17683b[_0x187b('0x2f')]['offset']);}_0x5d2857['order']=qs[_0x187b('0x38')](_0x17683b[_0x187b('0x2f')][_0x187b('0x38')]);_0x5d2857['where']=qs[_0x187b('0x56')](_[_0x187b('0x3a')](_0x17683b['query'],_0x43bf58[_0x187b('0x56')]));_0x5d2857[_0x187b('0x39')][_0x187b('0x57')]=_0x214d56['id'];if(_0x17683b['query']['filter']){_0x5d2857[_0x187b('0x39')]=_[_0x187b('0x3b')](_0x5d2857['where'],{'$or':_[_0x187b('0x29')](_0x5d2857[_0x187b('0x32')],function(_0x3a6038){var _0x449952={};_0x449952[_0x3a6038]={'$like':'%'+_0x17683b[_0x187b('0x2f')]['filter']+'%'};return _0x449952;})});}_0x5d2857=_[_0x187b('0x3b')]({},_0x5d2857,_0x17683b[_0x187b('0x43')]);return db['CmHopperBlack']['count']({'where':_0x5d2857[_0x187b('0x39')]})[_0x187b('0x23')](function(_0x25239a){_0x5bb3f5[_0x187b('0x1d')]=_0x25239a;if(_0x17683b['query']['includeAll']){_0x5d2857['include']=[{'all':!![]}];}return db[_0x187b('0x5f')][_0x187b('0x59')](_0x5d2857);})[_0x187b('0x23')](function(_0x555698){_0x5bb3f5[_0x187b('0x3e')]=_0x555698;return _0x5bb3f5;});}})[_0x187b('0x23')](respondWithFilteredResult(_0x8268e1,_0x5d2857))[_0x187b('0x4d')](handleError(_0x8268e1,null));};exports[_0x187b('0x60')]=function(_0x5778b0,_0x281738,_0xc1cf87){var _0x4e119e={};var _0x46413f={};var _0x40212c;var _0xa37ac3;return db['Campaign']['findOne']({'where':{'id':_0x5778b0[_0x187b('0x40')]['id']}})[_0x187b('0x23')](handleEntityNotFound(_0x281738,null))[_0x187b('0x23')](function(_0x3513b1){if(_0x3513b1){_0x40212c=_0x3513b1;_0x46413f[_0x187b('0x2e')]=_[_0x187b('0x30')](db[_0x187b('0x61')][_0x187b('0x41')]);_0x46413f[_0x187b('0x2f')]=_[_0x187b('0x30')](_0x5778b0[_0x187b('0x2f')]);_0x46413f[_0x187b('0x56')]=_[_0x187b('0x31')](_0x46413f[_0x187b('0x2e')],_0x46413f['query']);_0x4e119e[_0x187b('0x32')]=_[_0x187b('0x31')](_0x46413f['model'],qs[_0x187b('0x33')](_0x5778b0[_0x187b('0x2f')][_0x187b('0x33')]));_0x4e119e[_0x187b('0x32')]=_0x4e119e[_0x187b('0x32')]['length']?_0x4e119e[_0x187b('0x32')]:_0x46413f['model'];_0x4e119e[_0x187b('0x37')]=qs[_0x187b('0x38')](_0x5778b0[_0x187b('0x2f')][_0x187b('0x38')]);_0x4e119e[_0x187b('0x39')]=qs[_0x187b('0x56')](_[_0x187b('0x3a')](_0x5778b0[_0x187b('0x2f')],_0x46413f[_0x187b('0x56')]));if(_0x5778b0['query']['filter']){_0x4e119e[_0x187b('0x39')]=_[_0x187b('0x3b')](_0x4e119e[_0x187b('0x39')],{'$or':_[_0x187b('0x29')](_0x4e119e[_0x187b('0x32')],function(_0x2d74d6){var _0x3e056e={};_0x3e056e[_0x2d74d6]={'$like':'%'+_0x5778b0[_0x187b('0x2f')][_0x187b('0x58')]+'%'};return _0x3e056e;})});}_0x4e119e=_[_0x187b('0x3b')]({},_0x4e119e,_0x5778b0[_0x187b('0x43')]);return _0x40212c[_0x187b('0x60')](_0x4e119e);}})[_0x187b('0x23')](function(_0x2c7e59){if(_0x2c7e59){_0xa37ac3=_0x2c7e59[_0x187b('0x34')];if(!_0x5778b0['query'][_0x187b('0x35')](_0x187b('0x36'))){_0x4e119e[_0x187b('0x1c')]=qs[_0x187b('0x1c')](_0x5778b0[_0x187b('0x2f')][_0x187b('0x1c')]);_0x4e119e[_0x187b('0x1a')]=qs[_0x187b('0x1a')](_0x5778b0['query']['offset']);}return _0x40212c[_0x187b('0x60')](_0x4e119e);}})[_0x187b('0x23')](function(_0x3e2c25){if(_0x3e2c25){return _0x3e2c25?{'count':_0xa37ac3,'rows':_0x3e2c25}:null;}})[_0x187b('0x23')](respondWithResult(_0x281738,null))[_0x187b('0x4d')](handleError(_0x281738,null));};exports[_0x187b('0x62')]=function(_0x59cbc2,_0x5e4288,_0x2eb1d2){var _0x3aa511,_0x31d528;return db[_0x187b('0x2a')][_0x187b('0x50')]({'where':{'id':_0x59cbc2['params']['id']}})[_0x187b('0x23')](handleEntityNotFound(_0x5e4288,null))[_0x187b('0x23')](function(_0x19d982){if(_0x19d982){_0x31d528=_0x19d982;return _0x19d982[_0x187b('0x62')](_0x59cbc2['body'][_0x187b('0x63')],_[_0x187b('0x53')](_0x59cbc2[_0x187b('0x45')],[_0x187b('0x63'),'id'])||{});}return null;})[_0x187b('0x64')](function(_0x55e41f){var _0x379f8f;_0x3aa511=_0x55e41f||[];var _0x40ffa8=[];if(_0x55e41f){for(var _0xf510e1=0x0;_0xf510e1<_0x55e41f[_0x187b('0x34')];_0xf510e1+=0x1){var _0x15e2a7=_0x55e41f[_0xf510e1][_0x187b('0x24')]({'plain':!![]});_0x31d528[_0x187b('0x65')]=_0x59cbc2['body'][_0x187b('0x65')]?_0x59cbc2[_0x187b('0x45')][_0x187b('0x65')]:_0x31d528[_0x187b('0x65')];switch(_0x31d528[_0x187b('0x65')]){case _0x187b('0x66'):_0x379f8f=squel[_0x187b('0x67')]()[_0x187b('0x68')]('cm_hopper')['fromQuery'](['phone',_0x187b('0x69'),'ContactId',_0x187b('0x6a'),_0x187b('0x57'),_0x187b('0x51'),_0x187b('0x52')],squel[_0x187b('0x6b')]()[_0x187b('0x6c')]('phone',_0x187b('0x6d'))['field'](_0x187b('0x6e'),_0x187b('0x69'))[_0x187b('0x6c')]('id',_0x187b('0x6f'))[_0x187b('0x6c')](_0x15e2a7[_0x187b('0x70')][_0x187b('0x71')](),'ListId')[_0x187b('0x6c')](_0x59cbc2[_0x187b('0x40')]['id'][_0x187b('0x71')](),_0x187b('0x57'))[_0x187b('0x6c')](_0x187b('0x6e'),'createdAt')['field'](_0x187b('0x6e'),_0x187b('0x52'))[_0x187b('0x72')](_0x187b('0x73'))[_0x187b('0x39')](_0x187b('0x74'))[_0x187b('0x39')](_0x187b('0x75'),_0x15e2a7[_0x187b('0x70')][_0x187b('0x71')]())[_0x187b('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x187b('0x39')](_0x187b('0x76'),squel[_0x187b('0x6b')]()[_0x187b('0x6c')](_0x187b('0x77'))[_0x187b('0x72')]('cm_hopper_final')['where'](_0x187b('0x78'),_0x59cbc2['params']['id']['toString']()))[_0x187b('0x39')](_0x187b('0x76'),squel[_0x187b('0x6b')]()[_0x187b('0x6c')](_0x187b('0x79'))[_0x187b('0x72')](_0x187b('0x7a'))[_0x187b('0x39')](_0x187b('0x78'),_0x59cbc2[_0x187b('0x40')]['id'][_0x187b('0x71')]())))[_0x187b('0x71')]();break;case'onlyIfOpen':_0x379f8f=squel[_0x187b('0x67')]()[_0x187b('0x68')](_0x187b('0x7a'))[_0x187b('0x7b')]([_0x187b('0x6d'),'scheduledAt',_0x187b('0x6f'),_0x187b('0x6a'),_0x187b('0x57'),_0x187b('0x51'),'updatedAt'],squel[_0x187b('0x6b')]()[_0x187b('0x6c')]('phone','phone')[_0x187b('0x6c')](_0x187b('0x6e'),_0x187b('0x69'))[_0x187b('0x6c')]('id',_0x187b('0x6f'))[_0x187b('0x6c')](_0x15e2a7[_0x187b('0x70')][_0x187b('0x71')](),'ListId')[_0x187b('0x6c')](_0x59cbc2[_0x187b('0x40')]['id'][_0x187b('0x71')](),_0x187b('0x57'))[_0x187b('0x6c')](_0x187b('0x6e'),_0x187b('0x51'))[_0x187b('0x6c')]('NOW()','updatedAt')[_0x187b('0x72')]('cm_contacts')[_0x187b('0x39')](_0x187b('0x74'))['where'](_0x187b('0x75'),_0x15e2a7[_0x187b('0x70')][_0x187b('0x71')]())[_0x187b('0x39')](_0x187b('0x7c'))[_0x187b('0x39')](_0x187b('0x76'),squel[_0x187b('0x6b')]()[_0x187b('0x6c')](_0x187b('0x79'))['from'](_0x187b('0x7a'))[_0x187b('0x39')]('CampaignId\x20=\x20?',_0x59cbc2[_0x187b('0x40')]['id'][_0x187b('0x71')]())))[_0x187b('0x71')]();break;default:_0x379f8f=squel[_0x187b('0x67')]()[_0x187b('0x68')](_0x187b('0x7a'))['fromQuery']([_0x187b('0x6d'),_0x187b('0x69'),_0x187b('0x6f'),_0x187b('0x6a'),_0x187b('0x57'),_0x187b('0x51'),_0x187b('0x52')],squel[_0x187b('0x6b')]()[_0x187b('0x6c')](_0x187b('0x6d'),'phone')[_0x187b('0x6c')](_0x187b('0x6e'),_0x187b('0x69'))[_0x187b('0x6c')]('id',_0x187b('0x6f'))[_0x187b('0x6c')](_0x15e2a7['CmListId'][_0x187b('0x71')](),'ListId')[_0x187b('0x6c')](_0x59cbc2[_0x187b('0x40')]['id']['toString'](),_0x187b('0x57'))[_0x187b('0x6c')](_0x187b('0x6e'),_0x187b('0x51'))['field'](_0x187b('0x6e'),_0x187b('0x52'))['from'](_0x187b('0x73'))[_0x187b('0x39')](_0x187b('0x74'))['where'](_0x187b('0x75'),_0x15e2a7[_0x187b('0x70')]['toString']())[_0x187b('0x39')](_0x187b('0x7c')))[_0x187b('0x71')]();}_0x40ffa8[_0x187b('0x7d')](db[_0x187b('0x7e')][_0x187b('0x2f')](_0x379f8f));}return BPromise[_0x187b('0x7f')](_0x40ffa8);}})[_0x187b('0x23')](function(){return _0x3aa511;})[_0x187b('0x23')](respondWithResult(_0x5e4288,null))[_0x187b('0x4d')](handleError(_0x5e4288,null));};exports[_0x187b('0x80')]=function(_0xeb5c31,_0x28e50d,_0x5defab){return db[_0x187b('0x2a')][_0x187b('0x50')]({'where':{'id':_0xeb5c31[_0x187b('0x40')]['id']}})['then'](handleEntityNotFound(_0x28e50d,null))[_0x187b('0x23')](function(_0x44364e){if(_0x44364e){return _0x44364e[_0x187b('0x80')](_0xeb5c31[_0x187b('0x2f')]['ids']);}})[_0x187b('0x23')](function(_0x42612f){if(_0x42612f){return db[_0x187b('0x55')][_0x187b('0x25')]({'where':{'ListId':_0xeb5c31[_0x187b('0x2f')][_0x187b('0x63')],'CampaignId':_0xeb5c31[_0x187b('0x40')]['id']}})['then'](function(){return _0x42612f;});}})[_0x187b('0x23')](respondWithStatusCode(_0x28e50d,null))[_0x187b('0x4d')](handleError(_0x28e50d,null));};exports[_0x187b('0x81')]=function(_0x68ab42,_0x13e0f3,_0x28fe52){var _0x57312c={};var _0x2b76be={};var _0x1040ff;var _0x3f879f;return db[_0x187b('0x2a')][_0x187b('0x5b')]({'where':{'id':_0x68ab42[_0x187b('0x40')]['id']}})['then'](handleEntityNotFound(_0x13e0f3,null))[_0x187b('0x23')](function(_0x231bd2){if(_0x231bd2){_0x1040ff=_0x231bd2;_0x2b76be['model']=_['keys'](db['CmList']['rawAttributes']);_0x2b76be[_0x187b('0x2f')]=_[_0x187b('0x30')](_0x68ab42[_0x187b('0x2f')]);_0x2b76be['filters']=_[_0x187b('0x31')](_0x2b76be[_0x187b('0x2e')],_0x2b76be[_0x187b('0x2f')]);_0x57312c[_0x187b('0x32')]=_['intersection'](_0x2b76be[_0x187b('0x2e')],qs['fields'](_0x68ab42[_0x187b('0x2f')][_0x187b('0x33')]));_0x57312c[_0x187b('0x32')]=_0x57312c['attributes']['length']?_0x57312c[_0x187b('0x32')]:_0x2b76be[_0x187b('0x2e')];_0x57312c[_0x187b('0x37')]=qs['sort'](_0x68ab42[_0x187b('0x2f')][_0x187b('0x38')]);_0x57312c[_0x187b('0x39')]=qs[_0x187b('0x56')](_[_0x187b('0x3a')](_0x68ab42[_0x187b('0x2f')],_0x2b76be[_0x187b('0x56')]));if(_0x68ab42['query'][_0x187b('0x58')]){_0x57312c['where']=_[_0x187b('0x3b')](_0x57312c[_0x187b('0x39')],{'$or':_['map'](_0x57312c[_0x187b('0x32')],function(_0x4d4353){var _0x5da7e9={};_0x5da7e9[_0x4d4353]={'$like':'%'+_0x68ab42[_0x187b('0x2f')][_0x187b('0x58')]+'%'};return _0x5da7e9;})});}_0x57312c=_[_0x187b('0x3b')]({},_0x57312c,_0x68ab42[_0x187b('0x43')]);return _0x1040ff[_0x187b('0x81')](_0x57312c);}})[_0x187b('0x23')](function(_0x293da3){if(_0x293da3){_0x3f879f=_0x293da3[_0x187b('0x34')];if(!_0x68ab42[_0x187b('0x2f')]['hasOwnProperty'](_0x187b('0x36'))){_0x57312c[_0x187b('0x1c')]=qs[_0x187b('0x1c')](_0x68ab42['query']['limit']);_0x57312c[_0x187b('0x1a')]=qs[_0x187b('0x1a')](_0x68ab42[_0x187b('0x2f')][_0x187b('0x1a')]);}return _0x1040ff['getBlackLists'](_0x57312c);}})[_0x187b('0x23')](function(_0x4e1cc7){if(_0x4e1cc7){return _0x4e1cc7?{'count':_0x3f879f,'rows':_0x4e1cc7}:null;}})[_0x187b('0x23')](respondWithResult(_0x13e0f3,null))[_0x187b('0x4d')](handleError(_0x13e0f3,null));};exports[_0x187b('0x82')]=function(_0x38024a,_0x2de918,_0xb62081){var _0x4fd81a,_0x58841b;return db['Campaign']['find']({'where':{'id':_0x38024a[_0x187b('0x40')]['id']}})[_0x187b('0x23')](handleEntityNotFound(_0x2de918,null))['then'](function(_0x12c0fd){if(_0x12c0fd){_0x58841b=_0x12c0fd;return _0x12c0fd[_0x187b('0x82')](_0x38024a['body'][_0x187b('0x63')],_[_0x187b('0x53')](_0x38024a[_0x187b('0x45')],[_0x187b('0x63'),'id'])||{});}return null;})['spread'](function(_0x6930a4){var _0x3852c5;_0x4fd81a=_0x6930a4||[];var _0xf9ddbd=[];if(_0x6930a4){for(var _0x2ff87e=0x0;_0x2ff87e<_0x6930a4[_0x187b('0x34')];_0x2ff87e+=0x1){var _0x21abb1=_0x6930a4[_0x2ff87e][_0x187b('0x24')]({'plain':!![]});_0x3852c5=squel[_0x187b('0x67')]()[_0x187b('0x68')](_0x187b('0x83'))['fromQuery']([_0x187b('0x6d'),_0x187b('0x6f'),'ListId',_0x187b('0x57'),'createdAt',_0x187b('0x52')],squel[_0x187b('0x6b')]()[_0x187b('0x6c')](_0x187b('0x6d'),_0x187b('0x6d'))[_0x187b('0x6c')]('id',_0x187b('0x6f'))[_0x187b('0x6c')](_0x21abb1[_0x187b('0x70')][_0x187b('0x71')](),'ListId')[_0x187b('0x6c')](_0x38024a[_0x187b('0x40')]['id'][_0x187b('0x71')](),_0x187b('0x57'))[_0x187b('0x6c')](_0x187b('0x6e'),_0x187b('0x51'))['field'](_0x187b('0x6e'),'updatedAt')[_0x187b('0x72')]('cm_contacts')['where'](_0x187b('0x74'))[_0x187b('0x39')](_0x187b('0x75'),_0x21abb1[_0x187b('0x70')][_0x187b('0x71')]())[_0x187b('0x39')](_0x187b('0x7c')))[_0x187b('0x71')]();_0xf9ddbd['push'](db[_0x187b('0x7e')][_0x187b('0x2f')](_0x3852c5));}return BPromise['all'](_0xf9ddbd);}})[_0x187b('0x23')](function(){return _0x4fd81a;})[_0x187b('0x23')](respondWithResult(_0x2de918,null))[_0x187b('0x4d')](handleError(_0x2de918,null));};exports[_0x187b('0x84')]=function(_0x22119c,_0x76c849,_0x4b5248){return db[_0x187b('0x2a')]['find']({'where':{'id':_0x22119c[_0x187b('0x40')]['id']}})['then'](handleEntityNotFound(_0x76c849,null))[_0x187b('0x23')](function(_0x59c7c6){if(_0x59c7c6){return _0x59c7c6['removeBlackLists'](_0x22119c[_0x187b('0x2f')][_0x187b('0x63')]);}})[_0x187b('0x23')](function(_0xd7406b){if(_0xd7406b){return db[_0x187b('0x5f')][_0x187b('0x25')]({'where':{'ListId':_0x22119c[_0x187b('0x2f')]['ids'],'CampaignId':_0x22119c['params']['id']}})[_0x187b('0x23')](function(){return _0xd7406b;});}})[_0x187b('0x23')](respondWithStatusCode(_0x76c849,null))['catch'](handleError(_0x76c849,null));}; \ No newline at end of file +var _0xbc69=['select','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','cm_hopper_black','ListId\x20=\x20?','removeBlackLists','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','get','UserProfileResource','destroy','sendStatus','name','send','map','Campaign','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','rawAttributes','includeAll','find','catch','create','body','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','params','getHoppers','findOne','CmHopper','order','rows','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0xbc69,0x118));var _0x9bc6=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xbc69[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require(_0x9bc6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9bc6('0x1'));var rp=require('request-promise');var moment=require(_0x9bc6('0x2'));var BPromise=require(_0x9bc6('0x3'));var Mustache=require(_0x9bc6('0x4'));var util=require(_0x9bc6('0x5'));var path=require('path');var sox=require(_0x9bc6('0x6'));var csv=require('to-csv');var ejs=require(_0x9bc6('0x7'));var fs=require('fs');var fs_extra=require(_0x9bc6('0x8'));var _=require(_0x9bc6('0x9'));var squel=require(_0x9bc6('0xa'));var crypto=require(_0x9bc6('0xb'));var jsforce=require(_0x9bc6('0xc'));var deskjs=require(_0x9bc6('0xd'));var toCsv=require(_0x9bc6('0xe'));var querystring=require('querystring');var Papa=require(_0x9bc6('0xf'));var Redis=require(_0x9bc6('0x10'));var authService=require(_0x9bc6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9bc6('0x12'));var hardwareService=require(_0x9bc6('0x13'));var logger=require(_0x9bc6('0x14'))(_0x9bc6('0x15'));var utils=require('../../config/utils');var config=require(_0x9bc6('0x16'));var licenseUtil=require(_0x9bc6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24516b,_0x1adb08){_0x1adb08=_0x1adb08||0xcc;return function(_0x416dd1){if(_0x416dd1){return _0x24516b['sendStatus'](_0x1adb08);}return _0x24516b[_0x9bc6('0x18')](_0x1adb08)[_0x9bc6('0x19')]();};}function respondWithResult(_0x43813a,_0x5adb97){_0x5adb97=_0x5adb97||0xc8;return function(_0x53be4e){if(_0x53be4e){return _0x43813a[_0x9bc6('0x18')](_0x5adb97)[_0x9bc6('0x1a')](_0x53be4e);}};}function respondWithFilteredResult(_0x2226d1,_0x13c11c){return function(_0xf0034){if(_0xf0034){var _0x11cbc3=typeof _0x13c11c[_0x9bc6('0x1b')]===_0x9bc6('0x1c')&&typeof _0x13c11c[_0x9bc6('0x1d')]===_0x9bc6('0x1c');var _0x39c29f=_0xf0034[_0x9bc6('0x1e')];var _0xac9462=_0x11cbc3?0x0:_0x13c11c[_0x9bc6('0x1b')];var _0x4ebbad=_0x11cbc3?_0xf0034['count']:_0x13c11c['offset']+_0x13c11c['limit'];var _0x4511dd;if(_0x4ebbad>=_0x39c29f){_0x4ebbad=_0x39c29f;_0x4511dd=0xc8;}else{_0x4511dd=0xce;}_0x2226d1[_0x9bc6('0x18')](_0x4511dd);return _0x2226d1['set'](_0x9bc6('0x1f'),_0xac9462+'-'+_0x4ebbad+'/'+_0x39c29f)[_0x9bc6('0x1a')](_0xf0034);}return null;};}function patchUpdates(_0x4fa696){return function(_0x4f14ed){try{jsonpatch[_0x9bc6('0x20')](_0x4f14ed,_0x4fa696,!![]);}catch(_0x536c9f){return BPromise[_0x9bc6('0x21')](_0x536c9f);}return _0x4f14ed['save']();};}function saveUpdates(_0x5751f8,_0x510df8){return function(_0x3db144){if(_0x3db144){return _0x3db144['update'](_0x5751f8)[_0x9bc6('0x22')](function(_0x7aee53){return _0x7aee53;});}return null;};}function removeEntity(_0x280ffb,_0x582fe6){return function(_0x5e849a){if(_0x5e849a){return _0x5e849a['destroy']()[_0x9bc6('0x22')](function(){var _0x1426d4=_0x5e849a[_0x9bc6('0x23')]({'plain':!![]});var _0x4e628f='IvrCampaigns';return db[_0x9bc6('0x24')][_0x9bc6('0x25')]({'where':{'type':_0x4e628f,'resourceId':_0x1426d4['id']}})[_0x9bc6('0x22')](function(){return _0x5e849a;});})['then'](function(){_0x280ffb[_0x9bc6('0x18')](0xcc)[_0x9bc6('0x19')]();});}};}function handleEntityNotFound(_0x2e2421,_0x50876d){return function(_0x274b89){if(!_0x274b89){_0x2e2421[_0x9bc6('0x26')](0x194);}return _0x274b89;};}function handleError(_0x359f5e,_0x18fb40){_0x18fb40=_0x18fb40||0x1f4;return function(_0x2d431a){logger['error'](_0x2d431a['stack']);if(_0x2d431a[_0x9bc6('0x27')]){delete _0x2d431a[_0x9bc6('0x27')];}_0x359f5e[_0x9bc6('0x18')](_0x18fb40)[_0x9bc6('0x28')](_0x2d431a);};}exports['index']=function(_0x13ed85,_0x21f811){var _0x3cb6fd={},_0xfc9182={},_0x2f4d50={'count':0x0,'rows':[]};var _0x37db18=_[_0x9bc6('0x29')](db[_0x9bc6('0x2a')]['rawAttributes'],function(_0x1764a3){return{'name':_0x1764a3[_0x9bc6('0x2b')],'type':_0x1764a3[_0x9bc6('0x2c')][_0x9bc6('0x2d')]};});_0xfc9182[_0x9bc6('0x2e')]=_[_0x9bc6('0x29')](_0x37db18,_0x9bc6('0x27'));_0xfc9182[_0x9bc6('0x2f')]=_[_0x9bc6('0x30')](_0x13ed85[_0x9bc6('0x2f')]);_0xfc9182['filters']=_[_0x9bc6('0x31')](_0xfc9182[_0x9bc6('0x2e')],_0xfc9182[_0x9bc6('0x2f')]);_0x3cb6fd['attributes']=_[_0x9bc6('0x31')](_0xfc9182[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0x13ed85['query'][_0x9bc6('0x32')]));_0x3cb6fd['attributes']=_0x3cb6fd[_0x9bc6('0x33')][_0x9bc6('0x34')]?_0x3cb6fd[_0x9bc6('0x33')]:_0xfc9182['model'];if(!_0x13ed85[_0x9bc6('0x2f')][_0x9bc6('0x35')](_0x9bc6('0x36'))){_0x3cb6fd[_0x9bc6('0x1d')]=qs[_0x9bc6('0x1d')](_0x13ed85[_0x9bc6('0x2f')]['limit']);_0x3cb6fd[_0x9bc6('0x1b')]=qs[_0x9bc6('0x1b')](_0x13ed85[_0x9bc6('0x2f')]['offset']);}_0x3cb6fd['order']=qs[_0x9bc6('0x37')](_0x13ed85[_0x9bc6('0x2f')][_0x9bc6('0x37')]);_0x3cb6fd['where']=qs[_0x9bc6('0x38')](_[_0x9bc6('0x39')](_0x13ed85[_0x9bc6('0x2f')],_0xfc9182[_0x9bc6('0x38')]),_0x37db18);if(_0x13ed85[_0x9bc6('0x2f')][_0x9bc6('0x3a')]){_0x3cb6fd[_0x9bc6('0x3b')]=_[_0x9bc6('0x3c')](_0x3cb6fd[_0x9bc6('0x3b')],{'$or':_['map'](_0x37db18,function(_0x52c125){if(_0x52c125[_0x9bc6('0x2c')]!==_0x9bc6('0x3d')){var _0x18f5bd={};_0x18f5bd[_0x52c125['name']]={'$like':'%'+_0x13ed85['query']['filter']+'%'};return _0x18f5bd;}})});}_0x3cb6fd=_['merge']({},_0x3cb6fd,_0x13ed85[_0x9bc6('0x3e')]);var _0x409877={'where':_0x3cb6fd[_0x9bc6('0x3b')]};return db[_0x9bc6('0x2a')][_0x9bc6('0x1e')](_0x409877)['then'](function(_0x1bfbcc){_0x2f4d50[_0x9bc6('0x1e')]=_0x1bfbcc;if(_0x13ed85[_0x9bc6('0x2f')]['includeAll']){_0x3cb6fd[_0x9bc6('0x3f')]=[{'all':!![]}];}return db[_0x9bc6('0x2a')][_0x9bc6('0x40')](_0x3cb6fd);})[_0x9bc6('0x22')](function(_0x375f61){_0x2f4d50['rows']=_0x375f61;return _0x2f4d50;})[_0x9bc6('0x22')](respondWithFilteredResult(_0x21f811,_0x3cb6fd))['catch'](handleError(_0x21f811,null));};exports[_0x9bc6('0x41')]=function(_0x5bd9ee,_0x2a1843){var _0x1de11={'raw':![],'where':{'id':_0x5bd9ee['params']['id']}},_0x4880fa={};_0x4880fa[_0x9bc6('0x2e')]=_[_0x9bc6('0x30')](db[_0x9bc6('0x2a')][_0x9bc6('0x42')]);_0x4880fa[_0x9bc6('0x2f')]=_[_0x9bc6('0x30')](_0x5bd9ee[_0x9bc6('0x2f')]);_0x4880fa[_0x9bc6('0x38')]=_[_0x9bc6('0x31')](_0x4880fa[_0x9bc6('0x2e')],_0x4880fa['query']);_0x1de11[_0x9bc6('0x33')]=_['intersection'](_0x4880fa[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0x5bd9ee['query'][_0x9bc6('0x32')]));_0x1de11[_0x9bc6('0x33')]=_0x1de11[_0x9bc6('0x33')]['length']?_0x1de11[_0x9bc6('0x33')]:_0x4880fa[_0x9bc6('0x2e')];if(_0x5bd9ee[_0x9bc6('0x2f')][_0x9bc6('0x43')]){_0x1de11[_0x9bc6('0x3f')]=[{'all':!![]}];}_0x1de11=_[_0x9bc6('0x3c')]({},_0x1de11,_0x5bd9ee[_0x9bc6('0x3e')]);return db[_0x9bc6('0x2a')][_0x9bc6('0x44')](_0x1de11)['then'](handleEntityNotFound(_0x2a1843,null))[_0x9bc6('0x22')](respondWithResult(_0x2a1843,null))[_0x9bc6('0x45')](handleError(_0x2a1843,null));};exports[_0x9bc6('0x46')]=function(_0x522a72,_0x5473d2){return db[_0x9bc6('0x2a')][_0x9bc6('0x46')](_0x522a72[_0x9bc6('0x47')],{})[_0x9bc6('0x22')](function(_0x177303){var _0x9e6d13=_0x522a72['user'][_0x9bc6('0x23')]({'plain':!![]});if(!_0x9e6d13)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9e6d13[_0x9bc6('0x48')]===_0x9bc6('0x49')){var _0x2b6a27=_0x177303[_0x9bc6('0x23')]({'plain':!![]});var _0x4dbf23='IvrCampaigns';return db[_0x9bc6('0x4a')]['find']({'where':{'name':_0x4dbf23,'userProfileId':_0x9e6d13['userProfileId']},'raw':!![]})[_0x9bc6('0x22')](function(_0x5a1a95){if(_0x5a1a95&&_0x5a1a95['autoAssociation']===0x0){return db[_0x9bc6('0x24')][_0x9bc6('0x46')]({'name':_0x2b6a27['name'],'resourceId':_0x2b6a27['id'],'type':_0x5a1a95[_0x9bc6('0x27')],'sectionId':_0x5a1a95['id']},{})['then'](function(){return _0x177303;});}else{return _0x177303;}})[_0x9bc6('0x45')](function(_0x95f513){logger[_0x9bc6('0x4b')](_0x9bc6('0x4c'),_0x95f513);throw _0x95f513;});}return _0x177303;})['then'](respondWithResult(_0x5473d2,0xc9))[_0x9bc6('0x45')](handleError(_0x5473d2,null));};exports[_0x9bc6('0x4d')]=function(_0xf0c33b,_0x576480){var _0x1725d6={'where':{'id':_0xf0c33b['params']['id']}},_0x2a1559={};_0x2a1559[_0x9bc6('0x2e')]=_[_0x9bc6('0x30')](db[_0x9bc6('0x2a')]['rawAttributes']);_0x1725d6[_0x9bc6('0x33')]=_[_0x9bc6('0x31')](_0x2a1559[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0xf0c33b[_0x9bc6('0x2f')][_0x9bc6('0x32')]));_0x1725d6['attributes']=_0x1725d6[_0x9bc6('0x33')][_0x9bc6('0x34')]?_0x1725d6[_0x9bc6('0x33')]:_0x2a1559[_0x9bc6('0x2e')];if(_0xf0c33b['query'][_0x9bc6('0x43')]){_0x1725d6['include']=[{'all':!![]}];}_0x1725d6=_['merge']({},_0x1725d6,_0xf0c33b[_0x9bc6('0x3e')]);return db[_0x9bc6('0x2a')][_0x9bc6('0x44')](_0x1725d6)[_0x9bc6('0x22')](handleEntityNotFound(_0x576480,null))[_0x9bc6('0x22')](function(_0x2f5ce7){if(_0x2f5ce7){var _0x4dd400=_0x2f5ce7[_0x9bc6('0x23')]({'plain':!![]});_0x4dd400=qs[_0x9bc6('0x4e')](_0x4dd400,['id',_0x9bc6('0x4f'),'updatedAt']);_0xf0c33b[_0x9bc6('0x47')]=_['omit'](_0xf0c33b[_0x9bc6('0x47')],['id',_0x9bc6('0x4f'),_0x9bc6('0x50')]);return db[_0x9bc6('0x2a')][_0x9bc6('0x46')](_[_0x9bc6('0x3c')](_0x4dd400,_0xf0c33b['body']),{'include':_0xf0c33b['query']['includeAll']?[{'all':!![]}]:undefined})[_0x9bc6('0x22')](function(_0x3bbf9f){var _0x3dd28f=_0xf0c33b[_0x9bc6('0x49')][_0x9bc6('0x23')]({'plain':!![]});if(!_0x3dd28f)throw new Error(_0x9bc6('0x51'));if(_0x3dd28f[_0x9bc6('0x48')]===_0x9bc6('0x49')){var _0x10d9da=_0x3bbf9f[_0x9bc6('0x23')]({'plain':!![]});var _0xaae041='IvrCampaigns';return db['UserProfileSection'][_0x9bc6('0x44')]({'where':{'name':_0xaae041,'userProfileId':_0x3dd28f[_0x9bc6('0x52')]},'raw':!![]})['then'](function(_0x87ec59){if(_0x87ec59&&_0x87ec59[_0x9bc6('0x53')]===0x0){return db[_0x9bc6('0x24')][_0x9bc6('0x46')]({'name':_0x10d9da[_0x9bc6('0x27')],'resourceId':_0x10d9da['id'],'type':_0x87ec59[_0x9bc6('0x27')],'sectionId':_0x87ec59['id']},{})[_0x9bc6('0x22')](function(){return _0x3bbf9f;});}else{return _0x3bbf9f;}})[_0x9bc6('0x45')](function(_0x1d42e0){logger[_0x9bc6('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d42e0);throw _0x1d42e0;});}return _0x3bbf9f;});}})['then'](respondWithResult(_0x576480,0xc9))[_0x9bc6('0x45')](handleError(_0x576480,null));};exports[_0x9bc6('0x54')]=function(_0x385283,_0x501c2a){if(_0x385283[_0x9bc6('0x47')]['id']){delete _0x385283['body']['id'];}return db[_0x9bc6('0x2a')][_0x9bc6('0x44')]({'where':{'id':_0x385283[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x501c2a,null))[_0x9bc6('0x22')](saveUpdates(_0x385283[_0x9bc6('0x47')],null))[_0x9bc6('0x22')](respondWithResult(_0x501c2a,null))[_0x9bc6('0x45')](handleError(_0x501c2a,null));};exports[_0x9bc6('0x25')]=function(_0x571284,_0x1e966a){return db[_0x9bc6('0x2a')]['find']({'where':{'id':_0x571284['params']['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x1e966a,null))['then'](removeEntity(_0x1e966a,null))[_0x9bc6('0x45')](handleError(_0x1e966a,null));};exports[_0x9bc6('0x56')]=function(_0x3357f9,_0x4886db,_0xac23fd){var _0x597c4c={'raw':!![],'where':{}};var _0x2e55db={};var _0x4bcfd9={'count':0x0,'rows':[]};return db['Campaign'][_0x9bc6('0x57')]({'where':{'id':_0x3357f9[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x4886db,null))['then'](function(_0x4102ba){if(_0x4102ba){_0x2e55db[_0x9bc6('0x2e')]=_[_0x9bc6('0x30')](db[_0x9bc6('0x58')][_0x9bc6('0x42')]);_0x2e55db[_0x9bc6('0x2f')]=_[_0x9bc6('0x30')](_0x3357f9[_0x9bc6('0x2f')]);_0x2e55db['filters']=_[_0x9bc6('0x31')](_0x2e55db['model'],_0x2e55db[_0x9bc6('0x2f')]);_0x597c4c[_0x9bc6('0x33')]=_[_0x9bc6('0x31')](_0x2e55db[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0x3357f9[_0x9bc6('0x2f')][_0x9bc6('0x32')]));_0x597c4c[_0x9bc6('0x33')]=_0x597c4c[_0x9bc6('0x33')][_0x9bc6('0x34')]?_0x597c4c[_0x9bc6('0x33')]:_0x2e55db[_0x9bc6('0x2e')];if(!_0x3357f9['query'][_0x9bc6('0x35')](_0x9bc6('0x36'))){_0x597c4c['limit']=qs[_0x9bc6('0x1d')](_0x3357f9['query']['limit']);_0x597c4c[_0x9bc6('0x1b')]=qs[_0x9bc6('0x1b')](_0x3357f9[_0x9bc6('0x2f')][_0x9bc6('0x1b')]);}_0x597c4c[_0x9bc6('0x59')]=qs[_0x9bc6('0x37')](_0x3357f9[_0x9bc6('0x2f')][_0x9bc6('0x37')]);_0x597c4c['where']=qs['filters'](_[_0x9bc6('0x39')](_0x3357f9[_0x9bc6('0x2f')],_0x2e55db[_0x9bc6('0x38')]));_0x597c4c[_0x9bc6('0x3b')]['CampaignId']=_0x4102ba['id'];if(_0x3357f9[_0x9bc6('0x2f')][_0x9bc6('0x3a')]){_0x597c4c['where']=_['merge'](_0x597c4c[_0x9bc6('0x3b')],{'$or':_[_0x9bc6('0x29')](_0x597c4c[_0x9bc6('0x33')],function(_0x48312e){var _0x2337d3={};_0x2337d3[_0x48312e]={'$like':'%'+_0x3357f9['query'][_0x9bc6('0x3a')]+'%'};return _0x2337d3;})});}_0x597c4c=_[_0x9bc6('0x3c')]({},_0x597c4c,_0x3357f9[_0x9bc6('0x3e')]);return db['CmHopper'][_0x9bc6('0x1e')]({'where':_0x597c4c[_0x9bc6('0x3b')]})[_0x9bc6('0x22')](function(_0x44c639){_0x4bcfd9[_0x9bc6('0x1e')]=_0x44c639;if(_0x3357f9[_0x9bc6('0x2f')][_0x9bc6('0x43')]){_0x597c4c[_0x9bc6('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x9bc6('0x40')](_0x597c4c);})['then'](function(_0x291a32){_0x4bcfd9[_0x9bc6('0x5a')]=_0x291a32;return _0x4bcfd9;});}})[_0x9bc6('0x22')](respondWithFilteredResult(_0x4886db,_0x597c4c))[_0x9bc6('0x45')](handleError(_0x4886db,null));};exports[_0x9bc6('0x5b')]=function(_0x3f9c43,_0x2e4f15,_0x3e6f2c){var _0x202984={'raw':!![],'where':{}};var _0x53d73c={};var _0x2a2cb0={'count':0x0,'rows':[]};return db['Campaign'][_0x9bc6('0x57')]({'where':{'id':_0x3f9c43[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x2e4f15,null))['then'](function(_0x15f8f2){if(_0x15f8f2){_0x53d73c[_0x9bc6('0x2e')]=_[_0x9bc6('0x30')](db[_0x9bc6('0x5c')][_0x9bc6('0x42')]);_0x53d73c['query']=_[_0x9bc6('0x30')](_0x3f9c43['query']);_0x53d73c[_0x9bc6('0x38')]=_[_0x9bc6('0x31')](_0x53d73c['model'],_0x53d73c['query']);_0x202984[_0x9bc6('0x33')]=_[_0x9bc6('0x31')](_0x53d73c[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0x3f9c43[_0x9bc6('0x2f')][_0x9bc6('0x32')]));_0x202984[_0x9bc6('0x33')]=_0x202984[_0x9bc6('0x33')][_0x9bc6('0x34')]?_0x202984[_0x9bc6('0x33')]:_0x53d73c[_0x9bc6('0x2e')];if(!_0x3f9c43['query'][_0x9bc6('0x35')]('nolimit')){_0x202984[_0x9bc6('0x1d')]=qs[_0x9bc6('0x1d')](_0x3f9c43['query'][_0x9bc6('0x1d')]);_0x202984[_0x9bc6('0x1b')]=qs['offset'](_0x3f9c43['query']['offset']);}_0x202984[_0x9bc6('0x59')]=qs[_0x9bc6('0x37')](_0x3f9c43[_0x9bc6('0x2f')][_0x9bc6('0x37')]);_0x202984['where']=qs[_0x9bc6('0x38')](_[_0x9bc6('0x39')](_0x3f9c43[_0x9bc6('0x2f')],_0x53d73c[_0x9bc6('0x38')]));_0x202984[_0x9bc6('0x3b')][_0x9bc6('0x5d')]=_0x15f8f2['id'];if(_0x3f9c43[_0x9bc6('0x2f')][_0x9bc6('0x3a')]){_0x202984['where']=_[_0x9bc6('0x3c')](_0x202984[_0x9bc6('0x3b')],{'$or':_[_0x9bc6('0x29')](_0x202984[_0x9bc6('0x33')],function(_0x767880){var _0x564549={};_0x564549[_0x767880]={'$like':'%'+_0x3f9c43[_0x9bc6('0x2f')][_0x9bc6('0x3a')]+'%'};return _0x564549;})});}_0x202984=_[_0x9bc6('0x3c')]({},_0x202984,_0x3f9c43[_0x9bc6('0x3e')]);return db[_0x9bc6('0x5c')]['count']({'where':_0x202984[_0x9bc6('0x3b')]})[_0x9bc6('0x22')](function(_0x379a50){_0x2a2cb0[_0x9bc6('0x1e')]=_0x379a50;if(_0x3f9c43[_0x9bc6('0x2f')][_0x9bc6('0x43')]){_0x202984[_0x9bc6('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x9bc6('0x40')](_0x202984);})['then'](function(_0x37ad02){_0x2a2cb0[_0x9bc6('0x5a')]=_0x37ad02;return _0x2a2cb0;});}})[_0x9bc6('0x22')](respondWithFilteredResult(_0x2e4f15,_0x202984))[_0x9bc6('0x45')](handleError(_0x2e4f15,null));};exports[_0x9bc6('0x5e')]=function(_0x4a0d5f,_0x253e87,_0x474a97){var _0x447b07={'raw':!![],'where':{}};var _0x20c746={};var _0x42b4ce={'count':0x0,'rows':[]};return db[_0x9bc6('0x2a')]['findOne']({'where':{'id':_0x4a0d5f[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x253e87,null))['then'](function(_0x4891d1){if(_0x4891d1){_0x20c746['model']=_[_0x9bc6('0x30')](db[_0x9bc6('0x5f')]['rawAttributes']);_0x20c746[_0x9bc6('0x2f')]=_[_0x9bc6('0x30')](_0x4a0d5f[_0x9bc6('0x2f')]);_0x20c746[_0x9bc6('0x38')]=_[_0x9bc6('0x31')](_0x20c746[_0x9bc6('0x2e')],_0x20c746['query']);_0x447b07[_0x9bc6('0x33')]=_[_0x9bc6('0x31')](_0x20c746[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0x4a0d5f[_0x9bc6('0x2f')][_0x9bc6('0x32')]));_0x447b07[_0x9bc6('0x33')]=_0x447b07[_0x9bc6('0x33')]['length']?_0x447b07['attributes']:_0x20c746[_0x9bc6('0x2e')];if(!_0x4a0d5f[_0x9bc6('0x2f')]['hasOwnProperty'](_0x9bc6('0x36'))){_0x447b07[_0x9bc6('0x1d')]=qs[_0x9bc6('0x1d')](_0x4a0d5f['query']['limit']);_0x447b07[_0x9bc6('0x1b')]=qs[_0x9bc6('0x1b')](_0x4a0d5f[_0x9bc6('0x2f')][_0x9bc6('0x1b')]);}_0x447b07[_0x9bc6('0x59')]=qs[_0x9bc6('0x37')](_0x4a0d5f['query'][_0x9bc6('0x37')]);_0x447b07[_0x9bc6('0x3b')]=qs['filters'](_[_0x9bc6('0x39')](_0x4a0d5f[_0x9bc6('0x2f')],_0x20c746[_0x9bc6('0x38')]));_0x447b07['where'][_0x9bc6('0x5d')]=_0x4891d1['id'];if(_0x4a0d5f[_0x9bc6('0x2f')][_0x9bc6('0x3a')]){_0x447b07[_0x9bc6('0x3b')]=_[_0x9bc6('0x3c')](_0x447b07[_0x9bc6('0x3b')],{'$or':_[_0x9bc6('0x29')](_0x447b07['attributes'],function(_0x1a73f1){var _0x1c1001={};_0x1c1001[_0x1a73f1]={'$like':'%'+_0x4a0d5f['query'][_0x9bc6('0x3a')]+'%'};return _0x1c1001;})});}_0x447b07=_[_0x9bc6('0x3c')]({},_0x447b07,_0x4a0d5f[_0x9bc6('0x3e')]);return db['CmHopperFinal'][_0x9bc6('0x1e')]({'where':_0x447b07[_0x9bc6('0x3b')]})[_0x9bc6('0x22')](function(_0x13d9f4){_0x42b4ce[_0x9bc6('0x1e')]=_0x13d9f4;if(_0x4a0d5f['query']['includeAll']){_0x447b07[_0x9bc6('0x3f')]=[{'all':!![]}];}return db[_0x9bc6('0x5f')][_0x9bc6('0x40')](_0x447b07);})[_0x9bc6('0x22')](function(_0x402bd0){_0x42b4ce[_0x9bc6('0x5a')]=_0x402bd0;return _0x42b4ce;});}})[_0x9bc6('0x22')](respondWithFilteredResult(_0x253e87,_0x447b07))[_0x9bc6('0x45')](handleError(_0x253e87,null));};exports['getHopperBlacks']=function(_0x2d8d7f,_0x1ebb50,_0x21bc3f){var _0x4ada64={'raw':!![],'where':{}};var _0x48965d={};var _0x2314f1={'count':0x0,'rows':[]};return db[_0x9bc6('0x2a')]['findOne']({'where':{'id':_0x2d8d7f['params']['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x1ebb50,null))[_0x9bc6('0x22')](function(_0x15681e){if(_0x15681e){_0x48965d['model']=_[_0x9bc6('0x30')](db[_0x9bc6('0x60')][_0x9bc6('0x42')]);_0x48965d['query']=_[_0x9bc6('0x30')](_0x2d8d7f[_0x9bc6('0x2f')]);_0x48965d[_0x9bc6('0x38')]=_[_0x9bc6('0x31')](_0x48965d['model'],_0x48965d['query']);_0x4ada64[_0x9bc6('0x33')]=_[_0x9bc6('0x31')](_0x48965d[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0x2d8d7f[_0x9bc6('0x2f')][_0x9bc6('0x32')]));_0x4ada64[_0x9bc6('0x33')]=_0x4ada64[_0x9bc6('0x33')]['length']?_0x4ada64['attributes']:_0x48965d[_0x9bc6('0x2e')];if(!_0x2d8d7f[_0x9bc6('0x2f')][_0x9bc6('0x35')](_0x9bc6('0x36'))){_0x4ada64[_0x9bc6('0x1d')]=qs[_0x9bc6('0x1d')](_0x2d8d7f[_0x9bc6('0x2f')][_0x9bc6('0x1d')]);_0x4ada64[_0x9bc6('0x1b')]=qs[_0x9bc6('0x1b')](_0x2d8d7f[_0x9bc6('0x2f')][_0x9bc6('0x1b')]);}_0x4ada64[_0x9bc6('0x59')]=qs[_0x9bc6('0x37')](_0x2d8d7f[_0x9bc6('0x2f')]['sort']);_0x4ada64[_0x9bc6('0x3b')]=qs['filters'](_[_0x9bc6('0x39')](_0x2d8d7f[_0x9bc6('0x2f')],_0x48965d[_0x9bc6('0x38')]));_0x4ada64['where'][_0x9bc6('0x5d')]=_0x15681e['id'];if(_0x2d8d7f[_0x9bc6('0x2f')][_0x9bc6('0x3a')]){_0x4ada64[_0x9bc6('0x3b')]=_[_0x9bc6('0x3c')](_0x4ada64[_0x9bc6('0x3b')],{'$or':_['map'](_0x4ada64[_0x9bc6('0x33')],function(_0x2bf222){var _0x208753={};_0x208753[_0x2bf222]={'$like':'%'+_0x2d8d7f[_0x9bc6('0x2f')][_0x9bc6('0x3a')]+'%'};return _0x208753;})});}_0x4ada64=_[_0x9bc6('0x3c')]({},_0x4ada64,_0x2d8d7f[_0x9bc6('0x3e')]);return db[_0x9bc6('0x60')][_0x9bc6('0x1e')]({'where':_0x4ada64[_0x9bc6('0x3b')]})[_0x9bc6('0x22')](function(_0x2f086a){_0x2314f1[_0x9bc6('0x1e')]=_0x2f086a;if(_0x2d8d7f['query'][_0x9bc6('0x43')]){_0x4ada64[_0x9bc6('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9bc6('0x40')](_0x4ada64);})['then'](function(_0x240f2e){_0x2314f1[_0x9bc6('0x5a')]=_0x240f2e;return _0x2314f1;});}})[_0x9bc6('0x22')](respondWithFilteredResult(_0x1ebb50,_0x4ada64))['catch'](handleError(_0x1ebb50,null));};exports[_0x9bc6('0x61')]=function(_0x4c6052,_0x2c3a9b,_0x2b986f){var _0x4b0ee0={};var _0x4bb61c={};var _0x10568c;var _0x52be46;return db[_0x9bc6('0x2a')]['findOne']({'where':{'id':_0x4c6052[_0x9bc6('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c3a9b,null))[_0x9bc6('0x22')](function(_0xa1d1f){if(_0xa1d1f){_0x10568c=_0xa1d1f;_0x4bb61c[_0x9bc6('0x2e')]=_[_0x9bc6('0x30')](db[_0x9bc6('0x62')][_0x9bc6('0x42')]);_0x4bb61c[_0x9bc6('0x2f')]=_[_0x9bc6('0x30')](_0x4c6052[_0x9bc6('0x2f')]);_0x4bb61c[_0x9bc6('0x38')]=_[_0x9bc6('0x31')](_0x4bb61c[_0x9bc6('0x2e')],_0x4bb61c['query']);_0x4b0ee0[_0x9bc6('0x33')]=_[_0x9bc6('0x31')](_0x4bb61c[_0x9bc6('0x2e')],qs['fields'](_0x4c6052[_0x9bc6('0x2f')][_0x9bc6('0x32')]));_0x4b0ee0[_0x9bc6('0x33')]=_0x4b0ee0[_0x9bc6('0x33')][_0x9bc6('0x34')]?_0x4b0ee0[_0x9bc6('0x33')]:_0x4bb61c['model'];_0x4b0ee0[_0x9bc6('0x59')]=qs[_0x9bc6('0x37')](_0x4c6052['query'][_0x9bc6('0x37')]);_0x4b0ee0[_0x9bc6('0x3b')]=qs[_0x9bc6('0x38')](_[_0x9bc6('0x39')](_0x4c6052[_0x9bc6('0x2f')],_0x4bb61c[_0x9bc6('0x38')]));if(_0x4c6052[_0x9bc6('0x2f')][_0x9bc6('0x3a')]){_0x4b0ee0[_0x9bc6('0x3b')]=_['merge'](_0x4b0ee0[_0x9bc6('0x3b')],{'$or':_[_0x9bc6('0x29')](_0x4b0ee0[_0x9bc6('0x33')],function(_0xedcdfc){var _0x4aa861={};_0x4aa861[_0xedcdfc]={'$like':'%'+_0x4c6052[_0x9bc6('0x2f')][_0x9bc6('0x3a')]+'%'};return _0x4aa861;})});}_0x4b0ee0=_[_0x9bc6('0x3c')]({},_0x4b0ee0,_0x4c6052[_0x9bc6('0x3e')]);return _0x10568c[_0x9bc6('0x61')](_0x4b0ee0);}})[_0x9bc6('0x22')](function(_0x59d900){if(_0x59d900){_0x52be46=_0x59d900[_0x9bc6('0x34')];if(!_0x4c6052[_0x9bc6('0x2f')]['hasOwnProperty']('nolimit')){_0x4b0ee0['limit']=qs['limit'](_0x4c6052['query'][_0x9bc6('0x1d')]);_0x4b0ee0[_0x9bc6('0x1b')]=qs['offset'](_0x4c6052[_0x9bc6('0x2f')][_0x9bc6('0x1b')]);}return _0x10568c[_0x9bc6('0x61')](_0x4b0ee0);}})[_0x9bc6('0x22')](function(_0x1949e2){if(_0x1949e2){return _0x1949e2?{'count':_0x52be46,'rows':_0x1949e2}:null;}})[_0x9bc6('0x22')](respondWithResult(_0x2c3a9b,null))[_0x9bc6('0x45')](handleError(_0x2c3a9b,null));};exports[_0x9bc6('0x63')]=function(_0x208ed9,_0x316fb2,_0x53b8c7){var _0x1288ba,_0x5ba5ed;return db[_0x9bc6('0x2a')][_0x9bc6('0x44')]({'where':{'id':_0x208ed9[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x316fb2,null))[_0x9bc6('0x22')](function(_0x342b1d){if(_0x342b1d){_0x5ba5ed=_0x342b1d;return _0x342b1d[_0x9bc6('0x63')](_0x208ed9[_0x9bc6('0x47')][_0x9bc6('0x64')],_[_0x9bc6('0x4e')](_0x208ed9['body'],[_0x9bc6('0x64'),'id'])||{});}return null;})[_0x9bc6('0x65')](function(_0x3e3a6e){var _0x3ad404;_0x1288ba=_0x3e3a6e||[];var _0x234e81=[];if(_0x3e3a6e){for(var _0x1b16a6=0x0;_0x1b16a6<_0x3e3a6e[_0x9bc6('0x34')];_0x1b16a6+=0x1){var _0x17b56b=_0x3e3a6e[_0x1b16a6][_0x9bc6('0x23')]({'plain':!![]});_0x5ba5ed[_0x9bc6('0x66')]=_0x208ed9['body'][_0x9bc6('0x66')]?_0x208ed9[_0x9bc6('0x47')][_0x9bc6('0x66')]:_0x5ba5ed['dialCheckDuplicateType'];switch(_0x5ba5ed[_0x9bc6('0x66')]){case _0x9bc6('0x67'):_0x3ad404=squel[_0x9bc6('0x68')]()[_0x9bc6('0x69')](_0x9bc6('0x6a'))[_0x9bc6('0x6b')]([_0x9bc6('0x6c'),_0x9bc6('0x6d'),_0x9bc6('0x6e'),_0x9bc6('0x6f'),_0x9bc6('0x5d'),_0x9bc6('0x4f'),'updatedAt'],squel['select']()[_0x9bc6('0x70')](_0x9bc6('0x6c'),_0x9bc6('0x6c'))[_0x9bc6('0x70')](_0x9bc6('0x71'),'scheduledAt')['field']('id',_0x9bc6('0x6e'))[_0x9bc6('0x70')](_0x17b56b[_0x9bc6('0x72')][_0x9bc6('0x73')](),_0x9bc6('0x6f'))[_0x9bc6('0x70')](_0x208ed9[_0x9bc6('0x55')]['id'][_0x9bc6('0x73')](),_0x9bc6('0x5d'))[_0x9bc6('0x70')](_0x9bc6('0x71'),'createdAt')[_0x9bc6('0x70')](_0x9bc6('0x71'),_0x9bc6('0x50'))['from'](_0x9bc6('0x74'))['where'](_0x9bc6('0x75'))[_0x9bc6('0x3b')]('ListId\x20=\x20?',_0x17b56b[_0x9bc6('0x72')][_0x9bc6('0x73')]())[_0x9bc6('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x9bc6('0x76'),squel[_0x9bc6('0x77')]()[_0x9bc6('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x9bc6('0x78')](_0x9bc6('0x79'))[_0x9bc6('0x3b')]('CampaignId\x20=\x20?',_0x208ed9[_0x9bc6('0x55')]['id'][_0x9bc6('0x73')]()))[_0x9bc6('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9bc6('0x77')]()[_0x9bc6('0x70')]('COALESCE(phone,\x27\x27)')[_0x9bc6('0x78')](_0x9bc6('0x6a'))[_0x9bc6('0x3b')](_0x9bc6('0x7a'),_0x208ed9['params']['id'][_0x9bc6('0x73')]())))[_0x9bc6('0x73')]();break;case _0x9bc6('0x7b'):_0x3ad404=squel['insert']()[_0x9bc6('0x69')]('cm_hopper')[_0x9bc6('0x6b')]([_0x9bc6('0x6c'),_0x9bc6('0x6d'),_0x9bc6('0x6e'),_0x9bc6('0x6f'),'CampaignId',_0x9bc6('0x4f'),'updatedAt'],squel[_0x9bc6('0x77')]()[_0x9bc6('0x70')](_0x9bc6('0x6c'),'phone')['field'](_0x9bc6('0x71'),_0x9bc6('0x6d'))[_0x9bc6('0x70')]('id',_0x9bc6('0x6e'))[_0x9bc6('0x70')](_0x17b56b['CmListId'][_0x9bc6('0x73')](),_0x9bc6('0x6f'))[_0x9bc6('0x70')](_0x208ed9['params']['id'][_0x9bc6('0x73')](),_0x9bc6('0x5d'))['field'](_0x9bc6('0x71'),_0x9bc6('0x4f'))[_0x9bc6('0x70')]('NOW()',_0x9bc6('0x50'))[_0x9bc6('0x78')]('cm_contacts')[_0x9bc6('0x3b')](_0x9bc6('0x75'))['where']('ListId\x20=\x20?',_0x17b56b[_0x9bc6('0x72')][_0x9bc6('0x73')]())['where'](_0x9bc6('0x7c'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9bc6('0x77')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x9bc6('0x6a'))[_0x9bc6('0x3b')](_0x9bc6('0x7a'),_0x208ed9[_0x9bc6('0x55')]['id'][_0x9bc6('0x73')]())))['toString']();break;default:_0x3ad404=squel[_0x9bc6('0x68')]()[_0x9bc6('0x69')](_0x9bc6('0x6a'))[_0x9bc6('0x6b')](['phone','scheduledAt','ContactId',_0x9bc6('0x6f'),_0x9bc6('0x5d'),_0x9bc6('0x4f'),_0x9bc6('0x50')],squel[_0x9bc6('0x77')]()[_0x9bc6('0x70')]('phone',_0x9bc6('0x6c'))['field'](_0x9bc6('0x71'),_0x9bc6('0x6d'))[_0x9bc6('0x70')]('id',_0x9bc6('0x6e'))[_0x9bc6('0x70')](_0x17b56b[_0x9bc6('0x72')][_0x9bc6('0x73')](),_0x9bc6('0x6f'))['field'](_0x208ed9[_0x9bc6('0x55')]['id'][_0x9bc6('0x73')](),_0x9bc6('0x5d'))[_0x9bc6('0x70')]('NOW()',_0x9bc6('0x4f'))[_0x9bc6('0x70')](_0x9bc6('0x71'),_0x9bc6('0x50'))[_0x9bc6('0x78')]('cm_contacts')[_0x9bc6('0x3b')](_0x9bc6('0x75'))[_0x9bc6('0x3b')]('ListId\x20=\x20?',_0x17b56b[_0x9bc6('0x72')][_0x9bc6('0x73')]())[_0x9bc6('0x3b')](_0x9bc6('0x7c')))[_0x9bc6('0x73')]();}_0x234e81[_0x9bc6('0x7d')](db[_0x9bc6('0x7e')][_0x9bc6('0x2f')](_0x3ad404));}return BPromise[_0x9bc6('0x7f')](_0x234e81);}})['then'](function(){return _0x1288ba;})[_0x9bc6('0x22')](respondWithResult(_0x316fb2,null))[_0x9bc6('0x45')](handleError(_0x316fb2,null));};exports[_0x9bc6('0x80')]=function(_0x1f7335,_0x546957,_0x297adc){return db[_0x9bc6('0x2a')][_0x9bc6('0x44')]({'where':{'id':_0x1f7335['params']['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x546957,null))[_0x9bc6('0x22')](function(_0x489f3f){if(_0x489f3f){return _0x489f3f[_0x9bc6('0x80')](_0x1f7335[_0x9bc6('0x2f')][_0x9bc6('0x64')]);}})[_0x9bc6('0x22')](function(_0x2a9da8){if(_0x2a9da8){return db['CmHopper'][_0x9bc6('0x25')]({'where':{'ListId':_0x1f7335['query'][_0x9bc6('0x64')],'CampaignId':_0x1f7335[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](function(){return _0x2a9da8;});}})[_0x9bc6('0x22')](respondWithStatusCode(_0x546957,null))['catch'](handleError(_0x546957,null));};exports[_0x9bc6('0x81')]=function(_0x5d59d7,_0x45be3f,_0xfa04ae){var _0x43547f={};var _0x5206ba={};var _0x32e8e4;var _0x2144b6;return db[_0x9bc6('0x2a')]['findOne']({'where':{'id':_0x5d59d7[_0x9bc6('0x55')]['id']}})['then'](handleEntityNotFound(_0x45be3f,null))[_0x9bc6('0x22')](function(_0x2bb26b){if(_0x2bb26b){_0x32e8e4=_0x2bb26b;_0x5206ba[_0x9bc6('0x2e')]=_[_0x9bc6('0x30')](db[_0x9bc6('0x62')][_0x9bc6('0x42')]);_0x5206ba[_0x9bc6('0x2f')]=_['keys'](_0x5d59d7['query']);_0x5206ba[_0x9bc6('0x38')]=_[_0x9bc6('0x31')](_0x5206ba[_0x9bc6('0x2e')],_0x5206ba['query']);_0x43547f[_0x9bc6('0x33')]=_['intersection'](_0x5206ba[_0x9bc6('0x2e')],qs[_0x9bc6('0x32')](_0x5d59d7[_0x9bc6('0x2f')][_0x9bc6('0x32')]));_0x43547f[_0x9bc6('0x33')]=_0x43547f[_0x9bc6('0x33')]['length']?_0x43547f[_0x9bc6('0x33')]:_0x5206ba['model'];_0x43547f['order']=qs['sort'](_0x5d59d7['query']['sort']);_0x43547f[_0x9bc6('0x3b')]=qs['filters'](_['pick'](_0x5d59d7[_0x9bc6('0x2f')],_0x5206ba[_0x9bc6('0x38')]));if(_0x5d59d7[_0x9bc6('0x2f')][_0x9bc6('0x3a')]){_0x43547f[_0x9bc6('0x3b')]=_['merge'](_0x43547f[_0x9bc6('0x3b')],{'$or':_[_0x9bc6('0x29')](_0x43547f['attributes'],function(_0x5a2af1){var _0x59a427={};_0x59a427[_0x5a2af1]={'$like':'%'+_0x5d59d7[_0x9bc6('0x2f')][_0x9bc6('0x3a')]+'%'};return _0x59a427;})});}_0x43547f=_['merge']({},_0x43547f,_0x5d59d7['options']);return _0x32e8e4[_0x9bc6('0x81')](_0x43547f);}})['then'](function(_0x185d11){if(_0x185d11){_0x2144b6=_0x185d11[_0x9bc6('0x34')];if(!_0x5d59d7[_0x9bc6('0x2f')][_0x9bc6('0x35')](_0x9bc6('0x36'))){_0x43547f[_0x9bc6('0x1d')]=qs[_0x9bc6('0x1d')](_0x5d59d7[_0x9bc6('0x2f')][_0x9bc6('0x1d')]);_0x43547f[_0x9bc6('0x1b')]=qs[_0x9bc6('0x1b')](_0x5d59d7[_0x9bc6('0x2f')][_0x9bc6('0x1b')]);}return _0x32e8e4[_0x9bc6('0x81')](_0x43547f);}})['then'](function(_0x1d465f){if(_0x1d465f){return _0x1d465f?{'count':_0x2144b6,'rows':_0x1d465f}:null;}})['then'](respondWithResult(_0x45be3f,null))[_0x9bc6('0x45')](handleError(_0x45be3f,null));};exports['addBlackLists']=function(_0x187365,_0x37a2e2,_0x56e750){var _0x50b219,_0x545f5c;return db[_0x9bc6('0x2a')][_0x9bc6('0x44')]({'where':{'id':_0x187365['params']['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x37a2e2,null))[_0x9bc6('0x22')](function(_0x1c619e){if(_0x1c619e){_0x545f5c=_0x1c619e;return _0x1c619e['addBlackLists'](_0x187365[_0x9bc6('0x47')][_0x9bc6('0x64')],_[_0x9bc6('0x4e')](_0x187365['body'],[_0x9bc6('0x64'),'id'])||{});}return null;})[_0x9bc6('0x65')](function(_0x15e6ef){var _0x1fc177;_0x50b219=_0x15e6ef||[];var _0x5e17b3=[];if(_0x15e6ef){for(var _0x1ab44f=0x0;_0x1ab44f<_0x15e6ef[_0x9bc6('0x34')];_0x1ab44f+=0x1){var _0x5f0305=_0x15e6ef[_0x1ab44f]['get']({'plain':!![]});_0x1fc177=squel[_0x9bc6('0x68')]()[_0x9bc6('0x69')](_0x9bc6('0x82'))[_0x9bc6('0x6b')]([_0x9bc6('0x6c'),_0x9bc6('0x6e'),_0x9bc6('0x6f'),'CampaignId',_0x9bc6('0x4f'),_0x9bc6('0x50')],squel['select']()[_0x9bc6('0x70')](_0x9bc6('0x6c'),_0x9bc6('0x6c'))[_0x9bc6('0x70')]('id','ContactId')[_0x9bc6('0x70')](_0x5f0305[_0x9bc6('0x72')][_0x9bc6('0x73')](),_0x9bc6('0x6f'))[_0x9bc6('0x70')](_0x187365[_0x9bc6('0x55')]['id']['toString'](),_0x9bc6('0x5d'))['field'](_0x9bc6('0x71'),_0x9bc6('0x4f'))[_0x9bc6('0x70')](_0x9bc6('0x71'),_0x9bc6('0x50'))[_0x9bc6('0x78')](_0x9bc6('0x74'))[_0x9bc6('0x3b')]('deletedAt\x20IS\x20NULL')[_0x9bc6('0x3b')](_0x9bc6('0x83'),_0x5f0305[_0x9bc6('0x72')][_0x9bc6('0x73')]())[_0x9bc6('0x3b')](_0x9bc6('0x7c')))[_0x9bc6('0x73')]();_0x5e17b3[_0x9bc6('0x7d')](db['sequelize'][_0x9bc6('0x2f')](_0x1fc177));}return BPromise[_0x9bc6('0x7f')](_0x5e17b3);}})['then'](function(){return _0x50b219;})[_0x9bc6('0x22')](respondWithResult(_0x37a2e2,null))[_0x9bc6('0x45')](handleError(_0x37a2e2,null));};exports[_0x9bc6('0x84')]=function(_0x457ec2,_0x299190,_0x2a90f9){return db[_0x9bc6('0x2a')][_0x9bc6('0x44')]({'where':{'id':_0x457ec2[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](handleEntityNotFound(_0x299190,null))[_0x9bc6('0x22')](function(_0x3f3be5){if(_0x3f3be5){return _0x3f3be5[_0x9bc6('0x84')](_0x457ec2[_0x9bc6('0x2f')]['ids']);}})[_0x9bc6('0x22')](function(_0x8a0071){if(_0x8a0071){return db[_0x9bc6('0x60')][_0x9bc6('0x25')]({'where':{'ListId':_0x457ec2[_0x9bc6('0x2f')][_0x9bc6('0x64')],'CampaignId':_0x457ec2[_0x9bc6('0x55')]['id']}})[_0x9bc6('0x22')](function(){return _0x8a0071;});}})['then'](respondWithStatusCode(_0x299190,null))[_0x9bc6('0x45')](handleError(_0x299190,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e5d4dcb..c4acddb 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 a849eff..5b3456e 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 _0x6658=['message','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','map','model','include','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37bc37,_0x20e2da){var _0x1916d7=function(_0x1dd6dd){while(--_0x1dd6dd){_0x37bc37['push'](_0x37bc37['shift']());}};_0x1916d7(++_0x20e2da);}(_0x6658,0x198));var _0x8665=function(_0x5975ba,_0x345767){_0x5975ba=_0x5975ba-0x0;var _0x4f364c=_0x6658[_0x5975ba];return _0x4f364c;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var moment=require(_0x8665('0x2'));var BPromise=require(_0x8665('0x3'));var rs=require(_0x8665('0x4'));var fs=require('fs');var Redis=require(_0x8665('0x5'));var db=require(_0x8665('0x6'))['db'];var utils=require(_0x8665('0x7'));var logger=require('../../config/logger')(_0x8665('0x8'));var config=require(_0x8665('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8665('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x290df7,_0x24c89f,_0x242f58){return new BPromise(function(_0xe73687,_0x861e11){return client[_0x8665('0xb')](_0x290df7,_0x242f58)[_0x8665('0xc')](function(_0x5c25bf){logger[_0x8665('0xd')](_0x8665('0xe'),_0x24c89f,_0x8665('0xf'));logger[_0x8665('0x10')](_0x8665('0x11'),_0x24c89f,_0x8665('0xf'),JSON[_0x8665('0x12')](_0x5c25bf));if(_0x5c25bf[_0x8665('0x13')]){if(_0x5c25bf[_0x8665('0x13')][_0x8665('0x14')]===0x1f4){logger[_0x8665('0x13')](_0x8665('0xe'),_0x24c89f,_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);return _0x861e11(_0x5c25bf['error'][_0x8665('0x15')]);}logger['error'](_0x8665('0xe'),_0x24c89f,_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);return _0xe73687(_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);}else{logger[_0x8665('0xd')]('Campaign,\x20%s,\x20%s',_0x24c89f,_0x8665('0xf'));_0xe73687(_0x5c25bf[_0x8665('0x16')]['message']);}})[_0x8665('0x17')](function(_0x53dcb5){logger[_0x8665('0x13')](_0x8665('0xe'),_0x24c89f,_0x53dcb5);_0x861e11(_0x53dcb5);});});}exports[_0x8665('0x18')]=function(_0x50ba7d){var _0x331e01=this;return new Promise(function(_0x235617,_0x5b7984){return db[_0x8665('0x19')][_0x8665('0x1a')]({'raw':_0x50ba7d[_0x8665('0x1b')]?_0x50ba7d['options'][_0x8665('0x1c')]===undefined?!![]:![]:!![],'where':_0x50ba7d[_0x8665('0x1b')]?_0x50ba7d[_0x8665('0x1b')]['where']||null:null,'attributes':_0x50ba7d['options']?_0x50ba7d['options'][_0x8665('0x1d')]||null:null,'limit':_0x50ba7d['options']?_0x50ba7d[_0x8665('0x1b')]['limit']||null:null,'include':_0x50ba7d[_0x8665('0x1b')]?_0x50ba7d['options']['include']?_[_0x8665('0x1e')](_0x50ba7d[_0x8665('0x1b')]['include'],function(_0x38e3f5){return{'model':db[_0x38e3f5[_0x8665('0x1f')]],'as':_0x38e3f5['as'],'attributes':_0x38e3f5[_0x8665('0x1d')],'include':_0x38e3f5[_0x8665('0x20')]?_['map'](_0x38e3f5[_0x8665('0x20')],function(_0x41394e){return{'model':db[_0x41394e[_0x8665('0x1f')]],'as':_0x41394e['as'],'attributes':_0x41394e[_0x8665('0x1d')],'include':_0x41394e[_0x8665('0x20')]?_[_0x8665('0x1e')](_0x41394e[_0x8665('0x20')],function(_0x172f47){return{'model':db[_0x172f47['model']],'as':_0x172f47['as'],'attributes':_0x172f47[_0x8665('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8665('0xc')](function(_0x44e880){logger['info'](_0x8665('0x18'),_0x50ba7d);logger[_0x8665('0x10')](_0x8665('0x18'),_0x50ba7d,JSON[_0x8665('0x12')](_0x44e880));_0x235617(_0x44e880);})[_0x8665('0x17')](function(_0x3b0302){logger[_0x8665('0x13')](_0x8665('0x18'),_0x3b0302['message'],_0x50ba7d);_0x5b7984(_0x331e01[_0x8665('0x13')](0x1f4,_0x3b0302[_0x8665('0x15')]));});});}; \ No newline at end of file +var _0x0f69=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Campaign','findAll','options','raw','where','include','map','model','attributes','GetCampaign','debug','stringify','moment'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0x0f69,0x173));var _0x90f6=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x0f69[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x90f6('0x1'));var fs=require('fs');var Redis=require(_0x90f6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f6('0x3'));var logger=require(_0x90f6('0x4'))('rpc');var config=require(_0x90f6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90f6('0x6')][_0x90f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45657d,_0x3b35a0,_0x3bc2eb){return new BPromise(function(_0x42044f,_0x488b53){return client[_0x90f6('0x8')](_0x45657d,_0x3bc2eb)[_0x90f6('0x9')](function(_0x3c8148){logger[_0x90f6('0xa')](_0x90f6('0xb'),_0x3b35a0,_0x90f6('0xc'));logger['debug'](_0x90f6('0xd'),_0x3b35a0,_0x90f6('0xc'),JSON['stringify'](_0x3c8148));if(_0x3c8148[_0x90f6('0xe')]){if(_0x3c8148['error'][_0x90f6('0xf')]===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x3b35a0,_0x3c8148[_0x90f6('0xe')]['message']);return _0x488b53(_0x3c8148[_0x90f6('0xe')][_0x90f6('0x10')]);}logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3c8148['error'][_0x90f6('0x10')]);return _0x42044f(_0x3c8148['error']['message']);}else{logger[_0x90f6('0xa')]('Campaign,\x20%s,\x20%s',_0x3b35a0,_0x90f6('0xc'));_0x42044f(_0x3c8148[_0x90f6('0x11')][_0x90f6('0x10')]);}})[_0x90f6('0x12')](function(_0x3b4d5d){logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3b4d5d);_0x488b53(_0x3b4d5d);});});}exports['GetCampaign']=function(_0x36682a){var _0x2898a8=this;return new Promise(function(_0x5ac9be,_0x4209b8){return db[_0x90f6('0x13')][_0x90f6('0x14')]({'raw':_0x36682a[_0x90f6('0x15')]?_0x36682a[_0x90f6('0x15')][_0x90f6('0x16')]===undefined?!![]:![]:!![],'where':_0x36682a[_0x90f6('0x15')]?_0x36682a['options'][_0x90f6('0x17')]||null:null,'attributes':_0x36682a[_0x90f6('0x15')]?_0x36682a['options']['attributes']||null:null,'limit':_0x36682a[_0x90f6('0x15')]?_0x36682a['options']['limit']||null:null,'include':_0x36682a[_0x90f6('0x15')]?_0x36682a['options'][_0x90f6('0x18')]?_[_0x90f6('0x19')](_0x36682a[_0x90f6('0x15')][_0x90f6('0x18')],function(_0x31bec5){return{'model':db[_0x31bec5[_0x90f6('0x1a')]],'as':_0x31bec5['as'],'attributes':_0x31bec5['attributes'],'include':_0x31bec5[_0x90f6('0x18')]?_['map'](_0x31bec5[_0x90f6('0x18')],function(_0x1b22d5){return{'model':db[_0x1b22d5[_0x90f6('0x1a')]],'as':_0x1b22d5['as'],'attributes':_0x1b22d5[_0x90f6('0x1b')],'include':_0x1b22d5[_0x90f6('0x18')]?_[_0x90f6('0x19')](_0x1b22d5[_0x90f6('0x18')],function(_0x21ed7){return{'model':db[_0x21ed7['model']],'as':_0x21ed7['as'],'attributes':_0x21ed7[_0x90f6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f7e54){logger['info'](_0x90f6('0x1c'),_0x36682a);logger[_0x90f6('0x1d')]('GetCampaign',_0x36682a,JSON[_0x90f6('0x1e')](_0x4f7e54));_0x5ac9be(_0x4f7e54);})[_0x90f6('0x12')](function(_0x1bff1e){logger['error'](_0x90f6('0x1c'),_0x1bff1e[_0x90f6('0x10')],_0x36682a);_0x4209b8(_0x2898a8[_0x90f6('0xe')](0x1f4,_0x1bff1e[_0x90f6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index fa0add3..221e471 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 _0x39a9=['post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists'];(function(_0x1a5c57,_0xc4e207){var _0xdce8ad=function(_0x58d32d){while(--_0x58d32d){_0x1a5c57['push'](_0x1a5c57['shift']());}};_0xdce8ad(++_0xc4e207);}(_0x39a9,0x1d0));var _0x939a=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x39a9[_0x29df9a];return _0x3a8e96;};'use strict';var multer=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var path=require(_0x939a('0x2'));var timeout=require(_0x939a('0x3'));var express=require(_0x939a('0x4'));var router=express[_0x939a('0x5')]();var fs_extra=require(_0x939a('0x6'));var auth=require(_0x939a('0x7'));var interaction=require(_0x939a('0x8'));var config=require(_0x939a('0x9'));var controller=require(_0x939a('0xa'));router['get']('/',auth[_0x939a('0xb')](),controller[_0x939a('0xc')]);router[_0x939a('0xd')](_0x939a('0xe'),auth[_0x939a('0xb')](),controller[_0x939a('0xf')]);router[_0x939a('0xd')](_0x939a('0x10'),auth['isAuthenticated'](),controller[_0x939a('0x11')]);router[_0x939a('0xd')](_0x939a('0x12'),auth['isAuthenticated'](),controller[_0x939a('0x13')]);router[_0x939a('0xd')](_0x939a('0x14'),auth['isAuthenticated'](),controller[_0x939a('0x15')]);router[_0x939a('0xd')](_0x939a('0x16'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x939a('0xd')](_0x939a('0x17'),auth[_0x939a('0xb')](),controller['getLists']);router[_0x939a('0xd')](_0x939a('0x18'),auth[_0x939a('0xb')](),controller[_0x939a('0x19')]);router[_0x939a('0x1a')]('/',auth[_0x939a('0xb')](),controller[_0x939a('0x1b')]);router['post'](_0x939a('0x1c'),auth['isAuthenticated'](),controller[_0x939a('0x1d')]);router['post'](_0x939a('0x17'),auth[_0x939a('0xb')](),controller[_0x939a('0x1e')]);router[_0x939a('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x939a('0x1f')]);router['put']('/:id',auth[_0x939a('0xb')](),controller[_0x939a('0x20')]);router[_0x939a('0x21')](_0x939a('0xe'),auth[_0x939a('0xb')](),controller['destroy']);router[_0x939a('0x21')]('/:id/lists',auth[_0x939a('0xb')](),controller['removeLists']);router['delete'](_0x939a('0x18'),auth[_0x939a('0xb')](),controller[_0x939a('0x22')]);module['exports']=router; \ No newline at end of file +var _0xfe3c=['destroy','delete','removeLists','removeBlackLists','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','/:id','update'];(function(_0x1c9933,_0x59e5bb){var _0x33fc29=function(_0x87fcc6){while(--_0x87fcc6){_0x1c9933['push'](_0x1c9933['shift']());}};_0x33fc29(++_0x59e5bb);}(_0xfe3c,0xb8));var _0xcfe3=function(_0x33721a,_0x27f573){_0x33721a=_0x33721a-0x0;var _0x297427=_0xfe3c[_0x33721a];return _0x297427;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcfe3('0x0'));var timeout=require(_0xcfe3('0x1'));var express=require(_0xcfe3('0x2'));var router=express['Router']();var fs_extra=require(_0xcfe3('0x3'));var auth=require(_0xcfe3('0x4'));var interaction=require(_0xcfe3('0x5'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xcfe3('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xcfe3('0x7')](),controller[_0xcfe3('0x8')]);router[_0xcfe3('0x6')](_0xcfe3('0x9'),auth[_0xcfe3('0x7')](),controller[_0xcfe3('0xa')]);router['get'](_0xcfe3('0xb'),auth[_0xcfe3('0x7')](),controller[_0xcfe3('0xc')]);router[_0xcfe3('0x6')](_0xcfe3('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0xcfe3('0xe'),auth[_0xcfe3('0x7')](),controller['getHopperBlacks']);router['get'](_0xcfe3('0xf'),auth[_0xcfe3('0x7')](),controller[_0xcfe3('0x10')]);router[_0xcfe3('0x6')](_0xcfe3('0x11'),auth['isAuthenticated'](),controller[_0xcfe3('0x12')]);router[_0xcfe3('0x13')]('/',auth[_0xcfe3('0x7')](),controller[_0xcfe3('0x14')]);router[_0xcfe3('0x13')](_0xcfe3('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0xcfe3('0x13')](_0xcfe3('0xf'),auth[_0xcfe3('0x7')](),controller[_0xcfe3('0x16')]);router[_0xcfe3('0x13')](_0xcfe3('0x11'),auth[_0xcfe3('0x7')](),controller[_0xcfe3('0x17')]);router['put'](_0xcfe3('0x18'),auth[_0xcfe3('0x7')](),controller[_0xcfe3('0x19')]);router['delete'](_0xcfe3('0x18'),auth['isAuthenticated'](),controller[_0xcfe3('0x1a')]);router[_0xcfe3('0x1b')](_0xcfe3('0xf'),auth['isAuthenticated'](),controller[_0xcfe3('0x1c')]);router['delete'](_0xcfe3('0x11'),auth['isAuthenticated'](),controller[_0xcfe3('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 564fdfa..9c015c5 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 _0x08a8=['VIRTUAL','getDataValue','key','sequelize','STRING','TEXT'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x08a8,0x16b));var _0x808a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x808a('0x0'));module['exports']={'key':{'type':Sequelize[_0x808a('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x808a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x808a('0x1')]},'name':{'type':Sequelize[_0x808a('0x3')],'get':function(){return this[_0x808a('0x4')](_0x808a('0x5'));}}}; \ No newline at end of file +var _0xfda0=['VIRTUAL','getDataValue','key','sequelize','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfda0,0x17d));var _0x0fda=function(_0x5e1ce9,_0x45b8cb){_0x5e1ce9=_0x5e1ce9-0x0;var _0x30d949=_0xfda0[_0x5e1ce9];return _0x30d949;};'use strict';var Sequelize=require(_0x0fda('0x0'));module['exports']={'key':{'type':Sequelize[_0x0fda('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x0fda('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0fda('0x3')],'get':function(){return this[_0x0fda('0x4')](_0x0fda('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e7408fe..7642b51 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 _0xdd88=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','catch','body','params','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x48d776,_0xb7dfa1){var _0x4973d7=function(_0xf08a7a){while(--_0xf08a7a){_0x48d776['push'](_0x48d776['shift']());}};_0x4973d7(++_0xb7dfa1);}(_0xdd88,0xaa));var _0x8dd8=function(_0x529bdb,_0x350b4a){_0x529bdb=_0x529bdb-0x0;var _0x22cf71=_0xdd88[_0x529bdb];return _0x22cf71;};'use strict';var emlformat=require(_0x8dd8('0x0'));var rimraf=require(_0x8dd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8dd8('0x2'));var rp=require(_0x8dd8('0x3'));var moment=require(_0x8dd8('0x4'));var BPromise=require(_0x8dd8('0x5'));var Mustache=require(_0x8dd8('0x6'));var util=require(_0x8dd8('0x7'));var path=require(_0x8dd8('0x8'));var sox=require('sox');var csv=require(_0x8dd8('0x9'));var ejs=require(_0x8dd8('0xa'));var fs=require('fs');var fs_extra=require(_0x8dd8('0xb'));var _=require(_0x8dd8('0xc'));var squel=require('squel');var crypto=require(_0x8dd8('0xd'));var jsforce=require(_0x8dd8('0xe'));var deskjs=require(_0x8dd8('0xf'));var toCsv=require(_0x8dd8('0x9'));var querystring=require(_0x8dd8('0x10'));var Papa=require(_0x8dd8('0x11'));var Redis=require(_0x8dd8('0x12'));var authService=require(_0x8dd8('0x13'));var qs=require(_0x8dd8('0x14'));var as=require(_0x8dd8('0x15'));var hardwareService=require(_0x8dd8('0x16'));var logger=require(_0x8dd8('0x17'))('api');var utils=require(_0x8dd8('0x18'));var config=require(_0x8dd8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dd8('0x1a'))['db'];function respondWithStatusCode(_0x37a38f,_0x1441c6){_0x1441c6=_0x1441c6||0xcc;return function(_0x43150b){if(_0x43150b){return _0x37a38f[_0x8dd8('0x1b')](_0x1441c6);}return _0x37a38f[_0x8dd8('0x1c')](_0x1441c6)[_0x8dd8('0x1d')]();};}function respondWithResult(_0x3ab6e6,_0x5ba679){_0x5ba679=_0x5ba679||0xc8;return function(_0x1685e6){if(_0x1685e6){return _0x3ab6e6[_0x8dd8('0x1c')](_0x5ba679)[_0x8dd8('0x1e')](_0x1685e6);}};}function respondWithFilteredResult(_0x3802e6,_0x2fb65d){return function(_0x418baf){if(_0x418baf){var _0x40fde7=typeof _0x2fb65d[_0x8dd8('0x1f')]===_0x8dd8('0x20')&&typeof _0x2fb65d[_0x8dd8('0x21')]===_0x8dd8('0x20');var _0xc9b88e=_0x418baf[_0x8dd8('0x22')];var _0x1b7c42=_0x40fde7?0x0:_0x2fb65d[_0x8dd8('0x1f')];var _0xf9b905=_0x40fde7?_0x418baf[_0x8dd8('0x22')]:_0x2fb65d[_0x8dd8('0x1f')]+_0x2fb65d['limit'];var _0x17b2ce;if(_0xf9b905>=_0xc9b88e){_0xf9b905=_0xc9b88e;_0x17b2ce=0xc8;}else{_0x17b2ce=0xce;}_0x3802e6[_0x8dd8('0x1c')](_0x17b2ce);return _0x3802e6['set'](_0x8dd8('0x23'),_0x1b7c42+'-'+_0xf9b905+'/'+_0xc9b88e)[_0x8dd8('0x1e')](_0x418baf);}return null;};}function patchUpdates(_0x33b6f4){return function(_0x5ab556){try{jsonpatch[_0x8dd8('0x24')](_0x5ab556,_0x33b6f4,!![]);}catch(_0x18c352){return BPromise[_0x8dd8('0x25')](_0x18c352);}return _0x5ab556['save']();};}function saveUpdates(_0x23130b,_0x58379f){return function(_0x1b3d9){if(_0x1b3d9){return _0x1b3d9[_0x8dd8('0x26')](_0x23130b)[_0x8dd8('0x27')](function(_0x4ec327){return _0x4ec327;});}return null;};}function removeEntity(_0x4d03ca,_0x33da32){return function(_0x58beae){if(_0x58beae){return _0x58beae[_0x8dd8('0x28')]()['then'](function(){var _0x59276a=_0x58beae[_0x8dd8('0x29')]({'plain':!![]});var _0x405de7='CannedAnswers';return db[_0x8dd8('0x2a')][_0x8dd8('0x28')]({'where':{'type':_0x405de7,'resourceId':_0x59276a['id']}})[_0x8dd8('0x27')](function(){return _0x58beae;});})[_0x8dd8('0x27')](function(){_0x4d03ca[_0x8dd8('0x1c')](0xcc)[_0x8dd8('0x1d')]();});}};}function handleEntityNotFound(_0x56788c,_0x13914e){return function(_0x30ddd6){if(!_0x30ddd6){_0x56788c[_0x8dd8('0x1b')](0x194);}return _0x30ddd6;};}function handleError(_0x1abf27,_0x137754){_0x137754=_0x137754||0x1f4;return function(_0x1dc5b0){logger['error'](_0x1dc5b0[_0x8dd8('0x2b')]);if(_0x1dc5b0[_0x8dd8('0x2c')]){delete _0x1dc5b0[_0x8dd8('0x2c')];}_0x1abf27['status'](_0x137754)[_0x8dd8('0x2d')](_0x1dc5b0);};}exports[_0x8dd8('0x2e')]=function(_0x319089,_0x4c0ab6){var _0x173a95={},_0x533aa3={},_0x51c73e={'count':0x0,'rows':[]};var _0x1bc907=_[_0x8dd8('0x2f')](db[_0x8dd8('0x30')][_0x8dd8('0x31')],function(_0x14a167){return{'name':_0x14a167[_0x8dd8('0x32')],'type':_0x14a167[_0x8dd8('0x33')]['key']};});_0x533aa3[_0x8dd8('0x34')]=_[_0x8dd8('0x2f')](_0x1bc907,_0x8dd8('0x2c'));_0x533aa3[_0x8dd8('0x35')]=_[_0x8dd8('0x36')](_0x319089[_0x8dd8('0x35')]);_0x533aa3[_0x8dd8('0x37')]=_[_0x8dd8('0x38')](_0x533aa3[_0x8dd8('0x34')],_0x533aa3['query']);_0x173a95[_0x8dd8('0x39')]=_[_0x8dd8('0x38')](_0x533aa3[_0x8dd8('0x34')],qs[_0x8dd8('0x3a')](_0x319089[_0x8dd8('0x35')][_0x8dd8('0x3a')]));_0x173a95[_0x8dd8('0x39')]=_0x173a95[_0x8dd8('0x39')][_0x8dd8('0x3b')]?_0x173a95['attributes']:_0x533aa3['model'];if(!_0x319089[_0x8dd8('0x35')][_0x8dd8('0x3c')](_0x8dd8('0x3d'))){_0x173a95[_0x8dd8('0x21')]=qs[_0x8dd8('0x21')](_0x319089[_0x8dd8('0x35')][_0x8dd8('0x21')]);_0x173a95[_0x8dd8('0x1f')]=qs[_0x8dd8('0x1f')](_0x319089[_0x8dd8('0x35')][_0x8dd8('0x1f')]);}_0x173a95[_0x8dd8('0x3e')]=qs[_0x8dd8('0x3f')](_0x319089['query'][_0x8dd8('0x3f')]);_0x173a95[_0x8dd8('0x40')]=qs[_0x8dd8('0x37')](_[_0x8dd8('0x41')](_0x319089['query'],_0x533aa3[_0x8dd8('0x37')]),_0x1bc907);if(_0x319089['query'][_0x8dd8('0x42')]){_0x173a95[_0x8dd8('0x40')]=_[_0x8dd8('0x43')](_0x173a95['where'],{'$or':[{'key':{'$like':'%'+_0x319089['query'][_0x8dd8('0x42')]+'%'}},{'value':{'$like':'%'+_0x319089[_0x8dd8('0x35')][_0x8dd8('0x42')]+'%'}}]});}_0x173a95=_[_0x8dd8('0x43')]({},_0x173a95,_0x319089[_0x8dd8('0x44')]);var _0x550ef0={'where':_0x173a95[_0x8dd8('0x40')]};return db['CannedAnswer']['count'](_0x550ef0)[_0x8dd8('0x27')](function(_0x69546d){_0x51c73e[_0x8dd8('0x22')]=_0x69546d;if(_0x319089[_0x8dd8('0x35')][_0x8dd8('0x45')]){_0x173a95[_0x8dd8('0x46')]=[{'all':!![]}];}return db[_0x8dd8('0x30')]['findAll'](_0x173a95);})[_0x8dd8('0x27')](function(_0x71dc67){_0x51c73e[_0x8dd8('0x47')]=_0x71dc67;return _0x51c73e;})[_0x8dd8('0x27')](respondWithFilteredResult(_0x4c0ab6,_0x173a95))['catch'](handleError(_0x4c0ab6,null));};exports[_0x8dd8('0x48')]=function(_0x3b4aa2,_0xc84194){var _0x136bf1={'raw':!![],'where':{'id':_0x3b4aa2['params']['id']}},_0x4b1b47={};_0x4b1b47[_0x8dd8('0x34')]=_[_0x8dd8('0x36')](db[_0x8dd8('0x30')][_0x8dd8('0x31')]);_0x4b1b47[_0x8dd8('0x35')]=_[_0x8dd8('0x36')](_0x3b4aa2[_0x8dd8('0x35')]);_0x4b1b47[_0x8dd8('0x37')]=_['intersection'](_0x4b1b47[_0x8dd8('0x34')],_0x4b1b47[_0x8dd8('0x35')]);_0x136bf1[_0x8dd8('0x39')]=_[_0x8dd8('0x38')](_0x4b1b47[_0x8dd8('0x34')],qs[_0x8dd8('0x3a')](_0x3b4aa2[_0x8dd8('0x35')][_0x8dd8('0x3a')]));_0x136bf1[_0x8dd8('0x39')]=_0x136bf1[_0x8dd8('0x39')]['length']?_0x136bf1[_0x8dd8('0x39')]:_0x4b1b47[_0x8dd8('0x34')];if(_0x3b4aa2[_0x8dd8('0x35')][_0x8dd8('0x45')]){_0x136bf1[_0x8dd8('0x46')]=[{'all':!![]}];}_0x136bf1=_[_0x8dd8('0x43')]({},_0x136bf1,_0x3b4aa2[_0x8dd8('0x44')]);return db[_0x8dd8('0x30')][_0x8dd8('0x49')](_0x136bf1)[_0x8dd8('0x27')](handleEntityNotFound(_0xc84194,null))[_0x8dd8('0x27')](respondWithResult(_0xc84194,null))[_0x8dd8('0x4a')](handleError(_0xc84194,null));};exports['update']=function(_0x12052e,_0x130e9c){if(_0x12052e[_0x8dd8('0x4b')]['id']){delete _0x12052e[_0x8dd8('0x4b')]['id'];}return db[_0x8dd8('0x30')][_0x8dd8('0x49')]({'where':{'id':_0x12052e[_0x8dd8('0x4c')]['id']}})[_0x8dd8('0x27')](handleEntityNotFound(_0x130e9c,null))[_0x8dd8('0x27')](saveUpdates(_0x12052e[_0x8dd8('0x4b')],null))[_0x8dd8('0x27')](respondWithResult(_0x130e9c,null))[_0x8dd8('0x4a')](handleError(_0x130e9c,null));};exports[_0x8dd8('0x28')]=function(_0xd12cbe,_0x560c2a){return db[_0x8dd8('0x30')][_0x8dd8('0x49')]({'where':{'id':_0xd12cbe[_0x8dd8('0x4c')]['id']}})[_0x8dd8('0x27')](handleEntityNotFound(_0x560c2a,null))['then'](removeEntity(_0x560c2a,null))[_0x8dd8('0x4a')](handleError(_0x560c2a,null));};exports['create']=function(_0x1b6206,_0x242a86){var _0x534d9c={'key':_0x1b6206[_0x8dd8('0x4b')][_0x8dd8('0x4d')]};if(_0x1b6206[_0x8dd8('0x4b')][_0x8dd8('0x4e')]){_0x534d9c['MailAccountId']=_0x1b6206[_0x8dd8('0x4b')][_0x8dd8('0x4e')];}else if(_0x1b6206[_0x8dd8('0x4b')][_0x8dd8('0x4f')]){_0x534d9c[_0x8dd8('0x4f')]=_0x1b6206['body'][_0x8dd8('0x4f')];}else if(_0x1b6206['body'][_0x8dd8('0x50')]){_0x534d9c[_0x8dd8('0x50')]=_0x1b6206[_0x8dd8('0x4b')][_0x8dd8('0x50')];}else if(_0x1b6206[_0x8dd8('0x4b')][_0x8dd8('0x51')]){_0x534d9c['ChatWebsiteId']=_0x1b6206[_0x8dd8('0x4b')][_0x8dd8('0x51')];}return db[_0x8dd8('0x30')][_0x8dd8('0x49')]({'where':_0x534d9c})[_0x8dd8('0x27')](function(_0x2e7a04){if(_0x2e7a04){throw new db[(_0x8dd8('0x52'))]['ValidationError'](_0x8dd8('0x53'));}return db['CannedAnswer'][_0x8dd8('0x54')](_0x1b6206[_0x8dd8('0x4b')]);})[_0x8dd8('0x27')](function(_0x4b6671){var _0x1ae01a=_0x1b6206[_0x8dd8('0x55')]['get']({'plain':!![]});if(!_0x1ae01a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ae01a['role']===_0x8dd8('0x55')){var _0x4bbe96=_0x4b6671[_0x8dd8('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x8dd8('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x1ae01a[_0x8dd8('0x56')]},'raw':!![]})[_0x8dd8('0x27')](function(_0x1b07f5){if(_0x1b07f5&&_0x1b07f5[_0x8dd8('0x57')]===0x0){return db[_0x8dd8('0x2a')][_0x8dd8('0x54')]({'name':_0x4bbe96[_0x8dd8('0x2c')],'resourceId':_0x4bbe96['id'],'type':_0x1b07f5[_0x8dd8('0x2c')],'sectionId':_0x1b07f5['id']},{})[_0x8dd8('0x27')](function(){return _0x4b6671;});}else{return _0x4b6671;}})[_0x8dd8('0x4a')](function(_0x2d8b67){logger[_0x8dd8('0x58')](_0x8dd8('0x59'),_0x2d8b67);throw _0x2d8b67;});}return _0x4b6671;})[_0x8dd8('0x27')](respondWithResult(_0x242a86,0xc9))[_0x8dd8('0x4a')](handleError(_0x242a86,null));}; \ No newline at end of file +var _0x151f=['include','CannedAnswer','findAll','rows','catch','body','find','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','sort','pick','filters','where','merge','filter','options','includeAll'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x151f,0x11e));var _0xf151=function(_0x330b75,_0x2de6da){_0x330b75=_0x330b75-0x0;var _0x110056=_0x151f[_0x330b75];return _0x110056;};'use strict';var emlformat=require(_0xf151('0x0'));var rimraf=require(_0xf151('0x1'));var zipdir=require(_0xf151('0x2'));var jsonpatch=require(_0xf151('0x3'));var rp=require('request-promise');var moment=require(_0xf151('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf151('0x5'));var util=require(_0xf151('0x6'));var path=require(_0xf151('0x7'));var sox=require(_0xf151('0x8'));var csv=require(_0xf151('0x9'));var ejs=require(_0xf151('0xa'));var fs=require('fs');var fs_extra=require(_0xf151('0xb'));var _=require(_0xf151('0xc'));var squel=require('squel');var crypto=require(_0xf151('0xd'));var jsforce=require(_0xf151('0xe'));var deskjs=require(_0xf151('0xf'));var toCsv=require(_0xf151('0x9'));var querystring=require(_0xf151('0x10'));var Papa=require(_0xf151('0x11'));var Redis=require(_0xf151('0x12'));var authService=require(_0xf151('0x13'));var qs=require(_0xf151('0x14'));var as=require(_0xf151('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf151('0x16'))(_0xf151('0x17'));var utils=require(_0xf151('0x18'));var config=require(_0xf151('0x19'));var licenseUtil=require(_0xf151('0x1a'));var db=require(_0xf151('0x1b'))['db'];function respondWithStatusCode(_0xff00b2,_0x3261eb){_0x3261eb=_0x3261eb||0xcc;return function(_0xeaf13e){if(_0xeaf13e){return _0xff00b2[_0xf151('0x1c')](_0x3261eb);}return _0xff00b2['status'](_0x3261eb)[_0xf151('0x1d')]();};}function respondWithResult(_0x102d85,_0x4d43ec){_0x4d43ec=_0x4d43ec||0xc8;return function(_0x466a6d){if(_0x466a6d){return _0x102d85[_0xf151('0x1e')](_0x4d43ec)[_0xf151('0x1f')](_0x466a6d);}};}function respondWithFilteredResult(_0x664ec1,_0x2883ca){return function(_0x2f4ccc){if(_0x2f4ccc){var _0x4d1897=typeof _0x2883ca[_0xf151('0x20')]===_0xf151('0x21')&&typeof _0x2883ca[_0xf151('0x22')]===_0xf151('0x21');var _0x46bc59=_0x2f4ccc[_0xf151('0x23')];var _0x1cffcc=_0x4d1897?0x0:_0x2883ca[_0xf151('0x20')];var _0x5c5042=_0x4d1897?_0x2f4ccc['count']:_0x2883ca['offset']+_0x2883ca[_0xf151('0x22')];var _0x5f5bb4;if(_0x5c5042>=_0x46bc59){_0x5c5042=_0x46bc59;_0x5f5bb4=0xc8;}else{_0x5f5bb4=0xce;}_0x664ec1['status'](_0x5f5bb4);return _0x664ec1[_0xf151('0x24')](_0xf151('0x25'),_0x1cffcc+'-'+_0x5c5042+'/'+_0x46bc59)[_0xf151('0x1f')](_0x2f4ccc);}return null;};}function patchUpdates(_0x48f6fe){return function(_0x334e7f){try{jsonpatch[_0xf151('0x26')](_0x334e7f,_0x48f6fe,!![]);}catch(_0x90eb6c){return BPromise[_0xf151('0x27')](_0x90eb6c);}return _0x334e7f['save']();};}function saveUpdates(_0x3c78d8,_0x3c4d34){return function(_0x453faa){if(_0x453faa){return _0x453faa[_0xf151('0x28')](_0x3c78d8)[_0xf151('0x29')](function(_0x1ed6bd){return _0x1ed6bd;});}return null;};}function removeEntity(_0x25df7f,_0x4418bc){return function(_0x5aa3d3){if(_0x5aa3d3){return _0x5aa3d3['destroy']()[_0xf151('0x29')](function(){var _0x41fe72=_0x5aa3d3[_0xf151('0x2a')]({'plain':!![]});var _0x24e9d6=_0xf151('0x2b');return db[_0xf151('0x2c')][_0xf151('0x2d')]({'where':{'type':_0x24e9d6,'resourceId':_0x41fe72['id']}})[_0xf151('0x29')](function(){return _0x5aa3d3;});})[_0xf151('0x29')](function(){_0x25df7f['status'](0xcc)[_0xf151('0x1d')]();});}};}function handleEntityNotFound(_0x468ec8,_0x2d1e14){return function(_0xa705ea){if(!_0xa705ea){_0x468ec8[_0xf151('0x1c')](0x194);}return _0xa705ea;};}function handleError(_0x5a38f4,_0x2c632f){_0x2c632f=_0x2c632f||0x1f4;return function(_0x7b38ee){logger[_0xf151('0x2e')](_0x7b38ee[_0xf151('0x2f')]);if(_0x7b38ee['name']){delete _0x7b38ee[_0xf151('0x30')];}_0x5a38f4[_0xf151('0x1e')](_0x2c632f)['send'](_0x7b38ee);};}exports[_0xf151('0x31')]=function(_0x383a7a,_0x1ae6bd){var _0x49dcd7={},_0x18cec0={},_0x41286f={'count':0x0,'rows':[]};var _0x26aa6a=_[_0xf151('0x32')](db['CannedAnswer'][_0xf151('0x33')],function(_0x5d7378){return{'name':_0x5d7378[_0xf151('0x34')],'type':_0x5d7378[_0xf151('0x35')][_0xf151('0x36')]};});_0x18cec0['model']=_[_0xf151('0x32')](_0x26aa6a,'name');_0x18cec0['query']=_[_0xf151('0x37')](_0x383a7a[_0xf151('0x38')]);_0x18cec0['filters']=_[_0xf151('0x39')](_0x18cec0[_0xf151('0x3a')],_0x18cec0['query']);_0x49dcd7[_0xf151('0x3b')]=_[_0xf151('0x39')](_0x18cec0[_0xf151('0x3a')],qs[_0xf151('0x3c')](_0x383a7a[_0xf151('0x38')][_0xf151('0x3c')]));_0x49dcd7[_0xf151('0x3b')]=_0x49dcd7[_0xf151('0x3b')][_0xf151('0x3d')]?_0x49dcd7['attributes']:_0x18cec0[_0xf151('0x3a')];if(!_0x383a7a[_0xf151('0x38')]['hasOwnProperty']('nolimit')){_0x49dcd7['limit']=qs[_0xf151('0x22')](_0x383a7a[_0xf151('0x38')][_0xf151('0x22')]);_0x49dcd7[_0xf151('0x20')]=qs[_0xf151('0x20')](_0x383a7a[_0xf151('0x38')][_0xf151('0x20')]);}_0x49dcd7['order']=qs[_0xf151('0x3e')](_0x383a7a[_0xf151('0x38')][_0xf151('0x3e')]);_0x49dcd7['where']=qs['filters'](_[_0xf151('0x3f')](_0x383a7a[_0xf151('0x38')],_0x18cec0[_0xf151('0x40')]),_0x26aa6a);if(_0x383a7a[_0xf151('0x38')]['filter']){_0x49dcd7[_0xf151('0x41')]=_[_0xf151('0x42')](_0x49dcd7[_0xf151('0x41')],{'$or':[{'key':{'$like':'%'+_0x383a7a['query'][_0xf151('0x43')]+'%'}},{'value':{'$like':'%'+_0x383a7a[_0xf151('0x38')][_0xf151('0x43')]+'%'}}]});}_0x49dcd7=_['merge']({},_0x49dcd7,_0x383a7a[_0xf151('0x44')]);var _0x5b2a5a={'where':_0x49dcd7[_0xf151('0x41')]};return db['CannedAnswer'][_0xf151('0x23')](_0x5b2a5a)[_0xf151('0x29')](function(_0x1e522d){_0x41286f[_0xf151('0x23')]=_0x1e522d;if(_0x383a7a[_0xf151('0x38')][_0xf151('0x45')]){_0x49dcd7[_0xf151('0x46')]=[{'all':!![]}];}return db[_0xf151('0x47')][_0xf151('0x48')](_0x49dcd7);})[_0xf151('0x29')](function(_0xcf5a66){_0x41286f[_0xf151('0x49')]=_0xcf5a66;return _0x41286f;})[_0xf151('0x29')](respondWithFilteredResult(_0x1ae6bd,_0x49dcd7))[_0xf151('0x4a')](handleError(_0x1ae6bd,null));};exports['show']=function(_0x81a891,_0x137c8b){var _0x3be116={'raw':!![],'where':{'id':_0x81a891['params']['id']}},_0xddc2d8={};_0xddc2d8[_0xf151('0x3a')]=_[_0xf151('0x37')](db[_0xf151('0x47')][_0xf151('0x33')]);_0xddc2d8[_0xf151('0x38')]=_['keys'](_0x81a891['query']);_0xddc2d8[_0xf151('0x40')]=_[_0xf151('0x39')](_0xddc2d8['model'],_0xddc2d8[_0xf151('0x38')]);_0x3be116[_0xf151('0x3b')]=_[_0xf151('0x39')](_0xddc2d8[_0xf151('0x3a')],qs[_0xf151('0x3c')](_0x81a891[_0xf151('0x38')][_0xf151('0x3c')]));_0x3be116['attributes']=_0x3be116['attributes'][_0xf151('0x3d')]?_0x3be116[_0xf151('0x3b')]:_0xddc2d8['model'];if(_0x81a891['query']['includeAll']){_0x3be116['include']=[{'all':!![]}];}_0x3be116=_[_0xf151('0x42')]({},_0x3be116,_0x81a891[_0xf151('0x44')]);return db[_0xf151('0x47')]['find'](_0x3be116)['then'](handleEntityNotFound(_0x137c8b,null))[_0xf151('0x29')](respondWithResult(_0x137c8b,null))['catch'](handleError(_0x137c8b,null));};exports['update']=function(_0x41e468,_0x3e2098){if(_0x41e468[_0xf151('0x4b')]['id']){delete _0x41e468[_0xf151('0x4b')]['id'];}return db[_0xf151('0x47')][_0xf151('0x4c')]({'where':{'id':_0x41e468[_0xf151('0x4d')]['id']}})[_0xf151('0x29')](handleEntityNotFound(_0x3e2098,null))[_0xf151('0x29')](saveUpdates(_0x41e468[_0xf151('0x4b')],null))['then'](respondWithResult(_0x3e2098,null))[_0xf151('0x4a')](handleError(_0x3e2098,null));};exports[_0xf151('0x2d')]=function(_0x229afb,_0x421d3e){return db[_0xf151('0x47')][_0xf151('0x4c')]({'where':{'id':_0x229afb[_0xf151('0x4d')]['id']}})[_0xf151('0x29')](handleEntityNotFound(_0x421d3e,null))[_0xf151('0x29')](removeEntity(_0x421d3e,null))[_0xf151('0x4a')](handleError(_0x421d3e,null));};exports['create']=function(_0x5e3a13,_0x1dbd3d){var _0x10657c={'key':_0x5e3a13['body'][_0xf151('0x36')]};if(_0x5e3a13[_0xf151('0x4b')][_0xf151('0x4e')]){_0x10657c[_0xf151('0x4e')]=_0x5e3a13[_0xf151('0x4b')][_0xf151('0x4e')];}else if(_0x5e3a13[_0xf151('0x4b')][_0xf151('0x4f')]){_0x10657c['SmsAccountId']=_0x5e3a13['body']['SmsAccountId'];}else if(_0x5e3a13[_0xf151('0x4b')][_0xf151('0x50')]){_0x10657c[_0xf151('0x50')]=_0x5e3a13[_0xf151('0x4b')]['OpenchannelAccountId'];}else if(_0x5e3a13['body'][_0xf151('0x51')]){_0x10657c[_0xf151('0x51')]=_0x5e3a13[_0xf151('0x4b')][_0xf151('0x51')];}return db['CannedAnswer'][_0xf151('0x4c')]({'where':_0x10657c})['then'](function(_0x4d4e0a){if(_0x4d4e0a){throw new db['Sequelize'][(_0xf151('0x52'))](_0xf151('0x53'));}return db[_0xf151('0x47')]['create'](_0x5e3a13[_0xf151('0x4b')]);})[_0xf151('0x29')](function(_0x400c2d){var _0x24fd5f=_0x5e3a13[_0xf151('0x54')]['get']({'plain':!![]});if(!_0x24fd5f)throw new Error(_0xf151('0x55'));if(_0x24fd5f['role']===_0xf151('0x54')){var _0x4a68d0=_0x400c2d[_0xf151('0x2a')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xf151('0x2b'),'userProfileId':_0x24fd5f[_0xf151('0x56')]},'raw':!![]})[_0xf151('0x29')](function(_0x460e62){if(_0x460e62&&_0x460e62['autoAssociation']===0x0){return db[_0xf151('0x2c')][_0xf151('0x57')]({'name':_0x4a68d0[_0xf151('0x30')],'resourceId':_0x4a68d0['id'],'type':_0x460e62['name'],'sectionId':_0x460e62['id']},{})[_0xf151('0x29')](function(){return _0x400c2d;});}else{return _0x400c2d;}})[_0xf151('0x4a')](function(_0x3dddcb){logger[_0xf151('0x2e')](_0xf151('0x58'),_0x3dddcb);throw _0x3dddcb;});}return _0x400c2d;})[_0xf151('0x29')](respondWithResult(_0x1dbd3d,0xc9))[_0xf151('0x4a')](handleError(_0x1dbd3d,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7008869..4214d90 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 _0xee53=['moment','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0xee53,0x1ea));var _0x3ee5=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0xee53[_0x85d5a8];return _0x20479b;};'use strict';var _=require('lodash');var util=require(_0x3ee5('0x0'));var logger=require(_0x3ee5('0x1'))('api');var moment=require(_0x3ee5('0x2'));var BPromise=require('bluebird');var rp=require(_0x3ee5('0x3'));var fs=require('fs');var path=require(_0x3ee5('0x4'));var rimraf=require('rimraf');var config=require(_0x3ee5('0x5'));var attributes=require(_0x3ee5('0x6'));module[_0x3ee5('0x7')]=function(_0x1f4b5d,_0x4ca023){return _0x1f4b5d[_0x3ee5('0x8')](_0x3ee5('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3ee5('0xa'),'collate':_0x3ee5('0xb')});}; \ No newline at end of file +var _0xacff=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x10bc01,_0x34012c){var _0x135cb9=function(_0x1fb860){while(--_0x1fb860){_0x10bc01['push'](_0x10bc01['shift']());}};_0x135cb9(++_0x34012c);}(_0xacff,0x115));var _0xfacf=function(_0x322897,_0x48c9f3){_0x322897=_0x322897-0x0;var _0xefd39e=_0xacff[_0x322897];return _0xefd39e;};'use strict';var _=require(_0xfacf('0x0'));var util=require(_0xfacf('0x1'));var logger=require(_0xfacf('0x2'))(_0xfacf('0x3'));var moment=require(_0xfacf('0x4'));var BPromise=require(_0xfacf('0x5'));var rp=require(_0xfacf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfacf('0x7'));var config=require(_0xfacf('0x8'));var attributes=require(_0xfacf('0x9'));module[_0xfacf('0xa')]=function(_0x5a9130,_0x5c2e12){return _0x5a9130[_0xfacf('0xb')](_0xfacf('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfacf('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 622cd11..8b4edc8 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(_0x39b4cd,_0xd94d2a){var _0xb37552=function(_0x5bb49b){while(--_0x5bb49b){_0x39b4cd['push'](_0x39b4cd['shift']());}};_0xb37552(++_0xd94d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x230a14,_0x2b96ef){var _0x19017d=function(_0x4215c7){while(--_0x4215c7){_0x230a14['push'](_0x230a14['shift']());}};_0x19017d(++_0x2b96ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 5d56b67..eb8b408 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 _0x43b6=['create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','show','post','isAuthenticated'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x43b6,0x181));var _0x643b=function(_0x4f57f1,_0x4f2ba3){_0x4f57f1=_0x4f57f1-0x0;var _0x1d1101=_0x43b6[_0x4f57f1];return _0x1d1101;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x643b('0x0'));var timeout=require('connect-timeout');var express=require(_0x643b('0x1'));var router=express[_0x643b('0x2')]();var fs_extra=require(_0x643b('0x3'));var auth=require(_0x643b('0x4'));var interaction=require(_0x643b('0x5'));var config=require(_0x643b('0x6'));var controller=require(_0x643b('0x7'));router[_0x643b('0x8')]('/',auth['isAuthenticated'](),controller[_0x643b('0x9')]);router[_0x643b('0x8')](_0x643b('0xa'),auth['isAuthenticated'](),controller[_0x643b('0xb')]);router[_0x643b('0xc')]('/',auth[_0x643b('0xd')](),controller[_0x643b('0xe')]);router[_0x643b('0xf')](_0x643b('0xa'),auth[_0x643b('0xd')](),controller[_0x643b('0x10')]);router['delete'](_0x643b('0xa'),auth[_0x643b('0xd')](),controller[_0x643b('0x11')]);module[_0x643b('0x12')]=router; \ No newline at end of file +var _0x25cb=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','exports','path'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x25cb,0x133));var _0xb25c=function(_0x28eedc,_0x176917){_0x28eedc=_0x28eedc-0x0;var _0x575e59=_0x25cb[_0x28eedc];return _0x575e59;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb25c('0x0'));var timeout=require('connect-timeout');var express=require(_0xb25c('0x1'));var router=express[_0xb25c('0x2')]();var fs_extra=require(_0xb25c('0x3'));var auth=require(_0xb25c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb25c('0x5'));var controller=require('./cannedAnswer.controller');router[_0xb25c('0x6')]('/',auth[_0xb25c('0x7')](),controller['index']);router[_0xb25c('0x6')](_0xb25c('0x8'),auth[_0xb25c('0x7')](),controller[_0xb25c('0x9')]);router[_0xb25c('0xa')]('/',auth[_0xb25c('0x7')](),controller[_0xb25c('0xb')]);router['put'](_0xb25c('0x8'),auth[_0xb25c('0x7')](),controller[_0xb25c('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb25c('0xd')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index b78c920..8ca8d71 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 _0xd52a=['STRING','exports','1970-01-01\x2000:00:01'];(function(_0x4ffccc,_0x5a7acc){var _0x3438b3=function(_0x795eee){while(--_0x795eee){_0x4ffccc['push'](_0x4ffccc['shift']());}};_0x3438b3(++_0x5a7acc);}(_0xd52a,0xca));var _0xad52=function(_0x4d6d8b,_0x1a3dea){_0x4d6d8b=_0x4d6d8b-0x0;var _0x2b427b=_0xd52a[_0x4d6d8b];return _0x2b427b;};'use strict';var Sequelize=require('sequelize');module[_0xad52('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xad52('0x1')},'clid':{'type':Sequelize[_0xad52('0x2')]},'src':{'type':Sequelize[_0xad52('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xad52('0x2')]},'channel':{'type':Sequelize[_0xad52('0x2')]},'dstchannel':{'type':Sequelize[_0xad52('0x2')]},'lastapp':{'type':Sequelize[_0xad52('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xad52('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xad52('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xad52('0x2')]},'linkedid':{'type':Sequelize[_0xad52('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xad52('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xad52('0x2')]}}; \ No newline at end of file +var _0x34e2=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x1b729d,_0x5c5a6f){var _0x256125=function(_0x31481c){while(--_0x31481c){_0x1b729d['push'](_0x1b729d['shift']());}};_0x256125(++_0x5c5a6f);}(_0x34e2,0x126));var _0x234e=function(_0x540c2c,_0x55f60a){_0x540c2c=_0x540c2c-0x0;var _0xbcf60f=_0x34e2[_0x540c2c];return _0xbcf60f;};'use strict';var Sequelize=require(_0x234e('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x234e('0x1')],'allowNull':![],'defaultValue':_0x234e('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x234e('0x3')]},'channel':{'type':Sequelize[_0x234e('0x3')]},'dstchannel':{'type':Sequelize[_0x234e('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x234e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x234e('0x3')]},'amaflags':{'type':Sequelize[_0x234e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x234e('0x3')]},'userfield':{'type':Sequelize[_0x234e('0x3')]},'uniqueid':{'type':Sequelize[_0x234e('0x3')]},'linkedid':{'type':Sequelize[_0x234e('0x3')]},'sequence':{'type':Sequelize[_0x234e('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x234e('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d02f6b8..6a85860 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 _0x60c2=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','filters','filter','merge','where','VIRTUAL','options','includeAll','include','Cdr','findAll','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x2b03bd,_0x4ba427){var _0x41625c=function(_0x34897d){while(--_0x34897d){_0x2b03bd['push'](_0x2b03bd['shift']());}};_0x41625c(++_0x4ba427);}(_0x60c2,0x8f));var _0x260c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x60c2[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x260c('0x0'));var zipdir=require(_0x260c('0x1'));var jsonpatch=require(_0x260c('0x2'));var rp=require(_0x260c('0x3'));var moment=require(_0x260c('0x4'));var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require(_0x260c('0x9'));var csv=require(_0x260c('0xa'));var ejs=require(_0x260c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x260c('0xc'));var squel=require(_0x260c('0xd'));var crypto=require(_0x260c('0xe'));var jsforce=require(_0x260c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x260c('0xa'));var querystring=require(_0x260c('0x10'));var Papa=require(_0x260c('0x11'));var Redis=require(_0x260c('0x12'));var authService=require(_0x260c('0x13'));var qs=require(_0x260c('0x14'));var as=require(_0x260c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x16'))(_0x260c('0x17'));var utils=require(_0x260c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x19'));var db=require(_0x260c('0x1a'))['db'];function respondWithStatusCode(_0x191490,_0x5aed37){_0x5aed37=_0x5aed37||0xcc;return function(_0xc44e8d){if(_0xc44e8d){return _0x191490[_0x260c('0x1b')](_0x5aed37);}return _0x191490[_0x260c('0x1c')](_0x5aed37)[_0x260c('0x1d')]();};}function respondWithResult(_0x1d3775,_0x53df53){_0x53df53=_0x53df53||0xc8;return function(_0x3930b6){if(_0x3930b6){return _0x1d3775['status'](_0x53df53)[_0x260c('0x1e')](_0x3930b6);}};}function respondWithFilteredResult(_0x5a021c,_0x47edc1){return function(_0xd8b310){if(_0xd8b310){var _0x5299a4=typeof _0x47edc1[_0x260c('0x1f')]===_0x260c('0x20')&&typeof _0x47edc1[_0x260c('0x21')]===_0x260c('0x20');var _0x2bf3b8=_0xd8b310[_0x260c('0x22')];var _0x11e634=_0x5299a4?0x0:_0x47edc1[_0x260c('0x1f')];var _0x201e59=_0x5299a4?_0xd8b310[_0x260c('0x22')]:_0x47edc1[_0x260c('0x1f')]+_0x47edc1['limit'];var _0xd977b;if(_0x201e59>=_0x2bf3b8){_0x201e59=_0x2bf3b8;_0xd977b=0xc8;}else{_0xd977b=0xce;}_0x5a021c['status'](_0xd977b);return _0x5a021c[_0x260c('0x23')](_0x260c('0x24'),_0x11e634+'-'+_0x201e59+'/'+_0x2bf3b8)['json'](_0xd8b310);}return null;};}function patchUpdates(_0x1ccf81){return function(_0xe824db){try{jsonpatch[_0x260c('0x25')](_0xe824db,_0x1ccf81,!![]);}catch(_0x1c53e1){return BPromise[_0x260c('0x26')](_0x1c53e1);}return _0xe824db[_0x260c('0x27')]();};}function saveUpdates(_0x4b5b7a,_0xd5b7d8){return function(_0x158bc6){if(_0x158bc6){return _0x158bc6[_0x260c('0x28')](_0x4b5b7a)[_0x260c('0x29')](function(_0x58688c){return _0x58688c;});}return null;};}function removeEntity(_0x3f299f,_0x304961){return function(_0x461c8a){if(_0x461c8a){return _0x461c8a[_0x260c('0x2a')]()['then'](function(){_0x3f299f[_0x260c('0x1c')](0xcc)[_0x260c('0x1d')]();});}};}function handleEntityNotFound(_0x3bdfce,_0x29e10e){return function(_0x4cf0f9){if(!_0x4cf0f9){_0x3bdfce[_0x260c('0x1b')](0x194);}return _0x4cf0f9;};}function handleError(_0x2957e5,_0x480179){_0x480179=_0x480179||0x1f4;return function(_0x5def72){logger[_0x260c('0x2b')](_0x5def72[_0x260c('0x2c')]);if(_0x5def72[_0x260c('0x2d')]){delete _0x5def72[_0x260c('0x2d')];}_0x2957e5[_0x260c('0x1c')](_0x480179)[_0x260c('0x2e')](_0x5def72);};}exports['index']=function(_0xf1ad3e,_0x2e49dd){var _0x16b663={},_0x233a61={},_0x5993fd={'count':0x0,'rows':[]};var _0xc6868a=_[_0x260c('0x2f')](db['Cdr'][_0x260c('0x30')],function(_0xcb8c28){return{'name':_0xcb8c28[_0x260c('0x31')],'type':_0xcb8c28[_0x260c('0x32')][_0x260c('0x33')]};});_0x233a61[_0x260c('0x34')]=_[_0x260c('0x2f')](_0xc6868a,_0x260c('0x2d'));_0x233a61['query']=_[_0x260c('0x35')](_0xf1ad3e[_0x260c('0x36')]);_0x233a61['filters']=_[_0x260c('0x37')](_0x233a61['model'],_0x233a61['query']);_0x16b663['attributes']=_[_0x260c('0x37')](_0x233a61[_0x260c('0x34')],qs['fields'](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x38')]));_0x16b663[_0x260c('0x39')]=_0x16b663[_0x260c('0x39')][_0x260c('0x3a')]?_0x16b663[_0x260c('0x39')]:_0x233a61['model'];if(!_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3b')](_0x260c('0x3c'))){_0x16b663[_0x260c('0x21')]=qs[_0x260c('0x21')](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x21')]);_0x16b663[_0x260c('0x1f')]=qs[_0x260c('0x1f')](_0xf1ad3e['query'][_0x260c('0x1f')]);}_0x16b663['order']=qs['sort'](_0xf1ad3e['query']['sort']);_0x16b663['where']=qs['filters'](_['pick'](_0xf1ad3e[_0x260c('0x36')],_0x233a61[_0x260c('0x3d')]),_0xc6868a);if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3e')]){_0x16b663['where']=_[_0x260c('0x3f')](_0x16b663[_0x260c('0x40')],{'$or':_['map'](_0xc6868a,function(_0x35afd6){if(_0x35afd6[_0x260c('0x32')]!==_0x260c('0x41')){var _0x1dbc8a={};_0x1dbc8a[_0x35afd6[_0x260c('0x2d')]]={'$like':'%'+_0xf1ad3e['query']['filter']+'%'};return _0x1dbc8a;}})});}_0x16b663=_[_0x260c('0x3f')]({},_0x16b663,_0xf1ad3e[_0x260c('0x42')]);var _0x1de711={'where':_0x16b663[_0x260c('0x40')]};return db['Cdr'][_0x260c('0x22')](_0x1de711)[_0x260c('0x29')](function(_0x265bd8){_0x5993fd[_0x260c('0x22')]=_0x265bd8;if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x43')]){_0x16b663[_0x260c('0x44')]=[{'all':!![]}];}return db[_0x260c('0x45')][_0x260c('0x46')](_0x16b663);})[_0x260c('0x29')](function(_0x3392df){_0x5993fd[_0x260c('0x47')]=_0x3392df;return _0x5993fd;})[_0x260c('0x29')](respondWithFilteredResult(_0x2e49dd,_0x16b663))['catch'](handleError(_0x2e49dd,null));};exports['show']=function(_0x19ab59,_0x30b3f9){var _0xccd9c1={'raw':!![],'where':{'id':_0x19ab59[_0x260c('0x48')]['id']}},_0x50ed87={};_0x50ed87['model']=_['keys'](db[_0x260c('0x45')]['rawAttributes']);_0x50ed87[_0x260c('0x36')]=_[_0x260c('0x35')](_0x19ab59[_0x260c('0x36')]);_0x50ed87[_0x260c('0x3d')]=_['intersection'](_0x50ed87[_0x260c('0x34')],_0x50ed87[_0x260c('0x36')]);_0xccd9c1['attributes']=_[_0x260c('0x37')](_0x50ed87['model'],qs[_0x260c('0x38')](_0x19ab59[_0x260c('0x36')][_0x260c('0x38')]));_0xccd9c1['attributes']=_0xccd9c1[_0x260c('0x39')][_0x260c('0x3a')]?_0xccd9c1[_0x260c('0x39')]:_0x50ed87[_0x260c('0x34')];if(_0x19ab59[_0x260c('0x36')][_0x260c('0x43')]){_0xccd9c1[_0x260c('0x44')]=[{'all':!![]}];}_0xccd9c1=_[_0x260c('0x3f')]({},_0xccd9c1,_0x19ab59[_0x260c('0x42')]);return db[_0x260c('0x45')][_0x260c('0x49')](_0xccd9c1)[_0x260c('0x29')](handleEntityNotFound(_0x30b3f9,null))['then'](respondWithResult(_0x30b3f9,null))['catch'](handleError(_0x30b3f9,null));};exports[_0x260c('0x4a')]=function(_0x4517be,_0x18321f){return db[_0x260c('0x45')]['create'](_0x4517be[_0x260c('0x4b')],{})[_0x260c('0x29')](respondWithResult(_0x18321f,0xc9))[_0x260c('0x4c')](handleError(_0x18321f,null));};exports[_0x260c('0x28')]=function(_0x45175a,_0x1d0890){if(_0x45175a[_0x260c('0x4b')]['id']){delete _0x45175a[_0x260c('0x4b')]['id'];}return db[_0x260c('0x45')]['find']({'where':{'id':_0x45175a[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1d0890,null))['then'](saveUpdates(_0x45175a[_0x260c('0x4b')],null))['then'](respondWithResult(_0x1d0890,null))[_0x260c('0x4c')](handleError(_0x1d0890,null));};exports['destroy']=function(_0x4dcdca,_0x1e34fe){return db[_0x260c('0x45')][_0x260c('0x49')]({'where':{'id':_0x4dcdca[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1e34fe,null))[_0x260c('0x29')](removeEntity(_0x1e34fe,null))[_0x260c('0x4c')](handleError(_0x1e34fe,null));};exports['describe']=function(_0x12fbe5,_0x49b350){return db[_0x260c('0x45')][_0x260c('0x4d')]()[_0x260c('0x29')](respondWithResult(_0x49b350,null))[_0x260c('0x4c')](handleError(_0x49b350,null));}; \ No newline at end of file +var _0x6aa7=['includeAll','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x6aa7,0x178));var _0x76aa=function(_0x45a3ef,_0x353aa5){_0x45a3ef=_0x45a3ef-0x0;var _0x28cdf0=_0x6aa7[_0x45a3ef];return _0x28cdf0;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b'));_0x365ff8[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x3fcb7f[_0x76aa('0x33')]);_0x365ff8[_0x76aa('0x35')]=_['intersection'](_0x365ff8[_0x76aa('0x32')],_0x365ff8[_0x76aa('0x33')]);_0x994550['attributes']=_[_0x76aa('0x36')](_0x365ff8['model'],qs[_0x76aa('0x37')](_0x3fcb7f['query'][_0x76aa('0x37')]));_0x994550['attributes']=_0x994550['attributes'][_0x76aa('0x38')]?_0x994550[_0x76aa('0x39')]:_0x365ff8[_0x76aa('0x32')];if(!_0x3fcb7f[_0x76aa('0x33')]['hasOwnProperty']('nolimit')){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x1f')]);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f[_0x76aa('0x33')]['offset']);}_0x994550['order']=qs[_0x76aa('0x3a')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3a')]);_0x994550[_0x76aa('0x3b')]=qs['filters'](_[_0x76aa('0x3c')](_0x3fcb7f[_0x76aa('0x33')],_0x365ff8[_0x76aa('0x35')]),_0x1e90b9);if(_0x3fcb7f['query'][_0x76aa('0x3d')]){_0x994550[_0x76aa('0x3b')]=_[_0x76aa('0x3e')](_0x994550[_0x76aa('0x3b')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x982e62){if(_0x982e62[_0x76aa('0x31')]!==_0x76aa('0x3f')){var _0x283179={};_0x283179[_0x982e62['name']]={'$like':'%'+_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3d')]+'%'};return _0x283179;}})});}_0x994550=_[_0x76aa('0x3e')]({},_0x994550,_0x3fcb7f[_0x76aa('0x40')]);var _0x64612e={'where':_0x994550[_0x76aa('0x3b')]};return db['Cdr']['count'](_0x64612e)[_0x76aa('0x27')](function(_0x262906){_0x2dec94[_0x76aa('0x1d')]=_0x262906;if(_0x3fcb7f[_0x76aa('0x33')]['includeAll']){_0x994550[_0x76aa('0x41')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x42')](_0x994550);})[_0x76aa('0x27')](function(_0x1138b5){_0x2dec94['rows']=_0x1138b5;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports[_0x76aa('0x43')]=function(_0x54b8fd,_0x496304){var _0x4f7f3a={'raw':!![],'where':{'id':_0x54b8fd['params']['id']}},_0x144f0a={};_0x144f0a['model']=_['keys'](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x144f0a[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x54b8fd[_0x76aa('0x33')]);_0x144f0a['filters']=_[_0x76aa('0x36')](_0x144f0a[_0x76aa('0x32')],_0x144f0a[_0x76aa('0x33')]);_0x4f7f3a[_0x76aa('0x39')]=_[_0x76aa('0x36')](_0x144f0a['model'],qs[_0x76aa('0x37')](_0x54b8fd[_0x76aa('0x33')]['fields']));_0x4f7f3a[_0x76aa('0x39')]=_0x4f7f3a['attributes'][_0x76aa('0x38')]?_0x4f7f3a[_0x76aa('0x39')]:_0x144f0a[_0x76aa('0x32')];if(_0x54b8fd[_0x76aa('0x33')][_0x76aa('0x44')]){_0x4f7f3a[_0x76aa('0x41')]=[{'all':!![]}];}_0x4f7f3a=_[_0x76aa('0x3e')]({},_0x4f7f3a,_0x54b8fd[_0x76aa('0x40')]);return db[_0x76aa('0x2e')][_0x76aa('0x45')](_0x4f7f3a)['then'](handleEntityNotFound(_0x496304,null))[_0x76aa('0x27')](respondWithResult(_0x496304,null))['catch'](handleError(_0x496304,null));};exports[_0x76aa('0x46')]=function(_0x3d3332,_0x5e95f5){return db[_0x76aa('0x2e')]['create'](_0x3d3332['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5e95f5,0xc9))['catch'](handleError(_0x5e95f5,null));};exports[_0x76aa('0x26')]=function(_0x302a0c,_0x4315b3){if(_0x302a0c[_0x76aa('0x47')]['id']){delete _0x302a0c[_0x76aa('0x47')]['id'];}return db[_0x76aa('0x2e')]['find']({'where':{'id':_0x302a0c['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x4315b3,null))[_0x76aa('0x27')](saveUpdates(_0x302a0c[_0x76aa('0x47')],null))[_0x76aa('0x27')](respondWithResult(_0x4315b3,null))[_0x76aa('0x48')](handleError(_0x4315b3,null));};exports[_0x76aa('0x28')]=function(_0x4c52d5,_0x95b7c5){return db[_0x76aa('0x2e')][_0x76aa('0x45')]({'where':{'id':_0x4c52d5['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x95b7c5,null))['then'](removeEntity(_0x95b7c5,null))[_0x76aa('0x48')](handleError(_0x95b7c5,null));};exports['describe']=function(_0x339b0d,_0x4449c1){return db[_0x76aa('0x2e')][_0x76aa('0x49')]()[_0x76aa('0x27')](respondWithResult(_0x4449c1,null))[_0x76aa('0x48')](handleError(_0x4449c1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ee061cc..9d83dec 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4960f4,_0x46fe6d){var _0x396868=function(_0x35f1e2){while(--_0x35f1e2){_0x4960f4['push'](_0x4960f4['shift']());}};_0x396868(++_0x46fe6d);}(_0x7a54,0x106));var _0x47a5=function(_0x54ba54,_0x4fda46){_0x54ba54=_0x54ba54-0x0;var _0x25640e=_0x7a54[_0x54ba54];return _0x25640e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x767dc1,_0x4dbc84){var _0x27323a=function(_0xa0b5a5){while(--_0xa0b5a5){_0x767dc1['push'](_0x767dc1['shift']());}};_0x27323a(++_0x4dbc84);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 0a5cee7..d985d44 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 _0xded1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xded1,0x110));var _0x1ded=function(_0x443246,_0x199405){_0x443246=_0x443246-0x0;var _0xf91625=_0xded1[_0x443246];return _0xf91625;};'use strict';var _=require(_0x1ded('0x0'));var util=require(_0x1ded('0x1'));var moment=require(_0x1ded('0x2'));var BPromise=require(_0x1ded('0x3'));var rs=require(_0x1ded('0x4'));var fs=require('fs');var Redis=require(_0x1ded('0x5'));var db=require(_0x1ded('0x6'))['db'];var utils=require(_0x1ded('0x7'));var logger=require(_0x1ded('0x8'))(_0x1ded('0x9'));var config=require(_0x1ded('0xa'));var jayson=require(_0x1ded('0xb'));var client=jayson[_0x1ded('0xc')][_0x1ded('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4b07ae,_0x21bc22,_0x5d778d){return new BPromise(function(_0x3fa712,_0x3ba447){return client[_0x1ded('0xe')](_0x4b07ae,_0x5d778d)[_0x1ded('0xf')](function(_0x4fb46b){logger['info'](_0x1ded('0x10'),_0x21bc22,'request\x20sent');logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x21bc22,_0x1ded('0x11'),JSON[_0x1ded('0x12')](_0x4fb46b));if(_0x4fb46b[_0x1ded('0x13')]){if(_0x4fb46b[_0x1ded('0x13')][_0x1ded('0x14')]===0x1f4){logger[_0x1ded('0x13')](_0x1ded('0x10'),_0x21bc22,_0x4fb46b['error'][_0x1ded('0x15')]);return _0x3ba447(_0x4fb46b[_0x1ded('0x13')][_0x1ded('0x15')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x21bc22,_0x4fb46b['error'][_0x1ded('0x15')]);return _0x3fa712(_0x4fb46b['error'][_0x1ded('0x15')]);}else{logger[_0x1ded('0x16')]('Cdr,\x20%s,\x20%s',_0x21bc22,_0x1ded('0x11'));_0x3fa712(_0x4fb46b[_0x1ded('0x17')][_0x1ded('0x15')]);}})[_0x1ded('0x18')](function(_0x5c2fce){logger[_0x1ded('0x13')](_0x1ded('0x10'),_0x21bc22,_0x5c2fce);_0x3ba447(_0x5c2fce);});});} \ No newline at end of file +var _0xa175=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result'];(function(_0x1ad5a2,_0x45632b){var _0x51eba3=function(_0x38a6ce){while(--_0x38a6ce){_0x1ad5a2['push'](_0x1ad5a2['shift']());}};_0x51eba3(++_0x45632b);}(_0xa175,0xdd));var _0x5a17=function(_0x3157cf,_0x149773){_0x3157cf=_0x3157cf-0x0;var _0x5bf943=_0xa175[_0x3157cf];return _0x5bf943;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a17('0x0'));var BPromise=require(_0x5a17('0x1'));var rs=require(_0x5a17('0x2'));var fs=require('fs');var Redis=require(_0x5a17('0x3'));var db=require(_0x5a17('0x4'))['db'];var utils=require(_0x5a17('0x5'));var logger=require('../../config/logger')(_0x5a17('0x6'));var config=require(_0x5a17('0x7'));var jayson=require(_0x5a17('0x8'));var client=jayson['client'][_0x5a17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4da942,_0x367f4a,_0x34b3a6){return new BPromise(function(_0xc21a6e,_0x34e09c){return client[_0x5a17('0xa')](_0x4da942,_0x34b3a6)[_0x5a17('0xb')](function(_0x4d1374){logger[_0x5a17('0xc')]('Cdr,\x20%s,\x20%s',_0x367f4a,_0x5a17('0xd'));logger['debug'](_0x5a17('0xe'),_0x367f4a,_0x5a17('0xd'),JSON[_0x5a17('0xf')](_0x4d1374));if(_0x4d1374[_0x5a17('0x10')]){if(_0x4d1374[_0x5a17('0x10')][_0x5a17('0x11')]===0x1f4){logger['error'](_0x5a17('0x12'),_0x367f4a,_0x4d1374[_0x5a17('0x10')][_0x5a17('0x13')]);return _0x34e09c(_0x4d1374[_0x5a17('0x10')][_0x5a17('0x13')]);}logger[_0x5a17('0x10')](_0x5a17('0x12'),_0x367f4a,_0x4d1374[_0x5a17('0x10')][_0x5a17('0x13')]);return _0xc21a6e(_0x4d1374[_0x5a17('0x10')][_0x5a17('0x13')]);}else{logger['info'](_0x5a17('0x12'),_0x367f4a,_0x5a17('0xd'));_0xc21a6e(_0x4d1374[_0x5a17('0x14')][_0x5a17('0x13')]);}})[_0x5a17('0x15')](function(_0x415820){logger[_0x5a17('0x10')]('Cdr,\x20%s,\x20%s',_0x367f4a,_0x415820);_0x34e09c(_0x415820);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c97f2a1..982b3d6 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2ed4c9,_0x243771){var _0x237f0a=function(_0x7f100b){while(--_0x7f100b){_0x2ed4c9['push'](_0x2ed4c9['shift']());}};_0x237f0a(++_0x243771);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xaa4f3,_0x37be20){var _0x163cc9=function(_0x4fa98c){while(--_0x4fa98c){_0xaa4f3['push'](_0xaa4f3['shift']());}};_0x163cc9(++_0x37be20);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f66108b..c99230d 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 _0xdc4a=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x32173d,_0x7aeb47){var _0x248a95=function(_0x1e05ae){while(--_0x1e05ae){_0x32173d['push'](_0x32173d['shift']());}};_0x248a95(++_0x7aeb47);}(_0xdc4a,0x111));var _0xadc4=function(_0x20287f,_0x1f93c9){_0x20287f=_0x20287f-0x0;var _0x4c732d=_0xdc4a[_0x20287f];return _0x4c732d;};'use strict';var Sequelize=require('sequelize');module[_0xadc4('0x0')]={'priority':{'type':Sequelize[_0xadc4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xadc4('0x2')},'appdata':{'type':Sequelize[_0xadc4('0x3')]()},'description':{'type':Sequelize[_0xadc4('0x4')]},'interval':{'type':Sequelize[_0xadc4('0x4')],'defaultValue':_0xadc4('0x5')}}; \ No newline at end of file +var _0x4deb=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x25be4a,_0x542b8f){var _0x3ca4c0=function(_0x1cdb0e){while(--_0x1cdb0e){_0x25be4a['push'](_0x25be4a['shift']());}};_0x3ca4c0(++_0x542b8f);}(_0x4deb,0xc6));var _0xb4de=function(_0x352de7,_0x42d665){_0x352de7=_0x352de7-0x0;var _0x76cff2=_0x4deb[_0x352de7];return _0x76cff2;};'use strict';var Sequelize=require(_0xb4de('0x0'));module[_0xb4de('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb4de('0x2')],'allowNull':![],'defaultValue':_0xb4de('0x3')},'appdata':{'type':Sequelize[_0xb4de('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb4de('0x2')],'defaultValue':_0xb4de('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 731280f..c1a47a5 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 _0xc901=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','length','include','merge','find','catch','params','eml-format','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x3da84e,_0x201b2f){var _0x4d4d66=function(_0x3f9598){while(--_0x3f9598){_0x3da84e['push'](_0x3da84e['shift']());}};_0x4d4d66(++_0x201b2f);}(_0xc901,0x142));var _0x1c90=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc901[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x1c90('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c90('0x1'));var BPromise=require(_0x1c90('0x2'));var Mustache=require('mustache');var util=require(_0x1c90('0x3'));var path=require(_0x1c90('0x4'));var sox=require(_0x1c90('0x5'));var csv=require(_0x1c90('0x6'));var ejs=require(_0x1c90('0x7'));var fs=require('fs');var fs_extra=require(_0x1c90('0x8'));var _=require(_0x1c90('0x9'));var squel=require(_0x1c90('0xa'));var crypto=require(_0x1c90('0xb'));var jsforce=require(_0x1c90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1c90('0x6'));var querystring=require(_0x1c90('0xd'));var Papa=require(_0x1c90('0xe'));var Redis=require(_0x1c90('0xf'));var authService=require(_0x1c90('0x10'));var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c90('0x14'));var config=require(_0x1c90('0x15'));var licenseUtil=require(_0x1c90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da158,_0x3a38ed){_0x3a38ed=_0x3a38ed||0xcc;return function(_0x3353e3){if(_0x3353e3){return _0x4da158['sendStatus'](_0x3a38ed);}return _0x4da158[_0x1c90('0x17')](_0x3a38ed)[_0x1c90('0x18')]();};}function respondWithResult(_0xf72b98,_0x589c97){_0x589c97=_0x589c97||0xc8;return function(_0x42cb94){if(_0x42cb94){return _0xf72b98['status'](_0x589c97)[_0x1c90('0x19')](_0x42cb94);}};}function respondWithFilteredResult(_0x210ef4,_0x7a88dc){return function(_0x42d8a4){if(_0x42d8a4){var _0x48bd5e=typeof _0x7a88dc[_0x1c90('0x1a')]==='undefined'&&typeof _0x7a88dc[_0x1c90('0x1b')]===_0x1c90('0x1c');var _0x5f1025=_0x42d8a4[_0x1c90('0x1d')];var _0x4ec354=_0x48bd5e?0x0:_0x7a88dc['offset'];var _0x128bf0=_0x48bd5e?_0x42d8a4['count']:_0x7a88dc[_0x1c90('0x1a')]+_0x7a88dc[_0x1c90('0x1b')];var _0x2a5b73;if(_0x128bf0>=_0x5f1025){_0x128bf0=_0x5f1025;_0x2a5b73=0xc8;}else{_0x2a5b73=0xce;}_0x210ef4[_0x1c90('0x17')](_0x2a5b73);return _0x210ef4['set'](_0x1c90('0x1e'),_0x4ec354+'-'+_0x128bf0+'/'+_0x5f1025)['json'](_0x42d8a4);}return null;};}function patchUpdates(_0x525997){return function(_0x38f997){try{jsonpatch[_0x1c90('0x1f')](_0x38f997,_0x525997,!![]);}catch(_0x47fd11){return BPromise[_0x1c90('0x20')](_0x47fd11);}return _0x38f997[_0x1c90('0x21')]();};}function saveUpdates(_0x445664,_0x4074fd){return function(_0x13fc42){if(_0x13fc42){return _0x13fc42[_0x1c90('0x22')](_0x445664)['then'](function(_0x418f4c){return _0x418f4c;});}return null;};}function removeEntity(_0x46baa1,_0xab232a){return function(_0x33c88b){if(_0x33c88b){return _0x33c88b[_0x1c90('0x23')]()[_0x1c90('0x24')](function(){_0x46baa1[_0x1c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64ca90,_0x435c3a){return function(_0x3923a9){if(!_0x3923a9){_0x64ca90['sendStatus'](0x194);}return _0x3923a9;};}function handleError(_0xb5666e,_0x44387f){_0x44387f=_0x44387f||0x1f4;return function(_0x4abffe){logger[_0x1c90('0x25')](_0x4abffe[_0x1c90('0x26')]);if(_0x4abffe['name']){delete _0x4abffe[_0x1c90('0x27')];}_0xb5666e[_0x1c90('0x17')](_0x44387f)[_0x1c90('0x28')](_0x4abffe);};}exports[_0x1c90('0x29')]=function(_0x395edb,_0x111e20){var _0xd0a607={'raw':!![],'where':{'id':_0x395edb['params']['id']}},_0x35c843={};_0x35c843[_0x1c90('0x2a')]=_[_0x1c90('0x2b')](db[_0x1c90('0x2c')][_0x1c90('0x2d')]);_0x35c843[_0x1c90('0x2e')]=_[_0x1c90('0x2b')](_0x395edb[_0x1c90('0x2e')]);_0x35c843[_0x1c90('0x2f')]=_[_0x1c90('0x30')](_0x35c843[_0x1c90('0x2a')],_0x35c843[_0x1c90('0x2e')]);_0xd0a607['attributes']=_[_0x1c90('0x30')](_0x35c843[_0x1c90('0x2a')],qs['fields'](_0x395edb[_0x1c90('0x2e')]['fields']));_0xd0a607[_0x1c90('0x31')]=_0xd0a607['attributes'][_0x1c90('0x32')]?_0xd0a607['attributes']:_0x35c843[_0x1c90('0x2a')];if(_0x395edb[_0x1c90('0x2e')]['includeAll']){_0xd0a607[_0x1c90('0x33')]=[{'all':!![]}];}_0xd0a607=_[_0x1c90('0x34')]({},_0xd0a607,_0x395edb['options']);return db[_0x1c90('0x2c')][_0x1c90('0x35')](_0xd0a607)[_0x1c90('0x24')](handleEntityNotFound(_0x111e20,null))[_0x1c90('0x24')](respondWithResult(_0x111e20,null))[_0x1c90('0x36')](handleError(_0x111e20,null));};exports['update']=function(_0x5466c9,_0x4b5bd6){if(_0x5466c9['body']['id']){delete _0x5466c9['body']['id'];}return db[_0x1c90('0x2c')][_0x1c90('0x35')]({'where':{'id':_0x5466c9[_0x1c90('0x37')]['id']}})['then'](handleEntityNotFound(_0x4b5bd6,null))[_0x1c90('0x24')](saveUpdates(_0x5466c9['body'],null))[_0x1c90('0x24')](respondWithResult(_0x4b5bd6,null))[_0x1c90('0x36')](handleError(_0x4b5bd6,null));};exports['destroy']=function(_0x59ddbe,_0x4111b6){return db[_0x1c90('0x2c')][_0x1c90('0x35')]({'where':{'id':_0x59ddbe[_0x1c90('0x37')]['id']}})[_0x1c90('0x24')](handleEntityNotFound(_0x4111b6,null))[_0x1c90('0x24')](removeEntity(_0x4111b6,null))[_0x1c90('0x36')](handleError(_0x4111b6,null));}; \ No newline at end of file +var _0x0fd9=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','show','keys','ChatApplication','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','catch','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x583945,_0x5a2177){var _0x54b8f3=function(_0x52e932){while(--_0x52e932){_0x583945['push'](_0x583945['shift']());}};_0x54b8f3(++_0x5a2177);}(_0x0fd9,0xa3));var _0x90fd=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x0fd9[_0x45c981];return _0x4f62c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){_0x3ad6c6['status'](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x18d5b3,_0x2ffea2){return function(_0x31667c){if(!_0x31667c){_0x18d5b3[_0x90fd('0x17')](0x194);}return _0x31667c;};}function handleError(_0x4c962f,_0x35c38d){_0x35c38d=_0x35c38d||0x1f4;return function(_0xe333f0){logger[_0x90fd('0x26')](_0xe333f0[_0x90fd('0x27')]);if(_0xe333f0[_0x90fd('0x28')]){delete _0xe333f0[_0x90fd('0x28')];}_0x4c962f['status'](_0x35c38d)['send'](_0xe333f0);};}exports[_0x90fd('0x29')]=function(_0x170cfb,_0x2924e9){var _0x404971={'raw':!![],'where':{'id':_0x170cfb['params']['id']}},_0x397aaf={};_0x397aaf['model']=_[_0x90fd('0x2a')](db[_0x90fd('0x2b')][_0x90fd('0x2c')]);_0x397aaf[_0x90fd('0x2d')]=_['keys'](_0x170cfb['query']);_0x397aaf[_0x90fd('0x2e')]=_[_0x90fd('0x2f')](_0x397aaf[_0x90fd('0x30')],_0x397aaf[_0x90fd('0x2d')]);_0x404971['attributes']=_[_0x90fd('0x2f')](_0x397aaf[_0x90fd('0x30')],qs[_0x90fd('0x31')](_0x170cfb[_0x90fd('0x2d')][_0x90fd('0x31')]));_0x404971[_0x90fd('0x32')]=_0x404971[_0x90fd('0x32')][_0x90fd('0x33')]?_0x404971[_0x90fd('0x32')]:_0x397aaf[_0x90fd('0x30')];if(_0x170cfb[_0x90fd('0x2d')][_0x90fd('0x34')]){_0x404971[_0x90fd('0x35')]=[{'all':!![]}];}_0x404971=_[_0x90fd('0x36')]({},_0x404971,_0x170cfb[_0x90fd('0x37')]);return db[_0x90fd('0x2b')]['find'](_0x404971)[_0x90fd('0x25')](handleEntityNotFound(_0x2924e9,null))[_0x90fd('0x25')](respondWithResult(_0x2924e9,null))[_0x90fd('0x38')](handleError(_0x2924e9,null));};exports[_0x90fd('0x24')]=function(_0x14075f,_0x1a7518){if(_0x14075f[_0x90fd('0x39')]['id']){delete _0x14075f[_0x90fd('0x39')]['id'];}return db[_0x90fd('0x2b')][_0x90fd('0x3a')]({'where':{'id':_0x14075f[_0x90fd('0x3b')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x1a7518,null))[_0x90fd('0x25')](saveUpdates(_0x14075f['body'],null))[_0x90fd('0x25')](respondWithResult(_0x1a7518,null))[_0x90fd('0x38')](handleError(_0x1a7518,null));};exports[_0x90fd('0x3c')]=function(_0x35a4a9,_0x53cac2){return db[_0x90fd('0x2b')][_0x90fd('0x3a')]({'where':{'id':_0x35a4a9[_0x90fd('0x3b')]['id']}})['then'](handleEntityNotFound(_0x53cac2,null))['then'](removeEntity(_0x53cac2,null))[_0x90fd('0x38')](handleError(_0x53cac2,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 962c760..e671c6a 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 _0x5f64=['../../config/environment','./chatApplication.attributes','define','ChatApplication','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','path'];(function(_0xb8396,_0xc9e4fb){var _0x5a4ccc=function(_0x5d3eb2){while(--_0x5d3eb2){_0xb8396['push'](_0xb8396['shift']());}};_0x5a4ccc(++_0xc9e4fb);}(_0x5f64,0x1eb));var _0x45f6=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x5f64[_0x3acee8];return _0x5046cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x45f6('0x0'))('api');var moment=require(_0x45f6('0x1'));var BPromise=require('bluebird');var rp=require(_0x45f6('0x2'));var fs=require('fs');var path=require(_0x45f6('0x3'));var rimraf=require('rimraf');var config=require(_0x45f6('0x4'));var attributes=require(_0x45f6('0x5'));module['exports']=function(_0x46a25f,_0x3cb5cc){return _0x46a25f[_0x45f6('0x6')](_0x45f6('0x7'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x45f6('0x8')});}; \ No newline at end of file +var _0x0c25=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x3d71af,_0x1a3ee9){var _0x2c10b0=function(_0x918e3f){while(--_0x918e3f){_0x3d71af['push'](_0x3d71af['shift']());}};_0x2c10b0(++_0x1a3ee9);}(_0x0c25,0xfd));var _0x50c2=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x0c25[_0x4f34d8];return _0xc97536;};'use strict';var _=require('lodash');var util=require(_0x50c2('0x0'));var logger=require(_0x50c2('0x1'))(_0x50c2('0x2'));var moment=require(_0x50c2('0x3'));var BPromise=require(_0x50c2('0x4'));var rp=require(_0x50c2('0x5'));var fs=require('fs');var path=require(_0x50c2('0x6'));var rimraf=require(_0x50c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x50c2('0x8'));module[_0x50c2('0x9')]=function(_0x2ef208,_0x3ca264){return _0x2ef208[_0x50c2('0xa')](_0x50c2('0xb'),attributes,{'tableName':_0x50c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x50c2('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b33a7cd..3da1c36 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 _0x7340=['../../config/logger','rpc','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x35cabc,_0xc0f89a){var _0x2af2b9=function(_0x7490fb){while(--_0x7490fb){_0x35cabc['push'](_0x35cabc['shift']());}};_0x2af2b9(++_0xc0f89a);}(_0x7340,0x197));var _0x0734=function(_0x4182e2,_0x500fd5){_0x4182e2=_0x4182e2-0x0;var _0x55aaad=_0x7340[_0x4182e2];return _0x55aaad;};'use strict';var _=require(_0x0734('0x0'));var util=require(_0x0734('0x1'));var moment=require(_0x0734('0x2'));var BPromise=require(_0x0734('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0734('0x4'));var db=require(_0x0734('0x5'))['db'];var utils=require(_0x0734('0x6'));var logger=require(_0x0734('0x7'))(_0x0734('0x8'));var config=require('../../config/environment');var jayson=require(_0x0734('0x9'));var client=jayson[_0x0734('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383ca2,_0x301781,_0x38d03d){return new BPromise(function(_0x44a25e,_0x15d786){return client[_0x0734('0xb')](_0x383ca2,_0x38d03d)[_0x0734('0xc')](function(_0x445322){logger[_0x0734('0xd')]('ChatApplication,\x20%s,\x20%s',_0x301781,'request\x20sent');logger['debug'](_0x0734('0xe'),_0x301781,'request\x20sent',JSON[_0x0734('0xf')](_0x445322));if(_0x445322[_0x0734('0x10')]){if(_0x445322[_0x0734('0x10')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x301781,_0x445322['error'][_0x0734('0x11')]);return _0x15d786(_0x445322[_0x0734('0x10')][_0x0734('0x11')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x301781,_0x445322['error'][_0x0734('0x11')]);return _0x44a25e(_0x445322['error'][_0x0734('0x11')]);}else{logger[_0x0734('0xd')]('ChatApplication,\x20%s,\x20%s',_0x301781,'request\x20sent');_0x44a25e(_0x445322['result'][_0x0734('0x11')]);}})['catch'](function(_0x57ff8e){logger[_0x0734('0x10')]('ChatApplication,\x20%s,\x20%s',_0x301781,_0x57ff8e);_0x15d786(_0x57ff8e);});});} \ No newline at end of file +var _0xd875=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xd875,0xf2));var _0x5d87=function(_0x329fac,_0x43b216){_0x329fac=_0x329fac-0x0;var _0x42b353=_0xd875[_0x329fac];return _0x42b353;};'use strict';var _=require(_0x5d87('0x0'));var util=require(_0x5d87('0x1'));var moment=require(_0x5d87('0x2'));var BPromise=require(_0x5d87('0x3'));var rs=require(_0x5d87('0x4'));var fs=require('fs');var Redis=require(_0x5d87('0x5'));var db=require(_0x5d87('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d87('0x7'))(_0x5d87('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18984b,_0x5295d3,_0x4ebfe4){return new BPromise(function(_0x39c59f,_0x4c71df){return client['request'](_0x18984b,_0x4ebfe4)[_0x5d87('0x9')](function(_0x20246f){logger[_0x5d87('0xa')](_0x5d87('0xb'),_0x5295d3,_0x5d87('0xc'));logger[_0x5d87('0xd')](_0x5d87('0xe'),_0x5295d3,_0x5d87('0xc'),JSON[_0x5d87('0xf')](_0x20246f));if(_0x20246f[_0x5d87('0x10')]){if(_0x20246f[_0x5d87('0x10')]['code']===0x1f4){logger[_0x5d87('0x10')](_0x5d87('0xb'),_0x5295d3,_0x20246f[_0x5d87('0x10')][_0x5d87('0x11')]);return _0x4c71df(_0x20246f[_0x5d87('0x10')][_0x5d87('0x11')]);}logger['error'](_0x5d87('0xb'),_0x5295d3,_0x20246f['error']['message']);return _0x39c59f(_0x20246f[_0x5d87('0x10')]['message']);}else{logger[_0x5d87('0xa')](_0x5d87('0xb'),_0x5295d3,_0x5d87('0xc'));_0x39c59f(_0x20246f[_0x5d87('0x12')][_0x5d87('0x11')]);}})[_0x5d87('0x13')](function(_0x5237d3){logger[_0x5d87('0x10')](_0x5d87('0xb'),_0x5295d3,_0x5237d3);_0x4c71df(_0x5237d3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 040d9f0..06c980a 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 _0xa770=['isAuthenticated','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','put'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa770,0xb8));var _0x0a77=function(_0x10fe9d,_0xdb9d99){_0x10fe9d=_0x10fe9d-0x0;var _0x4c1905=_0xa770[_0x10fe9d];return _0x4c1905;};'use strict';var multer=require(_0x0a77('0x0'));var util=require(_0x0a77('0x1'));var path=require(_0x0a77('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a77('0x3'));var router=express[_0x0a77('0x4')]();var fs_extra=require(_0x0a77('0x5'));var auth=require(_0x0a77('0x6'));var interaction=require(_0x0a77('0x7'));var config=require(_0x0a77('0x8'));var controller=require('./chatApplication.controller');router['get'](_0x0a77('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0a77('0xa')](_0x0a77('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0a77('0x9'),auth[_0x0a77('0xb')](),controller[_0x0a77('0xc')]);module['exports']=router; \ No newline at end of file +var _0x59a7=['isAuthenticated','show','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id'];(function(_0x82158f,_0x4e103e){var _0x5f475f=function(_0x473255){while(--_0x473255){_0x82158f['push'](_0x82158f['shift']());}};_0x5f475f(++_0x4e103e);}(_0x59a7,0xf5));var _0x759a=function(_0x43c944,_0x1fbfc7){_0x43c944=_0x43c944-0x0;var _0x250603=_0x59a7[_0x43c944];return _0x250603;};'use strict';var multer=require(_0x759a('0x0'));var util=require(_0x759a('0x1'));var path=require(_0x759a('0x2'));var timeout=require(_0x759a('0x3'));var express=require(_0x759a('0x4'));var router=express['Router']();var fs_extra=require(_0x759a('0x5'));var auth=require(_0x759a('0x6'));var interaction=require(_0x759a('0x7'));var config=require(_0x759a('0x8'));var controller=require('./chatApplication.controller');router['get'](_0x759a('0x9'),auth[_0x759a('0xa')](),controller[_0x759a('0xb')]);router[_0x759a('0xc')](_0x759a('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x759a('0x9'),auth[_0x759a('0xa')](),controller[_0x759a('0xd')]);module[_0x759a('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 28b8253..6ef5b07 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 _0x95c8=['STRING','BOOLEAN','exports'];(function(_0x471b98,_0x7028dc){var _0x529f89=function(_0x3a3a7e){while(--_0x3a3a7e){_0x471b98['push'](_0x471b98['shift']());}};_0x529f89(++_0x7028dc);}(_0x95c8,0x16a));var _0x895c=function(_0x494240,_0x18a7a7){_0x494240=_0x494240-0x0;var _0x560f2b=_0x95c8[_0x494240];return _0x560f2b;};'use strict';var Sequelize=require('sequelize');module[_0x895c('0x0')]={'name':{'type':Sequelize[_0x895c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x895c('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x154f=['BOOLEAN','exports','STRING'];(function(_0x3f32e4,_0x4681c7){var _0x18fbef=function(_0x14ccc9){while(--_0x14ccc9){_0x3f32e4['push'](_0x3f32e4['shift']());}};_0x18fbef(++_0x4681c7);}(_0x154f,0x82));var _0xf154=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x154f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf154('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf154('0x1')]},'write':{'type':Sequelize[_0xf154('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 094f0c6..c004df8 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 _0xe04d=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','rows','show','keys','rawAttributes','find','catch','create','body','params','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','hasOwnProperty','removeMembers','addMessage','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe04d,0x1ec));var _0xde04=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xe04d[_0xb65e77];return _0x38134b;};'use strict';var emlformat=require(_0xde04('0x0'));var rimraf=require(_0xde04('0x1'));var zipdir=require(_0xde04('0x2'));var jsonpatch=require(_0xde04('0x3'));var rp=require('request-promise');var moment=require(_0xde04('0x4'));var BPromise=require(_0xde04('0x5'));var Mustache=require(_0xde04('0x6'));var util=require(_0xde04('0x7'));var path=require(_0xde04('0x8'));var sox=require(_0xde04('0x9'));var csv=require(_0xde04('0xa'));var ejs=require(_0xde04('0xb'));var fs=require('fs');var fs_extra=require(_0xde04('0xc'));var _=require(_0xde04('0xd'));var squel=require(_0xde04('0xe'));var crypto=require(_0xde04('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xde04('0x10'));var toCsv=require(_0xde04('0xa'));var querystring=require(_0xde04('0x11'));var Papa=require(_0xde04('0x12'));var Redis=require('ioredis');var authService=require(_0xde04('0x13'));var qs=require(_0xde04('0x14'));var as=require(_0xde04('0x15'));var hardwareService=require(_0xde04('0x16'));var logger=require(_0xde04('0x17'))(_0xde04('0x18'));var utils=require(_0xde04('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xde04('0x1a'));var db=require(_0xde04('0x1b'))['db'];config[_0xde04('0x1c')]=_[_0xde04('0x1d')](config[_0xde04('0x1c')],{'host':_0xde04('0x1e'),'port':0x18eb});var socket=require(_0xde04('0x1f'))(new Redis(config['redis']));require(_0xde04('0x20'))['register'](socket);function respondWithStatusCode(_0x25161e,_0x5b3c90){_0x5b3c90=_0x5b3c90||0xcc;return function(_0x31b2ff){if(_0x31b2ff){return _0x25161e['sendStatus'](_0x5b3c90);}return _0x25161e[_0xde04('0x21')](_0x5b3c90)[_0xde04('0x22')]();};}function respondWithResult(_0x33bfcc,_0x3772b8){_0x3772b8=_0x3772b8||0xc8;return function(_0x3ed931){if(_0x3ed931){return _0x33bfcc['status'](_0x3772b8)['json'](_0x3ed931);}};}function respondWithFilteredResult(_0x18e444,_0x34c048){return function(_0x277085){if(_0x277085){var _0x24e1d3=typeof _0x34c048[_0xde04('0x23')]===_0xde04('0x24')&&typeof _0x34c048[_0xde04('0x25')]===_0xde04('0x24');var _0x154301=_0x277085[_0xde04('0x26')];var _0x285330=_0x24e1d3?0x0:_0x34c048['offset'];var _0x421646=_0x24e1d3?_0x277085[_0xde04('0x26')]:_0x34c048[_0xde04('0x23')]+_0x34c048['limit'];var _0x25eef9;if(_0x421646>=_0x154301){_0x421646=_0x154301;_0x25eef9=0xc8;}else{_0x25eef9=0xce;}_0x18e444[_0xde04('0x21')](_0x25eef9);return _0x18e444[_0xde04('0x27')](_0xde04('0x28'),_0x285330+'-'+_0x421646+'/'+_0x154301)['json'](_0x277085);}return null;};}function patchUpdates(_0x28f941){return function(_0x15cf9a){try{jsonpatch[_0xde04('0x29')](_0x15cf9a,_0x28f941,!![]);}catch(_0x1fc564){return BPromise[_0xde04('0x2a')](_0x1fc564);}return _0x15cf9a[_0xde04('0x2b')]();};}function saveUpdates(_0x3d163e,_0x5661ef){return function(_0x2581c8){if(_0x2581c8){return _0x2581c8[_0xde04('0x2c')](_0x3d163e)[_0xde04('0x2d')](function(_0xc722f3){return _0xc722f3;});}return null;};}function removeEntity(_0x41b3d9,_0x101b00){return function(_0x426ae8){if(_0x426ae8){return _0x426ae8[_0xde04('0x2e')]()['then'](function(){_0x41b3d9['status'](0xcc)[_0xde04('0x22')]();});}};}function handleEntityNotFound(_0x269bda,_0xc14d8b){return function(_0x5b18c0){if(!_0x5b18c0){_0x269bda[_0xde04('0x2f')](0x194);}return _0x5b18c0;};}function handleError(_0x30a239,_0x19d82b){_0x19d82b=_0x19d82b||0x1f4;return function(_0x44a2aa){logger[_0xde04('0x30')](_0x44a2aa['stack']);if(_0x44a2aa[_0xde04('0x31')]){delete _0x44a2aa['name'];}_0x30a239[_0xde04('0x21')](_0x19d82b)['send'](_0x44a2aa);};}exports[_0xde04('0x32')]=function(_0x2f6e45,_0x590957){var _0x277ab1={},_0xe7f9b2={},_0x553356={'count':0x0,'rows':[]};var _0xa52b6f=_[_0xde04('0x33')](db['ChatGroup']['rawAttributes'],function(_0x1099e1){return{'name':_0x1099e1[_0xde04('0x34')],'type':_0x1099e1[_0xde04('0x35')][_0xde04('0x36')]};});_0xe7f9b2[_0xde04('0x37')]=_[_0xde04('0x33')](_0xa52b6f,_0xde04('0x31'));_0xe7f9b2[_0xde04('0x38')]=_['keys'](_0x2f6e45[_0xde04('0x38')]);_0xe7f9b2[_0xde04('0x39')]=_[_0xde04('0x3a')](_0xe7f9b2[_0xde04('0x37')],_0xe7f9b2[_0xde04('0x38')]);_0x277ab1[_0xde04('0x3b')]=_[_0xde04('0x3a')](_0xe7f9b2[_0xde04('0x37')],qs['fields'](_0x2f6e45['query'][_0xde04('0x3c')]));_0x277ab1[_0xde04('0x3b')]=_0x277ab1[_0xde04('0x3b')][_0xde04('0x3d')]?_0x277ab1[_0xde04('0x3b')]:_0xe7f9b2[_0xde04('0x37')];if(!_0x2f6e45['query']['hasOwnProperty'](_0xde04('0x3e'))){_0x277ab1[_0xde04('0x25')]=qs['limit'](_0x2f6e45[_0xde04('0x38')]['limit']);_0x277ab1['offset']=qs[_0xde04('0x23')](_0x2f6e45[_0xde04('0x38')][_0xde04('0x23')]);}_0x277ab1[_0xde04('0x3f')]=qs[_0xde04('0x40')](_0x2f6e45['query'][_0xde04('0x40')]);_0x277ab1[_0xde04('0x41')]=qs[_0xde04('0x39')](_['pick'](_0x2f6e45['query'],_0xe7f9b2[_0xde04('0x39')]),_0xa52b6f);if(_0x2f6e45[_0xde04('0x38')][_0xde04('0x42')]){_0x277ab1[_0xde04('0x41')]=_[_0xde04('0x43')](_0x277ab1[_0xde04('0x41')],{'$or':_[_0xde04('0x33')](_0xa52b6f,function(_0x5af50e){if(_0x5af50e[_0xde04('0x35')]!==_0xde04('0x44')){var _0x615360={};_0x615360[_0x5af50e[_0xde04('0x31')]]={'$like':'%'+_0x2f6e45[_0xde04('0x38')]['filter']+'%'};return _0x615360;}})});}_0x277ab1=_[_0xde04('0x43')]({},_0x277ab1,_0x2f6e45[_0xde04('0x45')]);var _0xebb11a={'where':_0x277ab1[_0xde04('0x41')]};return db[_0xde04('0x46')][_0xde04('0x26')](_0xebb11a)[_0xde04('0x2d')](function(_0x29ac10){_0x553356[_0xde04('0x26')]=_0x29ac10;if(_0x2f6e45[_0xde04('0x38')][_0xde04('0x47')]){_0x277ab1[_0xde04('0x48')]=[{'all':!![]}];}return db[_0xde04('0x46')]['findAll'](_0x277ab1);})[_0xde04('0x2d')](function(_0x3bc06b){_0x553356[_0xde04('0x49')]=_0x3bc06b;return _0x553356;})[_0xde04('0x2d')](respondWithFilteredResult(_0x590957,_0x277ab1))['catch'](handleError(_0x590957,null));};exports[_0xde04('0x4a')]=function(_0x48259a,_0x5d9f22){var _0x565414={'raw':!![],'where':{'id':_0x48259a['params']['id']}},_0x43f595={};_0x43f595[_0xde04('0x37')]=_[_0xde04('0x4b')](db['ChatGroup'][_0xde04('0x4c')]);_0x43f595[_0xde04('0x38')]=_[_0xde04('0x4b')](_0x48259a[_0xde04('0x38')]);_0x43f595[_0xde04('0x39')]=_[_0xde04('0x3a')](_0x43f595['model'],_0x43f595[_0xde04('0x38')]);_0x565414['attributes']=_[_0xde04('0x3a')](_0x43f595['model'],qs[_0xde04('0x3c')](_0x48259a[_0xde04('0x38')]['fields']));_0x565414['attributes']=_0x565414[_0xde04('0x3b')]['length']?_0x565414[_0xde04('0x3b')]:_0x43f595[_0xde04('0x37')];if(_0x48259a[_0xde04('0x38')][_0xde04('0x47')]){_0x565414[_0xde04('0x48')]=[{'all':!![]}];}_0x565414=_[_0xde04('0x43')]({},_0x565414,_0x48259a['options']);return db[_0xde04('0x46')][_0xde04('0x4d')](_0x565414)['then'](handleEntityNotFound(_0x5d9f22,null))[_0xde04('0x2d')](respondWithResult(_0x5d9f22,null))[_0xde04('0x4e')](handleError(_0x5d9f22,null));};exports[_0xde04('0x4f')]=function(_0x5bf6f3,_0x4a134c){return db['ChatGroup']['create'](_0x5bf6f3[_0xde04('0x50')],{})[_0xde04('0x2d')](respondWithResult(_0x4a134c,0xc9))[_0xde04('0x4e')](handleError(_0x4a134c,null));};exports[_0xde04('0x2c')]=function(_0x9b2a09,_0x2bf651){if(_0x9b2a09['body']['id']){delete _0x9b2a09[_0xde04('0x50')]['id'];}return db[_0xde04('0x46')]['find']({'where':{'id':_0x9b2a09[_0xde04('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf651,null))['then'](saveUpdates(_0x9b2a09[_0xde04('0x50')],null))[_0xde04('0x2d')](respondWithResult(_0x2bf651,null))['catch'](handleError(_0x2bf651,null));};exports[_0xde04('0x2e')]=function(_0x4346fd,_0x5c638a){return db['ChatGroup'][_0xde04('0x4d')]({'where':{'id':_0x4346fd[_0xde04('0x51')]['id']}})[_0xde04('0x2d')](handleEntityNotFound(_0x5c638a,null))[_0xde04('0x2d')](removeEntity(_0x5c638a,null))['catch'](handleError(_0x5c638a,null));};exports['describe']=function(_0x243a9f,_0x567a97){return db[_0xde04('0x46')][_0xde04('0x52')]()[_0xde04('0x2d')](respondWithResult(_0x567a97,null))['catch'](handleError(_0x567a97,null));};exports[_0xde04('0x53')]=function(_0x114db9,_0x217617,_0x35db93){return db['ChatInternalMessage'][_0xde04('0x26')]({'where':{'ChatGroupId':_0x114db9[_0xde04('0x51')]['id'],'ToId':_0x114db9[_0xde04('0x54')]['id'],'read':![]}})[_0xde04('0x2d')](function(_0x56dcb2){return{'id':_[_0xde04('0x55')](_0x114db9[_0xde04('0x51')]['id']),'count':_0x56dcb2};})[_0xde04('0x2d')](respondWithResult(_0x217617,null))[_0xde04('0x4e')](handleError(_0x217617,null));};exports[_0xde04('0x56')]=function(_0x5f48d3,_0x3ded23,_0x16419f){return db[_0xde04('0x46')]['find']({'where':{'id':_0x5f48d3[_0xde04('0x51')]['id']}})[_0xde04('0x2d')](handleEntityNotFound(_0x3ded23,null))[_0xde04('0x2d')](function(_0x19d8a4){if(_0x19d8a4){return _0x19d8a4[_0xde04('0x56')](_0x5f48d3[_0xde04('0x50')][_0xde04('0x57')],_[_0xde04('0x58')](_0x5f48d3[_0xde04('0x50')],[_0xde04('0x57'),'id'])||{});}})['then'](respondWithResult(_0x3ded23,null))[_0xde04('0x4e')](handleError(_0x3ded23,null));};exports[_0xde04('0x59')]=function(_0x1a63cd,_0x59d99b,_0x149653){var _0x2d414b={};var _0x148e1c={};var _0x461df1;var _0x1ddede;return db[_0xde04('0x46')][_0xde04('0x5a')]({'where':{'id':_0x1a63cd[_0xde04('0x51')]['id']}})['then'](handleEntityNotFound(_0x59d99b,null))[_0xde04('0x2d')](function(_0x18a134){if(_0x18a134){_0x461df1=_0x18a134;_0x148e1c[_0xde04('0x37')]=_[_0xde04('0x4b')](db[_0xde04('0x5b')][_0xde04('0x4c')]);_0x148e1c[_0xde04('0x38')]=_[_0xde04('0x4b')](_0x1a63cd[_0xde04('0x38')]);_0x148e1c[_0xde04('0x39')]=_['intersection'](_0x148e1c[_0xde04('0x37')],_0x148e1c[_0xde04('0x38')]);_0x2d414b[_0xde04('0x3b')]=_[_0xde04('0x3a')](_0x148e1c['model'],qs['fields'](_0x1a63cd[_0xde04('0x38')][_0xde04('0x3c')]));_0x2d414b[_0xde04('0x3b')]=_0x2d414b[_0xde04('0x3b')][_0xde04('0x3d')]?_0x2d414b['attributes']:_0x148e1c['model'];_0x2d414b['order']=qs[_0xde04('0x40')](_0x1a63cd[_0xde04('0x38')][_0xde04('0x40')]);_0x2d414b[_0xde04('0x41')]=qs['filters'](_[_0xde04('0x5c')](_0x1a63cd[_0xde04('0x38')],_0x148e1c[_0xde04('0x39')]));if(_0x1a63cd[_0xde04('0x38')][_0xde04('0x42')]){_0x2d414b[_0xde04('0x41')]=_[_0xde04('0x43')](_0x2d414b[_0xde04('0x41')],{'$or':_['map'](_0x2d414b[_0xde04('0x3b')],function(_0xfa2d3f){var _0x200df0={};_0x200df0[_0xfa2d3f]={'$like':'%'+_0x1a63cd[_0xde04('0x38')][_0xde04('0x42')]+'%'};return _0x200df0;})});}_0x2d414b=_[_0xde04('0x43')]({},_0x2d414b,_0x1a63cd[_0xde04('0x45')]);return _0x461df1[_0xde04('0x59')](_0x2d414b);}})['then'](function(_0x1144f9){if(_0x1144f9){_0x1ddede=_0x1144f9[_0xde04('0x3d')];if(!_0x1a63cd[_0xde04('0x38')][_0xde04('0x5d')](_0xde04('0x3e'))){_0x2d414b[_0xde04('0x25')]=qs[_0xde04('0x25')](_0x1a63cd[_0xde04('0x38')][_0xde04('0x25')]);_0x2d414b[_0xde04('0x23')]=qs[_0xde04('0x23')](_0x1a63cd['query'][_0xde04('0x23')]);}return _0x461df1['getMembers'](_0x2d414b);}})[_0xde04('0x2d')](function(_0x157567){if(_0x157567){return _0x157567?{'count':_0x1ddede,'rows':_0x157567}:null;}})[_0xde04('0x2d')](respondWithResult(_0x59d99b,null))[_0xde04('0x4e')](handleError(_0x59d99b,null));};exports[_0xde04('0x5e')]=function(_0x3216ed,_0x474378,_0x3bac29){return db['ChatGroup'][_0xde04('0x4d')]({'where':{'id':_0x3216ed[_0xde04('0x51')]['id']}})[_0xde04('0x2d')](handleEntityNotFound(_0x474378,null))[_0xde04('0x2d')](function(_0x1fef06){if(_0x1fef06){return _0x1fef06[_0xde04('0x5e')](_0x3216ed[_0xde04('0x38')][_0xde04('0x57')]);}})[_0xde04('0x2d')](respondWithStatusCode(_0x474378,null))[_0xde04('0x4e')](handleError(_0x474378,null));};exports[_0xde04('0x5f')]=function(_0x3e93f4,_0x19fd56,_0x40ecfc){if(_0x3e93f4[_0xde04('0x50')]['id']){delete _0x3e93f4[_0xde04('0x50')]['id'];}return db[_0xde04('0x46')][_0xde04('0x4d')]({'where':{'id':_0x3e93f4[_0xde04('0x51')]['id']}})['then'](handleEntityNotFound(_0x19fd56,null))['then'](function(_0x5be6d1){if(_0x5be6d1){_0x3e93f4['body']['ChatGroupId']=_0x5be6d1['id'];return db[_0xde04('0x60')][_0xde04('0x4f')](_0x3e93f4[_0xde04('0x50')]);}})[_0xde04('0x2d')](respondWithResult(_0x19fd56,null))[_0xde04('0x4e')](handleError(_0x19fd56,null));};exports['getMessages']=function(_0x241cb7,_0x580f86,_0xd385b7){var _0x536555={};var _0xd488fe={};var _0x1d1b4f;var _0x53382a;return db[_0xde04('0x46')][_0xde04('0x5a')]({'where':{'id':_0x241cb7[_0xde04('0x51')]['id']}})[_0xde04('0x2d')](handleEntityNotFound(_0x580f86,null))[_0xde04('0x2d')](function(_0x46dccc){if(_0x46dccc){_0x1d1b4f=_0x46dccc;_0xd488fe['model']=_[_0xde04('0x4b')](db[_0xde04('0x60')][_0xde04('0x4c')]);_0xd488fe[_0xde04('0x38')]=_[_0xde04('0x4b')](_0x241cb7['query']);_0xd488fe[_0xde04('0x39')]=_['intersection'](_0xd488fe[_0xde04('0x37')],_0xd488fe[_0xde04('0x38')]);_0x536555['attributes']=_[_0xde04('0x3a')](_0xd488fe[_0xde04('0x37')],qs[_0xde04('0x3c')](_0x241cb7[_0xde04('0x38')][_0xde04('0x3c')]));_0x536555[_0xde04('0x3b')]=_0x536555[_0xde04('0x3b')][_0xde04('0x3d')]?_0x536555['attributes']:_0xd488fe[_0xde04('0x37')];_0x536555[_0xde04('0x3f')]=qs[_0xde04('0x40')](_0x241cb7[_0xde04('0x38')][_0xde04('0x40')]);_0x536555['where']=qs[_0xde04('0x39')](_['pick'](_0x241cb7[_0xde04('0x38')],_0xd488fe[_0xde04('0x39')]));if(_0x241cb7[_0xde04('0x38')][_0xde04('0x42')]){_0x536555[_0xde04('0x41')]=_[_0xde04('0x43')](_0x536555[_0xde04('0x41')],{'$or':_['map'](_0x536555['attributes'],function(_0x41429a){var _0xc50ec1={};_0xc50ec1[_0x41429a]={'$like':'%'+_0x241cb7['query'][_0xde04('0x42')]+'%'};return _0xc50ec1;})});}if(_0x241cb7[_0xde04('0x38')][_0xde04('0x61')]){var _0x45104d=_0x241cb7['query']['$gte'][_0xde04('0x62')](',');var _0xd9386a={};_0xd9386a[_0x45104d[0x0]]={'$gte':moment(_0x45104d[0x1])[_0xde04('0x63')](_0xde04('0x64'))};_0x536555['where']=_['merge'](_0x536555[_0xde04('0x41')],_0xd9386a);}_0x536555=_[_0xde04('0x43')]({},_0x536555,_0x241cb7['options']);return _0x1d1b4f[_0xde04('0x65')](_0x536555);}})[_0xde04('0x2d')](function(_0x1d634e){if(_0x1d634e){_0x53382a=_0x1d634e[_0xde04('0x3d')];if(!_0x241cb7['query'][_0xde04('0x5d')](_0xde04('0x3e'))){_0x536555[_0xde04('0x25')]=qs[_0xde04('0x25')](_0x241cb7['query']['limit']);_0x536555['offset']=qs[_0xde04('0x23')](_0x241cb7[_0xde04('0x38')][_0xde04('0x23')]);}return _0x1d1b4f[_0xde04('0x65')](_0x536555);}})['then'](function(_0x353047){if(_0x353047){return _0x353047?{'count':_0x53382a,'rows':_0x353047}:null;}})[_0xde04('0x2d')](respondWithResult(_0x580f86,null))['catch'](handleError(_0x580f86,null));}; \ No newline at end of file +var _0x5963=['error','stack','name','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','options','include','rows','catch','length','find','create','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','rawAttributes','removeMembers','addMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','undefined','count','set','Content-Range','reject','update','then','destroy','end'];(function(_0x19b1c0,_0x31791d){var _0x315af8=function(_0x497fee){while(--_0x497fee){_0x19b1c0['push'](_0x19b1c0['shift']());}};_0x315af8(++_0x31791d);}(_0x5963,0x8e));var _0x3596=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5963[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x3596('0x0'));var rimraf=require(_0x3596('0x1'));var zipdir=require(_0x3596('0x2'));var jsonpatch=require(_0x3596('0x3'));var rp=require('request-promise');var moment=require(_0x3596('0x4'));var BPromise=require(_0x3596('0x5'));var Mustache=require(_0x3596('0x6'));var util=require(_0x3596('0x7'));var path=require('path');var sox=require(_0x3596('0x8'));var csv=require('to-csv');var ejs=require(_0x3596('0x9'));var fs=require('fs');var fs_extra=require(_0x3596('0xa'));var _=require('lodash');var squel=require(_0x3596('0xb'));var crypto=require(_0x3596('0xc'));var jsforce=require(_0x3596('0xd'));var deskjs=require(_0x3596('0xe'));var toCsv=require(_0x3596('0xf'));var querystring=require('querystring');var Papa=require(_0x3596('0x10'));var Redis=require(_0x3596('0x11'));var authService=require(_0x3596('0x12'));var qs=require(_0x3596('0x13'));var as=require(_0x3596('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3596('0x15'))(_0x3596('0x16'));var utils=require(_0x3596('0x17'));var config=require(_0x3596('0x18'));var licenseUtil=require(_0x3596('0x19'));var db=require(_0x3596('0x1a'))['db'];config[_0x3596('0x1b')]=_[_0x3596('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3596('0x1d'))(new Redis(config[_0x3596('0x1b')]));require(_0x3596('0x1e'))[_0x3596('0x1f')](socket);function respondWithStatusCode(_0x58886d,_0x448960){_0x448960=_0x448960||0xcc;return function(_0x42f44c){if(_0x42f44c){return _0x58886d[_0x3596('0x20')](_0x448960);}return _0x58886d[_0x3596('0x21')](_0x448960)['end']();};}function respondWithResult(_0x551685,_0xa98b04){_0xa98b04=_0xa98b04||0xc8;return function(_0x156262){if(_0x156262){return _0x551685[_0x3596('0x21')](_0xa98b04)[_0x3596('0x22')](_0x156262);}};}function respondWithFilteredResult(_0x2dc803,_0x56caca){return function(_0x4a5090){if(_0x4a5090){var _0x2d731d=typeof _0x56caca['offset']===_0x3596('0x23')&&typeof _0x56caca['limit']===_0x3596('0x23');var _0x666c23=_0x4a5090[_0x3596('0x24')];var _0x49411f=_0x2d731d?0x0:_0x56caca['offset'];var _0x29d08a=_0x2d731d?_0x4a5090[_0x3596('0x24')]:_0x56caca['offset']+_0x56caca['limit'];var _0x2dc0;if(_0x29d08a>=_0x666c23){_0x29d08a=_0x666c23;_0x2dc0=0xc8;}else{_0x2dc0=0xce;}_0x2dc803[_0x3596('0x21')](_0x2dc0);return _0x2dc803[_0x3596('0x25')](_0x3596('0x26'),_0x49411f+'-'+_0x29d08a+'/'+_0x666c23)[_0x3596('0x22')](_0x4a5090);}return null;};}function patchUpdates(_0x7d9ec5){return function(_0x473be3){try{jsonpatch['apply'](_0x473be3,_0x7d9ec5,!![]);}catch(_0x337564){return BPromise[_0x3596('0x27')](_0x337564);}return _0x473be3['save']();};}function saveUpdates(_0x42c160,_0x58a5b4){return function(_0x59bfbe){if(_0x59bfbe){return _0x59bfbe[_0x3596('0x28')](_0x42c160)[_0x3596('0x29')](function(_0x4a46c2){return _0x4a46c2;});}return null;};}function removeEntity(_0x4c56ba,_0x3be911){return function(_0x2cc38f){if(_0x2cc38f){return _0x2cc38f[_0x3596('0x2a')]()[_0x3596('0x29')](function(){_0x4c56ba[_0x3596('0x21')](0xcc)[_0x3596('0x2b')]();});}};}function handleEntityNotFound(_0x3d710a,_0x33d25e){return function(_0x3116f0){if(!_0x3116f0){_0x3d710a['sendStatus'](0x194);}return _0x3116f0;};}function handleError(_0x2565b8,_0x51907f){_0x51907f=_0x51907f||0x1f4;return function(_0x531d36){logger[_0x3596('0x2c')](_0x531d36[_0x3596('0x2d')]);if(_0x531d36[_0x3596('0x2e')]){delete _0x531d36[_0x3596('0x2e')];}_0x2565b8['status'](_0x51907f)['send'](_0x531d36);};}exports['index']=function(_0x55e6f8,_0x57d321){var _0x6d0ab3={},_0xcd05ab={},_0xea5283={'count':0x0,'rows':[]};var _0x4879c4=_[_0x3596('0x2f')](db[_0x3596('0x30')]['rawAttributes'],function(_0x42eab4){return{'name':_0x42eab4[_0x3596('0x31')],'type':_0x42eab4[_0x3596('0x32')][_0x3596('0x33')]};});_0xcd05ab[_0x3596('0x34')]=_['map'](_0x4879c4,_0x3596('0x2e'));_0xcd05ab[_0x3596('0x35')]=_[_0x3596('0x36')](_0x55e6f8[_0x3596('0x35')]);_0xcd05ab[_0x3596('0x37')]=_[_0x3596('0x38')](_0xcd05ab[_0x3596('0x34')],_0xcd05ab[_0x3596('0x35')]);_0x6d0ab3[_0x3596('0x39')]=_[_0x3596('0x38')](_0xcd05ab[_0x3596('0x34')],qs[_0x3596('0x3a')](_0x55e6f8[_0x3596('0x35')][_0x3596('0x3a')]));_0x6d0ab3[_0x3596('0x39')]=_0x6d0ab3[_0x3596('0x39')]['length']?_0x6d0ab3[_0x3596('0x39')]:_0xcd05ab[_0x3596('0x34')];if(!_0x55e6f8[_0x3596('0x35')][_0x3596('0x3b')](_0x3596('0x3c'))){_0x6d0ab3[_0x3596('0x3d')]=qs[_0x3596('0x3d')](_0x55e6f8[_0x3596('0x35')][_0x3596('0x3d')]);_0x6d0ab3['offset']=qs[_0x3596('0x3e')](_0x55e6f8[_0x3596('0x35')][_0x3596('0x3e')]);}_0x6d0ab3[_0x3596('0x3f')]=qs[_0x3596('0x40')](_0x55e6f8[_0x3596('0x35')][_0x3596('0x40')]);_0x6d0ab3[_0x3596('0x41')]=qs[_0x3596('0x37')](_[_0x3596('0x42')](_0x55e6f8[_0x3596('0x35')],_0xcd05ab['filters']),_0x4879c4);if(_0x55e6f8[_0x3596('0x35')][_0x3596('0x43')]){_0x6d0ab3[_0x3596('0x41')]=_[_0x3596('0x44')](_0x6d0ab3[_0x3596('0x41')],{'$or':_[_0x3596('0x2f')](_0x4879c4,function(_0x33b1f3){if(_0x33b1f3[_0x3596('0x32')]!=='VIRTUAL'){var _0x178989={};_0x178989[_0x33b1f3[_0x3596('0x2e')]]={'$like':'%'+_0x55e6f8['query'][_0x3596('0x43')]+'%'};return _0x178989;}})});}_0x6d0ab3=_[_0x3596('0x44')]({},_0x6d0ab3,_0x55e6f8[_0x3596('0x45')]);var _0x3cfb84={'where':_0x6d0ab3['where']};return db[_0x3596('0x30')][_0x3596('0x24')](_0x3cfb84)[_0x3596('0x29')](function(_0x24d44a){_0xea5283[_0x3596('0x24')]=_0x24d44a;if(_0x55e6f8[_0x3596('0x35')]['includeAll']){_0x6d0ab3[_0x3596('0x46')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x6d0ab3);})['then'](function(_0x29fc90){_0xea5283[_0x3596('0x47')]=_0x29fc90;return _0xea5283;})[_0x3596('0x29')](respondWithFilteredResult(_0x57d321,_0x6d0ab3))[_0x3596('0x48')](handleError(_0x57d321,null));};exports['show']=function(_0x4e0139,_0x100b56){var _0xbc19cb={'raw':!![],'where':{'id':_0x4e0139['params']['id']}},_0x126edf={};_0x126edf['model']=_[_0x3596('0x36')](db[_0x3596('0x30')]['rawAttributes']);_0x126edf[_0x3596('0x35')]=_[_0x3596('0x36')](_0x4e0139['query']);_0x126edf['filters']=_[_0x3596('0x38')](_0x126edf[_0x3596('0x34')],_0x126edf['query']);_0xbc19cb['attributes']=_[_0x3596('0x38')](_0x126edf[_0x3596('0x34')],qs[_0x3596('0x3a')](_0x4e0139[_0x3596('0x35')][_0x3596('0x3a')]));_0xbc19cb[_0x3596('0x39')]=_0xbc19cb['attributes'][_0x3596('0x49')]?_0xbc19cb[_0x3596('0x39')]:_0x126edf[_0x3596('0x34')];if(_0x4e0139['query']['includeAll']){_0xbc19cb[_0x3596('0x46')]=[{'all':!![]}];}_0xbc19cb=_[_0x3596('0x44')]({},_0xbc19cb,_0x4e0139[_0x3596('0x45')]);return db[_0x3596('0x30')][_0x3596('0x4a')](_0xbc19cb)[_0x3596('0x29')](handleEntityNotFound(_0x100b56,null))[_0x3596('0x29')](respondWithResult(_0x100b56,null))[_0x3596('0x48')](handleError(_0x100b56,null));};exports[_0x3596('0x4b')]=function(_0x4b0874,_0x53e2fa){return db[_0x3596('0x30')][_0x3596('0x4b')](_0x4b0874[_0x3596('0x4c')],{})[_0x3596('0x29')](respondWithResult(_0x53e2fa,0xc9))[_0x3596('0x48')](handleError(_0x53e2fa,null));};exports[_0x3596('0x28')]=function(_0x9431d,_0xb21668){if(_0x9431d['body']['id']){delete _0x9431d['body']['id'];}return db['ChatGroup'][_0x3596('0x4a')]({'where':{'id':_0x9431d[_0x3596('0x4d')]['id']}})[_0x3596('0x29')](handleEntityNotFound(_0xb21668,null))[_0x3596('0x29')](saveUpdates(_0x9431d[_0x3596('0x4c')],null))[_0x3596('0x29')](respondWithResult(_0xb21668,null))[_0x3596('0x48')](handleError(_0xb21668,null));};exports[_0x3596('0x2a')]=function(_0x3c959c,_0x432eef){return db['ChatGroup']['find']({'where':{'id':_0x3c959c[_0x3596('0x4d')]['id']}})['then'](handleEntityNotFound(_0x432eef,null))[_0x3596('0x29')](removeEntity(_0x432eef,null))[_0x3596('0x48')](handleError(_0x432eef,null));};exports[_0x3596('0x4e')]=function(_0x1a37b6,_0x47b2ce){return db[_0x3596('0x30')][_0x3596('0x4e')]()[_0x3596('0x29')](respondWithResult(_0x47b2ce,null))['catch'](handleError(_0x47b2ce,null));};exports['getUnread']=function(_0x4d30b5,_0x1c7558,_0xa3e5fb){return db[_0x3596('0x4f')][_0x3596('0x24')]({'where':{'ChatGroupId':_0x4d30b5[_0x3596('0x4d')]['id'],'ToId':_0x4d30b5[_0x3596('0x50')]['id'],'read':![]}})[_0x3596('0x29')](function(_0x40b741){return{'id':_[_0x3596('0x51')](_0x4d30b5[_0x3596('0x4d')]['id']),'count':_0x40b741};})['then'](respondWithResult(_0x1c7558,null))[_0x3596('0x48')](handleError(_0x1c7558,null));};exports[_0x3596('0x52')]=function(_0x131447,_0x22a043,_0x33fdfb){return db[_0x3596('0x30')][_0x3596('0x4a')]({'where':{'id':_0x131447[_0x3596('0x4d')]['id']}})[_0x3596('0x29')](handleEntityNotFound(_0x22a043,null))[_0x3596('0x29')](function(_0x368f3f){if(_0x368f3f){return _0x368f3f[_0x3596('0x52')](_0x131447[_0x3596('0x4c')][_0x3596('0x53')],_['omit'](_0x131447['body'],[_0x3596('0x53'),'id'])||{});}})['then'](respondWithResult(_0x22a043,null))[_0x3596('0x48')](handleError(_0x22a043,null));};exports[_0x3596('0x54')]=function(_0x3622a4,_0x5ccb5d,_0x154891){var _0x1542a7={};var _0x4bfc73={};var _0x22f265;var _0x258dda;return db['ChatGroup'][_0x3596('0x55')]({'where':{'id':_0x3622a4[_0x3596('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ccb5d,null))['then'](function(_0x950749){if(_0x950749){_0x22f265=_0x950749;_0x4bfc73[_0x3596('0x34')]=_['keys'](db[_0x3596('0x56')][_0x3596('0x57')]);_0x4bfc73[_0x3596('0x35')]=_[_0x3596('0x36')](_0x3622a4['query']);_0x4bfc73[_0x3596('0x37')]=_[_0x3596('0x38')](_0x4bfc73[_0x3596('0x34')],_0x4bfc73[_0x3596('0x35')]);_0x1542a7['attributes']=_[_0x3596('0x38')](_0x4bfc73[_0x3596('0x34')],qs[_0x3596('0x3a')](_0x3622a4['query'][_0x3596('0x3a')]));_0x1542a7[_0x3596('0x39')]=_0x1542a7[_0x3596('0x39')][_0x3596('0x49')]?_0x1542a7[_0x3596('0x39')]:_0x4bfc73['model'];_0x1542a7['order']=qs['sort'](_0x3622a4[_0x3596('0x35')][_0x3596('0x40')]);_0x1542a7[_0x3596('0x41')]=qs[_0x3596('0x37')](_[_0x3596('0x42')](_0x3622a4[_0x3596('0x35')],_0x4bfc73[_0x3596('0x37')]));if(_0x3622a4[_0x3596('0x35')][_0x3596('0x43')]){_0x1542a7[_0x3596('0x41')]=_[_0x3596('0x44')](_0x1542a7[_0x3596('0x41')],{'$or':_[_0x3596('0x2f')](_0x1542a7[_0x3596('0x39')],function(_0x2880a7){var _0x335a1a={};_0x335a1a[_0x2880a7]={'$like':'%'+_0x3622a4['query'][_0x3596('0x43')]+'%'};return _0x335a1a;})});}_0x1542a7=_[_0x3596('0x44')]({},_0x1542a7,_0x3622a4[_0x3596('0x45')]);return _0x22f265['getMembers'](_0x1542a7);}})[_0x3596('0x29')](function(_0x11e8f8){if(_0x11e8f8){_0x258dda=_0x11e8f8[_0x3596('0x49')];if(!_0x3622a4['query'][_0x3596('0x3b')]('nolimit')){_0x1542a7[_0x3596('0x3d')]=qs['limit'](_0x3622a4[_0x3596('0x35')]['limit']);_0x1542a7['offset']=qs[_0x3596('0x3e')](_0x3622a4[_0x3596('0x35')][_0x3596('0x3e')]);}return _0x22f265[_0x3596('0x54')](_0x1542a7);}})[_0x3596('0x29')](function(_0x203592){if(_0x203592){return _0x203592?{'count':_0x258dda,'rows':_0x203592}:null;}})[_0x3596('0x29')](respondWithResult(_0x5ccb5d,null))[_0x3596('0x48')](handleError(_0x5ccb5d,null));};exports['removeMembers']=function(_0x39d13a,_0x3f3e44,_0x5dc6dc){return db[_0x3596('0x30')][_0x3596('0x4a')]({'where':{'id':_0x39d13a[_0x3596('0x4d')]['id']}})[_0x3596('0x29')](handleEntityNotFound(_0x3f3e44,null))[_0x3596('0x29')](function(_0x4ecc2e){if(_0x4ecc2e){return _0x4ecc2e[_0x3596('0x58')](_0x39d13a[_0x3596('0x35')]['ids']);}})[_0x3596('0x29')](respondWithStatusCode(_0x3f3e44,null))[_0x3596('0x48')](handleError(_0x3f3e44,null));};exports[_0x3596('0x59')]=function(_0x147058,_0x155a48,_0x107b3e){if(_0x147058[_0x3596('0x4c')]['id']){delete _0x147058[_0x3596('0x4c')]['id'];}return db[_0x3596('0x30')][_0x3596('0x4a')]({'where':{'id':_0x147058['params']['id']}})[_0x3596('0x29')](handleEntityNotFound(_0x155a48,null))[_0x3596('0x29')](function(_0x226dec){if(_0x226dec){_0x147058[_0x3596('0x4c')]['ChatGroupId']=_0x226dec['id'];return db[_0x3596('0x4f')]['create'](_0x147058[_0x3596('0x4c')]);}})[_0x3596('0x29')](respondWithResult(_0x155a48,null))[_0x3596('0x48')](handleError(_0x155a48,null));};exports['getMessages']=function(_0x316340,_0x249142,_0x1a382c){var _0x498e15={};var _0x4c872={};var _0x4d4f79;var _0x4ba5ed;return db[_0x3596('0x30')][_0x3596('0x55')]({'where':{'id':_0x316340[_0x3596('0x4d')]['id']}})['then'](handleEntityNotFound(_0x249142,null))['then'](function(_0x480d4e){if(_0x480d4e){_0x4d4f79=_0x480d4e;_0x4c872[_0x3596('0x34')]=_[_0x3596('0x36')](db['ChatInternalMessage'][_0x3596('0x57')]);_0x4c872[_0x3596('0x35')]=_[_0x3596('0x36')](_0x316340[_0x3596('0x35')]);_0x4c872['filters']=_[_0x3596('0x38')](_0x4c872[_0x3596('0x34')],_0x4c872[_0x3596('0x35')]);_0x498e15[_0x3596('0x39')]=_[_0x3596('0x38')](_0x4c872[_0x3596('0x34')],qs['fields'](_0x316340[_0x3596('0x35')][_0x3596('0x3a')]));_0x498e15[_0x3596('0x39')]=_0x498e15[_0x3596('0x39')]['length']?_0x498e15[_0x3596('0x39')]:_0x4c872['model'];_0x498e15[_0x3596('0x3f')]=qs[_0x3596('0x40')](_0x316340[_0x3596('0x35')]['sort']);_0x498e15[_0x3596('0x41')]=qs[_0x3596('0x37')](_[_0x3596('0x42')](_0x316340[_0x3596('0x35')],_0x4c872['filters']));if(_0x316340['query'][_0x3596('0x43')]){_0x498e15[_0x3596('0x41')]=_[_0x3596('0x44')](_0x498e15['where'],{'$or':_[_0x3596('0x2f')](_0x498e15[_0x3596('0x39')],function(_0x228f7c){var _0x5d10c1={};_0x5d10c1[_0x228f7c]={'$like':'%'+_0x316340['query']['filter']+'%'};return _0x5d10c1;})});}if(_0x316340[_0x3596('0x35')][_0x3596('0x5a')]){var _0x50428e=_0x316340['query'][_0x3596('0x5a')][_0x3596('0x5b')](',');var _0x4f8acf={};_0x4f8acf[_0x50428e[0x0]]={'$gte':moment(_0x50428e[0x1])['format'](_0x3596('0x5c'))};_0x498e15[_0x3596('0x41')]=_[_0x3596('0x44')](_0x498e15[_0x3596('0x41')],_0x4f8acf);}_0x498e15=_[_0x3596('0x44')]({},_0x498e15,_0x316340[_0x3596('0x45')]);return _0x4d4f79['getMessages'](_0x498e15);}})[_0x3596('0x29')](function(_0x25166e){if(_0x25166e){_0x4ba5ed=_0x25166e[_0x3596('0x49')];if(!_0x316340[_0x3596('0x35')][_0x3596('0x3b')](_0x3596('0x3c'))){_0x498e15[_0x3596('0x3d')]=qs[_0x3596('0x3d')](_0x316340[_0x3596('0x35')][_0x3596('0x3d')]);_0x498e15[_0x3596('0x3e')]=qs['offset'](_0x316340[_0x3596('0x35')][_0x3596('0x3e')]);}return _0x4d4f79['getMessages'](_0x498e15);}})[_0x3596('0x29')](function(_0x1c001b){if(_0x1c001b){return _0x1c001b?{'count':_0x4ba5ed,'rows':_0x1c001b}:null;}})['then'](respondWithResult(_0x249142,null))[_0x3596('0x48')](handleError(_0x249142,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1348587..5eb8282 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 _0xb0ee=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xb0ee[_0x1da527];return _0x40fc7c;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xeb0e('0x0'))['db'][_0xeb0e('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xeb0e('0x2')](0x0);var events={'afterCreate':_0xeb0e('0x3'),'afterUpdate':_0xeb0e('0x4'),'afterDestroy':_0xeb0e('0x5')};function emitEvent(_0xa22c37){return function(_0x470baf,_0x441f55,_0x16f417){ChatGroupEvents['emit'](_0xa22c37+':'+_0x470baf['id'],_0x470baf);ChatGroupEvents[_0xeb0e('0x6')](_0xa22c37,_0x470baf);_0x16f417(null);};}for(var e in events){if(events[_0xeb0e('0x7')](e)){var event=events[e];ChatGroup[_0xeb0e('0x8')](e,emitEvent(event));}}module[_0xeb0e('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x8b02=['emit','hasOwnProperty','hook','exports','ChatGroup','save','update','remove'];(function(_0x1f1754,_0x2b011d){var _0x2757e6=function(_0x27a9b6){while(--_0x27a9b6){_0x1f1754['push'](_0x1f1754['shift']());}};_0x2757e6(++_0x2b011d);}(_0x8b02,0x94));var _0x28b0=function(_0x4b86bb,_0x476b58){_0x4b86bb=_0x4b86bb-0x0;var _0x197e35=_0x8b02[_0x4b86bb];return _0x197e35;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0x28b0('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28b0('0x1'),'afterUpdate':_0x28b0('0x2'),'afterDestroy':_0x28b0('0x3')};function emitEvent(_0x58c81e){return function(_0x57c671,_0x3d8ea1,_0x11c930){ChatGroupEvents[_0x28b0('0x4')](_0x58c81e+':'+_0x57c671['id'],_0x57c671);ChatGroupEvents['emit'](_0x58c81e,_0x57c671);_0x11c930(null);};}for(var e in events){if(events[_0x28b0('0x5')](e)){var event=events[e];ChatGroup[_0x28b0('0x6')](e,emitEvent(event));}}module[_0x28b0('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index bfbe0e4..c1684ed 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 _0x9b01=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./chatGroup.attributes','exports','ChatGroup','chat_groups'];(function(_0x6a0ef9,_0x317bd2){var _0x15d37e=function(_0x3b72ad){while(--_0x3b72ad){_0x6a0ef9['push'](_0x6a0ef9['shift']());}};_0x15d37e(++_0x317bd2);}(_0x9b01,0xc6));var _0x19b0=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x9b01[_0xe45118];return _0x15e15d;};'use strict';var _=require(_0x19b0('0x0'));var util=require('util');var logger=require(_0x19b0('0x1'))(_0x19b0('0x2'));var moment=require(_0x19b0('0x3'));var BPromise=require(_0x19b0('0x4'));var rp=require(_0x19b0('0x5'));var fs=require('fs');var path=require(_0x19b0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x19b0('0x7'));module[_0x19b0('0x8')]=function(_0x468855,_0x1f0df0){return _0x468855['define'](_0x19b0('0x9'),attributes,{'tableName':_0x19b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2da8=['../../config/environment','exports','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x2da8,0xf5));var _0x82da=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2da8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x82da('0x0'));var util=require(_0x82da('0x1'));var logger=require(_0x82da('0x2'))(_0x82da('0x3'));var moment=require(_0x82da('0x4'));var BPromise=require(_0x82da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82da('0x6'));var rimraf=require(_0x82da('0x7'));var config=require(_0x82da('0x8'));var attributes=require('./chatGroup.attributes');module[_0x82da('0x9')]=function(_0x5ce87e,_0xcb06e2){return _0x5ce87e['define']('ChatGroup',attributes,{'tableName':_0x82da('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 da7318e..df57e13 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 _0x9f75=['request','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket'];(function(_0x45c4c3,_0x28bf1d){var _0x572a80=function(_0x2f5a9d){while(--_0x2f5a9d){_0x45c4c3['push'](_0x45c4c3['shift']());}};_0x572a80(++_0x28bf1d);}(_0x9f75,0x15a));var _0x59f7=function(_0x142dba,_0xb77cce){_0x142dba=_0x142dba-0x0;var _0x2261b1=_0x9f75[_0x142dba];return _0x2261b1;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var moment=require(_0x59f7('0x1'));var BPromise=require(_0x59f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59f7('0x3'))['db'];var utils=require(_0x59f7('0x4'));var logger=require(_0x59f7('0x5'))(_0x59f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x59f7('0x7'));var client=jayson[_0x59f7('0x8')]['http']({'port':0x232a});config['redis']=_[_0x59f7('0x9')](config[_0x59f7('0xa')],{'host':_0x59f7('0xb'),'port':0x18eb});var socket=require(_0x59f7('0xc'))(new Redis(config[_0x59f7('0xa')]));require(_0x59f7('0xd'))['register'](socket);function respondWithRpcPromise(_0x2cd2b1,_0xdc23c7,_0x296a8d){return new BPromise(function(_0x2db28a,_0x4dbe8c){return client[_0x59f7('0xe')](_0x2cd2b1,_0x296a8d)['then'](function(_0x15a74d){logger['info'](_0x59f7('0xf'),_0xdc23c7,_0x59f7('0x10'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xdc23c7,_0x59f7('0x10'),JSON[_0x59f7('0x11')](_0x15a74d));if(_0x15a74d[_0x59f7('0x12')]){if(_0x15a74d[_0x59f7('0x12')][_0x59f7('0x13')]===0x1f4){logger[_0x59f7('0x12')]('ChatGroup,\x20%s,\x20%s',_0xdc23c7,_0x15a74d['error']['message']);return _0x4dbe8c(_0x15a74d[_0x59f7('0x12')]['message']);}logger[_0x59f7('0x12')](_0x59f7('0xf'),_0xdc23c7,_0x15a74d[_0x59f7('0x12')][_0x59f7('0x14')]);return _0x2db28a(_0x15a74d[_0x59f7('0x12')][_0x59f7('0x14')]);}else{logger[_0x59f7('0x15')](_0x59f7('0xf'),_0xdc23c7,_0x59f7('0x10'));_0x2db28a(_0x15a74d[_0x59f7('0x16')][_0x59f7('0x14')]);}})[_0x59f7('0x17')](function(_0x57dad5){logger[_0x59f7('0x12')](_0x59f7('0xf'),_0xdc23c7,_0x57dad5);_0x4dbe8c(_0x57dad5);});});} \ No newline at end of file +var _0x7a59=['http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1c6c57,_0x233fd9){var _0x5c0a59=function(_0x5421fa){while(--_0x5421fa){_0x1c6c57['push'](_0x1c6c57['shift']());}};_0x5c0a59(++_0x233fd9);}(_0x7a59,0x16e));var _0x97a5=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7a59[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97a5('0x1'));var rs=require(_0x97a5('0x2'));var fs=require('fs');var Redis=require(_0x97a5('0x3'));var db=require(_0x97a5('0x4'))['db'];var utils=require(_0x97a5('0x5'));var logger=require('../../config/logger')(_0x97a5('0x6'));var config=require(_0x97a5('0x7'));var jayson=require(_0x97a5('0x8'));var client=jayson['client'][_0x97a5('0x9')]({'port':0x232a});config[_0x97a5('0xa')]=_[_0x97a5('0xb')](config[_0x97a5('0xa')],{'host':_0x97a5('0xc'),'port':0x18eb});var socket=require(_0x97a5('0xd'))(new Redis(config[_0x97a5('0xa')]));require('./chatGroup.socket')[_0x97a5('0xe')](socket);function respondWithRpcPromise(_0x101c3f,_0xd70b51,_0x388bd7){return new BPromise(function(_0x1fc6b5,_0x4d93a5){return client['request'](_0x101c3f,_0x388bd7)[_0x97a5('0xf')](function(_0x41022d){logger[_0x97a5('0x10')]('ChatGroup,\x20%s,\x20%s',_0xd70b51,_0x97a5('0x11'));logger[_0x97a5('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xd70b51,'request\x20sent',JSON[_0x97a5('0x13')](_0x41022d));if(_0x41022d[_0x97a5('0x14')]){if(_0x41022d['error']['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0xd70b51,_0x41022d[_0x97a5('0x14')][_0x97a5('0x15')]);return _0x4d93a5(_0x41022d[_0x97a5('0x14')]['message']);}logger[_0x97a5('0x14')](_0x97a5('0x16'),_0xd70b51,_0x41022d['error'][_0x97a5('0x15')]);return _0x1fc6b5(_0x41022d['error'][_0x97a5('0x15')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0xd70b51,'request\x20sent');_0x1fc6b5(_0x41022d[_0x97a5('0x17')]['message']);}})[_0x97a5('0x18')](function(_0x9863ea){logger[_0x97a5('0x14')](_0x97a5('0x16'),_0xd70b51,_0x9863ea);_0x4d93a5(_0x9863ea);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 02b7516..8ef155c 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 _0x070e=['./chatGroup.events','remove','emit','removeListener','register','chatGroup:'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x070e,0x1d4));var _0xe070=function(_0x195c04,_0x23e0b3){_0x195c04=_0x195c04-0x0;var _0x2e5a59=_0x070e[_0x195c04];return _0x2e5a59;};'use strict';var ChatGroupEvents=require(_0xe070('0x0'));var events=['save',_0xe070('0x1'),'update'];function createListener(_0x5cee40,_0x388c4c){return function(_0x339010){_0x388c4c[_0xe070('0x2')](_0x5cee40,_0x339010);};}function removeListener(_0x11dcbd,_0x50b025){return function(){ChatGroupEvents[_0xe070('0x3')](_0x11dcbd,_0x50b025);};}exports[_0xe070('0x4')]=function(_0x12beff){for(var _0x41a9e3=0x0,_0x242bd0=events['length'];_0x41a9e3<_0x242bd0;_0x41a9e3++){var _0x3f9a9a=events[_0x41a9e3];var _0x43fe56=createListener(_0xe070('0x5')+_0x3f9a9a,_0x12beff);ChatGroupEvents['on'](_0x3f9a9a,_0x43fe56);}}; \ No newline at end of file +var _0xf81e=['emit','removeListener','register','length','save','remove','update'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0xf81e,0x138));var _0xef81=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf81e[_0x160c73];return _0xd9302;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xef81('0x0'),_0xef81('0x1'),_0xef81('0x2')];function createListener(_0x4fa655,_0x5d5d0b){return function(_0xd63715){_0x5d5d0b[_0xef81('0x3')](_0x4fa655,_0xd63715);};}function removeListener(_0x2a39c0,_0x5a559d){return function(){ChatGroupEvents[_0xef81('0x4')](_0x2a39c0,_0x5a559d);};}exports[_0xef81('0x5')]=function(_0x21ea0a){for(var _0x453e47=0x0,_0x37e804=events[_0xef81('0x6')];_0x453e47<_0x37e804;_0x453e47++){var _0x3af853=events[_0x453e47];var _0xebbe82=createListener('chatGroup:'+_0x3af853,_0x21ea0a);ChatGroupEvents['on'](_0x3af853,_0xebbe82);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 429cbb2..7377395 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 _0x5c46=['/:id/messages','getMessages','post','addMembers','put','/:id','update','destroy','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','index','get','isAuthenticated','describe','show','getUnread','/:id/members','getMembers'];(function(_0xe2a095,_0x474ba7){var _0x4c00a5=function(_0x358d3f){while(--_0x358d3f){_0xe2a095['push'](_0xe2a095['shift']());}};_0x4c00a5(++_0x474ba7);}(_0x5c46,0x184));var _0x65c4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5c46[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x65c4('0x0'));var util=require(_0x65c4('0x1'));var path=require(_0x65c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x65c4('0x3'));var router=express[_0x65c4('0x4')]();var fs_extra=require(_0x65c4('0x5'));var auth=require(_0x65c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x65c4('0x7'));var controller=require(_0x65c4('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x65c4('0x9')]);router[_0x65c4('0xa')]('/describe',auth[_0x65c4('0xb')](),controller[_0x65c4('0xc')]);router[_0x65c4('0xa')]('/:id',auth[_0x65c4('0xb')](),controller[_0x65c4('0xd')]);router[_0x65c4('0xa')]('/:id/unread',auth[_0x65c4('0xb')](),controller[_0x65c4('0xe')]);router[_0x65c4('0xa')](_0x65c4('0xf'),auth[_0x65c4('0xb')](),controller[_0x65c4('0x10')]);router[_0x65c4('0xa')](_0x65c4('0x11'),auth['isAuthenticated'](),controller[_0x65c4('0x12')]);router[_0x65c4('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65c4('0x13')](_0x65c4('0xf'),auth[_0x65c4('0xb')](),controller[_0x65c4('0x14')]);router['post'](_0x65c4('0x11'),auth[_0x65c4('0xb')](),controller['addMessage']);router[_0x65c4('0x15')](_0x65c4('0x16'),auth[_0x65c4('0xb')](),controller[_0x65c4('0x17')]);router['delete'](_0x65c4('0x16'),auth['isAuthenticated'](),controller[_0x65c4('0x18')]);router[_0x65c4('0x19')](_0x65c4('0xf'),auth[_0x65c4('0xb')](),controller['removeMembers']);module[_0x65c4('0x1a')]=router; \ No newline at end of file +var _0x6630=['removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMessage','delete'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x6630,0x1ab));var _0x0663=function(_0x1c6175,_0x1a6ea5){_0x1c6175=_0x1c6175-0x0;var _0x4692cb=_0x6630[_0x1c6175];return _0x4692cb;};'use strict';var multer=require(_0x0663('0x0'));var util=require(_0x0663('0x1'));var path=require(_0x0663('0x2'));var timeout=require(_0x0663('0x3'));var express=require(_0x0663('0x4'));var router=express[_0x0663('0x5')]();var fs_extra=require(_0x0663('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0663('0x7'));router[_0x0663('0x8')]('/',auth[_0x0663('0x9')](),controller['index']);router[_0x0663('0x8')](_0x0663('0xa'),auth['isAuthenticated'](),controller[_0x0663('0xb')]);router[_0x0663('0x8')](_0x0663('0xc'),auth['isAuthenticated'](),controller[_0x0663('0xd')]);router['get']('/:id/unread',auth[_0x0663('0x9')](),controller[_0x0663('0xe')]);router[_0x0663('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x0663('0xf')]);router[_0x0663('0x8')](_0x0663('0x10'),auth[_0x0663('0x9')](),controller[_0x0663('0x11')]);router[_0x0663('0x12')]('/',auth[_0x0663('0x9')](),controller[_0x0663('0x13')]);router[_0x0663('0x12')](_0x0663('0x14'),auth[_0x0663('0x9')](),controller['addMembers']);router[_0x0663('0x12')](_0x0663('0x10'),auth[_0x0663('0x9')](),controller[_0x0663('0x15')]);router['put'](_0x0663('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0663('0x16')](_0x0663('0xc'),auth[_0x0663('0x9')](),controller['destroy']);router[_0x0663('0x16')]('/:id/members',auth[_0x0663('0x9')](),controller[_0x0663('0x17')]);module[_0x0663('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8c94d46..226bd9b 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 _0x2f3a=['BOOLEAN','sequelize','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','out'];(function(_0x7e3462,_0x537e7a){var _0x15cf2c=function(_0x5048b5){while(--_0x5048b5){_0x7e3462['push'](_0x7e3462['shift']());}};_0x15cf2c(++_0x537e7a);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x10d2d9,_0x5e1acc){_0x10d2d9=_0x10d2d9-0x0;var _0xb0dc2d=_0x2f3a[_0x10d2d9];return _0xb0dc2d;};'use strict';var Sequelize=require(_0xa2f3('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa2f3('0x1')]},'ratingType':{'type':Sequelize[_0xa2f3('0x2')](_0xa2f3('0x3'),_0xa2f3('0x4')),'defaultValue':_0xa2f3('0x3')},'ratingMessage':{'type':Sequelize[_0xa2f3('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xa2f3('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa2f3('0x6')]},'secondDisposition':{'type':Sequelize[_0xa2f3('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xa2f3('0x6')]},'browserVersion':{'type':Sequelize[_0xa2f3('0x6')]},'osName':{'type':Sequelize[_0xa2f3('0x6')]},'osVersion':{'type':Sequelize[_0xa2f3('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa2f3('0x6')]},'deviceType':{'type':Sequelize[_0xa2f3('0x6')]},'referer':{'type':Sequelize[_0xa2f3('0x5')]},'customerIp':{'type':Sequelize[_0xa2f3('0x6')]},'formData':{'type':Sequelize[_0xa2f3('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xa2f3('0x7')]},'lastMsgAt':{'type':Sequelize[_0xa2f3('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa2f3('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa2f3('0x6')]},'customerPort':{'type':Sequelize[_0xa2f3('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xa2f3('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xb5fb=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x34e14d,_0x5dea39){var _0x3d8e08=function(_0x134769){while(--_0x134769){_0x34e14d['push'](_0x34e14d['shift']());}};_0x3d8e08(++_0x5dea39);}(_0xb5fb,0x172));var _0xbb5f=function(_0xb4bed2,_0x1ba3db){_0xb4bed2=_0xb4bed2-0x0;var _0x17a2a5=_0xb5fb[_0xb4bed2];return _0x17a2a5;};'use strict';var Sequelize=require(_0xbb5f('0x0'));module[_0xbb5f('0x1')]={'closed':{'type':Sequelize[_0xbb5f('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbb5f('0x3')]},'ratingType':{'type':Sequelize[_0xbb5f('0x4')](_0xbb5f('0x5'),_0xbb5f('0x6')),'defaultValue':_0xbb5f('0x5')},'ratingMessage':{'type':Sequelize[_0xbb5f('0x7')]},'pathTranscript':{'type':Sequelize[_0xbb5f('0x7')]},'mailTranscript':{'type':Sequelize[_0xbb5f('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbb5f('0x9')]},'disposition':{'type':Sequelize[_0xbb5f('0x8')]},'secondDisposition':{'type':Sequelize[_0xbb5f('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xbb5f('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xbb5f('0x8')]},'osVersion':{'type':Sequelize[_0xbb5f('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xbb5f('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xbb5f('0x8')]},'formData':{'type':Sequelize[_0xbb5f('0x7')](_0xbb5f('0xa'))},'read1stAt':{'type':Sequelize[_0xbb5f('0x9')]},'lastMsgAt':{'type':Sequelize[_0xbb5f('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xbb5f('0x4')]('in',_0xbb5f('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbb5f('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xbb5f('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7771242..c040702 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 _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x4d3bfa,_0x5ab06f){var _0x298ab2=function(_0x45efe8){while(--_0x45efe8){_0x4d3bfa['push'](_0x4d3bfa['shift']());}};_0x298ab2(++_0x5ab06f);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file +var _0xb10b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','stack','name','send','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','catch','show','params','keys','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','close','mailTranscript','root','now','Messages','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','includeAgent','alias','findAll','setTags','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','disposition','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x5fc4f9,_0x75415d){var _0x3d82ab=function(_0x233903){while(--_0x233903){_0x5fc4f9['push'](_0x5fc4f9['shift']());}};_0x3d82ab(++_0x75415d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b7fdc,_0x3e29ce){_0x4b7fdc=_0x4b7fdc-0x0;var _0x32a791=_0xb10b[_0x4b7fdc];return _0x32a791;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xbb10('0x13'));var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))('api');var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x17'));var db=require(_0xbb10('0x18'))['db'];config[_0xbb10('0x19')]=_[_0xbb10('0x1a')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);var jayson=require(_0xbb10('0x1e'));var client=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232b});var client9004=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3e26f4,_0x2b184e,_0x4a2bfc,_0x2eca0f){return new BPromise(function(_0x1145f1,_0x133ac2){var _0x42db98=_0x2eca0f||client;return _0x42db98[_0xbb10('0x21')](_0x3e26f4,_0x4a2bfc)[_0xbb10('0x22')](function(_0x575cca){logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));logger['debug'](_0xbb10('0x26'),_0x2b184e,_0xbb10('0x25'),JSON[_0xbb10('0x27')](_0x575cca));if(_0x575cca[_0xbb10('0x28')]){if(_0x575cca[_0xbb10('0x28')][_0xbb10('0x29')]===0x1f4){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')]['message']);return _0x133ac2(_0x575cca['error'][_0xbb10('0x2a')]);}logger[_0xbb10('0x28')](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x1145f1(_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);}else{logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));_0x1145f1(_0x575cca[_0xbb10('0x2b')][_0xbb10('0x2a')]);}})['catch'](function(_0x4fedac){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x4fedac);_0x133ac2(_0x4fedac);});});}function respondWithStatusCode(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0xcc;return function(_0x4e25ff){if(_0x4e25ff){return _0x3c5ae7[_0xbb10('0x2c')](_0x2c89b9);}return _0x3c5ae7[_0xbb10('0x2d')](_0x2c89b9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xc8;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9)['json'](_0x20d946);}};}function respondWithFilteredResult(_0x3796c7,_0x21ac54){return function(_0xfc3595){if(_0xfc3595){var _0x2e0249=typeof _0x21ac54[_0xbb10('0x2f')]===_0xbb10('0x30')&&typeof _0x21ac54['limit']===_0xbb10('0x30');var _0x4ee02e=_0xfc3595[_0xbb10('0x31')];var _0x56f2da=_0x2e0249?0x0:_0x21ac54[_0xbb10('0x2f')];var _0x1dcc9c=_0x2e0249?_0xfc3595[_0xbb10('0x31')]:_0x21ac54['offset']+_0x21ac54['limit'];var _0x4c3744;if(_0x1dcc9c>=_0x4ee02e){_0x1dcc9c=_0x4ee02e;_0x4c3744=0xc8;}else{_0x4c3744=0xce;}_0x3796c7[_0xbb10('0x2d')](_0x4c3744);return _0x3796c7['set'](_0xbb10('0x32'),_0x56f2da+'-'+_0x1dcc9c+'/'+_0x4ee02e)[_0xbb10('0x33')](_0xfc3595);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x22')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x22')](function(){_0x188cbd[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x28')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}function getMustacheRender(_0x25d72f,_0x52de31){return Mustache['render'](_0x25d72f,_['merge'](_0x52de31[_0xbb10('0x3a')],{'contact':_0x52de31[_0xbb10('0x3b')],'message':_0x52de31[_0xbb10('0x2a')],'agent':_0x52de31['agent'],'interaction':_0x52de31[_0xbb10('0x3c')],'account':_0x52de31[_0xbb10('0x3d')]}))||'';}function getInteractionUsers(_0x4345f3,_0x4d1a83){return new BPromise(function(_0x17b6c5,_0x12238a){try{if(_0x4d1a83[_0x4345f3['id']]){_0x4345f3[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](_0x4d1a83[_0x4345f3['id']],function(_0x4f1cdd){return{'id':_0x4f1cdd['id'],'fullname':_0x4f1cdd[_0xbb10('0x40')]};});}}catch(_0x110eb5){_0x12238a(_0x110eb5);}_0x17b6c5(_0x4345f3);});}function getInteractionTags(_0x5835fd,_0xe2040f){return new BPromise(function(_0x2e3214,_0x44d6ae){try{if(_0x5835fd[_0xbb10('0x41')]){_0x5835fd[_0xbb10('0x42')]=[];_0x5835fd[_0xbb10('0x41')]['split'](',')[_0xbb10('0x43')](function(_0x1c7fae){_0x5835fd[_0xbb10('0x42')][_0xbb10('0x44')](_0xe2040f[_0x1c7fae]);});}delete _0x5835fd['TagIds'];}catch(_0x3fff6c){_0x44d6ae(_0x3fff6c);}_0x2e3214(_0x5835fd);});}function updateChatInteraction(_0x331751,_0x23dc18,_0x403beb){return new BPromise(function(_0x5e2cfa,_0x351484){return getInteractionUsers(_0x331751,_0x403beb)[_0xbb10('0x22')](function(_0x54ac18){return getInteractionTags(_0x54ac18,_0x23dc18);})['then'](function(_0x38d78f){_0x5e2cfa(_0x38d78f);})['catch'](function(_0x318984){_0x351484(_0x318984);});});}exports[_0xbb10('0x45')]=function(_0x4c66d8,_0x366608){var _0x1d82bf={},_0x474e99={},_0x5cf4f8={'count':0x0,'rows':[]};var _0x2dd02b=_[_0xbb10('0x3f')](db[_0xbb10('0x46')][_0xbb10('0x47')],function(_0x36e1fa){return{'name':_0x36e1fa[_0xbb10('0x48')],'type':_0x36e1fa[_0xbb10('0x49')][_0xbb10('0x4a')]};});_0x474e99[_0xbb10('0x4b')]=_[_0xbb10('0x3f')](_0x2dd02b,_0xbb10('0x38'));_0x474e99[_0xbb10('0x4c')]=_['keys'](_0x4c66d8[_0xbb10('0x4c')]);_0x474e99[_0xbb10('0x4d')]=_['intersection'](_0x474e99[_0xbb10('0x4b')],_0x474e99[_0xbb10('0x4c')]);_0x1d82bf[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x474e99[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4c66d8[_0xbb10('0x4c')]['fields']));_0x1d82bf['attributes']=_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x51')]?_0x1d82bf[_0xbb10('0x4e')]:_0x474e99['model'];if(!_0x4c66d8['query'][_0xbb10('0x52')](_0xbb10('0x53'))){_0x1d82bf[_0xbb10('0x54')]=qs[_0xbb10('0x54')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x1d82bf[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x1d82bf['order']=qs['sort'](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x1d82bf[_0xbb10('0x56')]=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x4c66d8[_0xbb10('0x4c')],_0x474e99[_0xbb10('0x4d')]),_0x2dd02b);var _0x445870=[];var _0x1c0d8f=squel[_0xbb10('0x58')]()[_0xbb10('0x59')]('id')[_0xbb10('0x59')](_0xbb10('0x38'))[_0xbb10('0x59')](_0xbb10('0x5a'))['from'](_0xbb10('0x5b'));var _0x5bd44d=squel[_0xbb10('0x58')]()[_0xbb10('0x59')](_0xbb10('0x5c'))[_0xbb10('0x59')](_0xbb10('0x5d'))[_0xbb10('0x59')](_0xbb10('0x5e'))[_0xbb10('0x5f')](_0xbb10('0x60'),'ui')[_0xbb10('0x61')](_0xbb10('0x62'),'u',_0xbb10('0x63'));var _0x1d49e1=squel[_0xbb10('0x58')]()[_0xbb10('0x5f')]('chat_interactions','i')[_0xbb10('0x61')](_0xbb10('0x64'),'c',_0xbb10('0x65'))[_0xbb10('0x61')](_0xbb10('0x62'),'o',_0xbb10('0x66'))['left_join'](_0xbb10('0x67'),'a',_0xbb10('0x68'))[_0xbb10('0x61')](_0xbb10('0x69'),'me',_0xbb10('0x6a'))[_0xbb10('0x61')](_0xbb10('0x6b'),'it',_0xbb10('0x6c'))[_0xbb10('0x61')](_0xbb10('0x5b'),'t',_0xbb10('0x6d'));var _0x2a1ce1=squel[_0xbb10('0x6e')]();var _0x4e7fac=[];var _0x4ea1a6=squel[_0xbb10('0x6e')]();var _0x3e6338;if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x6f')]){_0x3e6338=as['parseSearch'](_0x4c66d8['query'][_0xbb10('0x6f')]);var _0xaf2cc3=_0x3e6338[_0xbb10('0x70')];for(var _0x2dd150=0x0;_0x2dd150<_0x3e6338[_0xbb10('0x71')][_0xbb10('0x51')];_0x2dd150++){var _0x45c0dc=_0x3e6338['conditions'][_0x2dd150];var _0x117e84='i';var _0x216cff=_['find'](_0x2dd02b,['name',_0x45c0dc['field']]);if(!_0x216cff){switch(_0x45c0dc[_0xbb10('0x59')]){case _0xbb10('0x72'):if(_0x45c0dc[_0xbb10('0x73')]==0x1){_0x1d49e1['having']('`'+_0x45c0dc['field']+'`\x20=\x200');}else{_0x1d49e1[_0xbb10('0x74')]('`'+_0x45c0dc[_0xbb10('0x59')]+_0xbb10('0x75'));}break;case'Contact':if(_0x45c0dc[_0xbb10('0x76')]===_0xbb10('0x77')){if(_0x45c0dc['value']['split']('\x20')[_0xbb10('0x51')]>0x1){_0x2a1ce1[_0xaf2cc3](_0xbb10('0x78'),qs[_0xbb10('0x79')](_0x45c0dc[_0xbb10('0x73')]),null);}else{var _0x54b7c5='%'+_0x45c0dc[_0xbb10('0x73')]+'%';_0x2a1ce1[_0xaf2cc3](_0xbb10('0x7a'),_0x54b7c5,_0x54b7c5,_0x54b7c5);}}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,['name',_0xbb10('0x7c')]);_0x45c0dc[_0xbb10('0x59')]=_0xbb10('0x7c');_0x329da7=as['buildExpression'](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x7f'):var _0x108e5b=_0x45c0dc[_0xbb10('0x73')]['split'](',')[_0xbb10('0x3f')](function(_0x277fe7){return Number(_0x277fe7);});_0x108e5b[_0xbb10('0x43')](function(_0x2ceb3e){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x2ceb3e+',%');});_0x4e7fac=_[_0xbb10('0x81')](_0x4e7fac,_0x108e5b);break;case _0xbb10('0x82'):if(_0x45c0dc['operator']==='$substring'){_0x2a1ce1[_0xaf2cc3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45c0dc[_0xbb10('0x73')]+'%',null);}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,[_0xbb10('0x38'),'UserId']);_0x45c0dc['field']=_0xbb10('0x83');_0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x3a'):_0x329da7=as[_0xbb10('0x84')]('me',null,_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')]['start'],_0x329da7['value']['end']);break;}}else{var _0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}}}else{var _0x4bc316=_(_0x4c66d8['query'])['keys']()[_0xbb10('0x3f')](function(_0x13040d){return _[_0xbb10('0x85')](_0x2dd02b,[_0xbb10('0x38'),_0x13040d])?_0x13040d:undefined;})['compact']()[_0xbb10('0x73')]();if(!_['isEmpty'](_0x4bc316)){_0x4bc316['forEach'](function(_0x165fe9){if(_0x165fe9===_0xbb10('0x86')){_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),[][_0xbb10('0x88')](_0x4c66d8['query'][_0x165fe9]));}else if(_0x165fe9===_0xbb10('0x89')){var _0x19fcec=JSON[_0xbb10('0x8a')](_0x4c66d8[_0xbb10('0x4c')][_0x165fe9])[_0xbb10('0x8b')];var _0x27f42f=JSON[_0xbb10('0x8a')](_0x4c66d8['query'][_0x165fe9])[_0xbb10('0x8c')];_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x8d'),_0x19fcec,_0x27f42f);}else{if(_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]===_0xbb10('0x8e')){_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+_0xbb10('0x8f'));}else{_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+'\x20=\x20?',_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]);}}});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x90')]){if(_0x4c66d8['query']['read']==0x1){_0x1d49e1['having'](_0xbb10('0x91'));}else{_0x1d49e1['having']('`unreadMessages`\x20>\x200');}}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]){_0x4e7fac=_[_0xbb10('0x93')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')])?_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]:new Array(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]);_0x4e7fac['forEach'](function(_0x318a14){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x318a14+',%');});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x94')]){var _0x5c8eb8=_0x4c66d8['query'][_0xbb10('0x94')][_0xbb10('0x95')]('\x5c','\x5c\x5c')[_0xbb10('0x95')](/'/g,'\x27\x27');if(qs[_0xbb10('0x96')](_0x5c8eb8)){_0x2a1ce1['or']('i.id\x20LIKE\x20?',_0x5c8eb8+'%');}else{_0x2a1ce1['or'](_0xbb10('0x97'),qs[_0xbb10('0x79')](_0x5c8eb8))['or'](_0xbb10('0x98'),_0x5c8eb8+'%');}}}_0x1d49e1[_0xbb10('0x56')](_0x2a1ce1);_0x1d49e1[_0xbb10('0x99')]('i.id');var _0x5f0691={'type':db[_0xbb10('0x9a')][_0xbb10('0x9b')][_0xbb10('0x9c')],'raw':!![]};var _0x5239da=_0x1d49e1[_0xbb10('0x9d')]();_0x5239da[_0xbb10('0x59')]('i.id');_0x5239da['field'](_0xbb10('0x9e'),_0xbb10('0x72'));if(_0x1d82bf[_0xbb10('0x9f')]){_0x1d82bf['order'][_0xbb10('0x43')](function(_0x3a17fc){var _0xfbb365=_0x3a17fc[0x0]===_0xbb10('0xa0')?_0x3a17fc[0x0]:'i.'+_0x3a17fc[0x0];_0x1d49e1[_0xbb10('0x9f')](_0xfbb365,_0x3a17fc[0x1]===_0xbb10('0xa1')?![]:!![]);});}if(!_[_0xbb10('0xa2')](_0x4e7fac)){_0x1d49e1[_0xbb10('0x74')](_0x4ea1a6);_0x5239da[_0xbb10('0x56')]('t.id\x20IN\x20?',_0x4e7fac);}BPromise[_0xbb10('0xa3')]()[_0xbb10('0x22')](function(){if(!_0x3e6338){if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x86')])return;_0x5239da[_0xbb10('0x56')](_0xbb10('0xa4'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0xa4'));return;}if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]!==_0xbb10('0xa7'))return;return _0x4c66d8[_0xbb10('0xa5')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0xe1fc51){if(_[_0xbb10('0xa2')](_0xe1fc51)){_0x5239da[_0xbb10('0x56')](_0xbb10('0xa8'));_0x1d49e1[_0xbb10('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x5239da[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));}});})['then'](function(){if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]==='agent'&&!_0x3e6338&&!_0x4c66d8[_0xbb10('0x4c')]['ChatWebsiteId'])return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5239da[_0xbb10('0xaa')](),_0x5f0691);})[_0xbb10('0x22')](function(_0x3a4a6e){_0x5cf4f8['count']=_0x3a4a6e[_0xbb10('0x51')];if(_0x5cf4f8['count']===0x0)return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1c0d8f['toString'](),_0x5f0691)['then'](function(_0x415407){_0x445870=_[_0xbb10('0xab')](_0x415407,'id');_0x5f0691=_[_0xbb10('0xac')](_0x5f0691,{'model':db[_0xbb10('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x50')]){_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x43')](function(_0x252ab8){_0x1d49e1[_0xbb10('0x59')]('i.'+_0x252ab8);});}else{_0x1d49e1[_0xbb10('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbb10('0x72'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xad'),_0xbb10('0xae'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xaf'),_0xbb10('0xb0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb1'),_0xbb10('0xa0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb2'));_0x1d49e1['field'](_0xbb10('0xb3'),'Contact.firstName');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb4'),_0xbb10('0xb5'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb6'),'Contact.email');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb7'),_0xbb10('0xb8'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb9'),_0xbb10('0xba'));_0x1d49e1['field']('c.fax',_0xbb10('0xbb'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbc'),'Owner.fullname');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbd'),'Owner.internal');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbe'),'TagIds');}if(_0x1d82bf[_0xbb10('0x54')])_0x1d49e1['limit'](_0x1d82bf[_0xbb10('0x54')]);if(_0x1d82bf[_0xbb10('0x2f')])_0x1d49e1['offset'](_0x1d82bf[_0xbb10('0x2f')]);return db[_0xbb10('0xa9')]['query'](_0x1d49e1['toString'](),_0x5f0691);})[_0xbb10('0x22')](function(_0x13ae83){if(_0x13ae83[_0xbb10('0x51')]>0x0)_0x5bd44d[_0xbb10('0x56')](_0xbb10('0xbf'),_['map'](_0x13ae83,'id'));return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5bd44d[_0xbb10('0xaa')](),_0x5f0691)['then'](function(_0xd68afa){var _0x4f90e6=_[_0xbb10('0xc0')](_0xd68afa,_0xbb10('0xc1'));var _0x44a3e1=[];_0x13ae83[_0xbb10('0x43')](function(_0x1f55d3){_0x44a3e1[_0xbb10('0x44')](updateChatInteraction(_0x1f55d3,_0x445870,_0x4f90e6));});return BPromise[_0xbb10('0xc2')](_0x44a3e1);});});})['then'](function(_0x4fc544){_0x5cf4f8[_0xbb10('0xc3')]=_0x4fc544;return _0x5cf4f8;})[_0xbb10('0x22')](respondWithFilteredResult(_0x366608,_0x1d82bf))[_0xbb10('0xc4')](handleError(_0x366608,null));};exports[_0xbb10('0xc5')]=function(_0x20b585,_0x363b81){var _0x1cccec={'raw':![],'where':{'id':_0x20b585[_0xbb10('0xc6')]['id']}},_0x1674f7={};_0x1674f7[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db[_0xbb10('0x46')][_0xbb10('0x47')]);_0x1674f7['query']=_[_0xbb10('0xc7')](_0x20b585[_0xbb10('0x4c')]);_0x1674f7[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],_0x1674f7[_0xbb10('0x4c')]);_0x1cccec[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x20b585[_0xbb10('0x4c')]['fields']));_0x1cccec[_0xbb10('0x4e')]=_0x1cccec['attributes'][_0xbb10('0x51')]?_0x1cccec[_0xbb10('0x4e')]:_0x1674f7[_0xbb10('0x4b')];if(_0x20b585[_0xbb10('0x4c')][_0xbb10('0xc8')]){_0x1cccec[_0xbb10('0xc9')]=[{'all':!![]}];}_0x1cccec=_['merge']({},_0x1cccec,_0x20b585[_0xbb10('0xca')]);return db['ChatInteraction'][_0xbb10('0x7b')](_0x1cccec)[_0xbb10('0x22')](handleEntityNotFound(_0x363b81,null))[_0xbb10('0x22')](respondWithResult(_0x363b81,null))[_0xbb10('0xc4')](handleError(_0x363b81,null));};exports[_0xbb10('0xcb')]=function(_0x31907e,_0x4f06c){return db[_0xbb10('0x46')][_0xbb10('0xcb')](_0x31907e[_0xbb10('0x3a')],{})[_0xbb10('0x22')](respondWithResult(_0x4f06c,0xc9))[_0xbb10('0xc4')](handleError(_0x4f06c,null));};exports['update']=function(_0x3696b3,_0x516520){if(_0x3696b3[_0xbb10('0x3a')]['id']){delete _0x3696b3[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x3696b3[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x516520,null))[_0xbb10('0x22')](saveUpdates(_0x3696b3['body'],null))[_0xbb10('0x22')](respondWithResult(_0x516520,null))['catch'](handleError(_0x516520,null));};exports['destroy']=function(_0x1513e0,_0x35cbb9){return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x1513e0[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x35cbb9,null))['then'](removeEntity(_0x35cbb9,null))[_0xbb10('0xc4')](handleError(_0x35cbb9,null));};exports[_0xbb10('0xcc')]=function(_0x39aa9e,_0xb1b7c8){return db[_0xbb10('0x46')][_0xbb10('0xcc')]()['then'](respondWithResult(_0xb1b7c8,null))[_0xbb10('0xc4')](handleError(_0xb1b7c8,null));};exports[_0xbb10('0xcd')]=function(_0xb7c454,_0xa8b7c3){var _0x31718f=_0xb7c454[_0xbb10('0xc6')]['id'];var _0x2764e1;var _0x5e405b;var _0x33a43e;return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x31718f}})['then'](function(_0x4c8b68){_0x2764e1=_0x4c8b68;return db[_0xbb10('0xcf')][_0xbb10('0xce')]({'where':{'id':_0x4c8b68[_0xbb10('0x86')]},'attributes':['id',_0xbb10('0xd0'),_0xbb10('0xd1'),'vidaooTopic',_0xbb10('0xd2'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x4dd138){if(_0x4dd138&&_0x4dd138[_0xbb10('0xd0')]&&_0x4dd138[_0xbb10('0xd1')]){_0x5e405b=_0x4dd138;var _0x1b9012={'interaction':{'id':_0x31718f},'agent':{'id':_0xb7c454[_0xbb10('0xa5')]['id'],'name':_0xb7c454[_0xbb10('0xa5')]['name'],'fullname':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0x40')],'email':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]},'contact':_0xb7c454[_0xbb10('0x3a')][_0xbb10('0x3b')],'account':_0xb7c454[_0xbb10('0x3a')]['account']};var _0x4c95c2={'rejectUnauthorized':![],'method':'POST','url':_0xbb10('0xd4'),'headers':{'X-APIKEY':_0x4dd138[_0xbb10('0xd0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]],'buttons':null,'topic':_0x5e405b[_0xbb10('0xd5')],'note':_[_0xbb10('0xd6')](_0x5e405b[_0xbb10('0xd2')])?null:getMustacheRender(_0x5e405b[_0xbb10('0xd2')],_0x1b9012),'metadata':null},'redirect':_0xbb10('0xd7'),'json':!![]};try{if(!_[_0xbb10('0xd6')](_0x5e405b['vidaooMetadata'])){var _0x58295f=getMustacheRender(_0x5e405b['vidaooMetadata'],_0x1b9012);var _0x3d4b89=JSON[_0xbb10('0x8a')](_0x58295f);_0x4c95c2[_0xbb10('0x3a')]['metadata']=_0x3d4b89;}}catch(_0x2bfa8e){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xd9'));}return rp(_0x4c95c2);}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x356660){_0x33a43e=_0x356660;if(_0x33a43e['id']){var _0x48889b={'body':_0x33a43e[_0xbb10('0xda')],'ChatWebsiteId':_0x5e405b['id'],'ChatInteractionId':_0x2764e1['id'],'direction':_0xbb10('0xdb'),'UserId':_0xb7c454[_0xbb10('0xa5')]['id']};return db[_0xbb10('0xdc')][_0xbb10('0xcb')](_0x48889b,{});}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xdd'));}})[_0xbb10('0x22')](function(){return _0x2764e1[_0xbb10('0xde')]({'vidaooSessionId':_0x33a43e['id']});})['then'](respondWithResult(_0xa8b7c3,null))[_0xbb10('0xc4')](handleError(_0xa8b7c3,null));};exports['customUpdate']=function(_0x27bed2,_0x5547fa){if(_0x27bed2[_0xbb10('0x3a')]['id']){delete _0x27bed2[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x27bed2['params']['id']},'include':[{'model':db[_0xbb10('0xdf')],'as':'Contact'}]})[_0xbb10('0x22')](handleEntityNotFound(_0x5547fa,null))[_0xbb10('0x22')](saveUpdates(_0x27bed2[_0xbb10('0x3a')],null))['then'](respondWithResult(_0x5547fa,null))[_0xbb10('0xc4')](handleError(_0x5547fa,null));};exports[_0xbb10('0xe0')]=function(_0x140173,_0x18a44f,_0x11d31b){if(_0x140173[_0xbb10('0x3a')]['id']){delete _0x140173['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x140173[_0xbb10('0xc6')]['id']}})['then'](function(_0x318908){if(!_0x318908){logger['error'](_0xbb10('0xe1'),_0xbb10('0xe0'),0x194,_0xbb10('0xe2'));_0x18a44f['sendStatus'](0x194);}else{if(_0x318908['UserId']){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xe3'));}}return _0x318908;})['then'](function(_0x440108){if(_0x440108){return _0x440108[_0xbb10('0x36')]({'closed':_0x140173[_0xbb10('0x3a')]['closed'],'disposition':_0x140173['body']['disposition']})[_0xbb10('0x22')](function(_0x55aa03){return _0x55aa03;});}})[_0xbb10('0x22')](function(_0x1c2c95){return respondWithRpcPromise(_0xbb10('0xe4'),_0xbb10('0xe0'),_0x140173[_0xbb10('0x3a')],client9004);})[_0xbb10('0x22')](respondWithResult(_0x18a44f,null))[_0xbb10('0xc4')](handleError(_0x18a44f,null));};exports[_0xbb10('0xe5')]=function(_0x2746eb,_0x431792,_0x2e2710){_0x2746eb['body'][_0xbb10('0x38')]=_0x2746eb[_0xbb10('0xe6')]['originalname'];_0x2746eb[_0xbb10('0x3a')]['basename']=_0x2746eb['file'][_0xbb10('0xe7')];_0x2746eb[_0xbb10('0x3a')][_0xbb10('0x49')]=_0x2746eb[_0xbb10('0xe6')][_0xbb10('0xe8')];return db['Attachment'][_0xbb10('0xcb')](_0x2746eb[_0xbb10('0x3a')])['then'](respondWithResult(_0x431792,0xc9))[_0xbb10('0xc4')](handleError(_0x431792,null));};exports[_0xbb10('0xe9')]=function(_0x5a82e7,_0x424c96,_0x4c769b){return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0xc6')]['id']},'raw':!![]})[_0xbb10('0x22')](handleEntityNotFound(_0x424c96,null))[_0xbb10('0x22')](function(_0x20b312){if(_0x20b312){if(_0x20b312[_0xbb10('0xea')]){return _0x424c96['status'](0x193)[_0xbb10('0x33')]({'status':0x193,'message':_0xbb10('0xeb')});}return db[_0xbb10('0xec')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0x4c')][_0xbb10('0xed')]},'raw':!![]})['then'](handleEntityNotFound(_0x424c96,null));}})['then'](function(_0x5a40e8){if(_0x5a40e8){var _0x23849e=_0x5a40e8[_0xbb10('0xee')]!==null;var _0x3e1a86=path[_0xbb10('0xef')](config['root'],_0xbb10('0xf0'));if(_0x23849e){_0x3e1a86=path[_0xbb10('0xef')](_0x3e1a86,_0xbb10('0xf1'));}var _0x577d27=path['join'](_0x3e1a86,_0x5a40e8[_0xbb10('0xf2')]);return _0x424c96['download'](_0x577d27);}})[_0xbb10('0xc4')](handleError(_0x424c96,null));};exports[_0xbb10('0xf3')]=function(_0xb9bc5a,_0x42276f){var _0x425505=null;var _0xcb61bb=null;var _0x1fe250=null;var _0x57933f=null;if(_0xb9bc5a[_0xbb10('0x3a')]['id']){delete _0xb9bc5a[_0xbb10('0x3a')]['id'];}if(_0xb9bc5a['body'][_0xbb10('0xf4')]){_0x57933f=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0xbb10('0xf6')]()));_0xb9bc5a[_0xbb10('0x3a')]['pathTranscript']=_0x57933f;}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0xb9bc5a[_0xbb10('0xc6')]['id']},'include':[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'include':[{'model':db[_0xbb10('0x82')],'as':_0xbb10('0x82')}]}]})['then'](handleEntityNotFound(_0x42276f,null))[_0xbb10('0x22')](saveUpdates(_0xb9bc5a['body'],null))['then'](function(_0x4aa0d7){if(_0x4aa0d7){_0x425505=_0x4aa0d7;return db[_0xbb10('0xcf')][_0xbb10('0x7b')]({'where':{'id':_0x425505['ChatWebsiteId']}});}})[_0xbb10('0x22')](function(_0x49f324){if(_0x49f324){_0x1fe250=_0x49f324;return db[_0xbb10('0xdf')][_0xbb10('0x7b')]({'where':{'id':_0x425505[_0xbb10('0x7c')]}});}})['then'](function(_0x4d10ea){if(_0x4d10ea){_0xcb61bb=_0x4d10ea;if(_0x57933f){var _0x447c0d=null;for(var _0x502e73=0x1;_0x502e73<_0x425505[_0xbb10('0xf7')][_0xbb10('0x51')];++_0x502e73){_0x447c0d=_0x425505['Messages'][_0x502e73];var _0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250['agentAlias'],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');var _0x22f153=_0xb9bc5a['body'][_0xbb10('0xfb')]||util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0xbb10('0xfc'),_0x447c0d[_0xbb10('0x7c')]);switch(_0x1fe250[_0xbb10('0xfd')]){case _0xbb10('0xfe'):_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');break;case'agent_alias':_0x50cd00=_0x447c0d['UserId']?_0x447c0d[_0xbb10('0x82')]['alias']||_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;case'agent_fullname':_0x50cd00=_0x447c0d[_0xbb10('0x83')]?_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;default:_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util['format'](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');}var _0x150d4c=util[_0xbb10('0xf8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x447c0d[_0xbb10('0x89')])[_0xbb10('0xf8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x447c0d[_0xbb10('0x100')]==='in'?_0x22f153:_0x50cd00,_0x447c0d[_0xbb10('0x3a')]);if(!_0x447c0d[_0xbb10('0x101')]){fs[_0xbb10('0x102')](_0x57933f,_0x150d4c);}}return db[_0xbb10('0x103')][_0xbb10('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0x104')],'as':_0xbb10('0x105'),'raw':!![]}]});}}})[_0xbb10('0x22')](function(_0x33d1b7){if(_0x33d1b7&&_0x33d1b7[_0xbb10('0x105')]&&_0xb9bc5a[_0xbb10('0x3a')]){var _0x1db646={'tls':{'rejectUnauthorized':![]}};if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')]){_0x1db646['service']=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')];}else{_0x1db646['host']=_0x33d1b7['Smtp'][_0xbb10('0x107')];_0x1db646[_0xbb10('0x108')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x108')];_0x1db646[_0xbb10('0x109')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x109')];}if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x10a')]){_0x1db646['auth']={'user':_0x33d1b7['Smtp']['user'],'pass':_0x33d1b7['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xbb10('0x10b'),{'account':_0x1db646,'message':{'from':util[_0xbb10('0xf8')](_0xbb10('0x10c'),_0x33d1b7[_0xbb10('0x38')],_0x33d1b7['email']||_0x33d1b7[_0xbb10('0x105')][_0xbb10('0xa5')]),'to':_0xb9bc5a[_0xbb10('0x3a')][_0xbb10('0xf4')],'subject':'Mail\x20Transcript','text':util['format'](_0xbb10('0x10d'),_0xb9bc5a[_0xbb10('0x3a')]['mailTranscript']),'attachments':[{'path':_0x57933f}]}})['then'](function(){return _0x425505;})[_0xbb10('0xc4')](function(_0xf1371a){console[_0xbb10('0x28')](_0xf1371a);});}else{return _0x425505;}})[_0xbb10('0x22')](respondWithStatusCode(_0x42276f,0xc8))[_0xbb10('0xc4')](handleError(_0x42276f,null));};exports['addMessage']=function(_0x4744f4,_0x5382e9,_0x4c97b9){return db[_0xbb10('0xdc')][_0xbb10('0x7b')]({'where':{'id':_0x4744f4[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5382e9,null))[_0xbb10('0x22')](function(_0x21c0fd){if(_0x21c0fd){return _0x21c0fd['addMessage'](_0x4744f4[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x4744f4[_0xbb10('0x3a')],[_0xbb10('0x10e'),'id'])||{});}})[_0xbb10('0x22')](respondWithResult(_0x5382e9,null))[_0xbb10('0xc4')](handleError(_0x5382e9,null));};exports[_0xbb10('0x110')]=function(_0x233d5e,_0x16f3ce,_0xbae19c){var _0x26f4b0={'raw':![],'where':{}};var _0x1dbf7b={};var _0x117e95={'count':0x0,'rows':[]};return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x233d5e[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x16f3ce,null))[_0xbb10('0x22')](function(_0x43a203){if(_0x43a203){_0x1dbf7b[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db['ChatMessage'][_0xbb10('0x47')]);_0x1dbf7b['query']=_[_0xbb10('0xc7')](_0x233d5e[_0xbb10('0x4c')]);_0x1dbf7b[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1dbf7b[_0xbb10('0x4b')],_0x1dbf7b['query']);_0x26f4b0['attributes']=_['intersection'](_0x1dbf7b[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x233d5e['query'][_0xbb10('0x50')]));_0x26f4b0[_0xbb10('0x4e')]=_0x26f4b0[_0xbb10('0x4e')]['length']?_0x26f4b0[_0xbb10('0x4e')]:_0x1dbf7b[_0xbb10('0x4b')];if(!_0x233d5e[_0xbb10('0x4c')]['hasOwnProperty'](_0xbb10('0x53'))){_0x26f4b0['limit']=qs[_0xbb10('0x54')](_0x233d5e['query']['limit']);_0x26f4b0['offset']=qs['offset'](_0x233d5e['query']['offset']);}_0x26f4b0[_0xbb10('0x9f')]=qs[_0xbb10('0x55')](_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x26f4b0['where']=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x233d5e[_0xbb10('0x4c')],_0x1dbf7b[_0xbb10('0x4d')]));_0x26f4b0[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x43a203['id'];if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0['where'],{'$or':_[_0xbb10('0x3f')](_0x26f4b0[_0xbb10('0x4e')],function(_0x288ccc){var _0x5c5ecc={};_0x5c5ecc[_0x288ccc]={'$like':'%'+_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]+'%'};return _0x5c5ecc;})});}if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')]){var _0x5b2292=_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')][_0xbb10('0x111')](',');var _0x22ec50={};_0x22ec50[_0x5b2292[0x0]]={'$gte':moment(_0x5b2292[0x1])[_0xbb10('0xf8')](_0xbb10('0x112'))};_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0[_0xbb10('0x56')],_0x22ec50);}_0x26f4b0=_[_0xbb10('0xac')]({},_0x26f4b0,_0x233d5e[_0xbb10('0xca')]);return db['ChatMessage'][_0xbb10('0x31')]({'where':_0x26f4b0[_0xbb10('0x56')]})['then'](function(_0x5eb1fb){_0x117e95[_0xbb10('0x31')]=_0x5eb1fb;if(_0x233d5e[_0xbb10('0x4c')]['includeAll']){_0x26f4b0[_0xbb10('0xc9')]=[{'all':!![]}];}return db[_0xbb10('0xdc')]['findAll'](_0x26f4b0);})[_0xbb10('0x22')](function(_0x42441e){_0x117e95[_0xbb10('0xc3')]=_0x42441e;return _0x117e95;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x16f3ce,_0x26f4b0))[_0xbb10('0xc4')](handleError(_0x16f3ce,null));};exports['getMyMessages']=function(_0x4fc260,_0x5a502c,_0xaeaa51){var _0x4db9ad={'where':{}},_0x43deea={},_0x53e73e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x4fc260[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5a502c,null))[_0xbb10('0x22')](function(_0x2527f4){if(_0x2527f4){_0x43deea[_0xbb10('0x4b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x43deea[_0xbb10('0x4c')]=_[_0xbb10('0xc7')](_0x4fc260[_0xbb10('0x4c')]);_0x43deea[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],_0x43deea[_0xbb10('0x4c')]);_0x4db9ad['attributes']=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4fc260[_0xbb10('0x4c')]['fields']));_0x4db9ad[_0xbb10('0x4e')]=_0x4db9ad['attributes']['length']?_0x4db9ad[_0xbb10('0x4e')]:_0x43deea[_0xbb10('0x4b')];if(!_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x52')](_0xbb10('0x53'))){_0x4db9ad[_0xbb10('0x54')]=qs['limit'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x4db9ad[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x4db9ad[_0xbb10('0x9f')]=qs['sort'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x4db9ad[_0xbb10('0x56')]=qs['filters'](_['pick'](_0x4fc260[_0xbb10('0x4c')],_0x43deea[_0xbb10('0x4d')]));_0x4db9ad[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x2527f4['id'];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x4db9ad[_0xbb10('0x56')]=_['merge'](_0x4db9ad[_0xbb10('0x56')],{'$or':_[_0xbb10('0x3f')](_0x4db9ad[_0xbb10('0x4e')],function(_0x55ba78){var _0x5e195a={};_0x5e195a[_0x55ba78]={'$like':'%'+_0x4fc260['query']['filter']+'%'};return _0x5e195a;})});}_0x4db9ad[_0xbb10('0x56')][_0xbb10('0x101')]=![];if(_0x4fc260[_0xbb10('0x4c')]['id']){_0x4db9ad[_0xbb10('0x56')]['id']={'$gt':_0x4fc260['query']['id']};}_0x4db9ad=_[_0xbb10('0xac')]({},_0x4db9ad,_0x4fc260['options']);return db[_0xbb10('0xdc')][_0xbb10('0x31')]({'where':_0x4db9ad[_0xbb10('0x56')]})[_0xbb10('0x22')](function(_0xa16287){_0x53e73e[_0xbb10('0x31')]=_0xa16287;_0x4db9ad[_0xbb10('0xc9')]=[];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x113')]){_0x4db9ad[_0xbb10('0xc9')][_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40'),_0xbb10('0x114')]});}if(_0x4fc260[_0xbb10('0x4c')]['includeAll']){_0x4db9ad[_0xbb10('0xc9')]=[{'all':!![]}];}return db['ChatMessage'][_0xbb10('0x115')](_0x4db9ad);})[_0xbb10('0x22')](function(_0x280119){_0x53e73e[_0xbb10('0xc3')]=_0x280119;return _0x53e73e;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x5a502c,_0x4db9ad))['catch'](handleError(_0x5a502c,null));};exports['addTags']=function(_0x842d94,_0x4cf5cc,_0x553bb8){return db[_0xbb10('0x46')]['find']({'where':{'id':_0x842d94[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4cf5cc,null))[_0xbb10('0x22')](function(_0x4469c4){if(_0x4469c4){return _0x4469c4[_0xbb10('0x116')](_0x842d94[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x842d94['body'],[_0xbb10('0x10e'),'id'])||{})['spread'](function(){return db[_0xbb10('0x7f')]['findAll']({'attributes':['id',_0xbb10('0x38'),_0xbb10('0x5a')],'where':{'id':_0x842d94['body'][_0xbb10('0x10e')]}});})[_0xbb10('0x22')](function(_0x1bb072){socket['emit'](_0xbb10('0x117'),{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]});return{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]};});}})['then'](respondWithResult(_0x4cf5cc,null))[_0xbb10('0xc4')](handleError(_0x4cf5cc,null));};exports[_0xbb10('0x118')]=function(_0x46df90,_0x4b781e,_0x3e6756){return db['ChatInteraction'][_0xbb10('0x7b')]({'where':{'id':_0x46df90[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4b781e,null))[_0xbb10('0x22')](function(_0x583a3e){if(_0x583a3e){return _0x583a3e[_0xbb10('0x118')](_0x46df90[_0xbb10('0x4c')][_0xbb10('0x10e')]);}})[_0xbb10('0x22')](respondWithStatusCode(_0x4b781e,null))[_0xbb10('0xc4')](handleError(_0x4b781e,null));};exports['download']=function(_0x4b10ed,_0x40b5da){var _0x4739a6=moment()[_0xbb10('0x119')]()['toString']();var _0x3d5870=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x11b'),_0xbb10('0x11c'));var _0x81d970=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server',_0xbb10('0x11b'),_0xbb10('0x11d'));var _0x4102af=path[_0xbb10('0xef')](_0x3d5870,_0x4739a6);var _0x4d49a7=util[_0xbb10('0xf8')](_0xbb10('0x11e'),_0x4b10ed[_0xbb10('0xc6')]['id'],_0x4739a6);var _0x59fef2=path['join'](_0x3d5870,_0x4d49a7);var _0x3b45c4=[];_0x3b45c4['push']({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40')],'raw':!![]});_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xdf')],'as':_0xbb10('0x11f'),'attributes':['id',_0xbb10('0x120'),_0xbb10('0x121')],'raw':!![]});if(_0x4b10ed[_0xbb10('0x4c')]['attachments']){_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xec')],'as':_0xbb10('0xec'),'raw':!![]});}var _0x2807d2=[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'attributes':['id','body',_0xbb10('0x89'),_0xbb10('0x100'),_0xbb10('0x101'),_0xbb10('0x90')],'include':_0x3b45c4}];_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0xcf')],'as':_0xbb10('0x122'),'attributes':['id','name']});_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':_0xbb10('0x123'),'attributes':['id','fullname']});return db[_0xbb10('0x46')]['find']({'where':{'id':_0x4b10ed[_0xbb10('0xc6')]['id']},'include':_0x2807d2})[_0xbb10('0x22')](handleEntityNotFound(_0x40b5da,null))[_0xbb10('0x22')](function(_0x58a447){if(_0x58a447){var _0x50fa4e=_0x58a447[_0xbb10('0x124')]({'plain':!![]});fs[_0xbb10('0x125')](_0x4102af);var _0xbb410e={'channel':_0xbb10('0x126'),'account':_0x50fa4e[_0xbb10('0x122')][_0xbb10('0x38')],'agent':_0x50fa4e[_0xbb10('0x123')]?_0x50fa4e[_0xbb10('0x123')][_0xbb10('0x40')]:_0xbb10('0x127'),'createdAt':moment(_0x50fa4e[_0xbb10('0x89')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbb10('0xaa')](),'closedAt':_0x50fa4e[_0xbb10('0xea')]?moment(_0x50fa4e['closedAt'])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')]():'','disposition':_0x50fa4e[_0xbb10('0x128')],'chatInfo':{'browser':_0x50fa4e['browserName'],'os':_0x50fa4e[_0xbb10('0x129')],'referer':_0x50fa4e[_0xbb10('0x12a')],'customerIp':_0x50fa4e['customerIp'],'customerPort':_0x50fa4e[_0xbb10('0x12b')]?_0x50fa4e[_0xbb10('0x12b')]:'N.A.'},'messages':_(_0x50fa4e['Messages'])[_0xbb10('0x12c')]()[_0xbb10('0x94')]({'secret':![]})[_0xbb10('0x3f')](function(_0x5cab64){if(_0x5cab64['Attachment']){var _0x58ee41=path[_0xbb10('0xef')](_0x81d970,_0x5cab64['Attachment'][_0xbb10('0xf2')]);if(fs[_0xbb10('0x12d')](_0x58ee41)){fs['createReadStream'](_0x58ee41)[_0xbb10('0x12e')](fs[_0xbb10('0x12f')](path[_0xbb10('0xef')](_0x4102af,_0x5cab64[_0xbb10('0xec')]['basename'])));}}return{'date':moment(_0x5cab64[_0xbb10('0x89')])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')](),'sender':_0x5cab64[_0xbb10('0x100')]===_0xbb10('0xdb')?_0x5cab64[_0xbb10('0x82')]?_0x5cab64[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa'):_0x5cab64['Contact'][_0xbb10('0x120')]+(_0x5cab64[_0xbb10('0x11f')][_0xbb10('0x121')]?'\x20'+_0x5cab64[_0xbb10('0x11f')]['lastName']:''),'body':_0x5cab64['Attachment']?_0x5cab64[_0xbb10('0xec')][_0xbb10('0xf2')]:_0x5cab64[_0xbb10('0x3a')],'direction':_0x5cab64[_0xbb10('0x100')]==='out'?'A':'C','secret':_0x5cab64[_0xbb10('0x101')],'read':_0x5cab64[_0xbb10('0x90')],'attachment':_0x5cab64['Attachment']};})[_0xbb10('0x73')]()};return ejs['renderFile'](path['join'](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x130'),_0xbb10('0x131')),{'interaction':_0xbb410e})[_0xbb10('0x22')](function(_0x4aa76a){var _0x38403e=path[_0xbb10('0xef')](_0x4102af,_0xbb10('0x132')+_0x50fa4e['id']+'-'+_0x4739a6+_0xbb10('0x133'));var _0x1b7274={'path':_0x38403e,'channel':_0xbb10('0x126'),'interactionId':_0x50fa4e['id']};return pdf[_0xbb10('0x134')](_0x4aa76a,_0x1b7274);})[_0xbb10('0x22')](function(){return new BPromise(function(_0x34f4d6,_0x254b6e){zipdir(_0x4102af,{'saveTo':_0x59fef2},function(_0x368adb,_0xef4ccf){if(_0x368adb)return _0x254b6e(_0x368adb);return _0x34f4d6(_0xef4ccf);});})[_0xbb10('0x22')](function(){return new BPromise(function(_0x9fcc26,_0x111fd4){rimraf(_0x4102af,function(_0x256ce9){if(_0x256ce9)_0x111fd4(_0x256ce9);return _0x9fcc26();});});})[_0xbb10('0x22')](function(){return _0x40b5da[_0xbb10('0x135')](_0x59fef2,_0x4d49a7,function(_0x27e0c5){if(_0x27e0c5){console[_0xbb10('0x136')](_0xbb10('0x137'),_0x27e0c5);}else{fs[_0xbb10('0x138')](_0x59fef2);}});});});}else{return _0x40b5da[_0xbb10('0x2c')](0xc8);}})[_0xbb10('0xc4')](handleError(_0x40b5da,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 99c4519..74ab1bb 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 _0x3bfb=['ChatInteraction','ChatMessage','setMaxListeners','save','update','then','Users','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x133360,_0x6c2375){var _0x25c5aa=function(_0x496fbe){while(--_0x496fbe){_0x133360['push'](_0x133360['shift']());}};_0x25c5aa(++_0x6c2375);}(_0x3bfb,0xb2));var _0xb3bf=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x3bfb[_0x35387d];return _0x3aba56;};'use strict';var EventEmitter=require(_0xb3bf('0x0'));var ChatInteraction=require(_0xb3bf('0x1'))['db'][_0xb3bf('0x2')];var ChatMessage=require(_0xb3bf('0x1'))['db'][_0xb3bf('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb3bf('0x4')](0x0);var events={'afterCreate':_0xb3bf('0x5'),'afterUpdate':_0xb3bf('0x6'),'afterDestroy':'remove'};function emitEvent(_0xf6766b){return function(_0x250d61,_0xefbe57,_0xc91592){_0x250d61['getUsers']({'attributes':['id'],'raw':!![]})[_0xb3bf('0x7')](function(_0x181838){_0x250d61['setDataValue'](_0xb3bf('0x8'),_0x181838['map'](function(_0x11a152){return{'id':_0x11a152['id']};}));return ChatMessage[_0xb3bf('0x9')]({'where':{'ChatInteractionId':_0x250d61['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4bc72b){_0x250d61[_0xb3bf('0xa')](_0xb3bf('0xb'),_0x4bc72b['length']);ChatInteractionEvents[_0xb3bf('0xc')](_0xf6766b+':'+_0x250d61['id'],_0x250d61);ChatInteractionEvents[_0xb3bf('0xc')](_0xf6766b,_0x250d61);_0xc91592(null);})[_0xb3bf('0xd')](_0xc91592(null));};}for(var e in events){if(events[_0xb3bf('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xd959=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','unreadMessages'];(function(_0x127728,_0x11c9c5){var _0x3b6cfe=function(_0x627b1e){while(--_0x627b1e){_0x127728['push'](_0x127728['shift']());}};_0x3b6cfe(++_0x11c9c5);}(_0xd959,0xcb));var _0x9d95=function(_0x3f4877,_0x39fecb){_0x3f4877=_0x3f4877-0x0;var _0x4a6f72=_0xd959[_0x3f4877];return _0x4a6f72;};'use strict';var EventEmitter=require(_0x9d95('0x0'));var ChatInteraction=require(_0x9d95('0x1'))['db'][_0x9d95('0x2')];var ChatMessage=require(_0x9d95('0x1'))['db'][_0x9d95('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9d95('0x4')](0x0);var events={'afterCreate':_0x9d95('0x5'),'afterUpdate':'update','afterDestroy':_0x9d95('0x6')};function emitEvent(_0x539ddf){return function(_0x32d2eb,_0x270d1c,_0x30f496){_0x32d2eb[_0x9d95('0x7')]({'attributes':['id'],'raw':!![]})[_0x9d95('0x8')](function(_0x574c28){_0x32d2eb['setDataValue'](_0x9d95('0x9'),_0x574c28[_0x9d95('0xa')](function(_0x29c642){return{'id':_0x29c642['id']};}));return ChatMessage[_0x9d95('0xb')]({'where':{'ChatInteractionId':_0x32d2eb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9d95('0x8')](function(_0x43c006){_0x32d2eb['setDataValue'](_0x9d95('0xc'),_0x43c006['length']);ChatInteractionEvents[_0x9d95('0xd')](_0x539ddf+':'+_0x32d2eb['id'],_0x32d2eb);ChatInteractionEvents[_0x9d95('0xd')](_0x539ddf,_0x32d2eb);_0x30f496(null);})[_0x9d95('0xe')](_0x30f496(null));};}for(var e in events){if(events[_0x9d95('0xf')](e)){var event=events[e];ChatInteraction[_0x9d95('0x10')](e,emitEvent(event));}}module[_0x9d95('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9a20751..3eee336 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 _0x2dd0=['path','rimraf','../../config/environment','define','changed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0xeb8374,_0x11caff){var _0x27d45c=function(_0xf71158){while(--_0xf71158){_0xeb8374['push'](_0xeb8374['shift']());}};_0x27d45c(++_0x11caff);}(_0x2dd0,0x1c2));var _0x02dd=function(_0x5a064d,_0x1fde09){_0x5a064d=_0x5a064d-0x0;var _0x361179=_0x2dd0[_0x5a064d];return _0x361179;};'use strict';var _=require(_0x02dd('0x0'));var util=require(_0x02dd('0x1'));var logger=require(_0x02dd('0x2'))('api');var moment=require(_0x02dd('0x3'));var BPromise=require(_0x02dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02dd('0x5'));var rimraf=require(_0x02dd('0x6'));var config=require(_0x02dd('0x7'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x141e5c,_0x2988f5){return _0x141e5c[_0x02dd('0x8')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x259a1a,_0x59d8f5,_0x34db46){if(_0x259a1a[_0x02dd('0x9')]('closed')){_0x259a1a['closedAt']=moment()[_0x02dd('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x34db46(null,_0x259a1a);}},'charset':_0x02dd('0xb'),'collate':_0x02dd('0xc')});}; \ No newline at end of file +var _0xb4d9=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1bc59a,_0x22d2c3){var _0x3ab7a4=function(_0x1282a1){while(--_0x1282a1){_0x1bc59a['push'](_0x1bc59a['shift']());}};_0x3ab7a4(++_0x22d2c3);}(_0xb4d9,0x1c9));var _0x9b4d=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb4d9[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x9b4d('0x0'));var util=require('util');var logger=require(_0x9b4d('0x1'))(_0x9b4d('0x2'));var moment=require(_0x9b4d('0x3'));var BPromise=require(_0x9b4d('0x4'));var rp=require(_0x9b4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b4d('0x6'));var config=require(_0x9b4d('0x7'));var attributes=require(_0x9b4d('0x8'));module[_0x9b4d('0x9')]=function(_0x3167d1,_0x22e1c0){return _0x3167d1[_0x9b4d('0xa')](_0x9b4d('0xb'),attributes,{'tableName':_0x9b4d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5477a8,_0x44fcd6,_0x298cd5){if(_0x5477a8[_0x9b4d('0xd')](_0x9b4d('0xe'))){_0x5477a8[_0x9b4d('0xf')]=moment()[_0x9b4d('0x10')](_0x9b4d('0x11'));}_0x298cd5(null,_0x5477a8);}},'charset':'utf8mb4','collate':_0x9b4d('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6a73591..ebbe3b5 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 _0x75ec=['request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','then','debug','AddTagsToChatInteraction','find','where','ids','spread','AddTags','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','request','info'];(function(_0x3ff863,_0x56d99f){var _0x1304a2=function(_0x2ce6bf){while(--_0x2ce6bf){_0x3ff863['push'](_0x3ff863['shift']());}};_0x1304a2(++_0x56d99f);}(_0x75ec,0xb3));var _0xc75e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x75ec[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc75e('0x0'));var util=require(_0xc75e('0x1'));var moment=require('moment');var BPromise=require(_0xc75e('0x2'));var rs=require(_0xc75e('0x3'));var fs=require('fs');var Redis=require(_0xc75e('0x4'));var db=require(_0xc75e('0x5'))['db'];var utils=require(_0xc75e('0x6'));var logger=require(_0xc75e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc75e('0x8'));var client=jayson['client'][_0xc75e('0x9')]({'port':0x232a});config['redis']=_[_0xc75e('0xa')](config[_0xc75e('0xb')],{'host':_0xc75e('0xc'),'port':0x18eb});var socket=require(_0xc75e('0xd'))(new Redis(config[_0xc75e('0xb')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4ed799,_0x26c5fc,_0x154fdc){return new BPromise(function(_0x1303f2,_0x516f9d){return client[_0xc75e('0xe')](_0x4ed799,_0x154fdc)['then'](function(_0x37a974){logger[_0xc75e('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x26c5fc,_0xc75e('0x10'));logger['debug'](_0xc75e('0x11'),_0x26c5fc,_0xc75e('0x10'),JSON[_0xc75e('0x12')](_0x37a974));if(_0x37a974['error']){if(_0x37a974['error']['code']===0x1f4){logger[_0xc75e('0x13')](_0xc75e('0x14'),_0x26c5fc,_0x37a974[_0xc75e('0x13')][_0xc75e('0x15')]);return _0x516f9d(_0x37a974[_0xc75e('0x13')][_0xc75e('0x15')]);}logger[_0xc75e('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x26c5fc,_0x37a974['error'][_0xc75e('0x15')]);return _0x1303f2(_0x37a974[_0xc75e('0x13')][_0xc75e('0x15')]);}else{logger[_0xc75e('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x26c5fc,_0xc75e('0x10'));_0x1303f2(_0x37a974[_0xc75e('0x16')][_0xc75e('0x15')]);}})['catch'](function(_0x189f60){logger[_0xc75e('0x13')](_0xc75e('0x14'),_0x26c5fc,_0x189f60);_0x516f9d(_0x189f60);});});}exports[_0xc75e('0x17')]=function(_0x49493b){var _0x513028=this;return new Promise(function(_0x485f41,_0x39ba6f){return db[_0xc75e('0x18')][_0xc75e('0x19')](_0x49493b[_0xc75e('0x1a')],{'raw':_0x49493b['options']?_0x49493b[_0xc75e('0x1b')][_0xc75e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49493b[_0xc75e('0x1b')]?_0x49493b['options']['where']||null:null,'attributes':_0x49493b[_0xc75e('0x1b')]?_0x49493b['options'][_0xc75e('0x1d')]||null:null,'limit':_0x49493b[_0xc75e('0x1b')]?_0x49493b[_0xc75e('0x1b')]['limit']||null:null})[_0xc75e('0x1e')](function(_0x46be24){logger[_0xc75e('0xf')](_0xc75e('0x17'),_0x49493b);logger[_0xc75e('0x1f')](_0xc75e('0x17'),_0x49493b,JSON[_0xc75e('0x12')](_0x46be24));_0x485f41(_0x46be24);})['catch'](function(_0x2f418d){logger[_0xc75e('0x13')](_0xc75e('0x17'),_0x2f418d['message'],_0x49493b);_0x39ba6f(_0x513028[_0xc75e('0x13')](0x1f4,_0x2f418d[_0xc75e('0x15')]));});});};exports[_0xc75e('0x20')]=function(_0x203db7){return new Promise(function(_0x480724,_0x476b76){return db['ChatInteraction'][_0xc75e('0x21')]({'where':_0x203db7[_0xc75e('0x1b')]?_0x203db7[_0xc75e('0x1b')][_0xc75e('0x22')]||null:null})['then'](function(_0x119039){if(_0x119039){return _0x119039['addTags'](_0x203db7[_0xc75e('0x1a')][_0xc75e('0x23')],_['omit'](_0x203db7[_0xc75e('0x1a')],['ids','id'])||{});}})[_0xc75e('0x24')](function(_0x5387ba){logger['info'](_0xc75e('0x25'),_0x203db7);logger[_0xc75e('0x1f')](_0xc75e('0x25'),_0x203db7,JSON[_0xc75e('0x12')](_0x5387ba));_0x480724(_0x5387ba);})[_0xc75e('0x26')](function(_0x5a48e6){logger[_0xc75e('0x13')]('AddTags',_0x5a48e6['message'],_0x203db7);_0x476b76(_this[_0xc75e('0x13')](0x1f4,_0x5a48e6[_0xc75e('0x15')]));});});}; \ No newline at end of file +var _0x3a1a=['limit','AddTagsToChatInteraction','ChatInteraction','addTags','omit','ids','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','UpdateChatInteraction','update','body','options','raw','where'];(function(_0x6a7e6,_0x38d3b6){var _0x55bc3d=function(_0x5a8c36){while(--_0x5a8c36){_0x6a7e6['push'](_0x6a7e6['shift']());}};_0x55bc3d(++_0x38d3b6);}(_0x3a1a,0x119));var _0xa3a1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3a1a[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xa3a1('0x0'));var util=require(_0xa3a1('0x1'));var moment=require(_0xa3a1('0x2'));var BPromise=require(_0xa3a1('0x3'));var rs=require(_0xa3a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3a1('0x6'))(_0xa3a1('0x7'));var config=require('../../config/environment');var jayson=require(_0xa3a1('0x8'));var client=jayson[_0xa3a1('0x9')][_0xa3a1('0xa')]({'port':0x232a});config[_0xa3a1('0xb')]=_[_0xa3a1('0xc')](config['redis'],{'host':_0xa3a1('0xd'),'port':0x18eb});var socket=require(_0xa3a1('0xe'))(new Redis(config[_0xa3a1('0xb')]));require(_0xa3a1('0xf'))['register'](socket);function respondWithRpcPromise(_0x238a04,_0x15b816,_0x171a43){return new BPromise(function(_0x26eebd,_0x42e618){return client[_0xa3a1('0x10')](_0x238a04,_0x171a43)[_0xa3a1('0x11')](function(_0x510841){logger[_0xa3a1('0x12')](_0xa3a1('0x13'),_0x15b816,_0xa3a1('0x14'));logger[_0xa3a1('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x15b816,_0xa3a1('0x14'),JSON['stringify'](_0x510841));if(_0x510841[_0xa3a1('0x16')]){if(_0x510841[_0xa3a1('0x16')][_0xa3a1('0x17')]===0x1f4){logger[_0xa3a1('0x16')](_0xa3a1('0x13'),_0x15b816,_0x510841[_0xa3a1('0x16')][_0xa3a1('0x18')]);return _0x42e618(_0x510841[_0xa3a1('0x16')]['message']);}logger['error'](_0xa3a1('0x13'),_0x15b816,_0x510841[_0xa3a1('0x16')][_0xa3a1('0x18')]);return _0x26eebd(_0x510841[_0xa3a1('0x16')]['message']);}else{logger[_0xa3a1('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x15b816,'request\x20sent');_0x26eebd(_0x510841['result']['message']);}})['catch'](function(_0x269939){logger[_0xa3a1('0x16')](_0xa3a1('0x13'),_0x15b816,_0x269939);_0x42e618(_0x269939);});});}exports[_0xa3a1('0x19')]=function(_0x18cc25){var _0x32b572=this;return new Promise(function(_0x3af59f,_0xd43121){return db['ChatInteraction'][_0xa3a1('0x1a')](_0x18cc25[_0xa3a1('0x1b')],{'raw':_0x18cc25[_0xa3a1('0x1c')]?_0x18cc25[_0xa3a1('0x1c')][_0xa3a1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18cc25[_0xa3a1('0x1c')]?_0x18cc25[_0xa3a1('0x1c')][_0xa3a1('0x1e')]||null:null,'attributes':_0x18cc25['options']?_0x18cc25[_0xa3a1('0x1c')]['attributes']||null:null,'limit':_0x18cc25[_0xa3a1('0x1c')]?_0x18cc25['options'][_0xa3a1('0x1f')]||null:null})['then'](function(_0x199196){logger['info'](_0xa3a1('0x19'),_0x18cc25);logger[_0xa3a1('0x15')]('UpdateChatInteraction',_0x18cc25,JSON['stringify'](_0x199196));_0x3af59f(_0x199196);})['catch'](function(_0x3aec4a){logger['error'](_0xa3a1('0x19'),_0x3aec4a[_0xa3a1('0x18')],_0x18cc25);_0xd43121(_0x32b572[_0xa3a1('0x16')](0x1f4,_0x3aec4a[_0xa3a1('0x18')]));});});};exports[_0xa3a1('0x20')]=function(_0xe01f73){return new Promise(function(_0x56a78a,_0x5638b4){return db[_0xa3a1('0x21')]['find']({'where':_0xe01f73[_0xa3a1('0x1c')]?_0xe01f73[_0xa3a1('0x1c')]['where']||null:null})[_0xa3a1('0x11')](function(_0x2507ac){if(_0x2507ac){return _0x2507ac[_0xa3a1('0x22')](_0xe01f73[_0xa3a1('0x1b')]['ids'],_[_0xa3a1('0x23')](_0xe01f73['body'],[_0xa3a1('0x24'),'id'])||{});}})['spread'](function(_0x13091d){logger[_0xa3a1('0x12')](_0xa3a1('0x25'),_0xe01f73);logger[_0xa3a1('0x15')](_0xa3a1('0x25'),_0xe01f73,JSON['stringify'](_0x13091d));_0x56a78a(_0x13091d);})[_0xa3a1('0x26')](function(_0x43149e){logger[_0xa3a1('0x16')](_0xa3a1('0x25'),_0x43149e[_0xa3a1('0x18')],_0xe01f73);_0x5638b4(_this[_0xa3a1('0x16')](0x1f4,_0x43149e[_0xa3a1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f667e5f..ebf2af0 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 _0x7dff=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','remove'];(function(_0xb40323,_0x18f424){var _0x3f3ae6=function(_0x57070d){while(--_0x57070d){_0xb40323['push'](_0xb40323['shift']());}};_0x3f3ae6(++_0x18f424);}(_0x7dff,0xde));var _0xf7df=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7dff[_0x49ca18];return _0x145d54;};'use strict';var ChatInteractionEvents=require(_0xf7df('0x0'));var events=['save',_0xf7df('0x1'),_0xf7df('0x2')];function createListener(_0x476669,_0x26ca3a){return function(_0x2e6bd9){_0x26ca3a[_0xf7df('0x3')](_0x476669,_0x2e6bd9);};}function removeListener(_0x598236,_0x46d158){return function(){ChatInteractionEvents[_0xf7df('0x4')](_0x598236,_0x46d158);};}exports[_0xf7df('0x5')]=function(_0x45fd6d){for(var _0x56bf9e=0x0,_0xf665b0=events[_0xf7df('0x6')];_0x56bf9e<_0xf665b0;_0x56bf9e++){var _0x19766b=events[_0x56bf9e];var _0x289f04=createListener(_0xf7df('0x7')+_0x19766b,_0x45fd6d);ChatInteractionEvents['on'](_0x19766b,_0x289f04);}}; \ No newline at end of file +var _0x2e2e=['removeListener','register','./chatInteraction.events','save','remove'];(function(_0x3a3f67,_0xd2c821){var _0x1d9795=function(_0x3a4569){while(--_0x3a4569){_0x3a3f67['push'](_0x3a3f67['shift']());}};_0x1d9795(++_0xd2c821);}(_0x2e2e,0x138));var _0xe2e2=function(_0x14f037,_0x3cb54d){_0x14f037=_0x14f037-0x0;var _0xf320b6=_0x2e2e[_0x14f037];return _0xf320b6;};'use strict';var ChatInteractionEvents=require(_0xe2e2('0x0'));var events=[_0xe2e2('0x1'),_0xe2e2('0x2'),'update'];function createListener(_0x5c23bd,_0xb4a24){return function(_0x3c4007){_0xb4a24['emit'](_0x5c23bd,_0x3c4007);};}function removeListener(_0x46f309,_0x375ded){return function(){ChatInteractionEvents[_0xe2e2('0x3')](_0x46f309,_0x375ded);};}exports[_0xe2e2('0x4')]=function(_0x11271f){for(var _0x4f2a56=0x0,_0x13e3be=events['length'];_0x4f2a56<_0x13e3be;_0x4f2a56++){var _0x169667=events[_0x4f2a56];var _0x1e6447=createListener('chatInteraction:'+_0x169667,_0x11271f);ChatInteractionEvents['on'](_0x169667,_0x1e6447);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2032da6..7c8013b 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 _0xf66a=['removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','download','create','post','/:id/vidaoo','createVidaooSession','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','chatinteraction:destroy','destroy','delete'];(function(_0x116059,_0x5790e1){var _0x4e0a65=function(_0x1b18f8){while(--_0x1b18f8){_0x116059['push'](_0x116059['shift']());}};_0x4e0a65(++_0x5790e1);}(_0xf66a,0x115));var _0xaf66=function(_0x3e0b32,_0x1d1a12){_0x3e0b32=_0x3e0b32-0x0;var _0x1ad846=_0xf66a[_0x3e0b32];return _0x1ad846;};'use strict';var multer=require(_0xaf66('0x0'));var util=require(_0xaf66('0x1'));var path=require(_0xaf66('0x2'));var timeout=require(_0xaf66('0x3'));var express=require(_0xaf66('0x4'));var router=express[_0xaf66('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaf66('0x6'));var config=require(_0xaf66('0x7'));var controller=require('./chatInteraction.controller');router[_0xaf66('0x8')]('/',auth['isAuthenticated'](),controller[_0xaf66('0x9')]);router[_0xaf66('0x8')](_0xaf66('0xa'),auth[_0xaf66('0xb')](),controller[_0xaf66('0xc')]);router[_0xaf66('0x8')](_0xaf66('0xd'),auth[_0xaf66('0xe')](),controller[_0xaf66('0xf')]);router['get'](_0xaf66('0x10'),auth[_0xaf66('0xe')](),controller[_0xaf66('0x11')]);router['get'](_0xaf66('0x12'),auth[_0xaf66('0xb')](),controller[_0xaf66('0x13')]);router['get']('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0xaf66('0x14')]);router[_0xaf66('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xaf66('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaf66('0x16')]);router[_0xaf66('0x17')](_0xaf66('0x18'),auth['isAuthenticated'](),controller[_0xaf66('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f61aa,_0x1e4f7b,_0x42e21e){_0x42e21e(null,path[_0xaf66('0x1a')](config['root'],_0xaf66('0x1b')));},'filename':function(_0x1fc9a3,_0x47bac5,_0x22a1c9){_0x22a1c9(null,util[_0xaf66('0x1c')](_0xaf66('0x1d'),Date[_0xaf66('0x1e')](),_0x47bac5[_0xaf66('0x1f')][_0xaf66('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaf66('0x17')](_0xaf66('0x21'),upload['single'](_0xaf66('0x22')),controller[_0xaf66('0x23')]);router[_0xaf66('0x17')](_0xaf66('0x12'),auth['isChatInteractionAuthorized'](),controller[_0xaf66('0x24')]);router[_0xaf66('0x17')](_0xaf66('0x25'),auth[_0xaf66('0xb')](),interaction['tracked'](_0xaf66('0x26'),_0xaf66('0x27')),controller[_0xaf66('0x28')]);router[_0xaf66('0x29')]('/:id',auth[_0xaf66('0xb')](),interaction[_0xaf66('0x2a')]('chat',_0xaf66('0x2b')),controller[_0xaf66('0x2c')]);router[_0xaf66('0x29')](_0xaf66('0x2d'),controller[_0xaf66('0x2e')]);router[_0xaf66('0x29')](_0xaf66('0x2f'),auth[_0xaf66('0xe')](),controller[_0xaf66('0x30')]);router[_0xaf66('0x29')]('/:id/close',controller[_0xaf66('0x31')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xaf66('0x2a')](_0xaf66('0x26'),_0xaf66('0x32')),controller[_0xaf66('0x33')]);router[_0xaf66('0x34')](_0xaf66('0x25'),auth[_0xaf66('0xb')](),controller[_0xaf66('0x35')]);module[_0xaf66('0x36')]=router; \ No newline at end of file +var _0x1fb2=['isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','/:id','chatinteraction:destroy','destroy','removeTags','exports','Router','fs-extra','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1fb2,0x1ba));var _0x21fb=function(_0x22563d,_0x51c029){_0x22563d=_0x22563d-0x0;var _0x19f637=_0x1fb2[_0x22563d];return _0x19f637;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21fb('0x0')]();var fs_extra=require(_0x21fb('0x1'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21fb('0x2'));router[_0x21fb('0x3')]('/',auth[_0x21fb('0x4')](),controller[_0x21fb('0x5')]);router[_0x21fb('0x3')](_0x21fb('0x6'),auth['isAuthenticated'](),controller[_0x21fb('0x7')]);router['get']('/:id',auth[_0x21fb('0x8')](),controller['show']);router[_0x21fb('0x3')](_0x21fb('0x9'),auth[_0x21fb('0x8')](),controller[_0x21fb('0xa')]);router[_0x21fb('0x3')](_0x21fb('0xb'),auth[_0x21fb('0x4')](),controller[_0x21fb('0xc')]);router[_0x21fb('0x3')](_0x21fb('0xd'),auth[_0x21fb('0x8')](),controller[_0x21fb('0xe')]);router[_0x21fb('0x3')](_0x21fb('0xf'),auth[_0x21fb('0x4')](),controller[_0x21fb('0x10')]);router[_0x21fb('0x11')]('/',auth[_0x21fb('0x4')](),controller['create']);router[_0x21fb('0x11')](_0x21fb('0x12'),auth[_0x21fb('0x4')](),controller[_0x21fb('0x13')]);var upload=multer({'storage':multer[_0x21fb('0x14')]({'destination':function(_0x4e294f,_0x2ca9a9,_0x555a03){_0x555a03(null,path[_0x21fb('0x15')](config[_0x21fb('0x16')],'server/files/attachments/'));},'filename':function(_0x8d758f,_0xaf70,_0x12a69c){_0x12a69c(null,util[_0x21fb('0x17')](_0x21fb('0x18'),Date[_0x21fb('0x19')](),_0xaf70[_0x21fb('0x1a')][_0x21fb('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x21fb('0x11')](_0x21fb('0x1c'),upload[_0x21fb('0x1d')]('file'),controller[_0x21fb('0x1e')]);router[_0x21fb('0x11')](_0x21fb('0xb'),auth[_0x21fb('0x8')](),controller[_0x21fb('0x1f')]);router[_0x21fb('0x11')](_0x21fb('0x20'),auth[_0x21fb('0x4')](),interaction[_0x21fb('0x21')]('chat',_0x21fb('0x22')),controller[_0x21fb('0x23')]);router[_0x21fb('0x24')]('/:id',auth[_0x21fb('0x4')](),interaction[_0x21fb('0x21')](_0x21fb('0x25'),_0x21fb('0x26')),controller[_0x21fb('0x27')]);router[_0x21fb('0x24')](_0x21fb('0x28'),controller[_0x21fb('0x29')]);router[_0x21fb('0x24')](_0x21fb('0x2a'),auth[_0x21fb('0x8')](),controller[_0x21fb('0x2b')]);router[_0x21fb('0x24')](_0x21fb('0x2c'),controller['close']);router['delete'](_0x21fb('0x2d'),auth[_0x21fb('0x4')](),interaction[_0x21fb('0x21')](_0x21fb('0x25'),_0x21fb('0x2e')),controller[_0x21fb('0x2f')]);router['delete'](_0x21fb('0x20'),auth[_0x21fb('0x4')](),controller[_0x21fb('0x30')]);module[_0x21fb('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 880dba0..de98390 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 _0xdb91=['TEXT','BOOLEAN','sequelize','exports'];(function(_0x4bf70d,_0x1cc11c){var _0x2c2ecf=function(_0x29f639){while(--_0x29f639){_0x4bf70d['push'](_0x4bf70d['shift']());}};_0x2c2ecf(++_0x1cc11c);}(_0xdb91,0x1e2));var _0x1db9=function(_0x47bcfa,_0x1ce737){_0x47bcfa=_0x47bcfa-0x0;var _0x2f11f9=_0xdb91[_0x47bcfa];return _0x2f11f9;};'use strict';var Sequelize=require(_0x1db9('0x0'));module[_0x1db9('0x1')]={'body':{'type':Sequelize[_0x1db9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1db9('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xece2=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xece2,0x1e2));var _0x2ece=function(_0x15b443,_0x12828c){_0x15b443=_0x15b443-0x0;var _0x707d35=_0xece2[_0x15b443];return _0x707d35;};'use strict';var Sequelize=require(_0x2ece('0x0'));module[_0x2ece('0x1')]={'body':{'type':Sequelize[_0x2ece('0x2')](_0x2ece('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2ece('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5408807..d6c9cb3 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 _0x3349=['params','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','length','resourceId','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','then','destroy','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','options','create','update','body','find'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3349,0x1e4));var _0x9334=function(_0x2081c1,_0x25f8d2){_0x2081c1=_0x2081c1-0x0;var _0x5a8693=_0x3349[_0x2081c1];return _0x5a8693;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9334('0x0'));var zipdir=require(_0x9334('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9334('0x2'));var moment=require(_0x9334('0x3'));var BPromise=require(_0x9334('0x4'));var Mustache=require(_0x9334('0x5'));var util=require('util');var path=require(_0x9334('0x6'));var sox=require(_0x9334('0x7'));var csv=require('to-csv');var ejs=require(_0x9334('0x8'));var fs=require('fs');var fs_extra=require(_0x9334('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9334('0xa'));var toCsv=require(_0x9334('0xb'));var querystring=require(_0x9334('0xc'));var Papa=require(_0x9334('0xd'));var Redis=require(_0x9334('0xe'));var authService=require(_0x9334('0xf'));var qs=require(_0x9334('0x10'));var as=require(_0x9334('0x11'));var hardwareService=require(_0x9334('0x12'));var logger=require(_0x9334('0x13'))('api');var utils=require(_0x9334('0x14'));var config=require(_0x9334('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9334('0x16'))['db'];config[_0x9334('0x17')]=_[_0x9334('0x18')](config[_0x9334('0x17')],{'host':_0x9334('0x19'),'port':0x18eb});var socket=require(_0x9334('0x1a'))(new Redis(config[_0x9334('0x17')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x5f573c,_0x20cf16){_0x20cf16=_0x20cf16||0xcc;return function(_0x945de7){if(_0x945de7){return _0x5f573c[_0x9334('0x1b')](_0x20cf16);}return _0x5f573c[_0x9334('0x1c')](_0x20cf16)[_0x9334('0x1d')]();};}function respondWithResult(_0x3eae7e,_0x19f323){_0x19f323=_0x19f323||0xc8;return function(_0x3cb01b){if(_0x3cb01b){return _0x3eae7e[_0x9334('0x1c')](_0x19f323)['json'](_0x3cb01b);}};}function respondWithFilteredResult(_0x576adb,_0x334a55){return function(_0x48430a){if(_0x48430a){var _0x47e450=typeof _0x334a55[_0x9334('0x1e')]===_0x9334('0x1f')&&typeof _0x334a55['limit']===_0x9334('0x1f');var _0x4cac76=_0x48430a[_0x9334('0x20')];var _0x5d3230=_0x47e450?0x0:_0x334a55[_0x9334('0x1e')];var _0x2c9d50=_0x47e450?_0x48430a[_0x9334('0x20')]:_0x334a55[_0x9334('0x1e')]+_0x334a55['limit'];var _0x583f54;if(_0x2c9d50>=_0x4cac76){_0x2c9d50=_0x4cac76;_0x583f54=0xc8;}else{_0x583f54=0xce;}_0x576adb[_0x9334('0x1c')](_0x583f54);return _0x576adb[_0x9334('0x21')](_0x9334('0x22'),_0x5d3230+'-'+_0x2c9d50+'/'+_0x4cac76)[_0x9334('0x23')](_0x48430a);}return null;};}function patchUpdates(_0x457500){return function(_0x5d2197){try{jsonpatch[_0x9334('0x24')](_0x5d2197,_0x457500,!![]);}catch(_0x4e8a05){return BPromise[_0x9334('0x25')](_0x4e8a05);}return _0x5d2197['save']();};}function saveUpdates(_0x3732c8,_0x52770b){return function(_0x53493b){if(_0x53493b){return _0x53493b['update'](_0x3732c8)[_0x9334('0x26')](function(_0x396c44){return _0x396c44;});}return null;};}function removeEntity(_0xf8bc73,_0xf0bf4f){return function(_0x5e4db7){if(_0x5e4db7){return _0x5e4db7[_0x9334('0x27')]()[_0x9334('0x26')](function(){_0xf8bc73[_0x9334('0x1c')](0xcc)[_0x9334('0x1d')]();});}};}function handleEntityNotFound(_0xb34506,_0x1de922){return function(_0x3455cc){if(!_0x3455cc){_0xb34506['sendStatus'](0x194);}return _0x3455cc;};}function handleError(_0x534d48,_0x116e51){_0x116e51=_0x116e51||0x1f4;return function(_0x28358d){logger[_0x9334('0x28')](_0x28358d['stack']);if(_0x28358d['name']){delete _0x28358d[_0x9334('0x29')];}_0x534d48[_0x9334('0x1c')](_0x116e51)[_0x9334('0x2a')](_0x28358d);};}exports[_0x9334('0x2b')]=function(_0x104514,_0x77d141){var _0x5e3c37={},_0x159c26={},_0x2e7029={'count':0x0,'rows':[]};var _0x569c12=_[_0x9334('0x2c')](db[_0x9334('0x2d')][_0x9334('0x2e')],function(_0x3ac8cc){return{'name':_0x3ac8cc[_0x9334('0x2f')],'type':_0x3ac8cc[_0x9334('0x30')][_0x9334('0x31')]};});_0x159c26[_0x9334('0x32')]=_[_0x9334('0x2c')](_0x569c12,_0x9334('0x29'));_0x159c26['query']=_[_0x9334('0x33')](_0x104514[_0x9334('0x34')]);_0x159c26[_0x9334('0x35')]=_[_0x9334('0x36')](_0x159c26[_0x9334('0x32')],_0x159c26['query']);_0x5e3c37[_0x9334('0x37')]=_[_0x9334('0x36')](_0x159c26['model'],qs[_0x9334('0x38')](_0x104514['query'][_0x9334('0x38')]));_0x5e3c37[_0x9334('0x37')]=_0x5e3c37[_0x9334('0x37')]['length']?_0x5e3c37['attributes']:_0x159c26[_0x9334('0x32')];if(!_0x104514[_0x9334('0x34')]['hasOwnProperty'](_0x9334('0x39'))){_0x5e3c37[_0x9334('0x3a')]=qs[_0x9334('0x3a')](_0x104514[_0x9334('0x34')]['limit']);_0x5e3c37[_0x9334('0x1e')]=qs[_0x9334('0x1e')](_0x104514['query']['offset']);}_0x5e3c37[_0x9334('0x3b')]=qs[_0x9334('0x3c')](_0x104514[_0x9334('0x34')][_0x9334('0x3c')]);_0x5e3c37[_0x9334('0x3d')]=qs[_0x9334('0x35')](_[_0x9334('0x3e')](_0x104514[_0x9334('0x34')],_0x159c26[_0x9334('0x35')]),_0x569c12);if(_0x104514[_0x9334('0x34')]['filter']){_0x5e3c37[_0x9334('0x3d')]=_[_0x9334('0x3f')](_0x5e3c37[_0x9334('0x3d')],{'$or':_[_0x9334('0x2c')](_0x569c12,function(_0x387b4b){if(_0x387b4b[_0x9334('0x30')]!=='VIRTUAL'){var _0x51ec1e={};_0x51ec1e[_0x387b4b['name']]={'$like':'%'+_0x104514['query'][_0x9334('0x40')]+'%'};return _0x51ec1e;}})});}_0x5e3c37=_['merge']({},_0x5e3c37,_0x104514['options']);var _0x2afb77={'where':_0x5e3c37[_0x9334('0x3d')]};return db[_0x9334('0x2d')][_0x9334('0x20')](_0x2afb77)[_0x9334('0x26')](function(_0xad7297){_0x2e7029['count']=_0xad7297;if(_0x104514[_0x9334('0x34')][_0x9334('0x41')]){_0x5e3c37[_0x9334('0x42')]=[{'all':!![]}];}return db[_0x9334('0x2d')][_0x9334('0x43')](_0x5e3c37);})[_0x9334('0x26')](function(_0x5d32bd){_0x2e7029[_0x9334('0x44')]=_0x5d32bd;return _0x2e7029;})['then'](respondWithFilteredResult(_0x77d141,_0x5e3c37))[_0x9334('0x45')](handleError(_0x77d141,null));};exports[_0x9334('0x46')]=function(_0x3fbb1f,_0x4fa8f1){var _0x38ed54={'raw':!![],'where':{'id':_0x3fbb1f['params']['id']}},_0x2dec2c={};_0x2dec2c[_0x9334('0x32')]=_[_0x9334('0x33')](db[_0x9334('0x2d')][_0x9334('0x2e')]);_0x2dec2c['query']=_[_0x9334('0x33')](_0x3fbb1f[_0x9334('0x34')]);_0x2dec2c['filters']=_[_0x9334('0x36')](_0x2dec2c[_0x9334('0x32')],_0x2dec2c[_0x9334('0x34')]);_0x38ed54[_0x9334('0x37')]=_['intersection'](_0x2dec2c['model'],qs[_0x9334('0x38')](_0x3fbb1f[_0x9334('0x34')][_0x9334('0x38')]));_0x38ed54[_0x9334('0x37')]=_0x38ed54['attributes']['length']?_0x38ed54[_0x9334('0x37')]:_0x2dec2c[_0x9334('0x32')];if(_0x3fbb1f[_0x9334('0x34')]['includeAll']){_0x38ed54[_0x9334('0x42')]=[{'all':!![]}];}_0x38ed54=_[_0x9334('0x3f')]({},_0x38ed54,_0x3fbb1f[_0x9334('0x47')]);return db[_0x9334('0x2d')]['find'](_0x38ed54)[_0x9334('0x26')](handleEntityNotFound(_0x4fa8f1,null))[_0x9334('0x26')](respondWithResult(_0x4fa8f1,null))[_0x9334('0x45')](handleError(_0x4fa8f1,null));};exports[_0x9334('0x48')]=function(_0x234db5,_0x3d1f10){return db[_0x9334('0x2d')][_0x9334('0x48')](_0x234db5['body'],{})[_0x9334('0x26')](respondWithResult(_0x3d1f10,0xc9))[_0x9334('0x45')](handleError(_0x3d1f10,null));};exports[_0x9334('0x49')]=function(_0x5cf770,_0x299d84){if(_0x5cf770[_0x9334('0x4a')]['id']){delete _0x5cf770[_0x9334('0x4a')]['id'];}return db[_0x9334('0x2d')][_0x9334('0x4b')]({'where':{'id':_0x5cf770[_0x9334('0x4c')]['id']}})[_0x9334('0x26')](handleEntityNotFound(_0x299d84,null))[_0x9334('0x26')](saveUpdates(_0x5cf770['body'],null))[_0x9334('0x26')](respondWithResult(_0x299d84,null))['catch'](handleError(_0x299d84,null));};exports[_0x9334('0x27')]=function(_0x537b8d,_0x5e2a97){return db[_0x9334('0x2d')][_0x9334('0x4b')]({'where':{'id':_0x537b8d['params']['id']}})[_0x9334('0x26')](handleEntityNotFound(_0x5e2a97,null))[_0x9334('0x26')](removeEntity(_0x5e2a97,null))[_0x9334('0x45')](handleError(_0x5e2a97,null));};exports[_0x9334('0x4d')]=function(_0x2bf719,_0x3f2a69){return db['ChatInternalMessage'][_0x9334('0x4d')]()['then'](respondWithResult(_0x3f2a69,null))[_0x9334('0x45')](handleError(_0x3f2a69,null));};function wrapUser(_0x321ecb){return function(_0x1b23f2){var _0x519be9=_0x321ecb[_0x9334('0x4e')]({'plain':!![]});_0x519be9[_0x9334('0x4f')]=[];if(_0x1b23f2){_0x519be9[_0x9334('0x50')]=_0x1b23f2[_0x9334('0x51')];_0x519be9[_0x9334('0x52')]=_0x1b23f2;}else{_0x519be9['lastMessageAt']=moment(0x0)['format'](_0x9334('0x53'));_0x519be9[_0x9334('0x52')]={};}return _0x519be9;};}exports[_0x9334('0x54')]=function(_0xa7c214,_0x2d58f8,_0x27f47b){var _0x34e876=[];return db[_0x9334('0x55')][_0x9334('0x43')]({'where':{'role':[_0x9334('0x56'),_0x9334('0x57'),_0x9334('0x58')]},'attributes':['id',_0x9334('0x59'),_0x9334('0x29'),_0x9334('0x5a'),_0x9334('0x5b'),'internal',_0x9334('0x5c'),_0x9334('0x5d'),_0x9334('0x5e'),_0x9334('0x5f')],'order':qs[_0x9334('0x3c')]('-online'),'include':[{'model':db[_0x9334('0x60')],'as':_0x9334('0x61'),'attributes':['id','name',_0x9334('0x30')],'through':{'attributes':[]}}]})[_0x9334('0x26')](function(_0x3c4dd2){if(_0x3c4dd2){var _0x4b836a=_0xa7c214[_0x9334('0x58')][_0x9334('0x4e')]({'plain':!![]});if(!_0x4b836a)throw new Error(_0x9334('0x62'));if(_0x4b836a[_0x9334('0x5a')]===_0x9334('0x58')){return db[_0x9334('0x63')][_0x9334('0x4b')]({'where':{'name':_0x9334('0x64'),'userProfileId':_0x4b836a[_0x9334('0x65')]},'raw':!![]})[_0x9334('0x26')](function(_0x448d76){if(_0x448d76){if(_0x448d76[_0x9334('0x66')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x448d76['id']},'raw':!![]})[_0x9334('0x26')](function(_0x4b1047){var _0x153c7a=[];if(_[_0x9334('0x67')](_0x4b1047)){_0x153c7a=_['filter'](_0x3c4dd2,function(_0x3450bf){if(_0x3450bf[_0x9334('0x5a')]!==_0x9334('0x56')){return _0x3450bf;}});return _0x153c7a;}else{for(var _0x252b0e=0x0;_0x252b0e<_0x3c4dd2[_0x9334('0x68')];_0x252b0e++){var _0x98906a=_0x3c4dd2[_0x252b0e];if(_0x98906a[_0x9334('0x5a')]===_0x9334('0x56')){var _0x4e7695=_[_0x9334('0x4b')](_0x4b1047,function(_0xb16ee){return _0xb16ee[_0x9334('0x69')]===_0x98906a['id'];});if(_0x4e7695)_0x153c7a['push'](_0x98906a);}else{_0x153c7a['push'](_0x98906a);}}return _0x153c7a;}});}else{return _0x3c4dd2;}}else{var _0x110792=_[_0x9334('0x40')](_0x3c4dd2,function(_0x5b2951){if(_0x5b2951[_0x9334('0x5a')]!==_0x9334('0x56')){return _0x5b2951;}});return _0x110792;}});}else{return _0x3c4dd2;}}})[_0x9334('0x26')](function(_0x2924f9){var _0x56909d=[];if(_0x2924f9){_0x34e876=_0x2924f9;for(var _0x43cd84=0x0;_0x43cd84<_0x2924f9[_0x9334('0x68')];_0x43cd84+=0x1){_0x34e876[_0x43cd84][_0x9334('0x4f')]=[];_0x56909d[_0x9334('0x6a')](db['ChatInternalMessage'][_0x9334('0x4b')]({'where':{'FromId':[_0xa7c214[_0x9334('0x58')]['id'],_0x2924f9[_0x43cd84]['id']],'ToId':[_0xa7c214[_0x9334('0x58')]['id'],_0x2924f9[_0x43cd84]['id']],'ChatGroupId':null},'attributes':['id',_0x9334('0x51'),_0x9334('0x6b'),_0x9334('0x6c'),_0x9334('0x6d'),_0x9334('0x4a')],'order':qs[_0x9334('0x3c')](_0x9334('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2924f9[_0x43cd84])));}return BPromise[_0x9334('0x6f')](_0x56909d);}return[];})['then'](function(_0x5804c4){return{'rows':_0x5804c4,'count':_0x5804c4['length']};})[_0x9334('0x26')](respondWithResult(_0x2d58f8,null))[_0x9334('0x45')](handleError(_0x2d58f8,null));}; \ No newline at end of file +var _0x8290=['includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','describe','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','fullname','role','userpic','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','read','all','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','merge','options'];(function(_0x3a4fb8,_0x4c7572){var _0x2cd37f=function(_0x2f4df3){while(--_0x2f4df3){_0x3a4fb8['push'](_0x3a4fb8['shift']());}};_0x2cd37f(++_0x4c7572);}(_0x8290,0x104));var _0x0829=function(_0x178b6f,_0x3c7de7){_0x178b6f=_0x178b6f-0x0;var _0xba8131=_0x8290[_0x178b6f];return _0xba8131;};'use strict';var emlformat=require(_0x0829('0x0'));var rimraf=require(_0x0829('0x1'));var zipdir=require(_0x0829('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0829('0x3'));var moment=require(_0x0829('0x4'));var BPromise=require(_0x0829('0x5'));var Mustache=require('mustache');var util=require(_0x0829('0x6'));var path=require(_0x0829('0x7'));var sox=require(_0x0829('0x8'));var csv=require(_0x0829('0x9'));var ejs=require(_0x0829('0xa'));var fs=require('fs');var fs_extra=require(_0x0829('0xb'));var _=require(_0x0829('0xc'));var squel=require(_0x0829('0xd'));var crypto=require(_0x0829('0xe'));var jsforce=require(_0x0829('0xf'));var deskjs=require(_0x0829('0x10'));var toCsv=require(_0x0829('0x9'));var querystring=require(_0x0829('0x11'));var Papa=require(_0x0829('0x12'));var Redis=require(_0x0829('0x13'));var authService=require(_0x0829('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0829('0x15'));var hardwareService=require(_0x0829('0x16'));var logger=require(_0x0829('0x17'))('api');var utils=require(_0x0829('0x18'));var config=require(_0x0829('0x19'));var licenseUtil=require(_0x0829('0x1a'));var db=require(_0x0829('0x1b'))['db'];config['redis']=_[_0x0829('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0829('0x1d'))(new Redis(config[_0x0829('0x1e')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0xd74166,_0x46e977){_0x46e977=_0x46e977||0xcc;return function(_0x19db0a){if(_0x19db0a){return _0xd74166['sendStatus'](_0x46e977);}return _0xd74166[_0x0829('0x1f')](_0x46e977)['end']();};}function respondWithResult(_0x1cbb4e,_0x1de2b2){_0x1de2b2=_0x1de2b2||0xc8;return function(_0x5078ed){if(_0x5078ed){return _0x1cbb4e['status'](_0x1de2b2)[_0x0829('0x20')](_0x5078ed);}};}function respondWithFilteredResult(_0x2de05f,_0x571c64){return function(_0x1a920f){if(_0x1a920f){var _0x5f4f66=typeof _0x571c64[_0x0829('0x21')]===_0x0829('0x22')&&typeof _0x571c64[_0x0829('0x23')]===_0x0829('0x22');var _0x232402=_0x1a920f[_0x0829('0x24')];var _0x3495c5=_0x5f4f66?0x0:_0x571c64['offset'];var _0x1acbe2=_0x5f4f66?_0x1a920f['count']:_0x571c64[_0x0829('0x21')]+_0x571c64['limit'];var _0x19b601;if(_0x1acbe2>=_0x232402){_0x1acbe2=_0x232402;_0x19b601=0xc8;}else{_0x19b601=0xce;}_0x2de05f['status'](_0x19b601);return _0x2de05f[_0x0829('0x25')](_0x0829('0x26'),_0x3495c5+'-'+_0x1acbe2+'/'+_0x232402)[_0x0829('0x20')](_0x1a920f);}return null;};}function patchUpdates(_0x5ad2a9){return function(_0x5982d4){try{jsonpatch[_0x0829('0x27')](_0x5982d4,_0x5ad2a9,!![]);}catch(_0x24019a){return BPromise['reject'](_0x24019a);}return _0x5982d4[_0x0829('0x28')]();};}function saveUpdates(_0x2bf2a7,_0x262101){return function(_0x5eeedf){if(_0x5eeedf){return _0x5eeedf[_0x0829('0x29')](_0x2bf2a7)[_0x0829('0x2a')](function(_0x19ff65){return _0x19ff65;});}return null;};}function removeEntity(_0x4b67c6,_0x463724){return function(_0x45dc77){if(_0x45dc77){return _0x45dc77[_0x0829('0x2b')]()[_0x0829('0x2a')](function(){_0x4b67c6[_0x0829('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeaaad4,_0x2c55b5){return function(_0x59eab8){if(!_0x59eab8){_0xeaaad4[_0x0829('0x2c')](0x194);}return _0x59eab8;};}function handleError(_0x4ff971,_0x5495e7){_0x5495e7=_0x5495e7||0x1f4;return function(_0x1b1d68){logger[_0x0829('0x2d')](_0x1b1d68[_0x0829('0x2e')]);if(_0x1b1d68[_0x0829('0x2f')]){delete _0x1b1d68[_0x0829('0x2f')];}_0x4ff971['status'](_0x5495e7)[_0x0829('0x30')](_0x1b1d68);};}exports[_0x0829('0x31')]=function(_0x16103b,_0x465aa7){var _0x1faedb={},_0x3a3358={},_0x33ab84={'count':0x0,'rows':[]};var _0x1f8685=_['map'](db[_0x0829('0x32')][_0x0829('0x33')],function(_0x281c44){return{'name':_0x281c44[_0x0829('0x34')],'type':_0x281c44[_0x0829('0x35')]['key']};});_0x3a3358[_0x0829('0x36')]=_[_0x0829('0x37')](_0x1f8685,_0x0829('0x2f'));_0x3a3358[_0x0829('0x38')]=_['keys'](_0x16103b[_0x0829('0x38')]);_0x3a3358[_0x0829('0x39')]=_[_0x0829('0x3a')](_0x3a3358[_0x0829('0x36')],_0x3a3358['query']);_0x1faedb[_0x0829('0x3b')]=_[_0x0829('0x3a')](_0x3a3358[_0x0829('0x36')],qs[_0x0829('0x3c')](_0x16103b['query'][_0x0829('0x3c')]));_0x1faedb[_0x0829('0x3b')]=_0x1faedb[_0x0829('0x3b')]['length']?_0x1faedb[_0x0829('0x3b')]:_0x3a3358[_0x0829('0x36')];if(!_0x16103b[_0x0829('0x38')][_0x0829('0x3d')]('nolimit')){_0x1faedb[_0x0829('0x23')]=qs['limit'](_0x16103b[_0x0829('0x38')][_0x0829('0x23')]);_0x1faedb[_0x0829('0x21')]=qs[_0x0829('0x21')](_0x16103b[_0x0829('0x38')][_0x0829('0x21')]);}_0x1faedb['order']=qs['sort'](_0x16103b[_0x0829('0x38')][_0x0829('0x3e')]);_0x1faedb['where']=qs[_0x0829('0x39')](_['pick'](_0x16103b[_0x0829('0x38')],_0x3a3358['filters']),_0x1f8685);if(_0x16103b[_0x0829('0x38')][_0x0829('0x3f')]){_0x1faedb[_0x0829('0x40')]=_[_0x0829('0x41')](_0x1faedb[_0x0829('0x40')],{'$or':_[_0x0829('0x37')](_0x1f8685,function(_0x1c18e0){if(_0x1c18e0[_0x0829('0x35')]!=='VIRTUAL'){var _0x535988={};_0x535988[_0x1c18e0[_0x0829('0x2f')]]={'$like':'%'+_0x16103b[_0x0829('0x38')][_0x0829('0x3f')]+'%'};return _0x535988;}})});}_0x1faedb=_[_0x0829('0x41')]({},_0x1faedb,_0x16103b[_0x0829('0x42')]);var _0xa89bf9={'where':_0x1faedb[_0x0829('0x40')]};return db[_0x0829('0x32')][_0x0829('0x24')](_0xa89bf9)[_0x0829('0x2a')](function(_0x57d564){_0x33ab84[_0x0829('0x24')]=_0x57d564;if(_0x16103b[_0x0829('0x38')][_0x0829('0x43')]){_0x1faedb[_0x0829('0x44')]=[{'all':!![]}];}return db[_0x0829('0x32')][_0x0829('0x45')](_0x1faedb);})[_0x0829('0x2a')](function(_0x35a171){_0x33ab84[_0x0829('0x46')]=_0x35a171;return _0x33ab84;})[_0x0829('0x2a')](respondWithFilteredResult(_0x465aa7,_0x1faedb))[_0x0829('0x47')](handleError(_0x465aa7,null));};exports[_0x0829('0x48')]=function(_0x2aaee4,_0xace144){var _0x3d847c={'raw':!![],'where':{'id':_0x2aaee4[_0x0829('0x49')]['id']}},_0x209b3f={};_0x209b3f[_0x0829('0x36')]=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x209b3f[_0x0829('0x38')]=_[_0x0829('0x4a')](_0x2aaee4['query']);_0x209b3f[_0x0829('0x39')]=_[_0x0829('0x3a')](_0x209b3f[_0x0829('0x36')],_0x209b3f['query']);_0x3d847c[_0x0829('0x3b')]=_['intersection'](_0x209b3f['model'],qs['fields'](_0x2aaee4[_0x0829('0x38')][_0x0829('0x3c')]));_0x3d847c['attributes']=_0x3d847c['attributes'][_0x0829('0x4b')]?_0x3d847c[_0x0829('0x3b')]:_0x209b3f[_0x0829('0x36')];if(_0x2aaee4[_0x0829('0x38')]['includeAll']){_0x3d847c[_0x0829('0x44')]=[{'all':!![]}];}_0x3d847c=_[_0x0829('0x41')]({},_0x3d847c,_0x2aaee4[_0x0829('0x42')]);return db[_0x0829('0x32')]['find'](_0x3d847c)['then'](handleEntityNotFound(_0xace144,null))[_0x0829('0x2a')](respondWithResult(_0xace144,null))[_0x0829('0x47')](handleError(_0xace144,null));};exports[_0x0829('0x4c')]=function(_0x1a25b8,_0x5badd4){return db['ChatInternalMessage'][_0x0829('0x4c')](_0x1a25b8[_0x0829('0x4d')],{})[_0x0829('0x2a')](respondWithResult(_0x5badd4,0xc9))[_0x0829('0x47')](handleError(_0x5badd4,null));};exports[_0x0829('0x29')]=function(_0xe2f8be,_0x50c1ce){if(_0xe2f8be['body']['id']){delete _0xe2f8be[_0x0829('0x4d')]['id'];}return db[_0x0829('0x32')][_0x0829('0x4e')]({'where':{'id':_0xe2f8be['params']['id']}})['then'](handleEntityNotFound(_0x50c1ce,null))['then'](saveUpdates(_0xe2f8be[_0x0829('0x4d')],null))[_0x0829('0x2a')](respondWithResult(_0x50c1ce,null))[_0x0829('0x47')](handleError(_0x50c1ce,null));};exports[_0x0829('0x2b')]=function(_0x2c95b3,_0x2da9b8){return db['ChatInternalMessage'][_0x0829('0x4e')]({'where':{'id':_0x2c95b3[_0x0829('0x49')]['id']}})[_0x0829('0x2a')](handleEntityNotFound(_0x2da9b8,null))['then'](removeEntity(_0x2da9b8,null))[_0x0829('0x47')](handleError(_0x2da9b8,null));};exports['describe']=function(_0x1c6a55,_0x42a455){return db[_0x0829('0x32')][_0x0829('0x4f')]()['then'](respondWithResult(_0x42a455,null))[_0x0829('0x47')](handleError(_0x42a455,null));};function wrapUser(_0x523987){return function(_0x2de2be){var _0x56b9c1=_0x523987['get']({'plain':!![]});_0x56b9c1[_0x0829('0x50')]=[];if(_0x2de2be){_0x56b9c1[_0x0829('0x51')]=_0x2de2be['createdAt'];_0x56b9c1[_0x0829('0x52')]=_0x2de2be;}else{_0x56b9c1[_0x0829('0x51')]=moment(0x0)['format'](_0x0829('0x53'));_0x56b9c1[_0x0829('0x52')]={};}return _0x56b9c1;};}exports[_0x0829('0x54')]=function(_0x48dcf6,_0x12925e,_0x3dfa29){var _0x310cff=[];return db[_0x0829('0x55')][_0x0829('0x45')]({'where':{'role':[_0x0829('0x56'),'admin','user']},'attributes':['id',_0x0829('0x57'),_0x0829('0x2f'),_0x0829('0x58'),_0x0829('0x59'),'internal',_0x0829('0x5a'),_0x0829('0x5b'),_0x0829('0x5c'),'showWebBar'],'order':qs[_0x0829('0x3e')](_0x0829('0x5d')),'include':[{'model':db[_0x0829('0x5e')],'as':_0x0829('0x5f'),'attributes':['id',_0x0829('0x2f'),_0x0829('0x35')],'through':{'attributes':[]}}]})['then'](function(_0x57b775){if(_0x57b775){var _0x26f7d8=_0x48dcf6[_0x0829('0x60')][_0x0829('0x61')]({'plain':!![]});if(!_0x26f7d8)throw new Error(_0x0829('0x62'));if(_0x26f7d8['role']===_0x0829('0x60')){return db[_0x0829('0x63')][_0x0829('0x4e')]({'where':{'name':_0x0829('0x64'),'userProfileId':_0x26f7d8[_0x0829('0x65')]},'raw':!![]})[_0x0829('0x2a')](function(_0x54ef8a){if(_0x54ef8a){if(_0x54ef8a[_0x0829('0x66')]===0x0){return db[_0x0829('0x67')]['findAll']({'where':{'sectionId':_0x54ef8a['id']},'raw':!![]})['then'](function(_0x49e509){var _0x239d4c=[];if(_[_0x0829('0x68')](_0x49e509)){_0x239d4c=_[_0x0829('0x3f')](_0x57b775,function(_0x310c35){if(_0x310c35['role']!=='agent'){return _0x310c35;}});return _0x239d4c;}else{for(var _0x382769=0x0;_0x382769<_0x57b775[_0x0829('0x4b')];_0x382769++){var _0xe3b281=_0x57b775[_0x382769];if(_0xe3b281[_0x0829('0x58')]==='agent'){var _0x38c8b7=_[_0x0829('0x4e')](_0x49e509,function(_0x3dd63b){return _0x3dd63b[_0x0829('0x69')]===_0xe3b281['id'];});if(_0x38c8b7)_0x239d4c[_0x0829('0x6a')](_0xe3b281);}else{_0x239d4c[_0x0829('0x6a')](_0xe3b281);}}return _0x239d4c;}});}else{return _0x57b775;}}else{var _0x3bf1bf=_[_0x0829('0x3f')](_0x57b775,function(_0x14a2ed){if(_0x14a2ed['role']!==_0x0829('0x56')){return _0x14a2ed;}});return _0x3bf1bf;}});}else{return _0x57b775;}}})[_0x0829('0x2a')](function(_0x498268){var _0x580ea4=[];if(_0x498268){_0x310cff=_0x498268;for(var _0x4ac7db=0x0;_0x4ac7db<_0x498268[_0x0829('0x4b')];_0x4ac7db+=0x1){_0x310cff[_0x4ac7db][_0x0829('0x50')]=[];_0x580ea4['push'](db[_0x0829('0x32')]['find']({'where':{'FromId':[_0x48dcf6[_0x0829('0x60')]['id'],_0x498268[_0x4ac7db]['id']],'ToId':[_0x48dcf6[_0x0829('0x60')]['id'],_0x498268[_0x4ac7db]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId','ToId',_0x0829('0x6b'),'body'],'order':qs[_0x0829('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0829('0x2a')](wrapUser(_0x498268[_0x4ac7db])));}return BPromise[_0x0829('0x6c')](_0x580ea4);}return[];})[_0x0829('0x2a')](function(_0x2509f5){return{'rows':_0x2509f5,'count':_0x2509f5[_0x0829('0x4b')]};})[_0x0829('0x2a')](respondWithResult(_0x12925e,null))[_0x0829('0x47')](handleError(_0x12925e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e383489..18d5a80 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 _0xf3d9=['ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2765b2,_0x59ee1d){var _0x1cfbaa=function(_0x4607a6){while(--_0x4607a6){_0x2765b2['push'](_0x2765b2['shift']());}};_0x1cfbaa(++_0x59ee1d);}(_0xf3d9,0x162));var _0x9f3d=function(_0xabc9ca,_0x49dc2d){_0xabc9ca=_0xabc9ca-0x0;var _0x3145a7=_0xf3d9[_0xabc9ca];return _0x3145a7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x9f3d('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9f3d('0x1')](0x0);var events={'afterCreate':_0x9f3d('0x2'),'afterUpdate':'update','afterDestroy':_0x9f3d('0x3')};function emitEvent(_0x23e965){return function(_0x1cea6e,_0x1e2b59,_0x147492){ChatInternalMessageEvents['emit'](_0x23e965+':'+_0x1cea6e['id'],_0x1cea6e);ChatInternalMessageEvents[_0x9f3d('0x4')](_0x23e965,_0x1cea6e);_0x147492(null);};}for(var e in events){if(events[_0x9f3d('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x1364=['exports','events','ChatInternalMessage','setMaxListeners','update','emit','hook'];(function(_0x4d18cf,_0x233104){var _0x4a117c=function(_0x56f731){while(--_0x56f731){_0x4d18cf['push'](_0x4d18cf['shift']());}};_0x4a117c(++_0x233104);}(_0x1364,0x1eb));var _0x4136=function(_0x1ec9e4,_0xcb6c1f){_0x1ec9e4=_0x1ec9e4-0x0;var _0x34e446=_0x1364[_0x1ec9e4];return _0x34e446;};'use strict';var EventEmitter=require(_0x4136('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x4136('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4136('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4136('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1397f8){return function(_0x674ea0,_0x174543,_0x5e9bad){ChatInternalMessageEvents['emit'](_0x1397f8+':'+_0x674ea0['id'],_0x674ea0);ChatInternalMessageEvents[_0x4136('0x4')](_0x1397f8,_0x674ea0);_0x5e9bad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x4136('0x5')](e,emitEvent(event));}}module[_0x4136('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 035b2d0..155323b 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 _0x2a05=['chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x4f21c4,_0x960024){var _0x2f9fa6=function(_0x26f914){while(--_0x26f914){_0x4f21c4['push'](_0x4f21c4['shift']());}};_0x2f9fa6(++_0x960024);}(_0x2a05,0xe6));var _0x52a0=function(_0x36dab3,_0x1fae2d){_0x36dab3=_0x36dab3-0x0;var _0x514492=_0x2a05[_0x36dab3];return _0x514492;};'use strict';var _=require('lodash');var util=require(_0x52a0('0x0'));var logger=require(_0x52a0('0x1'))(_0x52a0('0x2'));var moment=require('moment');var BPromise=require(_0x52a0('0x3'));var rp=require(_0x52a0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52a0('0x5'));var config=require('../../config/environment');var attributes=require(_0x52a0('0x6'));module[_0x52a0('0x7')]=function(_0xe2f966,_0x584b9e){return _0xe2f966[_0x52a0('0x8')](_0x52a0('0x9'),attributes,{'tableName':_0x52a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x52a0('0xb')});}; \ No newline at end of file +var _0x982d=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path'];(function(_0x5c73dd,_0xf24fa1){var _0x467794=function(_0x3d412e){while(--_0x3d412e){_0x5c73dd['push'](_0x5c73dd['shift']());}};_0x467794(++_0xf24fa1);}(_0x982d,0x1d5));var _0xd982=function(_0x5be5db,_0x3b34e3){_0x5be5db=_0x5be5db-0x0;var _0x2d5161=_0x982d[_0x5be5db];return _0x2d5161;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd982('0x0'))('api');var moment=require(_0xd982('0x1'));var BPromise=require(_0xd982('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd982('0x3'));var rimraf=require('rimraf');var config=require(_0xd982('0x4'));var attributes=require(_0xd982('0x5'));module[_0xd982('0x6')]=function(_0x2e4bf6,_0x3980de){return _0x2e4bf6[_0xd982('0x7')](_0xd982('0x8'),attributes,{'tableName':_0xd982('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd982('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c0be1a0..e98e4bd 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 _0x0d8c=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x4a753f,_0x33f3e9){var _0x117385=function(_0x76c316){while(--_0x76c316){_0x4a753f['push'](_0x4a753f['shift']());}};_0x117385(++_0x33f3e9);}(_0x0d8c,0xae));var _0xc0d8=function(_0x1f4ba4,_0x27004c){_0x1f4ba4=_0x1f4ba4-0x0;var _0x2b5f00=_0x0d8c[_0x1f4ba4];return _0x2b5f00;};'use strict';var _=require(_0xc0d8('0x0'));var util=require(_0xc0d8('0x1'));var moment=require(_0xc0d8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0d8('0x3'));var fs=require('fs');var Redis=require(_0xc0d8('0x4'));var db=require(_0xc0d8('0x5'))['db'];var utils=require(_0xc0d8('0x6'));var logger=require(_0xc0d8('0x7'))(_0xc0d8('0x8'));var config=require(_0xc0d8('0x9'));var jayson=require(_0xc0d8('0xa'));var client=jayson[_0xc0d8('0xb')][_0xc0d8('0xc')]({'port':0x232a});config[_0xc0d8('0xd')]=_[_0xc0d8('0xe')](config['redis'],{'host':_0xc0d8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0d8('0xd')]));require(_0xc0d8('0x10'))[_0xc0d8('0x11')](socket);function respondWithRpcPromise(_0x20ffe1,_0x42d620,_0x1fdf8e){return new BPromise(function(_0x1d42fb,_0x1fb4ca){return client[_0xc0d8('0x12')](_0x20ffe1,_0x1fdf8e)[_0xc0d8('0x13')](function(_0x1a6e1b){logger[_0xc0d8('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x42d620,_0xc0d8('0x15'));logger[_0xc0d8('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x42d620,_0xc0d8('0x15'),JSON[_0xc0d8('0x17')](_0x1a6e1b));if(_0x1a6e1b[_0xc0d8('0x18')]){if(_0x1a6e1b[_0xc0d8('0x18')][_0xc0d8('0x19')]===0x1f4){logger[_0xc0d8('0x18')](_0xc0d8('0x1a'),_0x42d620,_0x1a6e1b[_0xc0d8('0x18')][_0xc0d8('0x1b')]);return _0x1fb4ca(_0x1a6e1b[_0xc0d8('0x18')][_0xc0d8('0x1b')]);}logger[_0xc0d8('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x42d620,_0x1a6e1b['error'][_0xc0d8('0x1b')]);return _0x1d42fb(_0x1a6e1b[_0xc0d8('0x18')]['message']);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x42d620,'request\x20sent');_0x1d42fb(_0x1a6e1b[_0xc0d8('0x1c')]['message']);}})['catch'](function(_0x4962ac){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x42d620,_0x4962ac);_0x1fb4ca(_0x4962ac);});});} \ No newline at end of file +var _0x77a3=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./chatInternalMessage.socket','register','request','then','request\x20sent','debug'];(function(_0x4bb149,_0x398231){var _0x552b31=function(_0x10a854){while(--_0x10a854){_0x4bb149['push'](_0x4bb149['shift']());}};_0x552b31(++_0x398231);}(_0x77a3,0xfc));var _0x377a=function(_0x17aa09,_0x5f4d2b){_0x17aa09=_0x17aa09-0x0;var _0x54aac8=_0x77a3[_0x17aa09];return _0x54aac8;};'use strict';var _=require(_0x377a('0x0'));var util=require(_0x377a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x377a('0x2'));var fs=require('fs');var Redis=require(_0x377a('0x3'));var db=require(_0x377a('0x4'))['db'];var utils=require(_0x377a('0x5'));var logger=require(_0x377a('0x6'))(_0x377a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x377a('0x8')][_0x377a('0x9')]({'port':0x232a});config[_0x377a('0xa')]=_[_0x377a('0xb')](config[_0x377a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x377a('0xa')]));require(_0x377a('0xc'))[_0x377a('0xd')](socket);function respondWithRpcPromise(_0x3746bd,_0x2e4292,_0x543935){return new BPromise(function(_0x2ce025,_0x379c8f){return client[_0x377a('0xe')](_0x3746bd,_0x543935)[_0x377a('0xf')](function(_0x4df3ae){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x2e4292,_0x377a('0x10'));logger[_0x377a('0x11')](_0x377a('0x12'),_0x2e4292,_0x377a('0x10'),JSON[_0x377a('0x13')](_0x4df3ae));if(_0x4df3ae['error']){if(_0x4df3ae[_0x377a('0x14')][_0x377a('0x15')]===0x1f4){logger[_0x377a('0x14')](_0x377a('0x16'),_0x2e4292,_0x4df3ae[_0x377a('0x14')][_0x377a('0x17')]);return _0x379c8f(_0x4df3ae[_0x377a('0x14')]['message']);}logger[_0x377a('0x14')](_0x377a('0x16'),_0x2e4292,_0x4df3ae[_0x377a('0x14')][_0x377a('0x17')]);return _0x2ce025(_0x4df3ae[_0x377a('0x14')][_0x377a('0x17')]);}else{logger[_0x377a('0x18')](_0x377a('0x16'),_0x2e4292,_0x377a('0x10'));_0x2ce025(_0x4df3ae[_0x377a('0x19')][_0x377a('0x17')]);}})[_0x377a('0x1a')](function(_0x7f212e){logger[_0x377a('0x14')](_0x377a('0x16'),_0x2e4292,_0x7f212e);_0x379c8f(_0x7f212e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index afe7704..51caa26 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 _0x6b23=['update','emit','length','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6b23,0xa0));var _0x36b2=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x6b23[_0x3de8a4];return _0x4635cf;};'use strict';var ChatInternalMessageEvents=require(_0x36b2('0x0'));var events=['save',_0x36b2('0x1'),_0x36b2('0x2')];function createListener(_0x5335ff,_0xa804ed){return function(_0x25c2ad){_0xa804ed[_0x36b2('0x3')](_0x5335ff,_0x25c2ad);};}function removeListener(_0x3e0a7d,_0x3c26a0){return function(){ChatInternalMessageEvents['removeListener'](_0x3e0a7d,_0x3c26a0);};}exports['register']=function(_0xfa5f0c){for(var _0x1ede54=0x0,_0xb444d4=events[_0x36b2('0x4')];_0x1ede54<_0xb444d4;_0x1ede54++){var _0x53f540=events[_0x1ede54];var _0x2b685d=createListener(_0x36b2('0x5')+_0x53f540,_0xfa5f0c);ChatInternalMessageEvents['on'](_0x53f540,_0x2b685d);}}; \ No newline at end of file +var _0xfc98=['register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit','removeListener'];(function(_0x38e526,_0x200d7f){var _0x4db45f=function(_0x34b4e9){while(--_0x34b4e9){_0x38e526['push'](_0x38e526['shift']());}};_0x4db45f(++_0x200d7f);}(_0xfc98,0x14b));var _0x8fc9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xfc98[_0x5d6456];return _0x4d66c1;};'use strict';var ChatInternalMessageEvents=require(_0x8fc9('0x0'));var events=['save',_0x8fc9('0x1'),_0x8fc9('0x2')];function createListener(_0x22ca2a,_0x1a8c07){return function(_0xa48c07){_0x1a8c07[_0x8fc9('0x3')](_0x22ca2a,_0xa48c07);};}function removeListener(_0x130ff6,_0x4cc5a0){return function(){ChatInternalMessageEvents[_0x8fc9('0x4')](_0x130ff6,_0x4cc5a0);};}exports[_0x8fc9('0x5')]=function(_0x142743){for(var _0x1fd480=0x0,_0x30b12b=events[_0x8fc9('0x6')];_0x1fd480<_0x30b12b;_0x1fd480++){var _0x592733=events[_0x1fd480];var _0x26fbef=createListener(_0x8fc9('0x7')+_0x592733,_0x142743);ChatInternalMessageEvents['on'](_0x592733,_0x26fbef);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 64dbb9f..842d0f6 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 _0x48db=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x459963,_0x5a366a){var _0xbe84e3=function(_0x358999){while(--_0x358999){_0x459963['push'](_0x459963['shift']());}};_0xbe84e3(++_0x5a366a);}(_0x48db,0x1cf));var _0xb48d=function(_0x3463fa,_0x2d0d31){_0x3463fa=_0x3463fa-0x0;var _0x63c0f4=_0x48db[_0x3463fa];return _0x63c0f4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb48d('0x0'));var timeout=require(_0xb48d('0x1'));var express=require(_0xb48d('0x2'));var router=express[_0xb48d('0x3')]();var fs_extra=require(_0xb48d('0x4'));var auth=require(_0xb48d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb48d('0x6'));var controller=require(_0xb48d('0x7'));router['get']('/',auth[_0xb48d('0x8')](),controller[_0xb48d('0x9')]);router[_0xb48d('0xa')](_0xb48d('0xb'),auth[_0xb48d('0x8')](),controller[_0xb48d('0xc')]);router['get']('/users',auth[_0xb48d('0x8')](),controller['getUsers']);router[_0xb48d('0xa')](_0xb48d('0xd'),auth['isAuthenticated'](),controller[_0xb48d('0xe')]);router[_0xb48d('0xf')]('/',auth['isAuthenticated'](),controller[_0xb48d('0x10')]);router[_0xb48d('0x11')](_0xb48d('0xd'),controller[_0xb48d('0x12')]);router[_0xb48d('0x13')](_0xb48d('0xd'),auth[_0xb48d('0x8')](),controller[_0xb48d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6d1c=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','post','create'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0x6d1c,0x69));var _0xc6d1=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x6d1c[_0x50bf5a];return _0x4ddc1d;};'use strict';var multer=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var path=require(_0xc6d1('0x2'));var timeout=require(_0xc6d1('0x3'));var express=require(_0xc6d1('0x4'));var router=express[_0xc6d1('0x5')]();var fs_extra=require(_0xc6d1('0x6'));var auth=require(_0xc6d1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc6d1('0x8'));var controller=require(_0xc6d1('0x9'));router[_0xc6d1('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6d1('0xb')]);router[_0xc6d1('0xa')](_0xc6d1('0xc'),auth[_0xc6d1('0xd')](),controller[_0xc6d1('0xe')]);router[_0xc6d1('0xa')](_0xc6d1('0xf'),auth['isAuthenticated'](),controller[_0xc6d1('0x10')]);router['get'](_0xc6d1('0x11'),auth[_0xc6d1('0xd')](),controller['show']);router[_0xc6d1('0x12')]('/',auth[_0xc6d1('0xd')](),controller[_0xc6d1('0x13')]);router[_0xc6d1('0x14')](_0xc6d1('0x11'),controller[_0xc6d1('0x15')]);router[_0xc6d1('0x16')]('/:id',auth[_0xc6d1('0xd')](),controller[_0xc6d1('0x17')]);module[_0xc6d1('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d5fb7b0..712be25 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 _0xb01a=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x248f29,_0x265487){var _0x1ad3f3=function(_0x46bab6){while(--_0x46bab6){_0x248f29['push'](_0x248f29['shift']());}};_0x1ad3f3(++_0x265487);}(_0xb01a,0x1a1));var _0xab01=function(_0x18634a,_0x3fd185){_0x18634a=_0x18634a-0x0;var _0x28bbc6=_0xb01a[_0x18634a];return _0x28bbc6;};'use strict';var Sequelize=require(_0xab01('0x0'));module[_0xab01('0x1')]={'body':{'type':Sequelize[_0xab01('0x2')](_0xab01('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xab01('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xab01('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xab01('0x5')]('in',_0xab01('0x6')),'defaultValue':_0xab01('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xab01('0x7')]},'providerName':{'type':Sequelize[_0xab01('0x8')]},'providerResponse':{'type':Sequelize[_0xab01('0x2')]}}; \ No newline at end of file +var _0xe6e4=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3a3473,_0x56a37e){var _0x11ab5c=function(_0x4044ad){while(--_0x4044ad){_0x3a3473['push'](_0x3a3473['shift']());}};_0x11ab5c(++_0x56a37e);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x16e6bd,_0x164cd9){_0x16e6bd=_0x16e6bd-0x0;var _0x25f3c8=_0xe6e4[_0x16e6bd];return _0x25f3c8;};'use strict';var Sequelize=require(_0x4e6e('0x0'));module[_0x4e6e('0x1')]={'body':{'type':Sequelize[_0x4e6e('0x2')](_0x4e6e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4e6e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4e6e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e6e('0x5')]('in',_0x4e6e('0x6')),'defaultValue':_0x4e6e('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4e6e('0x7')]},'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 ed64afe..da512e9 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 _0xf206=['acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','ChatMessage','show','params','includeAll','options','create','body','find','describe','../../config/logger','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0xf206,0x8d));var _0x6f20=function(_0x555b5a,_0x23c7dd){_0x555b5a=_0x555b5a-0x0;var _0x33c2b7=_0xf206[_0x555b5a];return _0x33c2b7;};'use strict';var emlformat=require(_0x6f20('0x0'));var rimraf=require(_0x6f20('0x1'));var zipdir=require(_0x6f20('0x2'));var jsonpatch=require(_0x6f20('0x3'));var rp=require(_0x6f20('0x4'));var moment=require('moment');var BPromise=require(_0x6f20('0x5'));var Mustache=require('mustache');var util=require(_0x6f20('0x6'));var path=require(_0x6f20('0x7'));var sox=require(_0x6f20('0x8'));var csv=require('to-csv');var ejs=require(_0x6f20('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f20('0xa'));var squel=require(_0x6f20('0xb'));var crypto=require(_0x6f20('0xc'));var jsforce=require(_0x6f20('0xd'));var deskjs=require(_0x6f20('0xe'));var toCsv=require(_0x6f20('0xf'));var querystring=require(_0x6f20('0x10'));var Papa=require(_0x6f20('0x11'));var Redis=require('ioredis');var authService=require(_0x6f20('0x12'));var qs=require(_0x6f20('0x13'));var as=require(_0x6f20('0x14'));var hardwareService=require(_0x6f20('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6f20('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6f20('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6f20('0x18')](config[_0x6f20('0x19')],{'host':_0x6f20('0x1a'),'port':0x18eb});var socket=require(_0x6f20('0x1b'))(new Redis(config[_0x6f20('0x19')]));require(_0x6f20('0x1c'))[_0x6f20('0x1d')](socket);var jayson=require(_0x6f20('0x1e'));var client=jayson[_0x6f20('0x1f')][_0x6f20('0x20')]({'port':0x232c});var client9002=jayson[_0x6f20('0x1f')][_0x6f20('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x39d7d8,_0xf940d,_0x13bde3,_0x1f8c4e){return new BPromise(function(_0x5d1406,_0x2e067c){var _0x38e2e0=_0x1f8c4e||client;return _0x38e2e0[_0x6f20('0x21')](_0x39d7d8,_0x13bde3)[_0x6f20('0x22')](function(_0x5e7bab){logger[_0x6f20('0x23')](_0x6f20('0x24'),_0xf940d,_0x6f20('0x25'));logger['debug'](_0x6f20('0x26'),_0xf940d,_0x6f20('0x25'),JSON[_0x6f20('0x27')](_0x5e7bab));if(_0x5e7bab[_0x6f20('0x28')]){if(_0x5e7bab[_0x6f20('0x28')][_0x6f20('0x29')]===0x1f4){logger['error'](_0x6f20('0x24'),_0xf940d,_0x5e7bab['error'][_0x6f20('0x2a')]);return _0x2e067c(_0x5e7bab[_0x6f20('0x28')]['message']);}logger['error'](_0x6f20('0x24'),_0xf940d,_0x5e7bab[_0x6f20('0x28')][_0x6f20('0x2a')]);return _0x5d1406(_0x5e7bab['error'][_0x6f20('0x2a')]);}else{logger[_0x6f20('0x23')](_0x6f20('0x24'),_0xf940d,_0x6f20('0x25'));_0x5d1406(_0x5e7bab[_0x6f20('0x2b')][_0x6f20('0x2a')]);}})[_0x6f20('0x2c')](function(_0x11b91c){logger[_0x6f20('0x28')](_0x6f20('0x24'),_0xf940d,_0x11b91c);_0x2e067c(_0x11b91c);});});}function respondWithStatusCode(_0x43d49a,_0x38282d){_0x38282d=_0x38282d||0xcc;return function(_0x49e456){if(_0x49e456){return _0x43d49a[_0x6f20('0x2d')](_0x38282d);}return _0x43d49a[_0x6f20('0x2e')](_0x38282d)[_0x6f20('0x2f')]();};}function respondWithResult(_0x2015fc,_0x47dbbf){_0x47dbbf=_0x47dbbf||0xc8;return function(_0x1249ac){if(_0x1249ac){return _0x2015fc[_0x6f20('0x2e')](_0x47dbbf)[_0x6f20('0x30')](_0x1249ac);}};}function respondWithFilteredResult(_0x768ba5,_0x516feb){return function(_0x3e5cb5){if(_0x3e5cb5){var _0x3fc85c=typeof _0x516feb[_0x6f20('0x31')]==='undefined'&&typeof _0x516feb[_0x6f20('0x32')]===_0x6f20('0x33');var _0xe82ccc=_0x3e5cb5['count'];var _0x3f4f98=_0x3fc85c?0x0:_0x516feb[_0x6f20('0x31')];var _0x152269=_0x3fc85c?_0x3e5cb5[_0x6f20('0x34')]:_0x516feb[_0x6f20('0x31')]+_0x516feb['limit'];var _0x4445b7;if(_0x152269>=_0xe82ccc){_0x152269=_0xe82ccc;_0x4445b7=0xc8;}else{_0x4445b7=0xce;}_0x768ba5[_0x6f20('0x2e')](_0x4445b7);return _0x768ba5[_0x6f20('0x35')](_0x6f20('0x36'),_0x3f4f98+'-'+_0x152269+'/'+_0xe82ccc)[_0x6f20('0x30')](_0x3e5cb5);}return null;};}function patchUpdates(_0xb13108){return function(_0x509f5d){try{jsonpatch['apply'](_0x509f5d,_0xb13108,!![]);}catch(_0x6badc1){return BPromise[_0x6f20('0x37')](_0x6badc1);}return _0x509f5d[_0x6f20('0x38')]();};}function saveUpdates(_0x4bac9e,_0xaf2fd3){return function(_0x319329){if(_0x319329){return _0x319329[_0x6f20('0x39')](_0x4bac9e)[_0x6f20('0x22')](function(_0x98f855){return _0x98f855;});}return null;};}function removeEntity(_0x31b98c,_0x5de225){return function(_0x56be20){if(_0x56be20){return _0x56be20[_0x6f20('0x3a')]()[_0x6f20('0x22')](function(){_0x31b98c[_0x6f20('0x2e')](0xcc)[_0x6f20('0x2f')]();});}};}function handleEntityNotFound(_0x1d0791,_0xa5f888){return function(_0x271aca){if(!_0x271aca){_0x1d0791[_0x6f20('0x2d')](0x194);}return _0x271aca;};}function handleError(_0x2d1b7b,_0x20c538){_0x20c538=_0x20c538||0x1f4;return function(_0x1ed7a1){logger[_0x6f20('0x28')](_0x1ed7a1[_0x6f20('0x3b')]);if(_0x1ed7a1[_0x6f20('0x3c')]){delete _0x1ed7a1[_0x6f20('0x3c')];}_0x2d1b7b[_0x6f20('0x2e')](_0x20c538)[_0x6f20('0x3d')](_0x1ed7a1);};}exports['index']=function(_0x8f3d08,_0x11404f){var _0x2f360e={},_0x4fb54a={},_0x313c0b={'count':0x0,'rows':[]};var _0x3406c4=_[_0x6f20('0x3e')](db['ChatMessage'][_0x6f20('0x3f')],function(_0x58e5b5){return{'name':_0x58e5b5['fieldName'],'type':_0x58e5b5[_0x6f20('0x40')][_0x6f20('0x41')]};});_0x4fb54a['model']=_[_0x6f20('0x3e')](_0x3406c4,_0x6f20('0x3c'));_0x4fb54a[_0x6f20('0x42')]=_[_0x6f20('0x43')](_0x8f3d08['query']);_0x4fb54a[_0x6f20('0x44')]=_[_0x6f20('0x45')](_0x4fb54a[_0x6f20('0x46')],_0x4fb54a[_0x6f20('0x42')]);_0x2f360e[_0x6f20('0x47')]=_[_0x6f20('0x45')](_0x4fb54a[_0x6f20('0x46')],qs[_0x6f20('0x48')](_0x8f3d08[_0x6f20('0x42')][_0x6f20('0x48')]));_0x2f360e[_0x6f20('0x47')]=_0x2f360e[_0x6f20('0x47')][_0x6f20('0x49')]?_0x2f360e[_0x6f20('0x47')]:_0x4fb54a[_0x6f20('0x46')];if(!_0x8f3d08[_0x6f20('0x42')][_0x6f20('0x4a')](_0x6f20('0x4b'))){_0x2f360e[_0x6f20('0x32')]=qs[_0x6f20('0x32')](_0x8f3d08['query'][_0x6f20('0x32')]);_0x2f360e['offset']=qs[_0x6f20('0x31')](_0x8f3d08['query'][_0x6f20('0x31')]);}_0x2f360e[_0x6f20('0x4c')]=qs[_0x6f20('0x4d')](_0x8f3d08[_0x6f20('0x42')][_0x6f20('0x4d')]);_0x2f360e['where']=qs[_0x6f20('0x44')](_['pick'](_0x8f3d08[_0x6f20('0x42')],_0x4fb54a[_0x6f20('0x44')]),_0x3406c4);if(_0x8f3d08[_0x6f20('0x42')][_0x6f20('0x4e')]){_0x2f360e[_0x6f20('0x4f')]=_[_0x6f20('0x50')](_0x2f360e[_0x6f20('0x4f')],{'$or':_[_0x6f20('0x3e')](_0x3406c4,function(_0x5358b7){if(_0x5358b7[_0x6f20('0x40')]!==_0x6f20('0x51')){var _0x3530e7={};_0x3530e7[_0x5358b7[_0x6f20('0x3c')]]={'$like':'%'+_0x8f3d08['query'][_0x6f20('0x4e')]+'%'};return _0x3530e7;}})});}_0x2f360e=_['merge']({},_0x2f360e,_0x8f3d08['options']);var _0x3df2ca={'where':_0x2f360e[_0x6f20('0x4f')]};return db['ChatMessage'][_0x6f20('0x34')](_0x3df2ca)[_0x6f20('0x22')](function(_0x2a9f57){_0x313c0b['count']=_0x2a9f57;if(_0x8f3d08[_0x6f20('0x42')]['includeAll']){_0x2f360e[_0x6f20('0x52')]=[{'all':!![]}];}return db[_0x6f20('0x53')]['findAll'](_0x2f360e);})[_0x6f20('0x22')](function(_0x39f752){_0x313c0b['rows']=_0x39f752;return _0x313c0b;})['then'](respondWithFilteredResult(_0x11404f,_0x2f360e))['catch'](handleError(_0x11404f,null));};exports[_0x6f20('0x54')]=function(_0x32e8fe,_0x1df36c){var _0x3cc972={'raw':!![],'where':{'id':_0x32e8fe[_0x6f20('0x55')]['id']}},_0x152a4d={};_0x152a4d[_0x6f20('0x46')]=_[_0x6f20('0x43')](db['ChatMessage'][_0x6f20('0x3f')]);_0x152a4d['query']=_[_0x6f20('0x43')](_0x32e8fe[_0x6f20('0x42')]);_0x152a4d[_0x6f20('0x44')]=_[_0x6f20('0x45')](_0x152a4d['model'],_0x152a4d[_0x6f20('0x42')]);_0x3cc972['attributes']=_[_0x6f20('0x45')](_0x152a4d[_0x6f20('0x46')],qs[_0x6f20('0x48')](_0x32e8fe[_0x6f20('0x42')][_0x6f20('0x48')]));_0x3cc972['attributes']=_0x3cc972[_0x6f20('0x47')][_0x6f20('0x49')]?_0x3cc972[_0x6f20('0x47')]:_0x152a4d[_0x6f20('0x46')];if(_0x32e8fe[_0x6f20('0x42')][_0x6f20('0x56')]){_0x3cc972['include']=[{'all':!![]}];}_0x3cc972=_['merge']({},_0x3cc972,_0x32e8fe[_0x6f20('0x57')]);return db[_0x6f20('0x53')]['find'](_0x3cc972)[_0x6f20('0x22')](handleEntityNotFound(_0x1df36c,null))[_0x6f20('0x22')](respondWithResult(_0x1df36c,null))[_0x6f20('0x2c')](handleError(_0x1df36c,null));};exports[_0x6f20('0x58')]=function(_0x33da8e,_0x5c0fdd){return db[_0x6f20('0x53')][_0x6f20('0x58')](_0x33da8e[_0x6f20('0x59')],{})[_0x6f20('0x22')](respondWithResult(_0x5c0fdd,0xc9))[_0x6f20('0x2c')](handleError(_0x5c0fdd,null));};exports[_0x6f20('0x39')]=function(_0x1bf062,_0x3a21ef){if(_0x1bf062[_0x6f20('0x59')]['id']){delete _0x1bf062[_0x6f20('0x59')]['id'];}return db[_0x6f20('0x53')][_0x6f20('0x5a')]({'where':{'id':_0x1bf062[_0x6f20('0x55')]['id']}})[_0x6f20('0x22')](handleEntityNotFound(_0x3a21ef,null))[_0x6f20('0x22')](saveUpdates(_0x1bf062['body'],null))[_0x6f20('0x22')](respondWithResult(_0x3a21ef,null))['catch'](handleError(_0x3a21ef,null));};exports['destroy']=function(_0x3ec0c4,_0x54e988){return db[_0x6f20('0x53')][_0x6f20('0x5a')]({'where':{'id':_0x3ec0c4[_0x6f20('0x55')]['id']}})[_0x6f20('0x22')](handleEntityNotFound(_0x54e988,null))['then'](removeEntity(_0x54e988,null))[_0x6f20('0x2c')](handleError(_0x54e988,null));};exports[_0x6f20('0x5b')]=function(_0x611553,_0x547a05){return db[_0x6f20('0x53')][_0x6f20('0x5b')]()[_0x6f20('0x22')](respondWithResult(_0x547a05,null))[_0x6f20('0x2c')](handleError(_0x547a05,null));};var interaction_log=require(_0x6f20('0x5c'))(_0x6f20('0x5d'));exports[_0x6f20('0x5e')]=function(_0x16c51c,_0x5511e3,_0x4376f5){var _0x2fff14={'agent':{},'channel':_0x6f20('0x5f')};if(_0x16c51c[_0x6f20('0x59')]['id']){delete _0x16c51c['body']['id'];}_0x16c51c[_0x6f20('0x59')][_0x6f20('0x60')]=!![];_0x16c51c[_0x6f20('0x59')]['readAt']=moment()[_0x6f20('0x61')](_0x6f20('0x62'));_0x16c51c[_0x6f20('0x59')]['UserId']=_0x16c51c[_0x6f20('0x59')]['UserId']||_0x16c51c[_0x6f20('0x63')]['id'];_0x2fff14[_0x6f20('0x64')]['id']=_0x16c51c[_0x6f20('0x59')][_0x6f20('0x65')];return db[_0x6f20('0x53')]['find']({'where':{'id':_0x16c51c[_0x6f20('0x55')]['id'],'UserId':null}})[_0x6f20('0x22')](handleEntityNotFound(_0x5511e3,null))[_0x6f20('0x22')](saveUpdates(_0x16c51c['body'],null))[_0x6f20('0x22')](function(_0x35afaa){if(_0x35afaa){_0x2fff14['message']=_0x35afaa[_0x6f20('0x66')]({'plain':!![]});return db[_0x6f20('0x67')][_0x6f20('0x5a')]({'where':{'id':_0x35afaa[_0x6f20('0x68')]}});}return null;})[_0x6f20('0x22')](handleEntityNotFound(_0x5511e3,null))[_0x6f20('0x22')](function(_0x39d421){if(_0x39d421){return _0x39d421[_0x6f20('0x39')]({'UserId':_0x16c51c[_0x6f20('0x59')][_0x6f20('0x65')],'read1stAt':_[_0x6f20('0x69')](_0x39d421[_0x6f20('0x6a')])?moment()[_0x6f20('0x61')](_0x6f20('0x62')):undefined});}return null;})[_0x6f20('0x22')](function(_0x2a7be0){if(_0x2a7be0){_0x2fff14[_0x6f20('0x6b')]=_0x2a7be0[_0x6f20('0x66')]({'plain':!![]});interaction_log['info'](_0x6f20('0x6c'),_0x16c51c[_0x6f20('0x63')]['id'],_0x16c51c['user'][_0x6f20('0x3c')],_0x16c51c[_0x6f20('0x63')][_0x6f20('0x6d')],_0x2fff14['interaction']['id'],_0x16c51c['body']?JSON['stringify'](_0x16c51c[_0x6f20('0x59')]):_0x6f20('0x6e'));return respondWithRpcPromise(_0x6f20('0x6f'),_0x6f20('0x70'),_0x2fff14);}return null;})['then'](function(_0x14dd7d){var _0x4fe035=_0x6f20('0x71')+_0x14dd7d['message'][_0x6f20('0x72')];return db[_0x6f20('0x73')]['query'](_0x4fe035,{'type':db['Sequelize'][_0x6f20('0x74')][_0x6f20('0x75')],'raw':!![]})[_0x6f20('0x22')](function(_0x34ac00){return _0x34ac00;});})[_0x6f20('0x22')](function(_0x1b1a77){if(_0x1b1a77){_0x2fff14[_0x6f20('0x2a')][_0x6f20('0x76')]=_0x1b1a77[0x0];if(!_0x16c51c['body'][_0x6f20('0x65')])return;return db[_0x6f20('0x77')][_0x6f20('0x5a')]({'where':{'id':_0x16c51c[_0x6f20('0x59')][_0x6f20('0x65')],'role':_0x6f20('0x64')},'attributes':['id','name',_0x6f20('0x78'),'email',_0x6f20('0x79')],'raw':!![]});}return null;})[_0x6f20('0x22')](function(_0x3b00d8){if(!_0x3b00d8)return null;_0x2fff14[_0x6f20('0x2a')]['agent']=_0x3b00d8;return _0x2fff14;})['then'](function(_0x3bfa2b){if(_0x3bfa2b){if(_0x16c51c[_0x6f20('0x59')][_0x6f20('0x7a')]){_0x2fff14[_0x6f20('0x2a')][_0x6f20('0x7b')]=util['format'](_0x6f20('0x7c'),_0x16c51c[_0x6f20('0x63')][_0x6f20('0x3c')]);_0x2fff14['message']['channel']=_0x2fff14['channel'];_0x2fff14[_0x6f20('0x2a')][_0x6f20('0x7d')]=_0x2fff14[_0x6f20('0x7e')];_0x2fff14[_0x6f20('0x2a')][_0x6f20('0x7f')]='accept';return respondWithRpcPromise(_0x6f20('0x80'),_0x6f20('0x80'),{'event':_0x6f20('0x81'),'message':_[_0x6f20('0x50')](_0x2fff14['message'],JSON[_0x6f20('0x82')](_0x2fff14['interaction'][_0x6f20('0x83')]))},client9002)[_0x6f20('0x22')](function(){return _0x2fff14;});}return _0x2fff14;}return null;})['then'](respondWithResult(_0x5511e3,null))[_0x6f20('0x2c')](handleError(_0x5511e3,null));};var interaction_log=require(_0x6f20('0x5c'))(_0x6f20('0x5d'));exports[_0x6f20('0x37')]=function(_0x4c2316,_0x2634f2,_0xf3a305){var _0x1c007e={'agent':{},'channel':'chat'};if(_0x4c2316[_0x6f20('0x59')]['id']){delete _0x4c2316[_0x6f20('0x59')]['id'];}_0x4c2316[_0x6f20('0x59')][_0x6f20('0x65')]=_0x4c2316[_0x6f20('0x59')][_0x6f20('0x65')]||_0x4c2316[_0x6f20('0x63')]['id'];_0x1c007e[_0x6f20('0x64')]['id']=_0x4c2316[_0x6f20('0x59')][_0x6f20('0x65')];return db[_0x6f20('0x53')][_0x6f20('0x5a')]({'where':{'id':_0x4c2316[_0x6f20('0x55')]['id'],'UserId':null}})[_0x6f20('0x22')](handleEntityNotFound(_0x2634f2,null))[_0x6f20('0x22')](function(_0xae0352){if(_0xae0352){_0x1c007e['message']=_0xae0352[_0x6f20('0x66')]({'plain':!![]});return db[_0x6f20('0x67')][_0x6f20('0x5a')]({'where':{'id':_0xae0352['ChatInteractionId']}});}return null;})[_0x6f20('0x22')](handleEntityNotFound(_0x2634f2,null))[_0x6f20('0x22')](function(_0x352810){if(_0x352810){_0x1c007e[_0x6f20('0x6b')]=_0x352810[_0x6f20('0x66')]({'plain':!![]});interaction_log[_0x6f20('0x23')](_0x6f20('0x84'),_0x4c2316[_0x6f20('0x63')]['id'],_0x4c2316[_0x6f20('0x63')]['name'],_0x4c2316[_0x6f20('0x63')]['role'],_0x1c007e['interaction']['id'],_0x4c2316[_0x6f20('0x59')]?JSON['stringify'](_0x4c2316[_0x6f20('0x59')]):_0x6f20('0x6e'));return respondWithRpcPromise(_0x6f20('0x85'),_0x6f20('0x86'),_0x1c007e);}return null;})[_0x6f20('0x22')](function(_0x328b6d){var _0x33f58a=_0x6f20('0x71')+_0x328b6d[_0x6f20('0x2a')]['ContactId'];return db[_0x6f20('0x73')][_0x6f20('0x42')](_0x33f58a,{'type':db['Sequelize'][_0x6f20('0x74')][_0x6f20('0x75')],'raw':!![]})[_0x6f20('0x22')](function(_0x1c0ace){return _0x1c0ace;});})[_0x6f20('0x22')](function(_0x2df40e){if(_0x2df40e){_0x1c007e[_0x6f20('0x2a')]['contact']=_0x2df40e[0x0];if(!_0x4c2316[_0x6f20('0x59')]['UserId'])return;return db['User'][_0x6f20('0x5a')]({'where':{'id':_0x4c2316['body']['UserId'],'role':'agent'},'attributes':['id',_0x6f20('0x3c'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x6f20('0x22')](function(_0x3bde85){if(!_0x3bde85)return null;_0x1c007e[_0x6f20('0x2a')]['agent']=_0x3bde85;return _0x1c007e;})[_0x6f20('0x22')](function(_0x19a6ac){if(_0x19a6ac){_0x19a6ac[_0x6f20('0x2a')][_0x6f20('0x7b')]=util[_0x6f20('0x61')](_0x6f20('0x7c'),_0x4c2316['user'][_0x6f20('0x3c')]);_0x19a6ac[_0x6f20('0x2a')][_0x6f20('0x7e')]=_0x1c007e[_0x6f20('0x7e')];_0x19a6ac[_0x6f20('0x2a')][_0x6f20('0x7d')]=_0x1c007e[_0x6f20('0x7e')];_0x19a6ac[_0x6f20('0x2a')][_0x6f20('0x7f')]='reject';respondWithRpcPromise(_0x6f20('0x80'),_0x6f20('0x80'),{'event':'rejectmessage','message':_[_0x6f20('0x50')](_0x1c007e[_0x6f20('0x2a')],JSON[_0x6f20('0x82')](_0x1c007e[_0x6f20('0x6b')][_0x6f20('0x83')]))},client9002);return _0x1c007e;}return null;})['then'](respondWithResult(_0x2634f2,null))[_0x6f20('0x2c')](handleError(_0x2634f2,null));}; \ No newline at end of file +var _0x574f=['describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','QueryTypes','User','reject','rejectmessage','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','undefined','count','Content-Range','apply','save','update','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ChatMessage','findAll','rows','params','find','create','body','destroy'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x574f,0xad));var _0xf574=function(_0xfd02f1,_0x47f829){_0xfd02f1=_0xfd02f1-0x0;var _0x9abccd=_0x574f[_0xfd02f1];return _0x9abccd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf574('0x0'));var zipdir=require(_0xf574('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf574('0x2'));var moment=require(_0xf574('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf574('0x4'));var util=require(_0xf574('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf574('0x6'));var fs=require('fs');var fs_extra=require(_0xf574('0x7'));var _=require(_0xf574('0x8'));var squel=require(_0xf574('0x9'));var crypto=require('crypto');var jsforce=require(_0xf574('0xa'));var deskjs=require(_0xf574('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf574('0xc'));var Redis=require(_0xf574('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf574('0xe'));var as=require(_0xf574('0xf'));var hardwareService=require(_0xf574('0x10'));var logger=require(_0xf574('0x11'))('api');var utils=require(_0xf574('0x12'));var config=require(_0xf574('0x13'));var licenseUtil=require(_0xf574('0x14'));var db=require('../../mysqldb')['db'];config[_0xf574('0x15')]=_[_0xf574('0x16')](config['redis'],{'host':_0xf574('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf574('0x15')]));require(_0xf574('0x18'))[_0xf574('0x19')](socket);var jayson=require(_0xf574('0x1a'));var client=jayson[_0xf574('0x1b')][_0xf574('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xf574('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4a36cb,_0x4ce878,_0x42736f,_0x1e04a7){return new BPromise(function(_0x13cd18,_0xc3439b){var _0x252ae8=_0x1e04a7||client;return _0x252ae8['request'](_0x4a36cb,_0x42736f)[_0xf574('0x1d')](function(_0x1d269f){logger[_0xf574('0x1e')](_0xf574('0x1f'),_0x4ce878,_0xf574('0x20'));logger[_0xf574('0x21')](_0xf574('0x22'),_0x4ce878,_0xf574('0x20'),JSON['stringify'](_0x1d269f));if(_0x1d269f[_0xf574('0x23')]){if(_0x1d269f[_0xf574('0x23')][_0xf574('0x24')]===0x1f4){logger[_0xf574('0x23')]('ChatMessage,\x20%s,\x20%s',_0x4ce878,_0x1d269f[_0xf574('0x23')][_0xf574('0x25')]);return _0xc3439b(_0x1d269f[_0xf574('0x23')][_0xf574('0x25')]);}logger[_0xf574('0x23')](_0xf574('0x1f'),_0x4ce878,_0x1d269f[_0xf574('0x23')]['message']);return _0x13cd18(_0x1d269f[_0xf574('0x23')][_0xf574('0x25')]);}else{logger['info'](_0xf574('0x1f'),_0x4ce878,_0xf574('0x20'));_0x13cd18(_0x1d269f[_0xf574('0x26')]['message']);}})[_0xf574('0x27')](function(_0x2fb624){logger[_0xf574('0x23')](_0xf574('0x1f'),_0x4ce878,_0x2fb624);_0xc3439b(_0x2fb624);});});}function respondWithStatusCode(_0x4808fa,_0x34de32){_0x34de32=_0x34de32||0xcc;return function(_0x1a8b16){if(_0x1a8b16){return _0x4808fa['sendStatus'](_0x34de32);}return _0x4808fa[_0xf574('0x28')](_0x34de32)[_0xf574('0x29')]();};}function respondWithResult(_0x381794,_0x549602){_0x549602=_0x549602||0xc8;return function(_0x2e5641){if(_0x2e5641){return _0x381794['status'](_0x549602)[_0xf574('0x2a')](_0x2e5641);}};}function respondWithFilteredResult(_0x135c8f,_0x57b073){return function(_0xc747f6){if(_0xc747f6){var _0x554476=typeof _0x57b073[_0xf574('0x2b')]===_0xf574('0x2c')&&typeof _0x57b073['limit']===_0xf574('0x2c');var _0x3f92d1=_0xc747f6[_0xf574('0x2d')];var _0x3f8bfc=_0x554476?0x0:_0x57b073[_0xf574('0x2b')];var _0x2f7008=_0x554476?_0xc747f6['count']:_0x57b073[_0xf574('0x2b')]+_0x57b073['limit'];var _0x46528f;if(_0x2f7008>=_0x3f92d1){_0x2f7008=_0x3f92d1;_0x46528f=0xc8;}else{_0x46528f=0xce;}_0x135c8f[_0xf574('0x28')](_0x46528f);return _0x135c8f['set'](_0xf574('0x2e'),_0x3f8bfc+'-'+_0x2f7008+'/'+_0x3f92d1)['json'](_0xc747f6);}return null;};}function patchUpdates(_0x4b3ffa){return function(_0x53860b){try{jsonpatch[_0xf574('0x2f')](_0x53860b,_0x4b3ffa,!![]);}catch(_0x44047a){return BPromise['reject'](_0x44047a);}return _0x53860b[_0xf574('0x30')]();};}function saveUpdates(_0x471f89,_0x2e2307){return function(_0x24bbf0){if(_0x24bbf0){return _0x24bbf0[_0xf574('0x31')](_0x471f89)[_0xf574('0x1d')](function(_0x166e90){return _0x166e90;});}return null;};}function removeEntity(_0x2b62f7,_0x5104af){return function(_0x52a4b9){if(_0x52a4b9){return _0x52a4b9['destroy']()[_0xf574('0x1d')](function(){_0x2b62f7[_0xf574('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3e0e5,_0x5f27a2){return function(_0x111e30){if(!_0x111e30){_0xf3e0e5['sendStatus'](0x194);}return _0x111e30;};}function handleError(_0x5c8bf4,_0x51a1c8){_0x51a1c8=_0x51a1c8||0x1f4;return function(_0x1b5c95){logger[_0xf574('0x23')](_0x1b5c95[_0xf574('0x32')]);if(_0x1b5c95[_0xf574('0x33')]){delete _0x1b5c95[_0xf574('0x33')];}_0x5c8bf4[_0xf574('0x28')](_0x51a1c8)[_0xf574('0x34')](_0x1b5c95);};}exports[_0xf574('0x35')]=function(_0x19825e,_0x29029f){var _0x3765d4={},_0xa76a16={},_0x2fac56={'count':0x0,'rows':[]};var _0xbe2dd1=_['map'](db['ChatMessage'][_0xf574('0x36')],function(_0x4069b2){return{'name':_0x4069b2[_0xf574('0x37')],'type':_0x4069b2[_0xf574('0x38')][_0xf574('0x39')]};});_0xa76a16['model']=_[_0xf574('0x3a')](_0xbe2dd1,'name');_0xa76a16[_0xf574('0x3b')]=_[_0xf574('0x3c')](_0x19825e[_0xf574('0x3b')]);_0xa76a16[_0xf574('0x3d')]=_['intersection'](_0xa76a16[_0xf574('0x3e')],_0xa76a16[_0xf574('0x3b')]);_0x3765d4[_0xf574('0x3f')]=_[_0xf574('0x40')](_0xa76a16[_0xf574('0x3e')],qs[_0xf574('0x41')](_0x19825e[_0xf574('0x3b')][_0xf574('0x41')]));_0x3765d4[_0xf574('0x3f')]=_0x3765d4[_0xf574('0x3f')][_0xf574('0x42')]?_0x3765d4[_0xf574('0x3f')]:_0xa76a16[_0xf574('0x3e')];if(!_0x19825e[_0xf574('0x3b')][_0xf574('0x43')]('nolimit')){_0x3765d4['limit']=qs['limit'](_0x19825e['query'][_0xf574('0x44')]);_0x3765d4[_0xf574('0x2b')]=qs[_0xf574('0x2b')](_0x19825e[_0xf574('0x3b')][_0xf574('0x2b')]);}_0x3765d4[_0xf574('0x45')]=qs[_0xf574('0x46')](_0x19825e['query'][_0xf574('0x46')]);_0x3765d4[_0xf574('0x47')]=qs['filters'](_[_0xf574('0x48')](_0x19825e[_0xf574('0x3b')],_0xa76a16['filters']),_0xbe2dd1);if(_0x19825e[_0xf574('0x3b')][_0xf574('0x49')]){_0x3765d4[_0xf574('0x47')]=_[_0xf574('0x4a')](_0x3765d4[_0xf574('0x47')],{'$or':_[_0xf574('0x3a')](_0xbe2dd1,function(_0x15dc3b){if(_0x15dc3b[_0xf574('0x38')]!==_0xf574('0x4b')){var _0x170fa7={};_0x170fa7[_0x15dc3b[_0xf574('0x33')]]={'$like':'%'+_0x19825e[_0xf574('0x3b')][_0xf574('0x49')]+'%'};return _0x170fa7;}})});}_0x3765d4=_['merge']({},_0x3765d4,_0x19825e[_0xf574('0x4c')]);var _0xdcb9d9={'where':_0x3765d4[_0xf574('0x47')]};return db['ChatMessage'][_0xf574('0x2d')](_0xdcb9d9)[_0xf574('0x1d')](function(_0x3e5161){_0x2fac56['count']=_0x3e5161;if(_0x19825e['query'][_0xf574('0x4d')]){_0x3765d4[_0xf574('0x4e')]=[{'all':!![]}];}return db[_0xf574('0x4f')][_0xf574('0x50')](_0x3765d4);})['then'](function(_0x5917e9){_0x2fac56[_0xf574('0x51')]=_0x5917e9;return _0x2fac56;})[_0xf574('0x1d')](respondWithFilteredResult(_0x29029f,_0x3765d4))[_0xf574('0x27')](handleError(_0x29029f,null));};exports['show']=function(_0x254a56,_0x526e34){var _0x18b6b8={'raw':!![],'where':{'id':_0x254a56[_0xf574('0x52')]['id']}},_0x33e90d={};_0x33e90d[_0xf574('0x3e')]=_[_0xf574('0x3c')](db[_0xf574('0x4f')]['rawAttributes']);_0x33e90d['query']=_['keys'](_0x254a56[_0xf574('0x3b')]);_0x33e90d[_0xf574('0x3d')]=_[_0xf574('0x40')](_0x33e90d[_0xf574('0x3e')],_0x33e90d['query']);_0x18b6b8[_0xf574('0x3f')]=_[_0xf574('0x40')](_0x33e90d[_0xf574('0x3e')],qs[_0xf574('0x41')](_0x254a56[_0xf574('0x3b')][_0xf574('0x41')]));_0x18b6b8[_0xf574('0x3f')]=_0x18b6b8['attributes'][_0xf574('0x42')]?_0x18b6b8[_0xf574('0x3f')]:_0x33e90d[_0xf574('0x3e')];if(_0x254a56['query']['includeAll']){_0x18b6b8[_0xf574('0x4e')]=[{'all':!![]}];}_0x18b6b8=_[_0xf574('0x4a')]({},_0x18b6b8,_0x254a56[_0xf574('0x4c')]);return db['ChatMessage'][_0xf574('0x53')](_0x18b6b8)[_0xf574('0x1d')](handleEntityNotFound(_0x526e34,null))['then'](respondWithResult(_0x526e34,null))[_0xf574('0x27')](handleError(_0x526e34,null));};exports['create']=function(_0x1c8406,_0x56621f){return db[_0xf574('0x4f')][_0xf574('0x54')](_0x1c8406[_0xf574('0x55')],{})[_0xf574('0x1d')](respondWithResult(_0x56621f,0xc9))[_0xf574('0x27')](handleError(_0x56621f,null));};exports[_0xf574('0x31')]=function(_0x312d09,_0x5caeef){if(_0x312d09[_0xf574('0x55')]['id']){delete _0x312d09['body']['id'];}return db['ChatMessage']['find']({'where':{'id':_0x312d09[_0xf574('0x52')]['id']}})['then'](handleEntityNotFound(_0x5caeef,null))[_0xf574('0x1d')](saveUpdates(_0x312d09[_0xf574('0x55')],null))[_0xf574('0x1d')](respondWithResult(_0x5caeef,null))[_0xf574('0x27')](handleError(_0x5caeef,null));};exports[_0xf574('0x56')]=function(_0x5fb054,_0x48b64e){return db[_0xf574('0x4f')][_0xf574('0x53')]({'where':{'id':_0x5fb054[_0xf574('0x52')]['id']}})[_0xf574('0x1d')](handleEntityNotFound(_0x48b64e,null))[_0xf574('0x1d')](removeEntity(_0x48b64e,null))['catch'](handleError(_0x48b64e,null));};exports['describe']=function(_0xc32414,_0x50cb31){return db['ChatMessage'][_0xf574('0x57')]()[_0xf574('0x1d')](respondWithResult(_0x50cb31,null))[_0xf574('0x27')](handleError(_0x50cb31,null));};var interaction_log=require(_0xf574('0x11'))(_0xf574('0x58'));exports[_0xf574('0x59')]=function(_0x503f8a,_0x5122a5,_0x1f3919){var _0x22edda={'agent':{},'channel':_0xf574('0x5a')};if(_0x503f8a['body']['id']){delete _0x503f8a[_0xf574('0x55')]['id'];}_0x503f8a[_0xf574('0x55')][_0xf574('0x5b')]=!![];_0x503f8a[_0xf574('0x55')][_0xf574('0x5c')]=moment()[_0xf574('0x5d')](_0xf574('0x5e'));_0x503f8a[_0xf574('0x55')]['UserId']=_0x503f8a[_0xf574('0x55')][_0xf574('0x5f')]||_0x503f8a[_0xf574('0x60')]['id'];_0x22edda[_0xf574('0x61')]['id']=_0x503f8a[_0xf574('0x55')][_0xf574('0x5f')];return db[_0xf574('0x4f')][_0xf574('0x53')]({'where':{'id':_0x503f8a[_0xf574('0x52')]['id'],'UserId':null}})[_0xf574('0x1d')](handleEntityNotFound(_0x5122a5,null))['then'](saveUpdates(_0x503f8a[_0xf574('0x55')],null))['then'](function(_0x5c80d6){if(_0x5c80d6){_0x22edda[_0xf574('0x25')]=_0x5c80d6[_0xf574('0x62')]({'plain':!![]});return db[_0xf574('0x63')][_0xf574('0x53')]({'where':{'id':_0x5c80d6[_0xf574('0x64')]}});}return null;})[_0xf574('0x1d')](handleEntityNotFound(_0x5122a5,null))[_0xf574('0x1d')](function(_0x2419f6){if(_0x2419f6){return _0x2419f6['update']({'UserId':_0x503f8a[_0xf574('0x55')][_0xf574('0x5f')],'read1stAt':_['isNil'](_0x2419f6['read1stAt'])?moment()['format'](_0xf574('0x5e')):undefined});}return null;})['then'](function(_0x458adb){if(_0x458adb){_0x22edda[_0xf574('0x65')]=_0x458adb[_0xf574('0x62')]({'plain':!![]});interaction_log[_0xf574('0x1e')](_0xf574('0x66'),_0x503f8a[_0xf574('0x60')]['id'],_0x503f8a[_0xf574('0x60')][_0xf574('0x33')],_0x503f8a['user']['role'],_0x22edda[_0xf574('0x65')]['id'],_0x503f8a[_0xf574('0x55')]?JSON[_0xf574('0x67')](_0x503f8a[_0xf574('0x55')]):_0xf574('0x68'));return respondWithRpcPromise(_0xf574('0x69'),'acceptMessage',_0x22edda);}return null;})[_0xf574('0x1d')](function(_0x36fdfd){var _0x3ade20=_0xf574('0x6a')+_0x36fdfd[_0xf574('0x25')][_0xf574('0x6b')];return db[_0xf574('0x6c')][_0xf574('0x3b')](_0x3ade20,{'type':db[_0xf574('0x6d')]['QueryTypes'][_0xf574('0x6e')],'raw':!![]})['then'](function(_0x261888){return _0x261888;});})[_0xf574('0x1d')](function(_0x2a3589){if(_0x2a3589){_0x22edda[_0xf574('0x25')][_0xf574('0x6f')]=_0x2a3589[0x0];if(!_0x503f8a[_0xf574('0x55')][_0xf574('0x5f')])return;return db['User'][_0xf574('0x53')]({'where':{'id':_0x503f8a[_0xf574('0x55')][_0xf574('0x5f')],'role':_0xf574('0x61')},'attributes':['id',_0xf574('0x33'),_0xf574('0x70'),'email',_0xf574('0x71')],'raw':!![]});}return null;})[_0xf574('0x1d')](function(_0x392df9){if(!_0x392df9)return null;_0x22edda[_0xf574('0x25')][_0xf574('0x61')]=_0x392df9;return _0x22edda;})[_0xf574('0x1d')](function(_0x51e544){if(_0x51e544){if(_0x503f8a[_0xf574('0x55')][_0xf574('0x72')]){_0x22edda[_0xf574('0x25')][_0xf574('0x73')]=util['format'](_0xf574('0x74'),_0x503f8a[_0xf574('0x60')][_0xf574('0x33')]);_0x22edda[_0xf574('0x25')][_0xf574('0x75')]=_0x22edda[_0xf574('0x75')];_0x22edda['message'][_0xf574('0x76')]=_0x22edda[_0xf574('0x75')];_0x22edda[_0xf574('0x25')][_0xf574('0x77')]=_0xf574('0x59');return respondWithRpcPromise(_0xf574('0x78'),_0xf574('0x78'),{'event':'acceptmessage','message':_[_0xf574('0x4a')](_0x22edda[_0xf574('0x25')],JSON[_0xf574('0x79')](_0x22edda[_0xf574('0x65')][_0xf574('0x7a')]))},client9002)['then'](function(){return _0x22edda;});}return _0x22edda;}return null;})[_0xf574('0x1d')](respondWithResult(_0x5122a5,null))['catch'](handleError(_0x5122a5,null));};var interaction_log=require('../../config/logger')(_0xf574('0x58'));exports['reject']=function(_0x204aae,_0x56703a,_0x292481){var _0x478453={'agent':{},'channel':_0xf574('0x5a')};if(_0x204aae[_0xf574('0x55')]['id']){delete _0x204aae[_0xf574('0x55')]['id'];}_0x204aae[_0xf574('0x55')][_0xf574('0x5f')]=_0x204aae[_0xf574('0x55')][_0xf574('0x5f')]||_0x204aae[_0xf574('0x60')]['id'];_0x478453[_0xf574('0x61')]['id']=_0x204aae['body']['UserId'];return db[_0xf574('0x4f')][_0xf574('0x53')]({'where':{'id':_0x204aae[_0xf574('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x56703a,null))[_0xf574('0x1d')](function(_0x17f172){if(_0x17f172){_0x478453[_0xf574('0x25')]=_0x17f172[_0xf574('0x62')]({'plain':!![]});return db[_0xf574('0x63')][_0xf574('0x53')]({'where':{'id':_0x17f172['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x56703a,null))[_0xf574('0x1d')](function(_0xddd383){if(_0xddd383){_0x478453[_0xf574('0x65')]=_0xddd383[_0xf574('0x62')]({'plain':!![]});interaction_log[_0xf574('0x1e')](_0xf574('0x7b'),_0x204aae[_0xf574('0x60')]['id'],_0x204aae[_0xf574('0x60')]['name'],_0x204aae[_0xf574('0x60')][_0xf574('0x7c')],_0x478453[_0xf574('0x65')]['id'],_0x204aae[_0xf574('0x55')]?JSON[_0xf574('0x67')](_0x204aae[_0xf574('0x55')]):'null');return respondWithRpcPromise(_0xf574('0x7d'),'rejectMessage',_0x478453);}return null;})[_0xf574('0x1d')](function(_0x5add80){var _0x80ad23=_0xf574('0x6a')+_0x5add80[_0xf574('0x25')][_0xf574('0x6b')];return db[_0xf574('0x6c')][_0xf574('0x3b')](_0x80ad23,{'type':db[_0xf574('0x6d')][_0xf574('0x7e')]['SELECT'],'raw':!![]})['then'](function(_0x1d76f1){return _0x1d76f1;});})[_0xf574('0x1d')](function(_0x500edb){if(_0x500edb){_0x478453['message'][_0xf574('0x6f')]=_0x500edb[0x0];if(!_0x204aae[_0xf574('0x55')]['UserId'])return;return db[_0xf574('0x7f')][_0xf574('0x53')]({'where':{'id':_0x204aae['body'][_0xf574('0x5f')],'role':_0xf574('0x61')},'attributes':['id',_0xf574('0x33'),_0xf574('0x70'),'email',_0xf574('0x71')],'raw':!![]});}return null;})['then'](function(_0x4a7ab7){if(!_0x4a7ab7)return null;_0x478453[_0xf574('0x25')]['agent']=_0x4a7ab7;return _0x478453;})[_0xf574('0x1d')](function(_0x32db61){if(_0x32db61){_0x32db61['message'][_0xf574('0x73')]=util[_0xf574('0x5d')](_0xf574('0x74'),_0x204aae[_0xf574('0x60')][_0xf574('0x33')]);_0x32db61[_0xf574('0x25')]['channel']=_0x478453[_0xf574('0x75')];_0x32db61[_0xf574('0x25')][_0xf574('0x76')]=_0x478453[_0xf574('0x75')];_0x32db61[_0xf574('0x25')]['event']=_0xf574('0x80');respondWithRpcPromise('EventManager',_0xf574('0x78'),{'event':_0xf574('0x81'),'message':_[_0xf574('0x4a')](_0x478453['message'],JSON[_0xf574('0x79')](_0x478453[_0xf574('0x65')][_0xf574('0x7a')]))},client9002);return _0x478453;}return null;})[_0xf574('0x1d')](respondWithResult(_0x56703a,null))[_0xf574('0x27')](handleError(_0x56703a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b0e748c..4474e75 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 _0x26c8=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x59273d,_0x59bee7){var _0x5b01a5=function(_0x5f5c40){while(--_0x5f5c40){_0x59273d['push'](_0x59273d['shift']());}};_0x5b01a5(++_0x59bee7);}(_0x26c8,0xc2));var _0x826c=function(_0x2f9409,_0x415e5a){_0x2f9409=_0x2f9409-0x0;var _0x2739bb=_0x26c8[_0x2f9409];return _0x2739bb;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x826c('0x0'))['db'][_0x826c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x826c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x826c('0x3')};function emitEvent(_0x5b2068){return function(_0x448ec4,_0x2e6f43,_0x30ba5c){ChatMessageEvents['emit'](_0x5b2068+':'+_0x448ec4['id'],_0x448ec4);ChatMessageEvents[_0x826c('0x4')](_0x5b2068,_0x448ec4);_0x30ba5c(null);};}for(var e in events){if(events[_0x826c('0x5')](e)){var event=events[e];ChatMessage[_0x826c('0x6')](e,emitEvent(event));}}module[_0x826c('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xf80e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatMessage','setMaxListeners'];(function(_0x127098,_0x3abe9c){var _0x51622d=function(_0x1a754f){while(--_0x1a754f){_0x127098['push'](_0x127098['shift']());}};_0x51622d(++_0x3abe9c);}(_0xf80e,0x1a1));var _0xef80=function(_0x7fb404,_0x35907e){_0x7fb404=_0x7fb404-0x0;var _0x14d9c1=_0xf80e[_0x7fb404];return _0x14d9c1;};'use strict';var EventEmitter=require(_0xef80('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xef80('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xef80('0x2')](0x0);var events={'afterCreate':_0xef80('0x3'),'afterUpdate':_0xef80('0x4'),'afterDestroy':_0xef80('0x5')};function emitEvent(_0x470aff){return function(_0x3559d7,_0x1d928c,_0x3fd4a8){ChatMessageEvents[_0xef80('0x6')](_0x470aff+':'+_0x3559d7['id'],_0x3559d7);ChatMessageEvents['emit'](_0x470aff,_0x3559d7);_0x3fd4a8(null);};}for(var e in events){if(events[_0xef80('0x7')](e)){var event=events[e];ChatMessage[_0xef80('0x8')](e,emitEvent(event));}}module[_0xef80('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 0c5d49a..93216de 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 _0x760c=['then','createdAt','error','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','models','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x4d55a4,_0x26e4c3){var _0x21f49d=function(_0x550913){while(--_0x550913){_0x4d55a4['push'](_0x4d55a4['shift']());}};_0x21f49d(++_0x26e4c3);}(_0x760c,0x1a4));var _0xc760=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x760c[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc760('0x0'))(_0xc760('0x1'));var moment=require(_0xc760('0x2'));var BPromise=require(_0xc760('0x3'));var rp=require(_0xc760('0x4'));var fs=require('fs');var path=require(_0xc760('0x5'));var rimraf=require(_0xc760('0x6'));var config=require(_0xc760('0x7'));var attributes=require(_0xc760('0x8'));module[_0xc760('0x9')]=function(_0x1e09b4,_0xe96839){return _0x1e09b4[_0xc760('0xa')](_0xc760('0xb'),attributes,{'tableName':_0xc760('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x571b99,_0x377fbb,_0x5d4627){var _0x14661d=_0x1e09b4[_0xc760('0xd')];var _0x472d05=_0x571b99[_0xc760('0xe')]({'plain':!![]});if(_0x472d05[_0xc760('0xf')][_0xc760('0x10')]()==='in'||_0x472d05[_0xc760('0xf')][_0xc760('0x10')]()==='out'&&!_0x472d05[_0xc760('0x11')]&&!_['isNil'](_0x472d05[_0xc760('0x12')])){_0x14661d[_0xc760('0x13')][_0xc760('0x14')]({'where':{'id':_0x472d05[_0xc760('0x15')]}})[_0xc760('0x16')](function(_0x1b6e4e){if(_0x1b6e4e){_0x1b6e4e['update']({'lastMsgAt':_0x472d05[_0xc760('0x17')],'lastMsgDirection':_0x472d05['direction'][_0xc760('0x10')]()});}})['catch'](function(_0x363b11){console[_0xc760('0x18')](_0x363b11);});}_0x5d4627();}},'charset':'utf8mb4','collate':_0xc760('0x19')});}; \ No newline at end of file +var _0xcb70=['out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','error','utf8mb4','lodash','util','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase'];(function(_0x43b303,_0x593a4d){var _0x40241c=function(_0x468b97){while(--_0x468b97){_0x43b303['push'](_0x43b303['shift']());}};_0x40241c(++_0x593a4d);}(_0xcb70,0xf3));var _0x0cb7=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xcb70[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x0cb7('0x0'));var util=require(_0x0cb7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0cb7('0x2'));var fs=require('fs');var path=require(_0x0cb7('0x3'));var rimraf=require(_0x0cb7('0x4'));var config=require(_0x0cb7('0x5'));var attributes=require(_0x0cb7('0x6'));module[_0x0cb7('0x7')]=function(_0x19a010,_0x4e5b82){return _0x19a010[_0x0cb7('0x8')](_0x0cb7('0x9'),attributes,{'tableName':_0x0cb7('0xa'),'paranoid':![],'indexes':[{'name':_0x0cb7('0xb'),'fields':[_0x0cb7('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x548cdf,_0xe6479e,_0x475357){var _0x307f2c=_0x19a010[_0x0cb7('0xd')];var _0x559595=_0x548cdf[_0x0cb7('0xe')]({'plain':!![]});if(_0x559595[_0x0cb7('0xf')][_0x0cb7('0x10')]()==='in'||_0x559595['direction'][_0x0cb7('0x10')]()===_0x0cb7('0x11')&&!_0x559595['secret']&&!_[_0x0cb7('0x12')](_0x559595[_0x0cb7('0x13')])){_0x307f2c[_0x0cb7('0x14')][_0x0cb7('0x15')]({'where':{'id':_0x559595[_0x0cb7('0x16')]}})[_0x0cb7('0x17')](function(_0x5ab079){if(_0x5ab079){_0x5ab079['update']({'lastMsgAt':_0x559595['createdAt'],'lastMsgDirection':_0x559595[_0x0cb7('0xf')]['toLowerCase']()});}})['catch'](function(_0x36d903){console[_0x0cb7('0x18')](_0x36d903);});}_0x475357();}},'charset':_0x0cb7('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5ce6d3d..9ebda05 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 _0x9ef8=['catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xc069,_0x3005d6){var _0x3f143c=function(_0x2de702){while(--_0x2de702){_0xc069['push'](_0xc069['shift']());}};_0x3f143c(++_0x3005d6);}(_0x9ef8,0x90));var _0x89ef=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x9ef8[_0x53a7a8];return _0x555f71;};'use strict';var _=require('lodash');var util=require(_0x89ef('0x0'));var moment=require(_0x89ef('0x1'));var BPromise=require(_0x89ef('0x2'));var rs=require(_0x89ef('0x3'));var fs=require('fs');var Redis=require(_0x89ef('0x4'));var db=require(_0x89ef('0x5'))['db'];var utils=require(_0x89ef('0x6'));var logger=require('../../config/logger')(_0x89ef('0x7'));var config=require(_0x89ef('0x8'));var jayson=require(_0x89ef('0x9'));var client=jayson['client'][_0x89ef('0xa')]({'port':0x232a});config[_0x89ef('0xb')]=_[_0x89ef('0xc')](config[_0x89ef('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x89ef('0xd'))(new Redis(config['redis']));require(_0x89ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x3157d8,_0x16da80,_0xa06506){return new BPromise(function(_0x433221,_0x52a1be){return client[_0x89ef('0xf')](_0x3157d8,_0xa06506)[_0x89ef('0x10')](function(_0x304f01){logger[_0x89ef('0x11')](_0x89ef('0x12'),_0x16da80,_0x89ef('0x13'));logger['debug'](_0x89ef('0x14'),_0x16da80,'request\x20sent',JSON[_0x89ef('0x15')](_0x304f01));if(_0x304f01[_0x89ef('0x16')]){if(_0x304f01[_0x89ef('0x16')][_0x89ef('0x17')]===0x1f4){logger[_0x89ef('0x16')]('ChatMessage,\x20%s,\x20%s',_0x16da80,_0x304f01['error']['message']);return _0x52a1be(_0x304f01[_0x89ef('0x16')][_0x89ef('0x18')]);}logger[_0x89ef('0x16')]('ChatMessage,\x20%s,\x20%s',_0x16da80,_0x304f01[_0x89ef('0x16')]['message']);return _0x433221(_0x304f01[_0x89ef('0x16')][_0x89ef('0x18')]);}else{logger[_0x89ef('0x11')](_0x89ef('0x12'),_0x16da80,'request\x20sent');_0x433221(_0x304f01[_0x89ef('0x19')]['message']);}})[_0x89ef('0x1a')](function(_0x5567e8){logger[_0x89ef('0x16')](_0x89ef('0x12'),_0x16da80,_0x5567e8);_0x52a1be(_0x5567e8);});});}exports[_0x89ef('0x1b')]=function(_0x51ae10){var _0x4b5458=this;return new Promise(function(_0x50b84e,_0x1d6f72){return db[_0x89ef('0x1c')][_0x89ef('0x1d')](_0x51ae10[_0x89ef('0x1e')],{'raw':_0x51ae10[_0x89ef('0x1f')]?_0x51ae10[_0x89ef('0x1f')][_0x89ef('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2dbbc7){logger[_0x89ef('0x11')](_0x89ef('0x1b'),_0x51ae10);logger[_0x89ef('0x21')](_0x89ef('0x1b'),_0x51ae10,JSON[_0x89ef('0x15')](_0x2dbbc7));_0x50b84e(_0x2dbbc7);})['catch'](function(_0x16654f){logger[_0x89ef('0x16')](_0x89ef('0x1b'),_0x16654f['message'],_0x51ae10);_0x1d6f72(_0x4b5458[_0x89ef('0x16')](0x1f4,_0x16654f[_0x89ef('0x18')]));});});}; \ No newline at end of file +var _0x4a6d=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','CreateChatMessage','create','body','options','raw','stringify','util'];(function(_0x378c3e,_0x575d76){var _0x17afbf=function(_0x327def){while(--_0x327def){_0x378c3e['push'](_0x378c3e['shift']());}};_0x17afbf(++_0x575d76);}(_0x4a6d,0x121));var _0xd4a6=function(_0x4eda48,_0x234951){_0x4eda48=_0x4eda48-0x0;var _0x38d318=_0x4a6d[_0x4eda48];return _0x38d318;};'use strict';var _=require('lodash');var util=require(_0xd4a6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4a6('0x1'));var fs=require('fs');var Redis=require(_0xd4a6('0x2'));var db=require(_0xd4a6('0x3'))['db'];var utils=require(_0xd4a6('0x4'));var logger=require('../../config/logger')(_0xd4a6('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd4a6('0x6')]({'port':0x232a});config[_0xd4a6('0x7')]=_[_0xd4a6('0x8')](config[_0xd4a6('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4a6('0x7')]));require(_0xd4a6('0x9'))[_0xd4a6('0xa')](socket);function respondWithRpcPromise(_0x23398c,_0x4a3936,_0x2dff38){return new BPromise(function(_0x311731,_0x39e596){return client[_0xd4a6('0xb')](_0x23398c,_0x2dff38)[_0xd4a6('0xc')](function(_0x4f64bf){logger[_0xd4a6('0xd')](_0xd4a6('0xe'),_0x4a3936,'request\x20sent');logger[_0xd4a6('0xf')](_0xd4a6('0x10'),_0x4a3936,_0xd4a6('0x11'),JSON['stringify'](_0x4f64bf));if(_0x4f64bf['error']){if(_0x4f64bf['error'][_0xd4a6('0x12')]===0x1f4){logger[_0xd4a6('0x13')](_0xd4a6('0xe'),_0x4a3936,_0x4f64bf[_0xd4a6('0x13')][_0xd4a6('0x14')]);return _0x39e596(_0x4f64bf['error'][_0xd4a6('0x14')]);}logger[_0xd4a6('0x13')](_0xd4a6('0xe'),_0x4a3936,_0x4f64bf[_0xd4a6('0x13')][_0xd4a6('0x14')]);return _0x311731(_0x4f64bf['error'][_0xd4a6('0x14')]);}else{logger['info'](_0xd4a6('0xe'),_0x4a3936,_0xd4a6('0x11'));_0x311731(_0x4f64bf[_0xd4a6('0x15')][_0xd4a6('0x14')]);}})[_0xd4a6('0x16')](function(_0x2d486d){logger[_0xd4a6('0x13')](_0xd4a6('0xe'),_0x4a3936,_0x2d486d);_0x39e596(_0x2d486d);});});}exports[_0xd4a6('0x17')]=function(_0x3e21d0){var _0x386db0=this;return new Promise(function(_0x1cf715,_0x26625f){return db['ChatMessage'][_0xd4a6('0x18')](_0x3e21d0[_0xd4a6('0x19')],{'raw':_0x3e21d0[_0xd4a6('0x1a')]?_0x3e21d0[_0xd4a6('0x1a')][_0xd4a6('0x1b')]===undefined?!![]:![]:!![]})[_0xd4a6('0xc')](function(_0x3c3e84){logger['info'](_0xd4a6('0x17'),_0x3e21d0);logger[_0xd4a6('0xf')](_0xd4a6('0x17'),_0x3e21d0,JSON[_0xd4a6('0x1c')](_0x3c3e84));_0x1cf715(_0x3c3e84);})[_0xd4a6('0x16')](function(_0x509142){logger[_0xd4a6('0x13')](_0xd4a6('0x17'),_0x509142[_0xd4a6('0x14')],_0x3e21d0);_0x26625f(_0x386db0[_0xd4a6('0x13')](0x1f4,_0x509142['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index aa71d72..7443ef5 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 _0x9a14=['emit','length','chatMessage:','remove','update'];(function(_0x3b330c,_0x471357){var _0xc12852=function(_0xb32aac){while(--_0xb32aac){_0x3b330c['push'](_0x3b330c['shift']());}};_0xc12852(++_0x471357);}(_0x9a14,0xa8));var _0x49a1=function(_0x572414,_0x8eb70c){_0x572414=_0x572414-0x0;var _0x3bcfe6=_0x9a14[_0x572414];return _0x3bcfe6;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x49a1('0x0'),_0x49a1('0x1')];function createListener(_0x10e23c,_0x969076){return function(_0x1efead){_0x969076[_0x49a1('0x2')](_0x10e23c,_0x1efead);};}function removeListener(_0x10de2e,_0x453ecf){return function(){ChatMessageEvents['removeListener'](_0x10de2e,_0x453ecf);};}exports['register']=function(_0x479018){for(var _0x5283aa=0x0,_0x9394fc=events[_0x49a1('0x3')];_0x5283aa<_0x9394fc;_0x5283aa++){var _0x7ef1ba=events[_0x5283aa];var _0x592940=createListener(_0x49a1('0x4')+_0x7ef1ba,_0x479018);ChatMessageEvents['on'](_0x7ef1ba,_0x592940);}}; \ No newline at end of file +var _0x9f5a=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x3723f9,_0x4474ee){var _0x21e427=function(_0x24c501){while(--_0x24c501){_0x3723f9['push'](_0x3723f9['shift']());}};_0x21e427(++_0x4474ee);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x54139a,_0x92d26c){_0x54139a=_0x54139a-0x0;var _0x2099f2=_0x9f5a[_0x54139a];return _0x2099f2;};'use strict';var ChatMessageEvents=require(_0xa9f5('0x0'));var events=[_0xa9f5('0x1'),_0xa9f5('0x2'),_0xa9f5('0x3')];function createListener(_0x546306,_0x4268b0){return function(_0x45e3f5){_0x4268b0[_0xa9f5('0x4')](_0x546306,_0x45e3f5);};}function removeListener(_0x4eeedd,_0x20f51f){return function(){ChatMessageEvents['removeListener'](_0x4eeedd,_0x20f51f);};}exports[_0xa9f5('0x5')]=function(_0x219e89){for(var _0x49e337=0x0,_0x6c040d=events[_0xa9f5('0x6')];_0x49e337<_0x6c040d;_0x49e337++){var _0x3f644f=events[_0x49e337];var _0x1f6c78=createListener(_0xa9f5('0x7')+_0x3f644f,_0x219e89);ChatMessageEvents['on'](_0x3f644f,_0x1f6c78);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 99fd913..c76986d 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 _0x2c30=['Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','/:id/accept','accept','/:id/reject','destroy','util','path'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0x2c30,0x1a2));var _0x02c3=function(_0xc4ae9c,_0x51b2ee){_0xc4ae9c=_0xc4ae9c-0x0;var _0x52076b=_0x2c30[_0xc4ae9c];return _0x52076b;};'use strict';var multer=require('multer');var util=require(_0x02c3('0x0'));var path=require(_0x02c3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x02c3('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x02c3('0x3'));var interaction=require(_0x02c3('0x4'));var config=require('../../config/environment');var controller=require(_0x02c3('0x5'));router[_0x02c3('0x6')]('/',auth['isAuthenticated'](),controller[_0x02c3('0x7')]);router['get'](_0x02c3('0x8'),auth[_0x02c3('0x9')](),controller[_0x02c3('0xa')]);router[_0x02c3('0x6')]('/:id',auth[_0x02c3('0x9')](),controller[_0x02c3('0xb')]);router[_0x02c3('0xc')]('/',auth['isAuthenticated'](),interaction['tracked']('chat','chatmessage:create'),controller[_0x02c3('0xd')]);router[_0x02c3('0xe')](_0x02c3('0xf'),controller['update']);router['put'](_0x02c3('0x10'),auth[_0x02c3('0x9')](),controller[_0x02c3('0x11')]);router[_0x02c3('0xe')](_0x02c3('0x12'),auth[_0x02c3('0x9')](),controller['reject']);router['delete'](_0x02c3('0xf'),auth[_0x02c3('0x9')](),controller[_0x02c3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x71ba=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','post','chat','chatmessage:create','create','put','/:id/accept','accept','reject','delete','multer','path'];(function(_0x4c1714,_0x4754b2){var _0x285e11=function(_0x4edafa){while(--_0x4edafa){_0x4c1714['push'](_0x4c1714['shift']());}};_0x285e11(++_0x4754b2);}(_0x71ba,0x18d));var _0xa71b=function(_0x542a9b,_0x351513){_0x542a9b=_0x542a9b-0x0;var _0x4d5032=_0x71ba[_0x542a9b];return _0x4d5032;};'use strict';var multer=require(_0xa71b('0x0'));var util=require('util');var path=require(_0xa71b('0x1'));var timeout=require(_0xa71b('0x2'));var express=require(_0xa71b('0x3'));var router=express[_0xa71b('0x4')]();var fs_extra=require(_0xa71b('0x5'));var auth=require(_0xa71b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa71b('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xa71b('0x8')](),controller[_0xa71b('0x9')]);router['get']('/describe',auth[_0xa71b('0x8')](),controller['describe']);router[_0xa71b('0xa')](_0xa71b('0xb'),auth[_0xa71b('0x8')](),controller['show']);router[_0xa71b('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xa71b('0xd'),_0xa71b('0xe')),controller[_0xa71b('0xf')]);router[_0xa71b('0x10')](_0xa71b('0xb'),controller['update']);router[_0xa71b('0x10')](_0xa71b('0x11'),auth['isAuthenticated'](),controller[_0xa71b('0x12')]);router['put']('/:id/reject',auth[_0xa71b('0x8')](),controller[_0xa71b('0x13')]);router[_0xa71b('0x14')](_0xa71b('0xb'),auth[_0xa71b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e043b49..8057cb5 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 _0x48d3=['TEXT','medium','sequelize','exports'];(function(_0x1a4d2c,_0xb9426c){var _0x13f152=function(_0x32404b){while(--_0x32404b){_0x1a4d2c['push'](_0x1a4d2c['shift']());}};_0x13f152(++_0xb9426c);}(_0x48d3,0x11a));var _0x348d=function(_0x1f2c5c,_0x2e7b3d){_0x1f2c5c=_0x1f2c5c-0x0;var _0x2e3a9e=_0x48d3[_0x1f2c5c];return _0x2e3a9e;};'use strict';var Sequelize=require(_0x348d('0x0'));module[_0x348d('0x1')]={'body':{'type':Sequelize[_0x348d('0x2')](_0x348d('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x6bdb=['medium','sequelize'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x6bdb,0xaf));var _0xb6bd=function(_0x38b487,_0x1d5d90){_0x38b487=_0x38b487-0x0;var _0x2f9822=_0x6bdb[_0x38b487];return _0x2f9822;};'use strict';var Sequelize=require(_0xb6bd('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xb6bd('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 cd6efb2..9ab9f38 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x7a54,0x106));var _0x47a5=function(_0x52820f,_0x3fc1b3){_0x52820f=_0x52820f-0x0;var _0x658b23=_0x7a54[_0x52820f];return _0x658b23;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x15e932,_0xaec080){_0x15e932=_0x15e932-0x0;var _0x451055=_0x7a54[_0x15e932];return _0x451055;};'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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6baf4eb..ab0b801 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 _0x7c21=['path','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5c1358,_0x270fe2){var _0x2f5850=function(_0x28709a){while(--_0x28709a){_0x5c1358['push'](_0x5c1358['shift']());}};_0x2f5850(++_0x270fe2);}(_0x7c21,0x11e));var _0x17c2=function(_0x82b69d,_0x2b7727){_0x82b69d=_0x82b69d-0x0;var _0x2d322f=_0x7c21[_0x82b69d];return _0x2d322f;};'use strict';var _=require(_0x17c2('0x0'));var util=require('util');var logger=require(_0x17c2('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x17c2('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0x17c2('0x3')]=function(_0x8ae109,_0x21de96){return _0x8ae109['define'](_0x17c2('0x4'),attributes,{'tableName':_0x17c2('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x17c2('0x6'),'collate':_0x17c2('0x7')});}; \ No newline at end of file +var _0xd2e8=['api','moment','request-promise','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x44c35f,_0x255ef4){var _0xfbbbc5=function(_0x3a465f){while(--_0x3a465f){_0x44c35f['push'](_0x44c35f['shift']());}};_0xfbbbc5(++_0x255ef4);}(_0xd2e8,0x142));var _0x8d2e=function(_0x39ec06,_0xa5e032){_0x39ec06=_0x39ec06-0x0;var _0x43c12f=_0xd2e8[_0x39ec06];return _0x43c12f;};'use strict';var _=require('lodash');var util=require(_0x8d2e('0x0'));var logger=require(_0x8d2e('0x1'))(_0x8d2e('0x2'));var moment=require(_0x8d2e('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d2e('0x5'));var attributes=require(_0x8d2e('0x6'));module[_0x8d2e('0x7')]=function(_0x57aa24,_0x144a66){return _0x57aa24[_0x8d2e('0x8')]('ChatOfflineMessage',attributes,{'tableName':_0x8d2e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d2e('0xa'),'collate':_0x8d2e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 052d51c..36d2216 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 _0xda3c=['../../config/logger','../../config/environment','jayson/promise','client','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x85fbb2,_0x55d447){var _0x2c94e5=function(_0x3bd403){while(--_0x3bd403){_0x85fbb2['push'](_0x85fbb2['shift']());}};_0x2c94e5(++_0x55d447);}(_0xda3c,0x79));var _0xcda3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xda3c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xcda3('0x0'));var util=require(_0xcda3('0x1'));var moment=require(_0xcda3('0x2'));var BPromise=require(_0xcda3('0x3'));var rs=require(_0xcda3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcda3('0x5'))('rpc');var config=require(_0xcda3('0x6'));var jayson=require(_0xcda3('0x7'));var client=jayson[_0xcda3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55f028,_0x203e61,_0x35dc9f){return new BPromise(function(_0x1be425,_0x2b122a){return client[_0xcda3('0x9')](_0x55f028,_0x35dc9f)[_0xcda3('0xa')](function(_0x283a0b){logger['info'](_0xcda3('0xb'),_0x203e61,'request\x20sent');logger[_0xcda3('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x203e61,'request\x20sent',JSON[_0xcda3('0xd')](_0x283a0b));if(_0x283a0b[_0xcda3('0xe')]){if(_0x283a0b['error']['code']===0x1f4){logger[_0xcda3('0xe')](_0xcda3('0xb'),_0x203e61,_0x283a0b[_0xcda3('0xe')][_0xcda3('0xf')]);return _0x2b122a(_0x283a0b[_0xcda3('0xe')][_0xcda3('0xf')]);}logger[_0xcda3('0xe')](_0xcda3('0xb'),_0x203e61,_0x283a0b[_0xcda3('0xe')][_0xcda3('0xf')]);return _0x1be425(_0x283a0b[_0xcda3('0xe')][_0xcda3('0xf')]);}else{logger['info'](_0xcda3('0xb'),_0x203e61,'request\x20sent');_0x1be425(_0x283a0b[_0xcda3('0x10')][_0xcda3('0xf')]);}})[_0xcda3('0x11')](function(_0x402fdf){logger[_0xcda3('0xe')](_0xcda3('0xb'),_0x203e61,_0x402fdf);_0x2b122a(_0x402fdf);});});} \ No newline at end of file +var _0xfcb1=['message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x1bb6b4,_0x3e21cc){var _0x54ad97=function(_0x5ad21c){while(--_0x5ad21c){_0x1bb6b4['push'](_0x1bb6b4['shift']());}};_0x54ad97(++_0x3e21cc);}(_0xfcb1,0x134));var _0x1fcb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfcb1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x1fcb('0x0'));var moment=require(_0x1fcb('0x1'));var BPromise=require(_0x1fcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fcb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fcb('0x4'))('rpc');var config=require(_0x1fcb('0x5'));var jayson=require(_0x1fcb('0x6'));var client=jayson[_0x1fcb('0x7')][_0x1fcb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d9c12,_0x5d5e82,_0x4d25fd){return new BPromise(function(_0x23e91a,_0x5ebe1c){return client['request'](_0x5d9c12,_0x4d25fd)[_0x1fcb('0x9')](function(_0x208e10){logger['info'](_0x1fcb('0xa'),_0x5d5e82,'request\x20sent');logger[_0x1fcb('0xb')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5d5e82,_0x1fcb('0xc'),JSON[_0x1fcb('0xd')](_0x208e10));if(_0x208e10['error']){if(_0x208e10[_0x1fcb('0xe')]['code']===0x1f4){logger[_0x1fcb('0xe')](_0x1fcb('0xa'),_0x5d5e82,_0x208e10[_0x1fcb('0xe')][_0x1fcb('0xf')]);return _0x5ebe1c(_0x208e10[_0x1fcb('0xe')][_0x1fcb('0xf')]);}logger[_0x1fcb('0xe')](_0x1fcb('0xa'),_0x5d5e82,_0x208e10[_0x1fcb('0xe')][_0x1fcb('0xf')]);return _0x23e91a(_0x208e10[_0x1fcb('0xe')][_0x1fcb('0xf')]);}else{logger['info'](_0x1fcb('0xa'),_0x5d5e82,'request\x20sent');_0x23e91a(_0x208e10['result'][_0x1fcb('0xf')]);}})[_0x1fcb('0x10')](function(_0x29850d){logger[_0x1fcb('0xe')](_0x1fcb('0xa'),_0x5d5e82,_0x29850d);_0x5ebe1c(_0x29850d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a78eeb1..fda3db8 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 _0xecd4=['show','post','put','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xecd4,0x14b));var _0x4ecd=function(_0x13c453,_0x32e224){_0x13c453=_0x13c453-0x0;var _0x4646a1=_0xecd4[_0x13c453];return _0x4646a1;};'use strict';var multer=require(_0x4ecd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ecd('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x4ecd('0x2'));var interaction=require(_0x4ecd('0x3'));var config=require('../../config/environment');var controller=require(_0x4ecd('0x4'));router[_0x4ecd('0x5')]('/',auth['isAuthenticated'](),controller[_0x4ecd('0x6')]);router[_0x4ecd('0x5')](_0x4ecd('0x7'),auth['isAuthenticated'](),controller[_0x4ecd('0x8')]);router[_0x4ecd('0x5')](_0x4ecd('0x9'),auth[_0x4ecd('0xa')](),controller[_0x4ecd('0xb')]);router[_0x4ecd('0xc')]('/',auth[_0x4ecd('0xa')](),controller['create']);router[_0x4ecd('0xd')](_0x4ecd('0x9'),auth[_0x4ecd('0xa')](),controller[_0x4ecd('0xe')]);router[_0x4ecd('0xf')](_0x4ecd('0x9'),auth['isAuthenticated'](),controller[_0x4ecd('0x10')]);module[_0x4ecd('0x11')]=router; \ No newline at end of file +var _0x7880=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','util','path'];(function(_0x5af565,_0xe531a7){var _0x2a311f=function(_0x59429a){while(--_0x59429a){_0x5af565['push'](_0x5af565['shift']());}};_0x2a311f(++_0xe531a7);}(_0x7880,0x9e));var _0x0788=function(_0xc9671e,_0x5ae235){_0xc9671e=_0xc9671e-0x0;var _0x54957a=_0x7880[_0xc9671e];return _0x54957a;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express['Router']();var fs_extra=require(_0x0788('0x4'));var auth=require(_0x0788('0x5'));var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router['get']('/describe',auth[_0x0788('0xa')](),controller[_0x0788('0xc')]);router['get'](_0x0788('0xd'),auth[_0x0788('0xa')](),controller[_0x0788('0xe')]);router[_0x0788('0xf')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xd'),auth['isAuthenticated'](),controller[_0x0788('0x12')]);router['delete'](_0x0788('0xd'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 112418c..b4e4657 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 _0x1efc=['mouseOver','timeout','INTEGER','sequelize','STRING','ENUM'];(function(_0x31084e,_0x262b63){var _0x51f2f2=function(_0x5e9724){while(--_0x5e9724){_0x31084e['push'](_0x31084e['shift']());}};_0x51f2f2(++_0x262b63);}(_0x1efc,0xcf));var _0xc1ef=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x1efc[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require(_0xc1ef('0x0'));module['exports']={'name':{'type':Sequelize[_0xc1ef('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc1ef('0x2')](_0xc1ef('0x3'),_0xc1ef('0x4')),'defaultValue':_0xc1ef('0x3')},'selector':{'type':Sequelize[_0xc1ef('0x1')]},'timeout':{'type':Sequelize[_0xc1ef('0x5')]}}; \ No newline at end of file +var _0x7435=['INTEGER','sequelize','STRING','ENUM','mouseOver','timeout'];(function(_0x2e2334,_0x8ffa8b){var _0x31991c=function(_0x14c2bd){while(--_0x14c2bd){_0x2e2334['push'](_0x2e2334['shift']());}};_0x31991c(++_0x8ffa8b);}(_0x7435,0x145));var _0x5743=function(_0x425565,_0x4f15e1){_0x425565=_0x425565-0x0;var _0x3db3a9=_0x7435[_0x425565];return _0x3db3a9;};'use strict';var Sequelize=require(_0x5743('0x0'));module['exports']={'name':{'type':Sequelize[_0x5743('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5743('0x2')](_0x5743('0x3'),_0x5743('0x4')),'defaultValue':_0x5743('0x3')},'selector':{'type':Sequelize[_0x5743('0x1')]},'timeout':{'type':Sequelize[_0x5743('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e0ea4ac..d1a8557 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 _0xb5bb=['destroy','error','stack','name','send','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','reject','save','update','then'];(function(_0xdbe02f,_0x2a43af){var _0x12f870=function(_0x557f72){while(--_0x557f72){_0xdbe02f['push'](_0xdbe02f['shift']());}};_0x12f870(++_0x2a43af);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x14c582,_0x5e0a96){_0x14c582=_0x14c582-0x0;var _0x5d6d74=_0xb5bb[_0x14c582];return _0x5d6d74;};'use strict';var emlformat=require(_0xbb5b('0x0'));var rimraf=require(_0xbb5b('0x1'));var zipdir=require(_0xbb5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb5b('0x3'));var moment=require(_0xbb5b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb5b('0x5'));var fs=require('fs');var fs_extra=require(_0xbb5b('0x6'));var _=require('lodash');var squel=require(_0xbb5b('0x7'));var crypto=require(_0xbb5b('0x8'));var jsforce=require(_0xbb5b('0x9'));var deskjs=require(_0xbb5b('0xa'));var toCsv=require(_0xbb5b('0xb'));var querystring=require(_0xbb5b('0xc'));var Papa=require(_0xbb5b('0xd'));var Redis=require(_0xbb5b('0xe'));var authService=require(_0xbb5b('0xf'));var qs=require(_0xbb5b('0x10'));var as=require(_0xbb5b('0x11'));var hardwareService=require(_0xbb5b('0x12'));var logger=require(_0xbb5b('0x13'))(_0xbb5b('0x14'));var utils=require(_0xbb5b('0x15'));var config=require(_0xbb5b('0x16'));var licenseUtil=require(_0xbb5b('0x17'));var db=require(_0xbb5b('0x18'))['db'];function respondWithStatusCode(_0x143cca,_0x116d72){_0x116d72=_0x116d72||0xcc;return function(_0x5c59a3){if(_0x5c59a3){return _0x143cca[_0xbb5b('0x19')](_0x116d72);}return _0x143cca['status'](_0x116d72)[_0xbb5b('0x1a')]();};}function respondWithResult(_0x3efb92,_0x8f9833){_0x8f9833=_0x8f9833||0xc8;return function(_0x85ef08){if(_0x85ef08){return _0x3efb92['status'](_0x8f9833)[_0xbb5b('0x1b')](_0x85ef08);}};}function respondWithFilteredResult(_0x117f6d,_0x2aecf7){return function(_0x60f86d){if(_0x60f86d){var _0x3b2edb=typeof _0x2aecf7['offset']===_0xbb5b('0x1c')&&typeof _0x2aecf7[_0xbb5b('0x1d')]===_0xbb5b('0x1c');var _0x54b6cc=_0x60f86d[_0xbb5b('0x1e')];var _0x3b80df=_0x3b2edb?0x0:_0x2aecf7[_0xbb5b('0x1f')];var _0x1e84fc=_0x3b2edb?_0x60f86d[_0xbb5b('0x1e')]:_0x2aecf7[_0xbb5b('0x1f')]+_0x2aecf7['limit'];var _0x1667f1;if(_0x1e84fc>=_0x54b6cc){_0x1e84fc=_0x54b6cc;_0x1667f1=0xc8;}else{_0x1667f1=0xce;}_0x117f6d[_0xbb5b('0x20')](_0x1667f1);return _0x117f6d[_0xbb5b('0x21')]('Content-Range',_0x3b80df+'-'+_0x1e84fc+'/'+_0x54b6cc)['json'](_0x60f86d);}return null;};}function patchUpdates(_0x3e6e95){return function(_0x388fba){try{jsonpatch['apply'](_0x388fba,_0x3e6e95,!![]);}catch(_0x6e2e21){return BPromise[_0xbb5b('0x22')](_0x6e2e21);}return _0x388fba[_0xbb5b('0x23')]();};}function saveUpdates(_0x265944,_0x5c7dbf){return function(_0x409343){if(_0x409343){return _0x409343[_0xbb5b('0x24')](_0x265944)[_0xbb5b('0x25')](function(_0xcac7e4){return _0xcac7e4;});}return null;};}function removeEntity(_0x536868,_0x4c4971){return function(_0x34ec40){if(_0x34ec40){return _0x34ec40[_0xbb5b('0x26')]()['then'](function(){_0x536868[_0xbb5b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f7057,_0xda7b47){return function(_0x46a501){if(!_0x46a501){_0x3f7057[_0xbb5b('0x19')](0x194);}return _0x46a501;};}function handleError(_0x55b596,_0x4dbbe4){_0x4dbbe4=_0x4dbbe4||0x1f4;return function(_0x5c2ad7){logger[_0xbb5b('0x27')](_0x5c2ad7[_0xbb5b('0x28')]);if(_0x5c2ad7[_0xbb5b('0x29')]){delete _0x5c2ad7['name'];}_0x55b596['status'](_0x4dbbe4)[_0xbb5b('0x2a')](_0x5c2ad7);};}exports['show']=function(_0x364f46,_0x56c71e){var _0x33a9b6={'raw':!![],'where':{'id':_0x364f46['params']['id']}},_0x5d42a8={};_0x5d42a8[_0xbb5b('0x2b')]=_[_0xbb5b('0x2c')](db['ChatProactiveAction'][_0xbb5b('0x2d')]);_0x5d42a8[_0xbb5b('0x2e')]=_[_0xbb5b('0x2c')](_0x364f46[_0xbb5b('0x2e')]);_0x5d42a8['filters']=_['intersection'](_0x5d42a8[_0xbb5b('0x2b')],_0x5d42a8[_0xbb5b('0x2e')]);_0x33a9b6['attributes']=_[_0xbb5b('0x2f')](_0x5d42a8['model'],qs[_0xbb5b('0x30')](_0x364f46[_0xbb5b('0x2e')][_0xbb5b('0x30')]));_0x33a9b6['attributes']=_0x33a9b6[_0xbb5b('0x31')][_0xbb5b('0x32')]?_0x33a9b6[_0xbb5b('0x31')]:_0x5d42a8[_0xbb5b('0x2b')];if(_0x364f46['query'][_0xbb5b('0x33')]){_0x33a9b6[_0xbb5b('0x34')]=[{'all':!![]}];}_0x33a9b6=_[_0xbb5b('0x35')]({},_0x33a9b6,_0x364f46[_0xbb5b('0x36')]);return db['ChatProactiveAction'][_0xbb5b('0x37')](_0x33a9b6)[_0xbb5b('0x25')](handleEntityNotFound(_0x56c71e,null))[_0xbb5b('0x25')](respondWithResult(_0x56c71e,null))['catch'](handleError(_0x56c71e,null));};exports['create']=function(_0x4d24f9,_0x1d4c99){return db['ChatProactiveAction'][_0xbb5b('0x38')](_0x4d24f9[_0xbb5b('0x39')],{})[_0xbb5b('0x25')](respondWithResult(_0x1d4c99,0xc9))[_0xbb5b('0x3a')](handleError(_0x1d4c99,null));};exports[_0xbb5b('0x24')]=function(_0x5a81bb,_0x58915a){if(_0x5a81bb[_0xbb5b('0x39')]['id']){delete _0x5a81bb['body']['id'];}return db['ChatProactiveAction'][_0xbb5b('0x37')]({'where':{'id':_0x5a81bb[_0xbb5b('0x3b')]['id']}})[_0xbb5b('0x25')](handleEntityNotFound(_0x58915a,null))[_0xbb5b('0x25')](saveUpdates(_0x5a81bb['body'],null))[_0xbb5b('0x25')](respondWithResult(_0x58915a,null))[_0xbb5b('0x3a')](handleError(_0x58915a,null));};exports['destroy']=function(_0x56bb98,_0x15252){return db['ChatProactiveAction']['find']({'where':{'id':_0x56bb98['params']['id']}})['then'](handleEntityNotFound(_0x15252,null))[_0xbb5b('0x25')](removeEntity(_0x15252,null))[_0xbb5b('0x3a')](handleError(_0x15252,null));}; \ No newline at end of file +var _0x3248=['query','attributes','fields','length','include','merge','options','find','catch','create','body','destroy','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','params','ChatProactiveAction','keys','intersection','model'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x3248,0x1bc));var _0x8324=function(_0x50f120,_0x4d5691){_0x50f120=_0x50f120-0x0;var _0x238d10=_0x3248[_0x50f120];return _0x238d10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8324('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8324('0x1'));var moment=require(_0x8324('0x2'));var BPromise=require(_0x8324('0x3'));var Mustache=require(_0x8324('0x4'));var util=require(_0x8324('0x5'));var path=require(_0x8324('0x6'));var sox=require('sox');var csv=require(_0x8324('0x7'));var ejs=require(_0x8324('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8324('0x9'));var squel=require(_0x8324('0xa'));var crypto=require(_0x8324('0xb'));var jsforce=require(_0x8324('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8324('0x7'));var querystring=require(_0x8324('0xd'));var Papa=require(_0x8324('0xe'));var Redis=require(_0x8324('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8324('0x10'));var as=require(_0x8324('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8324('0x12'))(_0x8324('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8324('0x14'))['db'];function respondWithStatusCode(_0x24d731,_0x2aa8c1){_0x2aa8c1=_0x2aa8c1||0xcc;return function(_0x3619ec){if(_0x3619ec){return _0x24d731['sendStatus'](_0x2aa8c1);}return _0x24d731[_0x8324('0x15')](_0x2aa8c1)[_0x8324('0x16')]();};}function respondWithResult(_0x3882a4,_0x13a81f){_0x13a81f=_0x13a81f||0xc8;return function(_0x18a6fd){if(_0x18a6fd){return _0x3882a4['status'](_0x13a81f)[_0x8324('0x17')](_0x18a6fd);}};}function respondWithFilteredResult(_0x4651a0,_0x411e41){return function(_0x3b1a18){if(_0x3b1a18){var _0x3f8f66=typeof _0x411e41['offset']===_0x8324('0x18')&&typeof _0x411e41[_0x8324('0x19')]===_0x8324('0x18');var _0x3ea132=_0x3b1a18['count'];var _0x597fef=_0x3f8f66?0x0:_0x411e41['offset'];var _0x4c8531=_0x3f8f66?_0x3b1a18[_0x8324('0x1a')]:_0x411e41[_0x8324('0x1b')]+_0x411e41[_0x8324('0x19')];var _0x111f33;if(_0x4c8531>=_0x3ea132){_0x4c8531=_0x3ea132;_0x111f33=0xc8;}else{_0x111f33=0xce;}_0x4651a0['status'](_0x111f33);return _0x4651a0[_0x8324('0x1c')](_0x8324('0x1d'),_0x597fef+'-'+_0x4c8531+'/'+_0x3ea132)[_0x8324('0x17')](_0x3b1a18);}return null;};}function patchUpdates(_0xbbf8e3){return function(_0x3c2254){try{jsonpatch['apply'](_0x3c2254,_0xbbf8e3,!![]);}catch(_0x43ef2b){return BPromise[_0x8324('0x1e')](_0x43ef2b);}return _0x3c2254[_0x8324('0x1f')]();};}function saveUpdates(_0x4d648b,_0x378451){return function(_0x864bf8){if(_0x864bf8){return _0x864bf8[_0x8324('0x20')](_0x4d648b)[_0x8324('0x21')](function(_0x24e5e3){return _0x24e5e3;});}return null;};}function removeEntity(_0x4d0e92,_0x21c707){return function(_0x351079){if(_0x351079){return _0x351079['destroy']()[_0x8324('0x21')](function(){_0x4d0e92[_0x8324('0x15')](0xcc)[_0x8324('0x16')]();});}};}function handleEntityNotFound(_0x43717d,_0x2c398f){return function(_0x4fc210){if(!_0x4fc210){_0x43717d['sendStatus'](0x194);}return _0x4fc210;};}function handleError(_0x3e5233,_0x3569db){_0x3569db=_0x3569db||0x1f4;return function(_0x3e78f2){logger[_0x8324('0x22')](_0x3e78f2[_0x8324('0x23')]);if(_0x3e78f2[_0x8324('0x24')]){delete _0x3e78f2['name'];}_0x3e5233[_0x8324('0x15')](_0x3569db)['send'](_0x3e78f2);};}exports['show']=function(_0x3f8f4b,_0x3afd87){var _0x28ba63={'raw':!![],'where':{'id':_0x3f8f4b[_0x8324('0x25')]['id']}},_0x2cf245={};_0x2cf245['model']=_['keys'](db[_0x8324('0x26')]['rawAttributes']);_0x2cf245['query']=_[_0x8324('0x27')](_0x3f8f4b['query']);_0x2cf245['filters']=_[_0x8324('0x28')](_0x2cf245[_0x8324('0x29')],_0x2cf245[_0x8324('0x2a')]);_0x28ba63[_0x8324('0x2b')]=_['intersection'](_0x2cf245[_0x8324('0x29')],qs[_0x8324('0x2c')](_0x3f8f4b[_0x8324('0x2a')]['fields']));_0x28ba63[_0x8324('0x2b')]=_0x28ba63[_0x8324('0x2b')][_0x8324('0x2d')]?_0x28ba63['attributes']:_0x2cf245[_0x8324('0x29')];if(_0x3f8f4b[_0x8324('0x2a')]['includeAll']){_0x28ba63[_0x8324('0x2e')]=[{'all':!![]}];}_0x28ba63=_[_0x8324('0x2f')]({},_0x28ba63,_0x3f8f4b[_0x8324('0x30')]);return db[_0x8324('0x26')][_0x8324('0x31')](_0x28ba63)[_0x8324('0x21')](handleEntityNotFound(_0x3afd87,null))[_0x8324('0x21')](respondWithResult(_0x3afd87,null))[_0x8324('0x32')](handleError(_0x3afd87,null));};exports[_0x8324('0x33')]=function(_0x2ac8ca,_0x89f1c5){return db['ChatProactiveAction'][_0x8324('0x33')](_0x2ac8ca[_0x8324('0x34')],{})[_0x8324('0x21')](respondWithResult(_0x89f1c5,0xc9))[_0x8324('0x32')](handleError(_0x89f1c5,null));};exports[_0x8324('0x20')]=function(_0x22ac18,_0xbcc00d){if(_0x22ac18['body']['id']){delete _0x22ac18[_0x8324('0x34')]['id'];}return db[_0x8324('0x26')][_0x8324('0x31')]({'where':{'id':_0x22ac18[_0x8324('0x25')]['id']}})[_0x8324('0x21')](handleEntityNotFound(_0xbcc00d,null))[_0x8324('0x21')](saveUpdates(_0x22ac18[_0x8324('0x34')],null))[_0x8324('0x21')](respondWithResult(_0xbcc00d,null))['catch'](handleError(_0xbcc00d,null));};exports[_0x8324('0x35')]=function(_0x16a48e,_0x3beac9){return db[_0x8324('0x26')][_0x8324('0x31')]({'where':{'id':_0x16a48e[_0x8324('0x25')]['id']}})[_0x8324('0x21')](handleEntityNotFound(_0x3beac9,null))[_0x8324('0x21')](removeEntity(_0x3beac9,null))[_0x8324('0x32')](handleError(_0x3beac9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 171bedb..8b870f4 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 _0xf553=['define','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatProactiveAction.attributes','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf553,0xaa));var _0x3f55=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0xf553[_0x2179f1];return _0x176ec9;};'use strict';var _=require(_0x3f55('0x0'));var util=require(_0x3f55('0x1'));var logger=require(_0x3f55('0x2'))(_0x3f55('0x3'));var moment=require(_0x3f55('0x4'));var BPromise=require(_0x3f55('0x5'));var rp=require(_0x3f55('0x6'));var fs=require('fs');var path=require(_0x3f55('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3f55('0x8'));module[_0x3f55('0x9')]=function(_0x21122d,_0x1993b5){return _0x21122d[_0x3f55('0xa')](_0x3f55('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad7b=['../../config/logger','moment','bluebird','request-promise','path','exports','define','chat_proactive_actions','lodash','util'];(function(_0x87eee5,_0x581852){var _0x17e2dc=function(_0x1122d2){while(--_0x1122d2){_0x87eee5['push'](_0x87eee5['shift']());}};_0x17e2dc(++_0x581852);}(_0xad7b,0x1b6));var _0xbad7=function(_0x1e6c80,_0x3f5af7){_0x1e6c80=_0x1e6c80-0x0;var _0x3c3ec0=_0xad7b[_0x1e6c80];return _0x3c3ec0;};'use strict';var _=require(_0xbad7('0x0'));var util=require(_0xbad7('0x1'));var logger=require(_0xbad7('0x2'))('api');var moment=require(_0xbad7('0x3'));var BPromise=require(_0xbad7('0x4'));var rp=require(_0xbad7('0x5'));var fs=require('fs');var path=require(_0xbad7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xbad7('0x7')]=function(_0x1c2e4c,_0x2f3711){return _0x1c2e4c[_0xbad7('0x8')]('ChatProactiveAction',attributes,{'tableName':_0xbad7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index de83350..a4e672c 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 _0xa87e=['client','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x432324,_0x3e5677){var _0x2b2267=function(_0x46376a){while(--_0x46376a){_0x432324['push'](_0x432324['shift']());}};_0x2b2267(++_0x3e5677);}(_0xa87e,0x173));var _0xea87=function(_0x17677d,_0xc4fc91){_0x17677d=_0x17677d-0x0;var _0xe4def2=_0xa87e[_0x17677d];return _0xe4def2;};'use strict';var _=require('lodash');var util=require(_0xea87('0x0'));var moment=require(_0xea87('0x1'));var BPromise=require(_0xea87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea87('0x3'));var db=require(_0xea87('0x4'))['db'];var utils=require(_0xea87('0x5'));var logger=require(_0xea87('0x6'))(_0xea87('0x7'));var config=require('../../config/environment');var jayson=require(_0xea87('0x8'));var client=jayson[_0xea87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3c3a,_0x1b566a,_0x36352b){return new BPromise(function(_0xd0dd3b,_0xa7d4f){return client['request'](_0x2f3c3a,_0x36352b)[_0xea87('0xa')](function(_0x1ea786){logger['info'](_0xea87('0xb'),_0x1b566a,_0xea87('0xc'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1b566a,_0xea87('0xc'),JSON[_0xea87('0xd')](_0x1ea786));if(_0x1ea786[_0xea87('0xe')]){if(_0x1ea786[_0xea87('0xe')][_0xea87('0xf')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1b566a,_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);return _0xa7d4f(_0x1ea786['error'][_0xea87('0x10')]);}logger[_0xea87('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x1b566a,_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);return _0xd0dd3b(_0x1ea786[_0xea87('0xe')][_0xea87('0x10')]);}else{logger[_0xea87('0x11')](_0xea87('0xb'),_0x1b566a,'request\x20sent');_0xd0dd3b(_0x1ea786[_0xea87('0x12')][_0xea87('0x10')]);}})['catch'](function(_0x22b62d){logger[_0xea87('0xe')](_0xea87('0xb'),_0x1b566a,_0x22b62d);_0xa7d4f(_0x22b62d);});});} \ No newline at end of file +var _0x81dc=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x25f3cd,_0xbbecb9){var _0x3d790e=function(_0x305a26){while(--_0x305a26){_0x25f3cd['push'](_0x25f3cd['shift']());}};_0x3d790e(++_0xbbecb9);}(_0x81dc,0x13b));var _0xc81d=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0x81dc[_0x25bca6];return _0x3f8d02;};'use strict';var _=require(_0xc81d('0x0'));var util=require(_0xc81d('0x1'));var moment=require(_0xc81d('0x2'));var BPromise=require(_0xc81d('0x3'));var rs=require(_0xc81d('0x4'));var fs=require('fs');var Redis=require(_0xc81d('0x5'));var db=require(_0xc81d('0x6'))['db'];var utils=require(_0xc81d('0x7'));var logger=require(_0xc81d('0x8'))(_0xc81d('0x9'));var config=require(_0xc81d('0xa'));var jayson=require(_0xc81d('0xb'));var client=jayson['client'][_0xc81d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x522fb5,_0x4e447b,_0x1fd9e0){return new BPromise(function(_0x478ba6,_0x1cbfed){return client[_0xc81d('0xd')](_0x522fb5,_0x1fd9e0)['then'](function(_0xf41052){logger['info'](_0xc81d('0xe'),_0x4e447b,_0xc81d('0xf'));logger[_0xc81d('0x10')](_0xc81d('0x11'),_0x4e447b,_0xc81d('0xf'),JSON['stringify'](_0xf41052));if(_0xf41052[_0xc81d('0x12')]){if(_0xf41052[_0xc81d('0x12')]['code']===0x1f4){logger[_0xc81d('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x4e447b,_0xf41052['error'][_0xc81d('0x13')]);return _0x1cbfed(_0xf41052[_0xc81d('0x12')][_0xc81d('0x13')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4e447b,_0xf41052[_0xc81d('0x12')][_0xc81d('0x13')]);return _0x478ba6(_0xf41052['error']['message']);}else{logger['info'](_0xc81d('0xe'),_0x4e447b,_0xc81d('0xf'));_0x478ba6(_0xf41052[_0xc81d('0x14')][_0xc81d('0x13')]);}})[_0xc81d('0x15')](function(_0x2d37e8){logger[_0xc81d('0x12')](_0xc81d('0xe'),_0x4e447b,_0x2d37e8);_0x1cbfed(_0x2d37e8);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2fb0b83..eb01ab9 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x4611d3,_0x1148fe){var _0x4b6718=function(_0x379c3b){while(--_0x379c3b){_0x4611d3['push'](_0x4611d3['shift']());}};_0x4b6718(++_0x1148fe);}(_0x55ca,0x126));var _0xa55c=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x55ca[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file +var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x23db2c,_0x2dfb6c){var _0x1146fa=function(_0x239c1f){while(--_0x239c1f){_0x23db2c['push'](_0x23db2c['shift']());}};_0x1146fa(++_0x2dfb6c);}(_0xeda8,0x104));var _0x8eda=function(_0x3c95cb,_0x4b60ca){_0x3c95cb=_0x3c95cb-0x0;var _0x4baff8=_0xeda8[_0x3c95cb];return _0x4baff8;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('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 894e8d2..1793933 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 _0xd94f=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x527a53,_0x3265d6){var _0x2332f5=function(_0x3b2d90){while(--_0x3b2d90){_0x527a53['push'](_0x527a53['shift']());}};_0x2332f5(++_0x3265d6);}(_0xd94f,0x153));var _0xfd94=function(_0x5b05de,_0x441400){_0x5b05de=_0x5b05de-0x0;var _0x1dbd07=_0xd94f[_0x5b05de];return _0x1dbd07;};'use strict';var Sequelize=require(_0xfd94('0x0'));module[_0xfd94('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd94('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd94('0x3')]},'timeout':{'type':Sequelize[_0xfd94('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd94('0x5')](_0xfd94('0x6'),_0xfd94('0x7'),_0xfd94('0x8'))}}; \ No newline at end of file +var _0xf5a0=['INTEGER','rrmemory','roundrobin','exports','STRING'];(function(_0x5ecb86,_0x344ab3){var _0x752b59=function(_0x3dc7de){while(--_0x3dc7de){_0x5ecb86['push'](_0x5ecb86['shift']());}};_0x752b59(++_0x344ab3);}(_0xf5a0,0x1b6));var _0x0f5a=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xf5a0[_0x29d6e6];return _0xc75ff0;};'use strict';var Sequelize=require('sequelize');module[_0x0f5a('0x0')]={'name':{'type':Sequelize[_0x0f5a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0f5a('0x1')]},'timeout':{'type':Sequelize[_0x0f5a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0f5a('0x3'),'beepall',_0x0f5a('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b7c0630..1cea058 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 _0x6b80=['where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','options','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','sendStatus','stack','name','send','ChatQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b80,0x177));var _0x06b8=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x6b80[_0x31991b];return _0x307304;};'use strict';var emlformat=require(_0x06b8('0x0'));var rimraf=require(_0x06b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b8('0x2'));var rp=require('request-promise');var moment=require(_0x06b8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x06b8('0x4'));var util=require(_0x06b8('0x5'));var path=require(_0x06b8('0x6'));var sox=require(_0x06b8('0x7'));var csv=require(_0x06b8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x06b8('0x9'));var _=require(_0x06b8('0xa'));var squel=require(_0x06b8('0xb'));var crypto=require('crypto');var jsforce=require(_0x06b8('0xc'));var deskjs=require(_0x06b8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x06b8('0xe'));var Papa=require(_0x06b8('0xf'));var Redis=require(_0x06b8('0x10'));var authService=require(_0x06b8('0x11'));var qs=require(_0x06b8('0x12'));var as=require(_0x06b8('0x13'));var hardwareService=require(_0x06b8('0x14'));var logger=require(_0x06b8('0x15'))(_0x06b8('0x16'));var utils=require(_0x06b8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x06b8('0x18'));var db=require(_0x06b8('0x19'))['db'];config[_0x06b8('0x1a')]=_[_0x06b8('0x1b')](config[_0x06b8('0x1a')],{'host':_0x06b8('0x1c'),'port':0x18eb});var socket=require(_0x06b8('0x1d'))(new Redis(config['redis']));require(_0x06b8('0x1e'))['register'](socket);var jayson=require(_0x06b8('0x1f'));var client=jayson['client'][_0x06b8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5f5061,_0x394302,_0x3ff441,_0x209828){return new BPromise(function(_0x2d3d09,_0x4a8cdf){var _0x20c34a=_0x209828||client;return _0x20c34a[_0x06b8('0x21')](_0x5f5061,_0x3ff441)[_0x06b8('0x22')](function(_0x3d89f4){logger[_0x06b8('0x23')](_0x06b8('0x24'),_0x394302,_0x06b8('0x25'));logger['debug'](_0x06b8('0x26'),_0x394302,_0x06b8('0x25'),JSON['stringify'](_0x3d89f4));if(_0x3d89f4[_0x06b8('0x27')]){if(_0x3d89f4[_0x06b8('0x27')]['code']===0x1f4){logger[_0x06b8('0x27')]('ChatQueue,\x20%s,\x20%s',_0x394302,_0x3d89f4[_0x06b8('0x27')]['message']);return _0x4a8cdf(_0x3d89f4[_0x06b8('0x27')][_0x06b8('0x28')]);}logger[_0x06b8('0x27')]('ChatQueue,\x20%s,\x20%s',_0x394302,_0x3d89f4['error'][_0x06b8('0x28')]);return _0x2d3d09(_0x3d89f4['error'][_0x06b8('0x28')]);}else{logger[_0x06b8('0x23')]('ChatQueue,\x20%s,\x20%s',_0x394302,_0x06b8('0x25'));_0x2d3d09(_0x3d89f4['result'][_0x06b8('0x28')]);}})[_0x06b8('0x29')](function(_0x2a9861){logger[_0x06b8('0x27')](_0x06b8('0x24'),_0x394302,_0x2a9861);_0x4a8cdf(_0x2a9861);});});}function respondWithStatusCode(_0x56422f,_0x3db07a){_0x3db07a=_0x3db07a||0xcc;return function(_0x416fa9){if(_0x416fa9){return _0x56422f['sendStatus'](_0x3db07a);}return _0x56422f['status'](_0x3db07a)['end']();};}function respondWithResult(_0x572fc,_0xeba19d){_0xeba19d=_0xeba19d||0xc8;return function(_0xd06aef){if(_0xd06aef){return _0x572fc[_0x06b8('0x2a')](_0xeba19d)[_0x06b8('0x2b')](_0xd06aef);}};}function respondWithFilteredResult(_0x1fd96f,_0x1be90b){return function(_0x118348){if(_0x118348){var _0x5e6515=typeof _0x1be90b['offset']===_0x06b8('0x2c')&&typeof _0x1be90b[_0x06b8('0x2d')]===_0x06b8('0x2c');var _0x5f37fe=_0x118348[_0x06b8('0x2e')];var _0x3dbbe9=_0x5e6515?0x0:_0x1be90b[_0x06b8('0x2f')];var _0x4b3b6a=_0x5e6515?_0x118348[_0x06b8('0x2e')]:_0x1be90b[_0x06b8('0x2f')]+_0x1be90b[_0x06b8('0x2d')];var _0x205ae3;if(_0x4b3b6a>=_0x5f37fe){_0x4b3b6a=_0x5f37fe;_0x205ae3=0xc8;}else{_0x205ae3=0xce;}_0x1fd96f[_0x06b8('0x2a')](_0x205ae3);return _0x1fd96f[_0x06b8('0x30')]('Content-Range',_0x3dbbe9+'-'+_0x4b3b6a+'/'+_0x5f37fe)[_0x06b8('0x2b')](_0x118348);}return null;};}function patchUpdates(_0x560f63){return function(_0x27f564){try{jsonpatch[_0x06b8('0x31')](_0x27f564,_0x560f63,!![]);}catch(_0x3080ef){return BPromise[_0x06b8('0x32')](_0x3080ef);}return _0x27f564[_0x06b8('0x33')]();};}function saveUpdates(_0x56df4b,_0x2d0a98){return function(_0x68d52e){if(_0x68d52e){return _0x68d52e[_0x06b8('0x34')](_0x56df4b)[_0x06b8('0x22')](function(_0x30c895){return _0x30c895;});}return null;};}function removeEntity(_0x3a6a9d,_0x2f9f95){return function(_0x47ae2b){if(_0x47ae2b){return _0x47ae2b[_0x06b8('0x35')]()[_0x06b8('0x22')](function(){var _0x5bd5e1=_0x47ae2b[_0x06b8('0x36')]({'plain':!![]});var _0x42bf8a=_0x06b8('0x37');return db[_0x06b8('0x38')][_0x06b8('0x35')]({'where':{'type':_0x42bf8a,'resourceId':_0x5bd5e1['id']}})[_0x06b8('0x22')](function(){return _0x47ae2b;});})[_0x06b8('0x22')](function(){_0x3a6a9d[_0x06b8('0x2a')](0xcc)[_0x06b8('0x39')]();});}};}function handleEntityNotFound(_0x3a47ae,_0x34ecaa){return function(_0x245fa9){if(!_0x245fa9){_0x3a47ae[_0x06b8('0x3a')](0x194);}return _0x245fa9;};}function handleError(_0x500fb1,_0x4e1b1c){_0x4e1b1c=_0x4e1b1c||0x1f4;return function(_0x53f429){logger['error'](_0x53f429[_0x06b8('0x3b')]);if(_0x53f429[_0x06b8('0x3c')]){delete _0x53f429['name'];}_0x500fb1[_0x06b8('0x2a')](_0x4e1b1c)[_0x06b8('0x3d')](_0x53f429);};}exports['index']=function(_0x2330d1,_0x4f9441){var _0x290cae={},_0x630f68={},_0x54adf7={'count':0x0,'rows':[]};var _0x5f1159=_['map'](db[_0x06b8('0x3e')][_0x06b8('0x3f')],function(_0x91b9f4){return{'name':_0x91b9f4[_0x06b8('0x40')],'type':_0x91b9f4['type'][_0x06b8('0x41')]};});_0x630f68[_0x06b8('0x42')]=_[_0x06b8('0x43')](_0x5f1159,_0x06b8('0x3c'));_0x630f68[_0x06b8('0x44')]=_[_0x06b8('0x45')](_0x2330d1[_0x06b8('0x44')]);_0x630f68['filters']=_[_0x06b8('0x46')](_0x630f68[_0x06b8('0x42')],_0x630f68[_0x06b8('0x44')]);_0x290cae[_0x06b8('0x47')]=_[_0x06b8('0x46')](_0x630f68[_0x06b8('0x42')],qs[_0x06b8('0x48')](_0x2330d1[_0x06b8('0x44')]['fields']));_0x290cae[_0x06b8('0x47')]=_0x290cae['attributes'][_0x06b8('0x49')]?_0x290cae[_0x06b8('0x47')]:_0x630f68[_0x06b8('0x42')];if(!_0x2330d1[_0x06b8('0x44')][_0x06b8('0x4a')](_0x06b8('0x4b'))){_0x290cae[_0x06b8('0x2d')]=qs[_0x06b8('0x2d')](_0x2330d1[_0x06b8('0x44')]['limit']);_0x290cae[_0x06b8('0x2f')]=qs[_0x06b8('0x2f')](_0x2330d1[_0x06b8('0x44')][_0x06b8('0x2f')]);}_0x290cae[_0x06b8('0x4c')]=qs[_0x06b8('0x4d')](_0x2330d1['query'][_0x06b8('0x4d')]);_0x290cae['where']=qs[_0x06b8('0x4e')](_[_0x06b8('0x4f')](_0x2330d1[_0x06b8('0x44')],_0x630f68['filters']),_0x5f1159);if(_0x2330d1[_0x06b8('0x44')][_0x06b8('0x50')]){_0x290cae[_0x06b8('0x51')]=_[_0x06b8('0x52')](_0x290cae[_0x06b8('0x51')],{'$or':_[_0x06b8('0x43')](_0x5f1159,function(_0x30161e){if(_0x30161e['type']!==_0x06b8('0x53')){var _0x2ea147={};_0x2ea147[_0x30161e[_0x06b8('0x3c')]]={'$like':'%'+_0x2330d1['query'][_0x06b8('0x50')]+'%'};return _0x2ea147;}})});}_0x290cae=_[_0x06b8('0x52')]({},_0x290cae,_0x2330d1['options']);var _0x4b2050={'where':_0x290cae[_0x06b8('0x51')]};return db[_0x06b8('0x3e')][_0x06b8('0x2e')](_0x4b2050)[_0x06b8('0x22')](function(_0x101c15){_0x54adf7[_0x06b8('0x2e')]=_0x101c15;if(_0x2330d1[_0x06b8('0x44')][_0x06b8('0x54')]){_0x290cae['include']=[{'all':!![]}];}return db[_0x06b8('0x3e')][_0x06b8('0x55')](_0x290cae);})[_0x06b8('0x22')](function(_0x30e411){_0x54adf7[_0x06b8('0x56')]=_0x30e411;return _0x54adf7;})[_0x06b8('0x22')](respondWithFilteredResult(_0x4f9441,_0x290cae))['catch'](handleError(_0x4f9441,null));};exports[_0x06b8('0x57')]=function(_0x52875f,_0x198fe2){var _0x220dca={'raw':!![],'where':{'id':_0x52875f[_0x06b8('0x58')]['id']}},_0x521423={};_0x521423['model']=_[_0x06b8('0x45')](db[_0x06b8('0x3e')][_0x06b8('0x3f')]);_0x521423['query']=_['keys'](_0x52875f['query']);_0x521423['filters']=_[_0x06b8('0x46')](_0x521423[_0x06b8('0x42')],_0x521423[_0x06b8('0x44')]);_0x220dca['attributes']=_[_0x06b8('0x46')](_0x521423[_0x06b8('0x42')],qs[_0x06b8('0x48')](_0x52875f[_0x06b8('0x44')][_0x06b8('0x48')]));_0x220dca[_0x06b8('0x47')]=_0x220dca['attributes'][_0x06b8('0x49')]?_0x220dca[_0x06b8('0x47')]:_0x521423['model'];if(_0x52875f['query'][_0x06b8('0x54')]){_0x220dca[_0x06b8('0x59')]=[{'all':!![]}];}_0x220dca=_['merge']({},_0x220dca,_0x52875f['options']);return db[_0x06b8('0x3e')][_0x06b8('0x5a')](_0x220dca)[_0x06b8('0x22')](handleEntityNotFound(_0x198fe2,null))['then'](respondWithResult(_0x198fe2,null))[_0x06b8('0x29')](handleError(_0x198fe2,null));};exports['create']=function(_0x58862a,_0x1f7123){return db[_0x06b8('0x3e')][_0x06b8('0x5b')](_0x58862a[_0x06b8('0x5c')],{})[_0x06b8('0x22')](function(_0x2a0d25){var _0x4f5b26=_0x58862a[_0x06b8('0x5d')]['get']({'plain':!![]});if(!_0x4f5b26)throw new Error(_0x06b8('0x5e'));if(_0x4f5b26[_0x06b8('0x5f')]==='user'){var _0x46018e=_0x2a0d25[_0x06b8('0x36')]({'plain':!![]});var _0x44c4bf=_0x06b8('0x37');return db[_0x06b8('0x60')][_0x06b8('0x5a')]({'where':{'name':_0x44c4bf,'userProfileId':_0x4f5b26[_0x06b8('0x61')]},'raw':!![]})[_0x06b8('0x22')](function(_0x2fe0a9){if(_0x2fe0a9&&_0x2fe0a9['autoAssociation']===0x0){return db[_0x06b8('0x38')][_0x06b8('0x5b')]({'name':_0x46018e[_0x06b8('0x3c')],'resourceId':_0x46018e['id'],'type':_0x2fe0a9['name'],'sectionId':_0x2fe0a9['id']},{})[_0x06b8('0x22')](function(){return _0x2a0d25;});}else{return _0x2a0d25;}})['catch'](function(_0x1c151f){logger[_0x06b8('0x27')](_0x06b8('0x62'),_0x1c151f);throw _0x1c151f;});}return _0x2a0d25;})[_0x06b8('0x22')](respondWithResult(_0x1f7123,0xc9))['catch'](handleError(_0x1f7123,null));};exports[_0x06b8('0x34')]=function(_0x23f7d2,_0x24eeed){if(_0x23f7d2[_0x06b8('0x5c')]['id']){delete _0x23f7d2[_0x06b8('0x5c')]['id'];}return db[_0x06b8('0x3e')][_0x06b8('0x5a')]({'where':{'id':_0x23f7d2[_0x06b8('0x58')]['id']}})['then'](handleEntityNotFound(_0x24eeed,null))[_0x06b8('0x22')](saveUpdates(_0x23f7d2[_0x06b8('0x5c')],null))[_0x06b8('0x22')](respondWithResult(_0x24eeed,null))[_0x06b8('0x29')](handleError(_0x24eeed,null));};exports[_0x06b8('0x35')]=function(_0x30f7f3,_0x471cd1){return db[_0x06b8('0x3e')][_0x06b8('0x5a')]({'where':{'id':_0x30f7f3[_0x06b8('0x58')]['id']}})[_0x06b8('0x22')](handleEntityNotFound(_0x471cd1,null))['then'](removeEntity(_0x471cd1,null))[_0x06b8('0x29')](handleError(_0x471cd1,null));};exports['describe']=function(_0x35597c,_0xdb72ae){return db['ChatQueue'][_0x06b8('0x63')]()[_0x06b8('0x22')](respondWithResult(_0xdb72ae,null))['catch'](handleError(_0xdb72ae,null));};exports['getMembers']=function(_0x958bb3,_0x57bc23,_0x241030){var _0x31fa66={'raw':!![],'where':{}},_0x4683c3={},_0x1b94b5;return db['ChatQueue'][_0x06b8('0x64')]({'where':{'id':_0x958bb3[_0x06b8('0x58')]['id']}})[_0x06b8('0x22')](handleEntityNotFound(_0x57bc23,null))[_0x06b8('0x22')](function(_0x10be1f){if(_0x10be1f){_0x1b94b5=_0x10be1f[_0x06b8('0x36')]({'plain':!![]});_0x4683c3['model']=_[_0x06b8('0x45')](db['UserChatQueue']['rawAttributes']);_0x4683c3[_0x06b8('0x44')]=_['keys'](_0x958bb3[_0x06b8('0x44')]);_0x4683c3['filters']=_['intersection'](_0x4683c3[_0x06b8('0x42')],_0x4683c3[_0x06b8('0x44')]);_0x31fa66[_0x06b8('0x47')]=_['intersection'](_0x4683c3[_0x06b8('0x42')],qs[_0x06b8('0x48')](_0x958bb3[_0x06b8('0x44')][_0x06b8('0x48')]));_0x31fa66[_0x06b8('0x47')]=_0x31fa66[_0x06b8('0x47')]['length']?_0x31fa66[_0x06b8('0x47')]:_0x4683c3[_0x06b8('0x42')];if(!_0x958bb3['query']['hasOwnProperty'](_0x06b8('0x4b'))){_0x31fa66[_0x06b8('0x2d')]=qs['limit'](_0x958bb3['query'][_0x06b8('0x2d')]);_0x31fa66['offset']=qs[_0x06b8('0x2f')](_0x958bb3[_0x06b8('0x44')][_0x06b8('0x2f')]);}_0x31fa66[_0x06b8('0x4c')]=qs[_0x06b8('0x4d')](_0x958bb3[_0x06b8('0x44')][_0x06b8('0x4d')]);_0x31fa66[_0x06b8('0x51')]=qs[_0x06b8('0x4e')](_[_0x06b8('0x4f')](_0x958bb3[_0x06b8('0x44')],_0x4683c3[_0x06b8('0x4e')]));_0x31fa66['where'][_0x06b8('0x65')]=_0x10be1f['id'];if(_0x958bb3[_0x06b8('0x44')][_0x06b8('0x50')]){_0x31fa66['where']=_[_0x06b8('0x52')](_0x31fa66[_0x06b8('0x51')],{'$or':_['map'](_0x31fa66[_0x06b8('0x47')],function(_0x14434a){var _0x169549={};_0x169549[_0x14434a]={'$like':'%'+_0x958bb3[_0x06b8('0x44')][_0x06b8('0x50')]+'%'};return _0x169549;})});}_0x31fa66=_['merge']({},_0x31fa66,_0x958bb3['options']);return db[_0x06b8('0x66')][_0x06b8('0x55')](_0x31fa66);}})['then'](function(_0xc9563d){if(_0xc9563d){return db[_0x06b8('0x67')][_0x06b8('0x68')]({'where':{'id':_[_0x06b8('0x43')](_0xc9563d,_0x06b8('0x69')),'role':_0x06b8('0x6a')},'attributes':['id',_0x06b8('0x3c'),_0x06b8('0x6b'),_0x06b8('0x6c'),'createdAt']});}})['then'](function(_0x3e6c72){if(_0x3e6c72){return{'count':_0x3e6c72['count'],'rows':_[_0x06b8('0x43')](_0x3e6c72[_0x06b8('0x56')],function(_0x276f0c){return{'membername':_0x276f0c[_0x06b8('0x3c')],'UserId':_0x276f0c['id'],'queue_name':_0x1b94b5['name'],'ChatQueueId':_0x1b94b5['id'],'interface':util[_0x06b8('0x6d')](_0x06b8('0x6e'),_0x06b8('0x6f'),_0x276f0c[_0x06b8('0x3c')]),'penalty':0x0,'paused':_0x276f0c[_0x06b8('0x6b')],'createdAt':_0x276f0c[_0x06b8('0x70')],'updatedAt':_0x276f0c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x06b8('0x22')](respondWithFilteredResult(_0x57bc23,_0x31fa66))['catch'](handleError(_0x57bc23,null));};exports[_0x06b8('0x71')]=function(_0x59366c,_0x20e56c,_0x4500f1){var _0x3c4c4c={};var _0x191926={};var _0x511194;var _0x39828a;return db[_0x06b8('0x3e')]['findOne']({'where':{'id':_0x59366c[_0x06b8('0x58')]['id']}})[_0x06b8('0x22')](handleEntityNotFound(_0x20e56c,null))['then'](function(_0xe2d5eb){if(_0xe2d5eb){_0x511194=_0xe2d5eb;_0x191926[_0x06b8('0x42')]=_[_0x06b8('0x45')](db[_0x06b8('0x72')]['rawAttributes']);_0x191926[_0x06b8('0x44')]=_[_0x06b8('0x45')](_0x59366c[_0x06b8('0x44')]);_0x191926[_0x06b8('0x4e')]=_[_0x06b8('0x46')](_0x191926['model'],_0x191926['query']);_0x3c4c4c[_0x06b8('0x47')]=_['intersection'](_0x191926[_0x06b8('0x42')],qs[_0x06b8('0x48')](_0x59366c[_0x06b8('0x44')][_0x06b8('0x48')]));_0x3c4c4c['attributes']=_0x3c4c4c[_0x06b8('0x47')][_0x06b8('0x49')]?_0x3c4c4c[_0x06b8('0x47')]:_0x191926[_0x06b8('0x42')];_0x3c4c4c[_0x06b8('0x4c')]=qs[_0x06b8('0x4d')](_0x59366c[_0x06b8('0x44')]['sort']);_0x3c4c4c['where']=qs[_0x06b8('0x4e')](_[_0x06b8('0x4f')](_0x59366c[_0x06b8('0x44')],_0x191926[_0x06b8('0x4e')]));if(_0x59366c['query']['filter']){_0x3c4c4c[_0x06b8('0x51')]=_['merge'](_0x3c4c4c[_0x06b8('0x51')],{'$or':_[_0x06b8('0x43')](_0x3c4c4c['attributes'],function(_0xaf9a2f){var _0x119a9b={};_0x119a9b[_0xaf9a2f]={'$like':'%'+_0x59366c['query']['filter']+'%'};return _0x119a9b;})});}_0x3c4c4c=_[_0x06b8('0x52')]({},_0x3c4c4c,_0x59366c[_0x06b8('0x73')]);return _0x511194['getTeams'](_0x3c4c4c);}})['then'](function(_0x276e9c){if(_0x276e9c){_0x39828a=_0x276e9c['length'];if(!_0x59366c[_0x06b8('0x44')]['hasOwnProperty'](_0x06b8('0x4b'))){_0x3c4c4c[_0x06b8('0x2d')]=qs[_0x06b8('0x2d')](_0x59366c[_0x06b8('0x44')][_0x06b8('0x2d')]);_0x3c4c4c[_0x06b8('0x2f')]=qs[_0x06b8('0x2f')](_0x59366c['query']['offset']);}return _0x511194[_0x06b8('0x71')](_0x3c4c4c);}})['then'](function(_0x4c778e){if(_0x4c778e){return _0x4c778e?{'count':_0x39828a,'rows':_0x4c778e}:null;}})['then'](respondWithResult(_0x20e56c,null))['catch'](handleError(_0x20e56c,null));};exports['addTeams']=function(_0x282199,_0x4b9529,_0x1c1e34){var _0x61f76d=_0x282199[_0x06b8('0x5c')][_0x06b8('0x74')];return db[_0x06b8('0x72')][_0x06b8('0x55')]({'where':{'id':_0x61f76d},'attributes':['id'],'include':[{'model':db[_0x06b8('0x67')],'as':_0x06b8('0x75'),'attributes':['id',_0x06b8('0x3c'),_0x06b8('0x76'),_0x06b8('0x77'),_0x06b8('0x78')],'raw':!![]}]})[_0x06b8('0x22')](function(_0xd2afcf){if(_0xd2afcf){var _0x47c600=_[_0x06b8('0x79')](_0xd2afcf,function(_0x926e8c){var _0xeec710=_0x926e8c[_0x06b8('0x36')]({'plain':!![]});return _0xeec710[_0x06b8('0x75')];});return db[_0x06b8('0x3e')][_0x06b8('0x5a')]({'where':{'id':_0x282199[_0x06b8('0x58')]['id']}})[_0x06b8('0x22')](function(_0xaca93d){return db['sequelize'][_0x06b8('0x7a')](function(_0x3b57ed){return _0xaca93d['addTeams'](_0x61f76d,{'transaction':_0x3b57ed})[_0x06b8('0x22')](function(){return BPromise[_0x06b8('0x7b')](_0x47c600,function(_0x1cfd4e){return db['UserChatQueue'][_0x06b8('0x7c')]({'where':{'UserId':_0x1cfd4e['id'],'ChatQueueId':_0x282199[_0x06b8('0x58')]['id']},'transaction':_0x3b57ed});});})[_0x06b8('0x22')](function(){_0x47c600['forEach'](function(_0x5830b1){socket[_0x06b8('0x7d')]('userChatQueue:save',{'UserId':_0x5830b1['id'],'ChatQueueId':_0xaca93d['id']});});});});});}})[_0x06b8('0x22')](respondWithStatusCode(_0x4b9529,null))[_0x06b8('0x29')](handleError(_0x4b9529,null));};exports[_0x06b8('0x7e')]=function(_0x4c7be4,_0xfb9410,_0xa25fbf){return db[_0x06b8('0x72')][_0x06b8('0x55')]({'where':{'id':_0x4c7be4[_0x06b8('0x44')][_0x06b8('0x74')]},'attributes':['id'],'include':[{'model':db[_0x06b8('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xfb9410,null))['then'](function(_0x2ff863){var _0x53744c=_[_0x06b8('0x43')](_0x2ff863,'id');var _0x15d050=[];var _0x525699=[];var _0x2afb05=squel['select']();_0x2afb05['field'](_0x06b8('0x7f'))[_0x06b8('0x80')](_0x06b8('0x81'),'tq')[_0x06b8('0x82')]('user_has_teams','ut',_0x06b8('0x83'))[_0x06b8('0x51')](_0x06b8('0x84'),_0x4c7be4[_0x06b8('0x58')]['id']);for(var _0x56fce0=0x0;_0x56fce0<_0x2ff863[_0x06b8('0x49')];_0x56fce0+=0x1){let _0x43af68=_0x2ff863[_0x56fce0];for(var _0x183610=0x0;_0x183610<_0x43af68[_0x06b8('0x75')][_0x06b8('0x49')];_0x183610+=0x1){let _0x2c47d8=_0x43af68['Agents'][_0x183610];var _0x293450=_0x2afb05[_0x06b8('0x85')]();_0x293450[_0x06b8('0x51')](_0x06b8('0x86'),_0x2c47d8['id']);_0x525699[_0x06b8('0x87')](db[_0x06b8('0x88')]['query'](_0x293450['toString'](),{'type':db[_0x06b8('0x88')]['QueryTypes'][_0x06b8('0x89')]})['then'](function(_0xa4387c){if(_0xa4387c['length']===0x1){return _0x2c47d8['id'];}else{var _0x514ea5=_[_0x06b8('0x8a')](_[_0x06b8('0x43')](_0xa4387c,_0x06b8('0x8b')),function(_0x35bf3b){return _[_0x06b8('0x8c')](_0x53744c,_0x35bf3b);});if(_0x514ea5){return _0x2c47d8['id'];}}}));}}return BPromise[_0x06b8('0x8d')](_0x525699)[_0x06b8('0x22')](function(_0x446c68){_0x15d050=_(_0x15d050)['union'](_0x446c68)[_0x06b8('0x8e')]()[_0x06b8('0x8f')]();return db[_0x06b8('0x3e')][_0x06b8('0x5a')]({'where':{'id':_0x4c7be4[_0x06b8('0x58')]['id']}})[_0x06b8('0x22')](function(_0x51bf1a){return db[_0x06b8('0x88')][_0x06b8('0x7a')](function(_0x509bcf){return _0x51bf1a[_0x06b8('0x7e')](_0x4c7be4[_0x06b8('0x44')][_0x06b8('0x74')],{'transaction':_0x509bcf})[_0x06b8('0x22')](function(){if(!_[_0x06b8('0x90')](_0x15d050)){return _0x51bf1a[_0x06b8('0x91')](_0x15d050,{'transaction':_0x509bcf});}})['then'](function(){_0x15d050['forEach'](function(_0x390c0b){socket['emit'](_0x06b8('0x92'),{'UserId':_0x390c0b,'ChatQueueId':_0x51bf1a['id']});});});});});});})['then'](respondWithStatusCode(_0xfb9410,null))['catch'](handleError(_0xfb9410,null));};exports['addAgents']=function(_0x357845,_0x3bc426,_0x5d296e){return db[_0x06b8('0x3e')][_0x06b8('0x5a')]({'where':{'id':_0x357845[_0x06b8('0x58')]['id']}})[_0x06b8('0x22')](handleEntityNotFound(_0x3bc426,null))[_0x06b8('0x22')](function(_0x1e581a){if(_0x1e581a){return _0x1e581a[_0x06b8('0x93')](_0x357845['body'][_0x06b8('0x74')],_[_0x06b8('0x94')](_0x357845[_0x06b8('0x5c')],[_0x06b8('0x74'),'id'])||{})[_0x06b8('0x95')](function(_0x31450a){for(var _0x1aa407=0x0;_0x1aa407<_0x357845[_0x06b8('0x5c')][_0x06b8('0x74')][_0x06b8('0x49')];_0x1aa407+=0x1){socket[_0x06b8('0x7d')]('userChatQueue:save',{'UserId':Number(_0x357845['body'][_0x06b8('0x74')][_0x1aa407]),'ChatQueueId':Number(_0x357845['params']['id'])});}return _0x31450a;});}})[_0x06b8('0x22')](respondWithResult(_0x3bc426,null))[_0x06b8('0x29')](handleError(_0x3bc426,null));};exports[_0x06b8('0x91')]=function(_0x4e4781,_0x233430,_0x4d694a){return db[_0x06b8('0x3e')][_0x06b8('0x5a')]({'where':{'id':_0x4e4781['params']['id']}})[_0x06b8('0x22')](handleEntityNotFound(_0x233430,null))[_0x06b8('0x22')](function(_0x3bc88f){if(_0x3bc88f){return _0x3bc88f[_0x06b8('0x91')](_0x4e4781['query'][_0x06b8('0x74')])['then'](function(){if(_[_0x06b8('0x96')](_0x4e4781[_0x06b8('0x44')]['ids'])){for(var _0xcbbc21=0x0;_0xcbbc21<_0x4e4781[_0x06b8('0x44')][_0x06b8('0x74')]['length'];_0xcbbc21+=0x1){socket[_0x06b8('0x7d')]('userChatQueue:remove',{'UserId':Number(_0x4e4781[_0x06b8('0x44')][_0x06b8('0x74')][_0xcbbc21]),'ChatQueueId':Number(_0x4e4781['params']['id'])});}}else{socket[_0x06b8('0x7d')](_0x06b8('0x92'),{'UserId':Number(_0x4e4781[_0x06b8('0x44')][_0x06b8('0x74')]),'ChatQueueId':Number(_0x4e4781[_0x06b8('0x58')]['id'])});}});}})[_0x06b8('0x22')](respondWithStatusCode(_0x233430,null))['catch'](handleError(_0x233430,null));};exports[_0x06b8('0x97')]=function(_0x31856e,_0x186323,_0x2d0517){var _0x5e8045={};var _0x5b2bfe={};var _0x1e652b;var _0x4ec34d;return db[_0x06b8('0x3e')][_0x06b8('0x64')]({'where':{'id':_0x31856e['params']['id']}})[_0x06b8('0x22')](handleEntityNotFound(_0x186323,null))['then'](function(_0x35df78){if(_0x35df78){_0x1e652b=_0x35df78;_0x5b2bfe[_0x06b8('0x42')]=_[_0x06b8('0x45')](db[_0x06b8('0x67')][_0x06b8('0x3f')]);_0x5b2bfe['query']=_[_0x06b8('0x45')](_0x31856e[_0x06b8('0x44')]);_0x5b2bfe[_0x06b8('0x4e')]=_[_0x06b8('0x46')](_0x5b2bfe[_0x06b8('0x42')],_0x5b2bfe[_0x06b8('0x44')]);_0x5e8045[_0x06b8('0x47')]=_[_0x06b8('0x46')](_0x5b2bfe[_0x06b8('0x42')],qs[_0x06b8('0x48')](_0x31856e[_0x06b8('0x44')][_0x06b8('0x48')]));_0x5e8045[_0x06b8('0x47')]=_0x5e8045[_0x06b8('0x47')][_0x06b8('0x49')]?_0x5e8045[_0x06b8('0x47')]:_0x5b2bfe[_0x06b8('0x42')];_0x5e8045['order']=qs['sort'](_0x31856e[_0x06b8('0x44')][_0x06b8('0x4d')]);_0x5e8045['where']=qs[_0x06b8('0x4e')](_[_0x06b8('0x4f')](_0x31856e[_0x06b8('0x44')],_0x5b2bfe[_0x06b8('0x4e')]));if(_0x31856e[_0x06b8('0x44')][_0x06b8('0x50')]){_0x5e8045[_0x06b8('0x51')]=_[_0x06b8('0x52')](_0x5e8045[_0x06b8('0x51')],{'$or':_['map'](_0x5e8045['attributes'],function(_0x2d1b54){var _0x252ae3={};_0x252ae3[_0x2d1b54]={'$like':'%'+_0x31856e[_0x06b8('0x44')][_0x06b8('0x50')]+'%'};return _0x252ae3;})});}_0x5e8045=_[_0x06b8('0x52')]({},_0x5e8045,_0x31856e[_0x06b8('0x73')]);return _0x1e652b[_0x06b8('0x97')](_0x5e8045);}})[_0x06b8('0x22')](function(_0x3b9cd1){if(_0x3b9cd1){_0x4ec34d=_0x3b9cd1[_0x06b8('0x49')];if(!_0x31856e[_0x06b8('0x44')][_0x06b8('0x4a')](_0x06b8('0x4b'))){_0x5e8045[_0x06b8('0x2d')]=qs[_0x06b8('0x2d')](_0x31856e['query']['limit']);_0x5e8045[_0x06b8('0x2f')]=qs[_0x06b8('0x2f')](_0x31856e['query'][_0x06b8('0x2f')]);}return _0x1e652b[_0x06b8('0x97')](_0x5e8045);}})['then'](function(_0x5562bf){if(_0x5562bf){return _0x5562bf?{'count':_0x4ec34d,'rows':_0x5562bf}:null;}})[_0x06b8('0x22')](respondWithResult(_0x186323,null))['catch'](handleError(_0x186323,null));}; \ No newline at end of file +var _0x1049=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','ChatQueue','includeAll','include','findAll','rows','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','UserChatQueue','nolimit','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread','userChatQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys'];(function(_0x1f2a60,_0x559e9e){var _0x247238=function(_0x1249be){while(--_0x1249be){_0x1f2a60['push'](_0x1f2a60['shift']());}};_0x247238(++_0x559e9e);}(_0x1049,0x17c));var _0x9104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1049[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9104('0x0'));var rimraf=require(_0x9104('0x1'));var zipdir=require(_0x9104('0x2'));var jsonpatch=require(_0x9104('0x3'));var rp=require('request-promise');var moment=require(_0x9104('0x4'));var BPromise=require(_0x9104('0x5'));var Mustache=require('mustache');var util=require(_0x9104('0x6'));var path=require('path');var sox=require(_0x9104('0x7'));var csv=require(_0x9104('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9104('0x9'));var _=require('lodash');var squel=require(_0x9104('0xa'));var crypto=require('crypto');var jsforce=require(_0x9104('0xb'));var deskjs=require(_0x9104('0xc'));var toCsv=require(_0x9104('0x8'));var querystring=require('querystring');var Papa=require(_0x9104('0xd'));var Redis=require('ioredis');var authService=require(_0x9104('0xe'));var qs=require(_0x9104('0xf'));var as=require(_0x9104('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9104('0x11'))(_0x9104('0x12'));var utils=require(_0x9104('0x13'));var config=require(_0x9104('0x14'));var licenseUtil=require(_0x9104('0x15'));var db=require(_0x9104('0x16'))['db'];config[_0x9104('0x17')]=_['defaults'](config[_0x9104('0x17')],{'host':_0x9104('0x18'),'port':0x18eb});var socket=require(_0x9104('0x19'))(new Redis(config[_0x9104('0x17')]));require(_0x9104('0x1a'))[_0x9104('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9104('0x1c')][_0x9104('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5d5d50,_0x3e18f1,_0x100ff6,_0x341d75){return new BPromise(function(_0xbe47f3,_0x45ff9f){var _0x454764=_0x341d75||client;return _0x454764[_0x9104('0x1e')](_0x5d5d50,_0x100ff6)[_0x9104('0x1f')](function(_0x1fb220){logger[_0x9104('0x20')](_0x9104('0x21'),_0x3e18f1,'request\x20sent');logger['debug'](_0x9104('0x22'),_0x3e18f1,'request\x20sent',JSON[_0x9104('0x23')](_0x1fb220));if(_0x1fb220[_0x9104('0x24')]){if(_0x1fb220[_0x9104('0x24')][_0x9104('0x25')]===0x1f4){logger[_0x9104('0x24')](_0x9104('0x21'),_0x3e18f1,_0x1fb220[_0x9104('0x24')][_0x9104('0x26')]);return _0x45ff9f(_0x1fb220['error'][_0x9104('0x26')]);}logger[_0x9104('0x24')](_0x9104('0x21'),_0x3e18f1,_0x1fb220[_0x9104('0x24')]['message']);return _0xbe47f3(_0x1fb220[_0x9104('0x24')][_0x9104('0x26')]);}else{logger['info'](_0x9104('0x21'),_0x3e18f1,_0x9104('0x27'));_0xbe47f3(_0x1fb220[_0x9104('0x28')][_0x9104('0x26')]);}})[_0x9104('0x29')](function(_0x4ec7bf){logger['error'](_0x9104('0x21'),_0x3e18f1,_0x4ec7bf);_0x45ff9f(_0x4ec7bf);});});}function respondWithStatusCode(_0x458a68,_0x246b14){_0x246b14=_0x246b14||0xcc;return function(_0x5f0435){if(_0x5f0435){return _0x458a68[_0x9104('0x2a')](_0x246b14);}return _0x458a68[_0x9104('0x2b')](_0x246b14)[_0x9104('0x2c')]();};}function respondWithResult(_0x38b1b2,_0x4d0b89){_0x4d0b89=_0x4d0b89||0xc8;return function(_0x5eeb28){if(_0x5eeb28){return _0x38b1b2[_0x9104('0x2b')](_0x4d0b89)[_0x9104('0x2d')](_0x5eeb28);}};}function respondWithFilteredResult(_0xae24d2,_0x11c45b){return function(_0x4920d7){if(_0x4920d7){var _0x3157c3=typeof _0x11c45b[_0x9104('0x2e')]===_0x9104('0x2f')&&typeof _0x11c45b[_0x9104('0x30')]===_0x9104('0x2f');var _0x4069ba=_0x4920d7[_0x9104('0x31')];var _0x46f43f=_0x3157c3?0x0:_0x11c45b[_0x9104('0x2e')];var _0x27c99f=_0x3157c3?_0x4920d7[_0x9104('0x31')]:_0x11c45b[_0x9104('0x2e')]+_0x11c45b[_0x9104('0x30')];var _0x17d274;if(_0x27c99f>=_0x4069ba){_0x27c99f=_0x4069ba;_0x17d274=0xc8;}else{_0x17d274=0xce;}_0xae24d2[_0x9104('0x2b')](_0x17d274);return _0xae24d2[_0x9104('0x32')](_0x9104('0x33'),_0x46f43f+'-'+_0x27c99f+'/'+_0x4069ba)['json'](_0x4920d7);}return null;};}function patchUpdates(_0xaf7b0){return function(_0x26e01a){try{jsonpatch['apply'](_0x26e01a,_0xaf7b0,!![]);}catch(_0x1cf7a5){return BPromise[_0x9104('0x34')](_0x1cf7a5);}return _0x26e01a[_0x9104('0x35')]();};}function saveUpdates(_0x50cfa4,_0x49000e){return function(_0x53935b){if(_0x53935b){return _0x53935b['update'](_0x50cfa4)['then'](function(_0x20f27d){return _0x20f27d;});}return null;};}function removeEntity(_0x5db5d6,_0xabae07){return function(_0x298a1d){if(_0x298a1d){return _0x298a1d[_0x9104('0x36')]()[_0x9104('0x1f')](function(){var _0x2b2739=_0x298a1d[_0x9104('0x37')]({'plain':!![]});var _0x2bd2a4='ChatQueues';return db['UserProfileResource'][_0x9104('0x36')]({'where':{'type':_0x2bd2a4,'resourceId':_0x2b2739['id']}})[_0x9104('0x1f')](function(){return _0x298a1d;});})['then'](function(){_0x5db5d6[_0x9104('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb97c56,_0x28e7d9){return function(_0x14556a){if(!_0x14556a){_0xb97c56[_0x9104('0x2a')](0x194);}return _0x14556a;};}function handleError(_0x8fcbc7,_0x1eb4b8){_0x1eb4b8=_0x1eb4b8||0x1f4;return function(_0xb17453){logger[_0x9104('0x24')](_0xb17453[_0x9104('0x38')]);if(_0xb17453[_0x9104('0x39')]){delete _0xb17453[_0x9104('0x39')];}_0x8fcbc7[_0x9104('0x2b')](_0x1eb4b8)[_0x9104('0x3a')](_0xb17453);};}exports[_0x9104('0x3b')]=function(_0x59133e,_0x27cba0){var _0x1f9ebe={},_0x3bf2ae={},_0x43b6a1={'count':0x0,'rows':[]};var _0x22a7f0=_[_0x9104('0x3c')](db['ChatQueue'][_0x9104('0x3d')],function(_0x1e6b2a){return{'name':_0x1e6b2a[_0x9104('0x3e')],'type':_0x1e6b2a['type'][_0x9104('0x3f')]};});_0x3bf2ae[_0x9104('0x40')]=_[_0x9104('0x3c')](_0x22a7f0,_0x9104('0x39'));_0x3bf2ae[_0x9104('0x41')]=_[_0x9104('0x42')](_0x59133e['query']);_0x3bf2ae[_0x9104('0x43')]=_[_0x9104('0x44')](_0x3bf2ae[_0x9104('0x40')],_0x3bf2ae[_0x9104('0x41')]);_0x1f9ebe[_0x9104('0x45')]=_['intersection'](_0x3bf2ae[_0x9104('0x40')],qs[_0x9104('0x46')](_0x59133e[_0x9104('0x41')][_0x9104('0x46')]));_0x1f9ebe[_0x9104('0x45')]=_0x1f9ebe['attributes'][_0x9104('0x47')]?_0x1f9ebe[_0x9104('0x45')]:_0x3bf2ae[_0x9104('0x40')];if(!_0x59133e[_0x9104('0x41')][_0x9104('0x48')]('nolimit')){_0x1f9ebe[_0x9104('0x30')]=qs[_0x9104('0x30')](_0x59133e[_0x9104('0x41')]['limit']);_0x1f9ebe[_0x9104('0x2e')]=qs['offset'](_0x59133e[_0x9104('0x41')][_0x9104('0x2e')]);}_0x1f9ebe[_0x9104('0x49')]=qs[_0x9104('0x4a')](_0x59133e[_0x9104('0x41')][_0x9104('0x4a')]);_0x1f9ebe[_0x9104('0x4b')]=qs[_0x9104('0x43')](_[_0x9104('0x4c')](_0x59133e[_0x9104('0x41')],_0x3bf2ae[_0x9104('0x43')]),_0x22a7f0);if(_0x59133e[_0x9104('0x41')][_0x9104('0x4d')]){_0x1f9ebe[_0x9104('0x4b')]=_[_0x9104('0x4e')](_0x1f9ebe['where'],{'$or':_[_0x9104('0x3c')](_0x22a7f0,function(_0x1dca75){if(_0x1dca75[_0x9104('0x4f')]!==_0x9104('0x50')){var _0x18fa3f={};_0x18fa3f[_0x1dca75[_0x9104('0x39')]]={'$like':'%'+_0x59133e[_0x9104('0x41')][_0x9104('0x4d')]+'%'};return _0x18fa3f;}})});}_0x1f9ebe=_['merge']({},_0x1f9ebe,_0x59133e['options']);var _0x46f1fb={'where':_0x1f9ebe['where']};return db[_0x9104('0x51')]['count'](_0x46f1fb)[_0x9104('0x1f')](function(_0x3f4419){_0x43b6a1['count']=_0x3f4419;if(_0x59133e[_0x9104('0x41')][_0x9104('0x52')]){_0x1f9ebe[_0x9104('0x53')]=[{'all':!![]}];}return db[_0x9104('0x51')][_0x9104('0x54')](_0x1f9ebe);})['then'](function(_0x3448d9){_0x43b6a1[_0x9104('0x55')]=_0x3448d9;return _0x43b6a1;})['then'](respondWithFilteredResult(_0x27cba0,_0x1f9ebe))[_0x9104('0x29')](handleError(_0x27cba0,null));};exports[_0x9104('0x56')]=function(_0x4acb96,_0x5054d3){var _0x4c28b9={'raw':!![],'where':{'id':_0x4acb96['params']['id']}},_0x5b00ac={};_0x5b00ac['model']=_[_0x9104('0x42')](db['ChatQueue'][_0x9104('0x3d')]);_0x5b00ac[_0x9104('0x41')]=_[_0x9104('0x42')](_0x4acb96[_0x9104('0x41')]);_0x5b00ac[_0x9104('0x43')]=_[_0x9104('0x44')](_0x5b00ac[_0x9104('0x40')],_0x5b00ac['query']);_0x4c28b9[_0x9104('0x45')]=_[_0x9104('0x44')](_0x5b00ac['model'],qs[_0x9104('0x46')](_0x4acb96[_0x9104('0x41')][_0x9104('0x46')]));_0x4c28b9['attributes']=_0x4c28b9['attributes'][_0x9104('0x47')]?_0x4c28b9[_0x9104('0x45')]:_0x5b00ac['model'];if(_0x4acb96[_0x9104('0x41')][_0x9104('0x52')]){_0x4c28b9[_0x9104('0x53')]=[{'all':!![]}];}_0x4c28b9=_[_0x9104('0x4e')]({},_0x4c28b9,_0x4acb96[_0x9104('0x57')]);return db[_0x9104('0x51')][_0x9104('0x58')](_0x4c28b9)[_0x9104('0x1f')](handleEntityNotFound(_0x5054d3,null))[_0x9104('0x1f')](respondWithResult(_0x5054d3,null))[_0x9104('0x29')](handleError(_0x5054d3,null));};exports[_0x9104('0x59')]=function(_0x27ad0c,_0x4db5c8){return db['ChatQueue'][_0x9104('0x59')](_0x27ad0c[_0x9104('0x5a')],{})[_0x9104('0x1f')](function(_0x280242){var _0x3ea713=_0x27ad0c['user'][_0x9104('0x37')]({'plain':!![]});if(!_0x3ea713)throw new Error(_0x9104('0x5b'));if(_0x3ea713[_0x9104('0x5c')]===_0x9104('0x5d')){var _0x46ee86=_0x280242[_0x9104('0x37')]({'plain':!![]});var _0x5b1c2b='ChatQueues';return db['UserProfileSection']['find']({'where':{'name':_0x5b1c2b,'userProfileId':_0x3ea713[_0x9104('0x5e')]},'raw':!![]})[_0x9104('0x1f')](function(_0x44580e){if(_0x44580e&&_0x44580e['autoAssociation']===0x0){return db[_0x9104('0x5f')][_0x9104('0x59')]({'name':_0x46ee86[_0x9104('0x39')],'resourceId':_0x46ee86['id'],'type':_0x44580e[_0x9104('0x39')],'sectionId':_0x44580e['id']},{})[_0x9104('0x1f')](function(){return _0x280242;});}else{return _0x280242;}})['catch'](function(_0x5dd4c1){logger[_0x9104('0x24')](_0x9104('0x60'),_0x5dd4c1);throw _0x5dd4c1;});}return _0x280242;})[_0x9104('0x1f')](respondWithResult(_0x4db5c8,0xc9))['catch'](handleError(_0x4db5c8,null));};exports[_0x9104('0x61')]=function(_0x3651a5,_0x58ed4e){if(_0x3651a5[_0x9104('0x5a')]['id']){delete _0x3651a5[_0x9104('0x5a')]['id'];}return db[_0x9104('0x51')][_0x9104('0x58')]({'where':{'id':_0x3651a5[_0x9104('0x62')]['id']}})[_0x9104('0x1f')](handleEntityNotFound(_0x58ed4e,null))['then'](saveUpdates(_0x3651a5[_0x9104('0x5a')],null))[_0x9104('0x1f')](respondWithResult(_0x58ed4e,null))[_0x9104('0x29')](handleError(_0x58ed4e,null));};exports[_0x9104('0x36')]=function(_0x3ae9da,_0x5d6a82){return db[_0x9104('0x51')][_0x9104('0x58')]({'where':{'id':_0x3ae9da[_0x9104('0x62')]['id']}})[_0x9104('0x1f')](handleEntityNotFound(_0x5d6a82,null))[_0x9104('0x1f')](removeEntity(_0x5d6a82,null))[_0x9104('0x29')](handleError(_0x5d6a82,null));};exports[_0x9104('0x63')]=function(_0x60bb6,_0x2ba477){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x2ba477,null))[_0x9104('0x29')](handleError(_0x2ba477,null));};exports['getMembers']=function(_0x4f3789,_0x4f023d,_0x15b179){var _0x81124e={'raw':!![],'where':{}},_0x317085={},_0x50a39b;return db['ChatQueue']['findOne']({'where':{'id':_0x4f3789['params']['id']}})[_0x9104('0x1f')](handleEntityNotFound(_0x4f023d,null))['then'](function(_0x50f4f8){if(_0x50f4f8){_0x50a39b=_0x50f4f8['get']({'plain':!![]});_0x317085[_0x9104('0x40')]=_[_0x9104('0x42')](db[_0x9104('0x64')][_0x9104('0x3d')]);_0x317085['query']=_[_0x9104('0x42')](_0x4f3789[_0x9104('0x41')]);_0x317085[_0x9104('0x43')]=_['intersection'](_0x317085[_0x9104('0x40')],_0x317085['query']);_0x81124e[_0x9104('0x45')]=_[_0x9104('0x44')](_0x317085['model'],qs[_0x9104('0x46')](_0x4f3789[_0x9104('0x41')][_0x9104('0x46')]));_0x81124e['attributes']=_0x81124e['attributes'][_0x9104('0x47')]?_0x81124e[_0x9104('0x45')]:_0x317085[_0x9104('0x40')];if(!_0x4f3789[_0x9104('0x41')][_0x9104('0x48')](_0x9104('0x65'))){_0x81124e[_0x9104('0x30')]=qs[_0x9104('0x30')](_0x4f3789['query'][_0x9104('0x30')]);_0x81124e[_0x9104('0x2e')]=qs[_0x9104('0x2e')](_0x4f3789[_0x9104('0x41')]['offset']);}_0x81124e[_0x9104('0x49')]=qs['sort'](_0x4f3789[_0x9104('0x41')][_0x9104('0x4a')]);_0x81124e[_0x9104('0x4b')]=qs[_0x9104('0x43')](_['pick'](_0x4f3789[_0x9104('0x41')],_0x317085['filters']));_0x81124e[_0x9104('0x4b')]['ChatQueueId']=_0x50f4f8['id'];if(_0x4f3789['query'][_0x9104('0x4d')]){_0x81124e[_0x9104('0x4b')]=_[_0x9104('0x4e')](_0x81124e['where'],{'$or':_[_0x9104('0x3c')](_0x81124e['attributes'],function(_0x2eed62){var _0x4c0cec={};_0x4c0cec[_0x2eed62]={'$like':'%'+_0x4f3789[_0x9104('0x41')][_0x9104('0x4d')]+'%'};return _0x4c0cec;})});}_0x81124e=_[_0x9104('0x4e')]({},_0x81124e,_0x4f3789[_0x9104('0x57')]);return db[_0x9104('0x64')][_0x9104('0x54')](_0x81124e);}})[_0x9104('0x1f')](function(_0x29fe63){if(_0x29fe63){return db[_0x9104('0x66')][_0x9104('0x67')]({'where':{'id':_[_0x9104('0x3c')](_0x29fe63,_0x9104('0x68')),'role':'agent'},'attributes':['id',_0x9104('0x39'),_0x9104('0x69'),_0x9104('0x6a'),_0x9104('0x6b')]});}})[_0x9104('0x1f')](function(_0x1b54e6){if(_0x1b54e6){return{'count':_0x1b54e6['count'],'rows':_[_0x9104('0x3c')](_0x1b54e6[_0x9104('0x55')],function(_0xf082ec){return{'membername':_0xf082ec['name'],'UserId':_0xf082ec['id'],'queue_name':_0x50a39b[_0x9104('0x39')],'ChatQueueId':_0x50a39b['id'],'interface':util[_0x9104('0x6c')]('%s/%s','SIP',_0xf082ec['name']),'penalty':0x0,'paused':_0xf082ec[_0x9104('0x69')],'createdAt':_0xf082ec[_0x9104('0x6b')],'updatedAt':_0xf082ec['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4f023d,_0x81124e))['catch'](handleError(_0x4f023d,null));};exports[_0x9104('0x6d')]=function(_0x13e21c,_0x52dbab,_0x694721){var _0x3562df={};var _0x488375={};var _0x3a6a52;var _0x4691f5;return db[_0x9104('0x51')][_0x9104('0x6e')]({'where':{'id':_0x13e21c[_0x9104('0x62')]['id']}})['then'](handleEntityNotFound(_0x52dbab,null))[_0x9104('0x1f')](function(_0x29e90e){if(_0x29e90e){_0x3a6a52=_0x29e90e;_0x488375[_0x9104('0x40')]=_[_0x9104('0x42')](db[_0x9104('0x6f')]['rawAttributes']);_0x488375['query']=_[_0x9104('0x42')](_0x13e21c[_0x9104('0x41')]);_0x488375[_0x9104('0x43')]=_[_0x9104('0x44')](_0x488375[_0x9104('0x40')],_0x488375['query']);_0x3562df[_0x9104('0x45')]=_[_0x9104('0x44')](_0x488375[_0x9104('0x40')],qs['fields'](_0x13e21c[_0x9104('0x41')][_0x9104('0x46')]));_0x3562df[_0x9104('0x45')]=_0x3562df[_0x9104('0x45')][_0x9104('0x47')]?_0x3562df[_0x9104('0x45')]:_0x488375['model'];_0x3562df[_0x9104('0x49')]=qs[_0x9104('0x4a')](_0x13e21c[_0x9104('0x41')]['sort']);_0x3562df[_0x9104('0x4b')]=qs['filters'](_['pick'](_0x13e21c[_0x9104('0x41')],_0x488375[_0x9104('0x43')]));if(_0x13e21c['query'][_0x9104('0x4d')]){_0x3562df[_0x9104('0x4b')]=_['merge'](_0x3562df[_0x9104('0x4b')],{'$or':_[_0x9104('0x3c')](_0x3562df[_0x9104('0x45')],function(_0x137579){var _0x349cd4={};_0x349cd4[_0x137579]={'$like':'%'+_0x13e21c[_0x9104('0x41')]['filter']+'%'};return _0x349cd4;})});}_0x3562df=_['merge']({},_0x3562df,_0x13e21c[_0x9104('0x57')]);return _0x3a6a52[_0x9104('0x6d')](_0x3562df);}})[_0x9104('0x1f')](function(_0x32fd04){if(_0x32fd04){_0x4691f5=_0x32fd04[_0x9104('0x47')];if(!_0x13e21c[_0x9104('0x41')]['hasOwnProperty'](_0x9104('0x65'))){_0x3562df[_0x9104('0x30')]=qs[_0x9104('0x30')](_0x13e21c['query'][_0x9104('0x30')]);_0x3562df['offset']=qs[_0x9104('0x2e')](_0x13e21c['query'][_0x9104('0x2e')]);}return _0x3a6a52[_0x9104('0x6d')](_0x3562df);}})[_0x9104('0x1f')](function(_0x5ce33f){if(_0x5ce33f){return _0x5ce33f?{'count':_0x4691f5,'rows':_0x5ce33f}:null;}})[_0x9104('0x1f')](respondWithResult(_0x52dbab,null))[_0x9104('0x29')](handleError(_0x52dbab,null));};exports[_0x9104('0x70')]=function(_0x59ce21,_0x5d3239,_0x2fc31f){var _0xa2214a=_0x59ce21['body'][_0x9104('0x71')];return db[_0x9104('0x6f')][_0x9104('0x54')]({'where':{'id':_0xa2214a},'attributes':['id'],'include':[{'model':db[_0x9104('0x66')],'as':_0x9104('0x72'),'attributes':['id',_0x9104('0x39'),'online',_0x9104('0x73'),_0x9104('0x74')],'raw':!![]}]})[_0x9104('0x1f')](function(_0x1b1bd5){if(_0x1b1bd5){var _0x4695d5=_[_0x9104('0x75')](_0x1b1bd5,function(_0x1d97cc){var _0x29b4f3=_0x1d97cc['get']({'plain':!![]});return _0x29b4f3['Agents'];});return db[_0x9104('0x51')]['find']({'where':{'id':_0x59ce21[_0x9104('0x62')]['id']}})[_0x9104('0x1f')](function(_0x2dbd1f){return db[_0x9104('0x76')]['transaction'](function(_0x44f8df){return _0x2dbd1f[_0x9104('0x70')](_0xa2214a,{'transaction':_0x44f8df})['then'](function(){return BPromise[_0x9104('0x77')](_0x4695d5,function(_0x4be537){return db['UserChatQueue'][_0x9104('0x78')]({'where':{'UserId':_0x4be537['id'],'ChatQueueId':_0x59ce21[_0x9104('0x62')]['id']},'transaction':_0x44f8df});});})[_0x9104('0x1f')](function(){_0x4695d5[_0x9104('0x79')](function(_0x87cab1){socket['emit']('userChatQueue:save',{'UserId':_0x87cab1['id'],'ChatQueueId':_0x2dbd1f['id']});});});});});}})[_0x9104('0x1f')](respondWithStatusCode(_0x5d3239,null))[_0x9104('0x29')](handleError(_0x5d3239,null));};exports[_0x9104('0x7a')]=function(_0x5120f8,_0x4ff9e9,_0x35f160){return db[_0x9104('0x6f')][_0x9104('0x54')]({'where':{'id':_0x5120f8['query'][_0x9104('0x71')]},'attributes':['id'],'include':[{'model':db[_0x9104('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4ff9e9,null))['then'](function(_0x427caa){var _0x2065fb=_[_0x9104('0x3c')](_0x427caa,'id');var _0x14f233=[];var _0x12a130=[];var _0x2ba74e=squel['select']();_0x2ba74e[_0x9104('0x7b')](_0x9104('0x7c'))[_0x9104('0x7d')](_0x9104('0x7e'),'tq')[_0x9104('0x7f')](_0x9104('0x80'),'ut',_0x9104('0x81'))[_0x9104('0x4b')](_0x9104('0x82'),_0x5120f8['params']['id']);for(var _0x179e79=0x0;_0x179e79<_0x427caa[_0x9104('0x47')];_0x179e79+=0x1){let _0x21a2df=_0x427caa[_0x179e79];for(var _0x42851d=0x0;_0x42851d<_0x21a2df['Agents']['length'];_0x42851d+=0x1){let _0x20e494=_0x21a2df[_0x9104('0x72')][_0x42851d];var _0x1c2d6b=_0x2ba74e[_0x9104('0x83')]();_0x1c2d6b[_0x9104('0x4b')](_0x9104('0x84'),_0x20e494['id']);_0x12a130[_0x9104('0x85')](db[_0x9104('0x76')]['query'](_0x1c2d6b[_0x9104('0x86')](),{'type':db[_0x9104('0x76')][_0x9104('0x87')]['SELECT']})[_0x9104('0x1f')](function(_0x3299f9){if(_0x3299f9[_0x9104('0x47')]===0x1){return _0x20e494['id'];}else{var _0x26f718=_['every'](_[_0x9104('0x3c')](_0x3299f9,_0x9104('0x88')),function(_0x43ebbe){return _[_0x9104('0x89')](_0x2065fb,_0x43ebbe);});if(_0x26f718){return _0x20e494['id'];}}}));}}return BPromise[_0x9104('0x8a')](_0x12a130)[_0x9104('0x1f')](function(_0x2139ca){_0x14f233=_(_0x14f233)[_0x9104('0x8b')](_0x2139ca)['compact']()[_0x9104('0x8c')]();return db['ChatQueue'][_0x9104('0x58')]({'where':{'id':_0x5120f8['params']['id']}})[_0x9104('0x1f')](function(_0x44c2dd){return db[_0x9104('0x76')]['transaction'](function(_0x3f84e3){return _0x44c2dd[_0x9104('0x7a')](_0x5120f8[_0x9104('0x41')][_0x9104('0x71')],{'transaction':_0x3f84e3})[_0x9104('0x1f')](function(){if(!_[_0x9104('0x8d')](_0x14f233)){return _0x44c2dd[_0x9104('0x8e')](_0x14f233,{'transaction':_0x3f84e3});}})[_0x9104('0x1f')](function(){_0x14f233[_0x9104('0x79')](function(_0x440617){socket[_0x9104('0x8f')](_0x9104('0x90'),{'UserId':_0x440617,'ChatQueueId':_0x44c2dd['id']});});});});});});})['then'](respondWithStatusCode(_0x4ff9e9,null))[_0x9104('0x29')](handleError(_0x4ff9e9,null));};exports[_0x9104('0x91')]=function(_0x3a8e86,_0x2354bb,_0x1690e4){return db[_0x9104('0x51')][_0x9104('0x58')]({'where':{'id':_0x3a8e86['params']['id']}})['then'](handleEntityNotFound(_0x2354bb,null))[_0x9104('0x1f')](function(_0x1cc28c){if(_0x1cc28c){return _0x1cc28c[_0x9104('0x91')](_0x3a8e86[_0x9104('0x5a')][_0x9104('0x71')],_['omit'](_0x3a8e86[_0x9104('0x5a')],['ids','id'])||{})[_0x9104('0x92')](function(_0x44744f){for(var _0x41008f=0x0;_0x41008f<_0x3a8e86[_0x9104('0x5a')][_0x9104('0x71')][_0x9104('0x47')];_0x41008f+=0x1){socket['emit'](_0x9104('0x93'),{'UserId':Number(_0x3a8e86['body'][_0x9104('0x71')][_0x41008f]),'ChatQueueId':Number(_0x3a8e86[_0x9104('0x62')]['id'])});}return _0x44744f;});}})[_0x9104('0x1f')](respondWithResult(_0x2354bb,null))[_0x9104('0x29')](handleError(_0x2354bb,null));};exports[_0x9104('0x8e')]=function(_0x48f5dc,_0x3ac2b4,_0x67ab71){return db['ChatQueue'][_0x9104('0x58')]({'where':{'id':_0x48f5dc[_0x9104('0x62')]['id']}})[_0x9104('0x1f')](handleEntityNotFound(_0x3ac2b4,null))[_0x9104('0x1f')](function(_0x22d5f1){if(_0x22d5f1){return _0x22d5f1[_0x9104('0x8e')](_0x48f5dc[_0x9104('0x41')]['ids'])[_0x9104('0x1f')](function(){if(_['isArray'](_0x48f5dc[_0x9104('0x41')][_0x9104('0x71')])){for(var _0x533e76=0x0;_0x533e76<_0x48f5dc[_0x9104('0x41')]['ids'][_0x9104('0x47')];_0x533e76+=0x1){socket[_0x9104('0x8f')](_0x9104('0x90'),{'UserId':Number(_0x48f5dc[_0x9104('0x41')][_0x9104('0x71')][_0x533e76]),'ChatQueueId':Number(_0x48f5dc[_0x9104('0x62')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x48f5dc[_0x9104('0x41')][_0x9104('0x71')]),'ChatQueueId':Number(_0x48f5dc['params']['id'])});}});}})[_0x9104('0x1f')](respondWithStatusCode(_0x3ac2b4,null))[_0x9104('0x29')](handleError(_0x3ac2b4,null));};exports[_0x9104('0x94')]=function(_0x4f01eb,_0x160667,_0x4a32b1){var _0x2f13c0={};var _0x1b7654={};var _0x14c9cc;var _0x4ac8ff;return db['ChatQueue'][_0x9104('0x6e')]({'where':{'id':_0x4f01eb[_0x9104('0x62')]['id']}})['then'](handleEntityNotFound(_0x160667,null))[_0x9104('0x1f')](function(_0x136ace){if(_0x136ace){_0x14c9cc=_0x136ace;_0x1b7654[_0x9104('0x40')]=_[_0x9104('0x42')](db[_0x9104('0x66')]['rawAttributes']);_0x1b7654[_0x9104('0x41')]=_[_0x9104('0x42')](_0x4f01eb[_0x9104('0x41')]);_0x1b7654['filters']=_['intersection'](_0x1b7654[_0x9104('0x40')],_0x1b7654[_0x9104('0x41')]);_0x2f13c0[_0x9104('0x45')]=_[_0x9104('0x44')](_0x1b7654[_0x9104('0x40')],qs[_0x9104('0x46')](_0x4f01eb[_0x9104('0x41')][_0x9104('0x46')]));_0x2f13c0[_0x9104('0x45')]=_0x2f13c0[_0x9104('0x45')]['length']?_0x2f13c0[_0x9104('0x45')]:_0x1b7654[_0x9104('0x40')];_0x2f13c0[_0x9104('0x49')]=qs[_0x9104('0x4a')](_0x4f01eb[_0x9104('0x41')][_0x9104('0x4a')]);_0x2f13c0[_0x9104('0x4b')]=qs[_0x9104('0x43')](_[_0x9104('0x4c')](_0x4f01eb[_0x9104('0x41')],_0x1b7654[_0x9104('0x43')]));if(_0x4f01eb[_0x9104('0x41')]['filter']){_0x2f13c0['where']=_[_0x9104('0x4e')](_0x2f13c0[_0x9104('0x4b')],{'$or':_[_0x9104('0x3c')](_0x2f13c0[_0x9104('0x45')],function(_0x15320d){var _0x1c2241={};_0x1c2241[_0x15320d]={'$like':'%'+_0x4f01eb[_0x9104('0x41')][_0x9104('0x4d')]+'%'};return _0x1c2241;})});}_0x2f13c0=_[_0x9104('0x4e')]({},_0x2f13c0,_0x4f01eb[_0x9104('0x57')]);return _0x14c9cc[_0x9104('0x94')](_0x2f13c0);}})['then'](function(_0xc94762){if(_0xc94762){_0x4ac8ff=_0xc94762[_0x9104('0x47')];if(!_0x4f01eb[_0x9104('0x41')][_0x9104('0x48')]('nolimit')){_0x2f13c0['limit']=qs[_0x9104('0x30')](_0x4f01eb[_0x9104('0x41')][_0x9104('0x30')]);_0x2f13c0[_0x9104('0x2e')]=qs['offset'](_0x4f01eb[_0x9104('0x41')]['offset']);}return _0x14c9cc[_0x9104('0x94')](_0x2f13c0);}})[_0x9104('0x1f')](function(_0x2119b6){if(_0x2119b6){return _0x2119b6?{'count':_0x4ac8ff,'rows':_0x2119b6}:null;}})['then'](respondWithResult(_0x160667,null))[_0x9104('0x29')](handleError(_0x160667,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f8d785b..642c977 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 _0x60e6=['hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x3ea4fe,_0x298a0c){var _0x517133=function(_0x542abf){while(--_0x542abf){_0x3ea4fe['push'](_0x3ea4fe['shift']());}};_0x517133(++_0x298a0c);}(_0x60e6,0xd2));var _0x660e=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x60e6[_0x541260];return _0x1dd2b5;};'use strict';var EventEmitter=require(_0x660e('0x0'));var ChatQueue=require(_0x660e('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x660e('0x2'),'afterUpdate':_0x660e('0x3'),'afterDestroy':_0x660e('0x4')};function emitEvent(_0x43daae){return function(_0x10a5a9,_0x23af64,_0x25b1a0){ChatQueueEvents[_0x660e('0x5')](_0x43daae+':'+_0x10a5a9['id'],_0x10a5a9);ChatQueueEvents[_0x660e('0x5')](_0x43daae,_0x10a5a9);_0x25b1a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x660e('0x6')](e,emitEvent(event));}}module[_0x660e('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x2729=['update','emit','hook','events','setMaxListeners','save'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x2729,0xf3));var _0x9272=function(_0x2db588,_0x4b5828){_0x2db588=_0x2db588-0x0;var _0xf72e3d=_0x2729[_0x2db588];return _0xf72e3d;};'use strict';var EventEmitter=require(_0x9272('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9272('0x1')](0x0);var events={'afterCreate':_0x9272('0x2'),'afterUpdate':_0x9272('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1ba027){return function(_0x13f244,_0x24f3b8,_0x5510fe){ChatQueueEvents[_0x9272('0x4')](_0x1ba027+':'+_0x13f244['id'],_0x13f244);ChatQueueEvents[_0x9272('0x4')](_0x1ba027,_0x13f244);_0x5510fe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x9272('0x5')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 40edb8f..c4a0850 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 _0x749f=['chat_queues','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatQueue'];(function(_0x727217,_0x3326d5){var _0x5b1782=function(_0x4ef951){while(--_0x4ef951){_0x727217['push'](_0x727217['shift']());}};_0x5b1782(++_0x3326d5);}(_0x749f,0x16c));var _0xf749=function(_0x22be6d,_0x90876b){_0x22be6d=_0x22be6d-0x0;var _0x1985e1=_0x749f[_0x22be6d];return _0x1985e1;};'use strict';var _=require('lodash');var util=require(_0xf749('0x0'));var logger=require(_0xf749('0x1'))('api');var moment=require(_0xf749('0x2'));var BPromise=require(_0xf749('0x3'));var rp=require(_0xf749('0x4'));var fs=require('fs');var path=require(_0xf749('0x5'));var rimraf=require('rimraf');var config=require(_0xf749('0x6'));var attributes=require('./chatQueue.attributes');module[_0xf749('0x7')]=function(_0x2c5d49,_0xfed8d0){return _0x2c5d49[_0xf749('0x8')](_0xf749('0x9'),attributes,{'tableName':_0xf749('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fc9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x1c5391,_0x37e2b6){var _0x1cf467=function(_0x33de62){while(--_0x33de62){_0x1c5391['push'](_0x1c5391['shift']());}};_0x1cf467(++_0x37e2b6);}(_0x3fc9,0xff));var _0x93fc=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x3fc9[_0x4c7935];return _0x30651d;};'use strict';var _=require(_0x93fc('0x0'));var util=require(_0x93fc('0x1'));var logger=require(_0x93fc('0x2'))(_0x93fc('0x3'));var moment=require(_0x93fc('0x4'));var BPromise=require(_0x93fc('0x5'));var rp=require(_0x93fc('0x6'));var fs=require('fs');var path=require(_0x93fc('0x7'));var rimraf=require(_0x93fc('0x8'));var config=require(_0x93fc('0x9'));var attributes=require(_0x93fc('0xa'));module[_0x93fc('0xb')]=function(_0x1f926,_0x34f600){return _0x1f926[_0x93fc('0xc')](_0x93fc('0xd'),attributes,{'tableName':_0x93fc('0xe'),'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 1e3eeae..70646eb 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 _0x49f8=['register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowChatQueue','find','then','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49f8,0xff));var _0x849f=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0x49f8[_0x4b0008];return _0x401c96;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});config[_0x849f('0x8')]=_[_0x849f('0x9')](config[_0x849f('0x8')],{'host':_0x849f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x849f('0xb')](socket);function respondWithRpcPromise(_0x1a902c,_0x3b094c,_0x51cf64){return new BPromise(function(_0x1de72f,_0x28de6e){return client[_0x849f('0xc')](_0x1a902c,_0x51cf64)['then'](function(_0x14976e){logger['info'](_0x849f('0xd'),_0x3b094c,_0x849f('0xe'));logger[_0x849f('0xf')](_0x849f('0x10'),_0x3b094c,'request\x20sent',JSON[_0x849f('0x11')](_0x14976e));if(_0x14976e[_0x849f('0x12')]){if(_0x14976e[_0x849f('0x12')][_0x849f('0x13')]===0x1f4){logger[_0x849f('0x12')]('ChatQueue,\x20%s,\x20%s',_0x3b094c,_0x14976e['error'][_0x849f('0x14')]);return _0x28de6e(_0x14976e['error'][_0x849f('0x14')]);}logger[_0x849f('0x12')](_0x849f('0xd'),_0x3b094c,_0x14976e[_0x849f('0x12')][_0x849f('0x14')]);return _0x1de72f(_0x14976e[_0x849f('0x12')][_0x849f('0x14')]);}else{logger['info'](_0x849f('0xd'),_0x3b094c,_0x849f('0xe'));_0x1de72f(_0x14976e[_0x849f('0x15')]['message']);}})[_0x849f('0x16')](function(_0x364c9b){logger['error'](_0x849f('0xd'),_0x3b094c,_0x364c9b);_0x28de6e(_0x364c9b);});});}exports[_0x849f('0x17')]=function(_0x48622f){var _0x5047a3=this;return new Promise(function(_0x240ea4,_0x11d183){return db[_0x849f('0x18')][_0x849f('0x19')]({'raw':_0x48622f[_0x849f('0x1a')]?_0x48622f[_0x849f('0x1a')][_0x849f('0x1b')]===undefined?!![]:![]:!![],'where':_0x48622f[_0x849f('0x1a')]?_0x48622f['options'][_0x849f('0x1c')]||null:null,'attributes':_0x48622f[_0x849f('0x1a')]?_0x48622f[_0x849f('0x1a')][_0x849f('0x1d')]||null:null,'limit':_0x48622f[_0x849f('0x1a')]?_0x48622f['options'][_0x849f('0x1e')]||null:null,'include':_0x48622f[_0x849f('0x1a')]?_0x48622f[_0x849f('0x1a')][_0x849f('0x1f')]?_[_0x849f('0x20')](_0x48622f[_0x849f('0x1a')][_0x849f('0x1f')],function(_0x2e5371){return{'model':db[_0x2e5371[_0x849f('0x21')]],'as':_0x2e5371['as'],'attributes':_0x2e5371[_0x849f('0x1d')],'include':_0x2e5371[_0x849f('0x1f')]?_[_0x849f('0x20')](_0x2e5371[_0x849f('0x1f')],function(_0x529c3b){return{'model':db[_0x529c3b[_0x849f('0x21')]],'as':_0x529c3b['as'],'attributes':_0x529c3b['attributes'],'include':_0x529c3b[_0x849f('0x1f')]?_[_0x849f('0x20')](_0x529c3b[_0x849f('0x1f')],function(_0x295008){return{'model':db[_0x295008[_0x849f('0x21')]],'as':_0x295008['as'],'attributes':_0x295008[_0x849f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20fa7f){logger[_0x849f('0x22')](_0x849f('0x17'),_0x48622f);logger['debug'](_0x849f('0x17'),_0x48622f,JSON['stringify'](_0x20fa7f));_0x240ea4(_0x20fa7f);})[_0x849f('0x16')](function(_0x2ffa0a){logger[_0x849f('0x12')](_0x849f('0x17'),_0x2ffa0a['message'],_0x48622f);_0x11d183(_0x5047a3[_0x849f('0x12')](0x1f4,_0x2ffa0a['message']));});});};exports[_0x849f('0x23')]=function(_0x4511d2){var _0x5f4b15=this;return new Promise(function(_0x5c4f8a,_0x4b93ca){return db[_0x849f('0x18')][_0x849f('0x24')]({'raw':_0x4511d2[_0x849f('0x1a')]?_0x4511d2[_0x849f('0x1a')][_0x849f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4511d2['options']?_0x4511d2[_0x849f('0x1a')][_0x849f('0x1c')]||null:null,'attributes':_0x4511d2[_0x849f('0x1a')]?_0x4511d2[_0x849f('0x1a')][_0x849f('0x1d')]||null:null,'include':_0x4511d2[_0x849f('0x1a')]?_0x4511d2[_0x849f('0x1a')][_0x849f('0x1f')]?_[_0x849f('0x20')](_0x4511d2[_0x849f('0x1a')]['include'],function(_0x5cee85){return{'model':db[_0x5cee85[_0x849f('0x21')]],'as':_0x5cee85['as'],'attributes':_0x5cee85[_0x849f('0x1d')],'include':_0x5cee85[_0x849f('0x1f')]?_['map'](_0x5cee85[_0x849f('0x1f')],function(_0x1107ed){return{'model':db[_0x1107ed[_0x849f('0x21')]],'as':_0x1107ed['as'],'attributes':_0x1107ed[_0x849f('0x1d')],'include':_0x1107ed['include']?_[_0x849f('0x20')](_0x1107ed[_0x849f('0x1f')],function(_0x2b17ad){return{'model':db[_0x2b17ad[_0x849f('0x21')]],'as':_0x2b17ad['as'],'attributes':_0x2b17ad[_0x849f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x849f('0x25')](function(_0x40fbed){logger['info'](_0x849f('0x23'),_0x4511d2);logger[_0x849f('0xf')](_0x849f('0x23'),_0x4511d2,JSON['stringify'](_0x40fbed));_0x5c4f8a(_0x40fbed);})['catch'](function(_0xedad3f){logger['error'](_0x849f('0x23'),_0xedad3f['message'],_0x4511d2);_0x4b93ca(_0x5f4b15[_0x849f('0x12')](0x1f4,_0xedad3f[_0x849f('0x14')]));});});}; \ No newline at end of file +var _0x6ea1=['where','options','attributes','limit','map','include','model','ChatQueue','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','findAll','raw'];(function(_0x2a0e1a,_0x598945){var _0x149e83=function(_0x3fc984){while(--_0x3fc984){_0x2a0e1a['push'](_0x2a0e1a['shift']());}};_0x149e83(++_0x598945);}(_0x6ea1,0x1c2));var _0x16ea=function(_0x331779,_0xe76b8d){_0x331779=_0x331779-0x0;var _0x2fa37b=_0x6ea1[_0x331779];return _0x2fa37b;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var moment=require(_0x16ea('0x2'));var BPromise=require(_0x16ea('0x3'));var rs=require(_0x16ea('0x4'));var fs=require('fs');var Redis=require(_0x16ea('0x5'));var db=require(_0x16ea('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x16ea('0x7'));var config=require(_0x16ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x16ea('0x9')][_0x16ea('0xa')]({'port':0x232a});config[_0x16ea('0xb')]=_[_0x16ea('0xc')](config[_0x16ea('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x16ea('0xd'))(new Redis(config[_0x16ea('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2dad38,_0x42bcd8,_0x1525a9){return new BPromise(function(_0x12753e,_0x4b80ab){return client[_0x16ea('0xe')](_0x2dad38,_0x1525a9)[_0x16ea('0xf')](function(_0x504015){logger[_0x16ea('0x10')]('ChatQueue,\x20%s,\x20%s',_0x42bcd8,_0x16ea('0x11'));logger[_0x16ea('0x12')](_0x16ea('0x13'),_0x42bcd8,_0x16ea('0x11'),JSON[_0x16ea('0x14')](_0x504015));if(_0x504015[_0x16ea('0x15')]){if(_0x504015[_0x16ea('0x15')][_0x16ea('0x16')]===0x1f4){logger[_0x16ea('0x15')](_0x16ea('0x17'),_0x42bcd8,_0x504015['error'][_0x16ea('0x18')]);return _0x4b80ab(_0x504015[_0x16ea('0x15')][_0x16ea('0x18')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x42bcd8,_0x504015[_0x16ea('0x15')][_0x16ea('0x18')]);return _0x12753e(_0x504015['error'][_0x16ea('0x18')]);}else{logger[_0x16ea('0x10')](_0x16ea('0x17'),_0x42bcd8,_0x16ea('0x11'));_0x12753e(_0x504015[_0x16ea('0x19')][_0x16ea('0x18')]);}})[_0x16ea('0x1a')](function(_0x32ab64){logger[_0x16ea('0x15')](_0x16ea('0x17'),_0x42bcd8,_0x32ab64);_0x4b80ab(_0x32ab64);});});}exports[_0x16ea('0x1b')]=function(_0x7b6758){var _0x208dad=this;return new Promise(function(_0x583d6d,_0x3842f6){return db['ChatQueue'][_0x16ea('0x1c')]({'raw':_0x7b6758['options']?_0x7b6758['options'][_0x16ea('0x1d')]===undefined?!![]:![]:!![],'where':_0x7b6758['options']?_0x7b6758['options'][_0x16ea('0x1e')]||null:null,'attributes':_0x7b6758[_0x16ea('0x1f')]?_0x7b6758[_0x16ea('0x1f')][_0x16ea('0x20')]||null:null,'limit':_0x7b6758[_0x16ea('0x1f')]?_0x7b6758[_0x16ea('0x1f')][_0x16ea('0x21')]||null:null,'include':_0x7b6758['options']?_0x7b6758[_0x16ea('0x1f')]['include']?_[_0x16ea('0x22')](_0x7b6758[_0x16ea('0x1f')][_0x16ea('0x23')],function(_0x27723f){return{'model':db[_0x27723f[_0x16ea('0x24')]],'as':_0x27723f['as'],'attributes':_0x27723f[_0x16ea('0x20')],'include':_0x27723f['include']?_[_0x16ea('0x22')](_0x27723f[_0x16ea('0x23')],function(_0x350431){return{'model':db[_0x350431[_0x16ea('0x24')]],'as':_0x350431['as'],'attributes':_0x350431[_0x16ea('0x20')],'include':_0x350431[_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x350431[_0x16ea('0x23')],function(_0x350cf7){return{'model':db[_0x350cf7[_0x16ea('0x24')]],'as':_0x350cf7['as'],'attributes':_0x350cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0x16ea('0xf')](function(_0x460677){logger[_0x16ea('0x10')]('GetChatQueue',_0x7b6758);logger[_0x16ea('0x12')]('GetChatQueue',_0x7b6758,JSON[_0x16ea('0x14')](_0x460677));_0x583d6d(_0x460677);})[_0x16ea('0x1a')](function(_0x14d973){logger[_0x16ea('0x15')]('GetChatQueue',_0x14d973[_0x16ea('0x18')],_0x7b6758);_0x3842f6(_0x208dad[_0x16ea('0x15')](0x1f4,_0x14d973['message']));});});};exports['ShowChatQueue']=function(_0x579265){var _0x52eca2=this;return new Promise(function(_0x67505b,_0x36a69c){return db[_0x16ea('0x25')][_0x16ea('0x26')]({'raw':_0x579265['options']?_0x579265[_0x16ea('0x1f')][_0x16ea('0x1d')]===undefined?!![]:![]:!![],'where':_0x579265[_0x16ea('0x1f')]?_0x579265[_0x16ea('0x1f')][_0x16ea('0x1e')]||null:null,'attributes':_0x579265[_0x16ea('0x1f')]?_0x579265[_0x16ea('0x1f')][_0x16ea('0x20')]||null:null,'include':_0x579265[_0x16ea('0x1f')]?_0x579265[_0x16ea('0x1f')][_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x579265[_0x16ea('0x1f')][_0x16ea('0x23')],function(_0x4decd8){return{'model':db[_0x4decd8['model']],'as':_0x4decd8['as'],'attributes':_0x4decd8[_0x16ea('0x20')],'include':_0x4decd8[_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x4decd8[_0x16ea('0x23')],function(_0x116d31){return{'model':db[_0x116d31['model']],'as':_0x116d31['as'],'attributes':_0x116d31[_0x16ea('0x20')],'include':_0x116d31[_0x16ea('0x23')]?_[_0x16ea('0x22')](_0x116d31['include'],function(_0x3d0578){return{'model':db[_0x3d0578[_0x16ea('0x24')]],'as':_0x3d0578['as'],'attributes':_0x3d0578[_0x16ea('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52ca66){logger[_0x16ea('0x10')]('ShowChatQueue',_0x579265);logger[_0x16ea('0x12')](_0x16ea('0x27'),_0x579265,JSON[_0x16ea('0x14')](_0x52ca66));_0x67505b(_0x52ca66);})[_0x16ea('0x1a')](function(_0x3f0f94){logger[_0x16ea('0x15')](_0x16ea('0x27'),_0x3f0f94[_0x16ea('0x18')],_0x579265);_0x36a69c(_0x52eca2[_0x16ea('0x15')](0x1f4,_0x3f0f94['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f0560bd..172c34e 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 _0x702d=['remove','update','emit','register','length','./chatQueue.events','save'];(function(_0x1a33ac,_0x20a257){var _0x2b5d97=function(_0x43b9f0){while(--_0x43b9f0){_0x1a33ac['push'](_0x1a33ac['shift']());}};_0x2b5d97(++_0x20a257);}(_0x702d,0x147));var _0xd702=function(_0x57b440,_0x16cc6d){_0x57b440=_0x57b440-0x0;var _0x3a547d=_0x702d[_0x57b440];return _0x3a547d;};'use strict';var ChatQueueEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatQueueEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatQueue:'+_0x5af246,_0x544e94);ChatQueueEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file +var _0x4ea3=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x1d2254,_0x42dfea){var _0x1015e7=function(_0x417293){while(--_0x417293){_0x1d2254['push'](_0x1d2254['shift']());}};_0x1015e7(++_0x42dfea);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var ChatQueueEvents=require(_0x34ea('0x0'));var events=[_0x34ea('0x1'),_0x34ea('0x2'),_0x34ea('0x3')];function createListener(_0x588172,_0x374ec1){return function(_0x494b56){_0x374ec1[_0x34ea('0x4')](_0x588172,_0x494b56);};}function removeListener(_0x571f1b,_0x5e5a84){return function(){ChatQueueEvents[_0x34ea('0x5')](_0x571f1b,_0x5e5a84);};}exports[_0x34ea('0x6')]=function(_0x962596){for(var _0x123d48=0x0,_0x40434e=events[_0x34ea('0x7')];_0x123d48<_0x40434e;_0x123d48++){var _0x22b09e=events[_0x123d48];var _0x5bec7c=createListener(_0x34ea('0x8')+_0x22b09e,_0x962596);ChatQueueEvents['on'](_0x22b09e,_0x5bec7c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7c93538..2cb1c2e 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5d27b9,_0x547705){var _0x2c2983=function(_0x980652){while(--_0x980652){_0x5d27b9['push'](_0x5d27b9['shift']());}};_0x2c2983(++_0x547705);}(_0x7217,0x19e));var _0x7721=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7217[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 13ee2e2..a9940dc 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 _0x17ed=['exports','STRING','DATE','sequelize'];(function(_0x5d482d,_0x366df9){var _0x2c3b20=function(_0x402bf3){while(--_0x402bf3){_0x5d482d['push'](_0x5d482d['shift']());}};_0x2c3b20(++_0x366df9);}(_0x17ed,0xeb));var _0xd17e=function(_0x27b00f,_0xa77c83){_0x27b00f=_0x27b00f-0x0;var _0x2a8ec2=_0x17ed[_0x27b00f];return _0x2a8ec2;};'use strict';var moment=require('moment');var Sequelize=require(_0xd17e('0x0'));module[_0xd17e('0x1')]={'uniqueid':{'type':Sequelize[_0xd17e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd17e('0x2')]},'joinAt':{'type':Sequelize[_0xd17e('0x3')]},'leaveAt':{'type':Sequelize[_0xd17e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd17e('0x3')]},'reason':{'type':Sequelize[_0xd17e('0x2')]}}; \ No newline at end of file +var _0xca99=['DATE','moment','sequelize','exports','STRING'];(function(_0x58e7e1,_0x124573){var _0x3f9858=function(_0x29cd9c){while(--_0x29cd9c){_0x58e7e1['push'](_0x58e7e1['shift']());}};_0x3f9858(++_0x124573);}(_0xca99,0x1aa));var _0x9ca9=function(_0x4ca55f,_0xf27e7f){_0x4ca55f=_0x4ca55f-0x0;var _0x1435c0=_0xca99[_0x4ca55f];return _0x1435c0;};'use strict';var moment=require(_0x9ca9('0x0'));var Sequelize=require(_0x9ca9('0x1'));module[_0x9ca9('0x2')]={'uniqueid':{'type':Sequelize[_0x9ca9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9ca9('0x4')]},'leaveAt':{'type':Sequelize[_0x9ca9('0x4')]},'acceptAt':{'type':Sequelize[_0x9ca9('0x4')]},'exitAt':{'type':Sequelize[_0x9ca9('0x4')]},'reason':{'type':Sequelize[_0x9ca9('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 46187ef..703c979 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 _0x71ad=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','intersection','create','body','params','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','index','ChatQueueReport','type','key','map','query','filters','model','attributes','fields'];(function(_0x343c7a,_0x282152){var _0x3be1df=function(_0x6d1a7c){while(--_0x6d1a7c){_0x343c7a['push'](_0x343c7a['shift']());}};_0x3be1df(++_0x282152);}(_0x71ad,0xee));var _0xd71a=function(_0x300595,_0x16dd9a){_0x300595=_0x300595-0x0;var _0x5e5eb8=_0x71ad[_0x300595];return _0x5e5eb8;};'use strict';var emlformat=require(_0xd71a('0x0'));var rimraf=require(_0xd71a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd71a('0x2'));var rp=require('request-promise');var moment=require(_0xd71a('0x3'));var BPromise=require(_0xd71a('0x4'));var Mustache=require('mustache');var util=require(_0xd71a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd71a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd71a('0x7'));var _=require(_0xd71a('0x8'));var squel=require(_0xd71a('0x9'));var crypto=require(_0xd71a('0xa'));var jsforce=require(_0xd71a('0xb'));var deskjs=require(_0xd71a('0xc'));var toCsv=require(_0xd71a('0x6'));var querystring=require('querystring');var Papa=require(_0xd71a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd71a('0xe'));var as=require(_0xd71a('0xf'));var hardwareService=require(_0xd71a('0x10'));var logger=require(_0xd71a('0x11'))(_0xd71a('0x12'));var utils=require(_0xd71a('0x13'));var config=require(_0xd71a('0x14'));var licenseUtil=require(_0xd71a('0x15'));var db=require(_0xd71a('0x16'))['db'];function respondWithStatusCode(_0x3a0162,_0x4e18e9){_0x4e18e9=_0x4e18e9||0xcc;return function(_0x1ddfa9){if(_0x1ddfa9){return _0x3a0162[_0xd71a('0x17')](_0x4e18e9);}return _0x3a0162[_0xd71a('0x18')](_0x4e18e9)[_0xd71a('0x19')]();};}function respondWithResult(_0x2964fe,_0x3f6938){_0x3f6938=_0x3f6938||0xc8;return function(_0x10c0de){if(_0x10c0de){return _0x2964fe[_0xd71a('0x18')](_0x3f6938)[_0xd71a('0x1a')](_0x10c0de);}};}function respondWithFilteredResult(_0xfdcc6d,_0x10651e){return function(_0x15fd57){if(_0x15fd57){var _0x2c54c5=typeof _0x10651e[_0xd71a('0x1b')]===_0xd71a('0x1c')&&typeof _0x10651e['limit']===_0xd71a('0x1c');var _0x21334d=_0x15fd57[_0xd71a('0x1d')];var _0x5389fd=_0x2c54c5?0x0:_0x10651e['offset'];var _0x4e3832=_0x2c54c5?_0x15fd57[_0xd71a('0x1d')]:_0x10651e[_0xd71a('0x1b')]+_0x10651e[_0xd71a('0x1e')];var _0x25bb9b;if(_0x4e3832>=_0x21334d){_0x4e3832=_0x21334d;_0x25bb9b=0xc8;}else{_0x25bb9b=0xce;}_0xfdcc6d[_0xd71a('0x18')](_0x25bb9b);return _0xfdcc6d[_0xd71a('0x1f')]('Content-Range',_0x5389fd+'-'+_0x4e3832+'/'+_0x21334d)[_0xd71a('0x1a')](_0x15fd57);}return null;};}function patchUpdates(_0x266f54){return function(_0x4f1eb7){try{jsonpatch['apply'](_0x4f1eb7,_0x266f54,!![]);}catch(_0xc16934){return BPromise[_0xd71a('0x20')](_0xc16934);}return _0x4f1eb7[_0xd71a('0x21')]();};}function saveUpdates(_0x3f9ec1,_0x5eae39){return function(_0x1732f0){if(_0x1732f0){return _0x1732f0[_0xd71a('0x22')](_0x3f9ec1)[_0xd71a('0x23')](function(_0x3be820){return _0x3be820;});}return null;};}function removeEntity(_0x44c33e,_0xd5c0a0){return function(_0x4528e8){if(_0x4528e8){return _0x4528e8[_0xd71a('0x24')]()[_0xd71a('0x23')](function(){_0x44c33e['status'](0xcc)[_0xd71a('0x19')]();});}};}function handleEntityNotFound(_0x525ce9,_0x339d6f){return function(_0x589954){if(!_0x589954){_0x525ce9['sendStatus'](0x194);}return _0x589954;};}function handleError(_0x1f4cb9,_0x4911bb){_0x4911bb=_0x4911bb||0x1f4;return function(_0xef8f8c){logger[_0xd71a('0x25')](_0xef8f8c[_0xd71a('0x26')]);if(_0xef8f8c[_0xd71a('0x27')]){delete _0xef8f8c[_0xd71a('0x27')];}_0x1f4cb9[_0xd71a('0x18')](_0x4911bb)['send'](_0xef8f8c);};}exports[_0xd71a('0x28')]=function(_0x33f503,_0x405c71){var _0x1670f8={},_0x953740={},_0x3d234d={'count':0x0,'rows':[]};var _0x3a583a=_['map'](db[_0xd71a('0x29')]['rawAttributes'],function(_0x472c44){return{'name':_0x472c44['fieldName'],'type':_0x472c44[_0xd71a('0x2a')][_0xd71a('0x2b')]};});_0x953740['model']=_[_0xd71a('0x2c')](_0x3a583a,'name');_0x953740[_0xd71a('0x2d')]=_['keys'](_0x33f503['query']);_0x953740[_0xd71a('0x2e')]=_['intersection'](_0x953740[_0xd71a('0x2f')],_0x953740[_0xd71a('0x2d')]);_0x1670f8[_0xd71a('0x30')]=_['intersection'](_0x953740['model'],qs[_0xd71a('0x31')](_0x33f503[_0xd71a('0x2d')]['fields']));_0x1670f8[_0xd71a('0x30')]=_0x1670f8[_0xd71a('0x30')][_0xd71a('0x32')]?_0x1670f8[_0xd71a('0x30')]:_0x953740[_0xd71a('0x2f')];if(!_0x33f503[_0xd71a('0x2d')][_0xd71a('0x33')](_0xd71a('0x34'))){_0x1670f8[_0xd71a('0x1e')]=qs[_0xd71a('0x1e')](_0x33f503[_0xd71a('0x2d')][_0xd71a('0x1e')]);_0x1670f8[_0xd71a('0x1b')]=qs[_0xd71a('0x1b')](_0x33f503['query'][_0xd71a('0x1b')]);}_0x1670f8['order']=qs[_0xd71a('0x35')](_0x33f503[_0xd71a('0x2d')]['sort']);_0x1670f8[_0xd71a('0x36')]=qs[_0xd71a('0x2e')](_[_0xd71a('0x37')](_0x33f503['query'],_0x953740[_0xd71a('0x2e')]),_0x3a583a);if(_0x33f503[_0xd71a('0x2d')]['filter']){_0x1670f8['where']=_[_0xd71a('0x38')](_0x1670f8[_0xd71a('0x36')],{'$or':_[_0xd71a('0x2c')](_0x3a583a,function(_0x159118){if(_0x159118[_0xd71a('0x2a')]!==_0xd71a('0x39')){var _0x2a2ade={};_0x2a2ade[_0x159118['name']]={'$like':'%'+_0x33f503[_0xd71a('0x2d')][_0xd71a('0x3a')]+'%'};return _0x2a2ade;}})});}_0x1670f8=_['merge']({},_0x1670f8,_0x33f503[_0xd71a('0x3b')]);var _0x4b4067={'where':_0x1670f8['where']};return db['ChatQueueReport'][_0xd71a('0x1d')](_0x4b4067)[_0xd71a('0x23')](function(_0x3e5965){_0x3d234d['count']=_0x3e5965;if(_0x33f503[_0xd71a('0x2d')][_0xd71a('0x3c')]){_0x1670f8[_0xd71a('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x1670f8);})[_0xd71a('0x23')](function(_0x34c7ee){_0x3d234d[_0xd71a('0x3e')]=_0x34c7ee;return _0x3d234d;})['then'](respondWithFilteredResult(_0x405c71,_0x1670f8))[_0xd71a('0x3f')](handleError(_0x405c71,null));};exports[_0xd71a('0x40')]=function(_0x1c1e27,_0x44a255){var _0x48dc3f={'raw':!![],'where':{'id':_0x1c1e27['params']['id']}},_0x4ee62f={};_0x4ee62f['model']=_[_0xd71a('0x41')](db[_0xd71a('0x29')]['rawAttributes']);_0x4ee62f[_0xd71a('0x2d')]=_[_0xd71a('0x41')](_0x1c1e27[_0xd71a('0x2d')]);_0x4ee62f[_0xd71a('0x2e')]=_[_0xd71a('0x42')](_0x4ee62f['model'],_0x4ee62f[_0xd71a('0x2d')]);_0x48dc3f[_0xd71a('0x30')]=_[_0xd71a('0x42')](_0x4ee62f[_0xd71a('0x2f')],qs[_0xd71a('0x31')](_0x1c1e27[_0xd71a('0x2d')][_0xd71a('0x31')]));_0x48dc3f['attributes']=_0x48dc3f[_0xd71a('0x30')][_0xd71a('0x32')]?_0x48dc3f[_0xd71a('0x30')]:_0x4ee62f[_0xd71a('0x2f')];if(_0x1c1e27[_0xd71a('0x2d')][_0xd71a('0x3c')]){_0x48dc3f[_0xd71a('0x3d')]=[{'all':!![]}];}_0x48dc3f=_['merge']({},_0x48dc3f,_0x1c1e27[_0xd71a('0x3b')]);return db[_0xd71a('0x29')]['find'](_0x48dc3f)['then'](handleEntityNotFound(_0x44a255,null))['then'](respondWithResult(_0x44a255,null))[_0xd71a('0x3f')](handleError(_0x44a255,null));};exports['create']=function(_0x219e29,_0x146bdb){return db[_0xd71a('0x29')][_0xd71a('0x43')](_0x219e29[_0xd71a('0x44')],{})[_0xd71a('0x23')](respondWithResult(_0x146bdb,0xc9))[_0xd71a('0x3f')](handleError(_0x146bdb,null));};exports[_0xd71a('0x22')]=function(_0x3c9685,_0x1a557e){if(_0x3c9685['body']['id']){delete _0x3c9685[_0xd71a('0x44')]['id'];}return db[_0xd71a('0x29')]['find']({'where':{'id':_0x3c9685[_0xd71a('0x45')]['id']}})[_0xd71a('0x23')](handleEntityNotFound(_0x1a557e,null))['then'](saveUpdates(_0x3c9685['body'],null))[_0xd71a('0x23')](respondWithResult(_0x1a557e,null))[_0xd71a('0x3f')](handleError(_0x1a557e,null));};exports['destroy']=function(_0x1920d9,_0x499638){return db[_0xd71a('0x29')][_0xd71a('0x46')]({'where':{'id':_0x1920d9['params']['id']}})[_0xd71a('0x23')](handleEntityNotFound(_0x499638,null))[_0xd71a('0x23')](removeEntity(_0x499638,null))[_0xd71a('0x3f')](handleError(_0x499638,null));};exports[_0xd71a('0x47')]=function(_0x49f26c,_0x50d72a){return db['ChatQueueReport'][_0xd71a('0x47')]()['then'](respondWithResult(_0x50d72a,null))[_0xd71a('0x3f')](handleError(_0x50d72a,null));}; \ No newline at end of file +var _0xfc9b=['undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xfc9b,0x74));var _0xbfc9=function(_0x5018b2,_0x30752c){_0x5018b2=_0x5018b2-0x0;var _0x3c5357=_0xfc9b[_0x5018b2];return _0x3c5357;};'use strict';var emlformat=require(_0xbfc9('0x0'));var rimraf=require(_0xbfc9('0x1'));var zipdir=require(_0xbfc9('0x2'));var jsonpatch=require(_0xbfc9('0x3'));var rp=require(_0xbfc9('0x4'));var moment=require(_0xbfc9('0x5'));var BPromise=require(_0xbfc9('0x6'));var Mustache=require('mustache');var util=require(_0xbfc9('0x7'));var path=require('path');var sox=require(_0xbfc9('0x8'));var csv=require(_0xbfc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfc9('0xa'));var _=require(_0xbfc9('0xb'));var squel=require(_0xbfc9('0xc'));var crypto=require(_0xbfc9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbfc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfc9('0xf'));var Papa=require('papaparse');var Redis=require(_0xbfc9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbfc9('0x11'));var as=require(_0xbfc9('0x12'));var hardwareService=require(_0xbfc9('0x13'));var logger=require(_0xbfc9('0x14'))(_0xbfc9('0x15'));var utils=require(_0xbfc9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbfc9('0x17'));var db=require(_0xbfc9('0x18'))['db'];function respondWithStatusCode(_0x57f46c,_0x364b14){_0x364b14=_0x364b14||0xcc;return function(_0x51783e){if(_0x51783e){return _0x57f46c[_0xbfc9('0x19')](_0x364b14);}return _0x57f46c[_0xbfc9('0x1a')](_0x364b14)[_0xbfc9('0x1b')]();};}function respondWithResult(_0x2a5c78,_0x59b8b8){_0x59b8b8=_0x59b8b8||0xc8;return function(_0x3fbad7){if(_0x3fbad7){return _0x2a5c78[_0xbfc9('0x1a')](_0x59b8b8)[_0xbfc9('0x1c')](_0x3fbad7);}};}function respondWithFilteredResult(_0x30c34e,_0x44d984){return function(_0x16a0fc){if(_0x16a0fc){var _0x2bc807=typeof _0x44d984[_0xbfc9('0x1d')]===_0xbfc9('0x1e')&&typeof _0x44d984[_0xbfc9('0x1f')]===_0xbfc9('0x1e');var _0x1b6218=_0x16a0fc[_0xbfc9('0x20')];var _0x21e216=_0x2bc807?0x0:_0x44d984[_0xbfc9('0x1d')];var _0x345e7a=_0x2bc807?_0x16a0fc[_0xbfc9('0x20')]:_0x44d984[_0xbfc9('0x1d')]+_0x44d984[_0xbfc9('0x1f')];var _0x130eba;if(_0x345e7a>=_0x1b6218){_0x345e7a=_0x1b6218;_0x130eba=0xc8;}else{_0x130eba=0xce;}_0x30c34e[_0xbfc9('0x1a')](_0x130eba);return _0x30c34e[_0xbfc9('0x21')]('Content-Range',_0x21e216+'-'+_0x345e7a+'/'+_0x1b6218)[_0xbfc9('0x1c')](_0x16a0fc);}return null;};}function patchUpdates(_0x1217f4){return function(_0x237897){try{jsonpatch[_0xbfc9('0x22')](_0x237897,_0x1217f4,!![]);}catch(_0x2df6b9){return BPromise[_0xbfc9('0x23')](_0x2df6b9);}return _0x237897[_0xbfc9('0x24')]();};}function saveUpdates(_0x3f1603,_0x2e6e5b){return function(_0x3f6c00){if(_0x3f6c00){return _0x3f6c00[_0xbfc9('0x25')](_0x3f1603)[_0xbfc9('0x26')](function(_0x39bc58){return _0x39bc58;});}return null;};}function removeEntity(_0x7012e0,_0x5a3420){return function(_0x1f365f){if(_0x1f365f){return _0x1f365f[_0xbfc9('0x27')]()[_0xbfc9('0x26')](function(){_0x7012e0[_0xbfc9('0x1a')](0xcc)[_0xbfc9('0x1b')]();});}};}function handleEntityNotFound(_0x4ab0ec,_0x4498ed){return function(_0xa64699){if(!_0xa64699){_0x4ab0ec[_0xbfc9('0x19')](0x194);}return _0xa64699;};}function handleError(_0x278d07,_0x1fb58c){_0x1fb58c=_0x1fb58c||0x1f4;return function(_0xfa504){logger[_0xbfc9('0x28')](_0xfa504[_0xbfc9('0x29')]);if(_0xfa504[_0xbfc9('0x2a')]){delete _0xfa504['name'];}_0x278d07['status'](_0x1fb58c)['send'](_0xfa504);};}exports[_0xbfc9('0x2b')]=function(_0x4dd2da,_0x58401b){var _0x123261={},_0x2aa754={},_0xfa1abc={'count':0x0,'rows':[]};var _0x14e1ac=_[_0xbfc9('0x2c')](db[_0xbfc9('0x2d')][_0xbfc9('0x2e')],function(_0x224645){return{'name':_0x224645[_0xbfc9('0x2f')],'type':_0x224645['type'][_0xbfc9('0x30')]};});_0x2aa754[_0xbfc9('0x31')]=_[_0xbfc9('0x2c')](_0x14e1ac,'name');_0x2aa754[_0xbfc9('0x32')]=_[_0xbfc9('0x33')](_0x4dd2da[_0xbfc9('0x32')]);_0x2aa754[_0xbfc9('0x34')]=_[_0xbfc9('0x35')](_0x2aa754[_0xbfc9('0x31')],_0x2aa754[_0xbfc9('0x32')]);_0x123261[_0xbfc9('0x36')]=_[_0xbfc9('0x35')](_0x2aa754[_0xbfc9('0x31')],qs['fields'](_0x4dd2da['query'][_0xbfc9('0x37')]));_0x123261[_0xbfc9('0x36')]=_0x123261[_0xbfc9('0x36')][_0xbfc9('0x38')]?_0x123261[_0xbfc9('0x36')]:_0x2aa754[_0xbfc9('0x31')];if(!_0x4dd2da['query'][_0xbfc9('0x39')]('nolimit')){_0x123261['limit']=qs[_0xbfc9('0x1f')](_0x4dd2da['query'][_0xbfc9('0x1f')]);_0x123261[_0xbfc9('0x1d')]=qs[_0xbfc9('0x1d')](_0x4dd2da['query'][_0xbfc9('0x1d')]);}_0x123261['order']=qs['sort'](_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3a')]);_0x123261['where']=qs[_0xbfc9('0x34')](_['pick'](_0x4dd2da['query'],_0x2aa754[_0xbfc9('0x34')]),_0x14e1ac);if(_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3b')]){_0x123261[_0xbfc9('0x3c')]=_[_0xbfc9('0x3d')](_0x123261[_0xbfc9('0x3c')],{'$or':_[_0xbfc9('0x2c')](_0x14e1ac,function(_0x32d787){if(_0x32d787['type']!==_0xbfc9('0x3e')){var _0x3756d9={};_0x3756d9[_0x32d787['name']]={'$like':'%'+_0x4dd2da['query'][_0xbfc9('0x3b')]+'%'};return _0x3756d9;}})});}_0x123261=_[_0xbfc9('0x3d')]({},_0x123261,_0x4dd2da['options']);var _0xbecdeb={'where':_0x123261[_0xbfc9('0x3c')]};return db[_0xbfc9('0x2d')][_0xbfc9('0x20')](_0xbecdeb)[_0xbfc9('0x26')](function(_0x3d473c){_0xfa1abc[_0xbfc9('0x20')]=_0x3d473c;if(_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3f')]){_0x123261[_0xbfc9('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xbfc9('0x41')](_0x123261);})['then'](function(_0x5c8479){_0xfa1abc[_0xbfc9('0x42')]=_0x5c8479;return _0xfa1abc;})[_0xbfc9('0x26')](respondWithFilteredResult(_0x58401b,_0x123261))['catch'](handleError(_0x58401b,null));};exports[_0xbfc9('0x43')]=function(_0x19a1c0,_0x557795){var _0x18b75d={'raw':!![],'where':{'id':_0x19a1c0[_0xbfc9('0x44')]['id']}},_0x36a0cc={};_0x36a0cc['model']=_['keys'](db[_0xbfc9('0x2d')][_0xbfc9('0x2e')]);_0x36a0cc['query']=_['keys'](_0x19a1c0['query']);_0x36a0cc['filters']=_[_0xbfc9('0x35')](_0x36a0cc[_0xbfc9('0x31')],_0x36a0cc['query']);_0x18b75d[_0xbfc9('0x36')]=_[_0xbfc9('0x35')](_0x36a0cc['model'],qs['fields'](_0x19a1c0['query'][_0xbfc9('0x37')]));_0x18b75d[_0xbfc9('0x36')]=_0x18b75d[_0xbfc9('0x36')][_0xbfc9('0x38')]?_0x18b75d[_0xbfc9('0x36')]:_0x36a0cc[_0xbfc9('0x31')];if(_0x19a1c0[_0xbfc9('0x32')][_0xbfc9('0x3f')]){_0x18b75d[_0xbfc9('0x40')]=[{'all':!![]}];}_0x18b75d=_[_0xbfc9('0x3d')]({},_0x18b75d,_0x19a1c0['options']);return db[_0xbfc9('0x2d')]['find'](_0x18b75d)[_0xbfc9('0x26')](handleEntityNotFound(_0x557795,null))[_0xbfc9('0x26')](respondWithResult(_0x557795,null))[_0xbfc9('0x45')](handleError(_0x557795,null));};exports['create']=function(_0x5e971d,_0x201281){return db[_0xbfc9('0x2d')][_0xbfc9('0x46')](_0x5e971d['body'],{})[_0xbfc9('0x26')](respondWithResult(_0x201281,0xc9))[_0xbfc9('0x45')](handleError(_0x201281,null));};exports['update']=function(_0x192d07,_0x307e72){if(_0x192d07['body']['id']){delete _0x192d07[_0xbfc9('0x47')]['id'];}return db[_0xbfc9('0x2d')]['find']({'where':{'id':_0x192d07[_0xbfc9('0x44')]['id']}})[_0xbfc9('0x26')](handleEntityNotFound(_0x307e72,null))['then'](saveUpdates(_0x192d07[_0xbfc9('0x47')],null))[_0xbfc9('0x26')](respondWithResult(_0x307e72,null))['catch'](handleError(_0x307e72,null));};exports['destroy']=function(_0x340520,_0x33a8d7){return db[_0xbfc9('0x2d')]['find']({'where':{'id':_0x340520[_0xbfc9('0x44')]['id']}})[_0xbfc9('0x26')](handleEntityNotFound(_0x33a8d7,null))[_0xbfc9('0x26')](removeEntity(_0x33a8d7,null))['catch'](handleError(_0x33a8d7,null));};exports[_0xbfc9('0x48')]=function(_0x3abd7d,_0x4f8ca9){return db[_0xbfc9('0x2d')][_0xbfc9('0x48')]()[_0xbfc9('0x26')](respondWithResult(_0x4f8ca9,null))[_0xbfc9('0x45')](handleError(_0x4f8ca9,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7bb5d5e..faabd2f 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x50fcf4,_0xdec281){var _0x39707a=function(_0xe8eb58){while(--_0xe8eb58){_0x50fcf4['push'](_0x50fcf4['shift']());}};_0x39707a(++_0xdec281);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x51ee3a,_0x45c713){var _0x138cd3=function(_0x51ec8f){while(--_0x51ec8f){_0x51ee3a['push'](_0x51ee3a['shift']());}};_0x138cd3(++_0x45c713);}(_0x757a,0xde));var _0xa757=function(_0x18c899,_0x572bb3){_0x18c899=_0x18c899-0x0;var _0x37e7a4=_0x757a[_0x18c899];return _0x37e7a4;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c4b8511..0d7c035 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 _0x4a96=['then','debug','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','randomstring','../../config/utils','rpc','jayson/promise','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw'];(function(_0x42573b,_0x477c37){var _0xd0b56e=function(_0x42857c){while(--_0x42857c){_0x42573b['push'](_0x42573b['shift']());}};_0xd0b56e(++_0x477c37);}(_0x4a96,0x19d));var _0x64a9=function(_0x4fbdad,_0x42b22d){_0x4fbdad=_0x4fbdad-0x0;var _0xfa7d38=_0x4a96[_0x4fbdad];return _0xfa7d38;};'use strict';var _=require(_0x64a9('0x0'));var util=require(_0x64a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x64a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x64a9('0x3'));var logger=require('../../config/logger')(_0x64a9('0x4'));var config=require('../../config/environment');var jayson=require(_0x64a9('0x5'));var client=jayson['client'][_0x64a9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x700b39,_0x3b9a73,_0x35f5f0){return new BPromise(function(_0x212e7b,_0x25f0c1){return client['request'](_0x700b39,_0x35f5f0)['then'](function(_0x501083){logger[_0x64a9('0x7')](_0x64a9('0x8'),_0x3b9a73,'request\x20sent');logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3b9a73,_0x64a9('0x9'),JSON[_0x64a9('0xa')](_0x501083));if(_0x501083[_0x64a9('0xb')]){if(_0x501083[_0x64a9('0xb')][_0x64a9('0xc')]===0x1f4){logger[_0x64a9('0xb')](_0x64a9('0x8'),_0x3b9a73,_0x501083[_0x64a9('0xb')]['message']);return _0x25f0c1(_0x501083[_0x64a9('0xb')][_0x64a9('0xd')]);}logger[_0x64a9('0xb')](_0x64a9('0x8'),_0x3b9a73,_0x501083[_0x64a9('0xb')][_0x64a9('0xd')]);return _0x212e7b(_0x501083[_0x64a9('0xb')][_0x64a9('0xd')]);}else{logger['info'](_0x64a9('0x8'),_0x3b9a73,_0x64a9('0x9'));_0x212e7b(_0x501083[_0x64a9('0xe')][_0x64a9('0xd')]);}})[_0x64a9('0xf')](function(_0x19b10c){logger[_0x64a9('0xb')](_0x64a9('0x8'),_0x3b9a73,_0x19b10c);_0x25f0c1(_0x19b10c);});});}exports[_0x64a9('0x10')]=function(_0x1a9efc){var _0x54e39a=this;return new Promise(function(_0x24ea52,_0xe60e61){return db[_0x64a9('0x11')][_0x64a9('0x12')](_0x1a9efc[_0x64a9('0x13')],{'raw':_0x1a9efc[_0x64a9('0x14')]?_0x1a9efc[_0x64a9('0x14')][_0x64a9('0x15')]===undefined?!![]:![]:!![]})[_0x64a9('0x16')](function(_0x44d76c){logger['info'](_0x64a9('0x10'),_0x1a9efc);logger[_0x64a9('0x17')](_0x64a9('0x10'),_0x1a9efc,JSON[_0x64a9('0xa')](_0x44d76c));_0x24ea52(_0x44d76c);})[_0x64a9('0xf')](function(_0x4fd11f){logger[_0x64a9('0xb')](_0x64a9('0x10'),_0x4fd11f[_0x64a9('0xd')],_0x1a9efc);_0xe60e61(_0x54e39a[_0x64a9('0xb')](0x1f4,_0x4fd11f[_0x64a9('0xd')]));});});};exports[_0x64a9('0x18')]=function(_0x50d8cf){var _0x563971=this;return new Promise(function(_0x4153ec,_0x52b604){return db[_0x64a9('0x11')][_0x64a9('0x19')](_0x50d8cf[_0x64a9('0x13')],{'raw':_0x50d8cf[_0x64a9('0x14')]?_0x50d8cf['options'][_0x64a9('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d8cf[_0x64a9('0x14')]?_0x50d8cf[_0x64a9('0x14')][_0x64a9('0x1a')]||null:null,'attributes':_0x50d8cf[_0x64a9('0x14')]?_0x50d8cf[_0x64a9('0x14')][_0x64a9('0x1b')]||null:null,'limit':_0x50d8cf['options']?_0x50d8cf['options'][_0x64a9('0x1c')]||null:null})[_0x64a9('0x16')](function(_0x565807){logger['info']('UpdateChatQueueReport',_0x50d8cf);logger[_0x64a9('0x17')](_0x64a9('0x18'),_0x50d8cf,JSON['stringify'](_0x565807));_0x4153ec(_0x565807);})[_0x64a9('0xf')](function(_0x2bf43c){logger[_0x64a9('0xb')](_0x64a9('0x18'),_0x2bf43c['message'],_0x50d8cf);_0x52b604(_0x563971[_0x64a9('0xb')](0x1f4,_0x2bf43c[_0x64a9('0xd')]));});});}; \ No newline at end of file +var _0xe619=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s'];(function(_0x444381,_0x252632){var _0x26acd2=function(_0x2f9282){while(--_0x2f9282){_0x444381['push'](_0x444381['shift']());}};_0x26acd2(++_0x252632);}(_0xe619,0xc2));var _0x9e61=function(_0x48efc4,_0x4035c0){_0x48efc4=_0x48efc4-0x0;var _0x151c20=_0xe619[_0x48efc4];return _0x151c20;};'use strict';var _=require(_0x9e61('0x0'));var util=require(_0x9e61('0x1'));var moment=require(_0x9e61('0x2'));var BPromise=require(_0x9e61('0x3'));var rs=require(_0x9e61('0x4'));var fs=require('fs');var Redis=require(_0x9e61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e61('0x6'));var logger=require(_0x9e61('0x7'))(_0x9e61('0x8'));var config=require(_0x9e61('0x9'));var jayson=require(_0x9e61('0xa'));var client=jayson[_0x9e61('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303664,_0x4fb1d9,_0x13470c){return new BPromise(function(_0x58cef2,_0x4a11eb){return client[_0x9e61('0xc')](_0x303664,_0x13470c)[_0x9e61('0xd')](function(_0x5836de){logger[_0x9e61('0xe')](_0x9e61('0xf'),_0x4fb1d9,'request\x20sent');logger[_0x9e61('0x10')](_0x9e61('0x11'),_0x4fb1d9,'request\x20sent',JSON[_0x9e61('0x12')](_0x5836de));if(_0x5836de[_0x9e61('0x13')]){if(_0x5836de[_0x9e61('0x13')][_0x9e61('0x14')]===0x1f4){logger['error'](_0x9e61('0xf'),_0x4fb1d9,_0x5836de['error'][_0x9e61('0x15')]);return _0x4a11eb(_0x5836de[_0x9e61('0x13')]['message']);}logger[_0x9e61('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x4fb1d9,_0x5836de[_0x9e61('0x13')]['message']);return _0x58cef2(_0x5836de[_0x9e61('0x13')][_0x9e61('0x15')]);}else{logger[_0x9e61('0xe')](_0x9e61('0xf'),_0x4fb1d9,_0x9e61('0x16'));_0x58cef2(_0x5836de[_0x9e61('0x17')][_0x9e61('0x15')]);}})[_0x9e61('0x18')](function(_0x10b16e){logger[_0x9e61('0x13')](_0x9e61('0xf'),_0x4fb1d9,_0x10b16e);_0x4a11eb(_0x10b16e);});});}exports['CreateChatQueueReport']=function(_0x411b35){var _0x1c936d=this;return new Promise(function(_0x176473,_0x2df719){return db[_0x9e61('0x19')][_0x9e61('0x1a')](_0x411b35[_0x9e61('0x1b')],{'raw':_0x411b35[_0x9e61('0x1c')]?_0x411b35[_0x9e61('0x1c')][_0x9e61('0x1d')]===undefined?!![]:![]:!![]})[_0x9e61('0xd')](function(_0x480a94){logger[_0x9e61('0xe')]('CreateChatQueueReport',_0x411b35);logger[_0x9e61('0x10')]('CreateChatQueueReport',_0x411b35,JSON['stringify'](_0x480a94));_0x176473(_0x480a94);})[_0x9e61('0x18')](function(_0x411b11){logger[_0x9e61('0x13')](_0x9e61('0x1e'),_0x411b11[_0x9e61('0x15')],_0x411b35);_0x2df719(_0x1c936d[_0x9e61('0x13')](0x1f4,_0x411b11[_0x9e61('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x5e5432){var _0x1c650e=this;return new Promise(function(_0x4ec23e,_0x41f41b){return db['ChatQueueReport']['update'](_0x5e5432[_0x9e61('0x1b')],{'raw':_0x5e5432[_0x9e61('0x1c')]?_0x5e5432['options'][_0x9e61('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e5432[_0x9e61('0x1c')]?_0x5e5432[_0x9e61('0x1c')][_0x9e61('0x1f')]||null:null,'attributes':_0x5e5432['options']?_0x5e5432[_0x9e61('0x1c')][_0x9e61('0x20')]||null:null,'limit':_0x5e5432[_0x9e61('0x1c')]?_0x5e5432[_0x9e61('0x1c')][_0x9e61('0x21')]||null:null})[_0x9e61('0xd')](function(_0x3575f8){logger[_0x9e61('0xe')](_0x9e61('0x22'),_0x5e5432);logger[_0x9e61('0x10')](_0x9e61('0x22'),_0x5e5432,JSON['stringify'](_0x3575f8));_0x4ec23e(_0x3575f8);})[_0x9e61('0x18')](function(_0x3ae117){logger['error'](_0x9e61('0x22'),_0x3ae117['message'],_0x5e5432);_0x41f41b(_0x1c650e[_0x9e61('0x13')](0x1f4,_0x3ae117[_0x9e61('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ddc3e2c..f4ee44c 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 _0xaf03=['delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x5ced8b,_0x5f0335){var _0x535973=function(_0x44bf74){while(--_0x44bf74){_0x5ced8b['push'](_0x5ced8b['shift']());}};_0x535973(++_0x5f0335);}(_0xaf03,0x81));var _0x3af0=function(_0x199adf,_0x56138c){_0x199adf=_0x199adf-0x0;var _0xbc4796=_0xaf03[_0x199adf];return _0xbc4796;};'use strict';var multer=require(_0x3af0('0x0'));var util=require(_0x3af0('0x1'));var path=require('path');var timeout=require(_0x3af0('0x2'));var express=require(_0x3af0('0x3'));var router=express['Router']();var fs_extra=require(_0x3af0('0x4'));var auth=require(_0x3af0('0x5'));var interaction=require(_0x3af0('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x3af0('0x7')]('/',auth[_0x3af0('0x8')](),controller['index']);router[_0x3af0('0x7')](_0x3af0('0x9'),auth[_0x3af0('0x8')](),controller['describe']);router[_0x3af0('0x7')](_0x3af0('0xa'),auth[_0x3af0('0x8')](),controller[_0x3af0('0xb')]);router[_0x3af0('0xc')]('/',auth['isAuthenticated'](),controller[_0x3af0('0xd')]);router[_0x3af0('0xe')]('/:id',auth[_0x3af0('0x8')](),controller['update']);router[_0x3af0('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3af0('0x10')]);module[_0x3af0('0x11')]=router; \ No newline at end of file +var _0x3e64=['/:id','update','delete','destroy','exports','multer','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','show','post','create','put'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3e64,0x65));var _0x43e6=function(_0x35919e,_0x5f5125){_0x35919e=_0x35919e-0x0;var _0x1c6b07=_0x3e64[_0x35919e];return _0x1c6b07;};'use strict';var multer=require(_0x43e6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x43e6('0x1')]();var fs_extra=require(_0x43e6('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x43e6('0x3'));var controller=require('./chatQueueReport.controller');router[_0x43e6('0x4')]('/',auth[_0x43e6('0x5')](),controller['index']);router['get'](_0x43e6('0x6'),auth[_0x43e6('0x5')](),controller['describe']);router[_0x43e6('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x43e6('0x7')]);router[_0x43e6('0x8')]('/',auth['isAuthenticated'](),controller[_0x43e6('0x9')]);router[_0x43e6('0xa')](_0x43e6('0xb'),auth[_0x43e6('0x5')](),controller[_0x43e6('0xc')]);router[_0x43e6('0xd')]('/:id',auth[_0x43e6('0x5')](),controller[_0x43e6('0xe')]);module[_0x43e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c0fc663..ad19017 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xa0ad36,_0x2d78ac){var _0x4d488e=function(_0x35639f){while(--_0x35639f){_0xa0ad36['push'](_0xa0ad36['shift']());}};_0x4d488e(++_0x2d78ac);}(_0xf4eb,0xec));var _0xbf4e=function(_0x11a879,_0x42fbe9){_0x11a879=_0x11a879-0x0;var _0x20f78e=_0xf4eb[_0x11a879];return _0x20f78e;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2429b8,_0x567191){var _0x26d1e7=function(_0x3735e1){while(--_0x3735e1){_0x2429b8['push'](_0x2429b8['shift']());}};_0x26d1e7(++_0x567191);}(_0x70e0,0x17b));var _0x070e=function(_0xd4b76e,_0x3b01d3){_0xd4b76e=_0xd4b76e-0x0;var _0x1f9457=_0x70e0[_0xd4b76e];return _0x1f9457;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8a0991d..eb1ac3b 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 _0x9722=['include','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x1708fd,_0x100ae2){var _0x3c8001=function(_0xdf4020){while(--_0xdf4020){_0x1708fd['push'](_0x1708fd['shift']());}};_0x3c8001(++_0x100ae2);}(_0x9722,0x1bc));var _0x2972=function(_0x423cde,_0x5b8905){_0x423cde=_0x423cde-0x0;var _0x2f074b=_0x9722[_0x423cde];return _0x2f074b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2972('0x0'));var zipdir=require(_0x2972('0x1'));var jsonpatch=require(_0x2972('0x2'));var rp=require('request-promise');var moment=require(_0x2972('0x3'));var BPromise=require(_0x2972('0x4'));var Mustache=require('mustache');var util=require(_0x2972('0x5'));var path=require(_0x2972('0x6'));var sox=require(_0x2972('0x7'));var csv=require(_0x2972('0x8'));var ejs=require(_0x2972('0x9'));var fs=require('fs');var fs_extra=require(_0x2972('0xa'));var _=require(_0x2972('0xb'));var squel=require(_0x2972('0xc'));var crypto=require(_0x2972('0xd'));var jsforce=require(_0x2972('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2972('0x8'));var querystring=require(_0x2972('0xf'));var Papa=require('papaparse');var Redis=require(_0x2972('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2972('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2972('0x12'));var logger=require(_0x2972('0x13'))('api');var utils=require(_0x2972('0x14'));var config=require(_0x2972('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2972('0x16'))['db'];function respondWithStatusCode(_0x2212b2,_0x21bee6){_0x21bee6=_0x21bee6||0xcc;return function(_0x18bb3f){if(_0x18bb3f){return _0x2212b2[_0x2972('0x17')](_0x21bee6);}return _0x2212b2[_0x2972('0x18')](_0x21bee6)['end']();};}function respondWithResult(_0x4edb49,_0x55762c){_0x55762c=_0x55762c||0xc8;return function(_0x10a048){if(_0x10a048){return _0x4edb49[_0x2972('0x18')](_0x55762c)[_0x2972('0x19')](_0x10a048);}};}function respondWithFilteredResult(_0x129a2b,_0x1d0203){return function(_0x4ab94f){if(_0x4ab94f){var _0x52ce19=typeof _0x1d0203[_0x2972('0x1a')]==='undefined'&&typeof _0x1d0203[_0x2972('0x1b')]===_0x2972('0x1c');var _0x30c517=_0x4ab94f[_0x2972('0x1d')];var _0x1e4a34=_0x52ce19?0x0:_0x1d0203['offset'];var _0x20532d=_0x52ce19?_0x4ab94f[_0x2972('0x1d')]:_0x1d0203[_0x2972('0x1a')]+_0x1d0203[_0x2972('0x1b')];var _0x3b85b2;if(_0x20532d>=_0x30c517){_0x20532d=_0x30c517;_0x3b85b2=0xc8;}else{_0x3b85b2=0xce;}_0x129a2b[_0x2972('0x18')](_0x3b85b2);return _0x129a2b[_0x2972('0x1e')](_0x2972('0x1f'),_0x1e4a34+'-'+_0x20532d+'/'+_0x30c517)[_0x2972('0x19')](_0x4ab94f);}return null;};}function patchUpdates(_0x3a5e7a){return function(_0x3ee871){try{jsonpatch[_0x2972('0x20')](_0x3ee871,_0x3a5e7a,!![]);}catch(_0x4ca6c5){return BPromise[_0x2972('0x21')](_0x4ca6c5);}return _0x3ee871[_0x2972('0x22')]();};}function saveUpdates(_0x23a816,_0x1d8efe){return function(_0x35055c){if(_0x35055c){return _0x35055c[_0x2972('0x23')](_0x23a816)[_0x2972('0x24')](function(_0x59e528){return _0x59e528;});}return null;};}function removeEntity(_0x5f37d8,_0x542f72){return function(_0x7c58c5){if(_0x7c58c5){return _0x7c58c5[_0x2972('0x25')]()['then'](function(){_0x5f37d8[_0x2972('0x18')](0xcc)[_0x2972('0x26')]();});}};}function handleEntityNotFound(_0xefbe6b,_0x7a8ddf){return function(_0x1038eb){if(!_0x1038eb){_0xefbe6b[_0x2972('0x17')](0x194);}return _0x1038eb;};}function handleError(_0x921ecc,_0xd24640){_0xd24640=_0xd24640||0x1f4;return function(_0x58b85f){logger['error'](_0x58b85f['stack']);if(_0x58b85f['name']){delete _0x58b85f[_0x2972('0x27')];}_0x921ecc[_0x2972('0x18')](_0xd24640)[_0x2972('0x28')](_0x58b85f);};}exports['index']=function(_0x22cf6d,_0x5b3c89){var _0x42af00={},_0x28c6b4={},_0xdbeaa7={'count':0x0,'rows':[]};var _0x11d87e=_[_0x2972('0x29')](db[_0x2972('0x2a')][_0x2972('0x2b')],function(_0x2ebd3d){return{'name':_0x2ebd3d[_0x2972('0x2c')],'type':_0x2ebd3d[_0x2972('0x2d')][_0x2972('0x2e')]};});_0x28c6b4['model']=_[_0x2972('0x29')](_0x11d87e,_0x2972('0x27'));_0x28c6b4[_0x2972('0x2f')]=_[_0x2972('0x30')](_0x22cf6d[_0x2972('0x2f')]);_0x28c6b4[_0x2972('0x31')]=_[_0x2972('0x32')](_0x28c6b4[_0x2972('0x33')],_0x28c6b4[_0x2972('0x2f')]);_0x42af00[_0x2972('0x34')]=_[_0x2972('0x32')](_0x28c6b4['model'],qs[_0x2972('0x35')](_0x22cf6d['query'][_0x2972('0x35')]));_0x42af00['attributes']=_0x42af00[_0x2972('0x34')]['length']?_0x42af00[_0x2972('0x34')]:_0x28c6b4['model'];if(!_0x22cf6d[_0x2972('0x2f')][_0x2972('0x36')](_0x2972('0x37'))){_0x42af00['limit']=qs['limit'](_0x22cf6d['query'][_0x2972('0x1b')]);_0x42af00[_0x2972('0x1a')]=qs[_0x2972('0x1a')](_0x22cf6d['query'][_0x2972('0x1a')]);}_0x42af00[_0x2972('0x38')]=qs[_0x2972('0x39')](_0x22cf6d[_0x2972('0x2f')][_0x2972('0x39')]);_0x42af00[_0x2972('0x3a')]=qs[_0x2972('0x31')](_['pick'](_0x22cf6d[_0x2972('0x2f')],_0x28c6b4[_0x2972('0x31')]),_0x11d87e);if(_0x22cf6d[_0x2972('0x2f')][_0x2972('0x3b')]){_0x42af00[_0x2972('0x3a')]=_['merge'](_0x42af00[_0x2972('0x3a')],{'$or':_['map'](_0x11d87e,function(_0x5a6f90){if(_0x5a6f90[_0x2972('0x2d')]!=='VIRTUAL'){var _0x2536d5={};_0x2536d5[_0x5a6f90[_0x2972('0x27')]]={'$like':'%'+_0x22cf6d[_0x2972('0x2f')][_0x2972('0x3b')]+'%'};return _0x2536d5;}})});}_0x42af00=_['merge']({},_0x42af00,_0x22cf6d[_0x2972('0x3c')]);var _0x4beb48={'where':_0x42af00[_0x2972('0x3a')]};return db[_0x2972('0x2a')][_0x2972('0x1d')](_0x4beb48)[_0x2972('0x24')](function(_0x17024b){_0xdbeaa7[_0x2972('0x1d')]=_0x17024b;if(_0x22cf6d[_0x2972('0x2f')][_0x2972('0x3d')]){_0x42af00['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x2972('0x3e')](_0x42af00);})[_0x2972('0x24')](function(_0x53f41d){_0xdbeaa7[_0x2972('0x3f')]=_0x53f41d;return _0xdbeaa7;})[_0x2972('0x24')](respondWithFilteredResult(_0x5b3c89,_0x42af00))[_0x2972('0x40')](handleError(_0x5b3c89,null));};exports[_0x2972('0x41')]=function(_0x545678,_0x1a6643){var _0x5692fb={'raw':!![],'where':{'id':_0x545678[_0x2972('0x42')]['id']}},_0x3b6fc2={};_0x3b6fc2['model']=_['keys'](db[_0x2972('0x2a')][_0x2972('0x2b')]);_0x3b6fc2[_0x2972('0x2f')]=_['keys'](_0x545678['query']);_0x3b6fc2[_0x2972('0x31')]=_['intersection'](_0x3b6fc2['model'],_0x3b6fc2[_0x2972('0x2f')]);_0x5692fb['attributes']=_['intersection'](_0x3b6fc2['model'],qs[_0x2972('0x35')](_0x545678[_0x2972('0x2f')][_0x2972('0x35')]));_0x5692fb[_0x2972('0x34')]=_0x5692fb[_0x2972('0x34')]['length']?_0x5692fb[_0x2972('0x34')]:_0x3b6fc2[_0x2972('0x33')];if(_0x545678['query'][_0x2972('0x3d')]){_0x5692fb[_0x2972('0x43')]=[{'all':!![]}];}_0x5692fb=_[_0x2972('0x44')]({},_0x5692fb,_0x545678[_0x2972('0x3c')]);return db[_0x2972('0x2a')][_0x2972('0x45')](_0x5692fb)[_0x2972('0x24')](handleEntityNotFound(_0x1a6643,null))[_0x2972('0x24')](respondWithResult(_0x1a6643,null))['catch'](handleError(_0x1a6643,null));};exports[_0x2972('0x46')]=function(_0x5dba38,_0x1b36ec){return db['ChatTransferReport'][_0x2972('0x46')](_0x5dba38[_0x2972('0x47')],{})['then'](respondWithResult(_0x1b36ec,0xc9))['catch'](handleError(_0x1b36ec,null));};exports['update']=function(_0x3aa708,_0x4e1aa5){if(_0x3aa708['body']['id']){delete _0x3aa708[_0x2972('0x47')]['id'];}return db['ChatTransferReport'][_0x2972('0x45')]({'where':{'id':_0x3aa708[_0x2972('0x42')]['id']}})[_0x2972('0x24')](handleEntityNotFound(_0x4e1aa5,null))['then'](saveUpdates(_0x3aa708['body'],null))['then'](respondWithResult(_0x4e1aa5,null))[_0x2972('0x40')](handleError(_0x4e1aa5,null));};exports['destroy']=function(_0x546fd9,_0x5709b4){return db[_0x2972('0x2a')][_0x2972('0x45')]({'where':{'id':_0x546fd9[_0x2972('0x42')]['id']}})[_0x2972('0x24')](handleEntityNotFound(_0x5709b4,null))[_0x2972('0x24')](removeEntity(_0x5709b4,null))[_0x2972('0x40')](handleError(_0x5709b4,null));};exports['describe']=function(_0x478e47,_0x57580c){return db[_0x2972('0x2a')][_0x2972('0x48')]()['then'](respondWithResult(_0x57580c,null))[_0x2972('0x40')](handleError(_0x57580c,null));}; \ No newline at end of file +var _0x5d80=['json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','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','sendStatus','status','end','undefined','limit','offset','count','set'];(function(_0x5292b2,_0x376784){var _0x12bd10=function(_0x3e2f14){while(--_0x3e2f14){_0x5292b2['push'](_0x5292b2['shift']());}};_0x12bd10(++_0x376784);}(_0x5d80,0x1b2));var _0x05d8=function(_0x574812,_0x1dc686){_0x574812=_0x574812-0x0;var _0x1eae42=_0x5d80[_0x574812];return _0x1eae42;};'use strict';var emlformat=require(_0x05d8('0x0'));var rimraf=require(_0x05d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05d8('0x2'));var rp=require(_0x05d8('0x3'));var moment=require(_0x05d8('0x4'));var BPromise=require(_0x05d8('0x5'));var Mustache=require(_0x05d8('0x6'));var util=require(_0x05d8('0x7'));var path=require('path');var sox=require(_0x05d8('0x8'));var csv=require(_0x05d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05d8('0xa'));var _=require(_0x05d8('0xb'));var squel=require('squel');var crypto=require(_0x05d8('0xc'));var jsforce=require(_0x05d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x05d8('0x9'));var querystring=require(_0x05d8('0xe'));var Papa=require(_0x05d8('0xf'));var Redis=require(_0x05d8('0x10'));var authService=require(_0x05d8('0x11'));var qs=require(_0x05d8('0x12'));var as=require(_0x05d8('0x13'));var hardwareService=require(_0x05d8('0x14'));var logger=require(_0x05d8('0x15'))('api');var utils=require(_0x05d8('0x16'));var config=require(_0x05d8('0x17'));var licenseUtil=require(_0x05d8('0x18'));var db=require(_0x05d8('0x19'))['db'];function respondWithStatusCode(_0x4a1f4a,_0x260413){_0x260413=_0x260413||0xcc;return function(_0x1fd310){if(_0x1fd310){return _0x4a1f4a[_0x05d8('0x1a')](_0x260413);}return _0x4a1f4a[_0x05d8('0x1b')](_0x260413)[_0x05d8('0x1c')]();};}function respondWithResult(_0x59dfc4,_0x2ecefb){_0x2ecefb=_0x2ecefb||0xc8;return function(_0x43224b){if(_0x43224b){return _0x59dfc4[_0x05d8('0x1b')](_0x2ecefb)['json'](_0x43224b);}};}function respondWithFilteredResult(_0x2ea8e2,_0x1e699c){return function(_0x26cff6){if(_0x26cff6){var _0x545ec5=typeof _0x1e699c['offset']===_0x05d8('0x1d')&&typeof _0x1e699c[_0x05d8('0x1e')]===_0x05d8('0x1d');var _0x355a86=_0x26cff6['count'];var _0x4cb615=_0x545ec5?0x0:_0x1e699c[_0x05d8('0x1f')];var _0x3f80aa=_0x545ec5?_0x26cff6[_0x05d8('0x20')]:_0x1e699c[_0x05d8('0x1f')]+_0x1e699c[_0x05d8('0x1e')];var _0x57ecd3;if(_0x3f80aa>=_0x355a86){_0x3f80aa=_0x355a86;_0x57ecd3=0xc8;}else{_0x57ecd3=0xce;}_0x2ea8e2[_0x05d8('0x1b')](_0x57ecd3);return _0x2ea8e2[_0x05d8('0x21')]('Content-Range',_0x4cb615+'-'+_0x3f80aa+'/'+_0x355a86)[_0x05d8('0x22')](_0x26cff6);}return null;};}function patchUpdates(_0x4885a2){return function(_0x50d70a){try{jsonpatch[_0x05d8('0x23')](_0x50d70a,_0x4885a2,!![]);}catch(_0x264f80){return BPromise[_0x05d8('0x24')](_0x264f80);}return _0x50d70a[_0x05d8('0x25')]();};}function saveUpdates(_0x478dcb,_0x4aa3cd){return function(_0x3f035f){if(_0x3f035f){return _0x3f035f[_0x05d8('0x26')](_0x478dcb)[_0x05d8('0x27')](function(_0x10f2cd){return _0x10f2cd;});}return null;};}function removeEntity(_0x2a4101,_0x275247){return function(_0x2c716d){if(_0x2c716d){return _0x2c716d[_0x05d8('0x28')]()[_0x05d8('0x27')](function(){_0x2a4101['status'](0xcc)[_0x05d8('0x1c')]();});}};}function handleEntityNotFound(_0x39570c,_0x3dbf89){return function(_0x1bd2de){if(!_0x1bd2de){_0x39570c[_0x05d8('0x1a')](0x194);}return _0x1bd2de;};}function handleError(_0x48b439,_0x4bd549){_0x4bd549=_0x4bd549||0x1f4;return function(_0x2c0722){logger['error'](_0x2c0722[_0x05d8('0x29')]);if(_0x2c0722[_0x05d8('0x2a')]){delete _0x2c0722[_0x05d8('0x2a')];}_0x48b439[_0x05d8('0x1b')](_0x4bd549)[_0x05d8('0x2b')](_0x2c0722);};}exports[_0x05d8('0x2c')]=function(_0x509902,_0x58a347){var _0x20f06d={},_0x3d63f7={},_0x1bf63={'count':0x0,'rows':[]};var _0x1ebd45=_[_0x05d8('0x2d')](db[_0x05d8('0x2e')]['rawAttributes'],function(_0x156845){return{'name':_0x156845[_0x05d8('0x2f')],'type':_0x156845['type'][_0x05d8('0x30')]};});_0x3d63f7[_0x05d8('0x31')]=_['map'](_0x1ebd45,_0x05d8('0x2a'));_0x3d63f7[_0x05d8('0x32')]=_[_0x05d8('0x33')](_0x509902[_0x05d8('0x32')]);_0x3d63f7[_0x05d8('0x34')]=_[_0x05d8('0x35')](_0x3d63f7[_0x05d8('0x31')],_0x3d63f7[_0x05d8('0x32')]);_0x20f06d[_0x05d8('0x36')]=_[_0x05d8('0x35')](_0x3d63f7[_0x05d8('0x31')],qs['fields'](_0x509902[_0x05d8('0x32')]['fields']));_0x20f06d[_0x05d8('0x36')]=_0x20f06d['attributes'][_0x05d8('0x37')]?_0x20f06d['attributes']:_0x3d63f7['model'];if(!_0x509902['query'][_0x05d8('0x38')](_0x05d8('0x39'))){_0x20f06d[_0x05d8('0x1e')]=qs[_0x05d8('0x1e')](_0x509902[_0x05d8('0x32')][_0x05d8('0x1e')]);_0x20f06d[_0x05d8('0x1f')]=qs[_0x05d8('0x1f')](_0x509902['query'][_0x05d8('0x1f')]);}_0x20f06d[_0x05d8('0x3a')]=qs['sort'](_0x509902[_0x05d8('0x32')][_0x05d8('0x3b')]);_0x20f06d[_0x05d8('0x3c')]=qs['filters'](_[_0x05d8('0x3d')](_0x509902[_0x05d8('0x32')],_0x3d63f7['filters']),_0x1ebd45);if(_0x509902[_0x05d8('0x32')][_0x05d8('0x3e')]){_0x20f06d[_0x05d8('0x3c')]=_['merge'](_0x20f06d[_0x05d8('0x3c')],{'$or':_[_0x05d8('0x2d')](_0x1ebd45,function(_0x5f43d9){if(_0x5f43d9[_0x05d8('0x3f')]!=='VIRTUAL'){var _0x3971d9={};_0x3971d9[_0x5f43d9['name']]={'$like':'%'+_0x509902[_0x05d8('0x32')][_0x05d8('0x3e')]+'%'};return _0x3971d9;}})});}_0x20f06d=_[_0x05d8('0x40')]({},_0x20f06d,_0x509902[_0x05d8('0x41')]);var _0x40e0ae={'where':_0x20f06d[_0x05d8('0x3c')]};return db[_0x05d8('0x2e')][_0x05d8('0x20')](_0x40e0ae)['then'](function(_0x3bdcd5){_0x1bf63[_0x05d8('0x20')]=_0x3bdcd5;if(_0x509902[_0x05d8('0x32')][_0x05d8('0x42')]){_0x20f06d['include']=[{'all':!![]}];}return db[_0x05d8('0x2e')][_0x05d8('0x43')](_0x20f06d);})['then'](function(_0x11de85){_0x1bf63[_0x05d8('0x44')]=_0x11de85;return _0x1bf63;})[_0x05d8('0x27')](respondWithFilteredResult(_0x58a347,_0x20f06d))[_0x05d8('0x45')](handleError(_0x58a347,null));};exports[_0x05d8('0x46')]=function(_0x12fcf6,_0x2dda0b){var _0x1d3a2a={'raw':!![],'where':{'id':_0x12fcf6[_0x05d8('0x47')]['id']}},_0x46a7a2={};_0x46a7a2[_0x05d8('0x31')]=_[_0x05d8('0x33')](db['ChatTransferReport'][_0x05d8('0x48')]);_0x46a7a2[_0x05d8('0x32')]=_[_0x05d8('0x33')](_0x12fcf6[_0x05d8('0x32')]);_0x46a7a2['filters']=_[_0x05d8('0x35')](_0x46a7a2[_0x05d8('0x31')],_0x46a7a2['query']);_0x1d3a2a[_0x05d8('0x36')]=_[_0x05d8('0x35')](_0x46a7a2['model'],qs['fields'](_0x12fcf6['query']['fields']));_0x1d3a2a[_0x05d8('0x36')]=_0x1d3a2a[_0x05d8('0x36')][_0x05d8('0x37')]?_0x1d3a2a[_0x05d8('0x36')]:_0x46a7a2[_0x05d8('0x31')];if(_0x12fcf6[_0x05d8('0x32')][_0x05d8('0x42')]){_0x1d3a2a[_0x05d8('0x49')]=[{'all':!![]}];}_0x1d3a2a=_['merge']({},_0x1d3a2a,_0x12fcf6[_0x05d8('0x41')]);return db[_0x05d8('0x2e')][_0x05d8('0x4a')](_0x1d3a2a)['then'](handleEntityNotFound(_0x2dda0b,null))['then'](respondWithResult(_0x2dda0b,null))[_0x05d8('0x45')](handleError(_0x2dda0b,null));};exports[_0x05d8('0x4b')]=function(_0x3a6268,_0x22b9cb){return db[_0x05d8('0x2e')][_0x05d8('0x4b')](_0x3a6268['body'],{})[_0x05d8('0x27')](respondWithResult(_0x22b9cb,0xc9))[_0x05d8('0x45')](handleError(_0x22b9cb,null));};exports[_0x05d8('0x26')]=function(_0x3e48c2,_0x3e8f77){if(_0x3e48c2[_0x05d8('0x4c')]['id']){delete _0x3e48c2[_0x05d8('0x4c')]['id'];}return db[_0x05d8('0x2e')][_0x05d8('0x4a')]({'where':{'id':_0x3e48c2['params']['id']}})[_0x05d8('0x27')](handleEntityNotFound(_0x3e8f77,null))[_0x05d8('0x27')](saveUpdates(_0x3e48c2['body'],null))[_0x05d8('0x27')](respondWithResult(_0x3e8f77,null))[_0x05d8('0x45')](handleError(_0x3e8f77,null));};exports[_0x05d8('0x28')]=function(_0x40dbbe,_0x52b882){return db[_0x05d8('0x2e')][_0x05d8('0x4a')]({'where':{'id':_0x40dbbe[_0x05d8('0x47')]['id']}})[_0x05d8('0x27')](handleEntityNotFound(_0x52b882,null))[_0x05d8('0x27')](removeEntity(_0x52b882,null))['catch'](handleError(_0x52b882,null));};exports[_0x05d8('0x4d')]=function(_0x2c732e,_0x3f21f1){return db[_0x05d8('0x2e')][_0x05d8('0x4d')]()[_0x05d8('0x27')](respondWithResult(_0x3f21f1,null))[_0x05d8('0x45')](handleError(_0x3f21f1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 17cd2d1..cfd305b 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 _0x60e1=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0x5541ae,_0x4a902d){var _0x42adf6=function(_0x571a53){while(--_0x571a53){_0x5541ae['push'](_0x5541ae['shift']());}};_0x42adf6(++_0x4a902d);}(_0x60e1,0x10a));var _0x160e=function(_0x207ac3,_0xbc293e){_0x207ac3=_0x207ac3-0x0;var _0x4a39b2=_0x60e1[_0x207ac3];return _0x4a39b2;};'use strict';var _=require('lodash');var util=require(_0x160e('0x0'));var logger=require(_0x160e('0x1'))(_0x160e('0x2'));var moment=require(_0x160e('0x3'));var BPromise=require(_0x160e('0x4'));var rp=require(_0x160e('0x5'));var fs=require('fs');var path=require(_0x160e('0x6'));var rimraf=require(_0x160e('0x7'));var config=require(_0x160e('0x8'));var attributes=require(_0x160e('0x9'));module[_0x160e('0xa')]=function(_0x14fe33,_0x146c41){return _0x14fe33[_0x160e('0xb')](_0x160e('0xc'),attributes,{'tableName':_0x160e('0xd'),'paranoid':![],'indexes':[{'name':_0x160e('0xe'),'fields':[_0x160e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89c4=['./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89c4,0xbb));var _0x489c=function(_0x2a60cc,_0x457b82){_0x2a60cc=_0x2a60cc-0x0;var _0x2cb1af=_0x89c4[_0x2a60cc];return _0x2cb1af;};'use strict';var _=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var logger=require(_0x489c('0x2'))(_0x489c('0x3'));var moment=require(_0x489c('0x4'));var BPromise=require('bluebird');var rp=require(_0x489c('0x5'));var fs=require('fs');var path=require(_0x489c('0x6'));var rimraf=require(_0x489c('0x7'));var config=require(_0x489c('0x8'));var attributes=require(_0x489c('0x9'));module[_0x489c('0xa')]=function(_0x217d84,_0x731df4){return _0x217d84[_0x489c('0xb')](_0x489c('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x489c('0xd'),'fields':[_0x489c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c25d9a1..733912d 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 _0x03d2=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x465a49,_0x1606ca){var _0x29ff29=function(_0x316788){while(--_0x316788){_0x465a49['push'](_0x465a49['shift']());}};_0x29ff29(++_0x1606ca);}(_0x03d2,0x11a));var _0x203d=function(_0x34682d,_0x1a4d6c){_0x34682d=_0x34682d-0x0;var _0x548c8a=_0x03d2[_0x34682d];return _0x548c8a;};'use strict';var _=require(_0x203d('0x0'));var util=require(_0x203d('0x1'));var moment=require(_0x203d('0x2'));var BPromise=require('bluebird');var rs=require(_0x203d('0x3'));var fs=require('fs');var Redis=require(_0x203d('0x4'));var db=require(_0x203d('0x5'))['db'];var utils=require(_0x203d('0x6'));var logger=require(_0x203d('0x7'))('rpc');var config=require(_0x203d('0x8'));var jayson=require(_0x203d('0x9'));var client=jayson[_0x203d('0xa')][_0x203d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12b541,_0x290cce,_0x2810b0){return new BPromise(function(_0x4067b2,_0x57291e){return client[_0x203d('0xc')](_0x12b541,_0x2810b0)[_0x203d('0xd')](function(_0x2757ad){logger['info'](_0x203d('0xe'),_0x290cce,_0x203d('0xf'));logger[_0x203d('0x10')](_0x203d('0x11'),_0x290cce,'request\x20sent',JSON[_0x203d('0x12')](_0x2757ad));if(_0x2757ad['error']){if(_0x2757ad[_0x203d('0x13')][_0x203d('0x14')]===0x1f4){logger[_0x203d('0x13')](_0x203d('0xe'),_0x290cce,_0x2757ad[_0x203d('0x13')][_0x203d('0x15')]);return _0x57291e(_0x2757ad[_0x203d('0x13')]['message']);}logger[_0x203d('0x13')](_0x203d('0xe'),_0x290cce,_0x2757ad['error'][_0x203d('0x15')]);return _0x4067b2(_0x2757ad['error'][_0x203d('0x15')]);}else{logger[_0x203d('0x16')](_0x203d('0xe'),_0x290cce,_0x203d('0xf'));_0x4067b2(_0x2757ad[_0x203d('0x17')]['message']);}})[_0x203d('0x18')](function(_0x524e17){logger[_0x203d('0x13')](_0x203d('0xe'),_0x290cce,_0x524e17);_0x57291e(_0x524e17);});});} \ No newline at end of file +var _0xebff=['result','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xebff,0xd4));var _0xfebf=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xebff[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xfebf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfebf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfebf('0x2'));var db=require(_0xfebf('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfebf('0x4'));var config=require(_0xfebf('0x5'));var jayson=require(_0xfebf('0x6'));var client=jayson[_0xfebf('0x7')][_0xfebf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ead30,_0x4cd50a,_0x2e2ef9){return new BPromise(function(_0x4f1f85,_0x384faf){return client[_0xfebf('0x9')](_0x2ead30,_0x2e2ef9)[_0xfebf('0xa')](function(_0x13cb83){logger[_0xfebf('0xb')](_0xfebf('0xc'),_0x4cd50a,_0xfebf('0xd'));logger[_0xfebf('0xe')](_0xfebf('0xf'),_0x4cd50a,_0xfebf('0xd'),JSON[_0xfebf('0x10')](_0x13cb83));if(_0x13cb83[_0xfebf('0x11')]){if(_0x13cb83['error']['code']===0x1f4){logger[_0xfebf('0x11')](_0xfebf('0xc'),_0x4cd50a,_0x13cb83[_0xfebf('0x11')][_0xfebf('0x12')]);return _0x384faf(_0x13cb83[_0xfebf('0x11')][_0xfebf('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4cd50a,_0x13cb83[_0xfebf('0x11')][_0xfebf('0x12')]);return _0x4f1f85(_0x13cb83[_0xfebf('0x11')][_0xfebf('0x12')]);}else{logger[_0xfebf('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x4cd50a,_0xfebf('0xd'));_0x4f1f85(_0x13cb83[_0xfebf('0x13')][_0xfebf('0x12')]);}})[_0xfebf('0x14')](function(_0x39ca66){logger['error'](_0xfebf('0xc'),_0x4cd50a,_0x39ca66);_0x384faf(_0x39ca66);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index babadd1..ea3fe8e 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 _0x2975=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x1a3908,_0x55cfa7){var _0x1a86a3=function(_0x3d3d79){while(--_0x3d3d79){_0x1a3908['push'](_0x1a3908['shift']());}};_0x1a86a3(++_0x55cfa7);}(_0x2975,0x1a5));var _0x5297=function(_0x45ccc5,_0x37d819){_0x45ccc5=_0x45ccc5-0x0;var _0x22c042=_0x2975[_0x45ccc5];return _0x22c042;};'use strict';var multer=require('multer');var util=require(_0x5297('0x0'));var path=require(_0x5297('0x1'));var timeout=require(_0x5297('0x2'));var express=require(_0x5297('0x3'));var router=express[_0x5297('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5297('0x5'));var interaction=require(_0x5297('0x6'));var config=require(_0x5297('0x7'));var controller=require('./chatTransferReport.controller');router[_0x5297('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5297('0x8')](_0x5297('0x9'),auth[_0x5297('0xa')](),controller[_0x5297('0xb')]);router[_0x5297('0x8')]('/:id',auth[_0x5297('0xa')](),controller[_0x5297('0xc')]);router[_0x5297('0xd')]('/',auth[_0x5297('0xa')](),controller[_0x5297('0xe')]);router[_0x5297('0xf')](_0x5297('0x10'),auth['isAuthenticated'](),controller[_0x5297('0x11')]);router[_0x5297('0x12')]('/:id',auth[_0x5297('0xa')](),controller['destroy']);module[_0x5297('0x13')]=router; \ No newline at end of file +var _0x7cf7=['/:id','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','/describe','describe'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x7cf7,0x79));var _0x77cf=function(_0x9e656,_0x5dd2dd){_0x9e656=_0x9e656-0x0;var _0x43174c=_0x7cf7[_0x9e656];return _0x43174c;};'use strict';var multer=require(_0x77cf('0x0'));var util=require(_0x77cf('0x1'));var path=require('path');var timeout=require(_0x77cf('0x2'));var express=require(_0x77cf('0x3'));var router=express[_0x77cf('0x4')]();var fs_extra=require(_0x77cf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x77cf('0x6'));var controller=require(_0x77cf('0x7'));router['get']('/',auth[_0x77cf('0x8')](),controller[_0x77cf('0x9')]);router['get'](_0x77cf('0xa'),auth[_0x77cf('0x8')](),controller[_0x77cf('0xb')]);router['get'](_0x77cf('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x77cf('0xd')]('/',auth[_0x77cf('0x8')](),controller[_0x77cf('0xe')]);router[_0x77cf('0xf')]('/:id',auth[_0x77cf('0x8')](),controller[_0x77cf('0x10')]);router[_0x77cf('0x11')](_0x77cf('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x77cf('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 458c4bf..229da19 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 _0xabaa=['Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','bottom_right','alternate','#fafafa','System','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}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xabaa,0xeb));var _0xaaba=function(_0x392172,_0x4caa9a){_0x392172=_0x392172-0x0;var _0x178a11=_0xabaa[_0x392172];return _0x178a11;};'use strict';var Sequelize=require(_0xaaba('0x0'));var rs=require(_0xaaba('0x1'));module[_0xaaba('0x2')]={'name':{'type':Sequelize[_0xaaba('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xaaba('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xaaba('0x3')]},'mapKey':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x4')},'mapKeyOffline':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x5')},'customerAlias':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xaaba('0x3')],'allowNull':![],'defaultValue':_0xaaba('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xaaba('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xaaba('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xaaba('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xaaba('0x3')]},'animation':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xaaba('0x9')](_0xaaba('0xa'),_0xaaba('0xb')),'defaultValue':_0xaaba('0xa')},'header_online':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0xc')},'start_chat_button':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0xd')},'offline_chat_button':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0xe')},'download_transcript':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xaaba('0x10')]},'closingQuestion':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x12')},'placeholderMessage':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xaaba('0x14')},'closingMessageButton':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x15')},'skipMessageButton':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x16')},'conditionAgreement':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0xaaba('0x18'),_0xaaba('0x19')),'defaultValue':_0xaaba('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xaaba('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xaaba('0x10')],'defaultValue':function(){return JSON[_0xaaba('0x1a')]({'items':[{'type':_0xaaba('0x1b'),'variable':null,'config':{'placeholder':_0xaaba('0x1c'),'type':_0xaaba('0x1d'),'required':!![]},'props':{'title':_0xaaba('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0xaaba('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xaaba('0x4'),'type':_0xaaba('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xaaba('0x1e')]('onlineForm')?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x191bd3){return this['setDataValue'](_0xaaba('0x1f'),JSON[_0xaaba('0x1a')](_0x191bd3));}},'offlineForm':{'type':Sequelize[_0xaaba('0x10')],'defaultValue':function(){return JSON[_0xaaba('0x1a')]({'items':[{'type':_0xaaba('0x1b'),'props':{'title':_0xaaba('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xaaba('0x4'),'type':_0xaaba('0x4')},'variable':null},{'type':_0xaaba('0x20'),'config':{'placeholder':_0xaaba('0x21')},'props':{'title':_0xaaba('0x21'),'helpText':_0xaaba('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xaaba('0x1e')](_0xaaba('0x23'))?JSON[_0xaaba('0x24')](this['getDataValue'](_0xaaba('0x23'))):{};},'set':function(_0x1b3c2b){return this[_0xaaba('0x25')](_0xaaba('0x23'),JSON[_0xaaba('0x1a')](_0x1b3c2b));}},'token':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xaaba('0x3')]},'forwardOffline':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xaaba('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xaaba('0x26')},'waitingMessage':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x28')},'skipUnmanaged':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x16')},'sendUnmanaged':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x15')},'enableCustomerAttachment':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xaaba('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0xaaba('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xaaba('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x29')},'verticalAlignment':{'type':Sequelize[_0xaaba('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':_0xaaba('0x2a')},'defaultTitle':{'type':Sequelize[_0xaaba('0x3')]},'customerAvatar':{'type':Sequelize[_0xaaba('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xaaba('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xaaba('0x3')],'allowNull':![],'defaultValue':_0xaaba('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaaba('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xaaba('0x2c')},'systemAvatar':{'type':Sequelize[_0xaaba('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaaba('0x7')],'comment':_0xaaba('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaaba('0x2e'),'set':function(_0x6b4a38){if(!_0x6b4a38)this[_0xaaba('0x25')](_0xaaba('0x2f'),null);this['setDataValue'](_0xaaba('0x30'),_0x6b4a38);}},'vidaooEscalation':{'type':Sequelize[_0xaaba('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xaaba('0x3')],'allowNull':![],'defaultValue':_0xaaba('0x31')},'vidaooNote':{'type':Sequelize[_0xaaba('0x3')],'defaultValue':function(){return _0xaaba('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xaaba('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xaaba('0x10')]}}; \ No newline at end of file +var _0xc9c4=['System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','address','email','Agent','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','name','input','onlineForm','parse','getDataValue','setDataValue','stringify','textarea','Comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','website_alias','bottom_right'];(function(_0x15dd45,_0x39d85d){var _0x4e4a8e=function(_0x55bf1f){while(--_0x55bf1f){_0x15dd45['push'](_0x15dd45['shift']());}};_0x4e4a8e(++_0x39d85d);}(_0xc9c4,0xb1));var _0x4c9c=function(_0x54fd4a,_0x5e66f0){_0x54fd4a=_0x54fd4a-0x0;var _0x67ef13=_0xc9c4[_0x54fd4a];return _0x67ef13;};'use strict';var Sequelize=require(_0x4c9c('0x0'));var rs=require('randomstring');module[_0x4c9c('0x1')]={'name':{'type':Sequelize[_0x4c9c('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4c9c('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x4c9c('0x4')},'key':{'type':Sequelize[_0x4c9c('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x5')},'customerAlias':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4c9c('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4c9c('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4c9c('0x2')]},'animation':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4c9c('0x7')](_0x4c9c('0x8'),_0x4c9c('0x9')),'defaultValue':_0x4c9c('0x8')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x4c9c('0xa')},'start_chat_button':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0xb')},'header_offline':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4c9c('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4c9c('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x10')},'noteTitle':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4c9c('0x12')},'closingMessage':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x13')},'closingMessageButton':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0xb')},'skipMessageButton':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x14')},'conditionAgreement':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x15')},'ratingType':{'type':Sequelize[_0x4c9c('0x7')](_0x4c9c('0x16'),_0x4c9c('0x17')),'defaultValue':_0x4c9c('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x4c9c('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4c9c('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x4c9c('0x18'),'helpText':''}},{'type':_0x4c9c('0x19'),'props':{'title':_0x4c9c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4c9c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x4c9c('0x1a'))?JSON[_0x4c9c('0x1b')](this[_0x4c9c('0x1c')]('onlineForm')):{};},'set':function(_0x1bfd59){return this[_0x4c9c('0x1d')]('onlineForm',JSON['stringify'](_0x1bfd59));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4c9c('0x1e')]({'items':[{'type':_0x4c9c('0x19'),'props':{'title':_0x4c9c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4c9c('0x4'),'type':_0x4c9c('0x4')},'variable':null},{'type':_0x4c9c('0x1f'),'config':{'placeholder':_0x4c9c('0x20')},'props':{'title':_0x4c9c('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x4c9c('0x1c')]('offlineForm')?JSON[_0x4c9c('0x1b')](this[_0x4c9c('0x1c')]('offlineForm')):{};},'set':function(_0x31e058){return this[_0x4c9c('0x1d')](_0x4c9c('0x21'),JSON[_0x4c9c('0x1e')](_0x31e058));}},'token':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4c9c('0x2')]},'forwardOffline':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4c9c('0x22')},'waitingMessage':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x4c9c('0x14')},'sendUnmanaged':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4c9c('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':_0x4c9c('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4c9c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x4c9c('0x25')},'verticalAlignment':{'type':Sequelize[_0x4c9c('0xd')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x4c9c('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x4c9c('0x2')]},'customerAvatar':{'type':Sequelize[_0x4c9c('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4c9c('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c9c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4c9c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4c9c('0x26')},'systemAvatar':{'type':Sequelize[_0x4c9c('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c9c('0xd')],'comment':_0x4c9c('0x27')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4c9c('0x28'),'set':function(_0x54d5dc){if(!_0x54d5dc)this[_0x4c9c('0x1d')](_0x4c9c('0x29'),null);this['setDataValue']('mandatoryDisposition',_0x54d5dc);}},'vidaooEscalation':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4c9c('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4c9c('0x2a')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x4c9c('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4c9c('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4c9c('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 00f4a4d..58ccae3 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 _0xb446=['findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','difference','createdAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','ChatApplication','Applications','account','applications','list','List','orderBy','priority','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','browser','version','%s\x20%s','unknown','device','vendor','format','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','server','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','some','server/files/chat/iframe.ejs','remote','x-real-ip','referer','replace','alignment','verticalAlignment','textColor','backgroundColor','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','items','getOfflineMessages','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','get','ChatWebsites','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','include','show','params','rawAttributes','includeAll','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','update','describe','addDisposition','ChatWebsiteId','Disposition','merge'];(function(_0x4c5c25,_0x7107a0){var _0x4c9582=function(_0x570f26){while(--_0x570f26){_0x4c5c25['push'](_0x4c5c25['shift']());}};_0x4c9582(++_0x7107a0);}(_0xb446,0x1f4));var _0x6b44=function(_0x2c8e51,_0x158fd9){_0x2c8e51=_0x2c8e51-0x0;var _0x57e3fd=_0xb446[_0x2c8e51];return _0x57e3fd;};'use strict';var BPromise=require(_0x6b44('0x0'));var Mustache=require(_0x6b44('0x1'));var util=require(_0x6b44('0x2'));var path=require('path');var ejs=require(_0x6b44('0x3'));var fs=require('fs');var fs_extra=require(_0x6b44('0x4'));var _=require('lodash');var querystring=require(_0x6b44('0x5'));var Redis=require(_0x6b44('0x6'));var qs=require(_0x6b44('0x7'));var logger=require(_0x6b44('0x8'))(_0x6b44('0x9'));var config=require(_0x6b44('0xa'));var db=require('../../mysqldb')['db'];config[_0x6b44('0xb')]=_[_0x6b44('0xc')](config[_0x6b44('0xb')],{'host':_0x6b44('0xd'),'port':0x18eb});var socket=require(_0x6b44('0xe'))(new Redis(config['redis']));require(_0x6b44('0xf'))[_0x6b44('0x10')](socket);var jayson=require(_0x6b44('0x11'));var client=jayson['client'][_0x6b44('0x12')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x6b44('0x13')][_0x6b44('0x12')]({'port':0x232b});var client9001=jayson[_0x6b44('0x13')][_0x6b44('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x15ab09,_0xa0218c,_0x39443a,_0x48608f){return new BPromise(function(_0x29534f,_0x4fbaaf){var _0x40642c=_0x48608f||client;return _0x40642c[_0x6b44('0x14')](_0x15ab09,_0x39443a)[_0x6b44('0x15')](function(_0x245d44){logger[_0x6b44('0x16')](_0x6b44('0x17'),_0xa0218c,_0x6b44('0x18'));logger[_0x6b44('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xa0218c,'request\x20sent',JSON[_0x6b44('0x1a')](_0x245d44));if(_0x245d44[_0x6b44('0x1b')]){if(_0x245d44[_0x6b44('0x1b')]['code']===0x1f4){logger[_0x6b44('0x1b')](_0x6b44('0x17'),_0xa0218c,_0x245d44['error']['message']);return _0x4fbaaf(_0x245d44[_0x6b44('0x1b')][_0x6b44('0x1c')]);}logger[_0x6b44('0x1b')](_0x6b44('0x17'),_0xa0218c,_0x245d44['error']['message']);return _0x29534f(_0x245d44[_0x6b44('0x1b')][_0x6b44('0x1c')]);}else{logger['info'](_0x6b44('0x17'),_0xa0218c,_0x6b44('0x18'));_0x29534f(_0x245d44[_0x6b44('0x1d')][_0x6b44('0x1c')]);}})[_0x6b44('0x1e')](function(_0x1eb17c){logger[_0x6b44('0x1b')](_0x6b44('0x17'),_0xa0218c,_0x1eb17c);_0x4fbaaf(_0x1eb17c);});});}function respondWithStatusCode(_0x58f653,_0x5b8866){_0x5b8866=_0x5b8866||0xcc;return function(_0x5d5e0a){if(_0x5d5e0a){return _0x58f653[_0x6b44('0x1f')](_0x5b8866);}return _0x58f653[_0x6b44('0x20')](_0x5b8866)[_0x6b44('0x21')]();};}function respondWithResult(_0x915100,_0x4eb28c){_0x4eb28c=_0x4eb28c||0xc8;return function(_0x202d63){if(_0x202d63){return _0x915100[_0x6b44('0x20')](_0x4eb28c)[_0x6b44('0x22')](_0x202d63);}};}function respondWithFilteredResult(_0x2ce80c,_0x497afc){return function(_0x1646b0){if(_0x1646b0){var _0x5cc432=typeof _0x497afc[_0x6b44('0x23')]===_0x6b44('0x24')&&typeof _0x497afc[_0x6b44('0x25')]==='undefined';var _0x1abf06=_0x1646b0[_0x6b44('0x26')];var _0x272224=_0x5cc432?0x0:_0x497afc[_0x6b44('0x23')];var _0x25edb3=_0x5cc432?_0x1646b0[_0x6b44('0x26')]:_0x497afc[_0x6b44('0x23')]+_0x497afc[_0x6b44('0x25')];var _0x5c5562;if(_0x25edb3>=_0x1abf06){_0x25edb3=_0x1abf06;_0x5c5562=0xc8;}else{_0x5c5562=0xce;}_0x2ce80c['status'](_0x5c5562);return _0x2ce80c[_0x6b44('0x27')]('Content-Range',_0x272224+'-'+_0x25edb3+'/'+_0x1abf06)['json'](_0x1646b0);}return null;};}function saveUpdates(_0x42bedc){return function(_0x52f504){if(_0x52f504){return _0x52f504['update'](_0x42bedc)[_0x6b44('0x15')](function(_0x3906be){return _0x3906be;});}return null;};}function removeEntity(_0x247dd9){return function(_0x313b06){if(_0x313b06){return _0x313b06[_0x6b44('0x28')]()[_0x6b44('0x15')](function(){var _0x57095f=_0x313b06[_0x6b44('0x29')]({'plain':!![]});var _0xd015f3=_0x6b44('0x2a');return db[_0x6b44('0x2b')]['destroy']({'where':{'type':_0xd015f3,'resourceId':_0x57095f['id']}})['then'](function(){return _0x313b06;});})[_0x6b44('0x15')](function(){_0x247dd9['status'](0xcc)[_0x6b44('0x21')]();});}};}function handleEntityNotFound(_0x1ab4c4){return function(_0x16d749){if(!_0x16d749){_0x1ab4c4[_0x6b44('0x1f')](0x194);}return _0x16d749;};}function handleError(_0x418481,_0x4bc826){_0x4bc826=_0x4bc826||0x1f4;return function(_0x242519){logger['error'](_0x242519['stack']);if(_0x242519[_0x6b44('0x2c')]){delete _0x242519['name'];}_0x418481[_0x6b44('0x20')](_0x4bc826)[_0x6b44('0x2d')](_0x242519);};}exports['index']=function(_0x9b23c5,_0x13fddc){var _0x50a1ee={'include':[{'model':db[_0x6b44('0x2e')],'as':_0x6b44('0x2f')}]},_0xe02d71={},_0x2fb395={'count':0x0,'rows':[]};var _0xeda160=_[_0x6b44('0x30')](db[_0x6b44('0x31')]['rawAttributes'],function(_0x57807a){return{'name':_0x57807a[_0x6b44('0x32')],'type':_0x57807a[_0x6b44('0x33')][_0x6b44('0x34')]};});_0xe02d71['model']=_[_0x6b44('0x30')](_0xeda160,_0x6b44('0x2c'));_0xe02d71[_0x6b44('0x35')]=_[_0x6b44('0x36')](_0x9b23c5[_0x6b44('0x35')]);_0xe02d71[_0x6b44('0x37')]=_[_0x6b44('0x38')](_0xe02d71[_0x6b44('0x39')],_0xe02d71[_0x6b44('0x35')]);_0x50a1ee['attributes']=_[_0x6b44('0x38')](_0xe02d71[_0x6b44('0x39')],qs['fields'](_0x9b23c5[_0x6b44('0x35')][_0x6b44('0x3a')]));_0x50a1ee[_0x6b44('0x3b')]=_0x50a1ee[_0x6b44('0x3b')][_0x6b44('0x3c')]?_0x50a1ee[_0x6b44('0x3b')]:_0xe02d71[_0x6b44('0x39')];if(!_0x9b23c5[_0x6b44('0x35')][_0x6b44('0x3d')](_0x6b44('0x3e'))){_0x50a1ee[_0x6b44('0x25')]=qs[_0x6b44('0x25')](_0x9b23c5[_0x6b44('0x35')]['limit']);_0x50a1ee[_0x6b44('0x23')]=qs[_0x6b44('0x23')](_0x9b23c5['query'][_0x6b44('0x23')]);}_0x50a1ee[_0x6b44('0x3f')]=qs[_0x6b44('0x40')](_0x9b23c5[_0x6b44('0x35')][_0x6b44('0x40')]);_0x50a1ee['where']=qs['filters'](_[_0x6b44('0x41')](_0x9b23c5['query'],_0xe02d71['filters']),_0xeda160);if(_0x9b23c5[_0x6b44('0x35')][_0x6b44('0x42')]){_0x50a1ee[_0x6b44('0x43')]=_['merge'](_0x50a1ee['where'],{'$or':_[_0x6b44('0x30')](_0xeda160,function(_0x1e7f89){if(_0x1e7f89[_0x6b44('0x33')]!=='VIRTUAL'){var _0x55ae09={};_0x55ae09[_0x1e7f89[_0x6b44('0x2c')]]={'$like':'%'+_0x9b23c5[_0x6b44('0x35')]['filter']+'%'};return _0x55ae09;}})});}_0x50a1ee=_['merge']({},_0x50a1ee,_0x9b23c5[_0x6b44('0x44')]);var _0x24a663={'where':_0x50a1ee['where']};return db[_0x6b44('0x31')][_0x6b44('0x26')](_0x24a663)[_0x6b44('0x15')](function(_0x232109){_0x2fb395['count']=_0x232109;if(_0x9b23c5[_0x6b44('0x35')]['includeAll']){_0x50a1ee[_0x6b44('0x45')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x50a1ee);})[_0x6b44('0x15')](function(_0x5ceaa4){_0x2fb395['rows']=_0x5ceaa4;return _0x2fb395;})[_0x6b44('0x15')](respondWithFilteredResult(_0x13fddc,_0x50a1ee))['catch'](handleError(_0x13fddc,null));};exports[_0x6b44('0x46')]=function(_0x51727a,_0xc2102b){var _0x51f54f={'raw':![],'where':{'id':_0x51727a[_0x6b44('0x47')]['id']},'include':[{'model':db[_0x6b44('0x2e')],'as':'mandatoryDispositionPause'}]},_0x193451={};_0x193451[_0x6b44('0x39')]=_['keys'](db[_0x6b44('0x31')][_0x6b44('0x48')]);_0x193451[_0x6b44('0x35')]=_[_0x6b44('0x36')](_0x51727a['query']);_0x193451['filters']=_['intersection'](_0x193451['model'],_0x193451[_0x6b44('0x35')]);_0x51f54f['attributes']=_[_0x6b44('0x38')](_0x193451[_0x6b44('0x39')],qs['fields'](_0x51727a['query'][_0x6b44('0x3a')]));_0x51f54f[_0x6b44('0x3b')]=_0x51f54f['attributes'][_0x6b44('0x3c')]?_0x51f54f[_0x6b44('0x3b')]:_0x193451[_0x6b44('0x39')];if(_0x51727a['query'][_0x6b44('0x49')]){_0x51f54f[_0x6b44('0x45')]=[{'all':!![]}];}_0x51f54f=_['merge']({},_0x51f54f,_0x51727a['options']);return db[_0x6b44('0x31')][_0x6b44('0x4a')](_0x51f54f)[_0x6b44('0x15')](handleEntityNotFound(_0xc2102b,null))[_0x6b44('0x15')](respondWithResult(_0xc2102b,null))['catch'](handleError(_0xc2102b,null));};exports[_0x6b44('0x4b')]=function(_0xa29484,_0x5b3634){return db['ChatWebsite'][_0x6b44('0x4b')](_0xa29484[_0x6b44('0x4c')],{})[_0x6b44('0x15')](function(_0x17b3bd){var _0x20ad1d=_0xa29484['user'][_0x6b44('0x29')]({'plain':!![]});if(!_0x20ad1d)throw new Error(_0x6b44('0x4d'));if(_0x20ad1d[_0x6b44('0x4e')]===_0x6b44('0x4f')){var _0x479b1e=_0x17b3bd[_0x6b44('0x29')]({'plain':!![]});var _0x47294a=_0x6b44('0x2a');return db[_0x6b44('0x50')]['find']({'where':{'name':_0x47294a,'userProfileId':_0x20ad1d[_0x6b44('0x51')]},'raw':!![]})[_0x6b44('0x15')](function(_0x39b39f){if(_0x39b39f&&_0x39b39f[_0x6b44('0x52')]===0x0){return db['UserProfileResource'][_0x6b44('0x4b')]({'name':_0x479b1e[_0x6b44('0x2c')],'resourceId':_0x479b1e['id'],'type':_0x39b39f[_0x6b44('0x2c')],'sectionId':_0x39b39f['id']},{})[_0x6b44('0x15')](function(){return _0x17b3bd;});}else{return _0x17b3bd;}})[_0x6b44('0x1e')](function(_0x100c62){logger[_0x6b44('0x1b')](_0x6b44('0x53'),_0x100c62);throw _0x100c62;});}return _0x17b3bd;})[_0x6b44('0x15')](respondWithResult(_0x5b3634,0xc9))[_0x6b44('0x1e')](handleError(_0x5b3634,null));};exports[_0x6b44('0x54')]=function(_0x37446c,_0x23fa12){if(_0x37446c[_0x6b44('0x4c')]['id']){delete _0x37446c['body']['id'];}return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0x37446c[_0x6b44('0x47')]['id']},'include':[{'model':db[_0x6b44('0x2e')],'as':_0x6b44('0x2f')}]})['then'](handleEntityNotFound(_0x23fa12,null))[_0x6b44('0x15')](saveUpdates(_0x37446c[_0x6b44('0x4c')],null))[_0x6b44('0x15')](respondWithResult(_0x23fa12,null))[_0x6b44('0x1e')](handleError(_0x23fa12,null));};exports[_0x6b44('0x28')]=function(_0x284987,_0x3f906e){return db[_0x6b44('0x31')]['find']({'where':{'id':_0x284987['params']['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x3f906e,null))[_0x6b44('0x15')](removeEntity(_0x3f906e,null))[_0x6b44('0x1e')](handleError(_0x3f906e,null));};exports['describe']=function(_0x23fbd9,_0x3c2a92){return db['ChatWebsite'][_0x6b44('0x55')]()[_0x6b44('0x15')](respondWithResult(_0x3c2a92,null))[_0x6b44('0x1e')](handleError(_0x3c2a92,null));};exports[_0x6b44('0x56')]=function(_0x25fa21,_0x5580d2){if(_0x25fa21[_0x6b44('0x4c')]['id']){delete _0x25fa21[_0x6b44('0x4c')]['id'];}return db[_0x6b44('0x31')]['find']({'where':{'id':_0x25fa21['params']['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x5580d2,null))[_0x6b44('0x15')](function(_0x1b4c46){if(_0x1b4c46){_0x25fa21['body'][_0x6b44('0x57')]=_0x1b4c46['id'];return db['Disposition'][_0x6b44('0x4b')](_0x25fa21[_0x6b44('0x4c')]);}})[_0x6b44('0x15')](respondWithResult(_0x5580d2,null))['catch'](handleError(_0x5580d2,null));};exports['getDispositions']=function(_0x3d0449,_0x274b96){var _0x5387e7={'raw':![],'where':{}};var _0x2e6441={};var _0x571844={'count':0x0,'rows':[]};return db[_0x6b44('0x31')]['findOne']({'where':{'id':_0x3d0449[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x274b96,null))[_0x6b44('0x15')](function(_0x5824aa){if(_0x5824aa){_0x2e6441['model']=_[_0x6b44('0x36')](db[_0x6b44('0x58')][_0x6b44('0x48')]);_0x2e6441[_0x6b44('0x35')]=_[_0x6b44('0x36')](_0x3d0449[_0x6b44('0x35')]);_0x2e6441[_0x6b44('0x37')]=_['intersection'](_0x2e6441[_0x6b44('0x39')],_0x2e6441[_0x6b44('0x35')]);_0x5387e7[_0x6b44('0x3b')]=_[_0x6b44('0x38')](_0x2e6441[_0x6b44('0x39')],qs[_0x6b44('0x3a')](_0x3d0449[_0x6b44('0x35')][_0x6b44('0x3a')]));_0x5387e7[_0x6b44('0x3b')]=_0x5387e7['attributes'][_0x6b44('0x3c')]?_0x5387e7[_0x6b44('0x3b')]:_0x2e6441['model'];if(!_0x3d0449[_0x6b44('0x35')]['hasOwnProperty']('nolimit')){_0x5387e7['limit']=qs[_0x6b44('0x25')](_0x3d0449[_0x6b44('0x35')][_0x6b44('0x25')]);_0x5387e7[_0x6b44('0x23')]=qs['offset'](_0x3d0449[_0x6b44('0x35')]['offset']);}_0x5387e7[_0x6b44('0x3f')]=qs[_0x6b44('0x40')](_0x3d0449[_0x6b44('0x35')][_0x6b44('0x40')]);_0x5387e7['where']=qs['filters'](_[_0x6b44('0x41')](_0x3d0449[_0x6b44('0x35')],_0x2e6441[_0x6b44('0x37')]));_0x5387e7[_0x6b44('0x43')][_0x6b44('0x57')]=_0x5824aa['id'];if(_0x3d0449['query'][_0x6b44('0x42')]){_0x5387e7['where']=_[_0x6b44('0x59')](_0x5387e7[_0x6b44('0x43')],{'$or':_[_0x6b44('0x30')](_0x5387e7[_0x6b44('0x3b')],function(_0x2291ce){var _0x3edf8a={};_0x3edf8a[_0x2291ce]={'$like':'%'+_0x3d0449[_0x6b44('0x35')][_0x6b44('0x42')]+'%'};return _0x3edf8a;})});}_0x5387e7=_[_0x6b44('0x59')]({},_0x5387e7,_0x3d0449['options']);return db[_0x6b44('0x58')][_0x6b44('0x26')]({'where':_0x5387e7['where']})[_0x6b44('0x15')](function(_0x345078){_0x571844[_0x6b44('0x26')]=_0x345078;if(_0x3d0449[_0x6b44('0x35')]['includeAll']){_0x5387e7[_0x6b44('0x45')]=[{'all':!![]}];}return db[_0x6b44('0x58')][_0x6b44('0x5a')](_0x5387e7);})[_0x6b44('0x15')](function(_0x3bee51){_0x571844[_0x6b44('0x5b')]=_0x3bee51;return _0x571844;});}})[_0x6b44('0x15')](respondWithFilteredResult(_0x274b96,_0x5387e7))[_0x6b44('0x1e')](handleError(_0x274b96,null));};exports[_0x6b44('0x5c')]=function(_0x1b7b42,_0x328b0b){return db[_0x6b44('0x31')]['find']({'where':{'id':_0x1b7b42[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x328b0b,null))[_0x6b44('0x15')](function(_0x1560a2){if(_0x1560a2){return _0x1560a2[_0x6b44('0x5c')](_0x1b7b42['query'][_0x6b44('0x5d')]);}})[_0x6b44('0x15')](respondWithStatusCode(_0x328b0b,null))[_0x6b44('0x1e')](handleError(_0x328b0b,null));};exports[_0x6b44('0x5e')]=function(_0x231a06,_0x2411bf){if(_0x231a06[_0x6b44('0x4c')]['id']){delete _0x231a06[_0x6b44('0x4c')]['id'];}return db[_0x6b44('0x31')]['find']({'where':{'id':_0x231a06[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x2411bf,null))['then'](function(_0x266905){if(_0x266905){_0x231a06[_0x6b44('0x4c')][_0x6b44('0x57')]=_0x266905['id'];return db[_0x6b44('0x5f')][_0x6b44('0x4b')](_0x231a06[_0x6b44('0x4c')]);}})[_0x6b44('0x15')](respondWithResult(_0x2411bf,null))[_0x6b44('0x1e')](handleError(_0x2411bf,null));};exports[_0x6b44('0x60')]=function(_0x156de1,_0x13ed7f){var _0x18d1ef={'raw':![],'where':{}};var _0x1ecc05={};var _0x3a2296={'count':0x0,'rows':[]};return db[_0x6b44('0x31')][_0x6b44('0x61')]({'where':{'id':_0x156de1[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x13ed7f,null))[_0x6b44('0x15')](function(_0x244240){if(_0x244240){_0x1ecc05[_0x6b44('0x39')]=_[_0x6b44('0x36')](db[_0x6b44('0x5f')][_0x6b44('0x48')]);_0x1ecc05['query']=_[_0x6b44('0x36')](_0x156de1[_0x6b44('0x35')]);_0x1ecc05[_0x6b44('0x37')]=_[_0x6b44('0x38')](_0x1ecc05['model'],_0x1ecc05['query']);_0x18d1ef[_0x6b44('0x3b')]=_[_0x6b44('0x38')](_0x1ecc05[_0x6b44('0x39')],qs[_0x6b44('0x3a')](_0x156de1[_0x6b44('0x35')][_0x6b44('0x3a')]));_0x18d1ef[_0x6b44('0x3b')]=_0x18d1ef[_0x6b44('0x3b')][_0x6b44('0x3c')]?_0x18d1ef[_0x6b44('0x3b')]:_0x1ecc05[_0x6b44('0x39')];if(!_0x156de1[_0x6b44('0x35')]['hasOwnProperty'](_0x6b44('0x3e'))){_0x18d1ef[_0x6b44('0x25')]=qs[_0x6b44('0x25')](_0x156de1[_0x6b44('0x35')][_0x6b44('0x25')]);_0x18d1ef[_0x6b44('0x23')]=qs[_0x6b44('0x23')](_0x156de1[_0x6b44('0x35')][_0x6b44('0x23')]);}_0x18d1ef[_0x6b44('0x3f')]=qs[_0x6b44('0x40')](_0x156de1[_0x6b44('0x35')][_0x6b44('0x40')]);_0x18d1ef[_0x6b44('0x43')]=qs[_0x6b44('0x37')](_[_0x6b44('0x41')](_0x156de1[_0x6b44('0x35')],_0x1ecc05['filters']));_0x18d1ef[_0x6b44('0x43')]['ChatWebsiteId']=_0x244240['id'];if(_0x156de1[_0x6b44('0x35')][_0x6b44('0x42')]){_0x18d1ef['where']=_[_0x6b44('0x59')](_0x18d1ef['where'],{'$or':_[_0x6b44('0x30')](_0x18d1ef['attributes'],function(_0x5619f9){var _0x2cfc29={};_0x2cfc29[_0x5619f9]={'$like':'%'+_0x156de1[_0x6b44('0x35')][_0x6b44('0x42')]+'%'};return _0x2cfc29;})});}_0x18d1ef=_[_0x6b44('0x59')]({},_0x18d1ef,_0x156de1[_0x6b44('0x44')]);return db[_0x6b44('0x5f')]['count']({'where':_0x18d1ef[_0x6b44('0x43')]})[_0x6b44('0x15')](function(_0x266b96){_0x3a2296[_0x6b44('0x26')]=_0x266b96;if(_0x156de1[_0x6b44('0x35')]['includeAll']){_0x18d1ef[_0x6b44('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6b44('0x5a')](_0x18d1ef);})[_0x6b44('0x15')](function(_0xf04ac){_0x3a2296[_0x6b44('0x5b')]=_0xf04ac;return _0x3a2296;});}})['then'](respondWithFilteredResult(_0x13ed7f,_0x18d1ef))[_0x6b44('0x1e')](handleError(_0x13ed7f,null));};exports['removeAnswers']=function(_0x382e63,_0x7a68a4){return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0x382e63[_0x6b44('0x47')]['id']}})['then'](handleEntityNotFound(_0x7a68a4,null))[_0x6b44('0x15')](function(_0x3b26c5){if(_0x3b26c5){return _0x3b26c5['removeAnswers'](_0x382e63[_0x6b44('0x35')]['ids']);}})[_0x6b44('0x15')](respondWithStatusCode(_0x7a68a4,null))[_0x6b44('0x1e')](handleError(_0x7a68a4,null));};exports[_0x6b44('0x62')]=function(_0x49e888,_0x1f5440){_0x49e888[_0x6b44('0x4c')][_0x6b44('0x63')]=_0x49e888[_0x6b44('0x64')][_0x6b44('0x65')];return db[_0x6b44('0x31')]['find']({'where':{'id':_0x49e888[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x1f5440,null))['then'](saveUpdates(_0x49e888[_0x6b44('0x4c')],null))[_0x6b44('0x15')](respondWithResult(_0x1f5440,null))[_0x6b44('0x1e')](handleError(_0x1f5440,null));};exports[_0x6b44('0x66')]=function(_0xfbc5ba,_0x5cb53f){_0xfbc5ba['body'][_0x6b44('0x67')]=_0xfbc5ba['file'][_0x6b44('0x65')];return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0xfbc5ba[_0x6b44('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cb53f,null))[_0x6b44('0x15')](saveUpdates(_0xfbc5ba[_0x6b44('0x4c')],null))[_0x6b44('0x15')](respondWithResult(_0x5cb53f,null))[_0x6b44('0x1e')](handleError(_0x5cb53f,null));};exports[_0x6b44('0x68')]=function(_0x2e2ea9,_0x1caf58){_0x2e2ea9['body'][_0x6b44('0x69')]=_0x2e2ea9['file'][_0x6b44('0x65')];return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0x2e2ea9['params']['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x1caf58,null))[_0x6b44('0x15')](saveUpdates(_0x2e2ea9['body'],null))[_0x6b44('0x15')](respondWithResult(_0x1caf58,null))[_0x6b44('0x1e')](handleError(_0x1caf58,null));};exports[_0x6b44('0x6a')]=function(_0x4261b7,_0x3a4fdd){_0x4261b7[_0x6b44('0x4c')][_0x6b44('0x6b')]=_0x4261b7[_0x6b44('0x64')][_0x6b44('0x65')];return db['ChatWebsite'][_0x6b44('0x4a')]({'where':{'id':_0x4261b7['params']['id']}})['then'](handleEntityNotFound(_0x3a4fdd,null))['then'](saveUpdates(_0x4261b7[_0x6b44('0x4c')],null))[_0x6b44('0x15')](respondWithResult(_0x3a4fdd,null))[_0x6b44('0x1e')](handleError(_0x3a4fdd,null));};exports[_0x6b44('0x6c')]=function(_0x2f1767,_0x4043b9){var _0x57bd9e=path['join'](config['root'],_0x6b44('0x6d'));var _0x203ace={'where':{'id':_0x2f1767['params']['id']},'attributes':['id',_0x6b44('0x63')],'raw':!![]};var _0x788bed=![];return require(_0x6b44('0x6e'))[_0x6b44('0x6f')]()[_0x6b44('0x15')](function(_0x15a1a6){if(_0x15a1a6){_0x788bed=_0x15a1a6[_0x6b44('0x70')];}})[_0x6b44('0x15')](function(){return db[_0x6b44('0x31')][_0x6b44('0x4a')](_0x203ace);})['then'](handleEntityNotFound(_0x4043b9,null))[_0x6b44('0x15')](function(_0x3eb777){if(_0x3eb777){if(!_['isNil'](_0x3eb777[_0x6b44('0x63')])){if(fs[_0x6b44('0x71')](path['join'](config[_0x6b44('0x72')],_0x6b44('0x73'),_0x3eb777[_0x6b44('0x63')]))&&_0x788bed){_0x57bd9e=path[_0x6b44('0x74')](config[_0x6b44('0x72')],_0x6b44('0x73'),_0x3eb777[_0x6b44('0x63')]);}}return _0x4043b9[_0x6b44('0x75')](_0x57bd9e);}})[_0x6b44('0x1e')](handleError(_0x4043b9,null));};exports[_0x6b44('0x76')]=function(_0x120ec5,_0x2b1b28){var _0x132a3f=path['join'](config['root'],_0x6b44('0x77'));var _0x117d41={'where':{'id':_0x120ec5[_0x6b44('0x47')]['id']},'attributes':['id',_0x6b44('0x67')],'raw':!![]};return db[_0x6b44('0x31')][_0x6b44('0x4a')](_0x117d41)[_0x6b44('0x15')](handleEntityNotFound(_0x2b1b28,null))[_0x6b44('0x15')](function(_0x47c2b8){if(_0x47c2b8){if(!_[_0x6b44('0x78')](_0x47c2b8[_0x6b44('0x67')])){if(fs[_0x6b44('0x71')](path['join'](config[_0x6b44('0x72')],_0x6b44('0x79'),_0x47c2b8[_0x6b44('0x67')]))){_0x132a3f=path[_0x6b44('0x74')](config[_0x6b44('0x72')],'server/files/images/avatars/',_0x47c2b8[_0x6b44('0x67')]);}}return _0x2b1b28['download'](_0x132a3f);}})[_0x6b44('0x1e')](handleError(_0x2b1b28,null));};exports[_0x6b44('0x7a')]=function(_0x5dc9fd,_0x399431){var _0x293fbe=path['join'](config[_0x6b44('0x72')],_0x6b44('0x7b'));var _0x14467a={'where':{'id':_0x5dc9fd[_0x6b44('0x47')]['id']},'attributes':['id',_0x6b44('0x69'),_0x6b44('0x7c')],'raw':!![]};return db[_0x6b44('0x31')][_0x6b44('0x4a')](_0x14467a)['then'](handleEntityNotFound(_0x399431,null))[_0x6b44('0x15')](function(_0x27d2c2){if(_0x27d2c2){if(!_['isNil'](_0x27d2c2['customerAvatar'])){if(fs[_0x6b44('0x71')](path[_0x6b44('0x74')](config[_0x6b44('0x72')],_0x6b44('0x79'),_0x27d2c2[_0x6b44('0x69')]))&&_0x27d2c2[_0x6b44('0x7c')]){_0x293fbe=path[_0x6b44('0x74')](config[_0x6b44('0x72')],_0x6b44('0x79'),_0x27d2c2['customerAvatar']);}}return _0x399431[_0x6b44('0x75')](_0x293fbe);}})[_0x6b44('0x1e')](handleError(_0x399431,null));};exports[_0x6b44('0x7d')]=function(_0x2413fa,_0x374f40){var _0x33a674=path[_0x6b44('0x74')](config[_0x6b44('0x72')],_0x6b44('0x7e'));var _0x5b2cea={'where':{'id':_0x2413fa[_0x6b44('0x47')]['id']},'attributes':['id',_0x6b44('0x6b')],'raw':!![]};return db['ChatWebsite'][_0x6b44('0x4a')](_0x5b2cea)[_0x6b44('0x15')](handleEntityNotFound(_0x374f40,null))[_0x6b44('0x15')](function(_0x5272f0){if(_0x5272f0){if(!_[_0x6b44('0x78')](_0x5272f0[_0x6b44('0x6b')])){if(fs[_0x6b44('0x71')](path[_0x6b44('0x74')](config[_0x6b44('0x72')],_0x6b44('0x79'),_0x5272f0[_0x6b44('0x6b')]))){_0x33a674=path['join'](config[_0x6b44('0x72')],'server/files/images/avatars/',_0x5272f0[_0x6b44('0x6b')]);}}return _0x374f40[_0x6b44('0x75')](_0x33a674);}})[_0x6b44('0x1e')](handleError(_0x374f40,null));};exports[_0x6b44('0x7f')]=function(_0x263bfd,_0x237ae4){var _0x4e606a=require('user-agent-parser');var _0x4dc0c8=new _0x4e606a();var _0x3a66b4=_0x4dc0c8[_0x6b44('0x80')](_0x263bfd[_0x6b44('0x81')][_0x6b44('0x82')])[_0x6b44('0x83')]();var _0x49b2a0={'body':_0x263bfd['body'],'channel':'chat'};var _0xecea53=[];var _0x378fff=[];var _0x5c6320={};var _0x16ba9f=![];return db[_0x6b44('0x84')][_0x6b44('0x55')]()[_0x6b44('0x15')](function(_0x8c2ca1){if(!_0x8c2ca1){throw new db[(_0x6b44('0x85'))][(_0x6b44('0x86'))]('no\x20available\x20attributes');}_0xecea53=_[_0x6b44('0x87')](_['keys'](_0x8c2ca1),[_0x6b44('0x88'),'updatedAt']);_0x378fff=_[_0x6b44('0x87')](_['keys'](_0x8c2ca1),['createdAt','updatedAt',_0x6b44('0x89'),_0x6b44('0x8a')]);if(_0x263bfd[_0x6b44('0x4c')]['id']){delete _0x263bfd[_0x6b44('0x4c')]['id'];}if(_[_0x6b44('0x78')](_0x263bfd[_0x6b44('0x4c')][_0x6b44('0x8b')])){throw new db[(_0x6b44('0x85'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x6b44('0x78')](_0x263bfd['body'][_0x6b44('0x4c')])||_0x263bfd['body']['body']===''){throw new db['Sequelize'][(_0x6b44('0x86'))](_0x6b44('0x8c'));}if(_[_0x6b44('0x78')](_0x263bfd[_0x6b44('0x4c')]['mapKey'])){throw new db['Sequelize'][(_0x6b44('0x86'))](_0x6b44('0x8d')+_0x378fff);}if(!_['includes'](_0x378fff,_0x263bfd[_0x6b44('0x4c')][_0x6b44('0x8e')])){throw new db['Sequelize'][(_0x6b44('0x86'))](_0x6b44('0x8f')+_0x378fff);}_0x5c6320[_0x263bfd[_0x6b44('0x4c')]['mapKey']]=_0x263bfd[_0x6b44('0x4c')][_0x6b44('0x8b')];})['then'](function(){return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0x263bfd[_0x6b44('0x47')]['id']},'include':[{'model':db[_0x6b44('0x90')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6b44('0x91'),'where':_0x5c6320,'limit':0x1,'order':[[_0x6b44('0x92'),_0x6b44('0x93')]]}]},{'model':db[_0x6b44('0x94')],'as':_0x6b44('0x95')}]});})[_0x6b44('0x15')](handleEntityNotFound(_0x237ae4,null))['then'](function(_0x570e90){if(_0x570e90&&_0x570e90['List']){_0x49b2a0[_0x6b44('0x96')]=_0x570e90;_0x49b2a0[_0x6b44('0x97')]=_0x570e90[_0x6b44('0x95')];_0x49b2a0[_0x6b44('0x98')]=_0x570e90[_0x6b44('0x99')];_0x49b2a0[_0x6b44('0x97')]=_[_0x6b44('0x9a')](_0x49b2a0[_0x6b44('0x97')],[_0x6b44('0x9b')],['asc']);if(_0x49b2a0['account'][_0x6b44('0x95')]){delete _0x49b2a0[_0x6b44('0x96')][_0x6b44('0x95')];}if(_0x49b2a0['account'][_0x6b44('0x99')]&&_0x49b2a0[_0x6b44('0x96')][_0x6b44('0x99')][_0x6b44('0x91')]['length']){return _0x49b2a0['account']['List'][_0x6b44('0x91')][0x0];}var _0xb11eed=_[_0x6b44('0xc')](_0x263bfd[_0x6b44('0x4c')],{'firstName':_0x263bfd[_0x6b44('0x4c')][_0x6b44('0x8b')],'ListId':_0x570e90[_0x6b44('0x8a')]});_0xb11eed[_0x263bfd[_0x6b44('0x4c')][_0x6b44('0x8e')]]=_0x263bfd[_0x6b44('0x4c')][_0x6b44('0x8b')];return db[_0x6b44('0x84')][_0x6b44('0x4b')](_0xb11eed,{'fields':_0xecea53,'raw':!![]});}})['then'](handleEntityNotFound(_0x237ae4,null))['then'](function(_0x113536){_0x49b2a0[_0x6b44('0x9c')]=_0x113536;var _0x21901f=_0x263bfd['body'][_0x6b44('0x9d')];if(_0x263bfd[_0x6b44('0x81')][_0x6b44('0x9e')]){_0x21901f=_0x263bfd['headers'][_0x6b44('0x9e')];}else if(_0x263bfd[_0x6b44('0x81')][_0x6b44('0x9f')]){_0x21901f=_['first'](_0x263bfd[_0x6b44('0x81')][_0x6b44('0x9f')][_0x6b44('0xa0')](','));}if(_0x113536){var _0x54366d={'ContactId':_0x113536['id'],'ChatWebsiteId':_0x263bfd[_0x6b44('0x47')]['id'],'from':(_0x113536['firstName']||'')+'\x20'+(_0x113536[_0x6b44('0xa1')]||''),'customerIp':_0x21901f,'customerPort':_0x263bfd['headers'][_0x6b44('0xa2')]?_0x263bfd[_0x6b44('0x81')][_0x6b44('0xa2')]:null,'referer':_0x263bfd[_0x6b44('0x4c')]['referer'],'browserName':_0x3a66b4[_0x6b44('0xa3')]['name']&&_0x3a66b4[_0x6b44('0xa3')][_0x6b44('0xa4')]?util['format'](_0x6b44('0xa5'),_0x3a66b4[_0x6b44('0xa3')][_0x6b44('0x2c')],_0x3a66b4[_0x6b44('0xa3')][_0x6b44('0xa4')]):_0x6b44('0xa6'),'browserVersion':_0x3a66b4[_0x6b44('0xa3')][_0x6b44('0xa4')]||_0x6b44('0xa6'),'osName':util['format']('%s\x20%s',_0x3a66b4['os'][_0x6b44('0x2c')],_0x3a66b4['os'][_0x6b44('0xa4')]),'osVersion':_0x3a66b4['os'][_0x6b44('0xa4')],'deviceModel':_0x3a66b4[_0x6b44('0xa7')][_0x6b44('0x39')]&&_0x3a66b4[_0x6b44('0xa7')][_0x6b44('0xa8')]?util[_0x6b44('0xa9')](_0x6b44('0xaa'),_0x3a66b4['device'][_0x6b44('0x39')],_0x3a66b4[_0x6b44('0xa7')][_0x6b44('0xa8')],_0x3a66b4['device'][_0x6b44('0x33')]):null,'deviceVendor':_0x3a66b4[_0x6b44('0xa7')][_0x6b44('0xa8')],'deviceType':_0x3a66b4[_0x6b44('0xa7')]['type'],'formData':JSON[_0x6b44('0x1a')](_0x263bfd[_0x6b44('0x4c')])};var _0x315bca={'ChatWebsiteId':_0x263bfd[_0x6b44('0x47')]['id'],'closed':![]};if(_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xab')]){_0x315bca[_0x6b44('0xab')]=_0x263bfd[_0x6b44('0x4c')]['threadId'];return db[_0x6b44('0xac')][_0x6b44('0x4a')]({'where':_0x315bca})[_0x6b44('0x15')](function(_0x2ffd2c){if(_0x2ffd2c){return[_0x2ffd2c,![]];}_0x54366d['threadId']=_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xab')];_0x54366d['externalUrl']=_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xad')];return db[_0x6b44('0xac')][_0x6b44('0x4b')](_0x54366d)[_0x6b44('0x15')](function(_0x1c4de9){return[_0x1c4de9,!![]];});});}_0x315bca['ContactId']=_0x113536['id'];if(_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xae')]&&_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xae')]['id']){_0x315bca['id']=_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xae')]['id'];return db[_0x6b44('0xac')][_0x6b44('0x4a')]({'where':_0x315bca})['then'](function(_0x2a92d1){if(_0x2a92d1){return[_0x2a92d1,![]];}return db[_0x6b44('0xac')]['create'](_0x54366d)['then'](function(_0x52b30e){return[_0x52b30e,!![]];});});}return db[_0x6b44('0xac')][_0x6b44('0x4b')](_0x54366d)[_0x6b44('0x15')](function(_0x31b9a8){return[_0x31b9a8,!![]];});}})[_0x6b44('0xaf')](function(_0x285003,_0x205adc){if(_0x285003){_0x16ba9f=_0x205adc;if(!_0x205adc){var _0x77190={'from':(_0x49b2a0[_0x6b44('0x9c')][_0x6b44('0xb0')]||'')+'\x20'+(_0x49b2a0['contact'][_0x6b44('0xa1')]||'')};if(_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xab')]&&_0x263bfd[_0x6b44('0x4c')]['messageId']&&_0x263bfd[_0x6b44('0x4c')]['threadId']!=_0x263bfd['body'][_0x6b44('0xb1')]){_0x77190[_0x6b44('0xab')]=_0x263bfd[_0x6b44('0x4c')][_0x6b44('0xb1')];}return _0x285003['update'](_0x77190);}else{return _0x285003;}}})[_0x6b44('0x15')](function(_0x298094){_0x49b2a0['interaction']=_0x298094[_0x6b44('0x29')]({'plain':!![]});_0x49b2a0[_0x6b44('0xae')][_0x6b44('0xb2')]=_0x16ba9f;if(_0x49b2a0[_0x6b44('0xae')][_0x6b44('0xb2')]){if(_0x49b2a0[_0x6b44('0x96')][_0x6b44('0xb3')]){_0x49b2a0['applications'][_0x6b44('0xb4')]({'id':0x0,'priority':_0x49b2a0[_0x6b44('0x97')][_0x6b44('0x3c')]+0x1,'app':_0x6b44('0xb5'),'appdata':_0x6b44('0xb6'),'interval':_0x6b44('0xb7')});}}return db[_0x6b44('0xb8')][_0x6b44('0x4b')]({'body':_0x263bfd[_0x6b44('0x4c')][_0x6b44('0x4c')],'ChatWebsiteId':_0x263bfd['params']['id'],'ChatInteractionId':_0x298094['id'],'direction':'in','ContactId':_0x49b2a0[_0x6b44('0x9c')]['id'],'AttachmentId':_0x263bfd['body'][_0x6b44('0xb9')]});})[_0x6b44('0x15')](function(_0x551feb){_0x49b2a0[_0x6b44('0x1c')]=_0x551feb;if(_0x49b2a0[_0x6b44('0xae')]['UserId']){return db[_0x6b44('0xba')][_0x6b44('0x4a')]({'attributes':['id',_0x6b44('0x2c')],'where':{'id':_0x49b2a0[_0x6b44('0xae')]['UserId']}})[_0x6b44('0x15')](function(_0x49ae8c){if(_0x49ae8c){_0x49b2a0['applications'][_0x6b44('0xbb')]({'id':0x0,'priority':0x0,'app':_0x6b44('0xbc'),'appdata':_0x49ae8c[_0x6b44('0x2c')]+','+(_0x49b2a0[_0x6b44('0x96')]['waitForTheAssignedAgent']||0xa),'interval':_0x6b44('0xb7')});_0x49b2a0[_0x6b44('0xbd')]=!![];}return respondWithRpcPromise(_0x6b44('0xbe'),'startRouting',_0x49b2a0);});}return respondWithRpcPromise('Start',_0x6b44('0xbf'),_0x49b2a0);})[_0x6b44('0x15')](function(_0x11ca41){respondWithRpcPromise(_0x6b44('0xc0'),'EventManager',{'event':_0x6b44('0x7f'),'message':_0x11ca41},client9002);return _0x11ca41;})[_0x6b44('0x15')](respondWithResult(_0x237ae4,null))[_0x6b44('0x1e')](handleError(_0x237ae4,null));};exports[_0x6b44('0xc1')]=function(_0x537c0a,_0x1229c1){var _0x3b75ea,_0x22e02d,_0x11337c;var _0x7122eb=[];var _0x310fc5={};var _0x23ad71=_0x537c0a[_0x6b44('0xc2')]||[];var _0x1c9d76=[];var _0x20e671;return db['CmContact'][_0x6b44('0x55')]()[_0x6b44('0x15')](function(_0x2d9a44){if(!_0x2d9a44){throw new db[(_0x6b44('0x85'))][(_0x6b44('0x86'))](_0x6b44('0xc3'));}_0x7122eb=_[_0x6b44('0x87')](_['keys'](_0x2d9a44),[_0x6b44('0x88'),_0x6b44('0x92'),_0x6b44('0x89'),_0x6b44('0x8a')]);if(_0x537c0a['body']['id']){delete _0x537c0a[_0x6b44('0x4c')]['id'];}if(_[_0x6b44('0x78')](_0x537c0a[_0x6b44('0x4c')]['from'])){throw _0x1229c1[_0x6b44('0x20')](0x1f4)['send'](new db['Sequelize'][(_0x6b44('0x86'))](_0x6b44('0xc4')));}if(_[_0x6b44('0x78')](_0x537c0a['body'][_0x6b44('0x4c')])||_0x537c0a[_0x6b44('0x4c')][_0x6b44('0x4c')]===''){throw _0x1229c1[_0x6b44('0x20')](0x1f4)[_0x6b44('0x2d')](new db[(_0x6b44('0x85'))][(_0x6b44('0x86'))](_0x6b44('0x8c')));}if(_[_0x6b44('0x78')](_0x537c0a[_0x6b44('0x4c')][_0x6b44('0xc5')])){throw _0x1229c1[_0x6b44('0x20')](0x1f4)[_0x6b44('0x2d')](new db[(_0x6b44('0x85'))]['ValidationError'](_0x6b44('0xc6')+_0x7122eb));}if(!_[_0x6b44('0xc7')](_0x7122eb,_0x537c0a['body'][_0x6b44('0xc5')])){throw _0x1229c1[_0x6b44('0x20')](0x1f4)[_0x6b44('0x2d')](new db[(_0x6b44('0x85'))][(_0x6b44('0x86'))](_0x6b44('0xc8')+_0x7122eb));}_0x310fc5[_0x537c0a[_0x6b44('0x4c')]['mapKeyOffline']]=_0x537c0a[_0x6b44('0x4c')][_0x6b44('0x8b')];})[_0x6b44('0x15')](function(){return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0x537c0a[_0x6b44('0x47')]['id']},'include':[{'model':db[_0x6b44('0x90')],'as':_0x6b44('0x99')},{'model':db[_0x6b44('0xc9')],'as':_0x6b44('0xc9')}]});})[_0x6b44('0x15')](handleEntityNotFound(_0x1229c1,null))[_0x6b44('0x15')](function(_0x3fb667){if(_0x3fb667&&_0x3fb667['List']){_0x22e02d=_0x3fb667;var _0x2e2649=_[_0x6b44('0xc')](_0x537c0a[_0x6b44('0x4c')],{'firstName':_0x537c0a[_0x6b44('0x4c')][_0x6b44('0x8b')],'phone':_0x537c0a[_0x6b44('0x4c')][_0x6b44('0x8b')],'ListId':_0x3fb667[_0x6b44('0x8a')]});_0x2e2649[_0x537c0a[_0x6b44('0x4c')][_0x6b44('0xc5')]]=_0x537c0a[_0x6b44('0x4c')][_0x6b44('0x8b')];return db[_0x6b44('0x84')][_0x6b44('0xca')]({'where':_0x310fc5,'defaults':_0x2e2649});}})[_0x6b44('0xaf')](function(_0x40f1b8){if(_0x40f1b8){_0x11337c=_0x40f1b8;var _0x2a6d7f=fs[_0x6b44('0xcb')](path[_0x6b44('0x74')](config[_0x6b44('0x72')],_0x6b44('0xcc')),_0x6b44('0xcd'));var _0x7023ec=ejs[_0x6b44('0xce')](_0x2a6d7f,{'body':_[_0x6b44('0xcf')](_0x537c0a['body'][_0x6b44('0x4c')]),'bodyTitle':_0x22e02d[_0x6b44('0xd0')]});return db[_0x6b44('0xd1')][_0x6b44('0x4b')]({'body':_0x7023ec,'ContactId':_0x40f1b8['id'],'ChatWebsiteId':_0x22e02d['id']});}})[_0x6b44('0x15')](function(_0x5c3a56){_0x20e671=_0x5c3a56;if(_0x23ad71[_0x6b44('0x3c')]){var _0x3fedc3=_0x23ad71['map'](function(_0x2402b1){return{'name':_0x2402b1[_0x6b44('0xd2')],'basename':_0x2402b1['filename'],'type':_0x2402b1[_0x6b44('0xd3')],'ChatOfflineMessageId':_0x5c3a56['id']};});_0x1c9d76=_0x3fedc3[_0x6b44('0x30')](_0x334486=>{var _0x118cb2={'filename':_0x334486['name'],'path':path['join'](config[_0x6b44('0x72')],'server',_0x6b44('0xc2'),_0x6b44('0xd4'),_0x6b44('0xd5'),_0x334486[_0x6b44('0xd6')])};return _0x118cb2;});if(!_0x22e02d[_0x6b44('0xd7')]){return db['sequelize'][_0x6b44('0xd8')](function(_0x123794){return db[_0x6b44('0xd9')][_0x6b44('0xda')](_0x3fedc3,{'transaction':_0x123794});});}}})[_0x6b44('0x15')](function(){if(_0x20e671){_0x3b75ea=_0x20e671;return db[_0x6b44('0xc9')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x6b44('0xdb')],'as':_0x6b44('0xdc'),'raw':!![]}]});}})[_0x6b44('0x15')](function(_0x4cd268){if(_0x4cd268&&_0x4cd268[_0x6b44('0xdc')]&&_0x22e02d[_0x6b44('0xdd')]&&_0x22e02d[_0x6b44('0xde')]){var _0x5a011b={'tls':{'rejectUnauthorized':![]}};if(_0x4cd268['Smtp']['service']){_0x5a011b[_0x6b44('0xdf')]=_0x4cd268[_0x6b44('0xdc')][_0x6b44('0xdf')];}else{_0x5a011b['host']=_0x4cd268['Smtp'][_0x6b44('0xe0')];_0x5a011b[_0x6b44('0xe1')]=_0x4cd268['Smtp'][_0x6b44('0xe1')];_0x5a011b['secure']=_0x4cd268[_0x6b44('0xdc')][_0x6b44('0xe2')];}if(_0x4cd268[_0x6b44('0xdc')]['authentication']){_0x5a011b[_0x6b44('0xe3')]={'user':_0x4cd268[_0x6b44('0xdc')]['user'],'pass':_0x4cd268[_0x6b44('0xdc')][_0x6b44('0xe4')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5a011b,'message':{'from':util[_0x6b44('0xa9')](_0x6b44('0xe5'),_0x4cd268[_0x6b44('0x2c')],_0x4cd268['email']||_0x4cd268[_0x6b44('0xdc')][_0x6b44('0x4f')]),'to':_0x22e02d[_0x6b44('0xde')],'subject':_0x22e02d[_0x6b44('0xe6')],'html':_0x3b75ea[_0x6b44('0x4c')],'attachments':_0x1c9d76}},client9003)[_0x6b44('0x15')](function(){return _0x3b75ea;})[_0x6b44('0x1e')](function(_0x200fb7){console['error'](_0x200fb7);});}})['then'](function(){if(_0x22e02d&&_0x22e02d[_0x6b44('0xd7')]&&_0x22e02d[_0x6b44('0xe7')]){var _0x4f5d8d=[];if(_0x23ad71[_0x6b44('0x3c')]){_0x4f5d8d=_0x23ad71[_0x6b44('0x30')](function(_0x738eec){return{'name':_0x738eec[_0x6b44('0xd2')],'basename':_0x738eec['filename'],'type':_0x738eec[_0x6b44('0xd3')],'ChatOfflineMessageId':_0x20e671['id']};});}var _0x23bbd0;if(!_['isNil'](_0x22e02d[_0x6b44('0xe8')])){var _0x20e337=_[_0x6b44('0x30')](_0x537c0a[_0x6b44('0x4c')],function(_0x2dc947){return _0x2dc947;});var _0x522791=_[_0x6b44('0xe9')](_0x20e337)[0x0];var _0x382112=_[_0x6b44('0xea')](_0x522791,function(_0x13a9d9){return _0x13a9d9;});_0x23bbd0=_0x382112[0x1][_0x22e02d[_0x6b44('0xe8')]];}var _0x9ae8b1={'from':_0x11337c[_0x6b44('0xeb')],'firstName':_0x11337c[_0x6b44('0xb0')],'lastName':_0x11337c[_0x6b44('0xa1')],'mapKey':'email','message':{'from':_0x11337c[_0x6b44('0xeb')],'to':_0x22e02d[_0x6b44('0xc9')][_0x6b44('0xeb')],'cc':'','subject':_['isNil'](_0x23bbd0)?_0x22e02d[_0x6b44('0xe6')]:_0x23bbd0,'messageId':'','sentAt':new Date(),'attach':_0x4f5d8d['length'],'attachments':_0x4f5d8d,'originChannel':_0x6b44('0xec'),'ChatWebsiteId':_0x22e02d['id'],'ChatOfflineMessageId':_0x3b75ea['id'],'originTo':_0x22e02d['MailAccount'][_0x6b44('0xeb')]},'body':_0x3b75ea['body']};var _0x2a891b={'account':{'id':_0x22e02d[_0x6b44('0xe7')]},'body':_0x9ae8b1,'log':_0x6b44('0xed')};return respondWithRpcPromise(_0x6b44('0xed'),_0x6b44('0xee'),_0x2a891b,client9001)['then'](function(){return _0x3b75ea;})['catch'](function(_0x5901a6){console[_0x6b44('0x1b')](_0x5901a6);});}return;})[_0x6b44('0x15')](function(){if(_0x3b75ea){return _0x3b75ea;}})[_0x6b44('0x15')](respondWithResult(_0x1229c1,null))['catch'](function(_0x3ba5d4){console[_0x6b44('0x1b')]('catch',_0x3ba5d4);for(var _0xa180d8 of _0x23ad71){var _0x184d5a=path['join'](config[_0x6b44('0x72')],_0x6b44('0xef'),_0x6b44('0xc2'),_0x6b44('0xd4'),_0x6b44('0xd5'),_0xa180d8[_0x6b44('0x65')]);fs_extra['remove'](_0x184d5a)['catch'](function(_0x2e5798){console[_0x6b44('0x1b')](_0x6b44('0xf0'),_0x184d5a,_0x2e5798);});}});};exports[_0x6b44('0xf1')]=function(_0x118a75,_0x17bbd9){return db[_0x6b44('0xac')][_0x6b44('0x4a')]({'where':{'id':_0x118a75[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x17bbd9,null))[_0x6b44('0x15')](function(_0x5df28b){if(_0x5df28b){return _0x5df28b['addInteraction'](_0x118a75[_0x6b44('0x4c')]['ids'],_[_0x6b44('0xf2')](_0x118a75[_0x6b44('0x4c')],[_0x6b44('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x17bbd9,null))[_0x6b44('0x1e')](handleError(_0x17bbd9,null));};exports[_0x6b44('0xf3')]=function(_0x5af3a8,_0xab71ab){var _0x18b9a5={'raw':![],'where':{}};var _0x591762={};var _0x96f7a2={'count':0x0,'rows':[]};return db[_0x6b44('0x31')][_0x6b44('0x61')]({'where':{'id':_0x5af3a8[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0xab71ab,null))['then'](function(_0x3d86e7){if(_0x3d86e7){_0x591762[_0x6b44('0x39')]=_[_0x6b44('0x36')](db['ChatInteraction']['rawAttributes']);_0x591762[_0x6b44('0x35')]=_[_0x6b44('0x36')](_0x5af3a8[_0x6b44('0x35')]);_0x591762[_0x6b44('0x37')]=_[_0x6b44('0x38')](_0x591762[_0x6b44('0x39')],_0x591762['query']);_0x18b9a5[_0x6b44('0x3b')]=_[_0x6b44('0x38')](_0x591762[_0x6b44('0x39')],qs[_0x6b44('0x3a')](_0x5af3a8[_0x6b44('0x35')][_0x6b44('0x3a')]));_0x18b9a5[_0x6b44('0x3b')]=_0x18b9a5[_0x6b44('0x3b')]['length']?_0x18b9a5['attributes']:_0x591762[_0x6b44('0x39')];if(!_0x5af3a8[_0x6b44('0x35')]['hasOwnProperty']('nolimit')){_0x18b9a5[_0x6b44('0x25')]=qs['limit'](_0x5af3a8['query'][_0x6b44('0x25')]);_0x18b9a5[_0x6b44('0x23')]=qs['offset'](_0x5af3a8[_0x6b44('0x35')][_0x6b44('0x23')]);}_0x18b9a5[_0x6b44('0x3f')]=qs[_0x6b44('0x40')](_0x5af3a8[_0x6b44('0x35')]['sort']);_0x18b9a5[_0x6b44('0x43')]=qs[_0x6b44('0x37')](_[_0x6b44('0x41')](_0x5af3a8[_0x6b44('0x35')],_0x591762[_0x6b44('0x37')]));_0x18b9a5[_0x6b44('0x43')][_0x6b44('0x57')]=_0x3d86e7['id'];if(_0x5af3a8['query']['filter']){_0x18b9a5[_0x6b44('0x43')]=_[_0x6b44('0x59')](_0x18b9a5['where'],{'$or':_['map'](_0x18b9a5['attributes'],function(_0x35d1b4){var _0x118504={};_0x118504[_0x35d1b4]={'$like':'%'+_0x5af3a8['query'][_0x6b44('0x42')]+'%'};return _0x118504;})});}_0x18b9a5=_[_0x6b44('0x59')]({},_0x18b9a5,_0x5af3a8[_0x6b44('0x44')]);return db['ChatInteraction'][_0x6b44('0x26')]({'where':_0x18b9a5[_0x6b44('0x43')]})[_0x6b44('0x15')](function(_0xbbfce8){_0x96f7a2[_0x6b44('0x26')]=_0xbbfce8;if(_0x5af3a8[_0x6b44('0x35')][_0x6b44('0x49')]){_0x18b9a5['include']=[{'model':db[_0x6b44('0x84')],'as':_0x6b44('0xf4'),'required':![]},{'model':db[_0x6b44('0xba')],'as':'Owner','attributes':[_0x6b44('0x2c'),_0x6b44('0xf5'),_0x6b44('0xf6')],'required':![]},{'model':db[_0x6b44('0xf7')],'as':_0x6b44('0xf8'),'attributes':['id','name',_0x6b44('0xf9')],'where':_0x5af3a8[_0x6b44('0x35')]['tag']?{'id':_0x5af3a8[_0x6b44('0x35')]['tag']}:undefined,'required':_0x5af3a8['query'][_0x6b44('0xfa')]?!![]:![]}];}return db['ChatInteraction'][_0x6b44('0x5a')](_0x18b9a5);})['then'](function(_0x270301){_0x96f7a2[_0x6b44('0x5b')]=_0x270301;return _0x96f7a2;});}})[_0x6b44('0x15')](respondWithFilteredResult(_0xab71ab,_0x18b9a5))[_0x6b44('0x1e')](handleError(_0xab71ab,null));};function iftimePromise(_0x12197a,_0x5428d2){return respondWithRpcPromise(_0x6b44('0xfb'),_0x6b44('0xfc'),{'command':_0x5428d2[_0x6b44('0xfd')]?util['format'](_0x6b44('0xfe'),_0x12197a[_0x6b44('0xff')],_0x5428d2[_0x6b44('0xfd')]):util[_0x6b44('0xa9')](_0x6b44('0x100'),_0x12197a[_0x6b44('0xff')])},client9002)[_0x6b44('0x15')](function(_0x2df17b){var _0x2eacef=_0x2df17b&&_0x2df17b[_0x6b44('0x101')](_0x6b44('0x102'))>=0x0?!![]:![];logger[_0x6b44('0x16')](_0x6b44('0x103'),_0x5428d2['id'],_0x12197a['id'],_0x12197a[_0x6b44('0xff')],_0x2eacef?'ONLINE':_0x6b44('0x104'),_0x5428d2[_0x6b44('0xfd')]?_0x5428d2['timezone']:_0x6b44('0x105'));return _0x2eacef;})[_0x6b44('0x1e')](function(_0x357092){logger['error'](_0x6b44('0x103'),_0x5428d2['id'],_0x12197a['id'],_0x12197a[_0x6b44('0xff')],util[_0x6b44('0x106')](_0x357092,{'showHidden':![],'depth':null}),_0x5428d2[_0x6b44('0xfd')]?_0x5428d2['timezone']:_0x6b44('0x105'));return![];});}exports[_0x6b44('0xfc')]=function(_0x8f9053,_0x5902e0){var _0x1b0a9d=0x0;var _0x26c2ec=0x0;var _0x175b11=![];var _0x575ffe;var _0x1b34b8;return db['ChatWebsite'][_0x6b44('0x4a')]({'where':{'id':_0x8f9053[_0x6b44('0x47')]['id']},'include':[{'model':db['Interval'],'as':_0x6b44('0x107'),'include':[{'model':db[_0x6b44('0x107')],'as':_0x6b44('0x108'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x6b44('0x15')](handleEntityNotFound(_0x5902e0,null))[_0x6b44('0x15')](function(_0x58f731){if(_0x58f731){_0x575ffe=_0x58f731;return _0x58f731[_0x6b44('0x109')]({'raw':!![]});}})[_0x6b44('0x15')](function(_0x1ace2a){if(_0x575ffe){if(_0x1ace2a){_0x1b34b8=_0x1ace2a;}}return require(_0x6b44('0x6e'))[_0x6b44('0x6f')]();})[_0x6b44('0x15')](function(_0x19c6d6){if(_0x19c6d6){_0x26c2ec=_0x19c6d6[_0x6b44('0x10a')];_0x175b11=_0x19c6d6[_0x6b44('0x70')];}})[_0x6b44('0x15')](function(){return db[_0x6b44('0xac')]['count']({'where':{'closed':![]}});})[_0x6b44('0x15')](function(_0x4741eb){_0x1b0a9d=_0x4741eb;if(_0x26c2ec&&_0x4741eb>_0x26c2ec){return db[_0x6b44('0x10b')][_0x6b44('0x61')]({'where':{'id':0x1}})[_0x6b44('0x15')](function(_0x5cbca9){if(_0x5cbca9){_0x5cbca9['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x575ffe[_0x6b44('0x107')]&&_0x575ffe['Interval'][_0x6b44('0x108')]){var _0x3e8d7f=[];for(var _0x5cc637=0x0;_0x5cc637<_0x575ffe[_0x6b44('0x107')][_0x6b44('0x108')][_0x6b44('0x3c')];_0x5cc637++){var _0x25c13b=_0x575ffe[_0x6b44('0x107')][_0x6b44('0x108')][_0x5cc637][_0x6b44('0x29')]({'plain':!![]});_0x3e8d7f[_0x6b44('0xb4')](iftimePromise(_0x25c13b,_0x575ffe));}return BPromise['all'](_0x3e8d7f)[_0x6b44('0x15')](function(_0x3a8b98){return _[_0x6b44('0x10c')](_0x3a8b98);});}else{return!![];}})[_0x6b44('0x15')](function(_0x2b54d1){var _0x76b35d=fs['readFileSync'](path[_0x6b44('0x74')](config[_0x6b44('0x72')],_0x6b44('0x10d')),_0x6b44('0xcd'));var _0x1dbeab={'remote':_0x575ffe[_0x6b44('0x10e')],'query':querystring[_0x6b44('0x1a')](_[_0x6b44('0x59')](_0x575ffe[_0x6b44('0x29')]({'plain':!![]}),{'customerIp':_0x8f9053[_0x6b44('0x81')][_0x6b44('0x9f')]||_0x8f9053[_0x6b44('0x81')][_0x6b44('0x10f')]||_0x8f9053['connection']['remoteAddress']||_0x8f9053['ip'],'referer':_0x8f9053[_0x6b44('0x81')][_0x6b44('0x110')],'openedInteractions':_0x1b0a9d,'maxInteractions':_0x26c2ec,'virtual':_0x175b11[_0x6b44('0x10a')],'online':_0x2b54d1,'custom':_0x175b11}))[_0x6b44('0x111')](/'/g,'\x5c\x27')};_0x5902e0['send'](ejs[_0x6b44('0xce')](Mustache[_0x6b44('0xce')](_0x76b35d,_0x1dbeab),{'proactiveActions':_0x1b34b8,'alignment':_0x575ffe[_0x6b44('0x112')],'verticalAlignment':_0x575ffe[_0x6b44('0x113')],'div_color':_0x575ffe['color'],'text_color':_0x575ffe[_0x6b44('0x114')],'button_color':_0x575ffe['color_button'],'background_color':_0x575ffe[_0x6b44('0x115')]}));})[_0x6b44('0x1e')](handleError(_0x5902e0,null));};exports['addApplications']=function(_0x1d9afe,_0x215bb0){var _0x4d6f5d=_0x1d9afe[_0x6b44('0x47')]['id'];var _0x34d4f8=_0x1d9afe[_0x6b44('0x4c')];var _0x14363d=0xc8;var _0x22a122=null;return db[_0x6b44('0x116')]['transaction']({'isolationLevel':db['sequelize'][_0x6b44('0x117')][_0x6b44('0x118')][_0x6b44('0x119')]},function(_0x16314b){return db['ChatWebsite'][_0x6b44('0x61')]({'where':{'id':_0x4d6f5d},'transaction':_0x16314b})['then'](function(_0x254f19){if(_0x254f19){return db[_0x6b44('0x94')]['destroy']({'where':{'ChatWebsiteId':_0x4d6f5d},'transaction':_0x16314b})[_0x6b44('0x15')](function(){var _0x34e573=_[_0x6b44('0x30')](_0x34d4f8,function(_0x4429e8){_0x4429e8['ChatWebsiteId']=_0x4d6f5d;return _0x4429e8;});return db['ChatApplication'][_0x6b44('0xda')](_0x34e573,{'transaction':_0x16314b});});}else{_0x14363d=0x194;_0x22a122=[];}});})[_0x6b44('0x15')](function(){if(_0x14363d!==0x194){return db[_0x6b44('0x94')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x4d6f5d},'order':_0x6b44('0x9b')})[_0x6b44('0x15')](function(_0x13582b){_0x22a122=_0x13582b;});}})['catch'](function(_0x3fbe18){_0x14363d=0x1f4;logger[_0x6b44('0x1b')](_0x3fbe18['stack']);if(_0x3fbe18['name']){delete _0x3fbe18[_0x6b44('0x2c')];}_0x22a122=_0x3fbe18;})['finally'](function(){if(_0x22a122===null){_0x215bb0['sendStatus'](_0x14363d);}else{if(_0x14363d===0x1f4){_0x215bb0[_0x6b44('0x20')](_0x14363d)[_0x6b44('0x2d')](_0x22a122);}else{_0x215bb0[_0x6b44('0x20')](_0x14363d)[_0x6b44('0x22')](_0x22a122);}}});};exports['getApplications']=function(_0xcf085b,_0x596348){var _0x5b7c27={};var _0x147173={};var _0x5e6598;var _0x354c96;return db[_0x6b44('0x31')][_0x6b44('0x61')]({'where':{'id':_0xcf085b[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x596348,null))[_0x6b44('0x15')](function(_0x4ba51b){if(_0x4ba51b){_0x5e6598=_0x4ba51b;_0x147173['model']=_['keys'](db['ChatApplication'][_0x6b44('0x48')]);_0x147173['query']=_['keys'](_0xcf085b['query']);_0x147173[_0x6b44('0x37')]=_[_0x6b44('0x38')](_0x147173['model'],_0x147173[_0x6b44('0x35')]);_0x5b7c27[_0x6b44('0x3b')]=_[_0x6b44('0x38')](_0x147173[_0x6b44('0x39')],qs['fields'](_0xcf085b[_0x6b44('0x35')]['fields']));_0x5b7c27[_0x6b44('0x3b')]=_0x5b7c27['attributes'][_0x6b44('0x3c')]?_0x5b7c27['attributes']:_0x147173['model'];_0x5b7c27[_0x6b44('0x3f')]=qs[_0x6b44('0x40')](_0xcf085b[_0x6b44('0x35')][_0x6b44('0x40')]);_0x5b7c27[_0x6b44('0x43')]=qs[_0x6b44('0x37')](_[_0x6b44('0x41')](_0xcf085b[_0x6b44('0x35')],_0x147173[_0x6b44('0x37')]));if(_0xcf085b[_0x6b44('0x35')][_0x6b44('0x42')]){_0x5b7c27['where']=_['merge'](_0x5b7c27[_0x6b44('0x43')],{'$or':_[_0x6b44('0x30')](_0x5b7c27[_0x6b44('0x3b')],function(_0x405840){var _0x332032={};_0x332032[_0x405840]={'$like':'%'+_0xcf085b[_0x6b44('0x35')][_0x6b44('0x42')]+'%'};return _0x332032;})});}_0x5b7c27=_['merge']({},_0x5b7c27,_0xcf085b['options']);return _0x5e6598['getApplications'](_0x5b7c27);}})[_0x6b44('0x15')](function(_0x13d27d){if(_0x13d27d){_0x354c96=_0x13d27d[_0x6b44('0x3c')];if(!_0xcf085b['query']['hasOwnProperty'](_0x6b44('0x3e'))){_0x5b7c27[_0x6b44('0x25')]=qs[_0x6b44('0x25')](_0xcf085b['query']['limit']);_0x5b7c27[_0x6b44('0x23')]=qs[_0x6b44('0x23')](_0xcf085b['query'][_0x6b44('0x23')]);}return _0x5e6598['getApplications'](_0x5b7c27);}})[_0x6b44('0x15')](function(_0x2a7d2e){if(_0x2a7d2e){return _0x2a7d2e?{'count':_0x354c96,'rows':_0x2a7d2e}:null;}})[_0x6b44('0x15')](respondWithResult(_0x596348,null))['catch'](handleError(_0x596348,null));};exports[_0x6b44('0x11a')]=function(_0x562cf1,_0x44ec01){return db['chatProactiveAction'][_0x6b44('0x4a')]({'where':{'id':_0x562cf1['params']['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x44ec01,null))[_0x6b44('0x15')](function(_0x1f7bcc){if(_0x1f7bcc){return _0x1f7bcc[_0x6b44('0x11a')](_0x562cf1[_0x6b44('0x4c')][_0x6b44('0x5d')],_[_0x6b44('0xf2')](_0x562cf1[_0x6b44('0x4c')],[_0x6b44('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x44ec01,null))[_0x6b44('0x1e')](handleError(_0x44ec01,null));};exports[_0x6b44('0x109')]=function(_0x55aa7b,_0x1ac212){var _0x28b058={};var _0xbdaf5e={};var _0x58ec5e;var _0x3df156;return db[_0x6b44('0x31')][_0x6b44('0x61')]({'where':{'id':_0x55aa7b[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x1ac212,null))[_0x6b44('0x15')](function(_0xed4abc){if(_0xed4abc){_0x58ec5e=_0xed4abc;_0xbdaf5e[_0x6b44('0x39')]=_[_0x6b44('0x36')](db[_0x6b44('0x11b')][_0x6b44('0x48')]);_0xbdaf5e[_0x6b44('0x35')]=_[_0x6b44('0x36')](_0x55aa7b['query']);_0xbdaf5e['filters']=_[_0x6b44('0x38')](_0xbdaf5e[_0x6b44('0x39')],_0xbdaf5e['query']);_0x28b058[_0x6b44('0x3b')]=_[_0x6b44('0x38')](_0xbdaf5e[_0x6b44('0x39')],qs[_0x6b44('0x3a')](_0x55aa7b[_0x6b44('0x35')][_0x6b44('0x3a')]));_0x28b058[_0x6b44('0x3b')]=_0x28b058[_0x6b44('0x3b')][_0x6b44('0x3c')]?_0x28b058[_0x6b44('0x3b')]:_0xbdaf5e[_0x6b44('0x39')];_0x28b058[_0x6b44('0x3f')]=qs[_0x6b44('0x40')](_0x55aa7b['query'][_0x6b44('0x40')]);_0x28b058[_0x6b44('0x43')]=qs[_0x6b44('0x37')](_['pick'](_0x55aa7b['query'],_0xbdaf5e[_0x6b44('0x37')]));if(_0x55aa7b[_0x6b44('0x35')][_0x6b44('0x42')]){_0x28b058[_0x6b44('0x43')]=_[_0x6b44('0x59')](_0x28b058[_0x6b44('0x43')],{'$or':_[_0x6b44('0x30')](_0x28b058[_0x6b44('0x3b')],function(_0x3d7ed6){var _0xa481fb={};_0xa481fb[_0x3d7ed6]={'$like':'%'+_0x55aa7b[_0x6b44('0x35')]['filter']+'%'};return _0xa481fb;})});}_0x28b058=_[_0x6b44('0x59')]({},_0x28b058,_0x55aa7b[_0x6b44('0x44')]);return _0x58ec5e[_0x6b44('0x109')](_0x28b058);}})[_0x6b44('0x15')](function(_0x455b4c){if(_0x455b4c){_0x3df156=_0x455b4c[_0x6b44('0x3c')];if(!_0x55aa7b['query']['hasOwnProperty']('nolimit')){_0x28b058[_0x6b44('0x25')]=qs[_0x6b44('0x25')](_0x55aa7b[_0x6b44('0x35')][_0x6b44('0x25')]);_0x28b058['offset']=qs[_0x6b44('0x23')](_0x55aa7b[_0x6b44('0x35')][_0x6b44('0x23')]);}return _0x58ec5e[_0x6b44('0x109')](_0x28b058);}})[_0x6b44('0x15')](function(_0x2ad9c3){if(_0x2ad9c3){return _0x2ad9c3?{'count':_0x3df156,'rows':_0x2ad9c3}:null;}})['then'](respondWithResult(_0x1ac212,null))[_0x6b44('0x1e')](handleError(_0x1ac212,null));};exports[_0x6b44('0x11c')]=function(_0x1c1c2e,_0x51eb54){var _0x50827f=_0x1c1c2e[_0x6b44('0x35')][_0x6b44('0x11d')]==='false'?_0x6b44('0x11e'):'onlineForm';return db[_0x6b44('0x31')]['find']({'attributes':['id',_0x50827f],'where':{'id':_0x1c1c2e[_0x6b44('0x47')]['id']}})['then'](handleEntityNotFound(_0x51eb54,null))['then'](function(_0x46e5c3){if(_0x46e5c3){var _0x75922a=_0x46e5c3[_0x50827f];var _0x586866=_0x75922a&&_0x75922a[_0x6b44('0x11f')]?_0x75922a[_0x6b44('0x11f')]:[];_0x51eb54[_0x6b44('0x2d')]({'fromKey':_[_0x6b44('0x78')](_0x75922a['fromKey'])?undefined:_0x75922a['fromKey'],'count':_0x586866[_0x6b44('0x3c')],'rows':_0x586866});}})[_0x6b44('0x1e')](handleError(_0x51eb54,null));};exports[_0x6b44('0x120')]=function(_0x2756e9,_0x45b346){var _0x1dcf3b={'raw':![],'where':{}};var _0x15c922={};var _0x48a167={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6b44('0x61')]({'where':{'id':_0x2756e9[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x45b346,null))[_0x6b44('0x15')](function(_0x2ac29b){if(_0x2ac29b){_0x15c922[_0x6b44('0x39')]=_[_0x6b44('0x36')](db[_0x6b44('0xd1')]['rawAttributes']);_0x15c922[_0x6b44('0x35')]=_[_0x6b44('0x36')](_0x2756e9[_0x6b44('0x35')]);_0x15c922[_0x6b44('0x37')]=_[_0x6b44('0x38')](_0x15c922[_0x6b44('0x39')],_0x15c922['query']);_0x1dcf3b[_0x6b44('0x3b')]=_[_0x6b44('0x38')](_0x15c922[_0x6b44('0x39')],qs['fields'](_0x2756e9[_0x6b44('0x35')][_0x6b44('0x3a')]));_0x1dcf3b['attributes']=_0x1dcf3b['attributes'][_0x6b44('0x3c')]?_0x1dcf3b[_0x6b44('0x3b')]:_0x15c922[_0x6b44('0x39')];if(!_0x2756e9[_0x6b44('0x35')][_0x6b44('0x3d')](_0x6b44('0x3e'))){_0x1dcf3b[_0x6b44('0x25')]=qs[_0x6b44('0x25')](_0x2756e9[_0x6b44('0x35')][_0x6b44('0x25')]);_0x1dcf3b['offset']=qs[_0x6b44('0x23')](_0x2756e9[_0x6b44('0x35')][_0x6b44('0x23')]);}_0x1dcf3b[_0x6b44('0x3f')]=qs['sort'](_0x2756e9[_0x6b44('0x35')][_0x6b44('0x40')]);_0x1dcf3b[_0x6b44('0x43')]=qs['filters'](_[_0x6b44('0x41')](_0x2756e9['query'],_0x15c922[_0x6b44('0x37')]));_0x1dcf3b['where'][_0x6b44('0x57')]=_0x2ac29b['id'];if(_0x2756e9['query'][_0x6b44('0x42')]){_0x1dcf3b[_0x6b44('0x43')]=_['merge'](_0x1dcf3b[_0x6b44('0x43')],{'$or':_[_0x6b44('0x30')](_0x1dcf3b[_0x6b44('0x3b')],function(_0x596344){var _0x5337a8={};_0x5337a8[_0x596344]={'$like':'%'+_0x2756e9[_0x6b44('0x35')]['filter']+'%'};return _0x5337a8;})});}_0x1dcf3b=_[_0x6b44('0x59')]({},_0x1dcf3b,_0x2756e9['options']);return db[_0x6b44('0xd1')][_0x6b44('0x26')]({'where':_0x1dcf3b[_0x6b44('0x43')]})[_0x6b44('0x15')](function(_0x4b53fb){_0x48a167[_0x6b44('0x26')]=_0x4b53fb;if(_0x2756e9['query']['includeAll']){_0x1dcf3b[_0x6b44('0x45')]=[{'all':!![]}];}else{_0x1dcf3b['include']=[{'model':db[_0x6b44('0x84')],'as':_0x6b44('0xf4'),'required':![]},{'model':db[_0x6b44('0xd9')],'as':'Attachments','required':![]}];}return db[_0x6b44('0xd1')][_0x6b44('0x5a')](_0x1dcf3b);})[_0x6b44('0x15')](function(_0x57ee7f){_0x48a167[_0x6b44('0x5b')]=_0x57ee7f;return _0x48a167;});}})[_0x6b44('0x15')](respondWithFilteredResult(_0x45b346,_0x1dcf3b))[_0x6b44('0x1e')](handleError(_0x45b346,null));};exports[_0x6b44('0x121')]=function(_0x2b46a5,_0xdc2766){return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0x2b46a5[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0xdc2766,null))[_0x6b44('0x15')](function(_0x22ad08){if(_0x22ad08){return _0x22ad08[_0x6b44('0x121')](_0x2b46a5[_0x6b44('0x4c')]['ids'],_[_0x6b44('0xf2')](_0x2b46a5['body'],['ids','id'])||{})[_0x6b44('0xaf')](function(_0x566d3e){for(var _0x3b824b=0x0;_0x3b824b<_0x2b46a5['body'][_0x6b44('0x5d')][_0x6b44('0x3c')];_0x3b824b+=0x1){socket['emit'](_0x6b44('0x122'),{'UserId':Number(_0x2b46a5[_0x6b44('0x4c')]['ids'][_0x3b824b]),'ChatWebsiteId':Number(_0x2b46a5['params']['id'])});}return _0x566d3e;});}})[_0x6b44('0x15')](respondWithResult(_0xdc2766,null))[_0x6b44('0x1e')](handleError(_0xdc2766,null));};exports['removeAgents']=function(_0x31f4c1,_0x2733e2){return db[_0x6b44('0x31')][_0x6b44('0x4a')]({'where':{'id':_0x31f4c1[_0x6b44('0x47')]['id']}})[_0x6b44('0x15')](handleEntityNotFound(_0x2733e2,null))[_0x6b44('0x15')](function(_0xfe97e2){if(_0xfe97e2){return _0xfe97e2[_0x6b44('0x123')](_0x31f4c1['query'][_0x6b44('0x5d')])[_0x6b44('0x15')](function(){if(_[_0x6b44('0x124')](_0x31f4c1[_0x6b44('0x35')][_0x6b44('0x5d')])){for(var _0x1289d3=0x0;_0x1289d3<_0x31f4c1[_0x6b44('0x35')][_0x6b44('0x5d')]['length'];_0x1289d3+=0x1){socket['emit'](_0x6b44('0x125'),{'UserId':Number(_0x31f4c1[_0x6b44('0x35')]['ids'][_0x1289d3]),'ChatWebsiteId':Number(_0x31f4c1[_0x6b44('0x47')]['id'])});}}else{socket['emit'](_0x6b44('0x125'),{'UserId':Number(_0x31f4c1[_0x6b44('0x35')][_0x6b44('0x5d')]),'ChatWebsiteId':Number(_0x31f4c1[_0x6b44('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x2733e2,null))[_0x6b44('0x1e')](handleError(_0x2733e2,null));};exports[_0x6b44('0x126')]=function(_0x2f69ed,_0x5f73a4){var _0x1838f4={};var _0x1bb955={};var _0x51f643;var _0x4f6742;return db[_0x6b44('0x31')][_0x6b44('0x61')]({'where':{'id':_0x2f69ed[_0x6b44('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f73a4,null))[_0x6b44('0x15')](function(_0x378df2){if(_0x378df2){_0x51f643=_0x378df2;_0x1bb955[_0x6b44('0x39')]=_[_0x6b44('0x36')](db[_0x6b44('0xba')][_0x6b44('0x48')]);_0x1bb955['query']=_[_0x6b44('0x36')](_0x2f69ed[_0x6b44('0x35')]);_0x1bb955[_0x6b44('0x37')]=_['intersection'](_0x1bb955[_0x6b44('0x39')],_0x1bb955[_0x6b44('0x35')]);_0x1838f4[_0x6b44('0x3b')]=_[_0x6b44('0x38')](_0x1bb955[_0x6b44('0x39')],qs[_0x6b44('0x3a')](_0x2f69ed[_0x6b44('0x35')][_0x6b44('0x3a')]));_0x1838f4[_0x6b44('0x3b')]=_0x1838f4[_0x6b44('0x3b')][_0x6b44('0x3c')]?_0x1838f4['attributes']:_0x1bb955[_0x6b44('0x39')];_0x1838f4[_0x6b44('0x3f')]=qs[_0x6b44('0x40')](_0x2f69ed['query'][_0x6b44('0x40')]);_0x1838f4[_0x6b44('0x43')]=qs[_0x6b44('0x37')](_[_0x6b44('0x41')](_0x2f69ed[_0x6b44('0x35')],_0x1bb955[_0x6b44('0x37')]));if(_0x2f69ed['query'][_0x6b44('0x42')]){_0x1838f4[_0x6b44('0x43')]=_[_0x6b44('0x59')](_0x1838f4['where'],{'$or':_['map'](_0x1838f4[_0x6b44('0x3b')],function(_0x303faf){var _0x2b110b={};_0x2b110b[_0x303faf]={'$like':'%'+_0x2f69ed[_0x6b44('0x35')][_0x6b44('0x42')]+'%'};return _0x2b110b;})});}_0x1838f4=_[_0x6b44('0x59')]({},_0x1838f4,_0x2f69ed[_0x6b44('0x44')]);return _0x51f643[_0x6b44('0x126')](_0x1838f4);}})[_0x6b44('0x15')](function(_0x391a76){if(_0x391a76){_0x4f6742=_0x391a76[_0x6b44('0x3c')];if(!_0x2f69ed['query'][_0x6b44('0x3d')](_0x6b44('0x3e'))){_0x1838f4[_0x6b44('0x25')]=qs['limit'](_0x2f69ed[_0x6b44('0x35')]['limit']);_0x1838f4[_0x6b44('0x23')]=qs['offset'](_0x2f69ed[_0x6b44('0x35')]['offset']);}return _0x51f643[_0x6b44('0x126')](_0x1838f4);}})[_0x6b44('0x15')](function(_0xbd16c4){if(_0xbd16c4){return _0xbd16c4?{'count':_0x4f6742,'rows':_0xbd16c4}:null;}})[_0x6b44('0x15')](respondWithResult(_0x5f73a4,null))['catch'](handleError(_0x5f73a4,null));}; \ No newline at end of file +var _0x96fa=['request\x20sent','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','length','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','files','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','server','attachments','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','originalname','subjectOffline','toPairsIn','mapValues','MailAccountId','NotifyMailAccount','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','Intervals','push','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','replace','alignment','verticalAlignment','textColor','backgroundColor','transaction','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','debug','stringify','code','error','message','info'];(function(_0x37095b,_0x26feb7){var _0x15c35f=function(_0x541504){while(--_0x541504){_0x37095b['push'](_0x37095b['shift']());}};_0x15c35f(++_0x26feb7);}(_0x96fa,0x10c));var _0xa96f=function(_0x18b7cb,_0x38a752){_0x18b7cb=_0x18b7cb-0x0;var _0x39ad51=_0x96fa[_0x18b7cb];return _0x39ad51;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xa96f('0x0'));var util=require(_0xa96f('0x1'));var path=require(_0xa96f('0x2'));var ejs=require(_0xa96f('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa96f('0x4'));var querystring=require('querystring');var Redis=require(_0xa96f('0x5'));var qs=require(_0xa96f('0x6'));var logger=require(_0xa96f('0x7'))(_0xa96f('0x8'));var config=require(_0xa96f('0x9'));var db=require(_0xa96f('0xa'))['db'];config[_0xa96f('0xb')]=_[_0xa96f('0xc')](config[_0xa96f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa96f('0xb')]));require(_0xa96f('0xd'))[_0xa96f('0xe')](socket);var jayson=require(_0xa96f('0xf'));var client=jayson[_0xa96f('0x10')][_0xa96f('0x11')]({'port':0x232c});var client9002=jayson[_0xa96f('0x10')][_0xa96f('0x11')]({'port':0x232a});var client9003=jayson[_0xa96f('0x10')][_0xa96f('0x11')]({'port':0x232b});var client9001=jayson[_0xa96f('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x357dcf,_0x1c3b10,_0x5b3fa9,_0x120161){return new BPromise(function(_0x5c0938,_0x3f16ec){var _0x484bb6=_0x120161||client;return _0x484bb6[_0xa96f('0x12')](_0x357dcf,_0x5b3fa9)[_0xa96f('0x13')](function(_0x436e8b){logger['info'](_0xa96f('0x14'),_0x1c3b10,'request\x20sent');logger[_0xa96f('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1c3b10,'request\x20sent',JSON[_0xa96f('0x16')](_0x436e8b));if(_0x436e8b['error']){if(_0x436e8b['error'][_0xa96f('0x17')]===0x1f4){logger['error'](_0xa96f('0x14'),_0x1c3b10,_0x436e8b[_0xa96f('0x18')][_0xa96f('0x19')]);return _0x3f16ec(_0x436e8b[_0xa96f('0x18')]['message']);}logger[_0xa96f('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1c3b10,_0x436e8b[_0xa96f('0x18')][_0xa96f('0x19')]);return _0x5c0938(_0x436e8b['error'][_0xa96f('0x19')]);}else{logger[_0xa96f('0x1a')](_0xa96f('0x14'),_0x1c3b10,_0xa96f('0x1b'));_0x5c0938(_0x436e8b[_0xa96f('0x1c')][_0xa96f('0x19')]);}})[_0xa96f('0x1d')](function(_0x353715){logger[_0xa96f('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1c3b10,_0x353715);_0x3f16ec(_0x353715);});});}function respondWithStatusCode(_0x2b75a5,_0x4d8834){_0x4d8834=_0x4d8834||0xcc;return function(_0x3a822e){if(_0x3a822e){return _0x2b75a5[_0xa96f('0x1e')](_0x4d8834);}return _0x2b75a5[_0xa96f('0x1f')](_0x4d8834)[_0xa96f('0x20')]();};}function respondWithResult(_0x4e2517,_0xe0cf5d){_0xe0cf5d=_0xe0cf5d||0xc8;return function(_0x289ddc){if(_0x289ddc){return _0x4e2517[_0xa96f('0x1f')](_0xe0cf5d)['json'](_0x289ddc);}};}function respondWithFilteredResult(_0x558ea2,_0x17ee33){return function(_0x5a3535){if(_0x5a3535){var _0x52d567=typeof _0x17ee33[_0xa96f('0x21')]===_0xa96f('0x22')&&typeof _0x17ee33['limit']===_0xa96f('0x22');var _0x577aea=_0x5a3535[_0xa96f('0x23')];var _0x9bf4ca=_0x52d567?0x0:_0x17ee33[_0xa96f('0x21')];var _0x302cd0=_0x52d567?_0x5a3535[_0xa96f('0x23')]:_0x17ee33[_0xa96f('0x21')]+_0x17ee33[_0xa96f('0x24')];var _0x44d555;if(_0x302cd0>=_0x577aea){_0x302cd0=_0x577aea;_0x44d555=0xc8;}else{_0x44d555=0xce;}_0x558ea2[_0xa96f('0x1f')](_0x44d555);return _0x558ea2[_0xa96f('0x25')](_0xa96f('0x26'),_0x9bf4ca+'-'+_0x302cd0+'/'+_0x577aea)[_0xa96f('0x27')](_0x5a3535);}return null;};}function saveUpdates(_0x2e69c9){return function(_0x2e89e2){if(_0x2e89e2){return _0x2e89e2[_0xa96f('0x28')](_0x2e69c9)['then'](function(_0xe13d74){return _0xe13d74;});}return null;};}function removeEntity(_0x58d4a5){return function(_0x4264a8){if(_0x4264a8){return _0x4264a8['destroy']()['then'](function(){var _0x55b1ff=_0x4264a8[_0xa96f('0x29')]({'plain':!![]});var _0x62f54d=_0xa96f('0x2a');return db[_0xa96f('0x2b')][_0xa96f('0x2c')]({'where':{'type':_0x62f54d,'resourceId':_0x55b1ff['id']}})[_0xa96f('0x13')](function(){return _0x4264a8;});})[_0xa96f('0x13')](function(){_0x58d4a5[_0xa96f('0x1f')](0xcc)[_0xa96f('0x20')]();});}};}function handleEntityNotFound(_0x142f56){return function(_0x5e60cc){if(!_0x5e60cc){_0x142f56[_0xa96f('0x1e')](0x194);}return _0x5e60cc;};}function handleError(_0x47de73,_0x581f2d){_0x581f2d=_0x581f2d||0x1f4;return function(_0x152411){logger['error'](_0x152411[_0xa96f('0x2d')]);if(_0x152411['name']){delete _0x152411[_0xa96f('0x2e')];}_0x47de73[_0xa96f('0x1f')](_0x581f2d)['send'](_0x152411);};}exports[_0xa96f('0x2f')]=function(_0x473c72,_0x385b1d){var _0x134b80={'include':[{'model':db[_0xa96f('0x30')],'as':_0xa96f('0x31')}]},_0x348a8={},_0x485bf4={'count':0x0,'rows':[]};var _0xd83dc2=_[_0xa96f('0x32')](db[_0xa96f('0x33')][_0xa96f('0x34')],function(_0x78b2a){return{'name':_0x78b2a[_0xa96f('0x35')],'type':_0x78b2a[_0xa96f('0x36')][_0xa96f('0x37')]};});_0x348a8[_0xa96f('0x38')]=_[_0xa96f('0x32')](_0xd83dc2,_0xa96f('0x2e'));_0x348a8[_0xa96f('0x39')]=_[_0xa96f('0x3a')](_0x473c72[_0xa96f('0x39')]);_0x348a8['filters']=_['intersection'](_0x348a8[_0xa96f('0x38')],_0x348a8[_0xa96f('0x39')]);_0x134b80[_0xa96f('0x3b')]=_[_0xa96f('0x3c')](_0x348a8[_0xa96f('0x38')],qs[_0xa96f('0x3d')](_0x473c72[_0xa96f('0x39')][_0xa96f('0x3d')]));_0x134b80[_0xa96f('0x3b')]=_0x134b80[_0xa96f('0x3b')]['length']?_0x134b80[_0xa96f('0x3b')]:_0x348a8[_0xa96f('0x38')];if(!_0x473c72[_0xa96f('0x39')][_0xa96f('0x3e')](_0xa96f('0x3f'))){_0x134b80[_0xa96f('0x24')]=qs[_0xa96f('0x24')](_0x473c72[_0xa96f('0x39')][_0xa96f('0x24')]);_0x134b80[_0xa96f('0x21')]=qs[_0xa96f('0x21')](_0x473c72[_0xa96f('0x39')]['offset']);}_0x134b80[_0xa96f('0x40')]=qs[_0xa96f('0x41')](_0x473c72[_0xa96f('0x39')][_0xa96f('0x41')]);_0x134b80[_0xa96f('0x42')]=qs[_0xa96f('0x43')](_['pick'](_0x473c72[_0xa96f('0x39')],_0x348a8[_0xa96f('0x43')]),_0xd83dc2);if(_0x473c72['query'][_0xa96f('0x44')]){_0x134b80[_0xa96f('0x42')]=_[_0xa96f('0x45')](_0x134b80[_0xa96f('0x42')],{'$or':_['map'](_0xd83dc2,function(_0x743760){if(_0x743760[_0xa96f('0x36')]!==_0xa96f('0x46')){var _0xea8a21={};_0xea8a21[_0x743760['name']]={'$like':'%'+_0x473c72[_0xa96f('0x39')][_0xa96f('0x44')]+'%'};return _0xea8a21;}})});}_0x134b80=_[_0xa96f('0x45')]({},_0x134b80,_0x473c72[_0xa96f('0x47')]);var _0x31bc96={'where':_0x134b80[_0xa96f('0x42')]};return db['ChatWebsite'][_0xa96f('0x23')](_0x31bc96)[_0xa96f('0x13')](function(_0x1eac8d){_0x485bf4['count']=_0x1eac8d;if(_0x473c72[_0xa96f('0x39')][_0xa96f('0x48')]){_0x134b80[_0xa96f('0x49')]=[{'all':!![]}];}return db[_0xa96f('0x33')][_0xa96f('0x4a')](_0x134b80);})[_0xa96f('0x13')](function(_0x4109b1){_0x485bf4['rows']=_0x4109b1;return _0x485bf4;})[_0xa96f('0x13')](respondWithFilteredResult(_0x385b1d,_0x134b80))['catch'](handleError(_0x385b1d,null));};exports[_0xa96f('0x4b')]=function(_0x4f7507,_0x389a3d){var _0x552d46={'raw':![],'where':{'id':_0x4f7507[_0xa96f('0x4c')]['id']},'include':[{'model':db[_0xa96f('0x30')],'as':'mandatoryDispositionPause'}]},_0x41edf5={};_0x41edf5[_0xa96f('0x38')]=_[_0xa96f('0x3a')](db['ChatWebsite'][_0xa96f('0x34')]);_0x41edf5['query']=_[_0xa96f('0x3a')](_0x4f7507[_0xa96f('0x39')]);_0x41edf5['filters']=_[_0xa96f('0x3c')](_0x41edf5[_0xa96f('0x38')],_0x41edf5[_0xa96f('0x39')]);_0x552d46[_0xa96f('0x3b')]=_[_0xa96f('0x3c')](_0x41edf5['model'],qs[_0xa96f('0x3d')](_0x4f7507[_0xa96f('0x39')][_0xa96f('0x3d')]));_0x552d46[_0xa96f('0x3b')]=_0x552d46['attributes']['length']?_0x552d46['attributes']:_0x41edf5[_0xa96f('0x38')];if(_0x4f7507['query'][_0xa96f('0x48')]){_0x552d46[_0xa96f('0x49')]=[{'all':!![]}];}_0x552d46=_[_0xa96f('0x45')]({},_0x552d46,_0x4f7507[_0xa96f('0x47')]);return db[_0xa96f('0x33')][_0xa96f('0x4d')](_0x552d46)[_0xa96f('0x13')](handleEntityNotFound(_0x389a3d,null))[_0xa96f('0x13')](respondWithResult(_0x389a3d,null))[_0xa96f('0x1d')](handleError(_0x389a3d,null));};exports[_0xa96f('0x4e')]=function(_0x4cb288,_0x4ca90c){return db[_0xa96f('0x33')][_0xa96f('0x4e')](_0x4cb288[_0xa96f('0x4f')],{})['then'](function(_0x408696){var _0x1023ae=_0x4cb288[_0xa96f('0x50')][_0xa96f('0x29')]({'plain':!![]});if(!_0x1023ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1023ae[_0xa96f('0x51')]==='user'){var _0x47621e=_0x408696['get']({'plain':!![]});var _0x5f1a5e='ChatWebsites';return db[_0xa96f('0x52')]['find']({'where':{'name':_0x5f1a5e,'userProfileId':_0x1023ae[_0xa96f('0x53')]},'raw':!![]})[_0xa96f('0x13')](function(_0x5d98b0){if(_0x5d98b0&&_0x5d98b0[_0xa96f('0x54')]===0x0){return db[_0xa96f('0x2b')][_0xa96f('0x4e')]({'name':_0x47621e[_0xa96f('0x2e')],'resourceId':_0x47621e['id'],'type':_0x5d98b0[_0xa96f('0x2e')],'sectionId':_0x5d98b0['id']},{})['then'](function(){return _0x408696;});}else{return _0x408696;}})[_0xa96f('0x1d')](function(_0x3d96d8){logger[_0xa96f('0x18')](_0xa96f('0x55'),_0x3d96d8);throw _0x3d96d8;});}return _0x408696;})[_0xa96f('0x13')](respondWithResult(_0x4ca90c,0xc9))[_0xa96f('0x1d')](handleError(_0x4ca90c,null));};exports[_0xa96f('0x28')]=function(_0x4954b9,_0x250877){if(_0x4954b9[_0xa96f('0x4f')]['id']){delete _0x4954b9['body']['id'];}return db[_0xa96f('0x33')]['find']({'where':{'id':_0x4954b9[_0xa96f('0x4c')]['id']},'include':[{'model':db[_0xa96f('0x30')],'as':_0xa96f('0x31')}]})['then'](handleEntityNotFound(_0x250877,null))[_0xa96f('0x13')](saveUpdates(_0x4954b9['body'],null))[_0xa96f('0x13')](respondWithResult(_0x250877,null))[_0xa96f('0x1d')](handleError(_0x250877,null));};exports[_0xa96f('0x2c')]=function(_0x4b4e80,_0x14c461){return db['ChatWebsite'][_0xa96f('0x4d')]({'where':{'id':_0x4b4e80['params']['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x14c461,null))[_0xa96f('0x13')](removeEntity(_0x14c461,null))[_0xa96f('0x1d')](handleError(_0x14c461,null));};exports[_0xa96f('0x56')]=function(_0x145d0c,_0x5396f5){return db['ChatWebsite']['describe']()[_0xa96f('0x13')](respondWithResult(_0x5396f5,null))['catch'](handleError(_0x5396f5,null));};exports[_0xa96f('0x57')]=function(_0x255607,_0x248b04){if(_0x255607['body']['id']){delete _0x255607[_0xa96f('0x4f')]['id'];}return db[_0xa96f('0x33')]['find']({'where':{'id':_0x255607[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x248b04,null))[_0xa96f('0x13')](function(_0xb74a6c){if(_0xb74a6c){_0x255607['body'][_0xa96f('0x58')]=_0xb74a6c['id'];return db[_0xa96f('0x59')][_0xa96f('0x4e')](_0x255607['body']);}})[_0xa96f('0x13')](respondWithResult(_0x248b04,null))[_0xa96f('0x1d')](handleError(_0x248b04,null));};exports[_0xa96f('0x5a')]=function(_0xd498d5,_0x1217fd){var _0xfeda6e={'raw':![],'where':{}};var _0x3c24fe={};var _0x5e55e0={'count':0x0,'rows':[]};return db[_0xa96f('0x33')][_0xa96f('0x5b')]({'where':{'id':_0xd498d5[_0xa96f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1217fd,null))['then'](function(_0x5c368b){if(_0x5c368b){_0x3c24fe[_0xa96f('0x38')]=_[_0xa96f('0x3a')](db['Disposition'][_0xa96f('0x34')]);_0x3c24fe['query']=_['keys'](_0xd498d5[_0xa96f('0x39')]);_0x3c24fe[_0xa96f('0x43')]=_[_0xa96f('0x3c')](_0x3c24fe[_0xa96f('0x38')],_0x3c24fe[_0xa96f('0x39')]);_0xfeda6e['attributes']=_[_0xa96f('0x3c')](_0x3c24fe['model'],qs[_0xa96f('0x3d')](_0xd498d5['query'][_0xa96f('0x3d')]));_0xfeda6e[_0xa96f('0x3b')]=_0xfeda6e['attributes'][_0xa96f('0x5c')]?_0xfeda6e[_0xa96f('0x3b')]:_0x3c24fe[_0xa96f('0x38')];if(!_0xd498d5[_0xa96f('0x39')][_0xa96f('0x3e')]('nolimit')){_0xfeda6e[_0xa96f('0x24')]=qs[_0xa96f('0x24')](_0xd498d5[_0xa96f('0x39')]['limit']);_0xfeda6e['offset']=qs['offset'](_0xd498d5[_0xa96f('0x39')][_0xa96f('0x21')]);}_0xfeda6e[_0xa96f('0x40')]=qs[_0xa96f('0x41')](_0xd498d5[_0xa96f('0x39')][_0xa96f('0x41')]);_0xfeda6e[_0xa96f('0x42')]=qs[_0xa96f('0x43')](_[_0xa96f('0x5d')](_0xd498d5[_0xa96f('0x39')],_0x3c24fe['filters']));_0xfeda6e[_0xa96f('0x42')][_0xa96f('0x58')]=_0x5c368b['id'];if(_0xd498d5[_0xa96f('0x39')][_0xa96f('0x44')]){_0xfeda6e[_0xa96f('0x42')]=_[_0xa96f('0x45')](_0xfeda6e[_0xa96f('0x42')],{'$or':_['map'](_0xfeda6e[_0xa96f('0x3b')],function(_0x95bc07){var _0xc85160={};_0xc85160[_0x95bc07]={'$like':'%'+_0xd498d5[_0xa96f('0x39')]['filter']+'%'};return _0xc85160;})});}_0xfeda6e=_[_0xa96f('0x45')]({},_0xfeda6e,_0xd498d5['options']);return db[_0xa96f('0x59')]['count']({'where':_0xfeda6e['where']})[_0xa96f('0x13')](function(_0x3e2e92){_0x5e55e0[_0xa96f('0x23')]=_0x3e2e92;if(_0xd498d5['query'][_0xa96f('0x48')]){_0xfeda6e['include']=[{'all':!![]}];}return db[_0xa96f('0x59')][_0xa96f('0x4a')](_0xfeda6e);})[_0xa96f('0x13')](function(_0x4e57b4){_0x5e55e0[_0xa96f('0x5e')]=_0x4e57b4;return _0x5e55e0;});}})[_0xa96f('0x13')](respondWithFilteredResult(_0x1217fd,_0xfeda6e))[_0xa96f('0x1d')](handleError(_0x1217fd,null));};exports[_0xa96f('0x5f')]=function(_0x285e88,_0x19d353){return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'where':{'id':_0x285e88['params']['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x19d353,null))[_0xa96f('0x13')](function(_0x23a1a5){if(_0x23a1a5){return _0x23a1a5['removeDispositions'](_0x285e88[_0xa96f('0x39')][_0xa96f('0x60')]);}})[_0xa96f('0x13')](respondWithStatusCode(_0x19d353,null))[_0xa96f('0x1d')](handleError(_0x19d353,null));};exports['addAnswer']=function(_0x3127d5,_0x47d4a3){if(_0x3127d5[_0xa96f('0x4f')]['id']){delete _0x3127d5['body']['id'];}return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'where':{'id':_0x3127d5['params']['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x47d4a3,null))[_0xa96f('0x13')](function(_0x32254f){if(_0x32254f){_0x3127d5['body'][_0xa96f('0x58')]=_0x32254f['id'];return db[_0xa96f('0x61')][_0xa96f('0x4e')](_0x3127d5['body']);}})[_0xa96f('0x13')](respondWithResult(_0x47d4a3,null))['catch'](handleError(_0x47d4a3,null));};exports[_0xa96f('0x62')]=function(_0x418daf,_0x54c421){var _0x4cfdc0={'raw':![],'where':{}};var _0x2a3e6d={};var _0x13cf19={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa96f('0x5b')]({'where':{'id':_0x418daf[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x54c421,null))[_0xa96f('0x13')](function(_0x3998c7){if(_0x3998c7){_0x2a3e6d['model']=_['keys'](db[_0xa96f('0x61')][_0xa96f('0x34')]);_0x2a3e6d[_0xa96f('0x39')]=_[_0xa96f('0x3a')](_0x418daf['query']);_0x2a3e6d[_0xa96f('0x43')]=_[_0xa96f('0x3c')](_0x2a3e6d[_0xa96f('0x38')],_0x2a3e6d['query']);_0x4cfdc0[_0xa96f('0x3b')]=_[_0xa96f('0x3c')](_0x2a3e6d[_0xa96f('0x38')],qs[_0xa96f('0x3d')](_0x418daf[_0xa96f('0x39')][_0xa96f('0x3d')]));_0x4cfdc0[_0xa96f('0x3b')]=_0x4cfdc0['attributes'][_0xa96f('0x5c')]?_0x4cfdc0[_0xa96f('0x3b')]:_0x2a3e6d['model'];if(!_0x418daf[_0xa96f('0x39')]['hasOwnProperty'](_0xa96f('0x3f'))){_0x4cfdc0[_0xa96f('0x24')]=qs[_0xa96f('0x24')](_0x418daf[_0xa96f('0x39')][_0xa96f('0x24')]);_0x4cfdc0[_0xa96f('0x21')]=qs[_0xa96f('0x21')](_0x418daf[_0xa96f('0x39')][_0xa96f('0x21')]);}_0x4cfdc0[_0xa96f('0x40')]=qs['sort'](_0x418daf['query'][_0xa96f('0x41')]);_0x4cfdc0[_0xa96f('0x42')]=qs[_0xa96f('0x43')](_[_0xa96f('0x5d')](_0x418daf['query'],_0x2a3e6d[_0xa96f('0x43')]));_0x4cfdc0[_0xa96f('0x42')][_0xa96f('0x58')]=_0x3998c7['id'];if(_0x418daf[_0xa96f('0x39')][_0xa96f('0x44')]){_0x4cfdc0[_0xa96f('0x42')]=_[_0xa96f('0x45')](_0x4cfdc0[_0xa96f('0x42')],{'$or':_[_0xa96f('0x32')](_0x4cfdc0[_0xa96f('0x3b')],function(_0x4c9170){var _0x3ec91d={};_0x3ec91d[_0x4c9170]={'$like':'%'+_0x418daf['query'][_0xa96f('0x44')]+'%'};return _0x3ec91d;})});}_0x4cfdc0=_[_0xa96f('0x45')]({},_0x4cfdc0,_0x418daf[_0xa96f('0x47')]);return db['CannedAnswer']['count']({'where':_0x4cfdc0['where']})[_0xa96f('0x13')](function(_0x57cbf2){_0x13cf19[_0xa96f('0x23')]=_0x57cbf2;if(_0x418daf[_0xa96f('0x39')][_0xa96f('0x48')]){_0x4cfdc0[_0xa96f('0x49')]=[{'all':!![]}];}return db[_0xa96f('0x61')][_0xa96f('0x4a')](_0x4cfdc0);})[_0xa96f('0x13')](function(_0x2d1dd3){_0x13cf19[_0xa96f('0x5e')]=_0x2d1dd3;return _0x13cf19;});}})[_0xa96f('0x13')](respondWithFilteredResult(_0x54c421,_0x4cfdc0))['catch'](handleError(_0x54c421,null));};exports[_0xa96f('0x63')]=function(_0x431ab5,_0x4ee01e){return db[_0xa96f('0x33')]['find']({'where':{'id':_0x431ab5[_0xa96f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ee01e,null))[_0xa96f('0x13')](function(_0x1d2ffc){if(_0x1d2ffc){return _0x1d2ffc['removeAnswers'](_0x431ab5[_0xa96f('0x39')][_0xa96f('0x60')]);}})[_0xa96f('0x13')](respondWithStatusCode(_0x4ee01e,null))[_0xa96f('0x1d')](handleError(_0x4ee01e,null));};exports[_0xa96f('0x64')]=function(_0x56528a,_0x358522){_0x56528a[_0xa96f('0x4f')][_0xa96f('0x65')]=_0x56528a['file'][_0xa96f('0x66')];return db[_0xa96f('0x33')]['find']({'where':{'id':_0x56528a[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x358522,null))[_0xa96f('0x13')](saveUpdates(_0x56528a['body'],null))[_0xa96f('0x13')](respondWithResult(_0x358522,null))[_0xa96f('0x1d')](handleError(_0x358522,null));};exports['addAvatar']=function(_0x33f03f,_0x3915af){_0x33f03f[_0xa96f('0x4f')][_0xa96f('0x67')]=_0x33f03f[_0xa96f('0x68')][_0xa96f('0x66')];return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'where':{'id':_0x33f03f[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x3915af,null))[_0xa96f('0x13')](saveUpdates(_0x33f03f[_0xa96f('0x4f')],null))['then'](respondWithResult(_0x3915af,null))[_0xa96f('0x1d')](handleError(_0x3915af,null));};exports[_0xa96f('0x69')]=function(_0x22d80f,_0x503266){_0x22d80f['body'][_0xa96f('0x6a')]=_0x22d80f[_0xa96f('0x68')][_0xa96f('0x66')];return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'where':{'id':_0x22d80f[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x503266,null))[_0xa96f('0x13')](saveUpdates(_0x22d80f['body'],null))[_0xa96f('0x13')](respondWithResult(_0x503266,null))[_0xa96f('0x1d')](handleError(_0x503266,null));};exports['addSystemAvatar']=function(_0x2f6042,_0x495c5b){_0x2f6042[_0xa96f('0x4f')][_0xa96f('0x6b')]=_0x2f6042['file']['filename'];return db[_0xa96f('0x33')]['find']({'where':{'id':_0x2f6042[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x495c5b,null))[_0xa96f('0x13')](saveUpdates(_0x2f6042[_0xa96f('0x4f')],null))[_0xa96f('0x13')](respondWithResult(_0x495c5b,null))['catch'](handleError(_0x495c5b,null));};exports[_0xa96f('0x6c')]=function(_0x1999c8,_0xc4df){var _0x16ca41=path[_0xa96f('0x6d')](config['root'],_0xa96f('0x6e'));var _0x50335d={'where':{'id':_0x1999c8['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x303c08=![];return require(_0xa96f('0x6f'))['getLicense']()[_0xa96f('0x13')](function(_0x581e91){if(_0x581e91){_0x303c08=_0x581e91[_0xa96f('0x70')];}})['then'](function(){return db[_0xa96f('0x33')][_0xa96f('0x4d')](_0x50335d);})[_0xa96f('0x13')](handleEntityNotFound(_0xc4df,null))['then'](function(_0x160757){if(_0x160757){if(!_['isNil'](_0x160757['sitepic'])){if(fs[_0xa96f('0x71')](path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x73'),_0x160757[_0xa96f('0x65')]))&&_0x303c08){_0x16ca41=path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x73'),_0x160757[_0xa96f('0x65')]);}}return _0xc4df[_0xa96f('0x74')](_0x16ca41);}})['catch'](handleError(_0xc4df,null));};exports[_0xa96f('0x75')]=function(_0x32144a,_0xd049ad){var _0x247101=path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x76'));var _0x478142={'where':{'id':_0x32144a['params']['id']},'attributes':['id',_0xa96f('0x67')],'raw':!![]};return db['ChatWebsite'][_0xa96f('0x4d')](_0x478142)[_0xa96f('0x13')](handleEntityNotFound(_0xd049ad,null))[_0xa96f('0x13')](function(_0x568636){if(_0x568636){if(!_[_0xa96f('0x77')](_0x568636['agentAvatar'])){if(fs[_0xa96f('0x71')](path[_0xa96f('0x6d')](config[_0xa96f('0x72')],'server/files/images/avatars/',_0x568636[_0xa96f('0x67')]))){_0x247101=path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x78'),_0x568636['agentAvatar']);}}return _0xd049ad[_0xa96f('0x74')](_0x247101);}})[_0xa96f('0x1d')](handleError(_0xd049ad,null));};exports[_0xa96f('0x79')]=function(_0xe0bea8,_0x59ae0c){var _0xa80bab=path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x7a'));var _0x50ca64={'where':{'id':_0xe0bea8['params']['id']},'attributes':['id',_0xa96f('0x6a'),'showCustomerAvatar'],'raw':!![]};return db[_0xa96f('0x33')][_0xa96f('0x4d')](_0x50ca64)[_0xa96f('0x13')](handleEntityNotFound(_0x59ae0c,null))[_0xa96f('0x13')](function(_0x4d7231){if(_0x4d7231){if(!_[_0xa96f('0x77')](_0x4d7231[_0xa96f('0x6a')])){if(fs[_0xa96f('0x71')](path[_0xa96f('0x6d')](config[_0xa96f('0x72')],'server/files/images/avatars/',_0x4d7231['customerAvatar']))&&_0x4d7231['showCustomerAvatar']){_0xa80bab=path[_0xa96f('0x6d')](config['root'],_0xa96f('0x78'),_0x4d7231[_0xa96f('0x6a')]);}}return _0x59ae0c[_0xa96f('0x74')](_0xa80bab);}})[_0xa96f('0x1d')](handleError(_0x59ae0c,null));};exports[_0xa96f('0x7b')]=function(_0x58c641,_0x5c241a){var _0x40f311=path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x7c'));var _0x557451={'where':{'id':_0x58c641[_0xa96f('0x4c')]['id']},'attributes':['id',_0xa96f('0x6b')],'raw':!![]};return db[_0xa96f('0x33')][_0xa96f('0x4d')](_0x557451)[_0xa96f('0x13')](handleEntityNotFound(_0x5c241a,null))[_0xa96f('0x13')](function(_0xeaed76){if(_0xeaed76){if(!_['isNil'](_0xeaed76['systemAvatar'])){if(fs[_0xa96f('0x71')](path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x78'),_0xeaed76[_0xa96f('0x6b')]))){_0x40f311=path['join'](config[_0xa96f('0x72')],_0xa96f('0x78'),_0xeaed76[_0xa96f('0x6b')]);}}return _0x5c241a['download'](_0x40f311);}})[_0xa96f('0x1d')](handleError(_0x5c241a,null));};exports[_0xa96f('0x7d')]=function(_0x1fe5f1,_0x4c2e44){var _0x3af786=require('user-agent-parser');var _0x1ab69e=new _0x3af786();var _0x133fc2=_0x1ab69e[_0xa96f('0x7e')](_0x1fe5f1[_0xa96f('0x7f')][_0xa96f('0x80')])[_0xa96f('0x81')]();var _0x4af253={'body':_0x1fe5f1['body'],'channel':'chat'};var _0x319933=[];var _0x35a807=[];var _0x31ad8f={};var _0x2f44c0=![];return db[_0xa96f('0x82')][_0xa96f('0x56')]()['then'](function(_0x4ecc65){if(!_0x4ecc65){throw new db[(_0xa96f('0x83'))][(_0xa96f('0x84'))](_0xa96f('0x85'));}_0x319933=_[_0xa96f('0x86')](_[_0xa96f('0x3a')](_0x4ecc65),[_0xa96f('0x87'),'updatedAt']);_0x35a807=_[_0xa96f('0x86')](_[_0xa96f('0x3a')](_0x4ecc65),['createdAt',_0xa96f('0x88'),_0xa96f('0x89'),_0xa96f('0x8a')]);if(_0x1fe5f1[_0xa96f('0x4f')]['id']){delete _0x1fe5f1['body']['id'];}if(_[_0xa96f('0x77')](_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x8b')])){throw new db[(_0xa96f('0x83'))]['ValidationError'](_0xa96f('0x8c'));}if(_[_0xa96f('0x77')](_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x4f')])||_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x4f')]===''){throw new db[(_0xa96f('0x83'))][(_0xa96f('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa96f('0x77')](_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x8d')])){throw new db['Sequelize'][(_0xa96f('0x84'))](_0xa96f('0x8e')+_0x35a807);}if(!_[_0xa96f('0x8f')](_0x35a807,_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x8d')])){throw new db[(_0xa96f('0x83'))][(_0xa96f('0x84'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x35a807);}_0x31ad8f[_0x1fe5f1['body'][_0xa96f('0x8d')]]=_0x1fe5f1['body']['from'];})[_0xa96f('0x13')](function(){return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'where':{'id':_0x1fe5f1[_0xa96f('0x4c')]['id']},'include':[{'model':db[_0xa96f('0x90')],'as':_0xa96f('0x91'),'include':[{'model':db['CmContact'],'as':_0xa96f('0x92'),'where':_0x31ad8f,'limit':0x1,'order':[[_0xa96f('0x88'),_0xa96f('0x93')]]}]},{'model':db[_0xa96f('0x94')],'as':_0xa96f('0x95')}]});})['then'](handleEntityNotFound(_0x4c2e44,null))[_0xa96f('0x13')](function(_0x532266){if(_0x532266&&_0x532266[_0xa96f('0x91')]){_0x4af253['account']=_0x532266;_0x4af253[_0xa96f('0x96')]=_0x532266['Applications'];_0x4af253['list']=_0x532266[_0xa96f('0x91')];_0x4af253[_0xa96f('0x96')]=_['orderBy'](_0x4af253[_0xa96f('0x96')],['priority'],[_0xa96f('0x97')]);if(_0x4af253[_0xa96f('0x98')][_0xa96f('0x95')]){delete _0x4af253[_0xa96f('0x98')][_0xa96f('0x95')];}if(_0x4af253[_0xa96f('0x98')][_0xa96f('0x91')]&&_0x4af253[_0xa96f('0x98')][_0xa96f('0x91')][_0xa96f('0x92')][_0xa96f('0x5c')]){return _0x4af253[_0xa96f('0x98')][_0xa96f('0x91')]['Contacts'][0x0];}var _0x3fa60f=_[_0xa96f('0xc')](_0x1fe5f1[_0xa96f('0x4f')],{'firstName':_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x8b')],'ListId':_0x532266[_0xa96f('0x8a')]});_0x3fa60f[_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x8d')]]=_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x8b')];return db[_0xa96f('0x82')][_0xa96f('0x4e')](_0x3fa60f,{'fields':_0x319933,'raw':!![]});}})[_0xa96f('0x13')](handleEntityNotFound(_0x4c2e44,null))[_0xa96f('0x13')](function(_0x535139){_0x4af253[_0xa96f('0x99')]=_0x535139;var _0x2b0bae=_0x1fe5f1['body'][_0xa96f('0x9a')];if(_0x1fe5f1[_0xa96f('0x7f')][_0xa96f('0x9b')]){_0x2b0bae=_0x1fe5f1[_0xa96f('0x7f')][_0xa96f('0x9b')];}else if(_0x1fe5f1[_0xa96f('0x7f')][_0xa96f('0x9c')]){_0x2b0bae=_[_0xa96f('0x9d')](_0x1fe5f1[_0xa96f('0x7f')][_0xa96f('0x9c')][_0xa96f('0x9e')](','));}if(_0x535139){var _0x538df7={'ContactId':_0x535139['id'],'ChatWebsiteId':_0x1fe5f1[_0xa96f('0x4c')]['id'],'from':(_0x535139[_0xa96f('0x9f')]||'')+'\x20'+(_0x535139['lastName']||''),'customerIp':_0x2b0bae,'customerPort':_0x1fe5f1['headers']['x-real-port']?_0x1fe5f1[_0xa96f('0x7f')][_0xa96f('0xa0')]:null,'referer':_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0xa1')],'browserName':_0x133fc2[_0xa96f('0xa2')][_0xa96f('0x2e')]&&_0x133fc2[_0xa96f('0xa2')][_0xa96f('0xa3')]?util[_0xa96f('0xa4')]('%s\x20%s',_0x133fc2['browser'][_0xa96f('0x2e')],_0x133fc2['browser'][_0xa96f('0xa3')]):_0xa96f('0xa5'),'browserVersion':_0x133fc2[_0xa96f('0xa2')][_0xa96f('0xa3')]||'unknown','osName':util['format']('%s\x20%s',_0x133fc2['os']['name'],_0x133fc2['os'][_0xa96f('0xa3')]),'osVersion':_0x133fc2['os'][_0xa96f('0xa3')],'deviceModel':_0x133fc2[_0xa96f('0xa6')]['model']&&_0x133fc2[_0xa96f('0xa6')][_0xa96f('0xa7')]?util[_0xa96f('0xa4')](_0xa96f('0xa8'),_0x133fc2[_0xa96f('0xa6')]['model'],_0x133fc2[_0xa96f('0xa6')][_0xa96f('0xa7')],_0x133fc2[_0xa96f('0xa6')][_0xa96f('0x36')]):null,'deviceVendor':_0x133fc2[_0xa96f('0xa6')][_0xa96f('0xa7')],'deviceType':_0x133fc2['device'][_0xa96f('0x36')],'formData':JSON[_0xa96f('0x16')](_0x1fe5f1[_0xa96f('0x4f')])};var _0x4682a5={'ChatWebsiteId':_0x1fe5f1[_0xa96f('0x4c')]['id'],'closed':![]};if(_0x1fe5f1['body'][_0xa96f('0xa9')]){_0x4682a5['threadId']=_0x1fe5f1['body'][_0xa96f('0xa9')];return db[_0xa96f('0xaa')][_0xa96f('0x4d')]({'where':_0x4682a5})[_0xa96f('0x13')](function(_0x3b80d7){if(_0x3b80d7){return[_0x3b80d7,![]];}_0x538df7[_0xa96f('0xa9')]=_0x1fe5f1['body'][_0xa96f('0xa9')];_0x538df7[_0xa96f('0xab')]=_0x1fe5f1[_0xa96f('0x4f')]['externalUrl'];return db[_0xa96f('0xaa')][_0xa96f('0x4e')](_0x538df7)[_0xa96f('0x13')](function(_0xa5ebb3){return[_0xa5ebb3,!![]];});});}_0x4682a5[_0xa96f('0xac')]=_0x535139['id'];if(_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0xad')]&&_0x1fe5f1['body'][_0xa96f('0xad')]['id']){_0x4682a5['id']=_0x1fe5f1[_0xa96f('0x4f')]['interaction']['id'];return db['ChatInteraction'][_0xa96f('0x4d')]({'where':_0x4682a5})['then'](function(_0xf3700f){if(_0xf3700f){return[_0xf3700f,![]];}return db[_0xa96f('0xaa')][_0xa96f('0x4e')](_0x538df7)['then'](function(_0x387425){return[_0x387425,!![]];});});}return db[_0xa96f('0xaa')]['create'](_0x538df7)['then'](function(_0x4da628){return[_0x4da628,!![]];});}})[_0xa96f('0xae')](function(_0x2aa41e,_0x7bc4ab){if(_0x2aa41e){_0x2f44c0=_0x7bc4ab;if(!_0x7bc4ab){var _0x37f3e3={'from':(_0x4af253[_0xa96f('0x99')]['firstName']||'')+'\x20'+(_0x4af253['contact'][_0xa96f('0xaf')]||'')};if(_0x1fe5f1['body']['threadId']&&_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0xb0')]&&_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0xa9')]!=_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0xb0')]){_0x37f3e3[_0xa96f('0xa9')]=_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0xb0')];}return _0x2aa41e[_0xa96f('0x28')](_0x37f3e3);}else{return _0x2aa41e;}}})['then'](function(_0x3b68e3){_0x4af253[_0xa96f('0xad')]=_0x3b68e3['get']({'plain':!![]});_0x4af253[_0xa96f('0xad')][_0xa96f('0xb1')]=_0x2f44c0;if(_0x4af253[_0xa96f('0xad')]['created']){if(_0x4af253[_0xa96f('0x98')][_0xa96f('0xb2')]){_0x4af253[_0xa96f('0x96')]['push']({'id':0x0,'priority':_0x4af253['applications'][_0xa96f('0x5c')]+0x1,'app':_0xa96f('0xb3'),'appdata':'unmanaged','interval':_0xa96f('0xb4')});}}return db[_0xa96f('0xb5')][_0xa96f('0x4e')]({'body':_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0x4f')],'ChatWebsiteId':_0x1fe5f1[_0xa96f('0x4c')]['id'],'ChatInteractionId':_0x3b68e3['id'],'direction':'in','ContactId':_0x4af253[_0xa96f('0x99')]['id'],'AttachmentId':_0x1fe5f1[_0xa96f('0x4f')][_0xa96f('0xb6')]});})[_0xa96f('0x13')](function(_0x2b8283){_0x4af253[_0xa96f('0x19')]=_0x2b8283;if(_0x4af253['interaction'][_0xa96f('0xb7')]){return db[_0xa96f('0xb8')][_0xa96f('0x4d')]({'attributes':['id',_0xa96f('0x2e')],'where':{'id':_0x4af253[_0xa96f('0xad')]['UserId']}})[_0xa96f('0x13')](function(_0xba09d6){if(_0xba09d6){_0x4af253[_0xa96f('0x96')][_0xa96f('0xb9')]({'id':0x0,'priority':0x0,'app':_0xa96f('0xba'),'appdata':_0xba09d6[_0xa96f('0x2e')]+','+(_0x4af253['account']['waitForTheAssignedAgent']||0xa),'interval':_0xa96f('0xb4')});_0x4af253[_0xa96f('0xbb')]=!![];}return respondWithRpcPromise(_0xa96f('0xbc'),_0xa96f('0xbd'),_0x4af253);});}return respondWithRpcPromise(_0xa96f('0xbc'),'startRouting',_0x4af253);})['then'](function(_0x52c344){respondWithRpcPromise(_0xa96f('0xbe'),_0xa96f('0xbe'),{'event':_0xa96f('0x7d'),'message':_0x52c344},client9002);return _0x52c344;})[_0xa96f('0x13')](respondWithResult(_0x4c2e44,null))['catch'](handleError(_0x4c2e44,null));};exports['offline']=function(_0x1ac598,_0x340d10){var _0xbf912c,_0x147d61,_0x2c57a5;var _0x2d9289=[];var _0x383b82={};var _0x576477=_0x1ac598[_0xa96f('0xbf')]||[];var _0x3ceadc=[];var _0x2aeeb7;return db['CmContact'][_0xa96f('0x56')]()[_0xa96f('0x13')](function(_0x91efe8){if(!_0x91efe8){throw new db['Sequelize']['ValidationError'](_0xa96f('0x85'));}_0x2d9289=_['difference'](_[_0xa96f('0x3a')](_0x91efe8),[_0xa96f('0x87'),_0xa96f('0x88'),_0xa96f('0x89'),_0xa96f('0x8a')]);if(_0x1ac598['body']['id']){delete _0x1ac598[_0xa96f('0x4f')]['id'];}if(_[_0xa96f('0x77')](_0x1ac598['body'][_0xa96f('0x8b')])){throw _0x340d10[_0xa96f('0x1f')](0x1f4)[_0xa96f('0xc0')](new db['Sequelize']['ValidationError'](_0xa96f('0x8c')));}if(_['isNil'](_0x1ac598[_0xa96f('0x4f')][_0xa96f('0x4f')])||_0x1ac598[_0xa96f('0x4f')][_0xa96f('0x4f')]===''){throw _0x340d10[_0xa96f('0x1f')](0x1f4)['send'](new db[(_0xa96f('0x83'))][(_0xa96f('0x84'))](_0xa96f('0xc1')));}if(_[_0xa96f('0x77')](_0x1ac598['body'][_0xa96f('0xc2')])){throw _0x340d10[_0xa96f('0x1f')](0x1f4)[_0xa96f('0xc0')](new db[(_0xa96f('0x83'))][(_0xa96f('0x84'))](_0xa96f('0xc3')+_0x2d9289));}if(!_[_0xa96f('0x8f')](_0x2d9289,_0x1ac598[_0xa96f('0x4f')][_0xa96f('0xc2')])){throw _0x340d10[_0xa96f('0x1f')](0x1f4)[_0xa96f('0xc0')](new db[(_0xa96f('0x83'))][(_0xa96f('0x84'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d9289));}_0x383b82[_0x1ac598['body'][_0xa96f('0xc2')]]=_0x1ac598['body'][_0xa96f('0x8b')];})[_0xa96f('0x13')](function(){return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'where':{'id':_0x1ac598[_0xa96f('0x4c')]['id']},'include':[{'model':db[_0xa96f('0x90')],'as':_0xa96f('0x91')},{'model':db[_0xa96f('0xc4')],'as':'MailAccount'}]});})[_0xa96f('0x13')](handleEntityNotFound(_0x340d10,null))['then'](function(_0x282dfc){if(_0x282dfc&&_0x282dfc[_0xa96f('0x91')]){_0x147d61=_0x282dfc;var _0xf1da26=_[_0xa96f('0xc')](_0x1ac598[_0xa96f('0x4f')],{'firstName':_0x1ac598[_0xa96f('0x4f')][_0xa96f('0x8b')],'phone':_0x1ac598[_0xa96f('0x4f')][_0xa96f('0x8b')],'ListId':_0x282dfc[_0xa96f('0x8a')]});_0xf1da26[_0x1ac598[_0xa96f('0x4f')][_0xa96f('0xc2')]]=_0x1ac598[_0xa96f('0x4f')][_0xa96f('0x8b')];return db['CmContact'][_0xa96f('0xc5')]({'where':_0x383b82,'defaults':_0xf1da26});}})['spread'](function(_0x507a84){if(_0x507a84){_0x2c57a5=_0x507a84;var _0x2bd4e5=fs[_0xa96f('0xc6')](path['join'](config['root'],_0xa96f('0xc7')),_0xa96f('0xc8'));var _0xd7a764=ejs[_0xa96f('0xc9')](_0x2bd4e5,{'body':_[_0xa96f('0xca')](_0x1ac598[_0xa96f('0x4f')][_0xa96f('0x4f')]),'bodyTitle':_0x147d61[_0xa96f('0xcb')]});return db[_0xa96f('0xcc')][_0xa96f('0x4e')]({'body':_0xd7a764,'ContactId':_0x507a84['id'],'ChatWebsiteId':_0x147d61['id']});}})[_0xa96f('0x13')](function(_0x83b478){_0x2aeeb7=_0x83b478;if(_0x576477[_0xa96f('0x5c')]){var _0x1d7243=_0x576477[_0xa96f('0x32')](function(_0x4cd559){return{'name':_0x4cd559['originalname'],'basename':_0x4cd559[_0xa96f('0x66')],'type':_0x4cd559['mimetype'],'ChatOfflineMessageId':_0x83b478['id']};});_0x3ceadc=_0x1d7243[_0xa96f('0x32')](_0x32ffc8=>{var _0x22c57c={'filename':_0x32ffc8[_0xa96f('0x2e')],'path':path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0xcd'),_0xa96f('0xbf'),_0xa96f('0xce'),'offline-chat',_0x32ffc8[_0xa96f('0xcf')])};return _0x22c57c;});if(!_0x147d61[_0xa96f('0xd0')]){return db[_0xa96f('0xd1')]['transaction'](function(_0x47e00f){return db[_0xa96f('0xd2')][_0xa96f('0xd3')](_0x1d7243,{'transaction':_0x47e00f});});}}})['then'](function(){if(_0x2aeeb7){_0xbf912c=_0x2aeeb7;return db[_0xa96f('0xc4')][_0xa96f('0x5b')]({'where':{'active':!![]},'include':[{'model':db[_0xa96f('0xd4')],'as':_0xa96f('0xd5'),'raw':!![]}]});}})[_0xa96f('0x13')](function(_0x599714){if(_0x599714&&_0x599714[_0xa96f('0xd5')]&&_0x147d61[_0xa96f('0xd6')]&&_0x147d61[_0xa96f('0xd7')]){var _0x35927d={'tls':{'rejectUnauthorized':![]}};if(_0x599714[_0xa96f('0xd5')][_0xa96f('0xd8')]){_0x35927d[_0xa96f('0xd8')]=_0x599714[_0xa96f('0xd5')]['service'];}else{_0x35927d[_0xa96f('0xd9')]=_0x599714[_0xa96f('0xd5')][_0xa96f('0xd9')];_0x35927d[_0xa96f('0xda')]=_0x599714[_0xa96f('0xd5')][_0xa96f('0xda')];_0x35927d[_0xa96f('0xdb')]=_0x599714[_0xa96f('0xd5')][_0xa96f('0xdb')];}if(_0x599714[_0xa96f('0xd5')]['authentication']){_0x35927d[_0xa96f('0xdc')]={'user':_0x599714[_0xa96f('0xd5')][_0xa96f('0x50')],'pass':_0x599714[_0xa96f('0xd5')][_0xa96f('0xdd')]};}return respondWithRpcPromise('SendMail',_0xa96f('0xde'),{'account':_0x35927d,'message':{'from':util[_0xa96f('0xa4')](_0xa96f('0xdf'),_0x599714['name'],_0x599714[_0xa96f('0xe0')]||_0x599714[_0xa96f('0xd5')][_0xa96f('0x50')]),'to':_0x147d61['forwardOfflineAddress'],'subject':_0x147d61[_0xa96f('0xe1')],'html':_0xbf912c[_0xa96f('0x4f')],'attachments':_0x3ceadc}},client9003)[_0xa96f('0x13')](function(){return _0xbf912c;})[_0xa96f('0x1d')](function(_0x3aa7ae){console[_0xa96f('0x18')](_0x3aa7ae);});}})[_0xa96f('0x13')](function(){if(_0x147d61&&_0x147d61[_0xa96f('0xd0')]&&_0x147d61['MailAccountId']){var _0x2eda1b=[];if(_0x576477[_0xa96f('0x5c')]){_0x2eda1b=_0x576477[_0xa96f('0x32')](function(_0x9d0d25){return{'name':_0x9d0d25[_0xa96f('0xe2')],'basename':_0x9d0d25[_0xa96f('0x66')],'type':_0x9d0d25['mimetype'],'ChatOfflineMessageId':_0x2aeeb7['id']};});}var _0x57fc23;if(!_[_0xa96f('0x77')](_0x147d61[_0xa96f('0xe3')])){var _0x381049=_[_0xa96f('0x32')](_0x1ac598['body'],function(_0x417f07){return _0x417f07;});var _0x2c24f6=_[_0xa96f('0xe4')](_0x381049)[0x0];var _0x2f12be=_[_0xa96f('0xe5')](_0x2c24f6,function(_0x3a55dd){return _0x3a55dd;});_0x57fc23=_0x2f12be[0x1][_0x147d61[_0xa96f('0xe3')]];}var _0x18008d={'from':_0x2c57a5[_0xa96f('0xe0')],'firstName':_0x2c57a5[_0xa96f('0x9f')],'lastName':_0x2c57a5[_0xa96f('0xaf')],'mapKey':'email','message':{'from':_0x2c57a5['email'],'to':_0x147d61[_0xa96f('0xc4')][_0xa96f('0xe0')],'cc':'','subject':_['isNil'](_0x57fc23)?_0x147d61[_0xa96f('0xe1')]:_0x57fc23,'messageId':'','sentAt':new Date(),'attach':_0x2eda1b[_0xa96f('0x5c')],'attachments':_0x2eda1b,'originChannel':'Chat','ChatWebsiteId':_0x147d61['id'],'ChatOfflineMessageId':_0xbf912c['id'],'originTo':_0x147d61['MailAccount'][_0xa96f('0xe0')]},'body':_0xbf912c[_0xa96f('0x4f')]};var _0x12f17d={'account':{'id':_0x147d61[_0xa96f('0xe6')]},'body':_0x18008d,'log':_0xa96f('0xe7')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x12f17d,client9001)['then'](function(){return _0xbf912c;})[_0xa96f('0x1d')](function(_0xb06c23){console[_0xa96f('0x18')](_0xb06c23);});}return;})['then'](function(){if(_0xbf912c){return _0xbf912c;}})['then'](respondWithResult(_0x340d10,null))[_0xa96f('0x1d')](function(_0x44d09d){console[_0xa96f('0x18')](_0xa96f('0x1d'),_0x44d09d);for(var _0x14d8b9 of _0x576477){var _0x5ee2fd=path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0xcd'),'files','attachments',_0xa96f('0xe8'),_0x14d8b9[_0xa96f('0x66')]);fs_extra[_0xa96f('0xe9')](_0x5ee2fd)['catch'](function(_0x295e8c){console['error'](_0xa96f('0xea'),_0x5ee2fd,_0x295e8c);});}});};exports[_0xa96f('0xeb')]=function(_0x5d5b82,_0x2b0c61){return db[_0xa96f('0xaa')][_0xa96f('0x4d')]({'where':{'id':_0x5d5b82['params']['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x2b0c61,null))['then'](function(_0x2a301a){if(_0x2a301a){return _0x2a301a[_0xa96f('0xeb')](_0x5d5b82['body'][_0xa96f('0x60')],_[_0xa96f('0xec')](_0x5d5b82['body'],[_0xa96f('0x60'),'id'])||{});}})[_0xa96f('0x13')](respondWithResult(_0x2b0c61,null))[_0xa96f('0x1d')](handleError(_0x2b0c61,null));};exports['getInteractions']=function(_0x4a4e63,_0x4bb965){var _0x4bdca9={'raw':![],'where':{}};var _0x4e2706={};var _0x40a87d={'count':0x0,'rows':[]};return db[_0xa96f('0x33')][_0xa96f('0x5b')]({'where':{'id':_0x4a4e63['params']['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x4bb965,null))[_0xa96f('0x13')](function(_0x399fef){if(_0x399fef){_0x4e2706[_0xa96f('0x38')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x4e2706['query']=_[_0xa96f('0x3a')](_0x4a4e63[_0xa96f('0x39')]);_0x4e2706[_0xa96f('0x43')]=_['intersection'](_0x4e2706['model'],_0x4e2706[_0xa96f('0x39')]);_0x4bdca9[_0xa96f('0x3b')]=_['intersection'](_0x4e2706[_0xa96f('0x38')],qs[_0xa96f('0x3d')](_0x4a4e63[_0xa96f('0x39')]['fields']));_0x4bdca9[_0xa96f('0x3b')]=_0x4bdca9[_0xa96f('0x3b')]['length']?_0x4bdca9['attributes']:_0x4e2706[_0xa96f('0x38')];if(!_0x4a4e63[_0xa96f('0x39')][_0xa96f('0x3e')](_0xa96f('0x3f'))){_0x4bdca9[_0xa96f('0x24')]=qs[_0xa96f('0x24')](_0x4a4e63[_0xa96f('0x39')][_0xa96f('0x24')]);_0x4bdca9[_0xa96f('0x21')]=qs[_0xa96f('0x21')](_0x4a4e63[_0xa96f('0x39')]['offset']);}_0x4bdca9['order']=qs[_0xa96f('0x41')](_0x4a4e63[_0xa96f('0x39')]['sort']);_0x4bdca9['where']=qs[_0xa96f('0x43')](_[_0xa96f('0x5d')](_0x4a4e63[_0xa96f('0x39')],_0x4e2706[_0xa96f('0x43')]));_0x4bdca9[_0xa96f('0x42')][_0xa96f('0x58')]=_0x399fef['id'];if(_0x4a4e63[_0xa96f('0x39')][_0xa96f('0x44')]){_0x4bdca9['where']=_['merge'](_0x4bdca9['where'],{'$or':_['map'](_0x4bdca9[_0xa96f('0x3b')],function(_0xf19b11){var _0x1d6e04={};_0x1d6e04[_0xf19b11]={'$like':'%'+_0x4a4e63[_0xa96f('0x39')]['filter']+'%'};return _0x1d6e04;})});}_0x4bdca9=_[_0xa96f('0x45')]({},_0x4bdca9,_0x4a4e63[_0xa96f('0x47')]);return db[_0xa96f('0xaa')][_0xa96f('0x23')]({'where':_0x4bdca9['where']})[_0xa96f('0x13')](function(_0x35355d){_0x40a87d[_0xa96f('0x23')]=_0x35355d;if(_0x4a4e63[_0xa96f('0x39')]['includeAll']){_0x4bdca9[_0xa96f('0x49')]=[{'model':db[_0xa96f('0x82')],'as':_0xa96f('0xed'),'required':![]},{'model':db['User'],'as':_0xa96f('0xee'),'attributes':[_0xa96f('0x2e'),_0xa96f('0xef'),_0xa96f('0xf0')],'required':![]},{'model':db[_0xa96f('0xf1')],'as':_0xa96f('0xf2'),'attributes':['id','name',_0xa96f('0xf3')],'where':_0x4a4e63[_0xa96f('0x39')]['tag']?{'id':_0x4a4e63[_0xa96f('0x39')]['tag']}:undefined,'required':_0x4a4e63[_0xa96f('0x39')][_0xa96f('0xf4')]?!![]:![]}];}return db[_0xa96f('0xaa')]['findAll'](_0x4bdca9);})['then'](function(_0x59dd1f){_0x40a87d[_0xa96f('0x5e')]=_0x59dd1f;return _0x40a87d;});}})[_0xa96f('0x13')](respondWithFilteredResult(_0x4bb965,_0x4bdca9))[_0xa96f('0x1d')](handleError(_0x4bb965,null));};function iftimePromise(_0x5efc0f,_0xed2280){return respondWithRpcPromise(_0xa96f('0xf5'),'getSnippet',{'command':_0xed2280[_0xa96f('0xf6')]?util[_0xa96f('0xa4')](_0xa96f('0xf7'),_0x5efc0f[_0xa96f('0xf8')],_0xed2280[_0xa96f('0xf6')]):util[_0xa96f('0xa4')](_0xa96f('0xf9'),_0x5efc0f[_0xa96f('0xf8')])},client9002)['then'](function(_0x420b40){var _0x5d8296=_0x420b40&&_0x420b40[_0xa96f('0xfa')]('true')>=0x0?!![]:![];logger[_0xa96f('0x1a')](_0xa96f('0xfb'),_0xed2280['id'],_0x5efc0f['id'],_0x5efc0f['interval'],_0x5d8296?_0xa96f('0xfc'):_0xa96f('0xfd'),_0xed2280['timezone']?_0xed2280[_0xa96f('0xf6')]:_0xa96f('0xfe'));return _0x5d8296;})['catch'](function(_0x33ce0b){logger[_0xa96f('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xed2280['id'],_0x5efc0f['id'],_0x5efc0f[_0xa96f('0xf8')],util[_0xa96f('0xff')](_0x33ce0b,{'showHidden':![],'depth':null}),_0xed2280[_0xa96f('0xf6')]?_0xed2280[_0xa96f('0xf6')]:_0xa96f('0xfe'));return![];});}exports[_0xa96f('0x100')]=function(_0x4f8912,_0x5b471a){var _0x28bd84=0x0;var _0x3b3871=0x0;var _0x1d416d=![];var _0x17af98;var _0x3f24ee;return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'where':{'id':_0x4f8912[_0xa96f('0x4c')]['id']},'include':[{'model':db['Interval'],'as':_0xa96f('0x101'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xa96f('0x13')](handleEntityNotFound(_0x5b471a,null))['then'](function(_0x45bc18){if(_0x45bc18){_0x17af98=_0x45bc18;return _0x45bc18[_0xa96f('0x102')]({'raw':!![]});}})[_0xa96f('0x13')](function(_0x297e22){if(_0x17af98){if(_0x297e22){_0x3f24ee=_0x297e22;}}return require(_0xa96f('0x6f'))[_0xa96f('0x103')]();})[_0xa96f('0x13')](function(_0x10c1d1){if(_0x10c1d1){_0x3b3871=_0x10c1d1[_0xa96f('0x104')];_0x1d416d=_0x10c1d1[_0xa96f('0x70')];}})[_0xa96f('0x13')](function(){return db[_0xa96f('0xaa')][_0xa96f('0x23')]({'where':{'closed':![]}});})[_0xa96f('0x13')](function(_0xf5b5bc){_0x28bd84=_0xf5b5bc;if(_0x3b3871&&_0xf5b5bc>_0x3b3871){return db[_0xa96f('0x105')][_0xa96f('0x5b')]({'where':{'id':0x1}})[_0xa96f('0x13')](function(_0x9993c8){if(_0x9993c8){_0x9993c8['increment'](_0xa96f('0x106'));}});}})['then'](function(){if(_0x17af98[_0xa96f('0x101')]&&_0x17af98[_0xa96f('0x101')][_0xa96f('0x107')]){var _0x640d39=[];for(var _0x4d2351=0x0;_0x4d2351<_0x17af98['Interval'][_0xa96f('0x107')][_0xa96f('0x5c')];_0x4d2351++){var _0x400f1e=_0x17af98['Interval'][_0xa96f('0x107')][_0x4d2351]['get']({'plain':!![]});_0x640d39[_0xa96f('0x108')](iftimePromise(_0x400f1e,_0x17af98));}return BPromise[_0xa96f('0x109')](_0x640d39)[_0xa96f('0x13')](function(_0x405aad){return _[_0xa96f('0x10a')](_0x405aad);});}else{return!![];}})[_0xa96f('0x13')](function(_0x652c5d){var _0x318146=fs[_0xa96f('0xc6')](path[_0xa96f('0x6d')](config[_0xa96f('0x72')],_0xa96f('0x10b')),_0xa96f('0xc8'));var _0x3fb972={'remote':_0x17af98[_0xa96f('0x10c')],'query':querystring['stringify'](_['merge'](_0x17af98[_0xa96f('0x29')]({'plain':!![]}),{'customerIp':_0x4f8912[_0xa96f('0x7f')]['x-forwarded-for']||_0x4f8912[_0xa96f('0x7f')][_0xa96f('0x10d')]||_0x4f8912['connection']['remoteAddress']||_0x4f8912['ip'],'referer':_0x4f8912['headers']['referer'],'openedInteractions':_0x28bd84,'maxInteractions':_0x3b3871,'virtual':_0x1d416d[_0xa96f('0x104')],'online':_0x652c5d,'custom':_0x1d416d}))[_0xa96f('0x10e')](/'/g,'\x5c\x27')};_0x5b471a[_0xa96f('0xc0')](ejs['render'](Mustache[_0xa96f('0xc9')](_0x318146,_0x3fb972),{'proactiveActions':_0x3f24ee,'alignment':_0x17af98[_0xa96f('0x10f')],'verticalAlignment':_0x17af98[_0xa96f('0x110')],'div_color':_0x17af98[_0xa96f('0xf3')],'text_color':_0x17af98[_0xa96f('0x111')],'button_color':_0x17af98['color_button'],'background_color':_0x17af98[_0xa96f('0x112')]}));})[_0xa96f('0x1d')](handleError(_0x5b471a,null));};exports['addApplications']=function(_0x46d6a8,_0xb8b252){var _0x3cc0c0=_0x46d6a8[_0xa96f('0x4c')]['id'];var _0x2aeb0b=_0x46d6a8[_0xa96f('0x4f')];var _0xdc6cc1=0xc8;var _0x544ecd=null;return db[_0xa96f('0xd1')][_0xa96f('0x113')]({'isolationLevel':db[_0xa96f('0xd1')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x55e492){return db[_0xa96f('0x33')][_0xa96f('0x5b')]({'where':{'id':_0x3cc0c0},'transaction':_0x55e492})[_0xa96f('0x13')](function(_0x2ad909){if(_0x2ad909){return db[_0xa96f('0x94')][_0xa96f('0x2c')]({'where':{'ChatWebsiteId':_0x3cc0c0},'transaction':_0x55e492})[_0xa96f('0x13')](function(){var _0x56ab4b=_[_0xa96f('0x32')](_0x2aeb0b,function(_0x5440ca){_0x5440ca[_0xa96f('0x58')]=_0x3cc0c0;return _0x5440ca;});return db[_0xa96f('0x94')][_0xa96f('0xd3')](_0x56ab4b,{'transaction':_0x55e492});});}else{_0xdc6cc1=0x194;_0x544ecd=[];}});})[_0xa96f('0x13')](function(){if(_0xdc6cc1!==0x194){return db[_0xa96f('0x94')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3cc0c0},'order':'priority'})['then'](function(_0x4f5b43){_0x544ecd=_0x4f5b43;});}})[_0xa96f('0x1d')](function(_0x24161a){_0xdc6cc1=0x1f4;logger[_0xa96f('0x18')](_0x24161a[_0xa96f('0x2d')]);if(_0x24161a[_0xa96f('0x2e')]){delete _0x24161a['name'];}_0x544ecd=_0x24161a;})[_0xa96f('0x114')](function(){if(_0x544ecd===null){_0xb8b252[_0xa96f('0x1e')](_0xdc6cc1);}else{if(_0xdc6cc1===0x1f4){_0xb8b252['status'](_0xdc6cc1)[_0xa96f('0xc0')](_0x544ecd);}else{_0xb8b252[_0xa96f('0x1f')](_0xdc6cc1)['json'](_0x544ecd);}}});};exports[_0xa96f('0x115')]=function(_0x22b396,_0xf1bc42){var _0x4fe62f={};var _0x33cf98={};var _0x3b1da1;var _0x5dc101;return db[_0xa96f('0x33')][_0xa96f('0x5b')]({'where':{'id':_0x22b396[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0xf1bc42,null))[_0xa96f('0x13')](function(_0x54be56){if(_0x54be56){_0x3b1da1=_0x54be56;_0x33cf98[_0xa96f('0x38')]=_[_0xa96f('0x3a')](db[_0xa96f('0x94')][_0xa96f('0x34')]);_0x33cf98[_0xa96f('0x39')]=_[_0xa96f('0x3a')](_0x22b396[_0xa96f('0x39')]);_0x33cf98[_0xa96f('0x43')]=_[_0xa96f('0x3c')](_0x33cf98[_0xa96f('0x38')],_0x33cf98[_0xa96f('0x39')]);_0x4fe62f['attributes']=_[_0xa96f('0x3c')](_0x33cf98[_0xa96f('0x38')],qs['fields'](_0x22b396[_0xa96f('0x39')][_0xa96f('0x3d')]));_0x4fe62f[_0xa96f('0x3b')]=_0x4fe62f[_0xa96f('0x3b')][_0xa96f('0x5c')]?_0x4fe62f[_0xa96f('0x3b')]:_0x33cf98[_0xa96f('0x38')];_0x4fe62f[_0xa96f('0x40')]=qs['sort'](_0x22b396['query']['sort']);_0x4fe62f[_0xa96f('0x42')]=qs[_0xa96f('0x43')](_[_0xa96f('0x5d')](_0x22b396[_0xa96f('0x39')],_0x33cf98['filters']));if(_0x22b396[_0xa96f('0x39')]['filter']){_0x4fe62f[_0xa96f('0x42')]=_[_0xa96f('0x45')](_0x4fe62f[_0xa96f('0x42')],{'$or':_[_0xa96f('0x32')](_0x4fe62f[_0xa96f('0x3b')],function(_0x170871){var _0x12e6a3={};_0x12e6a3[_0x170871]={'$like':'%'+_0x22b396[_0xa96f('0x39')][_0xa96f('0x44')]+'%'};return _0x12e6a3;})});}_0x4fe62f=_['merge']({},_0x4fe62f,_0x22b396[_0xa96f('0x47')]);return _0x3b1da1[_0xa96f('0x115')](_0x4fe62f);}})[_0xa96f('0x13')](function(_0x5de48e){if(_0x5de48e){_0x5dc101=_0x5de48e[_0xa96f('0x5c')];if(!_0x22b396['query']['hasOwnProperty'](_0xa96f('0x3f'))){_0x4fe62f[_0xa96f('0x24')]=qs[_0xa96f('0x24')](_0x22b396[_0xa96f('0x39')]['limit']);_0x4fe62f['offset']=qs[_0xa96f('0x21')](_0x22b396[_0xa96f('0x39')]['offset']);}return _0x3b1da1[_0xa96f('0x115')](_0x4fe62f);}})[_0xa96f('0x13')](function(_0x3daec5){if(_0x3daec5){return _0x3daec5?{'count':_0x5dc101,'rows':_0x3daec5}:null;}})[_0xa96f('0x13')](respondWithResult(_0xf1bc42,null))[_0xa96f('0x1d')](handleError(_0xf1bc42,null));};exports[_0xa96f('0x116')]=function(_0x31b5c9,_0x4c7cb7){return db[_0xa96f('0x117')][_0xa96f('0x4d')]({'where':{'id':_0x31b5c9[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x4c7cb7,null))[_0xa96f('0x13')](function(_0x3a6d5b){if(_0x3a6d5b){return _0x3a6d5b[_0xa96f('0x116')](_0x31b5c9[_0xa96f('0x4f')][_0xa96f('0x60')],_[_0xa96f('0xec')](_0x31b5c9[_0xa96f('0x4f')],[_0xa96f('0x60'),'id'])||{});}})[_0xa96f('0x13')](respondWithResult(_0x4c7cb7,null))['catch'](handleError(_0x4c7cb7,null));};exports[_0xa96f('0x102')]=function(_0x3a5931,_0x231f5a){var _0x474179={};var _0x3fcccb={};var _0x478a0a;var _0xaddc5;return db[_0xa96f('0x33')]['findOne']({'where':{'id':_0x3a5931[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x231f5a,null))[_0xa96f('0x13')](function(_0x37dc1e){if(_0x37dc1e){_0x478a0a=_0x37dc1e;_0x3fcccb['model']=_['keys'](db['ChatProactiveAction'][_0xa96f('0x34')]);_0x3fcccb['query']=_[_0xa96f('0x3a')](_0x3a5931[_0xa96f('0x39')]);_0x3fcccb[_0xa96f('0x43')]=_['intersection'](_0x3fcccb[_0xa96f('0x38')],_0x3fcccb['query']);_0x474179[_0xa96f('0x3b')]=_[_0xa96f('0x3c')](_0x3fcccb[_0xa96f('0x38')],qs[_0xa96f('0x3d')](_0x3a5931[_0xa96f('0x39')][_0xa96f('0x3d')]));_0x474179[_0xa96f('0x3b')]=_0x474179[_0xa96f('0x3b')]['length']?_0x474179[_0xa96f('0x3b')]:_0x3fcccb[_0xa96f('0x38')];_0x474179[_0xa96f('0x40')]=qs['sort'](_0x3a5931['query'][_0xa96f('0x41')]);_0x474179[_0xa96f('0x42')]=qs['filters'](_[_0xa96f('0x5d')](_0x3a5931['query'],_0x3fcccb[_0xa96f('0x43')]));if(_0x3a5931[_0xa96f('0x39')][_0xa96f('0x44')]){_0x474179[_0xa96f('0x42')]=_[_0xa96f('0x45')](_0x474179[_0xa96f('0x42')],{'$or':_[_0xa96f('0x32')](_0x474179[_0xa96f('0x3b')],function(_0x8f31fb){var _0x450f72={};_0x450f72[_0x8f31fb]={'$like':'%'+_0x3a5931[_0xa96f('0x39')][_0xa96f('0x44')]+'%'};return _0x450f72;})});}_0x474179=_[_0xa96f('0x45')]({},_0x474179,_0x3a5931[_0xa96f('0x47')]);return _0x478a0a[_0xa96f('0x102')](_0x474179);}})[_0xa96f('0x13')](function(_0xc998bc){if(_0xc998bc){_0xaddc5=_0xc998bc['length'];if(!_0x3a5931[_0xa96f('0x39')][_0xa96f('0x3e')](_0xa96f('0x3f'))){_0x474179[_0xa96f('0x24')]=qs['limit'](_0x3a5931[_0xa96f('0x39')][_0xa96f('0x24')]);_0x474179[_0xa96f('0x21')]=qs[_0xa96f('0x21')](_0x3a5931[_0xa96f('0x39')]['offset']);}return _0x478a0a[_0xa96f('0x102')](_0x474179);}})[_0xa96f('0x13')](function(_0x662b5){if(_0x662b5){return _0x662b5?{'count':_0xaddc5,'rows':_0x662b5}:null;}})[_0xa96f('0x13')](respondWithResult(_0x231f5a,null))['catch'](handleError(_0x231f5a,null));};exports[_0xa96f('0x118')]=function(_0x277706,_0x5f3832){var _0x1b9e6a=_0x277706[_0xa96f('0x39')][_0xa96f('0x119')]===_0xa96f('0x11a')?'offlineForm':_0xa96f('0x11b');return db[_0xa96f('0x33')][_0xa96f('0x4d')]({'attributes':['id',_0x1b9e6a],'where':{'id':_0x277706[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x5f3832,null))[_0xa96f('0x13')](function(_0x219bea){if(_0x219bea){var _0x4b8434=_0x219bea[_0x1b9e6a];var _0x33d494=_0x4b8434&&_0x4b8434[_0xa96f('0x11c')]?_0x4b8434[_0xa96f('0x11c')]:[];_0x5f3832[_0xa96f('0xc0')]({'fromKey':_['isNil'](_0x4b8434[_0xa96f('0x11d')])?undefined:_0x4b8434[_0xa96f('0x11d')],'count':_0x33d494[_0xa96f('0x5c')],'rows':_0x33d494});}})[_0xa96f('0x1d')](handleError(_0x5f3832,null));};exports[_0xa96f('0x11e')]=function(_0x3b3514,_0x1c1ada){var _0x455a1d={'raw':![],'where':{}};var _0x3fb1b4={};var _0x326d22={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa96f('0x5b')]({'where':{'id':_0x3b3514[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x1c1ada,null))[_0xa96f('0x13')](function(_0x1848b5){if(_0x1848b5){_0x3fb1b4['model']=_[_0xa96f('0x3a')](db['ChatOfflineMessage'][_0xa96f('0x34')]);_0x3fb1b4['query']=_[_0xa96f('0x3a')](_0x3b3514[_0xa96f('0x39')]);_0x3fb1b4['filters']=_[_0xa96f('0x3c')](_0x3fb1b4[_0xa96f('0x38')],_0x3fb1b4[_0xa96f('0x39')]);_0x455a1d[_0xa96f('0x3b')]=_[_0xa96f('0x3c')](_0x3fb1b4[_0xa96f('0x38')],qs[_0xa96f('0x3d')](_0x3b3514['query'][_0xa96f('0x3d')]));_0x455a1d[_0xa96f('0x3b')]=_0x455a1d[_0xa96f('0x3b')]['length']?_0x455a1d['attributes']:_0x3fb1b4['model'];if(!_0x3b3514[_0xa96f('0x39')][_0xa96f('0x3e')]('nolimit')){_0x455a1d[_0xa96f('0x24')]=qs[_0xa96f('0x24')](_0x3b3514[_0xa96f('0x39')][_0xa96f('0x24')]);_0x455a1d['offset']=qs[_0xa96f('0x21')](_0x3b3514['query']['offset']);}_0x455a1d[_0xa96f('0x40')]=qs[_0xa96f('0x41')](_0x3b3514[_0xa96f('0x39')][_0xa96f('0x41')]);_0x455a1d[_0xa96f('0x42')]=qs[_0xa96f('0x43')](_[_0xa96f('0x5d')](_0x3b3514[_0xa96f('0x39')],_0x3fb1b4[_0xa96f('0x43')]));_0x455a1d['where'][_0xa96f('0x58')]=_0x1848b5['id'];if(_0x3b3514[_0xa96f('0x39')][_0xa96f('0x44')]){_0x455a1d['where']=_[_0xa96f('0x45')](_0x455a1d['where'],{'$or':_[_0xa96f('0x32')](_0x455a1d[_0xa96f('0x3b')],function(_0x4ab8cf){var _0x4f1e5f={};_0x4f1e5f[_0x4ab8cf]={'$like':'%'+_0x3b3514[_0xa96f('0x39')][_0xa96f('0x44')]+'%'};return _0x4f1e5f;})});}_0x455a1d=_[_0xa96f('0x45')]({},_0x455a1d,_0x3b3514['options']);return db[_0xa96f('0xcc')][_0xa96f('0x23')]({'where':_0x455a1d[_0xa96f('0x42')]})[_0xa96f('0x13')](function(_0x487b6f){_0x326d22[_0xa96f('0x23')]=_0x487b6f;if(_0x3b3514[_0xa96f('0x39')]['includeAll']){_0x455a1d['include']=[{'all':!![]}];}else{_0x455a1d[_0xa96f('0x49')]=[{'model':db[_0xa96f('0x82')],'as':_0xa96f('0xed'),'required':![]},{'model':db[_0xa96f('0xd2')],'as':_0xa96f('0x11f'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x455a1d);})[_0xa96f('0x13')](function(_0x53bc26){_0x326d22['rows']=_0x53bc26;return _0x326d22;});}})['then'](respondWithFilteredResult(_0x1c1ada,_0x455a1d))[_0xa96f('0x1d')](handleError(_0x1c1ada,null));};exports[_0xa96f('0x120')]=function(_0x442a0f,_0x5c74ee){return db[_0xa96f('0x33')]['find']({'where':{'id':_0x442a0f[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x5c74ee,null))[_0xa96f('0x13')](function(_0x34433f){if(_0x34433f){return _0x34433f[_0xa96f('0x120')](_0x442a0f[_0xa96f('0x4f')][_0xa96f('0x60')],_[_0xa96f('0xec')](_0x442a0f[_0xa96f('0x4f')],['ids','id'])||{})[_0xa96f('0xae')](function(_0x3e3f17){for(var _0x2c5934=0x0;_0x2c5934<_0x442a0f[_0xa96f('0x4f')][_0xa96f('0x60')][_0xa96f('0x5c')];_0x2c5934+=0x1){socket[_0xa96f('0x121')](_0xa96f('0x122'),{'UserId':Number(_0x442a0f[_0xa96f('0x4f')][_0xa96f('0x60')][_0x2c5934]),'ChatWebsiteId':Number(_0x442a0f[_0xa96f('0x4c')]['id'])});}return _0x3e3f17;});}})[_0xa96f('0x13')](respondWithResult(_0x5c74ee,null))[_0xa96f('0x1d')](handleError(_0x5c74ee,null));};exports[_0xa96f('0x123')]=function(_0x52266d,_0x42b667){return db[_0xa96f('0x33')]['find']({'where':{'id':_0x52266d[_0xa96f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42b667,null))[_0xa96f('0x13')](function(_0x37f3b5){if(_0x37f3b5){return _0x37f3b5[_0xa96f('0x123')](_0x52266d[_0xa96f('0x39')][_0xa96f('0x60')])[_0xa96f('0x13')](function(){if(_[_0xa96f('0x124')](_0x52266d['query'][_0xa96f('0x60')])){for(var _0x1a354c=0x0;_0x1a354c<_0x52266d[_0xa96f('0x39')][_0xa96f('0x60')]['length'];_0x1a354c+=0x1){socket[_0xa96f('0x121')](_0xa96f('0x125'),{'UserId':Number(_0x52266d[_0xa96f('0x39')]['ids'][_0x1a354c]),'ChatWebsiteId':Number(_0x52266d[_0xa96f('0x4c')]['id'])});}}else{socket[_0xa96f('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x52266d[_0xa96f('0x39')][_0xa96f('0x60')]),'ChatWebsiteId':Number(_0x52266d[_0xa96f('0x4c')]['id'])});}});}})[_0xa96f('0x13')](respondWithStatusCode(_0x42b667,null))[_0xa96f('0x1d')](handleError(_0x42b667,null));};exports[_0xa96f('0x126')]=function(_0x29b59a,_0x2d74c3){var _0x3762b5={};var _0x14cbe7={};var _0x164416;var _0xd4ed6e;return db[_0xa96f('0x33')][_0xa96f('0x5b')]({'where':{'id':_0x29b59a[_0xa96f('0x4c')]['id']}})[_0xa96f('0x13')](handleEntityNotFound(_0x2d74c3,null))[_0xa96f('0x13')](function(_0x239373){if(_0x239373){_0x164416=_0x239373;_0x14cbe7[_0xa96f('0x38')]=_[_0xa96f('0x3a')](db['User'][_0xa96f('0x34')]);_0x14cbe7[_0xa96f('0x39')]=_[_0xa96f('0x3a')](_0x29b59a[_0xa96f('0x39')]);_0x14cbe7[_0xa96f('0x43')]=_[_0xa96f('0x3c')](_0x14cbe7[_0xa96f('0x38')],_0x14cbe7[_0xa96f('0x39')]);_0x3762b5[_0xa96f('0x3b')]=_[_0xa96f('0x3c')](_0x14cbe7[_0xa96f('0x38')],qs['fields'](_0x29b59a['query'][_0xa96f('0x3d')]));_0x3762b5[_0xa96f('0x3b')]=_0x3762b5[_0xa96f('0x3b')][_0xa96f('0x5c')]?_0x3762b5[_0xa96f('0x3b')]:_0x14cbe7[_0xa96f('0x38')];_0x3762b5[_0xa96f('0x40')]=qs[_0xa96f('0x41')](_0x29b59a[_0xa96f('0x39')]['sort']);_0x3762b5[_0xa96f('0x42')]=qs[_0xa96f('0x43')](_['pick'](_0x29b59a[_0xa96f('0x39')],_0x14cbe7['filters']));if(_0x29b59a[_0xa96f('0x39')][_0xa96f('0x44')]){_0x3762b5['where']=_[_0xa96f('0x45')](_0x3762b5[_0xa96f('0x42')],{'$or':_[_0xa96f('0x32')](_0x3762b5[_0xa96f('0x3b')],function(_0x330a0a){var _0x708e07={};_0x708e07[_0x330a0a]={'$like':'%'+_0x29b59a['query']['filter']+'%'};return _0x708e07;})});}_0x3762b5=_[_0xa96f('0x45')]({},_0x3762b5,_0x29b59a['options']);return _0x164416[_0xa96f('0x126')](_0x3762b5);}})[_0xa96f('0x13')](function(_0xeaf39a){if(_0xeaf39a){_0xd4ed6e=_0xeaf39a['length'];if(!_0x29b59a['query'][_0xa96f('0x3e')](_0xa96f('0x3f'))){_0x3762b5[_0xa96f('0x24')]=qs[_0xa96f('0x24')](_0x29b59a[_0xa96f('0x39')]['limit']);_0x3762b5[_0xa96f('0x21')]=qs[_0xa96f('0x21')](_0x29b59a['query']['offset']);}return _0x164416[_0xa96f('0x126')](_0x3762b5);}})[_0xa96f('0x13')](function(_0x1ec8d4){if(_0x1ec8d4){return _0x1ec8d4?{'count':_0xd4ed6e,'rows':_0x1ec8d4}:null;}})[_0xa96f('0x13')](respondWithResult(_0x2d74c3,null))[_0xa96f('0x1d')](handleError(_0x2d74c3,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 962f2de..a416edf 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 _0xeb5d=['hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','emit'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xeb5d[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xdeb5('0x0'))['db'][_0xdeb5('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdeb5('0x2')](0x0);var events={'afterCreate':_0xdeb5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17d77f){return function(_0x16c31b,_0x546313,_0x19de5e){ChatWebsiteEvents[_0xdeb5('0x4')](_0x17d77f+':'+_0x16c31b['id'],_0x16c31b);ChatWebsiteEvents[_0xdeb5('0x4')](_0x17d77f,_0x16c31b);_0x19de5e(null);};}for(var e in events){if(events[_0xdeb5('0x5')](e)){var event=events[e];ChatWebsite[_0xdeb5('0x6')](e,emitEvent(event));}}module[_0xdeb5('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x0fc8=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','update'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0x0fc8,0x145));var _0x80fc=function(_0x132024,_0x5d2db4){_0x132024=_0x132024-0x0;var _0x1f87df=_0x0fc8[_0x132024];return _0x1f87df;};'use strict';var EventEmitter=require(_0x80fc('0x0'));var ChatWebsite=require(_0x80fc('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x80fc('0x2'),'afterDestroy':_0x80fc('0x3')};function emitEvent(_0x499326){return function(_0x4a128e,_0x862499,_0x5e3f0d){ChatWebsiteEvents[_0x80fc('0x4')](_0x499326+':'+_0x4a128e['id'],_0x4a128e);ChatWebsiteEvents[_0x80fc('0x4')](_0x499326,_0x4a128e);_0x5e3f0d(null);};}for(var e in events){if(events[_0x80fc('0x5')](e)){var event=events[e];ChatWebsite[_0x80fc('0x6')](e,emitEvent(event));}}module[_0x80fc('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 38a41c7..ea312be 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 _0x6060=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','lodash'];(function(_0x4b17da,_0x3b50b4){var _0x1dce95=function(_0x353a1f){while(--_0x353a1f){_0x4b17da['push'](_0x4b17da['shift']());}};_0x1dce95(++_0x3b50b4);}(_0x6060,0x17f));var _0x0606=function(_0x2770a9,_0x3bb210){_0x2770a9=_0x2770a9-0x0;var _0x59d922=_0x6060[_0x2770a9];return _0x59d922;};'use strict';var _=require(_0x0606('0x0'));var util=require(_0x0606('0x1'));var logger=require(_0x0606('0x2'))(_0x0606('0x3'));var moment=require(_0x0606('0x4'));var BPromise=require(_0x0606('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0606('0x6'));var rimraf=require(_0x0606('0x7'));var config=require(_0x0606('0x8'));var attributes=require(_0x0606('0x9'));module[_0x0606('0xa')]=function(_0x52a35e,_0x355d1e){return _0x52a35e[_0x0606('0xb')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca01=['bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','api'];(function(_0x44970c,_0x28c7a6){var _0x2dbbe2=function(_0x57e5ef){while(--_0x57e5ef){_0x44970c['push'](_0x44970c['shift']());}};_0x2dbbe2(++_0x28c7a6);}(_0xca01,0xfa));var _0x1ca0=function(_0x92078a,_0x3b57b4){_0x92078a=_0x92078a-0x0;var _0x29e979=_0xca01[_0x92078a];return _0x29e979;};'use strict';var _=require(_0x1ca0('0x0'));var util=require(_0x1ca0('0x1'));var logger=require('../../config/logger')(_0x1ca0('0x2'));var moment=require('moment');var BPromise=require(_0x1ca0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ca0('0x4'));var rimraf=require(_0x1ca0('0x5'));var config=require(_0x1ca0('0x6'));var attributes=require(_0x1ca0('0x7'));module[_0x1ca0('0x8')]=function(_0x3fb7c7,_0xf880bd){return _0x3fb7c7['define'](_0x1ca0('0x9'),attributes,{'tableName':_0x1ca0('0xa'),'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 43e1e11..959df11 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 _0xf729=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x1f5baf,_0x782936){var _0x32301c=function(_0x5cc916){while(--_0x5cc916){_0x1f5baf['push'](_0x1f5baf['shift']());}};_0x32301c(++_0x782936);}(_0xf729,0x1b3));var _0x9f72=function(_0x10c5bc,_0x5d3004){_0x10c5bc=_0x10c5bc-0x0;var _0x9f0bfa=_0xf729[_0x10c5bc];return _0x9f0bfa;};'use strict';var _=require(_0x9f72('0x0'));var util=require(_0x9f72('0x1'));var moment=require('moment');var BPromise=require(_0x9f72('0x2'));var rs=require(_0x9f72('0x3'));var fs=require('fs');var Redis=require(_0x9f72('0x4'));var db=require(_0x9f72('0x5'))['db'];var utils=require(_0x9f72('0x6'));var logger=require('../../config/logger')(_0x9f72('0x7'));var config=require(_0x9f72('0x8'));var jayson=require(_0x9f72('0x9'));var client=jayson['client'][_0x9f72('0xa')]({'port':0x232a});config[_0x9f72('0xb')]=_['defaults'](config[_0x9f72('0xb')],{'host':_0x9f72('0xc'),'port':0x18eb});var socket=require(_0x9f72('0xd'))(new Redis(config[_0x9f72('0xb')]));require('./chatWebsite.socket')[_0x9f72('0xe')](socket);function respondWithRpcPromise(_0x459c6f,_0x19d201,_0x343d02){return new BPromise(function(_0x402163,_0x499f25){return client[_0x9f72('0xf')](_0x459c6f,_0x343d02)[_0x9f72('0x10')](function(_0x433e3a){logger['info'](_0x9f72('0x11'),_0x19d201,_0x9f72('0x12'));logger[_0x9f72('0x13')](_0x9f72('0x14'),_0x19d201,_0x9f72('0x12'),JSON['stringify'](_0x433e3a));if(_0x433e3a[_0x9f72('0x15')]){if(_0x433e3a[_0x9f72('0x15')]['code']===0x1f4){logger[_0x9f72('0x15')](_0x9f72('0x11'),_0x19d201,_0x433e3a[_0x9f72('0x15')][_0x9f72('0x16')]);return _0x499f25(_0x433e3a['error']['message']);}logger[_0x9f72('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x19d201,_0x433e3a[_0x9f72('0x15')][_0x9f72('0x16')]);return _0x402163(_0x433e3a[_0x9f72('0x15')][_0x9f72('0x16')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x19d201,_0x9f72('0x12'));_0x402163(_0x433e3a[_0x9f72('0x17')][_0x9f72('0x16')]);}})['catch'](function(_0x3b88c3){logger[_0x9f72('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x19d201,_0x3b88c3);_0x499f25(_0x3b88c3);});});} \ No newline at end of file +var _0xed79=['request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x23ff55,_0x690344){var _0x501721=function(_0x34f086){while(--_0x34f086){_0x23ff55['push'](_0x23ff55['shift']());}};_0x501721(++_0x690344);}(_0xed79,0x17d));var _0x9ed7=function(_0x4dc2b9,_0x3da98c){_0x4dc2b9=_0x4dc2b9-0x0;var _0x4bbec6=_0xed79[_0x4dc2b9];return _0x4bbec6;};'use strict';var _=require(_0x9ed7('0x0'));var util=require(_0x9ed7('0x1'));var moment=require(_0x9ed7('0x2'));var BPromise=require(_0x9ed7('0x3'));var rs=require(_0x9ed7('0x4'));var fs=require('fs');var Redis=require(_0x9ed7('0x5'));var db=require(_0x9ed7('0x6'))['db'];var utils=require(_0x9ed7('0x7'));var logger=require('../../config/logger')(_0x9ed7('0x8'));var config=require(_0x9ed7('0x9'));var jayson=require(_0x9ed7('0xa'));var client=jayson[_0x9ed7('0xb')][_0x9ed7('0xc')]({'port':0x232a});config['redis']=_[_0x9ed7('0xd')](config[_0x9ed7('0xe')],{'host':_0x9ed7('0xf'),'port':0x18eb});var socket=require(_0x9ed7('0x10'))(new Redis(config[_0x9ed7('0xe')]));require(_0x9ed7('0x11'))['register'](socket);function respondWithRpcPromise(_0x294f8f,_0x499d75,_0x2a9105){return new BPromise(function(_0x26ba24,_0x29f3af){return client[_0x9ed7('0x12')](_0x294f8f,_0x2a9105)[_0x9ed7('0x13')](function(_0x24826d){logger[_0x9ed7('0x14')](_0x9ed7('0x15'),_0x499d75,_0x9ed7('0x16'));logger[_0x9ed7('0x17')](_0x9ed7('0x18'),_0x499d75,_0x9ed7('0x16'),JSON[_0x9ed7('0x19')](_0x24826d));if(_0x24826d[_0x9ed7('0x1a')]){if(_0x24826d[_0x9ed7('0x1a')][_0x9ed7('0x1b')]===0x1f4){logger['error'](_0x9ed7('0x15'),_0x499d75,_0x24826d[_0x9ed7('0x1a')][_0x9ed7('0x1c')]);return _0x29f3af(_0x24826d[_0x9ed7('0x1a')]['message']);}logger[_0x9ed7('0x1a')](_0x9ed7('0x15'),_0x499d75,_0x24826d['error']['message']);return _0x26ba24(_0x24826d[_0x9ed7('0x1a')]['message']);}else{logger[_0x9ed7('0x14')](_0x9ed7('0x15'),_0x499d75,_0x9ed7('0x16'));_0x26ba24(_0x24826d[_0x9ed7('0x1d')]['message']);}})[_0x9ed7('0x1e')](function(_0x343ae8){logger[_0x9ed7('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x499d75,_0x343ae8);_0x29f3af(_0x343ae8);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b168256..b75d0e2 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 _0xef95=['update','emit','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x1ea034,_0x476985){var _0x2a16c1=function(_0x2d8a2c){while(--_0x2d8a2c){_0x1ea034['push'](_0x1ea034['shift']());}};_0x2a16c1(++_0x476985);}(_0xef95,0x1e7));var _0x5ef9=function(_0xe32864,_0x1f3fc7){_0xe32864=_0xe32864-0x0;var _0x306eb8=_0xef95[_0xe32864];return _0x306eb8;};'use strict';var ChatWebsiteEvents=require(_0x5ef9('0x0'));var events=[_0x5ef9('0x1'),_0x5ef9('0x2'),_0x5ef9('0x3')];function createListener(_0x3d0cfe,_0x5a2d5b){return function(_0x10edd0){_0x5a2d5b[_0x5ef9('0x4')](_0x3d0cfe,_0x10edd0);};}function removeListener(_0x550046,_0x273f73){return function(){ChatWebsiteEvents['removeListener'](_0x550046,_0x273f73);};}exports['register']=function(_0x215778){for(var _0x58aab7=0x0,_0x325858=events[_0x5ef9('0x5')];_0x58aab7<_0x325858;_0x58aab7++){var _0x2e05e8=events[_0x58aab7];var _0x47a04c=createListener(_0x5ef9('0x6')+_0x2e05e8,_0x215778);ChatWebsiteEvents['on'](_0x2e05e8,_0x47a04c);}}; \ No newline at end of file +var _0xc663=['emit','register','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x428d58,_0x3f8742){var _0x58a8e4=function(_0x1f463c){while(--_0x1f463c){_0x428d58['push'](_0x428d58['shift']());}};_0x58a8e4(++_0x3f8742);}(_0xc663,0xdd));var _0x3c66=function(_0x2d51cc,_0x2ca3e2){_0x2d51cc=_0x2d51cc-0x0;var _0x3dc46b=_0xc663[_0x2d51cc];return _0x3dc46b;};'use strict';var ChatWebsiteEvents=require(_0x3c66('0x0'));var events=['save',_0x3c66('0x1'),_0x3c66('0x2')];function createListener(_0x57d7e0,_0xe0a037){return function(_0x5aa66c){_0xe0a037[_0x3c66('0x3')](_0x57d7e0,_0x5aa66c);};}function removeListener(_0x3c74d9,_0x4b8ae7){return function(){ChatWebsiteEvents['removeListener'](_0x3c74d9,_0x4b8ae7);};}exports[_0x3c66('0x4')]=function(_0x427696){for(var _0x2c8a44=0x0,_0x3113f3=events[_0x3c66('0x5')];_0x2c8a44<_0x3113f3;_0x2c8a44++){var _0x493dac=events[_0x2c8a44];var _0x34e76b=createListener(_0x3c66('0x6')+_0x493dac,_0x427696);ChatWebsiteEvents['on'](_0x493dac,_0x34e76b);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index aabb61b..b03ac37 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 _0x9e87=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/applications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','/:id/offline','any','offline','addInteraction','addApplications','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','multer','path'];(function(_0x235717,_0x135f0e){var _0x438562=function(_0x462dc3){while(--_0x462dc3){_0x235717['push'](_0x235717['shift']());}};_0x438562(++_0x135f0e);}(_0x9e87,0x1e1));var _0x79e8=function(_0xee3338,_0x49aa57){_0xee3338=_0xee3338-0x0;var _0x4479ce=_0x9e87[_0xee3338];return _0x4479ce;};'use strict';var multer=require(_0x79e8('0x0'));var util=require('util');var path=require(_0x79e8('0x1'));var timeout=require('connect-timeout');var express=require(_0x79e8('0x2'));var router=express[_0x79e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x79e8('0x4'));var interaction=require(_0x79e8('0x5'));var config=require(_0x79e8('0x6'));var controller=require(_0x79e8('0x7'));router[_0x79e8('0x8')]('/',auth[_0x79e8('0x9')](),controller['index']);router['get'](_0x79e8('0xa'),auth[_0x79e8('0x9')](),controller[_0x79e8('0xb')]);router[_0x79e8('0x8')](_0x79e8('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x79e8('0xd'),auth[_0x79e8('0x9')](),controller[_0x79e8('0xe')]);router[_0x79e8('0x8')]('/:id/canned_answers',auth[_0x79e8('0x9')](),controller[_0x79e8('0xf')]);router[_0x79e8('0x8')](_0x79e8('0x10'),controller[_0x79e8('0x11')]);router[_0x79e8('0x8')](_0x79e8('0x12'),controller[_0x79e8('0x13')]);router[_0x79e8('0x8')]('/:id/customer_avatar',controller[_0x79e8('0x14')]);router[_0x79e8('0x8')]('/:id/system_avatar',controller['getSystemAvatar']);router['get'](_0x79e8('0x15'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x16')]);router[_0x79e8('0x8')]('/:id/snippet',controller['getSnippet']);router[_0x79e8('0x8')](_0x79e8('0x17'),auth[_0x79e8('0x9')](),controller['getApplications']);router[_0x79e8('0x8')](_0x79e8('0x18'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x19')]);router[_0x79e8('0x8')]('/:id/fields',controller[_0x79e8('0x1a')]);router[_0x79e8('0x8')]('/:id/offline_messages',auth[_0x79e8('0x9')](),controller[_0x79e8('0x1b')]);router['get']('/:id/users',auth[_0x79e8('0x9')](),controller[_0x79e8('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x79e8('0x1d')](_0x79e8('0xd'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x1e')]);router[_0x79e8('0x1d')](_0x79e8('0x1f'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x20')]);var upload=multer({'storage':multer[_0x79e8('0x21')]({'destination':function(_0xc597d9,_0x3404b7,_0x43f1a4){_0x43f1a4(null,path[_0x79e8('0x22')](config[_0x79e8('0x23')],_0x79e8('0x24')));},'filename':function(_0x14cb3a,_0x23d38a,_0x527e68){_0x527e68(null,util[_0x79e8('0x25')](_0x79e8('0x26'),Date[_0x79e8('0x27')](),_0x23d38a[_0x79e8('0x28')]));}})});router[_0x79e8('0x1d')](_0x79e8('0x10'),upload[_0x79e8('0x29')](_0x79e8('0x2a')),controller[_0x79e8('0x2b')]);var upload=multer({'storage':multer[_0x79e8('0x21')]({'destination':function(_0x3acd29,_0x5cc868,_0x20b21b){_0x20b21b(null,path['join'](config['root'],_0x79e8('0x2c')));},'filename':function(_0x428575,_0x58ba49,_0x2e02d9){_0x2e02d9(null,util[_0x79e8('0x25')]('%s-%s',Date[_0x79e8('0x27')](),_0x58ba49[_0x79e8('0x28')]));}})});router[_0x79e8('0x1d')]('/:id/avatar',upload['single'](_0x79e8('0x2a')),controller[_0x79e8('0x2d')]);var upload=multer({'storage':multer[_0x79e8('0x21')]({'destination':function(_0x5e3e36,_0x77830b,_0x5f517b){_0x5f517b(null,path[_0x79e8('0x22')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2abb67,_0x8e89c8,_0x2529b1){_0x2529b1(null,util[_0x79e8('0x25')]('%s-%s',Date[_0x79e8('0x27')](),_0x8e89c8['originalname']));}})});router['post'](_0x79e8('0x2e'),upload[_0x79e8('0x29')](_0x79e8('0x2a')),controller[_0x79e8('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bfbed,_0x1d6dfe,_0x220410){_0x220410(null,path[_0x79e8('0x22')](config['root'],_0x79e8('0x2c')));},'filename':function(_0x492d95,_0x5b792f,_0x2a31bc){_0x2a31bc(null,util[_0x79e8('0x25')]('%s-%s',Date[_0x79e8('0x27')](),_0x5b792f[_0x79e8('0x28')]));}})});router[_0x79e8('0x1d')](_0x79e8('0x30'),upload[_0x79e8('0x29')](_0x79e8('0x2a')),controller[_0x79e8('0x31')]);router[_0x79e8('0x1d')](_0x79e8('0x32'),controller[_0x79e8('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x79e8('0x21')]({'destination':function(_0x14cbdf,_0x56b1b1,_0x5aa547){const _0x2da404=path[_0x79e8('0x22')](config[_0x79e8('0x23')],_0x79e8('0x34'),_0x79e8('0x35'),'offline-chat');fs_extra[_0x79e8('0x36')](_0x2da404,function(){_0x5aa547(null,_0x2da404);});},'filename':function(_0x467c61,_0x4be317,_0x4deb86){const _0x3714c1=_0x4be317[_0x79e8('0x28')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1171fc=path['extname'](_0x3714c1);const _0x1ac6b9=Date['now']()+'-'+_0x3714c1[_0x79e8('0x37')](_0x1171fc,'')+_0x1171fc;_0x4deb86(null,_0x1ac6b9);}})});router['post'](_0x79e8('0x38'),offlineUploadMulter[_0x79e8('0x39')](),controller[_0x79e8('0x3a')]);router['post'](_0x79e8('0x15'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x3b')]);router[_0x79e8('0x1d')]('/:id/applications',auth['isAuthenticated'](),controller[_0x79e8('0x3c')]);router[_0x79e8('0x1d')](_0x79e8('0x18'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x79e8('0x1d')]('/:id/users',auth[_0x79e8('0x9')](),controller['addAgents']);router[_0x79e8('0x3d')]('/:id',auth[_0x79e8('0x9')](),controller[_0x79e8('0x3e')]);router[_0x79e8('0x3f')](_0x79e8('0xc'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x40')]);router[_0x79e8('0x3f')](_0x79e8('0xd'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x41')]);router[_0x79e8('0x3f')](_0x79e8('0x1f'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x42')]);router['delete'](_0x79e8('0x43'),auth[_0x79e8('0x9')](),controller[_0x79e8('0x44')]);module['exports']=router; \ No newline at end of file +var _0x52ea=['getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','addDisposition','root','format','now','originalname','file','addLogo','diskStorage','server/files/images/avatars/','%s-%s','single','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','join','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','/:id/proactive_actions','/:id/users','addAgents','/:id','delete','removeDispositions','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getSnippet'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x52ea,0x13c));var _0xa52e=function(_0x3e5d32,_0x19ce13){_0x3e5d32=_0x3e5d32-0x0;var _0x3e7822=_0x52ea[_0x3e5d32];return _0x3e7822;};'use strict';var multer=require(_0xa52e('0x0'));var util=require(_0xa52e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa52e('0x2'));var router=express[_0xa52e('0x3')]();var fs_extra=require(_0xa52e('0x4'));var auth=require(_0xa52e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa52e('0x6'));var controller=require(_0xa52e('0x7'));router['get']('/',auth[_0xa52e('0x8')](),controller[_0xa52e('0x9')]);router[_0xa52e('0xa')](_0xa52e('0xb'),auth[_0xa52e('0x8')](),controller[_0xa52e('0xc')]);router[_0xa52e('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa52e('0xa')](_0xa52e('0xd'),auth[_0xa52e('0x8')](),controller[_0xa52e('0xe')]);router[_0xa52e('0xa')](_0xa52e('0xf'),auth[_0xa52e('0x8')](),controller['getAnswers']);router[_0xa52e('0xa')](_0xa52e('0x10'),controller[_0xa52e('0x11')]);router[_0xa52e('0xa')](_0xa52e('0x12'),controller[_0xa52e('0x13')]);router[_0xa52e('0xa')](_0xa52e('0x14'),controller['getCustomerAvatar']);router[_0xa52e('0xa')]('/:id/system_avatar',controller[_0xa52e('0x15')]);router[_0xa52e('0xa')](_0xa52e('0x16'),auth[_0xa52e('0x8')](),controller['getInteractions']);router[_0xa52e('0xa')]('/:id/snippet',controller[_0xa52e('0x17')]);router[_0xa52e('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa52e('0x18')]);router[_0xa52e('0xa')]('/:id/proactive_actions',auth[_0xa52e('0x8')](),controller[_0xa52e('0x19')]);router[_0xa52e('0xa')]('/:id/fields',controller[_0xa52e('0x1a')]);router['get'](_0xa52e('0x1b'),auth[_0xa52e('0x8')](),controller[_0xa52e('0x1c')]);router[_0xa52e('0xa')]('/:id/users',auth[_0xa52e('0x8')](),controller[_0xa52e('0x1d')]);router['post']('/',auth[_0xa52e('0x8')](),controller[_0xa52e('0x1e')]);router[_0xa52e('0x1f')]('/:id/dispositions',auth[_0xa52e('0x8')](),controller[_0xa52e('0x20')]);router[_0xa52e('0x1f')](_0xa52e('0xf'),auth[_0xa52e('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3bfa32,_0x48118b,_0xbaa74f){_0xbaa74f(null,path['join'](config[_0xa52e('0x21')],'server/files/images/logos/'));},'filename':function(_0x1b39b7,_0x26b7b7,_0x3d1b21){_0x3d1b21(null,util[_0xa52e('0x22')]('%s-%s',Date[_0xa52e('0x23')](),_0x26b7b7[_0xa52e('0x24')]));}})});router[_0xa52e('0x1f')](_0xa52e('0x10'),upload['single'](_0xa52e('0x25')),controller[_0xa52e('0x26')]);var upload=multer({'storage':multer[_0xa52e('0x27')]({'destination':function(_0x3cbce3,_0xd1cf41,_0x29b02c){_0x29b02c(null,path['join'](config['root'],_0xa52e('0x28')));},'filename':function(_0x18ee00,_0x1d85f3,_0x3da859){_0x3da859(null,util[_0xa52e('0x22')](_0xa52e('0x29'),Date[_0xa52e('0x23')](),_0x1d85f3[_0xa52e('0x24')]));}})});router['post'](_0xa52e('0x12'),upload[_0xa52e('0x2a')](_0xa52e('0x25')),controller[_0xa52e('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58c02b,_0x22ac8d,_0x155d05){_0x155d05(null,path['join'](config[_0xa52e('0x21')],_0xa52e('0x28')));},'filename':function(_0x137bb2,_0x47b893,_0x286fa4){_0x286fa4(null,util['format'](_0xa52e('0x29'),Date[_0xa52e('0x23')](),_0x47b893['originalname']));}})});router[_0xa52e('0x1f')](_0xa52e('0x14'),upload[_0xa52e('0x2a')](_0xa52e('0x25')),controller[_0xa52e('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x413da7,_0x393025,_0xbe416){_0xbe416(null,path['join'](config[_0xa52e('0x21')],_0xa52e('0x28')));},'filename':function(_0x43eaf3,_0x3db8e9,_0x3108fd){_0x3108fd(null,util[_0xa52e('0x22')]('%s-%s',Date[_0xa52e('0x23')](),_0x3db8e9['originalname']));}})});router['post'](_0xa52e('0x2d'),upload[_0xa52e('0x2a')](_0xa52e('0x25')),controller[_0xa52e('0x2e')]);router[_0xa52e('0x1f')](_0xa52e('0x2f'),controller[_0xa52e('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0xa52e('0x27')]({'destination':function(_0x37d703,_0x3235b2,_0x4bacf0){const _0x4959f8=path[_0xa52e('0x31')](config[_0xa52e('0x21')],_0xa52e('0x32'),_0xa52e('0x33'),_0xa52e('0x34'));fs_extra[_0xa52e('0x35')](_0x4959f8,function(){_0x4bacf0(null,_0x4959f8);});},'filename':function(_0x425afb,_0x2e492a,_0x468636){const _0x1b811e=_0x2e492a[_0xa52e('0x24')][_0xa52e('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x434f29=path[_0xa52e('0x37')](_0x1b811e);const _0x25d318=Date[_0xa52e('0x23')]()+'-'+_0x1b811e[_0xa52e('0x36')](_0x434f29,'')+_0x434f29;_0x468636(null,_0x25d318);}})});router['post'](_0xa52e('0x38'),offlineUploadMulter[_0xa52e('0x39')](),controller[_0xa52e('0x3a')]);router[_0xa52e('0x1f')](_0xa52e('0x16'),auth[_0xa52e('0x8')](),controller[_0xa52e('0x3b')]);router['post'](_0xa52e('0x3c'),auth[_0xa52e('0x8')](),controller['addApplications']);router[_0xa52e('0x1f')](_0xa52e('0x3d'),auth[_0xa52e('0x8')](),controller['addProactiveActions']);router[_0xa52e('0x1f')](_0xa52e('0x3e'),auth['isAuthenticated'](),controller[_0xa52e('0x3f')]);router['put'](_0xa52e('0x40'),auth[_0xa52e('0x8')](),controller['update']);router[_0xa52e('0x41')](_0xa52e('0x40'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xa52e('0xd'),auth[_0xa52e('0x8')](),controller[_0xa52e('0x42')]);router[_0xa52e('0x41')](_0xa52e('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xa52e('0x41')](_0xa52e('0x3e'),auth[_0xa52e('0x8')](),controller['removeAgents']);module[_0xa52e('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index a3d1d1d..97ff8c7 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 _0x1561=['Google','STRING','ENUM','AmazonAWS'];(function(_0x383875,_0x45b02b){var _0x128fc2=function(_0x247f99){while(--_0x247f99){_0x383875['push'](_0x383875['shift']());}};_0x128fc2(++_0x45b02b);}(_0x1561,0x1bd));var _0x1156=function(_0x527bea,_0x387f44){_0x527bea=_0x527bea-0x0;var _0x53eb48=_0x1561[_0x527bea];return _0x53eb48;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1156('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1156('0x1')](_0x1156('0x2'),_0x1156('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1156('0x0')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1751=['STRING','ENUM','Google','sequelize','exports'];(function(_0x24d079,_0x5af595){var _0x1fa7eb=function(_0x5889a4){while(--_0x5889a4){_0x24d079['push'](_0x24d079['shift']());}};_0x1fa7eb(++_0x5af595);}(_0x1751,0x76));var _0x1175=function(_0x22edb9,_0xed64d5){_0x22edb9=_0x22edb9-0x0;var _0x5503ad=_0x1751[_0x22edb9];return _0x5503ad;};'use strict';var Sequelize=require(_0x1175('0x0'));module[_0x1175('0x1')]={'name':{'type':Sequelize[_0x1175('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1175('0x3')]('AmazonAWS',_0x1175('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1175('0x2')]},'data2':{'type':Sequelize[_0x1175('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ba31b47..37899a4 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','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','CloudProvider','fieldName','type','key'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xadb5,0xad));var _0x5adb=function(_0x4bf68d,_0x4d9db2){_0x4bf68d=_0x4bf68d-0x0;var _0x40cf4a=_0xadb5[_0x4bf68d];return _0x40cf4a;};'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['CloudProvider']['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')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +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','CloudProvider','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(_0x127820,_0x4a606d){var _0x1f71a9=function(_0x27911b){while(--_0x27911b){_0x127820['push'](_0x127820['shift']());}};_0x1f71a9(++_0x4a606d);}(_0x2ef3,0xba));var _0x32ef=function(_0x1b29e2,_0x520b54){_0x1b29e2=_0x1b29e2-0x0;var _0x3c65f7=_0x2ef3[_0x1b29e2];return _0x3c65f7;};'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['CloudProvider'][_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['CloudProvider'][_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['CloudProvider']['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 diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0606532..5de16e4 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 _0x21e5=['exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x21e5,0xa0));var _0x521e=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x21e5[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require(_0x521e('0x0'));var util=require(_0x521e('0x1'));var logger=require(_0x521e('0x2'))(_0x521e('0x3'));var moment=require(_0x521e('0x4'));var BPromise=require('bluebird');var rp=require(_0x521e('0x5'));var fs=require('fs');var path=require(_0x521e('0x6'));var rimraf=require(_0x521e('0x7'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x521e('0x8')]=function(_0x180441,_0x3ea8e9){return _0x180441[_0x521e('0x9')](_0x521e('0xa'),attributes,{'tableName':_0x521e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58cd=['bluebird','request-promise','rimraf','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x58cd,0x8b));var _0xd58c=function(_0x5a65d1,_0x1dce5b){_0x5a65d1=_0x5a65d1-0x0;var _0x4f85fd=_0x58cd[_0x5a65d1];return _0x4f85fd;};'use strict';var _=require(_0xd58c('0x0'));var util=require('util');var logger=require(_0xd58c('0x1'))(_0xd58c('0x2'));var moment=require(_0xd58c('0x3'));var BPromise=require(_0xd58c('0x4'));var rp=require(_0xd58c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd58c('0x6'));var config=require('../../config/environment');var attributes=require(_0xd58c('0x7'));module['exports']=function(_0x37cf68,_0x28fb19){return _0x37cf68[_0xd58c('0x8')](_0xd58c('0x9'),attributes,{'tableName':_0xd58c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 642f352..3d7282a 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 _0x85de=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x3378c6,_0x1411c6){var _0x2e60ce=function(_0x463e35){while(--_0x463e35){_0x3378c6['push'](_0x3378c6['shift']());}};_0x2e60ce(++_0x1411c6);}(_0x85de,0x65));var _0xe85d=function(_0x519705,_0x2ae1b4){_0x519705=_0x519705-0x0;var _0x5a4635=_0x85de[_0x519705];return _0x5a4635;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var moment=require(_0xe85d('0x2'));var BPromise=require(_0xe85d('0x3'));var rs=require(_0xe85d('0x4'));var fs=require('fs');var Redis=require(_0xe85d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe85d('0x6'));var logger=require(_0xe85d('0x7'))(_0xe85d('0x8'));var config=require(_0xe85d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe85d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27401c,_0x387bfc,_0x42c1ca){return new BPromise(function(_0x4c1cbb,_0x2c1197){return client[_0xe85d('0xb')](_0x27401c,_0x42c1ca)[_0xe85d('0xc')](function(_0x89b2b2){logger[_0xe85d('0xd')](_0xe85d('0xe'),_0x387bfc,_0xe85d('0xf'));logger[_0xe85d('0x10')](_0xe85d('0x11'),_0x387bfc,_0xe85d('0xf'),JSON[_0xe85d('0x12')](_0x89b2b2));if(_0x89b2b2[_0xe85d('0x13')]){if(_0x89b2b2[_0xe85d('0x13')][_0xe85d('0x14')]===0x1f4){logger[_0xe85d('0x13')](_0xe85d('0xe'),_0x387bfc,_0x89b2b2[_0xe85d('0x13')]['message']);return _0x2c1197(_0x89b2b2['error'][_0xe85d('0x15')]);}logger[_0xe85d('0x13')](_0xe85d('0xe'),_0x387bfc,_0x89b2b2[_0xe85d('0x13')][_0xe85d('0x15')]);return _0x4c1cbb(_0x89b2b2[_0xe85d('0x13')][_0xe85d('0x15')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x387bfc,'request\x20sent');_0x4c1cbb(_0x89b2b2['result'][_0xe85d('0x15')]);}})[_0xe85d('0x16')](function(_0x5c431c){logger[_0xe85d('0x13')](_0xe85d('0xe'),_0x387bfc,_0x5c431c);_0x2c1197(_0x5c431c);});});} \ No newline at end of file +var _0x0e56=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0e56,0xf5));var _0x60e5=function(_0x2c699e,_0x5e9d6c){_0x2c699e=_0x2c699e-0x0;var _0x5844e3=_0x0e56[_0x2c699e];return _0x5844e3;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index ac02d5c..baf2019 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 _0x1a22=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a22,0x125));var _0x21a2=function(_0x23cfaf,_0x1d8545){_0x23cfaf=_0x23cfaf-0x0;var _0xf8af44=_0x1a22[_0x23cfaf];return _0xf8af44;};'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')]('/:id',auth[_0x21a2('0x9')](),controller['show']);router[_0x21a2('0xb')]('/',auth[_0x21a2('0x9')](),controller[_0x21a2('0xc')]);router[_0x21a2('0xd')]('/:id',auth[_0x21a2('0x9')](),controller[_0x21a2('0xe')]);router['delete']('/:id',auth[_0x21a2('0x9')](),controller[_0x21a2('0xf')]);module[_0x21a2('0x10')]=router; \ No newline at end of file +var _0x9e05=['../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a1c33,_0x319ba4){var _0x3e1b54=function(_0x56d4bb){while(--_0x56d4bb){_0x1a1c33['push'](_0x1a1c33['shift']());}};_0x3e1b54(++_0x319ba4);}(_0x9e05,0x123));var _0x59e0=function(_0x5589af,_0x18ee22){_0x5589af=_0x5589af-0x0;var _0x6b8a47=_0x9e05[_0x5589af];return _0x6b8a47;};'use strict';var multer=require(_0x59e0('0x0'));var util=require(_0x59e0('0x1'));var path=require(_0x59e0('0x2'));var timeout=require(_0x59e0('0x3'));var express=require(_0x59e0('0x4'));var router=express[_0x59e0('0x5')]();var fs_extra=require(_0x59e0('0x6'));var auth=require(_0x59e0('0x7'));var interaction=require(_0x59e0('0x8'));var config=require(_0x59e0('0x9'));var controller=require(_0x59e0('0xa'));router[_0x59e0('0xb')]('/',auth[_0x59e0('0xc')](),controller[_0x59e0('0xd')]);router['get'](_0x59e0('0xe'),auth[_0x59e0('0xc')](),controller[_0x59e0('0xf')]);router['post']('/',auth[_0x59e0('0xc')](),controller['create']);router[_0x59e0('0x10')](_0x59e0('0xe'),auth[_0x59e0('0xc')](),controller['update']);router[_0x59e0('0x11')](_0x59e0('0xe'),auth[_0x59e0('0xc')](),controller[_0x59e0('0x12')]);module[_0x59e0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 43aa2fb..f8dc556 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 _0xeb48=['name','exports','STRING'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0xeb48,0xfa));var _0x8eb4=function(_0x379145,_0x8624c9){_0x379145=_0x379145-0x0;var _0x32800e=_0xeb48[_0x379145];return _0x32800e;};'use strict';var Sequelize=require('sequelize');module[_0x8eb4('0x0')]={'name':{'type':Sequelize[_0x8eb4('0x1')],'unique':_0x8eb4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8eb4('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x8eb4('0x1')]},'type':{'type':Sequelize[_0x8eb4('0x1')]},'street':{'type':Sequelize[_0x8eb4('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8eb4('0x1')]},'country':{'type':Sequelize[_0x8eb4('0x1')]},'email':{'type':Sequelize[_0x8eb4('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8eb4('0x1')]},'sStreet':{'type':Sequelize[_0x8eb4('0x1')]},'sPostalCode':{'type':Sequelize[_0x8eb4('0x1')]},'sCity':{'type':Sequelize[_0x8eb4('0x1')]},'sCountry':{'type':Sequelize[_0x8eb4('0x1')]},'description':{'type':Sequelize[_0x8eb4('0x1')]}}; \ No newline at end of file +var _0xb800=['exports','STRING','name','sequelize'];(function(_0x30c521,_0x58ffcf){var _0x4d389e=function(_0x419e6f){while(--_0x419e6f){_0x30c521['push'](_0x30c521['shift']());}};_0x4d389e(++_0x58ffcf);}(_0xb800,0x187));var _0x0b80=function(_0x423a52,_0x2649e8){_0x423a52=_0x423a52-0x0;var _0x5c2971=_0xb800[_0x423a52];return _0x5c2971;};'use strict';var Sequelize=require(_0x0b80('0x0'));module[_0x0b80('0x1')]={'name':{'type':Sequelize[_0x0b80('0x2')],'unique':_0x0b80('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0b80('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0b80('0x2')]},'phone':{'type':Sequelize[_0x0b80('0x2')]},'fax':{'type':Sequelize[_0x0b80('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x0b80('0x2')]},'country':{'type':Sequelize[_0x0b80('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0b80('0x2')]},'sStreet':{'type':Sequelize[_0x0b80('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x0b80('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0b80('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a19c53e..0d3cacb 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 _0xd12f=['bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Companies','UserProfileResource','sendStatus','error','stack','name','index','CmCompany','describe','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','map','filter','merge','options','findAll','catch','show','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addContacts','CmContact','rawAttributes','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1c83de,_0x1abfb6){var _0x2221ad=function(_0x2c9915){while(--_0x2c9915){_0x1c83de['push'](_0x1c83de['shift']());}};_0x2221ad(++_0x1abfb6);}(_0xd12f,0xf1));var _0xfd12=function(_0x1d7876,_0x12a04e){_0x1d7876=_0x1d7876-0x0;var _0x57d572=_0xd12f[_0x1d7876];return _0x57d572;};'use strict';var emlformat=require(_0xfd12('0x0'));var rimraf=require(_0xfd12('0x1'));var zipdir=require(_0xfd12('0x2'));var jsonpatch=require(_0xfd12('0x3'));var rp=require(_0xfd12('0x4'));var moment=require('moment');var BPromise=require(_0xfd12('0x5'));var Mustache=require(_0xfd12('0x6'));var util=require(_0xfd12('0x7'));var path=require('path');var sox=require(_0xfd12('0x8'));var csv=require(_0xfd12('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd12('0xa'));var _=require(_0xfd12('0xb'));var squel=require(_0xfd12('0xc'));var crypto=require(_0xfd12('0xd'));var jsforce=require(_0xfd12('0xe'));var deskjs=require(_0xfd12('0xf'));var toCsv=require(_0xfd12('0x9'));var querystring=require(_0xfd12('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfd12('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd12('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd12('0x13'))('api');var utils=require(_0xfd12('0x14'));var config=require(_0xfd12('0x15'));var licenseUtil=require(_0xfd12('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e73d3,_0x2b9cce){_0x2b9cce=_0x2b9cce||0xcc;return function(_0x5d12ac){if(_0x5d12ac){return _0x2e73d3['sendStatus'](_0x2b9cce);}return _0x2e73d3[_0xfd12('0x17')](_0x2b9cce)[_0xfd12('0x18')]();};}function respondWithResult(_0x4ee1b0,_0x54e75c){_0x54e75c=_0x54e75c||0xc8;return function(_0x494f45){if(_0x494f45){return _0x4ee1b0[_0xfd12('0x17')](_0x54e75c)[_0xfd12('0x19')](_0x494f45);}};}function respondWithFilteredResult(_0x58d1b8,_0x184509){return function(_0x4fb4b6){if(_0x4fb4b6){var _0x13f924=typeof _0x184509[_0xfd12('0x1a')]===_0xfd12('0x1b')&&typeof _0x184509[_0xfd12('0x1c')]===_0xfd12('0x1b');var _0x62e75d=_0x4fb4b6[_0xfd12('0x1d')];var _0x3dc9bb=_0x13f924?0x0:_0x184509[_0xfd12('0x1a')];var _0x5eb619=_0x13f924?_0x4fb4b6['count']:_0x184509['offset']+_0x184509[_0xfd12('0x1c')];var _0x214eaf;if(_0x5eb619>=_0x62e75d){_0x5eb619=_0x62e75d;_0x214eaf=0xc8;}else{_0x214eaf=0xce;}_0x58d1b8['status'](_0x214eaf);return _0x58d1b8[_0xfd12('0x1e')](_0xfd12('0x1f'),_0x3dc9bb+'-'+_0x5eb619+'/'+_0x62e75d)[_0xfd12('0x19')](_0x4fb4b6);}return null;};}function patchUpdates(_0x4acd52){return function(_0x5c3f9a){try{jsonpatch[_0xfd12('0x20')](_0x5c3f9a,_0x4acd52,!![]);}catch(_0x187dce){return BPromise['reject'](_0x187dce);}return _0x5c3f9a[_0xfd12('0x21')]();};}function saveUpdates(_0x328ef2,_0x3a5e25){return function(_0xd58f5a){if(_0xd58f5a){return _0xd58f5a[_0xfd12('0x22')](_0x328ef2)['then'](function(_0x1c558f){return _0x1c558f;});}return null;};}function removeEntity(_0x279e58,_0x3165cf){return function(_0x27033a){if(_0x27033a){return _0x27033a['destroy']()[_0xfd12('0x23')](function(){var _0x81626d=_0x27033a[_0xfd12('0x24')]({'plain':!![]});var _0xe5cc20=_0xfd12('0x25');return db[_0xfd12('0x26')]['destroy']({'where':{'type':_0xe5cc20,'resourceId':_0x81626d['id']}})[_0xfd12('0x23')](function(){return _0x27033a;});})[_0xfd12('0x23')](function(){_0x279e58[_0xfd12('0x17')](0xcc)[_0xfd12('0x18')]();});}};}function handleEntityNotFound(_0x7769f5,_0x14d035){return function(_0x45c326){if(!_0x45c326){_0x7769f5[_0xfd12('0x27')](0x194);}return _0x45c326;};}function handleError(_0x3e81e7,_0x44e50a){_0x44e50a=_0x44e50a||0x1f4;return function(_0x1a6eb0){logger[_0xfd12('0x28')](_0x1a6eb0[_0xfd12('0x29')]);if(_0x1a6eb0[_0xfd12('0x2a')]){delete _0x1a6eb0[_0xfd12('0x2a')];}_0x3e81e7[_0xfd12('0x17')](_0x44e50a)['send'](_0x1a6eb0);};}exports[_0xfd12('0x2b')]=function(_0x5a14ea,_0xb25fe7){var _0x442457={},_0x42b788={},_0x32a583={'count':0x0,'rows':[]};return db[_0xfd12('0x2c')][_0xfd12('0x2d')]()[_0xfd12('0x23')](function(_0x42e507){_0x42b788[_0xfd12('0x2e')]=_['keys'](_0x42e507);_0x42b788[_0xfd12('0x2f')]=_[_0xfd12('0x30')](_0x5a14ea[_0xfd12('0x2f')]);_0x42b788[_0xfd12('0x31')]=_[_0xfd12('0x32')](_0x42b788[_0xfd12('0x2e')],_0x42b788[_0xfd12('0x2f')]);_0x442457['attributes']=_[_0xfd12('0x32')](_0x42b788['model'],qs['fields'](_0x5a14ea[_0xfd12('0x2f')][_0xfd12('0x33')]));_0x442457[_0xfd12('0x34')]=_0x442457['attributes'][_0xfd12('0x35')]?_0x442457['attributes']:_0x42b788[_0xfd12('0x2e')];if(!_0x5a14ea[_0xfd12('0x2f')][_0xfd12('0x36')](_0xfd12('0x37'))){_0x442457[_0xfd12('0x1c')]=qs[_0xfd12('0x1c')](_0x5a14ea[_0xfd12('0x2f')][_0xfd12('0x1c')]);_0x442457[_0xfd12('0x1a')]=qs[_0xfd12('0x1a')](_0x5a14ea[_0xfd12('0x2f')]['offset']);}_0x442457['order']=qs[_0xfd12('0x38')](_0x5a14ea['query']['sort']);_0x442457[_0xfd12('0x39')]=qs[_0xfd12('0x31')](_[_0xfd12('0x3a')](_0x5a14ea['query'],_0x42b788[_0xfd12('0x31')]),_0x42e507);if(_0x5a14ea[_0xfd12('0x2f')]['filter']){_0x442457[_0xfd12('0x39')]=_['merge'](_0x442457['where'],{'$or':_[_0xfd12('0x3b')](_0x442457[_0xfd12('0x34')],function(_0x57ab95){var _0x452226={};_0x452226[_0x57ab95]={'$like':'%'+_0x5a14ea[_0xfd12('0x2f')][_0xfd12('0x3c')]+'%'};return _0x452226;})});}_0x442457=_[_0xfd12('0x3d')]({},_0x442457,_0x5a14ea[_0xfd12('0x3e')]);var _0x3db685={'where':_0x442457[_0xfd12('0x39')]};return db[_0xfd12('0x2c')][_0xfd12('0x1d')](_0x3db685)['then'](function(_0x38b1cb){_0x32a583['count']=_0x38b1cb;if(_0x5a14ea['query']['includeAll']){_0x442457['include']=[{'all':!![]}];}return db[_0xfd12('0x2c')][_0xfd12('0x3f')](_0x442457);})['then'](function(_0xd0e1a0){_0x32a583['rows']=_0xd0e1a0;return _0x32a583;})[_0xfd12('0x23')](respondWithFilteredResult(_0xb25fe7,_0x442457))['catch'](handleError(_0xb25fe7,null));})[_0xfd12('0x40')](handleError(_0xb25fe7,null));};exports[_0xfd12('0x41')]=function(_0x3f9a16,_0x539f36){var _0x18fa81={'raw':![],'where':{'id':_0x3f9a16[_0xfd12('0x42')]['id']}},_0x558d28={};_0x558d28['model']=_['keys'](db[_0xfd12('0x2c')]['rawAttributes']);_0x558d28[_0xfd12('0x2f')]=_[_0xfd12('0x30')](_0x3f9a16[_0xfd12('0x2f')]);_0x558d28['filters']=_[_0xfd12('0x32')](_0x558d28[_0xfd12('0x2e')],_0x558d28[_0xfd12('0x2f')]);_0x18fa81[_0xfd12('0x34')]=_['intersection'](_0x558d28[_0xfd12('0x2e')],qs[_0xfd12('0x33')](_0x3f9a16[_0xfd12('0x2f')]['fields']));_0x18fa81[_0xfd12('0x34')]=_0x18fa81['attributes']['length']?_0x18fa81[_0xfd12('0x34')]:_0x558d28[_0xfd12('0x2e')];if(_0x3f9a16[_0xfd12('0x2f')][_0xfd12('0x43')]){_0x18fa81[_0xfd12('0x44')]=[{'all':!![]}];}_0x18fa81=_[_0xfd12('0x3d')]({},_0x18fa81,_0x3f9a16[_0xfd12('0x3e')]);return db[_0xfd12('0x2c')][_0xfd12('0x45')](_0x18fa81)[_0xfd12('0x23')](handleEntityNotFound(_0x539f36,null))['then'](respondWithResult(_0x539f36,null))['catch'](handleError(_0x539f36,null));};exports[_0xfd12('0x46')]=function(_0x191af8,_0x27fc41){return db['CmCompany'][_0xfd12('0x46')](_0x191af8[_0xfd12('0x47')],{})['then'](function(_0xbbc453){var _0xadaed8=_0x191af8[_0xfd12('0x48')][_0xfd12('0x24')]({'plain':!![]});if(!_0xadaed8)throw new Error(_0xfd12('0x49'));if(_0xadaed8['role']==='user'){var _0x1e400c=_0xbbc453[_0xfd12('0x24')]({'plain':!![]});var _0x182987=_0xfd12('0x25');return db[_0xfd12('0x4a')][_0xfd12('0x45')]({'where':{'name':_0x182987,'userProfileId':_0xadaed8[_0xfd12('0x4b')]},'raw':!![]})[_0xfd12('0x23')](function(_0x49cd9c){if(_0x49cd9c&&_0x49cd9c['autoAssociation']===0x0){return db[_0xfd12('0x26')][_0xfd12('0x46')]({'name':_0x1e400c[_0xfd12('0x2a')],'resourceId':_0x1e400c['id'],'type':_0x49cd9c['name'],'sectionId':_0x49cd9c['id']},{})[_0xfd12('0x23')](function(){return _0xbbc453;});}else{return _0xbbc453;}})['catch'](function(_0x5c40b0){logger['error'](_0xfd12('0x4c'),_0x5c40b0);throw _0x5c40b0;});}return _0xbbc453;})[_0xfd12('0x23')](respondWithResult(_0x27fc41,0xc9))[_0xfd12('0x40')](handleError(_0x27fc41,null));};exports[_0xfd12('0x22')]=function(_0x399d2b,_0x5a8dc6){if(_0x399d2b['body']['id']){delete _0x399d2b[_0xfd12('0x47')]['id'];}return db[_0xfd12('0x2c')][_0xfd12('0x45')]({'where':{'id':_0x399d2b[_0xfd12('0x42')]['id']}})[_0xfd12('0x23')](handleEntityNotFound(_0x5a8dc6,null))[_0xfd12('0x23')](saveUpdates(_0x399d2b['body'],null))[_0xfd12('0x23')](respondWithResult(_0x5a8dc6,null))['catch'](handleError(_0x5a8dc6,null));};exports[_0xfd12('0x4d')]=function(_0x38567a,_0x15ca96){return db[_0xfd12('0x2c')][_0xfd12('0x45')]({'where':{'id':_0x38567a[_0xfd12('0x42')]['id']}})[_0xfd12('0x23')](handleEntityNotFound(_0x15ca96,null))[_0xfd12('0x23')](removeEntity(_0x15ca96,null))[_0xfd12('0x40')](handleError(_0x15ca96,null));};exports['describe']=function(_0x3ab7bb,_0xea18a1){return db[_0xfd12('0x2c')][_0xfd12('0x2d')]()[_0xfd12('0x23')](respondWithResult(_0xea18a1,null))['catch'](handleError(_0xea18a1,null));};exports[_0xfd12('0x4e')]=function(_0x17fb5d,_0x1a568a,_0x31d9b0){return db[_0xfd12('0x4f')][_0xfd12('0x45')]({'where':{'id':_0x17fb5d[_0xfd12('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a568a,null))[_0xfd12('0x23')](function(_0x333630){if(_0x333630){return _0x333630['addContacts'](_0x17fb5d[_0xfd12('0x47')]['ids'],_['omit'](_0x17fb5d[_0xfd12('0x47')],['ids','id'])||{});}})[_0xfd12('0x23')](respondWithResult(_0x1a568a,null))[_0xfd12('0x40')](handleError(_0x1a568a,null));};exports['getContacts']=function(_0x3f8390,_0x135aba,_0x332854){var _0x29b934={};var _0x26ef43={};var _0x383639;var _0x2e5c45;return db[_0xfd12('0x2c')]['findOne']({'where':{'id':_0x3f8390[_0xfd12('0x42')]['id']}})[_0xfd12('0x23')](handleEntityNotFound(_0x135aba,null))[_0xfd12('0x23')](function(_0x224aa9){if(_0x224aa9){_0x383639=_0x224aa9;_0x26ef43[_0xfd12('0x2e')]=_['keys'](db[_0xfd12('0x4f')][_0xfd12('0x50')]);_0x26ef43[_0xfd12('0x2f')]=_['keys'](_0x3f8390[_0xfd12('0x2f')]);_0x26ef43[_0xfd12('0x31')]=_[_0xfd12('0x32')](_0x26ef43[_0xfd12('0x2e')],_0x26ef43[_0xfd12('0x2f')]);_0x29b934[_0xfd12('0x34')]=_[_0xfd12('0x32')](_0x26ef43[_0xfd12('0x2e')],qs[_0xfd12('0x33')](_0x3f8390[_0xfd12('0x2f')]['fields']));_0x29b934['attributes']=_0x29b934[_0xfd12('0x34')][_0xfd12('0x35')]?_0x29b934[_0xfd12('0x34')]:_0x26ef43['model'];_0x29b934[_0xfd12('0x51')]=qs[_0xfd12('0x38')](_0x3f8390['query']['sort']);_0x29b934[_0xfd12('0x39')]=qs[_0xfd12('0x31')](_[_0xfd12('0x3a')](_0x3f8390[_0xfd12('0x2f')],_0x26ef43[_0xfd12('0x31')]));if(_0x3f8390[_0xfd12('0x2f')][_0xfd12('0x3c')]){_0x29b934[_0xfd12('0x39')]=_['merge'](_0x29b934[_0xfd12('0x39')],{'$or':_[_0xfd12('0x3b')](_0x29b934[_0xfd12('0x34')],function(_0x4b71f6){var _0x4d6f5c={};_0x4d6f5c[_0x4b71f6]={'$like':'%'+_0x3f8390['query'][_0xfd12('0x3c')]+'%'};return _0x4d6f5c;})});}_0x29b934=_[_0xfd12('0x3d')]({},_0x29b934,_0x3f8390['options']);return _0x383639['getContacts'](_0x29b934);}})[_0xfd12('0x23')](function(_0x55fcfd){if(_0x55fcfd){_0x2e5c45=_0x55fcfd['length'];if(!_0x3f8390[_0xfd12('0x2f')][_0xfd12('0x36')](_0xfd12('0x37'))){_0x29b934[_0xfd12('0x1c')]=qs[_0xfd12('0x1c')](_0x3f8390[_0xfd12('0x2f')][_0xfd12('0x1c')]);_0x29b934[_0xfd12('0x1a')]=qs['offset'](_0x3f8390[_0xfd12('0x2f')][_0xfd12('0x1a')]);}return _0x383639['getContacts'](_0x29b934);}})['then'](function(_0x3f1f8f){if(_0x3f1f8f){return _0x3f1f8f?{'count':_0x2e5c45,'rows':_0x3f1f8f}:null;}})[_0xfd12('0x23')](respondWithResult(_0x135aba,null))['catch'](handleError(_0x135aba,null));}; \ No newline at end of file +var _0x293a=['merge','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','get','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','getContacts','findOne','pick','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Companies','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map'];(function(_0x5d29a7,_0x2c1c9f){var _0x51d5e9=function(_0x246713){while(--_0x246713){_0x5d29a7['push'](_0x5d29a7['shift']());}};_0x51d5e9(++_0x2c1c9f);}(_0x293a,0xc8));var _0xa293=function(_0x1c7eaf,_0x1f7036){_0x1c7eaf=_0x1c7eaf-0x0;var _0x2a7d93=_0x293a[_0x1c7eaf];return _0x2a7d93;};'use strict';var emlformat=require(_0xa293('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa293('0x1'));var rp=require(_0xa293('0x2'));var moment=require('moment');var BPromise=require(_0xa293('0x3'));var Mustache=require(_0xa293('0x4'));var util=require(_0xa293('0x5'));var path=require(_0xa293('0x6'));var sox=require('sox');var csv=require(_0xa293('0x7'));var ejs=require(_0xa293('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa293('0x9'));var squel=require('squel');var crypto=require(_0xa293('0xa'));var jsforce=require(_0xa293('0xb'));var deskjs=require(_0xa293('0xc'));var toCsv=require(_0xa293('0x7'));var querystring=require(_0xa293('0xd'));var Papa=require('papaparse');var Redis=require(_0xa293('0xe'));var authService=require(_0xa293('0xf'));var qs=require(_0xa293('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa293('0x11'));var logger=require(_0xa293('0x12'))(_0xa293('0x13'));var utils=require('../../config/utils');var config=require(_0xa293('0x14'));var licenseUtil=require(_0xa293('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b01ad,_0x1678c0){_0x1678c0=_0x1678c0||0xcc;return function(_0x205dc2){if(_0x205dc2){return _0x5b01ad[_0xa293('0x16')](_0x1678c0);}return _0x5b01ad['status'](_0x1678c0)[_0xa293('0x17')]();};}function respondWithResult(_0x301226,_0x67d728){_0x67d728=_0x67d728||0xc8;return function(_0x8f007){if(_0x8f007){return _0x301226[_0xa293('0x18')](_0x67d728)[_0xa293('0x19')](_0x8f007);}};}function respondWithFilteredResult(_0x28dd67,_0x3fe62e){return function(_0xfa14f){if(_0xfa14f){var _0x20fbb6=typeof _0x3fe62e[_0xa293('0x1a')]===_0xa293('0x1b')&&typeof _0x3fe62e[_0xa293('0x1c')]===_0xa293('0x1b');var _0x1fb360=_0xfa14f[_0xa293('0x1d')];var _0x677a75=_0x20fbb6?0x0:_0x3fe62e[_0xa293('0x1a')];var _0x170512=_0x20fbb6?_0xfa14f[_0xa293('0x1d')]:_0x3fe62e[_0xa293('0x1a')]+_0x3fe62e[_0xa293('0x1c')];var _0x3b28cb;if(_0x170512>=_0x1fb360){_0x170512=_0x1fb360;_0x3b28cb=0xc8;}else{_0x3b28cb=0xce;}_0x28dd67[_0xa293('0x18')](_0x3b28cb);return _0x28dd67[_0xa293('0x1e')](_0xa293('0x1f'),_0x677a75+'-'+_0x170512+'/'+_0x1fb360)[_0xa293('0x19')](_0xfa14f);}return null;};}function patchUpdates(_0x3eb36b){return function(_0x496c33){try{jsonpatch[_0xa293('0x20')](_0x496c33,_0x3eb36b,!![]);}catch(_0x4b9c8f){return BPromise[_0xa293('0x21')](_0x4b9c8f);}return _0x496c33[_0xa293('0x22')]();};}function saveUpdates(_0x25f224,_0x14a68f){return function(_0xcb3a5f){if(_0xcb3a5f){return _0xcb3a5f[_0xa293('0x23')](_0x25f224)[_0xa293('0x24')](function(_0x25948b){return _0x25948b;});}return null;};}function removeEntity(_0x261ebf,_0x184ca1){return function(_0x2f7f5c){if(_0x2f7f5c){return _0x2f7f5c[_0xa293('0x25')]()[_0xa293('0x24')](function(){var _0x3c2830=_0x2f7f5c['get']({'plain':!![]});var _0x218e61=_0xa293('0x26');return db['UserProfileResource'][_0xa293('0x25')]({'where':{'type':_0x218e61,'resourceId':_0x3c2830['id']}})[_0xa293('0x24')](function(){return _0x2f7f5c;});})['then'](function(){_0x261ebf['status'](0xcc)[_0xa293('0x17')]();});}};}function handleEntityNotFound(_0x445652,_0x3d8204){return function(_0x31e9ae){if(!_0x31e9ae){_0x445652['sendStatus'](0x194);}return _0x31e9ae;};}function handleError(_0x5ffe75,_0x45564b){_0x45564b=_0x45564b||0x1f4;return function(_0x3011d8){logger[_0xa293('0x27')](_0x3011d8[_0xa293('0x28')]);if(_0x3011d8[_0xa293('0x29')]){delete _0x3011d8['name'];}_0x5ffe75[_0xa293('0x18')](_0x45564b)[_0xa293('0x2a')](_0x3011d8);};}exports[_0xa293('0x2b')]=function(_0x201bb,_0x804c35){var _0x2e55d4={},_0x39b106={},_0x2083cc={'count':0x0,'rows':[]};return db[_0xa293('0x2c')][_0xa293('0x2d')]()[_0xa293('0x24')](function(_0x394fd0){_0x39b106[_0xa293('0x2e')]=_[_0xa293('0x2f')](_0x394fd0);_0x39b106[_0xa293('0x30')]=_[_0xa293('0x2f')](_0x201bb[_0xa293('0x30')]);_0x39b106[_0xa293('0x31')]=_[_0xa293('0x32')](_0x39b106['model'],_0x39b106[_0xa293('0x30')]);_0x2e55d4[_0xa293('0x33')]=_[_0xa293('0x32')](_0x39b106[_0xa293('0x2e')],qs[_0xa293('0x34')](_0x201bb[_0xa293('0x30')][_0xa293('0x34')]));_0x2e55d4['attributes']=_0x2e55d4[_0xa293('0x33')][_0xa293('0x35')]?_0x2e55d4['attributes']:_0x39b106['model'];if(!_0x201bb[_0xa293('0x30')][_0xa293('0x36')](_0xa293('0x37'))){_0x2e55d4['limit']=qs[_0xa293('0x1c')](_0x201bb[_0xa293('0x30')]['limit']);_0x2e55d4[_0xa293('0x1a')]=qs[_0xa293('0x1a')](_0x201bb[_0xa293('0x30')][_0xa293('0x1a')]);}_0x2e55d4[_0xa293('0x38')]=qs[_0xa293('0x39')](_0x201bb[_0xa293('0x30')][_0xa293('0x39')]);_0x2e55d4[_0xa293('0x3a')]=qs[_0xa293('0x31')](_['pick'](_0x201bb[_0xa293('0x30')],_0x39b106[_0xa293('0x31')]),_0x394fd0);if(_0x201bb[_0xa293('0x30')][_0xa293('0x3b')]){_0x2e55d4[_0xa293('0x3a')]=_['merge'](_0x2e55d4[_0xa293('0x3a')],{'$or':_[_0xa293('0x3c')](_0x2e55d4[_0xa293('0x33')],function(_0x21321d){var _0x196e19={};_0x196e19[_0x21321d]={'$like':'%'+_0x201bb[_0xa293('0x30')][_0xa293('0x3b')]+'%'};return _0x196e19;})});}_0x2e55d4=_[_0xa293('0x3d')]({},_0x2e55d4,_0x201bb[_0xa293('0x3e')]);var _0x1b8fc1={'where':_0x2e55d4[_0xa293('0x3a')]};return db[_0xa293('0x2c')]['count'](_0x1b8fc1)[_0xa293('0x24')](function(_0x36d6cf){_0x2083cc['count']=_0x36d6cf;if(_0x201bb[_0xa293('0x30')][_0xa293('0x3f')]){_0x2e55d4['include']=[{'all':!![]}];}return db[_0xa293('0x2c')]['findAll'](_0x2e55d4);})[_0xa293('0x24')](function(_0x31fe05){_0x2083cc[_0xa293('0x40')]=_0x31fe05;return _0x2083cc;})[_0xa293('0x24')](respondWithFilteredResult(_0x804c35,_0x2e55d4))[_0xa293('0x41')](handleError(_0x804c35,null));})[_0xa293('0x41')](handleError(_0x804c35,null));};exports[_0xa293('0x42')]=function(_0x4e7beb,_0x4eabc6){var _0x275dcd={'raw':![],'where':{'id':_0x4e7beb[_0xa293('0x43')]['id']}},_0x56ad99={};_0x56ad99[_0xa293('0x2e')]=_[_0xa293('0x2f')](db[_0xa293('0x2c')][_0xa293('0x44')]);_0x56ad99[_0xa293('0x30')]=_[_0xa293('0x2f')](_0x4e7beb['query']);_0x56ad99['filters']=_[_0xa293('0x32')](_0x56ad99['model'],_0x56ad99['query']);_0x275dcd[_0xa293('0x33')]=_['intersection'](_0x56ad99['model'],qs[_0xa293('0x34')](_0x4e7beb[_0xa293('0x30')][_0xa293('0x34')]));_0x275dcd[_0xa293('0x33')]=_0x275dcd[_0xa293('0x33')][_0xa293('0x35')]?_0x275dcd['attributes']:_0x56ad99[_0xa293('0x2e')];if(_0x4e7beb[_0xa293('0x30')]['includeAll']){_0x275dcd[_0xa293('0x45')]=[{'all':!![]}];}_0x275dcd=_[_0xa293('0x3d')]({},_0x275dcd,_0x4e7beb[_0xa293('0x3e')]);return db[_0xa293('0x2c')]['find'](_0x275dcd)['then'](handleEntityNotFound(_0x4eabc6,null))[_0xa293('0x24')](respondWithResult(_0x4eabc6,null))[_0xa293('0x41')](handleError(_0x4eabc6,null));};exports['create']=function(_0x39930f,_0x4934e7){return db[_0xa293('0x2c')][_0xa293('0x46')](_0x39930f[_0xa293('0x47')],{})[_0xa293('0x24')](function(_0x4a7166){var _0x53b3c1=_0x39930f['user'][_0xa293('0x48')]({'plain':!![]});if(!_0x53b3c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53b3c1[_0xa293('0x49')]===_0xa293('0x4a')){var _0xf8e812=_0x4a7166[_0xa293('0x48')]({'plain':!![]});var _0x3ad7f7=_0xa293('0x26');return db[_0xa293('0x4b')][_0xa293('0x4c')]({'where':{'name':_0x3ad7f7,'userProfileId':_0x53b3c1[_0xa293('0x4d')]},'raw':!![]})[_0xa293('0x24')](function(_0x3459d0){if(_0x3459d0&&_0x3459d0[_0xa293('0x4e')]===0x0){return db[_0xa293('0x4f')][_0xa293('0x46')]({'name':_0xf8e812[_0xa293('0x29')],'resourceId':_0xf8e812['id'],'type':_0x3459d0[_0xa293('0x29')],'sectionId':_0x3459d0['id']},{})[_0xa293('0x24')](function(){return _0x4a7166;});}else{return _0x4a7166;}})[_0xa293('0x41')](function(_0x5a87d5){logger[_0xa293('0x27')](_0xa293('0x50'),_0x5a87d5);throw _0x5a87d5;});}return _0x4a7166;})[_0xa293('0x24')](respondWithResult(_0x4934e7,0xc9))['catch'](handleError(_0x4934e7,null));};exports[_0xa293('0x23')]=function(_0x3f731b,_0x432ea3){if(_0x3f731b['body']['id']){delete _0x3f731b[_0xa293('0x47')]['id'];}return db[_0xa293('0x2c')][_0xa293('0x4c')]({'where':{'id':_0x3f731b[_0xa293('0x43')]['id']}})[_0xa293('0x24')](handleEntityNotFound(_0x432ea3,null))[_0xa293('0x24')](saveUpdates(_0x3f731b[_0xa293('0x47')],null))['then'](respondWithResult(_0x432ea3,null))[_0xa293('0x41')](handleError(_0x432ea3,null));};exports[_0xa293('0x25')]=function(_0x1445d2,_0x1207be){return db[_0xa293('0x2c')]['find']({'where':{'id':_0x1445d2[_0xa293('0x43')]['id']}})[_0xa293('0x24')](handleEntityNotFound(_0x1207be,null))[_0xa293('0x24')](removeEntity(_0x1207be,null))[_0xa293('0x41')](handleError(_0x1207be,null));};exports[_0xa293('0x2d')]=function(_0x51f036,_0x16ef5f){return db['CmCompany']['describe']()[_0xa293('0x24')](respondWithResult(_0x16ef5f,null))[_0xa293('0x41')](handleError(_0x16ef5f,null));};exports['addContacts']=function(_0x127d11,_0x43cec2,_0x502e9e){return db[_0xa293('0x51')][_0xa293('0x4c')]({'where':{'id':_0x127d11[_0xa293('0x43')]['id']}})[_0xa293('0x24')](handleEntityNotFound(_0x43cec2,null))[_0xa293('0x24')](function(_0x3e9a51){if(_0x3e9a51){return _0x3e9a51[_0xa293('0x52')](_0x127d11['body'][_0xa293('0x53')],_['omit'](_0x127d11[_0xa293('0x47')],[_0xa293('0x53'),'id'])||{});}})[_0xa293('0x24')](respondWithResult(_0x43cec2,null))[_0xa293('0x41')](handleError(_0x43cec2,null));};exports[_0xa293('0x54')]=function(_0x8d9183,_0x29d5e0,_0x4fa137){var _0x16d3df={};var _0x48a218={};var _0x6457a5;var _0x2f2c37;return db[_0xa293('0x2c')][_0xa293('0x55')]({'where':{'id':_0x8d9183[_0xa293('0x43')]['id']}})['then'](handleEntityNotFound(_0x29d5e0,null))['then'](function(_0x1e9cb8){if(_0x1e9cb8){_0x6457a5=_0x1e9cb8;_0x48a218[_0xa293('0x2e')]=_['keys'](db[_0xa293('0x51')][_0xa293('0x44')]);_0x48a218[_0xa293('0x30')]=_[_0xa293('0x2f')](_0x8d9183[_0xa293('0x30')]);_0x48a218['filters']=_[_0xa293('0x32')](_0x48a218[_0xa293('0x2e')],_0x48a218[_0xa293('0x30')]);_0x16d3df[_0xa293('0x33')]=_[_0xa293('0x32')](_0x48a218[_0xa293('0x2e')],qs['fields'](_0x8d9183[_0xa293('0x30')][_0xa293('0x34')]));_0x16d3df[_0xa293('0x33')]=_0x16d3df['attributes'][_0xa293('0x35')]?_0x16d3df[_0xa293('0x33')]:_0x48a218[_0xa293('0x2e')];_0x16d3df['order']=qs[_0xa293('0x39')](_0x8d9183[_0xa293('0x30')][_0xa293('0x39')]);_0x16d3df['where']=qs[_0xa293('0x31')](_[_0xa293('0x56')](_0x8d9183[_0xa293('0x30')],_0x48a218['filters']));if(_0x8d9183['query']['filter']){_0x16d3df[_0xa293('0x3a')]=_['merge'](_0x16d3df[_0xa293('0x3a')],{'$or':_[_0xa293('0x3c')](_0x16d3df['attributes'],function(_0x3d7f7b){var _0x434d86={};_0x434d86[_0x3d7f7b]={'$like':'%'+_0x8d9183[_0xa293('0x30')][_0xa293('0x3b')]+'%'};return _0x434d86;})});}_0x16d3df=_['merge']({},_0x16d3df,_0x8d9183[_0xa293('0x3e')]);return _0x6457a5['getContacts'](_0x16d3df);}})['then'](function(_0x4daf3e){if(_0x4daf3e){_0x2f2c37=_0x4daf3e[_0xa293('0x35')];if(!_0x8d9183[_0xa293('0x30')][_0xa293('0x36')](_0xa293('0x37'))){_0x16d3df[_0xa293('0x1c')]=qs[_0xa293('0x1c')](_0x8d9183[_0xa293('0x30')][_0xa293('0x1c')]);_0x16d3df[_0xa293('0x1a')]=qs[_0xa293('0x1a')](_0x8d9183['query'][_0xa293('0x1a')]);}return _0x6457a5[_0xa293('0x54')](_0x16d3df);}})[_0xa293('0x24')](function(_0x169511){if(_0x169511){return _0x169511?{'count':_0x2f2c37,'rows':_0x169511}:null;}})['then'](respondWithResult(_0x29d5e0,null))[_0xa293('0x41')](handleError(_0x29d5e0,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 2ce9d61..63803fc 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 _0xa805=['cm_companies','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany'];(function(_0x233a6e,_0x85c435){var _0x430181=function(_0x103d1c){while(--_0x103d1c){_0x233a6e['push'](_0x233a6e['shift']());}};_0x430181(++_0x85c435);}(_0xa805,0x177));var _0x5a80=function(_0x278968,_0x1e3c4a){_0x278968=_0x278968-0x0;var _0x456d6a=_0xa805[_0x278968];return _0x456d6a;};'use strict';var _=require(_0x5a80('0x0'));var util=require('util');var logger=require(_0x5a80('0x1'))(_0x5a80('0x2'));var moment=require('moment');var BPromise=require(_0x5a80('0x3'));var rp=require(_0x5a80('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a80('0x5'));var config=require(_0x5a80('0x6'));var attributes=require(_0x5a80('0x7'));module['exports']=function(_0x55e6ec,_0xb66025){return _0x55e6ec[_0x5a80('0x8')](_0x5a80('0x9'),attributes,{'tableName':_0x5a80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a86=['util','api','moment','bluebird','path','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x2ae878,_0x3f84b8){var _0x3e109b=function(_0x22cd36){while(--_0x22cd36){_0x2ae878['push'](_0x2ae878['shift']());}};_0x3e109b(++_0x3f84b8);}(_0x1a86,0xb4));var _0x61a8=function(_0x529ceb,_0x26c970){_0x529ceb=_0x529ceb-0x0;var _0x3cb27f=_0x1a86[_0x529ceb];return _0x3cb27f;};'use strict';var _=require('lodash');var util=require(_0x61a8('0x0'));var logger=require('../../config/logger')(_0x61a8('0x1'));var moment=require(_0x61a8('0x2'));var BPromise=require(_0x61a8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61a8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61a8('0x5'));module[_0x61a8('0x6')]=function(_0x25b98f,_0x1bfbf5){return _0x25b98f[_0x61a8('0x7')](_0x61a8('0x8'),attributes,{'tableName':'cm_companies','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 a685f3a..9f310e7 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 _0x98e6=['catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x18c781,_0x1d1ad7){var _0x27383a=function(_0x343125){while(--_0x343125){_0x18c781['push'](_0x18c781['shift']());}};_0x27383a(++_0x1d1ad7);}(_0x98e6,0x1e4));var _0x698e=function(_0xf5fbb7,_0xdb7f69){_0xf5fbb7=_0xf5fbb7-0x0;var _0x330d55=_0x98e6[_0xf5fbb7];return _0x330d55;};'use strict';var _=require('lodash');var util=require(_0x698e('0x0'));var moment=require('moment');var BPromise=require(_0x698e('0x1'));var rs=require(_0x698e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x698e('0x3'))['db'];var utils=require(_0x698e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x698e('0x5'));var jayson=require(_0x698e('0x6'));var client=jayson['client'][_0x698e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9a3f,_0x46451b,_0x4b3a94){return new BPromise(function(_0x5bbef8,_0x69270f){return client[_0x698e('0x8')](_0x9a3f,_0x4b3a94)[_0x698e('0x9')](function(_0x2a3420){logger[_0x698e('0xa')](_0x698e('0xb'),_0x46451b,_0x698e('0xc'));logger[_0x698e('0xd')](_0x698e('0xe'),_0x46451b,_0x698e('0xc'),JSON[_0x698e('0xf')](_0x2a3420));if(_0x2a3420[_0x698e('0x10')]){if(_0x2a3420[_0x698e('0x10')][_0x698e('0x11')]===0x1f4){logger['error'](_0x698e('0xb'),_0x46451b,_0x2a3420[_0x698e('0x10')][_0x698e('0x12')]);return _0x69270f(_0x2a3420[_0x698e('0x10')]['message']);}logger[_0x698e('0x10')](_0x698e('0xb'),_0x46451b,_0x2a3420[_0x698e('0x10')][_0x698e('0x12')]);return _0x5bbef8(_0x2a3420[_0x698e('0x10')][_0x698e('0x12')]);}else{logger['info'](_0x698e('0xb'),_0x46451b,_0x698e('0xc'));_0x5bbef8(_0x2a3420[_0x698e('0x13')][_0x698e('0x12')]);}})[_0x698e('0x14')](function(_0x53ade8){logger[_0x698e('0x10')](_0x698e('0xb'),_0x46451b,_0x53ade8);_0x69270f(_0x53ade8);});});} \ No newline at end of file +var _0xcc0c=['code','CmCompany,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','then','info','request\x20sent','debug','error'];(function(_0x386bf3,_0x39de2f){var _0x4e8eb5=function(_0x5040ba){while(--_0x5040ba){_0x386bf3['push'](_0x386bf3['shift']());}};_0x4e8eb5(++_0x39de2f);}(_0xcc0c,0x1f1));var _0xccc0=function(_0x3b2d98,_0xaa0b26){_0x3b2d98=_0x3b2d98-0x0;var _0x256bf1=_0xcc0c[_0x3b2d98];return _0x256bf1;};'use strict';var _=require(_0xccc0('0x0'));var util=require('util');var moment=require(_0xccc0('0x1'));var BPromise=require(_0xccc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccc0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xccc0('0x4'));var logger=require('../../config/logger')(_0xccc0('0x5'));var config=require('../../config/environment');var jayson=require(_0xccc0('0x6'));var client=jayson[_0xccc0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf6bda0,_0x39e1c4,_0x59c3b9){return new BPromise(function(_0x319cae,_0x334a8c){return client['request'](_0xf6bda0,_0x59c3b9)[_0xccc0('0x8')](function(_0x48dfba){logger[_0xccc0('0x9')]('CmCompany,\x20%s,\x20%s',_0x39e1c4,_0xccc0('0xa'));logger[_0xccc0('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x39e1c4,_0xccc0('0xa'),JSON['stringify'](_0x48dfba));if(_0x48dfba[_0xccc0('0xc')]){if(_0x48dfba[_0xccc0('0xc')][_0xccc0('0xd')]===0x1f4){logger[_0xccc0('0xc')](_0xccc0('0xe'),_0x39e1c4,_0x48dfba[_0xccc0('0xc')][_0xccc0('0xf')]);return _0x334a8c(_0x48dfba[_0xccc0('0xc')]['message']);}logger[_0xccc0('0xc')](_0xccc0('0xe'),_0x39e1c4,_0x48dfba[_0xccc0('0xc')][_0xccc0('0xf')]);return _0x319cae(_0x48dfba[_0xccc0('0xc')]['message']);}else{logger['info'](_0xccc0('0xe'),_0x39e1c4,'request\x20sent');_0x319cae(_0x48dfba['result']['message']);}})[_0xccc0('0x10')](function(_0x1e51b6){logger[_0xccc0('0xc')](_0xccc0('0xe'),_0x39e1c4,_0x1e51b6);_0x334a8c(_0x1e51b6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9382de6..4501574 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 _0x2e88=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','/:id/contacts','addContacts','update','delete','destroy','exports','multer','util'];(function(_0x125ebc,_0x3bfcc1){var _0x4c2996=function(_0x3c2b27){while(--_0x3c2b27){_0x125ebc['push'](_0x125ebc['shift']());}};_0x4c2996(++_0x3bfcc1);}(_0x2e88,0x15e));var _0x82e8=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x2e88[_0x1d87fc];return _0x492b56;};'use strict';var multer=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x82e8('0x2'));var router=express[_0x82e8('0x3')]();var fs_extra=require(_0x82e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82e8('0x5'));var config=require(_0x82e8('0x6'));var controller=require(_0x82e8('0x7'));router[_0x82e8('0x8')]('/',auth[_0x82e8('0x9')](),controller['index']);router['get'](_0x82e8('0xa'),auth[_0x82e8('0x9')](),controller[_0x82e8('0xb')]);router[_0x82e8('0x8')](_0x82e8('0xc'),auth[_0x82e8('0x9')](),controller[_0x82e8('0xd')]);router[_0x82e8('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x82e8('0xe')]('/',auth[_0x82e8('0x9')](),controller[_0x82e8('0xf')]);router[_0x82e8('0xe')](_0x82e8('0x10'),auth[_0x82e8('0x9')](),controller[_0x82e8('0x11')]);router['put']('/:id',auth[_0x82e8('0x9')](),controller[_0x82e8('0x12')]);router[_0x82e8('0x13')](_0x82e8('0xc'),auth[_0x82e8('0x9')](),controller[_0x82e8('0x14')]);module[_0x82e8('0x15')]=router; \ No newline at end of file +var _0x9066=['addContacts','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts','getContacts','create'];(function(_0x296a21,_0x56604f){var _0x48c547=function(_0x2dde4f){while(--_0x2dde4f){_0x296a21['push'](_0x296a21['shift']());}};_0x48c547(++_0x56604f);}(_0x9066,0x193));var _0x6906=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9066[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6906('0x0'));var util=require(_0x6906('0x1'));var path=require(_0x6906('0x2'));var timeout=require(_0x6906('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6906('0x4'));var interaction=require(_0x6906('0x5'));var config=require(_0x6906('0x6'));var controller=require(_0x6906('0x7'));router[_0x6906('0x8')]('/',auth[_0x6906('0x9')](),controller['index']);router[_0x6906('0x8')](_0x6906('0xa'),auth[_0x6906('0x9')](),controller[_0x6906('0xb')]);router[_0x6906('0x8')](_0x6906('0xc'),auth[_0x6906('0x9')](),controller[_0x6906('0xd')]);router[_0x6906('0x8')](_0x6906('0xe'),auth[_0x6906('0x9')](),controller[_0x6906('0xf')]);router['post']('/',auth[_0x6906('0x9')](),controller[_0x6906('0x10')]);router['post'](_0x6906('0xe'),auth[_0x6906('0x9')](),controller[_0x6906('0x11')]);router[_0x6906('0x12')](_0x6906('0xc'),auth[_0x6906('0x9')](),controller['update']);router[_0x6906('0x13')](_0x6906('0xc'),auth['isAuthenticated'](),controller[_0x6906('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ea64d3b..a062160 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 _0x8538=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','STRING'];(function(_0x42e3b8,_0x125f74){var _0x5d813f=function(_0x4c82a0){while(--_0x4c82a0){_0x42e3b8['push'](_0x42e3b8['shift']());}};_0x5d813f(++_0x125f74);}(_0x8538,0xe5));var _0x8853=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8538[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8853('0x0'));var Sequelize=require(_0x8853('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8853('0x2')]},'street':{'type':Sequelize[_0x8853('0x2')]},'postalCode':{'type':Sequelize[_0x8853('0x2')]},'city':{'type':Sequelize[_0x8853('0x2')]},'country':{'type':Sequelize[_0x8853('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8853('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x8853('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8853('0x2')]},'url':{'type':Sequelize[_0x8853('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x8853('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x8853('0x2')]},'teams':{'type':Sequelize[_0x8853('0x2')]},'viber':{'type':Sequelize[_0x8853('0x2')]},'line':{'type':Sequelize[_0x8853('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x8853('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8853('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8853('0x6')],'defaultValue':Sequelize[_0x8853('0x7')]}}; \ No newline at end of file +var _0xc1ae=['INTEGER','DATE','NOW','sequelize','exports','STRING'];(function(_0x22e056,_0x2cc7bd){var _0x20d872=function(_0x47b125){while(--_0x47b125){_0x22e056['push'](_0x22e056['shift']());}};_0x20d872(++_0x2cc7bd);}(_0xc1ae,0xb1));var _0xec1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var Sequelize=require(_0xec1a('0x0'));module[_0xec1a('0x1')]={'firstName':{'type':Sequelize[_0xec1a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xec1a('0x2')]},'postalCode':{'type':Sequelize[_0xec1a('0x2')]},'city':{'type':Sequelize[_0xec1a('0x2')]},'country':{'type':Sequelize[_0xec1a('0x2')]},'dateOfBirth':{'type':Sequelize[_0xec1a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xec1a('0x2')]},'mobile':{'type':Sequelize[_0xec1a('0x2')]},'fax':{'type':Sequelize[_0xec1a('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xec1a('0x2')]},'facebook':{'type':Sequelize[_0xec1a('0x2')]},'fb_data':{'type':Sequelize[_0xec1a('0x2')]},'twitter':{'type':Sequelize[_0xec1a('0x2')]},'skype':{'type':Sequelize[_0xec1a('0x2')]},'teams':{'type':Sequelize[_0xec1a('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xec1a('0x2')]},'telegram':{'type':Sequelize[_0xec1a('0x2')]},'UserId':{'type':Sequelize[_0xec1a('0x3')]},'priority':{'type':Sequelize[_0xec1a('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xec1a('0x4')],'defaultValue':Sequelize[_0xec1a('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c01930d..ab24ddc 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 _0xdd94=['findOrCreate','spread','show','Tag','color','omit','format','$and','pickBy','cf_%d','table','cm_contacts','setFields','id\x20=\x20?','toParam','values','phone','CmHopper','rawAttributes','options','getTags','setTags','ids','includeAll','nolimit','ContactId','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','import','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','-createdAt','channel','toLowerCase','Invalid\x20channel','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','source','callerid','starttime','endtime','duration','createdAt','userDisposition','userThirdDisposition','fullname','alias','DESC','range','VoiceCallReport','findAndCountAll','startCase','Website','Account','closedAt','note','secondDisposition','thirdDisposition','UserId','Owner','browserName','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','sortBy','reverse','slice','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','Content-Range','then','destroy','end','error','name','send','CmContact','describe','keys','length','startsWith','cf_','CmCustomField','findOne','trimStart','all','fieldType','query','filters','attributes','intersection','fields','model','hasOwnProperty','limit','order','sort','where','pick','select','field','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','search','parseSearch','sqlOperator','conditions','value','split','map','forEach','union','User','and','dateOfBirth','castTo','DATE','type','text','isNil','Contact','isEmpty','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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?','group','QueryTypes','SELECT','clone','having','resolve','role','some','getLists','c.ListId\x20IS\x20NULL','user','agent','toString','sequelize','keyBy','merge','c.id','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.CompanyId','TagIds','Tags','push','rows','catch','find','params','columnName','displayName','analytics','custom','body','findAll','get','mergeWith','tags','join','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ChatQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','duplicates','$or','ListId'];(function(_0xd2bb19,_0x36a7c1){var _0x50a142=function(_0x48428e){while(--_0x48428e){_0xd2bb19['push'](_0xd2bb19['shift']());}};_0x50a142(++_0x36a7c1);}(_0xdd94,0x18b));var _0x4dd9=function(_0x5a151c,_0x1c328a){_0x5a151c=_0x5a151c-0x0;var _0x89278e=_0xdd94[_0x5a151c];return _0x89278e;};'use strict';var moment=require(_0x4dd9('0x0'));var BPromise=require(_0x4dd9('0x1'));var util=require(_0x4dd9('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x4dd9('0x3'));var squel=require(_0x4dd9('0x4'));var Papa=require(_0x4dd9('0x5'));var Redis=require(_0x4dd9('0x6'));var qs=require(_0x4dd9('0x7'));var as=require(_0x4dd9('0x8'));var logger=require(_0x4dd9('0x9'))(_0x4dd9('0xa'));var config=require(_0x4dd9('0xb'));var db=require(_0x4dd9('0xc'))['db'];config[_0x4dd9('0xd')]=_['defaults'](config[_0x4dd9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4dd9('0xe'))(new Redis(config['redis']));require(_0x4dd9('0xf'))['register'](socket);function respondWithResult(_0x91f36d,_0x4f698c){_0x4f698c=_0x4f698c||0xc8;return function(_0x5bac4d){if(_0x5bac4d){return _0x91f36d[_0x4dd9('0x10')](_0x4f698c)[_0x4dd9('0x11')](_0x5bac4d);}};}function respondWithFilteredResult(_0x4f657a,_0x40765){return function(_0x564ef4){if(_0x564ef4){var _0x3f7ec6=typeof _0x40765[_0x4dd9('0x12')]===_0x4dd9('0x13')&&typeof _0x40765['limit']===_0x4dd9('0x13');var _0x51e46c=_0x564ef4[_0x4dd9('0x14')];var _0x2bdc39=_0x3f7ec6?0x0:_0x40765[_0x4dd9('0x12')];var _0x104522=_0x3f7ec6?_0x564ef4[_0x4dd9('0x14')]:_0x40765['offset']+_0x40765['limit'];var _0x3facb4;if(_0x104522>=_0x51e46c){_0x104522=_0x51e46c;_0x3facb4=0xc8;}else{_0x3facb4=0xce;}_0x4f657a[_0x4dd9('0x10')](_0x3facb4);return _0x4f657a['set'](_0x4dd9('0x15'),_0x2bdc39+'-'+_0x104522+'/'+_0x51e46c)[_0x4dd9('0x11')](_0x564ef4);}return null;};}function saveUpdates(_0x2595ae){return function(_0x7be57f){if(_0x7be57f){return _0x7be57f['update'](_0x2595ae)[_0x4dd9('0x16')](function(_0x19fb02){return _0x19fb02;});}return null;};}function removeEntity(_0x18fb3d){return function(_0x5dd475){if(_0x5dd475){return _0x5dd475[_0x4dd9('0x17')]()[_0x4dd9('0x16')](function(){_0x18fb3d[_0x4dd9('0x10')](0xcc)[_0x4dd9('0x18')]();});}};}function handleEntityNotFound(_0x54d4c5){return function(_0x323277){if(!_0x323277){_0x54d4c5['sendStatus'](0x194);}return _0x323277;};}function handleError(_0x48c0ec,_0x2431d6){_0x2431d6=_0x2431d6||0x1f4;return function(_0x2435ae){logger[_0x4dd9('0x19')](_0x2435ae['stack']);if(_0x2435ae[_0x4dd9('0x1a')]){delete _0x2435ae[_0x4dd9('0x1a')];}_0x48c0ec[_0x4dd9('0x10')](_0x2431d6)[_0x4dd9('0x1b')](_0x2435ae);};}exports['index']=function(_0x26f9e7,_0x1b7fcd){var _0x38819e={},_0x4abf40={},_0x5cab6f={'count':0x0,'rows':[]};return db[_0x4dd9('0x1c')][_0x4dd9('0x1d')]()[_0x4dd9('0x16')](function(_0x3daafc){var _0x4b1119=[];for(var _0x5bb97c=0x0;_0x5bb97c0x1){_0x5cb468['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4dd9('0x59')](_0x99c9f5),null);}else{if(qs[_0x4dd9('0x5a')](_0x99c9f5)){_0x5cb468['or'](_0x4dd9('0x5b'),_0x99c9f5+'%');_0x5cb468['or'](_0x4dd9('0x5c'),_0x99c9f5+'%');_0x5cb468['or'](_0x4dd9('0x5d'),_0x99c9f5+'%');_0x5cb468['or'](_0x4dd9('0x5e'),_0x99c9f5+'%');}else if(qs[_0x4dd9('0x5f')](_0x99c9f5)){_0x5cb468['or'](_0x4dd9('0x60'),_0x99c9f5+'%');}else{_0x5cb468['or'](_0x4dd9('0x61'),'%'+_0x99c9f5+'%');_0x5cb468['or'](_0x4dd9('0x62'),'%'+_0x99c9f5+'%');_0x5cb468['or'](_0x4dd9('0x60'),'%'+_0x99c9f5+'%');}}}}_0x1ce65a[_0x4dd9('0x31')](_0x5cb468);_0x1ce65a[_0x4dd9('0x63')]('c.id');var _0x2cb407={'type':db['Sequelize'][_0x4dd9('0x64')][_0x4dd9('0x65')],'raw':!![]};var _0x39988b=_0x1ce65a[_0x4dd9('0x66')]()[_0x4dd9('0x34')]('c.id');if(_0x38819e[_0x4dd9('0x2f')]){_0x38819e[_0x4dd9('0x2f')]['forEach'](function(_0xaa4687){_0x1ce65a['order']('c.'+_0xaa4687[0x0],_0xaa4687[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4dd9('0x50')](_0x5b196a)){_0x1ce65a[_0x4dd9('0x67')](_0x316fab);_0x39988b['where']('t.id\x20IN\x20?',_0x5b196a);}BPromise[_0x4dd9('0x68')]()[_0x4dd9('0x16')](function(){if(!_0x4b6ef1)return;if(_0x26f9e7['user'][_0x4dd9('0x69')]!=='agent')return;if(!_[_0x4dd9('0x6a')](_0x4b6ef1['conditions'],[_0x4dd9('0x34'),_0x4dd9('0x47')])){return _0x26f9e7['user'][_0x4dd9('0x6b')]({'attributes':['id'],'raw':!![]})[_0x4dd9('0x16')](function(_0x386517){if(_[_0x4dd9('0x50')](_0x386517)){_0x39988b[_0x4dd9('0x31')](_0x4dd9('0x6c'));_0x1ce65a[_0x4dd9('0x31')](_0x4dd9('0x6c'));}else{_0x39988b[_0x4dd9('0x31')](_0x4dd9('0x51'),_[_0x4dd9('0x44')](_0x386517,'id'));_0x1ce65a[_0x4dd9('0x31')](_0x4dd9('0x51'),_[_0x4dd9('0x44')](_0x386517,'id'));}});}})[_0x4dd9('0x16')](function(){if(_0x26f9e7[_0x4dd9('0x6d')][_0x4dd9('0x69')]===_0x4dd9('0x6e')&&!_0x4b6ef1&&!_0x26f9e7[_0x4dd9('0x27')]['ListId'])return[];return db['sequelize'][_0x4dd9('0x27')](_0x39988b[_0x4dd9('0x6f')](),_0x2cb407);})[_0x4dd9('0x16')](function(_0x1bb4d7){_0x5cab6f[_0x4dd9('0x14')]=_0x1bb4d7[_0x4dd9('0x1f')];if(_0x5cab6f[_0x4dd9('0x14')]===0x0)return[];return db[_0x4dd9('0x70')]['query'](_0x3e80a3[_0x4dd9('0x6f')](),_0x2cb407)[_0x4dd9('0x16')](function(_0x528ab0){_0x16b873=_[_0x4dd9('0x71')](_0x528ab0,'id');_0x2cb407=_[_0x4dd9('0x72')](_0x2cb407,{'model':db[_0x4dd9('0x1c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x26f9e7[_0x4dd9('0x27')][_0x4dd9('0x2b')]){_0x38819e[_0x4dd9('0x29')][_0x4dd9('0x45')](function(_0x3d229f){_0x1ce65a[_0x4dd9('0x34')]('c.'+_0x3d229f);});}else{_0x1ce65a[_0x4dd9('0x34')](_0x4dd9('0x73'));_0x1ce65a[_0x4dd9('0x34')]('c.firstName');_0x1ce65a[_0x4dd9('0x34')](_0x4dd9('0x74'));_0x1ce65a['field'](_0x4dd9('0x75'));_0x1ce65a['field'](_0x4dd9('0x76'));_0x1ce65a[_0x4dd9('0x34')]('c.fax');_0x1ce65a[_0x4dd9('0x34')](_0x4dd9('0x77'));_0x1ce65a[_0x4dd9('0x34')](_0x4dd9('0x78'));_0x1ce65a['field'](_0x4dd9('0x79'));_0x1ce65a[_0x4dd9('0x34')]('c.deletedAt');_0x1ce65a[_0x4dd9('0x34')](_0x4dd9('0x7a'));_0x1ce65a[_0x4dd9('0x34')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4dd9('0x7b'));}if(_0x38819e[_0x4dd9('0x2e')])_0x1ce65a[_0x4dd9('0x2e')](_0x38819e[_0x4dd9('0x2e')]);if(_0x38819e[_0x4dd9('0x12')])_0x1ce65a[_0x4dd9('0x12')](_0x38819e[_0x4dd9('0x12')]);return db[_0x4dd9('0x70')]['query'](_0x1ce65a[_0x4dd9('0x6f')](),_0x2cb407);});})[_0x4dd9('0x16')](function(_0x24ccce){_0x24ccce[_0x4dd9('0x45')](function(_0x20dd81){if(_0x20dd81[_0x4dd9('0x7b')]){_0x20dd81[_0x4dd9('0x7c')]=[];_0x20dd81['TagIds'][_0x4dd9('0x43')](',')[_0x4dd9('0x45')](function(_0x242fb9){_0x20dd81[_0x4dd9('0x7c')][_0x4dd9('0x7d')](_0x16b873[_0x242fb9]);});}delete _0x20dd81[_0x4dd9('0x7b')];});_0x5cab6f[_0x4dd9('0x7e')]=_0x24ccce;return _0x5cab6f;})[_0x4dd9('0x16')](respondWithFilteredResult(_0x1b7fcd,_0x38819e));})[_0x4dd9('0x7f')](handleError(_0x1b7fcd,null));};exports['destroy']=function(_0x50b4a8,_0x5218e9){return db[_0x4dd9('0x1c')][_0x4dd9('0x80')]({'where':{'id':_0x50b4a8[_0x4dd9('0x81')]['id']}})[_0x4dd9('0x16')](handleEntityNotFound(_0x5218e9,null))[_0x4dd9('0x16')](removeEntity(_0x5218e9,null))['catch'](handleError(_0x5218e9,null));};exports['describe']=function(_0x39e2df,_0x4ebcd2){return db[_0x4dd9('0x1c')]['describe']()[_0x4dd9('0x16')](function(_0x3a09db){delete _0x3a09db['tags'];for(var _0x990744=0x0;_0x990744=_0x493a3c){_0x398c9e=_0x493a3c;_0x4bd54e=0xc8;}else{_0x4bd54e=0xce;}_0x40d6be['status'](_0x4bd54e);return _0x40d6be['set'](_0x79b8('0xf'),_0x1b131d+'-'+_0x398c9e+'/'+_0x493a3c)[_0x79b8('0xa')](_0x7b7381);}return null;};}function saveUpdates(_0x115938){return function(_0x39cbd3){if(_0x39cbd3){return _0x39cbd3[_0x79b8('0x10')](_0x115938)[_0x79b8('0x11')](function(_0x426a09){return _0x426a09;});}return null;};}function removeEntity(_0x3a01a8){return function(_0x373213){if(_0x373213){return _0x373213[_0x79b8('0x12')]()['then'](function(){_0x3a01a8[_0x79b8('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31cda6){return function(_0x40ebe0){if(!_0x40ebe0){_0x31cda6[_0x79b8('0x13')](0x194);}return _0x40ebe0;};}function handleError(_0x5f0dee,_0x405131){_0x405131=_0x405131||0x1f4;return function(_0x40cddd){logger[_0x79b8('0x14')](_0x40cddd[_0x79b8('0x15')]);if(_0x40cddd[_0x79b8('0x16')]){delete _0x40cddd[_0x79b8('0x16')];}_0x5f0dee['status'](_0x405131)[_0x79b8('0x17')](_0x40cddd);};}exports[_0x79b8('0x18')]=function(_0x4db3bd,_0x26c482){var _0x58480b={},_0x325fb9={},_0xba9470={'count':0x0,'rows':[]};return db[_0x79b8('0x19')][_0x79b8('0x1a')]()[_0x79b8('0x11')](function(_0x418be5){var _0x2a1b08=[];for(var _0x2c3733=0x0;_0x2c37330x1){_0xbc56e6['or'](_0x79b8('0x56'),qs[_0x79b8('0x57')](_0x58d1f4),null);}else{if(qs[_0x79b8('0x58')](_0x58d1f4)){_0xbc56e6['or'](_0x79b8('0x59'),_0x58d1f4+'%');_0xbc56e6['or'](_0x79b8('0x5a'),_0x58d1f4+'%');_0xbc56e6['or'](_0x79b8('0x5b'),_0x58d1f4+'%');_0xbc56e6['or']('c.fax\x20LIKE\x20?',_0x58d1f4+'%');}else if(qs[_0x79b8('0x5c')](_0x58d1f4)){_0xbc56e6['or']('c.email\x20LIKE\x20?',_0x58d1f4+'%');}else{_0xbc56e6['or'](_0x79b8('0x5d'),'%'+_0x58d1f4+'%');_0xbc56e6['or'](_0x79b8('0x5e'),'%'+_0x58d1f4+'%');_0xbc56e6['or'](_0x79b8('0x5f'),'%'+_0x58d1f4+'%');}}}}_0x47604e[_0x79b8('0x2c')](_0xbc56e6);_0x47604e[_0x79b8('0x60')]('c.id');var _0x395234={'type':db[_0x79b8('0x61')]['QueryTypes'][_0x79b8('0x62')],'raw':!![]};var _0x144ff1=_0x47604e[_0x79b8('0x63')]()[_0x79b8('0x2f')](_0x79b8('0x64'));if(_0x58480b[_0x79b8('0x65')]){_0x58480b['order']['forEach'](function(_0x3bb409){_0x47604e['order']('c.'+_0x3bb409[0x0],_0x3bb409[0x1]===_0x79b8('0x66')?![]:!![]);});}if(!_['isEmpty'](_0x14db32)){_0x47604e[_0x79b8('0x67')](_0x29f922);_0x144ff1[_0x79b8('0x2c')](_0x79b8('0x68'),_0x14db32);}BPromise[_0x79b8('0x69')]()[_0x79b8('0x11')](function(){if(!_0x42d40e)return;if(_0x4db3bd[_0x79b8('0x6a')][_0x79b8('0x6b')]!==_0x79b8('0x6c'))return;if(!_['some'](_0x42d40e[_0x79b8('0x3d')],[_0x79b8('0x2f'),_0x79b8('0x44')])){return _0x4db3bd[_0x79b8('0x6a')][_0x79b8('0x6d')]({'attributes':['id'],'raw':!![]})[_0x79b8('0x11')](function(_0x2b6e9a){if(_[_0x79b8('0x6e')](_0x2b6e9a)){_0x144ff1[_0x79b8('0x2c')](_0x79b8('0x6f'));_0x47604e[_0x79b8('0x2c')](_0x79b8('0x6f'));}else{_0x144ff1[_0x79b8('0x2c')](_0x79b8('0x4f'),_[_0x79b8('0x41')](_0x2b6e9a,'id'));_0x47604e['where'](_0x79b8('0x4f'),_[_0x79b8('0x41')](_0x2b6e9a,'id'));}});}})['then'](function(){if(_0x4db3bd[_0x79b8('0x6a')][_0x79b8('0x6b')]===_0x79b8('0x6c')&&!_0x42d40e&&!_0x4db3bd['query'][_0x79b8('0x70')])return[];return db[_0x79b8('0x71')][_0x79b8('0x24')](_0x144ff1['toString'](),_0x395234);})[_0x79b8('0x11')](function(_0x6cb086){_0xba9470['count']=_0x6cb086[_0x79b8('0x1c')];if(_0xba9470[_0x79b8('0xe')]===0x0)return[];return db[_0x79b8('0x71')]['query'](_0x36d4a2['toString'](),_0x395234)['then'](function(_0x19abb0){_0x548dcc=_[_0x79b8('0x72')](_0x19abb0,'id');_0x395234=_[_0x79b8('0x73')](_0x395234,{'model':db[_0x79b8('0x19')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4db3bd[_0x79b8('0x24')]['fields']){_0x58480b[_0x79b8('0x29')]['forEach'](function(_0x296b1c){_0x47604e['field']('c.'+_0x296b1c);});}else{_0x47604e[_0x79b8('0x2f')](_0x79b8('0x64'));_0x47604e[_0x79b8('0x2f')](_0x79b8('0x74'));_0x47604e['field'](_0x79b8('0x75'));_0x47604e['field']('c.phone');_0x47604e[_0x79b8('0x2f')](_0x79b8('0x76'));_0x47604e[_0x79b8('0x2f')](_0x79b8('0x77'));_0x47604e['field']('c.email');_0x47604e['field'](_0x79b8('0x78'));_0x47604e[_0x79b8('0x2f')]('c.createdAt');_0x47604e[_0x79b8('0x2f')](_0x79b8('0x79'));_0x47604e[_0x79b8('0x2f')](_0x79b8('0x7a'));_0x47604e[_0x79b8('0x2f')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x58480b[_0x79b8('0xd')])_0x47604e[_0x79b8('0xd')](_0x58480b[_0x79b8('0xd')]);if(_0x58480b['offset'])_0x47604e['offset'](_0x58480b[_0x79b8('0xb')]);return db[_0x79b8('0x71')]['query'](_0x47604e[_0x79b8('0x7b')](),_0x395234);});})[_0x79b8('0x11')](function(_0x25d8a8){_0x25d8a8['forEach'](function(_0x554d61){if(_0x554d61[_0x79b8('0x7c')]){_0x554d61[_0x79b8('0x7d')]=[];_0x554d61[_0x79b8('0x7c')][_0x79b8('0x40')](',')[_0x79b8('0x42')](function(_0x517dc3){_0x554d61[_0x79b8('0x7d')][_0x79b8('0x1e')](_0x548dcc[_0x517dc3]);});}delete _0x554d61['TagIds'];});_0xba9470[_0x79b8('0x7e')]=_0x25d8a8;return _0xba9470;})[_0x79b8('0x11')](respondWithFilteredResult(_0x26c482,_0x58480b));})[_0x79b8('0x7f')](handleError(_0x26c482,null));};exports['destroy']=function(_0x9f6734,_0x1f6d9d){return db[_0x79b8('0x19')][_0x79b8('0x3e')]({'where':{'id':_0x9f6734[_0x79b8('0x80')]['id']}})[_0x79b8('0x11')](handleEntityNotFound(_0x1f6d9d,null))[_0x79b8('0x11')](removeEntity(_0x1f6d9d,null))['catch'](handleError(_0x1f6d9d,null));};exports[_0x79b8('0x1a')]=function(_0x412813,_0x3ff97a){return db[_0x79b8('0x19')][_0x79b8('0x1a')]()[_0x79b8('0x11')](function(_0x48475d){delete _0x48475d['tags'];for(var _0x2c8971=0x0;_0x2c8971{}\s\\|]/g,'-');_0x27eb4e(null,util['format'](_0xeb85('0x23'),path[_0xeb85('0x24')](_0x216cb8[_0xeb85('0x21')],path[_0xeb85('0x25')](_0x216cb8[_0xeb85('0x21')])),Date['now'](),path['extname'](_0x216cb8[_0xeb85('0x21')])));}})});router[_0xeb85('0x18')](_0xeb85('0x26'),upload[_0xeb85('0x27')](_0xeb85('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xeb85('0x1f')]({'destination':function(_0x1b30cb,_0xb6bc2d,_0x3d90a1){_0x3d90a1(null,path[_0xeb85('0x29')](config[_0xeb85('0x2a')],_0xeb85('0x20')));},'filename':function(_0x19b2ae,_0xdccf8f,_0x4e1262){_0xdccf8f[_0xeb85('0x21')]=_0xdccf8f[_0xeb85('0x21')][_0xeb85('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e1262(null,util[_0xeb85('0x2b')]('%s-%s%s',path[_0xeb85('0x24')](_0xdccf8f['originalname'],path[_0xeb85('0x25')](_0xdccf8f[_0xeb85('0x21')])),Date[_0xeb85('0x2c')](),path['extname'](_0xdccf8f[_0xeb85('0x21')])));}})});router['post'](_0xeb85('0x2d'),upload[_0xeb85('0x27')]('file'),controller[_0xeb85('0x2e')]);router[_0xeb85('0x18')]('/upload/:id',auth['isAuthenticated'](),controller[_0xeb85('0x2f')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xeb85('0x30')]);router[_0xeb85('0x31')](_0xeb85('0xe'),auth[_0xeb85('0xb')](),controller[_0xeb85('0x32')]);module[_0xeb85('0x33')]=router; \ No newline at end of file +var _0x480c=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getTags','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/journey','post','merge','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','now','/csv','/upload','single','file','/upload/:id','import','update'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x480c,0x18a));var _0xc480=function(_0x57ba65,_0x4f0586){_0x57ba65=_0x57ba65-0x0;var _0x32f634=_0x480c[_0x57ba65];return _0x32f634;};'use strict';var multer=require(_0xc480('0x0'));var util=require(_0xc480('0x1'));var path=require('path');var timeout=require(_0xc480('0x2'));var express=require(_0xc480('0x3'));var router=express[_0xc480('0x4')]();var fs_extra=require(_0xc480('0x5'));var auth=require(_0xc480('0x6'));var interaction=require(_0xc480('0x7'));var config=require(_0xc480('0x8'));var controller=require(_0xc480('0x9'));router[_0xc480('0xa')]('/',auth[_0xc480('0xb')](),controller[_0xc480('0xc')]);router[_0xc480('0xa')](_0xc480('0xd'),auth[_0xc480('0xb')](),controller[_0xc480('0xe')]);router[_0xc480('0xa')](_0xc480('0xf'),auth[_0xc480('0xb')](),controller[_0xc480('0x10')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0xc480('0x11')]);router[_0xc480('0xa')](_0xc480('0x12'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xc480('0xa')](_0xc480('0x13'),auth[_0xc480('0xb')](),controller['getHopperHistories']);router['get'](_0xc480('0x14'),auth[_0xc480('0xb')](),controller[_0xc480('0x15')]);router[_0xc480('0xa')]('/:id/jscripty_sessions',auth['isAuthenticated'](),controller['getJscriptySessions']);router['get'](_0xc480('0x16'),auth[_0xc480('0xb')](),controller['getJourney']);router[_0xc480('0x17')]('/merge',auth['isAuthenticated'](),controller[_0xc480('0x18')]);router[_0xc480('0x17')]('/',auth[_0xc480('0xb')](),controller[_0xc480('0x19')]);router[_0xc480('0x17')](_0xc480('0x1a'),auth[_0xc480('0xb')](),controller[_0xc480('0x1b')]);router['post'](_0xc480('0x1c'),auth[_0xc480('0xb')](),controller[_0xc480('0x1d')]);var upload=multer({'storage':multer[_0xc480('0x1e')]({'destination':function(_0x5da73b,_0x47a6e1,_0x5a4488){_0x5a4488(null,path[_0xc480('0x1f')](config[_0xc480('0x20')],_0xc480('0x21')));},'filename':function(_0x52b586,_0x3ff7a5,_0x433bb1){_0x3ff7a5['originalname']=_0x3ff7a5[_0xc480('0x22')][_0xc480('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x433bb1(null,util['format'](_0xc480('0x24'),path[_0xc480('0x25')](_0x3ff7a5[_0xc480('0x22')],path[_0xc480('0x26')](_0x3ff7a5[_0xc480('0x22')])),Date[_0xc480('0x27')](),path[_0xc480('0x26')](_0x3ff7a5[_0xc480('0x22')])));}})});router[_0xc480('0x17')](_0xc480('0x28'),upload['single']('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0xc480('0x1e')]({'destination':function(_0x3960ff,_0x4e4ebc,_0x566f38){_0x566f38(null,path[_0xc480('0x1f')](config[_0xc480('0x20')],'server/files/tmp'));},'filename':function(_0x2ee521,_0x2e0845,_0x185870){_0x2e0845['originalname']=_0x2e0845[_0xc480('0x22')][_0xc480('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x185870(null,util['format']('%s-%s%s',path[_0xc480('0x25')](_0x2e0845[_0xc480('0x22')],path[_0xc480('0x26')](_0x2e0845[_0xc480('0x22')])),Date[_0xc480('0x27')](),path['extname'](_0x2e0845['originalname'])));}})});router[_0xc480('0x17')](_0xc480('0x29'),upload[_0xc480('0x2a')](_0xc480('0x2b')),controller['upload']);router[_0xc480('0x17')](_0xc480('0x2c'),auth[_0xc480('0xb')](),controller[_0xc480('0x2d')]);router['put'](_0xc480('0xf'),auth['isAuthenticated'](),controller[_0xc480('0x2e')]);router['delete'](_0xc480('0xf'),auth[_0xc480('0xb')](),controller[_0xc480('0x2f')]);module[_0xc480('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index dea4939..e2b48c8 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 _0x8493=['ENUM','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','long','type','select','parse','values','isArray','stringify','BOOLEAN'];(function(_0x44754b,_0x2122d5){var _0x532cd1=function(_0x1679af){while(--_0x1679af){_0x44754b['push'](_0x44754b['shift']());}};_0x532cd1(++_0x2122d5);}(_0x8493,0x1a1));var _0x3849=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x8493[_0xcfd89f];return _0x59acd4;};'use strict';var Sequelize=require(_0x3849('0x0'));var _=require('lodash');module[_0x3849('0x1')]={'name':{'type':Sequelize[_0x3849('0x2')],'get':function(_0x8ffcc2){return this[_0x3849('0x3')](_0x3849('0x4'));}},'alias':{'type':Sequelize[_0x3849('0x5')],'allowNull':![],'set':function(_0x5bb2c3){this[_0x3849('0x6')](_0x3849('0x4'),_0x5bb2c3?_0x5bb2c3:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x3849('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x3849('0x7')),'get':function(){if(this[_0x3849('0x3')](_0x3849('0x8'))===_0x3849('0x9')){return JSON[_0x3849('0xa')](this[_0x3849('0x3')](_0x3849('0xb')));}else{return this[_0x3849('0x3')](_0x3849('0xb'));}},'set':function(_0x38cd3b){if(Array[_0x3849('0xc')](_0x38cd3b)){this['setDataValue'](_0x3849('0xb'),JSON[_0x3849('0xd')](_0x38cd3b));}else{this['setDataValue'](_0x3849('0xb'),_0x38cd3b);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3849('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3849('0xf')]('voice')}}; \ No newline at end of file +var _0x76a5=['parse','values','isArray','stringify','BOOLEAN','voice','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select'];(function(_0x3e0fce,_0x4141a1){var _0x108721=function(_0x3a8892){while(--_0x3a8892){_0x3e0fce['push'](_0x3e0fce['shift']());}};_0x108721(++_0x4141a1);}(_0x76a5,0xa6));var _0x576a=function(_0x5cf3d7,_0x26611b){_0x5cf3d7=_0x5cf3d7-0x0;var _0x318db5=_0x76a5[_0x5cf3d7];return _0x318db5;};'use strict';var Sequelize=require('sequelize');var _=require(_0x576a('0x0'));module['exports']={'name':{'type':Sequelize[_0x576a('0x1')],'get':function(_0x4bddba){return this[_0x576a('0x2')](_0x576a('0x3'));}},'alias':{'type':Sequelize[_0x576a('0x4')],'allowNull':![],'set':function(_0x47e46f){this[_0x576a('0x5')](_0x576a('0x3'),_0x47e46f?_0x47e46f:this[_0x576a('0x2')](_0x576a('0x6')));}},'type':{'type':Sequelize[_0x576a('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x576a('0x7')](_0x576a('0x8')),'get':function(){if(this[_0x576a('0x2')]('type')===_0x576a('0x9')){return JSON[_0x576a('0xa')](this[_0x576a('0x2')](_0x576a('0xb')));}else{return this[_0x576a('0x2')]('values');}},'set':function(_0x335afe){if(Array[_0x576a('0xc')](_0x335afe)){this[_0x576a('0x5')](_0x576a('0xb'),JSON[_0x576a('0xd')](_0x335afe));}else{this['setDataValue'](_0x576a('0xb'),_0x335afe);}}},'required':{'type':Sequelize[_0x576a('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x576a('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 890f1c8..d033932 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 _0x9dc6=['include','findAll','catch','show','CmCustomField','find','body','params','sequelize','transaction','create','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','cf_%d','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll'];(function(_0x122f8a,_0xed3e13){var _0x26098c=function(_0x45431f){while(--_0x45431f){_0x122f8a['push'](_0x122f8a['shift']());}};_0x26098c(++_0xed3e13);}(_0x9dc6,0x1ce));var _0x69dc=function(_0x5642d3,_0x579f35){_0x5642d3=_0x5642d3-0x0;var _0x34beca=_0x9dc6[_0x5642d3];return _0x34beca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69dc('0x1'));var rp=require(_0x69dc('0x2'));var moment=require('moment');var BPromise=require(_0x69dc('0x3'));var Mustache=require(_0x69dc('0x4'));var util=require(_0x69dc('0x5'));var path=require(_0x69dc('0x6'));var sox=require(_0x69dc('0x7'));var csv=require(_0x69dc('0x8'));var ejs=require(_0x69dc('0x9'));var fs=require('fs');var fs_extra=require(_0x69dc('0xa'));var _=require(_0x69dc('0xb'));var squel=require(_0x69dc('0xc'));var crypto=require('crypto');var jsforce=require(_0x69dc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x69dc('0xe'));var Papa=require(_0x69dc('0xf'));var Redis=require(_0x69dc('0x10'));var authService=require(_0x69dc('0x11'));var qs=require(_0x69dc('0x12'));var as=require(_0x69dc('0x13'));var hardwareService=require(_0x69dc('0x14'));var logger=require(_0x69dc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x69dc('0x16'));var licenseUtil=require(_0x69dc('0x17'));var db=require(_0x69dc('0x18'))['db'];function respondWithStatusCode(_0x5cb3ce,_0x495b91){_0x495b91=_0x495b91||0xcc;return function(_0x31b184){if(_0x31b184){return _0x5cb3ce[_0x69dc('0x19')](_0x495b91);}return _0x5cb3ce['status'](_0x495b91)[_0x69dc('0x1a')]();};}function respondWithResult(_0x4610ef,_0x26a8a5){_0x26a8a5=_0x26a8a5||0xc8;return function(_0x490f12){if(_0x490f12){return _0x4610ef[_0x69dc('0x1b')](_0x26a8a5)[_0x69dc('0x1c')](_0x490f12);}};}function respondWithFilteredResult(_0x5cd73a,_0x4ac781){return function(_0x43fcb3){if(_0x43fcb3){var _0x1cd7e0=typeof _0x4ac781['offset']===_0x69dc('0x1d')&&typeof _0x4ac781[_0x69dc('0x1e')]===_0x69dc('0x1d');var _0x22968d=_0x43fcb3[_0x69dc('0x1f')];var _0x30afca=_0x1cd7e0?0x0:_0x4ac781['offset'];var _0x337d0d=_0x1cd7e0?_0x43fcb3[_0x69dc('0x1f')]:_0x4ac781[_0x69dc('0x20')]+_0x4ac781[_0x69dc('0x1e')];var _0x36d705;if(_0x337d0d>=_0x22968d){_0x337d0d=_0x22968d;_0x36d705=0xc8;}else{_0x36d705=0xce;}_0x5cd73a['status'](_0x36d705);return _0x5cd73a[_0x69dc('0x21')](_0x69dc('0x22'),_0x30afca+'-'+_0x337d0d+'/'+_0x22968d)[_0x69dc('0x1c')](_0x43fcb3);}return null;};}function patchUpdates(_0x8253c7){return function(_0x1a3368){try{jsonpatch['apply'](_0x1a3368,_0x8253c7,!![]);}catch(_0x272fc5){return BPromise[_0x69dc('0x23')](_0x272fc5);}return _0x1a3368[_0x69dc('0x24')]();};}function saveUpdates(_0x34e15d,_0x38955a){return function(_0x2c23a4){if(_0x2c23a4){return _0x2c23a4[_0x69dc('0x25')](_0x34e15d)[_0x69dc('0x26')](function(_0x55f73d){return _0x55f73d;});}return null;};}function removeEntity(_0x37deb8,_0x327707){return function(_0x1b3eed){if(_0x1b3eed){return _0x1b3eed[_0x69dc('0x27')]()[_0x69dc('0x26')](function(){_0x37deb8[_0x69dc('0x1b')](0xcc)[_0x69dc('0x1a')]();});}};}function handleEntityNotFound(_0xde27b7,_0x2dc3f7){return function(_0x1602af){if(!_0x1602af){_0xde27b7[_0x69dc('0x19')](0x194);}return _0x1602af;};}function handleError(_0x3f7af9,_0x522938){_0x522938=_0x522938||0x1f4;return function(_0x5e7b98){logger[_0x69dc('0x28')](_0x5e7b98[_0x69dc('0x29')]);if(_0x5e7b98[_0x69dc('0x2a')]){delete _0x5e7b98['name'];}_0x3f7af9[_0x69dc('0x1b')](_0x522938)[_0x69dc('0x2b')](_0x5e7b98);};}exports['index']=function(_0x3f25b0,_0x42b4ef){var _0x38df3b={},_0x145731={},_0xb6e857={'count':0x0,'rows':[]};var _0x322205=_[_0x69dc('0x2c')](db['CmCustomField'][_0x69dc('0x2d')],function(_0x4b5654){return{'name':_0x4b5654[_0x69dc('0x2e')],'type':_0x4b5654[_0x69dc('0x2f')][_0x69dc('0x30')]};});_0x145731['model']=_[_0x69dc('0x31')](_['map'](_0x322205,'name'),['name']);_0x145731[_0x69dc('0x32')]=_[_0x69dc('0x33')](_0x3f25b0[_0x69dc('0x32')]);_0x145731[_0x69dc('0x34')]=_[_0x69dc('0x35')](_0x145731[_0x69dc('0x36')],_0x145731[_0x69dc('0x32')]);_0x38df3b['attributes']=_[_0x69dc('0x35')](_0x145731['model'],qs[_0x69dc('0x37')](_0x3f25b0['query'][_0x69dc('0x37')]));_0x38df3b['attributes']=_0x38df3b[_0x69dc('0x38')][_0x69dc('0x39')]?_0x38df3b[_0x69dc('0x38')]:_0x145731[_0x69dc('0x36')];if(!_0x3f25b0[_0x69dc('0x32')][_0x69dc('0x3a')](_0x69dc('0x3b'))){_0x38df3b[_0x69dc('0x1e')]=qs[_0x69dc('0x1e')](_0x3f25b0[_0x69dc('0x32')]['limit']);_0x38df3b[_0x69dc('0x20')]=qs[_0x69dc('0x20')](_0x3f25b0[_0x69dc('0x32')][_0x69dc('0x20')]);}_0x38df3b['order']=qs[_0x69dc('0x3c')](_0x3f25b0[_0x69dc('0x32')][_0x69dc('0x3c')]);_0x38df3b[_0x69dc('0x3d')]=qs[_0x69dc('0x34')](_['pick'](_0x3f25b0['query'],_0x145731[_0x69dc('0x34')]),_0x322205);if(_0x3f25b0[_0x69dc('0x32')][_0x69dc('0x3e')]){_0x38df3b[_0x69dc('0x3d')]=_[_0x69dc('0x3f')](_0x38df3b[_0x69dc('0x3d')],{'$or':_[_0x69dc('0x2c')](_0x322205,function(_0x3683cc){if(_0x3683cc[_0x69dc('0x2f')]!=='VIRTUAL'){var _0x10e39d={};_0x10e39d[_0x3683cc[_0x69dc('0x2a')]]={'$like':'%'+_0x3f25b0[_0x69dc('0x32')][_0x69dc('0x3e')]+'%'};return _0x10e39d;}})});}_0x38df3b=_[_0x69dc('0x3f')]({},_0x38df3b,_0x3f25b0[_0x69dc('0x40')]);var _0x413dae={'where':_0x38df3b[_0x69dc('0x3d')]};return db['CmCustomField'][_0x69dc('0x1f')](_0x413dae)['then'](function(_0x3ece4f){_0xb6e857[_0x69dc('0x1f')]=_0x3ece4f;if(_0x3f25b0[_0x69dc('0x32')][_0x69dc('0x41')]){_0x38df3b[_0x69dc('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0x69dc('0x43')](_0x38df3b);})[_0x69dc('0x26')](function(_0x46fed1){_0xb6e857['rows']=_0x46fed1;return _0xb6e857;})[_0x69dc('0x26')](respondWithFilteredResult(_0x42b4ef,_0x38df3b))[_0x69dc('0x44')](handleError(_0x42b4ef,null));};exports[_0x69dc('0x45')]=function(_0x23bfb2,_0x4391dd){var _0x494c10={'raw':!![],'where':{'id':_0x23bfb2['params']['id']}},_0x1876f2={};_0x1876f2['model']=_[_0x69dc('0x33')](db['CmCustomField']['rawAttributes']);_0x1876f2[_0x69dc('0x32')]=_[_0x69dc('0x33')](_0x23bfb2['query']);_0x1876f2[_0x69dc('0x34')]=_[_0x69dc('0x35')](_0x1876f2[_0x69dc('0x36')],_0x1876f2['query']);_0x494c10[_0x69dc('0x38')]=_[_0x69dc('0x35')](_0x1876f2[_0x69dc('0x36')],qs[_0x69dc('0x37')](_0x23bfb2[_0x69dc('0x32')][_0x69dc('0x37')]));_0x494c10[_0x69dc('0x38')]=_0x494c10[_0x69dc('0x38')][_0x69dc('0x39')]?_0x494c10['attributes']:_0x1876f2[_0x69dc('0x36')];if(_0x23bfb2[_0x69dc('0x32')][_0x69dc('0x41')]){_0x494c10[_0x69dc('0x42')]=[{'all':!![]}];}_0x494c10=_[_0x69dc('0x3f')]({},_0x494c10,_0x23bfb2['options']);return db[_0x69dc('0x46')][_0x69dc('0x47')](_0x494c10)[_0x69dc('0x26')](handleEntityNotFound(_0x4391dd,null))[_0x69dc('0x26')](respondWithResult(_0x4391dd,null))[_0x69dc('0x44')](handleError(_0x4391dd,null));};exports['update']=function(_0xfbedc2,_0xe69347){if(_0xfbedc2[_0x69dc('0x48')]['id']){delete _0xfbedc2[_0x69dc('0x48')]['id'];}return db[_0x69dc('0x46')][_0x69dc('0x47')]({'where':{'id':_0xfbedc2['params']['id']}})[_0x69dc('0x26')](handleEntityNotFound(_0xe69347,null))[_0x69dc('0x26')](saveUpdates(_0xfbedc2['body'],null))[_0x69dc('0x26')](respondWithResult(_0xe69347,null))['catch'](handleError(_0xe69347,null));};exports[_0x69dc('0x27')]=function(_0x2f3f6b,_0x5f05f7){return db[_0x69dc('0x46')]['find']({'where':{'id':_0x2f3f6b[_0x69dc('0x49')]['id']}})[_0x69dc('0x26')](handleEntityNotFound(_0x5f05f7,null))[_0x69dc('0x26')](removeEntity(_0x5f05f7,null))[_0x69dc('0x44')](handleError(_0x5f05f7,null));};exports['create']=function(_0xe2965b,_0x115820){var _0x6718f3;return db[_0x69dc('0x4a')][_0x69dc('0x4b')](function(_0x24b1d2){return db[_0x69dc('0x46')][_0x69dc('0x4c')](_0xe2965b[_0x69dc('0x48')],{'transaction':_0x24b1d2})[_0x69dc('0x26')](function(_0x2c824f){_0x6718f3=_0x2c824f;var _0x23e186={'type':db['Sequelize'][_0x69dc('0x4d')],'transaction':_0x24b1d2};switch(_0xe2965b[_0x69dc('0x48')][_0x69dc('0x2f')]){case _0x69dc('0x4e'):_0x23e186[_0x69dc('0x2f')]=db[_0x69dc('0x4f')][_0x69dc('0x4d')];break;case _0x69dc('0x50'):_0x23e186[_0x69dc('0x2f')]=db[_0x69dc('0x4f')][_0x69dc('0x51')];break;case _0x69dc('0x52'):_0x23e186[_0x69dc('0x2f')]=db[_0x69dc('0x4f')]['BOOLEAN'];_0x23e186[_0x69dc('0x53')]=![];break;default:}return db[_0x69dc('0x4a')][_0x69dc('0x54')]['addColumn'](_0x69dc('0x55'),util[_0x69dc('0x56')](_0x69dc('0x57'),_0x6718f3['id']),_0x23e186);})['then'](function(){return _0x6718f3;});})[_0x69dc('0x26')](respondWithResult(_0x115820,0xc9))[_0x69dc('0x44')](handleError(_0x115820,null));}; \ No newline at end of file +var _0x3948=['stack','name','map','CmCustomField','fieldName','type','model','differenceBy','query','keys','filters','attributes','length','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','fields','find','update','body','create','sequelize','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error'];(function(_0xffa1cd,_0x533c8c){var _0x231e13=function(_0x16db54){while(--_0x16db54){_0xffa1cd['push'](_0xffa1cd['shift']());}};_0x231e13(++_0x533c8c);}(_0x3948,0x1c6));var _0x8394=function(_0x52a2a4,_0x58dbb3){_0x52a2a4=_0x52a2a4-0x0;var _0x50c4f1=_0x3948[_0x52a2a4];return _0x50c4f1;};'use strict';var emlformat=require(_0x8394('0x0'));var rimraf=require(_0x8394('0x1'));var zipdir=require(_0x8394('0x2'));var jsonpatch=require(_0x8394('0x3'));var rp=require(_0x8394('0x4'));var moment=require(_0x8394('0x5'));var BPromise=require(_0x8394('0x6'));var Mustache=require('mustache');var util=require(_0x8394('0x7'));var path=require(_0x8394('0x8'));var sox=require(_0x8394('0x9'));var csv=require('to-csv');var ejs=require(_0x8394('0xa'));var fs=require('fs');var fs_extra=require(_0x8394('0xb'));var _=require(_0x8394('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8394('0xd'));var Papa=require('papaparse');var Redis=require(_0x8394('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8394('0xf'));var as=require(_0x8394('0x10'));var hardwareService=require(_0x8394('0x11'));var logger=require(_0x8394('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x8394('0x13'));var licenseUtil=require(_0x8394('0x14'));var db=require(_0x8394('0x15'))['db'];function respondWithStatusCode(_0x86f91d,_0x1ef6af){_0x1ef6af=_0x1ef6af||0xcc;return function(_0x22ae19){if(_0x22ae19){return _0x86f91d[_0x8394('0x16')](_0x1ef6af);}return _0x86f91d[_0x8394('0x17')](_0x1ef6af)[_0x8394('0x18')]();};}function respondWithResult(_0x402b00,_0x33f244){_0x33f244=_0x33f244||0xc8;return function(_0x114a09){if(_0x114a09){return _0x402b00[_0x8394('0x17')](_0x33f244)['json'](_0x114a09);}};}function respondWithFilteredResult(_0x187254,_0x1227b5){return function(_0x34c367){if(_0x34c367){var _0x24b772=typeof _0x1227b5['offset']===_0x8394('0x19')&&typeof _0x1227b5[_0x8394('0x1a')]===_0x8394('0x19');var _0x39ddef=_0x34c367[_0x8394('0x1b')];var _0x4b7619=_0x24b772?0x0:_0x1227b5[_0x8394('0x1c')];var _0x2b3b39=_0x24b772?_0x34c367['count']:_0x1227b5[_0x8394('0x1c')]+_0x1227b5['limit'];var _0x5bb2f6;if(_0x2b3b39>=_0x39ddef){_0x2b3b39=_0x39ddef;_0x5bb2f6=0xc8;}else{_0x5bb2f6=0xce;}_0x187254[_0x8394('0x17')](_0x5bb2f6);return _0x187254[_0x8394('0x1d')](_0x8394('0x1e'),_0x4b7619+'-'+_0x2b3b39+'/'+_0x39ddef)[_0x8394('0x1f')](_0x34c367);}return null;};}function patchUpdates(_0x22df5e){return function(_0x2d6ad0){try{jsonpatch[_0x8394('0x20')](_0x2d6ad0,_0x22df5e,!![]);}catch(_0x1c80ba){return BPromise[_0x8394('0x21')](_0x1c80ba);}return _0x2d6ad0[_0x8394('0x22')]();};}function saveUpdates(_0x4a7249,_0x249f24){return function(_0x273d0f){if(_0x273d0f){return _0x273d0f['update'](_0x4a7249)[_0x8394('0x23')](function(_0x433f27){return _0x433f27;});}return null;};}function removeEntity(_0x1f8702,_0x407775){return function(_0x356b16){if(_0x356b16){return _0x356b16[_0x8394('0x24')]()[_0x8394('0x23')](function(){_0x1f8702[_0x8394('0x17')](0xcc)[_0x8394('0x18')]();});}};}function handleEntityNotFound(_0x4d855c,_0x2608fd){return function(_0x50fd82){if(!_0x50fd82){_0x4d855c[_0x8394('0x16')](0x194);}return _0x50fd82;};}function handleError(_0x3a8926,_0x4a068b){_0x4a068b=_0x4a068b||0x1f4;return function(_0x1f9c37){logger[_0x8394('0x25')](_0x1f9c37[_0x8394('0x26')]);if(_0x1f9c37[_0x8394('0x27')]){delete _0x1f9c37[_0x8394('0x27')];}_0x3a8926[_0x8394('0x17')](_0x4a068b)['send'](_0x1f9c37);};}exports['index']=function(_0x2eb0dd,_0x31c8fb){var _0x5c0dd2={},_0x1d25c0={},_0x33087b={'count':0x0,'rows':[]};var _0x1933b4=_[_0x8394('0x28')](db[_0x8394('0x29')]['rawAttributes'],function(_0x4b3d14){return{'name':_0x4b3d14[_0x8394('0x2a')],'type':_0x4b3d14[_0x8394('0x2b')]['key']};});_0x1d25c0[_0x8394('0x2c')]=_[_0x8394('0x2d')](_['map'](_0x1933b4,_0x8394('0x27')),[_0x8394('0x27')]);_0x1d25c0[_0x8394('0x2e')]=_[_0x8394('0x2f')](_0x2eb0dd[_0x8394('0x2e')]);_0x1d25c0[_0x8394('0x30')]=_['intersection'](_0x1d25c0[_0x8394('0x2c')],_0x1d25c0[_0x8394('0x2e')]);_0x5c0dd2[_0x8394('0x31')]=_['intersection'](_0x1d25c0['model'],qs['fields'](_0x2eb0dd[_0x8394('0x2e')]['fields']));_0x5c0dd2['attributes']=_0x5c0dd2[_0x8394('0x31')][_0x8394('0x32')]?_0x5c0dd2[_0x8394('0x31')]:_0x1d25c0[_0x8394('0x2c')];if(!_0x2eb0dd['query']['hasOwnProperty']('nolimit')){_0x5c0dd2[_0x8394('0x1a')]=qs[_0x8394('0x1a')](_0x2eb0dd['query']['limit']);_0x5c0dd2[_0x8394('0x1c')]=qs[_0x8394('0x1c')](_0x2eb0dd['query'][_0x8394('0x1c')]);}_0x5c0dd2['order']=qs[_0x8394('0x33')](_0x2eb0dd[_0x8394('0x2e')]['sort']);_0x5c0dd2[_0x8394('0x34')]=qs['filters'](_['pick'](_0x2eb0dd[_0x8394('0x2e')],_0x1d25c0[_0x8394('0x30')]),_0x1933b4);if(_0x2eb0dd[_0x8394('0x2e')][_0x8394('0x35')]){_0x5c0dd2[_0x8394('0x34')]=_[_0x8394('0x36')](_0x5c0dd2[_0x8394('0x34')],{'$or':_['map'](_0x1933b4,function(_0xff1e53){if(_0xff1e53[_0x8394('0x2b')]!=='VIRTUAL'){var _0x32ba1c={};_0x32ba1c[_0xff1e53['name']]={'$like':'%'+_0x2eb0dd[_0x8394('0x2e')][_0x8394('0x35')]+'%'};return _0x32ba1c;}})});}_0x5c0dd2=_[_0x8394('0x36')]({},_0x5c0dd2,_0x2eb0dd[_0x8394('0x37')]);var _0xa6b2dc={'where':_0x5c0dd2['where']};return db[_0x8394('0x29')][_0x8394('0x1b')](_0xa6b2dc)[_0x8394('0x23')](function(_0x4cfa6f){_0x33087b[_0x8394('0x1b')]=_0x4cfa6f;if(_0x2eb0dd['query'][_0x8394('0x38')]){_0x5c0dd2[_0x8394('0x39')]=[{'all':!![]}];}return db[_0x8394('0x29')][_0x8394('0x3a')](_0x5c0dd2);})[_0x8394('0x23')](function(_0x471ed5){_0x33087b['rows']=_0x471ed5;return _0x33087b;})[_0x8394('0x23')](respondWithFilteredResult(_0x31c8fb,_0x5c0dd2))[_0x8394('0x3b')](handleError(_0x31c8fb,null));};exports[_0x8394('0x3c')]=function(_0x1e58f4,_0x499557){var _0x111fba={'raw':!![],'where':{'id':_0x1e58f4[_0x8394('0x3d')]['id']}},_0x1e1586={};_0x1e1586[_0x8394('0x2c')]=_[_0x8394('0x2f')](db[_0x8394('0x29')][_0x8394('0x3e')]);_0x1e1586['query']=_[_0x8394('0x2f')](_0x1e58f4[_0x8394('0x2e')]);_0x1e1586[_0x8394('0x30')]=_[_0x8394('0x3f')](_0x1e1586[_0x8394('0x2c')],_0x1e1586[_0x8394('0x2e')]);_0x111fba[_0x8394('0x31')]=_[_0x8394('0x3f')](_0x1e1586[_0x8394('0x2c')],qs[_0x8394('0x40')](_0x1e58f4['query'][_0x8394('0x40')]));_0x111fba[_0x8394('0x31')]=_0x111fba[_0x8394('0x31')][_0x8394('0x32')]?_0x111fba[_0x8394('0x31')]:_0x1e1586['model'];if(_0x1e58f4[_0x8394('0x2e')]['includeAll']){_0x111fba[_0x8394('0x39')]=[{'all':!![]}];}_0x111fba=_[_0x8394('0x36')]({},_0x111fba,_0x1e58f4[_0x8394('0x37')]);return db[_0x8394('0x29')][_0x8394('0x41')](_0x111fba)[_0x8394('0x23')](handleEntityNotFound(_0x499557,null))[_0x8394('0x23')](respondWithResult(_0x499557,null))['catch'](handleError(_0x499557,null));};exports[_0x8394('0x42')]=function(_0x15e2d1,_0x515145){if(_0x15e2d1['body']['id']){delete _0x15e2d1[_0x8394('0x43')]['id'];}return db[_0x8394('0x29')][_0x8394('0x41')]({'where':{'id':_0x15e2d1[_0x8394('0x3d')]['id']}})[_0x8394('0x23')](handleEntityNotFound(_0x515145,null))[_0x8394('0x23')](saveUpdates(_0x15e2d1[_0x8394('0x43')],null))[_0x8394('0x23')](respondWithResult(_0x515145,null))[_0x8394('0x3b')](handleError(_0x515145,null));};exports['destroy']=function(_0x355454,_0x2eeba5){return db[_0x8394('0x29')][_0x8394('0x41')]({'where':{'id':_0x355454[_0x8394('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2eeba5,null))[_0x8394('0x23')](removeEntity(_0x2eeba5,null))[_0x8394('0x3b')](handleError(_0x2eeba5,null));};exports[_0x8394('0x44')]=function(_0x10ab59,_0x35bcc1){var _0x3a3c73;return db[_0x8394('0x45')]['transaction'](function(_0x211f9f){return db[_0x8394('0x29')]['create'](_0x10ab59['body'],{'transaction':_0x211f9f})[_0x8394('0x23')](function(_0x116ee6){_0x3a3c73=_0x116ee6;var _0x4d81d9={'type':db['Sequelize'][_0x8394('0x46')],'transaction':_0x211f9f};switch(_0x10ab59[_0x8394('0x43')][_0x8394('0x2b')]){case _0x8394('0x47'):_0x4d81d9[_0x8394('0x2b')]=db[_0x8394('0x48')][_0x8394('0x46')];break;case _0x8394('0x49'):_0x4d81d9[_0x8394('0x2b')]=db[_0x8394('0x48')][_0x8394('0x4a')];break;case _0x8394('0x4b'):_0x4d81d9[_0x8394('0x2b')]=db[_0x8394('0x48')][_0x8394('0x4c')];_0x4d81d9['defaultValue']=![];break;default:}return db[_0x8394('0x45')][_0x8394('0x4d')][_0x8394('0x4e')](_0x8394('0x4f'),util[_0x8394('0x50')](_0x8394('0x51'),_0x3a3c73['id']),_0x4d81d9);})[_0x8394('0x23')](function(){return _0x3a3c73;});})['then'](respondWithResult(_0x35bcc1,0xc9))[_0x8394('0x3b')](handleError(_0x35bcc1,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 62d2af7..4eaa3c0 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 _0x83dd=['define','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x49cbf7,_0x4b1cb6){var _0x2a66c1=function(_0x5e8be2){while(--_0x5e8be2){_0x49cbf7['push'](_0x49cbf7['shift']());}};_0x2a66c1(++_0x4b1cb6);}(_0x83dd,0x1af));var _0xd83d=function(_0x52f03d,_0x532411){_0x52f03d=_0x52f03d-0x0;var _0x52a438=_0x83dd[_0x52f03d];return _0x52a438;};'use strict';var _=require(_0xd83d('0x0'));var util=require(_0xd83d('0x1'));var logger=require(_0xd83d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd83d('0x3'));var fs=require('fs');var path=require(_0xd83d('0x4'));var rimraf=require(_0xd83d('0x5'));var config=require(_0xd83d('0x6'));var attributes=require(_0xd83d('0x7'));module[_0xd83d('0x8')]=function(_0x6600ab,_0x3c65b4){return _0x6600ab[_0xd83d('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf906=['path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a82cc,_0x502b1f){var _0x7db098=function(_0x2c550e){while(--_0x2c550e){_0x5a82cc['push'](_0x5a82cc['shift']());}};_0x7db098(++_0x502b1f);}(_0xf906,0x132));var _0x6f90=function(_0x4ee2d0,_0x3cf39c){_0x4ee2d0=_0x4ee2d0-0x0;var _0x4b2877=_0xf906[_0x4ee2d0];return _0x4b2877;};'use strict';var _=require(_0x6f90('0x0'));var util=require(_0x6f90('0x1'));var logger=require(_0x6f90('0x2'))('api');var moment=require(_0x6f90('0x3'));var BPromise=require(_0x6f90('0x4'));var rp=require(_0x6f90('0x5'));var fs=require('fs');var path=require(_0x6f90('0x6'));var rimraf=require(_0x6f90('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f90('0x8'));module[_0x6f90('0x9')]=function(_0x316716,_0x1cc6c6){return _0x316716[_0x6f90('0xa')](_0x6f90('0xb'),attributes,{'tableName':_0x6f90('0xc'),'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 10fe217..b9a7d66 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 _0x2d3e=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','util','bluebird'];(function(_0x57c318,_0x339282){var _0x3ccb22=function(_0x5d1251){while(--_0x5d1251){_0x57c318['push'](_0x57c318['shift']());}};_0x3ccb22(++_0x339282);}(_0x2d3e,0x1f2));var _0xe2d3=function(_0x2b72ca,_0x5a8fc3){_0x2b72ca=_0x2b72ca-0x0;var _0xa734ea=_0x2d3e[_0x2b72ca];return _0xa734ea;};'use strict';var _=require('lodash');var util=require(_0xe2d3('0x0'));var moment=require('moment');var BPromise=require(_0xe2d3('0x1'));var rs=require(_0xe2d3('0x2'));var fs=require('fs');var Redis=require(_0xe2d3('0x3'));var db=require(_0xe2d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2d3('0x5'))(_0xe2d3('0x6'));var config=require(_0xe2d3('0x7'));var jayson=require(_0xe2d3('0x8'));var client=jayson['client'][_0xe2d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x333412,_0x6eeffc,_0xe8bd5b){return new BPromise(function(_0x3d6f66,_0x358721){return client[_0xe2d3('0xa')](_0x333412,_0xe8bd5b)[_0xe2d3('0xb')](function(_0x211771){logger[_0xe2d3('0xc')](_0xe2d3('0xd'),_0x6eeffc,'request\x20sent');logger[_0xe2d3('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x6eeffc,_0xe2d3('0xf'),JSON[_0xe2d3('0x10')](_0x211771));if(_0x211771['error']){if(_0x211771[_0xe2d3('0x11')]['code']===0x1f4){logger['error'](_0xe2d3('0xd'),_0x6eeffc,_0x211771['error'][_0xe2d3('0x12')]);return _0x358721(_0x211771[_0xe2d3('0x11')][_0xe2d3('0x12')]);}logger[_0xe2d3('0x11')](_0xe2d3('0xd'),_0x6eeffc,_0x211771[_0xe2d3('0x11')][_0xe2d3('0x12')]);return _0x3d6f66(_0x211771[_0xe2d3('0x11')][_0xe2d3('0x12')]);}else{logger[_0xe2d3('0xc')]('CmCustomField,\x20%s,\x20%s',_0x6eeffc,_0xe2d3('0xf'));_0x3d6f66(_0x211771[_0xe2d3('0x13')][_0xe2d3('0x12')]);}})['catch'](function(_0x53506d){logger[_0xe2d3('0x11')](_0xe2d3('0xd'),_0x6eeffc,_0x53506d);_0x358721(_0x53506d);});});} \ No newline at end of file +var _0xddd7=['http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x450b2a,_0x174591){var _0x37a7ff=function(_0x259a26){while(--_0x259a26){_0x450b2a['push'](_0x450b2a['shift']());}};_0x37a7ff(++_0x174591);}(_0xddd7,0xe4));var _0x7ddd=function(_0x354eec,_0x18d353){_0x354eec=_0x354eec-0x0;var _0x4d2d3e=_0xddd7[_0x354eec];return _0x4d2d3e;};'use strict';var _=require(_0x7ddd('0x0'));var util=require(_0x7ddd('0x1'));var moment=require(_0x7ddd('0x2'));var BPromise=require(_0x7ddd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ddd('0x4'));var db=require(_0x7ddd('0x5'))['db'];var utils=require(_0x7ddd('0x6'));var logger=require(_0x7ddd('0x7'))(_0x7ddd('0x8'));var config=require(_0x7ddd('0x9'));var jayson=require(_0x7ddd('0xa'));var client=jayson[_0x7ddd('0xb')][_0x7ddd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6b2503,_0x54fec0,_0x49c951){return new BPromise(function(_0x1ee2d7,_0x77a7c6){return client[_0x7ddd('0xd')](_0x6b2503,_0x49c951)[_0x7ddd('0xe')](function(_0x23477b){logger[_0x7ddd('0xf')](_0x7ddd('0x10'),_0x54fec0,_0x7ddd('0x11'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x54fec0,'request\x20sent',JSON[_0x7ddd('0x12')](_0x23477b));if(_0x23477b['error']){if(_0x23477b[_0x7ddd('0x13')][_0x7ddd('0x14')]===0x1f4){logger['error'](_0x7ddd('0x10'),_0x54fec0,_0x23477b[_0x7ddd('0x13')]['message']);return _0x77a7c6(_0x23477b[_0x7ddd('0x13')][_0x7ddd('0x15')]);}logger[_0x7ddd('0x13')](_0x7ddd('0x10'),_0x54fec0,_0x23477b[_0x7ddd('0x13')][_0x7ddd('0x15')]);return _0x1ee2d7(_0x23477b['error'][_0x7ddd('0x15')]);}else{logger[_0x7ddd('0xf')](_0x7ddd('0x10'),_0x54fec0,_0x7ddd('0x11'));_0x1ee2d7(_0x23477b[_0x7ddd('0x16')][_0x7ddd('0x15')]);}})[_0x7ddd('0x17')](function(_0x7a24a3){logger[_0x7ddd('0x13')](_0x7ddd('0x10'),_0x54fec0,_0x7a24a3);_0x77a7c6(_0x7a24a3);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4fc97b9..73f851f 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 _0xd094=['show','create','put','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd094,0x96));var _0x4d09=function(_0x287f65,_0x292477){_0x287f65=_0x287f65-0x0;var _0x3ef72c=_0xd094[_0x287f65];return _0x3ef72c;};'use strict';var multer=require('multer');var util=require(_0x4d09('0x0'));var path=require(_0x4d09('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d09('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x4d09('0x3'));var config=require(_0x4d09('0x4'));var controller=require(_0x4d09('0x5'));router['get']('/',auth[_0x4d09('0x6')](),controller[_0x4d09('0x7')]);router[_0x4d09('0x8')](_0x4d09('0x9'),auth['isAuthenticated'](),controller[_0x4d09('0xa')]);router['post']('/',auth[_0x4d09('0x6')](),controller[_0x4d09('0xb')]);router[_0x4d09('0xc')](_0x4d09('0x9'),auth[_0x4d09('0x6')](),controller['update']);router[_0x4d09('0xd')](_0x4d09('0x9'),auth[_0x4d09('0x6')](),controller[_0x4d09('0xe')]);module[_0x4d09('0xf')]=router; \ No newline at end of file +var _0x1b07=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2474ac,_0x335d3a){var _0x384a8f=function(_0x402bf6){while(--_0x402bf6){_0x2474ac['push'](_0x2474ac['shift']());}};_0x384a8f(++_0x335d3a);}(_0x1b07,0x1ca));var _0x71b0=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x1b07[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var path=require(_0x71b0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x71b0('0x3')]();var fs_extra=require(_0x71b0('0x4'));var auth=require(_0x71b0('0x5'));var interaction=require(_0x71b0('0x6'));var config=require(_0x71b0('0x7'));var controller=require('./cmCustomField.controller');router[_0x71b0('0x8')]('/',auth['isAuthenticated'](),controller[_0x71b0('0x9')]);router[_0x71b0('0x8')](_0x71b0('0xa'),auth['isAuthenticated'](),controller[_0x71b0('0xb')]);router[_0x71b0('0xc')]('/',auth[_0x71b0('0xd')](),controller[_0x71b0('0xe')]);router[_0x71b0('0xf')](_0x71b0('0xa'),auth[_0x71b0('0xd')](),controller[_0x71b0('0x10')]);router[_0x71b0('0x11')](_0x71b0('0xa'),auth[_0x71b0('0xd')](),controller[_0x71b0('0x12')]);module[_0x71b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 28f4a21..c5550c7 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 _0x7816=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0x7816,0x11c));var _0x6781=function(_0x34bcf6,_0x2cc521){_0x34bcf6=_0x34bcf6-0x0;var _0x54adc9=_0x7816[_0x34bcf6];return _0x54adc9;};'use strict';var moment=require(_0x6781('0x0'));var Sequelize=require(_0x6781('0x1'));module[_0x6781('0x2')]={'phone':{'type':Sequelize[_0x6781('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x6781('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6781('0x5')],'defaultValue':moment()[_0x6781('0x6')](_0x6781('0x7'))},'countbusyretry':{'type':Sequelize[_0x6781('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6781('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6781('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6781('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6781('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6781('0x5')]},'priority':{'type':Sequelize[_0x6781('0x8')](0x2)[_0x6781('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6781('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6781('0x8')],'unique':_0x6781('0xa')},'ListId':{'type':Sequelize[_0x6781('0x8')],'unique':_0x6781('0xa')},'UserId':{'type':Sequelize[_0x6781('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x6781('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6781('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6781('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6781('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0806=['exports','BOOLEAN','INTEGER','UNSIGNED','contactListQueue','sequelize'];(function(_0x2bfb71,_0x37f030){var _0x536b41=function(_0x1e6ace){while(--_0x1e6ace){_0x2bfb71['push'](_0x2bfb71['shift']());}};_0x536b41(++_0x37f030);}(_0x0806,0xcb));var _0x6080=function(_0x23a95f,_0x2c5d4b){_0x23a95f=_0x23a95f-0x0;var _0x4a36fb=_0x0806[_0x23a95f];return _0x4a36fb;};'use strict';var moment=require('moment');var Sequelize=require(_0x6080('0x0'));module[_0x6080('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x6080('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6080('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6080('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6080('0x3')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6080('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x6080('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6080('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6080('0x3')],'unique':_0x6080('0x5')},'ListId':{'type':Sequelize[_0x6080('0x3')],'unique':_0x6080('0x5')},'UserId':{'type':Sequelize[_0x6080('0x3')]},'VoiceQueueId':{'type':Sequelize[_0x6080('0x3')],'unique':_0x6080('0x5')},'CampaignId':{'type':Sequelize[_0x6080('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x6080('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6080('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6080('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 9b61928..624129a 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 _0x43b1=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','index','map','CmHopper','key','model','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$between','$notBetween','$in','$like','$notLike','$iLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','CmList','List','Queue','dialActive','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4e0964,_0x4c179b){var _0x34eadf=function(_0x169927){while(--_0x169927){_0x4e0964['push'](_0x4e0964['shift']());}};_0x34eadf(++_0x4c179b);}(_0x43b1,0x7d));var _0x143b=function(_0x2815fd,_0x3d3645){_0x2815fd=_0x2815fd-0x0;var _0x5d089c=_0x43b1[_0x2815fd];return _0x5d089c;};'use strict';var emlformat=require(_0x143b('0x0'));var rimraf=require(_0x143b('0x1'));var zipdir=require(_0x143b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x143b('0x3'));var moment=require('moment');var BPromise=require(_0x143b('0x4'));var Mustache=require(_0x143b('0x5'));var util=require(_0x143b('0x6'));var path=require(_0x143b('0x7'));var sox=require(_0x143b('0x8'));var csv=require(_0x143b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x143b('0xa'));var _=require(_0x143b('0xb'));var squel=require(_0x143b('0xc'));var crypto=require('crypto');var jsforce=require(_0x143b('0xd'));var deskjs=require(_0x143b('0xe'));var toCsv=require(_0x143b('0x9'));var querystring=require(_0x143b('0xf'));var Papa=require(_0x143b('0x10'));var Redis=require(_0x143b('0x11'));var authService=require(_0x143b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x143b('0x13'));var hardwareService=require(_0x143b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x143b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x143b('0x16'));var db=require(_0x143b('0x17'))['db'];function respondWithStatusCode(_0x52429f,_0x2d6c07){_0x2d6c07=_0x2d6c07||0xcc;return function(_0x1ef389){if(_0x1ef389){return _0x52429f[_0x143b('0x18')](_0x2d6c07);}return _0x52429f[_0x143b('0x19')](_0x2d6c07)[_0x143b('0x1a')]();};}function respondWithResult(_0x34cd9b,_0x1325c3){_0x1325c3=_0x1325c3||0xc8;return function(_0x40ce06){if(_0x40ce06){return _0x34cd9b[_0x143b('0x19')](_0x1325c3)[_0x143b('0x1b')](_0x40ce06);}};}function respondWithFilteredResult(_0x2bca2c,_0x3cc649){return function(_0x2d746a){if(_0x2d746a){var _0x133603=typeof _0x3cc649[_0x143b('0x1c')]===_0x143b('0x1d')&&typeof _0x3cc649[_0x143b('0x1e')]==='undefined';var _0x520197=_0x2d746a[_0x143b('0x1f')];var _0x244ba8=_0x133603?0x0:_0x3cc649[_0x143b('0x1c')];var _0x139aa9=_0x133603?_0x2d746a[_0x143b('0x1f')]:_0x3cc649[_0x143b('0x1c')]+_0x3cc649[_0x143b('0x1e')];var _0x1ca6d2;if(_0x139aa9>=_0x520197){_0x139aa9=_0x520197;_0x1ca6d2=0xc8;}else{_0x1ca6d2=0xce;}_0x2bca2c[_0x143b('0x19')](_0x1ca6d2);return _0x2bca2c[_0x143b('0x20')](_0x143b('0x21'),_0x244ba8+'-'+_0x139aa9+'/'+_0x520197)['json'](_0x2d746a);}return null;};}function patchUpdates(_0x1dd05b){return function(_0x35df37){try{jsonpatch[_0x143b('0x22')](_0x35df37,_0x1dd05b,!![]);}catch(_0xfd9194){return BPromise[_0x143b('0x23')](_0xfd9194);}return _0x35df37[_0x143b('0x24')]();};}function saveUpdates(_0x159ef6,_0x1d5b5b){return function(_0x5d0684){if(_0x5d0684){return _0x5d0684[_0x143b('0x25')](_0x159ef6)['then'](function(_0x2a55fe){return _0x2a55fe;});}return null;};}function removeEntity(_0x5bdebc,_0x549638){return function(_0x56717f){if(_0x56717f){return _0x56717f[_0x143b('0x26')]()['then'](function(){_0x5bdebc['status'](0xcc)[_0x143b('0x1a')]();});}};}function handleEntityNotFound(_0x53c102,_0x35e097){return function(_0x54eca6){if(!_0x54eca6){_0x53c102[_0x143b('0x18')](0x194);}return _0x54eca6;};}function handleError(_0xd30b1,_0x1adf50){_0x1adf50=_0x1adf50||0x1f4;return function(_0x4f5a17){logger['error'](_0x4f5a17['stack']);if(_0x4f5a17['name']){delete _0x4f5a17[_0x143b('0x27')];}_0xd30b1['status'](_0x1adf50)['send'](_0x4f5a17);};}exports[_0x143b('0x28')]=function(_0x37611b,_0x6174a3){var _0x5535b5={},_0xd1aa12={},_0x45ef09={'count':0x0,'rows':[]};var _0x42e136=_[_0x143b('0x29')](db[_0x143b('0x2a')]['rawAttributes'],function(_0x5d4da6){return{'name':_0x5d4da6['fieldName'],'type':_0x5d4da6['type'][_0x143b('0x2b')]};});_0xd1aa12[_0x143b('0x2c')]=_[_0x143b('0x29')](_0x42e136,_0x143b('0x27'));_0xd1aa12[_0x143b('0x2d')]=_[_0x143b('0x2e')](_0x37611b[_0x143b('0x2d')]);_0xd1aa12[_0x143b('0x2f')]=_[_0x143b('0x30')](_0xd1aa12[_0x143b('0x2c')],_0xd1aa12['query']);_0xd1aa12[_0x143b('0x2f')]=_[_0x143b('0x31')](_0xd1aa12['filters'],['$and',_0x143b('0x32'),_0x143b('0x33'),_0x143b('0x34'),_0x143b('0x35'),'$lte','$ne','$eq','$not',_0x143b('0x36'),_0x143b('0x37'),_0x143b('0x38'),'$notIn',_0x143b('0x39'),_0x143b('0x3a'),_0x143b('0x3b'),'$notILike',_0x143b('0x39'),_0x143b('0x3c'),_0x143b('0x3d'),'$contained',_0x143b('0x3e')]);_0x5535b5[_0x143b('0x3f')]=_['intersection'](_0xd1aa12['model'],qs['fields'](_0x37611b[_0x143b('0x2d')][_0x143b('0x40')]));_0x5535b5['attributes']=_0x5535b5[_0x143b('0x3f')][_0x143b('0x41')]?_0x5535b5[_0x143b('0x3f')]:_0xd1aa12[_0x143b('0x2c')];if(!_0x37611b['query'][_0x143b('0x42')](_0x143b('0x43'))){_0x5535b5[_0x143b('0x1e')]=qs[_0x143b('0x1e')](_0x37611b[_0x143b('0x2d')]['limit']);_0x5535b5[_0x143b('0x1c')]=qs[_0x143b('0x1c')](_0x37611b[_0x143b('0x2d')]['offset']);}_0x5535b5[_0x143b('0x44')]=qs[_0x143b('0x45')](_0x37611b['query'][_0x143b('0x45')]);_0x5535b5[_0x143b('0x46')]=qs[_0x143b('0x2f')](_[_0x143b('0x47')](_0x37611b[_0x143b('0x2d')],_0xd1aa12['filters']),_0x42e136);if(_0x37611b[_0x143b('0x2d')][_0x143b('0x48')]){_0x5535b5[_0x143b('0x46')]=_[_0x143b('0x49')](_0x5535b5[_0x143b('0x46')],{'$or':_[_0x143b('0x29')](_0x42e136,function(_0x110058){if(_0x110058['type']!==_0x143b('0x4a')){var _0x19a1c1={};_0x19a1c1[_0x110058['name']]={'$like':'%'+_0x37611b[_0x143b('0x2d')][_0x143b('0x48')]+'%'};return _0x19a1c1;}})});}_0x5535b5=_['merge']({},_0x5535b5,_0x37611b[_0x143b('0x4b')]);var _0x2e0222={'where':_0x5535b5[_0x143b('0x46')]};return db['CmHopper'][_0x143b('0x1f')](_0x2e0222)[_0x143b('0x4c')](function(_0xac79f6){_0x45ef09[_0x143b('0x1f')]=_0xac79f6;if(_0x37611b[_0x143b('0x2d')][_0x143b('0x4d')]){_0x5535b5['include']=[{'all':!![]}];}return db[_0x143b('0x2a')][_0x143b('0x4e')](_0x5535b5);})[_0x143b('0x4c')](function(_0x2a4c92){_0x45ef09['rows']=_0x2a4c92;return _0x45ef09;})[_0x143b('0x4c')](respondWithFilteredResult(_0x6174a3,_0x5535b5))[_0x143b('0x4f')](handleError(_0x6174a3,null));};exports[_0x143b('0x50')]=function(_0x3fabe4,_0x303171){var _0x477e9f={'raw':!![],'where':{'id':_0x3fabe4['params']['id']}},_0x69dd7c={};_0x69dd7c['model']=_['keys'](db[_0x143b('0x2a')][_0x143b('0x51')]);_0x69dd7c[_0x143b('0x2d')]=_[_0x143b('0x2e')](_0x3fabe4[_0x143b('0x2d')]);_0x69dd7c[_0x143b('0x2f')]=_[_0x143b('0x30')](_0x69dd7c[_0x143b('0x2c')],_0x69dd7c[_0x143b('0x2d')]);_0x477e9f[_0x143b('0x3f')]=_['intersection'](_0x69dd7c[_0x143b('0x2c')],qs[_0x143b('0x40')](_0x3fabe4[_0x143b('0x2d')][_0x143b('0x40')]));_0x477e9f['attributes']=_0x477e9f[_0x143b('0x3f')]['length']?_0x477e9f[_0x143b('0x3f')]:_0x69dd7c[_0x143b('0x2c')];if(_0x3fabe4['query']['includeAll']){_0x477e9f[_0x143b('0x52')]=[{'all':!![]}];}_0x477e9f=_[_0x143b('0x49')]({},_0x477e9f,_0x3fabe4[_0x143b('0x4b')]);return db['CmHopper'][_0x143b('0x53')](_0x477e9f)['then'](handleEntityNotFound(_0x303171,null))[_0x143b('0x4c')](respondWithResult(_0x303171,null))['catch'](handleError(_0x303171,null));};exports[_0x143b('0x54')]=function(_0x2bb0a4,_0x5a44aa){return db[_0x143b('0x2a')][_0x143b('0x54')](_0x2bb0a4[_0x143b('0x55')],{})[_0x143b('0x4c')](respondWithResult(_0x5a44aa,0xc9))[_0x143b('0x4f')](handleError(_0x5a44aa,null));};exports[_0x143b('0x25')]=function(_0x48a668,_0xa2bdc5){if(_0x48a668[_0x143b('0x55')]['id']){delete _0x48a668['body']['id'];}return db['CmHopper'][_0x143b('0x53')]({'where':{'id':_0x48a668[_0x143b('0x56')]['id']}})[_0x143b('0x4c')](handleEntityNotFound(_0xa2bdc5,null))[_0x143b('0x4c')](saveUpdates(_0x48a668[_0x143b('0x55')],null))[_0x143b('0x4c')](respondWithResult(_0xa2bdc5,null))[_0x143b('0x4f')](handleError(_0xa2bdc5,null));};exports[_0x143b('0x57')]=function(_0x2172c3,_0x2d976e){return db[_0x143b('0x2a')][_0x143b('0x57')]()['then'](respondWithResult(_0x2d976e,null))[_0x143b('0x4f')](handleError(_0x2d976e,null));};exports[_0x143b('0x26')]=function(_0x1b7454,_0x142f7a){var _0x21e0a9;return db[_0x143b('0x2a')]['find']({'where':{'id':_0x1b7454['params']['id']}})[_0x143b('0x4c')](handleEntityNotFound(_0x142f7a,null))[_0x143b('0x4c')](function(_0x4f1db8){if(_0x4f1db8){return _0x4f1db8[_0x143b('0x26')]()[_0x143b('0x4c')](function(_0x35087a){return _0x35087a;});}})['then'](function(_0x23e6e5){_0x21e0a9=_0x23e6e5;if(_0x23e6e5){if(_0x23e6e5[_0x143b('0x58')]||_0x23e6e5['CampaignId']){return db[_0x23e6e5[_0x143b('0x58')]?_0x143b('0x59'):_0x143b('0x5a')]['find']({'where':{'id':_0x23e6e5[_0x143b('0x58')]?_0x23e6e5[_0x143b('0x58')]:_0x23e6e5[_0x143b('0x5b')]},'attributes':['id','name'],'raw':!![]});}}})[_0x143b('0x4c')](function(_0x47893e){var _0x39ee14={};if(_0x47893e){_[_0x143b('0x49')](_0x39ee14,_[_0x143b('0x5c')](_0x21e0a9[_0x143b('0x5d')],['createdAt',_0x143b('0x5e'),'id']));_0x39ee14['state']=0x15;_0x39ee14[_0x143b('0x5f')]=_0x143b('0x60');_0x39ee14[_0x143b('0x61')]=_0x47893e[_0x143b('0x27')];_0x39ee14[_0x143b('0x62')]=_0x1b7454[_0x143b('0x63')][_0x143b('0x27')];_0x39ee14[_0x143b('0x64')]=_0x1b7454[_0x143b('0x63')]['id'];_0x39ee14[_0x143b('0x60')]=!![];_0x39ee14[_0x143b('0x65')]=moment()[_0x143b('0x66')](_0x143b('0x67'));_0x39ee14[_0x143b('0x68')]=_0x21e0a9['phone'];_0x39ee14[_0x143b('0x69')]=_0x21e0a9['VoiceQueueId']?_0x143b('0x6a'):_0x143b('0x6b');return db[_0x143b('0x6c')][_0x143b('0x53')]({'where':{'id':_0x39ee14[_0x143b('0x6d')]},'attributes':[_0x143b('0x6e'),_0x143b('0x6f')]})[_0x143b('0x4c')](function(_0x4fcb86){if(!_[_0x143b('0x70')](_0x142f7a)&&!_[_0x143b('0x70')](_0x4fcb86[_0x143b('0x6e')])){_0x39ee14[_0x143b('0x71')]=_0x4fcb86[_0x143b('0x6e')];if(!_[_0x143b('0x70')](_0x4fcb86[_0x143b('0x6f')])){_0x39ee14[_0x143b('0x71')]+='\x20'+_0x4fcb86[_0x143b('0x6f')];}}})[_0x143b('0x72')](function(){return db[_0x143b('0x73')][_0x143b('0x54')](_0x39ee14);});}})[_0x143b('0x4c')](function(){return _0x142f7a[_0x143b('0x19')](0xcc)[_0x143b('0x1a')]();})['catch'](handleError(_0x142f7a,null));};exports['getPreview']=function(_0x4b8eec,_0x5f4836,_0x5272b0){var _0x43a618=[];return db[_0x143b('0x6c')][_0x143b('0x57')]()[_0x143b('0x4c')](function(_0x1ddce6){_0x43a618=_['keys'](_0x1ddce6);return _0x4b8eec[_0x143b('0x63')][_0x143b('0x74')]({'where':{'type':_0x143b('0x75'),'dialActive':!![],'dialMethod':_0x143b('0x76')},'attributes':['id',_0x143b('0x77'),_0x143b('0x78')],'raw':!![]});})['then'](function(_0x311621){if(_0x311621&&_0x311621[_0x143b('0x41')]){return db[_0x143b('0x79')]['transaction'](function(_0x1d0403){var _0x41b4e7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x143b('0x66')](_0x143b('0x67'))},'VoiceQueueId':{'$in':_[_0x143b('0x29')](_0x311621,'id')},'$or':[{'UserId':null},{'UserId':_0x4b8eec[_0x143b('0x63')]['id']}]};var _0x335988={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x311621)[_0x143b('0x48')]([_0x143b('0x78'),0x0])[_0x143b('0x29')]('id')[_0x143b('0x7a')]()},'$or':[{'UserId':null},{'UserId':_0x4b8eec['user']['id']}]};var _0x354af8={'$or':[_0x41b4e7,_0x335988]};var _0x5151fd=[];if(_0x4b8eec[_0x143b('0x55')]['direction']&&_0x4b8eec[_0x143b('0x55')][_0x143b('0x7b')]==='prev'){if(!_[_0x143b('0x7c')](_0x4b8eec[_0x143b('0x55')]['hopperIds'])){_0x354af8['id']={'$in':_0x4b8eec[_0x143b('0x55')][_0x143b('0x7d')]};}_0x5151fd=[[_0x143b('0x7e'),_0x143b('0x7f')],[_0x143b('0x80'),_0x311621[0x0][_0x143b('0x77')]==='ASC'?_0x143b('0x81'):_0x143b('0x7f')],db[_0x143b('0x79')][_0x143b('0x82')](_0x143b('0x83')),['id','DESC']];}else{if(!_['isEmpty'](_0x4b8eec[_0x143b('0x55')][_0x143b('0x7d')])){_0x354af8['id']={'$notIn':_0x4b8eec['body'][_0x143b('0x7d')]};}_0x5151fd=[[_0x143b('0x7e'),'DESC'],[_0x143b('0x80'),_0x311621[0x0][_0x143b('0x77')]],db['sequelize'][_0x143b('0x82')](_0x143b('0x84')),['id','ASC']];}return db[_0x143b('0x2a')][_0x143b('0x85')]({'attributes':['id',_0x143b('0x86'),_0x143b('0x87')],'where':_0x354af8,'order':_0x5151fd,'transaction':_0x1d0403,'lock':_0x1d0403[_0x143b('0x88')]['UPDATE'],'include':[{'model':db[_0x143b('0x6c')],'as':_0x143b('0x89'),'attributes':_0x43a618,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x143b('0x27')]}]},{'model':db[_0x143b('0x8a')],'as':_0x143b('0x8b'),'attributes':['id','name']},{'model':db[_0x143b('0x59')],'as':_0x143b('0x8c'),'attributes':['id',_0x143b('0x27'),_0x143b('0x8d')]}]})['then'](function(_0x273ca9){if(_0x273ca9){return _0x273ca9['update']({'UserId':_0x4b8eec['user']['id']},{'transaction':_0x1d0403});}});});}})[_0x143b('0x4c')](handleEntityNotFound(_0x5f4836,null))[_0x143b('0x4c')](respondWithResult(_0x5f4836,null))[_0x143b('0x4f')](handleError(_0x5f4836,null));};exports[_0x143b('0x8e')]=function(_0x147686,_0x4939dd,_0x5e0669){return _0x147686[_0x143b('0x63')][_0x143b('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x143b('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x112713){if(_0x112713&&_0x112713[_0x143b('0x41')]){return db[_0x143b('0x2a')][_0x143b('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x143b('0x66')](_0x143b('0x67'))},'VoiceQueueId':{'$in':_[_0x143b('0x29')](_0x112713,'id')},'$or':[{'UserId':null},{'UserId':_0x147686[_0x143b('0x63')]['id']}]}});}return 0x0;})[_0x143b('0x4c')](function(_0x19797b){if(!_[_0x143b('0x70')](_0x19797b)&&_[_0x143b('0x8f')](_0x19797b)){return _0x4939dd[_0x143b('0x19')](0xc8)[_0x143b('0x1b')]({'contacts':_0x19797b});}else{logger[_0x143b('0x90')](_0x143b('0x91'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x4939dd[_0x143b('0x18')](0x194);}})[_0x143b('0x4f')](handleError(_0x4939dd,null));}; \ No newline at end of file +var _0x0d77=['lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','save','update','then','destroy','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','create','body','find','params','VoiceQueueId','CampaignId','VoiceQueue','omit','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','describe','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','filter','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','Contact','CmCompany','Company','CmList','List','Queue','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x1c9362,_0x147376){var _0xe46171=function(_0xe3be29){while(--_0xe3be29){_0x1c9362['push'](_0x1c9362['shift']());}};_0xe46171(++_0x147376);}(_0x0d77,0x8b));var _0x70d7=function(_0x4cf591,_0x4f02e8){_0x4cf591=_0x4cf591-0x0;var _0x56fa58=_0x0d77[_0x4cf591];return _0x56fa58;};'use strict';var emlformat=require(_0x70d7('0x0'));var rimraf=require(_0x70d7('0x1'));var zipdir=require(_0x70d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x70d7('0x3'));var moment=require(_0x70d7('0x4'));var BPromise=require(_0x70d7('0x5'));var Mustache=require('mustache');var util=require(_0x70d7('0x6'));var path=require(_0x70d7('0x7'));var sox=require('sox');var csv=require(_0x70d7('0x8'));var ejs=require(_0x70d7('0x9'));var fs=require('fs');var fs_extra=require(_0x70d7('0xa'));var _=require(_0x70d7('0xb'));var squel=require(_0x70d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x70d7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x70d7('0x8'));var querystring=require('querystring');var Papa=require(_0x70d7('0xe'));var Redis=require('ioredis');var authService=require(_0x70d7('0xf'));var qs=require(_0x70d7('0x10'));var as=require(_0x70d7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70d7('0x12'))(_0x70d7('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70d7('0x14'));var db=require(_0x70d7('0x15'))['db'];function respondWithStatusCode(_0x311c47,_0x458a88){_0x458a88=_0x458a88||0xcc;return function(_0x1b9d2e){if(_0x1b9d2e){return _0x311c47[_0x70d7('0x16')](_0x458a88);}return _0x311c47[_0x70d7('0x17')](_0x458a88)[_0x70d7('0x18')]();};}function respondWithResult(_0x928b30,_0x122807){_0x122807=_0x122807||0xc8;return function(_0x50eba0){if(_0x50eba0){return _0x928b30[_0x70d7('0x17')](_0x122807)[_0x70d7('0x19')](_0x50eba0);}};}function respondWithFilteredResult(_0x4c2339,_0x1acd9b){return function(_0x227b33){if(_0x227b33){var _0x4e9dfd=typeof _0x1acd9b['offset']==='undefined'&&typeof _0x1acd9b[_0x70d7('0x1a')]===_0x70d7('0x1b');var _0x272269=_0x227b33[_0x70d7('0x1c')];var _0x90afee=_0x4e9dfd?0x0:_0x1acd9b[_0x70d7('0x1d')];var _0x1048f8=_0x4e9dfd?_0x227b33[_0x70d7('0x1c')]:_0x1acd9b['offset']+_0x1acd9b[_0x70d7('0x1a')];var _0x4b6335;if(_0x1048f8>=_0x272269){_0x1048f8=_0x272269;_0x4b6335=0xc8;}else{_0x4b6335=0xce;}_0x4c2339[_0x70d7('0x17')](_0x4b6335);return _0x4c2339[_0x70d7('0x1e')]('Content-Range',_0x90afee+'-'+_0x1048f8+'/'+_0x272269)[_0x70d7('0x19')](_0x227b33);}return null;};}function patchUpdates(_0x5f338d){return function(_0x3210de){try{jsonpatch['apply'](_0x3210de,_0x5f338d,!![]);}catch(_0x23858d){return BPromise[_0x70d7('0x1f')](_0x23858d);}return _0x3210de[_0x70d7('0x20')]();};}function saveUpdates(_0x23ae30,_0x334aac){return function(_0x100238){if(_0x100238){return _0x100238[_0x70d7('0x21')](_0x23ae30)[_0x70d7('0x22')](function(_0x5de06f){return _0x5de06f;});}return null;};}function removeEntity(_0x544b0a,_0xd049b1){return function(_0x43dabc){if(_0x43dabc){return _0x43dabc[_0x70d7('0x23')]()[_0x70d7('0x22')](function(){_0x544b0a['status'](0xcc)[_0x70d7('0x18')]();});}};}function handleEntityNotFound(_0x378349,_0x50e04e){return function(_0x57e98c){if(!_0x57e98c){_0x378349[_0x70d7('0x16')](0x194);}return _0x57e98c;};}function handleError(_0x184ec9,_0x275fd4){_0x275fd4=_0x275fd4||0x1f4;return function(_0x2adb3d){logger[_0x70d7('0x24')](_0x2adb3d[_0x70d7('0x25')]);if(_0x2adb3d[_0x70d7('0x26')]){delete _0x2adb3d[_0x70d7('0x26')];}_0x184ec9[_0x70d7('0x17')](_0x275fd4)['send'](_0x2adb3d);};}exports[_0x70d7('0x27')]=function(_0x5e9b43,_0x4fb48d){var _0x3a6ab8={},_0x3f078d={},_0x1ce4a0={'count':0x0,'rows':[]};var _0x1159d6=_[_0x70d7('0x28')](db[_0x70d7('0x29')][_0x70d7('0x2a')],function(_0x405f05){return{'name':_0x405f05[_0x70d7('0x2b')],'type':_0x405f05[_0x70d7('0x2c')][_0x70d7('0x2d')]};});_0x3f078d[_0x70d7('0x2e')]=_[_0x70d7('0x28')](_0x1159d6,_0x70d7('0x26'));_0x3f078d['query']=_[_0x70d7('0x2f')](_0x5e9b43[_0x70d7('0x30')]);_0x3f078d[_0x70d7('0x31')]=_[_0x70d7('0x32')](_0x3f078d[_0x70d7('0x2e')],_0x3f078d[_0x70d7('0x30')]);_0x3f078d['filters']=_[_0x70d7('0x33')](_0x3f078d[_0x70d7('0x31')],[_0x70d7('0x34'),_0x70d7('0x35'),_0x70d7('0x36'),_0x70d7('0x37'),_0x70d7('0x38'),_0x70d7('0x39'),_0x70d7('0x3a'),_0x70d7('0x3b'),'$not',_0x70d7('0x3c'),_0x70d7('0x3d'),_0x70d7('0x3e'),_0x70d7('0x3f'),_0x70d7('0x40'),_0x70d7('0x41'),_0x70d7('0x42'),_0x70d7('0x43'),_0x70d7('0x40'),_0x70d7('0x44'),_0x70d7('0x45'),_0x70d7('0x46'),_0x70d7('0x47')]);_0x3a6ab8[_0x70d7('0x48')]=_[_0x70d7('0x32')](_0x3f078d[_0x70d7('0x2e')],qs[_0x70d7('0x49')](_0x5e9b43[_0x70d7('0x30')][_0x70d7('0x49')]));_0x3a6ab8[_0x70d7('0x48')]=_0x3a6ab8[_0x70d7('0x48')][_0x70d7('0x4a')]?_0x3a6ab8[_0x70d7('0x48')]:_0x3f078d[_0x70d7('0x2e')];if(!_0x5e9b43[_0x70d7('0x30')][_0x70d7('0x4b')]('nolimit')){_0x3a6ab8[_0x70d7('0x1a')]=qs[_0x70d7('0x1a')](_0x5e9b43[_0x70d7('0x30')][_0x70d7('0x1a')]);_0x3a6ab8['offset']=qs[_0x70d7('0x1d')](_0x5e9b43['query']['offset']);}_0x3a6ab8[_0x70d7('0x4c')]=qs['sort'](_0x5e9b43[_0x70d7('0x30')][_0x70d7('0x4d')]);_0x3a6ab8['where']=qs[_0x70d7('0x31')](_['pick'](_0x5e9b43[_0x70d7('0x30')],_0x3f078d['filters']),_0x1159d6);if(_0x5e9b43[_0x70d7('0x30')]['filter']){_0x3a6ab8[_0x70d7('0x4e')]=_[_0x70d7('0x4f')](_0x3a6ab8[_0x70d7('0x4e')],{'$or':_[_0x70d7('0x28')](_0x1159d6,function(_0x2ccfed){if(_0x2ccfed['type']!==_0x70d7('0x50')){var _0x3e0f89={};_0x3e0f89[_0x2ccfed[_0x70d7('0x26')]]={'$like':'%'+_0x5e9b43[_0x70d7('0x30')]['filter']+'%'};return _0x3e0f89;}})});}_0x3a6ab8=_[_0x70d7('0x4f')]({},_0x3a6ab8,_0x5e9b43['options']);var _0x2df5d4={'where':_0x3a6ab8[_0x70d7('0x4e')]};return db[_0x70d7('0x29')][_0x70d7('0x1c')](_0x2df5d4)[_0x70d7('0x22')](function(_0x85cd99){_0x1ce4a0[_0x70d7('0x1c')]=_0x85cd99;if(_0x5e9b43['query'][_0x70d7('0x51')]){_0x3a6ab8[_0x70d7('0x52')]=[{'all':!![]}];}return db[_0x70d7('0x29')][_0x70d7('0x53')](_0x3a6ab8);})[_0x70d7('0x22')](function(_0x1d9e04){_0x1ce4a0[_0x70d7('0x54')]=_0x1d9e04;return _0x1ce4a0;})['then'](respondWithFilteredResult(_0x4fb48d,_0x3a6ab8))['catch'](handleError(_0x4fb48d,null));};exports[_0x70d7('0x55')]=function(_0x24e3b4,_0x200ecf){var _0x2be593={'raw':!![],'where':{'id':_0x24e3b4['params']['id']}},_0x247b20={};_0x247b20[_0x70d7('0x2e')]=_[_0x70d7('0x2f')](db[_0x70d7('0x29')]['rawAttributes']);_0x247b20['query']=_['keys'](_0x24e3b4[_0x70d7('0x30')]);_0x247b20[_0x70d7('0x31')]=_[_0x70d7('0x32')](_0x247b20[_0x70d7('0x2e')],_0x247b20[_0x70d7('0x30')]);_0x2be593[_0x70d7('0x48')]=_['intersection'](_0x247b20['model'],qs[_0x70d7('0x49')](_0x24e3b4['query']['fields']));_0x2be593[_0x70d7('0x48')]=_0x2be593[_0x70d7('0x48')][_0x70d7('0x4a')]?_0x2be593['attributes']:_0x247b20[_0x70d7('0x2e')];if(_0x24e3b4[_0x70d7('0x30')][_0x70d7('0x51')]){_0x2be593[_0x70d7('0x52')]=[{'all':!![]}];}_0x2be593=_['merge']({},_0x2be593,_0x24e3b4[_0x70d7('0x56')]);return db[_0x70d7('0x29')]['find'](_0x2be593)[_0x70d7('0x22')](handleEntityNotFound(_0x200ecf,null))[_0x70d7('0x22')](respondWithResult(_0x200ecf,null))[_0x70d7('0x57')](handleError(_0x200ecf,null));};exports['create']=function(_0x4d89f8,_0x226c83){return db[_0x70d7('0x29')][_0x70d7('0x58')](_0x4d89f8[_0x70d7('0x59')],{})[_0x70d7('0x22')](respondWithResult(_0x226c83,0xc9))[_0x70d7('0x57')](handleError(_0x226c83,null));};exports['update']=function(_0x56b445,_0x11cdfd){if(_0x56b445['body']['id']){delete _0x56b445['body']['id'];}return db[_0x70d7('0x29')][_0x70d7('0x5a')]({'where':{'id':_0x56b445['params']['id']}})[_0x70d7('0x22')](handleEntityNotFound(_0x11cdfd,null))[_0x70d7('0x22')](saveUpdates(_0x56b445[_0x70d7('0x59')],null))[_0x70d7('0x22')](respondWithResult(_0x11cdfd,null))['catch'](handleError(_0x11cdfd,null));};exports['describe']=function(_0x36037d,_0x4a52d2){return db['CmHopper']['describe']()[_0x70d7('0x22')](respondWithResult(_0x4a52d2,null))[_0x70d7('0x57')](handleError(_0x4a52d2,null));};exports[_0x70d7('0x23')]=function(_0x27d16e,_0x3701a2){var _0x3df81f;return db[_0x70d7('0x29')][_0x70d7('0x5a')]({'where':{'id':_0x27d16e[_0x70d7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3701a2,null))[_0x70d7('0x22')](function(_0x4015c4){if(_0x4015c4){return _0x4015c4[_0x70d7('0x23')]()[_0x70d7('0x22')](function(_0x19f9f5){return _0x19f9f5;});}})[_0x70d7('0x22')](function(_0x2a2d83){_0x3df81f=_0x2a2d83;if(_0x2a2d83){if(_0x2a2d83[_0x70d7('0x5c')]||_0x2a2d83[_0x70d7('0x5d')]){return db[_0x2a2d83['VoiceQueueId']?_0x70d7('0x5e'):'Campaign'][_0x70d7('0x5a')]({'where':{'id':_0x2a2d83[_0x70d7('0x5c')]?_0x2a2d83[_0x70d7('0x5c')]:_0x2a2d83['CampaignId']},'attributes':['id',_0x70d7('0x26')],'raw':!![]});}}})[_0x70d7('0x22')](function(_0x25c137){var _0x130c79={};if(_0x25c137){_['merge'](_0x130c79,_[_0x70d7('0x5f')](_0x3df81f['dataValues'],['createdAt',_0x70d7('0x60'),'id']));_0x130c79[_0x70d7('0x61')]=0x15;_0x130c79[_0x70d7('0x62')]=_0x70d7('0x63');_0x130c79[_0x70d7('0x64')]=_0x25c137['name'];_0x130c79['membername']=_0x27d16e[_0x70d7('0x65')]['name'];_0x130c79[_0x70d7('0x66')]=_0x27d16e[_0x70d7('0x65')]['id'];_0x130c79[_0x70d7('0x63')]=!![];_0x130c79[_0x70d7('0x67')]=moment()[_0x70d7('0x68')](_0x70d7('0x69'));_0x130c79[_0x70d7('0x6a')]=_0x3df81f[_0x70d7('0x6b')];_0x130c79[_0x70d7('0x6c')]=_0x3df81f[_0x70d7('0x5c')]?_0x70d7('0x6d'):'ivr';return db[_0x70d7('0x6e')][_0x70d7('0x5a')]({'where':{'id':_0x130c79[_0x70d7('0x6f')]},'attributes':[_0x70d7('0x70'),_0x70d7('0x71')]})['then'](function(_0x454a39){if(!_[_0x70d7('0x72')](_0x3701a2)&&!_['isNil'](_0x454a39[_0x70d7('0x70')])){_0x130c79['calleridname']=_0x454a39[_0x70d7('0x70')];if(!_['isNil'](_0x454a39[_0x70d7('0x71')])){_0x130c79[_0x70d7('0x73')]+='\x20'+_0x454a39[_0x70d7('0x71')];}}})[_0x70d7('0x74')](function(){return db[_0x70d7('0x75')][_0x70d7('0x58')](_0x130c79);});}})['then'](function(){return _0x3701a2[_0x70d7('0x17')](0xcc)['end']();})[_0x70d7('0x57')](handleError(_0x3701a2,null));};exports[_0x70d7('0x76')]=function(_0x38b5ee,_0x14be62,_0x506177){var _0x5ca86d=[];return db['CmContact'][_0x70d7('0x77')]()[_0x70d7('0x22')](function(_0x3f6a8d){_0x5ca86d=_['keys'](_0x3f6a8d);return _0x38b5ee[_0x70d7('0x65')][_0x70d7('0x78')]({'where':{'type':_0x70d7('0x79'),'dialActive':!![],'dialMethod':_0x70d7('0x7a')},'attributes':['id','dialOrderByScheduledAt',_0x70d7('0x7b')],'raw':!![]});})[_0x70d7('0x22')](function(_0x33a7be){if(_0x33a7be&&_0x33a7be[_0x70d7('0x4a')]){return db[_0x70d7('0x7c')][_0x70d7('0x7d')](function(_0x54864c){var _0x1eba38={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x70d7('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x70d7('0x28')](_0x33a7be,'id')},'$or':[{'UserId':null},{'UserId':_0x38b5ee['user']['id']}]};var _0xf33cab={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x33a7be)[_0x70d7('0x7e')]([_0x70d7('0x7b'),0x0])[_0x70d7('0x28')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x38b5ee['user']['id']}]};var _0x33163f={'$or':[_0x1eba38,_0xf33cab]};var _0x4e0d05=[];if(_0x38b5ee[_0x70d7('0x59')][_0x70d7('0x7f')]&&_0x38b5ee[_0x70d7('0x59')][_0x70d7('0x7f')]===_0x70d7('0x80')){if(!_['isEmpty'](_0x38b5ee['body'][_0x70d7('0x81')])){_0x33163f['id']={'$in':_0x38b5ee[_0x70d7('0x59')][_0x70d7('0x81')]};}_0x4e0d05=[[_0x70d7('0x82'),_0x70d7('0x83')],[_0x70d7('0x84'),_0x33a7be[0x0][_0x70d7('0x85')]==='ASC'?_0x70d7('0x86'):_0x70d7('0x83')],db[_0x70d7('0x7c')][_0x70d7('0x87')](_0x70d7('0x88')),['id',_0x70d7('0x86')]];}else{if(!_[_0x70d7('0x89')](_0x38b5ee[_0x70d7('0x59')][_0x70d7('0x81')])){_0x33163f['id']={'$notIn':_0x38b5ee['body'][_0x70d7('0x81')]};}_0x4e0d05=[[_0x70d7('0x82'),_0x70d7('0x86')],[_0x70d7('0x84'),_0x33a7be[0x0][_0x70d7('0x85')]],db[_0x70d7('0x7c')][_0x70d7('0x87')](_0x70d7('0x8a')),['id','ASC']];}return db[_0x70d7('0x29')]['findOne']({'attributes':['id',_0x70d7('0x8b'),_0x70d7('0x8c')],'where':_0x33163f,'order':_0x4e0d05,'transaction':_0x54864c,'lock':_0x54864c[_0x70d7('0x8d')]['UPDATE'],'include':[{'model':db[_0x70d7('0x6e')],'as':_0x70d7('0x8e'),'attributes':_0x5ca86d,'include':[{'model':db[_0x70d7('0x8f')],'as':_0x70d7('0x90'),'attributes':['id',_0x70d7('0x26')]}]},{'model':db[_0x70d7('0x91')],'as':_0x70d7('0x92'),'attributes':['id',_0x70d7('0x26')]},{'model':db[_0x70d7('0x5e')],'as':_0x70d7('0x93'),'attributes':['id',_0x70d7('0x26'),'dialActive']}]})[_0x70d7('0x22')](function(_0x42e4b1){if(_0x42e4b1){return _0x42e4b1[_0x70d7('0x21')]({'UserId':_0x38b5ee[_0x70d7('0x65')]['id']},{'transaction':_0x54864c});}});});}})['then'](handleEntityNotFound(_0x14be62,null))[_0x70d7('0x22')](respondWithResult(_0x14be62,null))['catch'](handleError(_0x14be62,null));};exports[_0x70d7('0x94')]=function(_0x56e6a5,_0x505017,_0x2dbf35){return _0x56e6a5[_0x70d7('0x65')][_0x70d7('0x78')]({'where':{'type':_0x70d7('0x79'),'dialActive':!![],'dialMethod':_0x70d7('0x7a')},'attributes':['id'],'raw':!![]})[_0x70d7('0x22')](function(_0x1c5441){if(_0x1c5441&&_0x1c5441[_0x70d7('0x4a')]){return db[_0x70d7('0x29')][_0x70d7('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x70d7('0x68')](_0x70d7('0x69'))},'VoiceQueueId':{'$in':_[_0x70d7('0x28')](_0x1c5441,'id')},'$or':[{'UserId':null},{'UserId':_0x56e6a5[_0x70d7('0x65')]['id']}]}});}return 0x0;})[_0x70d7('0x22')](function(_0x3ac604){if(!_[_0x70d7('0x72')](_0x3ac604)&&_['isNumber'](_0x3ac604)){return _0x505017[_0x70d7('0x17')](0xc8)[_0x70d7('0x19')]({'contacts':_0x3ac604});}else{logger[_0x70d7('0x24')](_0x70d7('0x95'),_0x70d7('0x94'),0x194,'entity\x20not\x20found');_0x505017[_0x70d7('0x16')](0x194);}})[_0x70d7('0x57')](handleError(_0x505017,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c1a7ff9..fcdb1a6 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 _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0x117c4a,_0x6e441c){var _0xe1cc05=function(_0x46f2c6){while(--_0x46f2c6){_0x117c4a['push'](_0x117c4a['shift']());}};_0xe1cc05(++_0x6e441c);}(_0x33af,0xec));var _0xf33a=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x33af[_0x2a238a];return _0xeef802;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0x6878e0,_0x249f2a){var _0x5697ce=function(_0x2d160e){while(--_0x2d160e){_0x6878e0['push'](_0x6878e0['shift']());}};_0x5697ce(++_0x249f2a);}(_0xd8fb,0x99));var _0xbd8f=function(_0x118f2a,_0x3f8403){_0x118f2a=_0x118f2a-0x0;var _0x57a062=_0xd8fb[_0x118f2a];return _0x57a062;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e5e7ea0..786dbb7 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 _0x2cf2=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','limit','include','map','attributes','model','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','CountReScheduled','GetContactRecallMe','ResetActiveCalls','lodash','util','moment'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0x2cf2,0x183));var _0x22cf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2cf2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x22cf('0x0'));var util=require(_0x22cf('0x1'));var moment=require(_0x22cf('0x2'));var BPromise=require(_0x22cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22cf('0x4'))['db'];var utils=require(_0x22cf('0x5'));var logger=require('../../config/logger')(_0x22cf('0x6'));var config=require(_0x22cf('0x7'));var jayson=require(_0x22cf('0x8'));var client=jayson[_0x22cf('0x9')][_0x22cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56fcc0,_0x37239e,_0x229987){return new BPromise(function(_0xc7070f,_0x5ce649){return client[_0x22cf('0xb')](_0x56fcc0,_0x229987)[_0x22cf('0xc')](function(_0x398d2e){logger[_0x22cf('0xd')](_0x22cf('0xe'),_0x37239e,_0x22cf('0xf'));logger[_0x22cf('0x10')](_0x22cf('0x11'),_0x37239e,_0x22cf('0xf'),JSON[_0x22cf('0x12')](_0x398d2e));if(_0x398d2e[_0x22cf('0x13')]){if(_0x398d2e[_0x22cf('0x13')][_0x22cf('0x14')]===0x1f4){logger[_0x22cf('0x13')](_0x22cf('0xe'),_0x37239e,_0x398d2e[_0x22cf('0x13')][_0x22cf('0x15')]);return _0x5ce649(_0x398d2e[_0x22cf('0x13')][_0x22cf('0x15')]);}logger[_0x22cf('0x13')]('CmHopper,\x20%s,\x20%s',_0x37239e,_0x398d2e[_0x22cf('0x13')][_0x22cf('0x15')]);return _0xc7070f(_0x398d2e[_0x22cf('0x13')][_0x22cf('0x15')]);}else{logger['info'](_0x22cf('0xe'),_0x37239e,_0x22cf('0xf'));_0xc7070f(_0x398d2e[_0x22cf('0x16')][_0x22cf('0x15')]);}})[_0x22cf('0x17')](function(_0xe7a802){logger[_0x22cf('0x13')](_0x22cf('0xe'),_0x37239e,_0xe7a802);_0x5ce649(_0xe7a802);});});}exports[_0x22cf('0x18')]=function(_0x142831){var _0x288606=this;return new Promise(function(_0x2933ee,_0x5b7c0d){return db[_0x22cf('0x19')][_0x22cf('0x1a')]({'raw':_0x142831[_0x22cf('0x1b')]?_0x142831['options']['raw']===undefined?!![]:![]:!![],'where':_0x142831[_0x22cf('0x1b')]?_0x142831[_0x22cf('0x1b')][_0x22cf('0x1c')]||null:null,'attributes':_0x142831[_0x22cf('0x1b')]?_0x142831['options']['attributes']||null:null,'limit':_0x142831[_0x22cf('0x1b')]?_0x142831[_0x22cf('0x1b')][_0x22cf('0x1d')]||null:null,'include':_0x142831[_0x22cf('0x1b')]?_0x142831['options'][_0x22cf('0x1e')]?_[_0x22cf('0x1f')](_0x142831[_0x22cf('0x1b')]['include'],function(_0x33be9c){return{'model':db[_0x33be9c['model']],'as':_0x33be9c['as'],'attributes':_0x33be9c[_0x22cf('0x20')],'include':_0x33be9c[_0x22cf('0x1e')]?_[_0x22cf('0x1f')](_0x33be9c[_0x22cf('0x1e')],function(_0x29f826){return{'model':db[_0x29f826[_0x22cf('0x21')]],'as':_0x29f826['as'],'attributes':_0x29f826[_0x22cf('0x20')],'include':_0x29f826[_0x22cf('0x1e')]?_['map'](_0x29f826['include'],function(_0x5cf5e3){return{'model':db[_0x5cf5e3[_0x22cf('0x21')]],'as':_0x5cf5e3['as'],'attributes':_0x5cf5e3[_0x22cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x22cf('0xc')](function(_0x37b8f1){logger[_0x22cf('0xd')]('GetCmHopper',_0x142831);logger['debug'](_0x22cf('0x18'),_0x142831,JSON[_0x22cf('0x12')](_0x37b8f1));_0x2933ee(_0x37b8f1);})[_0x22cf('0x17')](function(_0xbb3b96){logger['error'](_0x22cf('0x18'),_0xbb3b96[_0x22cf('0x15')],_0x142831);_0x5b7c0d(_0x288606[_0x22cf('0x13')](0x1f4,_0xbb3b96[_0x22cf('0x15')]));});});};exports[_0x22cf('0x22')]=function(_0x37e55b){var _0x38e08d=this;return new Promise(function(_0x58f0ff,_0x3561c3){return db[_0x22cf('0x19')][_0x22cf('0x23')]({'raw':_0x37e55b[_0x22cf('0x1b')]?_0x37e55b[_0x22cf('0x1b')][_0x22cf('0x24')]===undefined?!![]:![]:!![],'where':_0x37e55b[_0x22cf('0x1b')]?_0x37e55b[_0x22cf('0x1b')]['where']||null:null,'attributes':_0x37e55b[_0x22cf('0x1b')]?_0x37e55b['options'][_0x22cf('0x20')]||null:null,'include':_0x37e55b[_0x22cf('0x1b')]?_0x37e55b[_0x22cf('0x1b')][_0x22cf('0x1e')]?_[_0x22cf('0x1f')](_0x37e55b['options'][_0x22cf('0x1e')],function(_0x17e844){return{'model':db[_0x17e844[_0x22cf('0x21')]],'as':_0x17e844['as'],'attributes':_0x17e844['attributes'],'include':_0x17e844[_0x22cf('0x1e')]?_['map'](_0x17e844['include'],function(_0x30ecb1){return{'model':db[_0x30ecb1[_0x22cf('0x21')]],'as':_0x30ecb1['as'],'attributes':_0x30ecb1[_0x22cf('0x20')],'include':_0x30ecb1[_0x22cf('0x1e')]?_[_0x22cf('0x1f')](_0x30ecb1[_0x22cf('0x1e')],function(_0x4e56fa){return{'model':db[_0x4e56fa['model']],'as':_0x4e56fa['as'],'attributes':_0x4e56fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x22cf('0xc')](function(_0x31faa8){logger[_0x22cf('0xd')](_0x22cf('0x22'),_0x37e55b);logger[_0x22cf('0x10')]('ShowCmHopper',_0x37e55b,JSON[_0x22cf('0x12')](_0x31faa8));_0x58f0ff(_0x31faa8);})[_0x22cf('0x17')](function(_0x4eca86){logger[_0x22cf('0x13')](_0x22cf('0x22'),_0x4eca86[_0x22cf('0x15')],_0x37e55b);_0x3561c3(_0x38e08d['error'](0x1f4,_0x4eca86[_0x22cf('0x15')]));});});};exports[_0x22cf('0x25')]=function(_0x4e0355){var _0x5e3e3c=this;return new Promise(function(_0x34b85e,_0x5541e0){return db[_0x22cf('0x19')][_0x22cf('0x26')](_0x4e0355['body'],{'raw':_0x4e0355[_0x22cf('0x1b')]?_0x4e0355[_0x22cf('0x1b')][_0x22cf('0x24')]===undefined?!![]:![]:!![]})[_0x22cf('0xc')](function(_0x20c5ae){logger[_0x22cf('0xd')](_0x22cf('0x25'),_0x4e0355);logger[_0x22cf('0x10')](_0x22cf('0x25'),_0x4e0355,JSON[_0x22cf('0x12')](_0x20c5ae));_0x34b85e(_0x20c5ae);})[_0x22cf('0x17')](function(_0x1d058a){logger['error']('CreateCmHopper',_0x1d058a[_0x22cf('0x15')],_0x4e0355);_0x5541e0(_0x5e3e3c[_0x22cf('0x13')](0x1f4,_0x1d058a[_0x22cf('0x15')]));});});};exports['UpdateCmHopper']=function(_0x4ee324){var _0x6181ab=this;return new Promise(function(_0x1ca83b,_0x6ea6fd){return db['CmHopper']['update'](_0x4ee324[_0x22cf('0x27')],{'raw':_0x4ee324['options']?_0x4ee324[_0x22cf('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ee324[_0x22cf('0x1b')]?_0x4ee324['options'][_0x22cf('0x1c')]||null:null,'attributes':_0x4ee324['options']?_0x4ee324[_0x22cf('0x1b')]['attributes']||null:null,'limit':_0x4ee324[_0x22cf('0x1b')]?_0x4ee324[_0x22cf('0x1b')][_0x22cf('0x1d')]||null:null})[_0x22cf('0xc')](function(_0x494b4e){logger[_0x22cf('0xd')](_0x22cf('0x28'),_0x4ee324);logger['info'](_0x22cf('0x29'),JSON[_0x22cf('0x12')](_0x4ee324['options']['where']),_0x4ee324[_0x22cf('0x27')][_0x22cf('0x2a')]);logger[_0x22cf('0x10')](_0x22cf('0x28'),_0x4ee324,JSON[_0x22cf('0x12')](_0x494b4e));_0x1ca83b(_0x494b4e);})[_0x22cf('0x17')](function(_0x48182c){logger[_0x22cf('0x13')]('UpdateCmHopper',_0x48182c[_0x22cf('0x15')],_0x4ee324);_0x6ea6fd(_0x6181ab['error'](0x1f4,_0x48182c[_0x22cf('0x15')]));});});};exports[_0x22cf('0x2b')]=function(_0x1d6f23){var _0xd98254=this;return new Promise(function(_0x2fc3b9,_0x3d488b){return db['CmHopper'][_0x22cf('0x2c')]({'where':_0x1d6f23[_0x22cf('0x1b')]?_0x1d6f23[_0x22cf('0x1b')][_0x22cf('0x1c')]||null:null})[_0x22cf('0xc')](function(_0x3f7847){logger[_0x22cf('0xd')](_0x22cf('0x2b'),_0x1d6f23);logger[_0x22cf('0x10')](_0x22cf('0x2b'),_0x1d6f23,JSON[_0x22cf('0x12')](_0x3f7847));_0x2fc3b9(_0x3f7847);})[_0x22cf('0x17')](function(_0x26eaa7){logger[_0x22cf('0x13')](_0x22cf('0x2b'),_0x26eaa7[_0x22cf('0x15')],_0x1d6f23);_0x3d488b(_0xd98254['error'](0x1f4,_0x26eaa7[_0x22cf('0x15')]));});});};exports[_0x22cf('0x2d')]=function(_0x518033){var _0x2c2b15=this;return new Promise(function(_0x189d97,_0xc8d1e7){return db[_0x22cf('0x2e')][_0x22cf('0x2f')]()['then'](function(_0x188c53){return db[_0x22cf('0x30')]['transaction'](function(_0x52db04){return db['CmHopper'][_0x22cf('0x1a')]({'where':_0x518033[_0x22cf('0x1b')]?_0x518033[_0x22cf('0x1b')]['where']||null:null,'attributes':_0x518033[_0x22cf('0x1b')]?_0x518033['options'][_0x22cf('0x20')]||null:null,'limit':_0x518033[_0x22cf('0x1b')]?_0x518033['options'][_0x22cf('0x1d')]||null:null,'order':_0x518033['options']?_0x518033['options'][_0x22cf('0x31')]||null:null,'transaction':_0x52db04,'lock':_0x52db04[_0x22cf('0x32')][_0x22cf('0x33')],'include':[{'model':db['CmContact'],'as':_0x22cf('0x34'),'attributes':_[_0x22cf('0x35')](_0x188c53)},{'model':db[_0x22cf('0x36')],'as':_0x22cf('0x37'),'attributes':['id',_0x22cf('0x38'),_0x22cf('0x39')]}]})['then'](function(_0x153f15){var _0x3282ed=[];var _0x5234ac=[];for(var _0x39195b=0x0;_0x39195b<_0x153f15[_0x22cf('0x3a')];_0x39195b+=0x1){var _0x419fcf=_0x153f15[_0x39195b][_0x22cf('0x3b')];if(_0x419fcf===null){_0x3282ed['push'](_0x153f15[_0x39195b][_0x22cf('0x3c')](_0x518033['body'],{'transaction':_0x52db04}));}else if(!_0x5234ac[_0x22cf('0x3d')](_0x419fcf)){_0x5234ac[_0x22cf('0x3e')](_0x419fcf);_0x3282ed[_0x22cf('0x3e')](_0x153f15[_0x39195b]['update'](_0x518033['body'],{'transaction':_0x52db04}));}}return BPromise[_0x22cf('0x3f')](_0x3282ed);});})['then'](function(_0x39e3fb){logger[_0x22cf('0xd')]('GetContactDialer',_0x518033);if(_0x39e3fb['length']>0x0){logger[_0x22cf('0xd')](_0x22cf('0x40'),_0x39e3fb[0x0][_0x22cf('0x41')]['id'],_0x39e3fb[0x0][_0x22cf('0x41')][_0x22cf('0x42')],_0x39e3fb[0x0]['dataValues']['active']);}logger[_0x22cf('0x10')](_0x22cf('0x2d'),_0x518033,JSON['stringify'](_0x39e3fb));_0x189d97(_0x39e3fb);})['catch'](function(_0x3c8331){logger[_0x22cf('0x13')](_0x22cf('0x2d'),_0x3c8331[_0x22cf('0x15')],_0x518033);_0xc8d1e7(_0x2c2b15[_0x22cf('0x13')](0x1f4,_0x3c8331[_0x22cf('0x15')]));});});});};exports[_0x22cf('0x43')]=function(_0x4a9dd7){var _0x328791=this;return new Promise(function(_0x2c69ff,_0x1d25e2){return db['sequelize'][_0x22cf('0x44')](function(_0x2b4c39){return db[_0x22cf('0x45')]['create'](_0x4a9dd7['body'],{'raw':_0x4a9dd7[_0x22cf('0x1b')]?_0x4a9dd7[_0x22cf('0x1b')][_0x22cf('0x24')]===undefined?!![]:![]:!![],'transaction':_0x2b4c39})[_0x22cf('0xc')](function(){logger[_0x22cf('0xd')](_0x22cf('0x46'),JSON[_0x22cf('0x12')](_0x4a9dd7[_0x22cf('0x1b')][_0x22cf('0x1c')]),_0x4a9dd7[_0x22cf('0x1b')][_0x22cf('0x1c')][_0x22cf('0x2a')]);return db[_0x22cf('0x19')][_0x22cf('0x2c')]({'where':_0x4a9dd7[_0x22cf('0x1b')]?_0x4a9dd7['options'][_0x22cf('0x1c')]||null:null,'transaction':_0x2b4c39});});})[_0x22cf('0xc')](function(_0x5859af){logger[_0x22cf('0xd')](_0x22cf('0x43'),_0x4a9dd7);logger[_0x22cf('0x10')]('MoveContactManagedDialer',_0x4a9dd7,JSON[_0x22cf('0x12')](_0x5859af));_0x2c69ff(_0x5859af);})[_0x22cf('0x17')](function(_0x1957eb){logger['error'](_0x22cf('0x43'),_0x1957eb['message'],_0x4a9dd7);_0x1d25e2(_0x328791['error'](0x1f4,_0x1957eb[_0x22cf('0x15')]));});});};exports['CountReScheduled']=function(_0x41ad51){var _0x4da892=this;return new Promise(function(_0x1a2ec2,_0x5a0079){return db['CmHopper'][_0x22cf('0x1a')]({'raw':_0x41ad51[_0x22cf('0x1b')]?_0x41ad51['options'][_0x22cf('0x24')]===undefined?!![]:![]:!![],'where':_0x41ad51['options']?_0x41ad51[_0x22cf('0x1b')][_0x22cf('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x22cf('0x47'),db[_0x22cf('0x30')]['fn']('IF',db[_0x22cf('0x30')]['literal']('`scheduledat`\x20>=\x20'+util['format'](_0x22cf('0x48'),moment()[_0x22cf('0x49')](_0x22cf('0x4a')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x22cf('0xc')](function(_0x4a0d14){logger[_0x22cf('0xd')](_0x22cf('0x4b'),_0x41ad51);logger['debug'](_0x22cf('0x4b'),_0x41ad51,JSON['stringify'](_0x4a0d14));_0x1a2ec2(_0x4a0d14);})['catch'](function(_0x5ab62d){logger[_0x22cf('0x13')](_0x22cf('0x4b'),_0x5ab62d[_0x22cf('0x15')],_0x41ad51);_0x5a0079(_0x4da892['error'](0x1f4,_0x5ab62d[_0x22cf('0x15')]));});});};exports['GetContactRecallMe']=function(_0x1d90fd){var _0x3f6937=this;return new Promise(function(_0x706ccf,_0x2ddf93){return db['CmContact'][_0x22cf('0x2f')]()[_0x22cf('0xc')](function(_0x28dbcf){return db['sequelize'][_0x22cf('0x44')](function(_0x31309f){return db[_0x22cf('0x19')][_0x22cf('0x1a')]({'where':_0x1d90fd['options']?_0x1d90fd['options'][_0x22cf('0x1c')]||null:null,'attributes':_0x1d90fd[_0x22cf('0x1b')]?_0x1d90fd[_0x22cf('0x1b')][_0x22cf('0x20')]||null:null,'limit':0x1,'order':_0x1d90fd['options']?_0x1d90fd['options'][_0x22cf('0x31')]||null:null,'group':db[_0x22cf('0x19')][_0x22cf('0x3b')],'transaction':_0x31309f,'lock':_0x31309f['LOCK'][_0x22cf('0x33')],'include':_0x1d90fd[_0x22cf('0x1b')]?_0x1d90fd['options'][_0x22cf('0x1e')]?_[_0x22cf('0x1f')](_0x1d90fd[_0x22cf('0x1b')][_0x22cf('0x1e')],function(_0x32f12b){return{'model':db[_0x32f12b[_0x22cf('0x21')]],'as':_0x32f12b['as'],'attributes':_0x32f12b[_0x22cf('0x20')],'include':_0x32f12b['include']?_[_0x22cf('0x1f')](_0x32f12b[_0x22cf('0x1e')],function(_0x16d8ad){return{'model':db[_0x16d8ad[_0x22cf('0x21')]],'as':_0x16d8ad['as'],'attributes':_0x16d8ad[_0x22cf('0x20')],'include':_0x16d8ad[_0x22cf('0x1e')]?_[_0x22cf('0x1f')](_0x16d8ad[_0x22cf('0x1e')],function(_0x51f356){return{'model':db[_0x51f356['model']],'as':_0x51f356['as'],'attributes':_0x51f356[_0x22cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x22cf('0xc')](function(_0x4e14de){var _0x9c1849=[];for(var _0x741a4d=0x0;_0x741a4d<_0x4e14de['length'];_0x741a4d+=0x1){_0x9c1849[_0x22cf('0x3e')](_0x4e14de[_0x741a4d][_0x22cf('0x3c')](_0x1d90fd[_0x22cf('0x27')],{'transaction':_0x31309f}));}return BPromise[_0x22cf('0x3f')](_0x9c1849);});})[_0x22cf('0xc')](function(_0x471b46){logger[_0x22cf('0xd')](_0x22cf('0x4c'),_0x1d90fd);logger[_0x22cf('0x10')](_0x22cf('0x4c'),_0x1d90fd,JSON[_0x22cf('0x12')](_0x471b46));_0x706ccf(_0x471b46);})[_0x22cf('0x17')](function(_0x2a5cf5){logger[_0x22cf('0x13')]('GetContactRecallMe',_0x2a5cf5[_0x22cf('0x15')],_0x1d90fd);_0x2ddf93(_0x3f6937[_0x22cf('0x13')](0x1f4,_0x2a5cf5[_0x22cf('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x459860){var _0x478456=this;return new Promise(function(_0x4b9a23,_0x29f1eb){db['CmContact']['describe']()[_0x22cf('0xc')](function(_0x2b2f0b){return db[_0x22cf('0x19')][_0x22cf('0x1a')]({'raw':_0x459860['options']?_0x459860[_0x22cf('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x459860[_0x22cf('0x1b')]?_0x459860[_0x22cf('0x1b')][_0x22cf('0x1c')]||null:null,'attributes':_0x459860['options']?_0x459860['options'][_0x22cf('0x20')]||null:null,'limit':_0x459860[_0x22cf('0x1b')]?_0x459860[_0x22cf('0x1b')][_0x22cf('0x1d')]||null:null,'include':_0x459860[_0x22cf('0x1b')]?_0x459860[_0x22cf('0x1b')][_0x22cf('0x1e')]?_['map'](_0x459860['options'][_0x22cf('0x1e')],function(_0x535aa8){return{'model':db[_0x535aa8[_0x22cf('0x21')]],'as':_0x535aa8['as'],'attributes':_0x535aa8['as']===_0x22cf('0x34')?_[_0x22cf('0x35')](_0x2b2f0b):_0x535aa8[_0x22cf('0x20')],'include':_0x535aa8['include']?_[_0x22cf('0x1f')](_0x535aa8['include'],function(_0x3d15c3){return{'model':db[_0x3d15c3[_0x22cf('0x21')]],'as':_0x3d15c3['as'],'attributes':_0x3d15c3[_0x22cf('0x20')],'include':_0x3d15c3[_0x22cf('0x1e')]?_['map'](_0x3d15c3[_0x22cf('0x1e')],function(_0xeb27b5){return{'model':db[_0xeb27b5[_0x22cf('0x21')]],'as':_0xeb27b5['as'],'attributes':_0xeb27b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x22cf('0xc')](function(_0x41f6fd){logger[_0x22cf('0xd')](_0x22cf('0x18'),_0x459860);logger[_0x22cf('0x10')](_0x22cf('0x18'),_0x459860,JSON[_0x22cf('0x12')](_0x41f6fd));_0x4b9a23(_0x41f6fd);})[_0x22cf('0x17')](function(_0x271f97){logger[_0x22cf('0x13')](_0x22cf('0x18'),_0x271f97[_0x22cf('0x15')],_0x459860);_0x29f1eb(_0x478456[_0x22cf('0x13')](0x1f4,_0x271f97[_0x22cf('0x15')]));});});});};exports['ResetActiveCalls']=function(_0x106f29){var _0x47dd67=this;return new Promise(function(_0x3177b5,_0x4c8a31){return db[_0x22cf('0x30')][_0x22cf('0x44')](function(_0x1b18f2){return db['CmHopper']['update']({'active':![]},{'where':{},'transaction':_0x1b18f2})[_0x22cf('0xc')](function(_0x28252c){logger['info']('ResetActiveCalls',_0x106f29);logger[_0x22cf('0x10')](_0x22cf('0x4d'),_0x106f29,JSON[_0x22cf('0x12')](_0x28252c));_0x3177b5(_0x28252c);})[_0x22cf('0x17')](function(_0x598654){logger[_0x22cf('0x13')]('ResetActiveCalls',_0x598654[_0x22cf('0x15')],_0x106f29);_0x4c8a31(_0x47dd67['error'](0x1f4,_0x598654[_0x22cf('0x15')]));});});});}; \ No newline at end of file +var _0xbe6c=['request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','name','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','ResetActiveCalls','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x3c5bf1,_0x30bb33){var _0x2dc4d3=function(_0x16c175){while(--_0x16c175){_0x3c5bf1['push'](_0x3c5bf1['shift']());}};_0x2dc4d3(++_0x30bb33);}(_0xbe6c,0x169));var _0xcbe6=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xbe6c[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xcbe6('0x0'));var util=require(_0xcbe6('0x1'));var moment=require('moment');var BPromise=require(_0xcbe6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe6('0x3'));var db=require(_0xcbe6('0x4'))['db'];var utils=require(_0xcbe6('0x5'));var logger=require('../../config/logger')(_0xcbe6('0x6'));var config=require(_0xcbe6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcbe6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19597d,_0x2788df,_0x29ede4){return new BPromise(function(_0x535f4d,_0x427678){return client[_0xcbe6('0x9')](_0x19597d,_0x29ede4)['then'](function(_0x493ef4){logger['info'](_0xcbe6('0xa'),_0x2788df,_0xcbe6('0xb'));logger[_0xcbe6('0xc')](_0xcbe6('0xd'),_0x2788df,_0xcbe6('0xb'),JSON[_0xcbe6('0xe')](_0x493ef4));if(_0x493ef4['error']){if(_0x493ef4[_0xcbe6('0xf')][_0xcbe6('0x10')]===0x1f4){logger[_0xcbe6('0xf')]('CmHopper,\x20%s,\x20%s',_0x2788df,_0x493ef4['error'][_0xcbe6('0x11')]);return _0x427678(_0x493ef4[_0xcbe6('0xf')][_0xcbe6('0x11')]);}logger[_0xcbe6('0xf')](_0xcbe6('0xa'),_0x2788df,_0x493ef4[_0xcbe6('0xf')][_0xcbe6('0x11')]);return _0x535f4d(_0x493ef4[_0xcbe6('0xf')]['message']);}else{logger[_0xcbe6('0x12')]('CmHopper,\x20%s,\x20%s',_0x2788df,_0xcbe6('0xb'));_0x535f4d(_0x493ef4['result'][_0xcbe6('0x11')]);}})[_0xcbe6('0x13')](function(_0x558126){logger['error'](_0xcbe6('0xa'),_0x2788df,_0x558126);_0x427678(_0x558126);});});}exports['GetCmHopper']=function(_0x2a0fb6){var _0x53afec=this;return new Promise(function(_0x1ee2b7,_0x213f7c){return db[_0xcbe6('0x14')][_0xcbe6('0x15')]({'raw':_0x2a0fb6[_0xcbe6('0x16')]?_0x2a0fb6['options'][_0xcbe6('0x17')]===undefined?!![]:![]:!![],'where':_0x2a0fb6['options']?_0x2a0fb6[_0xcbe6('0x16')][_0xcbe6('0x18')]||null:null,'attributes':_0x2a0fb6[_0xcbe6('0x16')]?_0x2a0fb6[_0xcbe6('0x16')]['attributes']||null:null,'limit':_0x2a0fb6[_0xcbe6('0x16')]?_0x2a0fb6['options'][_0xcbe6('0x19')]||null:null,'include':_0x2a0fb6[_0xcbe6('0x16')]?_0x2a0fb6[_0xcbe6('0x16')][_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x2a0fb6['options'][_0xcbe6('0x1a')],function(_0x412434){return{'model':db[_0x412434[_0xcbe6('0x1c')]],'as':_0x412434['as'],'attributes':_0x412434['attributes'],'include':_0x412434[_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x412434['include'],function(_0x1630c1){return{'model':db[_0x1630c1[_0xcbe6('0x1c')]],'as':_0x1630c1['as'],'attributes':_0x1630c1['attributes'],'include':_0x1630c1[_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x1630c1['include'],function(_0x53b407){return{'model':db[_0x53b407[_0xcbe6('0x1c')]],'as':_0x53b407['as'],'attributes':_0x53b407[_0xcbe6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcbe6('0x1e')](function(_0x31918c){logger[_0xcbe6('0x12')](_0xcbe6('0x1f'),_0x2a0fb6);logger[_0xcbe6('0xc')]('GetCmHopper',_0x2a0fb6,JSON[_0xcbe6('0xe')](_0x31918c));_0x1ee2b7(_0x31918c);})[_0xcbe6('0x13')](function(_0x4b6bd7){logger[_0xcbe6('0xf')]('GetCmHopper',_0x4b6bd7[_0xcbe6('0x11')],_0x2a0fb6);_0x213f7c(_0x53afec['error'](0x1f4,_0x4b6bd7[_0xcbe6('0x11')]));});});};exports[_0xcbe6('0x20')]=function(_0x5c249a){var _0x1db026=this;return new Promise(function(_0x43022c,_0x290090){return db[_0xcbe6('0x14')][_0xcbe6('0x21')]({'raw':_0x5c249a[_0xcbe6('0x16')]?_0x5c249a[_0xcbe6('0x16')][_0xcbe6('0x17')]===undefined?!![]:![]:!![],'where':_0x5c249a['options']?_0x5c249a[_0xcbe6('0x16')][_0xcbe6('0x18')]||null:null,'attributes':_0x5c249a[_0xcbe6('0x16')]?_0x5c249a[_0xcbe6('0x16')][_0xcbe6('0x1d')]||null:null,'include':_0x5c249a[_0xcbe6('0x16')]?_0x5c249a['options'][_0xcbe6('0x1a')]?_['map'](_0x5c249a[_0xcbe6('0x16')][_0xcbe6('0x1a')],function(_0x1e1ef7){return{'model':db[_0x1e1ef7[_0xcbe6('0x1c')]],'as':_0x1e1ef7['as'],'attributes':_0x1e1ef7[_0xcbe6('0x1d')],'include':_0x1e1ef7[_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x1e1ef7[_0xcbe6('0x1a')],function(_0x412fcd){return{'model':db[_0x412fcd[_0xcbe6('0x1c')]],'as':_0x412fcd['as'],'attributes':_0x412fcd[_0xcbe6('0x1d')],'include':_0x412fcd['include']?_[_0xcbe6('0x1b')](_0x412fcd['include'],function(_0x5f2168){return{'model':db[_0x5f2168[_0xcbe6('0x1c')]],'as':_0x5f2168['as'],'attributes':_0x5f2168[_0xcbe6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e140b){logger['info'](_0xcbe6('0x20'),_0x5c249a);logger[_0xcbe6('0xc')](_0xcbe6('0x20'),_0x5c249a,JSON[_0xcbe6('0xe')](_0x1e140b));_0x43022c(_0x1e140b);})[_0xcbe6('0x13')](function(_0x16938c){logger['error'](_0xcbe6('0x20'),_0x16938c[_0xcbe6('0x11')],_0x5c249a);_0x290090(_0x1db026[_0xcbe6('0xf')](0x1f4,_0x16938c[_0xcbe6('0x11')]));});});};exports[_0xcbe6('0x22')]=function(_0x2c8c54){var _0x1713d3=this;return new Promise(function(_0x59fe57,_0x4e327b){return db[_0xcbe6('0x14')][_0xcbe6('0x23')](_0x2c8c54[_0xcbe6('0x24')],{'raw':_0x2c8c54['options']?_0x2c8c54['options'][_0xcbe6('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x24ff33){logger[_0xcbe6('0x12')](_0xcbe6('0x22'),_0x2c8c54);logger[_0xcbe6('0xc')](_0xcbe6('0x22'),_0x2c8c54,JSON[_0xcbe6('0xe')](_0x24ff33));_0x59fe57(_0x24ff33);})[_0xcbe6('0x13')](function(_0x50c6f0){logger['error'](_0xcbe6('0x22'),_0x50c6f0[_0xcbe6('0x11')],_0x2c8c54);_0x4e327b(_0x1713d3[_0xcbe6('0xf')](0x1f4,_0x50c6f0[_0xcbe6('0x11')]));});});};exports[_0xcbe6('0x25')]=function(_0x11de91){var _0x354082=this;return new Promise(function(_0x4d643d,_0x5e1a0e){return db['CmHopper'][_0xcbe6('0x26')](_0x11de91[_0xcbe6('0x24')],{'raw':_0x11de91[_0xcbe6('0x16')]?_0x11de91[_0xcbe6('0x16')][_0xcbe6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11de91['options']?_0x11de91['options'][_0xcbe6('0x18')]||null:null,'attributes':_0x11de91[_0xcbe6('0x16')]?_0x11de91['options']['attributes']||null:null,'limit':_0x11de91[_0xcbe6('0x16')]?_0x11de91[_0xcbe6('0x16')][_0xcbe6('0x19')]||null:null})[_0xcbe6('0x1e')](function(_0x4bb870){logger[_0xcbe6('0x12')](_0xcbe6('0x25'),_0x11de91);logger[_0xcbe6('0x12')](_0xcbe6('0x27'),JSON[_0xcbe6('0xe')](_0x11de91['options']['where']),_0x11de91[_0xcbe6('0x24')][_0xcbe6('0x28')]);logger[_0xcbe6('0xc')]('UpdateCmHopper',_0x11de91,JSON[_0xcbe6('0xe')](_0x4bb870));_0x4d643d(_0x4bb870);})[_0xcbe6('0x13')](function(_0x332ade){logger['error']('UpdateCmHopper',_0x332ade['message'],_0x11de91);_0x5e1a0e(_0x354082[_0xcbe6('0xf')](0x1f4,_0x332ade[_0xcbe6('0x11')]));});});};exports[_0xcbe6('0x29')]=function(_0x2b8d){var _0x195737=this;return new Promise(function(_0xc6dfae,_0x6fcb00){return db['CmHopper'][_0xcbe6('0x2a')]({'where':_0x2b8d[_0xcbe6('0x16')]?_0x2b8d[_0xcbe6('0x16')][_0xcbe6('0x18')]||null:null})[_0xcbe6('0x1e')](function(_0x2f16ad){logger[_0xcbe6('0x12')](_0xcbe6('0x29'),_0x2b8d);logger[_0xcbe6('0xc')](_0xcbe6('0x29'),_0x2b8d,JSON[_0xcbe6('0xe')](_0x2f16ad));_0xc6dfae(_0x2f16ad);})['catch'](function(_0x247cab){logger['error'](_0xcbe6('0x29'),_0x247cab[_0xcbe6('0x11')],_0x2b8d);_0x6fcb00(_0x195737[_0xcbe6('0xf')](0x1f4,_0x247cab[_0xcbe6('0x11')]));});});};exports[_0xcbe6('0x2b')]=function(_0x3d8eff){var _0x321147=this;return new Promise(function(_0x4462fd,_0xdeb831){return db[_0xcbe6('0x2c')][_0xcbe6('0x2d')]()[_0xcbe6('0x1e')](function(_0x329824){return db[_0xcbe6('0x2e')][_0xcbe6('0x2f')](function(_0x598f23){return db['CmHopper'][_0xcbe6('0x15')]({'where':_0x3d8eff[_0xcbe6('0x16')]?_0x3d8eff[_0xcbe6('0x16')]['where']||null:null,'attributes':_0x3d8eff[_0xcbe6('0x16')]?_0x3d8eff['options'][_0xcbe6('0x1d')]||null:null,'limit':_0x3d8eff[_0xcbe6('0x16')]?_0x3d8eff[_0xcbe6('0x16')]['limit']||null:null,'order':_0x3d8eff[_0xcbe6('0x16')]?_0x3d8eff['options'][_0xcbe6('0x30')]||null:null,'transaction':_0x598f23,'lock':_0x598f23[_0xcbe6('0x31')][_0xcbe6('0x32')],'include':[{'model':db['CmContact'],'as':_0xcbe6('0x33'),'attributes':_[_0xcbe6('0x34')](_0x329824)},{'model':db[_0xcbe6('0x35')],'as':'Agent','attributes':['id',_0xcbe6('0x36'),'voicePause']}]})[_0xcbe6('0x1e')](function(_0x13420){var _0x289cce=[];var _0x40bf2b=[];for(var _0x3f1142=0x0;_0x3f1142<_0x13420[_0xcbe6('0x37')];_0x3f1142+=0x1){var _0x2e76b2=_0x13420[_0x3f1142][_0xcbe6('0x38')];if(_0x2e76b2===null){_0x289cce[_0xcbe6('0x39')](_0x13420[_0x3f1142]['update'](_0x3d8eff['body'],{'transaction':_0x598f23}));}else if(!_0x40bf2b[_0xcbe6('0x3a')](_0x2e76b2)){_0x40bf2b['push'](_0x2e76b2);_0x289cce[_0xcbe6('0x39')](_0x13420[_0x3f1142][_0xcbe6('0x26')](_0x3d8eff[_0xcbe6('0x24')],{'transaction':_0x598f23}));}}return BPromise[_0xcbe6('0x3b')](_0x289cce);});})['then'](function(_0x5b2b57){logger[_0xcbe6('0x12')](_0xcbe6('0x2b'),_0x3d8eff);if(_0x5b2b57[_0xcbe6('0x37')]>0x0){logger[_0xcbe6('0x12')](_0xcbe6('0x3c'),_0x5b2b57[0x0][_0xcbe6('0x3d')]['id'],_0x5b2b57[0x0][_0xcbe6('0x3d')]['ContactId'],_0x5b2b57[0x0][_0xcbe6('0x3d')]['active']);}logger[_0xcbe6('0xc')]('GetContactDialer',_0x3d8eff,JSON['stringify'](_0x5b2b57));_0x4462fd(_0x5b2b57);})[_0xcbe6('0x13')](function(_0x43cfb3){logger[_0xcbe6('0xf')](_0xcbe6('0x2b'),_0x43cfb3['message'],_0x3d8eff);_0xdeb831(_0x321147[_0xcbe6('0xf')](0x1f4,_0x43cfb3[_0xcbe6('0x11')]));});});});};exports[_0xcbe6('0x3e')]=function(_0x34f1d3){var _0x437e4d=this;return new Promise(function(_0x126df9,_0x2bddf8){return db['sequelize'][_0xcbe6('0x2f')](function(_0x1bc60d){return db[_0xcbe6('0x3f')][_0xcbe6('0x23')](_0x34f1d3['body'],{'raw':_0x34f1d3[_0xcbe6('0x16')]?_0x34f1d3[_0xcbe6('0x16')][_0xcbe6('0x17')]===undefined?!![]:![]:!![],'transaction':_0x1bc60d})[_0xcbe6('0x1e')](function(){logger[_0xcbe6('0x12')](_0xcbe6('0x40'),JSON['stringify'](_0x34f1d3[_0xcbe6('0x16')][_0xcbe6('0x18')]),_0x34f1d3[_0xcbe6('0x16')]['where'][_0xcbe6('0x28')]);return db[_0xcbe6('0x14')]['destroy']({'where':_0x34f1d3[_0xcbe6('0x16')]?_0x34f1d3[_0xcbe6('0x16')][_0xcbe6('0x18')]||null:null,'transaction':_0x1bc60d});});})[_0xcbe6('0x1e')](function(_0x48cae1){logger['info'](_0xcbe6('0x3e'),_0x34f1d3);logger['debug'](_0xcbe6('0x3e'),_0x34f1d3,JSON['stringify'](_0x48cae1));_0x126df9(_0x48cae1);})[_0xcbe6('0x13')](function(_0x31d3ee){logger['error'](_0xcbe6('0x3e'),_0x31d3ee['message'],_0x34f1d3);_0x2bddf8(_0x437e4d[_0xcbe6('0xf')](0x1f4,_0x31d3ee[_0xcbe6('0x11')]));});});};exports[_0xcbe6('0x41')]=function(_0x275bad){var _0x5b1358=this;return new Promise(function(_0x39dd31,_0x33b622){return db[_0xcbe6('0x14')][_0xcbe6('0x15')]({'raw':_0x275bad[_0xcbe6('0x16')]?_0x275bad[_0xcbe6('0x16')][_0xcbe6('0x17')]===undefined?!![]:![]:!![],'where':_0x275bad[_0xcbe6('0x16')]?_0x275bad['options'][_0xcbe6('0x18')]||null:null,'attributes':[[db[_0xcbe6('0x2e')]['fn'](_0xcbe6('0x42'),db[_0xcbe6('0x2e')]['fn']('IF',db[_0xcbe6('0x2e')]['literal'](_0xcbe6('0x43')+util['format']('\x22%s\x22',moment()[_0xcbe6('0x44')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xcbe6('0x45')))),_0xcbe6('0x46')]]})[_0xcbe6('0x1e')](function(_0x5b0630){logger[_0xcbe6('0x12')]('CountReScheduled',_0x275bad);logger[_0xcbe6('0xc')](_0xcbe6('0x41'),_0x275bad,JSON[_0xcbe6('0xe')](_0x5b0630));_0x39dd31(_0x5b0630);})[_0xcbe6('0x13')](function(_0x29cfbc){logger[_0xcbe6('0xf')]('CountReScheduled',_0x29cfbc[_0xcbe6('0x11')],_0x275bad);_0x33b622(_0x5b1358[_0xcbe6('0xf')](0x1f4,_0x29cfbc[_0xcbe6('0x11')]));});});};exports[_0xcbe6('0x47')]=function(_0x21bba1){var _0x35270c=this;return new Promise(function(_0x33febc,_0x4a0e28){return db[_0xcbe6('0x2c')][_0xcbe6('0x2d')]()['then'](function(_0x2da23e){return db[_0xcbe6('0x2e')][_0xcbe6('0x2f')](function(_0x480cda){return db[_0xcbe6('0x14')][_0xcbe6('0x15')]({'where':_0x21bba1['options']?_0x21bba1[_0xcbe6('0x16')][_0xcbe6('0x18')]||null:null,'attributes':_0x21bba1['options']?_0x21bba1[_0xcbe6('0x16')][_0xcbe6('0x1d')]||null:null,'limit':0x1,'order':_0x21bba1[_0xcbe6('0x16')]?_0x21bba1['options'][_0xcbe6('0x30')]||null:null,'group':db[_0xcbe6('0x14')]['UserId'],'transaction':_0x480cda,'lock':_0x480cda[_0xcbe6('0x31')]['UPDATE'],'include':_0x21bba1[_0xcbe6('0x16')]?_0x21bba1[_0xcbe6('0x16')][_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x21bba1['options']['include'],function(_0x46d90c){return{'model':db[_0x46d90c[_0xcbe6('0x1c')]],'as':_0x46d90c['as'],'attributes':_0x46d90c[_0xcbe6('0x1d')],'include':_0x46d90c['include']?_[_0xcbe6('0x1b')](_0x46d90c[_0xcbe6('0x1a')],function(_0x576e72){return{'model':db[_0x576e72['model']],'as':_0x576e72['as'],'attributes':_0x576e72[_0xcbe6('0x1d')],'include':_0x576e72[_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x576e72['include'],function(_0x3a5f20){return{'model':db[_0x3a5f20['model']],'as':_0x3a5f20['as'],'attributes':_0x3a5f20[_0xcbe6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcbe6('0x1e')](function(_0x1fcc53){var _0x5a68cf=[];for(var _0x5cf530=0x0;_0x5cf530<_0x1fcc53[_0xcbe6('0x37')];_0x5cf530+=0x1){_0x5a68cf['push'](_0x1fcc53[_0x5cf530][_0xcbe6('0x26')](_0x21bba1['body'],{'transaction':_0x480cda}));}return BPromise[_0xcbe6('0x3b')](_0x5a68cf);});})[_0xcbe6('0x1e')](function(_0xad4003){logger[_0xcbe6('0x12')]('GetContactRecallMe',_0x21bba1);logger[_0xcbe6('0xc')](_0xcbe6('0x47'),_0x21bba1,JSON['stringify'](_0xad4003));_0x33febc(_0xad4003);})['catch'](function(_0x2bbf14){logger[_0xcbe6('0xf')](_0xcbe6('0x47'),_0x2bbf14['message'],_0x21bba1);_0x4a0e28(_0x35270c[_0xcbe6('0xf')](0x1f4,_0x2bbf14[_0xcbe6('0x11')]));});});});};exports[_0xcbe6('0x48')]=function(_0xf05c13){var _0x171947=this;return new Promise(function(_0x4989fc,_0x34f84b){db[_0xcbe6('0x2c')][_0xcbe6('0x2d')]()['then'](function(_0x20842e){return db['CmHopper'][_0xcbe6('0x15')]({'raw':_0xf05c13[_0xcbe6('0x16')]?_0xf05c13['options'][_0xcbe6('0x17')]===undefined?!![]:![]:!![],'where':_0xf05c13[_0xcbe6('0x16')]?_0xf05c13[_0xcbe6('0x16')]['where']||null:null,'attributes':_0xf05c13[_0xcbe6('0x16')]?_0xf05c13['options'][_0xcbe6('0x1d')]||null:null,'limit':_0xf05c13[_0xcbe6('0x16')]?_0xf05c13[_0xcbe6('0x16')][_0xcbe6('0x19')]||null:null,'include':_0xf05c13[_0xcbe6('0x16')]?_0xf05c13[_0xcbe6('0x16')][_0xcbe6('0x1a')]?_['map'](_0xf05c13['options'][_0xcbe6('0x1a')],function(_0x9044be){return{'model':db[_0x9044be[_0xcbe6('0x1c')]],'as':_0x9044be['as'],'attributes':_0x9044be['as']===_0xcbe6('0x33')?_['keys'](_0x20842e):_0x9044be[_0xcbe6('0x1d')],'include':_0x9044be[_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x9044be['include'],function(_0x39a8a){return{'model':db[_0x39a8a[_0xcbe6('0x1c')]],'as':_0x39a8a['as'],'attributes':_0x39a8a[_0xcbe6('0x1d')],'include':_0x39a8a[_0xcbe6('0x1a')]?_[_0xcbe6('0x1b')](_0x39a8a['include'],function(_0x10082e){return{'model':db[_0x10082e[_0xcbe6('0x1c')]],'as':_0x10082e['as'],'attributes':_0x10082e[_0xcbe6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcbe6('0x1e')](function(_0x8fc9c3){logger[_0xcbe6('0x12')](_0xcbe6('0x1f'),_0xf05c13);logger[_0xcbe6('0xc')](_0xcbe6('0x1f'),_0xf05c13,JSON['stringify'](_0x8fc9c3));_0x4989fc(_0x8fc9c3);})[_0xcbe6('0x13')](function(_0x40dbe2){logger[_0xcbe6('0xf')](_0xcbe6('0x1f'),_0x40dbe2[_0xcbe6('0x11')],_0xf05c13);_0x34f84b(_0x171947[_0xcbe6('0xf')](0x1f4,_0x40dbe2[_0xcbe6('0x11')]));});});});};exports[_0xcbe6('0x49')]=function(_0x6b6094){var _0x272cd3=this;return new Promise(function(_0x511cac,_0x2fd328){return db[_0xcbe6('0x2e')][_0xcbe6('0x2f')](function(_0x401dae){return db[_0xcbe6('0x14')]['update']({'active':![]},{'where':{},'transaction':_0x401dae})[_0xcbe6('0x1e')](function(_0xb790d0){logger[_0xcbe6('0x12')]('ResetActiveCalls',_0x6b6094);logger[_0xcbe6('0xc')](_0xcbe6('0x49'),_0x6b6094,JSON['stringify'](_0xb790d0));_0x511cac(_0xb790d0);})[_0xcbe6('0x13')](function(_0x166c92){logger['error'](_0xcbe6('0x49'),_0x166c92[_0xcbe6('0x11')],_0x6b6094);_0x2fd328(_0x272cd3[_0xcbe6('0xf')](0x1f4,_0x166c92[_0xcbe6('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5cb9ecd..18964dd 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 _0x9a98=['connect-timeout','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/:id','post','/preview','getPreview','update','delete','destroy','exports','multer','util','path'];(function(_0x36d193,_0x134b7b){var _0x1cfd8d=function(_0x36a69f){while(--_0x36a69f){_0x36d193['push'](_0x36d193['shift']());}};_0x1cfd8d(++_0x134b7b);}(_0x9a98,0xba));var _0x89a9=function(_0x80dbaa,_0x2d4572){_0x80dbaa=_0x80dbaa-0x0;var _0x349a73=_0x9a98[_0x80dbaa];return _0x349a73;};'use strict';var multer=require(_0x89a9('0x0'));var util=require(_0x89a9('0x1'));var path=require(_0x89a9('0x2'));var timeout=require(_0x89a9('0x3'));var express=require('express');var router=express[_0x89a9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89a9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89a9('0x6'));router[_0x89a9('0x7')]('/',auth[_0x89a9('0x8')](),controller[_0x89a9('0x9')]);router[_0x89a9('0x7')](_0x89a9('0xa'),auth[_0x89a9('0x8')](),controller[_0x89a9('0xb')]);router['get'](_0x89a9('0xc'),auth[_0x89a9('0x8')](),controller['getOpenContacts']);router[_0x89a9('0x7')](_0x89a9('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x89a9('0xe')](_0x89a9('0xf'),auth[_0x89a9('0x8')](),controller[_0x89a9('0x10')]);router['put'](_0x89a9('0xd'),auth[_0x89a9('0x8')](),controller[_0x89a9('0x11')]);router[_0x89a9('0x12')](_0x89a9('0xd'),auth['isAuthenticated'](),controller[_0x89a9('0x13')]);module[_0x89a9('0x14')]=router; \ No newline at end of file +var _0xe2f9=['util','path','connect-timeout','express','Router','fs-extra','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','/:id','show','post','/preview','update','destroy','exports','multer'];(function(_0x3a9f17,_0xdd3dc4){var _0x5e445a=function(_0x16d94f){while(--_0x16d94f){_0x3a9f17['push'](_0x3a9f17['shift']());}};_0x5e445a(++_0xdd3dc4);}(_0xe2f9,0x77));var _0x9e2f=function(_0x52a0e4,_0x9c292f){_0x52a0e4=_0x52a0e4-0x0;var _0x28b930=_0xe2f9[_0x52a0e4];return _0x28b930;};'use strict';var multer=require(_0x9e2f('0x0'));var util=require(_0x9e2f('0x1'));var path=require(_0x9e2f('0x2'));var timeout=require(_0x9e2f('0x3'));var express=require(_0x9e2f('0x4'));var router=express[_0x9e2f('0x5')]();var fs_extra=require(_0x9e2f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e2f('0x7'));router[_0x9e2f('0x8')]('/',auth[_0x9e2f('0x9')](),controller['index']);router[_0x9e2f('0x8')](_0x9e2f('0xa'),auth[_0x9e2f('0x9')](),controller[_0x9e2f('0xb')]);router[_0x9e2f('0x8')](_0x9e2f('0xc'),auth[_0x9e2f('0x9')](),controller['getOpenContacts']);router[_0x9e2f('0x8')](_0x9e2f('0xd'),auth[_0x9e2f('0x9')](),controller[_0x9e2f('0xe')]);router[_0x9e2f('0xf')]('/',auth[_0x9e2f('0x9')](),controller['create']);router[_0x9e2f('0xf')](_0x9e2f('0x10'),auth[_0x9e2f('0x9')](),controller['getPreview']);router['put'](_0x9e2f('0xd'),auth['isAuthenticated'](),controller[_0x9e2f('0x11')]);router['delete'](_0x9e2f('0xd'),auth[_0x9e2f('0x9')](),controller[_0x9e2f('0x12')]);module[_0x9e2f('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f2ae7d3..228c3d3 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 _0x53cf=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x59cd0e,_0x483db6){var _0x2191d5=function(_0x4e72db){while(--_0x4e72db){_0x59cd0e['push'](_0x59cd0e['shift']());}};_0x2191d5(++_0x483db6);}(_0x53cf,0x1b0));var _0xf53c=function(_0x576393,_0x1b422c){_0x576393=_0x576393-0x0;var _0xe52a01=_0x53cf[_0x576393];return _0xe52a01;};'use strict';var moment=require(_0xf53c('0x0'));var Sequelize=require(_0xf53c('0x1'));module[_0xf53c('0x2')]={'phone':{'type':Sequelize[_0xf53c('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf53c('0x4')],'unique':_0xf53c('0x5')},'ListId':{'type':Sequelize[_0xf53c('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xf53c('0x4')],'unique':_0xf53c('0x5')}}; \ No newline at end of file +var _0x67d1=['INTEGER','moment','sequelize','exports','STRING','contactListQueue'];(function(_0x4aba57,_0x4c65ec){var _0x3630a5=function(_0x5cb9b2){while(--_0x5cb9b2){_0x4aba57['push'](_0x4aba57['shift']());}};_0x3630a5(++_0x4c65ec);}(_0x67d1,0xdf));var _0x167d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x67d1[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require(_0x167d('0x0'));var Sequelize=require(_0x167d('0x1'));module[_0x167d('0x2')]={'phone':{'type':Sequelize[_0x167d('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x167d('0x4')},'ListId':{'type':Sequelize[_0x167d('0x5')],'unique':_0x167d('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'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 49c9bfc..bf6ea85 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 _0x7aa0=['attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','catch','params','include','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','end','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x3e7033,_0x79469f){var _0x4dff0a=function(_0x232abe){while(--_0x232abe){_0x3e7033['push'](_0x3e7033['shift']());}};_0x4dff0a(++_0x79469f);}(_0x7aa0,0xa1));var _0x07aa=function(_0x47c9fd,_0x5bc3df){_0x47c9fd=_0x47c9fd-0x0;var _0x5b704f=_0x7aa0[_0x47c9fd];return _0x5b704f;};'use strict';var emlformat=require(_0x07aa('0x0'));var rimraf=require(_0x07aa('0x1'));var zipdir=require(_0x07aa('0x2'));var jsonpatch=require(_0x07aa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x07aa('0x4'));var Mustache=require(_0x07aa('0x5'));var util=require(_0x07aa('0x6'));var path=require(_0x07aa('0x7'));var sox=require(_0x07aa('0x8'));var csv=require(_0x07aa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07aa('0xa'));var _=require('lodash');var squel=require(_0x07aa('0xb'));var crypto=require('crypto');var jsforce=require(_0x07aa('0xc'));var deskjs=require(_0x07aa('0xd'));var toCsv=require(_0x07aa('0x9'));var querystring=require(_0x07aa('0xe'));var Papa=require(_0x07aa('0xf'));var Redis=require(_0x07aa('0x10'));var authService=require(_0x07aa('0x11'));var qs=require(_0x07aa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07aa('0x13'));var logger=require('../../config/logger')(_0x07aa('0x14'));var utils=require(_0x07aa('0x15'));var config=require(_0x07aa('0x16'));var licenseUtil=require(_0x07aa('0x17'));var db=require(_0x07aa('0x18'))['db'];function respondWithStatusCode(_0x56e8d6,_0x3fb3ad){_0x3fb3ad=_0x3fb3ad||0xcc;return function(_0x82b55a){if(_0x82b55a){return _0x56e8d6['sendStatus'](_0x3fb3ad);}return _0x56e8d6[_0x07aa('0x19')](_0x3fb3ad)['end']();};}function respondWithResult(_0x32df91,_0x54d592){_0x54d592=_0x54d592||0xc8;return function(_0x1d358c){if(_0x1d358c){return _0x32df91[_0x07aa('0x19')](_0x54d592)[_0x07aa('0x1a')](_0x1d358c);}};}function respondWithFilteredResult(_0x4b96b3,_0x59028c){return function(_0x2d1b51){if(_0x2d1b51){var _0x986040=typeof _0x59028c[_0x07aa('0x1b')]===_0x07aa('0x1c')&&typeof _0x59028c[_0x07aa('0x1d')]==='undefined';var _0x882585=_0x2d1b51[_0x07aa('0x1e')];var _0x53af68=_0x986040?0x0:_0x59028c[_0x07aa('0x1b')];var _0x209730=_0x986040?_0x2d1b51['count']:_0x59028c[_0x07aa('0x1b')]+_0x59028c[_0x07aa('0x1d')];var _0x33fd2b;if(_0x209730>=_0x882585){_0x209730=_0x882585;_0x33fd2b=0xc8;}else{_0x33fd2b=0xce;}_0x4b96b3[_0x07aa('0x19')](_0x33fd2b);return _0x4b96b3[_0x07aa('0x1f')]('Content-Range',_0x53af68+'-'+_0x209730+'/'+_0x882585)[_0x07aa('0x1a')](_0x2d1b51);}return null;};}function patchUpdates(_0x517ea1){return function(_0x32e63b){try{jsonpatch[_0x07aa('0x20')](_0x32e63b,_0x517ea1,!![]);}catch(_0x5461a3){return BPromise['reject'](_0x5461a3);}return _0x32e63b[_0x07aa('0x21')]();};}function saveUpdates(_0x29e4f0,_0x39087d){return function(_0xd94526){if(_0xd94526){return _0xd94526['update'](_0x29e4f0)[_0x07aa('0x22')](function(_0x657143){return _0x657143;});}return null;};}function removeEntity(_0x365cb1,_0x3f9451){return function(_0x15ee2f){if(_0x15ee2f){return _0x15ee2f[_0x07aa('0x23')]()[_0x07aa('0x22')](function(){_0x365cb1['status'](0xcc)[_0x07aa('0x24')]();});}};}function handleEntityNotFound(_0x11cdd9,_0x42bb38){return function(_0x4fe949){if(!_0x4fe949){_0x11cdd9[_0x07aa('0x25')](0x194);}return _0x4fe949;};}function handleError(_0x308697,_0x3154c6){_0x3154c6=_0x3154c6||0x1f4;return function(_0x5cad63){logger[_0x07aa('0x26')](_0x5cad63['stack']);if(_0x5cad63[_0x07aa('0x27')]){delete _0x5cad63['name'];}_0x308697[_0x07aa('0x19')](_0x3154c6)[_0x07aa('0x28')](_0x5cad63);};}exports[_0x07aa('0x29')]=function(_0x3c55ab,_0x3c633f){var _0x349c14={},_0x20155c={},_0xa8f57d={'count':0x0,'rows':[]};var _0x21e1a5=_[_0x07aa('0x2a')](db[_0x07aa('0x2b')][_0x07aa('0x2c')],function(_0xc90373){return{'name':_0xc90373[_0x07aa('0x2d')],'type':_0xc90373[_0x07aa('0x2e')]['key']};});_0x20155c[_0x07aa('0x2f')]=_[_0x07aa('0x2a')](_0x21e1a5,_0x07aa('0x27'));_0x20155c[_0x07aa('0x30')]=_[_0x07aa('0x31')](_0x3c55ab[_0x07aa('0x30')]);_0x20155c[_0x07aa('0x32')]=_[_0x07aa('0x33')](_0x20155c[_0x07aa('0x2f')],_0x20155c['query']);_0x349c14[_0x07aa('0x34')]=_[_0x07aa('0x33')](_0x20155c[_0x07aa('0x2f')],qs[_0x07aa('0x35')](_0x3c55ab['query'][_0x07aa('0x35')]));_0x349c14[_0x07aa('0x34')]=_0x349c14[_0x07aa('0x34')][_0x07aa('0x36')]?_0x349c14[_0x07aa('0x34')]:_0x20155c['model'];if(!_0x3c55ab[_0x07aa('0x30')]['hasOwnProperty'](_0x07aa('0x37'))){_0x349c14[_0x07aa('0x1d')]=qs[_0x07aa('0x1d')](_0x3c55ab[_0x07aa('0x30')][_0x07aa('0x1d')]);_0x349c14[_0x07aa('0x1b')]=qs[_0x07aa('0x1b')](_0x3c55ab['query'][_0x07aa('0x1b')]);}_0x349c14[_0x07aa('0x38')]=qs[_0x07aa('0x39')](_0x3c55ab[_0x07aa('0x30')][_0x07aa('0x39')]);_0x349c14[_0x07aa('0x3a')]=qs[_0x07aa('0x32')](_['pick'](_0x3c55ab[_0x07aa('0x30')],_0x20155c[_0x07aa('0x32')]),_0x21e1a5);if(_0x3c55ab['query'][_0x07aa('0x3b')]){_0x349c14[_0x07aa('0x3a')]=_[_0x07aa('0x3c')](_0x349c14['where'],{'$or':_['map'](_0x21e1a5,function(_0x346bb7){if(_0x346bb7[_0x07aa('0x2e')]!==_0x07aa('0x3d')){var _0x524393={};_0x524393[_0x346bb7['name']]={'$like':'%'+_0x3c55ab[_0x07aa('0x30')][_0x07aa('0x3b')]+'%'};return _0x524393;}})});}_0x349c14=_[_0x07aa('0x3c')]({},_0x349c14,_0x3c55ab['options']);var _0x173853={'where':_0x349c14['where']};return db[_0x07aa('0x2b')][_0x07aa('0x1e')](_0x173853)[_0x07aa('0x22')](function(_0x5de252){_0xa8f57d['count']=_0x5de252;if(_0x3c55ab[_0x07aa('0x30')][_0x07aa('0x3e')]){_0x349c14['include']=[{'all':!![]}];}return db[_0x07aa('0x2b')][_0x07aa('0x3f')](_0x349c14);})['then'](function(_0x178c98){_0xa8f57d['rows']=_0x178c98;return _0xa8f57d;})[_0x07aa('0x22')](respondWithFilteredResult(_0x3c633f,_0x349c14))[_0x07aa('0x40')](handleError(_0x3c633f,null));};exports['show']=function(_0x36bd95,_0x181a3d){var _0x17365b={'raw':!![],'where':{'id':_0x36bd95[_0x07aa('0x41')]['id']}},_0x3166c2={};_0x3166c2['model']=_['keys'](db[_0x07aa('0x2b')][_0x07aa('0x2c')]);_0x3166c2[_0x07aa('0x30')]=_['keys'](_0x36bd95['query']);_0x3166c2['filters']=_[_0x07aa('0x33')](_0x3166c2[_0x07aa('0x2f')],_0x3166c2[_0x07aa('0x30')]);_0x17365b[_0x07aa('0x34')]=_[_0x07aa('0x33')](_0x3166c2[_0x07aa('0x2f')],qs[_0x07aa('0x35')](_0x36bd95['query']['fields']));_0x17365b[_0x07aa('0x34')]=_0x17365b[_0x07aa('0x34')]['length']?_0x17365b[_0x07aa('0x34')]:_0x3166c2[_0x07aa('0x2f')];if(_0x36bd95[_0x07aa('0x30')]['includeAll']){_0x17365b[_0x07aa('0x42')]=[{'all':!![]}];}_0x17365b=_[_0x07aa('0x3c')]({},_0x17365b,_0x36bd95['options']);return db[_0x07aa('0x2b')][_0x07aa('0x43')](_0x17365b)[_0x07aa('0x22')](handleEntityNotFound(_0x181a3d,null))[_0x07aa('0x22')](respondWithResult(_0x181a3d,null))[_0x07aa('0x40')](handleError(_0x181a3d,null));};exports[_0x07aa('0x44')]=function(_0x1d75e1,_0x367a61){if(_0x1d75e1[_0x07aa('0x45')]['id']){delete _0x1d75e1['body']['id'];}return db[_0x07aa('0x2b')]['find']({'where':{'id':_0x1d75e1[_0x07aa('0x41')]['id']}})[_0x07aa('0x22')](handleEntityNotFound(_0x367a61,null))[_0x07aa('0x22')](saveUpdates(_0x1d75e1[_0x07aa('0x45')],null))['then'](respondWithResult(_0x367a61,null))[_0x07aa('0x40')](handleError(_0x367a61,null));};exports[_0x07aa('0x23')]=function(_0x40ab85,_0x2079bb){return db['CmHopperBlack'][_0x07aa('0x43')]({'where':{'id':_0x40ab85[_0x07aa('0x41')]['id']}})[_0x07aa('0x22')](handleEntityNotFound(_0x2079bb,null))[_0x07aa('0x22')](removeEntity(_0x2079bb,null))[_0x07aa('0x40')](handleError(_0x2079bb,null));};exports[_0x07aa('0x46')]=function(_0x478f6a,_0x3d1b46){return db['CmHopperBlack'][_0x07aa('0x46')]()[_0x07aa('0x22')](respondWithResult(_0x3d1b46,null))[_0x07aa('0x40')](handleError(_0x3d1b46,null));}; \ No newline at end of file +var _0x896e=['destroy','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x896e,0x6e));var _0xe896=function(_0x1b9254,_0x180d67){_0x1b9254=_0x1b9254-0x0;var _0x1ccd05=_0x896e[_0x1b9254];return _0x1ccd05;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var Mustache=require(_0xe896('0x4'));var util=require('util');var path=require(_0xe896('0x5'));var sox=require(_0xe896('0x6'));var csv=require(_0xe896('0x7'));var ejs=require(_0xe896('0x8'));var fs=require('fs');var fs_extra=require(_0xe896('0x9'));var _=require(_0xe896('0xa'));var squel=require(_0xe896('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe896('0xc'));var toCsv=require(_0xe896('0x7'));var querystring=require('querystring');var Papa=require(_0xe896('0xd'));var Redis=require(_0xe896('0xe'));var authService=require(_0xe896('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x10'));var hardwareService=require(_0xe896('0x11'));var logger=require('../../config/logger')(_0xe896('0x12'));var utils=require(_0xe896('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x14'));var db=require(_0xe896('0x15'))['db'];function respondWithStatusCode(_0x287c80,_0x578114){_0x578114=_0x578114||0xcc;return function(_0x3fa1c5){if(_0x3fa1c5){return _0x287c80[_0xe896('0x16')](_0x578114);}return _0x287c80[_0xe896('0x17')](_0x578114)['end']();};}function respondWithResult(_0x2895f2,_0x24ae5f){_0x24ae5f=_0x24ae5f||0xc8;return function(_0x139c0f){if(_0x139c0f){return _0x2895f2['status'](_0x24ae5f)[_0xe896('0x18')](_0x139c0f);}};}function respondWithFilteredResult(_0x42e8ed,_0x111b76){return function(_0x29d2ca){if(_0x29d2ca){var _0x54ede4=typeof _0x111b76[_0xe896('0x19')]===_0xe896('0x1a')&&typeof _0x111b76[_0xe896('0x1b')]===_0xe896('0x1a');var _0x49267c=_0x29d2ca[_0xe896('0x1c')];var _0x189790=_0x54ede4?0x0:_0x111b76[_0xe896('0x19')];var _0x30451d=_0x54ede4?_0x29d2ca['count']:_0x111b76[_0xe896('0x19')]+_0x111b76[_0xe896('0x1b')];var _0x8038cf;if(_0x30451d>=_0x49267c){_0x30451d=_0x49267c;_0x8038cf=0xc8;}else{_0x8038cf=0xce;}_0x42e8ed[_0xe896('0x17')](_0x8038cf);return _0x42e8ed[_0xe896('0x1d')]('Content-Range',_0x189790+'-'+_0x30451d+'/'+_0x49267c)['json'](_0x29d2ca);}return null;};}function patchUpdates(_0xdfda1a){return function(_0x3e1d38){try{jsonpatch[_0xe896('0x1e')](_0x3e1d38,_0xdfda1a,!![]);}catch(_0x2b03d3){return BPromise[_0xe896('0x1f')](_0x2b03d3);}return _0x3e1d38[_0xe896('0x20')]();};}function saveUpdates(_0x37f37c,_0x29f001){return function(_0x247daf){if(_0x247daf){return _0x247daf[_0xe896('0x21')](_0x37f37c)['then'](function(_0xd451a0){return _0xd451a0;});}return null;};}function removeEntity(_0x455ace,_0x4ad3e1){return function(_0x1b849d){if(_0x1b849d){return _0x1b849d[_0xe896('0x22')]()[_0xe896('0x23')](function(){_0x455ace[_0xe896('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8dc4fe,_0x303c26){return function(_0x4bb0d7){if(!_0x4bb0d7){_0x8dc4fe['sendStatus'](0x194);}return _0x4bb0d7;};}function handleError(_0x1e6137,_0x8066fe){_0x8066fe=_0x8066fe||0x1f4;return function(_0x2c69d1){logger[_0xe896('0x24')](_0x2c69d1[_0xe896('0x25')]);if(_0x2c69d1['name']){delete _0x2c69d1[_0xe896('0x26')];}_0x1e6137[_0xe896('0x17')](_0x8066fe)[_0xe896('0x27')](_0x2c69d1);};}exports['index']=function(_0x14bb7d,_0x2fbe2b){var _0x479675={},_0x2f8a8f={},_0x2f2a5f={'count':0x0,'rows':[]};var _0x3e10ef=_[_0xe896('0x28')](db[_0xe896('0x29')][_0xe896('0x2a')],function(_0xe64fe4){return{'name':_0xe64fe4[_0xe896('0x2b')],'type':_0xe64fe4[_0xe896('0x2c')][_0xe896('0x2d')]};});_0x2f8a8f[_0xe896('0x2e')]=_[_0xe896('0x28')](_0x3e10ef,_0xe896('0x26'));_0x2f8a8f['query']=_[_0xe896('0x2f')](_0x14bb7d['query']);_0x2f8a8f['filters']=_[_0xe896('0x30')](_0x2f8a8f[_0xe896('0x2e')],_0x2f8a8f[_0xe896('0x31')]);_0x479675['attributes']=_[_0xe896('0x30')](_0x2f8a8f['model'],qs['fields'](_0x14bb7d[_0xe896('0x31')][_0xe896('0x32')]));_0x479675[_0xe896('0x33')]=_0x479675[_0xe896('0x33')][_0xe896('0x34')]?_0x479675[_0xe896('0x33')]:_0x2f8a8f[_0xe896('0x2e')];if(!_0x14bb7d[_0xe896('0x31')]['hasOwnProperty'](_0xe896('0x35'))){_0x479675[_0xe896('0x1b')]=qs[_0xe896('0x1b')](_0x14bb7d['query']['limit']);_0x479675[_0xe896('0x19')]=qs[_0xe896('0x19')](_0x14bb7d['query'][_0xe896('0x19')]);}_0x479675[_0xe896('0x36')]=qs['sort'](_0x14bb7d[_0xe896('0x31')][_0xe896('0x37')]);_0x479675[_0xe896('0x38')]=qs[_0xe896('0x39')](_[_0xe896('0x3a')](_0x14bb7d[_0xe896('0x31')],_0x2f8a8f['filters']),_0x3e10ef);if(_0x14bb7d['query']['filter']){_0x479675['where']=_[_0xe896('0x3b')](_0x479675[_0xe896('0x38')],{'$or':_[_0xe896('0x28')](_0x3e10ef,function(_0x3117d8){if(_0x3117d8[_0xe896('0x2c')]!==_0xe896('0x3c')){var _0x5b5ee4={};_0x5b5ee4[_0x3117d8[_0xe896('0x26')]]={'$like':'%'+_0x14bb7d[_0xe896('0x31')][_0xe896('0x3d')]+'%'};return _0x5b5ee4;}})});}_0x479675=_[_0xe896('0x3b')]({},_0x479675,_0x14bb7d[_0xe896('0x3e')]);var _0x550c12={'where':_0x479675[_0xe896('0x38')]};return db[_0xe896('0x29')][_0xe896('0x1c')](_0x550c12)['then'](function(_0x2b33f8){_0x2f2a5f[_0xe896('0x1c')]=_0x2b33f8;if(_0x14bb7d[_0xe896('0x31')][_0xe896('0x3f')]){_0x479675[_0xe896('0x40')]=[{'all':!![]}];}return db[_0xe896('0x29')][_0xe896('0x41')](_0x479675);})['then'](function(_0x28c2df){_0x2f2a5f[_0xe896('0x42')]=_0x28c2df;return _0x2f2a5f;})[_0xe896('0x23')](respondWithFilteredResult(_0x2fbe2b,_0x479675))[_0xe896('0x43')](handleError(_0x2fbe2b,null));};exports['show']=function(_0x45296a,_0x550b17){var _0x3df622={'raw':!![],'where':{'id':_0x45296a[_0xe896('0x44')]['id']}},_0x5b25eb={};_0x5b25eb[_0xe896('0x2e')]=_[_0xe896('0x2f')](db[_0xe896('0x29')][_0xe896('0x2a')]);_0x5b25eb[_0xe896('0x31')]=_[_0xe896('0x2f')](_0x45296a[_0xe896('0x31')]);_0x5b25eb[_0xe896('0x39')]=_[_0xe896('0x30')](_0x5b25eb[_0xe896('0x2e')],_0x5b25eb[_0xe896('0x31')]);_0x3df622[_0xe896('0x33')]=_[_0xe896('0x30')](_0x5b25eb[_0xe896('0x2e')],qs[_0xe896('0x32')](_0x45296a[_0xe896('0x31')][_0xe896('0x32')]));_0x3df622[_0xe896('0x33')]=_0x3df622[_0xe896('0x33')][_0xe896('0x34')]?_0x3df622[_0xe896('0x33')]:_0x5b25eb[_0xe896('0x2e')];if(_0x45296a['query']['includeAll']){_0x3df622[_0xe896('0x40')]=[{'all':!![]}];}_0x3df622=_[_0xe896('0x3b')]({},_0x3df622,_0x45296a['options']);return db['CmHopperBlack']['find'](_0x3df622)['then'](handleEntityNotFound(_0x550b17,null))[_0xe896('0x23')](respondWithResult(_0x550b17,null))[_0xe896('0x43')](handleError(_0x550b17,null));};exports[_0xe896('0x21')]=function(_0x107775,_0x324175){if(_0x107775[_0xe896('0x45')]['id']){delete _0x107775[_0xe896('0x45')]['id'];}return db[_0xe896('0x29')][_0xe896('0x46')]({'where':{'id':_0x107775[_0xe896('0x44')]['id']}})['then'](handleEntityNotFound(_0x324175,null))['then'](saveUpdates(_0x107775['body'],null))['then'](respondWithResult(_0x324175,null))[_0xe896('0x43')](handleError(_0x324175,null));};exports[_0xe896('0x22')]=function(_0x3d5ee3,_0x1a14bc){return db[_0xe896('0x29')][_0xe896('0x46')]({'where':{'id':_0x3d5ee3[_0xe896('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a14bc,null))['then'](removeEntity(_0x1a14bc,null))['catch'](handleError(_0x1a14bc,null));};exports[_0xe896('0x47')]=function(_0x120921,_0x2de0d5){return db[_0xe896('0x29')]['describe']()[_0xe896('0x23')](respondWithResult(_0x2de0d5,null))[_0xe896('0x43')](handleError(_0x2de0d5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 292b41b..73507aa 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 _0xb722=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','lodash','util'];(function(_0x18d50f,_0x124aff){var _0x8ce385=function(_0x321962){while(--_0x321962){_0x18d50f['push'](_0x18d50f['shift']());}};_0x8ce385(++_0x124aff);}(_0xb722,0x9a));var _0x2b72=function(_0x407069,_0x4945a4){_0x407069=_0x407069-0x0;var _0x3520ee=_0xb722[_0x407069];return _0x3520ee;};'use strict';var _=require(_0x2b72('0x0'));var util=require(_0x2b72('0x1'));var logger=require(_0x2b72('0x2'))('api');var moment=require(_0x2b72('0x3'));var BPromise=require(_0x2b72('0x4'));var rp=require(_0x2b72('0x5'));var fs=require('fs');var path=require(_0x2b72('0x6'));var rimraf=require(_0x2b72('0x7'));var config=require(_0x2b72('0x8'));var attributes=require(_0x2b72('0x9'));module['exports']=function(_0x58fe49,_0x4b7e52){return _0x58fe49[_0x2b72('0xa')](_0x2b72('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c26=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','util'];(function(_0x3d5100,_0x8c0e3b){var _0x4e9604=function(_0x607bb7){while(--_0x607bb7){_0x3d5100['push'](_0x3d5100['shift']());}};_0x4e9604(++_0x8c0e3b);}(_0x7c26,0x144));var _0x67c2=function(_0xaddcd2,_0x1c53fc){_0xaddcd2=_0xaddcd2-0x0;var _0x5c90b7=_0x7c26[_0xaddcd2];return _0x5c90b7;};'use strict';var _=require('lodash');var util=require(_0x67c2('0x0'));var logger=require(_0x67c2('0x1'))(_0x67c2('0x2'));var moment=require(_0x67c2('0x3'));var BPromise=require(_0x67c2('0x4'));var rp=require(_0x67c2('0x5'));var fs=require('fs');var path=require(_0x67c2('0x6'));var rimraf=require(_0x67c2('0x7'));var config=require(_0x67c2('0x8'));var attributes=require(_0x67c2('0x9'));module[_0x67c2('0xa')]=function(_0x464cbf,_0x114c1f){return _0x464cbf['define'](_0x67c2('0xb'),attributes,{'tableName':_0x67c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index c13bca1..0cfcaa7 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 _0x7592=['findAll','options','where','attributes','limit','map','include','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','raw','then','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopperBlack'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x7592,0x1e3));var _0x2759=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x7592[_0x3b6652];return _0x14d39f;};'use strict';var _=require('lodash');var util=require(_0x2759('0x0'));var moment=require(_0x2759('0x1'));var BPromise=require(_0x2759('0x2'));var rs=require(_0x2759('0x3'));var fs=require('fs');var Redis=require(_0x2759('0x4'));var db=require(_0x2759('0x5'))['db'];var utils=require(_0x2759('0x6'));var logger=require(_0x2759('0x7'))(_0x2759('0x8'));var config=require(_0x2759('0x9'));var jayson=require(_0x2759('0xa'));var client=jayson[_0x2759('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xabedc6,_0xe00b76,_0x332463){return new BPromise(function(_0xfa6966,_0x278dd1){return client[_0x2759('0xc')](_0xabedc6,_0x332463)['then'](function(_0x3c9932){logger[_0x2759('0xd')](_0x2759('0xe'),_0xe00b76,_0x2759('0xf'));logger[_0x2759('0x10')](_0x2759('0x11'),_0xe00b76,_0x2759('0xf'),JSON[_0x2759('0x12')](_0x3c9932));if(_0x3c9932[_0x2759('0x13')]){if(_0x3c9932[_0x2759('0x13')][_0x2759('0x14')]===0x1f4){logger['error'](_0x2759('0xe'),_0xe00b76,_0x3c9932[_0x2759('0x13')][_0x2759('0x15')]);return _0x278dd1(_0x3c9932[_0x2759('0x13')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0xe00b76,_0x3c9932['error'][_0x2759('0x15')]);return _0xfa6966(_0x3c9932[_0x2759('0x13')][_0x2759('0x15')]);}else{logger[_0x2759('0xd')](_0x2759('0xe'),_0xe00b76,_0x2759('0xf'));_0xfa6966(_0x3c9932['result'][_0x2759('0x15')]);}})[_0x2759('0x16')](function(_0x12f159){logger[_0x2759('0x13')](_0x2759('0xe'),_0xe00b76,_0x12f159);_0x278dd1(_0x12f159);});});}exports['GetCmHopperBlack']=function(_0x2f276a){var _0x3c8367=this;return new Promise(function(_0x596909,_0x4ef193){return db[_0x2759('0x17')][_0x2759('0x18')]({'raw':_0x2f276a[_0x2759('0x19')]?_0x2f276a['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f276a[_0x2759('0x19')]?_0x2f276a['options'][_0x2759('0x1a')]||null:null,'attributes':_0x2f276a['options']?_0x2f276a[_0x2759('0x19')][_0x2759('0x1b')]||null:null,'limit':_0x2f276a[_0x2759('0x19')]?_0x2f276a['options'][_0x2759('0x1c')]||null:null,'include':_0x2f276a['options']?_0x2f276a[_0x2759('0x19')]['include']?_[_0x2759('0x1d')](_0x2f276a[_0x2759('0x19')][_0x2759('0x1e')],function(_0x591bd5){return{'model':db[_0x591bd5[_0x2759('0x1f')]],'as':_0x591bd5['as'],'attributes':_0x591bd5[_0x2759('0x1b')],'include':_0x591bd5[_0x2759('0x1e')]?_[_0x2759('0x1d')](_0x591bd5[_0x2759('0x1e')],function(_0x280d33){return{'model':db[_0x280d33[_0x2759('0x1f')]],'as':_0x280d33['as'],'attributes':_0x280d33[_0x2759('0x1b')],'include':_0x280d33[_0x2759('0x1e')]?_['map'](_0x280d33[_0x2759('0x1e')],function(_0x252855){return{'model':db[_0x252855[_0x2759('0x1f')]],'as':_0x252855['as'],'attributes':_0x252855[_0x2759('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f223e){logger[_0x2759('0xd')]('GetCmHopperBlack',_0x2f276a);logger['debug'](_0x2759('0x20'),_0x2f276a,JSON[_0x2759('0x12')](_0x3f223e));_0x596909(_0x3f223e);})[_0x2759('0x16')](function(_0x914e68){logger[_0x2759('0x13')](_0x2759('0x20'),_0x914e68[_0x2759('0x15')],_0x2f276a);_0x4ef193(_0x3c8367[_0x2759('0x13')](0x1f4,_0x914e68[_0x2759('0x15')]));});});};exports[_0x2759('0x21')]=function(_0x5683d2){var _0x234b62=this;return new Promise(function(_0x3e4084,_0x3f4270){return db[_0x2759('0x17')][_0x2759('0x22')](_0x5683d2[_0x2759('0x23')],{'raw':_0x5683d2[_0x2759('0x19')]?_0x5683d2['options'][_0x2759('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5683d2[_0x2759('0x19')]?_0x5683d2[_0x2759('0x19')][_0x2759('0x1a')]||null:null,'attributes':_0x5683d2[_0x2759('0x19')]?_0x5683d2['options'][_0x2759('0x1b')]||null:null,'limit':_0x5683d2['options']?_0x5683d2['options']['limit']||null:null})[_0x2759('0x25')](function(_0x2d92bf){logger[_0x2759('0xd')](_0x2759('0x21'),_0x5683d2);logger[_0x2759('0x10')](_0x2759('0x21'),_0x5683d2,JSON[_0x2759('0x12')](_0x2d92bf));_0x3e4084(_0x2d92bf);})[_0x2759('0x16')](function(_0x345911){logger[_0x2759('0x13')](_0x2759('0x21'),_0x345911[_0x2759('0x15')],_0x5683d2);_0x3f4270(_0x234b62['error'](0x1f4,_0x345911[_0x2759('0x15')]));});});};exports[_0x2759('0x26')]=function(_0x3a0e79){var _0x39b707=this;return new Promise(function(_0x5f45ac,_0x1b1107){return db['CmHopperBlack']['destroy']({'where':_0x3a0e79[_0x2759('0x19')]?_0x3a0e79['options']['where']||null:null})[_0x2759('0x25')](function(_0x2063b0){logger[_0x2759('0xd')](_0x2759('0x26'),_0x3a0e79);logger[_0x2759('0x10')](_0x2759('0x26'),_0x3a0e79,JSON[_0x2759('0x12')](_0x2063b0));_0x5f45ac(_0x2063b0);})[_0x2759('0x16')](function(_0xe4f0c6){logger[_0x2759('0x13')](_0x2759('0x26'),_0xe4f0c6[_0x2759('0x15')],_0x3a0e79);_0x1b1107(_0x39b707[_0x2759('0x13')](0x1f4,_0xe4f0c6[_0x2759('0x15')]));});});}; \ No newline at end of file +var _0xd942=['include','map','model','then','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes'];(function(_0x326664,_0x537a53){var _0x293f34=function(_0x2416d8){while(--_0x2416d8){_0x326664['push'](_0x326664['shift']());}};_0x293f34(++_0x537a53);}(_0xd942,0x1a0));var _0x2d94=function(_0x42def0,_0x4e7776){_0x42def0=_0x42def0-0x0;var _0x4f49a5=_0xd942[_0x42def0];return _0x4f49a5;};'use strict';var _=require(_0x2d94('0x0'));var util=require(_0x2d94('0x1'));var moment=require(_0x2d94('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d94('0x3'));var fs=require('fs');var Redis=require(_0x2d94('0x4'));var db=require(_0x2d94('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d94('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d94('0x7'));var client=jayson[_0x2d94('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fad1f,_0x27c070,_0x5bd5c5){return new BPromise(function(_0x4640b3,_0x383d82){return client[_0x2d94('0x9')](_0x3fad1f,_0x5bd5c5)['then'](function(_0x3ae966){logger[_0x2d94('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x27c070,'request\x20sent');logger[_0x2d94('0xb')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x27c070,_0x2d94('0xc'),JSON[_0x2d94('0xd')](_0x3ae966));if(_0x3ae966[_0x2d94('0xe')]){if(_0x3ae966[_0x2d94('0xe')][_0x2d94('0xf')]===0x1f4){logger['error'](_0x2d94('0x10'),_0x27c070,_0x3ae966[_0x2d94('0xe')][_0x2d94('0x11')]);return _0x383d82(_0x3ae966['error'][_0x2d94('0x11')]);}logger[_0x2d94('0xe')](_0x2d94('0x10'),_0x27c070,_0x3ae966[_0x2d94('0xe')][_0x2d94('0x11')]);return _0x4640b3(_0x3ae966[_0x2d94('0xe')][_0x2d94('0x11')]);}else{logger['info'](_0x2d94('0x10'),_0x27c070,_0x2d94('0xc'));_0x4640b3(_0x3ae966[_0x2d94('0x12')]['message']);}})[_0x2d94('0x13')](function(_0x321368){logger[_0x2d94('0xe')](_0x2d94('0x10'),_0x27c070,_0x321368);_0x383d82(_0x321368);});});}exports[_0x2d94('0x14')]=function(_0x4cda02){var _0x3b0476=this;return new Promise(function(_0x46a562,_0x5b0363){return db[_0x2d94('0x15')]['findAll']({'raw':_0x4cda02[_0x2d94('0x16')]?_0x4cda02[_0x2d94('0x16')][_0x2d94('0x17')]===undefined?!![]:![]:!![],'where':_0x4cda02[_0x2d94('0x16')]?_0x4cda02[_0x2d94('0x16')][_0x2d94('0x18')]||null:null,'attributes':_0x4cda02[_0x2d94('0x16')]?_0x4cda02[_0x2d94('0x16')][_0x2d94('0x19')]||null:null,'limit':_0x4cda02[_0x2d94('0x16')]?_0x4cda02['options']['limit']||null:null,'include':_0x4cda02['options']?_0x4cda02[_0x2d94('0x16')][_0x2d94('0x1a')]?_[_0x2d94('0x1b')](_0x4cda02['options'][_0x2d94('0x1a')],function(_0x5f585d){return{'model':db[_0x5f585d[_0x2d94('0x1c')]],'as':_0x5f585d['as'],'attributes':_0x5f585d['attributes'],'include':_0x5f585d['include']?_[_0x2d94('0x1b')](_0x5f585d[_0x2d94('0x1a')],function(_0x51ac05){return{'model':db[_0x51ac05[_0x2d94('0x1c')]],'as':_0x51ac05['as'],'attributes':_0x51ac05[_0x2d94('0x19')],'include':_0x51ac05[_0x2d94('0x1a')]?_[_0x2d94('0x1b')](_0x51ac05[_0x2d94('0x1a')],function(_0x23ef64){return{'model':db[_0x23ef64[_0x2d94('0x1c')]],'as':_0x23ef64['as'],'attributes':_0x23ef64['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d94('0x1d')](function(_0x4c8ead){logger[_0x2d94('0xa')](_0x2d94('0x14'),_0x4cda02);logger[_0x2d94('0xb')](_0x2d94('0x14'),_0x4cda02,JSON[_0x2d94('0xd')](_0x4c8ead));_0x46a562(_0x4c8ead);})[_0x2d94('0x13')](function(_0x407d0b){logger[_0x2d94('0xe')](_0x2d94('0x14'),_0x407d0b[_0x2d94('0x11')],_0x4cda02);_0x5b0363(_0x3b0476['error'](0x1f4,_0x407d0b[_0x2d94('0x11')]));});});};exports[_0x2d94('0x1e')]=function(_0x24595c){var _0x395f13=this;return new Promise(function(_0x46fe73,_0x2f74ec){return db['CmHopperBlack'][_0x2d94('0x1f')](_0x24595c[_0x2d94('0x20')],{'raw':_0x24595c[_0x2d94('0x16')]?_0x24595c[_0x2d94('0x16')][_0x2d94('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24595c[_0x2d94('0x16')]?_0x24595c[_0x2d94('0x16')][_0x2d94('0x18')]||null:null,'attributes':_0x24595c[_0x2d94('0x16')]?_0x24595c[_0x2d94('0x16')][_0x2d94('0x19')]||null:null,'limit':_0x24595c['options']?_0x24595c[_0x2d94('0x16')]['limit']||null:null})[_0x2d94('0x1d')](function(_0x4dc0a4){logger[_0x2d94('0xa')](_0x2d94('0x1e'),_0x24595c);logger['debug']('UpdateCmHopperBlack',_0x24595c,JSON[_0x2d94('0xd')](_0x4dc0a4));_0x46fe73(_0x4dc0a4);})[_0x2d94('0x13')](function(_0x5c1e91){logger['error'](_0x2d94('0x1e'),_0x5c1e91[_0x2d94('0x11')],_0x24595c);_0x2f74ec(_0x395f13[_0x2d94('0xe')](0x1f4,_0x5c1e91[_0x2d94('0x11')]));});});};exports[_0x2d94('0x21')]=function(_0xdb0a90){var _0x380444=this;return new Promise(function(_0x46e263,_0xe1acfa){return db[_0x2d94('0x15')]['destroy']({'where':_0xdb0a90[_0x2d94('0x16')]?_0xdb0a90[_0x2d94('0x16')][_0x2d94('0x18')]||null:null})[_0x2d94('0x1d')](function(_0x309099){logger[_0x2d94('0xa')]('DestroyCmHopperBlack',_0xdb0a90);logger[_0x2d94('0xb')](_0x2d94('0x21'),_0xdb0a90,JSON[_0x2d94('0xd')](_0x309099));_0x46e263(_0x309099);})[_0x2d94('0x13')](function(_0x8b7f20){logger[_0x2d94('0xe')](_0x2d94('0x21'),_0x8b7f20['message'],_0xdb0a90);_0xe1acfa(_0x380444[_0x2d94('0xe')](0x1f4,_0x8b7f20['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f20061e..f65ae23 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 _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id','show','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['put']('/:id',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file +var _0x4bd3=['put','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x4bd3,0x174));var _0x34bd=function(_0x2c0cc1,_0x19b497){_0x2c0cc1=_0x2c0cc1-0x0;var _0x43ffc1=_0x4bd3[_0x2c0cc1];return _0x43ffc1;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34bd('0x3'));var interaction=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var controller=require('./cmHopperBlack.controller');router[_0x34bd('0x6')]('/',auth[_0x34bd('0x7')](),controller['index']);router[_0x34bd('0x6')](_0x34bd('0x8'),auth['isAuthenticated'](),controller[_0x34bd('0x9')]);router[_0x34bd('0x6')](_0x34bd('0xa'),auth[_0x34bd('0x7')](),controller[_0x34bd('0xb')]);router[_0x34bd('0xc')]('/:id',auth[_0x34bd('0x7')](),controller[_0x34bd('0xd')]);router[_0x34bd('0xe')](_0x34bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x34bd('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 7b10a23..eaf36a0 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 _0xf663=['moment','exports','STRING','INTEGER','DATE','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize'];(function(_0x545a99,_0x4a2d23){var _0xcd4841=function(_0x573b83){while(--_0x573b83){_0x545a99['push'](_0x545a99['shift']());}};_0xcd4841(++_0x4a2d23);}(_0xf663,0x16b));var _0x3f66=function(_0x30ed79,_0x5cdfdb){_0x30ed79=_0x30ed79-0x0;var _0x5a2f51=_0xf663[_0x30ed79];return _0x5a2f51;};'use strict';var Sequelize=require(_0x3f66('0x0'));var moment=require(_0x3f66('0x1'));module[_0x3f66('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3f66('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3f66('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3f66('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3f66('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3f66('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3f66('0x5')]},'droptime':{'type':Sequelize[_0x3f66('0x5')]},'endtime':{'type':Sequelize[_0x3f66('0x5')]},'ringtime':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3f66('0x3')]},'campaigntype':{'type':Sequelize[_0x3f66('0x3')]},'membername':{'type':Sequelize[_0x3f66('0x3')]},'reason':{'type':Sequelize[_0x3f66('0x3')]},'disposition':{'type':Sequelize[_0x3f66('0x3')]},'secondDisposition':{'type':Sequelize[_0x3f66('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x3f66('0x5')],'set':function(_0x5e0a72){var _0x203123=this[_0x3f66('0x6')](_0x3f66('0x7'));if(_0x203123&&_0x5e0a72){this[_0x3f66('0x8')](_0x3f66('0x9'),moment(_0x5e0a72)[_0x3f66('0xa')](moment(_0x203123),'seconds'));}return this['setDataValue'](_0x3f66('0xb'),_0x5e0a72);}},'amd':{'type':Sequelize[_0x3f66('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3f66('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3f66('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3f66('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3f66('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3f66('0x5')]},'deleted':{'type':Sequelize[_0x3f66('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3f66('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3f66('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb630=['DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x195ccc,_0x1d534b){var _0x1b8fc0=function(_0x1b65fa){while(--_0x1b65fa){_0x195ccc['push'](_0x195ccc['shift']());}};_0x1b8fc0(++_0x1d534b);}(_0xb630,0x19b));var _0x0b63=function(_0x361bb4,_0x411189){_0x361bb4=_0x361bb4-0x0;var _0x3e88c3=_0xb630[_0x361bb4];return _0x3e88c3;};'use strict';var Sequelize=require(_0x0b63('0x0'));var moment=require(_0x0b63('0x1'));module[_0x0b63('0x2')]={'state':{'type':Sequelize[_0x0b63('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x0b63('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0b63('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0b63('0x4')]},'originatecalleridname':{'type':Sequelize[_0x0b63('0x4')]},'calleridnum':{'type':Sequelize[_0x0b63('0x4')]},'calleridname':{'type':Sequelize[_0x0b63('0x4')]},'starttime':{'type':Sequelize[_0x0b63('0x5')]},'responsetime':{'type':Sequelize[_0x0b63('0x5')]},'answertime':{'type':Sequelize[_0x0b63('0x5')]},'droptime':{'type':Sequelize[_0x0b63('0x5')]},'endtime':{'type':Sequelize[_0x0b63('0x5')]},'ringtime':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0b63('0x4')]},'campaigntype':{'type':Sequelize[_0x0b63('0x4')]},'membername':{'type':Sequelize[_0x0b63('0x4')]},'reason':{'type':Sequelize[_0x0b63('0x4')]},'disposition':{'type':Sequelize[_0x0b63('0x4')]},'secondDisposition':{'type':Sequelize[_0x0b63('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0b63('0x4')]},'dispositionat':{'type':Sequelize[_0x0b63('0x5')],'set':function(_0x29758a){var _0x166599=this[_0x0b63('0x6')](_0x0b63('0x7'));if(_0x166599&&_0x29758a){this[_0x0b63('0x8')](_0x0b63('0x9'),moment(_0x29758a)[_0x0b63('0xa')](moment(_0x166599),_0x0b63('0xb')));}return this[_0x0b63('0x8')]('dispositionat',_0x29758a);}},'amd':{'type':Sequelize[_0x0b63('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0b63('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0b63('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0b63('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0b63('0x5')]},'callback':{'type':Sequelize[_0x0b63('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0b63('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0b63('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0b63('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0b63('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 19e3b4a..b8c7f45 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 _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end'];(function(_0x5ba222,_0x281d54){var _0x39450f=function(_0xabb78d){while(--_0xabb78d){_0x5ba222['push'](_0x5ba222['shift']());}};_0x39450f(++_0x281d54);}(_0xb016,0x159));var _0x6b01=function(_0x354f95,_0x41e8eb){_0x354f95=_0x354f95-0x0;var _0x2499b6=_0xb016[_0x354f95];return _0x2499b6;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file +var _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','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','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','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0xcdd4f9,_0x470893){var _0x9dd6b8=function(_0x3c1617){while(--_0x3c1617){_0xcdd4f9['push'](_0xcdd4f9['shift']());}};_0x9dd6b8(++_0x470893);}(_0x2ef3,0xba));var _0x32ef=function(_0x229dd1,_0x9cbac6){_0x229dd1=_0x229dd1-0x0;var _0x78bafc=_0x2ef3[_0x229dd1];return _0x78bafc;};'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['CmHopperFinal'][_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['CmHopperFinal'][_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['CmHopperFinal']['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')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 5ce2364..c420206 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 _0xfc0e=['util','../../config/logger','moment','bluebird','path','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x3496d3,_0x4467a2){var _0x509096=function(_0xcc66bc){while(--_0xcc66bc){_0x3496d3['push'](_0x3496d3['shift']());}};_0x509096(++_0x4467a2);}(_0xfc0e,0x1a3));var _0xefc0=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0xfc0e[_0x1af5b2];return _0xf1aa2d;};'use strict';var _=require(_0xefc0('0x0'));var util=require(_0xefc0('0x1'));var logger=require(_0xefc0('0x2'))('api');var moment=require(_0xefc0('0x3'));var BPromise=require(_0xefc0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefc0('0x5'));var rimraf=require(_0xefc0('0x6'));var config=require('../../config/environment');var attributes=require(_0xefc0('0x7'));module[_0xefc0('0x8')]=function(_0xd92f25,_0x53d4a4){return _0xd92f25[_0xefc0('0x9')](_0xefc0('0xa'),attributes,{'tableName':_0xefc0('0xb'),'paranoid':![],'indexes':[{'name':_0xefc0('0xc'),'fields':[_0xefc0('0xc')]},{'name':_0xefc0('0xd'),'fields':[_0xefc0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5e1=['request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xc5e1,0xb1));var _0x1c5e=function(_0x26676d,_0x17ea81){_0x26676d=_0x26676d-0x0;var _0x491dd7=_0xc5e1[_0x26676d];return _0x491dd7;};'use strict';var _=require('lodash');var util=require(_0x1c5e('0x0'));var logger=require(_0x1c5e('0x1'))(_0x1c5e('0x2'));var moment=require(_0x1c5e('0x3'));var BPromise=require(_0x1c5e('0x4'));var rp=require(_0x1c5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c5e('0x6'));var config=require(_0x1c5e('0x7'));var attributes=require(_0x1c5e('0x8'));module[_0x1c5e('0x9')]=function(_0x53b66a,_0x304d73){return _0x53b66a[_0x1c5e('0xa')](_0x1c5e('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x1c5e('0xc')]},{'name':'uniqueid','fields':[_0x1c5e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b5e43bf..1a72ba0 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(_0xc810b6,_0x4afefa){var _0x2c1de7=function(_0x50a253){while(--_0x50a253){_0xc810b6['push'](_0xc810b6['shift']());}};_0x2c1de7(++_0x4afefa);}(_0xb10b,0x12a));var _0xbb10=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xb10b[_0x1afabf];return _0x497ff1;};'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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x44d5b0,_0x365d4a){var _0x39119e=function(_0x1bcc43){while(--_0x1bcc43){_0x44d5b0['push'](_0x44d5b0['shift']());}};_0x39119e(++_0x365d4a);}(_0x7a54,0x106));var _0x47a5=function(_0x178229,_0xb66343){_0x178229=_0x178229-0x0;var _0x6a92b8=_0x7a54[_0x178229];return _0x6a92b8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index cea0ade..b1d3711 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 _0x0a93=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/checkContactHopper','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','index','get','describe','/:id','show','/voice/queue/countAttributes/:id','isAuthenticated'];(function(_0x24047b,_0xa2a63a){var _0x2ee191=function(_0x3d16ba){while(--_0x3d16ba){_0x24047b['push'](_0x24047b['shift']());}};_0x2ee191(++_0xa2a63a);}(_0x0a93,0x6a));var _0x30a9=function(_0x2a7d65,_0x8021b2){_0x2a7d65=_0x2a7d65-0x0;var _0xb20e5c=_0x0a93[_0x2a7d65];return _0xb20e5c;};'use strict';var multer=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var path=require(_0x30a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x30a9('0x3'));var router=express[_0x30a9('0x4')]();var fs_extra=require(_0x30a9('0x5'));var auth=require(_0x30a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x30a9('0x7')]);router[_0x30a9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x30a9('0x9')]);router[_0x30a9('0x8')](_0x30a9('0xa'),auth['isAuthenticated'](),controller[_0x30a9('0xb')]);router[_0x30a9('0x8')](_0x30a9('0xc'),auth[_0x30a9('0xd')](),controller[_0x30a9('0xe')]);router[_0x30a9('0x8')](_0x30a9('0xf'),auth[_0x30a9('0xd')](),controller[_0x30a9('0x10')]);router['post'](_0x30a9('0x11'),auth[_0x30a9('0xd')](),controller[_0x30a9('0x12')]);router[_0x30a9('0x13')]('/voice/campaign/moveContacts/:id',auth[_0x30a9('0xd')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x30a9('0x13')](_0x30a9('0x14'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x30a9('0x15')](_0x30a9('0xa'),auth['isAuthenticated'](),controller[_0x30a9('0x16')]);module[_0x30a9('0x17')]=router; \ No newline at end of file +var _0x7200=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x7488c6,_0x1b2889){var _0x50fafa=function(_0x5dbf64){while(--_0x5dbf64){_0x7488c6['push'](_0x7488c6['shift']());}};_0x50fafa(++_0x1b2889);}(_0x7200,0x1a8));var _0x0720=function(_0x33e55a,_0x3d5690){_0x33e55a=_0x33e55a-0x0;var _0x542283=_0x7200[_0x33e55a];return _0x542283;};'use strict';var multer=require(_0x0720('0x0'));var util=require('util');var path=require(_0x0720('0x1'));var timeout=require('connect-timeout');var express=require(_0x0720('0x2'));var router=express[_0x0720('0x3')]();var fs_extra=require(_0x0720('0x4'));var auth=require(_0x0720('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0720('0x6'));var controller=require(_0x0720('0x7'));router[_0x0720('0x8')]('/',auth[_0x0720('0x9')](),controller[_0x0720('0xa')]);router[_0x0720('0x8')]('/describe',auth[_0x0720('0x9')](),controller[_0x0720('0xb')]);router[_0x0720('0x8')](_0x0720('0xc'),auth[_0x0720('0x9')](),controller[_0x0720('0xd')]);router[_0x0720('0x8')](_0x0720('0xe'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x0720('0x8')]('/campaign/countAttributes/:id',auth[_0x0720('0x9')](),controller[_0x0720('0xf')]);router[_0x0720('0x10')](_0x0720('0x11'),auth[_0x0720('0x9')](),controller[_0x0720('0x12')]);router[_0x0720('0x10')](_0x0720('0x13'),auth[_0x0720('0x9')](),controller[_0x0720('0x14')]);router[_0x0720('0x10')](_0x0720('0x15'),auth[_0x0720('0x9')](),controller[_0x0720('0x16')]);router[_0x0720('0x17')](_0x0720('0xc'),auth[_0x0720('0x9')](),controller[_0x0720('0x18')]);module[_0x0720('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5899fd3..60d4238 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 _0x0957=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x2f6232,_0x30d073){var _0x42a65d=function(_0x5d3112){while(--_0x5d3112){_0x2f6232['push'](_0x2f6232['shift']());}};_0x42a65d(++_0x30d073);}(_0x0957,0x1a0));var _0x7095=function(_0xd22de5,_0x492328){_0xd22de5=_0xd22de5-0x0;var _0x4b36f4=_0x0957[_0xd22de5];return _0x4b36f4;};'use strict';var Sequelize=require('sequelize');module[_0x7095('0x0')]={'state':{'type':Sequelize[_0x7095('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7095('0x2')]},'scheduledat':{'type':Sequelize[_0x7095('0x3')]},'countbusyretry':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7095('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x7095('0x2')]},'originatecalleridname':{'type':Sequelize[_0x7095('0x2')]},'calleridnum':{'type':Sequelize[_0x7095('0x2')]},'calleridname':{'type':Sequelize[_0x7095('0x2')]},'starttime':{'type':Sequelize[_0x7095('0x3')]},'responsetime':{'type':Sequelize[_0x7095('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7095('0x3')]},'ringtime':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x7095('0x2')]},'membername':{'type':Sequelize[_0x7095('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x7095('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7095('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7095('0x3')]},'recallme':{'type':Sequelize[_0x7095('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7095('0x3')]},'edited':{'type':Sequelize[_0x7095('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7095('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xde2d=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x5e2256,_0x39ab49){var _0x445f1c=function(_0x351010){while(--_0x351010){_0x5e2256['push'](_0x5e2256['shift']());}};_0x445f1c(++_0x39ab49);}(_0xde2d,0x1d7));var _0xdde2=function(_0x41cf04,_0x41e49b){_0x41cf04=_0x41cf04-0x0;var _0x270ada=_0xde2d[_0x41cf04];return _0x270ada;};'use strict';var Sequelize=require('sequelize');module[_0xdde2('0x0')]={'state':{'type':Sequelize[_0xdde2('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xdde2('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdde2('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xdde2('0x2')]},'originatecalleridname':{'type':Sequelize[_0xdde2('0x2')]},'calleridnum':{'type':Sequelize[_0xdde2('0x2')]},'calleridname':{'type':Sequelize[_0xdde2('0x2')]},'starttime':{'type':Sequelize[_0xdde2('0x3')]},'responsetime':{'type':Sequelize[_0xdde2('0x3')]},'answertime':{'type':Sequelize[_0xdde2('0x3')]},'droptime':{'type':Sequelize[_0xdde2('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdde2('0x2')]},'campaign':{'type':Sequelize[_0xdde2('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdde2('0x2')]},'reason':{'type':Sequelize[_0xdde2('0x2')]},'amd':{'type':Sequelize[_0xdde2('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xdde2('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdde2('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdde2('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xdde2('0x3')]},'edited':{'type':Sequelize[_0xdde2('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdde2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a4518fe..a2822aa 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 _0x3de5=['status','end','offset','undefined','count','limit','set','json','apply','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','CmHopperHistory','findAll','rows','catch','show','params','keys','find','create','body','describe','uniqueid','zip-dir','moment','mustache','util','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x128b1c,_0x6343a1){var _0x25123d=function(_0x4da54f){while(--_0x4da54f){_0x128b1c['push'](_0x128b1c['shift']());}};_0x25123d(++_0x6343a1);}(_0x3de5,0x73));var _0x53de=function(_0x35c2e6,_0x35b13c){_0x35c2e6=_0x35c2e6-0x0;var _0x1126c4=_0x3de5[_0x35c2e6];return _0x1126c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x53de('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x53de('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x53de('0x2'));var util=require(_0x53de('0x3'));var path=require('path');var sox=require(_0x53de('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53de('0x5'));var _=require('lodash');var squel=require(_0x53de('0x6'));var crypto=require(_0x53de('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x53de('0x8'));var toCsv=require(_0x53de('0x9'));var querystring=require(_0x53de('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53de('0xb'));var qs=require(_0x53de('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53de('0xd'));var utils=require(_0x53de('0xe'));var config=require(_0x53de('0xf'));var licenseUtil=require(_0x53de('0x10'));var db=require(_0x53de('0x11'))['db'];function respondWithStatusCode(_0x2f85e9,_0xa653f3){_0xa653f3=_0xa653f3||0xcc;return function(_0x526739){if(_0x526739){return _0x2f85e9[_0x53de('0x12')](_0xa653f3);}return _0x2f85e9[_0x53de('0x13')](_0xa653f3)[_0x53de('0x14')]();};}function respondWithResult(_0x336b9b,_0x550943){_0x550943=_0x550943||0xc8;return function(_0x7b41ec){if(_0x7b41ec){return _0x336b9b[_0x53de('0x13')](_0x550943)['json'](_0x7b41ec);}};}function respondWithFilteredResult(_0x31bc90,_0x159343){return function(_0x456fc0){if(_0x456fc0){var _0x371e29=typeof _0x159343[_0x53de('0x15')]==='undefined'&&typeof _0x159343['limit']===_0x53de('0x16');var _0x375478=_0x456fc0['count'];var _0xbeef2c=_0x371e29?0x0:_0x159343[_0x53de('0x15')];var _0x3e90cd=_0x371e29?_0x456fc0[_0x53de('0x17')]:_0x159343[_0x53de('0x15')]+_0x159343[_0x53de('0x18')];var _0x553efd;if(_0x3e90cd>=_0x375478){_0x3e90cd=_0x375478;_0x553efd=0xc8;}else{_0x553efd=0xce;}_0x31bc90['status'](_0x553efd);return _0x31bc90[_0x53de('0x19')]('Content-Range',_0xbeef2c+'-'+_0x3e90cd+'/'+_0x375478)[_0x53de('0x1a')](_0x456fc0);}return null;};}function patchUpdates(_0x307e45){return function(_0x2198da){try{jsonpatch[_0x53de('0x1b')](_0x2198da,_0x307e45,!![]);}catch(_0x3f9176){return BPromise['reject'](_0x3f9176);}return _0x2198da[_0x53de('0x1c')]();};}function saveUpdates(_0x104877,_0x4b6c70){return function(_0x1c4073){if(_0x1c4073){return _0x1c4073[_0x53de('0x1d')](_0x104877)[_0x53de('0x1e')](function(_0x20f50c){return _0x20f50c;});}return null;};}function removeEntity(_0x4ac7ec,_0x28a589){return function(_0x5c9d20){if(_0x5c9d20){return _0x5c9d20['destroy']()[_0x53de('0x1e')](function(){_0x4ac7ec[_0x53de('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b084,_0x126160){return function(_0x283a96){if(!_0x283a96){_0x52b084['sendStatus'](0x194);}return _0x283a96;};}function handleError(_0xeb4327,_0x673e8d){_0x673e8d=_0x673e8d||0x1f4;return function(_0x330d99){logger['error'](_0x330d99[_0x53de('0x1f')]);if(_0x330d99[_0x53de('0x20')]){delete _0x330d99[_0x53de('0x20')];}_0xeb4327[_0x53de('0x13')](_0x673e8d)[_0x53de('0x21')](_0x330d99);};}exports[_0x53de('0x22')]=function(_0x5b8e9f,_0x5b1774){var _0x408960={},_0x1be020={},_0x4d46bb={'count':0x0,'rows':[]};var _0xa497b=_[_0x53de('0x23')](db['CmHopperHistory'][_0x53de('0x24')],function(_0x2392f2){return{'name':_0x2392f2[_0x53de('0x25')],'type':_0x2392f2['type']['key']};});_0x1be020[_0x53de('0x26')]=_[_0x53de('0x23')](_0xa497b,_0x53de('0x20'));_0x1be020[_0x53de('0x27')]=_['keys'](_0x5b8e9f['query']);_0x1be020[_0x53de('0x28')]=_[_0x53de('0x29')](_0x1be020[_0x53de('0x26')],_0x1be020['query']);_0x408960[_0x53de('0x2a')]=_[_0x53de('0x29')](_0x1be020[_0x53de('0x26')],qs[_0x53de('0x2b')](_0x5b8e9f[_0x53de('0x27')][_0x53de('0x2b')]));_0x408960[_0x53de('0x2a')]=_0x408960['attributes'][_0x53de('0x2c')]?_0x408960[_0x53de('0x2a')]:_0x1be020[_0x53de('0x26')];if(!_0x5b8e9f[_0x53de('0x27')][_0x53de('0x2d')](_0x53de('0x2e'))){_0x408960['limit']=qs[_0x53de('0x18')](_0x5b8e9f[_0x53de('0x27')][_0x53de('0x18')]);_0x408960[_0x53de('0x15')]=qs[_0x53de('0x15')](_0x5b8e9f[_0x53de('0x27')]['offset']);}_0x408960['order']=qs[_0x53de('0x2f')](_0x5b8e9f[_0x53de('0x27')][_0x53de('0x2f')]);_0x408960[_0x53de('0x30')]=qs[_0x53de('0x28')](_['pick'](_0x5b8e9f[_0x53de('0x27')],_0x1be020['filters']),_0xa497b);if(_0x5b8e9f[_0x53de('0x27')][_0x53de('0x31')]){_0x408960[_0x53de('0x30')]=_[_0x53de('0x32')](_0x408960['where'],{'$or':_[_0x53de('0x23')](_0xa497b,function(_0x162cf3){if(_0x162cf3[_0x53de('0x33')]!=='VIRTUAL'){var _0x520081={};_0x520081[_0x162cf3[_0x53de('0x20')]]={'$like':'%'+_0x5b8e9f['query'][_0x53de('0x31')]+'%'};return _0x520081;}})});}_0x408960=_['merge']({},_0x408960,_0x5b8e9f[_0x53de('0x34')]);var _0x1ce951={'where':_0x408960[_0x53de('0x30')]};return db['CmHopperHistory'][_0x53de('0x17')](_0x1ce951)[_0x53de('0x1e')](function(_0x3fc7dc){_0x4d46bb[_0x53de('0x17')]=_0x3fc7dc;if(_0x5b8e9f[_0x53de('0x27')][_0x53de('0x35')]){_0x408960[_0x53de('0x36')]=[{'all':!![]}];}return db[_0x53de('0x37')][_0x53de('0x38')](_0x408960);})[_0x53de('0x1e')](function(_0x6ede23){_0x4d46bb[_0x53de('0x39')]=_0x6ede23;return _0x4d46bb;})['then'](respondWithFilteredResult(_0x5b1774,_0x408960))[_0x53de('0x3a')](handleError(_0x5b1774,null));};exports[_0x53de('0x3b')]=function(_0x43cd7a,_0x23f27f){var _0x1d5995={'raw':!![],'where':{'id':_0x43cd7a[_0x53de('0x3c')]['id']}},_0x4ce6fe={};_0x4ce6fe[_0x53de('0x26')]=_['keys'](db[_0x53de('0x37')][_0x53de('0x24')]);_0x4ce6fe[_0x53de('0x27')]=_[_0x53de('0x3d')](_0x43cd7a[_0x53de('0x27')]);_0x4ce6fe[_0x53de('0x28')]=_[_0x53de('0x29')](_0x4ce6fe[_0x53de('0x26')],_0x4ce6fe[_0x53de('0x27')]);_0x1d5995[_0x53de('0x2a')]=_[_0x53de('0x29')](_0x4ce6fe['model'],qs[_0x53de('0x2b')](_0x43cd7a[_0x53de('0x27')][_0x53de('0x2b')]));_0x1d5995['attributes']=_0x1d5995[_0x53de('0x2a')][_0x53de('0x2c')]?_0x1d5995['attributes']:_0x4ce6fe[_0x53de('0x26')];if(_0x43cd7a[_0x53de('0x27')][_0x53de('0x35')]){_0x1d5995[_0x53de('0x36')]=[{'all':!![]}];}_0x1d5995=_['merge']({},_0x1d5995,_0x43cd7a[_0x53de('0x34')]);return db[_0x53de('0x37')][_0x53de('0x3e')](_0x1d5995)[_0x53de('0x1e')](handleEntityNotFound(_0x23f27f,null))[_0x53de('0x1e')](respondWithResult(_0x23f27f,null))[_0x53de('0x3a')](handleError(_0x23f27f,null));};exports['create']=function(_0xb8ceef,_0x557d36){return db['CmHopperHistory'][_0x53de('0x3f')](_0xb8ceef[_0x53de('0x40')],{})[_0x53de('0x1e')](respondWithResult(_0x557d36,0xc9))[_0x53de('0x3a')](handleError(_0x557d36,null));};exports[_0x53de('0x41')]=function(_0x3c0d00,_0x4272e6){return db[_0x53de('0x37')][_0x53de('0x41')]()[_0x53de('0x1e')](respondWithResult(_0x4272e6,null))[_0x53de('0x3a')](handleError(_0x4272e6,null));};exports[_0x53de('0x1d')]=function(_0x4f5000,_0x32ca0a){if(_0x4f5000[_0x53de('0x40')][_0x53de('0x42')]){delete _0x4f5000['body'][_0x53de('0x42')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x4f5000[_0x53de('0x3c')]['id']}})[_0x53de('0x1e')](handleEntityNotFound(_0x32ca0a,null))[_0x53de('0x1e')](saveUpdates(_0x4f5000[_0x53de('0x40')],null))[_0x53de('0x1e')](respondWithResult(_0x32ca0a,null))[_0x53de('0x3a')](handleError(_0x32ca0a,null));}; \ No newline at end of file +var _0x43ad=['params','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','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','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','intersection','create','body','describe','uniqueid','find'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x43ad,0xeb));var _0xd43a=function(_0x226ce5,_0x4bf836){_0x226ce5=_0x226ce5-0x0;var _0x522612=_0x43ad[_0x226ce5];return _0x522612;};'use strict';var emlformat=require(_0xd43a('0x0'));var rimraf=require(_0xd43a('0x1'));var zipdir=require(_0xd43a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd43a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd43a('0x4'));var util=require(_0xd43a('0x5'));var path=require(_0xd43a('0x6'));var sox=require(_0xd43a('0x7'));var csv=require(_0xd43a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd43a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd43a('0xa'));var deskjs=require(_0xd43a('0xb'));var toCsv=require(_0xd43a('0x8'));var querystring=require(_0xd43a('0xc'));var Papa=require(_0xd43a('0xd'));var Redis=require(_0xd43a('0xe'));var authService=require(_0xd43a('0xf'));var qs=require(_0xd43a('0x10'));var as=require(_0xd43a('0x11'));var hardwareService=require(_0xd43a('0x12'));var logger=require(_0xd43a('0x13'))(_0xd43a('0x14'));var utils=require('../../config/utils');var config=require(_0xd43a('0x15'));var licenseUtil=require(_0xd43a('0x16'));var db=require(_0xd43a('0x17'))['db'];function respondWithStatusCode(_0x376b8c,_0x32bc7a){_0x32bc7a=_0x32bc7a||0xcc;return function(_0x59097f){if(_0x59097f){return _0x376b8c[_0xd43a('0x18')](_0x32bc7a);}return _0x376b8c[_0xd43a('0x19')](_0x32bc7a)[_0xd43a('0x1a')]();};}function respondWithResult(_0x3fb42e,_0x3c6f69){_0x3c6f69=_0x3c6f69||0xc8;return function(_0x498698){if(_0x498698){return _0x3fb42e[_0xd43a('0x19')](_0x3c6f69)['json'](_0x498698);}};}function respondWithFilteredResult(_0x2f1da2,_0x81b913){return function(_0x56ec66){if(_0x56ec66){var _0x5a383e=typeof _0x81b913['offset']===_0xd43a('0x1b')&&typeof _0x81b913[_0xd43a('0x1c')]==='undefined';var _0x2129ad=_0x56ec66[_0xd43a('0x1d')];var _0x1a193d=_0x5a383e?0x0:_0x81b913[_0xd43a('0x1e')];var _0x58641e=_0x5a383e?_0x56ec66['count']:_0x81b913[_0xd43a('0x1e')]+_0x81b913[_0xd43a('0x1c')];var _0x67c1e9;if(_0x58641e>=_0x2129ad){_0x58641e=_0x2129ad;_0x67c1e9=0xc8;}else{_0x67c1e9=0xce;}_0x2f1da2[_0xd43a('0x19')](_0x67c1e9);return _0x2f1da2['set'](_0xd43a('0x1f'),_0x1a193d+'-'+_0x58641e+'/'+_0x2129ad)[_0xd43a('0x20')](_0x56ec66);}return null;};}function patchUpdates(_0x3be639){return function(_0x49d4df){try{jsonpatch[_0xd43a('0x21')](_0x49d4df,_0x3be639,!![]);}catch(_0x43e0c){return BPromise[_0xd43a('0x22')](_0x43e0c);}return _0x49d4df[_0xd43a('0x23')]();};}function saveUpdates(_0x50595f,_0x1863c3){return function(_0x1bbaf1){if(_0x1bbaf1){return _0x1bbaf1[_0xd43a('0x24')](_0x50595f)[_0xd43a('0x25')](function(_0x1575bb){return _0x1575bb;});}return null;};}function removeEntity(_0x3f7af1,_0x337cd3){return function(_0x2b603f){if(_0x2b603f){return _0x2b603f[_0xd43a('0x26')]()['then'](function(){_0x3f7af1[_0xd43a('0x19')](0xcc)[_0xd43a('0x1a')]();});}};}function handleEntityNotFound(_0x3032c3,_0x29c630){return function(_0x1974b0){if(!_0x1974b0){_0x3032c3[_0xd43a('0x18')](0x194);}return _0x1974b0;};}function handleError(_0x158b80,_0x5cad9f){_0x5cad9f=_0x5cad9f||0x1f4;return function(_0xb6bb10){logger[_0xd43a('0x27')](_0xb6bb10['stack']);if(_0xb6bb10[_0xd43a('0x28')]){delete _0xb6bb10[_0xd43a('0x28')];}_0x158b80[_0xd43a('0x19')](_0x5cad9f)[_0xd43a('0x29')](_0xb6bb10);};}exports[_0xd43a('0x2a')]=function(_0x16eba8,_0x20ca47){var _0x3c10e9={},_0x52d3fe={},_0x327414={'count':0x0,'rows':[]};var _0x20ea5d=_[_0xd43a('0x2b')](db[_0xd43a('0x2c')][_0xd43a('0x2d')],function(_0x2ecb11){return{'name':_0x2ecb11[_0xd43a('0x2e')],'type':_0x2ecb11[_0xd43a('0x2f')][_0xd43a('0x30')]};});_0x52d3fe[_0xd43a('0x31')]=_[_0xd43a('0x2b')](_0x20ea5d,'name');_0x52d3fe['query']=_[_0xd43a('0x32')](_0x16eba8['query']);_0x52d3fe['filters']=_['intersection'](_0x52d3fe[_0xd43a('0x31')],_0x52d3fe[_0xd43a('0x33')]);_0x3c10e9[_0xd43a('0x34')]=_['intersection'](_0x52d3fe[_0xd43a('0x31')],qs[_0xd43a('0x35')](_0x16eba8[_0xd43a('0x33')][_0xd43a('0x35')]));_0x3c10e9[_0xd43a('0x34')]=_0x3c10e9[_0xd43a('0x34')][_0xd43a('0x36')]?_0x3c10e9[_0xd43a('0x34')]:_0x52d3fe['model'];if(!_0x16eba8[_0xd43a('0x33')][_0xd43a('0x37')](_0xd43a('0x38'))){_0x3c10e9['limit']=qs[_0xd43a('0x1c')](_0x16eba8[_0xd43a('0x33')][_0xd43a('0x1c')]);_0x3c10e9['offset']=qs[_0xd43a('0x1e')](_0x16eba8[_0xd43a('0x33')][_0xd43a('0x1e')]);}_0x3c10e9[_0xd43a('0x39')]=qs[_0xd43a('0x3a')](_0x16eba8[_0xd43a('0x33')][_0xd43a('0x3a')]);_0x3c10e9[_0xd43a('0x3b')]=qs[_0xd43a('0x3c')](_[_0xd43a('0x3d')](_0x16eba8[_0xd43a('0x33')],_0x52d3fe[_0xd43a('0x3c')]),_0x20ea5d);if(_0x16eba8[_0xd43a('0x33')][_0xd43a('0x3e')]){_0x3c10e9[_0xd43a('0x3b')]=_[_0xd43a('0x3f')](_0x3c10e9[_0xd43a('0x3b')],{'$or':_[_0xd43a('0x2b')](_0x20ea5d,function(_0x5b1b37){if(_0x5b1b37[_0xd43a('0x2f')]!=='VIRTUAL'){var _0x6156fd={};_0x6156fd[_0x5b1b37['name']]={'$like':'%'+_0x16eba8[_0xd43a('0x33')][_0xd43a('0x3e')]+'%'};return _0x6156fd;}})});}_0x3c10e9=_['merge']({},_0x3c10e9,_0x16eba8[_0xd43a('0x40')]);var _0xe3bda8={'where':_0x3c10e9[_0xd43a('0x3b')]};return db[_0xd43a('0x2c')][_0xd43a('0x1d')](_0xe3bda8)['then'](function(_0x419d50){_0x327414[_0xd43a('0x1d')]=_0x419d50;if(_0x16eba8[_0xd43a('0x33')][_0xd43a('0x41')]){_0x3c10e9[_0xd43a('0x42')]=[{'all':!![]}];}return db[_0xd43a('0x2c')][_0xd43a('0x43')](_0x3c10e9);})['then'](function(_0x135915){_0x327414[_0xd43a('0x44')]=_0x135915;return _0x327414;})['then'](respondWithFilteredResult(_0x20ca47,_0x3c10e9))[_0xd43a('0x45')](handleError(_0x20ca47,null));};exports[_0xd43a('0x46')]=function(_0x17cfa2,_0x5c4f66){var _0xb956a4={'raw':!![],'where':{'id':_0x17cfa2['params']['id']}},_0x2f4b56={};_0x2f4b56[_0xd43a('0x31')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x2f4b56[_0xd43a('0x33')]=_[_0xd43a('0x32')](_0x17cfa2[_0xd43a('0x33')]);_0x2f4b56['filters']=_['intersection'](_0x2f4b56[_0xd43a('0x31')],_0x2f4b56[_0xd43a('0x33')]);_0xb956a4[_0xd43a('0x34')]=_[_0xd43a('0x47')](_0x2f4b56[_0xd43a('0x31')],qs[_0xd43a('0x35')](_0x17cfa2[_0xd43a('0x33')]['fields']));_0xb956a4[_0xd43a('0x34')]=_0xb956a4[_0xd43a('0x34')][_0xd43a('0x36')]?_0xb956a4[_0xd43a('0x34')]:_0x2f4b56[_0xd43a('0x31')];if(_0x17cfa2[_0xd43a('0x33')][_0xd43a('0x41')]){_0xb956a4[_0xd43a('0x42')]=[{'all':!![]}];}_0xb956a4=_[_0xd43a('0x3f')]({},_0xb956a4,_0x17cfa2[_0xd43a('0x40')]);return db[_0xd43a('0x2c')]['find'](_0xb956a4)[_0xd43a('0x25')](handleEntityNotFound(_0x5c4f66,null))['then'](respondWithResult(_0x5c4f66,null))[_0xd43a('0x45')](handleError(_0x5c4f66,null));};exports[_0xd43a('0x48')]=function(_0x4c0a9f,_0x41958c){return db[_0xd43a('0x2c')]['create'](_0x4c0a9f[_0xd43a('0x49')],{})['then'](respondWithResult(_0x41958c,0xc9))[_0xd43a('0x45')](handleError(_0x41958c,null));};exports[_0xd43a('0x4a')]=function(_0x3181ed,_0x878129){return db[_0xd43a('0x2c')][_0xd43a('0x4a')]()['then'](respondWithResult(_0x878129,null))['catch'](handleError(_0x878129,null));};exports['update']=function(_0x53e66d,_0x4027ee){if(_0x53e66d[_0xd43a('0x49')][_0xd43a('0x4b')]){delete _0x53e66d[_0xd43a('0x49')][_0xd43a('0x4b')];}return db[_0xd43a('0x2c')][_0xd43a('0x4c')]({'where':{'uniqueid':_0x53e66d[_0xd43a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4027ee,null))['then'](saveUpdates(_0x53e66d[_0xd43a('0x49')],null))[_0xd43a('0x25')](respondWithResult(_0x4027ee,null))['catch'](handleError(_0x4027ee,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c9b0125..6b23674 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 _0x5b12=['../../config/logger','moment','request-promise','path','../../config/environment','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x5e6cb8,_0x1d1eb5){var _0x41754f=function(_0x5ef4ef){while(--_0x5ef4ef){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x41754f(++_0x1d1eb5);}(_0x5b12,0xa3));var _0x25b1=function(_0x5859e5,_0x35543a){_0x5859e5=_0x5859e5-0x0;var _0x1b0ae9=_0x5b12[_0x5859e5];return _0x1b0ae9;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var logger=require(_0x25b1('0x2'))('api');var moment=require(_0x25b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x25b1('0x4'));var fs=require('fs');var path=require(_0x25b1('0x5'));var rimraf=require('rimraf');var config=require(_0x25b1('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x35d90b,_0x5523c9){return _0x35d90b['define'](_0x25b1('0x7'),attributes,{'tableName':_0x25b1('0x8'),'paranoid':![],'indexes':[{'name':_0x25b1('0x9'),'fields':[_0x25b1('0x9')]},{'name':_0x25b1('0xa'),'fields':[_0x25b1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb59=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x2a5276,_0x26b9aa){var _0x278e97=function(_0x566a8d){while(--_0x566a8d){_0x2a5276['push'](_0x2a5276['shift']());}};_0x278e97(++_0x26b9aa);}(_0xbb59,0xec));var _0x9bb5=function(_0xe1ae48,_0x48ccfe){_0xe1ae48=_0xe1ae48-0x0;var _0x4fe82b=_0xbb59[_0xe1ae48];return _0x4fe82b;};'use strict';var _=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var logger=require(_0x9bb5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9bb5('0x3'));var rp=require(_0x9bb5('0x4'));var fs=require('fs');var path=require(_0x9bb5('0x5'));var rimraf=require(_0x9bb5('0x6'));var config=require(_0x9bb5('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x9bb5('0x8')]=function(_0x2c85f4,_0x1e57b2){return _0x2c85f4[_0x9bb5('0x9')](_0x9bb5('0xa'),attributes,{'tableName':_0x9bb5('0xb'),'paranoid':![],'indexes':[{'name':_0x9bb5('0xc'),'fields':[_0x9bb5('0xc')]},{'name':_0x9bb5('0xd'),'fields':[_0x9bb5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 50de081..e81ffeb 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 _0x5cd8=['`state`\x20=\x204,\x20`talktime`,\x20null','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','stringify','AvgHandleTime','findAll','raw','where','sequelize','col','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x244a35,_0x1b1810){var _0x24b713=function(_0x27cb1e){while(--_0x27cb1e){_0x244a35['push'](_0x244a35['shift']());}};_0x24b713(++_0x1b1810);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x55adc6,_0x17f13c){_0x55adc6=_0x55adc6-0x0;var _0x324f72=_0x5cd8[_0x55adc6];return _0x324f72;};'use strict';var _=require(_0x85cd('0x0'));var util=require('util');var moment=require(_0x85cd('0x1'));var BPromise=require(_0x85cd('0x2'));var rs=require(_0x85cd('0x3'));var fs=require('fs');var Redis=require(_0x85cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x85cd('0x5'));var logger=require('../../config/logger')(_0x85cd('0x6'));var config=require(_0x85cd('0x7'));var jayson=require(_0x85cd('0x8'));var client=jayson[_0x85cd('0x9')][_0x85cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x598ab6,_0x1a8619,_0x1a69c4){return new BPromise(function(_0x5aa3c3,_0x1e002d){return client[_0x85cd('0xb')](_0x598ab6,_0x1a69c4)[_0x85cd('0xc')](function(_0x30204b){logger[_0x85cd('0xd')](_0x85cd('0xe'),_0x1a8619,_0x85cd('0xf'));logger[_0x85cd('0x10')](_0x85cd('0x11'),_0x1a8619,'request\x20sent',JSON['stringify'](_0x30204b));if(_0x30204b[_0x85cd('0x12')]){if(_0x30204b[_0x85cd('0x12')][_0x85cd('0x13')]===0x1f4){logger[_0x85cd('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1a8619,_0x30204b[_0x85cd('0x12')][_0x85cd('0x14')]);return _0x1e002d(_0x30204b[_0x85cd('0x12')][_0x85cd('0x14')]);}logger[_0x85cd('0x12')](_0x85cd('0xe'),_0x1a8619,_0x30204b[_0x85cd('0x12')][_0x85cd('0x14')]);return _0x5aa3c3(_0x30204b['error'][_0x85cd('0x14')]);}else{logger[_0x85cd('0xd')](_0x85cd('0xe'),_0x1a8619,_0x85cd('0xf'));_0x5aa3c3(_0x30204b[_0x85cd('0x15')]['message']);}})[_0x85cd('0x16')](function(_0x5164e8){logger[_0x85cd('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1a8619,_0x5164e8);_0x1e002d(_0x5164e8);});});}exports[_0x85cd('0x17')]=function(_0x4d9c64){var _0x40e2e5=this;return new Promise(function(_0x11292e,_0x238799){return db[_0x85cd('0x18')][_0x85cd('0x19')](_0x4d9c64[_0x85cd('0x1a')],{'raw':_0x4d9c64[_0x85cd('0x1b')]?_0x4d9c64[_0x85cd('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x85cd('0xc')](function(_0x425779){logger['info']('CreateCmHopperHistory',_0x4d9c64);logger['debug']('CreateCmHopperHistory',_0x4d9c64,JSON[_0x85cd('0x1c')](_0x425779));_0x11292e(_0x425779);})['catch'](function(_0x3cf6c6){logger[_0x85cd('0x12')](_0x85cd('0x17'),_0x3cf6c6[_0x85cd('0x14')],_0x4d9c64);_0x238799(_0x40e2e5['error'](0x1f4,_0x3cf6c6[_0x85cd('0x14')]));});});};exports[_0x85cd('0x1d')]=function(_0x358202){var _0x1e5b87=this;return new Promise(function(_0xb984cc,_0x37646b){return db['CmHopperHistory'][_0x85cd('0x1e')]({'raw':_0x358202[_0x85cd('0x1b')]?_0x358202[_0x85cd('0x1b')][_0x85cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x358202['options']?_0x358202[_0x85cd('0x1b')][_0x85cd('0x20')]||null:null,'attributes':[[db[_0x85cd('0x21')]['fn']('COUNT',db['sequelize'][_0x85cd('0x22')]('id')),'predictiveIntervalTotalCalls'],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')]['literal'](_0x85cd('0x24')))),_0x85cd('0x25')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db['sequelize']['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x28')))),_0x85cd('0x29')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x2a'),db['sequelize']['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x2b')))),_0x85cd('0x2c')],[db['sequelize']['fn'](_0x85cd('0x2a'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x2d')))),'predictiveIntervalAvgTalktime']]})[_0x85cd('0xc')](function(_0x3e76e4){logger['info'](_0x85cd('0x1d'),_0x358202);logger[_0x85cd('0x10')](_0x85cd('0x1d'),_0x358202,JSON['stringify'](_0x3e76e4));_0xb984cc(_0x3e76e4);})['catch'](function(_0x2c7b30){logger[_0x85cd('0x12')]('AvgHandleTime',_0x2c7b30['message'],_0x358202);_0x37646b(_0x1e5b87[_0x85cd('0x12')](0x1f4,_0x2c7b30['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x10f3a3){var _0x1d0585=this;return new Promise(function(_0x8e683f,_0x1cbf78){return db[_0x85cd('0x18')][_0x85cd('0x1e')]({'raw':_0x10f3a3[_0x85cd('0x1b')]?_0x10f3a3[_0x85cd('0x1b')][_0x85cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x10f3a3[_0x85cd('0x1b')]?_0x10f3a3[_0x85cd('0x1b')][_0x85cd('0x20')]||null:null,'attributes':[[_0x85cd('0x2e'),_0x85cd('0x2f')],[db[_0x85cd('0x21')]['fn']('COUNT',db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x30')))),_0x85cd('0x31')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x32')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0x85cd('0x33')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db['sequelize']['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x34')))),_0x85cd('0x35')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x85cd('0x26')](_0x85cd('0x36')))),_0x85cd('0x37')],[db['sequelize']['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')]['literal'](_0x85cd('0x38')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x39')))),_0x85cd('0x3a')],[db['sequelize']['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')](_0x85cd('0x3b')))),_0x85cd('0x3c')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x85cd('0x26')](_0x85cd('0x3d')))),_0x85cd('0x3e')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db['sequelize'][_0x85cd('0x26')](_0x85cd('0x3f')))),_0x85cd('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x85cd('0x41')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')][_0x85cd('0x26')]('`state`\x20=\x2016,\x201,\x20null'))),_0x85cd('0x42')],[db[_0x85cd('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85cd('0x21')]['literal'](_0x85cd('0x43')))),'outboundRejectCallsDay'],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['fn']('IF',db['sequelize'][_0x85cd('0x26')](_0x85cd('0x44')))),_0x85cd('0x45')]],'group':[_0x85cd('0x2e')]})['then'](function(_0x1fbee7){logger[_0x85cd('0xd')]('GetVoiceQueueHopperHistory',_0x10f3a3);logger[_0x85cd('0x10')]('GetVoiceQueueHopperHistory',_0x10f3a3,JSON[_0x85cd('0x1c')](_0x1fbee7));_0x8e683f(_0x1fbee7);})[_0x85cd('0x16')](function(_0xa10d45){logger[_0x85cd('0x12')](_0x85cd('0x46'),_0xa10d45[_0x85cd('0x14')],_0x10f3a3);_0x1cbf78(_0x1d0585['error'](0x1f4,_0xa10d45['message']));});});};exports[_0x85cd('0x47')]=function(_0x1bc1a9){var _0x211fc7=this;return new Promise(function(_0x3696bd,_0x4e370c){return db[_0x85cd('0x18')][_0x85cd('0x1e')]({'raw':_0x1bc1a9[_0x85cd('0x1b')]?_0x1bc1a9[_0x85cd('0x1b')][_0x85cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x1bc1a9[_0x85cd('0x1b')]?_0x1bc1a9[_0x85cd('0x1b')]['where']||null:null,'attributes':[['campaign',_0x85cd('0x2f')],[db[_0x85cd('0x21')]['fn'](_0x85cd('0x23'),db[_0x85cd('0x21')]['col']('id')),_0x85cd('0x48')],[db[_0x85cd('0x21')]['fn']('COUNT',db[_0x85cd('0x21')]['fn']('IF',db[_0x85cd('0x21')]['literal'](_0x85cd('0x24')))),'ivrAnswerCallsDay']],'group':[_0x85cd('0x2e')]})[_0x85cd('0xc')](function(_0xbac0de){logger[_0x85cd('0xd')](_0x85cd('0x47'),_0x1bc1a9);logger[_0x85cd('0x10')](_0x85cd('0x47'),_0x1bc1a9,JSON['stringify'](_0xbac0de));_0x3696bd(_0xbac0de);})['catch'](function(_0x2343cf){logger[_0x85cd('0x12')]('GetCampaignHopperHistory',_0x2343cf[_0x85cd('0x14')],_0x1bc1a9);_0x4e370c(_0x211fc7[_0x85cd('0x12')](0x1f4,_0x2343cf[_0x85cd('0x14')]));});});}; \ No newline at end of file +var _0xdfe9=['then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','findAll','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','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','GetVoiceQueueHopperHistory','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x411ab9,_0x4906a7){var _0x5efb93=function(_0x25e47b){while(--_0x25e47b){_0x411ab9['push'](_0x411ab9['shift']());}};_0x5efb93(++_0x4906a7);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x1cbb75,_0x13ecb3){_0x1cbb75=_0x1cbb75-0x0;var _0x37d2f6=_0xdfe9[_0x1cbb75];return _0x37d2f6;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var moment=require(_0x9dfe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dfe('0x2'));var db=require(_0x9dfe('0x3'))['db'];var utils=require(_0x9dfe('0x4'));var logger=require(_0x9dfe('0x5'))(_0x9dfe('0x6'));var config=require(_0x9dfe('0x7'));var jayson=require(_0x9dfe('0x8'));var client=jayson[_0x9dfe('0x9')][_0x9dfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3471f0,_0x13b6f8,_0x5e0faf){return new BPromise(function(_0x377c1e,_0xa21ae3){return client[_0x9dfe('0xb')](_0x3471f0,_0x5e0faf)[_0x9dfe('0xc')](function(_0xcd9ecb){logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,_0x9dfe('0xf'));logger['debug'](_0x9dfe('0x10'),_0x13b6f8,_0x9dfe('0xf'),JSON[_0x9dfe('0x11')](_0xcd9ecb));if(_0xcd9ecb[_0x9dfe('0x12')]){if(_0xcd9ecb['error']['code']===0x1f4){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb['error']['message']);return _0xa21ae3(_0xcd9ecb['error'][_0x9dfe('0x13')]);}logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);return _0x377c1e(_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);}else{logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,'request\x20sent');_0x377c1e(_0xcd9ecb['result'][_0x9dfe('0x13')]);}})['catch'](function(_0x1a7cbe){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0x1a7cbe);_0xa21ae3(_0x1a7cbe);});});}exports[_0x9dfe('0x14')]=function(_0x15e32b){var _0x1bddd4=this;return new Promise(function(_0x5c7158,_0x270796){return db[_0x9dfe('0x15')][_0x9dfe('0x16')](_0x15e32b[_0x9dfe('0x17')],{'raw':_0x15e32b[_0x9dfe('0x18')]?_0x15e32b[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![]})[_0x9dfe('0xc')](function(_0x439cd4){logger[_0x9dfe('0xd')](_0x9dfe('0x14'),_0x15e32b);logger[_0x9dfe('0x1a')](_0x9dfe('0x14'),_0x15e32b,JSON[_0x9dfe('0x11')](_0x439cd4));_0x5c7158(_0x439cd4);})['catch'](function(_0x484f22){logger[_0x9dfe('0x12')](_0x9dfe('0x14'),_0x484f22[_0x9dfe('0x13')],_0x15e32b);_0x270796(_0x1bddd4[_0x9dfe('0x12')](0x1f4,_0x484f22[_0x9dfe('0x13')]));});});};exports[_0x9dfe('0x1b')]=function(_0x3354b7){var _0x361e5e=this;return new Promise(function(_0x3538bb,_0xf7fc28){return db[_0x9dfe('0x15')]['findAll']({'raw':_0x3354b7['options']?_0x3354b7[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![],'where':_0x3354b7['options']?_0x3354b7[_0x9dfe('0x18')][_0x9dfe('0x1c')]||null:null,'attributes':[[db[_0x9dfe('0x1d')]['fn']('COUNT',db[_0x9dfe('0x1d')][_0x9dfe('0x1e')]('id')),_0x9dfe('0x1f')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')]['literal'](_0x9dfe('0x21')))),_0x9dfe('0x22')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x9dfe('0x20'),db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x9dfe('0x23')](_0x9dfe('0x27')))),_0x9dfe('0x28')],[db[_0x9dfe('0x1d')]['fn']('AVG',db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x29')))),_0x9dfe('0x2a')]]})['then'](function(_0x2747fd){logger[_0x9dfe('0xd')](_0x9dfe('0x1b'),_0x3354b7);logger[_0x9dfe('0x1a')](_0x9dfe('0x1b'),_0x3354b7,JSON[_0x9dfe('0x11')](_0x2747fd));_0x3538bb(_0x2747fd);})[_0x9dfe('0x2b')](function(_0x55a6c4){logger[_0x9dfe('0x12')](_0x9dfe('0x1b'),_0x55a6c4[_0x9dfe('0x13')],_0x3354b7);_0xf7fc28(_0x361e5e[_0x9dfe('0x12')](0x1f4,_0x55a6c4[_0x9dfe('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x31db7f){var _0x153868=this;return new Promise(function(_0x547c93,_0x2edf05){return db['CmHopperHistory'][_0x9dfe('0x2c')]({'raw':_0x31db7f[_0x9dfe('0x18')]?_0x31db7f[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![],'where':_0x31db7f[_0x9dfe('0x18')]?_0x31db7f['options']['where']||null:null,'attributes':[[_0x9dfe('0x2d'),_0x9dfe('0x2e')],[db['sequelize']['fn'](_0x9dfe('0x20'),db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x9dfe('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')]['literal'](_0x9dfe('0x2f')))),_0x9dfe('0x30')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x21')))),_0x9dfe('0x31')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x32')))),_0x9dfe('0x33')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x9dfe('0x34')],[db['sequelize']['fn']('COUNT',db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x35')))),_0x9dfe('0x36')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9dfe('0x37')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0x9dfe('0x38')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0x9dfe('0x39')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x3a')))),_0x9dfe('0x3b')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x3c')))),_0x9dfe('0x3d')],[db['sequelize']['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x9dfe('0x3e')))),_0x9dfe('0x3f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x40')))),_0x9dfe('0x3d')],[db['sequelize']['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x41')))),'outboundReCallsDay']],'group':[_0x9dfe('0x2d')]})[_0x9dfe('0xc')](function(_0x5a1f13){logger[_0x9dfe('0xd')](_0x9dfe('0x42'),_0x31db7f);logger['debug'](_0x9dfe('0x42'),_0x31db7f,JSON[_0x9dfe('0x11')](_0x5a1f13));_0x547c93(_0x5a1f13);})[_0x9dfe('0x2b')](function(_0x5b2d25){logger[_0x9dfe('0x12')](_0x9dfe('0x42'),_0x5b2d25['message'],_0x31db7f);_0x2edf05(_0x153868['error'](0x1f4,_0x5b2d25[_0x9dfe('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x589b68){var _0xa70ba3=this;return new Promise(function(_0x349c71,_0x14ef32){return db['CmHopperHistory']['findAll']({'raw':_0x589b68[_0x9dfe('0x18')]?_0x589b68[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![],'where':_0x589b68[_0x9dfe('0x18')]?_0x589b68[_0x9dfe('0x18')][_0x9dfe('0x1c')]||null:null,'attributes':[[_0x9dfe('0x2d'),'name'],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['col']('id')),_0x9dfe('0x43')],[db['sequelize']['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x21')))),'ivrAnswerCallsDay']],'group':[_0x9dfe('0x2d')]})[_0x9dfe('0xc')](function(_0x1fa4d9){logger[_0x9dfe('0xd')](_0x9dfe('0x44'),_0x589b68);logger[_0x9dfe('0x1a')](_0x9dfe('0x44'),_0x589b68,JSON[_0x9dfe('0x11')](_0x1fa4d9));_0x349c71(_0x1fa4d9);})[_0x9dfe('0x2b')](function(_0x4455fc){logger[_0x9dfe('0x12')]('GetCampaignHopperHistory',_0x4455fc[_0x9dfe('0x13')],_0x589b68);_0x14ef32(_0xa70ba3['error'](0x1f4,_0x4455fc['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ac64e5b..999e861 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 _0xc59e=['get','isAuthenticated','/describe','describe','/:id','show','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x442ab3,_0x2ff685){var _0x27a7d4=function(_0x394307){while(--_0x394307){_0x442ab3['push'](_0x442ab3['shift']());}};_0x27a7d4(++_0x2ff685);}(_0xc59e,0xe5));var _0xec59=function(_0x373c90,_0x48d293){_0x373c90=_0x373c90-0x0;var _0xf504f1=_0xc59e[_0x373c90];return _0xf504f1;};'use strict';var multer=require(_0xec59('0x0'));var util=require(_0xec59('0x1'));var path=require(_0xec59('0x2'));var timeout=require(_0xec59('0x3'));var express=require(_0xec59('0x4'));var router=express[_0xec59('0x5')]();var fs_extra=require(_0xec59('0x6'));var auth=require(_0xec59('0x7'));var interaction=require(_0xec59('0x8'));var config=require(_0xec59('0x9'));var controller=require(_0xec59('0xa'));router[_0xec59('0xb')]('/',auth[_0xec59('0xc')](),controller['index']);router[_0xec59('0xb')](_0xec59('0xd'),auth[_0xec59('0xc')](),controller[_0xec59('0xe')]);router[_0xec59('0xb')](_0xec59('0xf'),auth[_0xec59('0xc')](),controller[_0xec59('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec59('0x11')]);router[_0xec59('0x12')](_0xec59('0xf'),auth[_0xec59('0xc')](),controller['update']);module[_0xec59('0x13')]=router; \ No newline at end of file +var _0x4c87=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','post','create','put','update','exports'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x4c87,0x90));var _0x74c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c87[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x74c8('0x0'));var util=require('util');var path=require(_0x74c8('0x1'));var timeout=require('connect-timeout');var express=require(_0x74c8('0x2'));var router=express[_0x74c8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74c8('0x4'));var interaction=require(_0x74c8('0x5'));var config=require(_0x74c8('0x6'));var controller=require(_0x74c8('0x7'));router[_0x74c8('0x8')]('/',auth[_0x74c8('0x9')](),controller[_0x74c8('0xa')]);router[_0x74c8('0x8')](_0x74c8('0xb'),auth[_0x74c8('0x9')](),controller[_0x74c8('0xc')]);router[_0x74c8('0x8')]('/:id',auth[_0x74c8('0x9')](),controller['show']);router[_0x74c8('0xd')]('/',auth[_0x74c8('0x9')](),controller[_0x74c8('0xe')]);router[_0x74c8('0xf')]('/:id',auth[_0x74c8('0x9')](),controller[_0x74c8('0x10')]);module[_0x74c8('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 67f5cad..4ce85b2 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 _0xa3e6=['sequelize','STRING'];(function(_0x3cb5fc,_0x2787c0){var _0x336d8d=function(_0x464a1a){while(--_0x464a1a){_0x3cb5fc['push'](_0x3cb5fc['shift']());}};_0x336d8d(++_0x2787c0);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x3b5f55,_0xcca523){_0x3b5f55=_0x3b5f55-0x0;var _0x32e65a=_0xa3e6[_0x3b5f55];return _0x32e65a;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a3e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a3e('0x1')]},'dialPrefix':{'type':Sequelize[_0x6a3e('0x1')]}}; \ No newline at end of file +var _0x70e9=['STRING','exports'];(function(_0x1eca92,_0x2db001){var _0x2bb3ea=function(_0x265576){while(--_0x265576){_0x1eca92['push'](_0x1eca92['shift']());}};_0x2bb3ea(++_0x2db001);}(_0x70e9,0x193));var _0x970e=function(_0xde1b69,_0x12a058){_0xde1b69=_0xde1b69-0x0;var _0x50f18f=_0x70e9[_0xde1b69];return _0x50f18f;};'use strict';var Sequelize=require('sequelize');module[_0x970e('0x0')]={'name':{'type':Sequelize[_0x970e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x970e('0x1')]},'dialPrefix':{'type':Sequelize[_0x970e('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 80c0004..30b23dc 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 _0x8955=['format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','getAgents','User','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','./cmList.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','get','Lists','UserProfileResource','destroy','stack','send','index','map','CmList','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','describe','ListId','Disposition','findOne','pick','removeDispositions','ids','CmContact','isArray','tags','join','push','each','omit','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat'];(function(_0x4aec3f,_0x2de89f){var _0x4f10cc=function(_0x325664){while(--_0x325664){_0x4aec3f['push'](_0x4aec3f['shift']());}};_0x4f10cc(++_0x2de89f);}(_0x8955,0x148));var _0x5895=function(_0x403a3b,_0x168c97){_0x403a3b=_0x403a3b-0x0;var _0x3ea5cf=_0x8955[_0x403a3b];return _0x3ea5cf;};'use strict';var emlformat=require(_0x5895('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5895('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5895('0x2'));var moment=require(_0x5895('0x3'));var BPromise=require(_0x5895('0x4'));var Mustache=require(_0x5895('0x5'));var util=require(_0x5895('0x6'));var path=require('path');var sox=require(_0x5895('0x7'));var csv=require(_0x5895('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5895('0x9'));var _=require('lodash');var squel=require(_0x5895('0xa'));var crypto=require(_0x5895('0xb'));var jsforce=require(_0x5895('0xc'));var deskjs=require(_0x5895('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5895('0xe'));var Papa=require(_0x5895('0xf'));var Redis=require(_0x5895('0x10'));var authService=require(_0x5895('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5895('0x12'));var hardwareService=require(_0x5895('0x13'));var logger=require(_0x5895('0x14'))(_0x5895('0x15'));var utils=require('../../config/utils');var config=require(_0x5895('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5895('0x17')](config[_0x5895('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5895('0x19'))[_0x5895('0x1a')](socket);function respondWithStatusCode(_0x5691f3,_0x346a65){_0x346a65=_0x346a65||0xcc;return function(_0x58c082){if(_0x58c082){return _0x5691f3[_0x5895('0x1b')](_0x346a65);}return _0x5691f3['status'](_0x346a65)[_0x5895('0x1c')]();};}function respondWithResult(_0x4ece32,_0x1838fa){_0x1838fa=_0x1838fa||0xc8;return function(_0x3aa6a5){if(_0x3aa6a5){return _0x4ece32[_0x5895('0x1d')](_0x1838fa)[_0x5895('0x1e')](_0x3aa6a5);}};}function respondWithFilteredResult(_0x882497,_0x312189){return function(_0xc599fc){if(_0xc599fc){var _0x3e67b2=typeof _0x312189['offset']===_0x5895('0x1f')&&typeof _0x312189[_0x5895('0x20')]===_0x5895('0x1f');var _0x3a16ad=_0xc599fc[_0x5895('0x21')];var _0x4528a1=_0x3e67b2?0x0:_0x312189[_0x5895('0x22')];var _0x24840f=_0x3e67b2?_0xc599fc[_0x5895('0x21')]:_0x312189[_0x5895('0x22')]+_0x312189[_0x5895('0x20')];var _0x5c6279;if(_0x24840f>=_0x3a16ad){_0x24840f=_0x3a16ad;_0x5c6279=0xc8;}else{_0x5c6279=0xce;}_0x882497[_0x5895('0x1d')](_0x5c6279);return _0x882497[_0x5895('0x23')](_0x5895('0x24'),_0x4528a1+'-'+_0x24840f+'/'+_0x3a16ad)['json'](_0xc599fc);}return null;};}function patchUpdates(_0x5d3dce){return function(_0x2a4dea){try{jsonpatch['apply'](_0x2a4dea,_0x5d3dce,!![]);}catch(_0x2ed1e9){return BPromise['reject'](_0x2ed1e9);}return _0x2a4dea[_0x5895('0x25')]();};}function saveUpdates(_0x36ebb3,_0x46e451){return function(_0x2b52a5){if(_0x2b52a5){return _0x2b52a5[_0x5895('0x26')](_0x36ebb3)['then'](function(_0x273b0d){return _0x273b0d;});}return null;};}function removeEntity(_0x39423d,_0x46b5ae){return function(_0x2b75ef){if(_0x2b75ef){return _0x2b75ef['destroy']()[_0x5895('0x27')](function(){var _0x150532=_0x2b75ef[_0x5895('0x28')]({'plain':!![]});var _0x38ebcb=_0x5895('0x29');return db[_0x5895('0x2a')][_0x5895('0x2b')]({'where':{'type':_0x38ebcb,'resourceId':_0x150532['id']}})[_0x5895('0x27')](function(){return _0x2b75ef;});})[_0x5895('0x27')](function(){_0x39423d[_0x5895('0x1d')](0xcc)[_0x5895('0x1c')]();});}};}function handleEntityNotFound(_0x3a6c8a,_0x4d4106){return function(_0x3ddf56){if(!_0x3ddf56){_0x3a6c8a[_0x5895('0x1b')](0x194);}return _0x3ddf56;};}function handleError(_0x3c2759,_0x49b69f){_0x49b69f=_0x49b69f||0x1f4;return function(_0x2fcf72){logger['error'](_0x2fcf72[_0x5895('0x2c')]);if(_0x2fcf72['name']){delete _0x2fcf72['name'];}_0x3c2759[_0x5895('0x1d')](_0x49b69f)[_0x5895('0x2d')](_0x2fcf72);};}exports[_0x5895('0x2e')]=function(_0xae7761,_0x55a162){var _0x101856={},_0x448d77={},_0x521ddf={'count':0x0,'rows':[]};var _0x1ae79d=_[_0x5895('0x2f')](db[_0x5895('0x30')][_0x5895('0x31')],function(_0x336cf0){return{'name':_0x336cf0[_0x5895('0x32')],'type':_0x336cf0[_0x5895('0x33')][_0x5895('0x34')]};});_0x448d77[_0x5895('0x35')]=_[_0x5895('0x2f')](_0x1ae79d,_0x5895('0x36'));_0x448d77[_0x5895('0x37')]=_[_0x5895('0x38')](_0xae7761[_0x5895('0x37')]);_0x448d77[_0x5895('0x39')]=_['intersection'](_0x448d77[_0x5895('0x35')],_0x448d77[_0x5895('0x37')]);_0x101856[_0x5895('0x3a')]=_[_0x5895('0x3b')](_0x448d77['model'],qs['fields'](_0xae7761[_0x5895('0x37')][_0x5895('0x3c')]));_0x101856['attributes']=_0x101856[_0x5895('0x3a')][_0x5895('0x3d')]?_0x101856[_0x5895('0x3a')]:_0x448d77[_0x5895('0x35')];if(!_0xae7761[_0x5895('0x37')]['hasOwnProperty'](_0x5895('0x3e'))){_0x101856[_0x5895('0x20')]=qs['limit'](_0xae7761[_0x5895('0x37')][_0x5895('0x20')]);_0x101856[_0x5895('0x22')]=qs[_0x5895('0x22')](_0xae7761[_0x5895('0x37')]['offset']);}_0x101856[_0x5895('0x3f')]=qs['sort'](_0xae7761[_0x5895('0x37')][_0x5895('0x40')]);_0x101856[_0x5895('0x41')]=qs[_0x5895('0x39')](_['pick'](_0xae7761[_0x5895('0x37')],_0x448d77[_0x5895('0x39')]),_0x1ae79d);if(_0xae7761[_0x5895('0x37')][_0x5895('0x42')]){_0x101856[_0x5895('0x41')]=_['merge'](_0x101856[_0x5895('0x41')],{'$or':_['map'](_0x1ae79d,function(_0x593f4f){if(_0x593f4f['type']!==_0x5895('0x43')){var _0x5d2771={};_0x5d2771[_0x593f4f['name']]={'$like':'%'+_0xae7761[_0x5895('0x37')][_0x5895('0x42')]+'%'};return _0x5d2771;}})});}_0x101856=_[_0x5895('0x44')]({},_0x101856,_0xae7761[_0x5895('0x45')]);var _0x2d1875={'where':_0x101856[_0x5895('0x41')]};return db[_0x5895('0x30')]['count'](_0x2d1875)[_0x5895('0x27')](function(_0x37d80a){_0x521ddf[_0x5895('0x21')]=_0x37d80a;if(_0xae7761[_0x5895('0x37')]['includeAll']){_0x101856[_0x5895('0x46')]=[{'all':!![]}];}return db[_0x5895('0x30')][_0x5895('0x47')](_0x101856);})[_0x5895('0x27')](function(_0x4f9a27){_0x521ddf[_0x5895('0x48')]=_0x4f9a27;return _0x521ddf;})['then'](respondWithFilteredResult(_0x55a162,_0x101856))['catch'](handleError(_0x55a162,null));};exports['show']=function(_0x485f44,_0x5d1b6a){var _0x5ef10d={'raw':![],'where':{'id':_0x485f44[_0x5895('0x49')]['id']}},_0xd3654={};_0xd3654[_0x5895('0x35')]=_['keys'](db[_0x5895('0x30')][_0x5895('0x31')]);_0xd3654['query']=_[_0x5895('0x38')](_0x485f44[_0x5895('0x37')]);_0xd3654[_0x5895('0x39')]=_[_0x5895('0x3b')](_0xd3654[_0x5895('0x35')],_0xd3654[_0x5895('0x37')]);_0x5ef10d[_0x5895('0x3a')]=_[_0x5895('0x3b')](_0xd3654[_0x5895('0x35')],qs[_0x5895('0x3c')](_0x485f44['query']['fields']));_0x5ef10d[_0x5895('0x3a')]=_0x5ef10d[_0x5895('0x3a')][_0x5895('0x3d')]?_0x5ef10d[_0x5895('0x3a')]:_0xd3654[_0x5895('0x35')];if(_0x485f44['query'][_0x5895('0x4a')]){_0x5ef10d[_0x5895('0x46')]=[{'all':!![]}];}_0x5ef10d=_[_0x5895('0x44')]({},_0x5ef10d,_0x485f44[_0x5895('0x45')]);return db['CmList'][_0x5895('0x4b')](_0x5ef10d)[_0x5895('0x27')](handleEntityNotFound(_0x5d1b6a,null))[_0x5895('0x27')](respondWithResult(_0x5d1b6a,null))[_0x5895('0x4c')](handleError(_0x5d1b6a,null));};exports[_0x5895('0x4d')]=function(_0xd8053,_0x36a5a2){return db['CmList'][_0x5895('0x4d')](_0xd8053[_0x5895('0x4e')],{})['then'](function(_0x1e163e){var _0x2a8be5=_0xd8053[_0x5895('0x4f')][_0x5895('0x28')]({'plain':!![]});if(!_0x2a8be5)throw new Error(_0x5895('0x50'));if(_0x2a8be5[_0x5895('0x51')]===_0x5895('0x4f')){var _0x59358b=_0x1e163e[_0x5895('0x28')]({'plain':!![]});var _0x3390c3=_0x5895('0x29');return db[_0x5895('0x52')][_0x5895('0x4b')]({'where':{'name':_0x3390c3,'userProfileId':_0x2a8be5[_0x5895('0x53')]},'raw':!![]})['then'](function(_0x51ce39){if(_0x51ce39&&_0x51ce39[_0x5895('0x54')]===0x0){return db[_0x5895('0x2a')][_0x5895('0x4d')]({'name':_0x59358b[_0x5895('0x36')],'resourceId':_0x59358b['id'],'type':_0x51ce39[_0x5895('0x36')],'sectionId':_0x51ce39['id']},{})[_0x5895('0x27')](function(){return _0x1e163e;});}else{return _0x1e163e;}})['catch'](function(_0x4e9cff){logger[_0x5895('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e9cff);throw _0x4e9cff;});}return _0x1e163e;})['then'](respondWithResult(_0x36a5a2,0xc9))[_0x5895('0x4c')](handleError(_0x36a5a2,null));};exports['update']=function(_0x1c8cb1,_0x2dc80d){if(_0x1c8cb1[_0x5895('0x4e')]['id']){delete _0x1c8cb1['body']['id'];}return db[_0x5895('0x30')][_0x5895('0x4b')]({'where':{'id':_0x1c8cb1[_0x5895('0x49')]['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x2dc80d,null))[_0x5895('0x27')](saveUpdates(_0x1c8cb1[_0x5895('0x4e')],null))[_0x5895('0x27')](respondWithResult(_0x2dc80d,null))[_0x5895('0x4c')](handleError(_0x2dc80d,null));};exports[_0x5895('0x2b')]=function(_0x36adac,_0x5c3426){return db[_0x5895('0x30')][_0x5895('0x4b')]({'where':{'id':_0x36adac['params']['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x5c3426,null))[_0x5895('0x27')](removeEntity(_0x5c3426,null))['catch'](handleError(_0x5c3426,null));};exports[_0x5895('0x56')]=function(_0x2742ac,_0x37c61b){return db[_0x5895('0x30')][_0x5895('0x56')]()[_0x5895('0x27')](respondWithResult(_0x37c61b,null))['catch'](handleError(_0x37c61b,null));};exports['addDisposition']=function(_0x4b00a7,_0x54ff10,_0x42c1ff){if(_0x4b00a7['body']['id']){delete _0x4b00a7[_0x5895('0x4e')]['id'];}return db[_0x5895('0x30')][_0x5895('0x4b')]({'where':{'id':_0x4b00a7[_0x5895('0x49')]['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x54ff10,null))[_0x5895('0x27')](function(_0x2effbb){if(_0x2effbb){_0x4b00a7['body'][_0x5895('0x57')]=_0x2effbb['id'];return db[_0x5895('0x58')]['create'](_0x4b00a7[_0x5895('0x4e')]);}})[_0x5895('0x27')](respondWithResult(_0x54ff10,null))[_0x5895('0x4c')](handleError(_0x54ff10,null));};exports['getDispositions']=function(_0x16fb8b,_0x673072,_0x541a6e){var _0x170819={'raw':![],'where':{}};var _0x3854cc={};var _0x9b0c81={'count':0x0,'rows':[]};return db['CmList'][_0x5895('0x59')]({'where':{'id':_0x16fb8b[_0x5895('0x49')]['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x673072,null))[_0x5895('0x27')](function(_0x596097){if(_0x596097){_0x3854cc[_0x5895('0x35')]=_['keys'](db[_0x5895('0x58')][_0x5895('0x31')]);_0x3854cc[_0x5895('0x37')]=_[_0x5895('0x38')](_0x16fb8b[_0x5895('0x37')]);_0x3854cc[_0x5895('0x39')]=_[_0x5895('0x3b')](_0x3854cc[_0x5895('0x35')],_0x3854cc[_0x5895('0x37')]);_0x170819[_0x5895('0x3a')]=_[_0x5895('0x3b')](_0x3854cc['model'],qs[_0x5895('0x3c')](_0x16fb8b[_0x5895('0x37')][_0x5895('0x3c')]));_0x170819[_0x5895('0x3a')]=_0x170819[_0x5895('0x3a')]['length']?_0x170819[_0x5895('0x3a')]:_0x3854cc[_0x5895('0x35')];if(!_0x16fb8b[_0x5895('0x37')]['hasOwnProperty'](_0x5895('0x3e'))){_0x170819[_0x5895('0x20')]=qs['limit'](_0x16fb8b['query'][_0x5895('0x20')]);_0x170819[_0x5895('0x22')]=qs[_0x5895('0x22')](_0x16fb8b['query']['offset']);}_0x170819['order']=qs[_0x5895('0x40')](_0x16fb8b['query'][_0x5895('0x40')]);_0x170819[_0x5895('0x41')]=qs['filters'](_[_0x5895('0x5a')](_0x16fb8b[_0x5895('0x37')],_0x3854cc[_0x5895('0x39')]));_0x170819[_0x5895('0x41')][_0x5895('0x57')]=_0x596097['id'];if(_0x16fb8b[_0x5895('0x37')]['filter']){_0x170819[_0x5895('0x41')]=_[_0x5895('0x44')](_0x170819[_0x5895('0x41')],{'$or':_[_0x5895('0x2f')](_0x170819[_0x5895('0x3a')],function(_0x19df78){var _0x4fb9f1={};_0x4fb9f1[_0x19df78]={'$like':'%'+_0x16fb8b[_0x5895('0x37')]['filter']+'%'};return _0x4fb9f1;})});}_0x170819=_['merge']({},_0x170819,_0x16fb8b[_0x5895('0x45')]);return db[_0x5895('0x58')][_0x5895('0x21')]({'where':_0x170819[_0x5895('0x41')]})['then'](function(_0x58121f){_0x9b0c81['count']=_0x58121f;if(_0x16fb8b['query'][_0x5895('0x4a')]){_0x170819[_0x5895('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x170819);})[_0x5895('0x27')](function(_0x2af053){_0x9b0c81[_0x5895('0x48')]=_0x2af053;return _0x9b0c81;});}})[_0x5895('0x27')](respondWithFilteredResult(_0x673072,_0x170819))[_0x5895('0x4c')](handleError(_0x673072,null));};exports[_0x5895('0x5b')]=function(_0x24e4d3,_0x43c02b,_0x2e5f97){return db[_0x5895('0x30')][_0x5895('0x4b')]({'where':{'id':_0x24e4d3['params']['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x43c02b,null))[_0x5895('0x27')](function(_0x1b1ef2){if(_0x1b1ef2){return _0x1b1ef2[_0x5895('0x5b')](_0x24e4d3['query'][_0x5895('0x5c')]);}})[_0x5895('0x27')](respondWithStatusCode(_0x43c02b,null))[_0x5895('0x4c')](handleError(_0x43c02b,null));};exports['addContacts']=function(_0x2ff5dd,_0x5b79a2,_0x17d841){return db[_0x5895('0x30')][_0x5895('0x4b')]({'where':{'id':_0x2ff5dd['params']['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x5b79a2,null))[_0x5895('0x27')](function(_0x581154){if(_0x581154){var _0x4507a1=[];var _0x13c1f0={'success':[],'errors':[]};return db[_0x5895('0x5d')][_0x5895('0x56')]()[_0x5895('0x27')](function(_0x2feee0){if(_0x2ff5dd['body']['tags']&&_[_0x5895('0x5e')](_0x2ff5dd[_0x5895('0x4e')]['tags'])){if(_0x2ff5dd[_0x5895('0x4e')][_0x5895('0x5f')]['length']){_0x2ff5dd['body'][_0x5895('0x5f')]=_0x2ff5dd[_0x5895('0x4e')][_0x5895('0x5f')][_0x5895('0x60')](';')+';';}else{_0x2ff5dd[_0x5895('0x4e')]['tags']=null;}}else{_0x2ff5dd[_0x5895('0x4e')][_0x5895('0x5f')]=null;}if(_0x2ff5dd[_0x5895('0x4e')]&&_['isArray'](_0x2ff5dd[_0x5895('0x4e')])){for(var _0x3de0e5=0x0;_0x3de0e5<_0x2ff5dd[_0x5895('0x4e')][_0x5895('0x3d')];_0x3de0e5+=0x1){_0x2ff5dd[_0x5895('0x4e')][_0x3de0e5][_0x5895('0x57')]=_0x2ff5dd[_0x5895('0x49')]['id'];_0x4507a1[_0x5895('0x61')](_0x2ff5dd['body'][_0x3de0e5]);}return BPromise[_0x5895('0x62')](_0x4507a1,function(_0x9577ce){return db[_0x5895('0x5d')][_0x5895('0x4d')](_[_0x5895('0x63')](_0x9577ce,[_0x5895('0x5c'),'id'])||{},{'fields':_[_0x5895('0x38')](_0x2feee0),'raw':!![]})[_0x5895('0x27')](function(_0x3389d4){_0x13c1f0['success'][_0x5895('0x61')](_0x3389d4[_0x5895('0x64')]);})[_0x5895('0x4c')](function(_0x38177a){_0x13c1f0[_0x5895('0x65')][_0x5895('0x61')]({'data':_0x9577ce,'error':_0x38177a['message']});});})['then'](function(_0x26a64d){return _0x13c1f0;})['catch'](function(_0x352f40){return _0x352f40;});}else{_0x5b79a2['status'](0x190)['json']({'message':_0x5895('0x66')});}});}})['then'](respondWithResult(_0x5b79a2,null))['catch'](handleError(_0x5b79a2,null));};exports[_0x5895('0x67')]=function(_0x4fd4b5,_0x262fca,_0x138938){var _0xdc6bb0;return db[_0x5895('0x30')]['find']({'where':{'id':_0x4fd4b5['params']['id']},'include':[{'model':db[_0x5895('0x68')],'as':_0x5895('0x69')}]})[_0x5895('0x27')](handleEntityNotFound(_0x262fca,null))[_0x5895('0x27')](function(_0x3569cf){if(_0x3569cf){_0xdc6bb0=_0x3569cf;return db[_0x5895('0x5d')][_0x5895('0x31')];}})[_0x5895('0x27')](function(_0x2f265a){if(_0x2f265a){var _0x5ee95d={};var _0x8faf8b={};_0x8faf8b[_0x5895('0x35')]=_[_0x5895('0x6a')](_[_0x5895('0x38')](_0x2f265a),_[_0x5895('0x2f')](_0xdc6bb0[_0x5895('0x69')],function(_0x341817){return util[_0x5895('0x6b')](_0x5895('0x6c'),_0x341817['id']);}));_0x8faf8b[_0x5895('0x37')]=_[_0x5895('0x38')](_0x4fd4b5[_0x5895('0x37')]);_0x8faf8b[_0x5895('0x39')]=_[_0x5895('0x3b')](_0x8faf8b[_0x5895('0x35')],_0x8faf8b[_0x5895('0x37')]);_0x5ee95d[_0x5895('0x3a')]=_[_0x5895('0x3b')](_0x8faf8b[_0x5895('0x35')],qs[_0x5895('0x3c')](_0x4fd4b5[_0x5895('0x37')][_0x5895('0x3c')]));_0x5ee95d[_0x5895('0x3a')]=_0x5ee95d[_0x5895('0x3a')][_0x5895('0x3d')]?_0x5ee95d['attributes']:_0x8faf8b['model'];if(!_0x4fd4b5[_0x5895('0x37')][_0x5895('0x6d')]('nolimit')){_0x5ee95d[_0x5895('0x20')]=qs[_0x5895('0x20')](_0x4fd4b5[_0x5895('0x37')][_0x5895('0x20')]);_0x5ee95d[_0x5895('0x22')]=qs[_0x5895('0x22')](_0x4fd4b5['query'][_0x5895('0x22')]);}_0x5ee95d[_0x5895('0x3f')]=qs[_0x5895('0x40')](_0x4fd4b5[_0x5895('0x37')][_0x5895('0x40')]);_0x5ee95d[_0x5895('0x41')]=qs[_0x5895('0x39')](_['pick'](_0x4fd4b5['query'],_0x8faf8b['filters']));_0x5ee95d[_0x5895('0x6e')]=!![];if(_0x4fd4b5['query'][_0x5895('0x42')]){_0x5ee95d['where']=_[_0x5895('0x44')](_0x5ee95d[_0x5895('0x41')],{'$or':_['map'](_0x5ee95d['attributes'],function(_0x5b0b45){var _0x52c029={};_0x52c029[_0x5b0b45]={'$like':'%'+_0x4fd4b5['query']['filter']+'%'};return _0x52c029;})});}_0x5ee95d=_[_0x5895('0x44')]({},_0x5ee95d,_0x4fd4b5['options']);return _0xdc6bb0['getContacts'](_0x5ee95d);}})[_0x5895('0x27')](respondWithResult(_0x262fca,null))[_0x5895('0x4c')](handleError(_0x262fca,null));};exports[_0x5895('0x6f')]=function(_0x235097,_0x1c218d,_0x2f8196){var _0x2aa805;return db[_0x5895('0x30')][_0x5895('0x4b')]({'where':{'id':_0x235097['params']['id']},'include':[{'model':db[_0x5895('0x68')],'as':_0x5895('0x69')}]})[_0x5895('0x27')](handleEntityNotFound(_0x1c218d,null))['then'](function(_0x238178){if(_0x238178){_0x2aa805=_0x238178;return db[_0x5895('0x5d')][_0x5895('0x31')];}})[_0x5895('0x27')](function(_0x236f60){if(_0x236f60){var _0x184b37={};var _0x505f16={};_0x505f16['model']=_[_0x5895('0x6a')](_['keys'](_0x236f60),_[_0x5895('0x2f')](_0x2aa805['CustomFields'],function(_0x39f684){return util[_0x5895('0x6b')](_0x5895('0x6c'),_0x39f684['id']);}));_0x505f16['query']=_[_0x5895('0x38')](_0x235097[_0x5895('0x37')]);_0x505f16['filters']=_[_0x5895('0x3b')](_0x505f16[_0x5895('0x35')],_0x505f16[_0x5895('0x37')]);_0x184b37['attributes']=_[_0x5895('0x3b')](_0x505f16['model'],qs[_0x5895('0x3c')](_0x235097[_0x5895('0x37')][_0x5895('0x3c')]));_0x184b37[_0x5895('0x3a')]=_0x184b37[_0x5895('0x3a')][_0x5895('0x3d')]?_0x184b37['attributes']:_0x505f16[_0x5895('0x35')];if(!_0x235097[_0x5895('0x37')][_0x5895('0x6d')](_0x5895('0x3e'))){_0x184b37[_0x5895('0x20')]=qs['limit'](_0x235097['query'][_0x5895('0x20')]);_0x184b37['offset']=qs[_0x5895('0x22')](_0x235097['query'][_0x5895('0x22')]);}_0x184b37[_0x5895('0x3f')]=qs['sort'](_0x235097[_0x5895('0x37')][_0x5895('0x40')]);_0x184b37['where']=qs['filters'](_['pick'](_0x235097[_0x5895('0x37')],_0x505f16['filters']));_0x184b37[_0x5895('0x6e')]=!![];if(_0x235097['query']['filter']){_0x184b37[_0x5895('0x41')]=_[_0x5895('0x44')](_0x184b37[_0x5895('0x41')],{'$or':_[_0x5895('0x2f')](_0x184b37[_0x5895('0x3a')],function(_0x299114){var _0x27c528={};_0x27c528[_0x299114]={'$like':'%'+_0x235097['query']['filter']+'%'};return _0x27c528;})});}_0x184b37=_[_0x5895('0x44')]({},_0x184b37,_0x235097[_0x5895('0x45')]);return _0x2aa805['getContacts'](_0x184b37);}})[_0x5895('0x27')](function(_0x19ed34){if(!_[_0x5895('0x70')](_0x19ed34)){var _0x227150=toCsv(_0x19ed34);var _0x33c8a3=Date[_0x5895('0x71')]();fs[_0x5895('0x72')](util[_0x5895('0x6b')](_0x5895('0x73'),_0x2aa805['id'],_0x33c8a3),_0x227150);_0x1c218d[_0x5895('0x74')](_0x5895('0x75'),_0x5895('0x76')+util[_0x5895('0x6b')](_0x5895('0x77'),_0x2aa805['id'],_0x33c8a3));_0x1c218d[_0x5895('0x74')](_0x5895('0x78'),_0x5895('0x79'));return _0x1c218d[_0x5895('0x7a')](util[_0x5895('0x6b')]('/tmp/list_%d_%s.csv',_0x2aa805['id'],_0x33c8a3));}else{return _0x1c218d[_0x5895('0x1b')](0xcc);}})['catch'](handleError(_0x1c218d,null));};exports[_0x5895('0x7b')]=function(_0x2dae39,_0xcc59f8,_0x1fb0bf){var _0x3fe2c6;delete _0x2dae39[_0x5895('0x4e')]['id'];return db[_0x5895('0x30')][_0x5895('0x59')]({'where':{'id':_0x2dae39[_0x5895('0x49')]['id']}})[_0x5895('0x27')](handleEntityNotFound(_0xcc59f8,null))[_0x5895('0x27')](function(_0x42ffa1){if(_0x42ffa1){return db[_0x5895('0x7c')][_0x5895('0x7d')](function(_0x446765){return db[_0x5895('0x68')][_0x5895('0x4d')](_0x2dae39[_0x5895('0x4e')],{'transaction':_0x446765})[_0x5895('0x27')](function(_0x50ae76){_0x3fe2c6=_0x50ae76;return _0x42ffa1['addCustomFields'](_0x50ae76,{'transaction':_0x446765});})[_0x5895('0x27')](function(){var _0xa337c8={'type':db[_0x5895('0x7e')]['TEXT'],'transaction':_0x446765};switch(_0x2dae39['body'][_0x5895('0x33')]){case _0x5895('0x7f'):_0xa337c8['type']=db[_0x5895('0x7e')][_0x5895('0x80')];break;case _0x5895('0x81'):_0xa337c8[_0x5895('0x33')]=db['Sequelize'][_0x5895('0x82')];break;case _0x5895('0x83'):_0xa337c8[_0x5895('0x33')]=db[_0x5895('0x7e')][_0x5895('0x84')];_0xa337c8[_0x5895('0x85')]=![];break;default:}return db[_0x5895('0x7c')]['queryInterface'][_0x5895('0x86')](_0x5895('0x87'),util[_0x5895('0x6b')](_0x5895('0x88'),_0x3fe2c6['id']),_0xa337c8);})[_0x5895('0x27')](function(){return _0x3fe2c6;});});}})[_0x5895('0x27')](respondWithResult(_0xcc59f8,null))[_0x5895('0x4c')](handleError(_0xcc59f8,null));};exports[_0x5895('0x89')]=function(_0x3d3adb,_0x12b1d7,_0x42622a){var _0x50b5a6={};var _0x453ef5={};var _0x18f7dc;var _0x2cf66c;return db['CmList'][_0x5895('0x59')]({'where':{'id':_0x3d3adb['params']['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x12b1d7,null))['then'](function(_0x1fc43c){if(_0x1fc43c){_0x18f7dc=_0x1fc43c;_0x453ef5[_0x5895('0x35')]=_[_0x5895('0x38')](db[_0x5895('0x68')][_0x5895('0x31')]);_0x453ef5[_0x5895('0x37')]=_[_0x5895('0x38')](_0x3d3adb['query']);_0x453ef5[_0x5895('0x39')]=_[_0x5895('0x3b')](_0x453ef5[_0x5895('0x35')],_0x453ef5[_0x5895('0x37')]);_0x50b5a6[_0x5895('0x3a')]=_[_0x5895('0x3b')](_0x453ef5['model'],qs[_0x5895('0x3c')](_0x3d3adb[_0x5895('0x37')][_0x5895('0x3c')]));_0x50b5a6[_0x5895('0x3a')]=_0x50b5a6['attributes'][_0x5895('0x3d')]?_0x50b5a6[_0x5895('0x3a')]:_0x453ef5[_0x5895('0x35')];_0x50b5a6[_0x5895('0x3f')]=qs[_0x5895('0x40')](_0x3d3adb['query'][_0x5895('0x40')]);_0x50b5a6[_0x5895('0x41')]=qs[_0x5895('0x39')](_[_0x5895('0x5a')](_0x3d3adb[_0x5895('0x37')],_0x453ef5['filters']));_0x50b5a6[_0x5895('0x41')]=_[_0x5895('0x44')](_0x50b5a6[_0x5895('0x41')],{'$or':[{'ListId':_0x1fc43c['id']},{'ListId':null}]});if(_0x3d3adb['query']['filter']){_0x50b5a6[_0x5895('0x41')]=_[_0x5895('0x44')](_0x50b5a6[_0x5895('0x41')],{'$or':_[_0x5895('0x2f')](_0x50b5a6[_0x5895('0x3a')],function(_0x556f8c){var _0xb7ba35={};_0xb7ba35[_0x556f8c]={'$like':'%'+_0x3d3adb[_0x5895('0x37')][_0x5895('0x42')]+'%'};return _0xb7ba35;})});}_0x50b5a6=_[_0x5895('0x44')]({},_0x50b5a6,_0x3d3adb['options']);return db[_0x5895('0x68')][_0x5895('0x8a')](_0x50b5a6);}})['then'](respondWithResult(_0x12b1d7,null))[_0x5895('0x4c')](handleError(_0x12b1d7,null));};exports[_0x5895('0x8b')]=function(_0x525914,_0x19af9f,_0x4173dd){return db[_0x5895('0x30')][_0x5895('0x4b')]({'where':{'id':_0x525914['params']['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x19af9f,null))[_0x5895('0x27')](function(_0x1a90d3){if(_0x1a90d3){return _0x1a90d3[_0x5895('0x8b')](_0x525914[_0x5895('0x4e')]['ids'],_[_0x5895('0x63')](_0x525914[_0x5895('0x4e')],[_0x5895('0x5c'),'id'])||{})[_0x5895('0x8c')](function(_0x3d433e){for(var _0x215ca6=0x0;_0x215ca6<_0x525914[_0x5895('0x4e')][_0x5895('0x5c')]['length'];_0x215ca6+=0x1){socket[_0x5895('0x8d')]('userCmList:save',{'UserId':Number(_0x525914['body'][_0x5895('0x5c')][_0x215ca6]),'CmListId':Number(_0x525914[_0x5895('0x49')]['id'])});}return _0x3d433e;});}})['then'](respondWithResult(_0x19af9f,null))[_0x5895('0x4c')](handleError(_0x19af9f,null));};exports[_0x5895('0x8e')]=function(_0x33bca2,_0x257905,_0x172ed8){return db['CmList'][_0x5895('0x4b')]({'where':{'id':_0x33bca2['params']['id']}})['then'](handleEntityNotFound(_0x257905,null))[_0x5895('0x27')](function(_0x1a56f1){if(_0x1a56f1){return _0x1a56f1['removeAgents'](_0x33bca2['query'][_0x5895('0x5c')])[_0x5895('0x27')](function(){if(_[_0x5895('0x5e')](_0x33bca2['query'][_0x5895('0x5c')])){for(var _0x5b2022=0x0;_0x5b2022<_0x33bca2[_0x5895('0x37')][_0x5895('0x5c')]['length'];_0x5b2022+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x33bca2[_0x5895('0x37')][_0x5895('0x5c')][_0x5b2022]),'CmListId':Number(_0x33bca2[_0x5895('0x49')]['id'])});}}else{socket[_0x5895('0x8d')]('userCmList:remove',{'UserId':Number(_0x33bca2[_0x5895('0x37')][_0x5895('0x5c')]),'CmListId':Number(_0x33bca2['params']['id'])});}});}})[_0x5895('0x27')](respondWithStatusCode(_0x257905,null))['catch'](handleError(_0x257905,null));};exports[_0x5895('0x8f')]=function(_0x12a525,_0x1f0b7d,_0x1e3ec5){var _0x5d5a60={};var _0x29d373={};var _0x2dd4d8;var _0x174f78;return db['CmList'][_0x5895('0x59')]({'where':{'id':_0x12a525[_0x5895('0x49')]['id']}})[_0x5895('0x27')](handleEntityNotFound(_0x1f0b7d,null))[_0x5895('0x27')](function(_0x5d252b){if(_0x5d252b){_0x2dd4d8=_0x5d252b;_0x29d373[_0x5895('0x35')]=_[_0x5895('0x38')](db[_0x5895('0x90')][_0x5895('0x31')]);_0x29d373[_0x5895('0x37')]=_['keys'](_0x12a525['query']);_0x29d373['filters']=_[_0x5895('0x3b')](_0x29d373[_0x5895('0x35')],_0x29d373['query']);_0x5d5a60[_0x5895('0x3a')]=_[_0x5895('0x3b')](_0x29d373['model'],qs[_0x5895('0x3c')](_0x12a525['query']['fields']));_0x5d5a60['attributes']=_0x5d5a60[_0x5895('0x3a')]['length']?_0x5d5a60[_0x5895('0x3a')]:_0x29d373[_0x5895('0x35')];_0x5d5a60[_0x5895('0x3f')]=qs[_0x5895('0x40')](_0x12a525[_0x5895('0x37')][_0x5895('0x40')]);_0x5d5a60[_0x5895('0x41')]=qs[_0x5895('0x39')](_[_0x5895('0x5a')](_0x12a525[_0x5895('0x37')],_0x29d373['filters']));if(_0x12a525[_0x5895('0x37')][_0x5895('0x42')]){_0x5d5a60[_0x5895('0x41')]=_['merge'](_0x5d5a60[_0x5895('0x41')],{'$or':_[_0x5895('0x2f')](_0x5d5a60[_0x5895('0x3a')],function(_0x43ad97){var _0x4bf7c4={};_0x4bf7c4[_0x43ad97]={'$like':'%'+_0x12a525[_0x5895('0x37')][_0x5895('0x42')]+'%'};return _0x4bf7c4;})});}_0x5d5a60=_[_0x5895('0x44')]({},_0x5d5a60,_0x12a525[_0x5895('0x45')]);return _0x2dd4d8[_0x5895('0x8f')](_0x5d5a60);}})[_0x5895('0x27')](function(_0x239b1a){if(_0x239b1a){_0x174f78=_0x239b1a[_0x5895('0x3d')];if(!_0x12a525[_0x5895('0x37')]['hasOwnProperty'](_0x5895('0x3e'))){_0x5d5a60[_0x5895('0x20')]=qs[_0x5895('0x20')](_0x12a525['query'][_0x5895('0x20')]);_0x5d5a60[_0x5895('0x22')]=qs['offset'](_0x12a525[_0x5895('0x37')][_0x5895('0x22')]);}return _0x2dd4d8[_0x5895('0x8f')](_0x5d5a60);}})[_0x5895('0x27')](function(_0x23c8cb){if(_0x23c8cb){return _0x23c8cb?{'count':_0x174f78,'rows':_0x23c8cb}:null;}})['then'](respondWithResult(_0x1f0b7d,null))['catch'](handleError(_0x1f0b7d,null));}; \ No newline at end of file +var _0x076b=['errors','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','cf_%d','nolimit','raw','getContacts','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','TEXT','type','text','Sequelize','number','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','cf_%s','addAgents','spread','emit','userCmList:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','UserProfileResource','name','index','CmList','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','filters','options','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','pick','ids','CmContact','tags','isArray','join','push','each','omit','success'];(function(_0x321b2e,_0x250208){var _0x595f11=function(_0x372835){while(--_0x372835){_0x321b2e['push'](_0x321b2e['shift']());}};_0x595f11(++_0x250208);}(_0x076b,0xbb));var _0xb076=function(_0x1c9fdd,_0x4bad20){_0x1c9fdd=_0x1c9fdd-0x0;var _0x2019bb=_0x076b[_0x1c9fdd];return _0x2019bb;};'use strict';var emlformat=require(_0xb076('0x0'));var rimraf=require(_0xb076('0x1'));var zipdir=require(_0xb076('0x2'));var jsonpatch=require(_0xb076('0x3'));var rp=require('request-promise');var moment=require(_0xb076('0x4'));var BPromise=require(_0xb076('0x5'));var Mustache=require(_0xb076('0x6'));var util=require(_0xb076('0x7'));var path=require(_0xb076('0x8'));var sox=require(_0xb076('0x9'));var csv=require(_0xb076('0xa'));var ejs=require(_0xb076('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb076('0xc'));var crypto=require(_0xb076('0xd'));var jsforce=require(_0xb076('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb076('0xf'));var Papa=require(_0xb076('0x10'));var Redis=require(_0xb076('0x11'));var authService=require(_0xb076('0x12'));var qs=require(_0xb076('0x13'));var as=require(_0xb076('0x14'));var hardwareService=require(_0xb076('0x15'));var logger=require(_0xb076('0x16'))(_0xb076('0x17'));var utils=require(_0xb076('0x18'));var config=require(_0xb076('0x19'));var licenseUtil=require(_0xb076('0x1a'));var db=require(_0xb076('0x1b'))['db'];config[_0xb076('0x1c')]=_[_0xb076('0x1d')](config[_0xb076('0x1c')],{'host':_0xb076('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb076('0x1c')]));require(_0xb076('0x1f'))[_0xb076('0x20')](socket);function respondWithStatusCode(_0x29dc68,_0x231a86){_0x231a86=_0x231a86||0xcc;return function(_0x47bf85){if(_0x47bf85){return _0x29dc68[_0xb076('0x21')](_0x231a86);}return _0x29dc68[_0xb076('0x22')](_0x231a86)[_0xb076('0x23')]();};}function respondWithResult(_0x1df719,_0x305887){_0x305887=_0x305887||0xc8;return function(_0x203e52){if(_0x203e52){return _0x1df719[_0xb076('0x22')](_0x305887)[_0xb076('0x24')](_0x203e52);}};}function respondWithFilteredResult(_0x35e5c7,_0x3bcef1){return function(_0x1b478c){if(_0x1b478c){var _0x51ce9c=typeof _0x3bcef1['offset']==='undefined'&&typeof _0x3bcef1[_0xb076('0x25')]===_0xb076('0x26');var _0x441ab0=_0x1b478c[_0xb076('0x27')];var _0x13eb15=_0x51ce9c?0x0:_0x3bcef1[_0xb076('0x28')];var _0xcb579=_0x51ce9c?_0x1b478c[_0xb076('0x27')]:_0x3bcef1['offset']+_0x3bcef1[_0xb076('0x25')];var _0x11bef0;if(_0xcb579>=_0x441ab0){_0xcb579=_0x441ab0;_0x11bef0=0xc8;}else{_0x11bef0=0xce;}_0x35e5c7[_0xb076('0x22')](_0x11bef0);return _0x35e5c7[_0xb076('0x29')]('Content-Range',_0x13eb15+'-'+_0xcb579+'/'+_0x441ab0)['json'](_0x1b478c);}return null;};}function patchUpdates(_0x41eef1){return function(_0x472f13){try{jsonpatch[_0xb076('0x2a')](_0x472f13,_0x41eef1,!![]);}catch(_0x473394){return BPromise[_0xb076('0x2b')](_0x473394);}return _0x472f13[_0xb076('0x2c')]();};}function saveUpdates(_0x3289a2,_0x2c91cf){return function(_0x5b8bc7){if(_0x5b8bc7){return _0x5b8bc7[_0xb076('0x2d')](_0x3289a2)[_0xb076('0x2e')](function(_0x2992b9){return _0x2992b9;});}return null;};}function removeEntity(_0xd19ca1,_0x5a6e0e){return function(_0x3d2f1d){if(_0x3d2f1d){return _0x3d2f1d[_0xb076('0x2f')]()['then'](function(){var _0x4eaf08=_0x3d2f1d['get']({'plain':!![]});var _0x492b8f='Lists';return db[_0xb076('0x30')]['destroy']({'where':{'type':_0x492b8f,'resourceId':_0x4eaf08['id']}})[_0xb076('0x2e')](function(){return _0x3d2f1d;});})['then'](function(){_0xd19ca1[_0xb076('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x390f89,_0x2e30d1){return function(_0x383622){if(!_0x383622){_0x390f89[_0xb076('0x21')](0x194);}return _0x383622;};}function handleError(_0x18a0ea,_0x268cb6){_0x268cb6=_0x268cb6||0x1f4;return function(_0x145ae4){logger['error'](_0x145ae4['stack']);if(_0x145ae4['name']){delete _0x145ae4[_0xb076('0x31')];}_0x18a0ea['status'](_0x268cb6)['send'](_0x145ae4);};}exports[_0xb076('0x32')]=function(_0xf08343,_0x4c3ae1){var _0x1a51de={},_0x57bb19={},_0x2244e5={'count':0x0,'rows':[]};var _0xf7e1b1=_['map'](db[_0xb076('0x33')][_0xb076('0x34')],function(_0x49fd01){return{'name':_0x49fd01[_0xb076('0x35')],'type':_0x49fd01['type'][_0xb076('0x36')]};});_0x57bb19[_0xb076('0x37')]=_[_0xb076('0x38')](_0xf7e1b1,_0xb076('0x31'));_0x57bb19[_0xb076('0x39')]=_[_0xb076('0x3a')](_0xf08343[_0xb076('0x39')]);_0x57bb19['filters']=_[_0xb076('0x3b')](_0x57bb19[_0xb076('0x37')],_0x57bb19[_0xb076('0x39')]);_0x1a51de[_0xb076('0x3c')]=_['intersection'](_0x57bb19[_0xb076('0x37')],qs[_0xb076('0x3d')](_0xf08343[_0xb076('0x39')]['fields']));_0x1a51de[_0xb076('0x3c')]=_0x1a51de[_0xb076('0x3c')][_0xb076('0x3e')]?_0x1a51de[_0xb076('0x3c')]:_0x57bb19[_0xb076('0x37')];if(!_0xf08343[_0xb076('0x39')][_0xb076('0x3f')]('nolimit')){_0x1a51de[_0xb076('0x25')]=qs[_0xb076('0x25')](_0xf08343['query']['limit']);_0x1a51de[_0xb076('0x28')]=qs[_0xb076('0x28')](_0xf08343[_0xb076('0x39')][_0xb076('0x28')]);}_0x1a51de[_0xb076('0x40')]=qs[_0xb076('0x41')](_0xf08343['query'][_0xb076('0x41')]);_0x1a51de[_0xb076('0x42')]=qs['filters'](_['pick'](_0xf08343['query'],_0x57bb19['filters']),_0xf7e1b1);if(_0xf08343[_0xb076('0x39')][_0xb076('0x43')]){_0x1a51de[_0xb076('0x42')]=_['merge'](_0x1a51de[_0xb076('0x42')],{'$or':_['map'](_0xf7e1b1,function(_0x42ea7b){if(_0x42ea7b['type']!==_0xb076('0x44')){var _0x3a1b2c={};_0x3a1b2c[_0x42ea7b[_0xb076('0x31')]]={'$like':'%'+_0xf08343['query'][_0xb076('0x43')]+'%'};return _0x3a1b2c;}})});}_0x1a51de=_[_0xb076('0x45')]({},_0x1a51de,_0xf08343['options']);var _0x14a796={'where':_0x1a51de['where']};return db['CmList']['count'](_0x14a796)['then'](function(_0x189a87){_0x2244e5[_0xb076('0x27')]=_0x189a87;if(_0xf08343[_0xb076('0x39')][_0xb076('0x46')]){_0x1a51de[_0xb076('0x47')]=[{'all':!![]}];}return db[_0xb076('0x33')][_0xb076('0x48')](_0x1a51de);})[_0xb076('0x2e')](function(_0x2a71d7){_0x2244e5[_0xb076('0x49')]=_0x2a71d7;return _0x2244e5;})[_0xb076('0x2e')](respondWithFilteredResult(_0x4c3ae1,_0x1a51de))['catch'](handleError(_0x4c3ae1,null));};exports[_0xb076('0x4a')]=function(_0x57ef8d,_0x1a56bc){var _0x51f4f0={'raw':![],'where':{'id':_0x57ef8d[_0xb076('0x4b')]['id']}},_0x4e0c15={};_0x4e0c15[_0xb076('0x37')]=_[_0xb076('0x3a')](db[_0xb076('0x33')]['rawAttributes']);_0x4e0c15[_0xb076('0x39')]=_[_0xb076('0x3a')](_0x57ef8d[_0xb076('0x39')]);_0x4e0c15[_0xb076('0x4c')]=_[_0xb076('0x3b')](_0x4e0c15['model'],_0x4e0c15[_0xb076('0x39')]);_0x51f4f0[_0xb076('0x3c')]=_['intersection'](_0x4e0c15['model'],qs[_0xb076('0x3d')](_0x57ef8d[_0xb076('0x39')]['fields']));_0x51f4f0['attributes']=_0x51f4f0[_0xb076('0x3c')]['length']?_0x51f4f0[_0xb076('0x3c')]:_0x4e0c15['model'];if(_0x57ef8d[_0xb076('0x39')][_0xb076('0x46')]){_0x51f4f0['include']=[{'all':!![]}];}_0x51f4f0=_[_0xb076('0x45')]({},_0x51f4f0,_0x57ef8d[_0xb076('0x4d')]);return db['CmList'][_0xb076('0x4e')](_0x51f4f0)[_0xb076('0x2e')](handleEntityNotFound(_0x1a56bc,null))[_0xb076('0x2e')](respondWithResult(_0x1a56bc,null))[_0xb076('0x4f')](handleError(_0x1a56bc,null));};exports['create']=function(_0x5b6e06,_0x1bf48d){return db['CmList']['create'](_0x5b6e06[_0xb076('0x50')],{})[_0xb076('0x2e')](function(_0x29c584){var _0x5d43e9=_0x5b6e06[_0xb076('0x51')][_0xb076('0x52')]({'plain':!![]});if(!_0x5d43e9)throw new Error(_0xb076('0x53'));if(_0x5d43e9[_0xb076('0x54')]===_0xb076('0x51')){var _0x3a661d=_0x29c584[_0xb076('0x52')]({'plain':!![]});var _0x2ae0a2=_0xb076('0x55');return db['UserProfileSection'][_0xb076('0x4e')]({'where':{'name':_0x2ae0a2,'userProfileId':_0x5d43e9[_0xb076('0x56')]},'raw':!![]})[_0xb076('0x2e')](function(_0x5b065b){if(_0x5b065b&&_0x5b065b[_0xb076('0x57')]===0x0){return db[_0xb076('0x30')][_0xb076('0x58')]({'name':_0x3a661d[_0xb076('0x31')],'resourceId':_0x3a661d['id'],'type':_0x5b065b[_0xb076('0x31')],'sectionId':_0x5b065b['id']},{})[_0xb076('0x2e')](function(){return _0x29c584;});}else{return _0x29c584;}})[_0xb076('0x4f')](function(_0x42c468){logger[_0xb076('0x59')](_0xb076('0x5a'),_0x42c468);throw _0x42c468;});}return _0x29c584;})[_0xb076('0x2e')](respondWithResult(_0x1bf48d,0xc9))[_0xb076('0x4f')](handleError(_0x1bf48d,null));};exports['update']=function(_0x5b998a,_0x224e91){if(_0x5b998a[_0xb076('0x50')]['id']){delete _0x5b998a['body']['id'];}return db[_0xb076('0x33')][_0xb076('0x4e')]({'where':{'id':_0x5b998a[_0xb076('0x4b')]['id']}})[_0xb076('0x2e')](handleEntityNotFound(_0x224e91,null))[_0xb076('0x2e')](saveUpdates(_0x5b998a['body'],null))[_0xb076('0x2e')](respondWithResult(_0x224e91,null))['catch'](handleError(_0x224e91,null));};exports[_0xb076('0x2f')]=function(_0x337f02,_0x19287c){return db[_0xb076('0x33')][_0xb076('0x4e')]({'where':{'id':_0x337f02[_0xb076('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19287c,null))[_0xb076('0x2e')](removeEntity(_0x19287c,null))[_0xb076('0x4f')](handleError(_0x19287c,null));};exports[_0xb076('0x5b')]=function(_0x24399c,_0x47ae2e){return db['CmList'][_0xb076('0x5b')]()[_0xb076('0x2e')](respondWithResult(_0x47ae2e,null))[_0xb076('0x4f')](handleError(_0x47ae2e,null));};exports[_0xb076('0x5c')]=function(_0x7a533f,_0x37ecd1,_0xaf84be){if(_0x7a533f[_0xb076('0x50')]['id']){delete _0x7a533f[_0xb076('0x50')]['id'];}return db[_0xb076('0x33')][_0xb076('0x4e')]({'where':{'id':_0x7a533f['params']['id']}})[_0xb076('0x2e')](handleEntityNotFound(_0x37ecd1,null))[_0xb076('0x2e')](function(_0x5d13c3){if(_0x5d13c3){_0x7a533f[_0xb076('0x50')][_0xb076('0x5d')]=_0x5d13c3['id'];return db[_0xb076('0x5e')][_0xb076('0x58')](_0x7a533f[_0xb076('0x50')]);}})[_0xb076('0x2e')](respondWithResult(_0x37ecd1,null))[_0xb076('0x4f')](handleError(_0x37ecd1,null));};exports['getDispositions']=function(_0x1dd115,_0x3eb911,_0x5e3417){var _0x19e023={'raw':![],'where':{}};var _0x16bf58={};var _0x25176b={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x1dd115['params']['id']}})['then'](handleEntityNotFound(_0x3eb911,null))['then'](function(_0x11773d){if(_0x11773d){_0x16bf58['model']=_[_0xb076('0x3a')](db['Disposition'][_0xb076('0x34')]);_0x16bf58[_0xb076('0x39')]=_[_0xb076('0x3a')](_0x1dd115[_0xb076('0x39')]);_0x16bf58[_0xb076('0x4c')]=_[_0xb076('0x3b')](_0x16bf58[_0xb076('0x37')],_0x16bf58['query']);_0x19e023['attributes']=_['intersection'](_0x16bf58[_0xb076('0x37')],qs[_0xb076('0x3d')](_0x1dd115['query'][_0xb076('0x3d')]));_0x19e023[_0xb076('0x3c')]=_0x19e023[_0xb076('0x3c')][_0xb076('0x3e')]?_0x19e023[_0xb076('0x3c')]:_0x16bf58['model'];if(!_0x1dd115[_0xb076('0x39')][_0xb076('0x3f')]('nolimit')){_0x19e023[_0xb076('0x25')]=qs[_0xb076('0x25')](_0x1dd115[_0xb076('0x39')][_0xb076('0x25')]);_0x19e023[_0xb076('0x28')]=qs[_0xb076('0x28')](_0x1dd115[_0xb076('0x39')][_0xb076('0x28')]);}_0x19e023[_0xb076('0x40')]=qs[_0xb076('0x41')](_0x1dd115[_0xb076('0x39')][_0xb076('0x41')]);_0x19e023[_0xb076('0x42')]=qs[_0xb076('0x4c')](_[_0xb076('0x5f')](_0x1dd115[_0xb076('0x39')],_0x16bf58[_0xb076('0x4c')]));_0x19e023[_0xb076('0x42')]['ListId']=_0x11773d['id'];if(_0x1dd115[_0xb076('0x39')][_0xb076('0x43')]){_0x19e023[_0xb076('0x42')]=_[_0xb076('0x45')](_0x19e023[_0xb076('0x42')],{'$or':_[_0xb076('0x38')](_0x19e023['attributes'],function(_0x172117){var _0x44795f={};_0x44795f[_0x172117]={'$like':'%'+_0x1dd115[_0xb076('0x39')][_0xb076('0x43')]+'%'};return _0x44795f;})});}_0x19e023=_[_0xb076('0x45')]({},_0x19e023,_0x1dd115['options']);return db[_0xb076('0x5e')][_0xb076('0x27')]({'where':_0x19e023['where']})[_0xb076('0x2e')](function(_0xeb1724){_0x25176b[_0xb076('0x27')]=_0xeb1724;if(_0x1dd115['query']['includeAll']){_0x19e023[_0xb076('0x47')]=[{'all':!![]}];}return db['Disposition'][_0xb076('0x48')](_0x19e023);})['then'](function(_0x3679be){_0x25176b['rows']=_0x3679be;return _0x25176b;});}})[_0xb076('0x2e')](respondWithFilteredResult(_0x3eb911,_0x19e023))[_0xb076('0x4f')](handleError(_0x3eb911,null));};exports['removeDispositions']=function(_0x4e370c,_0x3a211e,_0x283ab4){return db[_0xb076('0x33')][_0xb076('0x4e')]({'where':{'id':_0x4e370c[_0xb076('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a211e,null))[_0xb076('0x2e')](function(_0xf92bfe){if(_0xf92bfe){return _0xf92bfe['removeDispositions'](_0x4e370c[_0xb076('0x39')][_0xb076('0x60')]);}})[_0xb076('0x2e')](respondWithStatusCode(_0x3a211e,null))[_0xb076('0x4f')](handleError(_0x3a211e,null));};exports['addContacts']=function(_0x288c64,_0x14b89a,_0x417a52){return db[_0xb076('0x33')][_0xb076('0x4e')]({'where':{'id':_0x288c64[_0xb076('0x4b')]['id']}})[_0xb076('0x2e')](handleEntityNotFound(_0x14b89a,null))[_0xb076('0x2e')](function(_0x3d0538){if(_0x3d0538){var _0x7e687e=[];var _0x42c43b={'success':[],'errors':[]};return db[_0xb076('0x61')][_0xb076('0x5b')]()[_0xb076('0x2e')](function(_0x2a4ccb){if(_0x288c64[_0xb076('0x50')][_0xb076('0x62')]&&_[_0xb076('0x63')](_0x288c64[_0xb076('0x50')][_0xb076('0x62')])){if(_0x288c64['body'][_0xb076('0x62')]['length']){_0x288c64[_0xb076('0x50')][_0xb076('0x62')]=_0x288c64[_0xb076('0x50')][_0xb076('0x62')][_0xb076('0x64')](';')+';';}else{_0x288c64[_0xb076('0x50')][_0xb076('0x62')]=null;}}else{_0x288c64[_0xb076('0x50')]['tags']=null;}if(_0x288c64['body']&&_[_0xb076('0x63')](_0x288c64['body'])){for(var _0x22c0f8=0x0;_0x22c0f8<_0x288c64[_0xb076('0x50')][_0xb076('0x3e')];_0x22c0f8+=0x1){_0x288c64[_0xb076('0x50')][_0x22c0f8][_0xb076('0x5d')]=_0x288c64[_0xb076('0x4b')]['id'];_0x7e687e[_0xb076('0x65')](_0x288c64[_0xb076('0x50')][_0x22c0f8]);}return BPromise[_0xb076('0x66')](_0x7e687e,function(_0x3edb0c){return db[_0xb076('0x61')][_0xb076('0x58')](_[_0xb076('0x67')](_0x3edb0c,['ids','id'])||{},{'fields':_[_0xb076('0x3a')](_0x2a4ccb),'raw':!![]})['then'](function(_0x5d8698){_0x42c43b[_0xb076('0x68')][_0xb076('0x65')](_0x5d8698['dataValues']);})[_0xb076('0x4f')](function(_0x35ffaa){_0x42c43b[_0xb076('0x69')]['push']({'data':_0x3edb0c,'error':_0x35ffaa['message']});});})[_0xb076('0x2e')](function(_0x37f36c){return _0x42c43b;})[_0xb076('0x4f')](function(_0x47331c){return _0x47331c;});}else{_0x14b89a[_0xb076('0x22')](0x190)['json']({'message':_0xb076('0x6a')});}});}})[_0xb076('0x2e')](respondWithResult(_0x14b89a,null))[_0xb076('0x4f')](handleError(_0x14b89a,null));};exports['getContacts']=function(_0x608d23,_0x5c44f6,_0x59711d){var _0x13a5c1;return db[_0xb076('0x33')][_0xb076('0x4e')]({'where':{'id':_0x608d23[_0xb076('0x4b')]['id']},'include':[{'model':db[_0xb076('0x6b')],'as':'CustomFields'}]})[_0xb076('0x2e')](handleEntityNotFound(_0x5c44f6,null))[_0xb076('0x2e')](function(_0xd5369d){if(_0xd5369d){_0x13a5c1=_0xd5369d;return db['CmContact'][_0xb076('0x34')];}})[_0xb076('0x2e')](function(_0x307db7){if(_0x307db7){var _0x459f29={};var _0x20338f={};_0x20338f[_0xb076('0x37')]=_[_0xb076('0x6c')](_[_0xb076('0x3a')](_0x307db7),_[_0xb076('0x38')](_0x13a5c1[_0xb076('0x6d')],function(_0x1eec83){return util[_0xb076('0x6e')](_0xb076('0x6f'),_0x1eec83['id']);}));_0x20338f[_0xb076('0x39')]=_[_0xb076('0x3a')](_0x608d23['query']);_0x20338f[_0xb076('0x4c')]=_[_0xb076('0x3b')](_0x20338f['model'],_0x20338f['query']);_0x459f29['attributes']=_['intersection'](_0x20338f[_0xb076('0x37')],qs['fields'](_0x608d23[_0xb076('0x39')]['fields']));_0x459f29[_0xb076('0x3c')]=_0x459f29['attributes'][_0xb076('0x3e')]?_0x459f29['attributes']:_0x20338f['model'];if(!_0x608d23['query']['hasOwnProperty'](_0xb076('0x70'))){_0x459f29[_0xb076('0x25')]=qs[_0xb076('0x25')](_0x608d23['query'][_0xb076('0x25')]);_0x459f29[_0xb076('0x28')]=qs[_0xb076('0x28')](_0x608d23[_0xb076('0x39')][_0xb076('0x28')]);}_0x459f29[_0xb076('0x40')]=qs[_0xb076('0x41')](_0x608d23['query'][_0xb076('0x41')]);_0x459f29[_0xb076('0x42')]=qs[_0xb076('0x4c')](_[_0xb076('0x5f')](_0x608d23[_0xb076('0x39')],_0x20338f[_0xb076('0x4c')]));_0x459f29[_0xb076('0x71')]=!![];if(_0x608d23[_0xb076('0x39')][_0xb076('0x43')]){_0x459f29[_0xb076('0x42')]=_[_0xb076('0x45')](_0x459f29['where'],{'$or':_[_0xb076('0x38')](_0x459f29[_0xb076('0x3c')],function(_0x11d360){var _0x1fa048={};_0x1fa048[_0x11d360]={'$like':'%'+_0x608d23[_0xb076('0x39')][_0xb076('0x43')]+'%'};return _0x1fa048;})});}_0x459f29=_[_0xb076('0x45')]({},_0x459f29,_0x608d23['options']);return _0x13a5c1[_0xb076('0x72')](_0x459f29);}})['then'](respondWithResult(_0x5c44f6,null))['catch'](handleError(_0x5c44f6,null));};exports[_0xb076('0x73')]=function(_0x59ef11,_0x1c7bf3,_0x122702){var _0x57b799;return db[_0xb076('0x33')]['find']({'where':{'id':_0x59ef11[_0xb076('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xb076('0x6d')}]})[_0xb076('0x2e')](handleEntityNotFound(_0x1c7bf3,null))['then'](function(_0x1821c7){if(_0x1821c7){_0x57b799=_0x1821c7;return db[_0xb076('0x61')]['rawAttributes'];}})['then'](function(_0xbfbb83){if(_0xbfbb83){var _0x56536b={};var _0x2a3c3a={};_0x2a3c3a[_0xb076('0x37')]=_['concat'](_[_0xb076('0x3a')](_0xbfbb83),_['map'](_0x57b799['CustomFields'],function(_0x5f1b29){return util[_0xb076('0x6e')](_0xb076('0x6f'),_0x5f1b29['id']);}));_0x2a3c3a['query']=_[_0xb076('0x3a')](_0x59ef11[_0xb076('0x39')]);_0x2a3c3a[_0xb076('0x4c')]=_[_0xb076('0x3b')](_0x2a3c3a['model'],_0x2a3c3a[_0xb076('0x39')]);_0x56536b['attributes']=_[_0xb076('0x3b')](_0x2a3c3a[_0xb076('0x37')],qs[_0xb076('0x3d')](_0x59ef11[_0xb076('0x39')][_0xb076('0x3d')]));_0x56536b[_0xb076('0x3c')]=_0x56536b[_0xb076('0x3c')][_0xb076('0x3e')]?_0x56536b[_0xb076('0x3c')]:_0x2a3c3a['model'];if(!_0x59ef11[_0xb076('0x39')][_0xb076('0x3f')]('nolimit')){_0x56536b[_0xb076('0x25')]=qs[_0xb076('0x25')](_0x59ef11[_0xb076('0x39')]['limit']);_0x56536b['offset']=qs['offset'](_0x59ef11['query'][_0xb076('0x28')]);}_0x56536b['order']=qs[_0xb076('0x41')](_0x59ef11[_0xb076('0x39')][_0xb076('0x41')]);_0x56536b['where']=qs[_0xb076('0x4c')](_[_0xb076('0x5f')](_0x59ef11[_0xb076('0x39')],_0x2a3c3a[_0xb076('0x4c')]));_0x56536b['raw']=!![];if(_0x59ef11[_0xb076('0x39')][_0xb076('0x43')]){_0x56536b[_0xb076('0x42')]=_[_0xb076('0x45')](_0x56536b[_0xb076('0x42')],{'$or':_[_0xb076('0x38')](_0x56536b[_0xb076('0x3c')],function(_0x391b57){var _0x179ea7={};_0x179ea7[_0x391b57]={'$like':'%'+_0x59ef11[_0xb076('0x39')][_0xb076('0x43')]+'%'};return _0x179ea7;})});}_0x56536b=_[_0xb076('0x45')]({},_0x56536b,_0x59ef11[_0xb076('0x4d')]);return _0x57b799[_0xb076('0x72')](_0x56536b);}})[_0xb076('0x2e')](function(_0x3ec879){if(!_[_0xb076('0x74')](_0x3ec879)){var _0x572145=toCsv(_0x3ec879);var _0x456e62=Date[_0xb076('0x75')]();fs[_0xb076('0x76')](util[_0xb076('0x6e')](_0xb076('0x77'),_0x57b799['id'],_0x456e62),_0x572145);_0x1c7bf3['setHeader'](_0xb076('0x78'),_0xb076('0x79')+util[_0xb076('0x6e')](_0xb076('0x7a'),_0x57b799['id'],_0x456e62));_0x1c7bf3['setHeader'](_0xb076('0x7b'),_0xb076('0x7c'));return _0x1c7bf3[_0xb076('0x7d')](util['format'](_0xb076('0x77'),_0x57b799['id'],_0x456e62));}else{return _0x1c7bf3[_0xb076('0x21')](0xcc);}})[_0xb076('0x4f')](handleError(_0x1c7bf3,null));};exports[_0xb076('0x7e')]=function(_0x8ad5cf,_0x352ee4,_0x4937b3){var _0x70671b;delete _0x8ad5cf[_0xb076('0x50')]['id'];return db[_0xb076('0x33')][_0xb076('0x7f')]({'where':{'id':_0x8ad5cf[_0xb076('0x4b')]['id']}})['then'](handleEntityNotFound(_0x352ee4,null))['then'](function(_0x324cfd){if(_0x324cfd){return db['sequelize']['transaction'](function(_0x13c712){return db[_0xb076('0x6b')][_0xb076('0x58')](_0x8ad5cf['body'],{'transaction':_0x13c712})['then'](function(_0x2c9ddb){_0x70671b=_0x2c9ddb;return _0x324cfd['addCustomFields'](_0x2c9ddb,{'transaction':_0x13c712});})['then'](function(){var _0x4a116d={'type':db['Sequelize'][_0xb076('0x80')],'transaction':_0x13c712};switch(_0x8ad5cf['body'][_0xb076('0x81')]){case _0xb076('0x82'):_0x4a116d[_0xb076('0x81')]=db[_0xb076('0x83')][_0xb076('0x80')];break;case _0xb076('0x84'):_0x4a116d[_0xb076('0x81')]=db['Sequelize']['INTEGER'];break;case _0xb076('0x85'):_0x4a116d[_0xb076('0x81')]=db[_0xb076('0x83')][_0xb076('0x86')];_0x4a116d[_0xb076('0x87')]=![];break;default:}return db[_0xb076('0x88')]['queryInterface'][_0xb076('0x89')](_0xb076('0x8a'),util['format'](_0xb076('0x8b'),_0x70671b['id']),_0x4a116d);})[_0xb076('0x2e')](function(){return _0x70671b;});});}})[_0xb076('0x2e')](respondWithResult(_0x352ee4,null))['catch'](handleError(_0x352ee4,null));};exports['getCustomFields']=function(_0x10a777,_0x944047,_0x477931){var _0x28f0e8={};var _0x339a3b={};var _0xbfef10;var _0x12a461;return db[_0xb076('0x33')][_0xb076('0x7f')]({'where':{'id':_0x10a777[_0xb076('0x4b')]['id']}})[_0xb076('0x2e')](handleEntityNotFound(_0x944047,null))[_0xb076('0x2e')](function(_0x363aa7){if(_0x363aa7){_0xbfef10=_0x363aa7;_0x339a3b['model']=_[_0xb076('0x3a')](db[_0xb076('0x6b')][_0xb076('0x34')]);_0x339a3b[_0xb076('0x39')]=_['keys'](_0x10a777[_0xb076('0x39')]);_0x339a3b[_0xb076('0x4c')]=_[_0xb076('0x3b')](_0x339a3b[_0xb076('0x37')],_0x339a3b['query']);_0x28f0e8[_0xb076('0x3c')]=_[_0xb076('0x3b')](_0x339a3b[_0xb076('0x37')],qs[_0xb076('0x3d')](_0x10a777[_0xb076('0x39')]['fields']));_0x28f0e8['attributes']=_0x28f0e8[_0xb076('0x3c')][_0xb076('0x3e')]?_0x28f0e8[_0xb076('0x3c')]:_0x339a3b[_0xb076('0x37')];_0x28f0e8['order']=qs[_0xb076('0x41')](_0x10a777['query']['sort']);_0x28f0e8[_0xb076('0x42')]=qs[_0xb076('0x4c')](_['pick'](_0x10a777['query'],_0x339a3b[_0xb076('0x4c')]));_0x28f0e8['where']=_[_0xb076('0x45')](_0x28f0e8[_0xb076('0x42')],{'$or':[{'ListId':_0x363aa7['id']},{'ListId':null}]});if(_0x10a777['query']['filter']){_0x28f0e8[_0xb076('0x42')]=_[_0xb076('0x45')](_0x28f0e8[_0xb076('0x42')],{'$or':_[_0xb076('0x38')](_0x28f0e8[_0xb076('0x3c')],function(_0x49341d){var _0x14a474={};_0x14a474[_0x49341d]={'$like':'%'+_0x10a777['query'][_0xb076('0x43')]+'%'};return _0x14a474;})});}_0x28f0e8=_['merge']({},_0x28f0e8,_0x10a777['options']);return db['CmCustomField']['findAndCountAll'](_0x28f0e8);}})[_0xb076('0x2e')](respondWithResult(_0x944047,null))[_0xb076('0x4f')](handleError(_0x944047,null));};exports[_0xb076('0x8c')]=function(_0x4fed78,_0x20ae58,_0x55766c){return db[_0xb076('0x33')][_0xb076('0x4e')]({'where':{'id':_0x4fed78[_0xb076('0x4b')]['id']}})[_0xb076('0x2e')](handleEntityNotFound(_0x20ae58,null))[_0xb076('0x2e')](function(_0x141bbf){if(_0x141bbf){return _0x141bbf[_0xb076('0x8c')](_0x4fed78[_0xb076('0x50')]['ids'],_[_0xb076('0x67')](_0x4fed78[_0xb076('0x50')],[_0xb076('0x60'),'id'])||{})[_0xb076('0x8d')](function(_0x2e35f1){for(var _0x4d6caf=0x0;_0x4d6caf<_0x4fed78['body'][_0xb076('0x60')][_0xb076('0x3e')];_0x4d6caf+=0x1){socket[_0xb076('0x8e')](_0xb076('0x8f'),{'UserId':Number(_0x4fed78[_0xb076('0x50')][_0xb076('0x60')][_0x4d6caf]),'CmListId':Number(_0x4fed78[_0xb076('0x4b')]['id'])});}return _0x2e35f1;});}})['then'](respondWithResult(_0x20ae58,null))[_0xb076('0x4f')](handleError(_0x20ae58,null));};exports[_0xb076('0x90')]=function(_0x369783,_0x2d42ad,_0x156db5){return db['CmList'][_0xb076('0x4e')]({'where':{'id':_0x369783[_0xb076('0x4b')]['id']}})[_0xb076('0x2e')](handleEntityNotFound(_0x2d42ad,null))[_0xb076('0x2e')](function(_0x2f4dcf){if(_0x2f4dcf){return _0x2f4dcf[_0xb076('0x90')](_0x369783[_0xb076('0x39')][_0xb076('0x60')])[_0xb076('0x2e')](function(){if(_['isArray'](_0x369783[_0xb076('0x39')][_0xb076('0x60')])){for(var _0x33e573=0x0;_0x33e573<_0x369783['query']['ids'][_0xb076('0x3e')];_0x33e573+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x369783[_0xb076('0x39')][_0xb076('0x60')][_0x33e573]),'CmListId':Number(_0x369783['params']['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x369783[_0xb076('0x39')][_0xb076('0x60')]),'CmListId':Number(_0x369783[_0xb076('0x4b')]['id'])});}});}})[_0xb076('0x2e')](respondWithStatusCode(_0x2d42ad,null))[_0xb076('0x4f')](handleError(_0x2d42ad,null));};exports[_0xb076('0x91')]=function(_0x3eb049,_0x2c60d6,_0x3da634){var _0x15a6cb={};var _0x26057b={};var _0x1ed807;var _0x3b91f3;return db[_0xb076('0x33')][_0xb076('0x7f')]({'where':{'id':_0x3eb049[_0xb076('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c60d6,null))[_0xb076('0x2e')](function(_0x1de822){if(_0x1de822){_0x1ed807=_0x1de822;_0x26057b[_0xb076('0x37')]=_[_0xb076('0x3a')](db['User'][_0xb076('0x34')]);_0x26057b[_0xb076('0x39')]=_[_0xb076('0x3a')](_0x3eb049['query']);_0x26057b[_0xb076('0x4c')]=_[_0xb076('0x3b')](_0x26057b[_0xb076('0x37')],_0x26057b[_0xb076('0x39')]);_0x15a6cb[_0xb076('0x3c')]=_[_0xb076('0x3b')](_0x26057b['model'],qs[_0xb076('0x3d')](_0x3eb049[_0xb076('0x39')]['fields']));_0x15a6cb[_0xb076('0x3c')]=_0x15a6cb[_0xb076('0x3c')][_0xb076('0x3e')]?_0x15a6cb['attributes']:_0x26057b['model'];_0x15a6cb[_0xb076('0x40')]=qs[_0xb076('0x41')](_0x3eb049[_0xb076('0x39')][_0xb076('0x41')]);_0x15a6cb['where']=qs['filters'](_['pick'](_0x3eb049['query'],_0x26057b['filters']));if(_0x3eb049[_0xb076('0x39')][_0xb076('0x43')]){_0x15a6cb['where']=_[_0xb076('0x45')](_0x15a6cb['where'],{'$or':_[_0xb076('0x38')](_0x15a6cb[_0xb076('0x3c')],function(_0x1c7d63){var _0x3c7561={};_0x3c7561[_0x1c7d63]={'$like':'%'+_0x3eb049['query'][_0xb076('0x43')]+'%'};return _0x3c7561;})});}_0x15a6cb=_['merge']({},_0x15a6cb,_0x3eb049[_0xb076('0x4d')]);return _0x1ed807[_0xb076('0x91')](_0x15a6cb);}})[_0xb076('0x2e')](function(_0x52fb23){if(_0x52fb23){_0x3b91f3=_0x52fb23[_0xb076('0x3e')];if(!_0x3eb049[_0xb076('0x39')][_0xb076('0x3f')](_0xb076('0x70'))){_0x15a6cb[_0xb076('0x25')]=qs[_0xb076('0x25')](_0x3eb049[_0xb076('0x39')]['limit']);_0x15a6cb[_0xb076('0x28')]=qs[_0xb076('0x28')](_0x3eb049['query'][_0xb076('0x28')]);}return _0x1ed807[_0xb076('0x91')](_0x15a6cb);}})[_0xb076('0x2e')](function(_0xd157a2){if(_0xd157a2){return _0xd157a2?{'count':_0x3b91f3,'rows':_0xd157a2}:null;}})['then'](respondWithResult(_0x2c60d6,null))['catch'](handleError(_0x2c60d6,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ab3ef35..c2d18d4 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(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0x7217,0x19e));var _0x7721=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7217[_0x19e35c];return _0x3e1fe8;};'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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x55ca,0x126));var _0xa55c=function(_0x18dedd,_0x4cb9e5){_0x18dedd=_0x18dedd-0x0;var _0x35b7e1=_0x55ca[_0x18dedd];return _0x35b7e1;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b429d86..f15dc27 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 _0x41bb=['bluebird','request-promise','path','rimraf','./cmList.attributes','exports','cm_lists','lodash','util','api'];(function(_0x50f013,_0x3df3f4){var _0x4a3f71=function(_0x2b7617){while(--_0x2b7617){_0x50f013['push'](_0x50f013['shift']());}};_0x4a3f71(++_0x3df3f4);}(_0x41bb,0xc5));var _0xb41b=function(_0x2af4fe,_0x2b25bf){_0x2af4fe=_0x2af4fe-0x0;var _0x1dd4cf=_0x41bb[_0x2af4fe];return _0x1dd4cf;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('CmList',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xe14d,0x1ee));var _0xde14=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe14d[_0x24237f];return _0x48298e;};'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']('CmList',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index d3d9644..3f09a6f 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 _0x5054=['CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','then'];(function(_0x59ecd5,_0x20d212){var _0x5a5966=function(_0x33441d){while(--_0x33441d){_0x59ecd5['push'](_0x59ecd5['shift']());}};_0x5a5966(++_0x20d212);}(_0x5054,0xc8));var _0x4505=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5054[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x4505('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4505('0x1'));var fs=require('fs');var Redis=require(_0x4505('0x2'));var db=require(_0x4505('0x3'))['db'];var utils=require(_0x4505('0x4'));var logger=require(_0x4505('0x5'))('rpc');var config=require(_0x4505('0x6'));var jayson=require(_0x4505('0x7'));var client=jayson[_0x4505('0x8')][_0x4505('0x9')]({'port':0x232a});config[_0x4505('0xa')]=_['defaults'](config[_0x4505('0xa')],{'host':_0x4505('0xb'),'port':0x18eb});var socket=require(_0x4505('0xc'))(new Redis(config[_0x4505('0xa')]));require(_0x4505('0xd'))[_0x4505('0xe')](socket);function respondWithRpcPromise(_0x48c87d,_0x5b2083,_0x21c183){return new BPromise(function(_0x299b31,_0x44e2cc){return client['request'](_0x48c87d,_0x21c183)[_0x4505('0xf')](function(_0x20ecf3){logger['info'](_0x4505('0x10'),_0x5b2083,_0x4505('0x11'));logger[_0x4505('0x12')](_0x4505('0x13'),_0x5b2083,_0x4505('0x11'),JSON[_0x4505('0x14')](_0x20ecf3));if(_0x20ecf3[_0x4505('0x15')]){if(_0x20ecf3[_0x4505('0x15')][_0x4505('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x5b2083,_0x20ecf3[_0x4505('0x15')][_0x4505('0x17')]);return _0x44e2cc(_0x20ecf3[_0x4505('0x15')][_0x4505('0x17')]);}logger[_0x4505('0x15')](_0x4505('0x10'),_0x5b2083,_0x20ecf3[_0x4505('0x15')]['message']);return _0x299b31(_0x20ecf3[_0x4505('0x15')][_0x4505('0x17')]);}else{logger[_0x4505('0x18')]('CmList,\x20%s,\x20%s',_0x5b2083,_0x4505('0x11'));_0x299b31(_0x20ecf3[_0x4505('0x19')]['message']);}})[_0x4505('0x1a')](function(_0x3a9d36){logger[_0x4505('0x15')](_0x4505('0x10'),_0x5b2083,_0x3a9d36);_0x44e2cc(_0x3a9d36);});});} \ No newline at end of file +var _0xf958=['info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then'];(function(_0x1c2d7b,_0x91c1c1){var _0x57273b=function(_0x19ccd7){while(--_0x19ccd7){_0x1c2d7b['push'](_0x1c2d7b['shift']());}};_0x57273b(++_0x91c1c1);}(_0xf958,0xf8));var _0x8f95=function(_0x5bb541,_0x5b0a5e){_0x5bb541=_0x5bb541-0x0;var _0x134e08=_0xf958[_0x5bb541];return _0x134e08;};'use strict';var _=require(_0x8f95('0x0'));var util=require(_0x8f95('0x1'));var moment=require(_0x8f95('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x3'));var fs=require('fs');var Redis=require(_0x8f95('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f95('0x5'));var logger=require(_0x8f95('0x6'))(_0x8f95('0x7'));var config=require(_0x8f95('0x8'));var jayson=require(_0x8f95('0x9'));var client=jayson[_0x8f95('0xa')][_0x8f95('0xb')]({'port':0x232a});config[_0x8f95('0xc')]=_[_0x8f95('0xd')](config[_0x8f95('0xc')],{'host':_0x8f95('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x191cef,_0x39c0e8,_0x2f6134){return new BPromise(function(_0x514fa7,_0xc7aff0){return client['request'](_0x191cef,_0x2f6134)[_0x8f95('0xf')](function(_0x70e36d){logger[_0x8f95('0x10')](_0x8f95('0x11'),_0x39c0e8,_0x8f95('0x12'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x39c0e8,_0x8f95('0x12'),JSON[_0x8f95('0x13')](_0x70e36d));if(_0x70e36d[_0x8f95('0x14')]){if(_0x70e36d[_0x8f95('0x14')]['code']===0x1f4){logger[_0x8f95('0x14')](_0x8f95('0x11'),_0x39c0e8,_0x70e36d['error'][_0x8f95('0x15')]);return _0xc7aff0(_0x70e36d[_0x8f95('0x14')][_0x8f95('0x15')]);}logger[_0x8f95('0x14')](_0x8f95('0x11'),_0x39c0e8,_0x70e36d[_0x8f95('0x14')][_0x8f95('0x15')]);return _0x514fa7(_0x70e36d[_0x8f95('0x14')]['message']);}else{logger[_0x8f95('0x10')](_0x8f95('0x11'),_0x39c0e8,_0x8f95('0x12'));_0x514fa7(_0x70e36d[_0x8f95('0x16')]['message']);}})[_0x8f95('0x17')](function(_0x212200){logger['error'](_0x8f95('0x11'),_0x39c0e8,_0x212200);_0xc7aff0(_0x212200);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 90d65ff..859cb15 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 _0x4f98=['register','cmList:','./cmList.events','save','remove','update'];(function(_0x59f45b,_0xaeccce){var _0x6bc943=function(_0x3d84ee){while(--_0x3d84ee){_0x59f45b['push'](_0x59f45b['shift']());}};_0x6bc943(++_0xaeccce);}(_0x4f98,0xce));var _0x84f9=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x4f98[_0x430459];return _0x3a2439;};'use strict';var CmListEvents=require(_0x84f9('0x0'));var events=[_0x84f9('0x1'),_0x84f9('0x2'),_0x84f9('0x3')];function createListener(_0xafffe5,_0xa99d5f){return function(_0x4c5e6a){_0xa99d5f['emit'](_0xafffe5,_0x4c5e6a);};}function removeListener(_0x278e75,_0x291e8a){return function(){CmListEvents['removeListener'](_0x278e75,_0x291e8a);};}exports[_0x84f9('0x4')]=function(_0x3a6fb7){for(var _0x5e229d=0x0,_0x208f4a=events['length'];_0x5e229d<_0x208f4a;_0x5e229d++){var _0x778dda=events[_0x5e229d];var _0x8d0428=createListener(_0x84f9('0x5')+_0x778dda,_0x3a6fb7);CmListEvents['on'](_0x778dda,_0x8d0428);}}; \ No newline at end of file +var _0x243e=['./cmList.events','save','emit','removeListener','register','length','cmList:'];(function(_0x447174,_0x258d47){var _0x5c8c48=function(_0x28e91c){while(--_0x28e91c){_0x447174['push'](_0x447174['shift']());}};_0x5c8c48(++_0x258d47);}(_0x243e,0xe0));var _0xe243=function(_0x28afcd,_0x191b76){_0x28afcd=_0x28afcd-0x0;var _0x45d52d=_0x243e[_0x28afcd];return _0x45d52d;};'use strict';var CmListEvents=require(_0xe243('0x0'));var events=[_0xe243('0x1'),'remove','update'];function createListener(_0x4aade0,_0x5a5baf){return function(_0x4d641c){_0x5a5baf[_0xe243('0x2')](_0x4aade0,_0x4d641c);};}function removeListener(_0x15312d,_0x29a498){return function(){CmListEvents[_0xe243('0x3')](_0x15312d,_0x29a498);};}exports[_0xe243('0x4')]=function(_0x312f8b){for(var _0x17aed7=0x0,_0x27c14b=events[_0xe243('0x5')];_0x17aed7<_0x27c14b;_0x17aed7++){var _0x58397c=events[_0x17aed7];var _0x5a89a2=createListener(_0xe243('0x6')+_0x58397c,_0x312f8b);CmListEvents['on'](_0x58397c,_0x5a89a2);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 801c926..cd47e3f 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 _0x087a=['./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','/:id/contacts','/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x50deff,_0xc990e7){var _0xed2384=function(_0x56d959){while(--_0x56d959){_0x50deff['push'](_0x50deff['shift']());}};_0xed2384(++_0xc990e7);}(_0x087a,0x71));var _0xa087=function(_0x35f4e4,_0x1309b9){_0x35f4e4=_0x35f4e4-0x0;var _0x485cde=_0x087a[_0x35f4e4];return _0x485cde;};'use strict';var multer=require(_0xa087('0x0'));var util=require(_0xa087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa087('0x2'));var router=express[_0xa087('0x3')]();var fs_extra=require(_0xa087('0x4'));var auth=require(_0xa087('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa087('0x6'));var controller=require(_0xa087('0x7'));router[_0xa087('0x8')]('/',auth['isAuthenticated'](),controller[_0xa087('0x9')]);router[_0xa087('0x8')](_0xa087('0xa'),auth[_0xa087('0xb')](),controller[_0xa087('0xc')]);router[_0xa087('0x8')](_0xa087('0xd'),auth[_0xa087('0xb')](),controller['show']);router['get'](_0xa087('0xe'),auth[_0xa087('0xb')](),controller['getDispositions']);router[_0xa087('0x8')](_0xa087('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0xa087('0x8')]('/:id/contacts/csv',auth[_0xa087('0xb')](),controller['getContactsCsv']);router[_0xa087('0x8')](_0xa087('0x10'),auth[_0xa087('0xb')](),controller['getCustomFields']);router['get'](_0xa087('0x11'),auth['isAuthenticated'](),controller[_0xa087('0x12')]);router[_0xa087('0x13')]('/',auth[_0xa087('0xb')](),controller[_0xa087('0x14')]);router[_0xa087('0x13')](_0xa087('0xe'),auth['isAuthenticated'](),controller[_0xa087('0x15')]);router['post'](_0xa087('0xf'),auth['isAuthenticated'](),controller[_0xa087('0x16')]);router[_0xa087('0x13')](_0xa087('0x10'),auth['isAuthenticated'](),controller[_0xa087('0x17')]);router[_0xa087('0x13')](_0xa087('0x11'),auth[_0xa087('0xb')](),controller['addAgents']);router['put'](_0xa087('0xd'),auth[_0xa087('0xb')](),controller[_0xa087('0x18')]);router[_0xa087('0x19')](_0xa087('0xd'),auth[_0xa087('0xb')](),controller[_0xa087('0x1a')]);router[_0xa087('0x19')](_0xa087('0xe'),auth['isAuthenticated'](),controller[_0xa087('0x1b')]);router[_0xa087('0x19')](_0xa087('0x11'),auth[_0xa087('0xb')](),controller[_0xa087('0x1c')]);module[_0xa087('0x1d')]=router; \ No newline at end of file +var _0x7a9e=['express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addCustomField','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAgents','exports','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7a9e,0x95));var _0xe7a9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7a9e[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0xe7a9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe7a9('0x1'));var router=express[_0xe7a9('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe7a9('0x3'));var config=require(_0xe7a9('0x4'));var controller=require('./cmList.controller');router[_0xe7a9('0x5')]('/',auth['isAuthenticated'](),controller[_0xe7a9('0x6')]);router[_0xe7a9('0x5')](_0xe7a9('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xe7a9('0x8'),auth[_0xe7a9('0x9')](),controller[_0xe7a9('0xa')]);router[_0xe7a9('0x5')](_0xe7a9('0xb'),auth[_0xe7a9('0x9')](),controller[_0xe7a9('0xc')]);router[_0xe7a9('0x5')](_0xe7a9('0xd'),auth[_0xe7a9('0x9')](),controller[_0xe7a9('0xe')]);router['get'](_0xe7a9('0xf'),auth[_0xe7a9('0x9')](),controller[_0xe7a9('0x10')]);router[_0xe7a9('0x5')](_0xe7a9('0x11'),auth['isAuthenticated'](),controller[_0xe7a9('0x12')]);router['get']('/:id/users',auth[_0xe7a9('0x9')](),controller['getAgents']);router[_0xe7a9('0x13')]('/',auth[_0xe7a9('0x9')](),controller[_0xe7a9('0x14')]);router[_0xe7a9('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xe7a9('0x13')](_0xe7a9('0xd'),auth[_0xe7a9('0x9')](),controller['addContacts']);router[_0xe7a9('0x13')](_0xe7a9('0x11'),auth['isAuthenticated'](),controller[_0xe7a9('0x15')]);router['post'](_0xe7a9('0x16'),auth[_0xe7a9('0x9')](),controller[_0xe7a9('0x17')]);router[_0xe7a9('0x18')](_0xe7a9('0x8'),auth[_0xe7a9('0x9')](),controller['update']);router['delete'](_0xe7a9('0x8'),auth[_0xe7a9('0x9')](),controller[_0xe7a9('0x19')]);router[_0xe7a9('0x1a')]('/:id/dispositions',auth[_0xe7a9('0x9')](),controller[_0xe7a9('0x1b')]);router[_0xe7a9('0x1a')](_0xe7a9('0x16'),auth[_0xe7a9('0x9')](),controller[_0xe7a9('0x1c')]);module[_0xe7a9('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 52dbff0..4f895dd 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 _0x1749=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x419652,_0x2d89a5){var _0x3491c2=function(_0x493e83){while(--_0x493e83){_0x419652['push'](_0x419652['shift']());}};_0x3491c2(++_0x2d89a5);}(_0x1749,0x1bb));var _0x9174=function(_0x5268d1,_0x3398d7){_0x5268d1=_0x5268d1-0x0;var _0x3431ac=_0x1749[_0x5268d1];return _0x3431ac;};'use strict';var Sequelize=require(_0x9174('0x0'));module[_0x9174('0x1')]={'name':{'type':Sequelize[_0x9174('0x2')],'get':function(_0x73ee59){return this[_0x9174('0x3')]('field');}},'field':{'type':Sequelize[_0x9174('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x9174('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x36a8=['STRING','exports','VIRTUAL','getDataValue','field'];(function(_0x2f26c4,_0x22873c){var _0x1ed9a0=function(_0x5e1df0){while(--_0x5e1df0){_0x2f26c4['push'](_0x2f26c4['shift']());}};_0x1ed9a0(++_0x22873c);}(_0x36a8,0xec));var _0x836a=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x36a8[_0x52096b];return _0x2b1cc7;};'use strict';var Sequelize=require('sequelize');module[_0x836a('0x0')]={'name':{'type':Sequelize[_0x836a('0x1')],'get':function(_0x1eab8b){return this[_0x836a('0x2')](_0x836a('0x3'));}},'field':{'type':Sequelize[_0x836a('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x836a('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x836a('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 296099d..883e7c8 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x403833,_0x570194){var _0xc7382e=function(_0x3c37aa){while(--_0x3c37aa){_0x403833['push'](_0x403833['shift']());}};_0xc7382e(++_0x570194);}(_0x7a54,0x106));var _0x47a5=function(_0xb513f8,_0x3ba79c){_0xb513f8=_0xb513f8-0x0;var _0x13193f=_0x7a54[_0xb513f8];return _0x13193f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2a9840,_0x518554){var _0x340099=function(_0x2e8f9e){while(--_0x2e8f9e){_0x2a9840['push'](_0x2a9840['shift']());}};_0x340099(++_0x518554);}(_0x7a54,0x106));var _0x47a5=function(_0x3c9c8f,_0x326aa5){_0x3c9c8f=_0x3c9c8f-0x0;var _0x38436c=_0x7a54[_0x3c9c8f];return _0x38436c;};'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 1847bdd..a897fea 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 _0x7b3a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0x1c1663,_0xbca121){var _0x2b5aed=function(_0x5d00d3){while(--_0x5d00d3){_0x1c1663['push'](_0x1c1663['shift']());}};_0x2b5aed(++_0xbca121);}(_0x7b3a,0x11d));var _0xa7b3=function(_0x2fddb3,_0x4d3999){_0x2fddb3=_0x2fddb3-0x0;var _0x312988=_0x7b3a[_0x2fddb3];return _0x312988;};'use strict';var _=require(_0xa7b3('0x0'));var util=require('util');var logger=require(_0xa7b3('0x1'))(_0xa7b3('0x2'));var moment=require(_0xa7b3('0x3'));var BPromise=require(_0xa7b3('0x4'));var rp=require(_0xa7b3('0x5'));var fs=require('fs');var path=require(_0xa7b3('0x6'));var rimraf=require(_0xa7b3('0x7'));var config=require(_0xa7b3('0x8'));var attributes=require(_0xa7b3('0x9'));module[_0xa7b3('0xa')]=function(_0x599032,_0x239a22){return _0x599032['define'](_0xa7b3('0xb'),attributes,{'tableName':_0xa7b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x996b=['moment','bluebird','path','../../config/environment','./condition.attributes','exports','define','Condition','lodash'];(function(_0x36d58b,_0x2029a4){var _0x45b479=function(_0x886153){while(--_0x886153){_0x36d58b['push'](_0x36d58b['shift']());}};_0x45b479(++_0x2029a4);}(_0x996b,0x19d));var _0xb996=function(_0x52684d,_0x469bbc){_0x52684d=_0x52684d-0x0;var _0x46666e=_0x996b[_0x52684d];return _0x46666e;};'use strict';var _=require(_0xb996('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb996('0x1'));var BPromise=require(_0xb996('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb996('0x3'));var rimraf=require('rimraf');var config=require(_0xb996('0x4'));var attributes=require(_0xb996('0x5'));module[_0xb996('0x6')]=function(_0x5d1647,_0x1cf2d1){return _0x5d1647[_0xb996('0x7')](_0xb996('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 28f7a47..7c1070b 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 _0x5880=['../../config/logger','rpc','jayson/promise','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x218464,_0x23fc5f){var _0x54a063=function(_0x3a6c69){while(--_0x3a6c69){_0x218464['push'](_0x218464['shift']());}};_0x54a063(++_0x23fc5f);}(_0x5880,0x85));var _0x0588=function(_0x193fcf,_0x17486f){_0x193fcf=_0x193fcf-0x0;var _0x56121e=_0x5880[_0x193fcf];return _0x56121e;};'use strict';var _=require(_0x0588('0x0'));var util=require(_0x0588('0x1'));var moment=require('moment');var BPromise=require(_0x0588('0x2'));var rs=require(_0x0588('0x3'));var fs=require('fs');var Redis=require(_0x0588('0x4'));var db=require(_0x0588('0x5'))['db'];var utils=require(_0x0588('0x6'));var logger=require(_0x0588('0x7'))(_0x0588('0x8'));var config=require('../../config/environment');var jayson=require(_0x0588('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15000a,_0x199cfd,_0x7e85b8){return new BPromise(function(_0x4dfa88,_0xec4718){return client['request'](_0x15000a,_0x7e85b8)['then'](function(_0x4beaf1){logger[_0x0588('0xa')](_0x0588('0xb'),_0x199cfd,_0x0588('0xc'));logger[_0x0588('0xd')](_0x0588('0xe'),_0x199cfd,'request\x20sent',JSON[_0x0588('0xf')](_0x4beaf1));if(_0x4beaf1[_0x0588('0x10')]){if(_0x4beaf1[_0x0588('0x10')]['code']===0x1f4){logger[_0x0588('0x10')]('Condition,\x20%s,\x20%s',_0x199cfd,_0x4beaf1['error'][_0x0588('0x11')]);return _0xec4718(_0x4beaf1[_0x0588('0x10')]['message']);}logger[_0x0588('0x10')](_0x0588('0xb'),_0x199cfd,_0x4beaf1[_0x0588('0x10')][_0x0588('0x11')]);return _0x4dfa88(_0x4beaf1[_0x0588('0x10')]['message']);}else{logger['info'](_0x0588('0xb'),_0x199cfd,_0x0588('0xc'));_0x4dfa88(_0x4beaf1[_0x0588('0x12')]['message']);}})[_0x0588('0x13')](function(_0x15a240){logger[_0x0588('0x10')](_0x0588('0xb'),_0x199cfd,_0x15a240);_0xec4718(_0x15a240);});});} \ No newline at end of file +var _0xe1ea=['../../config/utils','../../config/logger','rpc','../../config/environment','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1b8e6d,_0x5ba0e2){var _0x25a0d3=function(_0x9fa033){while(--_0x9fa033){_0x1b8e6d['push'](_0x1b8e6d['shift']());}};_0x25a0d3(++_0x5ba0e2);}(_0xe1ea,0x120));var _0xae1e=function(_0x386b28,_0x28561b){_0x386b28=_0x386b28-0x0;var _0x3507a5=_0xe1ea[_0x386b28];return _0x3507a5;};'use strict';var _=require(_0xae1e('0x0'));var util=require(_0xae1e('0x1'));var moment=require(_0xae1e('0x2'));var BPromise=require('bluebird');var rs=require(_0xae1e('0x3'));var fs=require('fs');var Redis=require(_0xae1e('0x4'));var db=require(_0xae1e('0x5'))['db'];var utils=require(_0xae1e('0x6'));var logger=require(_0xae1e('0x7'))(_0xae1e('0x8'));var config=require(_0xae1e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5348cc,_0x3d41cb,_0xf983a4){return new BPromise(function(_0xfe25c6,_0x2362aa){return client['request'](_0x5348cc,_0xf983a4)[_0xae1e('0xa')](function(_0x5154c4){logger[_0xae1e('0xb')]('Condition,\x20%s,\x20%s',_0x3d41cb,_0xae1e('0xc'));logger['debug'](_0xae1e('0xd'),_0x3d41cb,'request\x20sent',JSON[_0xae1e('0xe')](_0x5154c4));if(_0x5154c4['error']){if(_0x5154c4['error'][_0xae1e('0xf')]===0x1f4){logger[_0xae1e('0x10')](_0xae1e('0x11'),_0x3d41cb,_0x5154c4[_0xae1e('0x10')][_0xae1e('0x12')]);return _0x2362aa(_0x5154c4['error'][_0xae1e('0x12')]);}logger[_0xae1e('0x10')](_0xae1e('0x11'),_0x3d41cb,_0x5154c4['error'][_0xae1e('0x12')]);return _0xfe25c6(_0x5154c4[_0xae1e('0x10')][_0xae1e('0x12')]);}else{logger[_0xae1e('0xb')](_0xae1e('0x11'),_0x3d41cb,_0xae1e('0xc'));_0xfe25c6(_0x5154c4[_0xae1e('0x13')][_0xae1e('0x12')]);}})[_0xae1e('0x14')](function(_0x404cb9){logger['error'](_0xae1e('0x11'),_0x3d41cb,_0x404cb9);_0x2362aa(_0x404cb9);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0e269bc..9b82370 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 _0x145f=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x145f,0x1bd));var _0xf145=function(_0x87aa3e,_0x49b250){_0x87aa3e=_0x87aa3e-0x0;var _0x2a6883=_0x145f[_0x87aa3e];return _0x2a6883;};'use strict';var multer=require(_0xf145('0x0'));var util=require(_0xf145('0x1'));var path=require(_0xf145('0x2'));var timeout=require(_0xf145('0x3'));var express=require(_0xf145('0x4'));var router=express[_0xf145('0x5')]();var fs_extra=require(_0xf145('0x6'));var auth=require(_0xf145('0x7'));var interaction=require(_0xf145('0x8'));var config=require(_0xf145('0x9'));var controller=require('./condition.controller');router[_0xf145('0xa')]('/:id',auth[_0xf145('0xb')](),controller[_0xf145('0xc')]);router[_0xf145('0xd')](_0xf145('0xe'),auth[_0xf145('0xb')](),controller[_0xf145('0xf')]);module[_0xf145('0x10')]=router; \ No newline at end of file +var _0xd237=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x2f95b0,_0x551e64){var _0x3bd230=function(_0x58fce8){while(--_0x58fce8){_0x2f95b0['push'](_0x2f95b0['shift']());}};_0x3bd230(++_0x551e64);}(_0xd237,0x1dc));var _0x7d23=function(_0x53bbb0,_0x66fb6){_0x53bbb0=_0x53bbb0-0x0;var _0x2b8845=_0xd237[_0x53bbb0];return _0x2b8845;};'use strict';var multer=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var path=require(_0x7d23('0x2'));var timeout=require(_0x7d23('0x3'));var express=require(_0x7d23('0x4'));var router=express[_0x7d23('0x5')]();var fs_extra=require(_0x7d23('0x6'));var auth=require(_0x7d23('0x7'));var interaction=require(_0x7d23('0x8'));var config=require('../../config/environment');var controller=require(_0x7d23('0x9'));router[_0x7d23('0xa')](_0x7d23('0xb'),auth[_0x7d23('0xc')](),controller[_0x7d23('0xd')]);router[_0x7d23('0xe')](_0x7d23('0xb'),auth[_0x7d23('0xc')](),controller[_0x7d23('0xf')]);module[_0x7d23('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 2fac9d8..aa999c7 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 8e281b3..c2846ba 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 _0x4ed5=['filter','merge','VIRTUAL','Dashboard','includeAll','include','findAll','rows','show','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','body','omit','updatedAt','UserProfileSection','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','order','map','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','get','UserProfileResource','error','index','rawAttributes','fieldName','type','key','name','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x29945c,_0x52a085){var _0x29cf01=function(_0x218b7b){while(--_0x218b7b){_0x29945c['push'](_0x29945c['shift']());}};_0x29cf01(++_0x52a085);}(_0x4ed5,0x1a8));var _0x54ed=function(_0x56d6f7,_0xb16b98){_0x56d6f7=_0x56d6f7-0x0;var _0x12f4ee=_0x4ed5[_0x56d6f7];return _0x12f4ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54ed('0x0'));var zipdir=require(_0x54ed('0x1'));var jsonpatch=require(_0x54ed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x54ed('0x3'));var util=require(_0x54ed('0x4'));var path=require('path');var sox=require(_0x54ed('0x5'));var csv=require(_0x54ed('0x6'));var ejs=require(_0x54ed('0x7'));var fs=require('fs');var fs_extra=require(_0x54ed('0x8'));var _=require('lodash');var squel=require(_0x54ed('0x9'));var crypto=require(_0x54ed('0xa'));var jsforce=require(_0x54ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x54ed('0x6'));var querystring=require(_0x54ed('0xc'));var Papa=require(_0x54ed('0xd'));var Redis=require(_0x54ed('0xe'));var authService=require(_0x54ed('0xf'));var qs=require(_0x54ed('0x10'));var as=require(_0x54ed('0x11'));var hardwareService=require(_0x54ed('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x54ed('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x54ed('0x14'))['db'];config[_0x54ed('0x15')]=_['defaults'](config[_0x54ed('0x15')],{'host':_0x54ed('0x16'),'port':0x18eb});var socket=require(_0x54ed('0x17'))(new Redis(config[_0x54ed('0x15')]));require(_0x54ed('0x18'))['register'](socket);function respondWithStatusCode(_0x1239bb,_0x18d505){_0x18d505=_0x18d505||0xcc;return function(_0x51f853){if(_0x51f853){return _0x1239bb[_0x54ed('0x19')](_0x18d505);}return _0x1239bb[_0x54ed('0x1a')](_0x18d505)[_0x54ed('0x1b')]();};}function respondWithResult(_0x115cfc,_0xd0659d){_0xd0659d=_0xd0659d||0xc8;return function(_0x255839){if(_0x255839){return _0x115cfc[_0x54ed('0x1a')](_0xd0659d)[_0x54ed('0x1c')](_0x255839);}};}function respondWithFilteredResult(_0x5b212c,_0x2c90b7){return function(_0x2d3886){if(_0x2d3886){var _0x5e656b=typeof _0x2c90b7[_0x54ed('0x1d')]==='undefined'&&typeof _0x2c90b7['limit']===_0x54ed('0x1e');var _0x48dc92=_0x2d3886[_0x54ed('0x1f')];var _0x1fbcf6=_0x5e656b?0x0:_0x2c90b7[_0x54ed('0x1d')];var _0x68ad00=_0x5e656b?_0x2d3886[_0x54ed('0x1f')]:_0x2c90b7[_0x54ed('0x1d')]+_0x2c90b7[_0x54ed('0x20')];var _0x40311b;if(_0x68ad00>=_0x48dc92){_0x68ad00=_0x48dc92;_0x40311b=0xc8;}else{_0x40311b=0xce;}_0x5b212c['status'](_0x40311b);return _0x5b212c[_0x54ed('0x21')]('Content-Range',_0x1fbcf6+'-'+_0x68ad00+'/'+_0x48dc92)['json'](_0x2d3886);}return null;};}function patchUpdates(_0xaf0c22){return function(_0x226fb7){try{jsonpatch['apply'](_0x226fb7,_0xaf0c22,!![]);}catch(_0xb62ebf){return BPromise[_0x54ed('0x22')](_0xb62ebf);}return _0x226fb7['save']();};}function saveUpdates(_0x3ec6a3,_0x3f7c34){return function(_0x1f3c01){if(_0x1f3c01){return _0x1f3c01[_0x54ed('0x23')](_0x3ec6a3)[_0x54ed('0x24')](function(_0x4e4efd){return _0x4e4efd;});}return null;};}function removeEntity(_0x3bfac3,_0x3f5ee2){return function(_0x19ae57){if(_0x19ae57){return _0x19ae57[_0x54ed('0x25')]()['then'](function(){var _0x5a7ded=_0x19ae57[_0x54ed('0x26')]({'plain':!![]});var _0x489ed4='CustomDashboards';return db[_0x54ed('0x27')][_0x54ed('0x25')]({'where':{'type':_0x489ed4,'resourceId':_0x5a7ded['id']}})[_0x54ed('0x24')](function(){return _0x19ae57;});})['then'](function(){_0x3bfac3[_0x54ed('0x1a')](0xcc)[_0x54ed('0x1b')]();});}};}function handleEntityNotFound(_0x20b0dc,_0x4e93cc){return function(_0x4577f6){if(!_0x4577f6){_0x20b0dc[_0x54ed('0x19')](0x194);}return _0x4577f6;};}function handleError(_0x40805f,_0x47cf64){_0x47cf64=_0x47cf64||0x1f4;return function(_0x3b85d0){logger[_0x54ed('0x28')](_0x3b85d0['stack']);if(_0x3b85d0['name']){delete _0x3b85d0['name'];}_0x40805f['status'](_0x47cf64)['send'](_0x3b85d0);};}exports[_0x54ed('0x29')]=function(_0x594c55,_0x1ec2dd){var _0x1dfdfa={},_0x40dfd1={},_0x5bd71e={'count':0x0,'rows':[]};var _0x4c7efe=_['map'](db['Dashboard'][_0x54ed('0x2a')],function(_0x13cc13){return{'name':_0x13cc13[_0x54ed('0x2b')],'type':_0x13cc13[_0x54ed('0x2c')][_0x54ed('0x2d')]};});_0x40dfd1['model']=_['map'](_0x4c7efe,_0x54ed('0x2e'));_0x40dfd1['query']=_[_0x54ed('0x2f')](_0x594c55[_0x54ed('0x30')]);_0x40dfd1[_0x54ed('0x31')]=_['intersection'](_0x40dfd1[_0x54ed('0x32')],_0x40dfd1[_0x54ed('0x30')]);_0x1dfdfa[_0x54ed('0x33')]=_[_0x54ed('0x34')](_0x40dfd1[_0x54ed('0x32')],qs[_0x54ed('0x35')](_0x594c55['query'][_0x54ed('0x35')]));_0x1dfdfa['attributes']=_0x1dfdfa[_0x54ed('0x33')][_0x54ed('0x36')]?_0x1dfdfa[_0x54ed('0x33')]:_0x40dfd1[_0x54ed('0x32')];if(!_0x594c55[_0x54ed('0x30')][_0x54ed('0x37')](_0x54ed('0x38'))){_0x1dfdfa['limit']=qs[_0x54ed('0x20')](_0x594c55['query']['limit']);_0x1dfdfa['offset']=qs[_0x54ed('0x1d')](_0x594c55[_0x54ed('0x30')][_0x54ed('0x1d')]);}_0x1dfdfa['order']=qs['sort'](_0x594c55[_0x54ed('0x30')][_0x54ed('0x39')]);_0x1dfdfa[_0x54ed('0x3a')]=qs[_0x54ed('0x31')](_[_0x54ed('0x3b')](_0x594c55[_0x54ed('0x30')],_0x40dfd1[_0x54ed('0x31')]),_0x4c7efe);if(_0x594c55[_0x54ed('0x30')][_0x54ed('0x3c')]){_0x1dfdfa[_0x54ed('0x3a')]=_[_0x54ed('0x3d')](_0x1dfdfa[_0x54ed('0x3a')],{'$or':_['map'](_0x4c7efe,function(_0x2e4deb){if(_0x2e4deb[_0x54ed('0x2c')]!==_0x54ed('0x3e')){var _0x11e1ca={};_0x11e1ca[_0x2e4deb[_0x54ed('0x2e')]]={'$like':'%'+_0x594c55[_0x54ed('0x30')][_0x54ed('0x3c')]+'%'};return _0x11e1ca;}})});}_0x1dfdfa=_[_0x54ed('0x3d')]({},_0x1dfdfa,_0x594c55['options']);var _0x4c232e={'where':_0x1dfdfa[_0x54ed('0x3a')]};return db[_0x54ed('0x3f')][_0x54ed('0x1f')](_0x4c232e)[_0x54ed('0x24')](function(_0x320b87){_0x5bd71e[_0x54ed('0x1f')]=_0x320b87;if(_0x594c55['query'][_0x54ed('0x40')]){_0x1dfdfa[_0x54ed('0x41')]=[{'all':!![]}];}return db[_0x54ed('0x3f')][_0x54ed('0x42')](_0x1dfdfa);})[_0x54ed('0x24')](function(_0x45c362){_0x5bd71e[_0x54ed('0x43')]=_0x45c362;return _0x5bd71e;})[_0x54ed('0x24')](respondWithFilteredResult(_0x1ec2dd,_0x1dfdfa))['catch'](handleError(_0x1ec2dd,null));};exports[_0x54ed('0x44')]=function(_0x486c1f,_0x4d23bd){var _0x528742={'raw':![],'where':{'id':_0x486c1f['params']['id']}},_0x583bb8={};_0x583bb8['model']=_[_0x54ed('0x2f')](db[_0x54ed('0x3f')][_0x54ed('0x2a')]);_0x583bb8[_0x54ed('0x30')]=_[_0x54ed('0x2f')](_0x486c1f['query']);_0x583bb8[_0x54ed('0x31')]=_[_0x54ed('0x34')](_0x583bb8[_0x54ed('0x32')],_0x583bb8[_0x54ed('0x30')]);_0x528742[_0x54ed('0x33')]=_['intersection'](_0x583bb8[_0x54ed('0x32')],qs['fields'](_0x486c1f['query'][_0x54ed('0x35')]));_0x528742[_0x54ed('0x33')]=_0x528742[_0x54ed('0x33')][_0x54ed('0x36')]?_0x528742[_0x54ed('0x33')]:_0x583bb8[_0x54ed('0x32')];if(_0x486c1f[_0x54ed('0x30')][_0x54ed('0x40')]){_0x528742[_0x54ed('0x41')]=[{'all':!![]}];}_0x528742=_[_0x54ed('0x3d')]({},_0x528742,_0x486c1f[_0x54ed('0x45')]);return db[_0x54ed('0x3f')][_0x54ed('0x46')](_0x528742)['then'](handleEntityNotFound(_0x4d23bd,null))['then'](respondWithResult(_0x4d23bd,null))['catch'](handleError(_0x4d23bd,null));};exports[_0x54ed('0x47')]=function(_0x361637,_0x132506){return db[_0x54ed('0x3f')][_0x54ed('0x47')](_0x361637['body'],{})[_0x54ed('0x24')](function(_0x3b44b2){var _0x486293=_0x361637[_0x54ed('0x48')][_0x54ed('0x26')]({'plain':!![]});if(!_0x486293)throw new Error(_0x54ed('0x49'));if(_0x486293[_0x54ed('0x4a')]==='user'){var _0x5113fc=_0x3b44b2[_0x54ed('0x26')]({'plain':!![]});var _0x32ca70=_0x54ed('0x4b');return db['UserProfileSection'][_0x54ed('0x46')]({'where':{'name':_0x32ca70,'userProfileId':_0x486293['userProfileId']},'raw':!![]})[_0x54ed('0x24')](function(_0x52540f){if(_0x52540f&&_0x52540f[_0x54ed('0x4c')]===0x0){return db[_0x54ed('0x27')]['create']({'name':_0x5113fc[_0x54ed('0x2e')],'resourceId':_0x5113fc['id'],'type':_0x52540f[_0x54ed('0x2e')],'sectionId':_0x52540f['id']},{})['then'](function(){return _0x3b44b2;});}else{return _0x3b44b2;}})[_0x54ed('0x4d')](function(_0x50f1be){logger[_0x54ed('0x28')](_0x54ed('0x4e'),_0x50f1be);throw _0x50f1be;});}return _0x3b44b2;})['then'](respondWithResult(_0x132506,0xc9))[_0x54ed('0x4d')](handleError(_0x132506,null));};exports[_0x54ed('0x4f')]=function(_0x3b21fb,_0x710df2){var _0x1c4e87={'where':{'id':_0x3b21fb[_0x54ed('0x50')]['id']}},_0x2659f4={};_0x2659f4['model']=_['keys'](db['Dashboard'][_0x54ed('0x2a')]);_0x1c4e87[_0x54ed('0x33')]=_[_0x54ed('0x34')](_0x2659f4['model'],qs[_0x54ed('0x35')](_0x3b21fb['query']['fields']));_0x1c4e87['attributes']=_0x1c4e87[_0x54ed('0x33')][_0x54ed('0x36')]?_0x1c4e87[_0x54ed('0x33')]:_0x2659f4['model'];if(_0x3b21fb[_0x54ed('0x30')][_0x54ed('0x40')]){_0x1c4e87[_0x54ed('0x41')]=[{'all':!![]}];}_0x1c4e87=_['merge']({},_0x1c4e87,_0x3b21fb[_0x54ed('0x45')]);return db['Dashboard']['find'](_0x1c4e87)[_0x54ed('0x24')](handleEntityNotFound(_0x710df2,null))['then'](function(_0x35644f){if(_0x35644f){var _0x9972fd=_0x35644f[_0x54ed('0x26')]({'plain':!![]});_0x9972fd=qs['omit'](_0x9972fd,['id',_0x54ed('0x51'),'updatedAt']);_0x3b21fb[_0x54ed('0x52')]=_[_0x54ed('0x53')](_0x3b21fb['body'],['id',_0x54ed('0x51'),_0x54ed('0x54')]);return db[_0x54ed('0x3f')][_0x54ed('0x47')](_[_0x54ed('0x3d')](_0x9972fd,_0x3b21fb[_0x54ed('0x52')]),{'include':_0x3b21fb[_0x54ed('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x54ed('0x24')](function(_0x5b3c5a){var _0x1ec343=_0x3b21fb['user'][_0x54ed('0x26')]({'plain':!![]});if(!_0x1ec343)throw new Error(_0x54ed('0x49'));if(_0x1ec343['role']===_0x54ed('0x48')){var _0x367a0d=_0x5b3c5a[_0x54ed('0x26')]({'plain':!![]});var _0x247a05='CustomDashboards';return db[_0x54ed('0x55')]['find']({'where':{'name':_0x247a05,'userProfileId':_0x1ec343[_0x54ed('0x56')]},'raw':!![]})['then'](function(_0x525b93){if(_0x525b93&&_0x525b93['autoAssociation']===0x0){return db['UserProfileResource'][_0x54ed('0x47')]({'name':_0x367a0d[_0x54ed('0x2e')],'resourceId':_0x367a0d['id'],'type':_0x525b93['name'],'sectionId':_0x525b93['id']},{})['then'](function(){return _0x5b3c5a;});}else{return _0x5b3c5a;}})[_0x54ed('0x4d')](function(_0x136692){logger[_0x54ed('0x28')](_0x54ed('0x4e'),_0x136692);throw _0x136692;});}return _0x5b3c5a;});}})['then'](respondWithResult(_0x710df2,0xc9))[_0x54ed('0x4d')](handleError(_0x710df2,null));};exports[_0x54ed('0x23')]=function(_0x475993,_0xefe016){if(_0x475993['body']['id']){delete _0x475993[_0x54ed('0x52')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x475993['params']['id']}})['then'](handleEntityNotFound(_0xefe016,null))[_0x54ed('0x24')](saveUpdates(_0x475993[_0x54ed('0x52')],null))[_0x54ed('0x24')](respondWithResult(_0xefe016,null))[_0x54ed('0x4d')](handleError(_0xefe016,null));};exports[_0x54ed('0x25')]=function(_0x44b25f,_0x332660){return db['Dashboard'][_0x54ed('0x46')]({'where':{'id':_0x44b25f['params']['id']}})[_0x54ed('0x24')](handleEntityNotFound(_0x332660,null))['then'](removeEntity(_0x332660,null))[_0x54ed('0x4d')](handleError(_0x332660,null));};function widgetAttributes(_0x3fd89d){try{switch(_0x3fd89d['type']){case _0x54ed('0x57'):return[{'name':'attrUrl','value':_0x3fd89d[_0x54ed('0x58')]||(_0x3fd89d['attrs']&&_0x3fd89d[_0x54ed('0x59')][0x0]?_0x3fd89d[_0x54ed('0x59')][0x0][_0x54ed('0x5a')]:undefined)||_0x54ed('0x5b')}];case _0x54ed('0x5c'):return[{'name':_0x54ed('0x5d'),'value':_0x3fd89d['attrPath']||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d[_0x54ed('0x59')][0x0]?_0x3fd89d['attrs'][0x0][_0x54ed('0x5a')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x3fd89d[_0x54ed('0x5e')]||(_0x3fd89d['attrs']&&_0x3fd89d[_0x54ed('0x59')][0x0]?_0x3fd89d[_0x54ed('0x59')][0x0][_0x54ed('0x5a')]:undefined)||_0x54ed('0x5f')},{'name':_0x54ed('0x60'),'value':_0x3fd89d[_0x54ed('0x60')]||(_0x3fd89d['attrs']&&_0x3fd89d[_0x54ed('0x59')][0x1]?_0x3fd89d[_0x54ed('0x59')][0x1][_0x54ed('0x5a')]:undefined)||_0x54ed('0x61')},{'name':_0x54ed('0x62'),'value':_0x3fd89d['attrFontSize']||(_0x3fd89d['attrs']&&_0x3fd89d[_0x54ed('0x59')][0x2]?_0x3fd89d[_0x54ed('0x59')][0x2][_0x54ed('0x5a')]:undefined)||0xc}];case _0x54ed('0x63'):return[{'name':_0x54ed('0x64'),'value':_0x3fd89d[_0x54ed('0x64')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d['attrs'][0x0]?_0x3fd89d[_0x54ed('0x59')][0x0][_0x54ed('0x5a')]:undefined)||_0x54ed('0x65')},{'name':_0x54ed('0x66'),'value':_0x3fd89d[_0x54ed('0x66')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d['attrs'][0x1]?_0x3fd89d[_0x54ed('0x59')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3fd89d[_0x54ed('0x62')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d[_0x54ed('0x59')][0x2]?_0x3fd89d[_0x54ed('0x59')][0x2][_0x54ed('0x5a')]:undefined)||0x14}];case _0x54ed('0x67'):case _0x54ed('0x68'):return[{'name':_0x54ed('0x69'),'value':_0x3fd89d[_0x54ed('0x69')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d[_0x54ed('0x59')][0x0]?_0x3fd89d[_0x54ed('0x59')][0x0]['value']:undefined)||'total'},{'name':_0x54ed('0x6a'),'value':_0x3fd89d[_0x54ed('0x6a')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d[_0x54ed('0x59')][0x1]?_0x3fd89d[_0x54ed('0x59')][0x1][_0x54ed('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0x3fd89d[_0x54ed('0x6b')]||(_0x3fd89d['attrs']&&_0x3fd89d[_0x54ed('0x59')][0x2]?_0x3fd89d[_0x54ed('0x59')][0x2][_0x54ed('0x5a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3fd89d[_0x54ed('0x66')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d[_0x54ed('0x59')][0x3]?_0x3fd89d[_0x54ed('0x59')][0x3][_0x54ed('0x5a')]:undefined)||[]}];case _0x54ed('0x6c'):return[{'name':'attrReport','type':_0x3fd89d[_0x54ed('0x6d')]||(_0x3fd89d['attrs']&&_0x3fd89d['attrs'][0x0]?_0x3fd89d[_0x54ed('0x59')][0x0][_0x54ed('0x2c')]:undefined)||null,'value':_0x3fd89d[_0x54ed('0x6e')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d[_0x54ed('0x59')][0x0]?_0x3fd89d[_0x54ed('0x59')][0x0]['value']:undefined)||null},{'name':_0x54ed('0x6f'),'value':_0x3fd89d[_0x54ed('0x6f')]||(_0x3fd89d[_0x54ed('0x59')]&&_0x3fd89d[_0x54ed('0x59')][0x1]?_0x3fd89d['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2bc982){logger[_0x54ed('0x28')](_0x54ed('0x70'),JSON[_0x54ed('0x71')](_0x2bc982));return[];}}exports[_0x54ed('0x72')]=function(_0x4690f9,_0x2a85c9,_0x181ca2){if(_0x4690f9[_0x54ed('0x52')]['id']){delete _0x4690f9[_0x54ed('0x52')]['id'];}return db[_0x54ed('0x3f')][_0x54ed('0x46')]({'where':{'id':_0x4690f9[_0x54ed('0x50')]['id']}})[_0x54ed('0x24')](handleEntityNotFound(_0x2a85c9,null))[_0x54ed('0x24')](function(_0x524b7e){if(_0x524b7e){_0x4690f9[_0x54ed('0x52')][_0x54ed('0x73')]=_0x524b7e['id'];_0x4690f9[_0x54ed('0x52')][_0x54ed('0x59')]=widgetAttributes(_0x4690f9[_0x54ed('0x52')]);return db['DashboardItem'][_0x54ed('0x47')](_0x4690f9[_0x54ed('0x52')]);}})[_0x54ed('0x24')](respondWithResult(_0x2a85c9,null))[_0x54ed('0x4d')](handleError(_0x2a85c9,null));};exports[_0x54ed('0x74')]=function(_0x2ac855,_0x234a43,_0x42cbeb){var _0x1f8e74={};var _0x12e06e={};var _0x4b6e7d;var _0xde0542;return db[_0x54ed('0x3f')][_0x54ed('0x75')]({'where':{'id':_0x2ac855[_0x54ed('0x50')]['id']}})[_0x54ed('0x24')](handleEntityNotFound(_0x234a43,null))[_0x54ed('0x24')](function(_0x368216){if(_0x368216){_0x4b6e7d=_0x368216;_0x12e06e[_0x54ed('0x32')]=_[_0x54ed('0x2f')](db[_0x54ed('0x76')][_0x54ed('0x2a')]);_0x12e06e[_0x54ed('0x30')]=_[_0x54ed('0x2f')](_0x2ac855[_0x54ed('0x30')]);_0x12e06e[_0x54ed('0x31')]=_['intersection'](_0x12e06e['model'],_0x12e06e[_0x54ed('0x30')]);_0x1f8e74[_0x54ed('0x33')]=_[_0x54ed('0x34')](_0x12e06e[_0x54ed('0x32')],qs['fields'](_0x2ac855['query'][_0x54ed('0x35')]));_0x1f8e74['attributes']=_0x1f8e74[_0x54ed('0x33')][_0x54ed('0x36')]?_0x1f8e74['attributes']:_0x12e06e[_0x54ed('0x32')];_0x1f8e74[_0x54ed('0x77')]=qs[_0x54ed('0x39')](_0x2ac855[_0x54ed('0x30')][_0x54ed('0x39')]);_0x1f8e74[_0x54ed('0x3a')]=qs['filters'](_[_0x54ed('0x3b')](_0x2ac855[_0x54ed('0x30')],_0x12e06e[_0x54ed('0x31')]));if(_0x2ac855[_0x54ed('0x30')][_0x54ed('0x3c')]){_0x1f8e74['where']=_[_0x54ed('0x3d')](_0x1f8e74[_0x54ed('0x3a')],{'$or':_[_0x54ed('0x78')](_0x1f8e74['attributes'],function(_0x42d70b){var _0x40b549={};_0x40b549[_0x42d70b]={'$like':'%'+_0x2ac855[_0x54ed('0x30')][_0x54ed('0x3c')]+'%'};return _0x40b549;})});}_0x1f8e74=_[_0x54ed('0x3d')]({},_0x1f8e74,_0x2ac855[_0x54ed('0x45')]);return _0x4b6e7d[_0x54ed('0x74')](_0x1f8e74);}})[_0x54ed('0x24')](function(_0x51c59f){if(_0x51c59f){_0xde0542=_0x51c59f[_0x54ed('0x36')];if(!_0x2ac855['query'][_0x54ed('0x37')](_0x54ed('0x38'))){_0x1f8e74[_0x54ed('0x20')]=qs[_0x54ed('0x20')](_0x2ac855[_0x54ed('0x30')][_0x54ed('0x20')]);_0x1f8e74[_0x54ed('0x1d')]=qs['offset'](_0x2ac855['query'][_0x54ed('0x1d')]);}return _0x4b6e7d[_0x54ed('0x74')](_0x1f8e74);}})[_0x54ed('0x24')](function(_0x1ff8e4){if(_0x1ff8e4){return _0x1ff8e4?{'count':_0xde0542,'rows':_0x1ff8e4}:null;}})[_0x54ed('0x24')](respondWithResult(_0x234a43,null))[_0x54ed('0x4d')](handleError(_0x234a43,null));}; \ No newline at end of file +var _0x2926=['role','user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','util','path','to-csv','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','Dashboard','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','create','body'];(function(_0x4272dd,_0x447405){var _0x33add3=function(_0xb4bdf2){while(--_0xb4bdf2){_0x4272dd['push'](_0x4272dd['shift']());}};_0x33add3(++_0x447405);}(_0x2926,0x1e7));var _0x6292=function(_0x416468,_0x2e7a72){_0x416468=_0x416468-0x0;var _0x2ee9b7=_0x2926[_0x416468];return _0x2ee9b7;};'use strict';var emlformat=require(_0x6292('0x0'));var rimraf=require(_0x6292('0x1'));var zipdir=require(_0x6292('0x2'));var jsonpatch=require(_0x6292('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6292('0x4'));var path=require(_0x6292('0x5'));var sox=require('sox');var csv=require(_0x6292('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6292('0x7'));var _=require(_0x6292('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6292('0x9'));var toCsv=require(_0x6292('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6292('0xa'));var authService=require(_0x6292('0xb'));var qs=require(_0x6292('0xc'));var as=require(_0x6292('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6292('0xe'))(_0x6292('0xf'));var utils=require(_0x6292('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x6292('0x11'));var db=require(_0x6292('0x12'))['db'];config[_0x6292('0x13')]=_[_0x6292('0x14')](config['redis'],{'host':_0x6292('0x15'),'port':0x18eb});var socket=require(_0x6292('0x16'))(new Redis(config['redis']));require(_0x6292('0x17'))['register'](socket);function respondWithStatusCode(_0x234d1c,_0x53429d){_0x53429d=_0x53429d||0xcc;return function(_0x353b0a){if(_0x353b0a){return _0x234d1c[_0x6292('0x18')](_0x53429d);}return _0x234d1c[_0x6292('0x19')](_0x53429d)[_0x6292('0x1a')]();};}function respondWithResult(_0x355617,_0x2ca22f){_0x2ca22f=_0x2ca22f||0xc8;return function(_0x55026c){if(_0x55026c){return _0x355617['status'](_0x2ca22f)['json'](_0x55026c);}};}function respondWithFilteredResult(_0x134cba,_0x215de0){return function(_0x2309db){if(_0x2309db){var _0xade4a1=typeof _0x215de0[_0x6292('0x1b')]===_0x6292('0x1c')&&typeof _0x215de0[_0x6292('0x1d')]===_0x6292('0x1c');var _0x4127a4=_0x2309db[_0x6292('0x1e')];var _0x3ef714=_0xade4a1?0x0:_0x215de0[_0x6292('0x1b')];var _0xf512f2=_0xade4a1?_0x2309db['count']:_0x215de0[_0x6292('0x1b')]+_0x215de0[_0x6292('0x1d')];var _0x2566f1;if(_0xf512f2>=_0x4127a4){_0xf512f2=_0x4127a4;_0x2566f1=0xc8;}else{_0x2566f1=0xce;}_0x134cba['status'](_0x2566f1);return _0x134cba['set']('Content-Range',_0x3ef714+'-'+_0xf512f2+'/'+_0x4127a4)['json'](_0x2309db);}return null;};}function patchUpdates(_0x207934){return function(_0x1bfb7e){try{jsonpatch[_0x6292('0x1f')](_0x1bfb7e,_0x207934,!![]);}catch(_0x1bd059){return BPromise[_0x6292('0x20')](_0x1bd059);}return _0x1bfb7e[_0x6292('0x21')]();};}function saveUpdates(_0x22e7eb,_0x57f2e5){return function(_0x3b3f29){if(_0x3b3f29){return _0x3b3f29[_0x6292('0x22')](_0x22e7eb)[_0x6292('0x23')](function(_0x32341c){return _0x32341c;});}return null;};}function removeEntity(_0x18d62a,_0x3f8f91){return function(_0x4528c2){if(_0x4528c2){return _0x4528c2[_0x6292('0x24')]()[_0x6292('0x23')](function(){var _0x519152=_0x4528c2[_0x6292('0x25')]({'plain':!![]});var _0x3ad30f='CustomDashboards';return db[_0x6292('0x26')][_0x6292('0x24')]({'where':{'type':_0x3ad30f,'resourceId':_0x519152['id']}})['then'](function(){return _0x4528c2;});})[_0x6292('0x23')](function(){_0x18d62a[_0x6292('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x486809,_0x25ce38){return function(_0x341664){if(!_0x341664){_0x486809[_0x6292('0x18')](0x194);}return _0x341664;};}function handleError(_0x39e727,_0x195556){_0x195556=_0x195556||0x1f4;return function(_0x3084cb){logger[_0x6292('0x27')](_0x3084cb['stack']);if(_0x3084cb[_0x6292('0x28')]){delete _0x3084cb['name'];}_0x39e727[_0x6292('0x19')](_0x195556)[_0x6292('0x29')](_0x3084cb);};}exports[_0x6292('0x2a')]=function(_0x50e362,_0x4e6808){var _0x55be09={},_0xeabb08={},_0x3305a2={'count':0x0,'rows':[]};var _0x375bcd=_['map'](db[_0x6292('0x2b')]['rawAttributes'],function(_0x451760){return{'name':_0x451760['fieldName'],'type':_0x451760[_0x6292('0x2c')]['key']};});_0xeabb08[_0x6292('0x2d')]=_[_0x6292('0x2e')](_0x375bcd,_0x6292('0x28'));_0xeabb08[_0x6292('0x2f')]=_[_0x6292('0x30')](_0x50e362[_0x6292('0x2f')]);_0xeabb08[_0x6292('0x31')]=_[_0x6292('0x32')](_0xeabb08[_0x6292('0x2d')],_0xeabb08[_0x6292('0x2f')]);_0x55be09[_0x6292('0x33')]=_[_0x6292('0x32')](_0xeabb08[_0x6292('0x2d')],qs[_0x6292('0x34')](_0x50e362[_0x6292('0x2f')]['fields']));_0x55be09[_0x6292('0x33')]=_0x55be09['attributes'][_0x6292('0x35')]?_0x55be09['attributes']:_0xeabb08['model'];if(!_0x50e362[_0x6292('0x2f')][_0x6292('0x36')](_0x6292('0x37'))){_0x55be09[_0x6292('0x1d')]=qs['limit'](_0x50e362[_0x6292('0x2f')][_0x6292('0x1d')]);_0x55be09[_0x6292('0x1b')]=qs[_0x6292('0x1b')](_0x50e362[_0x6292('0x2f')][_0x6292('0x1b')]);}_0x55be09[_0x6292('0x38')]=qs[_0x6292('0x39')](_0x50e362[_0x6292('0x2f')][_0x6292('0x39')]);_0x55be09[_0x6292('0x3a')]=qs['filters'](_[_0x6292('0x3b')](_0x50e362['query'],_0xeabb08[_0x6292('0x31')]),_0x375bcd);if(_0x50e362[_0x6292('0x2f')][_0x6292('0x3c')]){_0x55be09['where']=_[_0x6292('0x3d')](_0x55be09['where'],{'$or':_['map'](_0x375bcd,function(_0x2b48b2){if(_0x2b48b2[_0x6292('0x2c')]!=='VIRTUAL'){var _0x34b2f9={};_0x34b2f9[_0x2b48b2[_0x6292('0x28')]]={'$like':'%'+_0x50e362[_0x6292('0x2f')][_0x6292('0x3c')]+'%'};return _0x34b2f9;}})});}_0x55be09=_[_0x6292('0x3d')]({},_0x55be09,_0x50e362['options']);var _0x193add={'where':_0x55be09[_0x6292('0x3a')]};return db[_0x6292('0x2b')][_0x6292('0x1e')](_0x193add)[_0x6292('0x23')](function(_0x3c4f7c){_0x3305a2[_0x6292('0x1e')]=_0x3c4f7c;if(_0x50e362[_0x6292('0x2f')]['includeAll']){_0x55be09[_0x6292('0x3e')]=[{'all':!![]}];}return db[_0x6292('0x2b')][_0x6292('0x3f')](_0x55be09);})[_0x6292('0x23')](function(_0x2bb4f2){_0x3305a2[_0x6292('0x40')]=_0x2bb4f2;return _0x3305a2;})[_0x6292('0x23')](respondWithFilteredResult(_0x4e6808,_0x55be09))[_0x6292('0x41')](handleError(_0x4e6808,null));};exports[_0x6292('0x42')]=function(_0x3341d7,_0x1bf94d){var _0x23407d={'raw':![],'where':{'id':_0x3341d7[_0x6292('0x43')]['id']}},_0xd0dfd4={};_0xd0dfd4[_0x6292('0x2d')]=_['keys'](db[_0x6292('0x2b')][_0x6292('0x44')]);_0xd0dfd4[_0x6292('0x2f')]=_[_0x6292('0x30')](_0x3341d7[_0x6292('0x2f')]);_0xd0dfd4[_0x6292('0x31')]=_[_0x6292('0x32')](_0xd0dfd4[_0x6292('0x2d')],_0xd0dfd4[_0x6292('0x2f')]);_0x23407d[_0x6292('0x33')]=_[_0x6292('0x32')](_0xd0dfd4[_0x6292('0x2d')],qs['fields'](_0x3341d7[_0x6292('0x2f')][_0x6292('0x34')]));_0x23407d[_0x6292('0x33')]=_0x23407d[_0x6292('0x33')][_0x6292('0x35')]?_0x23407d[_0x6292('0x33')]:_0xd0dfd4['model'];if(_0x3341d7[_0x6292('0x2f')][_0x6292('0x45')]){_0x23407d[_0x6292('0x3e')]=[{'all':!![]}];}_0x23407d=_[_0x6292('0x3d')]({},_0x23407d,_0x3341d7[_0x6292('0x46')]);return db[_0x6292('0x2b')]['find'](_0x23407d)[_0x6292('0x23')](handleEntityNotFound(_0x1bf94d,null))[_0x6292('0x23')](respondWithResult(_0x1bf94d,null))['catch'](handleError(_0x1bf94d,null));};exports[_0x6292('0x47')]=function(_0x2a2cbc,_0x2eeac3){return db['Dashboard'][_0x6292('0x47')](_0x2a2cbc[_0x6292('0x48')],{})[_0x6292('0x23')](function(_0x422dbb){var _0x174417=_0x2a2cbc['user'][_0x6292('0x25')]({'plain':!![]});if(!_0x174417)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174417[_0x6292('0x49')]===_0x6292('0x4a')){var _0x5118aa=_0x422dbb['get']({'plain':!![]});var _0x54e3cd=_0x6292('0x4b');return db[_0x6292('0x4c')][_0x6292('0x4d')]({'where':{'name':_0x54e3cd,'userProfileId':_0x174417[_0x6292('0x4e')]},'raw':!![]})[_0x6292('0x23')](function(_0x46dabc){if(_0x46dabc&&_0x46dabc[_0x6292('0x4f')]===0x0){return db[_0x6292('0x26')]['create']({'name':_0x5118aa[_0x6292('0x28')],'resourceId':_0x5118aa['id'],'type':_0x46dabc['name'],'sectionId':_0x46dabc['id']},{})[_0x6292('0x23')](function(){return _0x422dbb;});}else{return _0x422dbb;}})[_0x6292('0x41')](function(_0xc6982f){logger[_0x6292('0x27')](_0x6292('0x50'),_0xc6982f);throw _0xc6982f;});}return _0x422dbb;})[_0x6292('0x23')](respondWithResult(_0x2eeac3,0xc9))[_0x6292('0x41')](handleError(_0x2eeac3,null));};exports['clone']=function(_0x4fd94c,_0x553ce2){var _0x1dece2={'where':{'id':_0x4fd94c[_0x6292('0x43')]['id']}},_0x3560c4={};_0x3560c4[_0x6292('0x2d')]=_[_0x6292('0x30')](db[_0x6292('0x2b')][_0x6292('0x44')]);_0x1dece2['attributes']=_['intersection'](_0x3560c4[_0x6292('0x2d')],qs[_0x6292('0x34')](_0x4fd94c[_0x6292('0x2f')]['fields']));_0x1dece2[_0x6292('0x33')]=_0x1dece2[_0x6292('0x33')][_0x6292('0x35')]?_0x1dece2[_0x6292('0x33')]:_0x3560c4[_0x6292('0x2d')];if(_0x4fd94c[_0x6292('0x2f')][_0x6292('0x45')]){_0x1dece2[_0x6292('0x3e')]=[{'all':!![]}];}_0x1dece2=_[_0x6292('0x3d')]({},_0x1dece2,_0x4fd94c['options']);return db[_0x6292('0x2b')][_0x6292('0x4d')](_0x1dece2)[_0x6292('0x23')](handleEntityNotFound(_0x553ce2,null))[_0x6292('0x23')](function(_0x1bbceb){if(_0x1bbceb){var _0x3f69f1=_0x1bbceb[_0x6292('0x25')]({'plain':!![]});_0x3f69f1=qs[_0x6292('0x51')](_0x3f69f1,['id',_0x6292('0x52'),_0x6292('0x53')]);_0x4fd94c['body']=_[_0x6292('0x51')](_0x4fd94c[_0x6292('0x48')],['id',_0x6292('0x52'),'updatedAt']);return db[_0x6292('0x2b')][_0x6292('0x47')](_[_0x6292('0x3d')](_0x3f69f1,_0x4fd94c[_0x6292('0x48')]),{'include':_0x4fd94c[_0x6292('0x2f')][_0x6292('0x45')]?[{'all':!![]}]:undefined})[_0x6292('0x23')](function(_0x3f5874){var _0x255429=_0x4fd94c[_0x6292('0x4a')]['get']({'plain':!![]});if(!_0x255429)throw new Error(_0x6292('0x54'));if(_0x255429['role']===_0x6292('0x4a')){var _0x43eeea=_0x3f5874['get']({'plain':!![]});var _0x358256=_0x6292('0x4b');return db['UserProfileSection'][_0x6292('0x4d')]({'where':{'name':_0x358256,'userProfileId':_0x255429[_0x6292('0x4e')]},'raw':!![]})[_0x6292('0x23')](function(_0x45b3ce){if(_0x45b3ce&&_0x45b3ce[_0x6292('0x4f')]===0x0){return db[_0x6292('0x26')]['create']({'name':_0x43eeea[_0x6292('0x28')],'resourceId':_0x43eeea['id'],'type':_0x45b3ce[_0x6292('0x28')],'sectionId':_0x45b3ce['id']},{})['then'](function(){return _0x3f5874;});}else{return _0x3f5874;}})[_0x6292('0x41')](function(_0x5b4f8a){logger[_0x6292('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b4f8a);throw _0x5b4f8a;});}return _0x3f5874;});}})['then'](respondWithResult(_0x553ce2,0xc9))[_0x6292('0x41')](handleError(_0x553ce2,null));};exports[_0x6292('0x22')]=function(_0x5303f1,_0x4586b8){if(_0x5303f1[_0x6292('0x48')]['id']){delete _0x5303f1['body']['id'];}return db[_0x6292('0x2b')]['find']({'where':{'id':_0x5303f1[_0x6292('0x43')]['id']}})[_0x6292('0x23')](handleEntityNotFound(_0x4586b8,null))['then'](saveUpdates(_0x5303f1[_0x6292('0x48')],null))[_0x6292('0x23')](respondWithResult(_0x4586b8,null))['catch'](handleError(_0x4586b8,null));};exports[_0x6292('0x24')]=function(_0x585e4b,_0x44c462){return db[_0x6292('0x2b')][_0x6292('0x4d')]({'where':{'id':_0x585e4b[_0x6292('0x43')]['id']}})[_0x6292('0x23')](handleEntityNotFound(_0x44c462,null))[_0x6292('0x23')](removeEntity(_0x44c462,null))[_0x6292('0x41')](handleError(_0x44c462,null));};function widgetAttributes(_0x4117b0){try{switch(_0x4117b0[_0x6292('0x2c')]){case _0x6292('0x55'):return[{'name':_0x6292('0x56'),'value':_0x4117b0[_0x6292('0x56')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0['attrs'][0x0]?_0x4117b0[_0x6292('0x57')][0x0][_0x6292('0x58')]:undefined)||_0x6292('0x59')}];case'custom':return[{'name':'attrPath','value':_0x4117b0[_0x6292('0x5a')]||(_0x4117b0['attrs']&&_0x4117b0[_0x6292('0x57')][0x0]?_0x4117b0[_0x6292('0x57')][0x0][_0x6292('0x58')]:undefined)||''}];case _0x6292('0x5b'):return[{'name':_0x6292('0x5c'),'value':_0x4117b0['attrHourFormat']||(_0x4117b0['attrs']&&_0x4117b0[_0x6292('0x57')][0x0]?_0x4117b0['attrs'][0x0]['value']:undefined)||_0x6292('0x5d')},{'name':'attrTimezone','value':_0x4117b0[_0x6292('0x5e')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0[_0x6292('0x57')][0x1]?_0x4117b0[_0x6292('0x57')][0x1][_0x6292('0x58')]:undefined)||'0.00'},{'name':_0x6292('0x5f'),'value':_0x4117b0['attrFontSize']||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0[_0x6292('0x57')][0x2]?_0x4117b0[_0x6292('0x57')][0x2][_0x6292('0x58')]:undefined)||0xc}];case _0x6292('0x60'):return[{'name':_0x6292('0x61'),'value':_0x4117b0['attrMetric']||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0[_0x6292('0x57')][0x0]?_0x4117b0[_0x6292('0x57')][0x0][_0x6292('0x58')]:undefined)||_0x6292('0x62')},{'name':_0x6292('0x63'),'value':_0x4117b0[_0x6292('0x63')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0[_0x6292('0x57')][0x1]?_0x4117b0[_0x6292('0x57')][0x1]['value']:undefined)||[]},{'name':_0x6292('0x5f'),'value':_0x4117b0[_0x6292('0x5f')]||(_0x4117b0['attrs']&&_0x4117b0[_0x6292('0x57')][0x2]?_0x4117b0[_0x6292('0x57')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x6292('0x64'):return[{'name':_0x6292('0x65'),'value':_0x4117b0[_0x6292('0x65')]||(_0x4117b0['attrs']&&_0x4117b0[_0x6292('0x57')][0x0]?_0x4117b0[_0x6292('0x57')][0x0][_0x6292('0x58')]:undefined)||_0x6292('0x62')},{'name':_0x6292('0x66'),'value':_0x4117b0[_0x6292('0x66')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0[_0x6292('0x57')][0x1]?_0x4117b0[_0x6292('0x57')][0x1][_0x6292('0x58')]:undefined)||null},{'name':_0x6292('0x67'),'value':_0x4117b0[_0x6292('0x67')]||(_0x4117b0['attrs']&&_0x4117b0[_0x6292('0x57')][0x2]?_0x4117b0[_0x6292('0x57')][0x2]['value']:undefined)||null},{'name':_0x6292('0x63'),'value':_0x4117b0[_0x6292('0x63')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0['attrs'][0x3]?_0x4117b0[_0x6292('0x57')][0x3]['value']:undefined)||[]}];case _0x6292('0x68'):return[{'name':_0x6292('0x69'),'type':_0x4117b0[_0x6292('0x6a')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0[_0x6292('0x57')][0x0]?_0x4117b0[_0x6292('0x57')][0x0][_0x6292('0x2c')]:undefined)||null,'value':_0x4117b0[_0x6292('0x69')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0[_0x6292('0x57')][0x0]?_0x4117b0['attrs'][0x0][_0x6292('0x58')]:undefined)||null},{'name':_0x6292('0x6b'),'value':_0x4117b0[_0x6292('0x6b')]||(_0x4117b0[_0x6292('0x57')]&&_0x4117b0['attrs'][0x1]?_0x4117b0[_0x6292('0x57')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x23f18c){logger[_0x6292('0x27')]('widgetAttributes:\x20%s',JSON[_0x6292('0x6c')](_0x23f18c));return[];}}exports[_0x6292('0x6d')]=function(_0x59acfa,_0x2dd41,_0x48fe9b){if(_0x59acfa[_0x6292('0x48')]['id']){delete _0x59acfa[_0x6292('0x48')]['id'];}return db[_0x6292('0x2b')][_0x6292('0x4d')]({'where':{'id':_0x59acfa[_0x6292('0x43')]['id']}})[_0x6292('0x23')](handleEntityNotFound(_0x2dd41,null))['then'](function(_0x3d944d){if(_0x3d944d){_0x59acfa[_0x6292('0x48')]['DashboardId']=_0x3d944d['id'];_0x59acfa[_0x6292('0x48')][_0x6292('0x57')]=widgetAttributes(_0x59acfa['body']);return db[_0x6292('0x6e')]['create'](_0x59acfa[_0x6292('0x48')]);}})[_0x6292('0x23')](respondWithResult(_0x2dd41,null))[_0x6292('0x41')](handleError(_0x2dd41,null));};exports['getItems']=function(_0x250af6,_0x916ff6,_0x4466b4){var _0x54547a={};var _0x374a78={};var _0x2d3b28;var _0x53df9d;return db[_0x6292('0x2b')]['findOne']({'where':{'id':_0x250af6['params']['id']}})['then'](handleEntityNotFound(_0x916ff6,null))[_0x6292('0x23')](function(_0x3daa10){if(_0x3daa10){_0x2d3b28=_0x3daa10;_0x374a78['model']=_[_0x6292('0x30')](db[_0x6292('0x6e')][_0x6292('0x44')]);_0x374a78['query']=_[_0x6292('0x30')](_0x250af6[_0x6292('0x2f')]);_0x374a78[_0x6292('0x31')]=_[_0x6292('0x32')](_0x374a78[_0x6292('0x2d')],_0x374a78['query']);_0x54547a[_0x6292('0x33')]=_[_0x6292('0x32')](_0x374a78[_0x6292('0x2d')],qs['fields'](_0x250af6[_0x6292('0x2f')][_0x6292('0x34')]));_0x54547a[_0x6292('0x33')]=_0x54547a[_0x6292('0x33')][_0x6292('0x35')]?_0x54547a[_0x6292('0x33')]:_0x374a78[_0x6292('0x2d')];_0x54547a[_0x6292('0x38')]=qs[_0x6292('0x39')](_0x250af6[_0x6292('0x2f')]['sort']);_0x54547a[_0x6292('0x3a')]=qs[_0x6292('0x31')](_[_0x6292('0x3b')](_0x250af6[_0x6292('0x2f')],_0x374a78[_0x6292('0x31')]));if(_0x250af6[_0x6292('0x2f')][_0x6292('0x3c')]){_0x54547a[_0x6292('0x3a')]=_[_0x6292('0x3d')](_0x54547a[_0x6292('0x3a')],{'$or':_[_0x6292('0x2e')](_0x54547a['attributes'],function(_0x5aa4c1){var _0x1fb5b1={};_0x1fb5b1[_0x5aa4c1]={'$like':'%'+_0x250af6[_0x6292('0x2f')][_0x6292('0x3c')]+'%'};return _0x1fb5b1;})});}_0x54547a=_['merge']({},_0x54547a,_0x250af6[_0x6292('0x46')]);return _0x2d3b28[_0x6292('0x6f')](_0x54547a);}})['then'](function(_0x576922){if(_0x576922){_0x53df9d=_0x576922[_0x6292('0x35')];if(!_0x250af6['query'][_0x6292('0x36')](_0x6292('0x37'))){_0x54547a['limit']=qs[_0x6292('0x1d')](_0x250af6[_0x6292('0x2f')]['limit']);_0x54547a[_0x6292('0x1b')]=qs[_0x6292('0x1b')](_0x250af6[_0x6292('0x2f')][_0x6292('0x1b')]);}return _0x2d3b28[_0x6292('0x6f')](_0x54547a);}})[_0x6292('0x23')](function(_0x312c66){if(_0x312c66){return _0x312c66?{'count':_0x53df9d,'rows':_0x312c66}:null;}})['then'](respondWithResult(_0x916ff6,null))[_0x6292('0x41')](handleError(_0x916ff6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 9211414..f97538d 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 _0x598a=['exports','events','Dashboard','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x41ab68,_0x3e806f){var _0x134b6c=function(_0x4c3a80){while(--_0x4c3a80){_0x41ab68['push'](_0x41ab68['shift']());}};_0x134b6c(++_0x3e806f);}(_0x598a,0x99));var _0xa598=function(_0x952584,_0x1941aa){_0x952584=_0x952584-0x0;var _0x5ba126=_0x598a[_0x952584];return _0x5ba126;};'use strict';var EventEmitter=require(_0xa598('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xa598('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa598('0x2')](0x0);var events={'afterCreate':_0xa598('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x52701e){return function(_0xa59ef0,_0x5d32de,_0x154070){DashboardEvents[_0xa598('0x4')](_0x52701e+':'+_0xa59ef0['id'],_0xa59ef0);DashboardEvents[_0xa598('0x4')](_0x52701e,_0xa59ef0);_0x154070(null);};}for(var e in events){if(events[_0xa598('0x5')](e)){var event=events[e];Dashboard[_0xa598('0x6')](e,emitEvent(event));}}module[_0xa598('0x7')]=DashboardEvents; \ No newline at end of file +var _0x0eb2=['update','remove','emit','hasOwnProperty','hook','events','Dashboard','setMaxListeners','save'];(function(_0x33fe04,_0x5d5377){var _0x5413f5=function(_0x31b1ab){while(--_0x31b1ab){_0x33fe04['push'](_0x33fe04['shift']());}};_0x5413f5(++_0x5d5377);}(_0x0eb2,0x11c));var _0x20eb=function(_0x56e6d3,_0x5bb066){_0x56e6d3=_0x56e6d3-0x0;var _0x3e9763=_0x0eb2[_0x56e6d3];return _0x3e9763;};'use strict';var EventEmitter=require(_0x20eb('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x20eb('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x20eb('0x2')](0x0);var events={'afterCreate':_0x20eb('0x3'),'afterUpdate':_0x20eb('0x4'),'afterDestroy':_0x20eb('0x5')};function emitEvent(_0x525ecf){return function(_0x118292,_0x59e891,_0x48d831){DashboardEvents['emit'](_0x525ecf+':'+_0x118292['id'],_0x118292);DashboardEvents[_0x20eb('0x6')](_0x525ecf,_0x118292);_0x48d831(null);};}for(var e in events){if(events[_0x20eb('0x7')](e)){var event=events[e];Dashboard[_0x20eb('0x8')](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 e027933..8ca1041 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 _0xf806=['Dashboard','dashboards','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./dashboard.attributes','define'];(function(_0x37a1c1,_0x2ec29e){var _0x3f359a=function(_0x6dd317){while(--_0x6dd317){_0x37a1c1['push'](_0x37a1c1['shift']());}};_0x3f359a(++_0x2ec29e);}(_0xf806,0x1e6));var _0x6f80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf806[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6f80('0x0'));var util=require(_0x6f80('0x1'));var logger=require(_0x6f80('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6f80('0x3'));var rp=require(_0x6f80('0x4'));var fs=require('fs');var path=require(_0x6f80('0x5'));var rimraf=require(_0x6f80('0x6'));var config=require('../../config/environment');var attributes=require(_0x6f80('0x7'));module['exports']=function(_0x1d7bd0,_0x429d52){return _0x1d7bd0[_0x6f80('0x8')](_0x6f80('0x9'),attributes,{'tableName':_0x6f80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31af=['rimraf','../../config/environment','exports','define','Dashboard','dashboards','lodash','api','moment','bluebird','path'];(function(_0x2b9baa,_0x287965){var _0x4449ae=function(_0x4a643c){while(--_0x4a643c){_0x2b9baa['push'](_0x2b9baa['shift']());}};_0x4449ae(++_0x287965);}(_0x31af,0x7f));var _0xf31a=function(_0xb6bf01,_0x482a88){_0xb6bf01=_0xb6bf01-0x0;var _0x158017=_0x31af[_0xb6bf01];return _0x158017;};'use strict';var _=require(_0xf31a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));var BPromise=require(_0xf31a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf31a('0x4'));var rimraf=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var attributes=require('./dashboard.attributes');module[_0xf31a('0x7')]=function(_0x5b56de,_0x25b5c5){return _0x5b56de[_0xf31a('0x8')](_0xf31a('0x9'),attributes,{'tableName':_0xf31a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index af509a3..a99abaf 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 _0xb383=['defaults','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis'];(function(_0x1e215a,_0x41fc9a){var _0x18d22a=function(_0x59c683){while(--_0x59c683){_0x1e215a['push'](_0x1e215a['shift']());}};_0x18d22a(++_0x41fc9a);}(_0xb383,0x87));var _0x3b38=function(_0x3b0bb5,_0x50f5d7){_0x3b0bb5=_0x3b0bb5-0x0;var _0x2193e7=_0xb383[_0x3b0bb5];return _0x2193e7;};'use strict';var _=require(_0x3b38('0x0'));var util=require(_0x3b38('0x1'));var moment=require('moment');var BPromise=require(_0x3b38('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b38('0x3'));var db=require(_0x3b38('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b38('0x5'));var config=require(_0x3b38('0x6'));var jayson=require(_0x3b38('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x3b38('0x8')]=_[_0x3b38('0x9')](config['redis'],{'host':_0x3b38('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b38('0x8')]));require(_0x3b38('0xb'))['register'](socket);function respondWithRpcPromise(_0x216945,_0x490db0,_0x1d3b38){return new BPromise(function(_0x7f4e,_0x1bf074){return client[_0x3b38('0xc')](_0x216945,_0x1d3b38)[_0x3b38('0xd')](function(_0x1cad09){logger[_0x3b38('0xe')]('Dashboard,\x20%s,\x20%s',_0x490db0,'request\x20sent');logger['debug'](_0x3b38('0xf'),_0x490db0,_0x3b38('0x10'),JSON[_0x3b38('0x11')](_0x1cad09));if(_0x1cad09['error']){if(_0x1cad09[_0x3b38('0x12')][_0x3b38('0x13')]===0x1f4){logger[_0x3b38('0x12')](_0x3b38('0x14'),_0x490db0,_0x1cad09[_0x3b38('0x12')][_0x3b38('0x15')]);return _0x1bf074(_0x1cad09[_0x3b38('0x12')][_0x3b38('0x15')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x490db0,_0x1cad09[_0x3b38('0x12')][_0x3b38('0x15')]);return _0x7f4e(_0x1cad09[_0x3b38('0x12')][_0x3b38('0x15')]);}else{logger[_0x3b38('0xe')]('Dashboard,\x20%s,\x20%s',_0x490db0,'request\x20sent');_0x7f4e(_0x1cad09[_0x3b38('0x16')]['message']);}})[_0x3b38('0x17')](function(_0x1047c8){logger[_0x3b38('0x12')]('Dashboard,\x20%s,\x20%s',_0x490db0,_0x1047c8);_0x1bf074(_0x1047c8);});});} \ No newline at end of file +var _0x6033=['then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x6033,0xe1));var _0x3603=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6033[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3603('0x0'));var util=require('util');var moment=require(_0x3603('0x1'));var BPromise=require(_0x3603('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3603('0x3'))['db'];var utils=require(_0x3603('0x4'));var logger=require(_0x3603('0x5'))(_0x3603('0x6'));var config=require(_0x3603('0x7'));var jayson=require(_0x3603('0x8'));var client=jayson[_0x3603('0x9')][_0x3603('0xa')]({'port':0x232a});config[_0x3603('0xb')]=_[_0x3603('0xc')](config[_0x3603('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3603('0xb')]));require('./dashboard.socket')[_0x3603('0xd')](socket);function respondWithRpcPromise(_0x428e19,_0xad53bd,_0x451e36){return new BPromise(function(_0x335b20,_0x5fe729){return client[_0x3603('0xe')](_0x428e19,_0x451e36)[_0x3603('0xf')](function(_0x5dd200){logger['info'](_0x3603('0x10'),_0xad53bd,_0x3603('0x11'));logger[_0x3603('0x12')](_0x3603('0x13'),_0xad53bd,_0x3603('0x11'),JSON[_0x3603('0x14')](_0x5dd200));if(_0x5dd200[_0x3603('0x15')]){if(_0x5dd200[_0x3603('0x15')][_0x3603('0x16')]===0x1f4){logger[_0x3603('0x15')](_0x3603('0x10'),_0xad53bd,_0x5dd200['error'][_0x3603('0x17')]);return _0x5fe729(_0x5dd200[_0x3603('0x15')][_0x3603('0x17')]);}logger[_0x3603('0x15')]('Dashboard,\x20%s,\x20%s',_0xad53bd,_0x5dd200[_0x3603('0x15')][_0x3603('0x17')]);return _0x335b20(_0x5dd200[_0x3603('0x15')][_0x3603('0x17')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0xad53bd,_0x3603('0x11'));_0x335b20(_0x5dd200['result']['message']);}})['catch'](function(_0x2af56a){logger[_0x3603('0x15')](_0x3603('0x10'),_0xad53bd,_0x2af56a);_0x5fe729(_0x2af56a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 07f3c0f..0d552ec 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 _0xcc42=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x47ed36,_0x54acd8){var _0x21323d=function(_0x3f87c1){while(--_0x3f87c1){_0x47ed36['push'](_0x47ed36['shift']());}};_0x21323d(++_0x54acd8);}(_0xcc42,0x1bd));var _0x2cc4=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xcc42[_0x4ff09b];return _0x3f5c2e;};'use strict';var DashboardEvents=require(_0x2cc4('0x0'));var events=[_0x2cc4('0x1'),_0x2cc4('0x2'),'update'];function createListener(_0x488a34,_0x2916ea){return function(_0x12d653){_0x2916ea[_0x2cc4('0x3')](_0x488a34,_0x12d653);};}function removeListener(_0x32c703,_0x28caa7){return function(){DashboardEvents[_0x2cc4('0x4')](_0x32c703,_0x28caa7);};}exports[_0x2cc4('0x5')]=function(_0x2133a4){for(var _0x1675b7=0x0,_0x36ee30=events[_0x2cc4('0x6')];_0x1675b7<_0x36ee30;_0x1675b7++){var _0x1d5c9a=events[_0x1675b7];var _0x229bee=createListener(_0x2cc4('0x7')+_0x1d5c9a,_0x2133a4);DashboardEvents['on'](_0x1d5c9a,_0x229bee);}}; \ No newline at end of file +var _0x9b84=['remove','update','removeListener','register','./dashboard.events','save'];(function(_0xe2fab5,_0x15ac7f){var _0x4cdafd=function(_0x160733){while(--_0x160733){_0xe2fab5['push'](_0xe2fab5['shift']());}};_0x4cdafd(++_0x15ac7f);}(_0x9b84,0x10c));var _0x49b8=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x9b84[_0x28407a];return _0x8bd6ef;};'use strict';var DashboardEvents=require(_0x49b8('0x0'));var events=[_0x49b8('0x1'),_0x49b8('0x2'),_0x49b8('0x3')];function createListener(_0xc1039f,_0xe9f3d6){return function(_0x4e93e5){_0xe9f3d6['emit'](_0xc1039f,_0x4e93e5);};}function removeListener(_0x522056,_0x1f124c){return function(){DashboardEvents[_0x49b8('0x4')](_0x522056,_0x1f124c);};}exports[_0x49b8('0x5')]=function(_0xf42c97){for(var _0x33f1f2=0x0,_0xd06b84=events['length'];_0x33f1f2<_0xd06b84;_0x33f1f2++){var _0x9a0829=events[_0x33f1f2];var _0x40089d=createListener('dashboard:'+_0x9a0829,_0xf42c97);DashboardEvents['on'](_0x9a0829,_0x40089d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index c8c35a6..37a1184 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 _0x0f7d=['post','create','/:id/clone','clone','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','/:id','get','/:id/items'];(function(_0x39ddc1,_0x35e0aa){var _0x2fdbef=function(_0x31e132){while(--_0x31e132){_0x39ddc1['push'](_0x39ddc1['shift']());}};_0x2fdbef(++_0x35e0aa);}(_0x0f7d,0x9b));var _0xd0f7=function(_0x53cfb9,_0x10bfb6){_0x53cfb9=_0x53cfb9-0x0;var _0x5072c7=_0x0f7d[_0x53cfb9];return _0x5072c7;};'use strict';var multer=require(_0xd0f7('0x0'));var util=require(_0xd0f7('0x1'));var path=require(_0xd0f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0f7('0x3'));var router=express[_0xd0f7('0x4')]();var fs_extra=require(_0xd0f7('0x5'));var auth=require(_0xd0f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0f7('0x7'));var controller=require(_0xd0f7('0x8'));router['get']('/',auth[_0xd0f7('0x9')](),controller['index']);router['get'](_0xd0f7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd0f7('0xb')](_0xd0f7('0xc'),auth[_0xd0f7('0x9')](),controller['getItems']);router[_0xd0f7('0xd')]('/',auth['isAuthenticated'](),controller[_0xd0f7('0xe')]);router[_0xd0f7('0xd')](_0xd0f7('0xf'),auth[_0xd0f7('0x9')](),controller[_0xd0f7('0x10')]);router[_0xd0f7('0xd')](_0xd0f7('0xc'),auth[_0xd0f7('0x9')](),controller['addItem']);router['put'](_0xd0f7('0xa'),auth[_0xd0f7('0x9')](),controller[_0xd0f7('0x11')]);router[_0xd0f7('0x12')](_0xd0f7('0xa'),auth['isAuthenticated'](),controller[_0xd0f7('0x13')]);module[_0xd0f7('0x14')]=router; \ No newline at end of file +var _0xe529=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','delete','destroy','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x44446f,_0x4c5598){var _0x227c30=function(_0x14d731){while(--_0x14d731){_0x44446f['push'](_0x44446f['shift']());}};_0x227c30(++_0x4c5598);}(_0xe529,0x19c));var _0x9e52=function(_0x53fb43,_0x223a27){_0x53fb43=_0x53fb43-0x0;var _0x35ca6e=_0xe529[_0x53fb43];return _0x35ca6e;};'use strict';var multer=require('multer');var util=require(_0x9e52('0x0'));var path=require('path');var timeout=require(_0x9e52('0x1'));var express=require(_0x9e52('0x2'));var router=express[_0x9e52('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9e52('0x4'));var config=require(_0x9e52('0x5'));var controller=require(_0x9e52('0x6'));router[_0x9e52('0x7')]('/',auth[_0x9e52('0x8')](),controller[_0x9e52('0x9')]);router[_0x9e52('0x7')](_0x9e52('0xa'),auth[_0x9e52('0x8')](),controller[_0x9e52('0xb')]);router[_0x9e52('0x7')](_0x9e52('0xc'),auth[_0x9e52('0x8')](),controller[_0x9e52('0xd')]);router[_0x9e52('0xe')]('/',auth['isAuthenticated'](),controller[_0x9e52('0xf')]);router[_0x9e52('0xe')](_0x9e52('0x10'),auth['isAuthenticated'](),controller[_0x9e52('0x11')]);router[_0x9e52('0xe')](_0x9e52('0xc'),auth[_0x9e52('0x8')](),controller[_0x9e52('0x12')]);router[_0x9e52('0x13')]('/:id',auth[_0x9e52('0x8')](),controller['update']);router[_0x9e52('0x14')]('/:id',auth[_0x9e52('0x8')](),controller[_0x9e52('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3166541..08982cf 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 _0x53ec=['getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','long'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x53ec,0x192));var _0xc53e=function(_0x238bce,_0x1fa37a){_0x238bce=_0x238bce-0x0;var _0x127fc9=_0x53ec[_0x238bce];return _0x127fc9;};'use strict';var Sequelize=require(_0xc53e('0x0'));var squel=require(_0xc53e('0x1'));var _=require(_0xc53e('0x2'));module[_0xc53e('0x3')]={'title':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xc53e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xc53e('0x5')),'get':function(){try{return JSON['parse'](this[_0xc53e('0x6')](_0xc53e('0x7')));}catch(_0x4a9c59){return[];}},'set':function(_0x2f1414){try{this['setDataValue'](_0xc53e('0x7'),JSON[_0xc53e('0x8')](_0x2f1414));}catch(_0x5d3b28){this[_0xc53e('0x9')](_0xc53e('0x7'),JSON[_0xc53e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xc53e('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xc53e('0xa')]},'col':{'type':Sequelize[_0xc53e('0xa')]},'background':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![],'defaultValue':_0xc53e('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xc53e('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xadb5=['long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','exports','STRING'];(function(_0x3ef448,_0x425199){var _0x4d7ca0=function(_0x1063ab){while(--_0x1063ab){_0x3ef448['push'](_0x3ef448['shift']());}};_0x4d7ca0(++_0x425199);}(_0xadb5,0xad));var _0x5adb=function(_0x44b5ac,_0xfd0e6b){_0x44b5ac=_0x44b5ac-0x0;var _0x47ed30=_0xadb5[_0x44b5ac];return _0x47ed30;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5adb('0x0'));var _=require('lodash');module[_0x5adb('0x1')]={'title':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5adb('0x3')),'get':function(){try{return JSON[_0x5adb('0x4')](this[_0x5adb('0x5')]('attrs'));}catch(_0x35a5d3){return[];}},'set':function(_0x168d89){try{this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')](_0x168d89));}catch(_0x353885){this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5adb('0x9')]},'col':{'type':Sequelize[_0x5adb('0x9')]},'background':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5adb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5adb('0x2')]},'titleFontSize':{'type':Sequelize[_0x5adb('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index c66ee30..55c3caa 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 _0x0456=['attrSerie2','attrSerie3','attrReport','type','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','offset','undefined','count','json','apply','save','update','then','destroy','end','error','stack','send','show','params','model','keys','query','filters','attributes','intersection','fields','length','includeAll','merge','options','DashboardItem','catch','find','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1'];(function(_0x4630f7,_0x2004ec){var _0x2e2e0e=function(_0x334ab7){while(--_0x334ab7){_0x4630f7['push'](_0x4630f7['shift']());}};_0x2e2e0e(++_0x2004ec);}(_0x0456,0xb8));var _0x6045=function(_0x3abe2a,_0x2e2532){_0x3abe2a=_0x3abe2a-0x0;var _0x130575=_0x0456[_0x3abe2a];return _0x130575;};'use strict';var emlformat=require(_0x6045('0x0'));var rimraf=require(_0x6045('0x1'));var zipdir=require(_0x6045('0x2'));var jsonpatch=require(_0x6045('0x3'));var rp=require(_0x6045('0x4'));var moment=require(_0x6045('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6045('0x6'));var util=require(_0x6045('0x7'));var path=require('path');var sox=require(_0x6045('0x8'));var csv=require('to-csv');var ejs=require(_0x6045('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6045('0xa'));var crypto=require(_0x6045('0xb'));var jsforce=require(_0x6045('0xc'));var deskjs=require(_0x6045('0xd'));var toCsv=require(_0x6045('0xe'));var querystring=require(_0x6045('0xf'));var Papa=require(_0x6045('0x10'));var Redis=require(_0x6045('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6045('0x12'));var as=require(_0x6045('0x13'));var hardwareService=require(_0x6045('0x14'));var logger=require('../../config/logger')(_0x6045('0x15'));var utils=require(_0x6045('0x16'));var config=require(_0x6045('0x17'));var licenseUtil=require(_0x6045('0x18'));var db=require(_0x6045('0x19'))['db'];config[_0x6045('0x1a')]=_[_0x6045('0x1b')](config[_0x6045('0x1a')],{'host':_0x6045('0x1c'),'port':0x18eb});var socket=require(_0x6045('0x1d'))(new Redis(config[_0x6045('0x1a')]));require(_0x6045('0x1e'))[_0x6045('0x1f')](socket);function respondWithStatusCode(_0x4b5b77,_0x45bbfb){_0x45bbfb=_0x45bbfb||0xcc;return function(_0x3ea9e2){if(_0x3ea9e2){return _0x4b5b77[_0x6045('0x20')](_0x45bbfb);}return _0x4b5b77[_0x6045('0x21')](_0x45bbfb)['end']();};}function respondWithResult(_0x11b1ee,_0x4d8292){_0x4d8292=_0x4d8292||0xc8;return function(_0x49a775){if(_0x49a775){return _0x11b1ee[_0x6045('0x21')](_0x4d8292)['json'](_0x49a775);}};}function respondWithFilteredResult(_0xe417d6,_0x36e07b){return function(_0x3e5c41){if(_0x3e5c41){var _0x4c3088=typeof _0x36e07b[_0x6045('0x22')]===_0x6045('0x23')&&typeof _0x36e07b['limit']===_0x6045('0x23');var _0x23775d=_0x3e5c41[_0x6045('0x24')];var _0x2a049d=_0x4c3088?0x0:_0x36e07b[_0x6045('0x22')];var _0x4a7a4b=_0x4c3088?_0x3e5c41['count']:_0x36e07b[_0x6045('0x22')]+_0x36e07b['limit'];var _0x4a8ed7;if(_0x4a7a4b>=_0x23775d){_0x4a7a4b=_0x23775d;_0x4a8ed7=0xc8;}else{_0x4a8ed7=0xce;}_0xe417d6[_0x6045('0x21')](_0x4a8ed7);return _0xe417d6['set']('Content-Range',_0x2a049d+'-'+_0x4a7a4b+'/'+_0x23775d)[_0x6045('0x25')](_0x3e5c41);}return null;};}function patchUpdates(_0x46c82d){return function(_0x300661){try{jsonpatch[_0x6045('0x26')](_0x300661,_0x46c82d,!![]);}catch(_0x30d585){return BPromise['reject'](_0x30d585);}return _0x300661[_0x6045('0x27')]();};}function saveUpdates(_0x29ca98,_0x2f638e){return function(_0xadd510){if(_0xadd510){return _0xadd510[_0x6045('0x28')](_0x29ca98)[_0x6045('0x29')](function(_0xdcedc2){return _0xdcedc2;});}return null;};}function removeEntity(_0x3b44a9,_0x4ec458){return function(_0x7f62b6){if(_0x7f62b6){return _0x7f62b6[_0x6045('0x2a')]()[_0x6045('0x29')](function(){_0x3b44a9[_0x6045('0x21')](0xcc)[_0x6045('0x2b')]();});}};}function handleEntityNotFound(_0x5daae8,_0x1fb040){return function(_0x3fe2b2){if(!_0x3fe2b2){_0x5daae8[_0x6045('0x20')](0x194);}return _0x3fe2b2;};}function handleError(_0x43c6fa,_0x369266){_0x369266=_0x369266||0x1f4;return function(_0x1bad7e){logger[_0x6045('0x2c')](_0x1bad7e[_0x6045('0x2d')]);if(_0x1bad7e['name']){delete _0x1bad7e['name'];}_0x43c6fa[_0x6045('0x21')](_0x369266)[_0x6045('0x2e')](_0x1bad7e);};}exports[_0x6045('0x2f')]=function(_0x1e29fb,_0x54ef33){var _0x4b4cf7={'raw':![],'where':{'id':_0x1e29fb[_0x6045('0x30')]['id']}},_0x2d17b9={};_0x2d17b9[_0x6045('0x31')]=_[_0x6045('0x32')](db['DashboardItem']['rawAttributes']);_0x2d17b9[_0x6045('0x33')]=_[_0x6045('0x32')](_0x1e29fb[_0x6045('0x33')]);_0x2d17b9[_0x6045('0x34')]=_['intersection'](_0x2d17b9[_0x6045('0x31')],_0x2d17b9[_0x6045('0x33')]);_0x4b4cf7[_0x6045('0x35')]=_[_0x6045('0x36')](_0x2d17b9[_0x6045('0x31')],qs[_0x6045('0x37')](_0x1e29fb[_0x6045('0x33')][_0x6045('0x37')]));_0x4b4cf7[_0x6045('0x35')]=_0x4b4cf7[_0x6045('0x35')][_0x6045('0x38')]?_0x4b4cf7[_0x6045('0x35')]:_0x2d17b9[_0x6045('0x31')];if(_0x1e29fb[_0x6045('0x33')][_0x6045('0x39')]){_0x4b4cf7['include']=[{'all':!![]}];}_0x4b4cf7=_[_0x6045('0x3a')]({},_0x4b4cf7,_0x1e29fb[_0x6045('0x3b')]);return db[_0x6045('0x3c')]['find'](_0x4b4cf7)[_0x6045('0x29')](handleEntityNotFound(_0x54ef33,null))[_0x6045('0x29')](respondWithResult(_0x54ef33,null))[_0x6045('0x3d')](handleError(_0x54ef33,null));};exports[_0x6045('0x2a')]=function(_0x4cafa4,_0x351267){return db[_0x6045('0x3c')][_0x6045('0x3e')]({'where':{'id':_0x4cafa4[_0x6045('0x30')]['id']}})[_0x6045('0x29')](handleEntityNotFound(_0x351267,null))['then'](removeEntity(_0x351267,null))['catch'](handleError(_0x351267,null));};function widgetAttributes(_0x1a53e1){try{switch(_0x1a53e1['type']){case _0x6045('0x3f'):return[{'name':_0x6045('0x40'),'value':_0x1a53e1[_0x6045('0x40')]||(_0x1a53e1['attrs']&&_0x1a53e1[_0x6045('0x41')][0x0]?_0x1a53e1['attrs'][0x0][_0x6045('0x42')]:undefined)||_0x6045('0x43')}];case'custom':return[{'name':_0x6045('0x44'),'value':_0x1a53e1['attrPath']||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x0]?_0x1a53e1[_0x6045('0x41')][0x0][_0x6045('0x42')]:undefined)||''}];case _0x6045('0x45'):return[{'name':'attrHourFormat','value':_0x1a53e1[_0x6045('0x46')]||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x0]?_0x1a53e1['attrs'][0x0][_0x6045('0x42')]:undefined)||_0x6045('0x47')},{'name':_0x6045('0x48'),'value':_0x1a53e1['attrTimezone']||(_0x1a53e1['attrs']&&_0x1a53e1[_0x6045('0x41')][0x1]?_0x1a53e1[_0x6045('0x41')][0x1][_0x6045('0x42')]:undefined)||_0x6045('0x49')},{'name':'attrFontSize','value':_0x1a53e1['attrFontSize']||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x2]?_0x1a53e1[_0x6045('0x41')][0x2]['value']:undefined)||0xc}];case _0x6045('0x4a'):return[{'name':_0x6045('0x4b'),'value':_0x1a53e1[_0x6045('0x4b')]||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x0]?_0x1a53e1['attrs'][0x0][_0x6045('0x42')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x1a53e1[_0x6045('0x4c')]||(_0x1a53e1['attrs']&&_0x1a53e1[_0x6045('0x41')][0x1]?_0x1a53e1[_0x6045('0x41')][0x1][_0x6045('0x42')]:undefined)||[]},{'name':_0x6045('0x4d'),'value':_0x1a53e1['attrFontSize']||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x2]?_0x1a53e1['attrs'][0x2][_0x6045('0x42')]:undefined)||0x14}];case'multibar-chart':case _0x6045('0x4e'):return[{'name':_0x6045('0x4f'),'value':_0x1a53e1[_0x6045('0x4f')]||(_0x1a53e1['attrs']&&_0x1a53e1[_0x6045('0x41')][0x0]?_0x1a53e1[_0x6045('0x41')][0x0][_0x6045('0x42')]:undefined)||'total'},{'name':_0x6045('0x50'),'value':_0x1a53e1[_0x6045('0x50')]||(_0x1a53e1['attrs']&&_0x1a53e1[_0x6045('0x41')][0x1]?_0x1a53e1[_0x6045('0x41')][0x1][_0x6045('0x42')]:undefined)||null},{'name':'attrSerie3','value':_0x1a53e1[_0x6045('0x51')]||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x2]?_0x1a53e1[_0x6045('0x41')][0x2][_0x6045('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1a53e1['attrVoiceQueues']||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x3]?_0x1a53e1[_0x6045('0x41')][0x3][_0x6045('0x42')]:undefined)||[]}];case'web-report':return[{'name':_0x6045('0x52'),'type':_0x1a53e1['reportType']||(_0x1a53e1['attrs']&&_0x1a53e1[_0x6045('0x41')][0x0]?_0x1a53e1[_0x6045('0x41')][0x0][_0x6045('0x53')]:undefined)||null,'value':_0x1a53e1['attrReport']||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1[_0x6045('0x41')][0x0]?_0x1a53e1[_0x6045('0x41')][0x0][_0x6045('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x1a53e1[_0x6045('0x54')]||(_0x1a53e1[_0x6045('0x41')]&&_0x1a53e1['attrs'][0x1]?_0x1a53e1[_0x6045('0x41')][0x1][_0x6045('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x472f71){logger['error'](_0x6045('0x55'),JSON['stringify'](_0x472f71));return[];}}exports[_0x6045('0x56')]=function(_0x3e5389,_0x1da46e){if(_0x3e5389['body']){_0x3e5389[_0x6045('0x57')][_0x6045('0x41')]=widgetAttributes(_0x3e5389[_0x6045('0x57')]);}return db[_0x6045('0x3c')]['create'](_0x3e5389[_0x6045('0x57')],{})[_0x6045('0x29')](respondWithResult(_0x1da46e,0xc9))[_0x6045('0x3d')](handleError(_0x1da46e,null));};exports[_0x6045('0x28')]=function(_0x29c818,_0x3a1f71){if(_0x29c818[_0x6045('0x57')]['id']){delete _0x29c818[_0x6045('0x57')]['id'];}_0x29c818[_0x6045('0x57')]['attrs']=widgetAttributes(_0x29c818[_0x6045('0x57')]);return db[_0x6045('0x3c')][_0x6045('0x3e')]({'where':{'id':_0x29c818[_0x6045('0x30')]['id']}})[_0x6045('0x29')](handleEntityNotFound(_0x3a1f71,null))[_0x6045('0x29')](saveUpdates(_0x29c818['body'],null))[_0x6045('0x29')](respondWithResult(_0x3a1f71,null))[_0x6045('0x3d')](handleError(_0x3a1f71,null));}; \ No newline at end of file +var _0xdd51=['defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','destroy','then','end','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','stringify','create','body','update','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','redis'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0xdd51,0x8b));var _0x1dd5=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xdd51[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1dd5('0x0'));var jsonpatch=require(_0x1dd5('0x1'));var rp=require('request-promise');var moment=require(_0x1dd5('0x2'));var BPromise=require(_0x1dd5('0x3'));var Mustache=require('mustache');var util=require(_0x1dd5('0x4'));var path=require('path');var sox=require(_0x1dd5('0x5'));var csv=require(_0x1dd5('0x6'));var ejs=require(_0x1dd5('0x7'));var fs=require('fs');var fs_extra=require(_0x1dd5('0x8'));var _=require('lodash');var squel=require(_0x1dd5('0x9'));var crypto=require(_0x1dd5('0xa'));var jsforce=require(_0x1dd5('0xb'));var deskjs=require(_0x1dd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1dd5('0xd'));var Papa=require(_0x1dd5('0xe'));var Redis=require(_0x1dd5('0xf'));var authService=require(_0x1dd5('0x10'));var qs=require(_0x1dd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dd5('0x12'))(_0x1dd5('0x13'));var utils=require('../../config/utils');var config=require(_0x1dd5('0x14'));var licenseUtil=require(_0x1dd5('0x15'));var db=require('../../mysqldb')['db'];config[_0x1dd5('0x16')]=_[_0x1dd5('0x17')](config['redis'],{'host':_0x1dd5('0x18'),'port':0x18eb});var socket=require(_0x1dd5('0x19'))(new Redis(config[_0x1dd5('0x16')]));require(_0x1dd5('0x1a'))['register'](socket);function respondWithStatusCode(_0xbdad53,_0x278f04){_0x278f04=_0x278f04||0xcc;return function(_0xd0e3a7){if(_0xd0e3a7){return _0xbdad53[_0x1dd5('0x1b')](_0x278f04);}return _0xbdad53[_0x1dd5('0x1c')](_0x278f04)['end']();};}function respondWithResult(_0x1b9ef6,_0x4c39d2){_0x4c39d2=_0x4c39d2||0xc8;return function(_0x3194ca){if(_0x3194ca){return _0x1b9ef6[_0x1dd5('0x1c')](_0x4c39d2)[_0x1dd5('0x1d')](_0x3194ca);}};}function respondWithFilteredResult(_0xdf3e09,_0x5bbb6a){return function(_0x5b5a16){if(_0x5b5a16){var _0x28260e=typeof _0x5bbb6a[_0x1dd5('0x1e')]===_0x1dd5('0x1f')&&typeof _0x5bbb6a[_0x1dd5('0x20')]===_0x1dd5('0x1f');var _0x193a20=_0x5b5a16['count'];var _0x22cd15=_0x28260e?0x0:_0x5bbb6a[_0x1dd5('0x1e')];var _0x39a56f=_0x28260e?_0x5b5a16['count']:_0x5bbb6a['offset']+_0x5bbb6a[_0x1dd5('0x20')];var _0x132f0f;if(_0x39a56f>=_0x193a20){_0x39a56f=_0x193a20;_0x132f0f=0xc8;}else{_0x132f0f=0xce;}_0xdf3e09['status'](_0x132f0f);return _0xdf3e09[_0x1dd5('0x21')](_0x1dd5('0x22'),_0x22cd15+'-'+_0x39a56f+'/'+_0x193a20)['json'](_0x5b5a16);}return null;};}function patchUpdates(_0x4e4010){return function(_0x1be94a){try{jsonpatch['apply'](_0x1be94a,_0x4e4010,!![]);}catch(_0xf67fbb){return BPromise[_0x1dd5('0x23')](_0xf67fbb);}return _0x1be94a['save']();};}function saveUpdates(_0x42b619,_0x321741){return function(_0x2aa5de){if(_0x2aa5de){return _0x2aa5de['update'](_0x42b619)['then'](function(_0x369a46){return _0x369a46;});}return null;};}function removeEntity(_0x189a93,_0x593d35){return function(_0x472a7){if(_0x472a7){return _0x472a7[_0x1dd5('0x24')]()[_0x1dd5('0x25')](function(){_0x189a93[_0x1dd5('0x1c')](0xcc)[_0x1dd5('0x26')]();});}};}function handleEntityNotFound(_0x38b52f,_0x2aaafb){return function(_0x5ea770){if(!_0x5ea770){_0x38b52f[_0x1dd5('0x1b')](0x194);}return _0x5ea770;};}function handleError(_0x2bd149,_0x4c2269){_0x4c2269=_0x4c2269||0x1f4;return function(_0x448f3c){logger['error'](_0x448f3c['stack']);if(_0x448f3c[_0x1dd5('0x27')]){delete _0x448f3c[_0x1dd5('0x27')];}_0x2bd149[_0x1dd5('0x1c')](_0x4c2269)[_0x1dd5('0x28')](_0x448f3c);};}exports[_0x1dd5('0x29')]=function(_0x4f08aa,_0x16c71e){var _0x132021={'raw':![],'where':{'id':_0x4f08aa[_0x1dd5('0x2a')]['id']}},_0x12f7ca={};_0x12f7ca['model']=_[_0x1dd5('0x2b')](db[_0x1dd5('0x2c')][_0x1dd5('0x2d')]);_0x12f7ca[_0x1dd5('0x2e')]=_[_0x1dd5('0x2b')](_0x4f08aa['query']);_0x12f7ca[_0x1dd5('0x2f')]=_[_0x1dd5('0x30')](_0x12f7ca['model'],_0x12f7ca['query']);_0x132021[_0x1dd5('0x31')]=_[_0x1dd5('0x30')](_0x12f7ca[_0x1dd5('0x32')],qs[_0x1dd5('0x33')](_0x4f08aa[_0x1dd5('0x2e')][_0x1dd5('0x33')]));_0x132021['attributes']=_0x132021[_0x1dd5('0x31')][_0x1dd5('0x34')]?_0x132021['attributes']:_0x12f7ca[_0x1dd5('0x32')];if(_0x4f08aa[_0x1dd5('0x2e')][_0x1dd5('0x35')]){_0x132021[_0x1dd5('0x36')]=[{'all':!![]}];}_0x132021=_['merge']({},_0x132021,_0x4f08aa['options']);return db[_0x1dd5('0x2c')][_0x1dd5('0x37')](_0x132021)['then'](handleEntityNotFound(_0x16c71e,null))[_0x1dd5('0x25')](respondWithResult(_0x16c71e,null))[_0x1dd5('0x38')](handleError(_0x16c71e,null));};exports['destroy']=function(_0x2ae7aa,_0x37a2cb){return db[_0x1dd5('0x2c')]['find']({'where':{'id':_0x2ae7aa[_0x1dd5('0x2a')]['id']}})[_0x1dd5('0x25')](handleEntityNotFound(_0x37a2cb,null))[_0x1dd5('0x25')](removeEntity(_0x37a2cb,null))[_0x1dd5('0x38')](handleError(_0x37a2cb,null));};function widgetAttributes(_0x3b4e5f){try{switch(_0x3b4e5f[_0x1dd5('0x39')]){case'iframe':return[{'name':_0x1dd5('0x3a'),'value':_0x3b4e5f[_0x1dd5('0x3a')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x0]?_0x3b4e5f[_0x1dd5('0x3b')][0x0][_0x1dd5('0x3c')]:undefined)||_0x1dd5('0x3d')}];case _0x1dd5('0x3e'):return[{'name':_0x1dd5('0x3f'),'value':_0x3b4e5f['attrPath']||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x0]?_0x3b4e5f['attrs'][0x0][_0x1dd5('0x3c')]:undefined)||''}];case'clock':return[{'name':_0x1dd5('0x40'),'value':_0x3b4e5f[_0x1dd5('0x40')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x0]?_0x3b4e5f[_0x1dd5('0x3b')][0x0][_0x1dd5('0x3c')]:undefined)||'HH:mm:ss'},{'name':_0x1dd5('0x41'),'value':_0x3b4e5f[_0x1dd5('0x41')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x1]?_0x3b4e5f['attrs'][0x1][_0x1dd5('0x3c')]:undefined)||'0.00'},{'name':_0x1dd5('0x42'),'value':_0x3b4e5f[_0x1dd5('0x42')]||(_0x3b4e5f['attrs']&&_0x3b4e5f[_0x1dd5('0x3b')][0x2]?_0x3b4e5f[_0x1dd5('0x3b')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x1dd5('0x43'),'value':_0x3b4e5f[_0x1dd5('0x43')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x0]?_0x3b4e5f[_0x1dd5('0x3b')][0x0][_0x1dd5('0x3c')]:undefined)||_0x1dd5('0x44')},{'name':_0x1dd5('0x45'),'value':_0x3b4e5f[_0x1dd5('0x45')]||(_0x3b4e5f['attrs']&&_0x3b4e5f[_0x1dd5('0x3b')][0x1]?_0x3b4e5f[_0x1dd5('0x3b')][0x1]['value']:undefined)||[]},{'name':_0x1dd5('0x42'),'value':_0x3b4e5f[_0x1dd5('0x42')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x2]?_0x3b4e5f[_0x1dd5('0x3b')][0x2][_0x1dd5('0x3c')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x3b4e5f[_0x1dd5('0x46')]||(_0x3b4e5f['attrs']&&_0x3b4e5f['attrs'][0x0]?_0x3b4e5f[_0x1dd5('0x3b')][0x0][_0x1dd5('0x3c')]:undefined)||'total'},{'name':'attrSerie2','value':_0x3b4e5f[_0x1dd5('0x47')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x1]?_0x3b4e5f[_0x1dd5('0x3b')][0x1][_0x1dd5('0x3c')]:undefined)||null},{'name':'attrSerie3','value':_0x3b4e5f[_0x1dd5('0x48')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x2]?_0x3b4e5f['attrs'][0x2]['value']:undefined)||null},{'name':_0x1dd5('0x45'),'value':_0x3b4e5f[_0x1dd5('0x45')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f['attrs'][0x3]?_0x3b4e5f[_0x1dd5('0x3b')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x1dd5('0x49'),'type':_0x3b4e5f[_0x1dd5('0x4a')]||(_0x3b4e5f['attrs']&&_0x3b4e5f[_0x1dd5('0x3b')][0x0]?_0x3b4e5f['attrs'][0x0][_0x1dd5('0x39')]:undefined)||null,'value':_0x3b4e5f[_0x1dd5('0x49')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f[_0x1dd5('0x3b')][0x0]?_0x3b4e5f['attrs'][0x0][_0x1dd5('0x3c')]:undefined)||null},{'name':'attrRefresh','value':_0x3b4e5f[_0x1dd5('0x4b')]||(_0x3b4e5f[_0x1dd5('0x3b')]&&_0x3b4e5f['attrs'][0x1]?_0x3b4e5f['attrs'][0x1][_0x1dd5('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0xee5abb){logger[_0x1dd5('0x4c')]('widgetAttributes:\x20%s',JSON[_0x1dd5('0x4d')](_0xee5abb));return[];}}exports[_0x1dd5('0x4e')]=function(_0x51b06e,_0x2e1ca5){if(_0x51b06e[_0x1dd5('0x4f')]){_0x51b06e['body'][_0x1dd5('0x3b')]=widgetAttributes(_0x51b06e[_0x1dd5('0x4f')]);}return db[_0x1dd5('0x2c')]['create'](_0x51b06e[_0x1dd5('0x4f')],{})['then'](respondWithResult(_0x2e1ca5,0xc9))[_0x1dd5('0x38')](handleError(_0x2e1ca5,null));};exports[_0x1dd5('0x50')]=function(_0x201875,_0x1a02af){if(_0x201875[_0x1dd5('0x4f')]['id']){delete _0x201875[_0x1dd5('0x4f')]['id'];}_0x201875[_0x1dd5('0x4f')][_0x1dd5('0x3b')]=widgetAttributes(_0x201875[_0x1dd5('0x4f')]);return db[_0x1dd5('0x2c')]['find']({'where':{'id':_0x201875[_0x1dd5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1a02af,null))[_0x1dd5('0x25')](saveUpdates(_0x201875[_0x1dd5('0x4f')],null))[_0x1dd5('0x25')](respondWithResult(_0x1a02af,null))[_0x1dd5('0x38')](handleError(_0x1a02af,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a3814e9..032b23a 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 _0xadb6=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x265ff2,_0x183632){var _0x3d723f=function(_0x1c518f){while(--_0x1c518f){_0x265ff2['push'](_0x265ff2['shift']());}};_0x3d723f(++_0x183632);}(_0xadb6,0x1b5));var _0x6adb=function(_0x5a3761,_0x57c59b){_0x5a3761=_0x5a3761-0x0;var _0x40ebe9=_0xadb6[_0x5a3761];return _0x40ebe9;};'use strict';var EventEmitter=require(_0x6adb('0x0'));var DashboardItem=require(_0x6adb('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6adb('0x2')](0x0);var events={'afterCreate':_0x6adb('0x3'),'afterUpdate':_0x6adb('0x4'),'afterDestroy':_0x6adb('0x5')};function emitEvent(_0x8e1df8){return function(_0x51c4a2,_0x1e6c1a,_0x364e76){DashboardItemEvents['emit'](_0x8e1df8+':'+_0x51c4a2['id'],_0x51c4a2);DashboardItemEvents[_0x6adb('0x6')](_0x8e1df8,_0x51c4a2);_0x364e76(null);};}for(var e in events){if(events[_0x6adb('0x7')](e)){var event=events[e];DashboardItem[_0x6adb('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x5c36=['exports','DashboardItem','setMaxListeners','save','update','remove','emit','hook'];(function(_0x31b56b,_0xdbf877){var _0x3c7b85=function(_0x54fd2d){while(--_0x54fd2d){_0x31b56b['push'](_0x31b56b['shift']());}};_0x3c7b85(++_0xdbf877);}(_0x5c36,0x1d1));var _0x65c3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5c36[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x65c3('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x65c3('0x1')](0x0);var events={'afterCreate':_0x65c3('0x2'),'afterUpdate':_0x65c3('0x3'),'afterDestroy':_0x65c3('0x4')};function emitEvent(_0x5a1548){return function(_0x2cb591,_0xdcac86,_0x418f78){DashboardItemEvents[_0x65c3('0x5')](_0x5a1548+':'+_0x2cb591['id'],_0x2cb591);DashboardItemEvents['emit'](_0x5a1548,_0x2cb591);_0x418f78(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x65c3('0x6')](e,emitEvent(event));}}module[_0x65c3('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1989c54..1ad3539 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 _0x9363=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','dashboard_items','lodash','util','../../config/logger'];(function(_0x43e2de,_0x34293d){var _0x57ac89=function(_0x5708c4){while(--_0x5708c4){_0x43e2de['push'](_0x43e2de['shift']());}};_0x57ac89(++_0x34293d);}(_0x9363,0x105));var _0x3936=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9363[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3936('0x0'));var util=require(_0x3936('0x1'));var logger=require(_0x3936('0x2'))(_0x3936('0x3'));var moment=require(_0x3936('0x4'));var BPromise=require(_0x3936('0x5'));var rp=require(_0x3936('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3936('0x7'));var config=require(_0x3936('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x3936('0x9')]=function(_0x544d37,_0x22ac97){return _0x544d37[_0x3936('0xa')]('DashboardItem',attributes,{'tableName':_0x3936('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5afe=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items','lodash','util','../../config/logger','api','bluebird'];(function(_0x2f0e59,_0x2bd7a3){var _0xa26162=function(_0x138be9){while(--_0x138be9){_0x2f0e59['push'](_0x2f0e59['shift']());}};_0xa26162(++_0x2bd7a3);}(_0x5afe,0x1ab));var _0xe5af=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0x5afe[_0x40f991];return _0x38eca2;};'use strict';var _=require(_0xe5af('0x0'));var util=require(_0xe5af('0x1'));var logger=require(_0xe5af('0x2'))(_0xe5af('0x3'));var moment=require('moment');var BPromise=require(_0xe5af('0x4'));var rp=require(_0xe5af('0x5'));var fs=require('fs');var path=require(_0xe5af('0x6'));var rimraf=require(_0xe5af('0x7'));var config=require(_0xe5af('0x8'));var attributes=require(_0xe5af('0x9'));module[_0xe5af('0xa')]=function(_0x2e7e5f,_0x110687){return _0x2e7e5f['define']('DashboardItem',attributes,{'tableName':_0xe5af('0xb'),'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 b55d925..25953c6 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 _0xa31a=['socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0xa31a,0xa9));var _0xaa31=function(_0x1a1a32,_0x323346){_0x1a1a32=_0x1a1a32-0x0;var _0x286819=_0xa31a[_0x1a1a32];return _0x286819;};'use strict';var _=require(_0xaa31('0x0'));var util=require(_0xaa31('0x1'));var moment=require(_0xaa31('0x2'));var BPromise=require(_0xaa31('0x3'));var rs=require(_0xaa31('0x4'));var fs=require('fs');var Redis=require(_0xaa31('0x5'));var db=require(_0xaa31('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xaa31('0x7'));var client=jayson[_0xaa31('0x8')][_0xaa31('0x9')]({'port':0x232a});config[_0xaa31('0xa')]=_[_0xaa31('0xb')](config[_0xaa31('0xa')],{'host':_0xaa31('0xc'),'port':0x18eb});var socket=require(_0xaa31('0xd'))(new Redis(config[_0xaa31('0xa')]));require(_0xaa31('0xe'))[_0xaa31('0xf')](socket);function respondWithRpcPromise(_0x4c5724,_0x38310f,_0xe67efd){return new BPromise(function(_0x6ea617,_0x2cb309){return client['request'](_0x4c5724,_0xe67efd)[_0xaa31('0x10')](function(_0x3888f5){logger[_0xaa31('0x11')](_0xaa31('0x12'),_0x38310f,_0xaa31('0x13'));logger[_0xaa31('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x38310f,'request\x20sent',JSON[_0xaa31('0x15')](_0x3888f5));if(_0x3888f5['error']){if(_0x3888f5[_0xaa31('0x16')][_0xaa31('0x17')]===0x1f4){logger['error'](_0xaa31('0x12'),_0x38310f,_0x3888f5[_0xaa31('0x16')]['message']);return _0x2cb309(_0x3888f5['error'][_0xaa31('0x18')]);}logger[_0xaa31('0x16')](_0xaa31('0x12'),_0x38310f,_0x3888f5[_0xaa31('0x16')][_0xaa31('0x18')]);return _0x6ea617(_0x3888f5[_0xaa31('0x16')]['message']);}else{logger[_0xaa31('0x11')](_0xaa31('0x12'),_0x38310f,_0xaa31('0x13'));_0x6ea617(_0x3888f5[_0xaa31('0x19')][_0xaa31('0x18')]);}})['catch'](function(_0x26df9e){logger[_0xaa31('0x16')]('DashboardItem,\x20%s,\x20%s',_0x38310f,_0x26df9e);_0x2cb309(_0x26df9e);});});} \ No newline at end of file +var _0x5008=['socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x11c072,_0x7a3405){var _0x7e6110=function(_0x1fcd14){while(--_0x1fcd14){_0x11c072['push'](_0x11c072['shift']());}};_0x7e6110(++_0x7a3405);}(_0x5008,0x90));var _0x8500=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x5008[_0x576266];return _0x18234f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8500('0x0'));var BPromise=require(_0x8500('0x1'));var rs=require(_0x8500('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8500('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8500('0x4'))(_0x8500('0x5'));var config=require('../../config/environment');var jayson=require(_0x8500('0x6'));var client=jayson[_0x8500('0x7')]['http']({'port':0x232a});config[_0x8500('0x8')]=_[_0x8500('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8500('0xa'))(new Redis(config[_0x8500('0x8')]));require(_0x8500('0xb'))[_0x8500('0xc')](socket);function respondWithRpcPromise(_0x2741d9,_0x51e789,_0xe06c04){return new BPromise(function(_0x4479ae,_0x2532cf){return client[_0x8500('0xd')](_0x2741d9,_0xe06c04)[_0x8500('0xe')](function(_0x46a3e3){logger['info'](_0x8500('0xf'),_0x51e789,_0x8500('0x10'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x51e789,'request\x20sent',JSON[_0x8500('0x11')](_0x46a3e3));if(_0x46a3e3[_0x8500('0x12')]){if(_0x46a3e3[_0x8500('0x12')][_0x8500('0x13')]===0x1f4){logger[_0x8500('0x12')]('DashboardItem,\x20%s,\x20%s',_0x51e789,_0x46a3e3[_0x8500('0x12')][_0x8500('0x14')]);return _0x2532cf(_0x46a3e3[_0x8500('0x12')][_0x8500('0x14')]);}logger['error'](_0x8500('0xf'),_0x51e789,_0x46a3e3[_0x8500('0x12')][_0x8500('0x14')]);return _0x4479ae(_0x46a3e3['error'][_0x8500('0x14')]);}else{logger['info'](_0x8500('0xf'),_0x51e789,_0x8500('0x10'));_0x4479ae(_0x46a3e3['result'][_0x8500('0x14')]);}})[_0x8500('0x15')](function(_0x4ee923){logger[_0x8500('0x12')](_0x8500('0xf'),_0x51e789,_0x4ee923);_0x2532cf(_0x4ee923);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 222e93b..52764e0 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 _0x89c3=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0x89c3,0x1a9));var _0x389c=function(_0x283787,_0x1ae745){_0x283787=_0x283787-0x0;var _0x4f6382=_0x89c3[_0x283787];return _0x4f6382;};'use strict';var DashboardItemEvents=require(_0x389c('0x0'));var events=[_0x389c('0x1'),_0x389c('0x2'),_0x389c('0x3')];function createListener(_0x16262a,_0x3c9e1d){return function(_0x4fb320){_0x3c9e1d[_0x389c('0x4')](_0x16262a,_0x4fb320);};}function removeListener(_0x502f72,_0x47cd7d){return function(){DashboardItemEvents[_0x389c('0x5')](_0x502f72,_0x47cd7d);};}exports[_0x389c('0x6')]=function(_0x7c4f59){for(var _0x4864a0=0x0,_0x46c5e9=events[_0x389c('0x7')];_0x4864a0<_0x46c5e9;_0x4864a0++){var _0x5c515e=events[_0x4864a0];var _0x7bc1d=createListener(_0x389c('0x8')+_0x5c515e,_0x7c4f59);DashboardItemEvents['on'](_0x5c515e,_0x7bc1d);}}; \ No newline at end of file +var _0xa858=['save','update','emit','removeListener','length'];(function(_0x124059,_0x330297){var _0x58e07a=function(_0x281d3d){while(--_0x281d3d){_0x124059['push'](_0x124059['shift']());}};_0x58e07a(++_0x330297);}(_0xa858,0x9b));var _0x8a85=function(_0x4fd108,_0xe3638c){_0x4fd108=_0x4fd108-0x0;var _0x30735b=_0xa858[_0x4fd108];return _0x30735b;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x8a85('0x0'),'remove',_0x8a85('0x1')];function createListener(_0x240db0,_0x2759c4){return function(_0x18da1f){_0x2759c4[_0x8a85('0x2')](_0x240db0,_0x18da1f);};}function removeListener(_0x2d0ad6,_0x5bb8ac){return function(){DashboardItemEvents[_0x8a85('0x3')](_0x2d0ad6,_0x5bb8ac);};}exports['register']=function(_0x18bab7){for(var _0x629f65=0x0,_0x3b1e94=events[_0x8a85('0x4')];_0x629f65<_0x3b1e94;_0x629f65++){var _0x11f7ca=events[_0x629f65];var _0x1300ca=createListener('dashboardItem:'+_0x11f7ca,_0x18bab7);DashboardItemEvents['on'](_0x11f7ca,_0x1300ca);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0f5ab94..834d85f 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 _0x4cbe=['Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','create','delete','destroy','exports','util','path'];(function(_0x1ea70b,_0x1c01b5){var _0x18bbb5=function(_0x5aeac6){while(--_0x5aeac6){_0x1ea70b['push'](_0x1ea70b['shift']());}};_0x18bbb5(++_0x1c01b5);}(_0x4cbe,0x19e));var _0xe4cb=function(_0x9a57d3,_0xc6453c){_0x9a57d3=_0x9a57d3-0x0;var _0x45ec2d=_0x4cbe[_0x9a57d3];return _0x45ec2d;};'use strict';var multer=require('multer');var util=require(_0xe4cb('0x0'));var path=require(_0xe4cb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe4cb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe4cb('0x3'));var interaction=require(_0xe4cb('0x4'));var config=require('../../config/environment');var controller=require(_0xe4cb('0x5'));router[_0xe4cb('0x6')](_0xe4cb('0x7'),auth[_0xe4cb('0x8')](),controller['show']);router['post']('/',auth[_0xe4cb('0x8')](),controller[_0xe4cb('0x9')]);router['put']('/:id',auth[_0xe4cb('0x8')](),controller['update']);router[_0xe4cb('0xa')](_0xe4cb('0x7'),auth[_0xe4cb('0x8')](),controller[_0xe4cb('0xb')]);module[_0xe4cb('0xc')]=router; \ No newline at end of file +var _0xe429=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','update','destroy','exports','multer'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe429,0x6b));var _0x9e42=function(_0x39acd3,_0x57b5e8){_0x39acd3=_0x39acd3-0x0;var _0x26be03=_0xe429[_0x39acd3];return _0x26be03;};'use strict';var multer=require(_0x9e42('0x0'));var util=require(_0x9e42('0x1'));var path=require(_0x9e42('0x2'));var timeout=require(_0x9e42('0x3'));var express=require(_0x9e42('0x4'));var router=express[_0x9e42('0x5')]();var fs_extra=require(_0x9e42('0x6'));var auth=require(_0x9e42('0x7'));var interaction=require(_0x9e42('0x8'));var config=require(_0x9e42('0x9'));var controller=require('./dashboardItem.controller');router[_0x9e42('0xa')](_0x9e42('0xb'),auth[_0x9e42('0xc')](),controller['show']);router[_0x9e42('0xd')]('/',auth['isAuthenticated'](),controller[_0x9e42('0xe')]);router['put'](_0x9e42('0xb'),auth[_0x9e42('0xc')](),controller[_0x9e42('0xf')]);router['delete'](_0x9e42('0xb'),auth[_0x9e42('0xc')](),controller[_0x9e42('0x10')]);module[_0x9e42('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 98e77da..72c3e61 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 _0x4005=['exports','ENUM','second','STRING','sequelize'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x4005,0x16c));var _0x5400=function(_0x4b243c,_0x15f2f7){_0x4b243c=_0x4b243c-0x0;var _0x34ebfa=_0x4005[_0x4b243c];return _0x34ebfa;};'use strict';var Sequelize=require(_0x5400('0x0'));module[_0x5400('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x5400('0x2')]('first',_0x5400('0x3'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x5400('0x4')]}}; \ No newline at end of file +var _0xb046=['exports','STRING','ENUM','first','second','third'];(function(_0x463d53,_0x59b94d){var _0x528135=function(_0x4d2d70){while(--_0x4d2d70){_0x463d53['push'](_0x463d53['shift']());}};_0x528135(++_0x59b94d);}(_0xb046,0x174));var _0x6b04=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0xb046[_0x38f737];return _0x7afda3;};'use strict';var Sequelize=require('sequelize');module[_0x6b04('0x0')]={'name':{'type':Sequelize[_0x6b04('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6b04('0x2')](_0x6b04('0x3'),_0x6b04('0x4'),_0x6b04('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ae9068b..66f7d21 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 _0x09d3=['params','Disposition','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4ce3a2,_0xf7ec9f){var _0x2652f8=function(_0xb5b5b2){while(--_0xb5b5b2){_0x4ce3a2['push'](_0x4ce3a2['shift']());}};_0x2652f8(++_0xf7ec9f);}(_0x09d3,0x16e));var _0x309d=function(_0x21e040,_0x20e57f){_0x21e040=_0x21e040-0x0;var _0x262b18=_0x09d3[_0x21e040];return _0x262b18;};'use strict';var emlformat=require(_0x309d('0x0'));var rimraf=require(_0x309d('0x1'));var zipdir=require(_0x309d('0x2'));var jsonpatch=require(_0x309d('0x3'));var rp=require(_0x309d('0x4'));var moment=require(_0x309d('0x5'));var BPromise=require(_0x309d('0x6'));var Mustache=require(_0x309d('0x7'));var util=require('util');var path=require(_0x309d('0x8'));var sox=require(_0x309d('0x9'));var csv=require(_0x309d('0xa'));var ejs=require(_0x309d('0xb'));var fs=require('fs');var fs_extra=require(_0x309d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x309d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x309d('0xa'));var querystring=require(_0x309d('0xe'));var Papa=require(_0x309d('0xf'));var Redis=require('ioredis');var authService=require(_0x309d('0x10'));var qs=require(_0x309d('0x11'));var as=require(_0x309d('0x12'));var hardwareService=require(_0x309d('0x13'));var logger=require(_0x309d('0x14'))(_0x309d('0x15'));var utils=require(_0x309d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x309d('0x17'));var db=require(_0x309d('0x18'))['db'];function respondWithStatusCode(_0x4e3281,_0x558ef0){_0x558ef0=_0x558ef0||0xcc;return function(_0x5f331e){if(_0x5f331e){return _0x4e3281['sendStatus'](_0x558ef0);}return _0x4e3281[_0x309d('0x19')](_0x558ef0)[_0x309d('0x1a')]();};}function respondWithResult(_0x107a6d,_0x2a28a2){_0x2a28a2=_0x2a28a2||0xc8;return function(_0x4bbbb3){if(_0x4bbbb3){return _0x107a6d[_0x309d('0x19')](_0x2a28a2)[_0x309d('0x1b')](_0x4bbbb3);}};}function respondWithFilteredResult(_0x1d5bf1,_0xde7f2f){return function(_0x2aaf22){if(_0x2aaf22){var _0x59bf5c=typeof _0xde7f2f[_0x309d('0x1c')]===_0x309d('0x1d')&&typeof _0xde7f2f[_0x309d('0x1e')]===_0x309d('0x1d');var _0x4419c3=_0x2aaf22[_0x309d('0x1f')];var _0x549c99=_0x59bf5c?0x0:_0xde7f2f[_0x309d('0x1c')];var _0x446115=_0x59bf5c?_0x2aaf22[_0x309d('0x1f')]:_0xde7f2f[_0x309d('0x1c')]+_0xde7f2f['limit'];var _0x12b16f;if(_0x446115>=_0x4419c3){_0x446115=_0x4419c3;_0x12b16f=0xc8;}else{_0x12b16f=0xce;}_0x1d5bf1[_0x309d('0x19')](_0x12b16f);return _0x1d5bf1['set'](_0x309d('0x20'),_0x549c99+'-'+_0x446115+'/'+_0x4419c3)[_0x309d('0x1b')](_0x2aaf22);}return null;};}function patchUpdates(_0x27887f){return function(_0x26adee){try{jsonpatch[_0x309d('0x21')](_0x26adee,_0x27887f,!![]);}catch(_0x59c839){return BPromise[_0x309d('0x22')](_0x59c839);}return _0x26adee[_0x309d('0x23')]();};}function saveUpdates(_0x521a6d,_0x5d70ec){return function(_0x56d7fb){if(_0x56d7fb){return _0x56d7fb[_0x309d('0x24')](_0x521a6d)[_0x309d('0x25')](function(_0x45ca15){return _0x45ca15;});}return null;};}function removeEntity(_0x3ed81a,_0x5f32ff){return function(_0x21df8e){if(_0x21df8e){return _0x21df8e[_0x309d('0x26')]()[_0x309d('0x25')](function(){var _0x472814=_0x21df8e[_0x309d('0x27')]({'plain':!![]});var _0x1f6ef6=_0x309d('0x28');return db['UserProfileResource'][_0x309d('0x26')]({'where':{'type':_0x1f6ef6,'resourceId':_0x472814['id']}})['then'](function(){return _0x21df8e;});})[_0x309d('0x25')](function(){_0x3ed81a[_0x309d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da25c,_0x4e3118){return function(_0x500dcf){if(!_0x500dcf){_0x4da25c[_0x309d('0x29')](0x194);}return _0x500dcf;};}function handleError(_0x479929,_0x42fe89){_0x42fe89=_0x42fe89||0x1f4;return function(_0x281031){logger[_0x309d('0x2a')](_0x281031[_0x309d('0x2b')]);if(_0x281031['name']){delete _0x281031[_0x309d('0x2c')];}_0x479929['status'](_0x42fe89)[_0x309d('0x2d')](_0x281031);};}exports[_0x309d('0x2e')]=function(_0x2a45b0,_0x5e0216){var _0x413c53={},_0x1a4059={},_0x5cabe7={'count':0x0,'rows':[]};var _0x1f37a8=_['map'](db['Disposition'][_0x309d('0x2f')],function(_0xc0fae6){return{'name':_0xc0fae6['fieldName'],'type':_0xc0fae6[_0x309d('0x30')][_0x309d('0x31')]};});_0x1a4059[_0x309d('0x32')]=_[_0x309d('0x33')](_0x1f37a8,'name');_0x1a4059['query']=_[_0x309d('0x34')](_0x2a45b0[_0x309d('0x35')]);_0x1a4059['filters']=_['intersection'](_0x1a4059[_0x309d('0x32')],_0x1a4059['query']);_0x413c53[_0x309d('0x36')]=_[_0x309d('0x37')](_0x1a4059[_0x309d('0x32')],qs['fields'](_0x2a45b0[_0x309d('0x35')][_0x309d('0x38')]));_0x413c53[_0x309d('0x36')]=_0x413c53[_0x309d('0x36')]['length']?_0x413c53[_0x309d('0x36')]:_0x1a4059[_0x309d('0x32')];if(!_0x2a45b0[_0x309d('0x35')][_0x309d('0x39')](_0x309d('0x3a'))){_0x413c53['limit']=qs[_0x309d('0x1e')](_0x2a45b0[_0x309d('0x35')]['limit']);_0x413c53[_0x309d('0x1c')]=qs[_0x309d('0x1c')](_0x2a45b0['query'][_0x309d('0x1c')]);}_0x413c53[_0x309d('0x3b')]=qs[_0x309d('0x3c')](_0x2a45b0['query'][_0x309d('0x3c')]);_0x413c53[_0x309d('0x3d')]=qs[_0x309d('0x3e')](_[_0x309d('0x3f')](_0x2a45b0[_0x309d('0x35')],_0x1a4059[_0x309d('0x3e')]),_0x1f37a8);if(_0x2a45b0[_0x309d('0x35')][_0x309d('0x40')]){_0x413c53['where']=_[_0x309d('0x41')](_0x413c53['where'],{'$or':_['map'](_0x1f37a8,function(_0x22a3c7){if(_0x22a3c7['type']!==_0x309d('0x42')){var _0x512b33={};_0x512b33[_0x22a3c7[_0x309d('0x2c')]]={'$like':'%'+_0x2a45b0[_0x309d('0x35')][_0x309d('0x40')]+'%'};return _0x512b33;}})});}_0x413c53=_[_0x309d('0x41')]({},_0x413c53,_0x2a45b0[_0x309d('0x43')]);var _0x1bb2ee={'where':_0x413c53[_0x309d('0x3d')]};return db['Disposition'][_0x309d('0x1f')](_0x1bb2ee)['then'](function(_0x5837ed){_0x5cabe7[_0x309d('0x1f')]=_0x5837ed;if(_0x2a45b0[_0x309d('0x35')][_0x309d('0x44')]){_0x413c53[_0x309d('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x309d('0x46')](_0x413c53);})[_0x309d('0x25')](function(_0x2756c2){_0x5cabe7[_0x309d('0x47')]=_0x2756c2;return _0x5cabe7;})[_0x309d('0x25')](respondWithFilteredResult(_0x5e0216,_0x413c53))[_0x309d('0x48')](handleError(_0x5e0216,null));};exports[_0x309d('0x49')]=function(_0x2dda5a,_0x251021){var _0x51ae92={'raw':!![],'where':{'id':_0x2dda5a[_0x309d('0x4a')]['id']}},_0x4e5b7d={};_0x4e5b7d[_0x309d('0x32')]=_[_0x309d('0x34')](db[_0x309d('0x4b')][_0x309d('0x2f')]);_0x4e5b7d[_0x309d('0x35')]=_[_0x309d('0x34')](_0x2dda5a[_0x309d('0x35')]);_0x4e5b7d['filters']=_['intersection'](_0x4e5b7d['model'],_0x4e5b7d['query']);_0x51ae92[_0x309d('0x36')]=_[_0x309d('0x37')](_0x4e5b7d[_0x309d('0x32')],qs[_0x309d('0x38')](_0x2dda5a['query'][_0x309d('0x38')]));_0x51ae92[_0x309d('0x36')]=_0x51ae92[_0x309d('0x36')][_0x309d('0x4c')]?_0x51ae92[_0x309d('0x36')]:_0x4e5b7d[_0x309d('0x32')];if(_0x2dda5a[_0x309d('0x35')][_0x309d('0x44')]){_0x51ae92[_0x309d('0x45')]=[{'all':!![]}];}_0x51ae92=_[_0x309d('0x41')]({},_0x51ae92,_0x2dda5a['options']);return db['Disposition'][_0x309d('0x4d')](_0x51ae92)['then'](handleEntityNotFound(_0x251021,null))[_0x309d('0x25')](respondWithResult(_0x251021,null))['catch'](handleError(_0x251021,null));};exports[_0x309d('0x4e')]=function(_0x36233e,_0x3367f5){return db[_0x309d('0x4b')][_0x309d('0x4e')](_0x36233e[_0x309d('0x4f')],{})[_0x309d('0x25')](function(_0x9eaf73){var _0x3af9ed=_0x36233e[_0x309d('0x50')]['get']({'plain':!![]});if(!_0x3af9ed)throw new Error(_0x309d('0x51'));if(_0x3af9ed[_0x309d('0x52')]===_0x309d('0x50')){var _0x2278ab=_0x9eaf73[_0x309d('0x27')]({'plain':!![]});var _0x348ec4='Dispositions';return db[_0x309d('0x53')]['find']({'where':{'name':_0x348ec4,'userProfileId':_0x3af9ed[_0x309d('0x54')]},'raw':!![]})[_0x309d('0x25')](function(_0x33cc5d){if(_0x33cc5d&&_0x33cc5d[_0x309d('0x55')]===0x0){return db[_0x309d('0x56')]['create']({'name':_0x2278ab[_0x309d('0x2c')],'resourceId':_0x2278ab['id'],'type':_0x33cc5d[_0x309d('0x2c')],'sectionId':_0x33cc5d['id']},{})[_0x309d('0x25')](function(){return _0x9eaf73;});}else{return _0x9eaf73;}})[_0x309d('0x48')](function(_0x3aee72){logger[_0x309d('0x2a')](_0x309d('0x57'),_0x3aee72);throw _0x3aee72;});}return _0x9eaf73;})[_0x309d('0x25')](respondWithResult(_0x3367f5,0xc9))[_0x309d('0x48')](handleError(_0x3367f5,null));};exports[_0x309d('0x24')]=function(_0x2a632d,_0x4559ce){if(_0x2a632d[_0x309d('0x4f')]['id']){delete _0x2a632d[_0x309d('0x4f')]['id'];}return db['Disposition'][_0x309d('0x4d')]({'where':{'id':_0x2a632d[_0x309d('0x4a')]['id']}})[_0x309d('0x25')](handleEntityNotFound(_0x4559ce,null))[_0x309d('0x25')](saveUpdates(_0x2a632d['body'],null))['then'](respondWithResult(_0x4559ce,null))[_0x309d('0x48')](handleError(_0x4559ce,null));};exports[_0x309d('0x26')]=function(_0x1c34e4,_0x134941){return db[_0x309d('0x4b')][_0x309d('0x4d')]({'where':{'id':_0x1c34e4[_0x309d('0x4a')]['id']}})[_0x309d('0x25')](handleEntityNotFound(_0x134941,null))[_0x309d('0x25')](removeEntity(_0x134941,null))[_0x309d('0x48')](handleError(_0x134941,null));}; \ No newline at end of file +var _0xb1f7=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','json','apply','reject','update','then','get','Dispositions','UserProfileResource','destroy','error','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','count','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5181dd,_0x23f6a6){var _0x5a41f7=function(_0x5129ac){while(--_0x5129ac){_0x5181dd['push'](_0x5181dd['shift']());}};_0x5a41f7(++_0x23f6a6);}(_0xb1f7,0x19d));var _0x7b1f=function(_0x577ce8,_0x3aab34){_0x577ce8=_0x577ce8-0x0;var _0x206ab9=_0xb1f7[_0x577ce8];return _0x206ab9;};'use strict';var emlformat=require(_0x7b1f('0x0'));var rimraf=require(_0x7b1f('0x1'));var zipdir=require(_0x7b1f('0x2'));var jsonpatch=require(_0x7b1f('0x3'));var rp=require(_0x7b1f('0x4'));var moment=require(_0x7b1f('0x5'));var BPromise=require(_0x7b1f('0x6'));var Mustache=require(_0x7b1f('0x7'));var util=require(_0x7b1f('0x8'));var path=require(_0x7b1f('0x9'));var sox=require(_0x7b1f('0xa'));var csv=require(_0x7b1f('0xb'));var ejs=require(_0x7b1f('0xc'));var fs=require('fs');var fs_extra=require(_0x7b1f('0xd'));var _=require(_0x7b1f('0xe'));var squel=require(_0x7b1f('0xf'));var crypto=require(_0x7b1f('0x10'));var jsforce=require(_0x7b1f('0x11'));var deskjs=require(_0x7b1f('0x12'));var toCsv=require(_0x7b1f('0xb'));var querystring=require(_0x7b1f('0x13'));var Papa=require(_0x7b1f('0x14'));var Redis=require(_0x7b1f('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b1f('0x16'));var logger=require(_0x7b1f('0x17'))(_0x7b1f('0x18'));var utils=require('../../config/utils');var config=require(_0x7b1f('0x19'));var licenseUtil=require(_0x7b1f('0x1a'));var db=require(_0x7b1f('0x1b'))['db'];function respondWithStatusCode(_0x3484db,_0x4c5029){_0x4c5029=_0x4c5029||0xcc;return function(_0x474bfb){if(_0x474bfb){return _0x3484db[_0x7b1f('0x1c')](_0x4c5029);}return _0x3484db[_0x7b1f('0x1d')](_0x4c5029)[_0x7b1f('0x1e')]();};}function respondWithResult(_0x359504,_0x367199){_0x367199=_0x367199||0xc8;return function(_0x558955){if(_0x558955){return _0x359504[_0x7b1f('0x1d')](_0x367199)['json'](_0x558955);}};}function respondWithFilteredResult(_0x57f110,_0x40e6cb){return function(_0x244ceb){if(_0x244ceb){var _0x3966f2=typeof _0x40e6cb['offset']===_0x7b1f('0x1f')&&typeof _0x40e6cb[_0x7b1f('0x20')]==='undefined';var _0x5d3ef2=_0x244ceb['count'];var _0x1c269c=_0x3966f2?0x0:_0x40e6cb[_0x7b1f('0x21')];var _0x3a6841=_0x3966f2?_0x244ceb['count']:_0x40e6cb[_0x7b1f('0x21')]+_0x40e6cb['limit'];var _0x22946c;if(_0x3a6841>=_0x5d3ef2){_0x3a6841=_0x5d3ef2;_0x22946c=0xc8;}else{_0x22946c=0xce;}_0x57f110[_0x7b1f('0x1d')](_0x22946c);return _0x57f110[_0x7b1f('0x22')]('Content-Range',_0x1c269c+'-'+_0x3a6841+'/'+_0x5d3ef2)[_0x7b1f('0x23')](_0x244ceb);}return null;};}function patchUpdates(_0x5a21aa){return function(_0x381979){try{jsonpatch[_0x7b1f('0x24')](_0x381979,_0x5a21aa,!![]);}catch(_0xf5a059){return BPromise[_0x7b1f('0x25')](_0xf5a059);}return _0x381979['save']();};}function saveUpdates(_0x5abce6,_0x264483){return function(_0x543310){if(_0x543310){return _0x543310[_0x7b1f('0x26')](_0x5abce6)[_0x7b1f('0x27')](function(_0x2c4588){return _0x2c4588;});}return null;};}function removeEntity(_0x54eb57,_0x580cbb){return function(_0x2bf0c2){if(_0x2bf0c2){return _0x2bf0c2['destroy']()[_0x7b1f('0x27')](function(){var _0xd09844=_0x2bf0c2[_0x7b1f('0x28')]({'plain':!![]});var _0x5de8e2=_0x7b1f('0x29');return db[_0x7b1f('0x2a')][_0x7b1f('0x2b')]({'where':{'type':_0x5de8e2,'resourceId':_0xd09844['id']}})[_0x7b1f('0x27')](function(){return _0x2bf0c2;});})['then'](function(){_0x54eb57[_0x7b1f('0x1d')](0xcc)[_0x7b1f('0x1e')]();});}};}function handleEntityNotFound(_0x20cf70,_0xf3764a){return function(_0x4878eb){if(!_0x4878eb){_0x20cf70[_0x7b1f('0x1c')](0x194);}return _0x4878eb;};}function handleError(_0x33b5bc,_0x44fe2b){_0x44fe2b=_0x44fe2b||0x1f4;return function(_0x46842d){logger[_0x7b1f('0x2c')](_0x46842d['stack']);if(_0x46842d[_0x7b1f('0x2d')]){delete _0x46842d[_0x7b1f('0x2d')];}_0x33b5bc['status'](_0x44fe2b)[_0x7b1f('0x2e')](_0x46842d);};}exports[_0x7b1f('0x2f')]=function(_0x1d9a17,_0x2132aa){var _0x7eb9d3={},_0x4b9985={},_0xadc0c5={'count':0x0,'rows':[]};var _0x45eba4=_[_0x7b1f('0x30')](db[_0x7b1f('0x31')][_0x7b1f('0x32')],function(_0x3dd4d2){return{'name':_0x3dd4d2[_0x7b1f('0x33')],'type':_0x3dd4d2['type'][_0x7b1f('0x34')]};});_0x4b9985[_0x7b1f('0x35')]=_[_0x7b1f('0x30')](_0x45eba4,_0x7b1f('0x2d'));_0x4b9985['query']=_[_0x7b1f('0x36')](_0x1d9a17[_0x7b1f('0x37')]);_0x4b9985[_0x7b1f('0x38')]=_[_0x7b1f('0x39')](_0x4b9985[_0x7b1f('0x35')],_0x4b9985[_0x7b1f('0x37')]);_0x7eb9d3['attributes']=_['intersection'](_0x4b9985[_0x7b1f('0x35')],qs[_0x7b1f('0x3a')](_0x1d9a17['query'][_0x7b1f('0x3a')]));_0x7eb9d3['attributes']=_0x7eb9d3[_0x7b1f('0x3b')][_0x7b1f('0x3c')]?_0x7eb9d3['attributes']:_0x4b9985[_0x7b1f('0x35')];if(!_0x1d9a17[_0x7b1f('0x37')][_0x7b1f('0x3d')](_0x7b1f('0x3e'))){_0x7eb9d3[_0x7b1f('0x20')]=qs['limit'](_0x1d9a17[_0x7b1f('0x37')][_0x7b1f('0x20')]);_0x7eb9d3[_0x7b1f('0x21')]=qs[_0x7b1f('0x21')](_0x1d9a17['query'][_0x7b1f('0x21')]);}_0x7eb9d3['order']=qs[_0x7b1f('0x3f')](_0x1d9a17['query']['sort']);_0x7eb9d3[_0x7b1f('0x40')]=qs['filters'](_['pick'](_0x1d9a17[_0x7b1f('0x37')],_0x4b9985['filters']),_0x45eba4);if(_0x1d9a17[_0x7b1f('0x37')][_0x7b1f('0x41')]){_0x7eb9d3[_0x7b1f('0x40')]=_[_0x7b1f('0x42')](_0x7eb9d3[_0x7b1f('0x40')],{'$or':_[_0x7b1f('0x30')](_0x45eba4,function(_0x11f317){if(_0x11f317[_0x7b1f('0x43')]!=='VIRTUAL'){var _0x5145ca={};_0x5145ca[_0x11f317[_0x7b1f('0x2d')]]={'$like':'%'+_0x1d9a17[_0x7b1f('0x37')][_0x7b1f('0x41')]+'%'};return _0x5145ca;}})});}_0x7eb9d3=_[_0x7b1f('0x42')]({},_0x7eb9d3,_0x1d9a17[_0x7b1f('0x44')]);var _0x1af615={'where':_0x7eb9d3['where']};return db[_0x7b1f('0x31')][_0x7b1f('0x45')](_0x1af615)[_0x7b1f('0x27')](function(_0x17bd0e){_0xadc0c5[_0x7b1f('0x45')]=_0x17bd0e;if(_0x1d9a17[_0x7b1f('0x37')]['includeAll']){_0x7eb9d3[_0x7b1f('0x46')]=[{'all':!![]}];}return db[_0x7b1f('0x31')][_0x7b1f('0x47')](_0x7eb9d3);})[_0x7b1f('0x27')](function(_0x3da300){_0xadc0c5[_0x7b1f('0x48')]=_0x3da300;return _0xadc0c5;})[_0x7b1f('0x27')](respondWithFilteredResult(_0x2132aa,_0x7eb9d3))[_0x7b1f('0x49')](handleError(_0x2132aa,null));};exports[_0x7b1f('0x4a')]=function(_0x4eea42,_0x34ff35){var _0x459ce3={'raw':!![],'where':{'id':_0x4eea42['params']['id']}},_0x228c09={};_0x228c09[_0x7b1f('0x35')]=_['keys'](db[_0x7b1f('0x31')][_0x7b1f('0x32')]);_0x228c09[_0x7b1f('0x37')]=_[_0x7b1f('0x36')](_0x4eea42[_0x7b1f('0x37')]);_0x228c09[_0x7b1f('0x38')]=_[_0x7b1f('0x39')](_0x228c09['model'],_0x228c09[_0x7b1f('0x37')]);_0x459ce3[_0x7b1f('0x3b')]=_[_0x7b1f('0x39')](_0x228c09[_0x7b1f('0x35')],qs[_0x7b1f('0x3a')](_0x4eea42[_0x7b1f('0x37')]['fields']));_0x459ce3[_0x7b1f('0x3b')]=_0x459ce3[_0x7b1f('0x3b')][_0x7b1f('0x3c')]?_0x459ce3[_0x7b1f('0x3b')]:_0x228c09[_0x7b1f('0x35')];if(_0x4eea42['query']['includeAll']){_0x459ce3['include']=[{'all':!![]}];}_0x459ce3=_['merge']({},_0x459ce3,_0x4eea42[_0x7b1f('0x44')]);return db[_0x7b1f('0x31')][_0x7b1f('0x4b')](_0x459ce3)[_0x7b1f('0x27')](handleEntityNotFound(_0x34ff35,null))['then'](respondWithResult(_0x34ff35,null))['catch'](handleError(_0x34ff35,null));};exports[_0x7b1f('0x4c')]=function(_0x289d88,_0x5af1b3){return db[_0x7b1f('0x31')]['create'](_0x289d88[_0x7b1f('0x4d')],{})['then'](function(_0x6b3af){var _0x362aa2=_0x289d88[_0x7b1f('0x4e')][_0x7b1f('0x28')]({'plain':!![]});if(!_0x362aa2)throw new Error(_0x7b1f('0x4f'));if(_0x362aa2[_0x7b1f('0x50')]===_0x7b1f('0x4e')){var _0x5a061c=_0x6b3af[_0x7b1f('0x28')]({'plain':!![]});var _0x1122e3=_0x7b1f('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x1122e3,'userProfileId':_0x362aa2[_0x7b1f('0x51')]},'raw':!![]})[_0x7b1f('0x27')](function(_0x5aad52){if(_0x5aad52&&_0x5aad52[_0x7b1f('0x52')]===0x0){return db[_0x7b1f('0x2a')][_0x7b1f('0x4c')]({'name':_0x5a061c['name'],'resourceId':_0x5a061c['id'],'type':_0x5aad52[_0x7b1f('0x2d')],'sectionId':_0x5aad52['id']},{})[_0x7b1f('0x27')](function(){return _0x6b3af;});}else{return _0x6b3af;}})[_0x7b1f('0x49')](function(_0x47e9e8){logger[_0x7b1f('0x2c')](_0x7b1f('0x53'),_0x47e9e8);throw _0x47e9e8;});}return _0x6b3af;})['then'](respondWithResult(_0x5af1b3,0xc9))['catch'](handleError(_0x5af1b3,null));};exports['update']=function(_0x22b6cf,_0x1e679a){if(_0x22b6cf[_0x7b1f('0x4d')]['id']){delete _0x22b6cf[_0x7b1f('0x4d')]['id'];}return db[_0x7b1f('0x31')][_0x7b1f('0x4b')]({'where':{'id':_0x22b6cf['params']['id']}})['then'](handleEntityNotFound(_0x1e679a,null))['then'](saveUpdates(_0x22b6cf[_0x7b1f('0x4d')],null))[_0x7b1f('0x27')](respondWithResult(_0x1e679a,null))[_0x7b1f('0x49')](handleError(_0x1e679a,null));};exports[_0x7b1f('0x2b')]=function(_0x1151e2,_0x3ebd49){return db[_0x7b1f('0x31')][_0x7b1f('0x4b')]({'where':{'id':_0x1151e2[_0x7b1f('0x54')]['id']}})[_0x7b1f('0x27')](handleEntityNotFound(_0x3ebd49,null))[_0x7b1f('0x27')](removeEntity(_0x3ebd49,null))[_0x7b1f('0x49')](handleError(_0x3ebd49,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2c85480..c2c7d2b 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 _0x24bc=['SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','name_sms'];(function(_0x104ada,_0xc16fff){var _0x70ab44=function(_0x5f2d8b){while(--_0x5f2d8b){_0x104ada['push'](_0x104ada['shift']());}};_0x70ab44(++_0xc16fff);}(_0x24bc,0xc6));var _0xc24b=function(_0x2f48cb,_0xea22fd){_0x2f48cb=_0x2f48cb-0x0;var _0x4ba3d2=_0x24bc[_0x2f48cb];return _0x4ba3d2;};'use strict';var _=require(_0xc24b('0x0'));var util=require(_0xc24b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc24b('0x2'));var rp=require(_0xc24b('0x3'));var fs=require('fs');var path=require(_0xc24b('0x4'));var rimraf=require(_0xc24b('0x5'));var config=require(_0xc24b('0x6'));var attributes=require('./disposition.attributes');module[_0xc24b('0x7')]=function(_0x1212fd,_0x28b350){return _0x1212fd[_0xc24b('0x8')](_0xc24b('0x9'),attributes,{'tableName':_0xc24b('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc24b('0xb'),'fields':['name',_0xc24b('0xc')]},{'unique':!![],'name':_0xc24b('0xd'),'fields':[_0xc24b('0xe'),_0xc24b('0xf')]},{'unique':!![],'name':_0xc24b('0x10'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xc24b('0x11'),'fields':[_0xc24b('0xe'),_0xc24b('0x12')]},{'unique':!![],'name':_0xc24b('0x13'),'fields':[_0xc24b('0xe'),_0xc24b('0x14')]},{'unique':!![],'name':_0xc24b('0x15'),'fields':[_0xc24b('0xe'),_0xc24b('0x16')]},{'unique':!![],'name':_0xc24b('0x17'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53bc=['api','moment','bluebird','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger'];(function(_0x428397,_0x3f5584){var _0x863826=function(_0x37bfc){while(--_0x37bfc){_0x428397['push'](_0x428397['shift']());}};_0x863826(++_0x3f5584);}(_0x53bc,0x1cc));var _0xc53b=function(_0x1c5b2b,_0x56d854){_0x1c5b2b=_0x1c5b2b-0x0;var _0x19d87e=_0x53bc[_0x1c5b2b];return _0x19d87e;};'use strict';var _=require(_0xc53b('0x0'));var util=require('util');var logger=require(_0xc53b('0x1'))(_0xc53b('0x2'));var moment=require(_0xc53b('0x3'));var BPromise=require(_0xc53b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53b('0x5'));var rimraf=require('rimraf');var config=require(_0xc53b('0x6'));var attributes=require(_0xc53b('0x7'));module[_0xc53b('0x8')]=function(_0x281ff0,_0x137de0){return _0x281ff0[_0xc53b('0x9')](_0xc53b('0xa'),attributes,{'tableName':_0xc53b('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc53b('0xc'),_0xc53b('0xd')]},{'unique':!![],'name':_0xc53b('0xe'),'fields':['name',_0xc53b('0xf')]},{'unique':!![],'name':_0xc53b('0x10'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xc53b('0xc'),'SmsAccountId']},{'unique':!![],'name':_0xc53b('0x11'),'fields':[_0xc53b('0xc'),'FaxAccountId']},{'unique':!![],'name':_0xc53b('0x12'),'fields':[_0xc53b('0xc'),_0xc53b('0x13')]},{'unique':!![],'name':_0xc53b('0x14'),'fields':['name',_0xc53b('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 78e99e6..5f327c0 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(_0x1e5b0e,_0x23af57){var _0x2183fb=function(_0xdea4db){while(--_0xdea4db){_0x1e5b0e['push'](_0x1e5b0e['shift']());}};_0x2183fb(++_0x23af57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0xb44eeb,_0x15506b){var _0x20b0e4=function(_0x349118){while(--_0x349118){_0xb44eeb['push'](_0xb44eeb['shift']());}};_0x20b0e4(++_0x15506b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 5d50b2f..2cd2861 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 _0x0f97=['post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x0f97,0x6a));var _0x70f9=function(_0x2f31d0,_0x4fce9a){_0x2f31d0=_0x2f31d0-0x0;var _0x1d0256=_0x0f97[_0x2f31d0];return _0x1d0256;};'use strict';var multer=require(_0x70f9('0x0'));var util=require('util');var path=require(_0x70f9('0x1'));var timeout=require(_0x70f9('0x2'));var express=require(_0x70f9('0x3'));var router=express[_0x70f9('0x4')]();var fs_extra=require(_0x70f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x70f9('0x6'));var config=require(_0x70f9('0x7'));var controller=require(_0x70f9('0x8'));router[_0x70f9('0x9')]('/',auth[_0x70f9('0xa')](),controller[_0x70f9('0xb')]);router[_0x70f9('0x9')](_0x70f9('0xc'),auth['isAuthenticated'](),controller[_0x70f9('0xd')]);router[_0x70f9('0xe')]('/',auth[_0x70f9('0xa')](),controller[_0x70f9('0xf')]);router[_0x70f9('0x10')](_0x70f9('0xc'),auth[_0x70f9('0xa')](),controller[_0x70f9('0x11')]);router[_0x70f9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x70f9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5c7b=['post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./disposition.controller','get','index','show'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x5c7b,0x194));var _0xb5c7=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5c7b[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0xb5c7('0x0'));var util=require(_0xb5c7('0x1'));var path=require(_0xb5c7('0x2'));var timeout=require(_0xb5c7('0x3'));var express=require('express');var router=express[_0xb5c7('0x4')]();var fs_extra=require(_0xb5c7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb5c7('0x6'));router[_0xb5c7('0x7')]('/',auth['isAuthenticated'](),controller[_0xb5c7('0x8')]);router[_0xb5c7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb5c7('0x9')]);router[_0xb5c7('0xa')]('/',auth[_0xb5c7('0xb')](),controller['create']);router[_0xb5c7('0xc')](_0xb5c7('0xd'),auth['isAuthenticated'](),controller[_0xb5c7('0xe')]);router[_0xb5c7('0xf')](_0xb5c7('0xd'),auth['isAuthenticated'](),controller[_0xb5c7('0x10')]);module[_0xb5c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0067fb3..040933c 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 _0x213c=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x213c,0x1cb));var _0xc213=function(_0x40998e,_0x16b0e0){_0x40998e=_0x40998e-0x0;var _0x48dbe9=_0x213c[_0x40998e];return _0x48dbe9;};'use strict';var Sequelize=require(_0xc213('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc213('0x1')]},'ecm':{'type':Sequelize[_0xc213('0x2')](_0xc213('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xc213('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xc213('0x1')],'unique':_0xc213('0x4')},'minrate':{'type':Sequelize[_0xc213('0x2')](_0xc213('0x5'),_0xc213('0x6'),_0xc213('0x7'),_0xc213('0x8'),'12000',_0xc213('0x9')),'defaultValue':_0xc213('0x6')},'maxrate':{'type':Sequelize[_0xc213('0x2')](_0xc213('0x5'),_0xc213('0x6'),_0xc213('0x7'),_0xc213('0x8'),_0xc213('0xa'),_0xc213('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xc213('0x1')],'defaultValue':_0xc213('0xb')},'gateway':{'type':Sequelize[_0xc213('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc213('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc213('0x2')]('SIP',_0xc213('0xc'),_0xc213('0xd'),_0xc213('0xe')),'defaultValue':_0xc213('0xf')},'key':{'type':Sequelize[_0xc213('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc213('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc213('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc213('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc213('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc213('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc213('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc213('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0xc213('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xc213('0x11')],'defaultValue':![],'comment':_0xc213('0x14'),'set':function(_0x4713d9){if(!_0x4713d9)this[_0xc213('0x15')](_0xc213('0x16'),null);this['setDataValue'](_0xc213('0x17'),_0x4713d9);}}}; \ No newline at end of file +var _0x1810=['14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x1810,0x116));var _0x0181=function(_0x598f1f,_0xa7d1c){_0x598f1f=_0x598f1f-0x0;var _0x26d77d=_0x1810[_0x598f1f];return _0x26d77d;};'use strict';var Sequelize=require(_0x0181('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x0181('0x1')]('yes','no'),'defaultValue':_0x0181('0x2')},'headerinfo':{'type':Sequelize[_0x0181('0x3')],'defaultValue':_0x0181('0x4')},'localstationid':{'type':Sequelize[_0x0181('0x3')],'unique':_0x0181('0x5')},'minrate':{'type':Sequelize[_0x0181('0x1')](_0x0181('0x6'),_0x0181('0x7'),_0x0181('0x8'),_0x0181('0x9'),'12000',_0x0181('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x0181('0x6'),_0x0181('0x7'),_0x0181('0x8'),_0x0181('0x9'),_0x0181('0xb'),'14400'),'defaultValue':_0x0181('0xa')},'modem':{'type':Sequelize[_0x0181('0x3')],'defaultValue':_0x0181('0xc')},'gateway':{'type':Sequelize[_0x0181('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0181('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0181('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0181('0x1')](_0x0181('0xe'),_0x0181('0xf'),_0x0181('0x10'),_0x0181('0x11')),'defaultValue':_0x0181('0xe')},'key':{'type':Sequelize[_0x0181('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0181('0x12')],'defaultValue':function(){return _0x0181('0x13');}},'notificationSound':{'type':Sequelize[_0x0181('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0181('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0181('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0181('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0181('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0181('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0181('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0181('0x14')],'defaultValue':![],'comment':_0x0181('0x15'),'set':function(_0x33cc21){if(!_0x33cc21)this[_0x0181('0x16')]('mandatoryDispositionPauseId',null);this[_0x0181('0x16')](_0x0181('0x17'),_0x33cc21);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 98ec682..42715b5 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 _0xf7ac=['removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','ids','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','create','body','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','findOne','hasOwnProperty','findAll'];(function(_0x35ec01,_0x5c44ac){var _0x4f75d5=function(_0x23ea8f){while(--_0x23ea8f){_0x35ec01['push'](_0x35ec01['shift']());}};_0x4f75d5(++_0x5c44ac);}(_0xf7ac,0x1df));var _0xcf7a=function(_0x4f4547,_0x2b7b2f){_0x4f4547=_0x4f4547-0x0;var _0x5541de=_0xf7ac[_0x4f4547];return _0x5541de;};'use strict';var emlformat=require(_0xcf7a('0x0'));var rimraf=require(_0xcf7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf7a('0x2'));var rp=require('request-promise');var moment=require(_0xcf7a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcf7a('0x4'));var util=require('util');var path=require(_0xcf7a('0x5'));var sox=require(_0xcf7a('0x6'));var csv=require('to-csv');var ejs=require(_0xcf7a('0x7'));var fs=require('fs');var fs_extra=require(_0xcf7a('0x8'));var _=require(_0xcf7a('0x9'));var squel=require(_0xcf7a('0xa'));var crypto=require(_0xcf7a('0xb'));var jsforce=require(_0xcf7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcf7a('0xd'));var querystring=require(_0xcf7a('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf7a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcf7a('0x10'));var as=require(_0xcf7a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcf7a('0x12'));var utils=require(_0xcf7a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcf7a('0x14'));var db=require(_0xcf7a('0x15'))['db'];config[_0xcf7a('0x16')]=_[_0xcf7a('0x17')](config[_0xcf7a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf7a('0x18'))(new Redis(config[_0xcf7a('0x16')]));require(_0xcf7a('0x19'))[_0xcf7a('0x1a')](socket);var jayson=require(_0xcf7a('0x1b'));var client=jayson[_0xcf7a('0x1c')][_0xcf7a('0x1d')]({'port':0x232c});var client9002=jayson[_0xcf7a('0x1c')][_0xcf7a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5b1581,_0x174c3d,_0x13ef18,_0x1f7620){return new BPromise(function(_0x443a58,_0x22c9a5){var _0x3dd1de=_0x1f7620||client;return _0x3dd1de[_0xcf7a('0x1e')](_0x5b1581,_0x13ef18)[_0xcf7a('0x1f')](function(_0x3dd478){logger[_0xcf7a('0x20')](_0xcf7a('0x21'),_0x174c3d,'request\x20sent');logger['debug'](_0xcf7a('0x22'),_0x174c3d,_0xcf7a('0x23'),JSON[_0xcf7a('0x24')](_0x3dd478));if(_0x3dd478[_0xcf7a('0x25')]){if(_0x3dd478[_0xcf7a('0x25')][_0xcf7a('0x26')]===0x1f4){logger[_0xcf7a('0x25')]('FaxAccount,\x20%s,\x20%s',_0x174c3d,_0x3dd478[_0xcf7a('0x25')][_0xcf7a('0x27')]);return _0x22c9a5(_0x3dd478[_0xcf7a('0x25')]['message']);}logger[_0xcf7a('0x25')](_0xcf7a('0x21'),_0x174c3d,_0x3dd478[_0xcf7a('0x25')][_0xcf7a('0x27')]);return _0x443a58(_0x3dd478[_0xcf7a('0x25')][_0xcf7a('0x27')]);}else{logger[_0xcf7a('0x20')](_0xcf7a('0x21'),_0x174c3d,'request\x20sent');_0x443a58(_0x3dd478[_0xcf7a('0x28')]['message']);}})['catch'](function(_0x21616f){logger[_0xcf7a('0x25')]('FaxAccount,\x20%s,\x20%s',_0x174c3d,_0x21616f);_0x22c9a5(_0x21616f);});});}function respondWithStatusCode(_0xc65d23,_0xbbb0b8){_0xbbb0b8=_0xbbb0b8||0xcc;return function(_0x3da524){if(_0x3da524){return _0xc65d23[_0xcf7a('0x29')](_0xbbb0b8);}return _0xc65d23[_0xcf7a('0x2a')](_0xbbb0b8)[_0xcf7a('0x2b')]();};}function respondWithResult(_0xb67b12,_0x173f21){_0x173f21=_0x173f21||0xc8;return function(_0x48da41){if(_0x48da41){return _0xb67b12[_0xcf7a('0x2a')](_0x173f21)['json'](_0x48da41);}};}function respondWithFilteredResult(_0x448aeb,_0x53e6de){return function(_0x55619d){if(_0x55619d){var _0x467caf=typeof _0x53e6de[_0xcf7a('0x2c')]===_0xcf7a('0x2d')&&typeof _0x53e6de['limit']===_0xcf7a('0x2d');var _0x2be31a=_0x55619d[_0xcf7a('0x2e')];var _0x3ceff5=_0x467caf?0x0:_0x53e6de[_0xcf7a('0x2c')];var _0x1978f1=_0x467caf?_0x55619d[_0xcf7a('0x2e')]:_0x53e6de['offset']+_0x53e6de[_0xcf7a('0x2f')];var _0x550edd;if(_0x1978f1>=_0x2be31a){_0x1978f1=_0x2be31a;_0x550edd=0xc8;}else{_0x550edd=0xce;}_0x448aeb['status'](_0x550edd);return _0x448aeb[_0xcf7a('0x30')](_0xcf7a('0x31'),_0x3ceff5+'-'+_0x1978f1+'/'+_0x2be31a)['json'](_0x55619d);}return null;};}function patchUpdates(_0x120cfe){return function(_0x5bcafc){try{jsonpatch[_0xcf7a('0x32')](_0x5bcafc,_0x120cfe,!![]);}catch(_0x4dbd31){return BPromise[_0xcf7a('0x33')](_0x4dbd31);}return _0x5bcafc[_0xcf7a('0x34')]();};}function saveUpdates(_0x52f289,_0xf8eb10){return function(_0x5cf216){if(_0x5cf216){return _0x5cf216[_0xcf7a('0x35')](_0x52f289)[_0xcf7a('0x1f')](function(_0x396a86){return _0x396a86;});}return null;};}function removeEntity(_0x4d2b62,_0x5cfc85){return function(_0x2c9bba){if(_0x2c9bba){return _0x2c9bba[_0xcf7a('0x36')]()[_0xcf7a('0x1f')](function(){var _0x366e28=_0x2c9bba[_0xcf7a('0x37')]({'plain':!![]});var _0x50f20f=_0xcf7a('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x50f20f,'resourceId':_0x366e28['id']}})[_0xcf7a('0x1f')](function(){return _0x2c9bba;});})[_0xcf7a('0x1f')](function(){_0x4d2b62[_0xcf7a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x388a21,_0x484f65){return function(_0x379298){if(!_0x379298){_0x388a21[_0xcf7a('0x29')](0x194);}return _0x379298;};}function handleError(_0x141bdc,_0x433965){_0x433965=_0x433965||0x1f4;return function(_0x2ab20a){logger[_0xcf7a('0x25')](_0x2ab20a[_0xcf7a('0x39')]);if(_0x2ab20a[_0xcf7a('0x3a')]){delete _0x2ab20a[_0xcf7a('0x3a')];}_0x141bdc['status'](_0x433965)[_0xcf7a('0x3b')](_0x2ab20a);};}exports['index']=function(_0x51f008,_0x2d72e3){var _0x1cdfff={'include':[{'model':db[_0xcf7a('0x3c')],'as':_0xcf7a('0x3d')}]},_0x344309={},_0x5ab18b={'count':0x0,'rows':[]};var _0x2e2362=_[_0xcf7a('0x3e')](db[_0xcf7a('0x3f')][_0xcf7a('0x40')],function(_0x1e9ada){return{'name':_0x1e9ada[_0xcf7a('0x41')],'type':_0x1e9ada[_0xcf7a('0x42')][_0xcf7a('0x43')]};});_0x344309['model']=_[_0xcf7a('0x3e')](_0x2e2362,_0xcf7a('0x3a'));_0x344309[_0xcf7a('0x44')]=_[_0xcf7a('0x45')](_0x51f008['query']);_0x344309[_0xcf7a('0x46')]=_[_0xcf7a('0x47')](_0x344309['model'],_0x344309[_0xcf7a('0x44')]);_0x1cdfff[_0xcf7a('0x48')]=_[_0xcf7a('0x47')](_0x344309['model'],qs[_0xcf7a('0x49')](_0x51f008[_0xcf7a('0x44')][_0xcf7a('0x49')]));_0x1cdfff['attributes']=_0x1cdfff[_0xcf7a('0x48')]['length']?_0x1cdfff[_0xcf7a('0x48')]:_0x344309[_0xcf7a('0x4a')];if(!_0x51f008[_0xcf7a('0x44')]['hasOwnProperty'](_0xcf7a('0x4b'))){_0x1cdfff['limit']=qs[_0xcf7a('0x2f')](_0x51f008[_0xcf7a('0x44')]['limit']);_0x1cdfff[_0xcf7a('0x2c')]=qs[_0xcf7a('0x2c')](_0x51f008[_0xcf7a('0x44')][_0xcf7a('0x2c')]);}_0x1cdfff[_0xcf7a('0x4c')]=qs[_0xcf7a('0x4d')](_0x51f008[_0xcf7a('0x44')][_0xcf7a('0x4d')]);_0x1cdfff[_0xcf7a('0x4e')]=qs[_0xcf7a('0x46')](_[_0xcf7a('0x4f')](_0x51f008['query'],_0x344309[_0xcf7a('0x46')]),_0x2e2362);if(_0x51f008[_0xcf7a('0x44')]['filter']){_0x1cdfff[_0xcf7a('0x4e')]=_[_0xcf7a('0x50')](_0x1cdfff[_0xcf7a('0x4e')],{'$or':_[_0xcf7a('0x3e')](_0x2e2362,function(_0x380937){if(_0x380937[_0xcf7a('0x42')]!==_0xcf7a('0x51')){var _0x56242b={};_0x56242b[_0x380937[_0xcf7a('0x3a')]]={'$like':'%'+_0x51f008[_0xcf7a('0x44')][_0xcf7a('0x52')]+'%'};return _0x56242b;}})});}_0x1cdfff=_[_0xcf7a('0x50')]({},_0x1cdfff,_0x51f008[_0xcf7a('0x53')]);var _0x5c364d={'where':_0x1cdfff[_0xcf7a('0x4e')]};return db[_0xcf7a('0x3f')][_0xcf7a('0x2e')](_0x5c364d)[_0xcf7a('0x1f')](function(_0x41ada1){_0x5ab18b[_0xcf7a('0x2e')]=_0x41ada1;if(_0x51f008['query'][_0xcf7a('0x54')]){_0x1cdfff[_0xcf7a('0x55')]=[{'all':!![]}];}return db[_0xcf7a('0x3f')]['findAll'](_0x1cdfff);})[_0xcf7a('0x1f')](function(_0x29bd7f){_0x5ab18b[_0xcf7a('0x56')]=_0x29bd7f;return _0x5ab18b;})['then'](respondWithFilteredResult(_0x2d72e3,_0x1cdfff))[_0xcf7a('0x57')](handleError(_0x2d72e3,null));};exports[_0xcf7a('0x58')]=function(_0x1de8b8,_0x3f039c){var _0x7573fe={'raw':![],'where':{'id':_0x1de8b8['params']['id']},'include':[{'model':db[_0xcf7a('0x3c')],'as':_0xcf7a('0x3d')}]},_0x4c2829={};_0x4c2829[_0xcf7a('0x4a')]=_[_0xcf7a('0x45')](db[_0xcf7a('0x3f')][_0xcf7a('0x40')]);_0x4c2829[_0xcf7a('0x44')]=_['keys'](_0x1de8b8[_0xcf7a('0x44')]);_0x4c2829[_0xcf7a('0x46')]=_['intersection'](_0x4c2829[_0xcf7a('0x4a')],_0x4c2829[_0xcf7a('0x44')]);_0x7573fe[_0xcf7a('0x48')]=_[_0xcf7a('0x47')](_0x4c2829[_0xcf7a('0x4a')],qs[_0xcf7a('0x49')](_0x1de8b8['query'][_0xcf7a('0x49')]));_0x7573fe[_0xcf7a('0x48')]=_0x7573fe[_0xcf7a('0x48')][_0xcf7a('0x59')]?_0x7573fe['attributes']:_0x4c2829[_0xcf7a('0x4a')];if(_0x1de8b8[_0xcf7a('0x44')]['includeAll']){_0x7573fe['include']=[{'all':!![]}];}_0x7573fe=_[_0xcf7a('0x50')]({},_0x7573fe,_0x1de8b8[_0xcf7a('0x53')]);return db['FaxAccount'][_0xcf7a('0x5a')](_0x7573fe)[_0xcf7a('0x1f')](handleEntityNotFound(_0x3f039c,null))[_0xcf7a('0x1f')](respondWithResult(_0x3f039c,null))[_0xcf7a('0x57')](handleError(_0x3f039c,null));};exports[_0xcf7a('0x5b')]=function(_0x3bf993,_0x5dc5e1){return db[_0xcf7a('0x3f')][_0xcf7a('0x5b')](_0x3bf993[_0xcf7a('0x5c')],{})[_0xcf7a('0x1f')](function(_0x1212e2){var _0x308e15=_0x3bf993[_0xcf7a('0x5d')]['get']({'plain':!![]});if(!_0x308e15)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x308e15[_0xcf7a('0x5e')]===_0xcf7a('0x5d')){var _0x393260=_0x1212e2[_0xcf7a('0x37')]({'plain':!![]});var _0xbc0540=_0xcf7a('0x38');return db['UserProfileSection'][_0xcf7a('0x5a')]({'where':{'name':_0xbc0540,'userProfileId':_0x308e15[_0xcf7a('0x5f')]},'raw':!![]})[_0xcf7a('0x1f')](function(_0x23e1d8){if(_0x23e1d8&&_0x23e1d8['autoAssociation']===0x0){return db[_0xcf7a('0x60')][_0xcf7a('0x5b')]({'name':_0x393260[_0xcf7a('0x3a')],'resourceId':_0x393260['id'],'type':_0x23e1d8[_0xcf7a('0x3a')],'sectionId':_0x23e1d8['id']},{})[_0xcf7a('0x1f')](function(){return _0x1212e2;});}else{return _0x1212e2;}})['catch'](function(_0x30d638){logger[_0xcf7a('0x25')](_0xcf7a('0x61'),_0x30d638);throw _0x30d638;});}return _0x1212e2;})[_0xcf7a('0x1f')](respondWithResult(_0x5dc5e1,0xc9))[_0xcf7a('0x57')](handleError(_0x5dc5e1,null));};exports['update']=function(_0x31c13c,_0x2f70d9){if(_0x31c13c['body']['id']){delete _0x31c13c['body']['id'];}return db[_0xcf7a('0x3f')][_0xcf7a('0x5a')]({'where':{'id':_0x31c13c[_0xcf7a('0x62')]['id']},'include':[{'model':db[_0xcf7a('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xcf7a('0x1f')](handleEntityNotFound(_0x2f70d9,null))[_0xcf7a('0x1f')](saveUpdates(_0x31c13c[_0xcf7a('0x5c')],null))[_0xcf7a('0x1f')](respondWithResult(_0x2f70d9,null))[_0xcf7a('0x57')](handleError(_0x2f70d9,null));};exports[_0xcf7a('0x36')]=function(_0x3b7fc2,_0x5cc717){return db['FaxAccount']['find']({'where':{'id':_0x3b7fc2[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x5cc717,null))[_0xcf7a('0x1f')](removeEntity(_0x5cc717,null))[_0xcf7a('0x57')](handleError(_0x5cc717,null));};exports[_0xcf7a('0x63')]=function(_0x4ec890,_0x1b1990){return db['FaxAccount'][_0xcf7a('0x63')]()['then'](respondWithResult(_0x1b1990,null))['catch'](handleError(_0x1b1990,null));};exports[_0xcf7a('0x64')]=function(_0xc581de,_0x5bf3e0,_0x3dbf08){if(_0xc581de[_0xcf7a('0x5c')]['id']){delete _0xc581de['body']['id'];}return db[_0xcf7a('0x3f')][_0xcf7a('0x5a')]({'where':{'id':_0xc581de['params']['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x5bf3e0,null))['then'](function(_0x3fe2fb){if(_0x3fe2fb){_0xc581de[_0xcf7a('0x5c')][_0xcf7a('0x65')]=_0x3fe2fb['id'];return db[_0xcf7a('0x66')][_0xcf7a('0x5b')](_0xc581de[_0xcf7a('0x5c')]);}})['then'](respondWithResult(_0x5bf3e0,null))[_0xcf7a('0x57')](handleError(_0x5bf3e0,null));};exports['getDispositions']=function(_0x3a431a,_0x3f78b1,_0x4c3017){var _0x8becdd={'raw':![],'where':{}};var _0x17088d={};var _0x5bc310={'count':0x0,'rows':[]};return db[_0xcf7a('0x3f')][_0xcf7a('0x67')]({'where':{'id':_0x3a431a['params']['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x3f78b1,null))[_0xcf7a('0x1f')](function(_0x389451){if(_0x389451){_0x17088d[_0xcf7a('0x4a')]=_[_0xcf7a('0x45')](db[_0xcf7a('0x66')][_0xcf7a('0x40')]);_0x17088d[_0xcf7a('0x44')]=_['keys'](_0x3a431a[_0xcf7a('0x44')]);_0x17088d[_0xcf7a('0x46')]=_[_0xcf7a('0x47')](_0x17088d[_0xcf7a('0x4a')],_0x17088d['query']);_0x8becdd[_0xcf7a('0x48')]=_[_0xcf7a('0x47')](_0x17088d[_0xcf7a('0x4a')],qs[_0xcf7a('0x49')](_0x3a431a[_0xcf7a('0x44')][_0xcf7a('0x49')]));_0x8becdd[_0xcf7a('0x48')]=_0x8becdd[_0xcf7a('0x48')][_0xcf7a('0x59')]?_0x8becdd[_0xcf7a('0x48')]:_0x17088d['model'];if(!_0x3a431a['query'][_0xcf7a('0x68')]('nolimit')){_0x8becdd[_0xcf7a('0x2f')]=qs[_0xcf7a('0x2f')](_0x3a431a[_0xcf7a('0x44')]['limit']);_0x8becdd[_0xcf7a('0x2c')]=qs[_0xcf7a('0x2c')](_0x3a431a[_0xcf7a('0x44')][_0xcf7a('0x2c')]);}_0x8becdd['order']=qs[_0xcf7a('0x4d')](_0x3a431a[_0xcf7a('0x44')][_0xcf7a('0x4d')]);_0x8becdd[_0xcf7a('0x4e')]=qs[_0xcf7a('0x46')](_[_0xcf7a('0x4f')](_0x3a431a['query'],_0x17088d['filters']));_0x8becdd['where'][_0xcf7a('0x65')]=_0x389451['id'];if(_0x3a431a['query'][_0xcf7a('0x52')]){_0x8becdd['where']=_[_0xcf7a('0x50')](_0x8becdd[_0xcf7a('0x4e')],{'$or':_[_0xcf7a('0x3e')](_0x8becdd[_0xcf7a('0x48')],function(_0x52cd15){var _0x5ad693={};_0x5ad693[_0x52cd15]={'$like':'%'+_0x3a431a[_0xcf7a('0x44')]['filter']+'%'};return _0x5ad693;})});}_0x8becdd=_[_0xcf7a('0x50')]({},_0x8becdd,_0x3a431a[_0xcf7a('0x53')]);return db[_0xcf7a('0x66')][_0xcf7a('0x2e')]({'where':_0x8becdd[_0xcf7a('0x4e')]})[_0xcf7a('0x1f')](function(_0x44806c){_0x5bc310[_0xcf7a('0x2e')]=_0x44806c;if(_0x3a431a[_0xcf7a('0x44')]['includeAll']){_0x8becdd[_0xcf7a('0x55')]=[{'all':!![]}];}return db[_0xcf7a('0x66')][_0xcf7a('0x69')](_0x8becdd);})['then'](function(_0x269188){_0x5bc310[_0xcf7a('0x56')]=_0x269188;return _0x5bc310;});}})['then'](respondWithFilteredResult(_0x3f78b1,_0x8becdd))[_0xcf7a('0x57')](handleError(_0x3f78b1,null));};exports[_0xcf7a('0x6a')]=function(_0x1b1299,_0x34f5bd,_0x27276b){return db['FaxAccount'][_0xcf7a('0x5a')]({'where':{'id':_0x1b1299['params']['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x34f5bd,null))[_0xcf7a('0x1f')](function(_0x417669){if(_0x417669){return _0x417669[_0xcf7a('0x6a')](_0x1b1299[_0xcf7a('0x44')]['ids']);}})[_0xcf7a('0x1f')](respondWithStatusCode(_0x34f5bd,null))['catch'](handleError(_0x34f5bd,null));};exports[_0xcf7a('0x6b')]=function(_0x1d7275,_0x35a9e2,_0x148baf){if(_0x1d7275[_0xcf7a('0x5c')]['id']){delete _0x1d7275[_0xcf7a('0x5c')]['id'];}return db[_0xcf7a('0x3f')][_0xcf7a('0x5a')]({'where':{'id':_0x1d7275[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x35a9e2,null))[_0xcf7a('0x1f')](function(_0x1aac56){if(_0x1aac56){_0x1d7275[_0xcf7a('0x5c')][_0xcf7a('0x65')]=_0x1aac56['id'];return db[_0xcf7a('0x6c')][_0xcf7a('0x5b')](_0x1d7275[_0xcf7a('0x5c')]);}})[_0xcf7a('0x1f')](respondWithResult(_0x35a9e2,null))[_0xcf7a('0x57')](handleError(_0x35a9e2,null));};exports[_0xcf7a('0x6d')]=function(_0x2aed00,_0x45678d,_0xbe39d1){var _0x57706e={'raw':![],'where':{}};var _0x2709b6={};var _0x1632db={'count':0x0,'rows':[]};return db[_0xcf7a('0x3f')]['findOne']({'where':{'id':_0x2aed00[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x45678d,null))[_0xcf7a('0x1f')](function(_0x3c7638){if(_0x3c7638){_0x2709b6[_0xcf7a('0x4a')]=_[_0xcf7a('0x45')](db[_0xcf7a('0x6c')]['rawAttributes']);_0x2709b6[_0xcf7a('0x44')]=_[_0xcf7a('0x45')](_0x2aed00[_0xcf7a('0x44')]);_0x2709b6[_0xcf7a('0x46')]=_['intersection'](_0x2709b6['model'],_0x2709b6[_0xcf7a('0x44')]);_0x57706e[_0xcf7a('0x48')]=_[_0xcf7a('0x47')](_0x2709b6[_0xcf7a('0x4a')],qs[_0xcf7a('0x49')](_0x2aed00[_0xcf7a('0x44')][_0xcf7a('0x49')]));_0x57706e[_0xcf7a('0x48')]=_0x57706e[_0xcf7a('0x48')]['length']?_0x57706e[_0xcf7a('0x48')]:_0x2709b6['model'];if(!_0x2aed00[_0xcf7a('0x44')][_0xcf7a('0x68')]('nolimit')){_0x57706e[_0xcf7a('0x2f')]=qs[_0xcf7a('0x2f')](_0x2aed00['query']['limit']);_0x57706e['offset']=qs[_0xcf7a('0x2c')](_0x2aed00[_0xcf7a('0x44')][_0xcf7a('0x2c')]);}_0x57706e[_0xcf7a('0x4c')]=qs['sort'](_0x2aed00[_0xcf7a('0x44')][_0xcf7a('0x4d')]);_0x57706e[_0xcf7a('0x4e')]=qs[_0xcf7a('0x46')](_[_0xcf7a('0x4f')](_0x2aed00[_0xcf7a('0x44')],_0x2709b6[_0xcf7a('0x46')]));_0x57706e[_0xcf7a('0x4e')][_0xcf7a('0x65')]=_0x3c7638['id'];if(_0x2aed00[_0xcf7a('0x44')]['filter']){_0x57706e[_0xcf7a('0x4e')]=_[_0xcf7a('0x50')](_0x57706e['where'],{'$or':_[_0xcf7a('0x3e')](_0x57706e[_0xcf7a('0x48')],function(_0xe72e1c){var _0xa3c016={};_0xa3c016[_0xe72e1c]={'$like':'%'+_0x2aed00[_0xcf7a('0x44')][_0xcf7a('0x52')]+'%'};return _0xa3c016;})});}_0x57706e=_[_0xcf7a('0x50')]({},_0x57706e,_0x2aed00[_0xcf7a('0x53')]);return db[_0xcf7a('0x6c')][_0xcf7a('0x2e')]({'where':_0x57706e['where']})[_0xcf7a('0x1f')](function(_0x311197){_0x1632db[_0xcf7a('0x2e')]=_0x311197;if(_0x2aed00[_0xcf7a('0x44')][_0xcf7a('0x54')]){_0x57706e[_0xcf7a('0x55')]=[{'all':!![]}];}return db[_0xcf7a('0x6c')][_0xcf7a('0x69')](_0x57706e);})['then'](function(_0x2ad720){_0x1632db['rows']=_0x2ad720;return _0x1632db;});}})[_0xcf7a('0x1f')](respondWithFilteredResult(_0x45678d,_0x57706e))[_0xcf7a('0x57')](handleError(_0x45678d,null));};exports[_0xcf7a('0x6e')]=function(_0x556574,_0x2c27de,_0x2c496e){return db[_0xcf7a('0x3f')][_0xcf7a('0x5a')]({'where':{'id':_0x556574[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x2c27de,null))[_0xcf7a('0x1f')](function(_0x57b23e){if(_0x57b23e){return _0x57b23e['removeAnswers'](_0x556574[_0xcf7a('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x2c27de,null))['catch'](handleError(_0x2c27de,null));};exports['addInteraction']=function(_0x221888,_0x3fa237,_0xb517e4){return db[_0xcf7a('0x6f')][_0xcf7a('0x5a')]({'where':{'id':_0x221888[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x3fa237,null))[_0xcf7a('0x1f')](function(_0x39669b){if(_0x39669b){return _0x39669b[_0xcf7a('0x70')](_0x221888[_0xcf7a('0x5c')][_0xcf7a('0x71')],_[_0xcf7a('0x72')](_0x221888[_0xcf7a('0x5c')],[_0xcf7a('0x71'),'id'])||{});}})[_0xcf7a('0x1f')](respondWithResult(_0x3fa237,null))[_0xcf7a('0x57')](handleError(_0x3fa237,null));};exports[_0xcf7a('0x73')]=function(_0x53cd60,_0x155ed7,_0x5d0cd8){var _0x24e8ad={'raw':![],'where':{}};var _0x25d73d={};var _0x565e4a={'count':0x0,'rows':[]};return db[_0xcf7a('0x3f')][_0xcf7a('0x67')]({'where':{'id':_0x53cd60[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x155ed7,null))[_0xcf7a('0x1f')](function(_0x30fa5){if(_0x30fa5){_0x25d73d[_0xcf7a('0x4a')]=_[_0xcf7a('0x45')](db[_0xcf7a('0x6f')]['rawAttributes']);_0x25d73d['query']=_[_0xcf7a('0x45')](_0x53cd60[_0xcf7a('0x44')]);_0x25d73d[_0xcf7a('0x46')]=_['intersection'](_0x25d73d['model'],_0x25d73d[_0xcf7a('0x44')]);_0x24e8ad[_0xcf7a('0x48')]=_[_0xcf7a('0x47')](_0x25d73d[_0xcf7a('0x4a')],qs[_0xcf7a('0x49')](_0x53cd60[_0xcf7a('0x44')][_0xcf7a('0x49')]));_0x24e8ad[_0xcf7a('0x48')]=_0x24e8ad[_0xcf7a('0x48')][_0xcf7a('0x59')]?_0x24e8ad['attributes']:_0x25d73d[_0xcf7a('0x4a')];if(!_0x53cd60['query']['hasOwnProperty'](_0xcf7a('0x4b'))){_0x24e8ad[_0xcf7a('0x2f')]=qs[_0xcf7a('0x2f')](_0x53cd60[_0xcf7a('0x44')][_0xcf7a('0x2f')]);_0x24e8ad[_0xcf7a('0x2c')]=qs[_0xcf7a('0x2c')](_0x53cd60[_0xcf7a('0x44')][_0xcf7a('0x2c')]);}_0x24e8ad['order']=qs[_0xcf7a('0x4d')](_0x53cd60[_0xcf7a('0x44')][_0xcf7a('0x4d')]);_0x24e8ad[_0xcf7a('0x4e')]=qs[_0xcf7a('0x46')](_[_0xcf7a('0x4f')](_0x53cd60[_0xcf7a('0x44')],_0x25d73d[_0xcf7a('0x46')]));_0x24e8ad['where'][_0xcf7a('0x65')]=_0x30fa5['id'];if(_0x53cd60[_0xcf7a('0x44')][_0xcf7a('0x52')]){_0x24e8ad[_0xcf7a('0x4e')]=_[_0xcf7a('0x50')](_0x24e8ad[_0xcf7a('0x4e')],{'$or':_['map'](_0x24e8ad[_0xcf7a('0x48')],function(_0x538fb8){var _0x578f9a={};_0x578f9a[_0x538fb8]={'$like':'%'+_0x53cd60[_0xcf7a('0x44')][_0xcf7a('0x52')]+'%'};return _0x578f9a;})});}_0x24e8ad=_[_0xcf7a('0x50')]({},_0x24e8ad,_0x53cd60[_0xcf7a('0x53')]);return db[_0xcf7a('0x6f')]['count']({'where':_0x24e8ad['where']})[_0xcf7a('0x1f')](function(_0x9ae5f4){_0x565e4a[_0xcf7a('0x2e')]=_0x9ae5f4;if(_0x53cd60['query'][_0xcf7a('0x54')]){_0x24e8ad[_0xcf7a('0x55')]=[{'model':db[_0xcf7a('0x74')],'as':_0xcf7a('0x75'),'required':![]},{'model':db[_0xcf7a('0x76')],'as':'Owner','attributes':['name',_0xcf7a('0x77'),_0xcf7a('0x78')],'required':![]},{'model':db[_0xcf7a('0x79')],'as':_0xcf7a('0x7a'),'attributes':['id','name',_0xcf7a('0x7b')],'where':_0x53cd60['query']['tag']?{'id':_0x53cd60[_0xcf7a('0x44')]['tag']}:undefined,'required':_0x53cd60[_0xcf7a('0x44')][_0xcf7a('0x7c')]?!![]:![]}];}return db[_0xcf7a('0x6f')]['findAll'](_0x24e8ad);})[_0xcf7a('0x1f')](function(_0x45a1c5){_0x565e4a['rows']=_0x45a1c5;return _0x565e4a;});}})[_0xcf7a('0x1f')](respondWithFilteredResult(_0x155ed7,_0x24e8ad))['catch'](handleError(_0x155ed7,null));};exports[_0xcf7a('0x7d')]=function(_0x402871,_0x48121e){var _0x2efe0c=_0x402871[_0xcf7a('0x62')]['id'];var _0x7afba9=_0x402871['body'];var _0x3403eb=0xc8;var _0x359428=null;return db[_0xcf7a('0x7e')][_0xcf7a('0x7f')]({'isolationLevel':db[_0xcf7a('0x7e')]['Transaction'][_0xcf7a('0x80')][_0xcf7a('0x81')]},function(_0xb0c43){return db[_0xcf7a('0x3f')][_0xcf7a('0x67')]({'where':{'id':_0x2efe0c},'transaction':_0xb0c43})[_0xcf7a('0x1f')](function(_0x21d783){if(_0x21d783){return db['FaxApplication'][_0xcf7a('0x36')]({'where':{'FaxAccountId':_0x2efe0c},'transaction':_0xb0c43})[_0xcf7a('0x1f')](function(){var _0x4d04e8=_[_0xcf7a('0x3e')](_0x7afba9,function(_0x1580c9){_0x1580c9[_0xcf7a('0x65')]=_0x2efe0c;return _0x1580c9;});return db[_0xcf7a('0x82')][_0xcf7a('0x83')](_0x4d04e8,{'transaction':_0xb0c43});});}else{_0x3403eb=0x194;_0x359428=[];}});})[_0xcf7a('0x1f')](function(){if(_0x3403eb!==0x194){return db[_0xcf7a('0x82')]['findAndCountAll']({'where':{'FaxAccountId':_0x2efe0c},'order':_0xcf7a('0x84')})[_0xcf7a('0x1f')](function(_0x682386){_0x359428=_0x682386;});}})[_0xcf7a('0x57')](function(_0x157b09){_0x3403eb=0x1f4;logger[_0xcf7a('0x25')](_0x157b09[_0xcf7a('0x39')]);if(_0x157b09['name']){delete _0x157b09[_0xcf7a('0x3a')];}_0x359428=_0x157b09;})[_0xcf7a('0x85')](function(){if(_0x359428===null){_0x48121e['sendStatus'](_0x3403eb);}else{if(_0x3403eb===0x1f4){_0x48121e['status'](_0x3403eb)[_0xcf7a('0x3b')](_0x359428);}else{_0x48121e[_0xcf7a('0x2a')](_0x3403eb)['json'](_0x359428);}}});};exports[_0xcf7a('0x86')]=function(_0x7edef7,_0x4e67e0,_0x3aa3ab){var _0x3f0532={};var _0x1446bb={};var _0x467925;var _0x44a5e3;return db[_0xcf7a('0x3f')][_0xcf7a('0x67')]({'where':{'id':_0x7edef7[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x4e67e0,null))[_0xcf7a('0x1f')](function(_0x4410ae){if(_0x4410ae){_0x467925=_0x4410ae;_0x1446bb[_0xcf7a('0x4a')]=_['keys'](db[_0xcf7a('0x82')][_0xcf7a('0x40')]);_0x1446bb[_0xcf7a('0x44')]=_[_0xcf7a('0x45')](_0x7edef7[_0xcf7a('0x44')]);_0x1446bb[_0xcf7a('0x46')]=_[_0xcf7a('0x47')](_0x1446bb['model'],_0x1446bb[_0xcf7a('0x44')]);_0x3f0532['attributes']=_[_0xcf7a('0x47')](_0x1446bb[_0xcf7a('0x4a')],qs[_0xcf7a('0x49')](_0x7edef7[_0xcf7a('0x44')][_0xcf7a('0x49')]));_0x3f0532['attributes']=_0x3f0532[_0xcf7a('0x48')][_0xcf7a('0x59')]?_0x3f0532[_0xcf7a('0x48')]:_0x1446bb[_0xcf7a('0x4a')];_0x3f0532[_0xcf7a('0x4c')]=qs[_0xcf7a('0x4d')](_0x7edef7[_0xcf7a('0x44')]['sort']);_0x3f0532[_0xcf7a('0x4e')]=qs[_0xcf7a('0x46')](_[_0xcf7a('0x4f')](_0x7edef7[_0xcf7a('0x44')],_0x1446bb[_0xcf7a('0x46')]));if(_0x7edef7['query'][_0xcf7a('0x52')]){_0x3f0532[_0xcf7a('0x4e')]=_[_0xcf7a('0x50')](_0x3f0532[_0xcf7a('0x4e')],{'$or':_['map'](_0x3f0532[_0xcf7a('0x48')],function(_0x178c4a){var _0x1dc92e={};_0x1dc92e[_0x178c4a]={'$like':'%'+_0x7edef7[_0xcf7a('0x44')][_0xcf7a('0x52')]+'%'};return _0x1dc92e;})});}_0x3f0532=_[_0xcf7a('0x50')]({},_0x3f0532,_0x7edef7[_0xcf7a('0x53')]);return _0x467925['getApplications'](_0x3f0532);}})[_0xcf7a('0x1f')](function(_0x10cb71){if(_0x10cb71){_0x44a5e3=_0x10cb71[_0xcf7a('0x59')];if(!_0x7edef7[_0xcf7a('0x44')][_0xcf7a('0x68')](_0xcf7a('0x4b'))){_0x3f0532['limit']=qs['limit'](_0x7edef7[_0xcf7a('0x44')]['limit']);_0x3f0532[_0xcf7a('0x2c')]=qs['offset'](_0x7edef7[_0xcf7a('0x44')][_0xcf7a('0x2c')]);}return _0x467925['getApplications'](_0x3f0532);}})['then'](function(_0x27333c){if(_0x27333c){return _0x27333c?{'count':_0x44a5e3,'rows':_0x27333c}:null;}})[_0xcf7a('0x1f')](respondWithResult(_0x4e67e0,null))['catch'](handleError(_0x4e67e0,null));};function Extension(_0x5e3371,_0x14f9d1,_0x25bdd3,_0x1113db){this[_0xcf7a('0x87')]=_0xcf7a('0x88');this[_0xcf7a('0x89')]=_0x5e3371['localstationid'];this[_0xcf7a('0x8a')]=_0x1113db;this['type']=_0xcf7a('0x8b');this[_0xcf7a('0x8c')]=_0xcf7a('0x8d');this[_0xcf7a('0x65')]=_0x5e3371['id'];this[_0xcf7a('0x84')]=_0x14f9d1;this[_0xcf7a('0x8e')]=_0x25bdd3;}function createExtensionsReciveFax(_0x1c11f0){var _0x49f54e=0x1;var _0xf179de=[];_0xf179de[_0xcf7a('0x8f')](new Extension(_0x1c11f0,_0x49f54e,'',_0xcf7a('0x90')));_0x49f54e+=0x1;_0xf179de['push'](new Extension(_0x1c11f0,_0x49f54e,_0xcf7a('0x91'),_0xcf7a('0x92')));_0x49f54e+=0x1;for(var _0x23ad19 in _0x1c11f0){if(_0x1c11f0[_0xcf7a('0x68')](_0x23ad19)&&(_0x23ad19===_0xcf7a('0x93')||_0x23ad19===_0xcf7a('0x94')||_0x23ad19===_0xcf7a('0x95')||_0x23ad19===_0xcf7a('0x96')||_0x23ad19===_0xcf7a('0x97')||_0x23ad19===_0xcf7a('0x98')||_0x23ad19==='minrate'||_0x23ad19===_0xcf7a('0x99')||_0x23ad19===_0xcf7a('0x9a'))){_0xf179de[_0xcf7a('0x8f')](new Extension(_0x1c11f0,_0x49f54e,'FAXOPT('+_0x23ad19+')='+_0x1c11f0[_0x23ad19],_0xcf7a('0x92')));_0x49f54e+=0x1;}}_0xf179de[_0xcf7a('0x8f')](new Extension(_0x1c11f0,_0x49f54e,'6','Wait'));_0x49f54e+=0x1;_0xf179de[_0xcf7a('0x8f')](new Extension(_0x1c11f0,_0x49f54e,_0xcf7a('0x9b'),_0xcf7a('0x9c')));_0x49f54e=0x0;return _0xf179de;}exports[_0xcf7a('0x9d')]=function(_0x2a983c,_0x2e1f98,_0x53fea6){var _0x4ce1e5;return db[_0xcf7a('0x7e')]['transaction'](function(_0x2fffc9){return db['FaxAccount']['create'](_0x2a983c[_0xcf7a('0x5c')],{'transaction':_0x2fffc9})[_0xcf7a('0x1f')](function(_0x503bd4){_0x4ce1e5=_0x503bd4[_0xcf7a('0x37')]({'plain':!![]});return db[_0xcf7a('0x9e')][_0xcf7a('0x83')](createExtensionsReciveFax(_0x4ce1e5),{'transaction':_0x2fffc9});});})[_0xcf7a('0x1f')](function(){return _0x4ce1e5;})[_0xcf7a('0x1f')](respondWithResult(_0x2e1f98,null))[_0xcf7a('0x57')](handleError(_0x2e1f98,null));};exports['updateAccountApplications']=function(_0x35cc11,_0x25c996,_0x5bfa77){var _0x31f869;return db['sequelize'][_0xcf7a('0x7f')](function(_0x4ef7b0){return db[_0xcf7a('0x3f')][_0xcf7a('0x35')](_0x35cc11['body'],{'where':{'id':_0x35cc11[_0xcf7a('0x5c')]['id']},'transaction':_0x4ef7b0})[_0xcf7a('0x1f')](function(_0x2c35ba){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x35cc11[_0xcf7a('0x5c')]['id']},'transaction':_0x4ef7b0})[_0xcf7a('0x1f')](function(_0x66a4d4){return db[_0xcf7a('0x9e')][_0xcf7a('0x83')](createExtensionsReciveFax(_[_0xcf7a('0x72')](_0x35cc11[_0xcf7a('0x5c')],['tech',_0xcf7a('0x43'),'createdAt',_0xcf7a('0x9f'),_0xcf7a('0xa0'),_0xcf7a('0xa1')])),{'transaction':_0x4ef7b0});});});})['then'](function(){return db[_0xcf7a('0x3f')][_0xcf7a('0xa2')](_0x35cc11[_0xcf7a('0x5c')]['id']);})[_0xcf7a('0x1f')](respondWithResult(_0x25c996,null))[_0xcf7a('0x57')](handleError(_0x25c996,null));};exports['getMessages']=function(_0x343513,_0x61788c,_0x13eb53){var _0x2e3f54={'raw':!![],'where':{}};var _0xb4d251={};var _0x153cb4={'count':0x0,'rows':[]};return db[_0xcf7a('0x3f')][_0xcf7a('0x67')]({'where':{'id':_0x343513[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x61788c,null))[_0xcf7a('0x1f')](function(_0x24f8c0){if(_0x24f8c0){_0xb4d251[_0xcf7a('0x4a')]=_['keys'](db[_0xcf7a('0xa3')]['rawAttributes']);_0xb4d251[_0xcf7a('0x44')]=_[_0xcf7a('0x45')](_0x343513['query']);_0xb4d251[_0xcf7a('0x46')]=_[_0xcf7a('0x47')](_0xb4d251['model'],_0xb4d251[_0xcf7a('0x44')]);_0x2e3f54['attributes']=_[_0xcf7a('0x47')](_0xb4d251[_0xcf7a('0x4a')],qs[_0xcf7a('0x49')](_0x343513['query'][_0xcf7a('0x49')]));_0x2e3f54['attributes']=_0x2e3f54[_0xcf7a('0x48')][_0xcf7a('0x59')]?_0x2e3f54['attributes']:_0xb4d251['model'];if(!_0x343513[_0xcf7a('0x44')]['hasOwnProperty'](_0xcf7a('0x4b'))){_0x2e3f54[_0xcf7a('0x2f')]=qs['limit'](_0x343513['query'][_0xcf7a('0x2f')]);_0x2e3f54[_0xcf7a('0x2c')]=qs['offset'](_0x343513[_0xcf7a('0x44')][_0xcf7a('0x2c')]);}_0x2e3f54[_0xcf7a('0x4c')]=qs['sort'](_0x343513[_0xcf7a('0x44')][_0xcf7a('0x4d')]);_0x2e3f54['where']=qs[_0xcf7a('0x46')](_[_0xcf7a('0x4f')](_0x343513[_0xcf7a('0x44')],_0xb4d251[_0xcf7a('0x46')]));_0x2e3f54[_0xcf7a('0x4e')][_0xcf7a('0x65')]=_0x24f8c0['id'];if(_0x343513[_0xcf7a('0x44')]['filter']){_0x2e3f54[_0xcf7a('0x4e')]=_['merge'](_0x2e3f54[_0xcf7a('0x4e')],{'$or':_[_0xcf7a('0x3e')](_0x2e3f54[_0xcf7a('0x48')],function(_0x4793cf){var _0x230b01={};_0x230b01[_0x4793cf]={'$like':'%'+_0x343513[_0xcf7a('0x44')]['filter']+'%'};return _0x230b01;})});}if(_0x343513[_0xcf7a('0x44')][_0xcf7a('0xa4')]){var _0x3cb161=_0x343513['query'][_0xcf7a('0xa4')][_0xcf7a('0xa5')](',');var _0x1605d1={};_0x1605d1[_0x3cb161[0x0]]={'$gte':moment(_0x3cb161[0x1])['format'](_0xcf7a('0xa6'))};_0x2e3f54[_0xcf7a('0x4e')]=_[_0xcf7a('0x50')](_0x2e3f54[_0xcf7a('0x4e')],_0x1605d1);}_0x2e3f54=_[_0xcf7a('0x50')]({},_0x2e3f54,_0x343513['options']);return db[_0xcf7a('0xa3')][_0xcf7a('0x2e')]({'where':_0x2e3f54['where']})['then'](function(_0x39b72d){_0x153cb4[_0xcf7a('0x2e')]=_0x39b72d;if(_0x343513[_0xcf7a('0x44')][_0xcf7a('0x54')]){_0x2e3f54[_0xcf7a('0x55')]=[{'all':!![]}];}return db[_0xcf7a('0xa3')][_0xcf7a('0x69')](_0x2e3f54);})[_0xcf7a('0x1f')](function(_0x42f69c){_0x153cb4[_0xcf7a('0x56')]=_0x42f69c;return _0x153cb4;});}})[_0xcf7a('0x1f')](respondWithFilteredResult(_0x61788c,_0x2e3f54))[_0xcf7a('0x57')](handleError(_0x61788c,null));};exports[_0xcf7a('0x3b')]=function(_0x49ea0c,_0x30fc71,_0x3ac2a2){var _0x5ae473,_0x4f2c09={},_0x257fa7;if(_0x49ea0c[_0xcf7a('0x5c')]['to']){_0x257fa7=_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0];}return db[_0xcf7a('0x3f')][_0xcf7a('0x5a')]({'where':{'id':_0x49ea0c[_0xcf7a('0x62')]['id']},'include':[{'model':db[_0xcf7a('0xa7')],'as':_0xcf7a('0xa8'),'include':[{'model':db[_0xcf7a('0x74')],'as':_0xcf7a('0xa9'),'where':{'fax':_0x257fa7},'limit':0x1,'order':[['updatedAt',_0xcf7a('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x30fc71,null))['then'](function(_0x5962f3){_0x5ae473=_0x5962f3;if(_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xab')]&&_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xab')][_0xcf7a('0x59')]){for(var _0x1b9e45=0x0;_0x1b9e45<_0x49ea0c[_0xcf7a('0x5c')]['attachments'][_0xcf7a('0x59')];_0x1b9e45+=0x1){_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xab')][_0x1b9e45]={'filename':_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xab')][_0x1b9e45][_0xcf7a('0x3a')],'id':_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xab')][_0x1b9e45]['id'],'path':path['join'](config[_0xcf7a('0xac')],_0xcf7a('0xad'),_0x49ea0c[_0xcf7a('0x5c')]['attachments'][_0x1b9e45][_0xcf7a('0xae')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xcf7a('0xaf')](_0x49ea0c['params']['id'])?undefined:_0x49ea0c[_0xcf7a('0x62')]['id'],'path':_[_0xcf7a('0xaf')](_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xab')][0x0]['path'])?undefined:_0x49ea0c['body']['attachments'][0x0]['path'],'fax':_[_0xcf7a('0xaf')](_0x49ea0c['body']['to'][0x0])?undefined:_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0]},client9002);})[_0xcf7a('0x1f')](function(){if(_0x5ae473){if(_[_0xcf7a('0xaf')](_0x49ea0c[_0xcf7a('0x5c')]['from'])){_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xb0')]=util[_0xcf7a('0xb1')](_0xcf7a('0xb2'),_0x5ae473[_0xcf7a('0x3a')],_0x5ae473[_0xcf7a('0xb3')]);}if(_0x5ae473[_0xcf7a('0xa8')]){if(_0x5ae473[_0xcf7a('0xa8')][_0xcf7a('0xa9')]['length']){return _0x5ae473[_0xcf7a('0xa8')][_0xcf7a('0xa9')][0x0];}else{return db[_0xcf7a('0x74')][_0xcf7a('0x5b')](_[_0xcf7a('0x17')](_0x49ea0c[_0xcf7a('0x5c')],{'firstName':_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0],'phone':_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0],'fax':_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0],'ListId':_0x5ae473[_0xcf7a('0xa1')]}));}}else{throw new Error(_0xcf7a('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xcf7a('0x1f')](function(_0x5027f7){if(_0x5027f7){return db['FaxInteraction'][_0xcf7a('0x5a')]({'where':{'ContactId':_0x5027f7['id'],'closed':![],'FaxAccountId':_0x5ae473['id']}})[_0xcf7a('0x1f')](function(_0x41b2de){if(_0x41b2de){return[_0x41b2de,![]];}return db['FaxInteraction']['create']({'UserId':_0x49ea0c['user']['id'],'ContactId':_0x5027f7['id'],'FaxAccountId':_0x5ae473['id'],'fax':_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0],'firstMsgDirection':_0xcf7a('0xb5'),'Messages':[_['merge'](_0x49ea0c['body'],{'read':![],'body':_0x49ea0c[_0xcf7a('0x5c')]['attachments'][0x0]['filename'],'FaxAccountId':_0x5ae473['id'],'UserId':_0x49ea0c['user']['id'],'ContactId':_0x5027f7['id'],'AttachmentId':_0x49ea0c['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xcf7a('0xa3')],'as':_0xcf7a('0xb6')}]})[_0xcf7a('0x1f')](function(_0x47372a){return[_0x47372a,!![]];});});}else{throw new Error(_0xcf7a('0xb7'));}})[_0xcf7a('0xb8')](function(_0x41b6ac,_0x41e6cf){if(_0x41e6cf){return _0x41b6ac;}return db[_0xcf7a('0xa3')][_0xcf7a('0x5b')]({'direction':_0xcf7a('0xb5'),'read':![],'body':_0x49ea0c[_0xcf7a('0x5c')]['attachments'][0x0][_0xcf7a('0xb9')],'FaxAccountId':_0x5ae473['id'],'FaxInteractionId':_0x41b6ac['id'],'UserId':_0x49ea0c['user']['id'],'ContactId':_0x41b6ac[_0xcf7a('0xba')],'AttachmentId':_0x49ea0c['body'][_0xcf7a('0xab')][0x0]['id']})['then'](function(_0x479b2f){_0x41b6ac['dataValues']['Messages']=[];_0x41b6ac[_0xcf7a('0xbb')][_0xcf7a('0xb6')][_0xcf7a('0x8f')](_0x479b2f['dataValues']);return _0x41b6ac;});})['then'](function(_0x21ac52){respondWithRpcPromise(_0xcf7a('0xbc'),_0xcf7a('0xbc'),{'FaxAccountId':_['isNil'](_0x49ea0c[_0xcf7a('0x62')]['id'])?undefined:_0x49ea0c[_0xcf7a('0x62')]['id'],'path':_[_0xcf7a('0xaf')](_0x49ea0c[_0xcf7a('0x5c')][_0xcf7a('0xab')][0x0][_0xcf7a('0x5')])?undefined:_0x49ea0c['body']['attachments'][0x0][_0xcf7a('0x5')],'fax':_[_0xcf7a('0xaf')](_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0])?undefined:_0x49ea0c[_0xcf7a('0x5c')]['to'][0x0],'AttachmentId':_0x49ea0c['body']['attachments'][0x0]['id']},client9002)[_0xcf7a('0x1f')](function(_0x3fdea1){logger['info'](_0xcf7a('0xbd'),_0x3fdea1);})[_0xcf7a('0x57')](function(_0x98278a){logger[_0xcf7a('0x20')](_0xcf7a('0xbd'),_0x98278a);});return _0x21ac52;})[_0xcf7a('0x1f')](respondWithResult(_0x30fc71,null))[_0xcf7a('0x57')](handleError(_0x30fc71,null));};exports['addAgents']=function(_0x155416,_0x2a324e,_0x37496c){return db['FaxAccount']['find']({'where':{'id':_0x155416['params']['id']}})['then'](handleEntityNotFound(_0x2a324e,null))[_0xcf7a('0x1f')](function(_0x2fb7f4){if(_0x2fb7f4){return _0x2fb7f4[_0xcf7a('0xbe')](_0x155416[_0xcf7a('0x5c')][_0xcf7a('0x71')],_[_0xcf7a('0x72')](_0x155416['body'],[_0xcf7a('0x71'),'id'])||{})['spread'](function(_0x52893d){for(var _0x1c3878=0x0;_0x1c3878<_0x155416['body'][_0xcf7a('0x71')][_0xcf7a('0x59')];_0x1c3878+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x155416[_0xcf7a('0x5c')]['ids'][_0x1c3878]),'FaxAccountId':Number(_0x155416[_0xcf7a('0x62')]['id'])});}return _0x52893d;});}})['then'](respondWithResult(_0x2a324e,null))[_0xcf7a('0x57')](handleError(_0x2a324e,null));};exports['removeAgents']=function(_0x1df26d,_0x5eb7c3,_0x4742fa){return db[_0xcf7a('0x3f')][_0xcf7a('0x5a')]({'where':{'id':_0x1df26d[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x5eb7c3,null))['then'](function(_0xe4a7e3){if(_0xe4a7e3){return _0xe4a7e3['removeAgents'](_0x1df26d['query'][_0xcf7a('0x71')])['then'](function(){if(_[_0xcf7a('0xbf')](_0x1df26d[_0xcf7a('0x44')][_0xcf7a('0x71')])){for(var _0x229713=0x0;_0x229713<_0x1df26d[_0xcf7a('0x44')][_0xcf7a('0x71')][_0xcf7a('0x59')];_0x229713+=0x1){socket[_0xcf7a('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x1df26d[_0xcf7a('0x44')][_0xcf7a('0x71')][_0x229713]),'FaxAccountId':Number(_0x1df26d['params']['id'])});}}else{socket[_0xcf7a('0xc0')](_0xcf7a('0xc1'),{'UserId':Number(_0x1df26d[_0xcf7a('0x44')][_0xcf7a('0x71')]),'FaxAccountId':Number(_0x1df26d['params']['id'])});}});}})[_0xcf7a('0x1f')](respondWithStatusCode(_0x5eb7c3,null))[_0xcf7a('0x57')](handleError(_0x5eb7c3,null));};exports[_0xcf7a('0xc2')]=function(_0x487a7a,_0x4fbeb7,_0x3db448){var _0x5ac8cb={};var _0x442509={};var _0x3dbf9b;var _0x1c35de;return db['FaxAccount'][_0xcf7a('0x67')]({'where':{'id':_0x487a7a[_0xcf7a('0x62')]['id']}})[_0xcf7a('0x1f')](handleEntityNotFound(_0x4fbeb7,null))[_0xcf7a('0x1f')](function(_0x5b2953){if(_0x5b2953){_0x3dbf9b=_0x5b2953;_0x442509[_0xcf7a('0x4a')]=_[_0xcf7a('0x45')](db[_0xcf7a('0x76')][_0xcf7a('0x40')]);_0x442509[_0xcf7a('0x44')]=_[_0xcf7a('0x45')](_0x487a7a[_0xcf7a('0x44')]);_0x442509['filters']=_['intersection'](_0x442509[_0xcf7a('0x4a')],_0x442509[_0xcf7a('0x44')]);_0x5ac8cb[_0xcf7a('0x48')]=_[_0xcf7a('0x47')](_0x442509[_0xcf7a('0x4a')],qs[_0xcf7a('0x49')](_0x487a7a[_0xcf7a('0x44')][_0xcf7a('0x49')]));_0x5ac8cb[_0xcf7a('0x48')]=_0x5ac8cb[_0xcf7a('0x48')][_0xcf7a('0x59')]?_0x5ac8cb[_0xcf7a('0x48')]:_0x442509[_0xcf7a('0x4a')];_0x5ac8cb[_0xcf7a('0x4c')]=qs[_0xcf7a('0x4d')](_0x487a7a['query'][_0xcf7a('0x4d')]);_0x5ac8cb[_0xcf7a('0x4e')]=qs[_0xcf7a('0x46')](_[_0xcf7a('0x4f')](_0x487a7a[_0xcf7a('0x44')],_0x442509['filters']));if(_0x487a7a[_0xcf7a('0x44')]['filter']){_0x5ac8cb[_0xcf7a('0x4e')]=_[_0xcf7a('0x50')](_0x5ac8cb[_0xcf7a('0x4e')],{'$or':_[_0xcf7a('0x3e')](_0x5ac8cb[_0xcf7a('0x48')],function(_0x1354ba){var _0x4757f4={};_0x4757f4[_0x1354ba]={'$like':'%'+_0x487a7a[_0xcf7a('0x44')]['filter']+'%'};return _0x4757f4;})});}_0x5ac8cb=_[_0xcf7a('0x50')]({},_0x5ac8cb,_0x487a7a[_0xcf7a('0x53')]);return _0x3dbf9b[_0xcf7a('0xc2')](_0x5ac8cb);}})[_0xcf7a('0x1f')](function(_0x2e825f){if(_0x2e825f){_0x1c35de=_0x2e825f[_0xcf7a('0x59')];if(!_0x487a7a[_0xcf7a('0x44')][_0xcf7a('0x68')](_0xcf7a('0x4b'))){_0x5ac8cb[_0xcf7a('0x2f')]=qs[_0xcf7a('0x2f')](_0x487a7a[_0xcf7a('0x44')][_0xcf7a('0x2f')]);_0x5ac8cb['offset']=qs['offset'](_0x487a7a['query'][_0xcf7a('0x2c')]);}return _0x3dbf9b[_0xcf7a('0xc2')](_0x5ac8cb);}})['then'](function(_0x147577){if(_0x147577){return _0x147577?{'count':_0x1c35de,'rows':_0x147577}:null;}})['then'](respondWithResult(_0x4fbeb7,null))[_0xcf7a('0x57')](handleError(_0x4fbeb7,null));}; \ No newline at end of file +var _0xbd8a=['moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','FaxAccounts','UserProfileResource','name','send','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','length','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','Pause','describe','addDisposition','FaxAccountId','Disposition','create','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','FaxApplication','findAndCountAll','priority','stack','finally','getApplications','context','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','ecm','localstationid','gateway','headerinfo','maxrate','ReceiveFax','addAccountApplications','get','VoiceExtension','updateAccountApplications','transaction','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','request-promise'];(function(_0x21443d,_0x1d6e0b){var _0x2eb7de=function(_0x47f385){while(--_0x47f385){_0x21443d['push'](_0x21443d['shift']());}};_0x2eb7de(++_0x1d6e0b);}(_0xbd8a,0xbf));var _0xabd8=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0xbd8a[_0x28fe94];return _0x3560da;};'use strict';var emlformat=require(_0xabd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabd8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabd8('0x2'));var moment=require(_0xabd8('0x3'));var BPromise=require(_0xabd8('0x4'));var Mustache=require(_0xabd8('0x5'));var util=require(_0xabd8('0x6'));var path=require(_0xabd8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabd8('0x8'));var squel=require(_0xabd8('0x9'));var crypto=require(_0xabd8('0xa'));var jsforce=require(_0xabd8('0xb'));var deskjs=require(_0xabd8('0xc'));var toCsv=require(_0xabd8('0xd'));var querystring=require('querystring');var Papa=require(_0xabd8('0xe'));var Redis=require(_0xabd8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xabd8('0x10'));var as=require(_0xabd8('0x11'));var hardwareService=require(_0xabd8('0x12'));var logger=require(_0xabd8('0x13'))(_0xabd8('0x14'));var utils=require(_0xabd8('0x15'));var config=require(_0xabd8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xabd8('0x17'))['db'];config[_0xabd8('0x18')]=_[_0xabd8('0x19')](config['redis'],{'host':_0xabd8('0x1a'),'port':0x18eb});var socket=require(_0xabd8('0x1b'))(new Redis(config[_0xabd8('0x18')]));require('./faxAccount.socket')[_0xabd8('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xabd8('0x1d')][_0xabd8('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xabd8('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2b1952,_0x249b7d,_0x50faad,_0x43e4ac){return new BPromise(function(_0x855f3f,_0x4c2abb){var _0x4f56d5=_0x43e4ac||client;return _0x4f56d5['request'](_0x2b1952,_0x50faad)['then'](function(_0x335261){logger[_0xabd8('0x1f')](_0xabd8('0x20'),_0x249b7d,_0xabd8('0x21'));logger[_0xabd8('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x249b7d,_0xabd8('0x21'),JSON[_0xabd8('0x23')](_0x335261));if(_0x335261[_0xabd8('0x24')]){if(_0x335261['error']['code']===0x1f4){logger[_0xabd8('0x24')](_0xabd8('0x20'),_0x249b7d,_0x335261[_0xabd8('0x24')][_0xabd8('0x25')]);return _0x4c2abb(_0x335261[_0xabd8('0x24')][_0xabd8('0x25')]);}logger['error'](_0xabd8('0x20'),_0x249b7d,_0x335261[_0xabd8('0x24')][_0xabd8('0x25')]);return _0x855f3f(_0x335261[_0xabd8('0x24')][_0xabd8('0x25')]);}else{logger[_0xabd8('0x1f')](_0xabd8('0x20'),_0x249b7d,_0xabd8('0x21'));_0x855f3f(_0x335261[_0xabd8('0x26')][_0xabd8('0x25')]);}})['catch'](function(_0x431ac8){logger[_0xabd8('0x24')]('FaxAccount,\x20%s,\x20%s',_0x249b7d,_0x431ac8);_0x4c2abb(_0x431ac8);});});}function respondWithStatusCode(_0x4959cb,_0x526006){_0x526006=_0x526006||0xcc;return function(_0xc19b9b){if(_0xc19b9b){return _0x4959cb[_0xabd8('0x27')](_0x526006);}return _0x4959cb['status'](_0x526006)[_0xabd8('0x28')]();};}function respondWithResult(_0x163a08,_0xa52b1d){_0xa52b1d=_0xa52b1d||0xc8;return function(_0x41be8d){if(_0x41be8d){return _0x163a08[_0xabd8('0x29')](_0xa52b1d)[_0xabd8('0x2a')](_0x41be8d);}};}function respondWithFilteredResult(_0x2728e9,_0x4e2d6c){return function(_0x1902da){if(_0x1902da){var _0x1585ea=typeof _0x4e2d6c[_0xabd8('0x2b')]===_0xabd8('0x2c')&&typeof _0x4e2d6c[_0xabd8('0x2d')]===_0xabd8('0x2c');var _0x2fa05c=_0x1902da[_0xabd8('0x2e')];var _0xdb5cea=_0x1585ea?0x0:_0x4e2d6c[_0xabd8('0x2b')];var _0x1a2f0f=_0x1585ea?_0x1902da[_0xabd8('0x2e')]:_0x4e2d6c[_0xabd8('0x2b')]+_0x4e2d6c[_0xabd8('0x2d')];var _0x4293cd;if(_0x1a2f0f>=_0x2fa05c){_0x1a2f0f=_0x2fa05c;_0x4293cd=0xc8;}else{_0x4293cd=0xce;}_0x2728e9[_0xabd8('0x29')](_0x4293cd);return _0x2728e9[_0xabd8('0x2f')](_0xabd8('0x30'),_0xdb5cea+'-'+_0x1a2f0f+'/'+_0x2fa05c)[_0xabd8('0x2a')](_0x1902da);}return null;};}function patchUpdates(_0x2a72cd){return function(_0x349a1f){try{jsonpatch[_0xabd8('0x31')](_0x349a1f,_0x2a72cd,!![]);}catch(_0x11ac6c){return BPromise[_0xabd8('0x32')](_0x11ac6c);}return _0x349a1f[_0xabd8('0x33')]();};}function saveUpdates(_0x138c7f,_0xd246aa){return function(_0x1e8467){if(_0x1e8467){return _0x1e8467['update'](_0x138c7f)[_0xabd8('0x34')](function(_0x3ba3d7){return _0x3ba3d7;});}return null;};}function removeEntity(_0x4bdb68,_0x25f49c){return function(_0x464bbd){if(_0x464bbd){return _0x464bbd[_0xabd8('0x35')]()[_0xabd8('0x34')](function(){var _0x57245e=_0x464bbd['get']({'plain':!![]});var _0x88f378=_0xabd8('0x36');return db[_0xabd8('0x37')][_0xabd8('0x35')]({'where':{'type':_0x88f378,'resourceId':_0x57245e['id']}})['then'](function(){return _0x464bbd;});})[_0xabd8('0x34')](function(){_0x4bdb68['status'](0xcc)[_0xabd8('0x28')]();});}};}function handleEntityNotFound(_0x116073,_0x3a3349){return function(_0x3b894a){if(!_0x3b894a){_0x116073[_0xabd8('0x27')](0x194);}return _0x3b894a;};}function handleError(_0x5a2088,_0x259c32){_0x259c32=_0x259c32||0x1f4;return function(_0xd2141d){logger[_0xabd8('0x24')](_0xd2141d['stack']);if(_0xd2141d[_0xabd8('0x38')]){delete _0xd2141d[_0xabd8('0x38')];}_0x5a2088[_0xabd8('0x29')](_0x259c32)[_0xabd8('0x39')](_0xd2141d);};}exports['index']=function(_0x139622,_0x21a791){var _0x5883c0={'include':[{'model':db['Pause'],'as':_0xabd8('0x3a')}]},_0x489292={},_0x1fcf12={'count':0x0,'rows':[]};var _0xfae0d8=_['map'](db[_0xabd8('0x3b')][_0xabd8('0x3c')],function(_0x363654){return{'name':_0x363654[_0xabd8('0x3d')],'type':_0x363654[_0xabd8('0x3e')][_0xabd8('0x3f')]};});_0x489292[_0xabd8('0x40')]=_[_0xabd8('0x41')](_0xfae0d8,'name');_0x489292[_0xabd8('0x42')]=_[_0xabd8('0x43')](_0x139622[_0xabd8('0x42')]);_0x489292[_0xabd8('0x44')]=_[_0xabd8('0x45')](_0x489292[_0xabd8('0x40')],_0x489292[_0xabd8('0x42')]);_0x5883c0['attributes']=_[_0xabd8('0x45')](_0x489292[_0xabd8('0x40')],qs[_0xabd8('0x46')](_0x139622[_0xabd8('0x42')]['fields']));_0x5883c0[_0xabd8('0x47')]=_0x5883c0[_0xabd8('0x47')]['length']?_0x5883c0['attributes']:_0x489292['model'];if(!_0x139622[_0xabd8('0x42')][_0xabd8('0x48')](_0xabd8('0x49'))){_0x5883c0[_0xabd8('0x2d')]=qs['limit'](_0x139622[_0xabd8('0x42')]['limit']);_0x5883c0[_0xabd8('0x2b')]=qs[_0xabd8('0x2b')](_0x139622[_0xabd8('0x42')]['offset']);}_0x5883c0[_0xabd8('0x4a')]=qs[_0xabd8('0x4b')](_0x139622['query'][_0xabd8('0x4b')]);_0x5883c0[_0xabd8('0x4c')]=qs[_0xabd8('0x44')](_[_0xabd8('0x4d')](_0x139622['query'],_0x489292[_0xabd8('0x44')]),_0xfae0d8);if(_0x139622[_0xabd8('0x42')][_0xabd8('0x4e')]){_0x5883c0['where']=_[_0xabd8('0x4f')](_0x5883c0[_0xabd8('0x4c')],{'$or':_[_0xabd8('0x41')](_0xfae0d8,function(_0x315eb6){if(_0x315eb6[_0xabd8('0x3e')]!==_0xabd8('0x50')){var _0x49eff9={};_0x49eff9[_0x315eb6['name']]={'$like':'%'+_0x139622[_0xabd8('0x42')]['filter']+'%'};return _0x49eff9;}})});}_0x5883c0=_[_0xabd8('0x4f')]({},_0x5883c0,_0x139622[_0xabd8('0x51')]);var _0xbf9eee={'where':_0x5883c0[_0xabd8('0x4c')]};return db[_0xabd8('0x3b')]['count'](_0xbf9eee)['then'](function(_0xa446e9){_0x1fcf12['count']=_0xa446e9;if(_0x139622[_0xabd8('0x42')][_0xabd8('0x52')]){_0x5883c0['include']=[{'all':!![]}];}return db['FaxAccount'][_0xabd8('0x53')](_0x5883c0);})[_0xabd8('0x34')](function(_0x4d696b){_0x1fcf12['rows']=_0x4d696b;return _0x1fcf12;})[_0xabd8('0x34')](respondWithFilteredResult(_0x21a791,_0x5883c0))[_0xabd8('0x54')](handleError(_0x21a791,null));};exports['show']=function(_0x4b2e41,_0x20e84e){var _0x2cd79b={'raw':![],'where':{'id':_0x4b2e41['params']['id']},'include':[{'model':db['Pause'],'as':_0xabd8('0x3a')}]},_0x13e34d={};_0x13e34d[_0xabd8('0x40')]=_['keys'](db[_0xabd8('0x3b')][_0xabd8('0x3c')]);_0x13e34d['query']=_[_0xabd8('0x43')](_0x4b2e41[_0xabd8('0x42')]);_0x13e34d[_0xabd8('0x44')]=_[_0xabd8('0x45')](_0x13e34d['model'],_0x13e34d[_0xabd8('0x42')]);_0x2cd79b[_0xabd8('0x47')]=_[_0xabd8('0x45')](_0x13e34d[_0xabd8('0x40')],qs[_0xabd8('0x46')](_0x4b2e41[_0xabd8('0x42')][_0xabd8('0x46')]));_0x2cd79b[_0xabd8('0x47')]=_0x2cd79b['attributes'][_0xabd8('0x55')]?_0x2cd79b[_0xabd8('0x47')]:_0x13e34d[_0xabd8('0x40')];if(_0x4b2e41[_0xabd8('0x42')][_0xabd8('0x52')]){_0x2cd79b[_0xabd8('0x56')]=[{'all':!![]}];}_0x2cd79b=_[_0xabd8('0x4f')]({},_0x2cd79b,_0x4b2e41[_0xabd8('0x51')]);return db[_0xabd8('0x3b')]['find'](_0x2cd79b)[_0xabd8('0x34')](handleEntityNotFound(_0x20e84e,null))[_0xabd8('0x34')](respondWithResult(_0x20e84e,null))[_0xabd8('0x54')](handleError(_0x20e84e,null));};exports['create']=function(_0x1d9770,_0xfadbfd){return db['FaxAccount']['create'](_0x1d9770[_0xabd8('0x57')],{})[_0xabd8('0x34')](function(_0x40ce03){var _0x114eb0=_0x1d9770[_0xabd8('0x58')]['get']({'plain':!![]});if(!_0x114eb0)throw new Error(_0xabd8('0x59'));if(_0x114eb0[_0xabd8('0x5a')]==='user'){var _0x162d6d=_0x40ce03['get']({'plain':!![]});var _0x3afd78=_0xabd8('0x36');return db['UserProfileSection'][_0xabd8('0x5b')]({'where':{'name':_0x3afd78,'userProfileId':_0x114eb0[_0xabd8('0x5c')]},'raw':!![]})['then'](function(_0x1dae6d){if(_0x1dae6d&&_0x1dae6d[_0xabd8('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x162d6d['name'],'resourceId':_0x162d6d['id'],'type':_0x1dae6d[_0xabd8('0x38')],'sectionId':_0x1dae6d['id']},{})[_0xabd8('0x34')](function(){return _0x40ce03;});}else{return _0x40ce03;}})[_0xabd8('0x54')](function(_0x63a324){logger[_0xabd8('0x24')](_0xabd8('0x5e'),_0x63a324);throw _0x63a324;});}return _0x40ce03;})[_0xabd8('0x34')](respondWithResult(_0xfadbfd,0xc9))['catch'](handleError(_0xfadbfd,null));};exports[_0xabd8('0x5f')]=function(_0x50dff4,_0x5c8653){if(_0x50dff4[_0xabd8('0x57')]['id']){delete _0x50dff4[_0xabd8('0x57')]['id'];}return db[_0xabd8('0x3b')]['find']({'where':{'id':_0x50dff4[_0xabd8('0x60')]['id']},'include':[{'model':db[_0xabd8('0x61')],'as':_0xabd8('0x3a')}]})['then'](handleEntityNotFound(_0x5c8653,null))[_0xabd8('0x34')](saveUpdates(_0x50dff4[_0xabd8('0x57')],null))['then'](respondWithResult(_0x5c8653,null))[_0xabd8('0x54')](handleError(_0x5c8653,null));};exports[_0xabd8('0x35')]=function(_0x2d0f35,_0x4de68e){return db[_0xabd8('0x3b')]['find']({'where':{'id':_0x2d0f35[_0xabd8('0x60')]['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x4de68e,null))[_0xabd8('0x34')](removeEntity(_0x4de68e,null))[_0xabd8('0x54')](handleError(_0x4de68e,null));};exports[_0xabd8('0x62')]=function(_0x7aa581,_0x3a057f){return db[_0xabd8('0x3b')][_0xabd8('0x62')]()['then'](respondWithResult(_0x3a057f,null))[_0xabd8('0x54')](handleError(_0x3a057f,null));};exports[_0xabd8('0x63')]=function(_0x5324ca,_0x44effe,_0x362724){if(_0x5324ca[_0xabd8('0x57')]['id']){delete _0x5324ca['body']['id'];}return db[_0xabd8('0x3b')][_0xabd8('0x5b')]({'where':{'id':_0x5324ca[_0xabd8('0x60')]['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x44effe,null))['then'](function(_0x29fcd1){if(_0x29fcd1){_0x5324ca['body'][_0xabd8('0x64')]=_0x29fcd1['id'];return db[_0xabd8('0x65')][_0xabd8('0x66')](_0x5324ca[_0xabd8('0x57')]);}})['then'](respondWithResult(_0x44effe,null))['catch'](handleError(_0x44effe,null));};exports[_0xabd8('0x67')]=function(_0x4437e9,_0x296967,_0x5a4fae){var _0x5a0a82={'raw':![],'where':{}};var _0x213de7={};var _0x62932a={'count':0x0,'rows':[]};return db[_0xabd8('0x3b')][_0xabd8('0x68')]({'where':{'id':_0x4437e9['params']['id']}})['then'](handleEntityNotFound(_0x296967,null))['then'](function(_0x5d36c2){if(_0x5d36c2){_0x213de7[_0xabd8('0x40')]=_['keys'](db[_0xabd8('0x65')][_0xabd8('0x3c')]);_0x213de7[_0xabd8('0x42')]=_[_0xabd8('0x43')](_0x4437e9[_0xabd8('0x42')]);_0x213de7[_0xabd8('0x44')]=_[_0xabd8('0x45')](_0x213de7[_0xabd8('0x40')],_0x213de7[_0xabd8('0x42')]);_0x5a0a82[_0xabd8('0x47')]=_[_0xabd8('0x45')](_0x213de7[_0xabd8('0x40')],qs['fields'](_0x4437e9[_0xabd8('0x42')][_0xabd8('0x46')]));_0x5a0a82[_0xabd8('0x47')]=_0x5a0a82[_0xabd8('0x47')][_0xabd8('0x55')]?_0x5a0a82[_0xabd8('0x47')]:_0x213de7['model'];if(!_0x4437e9[_0xabd8('0x42')][_0xabd8('0x48')](_0xabd8('0x49'))){_0x5a0a82[_0xabd8('0x2d')]=qs[_0xabd8('0x2d')](_0x4437e9['query']['limit']);_0x5a0a82[_0xabd8('0x2b')]=qs['offset'](_0x4437e9[_0xabd8('0x42')][_0xabd8('0x2b')]);}_0x5a0a82[_0xabd8('0x4a')]=qs[_0xabd8('0x4b')](_0x4437e9[_0xabd8('0x42')][_0xabd8('0x4b')]);_0x5a0a82[_0xabd8('0x4c')]=qs[_0xabd8('0x44')](_[_0xabd8('0x4d')](_0x4437e9[_0xabd8('0x42')],_0x213de7[_0xabd8('0x44')]));_0x5a0a82[_0xabd8('0x4c')][_0xabd8('0x64')]=_0x5d36c2['id'];if(_0x4437e9[_0xabd8('0x42')][_0xabd8('0x4e')]){_0x5a0a82[_0xabd8('0x4c')]=_[_0xabd8('0x4f')](_0x5a0a82[_0xabd8('0x4c')],{'$or':_[_0xabd8('0x41')](_0x5a0a82['attributes'],function(_0x1f4932){var _0x4057b9={};_0x4057b9[_0x1f4932]={'$like':'%'+_0x4437e9[_0xabd8('0x42')][_0xabd8('0x4e')]+'%'};return _0x4057b9;})});}_0x5a0a82=_['merge']({},_0x5a0a82,_0x4437e9[_0xabd8('0x51')]);return db[_0xabd8('0x65')]['count']({'where':_0x5a0a82[_0xabd8('0x4c')]})[_0xabd8('0x34')](function(_0x44bc6a){_0x62932a[_0xabd8('0x2e')]=_0x44bc6a;if(_0x4437e9['query'][_0xabd8('0x52')]){_0x5a0a82[_0xabd8('0x56')]=[{'all':!![]}];}return db[_0xabd8('0x65')][_0xabd8('0x53')](_0x5a0a82);})[_0xabd8('0x34')](function(_0x24324d){_0x62932a[_0xabd8('0x69')]=_0x24324d;return _0x62932a;});}})[_0xabd8('0x34')](respondWithFilteredResult(_0x296967,_0x5a0a82))[_0xabd8('0x54')](handleError(_0x296967,null));};exports[_0xabd8('0x6a')]=function(_0x37c4e7,_0x448564,_0x5895c6){return db[_0xabd8('0x3b')][_0xabd8('0x5b')]({'where':{'id':_0x37c4e7[_0xabd8('0x60')]['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x448564,null))['then'](function(_0xb2f15e){if(_0xb2f15e){return _0xb2f15e[_0xabd8('0x6a')](_0x37c4e7[_0xabd8('0x42')][_0xabd8('0x6b')]);}})[_0xabd8('0x34')](respondWithStatusCode(_0x448564,null))[_0xabd8('0x54')](handleError(_0x448564,null));};exports[_0xabd8('0x6c')]=function(_0x7cfdb1,_0x14cfc0,_0x58cf94){if(_0x7cfdb1['body']['id']){delete _0x7cfdb1[_0xabd8('0x57')]['id'];}return db[_0xabd8('0x3b')][_0xabd8('0x5b')]({'where':{'id':_0x7cfdb1['params']['id']}})['then'](handleEntityNotFound(_0x14cfc0,null))[_0xabd8('0x34')](function(_0x31eacc){if(_0x31eacc){_0x7cfdb1['body'][_0xabd8('0x64')]=_0x31eacc['id'];return db['CannedAnswer'][_0xabd8('0x66')](_0x7cfdb1[_0xabd8('0x57')]);}})[_0xabd8('0x34')](respondWithResult(_0x14cfc0,null))['catch'](handleError(_0x14cfc0,null));};exports[_0xabd8('0x6d')]=function(_0xd457e1,_0x20c89f,_0x534cc1){var _0x12ad2c={'raw':![],'where':{}};var _0x2b1e06={};var _0x5e8e8c={'count':0x0,'rows':[]};return db[_0xabd8('0x3b')][_0xabd8('0x68')]({'where':{'id':_0xd457e1['params']['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x20c89f,null))[_0xabd8('0x34')](function(_0x369b80){if(_0x369b80){_0x2b1e06[_0xabd8('0x40')]=_[_0xabd8('0x43')](db['CannedAnswer'][_0xabd8('0x3c')]);_0x2b1e06['query']=_['keys'](_0xd457e1[_0xabd8('0x42')]);_0x2b1e06[_0xabd8('0x44')]=_['intersection'](_0x2b1e06['model'],_0x2b1e06[_0xabd8('0x42')]);_0x12ad2c['attributes']=_[_0xabd8('0x45')](_0x2b1e06[_0xabd8('0x40')],qs[_0xabd8('0x46')](_0xd457e1[_0xabd8('0x42')][_0xabd8('0x46')]));_0x12ad2c[_0xabd8('0x47')]=_0x12ad2c[_0xabd8('0x47')][_0xabd8('0x55')]?_0x12ad2c[_0xabd8('0x47')]:_0x2b1e06[_0xabd8('0x40')];if(!_0xd457e1['query'][_0xabd8('0x48')]('nolimit')){_0x12ad2c['limit']=qs[_0xabd8('0x2d')](_0xd457e1[_0xabd8('0x42')][_0xabd8('0x2d')]);_0x12ad2c[_0xabd8('0x2b')]=qs[_0xabd8('0x2b')](_0xd457e1[_0xabd8('0x42')][_0xabd8('0x2b')]);}_0x12ad2c['order']=qs[_0xabd8('0x4b')](_0xd457e1[_0xabd8('0x42')][_0xabd8('0x4b')]);_0x12ad2c[_0xabd8('0x4c')]=qs[_0xabd8('0x44')](_[_0xabd8('0x4d')](_0xd457e1[_0xabd8('0x42')],_0x2b1e06[_0xabd8('0x44')]));_0x12ad2c['where'][_0xabd8('0x64')]=_0x369b80['id'];if(_0xd457e1[_0xabd8('0x42')][_0xabd8('0x4e')]){_0x12ad2c[_0xabd8('0x4c')]=_[_0xabd8('0x4f')](_0x12ad2c['where'],{'$or':_[_0xabd8('0x41')](_0x12ad2c[_0xabd8('0x47')],function(_0x798ec5){var _0xc2902e={};_0xc2902e[_0x798ec5]={'$like':'%'+_0xd457e1['query'][_0xabd8('0x4e')]+'%'};return _0xc2902e;})});}_0x12ad2c=_[_0xabd8('0x4f')]({},_0x12ad2c,_0xd457e1[_0xabd8('0x51')]);return db[_0xabd8('0x6e')][_0xabd8('0x2e')]({'where':_0x12ad2c[_0xabd8('0x4c')]})['then'](function(_0x509bb0){_0x5e8e8c[_0xabd8('0x2e')]=_0x509bb0;if(_0xd457e1[_0xabd8('0x42')][_0xabd8('0x52')]){_0x12ad2c[_0xabd8('0x56')]=[{'all':!![]}];}return db[_0xabd8('0x6e')][_0xabd8('0x53')](_0x12ad2c);})[_0xabd8('0x34')](function(_0x1a284a){_0x5e8e8c[_0xabd8('0x69')]=_0x1a284a;return _0x5e8e8c;});}})[_0xabd8('0x34')](respondWithFilteredResult(_0x20c89f,_0x12ad2c))[_0xabd8('0x54')](handleError(_0x20c89f,null));};exports[_0xabd8('0x6f')]=function(_0x2b2a7a,_0x2f12f5,_0x4ccc1e){return db['FaxAccount'][_0xabd8('0x5b')]({'where':{'id':_0x2b2a7a[_0xabd8('0x60')]['id']}})['then'](handleEntityNotFound(_0x2f12f5,null))[_0xabd8('0x34')](function(_0x52c130){if(_0x52c130){return _0x52c130['removeAnswers'](_0x2b2a7a[_0xabd8('0x42')][_0xabd8('0x6b')]);}})['then'](respondWithStatusCode(_0x2f12f5,null))[_0xabd8('0x54')](handleError(_0x2f12f5,null));};exports[_0xabd8('0x70')]=function(_0x31d1ac,_0x3f0d92,_0x5bdf4a){return db[_0xabd8('0x71')]['find']({'where':{'id':_0x31d1ac[_0xabd8('0x60')]['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x3f0d92,null))['then'](function(_0x65e0a8){if(_0x65e0a8){return _0x65e0a8[_0xabd8('0x70')](_0x31d1ac[_0xabd8('0x57')]['ids'],_[_0xabd8('0x72')](_0x31d1ac[_0xabd8('0x57')],[_0xabd8('0x6b'),'id'])||{});}})[_0xabd8('0x34')](respondWithResult(_0x3f0d92,null))[_0xabd8('0x54')](handleError(_0x3f0d92,null));};exports['getInteractions']=function(_0x2a26af,_0x1574bd,_0x252c41){var _0x29e3d4={'raw':![],'where':{}};var _0x9ebd6b={};var _0x140e8b={'count':0x0,'rows':[]};return db[_0xabd8('0x3b')][_0xabd8('0x68')]({'where':{'id':_0x2a26af['params']['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x1574bd,null))['then'](function(_0x4f546e){if(_0x4f546e){_0x9ebd6b['model']=_[_0xabd8('0x43')](db['FaxInteraction']['rawAttributes']);_0x9ebd6b[_0xabd8('0x42')]=_[_0xabd8('0x43')](_0x2a26af['query']);_0x9ebd6b['filters']=_[_0xabd8('0x45')](_0x9ebd6b['model'],_0x9ebd6b[_0xabd8('0x42')]);_0x29e3d4[_0xabd8('0x47')]=_['intersection'](_0x9ebd6b['model'],qs[_0xabd8('0x46')](_0x2a26af[_0xabd8('0x42')][_0xabd8('0x46')]));_0x29e3d4[_0xabd8('0x47')]=_0x29e3d4[_0xabd8('0x47')][_0xabd8('0x55')]?_0x29e3d4[_0xabd8('0x47')]:_0x9ebd6b[_0xabd8('0x40')];if(!_0x2a26af[_0xabd8('0x42')][_0xabd8('0x48')](_0xabd8('0x49'))){_0x29e3d4[_0xabd8('0x2d')]=qs['limit'](_0x2a26af[_0xabd8('0x42')]['limit']);_0x29e3d4[_0xabd8('0x2b')]=qs[_0xabd8('0x2b')](_0x2a26af[_0xabd8('0x42')][_0xabd8('0x2b')]);}_0x29e3d4['order']=qs[_0xabd8('0x4b')](_0x2a26af['query']['sort']);_0x29e3d4[_0xabd8('0x4c')]=qs[_0xabd8('0x44')](_[_0xabd8('0x4d')](_0x2a26af[_0xabd8('0x42')],_0x9ebd6b['filters']));_0x29e3d4[_0xabd8('0x4c')][_0xabd8('0x64')]=_0x4f546e['id'];if(_0x2a26af[_0xabd8('0x42')][_0xabd8('0x4e')]){_0x29e3d4[_0xabd8('0x4c')]=_['merge'](_0x29e3d4['where'],{'$or':_[_0xabd8('0x41')](_0x29e3d4['attributes'],function(_0x48ca3b){var _0x2910c8={};_0x2910c8[_0x48ca3b]={'$like':'%'+_0x2a26af['query'][_0xabd8('0x4e')]+'%'};return _0x2910c8;})});}_0x29e3d4=_['merge']({},_0x29e3d4,_0x2a26af[_0xabd8('0x51')]);return db['FaxInteraction'][_0xabd8('0x2e')]({'where':_0x29e3d4[_0xabd8('0x4c')]})['then'](function(_0x52c9df){_0x140e8b['count']=_0x52c9df;if(_0x2a26af[_0xabd8('0x42')][_0xabd8('0x52')]){_0x29e3d4[_0xabd8('0x56')]=[{'model':db[_0xabd8('0x73')],'as':_0xabd8('0x74'),'required':![]},{'model':db['User'],'as':_0xabd8('0x75'),'attributes':['name','fullname',_0xabd8('0x76')],'required':![]},{'model':db[_0xabd8('0x77')],'as':_0xabd8('0x78'),'attributes':['id',_0xabd8('0x38'),_0xabd8('0x79')],'where':_0x2a26af['query']['tag']?{'id':_0x2a26af[_0xabd8('0x42')][_0xabd8('0x7a')]}:undefined,'required':_0x2a26af['query'][_0xabd8('0x7a')]?!![]:![]}];}return db['FaxInteraction'][_0xabd8('0x53')](_0x29e3d4);})[_0xabd8('0x34')](function(_0xb99568){_0x140e8b['rows']=_0xb99568;return _0x140e8b;});}})[_0xabd8('0x34')](respondWithFilteredResult(_0x1574bd,_0x29e3d4))['catch'](handleError(_0x1574bd,null));};exports[_0xabd8('0x7b')]=function(_0x3bac93,_0x5b68a8){var _0x309d6e=_0x3bac93[_0xabd8('0x60')]['id'];var _0x42e03a=_0x3bac93[_0xabd8('0x57')];var _0x2e5d2b=0xc8;var _0x2eb26e=null;return db[_0xabd8('0x7c')]['transaction']({'isolationLevel':db[_0xabd8('0x7c')]['Transaction'][_0xabd8('0x7d')][_0xabd8('0x7e')]},function(_0x428bb3){return db['FaxAccount'][_0xabd8('0x68')]({'where':{'id':_0x309d6e},'transaction':_0x428bb3})['then'](function(_0x6c4e98){if(_0x6c4e98){return db['FaxApplication'][_0xabd8('0x35')]({'where':{'FaxAccountId':_0x309d6e},'transaction':_0x428bb3})[_0xabd8('0x34')](function(){var _0x4f259c=_[_0xabd8('0x41')](_0x42e03a,function(_0x4f60cc){_0x4f60cc['FaxAccountId']=_0x309d6e;return _0x4f60cc;});return db['FaxApplication'][_0xabd8('0x7f')](_0x4f259c,{'transaction':_0x428bb3});});}else{_0x2e5d2b=0x194;_0x2eb26e=[];}});})['then'](function(){if(_0x2e5d2b!==0x194){return db[_0xabd8('0x80')][_0xabd8('0x81')]({'where':{'FaxAccountId':_0x309d6e},'order':_0xabd8('0x82')})[_0xabd8('0x34')](function(_0x57a3ab){_0x2eb26e=_0x57a3ab;});}})['catch'](function(_0x40427b){_0x2e5d2b=0x1f4;logger['error'](_0x40427b[_0xabd8('0x83')]);if(_0x40427b[_0xabd8('0x38')]){delete _0x40427b[_0xabd8('0x38')];}_0x2eb26e=_0x40427b;})[_0xabd8('0x84')](function(){if(_0x2eb26e===null){_0x5b68a8[_0xabd8('0x27')](_0x2e5d2b);}else{if(_0x2e5d2b===0x1f4){_0x5b68a8['status'](_0x2e5d2b)[_0xabd8('0x39')](_0x2eb26e);}else{_0x5b68a8[_0xabd8('0x29')](_0x2e5d2b)[_0xabd8('0x2a')](_0x2eb26e);}}});};exports['getApplications']=function(_0x3581e8,_0x3401fe,_0x432adb){var _0x4d04cf={};var _0x3edc50={};var _0x2fe359;var _0x23ffcf;return db[_0xabd8('0x3b')][_0xabd8('0x68')]({'where':{'id':_0x3581e8[_0xabd8('0x60')]['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x3401fe,null))[_0xabd8('0x34')](function(_0x28f3cb){if(_0x28f3cb){_0x2fe359=_0x28f3cb;_0x3edc50['model']=_[_0xabd8('0x43')](db[_0xabd8('0x80')]['rawAttributes']);_0x3edc50[_0xabd8('0x42')]=_[_0xabd8('0x43')](_0x3581e8[_0xabd8('0x42')]);_0x3edc50[_0xabd8('0x44')]=_[_0xabd8('0x45')](_0x3edc50['model'],_0x3edc50[_0xabd8('0x42')]);_0x4d04cf['attributes']=_[_0xabd8('0x45')](_0x3edc50[_0xabd8('0x40')],qs[_0xabd8('0x46')](_0x3581e8['query'][_0xabd8('0x46')]));_0x4d04cf[_0xabd8('0x47')]=_0x4d04cf['attributes'][_0xabd8('0x55')]?_0x4d04cf[_0xabd8('0x47')]:_0x3edc50['model'];_0x4d04cf[_0xabd8('0x4a')]=qs['sort'](_0x3581e8[_0xabd8('0x42')][_0xabd8('0x4b')]);_0x4d04cf['where']=qs[_0xabd8('0x44')](_[_0xabd8('0x4d')](_0x3581e8[_0xabd8('0x42')],_0x3edc50[_0xabd8('0x44')]));if(_0x3581e8[_0xabd8('0x42')][_0xabd8('0x4e')]){_0x4d04cf[_0xabd8('0x4c')]=_[_0xabd8('0x4f')](_0x4d04cf[_0xabd8('0x4c')],{'$or':_['map'](_0x4d04cf['attributes'],function(_0x397f00){var _0x38fb88={};_0x38fb88[_0x397f00]={'$like':'%'+_0x3581e8['query'][_0xabd8('0x4e')]+'%'};return _0x38fb88;})});}_0x4d04cf=_[_0xabd8('0x4f')]({},_0x4d04cf,_0x3581e8['options']);return _0x2fe359['getApplications'](_0x4d04cf);}})[_0xabd8('0x34')](function(_0x69b3f9){if(_0x69b3f9){_0x23ffcf=_0x69b3f9[_0xabd8('0x55')];if(!_0x3581e8[_0xabd8('0x42')]['hasOwnProperty']('nolimit')){_0x4d04cf['limit']=qs[_0xabd8('0x2d')](_0x3581e8[_0xabd8('0x42')][_0xabd8('0x2d')]);_0x4d04cf[_0xabd8('0x2b')]=qs[_0xabd8('0x2b')](_0x3581e8[_0xabd8('0x42')][_0xabd8('0x2b')]);}return _0x2fe359[_0xabd8('0x85')](_0x4d04cf);}})[_0xabd8('0x34')](function(_0x228e34){if(_0x228e34){return _0x228e34?{'count':_0x23ffcf,'rows':_0x228e34}:null;}})[_0xabd8('0x34')](respondWithResult(_0x3401fe,null))[_0xabd8('0x54')](handleError(_0x3401fe,null));};function Extension(_0x11f11d,_0x563c96,_0x374501,_0x3fc06c){this[_0xabd8('0x86')]='from-voip-provider';this['exten']=_0x11f11d['localstationid'];this['app']=_0x3fc06c;this['type']=_0xabd8('0x87');this[_0xabd8('0x88')]=_0xabd8('0x89');this[_0xabd8('0x64')]=_0x11f11d['id'];this[_0xabd8('0x82')]=_0x563c96;this[_0xabd8('0x8a')]=_0x374501;}function createExtensionsReciveFax(_0x5bba73){var _0x19c889=0x1;var _0x1ef5a9=[];_0x1ef5a9['push'](new Extension(_0x5bba73,_0x19c889,'',_0xabd8('0x8b')));_0x19c889+=0x1;_0x1ef5a9[_0xabd8('0x8c')](new Extension(_0x5bba73,_0x19c889,_0xabd8('0x8d'),'Set'));_0x19c889+=0x1;for(var _0x6306c9 in _0x5bba73){if(_0x5bba73['hasOwnProperty'](_0x6306c9)&&(_0x6306c9===_0xabd8('0x8e')||_0x6306c9===_0xabd8('0x8f')||_0x6306c9===_0xabd8('0x90')||_0x6306c9==='faxdetect'||_0x6306c9===_0xabd8('0x91')||_0x6306c9===_0xabd8('0x92')||_0x6306c9==='minrate'||_0x6306c9==='modem'||_0x6306c9==='t38timeout')){_0x1ef5a9[_0xabd8('0x8c')](new Extension(_0x5bba73,_0x19c889,'FAXOPT('+_0x6306c9+')='+_0x5bba73[_0x6306c9],'Set'));_0x19c889+=0x1;}}_0x1ef5a9[_0xabd8('0x8c')](new Extension(_0x5bba73,_0x19c889,'6','Wait'));_0x19c889+=0x1;_0x1ef5a9[_0xabd8('0x8c')](new Extension(_0x5bba73,_0x19c889,'/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',_0xabd8('0x93')));_0x19c889=0x0;return _0x1ef5a9;}exports[_0xabd8('0x94')]=function(_0x5e3842,_0x1ebc0f,_0x2dd1dd){var _0x5ef192;return db['sequelize']['transaction'](function(_0x520c66){return db['FaxAccount'][_0xabd8('0x66')](_0x5e3842['body'],{'transaction':_0x520c66})[_0xabd8('0x34')](function(_0x25a61e){_0x5ef192=_0x25a61e[_0xabd8('0x95')]({'plain':!![]});return db[_0xabd8('0x96')][_0xabd8('0x7f')](createExtensionsReciveFax(_0x5ef192),{'transaction':_0x520c66});});})[_0xabd8('0x34')](function(){return _0x5ef192;})['then'](respondWithResult(_0x1ebc0f,null))[_0xabd8('0x54')](handleError(_0x1ebc0f,null));};exports[_0xabd8('0x97')]=function(_0x5c0108,_0xd38cd5,_0x56bf87){var _0x7b698b;return db[_0xabd8('0x7c')][_0xabd8('0x98')](function(_0x3a6ba3){return db['FaxAccount'][_0xabd8('0x5f')](_0x5c0108[_0xabd8('0x57')],{'where':{'id':_0x5c0108[_0xabd8('0x57')]['id']},'transaction':_0x3a6ba3})[_0xabd8('0x34')](function(_0x1da5cd){return db['VoiceExtension'][_0xabd8('0x35')]({'where':{'FaxAccountId':_0x5c0108[_0xabd8('0x57')]['id']},'transaction':_0x3a6ba3})[_0xabd8('0x34')](function(_0x6ae1f2){return db['VoiceExtension'][_0xabd8('0x7f')](createExtensionsReciveFax(_[_0xabd8('0x72')](_0x5c0108[_0xabd8('0x57')],[_0xabd8('0x99'),'key',_0xabd8('0x9a'),_0xabd8('0x9b'),_0xabd8('0x9c'),_0xabd8('0x9d')])),{'transaction':_0x3a6ba3});});});})[_0xabd8('0x34')](function(){return db[_0xabd8('0x3b')][_0xabd8('0x9e')](_0x5c0108[_0xabd8('0x57')]['id']);})['then'](respondWithResult(_0xd38cd5,null))[_0xabd8('0x54')](handleError(_0xd38cd5,null));};exports[_0xabd8('0x9f')]=function(_0x2a38d5,_0x268e34,_0x261b7d){var _0x566ec1={'raw':!![],'where':{}};var _0x131ef9={};var _0x1827b4={'count':0x0,'rows':[]};return db[_0xabd8('0x3b')][_0xabd8('0x68')]({'where':{'id':_0x2a38d5['params']['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x268e34,null))['then'](function(_0x33aac3){if(_0x33aac3){_0x131ef9['model']=_['keys'](db[_0xabd8('0xa0')][_0xabd8('0x3c')]);_0x131ef9[_0xabd8('0x42')]=_[_0xabd8('0x43')](_0x2a38d5[_0xabd8('0x42')]);_0x131ef9[_0xabd8('0x44')]=_[_0xabd8('0x45')](_0x131ef9['model'],_0x131ef9[_0xabd8('0x42')]);_0x566ec1[_0xabd8('0x47')]=_[_0xabd8('0x45')](_0x131ef9['model'],qs[_0xabd8('0x46')](_0x2a38d5[_0xabd8('0x42')][_0xabd8('0x46')]));_0x566ec1['attributes']=_0x566ec1[_0xabd8('0x47')]['length']?_0x566ec1[_0xabd8('0x47')]:_0x131ef9[_0xabd8('0x40')];if(!_0x2a38d5[_0xabd8('0x42')][_0xabd8('0x48')](_0xabd8('0x49'))){_0x566ec1[_0xabd8('0x2d')]=qs[_0xabd8('0x2d')](_0x2a38d5['query'][_0xabd8('0x2d')]);_0x566ec1[_0xabd8('0x2b')]=qs[_0xabd8('0x2b')](_0x2a38d5[_0xabd8('0x42')][_0xabd8('0x2b')]);}_0x566ec1[_0xabd8('0x4a')]=qs[_0xabd8('0x4b')](_0x2a38d5[_0xabd8('0x42')][_0xabd8('0x4b')]);_0x566ec1['where']=qs[_0xabd8('0x44')](_['pick'](_0x2a38d5[_0xabd8('0x42')],_0x131ef9[_0xabd8('0x44')]));_0x566ec1[_0xabd8('0x4c')][_0xabd8('0x64')]=_0x33aac3['id'];if(_0x2a38d5['query'][_0xabd8('0x4e')]){_0x566ec1[_0xabd8('0x4c')]=_[_0xabd8('0x4f')](_0x566ec1[_0xabd8('0x4c')],{'$or':_['map'](_0x566ec1['attributes'],function(_0x453fa2){var _0x489af7={};_0x489af7[_0x453fa2]={'$like':'%'+_0x2a38d5[_0xabd8('0x42')]['filter']+'%'};return _0x489af7;})});}if(_0x2a38d5[_0xabd8('0x42')][_0xabd8('0xa1')]){var _0xa3577f=_0x2a38d5[_0xabd8('0x42')][_0xabd8('0xa1')][_0xabd8('0xa2')](',');var _0x43dc7a={};_0x43dc7a[_0xa3577f[0x0]]={'$gte':moment(_0xa3577f[0x1])[_0xabd8('0xa3')](_0xabd8('0xa4'))};_0x566ec1[_0xabd8('0x4c')]=_[_0xabd8('0x4f')](_0x566ec1['where'],_0x43dc7a);}_0x566ec1=_[_0xabd8('0x4f')]({},_0x566ec1,_0x2a38d5[_0xabd8('0x51')]);return db['FaxMessage'][_0xabd8('0x2e')]({'where':_0x566ec1[_0xabd8('0x4c')]})['then'](function(_0x2aff41){_0x1827b4[_0xabd8('0x2e')]=_0x2aff41;if(_0x2a38d5[_0xabd8('0x42')][_0xabd8('0x52')]){_0x566ec1[_0xabd8('0x56')]=[{'all':!![]}];}return db[_0xabd8('0xa0')][_0xabd8('0x53')](_0x566ec1);})[_0xabd8('0x34')](function(_0x3b318b){_0x1827b4[_0xabd8('0x69')]=_0x3b318b;return _0x1827b4;});}})['then'](respondWithFilteredResult(_0x268e34,_0x566ec1))[_0xabd8('0x54')](handleError(_0x268e34,null));};exports[_0xabd8('0x39')]=function(_0x27aeb2,_0xa00b17,_0x44e483){var _0xc0caee,_0x181abd={},_0x29edd0;if(_0x27aeb2[_0xabd8('0x57')]['to']){_0x29edd0=_0x27aeb2[_0xabd8('0x57')]['to'][0x0];}return db[_0xabd8('0x3b')]['find']({'where':{'id':_0x27aeb2['params']['id']},'include':[{'model':db[_0xabd8('0xa5')],'as':_0xabd8('0xa6'),'include':[{'model':db[_0xabd8('0x73')],'as':_0xabd8('0xa7'),'where':{'fax':_0x29edd0},'limit':0x1,'order':[[_0xabd8('0x9b'),_0xabd8('0xa8')]]}]}]})[_0xabd8('0x34')](handleEntityNotFound(_0xa00b17,null))['then'](function(_0x244177){_0xc0caee=_0x244177;if(_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')]&&_0x27aeb2['body']['attachments'][_0xabd8('0x55')]){for(var _0x360e39=0x0;_0x360e39<_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][_0xabd8('0x55')];_0x360e39+=0x1){_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][_0x360e39]={'filename':_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][_0x360e39][_0xabd8('0x38')],'id':_0x27aeb2[_0xabd8('0x57')]['attachments'][_0x360e39]['id'],'path':path[_0xabd8('0xaa')](config[_0xabd8('0xab')],_0xabd8('0xac'),_0x27aeb2['body'][_0xabd8('0xa9')][_0x360e39]['basename'])};}}return respondWithRpcPromise(_0xabd8('0xad'),_0xabd8('0xad'),{'FaxAccountId':_[_0xabd8('0xae')](_0x27aeb2[_0xabd8('0x60')]['id'])?undefined:_0x27aeb2[_0xabd8('0x60')]['id'],'path':_[_0xabd8('0xae')](_0x27aeb2['body'][_0xabd8('0xa9')][0x0]['path'])?undefined:_0x27aeb2['body']['attachments'][0x0][_0xabd8('0x7')],'fax':_[_0xabd8('0xae')](_0x27aeb2['body']['to'][0x0])?undefined:_0x27aeb2[_0xabd8('0x57')]['to'][0x0]},client9002);})['then'](function(){if(_0xc0caee){if(_[_0xabd8('0xae')](_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xaf')])){_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xaf')]=util[_0xabd8('0xa3')](_0xabd8('0xb0'),_0xc0caee[_0xabd8('0x38')],_0xc0caee[_0xabd8('0xb1')]);}if(_0xc0caee[_0xabd8('0xa6')]){if(_0xc0caee['List'][_0xabd8('0xa7')][_0xabd8('0x55')]){return _0xc0caee[_0xabd8('0xa6')][_0xabd8('0xa7')][0x0];}else{return db[_0xabd8('0x73')][_0xabd8('0x66')](_[_0xabd8('0x19')](_0x27aeb2['body'],{'firstName':_0x27aeb2[_0xabd8('0x57')]['to'][0x0],'phone':_0x27aeb2[_0xabd8('0x57')]['to'][0x0],'fax':_0x27aeb2[_0xabd8('0x57')]['to'][0x0],'ListId':_0xc0caee[_0xabd8('0x9d')]}));}}else{throw new Error(_0xabd8('0xb2'));}}else{throw new Error(_0xabd8('0xb3'));}})[_0xabd8('0x34')](function(_0x1bb025){if(_0x1bb025){return db[_0xabd8('0x71')][_0xabd8('0x5b')]({'where':{'ContactId':_0x1bb025['id'],'closed':![],'FaxAccountId':_0xc0caee['id']}})[_0xabd8('0x34')](function(_0x237f91){if(_0x237f91){return[_0x237f91,![]];}return db[_0xabd8('0x71')]['create']({'UserId':_0x27aeb2[_0xabd8('0x58')]['id'],'ContactId':_0x1bb025['id'],'FaxAccountId':_0xc0caee['id'],'fax':_0x27aeb2[_0xabd8('0x57')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x27aeb2['body'],{'read':![],'body':_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][0x0][_0xabd8('0xb4')],'FaxAccountId':_0xc0caee['id'],'UserId':_0x27aeb2[_0xabd8('0x58')]['id'],'ContactId':_0x1bb025['id'],'AttachmentId':_0x27aeb2[_0xabd8('0x57')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xabd8('0xb5')}]})[_0xabd8('0x34')](function(_0x1a04a0){return[_0x1a04a0,!![]];});});}else{throw new Error(_0xabd8('0xb6'));}})[_0xabd8('0xb7')](function(_0x543018,_0x31f554){if(_0x31f554){return _0x543018;}return db[_0xabd8('0xa0')]['create']({'direction':'out','read':![],'body':_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][0x0][_0xabd8('0xb4')],'FaxAccountId':_0xc0caee['id'],'FaxInteractionId':_0x543018['id'],'UserId':_0x27aeb2['user']['id'],'ContactId':_0x543018['ContactId'],'AttachmentId':_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][0x0]['id']})['then'](function(_0x39a00d){_0x543018[_0xabd8('0xb8')][_0xabd8('0xb5')]=[];_0x543018[_0xabd8('0xb8')][_0xabd8('0xb5')][_0xabd8('0x8c')](_0x39a00d[_0xabd8('0xb8')]);return _0x543018;});})[_0xabd8('0x34')](function(_0x1193f3){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xabd8('0xae')](_0x27aeb2[_0xabd8('0x60')]['id'])?undefined:_0x27aeb2['params']['id'],'path':_['isNil'](_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][0x0]['path'])?undefined:_0x27aeb2[_0xabd8('0x57')]['attachments'][0x0][_0xabd8('0x7')],'fax':_[_0xabd8('0xae')](_0x27aeb2[_0xabd8('0x57')]['to'][0x0])?undefined:_0x27aeb2[_0xabd8('0x57')]['to'][0x0],'AttachmentId':_0x27aeb2[_0xabd8('0x57')][_0xabd8('0xa9')][0x0]['id']},client9002)['then'](function(_0x52e1bd){logger[_0xabd8('0x1f')]('SendFaxRpc,\x20%s',_0x52e1bd);})['catch'](function(_0x269d91){logger[_0xabd8('0x1f')](_0xabd8('0xb9'),_0x269d91);});return _0x1193f3;})['then'](respondWithResult(_0xa00b17,null))[_0xabd8('0x54')](handleError(_0xa00b17,null));};exports[_0xabd8('0xba')]=function(_0x3f181b,_0x195981,_0xff925d){return db['FaxAccount'][_0xabd8('0x5b')]({'where':{'id':_0x3f181b[_0xabd8('0x60')]['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x195981,null))[_0xabd8('0x34')](function(_0xb8f832){if(_0xb8f832){return _0xb8f832['addAgents'](_0x3f181b[_0xabd8('0x57')]['ids'],_[_0xabd8('0x72')](_0x3f181b[_0xabd8('0x57')],[_0xabd8('0x6b'),'id'])||{})[_0xabd8('0xb7')](function(_0x373f19){for(var _0x5e1b0f=0x0;_0x5e1b0f<_0x3f181b[_0xabd8('0x57')]['ids']['length'];_0x5e1b0f+=0x1){socket[_0xabd8('0xbb')](_0xabd8('0xbc'),{'UserId':Number(_0x3f181b[_0xabd8('0x57')][_0xabd8('0x6b')][_0x5e1b0f]),'FaxAccountId':Number(_0x3f181b[_0xabd8('0x60')]['id'])});}return _0x373f19;});}})[_0xabd8('0x34')](respondWithResult(_0x195981,null))[_0xabd8('0x54')](handleError(_0x195981,null));};exports[_0xabd8('0xbd')]=function(_0x537c1d,_0x38e6c2,_0x54d41d){return db[_0xabd8('0x3b')][_0xabd8('0x5b')]({'where':{'id':_0x537c1d[_0xabd8('0x60')]['id']}})[_0xabd8('0x34')](handleEntityNotFound(_0x38e6c2,null))['then'](function(_0x39542d){if(_0x39542d){return _0x39542d[_0xabd8('0xbd')](_0x537c1d[_0xabd8('0x42')][_0xabd8('0x6b')])['then'](function(){if(_[_0xabd8('0xbe')](_0x537c1d[_0xabd8('0x42')]['ids'])){for(var _0x4346db=0x0;_0x4346db<_0x537c1d['query'][_0xabd8('0x6b')][_0xabd8('0x55')];_0x4346db+=0x1){socket['emit'](_0xabd8('0xbf'),{'UserId':Number(_0x537c1d[_0xabd8('0x42')]['ids'][_0x4346db]),'FaxAccountId':Number(_0x537c1d['params']['id'])});}}else{socket['emit'](_0xabd8('0xbf'),{'UserId':Number(_0x537c1d[_0xabd8('0x42')][_0xabd8('0x6b')]),'FaxAccountId':Number(_0x537c1d['params']['id'])});}});}})[_0xabd8('0x34')](respondWithStatusCode(_0x38e6c2,null))[_0xabd8('0x54')](handleError(_0x38e6c2,null));};exports[_0xabd8('0xc0')]=function(_0x64a9e7,_0x124d3e,_0x5d5a6e){var _0x5e926f={};var _0xd5a6b0={};var _0x63c126;var _0x11a613;return db['FaxAccount']['findOne']({'where':{'id':_0x64a9e7[_0xabd8('0x60')]['id']}})['then'](handleEntityNotFound(_0x124d3e,null))[_0xabd8('0x34')](function(_0x4d9a9a){if(_0x4d9a9a){_0x63c126=_0x4d9a9a;_0xd5a6b0[_0xabd8('0x40')]=_[_0xabd8('0x43')](db[_0xabd8('0xc1')][_0xabd8('0x3c')]);_0xd5a6b0[_0xabd8('0x42')]=_['keys'](_0x64a9e7[_0xabd8('0x42')]);_0xd5a6b0[_0xabd8('0x44')]=_['intersection'](_0xd5a6b0['model'],_0xd5a6b0[_0xabd8('0x42')]);_0x5e926f[_0xabd8('0x47')]=_[_0xabd8('0x45')](_0xd5a6b0[_0xabd8('0x40')],qs[_0xabd8('0x46')](_0x64a9e7[_0xabd8('0x42')][_0xabd8('0x46')]));_0x5e926f[_0xabd8('0x47')]=_0x5e926f[_0xabd8('0x47')][_0xabd8('0x55')]?_0x5e926f['attributes']:_0xd5a6b0['model'];_0x5e926f['order']=qs[_0xabd8('0x4b')](_0x64a9e7[_0xabd8('0x42')][_0xabd8('0x4b')]);_0x5e926f[_0xabd8('0x4c')]=qs[_0xabd8('0x44')](_[_0xabd8('0x4d')](_0x64a9e7[_0xabd8('0x42')],_0xd5a6b0[_0xabd8('0x44')]));if(_0x64a9e7[_0xabd8('0x42')][_0xabd8('0x4e')]){_0x5e926f[_0xabd8('0x4c')]=_['merge'](_0x5e926f['where'],{'$or':_[_0xabd8('0x41')](_0x5e926f['attributes'],function(_0x109624){var _0x3e75f7={};_0x3e75f7[_0x109624]={'$like':'%'+_0x64a9e7[_0xabd8('0x42')][_0xabd8('0x4e')]+'%'};return _0x3e75f7;})});}_0x5e926f=_[_0xabd8('0x4f')]({},_0x5e926f,_0x64a9e7['options']);return _0x63c126['getAgents'](_0x5e926f);}})[_0xabd8('0x34')](function(_0x1eed3a){if(_0x1eed3a){_0x11a613=_0x1eed3a[_0xabd8('0x55')];if(!_0x64a9e7[_0xabd8('0x42')]['hasOwnProperty']('nolimit')){_0x5e926f[_0xabd8('0x2d')]=qs[_0xabd8('0x2d')](_0x64a9e7[_0xabd8('0x42')][_0xabd8('0x2d')]);_0x5e926f[_0xabd8('0x2b')]=qs[_0xabd8('0x2b')](_0x64a9e7['query'][_0xabd8('0x2b')]);}return _0x63c126['getAgents'](_0x5e926f);}})[_0xabd8('0x34')](function(_0x3dbff4){if(_0x3dbff4){return _0x3dbff4?{'count':_0x11a613,'rows':_0x3dbff4}:null;}})[_0xabd8('0x34')](respondWithResult(_0x124d3e,null))[_0xabd8('0x54')](handleError(_0x124d3e,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b9a6056..043ef37 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 _0x2b61=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hook'];(function(_0x31de4c,_0x5facf3){var _0x3f21d1=function(_0x31bf80){while(--_0x31bf80){_0x31de4c['push'](_0x31de4c['shift']());}};_0x3f21d1(++_0x5facf3);}(_0x2b61,0x1ba));var _0x12b6=function(_0x4144ef,_0x3ed22b){_0x4144ef=_0x4144ef-0x0;var _0x3691ba=_0x2b61[_0x4144ef];return _0x3691ba;};'use strict';var EventEmitter=require(_0x12b6('0x0'));var FaxAccount=require(_0x12b6('0x1'))['db'][_0x12b6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x12b6('0x3')](0x0);var events={'afterCreate':_0x12b6('0x4'),'afterUpdate':'update','afterDestroy':_0x12b6('0x5')};function emitEvent(_0x4f4165){return function(_0x41413e,_0x4edfc3,_0x306aa7){FaxAccountEvents[_0x12b6('0x6')](_0x4f4165+':'+_0x41413e['id'],_0x41413e);FaxAccountEvents[_0x12b6('0x6')](_0x4f4165,_0x41413e);_0x306aa7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x12b6('0x7')](e,emitEvent(event));}}module[_0x12b6('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x15fe=['events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit','hook','exports'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x15fe,0x158));var _0xe15f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15fe[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xe15f('0x0'));var FaxAccount=require(_0xe15f('0x1'))['db'][_0xe15f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe15f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe15f('0x4')};function emitEvent(_0x49551d){return function(_0x462314,_0x49edce,_0x57bdec){FaxAccountEvents[_0xe15f('0x5')](_0x49551d+':'+_0x462314['id'],_0x462314);FaxAccountEvents[_0xe15f('0x5')](_0x49551d,_0x462314);_0x57bdec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xe15f('0x6')](e,emitEvent(event));}}module[_0xe15f('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ae8879f..6ea49bc 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 _0xad51=['request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','api','moment','bluebird'];(function(_0x5099e9,_0x35303a){var _0x4f5a60=function(_0x55ca8a){while(--_0x55ca8a){_0x5099e9['push'](_0x5099e9['shift']());}};_0x4f5a60(++_0x35303a);}(_0xad51,0x14a));var _0x1ad5=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xad51[_0x30a31e];return _0x170879;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1ad5('0x0'));var moment=require(_0x1ad5('0x1'));var BPromise=require(_0x1ad5('0x2'));var rp=require(_0x1ad5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ad5('0x4'));var config=require(_0x1ad5('0x5'));var attributes=require(_0x1ad5('0x6'));module['exports']=function(_0x5d0511,_0x22908f){return _0x5d0511[_0x1ad5('0x7')](_0x1ad5('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9bf=['moment','bluebird','request-promise','../../config/environment','./faxAccount.attributes','FaxAccount','fax_accounts','lodash'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe9bf,0xa7));var _0xfe9b=function(_0x4e0fa4,_0x130453){_0x4e0fa4=_0x4e0fa4-0x0;var _0x19640b=_0xe9bf[_0x4e0fa4];return _0x19640b;};'use strict';var _=require(_0xfe9b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfe9b('0x1'));var BPromise=require(_0xfe9b('0x2'));var rp=require(_0xfe9b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfe9b('0x4'));var attributes=require(_0xfe9b('0x5'));module['exports']=function(_0x58f21c,_0x4e76aa){return _0x58f21c['define'](_0xfe9b('0x6'),attributes,{'tableName':_0xfe9b('0x7'),'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 1e42df9..413a169 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 _0x7051=['error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','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','FaxAccount','find','account','Contacts','DESC','FaxApplication','Applications','List','get','list','applications','orderBy','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1627cd,_0x2a9058){var _0x3d7971=function(_0x15d6a8){while(--_0x15d6a8){_0x1627cd['push'](_0x1627cd['shift']());}};_0x3d7971(++_0x2a9058);}(_0x7051,0x157));var _0x1705=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0x7051[_0x4a8bad];return _0x30cf32;};'use strict';var _=require(_0x1705('0x0'));var util=require('util');var moment=require(_0x1705('0x1'));var BPromise=require(_0x1705('0x2'));var rs=require(_0x1705('0x3'));var fs=require('fs');var Redis=require(_0x1705('0x4'));var db=require(_0x1705('0x5'))['db'];var utils=require(_0x1705('0x6'));var logger=require('../../config/logger')(_0x1705('0x7'));var config=require(_0x1705('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1705('0x9')]['http']({'port':0x232c});config[_0x1705('0xa')]=_[_0x1705('0xb')](config[_0x1705('0xa')],{'host':_0x1705('0xc'),'port':0x18eb});var socket=require(_0x1705('0xd'))(new Redis(config[_0x1705('0xa')]));require(_0x1705('0xe'))[_0x1705('0xf')](socket);function respondWithRpcPromise(_0x172f30,_0x53e72d,_0x14c295){return new BPromise(function(_0x2ac75b,_0x34f228){return client['request'](_0x172f30,_0x14c295)[_0x1705('0x10')](function(_0xa46eb5){logger['info']('FaxAccount,\x20%s,\x20%s',_0x53e72d,'request\x20sent');logger[_0x1705('0x11')](_0x1705('0x12'),_0x53e72d,_0x1705('0x13'),JSON[_0x1705('0x14')](_0xa46eb5));if(_0xa46eb5['error']){if(_0xa46eb5[_0x1705('0x15')][_0x1705('0x16')]===0x1f4){logger['error'](_0x1705('0x17'),_0x53e72d,_0xa46eb5['error'][_0x1705('0x18')]);return _0x34f228(_0xa46eb5['error'][_0x1705('0x18')]);}logger['error'](_0x1705('0x17'),_0x53e72d,_0xa46eb5[_0x1705('0x15')]['message']);return _0x2ac75b(_0xa46eb5[_0x1705('0x15')][_0x1705('0x18')]);}else{logger[_0x1705('0x19')](_0x1705('0x17'),_0x53e72d,_0x1705('0x13'));_0x2ac75b(_0xa46eb5['result'][_0x1705('0x18')]);}})[_0x1705('0x1a')](function(_0x552c00){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53e72d,_0x552c00);_0x34f228(_0x552c00);});});}exports[_0x1705('0x1b')]=function(_0x49c700){var _0x8b67ed=this;return new Promise(function(_0x253f00,_0x5486dd){return db['FaxAccount'][_0x1705('0x1c')]({'raw':_0x49c700[_0x1705('0x1d')]?_0x49c700[_0x1705('0x1d')][_0x1705('0x1e')]===undefined?!![]:![]:!![],'where':_0x49c700[_0x1705('0x1d')]?_0x49c700[_0x1705('0x1d')][_0x1705('0x1f')]||null:null,'attributes':_0x49c700[_0x1705('0x1d')]?_0x49c700[_0x1705('0x1d')][_0x1705('0x20')]||null:null,'limit':_0x49c700[_0x1705('0x1d')]?_0x49c700['options'][_0x1705('0x21')]||null:null,'include':_0x49c700['options']?_0x49c700[_0x1705('0x1d')][_0x1705('0x22')]?_['map'](_0x49c700[_0x1705('0x1d')][_0x1705('0x22')],function(_0x276ddc){return{'model':db[_0x276ddc['model']],'as':_0x276ddc['as'],'attributes':_0x276ddc[_0x1705('0x20')],'include':_0x276ddc[_0x1705('0x22')]?_[_0x1705('0x23')](_0x276ddc[_0x1705('0x22')],function(_0x516fc9){return{'model':db[_0x516fc9['model']],'as':_0x516fc9['as'],'attributes':_0x516fc9[_0x1705('0x20')],'include':_0x516fc9[_0x1705('0x22')]?_[_0x1705('0x23')](_0x516fc9['include'],function(_0x5ec967){return{'model':db[_0x5ec967[_0x1705('0x24')]],'as':_0x5ec967['as'],'attributes':_0x5ec967[_0x1705('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1705('0x10')](function(_0x399673){logger[_0x1705('0x19')](_0x1705('0x1b'),_0x49c700);logger[_0x1705('0x11')](_0x1705('0x1b'),_0x49c700,JSON[_0x1705('0x14')](_0x399673));_0x253f00(_0x399673);})[_0x1705('0x1a')](function(_0x152270){logger[_0x1705('0x15')](_0x1705('0x1b'),_0x152270[_0x1705('0x18')],_0x49c700);_0x5486dd(_0x8b67ed[_0x1705('0x15')](0x1f4,_0x152270[_0x1705('0x18')]));});});};exports[_0x1705('0x25')]=function(_0x1e8423,_0x5d64d0,_0x541040){var _0x248b30=this;return new Promise(function(_0x5339d0,_0x333e99){var _0x140aca={'body':_0x1e8423['body'],'channel':_0x1705('0x26')};var _0x15f62b=[];var _0x81cbe=[];var _0x50fb31={};return db[_0x1705('0x27')][_0x1705('0x28')]()[_0x1705('0x10')](function(_0x134a81){if(!_0x134a81){throw new db[(_0x1705('0x29'))][(_0x1705('0x2a'))]('no\x20available\x20attributes');}_0x15f62b=_[_0x1705('0x2b')](_[_0x1705('0x2c')](_0x134a81),[_0x1705('0x2d'),_0x1705('0x2e')]);_0x81cbe=_['difference'](_[_0x1705('0x2c')](_0x134a81),[_0x1705('0x2d'),'updatedAt',_0x1705('0x2f'),_0x1705('0x30')]);if(_0x1e8423['body']['id']){delete _0x1e8423[_0x1705('0x31')]['id'];}if(_[_0x1705('0x32')](_0x1e8423[_0x1705('0x31')][_0x1705('0x33')])){throw new db['Sequelize'][(_0x1705('0x2a'))](_0x1705('0x34'));}if(_['isNil'](_0x1e8423[_0x1705('0x31')]['body'])||_0x1e8423[_0x1705('0x31')][_0x1705('0x31')]===''){throw new db['Sequelize'][(_0x1705('0x2a'))](_0x1705('0x35'));}if(_[_0x1705('0x32')](_0x1e8423[_0x1705('0x31')][_0x1705('0x36')])){throw new db['Sequelize'][(_0x1705('0x2a'))](_0x1705('0x37')+_0x81cbe);}if(!_[_0x1705('0x38')](_0x81cbe,_0x1e8423[_0x1705('0x31')]['mapKey'])){throw new db[(_0x1705('0x29'))][(_0x1705('0x2a'))](_0x1705('0x39')+_0x81cbe);}_0x50fb31[_0x1e8423[_0x1705('0x31')][_0x1705('0x36')]]=_0x1e8423['body']['from'];})[_0x1705('0x10')](function(){return db[_0x1705('0x3a')][_0x1705('0x3b')]({'where':{'id':_0x1e8423[_0x1705('0x3c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x1705('0x3d'),'where':_0x50fb31,'limit':0x1,'order':[[_0x1705('0x2e'),_0x1705('0x3e')]]}]},{'model':db[_0x1705('0x3f')],'as':_0x1705('0x40')}]});})[_0x1705('0x10')](function(_0x19d760){if(_0x19d760&&_0x19d760[_0x1705('0x41')]){var _0x3d3d8f=_0x19d760[_0x1705('0x42')]({'plain':!![]});_0x140aca[_0x1705('0x3c')]=_0x3d3d8f;_0x140aca['applications']=_0x3d3d8f[_0x1705('0x40')];_0x140aca[_0x1705('0x43')]=_0x3d3d8f['List'];_0x140aca[_0x1705('0x44')]=_[_0x1705('0x45')](_0x140aca[_0x1705('0x44')],['priority'],['asc']);if(_0x140aca[_0x1705('0x3c')][_0x1705('0x40')]){delete _0x140aca[_0x1705('0x3c')]['Applications'];}if(_0x140aca['account'][_0x1705('0x41')]&&_0x140aca['account']['List'][_0x1705('0x3d')]['length']){return _0x140aca[_0x1705('0x3c')][_0x1705('0x41')][_0x1705('0x3d')][0x0];}var _0x194793=_['defaults'](_0x1e8423['body'],{'firstName':_0x1e8423[_0x1705('0x31')][_0x1705('0x33')],'ListId':_0x3d3d8f['ListId']});_0x194793[_0x1e8423[_0x1705('0x31')]['mapKey']]=_0x1e8423['body'][_0x1705('0x33')];return db[_0x1705('0x27')][_0x1705('0x46')](_0x194793,{'fields':_0x15f62b,'raw':!![]});}})[_0x1705('0x10')](function(_0x513cbd){_0x140aca[_0x1705('0x47')]=_0x513cbd;if(_0x513cbd){var _0x451a48={'ContactId':_0x513cbd['id'],'FaxAccountId':_0x1e8423['account']['id'],'fax':_0x513cbd[_0x1705('0x26')]};return db[_0x1705('0x48')]['find']({'where':{'ContactId':_0x513cbd['id'],'closed':![],'FaxAccountId':_0x1e8423[_0x1705('0x3c')]['id']}})['then'](function(_0x21e250){if(_0x21e250){return[_0x21e250,![]];}return db[_0x1705('0x48')][_0x1705('0x46')](_0x451a48)[_0x1705('0x10')](function(_0x39479d){return[_0x39479d,!![]];});});}else{throw new Error(_0x1705('0x49'));}})[_0x1705('0x4a')](function(_0x15dd3c,_0x650947){var _0x1d7437=_0x15dd3c[_0x1705('0x42')]({'plain':!![]});if(_0x650947){if(_0x140aca[_0x1705('0x3c')]['autoclose']){_0x140aca[_0x1705('0x44')][_0x1705('0x4b')]({'id':0x0,'priority':_0x140aca[_0x1705('0x44')][_0x1705('0x4c')]+0x1,'app':_0x1705('0x4d'),'appdata':_0x1705('0x4e'),'interval':_0x1705('0x4f')});}_0x1d7437[_0x1705('0x50')]=!![];}else{_0x1d7437['created']=![];}_0x140aca[_0x1705('0x51')]=_0x1d7437;return db[_0x1705('0x52')][_0x1705('0x46')]({'body':_0x1e8423['body'][_0x1705('0x31')],'FaxAccountId':_0x1e8423[_0x1705('0x3c')]['id'],'FaxInteractionId':_0x15dd3c['id'],'direction':'in','ContactId':_0x15dd3c[_0x1705('0x53')],'AttachmentId':_0x1e8423[_0x1705('0x31')]['AttachmentId']});})['then'](function(_0x413d86){_0x140aca[_0x1705('0x18')]=_0x413d86;if(_0x140aca[_0x1705('0x51')][_0x1705('0x54')]){return db[_0x1705('0x55')][_0x1705('0x3b')]({'attributes':['id',_0x1705('0x56')],'where':{'id':_0x140aca[_0x1705('0x51')][_0x1705('0x54')]}})['then'](function(_0x2a58da){if(_0x2a58da){_0x140aca['applications'][_0x1705('0x57')]({'id':0x0,'priority':0x0,'app':_0x1705('0x58'),'appdata':_0x2a58da[_0x1705('0x56')]+','+(_0x140aca[_0x1705('0x3c')][_0x1705('0x59')]||0xa),'interval':_0x1705('0x4f')});}return respondWithRpcPromise(_0x1705('0x5a'),'startRouting',_0x140aca);});}return respondWithRpcPromise(_0x1705('0x5a'),'startRouting',_0x140aca);})[_0x1705('0x10')](function(_0x348ac8){_0x5339d0(_0x348ac8);})['catch'](function(_0x53ef08){_0x333e99(_0x248b30[_0x1705('0x15')](0x1f4,_0x53ef08[_0x1705('0x18')]));});});}; \ No newline at end of file +var _0xf164=['error','code','message','result','catch','FaxAccount','options','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','CompanyId','ListId','isNil','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','from','find','account','CmList','DESC','FaxApplication','Applications','List','list','applications','orderBy','asc','Contacts','length','contact','fax','FaxInteraction','Contact\x20not\x20found','get','autoclose','close','unmanaged','created','FaxMessage','create','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f9c0a,_0x308110){var _0x5086cd=function(_0x118fd7){while(--_0x118fd7){_0x1f9c0a['push'](_0x1f9c0a['shift']());}};_0x5086cd(++_0x308110);}(_0xf164,0xfc));var _0x4f16=function(_0x5c3993,_0x5b9b11){_0x5c3993=_0x5c3993-0x0;var _0x5144ab=_0xf164[_0x5c3993];return _0x5144ab;};'use strict';var _=require(_0x4f16('0x0'));var util=require('util');var moment=require(_0x4f16('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f16('0x2'));var fs=require('fs');var Redis=require(_0x4f16('0x3'));var db=require(_0x4f16('0x4'))['db'];var utils=require(_0x4f16('0x5'));var logger=require(_0x4f16('0x6'))(_0x4f16('0x7'));var config=require(_0x4f16('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f16('0x9')][_0x4f16('0xa')]({'port':0x232c});config[_0x4f16('0xb')]=_[_0x4f16('0xc')](config[_0x4f16('0xb')],{'host':_0x4f16('0xd'),'port':0x18eb});var socket=require(_0x4f16('0xe'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x4f16('0xf')](socket);function respondWithRpcPromise(_0x3b69af,_0x2cc16b,_0x14e4ed){return new BPromise(function(_0x143e46,_0x598db2){return client[_0x4f16('0x10')](_0x3b69af,_0x14e4ed)[_0x4f16('0x11')](function(_0x193873){logger[_0x4f16('0x12')](_0x4f16('0x13'),_0x2cc16b,_0x4f16('0x14'));logger[_0x4f16('0x15')](_0x4f16('0x16'),_0x2cc16b,_0x4f16('0x14'),JSON[_0x4f16('0x17')](_0x193873));if(_0x193873['error']){if(_0x193873[_0x4f16('0x18')][_0x4f16('0x19')]===0x1f4){logger[_0x4f16('0x18')](_0x4f16('0x13'),_0x2cc16b,_0x193873['error']['message']);return _0x598db2(_0x193873[_0x4f16('0x18')][_0x4f16('0x1a')]);}logger[_0x4f16('0x18')]('FaxAccount,\x20%s,\x20%s',_0x2cc16b,_0x193873[_0x4f16('0x18')]['message']);return _0x143e46(_0x193873[_0x4f16('0x18')]['message']);}else{logger['info'](_0x4f16('0x13'),_0x2cc16b,'request\x20sent');_0x143e46(_0x193873[_0x4f16('0x1b')][_0x4f16('0x1a')]);}})[_0x4f16('0x1c')](function(_0x16c903){logger['error'](_0x4f16('0x13'),_0x2cc16b,_0x16c903);_0x598db2(_0x16c903);});});}exports['GetFaxAccount']=function(_0x338c56){var _0x446d47=this;return new Promise(function(_0x10e4c5,_0x9d7155){return db[_0x4f16('0x1d')]['findAll']({'raw':_0x338c56[_0x4f16('0x1e')]?_0x338c56['options']['raw']===undefined?!![]:![]:!![],'where':_0x338c56[_0x4f16('0x1e')]?_0x338c56[_0x4f16('0x1e')]['where']||null:null,'attributes':_0x338c56[_0x4f16('0x1e')]?_0x338c56[_0x4f16('0x1e')][_0x4f16('0x1f')]||null:null,'limit':_0x338c56[_0x4f16('0x1e')]?_0x338c56[_0x4f16('0x1e')][_0x4f16('0x20')]||null:null,'include':_0x338c56[_0x4f16('0x1e')]?_0x338c56[_0x4f16('0x1e')][_0x4f16('0x21')]?_['map'](_0x338c56[_0x4f16('0x1e')][_0x4f16('0x21')],function(_0x546ac0){return{'model':db[_0x546ac0['model']],'as':_0x546ac0['as'],'attributes':_0x546ac0[_0x4f16('0x1f')],'include':_0x546ac0[_0x4f16('0x21')]?_[_0x4f16('0x22')](_0x546ac0['include'],function(_0x2c63ae){return{'model':db[_0x2c63ae[_0x4f16('0x23')]],'as':_0x2c63ae['as'],'attributes':_0x2c63ae[_0x4f16('0x1f')],'include':_0x2c63ae[_0x4f16('0x21')]?_[_0x4f16('0x22')](_0x2c63ae[_0x4f16('0x21')],function(_0x12bb4c){return{'model':db[_0x12bb4c['model']],'as':_0x12bb4c['as'],'attributes':_0x12bb4c[_0x4f16('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4f16('0x11')](function(_0x55d431){logger[_0x4f16('0x12')]('GetFaxAccount',_0x338c56);logger[_0x4f16('0x15')]('GetFaxAccount',_0x338c56,JSON['stringify'](_0x55d431));_0x10e4c5(_0x55d431);})[_0x4f16('0x1c')](function(_0xa330cc){logger['error'](_0x4f16('0x24'),_0xa330cc['message'],_0x338c56);_0x9d7155(_0x446d47[_0x4f16('0x18')](0x1f4,_0xa330cc['message']));});});};exports[_0x4f16('0x25')]=function(_0x1caa2f,_0x3ddba5,_0x1f4822){var _0x12dafe=this;return new Promise(function(_0x360f34,_0x260253){var _0xf000dd={'body':_0x1caa2f[_0x4f16('0x26')],'channel':'fax'};var _0x51cd61=[];var _0x1f8102=[];var _0x24ad6e={};return db[_0x4f16('0x27')][_0x4f16('0x28')]()[_0x4f16('0x11')](function(_0x31ccea){if(!_0x31ccea){throw new db[(_0x4f16('0x29'))][(_0x4f16('0x2a'))](_0x4f16('0x2b'));}_0x51cd61=_['difference'](_[_0x4f16('0x2c')](_0x31ccea),['createdAt',_0x4f16('0x2d')]);_0x1f8102=_[_0x4f16('0x2e')](_[_0x4f16('0x2c')](_0x31ccea),['createdAt',_0x4f16('0x2d'),_0x4f16('0x2f'),_0x4f16('0x30')]);if(_0x1caa2f[_0x4f16('0x26')]['id']){delete _0x1caa2f[_0x4f16('0x26')]['id'];}if(_[_0x4f16('0x31')](_0x1caa2f['body']['from'])){throw new db[(_0x4f16('0x29'))][(_0x4f16('0x2a'))](_0x4f16('0x32'));}if(_[_0x4f16('0x31')](_0x1caa2f['body'][_0x4f16('0x26')])||_0x1caa2f[_0x4f16('0x26')]['body']===''){throw new db[(_0x4f16('0x29'))][(_0x4f16('0x2a'))](_0x4f16('0x33'));}if(_['isNil'](_0x1caa2f[_0x4f16('0x26')][_0x4f16('0x34')])){throw new db[(_0x4f16('0x29'))][(_0x4f16('0x2a'))](_0x4f16('0x35')+_0x1f8102);}if(!_[_0x4f16('0x36')](_0x1f8102,_0x1caa2f[_0x4f16('0x26')]['mapKey'])){throw new db[(_0x4f16('0x29'))]['ValidationError'](_0x4f16('0x37')+_0x1f8102);}_0x24ad6e[_0x1caa2f['body'][_0x4f16('0x34')]]=_0x1caa2f[_0x4f16('0x26')][_0x4f16('0x38')];})[_0x4f16('0x11')](function(){return db[_0x4f16('0x1d')][_0x4f16('0x39')]({'where':{'id':_0x1caa2f[_0x4f16('0x3a')]['id']},'include':[{'model':db[_0x4f16('0x3b')],'as':'List','include':[{'model':db[_0x4f16('0x27')],'as':'Contacts','where':_0x24ad6e,'limit':0x1,'order':[[_0x4f16('0x2d'),_0x4f16('0x3c')]]}]},{'model':db[_0x4f16('0x3d')],'as':_0x4f16('0x3e')}]});})[_0x4f16('0x11')](function(_0x45a8ec){if(_0x45a8ec&&_0x45a8ec[_0x4f16('0x3f')]){var _0x1b8e93=_0x45a8ec['get']({'plain':!![]});_0xf000dd[_0x4f16('0x3a')]=_0x1b8e93;_0xf000dd['applications']=_0x1b8e93[_0x4f16('0x3e')];_0xf000dd[_0x4f16('0x40')]=_0x1b8e93[_0x4f16('0x3f')];_0xf000dd[_0x4f16('0x41')]=_[_0x4f16('0x42')](_0xf000dd['applications'],['priority'],[_0x4f16('0x43')]);if(_0xf000dd[_0x4f16('0x3a')][_0x4f16('0x3e')]){delete _0xf000dd['account'][_0x4f16('0x3e')];}if(_0xf000dd['account'][_0x4f16('0x3f')]&&_0xf000dd[_0x4f16('0x3a')]['List'][_0x4f16('0x44')][_0x4f16('0x45')]){return _0xf000dd['account']['List']['Contacts'][0x0];}var _0xddb23a=_[_0x4f16('0xc')](_0x1caa2f['body'],{'firstName':_0x1caa2f[_0x4f16('0x26')][_0x4f16('0x38')],'ListId':_0x1b8e93[_0x4f16('0x30')]});_0xddb23a[_0x1caa2f['body'][_0x4f16('0x34')]]=_0x1caa2f[_0x4f16('0x26')]['from'];return db[_0x4f16('0x27')]['create'](_0xddb23a,{'fields':_0x51cd61,'raw':!![]});}})['then'](function(_0x1f0314){_0xf000dd[_0x4f16('0x46')]=_0x1f0314;if(_0x1f0314){var _0x8a613={'ContactId':_0x1f0314['id'],'FaxAccountId':_0x1caa2f[_0x4f16('0x3a')]['id'],'fax':_0x1f0314[_0x4f16('0x47')]};return db[_0x4f16('0x48')][_0x4f16('0x39')]({'where':{'ContactId':_0x1f0314['id'],'closed':![],'FaxAccountId':_0x1caa2f['account']['id']}})[_0x4f16('0x11')](function(_0x4954b6){if(_0x4954b6){return[_0x4954b6,![]];}return db[_0x4f16('0x48')]['create'](_0x8a613)[_0x4f16('0x11')](function(_0x13fab5){return[_0x13fab5,!![]];});});}else{throw new Error(_0x4f16('0x49'));}})['spread'](function(_0x1608de,_0x3d3a7d){var _0xa4342e=_0x1608de[_0x4f16('0x4a')]({'plain':!![]});if(_0x3d3a7d){if(_0xf000dd[_0x4f16('0x3a')][_0x4f16('0x4b')]){_0xf000dd[_0x4f16('0x41')]['push']({'id':0x0,'priority':_0xf000dd['applications'][_0x4f16('0x45')]+0x1,'app':_0x4f16('0x4c'),'appdata':_0x4f16('0x4d'),'interval':'*,*,*,*'});}_0xa4342e[_0x4f16('0x4e')]=!![];}else{_0xa4342e[_0x4f16('0x4e')]=![];}_0xf000dd['interaction']=_0xa4342e;return db[_0x4f16('0x4f')][_0x4f16('0x50')]({'body':_0x1caa2f[_0x4f16('0x26')][_0x4f16('0x26')],'FaxAccountId':_0x1caa2f[_0x4f16('0x3a')]['id'],'FaxInteractionId':_0x1608de['id'],'direction':'in','ContactId':_0x1608de[_0x4f16('0x51')],'AttachmentId':_0x1caa2f[_0x4f16('0x26')][_0x4f16('0x52')]});})[_0x4f16('0x11')](function(_0x547733){_0xf000dd['message']=_0x547733;if(_0xf000dd[_0x4f16('0x53')][_0x4f16('0x54')]){return db[_0x4f16('0x55')][_0x4f16('0x39')]({'attributes':['id',_0x4f16('0x56')],'where':{'id':_0xf000dd[_0x4f16('0x53')]['UserId']}})[_0x4f16('0x11')](function(_0x3c74da){if(_0x3c74da){_0xf000dd[_0x4f16('0x41')][_0x4f16('0x57')]({'id':0x0,'priority':0x0,'app':_0x4f16('0x58'),'appdata':_0x3c74da[_0x4f16('0x56')]+','+(_0xf000dd[_0x4f16('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x4f16('0x59')});}return respondWithRpcPromise(_0x4f16('0x5a'),_0x4f16('0x5b'),_0xf000dd);});}return respondWithRpcPromise(_0x4f16('0x5a'),_0x4f16('0x5b'),_0xf000dd);})[_0x4f16('0x11')](function(_0x3508b0){_0x360f34(_0x3508b0);})[_0x4f16('0x1c')](function(_0x4ef60f){_0x260253(_0x12dafe[_0x4f16('0x18')](0x1f4,_0x4ef60f[_0x4f16('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a068a3e..e787301 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 _0x02c8=['remove','update','emit','length','faxAccount:','save'];(function(_0x27dc71,_0x11993f){var _0x82381=function(_0x3837bc){while(--_0x3837bc){_0x27dc71['push'](_0x27dc71['shift']());}};_0x82381(++_0x11993f);}(_0x02c8,0xb9));var _0x802c=function(_0x5cde34,_0x27d3c2){_0x5cde34=_0x5cde34-0x0;var _0x11f0ce=_0x02c8[_0x5cde34];return _0x11f0ce;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x802c('0x0'),_0x802c('0x1'),_0x802c('0x2')];function createListener(_0x5210a9,_0x3fc2ca){return function(_0x4064f2){_0x3fc2ca[_0x802c('0x3')](_0x5210a9,_0x4064f2);};}function removeListener(_0x5aa6f2,_0x5302fa){return function(){FaxAccountEvents['removeListener'](_0x5aa6f2,_0x5302fa);};}exports['register']=function(_0x129ff6){for(var _0x21b5b8=0x0,_0x2af3f9=events[_0x802c('0x4')];_0x21b5b8<_0x2af3f9;_0x21b5b8++){var _0x174db6=events[_0x21b5b8];var _0x2fc6c5=createListener(_0x802c('0x5')+_0x174db6,_0x129ff6);FaxAccountEvents['on'](_0x174db6,_0x2fc6c5);}}; \ No newline at end of file +var _0xef1f=['length','./faxAccount.events','remove','update','removeListener'];(function(_0x1fc86a,_0x54613a){var _0x357919=function(_0x48e964){while(--_0x48e964){_0x1fc86a['push'](_0x1fc86a['shift']());}};_0x357919(++_0x54613a);}(_0xef1f,0x1a0));var _0xfef1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xef1f[_0x4b369d];return _0x571a98;};'use strict';var FaxAccountEvents=require(_0xfef1('0x0'));var events=['save',_0xfef1('0x1'),_0xfef1('0x2')];function createListener(_0x3c068c,_0x2b773a){return function(_0x14e79f){_0x2b773a['emit'](_0x3c068c,_0x14e79f);};}function removeListener(_0x272327,_0x12e7e3){return function(){FaxAccountEvents[_0xfef1('0x3')](_0x272327,_0x12e7e3);};}exports['register']=function(_0x38c9aa){for(var _0x56a1bc=0x0,_0x3338ff=events[_0xfef1('0x4')];_0x56a1bc<_0x3338ff;_0x56a1bc++){var _0xf7b000=events[_0x56a1bc];var _0x3ce0b2=createListener('faxAccount:'+_0xf7b000,_0x38c9aa);FaxAccountEvents['on'](_0xf7b000,_0x3ce0b2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 73a1b22..5416479 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x58dc9a,_0x563829){var _0x1cc3f1=function(_0x4ca609){while(--_0x4ca609){_0x58dc9a['push'](_0x58dc9a['shift']());}};_0x1cc3f1(++_0x563829);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5c89ff,_0x32fef6){var _0x5ec941=function(_0x5c4f80){while(--_0x5c4f80){_0x5c89ff['push'](_0x5c89ff['shift']());}};_0x5ec941(++_0x32fef6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5653b77..c7c0daf 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 _0x928c=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x5f4fc5,_0x53608a){var _0x208257=function(_0xc53e36){while(--_0xc53e36){_0x5f4fc5['push'](_0x5f4fc5['shift']());}};_0x208257(++_0x53608a);}(_0x928c,0x133));var _0xc928=function(_0x182186,_0x374912){_0x182186=_0x182186-0x0;var _0x1f4159=_0x928c[_0x182186];return _0x1f4159;};'use strict';var Sequelize=require(_0xc928('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc928('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc928('0x2')],'allowNull':![],'defaultValue':_0xc928('0x3')},'appdata':{'type':Sequelize[_0xc928('0x4')]()},'description':{'type':Sequelize[_0xc928('0x2')]},'interval':{'type':Sequelize[_0xc928('0x2')],'defaultValue':_0xc928('0x5')}}; \ No newline at end of file +var _0x8fce=['sequelize','INTEGER','STRING','noop'];(function(_0x5e49de,_0x1d3dd9){var _0x328849=function(_0x457210){while(--_0x457210){_0x5e49de['push'](_0x5e49de['shift']());}};_0x328849(++_0x1d3dd9);}(_0x8fce,0x1e4));var _0xe8fc=function(_0x4edbc2,_0x377681){_0x4edbc2=_0x4edbc2-0x0;var _0xb1d7ce=_0x8fce[_0x4edbc2];return _0xb1d7ce;};'use strict';var Sequelize=require(_0xe8fc('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe8fc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe8fc('0x2')],'allowNull':![],'defaultValue':_0xe8fc('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe8fc('0x2')]},'interval':{'type':Sequelize[_0xe8fc('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 53a8d30..e6d5cd3 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 _0x4dc3=['VIRTUAL','include','rows','catch','params','keys','intersection','length','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','sendStatus','error','name','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x132107,_0x40d4fc){var _0x28ecdf=function(_0x50ebb6){while(--_0x50ebb6){_0x132107['push'](_0x132107['shift']());}};_0x28ecdf(++_0x40d4fc);}(_0x4dc3,0xe8));var _0x34dc=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x4dc3[_0x50fda9];return _0x36b92b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34dc('0x0'));var zipdir=require(_0x34dc('0x1'));var jsonpatch=require(_0x34dc('0x2'));var rp=require(_0x34dc('0x3'));var moment=require(_0x34dc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x34dc('0x5'));var path=require(_0x34dc('0x6'));var sox=require(_0x34dc('0x7'));var csv=require(_0x34dc('0x8'));var ejs=require(_0x34dc('0x9'));var fs=require('fs');var fs_extra=require(_0x34dc('0xa'));var _=require(_0x34dc('0xb'));var squel=require(_0x34dc('0xc'));var crypto=require(_0x34dc('0xd'));var jsforce=require(_0x34dc('0xe'));var deskjs=require(_0x34dc('0xf'));var toCsv=require(_0x34dc('0x8'));var querystring=require(_0x34dc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x34dc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x34dc('0x12'));var hardwareService=require(_0x34dc('0x13'));var logger=require(_0x34dc('0x14'))(_0x34dc('0x15'));var utils=require(_0x34dc('0x16'));var config=require(_0x34dc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x34dc('0x18'))['db'];function respondWithStatusCode(_0x1d0150,_0x445d93){_0x445d93=_0x445d93||0xcc;return function(_0x57fad3){if(_0x57fad3){return _0x1d0150['sendStatus'](_0x445d93);}return _0x1d0150['status'](_0x445d93)[_0x34dc('0x19')]();};}function respondWithResult(_0x5ffbea,_0x133c50){_0x133c50=_0x133c50||0xc8;return function(_0x3f4458){if(_0x3f4458){return _0x5ffbea['status'](_0x133c50)[_0x34dc('0x1a')](_0x3f4458);}};}function respondWithFilteredResult(_0x51ed76,_0x36dbce){return function(_0x1fb79e){if(_0x1fb79e){var _0x2bbf27=typeof _0x36dbce[_0x34dc('0x1b')]===_0x34dc('0x1c')&&typeof _0x36dbce[_0x34dc('0x1d')]===_0x34dc('0x1c');var _0x76558f=_0x1fb79e['count'];var _0x468c18=_0x2bbf27?0x0:_0x36dbce[_0x34dc('0x1b')];var _0x49d28c=_0x2bbf27?_0x1fb79e[_0x34dc('0x1e')]:_0x36dbce['offset']+_0x36dbce['limit'];var _0x257bea;if(_0x49d28c>=_0x76558f){_0x49d28c=_0x76558f;_0x257bea=0xc8;}else{_0x257bea=0xce;}_0x51ed76[_0x34dc('0x1f')](_0x257bea);return _0x51ed76['set'](_0x34dc('0x20'),_0x468c18+'-'+_0x49d28c+'/'+_0x76558f)['json'](_0x1fb79e);}return null;};}function patchUpdates(_0x5597bb){return function(_0x5c8c44){try{jsonpatch[_0x34dc('0x21')](_0x5c8c44,_0x5597bb,!![]);}catch(_0x30640b){return BPromise[_0x34dc('0x22')](_0x30640b);}return _0x5c8c44[_0x34dc('0x23')]();};}function saveUpdates(_0x55e3e2,_0x1a4993){return function(_0x1a92d5){if(_0x1a92d5){return _0x1a92d5[_0x34dc('0x24')](_0x55e3e2)['then'](function(_0x3cde32){return _0x3cde32;});}return null;};}function removeEntity(_0x1b2c34,_0x50f317){return function(_0x3e559e){if(_0x3e559e){return _0x3e559e['destroy']()[_0x34dc('0x25')](function(){_0x1b2c34[_0x34dc('0x1f')](0xcc)[_0x34dc('0x19')]();});}};}function handleEntityNotFound(_0x1d815d,_0x525dc5){return function(_0x546a53){if(!_0x546a53){_0x1d815d[_0x34dc('0x26')](0x194);}return _0x546a53;};}function handleError(_0x3509ba,_0x4b852c){_0x4b852c=_0x4b852c||0x1f4;return function(_0x14564d){logger[_0x34dc('0x27')](_0x14564d['stack']);if(_0x14564d[_0x34dc('0x28')]){delete _0x14564d['name'];}_0x3509ba[_0x34dc('0x1f')](_0x4b852c)['send'](_0x14564d);};}exports['index']=function(_0x463d36,_0xa4d1f1){var _0x388aef={},_0x5cc47d={},_0x2491a9={'count':0x0,'rows':[]};var _0x5420d4=_['map'](db[_0x34dc('0x29')][_0x34dc('0x2a')],function(_0x42a8bd){return{'name':_0x42a8bd[_0x34dc('0x2b')],'type':_0x42a8bd[_0x34dc('0x2c')][_0x34dc('0x2d')]};});_0x5cc47d[_0x34dc('0x2e')]=_[_0x34dc('0x2f')](_0x5420d4,_0x34dc('0x28'));_0x5cc47d[_0x34dc('0x30')]=_['keys'](_0x463d36[_0x34dc('0x30')]);_0x5cc47d[_0x34dc('0x31')]=_['intersection'](_0x5cc47d[_0x34dc('0x2e')],_0x5cc47d['query']);_0x388aef[_0x34dc('0x32')]=_['intersection'](_0x5cc47d[_0x34dc('0x2e')],qs[_0x34dc('0x33')](_0x463d36['query'][_0x34dc('0x33')]));_0x388aef['attributes']=_0x388aef['attributes']['length']?_0x388aef['attributes']:_0x5cc47d[_0x34dc('0x2e')];if(!_0x463d36[_0x34dc('0x30')][_0x34dc('0x34')](_0x34dc('0x35'))){_0x388aef['limit']=qs[_0x34dc('0x1d')](_0x463d36[_0x34dc('0x30')][_0x34dc('0x1d')]);_0x388aef[_0x34dc('0x1b')]=qs[_0x34dc('0x1b')](_0x463d36[_0x34dc('0x30')][_0x34dc('0x1b')]);}_0x388aef[_0x34dc('0x36')]=qs[_0x34dc('0x37')](_0x463d36[_0x34dc('0x30')]['sort']);_0x388aef['where']=qs[_0x34dc('0x31')](_[_0x34dc('0x38')](_0x463d36[_0x34dc('0x30')],_0x5cc47d[_0x34dc('0x31')]),_0x5420d4);if(_0x463d36[_0x34dc('0x30')][_0x34dc('0x39')]){_0x388aef[_0x34dc('0x3a')]=_[_0x34dc('0x3b')](_0x388aef[_0x34dc('0x3a')],{'$or':_[_0x34dc('0x2f')](_0x5420d4,function(_0x4bb7a0){if(_0x4bb7a0[_0x34dc('0x2c')]!==_0x34dc('0x3c')){var _0x2d353d={};_0x2d353d[_0x4bb7a0[_0x34dc('0x28')]]={'$like':'%'+_0x463d36[_0x34dc('0x30')][_0x34dc('0x39')]+'%'};return _0x2d353d;}})});}_0x388aef=_[_0x34dc('0x3b')]({},_0x388aef,_0x463d36['options']);var _0xce3a9b={'where':_0x388aef[_0x34dc('0x3a')]};return db[_0x34dc('0x29')]['count'](_0xce3a9b)[_0x34dc('0x25')](function(_0x46c891){_0x2491a9[_0x34dc('0x1e')]=_0x46c891;if(_0x463d36[_0x34dc('0x30')]['includeAll']){_0x388aef[_0x34dc('0x3d')]=[{'all':!![]}];}return db[_0x34dc('0x29')]['findAll'](_0x388aef);})[_0x34dc('0x25')](function(_0x5d756e){_0x2491a9[_0x34dc('0x3e')]=_0x5d756e;return _0x2491a9;})[_0x34dc('0x25')](respondWithFilteredResult(_0xa4d1f1,_0x388aef))[_0x34dc('0x3f')](handleError(_0xa4d1f1,null));};exports['show']=function(_0x3c5014,_0x2bd111){var _0x7f7c94={'raw':!![],'where':{'id':_0x3c5014[_0x34dc('0x40')]['id']}},_0x45bc94={};_0x45bc94[_0x34dc('0x2e')]=_[_0x34dc('0x41')](db[_0x34dc('0x29')][_0x34dc('0x2a')]);_0x45bc94[_0x34dc('0x30')]=_[_0x34dc('0x41')](_0x3c5014['query']);_0x45bc94['filters']=_[_0x34dc('0x42')](_0x45bc94[_0x34dc('0x2e')],_0x45bc94[_0x34dc('0x30')]);_0x7f7c94[_0x34dc('0x32')]=_['intersection'](_0x45bc94[_0x34dc('0x2e')],qs[_0x34dc('0x33')](_0x3c5014[_0x34dc('0x30')][_0x34dc('0x33')]));_0x7f7c94[_0x34dc('0x32')]=_0x7f7c94[_0x34dc('0x32')][_0x34dc('0x43')]?_0x7f7c94[_0x34dc('0x32')]:_0x45bc94[_0x34dc('0x2e')];if(_0x3c5014[_0x34dc('0x30')]['includeAll']){_0x7f7c94['include']=[{'all':!![]}];}_0x7f7c94=_[_0x34dc('0x3b')]({},_0x7f7c94,_0x3c5014[_0x34dc('0x44')]);return db[_0x34dc('0x29')][_0x34dc('0x45')](_0x7f7c94)[_0x34dc('0x25')](handleEntityNotFound(_0x2bd111,null))[_0x34dc('0x25')](respondWithResult(_0x2bd111,null))['catch'](handleError(_0x2bd111,null));};exports[_0x34dc('0x46')]=function(_0x4c37fe,_0x499f45){return db['FaxApplication'][_0x34dc('0x46')](_0x4c37fe['body'],{})[_0x34dc('0x25')](respondWithResult(_0x499f45,0xc9))[_0x34dc('0x3f')](handleError(_0x499f45,null));};exports[_0x34dc('0x24')]=function(_0x11aafd,_0x39e11a){if(_0x11aafd[_0x34dc('0x47')]['id']){delete _0x11aafd[_0x34dc('0x47')]['id'];}return db[_0x34dc('0x29')][_0x34dc('0x45')]({'where':{'id':_0x11aafd['params']['id']}})[_0x34dc('0x25')](handleEntityNotFound(_0x39e11a,null))['then'](saveUpdates(_0x11aafd[_0x34dc('0x47')],null))[_0x34dc('0x25')](respondWithResult(_0x39e11a,null))[_0x34dc('0x3f')](handleError(_0x39e11a,null));};exports[_0x34dc('0x48')]=function(_0x1d54e6,_0x58f5a3){return db[_0x34dc('0x29')][_0x34dc('0x45')]({'where':{'id':_0x1d54e6['params']['id']}})[_0x34dc('0x25')](handleEntityNotFound(_0x58f5a3,null))[_0x34dc('0x25')](removeEntity(_0x58f5a3,null))[_0x34dc('0x3f')](handleError(_0x58f5a3,null));}; \ No newline at end of file +var _0xbf88=['apply','reject','save','update','then','destroy','end','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','fields','include','find','create','body','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','Content-Range','json'];(function(_0x311a73,_0x5814bf){var _0x197664=function(_0x411ca3){while(--_0x411ca3){_0x311a73['push'](_0x311a73['shift']());}};_0x197664(++_0x5814bf);}(_0xbf88,0x174));var _0x8bf8=function(_0x332b0a,_0x4cc291){_0x332b0a=_0x332b0a-0x0;var _0x88274b=_0xbf88[_0x332b0a];return _0x88274b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8bf8('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8bf8('0x1'));var Mustache=require(_0x8bf8('0x2'));var util=require('util');var path=require(_0x8bf8('0x3'));var sox=require('sox');var csv=require(_0x8bf8('0x4'));var ejs=require(_0x8bf8('0x5'));var fs=require('fs');var fs_extra=require(_0x8bf8('0x6'));var _=require('lodash');var squel=require(_0x8bf8('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8bf8('0x8'));var Papa=require(_0x8bf8('0x9'));var Redis=require(_0x8bf8('0xa'));var authService=require(_0x8bf8('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x8bf8('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8bf8('0xd'));var config=require(_0x8bf8('0xe'));var licenseUtil=require(_0x8bf8('0xf'));var db=require(_0x8bf8('0x10'))['db'];function respondWithStatusCode(_0x389ec5,_0x371712){_0x371712=_0x371712||0xcc;return function(_0x2fbbae){if(_0x2fbbae){return _0x389ec5['sendStatus'](_0x371712);}return _0x389ec5[_0x8bf8('0x11')](_0x371712)['end']();};}function respondWithResult(_0xd4b38b,_0xc431a7){_0xc431a7=_0xc431a7||0xc8;return function(_0x2887d7){if(_0x2887d7){return _0xd4b38b[_0x8bf8('0x11')](_0xc431a7)['json'](_0x2887d7);}};}function respondWithFilteredResult(_0x5601cb,_0x2a9627){return function(_0x2088c7){if(_0x2088c7){var _0x414366=typeof _0x2a9627['offset']===_0x8bf8('0x12')&&typeof _0x2a9627[_0x8bf8('0x13')]==='undefined';var _0x56d12b=_0x2088c7[_0x8bf8('0x14')];var _0x4be1f4=_0x414366?0x0:_0x2a9627['offset'];var _0x7f33ca=_0x414366?_0x2088c7['count']:_0x2a9627[_0x8bf8('0x15')]+_0x2a9627['limit'];var _0x297ee4;if(_0x7f33ca>=_0x56d12b){_0x7f33ca=_0x56d12b;_0x297ee4=0xc8;}else{_0x297ee4=0xce;}_0x5601cb[_0x8bf8('0x11')](_0x297ee4);return _0x5601cb['set'](_0x8bf8('0x16'),_0x4be1f4+'-'+_0x7f33ca+'/'+_0x56d12b)[_0x8bf8('0x17')](_0x2088c7);}return null;};}function patchUpdates(_0x5fc041){return function(_0x27e01f){try{jsonpatch[_0x8bf8('0x18')](_0x27e01f,_0x5fc041,!![]);}catch(_0x33b503){return BPromise[_0x8bf8('0x19')](_0x33b503);}return _0x27e01f[_0x8bf8('0x1a')]();};}function saveUpdates(_0x597209,_0x24ce6c){return function(_0x3a0dd3){if(_0x3a0dd3){return _0x3a0dd3[_0x8bf8('0x1b')](_0x597209)[_0x8bf8('0x1c')](function(_0x426e79){return _0x426e79;});}return null;};}function removeEntity(_0x4e7783,_0x1a41a8){return function(_0xcf3d03){if(_0xcf3d03){return _0xcf3d03[_0x8bf8('0x1d')]()[_0x8bf8('0x1c')](function(){_0x4e7783[_0x8bf8('0x11')](0xcc)[_0x8bf8('0x1e')]();});}};}function handleEntityNotFound(_0x6f2dfe,_0x3186bf){return function(_0x106ffa){if(!_0x106ffa){_0x6f2dfe['sendStatus'](0x194);}return _0x106ffa;};}function handleError(_0x2d5961,_0x345cf3){_0x345cf3=_0x345cf3||0x1f4;return function(_0x1295e0){logger['error'](_0x1295e0[_0x8bf8('0x1f')]);if(_0x1295e0[_0x8bf8('0x20')]){delete _0x1295e0['name'];}_0x2d5961[_0x8bf8('0x11')](_0x345cf3)[_0x8bf8('0x21')](_0x1295e0);};}exports[_0x8bf8('0x22')]=function(_0x1257e3,_0x397909){var _0x44279c={},_0x31ba87={},_0x186000={'count':0x0,'rows':[]};var _0x3fed72=_[_0x8bf8('0x23')](db[_0x8bf8('0x24')][_0x8bf8('0x25')],function(_0x2348c8){return{'name':_0x2348c8[_0x8bf8('0x26')],'type':_0x2348c8['type'][_0x8bf8('0x27')]};});_0x31ba87[_0x8bf8('0x28')]=_[_0x8bf8('0x23')](_0x3fed72,_0x8bf8('0x20'));_0x31ba87[_0x8bf8('0x29')]=_[_0x8bf8('0x2a')](_0x1257e3[_0x8bf8('0x29')]);_0x31ba87[_0x8bf8('0x2b')]=_['intersection'](_0x31ba87[_0x8bf8('0x28')],_0x31ba87[_0x8bf8('0x29')]);_0x44279c[_0x8bf8('0x2c')]=_[_0x8bf8('0x2d')](_0x31ba87[_0x8bf8('0x28')],qs['fields'](_0x1257e3[_0x8bf8('0x29')]['fields']));_0x44279c[_0x8bf8('0x2c')]=_0x44279c['attributes'][_0x8bf8('0x2e')]?_0x44279c[_0x8bf8('0x2c')]:_0x31ba87[_0x8bf8('0x28')];if(!_0x1257e3[_0x8bf8('0x29')][_0x8bf8('0x2f')]('nolimit')){_0x44279c[_0x8bf8('0x13')]=qs['limit'](_0x1257e3[_0x8bf8('0x29')][_0x8bf8('0x13')]);_0x44279c[_0x8bf8('0x15')]=qs[_0x8bf8('0x15')](_0x1257e3['query'][_0x8bf8('0x15')]);}_0x44279c[_0x8bf8('0x30')]=qs[_0x8bf8('0x31')](_0x1257e3['query'][_0x8bf8('0x31')]);_0x44279c[_0x8bf8('0x32')]=qs['filters'](_[_0x8bf8('0x33')](_0x1257e3[_0x8bf8('0x29')],_0x31ba87[_0x8bf8('0x2b')]),_0x3fed72);if(_0x1257e3[_0x8bf8('0x29')][_0x8bf8('0x34')]){_0x44279c['where']=_[_0x8bf8('0x35')](_0x44279c['where'],{'$or':_[_0x8bf8('0x23')](_0x3fed72,function(_0xb1ba26){if(_0xb1ba26[_0x8bf8('0x36')]!==_0x8bf8('0x37')){var _0x570749={};_0x570749[_0xb1ba26[_0x8bf8('0x20')]]={'$like':'%'+_0x1257e3['query']['filter']+'%'};return _0x570749;}})});}_0x44279c=_[_0x8bf8('0x35')]({},_0x44279c,_0x1257e3[_0x8bf8('0x38')]);var _0x2db5c0={'where':_0x44279c[_0x8bf8('0x32')]};return db[_0x8bf8('0x24')][_0x8bf8('0x14')](_0x2db5c0)[_0x8bf8('0x1c')](function(_0x4c728d){_0x186000[_0x8bf8('0x14')]=_0x4c728d;if(_0x1257e3[_0x8bf8('0x29')]['includeAll']){_0x44279c['include']=[{'all':!![]}];}return db[_0x8bf8('0x24')][_0x8bf8('0x39')](_0x44279c);})[_0x8bf8('0x1c')](function(_0x29ee5c){_0x186000['rows']=_0x29ee5c;return _0x186000;})['then'](respondWithFilteredResult(_0x397909,_0x44279c))[_0x8bf8('0x3a')](handleError(_0x397909,null));};exports[_0x8bf8('0x3b')]=function(_0x3f932a,_0xdc432e){var _0x25000b={'raw':!![],'where':{'id':_0x3f932a[_0x8bf8('0x3c')]['id']}},_0x14812={};_0x14812['model']=_[_0x8bf8('0x2a')](db[_0x8bf8('0x24')][_0x8bf8('0x25')]);_0x14812[_0x8bf8('0x29')]=_[_0x8bf8('0x2a')](_0x3f932a['query']);_0x14812['filters']=_[_0x8bf8('0x2d')](_0x14812['model'],_0x14812[_0x8bf8('0x29')]);_0x25000b[_0x8bf8('0x2c')]=_[_0x8bf8('0x2d')](_0x14812['model'],qs[_0x8bf8('0x3d')](_0x3f932a[_0x8bf8('0x29')][_0x8bf8('0x3d')]));_0x25000b[_0x8bf8('0x2c')]=_0x25000b['attributes'][_0x8bf8('0x2e')]?_0x25000b[_0x8bf8('0x2c')]:_0x14812[_0x8bf8('0x28')];if(_0x3f932a['query']['includeAll']){_0x25000b[_0x8bf8('0x3e')]=[{'all':!![]}];}_0x25000b=_['merge']({},_0x25000b,_0x3f932a[_0x8bf8('0x38')]);return db[_0x8bf8('0x24')][_0x8bf8('0x3f')](_0x25000b)['then'](handleEntityNotFound(_0xdc432e,null))[_0x8bf8('0x1c')](respondWithResult(_0xdc432e,null))['catch'](handleError(_0xdc432e,null));};exports['create']=function(_0x850127,_0x1bdc71){return db[_0x8bf8('0x24')][_0x8bf8('0x40')](_0x850127[_0x8bf8('0x41')],{})[_0x8bf8('0x1c')](respondWithResult(_0x1bdc71,0xc9))[_0x8bf8('0x3a')](handleError(_0x1bdc71,null));};exports[_0x8bf8('0x1b')]=function(_0x41db03,_0x4f570e){if(_0x41db03['body']['id']){delete _0x41db03[_0x8bf8('0x41')]['id'];}return db[_0x8bf8('0x24')][_0x8bf8('0x3f')]({'where':{'id':_0x41db03[_0x8bf8('0x3c')]['id']}})[_0x8bf8('0x1c')](handleEntityNotFound(_0x4f570e,null))['then'](saveUpdates(_0x41db03['body'],null))[_0x8bf8('0x1c')](respondWithResult(_0x4f570e,null))[_0x8bf8('0x3a')](handleError(_0x4f570e,null));};exports[_0x8bf8('0x1d')]=function(_0x3b97e7,_0x1783ed){return db[_0x8bf8('0x24')][_0x8bf8('0x3f')]({'where':{'id':_0x3b97e7[_0x8bf8('0x3c')]['id']}})[_0x8bf8('0x1c')](handleEntityNotFound(_0x1783ed,null))['then'](removeEntity(_0x1783ed,null))[_0x8bf8('0x3a')](handleError(_0x1783ed,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e1231bb..5c28ffb 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 _0x6b36=['./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a76fa,_0x1cee7d){var _0x2d2442=function(_0x2f5e81){while(--_0x2f5e81){_0x2a76fa['push'](_0x2a76fa['shift']());}};_0x2d2442(++_0x1cee7d);}(_0x6b36,0x6f));var _0x66b3=function(_0x29cd93,_0x25a691){_0x29cd93=_0x29cd93-0x0;var _0x54ef31=_0x6b36[_0x29cd93];return _0x54ef31;};'use strict';var _=require(_0x66b3('0x0'));var util=require(_0x66b3('0x1'));var logger=require(_0x66b3('0x2'))('api');var moment=require(_0x66b3('0x3'));var BPromise=require(_0x66b3('0x4'));var rp=require(_0x66b3('0x5'));var fs=require('fs');var path=require(_0x66b3('0x6'));var rimraf=require(_0x66b3('0x7'));var config=require(_0x66b3('0x8'));var attributes=require(_0x66b3('0x9'));module[_0x66b3('0xa')]=function(_0x363b1c,_0x42faac){return _0x363b1c[_0x66b3('0xb')](_0x66b3('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x66b3('0xd'),'collate':_0x66b3('0xe')});}; \ No newline at end of file +var _0x4ad5=['./faxApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5cd0bc,_0x4fd388){var _0x538cb0=function(_0x283626){while(--_0x283626){_0x5cd0bc['push'](_0x5cd0bc['shift']());}};_0x538cb0(++_0x4fd388);}(_0x4ad5,0x101));var _0x54ad=function(_0x22b98c,_0x3cc5dc){_0x22b98c=_0x22b98c-0x0;var _0x5e846e=_0x4ad5[_0x22b98c];return _0x5e846e;};'use strict';var _=require('lodash');var util=require(_0x54ad('0x0'));var logger=require(_0x54ad('0x1'))(_0x54ad('0x2'));var moment=require(_0x54ad('0x3'));var BPromise=require(_0x54ad('0x4'));var rp=require(_0x54ad('0x5'));var fs=require('fs');var path=require(_0x54ad('0x6'));var rimraf=require(_0x54ad('0x7'));var config=require(_0x54ad('0x8'));var attributes=require(_0x54ad('0x9'));module[_0x54ad('0xa')]=function(_0x406c07,_0x12614d){return _0x406c07[_0x54ad('0xb')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x54ad('0xc'),'collate':_0x54ad('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 52fc261..613aee7 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 _0xfe1f=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','request','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateFaxApplication','options','where','limit','then'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0xfe1f,0x1c3));var _0xffe1=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0xfe1f[_0x2b0f81];return _0x5ce74c;};'use strict';var _=require(_0xffe1('0x0'));var util=require(_0xffe1('0x1'));var moment=require(_0xffe1('0x2'));var BPromise=require(_0xffe1('0x3'));var rs=require(_0xffe1('0x4'));var fs=require('fs');var Redis=require(_0xffe1('0x5'));var db=require(_0xffe1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xffe1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x893266,_0x3fd849,_0x11b614){return new BPromise(function(_0x4e1875,_0x2414b3){return client[_0xffe1('0x8')](_0x893266,_0x11b614)['then'](function(_0x4335b0){logger[_0xffe1('0x9')]('FaxApplication,\x20%s,\x20%s',_0x3fd849,'request\x20sent');logger[_0xffe1('0xa')](_0xffe1('0xb'),_0x3fd849,'request\x20sent',JSON['stringify'](_0x4335b0));if(_0x4335b0[_0xffe1('0xc')]){if(_0x4335b0[_0xffe1('0xc')][_0xffe1('0xd')]===0x1f4){logger[_0xffe1('0xc')](_0xffe1('0xe'),_0x3fd849,_0x4335b0[_0xffe1('0xc')][_0xffe1('0xf')]);return _0x2414b3(_0x4335b0[_0xffe1('0xc')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x3fd849,_0x4335b0[_0xffe1('0xc')][_0xffe1('0xf')]);return _0x4e1875(_0x4335b0['error'][_0xffe1('0xf')]);}else{logger[_0xffe1('0x9')](_0xffe1('0xe'),_0x3fd849,_0xffe1('0x10'));_0x4e1875(_0x4335b0[_0xffe1('0x11')][_0xffe1('0xf')]);}})[_0xffe1('0x12')](function(_0x1bb4e1){logger['error'](_0xffe1('0xe'),_0x3fd849,_0x1bb4e1);_0x2414b3(_0x1bb4e1);});});}exports[_0xffe1('0x13')]=function(_0x47ca16){var _0x2ba8fd=this;return new Promise(function(_0x55a93b,_0x3a6378){return db['FaxApplication']['update'](_0x47ca16['body'],{'raw':_0x47ca16[_0xffe1('0x14')]?_0x47ca16[_0xffe1('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ca16[_0xffe1('0x14')]?_0x47ca16[_0xffe1('0x14')][_0xffe1('0x15')]||null:null,'attributes':_0x47ca16[_0xffe1('0x14')]?_0x47ca16[_0xffe1('0x14')]['attributes']||null:null,'limit':_0x47ca16[_0xffe1('0x14')]?_0x47ca16[_0xffe1('0x14')][_0xffe1('0x16')]||null:null})[_0xffe1('0x17')](function(_0x45521c){logger[_0xffe1('0x9')](_0xffe1('0x13'),_0x47ca16);logger[_0xffe1('0xa')](_0xffe1('0x13'),_0x47ca16,JSON[_0xffe1('0x18')](_0x45521c));_0x55a93b(_0x45521c);})[_0xffe1('0x12')](function(_0x37bca5){logger[_0xffe1('0xc')](_0xffe1('0x13'),_0x37bca5[_0xffe1('0xf')],_0x47ca16);_0x3a6378(_0x2ba8fd[_0xffe1('0xc')](0x1f4,_0x37bca5['message']));});});}; \ No newline at end of file +var _0xb6f1=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','limit','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x2d674d,_0x33b36e){var _0x588b6b=function(_0x11cf55){while(--_0x11cf55){_0x2d674d['push'](_0x2d674d['shift']());}};_0x588b6b(++_0x33b36e);}(_0xb6f1,0x118));var _0x1b6f=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xb6f1[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0x1b6f('0x0'));var util=require('util');var moment=require(_0x1b6f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6f('0x2'));var fs=require('fs');var Redis=require(_0x1b6f('0x3'));var db=require(_0x1b6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b6f('0x5'))('rpc');var config=require(_0x1b6f('0x6'));var jayson=require(_0x1b6f('0x7'));var client=jayson[_0x1b6f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x496b52,_0xe05935,_0x7b27f5){return new BPromise(function(_0x236908,_0x493908){return client[_0x1b6f('0x9')](_0x496b52,_0x7b27f5)[_0x1b6f('0xa')](function(_0x4c4cbf){logger[_0x1b6f('0xb')](_0x1b6f('0xc'),_0xe05935,_0x1b6f('0xd'));logger[_0x1b6f('0xe')](_0x1b6f('0xf'),_0xe05935,_0x1b6f('0xd'),JSON['stringify'](_0x4c4cbf));if(_0x4c4cbf['error']){if(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x11')]===0x1f4){logger[_0x1b6f('0x10')](_0x1b6f('0xc'),_0xe05935,_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);return _0x493908(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);}logger[_0x1b6f('0x10')](_0x1b6f('0xc'),_0xe05935,_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);return _0x236908(_0x4c4cbf[_0x1b6f('0x10')][_0x1b6f('0x12')]);}else{logger[_0x1b6f('0xb')](_0x1b6f('0xc'),_0xe05935,_0x1b6f('0xd'));_0x236908(_0x4c4cbf[_0x1b6f('0x13')][_0x1b6f('0x12')]);}})[_0x1b6f('0x14')](function(_0x54eec7){logger['error'](_0x1b6f('0xc'),_0xe05935,_0x54eec7);_0x493908(_0x54eec7);});});}exports[_0x1b6f('0x15')]=function(_0x1cdf6e){var _0x1f6b49=this;return new Promise(function(_0x437798,_0x110255){return db[_0x1b6f('0x16')]['update'](_0x1cdf6e[_0x1b6f('0x17')],{'raw':_0x1cdf6e[_0x1b6f('0x18')]?_0x1cdf6e[_0x1b6f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cdf6e[_0x1b6f('0x18')]?_0x1cdf6e[_0x1b6f('0x18')][_0x1b6f('0x19')]||null:null,'attributes':_0x1cdf6e['options']?_0x1cdf6e[_0x1b6f('0x18')][_0x1b6f('0x1a')]||null:null,'limit':_0x1cdf6e[_0x1b6f('0x18')]?_0x1cdf6e[_0x1b6f('0x18')][_0x1b6f('0x1b')]||null:null})[_0x1b6f('0xa')](function(_0x518122){logger['info'](_0x1b6f('0x15'),_0x1cdf6e);logger['debug'](_0x1b6f('0x15'),_0x1cdf6e,JSON[_0x1b6f('0x1c')](_0x518122));_0x437798(_0x518122);})[_0x1b6f('0x14')](function(_0x19aad4){logger[_0x1b6f('0x10')](_0x1b6f('0x15'),_0x19aad4[_0x1b6f('0x12')],_0x1cdf6e);_0x110255(_0x1f6b49[_0x1b6f('0x10')](0x1f4,_0x19aad4[_0x1b6f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b5494ea..fa4cd9c 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxApplication.controller'];(function(_0x59b760,_0x2f009b){var _0x357ffe=function(_0x2f1958){while(--_0x2f1958){_0x59b760['push'](_0x59b760['shift']());}};_0x357ffe(++_0x2f009b);}(_0x14a0,0x8e));var _0x014a=function(_0x177aa1,_0x419723){_0x177aa1=_0x177aa1-0x0;var _0x4eb61c=_0x14a0[_0x177aa1];return _0x4eb61c;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9348=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','post','delete','/:id','destroy','exports','multer'];(function(_0x182c60,_0x180726){var _0x346d17=function(_0x1f514a){while(--_0x1f514a){_0x182c60['push'](_0x182c60['shift']());}};_0x346d17(++_0x180726);}(_0x9348,0x10d));var _0x8934=function(_0x20886a,_0xf34a74){_0x20886a=_0x20886a-0x0;var _0x37c6ba=_0x9348[_0x20886a];return _0x37c6ba;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8934('0xa')](),controller['update']);router[_0x8934('0xe')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);module[_0x8934('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 6b6c305..2d95e4a 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 _0xfd12=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd12,0x182));var _0x2fd1=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0xfd12[_0x26b622];return _0x58a028;};'use strict';var Sequelize=require(_0x2fd1('0x0'));module[_0x2fd1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2fd1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2fd1('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2fd1('0x3')]},'note':{'type':Sequelize[_0x2fd1('0x3')]},'read1stAt':{'type':Sequelize[_0x2fd1('0x2')]},'fax':{'type':Sequelize[_0x2fd1('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2fd1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2fd1('0x4')]('in',_0x2fd1('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xda86=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x10bc58,_0x4bb330){var _0x59fc1e=function(_0x2ba4c4){while(--_0x2ba4c4){_0x10bc58['push'](_0x10bc58['shift']());}};_0x59fc1e(++_0x4bb330);}(_0xda86,0x121));var _0x6da8=function(_0x35d5d6,_0x445387){_0x35d5d6=_0x35d5d6-0x0;var _0x1f262c=_0xda86[_0x35d5d6];return _0x1f262c;};'use strict';var Sequelize=require(_0x6da8('0x0'));module[_0x6da8('0x1')]={'closed':{'type':Sequelize[_0x6da8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6da8('0x3')]},'disposition':{'type':Sequelize[_0x6da8('0x4')]},'secondDisposition':{'type':Sequelize[_0x6da8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6da8('0x4')]},'note':{'type':Sequelize[_0x6da8('0x4')]},'read1stAt':{'type':Sequelize[_0x6da8('0x3')]},'fax':{'type':Sequelize[_0x6da8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6da8('0x5')]('in',_0x6da8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6da8('0x5')]('in',_0x6da8('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index eb202d2..36c2428 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 _0xa49d=['value','having','`\x20=\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','keys','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','i.FaxAccountId\x20IS\x20NULL','role','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','include','options','create','update','describe','addMessage','FaxMessage','ids','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','removeTags','unix','root','server','files','tmp','join','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages'];(function(_0x595aa3,_0x975903){var _0x52ea3d=function(_0x112801){while(--_0x112801){_0x595aa3['push'](_0x595aa3['shift']());}};_0x52ea3d(++_0x975903);}(_0xa49d,0x71));var _0xda49=function(_0x8227d6,_0x13827f){_0x8227d6=_0x8227d6-0x0;var _0x468cd2=_0xa49d[_0x8227d6];return _0x468cd2;};'use strict';var emlformat=require(_0xda49('0x0'));var rimraf=require(_0xda49('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda49('0x2'));var rp=require(_0xda49('0x3'));var moment=require(_0xda49('0x4'));var BPromise=require(_0xda49('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xda49('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda49('0x7'));var fs=require('fs');var fs_extra=require(_0xda49('0x8'));var _=require(_0xda49('0x9'));var squel=require(_0xda49('0xa'));var crypto=require(_0xda49('0xb'));var jsforce=require(_0xda49('0xc'));var deskjs=require(_0xda49('0xd'));var toCsv=require('to-csv');var querystring=require(_0xda49('0xe'));var Papa=require(_0xda49('0xf'));var Redis=require('ioredis');var authService=require(_0xda49('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xda49('0x11'));var hardwareService=require(_0xda49('0x12'));var logger=require(_0xda49('0x13'))(_0xda49('0x14'));var utils=require(_0xda49('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda49('0x16'))['db'];config['redis']=_[_0xda49('0x17')](config[_0xda49('0x18')],{'host':_0xda49('0x19'),'port':0x18eb});var socket=require(_0xda49('0x1a'))(new Redis(config[_0xda49('0x18')]));require(_0xda49('0x1b'))[_0xda49('0x1c')](socket);function respondWithStatusCode(_0x5586dd,_0x1058fe){_0x1058fe=_0x1058fe||0xcc;return function(_0x4384d5){if(_0x4384d5){return _0x5586dd[_0xda49('0x1d')](_0x1058fe);}return _0x5586dd[_0xda49('0x1e')](_0x1058fe)[_0xda49('0x1f')]();};}function respondWithResult(_0x4f9634,_0x24338d){_0x24338d=_0x24338d||0xc8;return function(_0x59dea4){if(_0x59dea4){return _0x4f9634[_0xda49('0x1e')](_0x24338d)[_0xda49('0x20')](_0x59dea4);}};}function respondWithFilteredResult(_0x53537e,_0x1a77d8){return function(_0x56d277){if(_0x56d277){var _0x479fbf=typeof _0x1a77d8[_0xda49('0x21')]===_0xda49('0x22')&&typeof _0x1a77d8[_0xda49('0x23')]===_0xda49('0x22');var _0x5afe73=_0x56d277[_0xda49('0x24')];var _0x1bbbde=_0x479fbf?0x0:_0x1a77d8[_0xda49('0x21')];var _0x3e2b44=_0x479fbf?_0x56d277['count']:_0x1a77d8[_0xda49('0x21')]+_0x1a77d8[_0xda49('0x23')];var _0x43efc6;if(_0x3e2b44>=_0x5afe73){_0x3e2b44=_0x5afe73;_0x43efc6=0xc8;}else{_0x43efc6=0xce;}_0x53537e[_0xda49('0x1e')](_0x43efc6);return _0x53537e[_0xda49('0x25')](_0xda49('0x26'),_0x1bbbde+'-'+_0x3e2b44+'/'+_0x5afe73)['json'](_0x56d277);}return null;};}function patchUpdates(_0x30a694){return function(_0x42196b){try{jsonpatch[_0xda49('0x27')](_0x42196b,_0x30a694,!![]);}catch(_0x610349){return BPromise[_0xda49('0x28')](_0x610349);}return _0x42196b[_0xda49('0x29')]();};}function saveUpdates(_0x882740,_0x1ef4be){return function(_0x187f5f){if(_0x187f5f){return _0x187f5f['update'](_0x882740)[_0xda49('0x2a')](function(_0x203eb2){return _0x203eb2;});}return null;};}function removeEntity(_0x5eb70a,_0x495304){return function(_0x41eeb2){if(_0x41eeb2){return _0x41eeb2[_0xda49('0x2b')]()[_0xda49('0x2a')](function(){_0x5eb70a[_0xda49('0x1e')](0xcc)[_0xda49('0x1f')]();});}};}function handleEntityNotFound(_0x3b5bed,_0x35a5a3){return function(_0x1afbe6){if(!_0x1afbe6){_0x3b5bed[_0xda49('0x1d')](0x194);}return _0x1afbe6;};}function handleError(_0x283a83,_0x520681){_0x520681=_0x520681||0x1f4;return function(_0x27b3d4){logger[_0xda49('0x2c')](_0x27b3d4[_0xda49('0x2d')]);if(_0x27b3d4[_0xda49('0x2e')]){delete _0x27b3d4['name'];}_0x283a83[_0xda49('0x1e')](_0x520681)[_0xda49('0x2f')](_0x27b3d4);};}function getInteractionUsers(_0x4bbf12,_0x3364f5){return new BPromise(function(_0x1bb4d7,_0x40486c){try{if(_0x3364f5[_0x4bbf12['id']]){_0x4bbf12[_0xda49('0x30')]=_[_0xda49('0x31')](_0x3364f5[_0x4bbf12['id']],function(_0x1b287b){return{'id':_0x1b287b['id'],'fullname':_0x1b287b['fullname']};});}}catch(_0x4aaea2){_0x40486c(_0x4aaea2);}_0x1bb4d7(_0x4bbf12);});}function getInteractionTags(_0x3efa7b,_0x3ed46d){return new BPromise(function(_0x5ab544,_0x124ab4){try{if(_0x3efa7b[_0xda49('0x32')]){_0x3efa7b[_0xda49('0x33')]=[];_0x3efa7b[_0xda49('0x32')]['split'](',')[_0xda49('0x34')](function(_0x100be7){_0x3efa7b[_0xda49('0x33')]['push'](_0x3ed46d[_0x100be7]);});}delete _0x3efa7b[_0xda49('0x32')];}catch(_0x38e0c7){_0x124ab4(_0x38e0c7);}_0x5ab544(_0x3efa7b);});}function updateFaxInteraction(_0x47c87e,_0x1c6af6,_0x3cea32){return new BPromise(function(_0x4b4ff7,_0x2d6585){return getInteractionUsers(_0x47c87e,_0x3cea32)['then'](function(_0x4bbddc){return getInteractionTags(_0x4bbddc,_0x1c6af6);})[_0xda49('0x2a')](function(_0x4732d5){_0x4b4ff7(_0x4732d5);})[_0xda49('0x35')](function(_0x524775){_0x2d6585(_0x524775);});});}exports[_0xda49('0x36')]=function(_0x400808,_0x38dbf6){var _0x583f28={},_0x1aa824={},_0x25e33a={'count':0x0,'rows':[]};var _0x4c2b12=_[_0xda49('0x31')](db[_0xda49('0x37')][_0xda49('0x38')],function(_0x573921){return{'name':_0x573921[_0xda49('0x39')],'type':_0x573921['type'][_0xda49('0x3a')]};});_0x1aa824[_0xda49('0x3b')]=_[_0xda49('0x31')](_0x4c2b12,_0xda49('0x2e'));_0x1aa824[_0xda49('0x3c')]=_['keys'](_0x400808['query']);_0x1aa824[_0xda49('0x3d')]=_[_0xda49('0x3e')](_0x1aa824[_0xda49('0x3b')],_0x1aa824[_0xda49('0x3c')]);_0x583f28[_0xda49('0x3f')]=_[_0xda49('0x3e')](_0x1aa824[_0xda49('0x3b')],qs['fields'](_0x400808['query'][_0xda49('0x40')]));_0x583f28[_0xda49('0x3f')]=_0x583f28[_0xda49('0x3f')][_0xda49('0x41')]?_0x583f28[_0xda49('0x3f')]:_0x1aa824[_0xda49('0x3b')];if(!_0x400808[_0xda49('0x3c')][_0xda49('0x42')](_0xda49('0x43'))){_0x583f28[_0xda49('0x23')]=qs['limit'](_0x400808['query'][_0xda49('0x23')]);_0x583f28[_0xda49('0x21')]=qs['offset'](_0x400808[_0xda49('0x3c')][_0xda49('0x21')]);}_0x583f28[_0xda49('0x44')]=qs[_0xda49('0x45')](_0x400808['query'][_0xda49('0x45')]);_0x583f28[_0xda49('0x46')]=qs[_0xda49('0x3d')](_[_0xda49('0x47')](_0x400808[_0xda49('0x3c')],_0x1aa824[_0xda49('0x3d')]),_0x4c2b12);var _0x15bc33=[];var _0x3251d0=squel['select']()['field']('id')[_0xda49('0x48')](_0xda49('0x2e'))[_0xda49('0x48')](_0xda49('0x49'))[_0xda49('0x4a')](_0xda49('0x4b'));var _0xb338c7=squel['select']()[_0xda49('0x48')](_0xda49('0x4c'))[_0xda49('0x48')](_0xda49('0x4d'))[_0xda49('0x48')](_0xda49('0x4e'))[_0xda49('0x4a')](_0xda49('0x4f'),'ui')[_0xda49('0x50')](_0xda49('0x51'),'u',_0xda49('0x52'));var _0x5277f6=squel[_0xda49('0x53')]()['from']('fax_interactions','i')[_0xda49('0x50')](_0xda49('0x54'),'c',_0xda49('0x55'))[_0xda49('0x50')](_0xda49('0x51'),'o',_0xda49('0x56'))[_0xda49('0x50')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')[_0xda49('0x50')](_0xda49('0x57'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0xda49('0x58'),'it',_0xda49('0x59'))[_0xda49('0x50')](_0xda49('0x4b'),'t',_0xda49('0x5a'));var _0x2bdd20=squel[_0xda49('0x5b')]();var _0x50101a=[];var _0x5ce8d6=squel['expr']();var _0x337a76;if(_0x400808[_0xda49('0x3c')]['search']){_0x337a76=as[_0xda49('0x5c')](_0x400808[_0xda49('0x3c')]['search']);var _0x7b7c61=_0x337a76[_0xda49('0x5d')];for(var _0x32c959=0x0;_0x32c959<_0x337a76[_0xda49('0x5e')][_0xda49('0x41')];_0x32c959++){var _0x4de2f8=_0x337a76[_0xda49('0x5e')][_0x32c959];var _0x20b4e9='i';var _0x19ad50=_[_0xda49('0x5f')](_0x4c2b12,[_0xda49('0x2e'),_0x4de2f8[_0xda49('0x48')]]);if(!_0x19ad50){switch(_0x4de2f8['field']){case _0xda49('0x60'):if(_0x4de2f8[_0xda49('0x61')]==0x1){_0x5277f6[_0xda49('0x62')]('`'+_0x4de2f8['field']+_0xda49('0x63'));}else{_0x5277f6[_0xda49('0x62')]('`'+_0x4de2f8['field']+'`\x20>\x200');}break;case'Contact':if(_0x4de2f8[_0xda49('0x64')]==='$substring'){if(_0x4de2f8[_0xda49('0x61')]['split']('\x20')[_0xda49('0x41')]>0x1){_0x2bdd20[_0x7b7c61](_0xda49('0x65'),qs[_0xda49('0x66')](_0x4de2f8[_0xda49('0x61')]),null);}else{var _0x13c70d='%'+_0x4de2f8[_0xda49('0x61')]+'%';_0x2bdd20[_0x7b7c61](_0xda49('0x67'),_0x13c70d,_0x13c70d,_0x13c70d);}}else{_0x19ad50=_[_0xda49('0x5f')](_0x4c2b12,[_0xda49('0x2e'),_0xda49('0x68')]);_0x4de2f8[_0xda49('0x48')]=_0xda49('0x68');_0x5788c0=as[_0xda49('0x69')](_0x20b4e9,_0x19ad50[_0xda49('0x6a')],_0x4de2f8);_0x2bdd20[_0x7b7c61](_0x5788c0[_0xda49('0x6b')],_0x5788c0[_0xda49('0x61')][_0xda49('0x6c')],_0x5788c0['value']['end']);}break;case _0xda49('0x6d'):var _0xe6e602=_0x4de2f8[_0xda49('0x61')][_0xda49('0x6e')](',')[_0xda49('0x31')](function(_0x104fd2){return Number(_0x104fd2);});_0xe6e602['forEach'](function(_0x467b3b){_0x5ce8d6['or'](_0xda49('0x6f'),'%,'+_0x467b3b+',%');});_0x50101a=_[_0xda49('0x70')](_0x50101a,_0xe6e602);break;case _0xda49('0x71'):if(_0x4de2f8['operator']==='$substring'){_0x2bdd20[_0x7b7c61]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4de2f8[_0xda49('0x61')]+'%',null);}else{_0x19ad50=_['find'](_0x4c2b12,['name',_0xda49('0x72')]);_0x4de2f8[_0xda49('0x48')]=_0xda49('0x72');_0x5788c0=as[_0xda49('0x69')](_0x20b4e9,_0x19ad50[_0xda49('0x6a')],_0x4de2f8);_0x2bdd20[_0x7b7c61](_0x5788c0[_0xda49('0x6b')],_0x5788c0['value'][_0xda49('0x6c')],_0x5788c0[_0xda49('0x61')][_0xda49('0x1f')]);}break;case _0xda49('0x73'):_0x5788c0=as[_0xda49('0x69')]('me',null,_0x4de2f8);_0x2bdd20[_0x7b7c61](_0x5788c0[_0xda49('0x6b')],_0x5788c0[_0xda49('0x61')][_0xda49('0x6c')],_0x5788c0[_0xda49('0x61')][_0xda49('0x1f')]);break;}}else{var _0x5788c0=as[_0xda49('0x69')](_0x20b4e9,_0x19ad50[_0xda49('0x6a')],_0x4de2f8);_0x2bdd20[_0x7b7c61](_0x5788c0[_0xda49('0x6b')],_0x5788c0[_0xda49('0x61')][_0xda49('0x6c')],_0x5788c0[_0xda49('0x61')][_0xda49('0x1f')]);}}}else{var _0x3783db=_(_0x400808[_0xda49('0x3c')])[_0xda49('0x74')]()['map'](function(_0x26e69c){return _['some'](_0x4c2b12,[_0xda49('0x2e'),_0x26e69c])?_0x26e69c:undefined;})[_0xda49('0x75')]()[_0xda49('0x61')]();if(!_[_0xda49('0x76')](_0x3783db)){_0x3783db[_0xda49('0x34')](function(_0x3f17de){if(_0x3f17de===_0xda49('0x77')){_0x5277f6[_0xda49('0x46')](_0xda49('0x78'),[][_0xda49('0x79')](_0x400808['query'][_0x3f17de]));}else if(_0x3f17de===_0xda49('0x7a')){var _0x20205d=JSON[_0xda49('0x7b')](_0x400808['query'][_0x3f17de])[_0xda49('0x7c')];var _0x147c70=JSON[_0xda49('0x7b')](_0x400808['query'][_0x3f17de])[_0xda49('0x7d')];_0x5277f6['where'](_0xda49('0x7e'),_0x20205d,_0x147c70);}else{if(_0x400808['query'][_0x3f17de]===_0xda49('0x7f')){_0x5277f6[_0xda49('0x46')]('i.'+_0x3f17de+_0xda49('0x80'));}else{_0x5277f6[_0xda49('0x46')]('i.'+_0x3f17de+_0xda49('0x81'),_0x400808['query'][_0x3f17de]);}}});}if(_0x400808[_0xda49('0x3c')]['read']){if(_0x400808[_0xda49('0x3c')]['read']==0x1){_0x5277f6[_0xda49('0x62')](_0xda49('0x82'));}else{_0x5277f6[_0xda49('0x62')](_0xda49('0x83'));}}if(_0x400808[_0xda49('0x3c')]['tag']){_0x50101a=_['isArray'](_0x400808[_0xda49('0x3c')][_0xda49('0x84')])?_0x400808[_0xda49('0x3c')][_0xda49('0x84')]:new Array(_0x400808['query'][_0xda49('0x84')]);_0x50101a[_0xda49('0x34')](function(_0x40d312){_0x5ce8d6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x40d312+',%');});}if(_0x400808[_0xda49('0x3c')][_0xda49('0x85')]){var _0x1a37b9=_0x400808[_0xda49('0x3c')][_0xda49('0x85')][_0xda49('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1a37b9)){_0x2bdd20['or']('i.id\x20LIKE\x20?',_0x1a37b9+'%')['or']('i.fax\x20LIKE\x20?',_0x1a37b9+'%');}_0x2bdd20['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1a37b9+'%');}}_0x5277f6[_0xda49('0x46')](_0x2bdd20);_0x5277f6[_0xda49('0x87')]('i.id');var _0x55a5ef={'type':db[_0xda49('0x88')][_0xda49('0x89')][_0xda49('0x8a')],'raw':!![]};var _0x4e1809=_0x5277f6['clone']();_0x4e1809[_0xda49('0x48')](_0xda49('0x8b'));_0x4e1809['field'](_0xda49('0x8c'),_0xda49('0x60'));if(_0x583f28[_0xda49('0x44')]){_0x583f28['order']['forEach'](function(_0x1b3252){var _0x307073=_0x1b3252[0x0]===_0xda49('0x8d')?_0x1b3252[0x0]:'i.'+_0x1b3252[0x0];_0x5277f6['order'](_0x307073,_0x1b3252[0x1]===_0xda49('0x8e')?![]:!![]);});}if(!_[_0xda49('0x76')](_0x50101a)){_0x5277f6[_0xda49('0x62')](_0x5ce8d6);_0x4e1809[_0xda49('0x46')]('t.id\x20IN\x20?',_0x50101a);}BPromise[_0xda49('0x8f')]()[_0xda49('0x2a')](function(){if(!_0x337a76){if(_0x400808['query'][_0xda49('0x77')])return;_0x4e1809[_0xda49('0x46')](_0xda49('0x90'));_0x5277f6['where'](_0xda49('0x90'));return;}if(_0x400808[_0xda49('0x91')]['role']!==_0xda49('0x92'))return;return _0x400808[_0xda49('0x91')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xda49('0x2a')](function(_0x584512){if(_['isEmpty'](_0x584512)){_0x4e1809[_0xda49('0x46')](_0xda49('0x93'));_0x5277f6[_0xda49('0x46')](_0xda49('0x93'));}else{_0x4e1809[_0xda49('0x46')](_0xda49('0x78'),_[_0xda49('0x31')](_0x584512,'id'));_0x5277f6[_0xda49('0x46')](_0xda49('0x78'),_[_0xda49('0x31')](_0x584512,'id'));}});})[_0xda49('0x2a')](function(){if(_0x400808[_0xda49('0x91')][_0xda49('0x94')]===_0xda49('0x92')&&!_0x337a76&&!_0x400808[_0xda49('0x3c')][_0xda49('0x77')])return[];return db['sequelize'][_0xda49('0x3c')](_0x4e1809[_0xda49('0x95')](),_0x55a5ef);})[_0xda49('0x2a')](function(_0x4e2434){_0x25e33a[_0xda49('0x24')]=_0x4e2434['length'];if(_0x25e33a[_0xda49('0x24')]===0x0)return[];return db[_0xda49('0x96')]['query'](_0x3251d0[_0xda49('0x95')](),_0x55a5ef)['then'](function(_0x364631){_0x15bc33=_[_0xda49('0x97')](_0x364631,'id');_0x55a5ef=_[_0xda49('0x98')](_0x55a5ef,{'model':db[_0xda49('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x400808[_0xda49('0x3c')][_0xda49('0x40')]){_0x583f28['attributes'][_0xda49('0x34')](function(_0x160d4f){_0x5277f6[_0xda49('0x48')]('i.'+_0x160d4f);});}else{_0x5277f6[_0xda49('0x48')](_0xda49('0x8c'),_0xda49('0x60'));_0x5277f6[_0xda49('0x48')]('a.key',_0xda49('0x99'));_0x5277f6[_0xda49('0x48')](_0xda49('0x9a'),'Account.mandatoryDisposition');_0x5277f6['field']('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',_0xda49('0x8d'));_0x5277f6[_0xda49('0x48')]('i.*');_0x5277f6[_0xda49('0x48')](_0xda49('0x9b'),_0xda49('0x9c'));_0x5277f6[_0xda49('0x48')](_0xda49('0x9d'),_0xda49('0x9e'));_0x5277f6[_0xda49('0x48')](_0xda49('0x9f'),_0xda49('0xa0'));_0x5277f6['field']('c.phone','Contact.phone');_0x5277f6['field'](_0xda49('0xa1'),_0xda49('0xa2'));_0x5277f6[_0xda49('0x48')](_0xda49('0xa3'),_0xda49('0xa4'));_0x5277f6[_0xda49('0x48')](_0xda49('0xa5'),'Owner.fullname');_0x5277f6[_0xda49('0x48')](_0xda49('0xa6'),_0xda49('0xa7'));_0x5277f6[_0xda49('0x48')](_0xda49('0xa8'),_0xda49('0x32'));}if(_0x583f28[_0xda49('0x23')])_0x5277f6[_0xda49('0x23')](_0x583f28[_0xda49('0x23')]);if(_0x583f28[_0xda49('0x21')])_0x5277f6['offset'](_0x583f28[_0xda49('0x21')]);return db['sequelize'][_0xda49('0x3c')](_0x5277f6[_0xda49('0x95')](),_0x55a5ef);})['then'](function(_0x8136d3){if(_0x8136d3['length']>0x0)_0xb338c7['where'](_0xda49('0xa9'),_['map'](_0x8136d3,'id'));return db[_0xda49('0x96')][_0xda49('0x3c')](_0xb338c7[_0xda49('0x95')](),_0x55a5ef)[_0xda49('0x2a')](function(_0x4a3a6e){var _0x27df7b=_[_0xda49('0xaa')](_0x4a3a6e,'FaxInteractionId');var _0x43a736=[];_0x8136d3[_0xda49('0x34')](function(_0x29c484){_0x43a736[_0xda49('0xab')](updateFaxInteraction(_0x29c484,_0x15bc33,_0x27df7b));});return BPromise[_0xda49('0xac')](_0x43a736);});});})[_0xda49('0x2a')](function(_0x4b3768){_0x25e33a[_0xda49('0xad')]=_0x4b3768;return _0x25e33a;})['then'](respondWithFilteredResult(_0x38dbf6,_0x583f28))[_0xda49('0x35')](handleError(_0x38dbf6,null));};exports[_0xda49('0xae')]=function(_0x2ccfd7,_0x170229){var _0x996f5c={'raw':![],'where':{'id':_0x2ccfd7[_0xda49('0xaf')]['id']}},_0x19d615={};_0x19d615[_0xda49('0x3b')]=_[_0xda49('0x74')](db[_0xda49('0x37')][_0xda49('0x38')]);_0x19d615[_0xda49('0x3c')]=_[_0xda49('0x74')](_0x2ccfd7[_0xda49('0x3c')]);_0x19d615['filters']=_[_0xda49('0x3e')](_0x19d615['model'],_0x19d615[_0xda49('0x3c')]);_0x996f5c['attributes']=_['intersection'](_0x19d615['model'],qs['fields'](_0x2ccfd7[_0xda49('0x3c')][_0xda49('0x40')]));_0x996f5c[_0xda49('0x3f')]=_0x996f5c[_0xda49('0x3f')]['length']?_0x996f5c[_0xda49('0x3f')]:_0x19d615['model'];if(_0x2ccfd7[_0xda49('0x3c')]['includeAll']){_0x996f5c[_0xda49('0xb0')]=[{'all':!![]}];}_0x996f5c=_[_0xda49('0x98')]({},_0x996f5c,_0x2ccfd7[_0xda49('0xb1')]);return db['FaxInteraction'][_0xda49('0x5f')](_0x996f5c)['then'](handleEntityNotFound(_0x170229,null))['then'](respondWithResult(_0x170229,null))[_0xda49('0x35')](handleError(_0x170229,null));};exports[_0xda49('0xb2')]=function(_0x5857a1,_0x33cf6c){return db['FaxInteraction']['create'](_0x5857a1[_0xda49('0x73')],{})[_0xda49('0x2a')](respondWithResult(_0x33cf6c,0xc9))[_0xda49('0x35')](handleError(_0x33cf6c,null));};exports[_0xda49('0xb3')]=function(_0x58e75e,_0x4dd094){if(_0x58e75e[_0xda49('0x73')]['id']){delete _0x58e75e[_0xda49('0x73')]['id'];}return db[_0xda49('0x37')][_0xda49('0x5f')]({'where':{'id':_0x58e75e[_0xda49('0xaf')]['id']}})[_0xda49('0x2a')](handleEntityNotFound(_0x4dd094,null))[_0xda49('0x2a')](saveUpdates(_0x58e75e[_0xda49('0x73')],null))[_0xda49('0x2a')](respondWithResult(_0x4dd094,null))['catch'](handleError(_0x4dd094,null));};exports[_0xda49('0x2b')]=function(_0x202ac9,_0x181ffe){return db[_0xda49('0x37')]['find']({'where':{'id':_0x202ac9[_0xda49('0xaf')]['id']}})['then'](handleEntityNotFound(_0x181ffe,null))[_0xda49('0x2a')](removeEntity(_0x181ffe,null))['catch'](handleError(_0x181ffe,null));};exports[_0xda49('0xb4')]=function(_0xce090a,_0x36bb1b){return db[_0xda49('0x37')][_0xda49('0xb4')]()[_0xda49('0x2a')](respondWithResult(_0x36bb1b,null))[_0xda49('0x35')](handleError(_0x36bb1b,null));};exports[_0xda49('0xb5')]=function(_0x559cba,_0x45d961,_0x4d9e52){return db[_0xda49('0xb6')][_0xda49('0x5f')]({'where':{'id':_0x559cba[_0xda49('0xaf')]['id']}})[_0xda49('0x2a')](handleEntityNotFound(_0x45d961,null))[_0xda49('0x2a')](function(_0x18e921){if(_0x18e921){return _0x18e921[_0xda49('0xb5')](_0x559cba[_0xda49('0x73')][_0xda49('0xb7')],_['omit'](_0x559cba[_0xda49('0x73')],[_0xda49('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x45d961,null))[_0xda49('0x35')](handleError(_0x45d961,null));};exports['getMessages']=function(_0x10dac3,_0x14a63e,_0x2546ed){var _0x28b821={'raw':![],'where':{}};var _0x198c1d={};var _0x4da638={'count':0x0,'rows':[]};return db[_0xda49('0x37')]['findOne']({'where':{'id':_0x10dac3[_0xda49('0xaf')]['id']}})[_0xda49('0x2a')](handleEntityNotFound(_0x14a63e,null))['then'](function(_0x59fa40){if(_0x59fa40){_0x198c1d[_0xda49('0x3b')]=_[_0xda49('0x74')](db[_0xda49('0xb6')]['rawAttributes']);_0x198c1d[_0xda49('0x3c')]=_[_0xda49('0x74')](_0x10dac3['query']);_0x198c1d['filters']=_[_0xda49('0x3e')](_0x198c1d[_0xda49('0x3b')],_0x198c1d[_0xda49('0x3c')]);_0x28b821[_0xda49('0x3f')]=_[_0xda49('0x3e')](_0x198c1d[_0xda49('0x3b')],qs['fields'](_0x10dac3['query'][_0xda49('0x40')]));_0x28b821[_0xda49('0x3f')]=_0x28b821['attributes'][_0xda49('0x41')]?_0x28b821['attributes']:_0x198c1d[_0xda49('0x3b')];if(!_0x10dac3['query'][_0xda49('0x42')](_0xda49('0x43'))){_0x28b821['limit']=qs[_0xda49('0x23')](_0x10dac3[_0xda49('0x3c')]['limit']);_0x28b821['offset']=qs[_0xda49('0x21')](_0x10dac3['query'][_0xda49('0x21')]);}_0x28b821[_0xda49('0x44')]=qs[_0xda49('0x45')](_0x10dac3[_0xda49('0x3c')][_0xda49('0x45')]);_0x28b821[_0xda49('0x46')]=qs[_0xda49('0x3d')](_[_0xda49('0x47')](_0x10dac3['query'],_0x198c1d['filters']));_0x28b821[_0xda49('0x46')][_0xda49('0xb8')]=_0x59fa40['id'];if(_0x10dac3[_0xda49('0x3c')]['filter']){_0x28b821[_0xda49('0x46')]=_[_0xda49('0x98')](_0x28b821[_0xda49('0x46')],{'$or':_[_0xda49('0x31')](_0x28b821['attributes'],function(_0x3d6217){var _0x3c56a2={};_0x3c56a2[_0x3d6217]={'$like':'%'+_0x10dac3[_0xda49('0x3c')][_0xda49('0x85')]+'%'};return _0x3c56a2;})});}if(_0x10dac3['query'][_0xda49('0x7c')]){var _0xb4373d=_0x10dac3[_0xda49('0x3c')][_0xda49('0x7c')][_0xda49('0x6e')](',');var _0x3542af={};_0x3542af[_0xb4373d[0x0]]={'$gte':moment(_0xb4373d[0x1])['format'](_0xda49('0xb9'))};_0x28b821[_0xda49('0x46')]=_['merge'](_0x28b821['where'],_0x3542af);}_0x28b821=_[_0xda49('0x98')]({},_0x28b821,_0x10dac3['options']);return db['FaxMessage'][_0xda49('0x24')]({'where':_0x28b821['where']})[_0xda49('0x2a')](function(_0x2b40ae){_0x4da638[_0xda49('0x24')]=_0x2b40ae;if(_0x10dac3['query']['includeAll']){_0x28b821['include']=[{'all':!![]}];}return db[_0xda49('0xb6')][_0xda49('0xba')](_0x28b821);})[_0xda49('0x2a')](function(_0x6cc9e0){_0x4da638[_0xda49('0xad')]=_0x6cc9e0;return _0x4da638;});}})[_0xda49('0x2a')](respondWithFilteredResult(_0x14a63e,_0x28b821))['catch'](handleError(_0x14a63e,null));};exports[_0xda49('0xbb')]=function(_0x4bd7c4,_0x4cfc00,_0x52c9ce){return db[_0xda49('0x37')][_0xda49('0x5f')]({'where':{'id':_0x4bd7c4[_0xda49('0xaf')]['id']}})[_0xda49('0x2a')](handleEntityNotFound(_0x4cfc00,null))[_0xda49('0x2a')](function(_0x1b9ba5){if(_0x1b9ba5){return _0x1b9ba5[_0xda49('0xbc')](_0x4bd7c4[_0xda49('0x73')][_0xda49('0xb7')],_['omit'](_0x4bd7c4[_0xda49('0x73')],[_0xda49('0xb7'),'id'])||{})[_0xda49('0xbd')](function(){return db[_0xda49('0x6d')][_0xda49('0xba')]({'attributes':['id',_0xda49('0x2e'),_0xda49('0x49')],'where':{'id':_0x4bd7c4[_0xda49('0x73')][_0xda49('0xb7')]}});})[_0xda49('0x2a')](function(_0x10672d){socket['emit']('faxInteractionTags:save',{'id':Number(_0x4bd7c4['params']['id']),'tags':_0x10672d||[]});return{'id':Number(_0x4bd7c4[_0xda49('0xaf')]['id']),'tags':_0x10672d||[]};});}})[_0xda49('0x2a')](respondWithResult(_0x4cfc00,null))['catch'](handleError(_0x4cfc00,null));};exports[_0xda49('0xbe')]=function(_0x5b91ec,_0xc31d14,_0x243e82){return db[_0xda49('0x37')]['find']({'where':{'id':_0x5b91ec[_0xda49('0xaf')]['id']}})[_0xda49('0x2a')](handleEntityNotFound(_0xc31d14,null))[_0xda49('0x2a')](function(_0xbdac6f){if(_0xbdac6f){return _0xbdac6f[_0xda49('0xbe')](_0x5b91ec['query'][_0xda49('0xb7')]);}})[_0xda49('0x2a')](respondWithStatusCode(_0xc31d14,null))[_0xda49('0x35')](handleError(_0xc31d14,null));};exports['download']=function(_0x3572d4,_0x3c8873){var _0xfc2e01=moment()[_0xda49('0xbf')]()['toString']();var _0x46fe66=path['join'](config[_0xda49('0xc0')],_0xda49('0xc1'),_0xda49('0xc2'),_0xda49('0xc3'));var _0x2ff9a6=path[_0xda49('0xc4')](config[_0xda49('0xc0')],'server',_0xda49('0xc2'),'attachments');var _0x491597=path[_0xda49('0xc4')](_0x46fe66,_0xfc2e01);var _0xe83649=util['format'](_0xda49('0xc5'),_0x3572d4['params']['id'],_0xfc2e01);var _0x33bf2e=path[_0xda49('0xc4')](_0x46fe66,_0xe83649);var _0x53cf82=[];_0x53cf82[_0xda49('0xab')]({'model':db[_0xda49('0xc6')],'as':_0xda49('0xc6'),'raw':!![]});var _0x1f1748=[{'model':db[_0xda49('0xb6')],'as':_0xda49('0xc7'),'attributes':['id',_0xda49('0x73'),_0xda49('0x7a')],'include':_0x53cf82}];return db['FaxInteraction'][_0xda49('0x5f')]({'where':{'id':_0x3572d4[_0xda49('0xaf')]['id']},'include':_0x1f1748})[_0xda49('0x2a')](handleEntityNotFound(_0x3c8873,null))[_0xda49('0x2a')](function(_0x476056){if(_0x476056&&_0x476056[_0xda49('0xc7')]){var _0x26afda=_0x476056[_0xda49('0xc8')]({'plain':!![]});fs['mkdirSync'](_0x491597);for(var _0x961b2f=0x0;_0x961b2f<_0x26afda[_0xda49('0xc7')][_0xda49('0x41')];_0x961b2f++){var _0x4f1d3e=_0x26afda[_0xda49('0xc7')][_0x961b2f][_0xda49('0xc6')];if(_0x4f1d3e){var _0x4065d4=path['join'](_0x2ff9a6,_0x4f1d3e[_0xda49('0xc9')]);if(fs[_0xda49('0xca')](_0x4065d4)){fs[_0xda49('0xcb')](_0x4065d4)[_0xda49('0xcc')](fs[_0xda49('0xcd')](path[_0xda49('0xc4')](_0x491597,_0x4f1d3e['basename'])));}}}return BPromise[_0xda49('0x8f')]()['then'](function(){return new BPromise(function(_0x2cdca4,_0xe52ff7){zipdir(_0x491597,{'saveTo':_0x33bf2e},function(_0x29be50,_0x1fed7f){if(_0x29be50)return _0xe52ff7(_0x29be50);return _0x2cdca4(_0x1fed7f);});})[_0xda49('0x2a')](function(){return new BPromise(function(_0x2f5d06,_0x418512){rimraf(_0x491597,function(_0x45da3f){if(_0x45da3f)_0x418512(_0x45da3f);return _0x2f5d06();});});})['then'](function(){return _0x3c8873[_0xda49('0xce')](_0x33bf2e,_0xe83649,function(_0x5603ed){if(_0x5603ed){console[_0xda49('0xcf')](_0xda49('0xd0'),_0x5603ed);}else{fs[_0xda49('0xd1')](_0x33bf2e);}});});});}else{return _0x3c8873[_0xda49('0x1d')](0xc8);}})[_0xda49('0x35')](handleError(_0x3c8873,null));}; \ No newline at end of file +var _0x67ed=['buildExpression','start','body','keys','some','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','rows','show','FaxInteraction','includeAll','include','merge','options','catch','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','pick','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','join','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download','log','err','sendStatus','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','rawAttributes','fieldName','type','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','tools_tags','u.fullname','from','left_join','users','cm_contacts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','value','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId'];(function(_0x17a469,_0x200818){var _0x485c87=function(_0x16af4b){while(--_0x16af4b){_0x17a469['push'](_0x17a469['shift']());}};_0x485c87(++_0x200818);}(_0x67ed,0x6d));var _0xd67e=function(_0x13b77c,_0x332d61){_0x13b77c=_0x13b77c-0x0;var _0x1cd096=_0x67ed[_0x13b77c];return _0x1cd096;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd67e('0x0'));var jsonpatch=require(_0xd67e('0x1'));var rp=require(_0xd67e('0x2'));var moment=require('moment');var BPromise=require(_0xd67e('0x3'));var Mustache=require('mustache');var util=require(_0xd67e('0x4'));var path=require(_0xd67e('0x5'));var sox=require('sox');var csv=require(_0xd67e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd67e('0x7'));var _=require(_0xd67e('0x8'));var squel=require(_0xd67e('0x9'));var crypto=require(_0xd67e('0xa'));var jsforce=require(_0xd67e('0xb'));var deskjs=require(_0xd67e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd67e('0xd'));var Papa=require(_0xd67e('0xe'));var Redis=require(_0xd67e('0xf'));var authService=require(_0xd67e('0x10'));var qs=require(_0xd67e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd67e('0x12'))(_0xd67e('0x13'));var utils=require('../../config/utils');var config=require(_0xd67e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd67e('0x15')]=_[_0xd67e('0x16')](config['redis'],{'host':_0xd67e('0x17'),'port':0x18eb});var socket=require(_0xd67e('0x18'))(new Redis(config[_0xd67e('0x15')]));require(_0xd67e('0x19'))[_0xd67e('0x1a')](socket);function respondWithStatusCode(_0x4d974d,_0x49bf93){_0x49bf93=_0x49bf93||0xcc;return function(_0x791a43){if(_0x791a43){return _0x4d974d['sendStatus'](_0x49bf93);}return _0x4d974d[_0xd67e('0x1b')](_0x49bf93)[_0xd67e('0x1c')]();};}function respondWithResult(_0x3df7e6,_0x225340){_0x225340=_0x225340||0xc8;return function(_0x32e7cd){if(_0x32e7cd){return _0x3df7e6[_0xd67e('0x1b')](_0x225340)[_0xd67e('0x1d')](_0x32e7cd);}};}function respondWithFilteredResult(_0x361110,_0x1bf1c6){return function(_0x3e7740){if(_0x3e7740){var _0x2815e0=typeof _0x1bf1c6['offset']===_0xd67e('0x1e')&&typeof _0x1bf1c6[_0xd67e('0x1f')]===_0xd67e('0x1e');var _0x15e10a=_0x3e7740[_0xd67e('0x20')];var _0x22771f=_0x2815e0?0x0:_0x1bf1c6[_0xd67e('0x21')];var _0x5a77e0=_0x2815e0?_0x3e7740['count']:_0x1bf1c6[_0xd67e('0x21')]+_0x1bf1c6[_0xd67e('0x1f')];var _0xed6d8d;if(_0x5a77e0>=_0x15e10a){_0x5a77e0=_0x15e10a;_0xed6d8d=0xc8;}else{_0xed6d8d=0xce;}_0x361110[_0xd67e('0x1b')](_0xed6d8d);return _0x361110[_0xd67e('0x22')](_0xd67e('0x23'),_0x22771f+'-'+_0x5a77e0+'/'+_0x15e10a)[_0xd67e('0x1d')](_0x3e7740);}return null;};}function patchUpdates(_0x43357b){return function(_0x5911f9){try{jsonpatch['apply'](_0x5911f9,_0x43357b,!![]);}catch(_0x3338de){return BPromise[_0xd67e('0x24')](_0x3338de);}return _0x5911f9[_0xd67e('0x25')]();};}function saveUpdates(_0x30f7ca,_0x80799){return function(_0x43d9fe){if(_0x43d9fe){return _0x43d9fe[_0xd67e('0x26')](_0x30f7ca)[_0xd67e('0x27')](function(_0x1cc7c5){return _0x1cc7c5;});}return null;};}function removeEntity(_0xfa269b,_0x5ca737){return function(_0xf194ee){if(_0xf194ee){return _0xf194ee[_0xd67e('0x28')]()['then'](function(){_0xfa269b[_0xd67e('0x1b')](0xcc)[_0xd67e('0x1c')]();});}};}function handleEntityNotFound(_0xe2b364,_0x536d8d){return function(_0xec5521){if(!_0xec5521){_0xe2b364['sendStatus'](0x194);}return _0xec5521;};}function handleError(_0x2ddb15,_0x37c955){_0x37c955=_0x37c955||0x1f4;return function(_0x282d46){logger['error'](_0x282d46[_0xd67e('0x29')]);if(_0x282d46[_0xd67e('0x2a')]){delete _0x282d46[_0xd67e('0x2a')];}_0x2ddb15['status'](_0x37c955)[_0xd67e('0x2b')](_0x282d46);};}function getInteractionUsers(_0x29bd62,_0x342300){return new BPromise(function(_0x4f9334,_0x534cc0){try{if(_0x342300[_0x29bd62['id']]){_0x29bd62[_0xd67e('0x2c')]=_[_0xd67e('0x2d')](_0x342300[_0x29bd62['id']],function(_0x31120b){return{'id':_0x31120b['id'],'fullname':_0x31120b[_0xd67e('0x2e')]};});}}catch(_0x272ccd){_0x534cc0(_0x272ccd);}_0x4f9334(_0x29bd62);});}function getInteractionTags(_0x2a3fc4,_0xe43fd5){return new BPromise(function(_0x50a45c,_0x59df3c){try{if(_0x2a3fc4[_0xd67e('0x2f')]){_0x2a3fc4[_0xd67e('0x30')]=[];_0x2a3fc4[_0xd67e('0x2f')][_0xd67e('0x31')](',')[_0xd67e('0x32')](function(_0x3bf1c3){_0x2a3fc4[_0xd67e('0x30')][_0xd67e('0x33')](_0xe43fd5[_0x3bf1c3]);});}delete _0x2a3fc4[_0xd67e('0x2f')];}catch(_0xecaeb1){_0x59df3c(_0xecaeb1);}_0x50a45c(_0x2a3fc4);});}function updateFaxInteraction(_0x284c04,_0x3fd156,_0x535ab9){return new BPromise(function(_0x249949,_0xcffcad){return getInteractionUsers(_0x284c04,_0x535ab9)[_0xd67e('0x27')](function(_0x245f9e){return getInteractionTags(_0x245f9e,_0x3fd156);})[_0xd67e('0x27')](function(_0x1dac77){_0x249949(_0x1dac77);})['catch'](function(_0x20386b){_0xcffcad(_0x20386b);});});}exports['index']=function(_0x84165a,_0x1509aa){var _0x4075d8={},_0x5893d2={},_0x561b1d={'count':0x0,'rows':[]};var _0x56239a=_[_0xd67e('0x2d')](db['FaxInteraction'][_0xd67e('0x34')],function(_0x1a5f84){return{'name':_0x1a5f84[_0xd67e('0x35')],'type':_0x1a5f84[_0xd67e('0x36')]['key']};});_0x5893d2['model']=_[_0xd67e('0x2d')](_0x56239a,_0xd67e('0x2a'));_0x5893d2['query']=_['keys'](_0x84165a[_0xd67e('0x37')]);_0x5893d2['filters']=_['intersection'](_0x5893d2['model'],_0x5893d2[_0xd67e('0x37')]);_0x4075d8[_0xd67e('0x38')]=_[_0xd67e('0x39')](_0x5893d2[_0xd67e('0x3a')],qs[_0xd67e('0x3b')](_0x84165a[_0xd67e('0x37')][_0xd67e('0x3b')]));_0x4075d8[_0xd67e('0x38')]=_0x4075d8['attributes'][_0xd67e('0x3c')]?_0x4075d8[_0xd67e('0x38')]:_0x5893d2[_0xd67e('0x3a')];if(!_0x84165a['query'][_0xd67e('0x3d')](_0xd67e('0x3e'))){_0x4075d8['limit']=qs['limit'](_0x84165a[_0xd67e('0x37')][_0xd67e('0x1f')]);_0x4075d8[_0xd67e('0x21')]=qs[_0xd67e('0x21')](_0x84165a[_0xd67e('0x37')][_0xd67e('0x21')]);}_0x4075d8[_0xd67e('0x3f')]=qs[_0xd67e('0x40')](_0x84165a[_0xd67e('0x37')][_0xd67e('0x40')]);_0x4075d8[_0xd67e('0x41')]=qs['filters'](_['pick'](_0x84165a[_0xd67e('0x37')],_0x5893d2[_0xd67e('0x42')]),_0x56239a);var _0x5326ea=[];var _0x1d60ca=squel[_0xd67e('0x43')]()['field']('id')[_0xd67e('0x44')](_0xd67e('0x2a'))[_0xd67e('0x44')](_0xd67e('0x45'))['from'](_0xd67e('0x46'));var _0x54511d=squel[_0xd67e('0x43')]()['field']('u.id')[_0xd67e('0x44')](_0xd67e('0x47'))[_0xd67e('0x44')]('ui.FaxInteractionId')[_0xd67e('0x48')]('user_has_fax_interactions','ui')[_0xd67e('0x49')](_0xd67e('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x425da1=squel[_0xd67e('0x43')]()['from']('fax_interactions','i')[_0xd67e('0x49')](_0xd67e('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xd67e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0xd67e('0x49')]('fax_accounts','a',_0xd67e('0x4c'))[_0xd67e('0x49')]('fax_messages','me',_0xd67e('0x4d'))[_0xd67e('0x49')]('fax_interaction_has_tags','it',_0xd67e('0x4e'))['left_join'](_0xd67e('0x46'),'t',_0xd67e('0x4f'));var _0x5d39d8=squel['expr']();var _0x1ee568=[];var _0x1e3fd9=squel[_0xd67e('0x50')]();var _0xa288ce;if(_0x84165a[_0xd67e('0x37')][_0xd67e('0x51')]){_0xa288ce=as[_0xd67e('0x52')](_0x84165a[_0xd67e('0x37')]['search']);var _0x2e2312=_0xa288ce['sqlOperator'];for(var _0x2e1f44=0x0;_0x2e1f44<_0xa288ce[_0xd67e('0x53')]['length'];_0x2e1f44++){var _0x2e9f72=_0xa288ce[_0xd67e('0x53')][_0x2e1f44];var _0x2cdcde='i';var _0x23fcc2=_[_0xd67e('0x54')](_0x56239a,[_0xd67e('0x2a'),_0x2e9f72[_0xd67e('0x44')]]);if(!_0x23fcc2){switch(_0x2e9f72[_0xd67e('0x44')]){case'unreadMessages':if(_0x2e9f72[_0xd67e('0x55')]==0x1){_0x425da1['having']('`'+_0x2e9f72[_0xd67e('0x44')]+_0xd67e('0x56'));}else{_0x425da1['having']('`'+_0x2e9f72[_0xd67e('0x44')]+_0xd67e('0x57'));}break;case _0xd67e('0x58'):if(_0x2e9f72[_0xd67e('0x59')]==='$substring'){if(_0x2e9f72[_0xd67e('0x55')]['split']('\x20')[_0xd67e('0x3c')]>0x1){_0x5d39d8[_0x2e2312](_0xd67e('0x5a'),qs['getFullTextValue'](_0x2e9f72[_0xd67e('0x55')]),null);}else{var _0x6db929='%'+_0x2e9f72[_0xd67e('0x55')]+'%';_0x5d39d8[_0x2e2312](_0xd67e('0x5b'),_0x6db929,_0x6db929,_0x6db929);}}else{_0x23fcc2=_[_0xd67e('0x54')](_0x56239a,[_0xd67e('0x2a'),_0xd67e('0x5c')]);_0x2e9f72[_0xd67e('0x44')]=_0xd67e('0x5c');_0x4f8671=as['buildExpression'](_0x2cdcde,_0x23fcc2['type'],_0x2e9f72);_0x5d39d8[_0x2e2312](_0x4f8671[_0xd67e('0x5d')],_0x4f8671[_0xd67e('0x55')]['start'],_0x4f8671[_0xd67e('0x55')][_0xd67e('0x1c')]);}break;case _0xd67e('0x5e'):var _0x586669=_0x2e9f72[_0xd67e('0x55')][_0xd67e('0x31')](',')['map'](function(_0x39b60d){return Number(_0x39b60d);});_0x586669[_0xd67e('0x32')](function(_0xe2aa3b){_0x1e3fd9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xe2aa3b+',%');});_0x1ee568=_[_0xd67e('0x5f')](_0x1ee568,_0x586669);break;case _0xd67e('0x60'):if(_0x2e9f72[_0xd67e('0x59')]==='$substring'){_0x5d39d8[_0x2e2312](_0xd67e('0x61'),'%'+_0x2e9f72[_0xd67e('0x55')]+'%',null);}else{_0x23fcc2=_[_0xd67e('0x54')](_0x56239a,[_0xd67e('0x2a'),_0xd67e('0x62')]);_0x2e9f72[_0xd67e('0x44')]=_0xd67e('0x62');_0x4f8671=as[_0xd67e('0x63')](_0x2cdcde,_0x23fcc2[_0xd67e('0x36')],_0x2e9f72);_0x5d39d8[_0x2e2312](_0x4f8671[_0xd67e('0x5d')],_0x4f8671['value'][_0xd67e('0x64')],_0x4f8671[_0xd67e('0x55')][_0xd67e('0x1c')]);}break;case _0xd67e('0x65'):_0x4f8671=as[_0xd67e('0x63')]('me',null,_0x2e9f72);_0x5d39d8[_0x2e2312](_0x4f8671[_0xd67e('0x5d')],_0x4f8671[_0xd67e('0x55')][_0xd67e('0x64')],_0x4f8671[_0xd67e('0x55')][_0xd67e('0x1c')]);break;}}else{var _0x4f8671=as[_0xd67e('0x63')](_0x2cdcde,_0x23fcc2[_0xd67e('0x36')],_0x2e9f72);_0x5d39d8[_0x2e2312](_0x4f8671[_0xd67e('0x5d')],_0x4f8671[_0xd67e('0x55')]['start'],_0x4f8671['value']['end']);}}}else{var _0x44adaf=_(_0x84165a[_0xd67e('0x37')])[_0xd67e('0x66')]()['map'](function(_0x2c0c7d){return _[_0xd67e('0x67')](_0x56239a,[_0xd67e('0x2a'),_0x2c0c7d])?_0x2c0c7d:undefined;})['compact']()[_0xd67e('0x55')]();if(!_[_0xd67e('0x68')](_0x44adaf)){_0x44adaf[_0xd67e('0x32')](function(_0x26315e){if(_0x26315e===_0xd67e('0x69')){_0x425da1[_0xd67e('0x41')]('i.FaxAccountId\x20IN\x20?',[][_0xd67e('0x6a')](_0x84165a[_0xd67e('0x37')][_0x26315e]));}else if(_0x26315e===_0xd67e('0x6b')){var _0x4f1482=JSON[_0xd67e('0x6c')](_0x84165a[_0xd67e('0x37')][_0x26315e])[_0xd67e('0x6d')];var _0x3145d0=JSON[_0xd67e('0x6c')](_0x84165a[_0xd67e('0x37')][_0x26315e])[_0xd67e('0x6e')];_0x425da1[_0xd67e('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f1482,_0x3145d0);}else{if(_0x84165a[_0xd67e('0x37')][_0x26315e]===_0xd67e('0x6f')){_0x425da1['where']('i.'+_0x26315e+'\x20IS\x20NULL');}else{_0x425da1[_0xd67e('0x41')]('i.'+_0x26315e+_0xd67e('0x70'),_0x84165a['query'][_0x26315e]);}}});}if(_0x84165a['query'][_0xd67e('0x71')]){if(_0x84165a[_0xd67e('0x37')]['read']==0x1){_0x425da1[_0xd67e('0x72')](_0xd67e('0x73'));}else{_0x425da1[_0xd67e('0x72')]('`unreadMessages`\x20>\x200');}}if(_0x84165a[_0xd67e('0x37')][_0xd67e('0x74')]){_0x1ee568=_[_0xd67e('0x75')](_0x84165a[_0xd67e('0x37')][_0xd67e('0x74')])?_0x84165a[_0xd67e('0x37')][_0xd67e('0x74')]:new Array(_0x84165a[_0xd67e('0x37')][_0xd67e('0x74')]);_0x1ee568[_0xd67e('0x32')](function(_0x31d755){_0x1e3fd9['or'](_0xd67e('0x76'),'%,'+_0x31d755+',%');});}if(_0x84165a['query'][_0xd67e('0x77')]){var _0x2e2d64=_0x84165a[_0xd67e('0x37')][_0xd67e('0x77')]['replace']('\x5c','\x5c\x5c')[_0xd67e('0x78')](/'/g,'\x27\x27');if(qs[_0xd67e('0x79')](_0x2e2d64)){_0x5d39d8['or'](_0xd67e('0x7a'),_0x2e2d64+'%')['or']('i.fax\x20LIKE\x20?',_0x2e2d64+'%');}_0x5d39d8['or'](_0xd67e('0x7b'),_0x2e2d64+'%');}}_0x425da1[_0xd67e('0x41')](_0x5d39d8);_0x425da1['group'](_0xd67e('0x7c'));var _0x31e559={'type':db[_0xd67e('0x7d')][_0xd67e('0x7e')][_0xd67e('0x7f')],'raw':!![]};var _0xcfd5a3=_0x425da1[_0xd67e('0x80')]();_0xcfd5a3['field'](_0xd67e('0x7c'));_0xcfd5a3['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd67e('0x81'));if(_0x4075d8['order']){_0x4075d8[_0xd67e('0x3f')][_0xd67e('0x32')](function(_0x501cea){var _0x4d0926=_0x501cea[0x0]===_0xd67e('0x82')?_0x501cea[0x0]:'i.'+_0x501cea[0x0];_0x425da1[_0xd67e('0x3f')](_0x4d0926,_0x501cea[0x1]===_0xd67e('0x83')?![]:!![]);});}if(!_[_0xd67e('0x68')](_0x1ee568)){_0x425da1[_0xd67e('0x72')](_0x1e3fd9);_0xcfd5a3[_0xd67e('0x41')](_0xd67e('0x84'),_0x1ee568);}BPromise['resolve']()[_0xd67e('0x27')](function(){if(!_0xa288ce){if(_0x84165a[_0xd67e('0x37')]['FaxAccountId'])return;_0xcfd5a3[_0xd67e('0x41')](_0xd67e('0x85'));_0x425da1['where'](_0xd67e('0x85'));return;}if(_0x84165a[_0xd67e('0x86')][_0xd67e('0x87')]!==_0xd67e('0x88'))return;return _0x84165a['user'][_0xd67e('0x89')]({'attributes':['id'],'raw':!![]})['then'](function(_0x354b54){if(_[_0xd67e('0x68')](_0x354b54)){_0xcfd5a3[_0xd67e('0x41')](_0xd67e('0x8a'));_0x425da1[_0xd67e('0x41')]('i.FaxAccountId\x20IS\x20NULL');}else{_0xcfd5a3[_0xd67e('0x41')](_0xd67e('0x8b'),_['map'](_0x354b54,'id'));_0x425da1['where']('i.FaxAccountId\x20IN\x20?',_[_0xd67e('0x2d')](_0x354b54,'id'));}});})['then'](function(){if(_0x84165a[_0xd67e('0x86')][_0xd67e('0x87')]===_0xd67e('0x88')&&!_0xa288ce&&!_0x84165a[_0xd67e('0x37')]['FaxAccountId'])return[];return db['sequelize'][_0xd67e('0x37')](_0xcfd5a3[_0xd67e('0x8c')](),_0x31e559);})[_0xd67e('0x27')](function(_0x1b97ea){_0x561b1d[_0xd67e('0x20')]=_0x1b97ea[_0xd67e('0x3c')];if(_0x561b1d[_0xd67e('0x20')]===0x0)return[];return db[_0xd67e('0x8d')][_0xd67e('0x37')](_0x1d60ca[_0xd67e('0x8c')](),_0x31e559)[_0xd67e('0x27')](function(_0x119f7d){_0x5326ea=_[_0xd67e('0x8e')](_0x119f7d,'id');_0x31e559=_['merge'](_0x31e559,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x84165a['query']['fields']){_0x4075d8['attributes'][_0xd67e('0x32')](function(_0x5b91f1){_0x425da1['field']('i.'+_0x5b91f1);});}else{_0x425da1[_0xd67e('0x44')](_0xd67e('0x8f'),_0xd67e('0x81'));_0x425da1[_0xd67e('0x44')]('a.key',_0xd67e('0x90'));_0x425da1[_0xd67e('0x44')](_0xd67e('0x91'),_0xd67e('0x92'));_0x425da1[_0xd67e('0x44')](_0xd67e('0x93'),_0xd67e('0x82'));_0x425da1[_0xd67e('0x44')](_0xd67e('0x94'));_0x425da1[_0xd67e('0x44')](_0xd67e('0x95'),'Contact.firstName');_0x425da1[_0xd67e('0x44')](_0xd67e('0x96'),_0xd67e('0x97'));_0x425da1[_0xd67e('0x44')]('c.email',_0xd67e('0x98'));_0x425da1[_0xd67e('0x44')]('c.phone',_0xd67e('0x99'));_0x425da1[_0xd67e('0x44')](_0xd67e('0x9a'),_0xd67e('0x9b'));_0x425da1[_0xd67e('0x44')](_0xd67e('0x9c'),'Contact.fax');_0x425da1[_0xd67e('0x44')](_0xd67e('0x9d'),_0xd67e('0x9e'));_0x425da1['field']('o.internal','Owner.internal');_0x425da1[_0xd67e('0x44')](_0xd67e('0x9f'),'TagIds');}if(_0x4075d8[_0xd67e('0x1f')])_0x425da1[_0xd67e('0x1f')](_0x4075d8['limit']);if(_0x4075d8[_0xd67e('0x21')])_0x425da1['offset'](_0x4075d8['offset']);return db['sequelize'][_0xd67e('0x37')](_0x425da1[_0xd67e('0x8c')](),_0x31e559);})[_0xd67e('0x27')](function(_0x51fbbb){if(_0x51fbbb[_0xd67e('0x3c')]>0x0)_0x54511d[_0xd67e('0x41')](_0xd67e('0xa0'),_[_0xd67e('0x2d')](_0x51fbbb,'id'));return db[_0xd67e('0x8d')][_0xd67e('0x37')](_0x54511d[_0xd67e('0x8c')](),_0x31e559)[_0xd67e('0x27')](function(_0x53260f){var _0x2d34a5=_[_0xd67e('0xa1')](_0x53260f,'FaxInteractionId');var _0x34fade=[];_0x51fbbb[_0xd67e('0x32')](function(_0x801c32){_0x34fade[_0xd67e('0x33')](updateFaxInteraction(_0x801c32,_0x5326ea,_0x2d34a5));});return BPromise['all'](_0x34fade);});});})['then'](function(_0x473078){_0x561b1d[_0xd67e('0xa2')]=_0x473078;return _0x561b1d;})['then'](respondWithFilteredResult(_0x1509aa,_0x4075d8))['catch'](handleError(_0x1509aa,null));};exports[_0xd67e('0xa3')]=function(_0x5f22cf,_0x34f088){var _0x2e4b3b={'raw':![],'where':{'id':_0x5f22cf['params']['id']}},_0x8551c2={};_0x8551c2[_0xd67e('0x3a')]=_[_0xd67e('0x66')](db[_0xd67e('0xa4')][_0xd67e('0x34')]);_0x8551c2[_0xd67e('0x37')]=_[_0xd67e('0x66')](_0x5f22cf[_0xd67e('0x37')]);_0x8551c2[_0xd67e('0x42')]=_[_0xd67e('0x39')](_0x8551c2['model'],_0x8551c2[_0xd67e('0x37')]);_0x2e4b3b['attributes']=_['intersection'](_0x8551c2[_0xd67e('0x3a')],qs[_0xd67e('0x3b')](_0x5f22cf[_0xd67e('0x37')][_0xd67e('0x3b')]));_0x2e4b3b[_0xd67e('0x38')]=_0x2e4b3b[_0xd67e('0x38')]['length']?_0x2e4b3b[_0xd67e('0x38')]:_0x8551c2[_0xd67e('0x3a')];if(_0x5f22cf['query'][_0xd67e('0xa5')]){_0x2e4b3b[_0xd67e('0xa6')]=[{'all':!![]}];}_0x2e4b3b=_[_0xd67e('0xa7')]({},_0x2e4b3b,_0x5f22cf[_0xd67e('0xa8')]);return db[_0xd67e('0xa4')][_0xd67e('0x54')](_0x2e4b3b)[_0xd67e('0x27')](handleEntityNotFound(_0x34f088,null))[_0xd67e('0x27')](respondWithResult(_0x34f088,null))[_0xd67e('0xa9')](handleError(_0x34f088,null));};exports[_0xd67e('0xaa')]=function(_0xe2cc0c,_0x4aa062){return db[_0xd67e('0xa4')]['create'](_0xe2cc0c[_0xd67e('0x65')],{})[_0xd67e('0x27')](respondWithResult(_0x4aa062,0xc9))[_0xd67e('0xa9')](handleError(_0x4aa062,null));};exports[_0xd67e('0x26')]=function(_0x10cb15,_0x499e9c){if(_0x10cb15[_0xd67e('0x65')]['id']){delete _0x10cb15[_0xd67e('0x65')]['id'];}return db[_0xd67e('0xa4')][_0xd67e('0x54')]({'where':{'id':_0x10cb15[_0xd67e('0xab')]['id']}})[_0xd67e('0x27')](handleEntityNotFound(_0x499e9c,null))[_0xd67e('0x27')](saveUpdates(_0x10cb15[_0xd67e('0x65')],null))[_0xd67e('0x27')](respondWithResult(_0x499e9c,null))['catch'](handleError(_0x499e9c,null));};exports['destroy']=function(_0x26f161,_0x22a17f){return db[_0xd67e('0xa4')]['find']({'where':{'id':_0x26f161[_0xd67e('0xab')]['id']}})[_0xd67e('0x27')](handleEntityNotFound(_0x22a17f,null))['then'](removeEntity(_0x22a17f,null))[_0xd67e('0xa9')](handleError(_0x22a17f,null));};exports[_0xd67e('0xac')]=function(_0x409bc0,_0x4c935c){return db[_0xd67e('0xa4')][_0xd67e('0xac')]()[_0xd67e('0x27')](respondWithResult(_0x4c935c,null))[_0xd67e('0xa9')](handleError(_0x4c935c,null));};exports[_0xd67e('0xad')]=function(_0x54a40a,_0x5e0fb4,_0x3707b3){return db[_0xd67e('0xae')][_0xd67e('0x54')]({'where':{'id':_0x54a40a[_0xd67e('0xab')]['id']}})[_0xd67e('0x27')](handleEntityNotFound(_0x5e0fb4,null))[_0xd67e('0x27')](function(_0x474cbb){if(_0x474cbb){return _0x474cbb[_0xd67e('0xad')](_0x54a40a[_0xd67e('0x65')][_0xd67e('0xaf')],_[_0xd67e('0xb0')](_0x54a40a[_0xd67e('0x65')],[_0xd67e('0xaf'),'id'])||{});}})[_0xd67e('0x27')](respondWithResult(_0x5e0fb4,null))[_0xd67e('0xa9')](handleError(_0x5e0fb4,null));};exports[_0xd67e('0xb1')]=function(_0x56f796,_0x243ebe,_0xd200){var _0x489ed2={'raw':![],'where':{}};var _0x365a37={};var _0x224fe4={'count':0x0,'rows':[]};return db[_0xd67e('0xa4')][_0xd67e('0xb2')]({'where':{'id':_0x56f796[_0xd67e('0xab')]['id']}})['then'](handleEntityNotFound(_0x243ebe,null))[_0xd67e('0x27')](function(_0x4a7bf2){if(_0x4a7bf2){_0x365a37['model']=_[_0xd67e('0x66')](db['FaxMessage'][_0xd67e('0x34')]);_0x365a37['query']=_[_0xd67e('0x66')](_0x56f796['query']);_0x365a37[_0xd67e('0x42')]=_[_0xd67e('0x39')](_0x365a37[_0xd67e('0x3a')],_0x365a37['query']);_0x489ed2[_0xd67e('0x38')]=_[_0xd67e('0x39')](_0x365a37[_0xd67e('0x3a')],qs[_0xd67e('0x3b')](_0x56f796['query'][_0xd67e('0x3b')]));_0x489ed2[_0xd67e('0x38')]=_0x489ed2[_0xd67e('0x38')]['length']?_0x489ed2['attributes']:_0x365a37['model'];if(!_0x56f796[_0xd67e('0x37')][_0xd67e('0x3d')](_0xd67e('0x3e'))){_0x489ed2['limit']=qs[_0xd67e('0x1f')](_0x56f796[_0xd67e('0x37')][_0xd67e('0x1f')]);_0x489ed2[_0xd67e('0x21')]=qs[_0xd67e('0x21')](_0x56f796[_0xd67e('0x37')][_0xd67e('0x21')]);}_0x489ed2[_0xd67e('0x3f')]=qs['sort'](_0x56f796[_0xd67e('0x37')][_0xd67e('0x40')]);_0x489ed2[_0xd67e('0x41')]=qs[_0xd67e('0x42')](_[_0xd67e('0xb3')](_0x56f796[_0xd67e('0x37')],_0x365a37[_0xd67e('0x42')]));_0x489ed2['where'][_0xd67e('0xb4')]=_0x4a7bf2['id'];if(_0x56f796['query'][_0xd67e('0x77')]){_0x489ed2[_0xd67e('0x41')]=_['merge'](_0x489ed2[_0xd67e('0x41')],{'$or':_[_0xd67e('0x2d')](_0x489ed2[_0xd67e('0x38')],function(_0x3668b8){var _0x5b9868={};_0x5b9868[_0x3668b8]={'$like':'%'+_0x56f796[_0xd67e('0x37')][_0xd67e('0x77')]+'%'};return _0x5b9868;})});}if(_0x56f796['query']['$gte']){var _0x12487f=_0x56f796['query'][_0xd67e('0x6d')]['split'](',');var _0x1221dc={};_0x1221dc[_0x12487f[0x0]]={'$gte':moment(_0x12487f[0x1])[_0xd67e('0xb5')](_0xd67e('0xb6'))};_0x489ed2['where']=_['merge'](_0x489ed2['where'],_0x1221dc);}_0x489ed2=_['merge']({},_0x489ed2,_0x56f796[_0xd67e('0xa8')]);return db[_0xd67e('0xae')]['count']({'where':_0x489ed2[_0xd67e('0x41')]})[_0xd67e('0x27')](function(_0x1d1d95){_0x224fe4['count']=_0x1d1d95;if(_0x56f796[_0xd67e('0x37')]['includeAll']){_0x489ed2[_0xd67e('0xa6')]=[{'all':!![]}];}return db['FaxMessage'][_0xd67e('0xb7')](_0x489ed2);})[_0xd67e('0x27')](function(_0x4cfeee){_0x224fe4[_0xd67e('0xa2')]=_0x4cfeee;return _0x224fe4;});}})[_0xd67e('0x27')](respondWithFilteredResult(_0x243ebe,_0x489ed2))[_0xd67e('0xa9')](handleError(_0x243ebe,null));};exports['addTags']=function(_0x213522,_0x1c434f,_0x2d2712){return db['FaxInteraction'][_0xd67e('0x54')]({'where':{'id':_0x213522['params']['id']}})['then'](handleEntityNotFound(_0x1c434f,null))['then'](function(_0x2f38e2){if(_0x2f38e2){return _0x2f38e2[_0xd67e('0xb8')](_0x213522[_0xd67e('0x65')][_0xd67e('0xaf')],_['omit'](_0x213522[_0xd67e('0x65')],[_0xd67e('0xaf'),'id'])||{})[_0xd67e('0xb9')](function(){return db[_0xd67e('0x5e')]['findAll']({'attributes':['id',_0xd67e('0x2a'),_0xd67e('0x45')],'where':{'id':_0x213522[_0xd67e('0x65')]['ids']}});})[_0xd67e('0x27')](function(_0x3fc250){socket[_0xd67e('0xba')](_0xd67e('0xbb'),{'id':Number(_0x213522[_0xd67e('0xab')]['id']),'tags':_0x3fc250||[]});return{'id':Number(_0x213522['params']['id']),'tags':_0x3fc250||[]};});}})[_0xd67e('0x27')](respondWithResult(_0x1c434f,null))[_0xd67e('0xa9')](handleError(_0x1c434f,null));};exports['removeTags']=function(_0x4fcc35,_0x2a2c64,_0x255054){return db[_0xd67e('0xa4')]['find']({'where':{'id':_0x4fcc35[_0xd67e('0xab')]['id']}})[_0xd67e('0x27')](handleEntityNotFound(_0x2a2c64,null))[_0xd67e('0x27')](function(_0x3f20ce){if(_0x3f20ce){return _0x3f20ce[_0xd67e('0xbc')](_0x4fcc35[_0xd67e('0x37')][_0xd67e('0xaf')]);}})[_0xd67e('0x27')](respondWithStatusCode(_0x2a2c64,null))[_0xd67e('0xa9')](handleError(_0x2a2c64,null));};exports['download']=function(_0x2d30ae,_0xcb19bc){var _0x23fb69=moment()['unix']()[_0xd67e('0x8c')]();var _0x197460=path[_0xd67e('0xbd')](config['root'],_0xd67e('0xbe'),_0xd67e('0xbf'),_0xd67e('0xc0'));var _0x31a031=path['join'](config['root'],_0xd67e('0xbe'),'files',_0xd67e('0xc1'));var _0x3ce1e7=path[_0xd67e('0xbd')](_0x197460,_0x23fb69);var _0x299e0e=util[_0xd67e('0xb5')](_0xd67e('0xc2'),_0x2d30ae[_0xd67e('0xab')]['id'],_0x23fb69);var _0x253616=path[_0xd67e('0xbd')](_0x197460,_0x299e0e);var _0x4267eb=[];_0x4267eb[_0xd67e('0x33')]({'model':db[_0xd67e('0xc3')],'as':_0xd67e('0xc3'),'raw':!![]});var _0x56cc70=[{'model':db[_0xd67e('0xae')],'as':_0xd67e('0xc4'),'attributes':['id','body',_0xd67e('0x6b')],'include':_0x4267eb}];return db[_0xd67e('0xa4')][_0xd67e('0x54')]({'where':{'id':_0x2d30ae[_0xd67e('0xab')]['id']},'include':_0x56cc70})[_0xd67e('0x27')](handleEntityNotFound(_0xcb19bc,null))[_0xd67e('0x27')](function(_0x2f567e){if(_0x2f567e&&_0x2f567e[_0xd67e('0xc4')]){var _0x3b9cbe=_0x2f567e['get']({'plain':!![]});fs[_0xd67e('0xc5')](_0x3ce1e7);for(var _0x3f3636=0x0;_0x3f3636<_0x3b9cbe[_0xd67e('0xc4')]['length'];_0x3f3636++){var _0x7325bc=_0x3b9cbe[_0xd67e('0xc4')][_0x3f3636]['Attachment'];if(_0x7325bc){var _0xb0a5af=path['join'](_0x31a031,_0x7325bc['basename']);if(fs[_0xd67e('0xc6')](_0xb0a5af)){fs[_0xd67e('0xc7')](_0xb0a5af)[_0xd67e('0xc8')](fs[_0xd67e('0xc9')](path['join'](_0x3ce1e7,_0x7325bc[_0xd67e('0xca')])));}}}return BPromise[_0xd67e('0xcb')]()[_0xd67e('0x27')](function(){return new BPromise(function(_0x1c4f22,_0x526d36){zipdir(_0x3ce1e7,{'saveTo':_0x253616},function(_0x566511,_0x1be11d){if(_0x566511)return _0x526d36(_0x566511);return _0x1c4f22(_0x1be11d);});})[_0xd67e('0x27')](function(){return new BPromise(function(_0xa39b49,_0x249e08){rimraf(_0x3ce1e7,function(_0x4503dd){if(_0x4503dd)_0x249e08(_0x4503dd);return _0xa39b49();});});})[_0xd67e('0x27')](function(){return _0xcb19bc[_0xd67e('0xcc')](_0x253616,_0x299e0e,function(_0x4a9e2c){if(_0x4a9e2c){console[_0xd67e('0xcd')](_0xd67e('0xce'),_0x4a9e2c);}else{fs['unlinkSync'](_0x253616);}});});});}else{return _0xcb19bc[_0xd67e('0xcf')](0xc8);}})[_0xd67e('0xa9')](handleError(_0xcb19bc,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 535683c..f553bc5 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 _0x1e5b=['events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0x885926,_0x19bb4f){var _0x3643f4=function(_0x9e025a){while(--_0x9e025a){_0x885926['push'](_0x885926['shift']());}};_0x3643f4(++_0x19bb4f);}(_0x1e5b,0x88));var _0xb1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb1e5('0x0'));var FaxInteraction=require(_0xb1e5('0x1'))['db'][_0xb1e5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xb1e5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb1e5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb1e5('0x5'),'afterDestroy':_0xb1e5('0x6')};function emitEvent(_0x4bbc83){return function(_0x11c4d8,_0x17206e,_0x32c1e5){_0x11c4d8[_0xb1e5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x15aaa2){_0x11c4d8[_0xb1e5('0x8')](_0xb1e5('0x9'),_0x15aaa2[_0xb1e5('0xa')](function(_0xe659a8){return{'id':_0xe659a8['id']};}));return FaxMessage[_0xb1e5('0xb')]({'where':{'FaxInteractionId':_0x11c4d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb1e5('0xc')](function(_0x23187b){_0x11c4d8[_0xb1e5('0x8')](_0xb1e5('0xd'),_0x23187b[_0xb1e5('0xe')]);FaxInteractionEvents['emit'](_0x4bbc83+':'+_0x11c4d8['id'],_0x11c4d8);FaxInteractionEvents[_0xb1e5('0xf')](_0x4bbc83,_0x11c4d8);_0x32c1e5(null);})[_0xb1e5('0x10')](_0x32c1e5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x05d7=['getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','update','remove'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x05d7,0x1cb));var _0x705d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x05d7[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x705d('0x0'))['db'][_0x705d('0x1')];var FaxMessage=require(_0x705d('0x0'))['db'][_0x705d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x705d('0x3'),'afterDestroy':_0x705d('0x4')};function emitEvent(_0x1b1251){return function(_0x4a1998,_0x5b8048,_0x2f0384){_0x4a1998[_0x705d('0x5')]({'attributes':['id'],'raw':!![]})[_0x705d('0x6')](function(_0x193b4a){_0x4a1998[_0x705d('0x7')](_0x705d('0x8'),_0x193b4a['map'](function(_0x527fdc){return{'id':_0x527fdc['id']};}));return FaxMessage[_0x705d('0x9')]({'where':{'FaxInteractionId':_0x4a1998['id'],'direction':'in','read':![]},'raw':!![]});})[_0x705d('0x6')](function(_0x4a6a71){_0x4a1998[_0x705d('0x7')](_0x705d('0xa'),_0x4a6a71[_0x705d('0xb')]);FaxInteractionEvents[_0x705d('0xc')](_0x1b1251+':'+_0x4a1998['id'],_0x4a1998);FaxInteractionEvents[_0x705d('0xc')](_0x1b1251,_0x4a1998);_0x2f0384(null);})[_0x705d('0xd')](_0x2f0384(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x705d('0xe')](e,emitEvent(event));}}module[_0x705d('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 37cd879..2d3a0c8 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 _0x8137=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x23a7f1,_0x58e98a){var _0x5ea009=function(_0x1b5500){while(--_0x1b5500){_0x23a7f1['push'](_0x23a7f1['shift']());}};_0x5ea009(++_0x58e98a);}(_0x8137,0x180));var _0x7813=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8137[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x7813('0x0'));var util=require(_0x7813('0x1'));var logger=require(_0x7813('0x2'))(_0x7813('0x3'));var moment=require(_0x7813('0x4'));var BPromise=require(_0x7813('0x5'));var rp=require(_0x7813('0x6'));var fs=require('fs');var path=require(_0x7813('0x7'));var rimraf=require(_0x7813('0x8'));var config=require('../../config/environment');var attributes=require(_0x7813('0x9'));module[_0x7813('0xa')]=function(_0x4b251a,_0x22ed9a){return _0x4b251a['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25a499,_0x5ae51e,_0x386873){if(_0x25a499[_0x7813('0xb')](_0x7813('0xc'))){_0x25a499[_0x7813('0xd')]=moment()[_0x7813('0xe')](_0x7813('0xf'));}_0x386873(null,_0x25a499);}}});}; \ No newline at end of file +var _0xda33=['../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x28e725,_0x2d2be0){var _0x262030=function(_0x2cfba8){while(--_0x2cfba8){_0x28e725['push'](_0x28e725['shift']());}};_0x262030(++_0x2d2be0);}(_0xda33,0x1d4));var _0x3da3=function(_0x22965e,_0x1caefa){_0x22965e=_0x22965e-0x0;var _0x3bdfb8=_0xda33[_0x22965e];return _0x3bdfb8;};'use strict';var _=require('lodash');var util=require(_0x3da3('0x0'));var logger=require(_0x3da3('0x1'))(_0x3da3('0x2'));var moment=require(_0x3da3('0x3'));var BPromise=require(_0x3da3('0x4'));var rp=require(_0x3da3('0x5'));var fs=require('fs');var path=require(_0x3da3('0x6'));var rimraf=require(_0x3da3('0x7'));var config=require(_0x3da3('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x3da3('0x9')]=function(_0x510af0,_0x5ba26c){return _0x510af0[_0x3da3('0xa')](_0x3da3('0xb'),attributes,{'tableName':_0x3da3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a30a9,_0x4ef3b7,_0x104cee){if(_0x5a30a9[_0x3da3('0xd')]('closed')){_0x5a30a9[_0x3da3('0xe')]=moment()[_0x3da3('0xf')](_0x3da3('0x10'));}_0x104cee(null,_0x5a30a9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index bbb28a0..5dc47a0 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 _0x5507=['omit','AddTags','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','where','attributes','limit','find','addTags','ids'];(function(_0x12186a,_0x170696){var _0x35f45a=function(_0x256a04){while(--_0x256a04){_0x12186a['push'](_0x12186a['shift']());}};_0x35f45a(++_0x170696);}(_0x5507,0x1d6));var _0x7550=function(_0x52d056,_0x226035){_0x52d056=_0x52d056-0x0;var _0x4d0bb1=_0x5507[_0x52d056];return _0x4d0bb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7550('0x0'));var fs=require('fs');var Redis=require(_0x7550('0x1'));var db=require(_0x7550('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7550('0x3'))(_0x7550('0x4'));var config=require('../../config/environment');var jayson=require(_0x7550('0x5'));var client=jayson[_0x7550('0x6')][_0x7550('0x7')]({'port':0x232a});config[_0x7550('0x8')]=_[_0x7550('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7550('0xa'))(new Redis(config[_0x7550('0x8')]));require('./faxInteraction.socket')[_0x7550('0xb')](socket);function respondWithRpcPromise(_0x3207b4,_0x52c9f4,_0x248754){return new BPromise(function(_0x461d13,_0x1be4c0){return client[_0x7550('0xc')](_0x3207b4,_0x248754)[_0x7550('0xd')](function(_0x16a1b9){logger[_0x7550('0xe')](_0x7550('0xf'),_0x52c9f4,_0x7550('0x10'));logger[_0x7550('0x11')](_0x7550('0x12'),_0x52c9f4,_0x7550('0x10'),JSON[_0x7550('0x13')](_0x16a1b9));if(_0x16a1b9['error']){if(_0x16a1b9['error'][_0x7550('0x14')]===0x1f4){logger['error'](_0x7550('0xf'),_0x52c9f4,_0x16a1b9[_0x7550('0x15')]['message']);return _0x1be4c0(_0x16a1b9[_0x7550('0x15')][_0x7550('0x16')]);}logger['error'](_0x7550('0xf'),_0x52c9f4,_0x16a1b9[_0x7550('0x15')][_0x7550('0x16')]);return _0x461d13(_0x16a1b9[_0x7550('0x15')][_0x7550('0x16')]);}else{logger[_0x7550('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x52c9f4,_0x7550('0x10'));_0x461d13(_0x16a1b9[_0x7550('0x17')][_0x7550('0x16')]);}})[_0x7550('0x18')](function(_0x112da6){logger[_0x7550('0x15')](_0x7550('0xf'),_0x52c9f4,_0x112da6);_0x1be4c0(_0x112da6);});});}exports[_0x7550('0x19')]=function(_0x440e14){var _0x3097c8=this;return new Promise(function(_0x311dc0,_0x4e4001){return db[_0x7550('0x1a')][_0x7550('0x1b')](_0x440e14[_0x7550('0x1c')],{'raw':_0x440e14['options']?_0x440e14['options'][_0x7550('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x440e14[_0x7550('0x1e')]?_0x440e14[_0x7550('0x1e')][_0x7550('0x1f')]||null:null,'attributes':_0x440e14[_0x7550('0x1e')]?_0x440e14[_0x7550('0x1e')][_0x7550('0x20')]||null:null,'limit':_0x440e14[_0x7550('0x1e')]?_0x440e14['options'][_0x7550('0x21')]||null:null})[_0x7550('0xd')](function(_0x29f065){logger[_0x7550('0xe')](_0x7550('0x19'),_0x440e14);logger[_0x7550('0x11')](_0x7550('0x19'),_0x440e14,JSON['stringify'](_0x29f065));_0x311dc0(_0x29f065);})[_0x7550('0x18')](function(_0x258c69){logger[_0x7550('0x15')]('UpdateFaxInteraction',_0x258c69[_0x7550('0x16')],_0x440e14);_0x4e4001(_0x3097c8[_0x7550('0x15')](0x1f4,_0x258c69[_0x7550('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4937bf){return new Promise(function(_0x22b5a0,_0x4728c2){return db[_0x7550('0x1a')][_0x7550('0x22')]({'where':_0x4937bf[_0x7550('0x1e')]?_0x4937bf['options'][_0x7550('0x1f')]||null:null})[_0x7550('0xd')](function(_0x2c7946){if(_0x2c7946){return _0x2c7946[_0x7550('0x23')](_0x4937bf[_0x7550('0x1c')][_0x7550('0x24')],_[_0x7550('0x25')](_0x4937bf[_0x7550('0x1c')],[_0x7550('0x24'),'id'])||{});}})['spread'](function(_0x333451){logger[_0x7550('0xe')](_0x7550('0x26'),_0x4937bf);logger[_0x7550('0x11')]('AddTags',_0x4937bf,JSON['stringify'](_0x333451));_0x22b5a0(_0x333451);})[_0x7550('0x18')](function(_0x1e79f6){logger['error']('AddTags',_0x1e79f6[_0x7550('0x16')],_0x4937bf);_0x4728c2(_this['error'](0x1f4,_0x1e79f6['message']));});});}; \ No newline at end of file +var _0xcb00=['localhost','socket.io-emitter','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','find','addTags','ids','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xcb00,0xb3));var _0x0cb0=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xcb00[_0x39106e];return _0x892aec;};'use strict';var _=require('lodash');var util=require(_0x0cb0('0x0'));var moment=require(_0x0cb0('0x1'));var BPromise=require(_0x0cb0('0x2'));var rs=require(_0x0cb0('0x3'));var fs=require('fs');var Redis=require(_0x0cb0('0x4'));var db=require(_0x0cb0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cb0('0x6'))(_0x0cb0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0cb0('0x8')]({'port':0x232a});config[_0x0cb0('0x9')]=_[_0x0cb0('0xa')](config[_0x0cb0('0x9')],{'host':_0x0cb0('0xb'),'port':0x18eb});var socket=require(_0x0cb0('0xc'))(new Redis(config[_0x0cb0('0x9')]));require(_0x0cb0('0xd'))['register'](socket);function respondWithRpcPromise(_0x4edae2,_0x4618db,_0x2761cb){return new BPromise(function(_0x4de7e0,_0x1c370b){return client['request'](_0x4edae2,_0x2761cb)[_0x0cb0('0xe')](function(_0x2739c7){logger[_0x0cb0('0xf')](_0x0cb0('0x10'),_0x4618db,_0x0cb0('0x11'));logger[_0x0cb0('0x12')](_0x0cb0('0x13'),_0x4618db,'request\x20sent',JSON[_0x0cb0('0x14')](_0x2739c7));if(_0x2739c7[_0x0cb0('0x15')]){if(_0x2739c7[_0x0cb0('0x15')]['code']===0x1f4){logger['error'](_0x0cb0('0x10'),_0x4618db,_0x2739c7[_0x0cb0('0x15')][_0x0cb0('0x16')]);return _0x1c370b(_0x2739c7[_0x0cb0('0x15')][_0x0cb0('0x16')]);}logger[_0x0cb0('0x15')](_0x0cb0('0x10'),_0x4618db,_0x2739c7[_0x0cb0('0x15')][_0x0cb0('0x16')]);return _0x4de7e0(_0x2739c7['error'][_0x0cb0('0x16')]);}else{logger['info'](_0x0cb0('0x10'),_0x4618db,_0x0cb0('0x11'));_0x4de7e0(_0x2739c7['result'][_0x0cb0('0x16')]);}})['catch'](function(_0x585528){logger[_0x0cb0('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x4618db,_0x585528);_0x1c370b(_0x585528);});});}exports[_0x0cb0('0x17')]=function(_0x4b9627){var _0x2653de=this;return new Promise(function(_0xc4a5e4,_0x15893c){return db[_0x0cb0('0x18')][_0x0cb0('0x19')](_0x4b9627[_0x0cb0('0x1a')],{'raw':_0x4b9627['options']?_0x4b9627[_0x0cb0('0x1b')][_0x0cb0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b9627[_0x0cb0('0x1b')]?_0x4b9627['options'][_0x0cb0('0x1d')]||null:null,'attributes':_0x4b9627[_0x0cb0('0x1b')]?_0x4b9627['options'][_0x0cb0('0x1e')]||null:null,'limit':_0x4b9627['options']?_0x4b9627[_0x0cb0('0x1b')][_0x0cb0('0x1f')]||null:null})[_0x0cb0('0xe')](function(_0x1da735){logger[_0x0cb0('0xf')]('UpdateFaxInteraction',_0x4b9627);logger[_0x0cb0('0x12')]('UpdateFaxInteraction',_0x4b9627,JSON['stringify'](_0x1da735));_0xc4a5e4(_0x1da735);})[_0x0cb0('0x20')](function(_0x44d16a){logger[_0x0cb0('0x15')](_0x0cb0('0x17'),_0x44d16a[_0x0cb0('0x16')],_0x4b9627);_0x15893c(_0x2653de[_0x0cb0('0x15')](0x1f4,_0x44d16a[_0x0cb0('0x16')]));});});};exports[_0x0cb0('0x21')]=function(_0x3b3b7b){return new Promise(function(_0x313ceb,_0x4be8b4){return db[_0x0cb0('0x18')][_0x0cb0('0x22')]({'where':_0x3b3b7b['options']?_0x3b3b7b[_0x0cb0('0x1b')][_0x0cb0('0x1d')]||null:null})[_0x0cb0('0xe')](function(_0xc34166){if(_0xc34166){return _0xc34166[_0x0cb0('0x23')](_0x3b3b7b['body'][_0x0cb0('0x24')],_['omit'](_0x3b3b7b[_0x0cb0('0x1a')],['ids','id'])||{});}})['spread'](function(_0x30cca3){logger[_0x0cb0('0xf')](_0x0cb0('0x25'),_0x3b3b7b);logger[_0x0cb0('0x12')](_0x0cb0('0x25'),_0x3b3b7b,JSON[_0x0cb0('0x14')](_0x30cca3));_0x313ceb(_0x30cca3);})['catch'](function(_0x4ce285){logger['error'](_0x0cb0('0x25'),_0x4ce285[_0x0cb0('0x16')],_0x3b3b7b);_0x4be8b4(_this[_0x0cb0('0x15')](0x1f4,_0x4ce285['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 94ea9ac..598a704 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 _0x45fe=['save','remove','update','emit','register','faxInteraction:','./faxInteraction.events'];(function(_0x14b767,_0x577e84){var _0x22267a=function(_0xa87ebc){while(--_0xa87ebc){_0x14b767['push'](_0x14b767['shift']());}};_0x22267a(++_0x577e84);}(_0x45fe,0x110));var _0xe45f=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x45fe[_0x33c1b1];return _0x2c2037;};'use strict';var FaxInteractionEvents=require(_0xe45f('0x0'));var events=[_0xe45f('0x1'),_0xe45f('0x2'),_0xe45f('0x3')];function createListener(_0x8588b5,_0x46cd1e){return function(_0xb824a5){_0x46cd1e[_0xe45f('0x4')](_0x8588b5,_0xb824a5);};}function removeListener(_0x51c6b9,_0x406ca0){return function(){FaxInteractionEvents['removeListener'](_0x51c6b9,_0x406ca0);};}exports[_0xe45f('0x5')]=function(_0x3e6cd6){for(var _0x2e7768=0x0,_0x584ef7=events['length'];_0x2e7768<_0x584ef7;_0x2e7768++){var _0x1bd258=events[_0x2e7768];var _0x50a895=createListener(_0xe45f('0x6')+_0x1bd258,_0x3e6cd6);FaxInteractionEvents['on'](_0x1bd258,_0x50a895);}}; \ No newline at end of file +var _0xfeb1=['register','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0xfeb1,0x164));var _0x1feb=function(_0x43cba0,_0x5073a0){_0x43cba0=_0x43cba0-0x0;var _0x31fd30=_0xfeb1[_0x43cba0];return _0x31fd30;};'use strict';var FaxInteractionEvents=require(_0x1feb('0x0'));var events=[_0x1feb('0x1'),_0x1feb('0x2'),_0x1feb('0x3')];function createListener(_0x54c5e9,_0x5708e5){return function(_0x423d83){_0x5708e5['emit'](_0x54c5e9,_0x423d83);};}function removeListener(_0x499096,_0xa83fee){return function(){FaxInteractionEvents['removeListener'](_0x499096,_0xa83fee);};}exports[_0x1feb('0x4')]=function(_0x5c5998){for(var _0x1c82a0=0x0,_0x23c2df=events['length'];_0x1c82a0<_0x23c2df;_0x1c82a0++){var _0x25c1fb=events[_0x1c82a0];var _0x38aa6e=createListener(_0x1feb('0x5')+_0x25c1fb,_0x5c5998);FaxInteractionEvents['on'](_0x25c1fb,_0x38aa6e);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index fa0f211..c5a9e09 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 _0xb4d5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','create','post','/:id/messages','addMessage','/:id/tags','tracked','faxinteraction:addtags','put','fax','faxinteraction:destroy','destroy','delete','removeTags','multer','util','path','express','Router'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xb4d5,0x18e));var _0x5b4d=function(_0xc34024,_0x218f63){_0xc34024=_0xc34024-0x0;var _0x2c9305=_0xb4d5[_0xc34024];return _0x2c9305;};'use strict';var multer=require(_0x5b4d('0x0'));var util=require(_0x5b4d('0x1'));var path=require(_0x5b4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b4d('0x3'));var router=express[_0x5b4d('0x4')]();var fs_extra=require(_0x5b4d('0x5'));var auth=require(_0x5b4d('0x6'));var interaction=require(_0x5b4d('0x7'));var config=require(_0x5b4d('0x8'));var controller=require(_0x5b4d('0x9'));router[_0x5b4d('0xa')]('/',auth['isAuthenticated'](),controller[_0x5b4d('0xb')]);router[_0x5b4d('0xa')](_0x5b4d('0xc'),auth[_0x5b4d('0xd')](),controller[_0x5b4d('0xe')]);router[_0x5b4d('0xa')](_0x5b4d('0xf'),auth[_0x5b4d('0xd')](),controller[_0x5b4d('0x10')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x5b4d('0x11'),auth[_0x5b4d('0xd')](),controller['download']);router['post']('/',auth[_0x5b4d('0xd')](),controller[_0x5b4d('0x12')]);router[_0x5b4d('0x13')](_0x5b4d('0x14'),auth['isAuthenticated'](),controller[_0x5b4d('0x15')]);router[_0x5b4d('0x13')](_0x5b4d('0x16'),auth[_0x5b4d('0xd')](),interaction[_0x5b4d('0x17')]('fax',_0x5b4d('0x18')),controller['addTags']);router[_0x5b4d('0x19')](_0x5b4d('0xf'),auth[_0x5b4d('0xd')](),interaction[_0x5b4d('0x17')]('fax','faxinteraction:update'),controller['update']);router['delete'](_0x5b4d('0xf'),auth[_0x5b4d('0xd')](),interaction[_0x5b4d('0x17')](_0x5b4d('0x1a'),_0x5b4d('0x1b')),controller[_0x5b4d('0x1c')]);router[_0x5b4d('0x1d')](_0x5b4d('0x16'),auth['isAuthenticated'](),controller[_0x5b4d('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xd1d5=['fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router'];(function(_0x2c1db5,_0x4b5f4f){var _0x54bd98=function(_0x536bb6){while(--_0x536bb6){_0x2c1db5['push'](_0x2c1db5['shift']());}};_0x54bd98(++_0x4b5f4f);}(_0xd1d5,0x1eb));var _0x5d1d=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xd1d5[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0x5d1d('0x0'));var util=require(_0x5d1d('0x1'));var path=require(_0x5d1d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d1d('0x3'));var router=express[_0x5d1d('0x4')]();var fs_extra=require(_0x5d1d('0x5'));var auth=require(_0x5d1d('0x6'));var interaction=require(_0x5d1d('0x7'));var config=require('../../config/environment');var controller=require(_0x5d1d('0x8'));router[_0x5d1d('0x9')]('/',auth[_0x5d1d('0xa')](),controller[_0x5d1d('0xb')]);router[_0x5d1d('0x9')](_0x5d1d('0xc'),auth[_0x5d1d('0xa')](),controller[_0x5d1d('0xd')]);router['get'](_0x5d1d('0xe'),auth[_0x5d1d('0xa')](),controller['show']);router[_0x5d1d('0x9')](_0x5d1d('0xf'),auth[_0x5d1d('0xa')](),controller[_0x5d1d('0x10')]);router[_0x5d1d('0x9')]('/:id/download',auth[_0x5d1d('0xa')](),controller[_0x5d1d('0x11')]);router[_0x5d1d('0x12')]('/',auth[_0x5d1d('0xa')](),controller['create']);router['post'](_0x5d1d('0xf'),auth[_0x5d1d('0xa')](),controller['addMessage']);router[_0x5d1d('0x12')](_0x5d1d('0x13'),auth['isAuthenticated'](),interaction[_0x5d1d('0x14')](_0x5d1d('0x15'),'faxinteraction:addtags'),controller[_0x5d1d('0x16')]);router[_0x5d1d('0x17')]('/:id',auth[_0x5d1d('0xa')](),interaction[_0x5d1d('0x14')](_0x5d1d('0x15'),_0x5d1d('0x18')),controller[_0x5d1d('0x19')]);router[_0x5d1d('0x1a')]('/:id',auth[_0x5d1d('0xa')](),interaction[_0x5d1d('0x14')](_0x5d1d('0x15'),_0x5d1d('0x1b')),controller[_0x5d1d('0x1c')]);router[_0x5d1d('0x1a')](_0x5d1d('0x13'),auth[_0x5d1d('0xa')](),controller[_0x5d1d('0x1d')]);module[_0x5d1d('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 8b05069..812612c 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 _0xb201=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x594d91,_0x1f8aac){var _0x52b0bf=function(_0x54fcbb){while(--_0x54fcbb){_0x594d91['push'](_0x594d91['shift']());}};_0x52b0bf(++_0x1f8aac);}(_0xb201,0x1b1));var _0x1b20=function(_0x4d8e6c,_0x14437c){_0x4d8e6c=_0x4d8e6c-0x0;var _0x5116f5=_0xb201[_0x4d8e6c];return _0x5116f5;};'use strict';var Sequelize=require(_0x1b20('0x0'));module['exports']={'body':{'type':Sequelize[_0x1b20('0x1')](_0x1b20('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1b20('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1b20('0x4')]('in',_0x1b20('0x5')),'defaultValue':_0x1b20('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x1b20('0x6')]}}; \ No newline at end of file +var _0x1d25=['medium','BOOLEAN','out','DATE','sequelize','exports','TEXT'];(function(_0xce2d7e,_0x56dac4){var _0x3143d9=function(_0x52633b){while(--_0x52633b){_0xce2d7e['push'](_0xce2d7e['shift']());}};_0x3143d9(++_0x56dac4);}(_0x1d25,0xba));var _0x51d2=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x1d25[_0x2ab3d9];return _0x210a54;};'use strict';var Sequelize=require(_0x51d2('0x0'));module[_0x51d2('0x1')]={'body':{'type':Sequelize[_0x51d2('0x2')](_0x51d2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x51d2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x51d2('0x5')),'defaultValue':_0x51d2('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x51d2('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3d65ac4..e142bd5 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 _0x4c25=['request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','FaxMessage','includeAll','include','findAll','rows','show','fields','body','find','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','contact','fullname','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http'];(function(_0x4c3b95,_0x306093){var _0x1dced6=function(_0x1c4339){while(--_0x1c4339){_0x4c3b95['push'](_0x4c3b95['shift']());}};_0x1dced6(++_0x306093);}(_0x4c25,0x196));var _0x54c2=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x4c25[_0x39f375];return _0x463f93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54c2('0x1'));var rp=require('request-promise');var moment=require(_0x54c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x54c2('0x3'));var util=require(_0x54c2('0x4'));var path=require(_0x54c2('0x5'));var sox=require(_0x54c2('0x6'));var csv=require(_0x54c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54c2('0x8'));var _=require(_0x54c2('0x9'));var squel=require(_0x54c2('0xa'));var crypto=require(_0x54c2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x54c2('0x7'));var querystring=require(_0x54c2('0xc'));var Papa=require('papaparse');var Redis=require(_0x54c2('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54c2('0xe'));var logger=require(_0x54c2('0xf'))(_0x54c2('0x10'));var utils=require('../../config/utils');var config=require(_0x54c2('0x11'));var licenseUtil=require(_0x54c2('0x12'));var db=require(_0x54c2('0x13'))['db'];config['redis']=_[_0x54c2('0x14')](config[_0x54c2('0x15')],{'host':_0x54c2('0x16'),'port':0x18eb});var socket=require(_0x54c2('0x17'))(new Redis(config[_0x54c2('0x15')]));require(_0x54c2('0x18'))[_0x54c2('0x19')](socket);var jayson=require(_0x54c2('0x1a'));var client=jayson[_0x54c2('0x1b')][_0x54c2('0x1c')]({'port':0x232c});var client9002=jayson[_0x54c2('0x1b')][_0x54c2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2de742,_0x2e77c0,_0xe1ea3d,_0x47376f){return new BPromise(function(_0x111168,_0x39362d){var _0x43d829=_0x47376f||client;return _0x43d829[_0x54c2('0x1d')](_0x2de742,_0xe1ea3d)[_0x54c2('0x1e')](function(_0x4d773a){logger[_0x54c2('0x1f')](_0x54c2('0x20'),_0x2e77c0,'request\x20sent');logger[_0x54c2('0x21')](_0x54c2('0x22'),_0x2e77c0,_0x54c2('0x23'),JSON[_0x54c2('0x24')](_0x4d773a));if(_0x4d773a[_0x54c2('0x25')]){if(_0x4d773a[_0x54c2('0x25')]['code']===0x1f4){logger[_0x54c2('0x25')](_0x54c2('0x20'),_0x2e77c0,_0x4d773a['error'][_0x54c2('0x26')]);return _0x39362d(_0x4d773a[_0x54c2('0x25')][_0x54c2('0x26')]);}logger['error'](_0x54c2('0x20'),_0x2e77c0,_0x4d773a[_0x54c2('0x25')][_0x54c2('0x26')]);return _0x111168(_0x4d773a['error']['message']);}else{logger[_0x54c2('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x2e77c0,'request\x20sent');_0x111168(_0x4d773a[_0x54c2('0x27')][_0x54c2('0x26')]);}})[_0x54c2('0x28')](function(_0x5d2432){logger[_0x54c2('0x25')](_0x54c2('0x20'),_0x2e77c0,_0x5d2432);_0x39362d(_0x5d2432);});});}function respondWithStatusCode(_0x4f275f,_0x592e38){_0x592e38=_0x592e38||0xcc;return function(_0x704632){if(_0x704632){return _0x4f275f[_0x54c2('0x29')](_0x592e38);}return _0x4f275f[_0x54c2('0x2a')](_0x592e38)[_0x54c2('0x2b')]();};}function respondWithResult(_0x10bc48,_0x21353b){_0x21353b=_0x21353b||0xc8;return function(_0x37123e){if(_0x37123e){return _0x10bc48['status'](_0x21353b)['json'](_0x37123e);}};}function respondWithFilteredResult(_0x294f9d,_0x59aabe){return function(_0x1c4c37){if(_0x1c4c37){var _0x3561fe=typeof _0x59aabe[_0x54c2('0x2c')]===_0x54c2('0x2d')&&typeof _0x59aabe[_0x54c2('0x2e')]===_0x54c2('0x2d');var _0x3221a5=_0x1c4c37[_0x54c2('0x2f')];var _0x13447a=_0x3561fe?0x0:_0x59aabe[_0x54c2('0x2c')];var _0x1fc70e=_0x3561fe?_0x1c4c37[_0x54c2('0x2f')]:_0x59aabe[_0x54c2('0x2c')]+_0x59aabe['limit'];var _0x5795d3;if(_0x1fc70e>=_0x3221a5){_0x1fc70e=_0x3221a5;_0x5795d3=0xc8;}else{_0x5795d3=0xce;}_0x294f9d[_0x54c2('0x2a')](_0x5795d3);return _0x294f9d[_0x54c2('0x30')](_0x54c2('0x31'),_0x13447a+'-'+_0x1fc70e+'/'+_0x3221a5)['json'](_0x1c4c37);}return null;};}function patchUpdates(_0xc89415){return function(_0x57386d){try{jsonpatch[_0x54c2('0x32')](_0x57386d,_0xc89415,!![]);}catch(_0x59d344){return BPromise[_0x54c2('0x33')](_0x59d344);}return _0x57386d[_0x54c2('0x34')]();};}function saveUpdates(_0x4a8586,_0x3d3f5e){return function(_0x4c972e){if(_0x4c972e){return _0x4c972e[_0x54c2('0x35')](_0x4a8586)['then'](function(_0xef48af){return _0xef48af;});}return null;};}function removeEntity(_0x467fdf,_0x2f7145){return function(_0x10360f){if(_0x10360f){return _0x10360f[_0x54c2('0x36')]()[_0x54c2('0x1e')](function(){_0x467fdf[_0x54c2('0x2a')](0xcc)[_0x54c2('0x2b')]();});}};}function handleEntityNotFound(_0x16e49f,_0x50382e){return function(_0x12badc){if(!_0x12badc){_0x16e49f[_0x54c2('0x29')](0x194);}return _0x12badc;};}function handleError(_0x481fb2,_0x3bc2da){_0x3bc2da=_0x3bc2da||0x1f4;return function(_0x5e4ddb){logger[_0x54c2('0x25')](_0x5e4ddb[_0x54c2('0x37')]);if(_0x5e4ddb[_0x54c2('0x38')]){delete _0x5e4ddb[_0x54c2('0x38')];}_0x481fb2[_0x54c2('0x2a')](_0x3bc2da)['send'](_0x5e4ddb);};}exports[_0x54c2('0x39')]=function(_0x1c566d,_0x21c899){var _0x4d5133={},_0x19c3d7={},_0x106825={'count':0x0,'rows':[]};var _0x3872e6=_[_0x54c2('0x3a')](db['FaxMessage'][_0x54c2('0x3b')],function(_0x5ca8dd){return{'name':_0x5ca8dd[_0x54c2('0x3c')],'type':_0x5ca8dd[_0x54c2('0x3d')][_0x54c2('0x3e')]};});_0x19c3d7[_0x54c2('0x3f')]=_[_0x54c2('0x3a')](_0x3872e6,'name');_0x19c3d7[_0x54c2('0x40')]=_[_0x54c2('0x41')](_0x1c566d[_0x54c2('0x40')]);_0x19c3d7[_0x54c2('0x42')]=_[_0x54c2('0x43')](_0x19c3d7['model'],_0x19c3d7[_0x54c2('0x40')]);_0x4d5133[_0x54c2('0x44')]=_[_0x54c2('0x43')](_0x19c3d7[_0x54c2('0x3f')],qs['fields'](_0x1c566d[_0x54c2('0x40')]['fields']));_0x4d5133[_0x54c2('0x44')]=_0x4d5133['attributes'][_0x54c2('0x45')]?_0x4d5133['attributes']:_0x19c3d7[_0x54c2('0x3f')];if(!_0x1c566d[_0x54c2('0x40')][_0x54c2('0x46')]('nolimit')){_0x4d5133['limit']=qs['limit'](_0x1c566d[_0x54c2('0x40')][_0x54c2('0x2e')]);_0x4d5133[_0x54c2('0x2c')]=qs[_0x54c2('0x2c')](_0x1c566d['query']['offset']);}_0x4d5133[_0x54c2('0x47')]=qs[_0x54c2('0x48')](_0x1c566d[_0x54c2('0x40')][_0x54c2('0x48')]);_0x4d5133['where']=qs['filters'](_[_0x54c2('0x49')](_0x1c566d[_0x54c2('0x40')],_0x19c3d7['filters']),_0x3872e6);if(_0x1c566d[_0x54c2('0x40')][_0x54c2('0x4a')]){_0x4d5133['where']=_[_0x54c2('0x4b')](_0x4d5133['where'],{'$or':_[_0x54c2('0x3a')](_0x3872e6,function(_0x5a1880){if(_0x5a1880[_0x54c2('0x3d')]!==_0x54c2('0x4c')){var _0x4410a6={};_0x4410a6[_0x5a1880[_0x54c2('0x38')]]={'$like':'%'+_0x1c566d[_0x54c2('0x40')][_0x54c2('0x4a')]+'%'};return _0x4410a6;}})});}_0x4d5133=_[_0x54c2('0x4b')]({},_0x4d5133,_0x1c566d[_0x54c2('0x4d')]);var _0x5c7dd8={'where':_0x4d5133[_0x54c2('0x4e')]};return db[_0x54c2('0x4f')][_0x54c2('0x2f')](_0x5c7dd8)[_0x54c2('0x1e')](function(_0x388693){_0x106825['count']=_0x388693;if(_0x1c566d[_0x54c2('0x40')][_0x54c2('0x50')]){_0x4d5133[_0x54c2('0x51')]=[{'all':!![]}];}return db[_0x54c2('0x4f')][_0x54c2('0x52')](_0x4d5133);})[_0x54c2('0x1e')](function(_0x24b131){_0x106825[_0x54c2('0x53')]=_0x24b131;return _0x106825;})[_0x54c2('0x1e')](respondWithFilteredResult(_0x21c899,_0x4d5133))[_0x54c2('0x28')](handleError(_0x21c899,null));};exports[_0x54c2('0x54')]=function(_0x54c193,_0x599907){var _0x2d629c={'raw':!![],'where':{'id':_0x54c193['params']['id']}},_0x47a64a={};_0x47a64a['model']=_[_0x54c2('0x41')](db[_0x54c2('0x4f')][_0x54c2('0x3b')]);_0x47a64a[_0x54c2('0x40')]=_[_0x54c2('0x41')](_0x54c193[_0x54c2('0x40')]);_0x47a64a[_0x54c2('0x42')]=_[_0x54c2('0x43')](_0x47a64a[_0x54c2('0x3f')],_0x47a64a['query']);_0x2d629c[_0x54c2('0x44')]=_[_0x54c2('0x43')](_0x47a64a[_0x54c2('0x3f')],qs[_0x54c2('0x55')](_0x54c193[_0x54c2('0x40')][_0x54c2('0x55')]));_0x2d629c['attributes']=_0x2d629c['attributes']['length']?_0x2d629c[_0x54c2('0x44')]:_0x47a64a[_0x54c2('0x3f')];if(_0x54c193[_0x54c2('0x40')][_0x54c2('0x50')]){_0x2d629c['include']=[{'all':!![]}];}_0x2d629c=_[_0x54c2('0x4b')]({},_0x2d629c,_0x54c193[_0x54c2('0x4d')]);return db[_0x54c2('0x4f')]['find'](_0x2d629c)[_0x54c2('0x1e')](handleEntityNotFound(_0x599907,null))[_0x54c2('0x1e')](respondWithResult(_0x599907,null))[_0x54c2('0x28')](handleError(_0x599907,null));};exports[_0x54c2('0x35')]=function(_0x34986e,_0x166e7a){if(_0x34986e[_0x54c2('0x56')]['id']){delete _0x34986e[_0x54c2('0x56')]['id'];}return db[_0x54c2('0x4f')][_0x54c2('0x57')]({'where':{'id':_0x34986e['params']['id']}})[_0x54c2('0x1e')](handleEntityNotFound(_0x166e7a,null))[_0x54c2('0x1e')](saveUpdates(_0x34986e[_0x54c2('0x56')],null))[_0x54c2('0x1e')](respondWithResult(_0x166e7a,null))[_0x54c2('0x28')](handleError(_0x166e7a,null));};exports[_0x54c2('0x36')]=function(_0x167a49,_0x165fd3){return db[_0x54c2('0x4f')]['find']({'where':{'id':_0x167a49[_0x54c2('0x58')]['id']}})[_0x54c2('0x1e')](handleEntityNotFound(_0x165fd3,null))[_0x54c2('0x1e')](removeEntity(_0x165fd3,null))[_0x54c2('0x28')](handleError(_0x165fd3,null));};exports[_0x54c2('0x59')]=function(_0x19cf53,_0x573074){return db['FaxMessage'][_0x54c2('0x59')]()['then'](respondWithResult(_0x573074,null))[_0x54c2('0x28')](handleError(_0x573074,null));};var interaction_log=require(_0x54c2('0xf'))(_0x54c2('0x5a'));exports[_0x54c2('0x5b')]=function(_0x5f3d03,_0x391982,_0x3380f2){var _0x574254={'agent':{},'channel':_0x54c2('0x5c')};if(_0x5f3d03['body']['id']){delete _0x5f3d03['body']['id'];}_0x5f3d03[_0x54c2('0x56')][_0x54c2('0x5d')]=!![];_0x5f3d03[_0x54c2('0x56')][_0x54c2('0x5e')]=moment()[_0x54c2('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f3d03[_0x54c2('0x56')][_0x54c2('0x60')]=_0x5f3d03['body'][_0x54c2('0x60')]||_0x5f3d03[_0x54c2('0x61')]['id'];_0x574254[_0x54c2('0x62')]['id']=_0x5f3d03[_0x54c2('0x56')][_0x54c2('0x60')];return db[_0x54c2('0x4f')]['find']({'where':{'id':_0x5f3d03[_0x54c2('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x391982,null))[_0x54c2('0x1e')](saveUpdates(_0x5f3d03[_0x54c2('0x56')],null))[_0x54c2('0x1e')](function(_0x413d13){if(_0x413d13){_0x574254[_0x54c2('0x26')]=_0x413d13[_0x54c2('0x63')]({'plain':!![]});return db[_0x54c2('0x64')]['find']({'where':{'id':_0x413d13[_0x54c2('0x65')]}});}return null;})[_0x54c2('0x1e')](handleEntityNotFound(_0x391982,null))[_0x54c2('0x1e')](function(_0x4cd952){if(_0x4cd952){return _0x4cd952[_0x54c2('0x35')]({'UserId':_0x5f3d03['body'][_0x54c2('0x60')],'read1stAt':_['isNil'](_0x4cd952['read1stAt'])?moment()[_0x54c2('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x54c2('0x1e')](function(_0x3dfef7){if(_0x3dfef7){_0x574254[_0x54c2('0x66')]=_0x3dfef7[_0x54c2('0x63')]({'plain':!![]});interaction_log[_0x54c2('0x1f')](_0x54c2('0x67'),_0x5f3d03[_0x54c2('0x61')]['id'],_0x5f3d03['user'][_0x54c2('0x38')],_0x5f3d03[_0x54c2('0x61')][_0x54c2('0x68')],_0x574254[_0x54c2('0x66')]['id'],_0x5f3d03['body']?JSON[_0x54c2('0x24')](_0x5f3d03[_0x54c2('0x56')]):'null');return respondWithRpcPromise(_0x54c2('0x69'),_0x54c2('0x6a'),_0x574254);}return null;})[_0x54c2('0x1e')](function(_0x2afeb5){var _0x36577b=_0x54c2('0x6b')+_0x2afeb5[_0x54c2('0x26')][_0x54c2('0x6c')];return db[_0x54c2('0x6d')][_0x54c2('0x40')](_0x36577b,{'type':db[_0x54c2('0x6e')][_0x54c2('0x6f')][_0x54c2('0x70')],'raw':!![]})[_0x54c2('0x1e')](function(_0x957682){return _0x957682;});})[_0x54c2('0x1e')](function(_0x374638){if(_0x374638){_0x574254[_0x54c2('0x26')]['contact']=_0x374638[0x0];if(!_0x5f3d03[_0x54c2('0x56')][_0x54c2('0x60')])return;return db[_0x54c2('0x71')][_0x54c2('0x57')]({'where':{'id':_0x5f3d03['body'][_0x54c2('0x60')],'role':'agent'},'attributes':['id',_0x54c2('0x38'),'fullname',_0x54c2('0x72'),_0x54c2('0x73')],'raw':!![]});}return null;})[_0x54c2('0x1e')](function(_0x5208b2){if(!_0x5208b2)return null;_0x574254[_0x54c2('0x26')][_0x54c2('0x62')]=_0x5208b2;return _0x574254;})[_0x54c2('0x1e')](function(_0x46db5f){if(_0x46db5f){if(_0x5f3d03[_0x54c2('0x56')]['manual']){_0x574254[_0x54c2('0x26')][_0x54c2('0x74')]=util[_0x54c2('0x5f')](_0x54c2('0x75'),_0x5f3d03['user']['name']);_0x574254[_0x54c2('0x26')][_0x54c2('0x76')]=_0x574254[_0x54c2('0x76')];_0x574254[_0x54c2('0x26')][_0x54c2('0x77')]=_0x574254[_0x54c2('0x76')];_0x574254[_0x54c2('0x26')][_0x54c2('0x78')]='accept';return respondWithRpcPromise(_0x54c2('0x79'),_0x54c2('0x79'),{'event':_0x54c2('0x7a'),'message':_0x574254[_0x54c2('0x26')]},client9002)[_0x54c2('0x1e')](function(){return _0x574254;});}return _0x574254;}return null;})['then'](respondWithResult(_0x391982,null))['catch'](handleError(_0x391982,null));};var interaction_log=require(_0x54c2('0xf'))(_0x54c2('0x5a'));exports[_0x54c2('0x33')]=function(_0x212d68,_0x130143,_0x3c3f61){var _0xc06114={'agent':{},'channel':_0x54c2('0x5c')};if(_0x212d68['body']['id']){delete _0x212d68['body']['id'];}_0x212d68[_0x54c2('0x56')]['UserId']=_0x212d68[_0x54c2('0x56')][_0x54c2('0x60')]||_0x212d68[_0x54c2('0x61')]['id'];_0xc06114[_0x54c2('0x62')]['id']=_0x212d68[_0x54c2('0x56')][_0x54c2('0x60')];return db[_0x54c2('0x4f')]['find']({'where':{'id':_0x212d68[_0x54c2('0x58')]['id'],'UserId':null}})[_0x54c2('0x1e')](handleEntityNotFound(_0x130143,null))['then'](function(_0x186f2e){if(_0x186f2e){_0xc06114[_0x54c2('0x26')]=_0x186f2e['get']({'plain':!![]});return db[_0x54c2('0x64')][_0x54c2('0x57')]({'where':{'id':_0x186f2e[_0x54c2('0x65')]}});}return null;})[_0x54c2('0x1e')](handleEntityNotFound(_0x130143,null))[_0x54c2('0x1e')](function(_0x51d2b1){if(_0x51d2b1){_0xc06114[_0x54c2('0x66')]=_0x51d2b1['get']({'plain':!![]});interaction_log[_0x54c2('0x1f')](_0x54c2('0x7b'),_0x212d68[_0x54c2('0x61')]['id'],_0x212d68[_0x54c2('0x61')][_0x54c2('0x38')],_0x212d68[_0x54c2('0x61')][_0x54c2('0x68')],_0xc06114['interaction']['id'],_0x212d68[_0x54c2('0x56')]?JSON['stringify'](_0x212d68['body']):_0x54c2('0x7c'));return respondWithRpcPromise(_0x54c2('0x7d'),_0x54c2('0x7e'),_0xc06114);}return null;})[_0x54c2('0x1e')](function(_0x17342c){var _0x233b85=_0x54c2('0x6b')+_0x17342c[_0x54c2('0x26')]['ContactId'];return db[_0x54c2('0x6d')][_0x54c2('0x40')](_0x233b85,{'type':db[_0x54c2('0x6e')][_0x54c2('0x6f')][_0x54c2('0x70')],'raw':!![]})[_0x54c2('0x1e')](function(_0x4f4ef8){return _0x4f4ef8;});})[_0x54c2('0x1e')](function(_0x8e05d){if(_0x8e05d){_0xc06114[_0x54c2('0x26')][_0x54c2('0x7f')]=_0x8e05d[0x0];if(!_0x212d68['body'][_0x54c2('0x60')])return;return db[_0x54c2('0x71')][_0x54c2('0x57')]({'where':{'id':_0x212d68[_0x54c2('0x56')][_0x54c2('0x60')],'role':_0x54c2('0x62')},'attributes':['id','name',_0x54c2('0x80'),_0x54c2('0x72'),_0x54c2('0x73')],'raw':!![]});}return null;})[_0x54c2('0x1e')](function(_0x3ad778){if(!_0x3ad778)return null;_0xc06114[_0x54c2('0x26')]['agent']=_0x3ad778;return _0xc06114;})[_0x54c2('0x1e')](function(_0x222cb4){if(_0x222cb4){_0x222cb4[_0x54c2('0x26')]['interface']=util['format'](_0x54c2('0x75'),_0x212d68[_0x54c2('0x61')][_0x54c2('0x38')]);_0x222cb4['message'][_0x54c2('0x76')]=_0xc06114[_0x54c2('0x76')];_0x222cb4['message']['motionChannel']=_0xc06114[_0x54c2('0x76')];_0x222cb4[_0x54c2('0x26')][_0x54c2('0x78')]=_0x54c2('0x33');respondWithRpcPromise('EventManager',_0x54c2('0x79'),{'event':_0x54c2('0x81'),'message':_0x222cb4[_0x54c2('0x26')]},client9002);return _0xc06114;}return null;})[_0x54c2('0x1e')](respondWithResult(_0x130143,null))[_0x54c2('0x28')](handleError(_0x130143,null));};exports[_0x54c2('0x82')]=function(_0x575dcb,_0x3ecd3c){var _0x1374dc;return db[_0x54c2('0x4f')][_0x54c2('0x82')](_0x575dcb[_0x54c2('0x56')],{})['then'](function(_0x164d07){_0x1374dc=_0x164d07;return db[_0x54c2('0x83')][_0x54c2('0x84')]({'where':{'id':_0x1374dc['ContactId']}});})[_0x54c2('0x1e')](function(_0x294cdb){if(_[_0x54c2('0x85')](_0x294cdb)){return;}else{_0x1374dc['fax']=_0x294cdb[_0x54c2('0x5c')];return db['Attachment'][_0x54c2('0x84')]({'where':{'id':_0x1374dc[_0x54c2('0x86')]}});}})[_0x54c2('0x1e')](function(_0x4dc8fe){return respondWithRpcPromise(_0x54c2('0x87'),'SendFax',{'FaxAccountId':_[_0x54c2('0x85')](_0x575dcb[_0x54c2('0x56')])?undefined:_0x575dcb[_0x54c2('0x56')]['FaxAccountId'],'path':_[_0x54c2('0x85')](_0x4dc8fe)?undefined:util[_0x54c2('0x5f')](_0x54c2('0x88'),_0x4dc8fe[_0x54c2('0x89')]),'fax':_[_0x54c2('0x85')](_0x1374dc[_0x54c2('0x5c')])?undefined:_0x1374dc['fax'],'AttachmentId':_0x1374dc[_0x54c2('0x86')]},client9002);})['then'](respondWithResult(_0x3ecd3c,0xc9))[_0x54c2('0x28')](handleError(_0x3ecd3c,null));};exports[_0x54c2('0x8a')]=function(_0x51d573,_0xfacfe8){var _0x4e8a7a=path[_0x54c2('0x8b')](config[_0x54c2('0x8c')],_0x54c2('0x8d'),_0x54c2('0x8e'),_0x54c2('0x8f'));return db[_0x54c2('0x4f')]['find']({'where':{'id':_0x51d573[_0x54c2('0x58')]['id']},'include':[{'model':db[_0x54c2('0x90')],'as':'Attachment'}]})[_0x54c2('0x1e')](handleEntityNotFound(_0xfacfe8,null))[_0x54c2('0x1e')](function(_0x14ac3e){if(_0x14ac3e){return _0xfacfe8[_0x54c2('0x8a')](path[_0x54c2('0x8b')](_0x4e8a7a,_0x14ac3e[_0x54c2('0x90')][_0x54c2('0x89')]));}})[_0x54c2('0x28')](handleError(_0xfacfe8,null));}; \ No newline at end of file +var _0x599f=['query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','params','body','find','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','read1stAt','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','SELECT','fullname','email','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','server','attachments','Attachment','join','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x282a1e,_0x4dd4db){var _0x460b6c=function(_0xe99af3){while(--_0xe99af3){_0x282a1e['push'](_0x282a1e['shift']());}};_0x460b6c(++_0x4dd4db);}(_0x599f,0xdd));var _0xf599=function(_0x2a7d15,_0x56204e){_0x2a7d15=_0x2a7d15-0x0;var _0x442dda=_0x599f[_0x2a7d15];return _0x442dda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf599('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf599('0x1'));var moment=require(_0xf599('0x2'));var BPromise=require(_0xf599('0x3'));var Mustache=require(_0xf599('0x4'));var util=require(_0xf599('0x5'));var path=require('path');var sox=require(_0xf599('0x6'));var csv=require(_0xf599('0x7'));var ejs=require(_0xf599('0x8'));var fs=require('fs');var fs_extra=require(_0xf599('0x9'));var _=require(_0xf599('0xa'));var squel=require(_0xf599('0xb'));var crypto=require(_0xf599('0xc'));var jsforce=require(_0xf599('0xd'));var deskjs=require(_0xf599('0xe'));var toCsv=require(_0xf599('0x7'));var querystring=require('querystring');var Papa=require(_0xf599('0xf'));var Redis=require(_0xf599('0x10'));var authService=require(_0xf599('0x11'));var qs=require(_0xf599('0x12'));var as=require(_0xf599('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf599('0x14'))(_0xf599('0x15'));var utils=require(_0xf599('0x16'));var config=require(_0xf599('0x17'));var licenseUtil=require(_0xf599('0x18'));var db=require(_0xf599('0x19'))['db'];config[_0xf599('0x1a')]=_[_0xf599('0x1b')](config[_0xf599('0x1a')],{'host':_0xf599('0x1c'),'port':0x18eb});var socket=require(_0xf599('0x1d'))(new Redis(config['redis']));require(_0xf599('0x1e'))[_0xf599('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf599('0x20')][_0xf599('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xf599('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xb9c856,_0x4772e0,_0x25abff,_0x4ad5cb){return new BPromise(function(_0x1b856f,_0x291368){var _0x40f1ab=_0x4ad5cb||client;return _0x40f1ab[_0xf599('0x22')](_0xb9c856,_0x25abff)['then'](function(_0x1798c2){logger[_0xf599('0x23')](_0xf599('0x24'),_0x4772e0,_0xf599('0x25'));logger[_0xf599('0x26')](_0xf599('0x27'),_0x4772e0,'request\x20sent',JSON[_0xf599('0x28')](_0x1798c2));if(_0x1798c2[_0xf599('0x29')]){if(_0x1798c2[_0xf599('0x29')][_0xf599('0x2a')]===0x1f4){logger[_0xf599('0x29')](_0xf599('0x24'),_0x4772e0,_0x1798c2['error'][_0xf599('0x2b')]);return _0x291368(_0x1798c2['error'][_0xf599('0x2b')]);}logger[_0xf599('0x29')](_0xf599('0x24'),_0x4772e0,_0x1798c2['error']['message']);return _0x1b856f(_0x1798c2[_0xf599('0x29')][_0xf599('0x2b')]);}else{logger[_0xf599('0x23')](_0xf599('0x24'),_0x4772e0,_0xf599('0x25'));_0x1b856f(_0x1798c2[_0xf599('0x2c')]['message']);}})[_0xf599('0x2d')](function(_0x5a897c){logger[_0xf599('0x29')]('FaxMessage,\x20%s,\x20%s',_0x4772e0,_0x5a897c);_0x291368(_0x5a897c);});});}function respondWithStatusCode(_0x4cde00,_0x3c2c8b){_0x3c2c8b=_0x3c2c8b||0xcc;return function(_0x3e3f84){if(_0x3e3f84){return _0x4cde00[_0xf599('0x2e')](_0x3c2c8b);}return _0x4cde00[_0xf599('0x2f')](_0x3c2c8b)[_0xf599('0x30')]();};}function respondWithResult(_0x241795,_0x4ee6ab){_0x4ee6ab=_0x4ee6ab||0xc8;return function(_0x52af80){if(_0x52af80){return _0x241795[_0xf599('0x2f')](_0x4ee6ab)[_0xf599('0x31')](_0x52af80);}};}function respondWithFilteredResult(_0x341680,_0x35d273){return function(_0xd4f868){if(_0xd4f868){var _0x33d718=typeof _0x35d273[_0xf599('0x32')]===_0xf599('0x33')&&typeof _0x35d273[_0xf599('0x34')]===_0xf599('0x33');var _0x45f72c=_0xd4f868[_0xf599('0x35')];var _0x11d7cf=_0x33d718?0x0:_0x35d273[_0xf599('0x32')];var _0x8770ca=_0x33d718?_0xd4f868['count']:_0x35d273['offset']+_0x35d273['limit'];var _0x100dd2;if(_0x8770ca>=_0x45f72c){_0x8770ca=_0x45f72c;_0x100dd2=0xc8;}else{_0x100dd2=0xce;}_0x341680['status'](_0x100dd2);return _0x341680['set'](_0xf599('0x36'),_0x11d7cf+'-'+_0x8770ca+'/'+_0x45f72c)[_0xf599('0x31')](_0xd4f868);}return null;};}function patchUpdates(_0x1398bd){return function(_0x4124e5){try{jsonpatch[_0xf599('0x37')](_0x4124e5,_0x1398bd,!![]);}catch(_0x14fbdc){return BPromise[_0xf599('0x38')](_0x14fbdc);}return _0x4124e5[_0xf599('0x39')]();};}function saveUpdates(_0x379d3d,_0x708891){return function(_0x5d6217){if(_0x5d6217){return _0x5d6217[_0xf599('0x3a')](_0x379d3d)[_0xf599('0x3b')](function(_0x4458d3){return _0x4458d3;});}return null;};}function removeEntity(_0x2f890b,_0xd5e6c5){return function(_0x3bd916){if(_0x3bd916){return _0x3bd916[_0xf599('0x3c')]()[_0xf599('0x3b')](function(){_0x2f890b['status'](0xcc)[_0xf599('0x30')]();});}};}function handleEntityNotFound(_0x3d3635,_0x4cdc76){return function(_0x515221){if(!_0x515221){_0x3d3635[_0xf599('0x2e')](0x194);}return _0x515221;};}function handleError(_0x487f6c,_0x155b8e){_0x155b8e=_0x155b8e||0x1f4;return function(_0x2c9265){logger['error'](_0x2c9265[_0xf599('0x3d')]);if(_0x2c9265['name']){delete _0x2c9265[_0xf599('0x3e')];}_0x487f6c[_0xf599('0x2f')](_0x155b8e)[_0xf599('0x3f')](_0x2c9265);};}exports[_0xf599('0x40')]=function(_0x51c8ed,_0x20dea8){var _0x58ded9={},_0x447ca8={},_0x2c0106={'count':0x0,'rows':[]};var _0x85477d=_[_0xf599('0x41')](db['FaxMessage'][_0xf599('0x42')],function(_0x3d04a9){return{'name':_0x3d04a9[_0xf599('0x43')],'type':_0x3d04a9[_0xf599('0x44')][_0xf599('0x45')]};});_0x447ca8[_0xf599('0x46')]=_['map'](_0x85477d,_0xf599('0x3e'));_0x447ca8[_0xf599('0x47')]=_[_0xf599('0x48')](_0x51c8ed[_0xf599('0x47')]);_0x447ca8['filters']=_[_0xf599('0x49')](_0x447ca8[_0xf599('0x46')],_0x447ca8[_0xf599('0x47')]);_0x58ded9[_0xf599('0x4a')]=_[_0xf599('0x49')](_0x447ca8[_0xf599('0x46')],qs[_0xf599('0x4b')](_0x51c8ed['query'][_0xf599('0x4b')]));_0x58ded9[_0xf599('0x4a')]=_0x58ded9[_0xf599('0x4a')][_0xf599('0x4c')]?_0x58ded9[_0xf599('0x4a')]:_0x447ca8['model'];if(!_0x51c8ed[_0xf599('0x47')]['hasOwnProperty'](_0xf599('0x4d'))){_0x58ded9[_0xf599('0x34')]=qs[_0xf599('0x34')](_0x51c8ed[_0xf599('0x47')][_0xf599('0x34')]);_0x58ded9[_0xf599('0x32')]=qs[_0xf599('0x32')](_0x51c8ed[_0xf599('0x47')][_0xf599('0x32')]);}_0x58ded9[_0xf599('0x4e')]=qs['sort'](_0x51c8ed['query']['sort']);_0x58ded9[_0xf599('0x4f')]=qs[_0xf599('0x50')](_[_0xf599('0x51')](_0x51c8ed[_0xf599('0x47')],_0x447ca8['filters']),_0x85477d);if(_0x51c8ed[_0xf599('0x47')][_0xf599('0x52')]){_0x58ded9[_0xf599('0x4f')]=_[_0xf599('0x53')](_0x58ded9[_0xf599('0x4f')],{'$or':_[_0xf599('0x41')](_0x85477d,function(_0x4092c8){if(_0x4092c8[_0xf599('0x44')]!==_0xf599('0x54')){var _0x1f4570={};_0x1f4570[_0x4092c8[_0xf599('0x3e')]]={'$like':'%'+_0x51c8ed[_0xf599('0x47')][_0xf599('0x52')]+'%'};return _0x1f4570;}})});}_0x58ded9=_[_0xf599('0x53')]({},_0x58ded9,_0x51c8ed[_0xf599('0x55')]);var _0x30494b={'where':_0x58ded9[_0xf599('0x4f')]};return db[_0xf599('0x56')][_0xf599('0x35')](_0x30494b)['then'](function(_0x5bfe8d){_0x2c0106['count']=_0x5bfe8d;if(_0x51c8ed[_0xf599('0x47')][_0xf599('0x57')]){_0x58ded9[_0xf599('0x58')]=[{'all':!![]}];}return db[_0xf599('0x56')][_0xf599('0x59')](_0x58ded9);})['then'](function(_0x2c6e77){_0x2c0106['rows']=_0x2c6e77;return _0x2c0106;})[_0xf599('0x3b')](respondWithFilteredResult(_0x20dea8,_0x58ded9))[_0xf599('0x2d')](handleError(_0x20dea8,null));};exports['show']=function(_0x31ad37,_0x14b9a6){var _0x1e74a3={'raw':!![],'where':{'id':_0x31ad37[_0xf599('0x5a')]['id']}},_0x55e722={};_0x55e722[_0xf599('0x46')]=_[_0xf599('0x48')](db['FaxMessage'][_0xf599('0x42')]);_0x55e722['query']=_[_0xf599('0x48')](_0x31ad37[_0xf599('0x47')]);_0x55e722[_0xf599('0x50')]=_[_0xf599('0x49')](_0x55e722[_0xf599('0x46')],_0x55e722[_0xf599('0x47')]);_0x1e74a3['attributes']=_[_0xf599('0x49')](_0x55e722['model'],qs['fields'](_0x31ad37['query'][_0xf599('0x4b')]));_0x1e74a3['attributes']=_0x1e74a3[_0xf599('0x4a')][_0xf599('0x4c')]?_0x1e74a3[_0xf599('0x4a')]:_0x55e722[_0xf599('0x46')];if(_0x31ad37[_0xf599('0x47')][_0xf599('0x57')]){_0x1e74a3[_0xf599('0x58')]=[{'all':!![]}];}_0x1e74a3=_[_0xf599('0x53')]({},_0x1e74a3,_0x31ad37[_0xf599('0x55')]);return db['FaxMessage']['find'](_0x1e74a3)[_0xf599('0x3b')](handleEntityNotFound(_0x14b9a6,null))['then'](respondWithResult(_0x14b9a6,null))[_0xf599('0x2d')](handleError(_0x14b9a6,null));};exports[_0xf599('0x3a')]=function(_0x1b1bd3,_0x13a1a3){if(_0x1b1bd3[_0xf599('0x5b')]['id']){delete _0x1b1bd3['body']['id'];}return db[_0xf599('0x56')][_0xf599('0x5c')]({'where':{'id':_0x1b1bd3['params']['id']}})[_0xf599('0x3b')](handleEntityNotFound(_0x13a1a3,null))[_0xf599('0x3b')](saveUpdates(_0x1b1bd3['body'],null))[_0xf599('0x3b')](respondWithResult(_0x13a1a3,null))['catch'](handleError(_0x13a1a3,null));};exports[_0xf599('0x3c')]=function(_0x1d830c,_0x2acbdf){return db[_0xf599('0x56')][_0xf599('0x5c')]({'where':{'id':_0x1d830c[_0xf599('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2acbdf,null))['then'](removeEntity(_0x2acbdf,null))['catch'](handleError(_0x2acbdf,null));};exports[_0xf599('0x5d')]=function(_0x457ff6,_0x1d0d88){return db[_0xf599('0x56')][_0xf599('0x5d')]()[_0xf599('0x3b')](respondWithResult(_0x1d0d88,null))[_0xf599('0x2d')](handleError(_0x1d0d88,null));};var interaction_log=require(_0xf599('0x14'))(_0xf599('0x5e'));exports[_0xf599('0x5f')]=function(_0x22e5d0,_0x52a9ba,_0x3de171){var _0x446237={'agent':{},'channel':_0xf599('0x60')};if(_0x22e5d0[_0xf599('0x5b')]['id']){delete _0x22e5d0[_0xf599('0x5b')]['id'];}_0x22e5d0[_0xf599('0x5b')]['read']=!![];_0x22e5d0['body'][_0xf599('0x61')]=moment()[_0xf599('0x62')](_0xf599('0x63'));_0x22e5d0['body'][_0xf599('0x64')]=_0x22e5d0['body'][_0xf599('0x64')]||_0x22e5d0['user']['id'];_0x446237[_0xf599('0x65')]['id']=_0x22e5d0[_0xf599('0x5b')][_0xf599('0x64')];return db[_0xf599('0x56')][_0xf599('0x5c')]({'where':{'id':_0x22e5d0[_0xf599('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52a9ba,null))['then'](saveUpdates(_0x22e5d0[_0xf599('0x5b')],null))[_0xf599('0x3b')](function(_0x3eb70b){if(_0x3eb70b){_0x446237['message']=_0x3eb70b[_0xf599('0x66')]({'plain':!![]});return db[_0xf599('0x67')][_0xf599('0x5c')]({'where':{'id':_0x3eb70b['FaxInteractionId']}});}return null;})[_0xf599('0x3b')](handleEntityNotFound(_0x52a9ba,null))[_0xf599('0x3b')](function(_0x4e4cc4){if(_0x4e4cc4){return _0x4e4cc4['update']({'UserId':_0x22e5d0['body']['UserId'],'read1stAt':_['isNil'](_0x4e4cc4[_0xf599('0x68')])?moment()[_0xf599('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf599('0x3b')](function(_0x493b1a){if(_0x493b1a){_0x446237['interaction']=_0x493b1a[_0xf599('0x66')]({'plain':!![]});interaction_log[_0xf599('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22e5d0['user']['id'],_0x22e5d0[_0xf599('0x69')][_0xf599('0x3e')],_0x22e5d0[_0xf599('0x69')][_0xf599('0x6a')],_0x446237[_0xf599('0x6b')]['id'],_0x22e5d0[_0xf599('0x5b')]?JSON[_0xf599('0x28')](_0x22e5d0[_0xf599('0x5b')]):_0xf599('0x6c'));return respondWithRpcPromise(_0xf599('0x6d'),_0xf599('0x6e'),_0x446237);}return null;})['then'](function(_0x3efbda){var _0x162f85=_0xf599('0x6f')+_0x3efbda[_0xf599('0x2b')][_0xf599('0x70')];return db['sequelize'][_0xf599('0x47')](_0x162f85,{'type':db['Sequelize'][_0xf599('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x4934f0){return _0x4934f0;});})['then'](function(_0x1fd244){if(_0x1fd244){_0x446237[_0xf599('0x2b')][_0xf599('0x72')]=_0x1fd244[0x0];if(!_0x22e5d0['body'][_0xf599('0x64')])return;return db[_0xf599('0x73')][_0xf599('0x5c')]({'where':{'id':_0x22e5d0[_0xf599('0x5b')][_0xf599('0x64')],'role':_0xf599('0x65')},'attributes':['id','name','fullname','email',_0xf599('0x74')],'raw':!![]});}return null;})[_0xf599('0x3b')](function(_0x31572e){if(!_0x31572e)return null;_0x446237['message'][_0xf599('0x65')]=_0x31572e;return _0x446237;})['then'](function(_0x2f480a){if(_0x2f480a){if(_0x22e5d0['body'][_0xf599('0x75')]){_0x446237[_0xf599('0x2b')][_0xf599('0x76')]=util[_0xf599('0x62')](_0xf599('0x77'),_0x22e5d0[_0xf599('0x69')]['name']);_0x446237[_0xf599('0x2b')][_0xf599('0x78')]=_0x446237[_0xf599('0x78')];_0x446237[_0xf599('0x2b')][_0xf599('0x79')]=_0x446237[_0xf599('0x78')];_0x446237['message'][_0xf599('0x7a')]=_0xf599('0x5f');return respondWithRpcPromise(_0xf599('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x446237[_0xf599('0x2b')]},client9002)[_0xf599('0x3b')](function(){return _0x446237;});}return _0x446237;}return null;})[_0xf599('0x3b')](respondWithResult(_0x52a9ba,null))[_0xf599('0x2d')](handleError(_0x52a9ba,null));};var interaction_log=require('../../config/logger')(_0xf599('0x5e'));exports[_0xf599('0x38')]=function(_0x2f5962,_0x48837d,_0x2c7d79){var _0x342add={'agent':{},'channel':'fax'};if(_0x2f5962[_0xf599('0x5b')]['id']){delete _0x2f5962['body']['id'];}_0x2f5962['body'][_0xf599('0x64')]=_0x2f5962['body']['UserId']||_0x2f5962['user']['id'];_0x342add['agent']['id']=_0x2f5962[_0xf599('0x5b')]['UserId'];return db[_0xf599('0x56')][_0xf599('0x5c')]({'where':{'id':_0x2f5962[_0xf599('0x5a')]['id'],'UserId':null}})[_0xf599('0x3b')](handleEntityNotFound(_0x48837d,null))[_0xf599('0x3b')](function(_0x1395ab){if(_0x1395ab){_0x342add[_0xf599('0x2b')]=_0x1395ab[_0xf599('0x66')]({'plain':!![]});return db[_0xf599('0x67')][_0xf599('0x5c')]({'where':{'id':_0x1395ab[_0xf599('0x7c')]}});}return null;})[_0xf599('0x3b')](handleEntityNotFound(_0x48837d,null))['then'](function(_0x3dfb7f){if(_0x3dfb7f){_0x342add[_0xf599('0x6b')]=_0x3dfb7f[_0xf599('0x66')]({'plain':!![]});interaction_log['info'](_0xf599('0x7d'),_0x2f5962[_0xf599('0x69')]['id'],_0x2f5962[_0xf599('0x69')][_0xf599('0x3e')],_0x2f5962[_0xf599('0x69')][_0xf599('0x6a')],_0x342add[_0xf599('0x6b')]['id'],_0x2f5962[_0xf599('0x5b')]?JSON[_0xf599('0x28')](_0x2f5962['body']):_0xf599('0x6c'));return respondWithRpcPromise('RejectMessage',_0xf599('0x7e'),_0x342add);}return null;})[_0xf599('0x3b')](function(_0x599336){var _0x5ec0cb=_0xf599('0x6f')+_0x599336[_0xf599('0x2b')]['ContactId'];return db[_0xf599('0x7f')]['query'](_0x5ec0cb,{'type':db['Sequelize']['QueryTypes'][_0xf599('0x80')],'raw':!![]})['then'](function(_0x113df4){return _0x113df4;});})[_0xf599('0x3b')](function(_0x2f2971){if(_0x2f2971){_0x342add[_0xf599('0x2b')]['contact']=_0x2f2971[0x0];if(!_0x2f5962['body'][_0xf599('0x64')])return;return db['User'][_0xf599('0x5c')]({'where':{'id':_0x2f5962[_0xf599('0x5b')]['UserId'],'role':_0xf599('0x65')},'attributes':['id','name',_0xf599('0x81'),_0xf599('0x82'),_0xf599('0x74')],'raw':!![]});}return null;})[_0xf599('0x3b')](function(_0x38a781){if(!_0x38a781)return null;_0x342add[_0xf599('0x2b')][_0xf599('0x65')]=_0x38a781;return _0x342add;})[_0xf599('0x3b')](function(_0x3ceaaa){if(_0x3ceaaa){_0x3ceaaa[_0xf599('0x2b')][_0xf599('0x76')]=util['format'](_0xf599('0x77'),_0x2f5962[_0xf599('0x69')][_0xf599('0x3e')]);_0x3ceaaa['message'][_0xf599('0x78')]=_0x342add[_0xf599('0x78')];_0x3ceaaa[_0xf599('0x2b')]['motionChannel']=_0x342add[_0xf599('0x78')];_0x3ceaaa[_0xf599('0x2b')][_0xf599('0x7a')]=_0xf599('0x38');respondWithRpcPromise(_0xf599('0x7b'),_0xf599('0x7b'),{'event':_0xf599('0x83'),'message':_0x3ceaaa[_0xf599('0x2b')]},client9002);return _0x342add;}return null;})[_0xf599('0x3b')](respondWithResult(_0x48837d,null))[_0xf599('0x2d')](handleError(_0x48837d,null));};exports[_0xf599('0x84')]=function(_0x304d88,_0x34d615){var _0x2d6e1d;return db[_0xf599('0x56')]['create'](_0x304d88[_0xf599('0x5b')],{})['then'](function(_0xda8dca){_0x2d6e1d=_0xda8dca;return db[_0xf599('0x85')][_0xf599('0x86')]({'where':{'id':_0x2d6e1d[_0xf599('0x70')]}});})[_0xf599('0x3b')](function(_0x5a0fda){if(_[_0xf599('0x87')](_0x5a0fda)){return;}else{_0x2d6e1d['fax']=_0x5a0fda[_0xf599('0x60')];return db['Attachment'][_0xf599('0x86')]({'where':{'id':_0x2d6e1d[_0xf599('0x88')]}});}})[_0xf599('0x3b')](function(_0x1de3ef){return respondWithRpcPromise(_0xf599('0x89'),_0xf599('0x89'),{'FaxAccountId':_[_0xf599('0x87')](_0x304d88[_0xf599('0x5b')])?undefined:_0x304d88[_0xf599('0x5b')][_0xf599('0x8a')],'path':_[_0xf599('0x87')](_0x1de3ef)?undefined:util[_0xf599('0x62')](_0xf599('0x8b'),_0x1de3ef[_0xf599('0x8c')]),'fax':_[_0xf599('0x87')](_0x2d6e1d['fax'])?undefined:_0x2d6e1d['fax'],'AttachmentId':_0x2d6e1d[_0xf599('0x88')]},client9002);})['then'](respondWithResult(_0x34d615,0xc9))['catch'](handleError(_0x34d615,null));};exports[_0xf599('0x8d')]=function(_0x310132,_0x3be4a2){var _0x4fcc0=path['join'](config['root'],_0xf599('0x8e'),'files',_0xf599('0x8f'));return db[_0xf599('0x56')][_0xf599('0x5c')]({'where':{'id':_0x310132[_0xf599('0x5a')]['id']},'include':[{'model':db[_0xf599('0x90')],'as':_0xf599('0x90')}]})[_0xf599('0x3b')](handleEntityNotFound(_0x3be4a2,null))[_0xf599('0x3b')](function(_0x357950){if(_0x357950){return _0x3be4a2[_0xf599('0x8d')](path[_0xf599('0x91')](_0x4fcc0,_0x357950[_0xf599('0x90')][_0xf599('0x8c')]));}})['catch'](handleError(_0x3be4a2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index dbe2cef..dcc8780 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 _0xa786=['exports','events','../../mysqldb','FaxMessage','save','emit','hasOwnProperty'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xa786,0x71));var _0x6a78=function(_0x487a08,_0x211456){_0x487a08=_0x487a08-0x0;var _0x113c35=_0xa786[_0x487a08];return _0x113c35;};'use strict';var EventEmitter=require(_0x6a78('0x0'));var FaxMessage=require(_0x6a78('0x1'))['db'][_0x6a78('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a78('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47d5d5){return function(_0x2b0fed,_0x3b3608,_0x19285c){FaxMessageEvents[_0x6a78('0x4')](_0x47d5d5+':'+_0x2b0fed['id'],_0x2b0fed);FaxMessageEvents[_0x6a78('0x4')](_0x47d5d5,_0x2b0fed);_0x19285c(null);};}for(var e in events){if(events[_0x6a78('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x6a78('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x3c85=['remove','emit','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x52d766,_0x3b502e){var _0x4e0a8a=function(_0xa5cafa){while(--_0xa5cafa){_0x52d766['push'](_0x52d766['shift']());}};_0x4e0a8a(++_0x3b502e);}(_0x3c85,0x1a0));var _0x53c8=function(_0x2df690,_0x1d4b28){_0x2df690=_0x2df690-0x0;var _0x19be28=_0x3c85[_0x2df690];return _0x19be28;};'use strict';var EventEmitter=require(_0x53c8('0x0'));var FaxMessage=require(_0x53c8('0x1'))['db'][_0x53c8('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x53c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x53c8('0x4')};function emitEvent(_0xcc2f5f){return function(_0x44a11e,_0x4be799,_0x270365){FaxMessageEvents[_0x53c8('0x5')](_0xcc2f5f+':'+_0x44a11e['id'],_0x44a11e);FaxMessageEvents[_0x53c8('0x5')](_0xcc2f5f,_0x44a11e);_0x270365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](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 6abdb93..f5a5a7b 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 _0x9b7b=['fax_messages','fti_fax_messages','body','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','FaxInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage'];(function(_0x1c2930,_0x496ecd){var _0x185afa=function(_0x422327){while(--_0x422327){_0x1c2930['push'](_0x1c2930['shift']());}};_0x185afa(++_0x496ecd);}(_0x9b7b,0x1c0));var _0xb9b7=function(_0x3bf8d3,_0x1a1fd3){_0x3bf8d3=_0x3bf8d3-0x0;var _0x5af333=_0x9b7b[_0x3bf8d3];return _0x5af333;};'use strict';var _=require(_0xb9b7('0x0'));var util=require('util');var logger=require(_0xb9b7('0x1'))(_0xb9b7('0x2'));var moment=require('moment');var BPromise=require(_0xb9b7('0x3'));var rp=require(_0xb9b7('0x4'));var fs=require('fs');var path=require(_0xb9b7('0x5'));var rimraf=require('rimraf');var config=require(_0xb9b7('0x6'));var attributes=require(_0xb9b7('0x7'));module[_0xb9b7('0x8')]=function(_0x2d2906,_0x3a6df8){return _0x2d2906[_0xb9b7('0x9')](_0xb9b7('0xa'),attributes,{'tableName':_0xb9b7('0xb'),'paranoid':![],'indexes':[{'name':_0xb9b7('0xc'),'fields':[_0xb9b7('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e95b2,_0x21ed6a,_0x3bbf6f){var _0x29d686=_0x2d2906['models'];var _0x2beb17=_0x3e95b2[_0xb9b7('0xe')]({'plain':!![]});if(_0x2beb17[_0xb9b7('0xf')][_0xb9b7('0x10')]()==='in'||_0x2beb17[_0xb9b7('0xf')][_0xb9b7('0x10')]()===_0xb9b7('0x11')&&!_0x2beb17[_0xb9b7('0x12')]&&!_['isNil'](_0x2beb17[_0xb9b7('0x13')])){_0x29d686[_0xb9b7('0x14')]['findOne']({'where':{'id':_0x2beb17[_0xb9b7('0x15')]}})[_0xb9b7('0x16')](function(_0x56681f){if(_0x56681f){_0x56681f[_0xb9b7('0x17')]({'lastMsgAt':_0x2beb17['createdAt'],'lastMsgDirection':_0x2beb17[_0xb9b7('0xf')][_0xb9b7('0x10')]()});}})[_0xb9b7('0x18')](function(_0x14d7a4){console['error'](_0x14d7a4);});}_0x3bbf6f();}},'charset':_0xb9b7('0x19'),'collate':_0xb9b7('0x1a')});}; \ No newline at end of file +var _0x4329=['bluebird','request-promise','rimraf','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4329,0x130));var _0x9432=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x4329[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var logger=require('../../config/logger')(_0x9432('0x2'));var moment=require(_0x9432('0x3'));var BPromise=require(_0x9432('0x4'));var rp=require(_0x9432('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9432('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x9432('0x7')]=function(_0x435db8,_0x385d62){return _0x435db8[_0x9432('0x8')](_0x9432('0x9'),attributes,{'tableName':_0x9432('0xa'),'paranoid':![],'indexes':[{'name':_0x9432('0xb'),'fields':[_0x9432('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x444053,_0xa0be3f,_0xc48aef){var _0x5ae928=_0x435db8[_0x9432('0xd')];var _0x404721=_0x444053[_0x9432('0xe')]({'plain':!![]});if(_0x404721[_0x9432('0xf')][_0x9432('0x10')]()==='in'||_0x404721[_0x9432('0xf')][_0x9432('0x10')]()==='out'&&!_0x404721['secret']&&!_[_0x9432('0x11')](_0x404721[_0x9432('0x12')])){_0x5ae928[_0x9432('0x13')][_0x9432('0x14')]({'where':{'id':_0x404721[_0x9432('0x15')]}})[_0x9432('0x16')](function(_0x592349){if(_0x592349){_0x592349['update']({'lastMsgAt':_0x404721[_0x9432('0x17')],'lastMsgDirection':_0x404721[_0x9432('0xf')][_0x9432('0x10')]()});}})[_0x9432('0x18')](function(_0x53219a){console[_0x9432('0x19')](_0x53219a);});}_0xc48aef();}},'charset':_0x9432('0x1a'),'collate':_0x9432('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b03d97f..3638f8f 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 _0x3e74=['result','catch','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','create','body','options','raw','then','attributes','limit','UpdateFaxMessage','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x207974,_0x5a76e4){var _0x2a7933=function(_0x150db9){while(--_0x150db9){_0x207974['push'](_0x207974['shift']());}};_0x2a7933(++_0x5a76e4);}(_0x3e74,0x175));var _0x43e7=function(_0x11084e,_0x39a23b){_0x11084e=_0x11084e-0x0;var _0x318f81=_0x3e74[_0x11084e];return _0x318f81;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});config['redis']=_[_0x43e7('0xa')](config[_0x43e7('0xb')],{'host':_0x43e7('0xc'),'port':0x18eb});var socket=require(_0x43e7('0xd'))(new Redis(config[_0x43e7('0xb')]));require('./faxMessage.socket')[_0x43e7('0xe')](socket);function respondWithRpcPromise(_0x554d44,_0x54948c,_0x39c8bd){return new BPromise(function(_0x4139c9,_0x5c34f4){return client[_0x43e7('0xf')](_0x554d44,_0x39c8bd)['then'](function(_0xf7c520){logger[_0x43e7('0x10')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0x43e7('0x11'));logger[_0x43e7('0x12')](_0x43e7('0x13'),_0x54948c,_0x43e7('0x11'),JSON['stringify'](_0xf7c520));if(_0xf7c520['error']){if(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x15')]===0x1f4){logger[_0x43e7('0x14')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0xf7c520['error'][_0x43e7('0x16')]);return _0x5c34f4(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x16')]);}logger[_0x43e7('0x14')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0xf7c520['error'][_0x43e7('0x16')]);return _0x4139c9(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x16')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x54948c,_0x43e7('0x11'));_0x4139c9(_0xf7c520[_0x43e7('0x17')][_0x43e7('0x16')]);}})[_0x43e7('0x18')](function(_0x3776f5){logger[_0x43e7('0x14')](_0x43e7('0x19'),_0x54948c,_0x3776f5);_0x5c34f4(_0x3776f5);});});}exports[_0x43e7('0x1a')]=function(_0x2377a3){var _0xab63cf=this;return new Promise(function(_0x191dd5,_0x177ee1){return db['FaxMessage'][_0x43e7('0x1b')](_0x2377a3[_0x43e7('0x1c')],{'raw':_0x2377a3['options']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0x1e')]===undefined?!![]:![]:!![]})[_0x43e7('0x1f')](function(_0x28aacc){logger[_0x43e7('0x10')](_0x43e7('0x1a'),_0x2377a3);logger['debug'](_0x43e7('0x1a'),_0x2377a3,JSON['stringify'](_0x28aacc));_0x191dd5(_0x28aacc);})['catch'](function(_0x47204e){logger[_0x43e7('0x14')]('CreateFaxMessage',_0x47204e[_0x43e7('0x16')],_0x2377a3);_0x177ee1(_0xab63cf['error'](0x1f4,_0x47204e[_0x43e7('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x1af208){var _0x1b5f50=this;return new Promise(function(_0x20888b,_0x405f85){return db['FaxMessage']['update'](_0x1af208[_0x43e7('0x1c')],{'raw':_0x1af208['options']?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')]['where']||null:null,'attributes':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x20')]||null:null,'limit':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x21')]||null:null})[_0x43e7('0x1f')](function(_0x31b2a6){logger[_0x43e7('0x10')](_0x43e7('0x22'),_0x1af208);logger[_0x43e7('0x12')](_0x43e7('0x22'),_0x1af208,JSON[_0x43e7('0x23')](_0x31b2a6));_0x20888b(_0x31b2a6);})[_0x43e7('0x18')](function(_0x4bdb17){logger[_0x43e7('0x14')](_0x43e7('0x22'),_0x4bdb17[_0x43e7('0x16')],_0x1af208);_0x405f85(_0x1b5f50[_0x43e7('0x14')](0x1f4,_0x4bdb17[_0x43e7('0x16')]));});});}; \ No newline at end of file +var _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x1ab047,_0x436579){var _0x20018a=function(_0x24d04a){while(--_0x24d04a){_0x1ab047['push'](_0x1ab047['shift']());}};_0x20018a(++_0x436579);}(_0x55e0,0xdc));var _0x055e=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x55e0[_0x3b231a];return _0x18d67a;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 48787b1..c341a68 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 _0xe453=['length','faxMessage:','save','remove','update','emit','removeListener','register'];(function(_0x4a349b,_0x48fd5e){var _0x2b04cd=function(_0x328ae7){while(--_0x328ae7){_0x4a349b['push'](_0x4a349b['shift']());}};_0x2b04cd(++_0x48fd5e);}(_0xe453,0x92));var _0x3e45=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe453[_0x122ef9];return _0x42fba0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x3e45('0x0'),_0x3e45('0x1'),_0x3e45('0x2')];function createListener(_0x34ca43,_0x25a10e){return function(_0xb78766){_0x25a10e[_0x3e45('0x3')](_0x34ca43,_0xb78766);};}function removeListener(_0x6c2930,_0x30c340){return function(){FaxMessageEvents[_0x3e45('0x4')](_0x6c2930,_0x30c340);};}exports[_0x3e45('0x5')]=function(_0x28dad8){for(var _0x4ca37e=0x0,_0x667702=events[_0x3e45('0x6')];_0x4ca37e<_0x667702;_0x4ca37e++){var _0x2ea1d=events[_0x4ca37e];var _0xf7602a=createListener(_0x3e45('0x7')+_0x2ea1d,_0x28dad8);FaxMessageEvents['on'](_0x2ea1d,_0xf7602a);}}; \ No newline at end of file +var _0x589b=['faxMessage:','save','remove','update','emit','register','length'];(function(_0x39edc2,_0x407248){var _0x16ba14=function(_0x72b956){while(--_0x72b956){_0x39edc2['push'](_0x39edc2['shift']());}};_0x16ba14(++_0x407248);}(_0x589b,0x1b3));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb589('0x0'),_0xb589('0x1'),_0xb589('0x2')];function createListener(_0x5ec9b1,_0x1a996e){return function(_0x517612){_0x1a996e[_0xb589('0x3')](_0x5ec9b1,_0x517612);};}function removeListener(_0x46f5ea,_0x4caf53){return function(){FaxMessageEvents['removeListener'](_0x46f5ea,_0x4caf53);};}exports[_0xb589('0x4')]=function(_0xcf993){for(var _0x17c1a3=0x0,_0x2dd35f=events[_0xb589('0x5')];_0x17c1a3<_0x2dd35f;_0x17c1a3++){var _0x514352=events[_0x17c1a3];var _0x55b964=createListener(_0xb589('0x6')+_0x514352,_0xcf993);FaxMessageEvents['on'](_0x514352,_0x55b964);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 519c2af..f830f6f 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 _0x579c=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xf5e952,_0x43d903){var _0x577f81=function(_0x3cc789){while(--_0x3cc789){_0xf5e952['push'](_0xf5e952['shift']());}};_0x577f81(++_0x43d903);}(_0x579c,0xda));var _0xc579=function(_0x2ce71c,_0x3390f5){_0x2ce71c=_0x2ce71c-0x0;var _0x42f7bb=_0x579c[_0x2ce71c];return _0x42f7bb;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/describe',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0x9')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0x9')](_0xc579('0xf'),auth['isAuthenticated'](),controller[_0xc579('0x10')]);router[_0xc579('0x11')]('/',auth[_0xc579('0xa')](),interaction[_0xc579('0x12')](_0xc579('0x13'),_0xc579('0x14')),controller[_0xc579('0x15')]);router[_0xc579('0x16')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0x17')]);router['put'](_0xc579('0x18'),auth['isAuthenticated'](),controller[_0xc579('0x19')]);router['put'](_0xc579('0x1a'),auth['isAuthenticated'](),controller[_0xc579('0x1b')]);router['delete'](_0xc579('0xd'),auth[_0xc579('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa5fa=['accept','/:id/reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','faxmessage:create','create','put'];(function(_0x3d0ed5,_0xe5cf9d){var _0x10e71f=function(_0x52a848){while(--_0x52a848){_0x3d0ed5['push'](_0x3d0ed5['shift']());}};_0x10e71f(++_0xe5cf9d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x486ace,_0x2acf99){_0x486ace=_0x486ace-0x0;var _0x236c9b=_0xa5fa[_0x486ace];return _0x236c9b;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xaa5f('0x10')]('fax',_0xaa5f('0x11')),controller[_0xaa5f('0x12')]);router[_0xaa5f('0x13')](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller['update']);router[_0xaa5f('0x13')]('/:id/accept',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);router[_0xaa5f('0x13')](_0xaa5f('0x15'),auth[_0xaa5f('0x9')](),controller['reject']);router['delete'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x16')]);module[_0xaa5f('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 58934e1..81ff1db 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 _0x241f=['name','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x241f,0x169));var _0xf241=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x241f[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf241('0x0'));module[_0xf241('0x1')]={'name':{'type':Sequelize[_0xf241('0x2')],'unique':_0xf241('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf241('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf241('0x4')]('rrmemory',_0xf241('0x5'),_0xf241('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9820=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x4df6e3,_0x122209){var _0x314432=function(_0x590113){while(--_0x590113){_0x4df6e3['push'](_0x4df6e3['shift']());}};_0x314432(++_0x122209);}(_0x9820,0x93));var _0x0982=function(_0x267700,_0x299ab2){_0x267700=_0x267700-0x0;var _0x484cc0=_0x9820[_0x267700];return _0x484cc0;};'use strict';var Sequelize=require(_0x0982('0x0'));module[_0x0982('0x1')]={'name':{'type':Sequelize[_0x0982('0x2')],'unique':_0x0982('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0982('0x2')]},'timeout':{'type':Sequelize[_0x0982('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0982('0x5')](_0x0982('0x6'),_0x0982('0x7'),_0x0982('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0982('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 1bdaf18..7011525 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 _0xb924=['addAgents','omit','spread','isArray','getAgents','eml-format','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','limit','count','json','save','update','then','destroy','FaxQueues','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserFaxQueue','order','FaxQueueId','findAll','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','Team','hasOwnProperty','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','field','tq.TeamId','join','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove'];(function(_0x4d326e,_0x4c7774){var _0x1cd587=function(_0x2eea00){while(--_0x2eea00){_0x4d326e['push'](_0x4d326e['shift']());}};_0x1cd587(++_0x4c7774);}(_0xb924,0x19d));var _0x4b92=function(_0x3fad05,_0xf0abe3){_0x3fad05=_0x3fad05-0x0;var _0x1a9700=_0xb924[_0x3fad05];return _0x1a9700;};'use strict';var emlformat=require(_0x4b92('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4b92('0x1'));var moment=require('moment');var BPromise=require(_0x4b92('0x2'));var Mustache=require(_0x4b92('0x3'));var util=require(_0x4b92('0x4'));var path=require(_0x4b92('0x5'));var sox=require(_0x4b92('0x6'));var csv=require('to-csv');var ejs=require(_0x4b92('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b92('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4b92('0x9'));var deskjs=require(_0x4b92('0xa'));var toCsv=require(_0x4b92('0xb'));var querystring=require('querystring');var Papa=require(_0x4b92('0xc'));var Redis=require(_0x4b92('0xd'));var authService=require(_0x4b92('0xe'));var qs=require(_0x4b92('0xf'));var as=require(_0x4b92('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b92('0x11'))(_0x4b92('0x12'));var utils=require(_0x4b92('0x13'));var config=require(_0x4b92('0x14'));var licenseUtil=require(_0x4b92('0x15'));var db=require('../../mysqldb')['db'];config[_0x4b92('0x16')]=_[_0x4b92('0x17')](config[_0x4b92('0x16')],{'host':_0x4b92('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b92('0x16')]));require(_0x4b92('0x19'))[_0x4b92('0x1a')](socket);function respondWithStatusCode(_0x5d4aff,_0x59267a){_0x59267a=_0x59267a||0xcc;return function(_0x107b6a){if(_0x107b6a){return _0x5d4aff[_0x4b92('0x1b')](_0x59267a);}return _0x5d4aff[_0x4b92('0x1c')](_0x59267a)[_0x4b92('0x1d')]();};}function respondWithResult(_0x7adca3,_0x2f45b2){_0x2f45b2=_0x2f45b2||0xc8;return function(_0x54b38d){if(_0x54b38d){return _0x7adca3[_0x4b92('0x1c')](_0x2f45b2)['json'](_0x54b38d);}};}function respondWithFilteredResult(_0x3004ee,_0x1a10a0){return function(_0x32adac){if(_0x32adac){var _0x7fc5e6=typeof _0x1a10a0[_0x4b92('0x1e')]==='undefined'&&typeof _0x1a10a0[_0x4b92('0x1f')]==='undefined';var _0x1751cd=_0x32adac['count'];var _0x4910df=_0x7fc5e6?0x0:_0x1a10a0[_0x4b92('0x1e')];var _0x19f2ae=_0x7fc5e6?_0x32adac[_0x4b92('0x20')]:_0x1a10a0[_0x4b92('0x1e')]+_0x1a10a0[_0x4b92('0x1f')];var _0x40c087;if(_0x19f2ae>=_0x1751cd){_0x19f2ae=_0x1751cd;_0x40c087=0xc8;}else{_0x40c087=0xce;}_0x3004ee[_0x4b92('0x1c')](_0x40c087);return _0x3004ee['set']('Content-Range',_0x4910df+'-'+_0x19f2ae+'/'+_0x1751cd)[_0x4b92('0x21')](_0x32adac);}return null;};}function patchUpdates(_0x57f56a){return function(_0x47fecd){try{jsonpatch['apply'](_0x47fecd,_0x57f56a,!![]);}catch(_0x4e39ba){return BPromise['reject'](_0x4e39ba);}return _0x47fecd[_0x4b92('0x22')]();};}function saveUpdates(_0x43d5e7,_0x1d83c3){return function(_0x4c6000){if(_0x4c6000){return _0x4c6000[_0x4b92('0x23')](_0x43d5e7)[_0x4b92('0x24')](function(_0x3272b9){return _0x3272b9;});}return null;};}function removeEntity(_0x369efa,_0x24fc61){return function(_0x444f4c){if(_0x444f4c){return _0x444f4c[_0x4b92('0x25')]()[_0x4b92('0x24')](function(){var _0x4f50a6=_0x444f4c['get']({'plain':!![]});var _0x2cfbd9=_0x4b92('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2cfbd9,'resourceId':_0x4f50a6['id']}})[_0x4b92('0x24')](function(){return _0x444f4c;});})[_0x4b92('0x24')](function(){_0x369efa[_0x4b92('0x1c')](0xcc)[_0x4b92('0x1d')]();});}};}function handleEntityNotFound(_0x1f3340,_0x389da8){return function(_0x33501b){if(!_0x33501b){_0x1f3340['sendStatus'](0x194);}return _0x33501b;};}function handleError(_0x52ede8,_0x1ede78){_0x1ede78=_0x1ede78||0x1f4;return function(_0x5ca867){logger[_0x4b92('0x27')](_0x5ca867[_0x4b92('0x28')]);if(_0x5ca867[_0x4b92('0x29')]){delete _0x5ca867[_0x4b92('0x29')];}_0x52ede8['status'](_0x1ede78)[_0x4b92('0x2a')](_0x5ca867);};}exports[_0x4b92('0x2b')]=function(_0x2cef8e,_0x456668){var _0x2e8782={},_0x213bca={},_0x64c211={'count':0x0,'rows':[]};var _0x5ca2bf=_[_0x4b92('0x2c')](db[_0x4b92('0x2d')][_0x4b92('0x2e')],function(_0x198c6f){return{'name':_0x198c6f[_0x4b92('0x2f')],'type':_0x198c6f[_0x4b92('0x30')][_0x4b92('0x31')]};});_0x213bca['model']=_[_0x4b92('0x2c')](_0x5ca2bf,_0x4b92('0x29'));_0x213bca[_0x4b92('0x32')]=_[_0x4b92('0x33')](_0x2cef8e[_0x4b92('0x32')]);_0x213bca[_0x4b92('0x34')]=_[_0x4b92('0x35')](_0x213bca[_0x4b92('0x36')],_0x213bca[_0x4b92('0x32')]);_0x2e8782[_0x4b92('0x37')]=_[_0x4b92('0x35')](_0x213bca[_0x4b92('0x36')],qs['fields'](_0x2cef8e[_0x4b92('0x32')]['fields']));_0x2e8782['attributes']=_0x2e8782['attributes'][_0x4b92('0x38')]?_0x2e8782[_0x4b92('0x37')]:_0x213bca['model'];if(!_0x2cef8e[_0x4b92('0x32')]['hasOwnProperty'](_0x4b92('0x39'))){_0x2e8782[_0x4b92('0x1f')]=qs[_0x4b92('0x1f')](_0x2cef8e['query'][_0x4b92('0x1f')]);_0x2e8782[_0x4b92('0x1e')]=qs['offset'](_0x2cef8e[_0x4b92('0x32')][_0x4b92('0x1e')]);}_0x2e8782['order']=qs['sort'](_0x2cef8e[_0x4b92('0x32')][_0x4b92('0x3a')]);_0x2e8782['where']=qs[_0x4b92('0x34')](_[_0x4b92('0x3b')](_0x2cef8e['query'],_0x213bca[_0x4b92('0x34')]),_0x5ca2bf);if(_0x2cef8e[_0x4b92('0x32')]['filter']){_0x2e8782[_0x4b92('0x3c')]=_[_0x4b92('0x3d')](_0x2e8782[_0x4b92('0x3c')],{'$or':_['map'](_0x5ca2bf,function(_0x34b1b2){if(_0x34b1b2[_0x4b92('0x30')]!==_0x4b92('0x3e')){var _0xc111c6={};_0xc111c6[_0x34b1b2['name']]={'$like':'%'+_0x2cef8e[_0x4b92('0x32')][_0x4b92('0x3f')]+'%'};return _0xc111c6;}})});}_0x2e8782=_['merge']({},_0x2e8782,_0x2cef8e[_0x4b92('0x40')]);var _0x2101c1={'where':_0x2e8782[_0x4b92('0x3c')]};return db['FaxQueue']['count'](_0x2101c1)[_0x4b92('0x24')](function(_0x2d0e1d){_0x64c211[_0x4b92('0x20')]=_0x2d0e1d;if(_0x2cef8e[_0x4b92('0x32')][_0x4b92('0x41')]){_0x2e8782[_0x4b92('0x42')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x2e8782);})['then'](function(_0x57d4b6){_0x64c211[_0x4b92('0x43')]=_0x57d4b6;return _0x64c211;})['then'](respondWithFilteredResult(_0x456668,_0x2e8782))[_0x4b92('0x44')](handleError(_0x456668,null));};exports[_0x4b92('0x45')]=function(_0x434563,_0x132d24){var _0x3efa89={'raw':!![],'where':{'id':_0x434563[_0x4b92('0x46')]['id']}},_0x3fb279={};_0x3fb279[_0x4b92('0x36')]=_[_0x4b92('0x33')](db[_0x4b92('0x2d')]['rawAttributes']);_0x3fb279[_0x4b92('0x32')]=_[_0x4b92('0x33')](_0x434563['query']);_0x3fb279[_0x4b92('0x34')]=_[_0x4b92('0x35')](_0x3fb279[_0x4b92('0x36')],_0x3fb279[_0x4b92('0x32')]);_0x3efa89[_0x4b92('0x37')]=_[_0x4b92('0x35')](_0x3fb279['model'],qs[_0x4b92('0x47')](_0x434563[_0x4b92('0x32')][_0x4b92('0x47')]));_0x3efa89[_0x4b92('0x37')]=_0x3efa89[_0x4b92('0x37')][_0x4b92('0x38')]?_0x3efa89['attributes']:_0x3fb279[_0x4b92('0x36')];if(_0x434563[_0x4b92('0x32')][_0x4b92('0x41')]){_0x3efa89[_0x4b92('0x42')]=[{'all':!![]}];}_0x3efa89=_[_0x4b92('0x3d')]({},_0x3efa89,_0x434563[_0x4b92('0x40')]);return db['FaxQueue'][_0x4b92('0x48')](_0x3efa89)['then'](handleEntityNotFound(_0x132d24,null))[_0x4b92('0x24')](respondWithResult(_0x132d24,null))[_0x4b92('0x44')](handleError(_0x132d24,null));};exports[_0x4b92('0x49')]=function(_0x4c5cb8,_0xaabdd8){return db['FaxQueue']['create'](_0x4c5cb8[_0x4b92('0x4a')],{})['then'](function(_0x3d3041){var _0x241b4c=_0x4c5cb8[_0x4b92('0x4b')]['get']({'plain':!![]});if(!_0x241b4c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x241b4c['role']==='user'){var _0x19abf1=_0x3d3041[_0x4b92('0x4c')]({'plain':!![]});var _0x5eaf68=_0x4b92('0x26');return db[_0x4b92('0x4d')][_0x4b92('0x48')]({'where':{'name':_0x5eaf68,'userProfileId':_0x241b4c[_0x4b92('0x4e')]},'raw':!![]})[_0x4b92('0x24')](function(_0x499468){if(_0x499468&&_0x499468[_0x4b92('0x4f')]===0x0){return db['UserProfileResource'][_0x4b92('0x49')]({'name':_0x19abf1['name'],'resourceId':_0x19abf1['id'],'type':_0x499468[_0x4b92('0x29')],'sectionId':_0x499468['id']},{})[_0x4b92('0x24')](function(){return _0x3d3041;});}else{return _0x3d3041;}})['catch'](function(_0x58b9e1){logger[_0x4b92('0x27')](_0x4b92('0x50'),_0x58b9e1);throw _0x58b9e1;});}return _0x3d3041;})[_0x4b92('0x24')](respondWithResult(_0xaabdd8,0xc9))[_0x4b92('0x44')](handleError(_0xaabdd8,null));};exports[_0x4b92('0x23')]=function(_0x38b18d,_0x100dc5){if(_0x38b18d[_0x4b92('0x4a')]['id']){delete _0x38b18d[_0x4b92('0x4a')]['id'];}return db[_0x4b92('0x2d')][_0x4b92('0x48')]({'where':{'id':_0x38b18d[_0x4b92('0x46')]['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x100dc5,null))[_0x4b92('0x24')](saveUpdates(_0x38b18d[_0x4b92('0x4a')],null))['then'](respondWithResult(_0x100dc5,null))['catch'](handleError(_0x100dc5,null));};exports[_0x4b92('0x25')]=function(_0x3e25e3,_0x4f73a3){return db['FaxQueue'][_0x4b92('0x48')]({'where':{'id':_0x3e25e3[_0x4b92('0x46')]['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x4f73a3,null))[_0x4b92('0x24')](removeEntity(_0x4f73a3,null))[_0x4b92('0x44')](handleError(_0x4f73a3,null));};exports['describe']=function(_0x2e146f,_0x2d2ebf){return db[_0x4b92('0x2d')]['describe']()[_0x4b92('0x24')](respondWithResult(_0x2d2ebf,null))['catch'](handleError(_0x2d2ebf,null));};exports[_0x4b92('0x51')]=function(_0x58be75,_0x2345bc,_0x2aae90){var _0x5c68bb={'raw':!![],'where':{}},_0x13218c={},_0x675d2f;return db[_0x4b92('0x2d')][_0x4b92('0x52')]({'where':{'id':_0x58be75[_0x4b92('0x46')]['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x2345bc,null))[_0x4b92('0x24')](function(_0x219793){if(_0x219793){_0x675d2f=_0x219793[_0x4b92('0x4c')]({'plain':!![]});_0x13218c[_0x4b92('0x36')]=_[_0x4b92('0x33')](db[_0x4b92('0x53')]['rawAttributes']);_0x13218c[_0x4b92('0x32')]=_[_0x4b92('0x33')](_0x58be75[_0x4b92('0x32')]);_0x13218c[_0x4b92('0x34')]=_[_0x4b92('0x35')](_0x13218c[_0x4b92('0x36')],_0x13218c[_0x4b92('0x32')]);_0x5c68bb[_0x4b92('0x37')]=_[_0x4b92('0x35')](_0x13218c[_0x4b92('0x36')],qs[_0x4b92('0x47')](_0x58be75[_0x4b92('0x32')][_0x4b92('0x47')]));_0x5c68bb[_0x4b92('0x37')]=_0x5c68bb['attributes'][_0x4b92('0x38')]?_0x5c68bb[_0x4b92('0x37')]:_0x13218c[_0x4b92('0x36')];if(!_0x58be75[_0x4b92('0x32')]['hasOwnProperty'](_0x4b92('0x39'))){_0x5c68bb[_0x4b92('0x1f')]=qs[_0x4b92('0x1f')](_0x58be75['query']['limit']);_0x5c68bb[_0x4b92('0x1e')]=qs['offset'](_0x58be75[_0x4b92('0x32')][_0x4b92('0x1e')]);}_0x5c68bb[_0x4b92('0x54')]=qs[_0x4b92('0x3a')](_0x58be75[_0x4b92('0x32')][_0x4b92('0x3a')]);_0x5c68bb[_0x4b92('0x3c')]=qs[_0x4b92('0x34')](_[_0x4b92('0x3b')](_0x58be75['query'],_0x13218c['filters']));_0x5c68bb[_0x4b92('0x3c')][_0x4b92('0x55')]=_0x219793['id'];if(_0x58be75['query']['filter']){_0x5c68bb[_0x4b92('0x3c')]=_[_0x4b92('0x3d')](_0x5c68bb[_0x4b92('0x3c')],{'$or':_['map'](_0x5c68bb[_0x4b92('0x37')],function(_0x48558c){var _0x82f4f7={};_0x82f4f7[_0x48558c]={'$like':'%'+_0x58be75[_0x4b92('0x32')][_0x4b92('0x3f')]+'%'};return _0x82f4f7;})});}_0x5c68bb=_[_0x4b92('0x3d')]({},_0x5c68bb,_0x58be75['options']);return db[_0x4b92('0x53')][_0x4b92('0x56')](_0x5c68bb);}})[_0x4b92('0x24')](function(_0x37ccd7){if(_0x37ccd7){return db[_0x4b92('0x57')][_0x4b92('0x58')]({'where':{'id':_[_0x4b92('0x2c')](_0x37ccd7,'UserId'),'role':_0x4b92('0x59')},'attributes':['id',_0x4b92('0x29'),_0x4b92('0x5a'),'updatedAt',_0x4b92('0x5b')]});}})[_0x4b92('0x24')](function(_0x2eb92a){if(_0x2eb92a){return{'count':_0x2eb92a['count'],'rows':_['map'](_0x2eb92a['rows'],function(_0x4a461d){return{'membername':_0x4a461d['name'],'UserId':_0x4a461d['id'],'queue_name':_0x675d2f[_0x4b92('0x29')],'FaxQueueId':_0x675d2f['id'],'interface':util[_0x4b92('0x5c')](_0x4b92('0x5d'),_0x4b92('0x5e'),_0x4a461d[_0x4b92('0x29')]),'penalty':0x0,'paused':_0x4a461d['faxPause'],'createdAt':_0x4a461d[_0x4b92('0x5b')],'updatedAt':_0x4a461d[_0x4b92('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b92('0x24')](respondWithFilteredResult(_0x2345bc,_0x5c68bb))[_0x4b92('0x44')](handleError(_0x2345bc,null));};exports['getTeams']=function(_0x4ddbf7,_0x26c4ba,_0x42e1c4){var _0x1a7e7b={};var _0xf06456={};var _0x19b27d;var _0x181cb0;return db['FaxQueue'][_0x4b92('0x52')]({'where':{'id':_0x4ddbf7['params']['id']}})['then'](handleEntityNotFound(_0x26c4ba,null))[_0x4b92('0x24')](function(_0x5188a8){if(_0x5188a8){_0x19b27d=_0x5188a8;_0xf06456[_0x4b92('0x36')]=_[_0x4b92('0x33')](db[_0x4b92('0x60')][_0x4b92('0x2e')]);_0xf06456[_0x4b92('0x32')]=_[_0x4b92('0x33')](_0x4ddbf7[_0x4b92('0x32')]);_0xf06456[_0x4b92('0x34')]=_[_0x4b92('0x35')](_0xf06456[_0x4b92('0x36')],_0xf06456[_0x4b92('0x32')]);_0x1a7e7b['attributes']=_[_0x4b92('0x35')](_0xf06456['model'],qs[_0x4b92('0x47')](_0x4ddbf7[_0x4b92('0x32')][_0x4b92('0x47')]));_0x1a7e7b[_0x4b92('0x37')]=_0x1a7e7b['attributes'][_0x4b92('0x38')]?_0x1a7e7b['attributes']:_0xf06456['model'];_0x1a7e7b[_0x4b92('0x54')]=qs[_0x4b92('0x3a')](_0x4ddbf7[_0x4b92('0x32')][_0x4b92('0x3a')]);_0x1a7e7b[_0x4b92('0x3c')]=qs[_0x4b92('0x34')](_[_0x4b92('0x3b')](_0x4ddbf7[_0x4b92('0x32')],_0xf06456[_0x4b92('0x34')]));if(_0x4ddbf7[_0x4b92('0x32')][_0x4b92('0x3f')]){_0x1a7e7b[_0x4b92('0x3c')]=_[_0x4b92('0x3d')](_0x1a7e7b['where'],{'$or':_[_0x4b92('0x2c')](_0x1a7e7b[_0x4b92('0x37')],function(_0x2a8072){var _0x1e690e={};_0x1e690e[_0x2a8072]={'$like':'%'+_0x4ddbf7[_0x4b92('0x32')][_0x4b92('0x3f')]+'%'};return _0x1e690e;})});}_0x1a7e7b=_[_0x4b92('0x3d')]({},_0x1a7e7b,_0x4ddbf7[_0x4b92('0x40')]);return _0x19b27d['getTeams'](_0x1a7e7b);}})[_0x4b92('0x24')](function(_0x1ff5eb){if(_0x1ff5eb){_0x181cb0=_0x1ff5eb[_0x4b92('0x38')];if(!_0x4ddbf7[_0x4b92('0x32')][_0x4b92('0x61')](_0x4b92('0x39'))){_0x1a7e7b['limit']=qs['limit'](_0x4ddbf7[_0x4b92('0x32')][_0x4b92('0x1f')]);_0x1a7e7b[_0x4b92('0x1e')]=qs[_0x4b92('0x1e')](_0x4ddbf7[_0x4b92('0x32')][_0x4b92('0x1e')]);}return _0x19b27d[_0x4b92('0x62')](_0x1a7e7b);}})['then'](function(_0x3e42a4){if(_0x3e42a4){return _0x3e42a4?{'count':_0x181cb0,'rows':_0x3e42a4}:null;}})[_0x4b92('0x24')](respondWithResult(_0x26c4ba,null))[_0x4b92('0x44')](handleError(_0x26c4ba,null));};exports[_0x4b92('0x63')]=function(_0x181452,_0x45c74d,_0x303771){var _0x437a86=_0x181452[_0x4b92('0x4a')][_0x4b92('0x64')];return db[_0x4b92('0x60')][_0x4b92('0x56')]({'where':{'id':_0x437a86},'attributes':['id'],'include':[{'model':db[_0x4b92('0x57')],'as':_0x4b92('0x65'),'attributes':['id',_0x4b92('0x29'),_0x4b92('0x66'),_0x4b92('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x191250){if(_0x191250){var _0x4fbd0=_[_0x4b92('0x68')](_0x191250,function(_0xadf2bd){var _0x593008=_0xadf2bd[_0x4b92('0x4c')]({'plain':!![]});return _0x593008[_0x4b92('0x65')];});return db[_0x4b92('0x2d')][_0x4b92('0x48')]({'where':{'id':_0x181452['params']['id']}})[_0x4b92('0x24')](function(_0x290a94){return db[_0x4b92('0x69')][_0x4b92('0x6a')](function(_0x112970){return _0x290a94[_0x4b92('0x63')](_0x437a86,{'transaction':_0x112970})[_0x4b92('0x24')](function(){return BPromise[_0x4b92('0x6b')](_0x4fbd0,function(_0x392fcf){return db[_0x4b92('0x53')][_0x4b92('0x6c')]({'where':{'UserId':_0x392fcf['id'],'FaxQueueId':_0x181452[_0x4b92('0x46')]['id']},'transaction':_0x112970});});})[_0x4b92('0x24')](function(){_0x4fbd0['forEach'](function(_0xc3248d){socket[_0x4b92('0x6d')](_0x4b92('0x6e'),{'UserId':_0xc3248d['id'],'FaxQueueId':_0x290a94['id']});});});});});}})[_0x4b92('0x24')](respondWithStatusCode(_0x45c74d,null))['catch'](handleError(_0x45c74d,null));};exports['removeTeams']=function(_0xfc5563,_0x14d84b,_0xd5aa4e){return db['Team'][_0x4b92('0x56')]({'where':{'id':_0xfc5563['query'][_0x4b92('0x64')]},'attributes':['id'],'include':[{'model':db[_0x4b92('0x57')],'as':_0x4b92('0x65'),'attributes':['id'],'raw':!![]}]})[_0x4b92('0x24')](handleEntityNotFound(_0x14d84b,null))[_0x4b92('0x24')](function(_0x58ecba){var _0x49d991=_[_0x4b92('0x2c')](_0x58ecba,'id');var _0x4f6072=[];var _0x43b84b=[];var _0x43fb41=squel['select']();_0x43fb41[_0x4b92('0x6f')](_0x4b92('0x70'))['from']('team_has_fax_queues','tq')[_0x4b92('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4b92('0x3c')]('FaxQueueId\x20=\x20?',_0xfc5563[_0x4b92('0x46')]['id']);for(var _0x4dd740=0x0;_0x4dd740<_0x58ecba[_0x4b92('0x38')];_0x4dd740+=0x1){let _0x587ac1=_0x58ecba[_0x4dd740];for(var _0x26cdbd=0x0;_0x26cdbd<_0x587ac1[_0x4b92('0x65')][_0x4b92('0x38')];_0x26cdbd+=0x1){let _0x47e0=_0x587ac1[_0x4b92('0x65')][_0x26cdbd];var _0x85e6c=_0x43fb41[_0x4b92('0x72')]();_0x85e6c[_0x4b92('0x3c')](_0x4b92('0x73'),_0x47e0['id']);_0x43b84b[_0x4b92('0x74')](db[_0x4b92('0x69')][_0x4b92('0x32')](_0x85e6c[_0x4b92('0x75')](),{'type':db['sequelize'][_0x4b92('0x76')][_0x4b92('0x77')]})[_0x4b92('0x24')](function(_0x536dc3){if(_0x536dc3[_0x4b92('0x38')]===0x1){return _0x47e0['id'];}else{var _0x54634c=_[_0x4b92('0x78')](_['map'](_0x536dc3,_0x4b92('0x79')),function(_0x540f8a){return _[_0x4b92('0x7a')](_0x49d991,_0x540f8a);});if(_0x54634c){return _0x47e0['id'];}}}));}}return BPromise['all'](_0x43b84b)[_0x4b92('0x24')](function(_0x181103){_0x4f6072=_(_0x4f6072)[_0x4b92('0x7b')](_0x181103)[_0x4b92('0x7c')]()[_0x4b92('0x7d')]();return db[_0x4b92('0x2d')][_0x4b92('0x48')]({'where':{'id':_0xfc5563['params']['id']}})[_0x4b92('0x24')](function(_0x552863){return db[_0x4b92('0x69')][_0x4b92('0x6a')](function(_0x2dda5b){return _0x552863[_0x4b92('0x7e')](_0xfc5563[_0x4b92('0x32')][_0x4b92('0x64')],{'transaction':_0x2dda5b})[_0x4b92('0x24')](function(){if(!_[_0x4b92('0x7f')](_0x4f6072)){return _0x552863[_0x4b92('0x80')](_0x4f6072,{'transaction':_0x2dda5b});}})['then'](function(){_0x4f6072[_0x4b92('0x81')](function(_0x21fdde){socket['emit'](_0x4b92('0x82'),{'UserId':_0x21fdde,'FaxQueueId':_0x552863['id']});});});});});});})[_0x4b92('0x24')](respondWithStatusCode(_0x14d84b,null))[_0x4b92('0x44')](handleError(_0x14d84b,null));};exports['addAgents']=function(_0x2aab50,_0x24cac5,_0x40b4a1){return db[_0x4b92('0x2d')][_0x4b92('0x48')]({'where':{'id':_0x2aab50[_0x4b92('0x46')]['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x24cac5,null))['then'](function(_0xccc678){if(_0xccc678){return _0xccc678[_0x4b92('0x83')](_0x2aab50[_0x4b92('0x4a')][_0x4b92('0x64')],_[_0x4b92('0x84')](_0x2aab50[_0x4b92('0x4a')],[_0x4b92('0x64'),'id'])||{})[_0x4b92('0x85')](function(_0x1e49cc){for(var _0x3ff81c=0x0;_0x3ff81c<_0x2aab50[_0x4b92('0x4a')][_0x4b92('0x64')][_0x4b92('0x38')];_0x3ff81c+=0x1){socket[_0x4b92('0x6d')](_0x4b92('0x6e'),{'UserId':Number(_0x2aab50[_0x4b92('0x4a')]['ids'][_0x3ff81c]),'FaxQueueId':Number(_0x2aab50[_0x4b92('0x46')]['id'])});}return _0x1e49cc;});}})[_0x4b92('0x24')](respondWithResult(_0x24cac5,null))[_0x4b92('0x44')](handleError(_0x24cac5,null));};exports[_0x4b92('0x80')]=function(_0x5da90,_0x9965f4,_0x9c2dc4){return db[_0x4b92('0x2d')]['find']({'where':{'id':_0x5da90['params']['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x9965f4,null))['then'](function(_0x181a8d){if(_0x181a8d){return _0x181a8d['removeAgents'](_0x5da90[_0x4b92('0x32')][_0x4b92('0x64')])['then'](function(){if(_[_0x4b92('0x86')](_0x5da90[_0x4b92('0x32')][_0x4b92('0x64')])){for(var _0x6ebab9=0x0;_0x6ebab9<_0x5da90['query'][_0x4b92('0x64')]['length'];_0x6ebab9+=0x1){socket[_0x4b92('0x6d')](_0x4b92('0x82'),{'UserId':Number(_0x5da90[_0x4b92('0x32')][_0x4b92('0x64')][_0x6ebab9]),'FaxQueueId':Number(_0x5da90[_0x4b92('0x46')]['id'])});}}else{socket[_0x4b92('0x6d')](_0x4b92('0x82'),{'UserId':Number(_0x5da90[_0x4b92('0x32')][_0x4b92('0x64')]),'FaxQueueId':Number(_0x5da90['params']['id'])});}});}})[_0x4b92('0x24')](respondWithStatusCode(_0x9965f4,null))['catch'](handleError(_0x9965f4,null));};exports['getAgents']=function(_0x5d6dd1,_0x35ce38,_0x18f2ac){var _0x14ddf1={};var _0x4eac55={};var _0x47f410;var _0x4db8de;return db[_0x4b92('0x2d')]['findOne']({'where':{'id':_0x5d6dd1['params']['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x35ce38,null))[_0x4b92('0x24')](function(_0x4b4613){if(_0x4b4613){_0x47f410=_0x4b4613;_0x4eac55[_0x4b92('0x36')]=_['keys'](db[_0x4b92('0x57')][_0x4b92('0x2e')]);_0x4eac55[_0x4b92('0x32')]=_['keys'](_0x5d6dd1['query']);_0x4eac55[_0x4b92('0x34')]=_['intersection'](_0x4eac55[_0x4b92('0x36')],_0x4eac55['query']);_0x14ddf1[_0x4b92('0x37')]=_['intersection'](_0x4eac55[_0x4b92('0x36')],qs[_0x4b92('0x47')](_0x5d6dd1[_0x4b92('0x32')][_0x4b92('0x47')]));_0x14ddf1[_0x4b92('0x37')]=_0x14ddf1['attributes'][_0x4b92('0x38')]?_0x14ddf1[_0x4b92('0x37')]:_0x4eac55[_0x4b92('0x36')];_0x14ddf1[_0x4b92('0x54')]=qs[_0x4b92('0x3a')](_0x5d6dd1['query'][_0x4b92('0x3a')]);_0x14ddf1['where']=qs['filters'](_[_0x4b92('0x3b')](_0x5d6dd1[_0x4b92('0x32')],_0x4eac55[_0x4b92('0x34')]));if(_0x5d6dd1[_0x4b92('0x32')][_0x4b92('0x3f')]){_0x14ddf1[_0x4b92('0x3c')]=_[_0x4b92('0x3d')](_0x14ddf1[_0x4b92('0x3c')],{'$or':_[_0x4b92('0x2c')](_0x14ddf1[_0x4b92('0x37')],function(_0x253556){var _0x2e34b1={};_0x2e34b1[_0x253556]={'$like':'%'+_0x5d6dd1[_0x4b92('0x32')][_0x4b92('0x3f')]+'%'};return _0x2e34b1;})});}_0x14ddf1=_['merge']({},_0x14ddf1,_0x5d6dd1[_0x4b92('0x40')]);return _0x47f410[_0x4b92('0x87')](_0x14ddf1);}})[_0x4b92('0x24')](function(_0x174732){if(_0x174732){_0x4db8de=_0x174732['length'];if(!_0x5d6dd1[_0x4b92('0x32')]['hasOwnProperty'](_0x4b92('0x39'))){_0x14ddf1[_0x4b92('0x1f')]=qs[_0x4b92('0x1f')](_0x5d6dd1[_0x4b92('0x32')][_0x4b92('0x1f')]);_0x14ddf1[_0x4b92('0x1e')]=qs[_0x4b92('0x1e')](_0x5d6dd1[_0x4b92('0x32')][_0x4b92('0x1e')]);}return _0x47f410[_0x4b92('0x87')](_0x14ddf1);}})[_0x4b92('0x24')](function(_0x33e99d){if(_0x33e99d){return _0x33e99d?{'count':_0x4db8de,'rows':_0x33e99d}:null;}})[_0x4b92('0x24')](respondWithResult(_0x35ce38,null))[_0x4b92('0x44')](handleError(_0x35ce38,null));}; \ No newline at end of file +var _0xfe75=['describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','TeamId','includes','all','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','options','includeAll','FaxQueue','findAll','rows','catch','show','merge','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','params'];(function(_0x113da7,_0x376fad){var _0x1ba5ba=function(_0x5e2f67){while(--_0x5e2f67){_0x113da7['push'](_0x113da7['shift']());}};_0x1ba5ba(++_0x376fad);}(_0xfe75,0x1d3));var _0x5fe7=function(_0x48040e,_0x414ca5){_0x48040e=_0x48040e-0x0;var _0xc35ffb=_0xfe75[_0x48040e];return _0xc35ffb;};'use strict';var emlformat=require(_0x5fe7('0x0'));var rimraf=require(_0x5fe7('0x1'));var zipdir=require(_0x5fe7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5fe7('0x3'));var BPromise=require(_0x5fe7('0x4'));var Mustache=require('mustache');var util=require(_0x5fe7('0x5'));var path=require(_0x5fe7('0x6'));var sox=require(_0x5fe7('0x7'));var csv=require(_0x5fe7('0x8'));var ejs=require(_0x5fe7('0x9'));var fs=require('fs');var fs_extra=require(_0x5fe7('0xa'));var _=require(_0x5fe7('0xb'));var squel=require('squel');var crypto=require(_0x5fe7('0xc'));var jsforce=require(_0x5fe7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5fe7('0x8'));var querystring=require(_0x5fe7('0xe'));var Papa=require(_0x5fe7('0xf'));var Redis=require(_0x5fe7('0x10'));var authService=require(_0x5fe7('0x11'));var qs=require(_0x5fe7('0x12'));var as=require(_0x5fe7('0x13'));var hardwareService=require(_0x5fe7('0x14'));var logger=require('../../config/logger')(_0x5fe7('0x15'));var utils=require(_0x5fe7('0x16'));var config=require(_0x5fe7('0x17'));var licenseUtil=require(_0x5fe7('0x18'));var db=require('../../mysqldb')['db'];config[_0x5fe7('0x19')]=_[_0x5fe7('0x1a')](config[_0x5fe7('0x19')],{'host':_0x5fe7('0x1b'),'port':0x18eb});var socket=require(_0x5fe7('0x1c'))(new Redis(config[_0x5fe7('0x19')]));require(_0x5fe7('0x1d'))[_0x5fe7('0x1e')](socket);function respondWithStatusCode(_0x10b3c0,_0x261a01){_0x261a01=_0x261a01||0xcc;return function(_0x3df9a8){if(_0x3df9a8){return _0x10b3c0[_0x5fe7('0x1f')](_0x261a01);}return _0x10b3c0[_0x5fe7('0x20')](_0x261a01)[_0x5fe7('0x21')]();};}function respondWithResult(_0x4cc54c,_0x1975b6){_0x1975b6=_0x1975b6||0xc8;return function(_0x57161a){if(_0x57161a){return _0x4cc54c[_0x5fe7('0x20')](_0x1975b6)[_0x5fe7('0x22')](_0x57161a);}};}function respondWithFilteredResult(_0x359279,_0x3a2a92){return function(_0xefb045){if(_0xefb045){var _0x5830fa=typeof _0x3a2a92[_0x5fe7('0x23')]==='undefined'&&typeof _0x3a2a92[_0x5fe7('0x24')]===_0x5fe7('0x25');var _0xacd77c=_0xefb045[_0x5fe7('0x26')];var _0x4f51b8=_0x5830fa?0x0:_0x3a2a92['offset'];var _0x212cc0=_0x5830fa?_0xefb045[_0x5fe7('0x26')]:_0x3a2a92[_0x5fe7('0x23')]+_0x3a2a92[_0x5fe7('0x24')];var _0x410164;if(_0x212cc0>=_0xacd77c){_0x212cc0=_0xacd77c;_0x410164=0xc8;}else{_0x410164=0xce;}_0x359279['status'](_0x410164);return _0x359279[_0x5fe7('0x27')](_0x5fe7('0x28'),_0x4f51b8+'-'+_0x212cc0+'/'+_0xacd77c)[_0x5fe7('0x22')](_0xefb045);}return null;};}function patchUpdates(_0x7d7ebf){return function(_0x4d48d3){try{jsonpatch['apply'](_0x4d48d3,_0x7d7ebf,!![]);}catch(_0x2e71fe){return BPromise[_0x5fe7('0x29')](_0x2e71fe);}return _0x4d48d3[_0x5fe7('0x2a')]();};}function saveUpdates(_0x1a24b8,_0x22bad7){return function(_0x428824){if(_0x428824){return _0x428824[_0x5fe7('0x2b')](_0x1a24b8)[_0x5fe7('0x2c')](function(_0xdacb55){return _0xdacb55;});}return null;};}function removeEntity(_0x56558a,_0x4c91e5){return function(_0x49fe1d){if(_0x49fe1d){return _0x49fe1d['destroy']()['then'](function(){var _0x45d7a5=_0x49fe1d[_0x5fe7('0x2d')]({'plain':!![]});var _0x428632=_0x5fe7('0x2e');return db[_0x5fe7('0x2f')][_0x5fe7('0x30')]({'where':{'type':_0x428632,'resourceId':_0x45d7a5['id']}})['then'](function(){return _0x49fe1d;});})[_0x5fe7('0x2c')](function(){_0x56558a[_0x5fe7('0x20')](0xcc)[_0x5fe7('0x21')]();});}};}function handleEntityNotFound(_0x3590db,_0x5cca06){return function(_0x1ca20d){if(!_0x1ca20d){_0x3590db[_0x5fe7('0x1f')](0x194);}return _0x1ca20d;};}function handleError(_0x13298d,_0x3f04fb){_0x3f04fb=_0x3f04fb||0x1f4;return function(_0x367984){logger[_0x5fe7('0x31')](_0x367984[_0x5fe7('0x32')]);if(_0x367984[_0x5fe7('0x33')]){delete _0x367984[_0x5fe7('0x33')];}_0x13298d['status'](_0x3f04fb)[_0x5fe7('0x34')](_0x367984);};}exports[_0x5fe7('0x35')]=function(_0x3a8062,_0x5e3cf5){var _0x575f80={},_0xddfd38={},_0x2a2a8e={'count':0x0,'rows':[]};var _0x34c915=_[_0x5fe7('0x36')](db['FaxQueue'][_0x5fe7('0x37')],function(_0x4d9528){return{'name':_0x4d9528[_0x5fe7('0x38')],'type':_0x4d9528['type']['key']};});_0xddfd38[_0x5fe7('0x39')]=_[_0x5fe7('0x36')](_0x34c915,_0x5fe7('0x33'));_0xddfd38[_0x5fe7('0x3a')]=_[_0x5fe7('0x3b')](_0x3a8062[_0x5fe7('0x3a')]);_0xddfd38['filters']=_[_0x5fe7('0x3c')](_0xddfd38[_0x5fe7('0x39')],_0xddfd38['query']);_0x575f80['attributes']=_['intersection'](_0xddfd38[_0x5fe7('0x39')],qs[_0x5fe7('0x3d')](_0x3a8062[_0x5fe7('0x3a')][_0x5fe7('0x3d')]));_0x575f80[_0x5fe7('0x3e')]=_0x575f80[_0x5fe7('0x3e')][_0x5fe7('0x3f')]?_0x575f80[_0x5fe7('0x3e')]:_0xddfd38[_0x5fe7('0x39')];if(!_0x3a8062[_0x5fe7('0x3a')]['hasOwnProperty'](_0x5fe7('0x40'))){_0x575f80[_0x5fe7('0x24')]=qs[_0x5fe7('0x24')](_0x3a8062[_0x5fe7('0x3a')][_0x5fe7('0x24')]);_0x575f80[_0x5fe7('0x23')]=qs[_0x5fe7('0x23')](_0x3a8062[_0x5fe7('0x3a')][_0x5fe7('0x23')]);}_0x575f80[_0x5fe7('0x41')]=qs[_0x5fe7('0x42')](_0x3a8062['query'][_0x5fe7('0x42')]);_0x575f80[_0x5fe7('0x43')]=qs['filters'](_[_0x5fe7('0x44')](_0x3a8062[_0x5fe7('0x3a')],_0xddfd38[_0x5fe7('0x45')]),_0x34c915);if(_0x3a8062[_0x5fe7('0x3a')][_0x5fe7('0x46')]){_0x575f80[_0x5fe7('0x43')]=_['merge'](_0x575f80['where'],{'$or':_[_0x5fe7('0x36')](_0x34c915,function(_0x1f3f87){if(_0x1f3f87[_0x5fe7('0x47')]!==_0x5fe7('0x48')){var _0x11aa37={};_0x11aa37[_0x1f3f87[_0x5fe7('0x33')]]={'$like':'%'+_0x3a8062[_0x5fe7('0x3a')][_0x5fe7('0x46')]+'%'};return _0x11aa37;}})});}_0x575f80=_['merge']({},_0x575f80,_0x3a8062[_0x5fe7('0x49')]);var _0x22cf6c={'where':_0x575f80[_0x5fe7('0x43')]};return db['FaxQueue'][_0x5fe7('0x26')](_0x22cf6c)[_0x5fe7('0x2c')](function(_0x3697a5){_0x2a2a8e[_0x5fe7('0x26')]=_0x3697a5;if(_0x3a8062['query'][_0x5fe7('0x4a')]){_0x575f80['include']=[{'all':!![]}];}return db[_0x5fe7('0x4b')][_0x5fe7('0x4c')](_0x575f80);})[_0x5fe7('0x2c')](function(_0x3aca27){_0x2a2a8e[_0x5fe7('0x4d')]=_0x3aca27;return _0x2a2a8e;})[_0x5fe7('0x2c')](respondWithFilteredResult(_0x5e3cf5,_0x575f80))[_0x5fe7('0x4e')](handleError(_0x5e3cf5,null));};exports[_0x5fe7('0x4f')]=function(_0x39cbf5,_0x538b1f){var _0x829f4a={'raw':!![],'where':{'id':_0x39cbf5['params']['id']}},_0x1c8696={};_0x1c8696[_0x5fe7('0x39')]=_[_0x5fe7('0x3b')](db[_0x5fe7('0x4b')][_0x5fe7('0x37')]);_0x1c8696[_0x5fe7('0x3a')]=_[_0x5fe7('0x3b')](_0x39cbf5[_0x5fe7('0x3a')]);_0x1c8696[_0x5fe7('0x45')]=_['intersection'](_0x1c8696['model'],_0x1c8696[_0x5fe7('0x3a')]);_0x829f4a[_0x5fe7('0x3e')]=_[_0x5fe7('0x3c')](_0x1c8696[_0x5fe7('0x39')],qs['fields'](_0x39cbf5[_0x5fe7('0x3a')][_0x5fe7('0x3d')]));_0x829f4a[_0x5fe7('0x3e')]=_0x829f4a[_0x5fe7('0x3e')][_0x5fe7('0x3f')]?_0x829f4a[_0x5fe7('0x3e')]:_0x1c8696[_0x5fe7('0x39')];if(_0x39cbf5[_0x5fe7('0x3a')][_0x5fe7('0x4a')]){_0x829f4a['include']=[{'all':!![]}];}_0x829f4a=_[_0x5fe7('0x50')]({},_0x829f4a,_0x39cbf5['options']);return db['FaxQueue'][_0x5fe7('0x51')](_0x829f4a)[_0x5fe7('0x2c')](handleEntityNotFound(_0x538b1f,null))[_0x5fe7('0x2c')](respondWithResult(_0x538b1f,null))[_0x5fe7('0x4e')](handleError(_0x538b1f,null));};exports[_0x5fe7('0x52')]=function(_0x4efc70,_0x48e75d){return db[_0x5fe7('0x4b')]['create'](_0x4efc70['body'],{})[_0x5fe7('0x2c')](function(_0x2c2986){var _0x4356a1=_0x4efc70[_0x5fe7('0x53')][_0x5fe7('0x2d')]({'plain':!![]});if(!_0x4356a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4356a1['role']===_0x5fe7('0x53')){var _0x47e211=_0x2c2986[_0x5fe7('0x2d')]({'plain':!![]});var _0x1199f4=_0x5fe7('0x2e');return db[_0x5fe7('0x54')][_0x5fe7('0x51')]({'where':{'name':_0x1199f4,'userProfileId':_0x4356a1[_0x5fe7('0x55')]},'raw':!![]})[_0x5fe7('0x2c')](function(_0x524198){if(_0x524198&&_0x524198[_0x5fe7('0x56')]===0x0){return db[_0x5fe7('0x2f')][_0x5fe7('0x52')]({'name':_0x47e211[_0x5fe7('0x33')],'resourceId':_0x47e211['id'],'type':_0x524198[_0x5fe7('0x33')],'sectionId':_0x524198['id']},{})[_0x5fe7('0x2c')](function(){return _0x2c2986;});}else{return _0x2c2986;}})[_0x5fe7('0x4e')](function(_0x4df5e2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4df5e2);throw _0x4df5e2;});}return _0x2c2986;})['then'](respondWithResult(_0x48e75d,0xc9))[_0x5fe7('0x4e')](handleError(_0x48e75d,null));};exports['update']=function(_0xaec47b,_0x3c57bf){if(_0xaec47b[_0x5fe7('0x57')]['id']){delete _0xaec47b['body']['id'];}return db[_0x5fe7('0x4b')]['find']({'where':{'id':_0xaec47b[_0x5fe7('0x58')]['id']}})[_0x5fe7('0x2c')](handleEntityNotFound(_0x3c57bf,null))[_0x5fe7('0x2c')](saveUpdates(_0xaec47b[_0x5fe7('0x57')],null))[_0x5fe7('0x2c')](respondWithResult(_0x3c57bf,null))['catch'](handleError(_0x3c57bf,null));};exports[_0x5fe7('0x30')]=function(_0x51d6f8,_0x139660){return db['FaxQueue'][_0x5fe7('0x51')]({'where':{'id':_0x51d6f8['params']['id']}})[_0x5fe7('0x2c')](handleEntityNotFound(_0x139660,null))[_0x5fe7('0x2c')](removeEntity(_0x139660,null))[_0x5fe7('0x4e')](handleError(_0x139660,null));};exports[_0x5fe7('0x59')]=function(_0x149366,_0xd05f9a){return db['FaxQueue'][_0x5fe7('0x59')]()['then'](respondWithResult(_0xd05f9a,null))[_0x5fe7('0x4e')](handleError(_0xd05f9a,null));};exports[_0x5fe7('0x5a')]=function(_0x177f41,_0x2c9609,_0x279ef4){var _0x22b6c4={'raw':!![],'where':{}},_0x4045e6={},_0x510fd7;return db[_0x5fe7('0x4b')][_0x5fe7('0x5b')]({'where':{'id':_0x177f41[_0x5fe7('0x58')]['id']}})['then'](handleEntityNotFound(_0x2c9609,null))[_0x5fe7('0x2c')](function(_0x492fe7){if(_0x492fe7){_0x510fd7=_0x492fe7[_0x5fe7('0x2d')]({'plain':!![]});_0x4045e6[_0x5fe7('0x39')]=_[_0x5fe7('0x3b')](db[_0x5fe7('0x5c')]['rawAttributes']);_0x4045e6[_0x5fe7('0x3a')]=_[_0x5fe7('0x3b')](_0x177f41[_0x5fe7('0x3a')]);_0x4045e6[_0x5fe7('0x45')]=_['intersection'](_0x4045e6['model'],_0x4045e6[_0x5fe7('0x3a')]);_0x22b6c4[_0x5fe7('0x3e')]=_['intersection'](_0x4045e6['model'],qs[_0x5fe7('0x3d')](_0x177f41[_0x5fe7('0x3a')][_0x5fe7('0x3d')]));_0x22b6c4[_0x5fe7('0x3e')]=_0x22b6c4[_0x5fe7('0x3e')]['length']?_0x22b6c4[_0x5fe7('0x3e')]:_0x4045e6['model'];if(!_0x177f41['query'][_0x5fe7('0x5d')]('nolimit')){_0x22b6c4[_0x5fe7('0x24')]=qs[_0x5fe7('0x24')](_0x177f41[_0x5fe7('0x3a')][_0x5fe7('0x24')]);_0x22b6c4['offset']=qs['offset'](_0x177f41[_0x5fe7('0x3a')]['offset']);}_0x22b6c4[_0x5fe7('0x41')]=qs[_0x5fe7('0x42')](_0x177f41[_0x5fe7('0x3a')][_0x5fe7('0x42')]);_0x22b6c4[_0x5fe7('0x43')]=qs[_0x5fe7('0x45')](_[_0x5fe7('0x44')](_0x177f41[_0x5fe7('0x3a')],_0x4045e6[_0x5fe7('0x45')]));_0x22b6c4[_0x5fe7('0x43')][_0x5fe7('0x5e')]=_0x492fe7['id'];if(_0x177f41[_0x5fe7('0x3a')]['filter']){_0x22b6c4['where']=_[_0x5fe7('0x50')](_0x22b6c4['where'],{'$or':_[_0x5fe7('0x36')](_0x22b6c4[_0x5fe7('0x3e')],function(_0x4f6545){var _0x6510fd={};_0x6510fd[_0x4f6545]={'$like':'%'+_0x177f41[_0x5fe7('0x3a')][_0x5fe7('0x46')]+'%'};return _0x6510fd;})});}_0x22b6c4=_[_0x5fe7('0x50')]({},_0x22b6c4,_0x177f41[_0x5fe7('0x49')]);return db[_0x5fe7('0x5c')][_0x5fe7('0x4c')](_0x22b6c4);}})[_0x5fe7('0x2c')](function(_0x24182d){if(_0x24182d){return db[_0x5fe7('0x5f')][_0x5fe7('0x60')]({'where':{'id':_[_0x5fe7('0x36')](_0x24182d,'UserId'),'role':_0x5fe7('0x61')},'attributes':['id',_0x5fe7('0x33'),_0x5fe7('0x62'),_0x5fe7('0x63'),_0x5fe7('0x64')]});}})['then'](function(_0xedc73c){if(_0xedc73c){return{'count':_0xedc73c['count'],'rows':_['map'](_0xedc73c[_0x5fe7('0x4d')],function(_0x193988){return{'membername':_0x193988[_0x5fe7('0x33')],'UserId':_0x193988['id'],'queue_name':_0x510fd7[_0x5fe7('0x33')],'FaxQueueId':_0x510fd7['id'],'interface':util[_0x5fe7('0x65')](_0x5fe7('0x66'),_0x5fe7('0x67'),_0x193988[_0x5fe7('0x33')]),'penalty':0x0,'paused':_0x193988[_0x5fe7('0x62')],'createdAt':_0x193988['createdAt'],'updatedAt':_0x193988['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5fe7('0x2c')](respondWithFilteredResult(_0x2c9609,_0x22b6c4))[_0x5fe7('0x4e')](handleError(_0x2c9609,null));};exports['getTeams']=function(_0x40afb8,_0x18227c,_0x151bae){var _0x9f69ac={};var _0x52da57={};var _0x3582f4;var _0x28079f;return db['FaxQueue'][_0x5fe7('0x5b')]({'where':{'id':_0x40afb8[_0x5fe7('0x58')]['id']}})[_0x5fe7('0x2c')](handleEntityNotFound(_0x18227c,null))[_0x5fe7('0x2c')](function(_0x55eeb0){if(_0x55eeb0){_0x3582f4=_0x55eeb0;_0x52da57[_0x5fe7('0x39')]=_[_0x5fe7('0x3b')](db[_0x5fe7('0x68')][_0x5fe7('0x37')]);_0x52da57['query']=_['keys'](_0x40afb8[_0x5fe7('0x3a')]);_0x52da57[_0x5fe7('0x45')]=_[_0x5fe7('0x3c')](_0x52da57[_0x5fe7('0x39')],_0x52da57['query']);_0x9f69ac[_0x5fe7('0x3e')]=_[_0x5fe7('0x3c')](_0x52da57[_0x5fe7('0x39')],qs[_0x5fe7('0x3d')](_0x40afb8[_0x5fe7('0x3a')][_0x5fe7('0x3d')]));_0x9f69ac['attributes']=_0x9f69ac[_0x5fe7('0x3e')]['length']?_0x9f69ac[_0x5fe7('0x3e')]:_0x52da57[_0x5fe7('0x39')];_0x9f69ac[_0x5fe7('0x41')]=qs['sort'](_0x40afb8['query'][_0x5fe7('0x42')]);_0x9f69ac[_0x5fe7('0x43')]=qs[_0x5fe7('0x45')](_[_0x5fe7('0x44')](_0x40afb8[_0x5fe7('0x3a')],_0x52da57[_0x5fe7('0x45')]));if(_0x40afb8['query']['filter']){_0x9f69ac[_0x5fe7('0x43')]=_[_0x5fe7('0x50')](_0x9f69ac[_0x5fe7('0x43')],{'$or':_[_0x5fe7('0x36')](_0x9f69ac['attributes'],function(_0x1a1d7b){var _0x7b48aa={};_0x7b48aa[_0x1a1d7b]={'$like':'%'+_0x40afb8[_0x5fe7('0x3a')][_0x5fe7('0x46')]+'%'};return _0x7b48aa;})});}_0x9f69ac=_[_0x5fe7('0x50')]({},_0x9f69ac,_0x40afb8['options']);return _0x3582f4['getTeams'](_0x9f69ac);}})[_0x5fe7('0x2c')](function(_0x11f909){if(_0x11f909){_0x28079f=_0x11f909[_0x5fe7('0x3f')];if(!_0x40afb8[_0x5fe7('0x3a')]['hasOwnProperty'](_0x5fe7('0x40'))){_0x9f69ac['limit']=qs[_0x5fe7('0x24')](_0x40afb8[_0x5fe7('0x3a')]['limit']);_0x9f69ac[_0x5fe7('0x23')]=qs[_0x5fe7('0x23')](_0x40afb8[_0x5fe7('0x3a')][_0x5fe7('0x23')]);}return _0x3582f4['getTeams'](_0x9f69ac);}})[_0x5fe7('0x2c')](function(_0x497f91){if(_0x497f91){return _0x497f91?{'count':_0x28079f,'rows':_0x497f91}:null;}})[_0x5fe7('0x2c')](respondWithResult(_0x18227c,null))[_0x5fe7('0x4e')](handleError(_0x18227c,null));};exports[_0x5fe7('0x69')]=function(_0x912bb4,_0x3449a1,_0x1fcf92){var _0x196688=_0x912bb4[_0x5fe7('0x57')][_0x5fe7('0x6a')];return db[_0x5fe7('0x68')][_0x5fe7('0x4c')]({'where':{'id':_0x196688},'attributes':['id'],'include':[{'model':db[_0x5fe7('0x5f')],'as':_0x5fe7('0x6b'),'attributes':['id',_0x5fe7('0x33'),_0x5fe7('0x6c'),_0x5fe7('0x6d'),_0x5fe7('0x6e')],'raw':!![]}]})['then'](function(_0x36b1da){if(_0x36b1da){var _0x4c47fd=_[_0x5fe7('0x6f')](_0x36b1da,function(_0xe0adef){var _0x41a186=_0xe0adef[_0x5fe7('0x2d')]({'plain':!![]});return _0x41a186['Agents'];});return db[_0x5fe7('0x4b')][_0x5fe7('0x51')]({'where':{'id':_0x912bb4['params']['id']}})[_0x5fe7('0x2c')](function(_0x2d4dbb){return db[_0x5fe7('0x70')][_0x5fe7('0x71')](function(_0x479dce){return _0x2d4dbb[_0x5fe7('0x69')](_0x196688,{'transaction':_0x479dce})['then'](function(){return BPromise[_0x5fe7('0x72')](_0x4c47fd,function(_0x231768){return db[_0x5fe7('0x5c')]['findOrCreate']({'where':{'UserId':_0x231768['id'],'FaxQueueId':_0x912bb4['params']['id']},'transaction':_0x479dce});});})[_0x5fe7('0x2c')](function(){_0x4c47fd[_0x5fe7('0x73')](function(_0x743d48){socket[_0x5fe7('0x74')](_0x5fe7('0x75'),{'UserId':_0x743d48['id'],'FaxQueueId':_0x2d4dbb['id']});});});});});}})[_0x5fe7('0x2c')](respondWithStatusCode(_0x3449a1,null))[_0x5fe7('0x4e')](handleError(_0x3449a1,null));};exports[_0x5fe7('0x76')]=function(_0x41dbbb,_0x3c68b0,_0x52d9f1){return db[_0x5fe7('0x68')]['findAll']({'where':{'id':_0x41dbbb[_0x5fe7('0x3a')][_0x5fe7('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5fe7('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x5fe7('0x2c')](handleEntityNotFound(_0x3c68b0,null))['then'](function(_0x2ae0d9){var _0x514175=_[_0x5fe7('0x36')](_0x2ae0d9,'id');var _0x492619=[];var _0xbdde0=[];var _0x175626=squel[_0x5fe7('0x77')]();_0x175626['field'](_0x5fe7('0x78'))[_0x5fe7('0x79')](_0x5fe7('0x7a'),'tq')[_0x5fe7('0x7b')](_0x5fe7('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5fe7('0x43')](_0x5fe7('0x7d'),_0x41dbbb['params']['id']);for(var _0x85f4d7=0x0;_0x85f4d7<_0x2ae0d9[_0x5fe7('0x3f')];_0x85f4d7+=0x1){let _0x1f14d5=_0x2ae0d9[_0x85f4d7];for(var _0x4a694b=0x0;_0x4a694b<_0x1f14d5[_0x5fe7('0x6b')][_0x5fe7('0x3f')];_0x4a694b+=0x1){let _0x58dad9=_0x1f14d5[_0x5fe7('0x6b')][_0x4a694b];var _0x1211f6=_0x175626[_0x5fe7('0x7e')]();_0x1211f6[_0x5fe7('0x43')](_0x5fe7('0x7f'),_0x58dad9['id']);_0xbdde0[_0x5fe7('0x80')](db[_0x5fe7('0x70')]['query'](_0x1211f6['toString'](),{'type':db[_0x5fe7('0x70')]['QueryTypes']['SELECT']})['then'](function(_0x507537){if(_0x507537[_0x5fe7('0x3f')]===0x1){return _0x58dad9['id'];}else{var _0x56802d=_['every'](_[_0x5fe7('0x36')](_0x507537,_0x5fe7('0x81')),function(_0x2a05a9){return _[_0x5fe7('0x82')](_0x514175,_0x2a05a9);});if(_0x56802d){return _0x58dad9['id'];}}}));}}return BPromise[_0x5fe7('0x83')](_0xbdde0)[_0x5fe7('0x2c')](function(_0x1f51a5){_0x492619=_(_0x492619)['union'](_0x1f51a5)[_0x5fe7('0x84')]()['value']();return db[_0x5fe7('0x4b')]['find']({'where':{'id':_0x41dbbb[_0x5fe7('0x58')]['id']}})['then'](function(_0x29f668){return db[_0x5fe7('0x70')][_0x5fe7('0x71')](function(_0x5525cd){return _0x29f668['removeTeams'](_0x41dbbb[_0x5fe7('0x3a')][_0x5fe7('0x6a')],{'transaction':_0x5525cd})[_0x5fe7('0x2c')](function(){if(!_[_0x5fe7('0x85')](_0x492619)){return _0x29f668[_0x5fe7('0x86')](_0x492619,{'transaction':_0x5525cd});}})[_0x5fe7('0x2c')](function(){_0x492619[_0x5fe7('0x73')](function(_0x1baa97){socket[_0x5fe7('0x74')](_0x5fe7('0x87'),{'UserId':_0x1baa97,'FaxQueueId':_0x29f668['id']});});});});});});})[_0x5fe7('0x2c')](respondWithStatusCode(_0x3c68b0,null))[_0x5fe7('0x4e')](handleError(_0x3c68b0,null));};exports[_0x5fe7('0x88')]=function(_0x3a5859,_0x375ad6,_0x54062e){return db[_0x5fe7('0x4b')][_0x5fe7('0x51')]({'where':{'id':_0x3a5859['params']['id']}})[_0x5fe7('0x2c')](handleEntityNotFound(_0x375ad6,null))['then'](function(_0x5e403a){if(_0x5e403a){return _0x5e403a['addAgents'](_0x3a5859[_0x5fe7('0x57')][_0x5fe7('0x6a')],_[_0x5fe7('0x89')](_0x3a5859[_0x5fe7('0x57')],[_0x5fe7('0x6a'),'id'])||{})['spread'](function(_0x52c3f8){for(var _0x20109e=0x0;_0x20109e<_0x3a5859['body'][_0x5fe7('0x6a')][_0x5fe7('0x3f')];_0x20109e+=0x1){socket[_0x5fe7('0x74')]('userFaxQueue:save',{'UserId':Number(_0x3a5859[_0x5fe7('0x57')]['ids'][_0x20109e]),'FaxQueueId':Number(_0x3a5859[_0x5fe7('0x58')]['id'])});}return _0x52c3f8;});}})[_0x5fe7('0x2c')](respondWithResult(_0x375ad6,null))['catch'](handleError(_0x375ad6,null));};exports['removeAgents']=function(_0x3c3915,_0x552589,_0x1683e8){return db[_0x5fe7('0x4b')][_0x5fe7('0x51')]({'where':{'id':_0x3c3915[_0x5fe7('0x58')]['id']}})[_0x5fe7('0x2c')](handleEntityNotFound(_0x552589,null))[_0x5fe7('0x2c')](function(_0x4190af){if(_0x4190af){return _0x4190af['removeAgents'](_0x3c3915[_0x5fe7('0x3a')][_0x5fe7('0x6a')])[_0x5fe7('0x2c')](function(){if(_['isArray'](_0x3c3915[_0x5fe7('0x3a')][_0x5fe7('0x6a')])){for(var _0x89b44f=0x0;_0x89b44f<_0x3c3915[_0x5fe7('0x3a')]['ids']['length'];_0x89b44f+=0x1){socket[_0x5fe7('0x74')](_0x5fe7('0x87'),{'UserId':Number(_0x3c3915[_0x5fe7('0x3a')][_0x5fe7('0x6a')][_0x89b44f]),'FaxQueueId':Number(_0x3c3915[_0x5fe7('0x58')]['id'])});}}else{socket[_0x5fe7('0x74')](_0x5fe7('0x87'),{'UserId':Number(_0x3c3915[_0x5fe7('0x3a')][_0x5fe7('0x6a')]),'FaxQueueId':Number(_0x3c3915[_0x5fe7('0x58')]['id'])});}});}})[_0x5fe7('0x2c')](respondWithStatusCode(_0x552589,null))['catch'](handleError(_0x552589,null));};exports[_0x5fe7('0x8a')]=function(_0x77a009,_0x2fffd6,_0x47745e){var _0xc44e94={};var _0x134840={};var _0x1ba388;var _0x598e86;return db['FaxQueue'][_0x5fe7('0x5b')]({'where':{'id':_0x77a009[_0x5fe7('0x58')]['id']}})['then'](handleEntityNotFound(_0x2fffd6,null))['then'](function(_0x1ec5e4){if(_0x1ec5e4){_0x1ba388=_0x1ec5e4;_0x134840[_0x5fe7('0x39')]=_[_0x5fe7('0x3b')](db[_0x5fe7('0x5f')][_0x5fe7('0x37')]);_0x134840['query']=_[_0x5fe7('0x3b')](_0x77a009['query']);_0x134840[_0x5fe7('0x45')]=_[_0x5fe7('0x3c')](_0x134840[_0x5fe7('0x39')],_0x134840[_0x5fe7('0x3a')]);_0xc44e94['attributes']=_['intersection'](_0x134840[_0x5fe7('0x39')],qs[_0x5fe7('0x3d')](_0x77a009[_0x5fe7('0x3a')][_0x5fe7('0x3d')]));_0xc44e94[_0x5fe7('0x3e')]=_0xc44e94['attributes'][_0x5fe7('0x3f')]?_0xc44e94['attributes']:_0x134840['model'];_0xc44e94['order']=qs[_0x5fe7('0x42')](_0x77a009[_0x5fe7('0x3a')][_0x5fe7('0x42')]);_0xc44e94['where']=qs[_0x5fe7('0x45')](_[_0x5fe7('0x44')](_0x77a009[_0x5fe7('0x3a')],_0x134840['filters']));if(_0x77a009[_0x5fe7('0x3a')][_0x5fe7('0x46')]){_0xc44e94[_0x5fe7('0x43')]=_[_0x5fe7('0x50')](_0xc44e94[_0x5fe7('0x43')],{'$or':_[_0x5fe7('0x36')](_0xc44e94[_0x5fe7('0x3e')],function(_0x2c86b0){var _0x1baca6={};_0x1baca6[_0x2c86b0]={'$like':'%'+_0x77a009[_0x5fe7('0x3a')][_0x5fe7('0x46')]+'%'};return _0x1baca6;})});}_0xc44e94=_['merge']({},_0xc44e94,_0x77a009[_0x5fe7('0x49')]);return _0x1ba388['getAgents'](_0xc44e94);}})['then'](function(_0x4d9c49){if(_0x4d9c49){_0x598e86=_0x4d9c49['length'];if(!_0x77a009[_0x5fe7('0x3a')][_0x5fe7('0x5d')](_0x5fe7('0x40'))){_0xc44e94[_0x5fe7('0x24')]=qs[_0x5fe7('0x24')](_0x77a009['query'][_0x5fe7('0x24')]);_0xc44e94['offset']=qs['offset'](_0x77a009[_0x5fe7('0x3a')]['offset']);}return _0x1ba388['getAgents'](_0xc44e94);}})['then'](function(_0x1df2df){if(_0x1df2df){return _0x1df2df?{'count':_0x598e86,'rows':_0x1df2df}:null;}})[_0x5fe7('0x2c')](respondWithResult(_0x2fffd6,null))[_0x5fe7('0x4e')](handleError(_0x2fffd6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c7f761c..b8e9574 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 _0xaa1c=['exports','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x5dd800,_0x5d7d01){var _0x6966b0=function(_0x392464){while(--_0x392464){_0x5dd800['push'](_0x5dd800['shift']());}};_0x6966b0(++_0x5d7d01);}(_0xaa1c,0x9b));var _0xcaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1c[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xcaa1('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcaa1('0x1'),'afterDestroy':_0xcaa1('0x2')};function emitEvent(_0x3badd3){return function(_0x43a699,_0x300f28,_0x2120b0){FaxQueueEvents[_0xcaa1('0x3')](_0x3badd3+':'+_0x43a699['id'],_0x43a699);FaxQueueEvents['emit'](_0x3badd3,_0x43a699);_0x2120b0(null);};}for(var e in events){if(events[_0xcaa1('0x4')](e)){var event=events[e];FaxQueue[_0xcaa1('0x5')](e,emitEvent(event));}}module[_0xcaa1('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x1750=['update','hasOwnProperty','exports','../../mysqldb','FaxQueue','save'];(function(_0x255bd1,_0x30e8e5){var _0x40f3c4=function(_0x691dc){while(--_0x691dc){_0x255bd1['push'](_0x255bd1['shift']());}};_0x40f3c4(++_0x30e8e5);}(_0x1750,0x1e9));var _0x0175=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x1750[_0x278e3c];return _0x3e2d9b;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x0175('0x0'))['db'][_0x0175('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0175('0x2'),'afterUpdate':_0x0175('0x3'),'afterDestroy':'remove'};function emitEvent(_0x45fc3d){return function(_0x2142f4,_0x49f980,_0x309f56){FaxQueueEvents['emit'](_0x45fc3d+':'+_0x2142f4['id'],_0x2142f4);FaxQueueEvents['emit'](_0x45fc3d,_0x2142f4);_0x309f56(null);};}for(var e in events){if(events[_0x0175('0x4')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x0175('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index cff0792..8a00c1c 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 _0x20d4=['rimraf','../../config/environment','./faxQueue.attributes','FaxQueue','fax_queues','lodash','util','../../config/logger','api','path'];(function(_0x24cdd8,_0x58c55e){var _0x112337=function(_0x33fb5d){while(--_0x33fb5d){_0x24cdd8['push'](_0x24cdd8['shift']());}};_0x112337(++_0x58c55e);}(_0x20d4,0x1d1));var _0x420d=function(_0x1fa50d,_0x2a6416){_0x1fa50d=_0x1fa50d-0x0;var _0x534610=_0x20d4[_0x1fa50d];return _0x534610;};'use strict';var _=require(_0x420d('0x0'));var util=require(_0x420d('0x1'));var logger=require(_0x420d('0x2'))(_0x420d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x420d('0x4'));var rimraf=require(_0x420d('0x5'));var config=require(_0x420d('0x6'));var attributes=require(_0x420d('0x7'));module['exports']=function(_0x5c4921,_0x22aa7d){return _0x5c4921['define'](_0x420d('0x8'),attributes,{'tableName':_0x420d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd61=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x12888f,_0x30fc11){var _0x967d76=function(_0x589e9d){while(--_0x589e9d){_0x12888f['push'](_0x12888f['shift']());}};_0x967d76(++_0x30fc11);}(_0xcd61,0x1aa));var _0x1cd6=function(_0x5f021b,_0x2a6095){_0x5f021b=_0x5f021b-0x0;var _0x3a122e=_0xcd61[_0x5f021b];return _0x3a122e;};'use strict';var _=require(_0x1cd6('0x0'));var util=require(_0x1cd6('0x1'));var logger=require(_0x1cd6('0x2'))(_0x1cd6('0x3'));var moment=require(_0x1cd6('0x4'));var BPromise=require(_0x1cd6('0x5'));var rp=require(_0x1cd6('0x6'));var fs=require('fs');var path=require(_0x1cd6('0x7'));var rimraf=require(_0x1cd6('0x8'));var config=require(_0x1cd6('0x9'));var attributes=require(_0x1cd6('0xa'));module[_0x1cd6('0xb')]=function(_0x38d03f,_0x54e5f4){return _0x38d03f[_0x1cd6('0xc')](_0x1cd6('0xd'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ae2a2f7..9b89610 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 _0xcfe7=['defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','GetFaxQueue','ShowFaxQueue','find','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xcfe7,0x198));var _0x7cfe=function(_0x439d3c,_0x350968){_0x439d3c=_0x439d3c-0x0;var _0x45ff32=_0xcfe7[_0x439d3c];return _0x45ff32;};'use strict';var _=require(_0x7cfe('0x0'));var util=require(_0x7cfe('0x1'));var moment=require(_0x7cfe('0x2'));var BPromise=require(_0x7cfe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cfe('0x4'))['db'];var utils=require(_0x7cfe('0x5'));var logger=require('../../config/logger')(_0x7cfe('0x6'));var config=require(_0x7cfe('0x7'));var jayson=require(_0x7cfe('0x8'));var client=jayson[_0x7cfe('0x9')][_0x7cfe('0xa')]({'port':0x232a});config[_0x7cfe('0xb')]=_[_0x7cfe('0xc')](config[_0x7cfe('0xb')],{'host':_0x7cfe('0xd'),'port':0x18eb});var socket=require(_0x7cfe('0xe'))(new Redis(config['redis']));require(_0x7cfe('0xf'))[_0x7cfe('0x10')](socket);function respondWithRpcPromise(_0x4e0a2c,_0x52e044,_0xdb9a49){return new BPromise(function(_0x1b8d78,_0x11db6a){return client[_0x7cfe('0x11')](_0x4e0a2c,_0xdb9a49)['then'](function(_0x14fb85){logger[_0x7cfe('0x12')](_0x7cfe('0x13'),_0x52e044,_0x7cfe('0x14'));logger['debug'](_0x7cfe('0x15'),_0x52e044,_0x7cfe('0x14'),JSON[_0x7cfe('0x16')](_0x14fb85));if(_0x14fb85[_0x7cfe('0x17')]){if(_0x14fb85[_0x7cfe('0x17')]['code']===0x1f4){logger[_0x7cfe('0x17')](_0x7cfe('0x13'),_0x52e044,_0x14fb85[_0x7cfe('0x17')][_0x7cfe('0x18')]);return _0x11db6a(_0x14fb85['error'][_0x7cfe('0x18')]);}logger[_0x7cfe('0x17')](_0x7cfe('0x13'),_0x52e044,_0x14fb85[_0x7cfe('0x17')][_0x7cfe('0x18')]);return _0x1b8d78(_0x14fb85[_0x7cfe('0x17')][_0x7cfe('0x18')]);}else{logger[_0x7cfe('0x12')](_0x7cfe('0x13'),_0x52e044,_0x7cfe('0x14'));_0x1b8d78(_0x14fb85[_0x7cfe('0x19')][_0x7cfe('0x18')]);}})[_0x7cfe('0x1a')](function(_0x5155c0){logger[_0x7cfe('0x17')](_0x7cfe('0x13'),_0x52e044,_0x5155c0);_0x11db6a(_0x5155c0);});});}exports['GetFaxQueue']=function(_0x621721){var _0x205630=this;return new Promise(function(_0x4bf87d,_0x301fe2){return db[_0x7cfe('0x1b')][_0x7cfe('0x1c')]({'raw':_0x621721[_0x7cfe('0x1d')]?_0x621721[_0x7cfe('0x1d')][_0x7cfe('0x1e')]===undefined?!![]:![]:!![],'where':_0x621721['options']?_0x621721[_0x7cfe('0x1d')][_0x7cfe('0x1f')]||null:null,'attributes':_0x621721[_0x7cfe('0x1d')]?_0x621721[_0x7cfe('0x1d')][_0x7cfe('0x20')]||null:null,'limit':_0x621721['options']?_0x621721['options'][_0x7cfe('0x21')]||null:null,'include':_0x621721[_0x7cfe('0x1d')]?_0x621721[_0x7cfe('0x1d')]['include']?_[_0x7cfe('0x22')](_0x621721[_0x7cfe('0x1d')][_0x7cfe('0x23')],function(_0x5ae8d2){return{'model':db[_0x5ae8d2['model']],'as':_0x5ae8d2['as'],'attributes':_0x5ae8d2['attributes'],'include':_0x5ae8d2[_0x7cfe('0x23')]?_[_0x7cfe('0x22')](_0x5ae8d2[_0x7cfe('0x23')],function(_0x5b5576){return{'model':db[_0x5b5576[_0x7cfe('0x24')]],'as':_0x5b5576['as'],'attributes':_0x5b5576['attributes'],'include':_0x5b5576[_0x7cfe('0x23')]?_[_0x7cfe('0x22')](_0x5b5576['include'],function(_0x3a02b4){return{'model':db[_0x3a02b4[_0x7cfe('0x24')]],'as':_0x3a02b4['as'],'attributes':_0x3a02b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cfe('0x25')](function(_0x2935cf){logger[_0x7cfe('0x12')](_0x7cfe('0x26'),_0x621721);logger['debug'](_0x7cfe('0x26'),_0x621721,JSON[_0x7cfe('0x16')](_0x2935cf));_0x4bf87d(_0x2935cf);})[_0x7cfe('0x1a')](function(_0x175ab8){logger[_0x7cfe('0x17')](_0x7cfe('0x26'),_0x175ab8[_0x7cfe('0x18')],_0x621721);_0x301fe2(_0x205630[_0x7cfe('0x17')](0x1f4,_0x175ab8[_0x7cfe('0x18')]));});});};exports[_0x7cfe('0x27')]=function(_0x479d53){var _0x4f8d5b=this;return new Promise(function(_0x21aec5,_0x2f481a){return db[_0x7cfe('0x1b')][_0x7cfe('0x28')]({'raw':_0x479d53[_0x7cfe('0x1d')]?_0x479d53['options'][_0x7cfe('0x1e')]===undefined?!![]:![]:!![],'where':_0x479d53[_0x7cfe('0x1d')]?_0x479d53[_0x7cfe('0x1d')][_0x7cfe('0x1f')]||null:null,'attributes':_0x479d53[_0x7cfe('0x1d')]?_0x479d53['options']['attributes']||null:null,'include':_0x479d53['options']?_0x479d53['options'][_0x7cfe('0x23')]?_[_0x7cfe('0x22')](_0x479d53[_0x7cfe('0x1d')][_0x7cfe('0x23')],function(_0x2c7cb0){return{'model':db[_0x2c7cb0[_0x7cfe('0x24')]],'as':_0x2c7cb0['as'],'attributes':_0x2c7cb0[_0x7cfe('0x20')],'include':_0x2c7cb0[_0x7cfe('0x23')]?_[_0x7cfe('0x22')](_0x2c7cb0['include'],function(_0x4cd1fe){return{'model':db[_0x4cd1fe[_0x7cfe('0x24')]],'as':_0x4cd1fe['as'],'attributes':_0x4cd1fe[_0x7cfe('0x20')],'include':_0x4cd1fe['include']?_['map'](_0x4cd1fe['include'],function(_0x2d3237){return{'model':db[_0x2d3237[_0x7cfe('0x24')]],'as':_0x2d3237['as'],'attributes':_0x2d3237[_0x7cfe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7cfe('0x25')](function(_0x52d76f){logger[_0x7cfe('0x12')]('ShowFaxQueue',_0x479d53);logger[_0x7cfe('0x29')](_0x7cfe('0x27'),_0x479d53,JSON[_0x7cfe('0x16')](_0x52d76f));_0x21aec5(_0x52d76f);})['catch'](function(_0x496889){logger['error']('ShowFaxQueue',_0x496889[_0x7cfe('0x18')],_0x479d53);_0x2f481a(_0x4f8d5b[_0x7cfe('0x17')](0x1f4,_0x496889[_0x7cfe('0x18')]));});});}; \ No newline at end of file +var _0xa2b6=['FaxQueue','findAll','options','raw','where','attributes','include','model','map','debug','stringify','ShowFaxQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','GetFaxQueue'];(function(_0x3db66f,_0x2fe5bb){var _0x32f851=function(_0x5d64c1){while(--_0x5d64c1){_0x3db66f['push'](_0x3db66f['shift']());}};_0x32f851(++_0x2fe5bb);}(_0xa2b6,0x175));var _0x6a2b=function(_0x3a1274,_0x131652){_0x3a1274=_0x3a1274-0x0;var _0x350b11=_0xa2b6[_0x3a1274];return _0x350b11;};'use strict';var _=require(_0x6a2b('0x0'));var util=require(_0x6a2b('0x1'));var moment=require('moment');var BPromise=require(_0x6a2b('0x2'));var rs=require(_0x6a2b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a2b('0x4'))['db'];var utils=require(_0x6a2b('0x5'));var logger=require(_0x6a2b('0x6'))(_0x6a2b('0x7'));var config=require(_0x6a2b('0x8'));var jayson=require(_0x6a2b('0x9'));var client=jayson[_0x6a2b('0xa')]['http']({'port':0x232a});config['redis']=_[_0x6a2b('0xb')](config[_0x6a2b('0xc')],{'host':_0x6a2b('0xd'),'port':0x18eb});var socket=require(_0x6a2b('0xe'))(new Redis(config['redis']));require(_0x6a2b('0xf'))[_0x6a2b('0x10')](socket);function respondWithRpcPromise(_0x532433,_0x515614,_0x53d71b){return new BPromise(function(_0x338704,_0x406402){return client['request'](_0x532433,_0x53d71b)[_0x6a2b('0x11')](function(_0x504033){logger['info'](_0x6a2b('0x12'),_0x515614,'request\x20sent');logger['debug'](_0x6a2b('0x13'),_0x515614,'request\x20sent',JSON['stringify'](_0x504033));if(_0x504033['error']){if(_0x504033[_0x6a2b('0x14')][_0x6a2b('0x15')]===0x1f4){logger[_0x6a2b('0x14')]('FaxQueue,\x20%s,\x20%s',_0x515614,_0x504033[_0x6a2b('0x14')][_0x6a2b('0x16')]);return _0x406402(_0x504033[_0x6a2b('0x14')][_0x6a2b('0x16')]);}logger[_0x6a2b('0x14')]('FaxQueue,\x20%s,\x20%s',_0x515614,_0x504033[_0x6a2b('0x14')]['message']);return _0x338704(_0x504033['error'][_0x6a2b('0x16')]);}else{logger[_0x6a2b('0x17')]('FaxQueue,\x20%s,\x20%s',_0x515614,_0x6a2b('0x18'));_0x338704(_0x504033['result']['message']);}})[_0x6a2b('0x19')](function(_0x14b866){logger[_0x6a2b('0x14')]('FaxQueue,\x20%s,\x20%s',_0x515614,_0x14b866);_0x406402(_0x14b866);});});}exports[_0x6a2b('0x1a')]=function(_0x5dd668){var _0x121e1b=this;return new Promise(function(_0x2801fe,_0x51440b){return db[_0x6a2b('0x1b')][_0x6a2b('0x1c')]({'raw':_0x5dd668[_0x6a2b('0x1d')]?_0x5dd668[_0x6a2b('0x1d')][_0x6a2b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5dd668[_0x6a2b('0x1d')]?_0x5dd668[_0x6a2b('0x1d')][_0x6a2b('0x1f')]||null:null,'attributes':_0x5dd668[_0x6a2b('0x1d')]?_0x5dd668[_0x6a2b('0x1d')][_0x6a2b('0x20')]||null:null,'limit':_0x5dd668['options']?_0x5dd668[_0x6a2b('0x1d')]['limit']||null:null,'include':_0x5dd668['options']?_0x5dd668[_0x6a2b('0x1d')][_0x6a2b('0x21')]?_['map'](_0x5dd668[_0x6a2b('0x1d')][_0x6a2b('0x21')],function(_0x366e4f){return{'model':db[_0x366e4f[_0x6a2b('0x22')]],'as':_0x366e4f['as'],'attributes':_0x366e4f[_0x6a2b('0x20')],'include':_0x366e4f[_0x6a2b('0x21')]?_[_0x6a2b('0x23')](_0x366e4f[_0x6a2b('0x21')],function(_0x21ff5e){return{'model':db[_0x21ff5e[_0x6a2b('0x22')]],'as':_0x21ff5e['as'],'attributes':_0x21ff5e[_0x6a2b('0x20')],'include':_0x21ff5e['include']?_[_0x6a2b('0x23')](_0x21ff5e[_0x6a2b('0x21')],function(_0x5771ed){return{'model':db[_0x5771ed[_0x6a2b('0x22')]],'as':_0x5771ed['as'],'attributes':_0x5771ed[_0x6a2b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x223e98){logger[_0x6a2b('0x17')](_0x6a2b('0x1a'),_0x5dd668);logger[_0x6a2b('0x24')](_0x6a2b('0x1a'),_0x5dd668,JSON[_0x6a2b('0x25')](_0x223e98));_0x2801fe(_0x223e98);})[_0x6a2b('0x19')](function(_0x384710){logger[_0x6a2b('0x14')]('GetFaxQueue',_0x384710[_0x6a2b('0x16')],_0x5dd668);_0x51440b(_0x121e1b[_0x6a2b('0x14')](0x1f4,_0x384710[_0x6a2b('0x16')]));});});};exports[_0x6a2b('0x26')]=function(_0x40016a){var _0x12661f=this;return new Promise(function(_0x10cb11,_0x39b740){return db['FaxQueue'][_0x6a2b('0x27')]({'raw':_0x40016a['options']?_0x40016a[_0x6a2b('0x1d')][_0x6a2b('0x1e')]===undefined?!![]:![]:!![],'where':_0x40016a[_0x6a2b('0x1d')]?_0x40016a[_0x6a2b('0x1d')][_0x6a2b('0x1f')]||null:null,'attributes':_0x40016a['options']?_0x40016a['options']['attributes']||null:null,'include':_0x40016a['options']?_0x40016a[_0x6a2b('0x1d')][_0x6a2b('0x21')]?_[_0x6a2b('0x23')](_0x40016a[_0x6a2b('0x1d')][_0x6a2b('0x21')],function(_0x244169){return{'model':db[_0x244169[_0x6a2b('0x22')]],'as':_0x244169['as'],'attributes':_0x244169['attributes'],'include':_0x244169['include']?_['map'](_0x244169[_0x6a2b('0x21')],function(_0x1baae1){return{'model':db[_0x1baae1[_0x6a2b('0x22')]],'as':_0x1baae1['as'],'attributes':_0x1baae1[_0x6a2b('0x20')],'include':_0x1baae1[_0x6a2b('0x21')]?_[_0x6a2b('0x23')](_0x1baae1[_0x6a2b('0x21')],function(_0x357fb7){return{'model':db[_0x357fb7['model']],'as':_0x357fb7['as'],'attributes':_0x357fb7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41f91f){logger[_0x6a2b('0x17')]('ShowFaxQueue',_0x40016a);logger[_0x6a2b('0x24')](_0x6a2b('0x26'),_0x40016a,JSON[_0x6a2b('0x25')](_0x41f91f));_0x10cb11(_0x41f91f);})['catch'](function(_0x536b4e){logger[_0x6a2b('0x14')]('ShowFaxQueue',_0x536b4e['message'],_0x40016a);_0x39b740(_0x12661f['error'](0x1f4,_0x536b4e[_0x6a2b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ff186fc..e115c93 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 _0x8385=['emit','register','length','faxQueue:','save','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8385,0x12a));var _0x5838=function(_0x14d3cb,_0x205190){_0x14d3cb=_0x14d3cb-0x0;var _0x46c837=_0x8385[_0x14d3cb];return _0x46c837;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5838('0x0'),_0x5838('0x1'),_0x5838('0x2')];function createListener(_0x1d12d7,_0x53bfc5){return function(_0x1e3631){_0x53bfc5[_0x5838('0x3')](_0x1d12d7,_0x1e3631);};}function removeListener(_0x471e15,_0x88b762){return function(){FaxQueueEvents['removeListener'](_0x471e15,_0x88b762);};}exports[_0x5838('0x4')]=function(_0x484abf){for(var _0x3f155c=0x0,_0x365987=events[_0x5838('0x5')];_0x3f155c<_0x365987;_0x3f155c++){var _0x1637ce=events[_0x3f155c];var _0x1907db=createListener(_0x5838('0x6')+_0x1637ce,_0x484abf);FaxQueueEvents['on'](_0x1637ce,_0x1907db);}}; \ No newline at end of file +var _0xede7=['./faxQueue.events','remove','update','removeListener','register','faxQueue:'];(function(_0x5a369d,_0x140b74){var _0x22cfba=function(_0x42acb9){while(--_0x42acb9){_0x5a369d['push'](_0x5a369d['shift']());}};_0x22cfba(++_0x140b74);}(_0xede7,0xcc));var _0x7ede=function(_0x3a814f,_0x553e5b){_0x3a814f=_0x3a814f-0x0;var _0x150de1=_0xede7[_0x3a814f];return _0x150de1;};'use strict';var FaxQueueEvents=require(_0x7ede('0x0'));var events=['save',_0x7ede('0x1'),_0x7ede('0x2')];function createListener(_0x46f92c,_0x173082){return function(_0x562645){_0x173082['emit'](_0x46f92c,_0x562645);};}function removeListener(_0x2a28b6,_0xb33d38){return function(){FaxQueueEvents[_0x7ede('0x3')](_0x2a28b6,_0xb33d38);};}exports[_0x7ede('0x4')]=function(_0x550e3b){for(var _0x408fc9=0x0,_0xd40240=events['length'];_0x408fc9<_0xd40240;_0x408fc9++){var _0x1aecff=events[_0x408fc9];var _0x193110=createListener(_0x7ede('0x5')+_0x1aecff,_0x550e3b);FaxQueueEvents['on'](_0x1aecff,_0x193110);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 5510547..e941131 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 _0x553a=['/:id/users','getAgents','create','post','addTeams','put','/:id','destroy','delete','removeTeams','removeAgents','util','connect-timeout','express','Router','../../components/interaction/service','get','/describe','isAuthenticated','show','getMembers','/:id/teams','getTeams'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x553a,0x192));var _0xa553=function(_0x1834fb,_0x38bfa4){_0x1834fb=_0x1834fb-0x0;var _0x578b25=_0x553a[_0x1834fb];return _0x578b25;};'use strict';var multer=require('multer');var util=require(_0xa553('0x0'));var path=require('path');var timeout=require(_0xa553('0x1'));var express=require(_0xa553('0x2'));var router=express[_0xa553('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa553('0x4'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xa553('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa553('0x5')](_0xa553('0x6'),auth[_0xa553('0x7')](),controller['describe']);router[_0xa553('0x5')]('/:id',auth[_0xa553('0x7')](),controller[_0xa553('0x8')]);router[_0xa553('0x5')]('/:id/members',auth['isAuthenticated'](),controller[_0xa553('0x9')]);router['get'](_0xa553('0xa'),auth[_0xa553('0x7')](),controller[_0xa553('0xb')]);router['get'](_0xa553('0xc'),auth[_0xa553('0x7')](),controller[_0xa553('0xd')]);router['post']('/',auth[_0xa553('0x7')](),controller[_0xa553('0xe')]);router[_0xa553('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa553('0x10')]);router[_0xa553('0xf')](_0xa553('0xc'),auth[_0xa553('0x7')](),controller['addAgents']);router[_0xa553('0x11')]('/:id',auth[_0xa553('0x7')](),controller['update']);router['delete'](_0xa553('0x12'),auth['isAuthenticated'](),controller[_0xa553('0x13')]);router[_0xa553('0x14')](_0xa553('0xa'),auth['isAuthenticated'](),controller[_0xa553('0x15')]);router[_0xa553('0x14')]('/:id/users',auth[_0xa553('0x7')](),controller[_0xa553('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb511=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb511,0x165));var _0x1b51=function(_0x67912b,_0xda586c){_0x67912b=_0x67912b-0x0;var _0x2f8667=_0xb511[_0x67912b];return _0x2f8667;};'use strict';var multer=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var path=require(_0x1b51('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b51('0x3'));var router=express[_0x1b51('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1b51('0x5'));var interaction=require(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var controller=require('./faxQueue.controller');router[_0x1b51('0x8')]('/',auth[_0x1b51('0x9')](),controller['index']);router[_0x1b51('0x8')](_0x1b51('0xa'),auth['isAuthenticated'](),controller[_0x1b51('0xb')]);router[_0x1b51('0x8')](_0x1b51('0xc'),auth[_0x1b51('0x9')](),controller[_0x1b51('0xd')]);router[_0x1b51('0x8')](_0x1b51('0xe'),auth[_0x1b51('0x9')](),controller['getMembers']);router[_0x1b51('0x8')](_0x1b51('0xf'),auth[_0x1b51('0x9')](),controller[_0x1b51('0x10')]);router[_0x1b51('0x8')](_0x1b51('0x11'),auth['isAuthenticated'](),controller[_0x1b51('0x12')]);router[_0x1b51('0x13')]('/',auth[_0x1b51('0x9')](),controller[_0x1b51('0x14')]);router[_0x1b51('0x13')](_0x1b51('0xf'),auth[_0x1b51('0x9')](),controller['addTeams']);router[_0x1b51('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b51('0x15')]);router[_0x1b51('0x16')]('/:id',auth[_0x1b51('0x9')](),controller[_0x1b51('0x17')]);router[_0x1b51('0x18')]('/:id',auth[_0x1b51('0x9')](),controller[_0x1b51('0x19')]);router[_0x1b51('0x18')](_0x1b51('0xf'),auth['isAuthenticated'](),controller[_0x1b51('0x1a')]);router[_0x1b51('0x18')](_0x1b51('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1b51('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d0ebfa3..b4470bc 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 _0x4af3=['sequelize','exports','DATE','STRING'];(function(_0x8baa0b,_0x24b3fa){var _0x5ebdb9=function(_0x372b7b){while(--_0x372b7b){_0x8baa0b['push'](_0x8baa0b['shift']());}};_0x5ebdb9(++_0x24b3fa);}(_0x4af3,0x118));var _0x34af=function(_0x3b9afb,_0x2133f4){_0x3b9afb=_0x3b9afb-0x0;var _0x136e05=_0x4af3[_0x3b9afb];return _0x136e05;};'use strict';var moment=require('moment');var Sequelize=require(_0x34af('0x0'));module[_0x34af('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x34af('0x2')]},'acceptAt':{'type':Sequelize[_0x34af('0x2')]},'exitAt':{'type':Sequelize[_0x34af('0x2')]},'reason':{'type':Sequelize[_0x34af('0x3')]}}; \ No newline at end of file +var _0x0bb3=['STRING','DATE','sequelize','exports'];(function(_0x3d6785,_0x492ea3){var _0x39a624=function(_0x27d7db){while(--_0x27d7db){_0x3d6785['push'](_0x3d6785['shift']());}};_0x39a624(++_0x492ea3);}(_0x0bb3,0x126));var _0x30bb=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x0bb3[_0x256d6a];return _0x460058;};'use strict';var moment=require('moment');var Sequelize=require(_0x30bb('0x0'));module[_0x30bb('0x1')]={'uniqueid':{'type':Sequelize[_0x30bb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x30bb('0x2')]},'joinAt':{'type':Sequelize[_0x30bb('0x3')]},'leaveAt':{'type':Sequelize[_0x30bb('0x3')]},'acceptAt':{'type':Sequelize[_0x30bb('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x30bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9f2148d..c56eb54 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 _0x1cc7=['count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined'];(function(_0x3d8917,_0x4bf0bb){var _0x403058=function(_0x95d41d){while(--_0x95d41d){_0x3d8917['push'](_0x3d8917['shift']());}};_0x403058(++_0x4bf0bb);}(_0x1cc7,0x15a));var _0x71cc=function(_0x222c9a,_0x1b8492){_0x222c9a=_0x222c9a-0x0;var _0x3a04d4=_0x1cc7[_0x222c9a];return _0x3a04d4;};'use strict';var emlformat=require(_0x71cc('0x0'));var rimraf=require(_0x71cc('0x1'));var zipdir=require(_0x71cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71cc('0x3'));var Mustache=require(_0x71cc('0x4'));var util=require(_0x71cc('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x71cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71cc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad83,_0x4f9c5c){_0x4f9c5c=_0x4f9c5c||0xcc;return function(_0x1a7c58){if(_0x1a7c58){return _0x1aad83['sendStatus'](_0x4f9c5c);}return _0x1aad83[_0x71cc('0x13')](_0x4f9c5c)[_0x71cc('0x14')]();};}function respondWithResult(_0x3cee23,_0xd16032){_0xd16032=_0xd16032||0xc8;return function(_0x33070e){if(_0x33070e){return _0x3cee23['status'](_0xd16032)[_0x71cc('0x15')](_0x33070e);}};}function respondWithFilteredResult(_0x292d0c,_0x3b26d1){return function(_0x14d5ab){if(_0x14d5ab){var _0x3875b8=typeof _0x3b26d1[_0x71cc('0x16')]===_0x71cc('0x17')&&typeof _0x3b26d1['limit']===_0x71cc('0x17');var _0x14788d=_0x14d5ab[_0x71cc('0x18')];var _0x1d1da8=_0x3875b8?0x0:_0x3b26d1[_0x71cc('0x16')];var _0x10da0a=_0x3875b8?_0x14d5ab['count']:_0x3b26d1[_0x71cc('0x16')]+_0x3b26d1[_0x71cc('0x19')];var _0x4fc0a9;if(_0x10da0a>=_0x14788d){_0x10da0a=_0x14788d;_0x4fc0a9=0xc8;}else{_0x4fc0a9=0xce;}_0x292d0c['status'](_0x4fc0a9);return _0x292d0c[_0x71cc('0x1a')](_0x71cc('0x1b'),_0x1d1da8+'-'+_0x10da0a+'/'+_0x14788d)[_0x71cc('0x15')](_0x14d5ab);}return null;};}function patchUpdates(_0x11299c){return function(_0x258d30){try{jsonpatch[_0x71cc('0x1c')](_0x258d30,_0x11299c,!![]);}catch(_0x363ecb){return BPromise[_0x71cc('0x1d')](_0x363ecb);}return _0x258d30['save']();};}function saveUpdates(_0x1442ef,_0x109239){return function(_0x587a0b){if(_0x587a0b){return _0x587a0b[_0x71cc('0x1e')](_0x1442ef)[_0x71cc('0x1f')](function(_0x38f58e){return _0x38f58e;});}return null;};}function removeEntity(_0x1a9b4f,_0x1bc67c){return function(_0x887399){if(_0x887399){return _0x887399['destroy']()[_0x71cc('0x1f')](function(){_0x1a9b4f[_0x71cc('0x13')](0xcc)[_0x71cc('0x14')]();});}};}function handleEntityNotFound(_0x180cd2,_0x36367b){return function(_0x5fa323){if(!_0x5fa323){_0x180cd2[_0x71cc('0x20')](0x194);}return _0x5fa323;};}function handleError(_0x42e6ec,_0xbce208){_0xbce208=_0xbce208||0x1f4;return function(_0x4d4529){logger[_0x71cc('0x21')](_0x4d4529[_0x71cc('0x22')]);if(_0x4d4529[_0x71cc('0x23')]){delete _0x4d4529[_0x71cc('0x23')];}_0x42e6ec[_0x71cc('0x13')](_0xbce208)[_0x71cc('0x24')](_0x4d4529);};}exports[_0x71cc('0x25')]=function(_0x9a7ca3,_0x3cc813){var _0x1fc046={},_0x30f94d={},_0x35f723={'count':0x0,'rows':[]};var _0x1d5805=_[_0x71cc('0x26')](db[_0x71cc('0x27')][_0x71cc('0x28')],function(_0x4fa63e){return{'name':_0x4fa63e[_0x71cc('0x29')],'type':_0x4fa63e[_0x71cc('0x2a')][_0x71cc('0x2b')]};});_0x30f94d[_0x71cc('0x2c')]=_[_0x71cc('0x26')](_0x1d5805,_0x71cc('0x23'));_0x30f94d['query']=_[_0x71cc('0x2d')](_0x9a7ca3[_0x71cc('0x2e')]);_0x30f94d[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x30f94d[_0x71cc('0x2c')],_0x30f94d[_0x71cc('0x2e')]);_0x1fc046[_0x71cc('0x31')]=_['intersection'](_0x30f94d[_0x71cc('0x2c')],qs['fields'](_0x9a7ca3['query'][_0x71cc('0x32')]));_0x1fc046['attributes']=_0x1fc046['attributes'][_0x71cc('0x33')]?_0x1fc046['attributes']:_0x30f94d[_0x71cc('0x2c')];if(!_0x9a7ca3['query'][_0x71cc('0x34')](_0x71cc('0x35'))){_0x1fc046['limit']=qs[_0x71cc('0x19')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x19')]);_0x1fc046[_0x71cc('0x16')]=qs[_0x71cc('0x16')](_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x16')]);}_0x1fc046[_0x71cc('0x36')]=qs[_0x71cc('0x37')](_0x9a7ca3[_0x71cc('0x2e')]['sort']);_0x1fc046[_0x71cc('0x38')]=qs['filters'](_[_0x71cc('0x39')](_0x9a7ca3[_0x71cc('0x2e')],_0x30f94d[_0x71cc('0x2f')]),_0x1d5805);if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3a')]){_0x1fc046[_0x71cc('0x38')]=_['merge'](_0x1fc046[_0x71cc('0x38')],{'$or':_['map'](_0x1d5805,function(_0x468b4b){if(_0x468b4b[_0x71cc('0x2a')]!==_0x71cc('0x3b')){var _0x487e13={};_0x487e13[_0x468b4b[_0x71cc('0x23')]]={'$like':'%'+_0x9a7ca3['query'][_0x71cc('0x3a')]+'%'};return _0x487e13;}})});}_0x1fc046=_[_0x71cc('0x3c')]({},_0x1fc046,_0x9a7ca3[_0x71cc('0x3d')]);var _0x92389={'where':_0x1fc046[_0x71cc('0x38')]};return db[_0x71cc('0x27')][_0x71cc('0x18')](_0x92389)[_0x71cc('0x1f')](function(_0x3c3fae){_0x35f723[_0x71cc('0x18')]=_0x3c3fae;if(_0x9a7ca3[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x1fc046['include']=[{'all':!![]}];}return db[_0x71cc('0x27')][_0x71cc('0x3f')](_0x1fc046);})['then'](function(_0x54fc85){_0x35f723[_0x71cc('0x40')]=_0x54fc85;return _0x35f723;})[_0x71cc('0x1f')](respondWithFilteredResult(_0x3cc813,_0x1fc046))['catch'](handleError(_0x3cc813,null));};exports[_0x71cc('0x41')]=function(_0x3b9eec,_0x2fbe5e){var _0x19d7c8={'raw':!![],'where':{'id':_0x3b9eec['params']['id']}},_0x21ef21={};_0x21ef21['model']=_['keys'](db[_0x71cc('0x27')]['rawAttributes']);_0x21ef21[_0x71cc('0x2e')]=_[_0x71cc('0x2d')](_0x3b9eec[_0x71cc('0x2e')]);_0x21ef21[_0x71cc('0x2f')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],_0x21ef21[_0x71cc('0x2e')]);_0x19d7c8[_0x71cc('0x31')]=_[_0x71cc('0x30')](_0x21ef21[_0x71cc('0x2c')],qs[_0x71cc('0x32')](_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x32')]));_0x19d7c8['attributes']=_0x19d7c8[_0x71cc('0x31')][_0x71cc('0x33')]?_0x19d7c8[_0x71cc('0x31')]:_0x21ef21['model'];if(_0x3b9eec[_0x71cc('0x2e')][_0x71cc('0x3e')]){_0x19d7c8[_0x71cc('0x42')]=[{'all':!![]}];}_0x19d7c8=_[_0x71cc('0x3c')]({},_0x19d7c8,_0x3b9eec[_0x71cc('0x3d')]);return db[_0x71cc('0x27')][_0x71cc('0x43')](_0x19d7c8)[_0x71cc('0x1f')](handleEntityNotFound(_0x2fbe5e,null))[_0x71cc('0x1f')](respondWithResult(_0x2fbe5e,null))[_0x71cc('0x44')](handleError(_0x2fbe5e,null));};exports[_0x71cc('0x45')]=function(_0xbb951c,_0x47cefc){return db[_0x71cc('0x27')][_0x71cc('0x45')](_0xbb951c[_0x71cc('0x46')],{})[_0x71cc('0x1f')](respondWithResult(_0x47cefc,0xc9))[_0x71cc('0x44')](handleError(_0x47cefc,null));};exports[_0x71cc('0x1e')]=function(_0x430387,_0x51cd49){if(_0x430387[_0x71cc('0x46')]['id']){delete _0x430387[_0x71cc('0x46')]['id'];}return db['FaxQueueReport'][_0x71cc('0x43')]({'where':{'id':_0x430387[_0x71cc('0x47')]['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x51cd49,null))[_0x71cc('0x1f')](saveUpdates(_0x430387[_0x71cc('0x46')],null))[_0x71cc('0x1f')](respondWithResult(_0x51cd49,null))[_0x71cc('0x44')](handleError(_0x51cd49,null));};exports[_0x71cc('0x48')]=function(_0x3cf0bf,_0x1647ce){return db[_0x71cc('0x27')]['find']({'where':{'id':_0x3cf0bf[_0x71cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1647ce,null))[_0x71cc('0x1f')](removeEntity(_0x1647ce,null))['catch'](handleError(_0x1647ce,null));};exports[_0x71cc('0x49')]=function(_0x36c71e,_0x5c9ac5){return db[_0x71cc('0x27')][_0x71cc('0x49')]()['then'](respondWithResult(_0x5c9ac5,null))[_0x71cc('0x44')](handleError(_0x5c9ac5,null));}; \ No newline at end of file +var _0x028d=['nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x3d1528,_0x484501){var _0x481748=function(_0x2b873f){while(--_0x2b873f){_0x3d1528['push'](_0x3d1528['shift']());}};_0x481748(++_0x484501);}(_0x028d,0xff));var _0xd028=function(_0x4c5202,_0x35c30f){_0x4c5202=_0x4c5202-0x0;var _0x38dd6b=_0x028d[_0x4c5202];return _0x38dd6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd028('0x0'));var zipdir=require(_0xd028('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd028('0x2'));var moment=require(_0xd028('0x3'));var BPromise=require(_0xd028('0x4'));var Mustache=require(_0xd028('0x5'));var util=require(_0xd028('0x6'));var path=require(_0xd028('0x7'));var sox=require('sox');var csv=require(_0xd028('0x8'));var ejs=require(_0xd028('0x9'));var fs=require('fs');var fs_extra=require(_0xd028('0xa'));var _=require(_0xd028('0xb'));var squel=require(_0xd028('0xc'));var crypto=require(_0xd028('0xd'));var jsforce=require(_0xd028('0xe'));var deskjs=require(_0xd028('0xf'));var toCsv=require(_0xd028('0x8'));var querystring=require(_0xd028('0x10'));var Papa=require(_0xd028('0x11'));var Redis=require(_0xd028('0x12'));var authService=require(_0xd028('0x13'));var qs=require(_0xd028('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd028('0x15'));var logger=require(_0xd028('0x16'))(_0xd028('0x17'));var utils=require(_0xd028('0x18'));var config=require(_0xd028('0x19'));var licenseUtil=require(_0xd028('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b5fa,_0x144696){_0x144696=_0x144696||0xcc;return function(_0x4817a4){if(_0x4817a4){return _0x34b5fa[_0xd028('0x1b')](_0x144696);}return _0x34b5fa[_0xd028('0x1c')](_0x144696)[_0xd028('0x1d')]();};}function respondWithResult(_0x17b112,_0x1667bf){_0x1667bf=_0x1667bf||0xc8;return function(_0x5ec067){if(_0x5ec067){return _0x17b112[_0xd028('0x1c')](_0x1667bf)[_0xd028('0x1e')](_0x5ec067);}};}function respondWithFilteredResult(_0x3937b4,_0x3bac54){return function(_0x12450d){if(_0x12450d){var _0x463d38=typeof _0x3bac54['offset']===_0xd028('0x1f')&&typeof _0x3bac54['limit']===_0xd028('0x1f');var _0x2f4af6=_0x12450d[_0xd028('0x20')];var _0x4df54f=_0x463d38?0x0:_0x3bac54[_0xd028('0x21')];var _0x5a47a6=_0x463d38?_0x12450d[_0xd028('0x20')]:_0x3bac54['offset']+_0x3bac54[_0xd028('0x22')];var _0x415d6c;if(_0x5a47a6>=_0x2f4af6){_0x5a47a6=_0x2f4af6;_0x415d6c=0xc8;}else{_0x415d6c=0xce;}_0x3937b4[_0xd028('0x1c')](_0x415d6c);return _0x3937b4['set'](_0xd028('0x23'),_0x4df54f+'-'+_0x5a47a6+'/'+_0x2f4af6)[_0xd028('0x1e')](_0x12450d);}return null;};}function patchUpdates(_0x1a2767){return function(_0x1648a7){try{jsonpatch[_0xd028('0x24')](_0x1648a7,_0x1a2767,!![]);}catch(_0x4830a4){return BPromise[_0xd028('0x25')](_0x4830a4);}return _0x1648a7[_0xd028('0x26')]();};}function saveUpdates(_0x8a964d,_0x75657f){return function(_0x3203f9){if(_0x3203f9){return _0x3203f9[_0xd028('0x27')](_0x8a964d)[_0xd028('0x28')](function(_0x54beee){return _0x54beee;});}return null;};}function removeEntity(_0x115fef,_0x10d629){return function(_0x13e5f4){if(_0x13e5f4){return _0x13e5f4[_0xd028('0x29')]()['then'](function(){_0x115fef[_0xd028('0x1c')](0xcc)[_0xd028('0x1d')]();});}};}function handleEntityNotFound(_0x26eb4e,_0x3249ea){return function(_0x5b9f3d){if(!_0x5b9f3d){_0x26eb4e[_0xd028('0x1b')](0x194);}return _0x5b9f3d;};}function handleError(_0x128c63,_0x115004){_0x115004=_0x115004||0x1f4;return function(_0x3481be){logger[_0xd028('0x2a')](_0x3481be[_0xd028('0x2b')]);if(_0x3481be[_0xd028('0x2c')]){delete _0x3481be[_0xd028('0x2c')];}_0x128c63[_0xd028('0x1c')](_0x115004)[_0xd028('0x2d')](_0x3481be);};}exports[_0xd028('0x2e')]=function(_0x3112e8,_0x112578){var _0x17594f={},_0x23d9dd={},_0x3b46bb={'count':0x0,'rows':[]};var _0x5d6f95=_['map'](db[_0xd028('0x2f')][_0xd028('0x30')],function(_0x2caf5d){return{'name':_0x2caf5d[_0xd028('0x31')],'type':_0x2caf5d[_0xd028('0x32')][_0xd028('0x33')]};});_0x23d9dd['model']=_['map'](_0x5d6f95,_0xd028('0x2c'));_0x23d9dd[_0xd028('0x34')]=_[_0xd028('0x35')](_0x3112e8[_0xd028('0x34')]);_0x23d9dd[_0xd028('0x36')]=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],_0x23d9dd['query']);_0x17594f['attributes']=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],qs['fields'](_0x3112e8['query'][_0xd028('0x39')]));_0x17594f[_0xd028('0x3a')]=_0x17594f[_0xd028('0x3a')][_0xd028('0x3b')]?_0x17594f[_0xd028('0x3a')]:_0x23d9dd[_0xd028('0x38')];if(!_0x3112e8[_0xd028('0x34')][_0xd028('0x3c')](_0xd028('0x3d'))){_0x17594f[_0xd028('0x22')]=qs[_0xd028('0x22')](_0x3112e8['query']['limit']);_0x17594f['offset']=qs['offset'](_0x3112e8['query'][_0xd028('0x21')]);}_0x17594f['order']=qs['sort'](_0x3112e8['query'][_0xd028('0x3e')]);_0x17594f['where']=qs[_0xd028('0x36')](_['pick'](_0x3112e8['query'],_0x23d9dd[_0xd028('0x36')]),_0x5d6f95);if(_0x3112e8[_0xd028('0x34')]['filter']){_0x17594f[_0xd028('0x3f')]=_['merge'](_0x17594f['where'],{'$or':_['map'](_0x5d6f95,function(_0x5941ed){if(_0x5941ed['type']!==_0xd028('0x40')){var _0x24ba63={};_0x24ba63[_0x5941ed['name']]={'$like':'%'+_0x3112e8[_0xd028('0x34')][_0xd028('0x41')]+'%'};return _0x24ba63;}})});}_0x17594f=_[_0xd028('0x42')]({},_0x17594f,_0x3112e8[_0xd028('0x43')]);var _0xc79c76={'where':_0x17594f[_0xd028('0x3f')]};return db['FaxQueueReport'][_0xd028('0x20')](_0xc79c76)[_0xd028('0x28')](function(_0x2d5fab){_0x3b46bb['count']=_0x2d5fab;if(_0x3112e8[_0xd028('0x34')][_0xd028('0x44')]){_0x17594f[_0xd028('0x45')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xd028('0x46')](_0x17594f);})['then'](function(_0x26e51c){_0x3b46bb[_0xd028('0x47')]=_0x26e51c;return _0x3b46bb;})[_0xd028('0x28')](respondWithFilteredResult(_0x112578,_0x17594f))[_0xd028('0x48')](handleError(_0x112578,null));};exports[_0xd028('0x49')]=function(_0x3f86ed,_0x1de847){var _0x42a3fc={'raw':!![],'where':{'id':_0x3f86ed['params']['id']}},_0x3065f2={};_0x3065f2[_0xd028('0x38')]=_[_0xd028('0x35')](db[_0xd028('0x2f')][_0xd028('0x30')]);_0x3065f2['query']=_[_0xd028('0x35')](_0x3f86ed[_0xd028('0x34')]);_0x3065f2[_0xd028('0x36')]=_['intersection'](_0x3065f2[_0xd028('0x38')],_0x3065f2[_0xd028('0x34')]);_0x42a3fc['attributes']=_[_0xd028('0x37')](_0x3065f2[_0xd028('0x38')],qs[_0xd028('0x39')](_0x3f86ed[_0xd028('0x34')][_0xd028('0x39')]));_0x42a3fc[_0xd028('0x3a')]=_0x42a3fc[_0xd028('0x3a')][_0xd028('0x3b')]?_0x42a3fc[_0xd028('0x3a')]:_0x3065f2[_0xd028('0x38')];if(_0x3f86ed['query'][_0xd028('0x44')]){_0x42a3fc[_0xd028('0x45')]=[{'all':!![]}];}_0x42a3fc=_[_0xd028('0x42')]({},_0x42a3fc,_0x3f86ed[_0xd028('0x43')]);return db[_0xd028('0x2f')][_0xd028('0x4a')](_0x42a3fc)['then'](handleEntityNotFound(_0x1de847,null))[_0xd028('0x28')](respondWithResult(_0x1de847,null))[_0xd028('0x48')](handleError(_0x1de847,null));};exports[_0xd028('0x4b')]=function(_0xf0bd53,_0x30d7b6){return db['FaxQueueReport']['create'](_0xf0bd53['body'],{})['then'](respondWithResult(_0x30d7b6,0xc9))[_0xd028('0x48')](handleError(_0x30d7b6,null));};exports[_0xd028('0x27')]=function(_0x2ca45d,_0x3db4b8){if(_0x2ca45d[_0xd028('0x4c')]['id']){delete _0x2ca45d[_0xd028('0x4c')]['id'];}return db[_0xd028('0x2f')][_0xd028('0x4a')]({'where':{'id':_0x2ca45d[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3db4b8,null))[_0xd028('0x28')](saveUpdates(_0x2ca45d[_0xd028('0x4c')],null))[_0xd028('0x28')](respondWithResult(_0x3db4b8,null))[_0xd028('0x48')](handleError(_0x3db4b8,null));};exports[_0xd028('0x29')]=function(_0x13b619,_0x4a2c39){return db['FaxQueueReport'][_0xd028('0x4a')]({'where':{'id':_0x13b619[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2c39,null))[_0xd028('0x28')](removeEntity(_0x4a2c39,null))[_0xd028('0x48')](handleError(_0x4a2c39,null));};exports[_0xd028('0x4e')]=function(_0x1d337d,_0x29d5d2){return db[_0xd028('0x2f')][_0xd028('0x4e')]()[_0xd028('0x28')](respondWithResult(_0x29d5d2,null))[_0xd028('0x48')](handleError(_0x29d5d2,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 752dbac..bf21712 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 _0x0295=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path'];(function(_0x53c541,_0x97bb02){var _0xf88191=function(_0x19dd39){while(--_0x19dd39){_0x53c541['push'](_0x53c541['shift']());}};_0xf88191(++_0x97bb02);}(_0x0295,0x1f0));var _0x5029=function(_0x4eee80,_0x4a0b9a){_0x4eee80=_0x4eee80-0x0;var _0x10d6f0=_0x0295[_0x4eee80];return _0x10d6f0;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5029('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x251ea9,_0x1e1d6c){var _0x5b1e36=function(_0x3dbfff){while(--_0x3dbfff){_0x251ea9['push'](_0x251ea9['shift']());}};_0x5b1e36(++_0x1e1d6c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 101a6ed..f0a1420 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 _0x15d1=['FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b6c09,_0x381db2){var _0x575461=function(_0xa4559a){while(--_0xa4559a){_0x4b6c09['push'](_0x4b6c09['shift']());}};_0x575461(++_0x381db2);}(_0x15d1,0x8d));var _0x115d=function(_0x49c5b0,_0xca8692){_0x49c5b0=_0x49c5b0-0x0;var _0x4efb64=_0x15d1[_0x49c5b0];return _0x4efb64;};'use strict';var _=require(_0x115d('0x0'));var util=require('util');var moment=require(_0x115d('0x1'));var BPromise=require(_0x115d('0x2'));var rs=require(_0x115d('0x3'));var fs=require('fs');var Redis=require(_0x115d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x115d('0x5'))('rpc');var config=require(_0x115d('0x6'));var jayson=require(_0x115d('0x7'));var client=jayson[_0x115d('0x8')][_0x115d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14b3dd,_0x175df8,_0x523aa1){return new BPromise(function(_0x13e12c,_0xd96cda){return client[_0x115d('0xa')](_0x14b3dd,_0x523aa1)[_0x115d('0xb')](function(_0x5bb29f){logger[_0x115d('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x175df8,_0x115d('0xd'));logger[_0x115d('0xe')](_0x115d('0xf'),_0x175df8,_0x115d('0xd'),JSON[_0x115d('0x10')](_0x5bb29f));if(_0x5bb29f[_0x115d('0x11')]){if(_0x5bb29f[_0x115d('0x11')][_0x115d('0x12')]===0x1f4){logger[_0x115d('0x11')](_0x115d('0x13'),_0x175df8,_0x5bb29f['error'][_0x115d('0x14')]);return _0xd96cda(_0x5bb29f[_0x115d('0x11')][_0x115d('0x14')]);}logger['error'](_0x115d('0x13'),_0x175df8,_0x5bb29f['error'][_0x115d('0x14')]);return _0x13e12c(_0x5bb29f['error'][_0x115d('0x14')]);}else{logger[_0x115d('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x175df8,_0x115d('0xd'));_0x13e12c(_0x5bb29f[_0x115d('0x15')][_0x115d('0x14')]);}})[_0x115d('0x16')](function(_0x47c8ca){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x175df8,_0x47c8ca);_0xd96cda(_0x47c8ca);});});}exports[_0x115d('0x17')]=function(_0x36366f){var _0x5b9bd8=this;return new Promise(function(_0x37b0f1,_0x62e4ad){return db[_0x115d('0x18')][_0x115d('0x19')](_0x36366f[_0x115d('0x1a')],{'raw':_0x36366f[_0x115d('0x1b')]?_0x36366f[_0x115d('0x1b')][_0x115d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x56b7ac){logger[_0x115d('0xc')](_0x115d('0x17'),_0x36366f);logger[_0x115d('0xe')]('CreateFaxQueueReport',_0x36366f,JSON['stringify'](_0x56b7ac));_0x37b0f1(_0x56b7ac);})['catch'](function(_0x4e6e16){logger['error']('CreateFaxQueueReport',_0x4e6e16[_0x115d('0x14')],_0x36366f);_0x62e4ad(_0x5b9bd8['error'](0x1f4,_0x4e6e16[_0x115d('0x14')]));});});};exports[_0x115d('0x1d')]=function(_0x279ed3){var _0x57266d=this;return new Promise(function(_0x39e0c2,_0x299aa4){return db[_0x115d('0x18')]['update'](_0x279ed3['body'],{'raw':_0x279ed3[_0x115d('0x1b')]?_0x279ed3['options'][_0x115d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x279ed3[_0x115d('0x1b')]?_0x279ed3[_0x115d('0x1b')]['where']||null:null,'attributes':_0x279ed3['options']?_0x279ed3['options'][_0x115d('0x1e')]||null:null,'limit':_0x279ed3['options']?_0x279ed3[_0x115d('0x1b')][_0x115d('0x1f')]||null:null})[_0x115d('0xb')](function(_0x571cb8){logger[_0x115d('0xc')](_0x115d('0x1d'),_0x279ed3);logger['debug'](_0x115d('0x1d'),_0x279ed3,JSON[_0x115d('0x10')](_0x571cb8));_0x39e0c2(_0x571cb8);})[_0x115d('0x16')](function(_0x58205d){logger['error']('UpdateFaxQueueReport',_0x58205d[_0x115d('0x14')],_0x279ed3);_0x299aa4(_0x57266d[_0x115d('0x11')](0x1f4,_0x58205d[_0x115d('0x14')]));});});}; \ No newline at end of file +var _0x3eb8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','then','stringify','UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0xee6a46,_0x3cead3){var _0xe5c278=function(_0x16aeb8){while(--_0x16aeb8){_0xee6a46['push'](_0xee6a46['shift']());}};_0xe5c278(++_0x3cead3);}(_0x3eb8,0xe9));var _0x83eb=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x3eb8[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x83eb('0x0'));var util=require(_0x83eb('0x1'));var moment=require(_0x83eb('0x2'));var BPromise=require(_0x83eb('0x3'));var rs=require(_0x83eb('0x4'));var fs=require('fs');var Redis=require(_0x83eb('0x5'));var db=require(_0x83eb('0x6'))['db'];var utils=require(_0x83eb('0x7'));var logger=require(_0x83eb('0x8'))(_0x83eb('0x9'));var config=require(_0x83eb('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x83eb('0xb')][_0x83eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5174fb,_0x141b15,_0x4f092f){return new BPromise(function(_0x49f3dc,_0xd178e2){return client[_0x83eb('0xd')](_0x5174fb,_0x4f092f)['then'](function(_0xd5c7d1){logger[_0x83eb('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x141b15,_0x83eb('0xf'));logger['debug'](_0x83eb('0x10'),_0x141b15,'request\x20sent',JSON['stringify'](_0xd5c7d1));if(_0xd5c7d1[_0x83eb('0x11')]){if(_0xd5c7d1['error'][_0x83eb('0x12')]===0x1f4){logger[_0x83eb('0x11')](_0x83eb('0x13'),_0x141b15,_0xd5c7d1[_0x83eb('0x11')][_0x83eb('0x14')]);return _0xd178e2(_0xd5c7d1[_0x83eb('0x11')][_0x83eb('0x14')]);}logger[_0x83eb('0x11')](_0x83eb('0x13'),_0x141b15,_0xd5c7d1[_0x83eb('0x11')][_0x83eb('0x14')]);return _0x49f3dc(_0xd5c7d1['error'][_0x83eb('0x14')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x141b15,'request\x20sent');_0x49f3dc(_0xd5c7d1[_0x83eb('0x15')][_0x83eb('0x14')]);}})[_0x83eb('0x16')](function(_0x5d1e70){logger[_0x83eb('0x11')](_0x83eb('0x13'),_0x141b15,_0x5d1e70);_0xd178e2(_0x5d1e70);});});}exports[_0x83eb('0x17')]=function(_0x341af3){var _0x29d7fb=this;return new Promise(function(_0x190d12,_0x48c0df){return db[_0x83eb('0x18')]['create'](_0x341af3[_0x83eb('0x19')],{'raw':_0x341af3['options']?_0x341af3[_0x83eb('0x1a')][_0x83eb('0x1b')]===undefined?!![]:![]:!![]})[_0x83eb('0x1c')](function(_0x3a4cf1){logger['info']('CreateFaxQueueReport',_0x341af3);logger['debug'](_0x83eb('0x17'),_0x341af3,JSON[_0x83eb('0x1d')](_0x3a4cf1));_0x190d12(_0x3a4cf1);})['catch'](function(_0x4fad2f){logger[_0x83eb('0x11')]('CreateFaxQueueReport',_0x4fad2f[_0x83eb('0x14')],_0x341af3);_0x48c0df(_0x29d7fb[_0x83eb('0x11')](0x1f4,_0x4fad2f['message']));});});};exports[_0x83eb('0x1e')]=function(_0x6b4336){var _0x2eba3f=this;return new Promise(function(_0x400880,_0x10a3be){return db[_0x83eb('0x18')]['update'](_0x6b4336[_0x83eb('0x19')],{'raw':_0x6b4336[_0x83eb('0x1a')]?_0x6b4336[_0x83eb('0x1a')][_0x83eb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6b4336[_0x83eb('0x1a')]?_0x6b4336[_0x83eb('0x1a')][_0x83eb('0x1f')]||null:null,'attributes':_0x6b4336['options']?_0x6b4336[_0x83eb('0x1a')][_0x83eb('0x20')]||null:null,'limit':_0x6b4336[_0x83eb('0x1a')]?_0x6b4336[_0x83eb('0x1a')][_0x83eb('0x21')]||null:null})[_0x83eb('0x1c')](function(_0x3f3ebf){logger[_0x83eb('0xe')](_0x83eb('0x1e'),_0x6b4336);logger['debug'](_0x83eb('0x1e'),_0x6b4336,JSON[_0x83eb('0x1d')](_0x3f3ebf));_0x400880(_0x3f3ebf);})['catch'](function(_0x155de9){logger[_0x83eb('0x11')](_0x83eb('0x1e'),_0x155de9[_0x83eb('0x14')],_0x6b4336);_0x10a3be(_0x2eba3f[_0x83eb('0x11')](0x1f4,_0x155de9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8de2ef9..ad75e86 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 _0x1bd9=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','update','delete','destroy','connect-timeout','express'];(function(_0x5a19a0,_0x3dfbdf){var _0x3bc95a=function(_0x445a2c){while(--_0x445a2c){_0x5a19a0['push'](_0x5a19a0['shift']());}};_0x3bc95a(++_0x3dfbdf);}(_0x1bd9,0x97));var _0x91bd=function(_0x44ebac,_0xc105b3){_0x44ebac=_0x44ebac-0x0;var _0x40f975=_0x1bd9[_0x44ebac];return _0x40f975;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x91bd('0x0'));var express=require(_0x91bd('0x1'));var router=express[_0x91bd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x91bd('0x3'));var interaction=require(_0x91bd('0x4'));var config=require(_0x91bd('0x5'));var controller=require(_0x91bd('0x6'));router[_0x91bd('0x7')]('/',auth[_0x91bd('0x8')](),controller['index']);router[_0x91bd('0x7')](_0x91bd('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x91bd('0xa'),auth[_0x91bd('0x8')](),controller['show']);router[_0x91bd('0xb')]('/',auth['isAuthenticated'](),controller[_0x91bd('0xc')]);router[_0x91bd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x91bd('0xe')]);router[_0x91bd('0xf')](_0x91bd('0xa'),auth[_0x91bd('0x8')](),controller[_0x91bd('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf8e7=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','util'];(function(_0x256823,_0x1e8306){var _0x25a70f=function(_0x159bca){while(--_0x159bca){_0x256823['push'](_0x256823['shift']());}};_0x25a70f(++_0x1e8306);}(_0xf8e7,0x18f));var _0x7f8e=function(_0x512e20,_0x382b11){_0x512e20=_0x512e20-0x0;var _0x3496e2=_0xf8e7[_0x512e20];return _0x3496e2;};'use strict';var multer=require('multer');var util=require(_0x7f8e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f8e('0x1'));var router=express[_0x7f8e('0x2')]();var fs_extra=require(_0x7f8e('0x3'));var auth=require(_0x7f8e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x7f8e('0x5')]('/',auth[_0x7f8e('0x6')](),controller[_0x7f8e('0x7')]);router[_0x7f8e('0x5')](_0x7f8e('0x8'),auth[_0x7f8e('0x6')](),controller[_0x7f8e('0x9')]);router[_0x7f8e('0x5')](_0x7f8e('0xa'),auth[_0x7f8e('0x6')](),controller[_0x7f8e('0xb')]);router['post']('/',auth[_0x7f8e('0x6')](),controller[_0x7f8e('0xc')]);router['put'](_0x7f8e('0xa'),auth[_0x7f8e('0x6')](),controller[_0x7f8e('0xd')]);router['delete'](_0x7f8e('0xa'),auth[_0x7f8e('0x6')](),controller[_0x7f8e('0xe')]);module[_0x7f8e('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 472d6fc..50c5a73 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x54f1dc,_0x863c6b){var _0x257fcb=function(_0x19079c){while(--_0x19079c){_0x54f1dc['push'](_0x54f1dc['shift']());}};_0x257fcb(++_0x863c6b);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1eda88,_0x555454){var _0x2eb594=function(_0x250216){while(--_0x250216){_0x1eda88['push'](_0x1eda88['shift']());}};_0x2eb594(++_0x555454);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b257a65..61898fb 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 _0x7251=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','FaxTransferReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','findAll','rows','catch','keys','rawAttributes','includeAll','include','options','find','create','body','update','params','describe','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x7251,0x16f));var _0x1725=function(_0x35336e,_0x33f95e){_0x35336e=_0x35336e-0x0;var _0x32102b=_0x7251[_0x35336e];return _0x32102b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1725('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1725('0x1'));var rp=require(_0x1725('0x2'));var moment=require('moment');var BPromise=require(_0x1725('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1725('0x4'));var sox=require(_0x1725('0x5'));var csv=require(_0x1725('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1725('0x7'));var _=require(_0x1725('0x8'));var squel=require('squel');var crypto=require(_0x1725('0x9'));var jsforce=require(_0x1725('0xa'));var deskjs=require(_0x1725('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1725('0xc'));var Papa=require(_0x1725('0xd'));var Redis=require(_0x1725('0xe'));var authService=require(_0x1725('0xf'));var qs=require(_0x1725('0x10'));var as=require(_0x1725('0x11'));var hardwareService=require(_0x1725('0x12'));var logger=require(_0x1725('0x13'))(_0x1725('0x14'));var utils=require(_0x1725('0x15'));var config=require(_0x1725('0x16'));var licenseUtil=require(_0x1725('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54cf0e,_0x329b21){_0x329b21=_0x329b21||0xcc;return function(_0x32aa6e){if(_0x32aa6e){return _0x54cf0e[_0x1725('0x18')](_0x329b21);}return _0x54cf0e['status'](_0x329b21)[_0x1725('0x19')]();};}function respondWithResult(_0x26c5d3,_0x1fab5a){_0x1fab5a=_0x1fab5a||0xc8;return function(_0x3f81a0){if(_0x3f81a0){return _0x26c5d3[_0x1725('0x1a')](_0x1fab5a)[_0x1725('0x1b')](_0x3f81a0);}};}function respondWithFilteredResult(_0xf0c4da,_0x2e9559){return function(_0x24fe9a){if(_0x24fe9a){var _0x2d2b24=typeof _0x2e9559[_0x1725('0x1c')]===_0x1725('0x1d')&&typeof _0x2e9559[_0x1725('0x1e')]==='undefined';var _0x321b76=_0x24fe9a[_0x1725('0x1f')];var _0x5da0e8=_0x2d2b24?0x0:_0x2e9559[_0x1725('0x1c')];var _0x3b0185=_0x2d2b24?_0x24fe9a[_0x1725('0x1f')]:_0x2e9559['offset']+_0x2e9559[_0x1725('0x1e')];var _0x633a09;if(_0x3b0185>=_0x321b76){_0x3b0185=_0x321b76;_0x633a09=0xc8;}else{_0x633a09=0xce;}_0xf0c4da[_0x1725('0x1a')](_0x633a09);return _0xf0c4da['set'](_0x1725('0x20'),_0x5da0e8+'-'+_0x3b0185+'/'+_0x321b76)['json'](_0x24fe9a);}return null;};}function patchUpdates(_0x23b013){return function(_0x4ec765){try{jsonpatch[_0x1725('0x21')](_0x4ec765,_0x23b013,!![]);}catch(_0x2c5440){return BPromise[_0x1725('0x22')](_0x2c5440);}return _0x4ec765[_0x1725('0x23')]();};}function saveUpdates(_0x8cf001,_0x400603){return function(_0x45687b){if(_0x45687b){return _0x45687b['update'](_0x8cf001)['then'](function(_0x1d821e){return _0x1d821e;});}return null;};}function removeEntity(_0x4b60c3,_0x5cef70){return function(_0x48e925){if(_0x48e925){return _0x48e925[_0x1725('0x24')]()[_0x1725('0x25')](function(){_0x4b60c3[_0x1725('0x1a')](0xcc)[_0x1725('0x19')]();});}};}function handleEntityNotFound(_0x5d10a4,_0x609a4b){return function(_0xc3bf23){if(!_0xc3bf23){_0x5d10a4[_0x1725('0x18')](0x194);}return _0xc3bf23;};}function handleError(_0x71ca96,_0x40a04f){_0x40a04f=_0x40a04f||0x1f4;return function(_0x36bff7){logger[_0x1725('0x26')](_0x36bff7[_0x1725('0x27')]);if(_0x36bff7['name']){delete _0x36bff7[_0x1725('0x28')];}_0x71ca96[_0x1725('0x1a')](_0x40a04f)[_0x1725('0x29')](_0x36bff7);};}exports['index']=function(_0x4edb55,_0x11aa5b){var _0x459794={},_0x186196={},_0x315735={'count':0x0,'rows':[]};var _0x3ccaff=_[_0x1725('0x2a')](db[_0x1725('0x2b')]['rawAttributes'],function(_0x2c0298){return{'name':_0x2c0298[_0x1725('0x2c')],'type':_0x2c0298['type'][_0x1725('0x2d')]};});_0x186196[_0x1725('0x2e')]=_['map'](_0x3ccaff,_0x1725('0x28'));_0x186196['query']=_['keys'](_0x4edb55[_0x1725('0x2f')]);_0x186196[_0x1725('0x30')]=_[_0x1725('0x31')](_0x186196['model'],_0x186196[_0x1725('0x2f')]);_0x459794[_0x1725('0x32')]=_['intersection'](_0x186196[_0x1725('0x2e')],qs[_0x1725('0x33')](_0x4edb55['query'][_0x1725('0x33')]));_0x459794[_0x1725('0x32')]=_0x459794[_0x1725('0x32')][_0x1725('0x34')]?_0x459794['attributes']:_0x186196[_0x1725('0x2e')];if(!_0x4edb55[_0x1725('0x2f')][_0x1725('0x35')]('nolimit')){_0x459794[_0x1725('0x1e')]=qs['limit'](_0x4edb55[_0x1725('0x2f')][_0x1725('0x1e')]);_0x459794['offset']=qs[_0x1725('0x1c')](_0x4edb55[_0x1725('0x2f')][_0x1725('0x1c')]);}_0x459794[_0x1725('0x36')]=qs[_0x1725('0x37')](_0x4edb55['query'][_0x1725('0x37')]);_0x459794[_0x1725('0x38')]=qs['filters'](_['pick'](_0x4edb55[_0x1725('0x2f')],_0x186196['filters']),_0x3ccaff);if(_0x4edb55[_0x1725('0x2f')]['filter']){_0x459794[_0x1725('0x38')]=_[_0x1725('0x39')](_0x459794[_0x1725('0x38')],{'$or':_[_0x1725('0x2a')](_0x3ccaff,function(_0xea4490){if(_0xea4490[_0x1725('0x3a')]!==_0x1725('0x3b')){var _0x536b6c={};_0x536b6c[_0xea4490[_0x1725('0x28')]]={'$like':'%'+_0x4edb55['query'][_0x1725('0x3c')]+'%'};return _0x536b6c;}})});}_0x459794=_[_0x1725('0x39')]({},_0x459794,_0x4edb55['options']);var _0x54f9b3={'where':_0x459794[_0x1725('0x38')]};return db['FaxTransferReport']['count'](_0x54f9b3)[_0x1725('0x25')](function(_0x1b8cbb){_0x315735[_0x1725('0x1f')]=_0x1b8cbb;if(_0x4edb55['query']['includeAll']){_0x459794['include']=[{'all':!![]}];}return db[_0x1725('0x2b')][_0x1725('0x3d')](_0x459794);})[_0x1725('0x25')](function(_0x109f1a){_0x315735[_0x1725('0x3e')]=_0x109f1a;return _0x315735;})[_0x1725('0x25')](respondWithFilteredResult(_0x11aa5b,_0x459794))[_0x1725('0x3f')](handleError(_0x11aa5b,null));};exports['show']=function(_0x584664,_0x54a214){var _0x3a21ad={'raw':!![],'where':{'id':_0x584664['params']['id']}},_0x3fe4d4={};_0x3fe4d4['model']=_[_0x1725('0x40')](db['FaxTransferReport'][_0x1725('0x41')]);_0x3fe4d4[_0x1725('0x2f')]=_['keys'](_0x584664[_0x1725('0x2f')]);_0x3fe4d4[_0x1725('0x30')]=_[_0x1725('0x31')](_0x3fe4d4['model'],_0x3fe4d4[_0x1725('0x2f')]);_0x3a21ad[_0x1725('0x32')]=_[_0x1725('0x31')](_0x3fe4d4[_0x1725('0x2e')],qs[_0x1725('0x33')](_0x584664[_0x1725('0x2f')][_0x1725('0x33')]));_0x3a21ad[_0x1725('0x32')]=_0x3a21ad[_0x1725('0x32')][_0x1725('0x34')]?_0x3a21ad[_0x1725('0x32')]:_0x3fe4d4[_0x1725('0x2e')];if(_0x584664[_0x1725('0x2f')][_0x1725('0x42')]){_0x3a21ad[_0x1725('0x43')]=[{'all':!![]}];}_0x3a21ad=_[_0x1725('0x39')]({},_0x3a21ad,_0x584664[_0x1725('0x44')]);return db[_0x1725('0x2b')][_0x1725('0x45')](_0x3a21ad)[_0x1725('0x25')](handleEntityNotFound(_0x54a214,null))['then'](respondWithResult(_0x54a214,null))[_0x1725('0x3f')](handleError(_0x54a214,null));};exports[_0x1725('0x46')]=function(_0xaecdd3,_0x511838){return db[_0x1725('0x2b')][_0x1725('0x46')](_0xaecdd3[_0x1725('0x47')],{})[_0x1725('0x25')](respondWithResult(_0x511838,0xc9))[_0x1725('0x3f')](handleError(_0x511838,null));};exports[_0x1725('0x48')]=function(_0x3602b8,_0x4b1f9c){if(_0x3602b8[_0x1725('0x47')]['id']){delete _0x3602b8[_0x1725('0x47')]['id'];}return db[_0x1725('0x2b')][_0x1725('0x45')]({'where':{'id':_0x3602b8[_0x1725('0x49')]['id']}})[_0x1725('0x25')](handleEntityNotFound(_0x4b1f9c,null))['then'](saveUpdates(_0x3602b8[_0x1725('0x47')],null))[_0x1725('0x25')](respondWithResult(_0x4b1f9c,null))['catch'](handleError(_0x4b1f9c,null));};exports[_0x1725('0x24')]=function(_0x1bfd06,_0x1d7dc3){return db['FaxTransferReport'][_0x1725('0x45')]({'where':{'id':_0x1bfd06[_0x1725('0x49')]['id']}})[_0x1725('0x25')](handleEntityNotFound(_0x1d7dc3,null))[_0x1725('0x25')](removeEntity(_0x1d7dc3,null))[_0x1725('0x3f')](handleError(_0x1d7dc3,null));};exports['describe']=function(_0x5d9e45,_0x42e164){return db[_0x1725('0x2b')][_0x1725('0x4a')]()[_0x1725('0x25')](respondWithResult(_0x42e164,null))[_0x1725('0x3f')](handleError(_0x42e164,null));}; \ No newline at end of file +var _0x01e8=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','order','sort','where','filter','merge','map','VIRTUAL','include','FaxTransferReport','findAll','catch','params','attributes','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x5ede26,_0x1cce0c){var _0x4864ac=function(_0x18870d){while(--_0x18870d){_0x5ede26['push'](_0x5ede26['shift']());}};_0x4864ac(++_0x1cce0c);}(_0x01e8,0x1c9));var _0x801e=function(_0xc106ce,_0x2c20cc){_0xc106ce=_0xc106ce-0x0;var _0x55260c=_0x01e8[_0xc106ce];return _0x55260c;};'use strict';var emlformat=require(_0x801e('0x0'));var rimraf=require(_0x801e('0x1'));var zipdir=require(_0x801e('0x2'));var jsonpatch=require(_0x801e('0x3'));var rp=require('request-promise');var moment=require(_0x801e('0x4'));var BPromise=require(_0x801e('0x5'));var Mustache=require(_0x801e('0x6'));var util=require(_0x801e('0x7'));var path=require(_0x801e('0x8'));var sox=require(_0x801e('0x9'));var csv=require(_0x801e('0xa'));var ejs=require(_0x801e('0xb'));var fs=require('fs');var fs_extra=require(_0x801e('0xc'));var _=require(_0x801e('0xd'));var squel=require(_0x801e('0xe'));var crypto=require(_0x801e('0xf'));var jsforce=require(_0x801e('0x10'));var deskjs=require(_0x801e('0x11'));var toCsv=require(_0x801e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x801e('0x12'));var authService=require(_0x801e('0x13'));var qs=require(_0x801e('0x14'));var as=require(_0x801e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x801e('0x16'))(_0x801e('0x17'));var utils=require(_0x801e('0x18'));var config=require(_0x801e('0x19'));var licenseUtil=require(_0x801e('0x1a'));var db=require(_0x801e('0x1b'))['db'];function respondWithStatusCode(_0x200cf,_0x2271f0){_0x2271f0=_0x2271f0||0xcc;return function(_0x321184){if(_0x321184){return _0x200cf[_0x801e('0x1c')](_0x2271f0);}return _0x200cf[_0x801e('0x1d')](_0x2271f0)[_0x801e('0x1e')]();};}function respondWithResult(_0x4ed885,_0x3b0127){_0x3b0127=_0x3b0127||0xc8;return function(_0x1a3681){if(_0x1a3681){return _0x4ed885[_0x801e('0x1d')](_0x3b0127)['json'](_0x1a3681);}};}function respondWithFilteredResult(_0x268552,_0x275601){return function(_0x4bacfb){if(_0x4bacfb){var _0x2053a9=typeof _0x275601['offset']===_0x801e('0x1f')&&typeof _0x275601[_0x801e('0x20')]===_0x801e('0x1f');var _0x7ce456=_0x4bacfb[_0x801e('0x21')];var _0x4ac710=_0x2053a9?0x0:_0x275601[_0x801e('0x22')];var _0x44e252=_0x2053a9?_0x4bacfb[_0x801e('0x21')]:_0x275601[_0x801e('0x22')]+_0x275601['limit'];var _0x1b4c1f;if(_0x44e252>=_0x7ce456){_0x44e252=_0x7ce456;_0x1b4c1f=0xc8;}else{_0x1b4c1f=0xce;}_0x268552[_0x801e('0x1d')](_0x1b4c1f);return _0x268552[_0x801e('0x23')]('Content-Range',_0x4ac710+'-'+_0x44e252+'/'+_0x7ce456)[_0x801e('0x24')](_0x4bacfb);}return null;};}function patchUpdates(_0x31c079){return function(_0x344f8c){try{jsonpatch[_0x801e('0x25')](_0x344f8c,_0x31c079,!![]);}catch(_0x42259d){return BPromise[_0x801e('0x26')](_0x42259d);}return _0x344f8c[_0x801e('0x27')]();};}function saveUpdates(_0x140e6a,_0x392edb){return function(_0x10e9b9){if(_0x10e9b9){return _0x10e9b9[_0x801e('0x28')](_0x140e6a)[_0x801e('0x29')](function(_0x5a6a2c){return _0x5a6a2c;});}return null;};}function removeEntity(_0x1a566a,_0x4691f1){return function(_0x8992ce){if(_0x8992ce){return _0x8992ce[_0x801e('0x2a')]()[_0x801e('0x29')](function(){_0x1a566a[_0x801e('0x1d')](0xcc)[_0x801e('0x1e')]();});}};}function handleEntityNotFound(_0xd5ca27,_0x1c334e){return function(_0x5f52a6){if(!_0x5f52a6){_0xd5ca27[_0x801e('0x1c')](0x194);}return _0x5f52a6;};}function handleError(_0x8f145e,_0x209e31){_0x209e31=_0x209e31||0x1f4;return function(_0x53d555){logger[_0x801e('0x2b')](_0x53d555[_0x801e('0x2c')]);if(_0x53d555[_0x801e('0x2d')]){delete _0x53d555[_0x801e('0x2d')];}_0x8f145e[_0x801e('0x1d')](_0x209e31)['send'](_0x53d555);};}exports[_0x801e('0x2e')]=function(_0x374b79,_0x12dd87){var _0x4b8f21={},_0x433c43={},_0x4961fe={'count':0x0,'rows':[]};var _0x1feec6=_['map'](db['FaxTransferReport'][_0x801e('0x2f')],function(_0x32544d){return{'name':_0x32544d[_0x801e('0x30')],'type':_0x32544d[_0x801e('0x31')][_0x801e('0x32')]};});_0x433c43[_0x801e('0x33')]=_['map'](_0x1feec6,'name');_0x433c43[_0x801e('0x34')]=_[_0x801e('0x35')](_0x374b79[_0x801e('0x34')]);_0x433c43[_0x801e('0x36')]=_[_0x801e('0x37')](_0x433c43['model'],_0x433c43[_0x801e('0x34')]);_0x4b8f21['attributes']=_['intersection'](_0x433c43[_0x801e('0x33')],qs[_0x801e('0x38')](_0x374b79[_0x801e('0x34')][_0x801e('0x38')]));_0x4b8f21['attributes']=_0x4b8f21['attributes'][_0x801e('0x39')]?_0x4b8f21['attributes']:_0x433c43[_0x801e('0x33')];if(!_0x374b79[_0x801e('0x34')]['hasOwnProperty']('nolimit')){_0x4b8f21[_0x801e('0x20')]=qs[_0x801e('0x20')](_0x374b79[_0x801e('0x34')][_0x801e('0x20')]);_0x4b8f21[_0x801e('0x22')]=qs[_0x801e('0x22')](_0x374b79[_0x801e('0x34')][_0x801e('0x22')]);}_0x4b8f21[_0x801e('0x3a')]=qs[_0x801e('0x3b')](_0x374b79[_0x801e('0x34')][_0x801e('0x3b')]);_0x4b8f21[_0x801e('0x3c')]=qs[_0x801e('0x36')](_['pick'](_0x374b79[_0x801e('0x34')],_0x433c43[_0x801e('0x36')]),_0x1feec6);if(_0x374b79['query'][_0x801e('0x3d')]){_0x4b8f21[_0x801e('0x3c')]=_[_0x801e('0x3e')](_0x4b8f21['where'],{'$or':_[_0x801e('0x3f')](_0x1feec6,function(_0x46b3e0){if(_0x46b3e0[_0x801e('0x31')]!==_0x801e('0x40')){var _0x2f52d0={};_0x2f52d0[_0x46b3e0[_0x801e('0x2d')]]={'$like':'%'+_0x374b79[_0x801e('0x34')][_0x801e('0x3d')]+'%'};return _0x2f52d0;}})});}_0x4b8f21=_['merge']({},_0x4b8f21,_0x374b79['options']);var _0x1b9379={'where':_0x4b8f21['where']};return db['FaxTransferReport'][_0x801e('0x21')](_0x1b9379)[_0x801e('0x29')](function(_0x3db658){_0x4961fe[_0x801e('0x21')]=_0x3db658;if(_0x374b79[_0x801e('0x34')]['includeAll']){_0x4b8f21[_0x801e('0x41')]=[{'all':!![]}];}return db[_0x801e('0x42')][_0x801e('0x43')](_0x4b8f21);})[_0x801e('0x29')](function(_0x18546e){_0x4961fe['rows']=_0x18546e;return _0x4961fe;})[_0x801e('0x29')](respondWithFilteredResult(_0x12dd87,_0x4b8f21))[_0x801e('0x44')](handleError(_0x12dd87,null));};exports['show']=function(_0x3943aa,_0x1e615b){var _0x315409={'raw':!![],'where':{'id':_0x3943aa[_0x801e('0x45')]['id']}},_0x44f03b={};_0x44f03b['model']=_['keys'](db[_0x801e('0x42')][_0x801e('0x2f')]);_0x44f03b[_0x801e('0x34')]=_[_0x801e('0x35')](_0x3943aa[_0x801e('0x34')]);_0x44f03b[_0x801e('0x36')]=_[_0x801e('0x37')](_0x44f03b[_0x801e('0x33')],_0x44f03b['query']);_0x315409[_0x801e('0x46')]=_[_0x801e('0x37')](_0x44f03b[_0x801e('0x33')],qs['fields'](_0x3943aa[_0x801e('0x34')][_0x801e('0x38')]));_0x315409[_0x801e('0x46')]=_0x315409[_0x801e('0x46')][_0x801e('0x39')]?_0x315409[_0x801e('0x46')]:_0x44f03b[_0x801e('0x33')];if(_0x3943aa[_0x801e('0x34')][_0x801e('0x47')]){_0x315409[_0x801e('0x41')]=[{'all':!![]}];}_0x315409=_[_0x801e('0x3e')]({},_0x315409,_0x3943aa[_0x801e('0x48')]);return db[_0x801e('0x42')][_0x801e('0x49')](_0x315409)['then'](handleEntityNotFound(_0x1e615b,null))[_0x801e('0x29')](respondWithResult(_0x1e615b,null))[_0x801e('0x44')](handleError(_0x1e615b,null));};exports['create']=function(_0x20a2f4,_0x5c0f92){return db[_0x801e('0x42')][_0x801e('0x4a')](_0x20a2f4[_0x801e('0x4b')],{})[_0x801e('0x29')](respondWithResult(_0x5c0f92,0xc9))[_0x801e('0x44')](handleError(_0x5c0f92,null));};exports[_0x801e('0x28')]=function(_0x31ac18,_0x13e3cd){if(_0x31ac18[_0x801e('0x4b')]['id']){delete _0x31ac18[_0x801e('0x4b')]['id'];}return db[_0x801e('0x42')][_0x801e('0x49')]({'where':{'id':_0x31ac18['params']['id']}})[_0x801e('0x29')](handleEntityNotFound(_0x13e3cd,null))[_0x801e('0x29')](saveUpdates(_0x31ac18[_0x801e('0x4b')],null))['then'](respondWithResult(_0x13e3cd,null))[_0x801e('0x44')](handleError(_0x13e3cd,null));};exports[_0x801e('0x2a')]=function(_0x32086d,_0x447750){return db['FaxTransferReport']['find']({'where':{'id':_0x32086d[_0x801e('0x45')]['id']}})['then'](handleEntityNotFound(_0x447750,null))[_0x801e('0x29')](removeEntity(_0x447750,null))[_0x801e('0x44')](handleError(_0x447750,null));};exports[_0x801e('0x4c')]=function(_0x3a9618,_0x7d7527){return db['FaxTransferReport']['describe']()[_0x801e('0x29')](respondWithResult(_0x7d7527,null))[_0x801e('0x44')](handleError(_0x7d7527,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 717d1f0..8461a49 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 _0x2b8e=['define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x92640b,_0xa0726){var _0x284fdb=function(_0x593108){while(--_0x593108){_0x92640b['push'](_0x92640b['shift']());}};_0x284fdb(++_0xa0726);}(_0x2b8e,0xf4));var _0xe2b8=function(_0x3500d2,_0xc850ed){_0x3500d2=_0x3500d2-0x0;var _0x4d3416=_0x2b8e[_0x3500d2];return _0x4d3416;};'use strict';var _=require(_0xe2b8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe2b8('0x1'));var moment=require(_0xe2b8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe2b8('0x3'));var fs=require('fs');var path=require(_0xe2b8('0x4'));var rimraf=require(_0xe2b8('0x5'));var config=require(_0xe2b8('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0xe2b8('0x7')]=function(_0x162be9,_0x56fe8f){return _0x162be9[_0xe2b8('0x8')](_0xe2b8('0x9'),attributes,{'tableName':_0xe2b8('0xa'),'paranoid':![],'indexes':[{'name':_0xe2b8('0xb'),'fields':[_0xe2b8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c0=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b328a,_0x5c48bc){var _0xfcf474=function(_0x296320){while(--_0x296320){_0x5b328a['push'](_0x5b328a['shift']());}};_0xfcf474(++_0x5c48bc);}(_0xc9c0,0x1f1));var _0x0c9c=function(_0x3348fd,_0x59ddae){_0x3348fd=_0x3348fd-0x0;var _0x400bce=_0xc9c0[_0x3348fd];return _0x400bce;};'use strict';var _=require('lodash');var util=require(_0x0c9c('0x0'));var logger=require(_0x0c9c('0x1'))('api');var moment=require(_0x0c9c('0x2'));var BPromise=require(_0x0c9c('0x3'));var rp=require(_0x0c9c('0x4'));var fs=require('fs');var path=require(_0x0c9c('0x5'));var rimraf=require(_0x0c9c('0x6'));var config=require(_0x0c9c('0x7'));var attributes=require(_0x0c9c('0x8'));module[_0x0c9c('0x9')]=function(_0x19c195,_0x3cce7e){return _0x19c195[_0x0c9c('0xa')](_0x0c9c('0xb'),attributes,{'tableName':_0x0c9c('0xc'),'paranoid':![],'indexes':[{'name':_0x0c9c('0xd'),'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 71d1df2..d4d196f 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 _0x3425=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1c016e,_0x27e48c){var _0x134963=function(_0x50be39){while(--_0x50be39){_0x1c016e['push'](_0x1c016e['shift']());}};_0x134963(++_0x27e48c);}(_0x3425,0x149));var _0x5342=function(_0x396d8f,_0x5afa8e){_0x396d8f=_0x396d8f-0x0;var _0x3c6799=_0x3425[_0x396d8f];return _0x3c6799;};'use strict';var _=require(_0x5342('0x0'));var util=require('util');var moment=require(_0x5342('0x1'));var BPromise=require(_0x5342('0x2'));var rs=require(_0x5342('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5342('0x4'))('rpc');var config=require(_0x5342('0x5'));var jayson=require(_0x5342('0x6'));var client=jayson[_0x5342('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x233a9d,_0xf0c418,_0x1b5914){return new BPromise(function(_0x3825d0,_0x4ceeb3){return client['request'](_0x233a9d,_0x1b5914)['then'](function(_0xe71720){logger['info'](_0x5342('0x8'),_0xf0c418,_0x5342('0x9'));logger[_0x5342('0xa')](_0x5342('0xb'),_0xf0c418,_0x5342('0x9'),JSON[_0x5342('0xc')](_0xe71720));if(_0xe71720[_0x5342('0xd')]){if(_0xe71720[_0x5342('0xd')][_0x5342('0xe')]===0x1f4){logger['error'](_0x5342('0x8'),_0xf0c418,_0xe71720[_0x5342('0xd')][_0x5342('0xf')]);return _0x4ceeb3(_0xe71720[_0x5342('0xd')][_0x5342('0xf')]);}logger[_0x5342('0xd')](_0x5342('0x8'),_0xf0c418,_0xe71720['error']['message']);return _0x3825d0(_0xe71720[_0x5342('0xd')][_0x5342('0xf')]);}else{logger[_0x5342('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0xf0c418,_0x5342('0x9'));_0x3825d0(_0xe71720[_0x5342('0x11')][_0x5342('0xf')]);}})[_0x5342('0x12')](function(_0x369259){logger[_0x5342('0xd')](_0x5342('0x8'),_0xf0c418,_0x369259);_0x4ceeb3(_0x369259);});});} \ No newline at end of file +var _0xa621=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message'];(function(_0x39c89e,_0x2f46a3){var _0x1c94a1=function(_0x1eada4){while(--_0x1eada4){_0x39c89e['push'](_0x39c89e['shift']());}};_0x1c94a1(++_0x2f46a3);}(_0xa621,0x8c));var _0x1a62=function(_0x166537,_0x30196b){_0x166537=_0x166537-0x0;var _0x2bf670=_0xa621[_0x166537];return _0x2bf670;};'use strict';var _=require('lodash');var util=require(_0x1a62('0x0'));var moment=require(_0x1a62('0x1'));var BPromise=require(_0x1a62('0x2'));var rs=require(_0x1a62('0x3'));var fs=require('fs');var Redis=require(_0x1a62('0x4'));var db=require(_0x1a62('0x5'))['db'];var utils=require(_0x1a62('0x6'));var logger=require(_0x1a62('0x7'))('rpc');var config=require(_0x1a62('0x8'));var jayson=require(_0x1a62('0x9'));var client=jayson[_0x1a62('0xa')][_0x1a62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2412ac,_0x445db8,_0x3f0acb){return new BPromise(function(_0x27296e,_0x5b04b7){return client['request'](_0x2412ac,_0x3f0acb)['then'](function(_0x335677){logger[_0x1a62('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x445db8,_0x1a62('0xd'));logger[_0x1a62('0xe')](_0x1a62('0xf'),_0x445db8,_0x1a62('0xd'),JSON[_0x1a62('0x10')](_0x335677));if(_0x335677['error']){if(_0x335677[_0x1a62('0x11')][_0x1a62('0x12')]===0x1f4){logger[_0x1a62('0x11')](_0x1a62('0x13'),_0x445db8,_0x335677['error'][_0x1a62('0x14')]);return _0x5b04b7(_0x335677[_0x1a62('0x11')]['message']);}logger[_0x1a62('0x11')](_0x1a62('0x13'),_0x445db8,_0x335677[_0x1a62('0x11')]['message']);return _0x27296e(_0x335677[_0x1a62('0x11')]['message']);}else{logger[_0x1a62('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x445db8,'request\x20sent');_0x27296e(_0x335677[_0x1a62('0x15')][_0x1a62('0x14')]);}})[_0x1a62('0x16')](function(_0x4bf221){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x445db8,_0x4bf221);_0x5b04b7(_0x4bf221);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e126dc1..64c5a99 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 _0x28f0=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','create','put','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x3c38c7,_0x14dd97){var _0x4aa4b1=function(_0x3f1106){while(--_0x3f1106){_0x3c38c7['push'](_0x3c38c7['shift']());}};_0x4aa4b1(++_0x14dd97);}(_0x28f0,0xdb));var _0x028f=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x28f0[_0x4b4f24];return _0x1c13d4;};'use strict';var multer=require(_0x028f('0x0'));var util=require(_0x028f('0x1'));var path=require(_0x028f('0x2'));var timeout=require(_0x028f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x028f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x028f('0x5'));var config=require(_0x028f('0x6'));var controller=require('./faxTransferReport.controller');router[_0x028f('0x7')]('/',auth[_0x028f('0x8')](),controller[_0x028f('0x9')]);router[_0x028f('0x7')](_0x028f('0xa'),auth[_0x028f('0x8')](),controller['describe']);router['get']('/:id',auth[_0x028f('0x8')](),controller[_0x028f('0xb')]);router['post']('/',auth[_0x028f('0x8')](),controller[_0x028f('0xc')]);router[_0x028f('0xd')]('/:id',auth[_0x028f('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x028f('0xe')]);module[_0x028f('0xf')]=router; \ No newline at end of file +var _0xfc6f=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x21ad60,_0x181dd2){var _0x531c8e=function(_0x9f9f91){while(--_0x9f9f91){_0x21ad60['push'](_0x21ad60['shift']());}};_0x531c8e(++_0x181dd2);}(_0xfc6f,0x10f));var _0xffc6=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xfc6f[_0x53cf8e];return _0x459197;};'use strict';var multer=require(_0xffc6('0x0'));var util=require('util');var path=require(_0xffc6('0x1'));var timeout=require(_0xffc6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xffc6('0x3'));var auth=require(_0xffc6('0x4'));var interaction=require(_0xffc6('0x5'));var config=require(_0xffc6('0x6'));var controller=require(_0xffc6('0x7'));router[_0xffc6('0x8')]('/',auth['isAuthenticated'](),controller[_0xffc6('0x9')]);router[_0xffc6('0x8')](_0xffc6('0xa'),auth[_0xffc6('0xb')](),controller[_0xffc6('0xc')]);router['get'](_0xffc6('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xffc6('0xe')]('/',auth[_0xffc6('0xb')](),controller[_0xffc6('0xf')]);router[_0xffc6('0x10')](_0xffc6('0xd'),auth['isAuthenticated'](),controller[_0xffc6('0x11')]);router[_0xffc6('0x12')]('/:id',auth[_0xffc6('0xb')](),controller[_0xffc6('0x13')]);module[_0xffc6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e4471d0..338cb58 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 _0x2887=['get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskAccount.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2887,0x1ef));var _0x7288=function(_0x367ac0,_0x2cb992){_0x367ac0=_0x367ac0-0x0;var _0x26013e=_0x2887[_0x367ac0];return _0x26013e;};'use strict';var multer=require(_0x7288('0x0'));var util=require(_0x7288('0x1'));var path=require(_0x7288('0x2'));var timeout=require(_0x7288('0x3'));var express=require(_0x7288('0x4'));var router=express[_0x7288('0x5')]();var fs_extra=require(_0x7288('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7288('0x7'));var config=require('../../config/environment');var controller=require(_0x7288('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7288('0x9')](_0x7288('0xa'),auth[_0x7288('0xb')](),controller[_0x7288('0xc')]);router['get'](_0x7288('0xd'),auth[_0x7288('0xb')](),controller[_0x7288('0xe')]);router[_0x7288('0x9')]('/:id/fields',auth[_0x7288('0xb')](),controller['getFields']);router[_0x7288('0xf')]('/',auth['isAuthenticated'](),controller[_0x7288('0x10')]);router['post'](_0x7288('0xd'),auth[_0x7288('0xb')](),controller[_0x7288('0x11')]);router[_0x7288('0x12')](_0x7288('0xa'),auth[_0x7288('0xb')](),controller['update']);router[_0x7288('0x13')](_0x7288('0xa'),auth['isAuthenticated'](),controller[_0x7288('0x14')]);module['exports']=router; \ No newline at end of file +var _0x973c=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2beb76,_0x238b0d){var _0x490908=function(_0x5ae4fe){while(--_0x5ae4fe){_0x2beb76['push'](_0x2beb76['shift']());}};_0x490908(++_0x238b0d);}(_0x973c,0x105));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc973('0x0'));var util=require(_0xc973('0x1'));var path=require(_0xc973('0x2'));var timeout=require(_0xc973('0x3'));var express=require(_0xc973('0x4'));var router=express[_0xc973('0x5')]();var fs_extra=require(_0xc973('0x6'));var auth=require(_0xc973('0x7'));var interaction=require(_0xc973('0x8'));var config=require(_0xc973('0x9'));var controller=require(_0xc973('0xa'));router[_0xc973('0xb')]('/',auth[_0xc973('0xc')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc973('0xd')]);router[_0xc973('0xb')](_0xc973('0xe'),auth[_0xc973('0xc')](),controller[_0xc973('0xf')]);router[_0xc973('0xb')](_0xc973('0x10'),auth[_0xc973('0xc')](),controller[_0xc973('0x11')]);router[_0xc973('0x12')]('/',auth[_0xc973('0xc')](),controller[_0xc973('0x13')]);router[_0xc973('0x12')]('/:id/configurations',auth[_0xc973('0xc')](),controller[_0xc973('0x14')]);router[_0xc973('0x15')](_0xc973('0x16'),auth['isAuthenticated'](),controller[_0xc973('0x17')]);router[_0xc973('0x18')](_0xc973('0x16'),auth['isAuthenticated'](),controller[_0xc973('0x19')]);module[_0xc973('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index d432d42..721697e 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 _0x00da=['basic','integrationTab','sequelize','STRING','ENUM'];(function(_0x4a3bd9,_0x4c6ea8){var _0x45b132=function(_0x8cf988){while(--_0x8cf988){_0x4a3bd9['push'](_0x4a3bd9['shift']());}};_0x45b132(++_0x4c6ea8);}(_0x00da,0x179));var _0xa00d=function(_0x14a07c,_0x5a9c98){_0x14a07c=_0x14a07c-0x0;var _0x3d0000=_0x00da[_0x14a07c];return _0x3d0000;};'use strict';var Sequelize=require(_0xa00d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa00d('0x1')]},'username':{'type':Sequelize[_0xa00d('0x1')]},'remoteUri':{'type':Sequelize[_0xa00d('0x1')]},'authType':{'type':Sequelize[_0xa00d('0x2')](_0xa00d('0x3')),'defaultValue':_0xa00d('0x3')},'password':{'type':Sequelize[_0xa00d('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa00d('0x1')]},'token':{'type':Sequelize[_0xa00d('0x1')]},'tokenSecret':{'type':Sequelize[_0xa00d('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa00d('0x4'),'newTab'),'defaultValue':_0xa00d('0x4')}}; \ No newline at end of file +var _0xfb03=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x58063a,_0x328ef2){var _0x2edf64=function(_0x3c929c){while(--_0x3c929c){_0x58063a['push'](_0x58063a['shift']());}};_0x2edf64(++_0x328ef2);}(_0xfb03,0x1e4));var _0x3fb0=function(_0x3f6dad,_0x1cb4e2){_0x3f6dad=_0x3f6dad-0x0;var _0x42114d=_0xfb03[_0x3f6dad];return _0x42114d;};'use strict';var Sequelize=require(_0x3fb0('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fb0('0x1')]},'description':{'type':Sequelize[_0x3fb0('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fb0('0x1')]},'authType':{'type':Sequelize[_0x3fb0('0x2')](_0x3fb0('0x3')),'defaultValue':_0x3fb0('0x3')},'password':{'type':Sequelize[_0x3fb0('0x1')]},'consumerKey':{'type':Sequelize[_0x3fb0('0x1')]},'consumerSecret':{'type':Sequelize[_0x3fb0('0x1')]},'token':{'type':Sequelize[_0x3fb0('0x1')]},'tokenSecret':{'type':Sequelize[_0x3fb0('0x1')]},'serverUrl':{'type':Sequelize[_0x3fb0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3fb0('0x2')](_0x3fb0('0x4'),_0x3fb0('0x5')),'defaultValue':_0x3fb0('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index bf4c8cf..0ceebde 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 _0x7db5=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','show','params','find','create','body','catch','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','priority','authType','username','password','consumerKey','consumerSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','update','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x26ac82,_0x4b0c32){var _0x2e3c78=function(_0xd1c0c2){while(--_0xd1c0c2){_0x26ac82['push'](_0x26ac82['shift']());}};_0x2e3c78(++_0x4b0c32);}(_0x7db5,0x1f4));var _0x57db=function(_0x58ac5d,_0x38b607){_0x58ac5d=_0x58ac5d-0x0;var _0x2c2b6d=_0x7db5[_0x58ac5d];return _0x2c2b6d;};'use strict';var emlformat=require(_0x57db('0x0'));var rimraf=require(_0x57db('0x1'));var zipdir=require(_0x57db('0x2'));var jsonpatch=require(_0x57db('0x3'));var rp=require('request-promise');var moment=require(_0x57db('0x4'));var BPromise=require(_0x57db('0x5'));var Mustache=require(_0x57db('0x6'));var util=require('util');var path=require(_0x57db('0x7'));var sox=require('sox');var csv=require(_0x57db('0x8'));var ejs=require(_0x57db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57db('0xa'));var squel=require('squel');var crypto=require(_0x57db('0xb'));var jsforce=require(_0x57db('0xc'));var deskjs=require(_0x57db('0xd'));var toCsv=require(_0x57db('0x8'));var querystring=require(_0x57db('0xe'));var Papa=require('papaparse');var Redis=require(_0x57db('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57db('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x57db('0x11'));var config=require(_0x57db('0x12'));var licenseUtil=require(_0x57db('0x13'));var db=require(_0x57db('0x14'))['db'];var integrations=require(_0x57db('0x15'));function respondWithStatusCode(_0x356f12,_0x3896f8){_0x3896f8=_0x3896f8||0xcc;return function(_0x387e54){if(_0x387e54){return _0x356f12[_0x57db('0x16')](_0x3896f8);}return _0x356f12['status'](_0x3896f8)[_0x57db('0x17')]();};}function respondWithResult(_0x4a463c,_0x140a62){_0x140a62=_0x140a62||0xc8;return function(_0x712fe8){if(_0x712fe8){return _0x4a463c['status'](_0x140a62)[_0x57db('0x18')](_0x712fe8);}};}function respondWithFilteredResult(_0x2b29ff,_0x456de2){return function(_0x5140ac){if(_0x5140ac){var _0x36ea3f=typeof _0x456de2[_0x57db('0x19')]===_0x57db('0x1a')&&typeof _0x456de2['limit']==='undefined';var _0x139387=_0x5140ac[_0x57db('0x1b')];var _0x162bfa=_0x36ea3f?0x0:_0x456de2[_0x57db('0x19')];var _0x14ab74=_0x36ea3f?_0x5140ac[_0x57db('0x1b')]:_0x456de2[_0x57db('0x19')]+_0x456de2[_0x57db('0x1c')];var _0x125f1c;if(_0x14ab74>=_0x139387){_0x14ab74=_0x139387;_0x125f1c=0xc8;}else{_0x125f1c=0xce;}_0x2b29ff[_0x57db('0x1d')](_0x125f1c);return _0x2b29ff[_0x57db('0x1e')]('Content-Range',_0x162bfa+'-'+_0x14ab74+'/'+_0x139387)[_0x57db('0x18')](_0x5140ac);}return null;};}function patchUpdates(_0x48ba3d){return function(_0x43a959){try{jsonpatch[_0x57db('0x1f')](_0x43a959,_0x48ba3d,!![]);}catch(_0x3bb409){return BPromise['reject'](_0x3bb409);}return _0x43a959['save']();};}function saveUpdates(_0xf9aa51,_0x94e0ac){return function(_0x422b0e){if(_0x422b0e){return _0x422b0e[_0x57db('0x20')](_0xf9aa51)[_0x57db('0x21')](function(_0x326ce3){return _0x326ce3;});}return null;};}function removeEntity(_0x119ca9,_0x2112a0){return function(_0x535c38){if(_0x535c38){return _0x535c38[_0x57db('0x22')]()['then'](function(){_0x119ca9[_0x57db('0x1d')](0xcc)[_0x57db('0x17')]();});}};}function handleEntityNotFound(_0x32eab3,_0x2bc82f){return function(_0x52e80b){if(!_0x52e80b){_0x32eab3[_0x57db('0x16')](0x194);}return _0x52e80b;};}function handleError(_0x17193c,_0x3a5a93){_0x3a5a93=_0x3a5a93||0x1f4;return function(_0x4e1198){logger[_0x57db('0x23')](_0x4e1198[_0x57db('0x24')]);if(_0x4e1198[_0x57db('0x25')]){delete _0x4e1198[_0x57db('0x25')];}_0x17193c['status'](_0x3a5a93)[_0x57db('0x26')](_0x4e1198);};}exports[_0x57db('0x27')]=function(_0x59c303,_0x53f634){var _0x381862={},_0x43d0d3={},_0xef0767={'count':0x0,'rows':[]};var _0x1c67b0=_[_0x57db('0x28')](db[_0x57db('0x29')][_0x57db('0x2a')],function(_0x1d4521){return{'name':_0x1d4521[_0x57db('0x2b')],'type':_0x1d4521[_0x57db('0x2c')][_0x57db('0x2d')]};});_0x43d0d3[_0x57db('0x2e')]=_[_0x57db('0x28')](_0x1c67b0,_0x57db('0x25'));_0x43d0d3[_0x57db('0x2f')]=_[_0x57db('0x30')](_0x59c303[_0x57db('0x2f')]);_0x43d0d3[_0x57db('0x31')]=_[_0x57db('0x32')](_0x43d0d3[_0x57db('0x2e')],_0x43d0d3[_0x57db('0x2f')]);_0x381862['attributes']=_[_0x57db('0x32')](_0x43d0d3[_0x57db('0x2e')],qs[_0x57db('0x33')](_0x59c303[_0x57db('0x2f')][_0x57db('0x33')]));_0x381862[_0x57db('0x34')]=_0x381862[_0x57db('0x34')][_0x57db('0x35')]?_0x381862[_0x57db('0x34')]:_0x43d0d3[_0x57db('0x2e')];if(!_0x59c303[_0x57db('0x2f')][_0x57db('0x36')](_0x57db('0x37'))){_0x381862[_0x57db('0x1c')]=qs[_0x57db('0x1c')](_0x59c303[_0x57db('0x2f')][_0x57db('0x1c')]);_0x381862[_0x57db('0x19')]=qs[_0x57db('0x19')](_0x59c303[_0x57db('0x2f')][_0x57db('0x19')]);}_0x381862['order']=qs[_0x57db('0x38')](_0x59c303[_0x57db('0x2f')]['sort']);_0x381862[_0x57db('0x39')]=qs[_0x57db('0x31')](_[_0x57db('0x3a')](_0x59c303[_0x57db('0x2f')],_0x43d0d3[_0x57db('0x31')]),_0x1c67b0);if(_0x59c303['query']['filter']){_0x381862[_0x57db('0x39')]=_[_0x57db('0x3b')](_0x381862[_0x57db('0x39')],{'$or':_[_0x57db('0x28')](_0x1c67b0,function(_0x4e3627){if(_0x4e3627['type']!=='VIRTUAL'){var _0x3924e9={};_0x3924e9[_0x4e3627[_0x57db('0x25')]]={'$like':'%'+_0x59c303[_0x57db('0x2f')][_0x57db('0x3c')]+'%'};return _0x3924e9;}})});}_0x381862=_['merge']({},_0x381862,_0x59c303[_0x57db('0x3d')]);var _0xd9e134={'where':_0x381862['where']};return db[_0x57db('0x29')]['count'](_0xd9e134)['then'](function(_0x1db487){_0xef0767[_0x57db('0x1b')]=_0x1db487;if(_0x59c303['query'][_0x57db('0x3e')]){_0x381862[_0x57db('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0x57db('0x40')](_0x381862);})['then'](function(_0x4cc65d){_0xef0767['rows']=_0x4cc65d;return _0xef0767;})[_0x57db('0x21')](respondWithFilteredResult(_0x53f634,_0x381862))['catch'](handleError(_0x53f634,null));};exports[_0x57db('0x41')]=function(_0x44e325,_0x337e4f){var _0x2c3d62={'raw':![],'where':{'id':_0x44e325[_0x57db('0x42')]['id']}},_0x3404b4={};_0x3404b4[_0x57db('0x2e')]=_['keys'](db[_0x57db('0x29')][_0x57db('0x2a')]);_0x3404b4[_0x57db('0x2f')]=_['keys'](_0x44e325[_0x57db('0x2f')]);_0x3404b4[_0x57db('0x31')]=_[_0x57db('0x32')](_0x3404b4[_0x57db('0x2e')],_0x3404b4[_0x57db('0x2f')]);_0x2c3d62[_0x57db('0x34')]=_[_0x57db('0x32')](_0x3404b4[_0x57db('0x2e')],qs[_0x57db('0x33')](_0x44e325[_0x57db('0x2f')][_0x57db('0x33')]));_0x2c3d62[_0x57db('0x34')]=_0x2c3d62[_0x57db('0x34')][_0x57db('0x35')]?_0x2c3d62[_0x57db('0x34')]:_0x3404b4[_0x57db('0x2e')];if(_0x44e325['query']['includeAll']){_0x2c3d62[_0x57db('0x3f')]=[{'all':!![]}];}_0x2c3d62=_[_0x57db('0x3b')]({},_0x2c3d62,_0x44e325['options']);return db[_0x57db('0x29')][_0x57db('0x43')](_0x2c3d62)[_0x57db('0x21')](handleEntityNotFound(_0x337e4f,null))[_0x57db('0x21')](respondWithResult(_0x337e4f,null))['catch'](handleError(_0x337e4f,null));};exports[_0x57db('0x44')]=function(_0x3d7ecd,_0x37cccd){return db[_0x57db('0x29')][_0x57db('0x44')](_0x3d7ecd[_0x57db('0x45')],{})[_0x57db('0x21')](respondWithResult(_0x37cccd,0xc9))[_0x57db('0x46')](handleError(_0x37cccd,null));};exports['update']=function(_0x105b40,_0x2fffc9){if(_0x105b40[_0x57db('0x45')]['id']){delete _0x105b40['body']['id'];}return db[_0x57db('0x29')][_0x57db('0x43')]({'where':{'id':_0x105b40[_0x57db('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fffc9,null))[_0x57db('0x21')](saveUpdates(_0x105b40[_0x57db('0x45')],null))['then'](respondWithResult(_0x2fffc9,null))['catch'](handleError(_0x2fffc9,null));};exports[_0x57db('0x22')]=function(_0x451dfb,_0x3df25f){return db['DeskAccount'][_0x57db('0x43')]({'where':{'id':_0x451dfb[_0x57db('0x42')]['id']}})[_0x57db('0x21')](handleEntityNotFound(_0x3df25f,null))[_0x57db('0x21')](removeEntity(_0x3df25f,null))[_0x57db('0x46')](handleError(_0x3df25f,null));};exports[_0x57db('0x47')]=function(_0xa3c033,_0x3cd840,_0x5b2bbd){var _0x22b026={};var _0x37ec82={};var _0x50262e;var _0x14e559;return db[_0x57db('0x29')][_0x57db('0x48')]({'where':{'id':_0xa3c033[_0x57db('0x42')]['id']}})[_0x57db('0x21')](handleEntityNotFound(_0x3cd840,null))['then'](function(_0x36fd5e){if(_0x36fd5e){_0x50262e=_0x36fd5e;_0x37ec82['model']=_[_0x57db('0x30')](db['DeskConfiguration'][_0x57db('0x2a')]);_0x37ec82['query']=_['keys'](_0xa3c033['query']);_0x37ec82[_0x57db('0x31')]=_[_0x57db('0x32')](_0x37ec82['model'],_0x37ec82[_0x57db('0x2f')]);_0x22b026[_0x57db('0x34')]=_[_0x57db('0x32')](_0x37ec82[_0x57db('0x2e')],qs['fields'](_0xa3c033[_0x57db('0x2f')]['fields']));_0x22b026[_0x57db('0x34')]=_0x22b026[_0x57db('0x34')][_0x57db('0x35')]?_0x22b026[_0x57db('0x34')]:_0x37ec82[_0x57db('0x2e')];_0x22b026[_0x57db('0x49')]=qs['sort'](_0xa3c033['query']['sort']);_0x22b026[_0x57db('0x39')]=qs['filters'](_[_0x57db('0x3a')](_0xa3c033[_0x57db('0x2f')],_0x37ec82[_0x57db('0x31')]));if(_0xa3c033[_0x57db('0x2f')][_0x57db('0x3c')]){_0x22b026['where']=_[_0x57db('0x3b')](_0x22b026[_0x57db('0x39')],{'$or':_['map'](_0x22b026['attributes'],function(_0x28155d){var _0x37c9de={};_0x37c9de[_0x28155d]={'$like':'%'+_0xa3c033[_0x57db('0x2f')][_0x57db('0x3c')]+'%'};return _0x37c9de;})});}_0x22b026=_[_0x57db('0x3b')]({},_0x22b026,_0xa3c033[_0x57db('0x3d')]);return _0x50262e['getConfigurations'](_0x22b026);}})[_0x57db('0x21')](function(_0x4be80c){if(_0x4be80c){_0x14e559=_0x4be80c['length'];if(!_0xa3c033[_0x57db('0x2f')][_0x57db('0x36')]('nolimit')){_0x22b026[_0x57db('0x1c')]=qs[_0x57db('0x1c')](_0xa3c033['query'][_0x57db('0x1c')]);_0x22b026[_0x57db('0x19')]=qs[_0x57db('0x19')](_0xa3c033[_0x57db('0x2f')][_0x57db('0x19')]);}return _0x50262e['getConfigurations'](_0x22b026);}})[_0x57db('0x21')](function(_0x559212){if(_0x559212){return _0x559212?{'count':_0x14e559,'rows':_0x559212}:null;}})[_0x57db('0x21')](respondWithResult(_0x3cd840,null))[_0x57db('0x46')](handleError(_0x3cd840,null));};exports[_0x57db('0x4a')]=function(_0x81ceb8,_0x1dca6a,_0x17b3ff){if(_0x81ceb8['body']['id']){delete _0x81ceb8[_0x57db('0x45')]['id'];}return db[_0x57db('0x29')]['findOne']({'where':{'id':_0x81ceb8['params']['id']}})[_0x57db('0x21')](handleEntityNotFound(_0x1dca6a,null))['then'](function(_0x28158b){if(_0x28158b){_0x81ceb8[_0x57db('0x45')][_0x57db('0x4b')]=_0x28158b['id'];_0x81ceb8[_0x57db('0x45')][_0x57db('0x4c')]=integrations[_0x57db('0x4d')](_0x81ceb8[_0x57db('0x45')][_0x57db('0x4e')],_0x81ceb8[_0x57db('0x45')][_0x57db('0x2c')]);_0x81ceb8[_0x57db('0x45')][_0x57db('0x4f')]=integrations[_0x57db('0x50')](_0x81ceb8[_0x57db('0x45')][_0x57db('0x4e')],_0x81ceb8[_0x57db('0x45')][_0x57db('0x2c')]);return db['DeskConfiguration'][_0x57db('0x44')](_0x81ceb8[_0x57db('0x45')],{'include':[{'model':db['DeskField'],'as':_0x57db('0x4c')},{'model':db['DeskField'],'as':_0x57db('0x4f')}]});}return null;})[_0x57db('0x21')](respondWithResult(_0x1dca6a,null))[_0x57db('0x46')](handleError(_0x1dca6a,null));};exports[_0x57db('0x51')]=function(_0x44b492,_0xea8d08,_0x844839){var _0x322a9d=[{'name':_0x57db('0x52'),'label':_0x57db('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 _0x5aae33='';return db[_0x57db('0x29')][_0x57db('0x48')]({'where':{'id':_0x44b492[_0x57db('0x42')]['id']},'attributes':['id','remoteUri',_0x57db('0x53'),_0x57db('0x54'),_0x57db('0x55'),_0x57db('0x56'),_0x57db('0x57'),'token','tokenSecret']})[_0x57db('0x21')](handleEntityNotFound(_0xea8d08,null))[_0x57db('0x21')](function(_0x443a31){if(_0x443a31){_0x5aae33=_0x443a31[_0x57db('0x58')];var _0xf7d55b=_0x5aae33[_0x57db('0x59')](-0x1);if(_0xf7d55b==='/'){_0x5aae33=_0x5aae33[_0x57db('0x5a')](0x0,_0x5aae33['lastIndexOf'](_0xf7d55b));}var _0x258bd8={'method':_0x57db('0x5b'),'uri':util[_0x57db('0x5c')](_0x57db('0x5d'),_0x5aae33),'headers':{'Content-Type':'application/json','Accept':_0x57db('0x5e')},'json':!![]};if(_0x443a31['authType']===_0x57db('0x5f')){_0x258bd8[_0x57db('0x60')][_0x57db('0x61')]=util[_0x57db('0x5c')](_0x57db('0x62'),new Buffer(util[_0x57db('0x5c')]('%s:%s',_0x443a31[_0x57db('0x54')],_0x443a31[_0x57db('0x55')]))[_0x57db('0x63')](_0x57db('0x64')));}return rp(_0x258bd8)[_0x57db('0x21')](function(_0x3d45e9){return _0x322a9d[_0x57db('0x65')](_['map'](_0x3d45e9[_0x57db('0x66')][_0x57db('0x67')],function(_0x27ba19){return{'id':_0x27ba19['name'],'name':_0x27ba19[_0x57db('0x25')],'type':_0x27ba19[_0x57db('0x2c')],'active':_0x27ba19[_0x57db('0x68')],'label':_0x27ba19['label'],'custom':!![]};}));});}})[_0x57db('0x21')](function(_0x1015a6){return{'count':_0x1015a6[_0x57db('0x35')],'rows':_0x1015a6};})[_0x57db('0x21')](respondWithResult(_0xea8d08,null))[_0x57db('0x46')](function(_0x3ac5bf){var _0xe2be52=_0x44b492[_0x57db('0x2f')][_0x57db('0x69')]?0x1f4:_0x3ac5bf[_0x57db('0x6a')]||0x1f4;logger[_0x57db('0x23')](_0x57db('0x6b'),_0x57db('0x51'),_0xe2be52,JSON[_0x57db('0x6c')](_0x3ac5bf));delete _0x3ac5bf[_0x57db('0x25')];if(_0xe2be52===0x191){_0xe2be52=0x190;}_0xea8d08[_0x57db('0x1d')](_0xe2be52)[_0x57db('0x26')](_0x44b492['query'][_0x57db('0x69')]?{'message':_0x57db('0x6d'),'statusCode':_0x3ac5bf[_0x57db('0x6a')]}:_0x3ac5bf);});}; \ No newline at end of file +var _0x259e=['base64','concat','_embedded','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s'];(function(_0x34c6e0,_0x599072){var _0x5c280e=function(_0x59d58c){while(--_0x59d58c){_0x34c6e0['push'](_0x34c6e0['shift']());}};_0x5c280e(++_0x599072);}(_0x259e,0x1da));var _0xe259=function(_0x3c9ec7,_0x5a6317){_0x3c9ec7=_0x3c9ec7-0x0;var _0x3de6e3=_0x259e[_0x3c9ec7];return _0x3de6e3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe259('0x0'));var jsonpatch=require(_0xe259('0x1'));var rp=require('request-promise');var moment=require(_0xe259('0x2'));var BPromise=require(_0xe259('0x3'));var Mustache=require(_0xe259('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe259('0x5'));var csv=require(_0xe259('0x6'));var ejs=require(_0xe259('0x7'));var fs=require('fs');var fs_extra=require(_0xe259('0x8'));var _=require(_0xe259('0x9'));var squel=require('squel');var crypto=require(_0xe259('0xa'));var jsforce=require(_0xe259('0xb'));var deskjs=require(_0xe259('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe259('0xd'));var Papa=require(_0xe259('0xe'));var Redis=require(_0xe259('0xf'));var authService=require(_0xe259('0x10'));var qs=require(_0xe259('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe259('0x12'))(_0xe259('0x13'));var utils=require(_0xe259('0x14'));var config=require(_0xe259('0x15'));var licenseUtil=require(_0xe259('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe259('0x17'));function respondWithStatusCode(_0x1099f9,_0x125fc5){_0x125fc5=_0x125fc5||0xcc;return function(_0x5aefad){if(_0x5aefad){return _0x1099f9['sendStatus'](_0x125fc5);}return _0x1099f9['status'](_0x125fc5)['end']();};}function respondWithResult(_0x10e48e,_0x4391dc){_0x4391dc=_0x4391dc||0xc8;return function(_0x3a4167){if(_0x3a4167){return _0x10e48e['status'](_0x4391dc)[_0xe259('0x18')](_0x3a4167);}};}function respondWithFilteredResult(_0x3579fd,_0x46928e){return function(_0x3f4bde){if(_0x3f4bde){var _0x3e196c=typeof _0x46928e['offset']===_0xe259('0x19')&&typeof _0x46928e[_0xe259('0x1a')]===_0xe259('0x19');var _0x508de2=_0x3f4bde[_0xe259('0x1b')];var _0x262d68=_0x3e196c?0x0:_0x46928e[_0xe259('0x1c')];var _0x47fec2=_0x3e196c?_0x3f4bde['count']:_0x46928e[_0xe259('0x1c')]+_0x46928e[_0xe259('0x1a')];var _0x98d3f4;if(_0x47fec2>=_0x508de2){_0x47fec2=_0x508de2;_0x98d3f4=0xc8;}else{_0x98d3f4=0xce;}_0x3579fd[_0xe259('0x1d')](_0x98d3f4);return _0x3579fd[_0xe259('0x1e')](_0xe259('0x1f'),_0x262d68+'-'+_0x47fec2+'/'+_0x508de2)[_0xe259('0x18')](_0x3f4bde);}return null;};}function patchUpdates(_0x327ff2){return function(_0xca3751){try{jsonpatch[_0xe259('0x20')](_0xca3751,_0x327ff2,!![]);}catch(_0x5d131c){return BPromise[_0xe259('0x21')](_0x5d131c);}return _0xca3751['save']();};}function saveUpdates(_0xbfcb7f,_0x582ce9){return function(_0x31bab4){if(_0x31bab4){return _0x31bab4['update'](_0xbfcb7f)['then'](function(_0x288704){return _0x288704;});}return null;};}function removeEntity(_0x53b40a,_0x48ca53){return function(_0x4049ee){if(_0x4049ee){return _0x4049ee[_0xe259('0x22')]()[_0xe259('0x23')](function(){_0x53b40a[_0xe259('0x1d')](0xcc)[_0xe259('0x24')]();});}};}function handleEntityNotFound(_0xed3aaf,_0x31db5d){return function(_0x1eb481){if(!_0x1eb481){_0xed3aaf[_0xe259('0x25')](0x194);}return _0x1eb481;};}function handleError(_0x4c2887,_0x1a5a67){_0x1a5a67=_0x1a5a67||0x1f4;return function(_0x35c018){logger[_0xe259('0x26')](_0x35c018[_0xe259('0x27')]);if(_0x35c018['name']){delete _0x35c018[_0xe259('0x28')];}_0x4c2887[_0xe259('0x1d')](_0x1a5a67)[_0xe259('0x29')](_0x35c018);};}exports[_0xe259('0x2a')]=function(_0x5d585a,_0x2e811f){var _0x186df5={},_0x2c3168={},_0x549c6d={'count':0x0,'rows':[]};var _0x3e5eec=_[_0xe259('0x2b')](db['DeskAccount'][_0xe259('0x2c')],function(_0x207222){return{'name':_0x207222[_0xe259('0x2d')],'type':_0x207222[_0xe259('0x2e')][_0xe259('0x2f')]};});_0x2c3168[_0xe259('0x30')]=_[_0xe259('0x2b')](_0x3e5eec,_0xe259('0x28'));_0x2c3168[_0xe259('0x31')]=_[_0xe259('0x32')](_0x5d585a[_0xe259('0x31')]);_0x2c3168[_0xe259('0x33')]=_['intersection'](_0x2c3168[_0xe259('0x30')],_0x2c3168['query']);_0x186df5[_0xe259('0x34')]=_[_0xe259('0x35')](_0x2c3168[_0xe259('0x30')],qs['fields'](_0x5d585a['query'][_0xe259('0x36')]));_0x186df5['attributes']=_0x186df5[_0xe259('0x34')][_0xe259('0x37')]?_0x186df5[_0xe259('0x34')]:_0x2c3168[_0xe259('0x30')];if(!_0x5d585a[_0xe259('0x31')][_0xe259('0x38')]('nolimit')){_0x186df5['limit']=qs[_0xe259('0x1a')](_0x5d585a[_0xe259('0x31')][_0xe259('0x1a')]);_0x186df5[_0xe259('0x1c')]=qs[_0xe259('0x1c')](_0x5d585a[_0xe259('0x31')]['offset']);}_0x186df5[_0xe259('0x39')]=qs[_0xe259('0x3a')](_0x5d585a[_0xe259('0x31')]['sort']);_0x186df5['where']=qs['filters'](_['pick'](_0x5d585a['query'],_0x2c3168['filters']),_0x3e5eec);if(_0x5d585a['query'][_0xe259('0x3b')]){_0x186df5[_0xe259('0x3c')]=_['merge'](_0x186df5['where'],{'$or':_[_0xe259('0x2b')](_0x3e5eec,function(_0x2aba23){if(_0x2aba23['type']!==_0xe259('0x3d')){var _0x5f2571={};_0x5f2571[_0x2aba23[_0xe259('0x28')]]={'$like':'%'+_0x5d585a[_0xe259('0x31')][_0xe259('0x3b')]+'%'};return _0x5f2571;}})});}_0x186df5=_[_0xe259('0x3e')]({},_0x186df5,_0x5d585a[_0xe259('0x3f')]);var _0x1ffba4={'where':_0x186df5[_0xe259('0x3c')]};return db[_0xe259('0x40')][_0xe259('0x1b')](_0x1ffba4)['then'](function(_0x38ec09){_0x549c6d[_0xe259('0x1b')]=_0x38ec09;if(_0x5d585a['query'][_0xe259('0x41')]){_0x186df5[_0xe259('0x42')]=[{'all':!![]}];}return db['DeskAccount'][_0xe259('0x43')](_0x186df5);})[_0xe259('0x23')](function(_0x3f38d9){_0x549c6d[_0xe259('0x44')]=_0x3f38d9;return _0x549c6d;})[_0xe259('0x23')](respondWithFilteredResult(_0x2e811f,_0x186df5))[_0xe259('0x45')](handleError(_0x2e811f,null));};exports[_0xe259('0x46')]=function(_0x54eb7e,_0x5ec537){var _0x137b9f={'raw':![],'where':{'id':_0x54eb7e[_0xe259('0x47')]['id']}},_0x28edab={};_0x28edab['model']=_['keys'](db[_0xe259('0x40')]['rawAttributes']);_0x28edab[_0xe259('0x31')]=_['keys'](_0x54eb7e[_0xe259('0x31')]);_0x28edab[_0xe259('0x33')]=_[_0xe259('0x35')](_0x28edab['model'],_0x28edab[_0xe259('0x31')]);_0x137b9f['attributes']=_[_0xe259('0x35')](_0x28edab['model'],qs[_0xe259('0x36')](_0x54eb7e[_0xe259('0x31')]['fields']));_0x137b9f[_0xe259('0x34')]=_0x137b9f[_0xe259('0x34')][_0xe259('0x37')]?_0x137b9f['attributes']:_0x28edab[_0xe259('0x30')];if(_0x54eb7e['query'][_0xe259('0x41')]){_0x137b9f[_0xe259('0x42')]=[{'all':!![]}];}_0x137b9f=_[_0xe259('0x3e')]({},_0x137b9f,_0x54eb7e[_0xe259('0x3f')]);return db['DeskAccount'][_0xe259('0x48')](_0x137b9f)[_0xe259('0x23')](handleEntityNotFound(_0x5ec537,null))[_0xe259('0x23')](respondWithResult(_0x5ec537,null))[_0xe259('0x45')](handleError(_0x5ec537,null));};exports['create']=function(_0x19cd9c,_0x33d00a){return db[_0xe259('0x40')][_0xe259('0x49')](_0x19cd9c[_0xe259('0x4a')],{})[_0xe259('0x23')](respondWithResult(_0x33d00a,0xc9))[_0xe259('0x45')](handleError(_0x33d00a,null));};exports['update']=function(_0x5cacfd,_0x2f8084){if(_0x5cacfd[_0xe259('0x4a')]['id']){delete _0x5cacfd[_0xe259('0x4a')]['id'];}return db[_0xe259('0x40')][_0xe259('0x48')]({'where':{'id':_0x5cacfd[_0xe259('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f8084,null))[_0xe259('0x23')](saveUpdates(_0x5cacfd['body'],null))[_0xe259('0x23')](respondWithResult(_0x2f8084,null))[_0xe259('0x45')](handleError(_0x2f8084,null));};exports[_0xe259('0x22')]=function(_0x5302a9,_0x14fec3){return db['DeskAccount'][_0xe259('0x48')]({'where':{'id':_0x5302a9['params']['id']}})[_0xe259('0x23')](handleEntityNotFound(_0x14fec3,null))['then'](removeEntity(_0x14fec3,null))[_0xe259('0x45')](handleError(_0x14fec3,null));};exports[_0xe259('0x4b')]=function(_0x592301,_0x113f79,_0x437fa2){var _0x24a15b={};var _0x287e0c={};var _0x1a7116;var _0x2728c7;return db['DeskAccount'][_0xe259('0x4c')]({'where':{'id':_0x592301[_0xe259('0x47')]['id']}})[_0xe259('0x23')](handleEntityNotFound(_0x113f79,null))[_0xe259('0x23')](function(_0x3e0f09){if(_0x3e0f09){_0x1a7116=_0x3e0f09;_0x287e0c[_0xe259('0x30')]=_['keys'](db[_0xe259('0x4d')][_0xe259('0x2c')]);_0x287e0c['query']=_['keys'](_0x592301[_0xe259('0x31')]);_0x287e0c['filters']=_[_0xe259('0x35')](_0x287e0c['model'],_0x287e0c[_0xe259('0x31')]);_0x24a15b[_0xe259('0x34')]=_[_0xe259('0x35')](_0x287e0c[_0xe259('0x30')],qs[_0xe259('0x36')](_0x592301[_0xe259('0x31')][_0xe259('0x36')]));_0x24a15b['attributes']=_0x24a15b['attributes'][_0xe259('0x37')]?_0x24a15b[_0xe259('0x34')]:_0x287e0c[_0xe259('0x30')];_0x24a15b[_0xe259('0x39')]=qs[_0xe259('0x3a')](_0x592301['query'][_0xe259('0x3a')]);_0x24a15b[_0xe259('0x3c')]=qs['filters'](_['pick'](_0x592301['query'],_0x287e0c[_0xe259('0x33')]));if(_0x592301[_0xe259('0x31')][_0xe259('0x3b')]){_0x24a15b[_0xe259('0x3c')]=_['merge'](_0x24a15b[_0xe259('0x3c')],{'$or':_[_0xe259('0x2b')](_0x24a15b[_0xe259('0x34')],function(_0x357e14){var _0x5e14af={};_0x5e14af[_0x357e14]={'$like':'%'+_0x592301['query'][_0xe259('0x3b')]+'%'};return _0x5e14af;})});}_0x24a15b=_[_0xe259('0x3e')]({},_0x24a15b,_0x592301['options']);return _0x1a7116[_0xe259('0x4b')](_0x24a15b);}})[_0xe259('0x23')](function(_0x4fb940){if(_0x4fb940){_0x2728c7=_0x4fb940[_0xe259('0x37')];if(!_0x592301[_0xe259('0x31')][_0xe259('0x38')](_0xe259('0x4e'))){_0x24a15b[_0xe259('0x1a')]=qs[_0xe259('0x1a')](_0x592301[_0xe259('0x31')][_0xe259('0x1a')]);_0x24a15b['offset']=qs[_0xe259('0x1c')](_0x592301[_0xe259('0x31')][_0xe259('0x1c')]);}return _0x1a7116[_0xe259('0x4b')](_0x24a15b);}})[_0xe259('0x23')](function(_0x3d11bb){if(_0x3d11bb){return _0x3d11bb?{'count':_0x2728c7,'rows':_0x3d11bb}:null;}})[_0xe259('0x23')](respondWithResult(_0x113f79,null))[_0xe259('0x45')](handleError(_0x113f79,null));};exports[_0xe259('0x4f')]=function(_0x4d2f9d,_0x259043,_0xef68eb){if(_0x4d2f9d[_0xe259('0x4a')]['id']){delete _0x4d2f9d[_0xe259('0x4a')]['id'];}return db[_0xe259('0x40')]['findOne']({'where':{'id':_0x4d2f9d['params']['id']}})[_0xe259('0x23')](handleEntityNotFound(_0x259043,null))[_0xe259('0x23')](function(_0x53a644){if(_0x53a644){_0x4d2f9d[_0xe259('0x4a')][_0xe259('0x50')]=_0x53a644['id'];_0x4d2f9d[_0xe259('0x4a')][_0xe259('0x51')]=integrations[_0xe259('0x52')](_0x4d2f9d[_0xe259('0x4a')][_0xe259('0x53')],_0x4d2f9d['body'][_0xe259('0x2e')]);_0x4d2f9d[_0xe259('0x4a')]['Descriptions']=integrations[_0xe259('0x54')](_0x4d2f9d[_0xe259('0x4a')][_0xe259('0x53')],_0x4d2f9d[_0xe259('0x4a')][_0xe259('0x2e')]);return db[_0xe259('0x4d')][_0xe259('0x49')](_0x4d2f9d[_0xe259('0x4a')],{'include':[{'model':db[_0xe259('0x55')],'as':_0xe259('0x51')},{'model':db[_0xe259('0x55')],'as':_0xe259('0x56')}]});}return null;})[_0xe259('0x23')](respondWithResult(_0x259043,null))[_0xe259('0x45')](handleError(_0x259043,null));};exports[_0xe259('0x57')]=function(_0x2eb4f6,_0x1347ca,_0x2d4f00){var _0x5e8dbf=[{'name':_0xe259('0x58'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5ea855='';return db[_0xe259('0x40')][_0xe259('0x4c')]({'where':{'id':_0x2eb4f6[_0xe259('0x47')]['id']},'attributes':['id',_0xe259('0x59'),_0xe259('0x5a'),_0xe259('0x5b'),_0xe259('0x5c'),_0xe259('0x5d'),_0xe259('0x5e'),_0xe259('0x5f'),'tokenSecret']})[_0xe259('0x23')](handleEntityNotFound(_0x1347ca,null))[_0xe259('0x23')](function(_0x47eab1){if(_0x47eab1){_0x5ea855=_0x47eab1[_0xe259('0x59')];var _0x1f408f=_0x5ea855[_0xe259('0x60')](-0x1);if(_0x1f408f==='/'){_0x5ea855=_0x5ea855[_0xe259('0x61')](0x0,_0x5ea855[_0xe259('0x62')](_0x1f408f));}var _0x4043bb={'method':_0xe259('0x63'),'uri':util[_0xe259('0x64')](_0xe259('0x65'),_0x5ea855),'headers':{'Content-Type':_0xe259('0x66'),'Accept':_0xe259('0x66')},'json':!![]};if(_0x47eab1[_0xe259('0x5a')]==='basic'){_0x4043bb[_0xe259('0x67')][_0xe259('0x68')]=util['format'](_0xe259('0x69'),new Buffer(util[_0xe259('0x64')]('%s:%s',_0x47eab1[_0xe259('0x5b')],_0x47eab1[_0xe259('0x5c')]))['toString'](_0xe259('0x6a')));}return rp(_0x4043bb)[_0xe259('0x23')](function(_0x1f97e0){return _0x5e8dbf[_0xe259('0x6b')](_['map'](_0x1f97e0[_0xe259('0x6c')][_0xe259('0x6d')],function(_0x46f98b){return{'id':_0x46f98b['name'],'name':_0x46f98b['name'],'type':_0x46f98b[_0xe259('0x2e')],'active':_0x46f98b[_0xe259('0x6e')],'label':_0x46f98b[_0xe259('0x6f')],'custom':!![]};}));});}})[_0xe259('0x23')](function(_0x153e5c){return{'count':_0x153e5c[_0xe259('0x37')],'rows':_0x153e5c};})['then'](respondWithResult(_0x1347ca,null))[_0xe259('0x45')](function(_0x1dfbdf){var _0x4dabec=_0x2eb4f6[_0xe259('0x31')][_0xe259('0x70')]?0x1f4:_0x1dfbdf[_0xe259('0x71')]||0x1f4;logger[_0xe259('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xe259('0x57'),_0x4dabec,JSON[_0xe259('0x72')](_0x1dfbdf));delete _0x1dfbdf[_0xe259('0x28')];if(_0x4dabec===0x191){_0x4dabec=0x190;}_0x1347ca[_0xe259('0x1d')](_0x4dabec)[_0xe259('0x29')](_0x2eb4f6['query'][_0xe259('0x70')]?{'message':_0xe259('0x73'),'statusCode':_0x1dfbdf['statusCode']}:_0x1dfbdf);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d0dc9bd..776f852 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 _0x675d=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e76fb,_0x15d4d9){var _0x3ec38b=function(_0x49e61e){while(--_0x49e61e){_0x3e76fb['push'](_0x3e76fb['shift']());}};_0x3ec38b(++_0x15d4d9);}(_0x675d,0xac));var _0xd675=function(_0x527302,_0x359545){_0x527302=_0x527302-0x0;var _0x28b9a9=_0x675d[_0x527302];return _0x28b9a9;};'use strict';var _=require(_0xd675('0x0'));var util=require(_0xd675('0x1'));var logger=require('../../config/logger')(_0xd675('0x2'));var moment=require(_0xd675('0x3'));var BPromise=require(_0xd675('0x4'));var rp=require(_0xd675('0x5'));var fs=require('fs');var path=require(_0xd675('0x6'));var rimraf=require(_0xd675('0x7'));var config=require(_0xd675('0x8'));var attributes=require(_0xd675('0x9'));var integrations=require(_0xd675('0xa'));module[_0xd675('0xb')]=function(_0x5c7f83,_0x525fcc){return _0x5c7f83[_0xd675('0xc')](_0xd675('0xd'),attributes,{'tableName':_0xd675('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb253=['define','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x388914,_0x3c63f9){var _0x1f9111=function(_0x23dd69){while(--_0x23dd69){_0x388914['push'](_0x388914['shift']());}};_0x1f9111(++_0x3c63f9);}(_0xb253,0x1e2));var _0x3b25=function(_0x31dfdd,_0x4b55f9){_0x31dfdd=_0x31dfdd-0x0;var _0x30f59b=_0xb253[_0x31dfdd];return _0x30f59b;};'use strict';var _=require(_0x3b25('0x0'));var util=require(_0x3b25('0x1'));var logger=require(_0x3b25('0x2'))(_0x3b25('0x3'));var moment=require('moment');var BPromise=require(_0x3b25('0x4'));var rp=require(_0x3b25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b25('0x6'));var config=require(_0x3b25('0x7'));var attributes=require(_0x3b25('0x8'));var integrations=require(_0x3b25('0x9'));module['exports']=function(_0x409618,_0x3b535c){return _0x409618[_0x3b25('0xa')]('DeskAccount',attributes,{'tableName':_0x3b25('0xb'),'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 8d34a88..df7ee46 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 _0x95df=['attributes','include','map','model','stringify','catch','ShowDeskAccount','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','DeskAccount,\x20%s,\x20%s','GetDeskAccount','DeskAccount','options','raw','where'];(function(_0xf34ff8,_0x38af76){var _0x243a71=function(_0x1ede5c){while(--_0x1ede5c){_0xf34ff8['push'](_0xf34ff8['shift']());}};_0x243a71(++_0x38af76);}(_0x95df,0x1c2));var _0xf95d=function(_0x402e79,_0x54c19a){_0x402e79=_0x402e79-0x0;var _0x62a5d8=_0x95df[_0x402e79];return _0x62a5d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf95d('0x0'));var BPromise=require(_0xf95d('0x1'));var rs=require(_0xf95d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf95d('0x3'))['db'];var utils=require(_0xf95d('0x4'));var logger=require(_0xf95d('0x5'))(_0xf95d('0x6'));var config=require(_0xf95d('0x7'));var jayson=require(_0xf95d('0x8'));var client=jayson[_0xf95d('0x9')][_0xf95d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e1c38,_0xb21d3a,_0x1324b7){return new BPromise(function(_0x1315f3,_0x5ce16a){return client[_0xf95d('0xb')](_0x2e1c38,_0x1324b7)[_0xf95d('0xc')](function(_0x362d6b){logger[_0xf95d('0xd')]('DeskAccount,\x20%s,\x20%s',_0xb21d3a,_0xf95d('0xe'));logger[_0xf95d('0xf')](_0xf95d('0x10'),_0xb21d3a,_0xf95d('0xe'),JSON['stringify'](_0x362d6b));if(_0x362d6b['error']){if(_0x362d6b['error'][_0xf95d('0x11')]===0x1f4){logger[_0xf95d('0x12')]('DeskAccount,\x20%s,\x20%s',_0xb21d3a,_0x362d6b[_0xf95d('0x12')][_0xf95d('0x13')]);return _0x5ce16a(_0x362d6b[_0xf95d('0x12')][_0xf95d('0x13')]);}logger[_0xf95d('0x12')]('DeskAccount,\x20%s,\x20%s',_0xb21d3a,_0x362d6b[_0xf95d('0x12')]['message']);return _0x1315f3(_0x362d6b[_0xf95d('0x12')][_0xf95d('0x13')]);}else{logger[_0xf95d('0xd')](_0xf95d('0x14'),_0xb21d3a,_0xf95d('0xe'));_0x1315f3(_0x362d6b['result'][_0xf95d('0x13')]);}})['catch'](function(_0x2d5191){logger['error'](_0xf95d('0x14'),_0xb21d3a,_0x2d5191);_0x5ce16a(_0x2d5191);});});}exports[_0xf95d('0x15')]=function(_0x483025){var _0x5949c2=this;return new Promise(function(_0x43ce7e,_0x56e32e){return db[_0xf95d('0x16')]['findAll']({'raw':_0x483025[_0xf95d('0x17')]?_0x483025['options'][_0xf95d('0x18')]===undefined?!![]:![]:!![],'where':_0x483025[_0xf95d('0x17')]?_0x483025['options'][_0xf95d('0x19')]||null:null,'attributes':_0x483025[_0xf95d('0x17')]?_0x483025[_0xf95d('0x17')][_0xf95d('0x1a')]||null:null,'limit':_0x483025[_0xf95d('0x17')]?_0x483025['options']['limit']||null:null,'include':_0x483025[_0xf95d('0x17')]?_0x483025[_0xf95d('0x17')][_0xf95d('0x1b')]?_[_0xf95d('0x1c')](_0x483025[_0xf95d('0x17')]['include'],function(_0x4caab5){return{'model':db[_0x4caab5['model']],'as':_0x4caab5['as'],'attributes':_0x4caab5['attributes'],'include':_0x4caab5['include']?_[_0xf95d('0x1c')](_0x4caab5['include'],function(_0x1f9091){return{'model':db[_0x1f9091[_0xf95d('0x1d')]],'as':_0x1f9091['as'],'attributes':_0x1f9091[_0xf95d('0x1a')],'include':_0x1f9091[_0xf95d('0x1b')]?_[_0xf95d('0x1c')](_0x1f9091[_0xf95d('0x1b')],function(_0x3ed9f9){return{'model':db[_0x3ed9f9[_0xf95d('0x1d')]],'as':_0x3ed9f9['as'],'attributes':_0x3ed9f9[_0xf95d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30ea41){logger[_0xf95d('0xd')](_0xf95d('0x15'),_0x483025);logger[_0xf95d('0xf')]('GetDeskAccount',_0x483025,JSON[_0xf95d('0x1e')](_0x30ea41));_0x43ce7e(_0x30ea41);})[_0xf95d('0x1f')](function(_0x54eddb){logger[_0xf95d('0x12')](_0xf95d('0x15'),_0x54eddb[_0xf95d('0x13')],_0x483025);_0x56e32e(_0x5949c2[_0xf95d('0x12')](0x1f4,_0x54eddb[_0xf95d('0x13')]));});});};exports[_0xf95d('0x20')]=function(_0x112037){var _0x1a31e7=this;return new Promise(function(_0x48839f,_0x3a79a7){return db[_0xf95d('0x16')][_0xf95d('0x21')]({'raw':_0x112037[_0xf95d('0x17')]?_0x112037[_0xf95d('0x17')][_0xf95d('0x18')]===undefined?!![]:![]:!![],'where':_0x112037['options']?_0x112037[_0xf95d('0x17')]['where']||null:null,'attributes':_0x112037[_0xf95d('0x17')]?_0x112037[_0xf95d('0x17')][_0xf95d('0x1a')]||null:null,'include':_0x112037[_0xf95d('0x17')]?_0x112037['options']['include']?_['map'](_0x112037[_0xf95d('0x17')]['include'],function(_0x1c0f90){return{'model':db[_0x1c0f90[_0xf95d('0x1d')]],'as':_0x1c0f90['as'],'attributes':_0x1c0f90[_0xf95d('0x1a')],'include':_0x1c0f90[_0xf95d('0x1b')]?_[_0xf95d('0x1c')](_0x1c0f90['include'],function(_0x5792d4){return{'model':db[_0x5792d4[_0xf95d('0x1d')]],'as':_0x5792d4['as'],'attributes':_0x5792d4['attributes'],'include':_0x5792d4[_0xf95d('0x1b')]?_[_0xf95d('0x1c')](_0x5792d4[_0xf95d('0x1b')],function(_0x103566){return{'model':db[_0x103566[_0xf95d('0x1d')]],'as':_0x103566['as'],'attributes':_0x103566[_0xf95d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf95d('0xc')](function(_0x46a527){logger[_0xf95d('0xd')]('ShowDeskAccount',_0x112037);logger[_0xf95d('0xf')](_0xf95d('0x20'),_0x112037,JSON[_0xf95d('0x1e')](_0x46a527));_0x48839f(_0x46a527);})[_0xf95d('0x1f')](function(_0x5e6b7a){logger['error'](_0xf95d('0x20'),_0x5e6b7a['message'],_0x112037);_0x3a79a7(_0x1a31e7[_0xf95d('0x12')](0x1f4,_0x5e6b7a[_0xf95d('0x13')]));});});}; \ No newline at end of file +var _0x0b31=['stringify','error','message','DeskAccount,\x20%s,\x20%s','catch','DeskAccount','options','raw','where','attributes','limit','map','model','include','then','GetDeskAccount','ShowDeskAccount','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0xfbfa65,_0x4913b6){var _0x351c3b=function(_0x5ab169){while(--_0x5ab169){_0xfbfa65['push'](_0xfbfa65['shift']());}};_0x351c3b(++_0x4913b6);}(_0x0b31,0xd8));var _0x10b3=function(_0x360b48,_0xd81194){_0x360b48=_0x360b48-0x0;var _0x1d3d7b=_0x0b31[_0x360b48];return _0x1d3d7b;};'use strict';var _=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var moment=require(_0x10b3('0x2'));var BPromise=require(_0x10b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x10b3('0x5'));var logger=require(_0x10b3('0x6'))(_0x10b3('0x7'));var config=require(_0x10b3('0x8'));var jayson=require(_0x10b3('0x9'));var client=jayson[_0x10b3('0xa')][_0x10b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41b224,_0x50a228,_0xc453d2){return new BPromise(function(_0x5f6e44,_0x2dbdfd){return client[_0x10b3('0xc')](_0x41b224,_0xc453d2)['then'](function(_0x420bfa){logger[_0x10b3('0xd')]('DeskAccount,\x20%s,\x20%s',_0x50a228,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x50a228,_0x10b3('0xe'),JSON[_0x10b3('0xf')](_0x420bfa));if(_0x420bfa[_0x10b3('0x10')]){if(_0x420bfa['error']['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x50a228,_0x420bfa[_0x10b3('0x10')][_0x10b3('0x11')]);return _0x2dbdfd(_0x420bfa[_0x10b3('0x10')][_0x10b3('0x11')]);}logger['error'](_0x10b3('0x12'),_0x50a228,_0x420bfa[_0x10b3('0x10')][_0x10b3('0x11')]);return _0x5f6e44(_0x420bfa[_0x10b3('0x10')]['message']);}else{logger[_0x10b3('0xd')](_0x10b3('0x12'),_0x50a228,_0x10b3('0xe'));_0x5f6e44(_0x420bfa['result'][_0x10b3('0x11')]);}})[_0x10b3('0x13')](function(_0x3f6d95){logger[_0x10b3('0x10')]('DeskAccount,\x20%s,\x20%s',_0x50a228,_0x3f6d95);_0x2dbdfd(_0x3f6d95);});});}exports['GetDeskAccount']=function(_0xb4c2e8){var _0x4d89a5=this;return new Promise(function(_0x14e7ca,_0x4ea22c){return db[_0x10b3('0x14')]['findAll']({'raw':_0xb4c2e8['options']?_0xb4c2e8[_0x10b3('0x15')][_0x10b3('0x16')]===undefined?!![]:![]:!![],'where':_0xb4c2e8[_0x10b3('0x15')]?_0xb4c2e8[_0x10b3('0x15')][_0x10b3('0x17')]||null:null,'attributes':_0xb4c2e8[_0x10b3('0x15')]?_0xb4c2e8['options'][_0x10b3('0x18')]||null:null,'limit':_0xb4c2e8[_0x10b3('0x15')]?_0xb4c2e8[_0x10b3('0x15')][_0x10b3('0x19')]||null:null,'include':_0xb4c2e8[_0x10b3('0x15')]?_0xb4c2e8['options']['include']?_[_0x10b3('0x1a')](_0xb4c2e8[_0x10b3('0x15')]['include'],function(_0x41e55a){return{'model':db[_0x41e55a[_0x10b3('0x1b')]],'as':_0x41e55a['as'],'attributes':_0x41e55a[_0x10b3('0x18')],'include':_0x41e55a[_0x10b3('0x1c')]?_[_0x10b3('0x1a')](_0x41e55a['include'],function(_0x5da686){return{'model':db[_0x5da686[_0x10b3('0x1b')]],'as':_0x5da686['as'],'attributes':_0x5da686['attributes'],'include':_0x5da686[_0x10b3('0x1c')]?_[_0x10b3('0x1a')](_0x5da686[_0x10b3('0x1c')],function(_0x1aec51){return{'model':db[_0x1aec51[_0x10b3('0x1b')]],'as':_0x1aec51['as'],'attributes':_0x1aec51[_0x10b3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x10b3('0x1d')](function(_0x56aba1){logger[_0x10b3('0xd')](_0x10b3('0x1e'),_0xb4c2e8);logger['debug']('GetDeskAccount',_0xb4c2e8,JSON[_0x10b3('0xf')](_0x56aba1));_0x14e7ca(_0x56aba1);})[_0x10b3('0x13')](function(_0x1b55f2){logger[_0x10b3('0x10')](_0x10b3('0x1e'),_0x1b55f2[_0x10b3('0x11')],_0xb4c2e8);_0x4ea22c(_0x4d89a5[_0x10b3('0x10')](0x1f4,_0x1b55f2[_0x10b3('0x11')]));});});};exports[_0x10b3('0x1f')]=function(_0x3a8090){var _0x42846f=this;return new Promise(function(_0x1e123c,_0x2f6e00){return db[_0x10b3('0x14')]['find']({'raw':_0x3a8090[_0x10b3('0x15')]?_0x3a8090[_0x10b3('0x15')][_0x10b3('0x16')]===undefined?!![]:![]:!![],'where':_0x3a8090['options']?_0x3a8090['options'][_0x10b3('0x17')]||null:null,'attributes':_0x3a8090[_0x10b3('0x15')]?_0x3a8090[_0x10b3('0x15')][_0x10b3('0x18')]||null:null,'include':_0x3a8090[_0x10b3('0x15')]?_0x3a8090[_0x10b3('0x15')]['include']?_[_0x10b3('0x1a')](_0x3a8090[_0x10b3('0x15')][_0x10b3('0x1c')],function(_0x1cabf8){return{'model':db[_0x1cabf8[_0x10b3('0x1b')]],'as':_0x1cabf8['as'],'attributes':_0x1cabf8[_0x10b3('0x18')],'include':_0x1cabf8[_0x10b3('0x1c')]?_[_0x10b3('0x1a')](_0x1cabf8[_0x10b3('0x1c')],function(_0x3c027e){return{'model':db[_0x3c027e[_0x10b3('0x1b')]],'as':_0x3c027e['as'],'attributes':_0x3c027e['attributes'],'include':_0x3c027e[_0x10b3('0x1c')]?_[_0x10b3('0x1a')](_0x3c027e[_0x10b3('0x1c')],function(_0x1c1506){return{'model':db[_0x1c1506[_0x10b3('0x1b')]],'as':_0x1c1506['as'],'attributes':_0x1c1506[_0x10b3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x10b3('0x1d')](function(_0x5a8159){logger[_0x10b3('0xd')](_0x10b3('0x1f'),_0x3a8090);logger[_0x10b3('0x20')](_0x10b3('0x1f'),_0x3a8090,JSON[_0x10b3('0xf')](_0x5a8159));_0x1e123c(_0x5a8159);})[_0x10b3('0x13')](function(_0x893878){logger['error'](_0x10b3('0x1f'),_0x893878['message'],_0x3a8090);_0x2f6e00(_0x42846f[_0x10b3('0x10')](0x1f4,_0x893878[_0x10b3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 83ad12c..4f28209 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 _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(_0x863c18,_0x3a9776){var _0xe14194=function(_0x256202){while(--_0x256202){_0x863c18['push'](_0x863c18['shift']());}};_0xe14194(++_0x3a9776);}(_0x008c,0x188));var _0xc008=function(_0x24ec6f,_0x1de736){_0x24ec6f=_0x24ec6f-0x0;var _0x2b3d05=_0x008c[_0x24ec6f];return _0x2b3d05;};'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 +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x463ace,_0x21a674){var _0x10adbb=function(_0x4611a0){while(--_0x4611a0){_0x463ace['push'](_0x463ace['shift']());}};_0x10adbb(++_0x21a674);}(_0x3e74,0x175));var _0x43e7=function(_0x2ee29d,_0x392801){_0x2ee29d=_0x2ee29d-0x0;var _0xc60da7=_0x3e74[_0x2ee29d];return _0xc60da7;};'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/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 33d21cd..9a0f2d4 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 _0x5556=['STRING','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5556,0x1d5));var _0x6555=function(_0x99692,_0x32528e){_0x99692=_0x99692-0x0;var _0xe5fbb4=_0x5556[_0x99692];return _0xe5fbb4;};'use strict';var Sequelize=require(_0x6555('0x0'));module[_0x6555('0x1')]={'name':{'type':Sequelize[_0x6555('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe595=['STRING','sequelize','exports'];(function(_0x139db3,_0x54d26b){var _0x10e5ac=function(_0x3ec035){while(--_0x3ec035){_0x139db3['push'](_0x139db3['shift']());}};_0x10e5ac(++_0x54d26b);}(_0xe595,0x10c));var _0x5e59=function(_0x4c3ff9,_0x5d593d){_0x4c3ff9=_0x4c3ff9-0x0;var _0x18f349=_0xe595[_0x4c3ff9];return _0x18f349;};'use strict';var Sequelize=require(_0x5e59('0x0'));module[_0x5e59('0x1')]={'name':{'type':Sequelize[_0x5e59('0x2')]},'description':{'type':Sequelize[_0x5e59('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1c7f208..2e6cb46 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 _0xd5f8=['limit','status','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','DeskConfiguration','findAll','rows','show','params','length','catch','create','body','find','getFields','findOne','DeskField','options','getSubjects','getDescriptions','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','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','offset','count'];(function(_0xede297,_0x27b277){var _0x82cd53=function(_0x13811c){while(--_0x13811c){_0xede297['push'](_0xede297['shift']());}};_0x82cd53(++_0x27b277);}(_0xd5f8,0x88));var _0x8d5f=function(_0x3ddb82,_0xab8a9c){_0x3ddb82=_0x3ddb82-0x0;var _0x46e5d9=_0xd5f8[_0x3ddb82];return _0x46e5d9;};'use strict';var emlformat=require(_0x8d5f('0x0'));var rimraf=require(_0x8d5f('0x1'));var zipdir=require(_0x8d5f('0x2'));var jsonpatch=require(_0x8d5f('0x3'));var rp=require(_0x8d5f('0x4'));var moment=require(_0x8d5f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8d5f('0x6'));var path=require('path');var sox=require(_0x8d5f('0x7'));var csv=require(_0x8d5f('0x8'));var ejs=require(_0x8d5f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d5f('0xa'));var squel=require(_0x8d5f('0xb'));var crypto=require(_0x8d5f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8d5f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8d5f('0xe'));var Redis=require(_0x8d5f('0xf'));var authService=require(_0x8d5f('0x10'));var qs=require(_0x8d5f('0x11'));var as=require(_0x8d5f('0x12'));var hardwareService=require(_0x8d5f('0x13'));var logger=require(_0x8d5f('0x14'))('api');var utils=require(_0x8d5f('0x15'));var config=require(_0x8d5f('0x16'));var licenseUtil=require(_0x8d5f('0x17'));var db=require(_0x8d5f('0x18'))['db'];function respondWithStatusCode(_0x5380c7,_0x39c8f4){_0x39c8f4=_0x39c8f4||0xcc;return function(_0x5a2624){if(_0x5a2624){return _0x5380c7[_0x8d5f('0x19')](_0x39c8f4);}return _0x5380c7['status'](_0x39c8f4)['end']();};}function respondWithResult(_0x115ac1,_0x38302a){_0x38302a=_0x38302a||0xc8;return function(_0x2cebcc){if(_0x2cebcc){return _0x115ac1['status'](_0x38302a)['json'](_0x2cebcc);}};}function respondWithFilteredResult(_0x26bd9e,_0x2311c2){return function(_0x396606){if(_0x396606){var _0x429bf0=typeof _0x2311c2[_0x8d5f('0x1a')]==='undefined'&&typeof _0x2311c2['limit']==='undefined';var _0xfb8ef4=_0x396606[_0x8d5f('0x1b')];var _0x343e19=_0x429bf0?0x0:_0x2311c2[_0x8d5f('0x1a')];var _0x1b3323=_0x429bf0?_0x396606[_0x8d5f('0x1b')]:_0x2311c2[_0x8d5f('0x1a')]+_0x2311c2[_0x8d5f('0x1c')];var _0x2ad370;if(_0x1b3323>=_0xfb8ef4){_0x1b3323=_0xfb8ef4;_0x2ad370=0xc8;}else{_0x2ad370=0xce;}_0x26bd9e[_0x8d5f('0x1d')](_0x2ad370);return _0x26bd9e[_0x8d5f('0x1e')](_0x8d5f('0x1f'),_0x343e19+'-'+_0x1b3323+'/'+_0xfb8ef4)['json'](_0x396606);}return null;};}function patchUpdates(_0x12beeb){return function(_0x24f3e7){try{jsonpatch[_0x8d5f('0x20')](_0x24f3e7,_0x12beeb,!![]);}catch(_0x88f4b0){return BPromise['reject'](_0x88f4b0);}return _0x24f3e7[_0x8d5f('0x21')]();};}function saveUpdates(_0x3b9089,_0x48a119){return function(_0x12fd17){if(_0x12fd17){return _0x12fd17[_0x8d5f('0x22')](_0x3b9089)[_0x8d5f('0x23')](function(_0x30a0fd){return _0x30a0fd;});}return null;};}function removeEntity(_0x156913,_0x377abf){return function(_0x164df5){if(_0x164df5){return _0x164df5[_0x8d5f('0x24')]()[_0x8d5f('0x23')](function(){_0x156913['status'](0xcc)[_0x8d5f('0x25')]();});}};}function handleEntityNotFound(_0x4074f8,_0x5355ed){return function(_0x4cc2e4){if(!_0x4cc2e4){_0x4074f8[_0x8d5f('0x19')](0x194);}return _0x4cc2e4;};}function handleError(_0x3f9c2d,_0x5649b1){_0x5649b1=_0x5649b1||0x1f4;return function(_0x3e4218){logger[_0x8d5f('0x26')](_0x3e4218['stack']);if(_0x3e4218[_0x8d5f('0x27')]){delete _0x3e4218[_0x8d5f('0x27')];}_0x3f9c2d[_0x8d5f('0x1d')](_0x5649b1)[_0x8d5f('0x28')](_0x3e4218);};}exports[_0x8d5f('0x29')]=function(_0x58e878,_0x428755){var _0x5052ad={},_0x5c3a4b={},_0x4b08d4={'count':0x0,'rows':[]};var _0x45322e=_[_0x8d5f('0x2a')](db['DeskConfiguration'][_0x8d5f('0x2b')],function(_0x27f32c){return{'name':_0x27f32c[_0x8d5f('0x2c')],'type':_0x27f32c[_0x8d5f('0x2d')][_0x8d5f('0x2e')]};});_0x5c3a4b[_0x8d5f('0x2f')]=_[_0x8d5f('0x2a')](_0x45322e,_0x8d5f('0x27'));_0x5c3a4b['query']=_[_0x8d5f('0x30')](_0x58e878[_0x8d5f('0x31')]);_0x5c3a4b['filters']=_[_0x8d5f('0x32')](_0x5c3a4b[_0x8d5f('0x2f')],_0x5c3a4b[_0x8d5f('0x31')]);_0x5052ad[_0x8d5f('0x33')]=_[_0x8d5f('0x32')](_0x5c3a4b[_0x8d5f('0x2f')],qs[_0x8d5f('0x34')](_0x58e878[_0x8d5f('0x31')]['fields']));_0x5052ad[_0x8d5f('0x33')]=_0x5052ad['attributes']['length']?_0x5052ad['attributes']:_0x5c3a4b[_0x8d5f('0x2f')];if(!_0x58e878[_0x8d5f('0x31')][_0x8d5f('0x35')](_0x8d5f('0x36'))){_0x5052ad[_0x8d5f('0x1c')]=qs[_0x8d5f('0x1c')](_0x58e878[_0x8d5f('0x31')][_0x8d5f('0x1c')]);_0x5052ad[_0x8d5f('0x1a')]=qs[_0x8d5f('0x1a')](_0x58e878[_0x8d5f('0x31')]['offset']);}_0x5052ad[_0x8d5f('0x37')]=qs['sort'](_0x58e878[_0x8d5f('0x31')][_0x8d5f('0x38')]);_0x5052ad[_0x8d5f('0x39')]=qs[_0x8d5f('0x3a')](_[_0x8d5f('0x3b')](_0x58e878[_0x8d5f('0x31')],_0x5c3a4b[_0x8d5f('0x3a')]),_0x45322e);if(_0x58e878['query'][_0x8d5f('0x3c')]){_0x5052ad['where']=_[_0x8d5f('0x3d')](_0x5052ad[_0x8d5f('0x39')],{'$or':_[_0x8d5f('0x2a')](_0x45322e,function(_0x3284fe){if(_0x3284fe[_0x8d5f('0x2d')]!==_0x8d5f('0x3e')){var _0x1788dd={};_0x1788dd[_0x3284fe[_0x8d5f('0x27')]]={'$like':'%'+_0x58e878[_0x8d5f('0x31')][_0x8d5f('0x3c')]+'%'};return _0x1788dd;}})});}_0x5052ad=_[_0x8d5f('0x3d')]({},_0x5052ad,_0x58e878['options']);var _0x25770d={'where':_0x5052ad['where']};return db['DeskConfiguration'][_0x8d5f('0x1b')](_0x25770d)[_0x8d5f('0x23')](function(_0x32490f){_0x4b08d4[_0x8d5f('0x1b')]=_0x32490f;if(_0x58e878['query'][_0x8d5f('0x3f')]){_0x5052ad['include']=[{'all':!![]}];}return db[_0x8d5f('0x40')][_0x8d5f('0x41')](_0x5052ad);})['then'](function(_0x2e49e8){_0x4b08d4[_0x8d5f('0x42')]=_0x2e49e8;return _0x4b08d4;})[_0x8d5f('0x23')](respondWithFilteredResult(_0x428755,_0x5052ad))['catch'](handleError(_0x428755,null));};exports[_0x8d5f('0x43')]=function(_0x2eb815,_0x52e60e){var _0x32ddcb={'raw':![],'where':{'id':_0x2eb815[_0x8d5f('0x44')]['id']}},_0x3dba1b={};_0x3dba1b['model']=_[_0x8d5f('0x30')](db['DeskConfiguration'][_0x8d5f('0x2b')]);_0x3dba1b[_0x8d5f('0x31')]=_['keys'](_0x2eb815[_0x8d5f('0x31')]);_0x3dba1b[_0x8d5f('0x3a')]=_['intersection'](_0x3dba1b['model'],_0x3dba1b['query']);_0x32ddcb['attributes']=_[_0x8d5f('0x32')](_0x3dba1b['model'],qs[_0x8d5f('0x34')](_0x2eb815[_0x8d5f('0x31')][_0x8d5f('0x34')]));_0x32ddcb[_0x8d5f('0x33')]=_0x32ddcb['attributes'][_0x8d5f('0x45')]?_0x32ddcb[_0x8d5f('0x33')]:_0x3dba1b[_0x8d5f('0x2f')];if(_0x2eb815[_0x8d5f('0x31')][_0x8d5f('0x3f')]){_0x32ddcb['include']=[{'all':!![]}];}_0x32ddcb=_[_0x8d5f('0x3d')]({},_0x32ddcb,_0x2eb815['options']);return db[_0x8d5f('0x40')]['find'](_0x32ddcb)[_0x8d5f('0x23')](handleEntityNotFound(_0x52e60e,null))[_0x8d5f('0x23')](respondWithResult(_0x52e60e,null))[_0x8d5f('0x46')](handleError(_0x52e60e,null));};exports[_0x8d5f('0x47')]=function(_0x16a530,_0x4d5961){return db[_0x8d5f('0x40')][_0x8d5f('0x47')](_0x16a530[_0x8d5f('0x48')],{})[_0x8d5f('0x23')](respondWithResult(_0x4d5961,0xc9))['catch'](handleError(_0x4d5961,null));};exports[_0x8d5f('0x22')]=function(_0x5c1ad7,_0x38847e){if(_0x5c1ad7[_0x8d5f('0x48')]['id']){delete _0x5c1ad7[_0x8d5f('0x48')]['id'];}return db[_0x8d5f('0x40')][_0x8d5f('0x49')]({'where':{'id':_0x5c1ad7[_0x8d5f('0x44')]['id']}})['then'](handleEntityNotFound(_0x38847e,null))[_0x8d5f('0x23')](saveUpdates(_0x5c1ad7['body'],null))['then'](respondWithResult(_0x38847e,null))['catch'](handleError(_0x38847e,null));};exports['destroy']=function(_0xfbf159,_0x200ca4){return db[_0x8d5f('0x40')][_0x8d5f('0x49')]({'where':{'id':_0xfbf159[_0x8d5f('0x44')]['id']}})[_0x8d5f('0x23')](handleEntityNotFound(_0x200ca4,null))[_0x8d5f('0x23')](removeEntity(_0x200ca4,null))[_0x8d5f('0x46')](handleError(_0x200ca4,null));};exports[_0x8d5f('0x4a')]=function(_0x51237b,_0x4a7b23,_0x241381){var _0x3ccb3b={};var _0x558a32={};var _0x5ce7b6;var _0x1357d7;return db['DeskConfiguration'][_0x8d5f('0x4b')]({'where':{'id':_0x51237b['params']['id']}})['then'](handleEntityNotFound(_0x4a7b23,null))[_0x8d5f('0x23')](function(_0x5304cf){if(_0x5304cf){_0x5ce7b6=_0x5304cf;_0x558a32[_0x8d5f('0x2f')]=_[_0x8d5f('0x30')](db[_0x8d5f('0x4c')][_0x8d5f('0x2b')]);_0x558a32[_0x8d5f('0x31')]=_[_0x8d5f('0x30')](_0x51237b[_0x8d5f('0x31')]);_0x558a32[_0x8d5f('0x3a')]=_[_0x8d5f('0x32')](_0x558a32[_0x8d5f('0x2f')],_0x558a32[_0x8d5f('0x31')]);_0x3ccb3b['attributes']=_[_0x8d5f('0x32')](_0x558a32[_0x8d5f('0x2f')],qs[_0x8d5f('0x34')](_0x51237b['query'][_0x8d5f('0x34')]));_0x3ccb3b[_0x8d5f('0x33')]=_0x3ccb3b[_0x8d5f('0x33')]['length']?_0x3ccb3b[_0x8d5f('0x33')]:_0x558a32[_0x8d5f('0x2f')];_0x3ccb3b[_0x8d5f('0x37')]=qs[_0x8d5f('0x38')](_0x51237b[_0x8d5f('0x31')][_0x8d5f('0x38')]);_0x3ccb3b['where']=qs[_0x8d5f('0x3a')](_['pick'](_0x51237b['query'],_0x558a32['filters']));if(_0x51237b[_0x8d5f('0x31')]['filter']){_0x3ccb3b[_0x8d5f('0x39')]=_[_0x8d5f('0x3d')](_0x3ccb3b[_0x8d5f('0x39')],{'$or':_['map'](_0x3ccb3b[_0x8d5f('0x33')],function(_0x3c2255){var _0x67bee2={};_0x67bee2[_0x3c2255]={'$like':'%'+_0x51237b['query'][_0x8d5f('0x3c')]+'%'};return _0x67bee2;})});}_0x3ccb3b=_[_0x8d5f('0x3d')]({},_0x3ccb3b,_0x51237b[_0x8d5f('0x4d')]);return _0x5ce7b6[_0x8d5f('0x4a')](_0x3ccb3b);}})[_0x8d5f('0x23')](function(_0x5b0c66){if(_0x5b0c66){_0x1357d7=_0x5b0c66[_0x8d5f('0x45')];if(!_0x51237b[_0x8d5f('0x31')][_0x8d5f('0x35')](_0x8d5f('0x36'))){_0x3ccb3b[_0x8d5f('0x1c')]=qs[_0x8d5f('0x1c')](_0x51237b[_0x8d5f('0x31')][_0x8d5f('0x1c')]);_0x3ccb3b[_0x8d5f('0x1a')]=qs[_0x8d5f('0x1a')](_0x51237b[_0x8d5f('0x31')][_0x8d5f('0x1a')]);}return _0x5ce7b6[_0x8d5f('0x4a')](_0x3ccb3b);}})[_0x8d5f('0x23')](function(_0x2124d8){if(_0x2124d8){return _0x2124d8?{'count':_0x1357d7,'rows':_0x2124d8}:null;}})[_0x8d5f('0x23')](respondWithResult(_0x4a7b23,null))['catch'](handleError(_0x4a7b23,null));};exports[_0x8d5f('0x4e')]=function(_0x45721f,_0x414a9a,_0x2b9134){var _0x278091={};var _0x47bc3f={};var _0x288191;var _0xe5136c;return db[_0x8d5f('0x40')][_0x8d5f('0x4b')]({'where':{'id':_0x45721f[_0x8d5f('0x44')]['id']}})[_0x8d5f('0x23')](handleEntityNotFound(_0x414a9a,null))[_0x8d5f('0x23')](function(_0x1959c5){if(_0x1959c5){_0x288191=_0x1959c5;_0x47bc3f[_0x8d5f('0x2f')]=_[_0x8d5f('0x30')](db[_0x8d5f('0x4c')]['rawAttributes']);_0x47bc3f[_0x8d5f('0x31')]=_['keys'](_0x45721f[_0x8d5f('0x31')]);_0x47bc3f['filters']=_['intersection'](_0x47bc3f[_0x8d5f('0x2f')],_0x47bc3f[_0x8d5f('0x31')]);_0x278091[_0x8d5f('0x33')]=_[_0x8d5f('0x32')](_0x47bc3f[_0x8d5f('0x2f')],qs[_0x8d5f('0x34')](_0x45721f[_0x8d5f('0x31')]['fields']));_0x278091[_0x8d5f('0x33')]=_0x278091[_0x8d5f('0x33')]['length']?_0x278091[_0x8d5f('0x33')]:_0x47bc3f[_0x8d5f('0x2f')];_0x278091[_0x8d5f('0x37')]=qs['sort'](_0x45721f[_0x8d5f('0x31')]['sort']);_0x278091[_0x8d5f('0x39')]=qs[_0x8d5f('0x3a')](_['pick'](_0x45721f[_0x8d5f('0x31')],_0x47bc3f[_0x8d5f('0x3a')]));if(_0x45721f[_0x8d5f('0x31')][_0x8d5f('0x3c')]){_0x278091[_0x8d5f('0x39')]=_[_0x8d5f('0x3d')](_0x278091[_0x8d5f('0x39')],{'$or':_[_0x8d5f('0x2a')](_0x278091['attributes'],function(_0x4bd28c){var _0x384bb4={};_0x384bb4[_0x4bd28c]={'$like':'%'+_0x45721f[_0x8d5f('0x31')]['filter']+'%'};return _0x384bb4;})});}_0x278091=_[_0x8d5f('0x3d')]({},_0x278091,_0x45721f[_0x8d5f('0x4d')]);return _0x288191[_0x8d5f('0x4e')](_0x278091);}})['then'](function(_0x379f28){if(_0x379f28){_0xe5136c=_0x379f28[_0x8d5f('0x45')];if(!_0x45721f[_0x8d5f('0x31')][_0x8d5f('0x35')]('nolimit')){_0x278091[_0x8d5f('0x1c')]=qs['limit'](_0x45721f[_0x8d5f('0x31')]['limit']);_0x278091['offset']=qs[_0x8d5f('0x1a')](_0x45721f['query'][_0x8d5f('0x1a')]);}return _0x288191[_0x8d5f('0x4e')](_0x278091);}})['then'](function(_0x4c4158){if(_0x4c4158){return _0x4c4158?{'count':_0xe5136c,'rows':_0x4c4158}:null;}})['then'](respondWithResult(_0x414a9a,null))['catch'](handleError(_0x414a9a,null));};exports['getDescriptions']=function(_0x19d4be,_0x3ff82c,_0x9aef6f){var _0x72a44a={};var _0x249579={};var _0x5274c1;var _0x27912b;return db[_0x8d5f('0x40')]['findOne']({'where':{'id':_0x19d4be['params']['id']}})[_0x8d5f('0x23')](handleEntityNotFound(_0x3ff82c,null))[_0x8d5f('0x23')](function(_0x5bedc9){if(_0x5bedc9){_0x5274c1=_0x5bedc9;_0x249579[_0x8d5f('0x2f')]=_[_0x8d5f('0x30')](db[_0x8d5f('0x4c')][_0x8d5f('0x2b')]);_0x249579[_0x8d5f('0x31')]=_[_0x8d5f('0x30')](_0x19d4be[_0x8d5f('0x31')]);_0x249579[_0x8d5f('0x3a')]=_[_0x8d5f('0x32')](_0x249579['model'],_0x249579[_0x8d5f('0x31')]);_0x72a44a[_0x8d5f('0x33')]=_[_0x8d5f('0x32')](_0x249579[_0x8d5f('0x2f')],qs[_0x8d5f('0x34')](_0x19d4be[_0x8d5f('0x31')]['fields']));_0x72a44a['attributes']=_0x72a44a['attributes'][_0x8d5f('0x45')]?_0x72a44a['attributes']:_0x249579[_0x8d5f('0x2f')];_0x72a44a[_0x8d5f('0x37')]=qs[_0x8d5f('0x38')](_0x19d4be[_0x8d5f('0x31')][_0x8d5f('0x38')]);_0x72a44a[_0x8d5f('0x39')]=qs[_0x8d5f('0x3a')](_[_0x8d5f('0x3b')](_0x19d4be['query'],_0x249579[_0x8d5f('0x3a')]));if(_0x19d4be[_0x8d5f('0x31')][_0x8d5f('0x3c')]){_0x72a44a['where']=_['merge'](_0x72a44a[_0x8d5f('0x39')],{'$or':_['map'](_0x72a44a[_0x8d5f('0x33')],function(_0x30184e){var _0x1424af={};_0x1424af[_0x30184e]={'$like':'%'+_0x19d4be['query'][_0x8d5f('0x3c')]+'%'};return _0x1424af;})});}_0x72a44a=_[_0x8d5f('0x3d')]({},_0x72a44a,_0x19d4be[_0x8d5f('0x4d')]);return _0x5274c1['getDescriptions'](_0x72a44a);}})[_0x8d5f('0x23')](function(_0x198156){if(_0x198156){_0x27912b=_0x198156[_0x8d5f('0x45')];if(!_0x19d4be[_0x8d5f('0x31')][_0x8d5f('0x35')]('nolimit')){_0x72a44a['limit']=qs[_0x8d5f('0x1c')](_0x19d4be[_0x8d5f('0x31')][_0x8d5f('0x1c')]);_0x72a44a[_0x8d5f('0x1a')]=qs[_0x8d5f('0x1a')](_0x19d4be['query'][_0x8d5f('0x1a')]);}return _0x5274c1[_0x8d5f('0x4f')](_0x72a44a);}})[_0x8d5f('0x23')](function(_0x4fa28e){if(_0x4fa28e){return _0x4fa28e?{'count':_0x27912b,'rows':_0x4fa28e}:null;}})[_0x8d5f('0x23')](respondWithResult(_0x3ff82c,null))[_0x8d5f('0x46')](handleError(_0x3ff82c,null));};exports[_0x8d5f('0x50')]=function(_0x5276a1,_0x2e4fd9,_0x5b3802){var _0x159ee5={};var _0x44a5e6={};var _0x341559;var _0xa672e2;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5276a1['params']['id']}})[_0x8d5f('0x23')](handleEntityNotFound(_0x2e4fd9,null))['then'](function(_0x510bd5){if(_0x510bd5){_0x341559=_0x510bd5;_0x44a5e6[_0x8d5f('0x2f')]=_['keys'](db['Tag'][_0x8d5f('0x2b')]);_0x44a5e6[_0x8d5f('0x31')]=_[_0x8d5f('0x30')](_0x5276a1[_0x8d5f('0x31')]);_0x44a5e6[_0x8d5f('0x3a')]=_[_0x8d5f('0x32')](_0x44a5e6[_0x8d5f('0x2f')],_0x44a5e6[_0x8d5f('0x31')]);_0x159ee5[_0x8d5f('0x33')]=_[_0x8d5f('0x32')](_0x44a5e6[_0x8d5f('0x2f')],qs[_0x8d5f('0x34')](_0x5276a1['query'][_0x8d5f('0x34')]));_0x159ee5[_0x8d5f('0x33')]=_0x159ee5[_0x8d5f('0x33')]['length']?_0x159ee5[_0x8d5f('0x33')]:_0x44a5e6['model'];_0x159ee5[_0x8d5f('0x37')]=qs[_0x8d5f('0x38')](_0x5276a1[_0x8d5f('0x31')]['sort']);_0x159ee5['where']=qs[_0x8d5f('0x3a')](_[_0x8d5f('0x3b')](_0x5276a1[_0x8d5f('0x31')],_0x44a5e6[_0x8d5f('0x3a')]));if(_0x5276a1[_0x8d5f('0x31')][_0x8d5f('0x3c')]){_0x159ee5['where']=_[_0x8d5f('0x3d')](_0x159ee5[_0x8d5f('0x39')],{'$or':_[_0x8d5f('0x2a')](_0x159ee5[_0x8d5f('0x33')],function(_0x5f29b4){var _0x4508ff={};_0x4508ff[_0x5f29b4]={'$like':'%'+_0x5276a1[_0x8d5f('0x31')][_0x8d5f('0x3c')]+'%'};return _0x4508ff;})});}_0x159ee5=_[_0x8d5f('0x3d')]({},_0x159ee5,_0x5276a1[_0x8d5f('0x4d')]);return _0x341559[_0x8d5f('0x50')](_0x159ee5);}})[_0x8d5f('0x23')](function(_0x535fcb){if(_0x535fcb){_0xa672e2=_0x535fcb[_0x8d5f('0x45')];if(!_0x5276a1['query'][_0x8d5f('0x35')](_0x8d5f('0x36'))){_0x159ee5['limit']=qs[_0x8d5f('0x1c')](_0x5276a1['query']['limit']);_0x159ee5[_0x8d5f('0x1a')]=qs['offset'](_0x5276a1['query'][_0x8d5f('0x1a')]);}return _0x341559[_0x8d5f('0x50')](_0x159ee5);}})[_0x8d5f('0x23')](function(_0x259ee6){if(_0x259ee6){return _0x259ee6?{'count':_0xa672e2,'rows':_0x259ee6}:null;}})[_0x8d5f('0x23')](respondWithResult(_0x2e4fd9,null))['catch'](handleError(_0x2e4fd9,null));};exports['setTags']=function(_0x120942,_0x3f0f2d,_0x562783){if(_0x120942[_0x8d5f('0x48')]['id']){delete _0x120942[_0x8d5f('0x48')]['id'];}return db[_0x8d5f('0x40')][_0x8d5f('0x4b')]({'where':{'id':_0x120942['params']['id']}})[_0x8d5f('0x23')](handleEntityNotFound(_0x3f0f2d,null))[_0x8d5f('0x23')](function(_0x534ed0){if(_0x534ed0){return _0x534ed0['setTags'](_0x120942[_0x8d5f('0x48')][_0x8d5f('0x51')]||[]);}return null;})[_0x8d5f('0x23')](respondWithResult(_0x3f0f2d,null))['catch'](handleError(_0x3f0f2d,null));}; \ No newline at end of file +var _0x44f1=['body','find','params','getFields','findOne','DeskField','order','filter','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','DeskConfiguration','count','includeAll','include','findAll','catch','show','rawAttributes','options','create'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x44f1,0x169));var _0x144f=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x44f1[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x144f('0x0'));var rimraf=require(_0x144f('0x1'));var zipdir=require(_0x144f('0x2'));var jsonpatch=require(_0x144f('0x3'));var rp=require(_0x144f('0x4'));var moment=require(_0x144f('0x5'));var BPromise=require(_0x144f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x144f('0x7'));var sox=require(_0x144f('0x8'));var csv=require('to-csv');var ejs=require(_0x144f('0x9'));var fs=require('fs');var fs_extra=require(_0x144f('0xa'));var _=require(_0x144f('0xb'));var squel=require(_0x144f('0xc'));var crypto=require(_0x144f('0xd'));var jsforce=require(_0x144f('0xe'));var deskjs=require(_0x144f('0xf'));var toCsv=require(_0x144f('0x10'));var querystring=require('querystring');var Papa=require(_0x144f('0x11'));var Redis=require(_0x144f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x144f('0x13'));var as=require(_0x144f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x144f('0x15'))(_0x144f('0x16'));var utils=require('../../config/utils');var config=require(_0x144f('0x17'));var licenseUtil=require(_0x144f('0x18'));var db=require(_0x144f('0x19'))['db'];function respondWithStatusCode(_0x49f9b1,_0x3211b1){_0x3211b1=_0x3211b1||0xcc;return function(_0x510c98){if(_0x510c98){return _0x49f9b1[_0x144f('0x1a')](_0x3211b1);}return _0x49f9b1[_0x144f('0x1b')](_0x3211b1)[_0x144f('0x1c')]();};}function respondWithResult(_0x4ecd7e,_0x1407c6){_0x1407c6=_0x1407c6||0xc8;return function(_0x26e275){if(_0x26e275){return _0x4ecd7e['status'](_0x1407c6)[_0x144f('0x1d')](_0x26e275);}};}function respondWithFilteredResult(_0x27f256,_0x372144){return function(_0x7587e0){if(_0x7587e0){var _0x2493df=typeof _0x372144['offset']===_0x144f('0x1e')&&typeof _0x372144[_0x144f('0x1f')]===_0x144f('0x1e');var _0x165272=_0x7587e0['count'];var _0x429e36=_0x2493df?0x0:_0x372144['offset'];var _0x2aca4f=_0x2493df?_0x7587e0['count']:_0x372144[_0x144f('0x20')]+_0x372144[_0x144f('0x1f')];var _0x3b110a;if(_0x2aca4f>=_0x165272){_0x2aca4f=_0x165272;_0x3b110a=0xc8;}else{_0x3b110a=0xce;}_0x27f256[_0x144f('0x1b')](_0x3b110a);return _0x27f256[_0x144f('0x21')](_0x144f('0x22'),_0x429e36+'-'+_0x2aca4f+'/'+_0x165272)[_0x144f('0x1d')](_0x7587e0);}return null;};}function patchUpdates(_0x439e9b){return function(_0x56c21e){try{jsonpatch[_0x144f('0x23')](_0x56c21e,_0x439e9b,!![]);}catch(_0x46f749){return BPromise[_0x144f('0x24')](_0x46f749);}return _0x56c21e['save']();};}function saveUpdates(_0x568450,_0x5b1cde){return function(_0x55794a){if(_0x55794a){return _0x55794a[_0x144f('0x25')](_0x568450)[_0x144f('0x26')](function(_0x16b6c8){return _0x16b6c8;});}return null;};}function removeEntity(_0x35274c,_0x291b0d){return function(_0x2f86ac){if(_0x2f86ac){return _0x2f86ac[_0x144f('0x27')]()['then'](function(){_0x35274c[_0x144f('0x1b')](0xcc)[_0x144f('0x1c')]();});}};}function handleEntityNotFound(_0x11e8bc,_0x9a117f){return function(_0x534197){if(!_0x534197){_0x11e8bc['sendStatus'](0x194);}return _0x534197;};}function handleError(_0x4bf073,_0x1d9260){_0x1d9260=_0x1d9260||0x1f4;return function(_0x1d7f56){logger[_0x144f('0x28')](_0x1d7f56[_0x144f('0x29')]);if(_0x1d7f56[_0x144f('0x2a')]){delete _0x1d7f56[_0x144f('0x2a')];}_0x4bf073['status'](_0x1d9260)[_0x144f('0x2b')](_0x1d7f56);};}exports[_0x144f('0x2c')]=function(_0x3e0704,_0x433ee8){var _0x246300={},_0xd2eb29={},_0x2ad479={'count':0x0,'rows':[]};var _0x3f39c6=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x21e518){return{'name':_0x21e518[_0x144f('0x2d')],'type':_0x21e518['type'][_0x144f('0x2e')]};});_0xd2eb29[_0x144f('0x2f')]=_[_0x144f('0x30')](_0x3f39c6,_0x144f('0x2a'));_0xd2eb29[_0x144f('0x31')]=_[_0x144f('0x32')](_0x3e0704[_0x144f('0x31')]);_0xd2eb29[_0x144f('0x33')]=_[_0x144f('0x34')](_0xd2eb29[_0x144f('0x2f')],_0xd2eb29['query']);_0x246300['attributes']=_[_0x144f('0x34')](_0xd2eb29['model'],qs[_0x144f('0x35')](_0x3e0704['query'][_0x144f('0x35')]));_0x246300['attributes']=_0x246300[_0x144f('0x36')][_0x144f('0x37')]?_0x246300[_0x144f('0x36')]:_0xd2eb29[_0x144f('0x2f')];if(!_0x3e0704[_0x144f('0x31')][_0x144f('0x38')](_0x144f('0x39'))){_0x246300[_0x144f('0x1f')]=qs[_0x144f('0x1f')](_0x3e0704[_0x144f('0x31')][_0x144f('0x1f')]);_0x246300[_0x144f('0x20')]=qs[_0x144f('0x20')](_0x3e0704[_0x144f('0x31')]['offset']);}_0x246300['order']=qs['sort'](_0x3e0704[_0x144f('0x31')][_0x144f('0x3a')]);_0x246300[_0x144f('0x3b')]=qs[_0x144f('0x33')](_[_0x144f('0x3c')](_0x3e0704[_0x144f('0x31')],_0xd2eb29[_0x144f('0x33')]),_0x3f39c6);if(_0x3e0704[_0x144f('0x31')]['filter']){_0x246300[_0x144f('0x3b')]=_[_0x144f('0x3d')](_0x246300[_0x144f('0x3b')],{'$or':_[_0x144f('0x30')](_0x3f39c6,function(_0x3cf6df){if(_0x3cf6df[_0x144f('0x3e')]!==_0x144f('0x3f')){var _0x242f90={};_0x242f90[_0x3cf6df[_0x144f('0x2a')]]={'$like':'%'+_0x3e0704[_0x144f('0x31')]['filter']+'%'};return _0x242f90;}})});}_0x246300=_[_0x144f('0x3d')]({},_0x246300,_0x3e0704['options']);var _0x281339={'where':_0x246300[_0x144f('0x3b')]};return db[_0x144f('0x40')][_0x144f('0x41')](_0x281339)[_0x144f('0x26')](function(_0x246a67){_0x2ad479['count']=_0x246a67;if(_0x3e0704[_0x144f('0x31')][_0x144f('0x42')]){_0x246300[_0x144f('0x43')]=[{'all':!![]}];}return db[_0x144f('0x40')][_0x144f('0x44')](_0x246300);})[_0x144f('0x26')](function(_0x264cd2){_0x2ad479['rows']=_0x264cd2;return _0x2ad479;})['then'](respondWithFilteredResult(_0x433ee8,_0x246300))[_0x144f('0x45')](handleError(_0x433ee8,null));};exports[_0x144f('0x46')]=function(_0xb5360f,_0x4b4760){var _0x200bfa={'raw':![],'where':{'id':_0xb5360f['params']['id']}},_0x4e02ed={};_0x4e02ed['model']=_[_0x144f('0x32')](db[_0x144f('0x40')][_0x144f('0x47')]);_0x4e02ed['query']=_['keys'](_0xb5360f[_0x144f('0x31')]);_0x4e02ed[_0x144f('0x33')]=_['intersection'](_0x4e02ed['model'],_0x4e02ed[_0x144f('0x31')]);_0x200bfa[_0x144f('0x36')]=_['intersection'](_0x4e02ed['model'],qs[_0x144f('0x35')](_0xb5360f['query'][_0x144f('0x35')]));_0x200bfa[_0x144f('0x36')]=_0x200bfa[_0x144f('0x36')][_0x144f('0x37')]?_0x200bfa[_0x144f('0x36')]:_0x4e02ed[_0x144f('0x2f')];if(_0xb5360f[_0x144f('0x31')][_0x144f('0x42')]){_0x200bfa['include']=[{'all':!![]}];}_0x200bfa=_[_0x144f('0x3d')]({},_0x200bfa,_0xb5360f[_0x144f('0x48')]);return db[_0x144f('0x40')]['find'](_0x200bfa)[_0x144f('0x26')](handleEntityNotFound(_0x4b4760,null))[_0x144f('0x26')](respondWithResult(_0x4b4760,null))[_0x144f('0x45')](handleError(_0x4b4760,null));};exports[_0x144f('0x49')]=function(_0x1fdc00,_0x2ba50a){return db[_0x144f('0x40')][_0x144f('0x49')](_0x1fdc00[_0x144f('0x4a')],{})[_0x144f('0x26')](respondWithResult(_0x2ba50a,0xc9))[_0x144f('0x45')](handleError(_0x2ba50a,null));};exports[_0x144f('0x25')]=function(_0x5cce3d,_0x47f4df){if(_0x5cce3d['body']['id']){delete _0x5cce3d['body']['id'];}return db[_0x144f('0x40')][_0x144f('0x4b')]({'where':{'id':_0x5cce3d['params']['id']}})['then'](handleEntityNotFound(_0x47f4df,null))[_0x144f('0x26')](saveUpdates(_0x5cce3d['body'],null))[_0x144f('0x26')](respondWithResult(_0x47f4df,null))[_0x144f('0x45')](handleError(_0x47f4df,null));};exports[_0x144f('0x27')]=function(_0x293287,_0xb25378){return db[_0x144f('0x40')]['find']({'where':{'id':_0x293287[_0x144f('0x4c')]['id']}})[_0x144f('0x26')](handleEntityNotFound(_0xb25378,null))[_0x144f('0x26')](removeEntity(_0xb25378,null))[_0x144f('0x45')](handleError(_0xb25378,null));};exports[_0x144f('0x4d')]=function(_0x351239,_0x51c0cc,_0x2f53d7){var _0x255249={};var _0xa6e971={};var _0x1959f6;var _0x9a528b;return db['DeskConfiguration'][_0x144f('0x4e')]({'where':{'id':_0x351239[_0x144f('0x4c')]['id']}})[_0x144f('0x26')](handleEntityNotFound(_0x51c0cc,null))['then'](function(_0x29993f){if(_0x29993f){_0x1959f6=_0x29993f;_0xa6e971[_0x144f('0x2f')]=_[_0x144f('0x32')](db[_0x144f('0x4f')][_0x144f('0x47')]);_0xa6e971['query']=_[_0x144f('0x32')](_0x351239[_0x144f('0x31')]);_0xa6e971[_0x144f('0x33')]=_['intersection'](_0xa6e971['model'],_0xa6e971[_0x144f('0x31')]);_0x255249[_0x144f('0x36')]=_[_0x144f('0x34')](_0xa6e971[_0x144f('0x2f')],qs['fields'](_0x351239[_0x144f('0x31')]['fields']));_0x255249[_0x144f('0x36')]=_0x255249['attributes'][_0x144f('0x37')]?_0x255249[_0x144f('0x36')]:_0xa6e971[_0x144f('0x2f')];_0x255249[_0x144f('0x50')]=qs[_0x144f('0x3a')](_0x351239[_0x144f('0x31')][_0x144f('0x3a')]);_0x255249[_0x144f('0x3b')]=qs[_0x144f('0x33')](_[_0x144f('0x3c')](_0x351239['query'],_0xa6e971[_0x144f('0x33')]));if(_0x351239[_0x144f('0x31')][_0x144f('0x51')]){_0x255249[_0x144f('0x3b')]=_['merge'](_0x255249[_0x144f('0x3b')],{'$or':_[_0x144f('0x30')](_0x255249['attributes'],function(_0x3f65da){var _0x355264={};_0x355264[_0x3f65da]={'$like':'%'+_0x351239[_0x144f('0x31')][_0x144f('0x51')]+'%'};return _0x355264;})});}_0x255249=_[_0x144f('0x3d')]({},_0x255249,_0x351239['options']);return _0x1959f6[_0x144f('0x4d')](_0x255249);}})['then'](function(_0x1bf6d2){if(_0x1bf6d2){_0x9a528b=_0x1bf6d2['length'];if(!_0x351239['query'][_0x144f('0x38')](_0x144f('0x39'))){_0x255249['limit']=qs[_0x144f('0x1f')](_0x351239[_0x144f('0x31')][_0x144f('0x1f')]);_0x255249['offset']=qs[_0x144f('0x20')](_0x351239[_0x144f('0x31')]['offset']);}return _0x1959f6[_0x144f('0x4d')](_0x255249);}})['then'](function(_0x9844e6){if(_0x9844e6){return _0x9844e6?{'count':_0x9a528b,'rows':_0x9844e6}:null;}})['then'](respondWithResult(_0x51c0cc,null))['catch'](handleError(_0x51c0cc,null));};exports[_0x144f('0x52')]=function(_0x4180bd,_0x9ac3a5,_0x30efc0){var _0x3e1891={};var _0x4fcf3f={};var _0x39171d;var _0x13461f;return db[_0x144f('0x40')][_0x144f('0x4e')]({'where':{'id':_0x4180bd[_0x144f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9ac3a5,null))[_0x144f('0x26')](function(_0x1563a3){if(_0x1563a3){_0x39171d=_0x1563a3;_0x4fcf3f['model']=_['keys'](db[_0x144f('0x4f')]['rawAttributes']);_0x4fcf3f[_0x144f('0x31')]=_[_0x144f('0x32')](_0x4180bd[_0x144f('0x31')]);_0x4fcf3f[_0x144f('0x33')]=_[_0x144f('0x34')](_0x4fcf3f[_0x144f('0x2f')],_0x4fcf3f['query']);_0x3e1891['attributes']=_[_0x144f('0x34')](_0x4fcf3f[_0x144f('0x2f')],qs[_0x144f('0x35')](_0x4180bd[_0x144f('0x31')][_0x144f('0x35')]));_0x3e1891[_0x144f('0x36')]=_0x3e1891[_0x144f('0x36')]['length']?_0x3e1891['attributes']:_0x4fcf3f[_0x144f('0x2f')];_0x3e1891[_0x144f('0x50')]=qs[_0x144f('0x3a')](_0x4180bd[_0x144f('0x31')][_0x144f('0x3a')]);_0x3e1891['where']=qs[_0x144f('0x33')](_[_0x144f('0x3c')](_0x4180bd['query'],_0x4fcf3f[_0x144f('0x33')]));if(_0x4180bd[_0x144f('0x31')][_0x144f('0x51')]){_0x3e1891['where']=_[_0x144f('0x3d')](_0x3e1891[_0x144f('0x3b')],{'$or':_[_0x144f('0x30')](_0x3e1891[_0x144f('0x36')],function(_0x29caf2){var _0x3c1783={};_0x3c1783[_0x29caf2]={'$like':'%'+_0x4180bd[_0x144f('0x31')][_0x144f('0x51')]+'%'};return _0x3c1783;})});}_0x3e1891=_['merge']({},_0x3e1891,_0x4180bd[_0x144f('0x48')]);return _0x39171d['getSubjects'](_0x3e1891);}})['then'](function(_0x250607){if(_0x250607){_0x13461f=_0x250607[_0x144f('0x37')];if(!_0x4180bd[_0x144f('0x31')][_0x144f('0x38')]('nolimit')){_0x3e1891['limit']=qs[_0x144f('0x1f')](_0x4180bd['query'][_0x144f('0x1f')]);_0x3e1891[_0x144f('0x20')]=qs[_0x144f('0x20')](_0x4180bd[_0x144f('0x31')]['offset']);}return _0x39171d['getSubjects'](_0x3e1891);}})[_0x144f('0x26')](function(_0x2a7fae){if(_0x2a7fae){return _0x2a7fae?{'count':_0x13461f,'rows':_0x2a7fae}:null;}})[_0x144f('0x26')](respondWithResult(_0x9ac3a5,null))[_0x144f('0x45')](handleError(_0x9ac3a5,null));};exports[_0x144f('0x53')]=function(_0x211b28,_0x4e50ca,_0x418853){var _0x10f3fa={};var _0x4ce9c9={};var _0x20d2b8;var _0x4bf641;return db[_0x144f('0x40')]['findOne']({'where':{'id':_0x211b28[_0x144f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e50ca,null))[_0x144f('0x26')](function(_0x203511){if(_0x203511){_0x20d2b8=_0x203511;_0x4ce9c9[_0x144f('0x2f')]=_[_0x144f('0x32')](db[_0x144f('0x4f')][_0x144f('0x47')]);_0x4ce9c9[_0x144f('0x31')]=_[_0x144f('0x32')](_0x211b28['query']);_0x4ce9c9['filters']=_[_0x144f('0x34')](_0x4ce9c9[_0x144f('0x2f')],_0x4ce9c9[_0x144f('0x31')]);_0x10f3fa[_0x144f('0x36')]=_[_0x144f('0x34')](_0x4ce9c9[_0x144f('0x2f')],qs['fields'](_0x211b28[_0x144f('0x31')][_0x144f('0x35')]));_0x10f3fa[_0x144f('0x36')]=_0x10f3fa[_0x144f('0x36')][_0x144f('0x37')]?_0x10f3fa[_0x144f('0x36')]:_0x4ce9c9[_0x144f('0x2f')];_0x10f3fa['order']=qs['sort'](_0x211b28[_0x144f('0x31')][_0x144f('0x3a')]);_0x10f3fa[_0x144f('0x3b')]=qs[_0x144f('0x33')](_[_0x144f('0x3c')](_0x211b28['query'],_0x4ce9c9[_0x144f('0x33')]));if(_0x211b28[_0x144f('0x31')][_0x144f('0x51')]){_0x10f3fa[_0x144f('0x3b')]=_[_0x144f('0x3d')](_0x10f3fa[_0x144f('0x3b')],{'$or':_['map'](_0x10f3fa[_0x144f('0x36')],function(_0x43df40){var _0x91a669={};_0x91a669[_0x43df40]={'$like':'%'+_0x211b28['query'][_0x144f('0x51')]+'%'};return _0x91a669;})});}_0x10f3fa=_[_0x144f('0x3d')]({},_0x10f3fa,_0x211b28[_0x144f('0x48')]);return _0x20d2b8['getDescriptions'](_0x10f3fa);}})[_0x144f('0x26')](function(_0x16a050){if(_0x16a050){_0x4bf641=_0x16a050[_0x144f('0x37')];if(!_0x211b28[_0x144f('0x31')]['hasOwnProperty'](_0x144f('0x39'))){_0x10f3fa['limit']=qs['limit'](_0x211b28[_0x144f('0x31')][_0x144f('0x1f')]);_0x10f3fa[_0x144f('0x20')]=qs['offset'](_0x211b28['query']['offset']);}return _0x20d2b8['getDescriptions'](_0x10f3fa);}})[_0x144f('0x26')](function(_0x2f6c9f){if(_0x2f6c9f){return _0x2f6c9f?{'count':_0x4bf641,'rows':_0x2f6c9f}:null;}})[_0x144f('0x26')](respondWithResult(_0x4e50ca,null))[_0x144f('0x45')](handleError(_0x4e50ca,null));};exports[_0x144f('0x54')]=function(_0x11e138,_0x931c6d,_0x1794c0){var _0xce9cdf={};var _0x24bece={};var _0x4508d2;var _0x557b12;return db['DeskConfiguration'][_0x144f('0x4e')]({'where':{'id':_0x11e138[_0x144f('0x4c')]['id']}})[_0x144f('0x26')](handleEntityNotFound(_0x931c6d,null))[_0x144f('0x26')](function(_0xe82be3){if(_0xe82be3){_0x4508d2=_0xe82be3;_0x24bece[_0x144f('0x2f')]=_['keys'](db['Tag'][_0x144f('0x47')]);_0x24bece[_0x144f('0x31')]=_[_0x144f('0x32')](_0x11e138[_0x144f('0x31')]);_0x24bece[_0x144f('0x33')]=_[_0x144f('0x34')](_0x24bece[_0x144f('0x2f')],_0x24bece[_0x144f('0x31')]);_0xce9cdf[_0x144f('0x36')]=_[_0x144f('0x34')](_0x24bece[_0x144f('0x2f')],qs[_0x144f('0x35')](_0x11e138[_0x144f('0x31')]['fields']));_0xce9cdf[_0x144f('0x36')]=_0xce9cdf[_0x144f('0x36')][_0x144f('0x37')]?_0xce9cdf[_0x144f('0x36')]:_0x24bece[_0x144f('0x2f')];_0xce9cdf['order']=qs[_0x144f('0x3a')](_0x11e138['query'][_0x144f('0x3a')]);_0xce9cdf['where']=qs[_0x144f('0x33')](_[_0x144f('0x3c')](_0x11e138['query'],_0x24bece[_0x144f('0x33')]));if(_0x11e138[_0x144f('0x31')]['filter']){_0xce9cdf[_0x144f('0x3b')]=_['merge'](_0xce9cdf[_0x144f('0x3b')],{'$or':_[_0x144f('0x30')](_0xce9cdf[_0x144f('0x36')],function(_0x25cac6){var _0x20a7a2={};_0x20a7a2[_0x25cac6]={'$like':'%'+_0x11e138[_0x144f('0x31')][_0x144f('0x51')]+'%'};return _0x20a7a2;})});}_0xce9cdf=_[_0x144f('0x3d')]({},_0xce9cdf,_0x11e138[_0x144f('0x48')]);return _0x4508d2[_0x144f('0x54')](_0xce9cdf);}})[_0x144f('0x26')](function(_0x4d4eec){if(_0x4d4eec){_0x557b12=_0x4d4eec[_0x144f('0x37')];if(!_0x11e138['query'][_0x144f('0x38')](_0x144f('0x39'))){_0xce9cdf['limit']=qs[_0x144f('0x1f')](_0x11e138['query'][_0x144f('0x1f')]);_0xce9cdf['offset']=qs['offset'](_0x11e138[_0x144f('0x31')][_0x144f('0x20')]);}return _0x4508d2[_0x144f('0x54')](_0xce9cdf);}})[_0x144f('0x26')](function(_0x40202b){if(_0x40202b){return _0x40202b?{'count':_0x557b12,'rows':_0x40202b}:null;}})[_0x144f('0x26')](respondWithResult(_0x931c6d,null))['catch'](handleError(_0x931c6d,null));};exports[_0x144f('0x55')]=function(_0x32978b,_0x18a6d8,_0x1ef84e){if(_0x32978b[_0x144f('0x4a')]['id']){delete _0x32978b[_0x144f('0x4a')]['id'];}return db[_0x144f('0x40')][_0x144f('0x4e')]({'where':{'id':_0x32978b[_0x144f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x18a6d8,null))[_0x144f('0x26')](function(_0x3cd90f){if(_0x3cd90f){return _0x3cd90f[_0x144f('0x55')](_0x32978b[_0x144f('0x4a')][_0x144f('0x56')]||[]);}return null;})['then'](respondWithResult(_0x18a6d8,null))[_0x144f('0x45')](handleError(_0x18a6d8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cdb8aeb..00e966a 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 _0xf6b3=['exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf6b3,0x177));var _0x3f6b=function(_0x43924b,_0x20ceee){_0x43924b=_0x43924b-0x0;var _0x3dfff6=_0xf6b3[_0x43924b];return _0x3dfff6;};'use strict';var _=require(_0x3f6b('0x0'));var util=require(_0x3f6b('0x1'));var logger=require(_0x3f6b('0x2'))('api');var moment=require(_0x3f6b('0x3'));var BPromise=require(_0x3f6b('0x4'));var rp=require(_0x3f6b('0x5'));var fs=require('fs');var path=require(_0x3f6b('0x6'));var rimraf=require('rimraf');var config=require(_0x3f6b('0x7'));var attributes=require(_0x3f6b('0x8'));module[_0x3f6b('0x9')]=function(_0x34ab6b,_0x287ad0){return _0x34ab6b['define'](_0x3f6b('0xa'),attributes,{'tableName':_0x3f6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9762=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','bluebird'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x9762,0x14a));var _0x2976=function(_0x1de8cc,_0x3e3f90){_0x1de8cc=_0x1de8cc-0x0;var _0x6f59fa=_0x9762[_0x1de8cc];return _0x6f59fa;};'use strict';var _=require(_0x2976('0x0'));var util=require(_0x2976('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2976('0x2'));var rp=require(_0x2976('0x3'));var fs=require('fs');var path=require(_0x2976('0x4'));var rimraf=require('rimraf');var config=require(_0x2976('0x5'));var attributes=require(_0x2976('0x6'));module['exports']=function(_0x5e14d2,_0x499abc){return _0x5e14d2['define'](_0x2976('0x7'),attributes,{'tableName':_0x2976('0x8'),'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 86c2555..0e2ab1d 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 _0x8237=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x5841a3,_0x326276){var _0x1e4cf9=function(_0x479cdb){while(--_0x479cdb){_0x5841a3['push'](_0x5841a3['shift']());}};_0x1e4cf9(++_0x326276);}(_0x8237,0x96));var _0x7823=function(_0x4215f4,_0x17b2ad){_0x4215f4=_0x4215f4-0x0;var _0x1b5f92=_0x8237[_0x4215f4];return _0x1b5f92;};'use strict';var _=require(_0x7823('0x0'));var util=require(_0x7823('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7823('0x2'));var fs=require('fs');var Redis=require(_0x7823('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7823('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7823('0x5'));var jayson=require(_0x7823('0x6'));var client=jayson[_0x7823('0x7')][_0x7823('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e3841,_0x404dd8,_0x476ff5){return new BPromise(function(_0x1e5260,_0x52e175){return client[_0x7823('0x9')](_0x4e3841,_0x476ff5)[_0x7823('0xa')](function(_0x4eb36f){logger[_0x7823('0xb')](_0x7823('0xc'),_0x404dd8,_0x7823('0xd'));logger[_0x7823('0xe')](_0x7823('0xf'),_0x404dd8,_0x7823('0xd'),JSON[_0x7823('0x10')](_0x4eb36f));if(_0x4eb36f[_0x7823('0x11')]){if(_0x4eb36f[_0x7823('0x11')][_0x7823('0x12')]===0x1f4){logger[_0x7823('0x11')](_0x7823('0xc'),_0x404dd8,_0x4eb36f[_0x7823('0x11')][_0x7823('0x13')]);return _0x52e175(_0x4eb36f[_0x7823('0x11')][_0x7823('0x13')]);}logger[_0x7823('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x404dd8,_0x4eb36f[_0x7823('0x11')][_0x7823('0x13')]);return _0x1e5260(_0x4eb36f[_0x7823('0x11')][_0x7823('0x13')]);}else{logger[_0x7823('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x404dd8,'request\x20sent');_0x1e5260(_0x4eb36f[_0x7823('0x14')]['message']);}})[_0x7823('0x15')](function(_0x3ee68c){logger[_0x7823('0x11')](_0x7823('0xc'),_0x404dd8,_0x3ee68c);_0x52e175(_0x3ee68c);});});} \ No newline at end of file +var _0x13b6=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x13b6,0x97));var _0x613b=function(_0x56b54a,_0x1888ae){_0x56b54a=_0x56b54a-0x0;var _0x43238d=_0x13b6[_0x56b54a];return _0x43238d;};'use strict';var _=require(_0x613b('0x0'));var util=require('util');var moment=require(_0x613b('0x1'));var BPromise=require(_0x613b('0x2'));var rs=require(_0x613b('0x3'));var fs=require('fs');var Redis=require(_0x613b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x613b('0x5'));var logger=require(_0x613b('0x6'))(_0x613b('0x7'));var config=require('../../config/environment');var jayson=require(_0x613b('0x8'));var client=jayson[_0x613b('0x9')][_0x613b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x593a18,_0x31a96f,_0x4e576a){return new BPromise(function(_0xf83c34,_0x4abb96){return client['request'](_0x593a18,_0x4e576a)[_0x613b('0xb')](function(_0x37dbc7){logger[_0x613b('0xc')](_0x613b('0xd'),_0x31a96f,_0x613b('0xe'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x31a96f,_0x613b('0xe'),JSON['stringify'](_0x37dbc7));if(_0x37dbc7[_0x613b('0xf')]){if(_0x37dbc7['error']['code']===0x1f4){logger[_0x613b('0xf')](_0x613b('0xd'),_0x31a96f,_0x37dbc7[_0x613b('0xf')]['message']);return _0x4abb96(_0x37dbc7[_0x613b('0xf')][_0x613b('0x10')]);}logger[_0x613b('0xf')](_0x613b('0xd'),_0x31a96f,_0x37dbc7[_0x613b('0xf')][_0x613b('0x10')]);return _0xf83c34(_0x37dbc7[_0x613b('0xf')][_0x613b('0x10')]);}else{logger[_0x613b('0xc')](_0x613b('0xd'),_0x31a96f,'request\x20sent');_0xf83c34(_0x37dbc7[_0x613b('0x11')][_0x613b('0x10')]);}})[_0x613b('0x12')](function(_0x4cafe9){logger['error'](_0x613b('0xd'),_0x31a96f,_0x4cafe9);_0x4abb96(_0x4cafe9);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6866296..d09e833 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 _0x78fc=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78fc,0x1c6));var _0xc78f=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x78fc[_0x8e9386];return _0x4abf26;};'use strict';var multer=require(_0xc78f('0x0'));var util=require(_0xc78f('0x1'));var path=require('path');var timeout=require(_0xc78f('0x2'));var express=require('express');var router=express[_0xc78f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc78f('0x4'));var interaction=require(_0xc78f('0x5'));var config=require(_0xc78f('0x6'));var controller=require(_0xc78f('0x7'));router['get']('/',auth[_0xc78f('0x8')](),controller[_0xc78f('0x9')]);router[_0xc78f('0xa')](_0xc78f('0xb'),auth[_0xc78f('0x8')](),controller[_0xc78f('0xc')]);router[_0xc78f('0xd')]('/',auth[_0xc78f('0x8')](),controller['create']);router[_0xc78f('0xe')]('/:id',auth[_0xc78f('0x8')](),controller[_0xc78f('0xf')]);router[_0xc78f('0x10')](_0xc78f('0xb'),auth[_0xc78f('0x8')](),controller[_0xc78f('0x11')]);module[_0xc78f('0x12')]=router; \ No newline at end of file +var _0xe2b9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x2c2e98,_0x204bda){var _0x2f3b27=function(_0x4f1a8b){while(--_0x4f1a8b){_0x2c2e98['push'](_0x2c2e98['shift']());}};_0x2f3b27(++_0x204bda);}(_0xe2b9,0x140));var _0x9e2b=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0xe2b9[_0x132558];return _0x34f138;};'use strict';var multer=require(_0x9e2b('0x0'));var util=require('util');var path=require(_0x9e2b('0x1'));var timeout=require(_0x9e2b('0x2'));var express=require(_0x9e2b('0x3'));var router=express['Router']();var fs_extra=require(_0x9e2b('0x4'));var auth=require(_0x9e2b('0x5'));var interaction=require(_0x9e2b('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9e2b('0x7')]);router[_0x9e2b('0x8')]('/:id',auth[_0x9e2b('0x9')](),controller[_0x9e2b('0xa')]);router[_0x9e2b('0xb')]('/',auth[_0x9e2b('0x9')](),controller[_0x9e2b('0xc')]);router[_0x9e2b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9e2b('0xe')]);router[_0x9e2b('0xf')](_0x9e2b('0x10'),auth[_0x9e2b('0x9')](),controller[_0x9e2b('0x11')]);module[_0x9e2b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index fb5d9e4..c3f8689 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 _0xba13=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x157410,_0x123563){var _0x10de72=function(_0x2d49fc){while(--_0x2d49fc){_0x157410['push'](_0x157410['shift']());}};_0x10de72(++_0x123563);}(_0xba13,0x1b5));var _0x3ba1=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xba13[_0x469a3c];return _0x968f4;};'use strict';var Sequelize=require(_0x3ba1('0x0'));module[_0x3ba1('0x1')]={'type':{'type':Sequelize[_0x3ba1('0x2')](_0x3ba1('0x3'),_0x3ba1('0x4'),_0x3ba1('0x5'),_0x3ba1('0x6'),_0x3ba1('0x7')),'defaultValue':_0x3ba1('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x3ba1('0x3'),_0x3ba1('0x4'),_0x3ba1('0x5'))},'keyContent':{'type':Sequelize[_0x3ba1('0x8')]},'idField':{'type':Sequelize[_0x3ba1('0x8')]},'nameField':{'type':Sequelize[_0x3ba1('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3ba1('0x8')]}}; \ No newline at end of file +var _0xfe34=['string','variable','keyValue','STRING','customVariable','BOOLEAN','ENUM'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xfe34,0x13a));var _0x4fe3=function(_0x43270b,_0x2533e5){_0x43270b=_0x43270b-0x0;var _0x1bee9a=_0xfe34[_0x43270b];return _0x1bee9a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4fe3('0x0')](_0x4fe3('0x1'),_0x4fe3('0x2'),'customVariable',_0x4fe3('0x3'),'picklist'),'defaultValue':_0x4fe3('0x1')},'content':{'type':Sequelize[_0x4fe3('0x4')]},'key':{'type':Sequelize[_0x4fe3('0x4')]},'keyType':{'type':Sequelize[_0x4fe3('0x0')](_0x4fe3('0x1'),'variable',_0x4fe3('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4fe3('0x4')]},'nameField':{'type':Sequelize[_0x4fe3('0x4')]},'customField':{'type':Sequelize[_0x4fe3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 243861e..0a701af 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 _0xecb2=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','destroy','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x1f81c1,_0x10778c){var _0x61f935=function(_0x2ae940){while(--_0x2ae940){_0x1f81c1['push'](_0x1f81c1['shift']());}};_0x61f935(++_0x10778c);}(_0xecb2,0xf6));var _0x2ecb=function(_0x2187ab,_0xafaecc){_0x2187ab=_0x2187ab-0x0;var _0x23579b=_0xecb2[_0x2187ab];return _0x23579b;};'use strict';var emlformat=require(_0x2ecb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ecb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ecb('0x2'));var Mustache=require(_0x2ecb('0x3'));var util=require(_0x2ecb('0x4'));var path=require(_0x2ecb('0x5'));var sox=require(_0x2ecb('0x6'));var csv=require(_0x2ecb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ecb('0x8'));var crypto=require(_0x2ecb('0x9'));var jsforce=require(_0x2ecb('0xa'));var deskjs=require(_0x2ecb('0xb'));var toCsv=require(_0x2ecb('0x7'));var querystring=require('querystring');var Papa=require(_0x2ecb('0xc'));var Redis=require(_0x2ecb('0xd'));var authService=require(_0x2ecb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2ecb('0xf'));var hardwareService=require(_0x2ecb('0x10'));var logger=require(_0x2ecb('0x11'))(_0x2ecb('0x12'));var utils=require(_0x2ecb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2ecb('0x14'));var db=require(_0x2ecb('0x15'))['db'];function respondWithStatusCode(_0x3d74b3,_0x29cb3d){_0x29cb3d=_0x29cb3d||0xcc;return function(_0x59568c){if(_0x59568c){return _0x3d74b3[_0x2ecb('0x16')](_0x29cb3d);}return _0x3d74b3[_0x2ecb('0x17')](_0x29cb3d)['end']();};}function respondWithResult(_0x10bc58,_0x234741){_0x234741=_0x234741||0xc8;return function(_0x48505e){if(_0x48505e){return _0x10bc58[_0x2ecb('0x17')](_0x234741)[_0x2ecb('0x18')](_0x48505e);}};}function respondWithFilteredResult(_0x121f29,_0x3fda3b){return function(_0xe429aa){if(_0xe429aa){var _0x37ea40=typeof _0x3fda3b[_0x2ecb('0x19')]===_0x2ecb('0x1a')&&typeof _0x3fda3b[_0x2ecb('0x1b')]==='undefined';var _0x1c3e62=_0xe429aa[_0x2ecb('0x1c')];var _0x5a1d41=_0x37ea40?0x0:_0x3fda3b[_0x2ecb('0x19')];var _0x4c17cf=_0x37ea40?_0xe429aa[_0x2ecb('0x1c')]:_0x3fda3b[_0x2ecb('0x19')]+_0x3fda3b[_0x2ecb('0x1b')];var _0x3101fa;if(_0x4c17cf>=_0x1c3e62){_0x4c17cf=_0x1c3e62;_0x3101fa=0xc8;}else{_0x3101fa=0xce;}_0x121f29[_0x2ecb('0x17')](_0x3101fa);return _0x121f29[_0x2ecb('0x1d')](_0x2ecb('0x1e'),_0x5a1d41+'-'+_0x4c17cf+'/'+_0x1c3e62)['json'](_0xe429aa);}return null;};}function patchUpdates(_0x8ff004){return function(_0x3aaaae){try{jsonpatch[_0x2ecb('0x1f')](_0x3aaaae,_0x8ff004,!![]);}catch(_0x4c8330){return BPromise[_0x2ecb('0x20')](_0x4c8330);}return _0x3aaaae[_0x2ecb('0x21')]();};}function saveUpdates(_0x4e3d3c,_0x5b9d50){return function(_0x2db610){if(_0x2db610){return _0x2db610['update'](_0x4e3d3c)[_0x2ecb('0x22')](function(_0x2a1834){return _0x2a1834;});}return null;};}function removeEntity(_0xba8379,_0x296ae0){return function(_0x1ff315){if(_0x1ff315){return _0x1ff315['destroy']()['then'](function(){_0xba8379[_0x2ecb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa13f,_0x8f21c){return function(_0x45249b){if(!_0x45249b){_0x3fa13f[_0x2ecb('0x16')](0x194);}return _0x45249b;};}function handleError(_0x2eaaac,_0x20071b){_0x20071b=_0x20071b||0x1f4;return function(_0x171259){logger[_0x2ecb('0x23')](_0x171259[_0x2ecb('0x24')]);if(_0x171259[_0x2ecb('0x25')]){delete _0x171259[_0x2ecb('0x25')];}_0x2eaaac[_0x2ecb('0x17')](_0x20071b)[_0x2ecb('0x26')](_0x171259);};}exports[_0x2ecb('0x27')]=function(_0x75c8cb,_0x45059a){var _0x46092e={},_0x2d5ae3={},_0x294ff5={'count':0x0,'rows':[]};var _0x3e52b7=_[_0x2ecb('0x28')](db[_0x2ecb('0x29')]['rawAttributes'],function(_0x52f9f4){return{'name':_0x52f9f4[_0x2ecb('0x2a')],'type':_0x52f9f4[_0x2ecb('0x2b')][_0x2ecb('0x2c')]};});_0x2d5ae3[_0x2ecb('0x2d')]=_['map'](_0x3e52b7,_0x2ecb('0x25'));_0x2d5ae3[_0x2ecb('0x2e')]=_[_0x2ecb('0x2f')](_0x75c8cb[_0x2ecb('0x2e')]);_0x2d5ae3[_0x2ecb('0x30')]=_[_0x2ecb('0x31')](_0x2d5ae3['model'],_0x2d5ae3[_0x2ecb('0x2e')]);_0x46092e['attributes']=_[_0x2ecb('0x31')](_0x2d5ae3[_0x2ecb('0x2d')],qs[_0x2ecb('0x32')](_0x75c8cb[_0x2ecb('0x2e')][_0x2ecb('0x32')]));_0x46092e[_0x2ecb('0x33')]=_0x46092e[_0x2ecb('0x33')][_0x2ecb('0x34')]?_0x46092e[_0x2ecb('0x33')]:_0x2d5ae3['model'];if(!_0x75c8cb[_0x2ecb('0x2e')][_0x2ecb('0x35')](_0x2ecb('0x36'))){_0x46092e['limit']=qs[_0x2ecb('0x1b')](_0x75c8cb[_0x2ecb('0x2e')][_0x2ecb('0x1b')]);_0x46092e['offset']=qs[_0x2ecb('0x19')](_0x75c8cb[_0x2ecb('0x2e')][_0x2ecb('0x19')]);}_0x46092e[_0x2ecb('0x37')]=qs[_0x2ecb('0x38')](_0x75c8cb[_0x2ecb('0x2e')][_0x2ecb('0x38')]);_0x46092e[_0x2ecb('0x39')]=qs[_0x2ecb('0x30')](_[_0x2ecb('0x3a')](_0x75c8cb['query'],_0x2d5ae3[_0x2ecb('0x30')]),_0x3e52b7);if(_0x75c8cb['query'][_0x2ecb('0x3b')]){_0x46092e[_0x2ecb('0x39')]=_[_0x2ecb('0x3c')](_0x46092e[_0x2ecb('0x39')],{'$or':_[_0x2ecb('0x28')](_0x3e52b7,function(_0x369f44){if(_0x369f44['type']!==_0x2ecb('0x3d')){var _0x2f8f8c={};_0x2f8f8c[_0x369f44[_0x2ecb('0x25')]]={'$like':'%'+_0x75c8cb[_0x2ecb('0x2e')][_0x2ecb('0x3b')]+'%'};return _0x2f8f8c;}})});}_0x46092e=_[_0x2ecb('0x3c')]({},_0x46092e,_0x75c8cb[_0x2ecb('0x3e')]);var _0x361bde={'where':_0x46092e[_0x2ecb('0x39')]};return db[_0x2ecb('0x29')][_0x2ecb('0x1c')](_0x361bde)[_0x2ecb('0x22')](function(_0xa90974){_0x294ff5['count']=_0xa90974;if(_0x75c8cb[_0x2ecb('0x2e')]['includeAll']){_0x46092e['include']=[{'all':!![]}];}return db[_0x2ecb('0x29')][_0x2ecb('0x3f')](_0x46092e);})[_0x2ecb('0x22')](function(_0x818b70){_0x294ff5['rows']=_0x818b70;return _0x294ff5;})['then'](respondWithFilteredResult(_0x45059a,_0x46092e))['catch'](handleError(_0x45059a,null));};exports[_0x2ecb('0x40')]=function(_0x51ea11,_0x5d566e){var _0x231076={'raw':!![],'where':{'id':_0x51ea11[_0x2ecb('0x41')]['id']}},_0x312b35={};_0x312b35[_0x2ecb('0x2d')]=_[_0x2ecb('0x2f')](db[_0x2ecb('0x29')][_0x2ecb('0x42')]);_0x312b35[_0x2ecb('0x2e')]=_[_0x2ecb('0x2f')](_0x51ea11[_0x2ecb('0x2e')]);_0x312b35[_0x2ecb('0x30')]=_['intersection'](_0x312b35[_0x2ecb('0x2d')],_0x312b35[_0x2ecb('0x2e')]);_0x231076['attributes']=_[_0x2ecb('0x31')](_0x312b35[_0x2ecb('0x2d')],qs[_0x2ecb('0x32')](_0x51ea11['query']['fields']));_0x231076[_0x2ecb('0x33')]=_0x231076[_0x2ecb('0x33')][_0x2ecb('0x34')]?_0x231076[_0x2ecb('0x33')]:_0x312b35['model'];if(_0x51ea11[_0x2ecb('0x2e')][_0x2ecb('0x43')]){_0x231076[_0x2ecb('0x44')]=[{'all':!![]}];}_0x231076=_[_0x2ecb('0x3c')]({},_0x231076,_0x51ea11[_0x2ecb('0x3e')]);return db['DeskField'][_0x2ecb('0x45')](_0x231076)[_0x2ecb('0x22')](handleEntityNotFound(_0x5d566e,null))[_0x2ecb('0x22')](respondWithResult(_0x5d566e,null))[_0x2ecb('0x46')](handleError(_0x5d566e,null));};exports['create']=function(_0x6cb307,_0x5b66a7){return db[_0x2ecb('0x29')][_0x2ecb('0x47')](_0x6cb307[_0x2ecb('0x48')],{})['then'](respondWithResult(_0x5b66a7,0xc9))[_0x2ecb('0x46')](handleError(_0x5b66a7,null));};exports[_0x2ecb('0x49')]=function(_0x5f5350,_0x3afd6d){if(_0x5f5350[_0x2ecb('0x48')]['id']){delete _0x5f5350['body']['id'];}return db['DeskField'][_0x2ecb('0x45')]({'where':{'id':_0x5f5350[_0x2ecb('0x41')]['id']}})[_0x2ecb('0x22')](handleEntityNotFound(_0x3afd6d,null))['then'](saveUpdates(_0x5f5350[_0x2ecb('0x48')],null))['then'](respondWithResult(_0x3afd6d,null))['catch'](handleError(_0x3afd6d,null));};exports[_0x2ecb('0x4a')]=function(_0x273286,_0x1642ed){return db['DeskField'][_0x2ecb('0x45')]({'where':{'id':_0x273286['params']['id']}})[_0x2ecb('0x22')](handleEntityNotFound(_0x1642ed,null))[_0x2ecb('0x22')](removeEntity(_0x1642ed,null))[_0x2ecb('0x46')](handleError(_0x1642ed,null));}; \ No newline at end of file +var _0xeff8=['findAll','rows','catch','show','params','length','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0xeff8,0x186));var _0x8eff=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xeff8[_0xabfec4];return _0x7bafa2;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['DeskField'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['DeskField']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')](_0x33aa8d[_0x8eff('0x4a')],{})[_0x8eff('0x26')](respondWithResult(_0x1b5fda,0xc9))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x4c7013,_0x11e53c){if(_0x4c7013['body']['id']){delete _0x4c7013[_0x8eff('0x4a')]['id'];}return db[_0x8eff('0x2d')][_0x8eff('0x4b')]({'where':{'id':_0x4c7013[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x11e53c,null))[_0x8eff('0x26')](saveUpdates(_0x4c7013[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x11e53c,null))[_0x8eff('0x44')](handleError(_0x11e53c,null));};exports[_0x8eff('0x27')]=function(_0x2a4dbb,_0x452f7a){return db['DeskField'][_0x8eff('0x4b')]({'where':{'id':_0x2a4dbb[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452f7a,null))[_0x8eff('0x26')](removeEntity(_0x452f7a,null))[_0x8eff('0x44')](handleError(_0x452f7a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c86cacd..29b973c 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 _0x5e9d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x5e9d,0x119));var _0xd5e9=function(_0x2bff86,_0xa557bd){_0x2bff86=_0x2bff86-0x0;var _0x140870=_0x5e9d[_0x2bff86];return _0x140870;};'use strict';var _=require(_0xd5e9('0x0'));var util=require(_0xd5e9('0x1'));var logger=require(_0xd5e9('0x2'))(_0xd5e9('0x3'));var moment=require(_0xd5e9('0x4'));var BPromise=require(_0xd5e9('0x5'));var rp=require(_0xd5e9('0x6'));var fs=require('fs');var path=require(_0xd5e9('0x7'));var rimraf=require(_0xd5e9('0x8'));var config=require(_0xd5e9('0x9'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x7726cf,_0x13a351){return _0x7726cf[_0xd5e9('0xa')](_0xd5e9('0xb'),attributes,{'tableName':_0xd5e9('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xd5e9('0xd'),_0xd5e9('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x677b=['bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x677b,0x11c));var _0xb677=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0x677b[_0x38fb0d];return _0x30a5d6;};'use strict';var _=require(_0xb677('0x0'));var util=require('util');var logger=require(_0xb677('0x1'))(_0xb677('0x2'));var moment=require(_0xb677('0x3'));var BPromise=require(_0xb677('0x4'));var rp=require(_0xb677('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb677('0x6'));var config=require(_0xb677('0x7'));var attributes=require(_0xb677('0x8'));module[_0xb677('0x9')]=function(_0x27ab76,_0x47c61a){return _0x27ab76[_0xb677('0xa')](_0xb677('0xb'),attributes,{'tableName':_0xb677('0xc'),'paranoid':![],'indexes':[{'name':_0xb677('0xd'),'fields':[_0xb677('0xe'),_0xb677('0xf')],'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 c5866c8..30b2fe4 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 _0xf287=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','DeskField,\x20%s,\x20%s'];(function(_0x5a885b,_0x25eba0){var _0x5c8823=function(_0x59a3e3){while(--_0x59a3e3){_0x5a885b['push'](_0x5a885b['shift']());}};_0x5c8823(++_0x25eba0);}(_0xf287,0x16d));var _0x7f28=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf287[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x7f28('0x0'));var util=require('util');var moment=require(_0x7f28('0x1'));var BPromise=require(_0x7f28('0x2'));var rs=require(_0x7f28('0x3'));var fs=require('fs');var Redis=require(_0x7f28('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f28('0x5'));var logger=require(_0x7f28('0x6'))(_0x7f28('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f28('0x8'));var client=jayson[_0x7f28('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a40a3,_0x540537,_0x4fc144){return new BPromise(function(_0x478efd,_0x2a2e2b){return client[_0x7f28('0xa')](_0x1a40a3,_0x4fc144)[_0x7f28('0xb')](function(_0xc7529f){logger['info'](_0x7f28('0xc'),_0x540537,_0x7f28('0xd'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x540537,_0x7f28('0xd'),JSON[_0x7f28('0xe')](_0xc7529f));if(_0xc7529f[_0x7f28('0xf')]){if(_0xc7529f[_0x7f28('0xf')][_0x7f28('0x10')]===0x1f4){logger[_0x7f28('0xf')]('DeskField,\x20%s,\x20%s',_0x540537,_0xc7529f[_0x7f28('0xf')][_0x7f28('0x11')]);return _0x2a2e2b(_0xc7529f[_0x7f28('0xf')][_0x7f28('0x11')]);}logger['error'](_0x7f28('0xc'),_0x540537,_0xc7529f[_0x7f28('0xf')]['message']);return _0x478efd(_0xc7529f[_0x7f28('0xf')][_0x7f28('0x11')]);}else{logger[_0x7f28('0x12')](_0x7f28('0xc'),_0x540537,_0x7f28('0xd'));_0x478efd(_0xc7529f[_0x7f28('0x13')][_0x7f28('0x11')]);}})[_0x7f28('0x14')](function(_0x4ea235){logger['error'](_0x7f28('0xc'),_0x540537,_0x4ea235);_0x2a2e2b(_0x4ea235);});});} \ No newline at end of file +var _0xfce1=['jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4628c6,_0x212c5e){var _0x181ddc=function(_0x36280a){while(--_0x36280a){_0x4628c6['push'](_0x4628c6['shift']());}};_0x181ddc(++_0x212c5e);}(_0xfce1,0xe0));var _0x1fce=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xfce1[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x1fce('0x0'));var util=require('util');var moment=require(_0x1fce('0x1'));var BPromise=require('bluebird');var rs=require(_0x1fce('0x2'));var fs=require('fs');var Redis=require(_0x1fce('0x3'));var db=require(_0x1fce('0x4'))['db'];var utils=require(_0x1fce('0x5'));var logger=require(_0x1fce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1fce('0x7'));var client=jayson[_0x1fce('0x8')][_0x1fce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2433be,_0x4d9e65,_0x562b6a){return new BPromise(function(_0x330935,_0x38ca82){return client[_0x1fce('0xa')](_0x2433be,_0x562b6a)[_0x1fce('0xb')](function(_0x28dafb){logger[_0x1fce('0xc')](_0x1fce('0xd'),_0x4d9e65,'request\x20sent');logger[_0x1fce('0xe')](_0x1fce('0xf'),_0x4d9e65,_0x1fce('0x10'),JSON[_0x1fce('0x11')](_0x28dafb));if(_0x28dafb[_0x1fce('0x12')]){if(_0x28dafb['error'][_0x1fce('0x13')]===0x1f4){logger[_0x1fce('0x12')](_0x1fce('0xd'),_0x4d9e65,_0x28dafb[_0x1fce('0x12')][_0x1fce('0x14')]);return _0x38ca82(_0x28dafb[_0x1fce('0x12')][_0x1fce('0x14')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x4d9e65,_0x28dafb[_0x1fce('0x12')][_0x1fce('0x14')]);return _0x330935(_0x28dafb['error']['message']);}else{logger['info'](_0x1fce('0xd'),_0x4d9e65,_0x1fce('0x10'));_0x330935(_0x28dafb['result'][_0x1fce('0x14')]);}})['catch'](function(_0x1a216b){logger['error']('DeskField,\x20%s,\x20%s',_0x4d9e65,_0x1a216b);_0x38ca82(_0x1a216b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4e6cdb5..fec53da 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 _0x9206=['./intDynamics365Account.controller','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4caf4f,_0x1f9d37){var _0xf64dd9=function(_0x37507){while(--_0x37507){_0x4caf4f['push'](_0x4caf4f['shift']());}};_0xf64dd9(++_0x1f9d37);}(_0x9206,0x16f));var _0x6920=function(_0x1da648,_0x1365d3){_0x1da648=_0x1da648-0x0;var _0xb86467=_0x9206[_0x1da648];return _0xb86467;};'use strict';var multer=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var path=require(_0x6920('0x2'));var timeout=require('connect-timeout');var express=require(_0x6920('0x3'));var router=express[_0x6920('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6920('0x5'));var interaction=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var controller=require(_0x6920('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6920('0x9')]);router[_0x6920('0xa')](_0x6920('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6920('0xc'),auth['isAuthenticated'](),controller[_0x6920('0xd')]);router[_0x6920('0xa')](_0x6920('0xe'),auth[_0x6920('0xf')](),controller[_0x6920('0x10')]);router[_0x6920('0x11')]('/',auth['isAuthenticated'](),controller[_0x6920('0x12')]);router[_0x6920('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6920('0x13')]);router[_0x6920('0x14')](_0x6920('0xb'),auth['isAuthenticated'](),controller[_0x6920('0x15')]);router[_0x6920('0x16')](_0x6920('0xb'),auth['isAuthenticated'](),controller[_0x6920('0x17')]);module[_0x6920('0x18')]=router; \ No newline at end of file +var _0x9b5d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4afb9a,_0x2221a4){var _0x221c13=function(_0x176f30){while(--_0x176f30){_0x4afb9a['push'](_0x4afb9a['shift']());}};_0x221c13(++_0x2221a4);}(_0x9b5d,0x1aa));var _0xd9b5=function(_0x13ceb3,_0x349adf){_0x13ceb3=_0x13ceb3-0x0;var _0x2763ee=_0x9b5d[_0x13ceb3];return _0x2763ee;};'use strict';var multer=require(_0xd9b5('0x0'));var util=require(_0xd9b5('0x1'));var path=require(_0xd9b5('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9b5('0x3'));var router=express[_0xd9b5('0x4')]();var fs_extra=require(_0xd9b5('0x5'));var auth=require(_0xd9b5('0x6'));var interaction=require(_0xd9b5('0x7'));var config=require(_0xd9b5('0x8'));var controller=require(_0xd9b5('0x9'));router['get']('/',auth[_0xd9b5('0xa')](),controller['index']);router[_0xd9b5('0xb')]('/:id',auth[_0xd9b5('0xa')](),controller[_0xd9b5('0xc')]);router['get'](_0xd9b5('0xd'),auth[_0xd9b5('0xa')](),controller[_0xd9b5('0xe')]);router[_0xd9b5('0xb')](_0xd9b5('0xf'),auth[_0xd9b5('0xa')](),controller[_0xd9b5('0x10')]);router[_0xd9b5('0x11')]('/',auth[_0xd9b5('0xa')](),controller[_0xd9b5('0x12')]);router[_0xd9b5('0x11')](_0xd9b5('0xd'),auth[_0xd9b5('0xa')](),controller[_0xd9b5('0x13')]);router['put'](_0xd9b5('0x14'),auth[_0xd9b5('0xa')](),controller['update']);router[_0xd9b5('0x15')](_0xd9b5('0x14'),auth[_0xd9b5('0xa')](),controller[_0xd9b5('0x16')]);module[_0xd9b5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3a209dd..eb57690 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 _0xa194=['STRING','sequelize'];(function(_0x14e995,_0x92c239){var _0x4440c4=function(_0x2c070e){while(--_0x2c070e){_0x14e995['push'](_0x14e995['shift']());}};_0x4440c4(++_0x92c239);}(_0xa194,0x171));var _0x4a19=function(_0x3c328e,_0x133167){_0x3c328e=_0x3c328e-0x0;var _0x46b037=_0xa194[_0x3c328e];return _0x46b037;};'use strict';var Sequelize=require(_0x4a19('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a19('0x1')]},'username':{'type':Sequelize[_0x4a19('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4a19('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4a19('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4a19('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4a19('0x1')]}}; \ No newline at end of file +var _0x2172=['STRING','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2172,0x15b));var _0x2217=function(_0x2db16f,_0x50267e){_0x2db16f=_0x2db16f-0x0;var _0xe73c61=_0x2172[_0x2db16f];return _0xe73c61;};'use strict';var Sequelize=require('sequelize');module[_0x2217('0x0')]={'name':{'type':Sequelize[_0x2217('0x1')]},'username':{'type':Sequelize[_0x2217('0x1')]},'password':{'type':Sequelize[_0x2217('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2217('0x1')]},'clientSecret':{'type':Sequelize[_0x2217('0x1')]},'serverUrl':{'type':Sequelize[_0x2217('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 5674b89..b2ba832 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 _0x4403=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','error','name','send','index','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','Dynamics365Account','rawAttributes','intersection','fields','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','findOne','username','password','remoteUri','tenantId','clientId','clientSecret','slice','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','GET','Bearer\x20','4.0','value','MetadataId','Attributes','remove','includes','forEach','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','statusCode','stack','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0xb2d925,_0x3bed56){var _0x271f78=function(_0x1d8e88){while(--_0x1d8e88){_0xb2d925['push'](_0xb2d925['shift']());}};_0x271f78(++_0x3bed56);}(_0x4403,0x179));var _0x3440=function(_0x3c87d5,_0x1f2e3e){_0x3c87d5=_0x3c87d5-0x0;var _0x231bc4=_0x4403[_0x3c87d5];return _0x231bc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3440('0x0'));var rp=require('request-promise');var moment=require(_0x3440('0x1'));var BPromise=require(_0x3440('0x2'));var Mustache=require(_0x3440('0x3'));var util=require(_0x3440('0x4'));var path=require('path');var sox=require(_0x3440('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3440('0x6'));var _=require(_0x3440('0x7'));var squel=require(_0x3440('0x8'));var crypto=require('crypto');var jsforce=require(_0x3440('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3440('0xa'));var querystring=require(_0x3440('0xb'));var Papa=require(_0x3440('0xc'));var Redis=require('ioredis');var authService=require(_0x3440('0xd'));var qs=require(_0x3440('0xe'));var as=require(_0x3440('0xf'));var hardwareService=require(_0x3440('0x10'));var logger=require(_0x3440('0x11'))(_0x3440('0x12'));var utils=require(_0x3440('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3440('0x14'));var db=require(_0x3440('0x15'))['db'];var integrations=require(_0x3440('0x16'));function respondWithStatusCode(_0x4f541e,_0x270f4a){_0x270f4a=_0x270f4a||0xcc;return function(_0xb24e14){if(_0xb24e14){return _0x4f541e[_0x3440('0x17')](_0x270f4a);}return _0x4f541e[_0x3440('0x18')](_0x270f4a)[_0x3440('0x19')]();};}function respondWithResult(_0x5201e6,_0x36dd82){_0x36dd82=_0x36dd82||0xc8;return function(_0x55eac4){if(_0x55eac4){return _0x5201e6[_0x3440('0x18')](_0x36dd82)[_0x3440('0x1a')](_0x55eac4);}};}function respondWithFilteredResult(_0x33a5bb,_0x18871d){return function(_0x11930d){if(_0x11930d){var _0x1193f7=typeof _0x18871d[_0x3440('0x1b')]===_0x3440('0x1c')&&typeof _0x18871d['limit']===_0x3440('0x1c');var _0x1d2afe=_0x11930d[_0x3440('0x1d')];var _0x1c10fd=_0x1193f7?0x0:_0x18871d[_0x3440('0x1b')];var _0x39ee81=_0x1193f7?_0x11930d['count']:_0x18871d[_0x3440('0x1b')]+_0x18871d[_0x3440('0x1e')];var _0x2e692b;if(_0x39ee81>=_0x1d2afe){_0x39ee81=_0x1d2afe;_0x2e692b=0xc8;}else{_0x2e692b=0xce;}_0x33a5bb[_0x3440('0x18')](_0x2e692b);return _0x33a5bb[_0x3440('0x1f')](_0x3440('0x20'),_0x1c10fd+'-'+_0x39ee81+'/'+_0x1d2afe)[_0x3440('0x1a')](_0x11930d);}return null;};}function patchUpdates(_0x36f851){return function(_0x25afeb){try{jsonpatch[_0x3440('0x21')](_0x25afeb,_0x36f851,!![]);}catch(_0x1c735b){return BPromise['reject'](_0x1c735b);}return _0x25afeb['save']();};}function saveUpdates(_0x5f4386,_0x2c8e7c){return function(_0x45afde){if(_0x45afde){return _0x45afde['update'](_0x5f4386)[_0x3440('0x22')](function(_0x232b8f){return _0x232b8f;});}return null;};}function removeEntity(_0x33cfb5,_0x38bf02){return function(_0x371b83){if(_0x371b83){return _0x371b83['destroy']()[_0x3440('0x22')](function(){_0x33cfb5[_0x3440('0x18')](0xcc)[_0x3440('0x19')]();});}};}function handleEntityNotFound(_0x15f121,_0xd89efe){return function(_0x58c03a){if(!_0x58c03a){_0x15f121[_0x3440('0x17')](0x194);}return _0x58c03a;};}function handleError(_0x2e93c,_0x1cfe3a){_0x1cfe3a=_0x1cfe3a||0x1f4;return function(_0x251646){logger[_0x3440('0x23')](_0x251646['stack']);if(_0x251646[_0x3440('0x24')]){delete _0x251646[_0x3440('0x24')];}_0x2e93c[_0x3440('0x18')](_0x1cfe3a)[_0x3440('0x25')](_0x251646);};}exports[_0x3440('0x26')]=function(_0x24426a,_0xe23a){var _0x1f7fee={},_0xc2167c={},_0xf38d1={'count':0x0,'rows':[]};var _0x2f2bdb=_['map'](db['Dynamics365Account']['rawAttributes'],function(_0x550a2b){return{'name':_0x550a2b['fieldName'],'type':_0x550a2b['type'][_0x3440('0x27')]};});_0xc2167c['model']=_['map'](_0x2f2bdb,_0x3440('0x24'));_0xc2167c[_0x3440('0x28')]=_[_0x3440('0x29')](_0x24426a['query']);_0xc2167c[_0x3440('0x2a')]=_['intersection'](_0xc2167c['model'],_0xc2167c[_0x3440('0x28')]);_0x1f7fee['attributes']=_['intersection'](_0xc2167c[_0x3440('0x2b')],qs['fields'](_0x24426a[_0x3440('0x28')]['fields']));_0x1f7fee[_0x3440('0x2c')]=_0x1f7fee['attributes'][_0x3440('0x2d')]?_0x1f7fee['attributes']:_0xc2167c[_0x3440('0x2b')];if(!_0x24426a[_0x3440('0x28')][_0x3440('0x2e')](_0x3440('0x2f'))){_0x1f7fee[_0x3440('0x1e')]=qs['limit'](_0x24426a[_0x3440('0x28')][_0x3440('0x1e')]);_0x1f7fee[_0x3440('0x1b')]=qs[_0x3440('0x1b')](_0x24426a['query'][_0x3440('0x1b')]);}_0x1f7fee[_0x3440('0x30')]=qs['sort'](_0x24426a[_0x3440('0x28')][_0x3440('0x31')]);_0x1f7fee[_0x3440('0x32')]=qs[_0x3440('0x2a')](_[_0x3440('0x33')](_0x24426a[_0x3440('0x28')],_0xc2167c['filters']),_0x2f2bdb);if(_0x24426a[_0x3440('0x28')][_0x3440('0x34')]){_0x1f7fee[_0x3440('0x32')]=_['merge'](_0x1f7fee['where'],{'$or':_['map'](_0x2f2bdb,function(_0x5c1d74){if(_0x5c1d74[_0x3440('0x35')]!==_0x3440('0x36')){var _0x32abcf={};_0x32abcf[_0x5c1d74[_0x3440('0x24')]]={'$like':'%'+_0x24426a[_0x3440('0x28')]['filter']+'%'};return _0x32abcf;}})});}_0x1f7fee=_[_0x3440('0x37')]({},_0x1f7fee,_0x24426a[_0x3440('0x38')]);var _0x13f656={'where':_0x1f7fee['where']};return db['Dynamics365Account']['count'](_0x13f656)[_0x3440('0x22')](function(_0xea5036){_0xf38d1[_0x3440('0x1d')]=_0xea5036;if(_0x24426a[_0x3440('0x28')][_0x3440('0x39')]){_0x1f7fee[_0x3440('0x3a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3440('0x3b')](_0x1f7fee);})[_0x3440('0x22')](function(_0x41ce7d){_0xf38d1['rows']=_0x41ce7d;return _0xf38d1;})[_0x3440('0x22')](respondWithFilteredResult(_0xe23a,_0x1f7fee))[_0x3440('0x3c')](handleError(_0xe23a,null));};exports[_0x3440('0x3d')]=function(_0x3a4002,_0x3710d3){var _0x151ece={'raw':![],'where':{'id':_0x3a4002[_0x3440('0x3e')]['id']}},_0x54ceff={};_0x54ceff[_0x3440('0x2b')]=_['keys'](db[_0x3440('0x3f')][_0x3440('0x40')]);_0x54ceff[_0x3440('0x28')]=_[_0x3440('0x29')](_0x3a4002[_0x3440('0x28')]);_0x54ceff[_0x3440('0x2a')]=_[_0x3440('0x41')](_0x54ceff[_0x3440('0x2b')],_0x54ceff[_0x3440('0x28')]);_0x151ece[_0x3440('0x2c')]=_[_0x3440('0x41')](_0x54ceff['model'],qs[_0x3440('0x42')](_0x3a4002['query'][_0x3440('0x42')]));_0x151ece[_0x3440('0x2c')]=_0x151ece['attributes'][_0x3440('0x2d')]?_0x151ece[_0x3440('0x2c')]:_0x54ceff[_0x3440('0x2b')];if(_0x3a4002[_0x3440('0x28')][_0x3440('0x39')]){_0x151ece[_0x3440('0x3a')]=[{'all':!![]}];}_0x151ece=_[_0x3440('0x37')]({},_0x151ece,_0x3a4002[_0x3440('0x38')]);return db[_0x3440('0x3f')][_0x3440('0x43')](_0x151ece)[_0x3440('0x22')](handleEntityNotFound(_0x3710d3,null))['then'](respondWithResult(_0x3710d3,null))[_0x3440('0x3c')](handleError(_0x3710d3,null));};exports[_0x3440('0x44')]=function(_0x56505c,_0xee1e75){return db[_0x3440('0x3f')][_0x3440('0x44')](_0x56505c[_0x3440('0x45')],{})[_0x3440('0x22')](respondWithResult(_0xee1e75,0xc9))[_0x3440('0x3c')](handleError(_0xee1e75,null));};exports[_0x3440('0x46')]=function(_0x4a00e0,_0x56d37b){if(_0x4a00e0[_0x3440('0x45')]['id']){delete _0x4a00e0[_0x3440('0x45')]['id'];}return db[_0x3440('0x3f')][_0x3440('0x43')]({'where':{'id':_0x4a00e0[_0x3440('0x3e')]['id']}})[_0x3440('0x22')](handleEntityNotFound(_0x56d37b,null))[_0x3440('0x22')](saveUpdates(_0x4a00e0[_0x3440('0x45')],null))[_0x3440('0x22')](respondWithResult(_0x56d37b,null))[_0x3440('0x3c')](handleError(_0x56d37b,null));};exports[_0x3440('0x47')]=function(_0x9bf1de,_0x39bd1a){return db['Dynamics365Account']['find']({'where':{'id':_0x9bf1de[_0x3440('0x3e')]['id']}})[_0x3440('0x22')](handleEntityNotFound(_0x39bd1a,null))[_0x3440('0x22')](removeEntity(_0x39bd1a,null))[_0x3440('0x3c')](handleError(_0x39bd1a,null));};exports[_0x3440('0x48')]=function(_0x4d0525,_0x349f26,_0x53d7b7){var _0x2a7fcb={};var _0x4918f9={};var _0x4780a7;var _0x598129;return db[_0x3440('0x3f')]['findOne']({'where':{'id':_0x4d0525[_0x3440('0x3e')]['id']}})[_0x3440('0x22')](handleEntityNotFound(_0x349f26,null))[_0x3440('0x22')](function(_0x4151c5){if(_0x4151c5){_0x4780a7=_0x4151c5;_0x4918f9[_0x3440('0x2b')]=_['keys'](db[_0x3440('0x49')][_0x3440('0x40')]);_0x4918f9[_0x3440('0x28')]=_[_0x3440('0x29')](_0x4d0525[_0x3440('0x28')]);_0x4918f9[_0x3440('0x2a')]=_[_0x3440('0x41')](_0x4918f9[_0x3440('0x2b')],_0x4918f9[_0x3440('0x28')]);_0x2a7fcb['attributes']=_[_0x3440('0x41')](_0x4918f9[_0x3440('0x2b')],qs[_0x3440('0x42')](_0x4d0525[_0x3440('0x28')]['fields']));_0x2a7fcb[_0x3440('0x2c')]=_0x2a7fcb[_0x3440('0x2c')]['length']?_0x2a7fcb[_0x3440('0x2c')]:_0x4918f9[_0x3440('0x2b')];_0x2a7fcb['order']=qs[_0x3440('0x31')](_0x4d0525[_0x3440('0x28')][_0x3440('0x31')]);_0x2a7fcb['where']=qs[_0x3440('0x2a')](_[_0x3440('0x33')](_0x4d0525[_0x3440('0x28')],_0x4918f9[_0x3440('0x2a')]));if(_0x4d0525[_0x3440('0x28')]['filter']){_0x2a7fcb['where']=_[_0x3440('0x37')](_0x2a7fcb[_0x3440('0x32')],{'$or':_['map'](_0x2a7fcb[_0x3440('0x2c')],function(_0x412f7c){var _0xbcc492={};_0xbcc492[_0x412f7c]={'$like':'%'+_0x4d0525['query'][_0x3440('0x34')]+'%'};return _0xbcc492;})});}_0x2a7fcb=_[_0x3440('0x37')]({},_0x2a7fcb,_0x4d0525['options']);return _0x4780a7[_0x3440('0x48')](_0x2a7fcb);}})[_0x3440('0x22')](function(_0x140467){if(_0x140467){_0x598129=_0x140467[_0x3440('0x2d')];if(!_0x4d0525[_0x3440('0x28')][_0x3440('0x2e')]('nolimit')){_0x2a7fcb[_0x3440('0x1e')]=qs['limit'](_0x4d0525[_0x3440('0x28')]['limit']);_0x2a7fcb['offset']=qs[_0x3440('0x1b')](_0x4d0525[_0x3440('0x28')][_0x3440('0x1b')]);}return _0x4780a7['getConfigurations'](_0x2a7fcb);}})[_0x3440('0x22')](function(_0x96ed3e){if(_0x96ed3e){return _0x96ed3e?{'count':_0x598129,'rows':_0x96ed3e}:null;}})[_0x3440('0x22')](respondWithResult(_0x349f26,null))['catch'](handleError(_0x349f26,null));};exports[_0x3440('0x4a')]=function(_0x47c187,_0x38ae3b,_0x4b8196){if(_0x47c187['body']['id']){delete _0x47c187[_0x3440('0x45')]['id'];}return db[_0x3440('0x3f')]['findOne']({'where':{'id':_0x47c187['params']['id']}})[_0x3440('0x22')](handleEntityNotFound(_0x38ae3b,null))[_0x3440('0x22')](function(_0x5d118e){if(_0x5d118e){_0x47c187['body'][_0x3440('0x4b')]=_0x5d118e['id'];_0x47c187['body'][_0x3440('0x4c')]=integrations[_0x3440('0x4d')](_0x47c187[_0x3440('0x45')][_0x3440('0x4e')],_0x47c187['body']['type']);_0x47c187[_0x3440('0x45')][_0x3440('0x4f')]=integrations['getDescriptions'](_0x47c187[_0x3440('0x45')][_0x3440('0x4e')],_0x47c187['body'][_0x3440('0x35')]);return db[_0x3440('0x49')][_0x3440('0x44')](_0x47c187[_0x3440('0x45')],{'include':[{'model':db[_0x3440('0x50')],'as':_0x3440('0x4c')},{'model':db[_0x3440('0x50')],'as':_0x3440('0x4f')}]});}return null;})['then'](respondWithResult(_0x38ae3b,null))['catch'](handleError(_0x38ae3b,null));};exports[_0x3440('0x51')]=function(_0x460fa7,_0x34f9c4,_0x347e08){var _0x33a147=_0x460fa7['query'][_0x3440('0x52')];var _0x347af9=_0x33a147===_0x3440('0x53')?_0x3440('0x54'):'PhoneCall';var _0x3833d8='';var _0x75a903='';var _0x4833c2='';var _0x23cfb9='';var _0x19dda6='';var _0x46405b='';var _0x538924='';var _0x3b8ff9='';var _0x267099=[_0x3440('0x55'),_0x3440('0x56'),_0x3440('0x57'),_0x3440('0x58'),_0x3440('0x59'),_0x3440('0x5a'),_0x3440('0x5b'),_0x3440('0x5c'),_0x3440('0x5d'),'phonecall_activity_parties'];var _0x512377=[_0x3440('0x5e'),_0x3440('0x5f'),_0x3440('0x60'),_0x3440('0x61'),'contactidname','contactidyominame',_0x3440('0x62'),_0x3440('0x63'),_0x3440('0x64'),_0x3440('0x65'),_0x3440('0x66'),_0x3440('0x67'),_0x3440('0x68'),_0x3440('0x69'),'createdonbehalfbyyominame',_0x3440('0x6a'),_0x3440('0x6b'),'customeridyominame',_0x3440('0x6c'),_0x3440('0x6d'),'entityimage_timestamp',_0x3440('0x6e'),'escalatedon',_0x3440('0x6f'),_0x3440('0x70'),_0x3440('0x71'),'importsequencenumber',_0x3440('0x72'),_0x3440('0x73'),_0x3440('0x74'),_0x3440('0x75'),_0x3440('0x76'),_0x3440('0x77'),_0x3440('0x78'),_0x3440('0x79'),'modifiedon',_0x3440('0x7a'),_0x3440('0x7b'),_0x3440('0x7c'),_0x3440('0x7d'),_0x3440('0x7e'),'onholdtime','overriddencreatedon',_0x3440('0x7f'),_0x3440('0x80'),'owneridyominame',_0x3440('0x81'),_0x3440('0x82'),_0x3440('0x83'),_0x3440('0x84'),_0x3440('0x85'),_0x3440('0x86'),'resolveby','resolvebykpiidname',_0x3440('0x87'),'responsiblecontactidname',_0x3440('0x88'),_0x3440('0x89'),'slainvokedidname','slaname',_0x3440('0x8a'),_0x3440('0x8b'),_0x3440('0x8c'),'subjectidname','ticketnumber','timezoneruleversionnumber',_0x3440('0x8d'),_0x3440('0x8e'),_0x3440('0x8f'),_0x3440('0x90')];var _0x2ff471=_0x267099['concat'](_0x512377);return db[_0x3440('0x3f')][_0x3440('0x91')]({'where':{'id':_0x460fa7[_0x3440('0x3e')]['id']},'attributes':['id',_0x3440('0x92'),_0x3440('0x93'),_0x3440('0x94'),_0x3440('0x95'),_0x3440('0x96'),_0x3440('0x97')]})['then'](handleEntityNotFound(_0x34f9c4,null))[_0x3440('0x22')](function(_0x4e1cb8){if(_0x4e1cb8){_0x3b8ff9=_0x4e1cb8[_0x3440('0x94')];var _0xf518b9=_0x3b8ff9[_0x3440('0x98')](-0x1);if(_0xf518b9==='/'){_0x3b8ff9=_0x3b8ff9['substring'](0x0,_0x3b8ff9['lastIndexOf'](_0xf518b9));}_0x538924=util[_0x3440('0x99')](_0x3440('0x9a'),_0x3b8ff9);var _0x2109eb={'method':_0x3440('0x9b'),'uri':_0x3440('0x9c')+_0x4e1cb8[_0x3440('0x95')]+_0x3440('0x9d'),'form':{'client_id':_0x4e1cb8[_0x3440('0x96')],'resource':_0x3b8ff9,'username':_0x4e1cb8[_0x3440('0x92')],'password':_0x4e1cb8[_0x3440('0x93')],'grant_type':_0x3440('0x93'),'client_secret':_0x4e1cb8[_0x3440('0x97')]},'json':!![]};return rp(_0x2109eb);}})['then'](function(_0x57d18f){_0x46405b=_0x57d18f['access_token'];var _0x401f3a={'method':_0x3440('0x9e'),'uri':encodeURI(_0x538924+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x347af9+'\x27'),'headers':{'Authorization':_0x3440('0x9f')+_0x46405b,'If-None-Match':null,'OData-Version':_0x3440('0xa0')},'json':!![]};return rp(_0x401f3a);})['then'](function(_0x561dca){var _0x2e5c73=_0x561dca[_0x3440('0xa1')][0x0];var _0x19155a=_0x2e5c73[_0x3440('0xa2')];var _0x11e952={'method':_0x3440('0x9e'),'uri':_0x538924+'EntityDefinitions('+_0x19155a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x46405b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x11e952);})[_0x3440('0x22')](function(_0x459378){_0x3833d8=_0x459378;_0x75a903=_0x3833d8[_0x3440('0xa3')];_0x75a903=_[_0x3440('0xa4')](_0x75a903,function(_0x409a74){return!_0x2ff471[_0x3440('0xa5')](_0x409a74['LogicalName']);});var _0x5ca3b8=[];var _0x4d2d47=[];_0x75a903[_0x3440('0xa6')](function(_0x4d2320){if(_0x4d2320[_0x3440('0xa7')]){var _0x1d9cd5=_0x4d2320[_0x3440('0xa7')][_0x3440('0xa8')](_0x4d2320[_0x3440('0xa7')][_0x3440('0xa9')]('.')+0x1);if(_0x1d9cd5===_0x3440('0xaa')){_0x5ca3b8[_0x3440('0xab')](getSelectList(_0x538924,_0x33a147,_0x4d2d47,_0x3833d8[_0x3440('0xa2')],_0x4d2320['MetadataId'],_0x46405b));}}});return Promise[_0x3440('0xac')](_0x5ca3b8);})[_0x3440('0x22')](function(_0x353e38){_0x4833c2=_0x353e38[0x0];var _0x219b5a=[];var _0x2780d9=[];_0x75a903[_0x3440('0xa6')](function(_0x35e1fa){if(!_[_0x3440('0xad')](_0x35e1fa[_0x3440('0xa7')])){var _0x30aff7=_0x35e1fa['@odata.type'][_0x3440('0xa8')](_0x35e1fa['@odata.type'][_0x3440('0xa9')]('.')+0x1);if(_0x30aff7==='BooleanAttributeMetadata'){_0x219b5a['push'](getBooleanList(_0x538924,_0x33a147,_0x2780d9,_0x3833d8[_0x3440('0xa2')],_0x35e1fa[_0x3440('0xa2')],_0x46405b));}}});return Promise['all'](_0x219b5a);})[_0x3440('0x22')](function(_0x4c6840){_0x23cfb9=_0x4c6840[0x0];var _0x31c0ce=[];var _0x1223fd=[];_0x75a903[_0x3440('0xa6')](function(_0x286304){if(_0x286304['@odata.type']){var _0x4ad58a=_0x286304['@odata.type'][_0x3440('0xa8')](_0x286304[_0x3440('0xa7')][_0x3440('0xa9')]('.')+0x1);if(_0x4ad58a==='StringAttributeMetadata'||_0x4ad58a==='DoubleAttributeMetadata'||_0x4ad58a===_0x3440('0xae')||_0x4ad58a==='IntegerAttributeMetadata'||_0x4ad58a===_0x3440('0xaf')||_0x4ad58a==='DateTimeAttributeMetadata'||_0x4ad58a===_0x3440('0xb0')||_0x4ad58a===_0x3440('0xb1')||_0x4ad58a===_0x3440('0xb2')||_0x4ad58a==='DecimalAttributeMetadata'){_0x31c0ce[_0x3440('0xab')](getInputList(_0x538924,_0x33a147,_0x4ad58a,_0x1223fd,_0x3833d8['MetadataId'],_0x286304[_0x3440('0xa2')],_0x46405b));}}});return Promise[_0x3440('0xac')](_0x31c0ce);})[_0x3440('0x22')](function(_0xe53f35){_0x19dda6=_0xe53f35[0x0];var _0x291c28=_0x4833c2[_0x3440('0xb3')](_0x23cfb9)[_0x3440('0xb3')](_0x19dda6);var _0x35e239={'count':_0x291c28[_0x3440('0x2d')],'rows':_0x291c28};return _0x35e239;})[_0x3440('0x22')](respondWithResult(_0x34f9c4,null))['catch'](function(_0x549bd7){var _0x416ea3=_0x460fa7[_0x3440('0x28')][_0x3440('0xb4')]?0x1f4:_0x549bd7[_0x3440('0xb5')]||0x1f4;logger[_0x3440('0x23')](_0x549bd7[_0x3440('0xb6')]);delete _0x549bd7['name'];if(_0x416ea3===0x191){_0x416ea3=0x190;}_0x34f9c4[_0x3440('0x18')](_0x416ea3)[_0x3440('0x25')](_0x460fa7[_0x3440('0x28')][_0x3440('0xb4')]?{'message':_0x3440('0xb7'),'statusCode':_0x549bd7[_0x3440('0xb5')]}:_0x549bd7);});};function getSelectList(_0x233c9f,_0xc54920,_0x32ddf5,_0x5358d7,_0x1520af,_0x195992){var _0xf80fdb={'method':_0x3440('0x9e'),'uri':_0x233c9f+_0x3440('0xb8')+_0x5358d7+_0x3440('0xb9')+_0x1520af+_0x3440('0xba')+_0x3440('0xbb'),'headers':{'Authorization':_0x3440('0x9f')+_0x195992,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf80fdb)[_0x3440('0x22')](function(_0x406a1b){var _0x5b8c5b=[];var _0x3981ca=_0x406a1b[_0x3440('0xbc')][_0x3440('0xbd')];_0x3981ca[_0x3440('0xa6')](function(_0x3ec262){_0x5b8c5b['push']({'name':_0x3ec262['Label'][_0x3440('0xbe')][_0x3440('0xbf')],'value':String(_0x3ec262[_0x3440('0xc0')])});});var _0x2c0039={'id':_0xc54920+'_'+_0x406a1b[_0x3440('0xc1')],'name':_0x406a1b[_0x3440('0xc2')][_0x3440('0xbe')][_0x3440('0xbf')],'custom':![],'options':_0x5b8c5b};_0x32ddf5[_0x3440('0xab')](_0x2c0039);return _0x32ddf5;});}function getBooleanList(_0x37d1b6,_0x2dfa15,_0x164fdb,_0x39b878,_0x185494,_0x211b65){var _0x57deec={'method':_0x3440('0x9e'),'uri':_0x37d1b6+_0x3440('0xb8')+_0x39b878+_0x3440('0xb9')+_0x185494+_0x3440('0xc3'),'headers':{'Authorization':_0x3440('0x9f')+_0x211b65,'If-None-Match':null,'OData-Version':_0x3440('0xa0')},'json':!![]};return rp(_0x57deec)[_0x3440('0x22')](function(_0xa4a42a){var _0x495669=[];_0x495669[_0x3440('0xab')]({'name':_0xa4a42a[_0x3440('0xbc')][_0x3440('0xc4')][_0x3440('0xbf')][_0x3440('0xbe')][_0x3440('0xbf')],'value':'true'},{'name':_0xa4a42a['OptionSet'][_0x3440('0xc5')]['Label'][_0x3440('0xbe')][_0x3440('0xbf')],'value':'false'});var _0x20f208={'id':_0x2dfa15+'_'+_0xa4a42a[_0x3440('0xc1')],'name':_0xa4a42a[_0x3440('0xc2')]['UserLocalizedLabel'][_0x3440('0xbf')],'custom':![],'options':_0x495669};_0x164fdb[_0x3440('0xab')](_0x20f208);return _0x164fdb;});}function getInputList(_0x4434db,_0x2bacc7,_0x41eaf0,_0x5d8410,_0xb020c3,_0x2c7da1,_0x44e8da){var _0x196663={'method':_0x3440('0x9e'),'uri':_0x4434db+_0x3440('0xb8')+_0xb020c3+')/Attributes('+_0x2c7da1+_0x3440('0xc6')+_0x41eaf0+_0x3440('0xc7'),'headers':{'Authorization':_0x3440('0x9f')+_0x44e8da,'If-None-Match':null,'OData-Version':_0x3440('0xa0')},'json':!![]};return rp(_0x196663)[_0x3440('0x22')](function(_0x977dd2){var _0x367b3e={'id':_0x2bacc7+'_'+_0x977dd2[_0x3440('0xc1')],'name':_0x977dd2[_0x3440('0xc2')]['UserLocalizedLabel']?_0x977dd2['DisplayName'][_0x3440('0xbe')]['Label']:_0x977dd2[_0x3440('0xc1')],'custom':![],'options':[]};_0x5d8410['push'](_0x367b3e);return _0x5d8410;});} \ No newline at end of file +var _0x52b2=['modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','BooleanAttributeMetadata','all','StringAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','error','stack','send','index','map','Dynamics365Account','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','Descriptions','getFields','ticketType','PhoneCall','title','description','customerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname'];(function(_0x372454,_0x971c08){var _0x4226f4=function(_0x25580a){while(--_0x25580a){_0x372454['push'](_0x372454['shift']());}};_0x4226f4(++_0x971c08);}(_0x52b2,0x11e));var _0x252b=function(_0x271694,_0xe69a25){_0x271694=_0x271694-0x0;var _0x523181=_0x52b2[_0x271694];return _0x523181;};'use strict';var emlformat=require(_0x252b('0x0'));var rimraf=require(_0x252b('0x1'));var zipdir=require(_0x252b('0x2'));var jsonpatch=require(_0x252b('0x3'));var rp=require(_0x252b('0x4'));var moment=require(_0x252b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x252b('0x6'));var util=require(_0x252b('0x7'));var path=require(_0x252b('0x8'));var sox=require(_0x252b('0x9'));var csv=require(_0x252b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x252b('0xb'));var _=require(_0x252b('0xc'));var squel=require(_0x252b('0xd'));var crypto=require(_0x252b('0xe'));var jsforce=require(_0x252b('0xf'));var deskjs=require(_0x252b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x252b('0x11'));var Papa=require(_0x252b('0x12'));var Redis=require('ioredis');var authService=require(_0x252b('0x13'));var qs=require(_0x252b('0x14'));var as=require(_0x252b('0x15'));var hardwareService=require(_0x252b('0x16'));var logger=require(_0x252b('0x17'))(_0x252b('0x18'));var utils=require(_0x252b('0x19'));var config=require(_0x252b('0x1a'));var licenseUtil=require(_0x252b('0x1b'));var db=require(_0x252b('0x1c'))['db'];var integrations=require(_0x252b('0x1d'));function respondWithStatusCode(_0x533d67,_0x44bd30){_0x44bd30=_0x44bd30||0xcc;return function(_0x1833a3){if(_0x1833a3){return _0x533d67[_0x252b('0x1e')](_0x44bd30);}return _0x533d67[_0x252b('0x1f')](_0x44bd30)[_0x252b('0x20')]();};}function respondWithResult(_0x3cca58,_0x3f6ca1){_0x3f6ca1=_0x3f6ca1||0xc8;return function(_0x3b5a2a){if(_0x3b5a2a){return _0x3cca58[_0x252b('0x1f')](_0x3f6ca1)['json'](_0x3b5a2a);}};}function respondWithFilteredResult(_0x1f6a75,_0x2a6402){return function(_0x277751){if(_0x277751){var _0x3d3e46=typeof _0x2a6402['offset']==='undefined'&&typeof _0x2a6402[_0x252b('0x21')]==='undefined';var _0x1636b2=_0x277751[_0x252b('0x22')];var _0x15247b=_0x3d3e46?0x0:_0x2a6402[_0x252b('0x23')];var _0x2fcf48=_0x3d3e46?_0x277751['count']:_0x2a6402[_0x252b('0x23')]+_0x2a6402[_0x252b('0x21')];var _0xf18458;if(_0x2fcf48>=_0x1636b2){_0x2fcf48=_0x1636b2;_0xf18458=0xc8;}else{_0xf18458=0xce;}_0x1f6a75[_0x252b('0x1f')](_0xf18458);return _0x1f6a75[_0x252b('0x24')](_0x252b('0x25'),_0x15247b+'-'+_0x2fcf48+'/'+_0x1636b2)[_0x252b('0x26')](_0x277751);}return null;};}function patchUpdates(_0x10de53){return function(_0x3b95d7){try{jsonpatch['apply'](_0x3b95d7,_0x10de53,!![]);}catch(_0x26b707){return BPromise[_0x252b('0x27')](_0x26b707);}return _0x3b95d7[_0x252b('0x28')]();};}function saveUpdates(_0x46d0d8,_0x58384b){return function(_0x86a460){if(_0x86a460){return _0x86a460[_0x252b('0x29')](_0x46d0d8)['then'](function(_0x289d1a){return _0x289d1a;});}return null;};}function removeEntity(_0x1f5924,_0xf6da37){return function(_0x2cd272){if(_0x2cd272){return _0x2cd272[_0x252b('0x2a')]()['then'](function(){_0x1f5924[_0x252b('0x1f')](0xcc)[_0x252b('0x20')]();});}};}function handleEntityNotFound(_0x579931,_0x1db73c){return function(_0x359f5d){if(!_0x359f5d){_0x579931[_0x252b('0x1e')](0x194);}return _0x359f5d;};}function handleError(_0x26013c,_0x239b4a){_0x239b4a=_0x239b4a||0x1f4;return function(_0x37f011){logger[_0x252b('0x2b')](_0x37f011[_0x252b('0x2c')]);if(_0x37f011['name']){delete _0x37f011['name'];}_0x26013c[_0x252b('0x1f')](_0x239b4a)[_0x252b('0x2d')](_0x37f011);};}exports[_0x252b('0x2e')]=function(_0x1adf53,_0x3812c1){var _0x425060={},_0x3dfb5c={},_0x48bb0e={'count':0x0,'rows':[]};var _0x19b1d0=_[_0x252b('0x2f')](db[_0x252b('0x30')]['rawAttributes'],function(_0x5dc89f){return{'name':_0x5dc89f[_0x252b('0x31')],'type':_0x5dc89f[_0x252b('0x32')][_0x252b('0x33')]};});_0x3dfb5c[_0x252b('0x34')]=_['map'](_0x19b1d0,_0x252b('0x35'));_0x3dfb5c['query']=_[_0x252b('0x36')](_0x1adf53[_0x252b('0x37')]);_0x3dfb5c[_0x252b('0x38')]=_[_0x252b('0x39')](_0x3dfb5c[_0x252b('0x34')],_0x3dfb5c[_0x252b('0x37')]);_0x425060[_0x252b('0x3a')]=_[_0x252b('0x39')](_0x3dfb5c[_0x252b('0x34')],qs[_0x252b('0x3b')](_0x1adf53['query'][_0x252b('0x3b')]));_0x425060[_0x252b('0x3a')]=_0x425060['attributes'][_0x252b('0x3c')]?_0x425060[_0x252b('0x3a')]:_0x3dfb5c[_0x252b('0x34')];if(!_0x1adf53[_0x252b('0x37')][_0x252b('0x3d')](_0x252b('0x3e'))){_0x425060['limit']=qs['limit'](_0x1adf53[_0x252b('0x37')]['limit']);_0x425060[_0x252b('0x23')]=qs['offset'](_0x1adf53[_0x252b('0x37')]['offset']);}_0x425060[_0x252b('0x3f')]=qs[_0x252b('0x40')](_0x1adf53[_0x252b('0x37')][_0x252b('0x40')]);_0x425060[_0x252b('0x41')]=qs['filters'](_[_0x252b('0x42')](_0x1adf53[_0x252b('0x37')],_0x3dfb5c[_0x252b('0x38')]),_0x19b1d0);if(_0x1adf53['query'][_0x252b('0x43')]){_0x425060[_0x252b('0x41')]=_[_0x252b('0x44')](_0x425060[_0x252b('0x41')],{'$or':_[_0x252b('0x2f')](_0x19b1d0,function(_0xcef1b1){if(_0xcef1b1['type']!==_0x252b('0x45')){var _0x35f7a7={};_0x35f7a7[_0xcef1b1[_0x252b('0x35')]]={'$like':'%'+_0x1adf53[_0x252b('0x37')][_0x252b('0x43')]+'%'};return _0x35f7a7;}})});}_0x425060=_[_0x252b('0x44')]({},_0x425060,_0x1adf53[_0x252b('0x46')]);var _0x5f422b={'where':_0x425060[_0x252b('0x41')]};return db[_0x252b('0x30')][_0x252b('0x22')](_0x5f422b)[_0x252b('0x47')](function(_0x2162ca){_0x48bb0e['count']=_0x2162ca;if(_0x1adf53[_0x252b('0x37')]['includeAll']){_0x425060[_0x252b('0x48')]=[{'all':!![]}];}return db[_0x252b('0x30')][_0x252b('0x49')](_0x425060);})[_0x252b('0x47')](function(_0x3db4cb){_0x48bb0e[_0x252b('0x4a')]=_0x3db4cb;return _0x48bb0e;})[_0x252b('0x47')](respondWithFilteredResult(_0x3812c1,_0x425060))[_0x252b('0x4b')](handleError(_0x3812c1,null));};exports[_0x252b('0x4c')]=function(_0x78fb31,_0x56bc22){var _0x2c3397={'raw':![],'where':{'id':_0x78fb31[_0x252b('0x4d')]['id']}},_0x123b93={};_0x123b93[_0x252b('0x34')]=_[_0x252b('0x36')](db[_0x252b('0x30')][_0x252b('0x4e')]);_0x123b93[_0x252b('0x37')]=_['keys'](_0x78fb31['query']);_0x123b93[_0x252b('0x38')]=_[_0x252b('0x39')](_0x123b93[_0x252b('0x34')],_0x123b93[_0x252b('0x37')]);_0x2c3397[_0x252b('0x3a')]=_[_0x252b('0x39')](_0x123b93[_0x252b('0x34')],qs[_0x252b('0x3b')](_0x78fb31[_0x252b('0x37')]['fields']));_0x2c3397[_0x252b('0x3a')]=_0x2c3397[_0x252b('0x3a')][_0x252b('0x3c')]?_0x2c3397['attributes']:_0x123b93[_0x252b('0x34')];if(_0x78fb31[_0x252b('0x37')][_0x252b('0x4f')]){_0x2c3397['include']=[{'all':!![]}];}_0x2c3397=_[_0x252b('0x44')]({},_0x2c3397,_0x78fb31[_0x252b('0x46')]);return db[_0x252b('0x30')]['find'](_0x2c3397)[_0x252b('0x47')](handleEntityNotFound(_0x56bc22,null))[_0x252b('0x47')](respondWithResult(_0x56bc22,null))['catch'](handleError(_0x56bc22,null));};exports[_0x252b('0x50')]=function(_0x1451d7,_0x5cf7e2){return db['Dynamics365Account'][_0x252b('0x50')](_0x1451d7[_0x252b('0x51')],{})[_0x252b('0x47')](respondWithResult(_0x5cf7e2,0xc9))[_0x252b('0x4b')](handleError(_0x5cf7e2,null));};exports[_0x252b('0x29')]=function(_0xa3cef7,_0x444a7e){if(_0xa3cef7[_0x252b('0x51')]['id']){delete _0xa3cef7['body']['id'];}return db[_0x252b('0x30')]['find']({'where':{'id':_0xa3cef7[_0x252b('0x4d')]['id']}})[_0x252b('0x47')](handleEntityNotFound(_0x444a7e,null))[_0x252b('0x47')](saveUpdates(_0xa3cef7[_0x252b('0x51')],null))[_0x252b('0x47')](respondWithResult(_0x444a7e,null))[_0x252b('0x4b')](handleError(_0x444a7e,null));};exports[_0x252b('0x2a')]=function(_0x5726e7,_0x576a33){return db[_0x252b('0x30')]['find']({'where':{'id':_0x5726e7['params']['id']}})[_0x252b('0x47')](handleEntityNotFound(_0x576a33,null))['then'](removeEntity(_0x576a33,null))['catch'](handleError(_0x576a33,null));};exports[_0x252b('0x52')]=function(_0x1ac7d9,_0x51522e,_0x2ab3dd){var _0x1f05f3={};var _0x13a64f={};var _0x59d514;var _0x16a900;return db[_0x252b('0x30')][_0x252b('0x53')]({'where':{'id':_0x1ac7d9['params']['id']}})[_0x252b('0x47')](handleEntityNotFound(_0x51522e,null))[_0x252b('0x47')](function(_0xe2e9d8){if(_0xe2e9d8){_0x59d514=_0xe2e9d8;_0x13a64f[_0x252b('0x34')]=_[_0x252b('0x36')](db[_0x252b('0x54')]['rawAttributes']);_0x13a64f[_0x252b('0x37')]=_[_0x252b('0x36')](_0x1ac7d9[_0x252b('0x37')]);_0x13a64f['filters']=_[_0x252b('0x39')](_0x13a64f['model'],_0x13a64f['query']);_0x1f05f3[_0x252b('0x3a')]=_[_0x252b('0x39')](_0x13a64f[_0x252b('0x34')],qs[_0x252b('0x3b')](_0x1ac7d9[_0x252b('0x37')][_0x252b('0x3b')]));_0x1f05f3['attributes']=_0x1f05f3[_0x252b('0x3a')][_0x252b('0x3c')]?_0x1f05f3['attributes']:_0x13a64f[_0x252b('0x34')];_0x1f05f3[_0x252b('0x3f')]=qs[_0x252b('0x40')](_0x1ac7d9[_0x252b('0x37')][_0x252b('0x40')]);_0x1f05f3[_0x252b('0x41')]=qs[_0x252b('0x38')](_[_0x252b('0x42')](_0x1ac7d9['query'],_0x13a64f[_0x252b('0x38')]));if(_0x1ac7d9[_0x252b('0x37')][_0x252b('0x43')]){_0x1f05f3[_0x252b('0x41')]=_['merge'](_0x1f05f3[_0x252b('0x41')],{'$or':_[_0x252b('0x2f')](_0x1f05f3[_0x252b('0x3a')],function(_0x37ed00){var _0x586c99={};_0x586c99[_0x37ed00]={'$like':'%'+_0x1ac7d9[_0x252b('0x37')][_0x252b('0x43')]+'%'};return _0x586c99;})});}_0x1f05f3=_['merge']({},_0x1f05f3,_0x1ac7d9[_0x252b('0x46')]);return _0x59d514[_0x252b('0x52')](_0x1f05f3);}})[_0x252b('0x47')](function(_0x57ed36){if(_0x57ed36){_0x16a900=_0x57ed36[_0x252b('0x3c')];if(!_0x1ac7d9[_0x252b('0x37')][_0x252b('0x3d')](_0x252b('0x3e'))){_0x1f05f3[_0x252b('0x21')]=qs[_0x252b('0x21')](_0x1ac7d9[_0x252b('0x37')][_0x252b('0x21')]);_0x1f05f3[_0x252b('0x23')]=qs[_0x252b('0x23')](_0x1ac7d9['query'][_0x252b('0x23')]);}return _0x59d514[_0x252b('0x52')](_0x1f05f3);}})['then'](function(_0x1c6f6a){if(_0x1c6f6a){return _0x1c6f6a?{'count':_0x16a900,'rows':_0x1c6f6a}:null;}})['then'](respondWithResult(_0x51522e,null))[_0x252b('0x4b')](handleError(_0x51522e,null));};exports[_0x252b('0x55')]=function(_0x5ea1ad,_0x32b7f3,_0x15c6df){if(_0x5ea1ad[_0x252b('0x51')]['id']){delete _0x5ea1ad[_0x252b('0x51')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x5ea1ad[_0x252b('0x4d')]['id']}})[_0x252b('0x47')](handleEntityNotFound(_0x32b7f3,null))['then'](function(_0x513552){if(_0x513552){_0x5ea1ad[_0x252b('0x51')][_0x252b('0x56')]=_0x513552['id'];_0x5ea1ad[_0x252b('0x51')][_0x252b('0x57')]=integrations[_0x252b('0x58')](_0x5ea1ad[_0x252b('0x51')]['channel'],_0x5ea1ad[_0x252b('0x51')][_0x252b('0x32')]);_0x5ea1ad[_0x252b('0x51')]['Descriptions']=integrations[_0x252b('0x59')](_0x5ea1ad[_0x252b('0x51')][_0x252b('0x5a')],_0x5ea1ad['body']['type']);return db[_0x252b('0x54')][_0x252b('0x50')](_0x5ea1ad[_0x252b('0x51')],{'include':[{'model':db[_0x252b('0x5b')],'as':'Subjects'},{'model':db[_0x252b('0x5b')],'as':_0x252b('0x5c')}]});}return null;})[_0x252b('0x47')](respondWithResult(_0x32b7f3,null))[_0x252b('0x4b')](handleError(_0x32b7f3,null));};exports[_0x252b('0x5d')]=function(_0xec13e6,_0x351052,_0x219454){var _0x30d7de=_0xec13e6[_0x252b('0x37')][_0x252b('0x5e')];var _0x2635f1=_0x30d7de==='incident'?'Incident':_0x252b('0x5f');var _0x1c34cb='';var _0x256f30='';var _0x9ab726='';var _0x777882='';var _0x2abc22='';var _0x54ed42='';var _0x31e970='';var _0x506a3b='';var _0x50ac0c=[_0x252b('0x60'),_0x252b('0x61'),_0x252b('0x62'),'ownerid','caseorigincode',_0x252b('0x63'),'phonenumber',_0x252b('0x64'),_0x252b('0x65'),_0x252b('0x66')];var _0x256dfd=[_0x252b('0x67'),'accountidyominame',_0x252b('0x68'),_0x252b('0x69'),_0x252b('0x6a'),_0x252b('0x6b'),_0x252b('0x6c'),_0x252b('0x6d'),_0x252b('0x6e'),_0x252b('0x6f'),'createdbyname',_0x252b('0x70'),_0x252b('0x71'),'createdonbehalfbyname',_0x252b('0x72'),'customeridname',_0x252b('0x73'),_0x252b('0x74'),_0x252b('0x75'),_0x252b('0x76'),_0x252b('0x77'),_0x252b('0x78'),'escalatedon',_0x252b('0x79'),_0x252b('0x7a'),_0x252b('0x7b'),'importsequencenumber',_0x252b('0x7c'),_0x252b('0x7d'),'lastonholdtime','masteridname','modifiedbyexternalpartyname',_0x252b('0x7e'),'modifiedbyname',_0x252b('0x7f'),_0x252b('0x80'),_0x252b('0x81'),_0x252b('0x82'),_0x252b('0x83'),'msdyn_iotalertname',_0x252b('0x84'),_0x252b('0x85'),'overriddencreatedon',_0x252b('0x86'),_0x252b('0x87'),_0x252b('0x88'),_0x252b('0x89'),_0x252b('0x8a'),'primarycontactidyominame',_0x252b('0x8b'),_0x252b('0x8c'),_0x252b('0x8d'),_0x252b('0x8e'),_0x252b('0x8f'),_0x252b('0x90'),_0x252b('0x91'),'responsiblecontactidyominame',_0x252b('0x92'),_0x252b('0x93'),_0x252b('0x94'),_0x252b('0x95'),_0x252b('0x96'),_0x252b('0x97'),'subjectidname',_0x252b('0x98'),'timezoneruleversionnumber',_0x252b('0x99'),'traversedpath',_0x252b('0x9a'),_0x252b('0x9b')];var _0x58d441=_0x50ac0c[_0x252b('0x9c')](_0x256dfd);return db[_0x252b('0x30')][_0x252b('0x53')]({'where':{'id':_0xec13e6[_0x252b('0x4d')]['id']},'attributes':['id',_0x252b('0x9d'),_0x252b('0x9e'),'remoteUri','tenantId',_0x252b('0x9f'),_0x252b('0xa0')]})[_0x252b('0x47')](handleEntityNotFound(_0x351052,null))[_0x252b('0x47')](function(_0x2d114a){if(_0x2d114a){_0x506a3b=_0x2d114a[_0x252b('0xa1')];var _0x44e2d0=_0x506a3b[_0x252b('0xa2')](-0x1);if(_0x44e2d0==='/'){_0x506a3b=_0x506a3b[_0x252b('0xa3')](0x0,_0x506a3b[_0x252b('0xa4')](_0x44e2d0));}_0x31e970=util['format'](_0x252b('0xa5'),_0x506a3b);var _0x45382f={'method':_0x252b('0xa6'),'uri':'https://login.microsoftonline.com/'+_0x2d114a['tenantId']+'/oauth2/token','form':{'client_id':_0x2d114a[_0x252b('0x9f')],'resource':_0x506a3b,'username':_0x2d114a[_0x252b('0x9d')],'password':_0x2d114a['password'],'grant_type':'password','client_secret':_0x2d114a[_0x252b('0xa0')]},'json':!![]};return rp(_0x45382f);}})[_0x252b('0x47')](function(_0x375b02){_0x54ed42=_0x375b02[_0x252b('0xa7')];var _0x3f36ae={'method':_0x252b('0xa8'),'uri':encodeURI(_0x31e970+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2635f1+'\x27'),'headers':{'Authorization':_0x252b('0xa9')+_0x54ed42,'If-None-Match':null,'OData-Version':_0x252b('0xaa')},'json':!![]};return rp(_0x3f36ae);})[_0x252b('0x47')](function(_0x3b8a97){var _0x324d77=_0x3b8a97[_0x252b('0xab')][0x0];var _0x14a27d=_0x324d77[_0x252b('0xac')];var _0x26c0b4={'method':_0x252b('0xa8'),'uri':_0x31e970+_0x252b('0xad')+_0x14a27d+_0x252b('0xae'),'headers':{'Authorization':_0x252b('0xa9')+_0x54ed42,'If-None-Match':null,'OData-Version':_0x252b('0xaa')},'json':!![]};return rp(_0x26c0b4);})[_0x252b('0x47')](function(_0x282229){_0x1c34cb=_0x282229;_0x256f30=_0x1c34cb[_0x252b('0xaf')];_0x256f30=_[_0x252b('0xb0')](_0x256f30,function(_0x4df2cb){return!_0x58d441['includes'](_0x4df2cb[_0x252b('0xb1')]);});var _0x31e679=[];var _0x180590=[];_0x256f30[_0x252b('0xb2')](function(_0x5114bd){if(_0x5114bd[_0x252b('0xb3')]){var _0x1c24ad=_0x5114bd[_0x252b('0xb3')]['substring'](_0x5114bd['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1c24ad===_0x252b('0xb4')){_0x31e679[_0x252b('0xb5')](getSelectList(_0x31e970,_0x30d7de,_0x180590,_0x1c34cb['MetadataId'],_0x5114bd['MetadataId'],_0x54ed42));}}});return Promise['all'](_0x31e679);})[_0x252b('0x47')](function(_0x54b4ee){_0x9ab726=_0x54b4ee[0x0];var _0x401ea5=[];var _0x5721da=[];_0x256f30['forEach'](function(_0x5b561e){if(!_['isNil'](_0x5b561e['@odata.type'])){var _0x471875=_0x5b561e[_0x252b('0xb3')]['substring'](_0x5b561e[_0x252b('0xb3')][_0x252b('0xa4')]('.')+0x1);if(_0x471875===_0x252b('0xb6')){_0x401ea5['push'](getBooleanList(_0x31e970,_0x30d7de,_0x5721da,_0x1c34cb[_0x252b('0xac')],_0x5b561e['MetadataId'],_0x54ed42));}}});return Promise[_0x252b('0xb7')](_0x401ea5);})[_0x252b('0x47')](function(_0x4896eb){_0x777882=_0x4896eb[0x0];var _0x22b1d1=[];var _0xdda5b=[];_0x256f30['forEach'](function(_0x4fa05b){if(_0x4fa05b[_0x252b('0xb3')]){var _0x56e6ea=_0x4fa05b[_0x252b('0xb3')][_0x252b('0xa3')](_0x4fa05b[_0x252b('0xb3')][_0x252b('0xa4')]('.')+0x1);if(_0x56e6ea===_0x252b('0xb8')||_0x56e6ea==='DoubleAttributeMetadata'||_0x56e6ea===_0x252b('0xb9')||_0x56e6ea==='IntegerAttributeMetadata'||_0x56e6ea==='MemoAttributeMetadata'||_0x56e6ea===_0x252b('0xba')||_0x56e6ea==='StatusAttributeMetadata'||_0x56e6ea===_0x252b('0xbb')||_0x56e6ea===_0x252b('0xbc')||_0x56e6ea===_0x252b('0xbd')){_0x22b1d1[_0x252b('0xb5')](getInputList(_0x31e970,_0x30d7de,_0x56e6ea,_0xdda5b,_0x1c34cb[_0x252b('0xac')],_0x4fa05b[_0x252b('0xac')],_0x54ed42));}}});return Promise['all'](_0x22b1d1);})[_0x252b('0x47')](function(_0x301093){_0x2abc22=_0x301093[0x0];var _0x55fcc4=_0x9ab726[_0x252b('0x9c')](_0x777882)[_0x252b('0x9c')](_0x2abc22);var _0x213ed6={'count':_0x55fcc4[_0x252b('0x3c')],'rows':_0x55fcc4};return _0x213ed6;})[_0x252b('0x47')](respondWithResult(_0x351052,null))[_0x252b('0x4b')](function(_0xaeae08){var _0x2bf6e0=_0xec13e6[_0x252b('0x37')][_0x252b('0xbe')]?0x1f4:_0xaeae08[_0x252b('0xbf')]||0x1f4;logger['error'](_0xaeae08[_0x252b('0x2c')]);delete _0xaeae08[_0x252b('0x35')];if(_0x2bf6e0===0x191){_0x2bf6e0=0x190;}_0x351052[_0x252b('0x1f')](_0x2bf6e0)[_0x252b('0x2d')](_0xec13e6[_0x252b('0x37')][_0x252b('0xbe')]?{'message':'Wrong\x20credentials','statusCode':_0xaeae08[_0x252b('0xbf')]}:_0xaeae08);});};function getSelectList(_0x5db2fa,_0x40b3a0,_0x39c1df,_0x1aa60c,_0x334075,_0x4e23e5){var _0x2789ae={'method':_0x252b('0xa8'),'uri':_0x5db2fa+_0x252b('0xad')+_0x1aa60c+')/Attributes('+_0x334075+_0x252b('0xc0')+_0x252b('0xc1'),'headers':{'Authorization':_0x252b('0xa9')+_0x4e23e5,'If-None-Match':null,'OData-Version':_0x252b('0xaa')},'json':!![]};return rp(_0x2789ae)['then'](function(_0x134f59){var _0x34fe59=[];var _0x32d230=_0x134f59[_0x252b('0xc2')]['Options'];_0x32d230[_0x252b('0xb2')](function(_0x9336bd){_0x34fe59[_0x252b('0xb5')]({'name':_0x9336bd[_0x252b('0xc3')][_0x252b('0xc4')][_0x252b('0xc3')],'value':String(_0x9336bd[_0x252b('0xc5')])});});var _0x244079={'id':_0x40b3a0+'_'+_0x134f59[_0x252b('0xb1')],'name':_0x134f59['DisplayName'][_0x252b('0xc4')][_0x252b('0xc3')],'custom':![],'options':_0x34fe59};_0x39c1df[_0x252b('0xb5')](_0x244079);return _0x39c1df;});}function getBooleanList(_0x4d8e56,_0x2abe87,_0x2d4551,_0x10bf87,_0x410bb3,_0x6eeef7){var _0x18a582={'method':_0x252b('0xa8'),'uri':_0x4d8e56+_0x252b('0xad')+_0x10bf87+_0x252b('0xc6')+_0x410bb3+_0x252b('0xc7'),'headers':{'Authorization':_0x252b('0xa9')+_0x6eeef7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18a582)[_0x252b('0x47')](function(_0x1cafd4){var _0x44e3f5=[];_0x44e3f5[_0x252b('0xb5')]({'name':_0x1cafd4[_0x252b('0xc2')][_0x252b('0xc8')][_0x252b('0xc3')][_0x252b('0xc4')][_0x252b('0xc3')],'value':_0x252b('0xc9')},{'name':_0x1cafd4[_0x252b('0xc2')][_0x252b('0xca')][_0x252b('0xc3')][_0x252b('0xc4')][_0x252b('0xc3')],'value':_0x252b('0xcb')});var _0x339735={'id':_0x2abe87+'_'+_0x1cafd4[_0x252b('0xb1')],'name':_0x1cafd4[_0x252b('0xcc')][_0x252b('0xc4')]['Label'],'custom':![],'options':_0x44e3f5};_0x2d4551[_0x252b('0xb5')](_0x339735);return _0x2d4551;});}function getInputList(_0x1f81f1,_0x186117,_0x115cdd,_0x50052d,_0x62e926,_0x33d2e9,_0x2abb60){var _0x2e554d={'method':'GET','uri':_0x1f81f1+_0x252b('0xad')+_0x62e926+_0x252b('0xc6')+_0x33d2e9+')/Microsoft.Dynamics.CRM.'+_0x115cdd+_0x252b('0xcd'),'headers':{'Authorization':_0x252b('0xa9')+_0x2abb60,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e554d)[_0x252b('0x47')](function(_0x52e2f0){var _0x1c2a12={'id':_0x186117+'_'+_0x52e2f0['LogicalName'],'name':_0x52e2f0[_0x252b('0xcc')][_0x252b('0xc4')]?_0x52e2f0[_0x252b('0xcc')][_0x252b('0xc4')][_0x252b('0xc3')]:_0x52e2f0[_0x252b('0xb1')],'custom':![],'options':[]};_0x50052d['push'](_0x1c2a12);return _0x50052d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index ec1b0b3..5f94831 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x3d36df,_0x35d4f9){var _0x182668=function(_0x1b0405){while(--_0x1b0405){_0x3d36df['push'](_0x3d36df['shift']());}};_0x182668(++_0x35d4f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0xcb91[_0x1f83a5];return _0x45edf0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x49eda8,_0x139f5d){var _0x3acd32=function(_0x531c78){while(--_0x531c78){_0x49eda8['push'](_0x49eda8['shift']());}};_0x3acd32(++_0x139f5d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9db0be2..c50e02c 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 _0x700f=['find','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','attributes','include','map','model','ShowDynamics365Account'];(function(_0x3011d3,_0x2643cc){var _0x50c65e=function(_0x4d51c4){while(--_0x4d51c4){_0x3011d3['push'](_0x3011d3['shift']());}};_0x50c65e(++_0x2643cc);}(_0x700f,0xf1));var _0xf700=function(_0x2e4901,_0x271b7e){_0x2e4901=_0x2e4901-0x0;var _0x34211e=_0x700f[_0x2e4901];return _0x34211e;};'use strict';var _=require(_0xf700('0x0'));var util=require('util');var moment=require(_0xf700('0x1'));var BPromise=require(_0xf700('0x2'));var rs=require(_0xf700('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf700('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf700('0x5'))(_0xf700('0x6'));var config=require(_0xf700('0x7'));var jayson=require(_0xf700('0x8'));var client=jayson['client'][_0xf700('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a9261,_0xd129a0,_0x1653ff){return new BPromise(function(_0x590335,_0x52a2c6){return client[_0xf700('0xa')](_0x1a9261,_0x1653ff)[_0xf700('0xb')](function(_0x16f391){logger[_0xf700('0xc')](_0xf700('0xd'),_0xd129a0,_0xf700('0xe'));logger[_0xf700('0xf')](_0xf700('0x10'),_0xd129a0,'request\x20sent',JSON[_0xf700('0x11')](_0x16f391));if(_0x16f391['error']){if(_0x16f391[_0xf700('0x12')][_0xf700('0x13')]===0x1f4){logger[_0xf700('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0xd129a0,_0x16f391[_0xf700('0x12')][_0xf700('0x14')]);return _0x52a2c6(_0x16f391['error'][_0xf700('0x14')]);}logger[_0xf700('0x12')](_0xf700('0xd'),_0xd129a0,_0x16f391['error']['message']);return _0x590335(_0x16f391['error'][_0xf700('0x14')]);}else{logger[_0xf700('0xc')](_0xf700('0xd'),_0xd129a0,'request\x20sent');_0x590335(_0x16f391[_0xf700('0x15')][_0xf700('0x14')]);}})[_0xf700('0x16')](function(_0x76689f){logger[_0xf700('0x12')](_0xf700('0xd'),_0xd129a0,_0x76689f);_0x52a2c6(_0x76689f);});});}exports[_0xf700('0x17')]=function(_0x206967){var _0x2393fd=this;return new Promise(function(_0x54cb5c,_0x135fb2){return db[_0xf700('0x18')]['findAll']({'raw':_0x206967['options']?_0x206967['options']['raw']===undefined?!![]:![]:!![],'where':_0x206967[_0xf700('0x19')]?_0x206967[_0xf700('0x19')]['where']||null:null,'attributes':_0x206967[_0xf700('0x19')]?_0x206967[_0xf700('0x19')][_0xf700('0x1a')]||null:null,'limit':_0x206967[_0xf700('0x19')]?_0x206967[_0xf700('0x19')]['limit']||null:null,'include':_0x206967[_0xf700('0x19')]?_0x206967[_0xf700('0x19')][_0xf700('0x1b')]?_[_0xf700('0x1c')](_0x206967[_0xf700('0x19')][_0xf700('0x1b')],function(_0x563a18){return{'model':db[_0x563a18[_0xf700('0x1d')]],'as':_0x563a18['as'],'attributes':_0x563a18[_0xf700('0x1a')],'include':_0x563a18[_0xf700('0x1b')]?_[_0xf700('0x1c')](_0x563a18[_0xf700('0x1b')],function(_0x4e68b2){return{'model':db[_0x4e68b2[_0xf700('0x1d')]],'as':_0x4e68b2['as'],'attributes':_0x4e68b2['attributes'],'include':_0x4e68b2[_0xf700('0x1b')]?_[_0xf700('0x1c')](_0x4e68b2[_0xf700('0x1b')],function(_0x5891c3){return{'model':db[_0x5891c3[_0xf700('0x1d')]],'as':_0x5891c3['as'],'attributes':_0x5891c3[_0xf700('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf700('0xb')](function(_0x5a99fa){logger[_0xf700('0xc')](_0xf700('0x17'),_0x206967);logger['debug'](_0xf700('0x17'),_0x206967,JSON[_0xf700('0x11')](_0x5a99fa));_0x54cb5c(_0x5a99fa);})[_0xf700('0x16')](function(_0x1d9b50){logger[_0xf700('0x12')]('GetDynamics365Account',_0x1d9b50['message'],_0x206967);_0x135fb2(_0x2393fd[_0xf700('0x12')](0x1f4,_0x1d9b50[_0xf700('0x14')]));});});};exports[_0xf700('0x1e')]=function(_0x576c25){var _0x4d6e0f=this;return new Promise(function(_0x74efff,_0x540cb7){return db[_0xf700('0x18')][_0xf700('0x1f')]({'raw':_0x576c25[_0xf700('0x19')]?_0x576c25[_0xf700('0x19')][_0xf700('0x20')]===undefined?!![]:![]:!![],'where':_0x576c25['options']?_0x576c25[_0xf700('0x19')][_0xf700('0x21')]||null:null,'attributes':_0x576c25[_0xf700('0x19')]?_0x576c25[_0xf700('0x19')]['attributes']||null:null,'include':_0x576c25[_0xf700('0x19')]?_0x576c25['options']['include']?_[_0xf700('0x1c')](_0x576c25[_0xf700('0x19')]['include'],function(_0x551baf){return{'model':db[_0x551baf['model']],'as':_0x551baf['as'],'attributes':_0x551baf[_0xf700('0x1a')],'include':_0x551baf['include']?_[_0xf700('0x1c')](_0x551baf['include'],function(_0x5985ff){return{'model':db[_0x5985ff['model']],'as':_0x5985ff['as'],'attributes':_0x5985ff[_0xf700('0x1a')],'include':_0x5985ff[_0xf700('0x1b')]?_[_0xf700('0x1c')](_0x5985ff['include'],function(_0x42d80e){return{'model':db[_0x42d80e[_0xf700('0x1d')]],'as':_0x42d80e['as'],'attributes':_0x42d80e[_0xf700('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4137e8){logger[_0xf700('0xc')](_0xf700('0x1e'),_0x576c25);logger[_0xf700('0xf')]('ShowDynamics365Account',_0x576c25,JSON['stringify'](_0x4137e8));_0x74efff(_0x4137e8);})[_0xf700('0x16')](function(_0x4276b0){logger[_0xf700('0x12')]('ShowDynamics365Account',_0x4276b0['message'],_0x576c25);_0x540cb7(_0x4d6e0f[_0xf700('0x12')](0x1f4,_0x4276b0[_0xf700('0x14')]));});});}; \ No newline at end of file +var _0xc5fd=['stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','options','raw','attributes','limit','map','include','model','then','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x114dbf,_0x3dd101){var _0x5953c9=function(_0x39aeb0){while(--_0x39aeb0){_0x114dbf['push'](_0x114dbf['shift']());}};_0x5953c9(++_0x3dd101);}(_0xc5fd,0x1cb));var _0xdc5f=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0xc5fd[_0x28c939];return _0x527fe9;};'use strict';var _=require('lodash');var util=require(_0xdc5f('0x0'));var moment=require(_0xdc5f('0x1'));var BPromise=require(_0xdc5f('0x2'));var rs=require(_0xdc5f('0x3'));var fs=require('fs');var Redis=require(_0xdc5f('0x4'));var db=require(_0xdc5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc5f('0x6'))(_0xdc5f('0x7'));var config=require(_0xdc5f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdc5f('0x9')][_0xdc5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cd260,_0x4e0102,_0x2e7f11){return new BPromise(function(_0x2bc019,_0x5bb228){return client[_0xdc5f('0xb')](_0x5cd260,_0x2e7f11)['then'](function(_0x56e742){logger[_0xdc5f('0xc')](_0xdc5f('0xd'),_0x4e0102,_0xdc5f('0xe'));logger[_0xdc5f('0xf')](_0xdc5f('0x10'),_0x4e0102,'request\x20sent',JSON[_0xdc5f('0x11')](_0x56e742));if(_0x56e742[_0xdc5f('0x12')]){if(_0x56e742['error'][_0xdc5f('0x13')]===0x1f4){logger[_0xdc5f('0x12')](_0xdc5f('0xd'),_0x4e0102,_0x56e742[_0xdc5f('0x12')]['message']);return _0x5bb228(_0x56e742[_0xdc5f('0x12')][_0xdc5f('0x14')]);}logger[_0xdc5f('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x4e0102,_0x56e742[_0xdc5f('0x12')][_0xdc5f('0x14')]);return _0x2bc019(_0x56e742['error'][_0xdc5f('0x14')]);}else{logger['info'](_0xdc5f('0xd'),_0x4e0102,'request\x20sent');_0x2bc019(_0x56e742[_0xdc5f('0x15')][_0xdc5f('0x14')]);}})['catch'](function(_0x115e4f){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4e0102,_0x115e4f);_0x5bb228(_0x115e4f);});});}exports[_0xdc5f('0x16')]=function(_0x46c5ba){var _0x3c96f1=this;return new Promise(function(_0x241e9b,_0x3517d3){return db[_0xdc5f('0x17')]['findAll']({'raw':_0x46c5ba[_0xdc5f('0x18')]?_0x46c5ba[_0xdc5f('0x18')][_0xdc5f('0x19')]===undefined?!![]:![]:!![],'where':_0x46c5ba[_0xdc5f('0x18')]?_0x46c5ba[_0xdc5f('0x18')]['where']||null:null,'attributes':_0x46c5ba[_0xdc5f('0x18')]?_0x46c5ba[_0xdc5f('0x18')][_0xdc5f('0x1a')]||null:null,'limit':_0x46c5ba[_0xdc5f('0x18')]?_0x46c5ba['options'][_0xdc5f('0x1b')]||null:null,'include':_0x46c5ba[_0xdc5f('0x18')]?_0x46c5ba[_0xdc5f('0x18')]['include']?_[_0xdc5f('0x1c')](_0x46c5ba[_0xdc5f('0x18')][_0xdc5f('0x1d')],function(_0x54aa8b){return{'model':db[_0x54aa8b[_0xdc5f('0x1e')]],'as':_0x54aa8b['as'],'attributes':_0x54aa8b[_0xdc5f('0x1a')],'include':_0x54aa8b['include']?_[_0xdc5f('0x1c')](_0x54aa8b[_0xdc5f('0x1d')],function(_0x31d5d4){return{'model':db[_0x31d5d4[_0xdc5f('0x1e')]],'as':_0x31d5d4['as'],'attributes':_0x31d5d4['attributes'],'include':_0x31d5d4[_0xdc5f('0x1d')]?_[_0xdc5f('0x1c')](_0x31d5d4[_0xdc5f('0x1d')],function(_0x2cb74f){return{'model':db[_0x2cb74f[_0xdc5f('0x1e')]],'as':_0x2cb74f['as'],'attributes':_0x2cb74f[_0xdc5f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdc5f('0x1f')](function(_0x51f63b){logger['info'](_0xdc5f('0x16'),_0x46c5ba);logger[_0xdc5f('0xf')]('GetDynamics365Account',_0x46c5ba,JSON[_0xdc5f('0x11')](_0x51f63b));_0x241e9b(_0x51f63b);})['catch'](function(_0x20c180){logger[_0xdc5f('0x12')](_0xdc5f('0x16'),_0x20c180[_0xdc5f('0x14')],_0x46c5ba);_0x3517d3(_0x3c96f1['error'](0x1f4,_0x20c180[_0xdc5f('0x14')]));});});};exports[_0xdc5f('0x20')]=function(_0x2c77eb){var _0x20229c=this;return new Promise(function(_0x1cf5c2,_0xaf257d){return db[_0xdc5f('0x17')][_0xdc5f('0x21')]({'raw':_0x2c77eb[_0xdc5f('0x18')]?_0x2c77eb[_0xdc5f('0x18')][_0xdc5f('0x19')]===undefined?!![]:![]:!![],'where':_0x2c77eb['options']?_0x2c77eb[_0xdc5f('0x18')]['where']||null:null,'attributes':_0x2c77eb[_0xdc5f('0x18')]?_0x2c77eb[_0xdc5f('0x18')][_0xdc5f('0x1a')]||null:null,'include':_0x2c77eb['options']?_0x2c77eb['options'][_0xdc5f('0x1d')]?_[_0xdc5f('0x1c')](_0x2c77eb[_0xdc5f('0x18')][_0xdc5f('0x1d')],function(_0x45a6fa){return{'model':db[_0x45a6fa['model']],'as':_0x45a6fa['as'],'attributes':_0x45a6fa['attributes'],'include':_0x45a6fa[_0xdc5f('0x1d')]?_[_0xdc5f('0x1c')](_0x45a6fa[_0xdc5f('0x1d')],function(_0x3d2194){return{'model':db[_0x3d2194[_0xdc5f('0x1e')]],'as':_0x3d2194['as'],'attributes':_0x3d2194[_0xdc5f('0x1a')],'include':_0x3d2194['include']?_['map'](_0x3d2194[_0xdc5f('0x1d')],function(_0x47ce9e){return{'model':db[_0x47ce9e[_0xdc5f('0x1e')]],'as':_0x47ce9e['as'],'attributes':_0x47ce9e[_0xdc5f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13a43c){logger[_0xdc5f('0xc')](_0xdc5f('0x20'),_0x2c77eb);logger[_0xdc5f('0xf')](_0xdc5f('0x20'),_0x2c77eb,JSON[_0xdc5f('0x11')](_0x13a43c));_0x1cf5c2(_0x13a43c);})['catch'](function(_0x2a0356){logger['error'](_0xdc5f('0x20'),_0x2a0356[_0xdc5f('0x14')],_0x2c77eb);_0xaf257d(_0x20229c[_0xdc5f('0x12')](0x1f4,_0x2a0356['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7842f67..5673fcb 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 _0xd509=['exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','/:id','destroy'];(function(_0x5cb642,_0x118e79){var _0x59df7f=function(_0x13bcf9){while(--_0x13bcf9){_0x5cb642['push'](_0x5cb642['shift']());}};_0x59df7f(++_0x118e79);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d50('0x0'));var timeout=require(_0x9d50('0x1'));var express=require(_0x9d50('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9d50('0x3'));var interaction=require(_0x9d50('0x4'));var config=require('../../config/environment');var controller=require(_0x9d50('0x5'));router[_0x9d50('0x6')]('/',auth[_0x9d50('0x7')](),controller['index']);router[_0x9d50('0x6')]('/:id',auth[_0x9d50('0x7')](),controller[_0x9d50('0x8')]);router[_0x9d50('0x6')](_0x9d50('0x9'),auth[_0x9d50('0x7')](),controller['getFields']);router[_0x9d50('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x9d50('0xa')]);router['get'](_0x9d50('0xb'),auth[_0x9d50('0x7')](),controller[_0x9d50('0xc')]);router[_0x9d50('0xd')]('/',auth[_0x9d50('0x7')](),controller[_0x9d50('0xe')]);router[_0x9d50('0xf')]('/:id',auth[_0x9d50('0x7')](),controller['update']);router[_0x9d50('0x10')](_0x9d50('0x11'),auth[_0x9d50('0x7')](),controller[_0x9d50('0x12')]);module[_0x9d50('0x13')]=router; \ No newline at end of file +var _0x9845=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','destroy','multer'];(function(_0x14a31b,_0x1481f3){var _0x15ac07=function(_0x312309){while(--_0x312309){_0x14a31b['push'](_0x14a31b['shift']());}};_0x15ac07(++_0x1481f3);}(_0x9845,0x1e2));var _0x5984=function(_0x5a39c3,_0x7fa035){_0x5a39c3=_0x5a39c3-0x0;var _0x366141=_0x9845[_0x5a39c3];return _0x366141;};'use strict';var multer=require(_0x5984('0x0'));var util=require(_0x5984('0x1'));var path=require('path');var timeout=require(_0x5984('0x2'));var express=require(_0x5984('0x3'));var router=express[_0x5984('0x4')]();var fs_extra=require(_0x5984('0x5'));var auth=require(_0x5984('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5984('0x7'));var controller=require(_0x5984('0x8'));router[_0x5984('0x9')]('/',auth[_0x5984('0xa')](),controller[_0x5984('0xb')]);router['get'](_0x5984('0xc'),auth[_0x5984('0xa')](),controller[_0x5984('0xd')]);router[_0x5984('0x9')](_0x5984('0xe'),auth['isAuthenticated'](),controller[_0x5984('0xf')]);router[_0x5984('0x9')](_0x5984('0x10'),auth[_0x5984('0xa')](),controller['getSubjects']);router[_0x5984('0x9')](_0x5984('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5984('0x12')]('/',auth['isAuthenticated'](),controller[_0x5984('0x13')]);router[_0x5984('0x14')](_0x5984('0xc'),auth['isAuthenticated'](),controller[_0x5984('0x15')]);router['delete'](_0x5984('0xc'),auth[_0x5984('0xa')](),controller[_0x5984('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 7216a21..8d37841 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 _0xc5ec=['incident','sequelize','STRING','phonecall'];(function(_0x24c914,_0x29257c){var _0x5af158=function(_0x5d06a7){while(--_0x5d06a7){_0x24c914['push'](_0x24c914['shift']());}};_0x5af158(++_0x29257c);}(_0xc5ec,0x179));var _0xcc5e=function(_0x39dbf1,_0x549c62){_0x39dbf1=_0x39dbf1-0x0;var _0x4088b9=_0xc5ec[_0x39dbf1];return _0x4088b9;};'use strict';var Sequelize=require(_0xcc5e('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc5e('0x1')]},'description':{'type':Sequelize[_0xcc5e('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0xcc5e('0x2')),'defaultValue':_0xcc5e('0x3')}}; \ No newline at end of file +var _0x0d98=['incident','sequelize','exports','STRING','ENUM'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x0d98,0xf1));var _0x80d9=function(_0x51a824,_0x3a1d55){_0x51a824=_0x51a824-0x0;var _0x3edf35=_0x0d98[_0x51a824];return _0x3edf35;};'use strict';var Sequelize=require(_0x80d9('0x0'));module[_0x80d9('0x1')]={'name':{'type':Sequelize[_0x80d9('0x2')]},'description':{'type':Sequelize[_0x80d9('0x2')]},'ticketType':{'type':Sequelize[_0x80d9('0x3')](_0x80d9('0x4'),'phonecall'),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a3ee638..bfe863b 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 _0xb2ec=['../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','VIRTUAL','merge','rows','catch','includeAll','include','options','find','create','body','params','findOne','Dynamics365Field','sort','getSubjects','getDescriptions','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xb2ec,0x11d));var _0xcb2e=function(_0x511399,_0x2318d6){_0x511399=_0x511399-0x0;var _0x232221=_0xb2ec[_0x511399];return _0x232221;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb2e('0x0'));var rp=require('request-promise');var moment=require(_0xcb2e('0x1'));var BPromise=require(_0xcb2e('0x2'));var Mustache=require(_0xcb2e('0x3'));var util=require('util');var path=require(_0xcb2e('0x4'));var sox=require(_0xcb2e('0x5'));var csv=require('to-csv');var ejs=require(_0xcb2e('0x6'));var fs=require('fs');var fs_extra=require(_0xcb2e('0x7'));var _=require('lodash');var squel=require(_0xcb2e('0x8'));var crypto=require(_0xcb2e('0x9'));var jsforce=require(_0xcb2e('0xa'));var deskjs=require(_0xcb2e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcb2e('0xc'));var Papa=require(_0xcb2e('0xd'));var Redis=require(_0xcb2e('0xe'));var authService=require(_0xcb2e('0xf'));var qs=require(_0xcb2e('0x10'));var as=require(_0xcb2e('0x11'));var hardwareService=require(_0xcb2e('0x12'));var logger=require(_0xcb2e('0x13'))('api');var utils=require(_0xcb2e('0x14'));var config=require(_0xcb2e('0x15'));var licenseUtil=require(_0xcb2e('0x16'));var db=require(_0xcb2e('0x17'))['db'];function respondWithStatusCode(_0x423e3b,_0x4df8c7){_0x4df8c7=_0x4df8c7||0xcc;return function(_0x59db10){if(_0x59db10){return _0x423e3b['sendStatus'](_0x4df8c7);}return _0x423e3b['status'](_0x4df8c7)[_0xcb2e('0x18')]();};}function respondWithResult(_0x3c8b50,_0x5d2735){_0x5d2735=_0x5d2735||0xc8;return function(_0x143210){if(_0x143210){return _0x3c8b50[_0xcb2e('0x19')](_0x5d2735)[_0xcb2e('0x1a')](_0x143210);}};}function respondWithFilteredResult(_0x54209e,_0x59f4cd){return function(_0x28cf0f){if(_0x28cf0f){var _0x76c469=typeof _0x59f4cd[_0xcb2e('0x1b')]==='undefined'&&typeof _0x59f4cd[_0xcb2e('0x1c')]===_0xcb2e('0x1d');var _0x409412=_0x28cf0f[_0xcb2e('0x1e')];var _0x23c6bc=_0x76c469?0x0:_0x59f4cd[_0xcb2e('0x1b')];var _0x49a1e4=_0x76c469?_0x28cf0f[_0xcb2e('0x1e')]:_0x59f4cd[_0xcb2e('0x1b')]+_0x59f4cd[_0xcb2e('0x1c')];var _0x3e697e;if(_0x49a1e4>=_0x409412){_0x49a1e4=_0x409412;_0x3e697e=0xc8;}else{_0x3e697e=0xce;}_0x54209e['status'](_0x3e697e);return _0x54209e[_0xcb2e('0x1f')](_0xcb2e('0x20'),_0x23c6bc+'-'+_0x49a1e4+'/'+_0x409412)['json'](_0x28cf0f);}return null;};}function patchUpdates(_0x4cb23f){return function(_0x48ddfc){try{jsonpatch['apply'](_0x48ddfc,_0x4cb23f,!![]);}catch(_0x258a93){return BPromise[_0xcb2e('0x21')](_0x258a93);}return _0x48ddfc[_0xcb2e('0x22')]();};}function saveUpdates(_0x5db9e4,_0x44ac59){return function(_0x4f4bfb){if(_0x4f4bfb){return _0x4f4bfb[_0xcb2e('0x23')](_0x5db9e4)[_0xcb2e('0x24')](function(_0x1ac090){return _0x1ac090;});}return null;};}function removeEntity(_0x4b0b95,_0x3a5f57){return function(_0x1932aa){if(_0x1932aa){return _0x1932aa[_0xcb2e('0x25')]()['then'](function(){_0x4b0b95['status'](0xcc)[_0xcb2e('0x18')]();});}};}function handleEntityNotFound(_0x5679d8,_0x5834a5){return function(_0x5529f6){if(!_0x5529f6){_0x5679d8['sendStatus'](0x194);}return _0x5529f6;};}function handleError(_0x2d7813,_0x4dffd5){_0x4dffd5=_0x4dffd5||0x1f4;return function(_0x1254e8){logger['error'](_0x1254e8[_0xcb2e('0x26')]);if(_0x1254e8[_0xcb2e('0x27')]){delete _0x1254e8['name'];}_0x2d7813[_0xcb2e('0x19')](_0x4dffd5)['send'](_0x1254e8);};}exports[_0xcb2e('0x28')]=function(_0x52e3e8,_0x33589e){var _0x1c1826={},_0x31f28e={},_0x25ea92={'count':0x0,'rows':[]};var _0x169601=_[_0xcb2e('0x29')](db[_0xcb2e('0x2a')][_0xcb2e('0x2b')],function(_0x1e20b4){return{'name':_0x1e20b4[_0xcb2e('0x2c')],'type':_0x1e20b4[_0xcb2e('0x2d')][_0xcb2e('0x2e')]};});_0x31f28e['model']=_[_0xcb2e('0x29')](_0x169601,_0xcb2e('0x27'));_0x31f28e['query']=_[_0xcb2e('0x2f')](_0x52e3e8[_0xcb2e('0x30')]);_0x31f28e['filters']=_[_0xcb2e('0x31')](_0x31f28e['model'],_0x31f28e[_0xcb2e('0x30')]);_0x1c1826[_0xcb2e('0x32')]=_[_0xcb2e('0x31')](_0x31f28e[_0xcb2e('0x33')],qs[_0xcb2e('0x34')](_0x52e3e8[_0xcb2e('0x30')][_0xcb2e('0x34')]));_0x1c1826[_0xcb2e('0x32')]=_0x1c1826[_0xcb2e('0x32')][_0xcb2e('0x35')]?_0x1c1826[_0xcb2e('0x32')]:_0x31f28e['model'];if(!_0x52e3e8['query'][_0xcb2e('0x36')](_0xcb2e('0x37'))){_0x1c1826[_0xcb2e('0x1c')]=qs['limit'](_0x52e3e8[_0xcb2e('0x30')][_0xcb2e('0x1c')]);_0x1c1826[_0xcb2e('0x1b')]=qs[_0xcb2e('0x1b')](_0x52e3e8[_0xcb2e('0x30')][_0xcb2e('0x1b')]);}_0x1c1826[_0xcb2e('0x38')]=qs['sort'](_0x52e3e8[_0xcb2e('0x30')]['sort']);_0x1c1826[_0xcb2e('0x39')]=qs['filters'](_[_0xcb2e('0x3a')](_0x52e3e8[_0xcb2e('0x30')],_0x31f28e[_0xcb2e('0x3b')]),_0x169601);if(_0x52e3e8[_0xcb2e('0x30')][_0xcb2e('0x3c')]){_0x1c1826['where']=_['merge'](_0x1c1826[_0xcb2e('0x39')],{'$or':_[_0xcb2e('0x29')](_0x169601,function(_0x994746){if(_0x994746['type']!==_0xcb2e('0x3d')){var _0xc885b0={};_0xc885b0[_0x994746[_0xcb2e('0x27')]]={'$like':'%'+_0x52e3e8[_0xcb2e('0x30')][_0xcb2e('0x3c')]+'%'};return _0xc885b0;}})});}_0x1c1826=_[_0xcb2e('0x3e')]({},_0x1c1826,_0x52e3e8['options']);var _0x4f36d5={'where':_0x1c1826[_0xcb2e('0x39')]};return db['Dynamics365Configuration']['count'](_0x4f36d5)[_0xcb2e('0x24')](function(_0x3238a3){_0x25ea92[_0xcb2e('0x1e')]=_0x3238a3;if(_0x52e3e8['query']['includeAll']){_0x1c1826['include']=[{'all':!![]}];}return db[_0xcb2e('0x2a')]['findAll'](_0x1c1826);})[_0xcb2e('0x24')](function(_0x3f0937){_0x25ea92[_0xcb2e('0x3f')]=_0x3f0937;return _0x25ea92;})[_0xcb2e('0x24')](respondWithFilteredResult(_0x33589e,_0x1c1826))[_0xcb2e('0x40')](handleError(_0x33589e,null));};exports['show']=function(_0x21e51f,_0x469af7){var _0xa42c45={'raw':![],'where':{'id':_0x21e51f['params']['id']}},_0x1b78bf={};_0x1b78bf[_0xcb2e('0x33')]=_[_0xcb2e('0x2f')](db[_0xcb2e('0x2a')]['rawAttributes']);_0x1b78bf[_0xcb2e('0x30')]=_[_0xcb2e('0x2f')](_0x21e51f['query']);_0x1b78bf['filters']=_['intersection'](_0x1b78bf[_0xcb2e('0x33')],_0x1b78bf[_0xcb2e('0x30')]);_0xa42c45['attributes']=_[_0xcb2e('0x31')](_0x1b78bf['model'],qs['fields'](_0x21e51f[_0xcb2e('0x30')][_0xcb2e('0x34')]));_0xa42c45[_0xcb2e('0x32')]=_0xa42c45[_0xcb2e('0x32')][_0xcb2e('0x35')]?_0xa42c45['attributes']:_0x1b78bf[_0xcb2e('0x33')];if(_0x21e51f[_0xcb2e('0x30')][_0xcb2e('0x41')]){_0xa42c45[_0xcb2e('0x42')]=[{'all':!![]}];}_0xa42c45=_[_0xcb2e('0x3e')]({},_0xa42c45,_0x21e51f[_0xcb2e('0x43')]);return db[_0xcb2e('0x2a')][_0xcb2e('0x44')](_0xa42c45)[_0xcb2e('0x24')](handleEntityNotFound(_0x469af7,null))[_0xcb2e('0x24')](respondWithResult(_0x469af7,null))['catch'](handleError(_0x469af7,null));};exports[_0xcb2e('0x45')]=function(_0x4fa542,_0x1e2738){return db[_0xcb2e('0x2a')][_0xcb2e('0x45')](_0x4fa542[_0xcb2e('0x46')],{})[_0xcb2e('0x24')](respondWithResult(_0x1e2738,0xc9))[_0xcb2e('0x40')](handleError(_0x1e2738,null));};exports['update']=function(_0x3e74f9,_0x195a3b){if(_0x3e74f9[_0xcb2e('0x46')]['id']){delete _0x3e74f9['body']['id'];}return db['Dynamics365Configuration'][_0xcb2e('0x44')]({'where':{'id':_0x3e74f9[_0xcb2e('0x47')]['id']}})['then'](handleEntityNotFound(_0x195a3b,null))['then'](saveUpdates(_0x3e74f9[_0xcb2e('0x46')],null))[_0xcb2e('0x24')](respondWithResult(_0x195a3b,null))[_0xcb2e('0x40')](handleError(_0x195a3b,null));};exports[_0xcb2e('0x25')]=function(_0x2563f9,_0x5e6d8b){return db['Dynamics365Configuration'][_0xcb2e('0x44')]({'where':{'id':_0x2563f9[_0xcb2e('0x47')]['id']}})[_0xcb2e('0x24')](handleEntityNotFound(_0x5e6d8b,null))['then'](removeEntity(_0x5e6d8b,null))[_0xcb2e('0x40')](handleError(_0x5e6d8b,null));};exports['getFields']=function(_0x309592,_0x13ea9d,_0x169071){var _0x420b7b={};var _0x329b7b={};var _0x1a0529;var _0x50b9c6;return db[_0xcb2e('0x2a')][_0xcb2e('0x48')]({'where':{'id':_0x309592[_0xcb2e('0x47')]['id']}})[_0xcb2e('0x24')](handleEntityNotFound(_0x13ea9d,null))[_0xcb2e('0x24')](function(_0x1749ce){if(_0x1749ce){_0x1a0529=_0x1749ce;_0x329b7b[_0xcb2e('0x33')]=_['keys'](db[_0xcb2e('0x49')][_0xcb2e('0x2b')]);_0x329b7b[_0xcb2e('0x30')]=_[_0xcb2e('0x2f')](_0x309592[_0xcb2e('0x30')]);_0x329b7b[_0xcb2e('0x3b')]=_[_0xcb2e('0x31')](_0x329b7b[_0xcb2e('0x33')],_0x329b7b[_0xcb2e('0x30')]);_0x420b7b[_0xcb2e('0x32')]=_[_0xcb2e('0x31')](_0x329b7b['model'],qs['fields'](_0x309592['query'][_0xcb2e('0x34')]));_0x420b7b[_0xcb2e('0x32')]=_0x420b7b[_0xcb2e('0x32')][_0xcb2e('0x35')]?_0x420b7b[_0xcb2e('0x32')]:_0x329b7b[_0xcb2e('0x33')];_0x420b7b[_0xcb2e('0x38')]=qs[_0xcb2e('0x4a')](_0x309592[_0xcb2e('0x30')][_0xcb2e('0x4a')]);_0x420b7b[_0xcb2e('0x39')]=qs[_0xcb2e('0x3b')](_[_0xcb2e('0x3a')](_0x309592[_0xcb2e('0x30')],_0x329b7b['filters']));if(_0x309592['query'][_0xcb2e('0x3c')]){_0x420b7b[_0xcb2e('0x39')]=_[_0xcb2e('0x3e')](_0x420b7b[_0xcb2e('0x39')],{'$or':_['map'](_0x420b7b[_0xcb2e('0x32')],function(_0xf0778b){var _0x145331={};_0x145331[_0xf0778b]={'$like':'%'+_0x309592['query'][_0xcb2e('0x3c')]+'%'};return _0x145331;})});}_0x420b7b=_[_0xcb2e('0x3e')]({},_0x420b7b,_0x309592['options']);return _0x1a0529['getFields'](_0x420b7b);}})[_0xcb2e('0x24')](function(_0x110f8b){if(_0x110f8b){_0x50b9c6=_0x110f8b['length'];if(!_0x309592[_0xcb2e('0x30')][_0xcb2e('0x36')](_0xcb2e('0x37'))){_0x420b7b[_0xcb2e('0x1c')]=qs[_0xcb2e('0x1c')](_0x309592[_0xcb2e('0x30')][_0xcb2e('0x1c')]);_0x420b7b[_0xcb2e('0x1b')]=qs[_0xcb2e('0x1b')](_0x309592[_0xcb2e('0x30')][_0xcb2e('0x1b')]);}return _0x1a0529['getFields'](_0x420b7b);}})[_0xcb2e('0x24')](function(_0x803658){if(_0x803658){return _0x803658?{'count':_0x50b9c6,'rows':_0x803658}:null;}})[_0xcb2e('0x24')](respondWithResult(_0x13ea9d,null))[_0xcb2e('0x40')](handleError(_0x13ea9d,null));};exports[_0xcb2e('0x4b')]=function(_0x1730f8,_0x28f8b1,_0xbde56e){var _0x7ea01f={};var _0x39239e={};var _0x5c87e5;var _0x54f616;return db[_0xcb2e('0x2a')][_0xcb2e('0x48')]({'where':{'id':_0x1730f8[_0xcb2e('0x47')]['id']}})[_0xcb2e('0x24')](handleEntityNotFound(_0x28f8b1,null))[_0xcb2e('0x24')](function(_0x49eac0){if(_0x49eac0){_0x5c87e5=_0x49eac0;_0x39239e[_0xcb2e('0x33')]=_['keys'](db[_0xcb2e('0x49')][_0xcb2e('0x2b')]);_0x39239e[_0xcb2e('0x30')]=_[_0xcb2e('0x2f')](_0x1730f8[_0xcb2e('0x30')]);_0x39239e[_0xcb2e('0x3b')]=_[_0xcb2e('0x31')](_0x39239e[_0xcb2e('0x33')],_0x39239e[_0xcb2e('0x30')]);_0x7ea01f['attributes']=_['intersection'](_0x39239e[_0xcb2e('0x33')],qs[_0xcb2e('0x34')](_0x1730f8[_0xcb2e('0x30')]['fields']));_0x7ea01f['attributes']=_0x7ea01f[_0xcb2e('0x32')][_0xcb2e('0x35')]?_0x7ea01f[_0xcb2e('0x32')]:_0x39239e[_0xcb2e('0x33')];_0x7ea01f[_0xcb2e('0x38')]=qs['sort'](_0x1730f8['query']['sort']);_0x7ea01f[_0xcb2e('0x39')]=qs[_0xcb2e('0x3b')](_[_0xcb2e('0x3a')](_0x1730f8[_0xcb2e('0x30')],_0x39239e[_0xcb2e('0x3b')]));if(_0x1730f8[_0xcb2e('0x30')][_0xcb2e('0x3c')]){_0x7ea01f[_0xcb2e('0x39')]=_[_0xcb2e('0x3e')](_0x7ea01f[_0xcb2e('0x39')],{'$or':_[_0xcb2e('0x29')](_0x7ea01f['attributes'],function(_0x2f45f7){var _0xd70ee8={};_0xd70ee8[_0x2f45f7]={'$like':'%'+_0x1730f8[_0xcb2e('0x30')]['filter']+'%'};return _0xd70ee8;})});}_0x7ea01f=_['merge']({},_0x7ea01f,_0x1730f8[_0xcb2e('0x43')]);return _0x5c87e5['getSubjects'](_0x7ea01f);}})[_0xcb2e('0x24')](function(_0x1184a6){if(_0x1184a6){_0x54f616=_0x1184a6['length'];if(!_0x1730f8['query'][_0xcb2e('0x36')](_0xcb2e('0x37'))){_0x7ea01f[_0xcb2e('0x1c')]=qs['limit'](_0x1730f8[_0xcb2e('0x30')][_0xcb2e('0x1c')]);_0x7ea01f[_0xcb2e('0x1b')]=qs['offset'](_0x1730f8['query']['offset']);}return _0x5c87e5[_0xcb2e('0x4b')](_0x7ea01f);}})[_0xcb2e('0x24')](function(_0x506b00){if(_0x506b00){return _0x506b00?{'count':_0x54f616,'rows':_0x506b00}:null;}})['then'](respondWithResult(_0x28f8b1,null))[_0xcb2e('0x40')](handleError(_0x28f8b1,null));};exports[_0xcb2e('0x4c')]=function(_0xaaf543,_0x460118,_0x224ad7){var _0x244a05={};var _0x2cb4ff={};var _0xc30c6d;var _0x281dd5;return db[_0xcb2e('0x2a')]['findOne']({'where':{'id':_0xaaf543[_0xcb2e('0x47')]['id']}})[_0xcb2e('0x24')](handleEntityNotFound(_0x460118,null))['then'](function(_0x391388){if(_0x391388){_0xc30c6d=_0x391388;_0x2cb4ff['model']=_[_0xcb2e('0x2f')](db[_0xcb2e('0x49')][_0xcb2e('0x2b')]);_0x2cb4ff[_0xcb2e('0x30')]=_['keys'](_0xaaf543['query']);_0x2cb4ff[_0xcb2e('0x3b')]=_['intersection'](_0x2cb4ff['model'],_0x2cb4ff[_0xcb2e('0x30')]);_0x244a05[_0xcb2e('0x32')]=_[_0xcb2e('0x31')](_0x2cb4ff[_0xcb2e('0x33')],qs[_0xcb2e('0x34')](_0xaaf543[_0xcb2e('0x30')][_0xcb2e('0x34')]));_0x244a05[_0xcb2e('0x32')]=_0x244a05[_0xcb2e('0x32')][_0xcb2e('0x35')]?_0x244a05[_0xcb2e('0x32')]:_0x2cb4ff[_0xcb2e('0x33')];_0x244a05[_0xcb2e('0x38')]=qs['sort'](_0xaaf543[_0xcb2e('0x30')][_0xcb2e('0x4a')]);_0x244a05[_0xcb2e('0x39')]=qs['filters'](_[_0xcb2e('0x3a')](_0xaaf543['query'],_0x2cb4ff['filters']));if(_0xaaf543[_0xcb2e('0x30')][_0xcb2e('0x3c')]){_0x244a05[_0xcb2e('0x39')]=_[_0xcb2e('0x3e')](_0x244a05['where'],{'$or':_[_0xcb2e('0x29')](_0x244a05['attributes'],function(_0x8f6452){var _0x3574ea={};_0x3574ea[_0x8f6452]={'$like':'%'+_0xaaf543[_0xcb2e('0x30')][_0xcb2e('0x3c')]+'%'};return _0x3574ea;})});}_0x244a05=_[_0xcb2e('0x3e')]({},_0x244a05,_0xaaf543[_0xcb2e('0x43')]);return _0xc30c6d[_0xcb2e('0x4c')](_0x244a05);}})['then'](function(_0x22bf97){if(_0x22bf97){_0x281dd5=_0x22bf97[_0xcb2e('0x35')];if(!_0xaaf543[_0xcb2e('0x30')][_0xcb2e('0x36')](_0xcb2e('0x37'))){_0x244a05[_0xcb2e('0x1c')]=qs['limit'](_0xaaf543['query'][_0xcb2e('0x1c')]);_0x244a05[_0xcb2e('0x1b')]=qs[_0xcb2e('0x1b')](_0xaaf543['query'][_0xcb2e('0x1b')]);}return _0xc30c6d[_0xcb2e('0x4c')](_0x244a05);}})[_0xcb2e('0x24')](function(_0x3b9bb1){if(_0x3b9bb1){return _0x3b9bb1?{'count':_0x281dd5,'rows':_0x3b9bb1}:null;}})[_0xcb2e('0x24')](respondWithResult(_0x460118,null))['catch'](handleError(_0x460118,null));}; \ No newline at end of file +var _0xc029=['squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','order','sort','filter','where','merge','options','includeAll','include','findAll','show','params','rawAttributes','catch','create','body','find','destroy','getFields','findOne','Dynamics365Field','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash'];(function(_0x4ece58,_0x50922a){var _0x20d209=function(_0x3de5f6){while(--_0x3de5f6){_0x4ece58['push'](_0x4ece58['shift']());}};_0x20d209(++_0x50922a);}(_0xc029,0xea));var _0x9c02=function(_0x1b9a9f,_0x482c35){_0x1b9a9f=_0x1b9a9f-0x0;var _0x2552fd=_0xc029[_0x1b9a9f];return _0x2552fd;};'use strict';var emlformat=require(_0x9c02('0x0'));var rimraf=require(_0x9c02('0x1'));var zipdir=require(_0x9c02('0x2'));var jsonpatch=require(_0x9c02('0x3'));var rp=require(_0x9c02('0x4'));var moment=require('moment');var BPromise=require(_0x9c02('0x5'));var Mustache=require(_0x9c02('0x6'));var util=require(_0x9c02('0x7'));var path=require(_0x9c02('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9c02('0x9'));var fs=require('fs');var fs_extra=require(_0x9c02('0xa'));var _=require(_0x9c02('0xb'));var squel=require(_0x9c02('0xc'));var crypto=require(_0x9c02('0xd'));var jsforce=require(_0x9c02('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c02('0xf'));var querystring=require('querystring');var Papa=require(_0x9c02('0x10'));var Redis=require(_0x9c02('0x11'));var authService=require(_0x9c02('0x12'));var qs=require(_0x9c02('0x13'));var as=require(_0x9c02('0x14'));var hardwareService=require(_0x9c02('0x15'));var logger=require(_0x9c02('0x16'))(_0x9c02('0x17'));var utils=require(_0x9c02('0x18'));var config=require(_0x9c02('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c02('0x1a'))['db'];function respondWithStatusCode(_0x155423,_0x16bcee){_0x16bcee=_0x16bcee||0xcc;return function(_0x381b58){if(_0x381b58){return _0x155423[_0x9c02('0x1b')](_0x16bcee);}return _0x155423[_0x9c02('0x1c')](_0x16bcee)['end']();};}function respondWithResult(_0x542496,_0x371e5f){_0x371e5f=_0x371e5f||0xc8;return function(_0x54e400){if(_0x54e400){return _0x542496[_0x9c02('0x1c')](_0x371e5f)[_0x9c02('0x1d')](_0x54e400);}};}function respondWithFilteredResult(_0x506f0f,_0x3b3e4a){return function(_0x31dfd4){if(_0x31dfd4){var _0xd2c858=typeof _0x3b3e4a[_0x9c02('0x1e')]===_0x9c02('0x1f')&&typeof _0x3b3e4a[_0x9c02('0x20')]===_0x9c02('0x1f');var _0x30e608=_0x31dfd4['count'];var _0x13d061=_0xd2c858?0x0:_0x3b3e4a[_0x9c02('0x1e')];var _0x1725b1=_0xd2c858?_0x31dfd4[_0x9c02('0x21')]:_0x3b3e4a[_0x9c02('0x1e')]+_0x3b3e4a[_0x9c02('0x20')];var _0x333a06;if(_0x1725b1>=_0x30e608){_0x1725b1=_0x30e608;_0x333a06=0xc8;}else{_0x333a06=0xce;}_0x506f0f[_0x9c02('0x1c')](_0x333a06);return _0x506f0f[_0x9c02('0x22')]('Content-Range',_0x13d061+'-'+_0x1725b1+'/'+_0x30e608)[_0x9c02('0x1d')](_0x31dfd4);}return null;};}function patchUpdates(_0x15f301){return function(_0xf47b13){try{jsonpatch[_0x9c02('0x23')](_0xf47b13,_0x15f301,!![]);}catch(_0x21053b){return BPromise[_0x9c02('0x24')](_0x21053b);}return _0xf47b13['save']();};}function saveUpdates(_0x501253,_0x5a1773){return function(_0x4e15b0){if(_0x4e15b0){return _0x4e15b0[_0x9c02('0x25')](_0x501253)[_0x9c02('0x26')](function(_0x250466){return _0x250466;});}return null;};}function removeEntity(_0x3cc0e1,_0x42938c){return function(_0x44ae48){if(_0x44ae48){return _0x44ae48['destroy']()['then'](function(){_0x3cc0e1[_0x9c02('0x1c')](0xcc)[_0x9c02('0x27')]();});}};}function handleEntityNotFound(_0x119e44,_0x216ea3){return function(_0x113c20){if(!_0x113c20){_0x119e44[_0x9c02('0x1b')](0x194);}return _0x113c20;};}function handleError(_0x758b5d,_0x1efa39){_0x1efa39=_0x1efa39||0x1f4;return function(_0x1e7a14){logger[_0x9c02('0x28')](_0x1e7a14[_0x9c02('0x29')]);if(_0x1e7a14[_0x9c02('0x2a')]){delete _0x1e7a14[_0x9c02('0x2a')];}_0x758b5d[_0x9c02('0x1c')](_0x1efa39)[_0x9c02('0x2b')](_0x1e7a14);};}exports[_0x9c02('0x2c')]=function(_0xae524e,_0x35a924){var _0x4cb905={},_0x1109f3={},_0x320632={'count':0x0,'rows':[]};var _0x2efce1=_[_0x9c02('0x2d')](db[_0x9c02('0x2e')]['rawAttributes'],function(_0x232b18){return{'name':_0x232b18[_0x9c02('0x2f')],'type':_0x232b18[_0x9c02('0x30')][_0x9c02('0x31')]};});_0x1109f3['model']=_[_0x9c02('0x2d')](_0x2efce1,_0x9c02('0x2a'));_0x1109f3['query']=_[_0x9c02('0x32')](_0xae524e['query']);_0x1109f3[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x1109f3[_0x9c02('0x35')],_0x1109f3[_0x9c02('0x36')]);_0x4cb905[_0x9c02('0x37')]=_[_0x9c02('0x34')](_0x1109f3[_0x9c02('0x35')],qs[_0x9c02('0x38')](_0xae524e[_0x9c02('0x36')][_0x9c02('0x38')]));_0x4cb905[_0x9c02('0x37')]=_0x4cb905[_0x9c02('0x37')][_0x9c02('0x39')]?_0x4cb905[_0x9c02('0x37')]:_0x1109f3[_0x9c02('0x35')];if(!_0xae524e['query']['hasOwnProperty']('nolimit')){_0x4cb905[_0x9c02('0x20')]=qs[_0x9c02('0x20')](_0xae524e['query'][_0x9c02('0x20')]);_0x4cb905[_0x9c02('0x1e')]=qs[_0x9c02('0x1e')](_0xae524e[_0x9c02('0x36')]['offset']);}_0x4cb905[_0x9c02('0x3a')]=qs['sort'](_0xae524e[_0x9c02('0x36')][_0x9c02('0x3b')]);_0x4cb905['where']=qs[_0x9c02('0x33')](_['pick'](_0xae524e[_0x9c02('0x36')],_0x1109f3[_0x9c02('0x33')]),_0x2efce1);if(_0xae524e[_0x9c02('0x36')][_0x9c02('0x3c')]){_0x4cb905[_0x9c02('0x3d')]=_[_0x9c02('0x3e')](_0x4cb905[_0x9c02('0x3d')],{'$or':_['map'](_0x2efce1,function(_0x3d45d5){if(_0x3d45d5[_0x9c02('0x30')]!=='VIRTUAL'){var _0x1ad5be={};_0x1ad5be[_0x3d45d5[_0x9c02('0x2a')]]={'$like':'%'+_0xae524e['query'][_0x9c02('0x3c')]+'%'};return _0x1ad5be;}})});}_0x4cb905=_[_0x9c02('0x3e')]({},_0x4cb905,_0xae524e[_0x9c02('0x3f')]);var _0x19e9d6={'where':_0x4cb905[_0x9c02('0x3d')]};return db[_0x9c02('0x2e')][_0x9c02('0x21')](_0x19e9d6)[_0x9c02('0x26')](function(_0x459fe6){_0x320632['count']=_0x459fe6;if(_0xae524e['query'][_0x9c02('0x40')]){_0x4cb905[_0x9c02('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x9c02('0x42')](_0x4cb905);})[_0x9c02('0x26')](function(_0x7ad822){_0x320632['rows']=_0x7ad822;return _0x320632;})[_0x9c02('0x26')](respondWithFilteredResult(_0x35a924,_0x4cb905))['catch'](handleError(_0x35a924,null));};exports[_0x9c02('0x43')]=function(_0x17391f,_0x2e19f3){var _0xd63489={'raw':![],'where':{'id':_0x17391f[_0x9c02('0x44')]['id']}},_0x545e9b={};_0x545e9b[_0x9c02('0x35')]=_[_0x9c02('0x32')](db[_0x9c02('0x2e')][_0x9c02('0x45')]);_0x545e9b[_0x9c02('0x36')]=_[_0x9c02('0x32')](_0x17391f['query']);_0x545e9b[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x545e9b[_0x9c02('0x35')],_0x545e9b[_0x9c02('0x36')]);_0xd63489[_0x9c02('0x37')]=_[_0x9c02('0x34')](_0x545e9b[_0x9c02('0x35')],qs[_0x9c02('0x38')](_0x17391f['query'][_0x9c02('0x38')]));_0xd63489[_0x9c02('0x37')]=_0xd63489['attributes']['length']?_0xd63489[_0x9c02('0x37')]:_0x545e9b['model'];if(_0x17391f['query'][_0x9c02('0x40')]){_0xd63489[_0x9c02('0x41')]=[{'all':!![]}];}_0xd63489=_[_0x9c02('0x3e')]({},_0xd63489,_0x17391f['options']);return db[_0x9c02('0x2e')]['find'](_0xd63489)['then'](handleEntityNotFound(_0x2e19f3,null))[_0x9c02('0x26')](respondWithResult(_0x2e19f3,null))[_0x9c02('0x46')](handleError(_0x2e19f3,null));};exports[_0x9c02('0x47')]=function(_0xc455e4,_0x287d27){return db['Dynamics365Configuration'][_0x9c02('0x47')](_0xc455e4['body'],{})[_0x9c02('0x26')](respondWithResult(_0x287d27,0xc9))[_0x9c02('0x46')](handleError(_0x287d27,null));};exports[_0x9c02('0x25')]=function(_0x266345,_0x32075c){if(_0x266345[_0x9c02('0x48')]['id']){delete _0x266345[_0x9c02('0x48')]['id'];}return db[_0x9c02('0x2e')][_0x9c02('0x49')]({'where':{'id':_0x266345[_0x9c02('0x44')]['id']}})[_0x9c02('0x26')](handleEntityNotFound(_0x32075c,null))[_0x9c02('0x26')](saveUpdates(_0x266345[_0x9c02('0x48')],null))[_0x9c02('0x26')](respondWithResult(_0x32075c,null))[_0x9c02('0x46')](handleError(_0x32075c,null));};exports[_0x9c02('0x4a')]=function(_0x279b25,_0x1b79d7){return db[_0x9c02('0x2e')]['find']({'where':{'id':_0x279b25[_0x9c02('0x44')]['id']}})[_0x9c02('0x26')](handleEntityNotFound(_0x1b79d7,null))[_0x9c02('0x26')](removeEntity(_0x1b79d7,null))[_0x9c02('0x46')](handleError(_0x1b79d7,null));};exports[_0x9c02('0x4b')]=function(_0x115e46,_0x24e275,_0xede553){var _0x531b39={};var _0x24188e={};var _0x56d4ee;var _0x3991f8;return db[_0x9c02('0x2e')][_0x9c02('0x4c')]({'where':{'id':_0x115e46[_0x9c02('0x44')]['id']}})['then'](handleEntityNotFound(_0x24e275,null))[_0x9c02('0x26')](function(_0x515e5a){if(_0x515e5a){_0x56d4ee=_0x515e5a;_0x24188e[_0x9c02('0x35')]=_[_0x9c02('0x32')](db[_0x9c02('0x4d')]['rawAttributes']);_0x24188e['query']=_[_0x9c02('0x32')](_0x115e46[_0x9c02('0x36')]);_0x24188e[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x24188e[_0x9c02('0x35')],_0x24188e[_0x9c02('0x36')]);_0x531b39['attributes']=_[_0x9c02('0x34')](_0x24188e[_0x9c02('0x35')],qs[_0x9c02('0x38')](_0x115e46[_0x9c02('0x36')][_0x9c02('0x38')]));_0x531b39['attributes']=_0x531b39[_0x9c02('0x37')][_0x9c02('0x39')]?_0x531b39['attributes']:_0x24188e['model'];_0x531b39[_0x9c02('0x3a')]=qs['sort'](_0x115e46[_0x9c02('0x36')][_0x9c02('0x3b')]);_0x531b39[_0x9c02('0x3d')]=qs['filters'](_['pick'](_0x115e46[_0x9c02('0x36')],_0x24188e[_0x9c02('0x33')]));if(_0x115e46[_0x9c02('0x36')][_0x9c02('0x3c')]){_0x531b39[_0x9c02('0x3d')]=_[_0x9c02('0x3e')](_0x531b39[_0x9c02('0x3d')],{'$or':_[_0x9c02('0x2d')](_0x531b39[_0x9c02('0x37')],function(_0xfe94b2){var _0x506f29={};_0x506f29[_0xfe94b2]={'$like':'%'+_0x115e46[_0x9c02('0x36')][_0x9c02('0x3c')]+'%'};return _0x506f29;})});}_0x531b39=_[_0x9c02('0x3e')]({},_0x531b39,_0x115e46[_0x9c02('0x3f')]);return _0x56d4ee['getFields'](_0x531b39);}})['then'](function(_0x31af27){if(_0x31af27){_0x3991f8=_0x31af27[_0x9c02('0x39')];if(!_0x115e46['query']['hasOwnProperty'](_0x9c02('0x4e'))){_0x531b39[_0x9c02('0x20')]=qs['limit'](_0x115e46[_0x9c02('0x36')][_0x9c02('0x20')]);_0x531b39[_0x9c02('0x1e')]=qs[_0x9c02('0x1e')](_0x115e46[_0x9c02('0x36')]['offset']);}return _0x56d4ee[_0x9c02('0x4b')](_0x531b39);}})[_0x9c02('0x26')](function(_0x42c32f){if(_0x42c32f){return _0x42c32f?{'count':_0x3991f8,'rows':_0x42c32f}:null;}})[_0x9c02('0x26')](respondWithResult(_0x24e275,null))[_0x9c02('0x46')](handleError(_0x24e275,null));};exports[_0x9c02('0x4f')]=function(_0x5429f9,_0x676de2,_0x20c540){var _0x56e19e={};var _0xaed79e={};var _0x15e04a;var _0x25d6f1;return db[_0x9c02('0x2e')][_0x9c02('0x4c')]({'where':{'id':_0x5429f9[_0x9c02('0x44')]['id']}})[_0x9c02('0x26')](handleEntityNotFound(_0x676de2,null))[_0x9c02('0x26')](function(_0x4e9aa0){if(_0x4e9aa0){_0x15e04a=_0x4e9aa0;_0xaed79e[_0x9c02('0x35')]=_['keys'](db[_0x9c02('0x4d')][_0x9c02('0x45')]);_0xaed79e[_0x9c02('0x36')]=_[_0x9c02('0x32')](_0x5429f9[_0x9c02('0x36')]);_0xaed79e['filters']=_[_0x9c02('0x34')](_0xaed79e[_0x9c02('0x35')],_0xaed79e[_0x9c02('0x36')]);_0x56e19e[_0x9c02('0x37')]=_[_0x9c02('0x34')](_0xaed79e['model'],qs['fields'](_0x5429f9[_0x9c02('0x36')]['fields']));_0x56e19e[_0x9c02('0x37')]=_0x56e19e['attributes'][_0x9c02('0x39')]?_0x56e19e[_0x9c02('0x37')]:_0xaed79e['model'];_0x56e19e[_0x9c02('0x3a')]=qs[_0x9c02('0x3b')](_0x5429f9[_0x9c02('0x36')]['sort']);_0x56e19e['where']=qs[_0x9c02('0x33')](_['pick'](_0x5429f9[_0x9c02('0x36')],_0xaed79e[_0x9c02('0x33')]));if(_0x5429f9[_0x9c02('0x36')]['filter']){_0x56e19e[_0x9c02('0x3d')]=_['merge'](_0x56e19e['where'],{'$or':_[_0x9c02('0x2d')](_0x56e19e['attributes'],function(_0x4f00a8){var _0x22de27={};_0x22de27[_0x4f00a8]={'$like':'%'+_0x5429f9[_0x9c02('0x36')][_0x9c02('0x3c')]+'%'};return _0x22de27;})});}_0x56e19e=_[_0x9c02('0x3e')]({},_0x56e19e,_0x5429f9[_0x9c02('0x3f')]);return _0x15e04a[_0x9c02('0x4f')](_0x56e19e);}})['then'](function(_0x20978b){if(_0x20978b){_0x25d6f1=_0x20978b[_0x9c02('0x39')];if(!_0x5429f9[_0x9c02('0x36')][_0x9c02('0x50')](_0x9c02('0x4e'))){_0x56e19e[_0x9c02('0x20')]=qs[_0x9c02('0x20')](_0x5429f9['query'][_0x9c02('0x20')]);_0x56e19e['offset']=qs['offset'](_0x5429f9[_0x9c02('0x36')][_0x9c02('0x1e')]);}return _0x15e04a['getSubjects'](_0x56e19e);}})[_0x9c02('0x26')](function(_0x22fbed){if(_0x22fbed){return _0x22fbed?{'count':_0x25d6f1,'rows':_0x22fbed}:null;}})[_0x9c02('0x26')](respondWithResult(_0x676de2,null))[_0x9c02('0x46')](handleError(_0x676de2,null));};exports[_0x9c02('0x51')]=function(_0x211e6d,_0x3b21dc,_0x25cdfe){var _0x299cc7={};var _0x435be9={};var _0x4fb724;var _0x4aeb1b;return db[_0x9c02('0x2e')]['findOne']({'where':{'id':_0x211e6d['params']['id']}})[_0x9c02('0x26')](handleEntityNotFound(_0x3b21dc,null))[_0x9c02('0x26')](function(_0xe03f3e){if(_0xe03f3e){_0x4fb724=_0xe03f3e;_0x435be9[_0x9c02('0x35')]=_[_0x9c02('0x32')](db[_0x9c02('0x4d')][_0x9c02('0x45')]);_0x435be9[_0x9c02('0x36')]=_['keys'](_0x211e6d[_0x9c02('0x36')]);_0x435be9[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x435be9[_0x9c02('0x35')],_0x435be9['query']);_0x299cc7[_0x9c02('0x37')]=_[_0x9c02('0x34')](_0x435be9['model'],qs['fields'](_0x211e6d[_0x9c02('0x36')][_0x9c02('0x38')]));_0x299cc7[_0x9c02('0x37')]=_0x299cc7['attributes'][_0x9c02('0x39')]?_0x299cc7[_0x9c02('0x37')]:_0x435be9['model'];_0x299cc7[_0x9c02('0x3a')]=qs[_0x9c02('0x3b')](_0x211e6d['query'][_0x9c02('0x3b')]);_0x299cc7[_0x9c02('0x3d')]=qs[_0x9c02('0x33')](_['pick'](_0x211e6d[_0x9c02('0x36')],_0x435be9[_0x9c02('0x33')]));if(_0x211e6d[_0x9c02('0x36')][_0x9c02('0x3c')]){_0x299cc7[_0x9c02('0x3d')]=_[_0x9c02('0x3e')](_0x299cc7[_0x9c02('0x3d')],{'$or':_[_0x9c02('0x2d')](_0x299cc7['attributes'],function(_0x5d4235){var _0x41cacc={};_0x41cacc[_0x5d4235]={'$like':'%'+_0x211e6d[_0x9c02('0x36')][_0x9c02('0x3c')]+'%'};return _0x41cacc;})});}_0x299cc7=_[_0x9c02('0x3e')]({},_0x299cc7,_0x211e6d[_0x9c02('0x3f')]);return _0x4fb724[_0x9c02('0x51')](_0x299cc7);}})[_0x9c02('0x26')](function(_0xc58a31){if(_0xc58a31){_0x4aeb1b=_0xc58a31[_0x9c02('0x39')];if(!_0x211e6d[_0x9c02('0x36')][_0x9c02('0x50')](_0x9c02('0x4e'))){_0x299cc7[_0x9c02('0x20')]=qs[_0x9c02('0x20')](_0x211e6d[_0x9c02('0x36')][_0x9c02('0x20')]);_0x299cc7[_0x9c02('0x1e')]=qs[_0x9c02('0x1e')](_0x211e6d[_0x9c02('0x36')][_0x9c02('0x1e')]);}return _0x4fb724[_0x9c02('0x51')](_0x299cc7);}})[_0x9c02('0x26')](function(_0x52ec59){if(_0x52ec59){return _0x52ec59?{'count':_0x4aeb1b,'rows':_0x52ec59}:null;}})[_0x9c02('0x26')](respondWithResult(_0x3b21dc,null))[_0x9c02('0x46')](handleError(_0x3b21dc,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 26a5cb7..92b95d9 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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x35147a,_0x58654f){var _0xb1056b=function(_0x58b98e){while(--_0x58b98e){_0x35147a['push'](_0x35147a['shift']());}};_0xb1056b(++_0x58654f);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','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 8c4a72c..755365e 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 _0x5932=['then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x5932,0xdb));var _0x2593=function(_0x27589d,_0xee56aa){_0x27589d=_0x27589d-0x0;var _0x1f6333=_0x5932[_0x27589d];return _0x1f6333;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2593('0x0'));var BPromise=require(_0x2593('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2593('0x2'));var db=require(_0x2593('0x3'))['db'];var utils=require(_0x2593('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2593('0x5'));var jayson=require(_0x2593('0x6'));var client=jayson[_0x2593('0x7')][_0x2593('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x570af9,_0x26a7bc,_0x2d97ef){return new BPromise(function(_0x429ff1,_0x4f6a2c){return client['request'](_0x570af9,_0x2d97ef)[_0x2593('0x9')](function(_0x1c4c72){logger['info'](_0x2593('0xa'),_0x26a7bc,_0x2593('0xb'));logger['debug'](_0x2593('0xc'),_0x26a7bc,_0x2593('0xb'),JSON['stringify'](_0x1c4c72));if(_0x1c4c72[_0x2593('0xd')]){if(_0x1c4c72['error'][_0x2593('0xe')]===0x1f4){logger['error'](_0x2593('0xa'),_0x26a7bc,_0x1c4c72['error'][_0x2593('0xf')]);return _0x4f6a2c(_0x1c4c72[_0x2593('0xd')][_0x2593('0xf')]);}logger[_0x2593('0xd')](_0x2593('0xa'),_0x26a7bc,_0x1c4c72['error'][_0x2593('0xf')]);return _0x429ff1(_0x1c4c72[_0x2593('0xd')]['message']);}else{logger[_0x2593('0x10')](_0x2593('0xa'),_0x26a7bc,_0x2593('0xb'));_0x429ff1(_0x1c4c72[_0x2593('0x11')][_0x2593('0xf')]);}})[_0x2593('0x12')](function(_0xd76c7f){logger[_0x2593('0xd')](_0x2593('0xa'),_0x26a7bc,_0xd76c7f);_0x4f6a2c(_0xd76c7f);});});} \ No newline at end of file +var _0xe396=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0xe396,0x111));var _0x6e39=function(_0x15079c,_0x235831){_0x15079c=_0x15079c-0x0;var _0x5d6649=_0xe396[_0x15079c];return _0x5d6649;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e39('0x0'));var BPromise=require(_0x6e39('0x1'));var rs=require(_0x6e39('0x2'));var fs=require('fs');var Redis=require(_0x6e39('0x3'));var db=require(_0x6e39('0x4'))['db'];var utils=require(_0x6e39('0x5'));var logger=require(_0x6e39('0x6'))(_0x6e39('0x7'));var config=require(_0x6e39('0x8'));var jayson=require(_0x6e39('0x9'));var client=jayson[_0x6e39('0xa')][_0x6e39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ce256,_0x2c03db,_0x59ceb5){return new BPromise(function(_0x2e4cbb,_0x1c5fcb){return client['request'](_0x4ce256,_0x59ceb5)[_0x6e39('0xc')](function(_0x5e7fc7){logger[_0x6e39('0xd')](_0x6e39('0xe'),_0x2c03db,_0x6e39('0xf'));logger[_0x6e39('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2c03db,_0x6e39('0xf'),JSON[_0x6e39('0x11')](_0x5e7fc7));if(_0x5e7fc7[_0x6e39('0x12')]){if(_0x5e7fc7[_0x6e39('0x12')][_0x6e39('0x13')]===0x1f4){logger[_0x6e39('0x12')](_0x6e39('0xe'),_0x2c03db,_0x5e7fc7['error'][_0x6e39('0x14')]);return _0x1c5fcb(_0x5e7fc7[_0x6e39('0x12')][_0x6e39('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2c03db,_0x5e7fc7['error'][_0x6e39('0x14')]);return _0x2e4cbb(_0x5e7fc7['error'][_0x6e39('0x14')]);}else{logger[_0x6e39('0xd')](_0x6e39('0xe'),_0x2c03db,_0x6e39('0xf'));_0x2e4cbb(_0x5e7fc7[_0x6e39('0x15')][_0x6e39('0x14')]);}})[_0x6e39('0x16')](function(_0x4a8643){logger[_0x6e39('0x12')](_0x6e39('0xe'),_0x2c03db,_0x4a8643);_0x1c5fcb(_0x4a8643);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index aca11df..943a33b 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 _0x0a29=['Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1e6aa7,_0x3282c6){var _0x5f20c3=function(_0x1dd529){while(--_0x1dd529){_0x1e6aa7['push'](_0x1e6aa7['shift']());}};_0x5f20c3(++_0x3282c6);}(_0x0a29,0xcc));var _0x90a2=function(_0x13bdcf,_0x50947f){_0x13bdcf=_0x13bdcf-0x0;var _0x4343bb=_0x0a29[_0x13bdcf];return _0x4343bb;};'use strict';var multer=require(_0x90a2('0x0'));var util=require(_0x90a2('0x1'));var path=require(_0x90a2('0x2'));var timeout=require(_0x90a2('0x3'));var express=require('express');var router=express[_0x90a2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x90a2('0x5'));var interaction=require(_0x90a2('0x6'));var config=require('../../config/environment');var controller=require(_0x90a2('0x7'));router[_0x90a2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x90a2('0x9'),auth[_0x90a2('0xa')](),controller[_0x90a2('0xb')]);router['post']('/',auth[_0x90a2('0xa')](),controller[_0x90a2('0xc')]);router[_0x90a2('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x90a2('0xa')](),controller[_0x90a2('0xe')]);module[_0x90a2('0xf')]=router; \ No newline at end of file +var _0xfe96=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0xfe96,0x1ed));var _0x6fe9=function(_0x5e5f5a,_0x5cb19a){_0x5e5f5a=_0x5e5f5a-0x0;var _0x4141ae=_0xfe96[_0x5e5f5a];return _0x4141ae;};'use strict';var multer=require(_0x6fe9('0x0'));var util=require(_0x6fe9('0x1'));var path=require('path');var timeout=require(_0x6fe9('0x2'));var express=require(_0x6fe9('0x3'));var router=express[_0x6fe9('0x4')]();var fs_extra=require(_0x6fe9('0x5'));var auth=require(_0x6fe9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6fe9('0x7'));var controller=require(_0x6fe9('0x8'));router[_0x6fe9('0x9')]('/',auth[_0x6fe9('0xa')](),controller[_0x6fe9('0xb')]);router[_0x6fe9('0x9')](_0x6fe9('0xc'),auth['isAuthenticated'](),controller[_0x6fe9('0xd')]);router[_0x6fe9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6fe9('0xf')](_0x6fe9('0xc'),auth[_0x6fe9('0xa')](),controller['update']);router[_0x6fe9('0x10')](_0x6fe9('0xc'),auth[_0x6fe9('0xa')](),controller[_0x6fe9('0x11')]);module[_0x6fe9('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 73564ad..5990959 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 _0x6a81=['keyValue','picklist','STRING','BOOLEAN','exports','string','variable','customVariable'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6a81,0xcc));var _0x16a8=function(_0x1f4cc0,_0x238b6a){_0x1f4cc0=_0x1f4cc0-0x0;var _0x251992=_0x6a81[_0x1f4cc0];return _0x251992;};'use strict';var Sequelize=require('sequelize');module[_0x16a8('0x0')]={'type':{'type':Sequelize['ENUM'](_0x16a8('0x1'),_0x16a8('0x2'),_0x16a8('0x3'),_0x16a8('0x4'),_0x16a8('0x5')),'defaultValue':_0x16a8('0x1')},'content':{'type':Sequelize[_0x16a8('0x6')]},'key':{'type':Sequelize[_0x16a8('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x16a8('0x2'),_0x16a8('0x3'))},'keyContent':{'type':Sequelize[_0x16a8('0x6')]},'idField':{'type':Sequelize[_0x16a8('0x6')]},'nameField':{'type':Sequelize[_0x16a8('0x6')]},'customField':{'type':Sequelize[_0x16a8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16a8('0x6')]}}; \ No newline at end of file +var _0xee8c=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x465e84,_0x2ad6f8){var _0x29c6df=function(_0xa9af2b){while(--_0xa9af2b){_0x465e84['push'](_0x465e84['shift']());}};_0x29c6df(++_0x2ad6f8);}(_0xee8c,0x17c));var _0xcee8=function(_0xb78769,_0x5ce8ac){_0xb78769=_0xb78769-0x0;var _0x44809c=_0xee8c[_0xb78769];return _0x44809c;};'use strict';var Sequelize=require(_0xcee8('0x0'));module[_0xcee8('0x1')]={'type':{'type':Sequelize[_0xcee8('0x2')](_0xcee8('0x3'),_0xcee8('0x4'),_0xcee8('0x5'),_0xcee8('0x6'),'picklist'),'defaultValue':_0xcee8('0x3')},'content':{'type':Sequelize[_0xcee8('0x7')]},'key':{'type':Sequelize[_0xcee8('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xcee8('0x3'),_0xcee8('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcee8('0x7')]},'idField':{'type':Sequelize[_0xcee8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcee8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcee8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e2c08b5..706e1aa 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 _0x54cb=['where','merge','VIRTUAL','options','includeAll','include','Dynamics365Field','rows','show','params','keys','attributes','find','catch','create','body','destroy','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','undefined','limit','count','offset','status','Content-Range','json','apply','reject','save','update','then','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0xea860f,_0x4e877e){var _0x4ab3e7=function(_0x184a4d){while(--_0x184a4d){_0xea860f['push'](_0xea860f['shift']());}};_0x4ab3e7(++_0x4e877e);}(_0x54cb,0xe6));var _0xb54c=function(_0x1b904a,_0x45316a){_0x1b904a=_0x1b904a-0x0;var _0x20d02b=_0x54cb[_0x1b904a];return _0x20d02b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb54c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb54c('0x1'));var moment=require('moment');var BPromise=require(_0xb54c('0x2'));var Mustache=require(_0xb54c('0x3'));var util=require(_0xb54c('0x4'));var path=require(_0xb54c('0x5'));var sox=require(_0xb54c('0x6'));var csv=require(_0xb54c('0x7'));var ejs=require(_0xb54c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb54c('0x9'));var squel=require('squel');var crypto=require(_0xb54c('0xa'));var jsforce=require(_0xb54c('0xb'));var deskjs=require(_0xb54c('0xc'));var toCsv=require(_0xb54c('0x7'));var querystring=require(_0xb54c('0xd'));var Papa=require(_0xb54c('0xe'));var Redis=require('ioredis');var authService=require(_0xb54c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb54c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb54c('0x11'))('api');var utils=require(_0xb54c('0x12'));var config=require(_0xb54c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb54c('0x14'))['db'];function respondWithStatusCode(_0x1aa87e,_0x2a959c){_0x2a959c=_0x2a959c||0xcc;return function(_0x12b9b1){if(_0x12b9b1){return _0x1aa87e[_0xb54c('0x15')](_0x2a959c);}return _0x1aa87e['status'](_0x2a959c)['end']();};}function respondWithResult(_0x5ac1c4,_0x4e7445){_0x4e7445=_0x4e7445||0xc8;return function(_0x3d4560){if(_0x3d4560){return _0x5ac1c4['status'](_0x4e7445)['json'](_0x3d4560);}};}function respondWithFilteredResult(_0x415816,_0x63e9f1){return function(_0x435043){if(_0x435043){var _0xca1026=typeof _0x63e9f1['offset']===_0xb54c('0x16')&&typeof _0x63e9f1[_0xb54c('0x17')]==='undefined';var _0x4f9e71=_0x435043[_0xb54c('0x18')];var _0xf6cf74=_0xca1026?0x0:_0x63e9f1['offset'];var _0x4390bc=_0xca1026?_0x435043[_0xb54c('0x18')]:_0x63e9f1[_0xb54c('0x19')]+_0x63e9f1['limit'];var _0x31c7db;if(_0x4390bc>=_0x4f9e71){_0x4390bc=_0x4f9e71;_0x31c7db=0xc8;}else{_0x31c7db=0xce;}_0x415816[_0xb54c('0x1a')](_0x31c7db);return _0x415816['set'](_0xb54c('0x1b'),_0xf6cf74+'-'+_0x4390bc+'/'+_0x4f9e71)[_0xb54c('0x1c')](_0x435043);}return null;};}function patchUpdates(_0x1a580f){return function(_0x2f6af7){try{jsonpatch[_0xb54c('0x1d')](_0x2f6af7,_0x1a580f,!![]);}catch(_0x29b784){return BPromise[_0xb54c('0x1e')](_0x29b784);}return _0x2f6af7[_0xb54c('0x1f')]();};}function saveUpdates(_0x1b6a26,_0x3c8951){return function(_0x424caa){if(_0x424caa){return _0x424caa[_0xb54c('0x20')](_0x1b6a26)[_0xb54c('0x21')](function(_0x1d8f99){return _0x1d8f99;});}return null;};}function removeEntity(_0x33980b,_0x6c3063){return function(_0x294c73){if(_0x294c73){return _0x294c73['destroy']()[_0xb54c('0x21')](function(){_0x33980b[_0xb54c('0x1a')](0xcc)[_0xb54c('0x22')]();});}};}function handleEntityNotFound(_0x96d799,_0x19302e){return function(_0x54e2f1){if(!_0x54e2f1){_0x96d799[_0xb54c('0x15')](0x194);}return _0x54e2f1;};}function handleError(_0x30cd98,_0x4e6a60){_0x4e6a60=_0x4e6a60||0x1f4;return function(_0x45844b){logger['error'](_0x45844b[_0xb54c('0x23')]);if(_0x45844b['name']){delete _0x45844b[_0xb54c('0x24')];}_0x30cd98[_0xb54c('0x1a')](_0x4e6a60)['send'](_0x45844b);};}exports[_0xb54c('0x25')]=function(_0x3b4db3,_0x247783){var _0x339426={},_0x31d201={},_0x52ca36={'count':0x0,'rows':[]};var _0x5180d3=_[_0xb54c('0x26')](db['Dynamics365Field'][_0xb54c('0x27')],function(_0x477ce9){return{'name':_0x477ce9[_0xb54c('0x28')],'type':_0x477ce9[_0xb54c('0x29')][_0xb54c('0x2a')]};});_0x31d201[_0xb54c('0x2b')]=_[_0xb54c('0x26')](_0x5180d3,_0xb54c('0x24'));_0x31d201['query']=_['keys'](_0x3b4db3['query']);_0x31d201[_0xb54c('0x2c')]=_[_0xb54c('0x2d')](_0x31d201[_0xb54c('0x2b')],_0x31d201[_0xb54c('0x2e')]);_0x339426['attributes']=_[_0xb54c('0x2d')](_0x31d201['model'],qs[_0xb54c('0x2f')](_0x3b4db3[_0xb54c('0x2e')][_0xb54c('0x2f')]));_0x339426['attributes']=_0x339426['attributes'][_0xb54c('0x30')]?_0x339426['attributes']:_0x31d201[_0xb54c('0x2b')];if(!_0x3b4db3['query'][_0xb54c('0x31')](_0xb54c('0x32'))){_0x339426[_0xb54c('0x17')]=qs[_0xb54c('0x17')](_0x3b4db3[_0xb54c('0x2e')]['limit']);_0x339426[_0xb54c('0x19')]=qs['offset'](_0x3b4db3[_0xb54c('0x2e')][_0xb54c('0x19')]);}_0x339426[_0xb54c('0x33')]=qs[_0xb54c('0x34')](_0x3b4db3['query'][_0xb54c('0x34')]);_0x339426['where']=qs[_0xb54c('0x2c')](_['pick'](_0x3b4db3[_0xb54c('0x2e')],_0x31d201[_0xb54c('0x2c')]),_0x5180d3);if(_0x3b4db3[_0xb54c('0x2e')][_0xb54c('0x35')]){_0x339426[_0xb54c('0x36')]=_[_0xb54c('0x37')](_0x339426['where'],{'$or':_['map'](_0x5180d3,function(_0x537190){if(_0x537190[_0xb54c('0x29')]!==_0xb54c('0x38')){var _0x42f6ee={};_0x42f6ee[_0x537190['name']]={'$like':'%'+_0x3b4db3[_0xb54c('0x2e')][_0xb54c('0x35')]+'%'};return _0x42f6ee;}})});}_0x339426=_[_0xb54c('0x37')]({},_0x339426,_0x3b4db3[_0xb54c('0x39')]);var _0x9a8bdf={'where':_0x339426['where']};return db['Dynamics365Field']['count'](_0x9a8bdf)['then'](function(_0x195134){_0x52ca36[_0xb54c('0x18')]=_0x195134;if(_0x3b4db3['query'][_0xb54c('0x3a')]){_0x339426[_0xb54c('0x3b')]=[{'all':!![]}];}return db[_0xb54c('0x3c')]['findAll'](_0x339426);})[_0xb54c('0x21')](function(_0x226f28){_0x52ca36[_0xb54c('0x3d')]=_0x226f28;return _0x52ca36;})[_0xb54c('0x21')](respondWithFilteredResult(_0x247783,_0x339426))['catch'](handleError(_0x247783,null));};exports[_0xb54c('0x3e')]=function(_0x1e1390,_0x3b0519){var _0x580e8a={'raw':!![],'where':{'id':_0x1e1390[_0xb54c('0x3f')]['id']}},_0x3d8c63={};_0x3d8c63[_0xb54c('0x2b')]=_[_0xb54c('0x40')](db[_0xb54c('0x3c')][_0xb54c('0x27')]);_0x3d8c63['query']=_[_0xb54c('0x40')](_0x1e1390[_0xb54c('0x2e')]);_0x3d8c63['filters']=_[_0xb54c('0x2d')](_0x3d8c63['model'],_0x3d8c63['query']);_0x580e8a[_0xb54c('0x41')]=_[_0xb54c('0x2d')](_0x3d8c63[_0xb54c('0x2b')],qs[_0xb54c('0x2f')](_0x1e1390['query'][_0xb54c('0x2f')]));_0x580e8a[_0xb54c('0x41')]=_0x580e8a[_0xb54c('0x41')][_0xb54c('0x30')]?_0x580e8a[_0xb54c('0x41')]:_0x3d8c63['model'];if(_0x1e1390['query'][_0xb54c('0x3a')]){_0x580e8a[_0xb54c('0x3b')]=[{'all':!![]}];}_0x580e8a=_['merge']({},_0x580e8a,_0x1e1390['options']);return db[_0xb54c('0x3c')][_0xb54c('0x42')](_0x580e8a)['then'](handleEntityNotFound(_0x3b0519,null))[_0xb54c('0x21')](respondWithResult(_0x3b0519,null))[_0xb54c('0x43')](handleError(_0x3b0519,null));};exports[_0xb54c('0x44')]=function(_0x6a6d83,_0x4e7c76){return db[_0xb54c('0x3c')][_0xb54c('0x44')](_0x6a6d83[_0xb54c('0x45')],{})[_0xb54c('0x21')](respondWithResult(_0x4e7c76,0xc9))[_0xb54c('0x43')](handleError(_0x4e7c76,null));};exports[_0xb54c('0x20')]=function(_0x3220cc,_0x5ea558){if(_0x3220cc[_0xb54c('0x45')]['id']){delete _0x3220cc[_0xb54c('0x45')]['id'];}return db[_0xb54c('0x3c')][_0xb54c('0x42')]({'where':{'id':_0x3220cc[_0xb54c('0x3f')]['id']}})[_0xb54c('0x21')](handleEntityNotFound(_0x5ea558,null))[_0xb54c('0x21')](saveUpdates(_0x3220cc[_0xb54c('0x45')],null))[_0xb54c('0x21')](respondWithResult(_0x5ea558,null))['catch'](handleError(_0x5ea558,null));};exports[_0xb54c('0x46')]=function(_0x43197a,_0x4cbaa2){return db[_0xb54c('0x3c')][_0xb54c('0x42')]({'where':{'id':_0x43197a[_0xb54c('0x3f')]['id']}})[_0xb54c('0x21')](handleEntityNotFound(_0x4cbaa2,null))[_0xb54c('0x21')](removeEntity(_0x4cbaa2,null))['catch'](handleError(_0x4cbaa2,null));}; \ No newline at end of file +var _0x3588=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','name','index','Dynamics365Field','rawAttributes','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filters','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x587c45,_0x550ad1){var _0x50fac7=function(_0x18f3b9){while(--_0x18f3b9){_0x587c45['push'](_0x587c45['shift']());}};_0x50fac7(++_0x550ad1);}(_0x3588,0x171));var _0x8358=function(_0x25212e,_0x35c573){_0x25212e=_0x25212e-0x0;var _0xa65397=_0x3588[_0x25212e];return _0xa65397;};'use strict';var emlformat=require(_0x8358('0x0'));var rimraf=require(_0x8358('0x1'));var zipdir=require(_0x8358('0x2'));var jsonpatch=require(_0x8358('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8358('0x4'));var Mustache=require(_0x8358('0x5'));var util=require(_0x8358('0x6'));var path=require(_0x8358('0x7'));var sox=require(_0x8358('0x8'));var csv=require(_0x8358('0x9'));var ejs=require(_0x8358('0xa'));var fs=require('fs');var fs_extra=require(_0x8358('0xb'));var _=require('lodash');var squel=require(_0x8358('0xc'));var crypto=require(_0x8358('0xd'));var jsforce=require(_0x8358('0xe'));var deskjs=require(_0x8358('0xf'));var toCsv=require(_0x8358('0x9'));var querystring=require(_0x8358('0x10'));var Papa=require(_0x8358('0x11'));var Redis=require(_0x8358('0x12'));var authService=require(_0x8358('0x13'));var qs=require(_0x8358('0x14'));var as=require(_0x8358('0x15'));var hardwareService=require(_0x8358('0x16'));var logger=require('../../config/logger')(_0x8358('0x17'));var utils=require(_0x8358('0x18'));var config=require(_0x8358('0x19'));var licenseUtil=require(_0x8358('0x1a'));var db=require(_0x8358('0x1b'))['db'];function respondWithStatusCode(_0xe2318e,_0x36da22){_0x36da22=_0x36da22||0xcc;return function(_0xd1dfa0){if(_0xd1dfa0){return _0xe2318e[_0x8358('0x1c')](_0x36da22);}return _0xe2318e[_0x8358('0x1d')](_0x36da22)[_0x8358('0x1e')]();};}function respondWithResult(_0x2a9bb0,_0x46261b){_0x46261b=_0x46261b||0xc8;return function(_0x562f54){if(_0x562f54){return _0x2a9bb0[_0x8358('0x1d')](_0x46261b)[_0x8358('0x1f')](_0x562f54);}};}function respondWithFilteredResult(_0x3c81ea,_0x3c5594){return function(_0x17fc41){if(_0x17fc41){var _0x3d415a=typeof _0x3c5594[_0x8358('0x20')]===_0x8358('0x21')&&typeof _0x3c5594[_0x8358('0x22')]===_0x8358('0x21');var _0x455b33=_0x17fc41['count'];var _0x36f597=_0x3d415a?0x0:_0x3c5594['offset'];var _0x37e8c7=_0x3d415a?_0x17fc41[_0x8358('0x23')]:_0x3c5594[_0x8358('0x20')]+_0x3c5594[_0x8358('0x22')];var _0x1acafa;if(_0x37e8c7>=_0x455b33){_0x37e8c7=_0x455b33;_0x1acafa=0xc8;}else{_0x1acafa=0xce;}_0x3c81ea['status'](_0x1acafa);return _0x3c81ea['set'](_0x8358('0x24'),_0x36f597+'-'+_0x37e8c7+'/'+_0x455b33)[_0x8358('0x1f')](_0x17fc41);}return null;};}function patchUpdates(_0x185de8){return function(_0x23423e){try{jsonpatch['apply'](_0x23423e,_0x185de8,!![]);}catch(_0x40d8da){return BPromise['reject'](_0x40d8da);}return _0x23423e[_0x8358('0x25')]();};}function saveUpdates(_0x132a18,_0x1adc76){return function(_0x5f2d95){if(_0x5f2d95){return _0x5f2d95[_0x8358('0x26')](_0x132a18)[_0x8358('0x27')](function(_0x3dd29e){return _0x3dd29e;});}return null;};}function removeEntity(_0x510789,_0x1b6c07){return function(_0x101d7b){if(_0x101d7b){return _0x101d7b[_0x8358('0x28')]()[_0x8358('0x27')](function(){_0x510789[_0x8358('0x1d')](0xcc)[_0x8358('0x1e')]();});}};}function handleEntityNotFound(_0x517064,_0x278f04){return function(_0x2434d9){if(!_0x2434d9){_0x517064['sendStatus'](0x194);}return _0x2434d9;};}function handleError(_0x526550,_0x3b17fd){_0x3b17fd=_0x3b17fd||0x1f4;return function(_0x586f2d){logger[_0x8358('0x29')](_0x586f2d['stack']);if(_0x586f2d[_0x8358('0x2a')]){delete _0x586f2d['name'];}_0x526550[_0x8358('0x1d')](_0x3b17fd)['send'](_0x586f2d);};}exports[_0x8358('0x2b')]=function(_0x274e6a,_0xb1059){var _0x11e5d7={},_0x89a954={},_0x282481={'count':0x0,'rows':[]};var _0x12677c=_['map'](db[_0x8358('0x2c')][_0x8358('0x2d')],function(_0x4e261b){return{'name':_0x4e261b['fieldName'],'type':_0x4e261b[_0x8358('0x2e')]['key']};});_0x89a954[_0x8358('0x2f')]=_[_0x8358('0x30')](_0x12677c,_0x8358('0x2a'));_0x89a954[_0x8358('0x31')]=_['keys'](_0x274e6a[_0x8358('0x31')]);_0x89a954['filters']=_[_0x8358('0x32')](_0x89a954['model'],_0x89a954[_0x8358('0x31')]);_0x11e5d7['attributes']=_[_0x8358('0x32')](_0x89a954[_0x8358('0x2f')],qs[_0x8358('0x33')](_0x274e6a[_0x8358('0x31')][_0x8358('0x33')]));_0x11e5d7[_0x8358('0x34')]=_0x11e5d7[_0x8358('0x34')][_0x8358('0x35')]?_0x11e5d7[_0x8358('0x34')]:_0x89a954['model'];if(!_0x274e6a[_0x8358('0x31')][_0x8358('0x36')]('nolimit')){_0x11e5d7[_0x8358('0x22')]=qs['limit'](_0x274e6a[_0x8358('0x31')][_0x8358('0x22')]);_0x11e5d7[_0x8358('0x20')]=qs[_0x8358('0x20')](_0x274e6a['query']['offset']);}_0x11e5d7[_0x8358('0x37')]=qs[_0x8358('0x38')](_0x274e6a[_0x8358('0x31')][_0x8358('0x38')]);_0x11e5d7['where']=qs['filters'](_[_0x8358('0x39')](_0x274e6a[_0x8358('0x31')],_0x89a954[_0x8358('0x3a')]),_0x12677c);if(_0x274e6a[_0x8358('0x31')][_0x8358('0x3b')]){_0x11e5d7['where']=_[_0x8358('0x3c')](_0x11e5d7[_0x8358('0x3d')],{'$or':_[_0x8358('0x30')](_0x12677c,function(_0x3ce291){if(_0x3ce291[_0x8358('0x2e')]!=='VIRTUAL'){var _0x51d37c={};_0x51d37c[_0x3ce291[_0x8358('0x2a')]]={'$like':'%'+_0x274e6a[_0x8358('0x31')]['filter']+'%'};return _0x51d37c;}})});}_0x11e5d7=_['merge']({},_0x11e5d7,_0x274e6a[_0x8358('0x3e')]);var _0x18b098={'where':_0x11e5d7[_0x8358('0x3d')]};return db['Dynamics365Field'][_0x8358('0x23')](_0x18b098)[_0x8358('0x27')](function(_0xe30ada){_0x282481[_0x8358('0x23')]=_0xe30ada;if(_0x274e6a[_0x8358('0x31')][_0x8358('0x3f')]){_0x11e5d7[_0x8358('0x40')]=[{'all':!![]}];}return db[_0x8358('0x2c')][_0x8358('0x41')](_0x11e5d7);})[_0x8358('0x27')](function(_0x338470){_0x282481[_0x8358('0x42')]=_0x338470;return _0x282481;})[_0x8358('0x27')](respondWithFilteredResult(_0xb1059,_0x11e5d7))[_0x8358('0x43')](handleError(_0xb1059,null));};exports[_0x8358('0x44')]=function(_0xa0a344,_0x22618c){var _0x4ed43d={'raw':!![],'where':{'id':_0xa0a344[_0x8358('0x45')]['id']}},_0x52282f={};_0x52282f[_0x8358('0x2f')]=_[_0x8358('0x46')](db[_0x8358('0x2c')][_0x8358('0x2d')]);_0x52282f[_0x8358('0x31')]=_[_0x8358('0x46')](_0xa0a344[_0x8358('0x31')]);_0x52282f['filters']=_[_0x8358('0x32')](_0x52282f[_0x8358('0x2f')],_0x52282f[_0x8358('0x31')]);_0x4ed43d['attributes']=_[_0x8358('0x32')](_0x52282f[_0x8358('0x2f')],qs[_0x8358('0x33')](_0xa0a344[_0x8358('0x31')][_0x8358('0x33')]));_0x4ed43d[_0x8358('0x34')]=_0x4ed43d['attributes'][_0x8358('0x35')]?_0x4ed43d[_0x8358('0x34')]:_0x52282f[_0x8358('0x2f')];if(_0xa0a344[_0x8358('0x31')]['includeAll']){_0x4ed43d[_0x8358('0x40')]=[{'all':!![]}];}_0x4ed43d=_[_0x8358('0x3c')]({},_0x4ed43d,_0xa0a344[_0x8358('0x3e')]);return db[_0x8358('0x2c')][_0x8358('0x47')](_0x4ed43d)[_0x8358('0x27')](handleEntityNotFound(_0x22618c,null))['then'](respondWithResult(_0x22618c,null))['catch'](handleError(_0x22618c,null));};exports['create']=function(_0x337374,_0xf84f70){return db[_0x8358('0x2c')][_0x8358('0x48')](_0x337374[_0x8358('0x49')],{})['then'](respondWithResult(_0xf84f70,0xc9))['catch'](handleError(_0xf84f70,null));};exports[_0x8358('0x26')]=function(_0x3d87a3,_0x5be2ff){if(_0x3d87a3[_0x8358('0x49')]['id']){delete _0x3d87a3['body']['id'];}return db[_0x8358('0x2c')][_0x8358('0x47')]({'where':{'id':_0x3d87a3[_0x8358('0x45')]['id']}})[_0x8358('0x27')](handleEntityNotFound(_0x5be2ff,null))['then'](saveUpdates(_0x3d87a3[_0x8358('0x49')],null))[_0x8358('0x27')](respondWithResult(_0x5be2ff,null))[_0x8358('0x43')](handleError(_0x5be2ff,null));};exports['destroy']=function(_0x1aae83,_0x3ae605){return db[_0x8358('0x2c')]['find']({'where':{'id':_0x1aae83[_0x8358('0x45')]['id']}})[_0x8358('0x27')](handleEntityNotFound(_0x3ae605,null))[_0x8358('0x27')](removeEntity(_0x3ae605,null))[_0x8358('0x43')](handleError(_0x3ae605,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 0e3f5f0..65b7710 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 _0xa099=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0xd71e41,_0x168731){var _0x5d677c=function(_0x3cabc4){while(--_0x3cabc4){_0xd71e41['push'](_0xd71e41['shift']());}};_0x5d677c(++_0x168731);}(_0xa099,0x7a));var _0x9a09=function(_0x105d73,_0x4ac74e){_0x105d73=_0x105d73-0x0;var _0x403b0a=_0xa099[_0x105d73];return _0x403b0a;};'use strict';var _=require(_0x9a09('0x0'));var util=require('util');var logger=require(_0x9a09('0x1'))(_0x9a09('0x2'));var moment=require(_0x9a09('0x3'));var BPromise=require(_0x9a09('0x4'));var rp=require(_0x9a09('0x5'));var fs=require('fs');var path=require(_0x9a09('0x6'));var rimraf=require('rimraf');var config=require(_0x9a09('0x7'));var attributes=require(_0x9a09('0x8'));module[_0x9a09('0x9')]=function(_0x1ce233,_0xc10c46){return _0x1ce233[_0x9a09('0xa')](_0x9a09('0xb'),attributes,{'tableName':_0x9a09('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x9a09('0xd'),_0x9a09('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2fd5=['bluebird','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0xfdf243,_0x30a69f){var _0x5ea47c=function(_0x192956){while(--_0x192956){_0xfdf243['push'](_0xfdf243['shift']());}};_0x5ea47c(++_0x30a69f);}(_0x2fd5,0xdb));var _0x52fd=function(_0x182c07,_0x2d11cd){_0x182c07=_0x182c07-0x0;var _0x17b032=_0x2fd5[_0x182c07];return _0x17b032;};'use strict';var _=require(_0x52fd('0x0'));var util=require(_0x52fd('0x1'));var logger=require(_0x52fd('0x2'))(_0x52fd('0x3'));var moment=require(_0x52fd('0x4'));var BPromise=require(_0x52fd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52fd('0x6'));var attributes=require(_0x52fd('0x7'));module['exports']=function(_0x1c7527,_0x2e88ed){return _0x1c7527[_0x52fd('0x8')](_0x52fd('0x9'),attributes,{'tableName':_0x52fd('0xa'),'paranoid':![],'indexes':[{'name':_0x52fd('0xb'),'fields':[_0x52fd('0xc'),_0x52fd('0xd')],'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 33cee52..722741d 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 _0xca4a=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3fe584,_0x80f23d){var _0xce6f5d=function(_0x2fd2b9){while(--_0x2fd2b9){_0x3fe584['push'](_0x3fe584['shift']());}};_0xce6f5d(++_0x80f23d);}(_0xca4a,0x139));var _0xaca4=function(_0x2e0255,_0x469fed){_0x2e0255=_0x2e0255-0x0;var _0x370342=_0xca4a[_0x2e0255];return _0x370342;};'use strict';var _=require(_0xaca4('0x0'));var util=require(_0xaca4('0x1'));var moment=require('moment');var BPromise=require(_0xaca4('0x2'));var rs=require(_0xaca4('0x3'));var fs=require('fs');var Redis=require(_0xaca4('0x4'));var db=require(_0xaca4('0x5'))['db'];var utils=require(_0xaca4('0x6'));var logger=require(_0xaca4('0x7'))(_0xaca4('0x8'));var config=require('../../config/environment');var jayson=require(_0xaca4('0x9'));var client=jayson[_0xaca4('0xa')][_0xaca4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ca1e9,_0x36f4f6,_0x21c91c){return new BPromise(function(_0x253322,_0x5a8d76){return client[_0xaca4('0xc')](_0x3ca1e9,_0x21c91c)[_0xaca4('0xd')](function(_0x385126){logger[_0xaca4('0xe')](_0xaca4('0xf'),_0x36f4f6,_0xaca4('0x10'));logger[_0xaca4('0x11')](_0xaca4('0x12'),_0x36f4f6,'request\x20sent',JSON[_0xaca4('0x13')](_0x385126));if(_0x385126[_0xaca4('0x14')]){if(_0x385126[_0xaca4('0x14')][_0xaca4('0x15')]===0x1f4){logger[_0xaca4('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x36f4f6,_0x385126[_0xaca4('0x14')]['message']);return _0x5a8d76(_0x385126[_0xaca4('0x14')]['message']);}logger[_0xaca4('0x14')](_0xaca4('0xf'),_0x36f4f6,_0x385126['error'][_0xaca4('0x16')]);return _0x253322(_0x385126[_0xaca4('0x14')]['message']);}else{logger[_0xaca4('0xe')](_0xaca4('0xf'),_0x36f4f6,_0xaca4('0x10'));_0x253322(_0x385126[_0xaca4('0x17')][_0xaca4('0x16')]);}})['catch'](function(_0x52e174){logger[_0xaca4('0x14')](_0xaca4('0xf'),_0x36f4f6,_0x52e174);_0x5a8d76(_0x52e174);});});} \ No newline at end of file +var _0xff6f=['message','request\x20sent','result','catch','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b8838,_0x283894){var _0x38eedc=function(_0x55a5d1){while(--_0x55a5d1){_0x4b8838['push'](_0x4b8838['shift']());}};_0x38eedc(++_0x283894);}(_0xff6f,0x147));var _0xfff6=function(_0x531e85,_0x4c5f38){_0x531e85=_0x531e85-0x0;var _0x197b70=_0xff6f[_0x531e85];return _0x197b70;};'use strict';var _=require('lodash');var util=require(_0xfff6('0x0'));var moment=require('moment');var BPromise=require(_0xfff6('0x1'));var rs=require(_0xfff6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfff6('0x3'))(_0xfff6('0x4'));var config=require(_0xfff6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfff6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bdb92,_0x12a9ed,_0x248913){return new BPromise(function(_0x3ec208,_0x2cbe63){return client['request'](_0x1bdb92,_0x248913)[_0xfff6('0x7')](function(_0x5ea2b6){logger[_0xfff6('0x8')](_0xfff6('0x9'),_0x12a9ed,'request\x20sent');logger[_0xfff6('0xa')](_0xfff6('0xb'),_0x12a9ed,'request\x20sent',JSON[_0xfff6('0xc')](_0x5ea2b6));if(_0x5ea2b6['error']){if(_0x5ea2b6[_0xfff6('0xd')][_0xfff6('0xe')]===0x1f4){logger[_0xfff6('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x12a9ed,_0x5ea2b6[_0xfff6('0xd')][_0xfff6('0xf')]);return _0x2cbe63(_0x5ea2b6[_0xfff6('0xd')][_0xfff6('0xf')]);}logger[_0xfff6('0xd')](_0xfff6('0x9'),_0x12a9ed,_0x5ea2b6[_0xfff6('0xd')]['message']);return _0x3ec208(_0x5ea2b6[_0xfff6('0xd')][_0xfff6('0xf')]);}else{logger[_0xfff6('0x8')](_0xfff6('0x9'),_0x12a9ed,_0xfff6('0x10'));_0x3ec208(_0x5ea2b6[_0xfff6('0x11')][_0xfff6('0xf')]);}})[_0xfff6('0x12')](function(_0x1fb9a3){logger['error'](_0xfff6('0x9'),_0x12a9ed,_0x1fb9a3);_0x2cbe63(_0x1fb9a3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index d2509ea..e68b7f3 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 _0x72ff=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./intFreshdeskAccount.controller','get','index'];(function(_0x560e82,_0x58ea24){var _0x50d2a7=function(_0x596f24){while(--_0x596f24){_0x560e82['push'](_0x560e82['shift']());}};_0x50d2a7(++_0x58ea24);}(_0x72ff,0x1b0));var _0xf72f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x72ff[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xf72f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf72f('0x1'));var express=require(_0xf72f('0x2'));var router=express[_0xf72f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf72f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf72f('0x5'));router[_0xf72f('0x6')]('/',auth['isAuthenticated'](),controller[_0xf72f('0x7')]);router['get'](_0xf72f('0x8'),auth[_0xf72f('0x9')](),controller[_0xf72f('0xa')]);router[_0xf72f('0x6')](_0xf72f('0xb'),auth[_0xf72f('0x9')](),controller[_0xf72f('0xc')]);router[_0xf72f('0x6')](_0xf72f('0xd'),auth[_0xf72f('0x9')](),controller[_0xf72f('0xe')]);router[_0xf72f('0xf')]('/',auth[_0xf72f('0x9')](),controller[_0xf72f('0x10')]);router[_0xf72f('0xf')](_0xf72f('0xb'),auth[_0xf72f('0x9')](),controller[_0xf72f('0x11')]);router[_0xf72f('0x12')](_0xf72f('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf72f('0x13')](_0xf72f('0x8'),auth[_0xf72f('0x9')](),controller[_0xf72f('0x14')]);module[_0xf72f('0x15')]=router; \ No newline at end of file +var _0xeba2=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x142b05,_0x3952ac){var _0x4bee39=function(_0x580223){while(--_0x580223){_0x142b05['push'](_0x142b05['shift']());}};_0x4bee39(++_0x3952ac);}(_0xeba2,0x18e));var _0x2eba=function(_0x50a448,_0x3d1a4d){_0x50a448=_0x50a448-0x0;var _0x5da8c6=_0xeba2[_0x50a448];return _0x5da8c6;};'use strict';var multer=require(_0x2eba('0x0'));var util=require('util');var path=require(_0x2eba('0x1'));var timeout=require(_0x2eba('0x2'));var express=require(_0x2eba('0x3'));var router=express[_0x2eba('0x4')]();var fs_extra=require(_0x2eba('0x5'));var auth=require(_0x2eba('0x6'));var interaction=require(_0x2eba('0x7'));var config=require(_0x2eba('0x8'));var controller=require(_0x2eba('0x9'));router[_0x2eba('0xa')]('/',auth[_0x2eba('0xb')](),controller[_0x2eba('0xc')]);router[_0x2eba('0xa')](_0x2eba('0xd'),auth[_0x2eba('0xb')](),controller[_0x2eba('0xe')]);router[_0x2eba('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x2eba('0xf'),auth['isAuthenticated'](),controller[_0x2eba('0x10')]);router[_0x2eba('0x11')]('/',auth[_0x2eba('0xb')](),controller[_0x2eba('0x12')]);router['post'](_0x2eba('0x13'),auth['isAuthenticated'](),controller[_0x2eba('0x14')]);router[_0x2eba('0x15')](_0x2eba('0xd'),auth['isAuthenticated'](),controller[_0x2eba('0x16')]);router[_0x2eba('0x17')](_0x2eba('0xd'),auth[_0x2eba('0xb')](),controller['destroy']);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 3358862..c0512df 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68b3=['sequelize','exports','STRING','remoteUri'];(function(_0x215f2c,_0x4dbda1){var _0x193f9d=function(_0x4f3b3f){while(--_0x4f3b3f){_0x215f2c['push'](_0x215f2c['shift']());}};_0x193f9d(++_0x4dbda1);}(_0x68b3,0x1d8));var _0x368b=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x68b3[_0x5c4e16];return _0x36044a;};'use strict';var Sequelize=require(_0x368b('0x0'));module[_0x368b('0x1')]={'name':{'type':Sequelize[_0x368b('0x2')]},'description':{'type':Sequelize[_0x368b('0x2')]},'username':{'type':Sequelize[_0x368b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x368b('0x2')]},'remoteUri':{'type':Sequelize[_0x368b('0x2')],'unique':_0x368b('0x3')},'serverUrl':{'type':Sequelize[_0x368b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4213=['exports','STRING','username','remoteUri','sequelize'];(function(_0x100baa,_0x1659d0){var _0x50fbb2=function(_0x47c191){while(--_0x47c191){_0x100baa['push'](_0x100baa['shift']());}};_0x50fbb2(++_0x1659d0);}(_0x4213,0x77));var _0x3421=function(_0x4cbbc6,_0x2932a8){_0x4cbbc6=_0x4cbbc6-0x0;var _0x2db5bb=_0x4213[_0x4cbbc6];return _0x2db5bb;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')]},'description':{'type':Sequelize[_0x3421('0x2')]},'username':{'type':Sequelize[_0x3421('0x2')],'unique':_0x3421('0x3')},'apiKey':{'type':Sequelize[_0x3421('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3421('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index c6e0f1d..110820f 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 _0x8ae9=['addConfiguration','Subjects','getSubjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','apiKey','toString','base64','subject','agent','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','params','length','find','catch','create','body','getConfigurations','findOne','filters','filter','nolimit'];(function(_0xba846c,_0x2e9bad){var _0x495935=function(_0x316384){while(--_0x316384){_0xba846c['push'](_0xba846c['shift']());}};_0x495935(++_0x2e9bad);}(_0x8ae9,0x179));var _0x98ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ae9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x98ae('0x0'));var rimraf=require(_0x98ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x98ae('0x2'));var BPromise=require(_0x98ae('0x3'));var Mustache=require(_0x98ae('0x4'));var util=require('util');var path=require('path');var sox=require(_0x98ae('0x5'));var csv=require(_0x98ae('0x6'));var ejs=require(_0x98ae('0x7'));var fs=require('fs');var fs_extra=require(_0x98ae('0x8'));var _=require('lodash');var squel=require(_0x98ae('0x9'));var crypto=require(_0x98ae('0xa'));var jsforce=require(_0x98ae('0xb'));var deskjs=require(_0x98ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0x98ae('0xd'));var Papa=require(_0x98ae('0xe'));var Redis=require(_0x98ae('0xf'));var authService=require(_0x98ae('0x10'));var qs=require(_0x98ae('0x11'));var as=require(_0x98ae('0x12'));var hardwareService=require(_0x98ae('0x13'));var logger=require(_0x98ae('0x14'))(_0x98ae('0x15'));var utils=require('../../config/utils');var config=require(_0x98ae('0x16'));var licenseUtil=require(_0x98ae('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x98ae('0x18'));function respondWithStatusCode(_0x1637d7,_0x1e4575){_0x1e4575=_0x1e4575||0xcc;return function(_0x40e30a){if(_0x40e30a){return _0x1637d7['sendStatus'](_0x1e4575);}return _0x1637d7[_0x98ae('0x19')](_0x1e4575)[_0x98ae('0x1a')]();};}function respondWithResult(_0x5bc227,_0x42fbbf){_0x42fbbf=_0x42fbbf||0xc8;return function(_0x44f580){if(_0x44f580){return _0x5bc227[_0x98ae('0x19')](_0x42fbbf)['json'](_0x44f580);}};}function respondWithFilteredResult(_0x3d3861,_0x53604e){return function(_0x3476f1){if(_0x3476f1){var _0x530b86=typeof _0x53604e['offset']===_0x98ae('0x1b')&&typeof _0x53604e[_0x98ae('0x1c')]===_0x98ae('0x1b');var _0x43d40b=_0x3476f1['count'];var _0xb45dff=_0x530b86?0x0:_0x53604e['offset'];var _0xa1fd5d=_0x530b86?_0x3476f1[_0x98ae('0x1d')]:_0x53604e[_0x98ae('0x1e')]+_0x53604e['limit'];var _0x5163dc;if(_0xa1fd5d>=_0x43d40b){_0xa1fd5d=_0x43d40b;_0x5163dc=0xc8;}else{_0x5163dc=0xce;}_0x3d3861[_0x98ae('0x19')](_0x5163dc);return _0x3d3861[_0x98ae('0x1f')](_0x98ae('0x20'),_0xb45dff+'-'+_0xa1fd5d+'/'+_0x43d40b)['json'](_0x3476f1);}return null;};}function patchUpdates(_0x828d9){return function(_0x2c1a50){try{jsonpatch[_0x98ae('0x21')](_0x2c1a50,_0x828d9,!![]);}catch(_0x51ef31){return BPromise[_0x98ae('0x22')](_0x51ef31);}return _0x2c1a50[_0x98ae('0x23')]();};}function saveUpdates(_0x198491,_0x54b7fd){return function(_0x4ade15){if(_0x4ade15){return _0x4ade15[_0x98ae('0x24')](_0x198491)[_0x98ae('0x25')](function(_0x455449){return _0x455449;});}return null;};}function removeEntity(_0x47efeb,_0x122d22){return function(_0x261bb4){if(_0x261bb4){return _0x261bb4[_0x98ae('0x26')]()['then'](function(){_0x47efeb[_0x98ae('0x19')](0xcc)[_0x98ae('0x1a')]();});}};}function handleEntityNotFound(_0x4aa449,_0x59146a){return function(_0x51d235){if(!_0x51d235){_0x4aa449['sendStatus'](0x194);}return _0x51d235;};}function handleError(_0x3f308e,_0x1b96d8){_0x1b96d8=_0x1b96d8||0x1f4;return function(_0x34e7ad){logger[_0x98ae('0x27')](_0x34e7ad['stack']);if(_0x34e7ad['name']){delete _0x34e7ad[_0x98ae('0x28')];}_0x3f308e[_0x98ae('0x19')](_0x1b96d8)[_0x98ae('0x29')](_0x34e7ad);};}exports[_0x98ae('0x2a')]=function(_0xd42fa,_0xc2a637){var _0x2c43f0={},_0x25f782={},_0x4560ae={'count':0x0,'rows':[]};var _0x156081=_['map'](db[_0x98ae('0x2b')][_0x98ae('0x2c')],function(_0x49f1d0){return{'name':_0x49f1d0['fieldName'],'type':_0x49f1d0[_0x98ae('0x2d')][_0x98ae('0x2e')]};});_0x25f782[_0x98ae('0x2f')]=_[_0x98ae('0x30')](_0x156081,_0x98ae('0x28'));_0x25f782[_0x98ae('0x31')]=_[_0x98ae('0x32')](_0xd42fa[_0x98ae('0x31')]);_0x25f782['filters']=_[_0x98ae('0x33')](_0x25f782[_0x98ae('0x2f')],_0x25f782[_0x98ae('0x31')]);_0x2c43f0[_0x98ae('0x34')]=_[_0x98ae('0x33')](_0x25f782[_0x98ae('0x2f')],qs['fields'](_0xd42fa[_0x98ae('0x31')][_0x98ae('0x35')]));_0x2c43f0[_0x98ae('0x34')]=_0x2c43f0[_0x98ae('0x34')]['length']?_0x2c43f0[_0x98ae('0x34')]:_0x25f782['model'];if(!_0xd42fa[_0x98ae('0x31')][_0x98ae('0x36')]('nolimit')){_0x2c43f0[_0x98ae('0x1c')]=qs[_0x98ae('0x1c')](_0xd42fa['query'][_0x98ae('0x1c')]);_0x2c43f0[_0x98ae('0x1e')]=qs['offset'](_0xd42fa[_0x98ae('0x31')][_0x98ae('0x1e')]);}_0x2c43f0[_0x98ae('0x37')]=qs[_0x98ae('0x38')](_0xd42fa[_0x98ae('0x31')][_0x98ae('0x38')]);_0x2c43f0[_0x98ae('0x39')]=qs['filters'](_[_0x98ae('0x3a')](_0xd42fa[_0x98ae('0x31')],_0x25f782['filters']),_0x156081);if(_0xd42fa[_0x98ae('0x31')]['filter']){_0x2c43f0[_0x98ae('0x39')]=_[_0x98ae('0x3b')](_0x2c43f0[_0x98ae('0x39')],{'$or':_[_0x98ae('0x30')](_0x156081,function(_0x46f91a){if(_0x46f91a[_0x98ae('0x2d')]!==_0x98ae('0x3c')){var _0x1998b4={};_0x1998b4[_0x46f91a[_0x98ae('0x28')]]={'$like':'%'+_0xd42fa[_0x98ae('0x31')]['filter']+'%'};return _0x1998b4;}})});}_0x2c43f0=_[_0x98ae('0x3b')]({},_0x2c43f0,_0xd42fa[_0x98ae('0x3d')]);var _0x5693d3={'where':_0x2c43f0[_0x98ae('0x39')]};return db['FreshdeskAccount'][_0x98ae('0x1d')](_0x5693d3)[_0x98ae('0x25')](function(_0x2a4409){_0x4560ae['count']=_0x2a4409;if(_0xd42fa[_0x98ae('0x31')][_0x98ae('0x3e')]){_0x2c43f0[_0x98ae('0x3f')]=[{'all':!![]}];}return db[_0x98ae('0x2b')]['findAll'](_0x2c43f0);})[_0x98ae('0x25')](function(_0x3f7d52){_0x4560ae['rows']=_0x3f7d52;return _0x4560ae;})['then'](respondWithFilteredResult(_0xc2a637,_0x2c43f0))['catch'](handleError(_0xc2a637,null));};exports['show']=function(_0x39f94b,_0x39293b){var _0x363cb0={'raw':![],'where':{'id':_0x39f94b[_0x98ae('0x40')]['id']}},_0x481504={};_0x481504['model']=_[_0x98ae('0x32')](db[_0x98ae('0x2b')][_0x98ae('0x2c')]);_0x481504[_0x98ae('0x31')]=_[_0x98ae('0x32')](_0x39f94b[_0x98ae('0x31')]);_0x481504['filters']=_[_0x98ae('0x33')](_0x481504['model'],_0x481504[_0x98ae('0x31')]);_0x363cb0[_0x98ae('0x34')]=_['intersection'](_0x481504[_0x98ae('0x2f')],qs[_0x98ae('0x35')](_0x39f94b[_0x98ae('0x31')][_0x98ae('0x35')]));_0x363cb0[_0x98ae('0x34')]=_0x363cb0[_0x98ae('0x34')][_0x98ae('0x41')]?_0x363cb0[_0x98ae('0x34')]:_0x481504[_0x98ae('0x2f')];if(_0x39f94b[_0x98ae('0x31')][_0x98ae('0x3e')]){_0x363cb0['include']=[{'all':!![]}];}_0x363cb0=_[_0x98ae('0x3b')]({},_0x363cb0,_0x39f94b['options']);return db[_0x98ae('0x2b')][_0x98ae('0x42')](_0x363cb0)[_0x98ae('0x25')](handleEntityNotFound(_0x39293b,null))[_0x98ae('0x25')](respondWithResult(_0x39293b,null))[_0x98ae('0x43')](handleError(_0x39293b,null));};exports[_0x98ae('0x44')]=function(_0x2ed29a,_0x4be983){return db[_0x98ae('0x2b')]['create'](_0x2ed29a['body'],{})[_0x98ae('0x25')](respondWithResult(_0x4be983,0xc9))[_0x98ae('0x43')](handleError(_0x4be983,null));};exports['update']=function(_0x2b76b0,_0x28eacf){if(_0x2b76b0[_0x98ae('0x45')]['id']){delete _0x2b76b0[_0x98ae('0x45')]['id'];}return db[_0x98ae('0x2b')]['find']({'where':{'id':_0x2b76b0[_0x98ae('0x40')]['id']}})['then'](handleEntityNotFound(_0x28eacf,null))[_0x98ae('0x25')](saveUpdates(_0x2b76b0[_0x98ae('0x45')],null))[_0x98ae('0x25')](respondWithResult(_0x28eacf,null))[_0x98ae('0x43')](handleError(_0x28eacf,null));};exports[_0x98ae('0x26')]=function(_0xa4e569,_0x126a30){return db[_0x98ae('0x2b')][_0x98ae('0x42')]({'where':{'id':_0xa4e569[_0x98ae('0x40')]['id']}})[_0x98ae('0x25')](handleEntityNotFound(_0x126a30,null))[_0x98ae('0x25')](removeEntity(_0x126a30,null))['catch'](handleError(_0x126a30,null));};exports[_0x98ae('0x46')]=function(_0x4dae2c,_0x3b8cda,_0x30b5e0){var _0x24b684={};var _0x36fc3c={};var _0xd799d9;var _0x18099f;return db[_0x98ae('0x2b')][_0x98ae('0x47')]({'where':{'id':_0x4dae2c[_0x98ae('0x40')]['id']}})[_0x98ae('0x25')](handleEntityNotFound(_0x3b8cda,null))[_0x98ae('0x25')](function(_0x1bfc7d){if(_0x1bfc7d){_0xd799d9=_0x1bfc7d;_0x36fc3c[_0x98ae('0x2f')]=_[_0x98ae('0x32')](db['FreshdeskConfiguration']['rawAttributes']);_0x36fc3c[_0x98ae('0x31')]=_[_0x98ae('0x32')](_0x4dae2c[_0x98ae('0x31')]);_0x36fc3c[_0x98ae('0x48')]=_[_0x98ae('0x33')](_0x36fc3c[_0x98ae('0x2f')],_0x36fc3c[_0x98ae('0x31')]);_0x24b684[_0x98ae('0x34')]=_[_0x98ae('0x33')](_0x36fc3c[_0x98ae('0x2f')],qs[_0x98ae('0x35')](_0x4dae2c[_0x98ae('0x31')][_0x98ae('0x35')]));_0x24b684[_0x98ae('0x34')]=_0x24b684[_0x98ae('0x34')][_0x98ae('0x41')]?_0x24b684[_0x98ae('0x34')]:_0x36fc3c[_0x98ae('0x2f')];_0x24b684[_0x98ae('0x37')]=qs[_0x98ae('0x38')](_0x4dae2c[_0x98ae('0x31')][_0x98ae('0x38')]);_0x24b684[_0x98ae('0x39')]=qs[_0x98ae('0x48')](_[_0x98ae('0x3a')](_0x4dae2c[_0x98ae('0x31')],_0x36fc3c['filters']));if(_0x4dae2c[_0x98ae('0x31')]['filter']){_0x24b684['where']=_[_0x98ae('0x3b')](_0x24b684[_0x98ae('0x39')],{'$or':_[_0x98ae('0x30')](_0x24b684['attributes'],function(_0x59656a){var _0x2e5ee5={};_0x2e5ee5[_0x59656a]={'$like':'%'+_0x4dae2c['query'][_0x98ae('0x49')]+'%'};return _0x2e5ee5;})});}_0x24b684=_[_0x98ae('0x3b')]({},_0x24b684,_0x4dae2c[_0x98ae('0x3d')]);return _0xd799d9[_0x98ae('0x46')](_0x24b684);}})[_0x98ae('0x25')](function(_0x471df7){if(_0x471df7){_0x18099f=_0x471df7[_0x98ae('0x41')];if(!_0x4dae2c[_0x98ae('0x31')]['hasOwnProperty'](_0x98ae('0x4a'))){_0x24b684[_0x98ae('0x1c')]=qs[_0x98ae('0x1c')](_0x4dae2c['query'][_0x98ae('0x1c')]);_0x24b684[_0x98ae('0x1e')]=qs[_0x98ae('0x1e')](_0x4dae2c[_0x98ae('0x31')][_0x98ae('0x1e')]);}return _0xd799d9[_0x98ae('0x46')](_0x24b684);}})[_0x98ae('0x25')](function(_0x594f05){if(_0x594f05){return _0x594f05?{'count':_0x18099f,'rows':_0x594f05}:null;}})['then'](respondWithResult(_0x3b8cda,null))[_0x98ae('0x43')](handleError(_0x3b8cda,null));};exports[_0x98ae('0x4b')]=function(_0x33d96a,_0x32edd5,_0xa011d9){if(_0x33d96a[_0x98ae('0x45')]['id']){delete _0x33d96a['body']['id'];}return db['FreshdeskAccount'][_0x98ae('0x47')]({'where':{'id':_0x33d96a[_0x98ae('0x40')]['id']}})[_0x98ae('0x25')](handleEntityNotFound(_0x32edd5,null))['then'](function(_0x4f7d72){if(_0x4f7d72){_0x33d96a[_0x98ae('0x45')]['AccountId']=_0x4f7d72['id'];_0x33d96a['body'][_0x98ae('0x4c')]=integrations[_0x98ae('0x4d')](_0x33d96a['body']['channel'],_0x33d96a[_0x98ae('0x45')][_0x98ae('0x2d')]);_0x33d96a[_0x98ae('0x45')][_0x98ae('0x4e')]=integrations['getDescriptions'](_0x33d96a[_0x98ae('0x45')][_0x98ae('0x4f')],_0x33d96a[_0x98ae('0x45')][_0x98ae('0x2d')]);return db[_0x98ae('0x50')][_0x98ae('0x44')](_0x33d96a['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x98ae('0x4c')},{'model':db[_0x98ae('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x32edd5,null))[_0x98ae('0x43')](handleError(_0x32edd5,null));};exports[_0x98ae('0x52')]=function(_0x28c1eb,_0x3916a6,_0x4d6f00){var _0x2c34fc='';return db['FreshdeskAccount'][_0x98ae('0x47')]({'where':{'id':_0x28c1eb[_0x98ae('0x40')]['id']},'attributes':['id',_0x98ae('0x53'),'apiKey']})[_0x98ae('0x25')](handleEntityNotFound(_0x3916a6,null))[_0x98ae('0x25')](function(_0x2b3512){if(_0x2b3512){_0x2c34fc=_0x2b3512[_0x98ae('0x53')];var _0xea0fd0=_0x2c34fc[_0x98ae('0x54')](-0x1);if(_0xea0fd0==='/'){_0x2c34fc=_0x2c34fc[_0x98ae('0x55')](0x0,_0x2c34fc[_0x98ae('0x56')](_0xea0fd0));}return rp({'method':_0x98ae('0x57'),'uri':util[_0x98ae('0x58')](_0x98ae('0x59'),_0x2c34fc,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x98ae('0x58')](_0x98ae('0x5a'),new Buffer(util['format'](_0x98ae('0x5b'),_0x2b3512[_0x98ae('0x5c')]))[_0x98ae('0x5d')](_0x98ae('0x5e')))},'json':!![]});}})[_0x98ae('0x25')](function(_0x485d58){if(_0x485d58){var _0x31d7ea=['requester',_0x98ae('0x5f'),_0x98ae('0x60'),'description','status','priority',_0x98ae('0x61'),_0x98ae('0x62'),_0x98ae('0x63'),_0x98ae('0x61'),_0x98ae('0x64')];_[_0x98ae('0x65')](_0x485d58,function(_0x5eb5ab){return _0x31d7ea[_0x98ae('0x66')](_0x5eb5ab['name'])||!_0x5eb5ab[_0x98ae('0x67')]&&_0x5eb5ab[_0x98ae('0x2d')]!==_0x98ae('0x68')&&_0x5eb5ab[_0x98ae('0x2d')]!==_0x98ae('0x69');});return{'count':_0x485d58[_0x98ae('0x41')],'rows':_[_0x98ae('0x30')](_0x485d58,function(_0x98b874){return{'id':_0x98b874[_0x98ae('0x28')],'name':_0x98b874[_0x98ae('0x6a')],'custom':!_0x98b874[_0x98ae('0x67')],'options':_0x98b874[_0x98ae('0x6b')]?_[_0x98ae('0x30')](_0x98b874[_0x98ae('0x6b')],function(_0x3e950e){return{'name':_[_0x98ae('0x6c')](_0x3e950e),'value':_0x3e950e};}):[]};})};}})['then'](respondWithResult(_0x3916a6,null))[_0x98ae('0x43')](function(_0x423c75){var _0x5d968f=_0x28c1eb[_0x98ae('0x31')][_0x98ae('0x6d')]?0x1f4:_0x423c75[_0x98ae('0x6e')]||0x1f4;logger[_0x98ae('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x98ae('0x52'),_0x5d968f,JSON[_0x98ae('0x6f')](_0x423c75));delete _0x423c75['name'];if(_0x5d968f===0x191){_0x5d968f=0x190;}_0x3916a6[_0x98ae('0x19')](_0x5d968f)[_0x98ae('0x29')](_0x28c1eb[_0x98ae('0x31')][_0x98ae('0x6d')]?{'message':_0x98ae('0x70'),'statusCode':_0x423c75['statusCode']}:_0x423c75);});}; \ No newline at end of file +var _0x5b02=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','then','include','findAll','catch','show','params','includeAll','find','body','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','default','choices','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5b02,0xe9));var _0x25b0=function(_0x11910b,_0x42b33c){_0x11910b=_0x11910b-0x0;var _0x4caf61=_0x5b02[_0x11910b];return _0x4caf61;};'use strict';var emlformat=require(_0x25b0('0x0'));var rimraf=require(_0x25b0('0x1'));var zipdir=require(_0x25b0('0x2'));var jsonpatch=require(_0x25b0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25b0('0x4'));var Mustache=require('mustache');var util=require(_0x25b0('0x5'));var path=require(_0x25b0('0x6'));var sox=require(_0x25b0('0x7'));var csv=require(_0x25b0('0x8'));var ejs=require(_0x25b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var licenseUtil=require(_0x25b0('0x17'));var db=require(_0x25b0('0x18'))['db'];var integrations=require(_0x25b0('0x19'));function respondWithStatusCode(_0x184452,_0x26a34f){_0x26a34f=_0x26a34f||0xcc;return function(_0x2048dc){if(_0x2048dc){return _0x184452[_0x25b0('0x1a')](_0x26a34f);}return _0x184452[_0x25b0('0x1b')](_0x26a34f)[_0x25b0('0x1c')]();};}function respondWithResult(_0x293203,_0x211658){_0x211658=_0x211658||0xc8;return function(_0x418954){if(_0x418954){return _0x293203[_0x25b0('0x1b')](_0x211658)[_0x25b0('0x1d')](_0x418954);}};}function respondWithFilteredResult(_0x5ac18d,_0x51542b){return function(_0xfe1ea6){if(_0xfe1ea6){var _0x4b2357=typeof _0x51542b[_0x25b0('0x1e')]===_0x25b0('0x1f')&&typeof _0x51542b[_0x25b0('0x20')]===_0x25b0('0x1f');var _0x5e3a3a=_0xfe1ea6[_0x25b0('0x21')];var _0x213a77=_0x4b2357?0x0:_0x51542b[_0x25b0('0x1e')];var _0x385334=_0x4b2357?_0xfe1ea6[_0x25b0('0x21')]:_0x51542b[_0x25b0('0x1e')]+_0x51542b['limit'];var _0x348d36;if(_0x385334>=_0x5e3a3a){_0x385334=_0x5e3a3a;_0x348d36=0xc8;}else{_0x348d36=0xce;}_0x5ac18d[_0x25b0('0x1b')](_0x348d36);return _0x5ac18d[_0x25b0('0x22')](_0x25b0('0x23'),_0x213a77+'-'+_0x385334+'/'+_0x5e3a3a)[_0x25b0('0x1d')](_0xfe1ea6);}return null;};}function patchUpdates(_0xea4162){return function(_0x232be7){try{jsonpatch[_0x25b0('0x24')](_0x232be7,_0xea4162,!![]);}catch(_0x7bdaf9){return BPromise[_0x25b0('0x25')](_0x7bdaf9);}return _0x232be7[_0x25b0('0x26')]();};}function saveUpdates(_0x3ce1da,_0x5cb746){return function(_0x9f432e){if(_0x9f432e){return _0x9f432e[_0x25b0('0x27')](_0x3ce1da)['then'](function(_0x2d7c17){return _0x2d7c17;});}return null;};}function removeEntity(_0x2023d8,_0x3546f0){return function(_0x498fef){if(_0x498fef){return _0x498fef['destroy']()['then'](function(){_0x2023d8[_0x25b0('0x1b')](0xcc)[_0x25b0('0x1c')]();});}};}function handleEntityNotFound(_0x99bd3a,_0x24f847){return function(_0xdbb459){if(!_0xdbb459){_0x99bd3a[_0x25b0('0x1a')](0x194);}return _0xdbb459;};}function handleError(_0x40268a,_0x75ce7a){_0x75ce7a=_0x75ce7a||0x1f4;return function(_0x22e024){logger['error'](_0x22e024[_0x25b0('0x28')]);if(_0x22e024[_0x25b0('0x29')]){delete _0x22e024['name'];}_0x40268a['status'](_0x75ce7a)['send'](_0x22e024);};}exports[_0x25b0('0x2a')]=function(_0x3f0a54,_0x251fad){var _0x105129={},_0x214377={},_0x3285ae={'count':0x0,'rows':[]};var _0x12676b=_[_0x25b0('0x2b')](db[_0x25b0('0x2c')][_0x25b0('0x2d')],function(_0x1e217c){return{'name':_0x1e217c[_0x25b0('0x2e')],'type':_0x1e217c[_0x25b0('0x2f')]['key']};});_0x214377['model']=_[_0x25b0('0x2b')](_0x12676b,'name');_0x214377['query']=_[_0x25b0('0x30')](_0x3f0a54[_0x25b0('0x31')]);_0x214377[_0x25b0('0x32')]=_[_0x25b0('0x33')](_0x214377[_0x25b0('0x34')],_0x214377['query']);_0x105129[_0x25b0('0x35')]=_[_0x25b0('0x33')](_0x214377['model'],qs[_0x25b0('0x36')](_0x3f0a54[_0x25b0('0x31')]['fields']));_0x105129[_0x25b0('0x35')]=_0x105129['attributes'][_0x25b0('0x37')]?_0x105129[_0x25b0('0x35')]:_0x214377[_0x25b0('0x34')];if(!_0x3f0a54[_0x25b0('0x31')][_0x25b0('0x38')](_0x25b0('0x39'))){_0x105129[_0x25b0('0x20')]=qs[_0x25b0('0x20')](_0x3f0a54[_0x25b0('0x31')]['limit']);_0x105129[_0x25b0('0x1e')]=qs[_0x25b0('0x1e')](_0x3f0a54[_0x25b0('0x31')][_0x25b0('0x1e')]);}_0x105129[_0x25b0('0x3a')]=qs[_0x25b0('0x3b')](_0x3f0a54[_0x25b0('0x31')][_0x25b0('0x3b')]);_0x105129[_0x25b0('0x3c')]=qs[_0x25b0('0x32')](_['pick'](_0x3f0a54[_0x25b0('0x31')],_0x214377[_0x25b0('0x32')]),_0x12676b);if(_0x3f0a54[_0x25b0('0x31')]['filter']){_0x105129[_0x25b0('0x3c')]=_[_0x25b0('0x3d')](_0x105129[_0x25b0('0x3c')],{'$or':_[_0x25b0('0x2b')](_0x12676b,function(_0x17f67c){if(_0x17f67c[_0x25b0('0x2f')]!==_0x25b0('0x3e')){var _0x391493={};_0x391493[_0x17f67c['name']]={'$like':'%'+_0x3f0a54['query'][_0x25b0('0x3f')]+'%'};return _0x391493;}})});}_0x105129=_[_0x25b0('0x3d')]({},_0x105129,_0x3f0a54[_0x25b0('0x40')]);var _0x52c0af={'where':_0x105129[_0x25b0('0x3c')]};return db['FreshdeskAccount'][_0x25b0('0x21')](_0x52c0af)[_0x25b0('0x41')](function(_0xbd0db5){_0x3285ae[_0x25b0('0x21')]=_0xbd0db5;if(_0x3f0a54[_0x25b0('0x31')]['includeAll']){_0x105129[_0x25b0('0x42')]=[{'all':!![]}];}return db[_0x25b0('0x2c')][_0x25b0('0x43')](_0x105129);})[_0x25b0('0x41')](function(_0x428799){_0x3285ae['rows']=_0x428799;return _0x3285ae;})[_0x25b0('0x41')](respondWithFilteredResult(_0x251fad,_0x105129))[_0x25b0('0x44')](handleError(_0x251fad,null));};exports[_0x25b0('0x45')]=function(_0x44c400,_0x35fc00){var _0x1adf8d={'raw':![],'where':{'id':_0x44c400[_0x25b0('0x46')]['id']}},_0x51deba={};_0x51deba[_0x25b0('0x34')]=_[_0x25b0('0x30')](db[_0x25b0('0x2c')]['rawAttributes']);_0x51deba[_0x25b0('0x31')]=_['keys'](_0x44c400[_0x25b0('0x31')]);_0x51deba[_0x25b0('0x32')]=_[_0x25b0('0x33')](_0x51deba[_0x25b0('0x34')],_0x51deba['query']);_0x1adf8d[_0x25b0('0x35')]=_[_0x25b0('0x33')](_0x51deba[_0x25b0('0x34')],qs['fields'](_0x44c400[_0x25b0('0x31')][_0x25b0('0x36')]));_0x1adf8d[_0x25b0('0x35')]=_0x1adf8d[_0x25b0('0x35')][_0x25b0('0x37')]?_0x1adf8d[_0x25b0('0x35')]:_0x51deba[_0x25b0('0x34')];if(_0x44c400['query'][_0x25b0('0x47')]){_0x1adf8d[_0x25b0('0x42')]=[{'all':!![]}];}_0x1adf8d=_[_0x25b0('0x3d')]({},_0x1adf8d,_0x44c400['options']);return db[_0x25b0('0x2c')][_0x25b0('0x48')](_0x1adf8d)[_0x25b0('0x41')](handleEntityNotFound(_0x35fc00,null))[_0x25b0('0x41')](respondWithResult(_0x35fc00,null))[_0x25b0('0x44')](handleError(_0x35fc00,null));};exports['create']=function(_0x1e8a8d,_0x1cf933){return db[_0x25b0('0x2c')]['create'](_0x1e8a8d[_0x25b0('0x49')],{})[_0x25b0('0x41')](respondWithResult(_0x1cf933,0xc9))[_0x25b0('0x44')](handleError(_0x1cf933,null));};exports[_0x25b0('0x27')]=function(_0x29165e,_0x3d4531){if(_0x29165e['body']['id']){delete _0x29165e['body']['id'];}return db['FreshdeskAccount'][_0x25b0('0x48')]({'where':{'id':_0x29165e['params']['id']}})['then'](handleEntityNotFound(_0x3d4531,null))[_0x25b0('0x41')](saveUpdates(_0x29165e['body'],null))[_0x25b0('0x41')](respondWithResult(_0x3d4531,null))['catch'](handleError(_0x3d4531,null));};exports['destroy']=function(_0x394e52,_0x14a8a7){return db[_0x25b0('0x2c')][_0x25b0('0x48')]({'where':{'id':_0x394e52[_0x25b0('0x46')]['id']}})[_0x25b0('0x41')](handleEntityNotFound(_0x14a8a7,null))[_0x25b0('0x41')](removeEntity(_0x14a8a7,null))[_0x25b0('0x44')](handleError(_0x14a8a7,null));};exports[_0x25b0('0x4a')]=function(_0x20d56f,_0x48fb71,_0x4d3e9e){var _0x582f36={};var _0xf1e6bf={};var _0xa45e87;var _0x2a28fb;return db[_0x25b0('0x2c')][_0x25b0('0x4b')]({'where':{'id':_0x20d56f[_0x25b0('0x46')]['id']}})[_0x25b0('0x41')](handleEntityNotFound(_0x48fb71,null))['then'](function(_0x64ffa3){if(_0x64ffa3){_0xa45e87=_0x64ffa3;_0xf1e6bf['model']=_[_0x25b0('0x30')](db['FreshdeskConfiguration']['rawAttributes']);_0xf1e6bf[_0x25b0('0x31')]=_['keys'](_0x20d56f['query']);_0xf1e6bf[_0x25b0('0x32')]=_[_0x25b0('0x33')](_0xf1e6bf[_0x25b0('0x34')],_0xf1e6bf[_0x25b0('0x31')]);_0x582f36[_0x25b0('0x35')]=_[_0x25b0('0x33')](_0xf1e6bf[_0x25b0('0x34')],qs[_0x25b0('0x36')](_0x20d56f[_0x25b0('0x31')][_0x25b0('0x36')]));_0x582f36['attributes']=_0x582f36['attributes'][_0x25b0('0x37')]?_0x582f36[_0x25b0('0x35')]:_0xf1e6bf['model'];_0x582f36[_0x25b0('0x3a')]=qs[_0x25b0('0x3b')](_0x20d56f[_0x25b0('0x31')][_0x25b0('0x3b')]);_0x582f36[_0x25b0('0x3c')]=qs['filters'](_[_0x25b0('0x4c')](_0x20d56f[_0x25b0('0x31')],_0xf1e6bf[_0x25b0('0x32')]));if(_0x20d56f['query'][_0x25b0('0x3f')]){_0x582f36[_0x25b0('0x3c')]=_[_0x25b0('0x3d')](_0x582f36[_0x25b0('0x3c')],{'$or':_[_0x25b0('0x2b')](_0x582f36[_0x25b0('0x35')],function(_0x6f17a4){var _0x2ccf0c={};_0x2ccf0c[_0x6f17a4]={'$like':'%'+_0x20d56f[_0x25b0('0x31')][_0x25b0('0x3f')]+'%'};return _0x2ccf0c;})});}_0x582f36=_[_0x25b0('0x3d')]({},_0x582f36,_0x20d56f[_0x25b0('0x40')]);return _0xa45e87[_0x25b0('0x4a')](_0x582f36);}})[_0x25b0('0x41')](function(_0x561634){if(_0x561634){_0x2a28fb=_0x561634[_0x25b0('0x37')];if(!_0x20d56f[_0x25b0('0x31')]['hasOwnProperty'](_0x25b0('0x39'))){_0x582f36['limit']=qs[_0x25b0('0x20')](_0x20d56f[_0x25b0('0x31')]['limit']);_0x582f36[_0x25b0('0x1e')]=qs[_0x25b0('0x1e')](_0x20d56f[_0x25b0('0x31')]['offset']);}return _0xa45e87[_0x25b0('0x4a')](_0x582f36);}})['then'](function(_0x1be54a){if(_0x1be54a){return _0x1be54a?{'count':_0x2a28fb,'rows':_0x1be54a}:null;}})[_0x25b0('0x41')](respondWithResult(_0x48fb71,null))['catch'](handleError(_0x48fb71,null));};exports[_0x25b0('0x4d')]=function(_0x4457d1,_0x4efa96,_0x26e4fd){if(_0x4457d1['body']['id']){delete _0x4457d1['body']['id'];}return db['FreshdeskAccount'][_0x25b0('0x4b')]({'where':{'id':_0x4457d1[_0x25b0('0x46')]['id']}})[_0x25b0('0x41')](handleEntityNotFound(_0x4efa96,null))['then'](function(_0x45f175){if(_0x45f175){_0x4457d1[_0x25b0('0x49')][_0x25b0('0x4e')]=_0x45f175['id'];_0x4457d1[_0x25b0('0x49')][_0x25b0('0x4f')]=integrations[_0x25b0('0x50')](_0x4457d1[_0x25b0('0x49')][_0x25b0('0x51')],_0x4457d1[_0x25b0('0x49')][_0x25b0('0x2f')]);_0x4457d1[_0x25b0('0x49')][_0x25b0('0x52')]=integrations[_0x25b0('0x53')](_0x4457d1[_0x25b0('0x49')][_0x25b0('0x51')],_0x4457d1[_0x25b0('0x49')][_0x25b0('0x2f')]);return db['FreshdeskConfiguration'][_0x25b0('0x54')](_0x4457d1['body'],{'include':[{'model':db[_0x25b0('0x55')],'as':_0x25b0('0x4f')},{'model':db[_0x25b0('0x55')],'as':_0x25b0('0x52')}]});}return null;})['then'](respondWithResult(_0x4efa96,null))[_0x25b0('0x44')](handleError(_0x4efa96,null));};exports[_0x25b0('0x56')]=function(_0x3e326c,_0x2217e7,_0x46a1d1){var _0x19e49c='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x3e326c[_0x25b0('0x46')]['id']},'attributes':['id','remoteUri',_0x25b0('0x57')]})[_0x25b0('0x41')](handleEntityNotFound(_0x2217e7,null))[_0x25b0('0x41')](function(_0x5279ab){if(_0x5279ab){_0x19e49c=_0x5279ab[_0x25b0('0x58')];var _0x1259ad=_0x19e49c[_0x25b0('0x59')](-0x1);if(_0x1259ad==='/'){_0x19e49c=_0x19e49c[_0x25b0('0x5a')](0x0,_0x19e49c['lastIndexOf'](_0x1259ad));}return rp({'method':_0x25b0('0x5b'),'uri':util[_0x25b0('0x5c')](_0x25b0('0x5d'),_0x19e49c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x25b0('0x5c')](_0x25b0('0x5e'),new Buffer(util[_0x25b0('0x5c')](_0x25b0('0x5f'),_0x5279ab[_0x25b0('0x57')]))[_0x25b0('0x60')](_0x25b0('0x61')))},'json':!![]});}})[_0x25b0('0x41')](function(_0x55a48d){if(_0x55a48d){var _0x1f5757=[_0x25b0('0x62'),_0x25b0('0x63'),_0x25b0('0x64'),'description','status',_0x25b0('0x65'),_0x25b0('0x66'),_0x25b0('0x67'),_0x25b0('0x68'),'group',_0x25b0('0x69')];_[_0x25b0('0x6a')](_0x55a48d,function(_0x4876a4){return _0x1f5757[_0x25b0('0x6b')](_0x4876a4[_0x25b0('0x29')])||!_0x4876a4['default']&&_0x4876a4['type']!==_0x25b0('0x6c')&&_0x4876a4[_0x25b0('0x2f')]!==_0x25b0('0x6d');});return{'count':_0x55a48d[_0x25b0('0x37')],'rows':_[_0x25b0('0x2b')](_0x55a48d,function(_0x171d80){return{'id':_0x171d80[_0x25b0('0x29')],'name':_0x171d80[_0x25b0('0x6e')],'custom':!_0x171d80[_0x25b0('0x6f')],'options':_0x171d80[_0x25b0('0x70')]?_[_0x25b0('0x2b')](_0x171d80[_0x25b0('0x70')],function(_0x217f16){return{'name':_['capitalize'](_0x217f16),'value':_0x217f16};}):[]};})};}})[_0x25b0('0x41')](respondWithResult(_0x2217e7,null))['catch'](function(_0x472ae1){var _0x46a839=_0x3e326c['query'][_0x25b0('0x71')]?0x1f4:_0x472ae1[_0x25b0('0x72')]||0x1f4;logger[_0x25b0('0x73')](_0x25b0('0x74'),_0x25b0('0x56'),_0x46a839,JSON[_0x25b0('0x75')](_0x472ae1));delete _0x472ae1[_0x25b0('0x29')];if(_0x46a839===0x191){_0x46a839=0x190;}_0x2217e7[_0x25b0('0x1b')](_0x46a839)[_0x25b0('0x76')](_0x3e326c[_0x25b0('0x31')][_0x25b0('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x472ae1['statusCode']}:_0x472ae1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 428af5f..be8800b 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 _0xeb9c=['../../config/logger','bluebird','request-promise','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x41b8f9,_0x2e5a01){var _0x5145d1=function(_0x1aafe9){while(--_0x1aafe9){_0x41b8f9['push'](_0x41b8f9['shift']());}};_0x5145d1(++_0x2e5a01);}(_0xeb9c,0x1d2));var _0xceb9=function(_0x452fec,_0x15cf4e){_0x452fec=_0x452fec-0x0;var _0x646fd3=_0xeb9c[_0x452fec];return _0x646fd3;};'use strict';var _=require(_0xceb9('0x0'));var util=require(_0xceb9('0x1'));var logger=require(_0xceb9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xceb9('0x3'));var rp=require(_0xceb9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xceb9('0x5'));module['exports']=function(_0x29024d,_0x9e26d8){return _0x29024d[_0xceb9('0x6')](_0xceb9('0x7'),attributes,{'tableName':_0xceb9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4c4=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x6982f4,_0x1bdb2d){var _0x4a2a5f=function(_0x432de7){while(--_0x432de7){_0x6982f4['push'](_0x6982f4['shift']());}};_0x4a2a5f(++_0x1bdb2d);}(_0xe4c4,0x9c));var _0x4e4c=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0xe4c4[_0x4de9e8];return _0x4db0de;};'use strict';var _=require(_0x4e4c('0x0'));var util=require(_0x4e4c('0x1'));var logger=require(_0x4e4c('0x2'))('api');var moment=require(_0x4e4c('0x3'));var BPromise=require(_0x4e4c('0x4'));var rp=require(_0x4e4c('0x5'));var fs=require('fs');var path=require(_0x4e4c('0x6'));var rimraf=require('rimraf');var config=require(_0x4e4c('0x7'));var attributes=require(_0x4e4c('0x8'));var integrations=require(_0x4e4c('0x9'));module['exports']=function(_0x5bb4e8,_0x5dc30b){return _0x5bb4e8[_0x4e4c('0xa')](_0x4e4c('0xb'),attributes,{'tableName':_0x4e4c('0xc'),'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 e827d85..69eddf0 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 _0x3c0c=['request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','map','model','debug','ShowFreshdeskAccount','find','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x3c0c,0x162));var _0xc3c0=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3c0c[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xc3c0('0x0'));var util=require(_0xc3c0('0x1'));var moment=require(_0xc3c0('0x2'));var BPromise=require(_0xc3c0('0x3'));var rs=require(_0xc3c0('0x4'));var fs=require('fs');var Redis=require(_0xc3c0('0x5'));var db=require(_0xc3c0('0x6'))['db'];var utils=require(_0xc3c0('0x7'));var logger=require(_0xc3c0('0x8'))(_0xc3c0('0x9'));var config=require(_0xc3c0('0xa'));var jayson=require(_0xc3c0('0xb'));var client=jayson[_0xc3c0('0xc')][_0xc3c0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c0d2e,_0x2d4c26,_0x333c0c){return new BPromise(function(_0x2cc9bd,_0x169124){return client[_0xc3c0('0xe')](_0x3c0d2e,_0x333c0c)['then'](function(_0x54b4e8){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2d4c26,'request\x20sent');logger['debug'](_0xc3c0('0xf'),_0x2d4c26,_0xc3c0('0x10'),JSON[_0xc3c0('0x11')](_0x54b4e8));if(_0x54b4e8[_0xc3c0('0x12')]){if(_0x54b4e8['error']['code']===0x1f4){logger['error'](_0xc3c0('0x13'),_0x2d4c26,_0x54b4e8[_0xc3c0('0x12')][_0xc3c0('0x14')]);return _0x169124(_0x54b4e8['error']['message']);}logger[_0xc3c0('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x2d4c26,_0x54b4e8[_0xc3c0('0x12')]['message']);return _0x2cc9bd(_0x54b4e8[_0xc3c0('0x12')][_0xc3c0('0x14')]);}else{logger[_0xc3c0('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x2d4c26,_0xc3c0('0x10'));_0x2cc9bd(_0x54b4e8[_0xc3c0('0x16')][_0xc3c0('0x14')]);}})[_0xc3c0('0x17')](function(_0x2fc7df){logger['error'](_0xc3c0('0x13'),_0x2d4c26,_0x2fc7df);_0x169124(_0x2fc7df);});});}exports[_0xc3c0('0x18')]=function(_0x4c5705){var _0x43f0e6=this;return new Promise(function(_0x4febcc,_0x58010f){return db[_0xc3c0('0x19')][_0xc3c0('0x1a')]({'raw':_0x4c5705[_0xc3c0('0x1b')]?_0x4c5705[_0xc3c0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4c5705[_0xc3c0('0x1b')]?_0x4c5705[_0xc3c0('0x1b')][_0xc3c0('0x1c')]||null:null,'attributes':_0x4c5705['options']?_0x4c5705[_0xc3c0('0x1b')]['attributes']||null:null,'limit':_0x4c5705['options']?_0x4c5705[_0xc3c0('0x1b')][_0xc3c0('0x1d')]||null:null,'include':_0x4c5705[_0xc3c0('0x1b')]?_0x4c5705[_0xc3c0('0x1b')][_0xc3c0('0x1e')]?_['map'](_0x4c5705['options'][_0xc3c0('0x1e')],function(_0x1dba17){return{'model':db[_0x1dba17['model']],'as':_0x1dba17['as'],'attributes':_0x1dba17['attributes'],'include':_0x1dba17['include']?_[_0xc3c0('0x1f')](_0x1dba17['include'],function(_0x3aa854){return{'model':db[_0x3aa854[_0xc3c0('0x20')]],'as':_0x3aa854['as'],'attributes':_0x3aa854['attributes'],'include':_0x3aa854[_0xc3c0('0x1e')]?_[_0xc3c0('0x1f')](_0x3aa854[_0xc3c0('0x1e')],function(_0x4ae1e9){return{'model':db[_0x4ae1e9['model']],'as':_0x4ae1e9['as'],'attributes':_0x4ae1e9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27e6a7){logger['info'](_0xc3c0('0x18'),_0x4c5705);logger[_0xc3c0('0x21')]('GetFreshdeskAccount',_0x4c5705,JSON[_0xc3c0('0x11')](_0x27e6a7));_0x4febcc(_0x27e6a7);})[_0xc3c0('0x17')](function(_0x479614){logger[_0xc3c0('0x12')](_0xc3c0('0x18'),_0x479614[_0xc3c0('0x14')],_0x4c5705);_0x58010f(_0x43f0e6[_0xc3c0('0x12')](0x1f4,_0x479614['message']));});});};exports[_0xc3c0('0x22')]=function(_0x46a7f8){var _0x52dd01=this;return new Promise(function(_0x3297fb,_0x4aefad){return db[_0xc3c0('0x19')][_0xc3c0('0x23')]({'raw':_0x46a7f8[_0xc3c0('0x1b')]?_0x46a7f8[_0xc3c0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x46a7f8[_0xc3c0('0x1b')]?_0x46a7f8[_0xc3c0('0x1b')]['where']||null:null,'attributes':_0x46a7f8[_0xc3c0('0x1b')]?_0x46a7f8['options'][_0xc3c0('0x24')]||null:null,'include':_0x46a7f8[_0xc3c0('0x1b')]?_0x46a7f8[_0xc3c0('0x1b')][_0xc3c0('0x1e')]?_['map'](_0x46a7f8['options']['include'],function(_0x4f1582){return{'model':db[_0x4f1582['model']],'as':_0x4f1582['as'],'attributes':_0x4f1582[_0xc3c0('0x24')],'include':_0x4f1582[_0xc3c0('0x1e')]?_['map'](_0x4f1582[_0xc3c0('0x1e')],function(_0x2f224e){return{'model':db[_0x2f224e[_0xc3c0('0x20')]],'as':_0x2f224e['as'],'attributes':_0x2f224e[_0xc3c0('0x24')],'include':_0x2f224e[_0xc3c0('0x1e')]?_[_0xc3c0('0x1f')](_0x2f224e[_0xc3c0('0x1e')],function(_0x16ab99){return{'model':db[_0x16ab99[_0xc3c0('0x20')]],'as':_0x16ab99['as'],'attributes':_0x16ab99['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb68992){logger[_0xc3c0('0x15')](_0xc3c0('0x22'),_0x46a7f8);logger['debug'](_0xc3c0('0x22'),_0x46a7f8,JSON[_0xc3c0('0x11')](_0xb68992));_0x3297fb(_0xb68992);})[_0xc3c0('0x17')](function(_0x48eeb8){logger[_0xc3c0('0x12')]('ShowFreshdeskAccount',_0x48eeb8[_0xc3c0('0x14')],_0x46a7f8);_0x4aefad(_0x52dd01['error'](0x1f4,_0x48eeb8[_0xc3c0('0x14')]));});});}; \ No newline at end of file +var _0xe41f=['ShowFreshdeskAccount','find','where','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','stringify'];(function(_0x3033f6,_0x373775){var _0x151d04=function(_0xdcf301){while(--_0xdcf301){_0x3033f6['push'](_0x3033f6['shift']());}};_0x151d04(++_0x373775);}(_0xe41f,0x13e));var _0xfe41=function(_0x57c91f,_0x2e6c28){_0x57c91f=_0x57c91f-0x0;var _0x3e557c=_0xe41f[_0x57c91f];return _0x3e557c;};'use strict';var _=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var moment=require(_0xfe41('0x2'));var BPromise=require(_0xfe41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe41('0x4'));var logger=require(_0xfe41('0x5'))(_0xfe41('0x6'));var config=require(_0xfe41('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfe41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x519fb6,_0xf28c37,_0x224ed7){return new BPromise(function(_0x4f92d3,_0x224a23){return client[_0xfe41('0x9')](_0x519fb6,_0x224ed7)[_0xfe41('0xa')](function(_0x4c39e9){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xf28c37,'request\x20sent');logger[_0xfe41('0xb')](_0xfe41('0xc'),_0xf28c37,_0xfe41('0xd'),JSON['stringify'](_0x4c39e9));if(_0x4c39e9[_0xfe41('0xe')]){if(_0x4c39e9[_0xfe41('0xe')][_0xfe41('0xf')]===0x1f4){logger['error'](_0xfe41('0x10'),_0xf28c37,_0x4c39e9[_0xfe41('0xe')]['message']);return _0x224a23(_0x4c39e9[_0xfe41('0xe')][_0xfe41('0x11')]);}logger[_0xfe41('0xe')](_0xfe41('0x10'),_0xf28c37,_0x4c39e9[_0xfe41('0xe')]['message']);return _0x4f92d3(_0x4c39e9[_0xfe41('0xe')][_0xfe41('0x11')]);}else{logger[_0xfe41('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0xf28c37,'request\x20sent');_0x4f92d3(_0x4c39e9[_0xfe41('0x13')][_0xfe41('0x11')]);}})[_0xfe41('0x14')](function(_0x199644){logger['error'](_0xfe41('0x10'),_0xf28c37,_0x199644);_0x224a23(_0x199644);});});}exports[_0xfe41('0x15')]=function(_0x119a8d){var _0x1d810e=this;return new Promise(function(_0x27de87,_0x1fee43){return db[_0xfe41('0x16')][_0xfe41('0x17')]({'raw':_0x119a8d[_0xfe41('0x18')]?_0x119a8d[_0xfe41('0x18')][_0xfe41('0x19')]===undefined?!![]:![]:!![],'where':_0x119a8d[_0xfe41('0x18')]?_0x119a8d[_0xfe41('0x18')]['where']||null:null,'attributes':_0x119a8d[_0xfe41('0x18')]?_0x119a8d[_0xfe41('0x18')][_0xfe41('0x1a')]||null:null,'limit':_0x119a8d[_0xfe41('0x18')]?_0x119a8d[_0xfe41('0x18')][_0xfe41('0x1b')]||null:null,'include':_0x119a8d[_0xfe41('0x18')]?_0x119a8d[_0xfe41('0x18')][_0xfe41('0x1c')]?_[_0xfe41('0x1d')](_0x119a8d[_0xfe41('0x18')][_0xfe41('0x1c')],function(_0x5afe19){return{'model':db[_0x5afe19[_0xfe41('0x1e')]],'as':_0x5afe19['as'],'attributes':_0x5afe19[_0xfe41('0x1a')],'include':_0x5afe19[_0xfe41('0x1c')]?_[_0xfe41('0x1d')](_0x5afe19[_0xfe41('0x1c')],function(_0x5aefb9){return{'model':db[_0x5aefb9[_0xfe41('0x1e')]],'as':_0x5aefb9['as'],'attributes':_0x5aefb9[_0xfe41('0x1a')],'include':_0x5aefb9[_0xfe41('0x1c')]?_[_0xfe41('0x1d')](_0x5aefb9[_0xfe41('0x1c')],function(_0x5c72d8){return{'model':db[_0x5c72d8[_0xfe41('0x1e')]],'as':_0x5c72d8['as'],'attributes':_0x5c72d8[_0xfe41('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfe41('0xa')](function(_0x422d80){logger[_0xfe41('0x12')](_0xfe41('0x15'),_0x119a8d);logger[_0xfe41('0xb')]('GetFreshdeskAccount',_0x119a8d,JSON[_0xfe41('0x1f')](_0x422d80));_0x27de87(_0x422d80);})[_0xfe41('0x14')](function(_0x4a3df2){logger[_0xfe41('0xe')]('GetFreshdeskAccount',_0x4a3df2[_0xfe41('0x11')],_0x119a8d);_0x1fee43(_0x1d810e['error'](0x1f4,_0x4a3df2[_0xfe41('0x11')]));});});};exports[_0xfe41('0x20')]=function(_0x25fb52){var _0x2edee5=this;return new Promise(function(_0x33bc2c,_0x83d5ab){return db['FreshdeskAccount'][_0xfe41('0x21')]({'raw':_0x25fb52[_0xfe41('0x18')]?_0x25fb52[_0xfe41('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x25fb52[_0xfe41('0x18')]?_0x25fb52['options'][_0xfe41('0x22')]||null:null,'attributes':_0x25fb52[_0xfe41('0x18')]?_0x25fb52[_0xfe41('0x18')][_0xfe41('0x1a')]||null:null,'include':_0x25fb52[_0xfe41('0x18')]?_0x25fb52[_0xfe41('0x18')][_0xfe41('0x1c')]?_[_0xfe41('0x1d')](_0x25fb52['options'][_0xfe41('0x1c')],function(_0x1fea7c){return{'model':db[_0x1fea7c[_0xfe41('0x1e')]],'as':_0x1fea7c['as'],'attributes':_0x1fea7c['attributes'],'include':_0x1fea7c[_0xfe41('0x1c')]?_[_0xfe41('0x1d')](_0x1fea7c[_0xfe41('0x1c')],function(_0xc45c16){return{'model':db[_0xc45c16[_0xfe41('0x1e')]],'as':_0xc45c16['as'],'attributes':_0xc45c16[_0xfe41('0x1a')],'include':_0xc45c16[_0xfe41('0x1c')]?_[_0xfe41('0x1d')](_0xc45c16[_0xfe41('0x1c')],function(_0x26a662){return{'model':db[_0x26a662[_0xfe41('0x1e')]],'as':_0x26a662['as'],'attributes':_0x26a662['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe41('0xa')](function(_0x840506){logger[_0xfe41('0x12')](_0xfe41('0x20'),_0x25fb52);logger[_0xfe41('0xb')]('ShowFreshdeskAccount',_0x25fb52,JSON[_0xfe41('0x1f')](_0x840506));_0x33bc2c(_0x840506);})['catch'](function(_0x1126e2){logger['error'](_0xfe41('0x20'),_0x1126e2[_0xfe41('0x11')],_0x25fb52);_0x83d5ab(_0x2edee5[_0xfe41('0xe')](0x1f4,_0x1126e2[_0xfe41('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cab9cbd..d0fbf0c 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 _0x2a30=['delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','getTags','post','create','/:id/tags','setTags','put','update'];(function(_0x4da6d2,_0x811b9a){var _0x278f55=function(_0x361b13){while(--_0x361b13){_0x4da6d2['push'](_0x4da6d2['shift']());}};_0x278f55(++_0x811b9a);}(_0x2a30,0xb2));var _0x02a3=function(_0x4009d0,_0x3bfd48){_0x4009d0=_0x4009d0-0x0;var _0x145771=_0x2a30[_0x4009d0];return _0x145771;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x02a3('0x0'));var timeout=require(_0x02a3('0x1'));var express=require('express');var router=express[_0x02a3('0x2')]();var fs_extra=require(_0x02a3('0x3'));var auth=require(_0x02a3('0x4'));var interaction=require(_0x02a3('0x5'));var config=require(_0x02a3('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x02a3('0x7')](),controller[_0x02a3('0x8')]);router[_0x02a3('0x9')](_0x02a3('0xa'),auth[_0x02a3('0x7')](),controller[_0x02a3('0xb')]);router['get'](_0x02a3('0xc'),auth[_0x02a3('0x7')](),controller['getFields']);router['get'](_0x02a3('0xd'),auth[_0x02a3('0x7')](),controller[_0x02a3('0xe')]);router[_0x02a3('0x9')]('/:id/descriptions',auth[_0x02a3('0x7')](),controller['getDescriptions']);router[_0x02a3('0x9')]('/:id/tags',auth[_0x02a3('0x7')](),controller[_0x02a3('0xf')]);router[_0x02a3('0x10')]('/',auth[_0x02a3('0x7')](),controller[_0x02a3('0x11')]);router[_0x02a3('0x10')](_0x02a3('0x12'),auth[_0x02a3('0x7')](),controller[_0x02a3('0x13')]);router[_0x02a3('0x14')]('/:id',auth[_0x02a3('0x7')](),controller[_0x02a3('0x15')]);router[_0x02a3('0x16')]('/:id',auth[_0x02a3('0x7')](),controller[_0x02a3('0x17')]);module[_0x02a3('0x18')]=router; \ No newline at end of file +var _0x7d34=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','put','update','delete','exports','multer'];(function(_0x177d9a,_0x457fcb){var _0x1026fa=function(_0x320d09){while(--_0x320d09){_0x177d9a['push'](_0x177d9a['shift']());}};_0x1026fa(++_0x457fcb);}(_0x7d34,0x1af));var _0x47d3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7d34[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x47d3('0x0'));var util=require(_0x47d3('0x1'));var path=require(_0x47d3('0x2'));var timeout=require(_0x47d3('0x3'));var express=require('express');var router=express[_0x47d3('0x4')]();var fs_extra=require(_0x47d3('0x5'));var auth=require(_0x47d3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47d3('0x7'));var controller=require(_0x47d3('0x8'));router['get']('/',auth[_0x47d3('0x9')](),controller[_0x47d3('0xa')]);router[_0x47d3('0xb')](_0x47d3('0xc'),auth[_0x47d3('0x9')](),controller[_0x47d3('0xd')]);router['get']('/:id/fields',auth[_0x47d3('0x9')](),controller[_0x47d3('0xe')]);router[_0x47d3('0xb')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x47d3('0xf')]);router['get']('/:id/descriptions',auth[_0x47d3('0x9')](),controller[_0x47d3('0x10')]);router[_0x47d3('0xb')](_0x47d3('0x11'),auth[_0x47d3('0x9')](),controller[_0x47d3('0x12')]);router[_0x47d3('0x13')]('/',auth[_0x47d3('0x9')](),controller['create']);router[_0x47d3('0x13')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x47d3('0x14')](_0x47d3('0xc'),auth[_0x47d3('0x9')](),controller[_0x47d3('0x15')]);router[_0x47d3('0x16')](_0x47d3('0xc'),auth[_0x47d3('0x9')](),controller['destroy']);module[_0x47d3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 053d316..9ef6558 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 _0x7224=['STRING','sequelize'];(function(_0x2d7dfe,_0x3a189a){var _0x187e2b=function(_0x2a04ad){while(--_0x2a04ad){_0x2d7dfe['push'](_0x2d7dfe['shift']());}};_0x187e2b(++_0x3a189a);}(_0x7224,0x1b9));var _0x4722=function(_0x2c5a16,_0x1c7d1d){_0x2c5a16=_0x2c5a16-0x0;var _0x40cd8e=_0x7224[_0x2c5a16];return _0x40cd8e;};'use strict';var Sequelize=require(_0x4722('0x0'));module['exports']={'name':{'type':Sequelize[_0x4722('0x1')]},'description':{'type':Sequelize[_0x4722('0x1')]}}; \ No newline at end of file +var _0xe011=['exports','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe011,0x17c));var _0x1e01=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0xe011[_0x5c6022];return _0x4ab5af;};'use strict';var Sequelize=require('sequelize');module[_0x1e01('0x0')]={'name':{'type':Sequelize[_0x1e01('0x1')]},'description':{'type':Sequelize[_0x1e01('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index c32863c..22df6b0 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 _0xc6b0=['length','includeAll','include','find','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','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','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','FreshdeskConfiguration','findAll','catch','show','params'];(function(_0x224333,_0x13abe7){var _0x394a65=function(_0x403cda){while(--_0x403cda){_0x224333['push'](_0x224333['shift']());}};_0x394a65(++_0x13abe7);}(_0xc6b0,0xb1));var _0x0c6b=function(_0x4d88f6,_0x52f758){_0x4d88f6=_0x4d88f6-0x0;var _0x2041c8=_0xc6b0[_0x4d88f6];return _0x2041c8;};'use strict';var emlformat=require(_0x0c6b('0x0'));var rimraf=require(_0x0c6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c6b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0c6b('0x3'));var Mustache=require(_0x0c6b('0x4'));var util=require(_0x0c6b('0x5'));var path=require(_0x0c6b('0x6'));var sox=require(_0x0c6b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c6b('0x8'));var _=require(_0x0c6b('0x9'));var squel=require('squel');var crypto=require(_0x0c6b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0c6b('0xb'));var toCsv=require(_0x0c6b('0xc'));var querystring=require('querystring');var Papa=require(_0x0c6b('0xd'));var Redis=require(_0x0c6b('0xe'));var authService=require(_0x0c6b('0xf'));var qs=require(_0x0c6b('0x10'));var as=require(_0x0c6b('0x11'));var hardwareService=require(_0x0c6b('0x12'));var logger=require(_0x0c6b('0x13'))(_0x0c6b('0x14'));var utils=require('../../config/utils');var config=require(_0x0c6b('0x15'));var licenseUtil=require(_0x0c6b('0x16'));var db=require(_0x0c6b('0x17'))['db'];function respondWithStatusCode(_0x1aa5dc,_0x3aa660){_0x3aa660=_0x3aa660||0xcc;return function(_0x473282){if(_0x473282){return _0x1aa5dc[_0x0c6b('0x18')](_0x3aa660);}return _0x1aa5dc[_0x0c6b('0x19')](_0x3aa660)[_0x0c6b('0x1a')]();};}function respondWithResult(_0x4c9d79,_0x67825e){_0x67825e=_0x67825e||0xc8;return function(_0x2fd1da){if(_0x2fd1da){return _0x4c9d79[_0x0c6b('0x19')](_0x67825e)[_0x0c6b('0x1b')](_0x2fd1da);}};}function respondWithFilteredResult(_0x2507c5,_0x2ea7dc){return function(_0x4b665d){if(_0x4b665d){var _0x330822=typeof _0x2ea7dc[_0x0c6b('0x1c')]==='undefined'&&typeof _0x2ea7dc[_0x0c6b('0x1d')]===_0x0c6b('0x1e');var _0x24267b=_0x4b665d[_0x0c6b('0x1f')];var _0x44a8e5=_0x330822?0x0:_0x2ea7dc[_0x0c6b('0x1c')];var _0x41f2d0=_0x330822?_0x4b665d[_0x0c6b('0x1f')]:_0x2ea7dc[_0x0c6b('0x1c')]+_0x2ea7dc[_0x0c6b('0x1d')];var _0x34f5ce;if(_0x41f2d0>=_0x24267b){_0x41f2d0=_0x24267b;_0x34f5ce=0xc8;}else{_0x34f5ce=0xce;}_0x2507c5['status'](_0x34f5ce);return _0x2507c5[_0x0c6b('0x20')](_0x0c6b('0x21'),_0x44a8e5+'-'+_0x41f2d0+'/'+_0x24267b)[_0x0c6b('0x1b')](_0x4b665d);}return null;};}function patchUpdates(_0x4b94ad){return function(_0x400e16){try{jsonpatch[_0x0c6b('0x22')](_0x400e16,_0x4b94ad,!![]);}catch(_0x265fac){return BPromise[_0x0c6b('0x23')](_0x265fac);}return _0x400e16['save']();};}function saveUpdates(_0x52703,_0x562044){return function(_0x4fcfad){if(_0x4fcfad){return _0x4fcfad[_0x0c6b('0x24')](_0x52703)[_0x0c6b('0x25')](function(_0x2611df){return _0x2611df;});}return null;};}function removeEntity(_0x4917b1,_0x522348){return function(_0x2f53fe){if(_0x2f53fe){return _0x2f53fe[_0x0c6b('0x26')]()['then'](function(){_0x4917b1[_0x0c6b('0x19')](0xcc)[_0x0c6b('0x1a')]();});}};}function handleEntityNotFound(_0xd11b49,_0x29ec50){return function(_0x3d58ed){if(!_0x3d58ed){_0xd11b49[_0x0c6b('0x18')](0x194);}return _0x3d58ed;};}function handleError(_0x1d849a,_0x1819e7){_0x1819e7=_0x1819e7||0x1f4;return function(_0x214ca2){logger['error'](_0x214ca2[_0x0c6b('0x27')]);if(_0x214ca2[_0x0c6b('0x28')]){delete _0x214ca2['name'];}_0x1d849a[_0x0c6b('0x19')](_0x1819e7)[_0x0c6b('0x29')](_0x214ca2);};}exports['index']=function(_0x10a496,_0x348f34){var _0x28dc4e={},_0x5ba34a={},_0x4e119a={'count':0x0,'rows':[]};var _0xa56a02=_[_0x0c6b('0x2a')](db['FreshdeskConfiguration'][_0x0c6b('0x2b')],function(_0x5109ef){return{'name':_0x5109ef[_0x0c6b('0x2c')],'type':_0x5109ef['type'][_0x0c6b('0x2d')]};});_0x5ba34a[_0x0c6b('0x2e')]=_[_0x0c6b('0x2a')](_0xa56a02,_0x0c6b('0x28'));_0x5ba34a['query']=_[_0x0c6b('0x2f')](_0x10a496[_0x0c6b('0x30')]);_0x5ba34a[_0x0c6b('0x31')]=_[_0x0c6b('0x32')](_0x5ba34a[_0x0c6b('0x2e')],_0x5ba34a[_0x0c6b('0x30')]);_0x28dc4e[_0x0c6b('0x33')]=_['intersection'](_0x5ba34a[_0x0c6b('0x2e')],qs[_0x0c6b('0x34')](_0x10a496[_0x0c6b('0x30')][_0x0c6b('0x34')]));_0x28dc4e[_0x0c6b('0x33')]=_0x28dc4e[_0x0c6b('0x33')]['length']?_0x28dc4e[_0x0c6b('0x33')]:_0x5ba34a[_0x0c6b('0x2e')];if(!_0x10a496['query'][_0x0c6b('0x35')](_0x0c6b('0x36'))){_0x28dc4e[_0x0c6b('0x1d')]=qs[_0x0c6b('0x1d')](_0x10a496[_0x0c6b('0x30')]['limit']);_0x28dc4e['offset']=qs[_0x0c6b('0x1c')](_0x10a496[_0x0c6b('0x30')][_0x0c6b('0x1c')]);}_0x28dc4e[_0x0c6b('0x37')]=qs[_0x0c6b('0x38')](_0x10a496[_0x0c6b('0x30')][_0x0c6b('0x38')]);_0x28dc4e['where']=qs['filters'](_[_0x0c6b('0x39')](_0x10a496[_0x0c6b('0x30')],_0x5ba34a[_0x0c6b('0x31')]),_0xa56a02);if(_0x10a496['query'][_0x0c6b('0x3a')]){_0x28dc4e[_0x0c6b('0x3b')]=_[_0x0c6b('0x3c')](_0x28dc4e['where'],{'$or':_[_0x0c6b('0x2a')](_0xa56a02,function(_0x3489f8){if(_0x3489f8[_0x0c6b('0x3d')]!==_0x0c6b('0x3e')){var _0x243b93={};_0x243b93[_0x3489f8['name']]={'$like':'%'+_0x10a496[_0x0c6b('0x30')][_0x0c6b('0x3a')]+'%'};return _0x243b93;}})});}_0x28dc4e=_[_0x0c6b('0x3c')]({},_0x28dc4e,_0x10a496[_0x0c6b('0x3f')]);var _0x493b63={'where':_0x28dc4e['where']};return db[_0x0c6b('0x40')][_0x0c6b('0x1f')](_0x493b63)[_0x0c6b('0x25')](function(_0x4ff502){_0x4e119a[_0x0c6b('0x1f')]=_0x4ff502;if(_0x10a496[_0x0c6b('0x30')]['includeAll']){_0x28dc4e['include']=[{'all':!![]}];}return db[_0x0c6b('0x40')][_0x0c6b('0x41')](_0x28dc4e);})[_0x0c6b('0x25')](function(_0x28af04){_0x4e119a['rows']=_0x28af04;return _0x4e119a;})[_0x0c6b('0x25')](respondWithFilteredResult(_0x348f34,_0x28dc4e))[_0x0c6b('0x42')](handleError(_0x348f34,null));};exports[_0x0c6b('0x43')]=function(_0x5fba90,_0x2b5937){var _0x30cc38={'raw':![],'where':{'id':_0x5fba90[_0x0c6b('0x44')]['id']}},_0x339792={};_0x339792['model']=_[_0x0c6b('0x2f')](db[_0x0c6b('0x40')][_0x0c6b('0x2b')]);_0x339792[_0x0c6b('0x30')]=_[_0x0c6b('0x2f')](_0x5fba90[_0x0c6b('0x30')]);_0x339792[_0x0c6b('0x31')]=_[_0x0c6b('0x32')](_0x339792[_0x0c6b('0x2e')],_0x339792['query']);_0x30cc38['attributes']=_['intersection'](_0x339792[_0x0c6b('0x2e')],qs[_0x0c6b('0x34')](_0x5fba90[_0x0c6b('0x30')][_0x0c6b('0x34')]));_0x30cc38[_0x0c6b('0x33')]=_0x30cc38[_0x0c6b('0x33')][_0x0c6b('0x45')]?_0x30cc38['attributes']:_0x339792['model'];if(_0x5fba90['query'][_0x0c6b('0x46')]){_0x30cc38[_0x0c6b('0x47')]=[{'all':!![]}];}_0x30cc38=_['merge']({},_0x30cc38,_0x5fba90[_0x0c6b('0x3f')]);return db[_0x0c6b('0x40')][_0x0c6b('0x48')](_0x30cc38)[_0x0c6b('0x25')](handleEntityNotFound(_0x2b5937,null))[_0x0c6b('0x25')](respondWithResult(_0x2b5937,null))['catch'](handleError(_0x2b5937,null));};exports['create']=function(_0xc26136,_0x539281){return db['FreshdeskConfiguration']['create'](_0xc26136[_0x0c6b('0x49')],{})['then'](respondWithResult(_0x539281,0xc9))[_0x0c6b('0x42')](handleError(_0x539281,null));};exports['update']=function(_0x28e094,_0x27f21a){if(_0x28e094[_0x0c6b('0x49')]['id']){delete _0x28e094[_0x0c6b('0x49')]['id'];}return db[_0x0c6b('0x40')][_0x0c6b('0x48')]({'where':{'id':_0x28e094[_0x0c6b('0x44')]['id']}})[_0x0c6b('0x25')](handleEntityNotFound(_0x27f21a,null))[_0x0c6b('0x25')](saveUpdates(_0x28e094[_0x0c6b('0x49')],null))[_0x0c6b('0x25')](respondWithResult(_0x27f21a,null))['catch'](handleError(_0x27f21a,null));};exports[_0x0c6b('0x26')]=function(_0x139eeb,_0x6be6cd){return db[_0x0c6b('0x40')]['find']({'where':{'id':_0x139eeb['params']['id']}})['then'](handleEntityNotFound(_0x6be6cd,null))[_0x0c6b('0x25')](removeEntity(_0x6be6cd,null))['catch'](handleError(_0x6be6cd,null));};exports[_0x0c6b('0x4a')]=function(_0x391b86,_0x3c7c18,_0x270d7e){var _0x43a4f7={};var _0x18570b={};var _0x113f05;var _0x4f50f8;return db[_0x0c6b('0x40')][_0x0c6b('0x4b')]({'where':{'id':_0x391b86[_0x0c6b('0x44')]['id']}})[_0x0c6b('0x25')](handleEntityNotFound(_0x3c7c18,null))[_0x0c6b('0x25')](function(_0x25544f){if(_0x25544f){_0x113f05=_0x25544f;_0x18570b[_0x0c6b('0x2e')]=_['keys'](db[_0x0c6b('0x4c')][_0x0c6b('0x2b')]);_0x18570b['query']=_['keys'](_0x391b86['query']);_0x18570b['filters']=_[_0x0c6b('0x32')](_0x18570b[_0x0c6b('0x2e')],_0x18570b[_0x0c6b('0x30')]);_0x43a4f7[_0x0c6b('0x33')]=_[_0x0c6b('0x32')](_0x18570b[_0x0c6b('0x2e')],qs[_0x0c6b('0x34')](_0x391b86['query'][_0x0c6b('0x34')]));_0x43a4f7[_0x0c6b('0x33')]=_0x43a4f7['attributes'][_0x0c6b('0x45')]?_0x43a4f7[_0x0c6b('0x33')]:_0x18570b[_0x0c6b('0x2e')];_0x43a4f7[_0x0c6b('0x37')]=qs[_0x0c6b('0x38')](_0x391b86[_0x0c6b('0x30')]['sort']);_0x43a4f7[_0x0c6b('0x3b')]=qs[_0x0c6b('0x31')](_[_0x0c6b('0x39')](_0x391b86[_0x0c6b('0x30')],_0x18570b[_0x0c6b('0x31')]));if(_0x391b86[_0x0c6b('0x30')][_0x0c6b('0x3a')]){_0x43a4f7['where']=_[_0x0c6b('0x3c')](_0x43a4f7['where'],{'$or':_['map'](_0x43a4f7[_0x0c6b('0x33')],function(_0x31b018){var _0x5394b6={};_0x5394b6[_0x31b018]={'$like':'%'+_0x391b86['query'][_0x0c6b('0x3a')]+'%'};return _0x5394b6;})});}_0x43a4f7=_[_0x0c6b('0x3c')]({},_0x43a4f7,_0x391b86['options']);return _0x113f05[_0x0c6b('0x4a')](_0x43a4f7);}})[_0x0c6b('0x25')](function(_0x4973d0){if(_0x4973d0){_0x4f50f8=_0x4973d0['length'];if(!_0x391b86['query'][_0x0c6b('0x35')](_0x0c6b('0x36'))){_0x43a4f7[_0x0c6b('0x1d')]=qs['limit'](_0x391b86[_0x0c6b('0x30')][_0x0c6b('0x1d')]);_0x43a4f7[_0x0c6b('0x1c')]=qs['offset'](_0x391b86['query'][_0x0c6b('0x1c')]);}return _0x113f05[_0x0c6b('0x4a')](_0x43a4f7);}})[_0x0c6b('0x25')](function(_0x34a7d0){if(_0x34a7d0){return _0x34a7d0?{'count':_0x4f50f8,'rows':_0x34a7d0}:null;}})[_0x0c6b('0x25')](respondWithResult(_0x3c7c18,null))['catch'](handleError(_0x3c7c18,null));};exports[_0x0c6b('0x4d')]=function(_0x8b2629,_0x4315a8,_0x217122){var _0x580d23={};var _0x349f5a={};var _0x417af2;var _0x1d1e37;return db['FreshdeskConfiguration'][_0x0c6b('0x4b')]({'where':{'id':_0x8b2629[_0x0c6b('0x44')]['id']}})[_0x0c6b('0x25')](handleEntityNotFound(_0x4315a8,null))[_0x0c6b('0x25')](function(_0x15df67){if(_0x15df67){_0x417af2=_0x15df67;_0x349f5a[_0x0c6b('0x2e')]=_[_0x0c6b('0x2f')](db[_0x0c6b('0x4c')][_0x0c6b('0x2b')]);_0x349f5a[_0x0c6b('0x30')]=_[_0x0c6b('0x2f')](_0x8b2629[_0x0c6b('0x30')]);_0x349f5a[_0x0c6b('0x31')]=_['intersection'](_0x349f5a['model'],_0x349f5a[_0x0c6b('0x30')]);_0x580d23[_0x0c6b('0x33')]=_['intersection'](_0x349f5a['model'],qs[_0x0c6b('0x34')](_0x8b2629[_0x0c6b('0x30')][_0x0c6b('0x34')]));_0x580d23[_0x0c6b('0x33')]=_0x580d23[_0x0c6b('0x33')][_0x0c6b('0x45')]?_0x580d23[_0x0c6b('0x33')]:_0x349f5a[_0x0c6b('0x2e')];_0x580d23[_0x0c6b('0x37')]=qs['sort'](_0x8b2629[_0x0c6b('0x30')]['sort']);_0x580d23[_0x0c6b('0x3b')]=qs['filters'](_[_0x0c6b('0x39')](_0x8b2629[_0x0c6b('0x30')],_0x349f5a[_0x0c6b('0x31')]));if(_0x8b2629[_0x0c6b('0x30')][_0x0c6b('0x3a')]){_0x580d23[_0x0c6b('0x3b')]=_[_0x0c6b('0x3c')](_0x580d23[_0x0c6b('0x3b')],{'$or':_['map'](_0x580d23[_0x0c6b('0x33')],function(_0x30f33b){var _0x5982d2={};_0x5982d2[_0x30f33b]={'$like':'%'+_0x8b2629['query']['filter']+'%'};return _0x5982d2;})});}_0x580d23=_[_0x0c6b('0x3c')]({},_0x580d23,_0x8b2629[_0x0c6b('0x3f')]);return _0x417af2[_0x0c6b('0x4d')](_0x580d23);}})['then'](function(_0x3bebc3){if(_0x3bebc3){_0x1d1e37=_0x3bebc3[_0x0c6b('0x45')];if(!_0x8b2629[_0x0c6b('0x30')][_0x0c6b('0x35')](_0x0c6b('0x36'))){_0x580d23[_0x0c6b('0x1d')]=qs[_0x0c6b('0x1d')](_0x8b2629[_0x0c6b('0x30')][_0x0c6b('0x1d')]);_0x580d23['offset']=qs[_0x0c6b('0x1c')](_0x8b2629['query'][_0x0c6b('0x1c')]);}return _0x417af2[_0x0c6b('0x4d')](_0x580d23);}})[_0x0c6b('0x25')](function(_0x581b60){if(_0x581b60){return _0x581b60?{'count':_0x1d1e37,'rows':_0x581b60}:null;}})[_0x0c6b('0x25')](respondWithResult(_0x4315a8,null))[_0x0c6b('0x42')](handleError(_0x4315a8,null));};exports[_0x0c6b('0x4e')]=function(_0x933aa7,_0x3f6bf2,_0x31ec3e){var _0x379520={};var _0x3de82d={};var _0x2a2427;var _0x462277;return db['FreshdeskConfiguration'][_0x0c6b('0x4b')]({'where':{'id':_0x933aa7['params']['id']}})[_0x0c6b('0x25')](handleEntityNotFound(_0x3f6bf2,null))[_0x0c6b('0x25')](function(_0x4ca8a6){if(_0x4ca8a6){_0x2a2427=_0x4ca8a6;_0x3de82d['model']=_[_0x0c6b('0x2f')](db[_0x0c6b('0x4c')][_0x0c6b('0x2b')]);_0x3de82d['query']=_[_0x0c6b('0x2f')](_0x933aa7[_0x0c6b('0x30')]);_0x3de82d[_0x0c6b('0x31')]=_[_0x0c6b('0x32')](_0x3de82d[_0x0c6b('0x2e')],_0x3de82d[_0x0c6b('0x30')]);_0x379520[_0x0c6b('0x33')]=_[_0x0c6b('0x32')](_0x3de82d[_0x0c6b('0x2e')],qs[_0x0c6b('0x34')](_0x933aa7[_0x0c6b('0x30')][_0x0c6b('0x34')]));_0x379520['attributes']=_0x379520[_0x0c6b('0x33')][_0x0c6b('0x45')]?_0x379520['attributes']:_0x3de82d[_0x0c6b('0x2e')];_0x379520[_0x0c6b('0x37')]=qs[_0x0c6b('0x38')](_0x933aa7[_0x0c6b('0x30')][_0x0c6b('0x38')]);_0x379520[_0x0c6b('0x3b')]=qs['filters'](_[_0x0c6b('0x39')](_0x933aa7['query'],_0x3de82d['filters']));if(_0x933aa7[_0x0c6b('0x30')][_0x0c6b('0x3a')]){_0x379520[_0x0c6b('0x3b')]=_['merge'](_0x379520[_0x0c6b('0x3b')],{'$or':_[_0x0c6b('0x2a')](_0x379520[_0x0c6b('0x33')],function(_0x4275e6){var _0x5cd473={};_0x5cd473[_0x4275e6]={'$like':'%'+_0x933aa7[_0x0c6b('0x30')][_0x0c6b('0x3a')]+'%'};return _0x5cd473;})});}_0x379520=_[_0x0c6b('0x3c')]({},_0x379520,_0x933aa7[_0x0c6b('0x3f')]);return _0x2a2427[_0x0c6b('0x4e')](_0x379520);}})['then'](function(_0x47d8be){if(_0x47d8be){_0x462277=_0x47d8be[_0x0c6b('0x45')];if(!_0x933aa7[_0x0c6b('0x30')][_0x0c6b('0x35')]('nolimit')){_0x379520[_0x0c6b('0x1d')]=qs['limit'](_0x933aa7[_0x0c6b('0x30')][_0x0c6b('0x1d')]);_0x379520[_0x0c6b('0x1c')]=qs[_0x0c6b('0x1c')](_0x933aa7[_0x0c6b('0x30')][_0x0c6b('0x1c')]);}return _0x2a2427[_0x0c6b('0x4e')](_0x379520);}})[_0x0c6b('0x25')](function(_0x1e90a8){if(_0x1e90a8){return _0x1e90a8?{'count':_0x462277,'rows':_0x1e90a8}:null;}})[_0x0c6b('0x25')](respondWithResult(_0x3f6bf2,null))[_0x0c6b('0x42')](handleError(_0x3f6bf2,null));};exports['getTags']=function(_0x13ddb8,_0xe573d1,_0x332c99){var _0x416f34={};var _0x1a0e2b={};var _0x35bdad;var _0x2b7a49;return db[_0x0c6b('0x40')]['findOne']({'where':{'id':_0x13ddb8['params']['id']}})['then'](handleEntityNotFound(_0xe573d1,null))[_0x0c6b('0x25')](function(_0x3bda65){if(_0x3bda65){_0x35bdad=_0x3bda65;_0x1a0e2b[_0x0c6b('0x2e')]=_[_0x0c6b('0x2f')](db[_0x0c6b('0x4f')]['rawAttributes']);_0x1a0e2b[_0x0c6b('0x30')]=_['keys'](_0x13ddb8[_0x0c6b('0x30')]);_0x1a0e2b[_0x0c6b('0x31')]=_[_0x0c6b('0x32')](_0x1a0e2b[_0x0c6b('0x2e')],_0x1a0e2b[_0x0c6b('0x30')]);_0x416f34[_0x0c6b('0x33')]=_['intersection'](_0x1a0e2b['model'],qs['fields'](_0x13ddb8[_0x0c6b('0x30')][_0x0c6b('0x34')]));_0x416f34['attributes']=_0x416f34[_0x0c6b('0x33')][_0x0c6b('0x45')]?_0x416f34['attributes']:_0x1a0e2b[_0x0c6b('0x2e')];_0x416f34['order']=qs[_0x0c6b('0x38')](_0x13ddb8[_0x0c6b('0x30')][_0x0c6b('0x38')]);_0x416f34[_0x0c6b('0x3b')]=qs[_0x0c6b('0x31')](_[_0x0c6b('0x39')](_0x13ddb8[_0x0c6b('0x30')],_0x1a0e2b['filters']));if(_0x13ddb8['query'][_0x0c6b('0x3a')]){_0x416f34[_0x0c6b('0x3b')]=_[_0x0c6b('0x3c')](_0x416f34[_0x0c6b('0x3b')],{'$or':_['map'](_0x416f34['attributes'],function(_0x4432a2){var _0x276a1c={};_0x276a1c[_0x4432a2]={'$like':'%'+_0x13ddb8[_0x0c6b('0x30')][_0x0c6b('0x3a')]+'%'};return _0x276a1c;})});}_0x416f34=_[_0x0c6b('0x3c')]({},_0x416f34,_0x13ddb8[_0x0c6b('0x3f')]);return _0x35bdad[_0x0c6b('0x50')](_0x416f34);}})[_0x0c6b('0x25')](function(_0xa11373){if(_0xa11373){_0x2b7a49=_0xa11373[_0x0c6b('0x45')];if(!_0x13ddb8['query'][_0x0c6b('0x35')](_0x0c6b('0x36'))){_0x416f34[_0x0c6b('0x1d')]=qs[_0x0c6b('0x1d')](_0x13ddb8[_0x0c6b('0x30')]['limit']);_0x416f34['offset']=qs['offset'](_0x13ddb8['query']['offset']);}return _0x35bdad[_0x0c6b('0x50')](_0x416f34);}})[_0x0c6b('0x25')](function(_0x33b98f){if(_0x33b98f){return _0x33b98f?{'count':_0x2b7a49,'rows':_0x33b98f}:null;}})[_0x0c6b('0x25')](respondWithResult(_0xe573d1,null))['catch'](handleError(_0xe573d1,null));};exports[_0x0c6b('0x51')]=function(_0x3cac15,_0x18572c,_0x516613){if(_0x3cac15[_0x0c6b('0x49')]['id']){delete _0x3cac15[_0x0c6b('0x49')]['id'];}return db[_0x0c6b('0x40')][_0x0c6b('0x4b')]({'where':{'id':_0x3cac15[_0x0c6b('0x44')]['id']}})['then'](handleEntityNotFound(_0x18572c,null))['then'](function(_0x1e3bb6){if(_0x1e3bb6){return _0x1e3bb6[_0x0c6b('0x51')](_0x3cac15[_0x0c6b('0x49')]['ids']||[]);}return null;})[_0x0c6b('0x25')](respondWithResult(_0x18572c,null))[_0x0c6b('0x42')](handleError(_0x18572c,null));}; \ No newline at end of file +var _0x04dc=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','FreshdeskConfiguration','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','rawAttributes','include','catch','create','body','params','find','getFields','findOne','filter','options','nolimit','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x8f0cac,_0x30ecab){var _0x243a6d=function(_0x2823f6){while(--_0x2823f6){_0x8f0cac['push'](_0x8f0cac['shift']());}};_0x243a6d(++_0x30ecab);}(_0x04dc,0x144));var _0xc04d=function(_0x30eb36,_0x4f7dab){_0x30eb36=_0x30eb36-0x0;var _0x1b33d1=_0x04dc[_0x30eb36];return _0x1b33d1;};'use strict';var emlformat=require(_0xc04d('0x0'));var rimraf=require(_0xc04d('0x1'));var zipdir=require(_0xc04d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc04d('0x3'));var moment=require(_0xc04d('0x4'));var BPromise=require(_0xc04d('0x5'));var Mustache=require('mustache');var util=require(_0xc04d('0x6'));var path=require('path');var sox=require(_0xc04d('0x7'));var csv=require(_0xc04d('0x8'));var ejs=require(_0xc04d('0x9'));var fs=require('fs');var fs_extra=require(_0xc04d('0xa'));var _=require(_0xc04d('0xb'));var squel=require(_0xc04d('0xc'));var crypto=require(_0xc04d('0xd'));var jsforce=require(_0xc04d('0xe'));var deskjs=require(_0xc04d('0xf'));var toCsv=require(_0xc04d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc04d('0x10'));var authService=require(_0xc04d('0x11'));var qs=require(_0xc04d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc04d('0x13'));var logger=require('../../config/logger')(_0xc04d('0x14'));var utils=require(_0xc04d('0x15'));var config=require(_0xc04d('0x16'));var licenseUtil=require(_0xc04d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a5ee2,_0x1a9802){_0x1a9802=_0x1a9802||0xcc;return function(_0x1fe7e2){if(_0x1fe7e2){return _0x2a5ee2[_0xc04d('0x18')](_0x1a9802);}return _0x2a5ee2[_0xc04d('0x19')](_0x1a9802)['end']();};}function respondWithResult(_0x27f501,_0x153481){_0x153481=_0x153481||0xc8;return function(_0x4f9929){if(_0x4f9929){return _0x27f501['status'](_0x153481)[_0xc04d('0x1a')](_0x4f9929);}};}function respondWithFilteredResult(_0x4b2d41,_0xfe547f){return function(_0x4c1567){if(_0x4c1567){var _0x5e424a=typeof _0xfe547f['offset']==='undefined'&&typeof _0xfe547f[_0xc04d('0x1b')]===_0xc04d('0x1c');var _0x53b5c2=_0x4c1567[_0xc04d('0x1d')];var _0x2776d6=_0x5e424a?0x0:_0xfe547f[_0xc04d('0x1e')];var _0x55a8ff=_0x5e424a?_0x4c1567['count']:_0xfe547f[_0xc04d('0x1e')]+_0xfe547f['limit'];var _0x3a9d98;if(_0x55a8ff>=_0x53b5c2){_0x55a8ff=_0x53b5c2;_0x3a9d98=0xc8;}else{_0x3a9d98=0xce;}_0x4b2d41[_0xc04d('0x19')](_0x3a9d98);return _0x4b2d41[_0xc04d('0x1f')]('Content-Range',_0x2776d6+'-'+_0x55a8ff+'/'+_0x53b5c2)[_0xc04d('0x1a')](_0x4c1567);}return null;};}function patchUpdates(_0x2e5fbb){return function(_0x401530){try{jsonpatch[_0xc04d('0x20')](_0x401530,_0x2e5fbb,!![]);}catch(_0x576546){return BPromise[_0xc04d('0x21')](_0x576546);}return _0x401530[_0xc04d('0x22')]();};}function saveUpdates(_0x317758,_0x1812bc){return function(_0x1344df){if(_0x1344df){return _0x1344df[_0xc04d('0x23')](_0x317758)[_0xc04d('0x24')](function(_0x486b30){return _0x486b30;});}return null;};}function removeEntity(_0x53af01,_0x5ef194){return function(_0x2c61ff){if(_0x2c61ff){return _0x2c61ff[_0xc04d('0x25')]()[_0xc04d('0x24')](function(){_0x53af01[_0xc04d('0x19')](0xcc)[_0xc04d('0x26')]();});}};}function handleEntityNotFound(_0x100861,_0x5b4421){return function(_0x14a4fd){if(!_0x14a4fd){_0x100861[_0xc04d('0x18')](0x194);}return _0x14a4fd;};}function handleError(_0x454333,_0x2a2120){_0x2a2120=_0x2a2120||0x1f4;return function(_0x88753f){logger[_0xc04d('0x27')](_0x88753f[_0xc04d('0x28')]);if(_0x88753f[_0xc04d('0x29')]){delete _0x88753f['name'];}_0x454333[_0xc04d('0x19')](_0x2a2120)[_0xc04d('0x2a')](_0x88753f);};}exports[_0xc04d('0x2b')]=function(_0x3ab9fe,_0x24ad49){var _0x29e65e={},_0x546696={},_0x350007={'count':0x0,'rows':[]};var _0x1d74c6=_['map'](db[_0xc04d('0x2c')]['rawAttributes'],function(_0x3c45cf){return{'name':_0x3c45cf[_0xc04d('0x2d')],'type':_0x3c45cf[_0xc04d('0x2e')][_0xc04d('0x2f')]};});_0x546696[_0xc04d('0x30')]=_[_0xc04d('0x31')](_0x1d74c6,_0xc04d('0x29'));_0x546696['query']=_[_0xc04d('0x32')](_0x3ab9fe[_0xc04d('0x33')]);_0x546696[_0xc04d('0x34')]=_['intersection'](_0x546696[_0xc04d('0x30')],_0x546696[_0xc04d('0x33')]);_0x29e65e[_0xc04d('0x35')]=_[_0xc04d('0x36')](_0x546696[_0xc04d('0x30')],qs[_0xc04d('0x37')](_0x3ab9fe[_0xc04d('0x33')][_0xc04d('0x37')]));_0x29e65e['attributes']=_0x29e65e['attributes'][_0xc04d('0x38')]?_0x29e65e['attributes']:_0x546696[_0xc04d('0x30')];if(!_0x3ab9fe[_0xc04d('0x33')][_0xc04d('0x39')]('nolimit')){_0x29e65e['limit']=qs[_0xc04d('0x1b')](_0x3ab9fe['query']['limit']);_0x29e65e[_0xc04d('0x1e')]=qs[_0xc04d('0x1e')](_0x3ab9fe[_0xc04d('0x33')][_0xc04d('0x1e')]);}_0x29e65e[_0xc04d('0x3a')]=qs[_0xc04d('0x3b')](_0x3ab9fe[_0xc04d('0x33')][_0xc04d('0x3b')]);_0x29e65e[_0xc04d('0x3c')]=qs[_0xc04d('0x34')](_[_0xc04d('0x3d')](_0x3ab9fe[_0xc04d('0x33')],_0x546696['filters']),_0x1d74c6);if(_0x3ab9fe['query']['filter']){_0x29e65e[_0xc04d('0x3c')]=_[_0xc04d('0x3e')](_0x29e65e['where'],{'$or':_['map'](_0x1d74c6,function(_0x4214a8){if(_0x4214a8[_0xc04d('0x2e')]!==_0xc04d('0x3f')){var _0x137969={};_0x137969[_0x4214a8[_0xc04d('0x29')]]={'$like':'%'+_0x3ab9fe[_0xc04d('0x33')]['filter']+'%'};return _0x137969;}})});}_0x29e65e=_[_0xc04d('0x3e')]({},_0x29e65e,_0x3ab9fe['options']);var _0xd507f9={'where':_0x29e65e[_0xc04d('0x3c')]};return db[_0xc04d('0x2c')][_0xc04d('0x1d')](_0xd507f9)['then'](function(_0x288ba4){_0x350007[_0xc04d('0x1d')]=_0x288ba4;if(_0x3ab9fe['query'][_0xc04d('0x40')]){_0x29e65e['include']=[{'all':!![]}];}return db[_0xc04d('0x2c')][_0xc04d('0x41')](_0x29e65e);})[_0xc04d('0x24')](function(_0x421af1){_0x350007[_0xc04d('0x42')]=_0x421af1;return _0x350007;})['then'](respondWithFilteredResult(_0x24ad49,_0x29e65e))['catch'](handleError(_0x24ad49,null));};exports['show']=function(_0x1e825b,_0x2b3a80){var _0x36eaf4={'raw':![],'where':{'id':_0x1e825b['params']['id']}},_0x441db3={};_0x441db3[_0xc04d('0x30')]=_[_0xc04d('0x32')](db[_0xc04d('0x2c')][_0xc04d('0x43')]);_0x441db3[_0xc04d('0x33')]=_[_0xc04d('0x32')](_0x1e825b['query']);_0x441db3[_0xc04d('0x34')]=_['intersection'](_0x441db3[_0xc04d('0x30')],_0x441db3['query']);_0x36eaf4[_0xc04d('0x35')]=_[_0xc04d('0x36')](_0x441db3[_0xc04d('0x30')],qs['fields'](_0x1e825b[_0xc04d('0x33')][_0xc04d('0x37')]));_0x36eaf4[_0xc04d('0x35')]=_0x36eaf4[_0xc04d('0x35')][_0xc04d('0x38')]?_0x36eaf4[_0xc04d('0x35')]:_0x441db3[_0xc04d('0x30')];if(_0x1e825b[_0xc04d('0x33')][_0xc04d('0x40')]){_0x36eaf4[_0xc04d('0x44')]=[{'all':!![]}];}_0x36eaf4=_[_0xc04d('0x3e')]({},_0x36eaf4,_0x1e825b['options']);return db['FreshdeskConfiguration']['find'](_0x36eaf4)[_0xc04d('0x24')](handleEntityNotFound(_0x2b3a80,null))[_0xc04d('0x24')](respondWithResult(_0x2b3a80,null))[_0xc04d('0x45')](handleError(_0x2b3a80,null));};exports[_0xc04d('0x46')]=function(_0x573de4,_0x3fb3e6){return db['FreshdeskConfiguration'][_0xc04d('0x46')](_0x573de4[_0xc04d('0x47')],{})[_0xc04d('0x24')](respondWithResult(_0x3fb3e6,0xc9))[_0xc04d('0x45')](handleError(_0x3fb3e6,null));};exports['update']=function(_0x1cf1b0,_0x54abf6){if(_0x1cf1b0[_0xc04d('0x47')]['id']){delete _0x1cf1b0[_0xc04d('0x47')]['id'];}return db[_0xc04d('0x2c')]['find']({'where':{'id':_0x1cf1b0[_0xc04d('0x48')]['id']}})['then'](handleEntityNotFound(_0x54abf6,null))[_0xc04d('0x24')](saveUpdates(_0x1cf1b0[_0xc04d('0x47')],null))['then'](respondWithResult(_0x54abf6,null))[_0xc04d('0x45')](handleError(_0x54abf6,null));};exports[_0xc04d('0x25')]=function(_0x1b2e74,_0x32dac2){return db[_0xc04d('0x2c')][_0xc04d('0x49')]({'where':{'id':_0x1b2e74['params']['id']}})[_0xc04d('0x24')](handleEntityNotFound(_0x32dac2,null))[_0xc04d('0x24')](removeEntity(_0x32dac2,null))['catch'](handleError(_0x32dac2,null));};exports[_0xc04d('0x4a')]=function(_0x2939f8,_0xf88ebe,_0x277b7c){var _0x37b747={};var _0x743ec8={};var _0x549c77;var _0x18c7af;return db[_0xc04d('0x2c')][_0xc04d('0x4b')]({'where':{'id':_0x2939f8['params']['id']}})[_0xc04d('0x24')](handleEntityNotFound(_0xf88ebe,null))[_0xc04d('0x24')](function(_0x34e3ca){if(_0x34e3ca){_0x549c77=_0x34e3ca;_0x743ec8['model']=_['keys'](db['FreshdeskField'][_0xc04d('0x43')]);_0x743ec8[_0xc04d('0x33')]=_['keys'](_0x2939f8['query']);_0x743ec8['filters']=_[_0xc04d('0x36')](_0x743ec8['model'],_0x743ec8[_0xc04d('0x33')]);_0x37b747['attributes']=_['intersection'](_0x743ec8[_0xc04d('0x30')],qs[_0xc04d('0x37')](_0x2939f8[_0xc04d('0x33')]['fields']));_0x37b747['attributes']=_0x37b747['attributes'][_0xc04d('0x38')]?_0x37b747[_0xc04d('0x35')]:_0x743ec8[_0xc04d('0x30')];_0x37b747[_0xc04d('0x3a')]=qs['sort'](_0x2939f8['query'][_0xc04d('0x3b')]);_0x37b747[_0xc04d('0x3c')]=qs[_0xc04d('0x34')](_[_0xc04d('0x3d')](_0x2939f8[_0xc04d('0x33')],_0x743ec8[_0xc04d('0x34')]));if(_0x2939f8[_0xc04d('0x33')][_0xc04d('0x4c')]){_0x37b747[_0xc04d('0x3c')]=_[_0xc04d('0x3e')](_0x37b747['where'],{'$or':_[_0xc04d('0x31')](_0x37b747['attributes'],function(_0x11d00c){var _0x1bfeee={};_0x1bfeee[_0x11d00c]={'$like':'%'+_0x2939f8[_0xc04d('0x33')][_0xc04d('0x4c')]+'%'};return _0x1bfeee;})});}_0x37b747=_['merge']({},_0x37b747,_0x2939f8[_0xc04d('0x4d')]);return _0x549c77[_0xc04d('0x4a')](_0x37b747);}})[_0xc04d('0x24')](function(_0x10b6b8){if(_0x10b6b8){_0x18c7af=_0x10b6b8['length'];if(!_0x2939f8['query'][_0xc04d('0x39')](_0xc04d('0x4e'))){_0x37b747[_0xc04d('0x1b')]=qs[_0xc04d('0x1b')](_0x2939f8[_0xc04d('0x33')][_0xc04d('0x1b')]);_0x37b747[_0xc04d('0x1e')]=qs['offset'](_0x2939f8['query'][_0xc04d('0x1e')]);}return _0x549c77['getFields'](_0x37b747);}})[_0xc04d('0x24')](function(_0x12b811){if(_0x12b811){return _0x12b811?{'count':_0x18c7af,'rows':_0x12b811}:null;}})[_0xc04d('0x24')](respondWithResult(_0xf88ebe,null))[_0xc04d('0x45')](handleError(_0xf88ebe,null));};exports[_0xc04d('0x4f')]=function(_0x59411c,_0x32f4d0,_0x25b80a){var _0x4e0fbd={};var _0x36efd6={};var _0x4026e7;var _0x105836;return db[_0xc04d('0x2c')][_0xc04d('0x4b')]({'where':{'id':_0x59411c[_0xc04d('0x48')]['id']}})[_0xc04d('0x24')](handleEntityNotFound(_0x32f4d0,null))[_0xc04d('0x24')](function(_0x200452){if(_0x200452){_0x4026e7=_0x200452;_0x36efd6[_0xc04d('0x30')]=_[_0xc04d('0x32')](db[_0xc04d('0x50')]['rawAttributes']);_0x36efd6['query']=_[_0xc04d('0x32')](_0x59411c['query']);_0x36efd6[_0xc04d('0x34')]=_['intersection'](_0x36efd6['model'],_0x36efd6[_0xc04d('0x33')]);_0x4e0fbd[_0xc04d('0x35')]=_[_0xc04d('0x36')](_0x36efd6[_0xc04d('0x30')],qs['fields'](_0x59411c['query'][_0xc04d('0x37')]));_0x4e0fbd[_0xc04d('0x35')]=_0x4e0fbd[_0xc04d('0x35')][_0xc04d('0x38')]?_0x4e0fbd['attributes']:_0x36efd6[_0xc04d('0x30')];_0x4e0fbd[_0xc04d('0x3a')]=qs[_0xc04d('0x3b')](_0x59411c['query'][_0xc04d('0x3b')]);_0x4e0fbd[_0xc04d('0x3c')]=qs['filters'](_[_0xc04d('0x3d')](_0x59411c[_0xc04d('0x33')],_0x36efd6[_0xc04d('0x34')]));if(_0x59411c[_0xc04d('0x33')][_0xc04d('0x4c')]){_0x4e0fbd['where']=_['merge'](_0x4e0fbd['where'],{'$or':_[_0xc04d('0x31')](_0x4e0fbd[_0xc04d('0x35')],function(_0x7dea85){var _0x3b5bd1={};_0x3b5bd1[_0x7dea85]={'$like':'%'+_0x59411c[_0xc04d('0x33')]['filter']+'%'};return _0x3b5bd1;})});}_0x4e0fbd=_[_0xc04d('0x3e')]({},_0x4e0fbd,_0x59411c[_0xc04d('0x4d')]);return _0x4026e7[_0xc04d('0x4f')](_0x4e0fbd);}})['then'](function(_0x41b1a1){if(_0x41b1a1){_0x105836=_0x41b1a1['length'];if(!_0x59411c[_0xc04d('0x33')][_0xc04d('0x39')](_0xc04d('0x4e'))){_0x4e0fbd[_0xc04d('0x1b')]=qs[_0xc04d('0x1b')](_0x59411c[_0xc04d('0x33')][_0xc04d('0x1b')]);_0x4e0fbd[_0xc04d('0x1e')]=qs[_0xc04d('0x1e')](_0x59411c['query'][_0xc04d('0x1e')]);}return _0x4026e7['getSubjects'](_0x4e0fbd);}})[_0xc04d('0x24')](function(_0x3aca62){if(_0x3aca62){return _0x3aca62?{'count':_0x105836,'rows':_0x3aca62}:null;}})[_0xc04d('0x24')](respondWithResult(_0x32f4d0,null))[_0xc04d('0x45')](handleError(_0x32f4d0,null));};exports[_0xc04d('0x51')]=function(_0x3243b2,_0x3274ae,_0x374fa7){var _0x5f37b9={};var _0x29de66={};var _0x30db3c;var _0x476baf;return db[_0xc04d('0x2c')][_0xc04d('0x4b')]({'where':{'id':_0x3243b2[_0xc04d('0x48')]['id']}})[_0xc04d('0x24')](handleEntityNotFound(_0x3274ae,null))[_0xc04d('0x24')](function(_0x20e03d){if(_0x20e03d){_0x30db3c=_0x20e03d;_0x29de66['model']=_[_0xc04d('0x32')](db['FreshdeskField'][_0xc04d('0x43')]);_0x29de66[_0xc04d('0x33')]=_['keys'](_0x3243b2[_0xc04d('0x33')]);_0x29de66[_0xc04d('0x34')]=_[_0xc04d('0x36')](_0x29de66[_0xc04d('0x30')],_0x29de66[_0xc04d('0x33')]);_0x5f37b9[_0xc04d('0x35')]=_[_0xc04d('0x36')](_0x29de66['model'],qs[_0xc04d('0x37')](_0x3243b2[_0xc04d('0x33')][_0xc04d('0x37')]));_0x5f37b9[_0xc04d('0x35')]=_0x5f37b9['attributes'][_0xc04d('0x38')]?_0x5f37b9['attributes']:_0x29de66[_0xc04d('0x30')];_0x5f37b9[_0xc04d('0x3a')]=qs[_0xc04d('0x3b')](_0x3243b2[_0xc04d('0x33')][_0xc04d('0x3b')]);_0x5f37b9[_0xc04d('0x3c')]=qs[_0xc04d('0x34')](_[_0xc04d('0x3d')](_0x3243b2[_0xc04d('0x33')],_0x29de66[_0xc04d('0x34')]));if(_0x3243b2[_0xc04d('0x33')][_0xc04d('0x4c')]){_0x5f37b9[_0xc04d('0x3c')]=_[_0xc04d('0x3e')](_0x5f37b9[_0xc04d('0x3c')],{'$or':_['map'](_0x5f37b9[_0xc04d('0x35')],function(_0x5662a3){var _0x16a39b={};_0x16a39b[_0x5662a3]={'$like':'%'+_0x3243b2[_0xc04d('0x33')][_0xc04d('0x4c')]+'%'};return _0x16a39b;})});}_0x5f37b9=_[_0xc04d('0x3e')]({},_0x5f37b9,_0x3243b2['options']);return _0x30db3c[_0xc04d('0x51')](_0x5f37b9);}})['then'](function(_0x389d13){if(_0x389d13){_0x476baf=_0x389d13['length'];if(!_0x3243b2[_0xc04d('0x33')]['hasOwnProperty'](_0xc04d('0x4e'))){_0x5f37b9[_0xc04d('0x1b')]=qs[_0xc04d('0x1b')](_0x3243b2[_0xc04d('0x33')][_0xc04d('0x1b')]);_0x5f37b9[_0xc04d('0x1e')]=qs['offset'](_0x3243b2[_0xc04d('0x33')][_0xc04d('0x1e')]);}return _0x30db3c[_0xc04d('0x51')](_0x5f37b9);}})[_0xc04d('0x24')](function(_0x425a1a){if(_0x425a1a){return _0x425a1a?{'count':_0x476baf,'rows':_0x425a1a}:null;}})['then'](respondWithResult(_0x3274ae,null))[_0xc04d('0x45')](handleError(_0x3274ae,null));};exports[_0xc04d('0x52')]=function(_0x53290b,_0x4d04c8,_0x89a3b4){var _0x33996={};var _0x767204={};var _0x42591e;var _0x2576b4;return db[_0xc04d('0x2c')][_0xc04d('0x4b')]({'where':{'id':_0x53290b[_0xc04d('0x48')]['id']}})[_0xc04d('0x24')](handleEntityNotFound(_0x4d04c8,null))[_0xc04d('0x24')](function(_0x7d9576){if(_0x7d9576){_0x42591e=_0x7d9576;_0x767204[_0xc04d('0x30')]=_[_0xc04d('0x32')](db[_0xc04d('0x53')][_0xc04d('0x43')]);_0x767204['query']=_[_0xc04d('0x32')](_0x53290b[_0xc04d('0x33')]);_0x767204[_0xc04d('0x34')]=_[_0xc04d('0x36')](_0x767204[_0xc04d('0x30')],_0x767204['query']);_0x33996['attributes']=_[_0xc04d('0x36')](_0x767204[_0xc04d('0x30')],qs[_0xc04d('0x37')](_0x53290b[_0xc04d('0x33')][_0xc04d('0x37')]));_0x33996[_0xc04d('0x35')]=_0x33996[_0xc04d('0x35')][_0xc04d('0x38')]?_0x33996[_0xc04d('0x35')]:_0x767204[_0xc04d('0x30')];_0x33996['order']=qs['sort'](_0x53290b[_0xc04d('0x33')][_0xc04d('0x3b')]);_0x33996[_0xc04d('0x3c')]=qs[_0xc04d('0x34')](_[_0xc04d('0x3d')](_0x53290b[_0xc04d('0x33')],_0x767204[_0xc04d('0x34')]));if(_0x53290b['query']['filter']){_0x33996[_0xc04d('0x3c')]=_[_0xc04d('0x3e')](_0x33996['where'],{'$or':_[_0xc04d('0x31')](_0x33996['attributes'],function(_0x1f32c8){var _0x1f924c={};_0x1f924c[_0x1f32c8]={'$like':'%'+_0x53290b['query'][_0xc04d('0x4c')]+'%'};return _0x1f924c;})});}_0x33996=_['merge']({},_0x33996,_0x53290b[_0xc04d('0x4d')]);return _0x42591e[_0xc04d('0x52')](_0x33996);}})['then'](function(_0x104c6d){if(_0x104c6d){_0x2576b4=_0x104c6d['length'];if(!_0x53290b[_0xc04d('0x33')][_0xc04d('0x39')](_0xc04d('0x4e'))){_0x33996['limit']=qs[_0xc04d('0x1b')](_0x53290b[_0xc04d('0x33')][_0xc04d('0x1b')]);_0x33996[_0xc04d('0x1e')]=qs[_0xc04d('0x1e')](_0x53290b[_0xc04d('0x33')][_0xc04d('0x1e')]);}return _0x42591e[_0xc04d('0x52')](_0x33996);}})[_0xc04d('0x24')](function(_0x458c2b){if(_0x458c2b){return _0x458c2b?{'count':_0x2576b4,'rows':_0x458c2b}:null;}})[_0xc04d('0x24')](respondWithResult(_0x4d04c8,null))[_0xc04d('0x45')](handleError(_0x4d04c8,null));};exports['setTags']=function(_0x179147,_0x5f21c4,_0x599dc1){if(_0x179147[_0xc04d('0x47')]['id']){delete _0x179147['body']['id'];}return db[_0xc04d('0x2c')][_0xc04d('0x4b')]({'where':{'id':_0x179147[_0xc04d('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f21c4,null))[_0xc04d('0x24')](function(_0x1af302){if(_0x1af302){return _0x1af302[_0xc04d('0x54')](_0x179147['body'][_0xc04d('0x55')]||[]);}return null;})[_0xc04d('0x24')](respondWithResult(_0x5f21c4,null))[_0xc04d('0x45')](handleError(_0x5f21c4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a4be001..e3acea7 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 _0xb980=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb980,0x158));var _0x0b98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb980[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b98('0x0'));var util=require(_0x0b98('0x1'));var logger=require('../../config/logger')(_0x0b98('0x2'));var moment=require(_0x0b98('0x3'));var BPromise=require(_0x0b98('0x4'));var rp=require(_0x0b98('0x5'));var fs=require('fs');var path=require(_0x0b98('0x6'));var rimraf=require(_0x0b98('0x7'));var config=require(_0x0b98('0x8'));var attributes=require(_0x0b98('0x9'));module[_0x0b98('0xa')]=function(_0x46cc8f,_0x114583){return _0x46cc8f[_0x0b98('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0x0b98('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d2=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ca622,_0x335f62){var _0x5543a6=function(_0x28028b){while(--_0x28028b){_0x4ca622['push'](_0x4ca622['shift']());}};_0x5543a6(++_0x335f62);}(_0x79d2,0xcb));var _0x279d=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x79d2[_0x39ffd1];return _0x31267e;};'use strict';var _=require(_0x279d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x279d('0x1'));var BPromise=require(_0x279d('0x2'));var rp=require(_0x279d('0x3'));var fs=require('fs');var path=require(_0x279d('0x4'));var rimraf=require(_0x279d('0x5'));var config=require(_0x279d('0x6'));var attributes=require(_0x279d('0x7'));module[_0x279d('0x8')]=function(_0x41be00,_0x16d061){return _0x41be00[_0x279d('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x279d('0xa'),'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 3c17412..93e5895 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 _0x6444=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x356a8d,_0x182682){var _0x3ac4b4=function(_0x246f8b){while(--_0x246f8b){_0x356a8d['push'](_0x356a8d['shift']());}};_0x3ac4b4(++_0x182682);}(_0x6444,0x6a));var _0x4644=function(_0x319b97,_0x489c27){_0x319b97=_0x319b97-0x0;var _0x454f9e=_0x6444[_0x319b97];return _0x454f9e;};'use strict';var _=require(_0x4644('0x0'));var util=require(_0x4644('0x1'));var moment=require(_0x4644('0x2'));var BPromise=require(_0x4644('0x3'));var rs=require(_0x4644('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4644('0x5'))['db'];var utils=require(_0x4644('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4644('0x7'));var client=jayson[_0x4644('0x8')][_0x4644('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38d480,_0x523a48,_0x187069){return new BPromise(function(_0x1462b2,_0x1a6dec){return client['request'](_0x38d480,_0x187069)[_0x4644('0xa')](function(_0x58deaa){logger[_0x4644('0xb')](_0x4644('0xc'),_0x523a48,_0x4644('0xd'));logger[_0x4644('0xe')](_0x4644('0xf'),_0x523a48,_0x4644('0xd'),JSON[_0x4644('0x10')](_0x58deaa));if(_0x58deaa[_0x4644('0x11')]){if(_0x58deaa['error']['code']===0x1f4){logger['error'](_0x4644('0xc'),_0x523a48,_0x58deaa['error'][_0x4644('0x12')]);return _0x1a6dec(_0x58deaa[_0x4644('0x11')]['message']);}logger[_0x4644('0x11')](_0x4644('0xc'),_0x523a48,_0x58deaa[_0x4644('0x11')][_0x4644('0x12')]);return _0x1462b2(_0x58deaa[_0x4644('0x11')][_0x4644('0x12')]);}else{logger['info'](_0x4644('0xc'),_0x523a48,_0x4644('0xd'));_0x1462b2(_0x58deaa[_0x4644('0x13')][_0x4644('0x12')]);}})[_0x4644('0x14')](function(_0x2c6ebf){logger['error'](_0x4644('0xc'),_0x523a48,_0x2c6ebf);_0x1a6dec(_0x2c6ebf);});});} \ No newline at end of file +var _0x3c66=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','debug','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3c66,0x85));var _0x63c6=function(_0x57c039,_0x5b847d){_0x57c039=_0x57c039-0x0;var _0x57c58d=_0x3c66[_0x57c039];return _0x57c58d;};'use strict';var _=require(_0x63c6('0x0'));var util=require(_0x63c6('0x1'));var moment=require(_0x63c6('0x2'));var BPromise=require(_0x63c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63c6('0x4'));var db=require(_0x63c6('0x5'))['db'];var utils=require(_0x63c6('0x6'));var logger=require(_0x63c6('0x7'))(_0x63c6('0x8'));var config=require(_0x63c6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x63c6('0xa')][_0x63c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x123994,_0x285a82,_0x57af6c){return new BPromise(function(_0x59c207,_0x47c106){return client[_0x63c6('0xc')](_0x123994,_0x57af6c)['then'](function(_0x525364){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x285a82,'request\x20sent');logger[_0x63c6('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x285a82,_0x63c6('0xe'),JSON[_0x63c6('0xf')](_0x525364));if(_0x525364[_0x63c6('0x10')]){if(_0x525364[_0x63c6('0x10')][_0x63c6('0x11')]===0x1f4){logger[_0x63c6('0x10')](_0x63c6('0x12'),_0x285a82,_0x525364['error'][_0x63c6('0x13')]);return _0x47c106(_0x525364[_0x63c6('0x10')][_0x63c6('0x13')]);}logger[_0x63c6('0x10')](_0x63c6('0x12'),_0x285a82,_0x525364['error'][_0x63c6('0x13')]);return _0x59c207(_0x525364[_0x63c6('0x10')][_0x63c6('0x13')]);}else{logger[_0x63c6('0x14')](_0x63c6('0x12'),_0x285a82,_0x63c6('0xe'));_0x59c207(_0x525364[_0x63c6('0x15')][_0x63c6('0x13')]);}})[_0x63c6('0x16')](function(_0x37a212){logger['error'](_0x63c6('0x12'),_0x285a82,_0x37a212);_0x47c106(_0x37a212);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index afddc7f..d99b321 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 _0x2f9b=['delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x2f9b,0x142));var _0xb2f9=function(_0x23c98c,_0xd36881){_0x23c98c=_0x23c98c-0x0;var _0x47d361=_0x2f9b[_0x23c98c];return _0x47d361;};'use strict';var multer=require(_0xb2f9('0x0'));var util=require(_0xb2f9('0x1'));var path=require(_0xb2f9('0x2'));var timeout=require(_0xb2f9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb2f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2f9('0x5'));var config=require(_0xb2f9('0x6'));var controller=require('./intFreshdeskField.controller');router[_0xb2f9('0x7')]('/',auth[_0xb2f9('0x8')](),controller['index']);router[_0xb2f9('0x7')](_0xb2f9('0x9'),auth['isAuthenticated'](),controller[_0xb2f9('0xa')]);router[_0xb2f9('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb2f9('0xc')]('/:id',auth[_0xb2f9('0x8')](),controller[_0xb2f9('0xd')]);router[_0xb2f9('0xe')](_0xb2f9('0x9'),auth[_0xb2f9('0x8')](),controller[_0xb2f9('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc071=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x45b5c5,_0x28e0b6){var _0x165dc9=function(_0x39e5b9){while(--_0x39e5b9){_0x45b5c5['push'](_0x45b5c5['shift']());}};_0x165dc9(++_0x28e0b6);}(_0xc071,0x1bb));var _0x1c07=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xc071[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require(_0x1c07('0x0'));var util=require('util');var path=require(_0x1c07('0x1'));var timeout=require(_0x1c07('0x2'));var express=require(_0x1c07('0x3'));var router=express['Router']();var fs_extra=require(_0x1c07('0x4'));var auth=require(_0x1c07('0x5'));var interaction=require(_0x1c07('0x6'));var config=require(_0x1c07('0x7'));var controller=require(_0x1c07('0x8'));router[_0x1c07('0x9')]('/',auth[_0x1c07('0xa')](),controller[_0x1c07('0xb')]);router[_0x1c07('0x9')](_0x1c07('0xc'),auth[_0x1c07('0xa')](),controller[_0x1c07('0xd')]);router['post']('/',auth[_0x1c07('0xa')](),controller[_0x1c07('0xe')]);router[_0x1c07('0xf')](_0x1c07('0xc'),auth[_0x1c07('0xa')](),controller[_0x1c07('0x10')]);router[_0x1c07('0x11')](_0x1c07('0xc'),auth[_0x1c07('0xa')](),controller[_0x1c07('0x12')]);module[_0x1c07('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 12453a9..ae97c33 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 _0x4222=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x624d69,_0x9eaed){var _0x2f03ef=function(_0x1e8727){while(--_0x1e8727){_0x624d69['push'](_0x624d69['shift']());}};_0x2f03ef(++_0x9eaed);}(_0x4222,0x17c));var _0x2422=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4222[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x2422('0x0')]={'type':{'type':Sequelize[_0x2422('0x1')](_0x2422('0x2'),_0x2422('0x3'),_0x2422('0x4'),_0x2422('0x5'),_0x2422('0x6')),'defaultValue':_0x2422('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2422('0x7')]},'keyType':{'type':Sequelize[_0x2422('0x1')](_0x2422('0x2'),'variable',_0x2422('0x4'))},'keyContent':{'type':Sequelize[_0x2422('0x7')]},'idField':{'type':Sequelize[_0x2422('0x7')]},'nameField':{'type':Sequelize[_0x2422('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2422('0x7')]}}; \ No newline at end of file +var _0xbcb0=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x506b84,_0x5ae9d3){var _0x363f0a=function(_0x3d82c8){while(--_0x3d82c8){_0x506b84['push'](_0x506b84['shift']());}};_0x363f0a(++_0x5ae9d3);}(_0xbcb0,0xc3));var _0x0bcb=function(_0x42e540,_0xf667d3){_0x42e540=_0x42e540-0x0;var _0x544af3=_0xbcb0[_0x42e540];return _0x544af3;};'use strict';var Sequelize=require(_0x0bcb('0x0'));module[_0x0bcb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0bcb('0x2'),_0x0bcb('0x3'),_0x0bcb('0x4'),_0x0bcb('0x5'),'picklist'),'defaultValue':_0x0bcb('0x2')},'content':{'type':Sequelize[_0x0bcb('0x6')]},'key':{'type':Sequelize[_0x0bcb('0x6')]},'keyType':{'type':Sequelize[_0x0bcb('0x7')]('string','variable',_0x0bcb('0x4'))},'keyContent':{'type':Sequelize[_0x0bcb('0x6')]},'idField':{'type':Sequelize[_0x0bcb('0x6')]},'nameField':{'type':Sequelize[_0x0bcb('0x6')]},'customField':{'type':Sequelize[_0x0bcb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0bcb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e38d565..306b466 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 _0x407f=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','type','VIRTUAL','filter','include','catch','show','params','includeAll','options','create','body','update','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5e548a,_0x38e6ff){var _0x42310f=function(_0x4b56dd){while(--_0x4b56dd){_0x5e548a['push'](_0x5e548a['shift']());}};_0x42310f(++_0x38e6ff);}(_0x407f,0xc2));var _0xf407=function(_0x1b8191,_0xf183e9){_0x1b8191=_0x1b8191-0x0;var _0x2ccc28=_0x407f[_0x1b8191];return _0x2ccc28;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf407('0x0'));var rp=require(_0xf407('0x1'));var moment=require(_0xf407('0x2'));var BPromise=require(_0xf407('0x3'));var Mustache=require(_0xf407('0x4'));var util=require(_0xf407('0x5'));var path=require(_0xf407('0x6'));var sox=require(_0xf407('0x7'));var csv=require(_0xf407('0x8'));var ejs=require(_0xf407('0x9'));var fs=require('fs');var fs_extra=require(_0xf407('0xa'));var _=require(_0xf407('0xb'));var squel=require(_0xf407('0xc'));var crypto=require(_0xf407('0xd'));var jsforce=require(_0xf407('0xe'));var deskjs=require(_0xf407('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf407('0x10'));var Papa=require(_0xf407('0x11'));var Redis=require(_0xf407('0x12'));var authService=require(_0xf407('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf407('0x14'))(_0xf407('0x15'));var utils=require(_0xf407('0x16'));var config=require(_0xf407('0x17'));var licenseUtil=require(_0xf407('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ee485,_0x3f4ca0){_0x3f4ca0=_0x3f4ca0||0xcc;return function(_0x3b26ae){if(_0x3b26ae){return _0x2ee485[_0xf407('0x19')](_0x3f4ca0);}return _0x2ee485[_0xf407('0x1a')](_0x3f4ca0)[_0xf407('0x1b')]();};}function respondWithResult(_0x242f43,_0x5257ef){_0x5257ef=_0x5257ef||0xc8;return function(_0x5d80ab){if(_0x5d80ab){return _0x242f43['status'](_0x5257ef)[_0xf407('0x1c')](_0x5d80ab);}};}function respondWithFilteredResult(_0x593e36,_0x454710){return function(_0x4c1320){if(_0x4c1320){var _0x48fd5d=typeof _0x454710[_0xf407('0x1d')]===_0xf407('0x1e')&&typeof _0x454710[_0xf407('0x1f')]===_0xf407('0x1e');var _0x351252=_0x4c1320[_0xf407('0x20')];var _0x4ddbe6=_0x48fd5d?0x0:_0x454710[_0xf407('0x1d')];var _0x588fe4=_0x48fd5d?_0x4c1320[_0xf407('0x20')]:_0x454710[_0xf407('0x1d')]+_0x454710[_0xf407('0x1f')];var _0x334c1a;if(_0x588fe4>=_0x351252){_0x588fe4=_0x351252;_0x334c1a=0xc8;}else{_0x334c1a=0xce;}_0x593e36[_0xf407('0x1a')](_0x334c1a);return _0x593e36[_0xf407('0x21')]('Content-Range',_0x4ddbe6+'-'+_0x588fe4+'/'+_0x351252)[_0xf407('0x1c')](_0x4c1320);}return null;};}function patchUpdates(_0x39febd){return function(_0x2f7ed0){try{jsonpatch[_0xf407('0x22')](_0x2f7ed0,_0x39febd,!![]);}catch(_0x4eb0c3){return BPromise[_0xf407('0x23')](_0x4eb0c3);}return _0x2f7ed0[_0xf407('0x24')]();};}function saveUpdates(_0x23659c,_0xa6f11e){return function(_0x5f32bb){if(_0x5f32bb){return _0x5f32bb['update'](_0x23659c)[_0xf407('0x25')](function(_0x100e6e){return _0x100e6e;});}return null;};}function removeEntity(_0x2558a1,_0x2cea00){return function(_0x9406cf){if(_0x9406cf){return _0x9406cf[_0xf407('0x26')]()[_0xf407('0x25')](function(){_0x2558a1['status'](0xcc)[_0xf407('0x1b')]();});}};}function handleEntityNotFound(_0x1996c8,_0x2f620d){return function(_0x50897a){if(!_0x50897a){_0x1996c8[_0xf407('0x19')](0x194);}return _0x50897a;};}function handleError(_0x1bbd76,_0x2757f7){_0x2757f7=_0x2757f7||0x1f4;return function(_0x2c594a){logger[_0xf407('0x27')](_0x2c594a[_0xf407('0x28')]);if(_0x2c594a['name']){delete _0x2c594a[_0xf407('0x29')];}_0x1bbd76['status'](_0x2757f7)['send'](_0x2c594a);};}exports[_0xf407('0x2a')]=function(_0x115dce,_0x2705c0){var _0x582453={},_0x1c5335={},_0x249028={'count':0x0,'rows':[]};var _0x4c49b7=_[_0xf407('0x2b')](db[_0xf407('0x2c')][_0xf407('0x2d')],function(_0x89915b){return{'name':_0x89915b[_0xf407('0x2e')],'type':_0x89915b['type']['key']};});_0x1c5335[_0xf407('0x2f')]=_[_0xf407('0x2b')](_0x4c49b7,_0xf407('0x29'));_0x1c5335[_0xf407('0x30')]=_[_0xf407('0x31')](_0x115dce[_0xf407('0x30')]);_0x1c5335[_0xf407('0x32')]=_['intersection'](_0x1c5335[_0xf407('0x2f')],_0x1c5335['query']);_0x582453[_0xf407('0x33')]=_[_0xf407('0x34')](_0x1c5335['model'],qs['fields'](_0x115dce['query'][_0xf407('0x35')]));_0x582453[_0xf407('0x33')]=_0x582453['attributes'][_0xf407('0x36')]?_0x582453[_0xf407('0x33')]:_0x1c5335[_0xf407('0x2f')];if(!_0x115dce[_0xf407('0x30')]['hasOwnProperty']('nolimit')){_0x582453[_0xf407('0x1f')]=qs[_0xf407('0x1f')](_0x115dce[_0xf407('0x30')][_0xf407('0x1f')]);_0x582453[_0xf407('0x1d')]=qs[_0xf407('0x1d')](_0x115dce[_0xf407('0x30')][_0xf407('0x1d')]);}_0x582453[_0xf407('0x37')]=qs[_0xf407('0x38')](_0x115dce['query'][_0xf407('0x38')]);_0x582453['where']=qs[_0xf407('0x32')](_[_0xf407('0x39')](_0x115dce[_0xf407('0x30')],_0x1c5335[_0xf407('0x32')]),_0x4c49b7);if(_0x115dce[_0xf407('0x30')]['filter']){_0x582453[_0xf407('0x3a')]=_[_0xf407('0x3b')](_0x582453[_0xf407('0x3a')],{'$or':_[_0xf407('0x2b')](_0x4c49b7,function(_0x492ba9){if(_0x492ba9[_0xf407('0x3c')]!==_0xf407('0x3d')){var _0xe84235={};_0xe84235[_0x492ba9['name']]={'$like':'%'+_0x115dce['query'][_0xf407('0x3e')]+'%'};return _0xe84235;}})});}_0x582453=_['merge']({},_0x582453,_0x115dce['options']);var _0x612d67={'where':_0x582453[_0xf407('0x3a')]};return db['FreshdeskField'][_0xf407('0x20')](_0x612d67)[_0xf407('0x25')](function(_0x2ceefd){_0x249028[_0xf407('0x20')]=_0x2ceefd;if(_0x115dce[_0xf407('0x30')]['includeAll']){_0x582453[_0xf407('0x3f')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x582453);})[_0xf407('0x25')](function(_0x1ddb15){_0x249028['rows']=_0x1ddb15;return _0x249028;})[_0xf407('0x25')](respondWithFilteredResult(_0x2705c0,_0x582453))[_0xf407('0x40')](handleError(_0x2705c0,null));};exports[_0xf407('0x41')]=function(_0x1696e6,_0x43e7a7){var _0xaa954d={'raw':!![],'where':{'id':_0x1696e6[_0xf407('0x42')]['id']}},_0x1c8f17={};_0x1c8f17['model']=_[_0xf407('0x31')](db['FreshdeskField'][_0xf407('0x2d')]);_0x1c8f17['query']=_[_0xf407('0x31')](_0x1696e6['query']);_0x1c8f17[_0xf407('0x32')]=_[_0xf407('0x34')](_0x1c8f17[_0xf407('0x2f')],_0x1c8f17[_0xf407('0x30')]);_0xaa954d[_0xf407('0x33')]=_[_0xf407('0x34')](_0x1c8f17[_0xf407('0x2f')],qs['fields'](_0x1696e6[_0xf407('0x30')][_0xf407('0x35')]));_0xaa954d[_0xf407('0x33')]=_0xaa954d[_0xf407('0x33')][_0xf407('0x36')]?_0xaa954d[_0xf407('0x33')]:_0x1c8f17['model'];if(_0x1696e6[_0xf407('0x30')][_0xf407('0x43')]){_0xaa954d[_0xf407('0x3f')]=[{'all':!![]}];}_0xaa954d=_[_0xf407('0x3b')]({},_0xaa954d,_0x1696e6[_0xf407('0x44')]);return db[_0xf407('0x2c')]['find'](_0xaa954d)[_0xf407('0x25')](handleEntityNotFound(_0x43e7a7,null))[_0xf407('0x25')](respondWithResult(_0x43e7a7,null))[_0xf407('0x40')](handleError(_0x43e7a7,null));};exports['create']=function(_0x2ce4c0,_0x49cf34){return db[_0xf407('0x2c')][_0xf407('0x45')](_0x2ce4c0[_0xf407('0x46')],{})[_0xf407('0x25')](respondWithResult(_0x49cf34,0xc9))['catch'](handleError(_0x49cf34,null));};exports[_0xf407('0x47')]=function(_0x3b6c44,_0x16cf14){if(_0x3b6c44['body']['id']){delete _0x3b6c44['body']['id'];}return db[_0xf407('0x2c')][_0xf407('0x48')]({'where':{'id':_0x3b6c44[_0xf407('0x42')]['id']}})['then'](handleEntityNotFound(_0x16cf14,null))[_0xf407('0x25')](saveUpdates(_0x3b6c44[_0xf407('0x46')],null))[_0xf407('0x25')](respondWithResult(_0x16cf14,null))[_0xf407('0x40')](handleError(_0x16cf14,null));};exports['destroy']=function(_0x1282df,_0x3d3c9d){return db['FreshdeskField'][_0xf407('0x48')]({'where':{'id':_0x1282df[_0xf407('0x42')]['id']}})[_0xf407('0x25')](handleEntityNotFound(_0x3d3c9d,null))['then'](removeEntity(_0x3d3c9d,null))[_0xf407('0x40')](handleError(_0x3d3c9d,null));}; \ No newline at end of file +var _0x153f=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x2cc1e7,_0xc9cee6){var _0x53d353=function(_0x3bc908){while(--_0x3bc908){_0x2cc1e7['push'](_0x2cc1e7['shift']());}};_0x53d353(++_0xc9cee6);}(_0x153f,0x15b));var _0xf153=function(_0x38f1aa,_0x58ff80){_0x38f1aa=_0x38f1aa-0x0;var _0xfa6b6f=_0x153f[_0x38f1aa];return _0xfa6b6f;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){_0x4376f7[_0xf153('0x1c')](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(!_0x141ef4){_0xe490f8[_0xf153('0x1b')](0x194);}return _0x141ef4;};}function handleError(_0x23acc3,_0x17f7a4){_0x17f7a4=_0x17f7a4||0x1f4;return function(_0x48ebdc){logger[_0xf153('0x29')](_0x48ebdc[_0xf153('0x2a')]);if(_0x48ebdc['name']){delete _0x48ebdc[_0xf153('0x2b')];}_0x23acc3[_0xf153('0x1c')](_0x17f7a4)['send'](_0x48ebdc);};}exports[_0xf153('0x2c')]=function(_0x10295e,_0x261ac0){var _0x2b9a9c={},_0x339e96={},_0x258976={'count':0x0,'rows':[]};var _0x441436=_[_0xf153('0x2d')](db[_0xf153('0x2e')][_0xf153('0x2f')],function(_0x13b541){return{'name':_0x13b541[_0xf153('0x30')],'type':_0x13b541['type'][_0xf153('0x31')]};});_0x339e96[_0xf153('0x32')]=_[_0xf153('0x2d')](_0x441436,_0xf153('0x2b'));_0x339e96['query']=_['keys'](_0x10295e[_0xf153('0x33')]);_0x339e96['filters']=_['intersection'](_0x339e96[_0xf153('0x32')],_0x339e96['query']);_0x2b9a9c[_0xf153('0x34')]=_['intersection'](_0x339e96[_0xf153('0x32')],qs[_0xf153('0x35')](_0x10295e['query'][_0xf153('0x35')]));_0x2b9a9c[_0xf153('0x34')]=_0x2b9a9c[_0xf153('0x34')][_0xf153('0x36')]?_0x2b9a9c[_0xf153('0x34')]:_0x339e96[_0xf153('0x32')];if(!_0x10295e['query'][_0xf153('0x37')]('nolimit')){_0x2b9a9c[_0xf153('0x20')]=qs[_0xf153('0x20')](_0x10295e[_0xf153('0x33')][_0xf153('0x20')]);_0x2b9a9c[_0xf153('0x1f')]=qs[_0xf153('0x1f')](_0x10295e['query'][_0xf153('0x1f')]);}_0x2b9a9c[_0xf153('0x38')]=qs[_0xf153('0x39')](_0x10295e['query'][_0xf153('0x39')]);_0x2b9a9c[_0xf153('0x3a')]=qs[_0xf153('0x3b')](_[_0xf153('0x3c')](_0x10295e[_0xf153('0x33')],_0x339e96[_0xf153('0x3b')]),_0x441436);if(_0x10295e['query'][_0xf153('0x3d')]){_0x2b9a9c[_0xf153('0x3a')]=_['merge'](_0x2b9a9c[_0xf153('0x3a')],{'$or':_[_0xf153('0x2d')](_0x441436,function(_0x357666){if(_0x357666[_0xf153('0x3e')]!==_0xf153('0x3f')){var _0x42360a={};_0x42360a[_0x357666[_0xf153('0x2b')]]={'$like':'%'+_0x10295e['query'][_0xf153('0x3d')]+'%'};return _0x42360a;}})});}_0x2b9a9c=_[_0xf153('0x40')]({},_0x2b9a9c,_0x10295e[_0xf153('0x41')]);var _0x352e7c={'where':_0x2b9a9c[_0xf153('0x3a')]};return db[_0xf153('0x2e')]['count'](_0x352e7c)['then'](function(_0xa3922b){_0x258976['count']=_0xa3922b;if(_0x10295e[_0xf153('0x33')][_0xf153('0x42')]){_0x2b9a9c[_0xf153('0x43')]=[{'all':!![]}];}return db[_0xf153('0x2e')][_0xf153('0x44')](_0x2b9a9c);})[_0xf153('0x27')](function(_0x5599e5){_0x258976['rows']=_0x5599e5;return _0x258976;})[_0xf153('0x27')](respondWithFilteredResult(_0x261ac0,_0x2b9a9c))[_0xf153('0x45')](handleError(_0x261ac0,null));};exports['show']=function(_0x21529a,_0x1c77a6){var _0x1edf65={'raw':!![],'where':{'id':_0x21529a[_0xf153('0x46')]['id']}},_0x3a9cb2={};_0x3a9cb2[_0xf153('0x32')]=_[_0xf153('0x47')](db[_0xf153('0x2e')][_0xf153('0x2f')]);_0x3a9cb2[_0xf153('0x33')]=_[_0xf153('0x47')](_0x21529a[_0xf153('0x33')]);_0x3a9cb2['filters']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],_0x3a9cb2[_0xf153('0x33')]);_0x1edf65['attributes']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],qs['fields'](_0x21529a[_0xf153('0x33')]['fields']));_0x1edf65[_0xf153('0x34')]=_0x1edf65[_0xf153('0x34')][_0xf153('0x36')]?_0x1edf65['attributes']:_0x3a9cb2[_0xf153('0x32')];if(_0x21529a[_0xf153('0x33')][_0xf153('0x42')]){_0x1edf65[_0xf153('0x43')]=[{'all':!![]}];}_0x1edf65=_[_0xf153('0x40')]({},_0x1edf65,_0x21529a['options']);return db[_0xf153('0x2e')][_0xf153('0x49')](_0x1edf65)['then'](handleEntityNotFound(_0x1c77a6,null))[_0xf153('0x27')](respondWithResult(_0x1c77a6,null))[_0xf153('0x45')](handleError(_0x1c77a6,null));};exports[_0xf153('0x4a')]=function(_0x5599a6,_0x657403){return db[_0xf153('0x2e')][_0xf153('0x4a')](_0x5599a6[_0xf153('0x4b')],{})[_0xf153('0x27')](respondWithResult(_0x657403,0xc9))[_0xf153('0x45')](handleError(_0x657403,null));};exports[_0xf153('0x26')]=function(_0x33e48,_0x3b91ed){if(_0x33e48['body']['id']){delete _0x33e48[_0xf153('0x4b')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x33e48['params']['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x3b91ed,null))[_0xf153('0x27')](saveUpdates(_0x33e48['body'],null))[_0xf153('0x27')](respondWithResult(_0x3b91ed,null))[_0xf153('0x45')](handleError(_0x3b91ed,null));};exports['destroy']=function(_0x3f1ecb,_0xe6e023){return db[_0xf153('0x2e')][_0xf153('0x49')]({'where':{'id':_0x3f1ecb[_0xf153('0x46')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0xe6e023,null))['then'](removeEntity(_0xe6e023,null))[_0xf153('0x45')](handleError(_0xe6e023,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3e8dd55..b2f6f21 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 _0x072c=['moment','bluebird','request-promise','path','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','api'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x072c,0x10f));var _0xc072=function(_0x181b18,_0x37304d){_0x181b18=_0x181b18-0x0;var _0xcdfaff=_0x072c[_0x181b18];return _0xcdfaff;};'use strict';var _=require(_0xc072('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc072('0x1'));var moment=require(_0xc072('0x2'));var BPromise=require(_0xc072('0x3'));var rp=require(_0xc072('0x4'));var fs=require('fs');var path=require(_0xc072('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc072('0x6'));module['exports']=function(_0x852f18,_0x2fdd9a){return _0x852f18[_0xc072('0x7')](_0xc072('0x8'),attributes,{'tableName':_0xc072('0x9'),'paranoid':![],'indexes':[{'name':_0xc072('0xa'),'fields':[_0xc072('0xb'),_0xc072('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fb9=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x9aca6b,_0x2d08cc){var _0x3ff9c3=function(_0x3e65f6){while(--_0x3e65f6){_0x9aca6b['push'](_0x9aca6b['shift']());}};_0x3ff9c3(++_0x2d08cc);}(_0x3fb9,0x1d9));var _0x93fb=function(_0x3d0f55,_0x1baaee){_0x3d0f55=_0x3d0f55-0x0;var _0x2e8646=_0x3fb9[_0x3d0f55];return _0x2e8646;};'use strict';var _=require(_0x93fb('0x0'));var util=require(_0x93fb('0x1'));var logger=require(_0x93fb('0x2'))(_0x93fb('0x3'));var moment=require('moment');var BPromise=require(_0x93fb('0x4'));var rp=require(_0x93fb('0x5'));var fs=require('fs');var path=require(_0x93fb('0x6'));var rimraf=require(_0x93fb('0x7'));var config=require(_0x93fb('0x8'));var attributes=require(_0x93fb('0x9'));module[_0x93fb('0xa')]=function(_0x2c78d4,_0x347d58){return _0x2c78d4[_0x93fb('0xb')](_0x93fb('0xc'),attributes,{'tableName':_0x93fb('0xd'),'paranoid':![],'indexes':[{'name':_0x93fb('0xe'),'fields':[_0x93fb('0xf'),_0x93fb('0x10')],'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 2ab05b6..559ad27 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 _0xf90b=['../../config/environment','client','http','request','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5a560f,_0x359223){var _0x761cc7=function(_0x229d30){while(--_0x229d30){_0x5a560f['push'](_0x5a560f['shift']());}};_0x761cc7(++_0x359223);}(_0xf90b,0x10b));var _0xbf90=function(_0x36b5f2,_0x331799){_0x36b5f2=_0x36b5f2-0x0;var _0x410b5b=_0xf90b[_0x36b5f2];return _0x410b5b;};'use strict';var _=require(_0xbf90('0x0'));var util=require(_0xbf90('0x1'));var moment=require(_0xbf90('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf90('0x3'));var fs=require('fs');var Redis=require(_0xbf90('0x4'));var db=require(_0xbf90('0x5'))['db'];var utils=require(_0xbf90('0x6'));var logger=require(_0xbf90('0x7'))(_0xbf90('0x8'));var config=require(_0xbf90('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbf90('0xa')][_0xbf90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59ee36,_0x344e6c,_0x2fd93c){return new BPromise(function(_0x756028,_0x4506da){return client[_0xbf90('0xc')](_0x59ee36,_0x2fd93c)['then'](function(_0x23ace6){logger['info'](_0xbf90('0xd'),_0x344e6c,'request\x20sent');logger[_0xbf90('0xe')](_0xbf90('0xf'),_0x344e6c,'request\x20sent',JSON[_0xbf90('0x10')](_0x23ace6));if(_0x23ace6[_0xbf90('0x11')]){if(_0x23ace6[_0xbf90('0x11')][_0xbf90('0x12')]===0x1f4){logger[_0xbf90('0x11')](_0xbf90('0xd'),_0x344e6c,_0x23ace6[_0xbf90('0x11')][_0xbf90('0x13')]);return _0x4506da(_0x23ace6['error'][_0xbf90('0x13')]);}logger[_0xbf90('0x11')](_0xbf90('0xd'),_0x344e6c,_0x23ace6['error'][_0xbf90('0x13')]);return _0x756028(_0x23ace6[_0xbf90('0x11')][_0xbf90('0x13')]);}else{logger[_0xbf90('0x14')](_0xbf90('0xd'),_0x344e6c,_0xbf90('0x15'));_0x756028(_0x23ace6['result'][_0xbf90('0x13')]);}})[_0xbf90('0x16')](function(_0x4763a1){logger['error'](_0xbf90('0xd'),_0x344e6c,_0x4763a1);_0x4506da(_0x4763a1);});});} \ No newline at end of file +var _0x6f21=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3d2486,_0xe1e01e){var _0x1e5ade=function(_0x20981b){while(--_0x20981b){_0x3d2486['push'](_0x3d2486['shift']());}};_0x1e5ade(++_0xe1e01e);}(_0x6f21,0x11e));var _0x16f2=function(_0x384e01,_0x435e36){_0x384e01=_0x384e01-0x0;var _0x455bc7=_0x6f21[_0x384e01];return _0x455bc7;};'use strict';var _=require(_0x16f2('0x0'));var util=require(_0x16f2('0x1'));var moment=require(_0x16f2('0x2'));var BPromise=require('bluebird');var rs=require(_0x16f2('0x3'));var fs=require('fs');var Redis=require(_0x16f2('0x4'));var db=require(_0x16f2('0x5'))['db'];var utils=require(_0x16f2('0x6'));var logger=require('../../config/logger')(_0x16f2('0x7'));var config=require(_0x16f2('0x8'));var jayson=require(_0x16f2('0x9'));var client=jayson[_0x16f2('0xa')][_0x16f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53c7cc,_0x43d4fc,_0x26856a){return new BPromise(function(_0x487d79,_0x10cb0c){return client['request'](_0x53c7cc,_0x26856a)[_0x16f2('0xc')](function(_0x436a86){logger[_0x16f2('0xd')](_0x16f2('0xe'),_0x43d4fc,'request\x20sent');logger[_0x16f2('0xf')](_0x16f2('0x10'),_0x43d4fc,_0x16f2('0x11'),JSON[_0x16f2('0x12')](_0x436a86));if(_0x436a86['error']){if(_0x436a86[_0x16f2('0x13')][_0x16f2('0x14')]===0x1f4){logger[_0x16f2('0x13')](_0x16f2('0xe'),_0x43d4fc,_0x436a86[_0x16f2('0x13')][_0x16f2('0x15')]);return _0x10cb0c(_0x436a86['error'][_0x16f2('0x15')]);}logger[_0x16f2('0x13')](_0x16f2('0xe'),_0x43d4fc,_0x436a86[_0x16f2('0x13')][_0x16f2('0x15')]);return _0x487d79(_0x436a86[_0x16f2('0x13')][_0x16f2('0x15')]);}else{logger[_0x16f2('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x43d4fc,_0x16f2('0x11'));_0x487d79(_0x436a86[_0x16f2('0x16')][_0x16f2('0x15')]);}})[_0x16f2('0x17')](function(_0x539661){logger[_0x16f2('0x13')](_0x16f2('0xe'),_0x43d4fc,_0x539661);_0x10cb0c(_0x539661);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 5881b34..36f594b 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 _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x53829d,_0xc7fce8){var _0x29d370=function(_0x11269f){while(--_0x11269f){_0x53829d['push'](_0x53829d['shift']());}};_0x29d370(++_0xc7fce8);}(_0xc900,0xb3));var _0x0c90=function(_0x450256,_0x3477ae){_0x450256=_0x450256-0x0;var _0x17aa36=_0xc900[_0x450256];return _0x17aa36;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file +var _0x351d=['index','/:id','/:id/configurations','getFields','create','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x351d,0x90));var _0xd351=function(_0x52a4d8,_0x53e892){_0x52a4d8=_0x52a4d8-0x0;var _0x37492b=_0x351d[_0x52a4d8];return _0x37492b;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var fs_extra=require(_0xd351('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0xd351('0x7')]('/',auth[_0xd351('0x8')](),controller[_0xd351('0x9')]);router['get'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['show']);router[_0xd351('0x7')](_0xd351('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd351('0x7')]('/:id/fields',auth[_0xd351('0x8')](),controller[_0xd351('0xc')]);router['post']('/',auth[_0xd351('0x8')](),controller[_0xd351('0xd')]);router['post'](_0xd351('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd351('0xe')](_0xd351('0xa'),auth[_0xd351('0x8')](),controller[_0xd351('0xf')]);router['delete'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['destroy']);module[_0xd351('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 114c249..a2325d0 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 _0x627e=['STRING','remoteUri','sequelize','exports'];(function(_0x11bb29,_0x52fbfa){var _0x117c7d=function(_0x28d800){while(--_0x28d800){_0x11bb29['push'](_0x11bb29['shift']());}};_0x117c7d(++_0x52fbfa);}(_0x627e,0x14a));var _0xe627=function(_0x5ac8f7,_0x59ac67){_0x5ac8f7=_0x5ac8f7-0x0;var _0x4fffff=_0x627e[_0x5ac8f7];return _0x4fffff;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'name':{'type':Sequelize[_0xe627('0x2')]},'description':{'type':Sequelize[_0xe627('0x2')]},'username':{'type':Sequelize[_0xe627('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe627('0x2')]},'remoteUri':{'type':Sequelize[_0xe627('0x2')],'unique':_0xe627('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x5ad60a,_0x5262c5){var _0x266de2=function(_0x467006){while(--_0x467006){_0x5ad60a['push'](_0x5ad60a['shift']());}};_0x266de2(++_0x5262c5);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x51302d,_0x3496cc){_0x51302d=_0x51302d-0x0;var _0x49e012=_0xdd4f[_0x51302d];return _0x49e012;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index be8d395..0841d96 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 _0x157a=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','params','catch','destroy','findOne','FreshsalesConfiguration','pick','filter','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x157a,0x66));var _0xa157=function(_0x2c03ca,_0xad92ca){_0x2c03ca=_0x2c03ca-0x0;var _0xe670b=_0x157a[_0x2c03ca];return _0xe670b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa157('0x0'));var rp=require(_0xa157('0x1'));var moment=require(_0xa157('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa157('0x3'));var util=require(_0xa157('0x4'));var path=require(_0xa157('0x5'));var sox=require(_0xa157('0x6'));var csv=require(_0xa157('0x7'));var ejs=require(_0xa157('0x8'));var fs=require('fs');var fs_extra=require(_0xa157('0x9'));var _=require(_0xa157('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa157('0xb'));var deskjs=require(_0xa157('0xc'));var toCsv=require(_0xa157('0x7'));var querystring=require(_0xa157('0xd'));var Papa=require(_0xa157('0xe'));var Redis=require('ioredis');var authService=require(_0xa157('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa157('0x10'));var hardwareService=require(_0xa157('0x11'));var logger=require(_0xa157('0x12'))(_0xa157('0x13'));var utils=require('../../config/utils');var config=require(_0xa157('0x14'));var licenseUtil=require(_0xa157('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa157('0x16'));function respondWithStatusCode(_0x42baa0,_0x4e5d0a){_0x4e5d0a=_0x4e5d0a||0xcc;return function(_0x480e83){if(_0x480e83){return _0x42baa0['sendStatus'](_0x4e5d0a);}return _0x42baa0['status'](_0x4e5d0a)[_0xa157('0x17')]();};}function respondWithResult(_0x125534,_0x3991a9){_0x3991a9=_0x3991a9||0xc8;return function(_0x521218){if(_0x521218){return _0x125534[_0xa157('0x18')](_0x3991a9)['json'](_0x521218);}};}function respondWithFilteredResult(_0x2ed6b7,_0x479715){return function(_0x86f6b9){if(_0x86f6b9){var _0x2e88d6=typeof _0x479715[_0xa157('0x19')]==='undefined'&&typeof _0x479715[_0xa157('0x1a')]==='undefined';var _0x109f15=_0x86f6b9['count'];var _0x197d46=_0x2e88d6?0x0:_0x479715[_0xa157('0x19')];var _0x3b2f2f=_0x2e88d6?_0x86f6b9[_0xa157('0x1b')]:_0x479715[_0xa157('0x19')]+_0x479715[_0xa157('0x1a')];var _0x5a2a03;if(_0x3b2f2f>=_0x109f15){_0x3b2f2f=_0x109f15;_0x5a2a03=0xc8;}else{_0x5a2a03=0xce;}_0x2ed6b7[_0xa157('0x18')](_0x5a2a03);return _0x2ed6b7[_0xa157('0x1c')](_0xa157('0x1d'),_0x197d46+'-'+_0x3b2f2f+'/'+_0x109f15)[_0xa157('0x1e')](_0x86f6b9);}return null;};}function patchUpdates(_0x4857d2){return function(_0x35fc5e){try{jsonpatch[_0xa157('0x1f')](_0x35fc5e,_0x4857d2,!![]);}catch(_0x3bf559){return BPromise[_0xa157('0x20')](_0x3bf559);}return _0x35fc5e[_0xa157('0x21')]();};}function saveUpdates(_0x5f3ee2,_0x5c4dec){return function(_0x1b82d1){if(_0x1b82d1){return _0x1b82d1[_0xa157('0x22')](_0x5f3ee2)['then'](function(_0x1b591a){return _0x1b591a;});}return null;};}function removeEntity(_0x4c32d9,_0x1b49c3){return function(_0x540944){if(_0x540944){return _0x540944['destroy']()[_0xa157('0x23')](function(){_0x4c32d9[_0xa157('0x18')](0xcc)[_0xa157('0x17')]();});}};}function handleEntityNotFound(_0x251634,_0x5710e2){return function(_0x36f1d8){if(!_0x36f1d8){_0x251634[_0xa157('0x24')](0x194);}return _0x36f1d8;};}function handleError(_0x20a354,_0x4f24bb){_0x4f24bb=_0x4f24bb||0x1f4;return function(_0xa7af56){logger[_0xa157('0x25')](_0xa7af56[_0xa157('0x26')]);if(_0xa7af56[_0xa157('0x27')]){delete _0xa7af56[_0xa157('0x27')];}_0x20a354[_0xa157('0x18')](_0x4f24bb)['send'](_0xa7af56);};}exports[_0xa157('0x28')]=function(_0x3d80a8,_0x443f2e){var _0x218fca={},_0x27d48d={},_0xb07c89={'count':0x0,'rows':[]};var _0x2bc615=_[_0xa157('0x29')](db[_0xa157('0x2a')][_0xa157('0x2b')],function(_0x307045){return{'name':_0x307045[_0xa157('0x2c')],'type':_0x307045[_0xa157('0x2d')][_0xa157('0x2e')]};});_0x27d48d[_0xa157('0x2f')]=_['map'](_0x2bc615,_0xa157('0x27'));_0x27d48d[_0xa157('0x30')]=_[_0xa157('0x31')](_0x3d80a8[_0xa157('0x30')]);_0x27d48d[_0xa157('0x32')]=_['intersection'](_0x27d48d[_0xa157('0x2f')],_0x27d48d[_0xa157('0x30')]);_0x218fca[_0xa157('0x33')]=_[_0xa157('0x34')](_0x27d48d['model'],qs[_0xa157('0x35')](_0x3d80a8[_0xa157('0x30')]['fields']));_0x218fca[_0xa157('0x33')]=_0x218fca[_0xa157('0x33')][_0xa157('0x36')]?_0x218fca[_0xa157('0x33')]:_0x27d48d['model'];if(!_0x3d80a8[_0xa157('0x30')][_0xa157('0x37')](_0xa157('0x38'))){_0x218fca[_0xa157('0x1a')]=qs[_0xa157('0x1a')](_0x3d80a8[_0xa157('0x30')]['limit']);_0x218fca[_0xa157('0x19')]=qs[_0xa157('0x19')](_0x3d80a8[_0xa157('0x30')]['offset']);}_0x218fca[_0xa157('0x39')]=qs[_0xa157('0x3a')](_0x3d80a8[_0xa157('0x30')][_0xa157('0x3a')]);_0x218fca[_0xa157('0x3b')]=qs[_0xa157('0x32')](_['pick'](_0x3d80a8['query'],_0x27d48d['filters']),_0x2bc615);if(_0x3d80a8[_0xa157('0x30')]['filter']){_0x218fca['where']=_[_0xa157('0x3c')](_0x218fca[_0xa157('0x3b')],{'$or':_[_0xa157('0x29')](_0x2bc615,function(_0x3e2f63){if(_0x3e2f63[_0xa157('0x2d')]!==_0xa157('0x3d')){var _0x3ab046={};_0x3ab046[_0x3e2f63['name']]={'$like':'%'+_0x3d80a8[_0xa157('0x30')]['filter']+'%'};return _0x3ab046;}})});}_0x218fca=_[_0xa157('0x3c')]({},_0x218fca,_0x3d80a8[_0xa157('0x3e')]);var _0x66e165={'where':_0x218fca['where']};return db[_0xa157('0x2a')][_0xa157('0x1b')](_0x66e165)[_0xa157('0x23')](function(_0x28ca6a){_0xb07c89[_0xa157('0x1b')]=_0x28ca6a;if(_0x3d80a8[_0xa157('0x30')][_0xa157('0x3f')]){_0x218fca[_0xa157('0x40')]=[{'all':!![]}];}return db[_0xa157('0x2a')][_0xa157('0x41')](_0x218fca);})[_0xa157('0x23')](function(_0x5b7b19){_0xb07c89[_0xa157('0x42')]=_0x5b7b19;return _0xb07c89;})[_0xa157('0x23')](respondWithFilteredResult(_0x443f2e,_0x218fca))['catch'](handleError(_0x443f2e,null));};exports['show']=function(_0x3d4513,_0x2b59f5){var _0x89d199={'raw':![],'where':{'id':_0x3d4513['params']['id']}},_0x15fb02={};_0x15fb02[_0xa157('0x2f')]=_[_0xa157('0x31')](db[_0xa157('0x2a')]['rawAttributes']);_0x15fb02[_0xa157('0x30')]=_['keys'](_0x3d4513[_0xa157('0x30')]);_0x15fb02[_0xa157('0x32')]=_[_0xa157('0x34')](_0x15fb02[_0xa157('0x2f')],_0x15fb02[_0xa157('0x30')]);_0x89d199['attributes']=_['intersection'](_0x15fb02['model'],qs['fields'](_0x3d4513[_0xa157('0x30')][_0xa157('0x35')]));_0x89d199['attributes']=_0x89d199['attributes'][_0xa157('0x36')]?_0x89d199[_0xa157('0x33')]:_0x15fb02[_0xa157('0x2f')];if(_0x3d4513[_0xa157('0x30')]['includeAll']){_0x89d199['include']=[{'all':!![]}];}_0x89d199=_[_0xa157('0x3c')]({},_0x89d199,_0x3d4513[_0xa157('0x3e')]);return db[_0xa157('0x2a')][_0xa157('0x43')](_0x89d199)[_0xa157('0x23')](handleEntityNotFound(_0x2b59f5,null))[_0xa157('0x23')](respondWithResult(_0x2b59f5,null))['catch'](handleError(_0x2b59f5,null));};exports[_0xa157('0x44')]=function(_0x1e24d9,_0x197e01){return db['FreshsalesAccount'][_0xa157('0x44')](_0x1e24d9[_0xa157('0x45')],{})[_0xa157('0x23')](respondWithResult(_0x197e01,0xc9))['catch'](handleError(_0x197e01,null));};exports[_0xa157('0x22')]=function(_0x539fb2,_0x45da10){if(_0x539fb2['body']['id']){delete _0x539fb2[_0xa157('0x45')]['id'];}return db[_0xa157('0x2a')][_0xa157('0x43')]({'where':{'id':_0x539fb2[_0xa157('0x46')]['id']}})[_0xa157('0x23')](handleEntityNotFound(_0x45da10,null))['then'](saveUpdates(_0x539fb2['body'],null))[_0xa157('0x23')](respondWithResult(_0x45da10,null))[_0xa157('0x47')](handleError(_0x45da10,null));};exports[_0xa157('0x48')]=function(_0x5b482f,_0x17de0a){return db['FreshsalesAccount']['find']({'where':{'id':_0x5b482f[_0xa157('0x46')]['id']}})[_0xa157('0x23')](handleEntityNotFound(_0x17de0a,null))['then'](removeEntity(_0x17de0a,null))[_0xa157('0x47')](handleError(_0x17de0a,null));};exports['getConfigurations']=function(_0x291bc0,_0x1b0f57,_0x5a7d40){var _0x2851ad={};var _0x1a3f77={};var _0x2dad21;var _0x4b04cd;return db[_0xa157('0x2a')][_0xa157('0x49')]({'where':{'id':_0x291bc0[_0xa157('0x46')]['id']}})[_0xa157('0x23')](handleEntityNotFound(_0x1b0f57,null))[_0xa157('0x23')](function(_0x197b62){if(_0x197b62){_0x2dad21=_0x197b62;_0x1a3f77['model']=_['keys'](db[_0xa157('0x4a')]['rawAttributes']);_0x1a3f77[_0xa157('0x30')]=_['keys'](_0x291bc0['query']);_0x1a3f77[_0xa157('0x32')]=_[_0xa157('0x34')](_0x1a3f77[_0xa157('0x2f')],_0x1a3f77['query']);_0x2851ad[_0xa157('0x33')]=_['intersection'](_0x1a3f77[_0xa157('0x2f')],qs[_0xa157('0x35')](_0x291bc0[_0xa157('0x30')]['fields']));_0x2851ad[_0xa157('0x33')]=_0x2851ad['attributes']['length']?_0x2851ad['attributes']:_0x1a3f77['model'];_0x2851ad['order']=qs[_0xa157('0x3a')](_0x291bc0[_0xa157('0x30')][_0xa157('0x3a')]);_0x2851ad[_0xa157('0x3b')]=qs[_0xa157('0x32')](_[_0xa157('0x4b')](_0x291bc0[_0xa157('0x30')],_0x1a3f77['filters']));if(_0x291bc0['query'][_0xa157('0x4c')]){_0x2851ad[_0xa157('0x3b')]=_[_0xa157('0x3c')](_0x2851ad[_0xa157('0x3b')],{'$or':_[_0xa157('0x29')](_0x2851ad['attributes'],function(_0x905725){var _0x131f39={};_0x131f39[_0x905725]={'$like':'%'+_0x291bc0[_0xa157('0x30')][_0xa157('0x4c')]+'%'};return _0x131f39;})});}_0x2851ad=_[_0xa157('0x3c')]({},_0x2851ad,_0x291bc0['options']);return _0x2dad21[_0xa157('0x4d')](_0x2851ad);}})[_0xa157('0x23')](function(_0x537260){if(_0x537260){_0x4b04cd=_0x537260[_0xa157('0x36')];if(!_0x291bc0[_0xa157('0x30')][_0xa157('0x37')]('nolimit')){_0x2851ad[_0xa157('0x1a')]=qs[_0xa157('0x1a')](_0x291bc0[_0xa157('0x30')][_0xa157('0x1a')]);_0x2851ad['offset']=qs[_0xa157('0x19')](_0x291bc0[_0xa157('0x30')]['offset']);}return _0x2dad21['getConfigurations'](_0x2851ad);}})[_0xa157('0x23')](function(_0x456eeb){if(_0x456eeb){return _0x456eeb?{'count':_0x4b04cd,'rows':_0x456eeb}:null;}})[_0xa157('0x23')](respondWithResult(_0x1b0f57,null))[_0xa157('0x47')](handleError(_0x1b0f57,null));};exports['addConfiguration']=function(_0x3d0a10,_0x16ad88,_0x33a207){if(_0x3d0a10[_0xa157('0x45')]['id']){delete _0x3d0a10['body']['id'];}return db['FreshsalesAccount'][_0xa157('0x49')]({'where':{'id':_0x3d0a10['params']['id']}})['then'](handleEntityNotFound(_0x16ad88,null))[_0xa157('0x23')](function(_0x28a7a2){if(_0x28a7a2){_0x3d0a10[_0xa157('0x45')][_0xa157('0x4e')]=_0x28a7a2['id'];_0x3d0a10[_0xa157('0x45')][_0xa157('0x4f')]=integrations[_0xa157('0x50')](_0x3d0a10[_0xa157('0x45')][_0xa157('0x51')],_0x3d0a10[_0xa157('0x45')][_0xa157('0x2d')]);_0x3d0a10[_0xa157('0x45')]['Descriptions']=integrations[_0xa157('0x52')](_0x3d0a10['body'][_0xa157('0x51')],_0x3d0a10[_0xa157('0x45')][_0xa157('0x2d')]);return db[_0xa157('0x4a')][_0xa157('0x44')](_0x3d0a10[_0xa157('0x45')],{'include':[{'model':db[_0xa157('0x53')],'as':_0xa157('0x4f')},{'model':db['FreshsalesField'],'as':_0xa157('0x54')}]});}return null;})[_0xa157('0x23')](respondWithResult(_0x16ad88,null))[_0xa157('0x47')](handleError(_0x16ad88,null));};exports[_0xa157('0x55')]=function(_0x310542,_0x48b40b,_0x213ed7){var _0x1d566b='';var _0x2dae12='';return db[_0xa157('0x2a')][_0xa157('0x49')]({'where':{'id':_0x310542[_0xa157('0x46')]['id']},'attributes':['id',_0xa157('0x56'),'remoteUri',_0xa157('0x57')]})[_0xa157('0x23')](handleEntityNotFound(_0x48b40b,null))[_0xa157('0x23')](function(_0x34c5b8){if(_0x34c5b8){_0x2dae12=_0x34c5b8[_0xa157('0x56')];_0x1d566b=_0x34c5b8[_0xa157('0x58')];var _0x39bb3e=_0x34c5b8[_0xa157('0x58')]['slice'](-0x1);if(_0x39bb3e==='/'){_0x1d566b=_0x1d566b[_0xa157('0x59')](0x0,_0x1d566b[_0xa157('0x5a')](_0x39bb3e));}return rp({'method':_0xa157('0x5b'),'uri':util[_0xa157('0x5c')](_0xa157('0x5d'),_0x1d566b,_0xa157('0x5e')),'headers':{'Authorization':'Token\x20token='+_0x34c5b8[_0xa157('0x57')]},'json':!![]});}})['then'](function(_0x2e2be6){if(_0x2e2be6){var _0x48089a=_0x2e2be6[_0xa157('0x5f')];var _0x231657=![];var _0x446353=null;for(_0x446353=0x0;_0x446353<_0x48089a[_0xa157('0x36')];_0x446353++){if(_0x48089a[_0x446353][_0xa157('0x60')]===_0x2dae12){_0x231657=!![];}}if(_0x231657){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa157('0x61')});}}})[_0xa157('0x23')](respondWithResult(_0x48b40b,null))[_0xa157('0x47')](function(_0x46c535){var _0x597238=_0x310542[_0xa157('0x30')]['test']?0x1f4:_0x46c535[_0xa157('0x62')]||0x1f4;logger[_0xa157('0x25')](_0xa157('0x63'),'getFields',_0x597238,JSON[_0xa157('0x64')](_0x46c535));delete _0x46c535[_0xa157('0x27')];if(_0x597238===0x191){_0x597238=0x190;}_0x48b40b[_0xa157('0x18')](_0x597238)[_0xa157('0x65')](_0x310542[_0xa157('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x46c535[_0xa157('0x62')]}:_0x46c535);});}; \ No newline at end of file +var _0x918b=['options','include','rows','catch','show','params','find','create','body','getConfigurations','FreshsalesConfiguration','filter','length','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL'];(function(_0x6c71e8,_0xbb658a){var _0xacd198=function(_0x43b793){while(--_0x43b793){_0x6c71e8['push'](_0x6c71e8['shift']());}};_0xacd198(++_0xbb658a);}(_0x918b,0x15b));var _0xb918=function(_0xe397b4,_0x37f1c0){_0xe397b4=_0xe397b4-0x0;var _0x384f1e=_0x918b[_0xe397b4];return _0x384f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb918('0x0'));var zipdir=require(_0xb918('0x1'));var jsonpatch=require(_0xb918('0x2'));var rp=require('request-promise');var moment=require(_0xb918('0x3'));var BPromise=require(_0xb918('0x4'));var Mustache=require(_0xb918('0x5'));var util=require(_0xb918('0x6'));var path=require('path');var sox=require(_0xb918('0x7'));var csv=require(_0xb918('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb918('0x9'));var _=require(_0xb918('0xa'));var squel=require(_0xb918('0xb'));var crypto=require(_0xb918('0xc'));var jsforce=require(_0xb918('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb918('0xe'));var Papa=require(_0xb918('0xf'));var Redis=require(_0xb918('0x10'));var authService=require(_0xb918('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb918('0x12'));var hardwareService=require(_0xb918('0x13'));var logger=require(_0xb918('0x14'))(_0xb918('0x15'));var utils=require(_0xb918('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb918('0x17'));var db=require(_0xb918('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x45b4d5,_0x3f053b){_0x3f053b=_0x3f053b||0xcc;return function(_0x1d58d2){if(_0x1d58d2){return _0x45b4d5[_0xb918('0x19')](_0x3f053b);}return _0x45b4d5['status'](_0x3f053b)[_0xb918('0x1a')]();};}function respondWithResult(_0x2eb3af,_0xd1188){_0xd1188=_0xd1188||0xc8;return function(_0x15ed19){if(_0x15ed19){return _0x2eb3af['status'](_0xd1188)[_0xb918('0x1b')](_0x15ed19);}};}function respondWithFilteredResult(_0x26e4fc,_0x345b0c){return function(_0x3ac633){if(_0x3ac633){var _0x5781ba=typeof _0x345b0c['offset']===_0xb918('0x1c')&&typeof _0x345b0c[_0xb918('0x1d')]===_0xb918('0x1c');var _0x2395ae=_0x3ac633[_0xb918('0x1e')];var _0x567060=_0x5781ba?0x0:_0x345b0c[_0xb918('0x1f')];var _0x53a453=_0x5781ba?_0x3ac633['count']:_0x345b0c[_0xb918('0x1f')]+_0x345b0c[_0xb918('0x1d')];var _0x32f1bd;if(_0x53a453>=_0x2395ae){_0x53a453=_0x2395ae;_0x32f1bd=0xc8;}else{_0x32f1bd=0xce;}_0x26e4fc[_0xb918('0x20')](_0x32f1bd);return _0x26e4fc['set'](_0xb918('0x21'),_0x567060+'-'+_0x53a453+'/'+_0x2395ae)[_0xb918('0x1b')](_0x3ac633);}return null;};}function patchUpdates(_0x2fb8ac){return function(_0x3a1ff4){try{jsonpatch[_0xb918('0x22')](_0x3a1ff4,_0x2fb8ac,!![]);}catch(_0x1f644a){return BPromise[_0xb918('0x23')](_0x1f644a);}return _0x3a1ff4[_0xb918('0x24')]();};}function saveUpdates(_0x5612fe,_0x440b60){return function(_0x108609){if(_0x108609){return _0x108609[_0xb918('0x25')](_0x5612fe)[_0xb918('0x26')](function(_0x725158){return _0x725158;});}return null;};}function removeEntity(_0x26b48b,_0x5aca67){return function(_0x347d72){if(_0x347d72){return _0x347d72[_0xb918('0x27')]()[_0xb918('0x26')](function(){_0x26b48b[_0xb918('0x20')](0xcc)[_0xb918('0x1a')]();});}};}function handleEntityNotFound(_0x3bed09,_0x164a82){return function(_0x3f57ec){if(!_0x3f57ec){_0x3bed09[_0xb918('0x19')](0x194);}return _0x3f57ec;};}function handleError(_0x4ad566,_0xc0c6c5){_0xc0c6c5=_0xc0c6c5||0x1f4;return function(_0x218e16){logger[_0xb918('0x28')](_0x218e16[_0xb918('0x29')]);if(_0x218e16[_0xb918('0x2a')]){delete _0x218e16[_0xb918('0x2a')];}_0x4ad566['status'](_0xc0c6c5)[_0xb918('0x2b')](_0x218e16);};}exports[_0xb918('0x2c')]=function(_0x2b9db0,_0x417b4d){var _0x2345ef={},_0x14b1e8={},_0x3d8371={'count':0x0,'rows':[]};var _0x5be4a1=_[_0xb918('0x2d')](db[_0xb918('0x2e')][_0xb918('0x2f')],function(_0x1b4ce7){return{'name':_0x1b4ce7[_0xb918('0x30')],'type':_0x1b4ce7[_0xb918('0x31')][_0xb918('0x32')]};});_0x14b1e8['model']=_[_0xb918('0x2d')](_0x5be4a1,_0xb918('0x2a'));_0x14b1e8[_0xb918('0x33')]=_[_0xb918('0x34')](_0x2b9db0[_0xb918('0x33')]);_0x14b1e8['filters']=_[_0xb918('0x35')](_0x14b1e8[_0xb918('0x36')],_0x14b1e8[_0xb918('0x33')]);_0x2345ef['attributes']=_[_0xb918('0x35')](_0x14b1e8['model'],qs[_0xb918('0x37')](_0x2b9db0[_0xb918('0x33')][_0xb918('0x37')]));_0x2345ef[_0xb918('0x38')]=_0x2345ef[_0xb918('0x38')]['length']?_0x2345ef['attributes']:_0x14b1e8[_0xb918('0x36')];if(!_0x2b9db0[_0xb918('0x33')][_0xb918('0x39')](_0xb918('0x3a'))){_0x2345ef[_0xb918('0x1d')]=qs[_0xb918('0x1d')](_0x2b9db0[_0xb918('0x33')][_0xb918('0x1d')]);_0x2345ef[_0xb918('0x1f')]=qs['offset'](_0x2b9db0[_0xb918('0x33')][_0xb918('0x1f')]);}_0x2345ef['order']=qs['sort'](_0x2b9db0['query'][_0xb918('0x3b')]);_0x2345ef[_0xb918('0x3c')]=qs[_0xb918('0x3d')](_[_0xb918('0x3e')](_0x2b9db0[_0xb918('0x33')],_0x14b1e8[_0xb918('0x3d')]),_0x5be4a1);if(_0x2b9db0[_0xb918('0x33')]['filter']){_0x2345ef[_0xb918('0x3c')]=_[_0xb918('0x3f')](_0x2345ef[_0xb918('0x3c')],{'$or':_[_0xb918('0x2d')](_0x5be4a1,function(_0x367597){if(_0x367597[_0xb918('0x31')]!==_0xb918('0x40')){var _0x549347={};_0x549347[_0x367597['name']]={'$like':'%'+_0x2b9db0[_0xb918('0x33')]['filter']+'%'};return _0x549347;}})});}_0x2345ef=_['merge']({},_0x2345ef,_0x2b9db0[_0xb918('0x41')]);var _0xe1298b={'where':_0x2345ef[_0xb918('0x3c')]};return db[_0xb918('0x2e')]['count'](_0xe1298b)['then'](function(_0x4fc051){_0x3d8371[_0xb918('0x1e')]=_0x4fc051;if(_0x2b9db0['query']['includeAll']){_0x2345ef[_0xb918('0x42')]=[{'all':!![]}];}return db[_0xb918('0x2e')]['findAll'](_0x2345ef);})[_0xb918('0x26')](function(_0x46636b){_0x3d8371[_0xb918('0x43')]=_0x46636b;return _0x3d8371;})[_0xb918('0x26')](respondWithFilteredResult(_0x417b4d,_0x2345ef))[_0xb918('0x44')](handleError(_0x417b4d,null));};exports[_0xb918('0x45')]=function(_0x597cc1,_0x246ef5){var _0x17b3f8={'raw':![],'where':{'id':_0x597cc1[_0xb918('0x46')]['id']}},_0x4051b6={};_0x4051b6[_0xb918('0x36')]=_[_0xb918('0x34')](db['FreshsalesAccount'][_0xb918('0x2f')]);_0x4051b6[_0xb918('0x33')]=_[_0xb918('0x34')](_0x597cc1[_0xb918('0x33')]);_0x4051b6[_0xb918('0x3d')]=_[_0xb918('0x35')](_0x4051b6['model'],_0x4051b6[_0xb918('0x33')]);_0x17b3f8[_0xb918('0x38')]=_['intersection'](_0x4051b6[_0xb918('0x36')],qs[_0xb918('0x37')](_0x597cc1[_0xb918('0x33')][_0xb918('0x37')]));_0x17b3f8[_0xb918('0x38')]=_0x17b3f8[_0xb918('0x38')]['length']?_0x17b3f8[_0xb918('0x38')]:_0x4051b6[_0xb918('0x36')];if(_0x597cc1[_0xb918('0x33')]['includeAll']){_0x17b3f8[_0xb918('0x42')]=[{'all':!![]}];}_0x17b3f8=_[_0xb918('0x3f')]({},_0x17b3f8,_0x597cc1[_0xb918('0x41')]);return db[_0xb918('0x2e')][_0xb918('0x47')](_0x17b3f8)[_0xb918('0x26')](handleEntityNotFound(_0x246ef5,null))['then'](respondWithResult(_0x246ef5,null))[_0xb918('0x44')](handleError(_0x246ef5,null));};exports[_0xb918('0x48')]=function(_0x2f3cb5,_0x5c64e9){return db['FreshsalesAccount']['create'](_0x2f3cb5[_0xb918('0x49')],{})[_0xb918('0x26')](respondWithResult(_0x5c64e9,0xc9))[_0xb918('0x44')](handleError(_0x5c64e9,null));};exports[_0xb918('0x25')]=function(_0x2ba4a6,_0x5b7d5d){if(_0x2ba4a6[_0xb918('0x49')]['id']){delete _0x2ba4a6[_0xb918('0x49')]['id'];}return db['FreshsalesAccount'][_0xb918('0x47')]({'where':{'id':_0x2ba4a6['params']['id']}})[_0xb918('0x26')](handleEntityNotFound(_0x5b7d5d,null))[_0xb918('0x26')](saveUpdates(_0x2ba4a6[_0xb918('0x49')],null))[_0xb918('0x26')](respondWithResult(_0x5b7d5d,null))['catch'](handleError(_0x5b7d5d,null));};exports[_0xb918('0x27')]=function(_0x372fc6,_0x377302){return db[_0xb918('0x2e')][_0xb918('0x47')]({'where':{'id':_0x372fc6[_0xb918('0x46')]['id']}})[_0xb918('0x26')](handleEntityNotFound(_0x377302,null))[_0xb918('0x26')](removeEntity(_0x377302,null))['catch'](handleError(_0x377302,null));};exports[_0xb918('0x4a')]=function(_0x57830e,_0x50e478,_0x591f12){var _0x42e446={};var _0x4f9cb3={};var _0x40f780;var _0xf186c1;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x57830e[_0xb918('0x46')]['id']}})[_0xb918('0x26')](handleEntityNotFound(_0x50e478,null))['then'](function(_0xe2826e){if(_0xe2826e){_0x40f780=_0xe2826e;_0x4f9cb3[_0xb918('0x36')]=_[_0xb918('0x34')](db[_0xb918('0x4b')][_0xb918('0x2f')]);_0x4f9cb3[_0xb918('0x33')]=_[_0xb918('0x34')](_0x57830e[_0xb918('0x33')]);_0x4f9cb3[_0xb918('0x3d')]=_[_0xb918('0x35')](_0x4f9cb3[_0xb918('0x36')],_0x4f9cb3[_0xb918('0x33')]);_0x42e446[_0xb918('0x38')]=_['intersection'](_0x4f9cb3['model'],qs[_0xb918('0x37')](_0x57830e[_0xb918('0x33')][_0xb918('0x37')]));_0x42e446[_0xb918('0x38')]=_0x42e446[_0xb918('0x38')]['length']?_0x42e446[_0xb918('0x38')]:_0x4f9cb3['model'];_0x42e446['order']=qs[_0xb918('0x3b')](_0x57830e['query']['sort']);_0x42e446[_0xb918('0x3c')]=qs['filters'](_[_0xb918('0x3e')](_0x57830e[_0xb918('0x33')],_0x4f9cb3[_0xb918('0x3d')]));if(_0x57830e[_0xb918('0x33')]['filter']){_0x42e446[_0xb918('0x3c')]=_[_0xb918('0x3f')](_0x42e446[_0xb918('0x3c')],{'$or':_[_0xb918('0x2d')](_0x42e446[_0xb918('0x38')],function(_0x56eabc){var _0x31d3bb={};_0x31d3bb[_0x56eabc]={'$like':'%'+_0x57830e[_0xb918('0x33')][_0xb918('0x4c')]+'%'};return _0x31d3bb;})});}_0x42e446=_[_0xb918('0x3f')]({},_0x42e446,_0x57830e[_0xb918('0x41')]);return _0x40f780[_0xb918('0x4a')](_0x42e446);}})[_0xb918('0x26')](function(_0x38afa5){if(_0x38afa5){_0xf186c1=_0x38afa5[_0xb918('0x4d')];if(!_0x57830e['query'][_0xb918('0x39')](_0xb918('0x3a'))){_0x42e446[_0xb918('0x1d')]=qs['limit'](_0x57830e[_0xb918('0x33')][_0xb918('0x1d')]);_0x42e446[_0xb918('0x1f')]=qs[_0xb918('0x1f')](_0x57830e[_0xb918('0x33')][_0xb918('0x1f')]);}return _0x40f780['getConfigurations'](_0x42e446);}})[_0xb918('0x26')](function(_0x4d2e2c){if(_0x4d2e2c){return _0x4d2e2c?{'count':_0xf186c1,'rows':_0x4d2e2c}:null;}})['then'](respondWithResult(_0x50e478,null))[_0xb918('0x44')](handleError(_0x50e478,null));};exports[_0xb918('0x4e')]=function(_0x249d27,_0x2fd9d9,_0x5957c8){if(_0x249d27[_0xb918('0x49')]['id']){delete _0x249d27[_0xb918('0x49')]['id'];}return db[_0xb918('0x2e')][_0xb918('0x4f')]({'where':{'id':_0x249d27[_0xb918('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fd9d9,null))[_0xb918('0x26')](function(_0x1765a9){if(_0x1765a9){_0x249d27[_0xb918('0x49')][_0xb918('0x50')]=_0x1765a9['id'];_0x249d27['body'][_0xb918('0x51')]=integrations['getSubjects'](_0x249d27[_0xb918('0x49')][_0xb918('0x52')],_0x249d27[_0xb918('0x49')]['type']);_0x249d27[_0xb918('0x49')][_0xb918('0x53')]=integrations[_0xb918('0x54')](_0x249d27[_0xb918('0x49')][_0xb918('0x52')],_0x249d27[_0xb918('0x49')][_0xb918('0x31')]);return db['FreshsalesConfiguration'][_0xb918('0x48')](_0x249d27['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xb918('0x51')},{'model':db[_0xb918('0x55')],'as':_0xb918('0x53')}]});}return null;})[_0xb918('0x26')](respondWithResult(_0x2fd9d9,null))[_0xb918('0x44')](handleError(_0x2fd9d9,null));};exports[_0xb918('0x56')]=function(_0x2aa04f,_0x5371ae,_0x432d1a){var _0xef4647='';var _0x1e530d='';return db[_0xb918('0x2e')][_0xb918('0x4f')]({'where':{'id':_0x2aa04f[_0xb918('0x46')]['id']},'attributes':['id',_0xb918('0x57'),_0xb918('0x58'),'apiKey']})[_0xb918('0x26')](handleEntityNotFound(_0x5371ae,null))[_0xb918('0x26')](function(_0x558756){if(_0x558756){_0x1e530d=_0x558756[_0xb918('0x57')];_0xef4647=_0x558756['remoteUri'];var _0x4d324f=_0x558756[_0xb918('0x58')][_0xb918('0x59')](-0x1);if(_0x4d324f==='/'){_0xef4647=_0xef4647[_0xb918('0x5a')](0x0,_0xef4647[_0xb918('0x5b')](_0x4d324f));}return rp({'method':_0xb918('0x5c'),'uri':util['format'](_0xb918('0x5d'),_0xef4647,_0xb918('0x5e')),'headers':{'Authorization':_0xb918('0x5f')+_0x558756['apiKey']},'json':!![]});}})[_0xb918('0x26')](function(_0x12094b){if(_0x12094b){var _0x273714=_0x12094b[_0xb918('0x60')];var _0x56cca9=![];var _0xe018d5=null;for(_0xe018d5=0x0;_0xe018d5<_0x273714[_0xb918('0x4d')];_0xe018d5++){if(_0x273714[_0xe018d5]['email']===_0x1e530d){_0x56cca9=!![];}}if(_0x56cca9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb918('0x61')});}}})[_0xb918('0x26')](respondWithResult(_0x5371ae,null))[_0xb918('0x44')](function(_0xd75801){var _0x2ff6c9=_0x2aa04f[_0xb918('0x33')]['test']?0x1f4:_0xd75801[_0xb918('0x62')]||0x1f4;logger['error'](_0xb918('0x63'),_0xb918('0x56'),_0x2ff6c9,JSON[_0xb918('0x64')](_0xd75801));delete _0xd75801['name'];if(_0x2ff6c9===0x191){_0x2ff6c9=0x190;}_0x5371ae[_0xb918('0x20')](_0x2ff6c9)[_0xb918('0x2b')](_0x2aa04f[_0xb918('0x33')][_0xb918('0x65')]?{'message':_0xb918('0x66'),'statusCode':_0xd75801['statusCode']}:_0xd75801);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ce80eae..361d997 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 _0xcaf2=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0xcaf2,0x8a));var _0x2caf=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xcaf2[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));var integrations=require(_0x2caf('0x7'));module[_0x2caf('0x8')]=function(_0x599ce7,_0xc44e4e){return _0x599ce7[_0x2caf('0x9')](_0x2caf('0xa'),attributes,{'tableName':_0x2caf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x2c7b45,_0x8ca24a){var _0x5140eb=function(_0x475b0e){while(--_0x475b0e){_0x2c7b45['push'](_0x2c7b45['shift']());}};_0x5140eb(++_0x8ca24a);}(_0x82c4,0x1ca));var _0x482c=function(_0x11fc2c,_0x8dfa82){_0x11fc2c=_0x11fc2c-0x0;var _0x3df667=_0x82c4[_0x11fc2c];return _0x3df667;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x482c('0x9')]=function(_0x5d7c76,_0xfdb92){return _0x5d7c76[_0x482c('0xa')](_0x482c('0xb'),attributes,{'tableName':_0x482c('0xc'),'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 2c0e4fb..a6d2668 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 _0xfb11=['catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','debug','ShowFreshsalesAccount','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x529aff,_0x37e353){var _0x17acfe=function(_0x4d6558){while(--_0x4d6558){_0x529aff['push'](_0x529aff['shift']());}};_0x17acfe(++_0x37e353);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xfb11[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});}exports[_0x1fb1('0x14')]=function(_0x24d4df){var _0x34076b=this;return new Promise(function(_0x33c6b6,_0x27d71f){return db[_0x1fb1('0x15')][_0x1fb1('0x16')]({'raw':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options'][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x24d4df['options']?_0x24d4df['options'][_0x1fb1('0x19')]||null:null,'attributes':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df[_0x1fb1('0x17')]['attributes']||null:null,'limit':_0x24d4df[_0x1fb1('0x17')]?_0x24d4df['options']['limit']||null:null,'include':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x24d4df[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x53b8af){return{'model':db[_0x53b8af[_0x1fb1('0x1c')]],'as':_0x53b8af['as'],'attributes':_0x53b8af[_0x1fb1('0x1d')],'include':_0x53b8af[_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x53b8af[_0x1fb1('0x1a')],function(_0x1353a4){return{'model':db[_0x1353a4[_0x1fb1('0x1c')]],'as':_0x1353a4['as'],'attributes':_0x1353a4[_0x1fb1('0x1d')],'include':_0x1353a4['include']?_[_0x1fb1('0x1b')](_0x1353a4[_0x1fb1('0x1a')],function(_0x46ff60){return{'model':db[_0x46ff60[_0x1fb1('0x1c')]],'as':_0x46ff60['as'],'attributes':_0x46ff60[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x1a74c4){logger[_0x1fb1('0xb')](_0x1fb1('0x14'),_0x24d4df);logger[_0x1fb1('0x1e')](_0x1fb1('0x14'),_0x24d4df,JSON[_0x1fb1('0xf')](_0x1a74c4));_0x33c6b6(_0x1a74c4);})[_0x1fb1('0x13')](function(_0xe8ec0a){logger[_0x1fb1('0x10')]('GetFreshsalesAccount',_0xe8ec0a[_0x1fb1('0x12')],_0x24d4df);_0x27d71f(_0x34076b[_0x1fb1('0x10')](0x1f4,_0xe8ec0a[_0x1fb1('0x12')]));});});};exports[_0x1fb1('0x1f')]=function(_0x5402e9){var _0x245f84=this;return new Promise(function(_0x30c8eb,_0x5d45a5){return db[_0x1fb1('0x15')]['find']({'raw':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x19')]||null:null,'attributes':_0x5402e9[_0x1fb1('0x17')]?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1d')]||null:null,'include':_0x5402e9['options']?_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')]?_[_0x1fb1('0x1b')](_0x5402e9[_0x1fb1('0x17')][_0x1fb1('0x1a')],function(_0x307700){return{'model':db[_0x307700[_0x1fb1('0x1c')]],'as':_0x307700['as'],'attributes':_0x307700[_0x1fb1('0x1d')],'include':_0x307700[_0x1fb1('0x1a')]?_['map'](_0x307700[_0x1fb1('0x1a')],function(_0x4b4271){return{'model':db[_0x4b4271[_0x1fb1('0x1c')]],'as':_0x4b4271['as'],'attributes':_0x4b4271['attributes'],'include':_0x4b4271[_0x1fb1('0x1a')]?_['map'](_0x4b4271['include'],function(_0x25ac36){return{'model':db[_0x25ac36[_0x1fb1('0x1c')]],'as':_0x25ac36['as'],'attributes':_0x25ac36[_0x1fb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xa')](function(_0x564ed9){logger[_0x1fb1('0xb')](_0x1fb1('0x1f'),_0x5402e9);logger[_0x1fb1('0x1e')]('ShowFreshsalesAccount',_0x5402e9,JSON[_0x1fb1('0xf')](_0x564ed9));_0x30c8eb(_0x564ed9);})[_0x1fb1('0x13')](function(_0x228235){logger[_0x1fb1('0x10')](_0x1fb1('0x1f'),_0x228235[_0x1fb1('0x12')],_0x5402e9);_0x5d45a5(_0x245f84[_0x1fb1('0x10')](0x1f4,_0x228235['message']));});});}; \ No newline at end of file +var _0xb145=['stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetFreshsalesAccount','where','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb145,0xa3));var _0x5b14=function(_0x151913,_0x474bb2){_0x151913=_0x151913-0x0;var _0x5dac9f=_0xb145[_0x151913];return _0x5dac9f;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['GetFreshsalesAccount']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')]({'raw':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d395['options']?_0x48d395['options']['where']||null:null,'attributes':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'limit':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1c')]||null:null,'include':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x48d395['options'][_0x5b14('0x1d')],function(_0x54073f){return{'model':db[_0x54073f['model']],'as':_0x54073f['as'],'attributes':_0x54073f['attributes'],'include':_0x54073f['include']?_[_0x5b14('0x1e')](_0x54073f[_0x5b14('0x1d')],function(_0x153a25){return{'model':db[_0x153a25['model']],'as':_0x153a25['as'],'attributes':_0x153a25[_0x5b14('0x1b')],'include':_0x153a25[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x153a25[_0x5b14('0x1d')],function(_0xe6851b){return{'model':db[_0xe6851b[_0x5b14('0x1f')]],'as':_0xe6851b['as'],'attributes':_0xe6851b[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5b14('0x20')](function(_0x296d65){logger[_0x5b14('0xd')](_0x5b14('0x21'),_0x48d395);logger[_0x5b14('0xf')](_0x5b14('0x21'),_0x48d395,JSON[_0x5b14('0x11')](_0x296d65));_0x3f397d(_0x296d65);})['catch'](function(_0x370fcd){logger[_0x5b14('0x12')]('GetFreshsalesAccount',_0x370fcd['message'],_0x48d395);_0x3035b5(_0x58bf3c[_0x5b14('0x12')](0x1f4,_0x370fcd[_0x5b14('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4c1f0e){var _0x21b43b=this;return new Promise(function(_0x4d3905,_0x38c665){return db[_0x5b14('0x17')]['find']({'raw':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e['options'][_0x5b14('0x22')]||null:null,'attributes':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'include':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e[_0x5b14('0x19')]['include']?_[_0x5b14('0x1e')](_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1d')],function(_0x37f62c){return{'model':db[_0x37f62c['model']],'as':_0x37f62c['as'],'attributes':_0x37f62c[_0x5b14('0x1b')],'include':_0x37f62c[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x37f62c['include'],function(_0x2fe74d){return{'model':db[_0x2fe74d['model']],'as':_0x2fe74d['as'],'attributes':_0x2fe74d[_0x5b14('0x1b')],'include':_0x2fe74d[_0x5b14('0x1d')]?_['map'](_0x2fe74d[_0x5b14('0x1d')],function(_0x2a83d4){return{'model':db[_0x2a83d4['model']],'as':_0x2a83d4['as'],'attributes':_0x2a83d4[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce6bb){logger[_0x5b14('0xd')](_0x5b14('0x23'),_0x4c1f0e);logger[_0x5b14('0xf')]('ShowFreshsalesAccount',_0x4c1f0e,JSON[_0x5b14('0x11')](_0x1ce6bb));_0x4d3905(_0x1ce6bb);})[_0x5b14('0x16')](function(_0x15d4c4){logger[_0x5b14('0x12')](_0x5b14('0x23'),_0x15d4c4[_0x5b14('0x14')],_0x4c1f0e);_0x38c665(_0x21b43b[_0x5b14('0x12')](0x1f4,_0x15d4c4[_0x5b14('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9f7f9ec..0eab820 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 _0xe4aa=['get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','update','delete','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x376b37,_0x3d30a2){var _0x4f2c63=function(_0x51f55a){while(--_0x51f55a){_0x376b37['push'](_0x376b37['shift']());}};_0x4f2c63(++_0x3d30a2);}(_0xe4aa,0xe0));var _0xae4a=function(_0xb3ef47,_0xb6762b){_0xb3ef47=_0xb3ef47-0x0;var _0x113288=_0xe4aa[_0xb3ef47];return _0x113288;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xae4a('0x0'));var express=require(_0xae4a('0x1'));var router=express['Router']();var fs_extra=require(_0xae4a('0x2'));var auth=require(_0xae4a('0x3'));var interaction=require(_0xae4a('0x4'));var config=require(_0xae4a('0x5'));var controller=require(_0xae4a('0x6'));router[_0xae4a('0x7')]('/',auth[_0xae4a('0x8')](),controller[_0xae4a('0x9')]);router[_0xae4a('0x7')](_0xae4a('0xa'),auth[_0xae4a('0x8')](),controller[_0xae4a('0xb')]);router[_0xae4a('0x7')](_0xae4a('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xae4a('0x7')](_0xae4a('0xd'),auth[_0xae4a('0x8')](),controller[_0xae4a('0xe')]);router[_0xae4a('0x7')](_0xae4a('0xf'),auth[_0xae4a('0x8')](),controller['getFields']);router['post']('/',auth[_0xae4a('0x8')](),controller[_0xae4a('0x10')]);router[_0xae4a('0x11')](_0xae4a('0xa'),auth[_0xae4a('0x8')](),controller[_0xae4a('0x12')]);router[_0xae4a('0x13')](_0xae4a('0xa'),auth[_0xae4a('0x8')](),controller[_0xae4a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x983a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','delete','destroy','exports','multer','util'];(function(_0x41bac0,_0x23f30d){var _0x179176=function(_0x2fc101){while(--_0x2fc101){_0x41bac0['push'](_0x41bac0['shift']());}};_0x179176(++_0x23f30d);}(_0x983a,0x178));var _0xa983=function(_0x296f4e,_0x516f72){_0x296f4e=_0x296f4e-0x0;var _0x412c70=_0x983a[_0x296f4e];return _0x412c70;};'use strict';var multer=require(_0xa983('0x0'));var util=require(_0xa983('0x1'));var path=require(_0xa983('0x2'));var timeout=require(_0xa983('0x3'));var express=require(_0xa983('0x4'));var router=express[_0xa983('0x5')]();var fs_extra=require(_0xa983('0x6'));var auth=require(_0xa983('0x7'));var interaction=require(_0xa983('0x8'));var config=require(_0xa983('0x9'));var controller=require(_0xa983('0xa'));router[_0xa983('0xb')]('/',auth[_0xa983('0xc')](),controller[_0xa983('0xd')]);router['get'](_0xa983('0xe'),auth[_0xa983('0xc')](),controller[_0xa983('0xf')]);router[_0xa983('0xb')](_0xa983('0x10'),auth['isAuthenticated'](),controller[_0xa983('0x11')]);router[_0xa983('0xb')](_0xa983('0x12'),auth[_0xa983('0xc')](),controller[_0xa983('0x13')]);router[_0xa983('0xb')](_0xa983('0x14'),auth[_0xa983('0xc')](),controller[_0xa983('0x15')]);router[_0xa983('0x16')]('/',auth[_0xa983('0xc')](),controller['create']);router['put'](_0xa983('0xe'),auth[_0xa983('0xc')](),controller[_0xa983('0x17')]);router[_0xa983('0x18')](_0xa983('0xe'),auth[_0xa983('0xc')](),controller[_0xa983('0x19')]);module[_0xa983('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7e0d6c9..1adce2b 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 _0x2407=['exports','STRING','sequelize'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x2407,0x7d));var _0x7240=function(_0xea46d,_0x254082){_0xea46d=_0xea46d-0x0;var _0x1fa4c5=_0x2407[_0xea46d];return _0x1fa4c5;};'use strict';var Sequelize=require(_0x7240('0x0'));module[_0x7240('0x1')]={'name':{'type':Sequelize[_0x7240('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa0d8=['exports','STRING','sequelize'];(function(_0x5ae2c,_0x216476){var _0x3962fd=function(_0x4941e7){while(--_0x4941e7){_0x5ae2c['push'](_0x5ae2c['shift']());}};_0x3962fd(++_0x216476);}(_0xa0d8,0x1be));var _0x8a0d=function(_0x1eaf3a,_0x394cf3){_0x1eaf3a=_0x1eaf3a-0x0;var _0x199d2f=_0xa0d8[_0x1eaf3a];return _0x199d2f;};'use strict';var Sequelize=require(_0x8a0d('0x0'));module[_0x8a0d('0x1')]={'name':{'type':Sequelize[_0x8a0d('0x2')]},'description':{'type':Sequelize[_0x8a0d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3910077..ad65d73 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 _0x1f62=['getSubjects','hasOwnProperty','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','update','then','end','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','findOne','FreshsalesField','map','options'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x1f62,0x13c));var _0x21f6=function(_0x5468bf,_0x48c1ad){_0x5468bf=_0x5468bf-0x0;var _0x3c6c01=_0x1f62[_0x5468bf];return _0x3c6c01;};'use strict';var emlformat=require(_0x21f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21f6('0x1'));var jsonpatch=require(_0x21f6('0x2'));var rp=require(_0x21f6('0x3'));var moment=require('moment');var BPromise=require(_0x21f6('0x4'));var Mustache=require(_0x21f6('0x5'));var util=require('util');var path=require(_0x21f6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x21f6('0x7'));var fs=require('fs');var fs_extra=require(_0x21f6('0x8'));var _=require(_0x21f6('0x9'));var squel=require('squel');var crypto=require(_0x21f6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x21f6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x21f6('0xc'));var Papa=require(_0x21f6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21f6('0xe'));var hardwareService=require(_0x21f6('0xf'));var logger=require(_0x21f6('0x10'))('api');var utils=require(_0x21f6('0x11'));var config=require(_0x21f6('0x12'));var licenseUtil=require(_0x21f6('0x13'));var db=require(_0x21f6('0x14'))['db'];function respondWithStatusCode(_0x25435c,_0x4df575){_0x4df575=_0x4df575||0xcc;return function(_0x478f09){if(_0x478f09){return _0x25435c[_0x21f6('0x15')](_0x4df575);}return _0x25435c[_0x21f6('0x16')](_0x4df575)['end']();};}function respondWithResult(_0x496adf,_0x3eacb7){_0x3eacb7=_0x3eacb7||0xc8;return function(_0x8bcdbd){if(_0x8bcdbd){return _0x496adf[_0x21f6('0x16')](_0x3eacb7)['json'](_0x8bcdbd);}};}function respondWithFilteredResult(_0x34055a,_0x3826fc){return function(_0x19eb95){if(_0x19eb95){var _0x546e50=typeof _0x3826fc[_0x21f6('0x17')]===_0x21f6('0x18')&&typeof _0x3826fc[_0x21f6('0x19')]===_0x21f6('0x18');var _0x31eb90=_0x19eb95[_0x21f6('0x1a')];var _0x41465f=_0x546e50?0x0:_0x3826fc[_0x21f6('0x17')];var _0x530cdd=_0x546e50?_0x19eb95['count']:_0x3826fc[_0x21f6('0x17')]+_0x3826fc[_0x21f6('0x19')];var _0x1f4edc;if(_0x530cdd>=_0x31eb90){_0x530cdd=_0x31eb90;_0x1f4edc=0xc8;}else{_0x1f4edc=0xce;}_0x34055a[_0x21f6('0x16')](_0x1f4edc);return _0x34055a['set'](_0x21f6('0x1b'),_0x41465f+'-'+_0x530cdd+'/'+_0x31eb90)[_0x21f6('0x1c')](_0x19eb95);}return null;};}function patchUpdates(_0x1758bc){return function(_0x24cbda){try{jsonpatch[_0x21f6('0x1d')](_0x24cbda,_0x1758bc,!![]);}catch(_0x2cc046){return BPromise['reject'](_0x2cc046);}return _0x24cbda['save']();};}function saveUpdates(_0x5d01aa,_0x31afbf){return function(_0x216139){if(_0x216139){return _0x216139[_0x21f6('0x1e')](_0x5d01aa)[_0x21f6('0x1f')](function(_0x3b4391){return _0x3b4391;});}return null;};}function removeEntity(_0x10bc0e,_0x467ba7){return function(_0xb64cf6){if(_0xb64cf6){return _0xb64cf6['destroy']()[_0x21f6('0x1f')](function(){_0x10bc0e[_0x21f6('0x16')](0xcc)[_0x21f6('0x20')]();});}};}function handleEntityNotFound(_0x4c223f,_0x36ac36){return function(_0x58921b){if(!_0x58921b){_0x4c223f[_0x21f6('0x15')](0x194);}return _0x58921b;};}function handleError(_0x3bec10,_0x1c1944){_0x1c1944=_0x1c1944||0x1f4;return function(_0x36a1a5){logger[_0x21f6('0x21')](_0x36a1a5[_0x21f6('0x22')]);if(_0x36a1a5[_0x21f6('0x23')]){delete _0x36a1a5['name'];}_0x3bec10['status'](_0x1c1944)[_0x21f6('0x24')](_0x36a1a5);};}exports[_0x21f6('0x25')]=function(_0x404ad9,_0x38db1b){var _0x351300={},_0x24085a={},_0x1495d9={'count':0x0,'rows':[]};var _0x225d18=_['map'](db[_0x21f6('0x26')][_0x21f6('0x27')],function(_0x17f542){return{'name':_0x17f542[_0x21f6('0x28')],'type':_0x17f542[_0x21f6('0x29')][_0x21f6('0x2a')]};});_0x24085a[_0x21f6('0x2b')]=_['map'](_0x225d18,_0x21f6('0x23'));_0x24085a[_0x21f6('0x2c')]=_['keys'](_0x404ad9[_0x21f6('0x2c')]);_0x24085a[_0x21f6('0x2d')]=_[_0x21f6('0x2e')](_0x24085a['model'],_0x24085a[_0x21f6('0x2c')]);_0x351300['attributes']=_[_0x21f6('0x2e')](_0x24085a[_0x21f6('0x2b')],qs['fields'](_0x404ad9[_0x21f6('0x2c')][_0x21f6('0x2f')]));_0x351300[_0x21f6('0x30')]=_0x351300['attributes']['length']?_0x351300['attributes']:_0x24085a[_0x21f6('0x2b')];if(!_0x404ad9[_0x21f6('0x2c')]['hasOwnProperty'](_0x21f6('0x31'))){_0x351300['limit']=qs[_0x21f6('0x19')](_0x404ad9[_0x21f6('0x2c')][_0x21f6('0x19')]);_0x351300[_0x21f6('0x17')]=qs[_0x21f6('0x17')](_0x404ad9[_0x21f6('0x2c')]['offset']);}_0x351300[_0x21f6('0x32')]=qs[_0x21f6('0x33')](_0x404ad9['query'][_0x21f6('0x33')]);_0x351300['where']=qs['filters'](_[_0x21f6('0x34')](_0x404ad9[_0x21f6('0x2c')],_0x24085a[_0x21f6('0x2d')]),_0x225d18);if(_0x404ad9['query']['filter']){_0x351300[_0x21f6('0x35')]=_[_0x21f6('0x36')](_0x351300[_0x21f6('0x35')],{'$or':_['map'](_0x225d18,function(_0x2e3eed){if(_0x2e3eed[_0x21f6('0x29')]!==_0x21f6('0x37')){var _0x1295f9={};_0x1295f9[_0x2e3eed['name']]={'$like':'%'+_0x404ad9[_0x21f6('0x2c')][_0x21f6('0x38')]+'%'};return _0x1295f9;}})});}_0x351300=_[_0x21f6('0x36')]({},_0x351300,_0x404ad9['options']);var _0x1f5c9b={'where':_0x351300[_0x21f6('0x35')]};return db[_0x21f6('0x26')][_0x21f6('0x1a')](_0x1f5c9b)[_0x21f6('0x1f')](function(_0x2e68d3){_0x1495d9[_0x21f6('0x1a')]=_0x2e68d3;if(_0x404ad9['query'][_0x21f6('0x39')]){_0x351300[_0x21f6('0x3a')]=[{'all':!![]}];}return db[_0x21f6('0x26')][_0x21f6('0x3b')](_0x351300);})[_0x21f6('0x1f')](function(_0x429687){_0x1495d9[_0x21f6('0x3c')]=_0x429687;return _0x1495d9;})[_0x21f6('0x1f')](respondWithFilteredResult(_0x38db1b,_0x351300))[_0x21f6('0x3d')](handleError(_0x38db1b,null));};exports[_0x21f6('0x3e')]=function(_0x1dc1be,_0x535b1f){var _0x2357ab={'raw':![],'where':{'id':_0x1dc1be[_0x21f6('0x3f')]['id']}},_0x49aa77={};_0x49aa77[_0x21f6('0x2b')]=_[_0x21f6('0x40')](db[_0x21f6('0x26')][_0x21f6('0x27')]);_0x49aa77[_0x21f6('0x2c')]=_[_0x21f6('0x40')](_0x1dc1be[_0x21f6('0x2c')]);_0x49aa77[_0x21f6('0x2d')]=_['intersection'](_0x49aa77[_0x21f6('0x2b')],_0x49aa77[_0x21f6('0x2c')]);_0x2357ab[_0x21f6('0x30')]=_[_0x21f6('0x2e')](_0x49aa77['model'],qs[_0x21f6('0x2f')](_0x1dc1be[_0x21f6('0x2c')]['fields']));_0x2357ab['attributes']=_0x2357ab[_0x21f6('0x30')][_0x21f6('0x41')]?_0x2357ab[_0x21f6('0x30')]:_0x49aa77[_0x21f6('0x2b')];if(_0x1dc1be['query'][_0x21f6('0x39')]){_0x2357ab[_0x21f6('0x3a')]=[{'all':!![]}];}_0x2357ab=_[_0x21f6('0x36')]({},_0x2357ab,_0x1dc1be['options']);return db['FreshsalesConfiguration'][_0x21f6('0x42')](_0x2357ab)[_0x21f6('0x1f')](handleEntityNotFound(_0x535b1f,null))[_0x21f6('0x1f')](respondWithResult(_0x535b1f,null))['catch'](handleError(_0x535b1f,null));};exports[_0x21f6('0x43')]=function(_0x48aa07,_0x169b45){return db[_0x21f6('0x26')][_0x21f6('0x43')](_0x48aa07[_0x21f6('0x44')],{})[_0x21f6('0x1f')](respondWithResult(_0x169b45,0xc9))['catch'](handleError(_0x169b45,null));};exports[_0x21f6('0x1e')]=function(_0x1ee603,_0x2aa642){if(_0x1ee603['body']['id']){delete _0x1ee603[_0x21f6('0x44')]['id'];}return db['FreshsalesConfiguration'][_0x21f6('0x42')]({'where':{'id':_0x1ee603['params']['id']}})[_0x21f6('0x1f')](handleEntityNotFound(_0x2aa642,null))[_0x21f6('0x1f')](saveUpdates(_0x1ee603[_0x21f6('0x44')],null))['then'](respondWithResult(_0x2aa642,null))[_0x21f6('0x3d')](handleError(_0x2aa642,null));};exports[_0x21f6('0x45')]=function(_0xe5f785,_0x2b7e08){return db[_0x21f6('0x26')]['find']({'where':{'id':_0xe5f785[_0x21f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2b7e08,null))[_0x21f6('0x1f')](removeEntity(_0x2b7e08,null))[_0x21f6('0x3d')](handleError(_0x2b7e08,null));};exports['getSubjects']=function(_0x36ccd7,_0x24210b,_0x68a460){var _0x334b15={};var _0x5e4160={};var _0x1a960c;var _0x102563;return db[_0x21f6('0x26')][_0x21f6('0x46')]({'where':{'id':_0x36ccd7[_0x21f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24210b,null))['then'](function(_0x3fc771){if(_0x3fc771){_0x1a960c=_0x3fc771;_0x5e4160[_0x21f6('0x2b')]=_['keys'](db[_0x21f6('0x47')][_0x21f6('0x27')]);_0x5e4160['query']=_[_0x21f6('0x40')](_0x36ccd7['query']);_0x5e4160[_0x21f6('0x2d')]=_[_0x21f6('0x2e')](_0x5e4160[_0x21f6('0x2b')],_0x5e4160[_0x21f6('0x2c')]);_0x334b15[_0x21f6('0x30')]=_[_0x21f6('0x2e')](_0x5e4160[_0x21f6('0x2b')],qs[_0x21f6('0x2f')](_0x36ccd7['query'][_0x21f6('0x2f')]));_0x334b15[_0x21f6('0x30')]=_0x334b15[_0x21f6('0x30')][_0x21f6('0x41')]?_0x334b15[_0x21f6('0x30')]:_0x5e4160[_0x21f6('0x2b')];_0x334b15[_0x21f6('0x32')]=qs[_0x21f6('0x33')](_0x36ccd7['query']['sort']);_0x334b15[_0x21f6('0x35')]=qs[_0x21f6('0x2d')](_[_0x21f6('0x34')](_0x36ccd7[_0x21f6('0x2c')],_0x5e4160[_0x21f6('0x2d')]));if(_0x36ccd7[_0x21f6('0x2c')][_0x21f6('0x38')]){_0x334b15[_0x21f6('0x35')]=_[_0x21f6('0x36')](_0x334b15[_0x21f6('0x35')],{'$or':_[_0x21f6('0x48')](_0x334b15[_0x21f6('0x30')],function(_0x335549){var _0x5af412={};_0x5af412[_0x335549]={'$like':'%'+_0x36ccd7[_0x21f6('0x2c')][_0x21f6('0x38')]+'%'};return _0x5af412;})});}_0x334b15=_[_0x21f6('0x36')]({},_0x334b15,_0x36ccd7[_0x21f6('0x49')]);return _0x1a960c[_0x21f6('0x4a')](_0x334b15);}})[_0x21f6('0x1f')](function(_0x1f9a12){if(_0x1f9a12){_0x102563=_0x1f9a12[_0x21f6('0x41')];if(!_0x36ccd7[_0x21f6('0x2c')][_0x21f6('0x4b')]('nolimit')){_0x334b15['limit']=qs[_0x21f6('0x19')](_0x36ccd7[_0x21f6('0x2c')][_0x21f6('0x19')]);_0x334b15[_0x21f6('0x17')]=qs['offset'](_0x36ccd7[_0x21f6('0x2c')][_0x21f6('0x17')]);}return _0x1a960c['getSubjects'](_0x334b15);}})[_0x21f6('0x1f')](function(_0x225a70){if(_0x225a70){return _0x225a70?{'count':_0x102563,'rows':_0x225a70}:null;}})[_0x21f6('0x1f')](respondWithResult(_0x24210b,null))[_0x21f6('0x3d')](handleError(_0x24210b,null));};exports[_0x21f6('0x4c')]=function(_0x1cc403,_0x5b0e1e,_0x428784){var _0x422a05={};var _0x1709cb={};var _0x15cadd;var _0x150bf2;return db[_0x21f6('0x26')][_0x21f6('0x46')]({'where':{'id':_0x1cc403[_0x21f6('0x3f')]['id']}})[_0x21f6('0x1f')](handleEntityNotFound(_0x5b0e1e,null))[_0x21f6('0x1f')](function(_0x16927d){if(_0x16927d){_0x15cadd=_0x16927d;_0x1709cb[_0x21f6('0x2b')]=_[_0x21f6('0x40')](db[_0x21f6('0x47')]['rawAttributes']);_0x1709cb[_0x21f6('0x2c')]=_[_0x21f6('0x40')](_0x1cc403['query']);_0x1709cb[_0x21f6('0x2d')]=_['intersection'](_0x1709cb[_0x21f6('0x2b')],_0x1709cb[_0x21f6('0x2c')]);_0x422a05['attributes']=_[_0x21f6('0x2e')](_0x1709cb['model'],qs[_0x21f6('0x2f')](_0x1cc403[_0x21f6('0x2c')][_0x21f6('0x2f')]));_0x422a05[_0x21f6('0x30')]=_0x422a05['attributes'][_0x21f6('0x41')]?_0x422a05[_0x21f6('0x30')]:_0x1709cb[_0x21f6('0x2b')];_0x422a05['order']=qs[_0x21f6('0x33')](_0x1cc403['query']['sort']);_0x422a05[_0x21f6('0x35')]=qs['filters'](_['pick'](_0x1cc403['query'],_0x1709cb[_0x21f6('0x2d')]));if(_0x1cc403['query'][_0x21f6('0x38')]){_0x422a05[_0x21f6('0x35')]=_[_0x21f6('0x36')](_0x422a05[_0x21f6('0x35')],{'$or':_['map'](_0x422a05['attributes'],function(_0x50a01b){var _0x30b424={};_0x30b424[_0x50a01b]={'$like':'%'+_0x1cc403[_0x21f6('0x2c')]['filter']+'%'};return _0x30b424;})});}_0x422a05=_[_0x21f6('0x36')]({},_0x422a05,_0x1cc403[_0x21f6('0x49')]);return _0x15cadd[_0x21f6('0x4c')](_0x422a05);}})[_0x21f6('0x1f')](function(_0x195522){if(_0x195522){_0x150bf2=_0x195522[_0x21f6('0x41')];if(!_0x1cc403['query'][_0x21f6('0x4b')](_0x21f6('0x31'))){_0x422a05[_0x21f6('0x19')]=qs[_0x21f6('0x19')](_0x1cc403[_0x21f6('0x2c')][_0x21f6('0x19')]);_0x422a05[_0x21f6('0x17')]=qs[_0x21f6('0x17')](_0x1cc403[_0x21f6('0x2c')]['offset']);}return _0x15cadd['getDescriptions'](_0x422a05);}})[_0x21f6('0x1f')](function(_0x466940){if(_0x466940){return _0x466940?{'count':_0x150bf2,'rows':_0x466940}:null;}})[_0x21f6('0x1f')](respondWithResult(_0x5b0e1e,null))[_0x21f6('0x3d')](handleError(_0x5b0e1e,null));};exports[_0x21f6('0x4d')]=function(_0x375194,_0x1b6317,_0x4cd566){var _0xbf712e={};var _0x454147={};var _0x32141d;var _0x498731;return db[_0x21f6('0x26')][_0x21f6('0x46')]({'where':{'id':_0x375194[_0x21f6('0x3f')]['id']}})[_0x21f6('0x1f')](handleEntityNotFound(_0x1b6317,null))[_0x21f6('0x1f')](function(_0x6fa96e){if(_0x6fa96e){_0x32141d=_0x6fa96e;_0x454147[_0x21f6('0x2b')]=_[_0x21f6('0x40')](db[_0x21f6('0x47')][_0x21f6('0x27')]);_0x454147['query']=_[_0x21f6('0x40')](_0x375194['query']);_0x454147[_0x21f6('0x2d')]=_['intersection'](_0x454147[_0x21f6('0x2b')],_0x454147[_0x21f6('0x2c')]);_0xbf712e['attributes']=_[_0x21f6('0x2e')](_0x454147[_0x21f6('0x2b')],qs['fields'](_0x375194[_0x21f6('0x2c')][_0x21f6('0x2f')]));_0xbf712e[_0x21f6('0x30')]=_0xbf712e[_0x21f6('0x30')][_0x21f6('0x41')]?_0xbf712e['attributes']:_0x454147[_0x21f6('0x2b')];_0xbf712e[_0x21f6('0x32')]=qs['sort'](_0x375194[_0x21f6('0x2c')][_0x21f6('0x33')]);_0xbf712e['where']=qs['filters'](_[_0x21f6('0x34')](_0x375194[_0x21f6('0x2c')],_0x454147['filters']));if(_0x375194['query'][_0x21f6('0x38')]){_0xbf712e[_0x21f6('0x35')]=_[_0x21f6('0x36')](_0xbf712e[_0x21f6('0x35')],{'$or':_['map'](_0xbf712e['attributes'],function(_0x3b08b1){var _0x5e576c={};_0x5e576c[_0x3b08b1]={'$like':'%'+_0x375194['query'][_0x21f6('0x38')]+'%'};return _0x5e576c;})});}_0xbf712e=_[_0x21f6('0x36')]({},_0xbf712e,_0x375194[_0x21f6('0x49')]);return _0x32141d[_0x21f6('0x4d')](_0xbf712e);}})[_0x21f6('0x1f')](function(_0x3da066){if(_0x3da066){_0x498731=_0x3da066[_0x21f6('0x41')];if(!_0x375194['query'][_0x21f6('0x4b')](_0x21f6('0x31'))){_0xbf712e[_0x21f6('0x19')]=qs[_0x21f6('0x19')](_0x375194[_0x21f6('0x2c')][_0x21f6('0x19')]);_0xbf712e[_0x21f6('0x17')]=qs[_0x21f6('0x17')](_0x375194['query'][_0x21f6('0x17')]);}return _0x32141d['getFields'](_0xbf712e);}})[_0x21f6('0x1f')](function(_0x343192){if(_0x343192){return _0x343192?{'count':_0x498731,'rows':_0x343192}:null;}})[_0x21f6('0x1f')](respondWithResult(_0x1b6317,null))[_0x21f6('0x3d')](handleError(_0x1b6317,null));}; \ No newline at end of file +var _0x3d27=['show','params','fields','find','create','body','getSubjects','findOne','FreshsalesField','length','getDescriptions','nolimit','getFields','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch'];(function(_0x1faf34,_0x5a96e7){var _0x294624=function(_0x9679ec){while(--_0x9679ec){_0x1faf34['push'](_0x1faf34['shift']());}};_0x294624(++_0x5a96e7);}(_0x3d27,0x1a2));var _0x73d2=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x3d27[_0x12b8ec];return _0x21af77;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73d2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73d2('0x1'));var moment=require(_0x73d2('0x2'));var BPromise=require(_0x73d2('0x3'));var Mustache=require(_0x73d2('0x4'));var util=require(_0x73d2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x73d2('0x6'));var ejs=require(_0x73d2('0x7'));var fs=require('fs');var fs_extra=require(_0x73d2('0x8'));var _=require(_0x73d2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x73d2('0xa'));var deskjs=require(_0x73d2('0xb'));var toCsv=require(_0x73d2('0x6'));var querystring=require(_0x73d2('0xc'));var Papa=require(_0x73d2('0xd'));var Redis=require(_0x73d2('0xe'));var authService=require(_0x73d2('0xf'));var qs=require(_0x73d2('0x10'));var as=require(_0x73d2('0x11'));var hardwareService=require(_0x73d2('0x12'));var logger=require(_0x73d2('0x13'))(_0x73d2('0x14'));var utils=require(_0x73d2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x73d2('0x16'));var db=require(_0x73d2('0x17'))['db'];function respondWithStatusCode(_0x5a7b3c,_0x57605d){_0x57605d=_0x57605d||0xcc;return function(_0x5121b5){if(_0x5121b5){return _0x5a7b3c[_0x73d2('0x18')](_0x57605d);}return _0x5a7b3c[_0x73d2('0x19')](_0x57605d)[_0x73d2('0x1a')]();};}function respondWithResult(_0x44bd3c,_0x1e0a42){_0x1e0a42=_0x1e0a42||0xc8;return function(_0xe1ad4){if(_0xe1ad4){return _0x44bd3c[_0x73d2('0x19')](_0x1e0a42)[_0x73d2('0x1b')](_0xe1ad4);}};}function respondWithFilteredResult(_0x12200e,_0x3a887b){return function(_0x49b1f4){if(_0x49b1f4){var _0x32a194=typeof _0x3a887b['offset']===_0x73d2('0x1c')&&typeof _0x3a887b['limit']===_0x73d2('0x1c');var _0x29bac2=_0x49b1f4[_0x73d2('0x1d')];var _0x4e3989=_0x32a194?0x0:_0x3a887b[_0x73d2('0x1e')];var _0x763ad=_0x32a194?_0x49b1f4[_0x73d2('0x1d')]:_0x3a887b[_0x73d2('0x1e')]+_0x3a887b['limit'];var _0x5bfea8;if(_0x763ad>=_0x29bac2){_0x763ad=_0x29bac2;_0x5bfea8=0xc8;}else{_0x5bfea8=0xce;}_0x12200e[_0x73d2('0x19')](_0x5bfea8);return _0x12200e[_0x73d2('0x1f')](_0x73d2('0x20'),_0x4e3989+'-'+_0x763ad+'/'+_0x29bac2)[_0x73d2('0x1b')](_0x49b1f4);}return null;};}function patchUpdates(_0x30102a){return function(_0x547d7b){try{jsonpatch[_0x73d2('0x21')](_0x547d7b,_0x30102a,!![]);}catch(_0x446bcc){return BPromise[_0x73d2('0x22')](_0x446bcc);}return _0x547d7b[_0x73d2('0x23')]();};}function saveUpdates(_0x173924,_0x3bff72){return function(_0x2ee282){if(_0x2ee282){return _0x2ee282[_0x73d2('0x24')](_0x173924)['then'](function(_0x36a0c6){return _0x36a0c6;});}return null;};}function removeEntity(_0x57cfe4,_0x52ab06){return function(_0x4be545){if(_0x4be545){return _0x4be545[_0x73d2('0x25')]()[_0x73d2('0x26')](function(){_0x57cfe4[_0x73d2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2383bb,_0x56f18d){return function(_0x26cd2f){if(!_0x26cd2f){_0x2383bb[_0x73d2('0x18')](0x194);}return _0x26cd2f;};}function handleError(_0x508b91,_0x2b5998){_0x2b5998=_0x2b5998||0x1f4;return function(_0xc13ca9){logger[_0x73d2('0x27')](_0xc13ca9[_0x73d2('0x28')]);if(_0xc13ca9[_0x73d2('0x29')]){delete _0xc13ca9[_0x73d2('0x29')];}_0x508b91[_0x73d2('0x19')](_0x2b5998)['send'](_0xc13ca9);};}exports[_0x73d2('0x2a')]=function(_0xaf3925,_0x385d9a){var _0x56a1ac={},_0x281c34={},_0x414bd7={'count':0x0,'rows':[]};var _0x59db2d=_[_0x73d2('0x2b')](db[_0x73d2('0x2c')][_0x73d2('0x2d')],function(_0x16a23e){return{'name':_0x16a23e[_0x73d2('0x2e')],'type':_0x16a23e['type'][_0x73d2('0x2f')]};});_0x281c34['model']=_[_0x73d2('0x2b')](_0x59db2d,_0x73d2('0x29'));_0x281c34[_0x73d2('0x30')]=_[_0x73d2('0x31')](_0xaf3925[_0x73d2('0x30')]);_0x281c34[_0x73d2('0x32')]=_[_0x73d2('0x33')](_0x281c34[_0x73d2('0x34')],_0x281c34[_0x73d2('0x30')]);_0x56a1ac[_0x73d2('0x35')]=_[_0x73d2('0x33')](_0x281c34[_0x73d2('0x34')],qs['fields'](_0xaf3925[_0x73d2('0x30')]['fields']));_0x56a1ac[_0x73d2('0x35')]=_0x56a1ac['attributes']['length']?_0x56a1ac[_0x73d2('0x35')]:_0x281c34['model'];if(!_0xaf3925[_0x73d2('0x30')][_0x73d2('0x36')]('nolimit')){_0x56a1ac['limit']=qs[_0x73d2('0x37')](_0xaf3925['query'][_0x73d2('0x37')]);_0x56a1ac[_0x73d2('0x1e')]=qs[_0x73d2('0x1e')](_0xaf3925[_0x73d2('0x30')]['offset']);}_0x56a1ac[_0x73d2('0x38')]=qs[_0x73d2('0x39')](_0xaf3925[_0x73d2('0x30')][_0x73d2('0x39')]);_0x56a1ac[_0x73d2('0x3a')]=qs[_0x73d2('0x32')](_[_0x73d2('0x3b')](_0xaf3925[_0x73d2('0x30')],_0x281c34[_0x73d2('0x32')]),_0x59db2d);if(_0xaf3925[_0x73d2('0x30')][_0x73d2('0x3c')]){_0x56a1ac[_0x73d2('0x3a')]=_[_0x73d2('0x3d')](_0x56a1ac[_0x73d2('0x3a')],{'$or':_[_0x73d2('0x2b')](_0x59db2d,function(_0x264e22){if(_0x264e22[_0x73d2('0x3e')]!==_0x73d2('0x3f')){var _0x5be0d0={};_0x5be0d0[_0x264e22['name']]={'$like':'%'+_0xaf3925[_0x73d2('0x30')][_0x73d2('0x3c')]+'%'};return _0x5be0d0;}})});}_0x56a1ac=_['merge']({},_0x56a1ac,_0xaf3925[_0x73d2('0x40')]);var _0x345ce8={'where':_0x56a1ac[_0x73d2('0x3a')]};return db[_0x73d2('0x2c')][_0x73d2('0x1d')](_0x345ce8)['then'](function(_0xfdc65c){_0x414bd7[_0x73d2('0x1d')]=_0xfdc65c;if(_0xaf3925[_0x73d2('0x30')][_0x73d2('0x41')]){_0x56a1ac[_0x73d2('0x42')]=[{'all':!![]}];}return db[_0x73d2('0x2c')]['findAll'](_0x56a1ac);})['then'](function(_0x1f4028){_0x414bd7['rows']=_0x1f4028;return _0x414bd7;})[_0x73d2('0x26')](respondWithFilteredResult(_0x385d9a,_0x56a1ac))[_0x73d2('0x43')](handleError(_0x385d9a,null));};exports[_0x73d2('0x44')]=function(_0x17c1be,_0xb9aee3){var _0x8d679e={'raw':![],'where':{'id':_0x17c1be[_0x73d2('0x45')]['id']}},_0x4cfce3={};_0x4cfce3[_0x73d2('0x34')]=_[_0x73d2('0x31')](db[_0x73d2('0x2c')]['rawAttributes']);_0x4cfce3[_0x73d2('0x30')]=_[_0x73d2('0x31')](_0x17c1be[_0x73d2('0x30')]);_0x4cfce3[_0x73d2('0x32')]=_[_0x73d2('0x33')](_0x4cfce3[_0x73d2('0x34')],_0x4cfce3['query']);_0x8d679e[_0x73d2('0x35')]=_['intersection'](_0x4cfce3['model'],qs[_0x73d2('0x46')](_0x17c1be[_0x73d2('0x30')][_0x73d2('0x46')]));_0x8d679e['attributes']=_0x8d679e['attributes']['length']?_0x8d679e[_0x73d2('0x35')]:_0x4cfce3[_0x73d2('0x34')];if(_0x17c1be[_0x73d2('0x30')][_0x73d2('0x41')]){_0x8d679e[_0x73d2('0x42')]=[{'all':!![]}];}_0x8d679e=_['merge']({},_0x8d679e,_0x17c1be[_0x73d2('0x40')]);return db['FreshsalesConfiguration'][_0x73d2('0x47')](_0x8d679e)[_0x73d2('0x26')](handleEntityNotFound(_0xb9aee3,null))[_0x73d2('0x26')](respondWithResult(_0xb9aee3,null))['catch'](handleError(_0xb9aee3,null));};exports[_0x73d2('0x48')]=function(_0x40788a,_0x4eb984){return db[_0x73d2('0x2c')]['create'](_0x40788a[_0x73d2('0x49')],{})[_0x73d2('0x26')](respondWithResult(_0x4eb984,0xc9))[_0x73d2('0x43')](handleError(_0x4eb984,null));};exports[_0x73d2('0x24')]=function(_0x3b5b5e,_0x45e309){if(_0x3b5b5e['body']['id']){delete _0x3b5b5e[_0x73d2('0x49')]['id'];}return db[_0x73d2('0x2c')][_0x73d2('0x47')]({'where':{'id':_0x3b5b5e['params']['id']}})[_0x73d2('0x26')](handleEntityNotFound(_0x45e309,null))['then'](saveUpdates(_0x3b5b5e['body'],null))[_0x73d2('0x26')](respondWithResult(_0x45e309,null))[_0x73d2('0x43')](handleError(_0x45e309,null));};exports['destroy']=function(_0x41537e,_0x4079e4){return db['FreshsalesConfiguration'][_0x73d2('0x47')]({'where':{'id':_0x41537e[_0x73d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x4079e4,null))['then'](removeEntity(_0x4079e4,null))['catch'](handleError(_0x4079e4,null));};exports[_0x73d2('0x4a')]=function(_0x68853e,_0x13abce,_0x6ff603){var _0x148d21={};var _0xe8ba6b={};var _0x42c988;var _0x563778;return db['FreshsalesConfiguration'][_0x73d2('0x4b')]({'where':{'id':_0x68853e[_0x73d2('0x45')]['id']}})[_0x73d2('0x26')](handleEntityNotFound(_0x13abce,null))[_0x73d2('0x26')](function(_0x644659){if(_0x644659){_0x42c988=_0x644659;_0xe8ba6b[_0x73d2('0x34')]=_[_0x73d2('0x31')](db[_0x73d2('0x4c')][_0x73d2('0x2d')]);_0xe8ba6b['query']=_[_0x73d2('0x31')](_0x68853e[_0x73d2('0x30')]);_0xe8ba6b[_0x73d2('0x32')]=_[_0x73d2('0x33')](_0xe8ba6b[_0x73d2('0x34')],_0xe8ba6b['query']);_0x148d21['attributes']=_['intersection'](_0xe8ba6b[_0x73d2('0x34')],qs[_0x73d2('0x46')](_0x68853e[_0x73d2('0x30')][_0x73d2('0x46')]));_0x148d21[_0x73d2('0x35')]=_0x148d21[_0x73d2('0x35')][_0x73d2('0x4d')]?_0x148d21['attributes']:_0xe8ba6b['model'];_0x148d21[_0x73d2('0x38')]=qs[_0x73d2('0x39')](_0x68853e[_0x73d2('0x30')][_0x73d2('0x39')]);_0x148d21['where']=qs[_0x73d2('0x32')](_[_0x73d2('0x3b')](_0x68853e[_0x73d2('0x30')],_0xe8ba6b['filters']));if(_0x68853e[_0x73d2('0x30')][_0x73d2('0x3c')]){_0x148d21[_0x73d2('0x3a')]=_[_0x73d2('0x3d')](_0x148d21['where'],{'$or':_[_0x73d2('0x2b')](_0x148d21[_0x73d2('0x35')],function(_0x7c04fa){var _0x1008cd={};_0x1008cd[_0x7c04fa]={'$like':'%'+_0x68853e[_0x73d2('0x30')][_0x73d2('0x3c')]+'%'};return _0x1008cd;})});}_0x148d21=_[_0x73d2('0x3d')]({},_0x148d21,_0x68853e[_0x73d2('0x40')]);return _0x42c988[_0x73d2('0x4a')](_0x148d21);}})['then'](function(_0x53057a){if(_0x53057a){_0x563778=_0x53057a[_0x73d2('0x4d')];if(!_0x68853e[_0x73d2('0x30')][_0x73d2('0x36')]('nolimit')){_0x148d21[_0x73d2('0x37')]=qs['limit'](_0x68853e['query']['limit']);_0x148d21['offset']=qs[_0x73d2('0x1e')](_0x68853e[_0x73d2('0x30')][_0x73d2('0x1e')]);}return _0x42c988[_0x73d2('0x4a')](_0x148d21);}})['then'](function(_0x495b7c){if(_0x495b7c){return _0x495b7c?{'count':_0x563778,'rows':_0x495b7c}:null;}})[_0x73d2('0x26')](respondWithResult(_0x13abce,null))[_0x73d2('0x43')](handleError(_0x13abce,null));};exports[_0x73d2('0x4e')]=function(_0x410d0b,_0x403061,_0x195081){var _0x26f3bd={};var _0xdd293c={};var _0x40f883;var _0x347b01;return db['FreshsalesConfiguration'][_0x73d2('0x4b')]({'where':{'id':_0x410d0b[_0x73d2('0x45')]['id']}})[_0x73d2('0x26')](handleEntityNotFound(_0x403061,null))['then'](function(_0x5a5b3d){if(_0x5a5b3d){_0x40f883=_0x5a5b3d;_0xdd293c[_0x73d2('0x34')]=_[_0x73d2('0x31')](db['FreshsalesField']['rawAttributes']);_0xdd293c['query']=_[_0x73d2('0x31')](_0x410d0b[_0x73d2('0x30')]);_0xdd293c['filters']=_['intersection'](_0xdd293c['model'],_0xdd293c[_0x73d2('0x30')]);_0x26f3bd[_0x73d2('0x35')]=_[_0x73d2('0x33')](_0xdd293c[_0x73d2('0x34')],qs[_0x73d2('0x46')](_0x410d0b['query']['fields']));_0x26f3bd[_0x73d2('0x35')]=_0x26f3bd['attributes'][_0x73d2('0x4d')]?_0x26f3bd[_0x73d2('0x35')]:_0xdd293c['model'];_0x26f3bd[_0x73d2('0x38')]=qs['sort'](_0x410d0b[_0x73d2('0x30')][_0x73d2('0x39')]);_0x26f3bd['where']=qs['filters'](_[_0x73d2('0x3b')](_0x410d0b[_0x73d2('0x30')],_0xdd293c['filters']));if(_0x410d0b[_0x73d2('0x30')]['filter']){_0x26f3bd[_0x73d2('0x3a')]=_[_0x73d2('0x3d')](_0x26f3bd['where'],{'$or':_['map'](_0x26f3bd['attributes'],function(_0x2f4be3){var _0x188417={};_0x188417[_0x2f4be3]={'$like':'%'+_0x410d0b[_0x73d2('0x30')][_0x73d2('0x3c')]+'%'};return _0x188417;})});}_0x26f3bd=_[_0x73d2('0x3d')]({},_0x26f3bd,_0x410d0b[_0x73d2('0x40')]);return _0x40f883[_0x73d2('0x4e')](_0x26f3bd);}})[_0x73d2('0x26')](function(_0x18b455){if(_0x18b455){_0x347b01=_0x18b455['length'];if(!_0x410d0b[_0x73d2('0x30')][_0x73d2('0x36')](_0x73d2('0x4f'))){_0x26f3bd[_0x73d2('0x37')]=qs[_0x73d2('0x37')](_0x410d0b[_0x73d2('0x30')][_0x73d2('0x37')]);_0x26f3bd['offset']=qs['offset'](_0x410d0b[_0x73d2('0x30')][_0x73d2('0x1e')]);}return _0x40f883[_0x73d2('0x4e')](_0x26f3bd);}})[_0x73d2('0x26')](function(_0x3113d7){if(_0x3113d7){return _0x3113d7?{'count':_0x347b01,'rows':_0x3113d7}:null;}})['then'](respondWithResult(_0x403061,null))[_0x73d2('0x43')](handleError(_0x403061,null));};exports[_0x73d2('0x50')]=function(_0xfa4dfd,_0x2a504d,_0x1a13df){var _0x36e009={};var _0x2c2a72={};var _0x534580;var _0x244a10;return db['FreshsalesConfiguration'][_0x73d2('0x4b')]({'where':{'id':_0xfa4dfd[_0x73d2('0x45')]['id']}})[_0x73d2('0x26')](handleEntityNotFound(_0x2a504d,null))['then'](function(_0x2fc3c8){if(_0x2fc3c8){_0x534580=_0x2fc3c8;_0x2c2a72[_0x73d2('0x34')]=_[_0x73d2('0x31')](db[_0x73d2('0x4c')][_0x73d2('0x2d')]);_0x2c2a72[_0x73d2('0x30')]=_['keys'](_0xfa4dfd[_0x73d2('0x30')]);_0x2c2a72[_0x73d2('0x32')]=_[_0x73d2('0x33')](_0x2c2a72['model'],_0x2c2a72[_0x73d2('0x30')]);_0x36e009[_0x73d2('0x35')]=_[_0x73d2('0x33')](_0x2c2a72['model'],qs[_0x73d2('0x46')](_0xfa4dfd[_0x73d2('0x30')][_0x73d2('0x46')]));_0x36e009['attributes']=_0x36e009[_0x73d2('0x35')][_0x73d2('0x4d')]?_0x36e009['attributes']:_0x2c2a72[_0x73d2('0x34')];_0x36e009[_0x73d2('0x38')]=qs[_0x73d2('0x39')](_0xfa4dfd['query'][_0x73d2('0x39')]);_0x36e009['where']=qs[_0x73d2('0x32')](_['pick'](_0xfa4dfd[_0x73d2('0x30')],_0x2c2a72[_0x73d2('0x32')]));if(_0xfa4dfd[_0x73d2('0x30')][_0x73d2('0x3c')]){_0x36e009[_0x73d2('0x3a')]=_[_0x73d2('0x3d')](_0x36e009['where'],{'$or':_['map'](_0x36e009['attributes'],function(_0x550fb6){var _0x285c7d={};_0x285c7d[_0x550fb6]={'$like':'%'+_0xfa4dfd[_0x73d2('0x30')][_0x73d2('0x3c')]+'%'};return _0x285c7d;})});}_0x36e009=_[_0x73d2('0x3d')]({},_0x36e009,_0xfa4dfd[_0x73d2('0x40')]);return _0x534580['getFields'](_0x36e009);}})[_0x73d2('0x26')](function(_0x420740){if(_0x420740){_0x244a10=_0x420740[_0x73d2('0x4d')];if(!_0xfa4dfd[_0x73d2('0x30')]['hasOwnProperty'](_0x73d2('0x4f'))){_0x36e009[_0x73d2('0x37')]=qs[_0x73d2('0x37')](_0xfa4dfd[_0x73d2('0x30')]['limit']);_0x36e009['offset']=qs[_0x73d2('0x1e')](_0xfa4dfd[_0x73d2('0x30')]['offset']);}return _0x534580[_0x73d2('0x50')](_0x36e009);}})[_0x73d2('0x26')](function(_0x5135af){if(_0x5135af){return _0x5135af?{'count':_0x244a10,'rows':_0x5135af}:null;}})[_0x73d2('0x26')](respondWithResult(_0x2a504d,null))['catch'](handleError(_0x2a504d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 5c0035d..e38210a 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 _0xadf1=['moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api'];(function(_0x38b49e,_0xcd6c71){var _0x3eebf1=function(_0xbc2b2c){while(--_0xbc2b2c){_0x38b49e['push'](_0x38b49e['shift']());}};_0x3eebf1(++_0xcd6c71);}(_0xadf1,0x8c));var _0x1adf=function(_0x4d243d,_0xff553a){_0x4d243d=_0x4d243d-0x0;var _0x5da200=_0xadf1[_0x4d243d];return _0x5da200;};'use strict';var _=require(_0x1adf('0x0'));var util=require(_0x1adf('0x1'));var logger=require('../../config/logger')(_0x1adf('0x2'));var moment=require(_0x1adf('0x3'));var BPromise=require(_0x1adf('0x4'));var rp=require(_0x1adf('0x5'));var fs=require('fs');var path=require(_0x1adf('0x6'));var rimraf=require(_0x1adf('0x7'));var config=require('../../config/environment');var attributes=require(_0x1adf('0x8'));module[_0x1adf('0x9')]=function(_0x488c1c,_0x31c673){return _0x488c1c[_0x1adf('0xa')](_0x1adf('0xb'),attributes,{'tableName':_0x1adf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b02=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','moment'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x9b02,0xa5));var _0x29b0=function(_0x4d7558,_0x12ea20){_0x4d7558=_0x4d7558-0x0;var _0x42219f=_0x9b02[_0x4d7558];return _0x42219f;};'use strict';var _=require(_0x29b0('0x0'));var util=require('util');var logger=require(_0x29b0('0x1'))('api');var moment=require(_0x29b0('0x2'));var BPromise=require(_0x29b0('0x3'));var rp=require(_0x29b0('0x4'));var fs=require('fs');var path=require(_0x29b0('0x5'));var rimraf=require(_0x29b0('0x6'));var config=require(_0x29b0('0x7'));var attributes=require(_0x29b0('0x8'));module[_0x29b0('0x9')]=function(_0x153fdc,_0x2e74ba){return _0x153fdc['define'](_0x29b0('0xa'),attributes,{'tableName':_0x29b0('0xb'),'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 473a615..305dbb3 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 _0x7c5a=['../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1be531,_0x186ed7){var _0x1bdc14=function(_0x416d0f){while(--_0x416d0f){_0x1be531['push'](_0x1be531['shift']());}};_0x1bdc14(++_0x186ed7);}(_0x7c5a,0x10b));var _0xa7c5=function(_0xa1f751,_0x5af664){_0xa1f751=_0xa1f751-0x0;var _0x27566f=_0x7c5a[_0xa1f751];return _0x27566f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa7c5('0x0'));var rs=require(_0xa7c5('0x1'));var fs=require('fs');var Redis=require(_0xa7c5('0x2'));var db=require(_0xa7c5('0x3'))['db'];var utils=require(_0xa7c5('0x4'));var logger=require(_0xa7c5('0x5'))('rpc');var config=require(_0xa7c5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa7c5('0x7')][_0xa7c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43ddd0,_0x3abc0a,_0x54e279){return new BPromise(function(_0x53489b,_0x3b2926){return client[_0xa7c5('0x9')](_0x43ddd0,_0x54e279)[_0xa7c5('0xa')](function(_0x33d45c){logger[_0xa7c5('0xb')](_0xa7c5('0xc'),_0x3abc0a,_0xa7c5('0xd'));logger['debug'](_0xa7c5('0xe'),_0x3abc0a,_0xa7c5('0xd'),JSON[_0xa7c5('0xf')](_0x33d45c));if(_0x33d45c[_0xa7c5('0x10')]){if(_0x33d45c[_0xa7c5('0x10')][_0xa7c5('0x11')]===0x1f4){logger[_0xa7c5('0x10')](_0xa7c5('0xc'),_0x3abc0a,_0x33d45c[_0xa7c5('0x10')][_0xa7c5('0x12')]);return _0x3b2926(_0x33d45c[_0xa7c5('0x10')][_0xa7c5('0x12')]);}logger['error'](_0xa7c5('0xc'),_0x3abc0a,_0x33d45c['error'][_0xa7c5('0x12')]);return _0x53489b(_0x33d45c[_0xa7c5('0x10')][_0xa7c5('0x12')]);}else{logger[_0xa7c5('0xb')](_0xa7c5('0xc'),_0x3abc0a,_0xa7c5('0xd'));_0x53489b(_0x33d45c[_0xa7c5('0x13')][_0xa7c5('0x12')]);}})[_0xa7c5('0x14')](function(_0xd2e5e6){logger[_0xa7c5('0x10')](_0xa7c5('0xc'),_0x3abc0a,_0xd2e5e6);_0x3b2926(_0xd2e5e6);});});} \ No newline at end of file +var _0xb810=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x75bc02,_0x25be0e){var _0x35b224=function(_0x447454){while(--_0x447454){_0x75bc02['push'](_0x75bc02['shift']());}};_0x35b224(++_0x25be0e);}(_0xb810,0x19c));var _0x0b81=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb810[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0b81('0x0'));var util=require(_0x0b81('0x1'));var moment=require(_0x0b81('0x2'));var BPromise=require(_0x0b81('0x3'));var rs=require(_0x0b81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b81('0x5'))['db'];var utils=require(_0x0b81('0x6'));var logger=require(_0x0b81('0x7'))(_0x0b81('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0b81('0x9')][_0x0b81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eeb73,_0x461849,_0x1bb692){return new BPromise(function(_0x31d664,_0x4c47fd){return client[_0x0b81('0xb')](_0x2eeb73,_0x1bb692)[_0x0b81('0xc')](function(_0x403916){logger[_0x0b81('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x461849,_0x0b81('0xe'));logger[_0x0b81('0xf')](_0x0b81('0x10'),_0x461849,_0x0b81('0xe'),JSON[_0x0b81('0x11')](_0x403916));if(_0x403916[_0x0b81('0x12')]){if(_0x403916['error'][_0x0b81('0x13')]===0x1f4){logger['error'](_0x0b81('0x14'),_0x461849,_0x403916['error'][_0x0b81('0x15')]);return _0x4c47fd(_0x403916[_0x0b81('0x12')][_0x0b81('0x15')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x461849,_0x403916[_0x0b81('0x12')][_0x0b81('0x15')]);return _0x31d664(_0x403916[_0x0b81('0x12')][_0x0b81('0x15')]);}else{logger[_0x0b81('0xd')](_0x0b81('0x14'),_0x461849,'request\x20sent');_0x31d664(_0x403916['result'][_0x0b81('0x15')]);}})['catch'](function(_0x4b0263){logger[_0x0b81('0x12')](_0x0b81('0x14'),_0x461849,_0x4b0263);_0x4c47fd(_0x4b0263);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a2c663f..d069c7e 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 _0x894f=['show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x894f,0x14d));var _0xf894=function(_0x386aa3,_0x5a6802){_0x386aa3=_0x386aa3-0x0;var _0x5b3dd2=_0x894f[_0x386aa3];return _0x5b3dd2;};'use strict';var multer=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var path=require(_0xf894('0x2'));var timeout=require(_0xf894('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf894('0x4'));var auth=require(_0xf894('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf894('0x6'));router[_0xf894('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf894('0x7')](_0xf894('0x8'),auth['isAuthenticated'](),controller[_0xf894('0x9')]);router[_0xf894('0xa')]('/',auth[_0xf894('0xb')](),controller[_0xf894('0xc')]);router[_0xf894('0xd')](_0xf894('0x8'),auth[_0xf894('0xb')](),controller[_0xf894('0xe')]);router[_0xf894('0xf')](_0xf894('0x8'),auth[_0xf894('0xb')](),controller[_0xf894('0x10')]);module[_0xf894('0x11')]=router; \ No newline at end of file +var _0xa9e5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4355d5,_0x4e7ee3){var _0x185819=function(_0xaea950){while(--_0xaea950){_0x4355d5['push'](_0x4355d5['shift']());}};_0x185819(++_0x4e7ee3);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x318bf3,_0x5a1b02){_0x318bf3=_0x318bf3-0x0;var _0x34f0de=_0xa9e5[_0x318bf3];return _0x34f0de;};'use strict';var multer=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var path=require('path');var timeout=require(_0x5a9e('0x2'));var express=require(_0x5a9e('0x3'));var router=express[_0x5a9e('0x4')]();var fs_extra=require(_0x5a9e('0x5'));var auth=require(_0x5a9e('0x6'));var interaction=require(_0x5a9e('0x7'));var config=require(_0x5a9e('0x8'));var controller=require(_0x5a9e('0x9'));router[_0x5a9e('0xa')]('/',auth[_0x5a9e('0xb')](),controller[_0x5a9e('0xc')]);router[_0x5a9e('0xa')](_0x5a9e('0xd'),auth[_0x5a9e('0xb')](),controller['show']);router[_0x5a9e('0xe')]('/',auth[_0x5a9e('0xb')](),controller[_0x5a9e('0xf')]);router[_0x5a9e('0x10')]('/:id',auth[_0x5a9e('0xb')](),controller['update']);router[_0x5a9e('0x11')](_0x5a9e('0xd'),auth[_0x5a9e('0xb')](),controller[_0x5a9e('0x12')]);module[_0x5a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a68a1e0..3793fcf 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 _0x1ac8=['customVariable','sequelize','exports','ENUM','string','variable','picklist','STRING'];(function(_0x1a268f,_0x2f4759){var _0x63fe77=function(_0x525a3e){while(--_0x525a3e){_0x1a268f['push'](_0x1a268f['shift']());}};_0x63fe77(++_0x2f4759);}(_0x1ac8,0x181));var _0x81ac=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1ac8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x81ac('0x0'));module[_0x81ac('0x1')]={'type':{'type':Sequelize[_0x81ac('0x2')](_0x81ac('0x3'),_0x81ac('0x4'),'customVariable','keyValue',_0x81ac('0x5')),'defaultValue':_0x81ac('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x81ac('0x6')]},'keyType':{'type':Sequelize[_0x81ac('0x2')](_0x81ac('0x3'),_0x81ac('0x4'),_0x81ac('0x7'))},'keyContent':{'type':Sequelize[_0x81ac('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x81ac('0x6')]}}; \ No newline at end of file +var _0x9949=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x9949,0xbd));var _0x9994=function(_0x1a1408,_0x5612c0){_0x1a1408=_0x1a1408-0x0;var _0x76106c=_0x9949[_0x1a1408];return _0x76106c;};'use strict';var Sequelize=require(_0x9994('0x0'));module[_0x9994('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9994('0x2'),_0x9994('0x3'),_0x9994('0x4'),_0x9994('0x5'),_0x9994('0x6')),'defaultValue':_0x9994('0x2')},'content':{'type':Sequelize[_0x9994('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9994('0x8')](_0x9994('0x2'),_0x9994('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9994('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9994('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 8f306bf..b9c398c 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 _0xf3b2=['status','end','json','limit','undefined','count','offset','set','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','FreshsalesField','findAll','rows','catch','show','params','intersection','includeAll','create','body','find','request-promise','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2fc883,_0xfc2676){var _0x2b954d=function(_0x342030){while(--_0x342030){_0x2fc883['push'](_0x2fc883['shift']());}};_0x2b954d(++_0xfc2676);}(_0xf3b2,0x199));var _0x2f3b=function(_0x213ed5,_0x26712a){_0x213ed5=_0x213ed5-0x0;var _0x191514=_0xf3b2[_0x213ed5];return _0x191514;};'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(_0x2f3b('0x0'));var moment=require('moment');var BPromise=require(_0x2f3b('0x1'));var Mustache=require('mustache');var util=require(_0x2f3b('0x2'));var path=require(_0x2f3b('0x3'));var sox=require('sox');var csv=require(_0x2f3b('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2f3b('0x5'));var crypto=require(_0x2f3b('0x6'));var jsforce=require(_0x2f3b('0x7'));var deskjs=require(_0x2f3b('0x8'));var toCsv=require(_0x2f3b('0x4'));var querystring=require(_0x2f3b('0x9'));var Papa=require(_0x2f3b('0xa'));var Redis=require(_0x2f3b('0xb'));var authService=require(_0x2f3b('0xc'));var qs=require(_0x2f3b('0xd'));var as=require(_0x2f3b('0xe'));var hardwareService=require(_0x2f3b('0xf'));var logger=require(_0x2f3b('0x10'))(_0x2f3b('0x11'));var utils=require(_0x2f3b('0x12'));var config=require(_0x2f3b('0x13'));var licenseUtil=require(_0x2f3b('0x14'));var db=require(_0x2f3b('0x15'))['db'];function respondWithStatusCode(_0x5af75c,_0x112fa1){_0x112fa1=_0x112fa1||0xcc;return function(_0xaaaa3d){if(_0xaaaa3d){return _0x5af75c[_0x2f3b('0x16')](_0x112fa1);}return _0x5af75c[_0x2f3b('0x17')](_0x112fa1)[_0x2f3b('0x18')]();};}function respondWithResult(_0x18c8c9,_0x3d66e8){_0x3d66e8=_0x3d66e8||0xc8;return function(_0x81cea6){if(_0x81cea6){return _0x18c8c9[_0x2f3b('0x17')](_0x3d66e8)[_0x2f3b('0x19')](_0x81cea6);}};}function respondWithFilteredResult(_0x192b48,_0x5723fc){return function(_0x3bf08c){if(_0x3bf08c){var _0xbe2b40=typeof _0x5723fc['offset']==='undefined'&&typeof _0x5723fc[_0x2f3b('0x1a')]===_0x2f3b('0x1b');var _0x1ec5d6=_0x3bf08c[_0x2f3b('0x1c')];var _0x356eb6=_0xbe2b40?0x0:_0x5723fc['offset'];var _0x2cf74c=_0xbe2b40?_0x3bf08c[_0x2f3b('0x1c')]:_0x5723fc[_0x2f3b('0x1d')]+_0x5723fc['limit'];var _0x47a524;if(_0x2cf74c>=_0x1ec5d6){_0x2cf74c=_0x1ec5d6;_0x47a524=0xc8;}else{_0x47a524=0xce;}_0x192b48[_0x2f3b('0x17')](_0x47a524);return _0x192b48[_0x2f3b('0x1e')]('Content-Range',_0x356eb6+'-'+_0x2cf74c+'/'+_0x1ec5d6)[_0x2f3b('0x19')](_0x3bf08c);}return null;};}function patchUpdates(_0x4fbc07){return function(_0x5a43ba){try{jsonpatch['apply'](_0x5a43ba,_0x4fbc07,!![]);}catch(_0x2ece76){return BPromise[_0x2f3b('0x1f')](_0x2ece76);}return _0x5a43ba['save']();};}function saveUpdates(_0x35fdae,_0x49a78d){return function(_0x352b6f){if(_0x352b6f){return _0x352b6f[_0x2f3b('0x20')](_0x35fdae)[_0x2f3b('0x21')](function(_0x1ba68f){return _0x1ba68f;});}return null;};}function removeEntity(_0x5d86ee,_0x452443){return function(_0x2e790c){if(_0x2e790c){return _0x2e790c[_0x2f3b('0x22')]()[_0x2f3b('0x21')](function(){_0x5d86ee[_0x2f3b('0x17')](0xcc)[_0x2f3b('0x18')]();});}};}function handleEntityNotFound(_0x18c71c,_0x9f8bf6){return function(_0x323cd4){if(!_0x323cd4){_0x18c71c['sendStatus'](0x194);}return _0x323cd4;};}function handleError(_0x18931a,_0x328957){_0x328957=_0x328957||0x1f4;return function(_0x34edff){logger[_0x2f3b('0x23')](_0x34edff[_0x2f3b('0x24')]);if(_0x34edff[_0x2f3b('0x25')]){delete _0x34edff[_0x2f3b('0x25')];}_0x18931a[_0x2f3b('0x17')](_0x328957)['send'](_0x34edff);};}exports[_0x2f3b('0x26')]=function(_0x2e3e51,_0x290f75){var _0x293bdb={},_0x52f819={},_0xc36ee8={'count':0x0,'rows':[]};var _0x3b73c2=_[_0x2f3b('0x27')](db['FreshsalesField'][_0x2f3b('0x28')],function(_0xe15de9){return{'name':_0xe15de9[_0x2f3b('0x29')],'type':_0xe15de9[_0x2f3b('0x2a')][_0x2f3b('0x2b')]};});_0x52f819[_0x2f3b('0x2c')]=_[_0x2f3b('0x27')](_0x3b73c2,_0x2f3b('0x25'));_0x52f819[_0x2f3b('0x2d')]=_[_0x2f3b('0x2e')](_0x2e3e51[_0x2f3b('0x2d')]);_0x52f819[_0x2f3b('0x2f')]=_['intersection'](_0x52f819['model'],_0x52f819[_0x2f3b('0x2d')]);_0x293bdb[_0x2f3b('0x30')]=_['intersection'](_0x52f819[_0x2f3b('0x2c')],qs['fields'](_0x2e3e51[_0x2f3b('0x2d')][_0x2f3b('0x31')]));_0x293bdb[_0x2f3b('0x30')]=_0x293bdb[_0x2f3b('0x30')][_0x2f3b('0x32')]?_0x293bdb[_0x2f3b('0x30')]:_0x52f819['model'];if(!_0x2e3e51[_0x2f3b('0x2d')][_0x2f3b('0x33')](_0x2f3b('0x34'))){_0x293bdb[_0x2f3b('0x1a')]=qs[_0x2f3b('0x1a')](_0x2e3e51[_0x2f3b('0x2d')][_0x2f3b('0x1a')]);_0x293bdb[_0x2f3b('0x1d')]=qs['offset'](_0x2e3e51[_0x2f3b('0x2d')]['offset']);}_0x293bdb[_0x2f3b('0x35')]=qs['sort'](_0x2e3e51[_0x2f3b('0x2d')][_0x2f3b('0x36')]);_0x293bdb['where']=qs[_0x2f3b('0x2f')](_['pick'](_0x2e3e51['query'],_0x52f819[_0x2f3b('0x2f')]),_0x3b73c2);if(_0x2e3e51[_0x2f3b('0x2d')][_0x2f3b('0x37')]){_0x293bdb[_0x2f3b('0x38')]=_[_0x2f3b('0x39')](_0x293bdb[_0x2f3b('0x38')],{'$or':_[_0x2f3b('0x27')](_0x3b73c2,function(_0x3ff096){if(_0x3ff096['type']!==_0x2f3b('0x3a')){var _0x6eed8b={};_0x6eed8b[_0x3ff096['name']]={'$like':'%'+_0x2e3e51[_0x2f3b('0x2d')][_0x2f3b('0x37')]+'%'};return _0x6eed8b;}})});}_0x293bdb=_[_0x2f3b('0x39')]({},_0x293bdb,_0x2e3e51[_0x2f3b('0x3b')]);var _0x6f46c3={'where':_0x293bdb[_0x2f3b('0x38')]};return db['FreshsalesField']['count'](_0x6f46c3)[_0x2f3b('0x21')](function(_0x4e460c){_0xc36ee8['count']=_0x4e460c;if(_0x2e3e51[_0x2f3b('0x2d')]['includeAll']){_0x293bdb[_0x2f3b('0x3c')]=[{'all':!![]}];}return db[_0x2f3b('0x3d')][_0x2f3b('0x3e')](_0x293bdb);})[_0x2f3b('0x21')](function(_0x3a42f4){_0xc36ee8[_0x2f3b('0x3f')]=_0x3a42f4;return _0xc36ee8;})[_0x2f3b('0x21')](respondWithFilteredResult(_0x290f75,_0x293bdb))[_0x2f3b('0x40')](handleError(_0x290f75,null));};exports[_0x2f3b('0x41')]=function(_0x3cd4cc,_0x120792){var _0x1cd1ae={'raw':!![],'where':{'id':_0x3cd4cc[_0x2f3b('0x42')]['id']}},_0x3b8672={};_0x3b8672[_0x2f3b('0x2c')]=_[_0x2f3b('0x2e')](db[_0x2f3b('0x3d')][_0x2f3b('0x28')]);_0x3b8672[_0x2f3b('0x2d')]=_[_0x2f3b('0x2e')](_0x3cd4cc[_0x2f3b('0x2d')]);_0x3b8672['filters']=_[_0x2f3b('0x43')](_0x3b8672['model'],_0x3b8672['query']);_0x1cd1ae['attributes']=_['intersection'](_0x3b8672[_0x2f3b('0x2c')],qs['fields'](_0x3cd4cc[_0x2f3b('0x2d')][_0x2f3b('0x31')]));_0x1cd1ae['attributes']=_0x1cd1ae['attributes'][_0x2f3b('0x32')]?_0x1cd1ae['attributes']:_0x3b8672['model'];if(_0x3cd4cc[_0x2f3b('0x2d')][_0x2f3b('0x44')]){_0x1cd1ae[_0x2f3b('0x3c')]=[{'all':!![]}];}_0x1cd1ae=_[_0x2f3b('0x39')]({},_0x1cd1ae,_0x3cd4cc[_0x2f3b('0x3b')]);return db['FreshsalesField']['find'](_0x1cd1ae)[_0x2f3b('0x21')](handleEntityNotFound(_0x120792,null))[_0x2f3b('0x21')](respondWithResult(_0x120792,null))['catch'](handleError(_0x120792,null));};exports[_0x2f3b('0x45')]=function(_0x91c28c,_0x2970a0){return db[_0x2f3b('0x3d')][_0x2f3b('0x45')](_0x91c28c[_0x2f3b('0x46')],{})[_0x2f3b('0x21')](respondWithResult(_0x2970a0,0xc9))[_0x2f3b('0x40')](handleError(_0x2970a0,null));};exports[_0x2f3b('0x20')]=function(_0x4a75f1,_0x1f908c){if(_0x4a75f1[_0x2f3b('0x46')]['id']){delete _0x4a75f1['body']['id'];}return db[_0x2f3b('0x3d')][_0x2f3b('0x47')]({'where':{'id':_0x4a75f1['params']['id']}})['then'](handleEntityNotFound(_0x1f908c,null))[_0x2f3b('0x21')](saveUpdates(_0x4a75f1[_0x2f3b('0x46')],null))[_0x2f3b('0x21')](respondWithResult(_0x1f908c,null))['catch'](handleError(_0x1f908c,null));};exports[_0x2f3b('0x22')]=function(_0xe1c061,_0x12162d){return db[_0x2f3b('0x3d')][_0x2f3b('0x47')]({'where':{'id':_0xe1c061['params']['id']}})[_0x2f3b('0x21')](handleEntityNotFound(_0x12162d,null))['then'](removeEntity(_0x12162d,null))['catch'](handleError(_0x12162d,null));}; \ No newline at end of file +var _0xc6ae=['catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','FreshsalesField','include','findAll','show','params','keys','includeAll','find'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0xc6ae,0xd8));var _0xec6a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc6ae[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xec6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec6a('0x1'));var jsonpatch=require(_0xec6a('0x2'));var rp=require(_0xec6a('0x3'));var moment=require('moment');var BPromise=require(_0xec6a('0x4'));var Mustache=require(_0xec6a('0x5'));var util=require('util');var path=require(_0xec6a('0x6'));var sox=require('sox');var csv=require(_0xec6a('0x7'));var ejs=require(_0xec6a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xec6a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xec6a('0xa'));var toCsv=require(_0xec6a('0x7'));var querystring=require(_0xec6a('0xb'));var Papa=require(_0xec6a('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec6a('0xd'));var hardwareService=require(_0xec6a('0xe'));var logger=require(_0xec6a('0xf'))(_0xec6a('0x10'));var utils=require(_0xec6a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xec6a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49186f,_0xb4e359){_0xb4e359=_0xb4e359||0xcc;return function(_0x751caf){if(_0x751caf){return _0x49186f[_0xec6a('0x13')](_0xb4e359);}return _0x49186f[_0xec6a('0x14')](_0xb4e359)['end']();};}function respondWithResult(_0x11ddb5,_0x2caced){_0x2caced=_0x2caced||0xc8;return function(_0x454242){if(_0x454242){return _0x11ddb5[_0xec6a('0x14')](_0x2caced)['json'](_0x454242);}};}function respondWithFilteredResult(_0x591cf2,_0x52ac56){return function(_0x548429){if(_0x548429){var _0x56c490=typeof _0x52ac56[_0xec6a('0x15')]===_0xec6a('0x16')&&typeof _0x52ac56['limit']===_0xec6a('0x16');var _0x22227d=_0x548429[_0xec6a('0x17')];var _0x3d9813=_0x56c490?0x0:_0x52ac56[_0xec6a('0x15')];var _0x56f062=_0x56c490?_0x548429['count']:_0x52ac56[_0xec6a('0x15')]+_0x52ac56[_0xec6a('0x18')];var _0x635ac1;if(_0x56f062>=_0x22227d){_0x56f062=_0x22227d;_0x635ac1=0xc8;}else{_0x635ac1=0xce;}_0x591cf2[_0xec6a('0x14')](_0x635ac1);return _0x591cf2[_0xec6a('0x19')](_0xec6a('0x1a'),_0x3d9813+'-'+_0x56f062+'/'+_0x22227d)[_0xec6a('0x1b')](_0x548429);}return null;};}function patchUpdates(_0x5d7a4a){return function(_0x3a840d){try{jsonpatch[_0xec6a('0x1c')](_0x3a840d,_0x5d7a4a,!![]);}catch(_0x221e1f){return BPromise[_0xec6a('0x1d')](_0x221e1f);}return _0x3a840d[_0xec6a('0x1e')]();};}function saveUpdates(_0x66421b,_0x4b0354){return function(_0x73c1fe){if(_0x73c1fe){return _0x73c1fe['update'](_0x66421b)[_0xec6a('0x1f')](function(_0x2f164f){return _0x2f164f;});}return null;};}function removeEntity(_0x243f19,_0x213e82){return function(_0x594686){if(_0x594686){return _0x594686[_0xec6a('0x20')]()['then'](function(){_0x243f19['status'](0xcc)[_0xec6a('0x21')]();});}};}function handleEntityNotFound(_0x5b2ef1,_0x1211ca){return function(_0x3615b2){if(!_0x3615b2){_0x5b2ef1[_0xec6a('0x13')](0x194);}return _0x3615b2;};}function handleError(_0x298f90,_0x45d479){_0x45d479=_0x45d479||0x1f4;return function(_0x259641){logger[_0xec6a('0x22')](_0x259641[_0xec6a('0x23')]);if(_0x259641[_0xec6a('0x24')]){delete _0x259641[_0xec6a('0x24')];}_0x298f90[_0xec6a('0x14')](_0x45d479)[_0xec6a('0x25')](_0x259641);};}exports[_0xec6a('0x26')]=function(_0x96ad9a,_0x47dd0b){var _0x1c239a={},_0xf5fc1c={},_0x28e062={'count':0x0,'rows':[]};var _0x5a5950=_[_0xec6a('0x27')](db['FreshsalesField'][_0xec6a('0x28')],function(_0x35a2f8){return{'name':_0x35a2f8[_0xec6a('0x29')],'type':_0x35a2f8['type'][_0xec6a('0x2a')]};});_0xf5fc1c['model']=_['map'](_0x5a5950,'name');_0xf5fc1c['query']=_['keys'](_0x96ad9a[_0xec6a('0x2b')]);_0xf5fc1c['filters']=_[_0xec6a('0x2c')](_0xf5fc1c['model'],_0xf5fc1c[_0xec6a('0x2b')]);_0x1c239a[_0xec6a('0x2d')]=_[_0xec6a('0x2c')](_0xf5fc1c['model'],qs['fields'](_0x96ad9a[_0xec6a('0x2b')][_0xec6a('0x2e')]));_0x1c239a[_0xec6a('0x2d')]=_0x1c239a[_0xec6a('0x2d')][_0xec6a('0x2f')]?_0x1c239a[_0xec6a('0x2d')]:_0xf5fc1c[_0xec6a('0x30')];if(!_0x96ad9a[_0xec6a('0x2b')][_0xec6a('0x31')]('nolimit')){_0x1c239a[_0xec6a('0x18')]=qs[_0xec6a('0x18')](_0x96ad9a['query'][_0xec6a('0x18')]);_0x1c239a[_0xec6a('0x15')]=qs[_0xec6a('0x15')](_0x96ad9a[_0xec6a('0x2b')][_0xec6a('0x15')]);}_0x1c239a[_0xec6a('0x32')]=qs[_0xec6a('0x33')](_0x96ad9a[_0xec6a('0x2b')]['sort']);_0x1c239a['where']=qs[_0xec6a('0x34')](_[_0xec6a('0x35')](_0x96ad9a[_0xec6a('0x2b')],_0xf5fc1c[_0xec6a('0x34')]),_0x5a5950);if(_0x96ad9a['query']['filter']){_0x1c239a[_0xec6a('0x36')]=_[_0xec6a('0x37')](_0x1c239a['where'],{'$or':_['map'](_0x5a5950,function(_0x27e575){if(_0x27e575[_0xec6a('0x38')]!==_0xec6a('0x39')){var _0x4bb3f1={};_0x4bb3f1[_0x27e575['name']]={'$like':'%'+_0x96ad9a[_0xec6a('0x2b')][_0xec6a('0x3a')]+'%'};return _0x4bb3f1;}})});}_0x1c239a=_[_0xec6a('0x37')]({},_0x1c239a,_0x96ad9a[_0xec6a('0x3b')]);var _0x25d16b={'where':_0x1c239a[_0xec6a('0x36')]};return db[_0xec6a('0x3c')][_0xec6a('0x17')](_0x25d16b)[_0xec6a('0x1f')](function(_0x5d91d6){_0x28e062[_0xec6a('0x17')]=_0x5d91d6;if(_0x96ad9a[_0xec6a('0x2b')]['includeAll']){_0x1c239a[_0xec6a('0x3d')]=[{'all':!![]}];}return db[_0xec6a('0x3c')][_0xec6a('0x3e')](_0x1c239a);})[_0xec6a('0x1f')](function(_0x3ebcd0){_0x28e062['rows']=_0x3ebcd0;return _0x28e062;})['then'](respondWithFilteredResult(_0x47dd0b,_0x1c239a))['catch'](handleError(_0x47dd0b,null));};exports[_0xec6a('0x3f')]=function(_0x32719e,_0x44cca1){var _0x28af07={'raw':!![],'where':{'id':_0x32719e[_0xec6a('0x40')]['id']}},_0x575b85={};_0x575b85['model']=_['keys'](db[_0xec6a('0x3c')]['rawAttributes']);_0x575b85[_0xec6a('0x2b')]=_[_0xec6a('0x41')](_0x32719e[_0xec6a('0x2b')]);_0x575b85[_0xec6a('0x34')]=_['intersection'](_0x575b85[_0xec6a('0x30')],_0x575b85['query']);_0x28af07[_0xec6a('0x2d')]=_[_0xec6a('0x2c')](_0x575b85[_0xec6a('0x30')],qs[_0xec6a('0x2e')](_0x32719e[_0xec6a('0x2b')][_0xec6a('0x2e')]));_0x28af07['attributes']=_0x28af07[_0xec6a('0x2d')]['length']?_0x28af07['attributes']:_0x575b85[_0xec6a('0x30')];if(_0x32719e['query'][_0xec6a('0x42')]){_0x28af07[_0xec6a('0x3d')]=[{'all':!![]}];}_0x28af07=_[_0xec6a('0x37')]({},_0x28af07,_0x32719e[_0xec6a('0x3b')]);return db['FreshsalesField'][_0xec6a('0x43')](_0x28af07)[_0xec6a('0x1f')](handleEntityNotFound(_0x44cca1,null))[_0xec6a('0x1f')](respondWithResult(_0x44cca1,null))[_0xec6a('0x44')](handleError(_0x44cca1,null));};exports[_0xec6a('0x45')]=function(_0x1f92a5,_0x29a3bc){return db['FreshsalesField'][_0xec6a('0x45')](_0x1f92a5['body'],{})[_0xec6a('0x1f')](respondWithResult(_0x29a3bc,0xc9))['catch'](handleError(_0x29a3bc,null));};exports['update']=function(_0x267d8a,_0x5ad679){if(_0x267d8a[_0xec6a('0x46')]['id']){delete _0x267d8a[_0xec6a('0x46')]['id'];}return db['FreshsalesField'][_0xec6a('0x43')]({'where':{'id':_0x267d8a[_0xec6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5ad679,null))[_0xec6a('0x1f')](saveUpdates(_0x267d8a[_0xec6a('0x46')],null))['then'](respondWithResult(_0x5ad679,null))[_0xec6a('0x44')](handleError(_0x5ad679,null));};exports[_0xec6a('0x20')]=function(_0x32881b,_0x323d7b){return db[_0xec6a('0x3c')]['find']({'where':{'id':_0x32881b[_0xec6a('0x40')]['id']}})[_0xec6a('0x1f')](handleEntityNotFound(_0x323d7b,null))[_0xec6a('0x1f')](removeEntity(_0x323d7b,null))[_0xec6a('0x44')](handleError(_0x323d7b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f445388..c6c1683 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 _0xda20=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','path','rimraf','./intFreshsalesField.attributes','exports','define'];(function(_0x32879c,_0x492fe0){var _0x4a9dea=function(_0x191e11){while(--_0x191e11){_0x32879c['push'](_0x32879c['shift']());}};_0x4a9dea(++_0x492fe0);}(_0xda20,0x1d9));var _0x0da2=function(_0xe5dcd9,_0x41261c){_0xe5dcd9=_0xe5dcd9-0x0;var _0x15f6b6=_0xda20[_0xe5dcd9];return _0x15f6b6;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var logger=require(_0x0da2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0da2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0da2('0x3'));var rimraf=require(_0x0da2('0x4'));var config=require('../../config/environment');var attributes=require(_0x0da2('0x5'));module[_0x0da2('0x6')]=function(_0x5c1bcb,_0x4674a3){return _0x5c1bcb[_0x0da2('0x7')](_0x0da2('0x8'),attributes,{'tableName':_0x0da2('0x9'),'paranoid':![],'indexes':[{'name':_0x0da2('0xa'),'fields':[_0x0da2('0xb'),_0x0da2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x117c=['int_freshsales_fields','idField','FieldId','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x3e0262,_0x3fd86b){var _0x22ac7d=function(_0x2dea85){while(--_0x2dea85){_0x3e0262['push'](_0x3e0262['shift']());}};_0x22ac7d(++_0x3fd86b);}(_0x117c,0x71));var _0xc117=function(_0x514bd1,_0x25ea3e){_0x514bd1=_0x514bd1-0x0;var _0x58a281=_0x117c[_0x514bd1];return _0x58a281;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc117('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc117('0x1'));var fs=require('fs');var path=require(_0xc117('0x2'));var rimraf=require(_0xc117('0x3'));var config=require(_0xc117('0x4'));var attributes=require(_0xc117('0x5'));module[_0xc117('0x6')]=function(_0x52d09e,_0x3bb859){return _0x52d09e[_0xc117('0x7')]('FreshsalesField',attributes,{'tableName':_0xc117('0x8'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xc117('0x9'),_0xc117('0xa')],'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 484c3d7..3f85f6f 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x521c8f,_0x623a5e){var _0x4a8b6b=function(_0x436b38){while(--_0x436b38){_0x521c8f['push'](_0x521c8f['shift']());}};_0x4a8b6b(++_0x623a5e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x5fc3[_0x4d674b];return _0x535a1f;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x2de2bc,_0x18d318){var _0x13e2ca=function(_0x45ce2a){while(--_0x45ce2a){_0x2de2bc['push'](_0x2de2bc['shift']());}};_0x13e2ca(++_0x18d318);}(_0xeda8,0x104));var _0x8eda=function(_0x28ed1d,_0x315c1b){_0x28ed1d=_0x28ed1d-0x0;var _0x1855ee=_0xeda8[_0x28ed1d];return _0x1855ee;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b434cc2..0f2e783 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(_0x3343c6,_0x5d99d0){var _0xdb4dc2=function(_0x2a3a7a){while(--_0x2a3a7a){_0x3343c6['push'](_0x3343c6['shift']());}};_0xdb4dc2(++_0x5d99d0);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x54f1d6,_0x35a88a){var _0x160d59=function(_0x326cac){while(--_0x326cac){_0x54f1d6['push'](_0x54f1d6['shift']());}};_0x160d59(++_0x35a88a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 fef0d0d..d9a240e 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 _0x68ee=['integrationTab','sequelize','exports','STRING','username','ENUM','newTab'];(function(_0x200c20,_0x1ffc71){var _0x18188d=function(_0x439bda){while(--_0x439bda){_0x200c20['push'](_0x200c20['shift']());}};_0x18188d(++_0x1ffc71);}(_0x68ee,0xd3));var _0xe68e=function(_0x31bade,_0xca7de8){_0x31bade=_0x31bade-0x0;var _0xa222ad=_0x68ee[_0x31bade];return _0xa222ad;};'use strict';var Sequelize=require(_0xe68e('0x0'));module[_0xe68e('0x1')]={'name':{'type':Sequelize[_0xe68e('0x2')]},'description':{'type':Sequelize[_0xe68e('0x2')]},'username':{'type':Sequelize[_0xe68e('0x2')],'unique':_0xe68e('0x3')},'remoteUri':{'type':Sequelize[_0xe68e('0x2')]},'password':{'type':Sequelize[_0xe68e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe68e('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe68e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe68e('0x4')]('integrationTab',_0xe68e('0x5')),'defaultValue':_0xe68e('0x6')}}; \ No newline at end of file +var _0x9931=['exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x9931,0x1b6));var _0x1993=function(_0x1a354d,_0x463d7a){_0x1a354d=_0x1a354d-0x0;var _0x22afba=_0x9931[_0x1a354d];return _0x22afba;};'use strict';var Sequelize=require('sequelize');module[_0x1993('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1993('0x1')]},'username':{'type':Sequelize[_0x1993('0x1')],'unique':_0x1993('0x2')},'remoteUri':{'type':Sequelize[_0x1993('0x1')]},'password':{'type':Sequelize[_0x1993('0x1')]},'clientId':{'type':Sequelize[_0x1993('0x1')]},'clientSecret':{'type':Sequelize[_0x1993('0x1')]},'securityToken':{'type':Sequelize[_0x1993('0x1')]},'serverUrl':{'type':Sequelize[_0x1993('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1993('0x3')](_0x1993('0x4'),_0x1993('0x5')),'defaultValue':_0x1993('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index da1d827..5305aa9 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 _0x36fe=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','offset','set','Content-Range','apply','reject','update','destroy','end','name','send','index','map','rawAttributes','fieldName','type','model','keys','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','merge','SalesforceAccount','count','then','includeAll','include','rows','show','params','options','catch','create','body','find','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','username','password','securityToken','slice','substring','Connection','clientId','clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf'];(function(_0x3f6aef,_0x32621b){var _0x541506=function(_0x2eae79){while(--_0x2eae79){_0x3f6aef['push'](_0x3f6aef['shift']());}};_0x541506(++_0x32621b);}(_0x36fe,0x17b));var _0xe36f=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x36fe[_0x195577];return _0x13c367;};'use strict';var emlformat=require(_0xe36f('0x0'));var rimraf=require(_0xe36f('0x1'));var zipdir=require(_0xe36f('0x2'));var jsonpatch=require(_0xe36f('0x3'));var rp=require(_0xe36f('0x4'));var moment=require(_0xe36f('0x5'));var BPromise=require(_0xe36f('0x6'));var Mustache=require(_0xe36f('0x7'));var util=require(_0xe36f('0x8'));var path=require(_0xe36f('0x9'));var sox=require(_0xe36f('0xa'));var csv=require(_0xe36f('0xb'));var ejs=require(_0xe36f('0xc'));var fs=require('fs');var fs_extra=require(_0xe36f('0xd'));var _=require(_0xe36f('0xe'));var squel=require(_0xe36f('0xf'));var crypto=require(_0xe36f('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe36f('0xb'));var querystring=require(_0xe36f('0x11'));var Papa=require(_0xe36f('0x12'));var Redis=require(_0xe36f('0x13'));var authService=require(_0xe36f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe36f('0x15'));var hardwareService=require(_0xe36f('0x16'));var logger=require(_0xe36f('0x17'))('api');var utils=require(_0xe36f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe36f('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe36f('0x1a'));function respondWithStatusCode(_0x507e1e,_0x439a90){_0x439a90=_0x439a90||0xcc;return function(_0x206a87){if(_0x206a87){return _0x507e1e[_0xe36f('0x1b')](_0x439a90);}return _0x507e1e['status'](_0x439a90)['end']();};}function respondWithResult(_0x17c769,_0x10472d){_0x10472d=_0x10472d||0xc8;return function(_0x399a9b){if(_0x399a9b){return _0x17c769[_0xe36f('0x1c')](_0x10472d)[_0xe36f('0x1d')](_0x399a9b);}};}function respondWithFilteredResult(_0x2485a0,_0x1ef369){return function(_0x530730){if(_0x530730){var _0x256ce4=typeof _0x1ef369['offset']===_0xe36f('0x1e')&&typeof _0x1ef369['limit']===_0xe36f('0x1e');var _0x1d6f48=_0x530730['count'];var _0x17173b=_0x256ce4?0x0:_0x1ef369[_0xe36f('0x1f')];var _0x526bba=_0x256ce4?_0x530730['count']:_0x1ef369['offset']+_0x1ef369['limit'];var _0x13aae5;if(_0x526bba>=_0x1d6f48){_0x526bba=_0x1d6f48;_0x13aae5=0xc8;}else{_0x13aae5=0xce;}_0x2485a0[_0xe36f('0x1c')](_0x13aae5);return _0x2485a0[_0xe36f('0x20')](_0xe36f('0x21'),_0x17173b+'-'+_0x526bba+'/'+_0x1d6f48)[_0xe36f('0x1d')](_0x530730);}return null;};}function patchUpdates(_0x2bb1b9){return function(_0x58b0e7){try{jsonpatch[_0xe36f('0x22')](_0x58b0e7,_0x2bb1b9,!![]);}catch(_0x4a1ced){return BPromise[_0xe36f('0x23')](_0x4a1ced);}return _0x58b0e7['save']();};}function saveUpdates(_0x373c24,_0x286d6d){return function(_0x4fdc79){if(_0x4fdc79){return _0x4fdc79[_0xe36f('0x24')](_0x373c24)['then'](function(_0x1df06a){return _0x1df06a;});}return null;};}function removeEntity(_0xe2e207,_0x317b95){return function(_0x74e58){if(_0x74e58){return _0x74e58[_0xe36f('0x25')]()['then'](function(){_0xe2e207[_0xe36f('0x1c')](0xcc)[_0xe36f('0x26')]();});}};}function handleEntityNotFound(_0x5dbb07,_0x361eb2){return function(_0x3200b9){if(!_0x3200b9){_0x5dbb07[_0xe36f('0x1b')](0x194);}return _0x3200b9;};}function handleError(_0x214905,_0x332e11){_0x332e11=_0x332e11||0x1f4;return function(_0xe36ed0){logger['error'](_0xe36ed0['stack']);if(_0xe36ed0[_0xe36f('0x27')]){delete _0xe36ed0[_0xe36f('0x27')];}_0x214905['status'](_0x332e11)[_0xe36f('0x28')](_0xe36ed0);};}exports[_0xe36f('0x29')]=function(_0x2e47bb,_0x175d95){var _0x4e645e={},_0x2d054c={},_0x1de1f0={'count':0x0,'rows':[]};var _0x12870d=_[_0xe36f('0x2a')](db['SalesforceAccount'][_0xe36f('0x2b')],function(_0x126676){return{'name':_0x126676[_0xe36f('0x2c')],'type':_0x126676[_0xe36f('0x2d')]['key']};});_0x2d054c[_0xe36f('0x2e')]=_['map'](_0x12870d,_0xe36f('0x27'));_0x2d054c['query']=_[_0xe36f('0x2f')](_0x2e47bb['query']);_0x2d054c['filters']=_['intersection'](_0x2d054c[_0xe36f('0x2e')],_0x2d054c['query']);_0x4e645e[_0xe36f('0x30')]=_[_0xe36f('0x31')](_0x2d054c['model'],qs[_0xe36f('0x32')](_0x2e47bb[_0xe36f('0x33')][_0xe36f('0x32')]));_0x4e645e['attributes']=_0x4e645e[_0xe36f('0x30')][_0xe36f('0x34')]?_0x4e645e['attributes']:_0x2d054c[_0xe36f('0x2e')];if(!_0x2e47bb[_0xe36f('0x33')][_0xe36f('0x35')](_0xe36f('0x36'))){_0x4e645e[_0xe36f('0x37')]=qs[_0xe36f('0x37')](_0x2e47bb['query'][_0xe36f('0x37')]);_0x4e645e['offset']=qs[_0xe36f('0x1f')](_0x2e47bb['query'][_0xe36f('0x1f')]);}_0x4e645e[_0xe36f('0x38')]=qs[_0xe36f('0x39')](_0x2e47bb[_0xe36f('0x33')][_0xe36f('0x39')]);_0x4e645e[_0xe36f('0x3a')]=qs[_0xe36f('0x3b')](_[_0xe36f('0x3c')](_0x2e47bb['query'],_0x2d054c[_0xe36f('0x3b')]),_0x12870d);if(_0x2e47bb[_0xe36f('0x33')]['filter']){_0x4e645e[_0xe36f('0x3a')]=_['merge'](_0x4e645e[_0xe36f('0x3a')],{'$or':_[_0xe36f('0x2a')](_0x12870d,function(_0x1b146a){if(_0x1b146a[_0xe36f('0x2d')]!==_0xe36f('0x3d')){var _0x4adec6={};_0x4adec6[_0x1b146a['name']]={'$like':'%'+_0x2e47bb['query'][_0xe36f('0x3e')]+'%'};return _0x4adec6;}})});}_0x4e645e=_[_0xe36f('0x3f')]({},_0x4e645e,_0x2e47bb['options']);var _0x52be4a={'where':_0x4e645e[_0xe36f('0x3a')]};return db[_0xe36f('0x40')][_0xe36f('0x41')](_0x52be4a)[_0xe36f('0x42')](function(_0x28fbd5){_0x1de1f0[_0xe36f('0x41')]=_0x28fbd5;if(_0x2e47bb['query'][_0xe36f('0x43')]){_0x4e645e[_0xe36f('0x44')]=[{'all':!![]}];}return db[_0xe36f('0x40')]['findAll'](_0x4e645e);})[_0xe36f('0x42')](function(_0x2725a2){_0x1de1f0[_0xe36f('0x45')]=_0x2725a2;return _0x1de1f0;})[_0xe36f('0x42')](respondWithFilteredResult(_0x175d95,_0x4e645e))['catch'](handleError(_0x175d95,null));};exports[_0xe36f('0x46')]=function(_0x56eb29,_0x5e7766){var _0x54bf57={'raw':![],'where':{'id':_0x56eb29[_0xe36f('0x47')]['id']}},_0x33b115={};_0x33b115[_0xe36f('0x2e')]=_['keys'](db[_0xe36f('0x40')][_0xe36f('0x2b')]);_0x33b115[_0xe36f('0x33')]=_['keys'](_0x56eb29[_0xe36f('0x33')]);_0x33b115[_0xe36f('0x3b')]=_[_0xe36f('0x31')](_0x33b115[_0xe36f('0x2e')],_0x33b115['query']);_0x54bf57['attributes']=_[_0xe36f('0x31')](_0x33b115[_0xe36f('0x2e')],qs[_0xe36f('0x32')](_0x56eb29[_0xe36f('0x33')][_0xe36f('0x32')]));_0x54bf57[_0xe36f('0x30')]=_0x54bf57[_0xe36f('0x30')]['length']?_0x54bf57['attributes']:_0x33b115[_0xe36f('0x2e')];if(_0x56eb29[_0xe36f('0x33')][_0xe36f('0x43')]){_0x54bf57[_0xe36f('0x44')]=[{'all':!![]}];}_0x54bf57=_['merge']({},_0x54bf57,_0x56eb29[_0xe36f('0x48')]);return db[_0xe36f('0x40')]['find'](_0x54bf57)[_0xe36f('0x42')](handleEntityNotFound(_0x5e7766,null))[_0xe36f('0x42')](respondWithResult(_0x5e7766,null))[_0xe36f('0x49')](handleError(_0x5e7766,null));};exports['create']=function(_0x175c9a,_0x5eca82){return db[_0xe36f('0x40')][_0xe36f('0x4a')](_0x175c9a[_0xe36f('0x4b')],{})[_0xe36f('0x42')](respondWithResult(_0x5eca82,0xc9))[_0xe36f('0x49')](handleError(_0x5eca82,null));};exports[_0xe36f('0x24')]=function(_0x3099fc,_0x1bf2d5){if(_0x3099fc[_0xe36f('0x4b')]['id']){delete _0x3099fc['body']['id'];}return db[_0xe36f('0x40')][_0xe36f('0x4c')]({'where':{'id':_0x3099fc['params']['id']}})[_0xe36f('0x42')](handleEntityNotFound(_0x1bf2d5,null))[_0xe36f('0x42')](saveUpdates(_0x3099fc[_0xe36f('0x4b')],null))['then'](respondWithResult(_0x1bf2d5,null))[_0xe36f('0x49')](handleError(_0x1bf2d5,null));};exports['destroy']=function(_0x1fa4b1,_0x23299b){return db['SalesforceAccount'][_0xe36f('0x4c')]({'where':{'id':_0x1fa4b1[_0xe36f('0x47')]['id']}})[_0xe36f('0x42')](handleEntityNotFound(_0x23299b,null))[_0xe36f('0x42')](removeEntity(_0x23299b,null))['catch'](handleError(_0x23299b,null));};exports[_0xe36f('0x4d')]=function(_0x493625,_0x5d222e,_0x3884ad){var _0x4f252c={};var _0x3aa38c={};var _0xd69d4a;var _0x2da1c8;return db[_0xe36f('0x40')][_0xe36f('0x4e')]({'where':{'id':_0x493625[_0xe36f('0x47')]['id']}})[_0xe36f('0x42')](handleEntityNotFound(_0x5d222e,null))[_0xe36f('0x42')](function(_0x188b33){if(_0x188b33){_0xd69d4a=_0x188b33;_0x3aa38c[_0xe36f('0x2e')]=_['keys'](db[_0xe36f('0x4f')][_0xe36f('0x2b')]);_0x3aa38c[_0xe36f('0x33')]=_['keys'](_0x493625['query']);_0x3aa38c[_0xe36f('0x3b')]=_[_0xe36f('0x31')](_0x3aa38c[_0xe36f('0x2e')],_0x3aa38c[_0xe36f('0x33')]);_0x4f252c[_0xe36f('0x30')]=_[_0xe36f('0x31')](_0x3aa38c['model'],qs[_0xe36f('0x32')](_0x493625[_0xe36f('0x33')][_0xe36f('0x32')]));_0x4f252c[_0xe36f('0x30')]=_0x4f252c[_0xe36f('0x30')][_0xe36f('0x34')]?_0x4f252c[_0xe36f('0x30')]:_0x3aa38c[_0xe36f('0x2e')];_0x4f252c[_0xe36f('0x38')]=qs[_0xe36f('0x39')](_0x493625[_0xe36f('0x33')][_0xe36f('0x39')]);_0x4f252c[_0xe36f('0x3a')]=qs[_0xe36f('0x3b')](_[_0xe36f('0x3c')](_0x493625['query'],_0x3aa38c[_0xe36f('0x3b')]));if(_0x493625[_0xe36f('0x33')][_0xe36f('0x3e')]){_0x4f252c['where']=_[_0xe36f('0x3f')](_0x4f252c[_0xe36f('0x3a')],{'$or':_[_0xe36f('0x2a')](_0x4f252c[_0xe36f('0x30')],function(_0x5d1d61){var _0x1cea60={};_0x1cea60[_0x5d1d61]={'$like':'%'+_0x493625[_0xe36f('0x33')]['filter']+'%'};return _0x1cea60;})});}_0x4f252c=_['merge']({},_0x4f252c,_0x493625['options']);return _0xd69d4a['getConfigurations'](_0x4f252c);}})[_0xe36f('0x42')](function(_0x169ffa){if(_0x169ffa){_0x2da1c8=_0x169ffa[_0xe36f('0x34')];if(!_0x493625[_0xe36f('0x33')][_0xe36f('0x35')]('nolimit')){_0x4f252c[_0xe36f('0x37')]=qs[_0xe36f('0x37')](_0x493625[_0xe36f('0x33')][_0xe36f('0x37')]);_0x4f252c[_0xe36f('0x1f')]=qs['offset'](_0x493625['query'][_0xe36f('0x1f')]);}return _0xd69d4a[_0xe36f('0x4d')](_0x4f252c);}})[_0xe36f('0x42')](function(_0x312c51){if(_0x312c51){return _0x312c51?{'count':_0x2da1c8,'rows':_0x312c51}:null;}})[_0xe36f('0x42')](respondWithResult(_0x5d222e,null))[_0xe36f('0x49')](handleError(_0x5d222e,null));};exports['addConfiguration']=function(_0x4ca6aa,_0x4adde1,_0x2caaba){if(_0x4ca6aa['body']['id']){delete _0x4ca6aa['body']['id'];}return db[_0xe36f('0x40')][_0xe36f('0x4e')]({'where':{'id':_0x4ca6aa[_0xe36f('0x47')]['id']}})[_0xe36f('0x42')](handleEntityNotFound(_0x4adde1,null))['then'](function(_0x4fbce0){if(_0x4fbce0){_0x4ca6aa['body'][_0xe36f('0x50')]=_0x4fbce0['id'];_0x4ca6aa['body'][_0xe36f('0x51')]=integrations[_0xe36f('0x52')](_0x4ca6aa[_0xe36f('0x4b')][_0xe36f('0x53')],_0x4ca6aa['body'][_0xe36f('0x2d')]);_0x4ca6aa[_0xe36f('0x4b')][_0xe36f('0x54')]=integrations[_0xe36f('0x55')](_0x4ca6aa[_0xe36f('0x4b')][_0xe36f('0x53')],_0x4ca6aa[_0xe36f('0x4b')]['type']);return db['SalesforceConfiguration'][_0xe36f('0x4a')](_0x4ca6aa[_0xe36f('0x4b')],{'include':[{'model':db['SalesforceField'],'as':_0xe36f('0x51')},{'model':db[_0xe36f('0x56')],'as':_0xe36f('0x54')}]});}return null;})[_0xe36f('0x42')](respondWithResult(_0x4adde1,null))[_0xe36f('0x49')](handleError(_0x4adde1,null));};exports[_0xe36f('0x57')]=function(_0x4b7466,_0xd4079,_0x537193){var _0x3b10ef;var _0x1148f7='';var _0x5d0e67='Task';return db[_0xe36f('0x40')][_0xe36f('0x4e')]({'where':{'id':_0x4b7466[_0xe36f('0x47')]['id']},'attributes':['id',_0xe36f('0x58'),'clientId','clientSecret',_0xe36f('0x59'),_0xe36f('0x5a'),_0xe36f('0x5b')]})[_0xe36f('0x42')](handleEntityNotFound(_0xd4079,null))['then'](function(_0x4f2568){if(_0x4f2568){_0x1148f7=_0x4f2568[_0xe36f('0x58')];var _0x10284d=_0x1148f7[_0xe36f('0x5c')](-0x1);if(_0x10284d==='/'){_0x1148f7=_0x1148f7[_0xe36f('0x5d')](0x0,_0x1148f7['lastIndexOf'](_0x10284d));}_0x3b10ef=new jsforce[(_0xe36f('0x5e'))]({'oauth2':{'loginUrl':_0x1148f7,'clientId':_0x4f2568[_0xe36f('0x5f')],'clientSecret':_0x4f2568[_0xe36f('0x60')]}});return _0x3b10ef[_0xe36f('0x61')](_0x4f2568[_0xe36f('0x59')],_0x4f2568['password'][_0xe36f('0x62')](_0x4f2568[_0xe36f('0x5b')]));}})[_0xe36f('0x42')](function(_0x12f1d7){if(_0x12f1d7){if(!_[_0xe36f('0x63')](_0x4b7466[_0xe36f('0x33')][_0xe36f('0x64')])){_0x5d0e67=_0x4b7466[_0xe36f('0x33')]['ticketType'];}return _0x3b10ef[_0xe36f('0x65')](_0x5d0e67)[_0xe36f('0x66')]();}})[_0xe36f('0x42')](function(_0x22dada){var _0x124d2a=[_0xe36f('0x67'),_0xe36f('0x68'),_0xe36f('0x69'),_0xe36f('0x6a'),'Subject',_0xe36f('0x6b')];var _0x1df22c=['string',_0xe36f('0x6c'),'picklist',_0xe36f('0x6d'),_0xe36f('0x6e'),_0xe36f('0x6f'),_0xe36f('0x70')];if(_0x22dada){_[_0xe36f('0x71')](_0x22dada['fields'],function(_0x49e6ff){return _0x124d2a['includes'](_0x49e6ff[_0xe36f('0x27')])||!_0x1df22c[_0xe36f('0x72')](_0x49e6ff['type']);});return{'count':_0x22dada[_0xe36f('0x32')]['length'],'rows':_[_0xe36f('0x2a')](_0x22dada['fields'],function(_0x41ab27){return{'id':_0x41ab27[_0xe36f('0x27')],'name':_0x41ab27[_0xe36f('0x73')],'custom':_0x41ab27[_0xe36f('0x74')],'options':_0x41ab27[_0xe36f('0x75')][_0xe36f('0x34')]>0x0?_[_0xe36f('0x2a')](_0x41ab27['picklistValues'],function(_0x4828f5){return{'name':_0x4828f5['label'],'value':_0x4828f5[_0xe36f('0x76')]};}):_0x41ab27['type']==_0xe36f('0x6d')?[{'name':'True','value':_0xe36f('0x77')},{'name':_0xe36f('0x78'),'value':_0xe36f('0x79')}]:[]};})};}})[_0xe36f('0x42')](respondWithResult(_0xd4079,null))['catch'](function(_0x2850e1){var _0x5eaf2e=_0x4b7466[_0xe36f('0x33')][_0xe36f('0x7a')]?0x1f4:_0x2850e1[_0xe36f('0x7b')]||0x1f4;logger['error'](_0xe36f('0x7c'),_0xe36f('0x57'),_0x5eaf2e,JSON[_0xe36f('0x7d')](_0x2850e1));delete _0x2850e1['name'];if(_0x5eaf2e===0x191){_0x5eaf2e=0x190;}_0xd4079[_0xe36f('0x1c')](_0x5eaf2e)['send'](_0x4b7466['query'][_0xe36f('0x7a')]?{'message':_0xe36f('0x7e'),'statusCode':_0x2850e1[_0xe36f('0x7b')]}:_0x2850e1);});}; \ No newline at end of file +var _0xea72=['custom','label','value','False','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','int','picklist','boolean','email','remove','includes'];(function(_0x2a74a6,_0x10592f){var _0xc2e34a=function(_0x8497c9){while(--_0x8497c9){_0x2a74a6['push'](_0x2a74a6['shift']());}};_0xc2e34a(++_0x10592f);}(_0xea72,0x176));var _0x2ea7=function(_0x2ccaa5,_0x17b72e){_0x2ccaa5=_0x2ccaa5-0x0;var _0x403d6=_0xea72[_0x2ccaa5];return _0x403d6;};'use strict';var emlformat=require(_0x2ea7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2ea7('0x1'));var moment=require(_0x2ea7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2ea7('0x3'));var util=require(_0x2ea7('0x4'));var path=require(_0x2ea7('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2ea7('0x6'));var fs=require('fs');var fs_extra=require(_0x2ea7('0x7'));var _=require(_0x2ea7('0x8'));var squel=require(_0x2ea7('0x9'));var crypto=require(_0x2ea7('0xa'));var jsforce=require(_0x2ea7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2ea7('0xc'));var querystring=require(_0x2ea7('0xd'));var Papa=require(_0x2ea7('0xe'));var Redis=require(_0x2ea7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2ea7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ea7('0x11'));var logger=require(_0x2ea7('0x12'))(_0x2ea7('0x13'));var utils=require('../../config/utils');var config=require(_0x2ea7('0x14'));var licenseUtil=require(_0x2ea7('0x15'));var db=require(_0x2ea7('0x16'))['db'];var integrations=require(_0x2ea7('0x17'));function respondWithStatusCode(_0x2ece92,_0x236d4f){_0x236d4f=_0x236d4f||0xcc;return function(_0x1f08dc){if(_0x1f08dc){return _0x2ece92[_0x2ea7('0x18')](_0x236d4f);}return _0x2ece92[_0x2ea7('0x19')](_0x236d4f)['end']();};}function respondWithResult(_0x393c31,_0x4e2488){_0x4e2488=_0x4e2488||0xc8;return function(_0x3e8e27){if(_0x3e8e27){return _0x393c31[_0x2ea7('0x19')](_0x4e2488)[_0x2ea7('0x1a')](_0x3e8e27);}};}function respondWithFilteredResult(_0x1495ef,_0xcbd7f9){return function(_0x5d3057){if(_0x5d3057){var _0x286305=typeof _0xcbd7f9[_0x2ea7('0x1b')]==='undefined'&&typeof _0xcbd7f9[_0x2ea7('0x1c')]===_0x2ea7('0x1d');var _0xefa8dd=_0x5d3057[_0x2ea7('0x1e')];var _0x4880dd=_0x286305?0x0:_0xcbd7f9['offset'];var _0x249ed9=_0x286305?_0x5d3057[_0x2ea7('0x1e')]:_0xcbd7f9[_0x2ea7('0x1b')]+_0xcbd7f9[_0x2ea7('0x1c')];var _0x486022;if(_0x249ed9>=_0xefa8dd){_0x249ed9=_0xefa8dd;_0x486022=0xc8;}else{_0x486022=0xce;}_0x1495ef['status'](_0x486022);return _0x1495ef[_0x2ea7('0x1f')](_0x2ea7('0x20'),_0x4880dd+'-'+_0x249ed9+'/'+_0xefa8dd)['json'](_0x5d3057);}return null;};}function patchUpdates(_0x1dd758){return function(_0x185d01){try{jsonpatch['apply'](_0x185d01,_0x1dd758,!![]);}catch(_0x74c513){return BPromise[_0x2ea7('0x21')](_0x74c513);}return _0x185d01[_0x2ea7('0x22')]();};}function saveUpdates(_0x209c29,_0x415f4a){return function(_0x512fd6){if(_0x512fd6){return _0x512fd6[_0x2ea7('0x23')](_0x209c29)[_0x2ea7('0x24')](function(_0xaa7346){return _0xaa7346;});}return null;};}function removeEntity(_0x4e0a86,_0x47ece0){return function(_0x247aa1){if(_0x247aa1){return _0x247aa1[_0x2ea7('0x25')]()['then'](function(){_0x4e0a86['status'](0xcc)[_0x2ea7('0x26')]();});}};}function handleEntityNotFound(_0x37b848,_0x46c4a9){return function(_0x561065){if(!_0x561065){_0x37b848[_0x2ea7('0x18')](0x194);}return _0x561065;};}function handleError(_0x2ed599,_0x284414){_0x284414=_0x284414||0x1f4;return function(_0x2aa824){logger[_0x2ea7('0x27')](_0x2aa824[_0x2ea7('0x28')]);if(_0x2aa824[_0x2ea7('0x29')]){delete _0x2aa824[_0x2ea7('0x29')];}_0x2ed599[_0x2ea7('0x19')](_0x284414)[_0x2ea7('0x2a')](_0x2aa824);};}exports[_0x2ea7('0x2b')]=function(_0x17e2f6,_0x230144){var _0x134770={},_0x5794db={},_0x16cdf6={'count':0x0,'rows':[]};var _0x1e7346=_[_0x2ea7('0x2c')](db[_0x2ea7('0x2d')][_0x2ea7('0x2e')],function(_0xe02d8e){return{'name':_0xe02d8e['fieldName'],'type':_0xe02d8e[_0x2ea7('0x2f')]['key']};});_0x5794db[_0x2ea7('0x30')]=_[_0x2ea7('0x2c')](_0x1e7346,_0x2ea7('0x29'));_0x5794db['query']=_['keys'](_0x17e2f6[_0x2ea7('0x31')]);_0x5794db[_0x2ea7('0x32')]=_[_0x2ea7('0x33')](_0x5794db[_0x2ea7('0x30')],_0x5794db[_0x2ea7('0x31')]);_0x134770[_0x2ea7('0x34')]=_[_0x2ea7('0x33')](_0x5794db[_0x2ea7('0x30')],qs[_0x2ea7('0x35')](_0x17e2f6[_0x2ea7('0x31')][_0x2ea7('0x35')]));_0x134770[_0x2ea7('0x34')]=_0x134770[_0x2ea7('0x34')][_0x2ea7('0x36')]?_0x134770[_0x2ea7('0x34')]:_0x5794db[_0x2ea7('0x30')];if(!_0x17e2f6['query'][_0x2ea7('0x37')](_0x2ea7('0x38'))){_0x134770[_0x2ea7('0x1c')]=qs[_0x2ea7('0x1c')](_0x17e2f6[_0x2ea7('0x31')][_0x2ea7('0x1c')]);_0x134770['offset']=qs[_0x2ea7('0x1b')](_0x17e2f6[_0x2ea7('0x31')]['offset']);}_0x134770[_0x2ea7('0x39')]=qs[_0x2ea7('0x3a')](_0x17e2f6[_0x2ea7('0x31')][_0x2ea7('0x3a')]);_0x134770[_0x2ea7('0x3b')]=qs[_0x2ea7('0x32')](_['pick'](_0x17e2f6[_0x2ea7('0x31')],_0x5794db['filters']),_0x1e7346);if(_0x17e2f6[_0x2ea7('0x31')]['filter']){_0x134770[_0x2ea7('0x3b')]=_[_0x2ea7('0x3c')](_0x134770[_0x2ea7('0x3b')],{'$or':_['map'](_0x1e7346,function(_0x1348db){if(_0x1348db['type']!==_0x2ea7('0x3d')){var _0x35b75a={};_0x35b75a[_0x1348db[_0x2ea7('0x29')]]={'$like':'%'+_0x17e2f6[_0x2ea7('0x31')][_0x2ea7('0x3e')]+'%'};return _0x35b75a;}})});}_0x134770=_[_0x2ea7('0x3c')]({},_0x134770,_0x17e2f6[_0x2ea7('0x3f')]);var _0x6fed48={'where':_0x134770[_0x2ea7('0x3b')]};return db[_0x2ea7('0x2d')][_0x2ea7('0x1e')](_0x6fed48)[_0x2ea7('0x24')](function(_0x4e02af){_0x16cdf6[_0x2ea7('0x1e')]=_0x4e02af;if(_0x17e2f6[_0x2ea7('0x31')][_0x2ea7('0x40')]){_0x134770[_0x2ea7('0x41')]=[{'all':!![]}];}return db[_0x2ea7('0x2d')][_0x2ea7('0x42')](_0x134770);})[_0x2ea7('0x24')](function(_0x38a446){_0x16cdf6[_0x2ea7('0x43')]=_0x38a446;return _0x16cdf6;})[_0x2ea7('0x24')](respondWithFilteredResult(_0x230144,_0x134770))['catch'](handleError(_0x230144,null));};exports['show']=function(_0x15159c,_0x59ae84){var _0x5987a8={'raw':![],'where':{'id':_0x15159c[_0x2ea7('0x44')]['id']}},_0x317453={};_0x317453['model']=_[_0x2ea7('0x45')](db[_0x2ea7('0x2d')][_0x2ea7('0x2e')]);_0x317453[_0x2ea7('0x31')]=_[_0x2ea7('0x45')](_0x15159c['query']);_0x317453['filters']=_[_0x2ea7('0x33')](_0x317453[_0x2ea7('0x30')],_0x317453[_0x2ea7('0x31')]);_0x5987a8[_0x2ea7('0x34')]=_[_0x2ea7('0x33')](_0x317453[_0x2ea7('0x30')],qs['fields'](_0x15159c[_0x2ea7('0x31')][_0x2ea7('0x35')]));_0x5987a8['attributes']=_0x5987a8[_0x2ea7('0x34')][_0x2ea7('0x36')]?_0x5987a8['attributes']:_0x317453[_0x2ea7('0x30')];if(_0x15159c[_0x2ea7('0x31')][_0x2ea7('0x40')]){_0x5987a8[_0x2ea7('0x41')]=[{'all':!![]}];}_0x5987a8=_[_0x2ea7('0x3c')]({},_0x5987a8,_0x15159c[_0x2ea7('0x3f')]);return db[_0x2ea7('0x2d')][_0x2ea7('0x46')](_0x5987a8)[_0x2ea7('0x24')](handleEntityNotFound(_0x59ae84,null))[_0x2ea7('0x24')](respondWithResult(_0x59ae84,null))[_0x2ea7('0x47')](handleError(_0x59ae84,null));};exports[_0x2ea7('0x48')]=function(_0x1551e9,_0x1e1a2f){return db[_0x2ea7('0x2d')]['create'](_0x1551e9[_0x2ea7('0x49')],{})[_0x2ea7('0x24')](respondWithResult(_0x1e1a2f,0xc9))[_0x2ea7('0x47')](handleError(_0x1e1a2f,null));};exports[_0x2ea7('0x23')]=function(_0x167cbd,_0x3127f5){if(_0x167cbd[_0x2ea7('0x49')]['id']){delete _0x167cbd[_0x2ea7('0x49')]['id'];}return db[_0x2ea7('0x2d')][_0x2ea7('0x46')]({'where':{'id':_0x167cbd[_0x2ea7('0x44')]['id']}})[_0x2ea7('0x24')](handleEntityNotFound(_0x3127f5,null))[_0x2ea7('0x24')](saveUpdates(_0x167cbd[_0x2ea7('0x49')],null))[_0x2ea7('0x24')](respondWithResult(_0x3127f5,null))['catch'](handleError(_0x3127f5,null));};exports[_0x2ea7('0x25')]=function(_0x1f378,_0x43acad){return db[_0x2ea7('0x2d')][_0x2ea7('0x46')]({'where':{'id':_0x1f378[_0x2ea7('0x44')]['id']}})[_0x2ea7('0x24')](handleEntityNotFound(_0x43acad,null))[_0x2ea7('0x24')](removeEntity(_0x43acad,null))['catch'](handleError(_0x43acad,null));};exports[_0x2ea7('0x4a')]=function(_0x2f6ae7,_0x249cd0,_0x29c034){var _0x19fad8={};var _0x403c5a={};var _0xf70d03;var _0x2772ad;return db[_0x2ea7('0x2d')][_0x2ea7('0x4b')]({'where':{'id':_0x2f6ae7[_0x2ea7('0x44')]['id']}})['then'](handleEntityNotFound(_0x249cd0,null))[_0x2ea7('0x24')](function(_0x331d69){if(_0x331d69){_0xf70d03=_0x331d69;_0x403c5a[_0x2ea7('0x30')]=_[_0x2ea7('0x45')](db[_0x2ea7('0x4c')][_0x2ea7('0x2e')]);_0x403c5a[_0x2ea7('0x31')]=_['keys'](_0x2f6ae7['query']);_0x403c5a[_0x2ea7('0x32')]=_[_0x2ea7('0x33')](_0x403c5a[_0x2ea7('0x30')],_0x403c5a[_0x2ea7('0x31')]);_0x19fad8[_0x2ea7('0x34')]=_[_0x2ea7('0x33')](_0x403c5a['model'],qs[_0x2ea7('0x35')](_0x2f6ae7[_0x2ea7('0x31')][_0x2ea7('0x35')]));_0x19fad8[_0x2ea7('0x34')]=_0x19fad8[_0x2ea7('0x34')][_0x2ea7('0x36')]?_0x19fad8[_0x2ea7('0x34')]:_0x403c5a[_0x2ea7('0x30')];_0x19fad8[_0x2ea7('0x39')]=qs[_0x2ea7('0x3a')](_0x2f6ae7[_0x2ea7('0x31')][_0x2ea7('0x3a')]);_0x19fad8['where']=qs[_0x2ea7('0x32')](_[_0x2ea7('0x4d')](_0x2f6ae7[_0x2ea7('0x31')],_0x403c5a[_0x2ea7('0x32')]));if(_0x2f6ae7[_0x2ea7('0x31')]['filter']){_0x19fad8[_0x2ea7('0x3b')]=_[_0x2ea7('0x3c')](_0x19fad8[_0x2ea7('0x3b')],{'$or':_[_0x2ea7('0x2c')](_0x19fad8[_0x2ea7('0x34')],function(_0x589f35){var _0x2cc155={};_0x2cc155[_0x589f35]={'$like':'%'+_0x2f6ae7[_0x2ea7('0x31')][_0x2ea7('0x3e')]+'%'};return _0x2cc155;})});}_0x19fad8=_[_0x2ea7('0x3c')]({},_0x19fad8,_0x2f6ae7[_0x2ea7('0x3f')]);return _0xf70d03[_0x2ea7('0x4a')](_0x19fad8);}})[_0x2ea7('0x24')](function(_0x30a2ab){if(_0x30a2ab){_0x2772ad=_0x30a2ab['length'];if(!_0x2f6ae7[_0x2ea7('0x31')][_0x2ea7('0x37')](_0x2ea7('0x38'))){_0x19fad8[_0x2ea7('0x1c')]=qs[_0x2ea7('0x1c')](_0x2f6ae7[_0x2ea7('0x31')][_0x2ea7('0x1c')]);_0x19fad8[_0x2ea7('0x1b')]=qs[_0x2ea7('0x1b')](_0x2f6ae7[_0x2ea7('0x31')][_0x2ea7('0x1b')]);}return _0xf70d03['getConfigurations'](_0x19fad8);}})['then'](function(_0x2205e1){if(_0x2205e1){return _0x2205e1?{'count':_0x2772ad,'rows':_0x2205e1}:null;}})[_0x2ea7('0x24')](respondWithResult(_0x249cd0,null))[_0x2ea7('0x47')](handleError(_0x249cd0,null));};exports[_0x2ea7('0x4e')]=function(_0x17a1f7,_0x19771d,_0x52fa2f){if(_0x17a1f7[_0x2ea7('0x49')]['id']){delete _0x17a1f7[_0x2ea7('0x49')]['id'];}return db[_0x2ea7('0x2d')][_0x2ea7('0x4b')]({'where':{'id':_0x17a1f7['params']['id']}})[_0x2ea7('0x24')](handleEntityNotFound(_0x19771d,null))['then'](function(_0x4235c0){if(_0x4235c0){_0x17a1f7[_0x2ea7('0x49')][_0x2ea7('0x4f')]=_0x4235c0['id'];_0x17a1f7[_0x2ea7('0x49')][_0x2ea7('0x50')]=integrations[_0x2ea7('0x51')](_0x17a1f7[_0x2ea7('0x49')][_0x2ea7('0x52')],_0x17a1f7[_0x2ea7('0x49')][_0x2ea7('0x2f')]);_0x17a1f7[_0x2ea7('0x49')][_0x2ea7('0x53')]=integrations[_0x2ea7('0x54')](_0x17a1f7[_0x2ea7('0x49')][_0x2ea7('0x52')],_0x17a1f7['body'][_0x2ea7('0x2f')]);return db['SalesforceConfiguration'][_0x2ea7('0x48')](_0x17a1f7['body'],{'include':[{'model':db[_0x2ea7('0x55')],'as':_0x2ea7('0x50')},{'model':db[_0x2ea7('0x55')],'as':_0x2ea7('0x53')}]});}return null;})[_0x2ea7('0x24')](respondWithResult(_0x19771d,null))['catch'](handleError(_0x19771d,null));};exports[_0x2ea7('0x56')]=function(_0x9d6c3c,_0x43e481,_0x2b12f9){var _0x3516ab;var _0x7f1bd6='';var _0x40ef9d=_0x2ea7('0x57');return db[_0x2ea7('0x2d')][_0x2ea7('0x4b')]({'where':{'id':_0x9d6c3c[_0x2ea7('0x44')]['id']},'attributes':['id',_0x2ea7('0x58'),_0x2ea7('0x59'),_0x2ea7('0x5a'),_0x2ea7('0x5b'),_0x2ea7('0x5c'),_0x2ea7('0x5d')]})[_0x2ea7('0x24')](handleEntityNotFound(_0x43e481,null))[_0x2ea7('0x24')](function(_0x558f1b){if(_0x558f1b){_0x7f1bd6=_0x558f1b[_0x2ea7('0x58')];var _0x2f2ae1=_0x7f1bd6[_0x2ea7('0x5e')](-0x1);if(_0x2f2ae1==='/'){_0x7f1bd6=_0x7f1bd6[_0x2ea7('0x5f')](0x0,_0x7f1bd6[_0x2ea7('0x60')](_0x2f2ae1));}_0x3516ab=new jsforce[(_0x2ea7('0x61'))]({'oauth2':{'loginUrl':_0x7f1bd6,'clientId':_0x558f1b[_0x2ea7('0x59')],'clientSecret':_0x558f1b[_0x2ea7('0x5a')]}});return _0x3516ab[_0x2ea7('0x62')](_0x558f1b[_0x2ea7('0x5b')],_0x558f1b[_0x2ea7('0x5c')][_0x2ea7('0x63')](_0x558f1b['securityToken']));}})[_0x2ea7('0x24')](function(_0x5289bb){if(_0x5289bb){if(!_[_0x2ea7('0x64')](_0x9d6c3c['query'][_0x2ea7('0x65')])){_0x40ef9d=_0x9d6c3c[_0x2ea7('0x31')][_0x2ea7('0x65')];}return _0x3516ab[_0x2ea7('0x66')](_0x40ef9d)[_0x2ea7('0x67')]();}})[_0x2ea7('0x24')](function(_0x1937ca){var _0x1a26c8=['OwnerId',_0x2ea7('0x68'),_0x2ea7('0x69'),_0x2ea7('0x6a'),_0x2ea7('0x6b'),'Description'];var _0x351262=['string',_0x2ea7('0x6c'),_0x2ea7('0x6d'),_0x2ea7('0x6e'),_0x2ea7('0x6f'),'textarea','phone'];if(_0x1937ca){_[_0x2ea7('0x70')](_0x1937ca[_0x2ea7('0x35')],function(_0x40fdb8){return _0x1a26c8[_0x2ea7('0x71')](_0x40fdb8[_0x2ea7('0x29')])||!_0x351262[_0x2ea7('0x71')](_0x40fdb8[_0x2ea7('0x2f')]);});return{'count':_0x1937ca[_0x2ea7('0x35')]['length'],'rows':_['map'](_0x1937ca['fields'],function(_0x5affcf){return{'id':_0x5affcf['name'],'name':_0x5affcf['label'],'custom':_0x5affcf[_0x2ea7('0x72')],'options':_0x5affcf['picklistValues'][_0x2ea7('0x36')]>0x0?_[_0x2ea7('0x2c')](_0x5affcf['picklistValues'],function(_0x10788e){return{'name':_0x10788e[_0x2ea7('0x73')],'value':_0x10788e[_0x2ea7('0x74')]};}):_0x5affcf[_0x2ea7('0x2f')]==_0x2ea7('0x6e')?[{'name':'True','value':'true'},{'name':_0x2ea7('0x75'),'value':_0x2ea7('0x76')}]:[]};})};}})[_0x2ea7('0x24')](respondWithResult(_0x43e481,null))[_0x2ea7('0x47')](function(_0x2b2cb4){var _0x256654=_0x9d6c3c[_0x2ea7('0x31')][_0x2ea7('0x77')]?0x1f4:_0x2b2cb4['statusCode']||0x1f4;logger[_0x2ea7('0x27')](_0x2ea7('0x78'),'getFields',_0x256654,JSON['stringify'](_0x2b2cb4));delete _0x2b2cb4[_0x2ea7('0x29')];if(_0x256654===0x191){_0x256654=0x190;}_0x43e481[_0x2ea7('0x19')](_0x256654)[_0x2ea7('0x2a')](_0x9d6c3c[_0x2ea7('0x31')][_0x2ea7('0x77')]?{'message':_0x2ea7('0x79'),'statusCode':_0x2b2cb4['statusCode']}:_0x2b2cb4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index cb96f22..704a435 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 _0x3fb7=['request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x2c6e96,_0x56ab09){var _0x484f69=function(_0x4a4632){while(--_0x4a4632){_0x2c6e96['push'](_0x2c6e96['shift']());}};_0x484f69(++_0x56ab09);}(_0x3fb7,0x187));var _0x73fb=function(_0x4103e2,_0x3a9f2c){_0x4103e2=_0x4103e2-0x0;var _0x4944dd=_0x3fb7[_0x4103e2];return _0x4944dd;};'use strict';var _=require(_0x73fb('0x0'));var util=require(_0x73fb('0x1'));var logger=require(_0x73fb('0x2'))(_0x73fb('0x3'));var moment=require('moment');var BPromise=require(_0x73fb('0x4'));var rp=require(_0x73fb('0x5'));var fs=require('fs');var path=require(_0x73fb('0x6'));var rimraf=require(_0x73fb('0x7'));var config=require('../../config/environment');var attributes=require(_0x73fb('0x8'));var integrations=require(_0x73fb('0x9'));module['exports']=function(_0x42c90e,_0x557723){return _0x42c90e[_0x73fb('0xa')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ce=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x20620f,_0x37c815){var _0x593a2f=function(_0x25479a){while(--_0x25479a){_0x20620f['push'](_0x20620f['shift']());}};_0x593a2f(++_0x37c815);}(_0xb5ce,0xa1));var _0xeb5c=function(_0x2aad78,_0xcb7113){_0x2aad78=_0x2aad78-0x0;var _0x1638bc=_0xb5ce[_0x2aad78];return _0x1638bc;};'use strict';var _=require(_0xeb5c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeb5c('0x1'));var moment=require(_0xeb5c('0x2'));var BPromise=require('bluebird');var rp=require(_0xeb5c('0x3'));var fs=require('fs');var path=require(_0xeb5c('0x4'));var rimraf=require(_0xeb5c('0x5'));var config=require(_0xeb5c('0x6'));var attributes=require(_0xeb5c('0x7'));var integrations=require(_0xeb5c('0x8'));module[_0xeb5c('0x9')]=function(_0x5560e8,_0x4501c9){return _0x5560e8[_0xeb5c('0xa')](_0xeb5c('0xb'),attributes,{'tableName':_0xeb5c('0xc'),'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 473e636..4f0dbb8 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 _0xc8f2=['http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','attributes','limit','include','map','model','then','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','where','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xc8f2,0xc3));var _0x2c8f=function(_0x270a0a,_0x49b09e){_0x270a0a=_0x270a0a-0x0;var _0xa8c779=_0xc8f2[_0x270a0a];return _0xa8c779;};'use strict';var _=require('lodash');var util=require(_0x2c8f('0x0'));var moment=require(_0x2c8f('0x1'));var BPromise=require('bluebird');var rs=require(_0x2c8f('0x2'));var fs=require('fs');var Redis=require(_0x2c8f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c8f('0x4'));var logger=require('../../config/logger')(_0x2c8f('0x5'));var config=require(_0x2c8f('0x6'));var jayson=require(_0x2c8f('0x7'));var client=jayson[_0x2c8f('0x8')][_0x2c8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ed7c5,_0x10f876,_0x1f7a03){return new BPromise(function(_0x334070,_0x2eb0b3){return client[_0x2c8f('0xa')](_0x5ed7c5,_0x1f7a03)['then'](function(_0x40c840){logger[_0x2c8f('0xb')](_0x2c8f('0xc'),_0x10f876,_0x2c8f('0xd'));logger[_0x2c8f('0xe')](_0x2c8f('0xf'),_0x10f876,'request\x20sent',JSON[_0x2c8f('0x10')](_0x40c840));if(_0x40c840[_0x2c8f('0x11')]){if(_0x40c840['error'][_0x2c8f('0x12')]===0x1f4){logger[_0x2c8f('0x11')](_0x2c8f('0xc'),_0x10f876,_0x40c840[_0x2c8f('0x11')][_0x2c8f('0x13')]);return _0x2eb0b3(_0x40c840[_0x2c8f('0x11')][_0x2c8f('0x13')]);}logger[_0x2c8f('0x11')](_0x2c8f('0xc'),_0x10f876,_0x40c840[_0x2c8f('0x11')][_0x2c8f('0x13')]);return _0x334070(_0x40c840[_0x2c8f('0x11')][_0x2c8f('0x13')]);}else{logger[_0x2c8f('0xb')](_0x2c8f('0xc'),_0x10f876,'request\x20sent');_0x334070(_0x40c840['result'][_0x2c8f('0x13')]);}})[_0x2c8f('0x14')](function(_0x1a1fed){logger[_0x2c8f('0x11')](_0x2c8f('0xc'),_0x10f876,_0x1a1fed);_0x2eb0b3(_0x1a1fed);});});}exports['GetSalesforceAccount']=function(_0x4eefd9){var _0x5bbadd=this;return new Promise(function(_0x837d03,_0x48a6bb){return db['SalesforceAccount']['findAll']({'raw':_0x4eefd9[_0x2c8f('0x15')]?_0x4eefd9[_0x2c8f('0x15')][_0x2c8f('0x16')]===undefined?!![]:![]:!![],'where':_0x4eefd9['options']?_0x4eefd9[_0x2c8f('0x15')]['where']||null:null,'attributes':_0x4eefd9[_0x2c8f('0x15')]?_0x4eefd9[_0x2c8f('0x15')][_0x2c8f('0x17')]||null:null,'limit':_0x4eefd9[_0x2c8f('0x15')]?_0x4eefd9[_0x2c8f('0x15')][_0x2c8f('0x18')]||null:null,'include':_0x4eefd9['options']?_0x4eefd9['options'][_0x2c8f('0x19')]?_[_0x2c8f('0x1a')](_0x4eefd9['options'][_0x2c8f('0x19')],function(_0x2b83e1){return{'model':db[_0x2b83e1[_0x2c8f('0x1b')]],'as':_0x2b83e1['as'],'attributes':_0x2b83e1['attributes'],'include':_0x2b83e1[_0x2c8f('0x19')]?_['map'](_0x2b83e1[_0x2c8f('0x19')],function(_0x106737){return{'model':db[_0x106737[_0x2c8f('0x1b')]],'as':_0x106737['as'],'attributes':_0x106737['attributes'],'include':_0x106737['include']?_[_0x2c8f('0x1a')](_0x106737['include'],function(_0x40af6e){return{'model':db[_0x40af6e['model']],'as':_0x40af6e['as'],'attributes':_0x40af6e['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c8f('0x1c')](function(_0x92f7fd){logger[_0x2c8f('0xb')](_0x2c8f('0x1d'),_0x4eefd9);logger['debug'](_0x2c8f('0x1d'),_0x4eefd9,JSON[_0x2c8f('0x10')](_0x92f7fd));_0x837d03(_0x92f7fd);})['catch'](function(_0x20cf99){logger[_0x2c8f('0x11')](_0x2c8f('0x1d'),_0x20cf99['message'],_0x4eefd9);_0x48a6bb(_0x5bbadd[_0x2c8f('0x11')](0x1f4,_0x20cf99['message']));});});};exports[_0x2c8f('0x1e')]=function(_0x3de2ab){var _0x28656b=this;return new Promise(function(_0x16ab0a,_0x793710){return db[_0x2c8f('0x1f')][_0x2c8f('0x20')]({'raw':_0x3de2ab[_0x2c8f('0x15')]?_0x3de2ab[_0x2c8f('0x15')][_0x2c8f('0x16')]===undefined?!![]:![]:!![],'where':_0x3de2ab[_0x2c8f('0x15')]?_0x3de2ab[_0x2c8f('0x15')][_0x2c8f('0x21')]||null:null,'attributes':_0x3de2ab[_0x2c8f('0x15')]?_0x3de2ab['options']['attributes']||null:null,'include':_0x3de2ab[_0x2c8f('0x15')]?_0x3de2ab[_0x2c8f('0x15')]['include']?_[_0x2c8f('0x1a')](_0x3de2ab[_0x2c8f('0x15')]['include'],function(_0x44c3d0){return{'model':db[_0x44c3d0[_0x2c8f('0x1b')]],'as':_0x44c3d0['as'],'attributes':_0x44c3d0['attributes'],'include':_0x44c3d0['include']?_['map'](_0x44c3d0[_0x2c8f('0x19')],function(_0x482365){return{'model':db[_0x482365[_0x2c8f('0x1b')]],'as':_0x482365['as'],'attributes':_0x482365['attributes'],'include':_0x482365[_0x2c8f('0x19')]?_[_0x2c8f('0x1a')](_0x482365[_0x2c8f('0x19')],function(_0x151712){return{'model':db[_0x151712['model']],'as':_0x151712['as'],'attributes':_0x151712[_0x2c8f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2c8f('0x1c')](function(_0x3eb3c3){logger[_0x2c8f('0xb')](_0x2c8f('0x1e'),_0x3de2ab);logger[_0x2c8f('0xe')](_0x2c8f('0x1e'),_0x3de2ab,JSON[_0x2c8f('0x10')](_0x3eb3c3));_0x16ab0a(_0x3eb3c3);})[_0x2c8f('0x14')](function(_0x2fd3bf){logger['error'](_0x2c8f('0x1e'),_0x2fd3bf[_0x2c8f('0x13')],_0x3de2ab);_0x793710(_0x28656b[_0x2c8f('0x11')](0x1f4,_0x2fd3bf[_0x2c8f('0x13')]));});});}; \ No newline at end of file +var _0x3bad=['request\x20sent','stringify','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','then','find','where','debug','ShowSalesforceAccount','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s'];(function(_0x36ca6e,_0x1bcabc){var _0x1e774c=function(_0x59930b){while(--_0x59930b){_0x36ca6e['push'](_0x36ca6e['shift']());}};_0x1e774c(++_0x1bcabc);}(_0x3bad,0x174));var _0xd3ba=function(_0x46a824,_0x2c35c9){_0x46a824=_0x46a824-0x0;var _0x25a2f6=_0x3bad[_0x46a824];return _0x25a2f6;};'use strict';var _=require(_0xd3ba('0x0'));var util=require(_0xd3ba('0x1'));var moment=require(_0xd3ba('0x2'));var BPromise=require(_0xd3ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3ba('0x4'))['db'];var utils=require(_0xd3ba('0x5'));var logger=require('../../config/logger')(_0xd3ba('0x6'));var config=require(_0xd3ba('0x7'));var jayson=require(_0xd3ba('0x8'));var client=jayson[_0xd3ba('0x9')][_0xd3ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bc097,_0x394263,_0x8a07c0){return new BPromise(function(_0x451e86,_0x711140){return client[_0xd3ba('0xb')](_0x4bc097,_0x8a07c0)['then'](function(_0x1d44c5){logger['info'](_0xd3ba('0xc'),_0x394263,_0xd3ba('0xd'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x394263,'request\x20sent',JSON[_0xd3ba('0xe')](_0x1d44c5));if(_0x1d44c5[_0xd3ba('0xf')]){if(_0x1d44c5[_0xd3ba('0xf')][_0xd3ba('0x10')]===0x1f4){logger['error'](_0xd3ba('0xc'),_0x394263,_0x1d44c5[_0xd3ba('0xf')][_0xd3ba('0x11')]);return _0x711140(_0x1d44c5['error'][_0xd3ba('0x11')]);}logger[_0xd3ba('0xf')](_0xd3ba('0xc'),_0x394263,_0x1d44c5[_0xd3ba('0xf')][_0xd3ba('0x11')]);return _0x451e86(_0x1d44c5[_0xd3ba('0xf')]['message']);}else{logger[_0xd3ba('0x12')](_0xd3ba('0xc'),_0x394263,_0xd3ba('0xd'));_0x451e86(_0x1d44c5[_0xd3ba('0x13')][_0xd3ba('0x11')]);}})['catch'](function(_0x4fbbc1){logger[_0xd3ba('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x394263,_0x4fbbc1);_0x711140(_0x4fbbc1);});});}exports[_0xd3ba('0x14')]=function(_0x30dbd8){var _0x56132b=this;return new Promise(function(_0x2bbda6,_0x4078a4){return db[_0xd3ba('0x15')]['findAll']({'raw':_0x30dbd8[_0xd3ba('0x16')]?_0x30dbd8[_0xd3ba('0x16')][_0xd3ba('0x17')]===undefined?!![]:![]:!![],'where':_0x30dbd8[_0xd3ba('0x16')]?_0x30dbd8['options']['where']||null:null,'attributes':_0x30dbd8['options']?_0x30dbd8[_0xd3ba('0x16')][_0xd3ba('0x18')]||null:null,'limit':_0x30dbd8[_0xd3ba('0x16')]?_0x30dbd8[_0xd3ba('0x16')][_0xd3ba('0x19')]||null:null,'include':_0x30dbd8[_0xd3ba('0x16')]?_0x30dbd8['options'][_0xd3ba('0x1a')]?_[_0xd3ba('0x1b')](_0x30dbd8[_0xd3ba('0x16')][_0xd3ba('0x1a')],function(_0x3574cd){return{'model':db[_0x3574cd['model']],'as':_0x3574cd['as'],'attributes':_0x3574cd[_0xd3ba('0x18')],'include':_0x3574cd['include']?_[_0xd3ba('0x1b')](_0x3574cd[_0xd3ba('0x1a')],function(_0x4fb6e5){return{'model':db[_0x4fb6e5[_0xd3ba('0x1c')]],'as':_0x4fb6e5['as'],'attributes':_0x4fb6e5['attributes'],'include':_0x4fb6e5[_0xd3ba('0x1a')]?_[_0xd3ba('0x1b')](_0x4fb6e5[_0xd3ba('0x1a')],function(_0x4c17dd){return{'model':db[_0x4c17dd['model']],'as':_0x4c17dd['as'],'attributes':_0x4c17dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3ba('0x1d')](function(_0x66d1f7){logger[_0xd3ba('0x12')]('GetSalesforceAccount',_0x30dbd8);logger['debug'](_0xd3ba('0x14'),_0x30dbd8,JSON[_0xd3ba('0xe')](_0x66d1f7));_0x2bbda6(_0x66d1f7);})['catch'](function(_0x54dce3){logger[_0xd3ba('0xf')]('GetSalesforceAccount',_0x54dce3[_0xd3ba('0x11')],_0x30dbd8);_0x4078a4(_0x56132b[_0xd3ba('0xf')](0x1f4,_0x54dce3[_0xd3ba('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x2cb363){var _0x58f3c4=this;return new Promise(function(_0x5bd544,_0x39a4cb){return db[_0xd3ba('0x15')][_0xd3ba('0x1e')]({'raw':_0x2cb363[_0xd3ba('0x16')]?_0x2cb363[_0xd3ba('0x16')][_0xd3ba('0x17')]===undefined?!![]:![]:!![],'where':_0x2cb363[_0xd3ba('0x16')]?_0x2cb363['options'][_0xd3ba('0x1f')]||null:null,'attributes':_0x2cb363['options']?_0x2cb363[_0xd3ba('0x16')]['attributes']||null:null,'include':_0x2cb363[_0xd3ba('0x16')]?_0x2cb363[_0xd3ba('0x16')][_0xd3ba('0x1a')]?_[_0xd3ba('0x1b')](_0x2cb363[_0xd3ba('0x16')][_0xd3ba('0x1a')],function(_0x496d33){return{'model':db[_0x496d33[_0xd3ba('0x1c')]],'as':_0x496d33['as'],'attributes':_0x496d33[_0xd3ba('0x18')],'include':_0x496d33[_0xd3ba('0x1a')]?_['map'](_0x496d33[_0xd3ba('0x1a')],function(_0x1405a9){return{'model':db[_0x1405a9['model']],'as':_0x1405a9['as'],'attributes':_0x1405a9[_0xd3ba('0x18')],'include':_0x1405a9[_0xd3ba('0x1a')]?_[_0xd3ba('0x1b')](_0x1405a9[_0xd3ba('0x1a')],function(_0x166c10){return{'model':db[_0x166c10['model']],'as':_0x166c10['as'],'attributes':_0x166c10[_0xd3ba('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd3ba('0x1d')](function(_0x1ed29b){logger[_0xd3ba('0x12')]('ShowSalesforceAccount',_0x2cb363);logger[_0xd3ba('0x20')](_0xd3ba('0x21'),_0x2cb363,JSON[_0xd3ba('0xe')](_0x1ed29b));_0x5bd544(_0x1ed29b);})[_0xd3ba('0x22')](function(_0x2c2a83){logger[_0xd3ba('0xf')]('ShowSalesforceAccount',_0x2c2a83['message'],_0x2cb363);_0x39a4cb(_0x58f3c4[_0xd3ba('0xf')](0x1f4,_0x2c2a83['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ec3d732..25592d9 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x5da84c,_0x288db7){var _0xd41b86=function(_0x3063fa){while(--_0x3063fa){_0x5da84c['push'](_0x5da84c['shift']());}};_0xd41b86(++_0x288db7);}(_0x7a54,0x106));var _0x47a5=function(_0x5c45d3,_0x4d366f){_0x5c45d3=_0x5c45d3-0x0;var _0x41526c=_0x7a54[_0x5c45d3];return _0x41526c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2343d9,_0x2ca574){var _0x23ea8c=function(_0x1a95f7){while(--_0x1a95f7){_0x2343d9['push'](_0x2343d9['shift']());}};_0x23ea8c(++_0x2ca574);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 74459d1..d032638 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 _0x4c29=['nothing','account','STRING','exports','Task','ENUM','contact_lead','contact','account_contact_lead'];(function(_0x7272f9,_0xf117cf){var _0x28434d=function(_0x3cb228){while(--_0x3cb228){_0x7272f9['push'](_0x7272f9['shift']());}};_0x28434d(++_0xf117cf);}(_0x4c29,0x9c));var _0x94c2=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4c29[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require('sequelize');module[_0x94c2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task','Case'),'defaultValue':_0x94c2('0x1')},'moduleSearch':{'type':Sequelize[_0x94c2('0x2')](_0x94c2('0x3'),_0x94c2('0x4'),'lead',_0x94c2('0x5'),'account'),'defaultValue':_0x94c2('0x3')},'moduleCreate':{'type':Sequelize[_0x94c2('0x2')](_0x94c2('0x6'),_0x94c2('0x4'),'lead',_0x94c2('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x94c2('0x8')]},'additionalSearchAccount':{'type':Sequelize[_0x94c2('0x8')]},'additionalSearchContact':{'type':Sequelize[_0x94c2('0x8')]},'additionalSearchLead':{'type':Sequelize[_0x94c2('0x8')]}}; \ No newline at end of file +var _0xe005=['account_contact_lead','account','ENUM','lead','sequelize','exports','STRING','Task','Case','contact_lead','contact'];(function(_0x231cd2,_0x19fc12){var _0x2a9683=function(_0x2cc020){while(--_0x2cc020){_0x231cd2['push'](_0x231cd2['shift']());}};_0x2a9683(++_0x19fc12);}(_0xe005,0x17a));var _0x5e00=function(_0x3b2377,_0x3aaab3){_0x3b2377=_0x3b2377-0x0;var _0x9f289c=_0xe005[_0x3b2377];return _0x9f289c;};'use strict';var Sequelize=require(_0x5e00('0x0'));module[_0x5e00('0x1')]={'name':{'type':Sequelize[_0x5e00('0x2')]},'description':{'type':Sequelize[_0x5e00('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x5e00('0x3'),_0x5e00('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x5e00('0x5'),_0x5e00('0x6'),'lead',_0x5e00('0x7'),_0x5e00('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x5e00('0x9')]('nothing',_0x5e00('0x6'),'lead',_0x5e00('0x8')),'defaultValue':_0x5e00('0xa')},'leadId':{'type':Sequelize[_0x5e00('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x5e00('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x5e00('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 34386ef..a7285be 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 _0x5de0=['where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','findOne','SalesforceField','options','getFields','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3d4686,_0x141b92){var _0x355745=function(_0x486d60){while(--_0x486d60){_0x3d4686['push'](_0x3d4686['shift']());}};_0x355745(++_0x141b92);}(_0x5de0,0xb7));var _0x05de=function(_0x3863fb,_0x488521){_0x3863fb=_0x3863fb-0x0;var _0x572004=_0x5de0[_0x3863fb];return _0x572004;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05de('0x0'));var rp=require(_0x05de('0x1'));var moment=require(_0x05de('0x2'));var BPromise=require(_0x05de('0x3'));var Mustache=require(_0x05de('0x4'));var util=require(_0x05de('0x5'));var path=require(_0x05de('0x6'));var sox=require(_0x05de('0x7'));var csv=require('to-csv');var ejs=require(_0x05de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05de('0x9'));var squel=require(_0x05de('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x05de('0xb'));var toCsv=require(_0x05de('0xc'));var querystring=require(_0x05de('0xd'));var Papa=require(_0x05de('0xe'));var Redis=require('ioredis');var authService=require(_0x05de('0xf'));var qs=require(_0x05de('0x10'));var as=require(_0x05de('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05de('0x12'))(_0x05de('0x13'));var utils=require('../../config/utils');var config=require(_0x05de('0x14'));var licenseUtil=require(_0x05de('0x15'));var db=require(_0x05de('0x16'))['db'];function respondWithStatusCode(_0x26c75a,_0x14480f){_0x14480f=_0x14480f||0xcc;return function(_0x4392e1){if(_0x4392e1){return _0x26c75a[_0x05de('0x17')](_0x14480f);}return _0x26c75a['status'](_0x14480f)[_0x05de('0x18')]();};}function respondWithResult(_0x5709a2,_0x149321){_0x149321=_0x149321||0xc8;return function(_0x2479c3){if(_0x2479c3){return _0x5709a2[_0x05de('0x19')](_0x149321)['json'](_0x2479c3);}};}function respondWithFilteredResult(_0x37a240,_0x51affe){return function(_0x4fe93e){if(_0x4fe93e){var _0xfb6301=typeof _0x51affe['offset']===_0x05de('0x1a')&&typeof _0x51affe['limit']===_0x05de('0x1a');var _0x3352dc=_0x4fe93e[_0x05de('0x1b')];var _0x47ca94=_0xfb6301?0x0:_0x51affe['offset'];var _0x36b814=_0xfb6301?_0x4fe93e['count']:_0x51affe[_0x05de('0x1c')]+_0x51affe[_0x05de('0x1d')];var _0x379bb7;if(_0x36b814>=_0x3352dc){_0x36b814=_0x3352dc;_0x379bb7=0xc8;}else{_0x379bb7=0xce;}_0x37a240[_0x05de('0x19')](_0x379bb7);return _0x37a240['set']('Content-Range',_0x47ca94+'-'+_0x36b814+'/'+_0x3352dc)[_0x05de('0x1e')](_0x4fe93e);}return null;};}function patchUpdates(_0x47107e){return function(_0x544e98){try{jsonpatch[_0x05de('0x1f')](_0x544e98,_0x47107e,!![]);}catch(_0x3d7d5c){return BPromise[_0x05de('0x20')](_0x3d7d5c);}return _0x544e98[_0x05de('0x21')]();};}function saveUpdates(_0xcd1f8c,_0x3721dc){return function(_0x5eca89){if(_0x5eca89){return _0x5eca89[_0x05de('0x22')](_0xcd1f8c)[_0x05de('0x23')](function(_0xfe9f69){return _0xfe9f69;});}return null;};}function removeEntity(_0x28bc20,_0x264515){return function(_0x180e9b){if(_0x180e9b){return _0x180e9b[_0x05de('0x24')]()['then'](function(){_0x28bc20[_0x05de('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d4e0,_0x1e0a12){return function(_0x2bc575){if(!_0x2bc575){_0x48d4e0[_0x05de('0x17')](0x194);}return _0x2bc575;};}function handleError(_0x3b8769,_0x3fe4dd){_0x3fe4dd=_0x3fe4dd||0x1f4;return function(_0x497cea){logger[_0x05de('0x25')](_0x497cea[_0x05de('0x26')]);if(_0x497cea[_0x05de('0x27')]){delete _0x497cea[_0x05de('0x27')];}_0x3b8769[_0x05de('0x19')](_0x3fe4dd)[_0x05de('0x28')](_0x497cea);};}exports[_0x05de('0x29')]=function(_0x202a38,_0x292ab4){var _0x155254={},_0x43469f={},_0x2089d7={'count':0x0,'rows':[]};var _0x285472=_['map'](db[_0x05de('0x2a')][_0x05de('0x2b')],function(_0x1105f8){return{'name':_0x1105f8['fieldName'],'type':_0x1105f8[_0x05de('0x2c')][_0x05de('0x2d')]};});_0x43469f[_0x05de('0x2e')]=_[_0x05de('0x2f')](_0x285472,_0x05de('0x27'));_0x43469f[_0x05de('0x30')]=_['keys'](_0x202a38['query']);_0x43469f['filters']=_['intersection'](_0x43469f['model'],_0x43469f[_0x05de('0x30')]);_0x155254[_0x05de('0x31')]=_[_0x05de('0x32')](_0x43469f[_0x05de('0x2e')],qs[_0x05de('0x33')](_0x202a38[_0x05de('0x30')][_0x05de('0x33')]));_0x155254[_0x05de('0x31')]=_0x155254[_0x05de('0x31')][_0x05de('0x34')]?_0x155254[_0x05de('0x31')]:_0x43469f[_0x05de('0x2e')];if(!_0x202a38[_0x05de('0x30')][_0x05de('0x35')](_0x05de('0x36'))){_0x155254[_0x05de('0x1d')]=qs['limit'](_0x202a38['query']['limit']);_0x155254[_0x05de('0x1c')]=qs[_0x05de('0x1c')](_0x202a38[_0x05de('0x30')][_0x05de('0x1c')]);}_0x155254[_0x05de('0x37')]=qs[_0x05de('0x38')](_0x202a38[_0x05de('0x30')][_0x05de('0x38')]);_0x155254[_0x05de('0x39')]=qs[_0x05de('0x3a')](_[_0x05de('0x3b')](_0x202a38[_0x05de('0x30')],_0x43469f[_0x05de('0x3a')]),_0x285472);if(_0x202a38['query'][_0x05de('0x3c')]){_0x155254['where']=_[_0x05de('0x3d')](_0x155254[_0x05de('0x39')],{'$or':_[_0x05de('0x2f')](_0x285472,function(_0x18b7e5){if(_0x18b7e5['type']!==_0x05de('0x3e')){var _0x658713={};_0x658713[_0x18b7e5[_0x05de('0x27')]]={'$like':'%'+_0x202a38[_0x05de('0x30')][_0x05de('0x3c')]+'%'};return _0x658713;}})});}_0x155254=_[_0x05de('0x3d')]({},_0x155254,_0x202a38['options']);var _0x4c1bd1={'where':_0x155254[_0x05de('0x39')]};return db[_0x05de('0x2a')][_0x05de('0x1b')](_0x4c1bd1)[_0x05de('0x23')](function(_0x201f76){_0x2089d7[_0x05de('0x1b')]=_0x201f76;if(_0x202a38['query'][_0x05de('0x3f')]){_0x155254[_0x05de('0x40')]=[{'all':!![]}];}return db[_0x05de('0x2a')][_0x05de('0x41')](_0x155254);})['then'](function(_0x2c805e){_0x2089d7[_0x05de('0x42')]=_0x2c805e;return _0x2089d7;})[_0x05de('0x23')](respondWithFilteredResult(_0x292ab4,_0x155254))[_0x05de('0x43')](handleError(_0x292ab4,null));};exports[_0x05de('0x44')]=function(_0x1f285d,_0x22585b){var _0x142e87={'raw':![],'where':{'id':_0x1f285d['params']['id']}},_0x23c92a={};_0x23c92a[_0x05de('0x2e')]=_[_0x05de('0x45')](db[_0x05de('0x2a')]['rawAttributes']);_0x23c92a[_0x05de('0x30')]=_['keys'](_0x1f285d['query']);_0x23c92a['filters']=_[_0x05de('0x32')](_0x23c92a[_0x05de('0x2e')],_0x23c92a[_0x05de('0x30')]);_0x142e87['attributes']=_[_0x05de('0x32')](_0x23c92a['model'],qs[_0x05de('0x33')](_0x1f285d[_0x05de('0x30')]['fields']));_0x142e87[_0x05de('0x31')]=_0x142e87[_0x05de('0x31')]['length']?_0x142e87[_0x05de('0x31')]:_0x23c92a[_0x05de('0x2e')];if(_0x1f285d[_0x05de('0x30')][_0x05de('0x3f')]){_0x142e87[_0x05de('0x40')]=[{'all':!![]}];}_0x142e87=_[_0x05de('0x3d')]({},_0x142e87,_0x1f285d['options']);return db[_0x05de('0x2a')][_0x05de('0x46')](_0x142e87)['then'](handleEntityNotFound(_0x22585b,null))[_0x05de('0x23')](respondWithResult(_0x22585b,null))[_0x05de('0x43')](handleError(_0x22585b,null));};exports[_0x05de('0x47')]=function(_0x3b6e26,_0x379426){return db[_0x05de('0x2a')][_0x05de('0x47')](_0x3b6e26[_0x05de('0x48')],{})['then'](respondWithResult(_0x379426,0xc9))['catch'](handleError(_0x379426,null));};exports[_0x05de('0x22')]=function(_0x310658,_0x2ece10){if(_0x310658['body']['id']){delete _0x310658[_0x05de('0x48')]['id'];}return db[_0x05de('0x2a')][_0x05de('0x46')]({'where':{'id':_0x310658[_0x05de('0x49')]['id']}})[_0x05de('0x23')](handleEntityNotFound(_0x2ece10,null))['then'](saveUpdates(_0x310658[_0x05de('0x48')],null))[_0x05de('0x23')](respondWithResult(_0x2ece10,null))[_0x05de('0x43')](handleError(_0x2ece10,null));};exports[_0x05de('0x24')]=function(_0xd6e20f,_0x23ed1b){return db[_0x05de('0x2a')][_0x05de('0x46')]({'where':{'id':_0xd6e20f['params']['id']}})['then'](handleEntityNotFound(_0x23ed1b,null))[_0x05de('0x23')](removeEntity(_0x23ed1b,null))[_0x05de('0x43')](handleError(_0x23ed1b,null));};exports['getFields']=function(_0xc405d5,_0x28eb9b,_0x2352ac){var _0x258ec0={};var _0x5e626e={};var _0x519d4e;var _0x2a61d3;return db[_0x05de('0x2a')][_0x05de('0x4a')]({'where':{'id':_0xc405d5[_0x05de('0x49')]['id']}})['then'](handleEntityNotFound(_0x28eb9b,null))['then'](function(_0x399f56){if(_0x399f56){_0x519d4e=_0x399f56;_0x5e626e[_0x05de('0x2e')]=_[_0x05de('0x45')](db[_0x05de('0x4b')][_0x05de('0x2b')]);_0x5e626e[_0x05de('0x30')]=_[_0x05de('0x45')](_0xc405d5[_0x05de('0x30')]);_0x5e626e[_0x05de('0x3a')]=_[_0x05de('0x32')](_0x5e626e[_0x05de('0x2e')],_0x5e626e['query']);_0x258ec0[_0x05de('0x31')]=_[_0x05de('0x32')](_0x5e626e[_0x05de('0x2e')],qs[_0x05de('0x33')](_0xc405d5['query'][_0x05de('0x33')]));_0x258ec0[_0x05de('0x31')]=_0x258ec0[_0x05de('0x31')][_0x05de('0x34')]?_0x258ec0['attributes']:_0x5e626e[_0x05de('0x2e')];_0x258ec0['order']=qs[_0x05de('0x38')](_0xc405d5['query'][_0x05de('0x38')]);_0x258ec0[_0x05de('0x39')]=qs[_0x05de('0x3a')](_[_0x05de('0x3b')](_0xc405d5[_0x05de('0x30')],_0x5e626e[_0x05de('0x3a')]));if(_0xc405d5[_0x05de('0x30')][_0x05de('0x3c')]){_0x258ec0[_0x05de('0x39')]=_['merge'](_0x258ec0[_0x05de('0x39')],{'$or':_['map'](_0x258ec0[_0x05de('0x31')],function(_0x314eab){var _0x55c570={};_0x55c570[_0x314eab]={'$like':'%'+_0xc405d5['query'][_0x05de('0x3c')]+'%'};return _0x55c570;})});}_0x258ec0=_[_0x05de('0x3d')]({},_0x258ec0,_0xc405d5[_0x05de('0x4c')]);return _0x519d4e[_0x05de('0x4d')](_0x258ec0);}})[_0x05de('0x23')](function(_0x252938){if(_0x252938){_0x2a61d3=_0x252938['length'];if(!_0xc405d5[_0x05de('0x30')][_0x05de('0x35')](_0x05de('0x36'))){_0x258ec0['limit']=qs[_0x05de('0x1d')](_0xc405d5['query'][_0x05de('0x1d')]);_0x258ec0[_0x05de('0x1c')]=qs['offset'](_0xc405d5[_0x05de('0x30')][_0x05de('0x1c')]);}return _0x519d4e[_0x05de('0x4d')](_0x258ec0);}})[_0x05de('0x23')](function(_0x2e29ea){if(_0x2e29ea){return _0x2e29ea?{'count':_0x2a61d3,'rows':_0x2e29ea}:null;}})[_0x05de('0x23')](respondWithResult(_0x28eb9b,null))[_0x05de('0x43')](handleError(_0x28eb9b,null));};exports[_0x05de('0x4e')]=function(_0x1aa636,_0x423fda,_0x3542ff){var _0x5c0e05={};var _0x5e0b78={};var _0x5eb922;var _0x101eb0;return db[_0x05de('0x2a')][_0x05de('0x4a')]({'where':{'id':_0x1aa636[_0x05de('0x49')]['id']}})['then'](handleEntityNotFound(_0x423fda,null))['then'](function(_0x449bae){if(_0x449bae){_0x5eb922=_0x449bae;_0x5e0b78[_0x05de('0x2e')]=_[_0x05de('0x45')](db[_0x05de('0x4b')][_0x05de('0x2b')]);_0x5e0b78['query']=_['keys'](_0x1aa636['query']);_0x5e0b78[_0x05de('0x3a')]=_[_0x05de('0x32')](_0x5e0b78['model'],_0x5e0b78[_0x05de('0x30')]);_0x5c0e05['attributes']=_[_0x05de('0x32')](_0x5e0b78[_0x05de('0x2e')],qs[_0x05de('0x33')](_0x1aa636['query'][_0x05de('0x33')]));_0x5c0e05['attributes']=_0x5c0e05[_0x05de('0x31')][_0x05de('0x34')]?_0x5c0e05['attributes']:_0x5e0b78['model'];_0x5c0e05[_0x05de('0x37')]=qs[_0x05de('0x38')](_0x1aa636[_0x05de('0x30')][_0x05de('0x38')]);_0x5c0e05[_0x05de('0x39')]=qs[_0x05de('0x3a')](_[_0x05de('0x3b')](_0x1aa636[_0x05de('0x30')],_0x5e0b78[_0x05de('0x3a')]));if(_0x1aa636[_0x05de('0x30')][_0x05de('0x3c')]){_0x5c0e05[_0x05de('0x39')]=_['merge'](_0x5c0e05[_0x05de('0x39')],{'$or':_['map'](_0x5c0e05[_0x05de('0x31')],function(_0x16a272){var _0x1f2db7={};_0x1f2db7[_0x16a272]={'$like':'%'+_0x1aa636[_0x05de('0x30')]['filter']+'%'};return _0x1f2db7;})});}_0x5c0e05=_['merge']({},_0x5c0e05,_0x1aa636['options']);return _0x5eb922[_0x05de('0x4e')](_0x5c0e05);}})[_0x05de('0x23')](function(_0x125341){if(_0x125341){_0x101eb0=_0x125341[_0x05de('0x34')];if(!_0x1aa636[_0x05de('0x30')][_0x05de('0x35')]('nolimit')){_0x5c0e05[_0x05de('0x1d')]=qs[_0x05de('0x1d')](_0x1aa636[_0x05de('0x30')][_0x05de('0x1d')]);_0x5c0e05[_0x05de('0x1c')]=qs['offset'](_0x1aa636[_0x05de('0x30')][_0x05de('0x1c')]);}return _0x5eb922[_0x05de('0x4e')](_0x5c0e05);}})[_0x05de('0x23')](function(_0x2701b4){if(_0x2701b4){return _0x2701b4?{'count':_0x101eb0,'rows':_0x2701b4}:null;}})[_0x05de('0x23')](respondWithResult(_0x423fda,null))[_0x05de('0x43')](handleError(_0x423fda,null));};exports[_0x05de('0x4f')]=function(_0x4059bf,_0xe65008,_0x552f14){var _0x302b9d={};var _0x16b70f={};var _0x309caf;var _0x2abef8;return db[_0x05de('0x2a')]['findOne']({'where':{'id':_0x4059bf[_0x05de('0x49')]['id']}})['then'](handleEntityNotFound(_0xe65008,null))[_0x05de('0x23')](function(_0xf79929){if(_0xf79929){_0x309caf=_0xf79929;_0x16b70f[_0x05de('0x2e')]=_['keys'](db['SalesforceField'][_0x05de('0x2b')]);_0x16b70f[_0x05de('0x30')]=_[_0x05de('0x45')](_0x4059bf[_0x05de('0x30')]);_0x16b70f['filters']=_['intersection'](_0x16b70f['model'],_0x16b70f[_0x05de('0x30')]);_0x302b9d['attributes']=_[_0x05de('0x32')](_0x16b70f[_0x05de('0x2e')],qs['fields'](_0x4059bf[_0x05de('0x30')][_0x05de('0x33')]));_0x302b9d['attributes']=_0x302b9d[_0x05de('0x31')]['length']?_0x302b9d['attributes']:_0x16b70f[_0x05de('0x2e')];_0x302b9d[_0x05de('0x37')]=qs['sort'](_0x4059bf[_0x05de('0x30')][_0x05de('0x38')]);_0x302b9d['where']=qs[_0x05de('0x3a')](_['pick'](_0x4059bf['query'],_0x16b70f[_0x05de('0x3a')]));if(_0x4059bf[_0x05de('0x30')][_0x05de('0x3c')]){_0x302b9d[_0x05de('0x39')]=_[_0x05de('0x3d')](_0x302b9d[_0x05de('0x39')],{'$or':_[_0x05de('0x2f')](_0x302b9d[_0x05de('0x31')],function(_0x3691dd){var _0x43a2c5={};_0x43a2c5[_0x3691dd]={'$like':'%'+_0x4059bf[_0x05de('0x30')][_0x05de('0x3c')]+'%'};return _0x43a2c5;})});}_0x302b9d=_['merge']({},_0x302b9d,_0x4059bf['options']);return _0x309caf['getDescriptions'](_0x302b9d);}})['then'](function(_0x595a85){if(_0x595a85){_0x2abef8=_0x595a85[_0x05de('0x34')];if(!_0x4059bf[_0x05de('0x30')][_0x05de('0x35')](_0x05de('0x36'))){_0x302b9d[_0x05de('0x1d')]=qs['limit'](_0x4059bf[_0x05de('0x30')][_0x05de('0x1d')]);_0x302b9d[_0x05de('0x1c')]=qs[_0x05de('0x1c')](_0x4059bf['query'][_0x05de('0x1c')]);}return _0x309caf['getDescriptions'](_0x302b9d);}})[_0x05de('0x23')](function(_0x13f9e2){if(_0x13f9e2){return _0x13f9e2?{'count':_0x2abef8,'rows':_0x13f9e2}:null;}})['then'](respondWithResult(_0xe65008,null))[_0x05de('0x43')](handleError(_0xe65008,null));}; \ No newline at end of file +var _0x3c5e=['ejs','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x2dd82f,_0xd7595f){var _0x311f96=function(_0x30cc2d){while(--_0x30cc2d){_0x2dd82f['push'](_0x2dd82f['shift']());}};_0x311f96(++_0xd7595f);}(_0x3c5e,0x145));var _0xe3c5=function(_0x1650fa,_0x1025f2){_0x1650fa=_0x1650fa-0x0;var _0x1caddd=_0x3c5e[_0x1650fa];return _0x1caddd;};'use strict';var emlformat=require(_0xe3c5('0x0'));var rimraf=require(_0xe3c5('0x1'));var zipdir=require(_0xe3c5('0x2'));var jsonpatch=require(_0xe3c5('0x3'));var rp=require(_0xe3c5('0x4'));var moment=require(_0xe3c5('0x5'));var BPromise=require(_0xe3c5('0x6'));var Mustache=require('mustache');var util=require(_0xe3c5('0x7'));var path=require(_0xe3c5('0x8'));var sox=require(_0xe3c5('0x9'));var csv=require(_0xe3c5('0xa'));var ejs=require(_0xe3c5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3c5('0xc'));var squel=require(_0xe3c5('0xd'));var crypto=require('crypto');var jsforce=require(_0xe3c5('0xe'));var deskjs=require(_0xe3c5('0xf'));var toCsv=require(_0xe3c5('0xa'));var querystring=require(_0xe3c5('0x10'));var Papa=require(_0xe3c5('0x11'));var Redis=require(_0xe3c5('0x12'));var authService=require(_0xe3c5('0x13'));var qs=require(_0xe3c5('0x14'));var as=require(_0xe3c5('0x15'));var hardwareService=require(_0xe3c5('0x16'));var logger=require(_0xe3c5('0x17'))(_0xe3c5('0x18'));var utils=require(_0xe3c5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe3c5('0x1a'));var db=require(_0xe3c5('0x1b'))['db'];function respondWithStatusCode(_0x679406,_0x4108f7){_0x4108f7=_0x4108f7||0xcc;return function(_0x353699){if(_0x353699){return _0x679406[_0xe3c5('0x1c')](_0x4108f7);}return _0x679406[_0xe3c5('0x1d')](_0x4108f7)[_0xe3c5('0x1e')]();};}function respondWithResult(_0x4102bb,_0x56cbea){_0x56cbea=_0x56cbea||0xc8;return function(_0x72461){if(_0x72461){return _0x4102bb[_0xe3c5('0x1d')](_0x56cbea)[_0xe3c5('0x1f')](_0x72461);}};}function respondWithFilteredResult(_0x34d56c,_0xa43a94){return function(_0x109908){if(_0x109908){var _0x36bab2=typeof _0xa43a94[_0xe3c5('0x20')]===_0xe3c5('0x21')&&typeof _0xa43a94['limit']==='undefined';var _0x57959c=_0x109908['count'];var _0x2bd51d=_0x36bab2?0x0:_0xa43a94[_0xe3c5('0x20')];var _0x2fa81e=_0x36bab2?_0x109908[_0xe3c5('0x22')]:_0xa43a94['offset']+_0xa43a94['limit'];var _0x16a80c;if(_0x2fa81e>=_0x57959c){_0x2fa81e=_0x57959c;_0x16a80c=0xc8;}else{_0x16a80c=0xce;}_0x34d56c['status'](_0x16a80c);return _0x34d56c[_0xe3c5('0x23')](_0xe3c5('0x24'),_0x2bd51d+'-'+_0x2fa81e+'/'+_0x57959c)[_0xe3c5('0x1f')](_0x109908);}return null;};}function patchUpdates(_0x21dc55){return function(_0x49db10){try{jsonpatch['apply'](_0x49db10,_0x21dc55,!![]);}catch(_0x2d120f){return BPromise[_0xe3c5('0x25')](_0x2d120f);}return _0x49db10['save']();};}function saveUpdates(_0x2d43ed,_0x1716f9){return function(_0x5c32f5){if(_0x5c32f5){return _0x5c32f5[_0xe3c5('0x26')](_0x2d43ed)[_0xe3c5('0x27')](function(_0x1d69b3){return _0x1d69b3;});}return null;};}function removeEntity(_0x5b7dc4,_0x5f8849){return function(_0x5e4cfd){if(_0x5e4cfd){return _0x5e4cfd[_0xe3c5('0x28')]()[_0xe3c5('0x27')](function(){_0x5b7dc4[_0xe3c5('0x1d')](0xcc)[_0xe3c5('0x1e')]();});}};}function handleEntityNotFound(_0x4af61a,_0x400050){return function(_0x1e88d7){if(!_0x1e88d7){_0x4af61a[_0xe3c5('0x1c')](0x194);}return _0x1e88d7;};}function handleError(_0x5ec0b2,_0xec098f){_0xec098f=_0xec098f||0x1f4;return function(_0x16f6e4){logger[_0xe3c5('0x29')](_0x16f6e4[_0xe3c5('0x2a')]);if(_0x16f6e4['name']){delete _0x16f6e4[_0xe3c5('0x2b')];}_0x5ec0b2[_0xe3c5('0x1d')](_0xec098f)[_0xe3c5('0x2c')](_0x16f6e4);};}exports['index']=function(_0x44f729,_0x3483eb){var _0x5c99fc={},_0x2fae68={},_0x1f6c06={'count':0x0,'rows':[]};var _0x46b73c=_[_0xe3c5('0x2d')](db[_0xe3c5('0x2e')][_0xe3c5('0x2f')],function(_0x3188f5){return{'name':_0x3188f5[_0xe3c5('0x30')],'type':_0x3188f5[_0xe3c5('0x31')][_0xe3c5('0x32')]};});_0x2fae68[_0xe3c5('0x33')]=_[_0xe3c5('0x2d')](_0x46b73c,_0xe3c5('0x2b'));_0x2fae68['query']=_[_0xe3c5('0x34')](_0x44f729[_0xe3c5('0x35')]);_0x2fae68['filters']=_[_0xe3c5('0x36')](_0x2fae68[_0xe3c5('0x33')],_0x2fae68[_0xe3c5('0x35')]);_0x5c99fc[_0xe3c5('0x37')]=_[_0xe3c5('0x36')](_0x2fae68[_0xe3c5('0x33')],qs[_0xe3c5('0x38')](_0x44f729['query'][_0xe3c5('0x38')]));_0x5c99fc['attributes']=_0x5c99fc[_0xe3c5('0x37')][_0xe3c5('0x39')]?_0x5c99fc['attributes']:_0x2fae68[_0xe3c5('0x33')];if(!_0x44f729[_0xe3c5('0x35')]['hasOwnProperty']('nolimit')){_0x5c99fc['limit']=qs[_0xe3c5('0x3a')](_0x44f729[_0xe3c5('0x35')][_0xe3c5('0x3a')]);_0x5c99fc[_0xe3c5('0x20')]=qs['offset'](_0x44f729[_0xe3c5('0x35')]['offset']);}_0x5c99fc[_0xe3c5('0x3b')]=qs[_0xe3c5('0x3c')](_0x44f729[_0xe3c5('0x35')][_0xe3c5('0x3c')]);_0x5c99fc[_0xe3c5('0x3d')]=qs['filters'](_[_0xe3c5('0x3e')](_0x44f729[_0xe3c5('0x35')],_0x2fae68[_0xe3c5('0x3f')]),_0x46b73c);if(_0x44f729[_0xe3c5('0x35')]['filter']){_0x5c99fc[_0xe3c5('0x3d')]=_[_0xe3c5('0x40')](_0x5c99fc[_0xe3c5('0x3d')],{'$or':_[_0xe3c5('0x2d')](_0x46b73c,function(_0x567a31){if(_0x567a31['type']!==_0xe3c5('0x41')){var _0x18f84c={};_0x18f84c[_0x567a31['name']]={'$like':'%'+_0x44f729[_0xe3c5('0x35')][_0xe3c5('0x42')]+'%'};return _0x18f84c;}})});}_0x5c99fc=_['merge']({},_0x5c99fc,_0x44f729[_0xe3c5('0x43')]);var _0x3dfe22={'where':_0x5c99fc[_0xe3c5('0x3d')]};return db[_0xe3c5('0x2e')]['count'](_0x3dfe22)[_0xe3c5('0x27')](function(_0x24cdaa){_0x1f6c06[_0xe3c5('0x22')]=_0x24cdaa;if(_0x44f729[_0xe3c5('0x35')][_0xe3c5('0x44')]){_0x5c99fc[_0xe3c5('0x45')]=[{'all':!![]}];}return db[_0xe3c5('0x2e')]['findAll'](_0x5c99fc);})[_0xe3c5('0x27')](function(_0x53d3aa){_0x1f6c06[_0xe3c5('0x46')]=_0x53d3aa;return _0x1f6c06;})[_0xe3c5('0x27')](respondWithFilteredResult(_0x3483eb,_0x5c99fc))[_0xe3c5('0x47')](handleError(_0x3483eb,null));};exports[_0xe3c5('0x48')]=function(_0x3d9d59,_0x4e3ff4){var _0x3f5ccc={'raw':![],'where':{'id':_0x3d9d59[_0xe3c5('0x49')]['id']}},_0xc64789={};_0xc64789['model']=_['keys'](db['SalesforceConfiguration'][_0xe3c5('0x2f')]);_0xc64789[_0xe3c5('0x35')]=_[_0xe3c5('0x34')](_0x3d9d59['query']);_0xc64789[_0xe3c5('0x3f')]=_['intersection'](_0xc64789[_0xe3c5('0x33')],_0xc64789[_0xe3c5('0x35')]);_0x3f5ccc[_0xe3c5('0x37')]=_[_0xe3c5('0x36')](_0xc64789[_0xe3c5('0x33')],qs[_0xe3c5('0x38')](_0x3d9d59[_0xe3c5('0x35')][_0xe3c5('0x38')]));_0x3f5ccc[_0xe3c5('0x37')]=_0x3f5ccc[_0xe3c5('0x37')]['length']?_0x3f5ccc[_0xe3c5('0x37')]:_0xc64789[_0xe3c5('0x33')];if(_0x3d9d59[_0xe3c5('0x35')]['includeAll']){_0x3f5ccc[_0xe3c5('0x45')]=[{'all':!![]}];}_0x3f5ccc=_[_0xe3c5('0x40')]({},_0x3f5ccc,_0x3d9d59[_0xe3c5('0x43')]);return db[_0xe3c5('0x2e')][_0xe3c5('0x4a')](_0x3f5ccc)[_0xe3c5('0x27')](handleEntityNotFound(_0x4e3ff4,null))[_0xe3c5('0x27')](respondWithResult(_0x4e3ff4,null))['catch'](handleError(_0x4e3ff4,null));};exports['create']=function(_0x22ee3a,_0x29fa95){return db[_0xe3c5('0x2e')][_0xe3c5('0x4b')](_0x22ee3a[_0xe3c5('0x4c')],{})[_0xe3c5('0x27')](respondWithResult(_0x29fa95,0xc9))[_0xe3c5('0x47')](handleError(_0x29fa95,null));};exports['update']=function(_0x58226a,_0x49acd8){if(_0x58226a[_0xe3c5('0x4c')]['id']){delete _0x58226a['body']['id'];}return db[_0xe3c5('0x2e')][_0xe3c5('0x4a')]({'where':{'id':_0x58226a[_0xe3c5('0x49')]['id']}})[_0xe3c5('0x27')](handleEntityNotFound(_0x49acd8,null))[_0xe3c5('0x27')](saveUpdates(_0x58226a[_0xe3c5('0x4c')],null))['then'](respondWithResult(_0x49acd8,null))[_0xe3c5('0x47')](handleError(_0x49acd8,null));};exports[_0xe3c5('0x28')]=function(_0x4f7048,_0x120013){return db[_0xe3c5('0x2e')]['find']({'where':{'id':_0x4f7048[_0xe3c5('0x49')]['id']}})[_0xe3c5('0x27')](handleEntityNotFound(_0x120013,null))[_0xe3c5('0x27')](removeEntity(_0x120013,null))[_0xe3c5('0x47')](handleError(_0x120013,null));};exports[_0xe3c5('0x4d')]=function(_0x5353e3,_0x268ea3,_0x2afe68){var _0x4086fb={};var _0x313145={};var _0x2ea3f5;var _0xa2ef3f;return db[_0xe3c5('0x2e')][_0xe3c5('0x4e')]({'where':{'id':_0x5353e3[_0xe3c5('0x49')]['id']}})[_0xe3c5('0x27')](handleEntityNotFound(_0x268ea3,null))['then'](function(_0x2f6632){if(_0x2f6632){_0x2ea3f5=_0x2f6632;_0x313145[_0xe3c5('0x33')]=_['keys'](db[_0xe3c5('0x4f')][_0xe3c5('0x2f')]);_0x313145[_0xe3c5('0x35')]=_['keys'](_0x5353e3['query']);_0x313145['filters']=_[_0xe3c5('0x36')](_0x313145[_0xe3c5('0x33')],_0x313145[_0xe3c5('0x35')]);_0x4086fb[_0xe3c5('0x37')]=_[_0xe3c5('0x36')](_0x313145[_0xe3c5('0x33')],qs[_0xe3c5('0x38')](_0x5353e3[_0xe3c5('0x35')][_0xe3c5('0x38')]));_0x4086fb[_0xe3c5('0x37')]=_0x4086fb[_0xe3c5('0x37')][_0xe3c5('0x39')]?_0x4086fb['attributes']:_0x313145[_0xe3c5('0x33')];_0x4086fb[_0xe3c5('0x3b')]=qs[_0xe3c5('0x3c')](_0x5353e3[_0xe3c5('0x35')]['sort']);_0x4086fb[_0xe3c5('0x3d')]=qs[_0xe3c5('0x3f')](_[_0xe3c5('0x3e')](_0x5353e3[_0xe3c5('0x35')],_0x313145[_0xe3c5('0x3f')]));if(_0x5353e3[_0xe3c5('0x35')][_0xe3c5('0x42')]){_0x4086fb[_0xe3c5('0x3d')]=_[_0xe3c5('0x40')](_0x4086fb[_0xe3c5('0x3d')],{'$or':_[_0xe3c5('0x2d')](_0x4086fb[_0xe3c5('0x37')],function(_0x4190d3){var _0x222e55={};_0x222e55[_0x4190d3]={'$like':'%'+_0x5353e3[_0xe3c5('0x35')][_0xe3c5('0x42')]+'%'};return _0x222e55;})});}_0x4086fb=_['merge']({},_0x4086fb,_0x5353e3['options']);return _0x2ea3f5[_0xe3c5('0x4d')](_0x4086fb);}})[_0xe3c5('0x27')](function(_0x4b9351){if(_0x4b9351){_0xa2ef3f=_0x4b9351[_0xe3c5('0x39')];if(!_0x5353e3[_0xe3c5('0x35')][_0xe3c5('0x50')]('nolimit')){_0x4086fb[_0xe3c5('0x3a')]=qs['limit'](_0x5353e3[_0xe3c5('0x35')][_0xe3c5('0x3a')]);_0x4086fb[_0xe3c5('0x20')]=qs[_0xe3c5('0x20')](_0x5353e3[_0xe3c5('0x35')][_0xe3c5('0x20')]);}return _0x2ea3f5[_0xe3c5('0x4d')](_0x4086fb);}})['then'](function(_0x1c0dc4){if(_0x1c0dc4){return _0x1c0dc4?{'count':_0xa2ef3f,'rows':_0x1c0dc4}:null;}})[_0xe3c5('0x27')](respondWithResult(_0x268ea3,null))[_0xe3c5('0x47')](handleError(_0x268ea3,null));};exports['getSubjects']=function(_0x25316d,_0x39fd2f,_0x1d7035){var _0x239ccf={};var _0x1e35c8={};var _0x729e5d;var _0x3ef405;return db[_0xe3c5('0x2e')][_0xe3c5('0x4e')]({'where':{'id':_0x25316d[_0xe3c5('0x49')]['id']}})[_0xe3c5('0x27')](handleEntityNotFound(_0x39fd2f,null))[_0xe3c5('0x27')](function(_0x25fc61){if(_0x25fc61){_0x729e5d=_0x25fc61;_0x1e35c8[_0xe3c5('0x33')]=_[_0xe3c5('0x34')](db[_0xe3c5('0x4f')][_0xe3c5('0x2f')]);_0x1e35c8[_0xe3c5('0x35')]=_[_0xe3c5('0x34')](_0x25316d[_0xe3c5('0x35')]);_0x1e35c8[_0xe3c5('0x3f')]=_[_0xe3c5('0x36')](_0x1e35c8[_0xe3c5('0x33')],_0x1e35c8[_0xe3c5('0x35')]);_0x239ccf[_0xe3c5('0x37')]=_[_0xe3c5('0x36')](_0x1e35c8[_0xe3c5('0x33')],qs[_0xe3c5('0x38')](_0x25316d[_0xe3c5('0x35')][_0xe3c5('0x38')]));_0x239ccf['attributes']=_0x239ccf[_0xe3c5('0x37')][_0xe3c5('0x39')]?_0x239ccf[_0xe3c5('0x37')]:_0x1e35c8['model'];_0x239ccf[_0xe3c5('0x3b')]=qs['sort'](_0x25316d['query'][_0xe3c5('0x3c')]);_0x239ccf[_0xe3c5('0x3d')]=qs['filters'](_[_0xe3c5('0x3e')](_0x25316d[_0xe3c5('0x35')],_0x1e35c8[_0xe3c5('0x3f')]));if(_0x25316d[_0xe3c5('0x35')][_0xe3c5('0x42')]){_0x239ccf[_0xe3c5('0x3d')]=_[_0xe3c5('0x40')](_0x239ccf[_0xe3c5('0x3d')],{'$or':_[_0xe3c5('0x2d')](_0x239ccf[_0xe3c5('0x37')],function(_0x131561){var _0x11e62f={};_0x11e62f[_0x131561]={'$like':'%'+_0x25316d[_0xe3c5('0x35')]['filter']+'%'};return _0x11e62f;})});}_0x239ccf=_[_0xe3c5('0x40')]({},_0x239ccf,_0x25316d[_0xe3c5('0x43')]);return _0x729e5d[_0xe3c5('0x51')](_0x239ccf);}})['then'](function(_0x37e512){if(_0x37e512){_0x3ef405=_0x37e512[_0xe3c5('0x39')];if(!_0x25316d[_0xe3c5('0x35')][_0xe3c5('0x50')](_0xe3c5('0x52'))){_0x239ccf[_0xe3c5('0x3a')]=qs[_0xe3c5('0x3a')](_0x25316d[_0xe3c5('0x35')][_0xe3c5('0x3a')]);_0x239ccf[_0xe3c5('0x20')]=qs[_0xe3c5('0x20')](_0x25316d[_0xe3c5('0x35')][_0xe3c5('0x20')]);}return _0x729e5d[_0xe3c5('0x51')](_0x239ccf);}})['then'](function(_0x3d163f){if(_0x3d163f){return _0x3d163f?{'count':_0x3ef405,'rows':_0x3d163f}:null;}})['then'](respondWithResult(_0x39fd2f,null))[_0xe3c5('0x47')](handleError(_0x39fd2f,null));};exports[_0xe3c5('0x53')]=function(_0x68e0ba,_0x48d12e,_0x54d795){var _0x55ac9b={};var _0xe1787={};var _0x454d8d;var _0x32f869;return db[_0xe3c5('0x2e')]['findOne']({'where':{'id':_0x68e0ba[_0xe3c5('0x49')]['id']}})[_0xe3c5('0x27')](handleEntityNotFound(_0x48d12e,null))[_0xe3c5('0x27')](function(_0x559bf1){if(_0x559bf1){_0x454d8d=_0x559bf1;_0xe1787[_0xe3c5('0x33')]=_['keys'](db[_0xe3c5('0x4f')][_0xe3c5('0x2f')]);_0xe1787['query']=_[_0xe3c5('0x34')](_0x68e0ba['query']);_0xe1787['filters']=_[_0xe3c5('0x36')](_0xe1787[_0xe3c5('0x33')],_0xe1787[_0xe3c5('0x35')]);_0x55ac9b[_0xe3c5('0x37')]=_['intersection'](_0xe1787[_0xe3c5('0x33')],qs[_0xe3c5('0x38')](_0x68e0ba[_0xe3c5('0x35')]['fields']));_0x55ac9b['attributes']=_0x55ac9b['attributes'][_0xe3c5('0x39')]?_0x55ac9b['attributes']:_0xe1787[_0xe3c5('0x33')];_0x55ac9b[_0xe3c5('0x3b')]=qs['sort'](_0x68e0ba[_0xe3c5('0x35')][_0xe3c5('0x3c')]);_0x55ac9b[_0xe3c5('0x3d')]=qs['filters'](_[_0xe3c5('0x3e')](_0x68e0ba[_0xe3c5('0x35')],_0xe1787[_0xe3c5('0x3f')]));if(_0x68e0ba[_0xe3c5('0x35')][_0xe3c5('0x42')]){_0x55ac9b[_0xe3c5('0x3d')]=_[_0xe3c5('0x40')](_0x55ac9b[_0xe3c5('0x3d')],{'$or':_['map'](_0x55ac9b['attributes'],function(_0x3dd738){var _0x312fe8={};_0x312fe8[_0x3dd738]={'$like':'%'+_0x68e0ba['query']['filter']+'%'};return _0x312fe8;})});}_0x55ac9b=_['merge']({},_0x55ac9b,_0x68e0ba[_0xe3c5('0x43')]);return _0x454d8d[_0xe3c5('0x53')](_0x55ac9b);}})[_0xe3c5('0x27')](function(_0x17dc60){if(_0x17dc60){_0x32f869=_0x17dc60[_0xe3c5('0x39')];if(!_0x68e0ba['query'][_0xe3c5('0x50')](_0xe3c5('0x52'))){_0x55ac9b[_0xe3c5('0x3a')]=qs[_0xe3c5('0x3a')](_0x68e0ba[_0xe3c5('0x35')][_0xe3c5('0x3a')]);_0x55ac9b[_0xe3c5('0x20')]=qs[_0xe3c5('0x20')](_0x68e0ba[_0xe3c5('0x35')][_0xe3c5('0x20')]);}return _0x454d8d[_0xe3c5('0x53')](_0x55ac9b);}})[_0xe3c5('0x27')](function(_0x2a5158){if(_0x2a5158){return _0x2a5158?{'count':_0x32f869,'rows':_0x2a5158}:null;}})['then'](respondWithResult(_0x48d12e,null))[_0xe3c5('0x47')](handleError(_0x48d12e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 98355f7..4d6b82c 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 _0x864f=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x14fb3d,_0x2876ef){var _0x5c163d=function(_0x254005){while(--_0x254005){_0x14fb3d['push'](_0x14fb3d['shift']());}};_0x5c163d(++_0x2876ef);}(_0x864f,0x151));var _0xf864=function(_0x553dc7,_0x58c684){_0x553dc7=_0x553dc7-0x0;var _0x58d1ae=_0x864f[_0x553dc7];return _0x58d1ae;};'use strict';var _=require(_0xf864('0x0'));var util=require(_0xf864('0x1'));var logger=require(_0xf864('0x2'))('api');var moment=require(_0xf864('0x3'));var BPromise=require(_0xf864('0x4'));var rp=require(_0xf864('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf864('0x6'));var config=require(_0xf864('0x7'));var attributes=require(_0xf864('0x8'));module[_0xf864('0x9')]=function(_0x70515d,_0x460e25){return _0x70515d[_0xf864('0xa')](_0xf864('0xb'),attributes,{'tableName':_0xf864('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1a=['../../config/logger','api','moment','path','rimraf','int_salesforce_configurations','lodash'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x3e1a,0x187));var _0xa3e1=function(_0x5c31a8,_0x32263b){_0x5c31a8=_0x5c31a8-0x0;var _0x1286f0=_0x3e1a[_0x5c31a8];return _0x1286f0;};'use strict';var _=require(_0xa3e1('0x0'));var util=require('util');var logger=require(_0xa3e1('0x1'))(_0xa3e1('0x2'));var moment=require(_0xa3e1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3e1('0x4'));var rimraf=require(_0xa3e1('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x4934e2,_0x4369ab){return _0x4934e2['define']('SalesforceConfiguration',attributes,{'tableName':_0xa3e1('0x6'),'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 79aa689..6f60528 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 _0x1b93=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash'];(function(_0x4e47f9,_0x3ce10f){var _0x244302=function(_0x45cb4c){while(--_0x45cb4c){_0x4e47f9['push'](_0x4e47f9['shift']());}};_0x244302(++_0x3ce10f);}(_0x1b93,0x1c7));var _0x31b9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1b93[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x31b9('0x0'));var util=require(_0x31b9('0x1'));var moment=require(_0x31b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x31b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b9('0x4'))['db'];var utils=require(_0x31b9('0x5'));var logger=require(_0x31b9('0x6'))('rpc');var config=require(_0x31b9('0x7'));var jayson=require(_0x31b9('0x8'));var client=jayson[_0x31b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x62fa96,_0x12d727,_0x2ca68b){return new BPromise(function(_0x42ed3f,_0x324799){return client[_0x31b9('0xa')](_0x62fa96,_0x2ca68b)[_0x31b9('0xb')](function(_0x235733){logger[_0x31b9('0xc')](_0x31b9('0xd'),_0x12d727,_0x31b9('0xe'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x12d727,_0x31b9('0xe'),JSON['stringify'](_0x235733));if(_0x235733['error']){if(_0x235733[_0x31b9('0xf')]['code']===0x1f4){logger[_0x31b9('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12d727,_0x235733[_0x31b9('0xf')][_0x31b9('0x10')]);return _0x324799(_0x235733[_0x31b9('0xf')][_0x31b9('0x10')]);}logger[_0x31b9('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12d727,_0x235733['error'][_0x31b9('0x10')]);return _0x42ed3f(_0x235733[_0x31b9('0xf')][_0x31b9('0x10')]);}else{logger[_0x31b9('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12d727,'request\x20sent');_0x42ed3f(_0x235733[_0x31b9('0x11')][_0x31b9('0x10')]);}})[_0x31b9('0x12')](function(_0x2e04e5){logger[_0x31b9('0xf')](_0x31b9('0xd'),_0x12d727,_0x2e04e5);_0x324799(_0x2e04e5);});});} \ No newline at end of file +var _0xecc9=['rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecc9,0x1de));var _0x9ecc=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xecc9[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require(_0x9ecc('0x0'));var util=require('util');var moment=require(_0x9ecc('0x1'));var BPromise=require(_0x9ecc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ecc('0x3'))['db'];var utils=require(_0x9ecc('0x4'));var logger=require('../../config/logger')(_0x9ecc('0x5'));var config=require(_0x9ecc('0x6'));var jayson=require(_0x9ecc('0x7'));var client=jayson[_0x9ecc('0x8')][_0x9ecc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3db1f6,_0x2f7833,_0xebb73e){return new BPromise(function(_0xc7bd09,_0x334083){return client[_0x9ecc('0xa')](_0x3db1f6,_0xebb73e)[_0x9ecc('0xb')](function(_0x204c78){logger['info'](_0x9ecc('0xc'),_0x2f7833,_0x9ecc('0xd'));logger[_0x9ecc('0xe')](_0x9ecc('0xf'),_0x2f7833,_0x9ecc('0xd'),JSON[_0x9ecc('0x10')](_0x204c78));if(_0x204c78['error']){if(_0x204c78[_0x9ecc('0x11')][_0x9ecc('0x12')]===0x1f4){logger[_0x9ecc('0x11')](_0x9ecc('0xc'),_0x2f7833,_0x204c78[_0x9ecc('0x11')][_0x9ecc('0x13')]);return _0x334083(_0x204c78[_0x9ecc('0x11')][_0x9ecc('0x13')]);}logger[_0x9ecc('0x11')](_0x9ecc('0xc'),_0x2f7833,_0x204c78['error'][_0x9ecc('0x13')]);return _0xc7bd09(_0x204c78[_0x9ecc('0x11')][_0x9ecc('0x13')]);}else{logger[_0x9ecc('0x14')](_0x9ecc('0xc'),_0x2f7833,'request\x20sent');_0xc7bd09(_0x204c78[_0x9ecc('0x15')]['message']);}})[_0x9ecc('0x16')](function(_0x1d0637){logger[_0x9ecc('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2f7833,_0x1d0637);_0x334083(_0x1d0637);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4b0d391..332c7d2 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 _0x1d5d=['show','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get'];(function(_0x47854f,_0x19e806){var _0x427343=function(_0x553b87){while(--_0x553b87){_0x47854f['push'](_0x47854f['shift']());}};_0x427343(++_0x19e806);}(_0x1d5d,0xbc));var _0xd1d5=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x1d5d[_0x21aec3];return _0x288bbc;};'use strict';var multer=require('multer');var util=require(_0xd1d5('0x0'));var path=require(_0xd1d5('0x1'));var timeout=require(_0xd1d5('0x2'));var express=require(_0xd1d5('0x3'));var router=express[_0xd1d5('0x4')]();var fs_extra=require(_0xd1d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd1d5('0x6'));var config=require(_0xd1d5('0x7'));var controller=require(_0xd1d5('0x8'));router['get']('/',auth[_0xd1d5('0x9')](),controller[_0xd1d5('0xa')]);router[_0xd1d5('0xb')]('/:id',auth[_0xd1d5('0x9')](),controller[_0xd1d5('0xc')]);router[_0xd1d5('0xd')]('/',auth['isAuthenticated'](),controller[_0xd1d5('0xe')]);router[_0xd1d5('0xf')](_0xd1d5('0x10'),auth[_0xd1d5('0x9')](),controller['update']);router[_0xd1d5('0x11')](_0xd1d5('0x10'),auth[_0xd1d5('0x9')](),controller[_0xd1d5('0x12')]);module[_0xd1d5('0x13')]=router; \ No newline at end of file +var _0xd728=['../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','create','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0xd728,0x182));var _0x8d72=function(_0x173a24,_0x2e2dc8){_0x173a24=_0x173a24-0x0;var _0xb9d412=_0xd728[_0x173a24];return _0xb9d412;};'use strict';var multer=require('multer');var util=require(_0x8d72('0x0'));var path=require('path');var timeout=require(_0x8d72('0x1'));var express=require(_0x8d72('0x2'));var router=express[_0x8d72('0x3')]();var fs_extra=require(_0x8d72('0x4'));var auth=require(_0x8d72('0x5'));var interaction=require(_0x8d72('0x6'));var config=require('../../config/environment');var controller=require(_0x8d72('0x7'));router[_0x8d72('0x8')]('/',auth[_0x8d72('0x9')](),controller['index']);router[_0x8d72('0x8')](_0x8d72('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8d72('0x9')](),controller[_0x8d72('0xb')]);router['put'](_0x8d72('0xa'),auth['isAuthenticated'](),controller[_0x8d72('0xc')]);router['delete'](_0x8d72('0xa'),auth[_0x8d72('0x9')](),controller['destroy']);module[_0x8d72('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 3c78acb..39184d9 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 _0xb10c=['string','variable','customVariable','keyValue','STRING','ENUM','sequelize'];(function(_0x44bf0a,_0x510822){var _0x599c57=function(_0x375aea){while(--_0x375aea){_0x44bf0a['push'](_0x44bf0a['shift']());}};_0x599c57(++_0x510822);}(_0xb10c,0x117));var _0xcb10=function(_0x1b3706,_0x405791){_0x1b3706=_0x1b3706-0x0;var _0x5cd3a5=_0xb10c[_0x1b3706];return _0x5cd3a5;};'use strict';var Sequelize=require(_0xcb10('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xcb10('0x1'),_0xcb10('0x2'),_0xcb10('0x3'),_0xcb10('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xcb10('0x5')]},'key':{'type':Sequelize[_0xcb10('0x5')]},'keyType':{'type':Sequelize[_0xcb10('0x6')](_0xcb10('0x1'),_0xcb10('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xcb10('0x5')]},'idField':{'type':Sequelize[_0xcb10('0x5')]},'variableName':{'type':Sequelize[_0xcb10('0x5')]}}; \ No newline at end of file +var _0xf683=['ENUM','string','variable','keyValue','customVariable','STRING','sequelize','exports'];(function(_0x419bb3,_0x3e16af){var _0x377de2=function(_0x200b04){while(--_0x200b04){_0x419bb3['push'](_0x419bb3['shift']());}};_0x377de2(++_0x3e16af);}(_0xf683,0x1ce));var _0x3f68=function(_0x32902b,_0x3e0cd3){_0x32902b=_0x32902b-0x0;var _0x515408=_0xf683[_0x32902b];return _0x515408;};'use strict';var Sequelize=require(_0x3f68('0x0'));module[_0x3f68('0x1')]={'type':{'type':Sequelize[_0x3f68('0x2')](_0x3f68('0x3'),_0x3f68('0x4'),'customVariable',_0x3f68('0x5'),'picklist'),'defaultValue':_0x3f68('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3f68('0x2')]('string',_0x3f68('0x4'),_0x3f68('0x6'))},'keyContent':{'type':Sequelize[_0x3f68('0x7')]},'idField':{'type':Sequelize[_0x3f68('0x7')]},'variableName':{'type':Sequelize[_0x3f68('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2809d31..675f3c1 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 _0x6073=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','stack','name','send','map','fieldName','query','keys','filters','model','attributes','intersection','fields','sort','where','pick','merge','type','VIRTUAL','filter','then','includeAll','include','rows','catch','show','params','SalesforceField','rawAttributes','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2c674c,_0x59e732){var _0x7ac0ee=function(_0x117fd3){while(--_0x117fd3){_0x2c674c['push'](_0x2c674c['shift']());}};_0x7ac0ee(++_0x59e732);}(_0x6073,0x7d));var _0x3607=function(_0x366e49,_0x11080f){_0x366e49=_0x366e49-0x0;var _0x1ffeb4=_0x6073[_0x366e49];return _0x1ffeb4;};'use strict';var emlformat=require(_0x3607('0x0'));var rimraf=require(_0x3607('0x1'));var zipdir=require(_0x3607('0x2'));var jsonpatch=require(_0x3607('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3607('0x4'));var util=require(_0x3607('0x5'));var path=require(_0x3607('0x6'));var sox=require(_0x3607('0x7'));var csv=require(_0x3607('0x8'));var ejs=require(_0x3607('0x9'));var fs=require('fs');var fs_extra=require(_0x3607('0xa'));var _=require(_0x3607('0xb'));var squel=require(_0x3607('0xc'));var crypto=require(_0x3607('0xd'));var jsforce=require(_0x3607('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3607('0xf'));var Redis=require(_0x3607('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3607('0x11'));var as=require(_0x3607('0x12'));var hardwareService=require(_0x3607('0x13'));var logger=require(_0x3607('0x14'))('api');var utils=require(_0x3607('0x15'));var config=require(_0x3607('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3607('0x17'))['db'];function respondWithStatusCode(_0x4ba57f,_0xee3cd2){_0xee3cd2=_0xee3cd2||0xcc;return function(_0x2f8c0d){if(_0x2f8c0d){return _0x4ba57f[_0x3607('0x18')](_0xee3cd2);}return _0x4ba57f[_0x3607('0x19')](_0xee3cd2)[_0x3607('0x1a')]();};}function respondWithResult(_0x1cdd71,_0x63621c){_0x63621c=_0x63621c||0xc8;return function(_0x1c9128){if(_0x1c9128){return _0x1cdd71[_0x3607('0x19')](_0x63621c)[_0x3607('0x1b')](_0x1c9128);}};}function respondWithFilteredResult(_0x30b852,_0x51d4eb){return function(_0x834e82){if(_0x834e82){var _0xc62459=typeof _0x51d4eb[_0x3607('0x1c')]===_0x3607('0x1d')&&typeof _0x51d4eb['limit']===_0x3607('0x1d');var _0x4aa816=_0x834e82[_0x3607('0x1e')];var _0x3aa638=_0xc62459?0x0:_0x51d4eb[_0x3607('0x1c')];var _0x102b3e=_0xc62459?_0x834e82['count']:_0x51d4eb[_0x3607('0x1c')]+_0x51d4eb[_0x3607('0x1f')];var _0x39b1b6;if(_0x102b3e>=_0x4aa816){_0x102b3e=_0x4aa816;_0x39b1b6=0xc8;}else{_0x39b1b6=0xce;}_0x30b852[_0x3607('0x19')](_0x39b1b6);return _0x30b852[_0x3607('0x20')](_0x3607('0x21'),_0x3aa638+'-'+_0x102b3e+'/'+_0x4aa816)[_0x3607('0x1b')](_0x834e82);}return null;};}function patchUpdates(_0x59bc7b){return function(_0x3353f1){try{jsonpatch[_0x3607('0x22')](_0x3353f1,_0x59bc7b,!![]);}catch(_0xd454e0){return BPromise['reject'](_0xd454e0);}return _0x3353f1[_0x3607('0x23')]();};}function saveUpdates(_0x34b7b2,_0x248b17){return function(_0x5afb08){if(_0x5afb08){return _0x5afb08[_0x3607('0x24')](_0x34b7b2)['then'](function(_0x35d402){return _0x35d402;});}return null;};}function removeEntity(_0x12da13,_0x41ea53){return function(_0x5eeea6){if(_0x5eeea6){return _0x5eeea6['destroy']()['then'](function(){_0x12da13[_0x3607('0x19')](0xcc)[_0x3607('0x1a')]();});}};}function handleEntityNotFound(_0x4de6fa,_0x33bb07){return function(_0x49b6a4){if(!_0x49b6a4){_0x4de6fa['sendStatus'](0x194);}return _0x49b6a4;};}function handleError(_0x58ebbb,_0x338950){_0x338950=_0x338950||0x1f4;return function(_0x401868){logger['error'](_0x401868[_0x3607('0x25')]);if(_0x401868[_0x3607('0x26')]){delete _0x401868[_0x3607('0x26')];}_0x58ebbb[_0x3607('0x19')](_0x338950)[_0x3607('0x27')](_0x401868);};}exports['index']=function(_0x5a157f,_0x1b07d9){var _0x1a3d07={},_0x30abf1={},_0x296746={'count':0x0,'rows':[]};var _0x164d32=_[_0x3607('0x28')](db['SalesforceField']['rawAttributes'],function(_0x183049){return{'name':_0x183049[_0x3607('0x29')],'type':_0x183049['type']['key']};});_0x30abf1['model']=_[_0x3607('0x28')](_0x164d32,_0x3607('0x26'));_0x30abf1[_0x3607('0x2a')]=_[_0x3607('0x2b')](_0x5a157f[_0x3607('0x2a')]);_0x30abf1[_0x3607('0x2c')]=_['intersection'](_0x30abf1[_0x3607('0x2d')],_0x30abf1[_0x3607('0x2a')]);_0x1a3d07[_0x3607('0x2e')]=_[_0x3607('0x2f')](_0x30abf1[_0x3607('0x2d')],qs[_0x3607('0x30')](_0x5a157f['query'][_0x3607('0x30')]));_0x1a3d07[_0x3607('0x2e')]=_0x1a3d07[_0x3607('0x2e')]['length']?_0x1a3d07[_0x3607('0x2e')]:_0x30abf1['model'];if(!_0x5a157f[_0x3607('0x2a')]['hasOwnProperty']('nolimit')){_0x1a3d07[_0x3607('0x1f')]=qs[_0x3607('0x1f')](_0x5a157f[_0x3607('0x2a')][_0x3607('0x1f')]);_0x1a3d07[_0x3607('0x1c')]=qs[_0x3607('0x1c')](_0x5a157f[_0x3607('0x2a')][_0x3607('0x1c')]);}_0x1a3d07['order']=qs[_0x3607('0x31')](_0x5a157f[_0x3607('0x2a')][_0x3607('0x31')]);_0x1a3d07[_0x3607('0x32')]=qs[_0x3607('0x2c')](_[_0x3607('0x33')](_0x5a157f[_0x3607('0x2a')],_0x30abf1[_0x3607('0x2c')]),_0x164d32);if(_0x5a157f[_0x3607('0x2a')]['filter']){_0x1a3d07['where']=_[_0x3607('0x34')](_0x1a3d07[_0x3607('0x32')],{'$or':_[_0x3607('0x28')](_0x164d32,function(_0x4ee259){if(_0x4ee259[_0x3607('0x35')]!==_0x3607('0x36')){var _0x15142e={};_0x15142e[_0x4ee259[_0x3607('0x26')]]={'$like':'%'+_0x5a157f[_0x3607('0x2a')][_0x3607('0x37')]+'%'};return _0x15142e;}})});}_0x1a3d07=_['merge']({},_0x1a3d07,_0x5a157f['options']);var _0x415703={'where':_0x1a3d07['where']};return db['SalesforceField'][_0x3607('0x1e')](_0x415703)[_0x3607('0x38')](function(_0x48f33e){_0x296746[_0x3607('0x1e')]=_0x48f33e;if(_0x5a157f['query'][_0x3607('0x39')]){_0x1a3d07[_0x3607('0x3a')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x1a3d07);})[_0x3607('0x38')](function(_0x397290){_0x296746[_0x3607('0x3b')]=_0x397290;return _0x296746;})[_0x3607('0x38')](respondWithFilteredResult(_0x1b07d9,_0x1a3d07))[_0x3607('0x3c')](handleError(_0x1b07d9,null));};exports[_0x3607('0x3d')]=function(_0x387e39,_0x5a8c27){var _0x444483={'raw':!![],'where':{'id':_0x387e39[_0x3607('0x3e')]['id']}},_0x481281={};_0x481281[_0x3607('0x2d')]=_[_0x3607('0x2b')](db[_0x3607('0x3f')][_0x3607('0x40')]);_0x481281['query']=_['keys'](_0x387e39[_0x3607('0x2a')]);_0x481281[_0x3607('0x2c')]=_['intersection'](_0x481281[_0x3607('0x2d')],_0x481281[_0x3607('0x2a')]);_0x444483['attributes']=_[_0x3607('0x2f')](_0x481281[_0x3607('0x2d')],qs[_0x3607('0x30')](_0x387e39[_0x3607('0x2a')]['fields']));_0x444483['attributes']=_0x444483[_0x3607('0x2e')]['length']?_0x444483['attributes']:_0x481281[_0x3607('0x2d')];if(_0x387e39[_0x3607('0x2a')]['includeAll']){_0x444483[_0x3607('0x3a')]=[{'all':!![]}];}_0x444483=_[_0x3607('0x34')]({},_0x444483,_0x387e39[_0x3607('0x41')]);return db[_0x3607('0x3f')][_0x3607('0x42')](_0x444483)['then'](handleEntityNotFound(_0x5a8c27,null))['then'](respondWithResult(_0x5a8c27,null))['catch'](handleError(_0x5a8c27,null));};exports['create']=function(_0x4231ce,_0x4a81e6){return db[_0x3607('0x3f')][_0x3607('0x43')](_0x4231ce[_0x3607('0x44')],{})[_0x3607('0x38')](respondWithResult(_0x4a81e6,0xc9))[_0x3607('0x3c')](handleError(_0x4a81e6,null));};exports[_0x3607('0x24')]=function(_0x4491ad,_0x27d4e0){if(_0x4491ad[_0x3607('0x44')]['id']){delete _0x4491ad[_0x3607('0x44')]['id'];}return db[_0x3607('0x3f')][_0x3607('0x42')]({'where':{'id':_0x4491ad[_0x3607('0x3e')]['id']}})[_0x3607('0x38')](handleEntityNotFound(_0x27d4e0,null))[_0x3607('0x38')](saveUpdates(_0x4491ad[_0x3607('0x44')],null))[_0x3607('0x38')](respondWithResult(_0x27d4e0,null))[_0x3607('0x3c')](handleError(_0x27d4e0,null));};exports[_0x3607('0x45')]=function(_0x37d9c8,_0x3f0345){return db['SalesforceField']['find']({'where':{'id':_0x37d9c8['params']['id']}})['then'](handleEntityNotFound(_0x3f0345,null))[_0x3607('0x38')](removeEntity(_0x3f0345,null))[_0x3607('0x3c')](handleError(_0x3f0345,null));}; \ No newline at end of file +var _0xd92f=['find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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','send','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','SalesforceField','rawAttributes','includeAll'];(function(_0x520762,_0x434356){var _0x3441e9=function(_0x35e074){while(--_0x35e074){_0x520762['push'](_0x520762['shift']());}};_0x3441e9(++_0x434356);}(_0xd92f,0x138));var _0xfd92=function(_0x2f56c9,_0x53c36f){_0x2f56c9=_0x2f56c9-0x0;var _0x5d04f2=_0xd92f[_0x2f56c9];return _0x5d04f2;};'use strict';var emlformat=require(_0xfd92('0x0'));var rimraf=require(_0xfd92('0x1'));var zipdir=require(_0xfd92('0x2'));var jsonpatch=require(_0xfd92('0x3'));var rp=require(_0xfd92('0x4'));var moment=require(_0xfd92('0x5'));var BPromise=require(_0xfd92('0x6'));var Mustache=require(_0xfd92('0x7'));var util=require(_0xfd92('0x8'));var path=require(_0xfd92('0x9'));var sox=require(_0xfd92('0xa'));var csv=require(_0xfd92('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd92('0xc'));var squel=require('squel');var crypto=require(_0xfd92('0xd'));var jsforce=require(_0xfd92('0xe'));var deskjs=require(_0xfd92('0xf'));var toCsv=require(_0xfd92('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd92('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd92('0x11'));var as=require(_0xfd92('0x12'));var hardwareService=require(_0xfd92('0x13'));var logger=require('../../config/logger')(_0xfd92('0x14'));var utils=require(_0xfd92('0x15'));var config=require(_0xfd92('0x16'));var licenseUtil=require(_0xfd92('0x17'));var db=require(_0xfd92('0x18'))['db'];function respondWithStatusCode(_0x19f8da,_0x2b1cae){_0x2b1cae=_0x2b1cae||0xcc;return function(_0xbc5c65){if(_0xbc5c65){return _0x19f8da[_0xfd92('0x19')](_0x2b1cae);}return _0x19f8da['status'](_0x2b1cae)[_0xfd92('0x1a')]();};}function respondWithResult(_0x190dc8,_0x5b7c26){_0x5b7c26=_0x5b7c26||0xc8;return function(_0x5d0531){if(_0x5d0531){return _0x190dc8['status'](_0x5b7c26)[_0xfd92('0x1b')](_0x5d0531);}};}function respondWithFilteredResult(_0x540557,_0x4d3ef7){return function(_0x3b1671){if(_0x3b1671){var _0x43ba2d=typeof _0x4d3ef7[_0xfd92('0x1c')]===_0xfd92('0x1d')&&typeof _0x4d3ef7[_0xfd92('0x1e')]==='undefined';var _0x2a6047=_0x3b1671[_0xfd92('0x1f')];var _0x31c1c7=_0x43ba2d?0x0:_0x4d3ef7['offset'];var _0x1f7e99=_0x43ba2d?_0x3b1671['count']:_0x4d3ef7[_0xfd92('0x1c')]+_0x4d3ef7[_0xfd92('0x1e')];var _0xfc9174;if(_0x1f7e99>=_0x2a6047){_0x1f7e99=_0x2a6047;_0xfc9174=0xc8;}else{_0xfc9174=0xce;}_0x540557[_0xfd92('0x20')](_0xfc9174);return _0x540557[_0xfd92('0x21')](_0xfd92('0x22'),_0x31c1c7+'-'+_0x1f7e99+'/'+_0x2a6047)[_0xfd92('0x1b')](_0x3b1671);}return null;};}function patchUpdates(_0x453f53){return function(_0x34f609){try{jsonpatch[_0xfd92('0x23')](_0x34f609,_0x453f53,!![]);}catch(_0x5a9514){return BPromise[_0xfd92('0x24')](_0x5a9514);}return _0x34f609[_0xfd92('0x25')]();};}function saveUpdates(_0x21b1cc,_0x10adb9){return function(_0x325b0b){if(_0x325b0b){return _0x325b0b['update'](_0x21b1cc)['then'](function(_0x305944){return _0x305944;});}return null;};}function removeEntity(_0x5b062f,_0x279307){return function(_0x587f16){if(_0x587f16){return _0x587f16[_0xfd92('0x26')]()[_0xfd92('0x27')](function(){_0x5b062f[_0xfd92('0x20')](0xcc)[_0xfd92('0x1a')]();});}};}function handleEntityNotFound(_0x577d9e,_0x315ef2){return function(_0x5f3474){if(!_0x5f3474){_0x577d9e[_0xfd92('0x19')](0x194);}return _0x5f3474;};}function handleError(_0x3a67d7,_0x4b40f0){_0x4b40f0=_0x4b40f0||0x1f4;return function(_0x48f07a){logger[_0xfd92('0x28')](_0x48f07a[_0xfd92('0x29')]);if(_0x48f07a[_0xfd92('0x2a')]){delete _0x48f07a[_0xfd92('0x2a')];}_0x3a67d7[_0xfd92('0x20')](_0x4b40f0)[_0xfd92('0x2b')](_0x48f07a);};}exports['index']=function(_0x9d933,_0x2b467a){var _0x4903bf={},_0x52da2a={},_0x3264f6={'count':0x0,'rows':[]};var _0x272bc9=_['map'](db['SalesforceField']['rawAttributes'],function(_0x2d22f0){return{'name':_0x2d22f0[_0xfd92('0x2c')],'type':_0x2d22f0['type'][_0xfd92('0x2d')]};});_0x52da2a[_0xfd92('0x2e')]=_['map'](_0x272bc9,_0xfd92('0x2a'));_0x52da2a['query']=_[_0xfd92('0x2f')](_0x9d933[_0xfd92('0x30')]);_0x52da2a[_0xfd92('0x31')]=_[_0xfd92('0x32')](_0x52da2a['model'],_0x52da2a['query']);_0x4903bf[_0xfd92('0x33')]=_[_0xfd92('0x32')](_0x52da2a[_0xfd92('0x2e')],qs['fields'](_0x9d933[_0xfd92('0x30')][_0xfd92('0x34')]));_0x4903bf[_0xfd92('0x33')]=_0x4903bf['attributes'][_0xfd92('0x35')]?_0x4903bf['attributes']:_0x52da2a['model'];if(!_0x9d933['query']['hasOwnProperty'](_0xfd92('0x36'))){_0x4903bf[_0xfd92('0x1e')]=qs['limit'](_0x9d933['query'][_0xfd92('0x1e')]);_0x4903bf['offset']=qs[_0xfd92('0x1c')](_0x9d933[_0xfd92('0x30')]['offset']);}_0x4903bf[_0xfd92('0x37')]=qs[_0xfd92('0x38')](_0x9d933[_0xfd92('0x30')][_0xfd92('0x38')]);_0x4903bf[_0xfd92('0x39')]=qs[_0xfd92('0x31')](_[_0xfd92('0x3a')](_0x9d933[_0xfd92('0x30')],_0x52da2a['filters']),_0x272bc9);if(_0x9d933['query'][_0xfd92('0x3b')]){_0x4903bf['where']=_[_0xfd92('0x3c')](_0x4903bf['where'],{'$or':_['map'](_0x272bc9,function(_0x371fb8){if(_0x371fb8[_0xfd92('0x3d')]!==_0xfd92('0x3e')){var _0x5e22f9={};_0x5e22f9[_0x371fb8['name']]={'$like':'%'+_0x9d933[_0xfd92('0x30')][_0xfd92('0x3b')]+'%'};return _0x5e22f9;}})});}_0x4903bf=_[_0xfd92('0x3c')]({},_0x4903bf,_0x9d933[_0xfd92('0x3f')]);var _0x273649={'where':_0x4903bf[_0xfd92('0x39')]};return db['SalesforceField']['count'](_0x273649)[_0xfd92('0x27')](function(_0x213210){_0x3264f6[_0xfd92('0x1f')]=_0x213210;if(_0x9d933['query']['includeAll']){_0x4903bf[_0xfd92('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0xfd92('0x41')](_0x4903bf);})[_0xfd92('0x27')](function(_0x332f58){_0x3264f6[_0xfd92('0x42')]=_0x332f58;return _0x3264f6;})[_0xfd92('0x27')](respondWithFilteredResult(_0x2b467a,_0x4903bf))[_0xfd92('0x43')](handleError(_0x2b467a,null));};exports[_0xfd92('0x44')]=function(_0x52fcfb,_0x5d7e27){var _0x5af4c7={'raw':!![],'where':{'id':_0x52fcfb[_0xfd92('0x45')]['id']}},_0x553649={};_0x553649[_0xfd92('0x2e')]=_['keys'](db[_0xfd92('0x46')][_0xfd92('0x47')]);_0x553649['query']=_[_0xfd92('0x2f')](_0x52fcfb[_0xfd92('0x30')]);_0x553649[_0xfd92('0x31')]=_[_0xfd92('0x32')](_0x553649[_0xfd92('0x2e')],_0x553649[_0xfd92('0x30')]);_0x5af4c7[_0xfd92('0x33')]=_[_0xfd92('0x32')](_0x553649[_0xfd92('0x2e')],qs['fields'](_0x52fcfb['query'][_0xfd92('0x34')]));_0x5af4c7[_0xfd92('0x33')]=_0x5af4c7[_0xfd92('0x33')]['length']?_0x5af4c7[_0xfd92('0x33')]:_0x553649['model'];if(_0x52fcfb[_0xfd92('0x30')][_0xfd92('0x48')]){_0x5af4c7[_0xfd92('0x40')]=[{'all':!![]}];}_0x5af4c7=_[_0xfd92('0x3c')]({},_0x5af4c7,_0x52fcfb[_0xfd92('0x3f')]);return db['SalesforceField'][_0xfd92('0x49')](_0x5af4c7)[_0xfd92('0x27')](handleEntityNotFound(_0x5d7e27,null))[_0xfd92('0x27')](respondWithResult(_0x5d7e27,null))['catch'](handleError(_0x5d7e27,null));};exports[_0xfd92('0x4a')]=function(_0x54b356,_0x16ab45){return db[_0xfd92('0x46')]['create'](_0x54b356[_0xfd92('0x4b')],{})[_0xfd92('0x27')](respondWithResult(_0x16ab45,0xc9))[_0xfd92('0x43')](handleError(_0x16ab45,null));};exports[_0xfd92('0x4c')]=function(_0xefc095,_0x32df47){if(_0xefc095[_0xfd92('0x4b')]['id']){delete _0xefc095[_0xfd92('0x4b')]['id'];}return db['SalesforceField'][_0xfd92('0x49')]({'where':{'id':_0xefc095[_0xfd92('0x45')]['id']}})[_0xfd92('0x27')](handleEntityNotFound(_0x32df47,null))[_0xfd92('0x27')](saveUpdates(_0xefc095[_0xfd92('0x4b')],null))['then'](respondWithResult(_0x32df47,null))[_0xfd92('0x43')](handleError(_0x32df47,null));};exports['destroy']=function(_0xd9b9d1,_0x21a4d0){return db[_0xfd92('0x46')][_0xfd92('0x49')]({'where':{'id':_0xd9b9d1[_0xfd92('0x45')]['id']}})[_0xfd92('0x27')](handleEntityNotFound(_0x21a4d0,null))[_0xfd92('0x27')](removeEntity(_0x21a4d0,null))['catch'](handleError(_0x21a4d0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index afb3226..ad1f805 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 _0x54b8=['bluebird','request-promise','path','rimraf','exports','define','int_salesforce_fields','salesforce_unique_index','idField','../../config/logger','moment'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x54b8,0x106));var _0x854b=function(_0x244fac,_0x20b1b8){_0x244fac=_0x244fac-0x0;var _0x1056f7=_0x54b8[_0x244fac];return _0x1056f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x854b('0x0'))('api');var moment=require(_0x854b('0x1'));var BPromise=require(_0x854b('0x2'));var rp=require(_0x854b('0x3'));var fs=require('fs');var path=require(_0x854b('0x4'));var rimraf=require(_0x854b('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x854b('0x6')]=function(_0x4d4a3e,_0xea0f19){return _0x4d4a3e[_0x854b('0x7')]('SalesforceField',attributes,{'tableName':_0x854b('0x8'),'paranoid':![],'indexes':[{'name':_0x854b('0x9'),'fields':[_0x854b('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf701=['bluebird','request-promise','path','exports','define','int_salesforce_fields','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x13d1cd,_0x159be9){var _0x1d074b=function(_0x13bf72){while(--_0x13bf72){_0x13d1cd['push'](_0x13d1cd['shift']());}};_0x1d074b(++_0x159be9);}(_0xf701,0x103));var _0x1f70=function(_0x5b31e0,_0x36a714){_0x5b31e0=_0x5b31e0-0x0;var _0xc16b2=_0xf701[_0x5b31e0];return _0xc16b2;};'use strict';var _=require(_0x1f70('0x0'));var util=require(_0x1f70('0x1'));var logger=require(_0x1f70('0x2'))(_0x1f70('0x3'));var moment=require(_0x1f70('0x4'));var BPromise=require(_0x1f70('0x5'));var rp=require(_0x1f70('0x6'));var fs=require('fs');var path=require(_0x1f70('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x1f70('0x8')]=function(_0x429d2c,_0x265876){return _0x429d2c[_0x1f70('0x9')]('SalesforceField',attributes,{'tableName':_0x1f70('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x1f70('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index ac8c72d..a0221c0 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 _0x3842=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x5d3676,_0x24edeb){var _0x504f5b=function(_0x5ab2b4){while(--_0x5ab2b4){_0x5d3676['push'](_0x5d3676['shift']());}};_0x504f5b(++_0x24edeb);}(_0x3842,0x16f));var _0x2384=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3842[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x2384('0x0'));var util=require(_0x2384('0x1'));var moment=require(_0x2384('0x2'));var BPromise=require(_0x2384('0x3'));var rs=require(_0x2384('0x4'));var fs=require('fs');var Redis=require(_0x2384('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2384('0x6'));var logger=require(_0x2384('0x7'))('rpc');var config=require(_0x2384('0x8'));var jayson=require(_0x2384('0x9'));var client=jayson[_0x2384('0xa')][_0x2384('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ef2af,_0x2c9618,_0x5b6d16){return new BPromise(function(_0xe8f519,_0x112255){return client[_0x2384('0xc')](_0x4ef2af,_0x5b6d16)[_0x2384('0xd')](function(_0x420613){logger[_0x2384('0xe')](_0x2384('0xf'),_0x2c9618,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2c9618,'request\x20sent',JSON[_0x2384('0x10')](_0x420613));if(_0x420613[_0x2384('0x11')]){if(_0x420613['error'][_0x2384('0x12')]===0x1f4){logger[_0x2384('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2c9618,_0x420613[_0x2384('0x11')]['message']);return _0x112255(_0x420613[_0x2384('0x11')][_0x2384('0x13')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x2c9618,_0x420613['error'][_0x2384('0x13')]);return _0xe8f519(_0x420613[_0x2384('0x11')]['message']);}else{logger[_0x2384('0xe')](_0x2384('0xf'),_0x2c9618,_0x2384('0x14'));_0xe8f519(_0x420613[_0x2384('0x15')][_0x2384('0x13')]);}})[_0x2384('0x16')](function(_0x1816aa){logger[_0x2384('0x11')](_0x2384('0xf'),_0x2c9618,_0x1816aa);_0x112255(_0x1816aa);});});} \ No newline at end of file +var _0xa0a7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment'];(function(_0x2010f8,_0x424855){var _0xa3b9c0=function(_0x202c9b){while(--_0x202c9b){_0x2010f8['push'](_0x2010f8['shift']());}};_0xa3b9c0(++_0x424855);}(_0xa0a7,0x7c));var _0x7a0a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa0a7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7a0a('0x0'));var util=require('util');var moment=require(_0x7a0a('0x1'));var BPromise=require(_0x7a0a('0x2'));var rs=require(_0x7a0a('0x3'));var fs=require('fs');var Redis=require(_0x7a0a('0x4'));var db=require(_0x7a0a('0x5'))['db'];var utils=require(_0x7a0a('0x6'));var logger=require(_0x7a0a('0x7'))(_0x7a0a('0x8'));var config=require(_0x7a0a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7a0a('0xa')][_0x7a0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x249907,_0x44d210,_0x1af056){return new BPromise(function(_0x46d6e3,_0x1af59d){return client['request'](_0x249907,_0x1af056)['then'](function(_0x2dee32){logger['info'](_0x7a0a('0xc'),_0x44d210,_0x7a0a('0xd'));logger['debug'](_0x7a0a('0xe'),_0x44d210,_0x7a0a('0xd'),JSON[_0x7a0a('0xf')](_0x2dee32));if(_0x2dee32[_0x7a0a('0x10')]){if(_0x2dee32[_0x7a0a('0x10')][_0x7a0a('0x11')]===0x1f4){logger['error'](_0x7a0a('0xc'),_0x44d210,_0x2dee32[_0x7a0a('0x10')]['message']);return _0x1af59d(_0x2dee32[_0x7a0a('0x10')]['message']);}logger[_0x7a0a('0x10')](_0x7a0a('0xc'),_0x44d210,_0x2dee32[_0x7a0a('0x10')][_0x7a0a('0x12')]);return _0x46d6e3(_0x2dee32[_0x7a0a('0x10')][_0x7a0a('0x12')]);}else{logger[_0x7a0a('0x13')](_0x7a0a('0xc'),_0x44d210,_0x7a0a('0xd'));_0x46d6e3(_0x2dee32['result'][_0x7a0a('0x12')]);}})[_0x7a0a('0x14')](function(_0xc2d802){logger[_0x7a0a('0x10')](_0x7a0a('0xc'),_0x44d210,_0xc2d802);_0x1af59d(_0xc2d802);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 32b9166..a7a209d 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 _0x613f=['Router','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5e8bd0,_0x5bed26){var _0x4dcc62=function(_0x52133a){while(--_0x52133a){_0x5e8bd0['push'](_0x5e8bd0['shift']());}};_0x4dcc62(++_0x5bed26);}(_0x613f,0x6d));var _0xf613=function(_0x23d286,_0x2edfb5){_0x23d286=_0x23d286-0x0;var _0x2d6e80=_0x613f[_0x23d286];return _0x2d6e80;};'use strict';var multer=require(_0xf613('0x0'));var util=require(_0xf613('0x1'));var path=require(_0xf613('0x2'));var timeout=require(_0xf613('0x3'));var express=require(_0xf613('0x4'));var router=express[_0xf613('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf613('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf613('0x7'));router[_0xf613('0x8')]('/',auth[_0xf613('0x9')](),controller[_0xf613('0xa')]);router[_0xf613('0x8')](_0xf613('0xb'),auth[_0xf613('0x9')](),controller['show']);router[_0xf613('0x8')]('/:id/configurations',auth[_0xf613('0x9')](),controller['getConfigurations']);router[_0xf613('0x8')](_0xf613('0xc'),auth['isAuthenticated'](),controller[_0xf613('0xd')]);router[_0xf613('0xe')]('/',auth[_0xf613('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0xf613('0x9')](),controller[_0xf613('0xf')]);router[_0xf613('0x10')](_0xf613('0xb'),auth[_0xf613('0x9')](),controller['update']);router[_0xf613('0x11')](_0xf613('0xb'),auth[_0xf613('0x9')](),controller[_0xf613('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5eb1=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','/:id'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x5eb1,0x7c));var _0x15eb=function(_0x1614c2,_0x1fccfc){_0x1614c2=_0x1614c2-0x0;var _0x182c4c=_0x5eb1[_0x1614c2];return _0x182c4c;};'use strict';var multer=require('multer');var util=require(_0x15eb('0x0'));var path=require(_0x15eb('0x1'));var timeout=require(_0x15eb('0x2'));var express=require(_0x15eb('0x3'));var router=express[_0x15eb('0x4')]();var fs_extra=require(_0x15eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x15eb('0x6'));var config=require(_0x15eb('0x7'));var controller=require(_0x15eb('0x8'));router[_0x15eb('0x9')]('/',auth['isAuthenticated'](),controller[_0x15eb('0xa')]);router[_0x15eb('0x9')]('/:id',auth[_0x15eb('0xb')](),controller[_0x15eb('0xc')]);router[_0x15eb('0x9')](_0x15eb('0xd'),auth[_0x15eb('0xb')](),controller[_0x15eb('0xe')]);router[_0x15eb('0x9')](_0x15eb('0xf'),auth[_0x15eb('0xb')](),controller[_0x15eb('0x10')]);router[_0x15eb('0x11')]('/',auth[_0x15eb('0xb')](),controller[_0x15eb('0x12')]);router['post'](_0x15eb('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x15eb('0x13'),auth[_0x15eb('0xb')](),controller[_0x15eb('0x14')]);router[_0x15eb('0x15')]('/:id',auth[_0x15eb('0xb')](),controller[_0x15eb('0x16')]);module[_0x15eb('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 924aee1..b9e938d 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 _0x9ac3=['STRING','username','remoteUri','sequelize'];(function(_0x3f7a7f,_0x3b92f2){var _0x22739a=function(_0x1faa88){while(--_0x1faa88){_0x3f7a7f['push'](_0x3f7a7f['shift']());}};_0x22739a(++_0x3b92f2);}(_0x9ac3,0x1bb));var _0x39ac=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x9ac3[_0x35d4e9];return _0x5c2770;};'use strict';var Sequelize=require(_0x39ac('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x39ac('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x39ac('0x2')},'password':{'type':Sequelize[_0x39ac('0x1')]},'email':{'type':Sequelize[_0x39ac('0x1')]},'remoteUri':{'type':Sequelize[_0x39ac('0x1')],'unique':_0x39ac('0x3')},'serverUrl':{'type':Sequelize[_0x39ac('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x80b8=['remoteUri','STRING','username'];(function(_0x2ef2ce,_0x5a0547){var _0x37daf0=function(_0x5e6142){while(--_0x5e6142){_0x2ef2ce['push'](_0x2ef2ce['shift']());}};_0x37daf0(++_0x5a0547);}(_0x80b8,0x133));var _0x880b=function(_0x36162e,_0x3a1e2a){_0x36162e=_0x36162e-0x0;var _0x3fe909=_0x80b8[_0x36162e];return _0x3fe909;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x880b('0x0')],'unique':_0x880b('0x1')},'password':{'type':Sequelize[_0x880b('0x0')]},'email':{'type':Sequelize[_0x880b('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x880b('0x2')},'serverUrl':{'type':Sequelize[_0x880b('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a4ce367..3cf4969 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 _0x907d=['description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','reassignment_count','activity_due','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','internalType','push','all','label','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','status','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','watch_list','child_incidents','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','opened_at','business_duration','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x907d,0xef));var _0xd907=function(_0x383627,_0x5be16e){_0x383627=_0x383627-0x0;var _0x2c16a0=_0x907d[_0x383627];return _0x2c16a0;};'use strict';var emlformat=require(_0xd907('0x0'));var rimraf=require(_0xd907('0x1'));var zipdir=require(_0xd907('0x2'));var jsonpatch=require(_0xd907('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd907('0x4'));var Mustache=require('mustache');var util=require(_0xd907('0x5'));var path=require(_0xd907('0x6'));var sox=require(_0xd907('0x7'));var csv=require(_0xd907('0x8'));var ejs=require(_0xd907('0x9'));var fs=require('fs');var fs_extra=require(_0xd907('0xa'));var _=require(_0xd907('0xb'));var squel=require(_0xd907('0xc'));var crypto=require(_0xd907('0xd'));var jsforce=require(_0xd907('0xe'));var deskjs=require(_0xd907('0xf'));var toCsv=require(_0xd907('0x8'));var querystring=require(_0xd907('0x10'));var Papa=require(_0xd907('0x11'));var Redis=require(_0xd907('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd907('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd907('0x14'))(_0xd907('0x15'));var utils=require(_0xd907('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd907('0x17'));var db=require(_0xd907('0x18'))['db'];var integrations=require(_0xd907('0x19'));function respondWithStatusCode(_0xee2592,_0x4205e3){_0x4205e3=_0x4205e3||0xcc;return function(_0x48ac14){if(_0x48ac14){return _0xee2592[_0xd907('0x1a')](_0x4205e3);}return _0xee2592['status'](_0x4205e3)[_0xd907('0x1b')]();};}function respondWithResult(_0x2e04e9,_0x1cde0b){_0x1cde0b=_0x1cde0b||0xc8;return function(_0x3732a5){if(_0x3732a5){return _0x2e04e9['status'](_0x1cde0b)['json'](_0x3732a5);}};}function respondWithFilteredResult(_0x1be2d2,_0x281949){return function(_0x23d02e){if(_0x23d02e){var _0x1f5f9a=typeof _0x281949[_0xd907('0x1c')]===_0xd907('0x1d')&&typeof _0x281949[_0xd907('0x1e')]==='undefined';var _0x2d75a6=_0x23d02e[_0xd907('0x1f')];var _0x4968a4=_0x1f5f9a?0x0:_0x281949[_0xd907('0x1c')];var _0x52db57=_0x1f5f9a?_0x23d02e[_0xd907('0x1f')]:_0x281949['offset']+_0x281949[_0xd907('0x1e')];var _0x518b50;if(_0x52db57>=_0x2d75a6){_0x52db57=_0x2d75a6;_0x518b50=0xc8;}else{_0x518b50=0xce;}_0x1be2d2['status'](_0x518b50);return _0x1be2d2['set'](_0xd907('0x20'),_0x4968a4+'-'+_0x52db57+'/'+_0x2d75a6)[_0xd907('0x21')](_0x23d02e);}return null;};}function patchUpdates(_0x505a9e){return function(_0x142b1e){try{jsonpatch[_0xd907('0x22')](_0x142b1e,_0x505a9e,!![]);}catch(_0x4e936e){return BPromise[_0xd907('0x23')](_0x4e936e);}return _0x142b1e['save']();};}function saveUpdates(_0x51e83e,_0x3ba993){return function(_0x43f391){if(_0x43f391){return _0x43f391['update'](_0x51e83e)[_0xd907('0x24')](function(_0x3f6b42){return _0x3f6b42;});}return null;};}function removeEntity(_0x90b00,_0x4eff7e){return function(_0x3465a7){if(_0x3465a7){return _0x3465a7[_0xd907('0x25')]()[_0xd907('0x24')](function(){_0x90b00[_0xd907('0x26')](0xcc)[_0xd907('0x1b')]();});}};}function handleEntityNotFound(_0x136567,_0x5a23c9){return function(_0x4853b3){if(!_0x4853b3){_0x136567[_0xd907('0x1a')](0x194);}return _0x4853b3;};}function handleError(_0x2f491d,_0x4e8299){_0x4e8299=_0x4e8299||0x1f4;return function(_0x4da7d3){logger[_0xd907('0x27')](_0x4da7d3[_0xd907('0x28')]);if(_0x4da7d3[_0xd907('0x29')]){delete _0x4da7d3[_0xd907('0x29')];}_0x2f491d[_0xd907('0x26')](_0x4e8299)[_0xd907('0x2a')](_0x4da7d3);};}exports[_0xd907('0x2b')]=function(_0xd44bf7,_0x4d5108){var _0x11239f={},_0x465352={},_0x57c997={'count':0x0,'rows':[]};var _0x559884=_[_0xd907('0x2c')](db['ServicenowAccount'][_0xd907('0x2d')],function(_0x3d6200){return{'name':_0x3d6200['fieldName'],'type':_0x3d6200['type'][_0xd907('0x2e')]};});_0x465352[_0xd907('0x2f')]=_[_0xd907('0x2c')](_0x559884,_0xd907('0x29'));_0x465352[_0xd907('0x30')]=_[_0xd907('0x31')](_0xd44bf7['query']);_0x465352[_0xd907('0x32')]=_[_0xd907('0x33')](_0x465352['model'],_0x465352[_0xd907('0x30')]);_0x11239f[_0xd907('0x34')]=_[_0xd907('0x33')](_0x465352['model'],qs[_0xd907('0x35')](_0xd44bf7[_0xd907('0x30')][_0xd907('0x35')]));_0x11239f['attributes']=_0x11239f[_0xd907('0x34')][_0xd907('0x36')]?_0x11239f[_0xd907('0x34')]:_0x465352[_0xd907('0x2f')];if(!_0xd44bf7[_0xd907('0x30')][_0xd907('0x37')](_0xd907('0x38'))){_0x11239f['limit']=qs[_0xd907('0x1e')](_0xd44bf7[_0xd907('0x30')][_0xd907('0x1e')]);_0x11239f[_0xd907('0x1c')]=qs['offset'](_0xd44bf7['query'][_0xd907('0x1c')]);}_0x11239f['order']=qs[_0xd907('0x39')](_0xd44bf7[_0xd907('0x30')][_0xd907('0x39')]);_0x11239f['where']=qs['filters'](_[_0xd907('0x3a')](_0xd44bf7['query'],_0x465352[_0xd907('0x32')]),_0x559884);if(_0xd44bf7[_0xd907('0x30')][_0xd907('0x3b')]){_0x11239f[_0xd907('0x3c')]=_[_0xd907('0x3d')](_0x11239f['where'],{'$or':_[_0xd907('0x2c')](_0x559884,function(_0x551f8f){if(_0x551f8f[_0xd907('0x3e')]!==_0xd907('0x3f')){var _0x37eed7={};_0x37eed7[_0x551f8f[_0xd907('0x29')]]={'$like':'%'+_0xd44bf7[_0xd907('0x30')][_0xd907('0x3b')]+'%'};return _0x37eed7;}})});}_0x11239f=_['merge']({},_0x11239f,_0xd44bf7[_0xd907('0x40')]);var _0x451728={'where':_0x11239f[_0xd907('0x3c')]};return db[_0xd907('0x41')]['count'](_0x451728)[_0xd907('0x24')](function(_0x3c043e){_0x57c997['count']=_0x3c043e;if(_0xd44bf7['query'][_0xd907('0x42')]){_0x11239f[_0xd907('0x43')]=[{'all':!![]}];}return db[_0xd907('0x41')][_0xd907('0x44')](_0x11239f);})[_0xd907('0x24')](function(_0x19a60e){_0x57c997[_0xd907('0x45')]=_0x19a60e;return _0x57c997;})[_0xd907('0x24')](respondWithFilteredResult(_0x4d5108,_0x11239f))[_0xd907('0x46')](handleError(_0x4d5108,null));};exports[_0xd907('0x47')]=function(_0x390add,_0x16a79c){var _0x26a5d8={'raw':![],'where':{'id':_0x390add[_0xd907('0x48')]['id']}},_0xb98fa1={};_0xb98fa1['model']=_['keys'](db['ServicenowAccount'][_0xd907('0x2d')]);_0xb98fa1[_0xd907('0x30')]=_['keys'](_0x390add['query']);_0xb98fa1[_0xd907('0x32')]=_[_0xd907('0x33')](_0xb98fa1[_0xd907('0x2f')],_0xb98fa1[_0xd907('0x30')]);_0x26a5d8['attributes']=_['intersection'](_0xb98fa1[_0xd907('0x2f')],qs[_0xd907('0x35')](_0x390add['query'][_0xd907('0x35')]));_0x26a5d8[_0xd907('0x34')]=_0x26a5d8['attributes']['length']?_0x26a5d8[_0xd907('0x34')]:_0xb98fa1[_0xd907('0x2f')];if(_0x390add['query']['includeAll']){_0x26a5d8[_0xd907('0x43')]=[{'all':!![]}];}_0x26a5d8=_[_0xd907('0x3d')]({},_0x26a5d8,_0x390add[_0xd907('0x40')]);return db[_0xd907('0x41')]['find'](_0x26a5d8)[_0xd907('0x24')](handleEntityNotFound(_0x16a79c,null))[_0xd907('0x24')](respondWithResult(_0x16a79c,null))[_0xd907('0x46')](handleError(_0x16a79c,null));};exports[_0xd907('0x49')]=function(_0x329ffb,_0x4b4e43){return db['ServicenowAccount'][_0xd907('0x49')](_0x329ffb[_0xd907('0x4a')],{})[_0xd907('0x24')](respondWithResult(_0x4b4e43,0xc9))[_0xd907('0x46')](handleError(_0x4b4e43,null));};exports[_0xd907('0x4b')]=function(_0x497db8,_0x536159){if(_0x497db8[_0xd907('0x4a')]['id']){delete _0x497db8[_0xd907('0x4a')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x497db8[_0xd907('0x48')]['id']}})['then'](handleEntityNotFound(_0x536159,null))['then'](saveUpdates(_0x497db8['body'],null))[_0xd907('0x24')](respondWithResult(_0x536159,null))[_0xd907('0x46')](handleError(_0x536159,null));};exports[_0xd907('0x25')]=function(_0x1b73b9,_0xb0b79b){return db[_0xd907('0x41')][_0xd907('0x4c')]({'where':{'id':_0x1b73b9['params']['id']}})[_0xd907('0x24')](handleEntityNotFound(_0xb0b79b,null))['then'](removeEntity(_0xb0b79b,null))['catch'](handleError(_0xb0b79b,null));};exports[_0xd907('0x4d')]=function(_0x285a15,_0x357802,_0x5d5333){var _0x1b4ef0={};var _0x453748={};var _0x40f863;var _0x5b6318;return db['ServicenowAccount']['findOne']({'where':{'id':_0x285a15[_0xd907('0x48')]['id']}})[_0xd907('0x24')](handleEntityNotFound(_0x357802,null))[_0xd907('0x24')](function(_0x46890f){if(_0x46890f){_0x40f863=_0x46890f;_0x453748['model']=_[_0xd907('0x31')](db['ServicenowConfiguration'][_0xd907('0x2d')]);_0x453748['query']=_[_0xd907('0x31')](_0x285a15['query']);_0x453748[_0xd907('0x32')]=_[_0xd907('0x33')](_0x453748['model'],_0x453748[_0xd907('0x30')]);_0x1b4ef0[_0xd907('0x34')]=_[_0xd907('0x33')](_0x453748['model'],qs[_0xd907('0x35')](_0x285a15['query']['fields']));_0x1b4ef0[_0xd907('0x34')]=_0x1b4ef0[_0xd907('0x34')][_0xd907('0x36')]?_0x1b4ef0[_0xd907('0x34')]:_0x453748[_0xd907('0x2f')];_0x1b4ef0[_0xd907('0x4e')]=qs[_0xd907('0x39')](_0x285a15[_0xd907('0x30')][_0xd907('0x39')]);_0x1b4ef0['where']=qs[_0xd907('0x32')](_[_0xd907('0x3a')](_0x285a15[_0xd907('0x30')],_0x453748[_0xd907('0x32')]));if(_0x285a15['query'][_0xd907('0x3b')]){_0x1b4ef0[_0xd907('0x3c')]=_[_0xd907('0x3d')](_0x1b4ef0['where'],{'$or':_['map'](_0x1b4ef0['attributes'],function(_0x57b542){var _0x1dd77e={};_0x1dd77e[_0x57b542]={'$like':'%'+_0x285a15[_0xd907('0x30')][_0xd907('0x3b')]+'%'};return _0x1dd77e;})});}_0x1b4ef0=_['merge']({},_0x1b4ef0,_0x285a15['options']);return _0x40f863[_0xd907('0x4d')](_0x1b4ef0);}})[_0xd907('0x24')](function(_0x14d6f6){if(_0x14d6f6){_0x5b6318=_0x14d6f6['length'];if(!_0x285a15[_0xd907('0x30')][_0xd907('0x37')](_0xd907('0x38'))){_0x1b4ef0['limit']=qs[_0xd907('0x1e')](_0x285a15[_0xd907('0x30')][_0xd907('0x1e')]);_0x1b4ef0['offset']=qs[_0xd907('0x1c')](_0x285a15['query']['offset']);}return _0x40f863[_0xd907('0x4d')](_0x1b4ef0);}})[_0xd907('0x24')](function(_0x117c74){if(_0x117c74){return _0x117c74?{'count':_0x5b6318,'rows':_0x117c74}:null;}})['then'](respondWithResult(_0x357802,null))[_0xd907('0x46')](handleError(_0x357802,null));};exports[_0xd907('0x4f')]=function(_0xde1dc1,_0x2884e2,_0xd9a688){if(_0xde1dc1[_0xd907('0x4a')]['id']){delete _0xde1dc1[_0xd907('0x4a')]['id'];}return db[_0xd907('0x41')][_0xd907('0x50')]({'where':{'id':_0xde1dc1[_0xd907('0x48')]['id']}})[_0xd907('0x24')](handleEntityNotFound(_0x2884e2,null))[_0xd907('0x24')](function(_0x113061){if(_0x113061){_0xde1dc1['body'][_0xd907('0x51')]=_0x113061['id'];_0xde1dc1[_0xd907('0x4a')][_0xd907('0x52')]=integrations['getSubjects'](_0xde1dc1[_0xd907('0x4a')][_0xd907('0x53')],_0xde1dc1[_0xd907('0x4a')][_0xd907('0x3e')]);_0xde1dc1[_0xd907('0x4a')][_0xd907('0x54')]=integrations['getDescriptions'](_0xde1dc1[_0xd907('0x4a')]['channel'],_0xde1dc1['body'][_0xd907('0x3e')]);return db[_0xd907('0x55')][_0xd907('0x49')](_0xde1dc1[_0xd907('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0xd907('0x52')},{'model':db[_0xd907('0x56')],'as':_0xd907('0x54')}]});}return null;})[_0xd907('0x24')](respondWithResult(_0x2884e2,null))[_0xd907('0x46')](handleError(_0x2884e2,null));};exports[_0xd907('0x57')]=function(_0x2a4be4,_0x5cec1d,_0x2ae943){var _0xb182de=[_0xd907('0x58'),_0xd907('0x59'),_0xd907('0x5a'),_0xd907('0x5b'),_0xd907('0x5c'),_0xd907('0x5d'),_0xd907('0x5e'),_0xd907('0x5f'),_0xd907('0x60')];var _0x5320d9=[_0xd907('0x61'),_0xd907('0x58'),'caused_by',_0xd907('0x62'),'upon_reject','sys_updated_on',_0xd907('0x63'),_0xd907('0x59'),'approval_history',_0xd907('0x64'),'resolved_by',_0xd907('0x65'),'opened_by',_0xd907('0x66'),_0xd907('0x67'),_0xd907('0x68'),_0xd907('0x69'),_0xd907('0x6a'),_0xd907('0x5a'),_0xd907('0x4e'),'calendar_stc',_0xd907('0x6b'),_0xd907('0x6c'),_0xd907('0x6d'),_0xd907('0x6e'),_0xd907('0x6f'),_0xd907('0x70'),_0xd907('0x71'),_0xd907('0x72'),'sys_domain_path',_0xd907('0x73'),_0xd907('0x74'),'expected_start',_0xd907('0x75'),_0xd907('0x76'),'group_list','work_end',_0xd907('0x77'),_0xd907('0x78'),'caller_id',_0xd907('0x79'),'subcategory',_0xd907('0x7a'),_0xd907('0x7b'),_0xd907('0x5c'),_0xd907('0x7c'),_0xd907('0x7d'),_0xd907('0x7e'),_0xd907('0x7f'),'business_stc',_0xd907('0x80'),_0xd907('0x81'),_0xd907('0x82'),_0xd907('0x5d'),_0xd907('0x83'),_0xd907('0x84'),'closed_by',_0xd907('0x85'),_0xd907('0x86'),_0xd907('0x87'),_0xd907('0x88'),_0xd907('0x89'),'incident_state',_0xd907('0x8a'),'problem_id','company',_0xd907('0x8b'),_0xd907('0x8c'),'assigned_to',_0xd907('0x5f'),_0xd907('0x8d'),'sla_due',_0xd907('0x8e'),_0xd907('0x8f'),_0xd907('0x90'),_0xd907('0x91'),_0xd907('0x92'),_0xd907('0x93'),_0xd907('0x94'),'upon_approval','correlation_id',_0xd907('0x95'),_0xd907('0x60')];var _0x555dfa='';var _0x426be='';var _0xcff1d9=[];var _0x3bc44f='';var _0x10bb17='';var _0x4d4810=[];var _0x46126e='';var _0x4427a6='';var _0x118909={};var _0x474039='';return db[_0xd907('0x41')]['findOne']({'where':{'id':_0x2a4be4[_0xd907('0x48')]['id']},'attributes':['id','username','password','email','remoteUri','serverUrl']})[_0xd907('0x24')](handleEntityNotFound(_0x5cec1d,null))[_0xd907('0x24')](function(_0x46524d){if(_0x46524d){_0x474039=_0x46524d[_0xd907('0x96')];var _0x3cb22f=_0x474039[_0xd907('0x97')](-0x1);if(_0x3cb22f==='/'){_0x474039=_0x474039[_0xd907('0x98')](0x0,_0x474039[_0xd907('0x99')](_0x3cb22f));}_0x4427a6=util[_0xd907('0x9a')](_0xd907('0x9b'),_0x474039);_0x46126e=util[_0xd907('0x9a')](_0xd907('0x9c'),_0x474039);_0x118909={'user':_0x46524d[_0xd907('0x9d')],'pass':_0x46524d[_0xd907('0x9e')]};var _0x3f0bec={'method':_0xd907('0x9f'),'uri':_0x4427a6+_0xd907('0xa0'),'auth':_0x118909,'json':!![]};return rp(_0x3f0bec);}})[_0xd907('0x24')](function(_0x4bae71){if(_0x4bae71[_0xd907('0xa1')]['length']>0x0){_0x555dfa=_0x4bae71['result'];}console[_0xd907('0xa2')](_0xd907('0xa3'),_0x555dfa);_0x4d4810=[];_0x426be=Object[_0xd907('0xa4')]([],_0x555dfa);_[_0xd907('0xa5')](_0x426be,function(_0x3ecffb){return!_0xb182de['includes'](_0x3ecffb['name']);});_0x426be['forEach'](function(_0x123ae4){var _0x1ba500=createFieldObject(_0x46126e,_0x118909,_0x123ae4[_0xd907('0xa6')],_0x123ae4['name'],_0x123ae4['label'],![]);_0x4d4810[_0xd907('0xa7')](_0x1ba500);});return Promise[_0xd907('0xa8')](_0x4d4810);})['then'](function(_0x11b0c5){_0xcff1d9=_0x11b0c5;_0x3bc44f=Object['assign']([],_0x555dfa);console[_0xd907('0xa2')]('TCL:\x20_object',_0x555dfa);_[_0xd907('0xa5')](_0x3bc44f,function(_0xa9eb4e){return _0x5320d9['includes'](_0xa9eb4e[_0xd907('0x29')]);});console[_0xd907('0xa2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3bc44f);_0x4d4810=[];_0x3bc44f['forEach'](function(_0x420f59){var _0x38862e=createFieldObject(_0x46126e,_0x118909,_0x420f59[_0xd907('0xa6')],_0x420f59[_0xd907('0x29')],_0x420f59[_0xd907('0xa9')],!![]);_0x4d4810[_0xd907('0xa7')](_0x38862e);});return Promise['all'](_0x4d4810);})[_0xd907('0x24')](function(_0x491078){_0x10bb17=_0x491078;var _0x30501c=_0xcff1d9[_0xd907('0xaa')](_0x10bb17);return{'count':_0x30501c[_0xd907('0x36')],'rows':_0x30501c};})[_0xd907('0x24')](respondWithResult(_0x5cec1d,null))[_0xd907('0x46')](function(_0x464854){console[_0xd907('0xa2')](_0xd907('0xab')+_0x464854);var _0x1bdc60=_0x2a4be4['query'][_0xd907('0xac')]?0x1f4:_0x464854[_0xd907('0xad')]||0x1f4;logger['error'](_0x464854[_0xd907('0x28')]);delete _0x464854[_0xd907('0x29')];if(_0x1bdc60===0x191){_0x1bdc60=0x190;}_0x5cec1d[_0xd907('0x26')](_0x1bdc60)[_0xd907('0x2a')](_0x2a4be4[_0xd907('0x30')][_0xd907('0xac')]?{'message':_0xd907('0xae'),'statusCode':_0x464854['statusCode']}:_0x464854);});};function createFieldObject(_0x4dcb59,_0x23ed55,_0x57fcdd,_0x548d7d,_0x38face,_0x20fa96){return new Promise(function(_0x32fdad,_0x281da1){var _0x590f7f={'id':_0x548d7d,'name':_0x38face,'custom':_0x20fa96};if(_0x57fcdd===_0xd907('0xaf')){_0x590f7f['options']=[{'name':_0xd907('0xb0'),'value':_0xd907('0xb1')},{'name':_0xd907('0xb2'),'value':_0xd907('0xb3')}];_0x32fdad(_0x590f7f);}else{var _0x4cd911={'method':_0xd907('0x9f'),'uri':_0x4dcb59+_0xd907('0xb4')+_0x548d7d,'auth':_0x23ed55,'json':!![]};return rp(_0x4cd911)[_0xd907('0x24')](function(_0x5ef664){var _0x466c5e=[];if(_0x5ef664['result'][_0xd907('0x36')]>0x0){_0x5ef664[_0xd907('0xa1')][_0xd907('0xb5')](function(_0x10647d){if(_0x10647d[_0xd907('0xb6')]==='false'){var _0x5e2da0={'name':_0x10647d[_0xd907('0xa9')],'value':_0x10647d[_0xd907('0xb7')]};_0x466c5e[_0xd907('0xa7')](_0x5e2da0);}});}_0x590f7f[_0xd907('0x40')]=_0x466c5e;if(_0x590f7f[_0xd907('0x40')][_0xd907('0x36')]>0x0){_0x32fdad(_0x590f7f);}else{if(_0x20fa96==![]){_0x32fdad();}else{_0x32fdad(_0x590f7f);}}});}});} \ No newline at end of file +var _0xa613=['destroy','sendStatus','error','stack','send','map','ServicenowAccount','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','create','body','getConfigurations','ServicenowConfiguration','filter','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','subcategory','close_code','notify','caused_by','watch_list','upon_reject','child_incidents','hold_reason','approval_history','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','order','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','severity','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','category','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','false','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then'];(function(_0x125667,_0x285d9b){var _0x358682=function(_0x22ce75){while(--_0x22ce75){_0x125667['push'](_0x125667['shift']());}};_0x358682(++_0x285d9b);}(_0xa613,0x94));var _0x3a61=function(_0x4ccde3,_0x38ca57){_0x4ccde3=_0x4ccde3-0x0;var _0x3348ac=_0xa613[_0x4ccde3];return _0x3348ac;};'use strict';var emlformat=require(_0x3a61('0x0'));var rimraf=require(_0x3a61('0x1'));var zipdir=require(_0x3a61('0x2'));var jsonpatch=require(_0x3a61('0x3'));var rp=require('request-promise');var moment=require(_0x3a61('0x4'));var BPromise=require(_0x3a61('0x5'));var Mustache=require('mustache');var util=require(_0x3a61('0x6'));var path=require(_0x3a61('0x7'));var sox=require(_0x3a61('0x8'));var csv=require(_0x3a61('0x9'));var ejs=require(_0x3a61('0xa'));var fs=require('fs');var fs_extra=require(_0x3a61('0xb'));var _=require(_0x3a61('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3a61('0xd'));var deskjs=require(_0x3a61('0xe'));var toCsv=require(_0x3a61('0x9'));var querystring=require(_0x3a61('0xf'));var Papa=require(_0x3a61('0x10'));var Redis=require('ioredis');var authService=require(_0x3a61('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a61('0x12'));var hardwareService=require(_0x3a61('0x13'));var logger=require(_0x3a61('0x14'))(_0x3a61('0x15'));var utils=require(_0x3a61('0x16'));var config=require(_0x3a61('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a61('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x12449a,_0x1d9e99){_0x1d9e99=_0x1d9e99||0xcc;return function(_0x1a8197){if(_0x1a8197){return _0x12449a['sendStatus'](_0x1d9e99);}return _0x12449a['status'](_0x1d9e99)[_0x3a61('0x19')]();};}function respondWithResult(_0x52803f,_0x2ba702){_0x2ba702=_0x2ba702||0xc8;return function(_0x10c13b){if(_0x10c13b){return _0x52803f['status'](_0x2ba702)[_0x3a61('0x1a')](_0x10c13b);}};}function respondWithFilteredResult(_0x1fda08,_0x583495){return function(_0x361f7c){if(_0x361f7c){var _0x452e52=typeof _0x583495[_0x3a61('0x1b')]==='undefined'&&typeof _0x583495[_0x3a61('0x1c')]===_0x3a61('0x1d');var _0x3a231b=_0x361f7c['count'];var _0x159d06=_0x452e52?0x0:_0x583495[_0x3a61('0x1b')];var _0x2a125b=_0x452e52?_0x361f7c[_0x3a61('0x1e')]:_0x583495[_0x3a61('0x1b')]+_0x583495[_0x3a61('0x1c')];var _0x2efc6e;if(_0x2a125b>=_0x3a231b){_0x2a125b=_0x3a231b;_0x2efc6e=0xc8;}else{_0x2efc6e=0xce;}_0x1fda08[_0x3a61('0x1f')](_0x2efc6e);return _0x1fda08[_0x3a61('0x20')](_0x3a61('0x21'),_0x159d06+'-'+_0x2a125b+'/'+_0x3a231b)[_0x3a61('0x1a')](_0x361f7c);}return null;};}function patchUpdates(_0x27ebc6){return function(_0xf329e4){try{jsonpatch[_0x3a61('0x22')](_0xf329e4,_0x27ebc6,!![]);}catch(_0x4ed299){return BPromise[_0x3a61('0x23')](_0x4ed299);}return _0xf329e4[_0x3a61('0x24')]();};}function saveUpdates(_0x5bc03d,_0x32b12c){return function(_0x331578){if(_0x331578){return _0x331578[_0x3a61('0x25')](_0x5bc03d)[_0x3a61('0x26')](function(_0x1ca0b2){return _0x1ca0b2;});}return null;};}function removeEntity(_0x22253a,_0x17e1b5){return function(_0x5a4278){if(_0x5a4278){return _0x5a4278[_0x3a61('0x27')]()[_0x3a61('0x26')](function(){_0x22253a[_0x3a61('0x1f')](0xcc)[_0x3a61('0x19')]();});}};}function handleEntityNotFound(_0x1bce03,_0x2efd22){return function(_0x40fb66){if(!_0x40fb66){_0x1bce03[_0x3a61('0x28')](0x194);}return _0x40fb66;};}function handleError(_0x525439,_0x20782f){_0x20782f=_0x20782f||0x1f4;return function(_0xa0d889){logger[_0x3a61('0x29')](_0xa0d889[_0x3a61('0x2a')]);if(_0xa0d889['name']){delete _0xa0d889['name'];}_0x525439[_0x3a61('0x1f')](_0x20782f)[_0x3a61('0x2b')](_0xa0d889);};}exports['index']=function(_0x171403,_0x3a77af){var _0x3167e1={},_0x547d2f={},_0x597ed1={'count':0x0,'rows':[]};var _0x31d154=_[_0x3a61('0x2c')](db[_0x3a61('0x2d')]['rawAttributes'],function(_0x616319){return{'name':_0x616319[_0x3a61('0x2e')],'type':_0x616319[_0x3a61('0x2f')][_0x3a61('0x30')]};});_0x547d2f[_0x3a61('0x31')]=_[_0x3a61('0x2c')](_0x31d154,_0x3a61('0x32'));_0x547d2f[_0x3a61('0x33')]=_[_0x3a61('0x34')](_0x171403[_0x3a61('0x33')]);_0x547d2f[_0x3a61('0x35')]=_['intersection'](_0x547d2f[_0x3a61('0x31')],_0x547d2f[_0x3a61('0x33')]);_0x3167e1[_0x3a61('0x36')]=_[_0x3a61('0x37')](_0x547d2f[_0x3a61('0x31')],qs[_0x3a61('0x38')](_0x171403[_0x3a61('0x33')]['fields']));_0x3167e1[_0x3a61('0x36')]=_0x3167e1['attributes']['length']?_0x3167e1[_0x3a61('0x36')]:_0x547d2f[_0x3a61('0x31')];if(!_0x171403[_0x3a61('0x33')][_0x3a61('0x39')](_0x3a61('0x3a'))){_0x3167e1['limit']=qs['limit'](_0x171403['query'][_0x3a61('0x1c')]);_0x3167e1[_0x3a61('0x1b')]=qs['offset'](_0x171403[_0x3a61('0x33')][_0x3a61('0x1b')]);}_0x3167e1['order']=qs[_0x3a61('0x3b')](_0x171403[_0x3a61('0x33')][_0x3a61('0x3b')]);_0x3167e1[_0x3a61('0x3c')]=qs[_0x3a61('0x35')](_[_0x3a61('0x3d')](_0x171403[_0x3a61('0x33')],_0x547d2f[_0x3a61('0x35')]),_0x31d154);if(_0x171403[_0x3a61('0x33')]['filter']){_0x3167e1[_0x3a61('0x3c')]=_[_0x3a61('0x3e')](_0x3167e1[_0x3a61('0x3c')],{'$or':_['map'](_0x31d154,function(_0x1dccbf){if(_0x1dccbf[_0x3a61('0x2f')]!==_0x3a61('0x3f')){var _0x3cd168={};_0x3cd168[_0x1dccbf[_0x3a61('0x32')]]={'$like':'%'+_0x171403[_0x3a61('0x33')]['filter']+'%'};return _0x3cd168;}})});}_0x3167e1=_[_0x3a61('0x3e')]({},_0x3167e1,_0x171403[_0x3a61('0x40')]);var _0x2c2d45={'where':_0x3167e1['where']};return db[_0x3a61('0x2d')]['count'](_0x2c2d45)[_0x3a61('0x26')](function(_0x159f2f){_0x597ed1[_0x3a61('0x1e')]=_0x159f2f;if(_0x171403[_0x3a61('0x33')]['includeAll']){_0x3167e1[_0x3a61('0x41')]=[{'all':!![]}];}return db[_0x3a61('0x2d')][_0x3a61('0x42')](_0x3167e1);})[_0x3a61('0x26')](function(_0x573b2d){_0x597ed1['rows']=_0x573b2d;return _0x597ed1;})['then'](respondWithFilteredResult(_0x3a77af,_0x3167e1))[_0x3a61('0x43')](handleError(_0x3a77af,null));};exports[_0x3a61('0x44')]=function(_0x38c16e,_0xb8cd9){var _0x44d2c2={'raw':![],'where':{'id':_0x38c16e[_0x3a61('0x45')]['id']}},_0x505aaf={};_0x505aaf['model']=_[_0x3a61('0x34')](db['ServicenowAccount'][_0x3a61('0x46')]);_0x505aaf[_0x3a61('0x33')]=_[_0x3a61('0x34')](_0x38c16e[_0x3a61('0x33')]);_0x505aaf[_0x3a61('0x35')]=_[_0x3a61('0x37')](_0x505aaf[_0x3a61('0x31')],_0x505aaf[_0x3a61('0x33')]);_0x44d2c2[_0x3a61('0x36')]=_[_0x3a61('0x37')](_0x505aaf[_0x3a61('0x31')],qs['fields'](_0x38c16e['query'][_0x3a61('0x38')]));_0x44d2c2[_0x3a61('0x36')]=_0x44d2c2[_0x3a61('0x36')][_0x3a61('0x47')]?_0x44d2c2[_0x3a61('0x36')]:_0x505aaf[_0x3a61('0x31')];if(_0x38c16e['query'][_0x3a61('0x48')]){_0x44d2c2[_0x3a61('0x41')]=[{'all':!![]}];}_0x44d2c2=_[_0x3a61('0x3e')]({},_0x44d2c2,_0x38c16e['options']);return db['ServicenowAccount'][_0x3a61('0x49')](_0x44d2c2)[_0x3a61('0x26')](handleEntityNotFound(_0xb8cd9,null))[_0x3a61('0x26')](respondWithResult(_0xb8cd9,null))[_0x3a61('0x43')](handleError(_0xb8cd9,null));};exports[_0x3a61('0x4a')]=function(_0x3a7ae2,_0xe4582c){return db[_0x3a61('0x2d')][_0x3a61('0x4a')](_0x3a7ae2[_0x3a61('0x4b')],{})[_0x3a61('0x26')](respondWithResult(_0xe4582c,0xc9))[_0x3a61('0x43')](handleError(_0xe4582c,null));};exports[_0x3a61('0x25')]=function(_0x350174,_0x3523c4){if(_0x350174['body']['id']){delete _0x350174[_0x3a61('0x4b')]['id'];}return db[_0x3a61('0x2d')]['find']({'where':{'id':_0x350174[_0x3a61('0x45')]['id']}})[_0x3a61('0x26')](handleEntityNotFound(_0x3523c4,null))[_0x3a61('0x26')](saveUpdates(_0x350174[_0x3a61('0x4b')],null))[_0x3a61('0x26')](respondWithResult(_0x3523c4,null))[_0x3a61('0x43')](handleError(_0x3523c4,null));};exports[_0x3a61('0x27')]=function(_0x18fcd2,_0x2c694d){return db['ServicenowAccount'][_0x3a61('0x49')]({'where':{'id':_0x18fcd2[_0x3a61('0x45')]['id']}})[_0x3a61('0x26')](handleEntityNotFound(_0x2c694d,null))[_0x3a61('0x26')](removeEntity(_0x2c694d,null))[_0x3a61('0x43')](handleError(_0x2c694d,null));};exports[_0x3a61('0x4c')]=function(_0x557af7,_0x5e80b4,_0x4f60d6){var _0x46ac71={};var _0x2271f1={};var _0x5df98c;var _0x10a698;return db[_0x3a61('0x2d')]['findOne']({'where':{'id':_0x557af7[_0x3a61('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e80b4,null))['then'](function(_0x54543b){if(_0x54543b){_0x5df98c=_0x54543b;_0x2271f1[_0x3a61('0x31')]=_[_0x3a61('0x34')](db[_0x3a61('0x4d')][_0x3a61('0x46')]);_0x2271f1[_0x3a61('0x33')]=_['keys'](_0x557af7[_0x3a61('0x33')]);_0x2271f1[_0x3a61('0x35')]=_[_0x3a61('0x37')](_0x2271f1['model'],_0x2271f1[_0x3a61('0x33')]);_0x46ac71[_0x3a61('0x36')]=_[_0x3a61('0x37')](_0x2271f1[_0x3a61('0x31')],qs[_0x3a61('0x38')](_0x557af7[_0x3a61('0x33')][_0x3a61('0x38')]));_0x46ac71[_0x3a61('0x36')]=_0x46ac71[_0x3a61('0x36')][_0x3a61('0x47')]?_0x46ac71[_0x3a61('0x36')]:_0x2271f1['model'];_0x46ac71['order']=qs['sort'](_0x557af7[_0x3a61('0x33')]['sort']);_0x46ac71[_0x3a61('0x3c')]=qs['filters'](_[_0x3a61('0x3d')](_0x557af7[_0x3a61('0x33')],_0x2271f1[_0x3a61('0x35')]));if(_0x557af7[_0x3a61('0x33')][_0x3a61('0x4e')]){_0x46ac71[_0x3a61('0x3c')]=_[_0x3a61('0x3e')](_0x46ac71[_0x3a61('0x3c')],{'$or':_[_0x3a61('0x2c')](_0x46ac71['attributes'],function(_0x401523){var _0x46cfce={};_0x46cfce[_0x401523]={'$like':'%'+_0x557af7[_0x3a61('0x33')][_0x3a61('0x4e')]+'%'};return _0x46cfce;})});}_0x46ac71=_[_0x3a61('0x3e')]({},_0x46ac71,_0x557af7[_0x3a61('0x40')]);return _0x5df98c['getConfigurations'](_0x46ac71);}})[_0x3a61('0x26')](function(_0xcd7da0){if(_0xcd7da0){_0x10a698=_0xcd7da0[_0x3a61('0x47')];if(!_0x557af7[_0x3a61('0x33')][_0x3a61('0x39')](_0x3a61('0x3a'))){_0x46ac71[_0x3a61('0x1c')]=qs[_0x3a61('0x1c')](_0x557af7[_0x3a61('0x33')][_0x3a61('0x1c')]);_0x46ac71[_0x3a61('0x1b')]=qs[_0x3a61('0x1b')](_0x557af7[_0x3a61('0x33')][_0x3a61('0x1b')]);}return _0x5df98c['getConfigurations'](_0x46ac71);}})[_0x3a61('0x26')](function(_0x1920a4){if(_0x1920a4){return _0x1920a4?{'count':_0x10a698,'rows':_0x1920a4}:null;}})[_0x3a61('0x26')](respondWithResult(_0x5e80b4,null))[_0x3a61('0x43')](handleError(_0x5e80b4,null));};exports[_0x3a61('0x4f')]=function(_0x2db595,_0x33b73b,_0x4afbe3){if(_0x2db595[_0x3a61('0x4b')]['id']){delete _0x2db595['body']['id'];}return db[_0x3a61('0x2d')][_0x3a61('0x50')]({'where':{'id':_0x2db595['params']['id']}})[_0x3a61('0x26')](handleEntityNotFound(_0x33b73b,null))[_0x3a61('0x26')](function(_0x48ce99){if(_0x48ce99){_0x2db595[_0x3a61('0x4b')][_0x3a61('0x51')]=_0x48ce99['id'];_0x2db595[_0x3a61('0x4b')][_0x3a61('0x52')]=integrations[_0x3a61('0x53')](_0x2db595[_0x3a61('0x4b')][_0x3a61('0x54')],_0x2db595['body'][_0x3a61('0x2f')]);_0x2db595['body']['Descriptions']=integrations[_0x3a61('0x55')](_0x2db595[_0x3a61('0x4b')][_0x3a61('0x54')],_0x2db595[_0x3a61('0x4b')]['type']);return db[_0x3a61('0x4d')]['create'](_0x2db595[_0x3a61('0x4b')],{'include':[{'model':db['ServicenowField'],'as':_0x3a61('0x52')},{'model':db[_0x3a61('0x56')],'as':_0x3a61('0x57')}]});}return null;})[_0x3a61('0x26')](respondWithResult(_0x33b73b,null))[_0x3a61('0x43')](handleError(_0x33b73b,null));};exports[_0x3a61('0x58')]=function(_0x32ae0a,_0x40a8f6,_0x139ccd){var _0x1053d6=[_0x3a61('0x59'),'hold_reason','knowledge',_0x3a61('0x5a'),_0x3a61('0x5b'),_0x3a61('0x5c'),'incident_state','severity','category'];var _0x18f7d2=['parent',_0x3a61('0x59'),_0x3a61('0x5d'),_0x3a61('0x5e'),_0x3a61('0x5f'),'sys_updated_on',_0x3a61('0x60'),_0x3a61('0x61'),_0x3a61('0x62'),'number',_0x3a61('0x63'),'sys_updated_by',_0x3a61('0x64'),_0x3a61('0x65'),_0x3a61('0x66'),_0x3a61('0x67'),'state',_0x3a61('0x68'),'knowledge',_0x3a61('0x69'),_0x3a61('0x6a'),_0x3a61('0x6b'),_0x3a61('0x6c'),'delivery_plan',_0x3a61('0x6d'),'active',_0x3a61('0x6e'),_0x3a61('0x6f'),'priority',_0x3a61('0x70'),'rfc',_0x3a61('0x71'),_0x3a61('0x72'),_0x3a61('0x73'),_0x3a61('0x74'),_0x3a61('0x75'),_0x3a61('0x76'),'reopened_time',_0x3a61('0x77'),_0x3a61('0x78'),_0x3a61('0x79'),_0x3a61('0x5a'),_0x3a61('0x7a'),_0x3a61('0x7b'),_0x3a61('0x5b'),_0x3a61('0x7c'),_0x3a61('0x7d'),_0x3a61('0x7e'),_0x3a61('0x7f'),_0x3a61('0x80'),_0x3a61('0x81'),_0x3a61('0x82'),_0x3a61('0x83'),'notify',_0x3a61('0x84'),_0x3a61('0x85'),_0x3a61('0x86'),_0x3a61('0x87'),'parent_incident','sys_id',_0x3a61('0x88'),_0x3a61('0x89'),'incident_state',_0x3a61('0x8a'),_0x3a61('0x8b'),_0x3a61('0x8c'),'reassignment_count',_0x3a61('0x8d'),_0x3a61('0x8e'),_0x3a61('0x8f'),_0x3a61('0x90'),_0x3a61('0x91'),'approval',_0x3a61('0x92'),_0x3a61('0x93'),_0x3a61('0x94'),_0x3a61('0x95'),_0x3a61('0x96'),_0x3a61('0x97'),'upon_approval','correlation_id',_0x3a61('0x98'),_0x3a61('0x99')];var _0x356b24='';var _0x576fdc='';var _0x36ca8d=[];var _0x4f7463='';var _0x2689ec='';var _0x2ce858=[];var _0x4255fb='';var _0xd929df='';var _0x2d6125={};var _0x21bcd5='';return db['ServicenowAccount'][_0x3a61('0x50')]({'where':{'id':_0x32ae0a[_0x3a61('0x45')]['id']},'attributes':['id',_0x3a61('0x9a'),_0x3a61('0x9b'),_0x3a61('0x9c'),_0x3a61('0x9d'),_0x3a61('0x9e')]})[_0x3a61('0x26')](handleEntityNotFound(_0x40a8f6,null))[_0x3a61('0x26')](function(_0x55c002){if(_0x55c002){_0x21bcd5=_0x55c002[_0x3a61('0x9d')];var _0x53f1a8=_0x21bcd5[_0x3a61('0x9f')](-0x1);if(_0x53f1a8==='/'){_0x21bcd5=_0x21bcd5[_0x3a61('0xa0')](0x0,_0x21bcd5['lastIndexOf'](_0x53f1a8));}_0xd929df=util[_0x3a61('0xa1')](_0x3a61('0xa2'),_0x21bcd5);_0x4255fb=util['format'](_0x3a61('0xa3'),_0x21bcd5);_0x2d6125={'user':_0x55c002[_0x3a61('0x9a')],'pass':_0x55c002[_0x3a61('0x9b')]};var _0x22d0ee={'method':_0x3a61('0xa4'),'uri':_0xd929df+_0x3a61('0xa5'),'auth':_0x2d6125,'json':!![]};return rp(_0x22d0ee);}})[_0x3a61('0x26')](function(_0x1f4c90){if(_0x1f4c90[_0x3a61('0xa6')][_0x3a61('0x47')]>0x0){_0x356b24=_0x1f4c90[_0x3a61('0xa6')];}console[_0x3a61('0xa7')](_0x3a61('0xa8'),_0x356b24);_0x2ce858=[];_0x576fdc=Object[_0x3a61('0xa9')]([],_0x356b24);_[_0x3a61('0xaa')](_0x576fdc,function(_0x7db98f){return!_0x1053d6[_0x3a61('0xab')](_0x7db98f['name']);});_0x576fdc[_0x3a61('0xac')](function(_0x1f9a6c){var _0x4fe7e0=createFieldObject(_0x4255fb,_0x2d6125,_0x1f9a6c['internalType'],_0x1f9a6c[_0x3a61('0x32')],_0x1f9a6c[_0x3a61('0xad')],![]);_0x2ce858['push'](_0x4fe7e0);});return Promise[_0x3a61('0xae')](_0x2ce858);})[_0x3a61('0x26')](function(_0x23c656){_0x36ca8d=_0x23c656;_0x4f7463=Object['assign']([],_0x356b24);console['log'](_0x3a61('0xaf'),_0x356b24);_[_0x3a61('0xaa')](_0x4f7463,function(_0x56912a){return _0x18f7d2[_0x3a61('0xab')](_0x56912a['name']);});console[_0x3a61('0xa7')](_0x3a61('0xb0'),_0x4f7463);_0x2ce858=[];_0x4f7463[_0x3a61('0xac')](function(_0x284c53){var _0x198afd=createFieldObject(_0x4255fb,_0x2d6125,_0x284c53['internalType'],_0x284c53[_0x3a61('0x32')],_0x284c53['label'],!![]);_0x2ce858[_0x3a61('0xb1')](_0x198afd);});return Promise[_0x3a61('0xae')](_0x2ce858);})['then'](function(_0x233937){_0x2689ec=_0x233937;var _0x256f90=_0x36ca8d['concat'](_0x2689ec);return{'count':_0x256f90[_0x3a61('0x47')],'rows':_0x256f90};})[_0x3a61('0x26')](respondWithResult(_0x40a8f6,null))[_0x3a61('0x43')](function(_0x2369b3){console['log'](_0x3a61('0xb2')+_0x2369b3);var _0xbf168b=_0x32ae0a[_0x3a61('0x33')]['test']?0x1f4:_0x2369b3[_0x3a61('0xb3')]||0x1f4;logger['error'](_0x2369b3['stack']);delete _0x2369b3[_0x3a61('0x32')];if(_0xbf168b===0x191){_0xbf168b=0x190;}_0x40a8f6[_0x3a61('0x1f')](_0xbf168b)['send'](_0x32ae0a[_0x3a61('0x33')][_0x3a61('0xb4')]?{'message':_0x3a61('0xb5'),'statusCode':_0x2369b3[_0x3a61('0xb3')]}:_0x2369b3);});};function createFieldObject(_0x1c1c5f,_0xe0ff7f,_0x1e14a8,_0x1ba214,_0x51ee87,_0x2b9c5f){return new Promise(function(_0x4b2025,_0x33e8dc){var _0x1c00ff={'id':_0x1ba214,'name':_0x51ee87,'custom':_0x2b9c5f};if(_0x1e14a8===_0x3a61('0xb6')){_0x1c00ff['options']=[{'name':_0x3a61('0xb7'),'value':'true'},{'name':_0x3a61('0xb8'),'value':'false'}];_0x4b2025(_0x1c00ff);}else{var _0x43c85e={'method':'GET','uri':_0x1c1c5f+_0x3a61('0xb9')+_0x1ba214,'auth':_0xe0ff7f,'json':!![]};return rp(_0x43c85e)[_0x3a61('0x26')](function(_0x2e918a){var _0x36ceb9=[];if(_0x2e918a['result']['length']>0x0){_0x2e918a[_0x3a61('0xa6')][_0x3a61('0xac')](function(_0x8d6a6d){if(_0x8d6a6d['inactive']===_0x3a61('0xba')){var _0x85cf6e={'name':_0x8d6a6d['label'],'value':_0x8d6a6d['value']};_0x36ceb9[_0x3a61('0xb1')](_0x85cf6e);}});}_0x1c00ff[_0x3a61('0x40')]=_0x36ceb9;if(_0x1c00ff['options'][_0x3a61('0x47')]>0x0){_0x4b2025(_0x1c00ff);}else{if(_0x2b9c5f==![]){_0x4b2025();}else{_0x4b2025(_0x1c00ff);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 20172e3..a874b6a 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x20f59b,_0x5a9ee9){var _0x555adc=function(_0x6f06aa){while(--_0x6f06aa){_0x20f59b['push'](_0x20f59b['shift']());}};_0x555adc(++_0x5a9ee9);}(_0xba34,0x119));var _0x4ba3=function(_0x96f8f8,_0x572fe0){_0x96f8f8=_0x96f8f8-0x0;var _0x722377=_0xba34[_0x96f8f8];return _0x722377;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x271aa0,_0x52a0a2){var _0x20e6cc=function(_0x3afbed){while(--_0x3afbed){_0x271aa0['push'](_0x271aa0['shift']());}};_0x20e6cc(++_0x52a0a2);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x57d740,_0x50be99){_0x57d740=_0x57d740-0x0;var _0x6607ef=_0xfdbd[_0x57d740];return _0x6607ef;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('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 930ab24..967511a 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 _0x17dc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','map','include','model','attributes','ShowServicenowAccount','find','then','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xb50f3b,_0x149500){var _0x24875b=function(_0x2c2499){while(--_0x2c2499){_0xb50f3b['push'](_0xb50f3b['shift']());}};_0x24875b(++_0x149500);}(_0x17dc,0x123));var _0xc17d=function(_0x19508c,_0x4b8716){_0x19508c=_0x19508c-0x0;var _0x3ffbdd=_0x17dc[_0x19508c];return _0x3ffbdd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc17d('0x0'));var BPromise=require(_0xc17d('0x1'));var rs=require(_0xc17d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc17d('0x3'))['db'];var utils=require(_0xc17d('0x4'));var logger=require(_0xc17d('0x5'))(_0xc17d('0x6'));var config=require(_0xc17d('0x7'));var jayson=require(_0xc17d('0x8'));var client=jayson[_0xc17d('0x9')][_0xc17d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1444e7,_0x232b03,_0x4b8190){return new BPromise(function(_0xd6d8a3,_0x4029d6){return client[_0xc17d('0xb')](_0x1444e7,_0x4b8190)['then'](function(_0x5305ce){logger['info'](_0xc17d('0xc'),_0x232b03,'request\x20sent');logger[_0xc17d('0xd')](_0xc17d('0xe'),_0x232b03,_0xc17d('0xf'),JSON[_0xc17d('0x10')](_0x5305ce));if(_0x5305ce['error']){if(_0x5305ce[_0xc17d('0x11')][_0xc17d('0x12')]===0x1f4){logger[_0xc17d('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x232b03,_0x5305ce['error']['message']);return _0x4029d6(_0x5305ce[_0xc17d('0x11')][_0xc17d('0x13')]);}logger[_0xc17d('0x11')](_0xc17d('0xc'),_0x232b03,_0x5305ce[_0xc17d('0x11')][_0xc17d('0x13')]);return _0xd6d8a3(_0x5305ce[_0xc17d('0x11')][_0xc17d('0x13')]);}else{logger[_0xc17d('0x14')](_0xc17d('0xc'),_0x232b03,_0xc17d('0xf'));_0xd6d8a3(_0x5305ce[_0xc17d('0x15')][_0xc17d('0x13')]);}})['catch'](function(_0xbe029a){logger[_0xc17d('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x232b03,_0xbe029a);_0x4029d6(_0xbe029a);});});}exports[_0xc17d('0x16')]=function(_0x3de7e1){var _0x393776=this;return new Promise(function(_0x42e82e,_0x79bd31){return db[_0xc17d('0x17')][_0xc17d('0x18')]({'raw':_0x3de7e1[_0xc17d('0x19')]?_0x3de7e1[_0xc17d('0x19')][_0xc17d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3de7e1[_0xc17d('0x19')]?_0x3de7e1[_0xc17d('0x19')][_0xc17d('0x1b')]||null:null,'attributes':_0x3de7e1[_0xc17d('0x19')]?_0x3de7e1[_0xc17d('0x19')]['attributes']||null:null,'limit':_0x3de7e1[_0xc17d('0x19')]?_0x3de7e1[_0xc17d('0x19')][_0xc17d('0x1c')]||null:null,'include':_0x3de7e1[_0xc17d('0x19')]?_0x3de7e1[_0xc17d('0x19')]['include']?_[_0xc17d('0x1d')](_0x3de7e1[_0xc17d('0x19')][_0xc17d('0x1e')],function(_0x3a3945){return{'model':db[_0x3a3945[_0xc17d('0x1f')]],'as':_0x3a3945['as'],'attributes':_0x3a3945[_0xc17d('0x20')],'include':_0x3a3945[_0xc17d('0x1e')]?_[_0xc17d('0x1d')](_0x3a3945['include'],function(_0x55f4b7){return{'model':db[_0x55f4b7[_0xc17d('0x1f')]],'as':_0x55f4b7['as'],'attributes':_0x55f4b7[_0xc17d('0x20')],'include':_0x55f4b7[_0xc17d('0x1e')]?_[_0xc17d('0x1d')](_0x55f4b7[_0xc17d('0x1e')],function(_0x1a5f05){return{'model':db[_0x1a5f05[_0xc17d('0x1f')]],'as':_0x1a5f05['as'],'attributes':_0x1a5f05[_0xc17d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40dfc6){logger[_0xc17d('0x14')](_0xc17d('0x16'),_0x3de7e1);logger['debug'](_0xc17d('0x16'),_0x3de7e1,JSON['stringify'](_0x40dfc6));_0x42e82e(_0x40dfc6);})['catch'](function(_0x126b90){logger[_0xc17d('0x11')](_0xc17d('0x16'),_0x126b90['message'],_0x3de7e1);_0x79bd31(_0x393776[_0xc17d('0x11')](0x1f4,_0x126b90[_0xc17d('0x13')]));});});};exports[_0xc17d('0x21')]=function(_0x3f71fa){var _0x5d1d3e=this;return new Promise(function(_0x2b0611,_0x1c1b63){return db['ServicenowAccount'][_0xc17d('0x22')]({'raw':_0x3f71fa['options']?_0x3f71fa[_0xc17d('0x19')][_0xc17d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f71fa[_0xc17d('0x19')]?_0x3f71fa[_0xc17d('0x19')][_0xc17d('0x1b')]||null:null,'attributes':_0x3f71fa[_0xc17d('0x19')]?_0x3f71fa[_0xc17d('0x19')][_0xc17d('0x20')]||null:null,'include':_0x3f71fa[_0xc17d('0x19')]?_0x3f71fa[_0xc17d('0x19')][_0xc17d('0x1e')]?_[_0xc17d('0x1d')](_0x3f71fa[_0xc17d('0x19')]['include'],function(_0x15dc80){return{'model':db[_0x15dc80[_0xc17d('0x1f')]],'as':_0x15dc80['as'],'attributes':_0x15dc80[_0xc17d('0x20')],'include':_0x15dc80[_0xc17d('0x1e')]?_[_0xc17d('0x1d')](_0x15dc80[_0xc17d('0x1e')],function(_0x2a20a5){return{'model':db[_0x2a20a5[_0xc17d('0x1f')]],'as':_0x2a20a5['as'],'attributes':_0x2a20a5[_0xc17d('0x20')],'include':_0x2a20a5['include']?_[_0xc17d('0x1d')](_0x2a20a5['include'],function(_0x37c7d3){return{'model':db[_0x37c7d3[_0xc17d('0x1f')]],'as':_0x37c7d3['as'],'attributes':_0x37c7d3[_0xc17d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc17d('0x23')](function(_0x5cac04){logger[_0xc17d('0x14')](_0xc17d('0x21'),_0x3f71fa);logger[_0xc17d('0xd')]('ShowServicenowAccount',_0x3f71fa,JSON[_0xc17d('0x10')](_0x5cac04));_0x2b0611(_0x5cac04);})[_0xc17d('0x24')](function(_0x506b0e){logger[_0xc17d('0x11')](_0xc17d('0x21'),_0x506b0e[_0xc17d('0x13')],_0x3f71fa);_0x1c1b63(_0x5d1d3e[_0xc17d('0x11')](0x1f4,_0x506b0e[_0xc17d('0x13')]));});});}; \ No newline at end of file +var _0xb76c=['attributes','catch','ShowServicenowAccount','find','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','model'];(function(_0x3ea041,_0xae9989){var _0x395add=function(_0x3fbbea){while(--_0x3fbbea){_0x3ea041['push'](_0x3ea041['shift']());}};_0x395add(++_0xae9989);}(_0xb76c,0x16d));var _0xcb76=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0xb76c[_0x28a5ad];return _0x176b8a;};'use strict';var _=require('lodash');var util=require(_0xcb76('0x0'));var moment=require(_0xcb76('0x1'));var BPromise=require(_0xcb76('0x2'));var rs=require(_0xcb76('0x3'));var fs=require('fs');var Redis=require(_0xcb76('0x4'));var db=require(_0xcb76('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb76('0x6'))(_0xcb76('0x7'));var config=require(_0xcb76('0x8'));var jayson=require(_0xcb76('0x9'));var client=jayson[_0xcb76('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41f21f,_0x2ac811,_0x23bbe1){return new BPromise(function(_0x11c47e,_0x38767e){return client[_0xcb76('0xb')](_0x41f21f,_0x23bbe1)[_0xcb76('0xc')](function(_0x38a273){logger['info'](_0xcb76('0xd'),_0x2ac811,'request\x20sent');logger[_0xcb76('0xe')](_0xcb76('0xf'),_0x2ac811,_0xcb76('0x10'),JSON[_0xcb76('0x11')](_0x38a273));if(_0x38a273[_0xcb76('0x12')]){if(_0x38a273[_0xcb76('0x12')][_0xcb76('0x13')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2ac811,_0x38a273[_0xcb76('0x12')][_0xcb76('0x14')]);return _0x38767e(_0x38a273[_0xcb76('0x12')]['message']);}logger[_0xcb76('0x12')](_0xcb76('0xd'),_0x2ac811,_0x38a273[_0xcb76('0x12')]['message']);return _0x11c47e(_0x38a273[_0xcb76('0x12')][_0xcb76('0x14')]);}else{logger['info'](_0xcb76('0xd'),_0x2ac811,'request\x20sent');_0x11c47e(_0x38a273[_0xcb76('0x15')][_0xcb76('0x14')]);}})['catch'](function(_0x4f30c2){logger[_0xcb76('0x12')](_0xcb76('0xd'),_0x2ac811,_0x4f30c2);_0x38767e(_0x4f30c2);});});}exports[_0xcb76('0x16')]=function(_0x23b1ac){var _0x3b912d=this;return new Promise(function(_0x2ce2a7,_0x30d796){return db[_0xcb76('0x17')][_0xcb76('0x18')]({'raw':_0x23b1ac[_0xcb76('0x19')]?_0x23b1ac[_0xcb76('0x19')][_0xcb76('0x1a')]===undefined?!![]:![]:!![],'where':_0x23b1ac[_0xcb76('0x19')]?_0x23b1ac[_0xcb76('0x19')][_0xcb76('0x1b')]||null:null,'attributes':_0x23b1ac['options']?_0x23b1ac[_0xcb76('0x19')]['attributes']||null:null,'limit':_0x23b1ac[_0xcb76('0x19')]?_0x23b1ac[_0xcb76('0x19')]['limit']||null:null,'include':_0x23b1ac[_0xcb76('0x19')]?_0x23b1ac['options'][_0xcb76('0x1c')]?_[_0xcb76('0x1d')](_0x23b1ac[_0xcb76('0x19')][_0xcb76('0x1c')],function(_0x12e20e){return{'model':db[_0x12e20e[_0xcb76('0x1e')]],'as':_0x12e20e['as'],'attributes':_0x12e20e[_0xcb76('0x1f')],'include':_0x12e20e[_0xcb76('0x1c')]?_[_0xcb76('0x1d')](_0x12e20e[_0xcb76('0x1c')],function(_0x309b1a){return{'model':db[_0x309b1a[_0xcb76('0x1e')]],'as':_0x309b1a['as'],'attributes':_0x309b1a[_0xcb76('0x1f')],'include':_0x309b1a[_0xcb76('0x1c')]?_[_0xcb76('0x1d')](_0x309b1a['include'],function(_0x560d61){return{'model':db[_0x560d61['model']],'as':_0x560d61['as'],'attributes':_0x560d61[_0xcb76('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37f583){logger['info'](_0xcb76('0x16'),_0x23b1ac);logger[_0xcb76('0xe')](_0xcb76('0x16'),_0x23b1ac,JSON[_0xcb76('0x11')](_0x37f583));_0x2ce2a7(_0x37f583);})[_0xcb76('0x20')](function(_0x42f46c){logger[_0xcb76('0x12')](_0xcb76('0x16'),_0x42f46c[_0xcb76('0x14')],_0x23b1ac);_0x30d796(_0x3b912d['error'](0x1f4,_0x42f46c[_0xcb76('0x14')]));});});};exports[_0xcb76('0x21')]=function(_0x8f0f91){var _0x4a0701=this;return new Promise(function(_0x52b9c2,_0x51684d){return db[_0xcb76('0x17')][_0xcb76('0x22')]({'raw':_0x8f0f91['options']?_0x8f0f91[_0xcb76('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x8f0f91[_0xcb76('0x19')]?_0x8f0f91[_0xcb76('0x19')][_0xcb76('0x1b')]||null:null,'attributes':_0x8f0f91[_0xcb76('0x19')]?_0x8f0f91[_0xcb76('0x19')][_0xcb76('0x1f')]||null:null,'include':_0x8f0f91[_0xcb76('0x19')]?_0x8f0f91['options'][_0xcb76('0x1c')]?_[_0xcb76('0x1d')](_0x8f0f91[_0xcb76('0x19')]['include'],function(_0x2205d8){return{'model':db[_0x2205d8[_0xcb76('0x1e')]],'as':_0x2205d8['as'],'attributes':_0x2205d8[_0xcb76('0x1f')],'include':_0x2205d8[_0xcb76('0x1c')]?_[_0xcb76('0x1d')](_0x2205d8[_0xcb76('0x1c')],function(_0x463121){return{'model':db[_0x463121['model']],'as':_0x463121['as'],'attributes':_0x463121['attributes'],'include':_0x463121[_0xcb76('0x1c')]?_[_0xcb76('0x1d')](_0x463121[_0xcb76('0x1c')],function(_0xb47a27){return{'model':db[_0xb47a27[_0xcb76('0x1e')]],'as':_0xb47a27['as'],'attributes':_0xb47a27[_0xcb76('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcb76('0xc')](function(_0x361f84){logger[_0xcb76('0x23')](_0xcb76('0x21'),_0x8f0f91);logger['debug'](_0xcb76('0x21'),_0x8f0f91,JSON[_0xcb76('0x11')](_0x361f84));_0x52b9c2(_0x361f84);})[_0xcb76('0x20')](function(_0x131dc3){logger['error'](_0xcb76('0x21'),_0x131dc3[_0xcb76('0x14')],_0x8f0f91);_0x51684d(_0x4a0701['error'](0x1f4,_0x131dc3[_0xcb76('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index bc277b9..2b2844b 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 _0xf043=['fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15f61f,_0x30d166){var _0x26991c=function(_0x150b64){while(--_0x150b64){_0x15f61f['push'](_0x15f61f['shift']());}};_0x26991c(++_0x30d166);}(_0xf043,0x1bc));var _0x3f04=function(_0x2c49c4,_0x578038){_0x2c49c4=_0x2c49c4-0x0;var _0x604561=_0xf043[_0x2c49c4];return _0x604561;};'use strict';var multer=require(_0x3f04('0x0'));var util=require(_0x3f04('0x1'));var path=require(_0x3f04('0x2'));var timeout=require(_0x3f04('0x3'));var express=require(_0x3f04('0x4'));var router=express[_0x3f04('0x5')]();var fs_extra=require(_0x3f04('0x6'));var auth=require(_0x3f04('0x7'));var interaction=require(_0x3f04('0x8'));var config=require('../../config/environment');var controller=require(_0x3f04('0x9'));router[_0x3f04('0xa')]('/',auth[_0x3f04('0xb')](),controller[_0x3f04('0xc')]);router[_0x3f04('0xa')](_0x3f04('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3f04('0xa')](_0x3f04('0xe'),auth[_0x3f04('0xb')](),controller[_0x3f04('0xf')]);router['get']('/:id/subjects',auth[_0x3f04('0xb')](),controller['getSubjects']);router['get'](_0x3f04('0x10'),auth['isAuthenticated'](),controller[_0x3f04('0x11')]);router[_0x3f04('0x12')]('/',auth[_0x3f04('0xb')](),controller[_0x3f04('0x13')]);router[_0x3f04('0x14')](_0x3f04('0xd'),auth[_0x3f04('0xb')](),controller[_0x3f04('0x15')]);router[_0x3f04('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x3f04('0x17')]);module[_0x3f04('0x18')]=router; \ No newline at end of file +var _0xb423=['getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/fields'];(function(_0x9f98b9,_0x26b1c2){var _0x4c2b59=function(_0x1a83d8){while(--_0x1a83d8){_0x9f98b9['push'](_0x9f98b9['shift']());}};_0x4c2b59(++_0x26b1c2);}(_0xb423,0x142));var _0x3b42=function(_0x10e6cd,_0x7c1bb5){_0x10e6cd=_0x10e6cd-0x0;var _0x1d08a7=_0xb423[_0x10e6cd];return _0x1d08a7;};'use strict';var multer=require(_0x3b42('0x0'));var util=require(_0x3b42('0x1'));var path=require(_0x3b42('0x2'));var timeout=require(_0x3b42('0x3'));var express=require(_0x3b42('0x4'));var router=express[_0x3b42('0x5')]();var fs_extra=require(_0x3b42('0x6'));var auth=require(_0x3b42('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3b42('0x8'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x3b42('0x9')](),controller['index']);router[_0x3b42('0xa')](_0x3b42('0xb'),auth[_0x3b42('0x9')](),controller[_0x3b42('0xc')]);router[_0x3b42('0xa')](_0x3b42('0xd'),auth[_0x3b42('0x9')](),controller[_0x3b42('0xe')]);router[_0x3b42('0xa')]('/:id/subjects',auth[_0x3b42('0x9')](),controller[_0x3b42('0xf')]);router['get'](_0x3b42('0x10'),auth[_0x3b42('0x9')](),controller[_0x3b42('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b42('0x12')]);router[_0x3b42('0x13')](_0x3b42('0xb'),auth[_0x3b42('0x9')](),controller[_0x3b42('0x14')]);router[_0x3b42('0x15')](_0x3b42('0xb'),auth[_0x3b42('0x9')](),controller[_0x3b42('0x16')]);module[_0x3b42('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e540e2d..04d38de 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 _0xbfa8=['exports','STRING'];(function(_0x4f19eb,_0x4de252){var _0x7f2989=function(_0x50661e){while(--_0x50661e){_0x4f19eb['push'](_0x4f19eb['shift']());}};_0x7f2989(++_0x4de252);}(_0xbfa8,0x74));var _0x8bfa=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbfa8[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x8bfa('0x0')]={'name':{'type':Sequelize[_0x8bfa('0x1')]},'description':{'type':Sequelize[_0x8bfa('0x1')]}}; \ No newline at end of file +var _0xcfa1=['exports','STRING'];(function(_0x353443,_0x3e0ea0){var _0x488769=function(_0x1147a7){while(--_0x1147a7){_0x353443['push'](_0x353443['shift']());}};_0x488769(++_0x3e0ea0);}(_0xcfa1,0x184));var _0x1cfa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfa1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1cfa('0x0')]={'name':{'type':Sequelize[_0x1cfa('0x1')]},'description':{'type':Sequelize[_0x1cfa('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d65019f..66c07c3 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 _0x69c6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','reject','save','then','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','catch','create','body','update','find','params','destroy','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x69c6,0x12e));var _0x669c=function(_0x4bc479,_0x3e45e2){_0x4bc479=_0x4bc479-0x0;var _0x5d3996=_0x69c6[_0x4bc479];return _0x5d3996;};'use strict';var emlformat=require(_0x669c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x669c('0x1'));var jsonpatch=require(_0x669c('0x2'));var rp=require('request-promise');var moment=require(_0x669c('0x3'));var BPromise=require(_0x669c('0x4'));var Mustache=require(_0x669c('0x5'));var util=require(_0x669c('0x6'));var path=require(_0x669c('0x7'));var sox=require('sox');var csv=require(_0x669c('0x8'));var ejs=require(_0x669c('0x9'));var fs=require('fs');var fs_extra=require(_0x669c('0xa'));var _=require(_0x669c('0xb'));var squel=require('squel');var crypto=require(_0x669c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x669c('0x8'));var querystring=require('querystring');var Papa=require(_0x669c('0xd'));var Redis=require(_0x669c('0xe'));var authService=require(_0x669c('0xf'));var qs=require(_0x669c('0x10'));var as=require(_0x669c('0x11'));var hardwareService=require(_0x669c('0x12'));var logger=require(_0x669c('0x13'))(_0x669c('0x14'));var utils=require(_0x669c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x669c('0x16'));var db=require(_0x669c('0x17'))['db'];function respondWithStatusCode(_0xa6fa6c,_0x44e329){_0x44e329=_0x44e329||0xcc;return function(_0x3c4f32){if(_0x3c4f32){return _0xa6fa6c[_0x669c('0x18')](_0x44e329);}return _0xa6fa6c[_0x669c('0x19')](_0x44e329)[_0x669c('0x1a')]();};}function respondWithResult(_0x5817d8,_0x46f6e4){_0x46f6e4=_0x46f6e4||0xc8;return function(_0x4b27c9){if(_0x4b27c9){return _0x5817d8['status'](_0x46f6e4)['json'](_0x4b27c9);}};}function respondWithFilteredResult(_0x39127f,_0x7d011){return function(_0xf05a06){if(_0xf05a06){var _0x35a6d9=typeof _0x7d011[_0x669c('0x1b')]==='undefined'&&typeof _0x7d011[_0x669c('0x1c')]===_0x669c('0x1d');var _0x3d98d1=_0xf05a06[_0x669c('0x1e')];var _0x1b1eaa=_0x35a6d9?0x0:_0x7d011['offset'];var _0x569b43=_0x35a6d9?_0xf05a06[_0x669c('0x1e')]:_0x7d011[_0x669c('0x1b')]+_0x7d011[_0x669c('0x1c')];var _0x2f177f;if(_0x569b43>=_0x3d98d1){_0x569b43=_0x3d98d1;_0x2f177f=0xc8;}else{_0x2f177f=0xce;}_0x39127f['status'](_0x2f177f);return _0x39127f['set']('Content-Range',_0x1b1eaa+'-'+_0x569b43+'/'+_0x3d98d1)[_0x669c('0x1f')](_0xf05a06);}return null;};}function patchUpdates(_0x180a5d){return function(_0x3c66d5){try{jsonpatch['apply'](_0x3c66d5,_0x180a5d,!![]);}catch(_0x4c7f50){return BPromise[_0x669c('0x20')](_0x4c7f50);}return _0x3c66d5[_0x669c('0x21')]();};}function saveUpdates(_0xfa45f4,_0x28cfd8){return function(_0xb8e07){if(_0xb8e07){return _0xb8e07['update'](_0xfa45f4)[_0x669c('0x22')](function(_0x6f76df){return _0x6f76df;});}return null;};}function removeEntity(_0x243705,_0x56e633){return function(_0x407ae5){if(_0x407ae5){return _0x407ae5['destroy']()[_0x669c('0x22')](function(){_0x243705[_0x669c('0x19')](0xcc)[_0x669c('0x1a')]();});}};}function handleEntityNotFound(_0x325967,_0x5e655c){return function(_0x4d447a){if(!_0x4d447a){_0x325967[_0x669c('0x18')](0x194);}return _0x4d447a;};}function handleError(_0x273960,_0x23db87){_0x23db87=_0x23db87||0x1f4;return function(_0x4d9ffb){logger['error'](_0x4d9ffb[_0x669c('0x23')]);if(_0x4d9ffb['name']){delete _0x4d9ffb[_0x669c('0x24')];}_0x273960[_0x669c('0x19')](_0x23db87)['send'](_0x4d9ffb);};}exports[_0x669c('0x25')]=function(_0x53e05f,_0x288c12){var _0x4904d2={},_0xb51253={},_0x237ac8={'count':0x0,'rows':[]};var _0x53f2e7=_[_0x669c('0x26')](db[_0x669c('0x27')][_0x669c('0x28')],function(_0x18a148){return{'name':_0x18a148[_0x669c('0x29')],'type':_0x18a148[_0x669c('0x2a')][_0x669c('0x2b')]};});_0xb51253[_0x669c('0x2c')]=_[_0x669c('0x26')](_0x53f2e7,_0x669c('0x24'));_0xb51253[_0x669c('0x2d')]=_[_0x669c('0x2e')](_0x53e05f[_0x669c('0x2d')]);_0xb51253[_0x669c('0x2f')]=_[_0x669c('0x30')](_0xb51253['model'],_0xb51253[_0x669c('0x2d')]);_0x4904d2[_0x669c('0x31')]=_['intersection'](_0xb51253[_0x669c('0x2c')],qs[_0x669c('0x32')](_0x53e05f[_0x669c('0x2d')][_0x669c('0x32')]));_0x4904d2[_0x669c('0x31')]=_0x4904d2[_0x669c('0x31')][_0x669c('0x33')]?_0x4904d2[_0x669c('0x31')]:_0xb51253['model'];if(!_0x53e05f[_0x669c('0x2d')][_0x669c('0x34')](_0x669c('0x35'))){_0x4904d2[_0x669c('0x1c')]=qs[_0x669c('0x1c')](_0x53e05f['query'][_0x669c('0x1c')]);_0x4904d2[_0x669c('0x1b')]=qs[_0x669c('0x1b')](_0x53e05f[_0x669c('0x2d')][_0x669c('0x1b')]);}_0x4904d2[_0x669c('0x36')]=qs[_0x669c('0x37')](_0x53e05f[_0x669c('0x2d')]['sort']);_0x4904d2[_0x669c('0x38')]=qs[_0x669c('0x2f')](_['pick'](_0x53e05f[_0x669c('0x2d')],_0xb51253[_0x669c('0x2f')]),_0x53f2e7);if(_0x53e05f[_0x669c('0x2d')]['filter']){_0x4904d2['where']=_[_0x669c('0x39')](_0x4904d2[_0x669c('0x38')],{'$or':_['map'](_0x53f2e7,function(_0x3a3e72){if(_0x3a3e72[_0x669c('0x2a')]!==_0x669c('0x3a')){var _0x3036ca={};_0x3036ca[_0x3a3e72[_0x669c('0x24')]]={'$like':'%'+_0x53e05f[_0x669c('0x2d')][_0x669c('0x3b')]+'%'};return _0x3036ca;}})});}_0x4904d2=_[_0x669c('0x39')]({},_0x4904d2,_0x53e05f[_0x669c('0x3c')]);var _0x5946eb={'where':_0x4904d2[_0x669c('0x38')]};return db[_0x669c('0x27')][_0x669c('0x1e')](_0x5946eb)[_0x669c('0x22')](function(_0x3affb0){_0x237ac8[_0x669c('0x1e')]=_0x3affb0;if(_0x53e05f['query'][_0x669c('0x3d')]){_0x4904d2[_0x669c('0x3e')]=[{'all':!![]}];}return db[_0x669c('0x27')][_0x669c('0x3f')](_0x4904d2);})['then'](function(_0x23eb2e){_0x237ac8[_0x669c('0x40')]=_0x23eb2e;return _0x237ac8;})[_0x669c('0x22')](respondWithFilteredResult(_0x288c12,_0x4904d2))['catch'](handleError(_0x288c12,null));};exports[_0x669c('0x41')]=function(_0x4e7153,_0x5087ff){var _0x4cd1f5={'raw':![],'where':{'id':_0x4e7153['params']['id']}},_0x435c41={};_0x435c41['model']=_[_0x669c('0x2e')](db[_0x669c('0x27')]['rawAttributes']);_0x435c41[_0x669c('0x2d')]=_[_0x669c('0x2e')](_0x4e7153['query']);_0x435c41[_0x669c('0x2f')]=_[_0x669c('0x30')](_0x435c41['model'],_0x435c41[_0x669c('0x2d')]);_0x4cd1f5[_0x669c('0x31')]=_['intersection'](_0x435c41['model'],qs[_0x669c('0x32')](_0x4e7153[_0x669c('0x2d')][_0x669c('0x32')]));_0x4cd1f5[_0x669c('0x31')]=_0x4cd1f5[_0x669c('0x31')][_0x669c('0x33')]?_0x4cd1f5['attributes']:_0x435c41[_0x669c('0x2c')];if(_0x4e7153['query'][_0x669c('0x3d')]){_0x4cd1f5[_0x669c('0x3e')]=[{'all':!![]}];}_0x4cd1f5=_[_0x669c('0x39')]({},_0x4cd1f5,_0x4e7153[_0x669c('0x3c')]);return db[_0x669c('0x27')]['find'](_0x4cd1f5)[_0x669c('0x22')](handleEntityNotFound(_0x5087ff,null))[_0x669c('0x22')](respondWithResult(_0x5087ff,null))[_0x669c('0x42')](handleError(_0x5087ff,null));};exports[_0x669c('0x43')]=function(_0x2b45a3,_0xbc07b1){return db[_0x669c('0x27')][_0x669c('0x43')](_0x2b45a3[_0x669c('0x44')],{})[_0x669c('0x22')](respondWithResult(_0xbc07b1,0xc9))['catch'](handleError(_0xbc07b1,null));};exports[_0x669c('0x45')]=function(_0x5253f6,_0x388976){if(_0x5253f6[_0x669c('0x44')]['id']){delete _0x5253f6[_0x669c('0x44')]['id'];}return db[_0x669c('0x27')][_0x669c('0x46')]({'where':{'id':_0x5253f6[_0x669c('0x47')]['id']}})['then'](handleEntityNotFound(_0x388976,null))['then'](saveUpdates(_0x5253f6['body'],null))[_0x669c('0x22')](respondWithResult(_0x388976,null))[_0x669c('0x42')](handleError(_0x388976,null));};exports[_0x669c('0x48')]=function(_0x3c46fa,_0x1c7be0){return db['ServicenowConfiguration'][_0x669c('0x46')]({'where':{'id':_0x3c46fa[_0x669c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c7be0,null))[_0x669c('0x22')](removeEntity(_0x1c7be0,null))[_0x669c('0x42')](handleError(_0x1c7be0,null));};exports[_0x669c('0x49')]=function(_0x19ba91,_0x1b84c8,_0x4e7831){var _0x1a6cbc={};var _0x1af40c={};var _0x2c2f88;var _0x39432e;return db[_0x669c('0x27')][_0x669c('0x4a')]({'where':{'id':_0x19ba91[_0x669c('0x47')]['id']}})[_0x669c('0x22')](handleEntityNotFound(_0x1b84c8,null))[_0x669c('0x22')](function(_0x5c5ef4){if(_0x5c5ef4){_0x2c2f88=_0x5c5ef4;_0x1af40c[_0x669c('0x2c')]=_['keys'](db[_0x669c('0x4b')][_0x669c('0x28')]);_0x1af40c['query']=_[_0x669c('0x2e')](_0x19ba91['query']);_0x1af40c[_0x669c('0x2f')]=_[_0x669c('0x30')](_0x1af40c['model'],_0x1af40c[_0x669c('0x2d')]);_0x1a6cbc[_0x669c('0x31')]=_[_0x669c('0x30')](_0x1af40c['model'],qs[_0x669c('0x32')](_0x19ba91['query'][_0x669c('0x32')]));_0x1a6cbc[_0x669c('0x31')]=_0x1a6cbc[_0x669c('0x31')][_0x669c('0x33')]?_0x1a6cbc[_0x669c('0x31')]:_0x1af40c['model'];_0x1a6cbc[_0x669c('0x36')]=qs[_0x669c('0x37')](_0x19ba91[_0x669c('0x2d')][_0x669c('0x37')]);_0x1a6cbc['where']=qs[_0x669c('0x2f')](_[_0x669c('0x4c')](_0x19ba91[_0x669c('0x2d')],_0x1af40c['filters']));if(_0x19ba91[_0x669c('0x2d')][_0x669c('0x3b')]){_0x1a6cbc[_0x669c('0x38')]=_[_0x669c('0x39')](_0x1a6cbc['where'],{'$or':_[_0x669c('0x26')](_0x1a6cbc[_0x669c('0x31')],function(_0x5468c2){var _0x18b642={};_0x18b642[_0x5468c2]={'$like':'%'+_0x19ba91[_0x669c('0x2d')][_0x669c('0x3b')]+'%'};return _0x18b642;})});}_0x1a6cbc=_[_0x669c('0x39')]({},_0x1a6cbc,_0x19ba91['options']);return _0x2c2f88['getFields'](_0x1a6cbc);}})[_0x669c('0x22')](function(_0x3a02a5){if(_0x3a02a5){_0x39432e=_0x3a02a5['length'];if(!_0x19ba91[_0x669c('0x2d')]['hasOwnProperty'](_0x669c('0x35'))){_0x1a6cbc['limit']=qs[_0x669c('0x1c')](_0x19ba91[_0x669c('0x2d')][_0x669c('0x1c')]);_0x1a6cbc[_0x669c('0x1b')]=qs[_0x669c('0x1b')](_0x19ba91['query'][_0x669c('0x1b')]);}return _0x2c2f88[_0x669c('0x49')](_0x1a6cbc);}})['then'](function(_0x5845ec){if(_0x5845ec){return _0x5845ec?{'count':_0x39432e,'rows':_0x5845ec}:null;}})['then'](respondWithResult(_0x1b84c8,null))[_0x669c('0x42')](handleError(_0x1b84c8,null));};exports[_0x669c('0x4d')]=function(_0x1e045f,_0x354900,_0x4e3088){var _0x12ea83={};var _0x1b044a={};var _0x292f1f;var _0x4a4f0b;return db['ServicenowConfiguration'][_0x669c('0x4a')]({'where':{'id':_0x1e045f['params']['id']}})['then'](handleEntityNotFound(_0x354900,null))[_0x669c('0x22')](function(_0x2fa75b){if(_0x2fa75b){_0x292f1f=_0x2fa75b;_0x1b044a[_0x669c('0x2c')]=_[_0x669c('0x2e')](db['ServicenowField']['rawAttributes']);_0x1b044a[_0x669c('0x2d')]=_[_0x669c('0x2e')](_0x1e045f[_0x669c('0x2d')]);_0x1b044a[_0x669c('0x2f')]=_[_0x669c('0x30')](_0x1b044a[_0x669c('0x2c')],_0x1b044a[_0x669c('0x2d')]);_0x12ea83[_0x669c('0x31')]=_[_0x669c('0x30')](_0x1b044a[_0x669c('0x2c')],qs['fields'](_0x1e045f[_0x669c('0x2d')]['fields']));_0x12ea83[_0x669c('0x31')]=_0x12ea83[_0x669c('0x31')][_0x669c('0x33')]?_0x12ea83['attributes']:_0x1b044a[_0x669c('0x2c')];_0x12ea83['order']=qs[_0x669c('0x37')](_0x1e045f['query'][_0x669c('0x37')]);_0x12ea83[_0x669c('0x38')]=qs[_0x669c('0x2f')](_[_0x669c('0x4c')](_0x1e045f[_0x669c('0x2d')],_0x1b044a[_0x669c('0x2f')]));if(_0x1e045f[_0x669c('0x2d')][_0x669c('0x3b')]){_0x12ea83[_0x669c('0x38')]=_[_0x669c('0x39')](_0x12ea83[_0x669c('0x38')],{'$or':_[_0x669c('0x26')](_0x12ea83[_0x669c('0x31')],function(_0x4c78be){var _0x3f0966={};_0x3f0966[_0x4c78be]={'$like':'%'+_0x1e045f[_0x669c('0x2d')][_0x669c('0x3b')]+'%'};return _0x3f0966;})});}_0x12ea83=_[_0x669c('0x39')]({},_0x12ea83,_0x1e045f[_0x669c('0x3c')]);return _0x292f1f[_0x669c('0x4d')](_0x12ea83);}})[_0x669c('0x22')](function(_0xefd774){if(_0xefd774){_0x4a4f0b=_0xefd774[_0x669c('0x33')];if(!_0x1e045f[_0x669c('0x2d')][_0x669c('0x34')](_0x669c('0x35'))){_0x12ea83[_0x669c('0x1c')]=qs['limit'](_0x1e045f[_0x669c('0x2d')][_0x669c('0x1c')]);_0x12ea83[_0x669c('0x1b')]=qs['offset'](_0x1e045f[_0x669c('0x2d')][_0x669c('0x1b')]);}return _0x292f1f['getSubjects'](_0x12ea83);}})[_0x669c('0x22')](function(_0x3a948b){if(_0x3a948b){return _0x3a948b?{'count':_0x4a4f0b,'rows':_0x3a948b}:null;}})['then'](respondWithResult(_0x354900,null))[_0x669c('0x42')](handleError(_0x354900,null));};exports[_0x669c('0x4e')]=function(_0x4f1cd4,_0x6d37cc,_0x188924){var _0x1e74ff={};var _0x1d7548={};var _0x18c1fc;var _0x11f0e1;return db[_0x669c('0x27')][_0x669c('0x4a')]({'where':{'id':_0x4f1cd4[_0x669c('0x47')]['id']}})['then'](handleEntityNotFound(_0x6d37cc,null))[_0x669c('0x22')](function(_0x48addc){if(_0x48addc){_0x18c1fc=_0x48addc;_0x1d7548[_0x669c('0x2c')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x1d7548['query']=_[_0x669c('0x2e')](_0x4f1cd4['query']);_0x1d7548[_0x669c('0x2f')]=_[_0x669c('0x30')](_0x1d7548[_0x669c('0x2c')],_0x1d7548['query']);_0x1e74ff[_0x669c('0x31')]=_[_0x669c('0x30')](_0x1d7548[_0x669c('0x2c')],qs[_0x669c('0x32')](_0x4f1cd4[_0x669c('0x2d')][_0x669c('0x32')]));_0x1e74ff[_0x669c('0x31')]=_0x1e74ff[_0x669c('0x31')][_0x669c('0x33')]?_0x1e74ff[_0x669c('0x31')]:_0x1d7548[_0x669c('0x2c')];_0x1e74ff[_0x669c('0x36')]=qs['sort'](_0x4f1cd4[_0x669c('0x2d')][_0x669c('0x37')]);_0x1e74ff[_0x669c('0x38')]=qs[_0x669c('0x2f')](_[_0x669c('0x4c')](_0x4f1cd4['query'],_0x1d7548[_0x669c('0x2f')]));if(_0x4f1cd4[_0x669c('0x2d')][_0x669c('0x3b')]){_0x1e74ff['where']=_[_0x669c('0x39')](_0x1e74ff[_0x669c('0x38')],{'$or':_[_0x669c('0x26')](_0x1e74ff[_0x669c('0x31')],function(_0x4cccfc){var _0x115951={};_0x115951[_0x4cccfc]={'$like':'%'+_0x4f1cd4[_0x669c('0x2d')][_0x669c('0x3b')]+'%'};return _0x115951;})});}_0x1e74ff=_[_0x669c('0x39')]({},_0x1e74ff,_0x4f1cd4[_0x669c('0x3c')]);return _0x18c1fc[_0x669c('0x4e')](_0x1e74ff);}})[_0x669c('0x22')](function(_0x11bf90){if(_0x11bf90){_0x11f0e1=_0x11bf90[_0x669c('0x33')];if(!_0x4f1cd4['query']['hasOwnProperty']('nolimit')){_0x1e74ff['limit']=qs['limit'](_0x4f1cd4[_0x669c('0x2d')]['limit']);_0x1e74ff[_0x669c('0x1b')]=qs['offset'](_0x4f1cd4['query'][_0x669c('0x1b')]);}return _0x18c1fc[_0x669c('0x4e')](_0x1e74ff);}})[_0x669c('0x22')](function(_0x249664){if(_0x249664){return _0x249664?{'count':_0x11f0e1,'rows':_0x249664}:null;}})['then'](respondWithResult(_0x6d37cc,null))['catch'](handleError(_0x6d37cc,null));}; \ No newline at end of file +var _0xc937=['getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','catch','getFields','findOne','ServicenowField','sort'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc937,0xa4));var _0x7c93=function(_0x55dfd9,_0x362816){_0x55dfd9=_0x55dfd9-0x0;var _0xaf3fad=_0xc937[_0x55dfd9];return _0xaf3fad;};'use strict';var emlformat=require(_0x7c93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c93('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c93('0x2'));var moment=require(_0x7c93('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7c93('0x4'));var csv=require(_0x7c93('0x5'));var ejs=require(_0x7c93('0x6'));var fs=require('fs');var fs_extra=require(_0x7c93('0x7'));var _=require(_0x7c93('0x8'));var squel=require(_0x7c93('0x9'));var crypto=require(_0x7c93('0xa'));var jsforce=require(_0x7c93('0xb'));var deskjs=require(_0x7c93('0xc'));var toCsv=require(_0x7c93('0x5'));var querystring=require(_0x7c93('0xd'));var Papa=require('papaparse');var Redis=require(_0x7c93('0xe'));var authService=require(_0x7c93('0xf'));var qs=require(_0x7c93('0x10'));var as=require(_0x7c93('0x11'));var hardwareService=require(_0x7c93('0x12'));var logger=require('../../config/logger')(_0x7c93('0x13'));var utils=require(_0x7c93('0x14'));var config=require(_0x7c93('0x15'));var licenseUtil=require(_0x7c93('0x16'));var db=require(_0x7c93('0x17'))['db'];function respondWithStatusCode(_0x27c65c,_0x190d61){_0x190d61=_0x190d61||0xcc;return function(_0x188834){if(_0x188834){return _0x27c65c[_0x7c93('0x18')](_0x190d61);}return _0x27c65c[_0x7c93('0x19')](_0x190d61)[_0x7c93('0x1a')]();};}function respondWithResult(_0x5a4756,_0x3813fa){_0x3813fa=_0x3813fa||0xc8;return function(_0x12980f){if(_0x12980f){return _0x5a4756[_0x7c93('0x19')](_0x3813fa)[_0x7c93('0x1b')](_0x12980f);}};}function respondWithFilteredResult(_0xb4ca65,_0x1a6628){return function(_0x4409c3){if(_0x4409c3){var _0x46bfd0=typeof _0x1a6628[_0x7c93('0x1c')]===_0x7c93('0x1d')&&typeof _0x1a6628[_0x7c93('0x1e')]===_0x7c93('0x1d');var _0x4ee2dc=_0x4409c3['count'];var _0x527981=_0x46bfd0?0x0:_0x1a6628[_0x7c93('0x1c')];var _0x12a5d6=_0x46bfd0?_0x4409c3[_0x7c93('0x1f')]:_0x1a6628['offset']+_0x1a6628[_0x7c93('0x1e')];var _0x4aa9cd;if(_0x12a5d6>=_0x4ee2dc){_0x12a5d6=_0x4ee2dc;_0x4aa9cd=0xc8;}else{_0x4aa9cd=0xce;}_0xb4ca65[_0x7c93('0x19')](_0x4aa9cd);return _0xb4ca65[_0x7c93('0x20')](_0x7c93('0x21'),_0x527981+'-'+_0x12a5d6+'/'+_0x4ee2dc)[_0x7c93('0x1b')](_0x4409c3);}return null;};}function patchUpdates(_0x48803a){return function(_0x43dde5){try{jsonpatch[_0x7c93('0x22')](_0x43dde5,_0x48803a,!![]);}catch(_0x23186c){return BPromise[_0x7c93('0x23')](_0x23186c);}return _0x43dde5[_0x7c93('0x24')]();};}function saveUpdates(_0x353a11,_0x346765){return function(_0x2b1df5){if(_0x2b1df5){return _0x2b1df5[_0x7c93('0x25')](_0x353a11)[_0x7c93('0x26')](function(_0x33004c){return _0x33004c;});}return null;};}function removeEntity(_0x3b4f9b,_0xf962f4){return function(_0x1807aa){if(_0x1807aa){return _0x1807aa[_0x7c93('0x27')]()[_0x7c93('0x26')](function(){_0x3b4f9b[_0x7c93('0x19')](0xcc)[_0x7c93('0x1a')]();});}};}function handleEntityNotFound(_0x3b3000,_0x34834c){return function(_0x37b9b6){if(!_0x37b9b6){_0x3b3000[_0x7c93('0x18')](0x194);}return _0x37b9b6;};}function handleError(_0xf772bd,_0x475158){_0x475158=_0x475158||0x1f4;return function(_0x256b03){logger[_0x7c93('0x28')](_0x256b03[_0x7c93('0x29')]);if(_0x256b03['name']){delete _0x256b03[_0x7c93('0x2a')];}_0xf772bd[_0x7c93('0x19')](_0x475158)['send'](_0x256b03);};}exports['index']=function(_0x18b06a,_0x30bd1e){var _0x5911ad={},_0x3d1c3c={},_0x47bb91={'count':0x0,'rows':[]};var _0x554e09=_[_0x7c93('0x2b')](db[_0x7c93('0x2c')][_0x7c93('0x2d')],function(_0x1ec8da){return{'name':_0x1ec8da[_0x7c93('0x2e')],'type':_0x1ec8da[_0x7c93('0x2f')][_0x7c93('0x30')]};});_0x3d1c3c[_0x7c93('0x31')]=_['map'](_0x554e09,_0x7c93('0x2a'));_0x3d1c3c[_0x7c93('0x32')]=_[_0x7c93('0x33')](_0x18b06a[_0x7c93('0x32')]);_0x3d1c3c['filters']=_[_0x7c93('0x34')](_0x3d1c3c[_0x7c93('0x31')],_0x3d1c3c[_0x7c93('0x32')]);_0x5911ad[_0x7c93('0x35')]=_['intersection'](_0x3d1c3c[_0x7c93('0x31')],qs[_0x7c93('0x36')](_0x18b06a[_0x7c93('0x32')][_0x7c93('0x36')]));_0x5911ad[_0x7c93('0x35')]=_0x5911ad['attributes'][_0x7c93('0x37')]?_0x5911ad[_0x7c93('0x35')]:_0x3d1c3c[_0x7c93('0x31')];if(!_0x18b06a[_0x7c93('0x32')][_0x7c93('0x38')](_0x7c93('0x39'))){_0x5911ad[_0x7c93('0x1e')]=qs[_0x7c93('0x1e')](_0x18b06a[_0x7c93('0x32')]['limit']);_0x5911ad[_0x7c93('0x1c')]=qs[_0x7c93('0x1c')](_0x18b06a[_0x7c93('0x32')][_0x7c93('0x1c')]);}_0x5911ad[_0x7c93('0x3a')]=qs['sort'](_0x18b06a['query']['sort']);_0x5911ad[_0x7c93('0x3b')]=qs[_0x7c93('0x3c')](_[_0x7c93('0x3d')](_0x18b06a[_0x7c93('0x32')],_0x3d1c3c[_0x7c93('0x3c')]),_0x554e09);if(_0x18b06a['query'][_0x7c93('0x3e')]){_0x5911ad[_0x7c93('0x3b')]=_[_0x7c93('0x3f')](_0x5911ad[_0x7c93('0x3b')],{'$or':_['map'](_0x554e09,function(_0x530ed4){if(_0x530ed4[_0x7c93('0x2f')]!==_0x7c93('0x40')){var _0x2160e3={};_0x2160e3[_0x530ed4[_0x7c93('0x2a')]]={'$like':'%'+_0x18b06a[_0x7c93('0x32')][_0x7c93('0x3e')]+'%'};return _0x2160e3;}})});}_0x5911ad=_[_0x7c93('0x3f')]({},_0x5911ad,_0x18b06a[_0x7c93('0x41')]);var _0x245a53={'where':_0x5911ad[_0x7c93('0x3b')]};return db[_0x7c93('0x2c')][_0x7c93('0x1f')](_0x245a53)[_0x7c93('0x26')](function(_0x7b7aa){_0x47bb91[_0x7c93('0x1f')]=_0x7b7aa;if(_0x18b06a[_0x7c93('0x32')][_0x7c93('0x42')]){_0x5911ad[_0x7c93('0x43')]=[{'all':!![]}];}return db[_0x7c93('0x2c')][_0x7c93('0x44')](_0x5911ad);})[_0x7c93('0x26')](function(_0x27f413){_0x47bb91['rows']=_0x27f413;return _0x47bb91;})[_0x7c93('0x26')](respondWithFilteredResult(_0x30bd1e,_0x5911ad))['catch'](handleError(_0x30bd1e,null));};exports[_0x7c93('0x45')]=function(_0x4c4577,_0x253e2a){var _0x4ce8cd={'raw':![],'where':{'id':_0x4c4577[_0x7c93('0x46')]['id']}},_0x5e37a8={};_0x5e37a8[_0x7c93('0x31')]=_[_0x7c93('0x33')](db[_0x7c93('0x2c')]['rawAttributes']);_0x5e37a8['query']=_['keys'](_0x4c4577[_0x7c93('0x32')]);_0x5e37a8[_0x7c93('0x3c')]=_[_0x7c93('0x34')](_0x5e37a8['model'],_0x5e37a8['query']);_0x4ce8cd[_0x7c93('0x35')]=_[_0x7c93('0x34')](_0x5e37a8[_0x7c93('0x31')],qs['fields'](_0x4c4577[_0x7c93('0x32')][_0x7c93('0x36')]));_0x4ce8cd[_0x7c93('0x35')]=_0x4ce8cd['attributes'][_0x7c93('0x37')]?_0x4ce8cd[_0x7c93('0x35')]:_0x5e37a8[_0x7c93('0x31')];if(_0x4c4577['query'][_0x7c93('0x42')]){_0x4ce8cd[_0x7c93('0x43')]=[{'all':!![]}];}_0x4ce8cd=_['merge']({},_0x4ce8cd,_0x4c4577[_0x7c93('0x41')]);return db[_0x7c93('0x2c')][_0x7c93('0x47')](_0x4ce8cd)[_0x7c93('0x26')](handleEntityNotFound(_0x253e2a,null))[_0x7c93('0x26')](respondWithResult(_0x253e2a,null))['catch'](handleError(_0x253e2a,null));};exports[_0x7c93('0x48')]=function(_0x7f1a18,_0x2dcced){return db[_0x7c93('0x2c')][_0x7c93('0x48')](_0x7f1a18[_0x7c93('0x49')],{})[_0x7c93('0x26')](respondWithResult(_0x2dcced,0xc9))[_0x7c93('0x4a')](handleError(_0x2dcced,null));};exports['update']=function(_0x1e7124,_0x4905ab){if(_0x1e7124[_0x7c93('0x49')]['id']){delete _0x1e7124[_0x7c93('0x49')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x1e7124[_0x7c93('0x46')]['id']}})[_0x7c93('0x26')](handleEntityNotFound(_0x4905ab,null))[_0x7c93('0x26')](saveUpdates(_0x1e7124[_0x7c93('0x49')],null))['then'](respondWithResult(_0x4905ab,null))[_0x7c93('0x4a')](handleError(_0x4905ab,null));};exports[_0x7c93('0x27')]=function(_0x105963,_0x20fe95){return db[_0x7c93('0x2c')][_0x7c93('0x47')]({'where':{'id':_0x105963[_0x7c93('0x46')]['id']}})[_0x7c93('0x26')](handleEntityNotFound(_0x20fe95,null))[_0x7c93('0x26')](removeEntity(_0x20fe95,null))[_0x7c93('0x4a')](handleError(_0x20fe95,null));};exports[_0x7c93('0x4b')]=function(_0x3dcce8,_0x42ab1a,_0x37c718){var _0x55e0b4={};var _0xe5902b={};var _0x53f79e;var _0x481391;return db['ServicenowConfiguration'][_0x7c93('0x4c')]({'where':{'id':_0x3dcce8[_0x7c93('0x46')]['id']}})[_0x7c93('0x26')](handleEntityNotFound(_0x42ab1a,null))[_0x7c93('0x26')](function(_0x1a5432){if(_0x1a5432){_0x53f79e=_0x1a5432;_0xe5902b['model']=_[_0x7c93('0x33')](db[_0x7c93('0x4d')][_0x7c93('0x2d')]);_0xe5902b[_0x7c93('0x32')]=_[_0x7c93('0x33')](_0x3dcce8[_0x7c93('0x32')]);_0xe5902b['filters']=_[_0x7c93('0x34')](_0xe5902b[_0x7c93('0x31')],_0xe5902b['query']);_0x55e0b4[_0x7c93('0x35')]=_[_0x7c93('0x34')](_0xe5902b[_0x7c93('0x31')],qs['fields'](_0x3dcce8[_0x7c93('0x32')][_0x7c93('0x36')]));_0x55e0b4['attributes']=_0x55e0b4[_0x7c93('0x35')][_0x7c93('0x37')]?_0x55e0b4[_0x7c93('0x35')]:_0xe5902b['model'];_0x55e0b4[_0x7c93('0x3a')]=qs[_0x7c93('0x4e')](_0x3dcce8[_0x7c93('0x32')][_0x7c93('0x4e')]);_0x55e0b4[_0x7c93('0x3b')]=qs['filters'](_['pick'](_0x3dcce8[_0x7c93('0x32')],_0xe5902b[_0x7c93('0x3c')]));if(_0x3dcce8['query'][_0x7c93('0x3e')]){_0x55e0b4[_0x7c93('0x3b')]=_[_0x7c93('0x3f')](_0x55e0b4['where'],{'$or':_[_0x7c93('0x2b')](_0x55e0b4['attributes'],function(_0x26db01){var _0x33a649={};_0x33a649[_0x26db01]={'$like':'%'+_0x3dcce8['query'][_0x7c93('0x3e')]+'%'};return _0x33a649;})});}_0x55e0b4=_[_0x7c93('0x3f')]({},_0x55e0b4,_0x3dcce8[_0x7c93('0x41')]);return _0x53f79e[_0x7c93('0x4b')](_0x55e0b4);}})[_0x7c93('0x26')](function(_0x2939d2){if(_0x2939d2){_0x481391=_0x2939d2[_0x7c93('0x37')];if(!_0x3dcce8[_0x7c93('0x32')][_0x7c93('0x38')]('nolimit')){_0x55e0b4[_0x7c93('0x1e')]=qs[_0x7c93('0x1e')](_0x3dcce8[_0x7c93('0x32')][_0x7c93('0x1e')]);_0x55e0b4[_0x7c93('0x1c')]=qs['offset'](_0x3dcce8['query'][_0x7c93('0x1c')]);}return _0x53f79e[_0x7c93('0x4b')](_0x55e0b4);}})[_0x7c93('0x26')](function(_0x1c0538){if(_0x1c0538){return _0x1c0538?{'count':_0x481391,'rows':_0x1c0538}:null;}})[_0x7c93('0x26')](respondWithResult(_0x42ab1a,null))[_0x7c93('0x4a')](handleError(_0x42ab1a,null));};exports[_0x7c93('0x4f')]=function(_0xeabb4,_0x97647c,_0x41fcd7){var _0x46f1ad={};var _0x58ceb7={};var _0x404cd8;var _0x3e3ea6;return db[_0x7c93('0x2c')]['findOne']({'where':{'id':_0xeabb4[_0x7c93('0x46')]['id']}})[_0x7c93('0x26')](handleEntityNotFound(_0x97647c,null))[_0x7c93('0x26')](function(_0x2113a8){if(_0x2113a8){_0x404cd8=_0x2113a8;_0x58ceb7[_0x7c93('0x31')]=_[_0x7c93('0x33')](db['ServicenowField'][_0x7c93('0x2d')]);_0x58ceb7[_0x7c93('0x32')]=_[_0x7c93('0x33')](_0xeabb4[_0x7c93('0x32')]);_0x58ceb7[_0x7c93('0x3c')]=_[_0x7c93('0x34')](_0x58ceb7[_0x7c93('0x31')],_0x58ceb7[_0x7c93('0x32')]);_0x46f1ad['attributes']=_['intersection'](_0x58ceb7['model'],qs[_0x7c93('0x36')](_0xeabb4[_0x7c93('0x32')][_0x7c93('0x36')]));_0x46f1ad['attributes']=_0x46f1ad[_0x7c93('0x35')][_0x7c93('0x37')]?_0x46f1ad[_0x7c93('0x35')]:_0x58ceb7[_0x7c93('0x31')];_0x46f1ad[_0x7c93('0x3a')]=qs[_0x7c93('0x4e')](_0xeabb4[_0x7c93('0x32')][_0x7c93('0x4e')]);_0x46f1ad[_0x7c93('0x3b')]=qs['filters'](_[_0x7c93('0x3d')](_0xeabb4[_0x7c93('0x32')],_0x58ceb7['filters']));if(_0xeabb4[_0x7c93('0x32')][_0x7c93('0x3e')]){_0x46f1ad[_0x7c93('0x3b')]=_[_0x7c93('0x3f')](_0x46f1ad[_0x7c93('0x3b')],{'$or':_['map'](_0x46f1ad['attributes'],function(_0x17e565){var _0x40a186={};_0x40a186[_0x17e565]={'$like':'%'+_0xeabb4[_0x7c93('0x32')][_0x7c93('0x3e')]+'%'};return _0x40a186;})});}_0x46f1ad=_[_0x7c93('0x3f')]({},_0x46f1ad,_0xeabb4[_0x7c93('0x41')]);return _0x404cd8[_0x7c93('0x4f')](_0x46f1ad);}})[_0x7c93('0x26')](function(_0x3bb2bf){if(_0x3bb2bf){_0x3e3ea6=_0x3bb2bf[_0x7c93('0x37')];if(!_0xeabb4[_0x7c93('0x32')][_0x7c93('0x38')](_0x7c93('0x39'))){_0x46f1ad[_0x7c93('0x1e')]=qs['limit'](_0xeabb4[_0x7c93('0x32')][_0x7c93('0x1e')]);_0x46f1ad[_0x7c93('0x1c')]=qs[_0x7c93('0x1c')](_0xeabb4[_0x7c93('0x32')][_0x7c93('0x1c')]);}return _0x404cd8[_0x7c93('0x4f')](_0x46f1ad);}})['then'](function(_0x5f1fec){if(_0x5f1fec){return _0x5f1fec?{'count':_0x3e3ea6,'rows':_0x5f1fec}:null;}})['then'](respondWithResult(_0x97647c,null))[_0x7c93('0x4a')](handleError(_0x97647c,null));};exports[_0x7c93('0x50')]=function(_0x1b8cfd,_0x5f2497,_0xcf2cf3){var _0x1675ad={};var _0x14a935={};var _0x1d72fb;var _0x15f6f3;return db[_0x7c93('0x2c')][_0x7c93('0x4c')]({'where':{'id':_0x1b8cfd['params']['id']}})['then'](handleEntityNotFound(_0x5f2497,null))[_0x7c93('0x26')](function(_0xbf2520){if(_0xbf2520){_0x1d72fb=_0xbf2520;_0x14a935[_0x7c93('0x31')]=_['keys'](db[_0x7c93('0x4d')][_0x7c93('0x2d')]);_0x14a935[_0x7c93('0x32')]=_['keys'](_0x1b8cfd[_0x7c93('0x32')]);_0x14a935[_0x7c93('0x3c')]=_[_0x7c93('0x34')](_0x14a935[_0x7c93('0x31')],_0x14a935[_0x7c93('0x32')]);_0x1675ad['attributes']=_[_0x7c93('0x34')](_0x14a935[_0x7c93('0x31')],qs[_0x7c93('0x36')](_0x1b8cfd[_0x7c93('0x32')][_0x7c93('0x36')]));_0x1675ad[_0x7c93('0x35')]=_0x1675ad[_0x7c93('0x35')]['length']?_0x1675ad['attributes']:_0x14a935[_0x7c93('0x31')];_0x1675ad[_0x7c93('0x3a')]=qs['sort'](_0x1b8cfd[_0x7c93('0x32')][_0x7c93('0x4e')]);_0x1675ad['where']=qs[_0x7c93('0x3c')](_[_0x7c93('0x3d')](_0x1b8cfd[_0x7c93('0x32')],_0x14a935[_0x7c93('0x3c')]));if(_0x1b8cfd[_0x7c93('0x32')][_0x7c93('0x3e')]){_0x1675ad['where']=_[_0x7c93('0x3f')](_0x1675ad[_0x7c93('0x3b')],{'$or':_[_0x7c93('0x2b')](_0x1675ad[_0x7c93('0x35')],function(_0xa34551){var _0x5ead6c={};_0x5ead6c[_0xa34551]={'$like':'%'+_0x1b8cfd[_0x7c93('0x32')]['filter']+'%'};return _0x5ead6c;})});}_0x1675ad=_[_0x7c93('0x3f')]({},_0x1675ad,_0x1b8cfd['options']);return _0x1d72fb[_0x7c93('0x50')](_0x1675ad);}})[_0x7c93('0x26')](function(_0x174c84){if(_0x174c84){_0x15f6f3=_0x174c84[_0x7c93('0x37')];if(!_0x1b8cfd[_0x7c93('0x32')][_0x7c93('0x38')]('nolimit')){_0x1675ad['limit']=qs[_0x7c93('0x1e')](_0x1b8cfd[_0x7c93('0x32')][_0x7c93('0x1e')]);_0x1675ad[_0x7c93('0x1c')]=qs[_0x7c93('0x1c')](_0x1b8cfd[_0x7c93('0x32')][_0x7c93('0x1c')]);}return _0x1d72fb[_0x7c93('0x50')](_0x1675ad);}})[_0x7c93('0x26')](function(_0x5e636f){if(_0x5e636f){return _0x5e636f?{'count':_0x15f6f3,'rows':_0x5e636f}:null;}})['then'](respondWithResult(_0x5f2497,null))[_0x7c93('0x4a')](handleError(_0x5f2497,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index dac172c..2ba361d 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 _0xaa1b=['exports','define','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x42a059,_0x2f81d4){var _0x41aa7c=function(_0x3b343d){while(--_0x3b343d){_0x42a059['push'](_0x42a059['shift']());}};_0x41aa7c(++_0x2f81d4);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var logger=require(_0xbaa1('0x2'))('api');var moment=require(_0xbaa1('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaa1('0x4'));var fs=require('fs');var path=require(_0xbaa1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xbaa1('0x6')]=function(_0x27b99c,_0x4a5735){return _0x27b99c[_0xbaa1('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0xbaa1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d45=['../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d45,0x1d2));var _0x53d4=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x3d45[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var logger=require(_0x53d4('0x2'))(_0x53d4('0x3'));var moment=require(_0x53d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x53d4('0x5'));var fs=require('fs');var path=require(_0x53d4('0x6'));var rimraf=require('rimraf');var config=require(_0x53d4('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x4cfea8,_0x54b0a4){return _0x4cfea8[_0x53d4('0x8')](_0x53d4('0x9'),attributes,{'tableName':_0x53d4('0xa'),'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 7906a8a..a5db77f 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 _0x644f=['stringify','error','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x31c269,_0x58f97e){var _0x475bbf=function(_0x1cd9b4){while(--_0x1cd9b4){_0x31c269['push'](_0x31c269['shift']());}};_0x475bbf(++_0x58f97e);}(_0x644f,0xc2));var _0xf644=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x644f[_0x2bf888];return _0x3038d6;};'use strict';var _=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf644('0x2'));var fs=require('fs');var Redis=require(_0xf644('0x3'));var db=require(_0xf644('0x4'))['db'];var utils=require(_0xf644('0x5'));var logger=require(_0xf644('0x6'))(_0xf644('0x7'));var config=require(_0xf644('0x8'));var jayson=require(_0xf644('0x9'));var client=jayson[_0xf644('0xa')][_0xf644('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c7aaf,_0x454018,_0x50362e){return new BPromise(function(_0x2c2868,_0x11fa91){return client['request'](_0x2c7aaf,_0x50362e)[_0xf644('0xc')](function(_0x5746ae){logger['info'](_0xf644('0xd'),_0x454018,'request\x20sent');logger[_0xf644('0xe')](_0xf644('0xf'),_0x454018,'request\x20sent',JSON[_0xf644('0x10')](_0x5746ae));if(_0x5746ae[_0xf644('0x11')]){if(_0x5746ae[_0xf644('0x11')]['code']===0x1f4){logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x5746ae['error'][_0xf644('0x12')]);return _0x11fa91(_0x5746ae[_0xf644('0x11')]['message']);}logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x5746ae[_0xf644('0x11')][_0xf644('0x12')]);return _0x2c2868(_0x5746ae['error'][_0xf644('0x12')]);}else{logger[_0xf644('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x454018,'request\x20sent');_0x2c2868(_0x5746ae['result']['message']);}})[_0xf644('0x14')](function(_0x331478){logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x331478);_0x11fa91(_0x331478);});});} \ No newline at end of file +var _0xf56e=['rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2134cb,_0x1f95e7){var _0x114e62=function(_0x3885a1){while(--_0x3885a1){_0x2134cb['push'](_0x2134cb['shift']());}};_0x114e62(++_0x1f95e7);}(_0xf56e,0x152));var _0xef56=function(_0x1114b8,_0x38a20e){_0x1114b8=_0x1114b8-0x0;var _0x5d51d1=_0xf56e[_0x1114b8];return _0x5d51d1;};'use strict';var _=require('lodash');var util=require(_0xef56('0x0'));var moment=require(_0xef56('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef56('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xef56('0x3'))(_0xef56('0x4'));var config=require('../../config/environment');var jayson=require(_0xef56('0x5'));var client=jayson[_0xef56('0x6')][_0xef56('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4307b0,_0x52bcb4,_0x1e411d){return new BPromise(function(_0x4c762b,_0x1099ef){return client[_0xef56('0x8')](_0x4307b0,_0x1e411d)[_0xef56('0x9')](function(_0x2f7687){logger[_0xef56('0xa')](_0xef56('0xb'),_0x52bcb4,_0xef56('0xc'));logger[_0xef56('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x52bcb4,_0xef56('0xc'),JSON[_0xef56('0xe')](_0x2f7687));if(_0x2f7687[_0xef56('0xf')]){if(_0x2f7687['error']['code']===0x1f4){logger['error'](_0xef56('0xb'),_0x52bcb4,_0x2f7687[_0xef56('0xf')]['message']);return _0x1099ef(_0x2f7687[_0xef56('0xf')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x52bcb4,_0x2f7687[_0xef56('0xf')][_0xef56('0x10')]);return _0x4c762b(_0x2f7687[_0xef56('0xf')][_0xef56('0x10')]);}else{logger[_0xef56('0xa')](_0xef56('0xb'),_0x52bcb4,_0xef56('0xc'));_0x4c762b(_0x2f7687['result'][_0xef56('0x10')]);}})[_0xef56('0x11')](function(_0x3c4df6){logger[_0xef56('0xf')](_0xef56('0xb'),_0x52bcb4,_0x3c4df6);_0x1099ef(_0x3c4df6);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 661c626..954bdcd 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 _0x8768=['index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x303f6f,_0xded9d9){var _0x2cff0a=function(_0x314391){while(--_0x314391){_0x303f6f['push'](_0x303f6f['shift']());}};_0x2cff0a(++_0xded9d9);}(_0x8768,0x16e));var _0x8876=function(_0x1207ad,_0x3b5326){_0x1207ad=_0x1207ad-0x0;var _0x124f58=_0x8768[_0x1207ad];return _0x124f58;};'use strict';var multer=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var path=require(_0x8876('0x2'));var timeout=require(_0x8876('0x3'));var express=require(_0x8876('0x4'));var router=express[_0x8876('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8876('0x6'));var interaction=require(_0x8876('0x7'));var config=require(_0x8876('0x8'));var controller=require(_0x8876('0x9'));router[_0x8876('0xa')]('/',auth[_0x8876('0xb')](),controller[_0x8876('0xc')]);router['get'](_0x8876('0xd'),auth['isAuthenticated'](),controller[_0x8876('0xe')]);router[_0x8876('0xf')]('/',auth['isAuthenticated'](),controller[_0x8876('0x10')]);router[_0x8876('0x11')](_0x8876('0xd'),auth['isAuthenticated'](),controller[_0x8876('0x12')]);router[_0x8876('0x13')]('/:id',auth[_0x8876('0xb')](),controller[_0x8876('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0d61=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3b2ac8,_0x3819fe){var _0x3574f2=function(_0x4d5752){while(--_0x4d5752){_0x3b2ac8['push'](_0x3b2ac8['shift']());}};_0x3574f2(++_0x3819fe);}(_0x0d61,0x111));var _0x10d6=function(_0x52551e,_0x5c759b){_0x52551e=_0x52551e-0x0;var _0x17ab68=_0x0d61[_0x52551e];return _0x17ab68;};'use strict';var multer=require(_0x10d6('0x0'));var util=require(_0x10d6('0x1'));var path=require(_0x10d6('0x2'));var timeout=require(_0x10d6('0x3'));var express=require('express');var router=express[_0x10d6('0x4')]();var fs_extra=require(_0x10d6('0x5'));var auth=require(_0x10d6('0x6'));var interaction=require(_0x10d6('0x7'));var config=require(_0x10d6('0x8'));var controller=require('./intServicenowField.controller');router[_0x10d6('0x9')]('/',auth[_0x10d6('0xa')](),controller[_0x10d6('0xb')]);router[_0x10d6('0x9')](_0x10d6('0xc'),auth['isAuthenticated'](),controller[_0x10d6('0xd')]);router[_0x10d6('0xe')]('/',auth['isAuthenticated'](),controller[_0x10d6('0xf')]);router[_0x10d6('0x10')]('/:id',auth[_0x10d6('0xa')](),controller[_0x10d6('0x11')]);router[_0x10d6('0x12')](_0x10d6('0xc'),auth['isAuthenticated'](),controller[_0x10d6('0x13')]);module[_0x10d6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 555b8f9..34cf0bc 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 _0x87eb=['BOOLEAN','sequelize','exports','variable','customVariable','picklist','string','STRING','ENUM'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x87eb,0x133));var _0xb87e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x87eb[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xb87e('0x0'));module[_0xb87e('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xb87e('0x2'),_0xb87e('0x3'),'keyValue',_0xb87e('0x4')),'defaultValue':_0xb87e('0x5')},'content':{'type':Sequelize[_0xb87e('0x6')]},'key':{'type':Sequelize[_0xb87e('0x6')]},'keyType':{'type':Sequelize[_0xb87e('0x7')]('string',_0xb87e('0x2'),_0xb87e('0x3'))},'keyContent':{'type':Sequelize[_0xb87e('0x6')]},'idField':{'type':Sequelize[_0xb87e('0x6')]},'nameField':{'type':Sequelize[_0xb87e('0x6')]},'customField':{'type':Sequelize[_0xb87e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb87e('0x6')]}}; \ No newline at end of file +var _0xcd59=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x37831c,_0x5de47b){var _0x1da942=function(_0x3ca9a6){while(--_0x3ca9a6){_0x37831c['push'](_0x37831c['shift']());}};_0x1da942(++_0x5de47b);}(_0xcd59,0xe6));var _0x9cd5=function(_0x593467,_0x14e615){_0x593467=_0x593467-0x0;var _0x67a71b=_0xcd59[_0x593467];return _0x67a71b;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'type':{'type':Sequelize[_0x9cd5('0x2')](_0x9cd5('0x3'),_0x9cd5('0x4'),'customVariable',_0x9cd5('0x5'),_0x9cd5('0x6')),'defaultValue':_0x9cd5('0x3')},'content':{'type':Sequelize[_0x9cd5('0x7')]},'key':{'type':Sequelize[_0x9cd5('0x7')]},'keyType':{'type':Sequelize[_0x9cd5('0x2')](_0x9cd5('0x3'),_0x9cd5('0x4'),_0x9cd5('0x8'))},'keyContent':{'type':Sequelize[_0x9cd5('0x7')]},'idField':{'type':Sequelize[_0x9cd5('0x7')]},'nameField':{'type':Sequelize[_0x9cd5('0x7')]},'customField':{'type':Sequelize[_0x9cd5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9cd5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index cd0d040..bc11880 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 _0xbc51=['end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','VIRTUAL','filter','merge','ServicenowField','includeAll','include','findAll','rows','catch','rawAttributes','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xbc51,0x14d));var _0x1bc5=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0xbc51[_0x36b037];return _0x409194;};'use strict';var emlformat=require(_0x1bc5('0x0'));var rimraf=require(_0x1bc5('0x1'));var zipdir=require(_0x1bc5('0x2'));var jsonpatch=require(_0x1bc5('0x3'));var rp=require(_0x1bc5('0x4'));var moment=require(_0x1bc5('0x5'));var BPromise=require(_0x1bc5('0x6'));var Mustache=require(_0x1bc5('0x7'));var util=require(_0x1bc5('0x8'));var path=require('path');var sox=require(_0x1bc5('0x9'));var csv=require(_0x1bc5('0xa'));var ejs=require(_0x1bc5('0xb'));var fs=require('fs');var fs_extra=require(_0x1bc5('0xc'));var _=require(_0x1bc5('0xd'));var squel=require(_0x1bc5('0xe'));var crypto=require('crypto');var jsforce=require(_0x1bc5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1bc5('0xa'));var querystring=require(_0x1bc5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1bc5('0x11'));var qs=require(_0x1bc5('0x12'));var as=require(_0x1bc5('0x13'));var hardwareService=require(_0x1bc5('0x14'));var logger=require(_0x1bc5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1bc5('0x16'));var licenseUtil=require(_0x1bc5('0x17'));var db=require(_0x1bc5('0x18'))['db'];function respondWithStatusCode(_0xc2978f,_0x35643a){_0x35643a=_0x35643a||0xcc;return function(_0x1c456f){if(_0x1c456f){return _0xc2978f[_0x1bc5('0x19')](_0x35643a);}return _0xc2978f[_0x1bc5('0x1a')](_0x35643a)[_0x1bc5('0x1b')]();};}function respondWithResult(_0x427625,_0x35cd5b){_0x35cd5b=_0x35cd5b||0xc8;return function(_0x13dcb8){if(_0x13dcb8){return _0x427625[_0x1bc5('0x1a')](_0x35cd5b)['json'](_0x13dcb8);}};}function respondWithFilteredResult(_0x400088,_0x4e4a68){return function(_0x1ecf91){if(_0x1ecf91){var _0x4a573e=typeof _0x4e4a68[_0x1bc5('0x1c')]===_0x1bc5('0x1d')&&typeof _0x4e4a68[_0x1bc5('0x1e')]===_0x1bc5('0x1d');var _0x272eb5=_0x1ecf91[_0x1bc5('0x1f')];var _0x4e2278=_0x4a573e?0x0:_0x4e4a68['offset'];var _0x3dcad1=_0x4a573e?_0x1ecf91['count']:_0x4e4a68[_0x1bc5('0x1c')]+_0x4e4a68['limit'];var _0x44b1dd;if(_0x3dcad1>=_0x272eb5){_0x3dcad1=_0x272eb5;_0x44b1dd=0xc8;}else{_0x44b1dd=0xce;}_0x400088[_0x1bc5('0x1a')](_0x44b1dd);return _0x400088[_0x1bc5('0x20')](_0x1bc5('0x21'),_0x4e2278+'-'+_0x3dcad1+'/'+_0x272eb5)[_0x1bc5('0x22')](_0x1ecf91);}return null;};}function patchUpdates(_0x5442c8){return function(_0x1be8f9){try{jsonpatch['apply'](_0x1be8f9,_0x5442c8,!![]);}catch(_0x236ebb){return BPromise[_0x1bc5('0x23')](_0x236ebb);}return _0x1be8f9[_0x1bc5('0x24')]();};}function saveUpdates(_0x4689ab,_0xfdfa70){return function(_0x57bbf9){if(_0x57bbf9){return _0x57bbf9[_0x1bc5('0x25')](_0x4689ab)['then'](function(_0x117b10){return _0x117b10;});}return null;};}function removeEntity(_0x36a93b,_0x5c11f9){return function(_0x1fe465){if(_0x1fe465){return _0x1fe465['destroy']()[_0x1bc5('0x26')](function(){_0x36a93b[_0x1bc5('0x1a')](0xcc)[_0x1bc5('0x1b')]();});}};}function handleEntityNotFound(_0x3943bb,_0x5a2566){return function(_0x54c1e4){if(!_0x54c1e4){_0x3943bb[_0x1bc5('0x19')](0x194);}return _0x54c1e4;};}function handleError(_0x7060d3,_0x5491c7){_0x5491c7=_0x5491c7||0x1f4;return function(_0xf9b0cc){logger[_0x1bc5('0x27')](_0xf9b0cc['stack']);if(_0xf9b0cc[_0x1bc5('0x28')]){delete _0xf9b0cc['name'];}_0x7060d3[_0x1bc5('0x1a')](_0x5491c7)[_0x1bc5('0x29')](_0xf9b0cc);};}exports['index']=function(_0x55f8ca,_0x6e207b){var _0x567246={},_0x38f698={},_0x22a7bd={'count':0x0,'rows':[]};var _0x458257=_[_0x1bc5('0x2a')](db['ServicenowField']['rawAttributes'],function(_0x5eb316){return{'name':_0x5eb316[_0x1bc5('0x2b')],'type':_0x5eb316[_0x1bc5('0x2c')][_0x1bc5('0x2d')]};});_0x38f698[_0x1bc5('0x2e')]=_['map'](_0x458257,_0x1bc5('0x28'));_0x38f698[_0x1bc5('0x2f')]=_[_0x1bc5('0x30')](_0x55f8ca['query']);_0x38f698['filters']=_[_0x1bc5('0x31')](_0x38f698['model'],_0x38f698[_0x1bc5('0x2f')]);_0x567246[_0x1bc5('0x32')]=_[_0x1bc5('0x31')](_0x38f698['model'],qs['fields'](_0x55f8ca[_0x1bc5('0x2f')][_0x1bc5('0x33')]));_0x567246['attributes']=_0x567246[_0x1bc5('0x32')][_0x1bc5('0x34')]?_0x567246[_0x1bc5('0x32')]:_0x38f698[_0x1bc5('0x2e')];if(!_0x55f8ca[_0x1bc5('0x2f')]['hasOwnProperty']('nolimit')){_0x567246[_0x1bc5('0x1e')]=qs[_0x1bc5('0x1e')](_0x55f8ca[_0x1bc5('0x2f')][_0x1bc5('0x1e')]);_0x567246[_0x1bc5('0x1c')]=qs[_0x1bc5('0x1c')](_0x55f8ca[_0x1bc5('0x2f')][_0x1bc5('0x1c')]);}_0x567246['order']=qs[_0x1bc5('0x35')](_0x55f8ca[_0x1bc5('0x2f')]['sort']);_0x567246[_0x1bc5('0x36')]=qs[_0x1bc5('0x37')](_['pick'](_0x55f8ca['query'],_0x38f698['filters']),_0x458257);if(_0x55f8ca[_0x1bc5('0x2f')]['filter']){_0x567246[_0x1bc5('0x36')]=_['merge'](_0x567246['where'],{'$or':_[_0x1bc5('0x2a')](_0x458257,function(_0x1c0a1b){if(_0x1c0a1b[_0x1bc5('0x2c')]!==_0x1bc5('0x38')){var _0x16000c={};_0x16000c[_0x1c0a1b['name']]={'$like':'%'+_0x55f8ca[_0x1bc5('0x2f')][_0x1bc5('0x39')]+'%'};return _0x16000c;}})});}_0x567246=_[_0x1bc5('0x3a')]({},_0x567246,_0x55f8ca['options']);var _0x44a4e6={'where':_0x567246[_0x1bc5('0x36')]};return db[_0x1bc5('0x3b')][_0x1bc5('0x1f')](_0x44a4e6)['then'](function(_0x61fd62){_0x22a7bd[_0x1bc5('0x1f')]=_0x61fd62;if(_0x55f8ca[_0x1bc5('0x2f')][_0x1bc5('0x3c')]){_0x567246[_0x1bc5('0x3d')]=[{'all':!![]}];}return db[_0x1bc5('0x3b')][_0x1bc5('0x3e')](_0x567246);})[_0x1bc5('0x26')](function(_0x3682cc){_0x22a7bd[_0x1bc5('0x3f')]=_0x3682cc;return _0x22a7bd;})['then'](respondWithFilteredResult(_0x6e207b,_0x567246))[_0x1bc5('0x40')](handleError(_0x6e207b,null));};exports['show']=function(_0x3a8500,_0x4579a9){var _0x3f2bb4={'raw':!![],'where':{'id':_0x3a8500['params']['id']}},_0x479f95={};_0x479f95[_0x1bc5('0x2e')]=_[_0x1bc5('0x30')](db[_0x1bc5('0x3b')][_0x1bc5('0x41')]);_0x479f95['query']=_[_0x1bc5('0x30')](_0x3a8500[_0x1bc5('0x2f')]);_0x479f95[_0x1bc5('0x37')]=_['intersection'](_0x479f95[_0x1bc5('0x2e')],_0x479f95[_0x1bc5('0x2f')]);_0x3f2bb4[_0x1bc5('0x32')]=_['intersection'](_0x479f95[_0x1bc5('0x2e')],qs['fields'](_0x3a8500['query']['fields']));_0x3f2bb4[_0x1bc5('0x32')]=_0x3f2bb4[_0x1bc5('0x32')]['length']?_0x3f2bb4[_0x1bc5('0x32')]:_0x479f95[_0x1bc5('0x2e')];if(_0x3a8500['query'][_0x1bc5('0x3c')]){_0x3f2bb4[_0x1bc5('0x3d')]=[{'all':!![]}];}_0x3f2bb4=_[_0x1bc5('0x3a')]({},_0x3f2bb4,_0x3a8500[_0x1bc5('0x42')]);return db['ServicenowField'][_0x1bc5('0x43')](_0x3f2bb4)[_0x1bc5('0x26')](handleEntityNotFound(_0x4579a9,null))[_0x1bc5('0x26')](respondWithResult(_0x4579a9,null))[_0x1bc5('0x40')](handleError(_0x4579a9,null));};exports[_0x1bc5('0x44')]=function(_0x3c8db1,_0xc1b381){return db[_0x1bc5('0x3b')][_0x1bc5('0x44')](_0x3c8db1['body'],{})['then'](respondWithResult(_0xc1b381,0xc9))[_0x1bc5('0x40')](handleError(_0xc1b381,null));};exports['update']=function(_0xa0111f,_0x37f880){if(_0xa0111f['body']['id']){delete _0xa0111f[_0x1bc5('0x45')]['id'];}return db['ServicenowField'][_0x1bc5('0x43')]({'where':{'id':_0xa0111f[_0x1bc5('0x46')]['id']}})[_0x1bc5('0x26')](handleEntityNotFound(_0x37f880,null))['then'](saveUpdates(_0xa0111f[_0x1bc5('0x45')],null))[_0x1bc5('0x26')](respondWithResult(_0x37f880,null))['catch'](handleError(_0x37f880,null));};exports[_0x1bc5('0x47')]=function(_0x35bfb5,_0x49f033){return db[_0x1bc5('0x3b')][_0x1bc5('0x43')]({'where':{'id':_0x35bfb5[_0x1bc5('0x46')]['id']}})[_0x1bc5('0x26')](handleEntityNotFound(_0x49f033,null))[_0x1bc5('0x26')](removeEntity(_0x49f033,null))[_0x1bc5('0x40')](handleError(_0x49f033,null));}; \ No newline at end of file +var _0xeab5=['update','then','destroy','stack','name','send','index','map','ServicenowField','fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save'];(function(_0xc4e092,_0x5059f7){var _0xa4f542=function(_0x302769){while(--_0x302769){_0xc4e092['push'](_0xc4e092['shift']());}};_0xa4f542(++_0x5059f7);}(_0xeab5,0xb9));var _0x5eab=function(_0x4a68cb,_0x26b341){_0x4a68cb=_0x4a68cb-0x0;var _0x373828=_0xeab5[_0x4a68cb];return _0x373828;};'use strict';var emlformat=require(_0x5eab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eab('0x1'));var jsonpatch=require(_0x5eab('0x2'));var rp=require(_0x5eab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5eab('0x4'));var util=require(_0x5eab('0x5'));var path=require('path');var sox=require(_0x5eab('0x6'));var csv=require(_0x5eab('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5eab('0x8'));var _=require(_0x5eab('0x9'));var squel=require(_0x5eab('0xa'));var crypto=require(_0x5eab('0xb'));var jsforce=require(_0x5eab('0xc'));var deskjs=require(_0x5eab('0xd'));var toCsv=require(_0x5eab('0x7'));var querystring=require(_0x5eab('0xe'));var Papa=require('papaparse');var Redis=require(_0x5eab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5eab('0x10'));var as=require(_0x5eab('0x11'));var hardwareService=require(_0x5eab('0x12'));var logger=require(_0x5eab('0x13'))(_0x5eab('0x14'));var utils=require(_0x5eab('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5eab('0x16'));var db=require(_0x5eab('0x17'))['db'];function respondWithStatusCode(_0x40a9e5,_0x10ad94){_0x10ad94=_0x10ad94||0xcc;return function(_0x49e5c5){if(_0x49e5c5){return _0x40a9e5[_0x5eab('0x18')](_0x10ad94);}return _0x40a9e5['status'](_0x10ad94)['end']();};}function respondWithResult(_0x5ad695,_0x595015){_0x595015=_0x595015||0xc8;return function(_0xb424c4){if(_0xb424c4){return _0x5ad695[_0x5eab('0x19')](_0x595015)[_0x5eab('0x1a')](_0xb424c4);}};}function respondWithFilteredResult(_0x584a2f,_0x2d7643){return function(_0x320bbf){if(_0x320bbf){var _0x3c811f=typeof _0x2d7643[_0x5eab('0x1b')]===_0x5eab('0x1c')&&typeof _0x2d7643[_0x5eab('0x1d')]==='undefined';var _0x13bfdc=_0x320bbf[_0x5eab('0x1e')];var _0x555137=_0x3c811f?0x0:_0x2d7643['offset'];var _0x1822fa=_0x3c811f?_0x320bbf[_0x5eab('0x1e')]:_0x2d7643[_0x5eab('0x1b')]+_0x2d7643['limit'];var _0x18e30c;if(_0x1822fa>=_0x13bfdc){_0x1822fa=_0x13bfdc;_0x18e30c=0xc8;}else{_0x18e30c=0xce;}_0x584a2f[_0x5eab('0x19')](_0x18e30c);return _0x584a2f['set'](_0x5eab('0x1f'),_0x555137+'-'+_0x1822fa+'/'+_0x13bfdc)[_0x5eab('0x1a')](_0x320bbf);}return null;};}function patchUpdates(_0x279b2a){return function(_0x1825a8){try{jsonpatch[_0x5eab('0x20')](_0x1825a8,_0x279b2a,!![]);}catch(_0x40a47a){return BPromise['reject'](_0x40a47a);}return _0x1825a8[_0x5eab('0x21')]();};}function saveUpdates(_0x46b1b0,_0x3c55d5){return function(_0x32abb2){if(_0x32abb2){return _0x32abb2[_0x5eab('0x22')](_0x46b1b0)[_0x5eab('0x23')](function(_0x5b301c){return _0x5b301c;});}return null;};}function removeEntity(_0x41d286,_0x1c225a){return function(_0x5db59f){if(_0x5db59f){return _0x5db59f[_0x5eab('0x24')]()[_0x5eab('0x23')](function(){_0x41d286[_0x5eab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32fe03,_0x21c3c3){return function(_0x5a3cb5){if(!_0x5a3cb5){_0x32fe03['sendStatus'](0x194);}return _0x5a3cb5;};}function handleError(_0xd04aad,_0x4b9832){_0x4b9832=_0x4b9832||0x1f4;return function(_0x49330e){logger['error'](_0x49330e[_0x5eab('0x25')]);if(_0x49330e[_0x5eab('0x26')]){delete _0x49330e[_0x5eab('0x26')];}_0xd04aad['status'](_0x4b9832)[_0x5eab('0x27')](_0x49330e);};}exports[_0x5eab('0x28')]=function(_0x47d62e,_0x5252c1){var _0x29fc91={},_0x230ccb={},_0x4cb361={'count':0x0,'rows':[]};var _0x52dd52=_[_0x5eab('0x29')](db[_0x5eab('0x2a')]['rawAttributes'],function(_0xc67c3e){return{'name':_0xc67c3e[_0x5eab('0x2b')],'type':_0xc67c3e['type'][_0x5eab('0x2c')]};});_0x230ccb['model']=_[_0x5eab('0x29')](_0x52dd52,_0x5eab('0x26'));_0x230ccb[_0x5eab('0x2d')]=_['keys'](_0x47d62e[_0x5eab('0x2d')]);_0x230ccb[_0x5eab('0x2e')]=_[_0x5eab('0x2f')](_0x230ccb[_0x5eab('0x30')],_0x230ccb['query']);_0x29fc91[_0x5eab('0x31')]=_[_0x5eab('0x2f')](_0x230ccb['model'],qs['fields'](_0x47d62e[_0x5eab('0x2d')]['fields']));_0x29fc91[_0x5eab('0x31')]=_0x29fc91['attributes'][_0x5eab('0x32')]?_0x29fc91[_0x5eab('0x31')]:_0x230ccb[_0x5eab('0x30')];if(!_0x47d62e[_0x5eab('0x2d')]['hasOwnProperty'](_0x5eab('0x33'))){_0x29fc91[_0x5eab('0x1d')]=qs[_0x5eab('0x1d')](_0x47d62e[_0x5eab('0x2d')]['limit']);_0x29fc91[_0x5eab('0x1b')]=qs[_0x5eab('0x1b')](_0x47d62e[_0x5eab('0x2d')][_0x5eab('0x1b')]);}_0x29fc91[_0x5eab('0x34')]=qs['sort'](_0x47d62e['query'][_0x5eab('0x35')]);_0x29fc91[_0x5eab('0x36')]=qs['filters'](_[_0x5eab('0x37')](_0x47d62e['query'],_0x230ccb[_0x5eab('0x2e')]),_0x52dd52);if(_0x47d62e[_0x5eab('0x2d')][_0x5eab('0x38')]){_0x29fc91['where']=_[_0x5eab('0x39')](_0x29fc91[_0x5eab('0x36')],{'$or':_[_0x5eab('0x29')](_0x52dd52,function(_0x445d50){if(_0x445d50['type']!==_0x5eab('0x3a')){var _0x41f655={};_0x41f655[_0x445d50[_0x5eab('0x26')]]={'$like':'%'+_0x47d62e['query'][_0x5eab('0x38')]+'%'};return _0x41f655;}})});}_0x29fc91=_[_0x5eab('0x39')]({},_0x29fc91,_0x47d62e[_0x5eab('0x3b')]);var _0x5e9fa3={'where':_0x29fc91[_0x5eab('0x36')]};return db['ServicenowField']['count'](_0x5e9fa3)['then'](function(_0x50c2aa){_0x4cb361[_0x5eab('0x1e')]=_0x50c2aa;if(_0x47d62e[_0x5eab('0x2d')][_0x5eab('0x3c')]){_0x29fc91['include']=[{'all':!![]}];}return db[_0x5eab('0x2a')][_0x5eab('0x3d')](_0x29fc91);})[_0x5eab('0x23')](function(_0x39e1ed){_0x4cb361[_0x5eab('0x3e')]=_0x39e1ed;return _0x4cb361;})[_0x5eab('0x23')](respondWithFilteredResult(_0x5252c1,_0x29fc91))[_0x5eab('0x3f')](handleError(_0x5252c1,null));};exports[_0x5eab('0x40')]=function(_0x1a31dc,_0x3d04ca){var _0xa31ffd={'raw':!![],'where':{'id':_0x1a31dc[_0x5eab('0x41')]['id']}},_0xe7adf2={};_0xe7adf2[_0x5eab('0x30')]=_[_0x5eab('0x42')](db[_0x5eab('0x2a')][_0x5eab('0x43')]);_0xe7adf2[_0x5eab('0x2d')]=_['keys'](_0x1a31dc['query']);_0xe7adf2[_0x5eab('0x2e')]=_['intersection'](_0xe7adf2['model'],_0xe7adf2[_0x5eab('0x2d')]);_0xa31ffd[_0x5eab('0x31')]=_[_0x5eab('0x2f')](_0xe7adf2[_0x5eab('0x30')],qs[_0x5eab('0x44')](_0x1a31dc[_0x5eab('0x2d')][_0x5eab('0x44')]));_0xa31ffd[_0x5eab('0x31')]=_0xa31ffd[_0x5eab('0x31')]['length']?_0xa31ffd['attributes']:_0xe7adf2[_0x5eab('0x30')];if(_0x1a31dc['query'][_0x5eab('0x3c')]){_0xa31ffd[_0x5eab('0x45')]=[{'all':!![]}];}_0xa31ffd=_[_0x5eab('0x39')]({},_0xa31ffd,_0x1a31dc[_0x5eab('0x3b')]);return db[_0x5eab('0x2a')][_0x5eab('0x46')](_0xa31ffd)[_0x5eab('0x23')](handleEntityNotFound(_0x3d04ca,null))[_0x5eab('0x23')](respondWithResult(_0x3d04ca,null))[_0x5eab('0x3f')](handleError(_0x3d04ca,null));};exports[_0x5eab('0x47')]=function(_0x51954a,_0x2556ea){return db['ServicenowField']['create'](_0x51954a[_0x5eab('0x48')],{})[_0x5eab('0x23')](respondWithResult(_0x2556ea,0xc9))[_0x5eab('0x3f')](handleError(_0x2556ea,null));};exports[_0x5eab('0x22')]=function(_0x505351,_0x4a170c){if(_0x505351[_0x5eab('0x48')]['id']){delete _0x505351['body']['id'];}return db[_0x5eab('0x2a')][_0x5eab('0x46')]({'where':{'id':_0x505351[_0x5eab('0x41')]['id']}})[_0x5eab('0x23')](handleEntityNotFound(_0x4a170c,null))[_0x5eab('0x23')](saveUpdates(_0x505351['body'],null))[_0x5eab('0x23')](respondWithResult(_0x4a170c,null))[_0x5eab('0x3f')](handleError(_0x4a170c,null));};exports[_0x5eab('0x24')]=function(_0x19e35d,_0x809bd9){return db['ServicenowField'][_0x5eab('0x46')]({'where':{'id':_0x19e35d[_0x5eab('0x41')]['id']}})[_0x5eab('0x23')](handleEntityNotFound(_0x809bd9,null))[_0x5eab('0x23')](removeEntity(_0x809bd9,null))[_0x5eab('0x3f')](handleError(_0x809bd9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9af2043..d59822b 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 _0x0a7c=['../../config/environment','exports','define','ServicenowField','int_servicenow_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x577076,_0x4454f9){var _0x566347=function(_0x472ed8){while(--_0x472ed8){_0x577076['push'](_0x577076['shift']());}};_0x566347(++_0x4454f9);}(_0x0a7c,0x1e1));var _0xc0a7=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0a7c[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xc0a7('0x0'));var util=require(_0xc0a7('0x1'));var logger=require(_0xc0a7('0x2'))(_0xc0a7('0x3'));var moment=require(_0xc0a7('0x4'));var BPromise=require(_0xc0a7('0x5'));var rp=require(_0xc0a7('0x6'));var fs=require('fs');var path=require(_0xc0a7('0x7'));var rimraf=require(_0xc0a7('0x8'));var config=require(_0xc0a7('0x9'));var attributes=require('./intServicenowField.attributes');module[_0xc0a7('0xa')]=function(_0x424add,_0x5642dd){return _0x424add[_0xc0a7('0xb')](_0xc0a7('0xc'),attributes,{'tableName':_0xc0a7('0xd'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26ec=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','idField','lodash','util'];(function(_0x4f825b,_0x108224){var _0xc8c508=function(_0x5d7428){while(--_0x5d7428){_0x4f825b['push'](_0x4f825b['shift']());}};_0xc8c508(++_0x108224);}(_0x26ec,0x15c));var _0xc26e=function(_0x15914c,_0x14ba0b){_0x15914c=_0x15914c-0x0;var _0x3f39ef=_0x26ec[_0x15914c];return _0x3f39ef;};'use strict';var _=require(_0xc26e('0x0'));var util=require(_0xc26e('0x1'));var logger=require(_0xc26e('0x2'))(_0xc26e('0x3'));var moment=require(_0xc26e('0x4'));var BPromise=require(_0xc26e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc26e('0x6'));var rimraf=require(_0xc26e('0x7'));var config=require(_0xc26e('0x8'));var attributes=require(_0xc26e('0x9'));module[_0xc26e('0xa')]=function(_0x4f4ea5,_0x6d20f3){return _0x4f4ea5['define'](_0xc26e('0xb'),attributes,{'tableName':_0xc26e('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xc26e('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 520ae41..49ea2c1 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4d085f,_0x3c7393){var _0x1ae582=function(_0x2fffce){while(--_0x2fffce){_0x4d085f['push'](_0x4d085f['shift']());}};_0x1ae582(++_0x3c7393);}(_0xf4eb,0xec));var _0xbf4e=function(_0x484ed7,_0x41370f){_0x484ed7=_0x484ed7-0x0;var _0x39974f=_0xf4eb[_0x484ed7];return _0x39974f;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x55e170,_0x422bc4){var _0x819ce1=function(_0x2adf20){while(--_0x2adf20){_0x55e170['push'](_0x55e170['shift']());}};_0x819ce1(++_0x422bc4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0xcb91[_0x3e0b8f];return _0x22f742;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 725df94..28bf449 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(_0x3c0faa,_0x378b25){var _0x207093=function(_0x3739ba){while(--_0x3739ba){_0x3c0faa['push'](_0x3c0faa['shift']());}};_0x207093(++_0x378b25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x3b0785,_0x42c375){var _0x54e3f5=function(_0x51c1a3){while(--_0x51c1a3){_0x3b0785['push'](_0x3b0785['shift']());}};_0x54e3f5(++_0x42c375);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 911dfeb..2df034f 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(_0x287c80,_0x35d910){var _0x300508=function(_0x59b6c0){while(--_0x59b6c0){_0x287c80['push'](_0x287c80['shift']());}};_0x300508(++_0x35d910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x46649c,_0x57dd7f){var _0x306aef=function(_0x1410c9){while(--_0x1410c9){_0x46649c['push'](_0x46649c['shift']());}};_0x306aef(++_0x57dd7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 9edc857..4df5d3e 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 _0xd2cf=['limit','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','then','catch','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','merge','hasOwnProperty','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','Calls','remove','label','endsWith','values','value','test','statusCode','error','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count'];(function(_0x6c9ac2,_0x35886a){var _0x4d9f44=function(_0xd6faa){while(--_0xd6faa){_0x6c9ac2['push'](_0x6c9ac2['shift']());}};_0x4d9f44(++_0x35886a);}(_0xd2cf,0xc9));var _0xfd2c=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0xd2cf[_0x35e92e];return _0x1205a8;};'use strict';var emlformat=require(_0xfd2c('0x0'));var rimraf=require(_0xfd2c('0x1'));var zipdir=require(_0xfd2c('0x2'));var jsonpatch=require(_0xfd2c('0x3'));var rp=require(_0xfd2c('0x4'));var moment=require(_0xfd2c('0x5'));var BPromise=require(_0xfd2c('0x6'));var Mustache=require('mustache');var util=require(_0xfd2c('0x7'));var path=require(_0xfd2c('0x8'));var sox=require(_0xfd2c('0x9'));var csv=require(_0xfd2c('0xa'));var ejs=require(_0xfd2c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd2c('0xc'));var squel=require(_0xfd2c('0xd'));var crypto=require(_0xfd2c('0xe'));var jsforce=require(_0xfd2c('0xf'));var deskjs=require(_0xfd2c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfd2c('0x11'));var Redis=require(_0xfd2c('0x12'));var authService=require(_0xfd2c('0x13'));var qs=require(_0xfd2c('0x14'));var as=require(_0xfd2c('0x15'));var hardwareService=require(_0xfd2c('0x16'));var logger=require(_0xfd2c('0x17'))(_0xfd2c('0x18'));var utils=require(_0xfd2c('0x19'));var config=require(_0xfd2c('0x1a'));var licenseUtil=require(_0xfd2c('0x1b'));var db=require(_0xfd2c('0x1c'))['db'];var integrations=require(_0xfd2c('0x1d'));function respondWithStatusCode(_0x88d359,_0x78a3cb){_0x78a3cb=_0x78a3cb||0xcc;return function(_0x51b4b5){if(_0x51b4b5){return _0x88d359[_0xfd2c('0x1e')](_0x78a3cb);}return _0x88d359[_0xfd2c('0x1f')](_0x78a3cb)[_0xfd2c('0x20')]();};}function respondWithResult(_0x217ffa,_0x5d8f71){_0x5d8f71=_0x5d8f71||0xc8;return function(_0x23d894){if(_0x23d894){return _0x217ffa[_0xfd2c('0x1f')](_0x5d8f71)[_0xfd2c('0x21')](_0x23d894);}};}function respondWithFilteredResult(_0x15b2bb,_0xd16a76){return function(_0x4363e1){if(_0x4363e1){var _0xead798=typeof _0xd16a76[_0xfd2c('0x22')]===_0xfd2c('0x23')&&typeof _0xd16a76['limit']===_0xfd2c('0x23');var _0x22e823=_0x4363e1[_0xfd2c('0x24')];var _0x2cc063=_0xead798?0x0:_0xd16a76[_0xfd2c('0x22')];var _0x3d9423=_0xead798?_0x4363e1[_0xfd2c('0x24')]:_0xd16a76[_0xfd2c('0x22')]+_0xd16a76[_0xfd2c('0x25')];var _0x4a6c87;if(_0x3d9423>=_0x22e823){_0x3d9423=_0x22e823;_0x4a6c87=0xc8;}else{_0x4a6c87=0xce;}_0x15b2bb[_0xfd2c('0x1f')](_0x4a6c87);return _0x15b2bb['set'](_0xfd2c('0x26'),_0x2cc063+'-'+_0x3d9423+'/'+_0x22e823)['json'](_0x4363e1);}return null;};}function patchUpdates(_0x5d0f59){return function(_0x9ab4ee){try{jsonpatch[_0xfd2c('0x27')](_0x9ab4ee,_0x5d0f59,!![]);}catch(_0x252bed){return BPromise[_0xfd2c('0x28')](_0x252bed);}return _0x9ab4ee[_0xfd2c('0x29')]();};}function saveUpdates(_0xf9d055,_0x15a15f){return function(_0x3fc222){if(_0x3fc222){return _0x3fc222[_0xfd2c('0x2a')](_0xf9d055)['then'](function(_0x3aeec4){return _0x3aeec4;});}return null;};}function removeEntity(_0x333e3d,_0x391aa4){return function(_0x9095db){if(_0x9095db){return _0x9095db[_0xfd2c('0x2b')]()['then'](function(){_0x333e3d[_0xfd2c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x291c29,_0x40fa27){return function(_0x32ca69){if(!_0x32ca69){_0x291c29[_0xfd2c('0x1e')](0x194);}return _0x32ca69;};}function handleError(_0xd39e35,_0x4a9c7f){_0x4a9c7f=_0x4a9c7f||0x1f4;return function(_0x3eec91){logger['error'](_0x3eec91[_0xfd2c('0x2c')]);if(_0x3eec91[_0xfd2c('0x2d')]){delete _0x3eec91[_0xfd2c('0x2d')];}_0xd39e35[_0xfd2c('0x1f')](_0x4a9c7f)['send'](_0x3eec91);};}exports[_0xfd2c('0x2e')]=function(_0x49b59a,_0x43383f){var _0x3b7138={},_0xed8cdb={},_0x45d5b1={'count':0x0,'rows':[]};var _0x3d5c51=_[_0xfd2c('0x2f')](db[_0xfd2c('0x30')][_0xfd2c('0x31')],function(_0x5c31a8){return{'name':_0x5c31a8['fieldName'],'type':_0x5c31a8[_0xfd2c('0x32')][_0xfd2c('0x33')]};});_0xed8cdb[_0xfd2c('0x34')]=_[_0xfd2c('0x2f')](_0x3d5c51,'name');_0xed8cdb[_0xfd2c('0x35')]=_[_0xfd2c('0x36')](_0x49b59a[_0xfd2c('0x35')]);_0xed8cdb[_0xfd2c('0x37')]=_[_0xfd2c('0x38')](_0xed8cdb[_0xfd2c('0x34')],_0xed8cdb[_0xfd2c('0x35')]);_0x3b7138[_0xfd2c('0x39')]=_[_0xfd2c('0x38')](_0xed8cdb['model'],qs[_0xfd2c('0x3a')](_0x49b59a[_0xfd2c('0x35')][_0xfd2c('0x3a')]));_0x3b7138[_0xfd2c('0x39')]=_0x3b7138['attributes'][_0xfd2c('0x3b')]?_0x3b7138[_0xfd2c('0x39')]:_0xed8cdb['model'];if(!_0x49b59a['query']['hasOwnProperty'](_0xfd2c('0x3c'))){_0x3b7138[_0xfd2c('0x25')]=qs[_0xfd2c('0x25')](_0x49b59a[_0xfd2c('0x35')][_0xfd2c('0x25')]);_0x3b7138[_0xfd2c('0x22')]=qs[_0xfd2c('0x22')](_0x49b59a[_0xfd2c('0x35')][_0xfd2c('0x22')]);}_0x3b7138['order']=qs[_0xfd2c('0x3d')](_0x49b59a[_0xfd2c('0x35')][_0xfd2c('0x3d')]);_0x3b7138[_0xfd2c('0x3e')]=qs['filters'](_[_0xfd2c('0x3f')](_0x49b59a[_0xfd2c('0x35')],_0xed8cdb['filters']),_0x3d5c51);if(_0x49b59a[_0xfd2c('0x35')][_0xfd2c('0x40')]){_0x3b7138['where']=_['merge'](_0x3b7138['where'],{'$or':_[_0xfd2c('0x2f')](_0x3d5c51,function(_0x1e5429){if(_0x1e5429['type']!==_0xfd2c('0x41')){var _0x401836={};_0x401836[_0x1e5429[_0xfd2c('0x2d')]]={'$like':'%'+_0x49b59a[_0xfd2c('0x35')][_0xfd2c('0x40')]+'%'};return _0x401836;}})});}_0x3b7138=_['merge']({},_0x3b7138,_0x49b59a[_0xfd2c('0x42')]);var _0xdc698e={'where':_0x3b7138[_0xfd2c('0x3e')]};return db['SugarcrmAccount'][_0xfd2c('0x24')](_0xdc698e)['then'](function(_0x206546){_0x45d5b1['count']=_0x206546;if(_0x49b59a[_0xfd2c('0x35')][_0xfd2c('0x43')]){_0x3b7138[_0xfd2c('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xfd2c('0x45')](_0x3b7138);})[_0xfd2c('0x46')](function(_0x2b4ba8){_0x45d5b1['rows']=_0x2b4ba8;return _0x45d5b1;})[_0xfd2c('0x46')](respondWithFilteredResult(_0x43383f,_0x3b7138))[_0xfd2c('0x47')](handleError(_0x43383f,null));};exports['show']=function(_0x5e5f71,_0x4be015){var _0x1e6a13={'raw':![],'where':{'id':_0x5e5f71[_0xfd2c('0x48')]['id']}},_0x33b694={};_0x33b694[_0xfd2c('0x34')]=_[_0xfd2c('0x36')](db[_0xfd2c('0x30')]['rawAttributes']);_0x33b694[_0xfd2c('0x35')]=_[_0xfd2c('0x36')](_0x5e5f71[_0xfd2c('0x35')]);_0x33b694[_0xfd2c('0x37')]=_[_0xfd2c('0x38')](_0x33b694['model'],_0x33b694[_0xfd2c('0x35')]);_0x1e6a13[_0xfd2c('0x39')]=_[_0xfd2c('0x38')](_0x33b694[_0xfd2c('0x34')],qs[_0xfd2c('0x3a')](_0x5e5f71[_0xfd2c('0x35')][_0xfd2c('0x3a')]));_0x1e6a13[_0xfd2c('0x39')]=_0x1e6a13[_0xfd2c('0x39')][_0xfd2c('0x3b')]?_0x1e6a13[_0xfd2c('0x39')]:_0x33b694['model'];if(_0x5e5f71[_0xfd2c('0x35')][_0xfd2c('0x43')]){_0x1e6a13[_0xfd2c('0x44')]=[{'all':!![]}];}_0x1e6a13=_['merge']({},_0x1e6a13,_0x5e5f71[_0xfd2c('0x42')]);return db[_0xfd2c('0x30')][_0xfd2c('0x49')](_0x1e6a13)[_0xfd2c('0x46')](handleEntityNotFound(_0x4be015,null))['then'](respondWithResult(_0x4be015,null))[_0xfd2c('0x47')](handleError(_0x4be015,null));};exports[_0xfd2c('0x4a')]=function(_0x36754f,_0x4c2c6){return db[_0xfd2c('0x30')][_0xfd2c('0x4a')](_0x36754f['body'],{})[_0xfd2c('0x46')](respondWithResult(_0x4c2c6,0xc9))[_0xfd2c('0x47')](handleError(_0x4c2c6,null));};exports[_0xfd2c('0x2a')]=function(_0x308e3e,_0x4d8abc){if(_0x308e3e[_0xfd2c('0x4b')]['id']){delete _0x308e3e[_0xfd2c('0x4b')]['id'];}return db[_0xfd2c('0x30')][_0xfd2c('0x49')]({'where':{'id':_0x308e3e[_0xfd2c('0x48')]['id']}})[_0xfd2c('0x46')](handleEntityNotFound(_0x4d8abc,null))[_0xfd2c('0x46')](saveUpdates(_0x308e3e[_0xfd2c('0x4b')],null))[_0xfd2c('0x46')](respondWithResult(_0x4d8abc,null))['catch'](handleError(_0x4d8abc,null));};exports[_0xfd2c('0x2b')]=function(_0x165b66,_0x42181d){return db[_0xfd2c('0x30')][_0xfd2c('0x49')]({'where':{'id':_0x165b66[_0xfd2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x42181d,null))[_0xfd2c('0x46')](removeEntity(_0x42181d,null))[_0xfd2c('0x47')](handleError(_0x42181d,null));};exports[_0xfd2c('0x4c')]=function(_0x121ef8,_0xfd5bf8,_0x415879){var _0x222e40={};var _0x4e8309={};var _0x2fab7a;var _0x54d571;return db[_0xfd2c('0x30')][_0xfd2c('0x4d')]({'where':{'id':_0x121ef8[_0xfd2c('0x48')]['id']}})[_0xfd2c('0x46')](handleEntityNotFound(_0xfd5bf8,null))[_0xfd2c('0x46')](function(_0x19028f){if(_0x19028f){_0x2fab7a=_0x19028f;_0x4e8309['model']=_[_0xfd2c('0x36')](db[_0xfd2c('0x4e')][_0xfd2c('0x31')]);_0x4e8309['query']=_[_0xfd2c('0x36')](_0x121ef8[_0xfd2c('0x35')]);_0x4e8309[_0xfd2c('0x37')]=_[_0xfd2c('0x38')](_0x4e8309[_0xfd2c('0x34')],_0x4e8309['query']);_0x222e40['attributes']=_[_0xfd2c('0x38')](_0x4e8309[_0xfd2c('0x34')],qs[_0xfd2c('0x3a')](_0x121ef8[_0xfd2c('0x35')]['fields']));_0x222e40['attributes']=_0x222e40[_0xfd2c('0x39')]['length']?_0x222e40[_0xfd2c('0x39')]:_0x4e8309[_0xfd2c('0x34')];_0x222e40[_0xfd2c('0x4f')]=qs[_0xfd2c('0x3d')](_0x121ef8[_0xfd2c('0x35')][_0xfd2c('0x3d')]);_0x222e40[_0xfd2c('0x3e')]=qs[_0xfd2c('0x37')](_[_0xfd2c('0x3f')](_0x121ef8['query'],_0x4e8309[_0xfd2c('0x37')]));if(_0x121ef8[_0xfd2c('0x35')][_0xfd2c('0x40')]){_0x222e40[_0xfd2c('0x3e')]=_[_0xfd2c('0x50')](_0x222e40['where'],{'$or':_['map'](_0x222e40[_0xfd2c('0x39')],function(_0x395cba){var _0x2062ca={};_0x2062ca[_0x395cba]={'$like':'%'+_0x121ef8['query']['filter']+'%'};return _0x2062ca;})});}_0x222e40=_[_0xfd2c('0x50')]({},_0x222e40,_0x121ef8[_0xfd2c('0x42')]);return _0x2fab7a[_0xfd2c('0x4c')](_0x222e40);}})[_0xfd2c('0x46')](function(_0x2884eb){if(_0x2884eb){_0x54d571=_0x2884eb[_0xfd2c('0x3b')];if(!_0x121ef8[_0xfd2c('0x35')][_0xfd2c('0x51')](_0xfd2c('0x3c'))){_0x222e40[_0xfd2c('0x25')]=qs[_0xfd2c('0x25')](_0x121ef8[_0xfd2c('0x35')][_0xfd2c('0x25')]);_0x222e40[_0xfd2c('0x22')]=qs['offset'](_0x121ef8[_0xfd2c('0x35')][_0xfd2c('0x22')]);}return _0x2fab7a[_0xfd2c('0x4c')](_0x222e40);}})[_0xfd2c('0x46')](function(_0x314129){if(_0x314129){return _0x314129?{'count':_0x54d571,'rows':_0x314129}:null;}})['then'](respondWithResult(_0xfd5bf8,null))[_0xfd2c('0x47')](handleError(_0xfd5bf8,null));};exports[_0xfd2c('0x52')]=function(_0x2a585a,_0x3454ae,_0x25e84d){if(_0x2a585a[_0xfd2c('0x4b')]['id']){delete _0x2a585a['body']['id'];}return db['SugarcrmAccount'][_0xfd2c('0x4d')]({'where':{'id':_0x2a585a[_0xfd2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3454ae,null))[_0xfd2c('0x46')](function(_0x23f7f4){if(_0x23f7f4){_0x2a585a[_0xfd2c('0x4b')]['AccountId']=_0x23f7f4['id'];_0x2a585a[_0xfd2c('0x4b')][_0xfd2c('0x53')]=integrations[_0xfd2c('0x54')](_0x2a585a['body']['channel'],_0x2a585a['body'][_0xfd2c('0x32')]);_0x2a585a['body'][_0xfd2c('0x55')]=integrations[_0xfd2c('0x56')](_0x2a585a[_0xfd2c('0x4b')][_0xfd2c('0x57')],_0x2a585a['body'][_0xfd2c('0x32')]);return db['SugarcrmConfiguration'][_0xfd2c('0x4a')](_0x2a585a[_0xfd2c('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xfd2c('0x58')],'as':'Descriptions'}]});}return null;})[_0xfd2c('0x46')](respondWithResult(_0x3454ae,null))[_0xfd2c('0x47')](handleError(_0x3454ae,null));};exports[_0xfd2c('0x59')]=function(_0x1b6e52,_0x38eeee,_0x361971){var _0x108f3a='';var _0x4d9302=['id',_0xfd2c('0x2d'),'assigned_user_id','created_by','description','date_start','duration_hours',_0xfd2c('0x5a'),_0xfd2c('0x5b'),_0xfd2c('0x5c'),'parent_name',_0xfd2c('0x5d')];return db[_0xfd2c('0x30')]['findOne']({'where':{'id':_0x1b6e52['params']['id']},'attributes':['id',_0xfd2c('0x5e'),_0xfd2c('0x5f'),_0xfd2c('0x60')]})[_0xfd2c('0x46')](handleEntityNotFound(_0x38eeee,null))[_0xfd2c('0x46')](function(_0x5cc4f9){if(_0x5cc4f9){_0x108f3a=_0x5cc4f9['remoteUri'];var _0x22489d=_0x108f3a[_0xfd2c('0x61')](-0x1);if(_0x22489d==='/'){_0x108f3a=_0x108f3a[_0xfd2c('0x62')](0x0,_0x108f3a[_0xfd2c('0x63')](_0x22489d));}return rp({'method':_0xfd2c('0x64'),'uri':util[_0xfd2c('0x65')](_0xfd2c('0x66'),_0x108f3a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xfd2c('0x67'),'response_type':'JSON','rest_data':JSON[_0xfd2c('0x68')]({'user_auth':{'user_name':_0x5cc4f9[_0xfd2c('0x5e')],'password':_0x5cc4f9['password'],'encryption':'PLAIN'},'application':_0xfd2c('0x69')})}});}})[_0xfd2c('0x46')](function(_0x42a532){if(_0x42a532&&_0x42a532['name']!=='Invalid\x20Login'&&_0x42a532[_0xfd2c('0x2d')]!==_0xfd2c('0x6a')){return rp({'method':_0xfd2c('0x64'),'uri':util['format'](_0xfd2c('0x66'),_0x108f3a,_0xfd2c('0x6b')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xfd2c('0x67'),'response_type':'JSON','rest_data':JSON[_0xfd2c('0x68')]({'session':_0x42a532['id'],'module_name':_0xfd2c('0x6c')})}})[_0xfd2c('0x46')](function(_0x705f9d){if(_0x705f9d){var _0x50618f=_['values'](_0x705f9d['module_fields']);_[_0xfd2c('0x6d')](_0x50618f,function(_0xcda835){return _0x4d9302['includes'](_0xcda835['name']);});return{'count':_0x50618f['length'],'rows':_['map'](_0x50618f,function(_0x25b4d4){return{'id':_0x25b4d4[_0xfd2c('0x2d')],'name':_0x25b4d4[_0xfd2c('0x6e')],'custom':_[_0xfd2c('0x6f')](_0x25b4d4['name'],'_c')?!![]:![],'options':_0x25b4d4['options']?_[_0xfd2c('0x2f')](_[_0xfd2c('0x70')](_0x25b4d4[_0xfd2c('0x42')]),function(_0x11ac8d){return{'name':_0x11ac8d[_0xfd2c('0x71')],'value':_0x11ac8d[_0xfd2c('0x2d')]};}):[]};})};}})[_0xfd2c('0x46')](respondWithResult(_0x38eeee,null))[_0xfd2c('0x47')](function(_0x1cc76d){var _0x35348f=_0x1b6e52[_0xfd2c('0x35')][_0xfd2c('0x72')]?0x1f4:_0x1cc76d[_0xfd2c('0x73')]||0x1f4;logger[_0xfd2c('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xfd2c('0x59'),_0x35348f,JSON[_0xfd2c('0x68')](_0x1cc76d));delete _0x1cc76d[_0xfd2c('0x2d')];if(_0x35348f===0x191){_0x35348f=0x190;}_0x38eeee[_0xfd2c('0x1f')](_0x35348f)[_0xfd2c('0x75')](_0x1b6e52[_0xfd2c('0x35')]['test']?{'message':_0xfd2c('0x76'),'statusCode':_0x1cc76d[_0xfd2c('0x73')]}:_0x1cc76d);});}else{var _0x163418=0x1f4;_0x38eeee[_0xfd2c('0x1f')](_0x163418)[_0xfd2c('0x75')]({'message':_0xfd2c('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x7094=['stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','%s%s','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','SugarcrmField','Subjects','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON'];(function(_0x139daf,_0x1d64e9){var _0x434690=function(_0x261654){while(--_0x261654){_0x139daf['push'](_0x139daf['shift']());}};_0x434690(++_0x1d64e9);}(_0x7094,0x111));var _0x4709=function(_0x32a2d6,_0xaa4f9f){_0x32a2d6=_0x32a2d6-0x0;var _0x38871b=_0x7094[_0x32a2d6];return _0x38871b;};'use strict';var emlformat=require(_0x4709('0x0'));var rimraf=require(_0x4709('0x1'));var zipdir=require(_0x4709('0x2'));var jsonpatch=require(_0x4709('0x3'));var rp=require('request-promise');var moment=require(_0x4709('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4709('0x5'));var util=require(_0x4709('0x6'));var path=require(_0x4709('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4709('0x8'));var _=require(_0x4709('0x9'));var squel=require(_0x4709('0xa'));var crypto=require(_0x4709('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4709('0xc'));var querystring=require(_0x4709('0xd'));var Papa=require(_0x4709('0xe'));var Redis=require(_0x4709('0xf'));var authService=require(_0x4709('0x10'));var qs=require(_0x4709('0x11'));var as=require(_0x4709('0x12'));var hardwareService=require(_0x4709('0x13'));var logger=require('../../config/logger')(_0x4709('0x14'));var utils=require(_0x4709('0x15'));var config=require(_0x4709('0x16'));var licenseUtil=require(_0x4709('0x17'));var db=require(_0x4709('0x18'))['db'];var integrations=require(_0x4709('0x19'));function respondWithStatusCode(_0x335412,_0x4ff958){_0x4ff958=_0x4ff958||0xcc;return function(_0x40c1c8){if(_0x40c1c8){return _0x335412[_0x4709('0x1a')](_0x4ff958);}return _0x335412[_0x4709('0x1b')](_0x4ff958)[_0x4709('0x1c')]();};}function respondWithResult(_0xfc17d6,_0x255104){_0x255104=_0x255104||0xc8;return function(_0x46414a){if(_0x46414a){return _0xfc17d6[_0x4709('0x1b')](_0x255104)['json'](_0x46414a);}};}function respondWithFilteredResult(_0x5c130d,_0x5c5e8f){return function(_0x2729a6){if(_0x2729a6){var _0x32f65e=typeof _0x5c5e8f[_0x4709('0x1d')]==='undefined'&&typeof _0x5c5e8f['limit']===_0x4709('0x1e');var _0x5e59e4=_0x2729a6[_0x4709('0x1f')];var _0x59caca=_0x32f65e?0x0:_0x5c5e8f[_0x4709('0x1d')];var _0x1743a0=_0x32f65e?_0x2729a6[_0x4709('0x1f')]:_0x5c5e8f[_0x4709('0x1d')]+_0x5c5e8f[_0x4709('0x20')];var _0x10dc06;if(_0x1743a0>=_0x5e59e4){_0x1743a0=_0x5e59e4;_0x10dc06=0xc8;}else{_0x10dc06=0xce;}_0x5c130d[_0x4709('0x1b')](_0x10dc06);return _0x5c130d[_0x4709('0x21')](_0x4709('0x22'),_0x59caca+'-'+_0x1743a0+'/'+_0x5e59e4)[_0x4709('0x23')](_0x2729a6);}return null;};}function patchUpdates(_0x2db1c6){return function(_0x35764d){try{jsonpatch[_0x4709('0x24')](_0x35764d,_0x2db1c6,!![]);}catch(_0x282b30){return BPromise[_0x4709('0x25')](_0x282b30);}return _0x35764d[_0x4709('0x26')]();};}function saveUpdates(_0x250f28,_0x13630b){return function(_0x1b36e8){if(_0x1b36e8){return _0x1b36e8[_0x4709('0x27')](_0x250f28)['then'](function(_0x5d3e58){return _0x5d3e58;});}return null;};}function removeEntity(_0xfba2ce,_0x71617f){return function(_0x5bee1a){if(_0x5bee1a){return _0x5bee1a[_0x4709('0x28')]()[_0x4709('0x29')](function(){_0xfba2ce[_0x4709('0x1b')](0xcc)[_0x4709('0x1c')]();});}};}function handleEntityNotFound(_0x47598a,_0x590d3c){return function(_0x266e55){if(!_0x266e55){_0x47598a[_0x4709('0x1a')](0x194);}return _0x266e55;};}function handleError(_0x38b629,_0x26a7df){_0x26a7df=_0x26a7df||0x1f4;return function(_0x1c5d86){logger[_0x4709('0x2a')](_0x1c5d86[_0x4709('0x2b')]);if(_0x1c5d86['name']){delete _0x1c5d86[_0x4709('0x2c')];}_0x38b629[_0x4709('0x1b')](_0x26a7df)[_0x4709('0x2d')](_0x1c5d86);};}exports['index']=function(_0x2b0fac,_0x2dc2ce){var _0x5f221a={},_0xf7a29c={},_0x390fc7={'count':0x0,'rows':[]};var _0x52bbef=_[_0x4709('0x2e')](db[_0x4709('0x2f')][_0x4709('0x30')],function(_0x2a44bc){return{'name':_0x2a44bc[_0x4709('0x31')],'type':_0x2a44bc[_0x4709('0x32')][_0x4709('0x33')]};});_0xf7a29c['model']=_[_0x4709('0x2e')](_0x52bbef,'name');_0xf7a29c[_0x4709('0x34')]=_[_0x4709('0x35')](_0x2b0fac[_0x4709('0x34')]);_0xf7a29c[_0x4709('0x36')]=_[_0x4709('0x37')](_0xf7a29c[_0x4709('0x38')],_0xf7a29c[_0x4709('0x34')]);_0x5f221a['attributes']=_['intersection'](_0xf7a29c[_0x4709('0x38')],qs[_0x4709('0x39')](_0x2b0fac[_0x4709('0x34')][_0x4709('0x39')]));_0x5f221a[_0x4709('0x3a')]=_0x5f221a[_0x4709('0x3a')]['length']?_0x5f221a['attributes']:_0xf7a29c[_0x4709('0x38')];if(!_0x2b0fac[_0x4709('0x34')][_0x4709('0x3b')](_0x4709('0x3c'))){_0x5f221a['limit']=qs['limit'](_0x2b0fac[_0x4709('0x34')][_0x4709('0x20')]);_0x5f221a[_0x4709('0x1d')]=qs[_0x4709('0x1d')](_0x2b0fac[_0x4709('0x34')][_0x4709('0x1d')]);}_0x5f221a[_0x4709('0x3d')]=qs[_0x4709('0x3e')](_0x2b0fac[_0x4709('0x34')]['sort']);_0x5f221a[_0x4709('0x3f')]=qs[_0x4709('0x36')](_[_0x4709('0x40')](_0x2b0fac[_0x4709('0x34')],_0xf7a29c[_0x4709('0x36')]),_0x52bbef);if(_0x2b0fac[_0x4709('0x34')][_0x4709('0x41')]){_0x5f221a['where']=_[_0x4709('0x42')](_0x5f221a[_0x4709('0x3f')],{'$or':_[_0x4709('0x2e')](_0x52bbef,function(_0x533803){if(_0x533803[_0x4709('0x32')]!==_0x4709('0x43')){var _0x382c58={};_0x382c58[_0x533803['name']]={'$like':'%'+_0x2b0fac[_0x4709('0x34')][_0x4709('0x41')]+'%'};return _0x382c58;}})});}_0x5f221a=_['merge']({},_0x5f221a,_0x2b0fac[_0x4709('0x44')]);var _0x3a052a={'where':_0x5f221a['where']};return db['SugarcrmAccount']['count'](_0x3a052a)[_0x4709('0x29')](function(_0x131700){_0x390fc7['count']=_0x131700;if(_0x2b0fac['query'][_0x4709('0x45')]){_0x5f221a[_0x4709('0x46')]=[{'all':!![]}];}return db[_0x4709('0x2f')][_0x4709('0x47')](_0x5f221a);})[_0x4709('0x29')](function(_0x3504ff){_0x390fc7[_0x4709('0x48')]=_0x3504ff;return _0x390fc7;})['then'](respondWithFilteredResult(_0x2dc2ce,_0x5f221a))[_0x4709('0x49')](handleError(_0x2dc2ce,null));};exports[_0x4709('0x4a')]=function(_0x5b7322,_0x59d6cb){var _0x520d2a={'raw':![],'where':{'id':_0x5b7322[_0x4709('0x4b')]['id']}},_0xa1da90={};_0xa1da90[_0x4709('0x38')]=_['keys'](db['SugarcrmAccount'][_0x4709('0x30')]);_0xa1da90[_0x4709('0x34')]=_[_0x4709('0x35')](_0x5b7322[_0x4709('0x34')]);_0xa1da90['filters']=_[_0x4709('0x37')](_0xa1da90[_0x4709('0x38')],_0xa1da90[_0x4709('0x34')]);_0x520d2a[_0x4709('0x3a')]=_[_0x4709('0x37')](_0xa1da90[_0x4709('0x38')],qs['fields'](_0x5b7322[_0x4709('0x34')][_0x4709('0x39')]));_0x520d2a[_0x4709('0x3a')]=_0x520d2a[_0x4709('0x3a')][_0x4709('0x4c')]?_0x520d2a[_0x4709('0x3a')]:_0xa1da90[_0x4709('0x38')];if(_0x5b7322[_0x4709('0x34')][_0x4709('0x45')]){_0x520d2a['include']=[{'all':!![]}];}_0x520d2a=_[_0x4709('0x42')]({},_0x520d2a,_0x5b7322[_0x4709('0x44')]);return db[_0x4709('0x2f')][_0x4709('0x4d')](_0x520d2a)[_0x4709('0x29')](handleEntityNotFound(_0x59d6cb,null))['then'](respondWithResult(_0x59d6cb,null))['catch'](handleError(_0x59d6cb,null));};exports[_0x4709('0x4e')]=function(_0x29087c,_0x5becbe){return db[_0x4709('0x2f')][_0x4709('0x4e')](_0x29087c[_0x4709('0x4f')],{})[_0x4709('0x29')](respondWithResult(_0x5becbe,0xc9))[_0x4709('0x49')](handleError(_0x5becbe,null));};exports[_0x4709('0x27')]=function(_0x1a090f,_0x5c9dca){if(_0x1a090f[_0x4709('0x4f')]['id']){delete _0x1a090f['body']['id'];}return db[_0x4709('0x2f')]['find']({'where':{'id':_0x1a090f[_0x4709('0x4b')]['id']}})[_0x4709('0x29')](handleEntityNotFound(_0x5c9dca,null))['then'](saveUpdates(_0x1a090f[_0x4709('0x4f')],null))[_0x4709('0x29')](respondWithResult(_0x5c9dca,null))[_0x4709('0x49')](handleError(_0x5c9dca,null));};exports[_0x4709('0x28')]=function(_0x471397,_0x196781){return db[_0x4709('0x2f')]['find']({'where':{'id':_0x471397[_0x4709('0x4b')]['id']}})['then'](handleEntityNotFound(_0x196781,null))[_0x4709('0x29')](removeEntity(_0x196781,null))[_0x4709('0x49')](handleError(_0x196781,null));};exports['getConfigurations']=function(_0x2632c2,_0x280587,_0x3c1a03){var _0x48fab3={};var _0x2b75ae={};var _0x10d24a;var _0x5a58b5;return db[_0x4709('0x2f')][_0x4709('0x50')]({'where':{'id':_0x2632c2[_0x4709('0x4b')]['id']}})[_0x4709('0x29')](handleEntityNotFound(_0x280587,null))[_0x4709('0x29')](function(_0x44c441){if(_0x44c441){_0x10d24a=_0x44c441;_0x2b75ae['model']=_[_0x4709('0x35')](db[_0x4709('0x51')][_0x4709('0x30')]);_0x2b75ae[_0x4709('0x34')]=_[_0x4709('0x35')](_0x2632c2['query']);_0x2b75ae[_0x4709('0x36')]=_[_0x4709('0x37')](_0x2b75ae['model'],_0x2b75ae[_0x4709('0x34')]);_0x48fab3[_0x4709('0x3a')]=_[_0x4709('0x37')](_0x2b75ae['model'],qs[_0x4709('0x39')](_0x2632c2['query'][_0x4709('0x39')]));_0x48fab3[_0x4709('0x3a')]=_0x48fab3[_0x4709('0x3a')][_0x4709('0x4c')]?_0x48fab3[_0x4709('0x3a')]:_0x2b75ae[_0x4709('0x38')];_0x48fab3[_0x4709('0x3d')]=qs[_0x4709('0x3e')](_0x2632c2[_0x4709('0x34')]['sort']);_0x48fab3[_0x4709('0x3f')]=qs[_0x4709('0x36')](_[_0x4709('0x40')](_0x2632c2[_0x4709('0x34')],_0x2b75ae[_0x4709('0x36')]));if(_0x2632c2[_0x4709('0x34')][_0x4709('0x41')]){_0x48fab3[_0x4709('0x3f')]=_[_0x4709('0x42')](_0x48fab3[_0x4709('0x3f')],{'$or':_[_0x4709('0x2e')](_0x48fab3[_0x4709('0x3a')],function(_0x1bf652){var _0x5b837f={};_0x5b837f[_0x1bf652]={'$like':'%'+_0x2632c2[_0x4709('0x34')]['filter']+'%'};return _0x5b837f;})});}_0x48fab3=_['merge']({},_0x48fab3,_0x2632c2[_0x4709('0x44')]);return _0x10d24a['getConfigurations'](_0x48fab3);}})['then'](function(_0x89a03f){if(_0x89a03f){_0x5a58b5=_0x89a03f[_0x4709('0x4c')];if(!_0x2632c2[_0x4709('0x34')][_0x4709('0x3b')](_0x4709('0x3c'))){_0x48fab3['limit']=qs[_0x4709('0x20')](_0x2632c2['query'][_0x4709('0x20')]);_0x48fab3['offset']=qs[_0x4709('0x1d')](_0x2632c2[_0x4709('0x34')][_0x4709('0x1d')]);}return _0x10d24a[_0x4709('0x52')](_0x48fab3);}})[_0x4709('0x29')](function(_0x5d6016){if(_0x5d6016){return _0x5d6016?{'count':_0x5a58b5,'rows':_0x5d6016}:null;}})[_0x4709('0x29')](respondWithResult(_0x280587,null))[_0x4709('0x49')](handleError(_0x280587,null));};exports[_0x4709('0x53')]=function(_0x38113b,_0x4f012a,_0x13bcf2){if(_0x38113b['body']['id']){delete _0x38113b[_0x4709('0x4f')]['id'];}return db[_0x4709('0x2f')][_0x4709('0x50')]({'where':{'id':_0x38113b[_0x4709('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f012a,null))[_0x4709('0x29')](function(_0x48da39){if(_0x48da39){_0x38113b[_0x4709('0x4f')]['AccountId']=_0x48da39['id'];_0x38113b[_0x4709('0x4f')]['Subjects']=integrations[_0x4709('0x54')](_0x38113b['body'][_0x4709('0x55')],_0x38113b[_0x4709('0x4f')][_0x4709('0x32')]);_0x38113b[_0x4709('0x4f')][_0x4709('0x56')]=integrations['getDescriptions'](_0x38113b[_0x4709('0x4f')][_0x4709('0x55')],_0x38113b['body']['type']);return db[_0x4709('0x51')][_0x4709('0x4e')](_0x38113b[_0x4709('0x4f')],{'include':[{'model':db[_0x4709('0x57')],'as':_0x4709('0x58')},{'model':db[_0x4709('0x57')],'as':_0x4709('0x56')}]});}return null;})['then'](respondWithResult(_0x4f012a,null))[_0x4709('0x49')](handleError(_0x4f012a,null));};exports[_0x4709('0x59')]=function(_0x533a03,_0x3578cf,_0x2a8397){var _0x51ad26='';var _0x215912=['id','name',_0x4709('0x5a'),'created_by',_0x4709('0x5b'),'date_start',_0x4709('0x5c'),_0x4709('0x5d'),_0x4709('0x5e'),_0x4709('0x5f'),_0x4709('0x60'),_0x4709('0x61')];return db[_0x4709('0x2f')][_0x4709('0x50')]({'where':{'id':_0x533a03[_0x4709('0x4b')]['id']},'attributes':['id',_0x4709('0x62'),_0x4709('0x63'),_0x4709('0x64')]})[_0x4709('0x29')](handleEntityNotFound(_0x3578cf,null))['then'](function(_0x2b1c35){if(_0x2b1c35){_0x51ad26=_0x2b1c35[_0x4709('0x64')];var _0x4aa5cc=_0x51ad26[_0x4709('0x65')](-0x1);if(_0x4aa5cc==='/'){_0x51ad26=_0x51ad26[_0x4709('0x66')](0x0,_0x51ad26[_0x4709('0x67')](_0x4aa5cc));}return rp({'method':_0x4709('0x68'),'uri':util['format']('%s%s',_0x51ad26,_0x4709('0x69')),'json':!![],'form':{'method':_0x4709('0x6a'),'input_type':_0x4709('0x6b'),'response_type':_0x4709('0x6b'),'rest_data':JSON[_0x4709('0x6c')]({'user_auth':{'user_name':_0x2b1c35['username'],'password':_0x2b1c35[_0x4709('0x63')],'encryption':_0x4709('0x6d')},'application':_0x4709('0x6e')})}});}})[_0x4709('0x29')](function(_0x206483){if(_0x206483&&_0x206483['name']!==_0x4709('0x6f')&&_0x206483[_0x4709('0x2c')]!==_0x4709('0x70')){return rp({'method':'POST','uri':util[_0x4709('0x71')](_0x4709('0x72'),_0x51ad26,_0x4709('0x69')),'json':!![],'form':{'method':_0x4709('0x73'),'input_type':_0x4709('0x6b'),'response_type':_0x4709('0x6b'),'rest_data':JSON['stringify']({'session':_0x206483['id'],'module_name':_0x4709('0x74')})}})[_0x4709('0x29')](function(_0x72078f){if(_0x72078f){var _0x596137=_[_0x4709('0x75')](_0x72078f[_0x4709('0x76')]);_['remove'](_0x596137,function(_0x10f0da){return _0x215912[_0x4709('0x77')](_0x10f0da['name']);});return{'count':_0x596137['length'],'rows':_[_0x4709('0x2e')](_0x596137,function(_0x4edfea){return{'id':_0x4edfea['name'],'name':_0x4edfea[_0x4709('0x78')],'custom':_[_0x4709('0x79')](_0x4edfea[_0x4709('0x2c')],'_c')?!![]:![],'options':_0x4edfea[_0x4709('0x44')]?_[_0x4709('0x2e')](_['values'](_0x4edfea[_0x4709('0x44')]),function(_0x74dbfe){return{'name':_0x74dbfe[_0x4709('0x7a')],'value':_0x74dbfe[_0x4709('0x2c')]};}):[]};})};}})[_0x4709('0x29')](respondWithResult(_0x3578cf,null))[_0x4709('0x49')](function(_0x35f8a9){var _0x235555=_0x533a03[_0x4709('0x34')][_0x4709('0x7b')]?0x1f4:_0x35f8a9[_0x4709('0x7c')]||0x1f4;logger['error'](_0x4709('0x7d'),_0x4709('0x59'),_0x235555,JSON['stringify'](_0x35f8a9));delete _0x35f8a9[_0x4709('0x2c')];if(_0x235555===0x191){_0x235555=0x190;}_0x3578cf[_0x4709('0x1b')](_0x235555)[_0x4709('0x2d')](_0x533a03[_0x4709('0x34')][_0x4709('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x35f8a9[_0x4709('0x7c')]}:_0x35f8a9);});}else{var _0x295c73=0x1f4;_0x3578cf[_0x4709('0x1b')](_0x295c73)[_0x4709('0x2d')]({'message':_0x4709('0x7e'),'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 a37a712..12d065d 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 _0xcef7=['bluebird','path','rimraf','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment'];(function(_0x4405dc,_0x2ce0f5){var _0x9e5ab5=function(_0x4edc4f){while(--_0x4edc4f){_0x4405dc['push'](_0x4405dc['shift']());}};_0x9e5ab5(++_0x2ce0f5);}(_0xcef7,0xe3));var _0x7cef=function(_0x343bfc,_0x4ac0b9){_0x343bfc=_0x343bfc-0x0;var _0x533f57=_0xcef7[_0x343bfc];return _0x533f57;};'use strict';var _=require('lodash');var util=require(_0x7cef('0x0'));var logger=require(_0x7cef('0x1'))(_0x7cef('0x2'));var moment=require(_0x7cef('0x3'));var BPromise=require(_0x7cef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cef('0x5'));var rimraf=require(_0x7cef('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x7cef('0x7'));module[_0x7cef('0x8')]=function(_0x48bc7d,_0x12befc){return _0x48bc7d['define'](_0x7cef('0x9'),attributes,{'tableName':_0x7cef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe797=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash'];(function(_0x4324a5,_0x119043){var _0x39324b=function(_0x4b31c1){while(--_0x4b31c1){_0x4324a5['push'](_0x4324a5['shift']());}};_0x39324b(++_0x119043);}(_0xe797,0x12a));var _0x7e79=function(_0x45e664,_0x1969a5){_0x45e664=_0x45e664-0x0;var _0x1835b4=_0xe797[_0x45e664];return _0x1835b4;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var logger=require(_0x7e79('0x2'))(_0x7e79('0x3'));var moment=require(_0x7e79('0x4'));var BPromise=require(_0x7e79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e79('0x6'));var rimraf=require(_0x7e79('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e79('0x8'));var integrations=require(_0x7e79('0x9'));module[_0x7e79('0xa')]=function(_0x48a8c1,_0x4fdfa1){return _0x48a8c1[_0x7e79('0xb')](_0x7e79('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 47fbb1a..936e23d 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 _0x470f=['include','map','model','stringify','ShowSugarcrmAccount','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','attributes','limit'];(function(_0x5b6edf,_0x1e98e7){var _0x3c0ab9=function(_0x436400){while(--_0x436400){_0x5b6edf['push'](_0x5b6edf['shift']());}};_0x3c0ab9(++_0x1e98e7);}(_0x470f,0x6c));var _0xf470=function(_0x430e15,_0x4ae0f2){_0x430e15=_0x430e15-0x0;var _0x16c170=_0x470f[_0x430e15];return _0x16c170;};'use strict';var _=require(_0xf470('0x0'));var util=require(_0xf470('0x1'));var moment=require(_0xf470('0x2'));var BPromise=require(_0xf470('0x3'));var rs=require(_0xf470('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf470('0x5'));var logger=require(_0xf470('0x6'))('rpc');var config=require(_0xf470('0x7'));var jayson=require(_0xf470('0x8'));var client=jayson[_0xf470('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x493f97,_0x4b96b2,_0x585f82){return new BPromise(function(_0x463dc5,_0xd3cbaf){return client[_0xf470('0xa')](_0x493f97,_0x585f82)[_0xf470('0xb')](function(_0x581fed){logger[_0xf470('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4b96b2,'request\x20sent');logger[_0xf470('0xd')](_0xf470('0xe'),_0x4b96b2,'request\x20sent',JSON['stringify'](_0x581fed));if(_0x581fed['error']){if(_0x581fed[_0xf470('0xf')][_0xf470('0x10')]===0x1f4){logger[_0xf470('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x4b96b2,_0x581fed[_0xf470('0xf')][_0xf470('0x11')]);return _0xd3cbaf(_0x581fed[_0xf470('0xf')][_0xf470('0x11')]);}logger[_0xf470('0xf')](_0xf470('0x12'),_0x4b96b2,_0x581fed[_0xf470('0xf')][_0xf470('0x11')]);return _0x463dc5(_0x581fed['error'][_0xf470('0x11')]);}else{logger[_0xf470('0xc')](_0xf470('0x12'),_0x4b96b2,_0xf470('0x13'));_0x463dc5(_0x581fed[_0xf470('0x14')][_0xf470('0x11')]);}})[_0xf470('0x15')](function(_0x18baaa){logger[_0xf470('0xf')](_0xf470('0x12'),_0x4b96b2,_0x18baaa);_0xd3cbaf(_0x18baaa);});});}exports[_0xf470('0x16')]=function(_0x2b9c58){var _0xfd8fce=this;return new Promise(function(_0x2b84d1,_0x31647e){return db[_0xf470('0x17')][_0xf470('0x18')]({'raw':_0x2b9c58[_0xf470('0x19')]?_0x2b9c58[_0xf470('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9c58['options']?_0x2b9c58[_0xf470('0x19')]['where']||null:null,'attributes':_0x2b9c58[_0xf470('0x19')]?_0x2b9c58[_0xf470('0x19')][_0xf470('0x1a')]||null:null,'limit':_0x2b9c58[_0xf470('0x19')]?_0x2b9c58['options'][_0xf470('0x1b')]||null:null,'include':_0x2b9c58[_0xf470('0x19')]?_0x2b9c58[_0xf470('0x19')][_0xf470('0x1c')]?_['map'](_0x2b9c58[_0xf470('0x19')][_0xf470('0x1c')],function(_0x460514){return{'model':db[_0x460514['model']],'as':_0x460514['as'],'attributes':_0x460514[_0xf470('0x1a')],'include':_0x460514[_0xf470('0x1c')]?_[_0xf470('0x1d')](_0x460514[_0xf470('0x1c')],function(_0x262a31){return{'model':db[_0x262a31['model']],'as':_0x262a31['as'],'attributes':_0x262a31[_0xf470('0x1a')],'include':_0x262a31[_0xf470('0x1c')]?_[_0xf470('0x1d')](_0x262a31['include'],function(_0xe55c72){return{'model':db[_0xe55c72[_0xf470('0x1e')]],'as':_0xe55c72['as'],'attributes':_0xe55c72['attributes']};}):[]};}):[]};}):[]:[]})[_0xf470('0xb')](function(_0x22d9d7){logger[_0xf470('0xc')](_0xf470('0x16'),_0x2b9c58);logger['debug'](_0xf470('0x16'),_0x2b9c58,JSON[_0xf470('0x1f')](_0x22d9d7));_0x2b84d1(_0x22d9d7);})[_0xf470('0x15')](function(_0xc5609){logger[_0xf470('0xf')](_0xf470('0x16'),_0xc5609['message'],_0x2b9c58);_0x31647e(_0xfd8fce['error'](0x1f4,_0xc5609[_0xf470('0x11')]));});});};exports[_0xf470('0x20')]=function(_0x46a04a){var _0x3d7277=this;return new Promise(function(_0x599103,_0xcea9ce){return db[_0xf470('0x17')]['find']({'raw':_0x46a04a['options']?_0x46a04a[_0xf470('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x46a04a[_0xf470('0x19')]?_0x46a04a[_0xf470('0x19')][_0xf470('0x21')]||null:null,'attributes':_0x46a04a['options']?_0x46a04a[_0xf470('0x19')][_0xf470('0x1a')]||null:null,'include':_0x46a04a['options']?_0x46a04a[_0xf470('0x19')]['include']?_['map'](_0x46a04a[_0xf470('0x19')][_0xf470('0x1c')],function(_0xbdae35){return{'model':db[_0xbdae35[_0xf470('0x1e')]],'as':_0xbdae35['as'],'attributes':_0xbdae35[_0xf470('0x1a')],'include':_0xbdae35[_0xf470('0x1c')]?_[_0xf470('0x1d')](_0xbdae35['include'],function(_0x1db6aa){return{'model':db[_0x1db6aa[_0xf470('0x1e')]],'as':_0x1db6aa['as'],'attributes':_0x1db6aa[_0xf470('0x1a')],'include':_0x1db6aa['include']?_[_0xf470('0x1d')](_0x1db6aa[_0xf470('0x1c')],function(_0x4d566c){return{'model':db[_0x4d566c[_0xf470('0x1e')]],'as':_0x4d566c['as'],'attributes':_0x4d566c[_0xf470('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1120c8){logger['info'](_0xf470('0x20'),_0x46a04a);logger['debug'](_0xf470('0x20'),_0x46a04a,JSON[_0xf470('0x1f')](_0x1120c8));_0x599103(_0x1120c8);})['catch'](function(_0x1351d3){logger[_0xf470('0xf')](_0xf470('0x20'),_0x1351d3[_0xf470('0x11')],_0x46a04a);_0xcea9ce(_0x3d7277[_0xf470('0xf')](0x1f4,_0x1351d3['message']));});});}; \ No newline at end of file +var _0xcbf4=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','where','attributes','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x28c62c,_0x5eddb9){var _0x19d4f2=function(_0x50bde8){while(--_0x50bde8){_0x28c62c['push'](_0x28c62c['shift']());}};_0x19d4f2(++_0x5eddb9);}(_0xcbf4,0x106));var _0x4cbf=function(_0x579490,_0x5074d4){_0x579490=_0x579490-0x0;var _0x5f529b=_0xcbf4[_0x579490];return _0x5f529b;};'use strict';var _=require(_0x4cbf('0x0'));var util=require('util');var moment=require(_0x4cbf('0x1'));var BPromise=require(_0x4cbf('0x2'));var rs=require(_0x4cbf('0x3'));var fs=require('fs');var Redis=require(_0x4cbf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cbf('0x5'));var logger=require(_0x4cbf('0x6'))(_0x4cbf('0x7'));var config=require(_0x4cbf('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4cbf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe0fa5c,_0x3a210f,_0x3b246b){return new BPromise(function(_0xadf5d9,_0x380670){return client[_0x4cbf('0xa')](_0xe0fa5c,_0x3b246b)[_0x4cbf('0xb')](function(_0x3b3892){logger[_0x4cbf('0xc')](_0x4cbf('0xd'),_0x3a210f,_0x4cbf('0xe'));logger['debug'](_0x4cbf('0xf'),_0x3a210f,_0x4cbf('0xe'),JSON[_0x4cbf('0x10')](_0x3b3892));if(_0x3b3892['error']){if(_0x3b3892[_0x4cbf('0x11')][_0x4cbf('0x12')]===0x1f4){logger['error'](_0x4cbf('0xd'),_0x3a210f,_0x3b3892['error'][_0x4cbf('0x13')]);return _0x380670(_0x3b3892['error'][_0x4cbf('0x13')]);}logger['error'](_0x4cbf('0xd'),_0x3a210f,_0x3b3892[_0x4cbf('0x11')]['message']);return _0xadf5d9(_0x3b3892[_0x4cbf('0x11')]['message']);}else{logger[_0x4cbf('0xc')](_0x4cbf('0xd'),_0x3a210f,_0x4cbf('0xe'));_0xadf5d9(_0x3b3892[_0x4cbf('0x14')][_0x4cbf('0x13')]);}})[_0x4cbf('0x15')](function(_0x45183e){logger['error'](_0x4cbf('0xd'),_0x3a210f,_0x45183e);_0x380670(_0x45183e);});});}exports['GetSugarcrmAccount']=function(_0x17f714){var _0x1f2fe2=this;return new Promise(function(_0x13e031,_0x292bf5){return db[_0x4cbf('0x16')][_0x4cbf('0x17')]({'raw':_0x17f714['options']?_0x17f714['options']['raw']===undefined?!![]:![]:!![],'where':_0x17f714[_0x4cbf('0x18')]?_0x17f714[_0x4cbf('0x18')][_0x4cbf('0x19')]||null:null,'attributes':_0x17f714[_0x4cbf('0x18')]?_0x17f714[_0x4cbf('0x18')][_0x4cbf('0x1a')]||null:null,'limit':_0x17f714[_0x4cbf('0x18')]?_0x17f714[_0x4cbf('0x18')]['limit']||null:null,'include':_0x17f714['options']?_0x17f714['options'][_0x4cbf('0x1b')]?_[_0x4cbf('0x1c')](_0x17f714[_0x4cbf('0x18')]['include'],function(_0x474447){return{'model':db[_0x474447[_0x4cbf('0x1d')]],'as':_0x474447['as'],'attributes':_0x474447[_0x4cbf('0x1a')],'include':_0x474447[_0x4cbf('0x1b')]?_[_0x4cbf('0x1c')](_0x474447[_0x4cbf('0x1b')],function(_0x4995f6){return{'model':db[_0x4995f6['model']],'as':_0x4995f6['as'],'attributes':_0x4995f6[_0x4cbf('0x1a')],'include':_0x4995f6[_0x4cbf('0x1b')]?_[_0x4cbf('0x1c')](_0x4995f6[_0x4cbf('0x1b')],function(_0x43bf6d){return{'model':db[_0x43bf6d['model']],'as':_0x43bf6d['as'],'attributes':_0x43bf6d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ce6a3){logger['info']('GetSugarcrmAccount',_0x17f714);logger['debug'](_0x4cbf('0x1e'),_0x17f714,JSON['stringify'](_0x4ce6a3));_0x13e031(_0x4ce6a3);})['catch'](function(_0x12f743){logger[_0x4cbf('0x11')]('GetSugarcrmAccount',_0x12f743[_0x4cbf('0x13')],_0x17f714);_0x292bf5(_0x1f2fe2['error'](0x1f4,_0x12f743[_0x4cbf('0x13')]));});});};exports[_0x4cbf('0x1f')]=function(_0x384b97){var _0x3862ca=this;return new Promise(function(_0xe6719e,_0xf67eab){return db[_0x4cbf('0x16')]['find']({'raw':_0x384b97[_0x4cbf('0x18')]?_0x384b97[_0x4cbf('0x18')][_0x4cbf('0x20')]===undefined?!![]:![]:!![],'where':_0x384b97['options']?_0x384b97[_0x4cbf('0x18')][_0x4cbf('0x19')]||null:null,'attributes':_0x384b97[_0x4cbf('0x18')]?_0x384b97['options']['attributes']||null:null,'include':_0x384b97[_0x4cbf('0x18')]?_0x384b97['options'][_0x4cbf('0x1b')]?_['map'](_0x384b97['options']['include'],function(_0xe06842){return{'model':db[_0xe06842['model']],'as':_0xe06842['as'],'attributes':_0xe06842[_0x4cbf('0x1a')],'include':_0xe06842[_0x4cbf('0x1b')]?_['map'](_0xe06842['include'],function(_0x3ef1b4){return{'model':db[_0x3ef1b4[_0x4cbf('0x1d')]],'as':_0x3ef1b4['as'],'attributes':_0x3ef1b4[_0x4cbf('0x1a')],'include':_0x3ef1b4[_0x4cbf('0x1b')]?_[_0x4cbf('0x1c')](_0x3ef1b4[_0x4cbf('0x1b')],function(_0x12c590){return{'model':db[_0x12c590['model']],'as':_0x12c590['as'],'attributes':_0x12c590[_0x4cbf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4cbf('0xb')](function(_0x1480b8){logger[_0x4cbf('0xc')](_0x4cbf('0x1f'),_0x384b97);logger[_0x4cbf('0x21')](_0x4cbf('0x1f'),_0x384b97,JSON[_0x4cbf('0x10')](_0x1480b8));_0xe6719e(_0x1480b8);})[_0x4cbf('0x15')](function(_0x310c0d){logger[_0x4cbf('0x11')](_0x4cbf('0x1f'),_0x310c0d[_0x4cbf('0x13')],_0x384b97);_0xf67eab(_0x3862ca['error'](0x1f4,_0x310c0d[_0x4cbf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1811fd9..8dc2f43 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 _0xfac1=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xe13339,_0x5d1dc2){var _0x550e7c=function(_0x14092b){while(--_0x14092b){_0xe13339['push'](_0xe13339['shift']());}};_0x550e7c(++_0x5d1dc2);}(_0xfac1,0x140));var _0x1fac=function(_0x26f499,_0x2359ef){_0x26f499=_0x26f499-0x0;var _0xccb39=_0xfac1[_0x26f499];return _0xccb39;};'use strict';var multer=require('multer');var util=require(_0x1fac('0x0'));var path=require(_0x1fac('0x1'));var timeout=require('connect-timeout');var express=require(_0x1fac('0x2'));var router=express['Router']();var fs_extra=require(_0x1fac('0x3'));var auth=require(_0x1fac('0x4'));var interaction=require(_0x1fac('0x5'));var config=require(_0x1fac('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x1fac('0x7')]('/',auth[_0x1fac('0x8')](),controller[_0x1fac('0x9')]);router[_0x1fac('0x7')](_0x1fac('0xa'),auth['isAuthenticated'](),controller[_0x1fac('0xb')]);router['get'](_0x1fac('0xc'),auth[_0x1fac('0x8')](),controller[_0x1fac('0xd')]);router[_0x1fac('0x7')](_0x1fac('0xe'),auth['isAuthenticated'](),controller[_0x1fac('0xf')]);router[_0x1fac('0x7')](_0x1fac('0x10'),auth[_0x1fac('0x8')](),controller['getDescriptions']);router[_0x1fac('0x11')]('/',auth[_0x1fac('0x8')](),controller[_0x1fac('0x12')]);router[_0x1fac('0x13')](_0x1fac('0xa'),auth[_0x1fac('0x8')](),controller[_0x1fac('0x14')]);router['delete'](_0x1fac('0xa'),auth[_0x1fac('0x8')](),controller['destroy']);module[_0x1fac('0x15')]=router; \ No newline at end of file +var _0x40cb=['create','put','update','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post'];(function(_0x787c38,_0x804b9){var _0x1eb4a8=function(_0x16dba3){while(--_0x16dba3){_0x787c38['push'](_0x787c38['shift']());}};_0x1eb4a8(++_0x804b9);}(_0x40cb,0x169));var _0xb40c=function(_0x9d7098,_0x83bb7c){_0x9d7098=_0x9d7098-0x0;var _0x122806=_0x40cb[_0x9d7098];return _0x122806;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb40c('0x0'));var timeout=require('connect-timeout');var express=require(_0xb40c('0x1'));var router=express['Router']();var fs_extra=require(_0xb40c('0x2'));var auth=require(_0xb40c('0x3'));var interaction=require(_0xb40c('0x4'));var config=require(_0xb40c('0x5'));var controller=require(_0xb40c('0x6'));router[_0xb40c('0x7')]('/',auth['isAuthenticated'](),controller[_0xb40c('0x8')]);router[_0xb40c('0x7')](_0xb40c('0x9'),auth[_0xb40c('0xa')](),controller[_0xb40c('0xb')]);router[_0xb40c('0x7')](_0xb40c('0xc'),auth[_0xb40c('0xa')](),controller[_0xb40c('0xd')]);router['get'](_0xb40c('0xe'),auth[_0xb40c('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xb40c('0xa')](),controller[_0xb40c('0xf')]);router[_0xb40c('0x10')]('/',auth[_0xb40c('0xa')](),controller[_0xb40c('0x11')]);router[_0xb40c('0x12')](_0xb40c('0x9'),auth[_0xb40c('0xa')](),controller[_0xb40c('0x13')]);router['delete'](_0xb40c('0x9'),auth[_0xb40c('0xa')](),controller['destroy']);module[_0xb40c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 1918af1..761439c 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 _0x2a67=['exports','STRING','sequelize'];(function(_0xae76da,_0x5b0223){var _0x2102b7=function(_0x371bab){while(--_0x371bab){_0xae76da['push'](_0xae76da['shift']());}};_0x2102b7(++_0x5b0223);}(_0x2a67,0xc8));var _0x72a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x72a6('0x0'));module[_0x72a6('0x1')]={'name':{'type':Sequelize[_0x72a6('0x2')]},'description':{'type':Sequelize[_0x72a6('0x2')]}}; \ No newline at end of file +var _0x3c09=['STRING','sequelize','exports'];(function(_0x9bb1a7,_0x483916){var _0x10221e=function(_0x294dbb){while(--_0x294dbb){_0x9bb1a7['push'](_0x9bb1a7['shift']());}};_0x10221e(++_0x483916);}(_0x3c09,0x18d));var _0x93c0=function(_0x4ef941,_0x366c87){_0x4ef941=_0x4ef941-0x0;var _0x9d5bd2=_0x3c09[_0x4ef941];return _0x9d5bd2;};'use strict';var Sequelize=require(_0x93c0('0x0'));module[_0x93c0('0x1')]={'name':{'type':Sequelize[_0x93c0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1e0af96..2d3d149 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 _0x5e50=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','end','error','stack','name','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','body','getFields','findOne','getSubjects','SugarcrmField','sort','getDescriptions','eml-format','fast-json-patch','util','to-csv'];(function(_0x2cff4f,_0x21e344){var _0x3df848=function(_0x49474b){while(--_0x49474b){_0x2cff4f['push'](_0x2cff4f['shift']());}};_0x3df848(++_0x21e344);}(_0x5e50,0x178));var _0x05e5=function(_0x37277b,_0x41aab1){_0x37277b=_0x37277b-0x0;var _0x3c7b86=_0x5e50[_0x37277b];return _0x3c7b86;};'use strict';var emlformat=require(_0x05e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05e5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x05e5('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0x05e5('0x3'));var ejs=require(_0x05e5('0x4'));var fs=require('fs');var fs_extra=require(_0x05e5('0x5'));var _=require(_0x05e5('0x6'));var squel=require(_0x05e5('0x7'));var crypto=require(_0x05e5('0x8'));var jsforce=require(_0x05e5('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x05e5('0xa'));var Papa=require(_0x05e5('0xb'));var Redis=require(_0x05e5('0xc'));var authService=require(_0x05e5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x05e5('0xe'));var hardwareService=require(_0x05e5('0xf'));var logger=require(_0x05e5('0x10'))(_0x05e5('0x11'));var utils=require(_0x05e5('0x12'));var config=require(_0x05e5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x05e5('0x14'))['db'];function respondWithStatusCode(_0x5d7a1e,_0x2044ed){_0x2044ed=_0x2044ed||0xcc;return function(_0x4a76b5){if(_0x4a76b5){return _0x5d7a1e[_0x05e5('0x15')](_0x2044ed);}return _0x5d7a1e['status'](_0x2044ed)['end']();};}function respondWithResult(_0x524bd5,_0xbf5764){_0xbf5764=_0xbf5764||0xc8;return function(_0x2eddaa){if(_0x2eddaa){return _0x524bd5[_0x05e5('0x16')](_0xbf5764)[_0x05e5('0x17')](_0x2eddaa);}};}function respondWithFilteredResult(_0xffbef,_0x2cbbb1){return function(_0x3a43f0){if(_0x3a43f0){var _0x4558f8=typeof _0x2cbbb1[_0x05e5('0x18')]==='undefined'&&typeof _0x2cbbb1[_0x05e5('0x19')]===_0x05e5('0x1a');var _0x18a8bf=_0x3a43f0[_0x05e5('0x1b')];var _0x56da5b=_0x4558f8?0x0:_0x2cbbb1[_0x05e5('0x18')];var _0x5d9349=_0x4558f8?_0x3a43f0[_0x05e5('0x1b')]:_0x2cbbb1[_0x05e5('0x18')]+_0x2cbbb1[_0x05e5('0x19')];var _0x4eabaf;if(_0x5d9349>=_0x18a8bf){_0x5d9349=_0x18a8bf;_0x4eabaf=0xc8;}else{_0x4eabaf=0xce;}_0xffbef[_0x05e5('0x16')](_0x4eabaf);return _0xffbef[_0x05e5('0x1c')]('Content-Range',_0x56da5b+'-'+_0x5d9349+'/'+_0x18a8bf)['json'](_0x3a43f0);}return null;};}function patchUpdates(_0x518a38){return function(_0x4f91f7){try{jsonpatch['apply'](_0x4f91f7,_0x518a38,!![]);}catch(_0x33792d){return BPromise[_0x05e5('0x1d')](_0x33792d);}return _0x4f91f7[_0x05e5('0x1e')]();};}function saveUpdates(_0x27c83a,_0x4bb0eb){return function(_0x1f205e){if(_0x1f205e){return _0x1f205e[_0x05e5('0x1f')](_0x27c83a)[_0x05e5('0x20')](function(_0x31dbc6){return _0x31dbc6;});}return null;};}function removeEntity(_0x363cff,_0x11bfbd){return function(_0x3712b9){if(_0x3712b9){return _0x3712b9[_0x05e5('0x21')]()[_0x05e5('0x20')](function(){_0x363cff[_0x05e5('0x16')](0xcc)[_0x05e5('0x22')]();});}};}function handleEntityNotFound(_0x1978d9,_0x196368){return function(_0x1b9deb){if(!_0x1b9deb){_0x1978d9[_0x05e5('0x15')](0x194);}return _0x1b9deb;};}function handleError(_0x3a02cb,_0x55c5cd){_0x55c5cd=_0x55c5cd||0x1f4;return function(_0x4e9cf1){logger[_0x05e5('0x23')](_0x4e9cf1[_0x05e5('0x24')]);if(_0x4e9cf1[_0x05e5('0x25')]){delete _0x4e9cf1[_0x05e5('0x25')];}_0x3a02cb[_0x05e5('0x16')](_0x55c5cd)['send'](_0x4e9cf1);};}exports[_0x05e5('0x26')]=function(_0x37b0bf,_0x38edca){var _0x59ab85={},_0x3444dd={},_0x5795ea={'count':0x0,'rows':[]};var _0xb8870f=_[_0x05e5('0x27')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x1f7b92){return{'name':_0x1f7b92[_0x05e5('0x28')],'type':_0x1f7b92['type'][_0x05e5('0x29')]};});_0x3444dd['model']=_[_0x05e5('0x27')](_0xb8870f,'name');_0x3444dd[_0x05e5('0x2a')]=_[_0x05e5('0x2b')](_0x37b0bf[_0x05e5('0x2a')]);_0x3444dd[_0x05e5('0x2c')]=_[_0x05e5('0x2d')](_0x3444dd[_0x05e5('0x2e')],_0x3444dd[_0x05e5('0x2a')]);_0x59ab85[_0x05e5('0x2f')]=_[_0x05e5('0x2d')](_0x3444dd['model'],qs['fields'](_0x37b0bf[_0x05e5('0x2a')]['fields']));_0x59ab85[_0x05e5('0x2f')]=_0x59ab85[_0x05e5('0x2f')][_0x05e5('0x30')]?_0x59ab85[_0x05e5('0x2f')]:_0x3444dd[_0x05e5('0x2e')];if(!_0x37b0bf[_0x05e5('0x2a')][_0x05e5('0x31')](_0x05e5('0x32'))){_0x59ab85['limit']=qs[_0x05e5('0x19')](_0x37b0bf[_0x05e5('0x2a')][_0x05e5('0x19')]);_0x59ab85[_0x05e5('0x18')]=qs[_0x05e5('0x18')](_0x37b0bf[_0x05e5('0x2a')][_0x05e5('0x18')]);}_0x59ab85[_0x05e5('0x33')]=qs['sort'](_0x37b0bf[_0x05e5('0x2a')]['sort']);_0x59ab85[_0x05e5('0x34')]=qs[_0x05e5('0x2c')](_[_0x05e5('0x35')](_0x37b0bf['query'],_0x3444dd[_0x05e5('0x2c')]),_0xb8870f);if(_0x37b0bf[_0x05e5('0x2a')]['filter']){_0x59ab85[_0x05e5('0x34')]=_[_0x05e5('0x36')](_0x59ab85[_0x05e5('0x34')],{'$or':_[_0x05e5('0x27')](_0xb8870f,function(_0x1d7df6){if(_0x1d7df6['type']!==_0x05e5('0x37')){var _0x599fdb={};_0x599fdb[_0x1d7df6[_0x05e5('0x25')]]={'$like':'%'+_0x37b0bf['query'][_0x05e5('0x38')]+'%'};return _0x599fdb;}})});}_0x59ab85=_[_0x05e5('0x36')]({},_0x59ab85,_0x37b0bf[_0x05e5('0x39')]);var _0x37c5da={'where':_0x59ab85[_0x05e5('0x34')]};return db[_0x05e5('0x3a')][_0x05e5('0x1b')](_0x37c5da)[_0x05e5('0x20')](function(_0x552a3f){_0x5795ea[_0x05e5('0x1b')]=_0x552a3f;if(_0x37b0bf[_0x05e5('0x2a')][_0x05e5('0x3b')]){_0x59ab85[_0x05e5('0x3c')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x05e5('0x3d')](_0x59ab85);})[_0x05e5('0x20')](function(_0x771490){_0x5795ea[_0x05e5('0x3e')]=_0x771490;return _0x5795ea;})[_0x05e5('0x20')](respondWithFilteredResult(_0x38edca,_0x59ab85))[_0x05e5('0x3f')](handleError(_0x38edca,null));};exports[_0x05e5('0x40')]=function(_0x1e7d3e,_0x4f2248){var _0x46a8ea={'raw':![],'where':{'id':_0x1e7d3e[_0x05e5('0x41')]['id']}},_0x2f894d={};_0x2f894d['model']=_[_0x05e5('0x2b')](db[_0x05e5('0x3a')][_0x05e5('0x42')]);_0x2f894d[_0x05e5('0x2a')]=_[_0x05e5('0x2b')](_0x1e7d3e[_0x05e5('0x2a')]);_0x2f894d['filters']=_[_0x05e5('0x2d')](_0x2f894d[_0x05e5('0x2e')],_0x2f894d[_0x05e5('0x2a')]);_0x46a8ea['attributes']=_['intersection'](_0x2f894d[_0x05e5('0x2e')],qs['fields'](_0x1e7d3e[_0x05e5('0x2a')][_0x05e5('0x43')]));_0x46a8ea['attributes']=_0x46a8ea[_0x05e5('0x2f')][_0x05e5('0x30')]?_0x46a8ea[_0x05e5('0x2f')]:_0x2f894d['model'];if(_0x1e7d3e[_0x05e5('0x2a')][_0x05e5('0x3b')]){_0x46a8ea['include']=[{'all':!![]}];}_0x46a8ea=_['merge']({},_0x46a8ea,_0x1e7d3e[_0x05e5('0x39')]);return db[_0x05e5('0x3a')][_0x05e5('0x44')](_0x46a8ea)[_0x05e5('0x20')](handleEntityNotFound(_0x4f2248,null))[_0x05e5('0x20')](respondWithResult(_0x4f2248,null))['catch'](handleError(_0x4f2248,null));};exports['create']=function(_0x382601,_0x101554){return db[_0x05e5('0x3a')]['create'](_0x382601[_0x05e5('0x45')],{})['then'](respondWithResult(_0x101554,0xc9))['catch'](handleError(_0x101554,null));};exports[_0x05e5('0x1f')]=function(_0xe74744,_0x1081e6){if(_0xe74744[_0x05e5('0x45')]['id']){delete _0xe74744[_0x05e5('0x45')]['id'];}return db[_0x05e5('0x3a')][_0x05e5('0x44')]({'where':{'id':_0xe74744[_0x05e5('0x41')]['id']}})[_0x05e5('0x20')](handleEntityNotFound(_0x1081e6,null))[_0x05e5('0x20')](saveUpdates(_0xe74744['body'],null))[_0x05e5('0x20')](respondWithResult(_0x1081e6,null))['catch'](handleError(_0x1081e6,null));};exports[_0x05e5('0x21')]=function(_0x1ed33b,_0x191226){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1ed33b[_0x05e5('0x41')]['id']}})[_0x05e5('0x20')](handleEntityNotFound(_0x191226,null))[_0x05e5('0x20')](removeEntity(_0x191226,null))[_0x05e5('0x3f')](handleError(_0x191226,null));};exports[_0x05e5('0x46')]=function(_0x2cf089,_0x60a903,_0x1df5c){var _0x39572b={};var _0x16ebd7={};var _0x26920a;var _0x42788b;return db[_0x05e5('0x3a')][_0x05e5('0x47')]({'where':{'id':_0x2cf089[_0x05e5('0x41')]['id']}})[_0x05e5('0x20')](handleEntityNotFound(_0x60a903,null))[_0x05e5('0x20')](function(_0x4fc39e){if(_0x4fc39e){_0x26920a=_0x4fc39e;_0x16ebd7[_0x05e5('0x2e')]=_[_0x05e5('0x2b')](db['SugarcrmField'][_0x05e5('0x42')]);_0x16ebd7[_0x05e5('0x2a')]=_[_0x05e5('0x2b')](_0x2cf089[_0x05e5('0x2a')]);_0x16ebd7['filters']=_[_0x05e5('0x2d')](_0x16ebd7['model'],_0x16ebd7[_0x05e5('0x2a')]);_0x39572b[_0x05e5('0x2f')]=_['intersection'](_0x16ebd7[_0x05e5('0x2e')],qs[_0x05e5('0x43')](_0x2cf089[_0x05e5('0x2a')][_0x05e5('0x43')]));_0x39572b[_0x05e5('0x2f')]=_0x39572b[_0x05e5('0x2f')][_0x05e5('0x30')]?_0x39572b[_0x05e5('0x2f')]:_0x16ebd7['model'];_0x39572b[_0x05e5('0x33')]=qs['sort'](_0x2cf089[_0x05e5('0x2a')]['sort']);_0x39572b[_0x05e5('0x34')]=qs[_0x05e5('0x2c')](_[_0x05e5('0x35')](_0x2cf089['query'],_0x16ebd7[_0x05e5('0x2c')]));if(_0x2cf089['query'][_0x05e5('0x38')]){_0x39572b['where']=_[_0x05e5('0x36')](_0x39572b[_0x05e5('0x34')],{'$or':_['map'](_0x39572b['attributes'],function(_0x4a6cfb){var _0x1c7b72={};_0x1c7b72[_0x4a6cfb]={'$like':'%'+_0x2cf089[_0x05e5('0x2a')][_0x05e5('0x38')]+'%'};return _0x1c7b72;})});}_0x39572b=_[_0x05e5('0x36')]({},_0x39572b,_0x2cf089[_0x05e5('0x39')]);return _0x26920a[_0x05e5('0x46')](_0x39572b);}})[_0x05e5('0x20')](function(_0x1facc6){if(_0x1facc6){_0x42788b=_0x1facc6[_0x05e5('0x30')];if(!_0x2cf089[_0x05e5('0x2a')][_0x05e5('0x31')](_0x05e5('0x32'))){_0x39572b[_0x05e5('0x19')]=qs[_0x05e5('0x19')](_0x2cf089[_0x05e5('0x2a')][_0x05e5('0x19')]);_0x39572b[_0x05e5('0x18')]=qs[_0x05e5('0x18')](_0x2cf089[_0x05e5('0x2a')][_0x05e5('0x18')]);}return _0x26920a[_0x05e5('0x46')](_0x39572b);}})['then'](function(_0x2671e0){if(_0x2671e0){return _0x2671e0?{'count':_0x42788b,'rows':_0x2671e0}:null;}})[_0x05e5('0x20')](respondWithResult(_0x60a903,null))['catch'](handleError(_0x60a903,null));};exports[_0x05e5('0x48')]=function(_0x51aa1a,_0x423b6a,_0x5bcd35){var _0x169bdb={};var _0x8a6305={};var _0x3611aa;var _0x3f798f;return db[_0x05e5('0x3a')][_0x05e5('0x47')]({'where':{'id':_0x51aa1a[_0x05e5('0x41')]['id']}})[_0x05e5('0x20')](handleEntityNotFound(_0x423b6a,null))[_0x05e5('0x20')](function(_0x2d70ab){if(_0x2d70ab){_0x3611aa=_0x2d70ab;_0x8a6305[_0x05e5('0x2e')]=_[_0x05e5('0x2b')](db['SugarcrmField'][_0x05e5('0x42')]);_0x8a6305[_0x05e5('0x2a')]=_[_0x05e5('0x2b')](_0x51aa1a[_0x05e5('0x2a')]);_0x8a6305[_0x05e5('0x2c')]=_[_0x05e5('0x2d')](_0x8a6305['model'],_0x8a6305[_0x05e5('0x2a')]);_0x169bdb['attributes']=_[_0x05e5('0x2d')](_0x8a6305[_0x05e5('0x2e')],qs['fields'](_0x51aa1a['query']['fields']));_0x169bdb[_0x05e5('0x2f')]=_0x169bdb[_0x05e5('0x2f')][_0x05e5('0x30')]?_0x169bdb[_0x05e5('0x2f')]:_0x8a6305['model'];_0x169bdb[_0x05e5('0x33')]=qs['sort'](_0x51aa1a[_0x05e5('0x2a')]['sort']);_0x169bdb[_0x05e5('0x34')]=qs[_0x05e5('0x2c')](_[_0x05e5('0x35')](_0x51aa1a[_0x05e5('0x2a')],_0x8a6305[_0x05e5('0x2c')]));if(_0x51aa1a['query']['filter']){_0x169bdb[_0x05e5('0x34')]=_[_0x05e5('0x36')](_0x169bdb[_0x05e5('0x34')],{'$or':_['map'](_0x169bdb[_0x05e5('0x2f')],function(_0x34a22d){var _0x342d89={};_0x342d89[_0x34a22d]={'$like':'%'+_0x51aa1a[_0x05e5('0x2a')][_0x05e5('0x38')]+'%'};return _0x342d89;})});}_0x169bdb=_[_0x05e5('0x36')]({},_0x169bdb,_0x51aa1a[_0x05e5('0x39')]);return _0x3611aa[_0x05e5('0x48')](_0x169bdb);}})[_0x05e5('0x20')](function(_0x112fc3){if(_0x112fc3){_0x3f798f=_0x112fc3[_0x05e5('0x30')];if(!_0x51aa1a[_0x05e5('0x2a')]['hasOwnProperty']('nolimit')){_0x169bdb[_0x05e5('0x19')]=qs[_0x05e5('0x19')](_0x51aa1a[_0x05e5('0x2a')][_0x05e5('0x19')]);_0x169bdb[_0x05e5('0x18')]=qs[_0x05e5('0x18')](_0x51aa1a['query'][_0x05e5('0x18')]);}return _0x3611aa[_0x05e5('0x48')](_0x169bdb);}})[_0x05e5('0x20')](function(_0x436d24){if(_0x436d24){return _0x436d24?{'count':_0x3f798f,'rows':_0x436d24}:null;}})[_0x05e5('0x20')](respondWithResult(_0x423b6a,null))[_0x05e5('0x3f')](handleError(_0x423b6a,null));};exports['getDescriptions']=function(_0x2fa1bc,_0x5d3abd,_0x522df5){var _0x1641f3={};var _0x3200e1={};var _0x5dcc80;var _0x6aa381;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2fa1bc[_0x05e5('0x41')]['id']}})[_0x05e5('0x20')](handleEntityNotFound(_0x5d3abd,null))[_0x05e5('0x20')](function(_0x39d393){if(_0x39d393){_0x5dcc80=_0x39d393;_0x3200e1['model']=_[_0x05e5('0x2b')](db[_0x05e5('0x49')][_0x05e5('0x42')]);_0x3200e1[_0x05e5('0x2a')]=_[_0x05e5('0x2b')](_0x2fa1bc[_0x05e5('0x2a')]);_0x3200e1[_0x05e5('0x2c')]=_[_0x05e5('0x2d')](_0x3200e1[_0x05e5('0x2e')],_0x3200e1['query']);_0x1641f3[_0x05e5('0x2f')]=_[_0x05e5('0x2d')](_0x3200e1[_0x05e5('0x2e')],qs[_0x05e5('0x43')](_0x2fa1bc[_0x05e5('0x2a')][_0x05e5('0x43')]));_0x1641f3[_0x05e5('0x2f')]=_0x1641f3[_0x05e5('0x2f')][_0x05e5('0x30')]?_0x1641f3[_0x05e5('0x2f')]:_0x3200e1[_0x05e5('0x2e')];_0x1641f3[_0x05e5('0x33')]=qs[_0x05e5('0x4a')](_0x2fa1bc['query'][_0x05e5('0x4a')]);_0x1641f3[_0x05e5('0x34')]=qs[_0x05e5('0x2c')](_[_0x05e5('0x35')](_0x2fa1bc['query'],_0x3200e1['filters']));if(_0x2fa1bc[_0x05e5('0x2a')][_0x05e5('0x38')]){_0x1641f3[_0x05e5('0x34')]=_['merge'](_0x1641f3[_0x05e5('0x34')],{'$or':_[_0x05e5('0x27')](_0x1641f3['attributes'],function(_0x52bc9d){var _0x59d646={};_0x59d646[_0x52bc9d]={'$like':'%'+_0x2fa1bc[_0x05e5('0x2a')][_0x05e5('0x38')]+'%'};return _0x59d646;})});}_0x1641f3=_[_0x05e5('0x36')]({},_0x1641f3,_0x2fa1bc['options']);return _0x5dcc80[_0x05e5('0x4b')](_0x1641f3);}})[_0x05e5('0x20')](function(_0x2e649c){if(_0x2e649c){_0x6aa381=_0x2e649c[_0x05e5('0x30')];if(!_0x2fa1bc[_0x05e5('0x2a')][_0x05e5('0x31')](_0x05e5('0x32'))){_0x1641f3[_0x05e5('0x19')]=qs['limit'](_0x2fa1bc['query'][_0x05e5('0x19')]);_0x1641f3['offset']=qs[_0x05e5('0x18')](_0x2fa1bc[_0x05e5('0x2a')][_0x05e5('0x18')]);}return _0x5dcc80[_0x05e5('0x4b')](_0x1641f3);}})[_0x05e5('0x20')](function(_0x2771c5){if(_0x2771c5){return _0x2771c5?{'count':_0x6aa381,'rows':_0x2771c5}:null;}})[_0x05e5('0x20')](respondWithResult(_0x5d3abd,null))[_0x05e5('0x3f')](handleError(_0x5d3abd,null));}; \ No newline at end of file +var _0x94f1=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','map','SugarcrmConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x94f1,0x177));var _0x194f=function(_0x19705a,_0x237841){_0x19705a=_0x19705a-0x0;var _0x40747d=_0x94f1[_0x19705a];return _0x40747d;};'use strict';var emlformat=require(_0x194f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x194f('0x1'));var jsonpatch=require(_0x194f('0x2'));var rp=require(_0x194f('0x3'));var moment=require(_0x194f('0x4'));var BPromise=require(_0x194f('0x5'));var Mustache=require(_0x194f('0x6'));var util=require(_0x194f('0x7'));var path=require('path');var sox=require(_0x194f('0x8'));var csv=require(_0x194f('0x9'));var ejs=require(_0x194f('0xa'));var fs=require('fs');var fs_extra=require(_0x194f('0xb'));var _=require('lodash');var squel=require(_0x194f('0xc'));var crypto=require(_0x194f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x194f('0xe'));var Papa=require(_0x194f('0xf'));var Redis=require(_0x194f('0x10'));var authService=require(_0x194f('0x11'));var qs=require(_0x194f('0x12'));var as=require(_0x194f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x194f('0x14'));var config=require(_0x194f('0x15'));var licenseUtil=require(_0x194f('0x16'));var db=require(_0x194f('0x17'))['db'];function respondWithStatusCode(_0x2925e7,_0x298fba){_0x298fba=_0x298fba||0xcc;return function(_0x16124d){if(_0x16124d){return _0x2925e7[_0x194f('0x18')](_0x298fba);}return _0x2925e7['status'](_0x298fba)[_0x194f('0x19')]();};}function respondWithResult(_0x1f6cde,_0x32c670){_0x32c670=_0x32c670||0xc8;return function(_0x270436){if(_0x270436){return _0x1f6cde[_0x194f('0x1a')](_0x32c670)[_0x194f('0x1b')](_0x270436);}};}function respondWithFilteredResult(_0x39c34e,_0x25302b){return function(_0x838612){if(_0x838612){var _0x598e8f=typeof _0x25302b[_0x194f('0x1c')]===_0x194f('0x1d')&&typeof _0x25302b[_0x194f('0x1e')]===_0x194f('0x1d');var _0x5da7c9=_0x838612['count'];var _0x5773c4=_0x598e8f?0x0:_0x25302b[_0x194f('0x1c')];var _0x383664=_0x598e8f?_0x838612[_0x194f('0x1f')]:_0x25302b[_0x194f('0x1c')]+_0x25302b['limit'];var _0x3aa939;if(_0x383664>=_0x5da7c9){_0x383664=_0x5da7c9;_0x3aa939=0xc8;}else{_0x3aa939=0xce;}_0x39c34e[_0x194f('0x1a')](_0x3aa939);return _0x39c34e[_0x194f('0x20')]('Content-Range',_0x5773c4+'-'+_0x383664+'/'+_0x5da7c9)[_0x194f('0x1b')](_0x838612);}return null;};}function patchUpdates(_0x5a9f1c){return function(_0x3b17e0){try{jsonpatch[_0x194f('0x21')](_0x3b17e0,_0x5a9f1c,!![]);}catch(_0x38fc76){return BPromise['reject'](_0x38fc76);}return _0x3b17e0[_0x194f('0x22')]();};}function saveUpdates(_0x103faa,_0x2e7615){return function(_0x29048d){if(_0x29048d){return _0x29048d[_0x194f('0x23')](_0x103faa)[_0x194f('0x24')](function(_0x1d0dab){return _0x1d0dab;});}return null;};}function removeEntity(_0x3debeb,_0x4e62fc){return function(_0x6dcae5){if(_0x6dcae5){return _0x6dcae5[_0x194f('0x25')]()[_0x194f('0x24')](function(){_0x3debeb[_0x194f('0x1a')](0xcc)[_0x194f('0x19')]();});}};}function handleEntityNotFound(_0x18f913,_0x28630f){return function(_0x23e4e9){if(!_0x23e4e9){_0x18f913[_0x194f('0x18')](0x194);}return _0x23e4e9;};}function handleError(_0x286990,_0x338231){_0x338231=_0x338231||0x1f4;return function(_0x134f18){logger[_0x194f('0x26')](_0x134f18['stack']);if(_0x134f18[_0x194f('0x27')]){delete _0x134f18[_0x194f('0x27')];}_0x286990[_0x194f('0x1a')](_0x338231)[_0x194f('0x28')](_0x134f18);};}exports['index']=function(_0xa26a61,_0x1b9d83){var _0x4baabc={},_0x290d5f={},_0x2153f5={'count':0x0,'rows':[]};var _0x4ba20a=_[_0x194f('0x29')](db[_0x194f('0x2a')][_0x194f('0x2b')],function(_0x4ec01e){return{'name':_0x4ec01e['fieldName'],'type':_0x4ec01e[_0x194f('0x2c')][_0x194f('0x2d')]};});_0x290d5f[_0x194f('0x2e')]=_[_0x194f('0x29')](_0x4ba20a,_0x194f('0x27'));_0x290d5f['query']=_['keys'](_0xa26a61[_0x194f('0x2f')]);_0x290d5f[_0x194f('0x30')]=_[_0x194f('0x31')](_0x290d5f['model'],_0x290d5f['query']);_0x4baabc[_0x194f('0x32')]=_[_0x194f('0x31')](_0x290d5f[_0x194f('0x2e')],qs[_0x194f('0x33')](_0xa26a61[_0x194f('0x2f')][_0x194f('0x33')]));_0x4baabc[_0x194f('0x32')]=_0x4baabc[_0x194f('0x32')][_0x194f('0x34')]?_0x4baabc[_0x194f('0x32')]:_0x290d5f['model'];if(!_0xa26a61['query'][_0x194f('0x35')](_0x194f('0x36'))){_0x4baabc['limit']=qs['limit'](_0xa26a61[_0x194f('0x2f')][_0x194f('0x1e')]);_0x4baabc[_0x194f('0x1c')]=qs[_0x194f('0x1c')](_0xa26a61[_0x194f('0x2f')][_0x194f('0x1c')]);}_0x4baabc[_0x194f('0x37')]=qs['sort'](_0xa26a61['query'][_0x194f('0x38')]);_0x4baabc[_0x194f('0x39')]=qs[_0x194f('0x30')](_[_0x194f('0x3a')](_0xa26a61[_0x194f('0x2f')],_0x290d5f['filters']),_0x4ba20a);if(_0xa26a61[_0x194f('0x2f')][_0x194f('0x3b')]){_0x4baabc['where']=_[_0x194f('0x3c')](_0x4baabc[_0x194f('0x39')],{'$or':_[_0x194f('0x29')](_0x4ba20a,function(_0x1064f1){if(_0x1064f1[_0x194f('0x2c')]!==_0x194f('0x3d')){var _0x596d27={};_0x596d27[_0x1064f1[_0x194f('0x27')]]={'$like':'%'+_0xa26a61[_0x194f('0x2f')][_0x194f('0x3b')]+'%'};return _0x596d27;}})});}_0x4baabc=_[_0x194f('0x3c')]({},_0x4baabc,_0xa26a61[_0x194f('0x3e')]);var _0x36b811={'where':_0x4baabc[_0x194f('0x39')]};return db[_0x194f('0x2a')]['count'](_0x36b811)[_0x194f('0x24')](function(_0x5c4bbb){_0x2153f5['count']=_0x5c4bbb;if(_0xa26a61['query'][_0x194f('0x3f')]){_0x4baabc[_0x194f('0x40')]=[{'all':!![]}];}return db[_0x194f('0x2a')][_0x194f('0x41')](_0x4baabc);})[_0x194f('0x24')](function(_0x2f0601){_0x2153f5[_0x194f('0x42')]=_0x2f0601;return _0x2153f5;})[_0x194f('0x24')](respondWithFilteredResult(_0x1b9d83,_0x4baabc))[_0x194f('0x43')](handleError(_0x1b9d83,null));};exports[_0x194f('0x44')]=function(_0x1a22d1,_0x493a0e){var _0x39fbc0={'raw':![],'where':{'id':_0x1a22d1[_0x194f('0x45')]['id']}},_0x40a8a5={};_0x40a8a5[_0x194f('0x2e')]=_[_0x194f('0x46')](db[_0x194f('0x2a')]['rawAttributes']);_0x40a8a5[_0x194f('0x2f')]=_[_0x194f('0x46')](_0x1a22d1['query']);_0x40a8a5[_0x194f('0x30')]=_[_0x194f('0x31')](_0x40a8a5[_0x194f('0x2e')],_0x40a8a5['query']);_0x39fbc0[_0x194f('0x32')]=_['intersection'](_0x40a8a5[_0x194f('0x2e')],qs[_0x194f('0x33')](_0x1a22d1[_0x194f('0x2f')]['fields']));_0x39fbc0[_0x194f('0x32')]=_0x39fbc0['attributes'][_0x194f('0x34')]?_0x39fbc0[_0x194f('0x32')]:_0x40a8a5[_0x194f('0x2e')];if(_0x1a22d1[_0x194f('0x2f')][_0x194f('0x3f')]){_0x39fbc0[_0x194f('0x40')]=[{'all':!![]}];}_0x39fbc0=_[_0x194f('0x3c')]({},_0x39fbc0,_0x1a22d1[_0x194f('0x3e')]);return db[_0x194f('0x2a')]['find'](_0x39fbc0)[_0x194f('0x24')](handleEntityNotFound(_0x493a0e,null))[_0x194f('0x24')](respondWithResult(_0x493a0e,null))[_0x194f('0x43')](handleError(_0x493a0e,null));};exports[_0x194f('0x47')]=function(_0x2c2c9c,_0x57b691){return db[_0x194f('0x2a')]['create'](_0x2c2c9c[_0x194f('0x48')],{})['then'](respondWithResult(_0x57b691,0xc9))['catch'](handleError(_0x57b691,null));};exports[_0x194f('0x23')]=function(_0x45374f,_0x3fd50d){if(_0x45374f['body']['id']){delete _0x45374f[_0x194f('0x48')]['id'];}return db[_0x194f('0x2a')][_0x194f('0x49')]({'where':{'id':_0x45374f['params']['id']}})[_0x194f('0x24')](handleEntityNotFound(_0x3fd50d,null))[_0x194f('0x24')](saveUpdates(_0x45374f[_0x194f('0x48')],null))['then'](respondWithResult(_0x3fd50d,null))['catch'](handleError(_0x3fd50d,null));};exports[_0x194f('0x25')]=function(_0x49368f,_0x251ad8){return db['SugarcrmConfiguration'][_0x194f('0x49')]({'where':{'id':_0x49368f[_0x194f('0x45')]['id']}})['then'](handleEntityNotFound(_0x251ad8,null))[_0x194f('0x24')](removeEntity(_0x251ad8,null))[_0x194f('0x43')](handleError(_0x251ad8,null));};exports[_0x194f('0x4a')]=function(_0x56e61d,_0x54297b,_0x2c2c3e){var _0x297f92={};var _0x51ff67={};var _0x5adf1b;var _0x5de446;return db[_0x194f('0x2a')][_0x194f('0x4b')]({'where':{'id':_0x56e61d[_0x194f('0x45')]['id']}})[_0x194f('0x24')](handleEntityNotFound(_0x54297b,null))[_0x194f('0x24')](function(_0x1d9214){if(_0x1d9214){_0x5adf1b=_0x1d9214;_0x51ff67[_0x194f('0x2e')]=_[_0x194f('0x46')](db[_0x194f('0x4c')][_0x194f('0x2b')]);_0x51ff67[_0x194f('0x2f')]=_['keys'](_0x56e61d[_0x194f('0x2f')]);_0x51ff67[_0x194f('0x30')]=_[_0x194f('0x31')](_0x51ff67['model'],_0x51ff67['query']);_0x297f92['attributes']=_[_0x194f('0x31')](_0x51ff67[_0x194f('0x2e')],qs[_0x194f('0x33')](_0x56e61d[_0x194f('0x2f')][_0x194f('0x33')]));_0x297f92[_0x194f('0x32')]=_0x297f92[_0x194f('0x32')][_0x194f('0x34')]?_0x297f92['attributes']:_0x51ff67['model'];_0x297f92[_0x194f('0x37')]=qs[_0x194f('0x38')](_0x56e61d[_0x194f('0x2f')][_0x194f('0x38')]);_0x297f92[_0x194f('0x39')]=qs[_0x194f('0x30')](_['pick'](_0x56e61d['query'],_0x51ff67[_0x194f('0x30')]));if(_0x56e61d['query'][_0x194f('0x3b')]){_0x297f92['where']=_[_0x194f('0x3c')](_0x297f92['where'],{'$or':_[_0x194f('0x29')](_0x297f92[_0x194f('0x32')],function(_0x985098){var _0x24dee2={};_0x24dee2[_0x985098]={'$like':'%'+_0x56e61d[_0x194f('0x2f')][_0x194f('0x3b')]+'%'};return _0x24dee2;})});}_0x297f92=_['merge']({},_0x297f92,_0x56e61d[_0x194f('0x3e')]);return _0x5adf1b[_0x194f('0x4a')](_0x297f92);}})[_0x194f('0x24')](function(_0x337a0f){if(_0x337a0f){_0x5de446=_0x337a0f[_0x194f('0x34')];if(!_0x56e61d[_0x194f('0x2f')]['hasOwnProperty']('nolimit')){_0x297f92[_0x194f('0x1e')]=qs[_0x194f('0x1e')](_0x56e61d[_0x194f('0x2f')]['limit']);_0x297f92[_0x194f('0x1c')]=qs[_0x194f('0x1c')](_0x56e61d['query'][_0x194f('0x1c')]);}return _0x5adf1b['getFields'](_0x297f92);}})[_0x194f('0x24')](function(_0x43a715){if(_0x43a715){return _0x43a715?{'count':_0x5de446,'rows':_0x43a715}:null;}})['then'](respondWithResult(_0x54297b,null))[_0x194f('0x43')](handleError(_0x54297b,null));};exports['getSubjects']=function(_0x437f52,_0x27241e,_0x326f01){var _0x329a65={};var _0x447251={};var _0x195c64;var _0x3bcef6;return db[_0x194f('0x2a')][_0x194f('0x4b')]({'where':{'id':_0x437f52[_0x194f('0x45')]['id']}})[_0x194f('0x24')](handleEntityNotFound(_0x27241e,null))[_0x194f('0x24')](function(_0x3fcbb6){if(_0x3fcbb6){_0x195c64=_0x3fcbb6;_0x447251[_0x194f('0x2e')]=_[_0x194f('0x46')](db['SugarcrmField'][_0x194f('0x2b')]);_0x447251[_0x194f('0x2f')]=_[_0x194f('0x46')](_0x437f52[_0x194f('0x2f')]);_0x447251[_0x194f('0x30')]=_['intersection'](_0x447251[_0x194f('0x2e')],_0x447251[_0x194f('0x2f')]);_0x329a65['attributes']=_[_0x194f('0x31')](_0x447251[_0x194f('0x2e')],qs[_0x194f('0x33')](_0x437f52[_0x194f('0x2f')][_0x194f('0x33')]));_0x329a65['attributes']=_0x329a65[_0x194f('0x32')]['length']?_0x329a65[_0x194f('0x32')]:_0x447251['model'];_0x329a65[_0x194f('0x37')]=qs[_0x194f('0x38')](_0x437f52[_0x194f('0x2f')][_0x194f('0x38')]);_0x329a65[_0x194f('0x39')]=qs['filters'](_[_0x194f('0x3a')](_0x437f52[_0x194f('0x2f')],_0x447251[_0x194f('0x30')]));if(_0x437f52[_0x194f('0x2f')]['filter']){_0x329a65[_0x194f('0x39')]=_[_0x194f('0x3c')](_0x329a65[_0x194f('0x39')],{'$or':_[_0x194f('0x29')](_0x329a65[_0x194f('0x32')],function(_0x1c58f5){var _0x317310={};_0x317310[_0x1c58f5]={'$like':'%'+_0x437f52[_0x194f('0x2f')][_0x194f('0x3b')]+'%'};return _0x317310;})});}_0x329a65=_[_0x194f('0x3c')]({},_0x329a65,_0x437f52[_0x194f('0x3e')]);return _0x195c64[_0x194f('0x4d')](_0x329a65);}})[_0x194f('0x24')](function(_0x3842a0){if(_0x3842a0){_0x3bcef6=_0x3842a0[_0x194f('0x34')];if(!_0x437f52[_0x194f('0x2f')][_0x194f('0x35')](_0x194f('0x36'))){_0x329a65[_0x194f('0x1e')]=qs[_0x194f('0x1e')](_0x437f52[_0x194f('0x2f')][_0x194f('0x1e')]);_0x329a65[_0x194f('0x1c')]=qs[_0x194f('0x1c')](_0x437f52[_0x194f('0x2f')][_0x194f('0x1c')]);}return _0x195c64[_0x194f('0x4d')](_0x329a65);}})[_0x194f('0x24')](function(_0x2dbdce){if(_0x2dbdce){return _0x2dbdce?{'count':_0x3bcef6,'rows':_0x2dbdce}:null;}})[_0x194f('0x24')](respondWithResult(_0x27241e,null))['catch'](handleError(_0x27241e,null));};exports[_0x194f('0x4e')]=function(_0xaf471f,_0x26bf8b,_0x4da4b2){var _0x4f5cac={};var _0x25e70f={};var _0xd4d95c;var _0x470580;return db[_0x194f('0x2a')]['findOne']({'where':{'id':_0xaf471f[_0x194f('0x45')]['id']}})['then'](handleEntityNotFound(_0x26bf8b,null))['then'](function(_0xd205c6){if(_0xd205c6){_0xd4d95c=_0xd205c6;_0x25e70f[_0x194f('0x2e')]=_['keys'](db[_0x194f('0x4c')]['rawAttributes']);_0x25e70f[_0x194f('0x2f')]=_[_0x194f('0x46')](_0xaf471f[_0x194f('0x2f')]);_0x25e70f['filters']=_[_0x194f('0x31')](_0x25e70f[_0x194f('0x2e')],_0x25e70f['query']);_0x4f5cac[_0x194f('0x32')]=_[_0x194f('0x31')](_0x25e70f[_0x194f('0x2e')],qs['fields'](_0xaf471f['query']['fields']));_0x4f5cac[_0x194f('0x32')]=_0x4f5cac['attributes'][_0x194f('0x34')]?_0x4f5cac['attributes']:_0x25e70f['model'];_0x4f5cac[_0x194f('0x37')]=qs[_0x194f('0x38')](_0xaf471f['query'][_0x194f('0x38')]);_0x4f5cac[_0x194f('0x39')]=qs[_0x194f('0x30')](_[_0x194f('0x3a')](_0xaf471f['query'],_0x25e70f[_0x194f('0x30')]));if(_0xaf471f[_0x194f('0x2f')][_0x194f('0x3b')]){_0x4f5cac[_0x194f('0x39')]=_[_0x194f('0x3c')](_0x4f5cac[_0x194f('0x39')],{'$or':_[_0x194f('0x29')](_0x4f5cac[_0x194f('0x32')],function(_0x3447c8){var _0x36b9b1={};_0x36b9b1[_0x3447c8]={'$like':'%'+_0xaf471f['query'][_0x194f('0x3b')]+'%'};return _0x36b9b1;})});}_0x4f5cac=_[_0x194f('0x3c')]({},_0x4f5cac,_0xaf471f[_0x194f('0x3e')]);return _0xd4d95c[_0x194f('0x4e')](_0x4f5cac);}})[_0x194f('0x24')](function(_0x4a6764){if(_0x4a6764){_0x470580=_0x4a6764[_0x194f('0x34')];if(!_0xaf471f[_0x194f('0x2f')][_0x194f('0x35')]('nolimit')){_0x4f5cac[_0x194f('0x1e')]=qs[_0x194f('0x1e')](_0xaf471f[_0x194f('0x2f')][_0x194f('0x1e')]);_0x4f5cac[_0x194f('0x1c')]=qs['offset'](_0xaf471f[_0x194f('0x2f')]['offset']);}return _0xd4d95c[_0x194f('0x4e')](_0x4f5cac);}})[_0x194f('0x24')](function(_0x40d8a9){if(_0x40d8a9){return _0x40d8a9?{'count':_0x470580,'rows':_0x40d8a9}:null;}})['then'](respondWithResult(_0x26bf8b,null))[_0x194f('0x43')](handleError(_0x26bf8b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a5daffc..ab55782 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 _0xe182=['int_sugarcrm_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x15627a,_0x20646f){var _0x1e82c5=function(_0x200da2){while(--_0x200da2){_0x15627a['push'](_0x15627a['shift']());}};_0x1e82c5(++_0x20646f);}(_0xe182,0x175));var _0x2e18=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xe182[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x2e18('0x0'));var util=require(_0x2e18('0x1'));var logger=require('../../config/logger')(_0x2e18('0x2'));var moment=require('moment');var BPromise=require(_0x2e18('0x3'));var rp=require(_0x2e18('0x4'));var fs=require('fs');var path=require(_0x2e18('0x5'));var rimraf=require(_0x2e18('0x6'));var config=require(_0x2e18('0x7'));var attributes=require(_0x2e18('0x8'));module[_0x2e18('0x9')]=function(_0x1685ec,_0x193208){return _0x1685ec['define'](_0x2e18('0xa'),attributes,{'tableName':_0x2e18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b69=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x891b81,_0xfbb107){var _0x585932=function(_0x18e04d){while(--_0x18e04d){_0x891b81['push'](_0x891b81['shift']());}};_0x585932(++_0xfbb107);}(_0x4b69,0xb8));var _0x94b6=function(_0x4f0ff1,_0x21932a){_0x4f0ff1=_0x4f0ff1-0x0;var _0x19c273=_0x4b69[_0x4f0ff1];return _0x19c273;};'use strict';var _=require(_0x94b6('0x0'));var util=require('util');var logger=require(_0x94b6('0x1'))(_0x94b6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x94b6('0x3'));var fs=require('fs');var path=require(_0x94b6('0x4'));var rimraf=require(_0x94b6('0x5'));var config=require(_0x94b6('0x6'));var attributes=require(_0x94b6('0x7'));module[_0x94b6('0x8')]=function(_0xe3571d,_0x4fa8bd){return _0xe3571d[_0x94b6('0x9')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index dc57cb6..cb78c44 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 _0x568a=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x523cc7,_0x34b3d0){var _0x268b8b=function(_0x26d073){while(--_0x26d073){_0x523cc7['push'](_0x523cc7['shift']());}};_0x268b8b(++_0x34b3d0);}(_0x568a,0x8a));var _0xa568=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x568a[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0xa568('0x0'));var moment=require(_0xa568('0x1'));var BPromise=require(_0xa568('0x2'));var rs=require(_0xa568('0x3'));var fs=require('fs');var Redis=require(_0xa568('0x4'));var db=require(_0xa568('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa568('0x6'))('rpc');var config=require(_0xa568('0x7'));var jayson=require(_0xa568('0x8'));var client=jayson['client'][_0xa568('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d8c15,_0x5613a8,_0xc8a978){return new BPromise(function(_0x1f1629,_0x217c77){return client[_0xa568('0xa')](_0x7d8c15,_0xc8a978)[_0xa568('0xb')](function(_0xcd0db4){logger[_0xa568('0xc')](_0xa568('0xd'),_0x5613a8,_0xa568('0xe'));logger[_0xa568('0xf')](_0xa568('0x10'),_0x5613a8,_0xa568('0xe'),JSON[_0xa568('0x11')](_0xcd0db4));if(_0xcd0db4[_0xa568('0x12')]){if(_0xcd0db4[_0xa568('0x12')]['code']===0x1f4){logger[_0xa568('0x12')](_0xa568('0xd'),_0x5613a8,_0xcd0db4[_0xa568('0x12')][_0xa568('0x13')]);return _0x217c77(_0xcd0db4[_0xa568('0x12')]['message']);}logger[_0xa568('0x12')](_0xa568('0xd'),_0x5613a8,_0xcd0db4[_0xa568('0x12')][_0xa568('0x13')]);return _0x1f1629(_0xcd0db4[_0xa568('0x12')][_0xa568('0x13')]);}else{logger[_0xa568('0xc')](_0xa568('0xd'),_0x5613a8,_0xa568('0xe'));_0x1f1629(_0xcd0db4[_0xa568('0x14')]['message']);}})['catch'](function(_0x553170){logger[_0xa568('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5613a8,_0x553170);_0x217c77(_0x553170);});});} \ No newline at end of file +var _0x32d2=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x32d2,0x110));var _0x232d=function(_0x3cf228,_0x1c5598){_0x3cf228=_0x3cf228-0x0;var _0x4888d2=_0x32d2[_0x3cf228];return _0x4888d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x232d('0x0'));var rs=require(_0x232d('0x1'));var fs=require('fs');var Redis=require(_0x232d('0x2'));var db=require(_0x232d('0x3'))['db'];var utils=require(_0x232d('0x4'));var logger=require('../../config/logger')(_0x232d('0x5'));var config=require(_0x232d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x232d('0x7')][_0x232d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35be29,_0x2af2c1,_0x2c7c4e){return new BPromise(function(_0x27bd3a,_0x57e53b){return client[_0x232d('0x9')](_0x35be29,_0x2c7c4e)[_0x232d('0xa')](function(_0x253d1c){logger[_0x232d('0xb')](_0x232d('0xc'),_0x2af2c1,_0x232d('0xd'));logger[_0x232d('0xe')](_0x232d('0xf'),_0x2af2c1,_0x232d('0xd'),JSON[_0x232d('0x10')](_0x253d1c));if(_0x253d1c[_0x232d('0x11')]){if(_0x253d1c[_0x232d('0x11')][_0x232d('0x12')]===0x1f4){logger['error'](_0x232d('0xc'),_0x2af2c1,_0x253d1c[_0x232d('0x11')][_0x232d('0x13')]);return _0x57e53b(_0x253d1c['error']['message']);}logger[_0x232d('0x11')](_0x232d('0xc'),_0x2af2c1,_0x253d1c[_0x232d('0x11')]['message']);return _0x27bd3a(_0x253d1c[_0x232d('0x11')][_0x232d('0x13')]);}else{logger['info'](_0x232d('0xc'),_0x2af2c1,_0x232d('0xd'));_0x27bd3a(_0x253d1c[_0x232d('0x14')][_0x232d('0x13')]);}})['catch'](function(_0x2471c2){logger[_0x232d('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2af2c1,_0x2471c2);_0x57e53b(_0x2471c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index bd423ff..73c7cf4 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 _0x0ea2=['destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0ea2,0x1b5));var _0x20ea=function(_0x2fd7fb,_0x32afad){_0x2fd7fb=_0x2fd7fb-0x0;var _0x15bf0a=_0x0ea2[_0x2fd7fb];return _0x15bf0a;};'use strict';var multer=require('multer');var util=require(_0x20ea('0x0'));var path=require(_0x20ea('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x20ea('0x2'));var auth=require(_0x20ea('0x3'));var interaction=require(_0x20ea('0x4'));var config=require(_0x20ea('0x5'));var controller=require(_0x20ea('0x6'));router[_0x20ea('0x7')]('/',auth[_0x20ea('0x8')](),controller['index']);router['get']('/:id',auth[_0x20ea('0x8')](),controller[_0x20ea('0x9')]);router[_0x20ea('0xa')]('/',auth[_0x20ea('0x8')](),controller[_0x20ea('0xb')]);router['put'](_0x20ea('0xc'),auth[_0x20ea('0x8')](),controller['update']);router['delete'](_0x20ea('0xc'),auth['isAuthenticated'](),controller[_0x20ea('0xd')]);module[_0x20ea('0xe')]=router; \ No newline at end of file +var _0x2a65=['isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x14cef5,_0x5453fd){var _0x30b61b=function(_0x4301e2){while(--_0x4301e2){_0x14cef5['push'](_0x14cef5['shift']());}};_0x30b61b(++_0x5453fd);}(_0x2a65,0x8e));var _0x52a6=function(_0x1f34d3,_0x3e2bb7){_0x1f34d3=_0x1f34d3-0x0;var _0x42313a=_0x2a65[_0x1f34d3];return _0x42313a;};'use strict';var multer=require('multer');var util=require(_0x52a6('0x0'));var path=require(_0x52a6('0x1'));var timeout=require(_0x52a6('0x2'));var express=require('express');var router=express[_0x52a6('0x3')]();var fs_extra=require(_0x52a6('0x4'));var auth=require(_0x52a6('0x5'));var interaction=require(_0x52a6('0x6'));var config=require(_0x52a6('0x7'));var controller=require(_0x52a6('0x8'));router[_0x52a6('0x9')]('/',auth[_0x52a6('0xa')](),controller[_0x52a6('0xb')]);router[_0x52a6('0x9')]('/:id',auth[_0x52a6('0xa')](),controller['show']);router[_0x52a6('0xc')]('/',auth[_0x52a6('0xa')](),controller['create']);router[_0x52a6('0xd')](_0x52a6('0xe'),auth[_0x52a6('0xa')](),controller[_0x52a6('0xf')]);router[_0x52a6('0x10')](_0x52a6('0xe'),auth[_0x52a6('0xa')](),controller[_0x52a6('0x11')]);module[_0x52a6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 98028b9..4429f99 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 _0xd7d2=['STRING','customVariable','BOOLEAN','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x11085,_0x38da5f){var _0x762b03=function(_0x43d187){while(--_0x43d187){_0x11085['push'](_0x11085['shift']());}};_0x762b03(++_0x38da5f);}(_0xd7d2,0x8a));var _0x2d7d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd7d2[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x2d7d('0x0')]={'type':{'type':Sequelize[_0x2d7d('0x1')]('string',_0x2d7d('0x2'),'customVariable',_0x2d7d('0x3'),_0x2d7d('0x4')),'defaultValue':_0x2d7d('0x5')},'content':{'type':Sequelize[_0x2d7d('0x6')]},'key':{'type':Sequelize[_0x2d7d('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x2d7d('0x5'),_0x2d7d('0x2'),_0x2d7d('0x7'))},'keyContent':{'type':Sequelize[_0x2d7d('0x6')]},'idField':{'type':Sequelize[_0x2d7d('0x6')]},'nameField':{'type':Sequelize[_0x2d7d('0x6')]},'customField':{'type':Sequelize[_0x2d7d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa74a=['customVariable','keyValue','picklist','string','STRING','ENUM','sequelize','exports','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa74a,0x138));var _0xaa74=function(_0x4f7c83,_0x307a3c){_0x4f7c83=_0x4f7c83-0x0;var _0x92969d=_0xa74a[_0x4f7c83];return _0x92969d;};'use strict';var Sequelize=require(_0xaa74('0x0'));module[_0xaa74('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xaa74('0x2'),_0xaa74('0x3'),_0xaa74('0x4'),_0xaa74('0x5')),'defaultValue':_0xaa74('0x6')},'content':{'type':Sequelize[_0xaa74('0x7')]},'key':{'type':Sequelize[_0xaa74('0x7')]},'keyType':{'type':Sequelize[_0xaa74('0x8')](_0xaa74('0x6'),_0xaa74('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xaa74('0x7')]},'idField':{'type':Sequelize[_0xaa74('0x7')]},'nameField':{'type':Sequelize[_0xaa74('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index cb4df38..4754941 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 _0x1e43=['SugarcrmField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map'];(function(_0x2f1689,_0x2c98da){var _0x5c87bf=function(_0x37cbaa){while(--_0x37cbaa){_0x2f1689['push'](_0x2f1689['shift']());}};_0x5c87bf(++_0x2c98da);}(_0x1e43,0xe7));var _0x31e4=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x1e43[_0x1c34e7];return _0x378cb1;};'use strict';var emlformat=require(_0x31e4('0x0'));var rimraf=require(_0x31e4('0x1'));var zipdir=require(_0x31e4('0x2'));var jsonpatch=require(_0x31e4('0x3'));var rp=require('request-promise');var moment=require(_0x31e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31e4('0x5'));var util=require('util');var path=require(_0x31e4('0x6'));var sox=require('sox');var csv=require(_0x31e4('0x7'));var ejs=require(_0x31e4('0x8'));var fs=require('fs');var fs_extra=require(_0x31e4('0x9'));var _=require(_0x31e4('0xa'));var squel=require('squel');var crypto=require(_0x31e4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x31e4('0xc'));var toCsv=require(_0x31e4('0x7'));var querystring=require('querystring');var Papa=require(_0x31e4('0xd'));var Redis=require(_0x31e4('0xe'));var authService=require(_0x31e4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x31e4('0x10'));var hardwareService=require(_0x31e4('0x11'));var logger=require(_0x31e4('0x12'))(_0x31e4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x31e4('0x14'));var db=require(_0x31e4('0x15'))['db'];function respondWithStatusCode(_0x5ccd7f,_0x28ce9a){_0x28ce9a=_0x28ce9a||0xcc;return function(_0x2361d5){if(_0x2361d5){return _0x5ccd7f['sendStatus'](_0x28ce9a);}return _0x5ccd7f[_0x31e4('0x16')](_0x28ce9a)[_0x31e4('0x17')]();};}function respondWithResult(_0x25d5f9,_0x5c53f9){_0x5c53f9=_0x5c53f9||0xc8;return function(_0xf330c8){if(_0xf330c8){return _0x25d5f9[_0x31e4('0x16')](_0x5c53f9)[_0x31e4('0x18')](_0xf330c8);}};}function respondWithFilteredResult(_0xf9bf38,_0x187a19){return function(_0x676013){if(_0x676013){var _0xf22fad=typeof _0x187a19[_0x31e4('0x19')]===_0x31e4('0x1a')&&typeof _0x187a19[_0x31e4('0x1b')]===_0x31e4('0x1a');var _0x54d90a=_0x676013[_0x31e4('0x1c')];var _0x493379=_0xf22fad?0x0:_0x187a19['offset'];var _0x48abdc=_0xf22fad?_0x676013['count']:_0x187a19['offset']+_0x187a19[_0x31e4('0x1b')];var _0x337907;if(_0x48abdc>=_0x54d90a){_0x48abdc=_0x54d90a;_0x337907=0xc8;}else{_0x337907=0xce;}_0xf9bf38[_0x31e4('0x16')](_0x337907);return _0xf9bf38['set'](_0x31e4('0x1d'),_0x493379+'-'+_0x48abdc+'/'+_0x54d90a)[_0x31e4('0x18')](_0x676013);}return null;};}function patchUpdates(_0x236296){return function(_0x586f66){try{jsonpatch[_0x31e4('0x1e')](_0x586f66,_0x236296,!![]);}catch(_0x404ba4){return BPromise[_0x31e4('0x1f')](_0x404ba4);}return _0x586f66['save']();};}function saveUpdates(_0x2ac537,_0x90161){return function(_0x4cfeb3){if(_0x4cfeb3){return _0x4cfeb3[_0x31e4('0x20')](_0x2ac537)[_0x31e4('0x21')](function(_0x58d67a){return _0x58d67a;});}return null;};}function removeEntity(_0x573708,_0x11dd06){return function(_0x12bd33){if(_0x12bd33){return _0x12bd33[_0x31e4('0x22')]()[_0x31e4('0x21')](function(){_0x573708[_0x31e4('0x16')](0xcc)[_0x31e4('0x17')]();});}};}function handleEntityNotFound(_0x327b43,_0x232503){return function(_0x28abb2){if(!_0x28abb2){_0x327b43[_0x31e4('0x23')](0x194);}return _0x28abb2;};}function handleError(_0x1b66a7,_0x2dbbe3){_0x2dbbe3=_0x2dbbe3||0x1f4;return function(_0x4422a1){logger[_0x31e4('0x24')](_0x4422a1['stack']);if(_0x4422a1[_0x31e4('0x25')]){delete _0x4422a1['name'];}_0x1b66a7[_0x31e4('0x16')](_0x2dbbe3)[_0x31e4('0x26')](_0x4422a1);};}exports[_0x31e4('0x27')]=function(_0x3a26a3,_0x1c8bfb){var _0x52ac1f={},_0x1e989c={},_0x3c982e={'count':0x0,'rows':[]};var _0x46d249=_[_0x31e4('0x28')](db[_0x31e4('0x29')][_0x31e4('0x2a')],function(_0x1aee12){return{'name':_0x1aee12[_0x31e4('0x2b')],'type':_0x1aee12['type'][_0x31e4('0x2c')]};});_0x1e989c[_0x31e4('0x2d')]=_[_0x31e4('0x28')](_0x46d249,'name');_0x1e989c[_0x31e4('0x2e')]=_[_0x31e4('0x2f')](_0x3a26a3['query']);_0x1e989c['filters']=_['intersection'](_0x1e989c[_0x31e4('0x2d')],_0x1e989c['query']);_0x52ac1f[_0x31e4('0x30')]=_[_0x31e4('0x31')](_0x1e989c['model'],qs['fields'](_0x3a26a3[_0x31e4('0x2e')][_0x31e4('0x32')]));_0x52ac1f['attributes']=_0x52ac1f[_0x31e4('0x30')]['length']?_0x52ac1f[_0x31e4('0x30')]:_0x1e989c['model'];if(!_0x3a26a3['query'][_0x31e4('0x33')]('nolimit')){_0x52ac1f[_0x31e4('0x1b')]=qs['limit'](_0x3a26a3['query'][_0x31e4('0x1b')]);_0x52ac1f[_0x31e4('0x19')]=qs[_0x31e4('0x19')](_0x3a26a3[_0x31e4('0x2e')][_0x31e4('0x19')]);}_0x52ac1f['order']=qs[_0x31e4('0x34')](_0x3a26a3[_0x31e4('0x2e')]['sort']);_0x52ac1f[_0x31e4('0x35')]=qs[_0x31e4('0x36')](_['pick'](_0x3a26a3[_0x31e4('0x2e')],_0x1e989c[_0x31e4('0x36')]),_0x46d249);if(_0x3a26a3[_0x31e4('0x2e')]['filter']){_0x52ac1f[_0x31e4('0x35')]=_[_0x31e4('0x37')](_0x52ac1f[_0x31e4('0x35')],{'$or':_['map'](_0x46d249,function(_0x172858){if(_0x172858[_0x31e4('0x38')]!=='VIRTUAL'){var _0x3a5e04={};_0x3a5e04[_0x172858['name']]={'$like':'%'+_0x3a26a3['query'][_0x31e4('0x39')]+'%'};return _0x3a5e04;}})});}_0x52ac1f=_['merge']({},_0x52ac1f,_0x3a26a3[_0x31e4('0x3a')]);var _0x24c9e3={'where':_0x52ac1f[_0x31e4('0x35')]};return db['SugarcrmField'][_0x31e4('0x1c')](_0x24c9e3)[_0x31e4('0x21')](function(_0x2f7b31){_0x3c982e['count']=_0x2f7b31;if(_0x3a26a3[_0x31e4('0x2e')][_0x31e4('0x3b')]){_0x52ac1f[_0x31e4('0x3c')]=[{'all':!![]}];}return db[_0x31e4('0x29')][_0x31e4('0x3d')](_0x52ac1f);})['then'](function(_0x3b9427){_0x3c982e[_0x31e4('0x3e')]=_0x3b9427;return _0x3c982e;})[_0x31e4('0x21')](respondWithFilteredResult(_0x1c8bfb,_0x52ac1f))[_0x31e4('0x3f')](handleError(_0x1c8bfb,null));};exports[_0x31e4('0x40')]=function(_0x204128,_0x4cb60d){var _0x4b81db={'raw':!![],'where':{'id':_0x204128[_0x31e4('0x41')]['id']}},_0x468abe={};_0x468abe[_0x31e4('0x2d')]=_['keys'](db[_0x31e4('0x29')][_0x31e4('0x2a')]);_0x468abe[_0x31e4('0x2e')]=_['keys'](_0x204128[_0x31e4('0x2e')]);_0x468abe[_0x31e4('0x36')]=_[_0x31e4('0x31')](_0x468abe[_0x31e4('0x2d')],_0x468abe[_0x31e4('0x2e')]);_0x4b81db[_0x31e4('0x30')]=_[_0x31e4('0x31')](_0x468abe[_0x31e4('0x2d')],qs[_0x31e4('0x32')](_0x204128[_0x31e4('0x2e')][_0x31e4('0x32')]));_0x4b81db[_0x31e4('0x30')]=_0x4b81db[_0x31e4('0x30')]['length']?_0x4b81db[_0x31e4('0x30')]:_0x468abe[_0x31e4('0x2d')];if(_0x204128[_0x31e4('0x2e')]['includeAll']){_0x4b81db[_0x31e4('0x3c')]=[{'all':!![]}];}_0x4b81db=_['merge']({},_0x4b81db,_0x204128[_0x31e4('0x3a')]);return db['SugarcrmField'][_0x31e4('0x42')](_0x4b81db)[_0x31e4('0x21')](handleEntityNotFound(_0x4cb60d,null))['then'](respondWithResult(_0x4cb60d,null))['catch'](handleError(_0x4cb60d,null));};exports['create']=function(_0xea37a3,_0x21cae3){return db[_0x31e4('0x29')]['create'](_0xea37a3[_0x31e4('0x43')],{})[_0x31e4('0x21')](respondWithResult(_0x21cae3,0xc9))[_0x31e4('0x3f')](handleError(_0x21cae3,null));};exports['update']=function(_0x50b140,_0x4e86ad){if(_0x50b140[_0x31e4('0x43')]['id']){delete _0x50b140[_0x31e4('0x43')]['id'];}return db[_0x31e4('0x29')][_0x31e4('0x42')]({'where':{'id':_0x50b140[_0x31e4('0x41')]['id']}})[_0x31e4('0x21')](handleEntityNotFound(_0x4e86ad,null))[_0x31e4('0x21')](saveUpdates(_0x50b140[_0x31e4('0x43')],null))[_0x31e4('0x21')](respondWithResult(_0x4e86ad,null))[_0x31e4('0x3f')](handleError(_0x4e86ad,null));};exports[_0x31e4('0x22')]=function(_0x3c421b,_0x306ac6){return db['SugarcrmField'][_0x31e4('0x42')]({'where':{'id':_0x3c421b['params']['id']}})['then'](handleEntityNotFound(_0x306ac6,null))[_0x31e4('0x21')](removeEntity(_0x306ac6,null))['catch'](handleError(_0x306ac6,null));}; \ No newline at end of file +var _0x0e1c=['type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','create','body','find','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x0e1c,0x101));var _0xc0e1=function(_0x226d13,_0x3fdcd9){_0x226d13=_0x226d13-0x0;var _0x550533=_0x0e1c[_0x226d13];return _0x550533;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0e1('0x0'));var zipdir=require(_0xc0e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0e1('0x2'));var moment=require(_0xc0e1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc0e1('0x4'));var util=require(_0xc0e1('0x5'));var path=require(_0xc0e1('0x6'));var sox=require(_0xc0e1('0x7'));var csv=require(_0xc0e1('0x8'));var ejs=require(_0xc0e1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0e1('0xa'));var squel=require(_0xc0e1('0xb'));var crypto=require(_0xc0e1('0xc'));var jsforce=require(_0xc0e1('0xd'));var deskjs=require(_0xc0e1('0xe'));var toCsv=require(_0xc0e1('0x8'));var querystring=require(_0xc0e1('0xf'));var Papa=require(_0xc0e1('0x10'));var Redis=require(_0xc0e1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0e1('0x12'));var as=require(_0xc0e1('0x13'));var hardwareService=require(_0xc0e1('0x14'));var logger=require(_0xc0e1('0x15'))('api');var utils=require(_0xc0e1('0x16'));var config=require(_0xc0e1('0x17'));var licenseUtil=require(_0xc0e1('0x18'));var db=require(_0xc0e1('0x19'))['db'];function respondWithStatusCode(_0x207aac,_0xa20657){_0xa20657=_0xa20657||0xcc;return function(_0xff1bbf){if(_0xff1bbf){return _0x207aac[_0xc0e1('0x1a')](_0xa20657);}return _0x207aac[_0xc0e1('0x1b')](_0xa20657)['end']();};}function respondWithResult(_0x37b8fb,_0xe768ad){_0xe768ad=_0xe768ad||0xc8;return function(_0x511563){if(_0x511563){return _0x37b8fb[_0xc0e1('0x1b')](_0xe768ad)[_0xc0e1('0x1c')](_0x511563);}};}function respondWithFilteredResult(_0x4ed85b,_0x595db1){return function(_0x57e727){if(_0x57e727){var _0x41dd66=typeof _0x595db1[_0xc0e1('0x1d')]===_0xc0e1('0x1e')&&typeof _0x595db1[_0xc0e1('0x1f')]===_0xc0e1('0x1e');var _0x3f4048=_0x57e727['count'];var _0x1fc0ab=_0x41dd66?0x0:_0x595db1[_0xc0e1('0x1d')];var _0x5a1f44=_0x41dd66?_0x57e727[_0xc0e1('0x20')]:_0x595db1[_0xc0e1('0x1d')]+_0x595db1['limit'];var _0x4010d0;if(_0x5a1f44>=_0x3f4048){_0x5a1f44=_0x3f4048;_0x4010d0=0xc8;}else{_0x4010d0=0xce;}_0x4ed85b[_0xc0e1('0x1b')](_0x4010d0);return _0x4ed85b[_0xc0e1('0x21')](_0xc0e1('0x22'),_0x1fc0ab+'-'+_0x5a1f44+'/'+_0x3f4048)[_0xc0e1('0x1c')](_0x57e727);}return null;};}function patchUpdates(_0x470bc5){return function(_0x1aaa7d){try{jsonpatch['apply'](_0x1aaa7d,_0x470bc5,!![]);}catch(_0x8aa294){return BPromise['reject'](_0x8aa294);}return _0x1aaa7d['save']();};}function saveUpdates(_0x309c04,_0xccf42){return function(_0x1c1dd1){if(_0x1c1dd1){return _0x1c1dd1[_0xc0e1('0x23')](_0x309c04)[_0xc0e1('0x24')](function(_0x7f782){return _0x7f782;});}return null;};}function removeEntity(_0x219aab,_0x107fd0){return function(_0x59d6fa){if(_0x59d6fa){return _0x59d6fa[_0xc0e1('0x25')]()[_0xc0e1('0x24')](function(){_0x219aab[_0xc0e1('0x1b')](0xcc)[_0xc0e1('0x26')]();});}};}function handleEntityNotFound(_0x5e3dcc,_0x4c3dac){return function(_0x163af6){if(!_0x163af6){_0x5e3dcc[_0xc0e1('0x1a')](0x194);}return _0x163af6;};}function handleError(_0x9171ac,_0x4a3bac){_0x4a3bac=_0x4a3bac||0x1f4;return function(_0x4badc6){logger[_0xc0e1('0x27')](_0x4badc6[_0xc0e1('0x28')]);if(_0x4badc6[_0xc0e1('0x29')]){delete _0x4badc6[_0xc0e1('0x29')];}_0x9171ac[_0xc0e1('0x1b')](_0x4a3bac)['send'](_0x4badc6);};}exports[_0xc0e1('0x2a')]=function(_0x19ecb8,_0x1f4632){var _0x1a072f={},_0x361bcd={},_0x178afd={'count':0x0,'rows':[]};var _0x284e9e=_[_0xc0e1('0x2b')](db[_0xc0e1('0x2c')][_0xc0e1('0x2d')],function(_0x50a028){return{'name':_0x50a028[_0xc0e1('0x2e')],'type':_0x50a028[_0xc0e1('0x2f')][_0xc0e1('0x30')]};});_0x361bcd[_0xc0e1('0x31')]=_[_0xc0e1('0x2b')](_0x284e9e,_0xc0e1('0x29'));_0x361bcd[_0xc0e1('0x32')]=_[_0xc0e1('0x33')](_0x19ecb8['query']);_0x361bcd[_0xc0e1('0x34')]=_[_0xc0e1('0x35')](_0x361bcd[_0xc0e1('0x31')],_0x361bcd['query']);_0x1a072f['attributes']=_[_0xc0e1('0x35')](_0x361bcd['model'],qs['fields'](_0x19ecb8[_0xc0e1('0x32')]['fields']));_0x1a072f['attributes']=_0x1a072f[_0xc0e1('0x36')][_0xc0e1('0x37')]?_0x1a072f[_0xc0e1('0x36')]:_0x361bcd[_0xc0e1('0x31')];if(!_0x19ecb8[_0xc0e1('0x32')][_0xc0e1('0x38')](_0xc0e1('0x39'))){_0x1a072f[_0xc0e1('0x1f')]=qs[_0xc0e1('0x1f')](_0x19ecb8['query'][_0xc0e1('0x1f')]);_0x1a072f['offset']=qs[_0xc0e1('0x1d')](_0x19ecb8[_0xc0e1('0x32')]['offset']);}_0x1a072f[_0xc0e1('0x3a')]=qs[_0xc0e1('0x3b')](_0x19ecb8['query'][_0xc0e1('0x3b')]);_0x1a072f[_0xc0e1('0x3c')]=qs[_0xc0e1('0x34')](_[_0xc0e1('0x3d')](_0x19ecb8[_0xc0e1('0x32')],_0x361bcd[_0xc0e1('0x34')]),_0x284e9e);if(_0x19ecb8[_0xc0e1('0x32')][_0xc0e1('0x3e')]){_0x1a072f[_0xc0e1('0x3c')]=_[_0xc0e1('0x3f')](_0x1a072f['where'],{'$or':_['map'](_0x284e9e,function(_0x4a323e){if(_0x4a323e[_0xc0e1('0x2f')]!=='VIRTUAL'){var _0x4f134b={};_0x4f134b[_0x4a323e['name']]={'$like':'%'+_0x19ecb8[_0xc0e1('0x32')][_0xc0e1('0x3e')]+'%'};return _0x4f134b;}})});}_0x1a072f=_[_0xc0e1('0x3f')]({},_0x1a072f,_0x19ecb8[_0xc0e1('0x40')]);var _0x48b41b={'where':_0x1a072f[_0xc0e1('0x3c')]};return db[_0xc0e1('0x2c')][_0xc0e1('0x20')](_0x48b41b)[_0xc0e1('0x24')](function(_0x5d3a41){_0x178afd['count']=_0x5d3a41;if(_0x19ecb8['query'][_0xc0e1('0x41')]){_0x1a072f['include']=[{'all':!![]}];}return db[_0xc0e1('0x2c')][_0xc0e1('0x42')](_0x1a072f);})[_0xc0e1('0x24')](function(_0x3448f6){_0x178afd[_0xc0e1('0x43')]=_0x3448f6;return _0x178afd;})[_0xc0e1('0x24')](respondWithFilteredResult(_0x1f4632,_0x1a072f))[_0xc0e1('0x44')](handleError(_0x1f4632,null));};exports[_0xc0e1('0x45')]=function(_0x28010c,_0x4d4a01){var _0x345590={'raw':!![],'where':{'id':_0x28010c[_0xc0e1('0x46')]['id']}},_0x5e2b9e={};_0x5e2b9e[_0xc0e1('0x31')]=_['keys'](db[_0xc0e1('0x2c')][_0xc0e1('0x2d')]);_0x5e2b9e[_0xc0e1('0x32')]=_[_0xc0e1('0x33')](_0x28010c[_0xc0e1('0x32')]);_0x5e2b9e[_0xc0e1('0x34')]=_[_0xc0e1('0x35')](_0x5e2b9e[_0xc0e1('0x31')],_0x5e2b9e[_0xc0e1('0x32')]);_0x345590['attributes']=_[_0xc0e1('0x35')](_0x5e2b9e['model'],qs[_0xc0e1('0x47')](_0x28010c[_0xc0e1('0x32')][_0xc0e1('0x47')]));_0x345590[_0xc0e1('0x36')]=_0x345590['attributes']['length']?_0x345590['attributes']:_0x5e2b9e[_0xc0e1('0x31')];if(_0x28010c[_0xc0e1('0x32')][_0xc0e1('0x41')]){_0x345590[_0xc0e1('0x48')]=[{'all':!![]}];}_0x345590=_['merge']({},_0x345590,_0x28010c['options']);return db[_0xc0e1('0x2c')]['find'](_0x345590)[_0xc0e1('0x24')](handleEntityNotFound(_0x4d4a01,null))[_0xc0e1('0x24')](respondWithResult(_0x4d4a01,null))[_0xc0e1('0x44')](handleError(_0x4d4a01,null));};exports[_0xc0e1('0x49')]=function(_0x5485fc,_0x50c459){return db[_0xc0e1('0x2c')][_0xc0e1('0x49')](_0x5485fc[_0xc0e1('0x4a')],{})[_0xc0e1('0x24')](respondWithResult(_0x50c459,0xc9))[_0xc0e1('0x44')](handleError(_0x50c459,null));};exports[_0xc0e1('0x23')]=function(_0x3cda76,_0x8fce12){if(_0x3cda76[_0xc0e1('0x4a')]['id']){delete _0x3cda76[_0xc0e1('0x4a')]['id'];}return db['SugarcrmField'][_0xc0e1('0x4b')]({'where':{'id':_0x3cda76[_0xc0e1('0x46')]['id']}})[_0xc0e1('0x24')](handleEntityNotFound(_0x8fce12,null))[_0xc0e1('0x24')](saveUpdates(_0x3cda76['body'],null))['then'](respondWithResult(_0x8fce12,null))[_0xc0e1('0x44')](handleError(_0x8fce12,null));};exports[_0xc0e1('0x25')]=function(_0x29ddf1,_0x41b13c){return db[_0xc0e1('0x2c')][_0xc0e1('0x4b')]({'where':{'id':_0x29ddf1[_0xc0e1('0x46')]['id']}})[_0xc0e1('0x24')](handleEntityNotFound(_0x41b13c,null))['then'](removeEntity(_0x41b13c,null))[_0xc0e1('0x44')](handleError(_0x41b13c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ecad5e8..5f94395 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 _0x4b9b=['../../config/environment','SugarcrmField','int_sugarcrm_fields','idField','util','../../config/logger','api','path','rimraf'];(function(_0x113240,_0x3fdd8f){var _0x22bd34=function(_0x43e4eb){while(--_0x43e4eb){_0x113240['push'](_0x113240['shift']());}};_0x22bd34(++_0x3fdd8f);}(_0x4b9b,0xaf));var _0xb4b9=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0x4b9b[_0xffd8b0];return _0x301ba0;};'use strict';var _=require('lodash');var util=require(_0xb4b9('0x0'));var logger=require(_0xb4b9('0x1'))(_0xb4b9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4b9('0x3'));var rimraf=require(_0xb4b9('0x4'));var config=require(_0xb4b9('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x1d2b65,_0x44f9e4){return _0x1d2b65['define'](_0xb4b9('0x6'),attributes,{'tableName':_0xb4b9('0x7'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xb4b9('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5716=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x5716,0x140));var _0x6571=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0x5716[_0x232ec0];return _0x356705;};'use strict';var _=require(_0x6571('0x0'));var util=require(_0x6571('0x1'));var logger=require(_0x6571('0x2'))(_0x6571('0x3'));var moment=require(_0x6571('0x4'));var BPromise=require(_0x6571('0x5'));var rp=require(_0x6571('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6571('0x7'));var config=require(_0x6571('0x8'));var attributes=require(_0x6571('0x9'));module['exports']=function(_0x594c7a,_0x21efed){return _0x594c7a[_0x6571('0xa')](_0x6571('0xb'),attributes,{'tableName':_0x6571('0xc'),'paranoid':![],'indexes':[{'name':_0x6571('0xd'),'fields':[_0x6571('0xe'),_0x6571('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index e5b077e..3e5e662 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 _0x91d0=['SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x784768,_0x3d0c75){var _0x3b76fc=function(_0x2fdce9){while(--_0x2fdce9){_0x784768['push'](_0x784768['shift']());}};_0x3b76fc(++_0x3d0c75);}(_0x91d0,0x159));var _0x091d=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x91d0[_0x1aa3fe];return _0x163cee;};'use strict';var _=require(_0x091d('0x0'));var util=require('util');var moment=require(_0x091d('0x1'));var BPromise=require(_0x091d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x091d('0x3'));var db=require(_0x091d('0x4'))['db'];var utils=require(_0x091d('0x5'));var logger=require('../../config/logger')(_0x091d('0x6'));var config=require(_0x091d('0x7'));var jayson=require(_0x091d('0x8'));var client=jayson[_0x091d('0x9')][_0x091d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4193c8,_0x290d15,_0x16d903){return new BPromise(function(_0x353ae6,_0x5227fc){return client['request'](_0x4193c8,_0x16d903)['then'](function(_0x1aec72){logger[_0x091d('0xb')](_0x091d('0xc'),_0x290d15,_0x091d('0xd'));logger['debug'](_0x091d('0xe'),_0x290d15,_0x091d('0xd'),JSON[_0x091d('0xf')](_0x1aec72));if(_0x1aec72[_0x091d('0x10')]){if(_0x1aec72[_0x091d('0x10')][_0x091d('0x11')]===0x1f4){logger['error'](_0x091d('0xc'),_0x290d15,_0x1aec72[_0x091d('0x10')][_0x091d('0x12')]);return _0x5227fc(_0x1aec72['error'][_0x091d('0x12')]);}logger[_0x091d('0x10')](_0x091d('0xc'),_0x290d15,_0x1aec72['error'][_0x091d('0x12')]);return _0x353ae6(_0x1aec72['error'][_0x091d('0x12')]);}else{logger['info'](_0x091d('0xc'),_0x290d15,_0x091d('0xd'));_0x353ae6(_0x1aec72[_0x091d('0x13')][_0x091d('0x12')]);}})[_0x091d('0x14')](function(_0x4161ff){logger[_0x091d('0x10')](_0x091d('0xc'),_0x290d15,_0x4161ff);_0x5227fc(_0x4161ff);});});} \ No newline at end of file +var _0xf36d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x42e4ca,_0x23a585){var _0x26788e=function(_0x50092c){while(--_0x50092c){_0x42e4ca['push'](_0x42e4ca['shift']());}};_0x26788e(++_0x23a585);}(_0xf36d,0x13a));var _0xdf36=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xf36d[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0xdf36('0x0'));var util=require(_0xdf36('0x1'));var moment=require(_0xdf36('0x2'));var BPromise=require(_0xdf36('0x3'));var rs=require(_0xdf36('0x4'));var fs=require('fs');var Redis=require(_0xdf36('0x5'));var db=require(_0xdf36('0x6'))['db'];var utils=require(_0xdf36('0x7'));var logger=require('../../config/logger')(_0xdf36('0x8'));var config=require(_0xdf36('0x9'));var jayson=require(_0xdf36('0xa'));var client=jayson[_0xdf36('0xb')][_0xdf36('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52ff40,_0xcff61a,_0x3e0df1){return new BPromise(function(_0x2da78a,_0xe9010c){return client[_0xdf36('0xd')](_0x52ff40,_0x3e0df1)[_0xdf36('0xe')](function(_0x2132e4){logger[_0xdf36('0xf')](_0xdf36('0x10'),_0xcff61a,_0xdf36('0x11'));logger[_0xdf36('0x12')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xcff61a,_0xdf36('0x11'),JSON['stringify'](_0x2132e4));if(_0x2132e4['error']){if(_0x2132e4[_0xdf36('0x13')]['code']===0x1f4){logger[_0xdf36('0x13')]('SugarcrmField,\x20%s,\x20%s',_0xcff61a,_0x2132e4['error'][_0xdf36('0x14')]);return _0xe9010c(_0x2132e4[_0xdf36('0x13')][_0xdf36('0x14')]);}logger[_0xdf36('0x13')](_0xdf36('0x10'),_0xcff61a,_0x2132e4[_0xdf36('0x13')][_0xdf36('0x14')]);return _0x2da78a(_0x2132e4[_0xdf36('0x13')][_0xdf36('0x14')]);}else{logger[_0xdf36('0xf')](_0xdf36('0x10'),_0xcff61a,_0xdf36('0x11'));_0x2da78a(_0x2132e4[_0xdf36('0x15')]['message']);}})[_0xdf36('0x16')](function(_0x42e5d1){logger[_0xdf36('0x13')](_0xdf36('0x10'),_0xcff61a,_0x42e5d1);_0xe9010c(_0x42e5d1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 060b35b..b64f736 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 _0xbe83=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','/:id','destroy','multer','path'];(function(_0x46f4aa,_0x393810){var _0x152a9a=function(_0x469abb){while(--_0x469abb){_0x46f4aa['push'](_0x46f4aa['shift']());}};_0x152a9a(++_0x393810);}(_0xbe83,0xee));var _0x3be8=function(_0x4c5384,_0x4a38dc){_0x4c5384=_0x4c5384-0x0;var _0x32093b=_0xbe83[_0x4c5384];return _0x32093b;};'use strict';var multer=require(_0x3be8('0x0'));var util=require('util');var path=require(_0x3be8('0x1'));var timeout=require(_0x3be8('0x2'));var express=require(_0x3be8('0x3'));var router=express[_0x3be8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3be8('0x5'));var interaction=require(_0x3be8('0x6'));var config=require(_0x3be8('0x7'));var controller=require(_0x3be8('0x8'));router['get']('/',auth[_0x3be8('0x9')](),controller[_0x3be8('0xa')]);router[_0x3be8('0xb')]('/:id',auth[_0x3be8('0x9')](),controller[_0x3be8('0xc')]);router[_0x3be8('0xb')](_0x3be8('0xd'),auth[_0x3be8('0x9')](),controller[_0x3be8('0xe')]);router[_0x3be8('0xb')]('/:id/fields',auth[_0x3be8('0x9')](),controller[_0x3be8('0xf')]);router['post']('/',auth[_0x3be8('0x9')](),controller[_0x3be8('0x10')]);router[_0x3be8('0x11')]('/:id/configurations',auth[_0x3be8('0x9')](),controller[_0x3be8('0x12')]);router[_0x3be8('0x13')]('/:id',auth[_0x3be8('0x9')](),controller[_0x3be8('0x14')]);router[_0x3be8('0x15')](_0x3be8('0x16'),auth[_0x3be8('0x9')](),controller[_0x3be8('0x17')]);module['exports']=router; \ No newline at end of file +var _0x92e8=['exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x837f30,_0x551b26){var _0x2aee22=function(_0x24e559){while(--_0x24e559){_0x837f30['push'](_0x837f30['shift']());}};_0x2aee22(++_0x551b26);}(_0x92e8,0x7f));var _0x892e=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0x92e8[_0x59f0dc];return _0x5b5445;};'use strict';var multer=require(_0x892e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x892e('0x1'));var express=require('express');var router=express[_0x892e('0x2')]();var fs_extra=require(_0x892e('0x3'));var auth=require(_0x892e('0x4'));var interaction=require(_0x892e('0x5'));var config=require(_0x892e('0x6'));var controller=require(_0x892e('0x7'));router['get']('/',auth[_0x892e('0x8')](),controller['index']);router[_0x892e('0x9')]('/:id',auth[_0x892e('0x8')](),controller['show']);router[_0x892e('0x9')](_0x892e('0xa'),auth[_0x892e('0x8')](),controller['getConfigurations']);router[_0x892e('0x9')](_0x892e('0xb'),auth[_0x892e('0x8')](),controller[_0x892e('0xc')]);router[_0x892e('0xd')]('/',auth['isAuthenticated'](),controller[_0x892e('0xe')]);router[_0x892e('0xd')](_0x892e('0xa'),auth['isAuthenticated'](),controller[_0x892e('0xf')]);router['put'](_0x892e('0x10'),auth[_0x892e('0x8')](),controller[_0x892e('0x11')]);router[_0x892e('0x12')](_0x892e('0x10'),auth[_0x892e('0x8')](),controller[_0x892e('0x13')]);module[_0x892e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 4527f8d..69a5d71 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 _0xdd27=['STRING','HelpDesk','sequelize','exports'];(function(_0x32e4db,_0x2cfce7){var _0x8f53e0=function(_0x34c0f2){while(--_0x34c0f2){_0x32e4db['push'](_0x32e4db['shift']());}};_0x8f53e0(++_0x2cfce7);}(_0xdd27,0x15a));var _0x7dd2=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0xdd27[_0x23ca4d];return _0x435432;};'use strict';var Sequelize=require(_0x7dd2('0x0'));module[_0x7dd2('0x1')]={'name':{'type':Sequelize[_0x7dd2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7dd2('0x2')]},'username':{'type':Sequelize[_0x7dd2('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7dd2('0x3')},'remoteUri':{'type':Sequelize[_0x7dd2('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7dd2('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7dd2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xea77=['STRING','HelpDesk','sequelize','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xea77,0x182));var _0x7ea7=function(_0x1b9bfe,_0x36fdb3){_0x1b9bfe=_0x1b9bfe-0x0;var _0x4dba33=_0xea77[_0x1b9bfe];return _0x4dba33;};'use strict';var Sequelize=require(_0x7ea7('0x0'));module[_0x7ea7('0x1')]={'name':{'type':Sequelize[_0x7ea7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7ea7('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7ea7('0x2')],'allowNull':![],'defaultValue':_0x7ea7('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7ea7('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b4598eb..e9fda02 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 _0x5d51=['getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','login','result','success','describe','sessionName','reference','owner','remove','includes','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','body','VtigerConfiguration','merge'];(function(_0x44bca6,_0x379091){var _0x30d244=function(_0x10d2f6){while(--_0x10d2f6){_0x44bca6['push'](_0x44bca6['shift']());}};_0x30d244(++_0x379091);}(_0x5d51,0x121));var _0x15d5=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5d51[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x15d5('0x0'));var rimraf=require(_0x15d5('0x1'));var zipdir=require(_0x15d5('0x2'));var jsonpatch=require(_0x15d5('0x3'));var rp=require(_0x15d5('0x4'));var moment=require('moment');var BPromise=require(_0x15d5('0x5'));var Mustache=require(_0x15d5('0x6'));var util=require('util');var path=require(_0x15d5('0x7'));var sox=require(_0x15d5('0x8'));var csv=require(_0x15d5('0x9'));var ejs=require(_0x15d5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15d5('0xb'));var squel=require(_0x15d5('0xc'));var crypto=require(_0x15d5('0xd'));var jsforce=require(_0x15d5('0xe'));var deskjs=require(_0x15d5('0xf'));var toCsv=require(_0x15d5('0x9'));var querystring=require(_0x15d5('0x10'));var Papa=require(_0x15d5('0x11'));var Redis=require('ioredis');var authService=require(_0x15d5('0x12'));var qs=require(_0x15d5('0x13'));var as=require(_0x15d5('0x14'));var hardwareService=require(_0x15d5('0x15'));var logger=require(_0x15d5('0x16'))(_0x15d5('0x17'));var utils=require('../../config/utils');var config=require(_0x15d5('0x18'));var licenseUtil=require(_0x15d5('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x15d5('0x1a'));function respondWithStatusCode(_0x4d79a0,_0x23b0fa){_0x23b0fa=_0x23b0fa||0xcc;return function(_0x1fc97c){if(_0x1fc97c){return _0x4d79a0[_0x15d5('0x1b')](_0x23b0fa);}return _0x4d79a0[_0x15d5('0x1c')](_0x23b0fa)[_0x15d5('0x1d')]();};}function respondWithResult(_0x5180e1,_0x580298){_0x580298=_0x580298||0xc8;return function(_0x36574e){if(_0x36574e){return _0x5180e1[_0x15d5('0x1c')](_0x580298)[_0x15d5('0x1e')](_0x36574e);}};}function respondWithFilteredResult(_0x1b4d20,_0x386af3){return function(_0x3d03f9){if(_0x3d03f9){var _0x576450=typeof _0x386af3[_0x15d5('0x1f')]===_0x15d5('0x20')&&typeof _0x386af3[_0x15d5('0x21')]===_0x15d5('0x20');var _0xb92a5b=_0x3d03f9[_0x15d5('0x22')];var _0xa1a173=_0x576450?0x0:_0x386af3[_0x15d5('0x1f')];var _0x2f78b8=_0x576450?_0x3d03f9[_0x15d5('0x22')]:_0x386af3[_0x15d5('0x1f')]+_0x386af3[_0x15d5('0x21')];var _0x468b5c;if(_0x2f78b8>=_0xb92a5b){_0x2f78b8=_0xb92a5b;_0x468b5c=0xc8;}else{_0x468b5c=0xce;}_0x1b4d20[_0x15d5('0x1c')](_0x468b5c);return _0x1b4d20['set']('Content-Range',_0xa1a173+'-'+_0x2f78b8+'/'+_0xb92a5b)['json'](_0x3d03f9);}return null;};}function patchUpdates(_0x5ba375){return function(_0x337b6c){try{jsonpatch['apply'](_0x337b6c,_0x5ba375,!![]);}catch(_0xed14a){return BPromise[_0x15d5('0x23')](_0xed14a);}return _0x337b6c[_0x15d5('0x24')]();};}function saveUpdates(_0x1fb7cb,_0x322e12){return function(_0x1704a1){if(_0x1704a1){return _0x1704a1[_0x15d5('0x25')](_0x1fb7cb)['then'](function(_0x1dfa2e){return _0x1dfa2e;});}return null;};}function removeEntity(_0x166d1f,_0x4b30c7){return function(_0x5e7b31){if(_0x5e7b31){return _0x5e7b31[_0x15d5('0x26')]()[_0x15d5('0x27')](function(){_0x166d1f[_0x15d5('0x1c')](0xcc)[_0x15d5('0x1d')]();});}};}function handleEntityNotFound(_0xfacf41,_0x19c246){return function(_0x175c10){if(!_0x175c10){_0xfacf41[_0x15d5('0x1b')](0x194);}return _0x175c10;};}function handleError(_0x5d301e,_0x2518fc){_0x2518fc=_0x2518fc||0x1f4;return function(_0x308ec8){logger[_0x15d5('0x28')](_0x308ec8[_0x15d5('0x29')]);if(_0x308ec8['name']){delete _0x308ec8[_0x15d5('0x2a')];}_0x5d301e[_0x15d5('0x1c')](_0x2518fc)[_0x15d5('0x2b')](_0x308ec8);};}exports[_0x15d5('0x2c')]=function(_0x3f40e3,_0x508d92){var _0x11769b={},_0x551a76={},_0x57fece={'count':0x0,'rows':[]};var _0x5a46d3=_['map'](db[_0x15d5('0x2d')][_0x15d5('0x2e')],function(_0x17de2b){return{'name':_0x17de2b[_0x15d5('0x2f')],'type':_0x17de2b[_0x15d5('0x30')][_0x15d5('0x31')]};});_0x551a76[_0x15d5('0x32')]=_[_0x15d5('0x33')](_0x5a46d3,_0x15d5('0x2a'));_0x551a76['query']=_['keys'](_0x3f40e3[_0x15d5('0x34')]);_0x551a76[_0x15d5('0x35')]=_['intersection'](_0x551a76[_0x15d5('0x32')],_0x551a76[_0x15d5('0x34')]);_0x11769b[_0x15d5('0x36')]=_[_0x15d5('0x37')](_0x551a76[_0x15d5('0x32')],qs['fields'](_0x3f40e3[_0x15d5('0x34')]['fields']));_0x11769b['attributes']=_0x11769b[_0x15d5('0x36')][_0x15d5('0x38')]?_0x11769b['attributes']:_0x551a76[_0x15d5('0x32')];if(!_0x3f40e3[_0x15d5('0x34')][_0x15d5('0x39')](_0x15d5('0x3a'))){_0x11769b[_0x15d5('0x21')]=qs[_0x15d5('0x21')](_0x3f40e3[_0x15d5('0x34')][_0x15d5('0x21')]);_0x11769b['offset']=qs[_0x15d5('0x1f')](_0x3f40e3['query'][_0x15d5('0x1f')]);}_0x11769b[_0x15d5('0x3b')]=qs[_0x15d5('0x3c')](_0x3f40e3[_0x15d5('0x34')][_0x15d5('0x3c')]);_0x11769b[_0x15d5('0x3d')]=qs[_0x15d5('0x35')](_[_0x15d5('0x3e')](_0x3f40e3['query'],_0x551a76[_0x15d5('0x35')]),_0x5a46d3);if(_0x3f40e3['query'][_0x15d5('0x3f')]){_0x11769b[_0x15d5('0x3d')]=_['merge'](_0x11769b['where'],{'$or':_[_0x15d5('0x33')](_0x5a46d3,function(_0x4f3d22){if(_0x4f3d22[_0x15d5('0x30')]!=='VIRTUAL'){var _0x39af92={};_0x39af92[_0x4f3d22['name']]={'$like':'%'+_0x3f40e3[_0x15d5('0x34')][_0x15d5('0x3f')]+'%'};return _0x39af92;}})});}_0x11769b=_['merge']({},_0x11769b,_0x3f40e3['options']);var _0x47aaf6={'where':_0x11769b[_0x15d5('0x3d')]};return db[_0x15d5('0x2d')][_0x15d5('0x22')](_0x47aaf6)['then'](function(_0x4244a2){_0x57fece['count']=_0x4244a2;if(_0x3f40e3[_0x15d5('0x34')][_0x15d5('0x40')]){_0x11769b[_0x15d5('0x41')]=[{'all':!![]}];}return db[_0x15d5('0x2d')][_0x15d5('0x42')](_0x11769b);})[_0x15d5('0x27')](function(_0x28a6c2){_0x57fece[_0x15d5('0x43')]=_0x28a6c2;return _0x57fece;})[_0x15d5('0x27')](respondWithFilteredResult(_0x508d92,_0x11769b))[_0x15d5('0x44')](handleError(_0x508d92,null));};exports['show']=function(_0x536b18,_0x1b247e){var _0x4cab53={'raw':![],'where':{'id':_0x536b18[_0x15d5('0x45')]['id']}},_0x360119={};_0x360119[_0x15d5('0x32')]=_[_0x15d5('0x46')](db['VtigerAccount'][_0x15d5('0x2e')]);_0x360119[_0x15d5('0x34')]=_[_0x15d5('0x46')](_0x536b18['query']);_0x360119[_0x15d5('0x35')]=_['intersection'](_0x360119[_0x15d5('0x32')],_0x360119[_0x15d5('0x34')]);_0x4cab53[_0x15d5('0x36')]=_['intersection'](_0x360119[_0x15d5('0x32')],qs[_0x15d5('0x47')](_0x536b18[_0x15d5('0x34')]['fields']));_0x4cab53[_0x15d5('0x36')]=_0x4cab53[_0x15d5('0x36')][_0x15d5('0x38')]?_0x4cab53[_0x15d5('0x36')]:_0x360119[_0x15d5('0x32')];if(_0x536b18[_0x15d5('0x34')][_0x15d5('0x40')]){_0x4cab53['include']=[{'all':!![]}];}_0x4cab53=_['merge']({},_0x4cab53,_0x536b18['options']);return db['VtigerAccount'][_0x15d5('0x48')](_0x4cab53)['then'](handleEntityNotFound(_0x1b247e,null))[_0x15d5('0x27')](respondWithResult(_0x1b247e,null))[_0x15d5('0x44')](handleError(_0x1b247e,null));};exports[_0x15d5('0x49')]=function(_0x512258,_0x14a0db){return db[_0x15d5('0x2d')][_0x15d5('0x49')](_0x512258[_0x15d5('0x4a')],{})[_0x15d5('0x27')](respondWithResult(_0x14a0db,0xc9))[_0x15d5('0x44')](handleError(_0x14a0db,null));};exports[_0x15d5('0x25')]=function(_0x5b6481,_0x300bd6){if(_0x5b6481[_0x15d5('0x4a')]['id']){delete _0x5b6481[_0x15d5('0x4a')]['id'];}return db[_0x15d5('0x2d')][_0x15d5('0x48')]({'where':{'id':_0x5b6481[_0x15d5('0x45')]['id']}})['then'](handleEntityNotFound(_0x300bd6,null))[_0x15d5('0x27')](saveUpdates(_0x5b6481[_0x15d5('0x4a')],null))[_0x15d5('0x27')](respondWithResult(_0x300bd6,null))[_0x15d5('0x44')](handleError(_0x300bd6,null));};exports[_0x15d5('0x26')]=function(_0x91d436,_0x6f5f93){return db[_0x15d5('0x2d')][_0x15d5('0x48')]({'where':{'id':_0x91d436[_0x15d5('0x45')]['id']}})[_0x15d5('0x27')](handleEntityNotFound(_0x6f5f93,null))[_0x15d5('0x27')](removeEntity(_0x6f5f93,null))[_0x15d5('0x44')](handleError(_0x6f5f93,null));};exports['getConfigurations']=function(_0x292dcb,_0x1ced78,_0x3016a1){var _0x117127={};var _0x3ff0c8={};var _0x3b74bb;var _0x758776;return db['VtigerAccount']['findOne']({'where':{'id':_0x292dcb[_0x15d5('0x45')]['id']}})[_0x15d5('0x27')](handleEntityNotFound(_0x1ced78,null))[_0x15d5('0x27')](function(_0x651c29){if(_0x651c29){_0x3b74bb=_0x651c29;_0x3ff0c8[_0x15d5('0x32')]=_[_0x15d5('0x46')](db[_0x15d5('0x4b')][_0x15d5('0x2e')]);_0x3ff0c8['query']=_[_0x15d5('0x46')](_0x292dcb[_0x15d5('0x34')]);_0x3ff0c8[_0x15d5('0x35')]=_[_0x15d5('0x37')](_0x3ff0c8[_0x15d5('0x32')],_0x3ff0c8[_0x15d5('0x34')]);_0x117127[_0x15d5('0x36')]=_[_0x15d5('0x37')](_0x3ff0c8['model'],qs[_0x15d5('0x47')](_0x292dcb[_0x15d5('0x34')][_0x15d5('0x47')]));_0x117127[_0x15d5('0x36')]=_0x117127['attributes'][_0x15d5('0x38')]?_0x117127[_0x15d5('0x36')]:_0x3ff0c8[_0x15d5('0x32')];_0x117127[_0x15d5('0x3b')]=qs[_0x15d5('0x3c')](_0x292dcb[_0x15d5('0x34')]['sort']);_0x117127['where']=qs[_0x15d5('0x35')](_['pick'](_0x292dcb['query'],_0x3ff0c8['filters']));if(_0x292dcb[_0x15d5('0x34')]['filter']){_0x117127[_0x15d5('0x3d')]=_[_0x15d5('0x4c')](_0x117127[_0x15d5('0x3d')],{'$or':_['map'](_0x117127[_0x15d5('0x36')],function(_0x1bb2c3){var _0x2984dc={};_0x2984dc[_0x1bb2c3]={'$like':'%'+_0x292dcb[_0x15d5('0x34')][_0x15d5('0x3f')]+'%'};return _0x2984dc;})});}_0x117127=_['merge']({},_0x117127,_0x292dcb['options']);return _0x3b74bb['getConfigurations'](_0x117127);}})['then'](function(_0x2ec822){if(_0x2ec822){_0x758776=_0x2ec822[_0x15d5('0x38')];if(!_0x292dcb[_0x15d5('0x34')]['hasOwnProperty'](_0x15d5('0x3a'))){_0x117127[_0x15d5('0x21')]=qs['limit'](_0x292dcb[_0x15d5('0x34')][_0x15d5('0x21')]);_0x117127[_0x15d5('0x1f')]=qs[_0x15d5('0x1f')](_0x292dcb[_0x15d5('0x34')][_0x15d5('0x1f')]);}return _0x3b74bb[_0x15d5('0x4d')](_0x117127);}})[_0x15d5('0x27')](function(_0x5bcfb0){if(_0x5bcfb0){return _0x5bcfb0?{'count':_0x758776,'rows':_0x5bcfb0}:null;}})['then'](respondWithResult(_0x1ced78,null))[_0x15d5('0x44')](handleError(_0x1ced78,null));};exports[_0x15d5('0x4e')]=function(_0x32d14b,_0x20a430,_0x4c6989){if(_0x32d14b['body']['id']){delete _0x32d14b['body']['id'];}return db[_0x15d5('0x2d')][_0x15d5('0x4f')]({'where':{'id':_0x32d14b[_0x15d5('0x45')]['id']}})[_0x15d5('0x27')](handleEntityNotFound(_0x20a430,null))[_0x15d5('0x27')](function(_0x3155c7){if(_0x3155c7){_0x32d14b['body'][_0x15d5('0x50')]=_0x3155c7['id'];_0x32d14b[_0x15d5('0x4a')][_0x15d5('0x51')]=integrations[_0x15d5('0x52')](_0x32d14b[_0x15d5('0x4a')][_0x15d5('0x53')],_0x32d14b['body'][_0x15d5('0x30')]);_0x32d14b[_0x15d5('0x4a')][_0x15d5('0x54')]=integrations['getDescriptions'](_0x32d14b[_0x15d5('0x4a')][_0x15d5('0x53')],_0x32d14b[_0x15d5('0x4a')][_0x15d5('0x30')]);return db[_0x15d5('0x4b')][_0x15d5('0x49')](_0x32d14b['body'],{'include':[{'model':db['VtigerField'],'as':_0x15d5('0x51')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x20a430,null))[_0x15d5('0x44')](handleError(_0x20a430,null));};var md5=require(_0x15d5('0x55'));exports[_0x15d5('0x56')]=function(_0x5ed036,_0xa0b470,_0xcbaf32){var _0x850b2b=null;var _0x37df09=null;var _0xc4869c=null;var _0x1c662d=null;var _0x3ddb28='';return db[_0x15d5('0x2d')][_0x15d5('0x4f')]({'where':{'id':_0x5ed036[_0x15d5('0x45')]['id']},'attributes':['id',_0x15d5('0x2a'),'username','description',_0x15d5('0x57'),_0x15d5('0x58'),_0x15d5('0x59'),_0x15d5('0x5a')]})[_0x15d5('0x27')](handleEntityNotFound(_0xa0b470,null))[_0x15d5('0x27')](function(_0x19bf90){if(_0x19bf90){_0x850b2b=_0x19bf90[_0x15d5('0x5b')];_0x37df09=_0x19bf90['accessKey'];_0xc4869c=_0x19bf90[_0x15d5('0x57')];_0x3ddb28=_0x19bf90[_0x15d5('0x58')];var _0x57ec7d=_0x3ddb28[_0x15d5('0x5c')](-0x1);if(_0x57ec7d==='/'){_0x3ddb28=_0x3ddb28[_0x15d5('0x5d')](0x0,_0x3ddb28[_0x15d5('0x5e')](_0x57ec7d));}_0x1c662d=util[_0x15d5('0x5f')](_0x15d5('0x60'),_0x3ddb28);var _0x4df5e8={'method':_0x15d5('0x61'),'uri':_0x1c662d,'qs':{'operation':'getchallenge','username':_0x19bf90[_0x15d5('0x5b')]},'json':!![]};return rp(_0x4df5e8);}})[_0x15d5('0x27')](function(_0x7aec08){if(_0x7aec08['success']){var _0x21c71e={'method':_0x15d5('0x62'),'uri':_0x1c662d,'form':{'operation':_0x15d5('0x63'),'username':_0x850b2b,'accessKey':md5(_0x7aec08[_0x15d5('0x64')]['token']+_0x37df09)},'json':!![]};return rp(_0x21c71e);}})[_0x15d5('0x27')](function(_0x3dea4b){if(_0x3dea4b[_0x15d5('0x65')]){var _0x49da6a={'method':_0x15d5('0x61'),'uri':_0x1c662d,'qs':{'operation':_0x15d5('0x66'),'username':_0x850b2b,'sessionName':_0x3dea4b[_0x15d5('0x64')][_0x15d5('0x67')],'elementType':_0xc4869c},'json':!![]};return rp(_0x49da6a);}})[_0x15d5('0x27')](function(_0x4f2b36){if(_0x4f2b36[_0x15d5('0x65')]){var _0xe0b7b2=['autogenerated',_0x15d5('0x68'),_0x15d5('0x69')];_[_0x15d5('0x6a')](_0x4f2b36[_0x15d5('0x64')][_0x15d5('0x47')],function(_0x220995){return _0xe0b7b2[_0x15d5('0x6b')](_0x220995[_0x15d5('0x30')][_0x15d5('0x2a')]);});_[_0x15d5('0x6a')](_0x4f2b36[_0x15d5('0x64')][_0x15d5('0x47')],function(_0x5bbf22){return _0x5bbf22[_0x15d5('0x6c')]===_0x15d5('0x6d');});return{'count':_0x4f2b36[_0x15d5('0x64')]['fields'][_0x15d5('0x38')],'rows':_[_0x15d5('0x33')](_0x4f2b36[_0x15d5('0x64')][_0x15d5('0x47')],function(_0x1b774b){return{'id':_0x1b774b[_0x15d5('0x2a')],'name':_0x1b774b[_0x15d5('0x6e')],'custom':_['startsWith'](_0x1b774b['name'],_0x15d5('0x6f'))?!![]:![],'options':_0x1b774b[_0x15d5('0x30')][_0x15d5('0x2a')]===_0x15d5('0x70')&&_0x1b774b[_0x15d5('0x30')][_0x15d5('0x71')][_0x15d5('0x38')]>0x0?_['map'](_0x1b774b[_0x15d5('0x30')]['picklistValues'],function(_0x1bebc1){return{'name':_0x1bebc1[_0x15d5('0x6e')],'value':_0x1bebc1[_0x15d5('0x72')]};}):[]};})};}})['then'](respondWithResult(_0xa0b470,null))[_0x15d5('0x44')](function(_0x1f3a51){console[_0x15d5('0x73')](_0x15d5('0x74')+_0x1f3a51);var _0x595389=_0x5ed036[_0x15d5('0x34')][_0x15d5('0x75')]?0x1f4:_0x1f3a51['statusCode']||0x1f4;logger['error'](_0x15d5('0x76'),'getFields',_0x595389,JSON[_0x15d5('0x77')](_0x1f3a51));delete _0x1f3a51[_0x15d5('0x2a')];if(_0x595389===0x191){_0x595389=0x190;}_0xa0b470[_0x15d5('0x1c')](_0x595389)[_0x15d5('0x2b')](_0x5ed036[_0x15d5('0x34')][_0x15d5('0x75')]?{'message':_0x15d5('0x78'),'statusCode':_0x1f3a51[_0x15d5('0x79')]}:_0x1f3a51);});}; \ No newline at end of file +var _0xa6f9=['getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','getchallenge','login','token','success','GET','describe','result','sessionName','autogenerated','reference','owner','remove','editable','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','keys','filters','includeAll','find','create','body','update','destroy','getConfigurations','findOne','VtigerConfiguration','sort','hasOwnProperty','addConfiguration'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xa6f9,0x124));var _0x9a6f=function(_0x183bb0,_0x18b4c6){_0x183bb0=_0x183bb0-0x0;var _0x2df167=_0xa6f9[_0x183bb0];return _0x2df167;};'use strict';var emlformat=require(_0x9a6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a6f('0x1'));var jsonpatch=require(_0x9a6f('0x2'));var rp=require(_0x9a6f('0x3'));var moment=require(_0x9a6f('0x4'));var BPromise=require(_0x9a6f('0x5'));var Mustache=require(_0x9a6f('0x6'));var util=require(_0x9a6f('0x7'));var path=require(_0x9a6f('0x8'));var sox=require(_0x9a6f('0x9'));var csv=require(_0x9a6f('0xa'));var ejs=require(_0x9a6f('0xb'));var fs=require('fs');var fs_extra=require(_0x9a6f('0xc'));var _=require('lodash');var squel=require(_0x9a6f('0xd'));var crypto=require('crypto');var jsforce=require(_0x9a6f('0xe'));var deskjs=require(_0x9a6f('0xf'));var toCsv=require(_0x9a6f('0xa'));var querystring=require('querystring');var Papa=require(_0x9a6f('0x10'));var Redis=require(_0x9a6f('0x11'));var authService=require(_0x9a6f('0x12'));var qs=require(_0x9a6f('0x13'));var as=require(_0x9a6f('0x14'));var hardwareService=require(_0x9a6f('0x15'));var logger=require(_0x9a6f('0x16'))('api');var utils=require(_0x9a6f('0x17'));var config=require(_0x9a6f('0x18'));var licenseUtil=require(_0x9a6f('0x19'));var db=require(_0x9a6f('0x1a'))['db'];var integrations=require(_0x9a6f('0x1b'));function respondWithStatusCode(_0x564b79,_0x1ee930){_0x1ee930=_0x1ee930||0xcc;return function(_0x1d9df0){if(_0x1d9df0){return _0x564b79[_0x9a6f('0x1c')](_0x1ee930);}return _0x564b79[_0x9a6f('0x1d')](_0x1ee930)[_0x9a6f('0x1e')]();};}function respondWithResult(_0x28325e,_0x53c909){_0x53c909=_0x53c909||0xc8;return function(_0x4651c3){if(_0x4651c3){return _0x28325e[_0x9a6f('0x1d')](_0x53c909)[_0x9a6f('0x1f')](_0x4651c3);}};}function respondWithFilteredResult(_0x4f359a,_0x256f4d){return function(_0x1cf4fe){if(_0x1cf4fe){var _0x390065=typeof _0x256f4d[_0x9a6f('0x20')]==='undefined'&&typeof _0x256f4d['limit']===_0x9a6f('0x21');var _0x393a8f=_0x1cf4fe['count'];var _0x129067=_0x390065?0x0:_0x256f4d[_0x9a6f('0x20')];var _0x189ef5=_0x390065?_0x1cf4fe[_0x9a6f('0x22')]:_0x256f4d[_0x9a6f('0x20')]+_0x256f4d[_0x9a6f('0x23')];var _0x5b7d1;if(_0x189ef5>=_0x393a8f){_0x189ef5=_0x393a8f;_0x5b7d1=0xc8;}else{_0x5b7d1=0xce;}_0x4f359a[_0x9a6f('0x1d')](_0x5b7d1);return _0x4f359a[_0x9a6f('0x24')]('Content-Range',_0x129067+'-'+_0x189ef5+'/'+_0x393a8f)[_0x9a6f('0x1f')](_0x1cf4fe);}return null;};}function patchUpdates(_0x1152db){return function(_0x297c97){try{jsonpatch[_0x9a6f('0x25')](_0x297c97,_0x1152db,!![]);}catch(_0x52e01f){return BPromise[_0x9a6f('0x26')](_0x52e01f);}return _0x297c97[_0x9a6f('0x27')]();};}function saveUpdates(_0x5a8c2c,_0x4f5743){return function(_0x24657d){if(_0x24657d){return _0x24657d['update'](_0x5a8c2c)[_0x9a6f('0x28')](function(_0x409202){return _0x409202;});}return null;};}function removeEntity(_0x4e4337,_0x45034a){return function(_0xaedc99){if(_0xaedc99){return _0xaedc99['destroy']()['then'](function(){_0x4e4337['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eeb48,_0x5f3afb){return function(_0x5e1186){if(!_0x5e1186){_0x1eeb48[_0x9a6f('0x1c')](0x194);}return _0x5e1186;};}function handleError(_0x3ffbed,_0x120e37){_0x120e37=_0x120e37||0x1f4;return function(_0x3a9394){logger[_0x9a6f('0x29')](_0x3a9394[_0x9a6f('0x2a')]);if(_0x3a9394[_0x9a6f('0x2b')]){delete _0x3a9394[_0x9a6f('0x2b')];}_0x3ffbed[_0x9a6f('0x1d')](_0x120e37)[_0x9a6f('0x2c')](_0x3a9394);};}exports['index']=function(_0x4e8a61,_0x1134ab){var _0x3064a4={},_0x388647={},_0x5a7759={'count':0x0,'rows':[]};var _0x5ce474=_[_0x9a6f('0x2d')](db[_0x9a6f('0x2e')][_0x9a6f('0x2f')],function(_0x1a9dc8){return{'name':_0x1a9dc8[_0x9a6f('0x30')],'type':_0x1a9dc8['type']['key']};});_0x388647[_0x9a6f('0x31')]=_['map'](_0x5ce474,_0x9a6f('0x2b'));_0x388647[_0x9a6f('0x32')]=_['keys'](_0x4e8a61['query']);_0x388647['filters']=_[_0x9a6f('0x33')](_0x388647[_0x9a6f('0x31')],_0x388647[_0x9a6f('0x32')]);_0x3064a4[_0x9a6f('0x34')]=_[_0x9a6f('0x33')](_0x388647['model'],qs[_0x9a6f('0x35')](_0x4e8a61[_0x9a6f('0x32')][_0x9a6f('0x35')]));_0x3064a4['attributes']=_0x3064a4[_0x9a6f('0x34')][_0x9a6f('0x36')]?_0x3064a4[_0x9a6f('0x34')]:_0x388647['model'];if(!_0x4e8a61['query']['hasOwnProperty'](_0x9a6f('0x37'))){_0x3064a4['limit']=qs[_0x9a6f('0x23')](_0x4e8a61[_0x9a6f('0x32')]['limit']);_0x3064a4[_0x9a6f('0x20')]=qs[_0x9a6f('0x20')](_0x4e8a61[_0x9a6f('0x32')][_0x9a6f('0x20')]);}_0x3064a4[_0x9a6f('0x38')]=qs['sort'](_0x4e8a61['query']['sort']);_0x3064a4[_0x9a6f('0x39')]=qs['filters'](_[_0x9a6f('0x3a')](_0x4e8a61[_0x9a6f('0x32')],_0x388647['filters']),_0x5ce474);if(_0x4e8a61[_0x9a6f('0x32')][_0x9a6f('0x3b')]){_0x3064a4[_0x9a6f('0x39')]=_[_0x9a6f('0x3c')](_0x3064a4[_0x9a6f('0x39')],{'$or':_[_0x9a6f('0x2d')](_0x5ce474,function(_0x1bc700){if(_0x1bc700[_0x9a6f('0x3d')]!==_0x9a6f('0x3e')){var _0x55de13={};_0x55de13[_0x1bc700[_0x9a6f('0x2b')]]={'$like':'%'+_0x4e8a61[_0x9a6f('0x32')][_0x9a6f('0x3b')]+'%'};return _0x55de13;}})});}_0x3064a4=_[_0x9a6f('0x3c')]({},_0x3064a4,_0x4e8a61[_0x9a6f('0x3f')]);var _0x28c44c={'where':_0x3064a4['where']};return db[_0x9a6f('0x2e')]['count'](_0x28c44c)[_0x9a6f('0x28')](function(_0x25f494){_0x5a7759['count']=_0x25f494;if(_0x4e8a61['query']['includeAll']){_0x3064a4[_0x9a6f('0x40')]=[{'all':!![]}];}return db[_0x9a6f('0x2e')][_0x9a6f('0x41')](_0x3064a4);})[_0x9a6f('0x28')](function(_0x385639){_0x5a7759[_0x9a6f('0x42')]=_0x385639;return _0x5a7759;})['then'](respondWithFilteredResult(_0x1134ab,_0x3064a4))[_0x9a6f('0x43')](handleError(_0x1134ab,null));};exports['show']=function(_0x494fd2,_0x558dcc){var _0x18ed15={'raw':![],'where':{'id':_0x494fd2[_0x9a6f('0x44')]['id']}},_0x577f37={};_0x577f37[_0x9a6f('0x31')]=_[_0x9a6f('0x45')](db['VtigerAccount'][_0x9a6f('0x2f')]);_0x577f37[_0x9a6f('0x32')]=_[_0x9a6f('0x45')](_0x494fd2[_0x9a6f('0x32')]);_0x577f37[_0x9a6f('0x46')]=_[_0x9a6f('0x33')](_0x577f37[_0x9a6f('0x31')],_0x577f37[_0x9a6f('0x32')]);_0x18ed15[_0x9a6f('0x34')]=_[_0x9a6f('0x33')](_0x577f37[_0x9a6f('0x31')],qs['fields'](_0x494fd2[_0x9a6f('0x32')][_0x9a6f('0x35')]));_0x18ed15[_0x9a6f('0x34')]=_0x18ed15[_0x9a6f('0x34')][_0x9a6f('0x36')]?_0x18ed15[_0x9a6f('0x34')]:_0x577f37[_0x9a6f('0x31')];if(_0x494fd2[_0x9a6f('0x32')][_0x9a6f('0x47')]){_0x18ed15[_0x9a6f('0x40')]=[{'all':!![]}];}_0x18ed15=_[_0x9a6f('0x3c')]({},_0x18ed15,_0x494fd2[_0x9a6f('0x3f')]);return db[_0x9a6f('0x2e')][_0x9a6f('0x48')](_0x18ed15)[_0x9a6f('0x28')](handleEntityNotFound(_0x558dcc,null))['then'](respondWithResult(_0x558dcc,null))[_0x9a6f('0x43')](handleError(_0x558dcc,null));};exports[_0x9a6f('0x49')]=function(_0x10f637,_0x19a778){return db[_0x9a6f('0x2e')]['create'](_0x10f637[_0x9a6f('0x4a')],{})[_0x9a6f('0x28')](respondWithResult(_0x19a778,0xc9))['catch'](handleError(_0x19a778,null));};exports[_0x9a6f('0x4b')]=function(_0x5ee027,_0x1935af){if(_0x5ee027[_0x9a6f('0x4a')]['id']){delete _0x5ee027[_0x9a6f('0x4a')]['id'];}return db[_0x9a6f('0x2e')][_0x9a6f('0x48')]({'where':{'id':_0x5ee027[_0x9a6f('0x44')]['id']}})[_0x9a6f('0x28')](handleEntityNotFound(_0x1935af,null))[_0x9a6f('0x28')](saveUpdates(_0x5ee027['body'],null))[_0x9a6f('0x28')](respondWithResult(_0x1935af,null))[_0x9a6f('0x43')](handleError(_0x1935af,null));};exports[_0x9a6f('0x4c')]=function(_0x8c3ea1,_0x5ba0ac){return db['VtigerAccount']['find']({'where':{'id':_0x8c3ea1[_0x9a6f('0x44')]['id']}})[_0x9a6f('0x28')](handleEntityNotFound(_0x5ba0ac,null))[_0x9a6f('0x28')](removeEntity(_0x5ba0ac,null))['catch'](handleError(_0x5ba0ac,null));};exports[_0x9a6f('0x4d')]=function(_0x362fc1,_0x7e7c89,_0x9755c5){var _0x59aa25={};var _0xde9822={};var _0x32cedc;var _0x572a7a;return db[_0x9a6f('0x2e')][_0x9a6f('0x4e')]({'where':{'id':_0x362fc1['params']['id']}})['then'](handleEntityNotFound(_0x7e7c89,null))[_0x9a6f('0x28')](function(_0x42611c){if(_0x42611c){_0x32cedc=_0x42611c;_0xde9822[_0x9a6f('0x31')]=_[_0x9a6f('0x45')](db[_0x9a6f('0x4f')][_0x9a6f('0x2f')]);_0xde9822[_0x9a6f('0x32')]=_[_0x9a6f('0x45')](_0x362fc1[_0x9a6f('0x32')]);_0xde9822[_0x9a6f('0x46')]=_[_0x9a6f('0x33')](_0xde9822[_0x9a6f('0x31')],_0xde9822['query']);_0x59aa25['attributes']=_['intersection'](_0xde9822[_0x9a6f('0x31')],qs['fields'](_0x362fc1[_0x9a6f('0x32')][_0x9a6f('0x35')]));_0x59aa25[_0x9a6f('0x34')]=_0x59aa25['attributes'][_0x9a6f('0x36')]?_0x59aa25[_0x9a6f('0x34')]:_0xde9822['model'];_0x59aa25[_0x9a6f('0x38')]=qs[_0x9a6f('0x50')](_0x362fc1[_0x9a6f('0x32')][_0x9a6f('0x50')]);_0x59aa25['where']=qs[_0x9a6f('0x46')](_[_0x9a6f('0x3a')](_0x362fc1[_0x9a6f('0x32')],_0xde9822['filters']));if(_0x362fc1[_0x9a6f('0x32')][_0x9a6f('0x3b')]){_0x59aa25['where']=_['merge'](_0x59aa25[_0x9a6f('0x39')],{'$or':_[_0x9a6f('0x2d')](_0x59aa25[_0x9a6f('0x34')],function(_0x18fe4f){var _0x696dda={};_0x696dda[_0x18fe4f]={'$like':'%'+_0x362fc1[_0x9a6f('0x32')][_0x9a6f('0x3b')]+'%'};return _0x696dda;})});}_0x59aa25=_['merge']({},_0x59aa25,_0x362fc1[_0x9a6f('0x3f')]);return _0x32cedc[_0x9a6f('0x4d')](_0x59aa25);}})[_0x9a6f('0x28')](function(_0x32dee6){if(_0x32dee6){_0x572a7a=_0x32dee6[_0x9a6f('0x36')];if(!_0x362fc1[_0x9a6f('0x32')][_0x9a6f('0x51')]('nolimit')){_0x59aa25['limit']=qs[_0x9a6f('0x23')](_0x362fc1['query'][_0x9a6f('0x23')]);_0x59aa25['offset']=qs['offset'](_0x362fc1[_0x9a6f('0x32')][_0x9a6f('0x20')]);}return _0x32cedc[_0x9a6f('0x4d')](_0x59aa25);}})[_0x9a6f('0x28')](function(_0x113352){if(_0x113352){return _0x113352?{'count':_0x572a7a,'rows':_0x113352}:null;}})[_0x9a6f('0x28')](respondWithResult(_0x7e7c89,null))[_0x9a6f('0x43')](handleError(_0x7e7c89,null));};exports[_0x9a6f('0x52')]=function(_0x3e8178,_0x1fc095,_0x2f23e6){if(_0x3e8178['body']['id']){delete _0x3e8178[_0x9a6f('0x4a')]['id'];}return db[_0x9a6f('0x2e')][_0x9a6f('0x4e')]({'where':{'id':_0x3e8178[_0x9a6f('0x44')]['id']}})[_0x9a6f('0x28')](handleEntityNotFound(_0x1fc095,null))[_0x9a6f('0x28')](function(_0x42c036){if(_0x42c036){_0x3e8178['body']['AccountId']=_0x42c036['id'];_0x3e8178[_0x9a6f('0x4a')]['Subjects']=integrations[_0x9a6f('0x53')](_0x3e8178[_0x9a6f('0x4a')][_0x9a6f('0x54')],_0x3e8178[_0x9a6f('0x4a')]['type']);_0x3e8178[_0x9a6f('0x4a')][_0x9a6f('0x55')]=integrations[_0x9a6f('0x56')](_0x3e8178['body'][_0x9a6f('0x54')],_0x3e8178[_0x9a6f('0x4a')]['type']);return db[_0x9a6f('0x4f')][_0x9a6f('0x49')](_0x3e8178[_0x9a6f('0x4a')],{'include':[{'model':db[_0x9a6f('0x57')],'as':_0x9a6f('0x58')},{'model':db['VtigerField'],'as':_0x9a6f('0x55')}]});}return null;})['then'](respondWithResult(_0x1fc095,null))[_0x9a6f('0x43')](handleError(_0x1fc095,null));};var md5=require(_0x9a6f('0x59'));exports[_0x9a6f('0x5a')]=function(_0x2f33c7,_0x17a2c9,_0x7d3929){var _0x2348a3=null;var _0x3eabc1=null;var _0x3f60b7=null;var _0x4a0702=null;var _0x2b7805='';return db[_0x9a6f('0x2e')][_0x9a6f('0x4e')]({'where':{'id':_0x2f33c7[_0x9a6f('0x44')]['id']},'attributes':['id','name',_0x9a6f('0x5b'),_0x9a6f('0x5c'),_0x9a6f('0x5d'),'remoteUri',_0x9a6f('0x5e'),'accessKey']})[_0x9a6f('0x28')](handleEntityNotFound(_0x17a2c9,null))['then'](function(_0x15d216){if(_0x15d216){_0x2348a3=_0x15d216[_0x9a6f('0x5b')];_0x3eabc1=_0x15d216[_0x9a6f('0x5f')];_0x3f60b7=_0x15d216[_0x9a6f('0x5d')];_0x2b7805=_0x15d216['remoteUri'];var _0x2b703b=_0x2b7805['slice'](-0x1);if(_0x2b703b==='/'){_0x2b7805=_0x2b7805[_0x9a6f('0x60')](0x0,_0x2b7805[_0x9a6f('0x61')](_0x2b703b));}_0x4a0702=util[_0x9a6f('0x62')](_0x9a6f('0x63'),_0x2b7805);var _0x4942c7={'method':'GET','uri':_0x4a0702,'qs':{'operation':_0x9a6f('0x64'),'username':_0x15d216[_0x9a6f('0x5b')]},'json':!![]};return rp(_0x4942c7);}})[_0x9a6f('0x28')](function(_0x313b1e){if(_0x313b1e['success']){var _0x4e4d04={'method':'POST','uri':_0x4a0702,'form':{'operation':_0x9a6f('0x65'),'username':_0x2348a3,'accessKey':md5(_0x313b1e['result'][_0x9a6f('0x66')]+_0x3eabc1)},'json':!![]};return rp(_0x4e4d04);}})['then'](function(_0x13053d){if(_0x13053d[_0x9a6f('0x67')]){var _0x24a1be={'method':_0x9a6f('0x68'),'uri':_0x4a0702,'qs':{'operation':_0x9a6f('0x69'),'username':_0x2348a3,'sessionName':_0x13053d[_0x9a6f('0x6a')][_0x9a6f('0x6b')],'elementType':_0x3f60b7},'json':!![]};return rp(_0x24a1be);}})['then'](function(_0x24f232){if(_0x24f232['success']){var _0x473a40=[_0x9a6f('0x6c'),_0x9a6f('0x6d'),_0x9a6f('0x6e')];_[_0x9a6f('0x6f')](_0x24f232['result']['fields'],function(_0x40b267){return _0x473a40['includes'](_0x40b267['type']['name']);});_[_0x9a6f('0x6f')](_0x24f232['result']['fields'],function(_0x1fe48e){return _0x1fe48e[_0x9a6f('0x70')]==='false';});return{'count':_0x24f232[_0x9a6f('0x6a')]['fields'][_0x9a6f('0x36')],'rows':_[_0x9a6f('0x2d')](_0x24f232['result'][_0x9a6f('0x35')],function(_0x523217){return{'id':_0x523217[_0x9a6f('0x2b')],'name':_0x523217[_0x9a6f('0x71')],'custom':_[_0x9a6f('0x72')](_0x523217['name'],_0x9a6f('0x73'))?!![]:![],'options':_0x523217[_0x9a6f('0x3d')][_0x9a6f('0x2b')]==='picklist'&&_0x523217[_0x9a6f('0x3d')][_0x9a6f('0x74')]['length']>0x0?_[_0x9a6f('0x2d')](_0x523217['type'][_0x9a6f('0x74')],function(_0x1e1419){return{'name':_0x1e1419['label'],'value':_0x1e1419[_0x9a6f('0x75')]};}):[]};})};}})[_0x9a6f('0x28')](respondWithResult(_0x17a2c9,null))['catch'](function(_0x41e816){console[_0x9a6f('0x76')](_0x9a6f('0x77')+_0x41e816);var _0x5e5f01=_0x2f33c7[_0x9a6f('0x32')][_0x9a6f('0x78')]?0x1f4:_0x41e816[_0x9a6f('0x79')]||0x1f4;logger[_0x9a6f('0x29')](_0x9a6f('0x7a'),'getFields',_0x5e5f01,JSON[_0x9a6f('0x7b')](_0x41e816));delete _0x41e816[_0x9a6f('0x2b')];if(_0x5e5f01===0x191){_0x5e5f01=0x190;}_0x17a2c9[_0x9a6f('0x1d')](_0x5e5f01)[_0x9a6f('0x2c')](_0x2f33c7[_0x9a6f('0x32')][_0x9a6f('0x78')]?{'message':_0x9a6f('0x7c'),'statusCode':_0x41e816[_0x9a6f('0x79')]}:_0x41e816);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b7a4cb7..4fb4537 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 _0x6222=['path','rimraf','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6222,0xe2));var _0x2622=function(_0x5543ee,_0x1d9b5f){_0x5543ee=_0x5543ee-0x0;var _0x259166=_0x6222[_0x5543ee];return _0x259166;};'use strict';var _=require('lodash');var util=require(_0x2622('0x0'));var logger=require(_0x2622('0x1'))(_0x2622('0x2'));var moment=require('moment');var BPromise=require(_0x2622('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2622('0x4'));var rimraf=require(_0x2622('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x2622('0x6'));module[_0x2622('0x7')]=function(_0x8b3f9c,_0x3f649a){return _0x8b3f9c['define'](_0x2622('0x8'),attributes,{'tableName':_0x2622('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x891e=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x4ce0af,_0x462000){var _0x5238b4=function(_0x59c5d6){while(--_0x59c5d6){_0x4ce0af['push'](_0x4ce0af['shift']());}};_0x5238b4(++_0x462000);}(_0x891e,0x14f));var _0xe891=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0x891e[_0x55daf2];return _0x1c8500;};'use strict';var _=require(_0xe891('0x0'));var util=require('util');var logger=require(_0xe891('0x1'))(_0xe891('0x2'));var moment=require(_0xe891('0x3'));var BPromise=require(_0xe891('0x4'));var rp=require(_0xe891('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe891('0x6'));var attributes=require(_0xe891('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe891('0x8')]=function(_0x41106f,_0x5ae95e){return _0x41106f[_0xe891('0x9')](_0xe891('0xa'),attributes,{'tableName':_0xe891('0xb'),'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 0f44290..6bfa1b2 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 _0x0bb5=['VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x7aeee4,_0x4c888c){var _0xcebaeb=function(_0xfca287){while(--_0xfca287){_0x7aeee4['push'](_0x7aeee4['shift']());}};_0xcebaeb(++_0x4c888c);}(_0x0bb5,0x148));var _0x50bb=function(_0x162be0,_0x3f31eb){_0x162be0=_0x162be0-0x0;var _0x3dc460=_0x0bb5[_0x162be0];return _0x3dc460;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['GetVtigerAccount']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['VtigerAccount']['findAll']({'raw':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x24ba19[_0x50bb('0x16')]?_0x24ba19['options'][_0x50bb('0x18')]||null:null,'attributes':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')]['attributes']||null:null,'limit':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x19')]||null:null,'include':_0x24ba19['options']?_0x24ba19[_0x50bb('0x16')]['include']?_[_0x50bb('0x1a')](_0x24ba19[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x2ee87a){return{'model':db[_0x2ee87a[_0x50bb('0x1c')]],'as':_0x2ee87a['as'],'attributes':_0x2ee87a[_0x50bb('0x1d')],'include':_0x2ee87a['include']?_[_0x50bb('0x1a')](_0x2ee87a[_0x50bb('0x1b')],function(_0x284a76){return{'model':db[_0x284a76[_0x50bb('0x1c')]],'as':_0x284a76['as'],'attributes':_0x284a76['attributes'],'include':_0x284a76[_0x50bb('0x1b')]?_['map'](_0x284a76['include'],function(_0x2befd9){return{'model':db[_0x2befd9['model']],'as':_0x2befd9['as'],'attributes':_0x2befd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x12ee2c){logger[_0x50bb('0xb')](_0x50bb('0x1e'),_0x24ba19);logger[_0x50bb('0xd')](_0x50bb('0x1e'),_0x24ba19,JSON[_0x50bb('0x10')](_0x12ee2c));_0x301f61(_0x12ee2c);})[_0x50bb('0x15')](function(_0x4f7514){logger[_0x50bb('0x11')](_0x50bb('0x1e'),_0x4f7514[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4f7514['message']));});});};exports[_0x50bb('0x1f')]=function(_0x1a62fb){var _0xc38da5=this;return new Promise(function(_0xb3c3ba,_0x3fd5f6){return db[_0x50bb('0x20')][_0x50bb('0x21')]({'raw':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')]['where']||null:null,'attributes':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1d')]||null:null,'include':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x1cc4e2){return{'model':db[_0x1cc4e2[_0x50bb('0x1c')]],'as':_0x1cc4e2['as'],'attributes':_0x1cc4e2['attributes'],'include':_0x1cc4e2[_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1cc4e2[_0x50bb('0x1b')],function(_0x2bfb54){return{'model':db[_0x2bfb54[_0x50bb('0x1c')]],'as':_0x2bfb54['as'],'attributes':_0x2bfb54[_0x50bb('0x1d')],'include':_0x2bfb54['include']?_['map'](_0x2bfb54[_0x50bb('0x1b')],function(_0x5ed0b4){return{'model':db[_0x5ed0b4[_0x50bb('0x1c')]],'as':_0x5ed0b4['as'],'attributes':_0x5ed0b4[_0x50bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x171c6b){logger[_0x50bb('0xb')]('ShowVtigerAccount',_0x1a62fb);logger[_0x50bb('0xd')]('ShowVtigerAccount',_0x1a62fb,JSON[_0x50bb('0x10')](_0x171c6b));_0xb3c3ba(_0x171c6b);})[_0x50bb('0x15')](function(_0x280e5a){logger['error']('ShowVtigerAccount',_0x280e5a[_0x50bb('0x13')],_0x1a62fb);_0x3fd5f6(_0xc38da5[_0x50bb('0x11')](0x1f4,_0x280e5a[_0x50bb('0x13')]));});});}; \ No newline at end of file +var _0x4483=['client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','options','raw','where','attributes','include','model','find','map','ShowVtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2dfe26,_0x5805cc){var _0x42869d=function(_0x6fff99){while(--_0x6fff99){_0x2dfe26['push'](_0x2dfe26['shift']());}};_0x42869d(++_0x5805cc);}(_0x4483,0x1a3));var _0x3448=function(_0x1da98c,_0x3d790b){_0x1da98c=_0x1da98c-0x0;var _0x5301c2=_0x4483[_0x1da98c];return _0x5301c2;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});}exports[_0x3448('0x17')]=function(_0x425514){var _0x4a348c=this;return new Promise(function(_0x1658cd,_0x5b410d){return db['VtigerAccount']['findAll']({'raw':_0x425514[_0x3448('0x18')]?_0x425514[_0x3448('0x18')][_0x3448('0x19')]===undefined?!![]:![]:!![],'where':_0x425514['options']?_0x425514[_0x3448('0x18')][_0x3448('0x1a')]||null:null,'attributes':_0x425514[_0x3448('0x18')]?_0x425514[_0x3448('0x18')][_0x3448('0x1b')]||null:null,'limit':_0x425514[_0x3448('0x18')]?_0x425514['options']['limit']||null:null,'include':_0x425514['options']?_0x425514[_0x3448('0x18')][_0x3448('0x1c')]?_['map'](_0x425514['options'][_0x3448('0x1c')],function(_0x4371d6){return{'model':db[_0x4371d6[_0x3448('0x1d')]],'as':_0x4371d6['as'],'attributes':_0x4371d6[_0x3448('0x1b')],'include':_0x4371d6[_0x3448('0x1c')]?_['map'](_0x4371d6[_0x3448('0x1c')],function(_0x1b5c49){return{'model':db[_0x1b5c49[_0x3448('0x1d')]],'as':_0x1b5c49['as'],'attributes':_0x1b5c49[_0x3448('0x1b')],'include':_0x1b5c49[_0x3448('0x1c')]?_['map'](_0x1b5c49[_0x3448('0x1c')],function(_0x393081){return{'model':db[_0x393081['model']],'as':_0x393081['as'],'attributes':_0x393081[_0x3448('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3448('0xc')](function(_0x310912){logger[_0x3448('0xd')](_0x3448('0x17'),_0x425514);logger[_0x3448('0x10')](_0x3448('0x17'),_0x425514,JSON[_0x3448('0x12')](_0x310912));_0x1658cd(_0x310912);})['catch'](function(_0x3307dc){logger[_0x3448('0x13')](_0x3448('0x17'),_0x3307dc['message'],_0x425514);_0x5b410d(_0x4a348c[_0x3448('0x13')](0x1f4,_0x3307dc['message']));});});};exports['ShowVtigerAccount']=function(_0x493898){var _0x52fb48=this;return new Promise(function(_0xff6513,_0x5e96f0){return db['VtigerAccount'][_0x3448('0x1e')]({'raw':_0x493898[_0x3448('0x18')]?_0x493898[_0x3448('0x18')][_0x3448('0x19')]===undefined?!![]:![]:!![],'where':_0x493898['options']?_0x493898[_0x3448('0x18')][_0x3448('0x1a')]||null:null,'attributes':_0x493898[_0x3448('0x18')]?_0x493898['options'][_0x3448('0x1b')]||null:null,'include':_0x493898[_0x3448('0x18')]?_0x493898['options']['include']?_[_0x3448('0x1f')](_0x493898[_0x3448('0x18')][_0x3448('0x1c')],function(_0x37a0ee){return{'model':db[_0x37a0ee['model']],'as':_0x37a0ee['as'],'attributes':_0x37a0ee[_0x3448('0x1b')],'include':_0x37a0ee[_0x3448('0x1c')]?_[_0x3448('0x1f')](_0x37a0ee[_0x3448('0x1c')],function(_0x5ebab6){return{'model':db[_0x5ebab6[_0x3448('0x1d')]],'as':_0x5ebab6['as'],'attributes':_0x5ebab6[_0x3448('0x1b')],'include':_0x5ebab6['include']?_[_0x3448('0x1f')](_0x5ebab6[_0x3448('0x1c')],function(_0x89d6ae){return{'model':db[_0x89d6ae[_0x3448('0x1d')]],'as':_0x89d6ae['as'],'attributes':_0x89d6ae[_0x3448('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3448('0xc')](function(_0x32592f){logger[_0x3448('0xd')](_0x3448('0x20'),_0x493898);logger['debug']('ShowVtigerAccount',_0x493898,JSON[_0x3448('0x12')](_0x32592f));_0xff6513(_0x32592f);})['catch'](function(_0x22bb31){logger[_0x3448('0x13')](_0x3448('0x20'),_0x22bb31[_0x3448('0x14')],_0x493898);_0x5e96f0(_0x52fb48['error'](0x1f4,_0x22bb31[_0x3448('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 61b06d9..48ee914 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 _0x5a5a=['/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x47d36d,_0x9ed937){var _0x105caa=function(_0x4aa755){while(--_0x4aa755){_0x47d36d['push'](_0x47d36d['shift']());}};_0x105caa(++_0x9ed937);}(_0x5a5a,0xe5));var _0xa5a5=function(_0x2582af,_0x3409f7){_0x2582af=_0x2582af-0x0;var _0x38c9c6=_0x5a5a[_0x2582af];return _0x38c9c6;};'use strict';var multer=require(_0xa5a5('0x0'));var util=require('util');var path=require(_0xa5a5('0x1'));var timeout=require(_0xa5a5('0x2'));var express=require(_0xa5a5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa5a5('0x4'));var interaction=require(_0xa5a5('0x5'));var config=require('../../config/environment');var controller=require(_0xa5a5('0x6'));router[_0xa5a5('0x7')]('/',auth[_0xa5a5('0x8')](),controller[_0xa5a5('0x9')]);router[_0xa5a5('0x7')](_0xa5a5('0xa'),auth[_0xa5a5('0x8')](),controller['show']);router[_0xa5a5('0x7')](_0xa5a5('0xb'),auth[_0xa5a5('0x8')](),controller['getFields']);router['get'](_0xa5a5('0xc'),auth[_0xa5a5('0x8')](),controller[_0xa5a5('0xd')]);router['get']('/:id/descriptions',auth[_0xa5a5('0x8')](),controller[_0xa5a5('0xe')]);router[_0xa5a5('0xf')]('/',auth[_0xa5a5('0x8')](),controller['create']);router['put'](_0xa5a5('0xa'),auth['isAuthenticated'](),controller[_0xa5a5('0x10')]);router[_0xa5a5('0x11')](_0xa5a5('0xa'),auth['isAuthenticated'](),controller[_0xa5a5('0x12')]);module[_0xa5a5('0x13')]=router; \ No newline at end of file +var _0xed05=['./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5cffb2,_0x1ef64a){var _0x293adf=function(_0x1ec472){while(--_0x1ec472){_0x5cffb2['push'](_0x5cffb2['shift']());}};_0x293adf(++_0x1ef64a);}(_0xed05,0x13a));var _0x5ed0=function(_0x4b47a4,_0x1f7803){_0x4b47a4=_0x4b47a4-0x0;var _0x11d6be=_0xed05[_0x4b47a4];return _0x11d6be;};'use strict';var multer=require(_0x5ed0('0x0'));var util=require(_0x5ed0('0x1'));var path=require(_0x5ed0('0x2'));var timeout=require(_0x5ed0('0x3'));var express=require(_0x5ed0('0x4'));var router=express['Router']();var fs_extra=require(_0x5ed0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ed0('0x6'));var config=require(_0x5ed0('0x7'));var controller=require(_0x5ed0('0x8'));router[_0x5ed0('0x9')]('/',auth[_0x5ed0('0xa')](),controller[_0x5ed0('0xb')]);router['get']('/:id',auth[_0x5ed0('0xa')](),controller[_0x5ed0('0xc')]);router[_0x5ed0('0x9')](_0x5ed0('0xd'),auth[_0x5ed0('0xa')](),controller[_0x5ed0('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x5ed0('0xf')]);router['get'](_0x5ed0('0x10'),auth[_0x5ed0('0xa')](),controller[_0x5ed0('0x11')]);router['post']('/',auth[_0x5ed0('0xa')](),controller[_0x5ed0('0x12')]);router['put'](_0x5ed0('0x13'),auth[_0x5ed0('0xa')](),controller[_0x5ed0('0x14')]);router['delete']('/:id',auth[_0x5ed0('0xa')](),controller[_0x5ed0('0x15')]);module[_0x5ed0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1221f45..b3bf7a2 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 _0xbca9=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbca9,0x1b5));var _0x9bca=function(_0x308319,_0x470254){_0x308319=_0x308319-0x0;var _0x36df3f=_0xbca9[_0x308319];return _0x36df3f;};'use strict';var Sequelize=require(_0x9bca('0x0'));module[_0x9bca('0x1')]={'name':{'type':Sequelize[_0x9bca('0x2')]},'description':{'type':Sequelize[_0x9bca('0x2')]}}; \ No newline at end of file +var _0xa399=['sequelize','STRING'];(function(_0x24c90d,_0x5e8955){var _0x228245=function(_0x362dba){while(--_0x362dba){_0x24c90d['push'](_0x24c90d['shift']());}};_0x228245(++_0x5e8955);}(_0xa399,0xda));var _0x9a39=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa399[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x9a39('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a39('0x1')]},'description':{'type':Sequelize[_0x9a39('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index cfb2fd3..543ada9 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 _0xa9f3=['create','body','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find'];(function(_0x4ce167,_0x408a24){var _0xb84ed2=function(_0x4ffd46){while(--_0x4ffd46){_0x4ce167['push'](_0x4ce167['shift']());}};_0xb84ed2(++_0x408a24);}(_0xa9f3,0x1e8));var _0x3a9f=function(_0x2f59c6,_0x54a969){_0x2f59c6=_0x2f59c6-0x0;var _0x3e615d=_0xa9f3[_0x2f59c6];return _0x3e615d;};'use strict';var emlformat=require(_0x3a9f('0x0'));var rimraf=require(_0x3a9f('0x1'));var zipdir=require(_0x3a9f('0x2'));var jsonpatch=require(_0x3a9f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3a9f('0x4'));var Mustache=require('mustache');var util=require(_0x3a9f('0x5'));var path=require(_0x3a9f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3a9f('0x7'));var fs=require('fs');var fs_extra=require(_0x3a9f('0x8'));var _=require('lodash');var squel=require(_0x3a9f('0x9'));var crypto=require(_0x3a9f('0xa'));var jsforce=require(_0x3a9f('0xb'));var deskjs=require(_0x3a9f('0xc'));var toCsv=require(_0x3a9f('0xd'));var querystring=require(_0x3a9f('0xe'));var Papa=require(_0x3a9f('0xf'));var Redis=require(_0x3a9f('0x10'));var authService=require(_0x3a9f('0x11'));var qs=require(_0x3a9f('0x12'));var as=require(_0x3a9f('0x13'));var hardwareService=require(_0x3a9f('0x14'));var logger=require(_0x3a9f('0x15'))(_0x3a9f('0x16'));var utils=require(_0x3a9f('0x17'));var config=require(_0x3a9f('0x18'));var licenseUtil=require(_0x3a9f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7fc8,_0x14709b){_0x14709b=_0x14709b||0xcc;return function(_0x875e6a){if(_0x875e6a){return _0x4f7fc8[_0x3a9f('0x1a')](_0x14709b);}return _0x4f7fc8[_0x3a9f('0x1b')](_0x14709b)[_0x3a9f('0x1c')]();};}function respondWithResult(_0x5a299b,_0x3341e6){_0x3341e6=_0x3341e6||0xc8;return function(_0x5d57db){if(_0x5d57db){return _0x5a299b['status'](_0x3341e6)[_0x3a9f('0x1d')](_0x5d57db);}};}function respondWithFilteredResult(_0x5d66aa,_0xeb81c6){return function(_0x1d60c8){if(_0x1d60c8){var _0x299c50=typeof _0xeb81c6[_0x3a9f('0x1e')]==='undefined'&&typeof _0xeb81c6[_0x3a9f('0x1f')]===_0x3a9f('0x20');var _0xc853cd=_0x1d60c8[_0x3a9f('0x21')];var _0x4a0c6e=_0x299c50?0x0:_0xeb81c6[_0x3a9f('0x1e')];var _0x99fc9d=_0x299c50?_0x1d60c8[_0x3a9f('0x21')]:_0xeb81c6[_0x3a9f('0x1e')]+_0xeb81c6['limit'];var _0x368144;if(_0x99fc9d>=_0xc853cd){_0x99fc9d=_0xc853cd;_0x368144=0xc8;}else{_0x368144=0xce;}_0x5d66aa[_0x3a9f('0x1b')](_0x368144);return _0x5d66aa['set'](_0x3a9f('0x22'),_0x4a0c6e+'-'+_0x99fc9d+'/'+_0xc853cd)[_0x3a9f('0x1d')](_0x1d60c8);}return null;};}function patchUpdates(_0x4e105b){return function(_0x47f38e){try{jsonpatch[_0x3a9f('0x23')](_0x47f38e,_0x4e105b,!![]);}catch(_0x3b7fe5){return BPromise[_0x3a9f('0x24')](_0x3b7fe5);}return _0x47f38e['save']();};}function saveUpdates(_0x4dccb3,_0x48f352){return function(_0x40945d){if(_0x40945d){return _0x40945d[_0x3a9f('0x25')](_0x4dccb3)[_0x3a9f('0x26')](function(_0x5c1d62){return _0x5c1d62;});}return null;};}function removeEntity(_0xf78ef2,_0x712cf0){return function(_0x31f0e3){if(_0x31f0e3){return _0x31f0e3['destroy']()[_0x3a9f('0x26')](function(){_0xf78ef2[_0x3a9f('0x1b')](0xcc)[_0x3a9f('0x1c')]();});}};}function handleEntityNotFound(_0x1e5d39,_0x3acb0f){return function(_0x41d910){if(!_0x41d910){_0x1e5d39[_0x3a9f('0x1a')](0x194);}return _0x41d910;};}function handleError(_0x53a2cb,_0x3c3119){_0x3c3119=_0x3c3119||0x1f4;return function(_0x4c73c4){logger[_0x3a9f('0x27')](_0x4c73c4['stack']);if(_0x4c73c4[_0x3a9f('0x28')]){delete _0x4c73c4[_0x3a9f('0x28')];}_0x53a2cb[_0x3a9f('0x1b')](_0x3c3119)[_0x3a9f('0x29')](_0x4c73c4);};}exports[_0x3a9f('0x2a')]=function(_0x22f709,_0x191860){var _0x46c652={},_0x101fde={},_0x5b8457={'count':0x0,'rows':[]};var _0x32f8f2=_[_0x3a9f('0x2b')](db[_0x3a9f('0x2c')][_0x3a9f('0x2d')],function(_0x11f766){return{'name':_0x11f766[_0x3a9f('0x2e')],'type':_0x11f766[_0x3a9f('0x2f')]['key']};});_0x101fde[_0x3a9f('0x30')]=_[_0x3a9f('0x2b')](_0x32f8f2,_0x3a9f('0x28'));_0x101fde[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x22f709['query']);_0x101fde[_0x3a9f('0x33')]=_['intersection'](_0x101fde['model'],_0x101fde['query']);_0x46c652[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0x101fde[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x46c652[_0x3a9f('0x34')]=_0x46c652[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x46c652[_0x3a9f('0x34')]:_0x101fde['model'];if(!_0x22f709['query'][_0x3a9f('0x38')](_0x3a9f('0x39'))){_0x46c652[_0x3a9f('0x1f')]=qs['limit'](_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x1f')]);_0x46c652[_0x3a9f('0x1e')]=qs['offset'](_0x22f709[_0x3a9f('0x31')]['offset']);}_0x46c652[_0x3a9f('0x3a')]=qs[_0x3a9f('0x3b')](_0x22f709['query'][_0x3a9f('0x3b')]);_0x46c652[_0x3a9f('0x3c')]=qs[_0x3a9f('0x33')](_[_0x3a9f('0x3d')](_0x22f709[_0x3a9f('0x31')],_0x101fde[_0x3a9f('0x33')]),_0x32f8f2);if(_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x3e')]){_0x46c652[_0x3a9f('0x3c')]=_[_0x3a9f('0x3f')](_0x46c652[_0x3a9f('0x3c')],{'$or':_[_0x3a9f('0x2b')](_0x32f8f2,function(_0xec6c6f){if(_0xec6c6f[_0x3a9f('0x2f')]!=='VIRTUAL'){var _0x3c7467={};_0x3c7467[_0xec6c6f['name']]={'$like':'%'+_0x22f709[_0x3a9f('0x31')]['filter']+'%'};return _0x3c7467;}})});}_0x46c652=_[_0x3a9f('0x3f')]({},_0x46c652,_0x22f709[_0x3a9f('0x40')]);var _0x33e4a2={'where':_0x46c652['where']};return db[_0x3a9f('0x2c')][_0x3a9f('0x21')](_0x33e4a2)['then'](function(_0x36da40){_0x5b8457[_0x3a9f('0x21')]=_0x36da40;if(_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x41')]){_0x46c652[_0x3a9f('0x42')]=[{'all':!![]}];}return db[_0x3a9f('0x2c')][_0x3a9f('0x43')](_0x46c652);})[_0x3a9f('0x26')](function(_0x1669ea){_0x5b8457['rows']=_0x1669ea;return _0x5b8457;})[_0x3a9f('0x26')](respondWithFilteredResult(_0x191860,_0x46c652))[_0x3a9f('0x44')](handleError(_0x191860,null));};exports[_0x3a9f('0x45')]=function(_0x380a5d,_0x219210){var _0x317653={'raw':![],'where':{'id':_0x380a5d[_0x3a9f('0x46')]['id']}},_0xf83f4b={};_0xf83f4b[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db[_0x3a9f('0x2c')][_0x3a9f('0x2d')]);_0xf83f4b[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x380a5d['query']);_0xf83f4b[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0xf83f4b[_0x3a9f('0x30')],_0xf83f4b[_0x3a9f('0x31')]);_0x317653[_0x3a9f('0x34')]=_['intersection'](_0xf83f4b[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x380a5d['query'][_0x3a9f('0x36')]));_0x317653[_0x3a9f('0x34')]=_0x317653[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x317653[_0x3a9f('0x34')]:_0xf83f4b[_0x3a9f('0x30')];if(_0x380a5d['query'][_0x3a9f('0x41')]){_0x317653[_0x3a9f('0x42')]=[{'all':!![]}];}_0x317653=_[_0x3a9f('0x3f')]({},_0x317653,_0x380a5d[_0x3a9f('0x40')]);return db['VtigerConfiguration'][_0x3a9f('0x47')](_0x317653)['then'](handleEntityNotFound(_0x219210,null))[_0x3a9f('0x26')](respondWithResult(_0x219210,null))[_0x3a9f('0x44')](handleError(_0x219210,null));};exports[_0x3a9f('0x48')]=function(_0x1a38f0,_0x27214c){return db[_0x3a9f('0x2c')][_0x3a9f('0x48')](_0x1a38f0[_0x3a9f('0x49')],{})[_0x3a9f('0x26')](respondWithResult(_0x27214c,0xc9))[_0x3a9f('0x44')](handleError(_0x27214c,null));};exports[_0x3a9f('0x25')]=function(_0x46e5d2,_0x28279a){if(_0x46e5d2[_0x3a9f('0x49')]['id']){delete _0x46e5d2[_0x3a9f('0x49')]['id'];}return db['VtigerConfiguration'][_0x3a9f('0x47')]({'where':{'id':_0x46e5d2['params']['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x28279a,null))[_0x3a9f('0x26')](saveUpdates(_0x46e5d2[_0x3a9f('0x49')],null))[_0x3a9f('0x26')](respondWithResult(_0x28279a,null))[_0x3a9f('0x44')](handleError(_0x28279a,null));};exports[_0x3a9f('0x4a')]=function(_0x3c668a,_0x1fcc30){return db[_0x3a9f('0x2c')]['find']({'where':{'id':_0x3c668a[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x1fcc30,null))['then'](removeEntity(_0x1fcc30,null))['catch'](handleError(_0x1fcc30,null));};exports[_0x3a9f('0x4b')]=function(_0x4b161d,_0x3a60e2,_0x6af96d){var _0x54f13f={};var _0x516cff={};var _0x3d9287;var _0xedf346;return db[_0x3a9f('0x2c')][_0x3a9f('0x4c')]({'where':{'id':_0x4b161d[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x3a60e2,null))[_0x3a9f('0x26')](function(_0x541f27){if(_0x541f27){_0x3d9287=_0x541f27;_0x516cff[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db[_0x3a9f('0x4d')]['rawAttributes']);_0x516cff[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x4b161d[_0x3a9f('0x31')]);_0x516cff[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0x516cff[_0x3a9f('0x30')],_0x516cff[_0x3a9f('0x31')]);_0x54f13f[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0x516cff[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x4b161d[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x54f13f[_0x3a9f('0x34')]=_0x54f13f['attributes'][_0x3a9f('0x37')]?_0x54f13f[_0x3a9f('0x34')]:_0x516cff['model'];_0x54f13f[_0x3a9f('0x3a')]=qs[_0x3a9f('0x3b')](_0x4b161d[_0x3a9f('0x31')]['sort']);_0x54f13f[_0x3a9f('0x3c')]=qs[_0x3a9f('0x33')](_[_0x3a9f('0x3d')](_0x4b161d[_0x3a9f('0x31')],_0x516cff[_0x3a9f('0x33')]));if(_0x4b161d['query']['filter']){_0x54f13f['where']=_[_0x3a9f('0x3f')](_0x54f13f[_0x3a9f('0x3c')],{'$or':_['map'](_0x54f13f[_0x3a9f('0x34')],function(_0x2019b3){var _0x99679f={};_0x99679f[_0x2019b3]={'$like':'%'+_0x4b161d[_0x3a9f('0x31')][_0x3a9f('0x3e')]+'%'};return _0x99679f;})});}_0x54f13f=_[_0x3a9f('0x3f')]({},_0x54f13f,_0x4b161d[_0x3a9f('0x40')]);return _0x3d9287['getFields'](_0x54f13f);}})[_0x3a9f('0x26')](function(_0x5f7df5){if(_0x5f7df5){_0xedf346=_0x5f7df5[_0x3a9f('0x37')];if(!_0x4b161d['query'][_0x3a9f('0x38')](_0x3a9f('0x39'))){_0x54f13f[_0x3a9f('0x1f')]=qs[_0x3a9f('0x1f')](_0x4b161d[_0x3a9f('0x31')]['limit']);_0x54f13f[_0x3a9f('0x1e')]=qs[_0x3a9f('0x1e')](_0x4b161d[_0x3a9f('0x31')][_0x3a9f('0x1e')]);}return _0x3d9287[_0x3a9f('0x4b')](_0x54f13f);}})[_0x3a9f('0x26')](function(_0x588d58){if(_0x588d58){return _0x588d58?{'count':_0xedf346,'rows':_0x588d58}:null;}})['then'](respondWithResult(_0x3a60e2,null))['catch'](handleError(_0x3a60e2,null));};exports['getSubjects']=function(_0x4539ab,_0x36b0a7,_0x471691){var _0x5d64e3={};var _0x84029d={};var _0x18b332;var _0x41e744;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x4539ab[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x36b0a7,null))[_0x3a9f('0x26')](function(_0x408df5){if(_0x408df5){_0x18b332=_0x408df5;_0x84029d[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db['VtigerField'][_0x3a9f('0x2d')]);_0x84029d['query']=_[_0x3a9f('0x32')](_0x4539ab[_0x3a9f('0x31')]);_0x84029d[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0x84029d[_0x3a9f('0x30')],_0x84029d['query']);_0x5d64e3[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0x84029d[_0x3a9f('0x30')],qs['fields'](_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x5d64e3['attributes']=_0x5d64e3[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x5d64e3['attributes']:_0x84029d[_0x3a9f('0x30')];_0x5d64e3[_0x3a9f('0x3a')]=qs[_0x3a9f('0x3b')](_0x4539ab['query']['sort']);_0x5d64e3['where']=qs[_0x3a9f('0x33')](_[_0x3a9f('0x3d')](_0x4539ab[_0x3a9f('0x31')],_0x84029d[_0x3a9f('0x33')]));if(_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x3e')]){_0x5d64e3[_0x3a9f('0x3c')]=_[_0x3a9f('0x3f')](_0x5d64e3[_0x3a9f('0x3c')],{'$or':_[_0x3a9f('0x2b')](_0x5d64e3[_0x3a9f('0x34')],function(_0x4561e3){var _0x5ed001={};_0x5ed001[_0x4561e3]={'$like':'%'+_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x3e')]+'%'};return _0x5ed001;})});}_0x5d64e3=_['merge']({},_0x5d64e3,_0x4539ab[_0x3a9f('0x40')]);return _0x18b332[_0x3a9f('0x4e')](_0x5d64e3);}})[_0x3a9f('0x26')](function(_0x303c11){if(_0x303c11){_0x41e744=_0x303c11[_0x3a9f('0x37')];if(!_0x4539ab['query']['hasOwnProperty'](_0x3a9f('0x39'))){_0x5d64e3[_0x3a9f('0x1f')]=qs[_0x3a9f('0x1f')](_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x1f')]);_0x5d64e3[_0x3a9f('0x1e')]=qs['offset'](_0x4539ab['query'][_0x3a9f('0x1e')]);}return _0x18b332[_0x3a9f('0x4e')](_0x5d64e3);}})[_0x3a9f('0x26')](function(_0x24dabf){if(_0x24dabf){return _0x24dabf?{'count':_0x41e744,'rows':_0x24dabf}:null;}})[_0x3a9f('0x26')](respondWithResult(_0x36b0a7,null))[_0x3a9f('0x44')](handleError(_0x36b0a7,null));};exports[_0x3a9f('0x4f')]=function(_0x2ce31a,_0x1692ed,_0x48ff50){var _0x36cbc0={};var _0xae8e70={};var _0x14fe0d;var _0x351105;return db[_0x3a9f('0x2c')][_0x3a9f('0x4c')]({'where':{'id':_0x2ce31a[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x1692ed,null))['then'](function(_0x525c00){if(_0x525c00){_0x14fe0d=_0x525c00;_0xae8e70[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db[_0x3a9f('0x4d')][_0x3a9f('0x2d')]);_0xae8e70[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x2ce31a[_0x3a9f('0x31')]);_0xae8e70[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0xae8e70[_0x3a9f('0x30')],_0xae8e70[_0x3a9f('0x31')]);_0x36cbc0[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0xae8e70[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x36cbc0[_0x3a9f('0x34')]=_0x36cbc0[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x36cbc0[_0x3a9f('0x34')]:_0xae8e70['model'];_0x36cbc0['order']=qs[_0x3a9f('0x3b')](_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x3b')]);_0x36cbc0[_0x3a9f('0x3c')]=qs['filters'](_['pick'](_0x2ce31a[_0x3a9f('0x31')],_0xae8e70[_0x3a9f('0x33')]));if(_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x3e')]){_0x36cbc0[_0x3a9f('0x3c')]=_[_0x3a9f('0x3f')](_0x36cbc0[_0x3a9f('0x3c')],{'$or':_[_0x3a9f('0x2b')](_0x36cbc0[_0x3a9f('0x34')],function(_0x418da2){var _0x289a62={};_0x289a62[_0x418da2]={'$like':'%'+_0x2ce31a['query'][_0x3a9f('0x3e')]+'%'};return _0x289a62;})});}_0x36cbc0=_[_0x3a9f('0x3f')]({},_0x36cbc0,_0x2ce31a['options']);return _0x14fe0d[_0x3a9f('0x4f')](_0x36cbc0);}})['then'](function(_0x3008bf){if(_0x3008bf){_0x351105=_0x3008bf['length'];if(!_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x38')](_0x3a9f('0x39'))){_0x36cbc0[_0x3a9f('0x1f')]=qs[_0x3a9f('0x1f')](_0x2ce31a['query'][_0x3a9f('0x1f')]);_0x36cbc0[_0x3a9f('0x1e')]=qs[_0x3a9f('0x1e')](_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x1e')]);}return _0x14fe0d[_0x3a9f('0x4f')](_0x36cbc0);}})[_0x3a9f('0x26')](function(_0xd30ee1){if(_0xd30ee1){return _0xd30ee1?{'count':_0x351105,'rows':_0xd30ee1}:null;}})[_0x3a9f('0x26')](respondWithResult(_0x1692ed,null))[_0x3a9f('0x44')](handleError(_0x1692ed,null));}; \ No newline at end of file +var _0x3437=['moment','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','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','find','create','body','getFields','findOne','options','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3ea8ed,_0x4f8e08){var _0xfa0d63=function(_0x266c8f){while(--_0x266c8f){_0x3ea8ed['push'](_0x3ea8ed['shift']());}};_0xfa0d63(++_0x4f8e08);}(_0x3437,0x19b));var _0x7343=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3437[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7343('0x0'));var zipdir=require(_0x7343('0x1'));var jsonpatch=require(_0x7343('0x2'));var rp=require(_0x7343('0x3'));var moment=require(_0x7343('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7343('0x5'));var util=require(_0x7343('0x6'));var path=require(_0x7343('0x7'));var sox=require('sox');var csv=require(_0x7343('0x8'));var ejs=require(_0x7343('0x9'));var fs=require('fs');var fs_extra=require(_0x7343('0xa'));var _=require('lodash');var squel=require(_0x7343('0xb'));var crypto=require(_0x7343('0xc'));var jsforce=require(_0x7343('0xd'));var deskjs=require(_0x7343('0xe'));var toCsv=require(_0x7343('0x8'));var querystring=require(_0x7343('0xf'));var Papa=require(_0x7343('0x10'));var Redis=require(_0x7343('0x11'));var authService=require(_0x7343('0x12'));var qs=require(_0x7343('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7343('0x14'));var logger=require(_0x7343('0x15'))(_0x7343('0x16'));var utils=require(_0x7343('0x17'));var config=require(_0x7343('0x18'));var licenseUtil=require(_0x7343('0x19'));var db=require(_0x7343('0x1a'))['db'];function respondWithStatusCode(_0x5df5f8,_0x17d695){_0x17d695=_0x17d695||0xcc;return function(_0x29b4d8){if(_0x29b4d8){return _0x5df5f8['sendStatus'](_0x17d695);}return _0x5df5f8[_0x7343('0x1b')](_0x17d695)[_0x7343('0x1c')]();};}function respondWithResult(_0x235d4d,_0x11e800){_0x11e800=_0x11e800||0xc8;return function(_0x3769e5){if(_0x3769e5){return _0x235d4d[_0x7343('0x1b')](_0x11e800)[_0x7343('0x1d')](_0x3769e5);}};}function respondWithFilteredResult(_0x51e3b0,_0x170a6a){return function(_0x176949){if(_0x176949){var _0x383fea=typeof _0x170a6a[_0x7343('0x1e')]===_0x7343('0x1f')&&typeof _0x170a6a[_0x7343('0x20')]===_0x7343('0x1f');var _0x3f9a2b=_0x176949[_0x7343('0x21')];var _0x2e4830=_0x383fea?0x0:_0x170a6a['offset'];var _0x58117d=_0x383fea?_0x176949[_0x7343('0x21')]:_0x170a6a[_0x7343('0x1e')]+_0x170a6a['limit'];var _0x53d002;if(_0x58117d>=_0x3f9a2b){_0x58117d=_0x3f9a2b;_0x53d002=0xc8;}else{_0x53d002=0xce;}_0x51e3b0['status'](_0x53d002);return _0x51e3b0[_0x7343('0x22')]('Content-Range',_0x2e4830+'-'+_0x58117d+'/'+_0x3f9a2b)[_0x7343('0x1d')](_0x176949);}return null;};}function patchUpdates(_0x2a7d9b){return function(_0x57c6b0){try{jsonpatch[_0x7343('0x23')](_0x57c6b0,_0x2a7d9b,!![]);}catch(_0x2a53db){return BPromise['reject'](_0x2a53db);}return _0x57c6b0[_0x7343('0x24')]();};}function saveUpdates(_0x48c772,_0x255e2a){return function(_0x1b1a1d){if(_0x1b1a1d){return _0x1b1a1d[_0x7343('0x25')](_0x48c772)[_0x7343('0x26')](function(_0x350ffb){return _0x350ffb;});}return null;};}function removeEntity(_0x6fbbd5,_0x4a25ec){return function(_0xdf3ae5){if(_0xdf3ae5){return _0xdf3ae5[_0x7343('0x27')]()[_0x7343('0x26')](function(){_0x6fbbd5[_0x7343('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c4a0a,_0xdf4c21){return function(_0x36b331){if(!_0x36b331){_0x1c4a0a[_0x7343('0x28')](0x194);}return _0x36b331;};}function handleError(_0x139d4e,_0x5c15fd){_0x5c15fd=_0x5c15fd||0x1f4;return function(_0xaffde1){logger[_0x7343('0x29')](_0xaffde1[_0x7343('0x2a')]);if(_0xaffde1[_0x7343('0x2b')]){delete _0xaffde1['name'];}_0x139d4e[_0x7343('0x1b')](_0x5c15fd)[_0x7343('0x2c')](_0xaffde1);};}exports[_0x7343('0x2d')]=function(_0x4840c8,_0x495686){var _0x2118b2={},_0x1d451f={},_0x2a9883={'count':0x0,'rows':[]};var _0x342041=_[_0x7343('0x2e')](db[_0x7343('0x2f')][_0x7343('0x30')],function(_0xf429b1){return{'name':_0xf429b1[_0x7343('0x31')],'type':_0xf429b1[_0x7343('0x32')][_0x7343('0x33')]};});_0x1d451f[_0x7343('0x34')]=_[_0x7343('0x2e')](_0x342041,_0x7343('0x2b'));_0x1d451f[_0x7343('0x35')]=_[_0x7343('0x36')](_0x4840c8[_0x7343('0x35')]);_0x1d451f[_0x7343('0x37')]=_[_0x7343('0x38')](_0x1d451f['model'],_0x1d451f['query']);_0x2118b2[_0x7343('0x39')]=_['intersection'](_0x1d451f[_0x7343('0x34')],qs[_0x7343('0x3a')](_0x4840c8['query'][_0x7343('0x3a')]));_0x2118b2[_0x7343('0x39')]=_0x2118b2['attributes'][_0x7343('0x3b')]?_0x2118b2[_0x7343('0x39')]:_0x1d451f['model'];if(!_0x4840c8[_0x7343('0x35')][_0x7343('0x3c')](_0x7343('0x3d'))){_0x2118b2[_0x7343('0x20')]=qs[_0x7343('0x20')](_0x4840c8[_0x7343('0x35')][_0x7343('0x20')]);_0x2118b2[_0x7343('0x1e')]=qs[_0x7343('0x1e')](_0x4840c8[_0x7343('0x35')][_0x7343('0x1e')]);}_0x2118b2[_0x7343('0x3e')]=qs[_0x7343('0x3f')](_0x4840c8['query']['sort']);_0x2118b2[_0x7343('0x40')]=qs[_0x7343('0x37')](_[_0x7343('0x41')](_0x4840c8[_0x7343('0x35')],_0x1d451f['filters']),_0x342041);if(_0x4840c8[_0x7343('0x35')][_0x7343('0x42')]){_0x2118b2[_0x7343('0x40')]=_[_0x7343('0x43')](_0x2118b2[_0x7343('0x40')],{'$or':_[_0x7343('0x2e')](_0x342041,function(_0x5758ae){if(_0x5758ae[_0x7343('0x32')]!==_0x7343('0x44')){var _0x19f7a8={};_0x19f7a8[_0x5758ae[_0x7343('0x2b')]]={'$like':'%'+_0x4840c8[_0x7343('0x35')]['filter']+'%'};return _0x19f7a8;}})});}_0x2118b2=_['merge']({},_0x2118b2,_0x4840c8['options']);var _0x324bb3={'where':_0x2118b2['where']};return db[_0x7343('0x2f')]['count'](_0x324bb3)['then'](function(_0x54e40b){_0x2a9883[_0x7343('0x21')]=_0x54e40b;if(_0x4840c8[_0x7343('0x35')][_0x7343('0x45')]){_0x2118b2[_0x7343('0x46')]=[{'all':!![]}];}return db[_0x7343('0x2f')]['findAll'](_0x2118b2);})['then'](function(_0x200294){_0x2a9883[_0x7343('0x47')]=_0x200294;return _0x2a9883;})[_0x7343('0x26')](respondWithFilteredResult(_0x495686,_0x2118b2))[_0x7343('0x48')](handleError(_0x495686,null));};exports['show']=function(_0x450eca,_0x25aaa9){var _0x25fa79={'raw':![],'where':{'id':_0x450eca[_0x7343('0x49')]['id']}},_0x28f487={};_0x28f487[_0x7343('0x34')]=_[_0x7343('0x36')](db[_0x7343('0x2f')][_0x7343('0x30')]);_0x28f487[_0x7343('0x35')]=_[_0x7343('0x36')](_0x450eca['query']);_0x28f487['filters']=_[_0x7343('0x38')](_0x28f487[_0x7343('0x34')],_0x28f487[_0x7343('0x35')]);_0x25fa79['attributes']=_[_0x7343('0x38')](_0x28f487['model'],qs[_0x7343('0x3a')](_0x450eca['query'][_0x7343('0x3a')]));_0x25fa79[_0x7343('0x39')]=_0x25fa79[_0x7343('0x39')][_0x7343('0x3b')]?_0x25fa79[_0x7343('0x39')]:_0x28f487[_0x7343('0x34')];if(_0x450eca['query']['includeAll']){_0x25fa79[_0x7343('0x46')]=[{'all':!![]}];}_0x25fa79=_[_0x7343('0x43')]({},_0x25fa79,_0x450eca['options']);return db[_0x7343('0x2f')][_0x7343('0x4a')](_0x25fa79)['then'](handleEntityNotFound(_0x25aaa9,null))['then'](respondWithResult(_0x25aaa9,null))[_0x7343('0x48')](handleError(_0x25aaa9,null));};exports[_0x7343('0x4b')]=function(_0xc88a1d,_0x138f34){return db[_0x7343('0x2f')][_0x7343('0x4b')](_0xc88a1d['body'],{})[_0x7343('0x26')](respondWithResult(_0x138f34,0xc9))['catch'](handleError(_0x138f34,null));};exports[_0x7343('0x25')]=function(_0x368012,_0x2302c1){if(_0x368012[_0x7343('0x4c')]['id']){delete _0x368012[_0x7343('0x4c')]['id'];}return db[_0x7343('0x2f')][_0x7343('0x4a')]({'where':{'id':_0x368012[_0x7343('0x49')]['id']}})[_0x7343('0x26')](handleEntityNotFound(_0x2302c1,null))[_0x7343('0x26')](saveUpdates(_0x368012[_0x7343('0x4c')],null))[_0x7343('0x26')](respondWithResult(_0x2302c1,null))['catch'](handleError(_0x2302c1,null));};exports['destroy']=function(_0x15aa56,_0xcd393f){return db['VtigerConfiguration']['find']({'where':{'id':_0x15aa56[_0x7343('0x49')]['id']}})[_0x7343('0x26')](handleEntityNotFound(_0xcd393f,null))[_0x7343('0x26')](removeEntity(_0xcd393f,null))[_0x7343('0x48')](handleError(_0xcd393f,null));};exports[_0x7343('0x4d')]=function(_0x274af0,_0x2d6131,_0x420fad){var _0x4bcdb1={};var _0x388976={};var _0x4025dd;var _0x58bad3;return db['VtigerConfiguration'][_0x7343('0x4e')]({'where':{'id':_0x274af0[_0x7343('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d6131,null))['then'](function(_0x50c897){if(_0x50c897){_0x4025dd=_0x50c897;_0x388976[_0x7343('0x34')]=_[_0x7343('0x36')](db['VtigerField'][_0x7343('0x30')]);_0x388976['query']=_[_0x7343('0x36')](_0x274af0[_0x7343('0x35')]);_0x388976[_0x7343('0x37')]=_['intersection'](_0x388976['model'],_0x388976[_0x7343('0x35')]);_0x4bcdb1['attributes']=_['intersection'](_0x388976[_0x7343('0x34')],qs[_0x7343('0x3a')](_0x274af0['query'][_0x7343('0x3a')]));_0x4bcdb1[_0x7343('0x39')]=_0x4bcdb1[_0x7343('0x39')][_0x7343('0x3b')]?_0x4bcdb1['attributes']:_0x388976[_0x7343('0x34')];_0x4bcdb1[_0x7343('0x3e')]=qs[_0x7343('0x3f')](_0x274af0[_0x7343('0x35')][_0x7343('0x3f')]);_0x4bcdb1[_0x7343('0x40')]=qs[_0x7343('0x37')](_[_0x7343('0x41')](_0x274af0[_0x7343('0x35')],_0x388976[_0x7343('0x37')]));if(_0x274af0[_0x7343('0x35')][_0x7343('0x42')]){_0x4bcdb1['where']=_[_0x7343('0x43')](_0x4bcdb1[_0x7343('0x40')],{'$or':_['map'](_0x4bcdb1[_0x7343('0x39')],function(_0x37b5cc){var _0xb1bfd3={};_0xb1bfd3[_0x37b5cc]={'$like':'%'+_0x274af0[_0x7343('0x35')][_0x7343('0x42')]+'%'};return _0xb1bfd3;})});}_0x4bcdb1=_['merge']({},_0x4bcdb1,_0x274af0[_0x7343('0x4f')]);return _0x4025dd[_0x7343('0x4d')](_0x4bcdb1);}})[_0x7343('0x26')](function(_0x31bee1){if(_0x31bee1){_0x58bad3=_0x31bee1['length'];if(!_0x274af0['query'][_0x7343('0x3c')]('nolimit')){_0x4bcdb1[_0x7343('0x20')]=qs[_0x7343('0x20')](_0x274af0['query']['limit']);_0x4bcdb1[_0x7343('0x1e')]=qs[_0x7343('0x1e')](_0x274af0[_0x7343('0x35')][_0x7343('0x1e')]);}return _0x4025dd['getFields'](_0x4bcdb1);}})['then'](function(_0x10a81a){if(_0x10a81a){return _0x10a81a?{'count':_0x58bad3,'rows':_0x10a81a}:null;}})[_0x7343('0x26')](respondWithResult(_0x2d6131,null))[_0x7343('0x48')](handleError(_0x2d6131,null));};exports['getSubjects']=function(_0x4ad4d5,_0x2459b4,_0x1475f2){var _0x469610={};var _0x58b598={};var _0x3d18b8;var _0x4ef22b;return db[_0x7343('0x2f')]['findOne']({'where':{'id':_0x4ad4d5[_0x7343('0x49')]['id']}})[_0x7343('0x26')](handleEntityNotFound(_0x2459b4,null))[_0x7343('0x26')](function(_0x44978e){if(_0x44978e){_0x3d18b8=_0x44978e;_0x58b598[_0x7343('0x34')]=_[_0x7343('0x36')](db[_0x7343('0x50')][_0x7343('0x30')]);_0x58b598[_0x7343('0x35')]=_[_0x7343('0x36')](_0x4ad4d5[_0x7343('0x35')]);_0x58b598[_0x7343('0x37')]=_[_0x7343('0x38')](_0x58b598[_0x7343('0x34')],_0x58b598['query']);_0x469610[_0x7343('0x39')]=_[_0x7343('0x38')](_0x58b598['model'],qs[_0x7343('0x3a')](_0x4ad4d5[_0x7343('0x35')]['fields']));_0x469610[_0x7343('0x39')]=_0x469610[_0x7343('0x39')]['length']?_0x469610[_0x7343('0x39')]:_0x58b598[_0x7343('0x34')];_0x469610['order']=qs[_0x7343('0x3f')](_0x4ad4d5['query']['sort']);_0x469610[_0x7343('0x40')]=qs[_0x7343('0x37')](_[_0x7343('0x41')](_0x4ad4d5[_0x7343('0x35')],_0x58b598[_0x7343('0x37')]));if(_0x4ad4d5[_0x7343('0x35')][_0x7343('0x42')]){_0x469610[_0x7343('0x40')]=_['merge'](_0x469610['where'],{'$or':_[_0x7343('0x2e')](_0x469610[_0x7343('0x39')],function(_0x2a4713){var _0x380c41={};_0x380c41[_0x2a4713]={'$like':'%'+_0x4ad4d5[_0x7343('0x35')][_0x7343('0x42')]+'%'};return _0x380c41;})});}_0x469610=_[_0x7343('0x43')]({},_0x469610,_0x4ad4d5[_0x7343('0x4f')]);return _0x3d18b8['getSubjects'](_0x469610);}})[_0x7343('0x26')](function(_0x3bb705){if(_0x3bb705){_0x4ef22b=_0x3bb705[_0x7343('0x3b')];if(!_0x4ad4d5[_0x7343('0x35')][_0x7343('0x3c')]('nolimit')){_0x469610[_0x7343('0x20')]=qs['limit'](_0x4ad4d5[_0x7343('0x35')][_0x7343('0x20')]);_0x469610[_0x7343('0x1e')]=qs['offset'](_0x4ad4d5[_0x7343('0x35')][_0x7343('0x1e')]);}return _0x3d18b8[_0x7343('0x51')](_0x469610);}})[_0x7343('0x26')](function(_0x226915){if(_0x226915){return _0x226915?{'count':_0x4ef22b,'rows':_0x226915}:null;}})[_0x7343('0x26')](respondWithResult(_0x2459b4,null))[_0x7343('0x48')](handleError(_0x2459b4,null));};exports[_0x7343('0x52')]=function(_0x3e01fc,_0x1b6e88,_0x5b3d3e){var _0x1d4d34={};var _0x299420={};var _0x4e26a5;var _0x4ba3a5;return db[_0x7343('0x2f')][_0x7343('0x4e')]({'where':{'id':_0x3e01fc['params']['id']}})['then'](handleEntityNotFound(_0x1b6e88,null))['then'](function(_0x3cd78f){if(_0x3cd78f){_0x4e26a5=_0x3cd78f;_0x299420[_0x7343('0x34')]=_[_0x7343('0x36')](db[_0x7343('0x50')]['rawAttributes']);_0x299420[_0x7343('0x35')]=_[_0x7343('0x36')](_0x3e01fc[_0x7343('0x35')]);_0x299420[_0x7343('0x37')]=_[_0x7343('0x38')](_0x299420[_0x7343('0x34')],_0x299420[_0x7343('0x35')]);_0x1d4d34['attributes']=_[_0x7343('0x38')](_0x299420[_0x7343('0x34')],qs[_0x7343('0x3a')](_0x3e01fc[_0x7343('0x35')]['fields']));_0x1d4d34[_0x7343('0x39')]=_0x1d4d34[_0x7343('0x39')][_0x7343('0x3b')]?_0x1d4d34[_0x7343('0x39')]:_0x299420[_0x7343('0x34')];_0x1d4d34[_0x7343('0x3e')]=qs['sort'](_0x3e01fc[_0x7343('0x35')][_0x7343('0x3f')]);_0x1d4d34[_0x7343('0x40')]=qs['filters'](_[_0x7343('0x41')](_0x3e01fc[_0x7343('0x35')],_0x299420['filters']));if(_0x3e01fc[_0x7343('0x35')][_0x7343('0x42')]){_0x1d4d34[_0x7343('0x40')]=_[_0x7343('0x43')](_0x1d4d34[_0x7343('0x40')],{'$or':_[_0x7343('0x2e')](_0x1d4d34[_0x7343('0x39')],function(_0x312c55){var _0x20c4d4={};_0x20c4d4[_0x312c55]={'$like':'%'+_0x3e01fc[_0x7343('0x35')][_0x7343('0x42')]+'%'};return _0x20c4d4;})});}_0x1d4d34=_[_0x7343('0x43')]({},_0x1d4d34,_0x3e01fc['options']);return _0x4e26a5[_0x7343('0x52')](_0x1d4d34);}})[_0x7343('0x26')](function(_0x4588bc){if(_0x4588bc){_0x4ba3a5=_0x4588bc[_0x7343('0x3b')];if(!_0x3e01fc['query'][_0x7343('0x3c')](_0x7343('0x3d'))){_0x1d4d34[_0x7343('0x20')]=qs[_0x7343('0x20')](_0x3e01fc[_0x7343('0x35')][_0x7343('0x20')]);_0x1d4d34[_0x7343('0x1e')]=qs[_0x7343('0x1e')](_0x3e01fc[_0x7343('0x35')][_0x7343('0x1e')]);}return _0x4e26a5[_0x7343('0x52')](_0x1d4d34);}})[_0x7343('0x26')](function(_0x4733f0){if(_0x4733f0){return _0x4733f0?{'count':_0x4ba3a5,'rows':_0x4733f0}:null;}})[_0x7343('0x26')](respondWithResult(_0x1b6e88,null))['catch'](handleError(_0x1b6e88,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9b5f355..9d33a7c 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 _0x1498=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes'];(function(_0x5a306f,_0x335e7c){var _0x5deddd=function(_0x4d629d){while(--_0x4d629d){_0x5a306f['push'](_0x5a306f['shift']());}};_0x5deddd(++_0x335e7c);}(_0x1498,0x12a));var _0x8149=function(_0x5b0ec4,_0x223344){_0x5b0ec4=_0x5b0ec4-0x0;var _0x1de924=_0x1498[_0x5b0ec4];return _0x1de924;};'use strict';var _=require(_0x8149('0x0'));var util=require(_0x8149('0x1'));var logger=require(_0x8149('0x2'))(_0x8149('0x3'));var moment=require(_0x8149('0x4'));var BPromise=require(_0x8149('0x5'));var rp=require(_0x8149('0x6'));var fs=require('fs');var path=require(_0x8149('0x7'));var rimraf=require(_0x8149('0x8'));var config=require('../../config/environment');var attributes=require(_0x8149('0x9'));module[_0x8149('0xa')]=function(_0x435478,_0x30d74a){return _0x435478[_0x8149('0xb')](_0x8149('0xc'),attributes,{'tableName':_0x8149('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cb4=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x441b56,_0xcc660a){var _0x355ade=function(_0xb7fd4e){while(--_0xb7fd4e){_0x441b56['push'](_0x441b56['shift']());}};_0x355ade(++_0xcc660a);}(_0x4cb4,0x1ef));var _0x44cb=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x4cb4[_0x265003];return _0x33c743;};'use strict';var _=require(_0x44cb('0x0'));var util=require(_0x44cb('0x1'));var logger=require('../../config/logger')(_0x44cb('0x2'));var moment=require(_0x44cb('0x3'));var BPromise=require(_0x44cb('0x4'));var rp=require(_0x44cb('0x5'));var fs=require('fs');var path=require(_0x44cb('0x6'));var rimraf=require(_0x44cb('0x7'));var config=require(_0x44cb('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x44cb('0x9')]=function(_0x7a10a0,_0x113ed0){return _0x7a10a0[_0x44cb('0xa')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index d2b97f4..8cf9f5e 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 _0x0739=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x392890,_0xb8d3dd){var _0x2b2e30=function(_0x4b355f){while(--_0x4b355f){_0x392890['push'](_0x392890['shift']());}};_0x2b2e30(++_0xb8d3dd);}(_0x0739,0xf7));var _0x9073=function(_0x553000,_0x4b62a0){_0x553000=_0x553000-0x0;var _0xd1d187=_0x0739[_0x553000];return _0xd1d187;};'use strict';var _=require(_0x9073('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9073('0x1'));var fs=require('fs');var Redis=require(_0x9073('0x2'));var db=require(_0x9073('0x3'))['db'];var utils=require(_0x9073('0x4'));var logger=require(_0x9073('0x5'))(_0x9073('0x6'));var config=require(_0x9073('0x7'));var jayson=require(_0x9073('0x8'));var client=jayson[_0x9073('0x9')][_0x9073('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39fec5,_0x47395c,_0x2f077b){return new BPromise(function(_0x54b19f,_0x394891){return client[_0x9073('0xb')](_0x39fec5,_0x2f077b)[_0x9073('0xc')](function(_0x4d1c5d){logger[_0x9073('0xd')](_0x9073('0xe'),_0x47395c,_0x9073('0xf'));logger[_0x9073('0x10')](_0x9073('0x11'),_0x47395c,'request\x20sent',JSON[_0x9073('0x12')](_0x4d1c5d));if(_0x4d1c5d[_0x9073('0x13')]){if(_0x4d1c5d['error'][_0x9073('0x14')]===0x1f4){logger[_0x9073('0x13')](_0x9073('0xe'),_0x47395c,_0x4d1c5d[_0x9073('0x13')]['message']);return _0x394891(_0x4d1c5d[_0x9073('0x13')][_0x9073('0x15')]);}logger[_0x9073('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x47395c,_0x4d1c5d[_0x9073('0x13')][_0x9073('0x15')]);return _0x54b19f(_0x4d1c5d[_0x9073('0x13')][_0x9073('0x15')]);}else{logger[_0x9073('0xd')](_0x9073('0xe'),_0x47395c,_0x9073('0xf'));_0x54b19f(_0x4d1c5d[_0x9073('0x16')][_0x9073('0x15')]);}})[_0x9073('0x17')](function(_0x58649f){logger[_0x9073('0x13')](_0x9073('0xe'),_0x47395c,_0x58649f);_0x394891(_0x58649f);});});} \ No newline at end of file +var _0x0c94=['jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x17d050,_0x28e6d8){var _0x56351d=function(_0x491fbd){while(--_0x491fbd){_0x17d050['push'](_0x17d050['shift']());}};_0x56351d(++_0x28e6d8);}(_0x0c94,0x1dc));var _0x40c9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0c94[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x40c9('0x0'));var BPromise=require(_0x40c9('0x1'));var rs=require(_0x40c9('0x2'));var fs=require('fs');var Redis=require(_0x40c9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x40c9('0x4'));var logger=require(_0x40c9('0x5'))(_0x40c9('0x6'));var config=require(_0x40c9('0x7'));var jayson=require(_0x40c9('0x8'));var client=jayson[_0x40c9('0x9')][_0x40c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25c179,_0x2c2371,_0x7be91d){return new BPromise(function(_0x3278c6,_0x979905){return client[_0x40c9('0xb')](_0x25c179,_0x7be91d)[_0x40c9('0xc')](function(_0x1da303){logger['info'](_0x40c9('0xd'),_0x2c2371,_0x40c9('0xe'));logger['debug'](_0x40c9('0xf'),_0x2c2371,'request\x20sent',JSON[_0x40c9('0x10')](_0x1da303));if(_0x1da303[_0x40c9('0x11')]){if(_0x1da303[_0x40c9('0x11')][_0x40c9('0x12')]===0x1f4){logger['error'](_0x40c9('0xd'),_0x2c2371,_0x1da303['error'][_0x40c9('0x13')]);return _0x979905(_0x1da303[_0x40c9('0x11')]['message']);}logger[_0x40c9('0x11')](_0x40c9('0xd'),_0x2c2371,_0x1da303['error'][_0x40c9('0x13')]);return _0x3278c6(_0x1da303[_0x40c9('0x11')][_0x40c9('0x13')]);}else{logger['info'](_0x40c9('0xd'),_0x2c2371,_0x40c9('0xe'));_0x3278c6(_0x1da303[_0x40c9('0x14')][_0x40c9('0x13')]);}})[_0x40c9('0x15')](function(_0x1f107e){logger[_0x40c9('0x11')](_0x40c9('0xd'),_0x2c2371,_0x1f107e);_0x979905(_0x1f107e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7995ca0..8a444d7 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 _0x8974=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','destroy','exports','multer','util','path'];(function(_0xf7c8aa,_0x5cfbfd){var _0xd88374=function(_0x265993){while(--_0x265993){_0xf7c8aa['push'](_0xf7c8aa['shift']());}};_0xd88374(++_0x5cfbfd);}(_0x8974,0x153));var _0x4897=function(_0x367f9a,_0x5492c9){_0x367f9a=_0x367f9a-0x0;var _0x3db1c5=_0x8974[_0x367f9a];return _0x3db1c5;};'use strict';var multer=require(_0x4897('0x0'));var util=require(_0x4897('0x1'));var path=require(_0x4897('0x2'));var timeout=require('connect-timeout');var express=require(_0x4897('0x3'));var router=express[_0x4897('0x4')]();var fs_extra=require(_0x4897('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4897('0x6'));var config=require(_0x4897('0x7'));var controller=require(_0x4897('0x8'));router['get']('/',auth[_0x4897('0x9')](),controller[_0x4897('0xa')]);router[_0x4897('0xb')](_0x4897('0xc'),auth[_0x4897('0x9')](),controller[_0x4897('0xd')]);router[_0x4897('0xe')]('/',auth[_0x4897('0x9')](),controller[_0x4897('0xf')]);router['put'](_0x4897('0xc'),auth[_0x4897('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4897('0x10')]);module[_0x4897('0x11')]=router; \ No newline at end of file +var _0x64c8=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x197a58,_0x374125){var _0x352f4a=function(_0x33245a){while(--_0x33245a){_0x197a58['push'](_0x197a58['shift']());}};_0x352f4a(++_0x374125);}(_0x64c8,0x1ec));var _0x864c=function(_0x3a9213,_0xb8443e){_0x3a9213=_0x3a9213-0x0;var _0x2e5f00=_0x64c8[_0x3a9213];return _0x2e5f00;};'use strict';var multer=require(_0x864c('0x0'));var util=require(_0x864c('0x1'));var path=require(_0x864c('0x2'));var timeout=require(_0x864c('0x3'));var express=require(_0x864c('0x4'));var router=express[_0x864c('0x5')]();var fs_extra=require(_0x864c('0x6'));var auth=require(_0x864c('0x7'));var interaction=require(_0x864c('0x8'));var config=require(_0x864c('0x9'));var controller=require('./intVtigerField.controller');router[_0x864c('0xa')]('/',auth[_0x864c('0xb')](),controller[_0x864c('0xc')]);router['get'](_0x864c('0xd'),auth[_0x864c('0xb')](),controller[_0x864c('0xe')]);router[_0x864c('0xf')]('/',auth[_0x864c('0xb')](),controller['create']);router[_0x864c('0x10')](_0x864c('0xd'),auth[_0x864c('0xb')](),controller[_0x864c('0x11')]);router[_0x864c('0x12')](_0x864c('0xd'),auth[_0x864c('0xb')](),controller[_0x864c('0x13')]);module[_0x864c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index e7be643..fef4fdf 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 _0x16c0=['STRING','variable','customVariable','BOOLEAN','sequelize','ENUM','string','keyValue','picklist'];(function(_0xaf6257,_0xaac94d){var _0x412f87=function(_0x3b6e78){while(--_0x3b6e78){_0xaf6257['push'](_0xaf6257['shift']());}};_0x412f87(++_0xaac94d);}(_0x16c0,0x67));var _0x016c=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x16c0[_0x48b810];return _0x23c17d;};'use strict';var Sequelize=require(_0x016c('0x0'));module['exports']={'type':{'type':Sequelize[_0x016c('0x1')](_0x016c('0x2'),'variable','customVariable',_0x016c('0x3'),_0x016c('0x4')),'defaultValue':_0x016c('0x2')},'content':{'type':Sequelize[_0x016c('0x5')]},'key':{'type':Sequelize[_0x016c('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x016c('0x2'),_0x016c('0x6'),_0x016c('0x7'))},'keyContent':{'type':Sequelize[_0x016c('0x5')]},'idField':{'type':Sequelize[_0x016c('0x5')]},'nameField':{'type':Sequelize[_0x016c('0x5')]},'customField':{'type':Sequelize[_0x016c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9145=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0x9145,0x69));var _0x5914=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9145[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x5914('0x0'));module['exports']={'type':{'type':Sequelize[_0x5914('0x1')](_0x5914('0x2'),_0x5914('0x3'),_0x5914('0x4'),'keyValue',_0x5914('0x5')),'defaultValue':_0x5914('0x2')},'content':{'type':Sequelize[_0x5914('0x6')]},'key':{'type':Sequelize[_0x5914('0x6')]},'keyType':{'type':Sequelize[_0x5914('0x1')](_0x5914('0x2'),_0x5914('0x3'),_0x5914('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5914('0x6')]},'nameField':{'type':Sequelize[_0x5914('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5914('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 781f92f..f05796d 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 _0xbc77=['keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','query'];(function(_0x147f22,_0x3fb477){var _0x480aec=function(_0x42c78d){while(--_0x42c78d){_0x147f22['push'](_0x147f22['shift']());}};_0x480aec(++_0x3fb477);}(_0xbc77,0x140));var _0x7bc7=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xbc77[_0x382e89];return _0x3a1318;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7bc7('0x0'));var zipdir=require(_0x7bc7('0x1'));var jsonpatch=require(_0x7bc7('0x2'));var rp=require(_0x7bc7('0x3'));var moment=require(_0x7bc7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7bc7('0x5'));var util=require(_0x7bc7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7bc7('0x7'));var ejs=require(_0x7bc7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bc7('0x9'));var squel=require(_0x7bc7('0xa'));var crypto=require(_0x7bc7('0xb'));var jsforce=require(_0x7bc7('0xc'));var deskjs=require(_0x7bc7('0xd'));var toCsv=require(_0x7bc7('0x7'));var querystring=require(_0x7bc7('0xe'));var Papa=require(_0x7bc7('0xf'));var Redis=require('ioredis');var authService=require(_0x7bc7('0x10'));var qs=require(_0x7bc7('0x11'));var as=require(_0x7bc7('0x12'));var hardwareService=require(_0x7bc7('0x13'));var logger=require(_0x7bc7('0x14'))(_0x7bc7('0x15'));var utils=require('../../config/utils');var config=require(_0x7bc7('0x16'));var licenseUtil=require(_0x7bc7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2e9d,_0x4dd4c1){_0x4dd4c1=_0x4dd4c1||0xcc;return function(_0xae9648){if(_0xae9648){return _0x4c2e9d[_0x7bc7('0x18')](_0x4dd4c1);}return _0x4c2e9d['status'](_0x4dd4c1)[_0x7bc7('0x19')]();};}function respondWithResult(_0x2afcd0,_0x1a4527){_0x1a4527=_0x1a4527||0xc8;return function(_0xb675be){if(_0xb675be){return _0x2afcd0[_0x7bc7('0x1a')](_0x1a4527)['json'](_0xb675be);}};}function respondWithFilteredResult(_0x375176,_0x4afbb5){return function(_0x86caed){if(_0x86caed){var _0xc3f5aa=typeof _0x4afbb5['offset']===_0x7bc7('0x1b')&&typeof _0x4afbb5[_0x7bc7('0x1c')]==='undefined';var _0x130da4=_0x86caed['count'];var _0xee1b07=_0xc3f5aa?0x0:_0x4afbb5[_0x7bc7('0x1d')];var _0x446336=_0xc3f5aa?_0x86caed[_0x7bc7('0x1e')]:_0x4afbb5[_0x7bc7('0x1d')]+_0x4afbb5[_0x7bc7('0x1c')];var _0x4d9207;if(_0x446336>=_0x130da4){_0x446336=_0x130da4;_0x4d9207=0xc8;}else{_0x4d9207=0xce;}_0x375176[_0x7bc7('0x1a')](_0x4d9207);return _0x375176[_0x7bc7('0x1f')](_0x7bc7('0x20'),_0xee1b07+'-'+_0x446336+'/'+_0x130da4)[_0x7bc7('0x21')](_0x86caed);}return null;};}function patchUpdates(_0x421f22){return function(_0xf1e8c){try{jsonpatch[_0x7bc7('0x22')](_0xf1e8c,_0x421f22,!![]);}catch(_0x54e1d8){return BPromise['reject'](_0x54e1d8);}return _0xf1e8c[_0x7bc7('0x23')]();};}function saveUpdates(_0x2e3193,_0x248d13){return function(_0x28988b){if(_0x28988b){return _0x28988b[_0x7bc7('0x24')](_0x2e3193)[_0x7bc7('0x25')](function(_0x586427){return _0x586427;});}return null;};}function removeEntity(_0x115c98,_0x861af5){return function(_0x3a5d1d){if(_0x3a5d1d){return _0x3a5d1d[_0x7bc7('0x26')]()['then'](function(){_0x115c98[_0x7bc7('0x1a')](0xcc)[_0x7bc7('0x19')]();});}};}function handleEntityNotFound(_0x190dd8,_0x300d4d){return function(_0x699c57){if(!_0x699c57){_0x190dd8[_0x7bc7('0x18')](0x194);}return _0x699c57;};}function handleError(_0x44cd4b,_0x4e21ec){_0x4e21ec=_0x4e21ec||0x1f4;return function(_0xc2d742){logger[_0x7bc7('0x27')](_0xc2d742[_0x7bc7('0x28')]);if(_0xc2d742[_0x7bc7('0x29')]){delete _0xc2d742['name'];}_0x44cd4b[_0x7bc7('0x1a')](_0x4e21ec)[_0x7bc7('0x2a')](_0xc2d742);};}exports[_0x7bc7('0x2b')]=function(_0x42c9ab,_0x1ac298){var _0x4da2cd={},_0x26c77c={},_0x13346c={'count':0x0,'rows':[]};var _0x33c228=_[_0x7bc7('0x2c')](db[_0x7bc7('0x2d')][_0x7bc7('0x2e')],function(_0xbed894){return{'name':_0xbed894['fieldName'],'type':_0xbed894[_0x7bc7('0x2f')][_0x7bc7('0x30')]};});_0x26c77c['model']=_[_0x7bc7('0x2c')](_0x33c228,_0x7bc7('0x29'));_0x26c77c[_0x7bc7('0x31')]=_[_0x7bc7('0x32')](_0x42c9ab['query']);_0x26c77c[_0x7bc7('0x33')]=_[_0x7bc7('0x34')](_0x26c77c['model'],_0x26c77c[_0x7bc7('0x31')]);_0x4da2cd[_0x7bc7('0x35')]=_[_0x7bc7('0x34')](_0x26c77c[_0x7bc7('0x36')],qs[_0x7bc7('0x37')](_0x42c9ab[_0x7bc7('0x31')][_0x7bc7('0x37')]));_0x4da2cd[_0x7bc7('0x35')]=_0x4da2cd[_0x7bc7('0x35')][_0x7bc7('0x38')]?_0x4da2cd[_0x7bc7('0x35')]:_0x26c77c['model'];if(!_0x42c9ab['query']['hasOwnProperty'](_0x7bc7('0x39'))){_0x4da2cd['limit']=qs[_0x7bc7('0x1c')](_0x42c9ab[_0x7bc7('0x31')]['limit']);_0x4da2cd['offset']=qs[_0x7bc7('0x1d')](_0x42c9ab[_0x7bc7('0x31')][_0x7bc7('0x1d')]);}_0x4da2cd['order']=qs[_0x7bc7('0x3a')](_0x42c9ab[_0x7bc7('0x31')][_0x7bc7('0x3a')]);_0x4da2cd[_0x7bc7('0x3b')]=qs['filters'](_[_0x7bc7('0x3c')](_0x42c9ab['query'],_0x26c77c['filters']),_0x33c228);if(_0x42c9ab[_0x7bc7('0x31')][_0x7bc7('0x3d')]){_0x4da2cd['where']=_[_0x7bc7('0x3e')](_0x4da2cd[_0x7bc7('0x3b')],{'$or':_[_0x7bc7('0x2c')](_0x33c228,function(_0x44c2c9){if(_0x44c2c9['type']!==_0x7bc7('0x3f')){var _0x5b9143={};_0x5b9143[_0x44c2c9[_0x7bc7('0x29')]]={'$like':'%'+_0x42c9ab[_0x7bc7('0x31')]['filter']+'%'};return _0x5b9143;}})});}_0x4da2cd=_['merge']({},_0x4da2cd,_0x42c9ab[_0x7bc7('0x40')]);var _0x3239aa={'where':_0x4da2cd['where']};return db[_0x7bc7('0x2d')][_0x7bc7('0x1e')](_0x3239aa)[_0x7bc7('0x25')](function(_0x9e5384){_0x13346c[_0x7bc7('0x1e')]=_0x9e5384;if(_0x42c9ab[_0x7bc7('0x31')][_0x7bc7('0x41')]){_0x4da2cd[_0x7bc7('0x42')]=[{'all':!![]}];}return db[_0x7bc7('0x2d')][_0x7bc7('0x43')](_0x4da2cd);})[_0x7bc7('0x25')](function(_0x22caa7){_0x13346c[_0x7bc7('0x44')]=_0x22caa7;return _0x13346c;})[_0x7bc7('0x25')](respondWithFilteredResult(_0x1ac298,_0x4da2cd))[_0x7bc7('0x45')](handleError(_0x1ac298,null));};exports['show']=function(_0x3b5a07,_0x365545){var _0x6697d2={'raw':!![],'where':{'id':_0x3b5a07['params']['id']}},_0x3c82b4={};_0x3c82b4[_0x7bc7('0x36')]=_['keys'](db[_0x7bc7('0x2d')][_0x7bc7('0x2e')]);_0x3c82b4[_0x7bc7('0x31')]=_[_0x7bc7('0x32')](_0x3b5a07[_0x7bc7('0x31')]);_0x3c82b4['filters']=_[_0x7bc7('0x34')](_0x3c82b4[_0x7bc7('0x36')],_0x3c82b4[_0x7bc7('0x31')]);_0x6697d2[_0x7bc7('0x35')]=_['intersection'](_0x3c82b4[_0x7bc7('0x36')],qs[_0x7bc7('0x37')](_0x3b5a07[_0x7bc7('0x31')][_0x7bc7('0x37')]));_0x6697d2['attributes']=_0x6697d2[_0x7bc7('0x35')][_0x7bc7('0x38')]?_0x6697d2['attributes']:_0x3c82b4['model'];if(_0x3b5a07[_0x7bc7('0x31')][_0x7bc7('0x41')]){_0x6697d2[_0x7bc7('0x42')]=[{'all':!![]}];}_0x6697d2=_[_0x7bc7('0x3e')]({},_0x6697d2,_0x3b5a07[_0x7bc7('0x40')]);return db[_0x7bc7('0x2d')][_0x7bc7('0x46')](_0x6697d2)[_0x7bc7('0x25')](handleEntityNotFound(_0x365545,null))[_0x7bc7('0x25')](respondWithResult(_0x365545,null))[_0x7bc7('0x45')](handleError(_0x365545,null));};exports[_0x7bc7('0x47')]=function(_0x3358c6,_0x53ef2b){return db['VtigerField']['create'](_0x3358c6[_0x7bc7('0x48')],{})[_0x7bc7('0x25')](respondWithResult(_0x53ef2b,0xc9))['catch'](handleError(_0x53ef2b,null));};exports['update']=function(_0x566c21,_0x2d647a){if(_0x566c21[_0x7bc7('0x48')]['id']){delete _0x566c21[_0x7bc7('0x48')]['id'];}return db[_0x7bc7('0x2d')][_0x7bc7('0x46')]({'where':{'id':_0x566c21['params']['id']}})[_0x7bc7('0x25')](handleEntityNotFound(_0x2d647a,null))[_0x7bc7('0x25')](saveUpdates(_0x566c21[_0x7bc7('0x48')],null))[_0x7bc7('0x25')](respondWithResult(_0x2d647a,null))[_0x7bc7('0x45')](handleError(_0x2d647a,null));};exports[_0x7bc7('0x26')]=function(_0x33905a,_0x4231d7){return db[_0x7bc7('0x2d')][_0x7bc7('0x46')]({'where':{'id':_0x33905a[_0x7bc7('0x49')]['id']}})['then'](handleEntityNotFound(_0x4231d7,null))[_0x7bc7('0x25')](removeEntity(_0x4231d7,null))[_0x7bc7('0x45')](handleError(_0x4231d7,null));}; \ No newline at end of file +var _0xfa4e=['body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','VtigerField','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','options','find','update'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xfa4e,0x9b));var _0xefa4=function(_0x415e13,_0x2b495a){_0x415e13=_0x415e13-0x0;var _0xc169bb=_0xfa4e[_0x415e13];return _0xc169bb;};'use strict';var emlformat=require(_0xefa4('0x0'));var rimraf=require(_0xefa4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefa4('0x2'));var rp=require(_0xefa4('0x3'));var moment=require(_0xefa4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xefa4('0x5'));var util=require('util');var path=require(_0xefa4('0x6'));var sox=require(_0xefa4('0x7'));var csv=require(_0xefa4('0x8'));var ejs=require(_0xefa4('0x9'));var fs=require('fs');var fs_extra=require(_0xefa4('0xa'));var _=require(_0xefa4('0xb'));var squel=require('squel');var crypto=require(_0xefa4('0xc'));var jsforce=require(_0xefa4('0xd'));var deskjs=require(_0xefa4('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xefa4('0xf'));var Redis=require(_0xefa4('0x10'));var authService=require(_0xefa4('0x11'));var qs=require(_0xefa4('0x12'));var as=require(_0xefa4('0x13'));var hardwareService=require(_0xefa4('0x14'));var logger=require(_0xefa4('0x15'))(_0xefa4('0x16'));var utils=require(_0xefa4('0x17'));var config=require(_0xefa4('0x18'));var licenseUtil=require(_0xefa4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3945cb,_0x27f337){_0x27f337=_0x27f337||0xcc;return function(_0x3e9a78){if(_0x3e9a78){return _0x3945cb[_0xefa4('0x1a')](_0x27f337);}return _0x3945cb[_0xefa4('0x1b')](_0x27f337)[_0xefa4('0x1c')]();};}function respondWithResult(_0x5e3471,_0x88a643){_0x88a643=_0x88a643||0xc8;return function(_0x387654){if(_0x387654){return _0x5e3471[_0xefa4('0x1b')](_0x88a643)[_0xefa4('0x1d')](_0x387654);}};}function respondWithFilteredResult(_0x1f7c40,_0x17dd94){return function(_0x1d7f00){if(_0x1d7f00){var _0x16bcf0=typeof _0x17dd94['offset']==='undefined'&&typeof _0x17dd94[_0xefa4('0x1e')]===_0xefa4('0x1f');var _0x5e90dc=_0x1d7f00[_0xefa4('0x20')];var _0x3f1a45=_0x16bcf0?0x0:_0x17dd94[_0xefa4('0x21')];var _0x3c1041=_0x16bcf0?_0x1d7f00[_0xefa4('0x20')]:_0x17dd94[_0xefa4('0x21')]+_0x17dd94[_0xefa4('0x1e')];var _0x1bc7cf;if(_0x3c1041>=_0x5e90dc){_0x3c1041=_0x5e90dc;_0x1bc7cf=0xc8;}else{_0x1bc7cf=0xce;}_0x1f7c40[_0xefa4('0x1b')](_0x1bc7cf);return _0x1f7c40[_0xefa4('0x22')](_0xefa4('0x23'),_0x3f1a45+'-'+_0x3c1041+'/'+_0x5e90dc)['json'](_0x1d7f00);}return null;};}function patchUpdates(_0x28f276){return function(_0x1c11f1){try{jsonpatch[_0xefa4('0x24')](_0x1c11f1,_0x28f276,!![]);}catch(_0xd24237){return BPromise[_0xefa4('0x25')](_0xd24237);}return _0x1c11f1[_0xefa4('0x26')]();};}function saveUpdates(_0x7e6811,_0x31f255){return function(_0x3a1f82){if(_0x3a1f82){return _0x3a1f82['update'](_0x7e6811)[_0xefa4('0x27')](function(_0x1c6fc4){return _0x1c6fc4;});}return null;};}function removeEntity(_0xfa9c0a,_0x4f4af6){return function(_0x1979f8){if(_0x1979f8){return _0x1979f8[_0xefa4('0x28')]()[_0xefa4('0x27')](function(){_0xfa9c0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d09db,_0x65cc8a){return function(_0x5cf658){if(!_0x5cf658){_0x3d09db[_0xefa4('0x1a')](0x194);}return _0x5cf658;};}function handleError(_0x53c73b,_0x35de03){_0x35de03=_0x35de03||0x1f4;return function(_0x448457){logger[_0xefa4('0x29')](_0x448457['stack']);if(_0x448457[_0xefa4('0x2a')]){delete _0x448457['name'];}_0x53c73b['status'](_0x35de03)[_0xefa4('0x2b')](_0x448457);};}exports[_0xefa4('0x2c')]=function(_0x3ed088,_0x58b41a){var _0x2e3e3e={},_0x4d41fb={},_0x4e6cbe={'count':0x0,'rows':[]};var _0x3e11a9=_['map'](db[_0xefa4('0x2d')]['rawAttributes'],function(_0x3cf52e){return{'name':_0x3cf52e[_0xefa4('0x2e')],'type':_0x3cf52e[_0xefa4('0x2f')]['key']};});_0x4d41fb[_0xefa4('0x30')]=_[_0xefa4('0x31')](_0x3e11a9,_0xefa4('0x2a'));_0x4d41fb[_0xefa4('0x32')]=_['keys'](_0x3ed088['query']);_0x4d41fb[_0xefa4('0x33')]=_[_0xefa4('0x34')](_0x4d41fb[_0xefa4('0x30')],_0x4d41fb['query']);_0x2e3e3e['attributes']=_[_0xefa4('0x34')](_0x4d41fb[_0xefa4('0x30')],qs['fields'](_0x3ed088[_0xefa4('0x32')][_0xefa4('0x35')]));_0x2e3e3e[_0xefa4('0x36')]=_0x2e3e3e[_0xefa4('0x36')]['length']?_0x2e3e3e[_0xefa4('0x36')]:_0x4d41fb[_0xefa4('0x30')];if(!_0x3ed088[_0xefa4('0x32')][_0xefa4('0x37')](_0xefa4('0x38'))){_0x2e3e3e['limit']=qs[_0xefa4('0x1e')](_0x3ed088[_0xefa4('0x32')][_0xefa4('0x1e')]);_0x2e3e3e['offset']=qs[_0xefa4('0x21')](_0x3ed088['query']['offset']);}_0x2e3e3e[_0xefa4('0x39')]=qs['sort'](_0x3ed088[_0xefa4('0x32')][_0xefa4('0x3a')]);_0x2e3e3e[_0xefa4('0x3b')]=qs[_0xefa4('0x33')](_['pick'](_0x3ed088[_0xefa4('0x32')],_0x4d41fb[_0xefa4('0x33')]),_0x3e11a9);if(_0x3ed088[_0xefa4('0x32')][_0xefa4('0x3c')]){_0x2e3e3e[_0xefa4('0x3b')]=_[_0xefa4('0x3d')](_0x2e3e3e[_0xefa4('0x3b')],{'$or':_[_0xefa4('0x31')](_0x3e11a9,function(_0x5e52c2){if(_0x5e52c2[_0xefa4('0x2f')]!==_0xefa4('0x3e')){var _0x2ade0f={};_0x2ade0f[_0x5e52c2[_0xefa4('0x2a')]]={'$like':'%'+_0x3ed088[_0xefa4('0x32')][_0xefa4('0x3c')]+'%'};return _0x2ade0f;}})});}_0x2e3e3e=_['merge']({},_0x2e3e3e,_0x3ed088['options']);var _0x543a2a={'where':_0x2e3e3e[_0xefa4('0x3b')]};return db['VtigerField']['count'](_0x543a2a)[_0xefa4('0x27')](function(_0x5b5197){_0x4e6cbe['count']=_0x5b5197;if(_0x3ed088['query'][_0xefa4('0x3f')]){_0x2e3e3e[_0xefa4('0x40')]=[{'all':!![]}];}return db[_0xefa4('0x2d')][_0xefa4('0x41')](_0x2e3e3e);})[_0xefa4('0x27')](function(_0x25ac00){_0x4e6cbe[_0xefa4('0x42')]=_0x25ac00;return _0x4e6cbe;})[_0xefa4('0x27')](respondWithFilteredResult(_0x58b41a,_0x2e3e3e))[_0xefa4('0x43')](handleError(_0x58b41a,null));};exports[_0xefa4('0x44')]=function(_0x4b9de9,_0x34ae8d){var _0x502c07={'raw':!![],'where':{'id':_0x4b9de9[_0xefa4('0x45')]['id']}},_0x20c9cb={};_0x20c9cb[_0xefa4('0x30')]=_['keys'](db[_0xefa4('0x2d')][_0xefa4('0x46')]);_0x20c9cb[_0xefa4('0x32')]=_[_0xefa4('0x47')](_0x4b9de9[_0xefa4('0x32')]);_0x20c9cb[_0xefa4('0x33')]=_[_0xefa4('0x34')](_0x20c9cb[_0xefa4('0x30')],_0x20c9cb[_0xefa4('0x32')]);_0x502c07[_0xefa4('0x36')]=_['intersection'](_0x20c9cb[_0xefa4('0x30')],qs[_0xefa4('0x35')](_0x4b9de9[_0xefa4('0x32')][_0xefa4('0x35')]));_0x502c07['attributes']=_0x502c07['attributes'][_0xefa4('0x48')]?_0x502c07[_0xefa4('0x36')]:_0x20c9cb['model'];if(_0x4b9de9[_0xefa4('0x32')][_0xefa4('0x3f')]){_0x502c07[_0xefa4('0x40')]=[{'all':!![]}];}_0x502c07=_[_0xefa4('0x3d')]({},_0x502c07,_0x4b9de9[_0xefa4('0x49')]);return db[_0xefa4('0x2d')][_0xefa4('0x4a')](_0x502c07)[_0xefa4('0x27')](handleEntityNotFound(_0x34ae8d,null))[_0xefa4('0x27')](respondWithResult(_0x34ae8d,null))[_0xefa4('0x43')](handleError(_0x34ae8d,null));};exports['create']=function(_0x1ef229,_0x64b852){return db[_0xefa4('0x2d')]['create'](_0x1ef229['body'],{})['then'](respondWithResult(_0x64b852,0xc9))[_0xefa4('0x43')](handleError(_0x64b852,null));};exports[_0xefa4('0x4b')]=function(_0x45b08f,_0x45f292){if(_0x45b08f['body']['id']){delete _0x45b08f[_0xefa4('0x4c')]['id'];}return db[_0xefa4('0x2d')][_0xefa4('0x4a')]({'where':{'id':_0x45b08f['params']['id']}})[_0xefa4('0x27')](handleEntityNotFound(_0x45f292,null))[_0xefa4('0x27')](saveUpdates(_0x45b08f[_0xefa4('0x4c')],null))[_0xefa4('0x27')](respondWithResult(_0x45f292,null))[_0xefa4('0x43')](handleError(_0x45f292,null));};exports[_0xefa4('0x28')]=function(_0x5c3af8,_0x3f659b){return db[_0xefa4('0x2d')]['find']({'where':{'id':_0x5c3af8[_0xefa4('0x45')]['id']}})[_0xefa4('0x27')](handleEntityNotFound(_0x3f659b,null))[_0xefa4('0x27')](removeEntity(_0x3f659b,null))[_0xefa4('0x43')](handleError(_0x3f659b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6f6b3fe..58cbba2 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 _0xcaef=['vtiger_unique_index','idField','FieldId','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0xcaef,0xfa));var _0xfcae=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xcaef[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfcae('0x0'));var moment=require(_0xfcae('0x1'));var BPromise=require(_0xfcae('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcae('0x3'));var rimraf=require(_0xfcae('0x4'));var config=require(_0xfcae('0x5'));var attributes=require(_0xfcae('0x6'));module['exports']=function(_0x140164,_0x289de4){return _0x140164[_0xfcae('0x7')](_0xfcae('0x8'),attributes,{'tableName':_0xfcae('0x9'),'paranoid':![],'indexes':[{'name':_0xfcae('0xa'),'fields':[_0xfcae('0xb'),_0xfcae('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x730f=['vtiger_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x117bba,_0x25c152){var _0x27057d=function(_0x59d1aa){while(--_0x59d1aa){_0x117bba['push'](_0x117bba['shift']());}};_0x27057d(++_0x25c152);}(_0x730f,0x78));var _0xf730=function(_0x31f8be,_0x11b289){_0x31f8be=_0x31f8be-0x0;var _0x52b751=_0x730f[_0x31f8be];return _0x52b751;};'use strict';var _=require(_0xf730('0x0'));var util=require('util');var logger=require(_0xf730('0x1'))('api');var moment=require(_0xf730('0x2'));var BPromise=require(_0xf730('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf730('0x4'));var rimraf=require(_0xf730('0x5'));var config=require('../../config/environment');var attributes=require(_0xf730('0x6'));module[_0xf730('0x7')]=function(_0x49c287,_0xdfa02b){return _0x49c287[_0xf730('0x8')](_0xf730('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xf730('0xa'),'fields':[_0xf730('0xb'),_0xf730('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 763f56c..2e875eb 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 _0x40ad=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x149b25,_0x2bb415){var _0x40b742=function(_0x103584){while(--_0x103584){_0x149b25['push'](_0x149b25['shift']());}};_0x40b742(++_0x2bb415);}(_0x40ad,0x144));var _0xd40a=function(_0x3b477d,_0x4495f9){_0x3b477d=_0x3b477d-0x0;var _0x45d4eb=_0x40ad[_0x3b477d];return _0x45d4eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd40a('0x0'));var BPromise=require(_0xd40a('0x1'));var rs=require(_0xd40a('0x2'));var fs=require('fs');var Redis=require(_0xd40a('0x3'));var db=require(_0xd40a('0x4'))['db'];var utils=require(_0xd40a('0x5'));var logger=require(_0xd40a('0x6'))('rpc');var config=require(_0xd40a('0x7'));var jayson=require(_0xd40a('0x8'));var client=jayson[_0xd40a('0x9')][_0xd40a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe715a4,_0x2aecac,_0x24197c){return new BPromise(function(_0x4239bf,_0x3793e1){return client[_0xd40a('0xb')](_0xe715a4,_0x24197c)[_0xd40a('0xc')](function(_0x2f319a){logger[_0xd40a('0xd')]('VtigerField,\x20%s,\x20%s',_0x2aecac,_0xd40a('0xe'));logger['debug'](_0xd40a('0xf'),_0x2aecac,_0xd40a('0xe'),JSON[_0xd40a('0x10')](_0x2f319a));if(_0x2f319a[_0xd40a('0x11')]){if(_0x2f319a[_0xd40a('0x11')][_0xd40a('0x12')]===0x1f4){logger[_0xd40a('0x11')]('VtigerField,\x20%s,\x20%s',_0x2aecac,_0x2f319a[_0xd40a('0x11')][_0xd40a('0x13')]);return _0x3793e1(_0x2f319a['error'][_0xd40a('0x13')]);}logger[_0xd40a('0x11')](_0xd40a('0x14'),_0x2aecac,_0x2f319a['error'][_0xd40a('0x13')]);return _0x4239bf(_0x2f319a[_0xd40a('0x11')][_0xd40a('0x13')]);}else{logger[_0xd40a('0xd')](_0xd40a('0x14'),_0x2aecac,_0xd40a('0xe'));_0x4239bf(_0x2f319a['result'][_0xd40a('0x13')]);}})[_0xd40a('0x15')](function(_0x31200b){logger[_0xd40a('0x11')](_0xd40a('0x14'),_0x2aecac,_0x31200b);_0x3793e1(_0x31200b);});});} \ No newline at end of file +var _0x15f0=['../../config/environment','client','http','then','info','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x36cb07,_0x4aa173){var _0x5ed355=function(_0x122556){while(--_0x122556){_0x36cb07['push'](_0x36cb07['shift']());}};_0x5ed355(++_0x4aa173);}(_0x15f0,0xcb));var _0x015f=function(_0xc46fc2,_0x31d4e4){_0xc46fc2=_0xc46fc2-0x0;var _0x4d4268=_0x15f0[_0xc46fc2];return _0x4d4268;};'use strict';var _=require('lodash');var util=require(_0x015f('0x0'));var moment=require(_0x015f('0x1'));var BPromise=require('bluebird');var rs=require(_0x015f('0x2'));var fs=require('fs');var Redis=require(_0x015f('0x3'));var db=require(_0x015f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x015f('0x5'));var config=require(_0x015f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x015f('0x7')][_0x015f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe08e67,_0x2bc552,_0x288ac2){return new BPromise(function(_0x4695f0,_0x54c33){return client['request'](_0xe08e67,_0x288ac2)[_0x015f('0x9')](function(_0x1eb273){logger[_0x015f('0xa')](_0x015f('0xb'),_0x2bc552,'request\x20sent');logger[_0x015f('0xc')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x2bc552,_0x015f('0xd'),JSON[_0x015f('0xe')](_0x1eb273));if(_0x1eb273[_0x015f('0xf')]){if(_0x1eb273[_0x015f('0xf')]['code']===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x2bc552,_0x1eb273['error'][_0x015f('0x10')]);return _0x54c33(_0x1eb273[_0x015f('0xf')][_0x015f('0x10')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x2bc552,_0x1eb273[_0x015f('0xf')][_0x015f('0x10')]);return _0x4695f0(_0x1eb273['error'][_0x015f('0x10')]);}else{logger[_0x015f('0xa')](_0x015f('0xb'),_0x2bc552,'request\x20sent');_0x4695f0(_0x1eb273[_0x015f('0x11')]['message']);}})[_0x015f('0x12')](function(_0x3a1895){logger[_0x015f('0xf')](_0x015f('0xb'),_0x2bc552,_0x3a1895);_0x54c33(_0x3a1895);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 606b0e4..e53c5eb 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 _0xd220=['put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration'];(function(_0x398437,_0x382e5f){var _0x539597=function(_0x296472){while(--_0x296472){_0x398437['push'](_0x398437['shift']());}};_0x539597(++_0x382e5f);}(_0xd220,0x169));var _0x0d22=function(_0x5828fa,_0x5955e2){_0x5828fa=_0x5828fa-0x0;var _0x3f9f92=_0xd220[_0x5828fa];return _0x3f9f92;};'use strict';var multer=require(_0x0d22('0x0'));var util=require(_0x0d22('0x1'));var path=require(_0x0d22('0x2'));var timeout=require(_0x0d22('0x3'));var express=require(_0x0d22('0x4'));var router=express['Router']();var fs_extra=require(_0x0d22('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x0d22('0x6')]('/',auth['isAuthenticated'](),controller[_0x0d22('0x7')]);router[_0x0d22('0x6')](_0x0d22('0x8'),auth[_0x0d22('0x9')](),controller[_0x0d22('0xa')]);router[_0x0d22('0x6')](_0x0d22('0xb'),auth['isAuthenticated'](),controller[_0x0d22('0xc')]);router[_0x0d22('0x6')]('/:id/fields',auth[_0x0d22('0x9')](),controller[_0x0d22('0xd')]);router[_0x0d22('0xe')]('/',auth[_0x0d22('0x9')](),controller[_0x0d22('0xf')]);router[_0x0d22('0xe')](_0x0d22('0xb'),auth[_0x0d22('0x9')](),controller[_0x0d22('0x10')]);router[_0x0d22('0x11')](_0x0d22('0x8'),auth[_0x0d22('0x9')](),controller[_0x0d22('0x12')]);router[_0x0d22('0x13')](_0x0d22('0x8'),auth[_0x0d22('0x9')](),controller[_0x0d22('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4bcf=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update'];(function(_0xbf1956,_0x49953d){var _0x2b265e=function(_0x5e20f9){while(--_0x5e20f9){_0xbf1956['push'](_0xbf1956['shift']());}};_0x2b265e(++_0x49953d);}(_0x4bcf,0x116));var _0xf4bc=function(_0x4f2540,_0x10e19b){_0x4f2540=_0x4f2540-0x0;var _0x151dd6=_0x4bcf[_0x4f2540];return _0x151dd6;};'use strict';var multer=require(_0xf4bc('0x0'));var util=require(_0xf4bc('0x1'));var path=require('path');var timeout=require(_0xf4bc('0x2'));var express=require(_0xf4bc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf4bc('0x4'));var interaction=require(_0xf4bc('0x5'));var config=require(_0xf4bc('0x6'));var controller=require(_0xf4bc('0x7'));router[_0xf4bc('0x8')]('/',auth[_0xf4bc('0x9')](),controller[_0xf4bc('0xa')]);router[_0xf4bc('0x8')]('/:id',auth[_0xf4bc('0x9')](),controller[_0xf4bc('0xb')]);router['get'](_0xf4bc('0xc'),auth[_0xf4bc('0x9')](),controller[_0xf4bc('0xd')]);router[_0xf4bc('0x8')](_0xf4bc('0xe'),auth[_0xf4bc('0x9')](),controller[_0xf4bc('0xf')]);router[_0xf4bc('0x10')]('/',auth[_0xf4bc('0x9')](),controller['create']);router['post'](_0xf4bc('0xc'),auth['isAuthenticated'](),controller[_0xf4bc('0x11')]);router[_0xf4bc('0x12')](_0xf4bc('0x13'),auth[_0xf4bc('0x9')](),controller[_0xf4bc('0x14')]);router['delete']('/:id',auth[_0xf4bc('0x9')](),controller[_0xf4bc('0x15')]);module[_0xf4bc('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 c537121..b22fb51 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 _0xf03a=['exports','STRING','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xf03a,0x1a0));var _0xaf03=function(_0x29b6b6,_0x2f2842){_0x29b6b6=_0x29b6b6-0x0;var _0x4f20e2=_0xf03a[_0x29b6b6];return _0x4f20e2;};'use strict';var Sequelize=require('sequelize');module[_0xaf03('0x0')]={'name':{'type':Sequelize[_0xaf03('0x1')]},'description':{'type':Sequelize[_0xaf03('0x1')]},'username':{'type':Sequelize[_0xaf03('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xaf03('0x1')]},'token':{'type':Sequelize[_0xaf03('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xaf03('0x2')},'authType':{'type':Sequelize[_0xaf03('0x3')](_0xaf03('0x4'),_0xaf03('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xaf03('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaf03('0x6'),_0xaf03('0x7')),'defaultValue':_0xaf03('0x6')}}; \ No newline at end of file +var _0xed54=['exports','STRING','ENUM','password','token','integrationTab'];(function(_0x3caaaf,_0x87614f){var _0x120b06=function(_0x4f7523){while(--_0x4f7523){_0x3caaaf['push'](_0x3caaaf['shift']());}};_0x120b06(++_0x87614f);}(_0xed54,0xfc));var _0x4ed5=function(_0x2f726d,_0x4c486c){_0x2f726d=_0x2f726d-0x0;var _0x38e7fe=_0xed54[_0x2f726d];return _0x38e7fe;};'use strict';var Sequelize=require('sequelize');module[_0x4ed5('0x0')]={'name':{'type':Sequelize[_0x4ed5('0x1')]},'description':{'type':Sequelize[_0x4ed5('0x1')]},'username':{'type':Sequelize[_0x4ed5('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x4ed5('0x1')]},'token':{'type':Sequelize[_0x4ed5('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x4ed5('0x2')](_0x4ed5('0x3'),_0x4ed5('0x4')),'defaultValue':_0x4ed5('0x3')},'serverUrl':{'type':Sequelize[_0x4ed5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4ed5('0x2')](_0x4ed5('0x5'),'newTab'),'defaultValue':_0x4ed5('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bbdc2fa..231a629 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 _0x1775=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','body','destroy','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','format','%s/%s','password','headers','%s:%s','base64','Basic\x20%s','%s/token:%s','ValidationError','subject','description','assignee','remove','ticket_fields','includes','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x45cd7c,_0x69dced){var _0x1ec76a=function(_0x20aa2e){while(--_0x20aa2e){_0x45cd7c['push'](_0x45cd7c['shift']());}};_0x1ec76a(++_0x69dced);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];var integrations=require(_0x5177('0x1c'));function respondWithStatusCode(_0x3c4ced,_0x111e99){_0x111e99=_0x111e99||0xcc;return function(_0x299eba){if(_0x299eba){return _0x3c4ced[_0x5177('0x1d')](_0x111e99);}return _0x3c4ced[_0x5177('0x1e')](_0x111e99)[_0x5177('0x1f')]();};}function respondWithResult(_0x1eb9dd,_0x41bef4){_0x41bef4=_0x41bef4||0xc8;return function(_0x2bf5bb){if(_0x2bf5bb){return _0x1eb9dd[_0x5177('0x1e')](_0x41bef4)[_0x5177('0x20')](_0x2bf5bb);}};}function respondWithFilteredResult(_0x1b32e6,_0x175ca6){return function(_0x2ab5e5){if(_0x2ab5e5){var _0x7dba6f=typeof _0x175ca6[_0x5177('0x21')]==='undefined'&&typeof _0x175ca6[_0x5177('0x22')]===_0x5177('0x23');var _0x3f5ab5=_0x2ab5e5[_0x5177('0x24')];var _0x5f5bd4=_0x7dba6f?0x0:_0x175ca6[_0x5177('0x21')];var _0x2ebf91=_0x7dba6f?_0x2ab5e5[_0x5177('0x24')]:_0x175ca6['offset']+_0x175ca6[_0x5177('0x22')];var _0x4cf600;if(_0x2ebf91>=_0x3f5ab5){_0x2ebf91=_0x3f5ab5;_0x4cf600=0xc8;}else{_0x4cf600=0xce;}_0x1b32e6[_0x5177('0x1e')](_0x4cf600);return _0x1b32e6[_0x5177('0x25')](_0x5177('0x26'),_0x5f5bd4+'-'+_0x2ebf91+'/'+_0x3f5ab5)[_0x5177('0x20')](_0x2ab5e5);}return null;};}function patchUpdates(_0x451e5c){return function(_0x3314f2){try{jsonpatch[_0x5177('0x27')](_0x3314f2,_0x451e5c,!![]);}catch(_0xfc1bd4){return BPromise[_0x5177('0x28')](_0xfc1bd4);}return _0x3314f2[_0x5177('0x29')]();};}function saveUpdates(_0x23dad2,_0x3b0c37){return function(_0x5d9a9c){if(_0x5d9a9c){return _0x5d9a9c[_0x5177('0x2a')](_0x23dad2)['then'](function(_0x30b60f){return _0x30b60f;});}return null;};}function removeEntity(_0x2c68d8,_0x3b39b5){return function(_0x2d51d0){if(_0x2d51d0){return _0x2d51d0['destroy']()[_0x5177('0x2b')](function(){_0x2c68d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(!_0x577bf7){_0x19a0c2[_0x5177('0x1d')](0x194);}return _0x577bf7;};}function handleError(_0x4eba3a,_0x231d35){_0x231d35=_0x231d35||0x1f4;return function(_0x1cbd29){logger['error'](_0x1cbd29[_0x5177('0x2c')]);if(_0x1cbd29[_0x5177('0x2d')]){delete _0x1cbd29[_0x5177('0x2d')];}_0x4eba3a[_0x5177('0x1e')](_0x231d35)[_0x5177('0x2e')](_0x1cbd29);};}exports[_0x5177('0x2f')]=function(_0x5577bb,_0x498fcd){var _0x45cf20={},_0x1c660e={},_0x7dae59={'count':0x0,'rows':[]};var _0x174f7a=_[_0x5177('0x30')](db[_0x5177('0x31')][_0x5177('0x32')],function(_0x72dced){return{'name':_0x72dced['fieldName'],'type':_0x72dced[_0x5177('0x33')][_0x5177('0x34')]};});_0x1c660e['model']=_[_0x5177('0x30')](_0x174f7a,'name');_0x1c660e[_0x5177('0x35')]=_[_0x5177('0x36')](_0x5577bb[_0x5177('0x35')]);_0x1c660e['filters']=_['intersection'](_0x1c660e[_0x5177('0x37')],_0x1c660e[_0x5177('0x35')]);_0x45cf20[_0x5177('0x38')]=_[_0x5177('0x39')](_0x1c660e[_0x5177('0x37')],qs[_0x5177('0x3a')](_0x5577bb[_0x5177('0x35')][_0x5177('0x3a')]));_0x45cf20['attributes']=_0x45cf20[_0x5177('0x38')][_0x5177('0x3b')]?_0x45cf20['attributes']:_0x1c660e[_0x5177('0x37')];if(!_0x5577bb[_0x5177('0x35')][_0x5177('0x3c')](_0x5177('0x3d'))){_0x45cf20[_0x5177('0x22')]=qs[_0x5177('0x22')](_0x5577bb['query'][_0x5177('0x22')]);_0x45cf20[_0x5177('0x21')]=qs[_0x5177('0x21')](_0x5577bb[_0x5177('0x35')][_0x5177('0x21')]);}_0x45cf20[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x5577bb['query'][_0x5177('0x3f')]);_0x45cf20[_0x5177('0x40')]=qs['filters'](_['pick'](_0x5577bb[_0x5177('0x35')],_0x1c660e[_0x5177('0x41')]),_0x174f7a);if(_0x5577bb[_0x5177('0x35')][_0x5177('0x42')]){_0x45cf20[_0x5177('0x40')]=_[_0x5177('0x43')](_0x45cf20[_0x5177('0x40')],{'$or':_[_0x5177('0x30')](_0x174f7a,function(_0xa2ed49){if(_0xa2ed49[_0x5177('0x33')]!==_0x5177('0x44')){var _0x1f15f8={};_0x1f15f8[_0xa2ed49[_0x5177('0x2d')]]={'$like':'%'+_0x5577bb['query'][_0x5177('0x42')]+'%'};return _0x1f15f8;}})});}_0x45cf20=_[_0x5177('0x43')]({},_0x45cf20,_0x5577bb['options']);var _0x7341c0={'where':_0x45cf20['where']};return db[_0x5177('0x31')][_0x5177('0x24')](_0x7341c0)[_0x5177('0x2b')](function(_0x5742aa){_0x7dae59['count']=_0x5742aa;if(_0x5577bb[_0x5177('0x35')][_0x5177('0x45')]){_0x45cf20[_0x5177('0x46')]=[{'all':!![]}];}return db[_0x5177('0x31')][_0x5177('0x47')](_0x45cf20);})[_0x5177('0x2b')](function(_0x41d874){_0x7dae59[_0x5177('0x48')]=_0x41d874;return _0x7dae59;})['then'](respondWithFilteredResult(_0x498fcd,_0x45cf20))[_0x5177('0x49')](handleError(_0x498fcd,null));};exports['show']=function(_0x5e3d30,_0x30e4f3){var _0x17dc98={'raw':![],'where':{'id':_0x5e3d30[_0x5177('0x4a')]['id']}},_0x5172f8={};_0x5172f8['model']=_['keys'](db[_0x5177('0x31')][_0x5177('0x32')]);_0x5172f8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x5e3d30[_0x5177('0x35')]);_0x5172f8[_0x5177('0x41')]=_[_0x5177('0x39')](_0x5172f8['model'],_0x5172f8['query']);_0x17dc98[_0x5177('0x38')]=_['intersection'](_0x5172f8[_0x5177('0x37')],qs[_0x5177('0x3a')](_0x5e3d30[_0x5177('0x35')][_0x5177('0x3a')]));_0x17dc98['attributes']=_0x17dc98[_0x5177('0x38')][_0x5177('0x3b')]?_0x17dc98[_0x5177('0x38')]:_0x5172f8[_0x5177('0x37')];if(_0x5e3d30[_0x5177('0x35')][_0x5177('0x45')]){_0x17dc98[_0x5177('0x46')]=[{'all':!![]}];}_0x17dc98=_[_0x5177('0x43')]({},_0x17dc98,_0x5e3d30[_0x5177('0x4b')]);return db[_0x5177('0x31')][_0x5177('0x4c')](_0x17dc98)['then'](handleEntityNotFound(_0x30e4f3,null))[_0x5177('0x2b')](respondWithResult(_0x30e4f3,null))['catch'](handleError(_0x30e4f3,null));};exports['create']=function(_0x5bda8a,_0x2f9ff9){return db[_0x5177('0x31')]['create'](_0x5bda8a[_0x5177('0x4d')],{})[_0x5177('0x2b')](respondWithResult(_0x2f9ff9,0xc9))[_0x5177('0x49')](handleError(_0x2f9ff9,null));};exports['update']=function(_0x1d4ae4,_0x5981dc){if(_0x1d4ae4['body']['id']){delete _0x1d4ae4['body']['id'];}return db[_0x5177('0x31')][_0x5177('0x4c')]({'where':{'id':_0x1d4ae4[_0x5177('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5981dc,null))['then'](saveUpdates(_0x1d4ae4[_0x5177('0x4d')],null))['then'](respondWithResult(_0x5981dc,null))[_0x5177('0x49')](handleError(_0x5981dc,null));};exports[_0x5177('0x4e')]=function(_0x430e8e,_0x31a6e1){return db[_0x5177('0x31')][_0x5177('0x4c')]({'where':{'id':_0x430e8e[_0x5177('0x4a')]['id']}})[_0x5177('0x2b')](handleEntityNotFound(_0x31a6e1,null))[_0x5177('0x2b')](removeEntity(_0x31a6e1,null))[_0x5177('0x49')](handleError(_0x31a6e1,null));};exports[_0x5177('0x4f')]=function(_0xb08267,_0x422d6c,_0x4c2068){var _0x59376b={};var _0x29ff0f={};var _0x5d5016;var _0x649c6f;return db['ZendeskAccount'][_0x5177('0x50')]({'where':{'id':_0xb08267[_0x5177('0x4a')]['id']}})[_0x5177('0x2b')](handleEntityNotFound(_0x422d6c,null))['then'](function(_0x5be224){if(_0x5be224){_0x5d5016=_0x5be224;_0x29ff0f[_0x5177('0x37')]=_[_0x5177('0x36')](db[_0x5177('0x51')][_0x5177('0x32')]);_0x29ff0f['query']=_['keys'](_0xb08267[_0x5177('0x35')]);_0x29ff0f[_0x5177('0x41')]=_[_0x5177('0x39')](_0x29ff0f[_0x5177('0x37')],_0x29ff0f['query']);_0x59376b[_0x5177('0x38')]=_[_0x5177('0x39')](_0x29ff0f[_0x5177('0x37')],qs['fields'](_0xb08267[_0x5177('0x35')][_0x5177('0x3a')]));_0x59376b[_0x5177('0x38')]=_0x59376b['attributes'][_0x5177('0x3b')]?_0x59376b['attributes']:_0x29ff0f[_0x5177('0x37')];_0x59376b[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0xb08267['query'][_0x5177('0x3f')]);_0x59376b[_0x5177('0x40')]=qs[_0x5177('0x41')](_[_0x5177('0x52')](_0xb08267[_0x5177('0x35')],_0x29ff0f[_0x5177('0x41')]));if(_0xb08267[_0x5177('0x35')][_0x5177('0x42')]){_0x59376b['where']=_['merge'](_0x59376b['where'],{'$or':_[_0x5177('0x30')](_0x59376b[_0x5177('0x38')],function(_0x35aa22){var _0x75cc0e={};_0x75cc0e[_0x35aa22]={'$like':'%'+_0xb08267[_0x5177('0x35')][_0x5177('0x42')]+'%'};return _0x75cc0e;})});}_0x59376b=_['merge']({},_0x59376b,_0xb08267['options']);return _0x5d5016[_0x5177('0x4f')](_0x59376b);}})[_0x5177('0x2b')](function(_0x1f294e){if(_0x1f294e){_0x649c6f=_0x1f294e[_0x5177('0x3b')];if(!_0xb08267[_0x5177('0x35')][_0x5177('0x3c')](_0x5177('0x3d'))){_0x59376b[_0x5177('0x22')]=qs[_0x5177('0x22')](_0xb08267['query'][_0x5177('0x22')]);_0x59376b[_0x5177('0x21')]=qs['offset'](_0xb08267[_0x5177('0x35')][_0x5177('0x21')]);}return _0x5d5016['getConfigurations'](_0x59376b);}})[_0x5177('0x2b')](function(_0x2f3344){if(_0x2f3344){return _0x2f3344?{'count':_0x649c6f,'rows':_0x2f3344}:null;}})[_0x5177('0x2b')](respondWithResult(_0x422d6c,null))['catch'](handleError(_0x422d6c,null));};exports[_0x5177('0x53')]=function(_0x400e27,_0x5f5bd5,_0x52a6c2){if(_0x400e27[_0x5177('0x4d')]['id']){delete _0x400e27['body']['id'];}return db[_0x5177('0x31')]['findOne']({'where':{'id':_0x400e27[_0x5177('0x4a')]['id']}})[_0x5177('0x2b')](handleEntityNotFound(_0x5f5bd5,null))['then'](function(_0x2af938){if(_0x2af938){_0x400e27[_0x5177('0x4d')][_0x5177('0x54')]=_0x2af938['id'];_0x400e27[_0x5177('0x4d')][_0x5177('0x55')]=integrations[_0x5177('0x56')](_0x400e27[_0x5177('0x4d')]['channel'],_0x400e27[_0x5177('0x4d')]['type']);_0x400e27['body'][_0x5177('0x57')]=integrations[_0x5177('0x58')](_0x400e27['body'][_0x5177('0x59')],_0x400e27[_0x5177('0x4d')][_0x5177('0x33')]);return db[_0x5177('0x51')][_0x5177('0x5a')](_0x400e27[_0x5177('0x4d')],{'include':[{'model':db[_0x5177('0x5b')],'as':_0x5177('0x55')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x5177('0x2b')](respondWithResult(_0x5f5bd5,null))[_0x5177('0x49')](handleError(_0x5f5bd5,null));};exports[_0x5177('0x5c')]=function(_0x2d24b3,_0x3de0b5,_0x3dd58f){var _0x4fc289='';return db[_0x5177('0x31')][_0x5177('0x50')]({'where':{'id':_0x2d24b3[_0x5177('0x4a')]['id']},'attributes':['id',_0x5177('0x5d'),'password',_0x5177('0x5e'),_0x5177('0x5f'),_0x5177('0x60')]})[_0x5177('0x2b')](handleEntityNotFound(_0x3de0b5,null))[_0x5177('0x2b')](function(_0x5130e6){if(_0x5130e6){_0x4fc289=_0x5130e6[_0x5177('0x60')];var _0x4aa8d3=_0x4fc289[_0x5177('0x61')](-0x1);if(_0x4aa8d3==='/'){_0x4fc289=_0x4fc289[_0x5177('0x62')](0x0,_0x4fc289['lastIndexOf'](_0x4aa8d3));}var _0x67d605={'method':_0x5177('0x63'),'uri':util[_0x5177('0x64')](_0x5177('0x65'),_0x4fc289,'ticket_fields'),'json':!![]};switch(_0x5130e6[_0x5177('0x5f')]){case _0x5177('0x66'):_0x67d605[_0x5177('0x67')]={'Authorization':util[_0x5177('0x64')]('Basic\x20%s',new Buffer(util[_0x5177('0x64')](_0x5177('0x68'),_0x5130e6[_0x5177('0x5d')],_0x5130e6['password']))['toString'](_0x5177('0x69')))};break;case _0x5177('0x5e'):_0x67d605[_0x5177('0x67')]={'Authorization':util[_0x5177('0x64')](_0x5177('0x6a'),new Buffer(util[_0x5177('0x64')](_0x5177('0x6b'),_0x5130e6[_0x5177('0x5d')],_0x5130e6[_0x5177('0x5e')]))['toString']('base64'))};break;default:throw new db['Sequelize'][(_0x5177('0x6c'))]('Unknown\x20authentication\x20type');}return rp(_0x67d605);}})[_0x5177('0x2b')](function(_0x3255a2){if(_0x3255a2){var _0x56c1aa=[_0x5177('0x6d'),_0x5177('0x6e'),'group',_0x5177('0x6f')];_[_0x5177('0x70')](_0x3255a2[_0x5177('0x71')],function(_0x4fce32){return _0x56c1aa[_0x5177('0x72')](_0x4fce32['type']);});return{'count':_0x3255a2[_0x5177('0x71')][_0x5177('0x3b')],'rows':_['map'](_0x3255a2[_0x5177('0x71')],function(_0x3f3031){return{'id':_0x3f3031['id'],'name':_0x3f3031['position']>0x7?_0x3f3031['title']:_0x3f3031[_0x5177('0x33')],'custom':_0x3f3031['position']>0x7?!![]:![],'options':_0x3f3031[_0x5177('0x73')]?_0x3f3031[_0x5177('0x73')]:_0x3f3031['custom_field_options']?_0x3f3031[_0x5177('0x74')]:[]};})};}})[_0x5177('0x2b')](respondWithResult(_0x3de0b5,null))[_0x5177('0x49')](function(_0x20ceb9){var _0x43a584=_0x2d24b3[_0x5177('0x35')][_0x5177('0x75')]?0x1f4:_0x20ceb9[_0x5177('0x76')]||0x1f4;logger['error'](_0x5177('0x77'),'getFields',_0x43a584,JSON[_0x5177('0x78')](_0x20ceb9));delete _0x20ceb9[_0x5177('0x2d')];if(_0x43a584===0x191){_0x43a584=0x190;}_0x3de0b5[_0x5177('0x1e')](_0x43a584)[_0x5177('0x2e')](_0x2d24b3['query'][_0x5177('0x75')]?{'message':_0x5177('0x79'),'statusCode':_0x20ceb9['statusCode']}:_0x20ceb9);});}; \ No newline at end of file +var _0x2e54=['position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','intersection','options','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','format','%s/%s','Basic\x20%s','%s:%s','headers','%s/token:%s','toString','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields'];(function(_0x27f7b2,_0x432964){var _0x22454f=function(_0x37408d){while(--_0x37408d){_0x27f7b2['push'](_0x27f7b2['shift']());}};_0x22454f(++_0x432964);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2cd3dc,_0x3d3b9e){_0x2cd3dc=_0x2cd3dc-0x0;var _0x5b7d50=_0x2e54[_0x2cd3dc];return _0x5b7d50;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];var integrations=require(_0x42e5('0x18'));function respondWithStatusCode(_0x4530ba,_0x41598d){_0x41598d=_0x41598d||0xcc;return function(_0x144fb4){if(_0x144fb4){return _0x4530ba[_0x42e5('0x19')](_0x41598d);}return _0x4530ba[_0x42e5('0x1a')](_0x41598d)[_0x42e5('0x1b')]();};}function respondWithResult(_0x447648,_0x23957f){_0x23957f=_0x23957f||0xc8;return function(_0x51b2f4){if(_0x51b2f4){return _0x447648[_0x42e5('0x1a')](_0x23957f)[_0x42e5('0x1c')](_0x51b2f4);}};}function respondWithFilteredResult(_0x4034bd,_0x388300){return function(_0x2f4999){if(_0x2f4999){var _0x263a3d=typeof _0x388300[_0x42e5('0x1d')]===_0x42e5('0x1e')&&typeof _0x388300[_0x42e5('0x1f')]===_0x42e5('0x1e');var _0x22655f=_0x2f4999[_0x42e5('0x20')];var _0x11550e=_0x263a3d?0x0:_0x388300[_0x42e5('0x1d')];var _0x54fcfc=_0x263a3d?_0x2f4999[_0x42e5('0x20')]:_0x388300['offset']+_0x388300['limit'];var _0x14d16d;if(_0x54fcfc>=_0x22655f){_0x54fcfc=_0x22655f;_0x14d16d=0xc8;}else{_0x14d16d=0xce;}_0x4034bd[_0x42e5('0x1a')](_0x14d16d);return _0x4034bd['set'](_0x42e5('0x21'),_0x11550e+'-'+_0x54fcfc+'/'+_0x22655f)[_0x42e5('0x1c')](_0x2f4999);}return null;};}function patchUpdates(_0x1c2169){return function(_0x3fde76){try{jsonpatch[_0x42e5('0x22')](_0x3fde76,_0x1c2169,!![]);}catch(_0xa6825e){return BPromise[_0x42e5('0x23')](_0xa6825e);}return _0x3fde76['save']();};}function saveUpdates(_0x4da508,_0x283d44){return function(_0x52d319){if(_0x52d319){return _0x52d319[_0x42e5('0x24')](_0x4da508)[_0x42e5('0x25')](function(_0x37d10e){return _0x37d10e;});}return null;};}function removeEntity(_0x49490f,_0x32380f){return function(_0x5d6b24){if(_0x5d6b24){return _0x5d6b24[_0x42e5('0x26')]()[_0x42e5('0x25')](function(){_0x49490f[_0x42e5('0x1a')](0xcc)[_0x42e5('0x1b')]();});}};}function handleEntityNotFound(_0x4638bc,_0x4f52b2){return function(_0x4fb147){if(!_0x4fb147){_0x4638bc[_0x42e5('0x19')](0x194);}return _0x4fb147;};}function handleError(_0x534a26,_0x56f812){_0x56f812=_0x56f812||0x1f4;return function(_0x1b60be){logger['error'](_0x1b60be[_0x42e5('0x27')]);if(_0x1b60be[_0x42e5('0x28')]){delete _0x1b60be[_0x42e5('0x28')];}_0x534a26[_0x42e5('0x1a')](_0x56f812)[_0x42e5('0x29')](_0x1b60be);};}exports[_0x42e5('0x2a')]=function(_0x59a46b,_0x3e2ea5){var _0x201d9e={},_0x39f763={},_0x2c53d4={'count':0x0,'rows':[]};var _0x1d22ba=_[_0x42e5('0x2b')](db[_0x42e5('0x2c')][_0x42e5('0x2d')],function(_0x5a4930){return{'name':_0x5a4930[_0x42e5('0x2e')],'type':_0x5a4930[_0x42e5('0x2f')][_0x42e5('0x30')]};});_0x39f763[_0x42e5('0x31')]=_['map'](_0x1d22ba,_0x42e5('0x28'));_0x39f763[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x59a46b[_0x42e5('0x32')]);_0x39f763['filters']=_['intersection'](_0x39f763[_0x42e5('0x31')],_0x39f763['query']);_0x201d9e[_0x42e5('0x34')]=_['intersection'](_0x39f763[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x59a46b[_0x42e5('0x32')]['fields']));_0x201d9e[_0x42e5('0x34')]=_0x201d9e[_0x42e5('0x34')]['length']?_0x201d9e[_0x42e5('0x34')]:_0x39f763['model'];if(!_0x59a46b[_0x42e5('0x32')][_0x42e5('0x36')](_0x42e5('0x37'))){_0x201d9e[_0x42e5('0x1f')]=qs[_0x42e5('0x1f')](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1f')]);_0x201d9e['offset']=qs['offset'](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1d')]);}_0x201d9e[_0x42e5('0x38')]=qs['sort'](_0x59a46b['query']['sort']);_0x201d9e['where']=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x59a46b[_0x42e5('0x32')],_0x39f763[_0x42e5('0x39')]),_0x1d22ba);if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]){_0x201d9e[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x201d9e['where'],{'$or':_[_0x42e5('0x2b')](_0x1d22ba,function(_0x587832){if(_0x587832[_0x42e5('0x2f')]!==_0x42e5('0x3e')){var _0x340caf={};_0x340caf[_0x587832[_0x42e5('0x28')]]={'$like':'%'+_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x340caf;}})});}_0x201d9e=_[_0x42e5('0x3d')]({},_0x201d9e,_0x59a46b['options']);var _0x20f372={'where':_0x201d9e[_0x42e5('0x3c')]};return db['ZendeskAccount'][_0x42e5('0x20')](_0x20f372)['then'](function(_0x53b0bd){_0x2c53d4['count']=_0x53b0bd;if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x201d9e[_0x42e5('0x40')]=[{'all':!![]}];}return db[_0x42e5('0x2c')][_0x42e5('0x41')](_0x201d9e);})[_0x42e5('0x25')](function(_0x1fbde){_0x2c53d4['rows']=_0x1fbde;return _0x2c53d4;})[_0x42e5('0x25')](respondWithFilteredResult(_0x3e2ea5,_0x201d9e))[_0x42e5('0x42')](handleError(_0x3e2ea5,null));};exports['show']=function(_0x398b73,_0x1c697a){var _0x5db771={'raw':![],'where':{'id':_0x398b73[_0x42e5('0x43')]['id']}},_0x33054f={};_0x33054f[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x2c')]['rawAttributes']);_0x33054f[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x398b73[_0x42e5('0x32')]);_0x33054f[_0x42e5('0x39')]=_['intersection'](_0x33054f[_0x42e5('0x31')],_0x33054f[_0x42e5('0x32')]);_0x5db771[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x33054f[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x398b73[_0x42e5('0x32')][_0x42e5('0x35')]));_0x5db771['attributes']=_0x5db771[_0x42e5('0x34')]['length']?_0x5db771['attributes']:_0x33054f[_0x42e5('0x31')];if(_0x398b73[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x5db771[_0x42e5('0x40')]=[{'all':!![]}];}_0x5db771=_[_0x42e5('0x3d')]({},_0x5db771,_0x398b73[_0x42e5('0x45')]);return db[_0x42e5('0x2c')]['find'](_0x5db771)[_0x42e5('0x25')](handleEntityNotFound(_0x1c697a,null))[_0x42e5('0x25')](respondWithResult(_0x1c697a,null))[_0x42e5('0x42')](handleError(_0x1c697a,null));};exports[_0x42e5('0x46')]=function(_0x1086b2,_0xc8de4d){return db[_0x42e5('0x2c')][_0x42e5('0x46')](_0x1086b2['body'],{})[_0x42e5('0x25')](respondWithResult(_0xc8de4d,0xc9))[_0x42e5('0x42')](handleError(_0xc8de4d,null));};exports[_0x42e5('0x24')]=function(_0x48757e,_0x2ab52a){if(_0x48757e[_0x42e5('0x47')]['id']){delete _0x48757e[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x48757e['params']['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x2ab52a,null))['then'](saveUpdates(_0x48757e[_0x42e5('0x47')],null))[_0x42e5('0x25')](respondWithResult(_0x2ab52a,null))[_0x42e5('0x42')](handleError(_0x2ab52a,null));};exports['destroy']=function(_0x50f59c,_0x4f0639){return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x50f59c[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x4f0639,null))['then'](removeEntity(_0x4f0639,null))[_0x42e5('0x42')](handleError(_0x4f0639,null));};exports[_0x42e5('0x49')]=function(_0x18cedc,_0x504110,_0x34e169){var _0x5070aa={};var _0x319088={};var _0x2583cd;var _0x53e29b;return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x18cedc[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x504110,null))[_0x42e5('0x25')](function(_0x3f043f){if(_0x3f043f){_0x2583cd=_0x3f043f;_0x319088[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x4b')][_0x42e5('0x2d')]);_0x319088['query']=_[_0x42e5('0x33')](_0x18cedc[_0x42e5('0x32')]);_0x319088[_0x42e5('0x39')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],_0x319088['query']);_0x5070aa[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x18cedc['query']['fields']));_0x5070aa['attributes']=_0x5070aa[_0x42e5('0x34')][_0x42e5('0x4c')]?_0x5070aa['attributes']:_0x319088[_0x42e5('0x31')];_0x5070aa[_0x42e5('0x38')]=qs[_0x42e5('0x4d')](_0x18cedc[_0x42e5('0x32')][_0x42e5('0x4d')]);_0x5070aa[_0x42e5('0x3c')]=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x18cedc[_0x42e5('0x32')],_0x319088['filters']));if(_0x18cedc[_0x42e5('0x32')]['filter']){_0x5070aa[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x5070aa[_0x42e5('0x3c')],{'$or':_[_0x42e5('0x2b')](_0x5070aa[_0x42e5('0x34')],function(_0x3b46d2){var _0x248cb8={};_0x248cb8[_0x3b46d2]={'$like':'%'+_0x18cedc[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x248cb8;})});}_0x5070aa=_[_0x42e5('0x3d')]({},_0x5070aa,_0x18cedc[_0x42e5('0x45')]);return _0x2583cd['getConfigurations'](_0x5070aa);}})[_0x42e5('0x25')](function(_0x4ff58c){if(_0x4ff58c){_0x53e29b=_0x4ff58c[_0x42e5('0x4c')];if(!_0x18cedc['query'][_0x42e5('0x36')](_0x42e5('0x37'))){_0x5070aa['limit']=qs[_0x42e5('0x1f')](_0x18cedc[_0x42e5('0x32')]['limit']);_0x5070aa[_0x42e5('0x1d')]=qs[_0x42e5('0x1d')](_0x18cedc['query'][_0x42e5('0x1d')]);}return _0x2583cd[_0x42e5('0x49')](_0x5070aa);}})[_0x42e5('0x25')](function(_0x57814b){if(_0x57814b){return _0x57814b?{'count':_0x53e29b,'rows':_0x57814b}:null;}})[_0x42e5('0x25')](respondWithResult(_0x504110,null))[_0x42e5('0x42')](handleError(_0x504110,null));};exports[_0x42e5('0x4e')]=function(_0x78394d,_0x57368e,_0x42db50){if(_0x78394d['body']['id']){delete _0x78394d[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x78394d[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x57368e,null))[_0x42e5('0x25')](function(_0x15ff42){if(_0x15ff42){_0x78394d['body'][_0x42e5('0x4f')]=_0x15ff42['id'];_0x78394d[_0x42e5('0x47')][_0x42e5('0x50')]=integrations[_0x42e5('0x51')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')][_0x42e5('0x2f')]);_0x78394d[_0x42e5('0x47')]['Descriptions']=integrations[_0x42e5('0x53')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')]['type']);return db[_0x42e5('0x4b')][_0x42e5('0x46')](_0x78394d[_0x42e5('0x47')],{'include':[{'model':db[_0x42e5('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x42e5('0x25')](respondWithResult(_0x57368e,null))[_0x42e5('0x42')](handleError(_0x57368e,null));};exports[_0x42e5('0x55')]=function(_0x2ce1d4,_0xb198d,_0x14d111){var _0x1cfe79='';return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x2ce1d4['params']['id']},'attributes':['id',_0x42e5('0x56'),_0x42e5('0x57'),_0x42e5('0x58'),_0x42e5('0x59'),_0x42e5('0x5a')]})[_0x42e5('0x25')](handleEntityNotFound(_0xb198d,null))[_0x42e5('0x25')](function(_0x147613){if(_0x147613){_0x1cfe79=_0x147613['remoteUri'];var _0x548f8a=_0x1cfe79[_0x42e5('0x5b')](-0x1);if(_0x548f8a==='/'){_0x1cfe79=_0x1cfe79[_0x42e5('0x5c')](0x0,_0x1cfe79['lastIndexOf'](_0x548f8a));}var _0x4b9559={'method':'GET','uri':util[_0x42e5('0x5d')](_0x42e5('0x5e'),_0x1cfe79,'ticket_fields'),'json':!![]};switch(_0x147613[_0x42e5('0x59')]){case _0x42e5('0x57'):_0x4b9559['headers']={'Authorization':util[_0x42e5('0x5d')](_0x42e5('0x5f'),new Buffer(util['format'](_0x42e5('0x60'),_0x147613['username'],_0x147613['password']))['toString']('base64'))};break;case _0x42e5('0x58'):_0x4b9559[_0x42e5('0x61')]={'Authorization':util['format'](_0x42e5('0x5f'),new Buffer(util[_0x42e5('0x5d')](_0x42e5('0x62'),_0x147613[_0x42e5('0x56')],_0x147613[_0x42e5('0x58')]))[_0x42e5('0x63')]('base64'))};break;default:throw new db[(_0x42e5('0x64'))][(_0x42e5('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x4b9559);}})['then'](function(_0x2faf9b){if(_0x2faf9b){var _0xfa822e=[_0x42e5('0x66'),_0x42e5('0x67'),_0x42e5('0x68'),_0x42e5('0x69')];_[_0x42e5('0x6a')](_0x2faf9b['ticket_fields'],function(_0x5a1b63){return _0xfa822e['includes'](_0x5a1b63['type']);});return{'count':_0x2faf9b[_0x42e5('0x6b')][_0x42e5('0x4c')],'rows':_['map'](_0x2faf9b[_0x42e5('0x6b')],function(_0x5debb1){return{'id':_0x5debb1['id'],'name':_0x5debb1[_0x42e5('0x6c')]>0x7?_0x5debb1[_0x42e5('0x6d')]:_0x5debb1[_0x42e5('0x2f')],'custom':_0x5debb1[_0x42e5('0x6c')]>0x7?!![]:![],'options':_0x5debb1[_0x42e5('0x6e')]?_0x5debb1[_0x42e5('0x6e')]:_0x5debb1[_0x42e5('0x6f')]?_0x5debb1[_0x42e5('0x6f')]:[]};})};}})[_0x42e5('0x25')](respondWithResult(_0xb198d,null))[_0x42e5('0x42')](function(_0x1ee9b2){var _0x78573b=_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?0x1f4:_0x1ee9b2[_0x42e5('0x71')]||0x1f4;logger[_0x42e5('0x72')](_0x42e5('0x73'),_0x42e5('0x55'),_0x78573b,JSON['stringify'](_0x1ee9b2));delete _0x1ee9b2[_0x42e5('0x28')];if(_0x78573b===0x191){_0x78573b=0x190;}_0xb198d[_0x42e5('0x1a')](_0x78573b)[_0x42e5('0x29')](_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?{'message':_0x42e5('0x74'),'statusCode':_0x1ee9b2[_0x42e5('0x71')]}:_0x1ee9b2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 020a6c8..7445ac7 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 _0x67dd=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x55552e,_0x54cedf){var _0x2dc343=function(_0x1c1d1d){while(--_0x1c1d1d){_0x55552e['push'](_0x55552e['shift']());}};_0x2dc343(++_0x54cedf);}(_0x67dd,0x193));var _0xd67d=function(_0x26cab9,_0x1b290d){_0x26cab9=_0x26cab9-0x0;var _0x5d9b83=_0x67dd[_0x26cab9];return _0x5d9b83;};'use strict';var _=require(_0xd67d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd67d('0x1'));var moment=require(_0xd67d('0x2'));var BPromise=require('bluebird');var rp=require(_0xd67d('0x3'));var fs=require('fs');var path=require(_0xd67d('0x4'));var rimraf=require(_0xd67d('0x5'));var config=require(_0xd67d('0x6'));var attributes=require(_0xd67d('0x7'));var integrations=require(_0xd67d('0x8'));module[_0xd67d('0x9')]=function(_0x6856eb,_0x51a82a){return _0x6856eb[_0xd67d('0xa')](_0xd67d('0xb'),attributes,{'tableName':_0xd67d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcba0=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x2539e6,_0x595d36){var _0xe83570=function(_0x2a8b2e){while(--_0x2a8b2e){_0x2539e6['push'](_0x2539e6['shift']());}};_0xe83570(++_0x595d36);}(_0xcba0,0xb5));var _0x0cba=function(_0x3a1a52,_0x16a4d7){_0x3a1a52=_0x3a1a52-0x0;var _0x4a262a=_0xcba0[_0x3a1a52];return _0x4a262a;};'use strict';var _=require(_0x0cba('0x0'));var util=require(_0x0cba('0x1'));var logger=require(_0x0cba('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0cba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cba('0x4'));var rimraf=require(_0x0cba('0x5'));var config=require(_0x0cba('0x6'));var attributes=require(_0x0cba('0x7'));var integrations=require(_0x0cba('0x8'));module[_0x0cba('0x9')]=function(_0x2a7472,_0x172a1f){return _0x2a7472[_0x0cba('0xa')](_0x0cba('0xb'),attributes,{'tableName':_0x0cba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2f439cc..1adc9b8 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 _0x1d64=['error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','limit','map','include','model','attributes','debug','stringify','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0xdde4d2,_0x409a90){var _0x68d974=function(_0x7ca962){while(--_0x7ca962){_0xdde4d2['push'](_0xdde4d2['shift']());}};_0x68d974(++_0x409a90);}(_0x1d64,0x1cd));var _0x41d6=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0x1d64[_0x541a67];return _0x45da2a;};'use strict';var _=require(_0x41d6('0x0'));var util=require(_0x41d6('0x1'));var moment=require(_0x41d6('0x2'));var BPromise=require(_0x41d6('0x3'));var rs=require(_0x41d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41d6('0x5'))['db'];var utils=require(_0x41d6('0x6'));var logger=require(_0x41d6('0x7'))(_0x41d6('0x8'));var config=require('../../config/environment');var jayson=require(_0x41d6('0x9'));var client=jayson[_0x41d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5515e6,_0x5605e8,_0x4a63c5){return new BPromise(function(_0x131376,_0x2d359e){return client['request'](_0x5515e6,_0x4a63c5)[_0x41d6('0xb')](function(_0x47b46a){logger[_0x41d6('0xc')](_0x41d6('0xd'),_0x5605e8,_0x41d6('0xe'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5605e8,_0x41d6('0xe'),JSON['stringify'](_0x47b46a));if(_0x47b46a['error']){if(_0x47b46a[_0x41d6('0xf')][_0x41d6('0x10')]===0x1f4){logger[_0x41d6('0xf')](_0x41d6('0xd'),_0x5605e8,_0x47b46a[_0x41d6('0xf')]['message']);return _0x2d359e(_0x47b46a[_0x41d6('0xf')]['message']);}logger[_0x41d6('0xf')](_0x41d6('0xd'),_0x5605e8,_0x47b46a[_0x41d6('0xf')][_0x41d6('0x11')]);return _0x131376(_0x47b46a[_0x41d6('0xf')][_0x41d6('0x11')]);}else{logger[_0x41d6('0xc')](_0x41d6('0xd'),_0x5605e8,'request\x20sent');_0x131376(_0x47b46a[_0x41d6('0x12')]['message']);}})[_0x41d6('0x13')](function(_0x1426be){logger[_0x41d6('0xf')](_0x41d6('0xd'),_0x5605e8,_0x1426be);_0x2d359e(_0x1426be);});});}exports[_0x41d6('0x14')]=function(_0x342bf6){var _0x146ba2=this;return new Promise(function(_0xd91c79,_0x11d2a8){return db[_0x41d6('0x15')][_0x41d6('0x16')]({'raw':_0x342bf6['options']?_0x342bf6[_0x41d6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x342bf6[_0x41d6('0x17')]?_0x342bf6[_0x41d6('0x17')][_0x41d6('0x18')]||null:null,'attributes':_0x342bf6[_0x41d6('0x17')]?_0x342bf6[_0x41d6('0x17')]['attributes']||null:null,'limit':_0x342bf6[_0x41d6('0x17')]?_0x342bf6['options'][_0x41d6('0x19')]||null:null,'include':_0x342bf6[_0x41d6('0x17')]?_0x342bf6[_0x41d6('0x17')]['include']?_[_0x41d6('0x1a')](_0x342bf6['options'][_0x41d6('0x1b')],function(_0x489db7){return{'model':db[_0x489db7[_0x41d6('0x1c')]],'as':_0x489db7['as'],'attributes':_0x489db7['attributes'],'include':_0x489db7[_0x41d6('0x1b')]?_[_0x41d6('0x1a')](_0x489db7[_0x41d6('0x1b')],function(_0x2370c0){return{'model':db[_0x2370c0[_0x41d6('0x1c')]],'as':_0x2370c0['as'],'attributes':_0x2370c0[_0x41d6('0x1d')],'include':_0x2370c0[_0x41d6('0x1b')]?_['map'](_0x2370c0[_0x41d6('0x1b')],function(_0x5caba8){return{'model':db[_0x5caba8[_0x41d6('0x1c')]],'as':_0x5caba8['as'],'attributes':_0x5caba8[_0x41d6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8ff89e){logger[_0x41d6('0xc')](_0x41d6('0x14'),_0x342bf6);logger[_0x41d6('0x1e')](_0x41d6('0x14'),_0x342bf6,JSON[_0x41d6('0x1f')](_0x8ff89e));_0xd91c79(_0x8ff89e);})[_0x41d6('0x13')](function(_0x34ad66){logger['error'](_0x41d6('0x14'),_0x34ad66[_0x41d6('0x11')],_0x342bf6);_0x11d2a8(_0x146ba2['error'](0x1f4,_0x34ad66[_0x41d6('0x11')]));});});};exports[_0x41d6('0x20')]=function(_0x26badf){var _0x50e680=this;return new Promise(function(_0x1015b0,_0xc72fc8){return db['ZendeskAccount'][_0x41d6('0x21')]({'raw':_0x26badf['options']?_0x26badf[_0x41d6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x26badf['options']?_0x26badf[_0x41d6('0x17')][_0x41d6('0x18')]||null:null,'attributes':_0x26badf['options']?_0x26badf[_0x41d6('0x17')][_0x41d6('0x1d')]||null:null,'include':_0x26badf[_0x41d6('0x17')]?_0x26badf[_0x41d6('0x17')][_0x41d6('0x1b')]?_[_0x41d6('0x1a')](_0x26badf[_0x41d6('0x17')]['include'],function(_0x3d1bc1){return{'model':db[_0x3d1bc1['model']],'as':_0x3d1bc1['as'],'attributes':_0x3d1bc1[_0x41d6('0x1d')],'include':_0x3d1bc1[_0x41d6('0x1b')]?_['map'](_0x3d1bc1[_0x41d6('0x1b')],function(_0x29d4b9){return{'model':db[_0x29d4b9[_0x41d6('0x1c')]],'as':_0x29d4b9['as'],'attributes':_0x29d4b9[_0x41d6('0x1d')],'include':_0x29d4b9[_0x41d6('0x1b')]?_['map'](_0x29d4b9['include'],function(_0x24187a){return{'model':db[_0x24187a[_0x41d6('0x1c')]],'as':_0x24187a['as'],'attributes':_0x24187a[_0x41d6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x41d6('0xb')](function(_0x174830){logger[_0x41d6('0xc')]('ShowZendeskAccount',_0x26badf);logger[_0x41d6('0x1e')](_0x41d6('0x20'),_0x26badf,JSON[_0x41d6('0x1f')](_0x174830));_0x1015b0(_0x174830);})[_0x41d6('0x13')](function(_0x5990b6){logger[_0x41d6('0xf')](_0x41d6('0x20'),_0x5990b6[_0x41d6('0x11')],_0x26badf);_0xc72fc8(_0x50e680[_0x41d6('0xf')](0x1f4,_0x5990b6[_0x41d6('0x11')]));});});}; \ No newline at end of file +var _0x5f25=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','limit','include','map','model','attributes','stringify','find','raw','ShowZendeskAccount'];(function(_0x523f4c,_0x534b89){var _0x1f4cd6=function(_0x4ccd38){while(--_0x4ccd38){_0x523f4c['push'](_0x523f4c['shift']());}};_0x1f4cd6(++_0x534b89);}(_0x5f25,0x13b));var _0x55f2=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x5f25[_0x4207a6];return _0x42b37a;};'use strict';var _=require('lodash');var util=require(_0x55f2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x55f2('0x1'));var fs=require('fs');var Redis=require(_0x55f2('0x2'));var db=require(_0x55f2('0x3'))['db'];var utils=require(_0x55f2('0x4'));var logger=require(_0x55f2('0x5'))(_0x55f2('0x6'));var config=require(_0x55f2('0x7'));var jayson=require(_0x55f2('0x8'));var client=jayson[_0x55f2('0x9')][_0x55f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b474e,_0xddd2ee,_0x11d23f){return new BPromise(function(_0x3deb02,_0x581da0){return client[_0x55f2('0xb')](_0x5b474e,_0x11d23f)[_0x55f2('0xc')](function(_0x3daf19){logger[_0x55f2('0xd')](_0x55f2('0xe'),_0xddd2ee,_0x55f2('0xf'));logger[_0x55f2('0x10')](_0x55f2('0x11'),_0xddd2ee,_0x55f2('0xf'),JSON['stringify'](_0x3daf19));if(_0x3daf19[_0x55f2('0x12')]){if(_0x3daf19[_0x55f2('0x12')]['code']===0x1f4){logger[_0x55f2('0x12')](_0x55f2('0xe'),_0xddd2ee,_0x3daf19[_0x55f2('0x12')][_0x55f2('0x13')]);return _0x581da0(_0x3daf19[_0x55f2('0x12')][_0x55f2('0x13')]);}logger['error'](_0x55f2('0xe'),_0xddd2ee,_0x3daf19[_0x55f2('0x12')][_0x55f2('0x13')]);return _0x3deb02(_0x3daf19['error'][_0x55f2('0x13')]);}else{logger[_0x55f2('0xd')](_0x55f2('0xe'),_0xddd2ee,_0x55f2('0xf'));_0x3deb02(_0x3daf19['result'][_0x55f2('0x13')]);}})[_0x55f2('0x14')](function(_0xbbced9){logger[_0x55f2('0x12')](_0x55f2('0xe'),_0xddd2ee,_0xbbced9);_0x581da0(_0xbbced9);});});}exports[_0x55f2('0x15')]=function(_0x564b2f){var _0x2b3348=this;return new Promise(function(_0x172454,_0x4f8a63){return db[_0x55f2('0x16')][_0x55f2('0x17')]({'raw':_0x564b2f[_0x55f2('0x18')]?_0x564b2f[_0x55f2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x564b2f[_0x55f2('0x18')]?_0x564b2f[_0x55f2('0x18')][_0x55f2('0x19')]||null:null,'attributes':_0x564b2f[_0x55f2('0x18')]?_0x564b2f[_0x55f2('0x18')]['attributes']||null:null,'limit':_0x564b2f['options']?_0x564b2f[_0x55f2('0x18')][_0x55f2('0x1a')]||null:null,'include':_0x564b2f['options']?_0x564b2f[_0x55f2('0x18')][_0x55f2('0x1b')]?_[_0x55f2('0x1c')](_0x564b2f[_0x55f2('0x18')][_0x55f2('0x1b')],function(_0x2e0e47){return{'model':db[_0x2e0e47[_0x55f2('0x1d')]],'as':_0x2e0e47['as'],'attributes':_0x2e0e47[_0x55f2('0x1e')],'include':_0x2e0e47[_0x55f2('0x1b')]?_[_0x55f2('0x1c')](_0x2e0e47[_0x55f2('0x1b')],function(_0x4870fe){return{'model':db[_0x4870fe[_0x55f2('0x1d')]],'as':_0x4870fe['as'],'attributes':_0x4870fe[_0x55f2('0x1e')],'include':_0x4870fe[_0x55f2('0x1b')]?_['map'](_0x4870fe[_0x55f2('0x1b')],function(_0xb957a7){return{'model':db[_0xb957a7[_0x55f2('0x1d')]],'as':_0xb957a7['as'],'attributes':_0xb957a7[_0x55f2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x301797){logger[_0x55f2('0xd')](_0x55f2('0x15'),_0x564b2f);logger[_0x55f2('0x10')](_0x55f2('0x15'),_0x564b2f,JSON[_0x55f2('0x1f')](_0x301797));_0x172454(_0x301797);})['catch'](function(_0x56ce8c){logger[_0x55f2('0x12')](_0x55f2('0x15'),_0x56ce8c[_0x55f2('0x13')],_0x564b2f);_0x4f8a63(_0x2b3348[_0x55f2('0x12')](0x1f4,_0x56ce8c['message']));});});};exports['ShowZendeskAccount']=function(_0x5c7e0f){var _0x89eb9b=this;return new Promise(function(_0x309327,_0x545e42){return db[_0x55f2('0x16')][_0x55f2('0x20')]({'raw':_0x5c7e0f[_0x55f2('0x18')]?_0x5c7e0f[_0x55f2('0x18')][_0x55f2('0x21')]===undefined?!![]:![]:!![],'where':_0x5c7e0f[_0x55f2('0x18')]?_0x5c7e0f[_0x55f2('0x18')][_0x55f2('0x19')]||null:null,'attributes':_0x5c7e0f[_0x55f2('0x18')]?_0x5c7e0f['options'][_0x55f2('0x1e')]||null:null,'include':_0x5c7e0f[_0x55f2('0x18')]?_0x5c7e0f[_0x55f2('0x18')][_0x55f2('0x1b')]?_[_0x55f2('0x1c')](_0x5c7e0f['options'][_0x55f2('0x1b')],function(_0x580b8f){return{'model':db[_0x580b8f[_0x55f2('0x1d')]],'as':_0x580b8f['as'],'attributes':_0x580b8f['attributes'],'include':_0x580b8f[_0x55f2('0x1b')]?_[_0x55f2('0x1c')](_0x580b8f[_0x55f2('0x1b')],function(_0x3084db){return{'model':db[_0x3084db[_0x55f2('0x1d')]],'as':_0x3084db['as'],'attributes':_0x3084db[_0x55f2('0x1e')],'include':_0x3084db[_0x55f2('0x1b')]?_[_0x55f2('0x1c')](_0x3084db[_0x55f2('0x1b')],function(_0x2ad768){return{'model':db[_0x2ad768[_0x55f2('0x1d')]],'as':_0x2ad768['as'],'attributes':_0x2ad768[_0x55f2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ee13c){logger['info'](_0x55f2('0x22'),_0x5c7e0f);logger[_0x55f2('0x10')](_0x55f2('0x22'),_0x5c7e0f,JSON[_0x55f2('0x1f')](_0x5ee13c));_0x309327(_0x5ee13c);})[_0x55f2('0x14')](function(_0x353336){logger[_0x55f2('0x12')]('ShowZendeskAccount',_0x353336[_0x55f2('0x13')],_0x5c7e0f);_0x545e42(_0x89eb9b[_0x55f2('0x12')](0x1f4,_0x353336['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9e8a029..059cd24 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 _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x4fdf2f,_0x33cc47){var _0xac01dd=function(_0x524fc3){while(--_0x524fc3){_0x4fdf2f['push'](_0x4fdf2f['shift']());}};_0xac01dd(++_0x33cc47);}(_0x4fc2,0x111));var _0x24fc=function(_0x131fe7,_0x21fcdb){_0x131fe7=_0x131fe7-0x0;var _0x2eddf3=_0x4fc2[_0x131fe7];return _0x2eddf3;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=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(_0xd35665,_0xbd2799){var _0x129fd8=function(_0x5e4636){while(--_0x5e4636){_0xd35665['push'](_0xd35665['shift']());}};_0x129fd8(++_0xbd2799);}(_0xe706,0xa3));var _0x6e70=function(_0xc721f5,_0x42404b){_0xc721f5=_0xc721f5-0x0;var _0x1bc1bd=_0xe706[_0xc721f5];return _0x1bc1bd;};'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 16652bc..1d5a8cb 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 _0xf9c7=['STRING','sequelize','exports'];(function(_0x53547b,_0x33b155){var _0x3bf8df=function(_0xbb793e){while(--_0xbb793e){_0x53547b['push'](_0x53547b['shift']());}};_0x3bf8df(++_0x33b155);}(_0xf9c7,0xeb));var _0x7f9c=function(_0x407a37,_0x1c2c18){_0x407a37=_0x407a37-0x0;var _0x563b49=_0xf9c7[_0x407a37];return _0x563b49;};'use strict';var Sequelize=require(_0x7f9c('0x0'));module[_0x7f9c('0x1')]={'name':{'type':Sequelize[_0x7f9c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5bfe=['sequelize','STRING'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0x5bfe,0x14c));var _0xe5bf=function(_0x25b4ff,_0x4e961c){_0x25b4ff=_0x25b4ff-0x0;var _0x2ed1a9=_0x5bfe[_0x25b4ff];return _0x2ed1a9;};'use strict';var Sequelize=require(_0xe5bf('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5bf('0x1')]},'description':{'type':Sequelize[_0xe5bf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b005e75..b243db3 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 _0xb3ad=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','update','then','destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','nolimit','order','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','fields','find','create','body','getFields','findOne','ZendeskField','sort','filter','getSubjects','getDescriptions','hasOwnProperty','getTags','Tag','ids'];(function(_0x35bb3e,_0xecbee){var _0x57950d=function(_0x270d22){while(--_0x270d22){_0x35bb3e['push'](_0x35bb3e['shift']());}};_0x57950d(++_0xecbee);}(_0xb3ad,0x1f2));var _0xdb3a=function(_0xe92689,_0x477267){_0xe92689=_0xe92689-0x0;var _0x54fcd2=_0xb3ad[_0xe92689];return _0x54fcd2;};'use strict';var emlformat=require(_0xdb3a('0x0'));var rimraf=require(_0xdb3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdb3a('0x2'));var moment=require('moment');var BPromise=require(_0xdb3a('0x3'));var Mustache=require(_0xdb3a('0x4'));var util=require(_0xdb3a('0x5'));var path=require(_0xdb3a('0x6'));var sox=require(_0xdb3a('0x7'));var csv=require(_0xdb3a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb3a('0x9'));var _=require(_0xdb3a('0xa'));var squel=require('squel');var crypto=require(_0xdb3a('0xb'));var jsforce=require(_0xdb3a('0xc'));var deskjs=require(_0xdb3a('0xd'));var toCsv=require(_0xdb3a('0x8'));var querystring=require(_0xdb3a('0xe'));var Papa=require(_0xdb3a('0xf'));var Redis=require(_0xdb3a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdb3a('0x11'));var as=require(_0xdb3a('0x12'));var hardwareService=require(_0xdb3a('0x13'));var logger=require(_0xdb3a('0x14'))('api');var utils=require(_0xdb3a('0x15'));var config=require(_0xdb3a('0x16'));var licenseUtil=require(_0xdb3a('0x17'));var db=require(_0xdb3a('0x18'))['db'];function respondWithStatusCode(_0x579ba8,_0x1ba058){_0x1ba058=_0x1ba058||0xcc;return function(_0x4d4356){if(_0x4d4356){return _0x579ba8[_0xdb3a('0x19')](_0x1ba058);}return _0x579ba8[_0xdb3a('0x1a')](_0x1ba058)[_0xdb3a('0x1b')]();};}function respondWithResult(_0x37eeb1,_0x163948){_0x163948=_0x163948||0xc8;return function(_0x5233fd){if(_0x5233fd){return _0x37eeb1[_0xdb3a('0x1a')](_0x163948)[_0xdb3a('0x1c')](_0x5233fd);}};}function respondWithFilteredResult(_0x374e58,_0x1ea524){return function(_0x20c557){if(_0x20c557){var _0x59ae45=typeof _0x1ea524[_0xdb3a('0x1d')]===_0xdb3a('0x1e')&&typeof _0x1ea524['limit']==='undefined';var _0x4a9635=_0x20c557['count'];var _0x73c0f3=_0x59ae45?0x0:_0x1ea524['offset'];var _0x525cff=_0x59ae45?_0x20c557['count']:_0x1ea524['offset']+_0x1ea524[_0xdb3a('0x1f')];var _0x3d6889;if(_0x525cff>=_0x4a9635){_0x525cff=_0x4a9635;_0x3d6889=0xc8;}else{_0x3d6889=0xce;}_0x374e58[_0xdb3a('0x1a')](_0x3d6889);return _0x374e58['set'](_0xdb3a('0x20'),_0x73c0f3+'-'+_0x525cff+'/'+_0x4a9635)['json'](_0x20c557);}return null;};}function patchUpdates(_0x4813ce){return function(_0x469a47){try{jsonpatch['apply'](_0x469a47,_0x4813ce,!![]);}catch(_0x520149){return BPromise[_0xdb3a('0x21')](_0x520149);}return _0x469a47['save']();};}function saveUpdates(_0x13403f,_0x1406f9){return function(_0x560a14){if(_0x560a14){return _0x560a14[_0xdb3a('0x22')](_0x13403f)[_0xdb3a('0x23')](function(_0x3aa3fb){return _0x3aa3fb;});}return null;};}function removeEntity(_0x4af39b,_0x3e837a){return function(_0x4b95cf){if(_0x4b95cf){return _0x4b95cf[_0xdb3a('0x24')]()[_0xdb3a('0x23')](function(){_0x4af39b[_0xdb3a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1590ce,_0xd3b35e){return function(_0x502d95){if(!_0x502d95){_0x1590ce[_0xdb3a('0x19')](0x194);}return _0x502d95;};}function handleError(_0x1ba56a,_0x26d772){_0x26d772=_0x26d772||0x1f4;return function(_0x32e688){logger[_0xdb3a('0x25')](_0x32e688['stack']);if(_0x32e688[_0xdb3a('0x26')]){delete _0x32e688['name'];}_0x1ba56a[_0xdb3a('0x1a')](_0x26d772)[_0xdb3a('0x27')](_0x32e688);};}exports[_0xdb3a('0x28')]=function(_0x5cf451,_0x37dc6d){var _0x3e8e75={},_0x38096c={},_0x277e6b={'count':0x0,'rows':[]};var _0xdaca8a=_[_0xdb3a('0x29')](db[_0xdb3a('0x2a')][_0xdb3a('0x2b')],function(_0x5bacad){return{'name':_0x5bacad[_0xdb3a('0x2c')],'type':_0x5bacad[_0xdb3a('0x2d')][_0xdb3a('0x2e')]};});_0x38096c[_0xdb3a('0x2f')]=_['map'](_0xdaca8a,_0xdb3a('0x26'));_0x38096c[_0xdb3a('0x30')]=_['keys'](_0x5cf451['query']);_0x38096c[_0xdb3a('0x31')]=_['intersection'](_0x38096c[_0xdb3a('0x2f')],_0x38096c[_0xdb3a('0x30')]);_0x3e8e75[_0xdb3a('0x32')]=_[_0xdb3a('0x33')](_0x38096c[_0xdb3a('0x2f')],qs['fields'](_0x5cf451[_0xdb3a('0x30')]['fields']));_0x3e8e75[_0xdb3a('0x32')]=_0x3e8e75[_0xdb3a('0x32')][_0xdb3a('0x34')]?_0x3e8e75['attributes']:_0x38096c[_0xdb3a('0x2f')];if(!_0x5cf451[_0xdb3a('0x30')]['hasOwnProperty'](_0xdb3a('0x35'))){_0x3e8e75[_0xdb3a('0x1f')]=qs['limit'](_0x5cf451[_0xdb3a('0x30')][_0xdb3a('0x1f')]);_0x3e8e75[_0xdb3a('0x1d')]=qs[_0xdb3a('0x1d')](_0x5cf451[_0xdb3a('0x30')][_0xdb3a('0x1d')]);}_0x3e8e75[_0xdb3a('0x36')]=qs['sort'](_0x5cf451['query']['sort']);_0x3e8e75[_0xdb3a('0x37')]=qs[_0xdb3a('0x31')](_[_0xdb3a('0x38')](_0x5cf451['query'],_0x38096c['filters']),_0xdaca8a);if(_0x5cf451['query']['filter']){_0x3e8e75[_0xdb3a('0x37')]=_[_0xdb3a('0x39')](_0x3e8e75[_0xdb3a('0x37')],{'$or':_['map'](_0xdaca8a,function(_0x5037e5){if(_0x5037e5[_0xdb3a('0x2d')]!==_0xdb3a('0x3a')){var _0x329c5a={};_0x329c5a[_0x5037e5[_0xdb3a('0x26')]]={'$like':'%'+_0x5cf451[_0xdb3a('0x30')]['filter']+'%'};return _0x329c5a;}})});}_0x3e8e75=_[_0xdb3a('0x39')]({},_0x3e8e75,_0x5cf451[_0xdb3a('0x3b')]);var _0x2ddfa8={'where':_0x3e8e75[_0xdb3a('0x37')]};return db[_0xdb3a('0x2a')][_0xdb3a('0x3c')](_0x2ddfa8)['then'](function(_0x3be834){_0x277e6b['count']=_0x3be834;if(_0x5cf451[_0xdb3a('0x30')][_0xdb3a('0x3d')]){_0x3e8e75[_0xdb3a('0x3e')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xdb3a('0x3f')](_0x3e8e75);})[_0xdb3a('0x23')](function(_0x4dda05){_0x277e6b['rows']=_0x4dda05;return _0x277e6b;})[_0xdb3a('0x23')](respondWithFilteredResult(_0x37dc6d,_0x3e8e75))[_0xdb3a('0x40')](handleError(_0x37dc6d,null));};exports[_0xdb3a('0x41')]=function(_0x294ddb,_0x2f0471){var _0x33bde6={'raw':![],'where':{'id':_0x294ddb[_0xdb3a('0x42')]['id']}},_0x3328f0={};_0x3328f0['model']=_[_0xdb3a('0x43')](db[_0xdb3a('0x2a')][_0xdb3a('0x2b')]);_0x3328f0[_0xdb3a('0x30')]=_[_0xdb3a('0x43')](_0x294ddb[_0xdb3a('0x30')]);_0x3328f0[_0xdb3a('0x31')]=_[_0xdb3a('0x33')](_0x3328f0[_0xdb3a('0x2f')],_0x3328f0[_0xdb3a('0x30')]);_0x33bde6[_0xdb3a('0x32')]=_['intersection'](_0x3328f0[_0xdb3a('0x2f')],qs[_0xdb3a('0x44')](_0x294ddb['query'][_0xdb3a('0x44')]));_0x33bde6[_0xdb3a('0x32')]=_0x33bde6[_0xdb3a('0x32')]['length']?_0x33bde6['attributes']:_0x3328f0['model'];if(_0x294ddb[_0xdb3a('0x30')]['includeAll']){_0x33bde6[_0xdb3a('0x3e')]=[{'all':!![]}];}_0x33bde6=_[_0xdb3a('0x39')]({},_0x33bde6,_0x294ddb['options']);return db['ZendeskConfiguration'][_0xdb3a('0x45')](_0x33bde6)[_0xdb3a('0x23')](handleEntityNotFound(_0x2f0471,null))[_0xdb3a('0x23')](respondWithResult(_0x2f0471,null))['catch'](handleError(_0x2f0471,null));};exports[_0xdb3a('0x46')]=function(_0x3712da,_0x14f963){return db[_0xdb3a('0x2a')]['create'](_0x3712da[_0xdb3a('0x47')],{})[_0xdb3a('0x23')](respondWithResult(_0x14f963,0xc9))[_0xdb3a('0x40')](handleError(_0x14f963,null));};exports[_0xdb3a('0x22')]=function(_0x52eb4a,_0x921d1e){if(_0x52eb4a['body']['id']){delete _0x52eb4a['body']['id'];}return db['ZendeskConfiguration'][_0xdb3a('0x45')]({'where':{'id':_0x52eb4a['params']['id']}})[_0xdb3a('0x23')](handleEntityNotFound(_0x921d1e,null))[_0xdb3a('0x23')](saveUpdates(_0x52eb4a[_0xdb3a('0x47')],null))[_0xdb3a('0x23')](respondWithResult(_0x921d1e,null))['catch'](handleError(_0x921d1e,null));};exports[_0xdb3a('0x24')]=function(_0x36b8e4,_0x1ed48c){return db[_0xdb3a('0x2a')][_0xdb3a('0x45')]({'where':{'id':_0x36b8e4['params']['id']}})[_0xdb3a('0x23')](handleEntityNotFound(_0x1ed48c,null))[_0xdb3a('0x23')](removeEntity(_0x1ed48c,null))[_0xdb3a('0x40')](handleError(_0x1ed48c,null));};exports[_0xdb3a('0x48')]=function(_0x310280,_0x2945ab,_0x266a1b){var _0x5cfb50={};var _0x1c79ae={};var _0x4373ca;var _0x2e02fe;return db[_0xdb3a('0x2a')][_0xdb3a('0x49')]({'where':{'id':_0x310280[_0xdb3a('0x42')]['id']}})[_0xdb3a('0x23')](handleEntityNotFound(_0x2945ab,null))[_0xdb3a('0x23')](function(_0x2c6ba3){if(_0x2c6ba3){_0x4373ca=_0x2c6ba3;_0x1c79ae[_0xdb3a('0x2f')]=_[_0xdb3a('0x43')](db[_0xdb3a('0x4a')]['rawAttributes']);_0x1c79ae[_0xdb3a('0x30')]=_['keys'](_0x310280[_0xdb3a('0x30')]);_0x1c79ae[_0xdb3a('0x31')]=_['intersection'](_0x1c79ae['model'],_0x1c79ae['query']);_0x5cfb50[_0xdb3a('0x32')]=_[_0xdb3a('0x33')](_0x1c79ae[_0xdb3a('0x2f')],qs[_0xdb3a('0x44')](_0x310280[_0xdb3a('0x30')][_0xdb3a('0x44')]));_0x5cfb50[_0xdb3a('0x32')]=_0x5cfb50[_0xdb3a('0x32')][_0xdb3a('0x34')]?_0x5cfb50[_0xdb3a('0x32')]:_0x1c79ae[_0xdb3a('0x2f')];_0x5cfb50[_0xdb3a('0x36')]=qs[_0xdb3a('0x4b')](_0x310280[_0xdb3a('0x30')]['sort']);_0x5cfb50[_0xdb3a('0x37')]=qs['filters'](_['pick'](_0x310280[_0xdb3a('0x30')],_0x1c79ae['filters']));if(_0x310280[_0xdb3a('0x30')][_0xdb3a('0x4c')]){_0x5cfb50[_0xdb3a('0x37')]=_[_0xdb3a('0x39')](_0x5cfb50['where'],{'$or':_[_0xdb3a('0x29')](_0x5cfb50[_0xdb3a('0x32')],function(_0x838fe3){var _0x24d217={};_0x24d217[_0x838fe3]={'$like':'%'+_0x310280[_0xdb3a('0x30')][_0xdb3a('0x4c')]+'%'};return _0x24d217;})});}_0x5cfb50=_['merge']({},_0x5cfb50,_0x310280[_0xdb3a('0x3b')]);return _0x4373ca['getFields'](_0x5cfb50);}})[_0xdb3a('0x23')](function(_0xf04749){if(_0xf04749){_0x2e02fe=_0xf04749['length'];if(!_0x310280['query']['hasOwnProperty']('nolimit')){_0x5cfb50[_0xdb3a('0x1f')]=qs[_0xdb3a('0x1f')](_0x310280[_0xdb3a('0x30')][_0xdb3a('0x1f')]);_0x5cfb50[_0xdb3a('0x1d')]=qs['offset'](_0x310280[_0xdb3a('0x30')][_0xdb3a('0x1d')]);}return _0x4373ca[_0xdb3a('0x48')](_0x5cfb50);}})[_0xdb3a('0x23')](function(_0x4054d0){if(_0x4054d0){return _0x4054d0?{'count':_0x2e02fe,'rows':_0x4054d0}:null;}})[_0xdb3a('0x23')](respondWithResult(_0x2945ab,null))[_0xdb3a('0x40')](handleError(_0x2945ab,null));};exports[_0xdb3a('0x4d')]=function(_0x13097d,_0x2c18d3,_0xcb7cf5){var _0x20530b={};var _0x33e0df={};var _0x3eaf02;var _0x1fb9f8;return db[_0xdb3a('0x2a')][_0xdb3a('0x49')]({'where':{'id':_0x13097d['params']['id']}})[_0xdb3a('0x23')](handleEntityNotFound(_0x2c18d3,null))['then'](function(_0x3edf0e){if(_0x3edf0e){_0x3eaf02=_0x3edf0e;_0x33e0df[_0xdb3a('0x2f')]=_[_0xdb3a('0x43')](db[_0xdb3a('0x4a')][_0xdb3a('0x2b')]);_0x33e0df[_0xdb3a('0x30')]=_['keys'](_0x13097d[_0xdb3a('0x30')]);_0x33e0df[_0xdb3a('0x31')]=_[_0xdb3a('0x33')](_0x33e0df[_0xdb3a('0x2f')],_0x33e0df[_0xdb3a('0x30')]);_0x20530b[_0xdb3a('0x32')]=_['intersection'](_0x33e0df[_0xdb3a('0x2f')],qs[_0xdb3a('0x44')](_0x13097d[_0xdb3a('0x30')]['fields']));_0x20530b[_0xdb3a('0x32')]=_0x20530b['attributes']['length']?_0x20530b[_0xdb3a('0x32')]:_0x33e0df[_0xdb3a('0x2f')];_0x20530b['order']=qs[_0xdb3a('0x4b')](_0x13097d[_0xdb3a('0x30')][_0xdb3a('0x4b')]);_0x20530b[_0xdb3a('0x37')]=qs[_0xdb3a('0x31')](_[_0xdb3a('0x38')](_0x13097d[_0xdb3a('0x30')],_0x33e0df[_0xdb3a('0x31')]));if(_0x13097d[_0xdb3a('0x30')][_0xdb3a('0x4c')]){_0x20530b[_0xdb3a('0x37')]=_[_0xdb3a('0x39')](_0x20530b[_0xdb3a('0x37')],{'$or':_[_0xdb3a('0x29')](_0x20530b['attributes'],function(_0x30411a){var _0x120c4e={};_0x120c4e[_0x30411a]={'$like':'%'+_0x13097d['query'][_0xdb3a('0x4c')]+'%'};return _0x120c4e;})});}_0x20530b=_[_0xdb3a('0x39')]({},_0x20530b,_0x13097d['options']);return _0x3eaf02['getSubjects'](_0x20530b);}})[_0xdb3a('0x23')](function(_0x193d6a){if(_0x193d6a){_0x1fb9f8=_0x193d6a['length'];if(!_0x13097d[_0xdb3a('0x30')]['hasOwnProperty'](_0xdb3a('0x35'))){_0x20530b[_0xdb3a('0x1f')]=qs[_0xdb3a('0x1f')](_0x13097d['query'][_0xdb3a('0x1f')]);_0x20530b[_0xdb3a('0x1d')]=qs[_0xdb3a('0x1d')](_0x13097d[_0xdb3a('0x30')][_0xdb3a('0x1d')]);}return _0x3eaf02[_0xdb3a('0x4d')](_0x20530b);}})[_0xdb3a('0x23')](function(_0x153605){if(_0x153605){return _0x153605?{'count':_0x1fb9f8,'rows':_0x153605}:null;}})[_0xdb3a('0x23')](respondWithResult(_0x2c18d3,null))[_0xdb3a('0x40')](handleError(_0x2c18d3,null));};exports[_0xdb3a('0x4e')]=function(_0x17083a,_0x4f84fa,_0x4e7312){var _0x1c0de7={};var _0x52d294={};var _0x18e070;var _0x375f9b;return db['ZendeskConfiguration'][_0xdb3a('0x49')]({'where':{'id':_0x17083a[_0xdb3a('0x42')]['id']}})[_0xdb3a('0x23')](handleEntityNotFound(_0x4f84fa,null))[_0xdb3a('0x23')](function(_0xef2ccb){if(_0xef2ccb){_0x18e070=_0xef2ccb;_0x52d294[_0xdb3a('0x2f')]=_[_0xdb3a('0x43')](db[_0xdb3a('0x4a')]['rawAttributes']);_0x52d294[_0xdb3a('0x30')]=_[_0xdb3a('0x43')](_0x17083a[_0xdb3a('0x30')]);_0x52d294['filters']=_['intersection'](_0x52d294[_0xdb3a('0x2f')],_0x52d294['query']);_0x1c0de7[_0xdb3a('0x32')]=_[_0xdb3a('0x33')](_0x52d294[_0xdb3a('0x2f')],qs[_0xdb3a('0x44')](_0x17083a[_0xdb3a('0x30')][_0xdb3a('0x44')]));_0x1c0de7['attributes']=_0x1c0de7[_0xdb3a('0x32')][_0xdb3a('0x34')]?_0x1c0de7['attributes']:_0x52d294[_0xdb3a('0x2f')];_0x1c0de7[_0xdb3a('0x36')]=qs[_0xdb3a('0x4b')](_0x17083a['query']['sort']);_0x1c0de7['where']=qs[_0xdb3a('0x31')](_[_0xdb3a('0x38')](_0x17083a[_0xdb3a('0x30')],_0x52d294[_0xdb3a('0x31')]));if(_0x17083a[_0xdb3a('0x30')][_0xdb3a('0x4c')]){_0x1c0de7['where']=_[_0xdb3a('0x39')](_0x1c0de7[_0xdb3a('0x37')],{'$or':_['map'](_0x1c0de7[_0xdb3a('0x32')],function(_0x25d661){var _0xe496c7={};_0xe496c7[_0x25d661]={'$like':'%'+_0x17083a[_0xdb3a('0x30')][_0xdb3a('0x4c')]+'%'};return _0xe496c7;})});}_0x1c0de7=_[_0xdb3a('0x39')]({},_0x1c0de7,_0x17083a[_0xdb3a('0x3b')]);return _0x18e070['getDescriptions'](_0x1c0de7);}})['then'](function(_0x2d4fef){if(_0x2d4fef){_0x375f9b=_0x2d4fef[_0xdb3a('0x34')];if(!_0x17083a[_0xdb3a('0x30')][_0xdb3a('0x4f')](_0xdb3a('0x35'))){_0x1c0de7[_0xdb3a('0x1f')]=qs[_0xdb3a('0x1f')](_0x17083a[_0xdb3a('0x30')][_0xdb3a('0x1f')]);_0x1c0de7[_0xdb3a('0x1d')]=qs['offset'](_0x17083a[_0xdb3a('0x30')][_0xdb3a('0x1d')]);}return _0x18e070[_0xdb3a('0x4e')](_0x1c0de7);}})[_0xdb3a('0x23')](function(_0x3ed7e2){if(_0x3ed7e2){return _0x3ed7e2?{'count':_0x375f9b,'rows':_0x3ed7e2}:null;}})[_0xdb3a('0x23')](respondWithResult(_0x4f84fa,null))[_0xdb3a('0x40')](handleError(_0x4f84fa,null));};exports[_0xdb3a('0x50')]=function(_0x347ebe,_0x4a57a9,_0x1c7f02){var _0x45a0fb={};var _0x2f7b3d={};var _0x456df1;var _0x5cf3f4;return db[_0xdb3a('0x2a')][_0xdb3a('0x49')]({'where':{'id':_0x347ebe[_0xdb3a('0x42')]['id']}})[_0xdb3a('0x23')](handleEntityNotFound(_0x4a57a9,null))[_0xdb3a('0x23')](function(_0x1fd389){if(_0x1fd389){_0x456df1=_0x1fd389;_0x2f7b3d[_0xdb3a('0x2f')]=_[_0xdb3a('0x43')](db[_0xdb3a('0x51')]['rawAttributes']);_0x2f7b3d[_0xdb3a('0x30')]=_[_0xdb3a('0x43')](_0x347ebe[_0xdb3a('0x30')]);_0x2f7b3d[_0xdb3a('0x31')]=_['intersection'](_0x2f7b3d['model'],_0x2f7b3d[_0xdb3a('0x30')]);_0x45a0fb[_0xdb3a('0x32')]=_[_0xdb3a('0x33')](_0x2f7b3d['model'],qs[_0xdb3a('0x44')](_0x347ebe[_0xdb3a('0x30')][_0xdb3a('0x44')]));_0x45a0fb[_0xdb3a('0x32')]=_0x45a0fb[_0xdb3a('0x32')][_0xdb3a('0x34')]?_0x45a0fb[_0xdb3a('0x32')]:_0x2f7b3d[_0xdb3a('0x2f')];_0x45a0fb[_0xdb3a('0x36')]=qs[_0xdb3a('0x4b')](_0x347ebe['query']['sort']);_0x45a0fb[_0xdb3a('0x37')]=qs['filters'](_[_0xdb3a('0x38')](_0x347ebe[_0xdb3a('0x30')],_0x2f7b3d[_0xdb3a('0x31')]));if(_0x347ebe['query'][_0xdb3a('0x4c')]){_0x45a0fb[_0xdb3a('0x37')]=_[_0xdb3a('0x39')](_0x45a0fb[_0xdb3a('0x37')],{'$or':_[_0xdb3a('0x29')](_0x45a0fb['attributes'],function(_0x49fea8){var _0x1f2ec8={};_0x1f2ec8[_0x49fea8]={'$like':'%'+_0x347ebe[_0xdb3a('0x30')]['filter']+'%'};return _0x1f2ec8;})});}_0x45a0fb=_['merge']({},_0x45a0fb,_0x347ebe[_0xdb3a('0x3b')]);return _0x456df1[_0xdb3a('0x50')](_0x45a0fb);}})['then'](function(_0x3f0880){if(_0x3f0880){_0x5cf3f4=_0x3f0880['length'];if(!_0x347ebe[_0xdb3a('0x30')]['hasOwnProperty'](_0xdb3a('0x35'))){_0x45a0fb[_0xdb3a('0x1f')]=qs[_0xdb3a('0x1f')](_0x347ebe['query'][_0xdb3a('0x1f')]);_0x45a0fb['offset']=qs[_0xdb3a('0x1d')](_0x347ebe[_0xdb3a('0x30')]['offset']);}return _0x456df1[_0xdb3a('0x50')](_0x45a0fb);}})['then'](function(_0x387fb5){if(_0x387fb5){return _0x387fb5?{'count':_0x5cf3f4,'rows':_0x387fb5}:null;}})[_0xdb3a('0x23')](respondWithResult(_0x4a57a9,null))[_0xdb3a('0x40')](handleError(_0x4a57a9,null));};exports['setTags']=function(_0x396579,_0x500a7d,_0x3e1f1e){if(_0x396579[_0xdb3a('0x47')]['id']){delete _0x396579[_0xdb3a('0x47')]['id'];}return db[_0xdb3a('0x2a')]['findOne']({'where':{'id':_0x396579[_0xdb3a('0x42')]['id']}})['then'](handleEntityNotFound(_0x500a7d,null))['then'](function(_0xd313aa){if(_0xd313aa){return _0xd313aa['setTags'](_0x396579[_0xdb3a('0x47')][_0xdb3a('0x52')]||[]);}return null;})[_0xdb3a('0x23')](respondWithResult(_0x500a7d,null))[_0xdb3a('0x40')](handleError(_0x500a7d,null));}; \ No newline at end of file +var _0xba90=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','find','create','body','findOne','ZendeskField','getFields','getSubjects','getDescriptions','Tag','getTags','ids','rimraf','fast-json-patch','request-promise','moment'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0xba90,0xa6));var _0x0ba9=function(_0x26ca47,_0x1bb817){_0x26ca47=_0x26ca47-0x0;var _0xa4b530=_0xba90[_0x26ca47];return _0xa4b530;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ba9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ba9('0x1'));var rp=require(_0x0ba9('0x2'));var moment=require(_0x0ba9('0x3'));var BPromise=require(_0x0ba9('0x4'));var Mustache=require(_0x0ba9('0x5'));var util=require(_0x0ba9('0x6'));var path=require(_0x0ba9('0x7'));var sox=require(_0x0ba9('0x8'));var csv=require('to-csv');var ejs=require(_0x0ba9('0x9'));var fs=require('fs');var fs_extra=require(_0x0ba9('0xa'));var _=require(_0x0ba9('0xb'));var squel=require(_0x0ba9('0xc'));var crypto=require(_0x0ba9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0ba9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ba9('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ba9('0x10'));var authService=require(_0x0ba9('0x11'));var qs=require(_0x0ba9('0x12'));var as=require(_0x0ba9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ba9('0x14'))(_0x0ba9('0x15'));var utils=require(_0x0ba9('0x16'));var config=require(_0x0ba9('0x17'));var licenseUtil=require(_0x0ba9('0x18'));var db=require(_0x0ba9('0x19'))['db'];function respondWithStatusCode(_0x4ba6d9,_0x4bb35b){_0x4bb35b=_0x4bb35b||0xcc;return function(_0x424d9d){if(_0x424d9d){return _0x4ba6d9['sendStatus'](_0x4bb35b);}return _0x4ba6d9[_0x0ba9('0x1a')](_0x4bb35b)[_0x0ba9('0x1b')]();};}function respondWithResult(_0x383390,_0x50b8e4){_0x50b8e4=_0x50b8e4||0xc8;return function(_0x5cc455){if(_0x5cc455){return _0x383390[_0x0ba9('0x1a')](_0x50b8e4)[_0x0ba9('0x1c')](_0x5cc455);}};}function respondWithFilteredResult(_0x3ebce3,_0x459cfd){return function(_0x26609d){if(_0x26609d){var _0x5a9637=typeof _0x459cfd['offset']===_0x0ba9('0x1d')&&typeof _0x459cfd[_0x0ba9('0x1e')]==='undefined';var _0xa8ff76=_0x26609d[_0x0ba9('0x1f')];var _0x41e416=_0x5a9637?0x0:_0x459cfd['offset'];var _0x4301c7=_0x5a9637?_0x26609d[_0x0ba9('0x1f')]:_0x459cfd[_0x0ba9('0x20')]+_0x459cfd[_0x0ba9('0x1e')];var _0x1d3e00;if(_0x4301c7>=_0xa8ff76){_0x4301c7=_0xa8ff76;_0x1d3e00=0xc8;}else{_0x1d3e00=0xce;}_0x3ebce3[_0x0ba9('0x1a')](_0x1d3e00);return _0x3ebce3[_0x0ba9('0x21')](_0x0ba9('0x22'),_0x41e416+'-'+_0x4301c7+'/'+_0xa8ff76)['json'](_0x26609d);}return null;};}function patchUpdates(_0x1fdbe5){return function(_0x1f35f9){try{jsonpatch[_0x0ba9('0x23')](_0x1f35f9,_0x1fdbe5,!![]);}catch(_0x489826){return BPromise[_0x0ba9('0x24')](_0x489826);}return _0x1f35f9[_0x0ba9('0x25')]();};}function saveUpdates(_0x295d0e,_0x274e10){return function(_0x439191){if(_0x439191){return _0x439191[_0x0ba9('0x26')](_0x295d0e)[_0x0ba9('0x27')](function(_0x3b831c){return _0x3b831c;});}return null;};}function removeEntity(_0x40519c,_0x51e829){return function(_0x4192b0){if(_0x4192b0){return _0x4192b0[_0x0ba9('0x28')]()[_0x0ba9('0x27')](function(){_0x40519c['status'](0xcc)[_0x0ba9('0x1b')]();});}};}function handleEntityNotFound(_0x5d1589,_0xc4fbad){return function(_0x2125a5){if(!_0x2125a5){_0x5d1589[_0x0ba9('0x29')](0x194);}return _0x2125a5;};}function handleError(_0x3adcf3,_0x3c6445){_0x3c6445=_0x3c6445||0x1f4;return function(_0x4bd3cb){logger[_0x0ba9('0x2a')](_0x4bd3cb[_0x0ba9('0x2b')]);if(_0x4bd3cb['name']){delete _0x4bd3cb[_0x0ba9('0x2c')];}_0x3adcf3[_0x0ba9('0x1a')](_0x3c6445)[_0x0ba9('0x2d')](_0x4bd3cb);};}exports['index']=function(_0xf58d9d,_0x21f379){var _0x346535={},_0x437dc7={},_0x46c609={'count':0x0,'rows':[]};var _0x4d5f4e=_[_0x0ba9('0x2e')](db[_0x0ba9('0x2f')][_0x0ba9('0x30')],function(_0x233e24){return{'name':_0x233e24[_0x0ba9('0x31')],'type':_0x233e24[_0x0ba9('0x32')][_0x0ba9('0x33')]};});_0x437dc7['model']=_['map'](_0x4d5f4e,_0x0ba9('0x2c'));_0x437dc7[_0x0ba9('0x34')]=_[_0x0ba9('0x35')](_0xf58d9d[_0x0ba9('0x34')]);_0x437dc7[_0x0ba9('0x36')]=_[_0x0ba9('0x37')](_0x437dc7[_0x0ba9('0x38')],_0x437dc7[_0x0ba9('0x34')]);_0x346535['attributes']=_[_0x0ba9('0x37')](_0x437dc7[_0x0ba9('0x38')],qs[_0x0ba9('0x39')](_0xf58d9d[_0x0ba9('0x34')][_0x0ba9('0x39')]));_0x346535[_0x0ba9('0x3a')]=_0x346535[_0x0ba9('0x3a')][_0x0ba9('0x3b')]?_0x346535['attributes']:_0x437dc7['model'];if(!_0xf58d9d[_0x0ba9('0x34')][_0x0ba9('0x3c')](_0x0ba9('0x3d'))){_0x346535[_0x0ba9('0x1e')]=qs[_0x0ba9('0x1e')](_0xf58d9d[_0x0ba9('0x34')][_0x0ba9('0x1e')]);_0x346535['offset']=qs[_0x0ba9('0x20')](_0xf58d9d[_0x0ba9('0x34')][_0x0ba9('0x20')]);}_0x346535[_0x0ba9('0x3e')]=qs[_0x0ba9('0x3f')](_0xf58d9d[_0x0ba9('0x34')]['sort']);_0x346535[_0x0ba9('0x40')]=qs[_0x0ba9('0x36')](_[_0x0ba9('0x41')](_0xf58d9d[_0x0ba9('0x34')],_0x437dc7['filters']),_0x4d5f4e);if(_0xf58d9d[_0x0ba9('0x34')][_0x0ba9('0x42')]){_0x346535[_0x0ba9('0x40')]=_['merge'](_0x346535[_0x0ba9('0x40')],{'$or':_[_0x0ba9('0x2e')](_0x4d5f4e,function(_0x48f588){if(_0x48f588[_0x0ba9('0x32')]!==_0x0ba9('0x43')){var _0x46b050={};_0x46b050[_0x48f588[_0x0ba9('0x2c')]]={'$like':'%'+_0xf58d9d[_0x0ba9('0x34')][_0x0ba9('0x42')]+'%'};return _0x46b050;}})});}_0x346535=_[_0x0ba9('0x44')]({},_0x346535,_0xf58d9d[_0x0ba9('0x45')]);var _0x455849={'where':_0x346535[_0x0ba9('0x40')]};return db[_0x0ba9('0x2f')]['count'](_0x455849)[_0x0ba9('0x27')](function(_0x2edaf6){_0x46c609[_0x0ba9('0x1f')]=_0x2edaf6;if(_0xf58d9d['query'][_0x0ba9('0x46')]){_0x346535['include']=[{'all':!![]}];}return db[_0x0ba9('0x2f')][_0x0ba9('0x47')](_0x346535);})[_0x0ba9('0x27')](function(_0x180c6d){_0x46c609['rows']=_0x180c6d;return _0x46c609;})['then'](respondWithFilteredResult(_0x21f379,_0x346535))[_0x0ba9('0x48')](handleError(_0x21f379,null));};exports['show']=function(_0x3d84ab,_0x8fc4e6){var _0x119521={'raw':![],'where':{'id':_0x3d84ab[_0x0ba9('0x49')]['id']}},_0x574942={};_0x574942[_0x0ba9('0x38')]=_[_0x0ba9('0x35')](db[_0x0ba9('0x2f')]['rawAttributes']);_0x574942[_0x0ba9('0x34')]=_[_0x0ba9('0x35')](_0x3d84ab['query']);_0x574942['filters']=_[_0x0ba9('0x37')](_0x574942[_0x0ba9('0x38')],_0x574942[_0x0ba9('0x34')]);_0x119521[_0x0ba9('0x3a')]=_[_0x0ba9('0x37')](_0x574942[_0x0ba9('0x38')],qs[_0x0ba9('0x39')](_0x3d84ab['query'][_0x0ba9('0x39')]));_0x119521[_0x0ba9('0x3a')]=_0x119521[_0x0ba9('0x3a')][_0x0ba9('0x3b')]?_0x119521[_0x0ba9('0x3a')]:_0x574942[_0x0ba9('0x38')];if(_0x3d84ab[_0x0ba9('0x34')][_0x0ba9('0x46')]){_0x119521['include']=[{'all':!![]}];}_0x119521=_[_0x0ba9('0x44')]({},_0x119521,_0x3d84ab[_0x0ba9('0x45')]);return db['ZendeskConfiguration'][_0x0ba9('0x4a')](_0x119521)[_0x0ba9('0x27')](handleEntityNotFound(_0x8fc4e6,null))[_0x0ba9('0x27')](respondWithResult(_0x8fc4e6,null))[_0x0ba9('0x48')](handleError(_0x8fc4e6,null));};exports[_0x0ba9('0x4b')]=function(_0x7cf2e5,_0x2e7000){return db[_0x0ba9('0x2f')][_0x0ba9('0x4b')](_0x7cf2e5[_0x0ba9('0x4c')],{})[_0x0ba9('0x27')](respondWithResult(_0x2e7000,0xc9))[_0x0ba9('0x48')](handleError(_0x2e7000,null));};exports['update']=function(_0x5b6f48,_0x3a3909){if(_0x5b6f48[_0x0ba9('0x4c')]['id']){delete _0x5b6f48['body']['id'];}return db[_0x0ba9('0x2f')][_0x0ba9('0x4a')]({'where':{'id':_0x5b6f48[_0x0ba9('0x49')]['id']}})[_0x0ba9('0x27')](handleEntityNotFound(_0x3a3909,null))['then'](saveUpdates(_0x5b6f48[_0x0ba9('0x4c')],null))['then'](respondWithResult(_0x3a3909,null))[_0x0ba9('0x48')](handleError(_0x3a3909,null));};exports[_0x0ba9('0x28')]=function(_0x22e4c2,_0x2e385f){return db[_0x0ba9('0x2f')]['find']({'where':{'id':_0x22e4c2[_0x0ba9('0x49')]['id']}})[_0x0ba9('0x27')](handleEntityNotFound(_0x2e385f,null))[_0x0ba9('0x27')](removeEntity(_0x2e385f,null))['catch'](handleError(_0x2e385f,null));};exports['getFields']=function(_0x47e230,_0x22e59b,_0x5d558d){var _0x488ee9={};var _0x2d2c25={};var _0x5540f0;var _0x564297;return db['ZendeskConfiguration'][_0x0ba9('0x4d')]({'where':{'id':_0x47e230['params']['id']}})[_0x0ba9('0x27')](handleEntityNotFound(_0x22e59b,null))[_0x0ba9('0x27')](function(_0x12c714){if(_0x12c714){_0x5540f0=_0x12c714;_0x2d2c25[_0x0ba9('0x38')]=_[_0x0ba9('0x35')](db[_0x0ba9('0x4e')][_0x0ba9('0x30')]);_0x2d2c25[_0x0ba9('0x34')]=_[_0x0ba9('0x35')](_0x47e230['query']);_0x2d2c25[_0x0ba9('0x36')]=_[_0x0ba9('0x37')](_0x2d2c25['model'],_0x2d2c25[_0x0ba9('0x34')]);_0x488ee9[_0x0ba9('0x3a')]=_[_0x0ba9('0x37')](_0x2d2c25['model'],qs[_0x0ba9('0x39')](_0x47e230[_0x0ba9('0x34')][_0x0ba9('0x39')]));_0x488ee9[_0x0ba9('0x3a')]=_0x488ee9[_0x0ba9('0x3a')][_0x0ba9('0x3b')]?_0x488ee9[_0x0ba9('0x3a')]:_0x2d2c25[_0x0ba9('0x38')];_0x488ee9[_0x0ba9('0x3e')]=qs[_0x0ba9('0x3f')](_0x47e230['query'][_0x0ba9('0x3f')]);_0x488ee9[_0x0ba9('0x40')]=qs[_0x0ba9('0x36')](_[_0x0ba9('0x41')](_0x47e230[_0x0ba9('0x34')],_0x2d2c25['filters']));if(_0x47e230[_0x0ba9('0x34')][_0x0ba9('0x42')]){_0x488ee9[_0x0ba9('0x40')]=_[_0x0ba9('0x44')](_0x488ee9[_0x0ba9('0x40')],{'$or':_[_0x0ba9('0x2e')](_0x488ee9[_0x0ba9('0x3a')],function(_0x261d2b){var _0x319a62={};_0x319a62[_0x261d2b]={'$like':'%'+_0x47e230['query'][_0x0ba9('0x42')]+'%'};return _0x319a62;})});}_0x488ee9=_[_0x0ba9('0x44')]({},_0x488ee9,_0x47e230['options']);return _0x5540f0[_0x0ba9('0x4f')](_0x488ee9);}})[_0x0ba9('0x27')](function(_0x443db4){if(_0x443db4){_0x564297=_0x443db4['length'];if(!_0x47e230[_0x0ba9('0x34')][_0x0ba9('0x3c')]('nolimit')){_0x488ee9[_0x0ba9('0x1e')]=qs[_0x0ba9('0x1e')](_0x47e230[_0x0ba9('0x34')][_0x0ba9('0x1e')]);_0x488ee9['offset']=qs[_0x0ba9('0x20')](_0x47e230[_0x0ba9('0x34')][_0x0ba9('0x20')]);}return _0x5540f0['getFields'](_0x488ee9);}})[_0x0ba9('0x27')](function(_0x492f2c){if(_0x492f2c){return _0x492f2c?{'count':_0x564297,'rows':_0x492f2c}:null;}})[_0x0ba9('0x27')](respondWithResult(_0x22e59b,null))[_0x0ba9('0x48')](handleError(_0x22e59b,null));};exports[_0x0ba9('0x50')]=function(_0x4d7598,_0x1dd065,_0x16ec8b){var _0x10a483={};var _0x4c27fe={};var _0x15766e;var _0x588856;return db[_0x0ba9('0x2f')][_0x0ba9('0x4d')]({'where':{'id':_0x4d7598[_0x0ba9('0x49')]['id']}})[_0x0ba9('0x27')](handleEntityNotFound(_0x1dd065,null))[_0x0ba9('0x27')](function(_0x54438f){if(_0x54438f){_0x15766e=_0x54438f;_0x4c27fe[_0x0ba9('0x38')]=_['keys'](db[_0x0ba9('0x4e')]['rawAttributes']);_0x4c27fe[_0x0ba9('0x34')]=_[_0x0ba9('0x35')](_0x4d7598[_0x0ba9('0x34')]);_0x4c27fe[_0x0ba9('0x36')]=_['intersection'](_0x4c27fe['model'],_0x4c27fe['query']);_0x10a483[_0x0ba9('0x3a')]=_['intersection'](_0x4c27fe[_0x0ba9('0x38')],qs['fields'](_0x4d7598['query'][_0x0ba9('0x39')]));_0x10a483['attributes']=_0x10a483[_0x0ba9('0x3a')][_0x0ba9('0x3b')]?_0x10a483[_0x0ba9('0x3a')]:_0x4c27fe['model'];_0x10a483['order']=qs[_0x0ba9('0x3f')](_0x4d7598['query'][_0x0ba9('0x3f')]);_0x10a483['where']=qs[_0x0ba9('0x36')](_[_0x0ba9('0x41')](_0x4d7598['query'],_0x4c27fe[_0x0ba9('0x36')]));if(_0x4d7598[_0x0ba9('0x34')][_0x0ba9('0x42')]){_0x10a483['where']=_['merge'](_0x10a483[_0x0ba9('0x40')],{'$or':_[_0x0ba9('0x2e')](_0x10a483[_0x0ba9('0x3a')],function(_0x2a67ba){var _0x2e3926={};_0x2e3926[_0x2a67ba]={'$like':'%'+_0x4d7598[_0x0ba9('0x34')][_0x0ba9('0x42')]+'%'};return _0x2e3926;})});}_0x10a483=_['merge']({},_0x10a483,_0x4d7598[_0x0ba9('0x45')]);return _0x15766e[_0x0ba9('0x50')](_0x10a483);}})[_0x0ba9('0x27')](function(_0x162fd7){if(_0x162fd7){_0x588856=_0x162fd7[_0x0ba9('0x3b')];if(!_0x4d7598[_0x0ba9('0x34')][_0x0ba9('0x3c')](_0x0ba9('0x3d'))){_0x10a483[_0x0ba9('0x1e')]=qs[_0x0ba9('0x1e')](_0x4d7598['query'][_0x0ba9('0x1e')]);_0x10a483[_0x0ba9('0x20')]=qs[_0x0ba9('0x20')](_0x4d7598[_0x0ba9('0x34')][_0x0ba9('0x20')]);}return _0x15766e[_0x0ba9('0x50')](_0x10a483);}})[_0x0ba9('0x27')](function(_0x543d74){if(_0x543d74){return _0x543d74?{'count':_0x588856,'rows':_0x543d74}:null;}})['then'](respondWithResult(_0x1dd065,null))[_0x0ba9('0x48')](handleError(_0x1dd065,null));};exports['getDescriptions']=function(_0x51b5ae,_0x4057dc,_0x32f773){var _0x33ead6={};var _0x570ace={};var _0x90936a;var _0x41f527;return db[_0x0ba9('0x2f')][_0x0ba9('0x4d')]({'where':{'id':_0x51b5ae[_0x0ba9('0x49')]['id']}})[_0x0ba9('0x27')](handleEntityNotFound(_0x4057dc,null))[_0x0ba9('0x27')](function(_0x56a284){if(_0x56a284){_0x90936a=_0x56a284;_0x570ace['model']=_[_0x0ba9('0x35')](db[_0x0ba9('0x4e')][_0x0ba9('0x30')]);_0x570ace[_0x0ba9('0x34')]=_['keys'](_0x51b5ae['query']);_0x570ace[_0x0ba9('0x36')]=_[_0x0ba9('0x37')](_0x570ace[_0x0ba9('0x38')],_0x570ace[_0x0ba9('0x34')]);_0x33ead6[_0x0ba9('0x3a')]=_['intersection'](_0x570ace[_0x0ba9('0x38')],qs[_0x0ba9('0x39')](_0x51b5ae[_0x0ba9('0x34')]['fields']));_0x33ead6[_0x0ba9('0x3a')]=_0x33ead6['attributes'][_0x0ba9('0x3b')]?_0x33ead6[_0x0ba9('0x3a')]:_0x570ace['model'];_0x33ead6['order']=qs[_0x0ba9('0x3f')](_0x51b5ae['query']['sort']);_0x33ead6[_0x0ba9('0x40')]=qs['filters'](_['pick'](_0x51b5ae['query'],_0x570ace[_0x0ba9('0x36')]));if(_0x51b5ae[_0x0ba9('0x34')]['filter']){_0x33ead6['where']=_[_0x0ba9('0x44')](_0x33ead6[_0x0ba9('0x40')],{'$or':_[_0x0ba9('0x2e')](_0x33ead6[_0x0ba9('0x3a')],function(_0x228e77){var _0x5d4e23={};_0x5d4e23[_0x228e77]={'$like':'%'+_0x51b5ae[_0x0ba9('0x34')][_0x0ba9('0x42')]+'%'};return _0x5d4e23;})});}_0x33ead6=_[_0x0ba9('0x44')]({},_0x33ead6,_0x51b5ae[_0x0ba9('0x45')]);return _0x90936a[_0x0ba9('0x51')](_0x33ead6);}})[_0x0ba9('0x27')](function(_0x3008ed){if(_0x3008ed){_0x41f527=_0x3008ed[_0x0ba9('0x3b')];if(!_0x51b5ae['query']['hasOwnProperty'](_0x0ba9('0x3d'))){_0x33ead6['limit']=qs[_0x0ba9('0x1e')](_0x51b5ae[_0x0ba9('0x34')]['limit']);_0x33ead6[_0x0ba9('0x20')]=qs['offset'](_0x51b5ae[_0x0ba9('0x34')][_0x0ba9('0x20')]);}return _0x90936a[_0x0ba9('0x51')](_0x33ead6);}})[_0x0ba9('0x27')](function(_0x5a6711){if(_0x5a6711){return _0x5a6711?{'count':_0x41f527,'rows':_0x5a6711}:null;}})[_0x0ba9('0x27')](respondWithResult(_0x4057dc,null))[_0x0ba9('0x48')](handleError(_0x4057dc,null));};exports['getTags']=function(_0x2fe714,_0x573820,_0x4f10a8){var _0x155c3c={};var _0x3dcc69={};var _0x3f2cba;var _0x403412;return db[_0x0ba9('0x2f')][_0x0ba9('0x4d')]({'where':{'id':_0x2fe714[_0x0ba9('0x49')]['id']}})['then'](handleEntityNotFound(_0x573820,null))['then'](function(_0x3bf362){if(_0x3bf362){_0x3f2cba=_0x3bf362;_0x3dcc69['model']=_['keys'](db[_0x0ba9('0x52')][_0x0ba9('0x30')]);_0x3dcc69['query']=_[_0x0ba9('0x35')](_0x2fe714['query']);_0x3dcc69[_0x0ba9('0x36')]=_[_0x0ba9('0x37')](_0x3dcc69[_0x0ba9('0x38')],_0x3dcc69[_0x0ba9('0x34')]);_0x155c3c[_0x0ba9('0x3a')]=_['intersection'](_0x3dcc69[_0x0ba9('0x38')],qs['fields'](_0x2fe714[_0x0ba9('0x34')][_0x0ba9('0x39')]));_0x155c3c['attributes']=_0x155c3c[_0x0ba9('0x3a')][_0x0ba9('0x3b')]?_0x155c3c[_0x0ba9('0x3a')]:_0x3dcc69[_0x0ba9('0x38')];_0x155c3c[_0x0ba9('0x3e')]=qs[_0x0ba9('0x3f')](_0x2fe714[_0x0ba9('0x34')]['sort']);_0x155c3c[_0x0ba9('0x40')]=qs[_0x0ba9('0x36')](_[_0x0ba9('0x41')](_0x2fe714[_0x0ba9('0x34')],_0x3dcc69[_0x0ba9('0x36')]));if(_0x2fe714['query'][_0x0ba9('0x42')]){_0x155c3c[_0x0ba9('0x40')]=_[_0x0ba9('0x44')](_0x155c3c['where'],{'$or':_[_0x0ba9('0x2e')](_0x155c3c[_0x0ba9('0x3a')],function(_0x52eb50){var _0x271795={};_0x271795[_0x52eb50]={'$like':'%'+_0x2fe714[_0x0ba9('0x34')][_0x0ba9('0x42')]+'%'};return _0x271795;})});}_0x155c3c=_['merge']({},_0x155c3c,_0x2fe714['options']);return _0x3f2cba[_0x0ba9('0x53')](_0x155c3c);}})[_0x0ba9('0x27')](function(_0x5de830){if(_0x5de830){_0x403412=_0x5de830['length'];if(!_0x2fe714[_0x0ba9('0x34')][_0x0ba9('0x3c')](_0x0ba9('0x3d'))){_0x155c3c[_0x0ba9('0x1e')]=qs[_0x0ba9('0x1e')](_0x2fe714['query'][_0x0ba9('0x1e')]);_0x155c3c['offset']=qs['offset'](_0x2fe714['query'][_0x0ba9('0x20')]);}return _0x3f2cba[_0x0ba9('0x53')](_0x155c3c);}})[_0x0ba9('0x27')](function(_0x45cd5d){if(_0x45cd5d){return _0x45cd5d?{'count':_0x403412,'rows':_0x45cd5d}:null;}})[_0x0ba9('0x27')](respondWithResult(_0x573820,null))['catch'](handleError(_0x573820,null));};exports['setTags']=function(_0x346413,_0x1dc0ee,_0x47743b){if(_0x346413[_0x0ba9('0x4c')]['id']){delete _0x346413[_0x0ba9('0x4c')]['id'];}return db[_0x0ba9('0x2f')][_0x0ba9('0x4d')]({'where':{'id':_0x346413[_0x0ba9('0x49')]['id']}})[_0x0ba9('0x27')](handleEntityNotFound(_0x1dc0ee,null))[_0x0ba9('0x27')](function(_0x2e33f9){if(_0x2e33f9){return _0x2e33f9['setTags'](_0x346413['body'][_0x0ba9('0x54')]||[]);}return null;})[_0x0ba9('0x27')](respondWithResult(_0x1dc0ee,null))[_0x0ba9('0x48')](handleError(_0x1dc0ee,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 50f9cd8..e1aaf51 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xb10b,0x12a));var _0xbb10=function(_0x277415,_0x38968b){_0x277415=_0x277415-0x0;var _0x376342=_0xb10b[_0x277415];return _0x376342;};'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')]('ZendeskConfiguration',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb03e=['int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0xd3bdab,_0x5d784a){var _0x1c3178=function(_0x4f7ef4){while(--_0x4f7ef4){_0xd3bdab['push'](_0xd3bdab['shift']());}};_0x1c3178(++_0x5d784a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x54b45d,_0x5cc1a0){_0x54b45d=_0x54b45d-0x0;var _0x34f335=_0xb03e[_0x54b45d];return _0x34f335;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 5e15f99..6e84735 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 _0x6969=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x50f9e6,_0x6f2199){var _0x424509=function(_0x130dac){while(--_0x130dac){_0x50f9e6['push'](_0x50f9e6['shift']());}};_0x424509(++_0x6f2199);}(_0x6969,0x89));var _0x9696=function(_0x2652e3,_0x55253b){_0x2652e3=_0x2652e3-0x0;var _0x249759=_0x6969[_0x2652e3];return _0x249759;};'use strict';var _=require(_0x9696('0x0'));var util=require(_0x9696('0x1'));var moment=require(_0x9696('0x2'));var BPromise=require(_0x9696('0x3'));var rs=require(_0x9696('0x4'));var fs=require('fs');var Redis=require(_0x9696('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9696('0x6'));var logger=require(_0x9696('0x7'))('rpc');var config=require(_0x9696('0x8'));var jayson=require(_0x9696('0x9'));var client=jayson[_0x9696('0xa')][_0x9696('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52e167,_0x279648,_0x478764){return new BPromise(function(_0x317f9f,_0x2901a3){return client['request'](_0x52e167,_0x478764)['then'](function(_0x28b272){logger['info'](_0x9696('0xc'),_0x279648,_0x9696('0xd'));logger[_0x9696('0xe')](_0x9696('0xf'),_0x279648,'request\x20sent',JSON[_0x9696('0x10')](_0x28b272));if(_0x28b272['error']){if(_0x28b272[_0x9696('0x11')][_0x9696('0x12')]===0x1f4){logger[_0x9696('0x11')](_0x9696('0xc'),_0x279648,_0x28b272[_0x9696('0x11')][_0x9696('0x13')]);return _0x2901a3(_0x28b272['error']['message']);}logger['error'](_0x9696('0xc'),_0x279648,_0x28b272['error'][_0x9696('0x13')]);return _0x317f9f(_0x28b272['error'][_0x9696('0x13')]);}else{logger[_0x9696('0x14')](_0x9696('0xc'),_0x279648,_0x9696('0xd'));_0x317f9f(_0x28b272[_0x9696('0x15')][_0x9696('0x13')]);}})[_0x9696('0x16')](function(_0x53c693){logger[_0x9696('0x11')](_0x9696('0xc'),_0x279648,_0x53c693);_0x2901a3(_0x53c693);});});} \ No newline at end of file +var _0x9dd9=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x3500d1,_0x571280){var _0x5f2b41=function(_0x2c0ffb){while(--_0x2c0ffb){_0x3500d1['push'](_0x3500d1['shift']());}};_0x5f2b41(++_0x571280);}(_0x9dd9,0xda));var _0x99dd=function(_0x29801c,_0x550608){_0x29801c=_0x29801c-0x0;var _0x517be1=_0x9dd9[_0x29801c];return _0x517be1;};'use strict';var _=require(_0x99dd('0x0'));var util=require(_0x99dd('0x1'));var moment=require('moment');var BPromise=require(_0x99dd('0x2'));var rs=require(_0x99dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99dd('0x4'))['db'];var utils=require(_0x99dd('0x5'));var logger=require('../../config/logger')(_0x99dd('0x6'));var config=require(_0x99dd('0x7'));var jayson=require(_0x99dd('0x8'));var client=jayson[_0x99dd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e643a,_0x4f7667,_0x372c49){return new BPromise(function(_0xc27cdd,_0x15e7bf){return client['request'](_0x4e643a,_0x372c49)['then'](function(_0x50e304){logger[_0x99dd('0xa')](_0x99dd('0xb'),_0x4f7667,_0x99dd('0xc'));logger[_0x99dd('0xd')](_0x99dd('0xe'),_0x4f7667,_0x99dd('0xc'),JSON[_0x99dd('0xf')](_0x50e304));if(_0x50e304[_0x99dd('0x10')]){if(_0x50e304[_0x99dd('0x10')][_0x99dd('0x11')]===0x1f4){logger[_0x99dd('0x10')](_0x99dd('0xb'),_0x4f7667,_0x50e304[_0x99dd('0x10')]['message']);return _0x15e7bf(_0x50e304[_0x99dd('0x10')][_0x99dd('0x12')]);}logger['error'](_0x99dd('0xb'),_0x4f7667,_0x50e304[_0x99dd('0x10')][_0x99dd('0x12')]);return _0xc27cdd(_0x50e304[_0x99dd('0x10')][_0x99dd('0x12')]);}else{logger['info'](_0x99dd('0xb'),_0x4f7667,'request\x20sent');_0xc27cdd(_0x50e304[_0x99dd('0x13')]['message']);}})['catch'](function(_0x2ecdb7){logger[_0x99dd('0x10')](_0x99dd('0xb'),_0x4f7667,_0x2ecdb7);_0x15e7bf(_0x2ecdb7);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 07feba4..fdaf47b 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 _0x7b6c=['show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id'];(function(_0x16f91f,_0x4726eb){var _0x5e6f15=function(_0x26642f){while(--_0x26642f){_0x16f91f['push'](_0x16f91f['shift']());}};_0x5e6f15(++_0x4726eb);}(_0x7b6c,0x91));var _0xc7b6=function(_0x21acdf,_0x51bc8a){_0x21acdf=_0x21acdf-0x0;var _0x1585a6=_0x7b6c[_0x21acdf];return _0x1585a6;};'use strict';var multer=require(_0xc7b6('0x0'));var util=require(_0xc7b6('0x1'));var path=require(_0xc7b6('0x2'));var timeout=require(_0xc7b6('0x3'));var express=require(_0xc7b6('0x4'));var router=express[_0xc7b6('0x5')]();var fs_extra=require(_0xc7b6('0x6'));var auth=require(_0xc7b6('0x7'));var interaction=require(_0xc7b6('0x8'));var config=require(_0xc7b6('0x9'));var controller=require(_0xc7b6('0xa'));router['get']('/',auth[_0xc7b6('0xb')](),controller[_0xc7b6('0xc')]);router[_0xc7b6('0xd')](_0xc7b6('0xe'),auth[_0xc7b6('0xb')](),controller[_0xc7b6('0xf')]);router['post']('/',auth[_0xc7b6('0xb')](),controller[_0xc7b6('0x10')]);router[_0xc7b6('0x11')]('/:id',auth[_0xc7b6('0xb')](),controller[_0xc7b6('0x12')]);router[_0xc7b6('0x13')](_0xc7b6('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x603d=['post','isAuthenticated','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x603d,0xd3));var _0xd603=function(_0xd6e6a6,_0x10096b){_0xd6e6a6=_0xd6e6a6-0x0;var _0x4bb481=_0x603d[_0xd6e6a6];return _0x4bb481;};'use strict';var multer=require(_0xd603('0x0'));var util=require(_0xd603('0x1'));var path=require(_0xd603('0x2'));var timeout=require(_0xd603('0x3'));var express=require(_0xd603('0x4'));var router=express[_0xd603('0x5')]();var fs_extra=require(_0xd603('0x6'));var auth=require(_0xd603('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd603('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd603('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd603('0xa')]('/',auth[_0xd603('0xb')](),controller['create']);router[_0xd603('0xc')](_0xd603('0xd'),auth[_0xd603('0xb')](),controller[_0xd603('0xe')]);router['delete'](_0xd603('0xd'),auth[_0xd603('0xb')](),controller[_0xd603('0xf')]);module[_0xd603('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ee28624..4ea67fb 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 _0x8e26=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0xf20543,_0x115c22){var _0x4cc31d=function(_0x2f6f13){while(--_0x2f6f13){_0xf20543['push'](_0xf20543['shift']());}};_0x4cc31d(++_0x115c22);}(_0x8e26,0x17e));var _0x68e2=function(_0x546464,_0x25ddb3){_0x546464=_0x546464-0x0;var _0x4aa269=_0x8e26[_0x546464];return _0x4aa269;};'use strict';var Sequelize=require(_0x68e2('0x0'));module[_0x68e2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x68e2('0x2'),_0x68e2('0x3'),_0x68e2('0x4'),_0x68e2('0x5'),_0x68e2('0x6')),'defaultValue':_0x68e2('0x2')},'content':{'type':Sequelize[_0x68e2('0x7')]},'key':{'type':Sequelize[_0x68e2('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x68e2('0x2'),_0x68e2('0x3'),_0x68e2('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x68e2('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x68e2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c5b=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x5c3dd1,_0x48bf4b){var _0x387e7c=function(_0x3f2a2e){while(--_0x3f2a2e){_0x5c3dd1['push'](_0x5c3dd1['shift']());}};_0x387e7c(++_0x48bf4b);}(_0x6c5b,0x8e));var _0xb6c5=function(_0x53c6be,_0x14b3bd){_0x53c6be=_0x53c6be-0x0;var _0x191172=_0x6c5b[_0x53c6be];return _0x191172;};'use strict';var Sequelize=require(_0xb6c5('0x0'));module[_0xb6c5('0x1')]={'type':{'type':Sequelize[_0xb6c5('0x2')](_0xb6c5('0x3'),_0xb6c5('0x4'),_0xb6c5('0x5'),_0xb6c5('0x6'),'picklist'),'defaultValue':_0xb6c5('0x3')},'content':{'type':Sequelize[_0xb6c5('0x7')]},'key':{'type':Sequelize[_0xb6c5('0x7')]},'keyType':{'type':Sequelize[_0xb6c5('0x2')](_0xb6c5('0x3'),'variable',_0xb6c5('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb6c5('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb6c5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 37721ff..a08ca9d 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 _0x4513=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filters','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model'];(function(_0x276a47,_0x589ddd){var _0x240551=function(_0x5bb407){while(--_0x5bb407){_0x276a47['push'](_0x276a47['shift']());}};_0x240551(++_0x589ddd);}(_0x4513,0xef));var _0x3451=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4513[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3451('0x0'));var zipdir=require(_0x3451('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3451('0x2'));var Mustache=require('mustache');var util=require(_0x3451('0x3'));var path=require(_0x3451('0x4'));var sox=require(_0x3451('0x5'));var csv=require(_0x3451('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3451('0x7'));var squel=require(_0x3451('0x8'));var crypto=require(_0x3451('0x9'));var jsforce=require(_0x3451('0xa'));var deskjs=require(_0x3451('0xb'));var toCsv=require(_0x3451('0x6'));var querystring=require(_0x3451('0xc'));var Papa=require(_0x3451('0xd'));var Redis=require(_0x3451('0xe'));var authService=require(_0x3451('0xf'));var qs=require(_0x3451('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3451('0x11'));var logger=require(_0x3451('0x12'))(_0x3451('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3451('0x14'))['db'];function respondWithStatusCode(_0x2ac12f,_0x46c1dd){_0x46c1dd=_0x46c1dd||0xcc;return function(_0xe81d2d){if(_0xe81d2d){return _0x2ac12f['sendStatus'](_0x46c1dd);}return _0x2ac12f[_0x3451('0x15')](_0x46c1dd)[_0x3451('0x16')]();};}function respondWithResult(_0x1344b8,_0x1d1a70){_0x1d1a70=_0x1d1a70||0xc8;return function(_0x2fc411){if(_0x2fc411){return _0x1344b8['status'](_0x1d1a70)[_0x3451('0x17')](_0x2fc411);}};}function respondWithFilteredResult(_0x42e359,_0x35cc9a){return function(_0x434f05){if(_0x434f05){var _0x463db7=typeof _0x35cc9a[_0x3451('0x18')]===_0x3451('0x19')&&typeof _0x35cc9a[_0x3451('0x1a')]==='undefined';var _0x5c9e33=_0x434f05[_0x3451('0x1b')];var _0xf15979=_0x463db7?0x0:_0x35cc9a[_0x3451('0x18')];var _0x1ca7cf=_0x463db7?_0x434f05['count']:_0x35cc9a['offset']+_0x35cc9a['limit'];var _0x42e1bb;if(_0x1ca7cf>=_0x5c9e33){_0x1ca7cf=_0x5c9e33;_0x42e1bb=0xc8;}else{_0x42e1bb=0xce;}_0x42e359[_0x3451('0x15')](_0x42e1bb);return _0x42e359[_0x3451('0x1c')](_0x3451('0x1d'),_0xf15979+'-'+_0x1ca7cf+'/'+_0x5c9e33)[_0x3451('0x17')](_0x434f05);}return null;};}function patchUpdates(_0x39b68a){return function(_0x266ed9){try{jsonpatch[_0x3451('0x1e')](_0x266ed9,_0x39b68a,!![]);}catch(_0x2a2e50){return BPromise['reject'](_0x2a2e50);}return _0x266ed9['save']();};}function saveUpdates(_0x1be765,_0x243b49){return function(_0x53ffb7){if(_0x53ffb7){return _0x53ffb7['update'](_0x1be765)[_0x3451('0x1f')](function(_0x2fe645){return _0x2fe645;});}return null;};}function removeEntity(_0xfd502e,_0x50fbee){return function(_0x4b746f){if(_0x4b746f){return _0x4b746f[_0x3451('0x20')]()['then'](function(){_0xfd502e[_0x3451('0x15')](0xcc)[_0x3451('0x16')]();});}};}function handleEntityNotFound(_0xc9c25e,_0x2b896a){return function(_0x3dee5f){if(!_0x3dee5f){_0xc9c25e[_0x3451('0x21')](0x194);}return _0x3dee5f;};}function handleError(_0x2a2e58,_0x3778cd){_0x3778cd=_0x3778cd||0x1f4;return function(_0x4d8ff4){logger[_0x3451('0x22')](_0x4d8ff4[_0x3451('0x23')]);if(_0x4d8ff4[_0x3451('0x24')]){delete _0x4d8ff4[_0x3451('0x24')];}_0x2a2e58[_0x3451('0x15')](_0x3778cd)[_0x3451('0x25')](_0x4d8ff4);};}exports[_0x3451('0x26')]=function(_0x1cf152,_0xaeebfe){var _0x4265d3={},_0x4645ab={},_0x57b242={'count':0x0,'rows':[]};var _0x1d745e=_[_0x3451('0x27')](db[_0x3451('0x28')][_0x3451('0x29')],function(_0x5aa5b1){return{'name':_0x5aa5b1[_0x3451('0x2a')],'type':_0x5aa5b1['type'][_0x3451('0x2b')]};});_0x4645ab[_0x3451('0x2c')]=_['map'](_0x1d745e,_0x3451('0x24'));_0x4645ab[_0x3451('0x2d')]=_[_0x3451('0x2e')](_0x1cf152[_0x3451('0x2d')]);_0x4645ab['filters']=_[_0x3451('0x2f')](_0x4645ab[_0x3451('0x2c')],_0x4645ab[_0x3451('0x2d')]);_0x4265d3[_0x3451('0x30')]=_['intersection'](_0x4645ab[_0x3451('0x2c')],qs['fields'](_0x1cf152[_0x3451('0x2d')][_0x3451('0x31')]));_0x4265d3[_0x3451('0x30')]=_0x4265d3[_0x3451('0x30')][_0x3451('0x32')]?_0x4265d3[_0x3451('0x30')]:_0x4645ab[_0x3451('0x2c')];if(!_0x1cf152['query'][_0x3451('0x33')](_0x3451('0x34'))){_0x4265d3[_0x3451('0x1a')]=qs['limit'](_0x1cf152[_0x3451('0x2d')][_0x3451('0x1a')]);_0x4265d3['offset']=qs['offset'](_0x1cf152[_0x3451('0x2d')]['offset']);}_0x4265d3[_0x3451('0x35')]=qs['sort'](_0x1cf152[_0x3451('0x2d')]['sort']);_0x4265d3['where']=qs['filters'](_[_0x3451('0x36')](_0x1cf152[_0x3451('0x2d')],_0x4645ab[_0x3451('0x37')]),_0x1d745e);if(_0x1cf152[_0x3451('0x2d')]['filter']){_0x4265d3[_0x3451('0x38')]=_[_0x3451('0x39')](_0x4265d3[_0x3451('0x38')],{'$or':_['map'](_0x1d745e,function(_0x511570){if(_0x511570[_0x3451('0x3a')]!==_0x3451('0x3b')){var _0xbc63bd={};_0xbc63bd[_0x511570[_0x3451('0x24')]]={'$like':'%'+_0x1cf152[_0x3451('0x2d')]['filter']+'%'};return _0xbc63bd;}})});}_0x4265d3=_[_0x3451('0x39')]({},_0x4265d3,_0x1cf152[_0x3451('0x3c')]);var _0x249b87={'where':_0x4265d3[_0x3451('0x38')]};return db[_0x3451('0x28')]['count'](_0x249b87)[_0x3451('0x1f')](function(_0x89f100){_0x57b242[_0x3451('0x1b')]=_0x89f100;if(_0x1cf152[_0x3451('0x2d')][_0x3451('0x3d')]){_0x4265d3['include']=[{'all':!![]}];}return db[_0x3451('0x28')][_0x3451('0x3e')](_0x4265d3);})[_0x3451('0x1f')](function(_0x1e7901){_0x57b242[_0x3451('0x3f')]=_0x1e7901;return _0x57b242;})[_0x3451('0x1f')](respondWithFilteredResult(_0xaeebfe,_0x4265d3))[_0x3451('0x40')](handleError(_0xaeebfe,null));};exports[_0x3451('0x41')]=function(_0x38d537,_0x345224){var _0x1b4590={'raw':!![],'where':{'id':_0x38d537[_0x3451('0x42')]['id']}},_0x3b8713={};_0x3b8713['model']=_[_0x3451('0x2e')](db['ZendeskField']['rawAttributes']);_0x3b8713['query']=_['keys'](_0x38d537['query']);_0x3b8713[_0x3451('0x37')]=_[_0x3451('0x2f')](_0x3b8713[_0x3451('0x2c')],_0x3b8713[_0x3451('0x2d')]);_0x1b4590[_0x3451('0x30')]=_[_0x3451('0x2f')](_0x3b8713[_0x3451('0x2c')],qs['fields'](_0x38d537[_0x3451('0x2d')][_0x3451('0x31')]));_0x1b4590[_0x3451('0x30')]=_0x1b4590[_0x3451('0x30')][_0x3451('0x32')]?_0x1b4590[_0x3451('0x30')]:_0x3b8713[_0x3451('0x2c')];if(_0x38d537['query']['includeAll']){_0x1b4590[_0x3451('0x43')]=[{'all':!![]}];}_0x1b4590=_[_0x3451('0x39')]({},_0x1b4590,_0x38d537[_0x3451('0x3c')]);return db['ZendeskField'][_0x3451('0x44')](_0x1b4590)['then'](handleEntityNotFound(_0x345224,null))['then'](respondWithResult(_0x345224,null))[_0x3451('0x40')](handleError(_0x345224,null));};exports[_0x3451('0x45')]=function(_0x2a5fa7,_0x550ea8){return db['ZendeskField'][_0x3451('0x45')](_0x2a5fa7[_0x3451('0x46')],{})[_0x3451('0x1f')](respondWithResult(_0x550ea8,0xc9))[_0x3451('0x40')](handleError(_0x550ea8,null));};exports['update']=function(_0x476b16,_0x3475a4){if(_0x476b16['body']['id']){delete _0x476b16[_0x3451('0x46')]['id'];}return db[_0x3451('0x28')][_0x3451('0x44')]({'where':{'id':_0x476b16[_0x3451('0x42')]['id']}})[_0x3451('0x1f')](handleEntityNotFound(_0x3475a4,null))['then'](saveUpdates(_0x476b16[_0x3451('0x46')],null))[_0x3451('0x1f')](respondWithResult(_0x3475a4,null))[_0x3451('0x40')](handleError(_0x3475a4,null));};exports['destroy']=function(_0x7dc5f7,_0x13a176){return db[_0x3451('0x28')]['find']({'where':{'id':_0x7dc5f7['params']['id']}})[_0x3451('0x1f')](handleEntityNotFound(_0x13a176,null))[_0x3451('0x1f')](removeEntity(_0x13a176,null))[_0x3451('0x40')](handleError(_0x13a176,null));}; \ No newline at end of file +var _0xe65c=['params','keys','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','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','status','json','offset','limit','undefined','count','set','reject','update','then','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe65c,0x19e));var _0xce65=function(_0xc6cd9,_0x24938f){_0xc6cd9=_0xc6cd9-0x0;var _0x39ca4b=_0xe65c[_0xc6cd9];return _0x39ca4b;};'use strict';var emlformat=require(_0xce65('0x0'));var rimraf=require(_0xce65('0x1'));var zipdir=require(_0xce65('0x2'));var jsonpatch=require(_0xce65('0x3'));var rp=require(_0xce65('0x4'));var moment=require('moment');var BPromise=require(_0xce65('0x5'));var Mustache=require('mustache');var util=require(_0xce65('0x6'));var path=require(_0xce65('0x7'));var sox=require('sox');var csv=require(_0xce65('0x8'));var ejs=require(_0xce65('0x9'));var fs=require('fs');var fs_extra=require(_0xce65('0xa'));var _=require(_0xce65('0xb'));var squel=require(_0xce65('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xce65('0xd'));var toCsv=require(_0xce65('0x8'));var querystring=require(_0xce65('0xe'));var Papa=require(_0xce65('0xf'));var Redis=require(_0xce65('0x10'));var authService=require(_0xce65('0x11'));var qs=require(_0xce65('0x12'));var as=require(_0xce65('0x13'));var hardwareService=require(_0xce65('0x14'));var logger=require(_0xce65('0x15'))('api');var utils=require(_0xce65('0x16'));var config=require(_0xce65('0x17'));var licenseUtil=require(_0xce65('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5caa71,_0x2d8252){_0x2d8252=_0x2d8252||0xcc;return function(_0x4b9072){if(_0x4b9072){return _0x5caa71['sendStatus'](_0x2d8252);}return _0x5caa71['status'](_0x2d8252)['end']();};}function respondWithResult(_0x47d1eb,_0xf6ba1b){_0xf6ba1b=_0xf6ba1b||0xc8;return function(_0x385f11){if(_0x385f11){return _0x47d1eb[_0xce65('0x19')](_0xf6ba1b)[_0xce65('0x1a')](_0x385f11);}};}function respondWithFilteredResult(_0x367d5c,_0x5a9a1b){return function(_0x1ba62b){if(_0x1ba62b){var _0x4a10a1=typeof _0x5a9a1b[_0xce65('0x1b')]==='undefined'&&typeof _0x5a9a1b[_0xce65('0x1c')]===_0xce65('0x1d');var _0x49c53c=_0x1ba62b[_0xce65('0x1e')];var _0xae97da=_0x4a10a1?0x0:_0x5a9a1b[_0xce65('0x1b')];var _0x416fc0=_0x4a10a1?_0x1ba62b[_0xce65('0x1e')]:_0x5a9a1b[_0xce65('0x1b')]+_0x5a9a1b[_0xce65('0x1c')];var _0x42bdf2;if(_0x416fc0>=_0x49c53c){_0x416fc0=_0x49c53c;_0x42bdf2=0xc8;}else{_0x42bdf2=0xce;}_0x367d5c['status'](_0x42bdf2);return _0x367d5c[_0xce65('0x1f')]('Content-Range',_0xae97da+'-'+_0x416fc0+'/'+_0x49c53c)['json'](_0x1ba62b);}return null;};}function patchUpdates(_0x1115f6){return function(_0x17f9d1){try{jsonpatch['apply'](_0x17f9d1,_0x1115f6,!![]);}catch(_0x4d8396){return BPromise[_0xce65('0x20')](_0x4d8396);}return _0x17f9d1['save']();};}function saveUpdates(_0x123ecb,_0x30423a){return function(_0x4d7f40){if(_0x4d7f40){return _0x4d7f40[_0xce65('0x21')](_0x123ecb)[_0xce65('0x22')](function(_0x5152e2){return _0x5152e2;});}return null;};}function removeEntity(_0x4c96f5,_0x54491d){return function(_0xd8dcb7){if(_0xd8dcb7){return _0xd8dcb7['destroy']()[_0xce65('0x22')](function(){_0x4c96f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a88a9,_0x5a8b89){return function(_0x254d26){if(!_0x254d26){_0x3a88a9['sendStatus'](0x194);}return _0x254d26;};}function handleError(_0x5a0d32,_0x20777d){_0x20777d=_0x20777d||0x1f4;return function(_0x14a329){logger[_0xce65('0x23')](_0x14a329['stack']);if(_0x14a329[_0xce65('0x24')]){delete _0x14a329[_0xce65('0x24')];}_0x5a0d32[_0xce65('0x19')](_0x20777d)[_0xce65('0x25')](_0x14a329);};}exports[_0xce65('0x26')]=function(_0x5cd38c,_0x1076ef){var _0x589b26={},_0x1058ec={},_0x276764={'count':0x0,'rows':[]};var _0x125d9c=_[_0xce65('0x27')](db[_0xce65('0x28')][_0xce65('0x29')],function(_0x2a4ce3){return{'name':_0x2a4ce3[_0xce65('0x2a')],'type':_0x2a4ce3[_0xce65('0x2b')]['key']};});_0x1058ec[_0xce65('0x2c')]=_[_0xce65('0x27')](_0x125d9c,_0xce65('0x24'));_0x1058ec['query']=_['keys'](_0x5cd38c['query']);_0x1058ec[_0xce65('0x2d')]=_[_0xce65('0x2e')](_0x1058ec[_0xce65('0x2c')],_0x1058ec[_0xce65('0x2f')]);_0x589b26['attributes']=_['intersection'](_0x1058ec[_0xce65('0x2c')],qs['fields'](_0x5cd38c[_0xce65('0x2f')][_0xce65('0x30')]));_0x589b26[_0xce65('0x31')]=_0x589b26['attributes'][_0xce65('0x32')]?_0x589b26['attributes']:_0x1058ec[_0xce65('0x2c')];if(!_0x5cd38c[_0xce65('0x2f')][_0xce65('0x33')](_0xce65('0x34'))){_0x589b26[_0xce65('0x1c')]=qs[_0xce65('0x1c')](_0x5cd38c[_0xce65('0x2f')][_0xce65('0x1c')]);_0x589b26[_0xce65('0x1b')]=qs[_0xce65('0x1b')](_0x5cd38c['query']['offset']);}_0x589b26['order']=qs[_0xce65('0x35')](_0x5cd38c['query'][_0xce65('0x35')]);_0x589b26[_0xce65('0x36')]=qs[_0xce65('0x2d')](_['pick'](_0x5cd38c['query'],_0x1058ec['filters']),_0x125d9c);if(_0x5cd38c[_0xce65('0x2f')]['filter']){_0x589b26[_0xce65('0x36')]=_[_0xce65('0x37')](_0x589b26['where'],{'$or':_[_0xce65('0x27')](_0x125d9c,function(_0x6ae0b2){if(_0x6ae0b2['type']!==_0xce65('0x38')){var _0x39f4f1={};_0x39f4f1[_0x6ae0b2[_0xce65('0x24')]]={'$like':'%'+_0x5cd38c[_0xce65('0x2f')]['filter']+'%'};return _0x39f4f1;}})});}_0x589b26=_[_0xce65('0x37')]({},_0x589b26,_0x5cd38c['options']);var _0x50e46f={'where':_0x589b26[_0xce65('0x36')]};return db['ZendeskField'][_0xce65('0x1e')](_0x50e46f)[_0xce65('0x22')](function(_0x18ebe3){_0x276764[_0xce65('0x1e')]=_0x18ebe3;if(_0x5cd38c['query'][_0xce65('0x39')]){_0x589b26['include']=[{'all':!![]}];}return db[_0xce65('0x28')][_0xce65('0x3a')](_0x589b26);})[_0xce65('0x22')](function(_0x571f4c){_0x276764[_0xce65('0x3b')]=_0x571f4c;return _0x276764;})[_0xce65('0x22')](respondWithFilteredResult(_0x1076ef,_0x589b26))[_0xce65('0x3c')](handleError(_0x1076ef,null));};exports[_0xce65('0x3d')]=function(_0xdd6e84,_0x39a17e){var _0x839cb8={'raw':!![],'where':{'id':_0xdd6e84[_0xce65('0x3e')]['id']}},_0x3c073a={};_0x3c073a[_0xce65('0x2c')]=_[_0xce65('0x3f')](db['ZendeskField']['rawAttributes']);_0x3c073a[_0xce65('0x2f')]=_[_0xce65('0x3f')](_0xdd6e84['query']);_0x3c073a['filters']=_[_0xce65('0x2e')](_0x3c073a[_0xce65('0x2c')],_0x3c073a['query']);_0x839cb8[_0xce65('0x31')]=_[_0xce65('0x2e')](_0x3c073a['model'],qs[_0xce65('0x30')](_0xdd6e84['query'][_0xce65('0x30')]));_0x839cb8[_0xce65('0x31')]=_0x839cb8[_0xce65('0x31')][_0xce65('0x32')]?_0x839cb8['attributes']:_0x3c073a['model'];if(_0xdd6e84[_0xce65('0x2f')]['includeAll']){_0x839cb8[_0xce65('0x40')]=[{'all':!![]}];}_0x839cb8=_['merge']({},_0x839cb8,_0xdd6e84['options']);return db[_0xce65('0x28')]['find'](_0x839cb8)[_0xce65('0x22')](handleEntityNotFound(_0x39a17e,null))[_0xce65('0x22')](respondWithResult(_0x39a17e,null))[_0xce65('0x3c')](handleError(_0x39a17e,null));};exports[_0xce65('0x41')]=function(_0x33d2f1,_0x5823de){return db[_0xce65('0x28')][_0xce65('0x41')](_0x33d2f1[_0xce65('0x42')],{})[_0xce65('0x22')](respondWithResult(_0x5823de,0xc9))[_0xce65('0x3c')](handleError(_0x5823de,null));};exports[_0xce65('0x21')]=function(_0x4d0f17,_0x3f5aba){if(_0x4d0f17[_0xce65('0x42')]['id']){delete _0x4d0f17[_0xce65('0x42')]['id'];}return db[_0xce65('0x28')][_0xce65('0x43')]({'where':{'id':_0x4d0f17['params']['id']}})[_0xce65('0x22')](handleEntityNotFound(_0x3f5aba,null))['then'](saveUpdates(_0x4d0f17[_0xce65('0x42')],null))[_0xce65('0x22')](respondWithResult(_0x3f5aba,null))[_0xce65('0x3c')](handleError(_0x3f5aba,null));};exports['destroy']=function(_0x1110bb,_0x3f356a){return db['ZendeskField'][_0xce65('0x43')]({'where':{'id':_0x1110bb[_0xce65('0x3e')]['id']}})[_0xce65('0x22')](handleEntityNotFound(_0x3f356a,null))['then'](removeEntity(_0x3f356a,null))['catch'](handleError(_0x3f356a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 757092f..be47055 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 _0xdaad=['../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x9154ee,_0x5f2a85){var _0x24c414=function(_0x1602da){while(--_0x1602da){_0x9154ee['push'](_0x9154ee['shift']());}};_0x24c414(++_0x5f2a85);}(_0xdaad,0xdb));var _0xddaa=function(_0x1ade20,_0x1194d4){_0x1ade20=_0x1ade20-0x0;var _0x18ca28=_0xdaad[_0x1ade20];return _0x18ca28;};'use strict';var _=require(_0xddaa('0x0'));var util=require(_0xddaa('0x1'));var logger=require(_0xddaa('0x2'))(_0xddaa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xddaa('0x4'));var fs=require('fs');var path=require(_0xddaa('0x5'));var rimraf=require('rimraf');var config=require(_0xddaa('0x6'));var attributes=require(_0xddaa('0x7'));module[_0xddaa('0x8')]=function(_0x7944,_0x1afee5){return _0x7944[_0xddaa('0x9')](_0xddaa('0xa'),attributes,{'tableName':_0xddaa('0xb'),'paranoid':![],'indexes':[{'name':_0xddaa('0xc'),'fields':[_0xddaa('0xd'),_0xddaa('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x639f=['./intZendeskField.attributes','exports','define','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x5a7cdf,_0x372ce0){var _0x4eb079=function(_0x226a86){while(--_0x226a86){_0x5a7cdf['push'](_0x5a7cdf['shift']());}};_0x4eb079(++_0x372ce0);}(_0x639f,0x199));var _0xf639=function(_0x270189,_0x814b50){_0x270189=_0x270189-0x0;var _0x121150=_0x639f[_0x270189];return _0x121150;};'use strict';var _=require('lodash');var util=require(_0xf639('0x0'));var logger=require(_0xf639('0x1'))(_0xf639('0x2'));var moment=require(_0xf639('0x3'));var BPromise=require(_0xf639('0x4'));var rp=require(_0xf639('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf639('0x6'));var attributes=require(_0xf639('0x7'));module[_0xf639('0x8')]=function(_0x3e480f,_0x35085b){return _0x3e480f[_0xf639('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xf639('0xa'),'fields':[_0xf639('0xb'),_0xf639('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 6c4b937..7ac6fe7 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 _0x7c7c=['then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request'];(function(_0xd1a258,_0x390792){var _0x26f726=function(_0x493d3c){while(--_0x493d3c){_0xd1a258['push'](_0xd1a258['shift']());}};_0x26f726(++_0x390792);}(_0x7c7c,0xdd));var _0xc7c7=function(_0x5ddf1e,_0x45eb27){_0x5ddf1e=_0x5ddf1e-0x0;var _0x16e467=_0x7c7c[_0x5ddf1e];return _0x16e467;};'use strict';var _=require(_0xc7c7('0x0'));var util=require(_0xc7c7('0x1'));var moment=require('moment');var BPromise=require(_0xc7c7('0x2'));var rs=require(_0xc7c7('0x3'));var fs=require('fs');var Redis=require(_0xc7c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc7c7('0x5'))(_0xc7c7('0x6'));var config=require(_0xc7c7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc7c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3302b5,_0x1d8531,_0x53dd3b){return new BPromise(function(_0x481619,_0x1b8887){return client[_0xc7c7('0x9')](_0x3302b5,_0x53dd3b)[_0xc7c7('0xa')](function(_0x4b3287){logger[_0xc7c7('0xb')](_0xc7c7('0xc'),_0x1d8531,_0xc7c7('0xd'));logger['debug'](_0xc7c7('0xe'),_0x1d8531,'request\x20sent',JSON[_0xc7c7('0xf')](_0x4b3287));if(_0x4b3287['error']){if(_0x4b3287[_0xc7c7('0x10')][_0xc7c7('0x11')]===0x1f4){logger[_0xc7c7('0x10')](_0xc7c7('0xc'),_0x1d8531,_0x4b3287[_0xc7c7('0x10')][_0xc7c7('0x12')]);return _0x1b8887(_0x4b3287[_0xc7c7('0x10')]['message']);}logger[_0xc7c7('0x10')](_0xc7c7('0xc'),_0x1d8531,_0x4b3287['error'][_0xc7c7('0x12')]);return _0x481619(_0x4b3287['error'][_0xc7c7('0x12')]);}else{logger[_0xc7c7('0xb')](_0xc7c7('0xc'),_0x1d8531,_0xc7c7('0xd'));_0x481619(_0x4b3287[_0xc7c7('0x13')][_0xc7c7('0x12')]);}})[_0xc7c7('0x14')](function(_0x4a1ce9){logger[_0xc7c7('0x10')](_0xc7c7('0xc'),_0x1d8531,_0x4a1ce9);_0x1b8887(_0x4a1ce9);});});} \ No newline at end of file +var _0x05c0=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x76faa4,_0x4a8b9c){var _0x5cab58=function(_0x159033){while(--_0x159033){_0x76faa4['push'](_0x76faa4['shift']());}};_0x5cab58(++_0x4a8b9c);}(_0x05c0,0xef));var _0x005c=function(_0xf06944,_0x46b97b){_0xf06944=_0xf06944-0x0;var _0x56f0c3=_0x05c0[_0xf06944];return _0x56f0c3;};'use strict';var _=require(_0x005c('0x0'));var util=require(_0x005c('0x1'));var moment=require(_0x005c('0x2'));var BPromise=require(_0x005c('0x3'));var rs=require(_0x005c('0x4'));var fs=require('fs');var Redis=require(_0x005c('0x5'));var db=require(_0x005c('0x6'))['db'];var utils=require(_0x005c('0x7'));var logger=require(_0x005c('0x8'))(_0x005c('0x9'));var config=require(_0x005c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x005c('0xb')][_0x005c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53052a,_0x3e657c,_0x2019d7){return new BPromise(function(_0x4a886d,_0x53ab2b){return client[_0x005c('0xd')](_0x53052a,_0x2019d7)[_0x005c('0xe')](function(_0x2ff631){logger['info'](_0x005c('0xf'),_0x3e657c,'request\x20sent');logger[_0x005c('0x10')](_0x005c('0x11'),_0x3e657c,_0x005c('0x12'),JSON[_0x005c('0x13')](_0x2ff631));if(_0x2ff631[_0x005c('0x14')]){if(_0x2ff631[_0x005c('0x14')][_0x005c('0x15')]===0x1f4){logger[_0x005c('0x14')](_0x005c('0xf'),_0x3e657c,_0x2ff631[_0x005c('0x14')][_0x005c('0x16')]);return _0x53ab2b(_0x2ff631[_0x005c('0x14')][_0x005c('0x16')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x3e657c,_0x2ff631[_0x005c('0x14')][_0x005c('0x16')]);return _0x4a886d(_0x2ff631['error'][_0x005c('0x16')]);}else{logger[_0x005c('0x17')](_0x005c('0xf'),_0x3e657c,_0x005c('0x12'));_0x4a886d(_0x2ff631[_0x005c('0x18')][_0x005c('0x16')]);}})[_0x005c('0x19')](function(_0x153c1c){logger[_0x005c('0x14')]('ZendeskField,\x20%s,\x20%s',_0x3e657c,_0x153c1c);_0x53ab2b(_0x153c1c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a98523c..403c1ac 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 _0xfb8d=['post','addConfiguration','put','update','util','express','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields'];(function(_0x5b3979,_0x8adcf9){var _0x4c0727=function(_0x2b81b6){while(--_0x2b81b6){_0x5b3979['push'](_0x5b3979['shift']());}};_0x4c0727(++_0x8adcf9);}(_0xfb8d,0x174));var _0xdfb8=function(_0x549a88,_0x37324e){_0x549a88=_0x549a88-0x0;var _0x4568a6=_0xfb8d[_0x549a88];return _0x4568a6;};'use strict';var multer=require('multer');var util=require(_0xdfb8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfb8('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdfb8('0x2'));var interaction=require(_0xdfb8('0x3'));var config=require('../../config/environment');var controller=require(_0xdfb8('0x4'));router[_0xdfb8('0x5')]('/',auth[_0xdfb8('0x6')](),controller[_0xdfb8('0x7')]);router[_0xdfb8('0x5')](_0xdfb8('0x8'),auth['isAuthenticated'](),controller[_0xdfb8('0x9')]);router[_0xdfb8('0x5')](_0xdfb8('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xdfb8('0x5')]('/:id/fields',auth[_0xdfb8('0x6')](),controller[_0xdfb8('0xb')]);router['post']('/',auth[_0xdfb8('0x6')](),controller['create']);router[_0xdfb8('0xc')](_0xdfb8('0xa'),auth[_0xdfb8('0x6')](),controller[_0xdfb8('0xd')]);router[_0xdfb8('0xe')](_0xdfb8('0x8'),auth[_0xdfb8('0x6')](),controller[_0xdfb8('0xf')]);router['delete'](_0xdfb8('0x8'),auth[_0xdfb8('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x227a=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x420b0c,_0xbb4ea3){var _0x3a0f8b=function(_0x238ac){while(--_0x238ac){_0x420b0c['push'](_0x420b0c['shift']());}};_0x3a0f8b(++_0xbb4ea3);}(_0x227a,0x1b2));var _0xa227=function(_0x90f09b,_0x56cc5d){_0x90f09b=_0x90f09b-0x0;var _0x1caf14=_0x227a[_0x90f09b];return _0x1caf14;};'use strict';var multer=require(_0xa227('0x0'));var util=require(_0xa227('0x1'));var path=require(_0xa227('0x2'));var timeout=require(_0xa227('0x3'));var express=require(_0xa227('0x4'));var router=express[_0xa227('0x5')]();var fs_extra=require(_0xa227('0x6'));var auth=require(_0xa227('0x7'));var interaction=require(_0xa227('0x8'));var config=require(_0xa227('0x9'));var controller=require(_0xa227('0xa'));router['get']('/',auth[_0xa227('0xb')](),controller[_0xa227('0xc')]);router[_0xa227('0xd')]('/:id',auth[_0xa227('0xb')](),controller[_0xa227('0xe')]);router[_0xa227('0xd')](_0xa227('0xf'),auth[_0xa227('0xb')](),controller[_0xa227('0x10')]);router['get'](_0xa227('0x11'),auth[_0xa227('0xb')](),controller[_0xa227('0x12')]);router[_0xa227('0x13')]('/',auth[_0xa227('0xb')](),controller[_0xa227('0x14')]);router[_0xa227('0x13')](_0xa227('0xf'),auth[_0xa227('0xb')](),controller['addConfiguration']);router[_0xa227('0x15')](_0xa227('0x16'),auth[_0xa227('0xb')](),controller[_0xa227('0x17')]);router[_0xa227('0x18')](_0xa227('0x16'),auth[_0xa227('0xb')](),controller['destroy']);module[_0xa227('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f0cb379..a18fda7 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 _0xaa88=['exports','STRING','sequelize'];(function(_0x497479,_0x4075a1){var _0x372a32=function(_0x16ce6a){while(--_0x16ce6a){_0x497479['push'](_0x497479['shift']());}};_0x372a32(++_0x4075a1);}(_0xaa88,0x137));var _0x8aa8=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xaa88[_0x12a2a6];return _0x1754ae;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','STRING'];(function(_0x478927,_0x137268){var _0x37223f=function(_0x16faf8){while(--_0x16faf8){_0x478927['push'](_0x478927['shift']());}};_0x37223f(++_0x137268);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index eac08f6..ba7eabe 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 _0x530b=['name','send','index','rawAttributes','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','catch','params','keys','merge','find','create','body','destroy','findOne','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','serverUrl','code','host','zoho.eu','com','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','stack'];(function(_0x2dba33,_0x38eca1){var _0xf340c2=function(_0x18290b){while(--_0x18290b){_0x2dba33['push'](_0x2dba33['shift']());}};_0xf340c2(++_0x38eca1);}(_0x530b,0x1d9));var _0xb530=function(_0x330141,_0x1dd290){_0x330141=_0x330141-0x0;var _0x1b68a2=_0x530b[_0x330141];return _0x1b68a2;};'use strict';var emlformat=require(_0xb530('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb530('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb530('0x2'));var moment=require(_0xb530('0x3'));var BPromise=require(_0xb530('0x4'));var Mustache=require(_0xb530('0x5'));var util=require(_0xb530('0x6'));var path=require(_0xb530('0x7'));var sox=require('sox');var csv=require(_0xb530('0x8'));var ejs=require(_0xb530('0x9'));var fs=require('fs');var fs_extra=require(_0xb530('0xa'));var _=require(_0xb530('0xb'));var squel=require(_0xb530('0xc'));var crypto=require(_0xb530('0xd'));var jsforce=require(_0xb530('0xe'));var deskjs=require(_0xb530('0xf'));var toCsv=require(_0xb530('0x8'));var querystring=require(_0xb530('0x10'));var Papa=require('papaparse');var Redis=require(_0xb530('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb530('0x12'));var logger=require(_0xb530('0x13'))('api');var utils=require(_0xb530('0x14'));var config=require(_0xb530('0x15'));var licenseUtil=require(_0xb530('0x16'));var db=require(_0xb530('0x17'))['db'];var integrations=require(_0xb530('0x18'));function respondWithStatusCode(_0x20f770,_0x4ff483){_0x4ff483=_0x4ff483||0xcc;return function(_0x4478ef){if(_0x4478ef){return _0x20f770['sendStatus'](_0x4ff483);}return _0x20f770[_0xb530('0x19')](_0x4ff483)[_0xb530('0x1a')]();};}function respondWithResult(_0x14bbdf,_0x2db28b){_0x2db28b=_0x2db28b||0xc8;return function(_0x39c143){if(_0x39c143){return _0x14bbdf[_0xb530('0x19')](_0x2db28b)[_0xb530('0x1b')](_0x39c143);}};}function respondWithFilteredResult(_0x1bb994,_0x3ae78e){return function(_0x50f5b2){if(_0x50f5b2){var _0x37b5b5=typeof _0x3ae78e['offset']===_0xb530('0x1c')&&typeof _0x3ae78e[_0xb530('0x1d')]===_0xb530('0x1c');var _0x5dbaaf=_0x50f5b2[_0xb530('0x1e')];var _0xb0814d=_0x37b5b5?0x0:_0x3ae78e['offset'];var _0x3aa704=_0x37b5b5?_0x50f5b2[_0xb530('0x1e')]:_0x3ae78e[_0xb530('0x1f')]+_0x3ae78e[_0xb530('0x1d')];var _0x5b86e7;if(_0x3aa704>=_0x5dbaaf){_0x3aa704=_0x5dbaaf;_0x5b86e7=0xc8;}else{_0x5b86e7=0xce;}_0x1bb994[_0xb530('0x19')](_0x5b86e7);return _0x1bb994['set']('Content-Range',_0xb0814d+'-'+_0x3aa704+'/'+_0x5dbaaf)[_0xb530('0x1b')](_0x50f5b2);}return null;};}function patchUpdates(_0x2a906d){return function(_0x572b73){try{jsonpatch[_0xb530('0x20')](_0x572b73,_0x2a906d,!![]);}catch(_0x13aaa4){return BPromise[_0xb530('0x21')](_0x13aaa4);}return _0x572b73[_0xb530('0x22')]();};}function saveUpdates(_0x16e72b,_0x104eb6){return function(_0x400267){if(_0x400267){return _0x400267[_0xb530('0x23')](_0x16e72b)[_0xb530('0x24')](function(_0x3395ff){return _0x3395ff;});}return null;};}function removeEntity(_0xc7b169,_0x1a9b11){return function(_0x4c6f2c){if(_0x4c6f2c){return _0x4c6f2c['destroy']()[_0xb530('0x24')](function(){_0xc7b169[_0xb530('0x19')](0xcc)[_0xb530('0x1a')]();});}};}function handleEntityNotFound(_0x65976b,_0x1d7ae9){return function(_0x5812c1){if(!_0x5812c1){_0x65976b['sendStatus'](0x194);}return _0x5812c1;};}function handleError(_0x3a6e62,_0x652996){_0x652996=_0x652996||0x1f4;return function(_0x1ec32d){logger[_0xb530('0x25')](_0x1ec32d[_0xb530('0x26')]);if(_0x1ec32d[_0xb530('0x27')]){delete _0x1ec32d['name'];}_0x3a6e62['status'](_0x652996)[_0xb530('0x28')](_0x1ec32d);};}exports[_0xb530('0x29')]=function(_0x3fa6ae,_0x241722){var _0x1361b8={},_0xeb2564={},_0x86ba84={'count':0x0,'rows':[]};var _0x2047e5=_['map'](db['ZohoAccount'][_0xb530('0x2a')],function(_0x55bd36){return{'name':_0x55bd36['fieldName'],'type':_0x55bd36[_0xb530('0x2b')]['key']};});_0xeb2564[_0xb530('0x2c')]=_[_0xb530('0x2d')](_0x2047e5,_0xb530('0x27'));_0xeb2564[_0xb530('0x2e')]=_['keys'](_0x3fa6ae[_0xb530('0x2e')]);_0xeb2564['filters']=_[_0xb530('0x2f')](_0xeb2564[_0xb530('0x2c')],_0xeb2564[_0xb530('0x2e')]);_0x1361b8[_0xb530('0x30')]=_['intersection'](_0xeb2564[_0xb530('0x2c')],qs[_0xb530('0x31')](_0x3fa6ae[_0xb530('0x2e')][_0xb530('0x31')]));_0x1361b8[_0xb530('0x30')]=_0x1361b8[_0xb530('0x30')][_0xb530('0x32')]?_0x1361b8[_0xb530('0x30')]:_0xeb2564['model'];if(!_0x3fa6ae[_0xb530('0x2e')][_0xb530('0x33')](_0xb530('0x34'))){_0x1361b8[_0xb530('0x1d')]=qs[_0xb530('0x1d')](_0x3fa6ae[_0xb530('0x2e')][_0xb530('0x1d')]);_0x1361b8[_0xb530('0x1f')]=qs[_0xb530('0x1f')](_0x3fa6ae[_0xb530('0x2e')][_0xb530('0x1f')]);}_0x1361b8[_0xb530('0x35')]=qs[_0xb530('0x36')](_0x3fa6ae[_0xb530('0x2e')][_0xb530('0x36')]);_0x1361b8[_0xb530('0x37')]=qs['filters'](_['pick'](_0x3fa6ae[_0xb530('0x2e')],_0xeb2564[_0xb530('0x38')]),_0x2047e5);if(_0x3fa6ae['query'][_0xb530('0x39')]){_0x1361b8[_0xb530('0x37')]=_['merge'](_0x1361b8[_0xb530('0x37')],{'$or':_[_0xb530('0x2d')](_0x2047e5,function(_0x2f9d41){if(_0x2f9d41[_0xb530('0x2b')]!==_0xb530('0x3a')){var _0x23fe8b={};_0x23fe8b[_0x2f9d41[_0xb530('0x27')]]={'$like':'%'+_0x3fa6ae['query'][_0xb530('0x39')]+'%'};return _0x23fe8b;}})});}_0x1361b8=_['merge']({},_0x1361b8,_0x3fa6ae[_0xb530('0x3b')]);var _0x521ed5={'where':_0x1361b8['where']};return db[_0xb530('0x3c')][_0xb530('0x1e')](_0x521ed5)[_0xb530('0x24')](function(_0x223f48){_0x86ba84[_0xb530('0x1e')]=_0x223f48;if(_0x3fa6ae['query'][_0xb530('0x3d')]){_0x1361b8[_0xb530('0x3e')]=[{'all':!![]}];}return db['ZohoAccount'][_0xb530('0x3f')](_0x1361b8);})[_0xb530('0x24')](function(_0x459921){_0x86ba84[_0xb530('0x40')]=_0x459921;return _0x86ba84;})['then'](respondWithFilteredResult(_0x241722,_0x1361b8))[_0xb530('0x41')](handleError(_0x241722,null));};exports['show']=function(_0x4859f0,_0x3700c5){var _0x11a838={'raw':![],'where':{'id':_0x4859f0[_0xb530('0x42')]['id']}},_0x31df6d={};_0x31df6d[_0xb530('0x2c')]=_[_0xb530('0x43')](db[_0xb530('0x3c')]['rawAttributes']);_0x31df6d['query']=_[_0xb530('0x43')](_0x4859f0[_0xb530('0x2e')]);_0x31df6d[_0xb530('0x38')]=_[_0xb530('0x2f')](_0x31df6d[_0xb530('0x2c')],_0x31df6d['query']);_0x11a838[_0xb530('0x30')]=_[_0xb530('0x2f')](_0x31df6d[_0xb530('0x2c')],qs[_0xb530('0x31')](_0x4859f0['query']['fields']));_0x11a838[_0xb530('0x30')]=_0x11a838[_0xb530('0x30')][_0xb530('0x32')]?_0x11a838[_0xb530('0x30')]:_0x31df6d[_0xb530('0x2c')];if(_0x4859f0['query'][_0xb530('0x3d')]){_0x11a838[_0xb530('0x3e')]=[{'all':!![]}];}_0x11a838=_[_0xb530('0x44')]({},_0x11a838,_0x4859f0[_0xb530('0x3b')]);return db[_0xb530('0x3c')][_0xb530('0x45')](_0x11a838)['then'](handleEntityNotFound(_0x3700c5,null))[_0xb530('0x24')](respondWithResult(_0x3700c5,null))['catch'](handleError(_0x3700c5,null));};exports[_0xb530('0x46')]=function(_0x404c59,_0x30a470){return db[_0xb530('0x3c')][_0xb530('0x46')](_0x404c59[_0xb530('0x47')],{})[_0xb530('0x24')](respondWithResult(_0x30a470,0xc9))[_0xb530('0x41')](handleError(_0x30a470,null));};exports[_0xb530('0x23')]=function(_0x42552f,_0x16ab89){if(_0x42552f['body']['id']){delete _0x42552f[_0xb530('0x47')]['id'];}return db[_0xb530('0x3c')][_0xb530('0x45')]({'where':{'id':_0x42552f[_0xb530('0x42')]['id']}})[_0xb530('0x24')](handleEntityNotFound(_0x16ab89,null))[_0xb530('0x24')](saveUpdates(_0x42552f['body'],null))[_0xb530('0x24')](respondWithResult(_0x16ab89,null))[_0xb530('0x41')](handleError(_0x16ab89,null));};exports[_0xb530('0x48')]=function(_0x8ea968,_0x38e933){return db[_0xb530('0x3c')][_0xb530('0x45')]({'where':{'id':_0x8ea968[_0xb530('0x42')]['id']}})[_0xb530('0x24')](handleEntityNotFound(_0x38e933,null))[_0xb530('0x24')](removeEntity(_0x38e933,null))['catch'](handleError(_0x38e933,null));};exports['getConfigurations']=function(_0xff20f1,_0x564f1d,_0x28c892){var _0x2b383c={};var _0x3836fa={};var _0x2a4011;var _0x457b8c;return db['ZohoAccount'][_0xb530('0x49')]({'where':{'id':_0xff20f1[_0xb530('0x42')]['id']}})[_0xb530('0x24')](handleEntityNotFound(_0x564f1d,null))[_0xb530('0x24')](function(_0xda29c4){if(_0xda29c4){_0x2a4011=_0xda29c4;_0x3836fa[_0xb530('0x2c')]=_[_0xb530('0x43')](db['ZohoConfiguration'][_0xb530('0x2a')]);_0x3836fa['query']=_[_0xb530('0x43')](_0xff20f1[_0xb530('0x2e')]);_0x3836fa[_0xb530('0x38')]=_[_0xb530('0x2f')](_0x3836fa['model'],_0x3836fa[_0xb530('0x2e')]);_0x2b383c['attributes']=_[_0xb530('0x2f')](_0x3836fa[_0xb530('0x2c')],qs['fields'](_0xff20f1['query'][_0xb530('0x31')]));_0x2b383c['attributes']=_0x2b383c[_0xb530('0x30')]['length']?_0x2b383c[_0xb530('0x30')]:_0x3836fa['model'];_0x2b383c[_0xb530('0x35')]=qs[_0xb530('0x36')](_0xff20f1[_0xb530('0x2e')][_0xb530('0x36')]);_0x2b383c[_0xb530('0x37')]=qs[_0xb530('0x38')](_[_0xb530('0x4a')](_0xff20f1['query'],_0x3836fa['filters']));if(_0xff20f1['query']['filter']){_0x2b383c[_0xb530('0x37')]=_[_0xb530('0x44')](_0x2b383c['where'],{'$or':_[_0xb530('0x2d')](_0x2b383c['attributes'],function(_0x4e980a){var _0x4f0111={};_0x4f0111[_0x4e980a]={'$like':'%'+_0xff20f1[_0xb530('0x2e')][_0xb530('0x39')]+'%'};return _0x4f0111;})});}_0x2b383c=_[_0xb530('0x44')]({},_0x2b383c,_0xff20f1[_0xb530('0x3b')]);return _0x2a4011[_0xb530('0x4b')](_0x2b383c);}})[_0xb530('0x24')](function(_0x3c256a){if(_0x3c256a){_0x457b8c=_0x3c256a['length'];if(!_0xff20f1['query'][_0xb530('0x33')](_0xb530('0x34'))){_0x2b383c[_0xb530('0x1d')]=qs[_0xb530('0x1d')](_0xff20f1[_0xb530('0x2e')][_0xb530('0x1d')]);_0x2b383c[_0xb530('0x1f')]=qs['offset'](_0xff20f1['query'][_0xb530('0x1f')]);}return _0x2a4011['getConfigurations'](_0x2b383c);}})[_0xb530('0x24')](function(_0x270a58){if(_0x270a58){return _0x270a58?{'count':_0x457b8c,'rows':_0x270a58}:null;}})[_0xb530('0x24')](respondWithResult(_0x564f1d,null))[_0xb530('0x41')](handleError(_0x564f1d,null));};exports[_0xb530('0x4c')]=function(_0xa2e1fe,_0x59e024,_0x37373f){if(_0xa2e1fe[_0xb530('0x47')]['id']){delete _0xa2e1fe['body']['id'];}return db[_0xb530('0x3c')]['findOne']({'where':{'id':_0xa2e1fe['params']['id']}})[_0xb530('0x24')](handleEntityNotFound(_0x59e024,null))[_0xb530('0x24')](function(_0x4a4d9a){if(_0x4a4d9a){_0xa2e1fe[_0xb530('0x47')]['AccountId']=_0x4a4d9a['id'];_0xa2e1fe['body'][_0xb530('0x4d')]=integrations[_0xb530('0x4e')](_0xa2e1fe[_0xb530('0x47')][_0xb530('0x4f')],_0xa2e1fe[_0xb530('0x47')][_0xb530('0x2b')]);_0xa2e1fe[_0xb530('0x47')]['Descriptions']=integrations[_0xb530('0x50')](_0xa2e1fe[_0xb530('0x47')][_0xb530('0x4f')],_0xa2e1fe[_0xb530('0x47')]['type']);return db['ZohoConfiguration'][_0xb530('0x46')](_0xa2e1fe[_0xb530('0x47')],{'include':[{'model':db['ZohoField'],'as':_0xb530('0x4d')},{'model':db[_0xb530('0x51')],'as':_0xb530('0x52')}]});}return null;})[_0xb530('0x24')](respondWithResult(_0x59e024,null))[_0xb530('0x41')](handleError(_0x59e024,null));};function getAccessToken(_0x3bd771){return new Promise(function(_0x5ae40b,_0x3d44cf){var _0x56aafd;switch(_0x3bd771[_0xb530('0x53')]){case'US':_0x56aafd=_0xb530('0x54');break;case'AU':_0x56aafd='https://accounts.zoho.com.au';break;case'EU':_0x56aafd=_0xb530('0x55');break;case'IN':_0x56aafd='https://accounts.zoho.in';break;case'CN':_0x56aafd=_0xb530('0x56');break;default:_0x56aafd=_0xb530('0x55');break;}var _0x18c147={'method':_0xb530('0x57'),'uri':_0x56aafd+_0xb530('0x58'),'qs':{'refresh_token':_0x3bd771['refreshToken'],'client_id':_0x3bd771['clientId'],'client_secret':_0x3bd771[_0xb530('0x59')],'grant_type':_0xb530('0x5a')},'json':!![]};return rp(_0x18c147)[_0xb530('0x24')](function(_0x2833fb){if(_0x2833fb[_0xb530('0x5b')]){_0x5ae40b(_0x2833fb[_0xb530('0x5b')]);}else{_0x3d44cf(_0xb530('0x5c'));}})['catch'](function(_0x5af296){_0x3d44cf(_0x5af296);});});}exports[_0xb530('0x5d')]=function(_0x5992e1,_0x155b89,_0x200998){var _0x5dce3d,_0x3b17ce,_0x3b9367,_0x2518bf,_0x27bc1f;return db[_0xb530('0x3c')][_0xb530('0x49')]({'where':{'id':_0x5992e1['params']['id']},'attributes':['id','host',_0xb530('0x53'),_0xb530('0x5e'),_0xb530('0x59'),_0xb530('0x5f'),_0xb530('0x60'),'refreshToken']})[_0xb530('0x24')](handleEntityNotFound(_0x155b89,null))[_0xb530('0x24')](function(_0x4be09a){_0x27bc1f=_0x4be09a;_0x5dce3d=_0x27bc1f[_0xb530('0x61')];_0x3b17ce=_0x5dce3d===_0xb530('0x62')?'eu':_0xb530('0x63');_0x3b9367=_0x27bc1f[_0xb530('0x5f')];var _0x871340=_0x3b9367['slice'](-0x1);if(_0x871340==='/'||_0x871340==='\x5c'||_0x871340===':'){_0x3b9367=_0x3b9367[_0xb530('0x64')](0x0,_0x3b9367[_0xb530('0x65')](_0x871340));}if(!_0x27bc1f[_0xb530('0x66')]){throw new Error(_0xb530('0x67'));}return getAccessToken(_0x27bc1f);})['then'](function(_0x127c86){if(_0x127c86){return rp({'method':_0xb530('0x68'),'uri':util['format'](_0xb530('0x69'),_0x3b17ce),'qs':{'module':_0xb530('0x6a')},'headers':{'Authorization':_0xb530('0x6b')+_0x127c86},'json':!![]});}})[_0xb530('0x24')](function(_0x5a74cc){if(_0x5a74cc){if(_0x5a74cc[_0xb530('0x6c')]&&_0x5a74cc[_0xb530('0x6c')][_0xb530('0x25')]){throw new Error(_0x5a74cc[_0xb530('0x6c')]['error'][_0xb530('0x6d')]);}var _0x31a7e1=[];var _0x2cd651=[];var _0x3c15e7=[_0xb530('0x6e'),_0xb530('0x6f'),_0xb530('0x70'),'WhoId',_0xb530('0x71'),_0xb530('0x72'),'Call_Start_Time',_0xb530('0x73')];_0x2cd651=_[_0xb530('0x74')](_0x5a74cc[_0xb530('0x31')],function(_0x2c83cd){return _0x3c15e7['includes'](_0x2c83cd[_0xb530('0x75')]);});for(var _0x3294c6=0x0;_0x3294c6<_0x2cd651[_0xb530('0x32')];_0x3294c6++){if(_0x2cd651[_0x3294c6][_0xb530('0x76')]===![]){_0x31a7e1[_0xb530('0x77')]({'id':_0x2cd651[_0x3294c6]['id'],'name':_0x2cd651[_0x3294c6][_0xb530('0x78')],'custom':_0x2cd651[_0x3294c6]['custom_field'],'options':_0x2cd651[_0x3294c6][_0xb530('0x79')]===_0xb530('0x7a')&&_0x2cd651[_0x3294c6][_0xb530('0x7b')][_0xb530('0x32')]>-0x1?_[_0xb530('0x2d')](_0x2cd651[_0x3294c6][_0xb530('0x7b')],function(_0x23596b){return{'name':_0x23596b,'value':_0x23596b};}):[]});}}return{'count':_0x31a7e1['length'],'rows':_0x31a7e1};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x155b89,null))['catch'](function(_0x5f54ea){var _0x35c6f9=_0x5992e1[_0xb530('0x2e')][_0xb530('0x7c')]?0x1f4:_0x5f54ea[_0xb530('0x7d')]||0x1f4;logger['error'](_0xb530('0x7e'),'getFields',_0x35c6f9,JSON['stringify'](_0x5f54ea));delete _0x5f54ea[_0xb530('0x27')];if(_0x35c6f9===0x191){_0x35c6f9=0x190;}_0x155b89[_0xb530('0x19')](_0x35c6f9)[_0xb530('0x28')](_0x5992e1['query'][_0xb530('0x7c')]?{'message':_0xb530('0x7f'),'statusCode':_0x5f54ea[_0xb530('0x7d')]}:_0x5f54ea);});}; \ No newline at end of file +var _0x8fb3=['filter','where','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','ZohoConfiguration','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','model','map','query','keys','filters','attributes','fields','length','order','sort','pick'];(function(_0x2928ab,_0x5311b3){var _0x3981f0=function(_0x50b1de){while(--_0x50b1de){_0x2928ab['push'](_0x2928ab['shift']());}};_0x3981f0(++_0x5311b3);}(_0x8fb3,0x161));var _0x38fb=function(_0x30e5b1,_0x53ce03){_0x30e5b1=_0x30e5b1-0x0;var _0x43a05f=_0x8fb3[_0x30e5b1];return _0x43a05f;};'use strict';var emlformat=require(_0x38fb('0x0'));var rimraf=require(_0x38fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38fb('0x2'));var moment=require(_0x38fb('0x3'));var BPromise=require(_0x38fb('0x4'));var Mustache=require(_0x38fb('0x5'));var util=require('util');var path=require(_0x38fb('0x6'));var sox=require(_0x38fb('0x7'));var csv=require(_0x38fb('0x8'));var ejs=require(_0x38fb('0x9'));var fs=require('fs');var fs_extra=require(_0x38fb('0xa'));var _=require(_0x38fb('0xb'));var squel=require(_0x38fb('0xc'));var crypto=require(_0x38fb('0xd'));var jsforce=require(_0x38fb('0xe'));var deskjs=require(_0x38fb('0xf'));var toCsv=require(_0x38fb('0x8'));var querystring=require(_0x38fb('0x10'));var Papa=require(_0x38fb('0x11'));var Redis=require(_0x38fb('0x12'));var authService=require(_0x38fb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x38fb('0x14'));var hardwareService=require(_0x38fb('0x15'));var logger=require(_0x38fb('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x38fb('0x17'));var licenseUtil=require(_0x38fb('0x18'));var db=require(_0x38fb('0x19'))['db'];var integrations=require(_0x38fb('0x1a'));function respondWithStatusCode(_0x19446c,_0x233178){_0x233178=_0x233178||0xcc;return function(_0x1547b4){if(_0x1547b4){return _0x19446c[_0x38fb('0x1b')](_0x233178);}return _0x19446c['status'](_0x233178)[_0x38fb('0x1c')]();};}function respondWithResult(_0x13168d,_0x46a24e){_0x46a24e=_0x46a24e||0xc8;return function(_0x5ee8ba){if(_0x5ee8ba){return _0x13168d[_0x38fb('0x1d')](_0x46a24e)['json'](_0x5ee8ba);}};}function respondWithFilteredResult(_0xabf56d,_0x239d38){return function(_0x4f844f){if(_0x4f844f){var _0x2fadaa=typeof _0x239d38['offset']===_0x38fb('0x1e')&&typeof _0x239d38['limit']===_0x38fb('0x1e');var _0x26df64=_0x4f844f['count'];var _0xdd1741=_0x2fadaa?0x0:_0x239d38[_0x38fb('0x1f')];var _0x20d4ba=_0x2fadaa?_0x4f844f['count']:_0x239d38['offset']+_0x239d38[_0x38fb('0x20')];var _0x58fb18;if(_0x20d4ba>=_0x26df64){_0x20d4ba=_0x26df64;_0x58fb18=0xc8;}else{_0x58fb18=0xce;}_0xabf56d['status'](_0x58fb18);return _0xabf56d[_0x38fb('0x21')](_0x38fb('0x22'),_0xdd1741+'-'+_0x20d4ba+'/'+_0x26df64)['json'](_0x4f844f);}return null;};}function patchUpdates(_0x48d4d4){return function(_0x34bae4){try{jsonpatch[_0x38fb('0x23')](_0x34bae4,_0x48d4d4,!![]);}catch(_0x28dd94){return BPromise[_0x38fb('0x24')](_0x28dd94);}return _0x34bae4[_0x38fb('0x25')]();};}function saveUpdates(_0x2048e5,_0x447459){return function(_0x5654d8){if(_0x5654d8){return _0x5654d8[_0x38fb('0x26')](_0x2048e5)[_0x38fb('0x27')](function(_0xdf209c){return _0xdf209c;});}return null;};}function removeEntity(_0xcf609c,_0x2a18c4){return function(_0x24b103){if(_0x24b103){return _0x24b103[_0x38fb('0x28')]()[_0x38fb('0x27')](function(){_0xcf609c[_0x38fb('0x1d')](0xcc)[_0x38fb('0x1c')]();});}};}function handleEntityNotFound(_0x42b1d2,_0x3fa101){return function(_0x595336){if(!_0x595336){_0x42b1d2[_0x38fb('0x1b')](0x194);}return _0x595336;};}function handleError(_0x59abf6,_0x36b328){_0x36b328=_0x36b328||0x1f4;return function(_0x1bd720){logger['error'](_0x1bd720[_0x38fb('0x29')]);if(_0x1bd720['name']){delete _0x1bd720[_0x38fb('0x2a')];}_0x59abf6[_0x38fb('0x1d')](_0x36b328)['send'](_0x1bd720);};}exports[_0x38fb('0x2b')]=function(_0x1ff0bf,_0x36a588){var _0x4277a9={},_0x58c8bc={},_0x4c1735={'count':0x0,'rows':[]};var _0x48d68c=_['map'](db[_0x38fb('0x2c')][_0x38fb('0x2d')],function(_0x3292b3){return{'name':_0x3292b3[_0x38fb('0x2e')],'type':_0x3292b3['type']['key']};});_0x58c8bc[_0x38fb('0x2f')]=_[_0x38fb('0x30')](_0x48d68c,_0x38fb('0x2a'));_0x58c8bc[_0x38fb('0x31')]=_[_0x38fb('0x32')](_0x1ff0bf[_0x38fb('0x31')]);_0x58c8bc[_0x38fb('0x33')]=_['intersection'](_0x58c8bc[_0x38fb('0x2f')],_0x58c8bc['query']);_0x4277a9[_0x38fb('0x34')]=_['intersection'](_0x58c8bc[_0x38fb('0x2f')],qs[_0x38fb('0x35')](_0x1ff0bf[_0x38fb('0x31')][_0x38fb('0x35')]));_0x4277a9[_0x38fb('0x34')]=_0x4277a9[_0x38fb('0x34')][_0x38fb('0x36')]?_0x4277a9[_0x38fb('0x34')]:_0x58c8bc['model'];if(!_0x1ff0bf['query']['hasOwnProperty']('nolimit')){_0x4277a9['limit']=qs[_0x38fb('0x20')](_0x1ff0bf[_0x38fb('0x31')]['limit']);_0x4277a9[_0x38fb('0x1f')]=qs[_0x38fb('0x1f')](_0x1ff0bf[_0x38fb('0x31')][_0x38fb('0x1f')]);}_0x4277a9[_0x38fb('0x37')]=qs[_0x38fb('0x38')](_0x1ff0bf[_0x38fb('0x31')][_0x38fb('0x38')]);_0x4277a9['where']=qs[_0x38fb('0x33')](_[_0x38fb('0x39')](_0x1ff0bf['query'],_0x58c8bc[_0x38fb('0x33')]),_0x48d68c);if(_0x1ff0bf['query'][_0x38fb('0x3a')]){_0x4277a9[_0x38fb('0x3b')]=_[_0x38fb('0x3c')](_0x4277a9[_0x38fb('0x3b')],{'$or':_['map'](_0x48d68c,function(_0x5f121d){if(_0x5f121d[_0x38fb('0x3d')]!==_0x38fb('0x3e')){var _0x5f44fa={};_0x5f44fa[_0x5f121d[_0x38fb('0x2a')]]={'$like':'%'+_0x1ff0bf[_0x38fb('0x31')]['filter']+'%'};return _0x5f44fa;}})});}_0x4277a9=_['merge']({},_0x4277a9,_0x1ff0bf[_0x38fb('0x3f')]);var _0xf25f69={'where':_0x4277a9['where']};return db[_0x38fb('0x2c')][_0x38fb('0x40')](_0xf25f69)[_0x38fb('0x27')](function(_0x117b87){_0x4c1735[_0x38fb('0x40')]=_0x117b87;if(_0x1ff0bf[_0x38fb('0x31')]['includeAll']){_0x4277a9[_0x38fb('0x41')]=[{'all':!![]}];}return db[_0x38fb('0x2c')][_0x38fb('0x42')](_0x4277a9);})[_0x38fb('0x27')](function(_0x8bdaa8){_0x4c1735[_0x38fb('0x43')]=_0x8bdaa8;return _0x4c1735;})[_0x38fb('0x27')](respondWithFilteredResult(_0x36a588,_0x4277a9))[_0x38fb('0x44')](handleError(_0x36a588,null));};exports[_0x38fb('0x45')]=function(_0x43e185,_0x29f80a){var _0x1258c1={'raw':![],'where':{'id':_0x43e185[_0x38fb('0x46')]['id']}},_0xb444b1={};_0xb444b1[_0x38fb('0x2f')]=_['keys'](db['ZohoAccount'][_0x38fb('0x2d')]);_0xb444b1[_0x38fb('0x31')]=_[_0x38fb('0x32')](_0x43e185[_0x38fb('0x31')]);_0xb444b1[_0x38fb('0x33')]=_['intersection'](_0xb444b1[_0x38fb('0x2f')],_0xb444b1[_0x38fb('0x31')]);_0x1258c1[_0x38fb('0x34')]=_['intersection'](_0xb444b1[_0x38fb('0x2f')],qs[_0x38fb('0x35')](_0x43e185[_0x38fb('0x31')][_0x38fb('0x35')]));_0x1258c1[_0x38fb('0x34')]=_0x1258c1[_0x38fb('0x34')]['length']?_0x1258c1['attributes']:_0xb444b1[_0x38fb('0x2f')];if(_0x43e185[_0x38fb('0x31')][_0x38fb('0x47')]){_0x1258c1[_0x38fb('0x41')]=[{'all':!![]}];}_0x1258c1=_['merge']({},_0x1258c1,_0x43e185['options']);return db['ZohoAccount'][_0x38fb('0x48')](_0x1258c1)[_0x38fb('0x27')](handleEntityNotFound(_0x29f80a,null))[_0x38fb('0x27')](respondWithResult(_0x29f80a,null))[_0x38fb('0x44')](handleError(_0x29f80a,null));};exports[_0x38fb('0x49')]=function(_0x3c9109,_0x155dcc){return db['ZohoAccount'][_0x38fb('0x49')](_0x3c9109[_0x38fb('0x4a')],{})['then'](respondWithResult(_0x155dcc,0xc9))[_0x38fb('0x44')](handleError(_0x155dcc,null));};exports[_0x38fb('0x26')]=function(_0x4aafdf,_0x4be82d){if(_0x4aafdf[_0x38fb('0x4a')]['id']){delete _0x4aafdf[_0x38fb('0x4a')]['id'];}return db[_0x38fb('0x2c')][_0x38fb('0x48')]({'where':{'id':_0x4aafdf[_0x38fb('0x46')]['id']}})[_0x38fb('0x27')](handleEntityNotFound(_0x4be82d,null))['then'](saveUpdates(_0x4aafdf[_0x38fb('0x4a')],null))[_0x38fb('0x27')](respondWithResult(_0x4be82d,null))[_0x38fb('0x44')](handleError(_0x4be82d,null));};exports[_0x38fb('0x28')]=function(_0x4ee02d,_0x375af1){return db[_0x38fb('0x2c')][_0x38fb('0x48')]({'where':{'id':_0x4ee02d[_0x38fb('0x46')]['id']}})[_0x38fb('0x27')](handleEntityNotFound(_0x375af1,null))['then'](removeEntity(_0x375af1,null))['catch'](handleError(_0x375af1,null));};exports['getConfigurations']=function(_0x14d933,_0x3b04eb,_0xc7999c){var _0x4e88cf={};var _0x5cf154={};var _0x1e66b4;var _0x332780;return db['ZohoAccount'][_0x38fb('0x4b')]({'where':{'id':_0x14d933[_0x38fb('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b04eb,null))[_0x38fb('0x27')](function(_0x1a656f){if(_0x1a656f){_0x1e66b4=_0x1a656f;_0x5cf154[_0x38fb('0x2f')]=_[_0x38fb('0x32')](db[_0x38fb('0x4c')][_0x38fb('0x2d')]);_0x5cf154[_0x38fb('0x31')]=_[_0x38fb('0x32')](_0x14d933[_0x38fb('0x31')]);_0x5cf154[_0x38fb('0x33')]=_['intersection'](_0x5cf154['model'],_0x5cf154[_0x38fb('0x31')]);_0x4e88cf['attributes']=_['intersection'](_0x5cf154[_0x38fb('0x2f')],qs[_0x38fb('0x35')](_0x14d933[_0x38fb('0x31')][_0x38fb('0x35')]));_0x4e88cf['attributes']=_0x4e88cf[_0x38fb('0x34')][_0x38fb('0x36')]?_0x4e88cf[_0x38fb('0x34')]:_0x5cf154[_0x38fb('0x2f')];_0x4e88cf['order']=qs[_0x38fb('0x38')](_0x14d933['query'][_0x38fb('0x38')]);_0x4e88cf[_0x38fb('0x3b')]=qs[_0x38fb('0x33')](_[_0x38fb('0x39')](_0x14d933[_0x38fb('0x31')],_0x5cf154['filters']));if(_0x14d933['query']['filter']){_0x4e88cf['where']=_[_0x38fb('0x3c')](_0x4e88cf[_0x38fb('0x3b')],{'$or':_['map'](_0x4e88cf[_0x38fb('0x34')],function(_0x28c302){var _0x49cd3b={};_0x49cd3b[_0x28c302]={'$like':'%'+_0x14d933[_0x38fb('0x31')][_0x38fb('0x3a')]+'%'};return _0x49cd3b;})});}_0x4e88cf=_[_0x38fb('0x3c')]({},_0x4e88cf,_0x14d933['options']);return _0x1e66b4[_0x38fb('0x4d')](_0x4e88cf);}})[_0x38fb('0x27')](function(_0x16f0e2){if(_0x16f0e2){_0x332780=_0x16f0e2[_0x38fb('0x36')];if(!_0x14d933[_0x38fb('0x31')][_0x38fb('0x4e')](_0x38fb('0x4f'))){_0x4e88cf['limit']=qs[_0x38fb('0x20')](_0x14d933[_0x38fb('0x31')][_0x38fb('0x20')]);_0x4e88cf['offset']=qs[_0x38fb('0x1f')](_0x14d933['query']['offset']);}return _0x1e66b4['getConfigurations'](_0x4e88cf);}})[_0x38fb('0x27')](function(_0x1dc30a){if(_0x1dc30a){return _0x1dc30a?{'count':_0x332780,'rows':_0x1dc30a}:null;}})[_0x38fb('0x27')](respondWithResult(_0x3b04eb,null))['catch'](handleError(_0x3b04eb,null));};exports[_0x38fb('0x50')]=function(_0x2f83c4,_0x3748a7,_0x4fa7eb){if(_0x2f83c4[_0x38fb('0x4a')]['id']){delete _0x2f83c4[_0x38fb('0x4a')]['id'];}return db['ZohoAccount'][_0x38fb('0x4b')]({'where':{'id':_0x2f83c4[_0x38fb('0x46')]['id']}})[_0x38fb('0x27')](handleEntityNotFound(_0x3748a7,null))['then'](function(_0x1a1d0f){if(_0x1a1d0f){_0x2f83c4[_0x38fb('0x4a')][_0x38fb('0x51')]=_0x1a1d0f['id'];_0x2f83c4[_0x38fb('0x4a')][_0x38fb('0x52')]=integrations['getSubjects'](_0x2f83c4['body'][_0x38fb('0x53')],_0x2f83c4[_0x38fb('0x4a')][_0x38fb('0x3d')]);_0x2f83c4[_0x38fb('0x4a')][_0x38fb('0x54')]=integrations[_0x38fb('0x55')](_0x2f83c4['body'][_0x38fb('0x53')],_0x2f83c4[_0x38fb('0x4a')][_0x38fb('0x3d')]);return db[_0x38fb('0x4c')][_0x38fb('0x49')](_0x2f83c4['body'],{'include':[{'model':db['ZohoField'],'as':_0x38fb('0x52')},{'model':db[_0x38fb('0x56')],'as':_0x38fb('0x54')}]});}return null;})[_0x38fb('0x27')](respondWithResult(_0x3748a7,null))[_0x38fb('0x44')](handleError(_0x3748a7,null));};function getAccessToken(_0x55def6){return new Promise(function(_0x52ec1f,_0x12f49c){var _0x5dc07e;switch(_0x55def6[_0x38fb('0x57')]){case'US':_0x5dc07e=_0x38fb('0x58');break;case'AU':_0x5dc07e=_0x38fb('0x59');break;case'EU':_0x5dc07e='https://accounts.zoho.eu';break;case'IN':_0x5dc07e=_0x38fb('0x5a');break;case'CN':_0x5dc07e=_0x38fb('0x5b');break;default:_0x5dc07e=_0x38fb('0x5c');break;}var _0x5e553d={'method':_0x38fb('0x5d'),'uri':_0x5dc07e+_0x38fb('0x5e'),'qs':{'refresh_token':_0x55def6[_0x38fb('0x5f')],'client_id':_0x55def6[_0x38fb('0x60')],'client_secret':_0x55def6[_0x38fb('0x61')],'grant_type':_0x38fb('0x62')},'json':!![]};return rp(_0x5e553d)[_0x38fb('0x27')](function(_0x300adf){if(_0x300adf[_0x38fb('0x63')]){_0x52ec1f(_0x300adf['access_token']);}else{_0x12f49c(_0x38fb('0x64'));}})['catch'](function(_0x32deba){_0x12f49c(_0x32deba);});});}exports[_0x38fb('0x65')]=function(_0xab580a,_0x572b79,_0x1f5a5c){var _0x3e947e,_0x2d48d3,_0x9022dd,_0x5cdbe1,_0x266d8f;return db[_0x38fb('0x2c')][_0x38fb('0x4b')]({'where':{'id':_0xab580a['params']['id']},'attributes':['id',_0x38fb('0x66'),_0x38fb('0x57'),_0x38fb('0x60'),_0x38fb('0x61'),_0x38fb('0x67'),_0x38fb('0x68'),'refreshToken']})[_0x38fb('0x27')](handleEntityNotFound(_0x572b79,null))[_0x38fb('0x27')](function(_0x3f7011){_0x266d8f=_0x3f7011;_0x3e947e=_0x266d8f['host'];_0x2d48d3=_0x3e947e===_0x38fb('0x69')?'eu':_0x38fb('0x6a');_0x9022dd=_0x266d8f[_0x38fb('0x67')];var _0x5da3c1=_0x9022dd[_0x38fb('0x6b')](-0x1);if(_0x5da3c1==='/'||_0x5da3c1==='\x5c'||_0x5da3c1===':'){_0x9022dd=_0x9022dd[_0x38fb('0x6c')](0x0,_0x9022dd[_0x38fb('0x6d')](_0x5da3c1));}if(!_0x266d8f[_0x38fb('0x5f')]){throw new Error(_0x38fb('0x6e'));}return getAccessToken(_0x266d8f);})[_0x38fb('0x27')](function(_0x27e3f8){if(_0x27e3f8){return rp({'method':'GET','uri':util[_0x38fb('0x6f')](_0x38fb('0x70'),_0x2d48d3),'qs':{'module':_0x38fb('0x71')},'headers':{'Authorization':_0x38fb('0x72')+_0x27e3f8},'json':!![]});}})['then'](function(_0x2f16fa){if(_0x2f16fa){if(_0x2f16fa[_0x38fb('0x73')]&&_0x2f16fa['response'][_0x38fb('0x74')]){throw new Error(_0x2f16fa[_0x38fb('0x73')][_0x38fb('0x74')]['message']);}var _0x1829c5=[];var _0xfeb2e1=[];var _0x50a39e=[_0x38fb('0x75'),_0x38fb('0x76'),_0x38fb('0x77'),_0x38fb('0x78'),'Call_Duration',_0x38fb('0x79'),_0x38fb('0x7a'),_0x38fb('0x7b')];_0xfeb2e1=_[_0x38fb('0x7c')](_0x2f16fa[_0x38fb('0x35')],function(_0x3ce7fe){return _0x50a39e[_0x38fb('0x7d')](_0x3ce7fe['api_name']);});for(var _0x34094f=0x0;_0x34094f<_0xfeb2e1[_0x38fb('0x36')];_0x34094f++){if(_0xfeb2e1[_0x34094f][_0x38fb('0x7e')]===![]){_0x1829c5['push']({'id':_0xfeb2e1[_0x34094f]['id'],'name':_0xfeb2e1[_0x34094f][_0x38fb('0x7f')],'custom':_0xfeb2e1[_0x34094f][_0x38fb('0x80')],'options':_0xfeb2e1[_0x34094f][_0x38fb('0x81')]===_0x38fb('0x82')&&_0xfeb2e1[_0x34094f][_0x38fb('0x83')][_0x38fb('0x36')]>-0x1?_[_0x38fb('0x30')](_0xfeb2e1[_0x34094f][_0x38fb('0x83')],function(_0xc34b83){return{'name':_0xc34b83,'value':_0xc34b83};}):[]});}}return{'count':_0x1829c5['length'],'rows':_0x1829c5};}else{return{'count':0x0,'rows':[]};}})[_0x38fb('0x27')](respondWithResult(_0x572b79,null))['catch'](function(_0x558a55){var _0x71e3a2=_0xab580a[_0x38fb('0x31')][_0x38fb('0x84')]?0x1f4:_0x558a55[_0x38fb('0x85')]||0x1f4;logger[_0x38fb('0x74')](_0x38fb('0x86'),'getFields',_0x71e3a2,JSON[_0x38fb('0x87')](_0x558a55));delete _0x558a55[_0x38fb('0x2a')];if(_0x71e3a2===0x191){_0x71e3a2=0x190;}_0x572b79[_0x38fb('0x1d')](_0x71e3a2)['send'](_0xab580a[_0x38fb('0x31')][_0x38fb('0x84')]?{'message':_0x38fb('0x88'),'statusCode':_0x558a55[_0x38fb('0x85')]}:_0x558a55);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3133bc9..96bd180 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 _0xd047=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','name','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.in','POST','then','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xd047,0x138));var _0x7d04=function(_0x422a33,_0x2f4561){_0x422a33=_0x422a33-0x0;var _0x45142a=_0xd047[_0x422a33];return _0x45142a;};'use strict';var _=require(_0x7d04('0x0'));var util=require(_0x7d04('0x1'));var logger=require('../../config/logger')(_0x7d04('0x2'));var moment=require(_0x7d04('0x3'));var BPromise=require(_0x7d04('0x4'));var rp=require(_0x7d04('0x5'));var fs=require('fs');var path=require(_0x7d04('0x6'));var rimraf=require(_0x7d04('0x7'));var config=require(_0x7d04('0x8'));var attributes=require(_0x7d04('0x9'));var integrations=require(_0x7d04('0xa'));module['exports']=function(_0x509c0c,_0x96db53){return _0x509c0c['define']('ZohoAccount',attributes,{'tableName':_0x7d04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x22139e,_0x569be7,_0x3997d1){if(_0x22139e['changed']('zone')||_0x22139e[_0x7d04('0xc')](_0x7d04('0xd'))||_0x22139e[_0x7d04('0xc')](_0x7d04('0xe'))||_0x22139e[_0x7d04('0xc')](_0x7d04('0xf'))||_0x22139e[_0x7d04('0xc')](_0x7d04('0x10'))||_0x22139e['changed'](_0x7d04('0x11'))){var _0x5d1220,_0x4e85d4;_0x5d1220=_0x22139e[_0x7d04('0xd')];var _0xb19690=_0x5d1220[_0x7d04('0x12')](-0x1);if(_0xb19690==='/'||_0xb19690==='\x5c'||_0xb19690===':'){_0x5d1220=_0x5d1220[_0x7d04('0x13')](0x0,_0x5d1220[_0x7d04('0x14')](_0xb19690));}switch(_0x22139e[_0x7d04('0x15')]){case'US':_0x4e85d4=_0x7d04('0x16');break;case'AU':_0x4e85d4=_0x7d04('0x17');break;case'IN':_0x4e85d4='https://accounts.zoho.in';break;case'CN':_0x4e85d4=_0x7d04('0x18');break;default:_0x4e85d4=_0x7d04('0x19');break;}var _0x3960af={'method':'POST','uri':_0x4e85d4+_0x7d04('0x1a'),'form':{'grant_type':_0x7d04('0x1b'),'client_id':_0x22139e[_0x7d04('0xe')],'client_secret':_0x22139e[_0x7d04('0xf')],'redirect_uri':_0x22139e[_0x7d04('0xd')],'code':_0x22139e[_0x7d04('0x10')]},'headers':{'Content-Type':_0x7d04('0x1c')}};return rp(_0x3960af)['then'](function(_0x470adc){var _0x4587d2=JSON[_0x7d04('0x1d')](_0x470adc);if(_0x4587d2[_0x7d04('0x1e')]){_0x22139e[_0x7d04('0x1f')]=_0x4587d2[_0x7d04('0x1e')];logger[_0x7d04('0x20')](util[_0x7d04('0x21')](_0x7d04('0x22'),_0x22139e['name'],_0x22139e['id']));}else{logger[_0x7d04('0x23')](util[_0x7d04('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x22139e[_0x7d04('0x24')],_0x22139e['id']),util[_0x7d04('0x25')](_0x4587d2,{'showHidden':![],'depth':null}));}return _0x3997d1(null,_0x569be7);})[_0x7d04('0x26')](function(_0x11b5f3){logger[_0x7d04('0x23')](util['format'](_0x7d04('0x27'),_0x22139e['name'],_0x22139e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3997d1(_0x11b5f3);});}else{return _0x3997d1(null,_0x569be7);}},'beforeUpdate':function(_0x1e8354,_0x224981,_0x2b470d){if(_0x1e8354[_0x7d04('0xc')]('zone')||_0x1e8354['changed'](_0x7d04('0xd'))||_0x1e8354[_0x7d04('0xc')]('clientId')||_0x1e8354['changed'](_0x7d04('0xf'))||_0x1e8354[_0x7d04('0xc')]('code')||_0x1e8354['changed'](_0x7d04('0x11'))){var _0x504369,_0x5a8aa2;_0x504369=_0x1e8354['serverUrl'];var _0x3b0ae6=_0x504369['slice'](-0x1);if(_0x3b0ae6==='/'||_0x3b0ae6==='\x5c'||_0x3b0ae6===':'){_0x504369=_0x504369[_0x7d04('0x13')](0x0,_0x504369[_0x7d04('0x14')](_0x3b0ae6));}switch(_0x1e8354[_0x7d04('0x15')]){case'US':_0x5a8aa2=_0x7d04('0x16');break;case'AU':_0x5a8aa2='https://accounts.zoho.com.au';break;case'IN':_0x5a8aa2=_0x7d04('0x28');break;case'CN':_0x5a8aa2=_0x7d04('0x18');break;default:_0x5a8aa2=_0x7d04('0x19');break;}var _0x69dd54={'method':_0x7d04('0x29'),'uri':_0x5a8aa2+'/oauth/v2/token','form':{'grant_type':_0x7d04('0x1b'),'client_id':_0x1e8354[_0x7d04('0xe')],'client_secret':_0x1e8354[_0x7d04('0xf')],'redirect_uri':_0x1e8354[_0x7d04('0xd')],'code':_0x1e8354['code']},'headers':{'Content-Type':_0x7d04('0x1c')}};return rp(_0x69dd54)[_0x7d04('0x2a')](function(_0x555cc9){var _0x3f5463=JSON[_0x7d04('0x1d')](_0x555cc9);if(_0x3f5463[_0x7d04('0x1e')]){_0x1e8354[_0x7d04('0x1f')]=_0x3f5463[_0x7d04('0x1e')];logger['info'](util[_0x7d04('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1e8354[_0x7d04('0x24')],_0x1e8354['id']));}else{logger[_0x7d04('0x23')](util[_0x7d04('0x21')](_0x7d04('0x27'),_0x1e8354[_0x7d04('0x24')],_0x1e8354['id']),util[_0x7d04('0x25')](_0x3f5463,{'showHidden':![],'depth':null}));}return _0x2b470d(null,_0x224981);})[_0x7d04('0x26')](function(_0x362e24){logger[_0x7d04('0x23')](util[_0x7d04('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1e8354['name'],_0x1e8354['id']),util[_0x7d04('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2b470d(_0x362e24);});}else{return _0x2b470d(null,_0x224981);}}}});}; \ No newline at end of file +var _0x6167=['info','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','authorization_code','then','parse','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','refresh_token'];(function(_0x30475b,_0xf0285c){var _0x39345a=function(_0x3e35c5){while(--_0x3e35c5){_0x30475b['push'](_0x30475b['shift']());}};_0x39345a(++_0xf0285c);}(_0x6167,0x12e));var _0x7616=function(_0x33ff38,_0x2ec059){_0x33ff38=_0x33ff38-0x0;var _0xb32b75=_0x6167[_0x33ff38];return _0xb32b75;};'use strict';var _=require(_0x7616('0x0'));var util=require('util');var logger=require(_0x7616('0x1'))(_0x7616('0x2'));var moment=require('moment');var BPromise=require(_0x7616('0x3'));var rp=require(_0x7616('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7616('0x5'));var config=require(_0x7616('0x6'));var attributes=require(_0x7616('0x7'));var integrations=require(_0x7616('0x8'));module[_0x7616('0x9')]=function(_0x1608f3,_0x1d7d5c){return _0x1608f3[_0x7616('0xa')]('ZohoAccount',attributes,{'tableName':_0x7616('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x327150,_0x5e51d5,_0x5eeee0){if(_0x327150['changed'](_0x7616('0xc'))||_0x327150[_0x7616('0xd')](_0x7616('0xe'))||_0x327150[_0x7616('0xd')](_0x7616('0xf'))||_0x327150['changed'](_0x7616('0x10'))||_0x327150['changed'](_0x7616('0x11'))||_0x327150[_0x7616('0xd')](_0x7616('0x12'))){var _0x208394,_0x38bbd4;_0x208394=_0x327150[_0x7616('0xe')];var _0x31b320=_0x208394[_0x7616('0x13')](-0x1);if(_0x31b320==='/'||_0x31b320==='\x5c'||_0x31b320===':'){_0x208394=_0x208394[_0x7616('0x14')](0x0,_0x208394[_0x7616('0x15')](_0x31b320));}switch(_0x327150[_0x7616('0xc')]){case'US':_0x38bbd4=_0x7616('0x16');break;case'AU':_0x38bbd4=_0x7616('0x17');break;case'IN':_0x38bbd4='https://accounts.zoho.in';break;case'CN':_0x38bbd4=_0x7616('0x18');break;default:_0x38bbd4='https://accounts.zoho.eu';break;}var _0x49d831={'method':'POST','uri':_0x38bbd4+'/oauth/v2/token','form':{'grant_type':_0x7616('0x19'),'client_id':_0x327150[_0x7616('0xf')],'client_secret':_0x327150[_0x7616('0x10')],'redirect_uri':_0x327150['serverUrl'],'code':_0x327150[_0x7616('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x49d831)[_0x7616('0x1a')](function(_0x55dd8a){var _0x507058=JSON[_0x7616('0x1b')](_0x55dd8a);if(_0x507058['refresh_token']){_0x327150[_0x7616('0x1c')]=_0x507058['refresh_token'];logger['info'](util[_0x7616('0x1d')](_0x7616('0x1e'),_0x327150['name'],_0x327150['id']));}else{logger['error'](util[_0x7616('0x1d')](_0x7616('0x1f'),_0x327150[_0x7616('0x20')],_0x327150['id']),util[_0x7616('0x21')](_0x507058,{'showHidden':![],'depth':null}));}return _0x5eeee0(null,_0x5e51d5);})[_0x7616('0x22')](function(_0xf181c0){logger[_0x7616('0x23')](util[_0x7616('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x327150['name'],_0x327150['id']),util[_0x7616('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x5eeee0(_0xf181c0);});}else{return _0x5eeee0(null,_0x5e51d5);}},'beforeUpdate':function(_0x3e724f,_0x2c51ea,_0x582749){if(_0x3e724f['changed']('zone')||_0x3e724f['changed'](_0x7616('0xe'))||_0x3e724f['changed']('clientId')||_0x3e724f[_0x7616('0xd')](_0x7616('0x10'))||_0x3e724f['changed']('code')||_0x3e724f[_0x7616('0xd')](_0x7616('0x12'))){var _0x172d8d,_0x375449;_0x172d8d=_0x3e724f['serverUrl'];var _0x343490=_0x172d8d[_0x7616('0x13')](-0x1);if(_0x343490==='/'||_0x343490==='\x5c'||_0x343490===':'){_0x172d8d=_0x172d8d[_0x7616('0x14')](0x0,_0x172d8d[_0x7616('0x15')](_0x343490));}switch(_0x3e724f['zone']){case'US':_0x375449=_0x7616('0x16');break;case'AU':_0x375449=_0x7616('0x17');break;case'IN':_0x375449=_0x7616('0x24');break;case'CN':_0x375449=_0x7616('0x18');break;default:_0x375449=_0x7616('0x25');break;}var _0x52fc95={'method':_0x7616('0x26'),'uri':_0x375449+_0x7616('0x27'),'form':{'grant_type':'authorization_code','client_id':_0x3e724f[_0x7616('0xf')],'client_secret':_0x3e724f[_0x7616('0x10')],'redirect_uri':_0x3e724f['serverUrl'],'code':_0x3e724f[_0x7616('0x11')]},'headers':{'Content-Type':_0x7616('0x28')}};return rp(_0x52fc95)[_0x7616('0x1a')](function(_0x426bad){var _0x17424f=JSON[_0x7616('0x1b')](_0x426bad);if(_0x17424f[_0x7616('0x29')]){_0x3e724f[_0x7616('0x1c')]=_0x17424f[_0x7616('0x29')];logger[_0x7616('0x2a')](util['format'](_0x7616('0x1e'),_0x3e724f[_0x7616('0x20')],_0x3e724f['id']));}else{logger['error'](util[_0x7616('0x1d')](_0x7616('0x1f'),_0x3e724f['name'],_0x3e724f['id']),util[_0x7616('0x21')](_0x17424f,{'showHidden':![],'depth':null}));}return _0x582749(null,_0x2c51ea);})[_0x7616('0x22')](function(_0x5b41d1){logger[_0x7616('0x23')](util['format'](_0x7616('0x1f'),_0x3e724f[_0x7616('0x20')],_0x3e724f['id']),util[_0x7616('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x582749(_0x5b41d1);});}else{return _0x582749(null,_0x2c51ea);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3ceb115..c2ee410 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 _0xe35d=['error','message','request\x20sent','catch','GetZohoAccount','options','raw','where','attributes','map','model','include','then','ShowZohoAccount','ZohoAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1adb39,_0x5b4648){var _0x4d53dc=function(_0x1dd645){while(--_0x1dd645){_0x1adb39['push'](_0x1adb39['shift']());}};_0x4d53dc(++_0x5b4648);}(_0xe35d,0xd5));var _0xde35=function(_0x2117d3,_0x2adb54){_0x2117d3=_0x2117d3-0x0;var _0x478416=_0xe35d[_0x2117d3];return _0x478416;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xde35('0x2'));var fs=require('fs');var Redis=require(_0xde35('0x3'));var db=require(_0xde35('0x4'))['db'];var utils=require(_0xde35('0x5'));var logger=require(_0xde35('0x6'))(_0xde35('0x7'));var config=require(_0xde35('0x8'));var jayson=require(_0xde35('0x9'));var client=jayson[_0xde35('0xa')][_0xde35('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57c5a7,_0x1f0541,_0xe542e){return new BPromise(function(_0x3200e1,_0x25c8a1){return client[_0xde35('0xc')](_0x57c5a7,_0xe542e)['then'](function(_0xa3af60){logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,'request\x20sent');logger[_0xde35('0xf')](_0xde35('0x10'),_0x1f0541,'request\x20sent',JSON[_0xde35('0x11')](_0xa3af60));if(_0xa3af60['error']){if(_0xa3af60[_0xde35('0x12')]['code']===0x1f4){logger[_0xde35('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x1f0541,_0xa3af60['error']['message']);return _0x25c8a1(_0xa3af60['error']['message']);}logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0xa3af60['error']['message']);return _0x3200e1(_0xa3af60[_0xde35('0x12')][_0xde35('0x13')]);}else{logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,_0xde35('0x14'));_0x3200e1(_0xa3af60['result'][_0xde35('0x13')]);}})[_0xde35('0x15')](function(_0x274de6){logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0x274de6);_0x25c8a1(_0x274de6);});});}exports[_0xde35('0x16')]=function(_0x19ec9e){var _0x5a90de=this;return new Promise(function(_0x3c912a,_0x4e8874){return db['ZohoAccount']['findAll']({'raw':_0x19ec9e[_0xde35('0x17')]?_0x19ec9e['options'][_0xde35('0x18')]===undefined?!![]:![]:!![],'where':_0x19ec9e[_0xde35('0x17')]?_0x19ec9e[_0xde35('0x17')][_0xde35('0x19')]||null:null,'attributes':_0x19ec9e[_0xde35('0x17')]?_0x19ec9e[_0xde35('0x17')][_0xde35('0x1a')]||null:null,'limit':_0x19ec9e[_0xde35('0x17')]?_0x19ec9e[_0xde35('0x17')]['limit']||null:null,'include':_0x19ec9e['options']?_0x19ec9e[_0xde35('0x17')]['include']?_[_0xde35('0x1b')](_0x19ec9e[_0xde35('0x17')]['include'],function(_0x13ff99){return{'model':db[_0x13ff99[_0xde35('0x1c')]],'as':_0x13ff99['as'],'attributes':_0x13ff99[_0xde35('0x1a')],'include':_0x13ff99['include']?_[_0xde35('0x1b')](_0x13ff99[_0xde35('0x1d')],function(_0x740ab8){return{'model':db[_0x740ab8[_0xde35('0x1c')]],'as':_0x740ab8['as'],'attributes':_0x740ab8[_0xde35('0x1a')],'include':_0x740ab8[_0xde35('0x1d')]?_[_0xde35('0x1b')](_0x740ab8[_0xde35('0x1d')],function(_0x31a61d){return{'model':db[_0x31a61d['model']],'as':_0x31a61d['as'],'attributes':_0x31a61d[_0xde35('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xde35('0x1e')](function(_0x157a70){logger[_0xde35('0xd')]('GetZohoAccount',_0x19ec9e);logger[_0xde35('0xf')](_0xde35('0x16'),_0x19ec9e,JSON[_0xde35('0x11')](_0x157a70));_0x3c912a(_0x157a70);})[_0xde35('0x15')](function(_0x459d29){logger[_0xde35('0x12')](_0xde35('0x16'),_0x459d29['message'],_0x19ec9e);_0x4e8874(_0x5a90de[_0xde35('0x12')](0x1f4,_0x459d29[_0xde35('0x13')]));});});};exports[_0xde35('0x1f')]=function(_0x13d00f){var _0x2ffa7b=this;return new Promise(function(_0x3f8609,_0x23014b){return db[_0xde35('0x20')]['find']({'raw':_0x13d00f[_0xde35('0x17')]?_0x13d00f[_0xde35('0x17')][_0xde35('0x18')]===undefined?!![]:![]:!![],'where':_0x13d00f[_0xde35('0x17')]?_0x13d00f['options']['where']||null:null,'attributes':_0x13d00f[_0xde35('0x17')]?_0x13d00f[_0xde35('0x17')][_0xde35('0x1a')]||null:null,'include':_0x13d00f['options']?_0x13d00f[_0xde35('0x17')][_0xde35('0x1d')]?_[_0xde35('0x1b')](_0x13d00f[_0xde35('0x17')][_0xde35('0x1d')],function(_0x5de9d2){return{'model':db[_0x5de9d2[_0xde35('0x1c')]],'as':_0x5de9d2['as'],'attributes':_0x5de9d2[_0xde35('0x1a')],'include':_0x5de9d2['include']?_[_0xde35('0x1b')](_0x5de9d2[_0xde35('0x1d')],function(_0x33ae79){return{'model':db[_0x33ae79[_0xde35('0x1c')]],'as':_0x33ae79['as'],'attributes':_0x33ae79[_0xde35('0x1a')],'include':_0x33ae79[_0xde35('0x1d')]?_['map'](_0x33ae79['include'],function(_0x140f7b){return{'model':db[_0x140f7b[_0xde35('0x1c')]],'as':_0x140f7b['as'],'attributes':_0x140f7b[_0xde35('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f6f52){logger[_0xde35('0xd')]('ShowZohoAccount',_0x13d00f);logger[_0xde35('0xf')](_0xde35('0x1f'),_0x13d00f,JSON[_0xde35('0x11')](_0x2f6f52));_0x3f8609(_0x2f6f52);})['catch'](function(_0x327e9d){logger[_0xde35('0x12')](_0xde35('0x1f'),_0x327e9d[_0xde35('0x13')],_0x13d00f);_0x23014b(_0x2ffa7b[_0xde35('0x12')](0x1f4,_0x327e9d[_0xde35('0x13')]));});});}; \ No newline at end of file +var _0x9582=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','ZohoAccount','options','raw','limit','include','map','model','attributes','then','GetZohoAccount','ShowZohoAccount','find'];(function(_0x24b609,_0x3a1d9f){var _0x26dbf6=function(_0xf505d0){while(--_0xf505d0){_0x24b609['push'](_0x24b609['shift']());}};_0x26dbf6(++_0x3a1d9f);}(_0x9582,0x95));var _0x2958=function(_0x2f6b46,_0x1209cf){_0x2f6b46=_0x2f6b46-0x0;var _0x2c6243=_0x9582[_0x2f6b46];return _0x2c6243;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309525,_0xa385ec,_0x2e571b){return new BPromise(function(_0x56ca85,_0x5ec1b3){return client[_0x2958('0xd')](_0x309525,_0x2e571b)['then'](function(_0x10db1e){logger['info'](_0x2958('0xe'),_0xa385ec,'request\x20sent');logger[_0x2958('0xf')](_0x2958('0x10'),_0xa385ec,_0x2958('0x11'),JSON[_0x2958('0x12')](_0x10db1e));if(_0x10db1e[_0x2958('0x13')]){if(_0x10db1e['error'][_0x2958('0x14')]===0x1f4){logger[_0x2958('0x13')](_0x2958('0xe'),_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x5ec1b3(_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);}logger[_0x2958('0x13')]('ZohoAccount,\x20%s,\x20%s',_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x56ca85(_0x10db1e['error']['message']);}else{logger[_0x2958('0x16')](_0x2958('0xe'),_0xa385ec,'request\x20sent');_0x56ca85(_0x10db1e[_0x2958('0x17')]['message']);}})['catch'](function(_0x429d42){logger[_0x2958('0x13')]('ZohoAccount,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});}exports['GetZohoAccount']=function(_0x28a92c){var _0x160949=this;return new Promise(function(_0x310d07,_0x42bb99){return db[_0x2958('0x18')]['findAll']({'raw':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1a')]===undefined?!![]:![]:!![],'where':_0x28a92c['options']?_0x28a92c[_0x2958('0x19')]['where']||null:null,'attributes':_0x28a92c[_0x2958('0x19')]?_0x28a92c['options']['attributes']||null:null,'limit':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1b')]||null:null,'include':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x28a92c[_0x2958('0x19')][_0x2958('0x1c')],function(_0x2aa514){return{'model':db[_0x2aa514[_0x2958('0x1e')]],'as':_0x2aa514['as'],'attributes':_0x2aa514[_0x2958('0x1f')],'include':_0x2aa514[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x2aa514[_0x2958('0x1c')],function(_0x4f811a){return{'model':db[_0x4f811a['model']],'as':_0x4f811a['as'],'attributes':_0x4f811a[_0x2958('0x1f')],'include':_0x4f811a[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x4f811a[_0x2958('0x1c')],function(_0x52bd32){return{'model':db[_0x52bd32[_0x2958('0x1e')]],'as':_0x52bd32['as'],'attributes':_0x52bd32['attributes']};}):[]};}):[]};}):[]:[]})[_0x2958('0x20')](function(_0x40adce){logger[_0x2958('0x16')](_0x2958('0x21'),_0x28a92c);logger[_0x2958('0xf')](_0x2958('0x21'),_0x28a92c,JSON[_0x2958('0x12')](_0x40adce));_0x310d07(_0x40adce);})['catch'](function(_0x21b919){logger['error']('GetZohoAccount',_0x21b919[_0x2958('0x15')],_0x28a92c);_0x42bb99(_0x160949[_0x2958('0x13')](0x1f4,_0x21b919[_0x2958('0x15')]));});});};exports[_0x2958('0x22')]=function(_0x584179){var _0x2d9472=this;return new Promise(function(_0x222b83,_0x2c73e9){return db['ZohoAccount'][_0x2958('0x23')]({'raw':_0x584179[_0x2958('0x19')]?_0x584179['options'][_0x2958('0x1a')]===undefined?!![]:![]:!![],'where':_0x584179['options']?_0x584179[_0x2958('0x19')]['where']||null:null,'attributes':_0x584179[_0x2958('0x19')]?_0x584179['options'][_0x2958('0x1f')]||null:null,'include':_0x584179[_0x2958('0x19')]?_0x584179[_0x2958('0x19')][_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x584179[_0x2958('0x19')][_0x2958('0x1c')],function(_0x58f9b4){return{'model':db[_0x58f9b4[_0x2958('0x1e')]],'as':_0x58f9b4['as'],'attributes':_0x58f9b4['attributes'],'include':_0x58f9b4[_0x2958('0x1c')]?_['map'](_0x58f9b4[_0x2958('0x1c')],function(_0x517f55){return{'model':db[_0x517f55[_0x2958('0x1e')]],'as':_0x517f55['as'],'attributes':_0x517f55[_0x2958('0x1f')],'include':_0x517f55[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x517f55[_0x2958('0x1c')],function(_0x24aca5){return{'model':db[_0x24aca5[_0x2958('0x1e')]],'as':_0x24aca5['as'],'attributes':_0x24aca5[_0x2958('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2958('0x20')](function(_0xc4a303){logger[_0x2958('0x16')](_0x2958('0x22'),_0x584179);logger[_0x2958('0xf')]('ShowZohoAccount',_0x584179,JSON[_0x2958('0x12')](_0xc4a303));_0x222b83(_0xc4a303);})[_0x2958('0x24')](function(_0x281817){logger[_0x2958('0x13')]('ShowZohoAccount',_0x281817[_0x2958('0x15')],_0x584179);_0x2c73e9(_0x2d9472[_0x2958('0x13')](0x1f4,_0x281817[_0x2958('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2b2b5e2..88773d7 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 _0xdfaa=['create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','post'];(function(_0x50b376,_0x445263){var _0x4e5413=function(_0x4f03e4){while(--_0x4f03e4){_0x50b376['push'](_0x50b376['shift']());}};_0x4e5413(++_0x445263);}(_0xdfaa,0xae));var _0xadfa=function(_0x2e2be0,_0x2d77b6){_0x2e2be0=_0x2e2be0-0x0;var _0xdd49c4=_0xdfaa[_0x2e2be0];return _0xdd49c4;};'use strict';var multer=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var path=require('path');var timeout=require(_0xadfa('0x2'));var express=require('express');var router=express[_0xadfa('0x3')]();var fs_extra=require(_0xadfa('0x4'));var auth=require(_0xadfa('0x5'));var interaction=require(_0xadfa('0x6'));var config=require(_0xadfa('0x7'));var controller=require(_0xadfa('0x8'));router['get']('/',auth[_0xadfa('0x9')](),controller[_0xadfa('0xa')]);router[_0xadfa('0xb')]('/:id',auth[_0xadfa('0x9')](),controller[_0xadfa('0xc')]);router['get'](_0xadfa('0xd'),auth[_0xadfa('0x9')](),controller[_0xadfa('0xe')]);router[_0xadfa('0xb')](_0xadfa('0xf'),auth['isAuthenticated'](),controller[_0xadfa('0x10')]);router[_0xadfa('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xadfa('0x11')]('/',auth['isAuthenticated'](),controller[_0xadfa('0x12')]);router[_0xadfa('0x13')](_0xadfa('0x14'),auth[_0xadfa('0x9')](),controller['update']);router[_0xadfa('0x15')](_0xadfa('0x14'),auth['isAuthenticated'](),controller[_0xadfa('0x16')]);module[_0xadfa('0x17')]=router; \ No newline at end of file +var _0x964e=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x418432,_0x537680){var _0x3023a9=function(_0x1c42d0){while(--_0x1c42d0){_0x418432['push'](_0x418432['shift']());}};_0x3023a9(++_0x537680);}(_0x964e,0xfb));var _0xe964=function(_0x2d397c,_0x26b969){_0x2d397c=_0x2d397c-0x0;var _0x2171db=_0x964e[_0x2d397c];return _0x2171db;};'use strict';var multer=require(_0xe964('0x0'));var util=require(_0xe964('0x1'));var path=require('path');var timeout=require(_0xe964('0x2'));var express=require('express');var router=express[_0xe964('0x3')]();var fs_extra=require(_0xe964('0x4'));var auth=require(_0xe964('0x5'));var interaction=require(_0xe964('0x6'));var config=require(_0xe964('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xe964('0x8')]('/',auth[_0xe964('0x9')](),controller[_0xe964('0xa')]);router[_0xe964('0x8')](_0xe964('0xb'),auth[_0xe964('0x9')](),controller[_0xe964('0xc')]);router['get'](_0xe964('0xd'),auth[_0xe964('0x9')](),controller[_0xe964('0xe')]);router['get'](_0xe964('0xf'),auth[_0xe964('0x9')](),controller[_0xe964('0x10')]);router['get'](_0xe964('0x11'),auth[_0xe964('0x9')](),controller[_0xe964('0x12')]);router[_0xe964('0x13')]('/',auth['isAuthenticated'](),controller[_0xe964('0x14')]);router[_0xe964('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe964('0x16')]);router[_0xe964('0x17')]('/:id',auth[_0xe964('0x9')](),controller[_0xe964('0x18')]);module[_0xe964('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index df1adc8..9ee336a 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 _0xcc37=['STRING','lead','contact','nothing','ENUM','contact_lead','exports'];(function(_0x5a0318,_0x25f472){var _0x120b82=function(_0x2f313f){while(--_0x2f313f){_0x5a0318['push'](_0x5a0318['shift']());}};_0x120b82(++_0x25f472);}(_0xcc37,0xa7));var _0x7cc3=function(_0x5d5cb0,_0x21e34b){_0x5d5cb0=_0x5d5cb0-0x0;var _0xe286e6=_0xcc37[_0x5d5cb0];return _0xe286e6;};'use strict';var Sequelize=require('sequelize');module[_0x7cc3('0x0')]={'name':{'type':Sequelize[_0x7cc3('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x7cc3('0x2'),_0x7cc3('0x3'),_0x7cc3('0x4')),'defaultValue':_0x7cc3('0x2')},'moduleSearch':{'type':Sequelize[_0x7cc3('0x5')](_0x7cc3('0x6'),'contact',_0x7cc3('0x2')),'defaultValue':_0x7cc3('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3eee=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x229d39,_0x52ffbd){var _0x282743=function(_0x1252cb){while(--_0x1252cb){_0x229d39['push'](_0x229d39['shift']());}};_0x282743(++_0x52ffbd);}(_0x3eee,0x101));var _0xe3ee=function(_0x281a9d,_0x7b3522){_0x281a9d=_0x281a9d-0x0;var _0x4a7c4b=_0x3eee[_0x281a9d];return _0x4a7c4b;};'use strict';var Sequelize=require('sequelize');module[_0xe3ee('0x0')]={'name':{'type':Sequelize[_0xe3ee('0x1')]},'moduleCreate':{'type':Sequelize[_0xe3ee('0x2')](_0xe3ee('0x3'),_0xe3ee('0x4'),_0xe3ee('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe3ee('0x2')](_0xe3ee('0x6'),_0xe3ee('0x4'),_0xe3ee('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe3ee('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index fa23a3d..9d5679b 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 _0xb994=['save','update','then','destroy','end','stack','name','status','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type','ZohoConfiguration','include','rows','catch','show','params','merge','find','create','body','getFields','ZohoField','order','options','getSubjects','findOne','nolimit','getDescriptions','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0xb994,0xc7));var _0x4b99=function(_0x23e8b0,_0x48e311){_0x23e8b0=_0x23e8b0-0x0;var _0x517a11=_0xb994[_0x23e8b0];return _0x517a11;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4b99('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b99('0x1'));var moment=require(_0x4b99('0x2'));var BPromise=require(_0x4b99('0x3'));var Mustache=require('mustache');var util=require(_0x4b99('0x4'));var path=require(_0x4b99('0x5'));var sox=require('sox');var csv=require(_0x4b99('0x6'));var ejs=require(_0x4b99('0x7'));var fs=require('fs');var fs_extra=require(_0x4b99('0x8'));var _=require(_0x4b99('0x9'));var squel=require(_0x4b99('0xa'));var crypto=require(_0x4b99('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b99('0xc'));var toCsv=require(_0x4b99('0x6'));var querystring=require(_0x4b99('0xd'));var Papa=require(_0x4b99('0xe'));var Redis=require(_0x4b99('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4b99('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b99('0x11'))(_0x4b99('0x12'));var utils=require('../../config/utils');var config=require(_0x4b99('0x13'));var licenseUtil=require(_0x4b99('0x14'));var db=require(_0x4b99('0x15'))['db'];function respondWithStatusCode(_0x528f41,_0x2d4799){_0x2d4799=_0x2d4799||0xcc;return function(_0x103270){if(_0x103270){return _0x528f41[_0x4b99('0x16')](_0x2d4799);}return _0x528f41['status'](_0x2d4799)['end']();};}function respondWithResult(_0x274cc4,_0x528720){_0x528720=_0x528720||0xc8;return function(_0x3092e0){if(_0x3092e0){return _0x274cc4['status'](_0x528720)[_0x4b99('0x17')](_0x3092e0);}};}function respondWithFilteredResult(_0x4822ad,_0x387374){return function(_0x469f62){if(_0x469f62){var _0x26ee9c=typeof _0x387374[_0x4b99('0x18')]===_0x4b99('0x19')&&typeof _0x387374[_0x4b99('0x1a')]===_0x4b99('0x19');var _0x37a304=_0x469f62[_0x4b99('0x1b')];var _0x229f87=_0x26ee9c?0x0:_0x387374['offset'];var _0x228cad=_0x26ee9c?_0x469f62[_0x4b99('0x1b')]:_0x387374[_0x4b99('0x18')]+_0x387374[_0x4b99('0x1a')];var _0x1e85ed;if(_0x228cad>=_0x37a304){_0x228cad=_0x37a304;_0x1e85ed=0xc8;}else{_0x1e85ed=0xce;}_0x4822ad['status'](_0x1e85ed);return _0x4822ad[_0x4b99('0x1c')](_0x4b99('0x1d'),_0x229f87+'-'+_0x228cad+'/'+_0x37a304)[_0x4b99('0x17')](_0x469f62);}return null;};}function patchUpdates(_0x28476a){return function(_0x15c2e6){try{jsonpatch[_0x4b99('0x1e')](_0x15c2e6,_0x28476a,!![]);}catch(_0x1e226a){return BPromise[_0x4b99('0x1f')](_0x1e226a);}return _0x15c2e6[_0x4b99('0x20')]();};}function saveUpdates(_0x14d7f2,_0x91ab11){return function(_0x464d81){if(_0x464d81){return _0x464d81[_0x4b99('0x21')](_0x14d7f2)[_0x4b99('0x22')](function(_0x25a821){return _0x25a821;});}return null;};}function removeEntity(_0x29e172,_0x2039ee){return function(_0x458d93){if(_0x458d93){return _0x458d93[_0x4b99('0x23')]()[_0x4b99('0x22')](function(){_0x29e172['status'](0xcc)[_0x4b99('0x24')]();});}};}function handleEntityNotFound(_0x1376c2,_0xe06ecc){return function(_0x364bac){if(!_0x364bac){_0x1376c2[_0x4b99('0x16')](0x194);}return _0x364bac;};}function handleError(_0x1d1486,_0x1dd9b0){_0x1dd9b0=_0x1dd9b0||0x1f4;return function(_0x2940b3){logger['error'](_0x2940b3[_0x4b99('0x25')]);if(_0x2940b3[_0x4b99('0x26')]){delete _0x2940b3[_0x4b99('0x26')];}_0x1d1486[_0x4b99('0x27')](_0x1dd9b0)[_0x4b99('0x28')](_0x2940b3);};}exports[_0x4b99('0x29')]=function(_0x5e56d0,_0x18f107){var _0x19f659={},_0x1de508={},_0x2e7805={'count':0x0,'rows':[]};var _0x359a33=_[_0x4b99('0x2a')](db['ZohoConfiguration'][_0x4b99('0x2b')],function(_0x736583){return{'name':_0x736583['fieldName'],'type':_0x736583['type'][_0x4b99('0x2c')]};});_0x1de508[_0x4b99('0x2d')]=_[_0x4b99('0x2a')](_0x359a33,_0x4b99('0x26'));_0x1de508[_0x4b99('0x2e')]=_[_0x4b99('0x2f')](_0x5e56d0[_0x4b99('0x2e')]);_0x1de508[_0x4b99('0x30')]=_[_0x4b99('0x31')](_0x1de508[_0x4b99('0x2d')],_0x1de508[_0x4b99('0x2e')]);_0x19f659[_0x4b99('0x32')]=_['intersection'](_0x1de508[_0x4b99('0x2d')],qs[_0x4b99('0x33')](_0x5e56d0['query'][_0x4b99('0x33')]));_0x19f659[_0x4b99('0x32')]=_0x19f659[_0x4b99('0x32')][_0x4b99('0x34')]?_0x19f659[_0x4b99('0x32')]:_0x1de508[_0x4b99('0x2d')];if(!_0x5e56d0['query'][_0x4b99('0x35')]('nolimit')){_0x19f659[_0x4b99('0x1a')]=qs['limit'](_0x5e56d0['query']['limit']);_0x19f659['offset']=qs['offset'](_0x5e56d0[_0x4b99('0x2e')][_0x4b99('0x18')]);}_0x19f659['order']=qs[_0x4b99('0x36')](_0x5e56d0[_0x4b99('0x2e')]['sort']);_0x19f659['where']=qs['filters'](_[_0x4b99('0x37')](_0x5e56d0[_0x4b99('0x2e')],_0x1de508[_0x4b99('0x30')]),_0x359a33);if(_0x5e56d0[_0x4b99('0x2e')][_0x4b99('0x38')]){_0x19f659['where']=_['merge'](_0x19f659[_0x4b99('0x39')],{'$or':_[_0x4b99('0x2a')](_0x359a33,function(_0x318cc3){if(_0x318cc3[_0x4b99('0x3a')]!=='VIRTUAL'){var _0x27433f={};_0x27433f[_0x318cc3[_0x4b99('0x26')]]={'$like':'%'+_0x5e56d0['query'][_0x4b99('0x38')]+'%'};return _0x27433f;}})});}_0x19f659=_['merge']({},_0x19f659,_0x5e56d0['options']);var _0x57660d={'where':_0x19f659['where']};return db[_0x4b99('0x3b')][_0x4b99('0x1b')](_0x57660d)[_0x4b99('0x22')](function(_0x3f9c78){_0x2e7805[_0x4b99('0x1b')]=_0x3f9c78;if(_0x5e56d0[_0x4b99('0x2e')]['includeAll']){_0x19f659[_0x4b99('0x3c')]=[{'all':!![]}];}return db[_0x4b99('0x3b')]['findAll'](_0x19f659);})['then'](function(_0xe9f765){_0x2e7805[_0x4b99('0x3d')]=_0xe9f765;return _0x2e7805;})[_0x4b99('0x22')](respondWithFilteredResult(_0x18f107,_0x19f659))[_0x4b99('0x3e')](handleError(_0x18f107,null));};exports[_0x4b99('0x3f')]=function(_0xee4ac2,_0xe06b5){var _0x4e31cb={'raw':![],'where':{'id':_0xee4ac2[_0x4b99('0x40')]['id']}},_0x2de05f={};_0x2de05f[_0x4b99('0x2d')]=_[_0x4b99('0x2f')](db[_0x4b99('0x3b')]['rawAttributes']);_0x2de05f[_0x4b99('0x2e')]=_[_0x4b99('0x2f')](_0xee4ac2[_0x4b99('0x2e')]);_0x2de05f[_0x4b99('0x30')]=_[_0x4b99('0x31')](_0x2de05f[_0x4b99('0x2d')],_0x2de05f[_0x4b99('0x2e')]);_0x4e31cb['attributes']=_[_0x4b99('0x31')](_0x2de05f[_0x4b99('0x2d')],qs[_0x4b99('0x33')](_0xee4ac2[_0x4b99('0x2e')]['fields']));_0x4e31cb[_0x4b99('0x32')]=_0x4e31cb[_0x4b99('0x32')][_0x4b99('0x34')]?_0x4e31cb[_0x4b99('0x32')]:_0x2de05f[_0x4b99('0x2d')];if(_0xee4ac2[_0x4b99('0x2e')]['includeAll']){_0x4e31cb['include']=[{'all':!![]}];}_0x4e31cb=_[_0x4b99('0x41')]({},_0x4e31cb,_0xee4ac2['options']);return db['ZohoConfiguration'][_0x4b99('0x42')](_0x4e31cb)['then'](handleEntityNotFound(_0xe06b5,null))[_0x4b99('0x22')](respondWithResult(_0xe06b5,null))[_0x4b99('0x3e')](handleError(_0xe06b5,null));};exports['create']=function(_0x871392,_0x4833b3){return db['ZohoConfiguration'][_0x4b99('0x43')](_0x871392[_0x4b99('0x44')],{})['then'](respondWithResult(_0x4833b3,0xc9))['catch'](handleError(_0x4833b3,null));};exports['update']=function(_0x1baa70,_0x405b09){if(_0x1baa70[_0x4b99('0x44')]['id']){delete _0x1baa70[_0x4b99('0x44')]['id'];}return db[_0x4b99('0x3b')]['find']({'where':{'id':_0x1baa70['params']['id']}})['then'](handleEntityNotFound(_0x405b09,null))[_0x4b99('0x22')](saveUpdates(_0x1baa70['body'],null))[_0x4b99('0x22')](respondWithResult(_0x405b09,null))[_0x4b99('0x3e')](handleError(_0x405b09,null));};exports[_0x4b99('0x23')]=function(_0x1dae42,_0x4fdbae){return db['ZohoConfiguration'][_0x4b99('0x42')]({'where':{'id':_0x1dae42['params']['id']}})['then'](handleEntityNotFound(_0x4fdbae,null))[_0x4b99('0x22')](removeEntity(_0x4fdbae,null))['catch'](handleError(_0x4fdbae,null));};exports[_0x4b99('0x45')]=function(_0x2f0a78,_0x390307,_0x161999){var _0xdebad0={};var _0x374846={};var _0x13584c;var _0x5bfa6e;return db[_0x4b99('0x3b')]['findOne']({'where':{'id':_0x2f0a78['params']['id']}})['then'](handleEntityNotFound(_0x390307,null))[_0x4b99('0x22')](function(_0x45bb44){if(_0x45bb44){_0x13584c=_0x45bb44;_0x374846[_0x4b99('0x2d')]=_['keys'](db[_0x4b99('0x46')]['rawAttributes']);_0x374846[_0x4b99('0x2e')]=_[_0x4b99('0x2f')](_0x2f0a78[_0x4b99('0x2e')]);_0x374846[_0x4b99('0x30')]=_['intersection'](_0x374846['model'],_0x374846[_0x4b99('0x2e')]);_0xdebad0[_0x4b99('0x32')]=_[_0x4b99('0x31')](_0x374846[_0x4b99('0x2d')],qs['fields'](_0x2f0a78['query'][_0x4b99('0x33')]));_0xdebad0['attributes']=_0xdebad0[_0x4b99('0x32')][_0x4b99('0x34')]?_0xdebad0[_0x4b99('0x32')]:_0x374846[_0x4b99('0x2d')];_0xdebad0[_0x4b99('0x47')]=qs[_0x4b99('0x36')](_0x2f0a78[_0x4b99('0x2e')][_0x4b99('0x36')]);_0xdebad0[_0x4b99('0x39')]=qs[_0x4b99('0x30')](_['pick'](_0x2f0a78[_0x4b99('0x2e')],_0x374846[_0x4b99('0x30')]));if(_0x2f0a78[_0x4b99('0x2e')][_0x4b99('0x38')]){_0xdebad0['where']=_[_0x4b99('0x41')](_0xdebad0[_0x4b99('0x39')],{'$or':_[_0x4b99('0x2a')](_0xdebad0[_0x4b99('0x32')],function(_0x7692f2){var _0x4cf49f={};_0x4cf49f[_0x7692f2]={'$like':'%'+_0x2f0a78[_0x4b99('0x2e')]['filter']+'%'};return _0x4cf49f;})});}_0xdebad0=_['merge']({},_0xdebad0,_0x2f0a78[_0x4b99('0x48')]);return _0x13584c[_0x4b99('0x45')](_0xdebad0);}})['then'](function(_0x1a652){if(_0x1a652){_0x5bfa6e=_0x1a652[_0x4b99('0x34')];if(!_0x2f0a78[_0x4b99('0x2e')]['hasOwnProperty']('nolimit')){_0xdebad0[_0x4b99('0x1a')]=qs[_0x4b99('0x1a')](_0x2f0a78[_0x4b99('0x2e')]['limit']);_0xdebad0['offset']=qs[_0x4b99('0x18')](_0x2f0a78[_0x4b99('0x2e')][_0x4b99('0x18')]);}return _0x13584c[_0x4b99('0x45')](_0xdebad0);}})['then'](function(_0x23771e){if(_0x23771e){return _0x23771e?{'count':_0x5bfa6e,'rows':_0x23771e}:null;}})['then'](respondWithResult(_0x390307,null))[_0x4b99('0x3e')](handleError(_0x390307,null));};exports[_0x4b99('0x49')]=function(_0x2bc107,_0x47fc08,_0x521fb4){var _0x2e2139={};var _0x56bb8d={};var _0xac3f29;var _0x2ec9dd;return db[_0x4b99('0x3b')][_0x4b99('0x4a')]({'where':{'id':_0x2bc107[_0x4b99('0x40')]['id']}})[_0x4b99('0x22')](handleEntityNotFound(_0x47fc08,null))[_0x4b99('0x22')](function(_0x581dd1){if(_0x581dd1){_0xac3f29=_0x581dd1;_0x56bb8d[_0x4b99('0x2d')]=_['keys'](db[_0x4b99('0x46')][_0x4b99('0x2b')]);_0x56bb8d[_0x4b99('0x2e')]=_[_0x4b99('0x2f')](_0x2bc107[_0x4b99('0x2e')]);_0x56bb8d[_0x4b99('0x30')]=_[_0x4b99('0x31')](_0x56bb8d['model'],_0x56bb8d[_0x4b99('0x2e')]);_0x2e2139[_0x4b99('0x32')]=_[_0x4b99('0x31')](_0x56bb8d[_0x4b99('0x2d')],qs[_0x4b99('0x33')](_0x2bc107[_0x4b99('0x2e')]['fields']));_0x2e2139[_0x4b99('0x32')]=_0x2e2139[_0x4b99('0x32')][_0x4b99('0x34')]?_0x2e2139[_0x4b99('0x32')]:_0x56bb8d[_0x4b99('0x2d')];_0x2e2139['order']=qs['sort'](_0x2bc107[_0x4b99('0x2e')][_0x4b99('0x36')]);_0x2e2139['where']=qs[_0x4b99('0x30')](_['pick'](_0x2bc107['query'],_0x56bb8d[_0x4b99('0x30')]));if(_0x2bc107[_0x4b99('0x2e')][_0x4b99('0x38')]){_0x2e2139[_0x4b99('0x39')]=_['merge'](_0x2e2139['where'],{'$or':_[_0x4b99('0x2a')](_0x2e2139[_0x4b99('0x32')],function(_0x311d2d){var _0x591242={};_0x591242[_0x311d2d]={'$like':'%'+_0x2bc107['query']['filter']+'%'};return _0x591242;})});}_0x2e2139=_[_0x4b99('0x41')]({},_0x2e2139,_0x2bc107[_0x4b99('0x48')]);return _0xac3f29[_0x4b99('0x49')](_0x2e2139);}})[_0x4b99('0x22')](function(_0x1e8032){if(_0x1e8032){_0x2ec9dd=_0x1e8032[_0x4b99('0x34')];if(!_0x2bc107[_0x4b99('0x2e')][_0x4b99('0x35')](_0x4b99('0x4b'))){_0x2e2139[_0x4b99('0x1a')]=qs[_0x4b99('0x1a')](_0x2bc107[_0x4b99('0x2e')][_0x4b99('0x1a')]);_0x2e2139['offset']=qs[_0x4b99('0x18')](_0x2bc107['query'][_0x4b99('0x18')]);}return _0xac3f29['getSubjects'](_0x2e2139);}})[_0x4b99('0x22')](function(_0x37c85b){if(_0x37c85b){return _0x37c85b?{'count':_0x2ec9dd,'rows':_0x37c85b}:null;}})[_0x4b99('0x22')](respondWithResult(_0x47fc08,null))[_0x4b99('0x3e')](handleError(_0x47fc08,null));};exports[_0x4b99('0x4c')]=function(_0x652d11,_0x103aa9,_0xf35def){var _0x4e285e={};var _0x31262a={};var _0x1231a0;var _0x1d3a0d;return db[_0x4b99('0x3b')][_0x4b99('0x4a')]({'where':{'id':_0x652d11['params']['id']}})[_0x4b99('0x22')](handleEntityNotFound(_0x103aa9,null))[_0x4b99('0x22')](function(_0x1b75e6){if(_0x1b75e6){_0x1231a0=_0x1b75e6;_0x31262a[_0x4b99('0x2d')]=_['keys'](db[_0x4b99('0x46')]['rawAttributes']);_0x31262a[_0x4b99('0x2e')]=_['keys'](_0x652d11[_0x4b99('0x2e')]);_0x31262a[_0x4b99('0x30')]=_[_0x4b99('0x31')](_0x31262a[_0x4b99('0x2d')],_0x31262a[_0x4b99('0x2e')]);_0x4e285e[_0x4b99('0x32')]=_[_0x4b99('0x31')](_0x31262a['model'],qs[_0x4b99('0x33')](_0x652d11[_0x4b99('0x2e')][_0x4b99('0x33')]));_0x4e285e['attributes']=_0x4e285e['attributes'][_0x4b99('0x34')]?_0x4e285e[_0x4b99('0x32')]:_0x31262a[_0x4b99('0x2d')];_0x4e285e[_0x4b99('0x47')]=qs[_0x4b99('0x36')](_0x652d11[_0x4b99('0x2e')][_0x4b99('0x36')]);_0x4e285e[_0x4b99('0x39')]=qs[_0x4b99('0x30')](_['pick'](_0x652d11['query'],_0x31262a[_0x4b99('0x30')]));if(_0x652d11[_0x4b99('0x2e')]['filter']){_0x4e285e[_0x4b99('0x39')]=_[_0x4b99('0x41')](_0x4e285e[_0x4b99('0x39')],{'$or':_[_0x4b99('0x2a')](_0x4e285e[_0x4b99('0x32')],function(_0x193872){var _0x1b943d={};_0x1b943d[_0x193872]={'$like':'%'+_0x652d11['query'][_0x4b99('0x38')]+'%'};return _0x1b943d;})});}_0x4e285e=_[_0x4b99('0x41')]({},_0x4e285e,_0x652d11['options']);return _0x1231a0['getDescriptions'](_0x4e285e);}})['then'](function(_0x2c662b){if(_0x2c662b){_0x1d3a0d=_0x2c662b['length'];if(!_0x652d11[_0x4b99('0x2e')][_0x4b99('0x35')]('nolimit')){_0x4e285e[_0x4b99('0x1a')]=qs[_0x4b99('0x1a')](_0x652d11[_0x4b99('0x2e')][_0x4b99('0x1a')]);_0x4e285e['offset']=qs[_0x4b99('0x18')](_0x652d11[_0x4b99('0x2e')][_0x4b99('0x18')]);}return _0x1231a0[_0x4b99('0x4c')](_0x4e285e);}})[_0x4b99('0x22')](function(_0x27f349){if(_0x27f349){return _0x27f349?{'count':_0x1d3a0d,'rows':_0x27f349}:null;}})[_0x4b99('0x22')](respondWithResult(_0x103aa9,null))[_0x4b99('0x3e')](handleError(_0x103aa9,null));}; \ No newline at end of file +var _0xdc30=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','getFields','findOne','ZohoField','getSubjects','order','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','end','error','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type'];(function(_0x28db84,_0x1e400e){var _0x4c3463=function(_0x7aee81){while(--_0x7aee81){_0x28db84['push'](_0x28db84['shift']());}};_0x4c3463(++_0x1e400e);}(_0xdc30,0x6e));var _0x0dc3=function(_0x1ed406,_0x3b3184){_0x1ed406=_0x1ed406-0x0;var _0x359b38=_0xdc30[_0x1ed406];return _0x359b38;};'use strict';var emlformat=require(_0x0dc3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0dc3('0x1'));var rp=require(_0x0dc3('0x2'));var moment=require(_0x0dc3('0x3'));var BPromise=require(_0x0dc3('0x4'));var Mustache=require('mustache');var util=require(_0x0dc3('0x5'));var path=require(_0x0dc3('0x6'));var sox=require(_0x0dc3('0x7'));var csv=require(_0x0dc3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dc3('0x9'));var squel=require(_0x0dc3('0xa'));var crypto=require('crypto');var jsforce=require(_0x0dc3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0dc3('0x8'));var querystring=require(_0x0dc3('0xc'));var Papa=require(_0x0dc3('0xd'));var Redis=require('ioredis');var authService=require(_0x0dc3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0dc3('0xf'));var hardwareService=require(_0x0dc3('0x10'));var logger=require('../../config/logger')(_0x0dc3('0x11'));var utils=require(_0x0dc3('0x12'));var config=require(_0x0dc3('0x13'));var licenseUtil=require(_0x0dc3('0x14'));var db=require(_0x0dc3('0x15'))['db'];function respondWithStatusCode(_0x37e1fd,_0x3c5a44){_0x3c5a44=_0x3c5a44||0xcc;return function(_0x4940d9){if(_0x4940d9){return _0x37e1fd[_0x0dc3('0x16')](_0x3c5a44);}return _0x37e1fd[_0x0dc3('0x17')](_0x3c5a44)['end']();};}function respondWithResult(_0x2c02d4,_0xf954bf){_0xf954bf=_0xf954bf||0xc8;return function(_0x3538eb){if(_0x3538eb){return _0x2c02d4[_0x0dc3('0x17')](_0xf954bf)[_0x0dc3('0x18')](_0x3538eb);}};}function respondWithFilteredResult(_0x4050d9,_0x380948){return function(_0x4d944b){if(_0x4d944b){var _0x3c4583=typeof _0x380948[_0x0dc3('0x19')]===_0x0dc3('0x1a')&&typeof _0x380948[_0x0dc3('0x1b')]===_0x0dc3('0x1a');var _0x22046a=_0x4d944b[_0x0dc3('0x1c')];var _0x3ae620=_0x3c4583?0x0:_0x380948['offset'];var _0xc6a60=_0x3c4583?_0x4d944b[_0x0dc3('0x1c')]:_0x380948[_0x0dc3('0x19')]+_0x380948[_0x0dc3('0x1b')];var _0x199017;if(_0xc6a60>=_0x22046a){_0xc6a60=_0x22046a;_0x199017=0xc8;}else{_0x199017=0xce;}_0x4050d9['status'](_0x199017);return _0x4050d9['set']('Content-Range',_0x3ae620+'-'+_0xc6a60+'/'+_0x22046a)[_0x0dc3('0x18')](_0x4d944b);}return null;};}function patchUpdates(_0x228fd4){return function(_0x369c82){try{jsonpatch[_0x0dc3('0x1d')](_0x369c82,_0x228fd4,!![]);}catch(_0xbf181f){return BPromise[_0x0dc3('0x1e')](_0xbf181f);}return _0x369c82['save']();};}function saveUpdates(_0x46a4e6,_0x5122cb){return function(_0x17f0a6){if(_0x17f0a6){return _0x17f0a6[_0x0dc3('0x1f')](_0x46a4e6)[_0x0dc3('0x20')](function(_0x55b4ad){return _0x55b4ad;});}return null;};}function removeEntity(_0x20d929,_0x2f274d){return function(_0x1c7f58){if(_0x1c7f58){return _0x1c7f58[_0x0dc3('0x21')]()['then'](function(){_0x20d929[_0x0dc3('0x17')](0xcc)[_0x0dc3('0x22')]();});}};}function handleEntityNotFound(_0x274af4,_0x50e686){return function(_0x4136b3){if(!_0x4136b3){_0x274af4[_0x0dc3('0x16')](0x194);}return _0x4136b3;};}function handleError(_0x145e2b,_0x4b835b){_0x4b835b=_0x4b835b||0x1f4;return function(_0x3a2c6f){logger[_0x0dc3('0x23')](_0x3a2c6f[_0x0dc3('0x24')]);if(_0x3a2c6f['name']){delete _0x3a2c6f[_0x0dc3('0x25')];}_0x145e2b[_0x0dc3('0x17')](_0x4b835b)['send'](_0x3a2c6f);};}exports[_0x0dc3('0x26')]=function(_0x518585,_0x4496ba){var _0x5382a1={},_0x49d704={},_0x44dd65={'count':0x0,'rows':[]};var _0x5ea28d=_[_0x0dc3('0x27')](db[_0x0dc3('0x28')][_0x0dc3('0x29')],function(_0xf009ca){return{'name':_0xf009ca[_0x0dc3('0x2a')],'type':_0xf009ca[_0x0dc3('0x2b')][_0x0dc3('0x2c')]};});_0x49d704[_0x0dc3('0x2d')]=_[_0x0dc3('0x27')](_0x5ea28d,_0x0dc3('0x25'));_0x49d704[_0x0dc3('0x2e')]=_[_0x0dc3('0x2f')](_0x518585[_0x0dc3('0x2e')]);_0x49d704[_0x0dc3('0x30')]=_[_0x0dc3('0x31')](_0x49d704[_0x0dc3('0x2d')],_0x49d704[_0x0dc3('0x2e')]);_0x5382a1['attributes']=_[_0x0dc3('0x31')](_0x49d704['model'],qs[_0x0dc3('0x32')](_0x518585[_0x0dc3('0x2e')][_0x0dc3('0x32')]));_0x5382a1[_0x0dc3('0x33')]=_0x5382a1[_0x0dc3('0x33')][_0x0dc3('0x34')]?_0x5382a1[_0x0dc3('0x33')]:_0x49d704[_0x0dc3('0x2d')];if(!_0x518585[_0x0dc3('0x2e')][_0x0dc3('0x35')](_0x0dc3('0x36'))){_0x5382a1[_0x0dc3('0x1b')]=qs[_0x0dc3('0x1b')](_0x518585[_0x0dc3('0x2e')][_0x0dc3('0x1b')]);_0x5382a1[_0x0dc3('0x19')]=qs[_0x0dc3('0x19')](_0x518585[_0x0dc3('0x2e')]['offset']);}_0x5382a1['order']=qs[_0x0dc3('0x37')](_0x518585['query'][_0x0dc3('0x37')]);_0x5382a1[_0x0dc3('0x38')]=qs['filters'](_[_0x0dc3('0x39')](_0x518585['query'],_0x49d704[_0x0dc3('0x30')]),_0x5ea28d);if(_0x518585[_0x0dc3('0x2e')][_0x0dc3('0x3a')]){_0x5382a1[_0x0dc3('0x38')]=_[_0x0dc3('0x3b')](_0x5382a1['where'],{'$or':_[_0x0dc3('0x27')](_0x5ea28d,function(_0x3a68b7){if(_0x3a68b7[_0x0dc3('0x2b')]!==_0x0dc3('0x3c')){var _0x353d95={};_0x353d95[_0x3a68b7['name']]={'$like':'%'+_0x518585[_0x0dc3('0x2e')][_0x0dc3('0x3a')]+'%'};return _0x353d95;}})});}_0x5382a1=_[_0x0dc3('0x3b')]({},_0x5382a1,_0x518585['options']);var _0x17c919={'where':_0x5382a1[_0x0dc3('0x38')]};return db[_0x0dc3('0x28')][_0x0dc3('0x1c')](_0x17c919)[_0x0dc3('0x20')](function(_0x589f53){_0x44dd65[_0x0dc3('0x1c')]=_0x589f53;if(_0x518585[_0x0dc3('0x2e')][_0x0dc3('0x3d')]){_0x5382a1['include']=[{'all':!![]}];}return db[_0x0dc3('0x28')][_0x0dc3('0x3e')](_0x5382a1);})[_0x0dc3('0x20')](function(_0x10ca23){_0x44dd65[_0x0dc3('0x3f')]=_0x10ca23;return _0x44dd65;})[_0x0dc3('0x20')](respondWithFilteredResult(_0x4496ba,_0x5382a1))[_0x0dc3('0x40')](handleError(_0x4496ba,null));};exports['show']=function(_0xffc56b,_0x3bb75f){var _0xd8041a={'raw':![],'where':{'id':_0xffc56b[_0x0dc3('0x41')]['id']}},_0x5a59fb={};_0x5a59fb[_0x0dc3('0x2d')]=_['keys'](db[_0x0dc3('0x28')][_0x0dc3('0x29')]);_0x5a59fb[_0x0dc3('0x2e')]=_[_0x0dc3('0x2f')](_0xffc56b['query']);_0x5a59fb[_0x0dc3('0x30')]=_[_0x0dc3('0x31')](_0x5a59fb[_0x0dc3('0x2d')],_0x5a59fb['query']);_0xd8041a[_0x0dc3('0x33')]=_[_0x0dc3('0x31')](_0x5a59fb[_0x0dc3('0x2d')],qs[_0x0dc3('0x32')](_0xffc56b[_0x0dc3('0x2e')][_0x0dc3('0x32')]));_0xd8041a['attributes']=_0xd8041a['attributes'][_0x0dc3('0x34')]?_0xd8041a['attributes']:_0x5a59fb[_0x0dc3('0x2d')];if(_0xffc56b[_0x0dc3('0x2e')][_0x0dc3('0x3d')]){_0xd8041a[_0x0dc3('0x42')]=[{'all':!![]}];}_0xd8041a=_[_0x0dc3('0x3b')]({},_0xd8041a,_0xffc56b[_0x0dc3('0x43')]);return db['ZohoConfiguration'][_0x0dc3('0x44')](_0xd8041a)[_0x0dc3('0x20')](handleEntityNotFound(_0x3bb75f,null))[_0x0dc3('0x20')](respondWithResult(_0x3bb75f,null))[_0x0dc3('0x40')](handleError(_0x3bb75f,null));};exports[_0x0dc3('0x45')]=function(_0x726cae,_0x27882f){return db[_0x0dc3('0x28')][_0x0dc3('0x45')](_0x726cae[_0x0dc3('0x46')],{})['then'](respondWithResult(_0x27882f,0xc9))['catch'](handleError(_0x27882f,null));};exports[_0x0dc3('0x1f')]=function(_0x1034c,_0x502229){if(_0x1034c[_0x0dc3('0x46')]['id']){delete _0x1034c['body']['id'];}return db[_0x0dc3('0x28')][_0x0dc3('0x44')]({'where':{'id':_0x1034c[_0x0dc3('0x41')]['id']}})[_0x0dc3('0x20')](handleEntityNotFound(_0x502229,null))['then'](saveUpdates(_0x1034c[_0x0dc3('0x46')],null))[_0x0dc3('0x20')](respondWithResult(_0x502229,null))[_0x0dc3('0x40')](handleError(_0x502229,null));};exports[_0x0dc3('0x21')]=function(_0x5f3b31,_0x3fcd00){return db['ZohoConfiguration'][_0x0dc3('0x44')]({'where':{'id':_0x5f3b31[_0x0dc3('0x41')]['id']}})['then'](handleEntityNotFound(_0x3fcd00,null))['then'](removeEntity(_0x3fcd00,null))[_0x0dc3('0x40')](handleError(_0x3fcd00,null));};exports[_0x0dc3('0x47')]=function(_0x28ba19,_0x537ecc,_0x172f2a){var _0x213fff={};var _0x27f465={};var _0x202f9d;var _0x7e8d80;return db['ZohoConfiguration'][_0x0dc3('0x48')]({'where':{'id':_0x28ba19[_0x0dc3('0x41')]['id']}})[_0x0dc3('0x20')](handleEntityNotFound(_0x537ecc,null))['then'](function(_0x213688){if(_0x213688){_0x202f9d=_0x213688;_0x27f465[_0x0dc3('0x2d')]=_[_0x0dc3('0x2f')](db[_0x0dc3('0x49')][_0x0dc3('0x29')]);_0x27f465[_0x0dc3('0x2e')]=_['keys'](_0x28ba19[_0x0dc3('0x2e')]);_0x27f465[_0x0dc3('0x30')]=_[_0x0dc3('0x31')](_0x27f465[_0x0dc3('0x2d')],_0x27f465[_0x0dc3('0x2e')]);_0x213fff[_0x0dc3('0x33')]=_['intersection'](_0x27f465[_0x0dc3('0x2d')],qs[_0x0dc3('0x32')](_0x28ba19[_0x0dc3('0x2e')][_0x0dc3('0x32')]));_0x213fff[_0x0dc3('0x33')]=_0x213fff[_0x0dc3('0x33')][_0x0dc3('0x34')]?_0x213fff['attributes']:_0x27f465[_0x0dc3('0x2d')];_0x213fff['order']=qs['sort'](_0x28ba19[_0x0dc3('0x2e')]['sort']);_0x213fff['where']=qs['filters'](_[_0x0dc3('0x39')](_0x28ba19[_0x0dc3('0x2e')],_0x27f465[_0x0dc3('0x30')]));if(_0x28ba19[_0x0dc3('0x2e')][_0x0dc3('0x3a')]){_0x213fff[_0x0dc3('0x38')]=_['merge'](_0x213fff[_0x0dc3('0x38')],{'$or':_[_0x0dc3('0x27')](_0x213fff['attributes'],function(_0x441592){var _0x28d01={};_0x28d01[_0x441592]={'$like':'%'+_0x28ba19[_0x0dc3('0x2e')]['filter']+'%'};return _0x28d01;})});}_0x213fff=_['merge']({},_0x213fff,_0x28ba19[_0x0dc3('0x43')]);return _0x202f9d[_0x0dc3('0x47')](_0x213fff);}})[_0x0dc3('0x20')](function(_0x23a942){if(_0x23a942){_0x7e8d80=_0x23a942['length'];if(!_0x28ba19[_0x0dc3('0x2e')][_0x0dc3('0x35')](_0x0dc3('0x36'))){_0x213fff[_0x0dc3('0x1b')]=qs['limit'](_0x28ba19[_0x0dc3('0x2e')]['limit']);_0x213fff[_0x0dc3('0x19')]=qs['offset'](_0x28ba19[_0x0dc3('0x2e')][_0x0dc3('0x19')]);}return _0x202f9d[_0x0dc3('0x47')](_0x213fff);}})[_0x0dc3('0x20')](function(_0x1fc151){if(_0x1fc151){return _0x1fc151?{'count':_0x7e8d80,'rows':_0x1fc151}:null;}})[_0x0dc3('0x20')](respondWithResult(_0x537ecc,null))[_0x0dc3('0x40')](handleError(_0x537ecc,null));};exports[_0x0dc3('0x4a')]=function(_0x9227b,_0x15b36b,_0x4c533b){var _0x19affe={};var _0x3c8d7a={};var _0x2b22ec;var _0x180efb;return db[_0x0dc3('0x28')][_0x0dc3('0x48')]({'where':{'id':_0x9227b[_0x0dc3('0x41')]['id']}})[_0x0dc3('0x20')](handleEntityNotFound(_0x15b36b,null))[_0x0dc3('0x20')](function(_0x46c502){if(_0x46c502){_0x2b22ec=_0x46c502;_0x3c8d7a[_0x0dc3('0x2d')]=_[_0x0dc3('0x2f')](db[_0x0dc3('0x49')][_0x0dc3('0x29')]);_0x3c8d7a[_0x0dc3('0x2e')]=_[_0x0dc3('0x2f')](_0x9227b['query']);_0x3c8d7a[_0x0dc3('0x30')]=_['intersection'](_0x3c8d7a[_0x0dc3('0x2d')],_0x3c8d7a[_0x0dc3('0x2e')]);_0x19affe[_0x0dc3('0x33')]=_[_0x0dc3('0x31')](_0x3c8d7a[_0x0dc3('0x2d')],qs[_0x0dc3('0x32')](_0x9227b[_0x0dc3('0x2e')]['fields']));_0x19affe[_0x0dc3('0x33')]=_0x19affe[_0x0dc3('0x33')][_0x0dc3('0x34')]?_0x19affe[_0x0dc3('0x33')]:_0x3c8d7a[_0x0dc3('0x2d')];_0x19affe[_0x0dc3('0x4b')]=qs[_0x0dc3('0x37')](_0x9227b[_0x0dc3('0x2e')]['sort']);_0x19affe['where']=qs[_0x0dc3('0x30')](_[_0x0dc3('0x39')](_0x9227b[_0x0dc3('0x2e')],_0x3c8d7a['filters']));if(_0x9227b[_0x0dc3('0x2e')][_0x0dc3('0x3a')]){_0x19affe[_0x0dc3('0x38')]=_[_0x0dc3('0x3b')](_0x19affe[_0x0dc3('0x38')],{'$or':_[_0x0dc3('0x27')](_0x19affe[_0x0dc3('0x33')],function(_0xd3a80f){var _0x2332bc={};_0x2332bc[_0xd3a80f]={'$like':'%'+_0x9227b['query'][_0x0dc3('0x3a')]+'%'};return _0x2332bc;})});}_0x19affe=_['merge']({},_0x19affe,_0x9227b[_0x0dc3('0x43')]);return _0x2b22ec[_0x0dc3('0x4a')](_0x19affe);}})[_0x0dc3('0x20')](function(_0x45d77c){if(_0x45d77c){_0x180efb=_0x45d77c[_0x0dc3('0x34')];if(!_0x9227b[_0x0dc3('0x2e')]['hasOwnProperty'](_0x0dc3('0x36'))){_0x19affe['limit']=qs['limit'](_0x9227b[_0x0dc3('0x2e')][_0x0dc3('0x1b')]);_0x19affe[_0x0dc3('0x19')]=qs[_0x0dc3('0x19')](_0x9227b[_0x0dc3('0x2e')][_0x0dc3('0x19')]);}return _0x2b22ec[_0x0dc3('0x4a')](_0x19affe);}})[_0x0dc3('0x20')](function(_0x280825){if(_0x280825){return _0x280825?{'count':_0x180efb,'rows':_0x280825}:null;}})[_0x0dc3('0x20')](respondWithResult(_0x15b36b,null))[_0x0dc3('0x40')](handleError(_0x15b36b,null));};exports[_0x0dc3('0x4c')]=function(_0x2c22d8,_0x36fd67,_0x1c3017){var _0xcfccec={};var _0x4dbed4={};var _0xd5ef11;var _0x519b5e;return db[_0x0dc3('0x28')][_0x0dc3('0x48')]({'where':{'id':_0x2c22d8[_0x0dc3('0x41')]['id']}})['then'](handleEntityNotFound(_0x36fd67,null))['then'](function(_0x167ec6){if(_0x167ec6){_0xd5ef11=_0x167ec6;_0x4dbed4[_0x0dc3('0x2d')]=_[_0x0dc3('0x2f')](db[_0x0dc3('0x49')][_0x0dc3('0x29')]);_0x4dbed4[_0x0dc3('0x2e')]=_[_0x0dc3('0x2f')](_0x2c22d8[_0x0dc3('0x2e')]);_0x4dbed4['filters']=_['intersection'](_0x4dbed4[_0x0dc3('0x2d')],_0x4dbed4['query']);_0xcfccec[_0x0dc3('0x33')]=_['intersection'](_0x4dbed4['model'],qs[_0x0dc3('0x32')](_0x2c22d8[_0x0dc3('0x2e')][_0x0dc3('0x32')]));_0xcfccec[_0x0dc3('0x33')]=_0xcfccec[_0x0dc3('0x33')][_0x0dc3('0x34')]?_0xcfccec[_0x0dc3('0x33')]:_0x4dbed4[_0x0dc3('0x2d')];_0xcfccec['order']=qs['sort'](_0x2c22d8[_0x0dc3('0x2e')][_0x0dc3('0x37')]);_0xcfccec['where']=qs[_0x0dc3('0x30')](_['pick'](_0x2c22d8[_0x0dc3('0x2e')],_0x4dbed4[_0x0dc3('0x30')]));if(_0x2c22d8[_0x0dc3('0x2e')][_0x0dc3('0x3a')]){_0xcfccec[_0x0dc3('0x38')]=_['merge'](_0xcfccec[_0x0dc3('0x38')],{'$or':_[_0x0dc3('0x27')](_0xcfccec[_0x0dc3('0x33')],function(_0x1e296c){var _0x197896={};_0x197896[_0x1e296c]={'$like':'%'+_0x2c22d8[_0x0dc3('0x2e')][_0x0dc3('0x3a')]+'%'};return _0x197896;})});}_0xcfccec=_[_0x0dc3('0x3b')]({},_0xcfccec,_0x2c22d8[_0x0dc3('0x43')]);return _0xd5ef11[_0x0dc3('0x4c')](_0xcfccec);}})[_0x0dc3('0x20')](function(_0x155e69){if(_0x155e69){_0x519b5e=_0x155e69['length'];if(!_0x2c22d8[_0x0dc3('0x2e')][_0x0dc3('0x35')](_0x0dc3('0x36'))){_0xcfccec[_0x0dc3('0x1b')]=qs[_0x0dc3('0x1b')](_0x2c22d8[_0x0dc3('0x2e')][_0x0dc3('0x1b')]);_0xcfccec[_0x0dc3('0x19')]=qs[_0x0dc3('0x19')](_0x2c22d8[_0x0dc3('0x2e')]['offset']);}return _0xd5ef11[_0x0dc3('0x4c')](_0xcfccec);}})[_0x0dc3('0x20')](function(_0x2ee04a){if(_0x2ee04a){return _0x2ee04a?{'count':_0x519b5e,'rows':_0x2ee04a}:null;}})['then'](respondWithResult(_0x36fd67,null))[_0x0dc3('0x40')](handleError(_0x36fd67,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 53a80f4..4379977 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 _0xbaea=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','util'];(function(_0x41c556,_0x5e4fdd){var _0x49a18e=function(_0x4f02fd){while(--_0x4f02fd){_0x41c556['push'](_0x41c556['shift']());}};_0x49a18e(++_0x5e4fdd);}(_0xbaea,0x137));var _0xabae=function(_0x2e4828,_0x9ebfd8){_0x2e4828=_0x2e4828-0x0;var _0x2e86c0=_0xbaea[_0x2e4828];return _0x2e86c0;};'use strict';var _=require('lodash');var util=require(_0xabae('0x0'));var logger=require(_0xabae('0x1'))(_0xabae('0x2'));var moment=require(_0xabae('0x3'));var BPromise=require(_0xabae('0x4'));var rp=require(_0xabae('0x5'));var fs=require('fs');var path=require(_0xabae('0x6'));var rimraf=require('rimraf');var config=require(_0xabae('0x7'));var attributes=require(_0xabae('0x8'));module[_0xabae('0x9')]=function(_0x3e0829,_0x1620f9){return _0x3e0829[_0xabae('0xa')](_0xabae('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','int_zoho_configurations','lodash','util'];(function(_0x1d9e47,_0x5c6d0c){var _0x484554=function(_0x9bd5f2){while(--_0x9bd5f2){_0x1d9e47['push'](_0x1d9e47['shift']());}};_0x484554(++_0x5c6d0c);}(_0xac4c,0x15a));var _0xcac4=function(_0x116c32,_0x1970bd){_0x116c32=_0x116c32-0x0;var _0xb9440e=_0xac4c[_0x116c32];return _0xb9440e;};'use strict';var _=require(_0xcac4('0x0'));var util=require(_0xcac4('0x1'));var logger=require(_0xcac4('0x2'))('api');var moment=require(_0xcac4('0x3'));var BPromise=require(_0xcac4('0x4'));var rp=require(_0xcac4('0x5'));var fs=require('fs');var path=require(_0xcac4('0x6'));var rimraf=require(_0xcac4('0x7'));var config=require(_0xcac4('0x8'));var attributes=require(_0xcac4('0x9'));module['exports']=function(_0x6ccc2a,_0x1a6e63){return _0x6ccc2a[_0xcac4('0xa')]('ZohoConfiguration',attributes,{'tableName':_0xcac4('0xb'),'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 d5d974f..b759963 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 _0x31ec=['stringify','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x535c17,_0x206242){var _0x52d73f=function(_0xb13021){while(--_0xb13021){_0x535c17['push'](_0x535c17['shift']());}};_0x52d73f(++_0x206242);}(_0x31ec,0xf4));var _0xc31e=function(_0xc778c8,_0x4d23ce){_0xc778c8=_0xc778c8-0x0;var _0x4485d6=_0x31ec[_0xc778c8];return _0x4485d6;};'use strict';var _=require(_0xc31e('0x0'));var util=require('util');var moment=require(_0xc31e('0x1'));var BPromise=require(_0xc31e('0x2'));var rs=require(_0xc31e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc31e('0x4'))['db'];var utils=require(_0xc31e('0x5'));var logger=require(_0xc31e('0x6'))(_0xc31e('0x7'));var config=require(_0xc31e('0x8'));var jayson=require(_0xc31e('0x9'));var client=jayson['client'][_0xc31e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb0f563,_0x4a1e04,_0x15c3a0){return new BPromise(function(_0x2e4e12,_0x2bd3da){return client[_0xc31e('0xb')](_0xb0f563,_0x15c3a0)['then'](function(_0x4e6dfa){logger[_0xc31e('0xc')](_0xc31e('0xd'),_0x4a1e04,_0xc31e('0xe'));logger['debug'](_0xc31e('0xf'),_0x4a1e04,_0xc31e('0xe'),JSON[_0xc31e('0x10')](_0x4e6dfa));if(_0x4e6dfa[_0xc31e('0x11')]){if(_0x4e6dfa[_0xc31e('0x11')][_0xc31e('0x12')]===0x1f4){logger[_0xc31e('0x11')](_0xc31e('0xd'),_0x4a1e04,_0x4e6dfa['error'][_0xc31e('0x13')]);return _0x2bd3da(_0x4e6dfa[_0xc31e('0x11')]['message']);}logger[_0xc31e('0x11')](_0xc31e('0xd'),_0x4a1e04,_0x4e6dfa[_0xc31e('0x11')][_0xc31e('0x13')]);return _0x2e4e12(_0x4e6dfa[_0xc31e('0x11')][_0xc31e('0x13')]);}else{logger[_0xc31e('0xc')](_0xc31e('0xd'),_0x4a1e04,'request\x20sent');_0x2e4e12(_0x4e6dfa['result'][_0xc31e('0x13')]);}})['catch'](function(_0x3a7035){logger[_0xc31e('0x11')](_0xc31e('0xd'),_0x4a1e04,_0x3a7035);_0x2bd3da(_0x3a7035);});});} \ No newline at end of file +var _0xea28=['jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x379834,_0x133585){var _0x5be98d=function(_0x307e84){while(--_0x307e84){_0x379834['push'](_0x379834['shift']());}};_0x5be98d(++_0x133585);}(_0xea28,0x1ef));var _0x8ea2=function(_0x5b793c,_0x219dbe){_0x5b793c=_0x5b793c-0x0;var _0x21b90c=_0xea28[_0x5b793c];return _0x21b90c;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require(_0x8ea2('0x8'))(_0x8ea2('0x9'));var config=require(_0x8ea2('0xa'));var jayson=require(_0x8ea2('0xb'));var client=jayson[_0x8ea2('0xc')][_0x8ea2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x171680,_0x38ec70,_0x9a11e3){return new BPromise(function(_0x5b0cfb,_0x180b52){return client['request'](_0x171680,_0x9a11e3)[_0x8ea2('0xe')](function(_0x52df4d){logger[_0x8ea2('0xf')](_0x8ea2('0x10'),_0x38ec70,'request\x20sent');logger[_0x8ea2('0x11')](_0x8ea2('0x12'),_0x38ec70,_0x8ea2('0x13'),JSON['stringify'](_0x52df4d));if(_0x52df4d[_0x8ea2('0x14')]){if(_0x52df4d[_0x8ea2('0x14')]['code']===0x1f4){logger['error'](_0x8ea2('0x10'),_0x38ec70,_0x52df4d[_0x8ea2('0x14')][_0x8ea2('0x15')]);return _0x180b52(_0x52df4d[_0x8ea2('0x14')]['message']);}logger[_0x8ea2('0x14')](_0x8ea2('0x10'),_0x38ec70,_0x52df4d[_0x8ea2('0x14')][_0x8ea2('0x15')]);return _0x5b0cfb(_0x52df4d['error']['message']);}else{logger[_0x8ea2('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x38ec70,_0x8ea2('0x13'));_0x5b0cfb(_0x52df4d['result'][_0x8ea2('0x15')]);}})['catch'](function(_0xaf14b2){logger['error'](_0x8ea2('0x10'),_0x38ec70,_0xaf14b2);_0x180b52(_0xaf14b2);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1af9832..c670446 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 _0x770a=['isAuthenticated','index','post','create','put','/:id','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get'];(function(_0x358318,_0xf70eb1){var _0x496dd6=function(_0xf0d7){while(--_0xf0d7){_0x358318['push'](_0x358318['shift']());}};_0x496dd6(++_0xf70eb1);}(_0x770a,0xf6));var _0xa770=function(_0x14e58a,_0x766448){_0x14e58a=_0x14e58a-0x0;var _0x330c8d=_0x770a[_0x14e58a];return _0x330c8d;};'use strict';var multer=require(_0xa770('0x0'));var util=require('util');var path=require(_0xa770('0x1'));var timeout=require(_0xa770('0x2'));var express=require(_0xa770('0x3'));var router=express[_0xa770('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa770('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa770('0x6'));var controller=require(_0xa770('0x7'));router[_0xa770('0x8')]('/',auth[_0xa770('0x9')](),controller[_0xa770('0xa')]);router[_0xa770('0x8')]('/:id',auth[_0xa770('0x9')](),controller['show']);router[_0xa770('0xb')]('/',auth['isAuthenticated'](),controller[_0xa770('0xc')]);router[_0xa770('0xd')](_0xa770('0xe'),auth[_0xa770('0x9')](),controller['update']);router[_0xa770('0xf')](_0xa770('0xe'),auth[_0xa770('0x9')](),controller['destroy']);module[_0xa770('0x10')]=router; \ No newline at end of file +var _0xd7e1=['put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create'];(function(_0x4182a7,_0xcd2a05){var _0x52c210=function(_0x193ffe){while(--_0x193ffe){_0x4182a7['push'](_0x4182a7['shift']());}};_0x52c210(++_0xcd2a05);}(_0xd7e1,0x136));var _0x1d7e=function(_0xb400ce,_0x51e8dc){_0xb400ce=_0xb400ce-0x0;var _0x50b4bc=_0xd7e1[_0xb400ce];return _0x50b4bc;};'use strict';var multer=require('multer');var util=require(_0x1d7e('0x0'));var path=require('path');var timeout=require(_0x1d7e('0x1'));var express=require(_0x1d7e('0x2'));var router=express[_0x1d7e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1d7e('0x4'));var interaction=require(_0x1d7e('0x5'));var config=require(_0x1d7e('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x1d7e('0x7')](),controller['index']);router[_0x1d7e('0x8')](_0x1d7e('0x9'),auth[_0x1d7e('0x7')](),controller[_0x1d7e('0xa')]);router[_0x1d7e('0xb')]('/',auth[_0x1d7e('0x7')](),controller[_0x1d7e('0xc')]);router[_0x1d7e('0xd')](_0x1d7e('0x9'),auth[_0x1d7e('0x7')](),controller[_0x1d7e('0xe')]);router[_0x1d7e('0xf')](_0x1d7e('0x9'),auth[_0x1d7e('0x7')](),controller['destroy']);module[_0x1d7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 7690bbd..5151111 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 _0xfecc=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x4e518d,_0x32a45d){var _0x458ff2=function(_0xc96c49){while(--_0xc96c49){_0x4e518d['push'](_0x4e518d['shift']());}};_0x458ff2(++_0x32a45d);}(_0xfecc,0x19f));var _0xcfec=function(_0x289a98,_0x5029f7){_0x289a98=_0x289a98-0x0;var _0x234194=_0xfecc[_0x289a98];return _0x234194;};'use strict';var Sequelize=require(_0xcfec('0x0'));module['exports']={'type':{'type':Sequelize[_0xcfec('0x1')](_0xcfec('0x2'),_0xcfec('0x3'),_0xcfec('0x4'),_0xcfec('0x5'),_0xcfec('0x6')),'defaultValue':_0xcfec('0x2')},'content':{'type':Sequelize[_0xcfec('0x7')]},'key':{'type':Sequelize[_0xcfec('0x7')]},'keyType':{'type':Sequelize[_0xcfec('0x1')]('string',_0xcfec('0x3'),_0xcfec('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcfec('0x7')]},'nameField':{'type':Sequelize[_0xcfec('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41af=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','ENUM'];(function(_0x45479e,_0x4149b9){var _0xece85b=function(_0x53dc9d){while(--_0x53dc9d){_0x45479e['push'](_0x45479e['shift']());}};_0xece85b(++_0x4149b9);}(_0x41af,0x1ee));var _0xf41a=function(_0x15e595,_0x3c3e29){_0x15e595=_0x15e595-0x0;var _0x45f371=_0x41af[_0x15e595];return _0x45f371;};'use strict';var Sequelize=require(_0xf41a('0x0'));module['exports']={'type':{'type':Sequelize[_0xf41a('0x1')](_0xf41a('0x2'),'variable',_0xf41a('0x3'),_0xf41a('0x4'),_0xf41a('0x5')),'defaultValue':_0xf41a('0x2')},'content':{'type':Sequelize[_0xf41a('0x6')]},'key':{'type':Sequelize[_0xf41a('0x6')]},'keyType':{'type':Sequelize[_0xf41a('0x1')](_0xf41a('0x2'),_0xf41a('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xf41a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf41a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 39f5408..123c3fb 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 _0x00d0=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','ZohoField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0xdf6a49,_0x48f5dc){var _0x1057c3=function(_0x1a1574){while(--_0x1a1574){_0xdf6a49['push'](_0xdf6a49['shift']());}};_0x1057c3(++_0x48f5dc);}(_0x00d0,0x163));var _0x000d=function(_0x564c35,_0x5f03a2){_0x564c35=_0x564c35-0x0;var _0x3de3d5=_0x00d0[_0x564c35];return _0x3de3d5;};'use strict';var emlformat=require(_0x000d('0x0'));var rimraf=require(_0x000d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x000d('0x2'));var rp=require(_0x000d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x000d('0x4'));var util=require(_0x000d('0x5'));var path=require('path');var sox=require(_0x000d('0x6'));var csv=require(_0x000d('0x7'));var ejs=require(_0x000d('0x8'));var fs=require('fs');var fs_extra=require(_0x000d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x000d('0xa'));var jsforce=require(_0x000d('0xb'));var deskjs=require(_0x000d('0xc'));var toCsv=require(_0x000d('0x7'));var querystring=require(_0x000d('0xd'));var Papa=require(_0x000d('0xe'));var Redis=require('ioredis');var authService=require(_0x000d('0xf'));var qs=require(_0x000d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x000d('0x11'));var logger=require('../../config/logger')(_0x000d('0x12'));var utils=require(_0x000d('0x13'));var config=require(_0x000d('0x14'));var licenseUtil=require(_0x000d('0x15'));var db=require(_0x000d('0x16'))['db'];function respondWithStatusCode(_0x3d29dd,_0x85debd){_0x85debd=_0x85debd||0xcc;return function(_0x5c3ece){if(_0x5c3ece){return _0x3d29dd[_0x000d('0x17')](_0x85debd);}return _0x3d29dd[_0x000d('0x18')](_0x85debd)[_0x000d('0x19')]();};}function respondWithResult(_0x198089,_0x2616ff){_0x2616ff=_0x2616ff||0xc8;return function(_0x5553b7){if(_0x5553b7){return _0x198089[_0x000d('0x18')](_0x2616ff)[_0x000d('0x1a')](_0x5553b7);}};}function respondWithFilteredResult(_0x5878e6,_0x457923){return function(_0x336835){if(_0x336835){var _0x1e3cd1=typeof _0x457923[_0x000d('0x1b')]===_0x000d('0x1c')&&typeof _0x457923[_0x000d('0x1d')]===_0x000d('0x1c');var _0x44d7bc=_0x336835['count'];var _0x39aea1=_0x1e3cd1?0x0:_0x457923['offset'];var _0x3eb509=_0x1e3cd1?_0x336835['count']:_0x457923[_0x000d('0x1b')]+_0x457923[_0x000d('0x1d')];var _0x416fd3;if(_0x3eb509>=_0x44d7bc){_0x3eb509=_0x44d7bc;_0x416fd3=0xc8;}else{_0x416fd3=0xce;}_0x5878e6[_0x000d('0x18')](_0x416fd3);return _0x5878e6[_0x000d('0x1e')](_0x000d('0x1f'),_0x39aea1+'-'+_0x3eb509+'/'+_0x44d7bc)[_0x000d('0x1a')](_0x336835);}return null;};}function patchUpdates(_0x1759b5){return function(_0xe57ea7){try{jsonpatch['apply'](_0xe57ea7,_0x1759b5,!![]);}catch(_0x41d699){return BPromise[_0x000d('0x20')](_0x41d699);}return _0xe57ea7[_0x000d('0x21')]();};}function saveUpdates(_0x49b711,_0x2fba55){return function(_0x527f14){if(_0x527f14){return _0x527f14['update'](_0x49b711)[_0x000d('0x22')](function(_0x2723c9){return _0x2723c9;});}return null;};}function removeEntity(_0x3c212a,_0x19bdd2){return function(_0x9dee07){if(_0x9dee07){return _0x9dee07[_0x000d('0x23')]()[_0x000d('0x22')](function(){_0x3c212a[_0x000d('0x18')](0xcc)[_0x000d('0x19')]();});}};}function handleEntityNotFound(_0x110125,_0x3c23b4){return function(_0x4b764f){if(!_0x4b764f){_0x110125[_0x000d('0x17')](0x194);}return _0x4b764f;};}function handleError(_0x505ed0,_0x261a07){_0x261a07=_0x261a07||0x1f4;return function(_0x2fc7c0){logger[_0x000d('0x24')](_0x2fc7c0['stack']);if(_0x2fc7c0[_0x000d('0x25')]){delete _0x2fc7c0[_0x000d('0x25')];}_0x505ed0[_0x000d('0x18')](_0x261a07)[_0x000d('0x26')](_0x2fc7c0);};}exports[_0x000d('0x27')]=function(_0x22dad2,_0x54180c){var _0x4ceab9={},_0xaaea8c={},_0x303bdb={'count':0x0,'rows':[]};var _0x356b0f=_[_0x000d('0x28')](db[_0x000d('0x29')]['rawAttributes'],function(_0x2b896c){return{'name':_0x2b896c[_0x000d('0x2a')],'type':_0x2b896c[_0x000d('0x2b')]['key']};});_0xaaea8c[_0x000d('0x2c')]=_['map'](_0x356b0f,_0x000d('0x25'));_0xaaea8c[_0x000d('0x2d')]=_[_0x000d('0x2e')](_0x22dad2['query']);_0xaaea8c[_0x000d('0x2f')]=_[_0x000d('0x30')](_0xaaea8c[_0x000d('0x2c')],_0xaaea8c[_0x000d('0x2d')]);_0x4ceab9[_0x000d('0x31')]=_[_0x000d('0x30')](_0xaaea8c[_0x000d('0x2c')],qs[_0x000d('0x32')](_0x22dad2['query'][_0x000d('0x32')]));_0x4ceab9['attributes']=_0x4ceab9[_0x000d('0x31')]['length']?_0x4ceab9[_0x000d('0x31')]:_0xaaea8c['model'];if(!_0x22dad2[_0x000d('0x2d')][_0x000d('0x33')](_0x000d('0x34'))){_0x4ceab9[_0x000d('0x1d')]=qs[_0x000d('0x1d')](_0x22dad2['query'][_0x000d('0x1d')]);_0x4ceab9[_0x000d('0x1b')]=qs[_0x000d('0x1b')](_0x22dad2[_0x000d('0x2d')]['offset']);}_0x4ceab9[_0x000d('0x35')]=qs['sort'](_0x22dad2[_0x000d('0x2d')]['sort']);_0x4ceab9['where']=qs['filters'](_[_0x000d('0x36')](_0x22dad2[_0x000d('0x2d')],_0xaaea8c[_0x000d('0x2f')]),_0x356b0f);if(_0x22dad2[_0x000d('0x2d')][_0x000d('0x37')]){_0x4ceab9[_0x000d('0x38')]=_[_0x000d('0x39')](_0x4ceab9[_0x000d('0x38')],{'$or':_[_0x000d('0x28')](_0x356b0f,function(_0x5362c1){if(_0x5362c1['type']!==_0x000d('0x3a')){var _0x295a77={};_0x295a77[_0x5362c1[_0x000d('0x25')]]={'$like':'%'+_0x22dad2[_0x000d('0x2d')][_0x000d('0x37')]+'%'};return _0x295a77;}})});}_0x4ceab9=_['merge']({},_0x4ceab9,_0x22dad2[_0x000d('0x3b')]);var _0x5806c8={'where':_0x4ceab9['where']};return db[_0x000d('0x29')][_0x000d('0x3c')](_0x5806c8)['then'](function(_0x4b4cf6){_0x303bdb[_0x000d('0x3c')]=_0x4b4cf6;if(_0x22dad2[_0x000d('0x2d')][_0x000d('0x3d')]){_0x4ceab9[_0x000d('0x3e')]=[{'all':!![]}];}return db[_0x000d('0x29')]['findAll'](_0x4ceab9);})[_0x000d('0x22')](function(_0x19e89d){_0x303bdb[_0x000d('0x3f')]=_0x19e89d;return _0x303bdb;})[_0x000d('0x22')](respondWithFilteredResult(_0x54180c,_0x4ceab9))[_0x000d('0x40')](handleError(_0x54180c,null));};exports[_0x000d('0x41')]=function(_0x419da8,_0x3b3c57){var _0x4b1d0d={'raw':!![],'where':{'id':_0x419da8[_0x000d('0x42')]['id']}},_0x16a3b4={};_0x16a3b4[_0x000d('0x2c')]=_['keys'](db[_0x000d('0x29')][_0x000d('0x43')]);_0x16a3b4['query']=_[_0x000d('0x2e')](_0x419da8['query']);_0x16a3b4['filters']=_[_0x000d('0x30')](_0x16a3b4[_0x000d('0x2c')],_0x16a3b4[_0x000d('0x2d')]);_0x4b1d0d[_0x000d('0x31')]=_[_0x000d('0x30')](_0x16a3b4[_0x000d('0x2c')],qs['fields'](_0x419da8[_0x000d('0x2d')][_0x000d('0x32')]));_0x4b1d0d[_0x000d('0x31')]=_0x4b1d0d[_0x000d('0x31')][_0x000d('0x44')]?_0x4b1d0d[_0x000d('0x31')]:_0x16a3b4['model'];if(_0x419da8[_0x000d('0x2d')][_0x000d('0x3d')]){_0x4b1d0d[_0x000d('0x3e')]=[{'all':!![]}];}_0x4b1d0d=_['merge']({},_0x4b1d0d,_0x419da8['options']);return db[_0x000d('0x29')][_0x000d('0x45')](_0x4b1d0d)[_0x000d('0x22')](handleEntityNotFound(_0x3b3c57,null))[_0x000d('0x22')](respondWithResult(_0x3b3c57,null))[_0x000d('0x40')](handleError(_0x3b3c57,null));};exports[_0x000d('0x46')]=function(_0x2d001d,_0x54fd9c){return db[_0x000d('0x29')]['create'](_0x2d001d[_0x000d('0x47')],{})[_0x000d('0x22')](respondWithResult(_0x54fd9c,0xc9))[_0x000d('0x40')](handleError(_0x54fd9c,null));};exports[_0x000d('0x48')]=function(_0x179f12,_0x2ac151){if(_0x179f12[_0x000d('0x47')]['id']){delete _0x179f12[_0x000d('0x47')]['id'];}return db[_0x000d('0x29')][_0x000d('0x45')]({'where':{'id':_0x179f12[_0x000d('0x42')]['id']}})[_0x000d('0x22')](handleEntityNotFound(_0x2ac151,null))[_0x000d('0x22')](saveUpdates(_0x179f12[_0x000d('0x47')],null))[_0x000d('0x22')](respondWithResult(_0x2ac151,null))['catch'](handleError(_0x2ac151,null));};exports[_0x000d('0x23')]=function(_0x173d2f,_0x5f2d54){return db['ZohoField'][_0x000d('0x45')]({'where':{'id':_0x173d2f[_0x000d('0x42')]['id']}})[_0x000d('0x22')](handleEntityNotFound(_0x5f2d54,null))[_0x000d('0x22')](removeEntity(_0x5f2d54,null))['catch'](handleError(_0x5f2d54,null));}; \ No newline at end of file +var _0x2c12=['destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','include','findAll','catch','show','params','keys','includeAll','merge','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0xd8a6f7,_0x37fb9a){var _0x45f465=function(_0x57556f){while(--_0x57556f){_0xd8a6f7['push'](_0xd8a6f7['shift']());}};_0x45f465(++_0x37fb9a);}(_0x2c12,0x107));var _0x22c1=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x2c12[_0x4d79bc];return _0x4b4760;};'use strict';var emlformat=require(_0x22c1('0x0'));var rimraf=require(_0x22c1('0x1'));var zipdir=require(_0x22c1('0x2'));var jsonpatch=require(_0x22c1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x22c1('0x4'));var Mustache=require('mustache');var util=require(_0x22c1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x22c1('0x6'));var ejs=require(_0x22c1('0x7'));var fs=require('fs');var fs_extra=require(_0x22c1('0x8'));var _=require(_0x22c1('0x9'));var squel=require(_0x22c1('0xa'));var crypto=require(_0x22c1('0xb'));var jsforce=require(_0x22c1('0xc'));var deskjs=require(_0x22c1('0xd'));var toCsv=require(_0x22c1('0x6'));var querystring=require(_0x22c1('0xe'));var Papa=require(_0x22c1('0xf'));var Redis=require('ioredis');var authService=require(_0x22c1('0x10'));var qs=require(_0x22c1('0x11'));var as=require(_0x22c1('0x12'));var hardwareService=require(_0x22c1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x22c1('0x14'));var config=require(_0x22c1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x22c1('0x16'))['db'];function respondWithStatusCode(_0xa7440,_0x4dd606){_0x4dd606=_0x4dd606||0xcc;return function(_0x5788aa){if(_0x5788aa){return _0xa7440[_0x22c1('0x17')](_0x4dd606);}return _0xa7440[_0x22c1('0x18')](_0x4dd606)[_0x22c1('0x19')]();};}function respondWithResult(_0x36da4b,_0x2930c9){_0x2930c9=_0x2930c9||0xc8;return function(_0x39be54){if(_0x39be54){return _0x36da4b[_0x22c1('0x18')](_0x2930c9)[_0x22c1('0x1a')](_0x39be54);}};}function respondWithFilteredResult(_0x1cc3ef,_0x5e2003){return function(_0x246542){if(_0x246542){var _0x5880c2=typeof _0x5e2003[_0x22c1('0x1b')]===_0x22c1('0x1c')&&typeof _0x5e2003[_0x22c1('0x1d')]==='undefined';var _0x3ef985=_0x246542[_0x22c1('0x1e')];var _0x5d05ea=_0x5880c2?0x0:_0x5e2003['offset'];var _0x4eb00f=_0x5880c2?_0x246542[_0x22c1('0x1e')]:_0x5e2003['offset']+_0x5e2003[_0x22c1('0x1d')];var _0x18a63d;if(_0x4eb00f>=_0x3ef985){_0x4eb00f=_0x3ef985;_0x18a63d=0xc8;}else{_0x18a63d=0xce;}_0x1cc3ef['status'](_0x18a63d);return _0x1cc3ef['set'](_0x22c1('0x1f'),_0x5d05ea+'-'+_0x4eb00f+'/'+_0x3ef985)[_0x22c1('0x1a')](_0x246542);}return null;};}function patchUpdates(_0x4df865){return function(_0x5d28d4){try{jsonpatch[_0x22c1('0x20')](_0x5d28d4,_0x4df865,!![]);}catch(_0x3e70ea){return BPromise[_0x22c1('0x21')](_0x3e70ea);}return _0x5d28d4[_0x22c1('0x22')]();};}function saveUpdates(_0x3ebf32,_0x38e3f1){return function(_0x182eaa){if(_0x182eaa){return _0x182eaa[_0x22c1('0x23')](_0x3ebf32)[_0x22c1('0x24')](function(_0x47c512){return _0x47c512;});}return null;};}function removeEntity(_0x31244e,_0x451fc7){return function(_0x1465bb){if(_0x1465bb){return _0x1465bb[_0x22c1('0x25')]()[_0x22c1('0x24')](function(){_0x31244e[_0x22c1('0x18')](0xcc)[_0x22c1('0x19')]();});}};}function handleEntityNotFound(_0x5799f2,_0x47d26c){return function(_0x27d624){if(!_0x27d624){_0x5799f2[_0x22c1('0x17')](0x194);}return _0x27d624;};}function handleError(_0x4bd330,_0x4660a2){_0x4660a2=_0x4660a2||0x1f4;return function(_0x254b11){logger[_0x22c1('0x26')](_0x254b11[_0x22c1('0x27')]);if(_0x254b11[_0x22c1('0x28')]){delete _0x254b11[_0x22c1('0x28')];}_0x4bd330[_0x22c1('0x18')](_0x4660a2)[_0x22c1('0x29')](_0x254b11);};}exports[_0x22c1('0x2a')]=function(_0x5e4fb3,_0x2356c0){var _0x3a8501={},_0x3fd007={},_0x528b35={'count':0x0,'rows':[]};var _0x102b21=_[_0x22c1('0x2b')](db[_0x22c1('0x2c')][_0x22c1('0x2d')],function(_0x96e2cf){return{'name':_0x96e2cf[_0x22c1('0x2e')],'type':_0x96e2cf[_0x22c1('0x2f')][_0x22c1('0x30')]};});_0x3fd007[_0x22c1('0x31')]=_[_0x22c1('0x2b')](_0x102b21,_0x22c1('0x28'));_0x3fd007[_0x22c1('0x32')]=_['keys'](_0x5e4fb3[_0x22c1('0x32')]);_0x3fd007[_0x22c1('0x33')]=_[_0x22c1('0x34')](_0x3fd007[_0x22c1('0x31')],_0x3fd007['query']);_0x3a8501[_0x22c1('0x35')]=_['intersection'](_0x3fd007[_0x22c1('0x31')],qs['fields'](_0x5e4fb3[_0x22c1('0x32')][_0x22c1('0x36')]));_0x3a8501[_0x22c1('0x35')]=_0x3a8501[_0x22c1('0x35')][_0x22c1('0x37')]?_0x3a8501[_0x22c1('0x35')]:_0x3fd007[_0x22c1('0x31')];if(!_0x5e4fb3['query'][_0x22c1('0x38')](_0x22c1('0x39'))){_0x3a8501['limit']=qs[_0x22c1('0x1d')](_0x5e4fb3[_0x22c1('0x32')][_0x22c1('0x1d')]);_0x3a8501[_0x22c1('0x1b')]=qs[_0x22c1('0x1b')](_0x5e4fb3['query']['offset']);}_0x3a8501[_0x22c1('0x3a')]=qs[_0x22c1('0x3b')](_0x5e4fb3[_0x22c1('0x32')][_0x22c1('0x3b')]);_0x3a8501[_0x22c1('0x3c')]=qs['filters'](_['pick'](_0x5e4fb3['query'],_0x3fd007['filters']),_0x102b21);if(_0x5e4fb3['query'][_0x22c1('0x3d')]){_0x3a8501[_0x22c1('0x3c')]=_['merge'](_0x3a8501[_0x22c1('0x3c')],{'$or':_[_0x22c1('0x2b')](_0x102b21,function(_0x2e2db7){if(_0x2e2db7[_0x22c1('0x2f')]!==_0x22c1('0x3e')){var _0x49a395={};_0x49a395[_0x2e2db7[_0x22c1('0x28')]]={'$like':'%'+_0x5e4fb3[_0x22c1('0x32')][_0x22c1('0x3d')]+'%'};return _0x49a395;}})});}_0x3a8501=_['merge']({},_0x3a8501,_0x5e4fb3['options']);var _0x379489={'where':_0x3a8501[_0x22c1('0x3c')]};return db['ZohoField'][_0x22c1('0x1e')](_0x379489)['then'](function(_0x249561){_0x528b35[_0x22c1('0x1e')]=_0x249561;if(_0x5e4fb3[_0x22c1('0x32')]['includeAll']){_0x3a8501[_0x22c1('0x3f')]=[{'all':!![]}];}return db[_0x22c1('0x2c')][_0x22c1('0x40')](_0x3a8501);})['then'](function(_0x31609c){_0x528b35['rows']=_0x31609c;return _0x528b35;})[_0x22c1('0x24')](respondWithFilteredResult(_0x2356c0,_0x3a8501))[_0x22c1('0x41')](handleError(_0x2356c0,null));};exports[_0x22c1('0x42')]=function(_0x58b0b6,_0x15029a){var _0x21f1c1={'raw':!![],'where':{'id':_0x58b0b6[_0x22c1('0x43')]['id']}},_0x5549c5={};_0x5549c5[_0x22c1('0x31')]=_[_0x22c1('0x44')](db['ZohoField'][_0x22c1('0x2d')]);_0x5549c5[_0x22c1('0x32')]=_[_0x22c1('0x44')](_0x58b0b6[_0x22c1('0x32')]);_0x5549c5[_0x22c1('0x33')]=_[_0x22c1('0x34')](_0x5549c5[_0x22c1('0x31')],_0x5549c5[_0x22c1('0x32')]);_0x21f1c1[_0x22c1('0x35')]=_[_0x22c1('0x34')](_0x5549c5[_0x22c1('0x31')],qs[_0x22c1('0x36')](_0x58b0b6[_0x22c1('0x32')][_0x22c1('0x36')]));_0x21f1c1['attributes']=_0x21f1c1[_0x22c1('0x35')][_0x22c1('0x37')]?_0x21f1c1['attributes']:_0x5549c5[_0x22c1('0x31')];if(_0x58b0b6[_0x22c1('0x32')][_0x22c1('0x45')]){_0x21f1c1['include']=[{'all':!![]}];}_0x21f1c1=_[_0x22c1('0x46')]({},_0x21f1c1,_0x58b0b6[_0x22c1('0x47')]);return db[_0x22c1('0x2c')][_0x22c1('0x48')](_0x21f1c1)[_0x22c1('0x24')](handleEntityNotFound(_0x15029a,null))[_0x22c1('0x24')](respondWithResult(_0x15029a,null))[_0x22c1('0x41')](handleError(_0x15029a,null));};exports[_0x22c1('0x49')]=function(_0x5c7a85,_0x347920){return db[_0x22c1('0x2c')]['create'](_0x5c7a85[_0x22c1('0x4a')],{})['then'](respondWithResult(_0x347920,0xc9))[_0x22c1('0x41')](handleError(_0x347920,null));};exports[_0x22c1('0x23')]=function(_0x26c224,_0xdc512e){if(_0x26c224[_0x22c1('0x4a')]['id']){delete _0x26c224[_0x22c1('0x4a')]['id'];}return db[_0x22c1('0x2c')][_0x22c1('0x48')]({'where':{'id':_0x26c224[_0x22c1('0x43')]['id']}})[_0x22c1('0x24')](handleEntityNotFound(_0xdc512e,null))[_0x22c1('0x24')](saveUpdates(_0x26c224[_0x22c1('0x4a')],null))[_0x22c1('0x24')](respondWithResult(_0xdc512e,null))[_0x22c1('0x41')](handleError(_0xdc512e,null));};exports[_0x22c1('0x25')]=function(_0x2b70f0,_0x38bab7){return db[_0x22c1('0x2c')][_0x22c1('0x48')]({'where':{'id':_0x2b70f0[_0x22c1('0x43')]['id']}})[_0x22c1('0x24')](handleEntityNotFound(_0x38bab7,null))[_0x22c1('0x24')](removeEntity(_0x38bab7,null))[_0x22c1('0x41')](handleError(_0x38bab7,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b5fe4ac..5989c79 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 _0xa46e=['path','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0xda0921,_0x11bd63){var _0xf871d9=function(_0xff395f){while(--_0xff395f){_0xda0921['push'](_0xda0921['shift']());}};_0xf871d9(++_0x11bd63);}(_0xa46e,0x8a));var _0xea46=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0xa46e[_0x7538c5];return _0x8b56be;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intZohoField.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('ZohoField',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xb'),_0xea46('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x49f444,_0x202ceb){var _0x3897a6=function(_0x34e4ba){while(--_0x34e4ba){_0x49f444['push'](_0x49f444['shift']());}};_0x3897a6(++_0x202ceb);}(_0x687b,0x14a));var _0xb687=function(_0xa59345,_0x86f01c){_0xa59345=_0xa59345-0x0;var _0x22fc32=_0x687b[_0xa59345];return _0x22fc32;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 395767c..bc7d10f 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 _0xa9ec=['error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x305d8c,_0x153576){var _0x1e6143=function(_0x30913b){while(--_0x30913b){_0x305d8c['push'](_0x305d8c['shift']());}};_0x1e6143(++_0x153576);}(_0xa9ec,0x1f1));var _0xca9e=function(_0x451539,_0x4ddef2){_0x451539=_0x451539-0x0;var _0x290fd9=_0xa9ec[_0x451539];return _0x290fd9;};'use strict';var _=require('lodash');var util=require(_0xca9e('0x0'));var moment=require('moment');var BPromise=require(_0xca9e('0x1'));var rs=require(_0xca9e('0x2'));var fs=require('fs');var Redis=require(_0xca9e('0x3'));var db=require(_0xca9e('0x4'))['db'];var utils=require(_0xca9e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xca9e('0x6'));var jayson=require(_0xca9e('0x7'));var client=jayson[_0xca9e('0x8')][_0xca9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c28c9,_0x1c329f,_0x3cf2e8){return new BPromise(function(_0x29400c,_0x502d75){return client['request'](_0x4c28c9,_0x3cf2e8)[_0xca9e('0xa')](function(_0x228001){logger['info'](_0xca9e('0xb'),_0x1c329f,_0xca9e('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x1c329f,_0xca9e('0xc'),JSON['stringify'](_0x228001));if(_0x228001['error']){if(_0x228001[_0xca9e('0xd')][_0xca9e('0xe')]===0x1f4){logger[_0xca9e('0xd')](_0xca9e('0xb'),_0x1c329f,_0x228001[_0xca9e('0xd')]['message']);return _0x502d75(_0x228001[_0xca9e('0xd')][_0xca9e('0xf')]);}logger[_0xca9e('0xd')](_0xca9e('0xb'),_0x1c329f,_0x228001['error'][_0xca9e('0xf')]);return _0x29400c(_0x228001[_0xca9e('0xd')][_0xca9e('0xf')]);}else{logger['info'](_0xca9e('0xb'),_0x1c329f,'request\x20sent');_0x29400c(_0x228001['result'][_0xca9e('0xf')]);}})[_0xca9e('0x10')](function(_0x1731f1){logger[_0xca9e('0xd')](_0xca9e('0xb'),_0x1c329f,_0x1731f1);_0x502d75(_0x1731f1);});});} \ No newline at end of file +var _0x6910=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1462d7,_0x5c8b0e){var _0x41ceb2=function(_0x35f459){while(--_0x35f459){_0x1462d7['push'](_0x1462d7['shift']());}};_0x41ceb2(++_0x5c8b0e);}(_0x6910,0x1bf));var _0x0691=function(_0x3d69f9,_0x24daed){_0x3d69f9=_0x3d69f9-0x0;var _0x386964=_0x6910[_0x3d69f9];return _0x386964;};'use strict';var _=require(_0x0691('0x0'));var util=require(_0x0691('0x1'));var moment=require(_0x0691('0x2'));var BPromise=require(_0x0691('0x3'));var rs=require(_0x0691('0x4'));var fs=require('fs');var Redis=require(_0x0691('0x5'));var db=require(_0x0691('0x6'))['db'];var utils=require(_0x0691('0x7'));var logger=require('../../config/logger')(_0x0691('0x8'));var config=require('../../config/environment');var jayson=require(_0x0691('0x9'));var client=jayson[_0x0691('0xa')][_0x0691('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x854c7a,_0x36d2ac,_0x1f46f3){return new BPromise(function(_0x1f3d49,_0x10ed1f){return client[_0x0691('0xc')](_0x854c7a,_0x1f46f3)[_0x0691('0xd')](function(_0x396f84){logger[_0x0691('0xe')](_0x0691('0xf'),_0x36d2ac,_0x0691('0x10'));logger[_0x0691('0x11')](_0x0691('0x12'),_0x36d2ac,'request\x20sent',JSON[_0x0691('0x13')](_0x396f84));if(_0x396f84[_0x0691('0x14')]){if(_0x396f84[_0x0691('0x14')][_0x0691('0x15')]===0x1f4){logger[_0x0691('0x14')](_0x0691('0xf'),_0x36d2ac,_0x396f84[_0x0691('0x14')][_0x0691('0x16')]);return _0x10ed1f(_0x396f84[_0x0691('0x14')][_0x0691('0x16')]);}logger[_0x0691('0x14')](_0x0691('0xf'),_0x36d2ac,_0x396f84[_0x0691('0x14')]['message']);return _0x1f3d49(_0x396f84[_0x0691('0x14')]['message']);}else{logger[_0x0691('0xe')](_0x0691('0xf'),_0x36d2ac,_0x0691('0x10'));_0x1f3d49(_0x396f84[_0x0691('0x17')][_0x0691('0x16')]);}})[_0x0691('0x18')](function(_0x5a805d){logger['error'](_0x0691('0xf'),_0x36d2ac,_0x5a805d);_0x10ed1f(_0x5a805d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7fba566..208a5ad 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x371585,_0x43c516){var _0x59fb00=function(_0x88540f){while(--_0x88540f){_0x371585['push'](_0x371585['shift']());}};_0x59fb00(++_0x43c516);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x5a2839,_0x10ee43){var _0x48cc3b=function(_0x127fde){while(--_0x127fde){_0x5a2839['push'](_0x5a2839['shift']());}};_0x48cc3b(++_0x10ee43);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0xcb91[_0x51639a];return _0x3abae4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 03be8f1..e9d8302 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 _0x85f1=['exports','STRING','unique_name_and_version','app.js','state','sequelize'];(function(_0x4ea809,_0x5416a6){var _0x31be45=function(_0x347d68){while(--_0x347d68){_0x4ea809['push'](_0x4ea809['shift']());}};_0x31be45(++_0x5416a6);}(_0x85f1,0x8f));var _0x185f=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x85f1[_0x202c61];return _0x540691;};'use strict';var Sequelize=require(_0x185f('0x0'));module[_0x185f('0x1')]={'name':{'type':Sequelize[_0x185f('0x2')],'allowNull':![],'unique':_0x185f('0x3')},'version':{'type':Sequelize[_0x185f('0x2')],'allowNull':![],'unique':_0x185f('0x3')},'main':{'type':Sequelize[_0x185f('0x2')],'defaultValue':_0x185f('0x4')},'filename':{'type':Sequelize[_0x185f('0x2')]},'path':{'type':Sequelize[_0x185f('0x2')]},'type':{'type':Sequelize[_0x185f('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x185f('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x185f('0x2')],'unique':_0x185f('0x5')},'description':{'type':Sequelize[_0x185f('0x2')]},'title':{'type':Sequelize[_0x185f('0x2')]},'remoteUri':{'type':Sequelize[_0x185f('0x2')]},'link':{'type':Sequelize[_0x185f('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x60c9=['STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize','exports'];(function(_0x463b56,_0x38026e){var _0x1b47d6=function(_0xc7b623){while(--_0xc7b623){_0x463b56['push'](_0x463b56['shift']());}};_0x1b47d6(++_0x38026e);}(_0x60c9,0x116));var _0x960c=function(_0x13aa39,_0xd235cc){_0x13aa39=_0x13aa39-0x0;var _0x2269bb=_0x60c9[_0x13aa39];return _0x2269bb;};'use strict';var Sequelize=require(_0x960c('0x0'));module[_0x960c('0x1')]={'name':{'type':Sequelize[_0x960c('0x2')],'allowNull':![],'unique':_0x960c('0x3')},'version':{'type':Sequelize[_0x960c('0x2')],'allowNull':![],'unique':_0x960c('0x3')},'main':{'type':Sequelize[_0x960c('0x2')],'defaultValue':_0x960c('0x4')},'filename':{'type':Sequelize[_0x960c('0x2')]},'path':{'type':Sequelize[_0x960c('0x2')]},'type':{'type':Sequelize[_0x960c('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x960c('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x960c('0x2')]},'state':{'type':Sequelize[_0x960c('0x2')],'unique':_0x960c('0x6')},'description':{'type':Sequelize[_0x960c('0x2')]},'title':{'type':Sequelize[_0x960c('0x2')]},'remoteUri':{'type':Sequelize[_0x960c('0x2')]},'link':{'type':Sequelize[_0x960c('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 f3c1d50..741a318 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0x9582,0x95));var _0x2958=function(_0x1afe73,_0x22e143){_0x1afe73=_0x1afe73-0x0;var _0x51e323=_0x9582[_0x1afe73];return _0x51e323;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file +var _0x4c60=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','Integration','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x4c60,0xc1));var _0x04c6=function(_0x2adac1,_0x272a6d){_0x2adac1=_0x2adac1-0x0;var _0x39473e=_0x4c60[_0x2adac1];return _0x39473e;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['Integration'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['Integration'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['Integration'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['Integration'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['Integration'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 86f5bfa..60c3583 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 _0xdf6e=['integrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','define','Integration'];(function(_0x4f6ad3,_0xe7e40d){var _0x305669=function(_0x1fae11){while(--_0x1fae11){_0x4f6ad3['push'](_0x4f6ad3['shift']());}};_0x305669(++_0xe7e40d);}(_0xdf6e,0x199));var _0xedf6=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xdf6e[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xedf6('0x0'));var util=require(_0xedf6('0x1'));var logger=require(_0xedf6('0x2'))('api');var moment=require(_0xedf6('0x3'));var BPromise=require(_0xedf6('0x4'));var rp=require(_0xedf6('0x5'));var fs=require('fs');var path=require(_0xedf6('0x6'));var rimraf=require('rimraf');var config=require(_0xedf6('0x7'));var attributes=require(_0xedf6('0x8'));module['exports']=function(_0x44ed19,_0xc1b5d4){return _0x44ed19[_0xedf6('0x9')](_0xedf6('0xa'),attributes,{'tableName':_0xedf6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79b3=['define','Integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x592c1d,_0x260c6c){var _0xc71bff=function(_0x40572f){while(--_0x40572f){_0x592c1d['push'](_0x592c1d['shift']());}};_0xc71bff(++_0x260c6c);}(_0x79b3,0xfe));var _0x379b=function(_0x4af4e4,_0x4e63d5){_0x4af4e4=_0x4af4e4-0x0;var _0x1bc967=_0x79b3[_0x4af4e4];return _0x1bc967;};'use strict';var _=require('lodash');var util=require(_0x379b('0x0'));var logger=require(_0x379b('0x1'))(_0x379b('0x2'));var moment=require(_0x379b('0x3'));var BPromise=require(_0x379b('0x4'));var rp=require(_0x379b('0x5'));var fs=require('fs');var path=require(_0x379b('0x6'));var rimraf=require(_0x379b('0x7'));var config=require(_0x379b('0x8'));var attributes=require('./integration.attributes');module[_0x379b('0x9')]=function(_0x381825,_0x13e37b){return _0x381825[_0x379b('0xa')](_0x379b('0xb'),attributes,{'tableName':'integrations','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 cce047e..02e74e1 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 _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x0b0e[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5e9646,_0x901c22){var _0x48ffe2=function(_0x288512){while(--_0x288512){_0x5e9646['push'](_0x5e9646['shift']());}};_0x48ffe2(++_0x901c22);}(_0x0295,0x1f0));var _0x5029=function(_0x3bac05,_0xe3556a){_0x3bac05=_0x3bac05-0x0;var _0x5bc64b=_0x0295[_0x3bac05];return _0x5bc64b;};'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')]('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 57b810e..2cc6534 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'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('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4bdea2,_0x310252){_0x4bdea2=_0x4bdea2-0x0;var _0x535839=_0x5f2f[_0x4bdea2];return _0x535839;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c7202f3..94be2e7 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 _0x0765=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0xa4c607,_0x3a1e0c){var _0x1049dc=function(_0x309a09){while(--_0x309a09){_0xa4c607['push'](_0xa4c607['shift']());}};_0x1049dc(++_0x3a1e0c);}(_0x0765,0x6f));var _0x5076=function(_0x2e759f,_0x3d5224){_0x2e759f=_0x2e759f-0x0;var _0x505f7d=_0x0765[_0x2e759f];return _0x505f7d;};'use strict';var Sequelize=require(_0x5076('0x0'));module[_0x5076('0x1')]={'integration':{'type':Sequelize[_0x5076('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x5076('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x5076('0x3')]},'contacts':{'type':Sequelize[_0x5076('0x2')]},'uniqueid':{'type':Sequelize[_0x5076('0x2')]},'calleridnum':{'type':Sequelize[_0x5076('0x2')]},'calleridname':{'type':Sequelize[_0x5076('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5076('0x2')]},'membername':{'type':Sequelize[_0x5076('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5076('0x4')]},'agentconnectAt':{'type':Sequelize[_0x5076('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5076('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5076('0x4')]},'talktime':{'type':Sequelize[_0x5076('0x3')]},'agentacw':{'type':Sequelize[_0x5076('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5076('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x5076('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5076('0x4')]},'agentdump':{'type':Sequelize[_0x5076('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5076('0x4')]},'lastevent':{'type':Sequelize[_0x5076('0x2')]},'channel':{'type':Sequelize[_0x5076('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5076('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5076('0x2')]},'language':{'type':Sequelize[_0x5076('0x2')]},'accountcode':{'type':Sequelize[_0x5076('0x2')]},'context':{'type':Sequelize[_0x5076('0x2')]},'exten':{'type':Sequelize[_0x5076('0x2')]},'priority':{'type':Sequelize[_0x5076('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x5076('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5076('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5076('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5076('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5076('0x2')]},'destaccountcode':{'type':Sequelize[_0x5076('0x2')]},'destcontext':{'type':Sequelize[_0x5076('0x2')]},'destexten':{'type':Sequelize[_0x5076('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5076('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x5076('0x2')]},'to':{'type':Sequelize[_0x5076('0x2')]},'cc':{'type':Sequelize[_0x5076('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x5076('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x5076('0x7')](_0x5076('0x8'),_0x5076('0x9'),'RECEIVED',_0x5076('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x5076('0x2')]},'appdata':{'type':Sequelize[_0x5076('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe7ac=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x51d8cd,_0x58bda1){var _0x305620=function(_0x3aefc9){while(--_0x3aefc9){_0x51d8cd['push'](_0x51d8cd['shift']());}};_0x305620(++_0x58bda1);}(_0xe7ac,0xc7));var _0xce7a=function(_0x39072c,_0x592929){_0x39072c=_0x39072c-0x0;var _0xb7a23f=_0xe7ac[_0x39072c];return _0xb7a23f;};'use strict';var Sequelize=require(_0xce7a('0x0'));module[_0xce7a('0x1')]={'integration':{'type':Sequelize[_0xce7a('0x2')]},'eventChannel':{'type':Sequelize[_0xce7a('0x2')]},'exitStatus':{'type':Sequelize[_0xce7a('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xce7a('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xce7a('0x2')]},'interface':{'type':Sequelize[_0xce7a('0x2')]},'membername':{'type':Sequelize[_0xce7a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xce7a('0x4')]},'agentconnectAt':{'type':Sequelize[_0xce7a('0x4')]},'holdtime':{'type':Sequelize[_0xce7a('0x3')]},'agentcomplete':{'type':Sequelize[_0xce7a('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xce7a('0x4')]},'talktime':{'type':Sequelize[_0xce7a('0x3')]},'agentacw':{'type':Sequelize[_0xce7a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xce7a('0x3')]},'reason':{'type':Sequelize[_0xce7a('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xce7a('0x4')]},'agentdump':{'type':Sequelize[_0xce7a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xce7a('0x4')]},'lastevent':{'type':Sequelize[_0xce7a('0x2')]},'channel':{'type':Sequelize[_0xce7a('0x2')]},'channelstate':{'type':Sequelize[_0xce7a('0x3')]},'channelstatedesc':{'type':Sequelize[_0xce7a('0x2')]},'connectedlinenum':{'type':Sequelize[_0xce7a('0x2')]},'connectedlinename':{'type':Sequelize[_0xce7a('0x2')]},'language':{'type':Sequelize[_0xce7a('0x2')]},'accountcode':{'type':Sequelize[_0xce7a('0x2')]},'context':{'type':Sequelize[_0xce7a('0x2')]},'exten':{'type':Sequelize[_0xce7a('0x2')]},'priority':{'type':Sequelize[_0xce7a('0x2')]},'destchannel':{'type':Sequelize[_0xce7a('0x2')]},'destchannelstate':{'type':Sequelize[_0xce7a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xce7a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xce7a('0x2')]},'destcalleridname':{'type':Sequelize[_0xce7a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xce7a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xce7a('0x2')]},'destlanguage':{'type':Sequelize[_0xce7a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xce7a('0x2')]},'destexten':{'type':Sequelize[_0xce7a('0x2')]},'destpriority':{'type':Sequelize[_0xce7a('0x2')]},'destuniqueid':{'type':Sequelize[_0xce7a('0x2')]},'messageId':{'type':Sequelize[_0xce7a('0x2')]},'inReplyTo':{'type':Sequelize[_0xce7a('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xce7a('0x2')]},'to':{'type':Sequelize[_0xce7a('0x2')]},'cc':{'type':Sequelize[_0xce7a('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xce7a('0x6')]},'text':{'type':Sequelize[_0xce7a('0x6')]},'status':{'type':Sequelize[_0xce7a('0x7')]('SENT',_0xce7a('0x8'),_0xce7a('0x9'),_0xce7a('0xa'))},'url':{'type':Sequelize[_0xce7a('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xce7a('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e5e6b7b..1be5abd 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 _0x5916=['apply','destroy','then','error','name','send','index','map','IntegrationReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x2ea675,_0x592a27){var _0x20d00c=function(_0x6b22da){while(--_0x6b22da){_0x2ea675['push'](_0x2ea675['shift']());}};_0x20d00c(++_0x592a27);}(_0x5916,0x190));var _0x6591=function(_0x543302,_0x123ff9){_0x543302=_0x543302-0x0;var _0x81117=_0x5916[_0x543302];return _0x81117;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6591('0x0'));var zipdir=require(_0x6591('0x1'));var jsonpatch=require(_0x6591('0x2'));var rp=require(_0x6591('0x3'));var moment=require(_0x6591('0x4'));var BPromise=require(_0x6591('0x5'));var Mustache=require('mustache');var util=require(_0x6591('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6591('0x7'));var ejs=require(_0x6591('0x8'));var fs=require('fs');var fs_extra=require(_0x6591('0x9'));var _=require(_0x6591('0xa'));var squel=require(_0x6591('0xb'));var crypto=require('crypto');var jsforce=require(_0x6591('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6591('0x7'));var querystring=require(_0x6591('0xd'));var Papa=require(_0x6591('0xe'));var Redis=require(_0x6591('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6591('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6591('0x11'))(_0x6591('0x12'));var utils=require(_0x6591('0x13'));var config=require(_0x6591('0x14'));var licenseUtil=require(_0x6591('0x15'));var db=require(_0x6591('0x16'))['db'];function respondWithStatusCode(_0x3df963,_0x39f875){_0x39f875=_0x39f875||0xcc;return function(_0x2f0285){if(_0x2f0285){return _0x3df963[_0x6591('0x17')](_0x39f875);}return _0x3df963[_0x6591('0x18')](_0x39f875)[_0x6591('0x19')]();};}function respondWithResult(_0x12d3cf,_0x1b667d){_0x1b667d=_0x1b667d||0xc8;return function(_0x309509){if(_0x309509){return _0x12d3cf['status'](_0x1b667d)[_0x6591('0x1a')](_0x309509);}};}function respondWithFilteredResult(_0x3a5d0a,_0x569c9f){return function(_0x2db4df){if(_0x2db4df){var _0x349953=typeof _0x569c9f[_0x6591('0x1b')]==='undefined'&&typeof _0x569c9f[_0x6591('0x1c')]==='undefined';var _0x4c0845=_0x2db4df[_0x6591('0x1d')];var _0x2bd394=_0x349953?0x0:_0x569c9f[_0x6591('0x1b')];var _0x5f53da=_0x349953?_0x2db4df[_0x6591('0x1d')]:_0x569c9f[_0x6591('0x1b')]+_0x569c9f[_0x6591('0x1c')];var _0x2e2647;if(_0x5f53da>=_0x4c0845){_0x5f53da=_0x4c0845;_0x2e2647=0xc8;}else{_0x2e2647=0xce;}_0x3a5d0a['status'](_0x2e2647);return _0x3a5d0a[_0x6591('0x1e')](_0x6591('0x1f'),_0x2bd394+'-'+_0x5f53da+'/'+_0x4c0845)[_0x6591('0x1a')](_0x2db4df);}return null;};}function patchUpdates(_0x47db78){return function(_0x2db586){try{jsonpatch[_0x6591('0x20')](_0x2db586,_0x47db78,!![]);}catch(_0xbe900d){return BPromise['reject'](_0xbe900d);}return _0x2db586['save']();};}function saveUpdates(_0x350ccc,_0x2a0c54){return function(_0x3584fe){if(_0x3584fe){return _0x3584fe['update'](_0x350ccc)['then'](function(_0x29d579){return _0x29d579;});}return null;};}function removeEntity(_0xeedbd6,_0x5d3514){return function(_0x4edc66){if(_0x4edc66){return _0x4edc66[_0x6591('0x21')]()[_0x6591('0x22')](function(){_0xeedbd6[_0x6591('0x18')](0xcc)[_0x6591('0x19')]();});}};}function handleEntityNotFound(_0xdcb68b,_0x370751){return function(_0x32e5d7){if(!_0x32e5d7){_0xdcb68b[_0x6591('0x17')](0x194);}return _0x32e5d7;};}function handleError(_0x24e18b,_0x41b575){_0x41b575=_0x41b575||0x1f4;return function(_0x5de44d){logger[_0x6591('0x23')](_0x5de44d['stack']);if(_0x5de44d['name']){delete _0x5de44d[_0x6591('0x24')];}_0x24e18b[_0x6591('0x18')](_0x41b575)[_0x6591('0x25')](_0x5de44d);};}exports[_0x6591('0x26')]=function(_0x44f763,_0x155484){var _0x45deb2={},_0xc77f63={},_0x103529={'count':0x0,'rows':[]};var _0x2642b0=_[_0x6591('0x27')](db[_0x6591('0x28')][_0x6591('0x29')],function(_0x4d2ffd){return{'name':_0x4d2ffd['fieldName'],'type':_0x4d2ffd[_0x6591('0x2a')]['key']};});_0xc77f63[_0x6591('0x2b')]=_[_0x6591('0x27')](_0x2642b0,_0x6591('0x24'));_0xc77f63[_0x6591('0x2c')]=_['keys'](_0x44f763['query']);_0xc77f63[_0x6591('0x2d')]=_[_0x6591('0x2e')](_0xc77f63[_0x6591('0x2b')],_0xc77f63['query']);_0x45deb2[_0x6591('0x2f')]=_['intersection'](_0xc77f63[_0x6591('0x2b')],qs[_0x6591('0x30')](_0x44f763['query'][_0x6591('0x30')]));_0x45deb2[_0x6591('0x2f')]=_0x45deb2[_0x6591('0x2f')][_0x6591('0x31')]?_0x45deb2['attributes']:_0xc77f63[_0x6591('0x2b')];if(!_0x44f763['query']['hasOwnProperty'](_0x6591('0x32'))){_0x45deb2[_0x6591('0x1c')]=qs[_0x6591('0x1c')](_0x44f763['query']['limit']);_0x45deb2[_0x6591('0x1b')]=qs[_0x6591('0x1b')](_0x44f763[_0x6591('0x2c')][_0x6591('0x1b')]);}_0x45deb2[_0x6591('0x33')]=qs[_0x6591('0x34')](_0x44f763['query'][_0x6591('0x34')]);_0x45deb2[_0x6591('0x35')]=qs[_0x6591('0x2d')](_[_0x6591('0x36')](_0x44f763[_0x6591('0x2c')],_0xc77f63[_0x6591('0x2d')]),_0x2642b0);if(_0x44f763[_0x6591('0x2c')][_0x6591('0x37')]){_0x45deb2['where']=_[_0x6591('0x38')](_0x45deb2[_0x6591('0x35')],{'$or':_[_0x6591('0x27')](_0x2642b0,function(_0x476272){if(_0x476272[_0x6591('0x2a')]!==_0x6591('0x39')){var _0x501527={};_0x501527[_0x476272[_0x6591('0x24')]]={'$like':'%'+_0x44f763[_0x6591('0x2c')][_0x6591('0x37')]+'%'};return _0x501527;}})});}_0x45deb2=_[_0x6591('0x38')]({},_0x45deb2,_0x44f763[_0x6591('0x3a')]);var _0x5a1d87={'where':_0x45deb2[_0x6591('0x35')]};return db['IntegrationReport'][_0x6591('0x1d')](_0x5a1d87)[_0x6591('0x22')](function(_0x260e54){_0x103529['count']=_0x260e54;if(_0x44f763[_0x6591('0x2c')]['includeAll']){_0x45deb2[_0x6591('0x3b')]=[{'all':!![]}];}return db[_0x6591('0x28')][_0x6591('0x3c')](_0x45deb2);})[_0x6591('0x22')](function(_0x21d9fe){_0x103529[_0x6591('0x3d')]=_0x21d9fe;return _0x103529;})[_0x6591('0x22')](respondWithFilteredResult(_0x155484,_0x45deb2))['catch'](handleError(_0x155484,null));};exports[_0x6591('0x3e')]=function(_0x486ae0,_0x303482){var _0x54e977={'raw':![],'where':{'id':_0x486ae0[_0x6591('0x3f')]['id']}},_0x3eb69a={};_0x3eb69a[_0x6591('0x2b')]=_[_0x6591('0x40')](db[_0x6591('0x28')][_0x6591('0x29')]);_0x3eb69a[_0x6591('0x2c')]=_[_0x6591('0x40')](_0x486ae0['query']);_0x3eb69a[_0x6591('0x2d')]=_[_0x6591('0x2e')](_0x3eb69a['model'],_0x3eb69a[_0x6591('0x2c')]);_0x54e977[_0x6591('0x2f')]=_[_0x6591('0x2e')](_0x3eb69a[_0x6591('0x2b')],qs[_0x6591('0x30')](_0x486ae0[_0x6591('0x2c')][_0x6591('0x30')]));_0x54e977[_0x6591('0x2f')]=_0x54e977[_0x6591('0x2f')][_0x6591('0x31')]?_0x54e977[_0x6591('0x2f')]:_0x3eb69a[_0x6591('0x2b')];if(_0x486ae0['query'][_0x6591('0x41')]){_0x54e977[_0x6591('0x3b')]=[{'all':!![]}];}_0x54e977=_['merge']({},_0x54e977,_0x486ae0[_0x6591('0x3a')]);return db[_0x6591('0x28')][_0x6591('0x42')](_0x54e977)[_0x6591('0x22')](handleEntityNotFound(_0x303482,null))[_0x6591('0x22')](respondWithResult(_0x303482,null))[_0x6591('0x43')](handleError(_0x303482,null));};exports[_0x6591('0x44')]=function(_0x197b2d,_0x434d36){return db['IntegrationReport'][_0x6591('0x44')](_0x197b2d[_0x6591('0x45')],{})['then'](respondWithResult(_0x434d36,0xc9))[_0x6591('0x43')](handleError(_0x434d36,null));};exports[_0x6591('0x46')]=function(_0x2e44bb,_0x2681be){if(_0x2e44bb[_0x6591('0x45')]['id']){delete _0x2e44bb[_0x6591('0x45')]['id'];}return db[_0x6591('0x28')]['find']({'where':{'id':_0x2e44bb[_0x6591('0x3f')]['id']}})[_0x6591('0x22')](handleEntityNotFound(_0x2681be,null))[_0x6591('0x22')](saveUpdates(_0x2e44bb[_0x6591('0x45')],null))[_0x6591('0x22')](respondWithResult(_0x2681be,null))[_0x6591('0x43')](handleError(_0x2681be,null));};exports[_0x6591('0x21')]=function(_0x1908ee,_0x81ca04){return db['IntegrationReport']['find']({'where':{'id':_0x1908ee[_0x6591('0x3f')]['id']}})[_0x6591('0x22')](handleEntityNotFound(_0x81ca04,null))['then'](removeEntity(_0x81ca04,null))[_0x6591('0x43')](handleError(_0x81ca04,null));};exports[_0x6591('0x47')]=function(_0x4b5213,_0xa6c6b8){return db[_0x6591('0x28')]['describe']()[_0x6591('0x22')](respondWithResult(_0xa6c6b8,null))['catch'](handleError(_0xa6c6b8,null));}; \ No newline at end of file +var _0xb629=['save','update','then','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x2e7ac5,_0x17e9b0){var _0x3a7387=function(_0x372fe3){while(--_0x372fe3){_0x2e7ac5['push'](_0x2e7ac5['shift']());}};_0x3a7387(++_0x17e9b0);}(_0xb629,0xba));var _0x9b62=function(_0x4884d9,_0x324448){_0x4884d9=_0x4884d9-0x0;var _0x1c9176=_0xb629[_0x4884d9];return _0x1c9176;};'use strict';var emlformat=require(_0x9b62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b62('0x1'));var jsonpatch=require(_0x9b62('0x2'));var rp=require(_0x9b62('0x3'));var moment=require('moment');var BPromise=require(_0x9b62('0x4'));var Mustache=require(_0x9b62('0x5'));var util=require(_0x9b62('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9b62('0x7'));var fs=require('fs');var fs_extra=require(_0x9b62('0x8'));var _=require(_0x9b62('0x9'));var squel=require(_0x9b62('0xa'));var crypto=require(_0x9b62('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9b62('0xc'));var toCsv=require(_0x9b62('0xd'));var querystring=require(_0x9b62('0xe'));var Papa=require(_0x9b62('0xf'));var Redis=require(_0x9b62('0x10'));var authService=require(_0x9b62('0x11'));var qs=require(_0x9b62('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b62('0x13'));var logger=require(_0x9b62('0x14'))('api');var utils=require(_0x9b62('0x15'));var config=require(_0x9b62('0x16'));var licenseUtil=require(_0x9b62('0x17'));var db=require(_0x9b62('0x18'))['db'];function respondWithStatusCode(_0x291209,_0x42e4f5){_0x42e4f5=_0x42e4f5||0xcc;return function(_0x49d01a){if(_0x49d01a){return _0x291209['sendStatus'](_0x42e4f5);}return _0x291209[_0x9b62('0x19')](_0x42e4f5)[_0x9b62('0x1a')]();};}function respondWithResult(_0x42904a,_0x5d1753){_0x5d1753=_0x5d1753||0xc8;return function(_0xe81876){if(_0xe81876){return _0x42904a[_0x9b62('0x19')](_0x5d1753)['json'](_0xe81876);}};}function respondWithFilteredResult(_0x730d0b,_0x4248f0){return function(_0x34090f){if(_0x34090f){var _0x7b4f9b=typeof _0x4248f0['offset']===_0x9b62('0x1b')&&typeof _0x4248f0[_0x9b62('0x1c')]===_0x9b62('0x1b');var _0x5e80ac=_0x34090f[_0x9b62('0x1d')];var _0x4609f9=_0x7b4f9b?0x0:_0x4248f0['offset'];var _0xf2ccb=_0x7b4f9b?_0x34090f[_0x9b62('0x1d')]:_0x4248f0[_0x9b62('0x1e')]+_0x4248f0[_0x9b62('0x1c')];var _0x3256c9;if(_0xf2ccb>=_0x5e80ac){_0xf2ccb=_0x5e80ac;_0x3256c9=0xc8;}else{_0x3256c9=0xce;}_0x730d0b[_0x9b62('0x19')](_0x3256c9);return _0x730d0b[_0x9b62('0x1f')](_0x9b62('0x20'),_0x4609f9+'-'+_0xf2ccb+'/'+_0x5e80ac)[_0x9b62('0x21')](_0x34090f);}return null;};}function patchUpdates(_0xd40e33){return function(_0x339325){try{jsonpatch[_0x9b62('0x22')](_0x339325,_0xd40e33,!![]);}catch(_0x73f5cc){return BPromise[_0x9b62('0x23')](_0x73f5cc);}return _0x339325[_0x9b62('0x24')]();};}function saveUpdates(_0x1cb6cc,_0x4227b4){return function(_0x2410d8){if(_0x2410d8){return _0x2410d8[_0x9b62('0x25')](_0x1cb6cc)[_0x9b62('0x26')](function(_0xb86c65){return _0xb86c65;});}return null;};}function removeEntity(_0x5d99a6,_0x4b8a85){return function(_0x58d681){if(_0x58d681){return _0x58d681[_0x9b62('0x27')]()['then'](function(){_0x5d99a6[_0x9b62('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4ebb,_0x24d9a0){return function(_0x5a9493){if(!_0x5a9493){_0x3d4ebb['sendStatus'](0x194);}return _0x5a9493;};}function handleError(_0x467f04,_0x49c4e0){_0x49c4e0=_0x49c4e0||0x1f4;return function(_0xe485d){logger[_0x9b62('0x28')](_0xe485d['stack']);if(_0xe485d[_0x9b62('0x29')]){delete _0xe485d['name'];}_0x467f04[_0x9b62('0x19')](_0x49c4e0)[_0x9b62('0x2a')](_0xe485d);};}exports[_0x9b62('0x2b')]=function(_0x353e06,_0x59095f){var _0x606aa={},_0x1be466={},_0x17b1b5={'count':0x0,'rows':[]};var _0x14eb14=_[_0x9b62('0x2c')](db[_0x9b62('0x2d')][_0x9b62('0x2e')],function(_0x35cfb0){return{'name':_0x35cfb0['fieldName'],'type':_0x35cfb0[_0x9b62('0x2f')]['key']};});_0x1be466[_0x9b62('0x30')]=_['map'](_0x14eb14,'name');_0x1be466[_0x9b62('0x31')]=_[_0x9b62('0x32')](_0x353e06[_0x9b62('0x31')]);_0x1be466[_0x9b62('0x33')]=_['intersection'](_0x1be466[_0x9b62('0x30')],_0x1be466[_0x9b62('0x31')]);_0x606aa['attributes']=_[_0x9b62('0x34')](_0x1be466[_0x9b62('0x30')],qs[_0x9b62('0x35')](_0x353e06[_0x9b62('0x31')][_0x9b62('0x35')]));_0x606aa[_0x9b62('0x36')]=_0x606aa[_0x9b62('0x36')][_0x9b62('0x37')]?_0x606aa[_0x9b62('0x36')]:_0x1be466['model'];if(!_0x353e06[_0x9b62('0x31')]['hasOwnProperty'](_0x9b62('0x38'))){_0x606aa[_0x9b62('0x1c')]=qs[_0x9b62('0x1c')](_0x353e06['query'][_0x9b62('0x1c')]);_0x606aa['offset']=qs['offset'](_0x353e06[_0x9b62('0x31')][_0x9b62('0x1e')]);}_0x606aa[_0x9b62('0x39')]=qs[_0x9b62('0x3a')](_0x353e06[_0x9b62('0x31')][_0x9b62('0x3a')]);_0x606aa['where']=qs[_0x9b62('0x33')](_['pick'](_0x353e06[_0x9b62('0x31')],_0x1be466[_0x9b62('0x33')]),_0x14eb14);if(_0x353e06[_0x9b62('0x31')]['filter']){_0x606aa['where']=_['merge'](_0x606aa[_0x9b62('0x3b')],{'$or':_[_0x9b62('0x2c')](_0x14eb14,function(_0x2319b1){if(_0x2319b1[_0x9b62('0x2f')]!==_0x9b62('0x3c')){var _0x4f599b={};_0x4f599b[_0x2319b1['name']]={'$like':'%'+_0x353e06['query'][_0x9b62('0x3d')]+'%'};return _0x4f599b;}})});}_0x606aa=_[_0x9b62('0x3e')]({},_0x606aa,_0x353e06[_0x9b62('0x3f')]);var _0x582bed={'where':_0x606aa[_0x9b62('0x3b')]};return db[_0x9b62('0x2d')]['count'](_0x582bed)['then'](function(_0x18c01d){_0x17b1b5[_0x9b62('0x1d')]=_0x18c01d;if(_0x353e06[_0x9b62('0x31')][_0x9b62('0x40')]){_0x606aa['include']=[{'all':!![]}];}return db[_0x9b62('0x2d')][_0x9b62('0x41')](_0x606aa);})['then'](function(_0x84d8bb){_0x17b1b5['rows']=_0x84d8bb;return _0x17b1b5;})[_0x9b62('0x26')](respondWithFilteredResult(_0x59095f,_0x606aa))[_0x9b62('0x42')](handleError(_0x59095f,null));};exports[_0x9b62('0x43')]=function(_0x48137a,_0x17959f){var _0x184a40={'raw':![],'where':{'id':_0x48137a[_0x9b62('0x44')]['id']}},_0x51696f={};_0x51696f[_0x9b62('0x30')]=_[_0x9b62('0x32')](db['IntegrationReport'][_0x9b62('0x2e')]);_0x51696f[_0x9b62('0x31')]=_[_0x9b62('0x32')](_0x48137a['query']);_0x51696f['filters']=_[_0x9b62('0x34')](_0x51696f[_0x9b62('0x30')],_0x51696f['query']);_0x184a40[_0x9b62('0x36')]=_[_0x9b62('0x34')](_0x51696f[_0x9b62('0x30')],qs[_0x9b62('0x35')](_0x48137a['query'][_0x9b62('0x35')]));_0x184a40[_0x9b62('0x36')]=_0x184a40[_0x9b62('0x36')][_0x9b62('0x37')]?_0x184a40[_0x9b62('0x36')]:_0x51696f[_0x9b62('0x30')];if(_0x48137a[_0x9b62('0x31')][_0x9b62('0x40')]){_0x184a40[_0x9b62('0x45')]=[{'all':!![]}];}_0x184a40=_[_0x9b62('0x3e')]({},_0x184a40,_0x48137a[_0x9b62('0x3f')]);return db[_0x9b62('0x2d')][_0x9b62('0x46')](_0x184a40)[_0x9b62('0x26')](handleEntityNotFound(_0x17959f,null))[_0x9b62('0x26')](respondWithResult(_0x17959f,null))[_0x9b62('0x42')](handleError(_0x17959f,null));};exports[_0x9b62('0x47')]=function(_0x32ae97,_0x554e9c){return db['IntegrationReport'][_0x9b62('0x47')](_0x32ae97[_0x9b62('0x48')],{})[_0x9b62('0x26')](respondWithResult(_0x554e9c,0xc9))[_0x9b62('0x42')](handleError(_0x554e9c,null));};exports[_0x9b62('0x25')]=function(_0x1a8735,_0x27a000){if(_0x1a8735['body']['id']){delete _0x1a8735[_0x9b62('0x48')]['id'];}return db[_0x9b62('0x2d')]['find']({'where':{'id':_0x1a8735['params']['id']}})[_0x9b62('0x26')](handleEntityNotFound(_0x27a000,null))['then'](saveUpdates(_0x1a8735[_0x9b62('0x48')],null))[_0x9b62('0x26')](respondWithResult(_0x27a000,null))[_0x9b62('0x42')](handleError(_0x27a000,null));};exports['destroy']=function(_0x1706da,_0xbb7b34){return db[_0x9b62('0x2d')][_0x9b62('0x46')]({'where':{'id':_0x1706da[_0x9b62('0x44')]['id']}})['then'](handleEntityNotFound(_0xbb7b34,null))[_0x9b62('0x26')](removeEntity(_0xbb7b34,null))['catch'](handleError(_0xbb7b34,null));};exports[_0x9b62('0x49')]=function(_0x4726d2,_0x16c220){return db[_0x9b62('0x2d')][_0x9b62('0x49')]()['then'](respondWithResult(_0x16c220,null))[_0x9b62('0x42')](handleError(_0x16c220,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 427ecf1..6441c1c 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 _0x6b49=['IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0xc51a9e,_0x504130){var _0x563fab=function(_0x505d14){while(--_0x505d14){_0xc51a9e['push'](_0xc51a9e['shift']());}};_0x563fab(++_0x504130);}(_0x6b49,0x1b0));var _0x96b4=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0x6b49[_0x470f24];return _0x2c6fc8;};'use strict';var _=require(_0x96b4('0x0'));var util=require(_0x96b4('0x1'));var logger=require(_0x96b4('0x2'))(_0x96b4('0x3'));var moment=require(_0x96b4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x96b4('0x5'));var config=require(_0x96b4('0x6'));var attributes=require(_0x96b4('0x7'));module['exports']=function(_0x104d21,_0x9e0b0a){return _0x104d21['define'](_0x96b4('0x8'),attributes,{'tableName':_0x96b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f8c=['IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x5f8c,0x116));var _0xc5f8=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x5f8c[_0x5d23be];return _0x4d60a9;};'use strict';var _=require('lodash');var util=require(_0xc5f8('0x0'));var logger=require(_0xc5f8('0x1'))(_0xc5f8('0x2'));var moment=require(_0xc5f8('0x3'));var BPromise=require(_0xc5f8('0x4'));var rp=require(_0xc5f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc5f8('0x6'));var attributes=require(_0xc5f8('0x7'));module[_0xc5f8('0x8')]=function(_0x17a174,_0x62034f){return _0x17a174[_0xc5f8('0x9')](_0xc5f8('0xa'),attributes,{'tableName':_0xc5f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 9b4c046..7be196a 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4975,0x86));var _0x5497=function(_0x3b0b33,_0x2f14ee){_0x3b0b33=_0x3b0b33-0x0;var _0x5c568b=_0x4975[_0x3b0b33];return _0x5c568b;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1ee780,_0x39ef31){var _0x40ef69=function(_0x1c367d){while(--_0x1c367d){_0x1ee780['push'](_0x1ee780['shift']());}};_0x40ef69(++_0x39ef31);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2236666..57733e3 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 _0x3eea=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','addIntervals','put','update'];(function(_0x317b2e,_0x165181){var _0x1a30d6=function(_0x498315){while(--_0x498315){_0x317b2e['push'](_0x317b2e['shift']());}};_0x1a30d6(++_0x165181);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x436772,_0xadd922){_0x436772=_0x436772-0x0;var _0x678553=_0x3eea[_0x436772];return _0x678553;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['get'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router['post']('/',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0x11')]('/:id/sub_intervals',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x12')]);router['post']('/:id/sub_intervals/create_many',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x13')]);router[_0xa3ee('0x14')](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0x15')]);router['delete'](_0xa3ee('0xc'),auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x16')]);module[_0xa3ee('0x17')]=router; \ No newline at end of file +var _0xc9c3=['put','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0x5098e5,_0x3672ef){var _0xd32dc5=function(_0x15a168){while(--_0x15a168){_0x5098e5['push'](_0x5098e5['shift']());}};_0xd32dc5(++_0x3672ef);}(_0xc9c3,0x96));var _0x3c9c=function(_0x4e92a2,_0x2daa37){_0x4e92a2=_0x4e92a2-0x0;var _0x29e1db=_0xc9c3[_0x4e92a2];return _0x29e1db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x3c9c('0x1'));var router=express[_0x3c9c('0x2')]();var fs_extra=require(_0x3c9c('0x3'));var auth=require(_0x3c9c('0x4'));var interaction=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var controller=require(_0x3c9c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3c9c('0x8')](_0x3c9c('0x9'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xb')]);router[_0x3c9c('0x8')](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xd')]);router[_0x3c9c('0xe')]('/',auth[_0x3c9c('0xa')](),controller['create']);router[_0x3c9c('0xe')](_0x3c9c('0xc'),auth['isAuthenticated'](),controller[_0x3c9c('0xf')]);router['post'](_0x3c9c('0x10'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0x11')]);router[_0x3c9c('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3c9c('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3c9c('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 67cc452..7d20b03 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 _0x2c13=['STRING','exports'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x2c13,0xcf));var _0x32c1=function(_0x34d5ca,_0x460bf8){_0x34d5ca=_0x34d5ca-0x0;var _0x71b054=_0x2c13[_0x34d5ca];return _0x71b054;};'use strict';var Sequelize=require('sequelize');module[_0x32c1('0x0')]={'name':{'type':Sequelize[_0x32c1('0x1')]},'description':{'type':Sequelize[_0x32c1('0x1')]},'interval':{'type':Sequelize[_0x32c1('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xbb5d=['exports','STRING','sequelize'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xbb5d,0x11c));var _0xdbb5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbb5d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdbb5('0x0'));module[_0xdbb5('0x1')]={'name':{'type':Sequelize[_0xdbb5('0x2')]},'description':{'type':Sequelize[_0xdbb5('0x2')]},'interval':{'type':Sequelize[_0xdbb5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 5a1d2b9..1508828 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 _0xcdc7=['crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','create','getIntervals','findOne','options','nolimit','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x402b1f,_0x3df329){var _0x5d22f2=function(_0x5f17c3){while(--_0x5f17c3){_0x402b1f['push'](_0x402b1f['shift']());}};_0x5d22f2(++_0x3df329);}(_0xcdc7,0x15d));var _0x7cdc=function(_0x1ce91c,_0xdd3b2b){_0x1ce91c=_0x1ce91c-0x0;var _0x4663de=_0xcdc7[_0x1ce91c];return _0x4663de;};'use strict';var emlformat=require(_0x7cdc('0x0'));var rimraf=require(_0x7cdc('0x1'));var zipdir=require(_0x7cdc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cdc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7cdc('0x4'));var util=require(_0x7cdc('0x5'));var path=require(_0x7cdc('0x6'));var sox=require(_0x7cdc('0x7'));var csv=require(_0x7cdc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cdc('0x9'));var _=require('lodash');var squel=require(_0x7cdc('0xa'));var crypto=require(_0x7cdc('0xb'));var jsforce=require(_0x7cdc('0xc'));var deskjs=require(_0x7cdc('0xd'));var toCsv=require(_0x7cdc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7cdc('0xe'));var authService=require(_0x7cdc('0xf'));var qs=require(_0x7cdc('0x10'));var as=require(_0x7cdc('0x11'));var hardwareService=require(_0x7cdc('0x12'));var logger=require(_0x7cdc('0x13'))(_0x7cdc('0x14'));var utils=require(_0x7cdc('0x15'));var config=require(_0x7cdc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7cdc('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4611eb,_0x4f4abf){_0x4f4abf=_0x4f4abf||0xcc;return function(_0x10913e){if(_0x10913e){return _0x4611eb[_0x7cdc('0x18')](_0x4f4abf);}return _0x4611eb[_0x7cdc('0x19')](_0x4f4abf)['end']();};}function respondWithResult(_0x4fe9f2,_0x3120e3){_0x3120e3=_0x3120e3||0xc8;return function(_0x10a4d3){if(_0x10a4d3){return _0x4fe9f2[_0x7cdc('0x19')](_0x3120e3)[_0x7cdc('0x1a')](_0x10a4d3);}};}function respondWithFilteredResult(_0x348945,_0x5de54d){return function(_0x1a6cf4){if(_0x1a6cf4){var _0x52ca58=typeof _0x5de54d[_0x7cdc('0x1b')]==='undefined'&&typeof _0x5de54d['limit']==='undefined';var _0x18af45=_0x1a6cf4[_0x7cdc('0x1c')];var _0x7d222=_0x52ca58?0x0:_0x5de54d[_0x7cdc('0x1b')];var _0x5405d5=_0x52ca58?_0x1a6cf4[_0x7cdc('0x1c')]:_0x5de54d['offset']+_0x5de54d[_0x7cdc('0x1d')];var _0x4a40a1;if(_0x5405d5>=_0x18af45){_0x5405d5=_0x18af45;_0x4a40a1=0xc8;}else{_0x4a40a1=0xce;}_0x348945[_0x7cdc('0x19')](_0x4a40a1);return _0x348945[_0x7cdc('0x1e')](_0x7cdc('0x1f'),_0x7d222+'-'+_0x5405d5+'/'+_0x18af45)[_0x7cdc('0x1a')](_0x1a6cf4);}return null;};}function patchUpdates(_0x1a5b50){return function(_0x5d54ae){try{jsonpatch[_0x7cdc('0x20')](_0x5d54ae,_0x1a5b50,!![]);}catch(_0xba351c){return BPromise[_0x7cdc('0x21')](_0xba351c);}return _0x5d54ae[_0x7cdc('0x22')]();};}function saveUpdates(_0x153aa1,_0x5487ee){return function(_0x30a6c6){if(_0x30a6c6){return _0x30a6c6['update'](_0x153aa1)[_0x7cdc('0x23')](function(_0x273c79){return _0x273c79;});}return null;};}function removeEntity(_0x35e922,_0x1d2460){return function(_0x1a4723){if(_0x1a4723){return _0x1a4723[_0x7cdc('0x24')]()[_0x7cdc('0x23')](function(){var _0x2b175f=_0x1a4723[_0x7cdc('0x25')]({'plain':!![]});var _0x247d03=_0x7cdc('0x26');return db[_0x7cdc('0x27')]['destroy']({'where':{'type':_0x247d03,'resourceId':_0x2b175f['id']}})[_0x7cdc('0x23')](function(){return _0x1a4723;});})[_0x7cdc('0x23')](function(){_0x35e922['status'](0xcc)[_0x7cdc('0x28')]();});}};}function handleEntityNotFound(_0x119ec7,_0x5cae86){return function(_0x4c0477){if(!_0x4c0477){_0x119ec7[_0x7cdc('0x18')](0x194);}return _0x4c0477;};}function handleError(_0x3eca1a,_0x3b2021){_0x3b2021=_0x3b2021||0x1f4;return function(_0x3a0e3d){logger[_0x7cdc('0x29')](_0x3a0e3d[_0x7cdc('0x2a')]);if(_0x3a0e3d[_0x7cdc('0x2b')]){delete _0x3a0e3d[_0x7cdc('0x2b')];}_0x3eca1a[_0x7cdc('0x19')](_0x3b2021)['send'](_0x3a0e3d);};}exports[_0x7cdc('0x2c')]=function(_0x4472b0,_0x4d340b){var _0x1a75d9={},_0x4a2e92={},_0x2f4433={'count':0x0,'rows':[]};var _0x2a9c55=_[_0x7cdc('0x2d')](db[_0x7cdc('0x2e')][_0x7cdc('0x2f')],function(_0x4caecc){return{'name':_0x4caecc[_0x7cdc('0x30')],'type':_0x4caecc[_0x7cdc('0x31')][_0x7cdc('0x32')]};});_0x4a2e92[_0x7cdc('0x33')]=_['map'](_0x2a9c55,_0x7cdc('0x2b'));_0x4a2e92[_0x7cdc('0x34')]=_['keys'](_0x4472b0[_0x7cdc('0x34')]);_0x4a2e92[_0x7cdc('0x35')]=_[_0x7cdc('0x36')](_0x4a2e92[_0x7cdc('0x33')],_0x4a2e92[_0x7cdc('0x34')]);_0x1a75d9[_0x7cdc('0x37')]=_[_0x7cdc('0x36')](_0x4a2e92[_0x7cdc('0x33')],qs[_0x7cdc('0x38')](_0x4472b0[_0x7cdc('0x34')]['fields']));_0x1a75d9[_0x7cdc('0x37')]=_0x1a75d9[_0x7cdc('0x37')][_0x7cdc('0x39')]?_0x1a75d9[_0x7cdc('0x37')]:_0x4a2e92[_0x7cdc('0x33')];if(!_0x4472b0[_0x7cdc('0x34')][_0x7cdc('0x3a')]('nolimit')){_0x1a75d9['limit']=qs[_0x7cdc('0x1d')](_0x4472b0[_0x7cdc('0x34')][_0x7cdc('0x1d')]);_0x1a75d9[_0x7cdc('0x1b')]=qs['offset'](_0x4472b0[_0x7cdc('0x34')][_0x7cdc('0x1b')]);}_0x1a75d9[_0x7cdc('0x3b')]=qs['sort'](_0x4472b0[_0x7cdc('0x34')][_0x7cdc('0x3c')]);_0x1a75d9[_0x7cdc('0x3d')]=qs[_0x7cdc('0x35')](_['pick'](_0x4472b0[_0x7cdc('0x34')],_0x4a2e92['filters']),_0x2a9c55);if(_0x4472b0['query'][_0x7cdc('0x3e')]){_0x1a75d9[_0x7cdc('0x3d')]=_[_0x7cdc('0x3f')](_0x1a75d9[_0x7cdc('0x3d')],{'$or':_[_0x7cdc('0x2d')](_0x2a9c55,function(_0x1daf90){if(_0x1daf90[_0x7cdc('0x31')]!==_0x7cdc('0x40')){var _0x31f10a={};_0x31f10a[_0x1daf90[_0x7cdc('0x2b')]]={'$like':'%'+_0x4472b0[_0x7cdc('0x34')]['filter']+'%'};return _0x31f10a;}})});}_0x1a75d9=_[_0x7cdc('0x3f')]({},_0x1a75d9,_0x4472b0['options']);var _0x31cb70={'where':_0x1a75d9[_0x7cdc('0x3d')]};return db[_0x7cdc('0x2e')]['count'](_0x31cb70)[_0x7cdc('0x23')](function(_0x2ed8fa){_0x2f4433[_0x7cdc('0x1c')]=_0x2ed8fa;if(_0x4472b0[_0x7cdc('0x34')][_0x7cdc('0x41')]){_0x1a75d9[_0x7cdc('0x42')]=[{'all':!![]}];}return db[_0x7cdc('0x2e')][_0x7cdc('0x43')](_0x1a75d9);})[_0x7cdc('0x23')](function(_0xac1ea){_0x2f4433[_0x7cdc('0x44')]=_0xac1ea;return _0x2f4433;})[_0x7cdc('0x23')](respondWithFilteredResult(_0x4d340b,_0x1a75d9))[_0x7cdc('0x45')](handleError(_0x4d340b,null));};exports[_0x7cdc('0x46')]=function(_0x2ac655,_0x4c51f7){var _0x4c8eaa={'raw':!![],'where':{'id':_0x2ac655[_0x7cdc('0x47')]['id']}},_0x16d0e9={};_0x16d0e9[_0x7cdc('0x33')]=_[_0x7cdc('0x48')](db['Interval'][_0x7cdc('0x2f')]);_0x16d0e9['query']=_[_0x7cdc('0x48')](_0x2ac655[_0x7cdc('0x34')]);_0x16d0e9[_0x7cdc('0x35')]=_[_0x7cdc('0x36')](_0x16d0e9['model'],_0x16d0e9[_0x7cdc('0x34')]);_0x4c8eaa[_0x7cdc('0x37')]=_[_0x7cdc('0x36')](_0x16d0e9[_0x7cdc('0x33')],qs[_0x7cdc('0x38')](_0x2ac655['query'][_0x7cdc('0x38')]));_0x4c8eaa[_0x7cdc('0x37')]=_0x4c8eaa[_0x7cdc('0x37')][_0x7cdc('0x39')]?_0x4c8eaa[_0x7cdc('0x37')]:_0x16d0e9['model'];if(_0x2ac655[_0x7cdc('0x34')]['includeAll']){_0x4c8eaa[_0x7cdc('0x42')]=[{'all':!![]}];}_0x4c8eaa=_[_0x7cdc('0x3f')]({},_0x4c8eaa,_0x2ac655['options']);return db['Interval'][_0x7cdc('0x49')](_0x4c8eaa)[_0x7cdc('0x23')](handleEntityNotFound(_0x4c51f7,null))['then'](respondWithResult(_0x4c51f7,null))[_0x7cdc('0x45')](handleError(_0x4c51f7,null));};exports['create']=function(_0x70594d,_0x5e1ff7){return db['Interval']['create'](_0x70594d[_0x7cdc('0x4a')],{})[_0x7cdc('0x23')](function(_0x48d492){var _0x28d12e=_0x70594d['user'][_0x7cdc('0x25')]({'plain':!![]});if(!_0x28d12e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28d12e['role']==='user'){var _0x1f05c8=_0x48d492[_0x7cdc('0x25')]({'plain':!![]});var _0x1ec807=_0x7cdc('0x26');return db[_0x7cdc('0x4b')][_0x7cdc('0x49')]({'where':{'name':_0x1ec807,'userProfileId':_0x28d12e[_0x7cdc('0x4c')]},'raw':!![]})[_0x7cdc('0x23')](function(_0x272b52){if(_0x272b52&&_0x272b52[_0x7cdc('0x4d')]===0x0){return db[_0x7cdc('0x27')]['create']({'name':_0x1f05c8[_0x7cdc('0x2b')],'resourceId':_0x1f05c8['id'],'type':_0x272b52[_0x7cdc('0x2b')],'sectionId':_0x272b52['id']},{})[_0x7cdc('0x23')](function(){return _0x48d492;});}else{return _0x48d492;}})[_0x7cdc('0x45')](function(_0x6e8b33){logger['error'](_0x7cdc('0x4e'),_0x6e8b33);throw _0x6e8b33;});}return _0x48d492;})['then'](respondWithResult(_0x5e1ff7,0xc9))[_0x7cdc('0x45')](handleError(_0x5e1ff7,null));};exports[_0x7cdc('0x4f')]=function(_0xb65673,_0x5113da){if(_0xb65673['body']['id']){delete _0xb65673[_0x7cdc('0x4a')]['id'];}return db['Interval'][_0x7cdc('0x49')]({'where':{'id':_0xb65673[_0x7cdc('0x47')]['id']}})[_0x7cdc('0x23')](handleEntityNotFound(_0x5113da,null))[_0x7cdc('0x23')](saveUpdates(_0xb65673['body'],null))['then'](respondWithResult(_0x5113da,null))['catch'](handleError(_0x5113da,null));};exports['destroy']=function(_0x27b40f,_0x5ce35b){return db[_0x7cdc('0x2e')]['find']({'where':{'id':_0x27b40f[_0x7cdc('0x47')]['id']}})[_0x7cdc('0x23')](handleEntityNotFound(_0x5ce35b,null))[_0x7cdc('0x23')](removeEntity(_0x5ce35b,null))[_0x7cdc('0x45')](handleError(_0x5ce35b,null));};exports[_0x7cdc('0x50')]=function(_0x421865,_0x174a42,_0x1a8a43){if(_0x421865[_0x7cdc('0x4a')]['id']){delete _0x421865[_0x7cdc('0x4a')]['id'];}return db['Interval'][_0x7cdc('0x49')]({'where':{'id':_0x421865[_0x7cdc('0x47')]['id']}})[_0x7cdc('0x23')](handleEntityNotFound(_0x174a42,null))[_0x7cdc('0x23')](function(_0x1ac601){if(_0x1ac601){_0x421865[_0x7cdc('0x4a')][_0x7cdc('0x51')]=_0x1ac601['id'];return db['Interval'][_0x7cdc('0x52')](_0x421865[_0x7cdc('0x4a')]);}})['then'](respondWithResult(_0x174a42,null))['catch'](handleError(_0x174a42,null));};exports[_0x7cdc('0x53')]=function(_0x11d754,_0x42d276,_0x209403){var _0x44cb5e={};var _0xf693fc={};var _0x3fa8a7;var _0x11a47b;return db['Interval'][_0x7cdc('0x54')]({'where':{'id':_0x11d754[_0x7cdc('0x47')]['id']}})[_0x7cdc('0x23')](handleEntityNotFound(_0x42d276,null))[_0x7cdc('0x23')](function(_0x57ea8c){if(_0x57ea8c){_0x3fa8a7=_0x57ea8c;_0xf693fc['model']=_[_0x7cdc('0x48')](db['Interval'][_0x7cdc('0x2f')]);_0xf693fc[_0x7cdc('0x34')]=_[_0x7cdc('0x48')](_0x11d754['query']);_0xf693fc['filters']=_[_0x7cdc('0x36')](_0xf693fc['model'],_0xf693fc[_0x7cdc('0x34')]);_0x44cb5e[_0x7cdc('0x37')]=_[_0x7cdc('0x36')](_0xf693fc['model'],qs[_0x7cdc('0x38')](_0x11d754[_0x7cdc('0x34')][_0x7cdc('0x38')]));_0x44cb5e['attributes']=_0x44cb5e['attributes'][_0x7cdc('0x39')]?_0x44cb5e[_0x7cdc('0x37')]:_0xf693fc[_0x7cdc('0x33')];_0x44cb5e[_0x7cdc('0x3b')]=qs[_0x7cdc('0x3c')](_0x11d754[_0x7cdc('0x34')]['sort']);_0x44cb5e[_0x7cdc('0x3d')]=qs[_0x7cdc('0x35')](_['pick'](_0x11d754[_0x7cdc('0x34')],_0xf693fc['filters']));if(_0x11d754[_0x7cdc('0x34')][_0x7cdc('0x3e')]){_0x44cb5e[_0x7cdc('0x3d')]=_[_0x7cdc('0x3f')](_0x44cb5e[_0x7cdc('0x3d')],{'$or':_['map'](_0x44cb5e['attributes'],function(_0x4f3441){var _0x163ad0={};_0x163ad0[_0x4f3441]={'$like':'%'+_0x11d754[_0x7cdc('0x34')]['filter']+'%'};return _0x163ad0;})});}_0x44cb5e=_[_0x7cdc('0x3f')]({},_0x44cb5e,_0x11d754[_0x7cdc('0x55')]);return _0x3fa8a7[_0x7cdc('0x53')](_0x44cb5e);}})[_0x7cdc('0x23')](function(_0x5f43d4){if(_0x5f43d4){_0x11a47b=_0x5f43d4[_0x7cdc('0x39')];if(!_0x11d754['query'][_0x7cdc('0x3a')](_0x7cdc('0x56'))){_0x44cb5e[_0x7cdc('0x1d')]=qs[_0x7cdc('0x1d')](_0x11d754[_0x7cdc('0x34')][_0x7cdc('0x1d')]);_0x44cb5e['offset']=qs['offset'](_0x11d754[_0x7cdc('0x34')][_0x7cdc('0x1b')]);}return _0x3fa8a7[_0x7cdc('0x53')](_0x44cb5e);}})[_0x7cdc('0x23')](function(_0x2bd14b){if(_0x2bd14b){return _0x2bd14b?{'count':_0x11a47b,'rows':_0x2bd14b}:null;}})[_0x7cdc('0x23')](respondWithResult(_0x42d276,null))[_0x7cdc('0x45')](handleError(_0x42d276,null));};exports[_0x7cdc('0x57')]=function(_0x6666ee,_0x5a344f,_0x20e856){return db[_0x7cdc('0x2e')]['findOne']({'where':{'id':_0x6666ee['params']['id']}})[_0x7cdc('0x23')](handleEntityNotFound(_0x5a344f,null))[_0x7cdc('0x23')](function(_0x2119ff){if(_0x2119ff){return db['sequelize'][_0x7cdc('0x58')](function(_0x37f88f){return db[_0x7cdc('0x2e')][_0x7cdc('0x24')]({'where':{'IntervalId':_0x6666ee['params']['id']},'transaction':_0x37f88f})[_0x7cdc('0x23')](function(_0x5474d0){var _0x5a5f99=_[_0x7cdc('0x2d')](_0x6666ee[_0x7cdc('0x4a')],function(_0x1672e7){delete _0x1672e7['id'];_0x1672e7[_0x7cdc('0x51')]=_0x6666ee['params']['id'];return _0x1672e7;});return db['Interval'][_0x7cdc('0x59')](_0x5a5f99,{'transaction':_0x37f88f});});})[_0x7cdc('0x23')](function(){return db[_0x7cdc('0x2e')]['findAll']({'where':{'IntervalId':_0x6666ee['params']['id']}});});}})[_0x7cdc('0x23')](respondWithResult(_0x5a344f,null))[_0x7cdc('0x45')](handleError(_0x5a344f,null));}; \ No newline at end of file +var _0xc607=['bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','name','index','Interval','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','filter','options','include','findAll','catch','params','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','transaction'];(function(_0x48b7b7,_0x26141b){var _0x2bdba6=function(_0x268b7c){while(--_0x268b7c){_0x48b7b7['push'](_0x48b7b7['shift']());}};_0x2bdba6(++_0x26141b);}(_0xc607,0xb7));var _0x7c60=function(_0x1d0ce7,_0x5938f1){_0x1d0ce7=_0x1d0ce7-0x0;var _0x27d94d=_0xc607[_0x1d0ce7];return _0x27d94d;};'use strict';var emlformat=require(_0x7c60('0x0'));var rimraf=require(_0x7c60('0x1'));var zipdir=require(_0x7c60('0x2'));var jsonpatch=require(_0x7c60('0x3'));var rp=require(_0x7c60('0x4'));var moment=require(_0x7c60('0x5'));var BPromise=require(_0x7c60('0x6'));var Mustache=require(_0x7c60('0x7'));var util=require(_0x7c60('0x8'));var path=require(_0x7c60('0x9'));var sox=require(_0x7c60('0xa'));var csv=require('to-csv');var ejs=require(_0x7c60('0xb'));var fs=require('fs');var fs_extra=require(_0x7c60('0xc'));var _=require(_0x7c60('0xd'));var squel=require(_0x7c60('0xe'));var crypto=require(_0x7c60('0xf'));var jsforce=require(_0x7c60('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7c60('0x11'));var querystring=require('querystring');var Papa=require(_0x7c60('0x12'));var Redis=require('ioredis');var authService=require(_0x7c60('0x13'));var qs=require(_0x7c60('0x14'));var as=require(_0x7c60('0x15'));var hardwareService=require(_0x7c60('0x16'));var logger=require(_0x7c60('0x17'))('api');var utils=require(_0x7c60('0x18'));var config=require(_0x7c60('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c60('0x1a'))['db'];var extensions=require(_0x7c60('0x1b'));function respondWithStatusCode(_0x500645,_0x215d19){_0x215d19=_0x215d19||0xcc;return function(_0x13647c){if(_0x13647c){return _0x500645['sendStatus'](_0x215d19);}return _0x500645[_0x7c60('0x1c')](_0x215d19)[_0x7c60('0x1d')]();};}function respondWithResult(_0x1a22cb,_0x2145c5){_0x2145c5=_0x2145c5||0xc8;return function(_0x184b88){if(_0x184b88){return _0x1a22cb[_0x7c60('0x1c')](_0x2145c5)[_0x7c60('0x1e')](_0x184b88);}};}function respondWithFilteredResult(_0x17f5c6,_0x1da599){return function(_0x195cef){if(_0x195cef){var _0x506e0a=typeof _0x1da599[_0x7c60('0x1f')]===_0x7c60('0x20')&&typeof _0x1da599[_0x7c60('0x21')]==='undefined';var _0x22db2a=_0x195cef['count'];var _0x59f973=_0x506e0a?0x0:_0x1da599[_0x7c60('0x1f')];var _0x5b59d7=_0x506e0a?_0x195cef[_0x7c60('0x22')]:_0x1da599['offset']+_0x1da599[_0x7c60('0x21')];var _0x174a17;if(_0x5b59d7>=_0x22db2a){_0x5b59d7=_0x22db2a;_0x174a17=0xc8;}else{_0x174a17=0xce;}_0x17f5c6['status'](_0x174a17);return _0x17f5c6[_0x7c60('0x23')](_0x7c60('0x24'),_0x59f973+'-'+_0x5b59d7+'/'+_0x22db2a)[_0x7c60('0x1e')](_0x195cef);}return null;};}function patchUpdates(_0x4caec0){return function(_0x146a01){try{jsonpatch[_0x7c60('0x25')](_0x146a01,_0x4caec0,!![]);}catch(_0x3c6653){return BPromise['reject'](_0x3c6653);}return _0x146a01[_0x7c60('0x26')]();};}function saveUpdates(_0x5367f7,_0x2da20c){return function(_0x5f38af){if(_0x5f38af){return _0x5f38af['update'](_0x5367f7)[_0x7c60('0x27')](function(_0x36a70c){return _0x36a70c;});}return null;};}function removeEntity(_0xc02d4f,_0xb065f3){return function(_0x512d83){if(_0x512d83){return _0x512d83[_0x7c60('0x28')]()[_0x7c60('0x27')](function(){var _0x54e2fd=_0x512d83[_0x7c60('0x29')]({'plain':!![]});var _0x43a969=_0x7c60('0x2a');return db[_0x7c60('0x2b')][_0x7c60('0x28')]({'where':{'type':_0x43a969,'resourceId':_0x54e2fd['id']}})[_0x7c60('0x27')](function(){return _0x512d83;});})[_0x7c60('0x27')](function(){_0xc02d4f[_0x7c60('0x1c')](0xcc)[_0x7c60('0x1d')]();});}};}function handleEntityNotFound(_0x559c4f,_0x1092a6){return function(_0x467f8d){if(!_0x467f8d){_0x559c4f[_0x7c60('0x2c')](0x194);}return _0x467f8d;};}function handleError(_0x15b39b,_0x50d660){_0x50d660=_0x50d660||0x1f4;return function(_0x53908f){logger[_0x7c60('0x2d')](_0x53908f['stack']);if(_0x53908f[_0x7c60('0x2e')]){delete _0x53908f[_0x7c60('0x2e')];}_0x15b39b[_0x7c60('0x1c')](_0x50d660)['send'](_0x53908f);};}exports[_0x7c60('0x2f')]=function(_0x1e56c1,_0x565cb3){var _0x1768d6={},_0x4da779={},_0x3accf9={'count':0x0,'rows':[]};var _0xc55433=_['map'](db[_0x7c60('0x30')][_0x7c60('0x31')],function(_0x32239a){return{'name':_0x32239a['fieldName'],'type':_0x32239a[_0x7c60('0x32')][_0x7c60('0x33')]};});_0x4da779[_0x7c60('0x34')]=_[_0x7c60('0x35')](_0xc55433,_0x7c60('0x2e'));_0x4da779[_0x7c60('0x36')]=_[_0x7c60('0x37')](_0x1e56c1[_0x7c60('0x36')]);_0x4da779[_0x7c60('0x38')]=_[_0x7c60('0x39')](_0x4da779[_0x7c60('0x34')],_0x4da779[_0x7c60('0x36')]);_0x1768d6['attributes']=_[_0x7c60('0x39')](_0x4da779[_0x7c60('0x34')],qs['fields'](_0x1e56c1[_0x7c60('0x36')][_0x7c60('0x3a')]));_0x1768d6[_0x7c60('0x3b')]=_0x1768d6[_0x7c60('0x3b')][_0x7c60('0x3c')]?_0x1768d6[_0x7c60('0x3b')]:_0x4da779['model'];if(!_0x1e56c1[_0x7c60('0x36')]['hasOwnProperty'](_0x7c60('0x3d'))){_0x1768d6['limit']=qs[_0x7c60('0x21')](_0x1e56c1[_0x7c60('0x36')][_0x7c60('0x21')]);_0x1768d6[_0x7c60('0x1f')]=qs[_0x7c60('0x1f')](_0x1e56c1[_0x7c60('0x36')][_0x7c60('0x1f')]);}_0x1768d6[_0x7c60('0x3e')]=qs[_0x7c60('0x3f')](_0x1e56c1[_0x7c60('0x36')][_0x7c60('0x3f')]);_0x1768d6['where']=qs[_0x7c60('0x38')](_[_0x7c60('0x40')](_0x1e56c1[_0x7c60('0x36')],_0x4da779['filters']),_0xc55433);if(_0x1e56c1[_0x7c60('0x36')]['filter']){_0x1768d6[_0x7c60('0x41')]=_[_0x7c60('0x42')](_0x1768d6[_0x7c60('0x41')],{'$or':_[_0x7c60('0x35')](_0xc55433,function(_0x3ee6be){if(_0x3ee6be[_0x7c60('0x32')]!=='VIRTUAL'){var _0x163a66={};_0x163a66[_0x3ee6be[_0x7c60('0x2e')]]={'$like':'%'+_0x1e56c1[_0x7c60('0x36')][_0x7c60('0x43')]+'%'};return _0x163a66;}})});}_0x1768d6=_['merge']({},_0x1768d6,_0x1e56c1[_0x7c60('0x44')]);var _0x26cc3d={'where':_0x1768d6[_0x7c60('0x41')]};return db['Interval'][_0x7c60('0x22')](_0x26cc3d)['then'](function(_0x6e05a6){_0x3accf9[_0x7c60('0x22')]=_0x6e05a6;if(_0x1e56c1['query']['includeAll']){_0x1768d6[_0x7c60('0x45')]=[{'all':!![]}];}return db[_0x7c60('0x30')][_0x7c60('0x46')](_0x1768d6);})[_0x7c60('0x27')](function(_0x2db0e0){_0x3accf9['rows']=_0x2db0e0;return _0x3accf9;})[_0x7c60('0x27')](respondWithFilteredResult(_0x565cb3,_0x1768d6))[_0x7c60('0x47')](handleError(_0x565cb3,null));};exports['show']=function(_0x2fb793,_0x503426){var _0x2e1d96={'raw':!![],'where':{'id':_0x2fb793[_0x7c60('0x48')]['id']}},_0x384cab={};_0x384cab[_0x7c60('0x34')]=_[_0x7c60('0x37')](db[_0x7c60('0x30')][_0x7c60('0x31')]);_0x384cab[_0x7c60('0x36')]=_['keys'](_0x2fb793[_0x7c60('0x36')]);_0x384cab['filters']=_[_0x7c60('0x39')](_0x384cab[_0x7c60('0x34')],_0x384cab['query']);_0x2e1d96[_0x7c60('0x3b')]=_[_0x7c60('0x39')](_0x384cab['model'],qs['fields'](_0x2fb793[_0x7c60('0x36')]['fields']));_0x2e1d96['attributes']=_0x2e1d96[_0x7c60('0x3b')][_0x7c60('0x3c')]?_0x2e1d96[_0x7c60('0x3b')]:_0x384cab['model'];if(_0x2fb793[_0x7c60('0x36')][_0x7c60('0x49')]){_0x2e1d96[_0x7c60('0x45')]=[{'all':!![]}];}_0x2e1d96=_['merge']({},_0x2e1d96,_0x2fb793[_0x7c60('0x44')]);return db['Interval']['find'](_0x2e1d96)[_0x7c60('0x27')](handleEntityNotFound(_0x503426,null))[_0x7c60('0x27')](respondWithResult(_0x503426,null))[_0x7c60('0x47')](handleError(_0x503426,null));};exports[_0x7c60('0x4a')]=function(_0x381121,_0x41d0c7){return db[_0x7c60('0x30')]['create'](_0x381121['body'],{})[_0x7c60('0x27')](function(_0xb102e0){var _0x305bcf=_0x381121['user'][_0x7c60('0x29')]({'plain':!![]});if(!_0x305bcf)throw new Error(_0x7c60('0x4b'));if(_0x305bcf['role']===_0x7c60('0x4c')){var _0xa2be8=_0xb102e0['get']({'plain':!![]});var _0x4acec6=_0x7c60('0x2a');return db[_0x7c60('0x4d')][_0x7c60('0x4e')]({'where':{'name':_0x4acec6,'userProfileId':_0x305bcf[_0x7c60('0x4f')]},'raw':!![]})[_0x7c60('0x27')](function(_0x162b88){if(_0x162b88&&_0x162b88['autoAssociation']===0x0){return db[_0x7c60('0x2b')][_0x7c60('0x4a')]({'name':_0xa2be8['name'],'resourceId':_0xa2be8['id'],'type':_0x162b88[_0x7c60('0x2e')],'sectionId':_0x162b88['id']},{})[_0x7c60('0x27')](function(){return _0xb102e0;});}else{return _0xb102e0;}})[_0x7c60('0x47')](function(_0x408aee){logger['error'](_0x7c60('0x50'),_0x408aee);throw _0x408aee;});}return _0xb102e0;})[_0x7c60('0x27')](respondWithResult(_0x41d0c7,0xc9))[_0x7c60('0x47')](handleError(_0x41d0c7,null));};exports[_0x7c60('0x51')]=function(_0x4611bf,_0x3c43f6){if(_0x4611bf[_0x7c60('0x52')]['id']){delete _0x4611bf[_0x7c60('0x52')]['id'];}return db[_0x7c60('0x30')][_0x7c60('0x4e')]({'where':{'id':_0x4611bf[_0x7c60('0x48')]['id']}})[_0x7c60('0x27')](handleEntityNotFound(_0x3c43f6,null))['then'](saveUpdates(_0x4611bf[_0x7c60('0x52')],null))[_0x7c60('0x27')](respondWithResult(_0x3c43f6,null))[_0x7c60('0x47')](handleError(_0x3c43f6,null));};exports['destroy']=function(_0x4004f7,_0x460a1c){return db[_0x7c60('0x30')]['find']({'where':{'id':_0x4004f7[_0x7c60('0x48')]['id']}})[_0x7c60('0x27')](handleEntityNotFound(_0x460a1c,null))[_0x7c60('0x27')](removeEntity(_0x460a1c,null))[_0x7c60('0x47')](handleError(_0x460a1c,null));};exports[_0x7c60('0x53')]=function(_0x5e3685,_0x5ee664,_0x3fd0c6){if(_0x5e3685[_0x7c60('0x52')]['id']){delete _0x5e3685[_0x7c60('0x52')]['id'];}return db[_0x7c60('0x30')][_0x7c60('0x4e')]({'where':{'id':_0x5e3685[_0x7c60('0x48')]['id']}})[_0x7c60('0x27')](handleEntityNotFound(_0x5ee664,null))[_0x7c60('0x27')](function(_0x36e0a0){if(_0x36e0a0){_0x5e3685['body'][_0x7c60('0x54')]=_0x36e0a0['id'];return db[_0x7c60('0x30')][_0x7c60('0x4a')](_0x5e3685[_0x7c60('0x52')]);}})[_0x7c60('0x27')](respondWithResult(_0x5ee664,null))[_0x7c60('0x47')](handleError(_0x5ee664,null));};exports[_0x7c60('0x55')]=function(_0x38a616,_0x5cdd89,_0x54382a){var _0x338d3c={};var _0x528d0b={};var _0x148a0d;var _0x947197;return db[_0x7c60('0x30')][_0x7c60('0x56')]({'where':{'id':_0x38a616[_0x7c60('0x48')]['id']}})['then'](handleEntityNotFound(_0x5cdd89,null))[_0x7c60('0x27')](function(_0x5977cf){if(_0x5977cf){_0x148a0d=_0x5977cf;_0x528d0b[_0x7c60('0x34')]=_[_0x7c60('0x37')](db['Interval'][_0x7c60('0x31')]);_0x528d0b[_0x7c60('0x36')]=_['keys'](_0x38a616[_0x7c60('0x36')]);_0x528d0b[_0x7c60('0x38')]=_[_0x7c60('0x39')](_0x528d0b[_0x7c60('0x34')],_0x528d0b[_0x7c60('0x36')]);_0x338d3c['attributes']=_[_0x7c60('0x39')](_0x528d0b['model'],qs[_0x7c60('0x3a')](_0x38a616[_0x7c60('0x36')]['fields']));_0x338d3c[_0x7c60('0x3b')]=_0x338d3c['attributes']['length']?_0x338d3c[_0x7c60('0x3b')]:_0x528d0b['model'];_0x338d3c[_0x7c60('0x3e')]=qs['sort'](_0x38a616[_0x7c60('0x36')][_0x7c60('0x3f')]);_0x338d3c[_0x7c60('0x41')]=qs[_0x7c60('0x38')](_[_0x7c60('0x40')](_0x38a616[_0x7c60('0x36')],_0x528d0b[_0x7c60('0x38')]));if(_0x38a616[_0x7c60('0x36')][_0x7c60('0x43')]){_0x338d3c[_0x7c60('0x41')]=_[_0x7c60('0x42')](_0x338d3c[_0x7c60('0x41')],{'$or':_[_0x7c60('0x35')](_0x338d3c[_0x7c60('0x3b')],function(_0xb26a0){var _0x29d57e={};_0x29d57e[_0xb26a0]={'$like':'%'+_0x38a616['query']['filter']+'%'};return _0x29d57e;})});}_0x338d3c=_[_0x7c60('0x42')]({},_0x338d3c,_0x38a616['options']);return _0x148a0d[_0x7c60('0x55')](_0x338d3c);}})[_0x7c60('0x27')](function(_0x29c8bc){if(_0x29c8bc){_0x947197=_0x29c8bc[_0x7c60('0x3c')];if(!_0x38a616[_0x7c60('0x36')][_0x7c60('0x57')](_0x7c60('0x3d'))){_0x338d3c[_0x7c60('0x21')]=qs[_0x7c60('0x21')](_0x38a616['query']['limit']);_0x338d3c['offset']=qs[_0x7c60('0x1f')](_0x38a616['query'][_0x7c60('0x1f')]);}return _0x148a0d[_0x7c60('0x55')](_0x338d3c);}})[_0x7c60('0x27')](function(_0x37de4b){if(_0x37de4b){return _0x37de4b?{'count':_0x947197,'rows':_0x37de4b}:null;}})[_0x7c60('0x27')](respondWithResult(_0x5cdd89,null))[_0x7c60('0x47')](handleError(_0x5cdd89,null));};exports[_0x7c60('0x58')]=function(_0x1f9e38,_0xa355b1,_0x1a41a7){return db[_0x7c60('0x30')]['findOne']({'where':{'id':_0x1f9e38[_0x7c60('0x48')]['id']}})[_0x7c60('0x27')](handleEntityNotFound(_0xa355b1,null))[_0x7c60('0x27')](function(_0xe96e46){if(_0xe96e46){return db['sequelize'][_0x7c60('0x59')](function(_0x79c61){return db[_0x7c60('0x30')]['destroy']({'where':{'IntervalId':_0x1f9e38[_0x7c60('0x48')]['id']},'transaction':_0x79c61})['then'](function(_0x38a94a){var _0x19b37c=_[_0x7c60('0x35')](_0x1f9e38[_0x7c60('0x52')],function(_0x32e1fe){delete _0x32e1fe['id'];_0x32e1fe['IntervalId']=_0x1f9e38[_0x7c60('0x48')]['id'];return _0x32e1fe;});return db['Interval'][_0x7c60('0x5a')](_0x19b37c,{'transaction':_0x79c61});});})[_0x7c60('0x27')](function(){return db[_0x7c60('0x30')][_0x7c60('0x46')]({'where':{'IntervalId':_0x1f9e38['params']['id']}});});}})[_0x7c60('0x27')](respondWithResult(_0xa355b1,null))['catch'](handleError(_0xa355b1,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ea2675c..4c64463 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 _0x3f76=['tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x43b7ab,_0x46ac54){var _0x4d1140=function(_0x77f2ca){while(--_0x77f2ca){_0x43b7ab['push'](_0x43b7ab['shift']());}};_0x4d1140(++_0x46ac54);}(_0x3f76,0x147));var _0x63f7=function(_0x1148a9,_0x48c069){_0x1148a9=_0x1148a9-0x0;var _0x125aaf=_0x3f76[_0x1148a9];return _0x125aaf;};'use strict';var _=require(_0x63f7('0x0'));var util=require(_0x63f7('0x1'));var logger=require(_0x63f7('0x2'))('api');var moment=require(_0x63f7('0x3'));var BPromise=require(_0x63f7('0x4'));var rp=require(_0x63f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63f7('0x6'));var config=require('../../config/environment');var attributes=require(_0x63f7('0x7'));var extensions=require(_0x63f7('0x8'));module[_0x63f7('0x9')]=function(_0x4f0680,_0x2f04f3){return _0x4f0680[_0x63f7('0xa')]('Interval',attributes,{'tableName':_0x63f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fc021,_0x288cf6){extensions[_0x63f7('0xc')](_0x4f0680,_0x3fc021);},'afterBulkCreate':function(_0x465b5d,_0x378404,_0x3d87bc){_0x3d87bc();extensions[_0x63f7('0xc')](_0x4f0680,_0x465b5d[0x0]);},'afterUpdate':function(_0x5d5e3b,_0x153c6c){extensions[_0x63f7('0xc')](_0x4f0680,_0x5d5e3b);},'afterDestroy':function(_0x480d7e,_0x46161f){extensions['rewrite'](_0x4f0680,_0x480d7e);}}});}; \ No newline at end of file +var _0x2f81=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite'];(function(_0x5001b4,_0x362ed5){var _0x44ffa7=function(_0x3a0a8e){while(--_0x3a0a8e){_0x5001b4['push'](_0x5001b4['shift']());}};_0x44ffa7(++_0x362ed5);}(_0x2f81,0x110));var _0x12f8=function(_0x49cf91,_0x14880d){_0x49cf91=_0x49cf91-0x0;var _0x542b70=_0x2f81[_0x49cf91];return _0x542b70;};'use strict';var _=require('lodash');var util=require(_0x12f8('0x0'));var logger=require(_0x12f8('0x1'))(_0x12f8('0x2'));var moment=require(_0x12f8('0x3'));var BPromise=require(_0x12f8('0x4'));var rp=require(_0x12f8('0x5'));var fs=require('fs');var path=require(_0x12f8('0x6'));var rimraf=require(_0x12f8('0x7'));var config=require(_0x12f8('0x8'));var attributes=require(_0x12f8('0x9'));var extensions=require(_0x12f8('0xa'));module[_0x12f8('0xb')]=function(_0x48df52,_0x5cb6b3){return _0x48df52[_0x12f8('0xc')](_0x12f8('0xd'),attributes,{'tableName':_0x12f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x12d6f5,_0x495f39){extensions[_0x12f8('0xf')](_0x48df52,_0x12d6f5);},'afterBulkCreate':function(_0x3ca56e,_0x5b712a,_0x481b53){_0x481b53();extensions[_0x12f8('0xf')](_0x48df52,_0x3ca56e[0x0]);},'afterUpdate':function(_0x757b2b,_0x282780){extensions[_0x12f8('0xf')](_0x48df52,_0x757b2b);},'afterDestroy':function(_0x4da9b1,_0x34cf71){extensions['rewrite'](_0x48df52,_0x4da9b1);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4f824c2..452b57d 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2c7a24b..03ce379 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xb10b,0x12a));var _0xbb10=function(_0x347379,_0x37de29){_0x347379=_0x347379-0x0;var _0x1e6dbf=_0xb10b[_0x347379];return _0x1e6dbf;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x51fb74,_0x571dac){var _0x52a205=function(_0x16f624){while(--_0x16f624){_0x51fb74['push'](_0x51fb74['shift']());}};_0x52a205(++_0x571dac);}(_0x2032,0xd9));var _0x2203=function(_0x3bc2f3,_0x293e54){_0x3bc2f3=_0x3bc2f3-0x0;var _0xdf2413=_0x2032[_0x3bc2f3];return _0xdf2413;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 94e07bb..9d24c9e 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 _0x9c58=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','end','status','statusCode','json','parse'];(function(_0x437e8a,_0x44dfba){var _0x5e9910=function(_0x3b71e1){while(--_0x3b71e1){_0x437e8a['push'](_0x437e8a['shift']());}};_0x5e9910(++_0x44dfba);}(_0x9c58,0x182));var _0x89c5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9c58[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require('bluebird');var https=require(_0x89c5('0x0'));var logger=require(_0x89c5('0x1'))(_0x89c5('0x2'));var USERNAME=_0x89c5('0x3');var PASSWORD=_0x89c5('0x4');function openIssue(_0x12623e,_0x583084){var _0x52ce53={'fields':{'project':{'key':_0x12623e[_0x89c5('0x5')]||'MOTGUI'},'summary':(_0x12623e[_0x89c5('0x6')]||_0x89c5('0x7'))+_0x89c5('0x8')+_0x12623e['ip'],'description':_0x12623e[_0x89c5('0x9')]||JSON[_0x89c5('0xa')](_0x12623e),'issuetype':{'name':_0x12623e[_0x89c5('0xb')]||_0x89c5('0xc')}}};_0x52ce53[_0x89c5('0xd')][_0x89c5('0xe')]=_0x12623e[_0x89c5('0xf')];_0x52ce53[_0x89c5('0xd')][_0x89c5('0x10')]=_0x12623e['oldToken'];_0x52ce53[_0x89c5('0xd')]['customfield_11502']=_0x12623e[_0x89c5('0x11')];_0x52ce53['fields'][_0x89c5('0x12')]=_0x12623e[_0x89c5('0x13')];_0x52ce53[_0x89c5('0xd')][_0x89c5('0x14')]=_0x12623e[_0x89c5('0x15')];_0x52ce53[_0x89c5('0xd')][_0x89c5('0x16')]=_0x12623e['ip'];var _0x1cd7b8={'host':_0x89c5('0x17'),'port':0x1bb,'path':_0x89c5('0x18'),'method':_0x89c5('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x89c5('0x1a'),'Authorization':_0x89c5('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x89c5('0x1c')](_0x89c5('0x1d'))}};var _0x3b1e37=JSON[_0x89c5('0xa')](_0x52ce53);var _0x3e22c7=https[_0x89c5('0x1e')](_0x1cd7b8,function(_0x27d3af){_0x27d3af[_0x89c5('0x1f')]('utf8');var _0x82c1c0='';_0x27d3af['on']('data',function(_0x324f44){_0x82c1c0+=_0x324f44;});_0x27d3af['on'](_0x89c5('0x20'),function(){if(_0x583084){return _0x583084[_0x89c5('0x21')](_0x27d3af[_0x89c5('0x22')])[_0x89c5('0x23')](JSON[_0x89c5('0x24')](_0x82c1c0));}});});_0x3e22c7['on']('error',function(_0x437edb){if(_0x583084){return _0x583084[_0x89c5('0x21')](0x1f4)['json']({'errors':[{'message':_0x89c5('0x25'),'type':_0x89c5('0x26')}]});}});_0x3e22c7['write'](_0x3b1e37);_0x3e22c7[_0x89c5('0x20')]();}exports[_0x89c5('0x27')]=openIssue;exports[_0x89c5('0x28')]=function(_0x1e75ff,_0x55e651){_0x1e75ff[_0x89c5('0x29')]['ip']=_0x1e75ff[_0x89c5('0x2a')][_0x89c5('0x2b')]||_0x1e75ff['connection'][_0x89c5('0x2c')]||_0x1e75ff[_0x89c5('0x2d')][_0x89c5('0x2c')]||_0x1e75ff[_0x89c5('0x2e')][_0x89c5('0x2d')][_0x89c5('0x2c')];return openIssue(_0x1e75ff[_0x89c5('0x29')],_0x55e651);}; \ No newline at end of file +var _0x51d1=['email','fields','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','request','setEncoding','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','support','summary','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x51d1,0x10d));var _0x151d=function(_0x57d7f7,_0x335c81){_0x57d7f7=_0x57d7f7-0x0;var _0x1a6800=_0x51d1[_0x57d7f7];return _0x1a6800;};'use strict';var BPromise=require(_0x151d('0x0'));var https=require(_0x151d('0x1'));var logger=require(_0x151d('0x2'))('api');var USERNAME=_0x151d('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x57be0b,_0x22516d){var _0x2fcbef={'fields':{'project':{'key':_0x57be0b['key']||'MOTGUI'},'summary':(_0x57be0b[_0x151d('0x4')]||'Report')+_0x151d('0x5')+_0x57be0b['ip'],'description':_0x57be0b[_0x151d('0x6')]||JSON[_0x151d('0x7')](_0x57be0b),'issuetype':{'name':_0x57be0b[_0x151d('0x8')]||_0x151d('0x9')}}};_0x2fcbef['fields'][_0x151d('0xa')]=_0x57be0b[_0x151d('0xb')];_0x2fcbef[_0x151d('0xc')]['customfield_11501']=_0x57be0b['oldToken'];_0x2fcbef[_0x151d('0xc')]['customfield_11502']=_0x57be0b[_0x151d('0xd')];_0x2fcbef['fields'][_0x151d('0xe')]=_0x57be0b[_0x151d('0xf')];_0x2fcbef['fields']['customfield_11504']=_0x57be0b['reason'];_0x2fcbef[_0x151d('0xc')][_0x151d('0x10')]=_0x57be0b['ip'];var _0x5f1c00={'host':_0x151d('0x11'),'port':0x1bb,'path':_0x151d('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x151d('0x13'),'Authorization':_0x151d('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x151d('0x15')]('base64')}};var _0x148340=JSON[_0x151d('0x7')](_0x2fcbef);var _0x4c8a96=https[_0x151d('0x16')](_0x5f1c00,function(_0x59db5f){_0x59db5f[_0x151d('0x17')]('utf8');var _0x426955='';_0x59db5f['on']('data',function(_0x43f5de){_0x426955+=_0x43f5de;});_0x59db5f['on']('end',function(){if(_0x22516d){return _0x22516d[_0x151d('0x18')](_0x59db5f[_0x151d('0x19')])[_0x151d('0x1a')](JSON[_0x151d('0x1b')](_0x426955));}});});_0x4c8a96['on']('error',function(_0x4d744b){if(_0x22516d){return _0x22516d[_0x151d('0x18')](0x1f4)['json']({'errors':[{'message':_0x151d('0x1c'),'type':_0x151d('0x1d')}]});}});_0x4c8a96[_0x151d('0x1e')](_0x148340);_0x4c8a96[_0x151d('0x1f')]();}exports[_0x151d('0x20')]=openIssue;exports[_0x151d('0x21')]=function(_0x37699b,_0x3f619d){_0x37699b['body']['ip']=_0x37699b[_0x151d('0x22')][_0x151d('0x23')]||_0x37699b[_0x151d('0x24')][_0x151d('0x25')]||_0x37699b[_0x151d('0x26')][_0x151d('0x25')]||_0x37699b[_0x151d('0x24')]['socket'][_0x151d('0x25')];return openIssue(_0x37699b[_0x151d('0x27')],_0x3f619d);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4266785..f3c240a 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 _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x26deba,_0x5f4257){var _0x346f90=function(_0x369430){while(--_0x369430){_0x26deba['push'](_0x26deba['shift']());}};_0x346f90(++_0x5f4257);}(_0xa75b,0x170));var _0xba75=function(_0x1cd17d,_0x1bd5d6){_0x1cd17d=_0x1cd17d-0x0;var _0x5aaf40=_0xa75b[_0x1cd17d];return _0x5aaf40;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0xcff84,_0x3988bb){var _0x42fc21=function(_0x2908f5){while(--_0x2908f5){_0xcff84['push'](_0xcff84['shift']());}};_0x42fc21(++_0x3988bb);}(_0x5b02,0xe9));var _0x25b0=function(_0x213d31,_0x3d6bbb){_0x213d31=_0x213d31-0x0;var _0x24a185=_0x5b02[_0x213d31];return _0x24a185;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index cbc2f55..3653358 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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x455635,_0x5ea3ca){_0x455635=_0x455635-0x0;var _0x4af5ae=_0x7a54[_0x455635];return _0x4af5ae;};'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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x28cff5,_0x174dcf){_0x28cff5=_0x28cff5-0x0;var _0xddb632=_0x7a54[_0x28cff5];return _0xddb632;};'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 06325e7..6e5243d 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 _0x72a2=['json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x72a2,0x161));var _0x272a=function(_0x158f24,_0x188b16){_0x158f24=_0x158f24-0x0;var _0x52568d=_0x72a2[_0x158f24];return _0x52568d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x272a('0x0'));var zipdir=require(_0x272a('0x1'));var jsonpatch=require(_0x272a('0x2'));var rp=require(_0x272a('0x3'));var moment=require(_0x272a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x272a('0x5'));var util=require('util');var path=require(_0x272a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x272a('0x7'));var _=require(_0x272a('0x8'));var squel=require(_0x272a('0x9'));var crypto=require(_0x272a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x272a('0xb'));var querystring=require('querystring');var Papa=require(_0x272a('0xc'));var Redis=require('ioredis');var authService=require(_0x272a('0xd'));var qs=require(_0x272a('0xe'));var as=require(_0x272a('0xf'));var hardwareService=require(_0x272a('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x272a('0x11'));var config=require(_0x272a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x272a('0x13'))['db'];function respondWithStatusCode(_0x7cb1fe,_0x37ee7e){_0x37ee7e=_0x37ee7e||0xcc;return function(_0xa82788){if(_0xa82788){return _0x7cb1fe[_0x272a('0x14')](_0x37ee7e);}return _0x7cb1fe['status'](_0x37ee7e)[_0x272a('0x15')]();};}function respondWithResult(_0x2143a4,_0x43fce6){_0x43fce6=_0x43fce6||0xc8;return function(_0x167a72){if(_0x167a72){return _0x2143a4['status'](_0x43fce6)[_0x272a('0x16')](_0x167a72);}};}function respondWithFilteredResult(_0x9414d6,_0x5b615a){return function(_0x4e3661){if(_0x4e3661){var _0x4cfb67=typeof _0x5b615a['offset']==='undefined'&&typeof _0x5b615a['limit']===_0x272a('0x17');var _0x48bf3d=_0x4e3661[_0x272a('0x18')];var _0x327f68=_0x4cfb67?0x0:_0x5b615a[_0x272a('0x19')];var _0x3325b2=_0x4cfb67?_0x4e3661['count']:_0x5b615a[_0x272a('0x19')]+_0x5b615a[_0x272a('0x1a')];var _0x2675be;if(_0x3325b2>=_0x48bf3d){_0x3325b2=_0x48bf3d;_0x2675be=0xc8;}else{_0x2675be=0xce;}_0x9414d6[_0x272a('0x1b')](_0x2675be);return _0x9414d6[_0x272a('0x1c')](_0x272a('0x1d'),_0x327f68+'-'+_0x3325b2+'/'+_0x48bf3d)[_0x272a('0x16')](_0x4e3661);}return null;};}function patchUpdates(_0x5cc0d6){return function(_0x393e68){try{jsonpatch[_0x272a('0x1e')](_0x393e68,_0x5cc0d6,!![]);}catch(_0x12c1c3){return BPromise[_0x272a('0x1f')](_0x12c1c3);}return _0x393e68[_0x272a('0x20')]();};}function saveUpdates(_0x297562,_0x4ac0bb){return function(_0x1bfe85){if(_0x1bfe85){return _0x1bfe85['update'](_0x297562)[_0x272a('0x21')](function(_0x504868){return _0x504868;});}return null;};}function removeEntity(_0x3ec1c3,_0x5a7003){return function(_0x13081e){if(_0x13081e){return _0x13081e[_0x272a('0x22')]()[_0x272a('0x21')](function(){_0x3ec1c3[_0x272a('0x1b')](0xcc)[_0x272a('0x15')]();});}};}function handleEntityNotFound(_0x4554b1,_0x15d35c){return function(_0x8138e2){if(!_0x8138e2){_0x4554b1[_0x272a('0x14')](0x194);}return _0x8138e2;};}function handleError(_0x4d1293,_0xc743bc){_0xc743bc=_0xc743bc||0x1f4;return function(_0x6312d4){logger[_0x272a('0x23')](_0x6312d4[_0x272a('0x24')]);if(_0x6312d4[_0x272a('0x25')]){delete _0x6312d4['name'];}_0x4d1293['status'](_0xc743bc)[_0x272a('0x26')](_0x6312d4);};}exports[_0x272a('0x27')]=function(_0x654dc6,_0x1bce15){var _0x62a99c={},_0x73707b={},_0x10d03c={'count':0x0,'rows':[]};var _0x142f1=_[_0x272a('0x28')](db[_0x272a('0x29')][_0x272a('0x2a')],function(_0x5104f3){return{'name':_0x5104f3['fieldName'],'type':_0x5104f3['type'][_0x272a('0x2b')]};});_0x73707b['model']=_[_0x272a('0x28')](_0x142f1,_0x272a('0x25'));_0x73707b['query']=_[_0x272a('0x2c')](_0x654dc6[_0x272a('0x2d')]);_0x73707b[_0x272a('0x2e')]=_[_0x272a('0x2f')](_0x73707b[_0x272a('0x30')],_0x73707b[_0x272a('0x2d')]);_0x62a99c[_0x272a('0x31')]=_[_0x272a('0x2f')](_0x73707b['model'],qs[_0x272a('0x32')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x32')]));_0x62a99c['attributes']=_0x62a99c[_0x272a('0x31')]['length']?_0x62a99c['attributes']:_0x73707b[_0x272a('0x30')];if(!_0x654dc6['query'][_0x272a('0x33')](_0x272a('0x34'))){_0x62a99c[_0x272a('0x1a')]=qs[_0x272a('0x1a')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x1a')]);_0x62a99c['offset']=qs[_0x272a('0x19')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x19')]);}_0x62a99c[_0x272a('0x35')]=qs[_0x272a('0x36')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x36')]);_0x62a99c['where']=qs[_0x272a('0x2e')](_[_0x272a('0x37')](_0x654dc6[_0x272a('0x2d')],_0x73707b[_0x272a('0x2e')]),_0x142f1);if(_0x654dc6[_0x272a('0x2d')][_0x272a('0x38')]){_0x62a99c['where']=_['merge'](_0x62a99c[_0x272a('0x39')],{'$or':_[_0x272a('0x28')](_0x142f1,function(_0x20e5b6){if(_0x20e5b6[_0x272a('0x3a')]!==_0x272a('0x3b')){var _0xf9b46={};_0xf9b46[_0x20e5b6[_0x272a('0x25')]]={'$like':'%'+_0x654dc6[_0x272a('0x2d')][_0x272a('0x38')]+'%'};return _0xf9b46;}})});}_0x62a99c=_[_0x272a('0x3c')]({},_0x62a99c,_0x654dc6[_0x272a('0x3d')]);var _0x46227e={'where':_0x62a99c[_0x272a('0x39')]};return db[_0x272a('0x29')][_0x272a('0x18')](_0x46227e)['then'](function(_0x33abdd){_0x10d03c[_0x272a('0x18')]=_0x33abdd;if(_0x654dc6['query'][_0x272a('0x3e')]){_0x62a99c[_0x272a('0x3f')]=[{'all':!![]}];}return db[_0x272a('0x29')][_0x272a('0x40')](_0x62a99c);})[_0x272a('0x21')](function(_0x357712){_0x10d03c[_0x272a('0x41')]=_0x357712;return _0x10d03c;})['then'](respondWithFilteredResult(_0x1bce15,_0x62a99c))[_0x272a('0x42')](handleError(_0x1bce15,null));};exports[_0x272a('0x43')]=function(_0x5a7a12,_0x48c7b0){var _0x35be0e={'raw':!![],'where':{'id':_0x5a7a12[_0x272a('0x44')]['id']}},_0x47fcbd={};_0x47fcbd[_0x272a('0x30')]=_[_0x272a('0x2c')](db[_0x272a('0x29')][_0x272a('0x2a')]);_0x47fcbd[_0x272a('0x2d')]=_['keys'](_0x5a7a12[_0x272a('0x2d')]);_0x47fcbd[_0x272a('0x2e')]=_['intersection'](_0x47fcbd[_0x272a('0x30')],_0x47fcbd[_0x272a('0x2d')]);_0x35be0e['attributes']=_[_0x272a('0x2f')](_0x47fcbd[_0x272a('0x30')],qs[_0x272a('0x32')](_0x5a7a12[_0x272a('0x2d')][_0x272a('0x32')]));_0x35be0e[_0x272a('0x31')]=_0x35be0e['attributes'][_0x272a('0x45')]?_0x35be0e[_0x272a('0x31')]:_0x47fcbd[_0x272a('0x30')];if(_0x5a7a12['query'][_0x272a('0x3e')]){_0x35be0e[_0x272a('0x3f')]=[{'all':!![]}];}_0x35be0e=_['merge']({},_0x35be0e,_0x5a7a12[_0x272a('0x3d')]);return db[_0x272a('0x29')][_0x272a('0x46')](_0x35be0e)[_0x272a('0x21')](handleEntityNotFound(_0x48c7b0,null))[_0x272a('0x21')](respondWithResult(_0x48c7b0,null))[_0x272a('0x42')](handleError(_0x48c7b0,null));};exports[_0x272a('0x47')]=function(_0x4d2f43,_0x53a627){return db['JscriptyAnswerReport']['create'](_0x4d2f43[_0x272a('0x48')],{})[_0x272a('0x21')](respondWithResult(_0x53a627,0xc9))[_0x272a('0x42')](handleError(_0x53a627,null));};exports[_0x272a('0x49')]=function(_0x4bb335,_0x96d803){if(_0x4bb335[_0x272a('0x48')]['id']){delete _0x4bb335['body']['id'];}return db[_0x272a('0x29')][_0x272a('0x46')]({'where':{'id':_0x4bb335[_0x272a('0x44')]['id']}})[_0x272a('0x21')](handleEntityNotFound(_0x96d803,null))[_0x272a('0x21')](saveUpdates(_0x4bb335[_0x272a('0x48')],null))[_0x272a('0x21')](respondWithResult(_0x96d803,null))[_0x272a('0x42')](handleError(_0x96d803,null));};exports[_0x272a('0x22')]=function(_0x961994,_0x313723){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x961994[_0x272a('0x44')]['id']}})['then'](handleEntityNotFound(_0x313723,null))[_0x272a('0x21')](removeEntity(_0x313723,null))[_0x272a('0x42')](handleError(_0x313723,null));};exports[_0x272a('0x4a')]=function(_0xc9e362,_0x40c86c){return db['JscriptyAnswerReport']['describe']()[_0x272a('0x21')](respondWithResult(_0x40c86c,null))['catch'](handleError(_0x40c86c,null));}; \ No newline at end of file +var _0xb138=['filters','pick','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../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','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where'];(function(_0x4a49bb,_0x59c7b2){var _0x3cf176=function(_0x5337a1){while(--_0x5337a1){_0x4a49bb['push'](_0x4a49bb['shift']());}};_0x3cf176(++_0x59c7b2);}(_0xb138,0x1dd));var _0x8b13=function(_0x4acd70,_0x47eabd){_0x4acd70=_0x4acd70-0x0;var _0x188a1e=_0xb138[_0x4acd70];return _0x188a1e;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];function respondWithStatusCode(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xcc;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['sendStatus'](_0x1893b1);}return _0xb227e0[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')]();};}function respondWithResult(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x479773){if(_0x479773){return _0x5f12b5[_0x8b13('0x1a')](_0x51a935)[_0x8b13('0x1c')](_0x479773);}};}function respondWithFilteredResult(_0xf29086,_0x2c615a){return function(_0x13f956){if(_0x13f956){var _0x542357=typeof _0x2c615a[_0x8b13('0x1d')]===_0x8b13('0x1e')&&typeof _0x2c615a[_0x8b13('0x1f')]===_0x8b13('0x1e');var _0x3eed21=_0x13f956[_0x8b13('0x20')];var _0x10fbde=_0x542357?0x0:_0x2c615a[_0x8b13('0x1d')];var _0x4989d3=_0x542357?_0x13f956['count']:_0x2c615a[_0x8b13('0x1d')]+_0x2c615a[_0x8b13('0x1f')];var _0x14a8ac;if(_0x4989d3>=_0x3eed21){_0x4989d3=_0x3eed21;_0x14a8ac=0xc8;}else{_0x14a8ac=0xce;}_0xf29086[_0x8b13('0x1a')](_0x14a8ac);return _0xf29086[_0x8b13('0x21')](_0x8b13('0x22'),_0x10fbde+'-'+_0x4989d3+'/'+_0x3eed21)['json'](_0x13f956);}return null;};}function patchUpdates(_0x1e8a48){return function(_0x3c4d4f){try{jsonpatch[_0x8b13('0x23')](_0x3c4d4f,_0x1e8a48,!![]);}catch(_0x54a309){return BPromise['reject'](_0x54a309);}return _0x3c4d4f[_0x8b13('0x24')]();};}function saveUpdates(_0xcb7621,_0x4f9902){return function(_0x3187ed){if(_0x3187ed){return _0x3187ed[_0x8b13('0x25')](_0xcb7621)[_0x8b13('0x26')](function(_0x213280){return _0x213280;});}return null;};}function removeEntity(_0xc05d5c,_0x583639){return function(_0x339271){if(_0x339271){return _0x339271[_0x8b13('0x27')]()['then'](function(){_0xc05d5c[_0x8b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420772,_0x325d68){return function(_0x54786a){if(!_0x54786a){_0x420772[_0x8b13('0x28')](0x194);}return _0x54786a;};}function handleError(_0x3223d8,_0x4f8e58){_0x4f8e58=_0x4f8e58||0x1f4;return function(_0x134c5e){logger[_0x8b13('0x29')](_0x134c5e[_0x8b13('0x2a')]);if(_0x134c5e[_0x8b13('0x2b')]){delete _0x134c5e[_0x8b13('0x2b')];}_0x3223d8['status'](_0x4f8e58)[_0x8b13('0x2c')](_0x134c5e);};}exports[_0x8b13('0x2d')]=function(_0x3475d8,_0x1511bf){var _0x114b01={},_0x2bb51d={},_0x5ab161={'count':0x0,'rows':[]};var _0x35fdca=_[_0x8b13('0x2e')](db[_0x8b13('0x2f')][_0x8b13('0x30')],function(_0x23fde7){return{'name':_0x23fde7[_0x8b13('0x31')],'type':_0x23fde7[_0x8b13('0x32')][_0x8b13('0x33')]};});_0x2bb51d[_0x8b13('0x34')]=_['map'](_0x35fdca,_0x8b13('0x2b'));_0x2bb51d[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x3475d8[_0x8b13('0x35')]);_0x2bb51d['filters']=_['intersection'](_0x2bb51d[_0x8b13('0x34')],_0x2bb51d['query']);_0x114b01['attributes']=_[_0x8b13('0x37')](_0x2bb51d['model'],qs[_0x8b13('0x38')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x38')]));_0x114b01[_0x8b13('0x39')]=_0x114b01[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x114b01[_0x8b13('0x39')]:_0x2bb51d[_0x8b13('0x34')];if(!_0x3475d8[_0x8b13('0x35')][_0x8b13('0x3b')]('nolimit')){_0x114b01[_0x8b13('0x1f')]=qs[_0x8b13('0x1f')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x114b01[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1d')]);}_0x114b01['order']=qs[_0x8b13('0x3c')](_0x3475d8['query'][_0x8b13('0x3c')]);_0x114b01[_0x8b13('0x3d')]=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x3475d8[_0x8b13('0x35')],_0x2bb51d[_0x8b13('0x3e')]),_0x35fdca);if(_0x3475d8['query']['filter']){_0x114b01[_0x8b13('0x3d')]=_['merge'](_0x114b01[_0x8b13('0x3d')],{'$or':_['map'](_0x35fdca,function(_0x590a23){if(_0x590a23[_0x8b13('0x32')]!==_0x8b13('0x40')){var _0x2bc877={};_0x2bc877[_0x590a23[_0x8b13('0x2b')]]={'$like':'%'+_0x3475d8['query']['filter']+'%'};return _0x2bc877;}})});}_0x114b01=_[_0x8b13('0x41')]({},_0x114b01,_0x3475d8['options']);var _0x6ba2f3={'where':_0x114b01[_0x8b13('0x3d')]};return db['JscriptyAnswerReport'][_0x8b13('0x20')](_0x6ba2f3)[_0x8b13('0x26')](function(_0x35c1d6){_0x5ab161[_0x8b13('0x20')]=_0x35c1d6;if(_0x3475d8[_0x8b13('0x35')][_0x8b13('0x42')]){_0x114b01[_0x8b13('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x114b01);})['then'](function(_0x3eb3c5){_0x5ab161[_0x8b13('0x44')]=_0x3eb3c5;return _0x5ab161;})[_0x8b13('0x26')](respondWithFilteredResult(_0x1511bf,_0x114b01))[_0x8b13('0x45')](handleError(_0x1511bf,null));};exports[_0x8b13('0x46')]=function(_0x271507,_0x492f7d){var _0x4342db={'raw':!![],'where':{'id':_0x271507[_0x8b13('0x47')]['id']}},_0x50e535={};_0x50e535['model']=_[_0x8b13('0x36')](db[_0x8b13('0x2f')][_0x8b13('0x30')]);_0x50e535[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x271507[_0x8b13('0x35')]);_0x50e535[_0x8b13('0x3e')]=_['intersection'](_0x50e535['model'],_0x50e535['query']);_0x4342db[_0x8b13('0x39')]=_[_0x8b13('0x37')](_0x50e535[_0x8b13('0x34')],qs[_0x8b13('0x38')](_0x271507['query']['fields']));_0x4342db[_0x8b13('0x39')]=_0x4342db['attributes'][_0x8b13('0x3a')]?_0x4342db[_0x8b13('0x39')]:_0x50e535[_0x8b13('0x34')];if(_0x271507[_0x8b13('0x35')][_0x8b13('0x42')]){_0x4342db['include']=[{'all':!![]}];}_0x4342db=_[_0x8b13('0x41')]({},_0x4342db,_0x271507[_0x8b13('0x48')]);return db[_0x8b13('0x2f')][_0x8b13('0x49')](_0x4342db)[_0x8b13('0x26')](handleEntityNotFound(_0x492f7d,null))[_0x8b13('0x26')](respondWithResult(_0x492f7d,null))[_0x8b13('0x45')](handleError(_0x492f7d,null));};exports[_0x8b13('0x4a')]=function(_0x3e192b,_0x518298){return db[_0x8b13('0x2f')]['create'](_0x3e192b[_0x8b13('0x4b')],{})[_0x8b13('0x26')](respondWithResult(_0x518298,0xc9))[_0x8b13('0x45')](handleError(_0x518298,null));};exports['update']=function(_0x148efb,_0x35f612){if(_0x148efb[_0x8b13('0x4b')]['id']){delete _0x148efb[_0x8b13('0x4b')]['id'];}return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x148efb[_0x8b13('0x47')]['id']}})['then'](handleEntityNotFound(_0x35f612,null))[_0x8b13('0x26')](saveUpdates(_0x148efb['body'],null))[_0x8b13('0x26')](respondWithResult(_0x35f612,null))[_0x8b13('0x45')](handleError(_0x35f612,null));};exports[_0x8b13('0x27')]=function(_0x435867,_0x2be640){return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x435867[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x2be640,null))[_0x8b13('0x26')](removeEntity(_0x2be640,null))[_0x8b13('0x45')](handleError(_0x2be640,null));};exports[_0x8b13('0x4c')]=function(_0xd55f3b,_0x2bdfae){return db[_0x8b13('0x2f')][_0x8b13('0x4c')]()[_0x8b13('0x26')](respondWithResult(_0x2bdfae,null))['catch'](handleError(_0x2bdfae,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 2e74a0c..e9d8009 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 _0x3b0b=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','lodash','../../config/logger','moment'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x3b0b,0x81));var _0xb3b0=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x3b0b[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xb3b0('0x0'));var util=require('util');var logger=require(_0xb3b0('0x1'))('api');var moment=require(_0xb3b0('0x2'));var BPromise=require(_0xb3b0('0x3'));var rp=require(_0xb3b0('0x4'));var fs=require('fs');var path=require(_0xb3b0('0x5'));var rimraf=require(_0xb3b0('0x6'));var config=require(_0xb3b0('0x7'));var attributes=require(_0xb3b0('0x8'));module[_0xb3b0('0x9')]=function(_0x465aae,_0x17dbc6){return _0x465aae[_0xb3b0('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a27=['api','request-promise','path','../../config/environment','define','JscriptyAnswerReport','lodash','util','../../config/logger'];(function(_0x419454,_0x481c7e){var _0x15cba1=function(_0x2875e2){while(--_0x2875e2){_0x419454['push'](_0x419454['shift']());}};_0x15cba1(++_0x481c7e);}(_0x5a27,0xa8));var _0x75a2=function(_0x5de80d,_0x3dab95){_0x5de80d=_0x5de80d-0x0;var _0x262fdd=_0x5a27[_0x5de80d];return _0x262fdd;};'use strict';var _=require(_0x75a2('0x0'));var util=require(_0x75a2('0x1'));var logger=require(_0x75a2('0x2'))(_0x75a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x75a2('0x4'));var fs=require('fs');var path=require(_0x75a2('0x5'));var rimraf=require('rimraf');var config=require(_0x75a2('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x382e70,_0x724d4a){return _0x382e70[_0x75a2('0x7')](_0x75a2('0x8'),attributes,{'tableName':'report_jscripty_answers','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 723af4e..88fcead 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 _0xefe6=['jayson/promise','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x39cdb8,_0x15ee98){var _0x44bbc9=function(_0x395338){while(--_0x395338){_0x39cdb8['push'](_0x39cdb8['shift']());}};_0x44bbc9(++_0x15ee98);}(_0xefe6,0x14c));var _0x6efe=function(_0x201920,_0x23a42e){_0x201920=_0x201920-0x0;var _0x11ca83=_0xefe6[_0x201920];return _0x11ca83;};'use strict';var _=require(_0x6efe('0x0'));var util=require('util');var moment=require(_0x6efe('0x1'));var BPromise=require(_0x6efe('0x2'));var rs=require(_0x6efe('0x3'));var fs=require('fs');var Redis=require(_0x6efe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6efe('0x5'));var logger=require(_0x6efe('0x6'))(_0x6efe('0x7'));var config=require('../../config/environment');var jayson=require(_0x6efe('0x8'));var client=jayson['client'][_0x6efe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b7d6b,_0x4795a2,_0x3ff69f){return new BPromise(function(_0x59b256,_0x5afb98){return client[_0x6efe('0xa')](_0x1b7d6b,_0x3ff69f)['then'](function(_0x31134b){logger[_0x6efe('0xb')](_0x6efe('0xc'),_0x4795a2,_0x6efe('0xd'));logger[_0x6efe('0xe')](_0x6efe('0xf'),_0x4795a2,_0x6efe('0xd'),JSON['stringify'](_0x31134b));if(_0x31134b['error']){if(_0x31134b[_0x6efe('0x10')]['code']===0x1f4){logger[_0x6efe('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4795a2,_0x31134b[_0x6efe('0x10')][_0x6efe('0x11')]);return _0x5afb98(_0x31134b[_0x6efe('0x10')][_0x6efe('0x11')]);}logger['error'](_0x6efe('0xc'),_0x4795a2,_0x31134b[_0x6efe('0x10')][_0x6efe('0x11')]);return _0x59b256(_0x31134b['error']['message']);}else{logger[_0x6efe('0xb')](_0x6efe('0xc'),_0x4795a2,'request\x20sent');_0x59b256(_0x31134b[_0x6efe('0x12')][_0x6efe('0x11')]);}})[_0x6efe('0x13')](function(_0x39f744){logger['error'](_0x6efe('0xc'),_0x4795a2,_0x39f744);_0x5afb98(_0x39f744);});});} \ No newline at end of file +var _0x714f=['rpc','../../config/environment','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9c68c4,_0x57ac51){var _0x44c3bb=function(_0x41f933){while(--_0x41f933){_0x9c68c4['push'](_0x9c68c4['shift']());}};_0x44c3bb(++_0x57ac51);}(_0x714f,0x149));var _0xf714=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x714f[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xf714('0x0'));var util=require('util');var moment=require(_0xf714('0x1'));var BPromise=require(_0xf714('0x2'));var rs=require(_0xf714('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf714('0x4'))['db'];var utils=require(_0xf714('0x5'));var logger=require(_0xf714('0x6'))(_0xf714('0x7'));var config=require(_0xf714('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf714('0x9')][_0xf714('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46a4e1,_0x31b6e4,_0x2c7a38){return new BPromise(function(_0xb16bf1,_0x4ca1b6){return client[_0xf714('0xb')](_0x46a4e1,_0x2c7a38)[_0xf714('0xc')](function(_0x3e909b){logger['info'](_0xf714('0xd'),_0x31b6e4,_0xf714('0xe'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x31b6e4,'request\x20sent',JSON['stringify'](_0x3e909b));if(_0x3e909b['error']){if(_0x3e909b[_0xf714('0xf')][_0xf714('0x10')]===0x1f4){logger[_0xf714('0xf')](_0xf714('0xd'),_0x31b6e4,_0x3e909b['error']['message']);return _0x4ca1b6(_0x3e909b[_0xf714('0xf')]['message']);}logger[_0xf714('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x31b6e4,_0x3e909b[_0xf714('0xf')]['message']);return _0xb16bf1(_0x3e909b[_0xf714('0xf')][_0xf714('0x11')]);}else{logger[_0xf714('0x12')](_0xf714('0xd'),_0x31b6e4,_0xf714('0xe'));_0xb16bf1(_0x3e909b[_0xf714('0x13')][_0xf714('0x11')]);}})[_0xf714('0x14')](function(_0x2eaa14){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x31b6e4,_0x2eaa14);_0x4ca1b6(_0x2eaa14);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 803caa5..24632eb 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 _0x2047=['clone','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id/sessions','isAuthenticated','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone'];(function(_0x6a7e10,_0x26cdfb){var _0x243647=function(_0x3d059f){while(--_0x3d059f){_0x6a7e10['push'](_0x6a7e10['shift']());}};_0x243647(++_0x26cdfb);}(_0x2047,0x14b));var _0x7204=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x2047[_0x24237f];return _0x48298e;};'use strict';var multer=require('multer');var util=require(_0x7204('0x0'));var path=require(_0x7204('0x1'));var timeout=require(_0x7204('0x2'));var express=require(_0x7204('0x3'));var router=express[_0x7204('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7204('0x5'));var config=require(_0x7204('0x6'));var controller=require(_0x7204('0x7'));router[_0x7204('0x8')]('/',auth['isAuthenticated'](),controller[_0x7204('0x9')]);router[_0x7204('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7204('0x8')](_0x7204('0xa'),auth[_0x7204('0xb')](),controller['getSessions']);router[_0x7204('0x8')](_0x7204('0xc'),auth[_0x7204('0xb')](),controller[_0x7204('0xd')]);router['get'](_0x7204('0xe'),auth[_0x7204('0xb')](),timeout(_0x7204('0xf')),controller[_0x7204('0x10')]);router[_0x7204('0x11')]('/',auth[_0x7204('0xb')](),controller[_0x7204('0x12')]);router[_0x7204('0x11')](_0x7204('0x13'),auth['isAuthenticated'](),controller[_0x7204('0x14')]);router[_0x7204('0x15')](_0x7204('0x16'),auth[_0x7204('0xb')](),controller[_0x7204('0x17')]);router[_0x7204('0x18')](_0x7204('0x16'),auth[_0x7204('0xb')](),controller[_0x7204('0x19')]);module[_0x7204('0x1a')]=router; \ No newline at end of file +var _0x713c=['../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','clone','put','update','destroy','multer','path','connect-timeout','express'];(function(_0x194665,_0x12b9a6){var _0x415e55=function(_0x560c1f){while(--_0x560c1f){_0x194665['push'](_0x194665['shift']());}};_0x415e55(++_0x12b9a6);}(_0x713c,0x183));var _0xc713=function(_0xdbc34c,_0x4ed1bd){_0xdbc34c=_0xdbc34c-0x0;var _0x1e0b16=_0x713c[_0xdbc34c];return _0x1e0b16;};'use strict';var multer=require(_0xc713('0x0'));var util=require('util');var path=require(_0xc713('0x1'));var timeout=require(_0xc713('0x2'));var express=require(_0xc713('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc713('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc713('0x5'));var controller=require(_0xc713('0x6'));router[_0xc713('0x7')]('/',auth[_0xc713('0x8')](),controller[_0xc713('0x9')]);router[_0xc713('0x7')](_0xc713('0xa'),auth['isAuthenticated'](),controller[_0xc713('0xb')]);router[_0xc713('0x7')]('/:id/sessions',auth[_0xc713('0x8')](),controller[_0xc713('0xc')]);router[_0xc713('0x7')](_0xc713('0xd'),auth[_0xc713('0x8')](),controller[_0xc713('0xe')]);router[_0xc713('0x7')](_0xc713('0xf'),auth[_0xc713('0x8')](),timeout('30s'),controller[_0xc713('0x10')]);router[_0xc713('0x11')]('/',auth[_0xc713('0x8')](),controller[_0xc713('0x12')]);router[_0xc713('0x11')]('/:id/clone',auth[_0xc713('0x8')](),controller[_0xc713('0x13')]);router[_0xc713('0x14')](_0xc713('0xa'),auth[_0xc713('0x8')](),controller[_0xc713('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc713('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 4c0316c..90f80fd 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 _0x8f8d=['sequelize','lodash','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x1cae98,_0x3651d7){var _0x55de44=function(_0x26e6ab){while(--_0x26e6ab){_0x1cae98['push'](_0x1cae98['shift']());}};_0x55de44(++_0x3651d7);}(_0x8f8d,0x121));var _0xd8f8=function(_0x559eab,_0x38367e){_0x559eab=_0x559eab-0x0;var _0x1245e5=_0x8f8d[_0x559eab];return _0x1245e5;};'use strict';var Sequelize=require(_0xd8f8('0x0'));var _=require(_0xd8f8('0x1'));var util=require(_0xd8f8('0x2'));module[_0xd8f8('0x3')]={'name':{'type':Sequelize[_0xd8f8('0x4')],'unique':_0xd8f8('0x5')},'description':{'type':Sequelize[_0xd8f8('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xd8f8('0x6')),'set':function(_0x136f30){if(_[_0xd8f8('0x7')](_0x136f30)){this[_0xd8f8('0x8')](_0xd8f8('0x9'),JSON[_0xd8f8('0xa')](_0x136f30));}else if(_[_0xd8f8('0xb')](_0x136f30)){this[_0xd8f8('0x8')](_0xd8f8('0x9'),_0x136f30);}else{this[_0xd8f8('0x8')](_0xd8f8('0x9'),util[_0xd8f8('0xc')](_0xd8f8('0xd'),this[_0xd8f8('0xe')](_0xd8f8('0x5'))||'',this[_0xd8f8('0xe')](_0xd8f8('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd8f8('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd8f8('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d8d=['lodash','STRING','TEXT','long','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','description','BOOLEAN'];(function(_0x2e91f2,_0x17da65){var _0x55db81=function(_0x1857db){while(--_0x1857db){_0x2e91f2['push'](_0x2e91f2['shift']());}};_0x55db81(++_0x17da65);}(_0x1d8d,0xfc));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd1d8('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xd1d8('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xd1d8('0x1')]},'formData':{'type':Sequelize[_0xd1d8('0x2')](_0xd1d8('0x3')),'set':function(_0x3151fb){if(_['isObjectLike'](_0x3151fb)){this[_0xd1d8('0x4')]('formData',JSON['stringify'](_0x3151fb));}else if(_[_0xd1d8('0x5')](_0x3151fb)){this[_0xd1d8('0x4')](_0xd1d8('0x6'),_0x3151fb);}else{this['setDataValue']('formData',util[_0xd1d8('0x7')](_0xd1d8('0x8'),this['getDataValue'](_0xd1d8('0x9'))||'',this['getDataValue'](_0xd1d8('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd1d8('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd1d8('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2a43137..e0ae234 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 _0x85de=['question','starttime','format','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','JscriptyProject','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getSessions','findOne','JscriptySessionReport','ProjectId','count','JscriptyAnswerReport','length','fromCharCode','toString','indexOf','replace','getSummary','parse','JscriptyQuestionReport','-createdAt','questionId'];(function(_0x923ab6,_0x200ec5){var _0x484752=function(_0x266328){while(--_0x266328){_0x923ab6['push'](_0x923ab6['shift']());}};_0x484752(++_0x200ec5);}(_0x85de,0x1f0));var _0xe85d=function(_0x163877,_0x369421){_0x163877=_0x163877-0x0;var _0x3879c2=_0x85de[_0x163877];return _0x3879c2;};'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('mustache');var util=require('util');var path=require(_0xe85d('0x6'));var sox=require(_0xe85d('0x7'));var csv=require('to-csv');var ejs=require(_0xe85d('0x8'));var fs=require('fs');var fs_extra=require(_0xe85d('0x9'));var _=require(_0xe85d('0xa'));var squel=require(_0xe85d('0xb'));var crypto=require(_0xe85d('0xc'));var jsforce=require(_0xe85d('0xd'));var deskjs=require(_0xe85d('0xe'));var toCsv=require(_0xe85d('0xf'));var querystring=require('querystring');var Papa=require(_0xe85d('0x10'));var Redis=require(_0xe85d('0x11'));var authService=require(_0xe85d('0x12'));var qs=require(_0xe85d('0x13'));var as=require(_0xe85d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85d('0x15'))('api');var utils=require(_0xe85d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe85d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec59a,_0x1fc972){_0x1fc972=_0x1fc972||0xcc;return function(_0x10dd73){if(_0x10dd73){return _0x3ec59a[_0xe85d('0x18')](_0x1fc972);}return _0x3ec59a[_0xe85d('0x19')](_0x1fc972)[_0xe85d('0x1a')]();};}function respondWithResult(_0xe3d1ca,_0x59382f){_0x59382f=_0x59382f||0xc8;return function(_0xe78813){if(_0xe78813){return _0xe3d1ca[_0xe85d('0x19')](_0x59382f)['json'](_0xe78813);}};}function respondWithFilteredResult(_0x2750e8,_0x11aa3d){return function(_0x174d06){if(_0x174d06){var _0x1e56c5=typeof _0x11aa3d[_0xe85d('0x1b')]===_0xe85d('0x1c')&&typeof _0x11aa3d[_0xe85d('0x1d')]===_0xe85d('0x1c');var _0x12cf32=_0x174d06['count'];var _0x2fc882=_0x1e56c5?0x0:_0x11aa3d['offset'];var _0x289384=_0x1e56c5?_0x174d06['count']:_0x11aa3d['offset']+_0x11aa3d['limit'];var _0xed29b9;if(_0x289384>=_0x12cf32){_0x289384=_0x12cf32;_0xed29b9=0xc8;}else{_0xed29b9=0xce;}_0x2750e8[_0xe85d('0x19')](_0xed29b9);return _0x2750e8[_0xe85d('0x1e')]('Content-Range',_0x2fc882+'-'+_0x289384+'/'+_0x12cf32)[_0xe85d('0x1f')](_0x174d06);}return null;};}function patchUpdates(_0x1cf621){return function(_0x44bab0){try{jsonpatch[_0xe85d('0x20')](_0x44bab0,_0x1cf621,!![]);}catch(_0x144380){return BPromise[_0xe85d('0x21')](_0x144380);}return _0x44bab0[_0xe85d('0x22')]();};}function saveUpdates(_0x2f77d8,_0x4d9970){return function(_0x296f02){if(_0x296f02){return _0x296f02[_0xe85d('0x23')](_0x2f77d8)[_0xe85d('0x24')](function(_0x3a95be){return _0x3a95be;});}return null;};}function removeEntity(_0x22a5c5,_0x58c73f){return function(_0x2672a3){if(_0x2672a3){return _0x2672a3[_0xe85d('0x25')]()['then'](function(){var _0x44a48c=_0x2672a3[_0xe85d('0x26')]({'plain':!![]});var _0x393902=_0xe85d('0x27');return db[_0xe85d('0x28')][_0xe85d('0x25')]({'where':{'type':_0x393902,'resourceId':_0x44a48c['id']}})[_0xe85d('0x24')](function(){return _0x2672a3;});})[_0xe85d('0x24')](function(){_0x22a5c5['status'](0xcc)[_0xe85d('0x1a')]();});}};}function handleEntityNotFound(_0x1ce626,_0x3c459c){return function(_0x591f7c){if(!_0x591f7c){_0x1ce626[_0xe85d('0x18')](0x194);}return _0x591f7c;};}function handleError(_0x29b4d5,_0xa88e5b){_0xa88e5b=_0xa88e5b||0x1f4;return function(_0x1a7892){logger['error'](_0x1a7892[_0xe85d('0x29')]);if(_0x1a7892[_0xe85d('0x2a')]){delete _0x1a7892[_0xe85d('0x2a')];}_0x29b4d5[_0xe85d('0x19')](_0xa88e5b)['send'](_0x1a7892);};}exports[_0xe85d('0x2b')]=function(_0xe86634,_0x36b263){var _0x3130cc={},_0x32b24c={},_0x14a8c8={'count':0x0,'rows':[]};var _0xf3f13c=_['map'](db['JscriptyProject'][_0xe85d('0x2c')],function(_0x2f60d6){return{'name':_0x2f60d6[_0xe85d('0x2d')],'type':_0x2f60d6[_0xe85d('0x2e')][_0xe85d('0x2f')]};});_0x32b24c['model']=_[_0xe85d('0x30')](_0xf3f13c,_0xe85d('0x2a'));_0x32b24c[_0xe85d('0x31')]=_[_0xe85d('0x32')](_0xe86634['query']);_0x32b24c[_0xe85d('0x33')]=_[_0xe85d('0x34')](_0x32b24c[_0xe85d('0x35')],_0x32b24c['query']);_0x3130cc[_0xe85d('0x36')]=_['intersection'](_0x32b24c[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0xe86634[_0xe85d('0x31')][_0xe85d('0x37')]));_0x3130cc[_0xe85d('0x36')]=_0x3130cc[_0xe85d('0x36')]['length']?_0x3130cc[_0xe85d('0x36')]:_0x32b24c['model'];if(!_0xe86634[_0xe85d('0x31')][_0xe85d('0x38')](_0xe85d('0x39'))){_0x3130cc['limit']=qs[_0xe85d('0x1d')](_0xe86634[_0xe85d('0x31')]['limit']);_0x3130cc[_0xe85d('0x1b')]=qs[_0xe85d('0x1b')](_0xe86634[_0xe85d('0x31')][_0xe85d('0x1b')]);}_0x3130cc[_0xe85d('0x3a')]=qs[_0xe85d('0x3b')](_0xe86634['query']['sort']);_0x3130cc[_0xe85d('0x3c')]=qs[_0xe85d('0x33')](_[_0xe85d('0x3d')](_0xe86634[_0xe85d('0x31')],_0x32b24c[_0xe85d('0x33')]),_0xf3f13c);if(_0xe86634['query'][_0xe85d('0x3e')]){_0x3130cc['where']=_['merge'](_0x3130cc['where'],{'$or':_[_0xe85d('0x30')](_0xf3f13c,function(_0x5fb38a){if(_0x5fb38a['type']!==_0xe85d('0x3f')){var _0x252892={};_0x252892[_0x5fb38a[_0xe85d('0x2a')]]={'$like':'%'+_0xe86634[_0xe85d('0x31')][_0xe85d('0x3e')]+'%'};return _0x252892;}})});}_0x3130cc=_[_0xe85d('0x40')]({},_0x3130cc,_0xe86634[_0xe85d('0x41')]);var _0x37f922={'where':_0x3130cc[_0xe85d('0x3c')]};return db[_0xe85d('0x42')]['count'](_0x37f922)[_0xe85d('0x24')](function(_0x2c0c99){_0x14a8c8['count']=_0x2c0c99;if(_0xe86634[_0xe85d('0x31')][_0xe85d('0x43')]){_0x3130cc[_0xe85d('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0xe85d('0x45')](_0x3130cc);})['then'](function(_0x4b4fe0){_0x14a8c8[_0xe85d('0x46')]=_0x4b4fe0;return _0x14a8c8;})[_0xe85d('0x24')](respondWithFilteredResult(_0x36b263,_0x3130cc))['catch'](handleError(_0x36b263,null));};exports[_0xe85d('0x47')]=function(_0x2f7b1f,_0x2da07c){var _0x57e71a={'raw':![],'where':{'id':_0x2f7b1f[_0xe85d('0x48')]['id']}},_0x5c45da={};_0x5c45da[_0xe85d('0x35')]=_[_0xe85d('0x32')](db['JscriptyProject'][_0xe85d('0x2c')]);_0x5c45da[_0xe85d('0x31')]=_['keys'](_0x2f7b1f[_0xe85d('0x31')]);_0x5c45da['filters']=_[_0xe85d('0x34')](_0x5c45da[_0xe85d('0x35')],_0x5c45da[_0xe85d('0x31')]);_0x57e71a[_0xe85d('0x36')]=_[_0xe85d('0x34')](_0x5c45da[_0xe85d('0x35')],qs['fields'](_0x2f7b1f[_0xe85d('0x31')][_0xe85d('0x37')]));_0x57e71a['attributes']=_0x57e71a[_0xe85d('0x36')]['length']?_0x57e71a[_0xe85d('0x36')]:_0x5c45da[_0xe85d('0x35')];if(_0x2f7b1f[_0xe85d('0x31')][_0xe85d('0x43')]){_0x57e71a['include']=[{'all':!![]}];}_0x57e71a=_[_0xe85d('0x40')]({},_0x57e71a,_0x2f7b1f[_0xe85d('0x41')]);return db['JscriptyProject'][_0xe85d('0x49')](_0x57e71a)[_0xe85d('0x24')](handleEntityNotFound(_0x2da07c,null))[_0xe85d('0x24')](respondWithResult(_0x2da07c,null))['catch'](handleError(_0x2da07c,null));};exports[_0xe85d('0x4a')]=function(_0x5e9641,_0x18966d){return db[_0xe85d('0x42')]['create'](_0x5e9641[_0xe85d('0x4b')],{})[_0xe85d('0x24')](function(_0x5a032f){var _0x2bf4c1=_0x5e9641[_0xe85d('0x4c')]['get']({'plain':!![]});if(!_0x2bf4c1)throw new Error(_0xe85d('0x4d'));if(_0x2bf4c1[_0xe85d('0x4e')]==='user'){var _0x340790=_0x5a032f[_0xe85d('0x26')]({'plain':!![]});var _0x4a860e=_0xe85d('0x27');return db[_0xe85d('0x4f')][_0xe85d('0x49')]({'where':{'name':_0x4a860e,'userProfileId':_0x2bf4c1[_0xe85d('0x50')]},'raw':!![]})['then'](function(_0x25e53f){if(_0x25e53f&&_0x25e53f['autoAssociation']===0x0){return db[_0xe85d('0x28')]['create']({'name':_0x340790[_0xe85d('0x2a')],'resourceId':_0x340790['id'],'type':_0x25e53f[_0xe85d('0x2a')],'sectionId':_0x25e53f['id']},{})[_0xe85d('0x24')](function(){return _0x5a032f;});}else{return _0x5a032f;}})[_0xe85d('0x51')](function(_0x43ead1){logger[_0xe85d('0x52')](_0xe85d('0x53'),_0x43ead1);throw _0x43ead1;});}return _0x5a032f;})[_0xe85d('0x24')](respondWithResult(_0x18966d,0xc9))[_0xe85d('0x51')](handleError(_0x18966d,null));};exports['clone']=function(_0xc53c90,_0x3021b5){var _0x3fcace={'where':{'id':_0xc53c90[_0xe85d('0x48')]['id']}},_0x22e667={};_0x22e667[_0xe85d('0x35')]=_[_0xe85d('0x32')](db[_0xe85d('0x42')]['rawAttributes']);_0x3fcace[_0xe85d('0x36')]=_['intersection'](_0x22e667[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0xc53c90[_0xe85d('0x31')]['fields']));_0x3fcace[_0xe85d('0x36')]=_0x3fcace[_0xe85d('0x36')]['length']?_0x3fcace['attributes']:_0x22e667[_0xe85d('0x35')];if(_0xc53c90[_0xe85d('0x31')][_0xe85d('0x43')]){_0x3fcace['include']=[{'all':!![]}];}_0x3fcace=_['merge']({},_0x3fcace,_0xc53c90[_0xe85d('0x41')]);return db[_0xe85d('0x42')][_0xe85d('0x49')](_0x3fcace)[_0xe85d('0x24')](handleEntityNotFound(_0x3021b5,null))['then'](function(_0x38b619){if(_0x38b619){var _0x325587=_0x38b619[_0xe85d('0x26')]({'plain':!![]});_0x325587=qs[_0xe85d('0x54')](_0x325587,['id','createdAt',_0xe85d('0x55')]);_0xc53c90[_0xe85d('0x4b')]=_[_0xe85d('0x54')](_0xc53c90['body'],['id',_0xe85d('0x56'),_0xe85d('0x55')]);return db[_0xe85d('0x42')][_0xe85d('0x4a')](_[_0xe85d('0x40')](_0x325587,_0xc53c90[_0xe85d('0x4b')]),{'include':_0xc53c90[_0xe85d('0x31')][_0xe85d('0x43')]?[{'all':!![]}]:undefined})[_0xe85d('0x24')](function(_0x2b0d9e){var _0x49c5f7=_0xc53c90[_0xe85d('0x4c')][_0xe85d('0x26')]({'plain':!![]});if(!_0x49c5f7)throw new Error(_0xe85d('0x4d'));if(_0x49c5f7[_0xe85d('0x4e')]===_0xe85d('0x4c')){var _0x41e95f=_0x2b0d9e[_0xe85d('0x26')]({'plain':!![]});var _0x5a83e1=_0xe85d('0x27');return db['UserProfileSection'][_0xe85d('0x49')]({'where':{'name':_0x5a83e1,'userProfileId':_0x49c5f7[_0xe85d('0x50')]},'raw':!![]})[_0xe85d('0x24')](function(_0x5c02ee){if(_0x5c02ee&&_0x5c02ee[_0xe85d('0x57')]===0x0){return db[_0xe85d('0x28')][_0xe85d('0x4a')]({'name':_0x41e95f['name'],'resourceId':_0x41e95f['id'],'type':_0x5c02ee[_0xe85d('0x2a')],'sectionId':_0x5c02ee['id']},{})[_0xe85d('0x24')](function(){return _0x2b0d9e;});}else{return _0x2b0d9e;}})[_0xe85d('0x51')](function(_0xcfe279){logger['error'](_0xe85d('0x53'),_0xcfe279);throw _0xcfe279;});}return _0x2b0d9e;});}})[_0xe85d('0x24')](respondWithResult(_0x3021b5,0xc9))['catch'](handleError(_0x3021b5,null));};exports[_0xe85d('0x23')]=function(_0x2c96ad,_0x237369){if(_0x2c96ad[_0xe85d('0x4b')]['id']){delete _0x2c96ad[_0xe85d('0x4b')]['id'];}return db[_0xe85d('0x42')][_0xe85d('0x49')]({'where':{'id':_0x2c96ad[_0xe85d('0x48')]['id']}})[_0xe85d('0x24')](handleEntityNotFound(_0x237369,null))[_0xe85d('0x24')](saveUpdates(_0x2c96ad[_0xe85d('0x4b')],null))[_0xe85d('0x24')](respondWithResult(_0x237369,null))[_0xe85d('0x51')](handleError(_0x237369,null));};exports['destroy']=function(_0x5c1dbb,_0x13eabf){return db['JscriptyProject'][_0xe85d('0x49')]({'where':{'id':_0x5c1dbb[_0xe85d('0x48')]['id']}})[_0xe85d('0x24')](handleEntityNotFound(_0x13eabf,null))['then'](removeEntity(_0x13eabf,null))['catch'](handleError(_0x13eabf,null));};exports[_0xe85d('0x58')]=function(_0x52f8f,_0x100454,_0x3e0bc9){var _0x5db07e={'raw':!![],'where':{}};var _0x567974={};var _0x40dcbb={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe85d('0x59')]({'where':{'id':_0x52f8f[_0xe85d('0x48')]['id']}})['then'](handleEntityNotFound(_0x100454,null))[_0xe85d('0x24')](function(_0x3a513c){if(_0x3a513c){_0x567974[_0xe85d('0x35')]=_[_0xe85d('0x32')](db[_0xe85d('0x5a')][_0xe85d('0x2c')]);_0x567974[_0xe85d('0x31')]=_['keys'](_0x52f8f['query']);_0x567974[_0xe85d('0x33')]=_[_0xe85d('0x34')](_0x567974[_0xe85d('0x35')],_0x567974['query']);_0x5db07e[_0xe85d('0x36')]=_[_0xe85d('0x34')](_0x567974[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0x52f8f[_0xe85d('0x31')][_0xe85d('0x37')]));_0x5db07e[_0xe85d('0x36')]=_0x5db07e['attributes']['length']?_0x5db07e[_0xe85d('0x36')]:_0x567974[_0xe85d('0x35')];if(!_0x52f8f[_0xe85d('0x31')][_0xe85d('0x38')](_0xe85d('0x39'))){_0x5db07e[_0xe85d('0x1d')]=qs['limit'](_0x52f8f['query'][_0xe85d('0x1d')]);_0x5db07e['offset']=qs[_0xe85d('0x1b')](_0x52f8f[_0xe85d('0x31')][_0xe85d('0x1b')]);}_0x5db07e[_0xe85d('0x3a')]=qs['sort'](_0x52f8f[_0xe85d('0x31')][_0xe85d('0x3b')]);_0x5db07e['where']=qs[_0xe85d('0x33')](_['pick'](_0x52f8f[_0xe85d('0x31')],_0x567974['filters']));_0x5db07e[_0xe85d('0x3c')][_0xe85d('0x5b')]=_0x3a513c['id'];if(_0x52f8f[_0xe85d('0x31')][_0xe85d('0x3e')]){_0x5db07e[_0xe85d('0x3c')]=_[_0xe85d('0x40')](_0x5db07e[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x30')](_0x5db07e[_0xe85d('0x36')],function(_0x595f9c){var _0x2bddb3={};_0x2bddb3[_0x595f9c]={'$like':'%'+_0x52f8f[_0xe85d('0x31')]['filter']+'%'};return _0x2bddb3;})});}_0x5db07e=_['merge']({},_0x5db07e,_0x52f8f['options']);return db[_0xe85d('0x5a')][_0xe85d('0x5c')]({'where':_0x5db07e['where']})[_0xe85d('0x24')](function(_0x535499){_0x40dcbb[_0xe85d('0x5c')]=_0x535499;if(_0x52f8f['query'][_0xe85d('0x43')]){_0x5db07e[_0xe85d('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xe85d('0x45')](_0x5db07e);})['then'](function(_0x486bc5){_0x40dcbb['rows']=_0x486bc5;return _0x40dcbb;});}})[_0xe85d('0x24')](respondWithFilteredResult(_0x100454,_0x5db07e))[_0xe85d('0x51')](handleError(_0x100454,null));};exports['getAnswers']=function(_0x4e24b2,_0x3aa054,_0x36a8c6){var _0x26da60={'raw':!![],'where':{}};var _0x4bd218={};var _0x33167f={'count':0x0,'rows':[]};return db[_0xe85d('0x42')]['findOne']({'where':{'id':_0x4e24b2[_0xe85d('0x48')]['id']}})[_0xe85d('0x24')](handleEntityNotFound(_0x3aa054,null))['then'](function(_0x1b2512){if(_0x1b2512){_0x4bd218['model']=_[_0xe85d('0x32')](db[_0xe85d('0x5d')][_0xe85d('0x2c')]);_0x4bd218['query']=_[_0xe85d('0x32')](_0x4e24b2['query']);_0x4bd218[_0xe85d('0x33')]=_[_0xe85d('0x34')](_0x4bd218['model'],_0x4bd218[_0xe85d('0x31')]);_0x26da60[_0xe85d('0x36')]=_[_0xe85d('0x34')](_0x4bd218[_0xe85d('0x35')],qs[_0xe85d('0x37')](_0x4e24b2[_0xe85d('0x31')]['fields']));_0x26da60['attributes']=_0x26da60[_0xe85d('0x36')][_0xe85d('0x5e')]?_0x26da60[_0xe85d('0x36')]:_0x4bd218[_0xe85d('0x35')];if(!_0x4e24b2[_0xe85d('0x31')][_0xe85d('0x38')](_0xe85d('0x39'))){_0x26da60[_0xe85d('0x1d')]=qs[_0xe85d('0x1d')](_0x4e24b2[_0xe85d('0x31')][_0xe85d('0x1d')]);_0x26da60['offset']=qs[_0xe85d('0x1b')](_0x4e24b2[_0xe85d('0x31')][_0xe85d('0x1b')]);}_0x26da60['order']=qs[_0xe85d('0x3b')](_0x4e24b2[_0xe85d('0x31')]['sort']);_0x26da60[_0xe85d('0x3c')]=qs[_0xe85d('0x33')](_[_0xe85d('0x3d')](_0x4e24b2[_0xe85d('0x31')],_0x4bd218[_0xe85d('0x33')]));_0x26da60['where'][_0xe85d('0x5b')]=_0x1b2512['id'];if(_0x4e24b2['query'][_0xe85d('0x3e')]){_0x26da60['where']=_['merge'](_0x26da60[_0xe85d('0x3c')],{'$or':_[_0xe85d('0x30')](_0x26da60[_0xe85d('0x36')],function(_0xe47ca7){var _0x23654a={};_0x23654a[_0xe47ca7]={'$like':'%'+_0x4e24b2[_0xe85d('0x31')]['filter']+'%'};return _0x23654a;})});}_0x26da60=_['merge']({},_0x26da60,_0x4e24b2[_0xe85d('0x41')]);return db['JscriptyAnswerReport'][_0xe85d('0x5c')]({'where':_0x26da60['where']})[_0xe85d('0x24')](function(_0x4655cb){_0x33167f['count']=_0x4655cb;if(_0x4e24b2[_0xe85d('0x31')]['includeAll']){_0x26da60[_0xe85d('0x44')]=[{'all':!![]}];}return db[_0xe85d('0x5d')]['findAll'](_0x26da60);})[_0xe85d('0x24')](function(_0x250d22){_0x33167f[_0xe85d('0x46')]=_0x250d22;return _0x33167f;});}})[_0xe85d('0x24')](respondWithFilteredResult(_0x3aa054,_0x26da60))['catch'](handleError(_0x3aa054,null));};function char(_0x3a704c){return'number'===typeof _0x3a704c?String[_0xe85d('0x5f')][_0xe85d('0x20')](null,arguments):_0x3a704c;}function needsEncapsulation(_0x399ce1){return!!_0x399ce1&&(_0x399ce1[_0xe85d('0x60')]()[_0xe85d('0x61')](char(0xd))>=0x0||_0x399ce1[_0xe85d('0x60')]()[_0xe85d('0x61')](char(0xa))>=0x0||_0x399ce1['toString']()[_0xe85d('0x61')](char(0x2c))>=0x0||_0x399ce1[_0xe85d('0x60')]()[_0xe85d('0x61')](char(0x22))>=0x0);}function encapsulate(_0x269cb8){var _0x5415d8=char(0x22),_0x1b7b74='\x5c'+char(0x22),_0x303557=_0x269cb8[_0xe85d('0x60')]()[_0xe85d('0x62')](new RegExp(_0x5415d8,'g'),_0x1b7b74);return _0x5415d8+_0x303557+_0x5415d8;}exports[_0xe85d('0x63')]=function(_0x2d0d49,_0x3add5c,_0x204dd2){var _0x2cbe2f,_0x2d22f5;var _0x4b1778={'where':{'ProjectId':_0x2d0d49[_0xe85d('0x48')]['id']}};if(_0x2d0d49['query']['startTime']){_0x4b1778[_0xe85d('0x3c')]['starttime']=JSON[_0xe85d('0x64')](_0x2d0d49[_0xe85d('0x31')]['startTime']);}return db[_0xe85d('0x5a')][_0xe85d('0x45')](_0x4b1778)[_0xe85d('0x24')](handleEntityNotFound(_0x3add5c,null))[_0xe85d('0x24')](function(_0x15fd9d){if(_0x15fd9d){_0x2cbe2f=_0x15fd9d;return db[_0xe85d('0x65')][_0xe85d('0x45')]({'where':{'SessionId':{'$in':_[_0xe85d('0x30')](_0x2cbe2f,'id')},'ProjectId':_0x2d0d49[_0xe85d('0x48')]['id']},'order':_0xe85d('0x66')});}})[_0xe85d('0x24')](handleEntityNotFound(_0x3add5c,null))[_0xe85d('0x24')](function(_0x18208b){if(_0x18208b){_0x2d22f5=_0x18208b;var _0x292a60={};for(var _0x2e1644=0x0,_0x2d2327=_0x2d22f5[_0xe85d('0x5e')];_0x2e1644<_0x2d2327;_0x2e1644++){if(!_0x292a60[_0xe85d('0x38')](_0x2d22f5[_0x2e1644][_0xe85d('0x67')])){_0x292a60[_0x2d22f5[_0x2e1644][_0xe85d('0x67')]]=needsEncapsulation(_0x2d22f5[_0x2e1644][_0xe85d('0x68')])?encapsulate(_0x2d22f5[_0x2e1644][_0xe85d('0x68')]):_0x2d22f5[_0x2e1644][_0xe85d('0x68')];}}var _0x29c15f=[],_0x114ab1={};for(var _0x1c871f=0x0,_0x1610df=_0x2cbe2f[_0xe85d('0x5e')];_0x1c871f<_0x1610df;_0x1c871f++){_0x114ab1={'ProjectId':_0x2d0d49[_0xe85d('0x48')]['id'],'SessionId':_0x2cbe2f[_0x1c871f]['id'],'StartTime':moment(_0x2cbe2f[_0x1c871f][_0xe85d('0x69')])[_0xe85d('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1aac1a=0x0,_0x1271bf=_0x2d22f5[_0xe85d('0x5e')];_0x1aac1a<_0x1271bf;_0x1aac1a++){if(_0x2d22f5[_0x1aac1a][_0xe85d('0x6b')]==_0x2cbe2f[_0x1c871f]['id']&&_0x292a60[_0xe85d('0x38')](_0x2d22f5[_0x1aac1a][_0xe85d('0x67')])){_0x114ab1[_0x292a60[_0x2d22f5[_0x1aac1a][_0xe85d('0x67')]]]=_0x2d22f5[_0x1aac1a][_0xe85d('0x6c')];}}for(var _0x29db51 in _0x292a60){if(!_0x114ab1[_0xe85d('0x38')](_0x292a60[_0x29db51])){_0x114ab1[_0x292a60[_0x29db51]]=null;}}_0x29c15f[_0xe85d('0x6d')](_0x114ab1);}return _0x29c15f;}})[_0xe85d('0x24')](function(_0x4ef0e8){if(!_['isEmpty'](_0x4ef0e8)){var _0x2083c5=toCsv(_0x4ef0e8);var _0x3c12f2=Date[_0xe85d('0x6e')]();fs[_0xe85d('0x6f')](util[_0xe85d('0x6a')](_0xe85d('0x70'),_0x2d0d49['params']['id'],_0x3c12f2),_0x2083c5);_0x3add5c[_0xe85d('0x71')](_0xe85d('0x72'),_0xe85d('0x73')+util[_0xe85d('0x6a')](_0xe85d('0x74'),_0x2d0d49[_0xe85d('0x48')]['id'],_0x3c12f2));_0x3add5c[_0xe85d('0x71')](_0xe85d('0x75'),_0xe85d('0x76'));return _0x3add5c[_0xe85d('0x77')](util[_0xe85d('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2d0d49[_0xe85d('0x48')]['id'],_0x3c12f2));}else{return _0x3add5c[_0xe85d('0x18')](0xcc);}})[_0xe85d('0x51')](handleError(_0x3add5c,null));}; \ No newline at end of file +var _0xfb5d=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','JscriptyProject','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','destroy','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','ProjectId','fromCharCode','indexOf','toString','replace','startTime','starttime','parse','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','Content-disposition','attachment;\x20filename=','format','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfb5d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xdfb5('0x0'));var rimraf=require(_0xdfb5('0x1'));var zipdir=require(_0xdfb5('0x2'));var jsonpatch=require(_0xdfb5('0x3'));var rp=require('request-promise');var moment=require(_0xdfb5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdfb5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfb5('0x6'));var squel=require(_0xdfb5('0x7'));var crypto=require(_0xdfb5('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xdfb5('0x9'));var toCsv=require(_0xdfb5('0x5'));var querystring=require(_0xdfb5('0xa'));var Papa=require(_0xdfb5('0xb'));var Redis=require(_0xdfb5('0xc'));var authService=require(_0xdfb5('0xd'));var qs=require(_0xdfb5('0xe'));var as=require(_0xdfb5('0xf'));var hardwareService=require(_0xdfb5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xdfb5('0x11'));var config=require(_0xdfb5('0x12'));var licenseUtil=require(_0xdfb5('0x13'));var db=require(_0xdfb5('0x14'))['db'];function respondWithStatusCode(_0x33cbc1,_0x57d233){_0x57d233=_0x57d233||0xcc;return function(_0x2b3683){if(_0x2b3683){return _0x33cbc1[_0xdfb5('0x15')](_0x57d233);}return _0x33cbc1['status'](_0x57d233)[_0xdfb5('0x16')]();};}function respondWithResult(_0x23ff84,_0x44c4a3){_0x44c4a3=_0x44c4a3||0xc8;return function(_0x11adb7){if(_0x11adb7){return _0x23ff84[_0xdfb5('0x17')](_0x44c4a3)['json'](_0x11adb7);}};}function respondWithFilteredResult(_0x56d8aa,_0x15fd53){return function(_0x4e863d){if(_0x4e863d){var _0xbd0bd6=typeof _0x15fd53[_0xdfb5('0x18')]===_0xdfb5('0x19')&&typeof _0x15fd53[_0xdfb5('0x1a')]===_0xdfb5('0x19');var _0x35b052=_0x4e863d[_0xdfb5('0x1b')];var _0x54fa59=_0xbd0bd6?0x0:_0x15fd53[_0xdfb5('0x18')];var _0x29576a=_0xbd0bd6?_0x4e863d[_0xdfb5('0x1b')]:_0x15fd53[_0xdfb5('0x18')]+_0x15fd53[_0xdfb5('0x1a')];var _0x57e2b1;if(_0x29576a>=_0x35b052){_0x29576a=_0x35b052;_0x57e2b1=0xc8;}else{_0x57e2b1=0xce;}_0x56d8aa[_0xdfb5('0x17')](_0x57e2b1);return _0x56d8aa[_0xdfb5('0x1c')]('Content-Range',_0x54fa59+'-'+_0x29576a+'/'+_0x35b052)[_0xdfb5('0x1d')](_0x4e863d);}return null;};}function patchUpdates(_0x531ab8){return function(_0x3a0908){try{jsonpatch[_0xdfb5('0x1e')](_0x3a0908,_0x531ab8,!![]);}catch(_0x1e282a){return BPromise[_0xdfb5('0x1f')](_0x1e282a);}return _0x3a0908['save']();};}function saveUpdates(_0xf58ac,_0x2fbf03){return function(_0xe08d19){if(_0xe08d19){return _0xe08d19['update'](_0xf58ac)[_0xdfb5('0x20')](function(_0x21ec5d){return _0x21ec5d;});}return null;};}function removeEntity(_0x401b08,_0x495c34){return function(_0x51784c){if(_0x51784c){return _0x51784c['destroy']()[_0xdfb5('0x20')](function(){var _0x386aaa=_0x51784c[_0xdfb5('0x21')]({'plain':!![]});var _0x34764b='Projects';return db[_0xdfb5('0x22')]['destroy']({'where':{'type':_0x34764b,'resourceId':_0x386aaa['id']}})[_0xdfb5('0x20')](function(){return _0x51784c;});})[_0xdfb5('0x20')](function(){_0x401b08[_0xdfb5('0x17')](0xcc)[_0xdfb5('0x16')]();});}};}function handleEntityNotFound(_0x6ff5a7,_0x305d3a){return function(_0x4c5d82){if(!_0x4c5d82){_0x6ff5a7[_0xdfb5('0x15')](0x194);}return _0x4c5d82;};}function handleError(_0x5bcbef,_0x45c7e8){_0x45c7e8=_0x45c7e8||0x1f4;return function(_0x2ecd76){logger[_0xdfb5('0x23')](_0x2ecd76[_0xdfb5('0x24')]);if(_0x2ecd76[_0xdfb5('0x25')]){delete _0x2ecd76[_0xdfb5('0x25')];}_0x5bcbef[_0xdfb5('0x17')](_0x45c7e8)[_0xdfb5('0x26')](_0x2ecd76);};}exports[_0xdfb5('0x27')]=function(_0x52e8a6,_0x2d289f){var _0xa61e4d={},_0x213bdb={},_0x1b7931={'count':0x0,'rows':[]};var _0x39a0e7=_[_0xdfb5('0x28')](db['JscriptyProject'][_0xdfb5('0x29')],function(_0x49f49f){return{'name':_0x49f49f[_0xdfb5('0x2a')],'type':_0x49f49f[_0xdfb5('0x2b')][_0xdfb5('0x2c')]};});_0x213bdb[_0xdfb5('0x2d')]=_[_0xdfb5('0x28')](_0x39a0e7,_0xdfb5('0x25'));_0x213bdb[_0xdfb5('0x2e')]=_[_0xdfb5('0x2f')](_0x52e8a6[_0xdfb5('0x2e')]);_0x213bdb[_0xdfb5('0x30')]=_['intersection'](_0x213bdb[_0xdfb5('0x2d')],_0x213bdb[_0xdfb5('0x2e')]);_0xa61e4d[_0xdfb5('0x31')]=_['intersection'](_0x213bdb[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x32')]));_0xa61e4d[_0xdfb5('0x31')]=_0xa61e4d[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0xa61e4d[_0xdfb5('0x31')]:_0x213bdb[_0xdfb5('0x2d')];if(!_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x34')](_0xdfb5('0x35'))){_0xa61e4d['limit']=qs[_0xdfb5('0x1a')](_0x52e8a6['query'][_0xdfb5('0x1a')]);_0xa61e4d['offset']=qs[_0xdfb5('0x18')](_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x18')]);}_0xa61e4d[_0xdfb5('0x36')]=qs[_0xdfb5('0x37')](_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x37')]);_0xa61e4d['where']=qs[_0xdfb5('0x30')](_[_0xdfb5('0x38')](_0x52e8a6[_0xdfb5('0x2e')],_0x213bdb[_0xdfb5('0x30')]),_0x39a0e7);if(_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x39')]){_0xa61e4d[_0xdfb5('0x3a')]=_['merge'](_0xa61e4d[_0xdfb5('0x3a')],{'$or':_[_0xdfb5('0x28')](_0x39a0e7,function(_0x5eb1ee){if(_0x5eb1ee[_0xdfb5('0x2b')]!=='VIRTUAL'){var _0x378f01={};_0x378f01[_0x5eb1ee['name']]={'$like':'%'+_0x52e8a6[_0xdfb5('0x2e')][_0xdfb5('0x39')]+'%'};return _0x378f01;}})});}_0xa61e4d=_[_0xdfb5('0x3b')]({},_0xa61e4d,_0x52e8a6[_0xdfb5('0x3c')]);var _0x1fa5f6={'where':_0xa61e4d[_0xdfb5('0x3a')]};return db[_0xdfb5('0x3d')][_0xdfb5('0x1b')](_0x1fa5f6)['then'](function(_0x85521b){_0x1b7931[_0xdfb5('0x1b')]=_0x85521b;if(_0x52e8a6['query'][_0xdfb5('0x3e')]){_0xa61e4d['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xdfb5('0x3f')](_0xa61e4d);})[_0xdfb5('0x20')](function(_0x2b3b97){_0x1b7931[_0xdfb5('0x40')]=_0x2b3b97;return _0x1b7931;})['then'](respondWithFilteredResult(_0x2d289f,_0xa61e4d))[_0xdfb5('0x41')](handleError(_0x2d289f,null));};exports[_0xdfb5('0x42')]=function(_0x15563b,_0x215517){var _0x2c192d={'raw':![],'where':{'id':_0x15563b[_0xdfb5('0x43')]['id']}},_0x3ba40b={};_0x3ba40b[_0xdfb5('0x2d')]=_['keys'](db[_0xdfb5('0x3d')][_0xdfb5('0x29')]);_0x3ba40b[_0xdfb5('0x2e')]=_[_0xdfb5('0x2f')](_0x15563b[_0xdfb5('0x2e')]);_0x3ba40b[_0xdfb5('0x30')]=_[_0xdfb5('0x44')](_0x3ba40b[_0xdfb5('0x2d')],_0x3ba40b[_0xdfb5('0x2e')]);_0x2c192d['attributes']=_[_0xdfb5('0x44')](_0x3ba40b[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x15563b[_0xdfb5('0x2e')]['fields']));_0x2c192d['attributes']=_0x2c192d[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x2c192d['attributes']:_0x3ba40b[_0xdfb5('0x2d')];if(_0x15563b['query']['includeAll']){_0x2c192d[_0xdfb5('0x45')]=[{'all':!![]}];}_0x2c192d=_[_0xdfb5('0x3b')]({},_0x2c192d,_0x15563b[_0xdfb5('0x3c')]);return db['JscriptyProject'][_0xdfb5('0x46')](_0x2c192d)[_0xdfb5('0x20')](handleEntityNotFound(_0x215517,null))[_0xdfb5('0x20')](respondWithResult(_0x215517,null))[_0xdfb5('0x41')](handleError(_0x215517,null));};exports[_0xdfb5('0x47')]=function(_0x27b12a,_0x1fdbcf){return db[_0xdfb5('0x3d')]['create'](_0x27b12a['body'],{})[_0xdfb5('0x20')](function(_0x5136d2){var _0x43a608=_0x27b12a[_0xdfb5('0x48')][_0xdfb5('0x21')]({'plain':!![]});if(!_0x43a608)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43a608['role']===_0xdfb5('0x48')){var _0x21f0fa=_0x5136d2[_0xdfb5('0x21')]({'plain':!![]});var _0x365335=_0xdfb5('0x49');return db[_0xdfb5('0x4a')]['find']({'where':{'name':_0x365335,'userProfileId':_0x43a608[_0xdfb5('0x4b')]},'raw':!![]})['then'](function(_0x23d804){if(_0x23d804&&_0x23d804[_0xdfb5('0x4c')]===0x0){return db['UserProfileResource'][_0xdfb5('0x47')]({'name':_0x21f0fa[_0xdfb5('0x25')],'resourceId':_0x21f0fa['id'],'type':_0x23d804['name'],'sectionId':_0x23d804['id']},{})['then'](function(){return _0x5136d2;});}else{return _0x5136d2;}})['catch'](function(_0x1a04ce){logger[_0xdfb5('0x23')](_0xdfb5('0x4d'),_0x1a04ce);throw _0x1a04ce;});}return _0x5136d2;})[_0xdfb5('0x20')](respondWithResult(_0x1fdbcf,0xc9))[_0xdfb5('0x41')](handleError(_0x1fdbcf,null));};exports['clone']=function(_0x63b35c,_0x51febf){var _0x1b61dc={'where':{'id':_0x63b35c['params']['id']}},_0x17171c={};_0x17171c[_0xdfb5('0x2d')]=_['keys'](db[_0xdfb5('0x3d')]['rawAttributes']);_0x1b61dc[_0xdfb5('0x31')]=_[_0xdfb5('0x44')](_0x17171c[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x63b35c[_0xdfb5('0x2e')][_0xdfb5('0x32')]));_0x1b61dc[_0xdfb5('0x31')]=_0x1b61dc[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x1b61dc[_0xdfb5('0x31')]:_0x17171c['model'];if(_0x63b35c[_0xdfb5('0x2e')][_0xdfb5('0x3e')]){_0x1b61dc[_0xdfb5('0x45')]=[{'all':!![]}];}_0x1b61dc=_['merge']({},_0x1b61dc,_0x63b35c[_0xdfb5('0x3c')]);return db[_0xdfb5('0x3d')]['find'](_0x1b61dc)[_0xdfb5('0x20')](handleEntityNotFound(_0x51febf,null))[_0xdfb5('0x20')](function(_0x5a97dd){if(_0x5a97dd){var _0x3f75b0=_0x5a97dd[_0xdfb5('0x21')]({'plain':!![]});_0x3f75b0=qs['omit'](_0x3f75b0,['id',_0xdfb5('0x4e'),'updatedAt']);_0x63b35c[_0xdfb5('0x4f')]=_['omit'](_0x63b35c['body'],['id','createdAt','updatedAt']);return db[_0xdfb5('0x3d')][_0xdfb5('0x47')](_[_0xdfb5('0x3b')](_0x3f75b0,_0x63b35c[_0xdfb5('0x4f')]),{'include':_0x63b35c[_0xdfb5('0x2e')][_0xdfb5('0x3e')]?[{'all':!![]}]:undefined})[_0xdfb5('0x20')](function(_0x397b8e){var _0x177af7=_0x63b35c[_0xdfb5('0x48')][_0xdfb5('0x21')]({'plain':!![]});if(!_0x177af7)throw new Error(_0xdfb5('0x50'));if(_0x177af7[_0xdfb5('0x51')]===_0xdfb5('0x48')){var _0x590706=_0x397b8e['get']({'plain':!![]});var _0x4caee5='Projects';return db[_0xdfb5('0x4a')][_0xdfb5('0x46')]({'where':{'name':_0x4caee5,'userProfileId':_0x177af7[_0xdfb5('0x4b')]},'raw':!![]})[_0xdfb5('0x20')](function(_0x284ee3){if(_0x284ee3&&_0x284ee3[_0xdfb5('0x4c')]===0x0){return db[_0xdfb5('0x22')]['create']({'name':_0x590706['name'],'resourceId':_0x590706['id'],'type':_0x284ee3[_0xdfb5('0x25')],'sectionId':_0x284ee3['id']},{})[_0xdfb5('0x20')](function(){return _0x397b8e;});}else{return _0x397b8e;}})[_0xdfb5('0x41')](function(_0x7af5de){logger['error'](_0xdfb5('0x4d'),_0x7af5de);throw _0x7af5de;});}return _0x397b8e;});}})[_0xdfb5('0x20')](respondWithResult(_0x51febf,0xc9))[_0xdfb5('0x41')](handleError(_0x51febf,null));};exports['update']=function(_0x5622ff,_0x14b116){if(_0x5622ff[_0xdfb5('0x4f')]['id']){delete _0x5622ff[_0xdfb5('0x4f')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x5622ff[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x14b116,null))[_0xdfb5('0x20')](saveUpdates(_0x5622ff['body'],null))['then'](respondWithResult(_0x14b116,null))[_0xdfb5('0x41')](handleError(_0x14b116,null));};exports[_0xdfb5('0x52')]=function(_0x36a544,_0x591a87){return db['JscriptyProject'][_0xdfb5('0x46')]({'where':{'id':_0x36a544[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x591a87,null))['then'](removeEntity(_0x591a87,null))[_0xdfb5('0x41')](handleError(_0x591a87,null));};exports[_0xdfb5('0x53')]=function(_0x61ea55,_0x41a08f,_0x11c057){var _0x153852={'raw':!![],'where':{}};var _0x2f1337={};var _0x3ad536={'count':0x0,'rows':[]};return db[_0xdfb5('0x3d')][_0xdfb5('0x54')]({'where':{'id':_0x61ea55[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x41a08f,null))[_0xdfb5('0x20')](function(_0x26c7b9){if(_0x26c7b9){_0x2f1337[_0xdfb5('0x2d')]=_['keys'](db[_0xdfb5('0x55')][_0xdfb5('0x29')]);_0x2f1337[_0xdfb5('0x2e')]=_[_0xdfb5('0x2f')](_0x61ea55[_0xdfb5('0x2e')]);_0x2f1337['filters']=_[_0xdfb5('0x44')](_0x2f1337[_0xdfb5('0x2d')],_0x2f1337['query']);_0x153852[_0xdfb5('0x31')]=_[_0xdfb5('0x44')](_0x2f1337[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x61ea55[_0xdfb5('0x2e')]['fields']));_0x153852[_0xdfb5('0x31')]=_0x153852[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x153852['attributes']:_0x2f1337[_0xdfb5('0x2d')];if(!_0x61ea55['query'][_0xdfb5('0x34')](_0xdfb5('0x35'))){_0x153852[_0xdfb5('0x1a')]=qs[_0xdfb5('0x1a')](_0x61ea55[_0xdfb5('0x2e')]['limit']);_0x153852['offset']=qs[_0xdfb5('0x18')](_0x61ea55[_0xdfb5('0x2e')][_0xdfb5('0x18')]);}_0x153852[_0xdfb5('0x36')]=qs[_0xdfb5('0x37')](_0x61ea55[_0xdfb5('0x2e')]['sort']);_0x153852[_0xdfb5('0x3a')]=qs[_0xdfb5('0x30')](_[_0xdfb5('0x38')](_0x61ea55['query'],_0x2f1337[_0xdfb5('0x30')]));_0x153852[_0xdfb5('0x3a')]['ProjectId']=_0x26c7b9['id'];if(_0x61ea55[_0xdfb5('0x2e')]['filter']){_0x153852['where']=_[_0xdfb5('0x3b')](_0x153852[_0xdfb5('0x3a')],{'$or':_[_0xdfb5('0x28')](_0x153852['attributes'],function(_0x2c145b){var _0x67b37b={};_0x67b37b[_0x2c145b]={'$like':'%'+_0x61ea55[_0xdfb5('0x2e')][_0xdfb5('0x39')]+'%'};return _0x67b37b;})});}_0x153852=_['merge']({},_0x153852,_0x61ea55[_0xdfb5('0x3c')]);return db[_0xdfb5('0x55')][_0xdfb5('0x1b')]({'where':_0x153852['where']})[_0xdfb5('0x20')](function(_0x464d8e){_0x3ad536[_0xdfb5('0x1b')]=_0x464d8e;if(_0x61ea55[_0xdfb5('0x2e')][_0xdfb5('0x3e')]){_0x153852[_0xdfb5('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x153852);})[_0xdfb5('0x20')](function(_0x460f34){_0x3ad536[_0xdfb5('0x40')]=_0x460f34;return _0x3ad536;});}})[_0xdfb5('0x20')](respondWithFilteredResult(_0x41a08f,_0x153852))[_0xdfb5('0x41')](handleError(_0x41a08f,null));};exports['getAnswers']=function(_0x34a976,_0x5bc6dc,_0x4c6420){var _0x2e5f1b={'raw':!![],'where':{}};var _0x577121={};var _0x21a9a7={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdfb5('0x54')]({'where':{'id':_0x34a976[_0xdfb5('0x43')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x5bc6dc,null))[_0xdfb5('0x20')](function(_0x337915){if(_0x337915){_0x577121['model']=_[_0xdfb5('0x2f')](db[_0xdfb5('0x56')][_0xdfb5('0x29')]);_0x577121['query']=_[_0xdfb5('0x2f')](_0x34a976[_0xdfb5('0x2e')]);_0x577121[_0xdfb5('0x30')]=_['intersection'](_0x577121['model'],_0x577121[_0xdfb5('0x2e')]);_0x2e5f1b[_0xdfb5('0x31')]=_[_0xdfb5('0x44')](_0x577121[_0xdfb5('0x2d')],qs[_0xdfb5('0x32')](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x32')]));_0x2e5f1b[_0xdfb5('0x31')]=_0x2e5f1b[_0xdfb5('0x31')][_0xdfb5('0x33')]?_0x2e5f1b[_0xdfb5('0x31')]:_0x577121[_0xdfb5('0x2d')];if(!_0x34a976[_0xdfb5('0x2e')]['hasOwnProperty'](_0xdfb5('0x35'))){_0x2e5f1b[_0xdfb5('0x1a')]=qs[_0xdfb5('0x1a')](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x1a')]);_0x2e5f1b[_0xdfb5('0x18')]=qs['offset'](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x18')]);}_0x2e5f1b[_0xdfb5('0x36')]=qs[_0xdfb5('0x37')](_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x37')]);_0x2e5f1b[_0xdfb5('0x3a')]=qs[_0xdfb5('0x30')](_[_0xdfb5('0x38')](_0x34a976['query'],_0x577121[_0xdfb5('0x30')]));_0x2e5f1b[_0xdfb5('0x3a')][_0xdfb5('0x57')]=_0x337915['id'];if(_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x39')]){_0x2e5f1b[_0xdfb5('0x3a')]=_['merge'](_0x2e5f1b[_0xdfb5('0x3a')],{'$or':_[_0xdfb5('0x28')](_0x2e5f1b['attributes'],function(_0x19e4f1){var _0x9ddc0f={};_0x9ddc0f[_0x19e4f1]={'$like':'%'+_0x34a976[_0xdfb5('0x2e')][_0xdfb5('0x39')]+'%'};return _0x9ddc0f;})});}_0x2e5f1b=_[_0xdfb5('0x3b')]({},_0x2e5f1b,_0x34a976[_0xdfb5('0x3c')]);return db['JscriptyAnswerReport']['count']({'where':_0x2e5f1b[_0xdfb5('0x3a')]})[_0xdfb5('0x20')](function(_0x503b2b){_0x21a9a7[_0xdfb5('0x1b')]=_0x503b2b;if(_0x34a976['query'][_0xdfb5('0x3e')]){_0x2e5f1b[_0xdfb5('0x45')]=[{'all':!![]}];}return db[_0xdfb5('0x56')]['findAll'](_0x2e5f1b);})[_0xdfb5('0x20')](function(_0x211e9c){_0x21a9a7['rows']=_0x211e9c;return _0x21a9a7;});}})[_0xdfb5('0x20')](respondWithFilteredResult(_0x5bc6dc,_0x2e5f1b))[_0xdfb5('0x41')](handleError(_0x5bc6dc,null));};function char(_0x3e7b8b){return'number'===typeof _0x3e7b8b?String[_0xdfb5('0x58')][_0xdfb5('0x1e')](null,arguments):_0x3e7b8b;}function needsEncapsulation(_0x4797ba){return!!_0x4797ba&&(_0x4797ba['toString']()[_0xdfb5('0x59')](char(0xd))>=0x0||_0x4797ba[_0xdfb5('0x5a')]()[_0xdfb5('0x59')](char(0xa))>=0x0||_0x4797ba['toString']()[_0xdfb5('0x59')](char(0x2c))>=0x0||_0x4797ba[_0xdfb5('0x5a')]()[_0xdfb5('0x59')](char(0x22))>=0x0);}function encapsulate(_0x40e16b){var _0x2fc33a=char(0x22),_0x795174='\x5c'+char(0x22),_0x169ca3=_0x40e16b[_0xdfb5('0x5a')]()[_0xdfb5('0x5b')](new RegExp(_0x2fc33a,'g'),_0x795174);return _0x2fc33a+_0x169ca3+_0x2fc33a;}exports['getSummary']=function(_0x47acd4,_0x148d4c,_0x134120){var _0x45d9d8,_0x2d5566;var _0x3a07e6={'where':{'ProjectId':_0x47acd4[_0xdfb5('0x43')]['id']}};if(_0x47acd4['query'][_0xdfb5('0x5c')]){_0x3a07e6[_0xdfb5('0x3a')][_0xdfb5('0x5d')]=JSON[_0xdfb5('0x5e')](_0x47acd4[_0xdfb5('0x2e')][_0xdfb5('0x5c')]);}return db[_0xdfb5('0x55')]['findAll'](_0x3a07e6)['then'](handleEntityNotFound(_0x148d4c,null))[_0xdfb5('0x20')](function(_0x1c0386){if(_0x1c0386){_0x45d9d8=_0x1c0386;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0x45d9d8,'id')},'ProjectId':_0x47acd4[_0xdfb5('0x43')]['id']},'order':'-createdAt'});}})[_0xdfb5('0x20')](handleEntityNotFound(_0x148d4c,null))['then'](function(_0x2062da){if(_0x2062da){_0x2d5566=_0x2062da;var _0x1459b1={};for(var _0x2ccc7f=0x0,_0x93a545=_0x2d5566[_0xdfb5('0x33')];_0x2ccc7f<_0x93a545;_0x2ccc7f++){if(!_0x1459b1[_0xdfb5('0x34')](_0x2d5566[_0x2ccc7f][_0xdfb5('0x5f')])){_0x1459b1[_0x2d5566[_0x2ccc7f][_0xdfb5('0x5f')]]=needsEncapsulation(_0x2d5566[_0x2ccc7f][_0xdfb5('0x60')])?encapsulate(_0x2d5566[_0x2ccc7f][_0xdfb5('0x60')]):_0x2d5566[_0x2ccc7f][_0xdfb5('0x60')];}}var _0x2365fd=[],_0x163508={};for(var _0x2cacce=0x0,_0x1ae077=_0x45d9d8[_0xdfb5('0x33')];_0x2cacce<_0x1ae077;_0x2cacce++){_0x163508={'ProjectId':_0x47acd4['params']['id'],'SessionId':_0x45d9d8[_0x2cacce]['id'],'StartTime':moment(_0x45d9d8[_0x2cacce][_0xdfb5('0x5d')])['format'](_0xdfb5('0x61'))};for(var _0xf084e0=0x0,_0x26b805=_0x2d5566[_0xdfb5('0x33')];_0xf084e0<_0x26b805;_0xf084e0++){if(_0x2d5566[_0xf084e0][_0xdfb5('0x62')]==_0x45d9d8[_0x2cacce]['id']&&_0x1459b1[_0xdfb5('0x34')](_0x2d5566[_0xf084e0][_0xdfb5('0x5f')])){_0x163508[_0x1459b1[_0x2d5566[_0xf084e0][_0xdfb5('0x5f')]]]=_0x2d5566[_0xf084e0][_0xdfb5('0x63')];}}for(var _0x1d625c in _0x1459b1){if(!_0x163508[_0xdfb5('0x34')](_0x1459b1[_0x1d625c])){_0x163508[_0x1459b1[_0x1d625c]]=null;}}_0x2365fd[_0xdfb5('0x64')](_0x163508);}return _0x2365fd;}})[_0xdfb5('0x20')](function(_0x2eee0e){if(!_['isEmpty'](_0x2eee0e)){var _0x1dadcf=toCsv(_0x2eee0e);var _0x2fae83=Date[_0xdfb5('0x65')]();fs[_0xdfb5('0x66')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47acd4[_0xdfb5('0x43')]['id'],_0x2fae83),_0x1dadcf);_0x148d4c['setHeader'](_0xdfb5('0x67'),_0xdfb5('0x68')+util[_0xdfb5('0x69')]('Jscripty_Project_%d_Summary_%s.csv',_0x47acd4[_0xdfb5('0x43')]['id'],_0x2fae83));_0x148d4c[_0xdfb5('0x6a')](_0xdfb5('0x6b'),_0xdfb5('0x6c'));return _0x148d4c[_0xdfb5('0x6d')](util['format'](_0xdfb5('0x6e'),_0x47acd4[_0xdfb5('0x43')]['id'],_0x2fae83));}else{return _0x148d4c[_0xdfb5('0x15')](0xcc);}})[_0xdfb5('0x41')](handleError(_0x148d4c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8a47d19..b43943d 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 _0x44e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x5f52e4,_0x5a69b3){var _0x25148b=function(_0x461a44){while(--_0x461a44){_0x5f52e4['push'](_0x5f52e4['shift']());}};_0x25148b(++_0x5a69b3);}(_0x44e8,0xd7));var _0x844e=function(_0x4a788f,_0x21542c){_0x4a788f=_0x4a788f-0x0;var _0x3a98c7=_0x44e8[_0x4a788f];return _0x3a98c7;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41d9=['../../config/environment','exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x261d54,_0x2b6c2d){var _0x18e974=function(_0x238246){while(--_0x238246){_0x261d54['push'](_0x261d54['shift']());}};_0x18e974(++_0x2b6c2d);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var logger=require(_0x941d('0x2'))(_0x941d('0x3'));var moment=require(_0x941d('0x4'));var BPromise=require(_0x941d('0x5'));var rp=require(_0x941d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x941d('0x7'));var config=require(_0x941d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x941d('0x9')]=function(_0x19dd41,_0x56e384){return _0x19dd41[_0x941d('0xa')]('JscriptyProject',attributes,{'tableName':_0x941d('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 0bb275c..1d664dc 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x263205,_0x267ba){_0x263205=_0x263205-0x0;var _0x19a403=_0xac4a[_0x263205];return _0x19a403;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3fea23,_0x4fc696){var _0x93b1d9=function(_0x4e30c3){while(--_0x4e30c3){_0x3fea23['push'](_0x3fea23['shift']());}};_0x93b1d9(++_0x4fc696);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3f5206,_0x34f3d7){_0x3f5206=_0x3f5206-0x0;var _0x1174f5=_0xb43b[_0x3f5206];return _0x1174f5;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 88bdbea..49849e4 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 _0x3b3f=['/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe'];(function(_0x102049,_0x4a6825){var _0x237716=function(_0x28b3e5){while(--_0x28b3e5){_0x102049['push'](_0x102049['shift']());}};_0x237716(++_0x4a6825);}(_0x3b3f,0x171));var _0xf3b3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3b3f[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0xf3b3('0x0'));var path=require(_0xf3b3('0x1'));var timeout=require(_0xf3b3('0x2'));var express=require(_0xf3b3('0x3'));var router=express[_0xf3b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf3b3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf3b3('0x6'));router[_0xf3b3('0x7')]('/',auth[_0xf3b3('0x8')](),controller[_0xf3b3('0x9')]);router[_0xf3b3('0x7')]('/describe',auth[_0xf3b3('0x8')](),controller[_0xf3b3('0xa')]);router[_0xf3b3('0x7')](_0xf3b3('0xb'),auth['isAuthenticated'](),controller[_0xf3b3('0xc')]);router[_0xf3b3('0xd')]('/',auth['isAuthenticated'](),controller[_0xf3b3('0xe')]);router['put'](_0xf3b3('0xb'),auth[_0xf3b3('0x8')](),controller[_0xf3b3('0xf')]);router[_0xf3b3('0x10')](_0xf3b3('0xb'),auth['isAuthenticated'](),controller[_0xf3b3('0x11')]);module[_0xf3b3('0x12')]=router; \ No newline at end of file +var _0x7b71=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x3a475a,_0x40bf1d){var _0x3acf74=function(_0x59fbd1){while(--_0x59fbd1){_0x3a475a['push'](_0x3a475a['shift']());}};_0x3acf74(++_0x40bf1d);}(_0x7b71,0xf7));var _0x17b7=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x7b71[_0x5db657];return _0x2d6e70;};'use strict';var multer=require(_0x17b7('0x0'));var util=require('util');var path=require(_0x17b7('0x1'));var timeout=require(_0x17b7('0x2'));var express=require('express');var router=express[_0x17b7('0x3')]();var fs_extra=require(_0x17b7('0x4'));var auth=require(_0x17b7('0x5'));var interaction=require(_0x17b7('0x6'));var config=require(_0x17b7('0x7'));var controller=require(_0x17b7('0x8'));router['get']('/',auth[_0x17b7('0x9')](),controller[_0x17b7('0xa')]);router[_0x17b7('0xb')](_0x17b7('0xc'),auth['isAuthenticated'](),controller[_0x17b7('0xd')]);router[_0x17b7('0xb')](_0x17b7('0xe'),auth[_0x17b7('0x9')](),controller[_0x17b7('0xf')]);router[_0x17b7('0x10')]('/',auth[_0x17b7('0x9')](),controller['create']);router['put'](_0x17b7('0xe'),auth[_0x17b7('0x9')](),controller[_0x17b7('0x11')]);router[_0x17b7('0x12')](_0x17b7('0xe'),auth['isAuthenticated'](),controller[_0x17b7('0x13')]);module[_0x17b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 637b0af..ca848d7 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x530a4b,_0x51689c){_0x530a4b=_0x530a4b-0x0;var _0x59fc34=_0x7a54[_0x530a4b];return _0x59fc34;};'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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x2784a0,_0x211b9b){_0x2784a0=_0x2784a0-0x0;var _0x25fb94=_0x7a54[_0x2784a0];return _0x25fb94;};'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 f601081..81c79e6 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 _0x76b9=['to-csv','ejs','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','offset','set','apply','save','update','then','sendStatus','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','zip-dir','request-promise','mustache','util','path','sox'];(function(_0x34340e,_0x23864a){var _0x33889b=function(_0x2a59a7){while(--_0x2a59a7){_0x34340e['push'](_0x34340e['shift']());}};_0x33889b(++_0x23864a);}(_0x76b9,0x148));var _0x976b=function(_0x52463a,_0x160170){_0x52463a=_0x52463a-0x0;var _0xad7ce2=_0x76b9[_0x52463a];return _0xad7ce2;};'use strict';var emlformat=require(_0x976b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x976b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x976b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x976b('0x3'));var util=require(_0x976b('0x4'));var path=require(_0x976b('0x5'));var sox=require(_0x976b('0x6'));var csv=require(_0x976b('0x7'));var ejs=require(_0x976b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x976b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x976b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x976b('0xa'));var authService=require(_0x976b('0xb'));var qs=require(_0x976b('0xc'));var as=require(_0x976b('0xd'));var hardwareService=require(_0x976b('0xe'));var logger=require('../../config/logger')(_0x976b('0xf'));var utils=require(_0x976b('0x10'));var config=require(_0x976b('0x11'));var licenseUtil=require(_0x976b('0x12'));var db=require(_0x976b('0x13'))['db'];function respondWithStatusCode(_0x15b3fc,_0x33ba4f){_0x33ba4f=_0x33ba4f||0xcc;return function(_0x109243){if(_0x109243){return _0x15b3fc['sendStatus'](_0x33ba4f);}return _0x15b3fc[_0x976b('0x14')](_0x33ba4f)[_0x976b('0x15')]();};}function respondWithResult(_0x1cf452,_0x5dea72){_0x5dea72=_0x5dea72||0xc8;return function(_0x2e0999){if(_0x2e0999){return _0x1cf452['status'](_0x5dea72)['json'](_0x2e0999);}};}function respondWithFilteredResult(_0x282e6b,_0x313ea7){return function(_0x194840){if(_0x194840){var _0x11c1d3=typeof _0x313ea7['offset']==='undefined'&&typeof _0x313ea7[_0x976b('0x16')]===_0x976b('0x17');var _0x2213c5=_0x194840['count'];var _0x66130=_0x11c1d3?0x0:_0x313ea7[_0x976b('0x18')];var _0x5e74c8=_0x11c1d3?_0x194840['count']:_0x313ea7[_0x976b('0x18')]+_0x313ea7[_0x976b('0x16')];var _0x11a050;if(_0x5e74c8>=_0x2213c5){_0x5e74c8=_0x2213c5;_0x11a050=0xc8;}else{_0x11a050=0xce;}_0x282e6b[_0x976b('0x14')](_0x11a050);return _0x282e6b[_0x976b('0x19')]('Content-Range',_0x66130+'-'+_0x5e74c8+'/'+_0x2213c5)['json'](_0x194840);}return null;};}function patchUpdates(_0x5408f1){return function(_0x48445f){try{jsonpatch[_0x976b('0x1a')](_0x48445f,_0x5408f1,!![]);}catch(_0x483cdf){return BPromise['reject'](_0x483cdf);}return _0x48445f[_0x976b('0x1b')]();};}function saveUpdates(_0x54f9ab,_0x440051){return function(_0x55542d){if(_0x55542d){return _0x55542d[_0x976b('0x1c')](_0x54f9ab)['then'](function(_0x488ad3){return _0x488ad3;});}return null;};}function removeEntity(_0x49c9fb,_0x2f85d3){return function(_0x121d95){if(_0x121d95){return _0x121d95['destroy']()[_0x976b('0x1d')](function(){_0x49c9fb[_0x976b('0x14')](0xcc)[_0x976b('0x15')]();});}};}function handleEntityNotFound(_0x44d3ab,_0x4d88b6){return function(_0x496fc6){if(!_0x496fc6){_0x44d3ab[_0x976b('0x1e')](0x194);}return _0x496fc6;};}function handleError(_0x181694,_0x17aede){_0x17aede=_0x17aede||0x1f4;return function(_0x46dc82){logger[_0x976b('0x1f')](_0x46dc82[_0x976b('0x20')]);if(_0x46dc82[_0x976b('0x21')]){delete _0x46dc82[_0x976b('0x21')];}_0x181694[_0x976b('0x14')](_0x17aede)[_0x976b('0x22')](_0x46dc82);};}exports['index']=function(_0x275ec3,_0x3c8bf6){var _0x4d2eb9={},_0x50ed73={},_0x282b52={'count':0x0,'rows':[]};var _0x51da78=_[_0x976b('0x23')](db[_0x976b('0x24')][_0x976b('0x25')],function(_0x34babe){return{'name':_0x34babe[_0x976b('0x26')],'type':_0x34babe[_0x976b('0x27')][_0x976b('0x28')]};});_0x50ed73[_0x976b('0x29')]=_[_0x976b('0x23')](_0x51da78,_0x976b('0x21'));_0x50ed73[_0x976b('0x2a')]=_[_0x976b('0x2b')](_0x275ec3[_0x976b('0x2a')]);_0x50ed73[_0x976b('0x2c')]=_[_0x976b('0x2d')](_0x50ed73[_0x976b('0x29')],_0x50ed73['query']);_0x4d2eb9[_0x976b('0x2e')]=_['intersection'](_0x50ed73['model'],qs[_0x976b('0x2f')](_0x275ec3[_0x976b('0x2a')][_0x976b('0x2f')]));_0x4d2eb9[_0x976b('0x2e')]=_0x4d2eb9[_0x976b('0x2e')][_0x976b('0x30')]?_0x4d2eb9[_0x976b('0x2e')]:_0x50ed73[_0x976b('0x29')];if(!_0x275ec3[_0x976b('0x2a')][_0x976b('0x31')]('nolimit')){_0x4d2eb9[_0x976b('0x16')]=qs[_0x976b('0x16')](_0x275ec3['query'][_0x976b('0x16')]);_0x4d2eb9[_0x976b('0x18')]=qs[_0x976b('0x18')](_0x275ec3[_0x976b('0x2a')][_0x976b('0x18')]);}_0x4d2eb9[_0x976b('0x32')]=qs['sort'](_0x275ec3[_0x976b('0x2a')]['sort']);_0x4d2eb9[_0x976b('0x33')]=qs[_0x976b('0x2c')](_['pick'](_0x275ec3[_0x976b('0x2a')],_0x50ed73[_0x976b('0x2c')]),_0x51da78);if(_0x275ec3[_0x976b('0x2a')][_0x976b('0x34')]){_0x4d2eb9[_0x976b('0x33')]=_[_0x976b('0x35')](_0x4d2eb9['where'],{'$or':_[_0x976b('0x23')](_0x51da78,function(_0x75a9fa){if(_0x75a9fa[_0x976b('0x27')]!==_0x976b('0x36')){var _0x29f76d={};_0x29f76d[_0x75a9fa[_0x976b('0x21')]]={'$like':'%'+_0x275ec3['query'][_0x976b('0x34')]+'%'};return _0x29f76d;}})});}_0x4d2eb9=_[_0x976b('0x35')]({},_0x4d2eb9,_0x275ec3[_0x976b('0x37')]);var _0x57979d={'where':_0x4d2eb9['where']};return db['JscriptyQuestionReport'][_0x976b('0x38')](_0x57979d)[_0x976b('0x1d')](function(_0x23cd45){_0x282b52[_0x976b('0x38')]=_0x23cd45;if(_0x275ec3['query'][_0x976b('0x39')]){_0x4d2eb9[_0x976b('0x3a')]=[{'all':!![]}];}return db[_0x976b('0x24')][_0x976b('0x3b')](_0x4d2eb9);})[_0x976b('0x1d')](function(_0x2d9a76){_0x282b52['rows']=_0x2d9a76;return _0x282b52;})[_0x976b('0x1d')](respondWithFilteredResult(_0x3c8bf6,_0x4d2eb9))[_0x976b('0x3c')](handleError(_0x3c8bf6,null));};exports[_0x976b('0x3d')]=function(_0xc290cd,_0x2ffd86){var _0x15a6dd={'raw':!![],'where':{'id':_0xc290cd['params']['id']}},_0x54725e={};_0x54725e[_0x976b('0x29')]=_[_0x976b('0x2b')](db['JscriptyQuestionReport'][_0x976b('0x25')]);_0x54725e[_0x976b('0x2a')]=_['keys'](_0xc290cd['query']);_0x54725e[_0x976b('0x2c')]=_[_0x976b('0x2d')](_0x54725e[_0x976b('0x29')],_0x54725e[_0x976b('0x2a')]);_0x15a6dd['attributes']=_[_0x976b('0x2d')](_0x54725e[_0x976b('0x29')],qs[_0x976b('0x2f')](_0xc290cd['query'][_0x976b('0x2f')]));_0x15a6dd[_0x976b('0x2e')]=_0x15a6dd[_0x976b('0x2e')]['length']?_0x15a6dd['attributes']:_0x54725e[_0x976b('0x29')];if(_0xc290cd['query'][_0x976b('0x39')]){_0x15a6dd[_0x976b('0x3a')]=[{'all':!![]}];}_0x15a6dd=_['merge']({},_0x15a6dd,_0xc290cd[_0x976b('0x37')]);return db[_0x976b('0x24')][_0x976b('0x3e')](_0x15a6dd)[_0x976b('0x1d')](handleEntityNotFound(_0x2ffd86,null))[_0x976b('0x1d')](respondWithResult(_0x2ffd86,null))[_0x976b('0x3c')](handleError(_0x2ffd86,null));};exports['create']=function(_0x25e622,_0x466d69){return db[_0x976b('0x24')][_0x976b('0x3f')](_0x25e622['body'],{})['then'](respondWithResult(_0x466d69,0xc9))['catch'](handleError(_0x466d69,null));};exports[_0x976b('0x1c')]=function(_0x34bbb2,_0x132a76){if(_0x34bbb2[_0x976b('0x40')]['id']){delete _0x34bbb2[_0x976b('0x40')]['id'];}return db['JscriptyQuestionReport'][_0x976b('0x3e')]({'where':{'id':_0x34bbb2['params']['id']}})['then'](handleEntityNotFound(_0x132a76,null))[_0x976b('0x1d')](saveUpdates(_0x34bbb2[_0x976b('0x40')],null))[_0x976b('0x1d')](respondWithResult(_0x132a76,null))['catch'](handleError(_0x132a76,null));};exports['destroy']=function(_0x1e89f2,_0x35a5bc){return db['JscriptyQuestionReport'][_0x976b('0x3e')]({'where':{'id':_0x1e89f2[_0x976b('0x41')]['id']}})[_0x976b('0x1d')](handleEntityNotFound(_0x35a5bc,null))[_0x976b('0x1d')](removeEntity(_0x35a5bc,null))[_0x976b('0x3c')](handleError(_0x35a5bc,null));};exports[_0x976b('0x42')]=function(_0x114889,_0x1f1cd4){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0x1f1cd4,null))['catch'](handleError(_0x1f1cd4,null));}; \ No newline at end of file +var _0x771c=['then','destroy','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','bluebird','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','reject','save','update'];(function(_0x53cb8b,_0x1074de){var _0x5a7658=function(_0xc3b5c9){while(--_0xc3b5c9){_0x53cb8b['push'](_0x53cb8b['shift']());}};_0x5a7658(++_0x1074de);}(_0x771c,0x6b));var _0xc771=function(_0xd93317,_0x4136cd){_0xd93317=_0xd93317-0x0;var _0x1151af=_0x771c[_0xd93317];return _0x1151af;};'use strict';var emlformat=require(_0xc771('0x0'));var rimraf=require(_0xc771('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc771('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc771('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc771('0x4'));var sox=require('sox');var csv=require(_0xc771('0x5'));var ejs=require(_0xc771('0x6'));var fs=require('fs');var fs_extra=require(_0xc771('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc771('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc771('0x9'));var toCsv=require(_0xc771('0x5'));var querystring=require(_0xc771('0xa'));var Papa=require('papaparse');var Redis=require(_0xc771('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc771('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc771('0xd'));var logger=require(_0xc771('0xe'))(_0xc771('0xf'));var utils=require(_0xc771('0x10'));var config=require(_0xc771('0x11'));var licenseUtil=require(_0xc771('0x12'));var db=require(_0xc771('0x13'))['db'];function respondWithStatusCode(_0x3fca2a,_0x596710){_0x596710=_0x596710||0xcc;return function(_0x3589f6){if(_0x3589f6){return _0x3fca2a[_0xc771('0x14')](_0x596710);}return _0x3fca2a[_0xc771('0x15')](_0x596710)[_0xc771('0x16')]();};}function respondWithResult(_0x30525e,_0xae8d7e){_0xae8d7e=_0xae8d7e||0xc8;return function(_0x3a3843){if(_0x3a3843){return _0x30525e['status'](_0xae8d7e)['json'](_0x3a3843);}};}function respondWithFilteredResult(_0x5846c4,_0xa5eaae){return function(_0x3d3dfd){if(_0x3d3dfd){var _0x59cd5e=typeof _0xa5eaae[_0xc771('0x17')]==='undefined'&&typeof _0xa5eaae[_0xc771('0x18')]==='undefined';var _0x897124=_0x3d3dfd['count'];var _0x454003=_0x59cd5e?0x0:_0xa5eaae[_0xc771('0x17')];var _0x4e1f25=_0x59cd5e?_0x3d3dfd[_0xc771('0x19')]:_0xa5eaae[_0xc771('0x17')]+_0xa5eaae[_0xc771('0x18')];var _0x440bea;if(_0x4e1f25>=_0x897124){_0x4e1f25=_0x897124;_0x440bea=0xc8;}else{_0x440bea=0xce;}_0x5846c4[_0xc771('0x15')](_0x440bea);return _0x5846c4[_0xc771('0x1a')]('Content-Range',_0x454003+'-'+_0x4e1f25+'/'+_0x897124)[_0xc771('0x1b')](_0x3d3dfd);}return null;};}function patchUpdates(_0x22b6ad){return function(_0x3ced16){try{jsonpatch['apply'](_0x3ced16,_0x22b6ad,!![]);}catch(_0x3dc280){return BPromise[_0xc771('0x1c')](_0x3dc280);}return _0x3ced16[_0xc771('0x1d')]();};}function saveUpdates(_0x57233a,_0x486943){return function(_0x1d9950){if(_0x1d9950){return _0x1d9950[_0xc771('0x1e')](_0x57233a)[_0xc771('0x1f')](function(_0x497462){return _0x497462;});}return null;};}function removeEntity(_0x3c883e,_0x17314c){return function(_0x85ce9e){if(_0x85ce9e){return _0x85ce9e[_0xc771('0x20')]()['then'](function(){_0x3c883e['status'](0xcc)[_0xc771('0x16')]();});}};}function handleEntityNotFound(_0x31e9d7,_0x543719){return function(_0x1684f9){if(!_0x1684f9){_0x31e9d7[_0xc771('0x14')](0x194);}return _0x1684f9;};}function handleError(_0x518d2e,_0x3dd9fe){_0x3dd9fe=_0x3dd9fe||0x1f4;return function(_0x1ca116){logger['error'](_0x1ca116['stack']);if(_0x1ca116[_0xc771('0x21')]){delete _0x1ca116[_0xc771('0x21')];}_0x518d2e[_0xc771('0x15')](_0x3dd9fe)[_0xc771('0x22')](_0x1ca116);};}exports[_0xc771('0x23')]=function(_0x5e7e59,_0x348f6c){var _0x5d7def={},_0x136489={},_0x3210b6={'count':0x0,'rows':[]};var _0x11c702=_[_0xc771('0x24')](db[_0xc771('0x25')][_0xc771('0x26')],function(_0xb4cb6e){return{'name':_0xb4cb6e[_0xc771('0x27')],'type':_0xb4cb6e[_0xc771('0x28')][_0xc771('0x29')]};});_0x136489[_0xc771('0x2a')]=_[_0xc771('0x24')](_0x11c702,_0xc771('0x21'));_0x136489[_0xc771('0x2b')]=_[_0xc771('0x2c')](_0x5e7e59[_0xc771('0x2b')]);_0x136489[_0xc771('0x2d')]=_[_0xc771('0x2e')](_0x136489[_0xc771('0x2a')],_0x136489[_0xc771('0x2b')]);_0x5d7def[_0xc771('0x2f')]=_[_0xc771('0x2e')](_0x136489[_0xc771('0x2a')],qs[_0xc771('0x30')](_0x5e7e59['query'][_0xc771('0x30')]));_0x5d7def[_0xc771('0x2f')]=_0x5d7def[_0xc771('0x2f')]['length']?_0x5d7def[_0xc771('0x2f')]:_0x136489['model'];if(!_0x5e7e59[_0xc771('0x2b')][_0xc771('0x31')](_0xc771('0x32'))){_0x5d7def['limit']=qs[_0xc771('0x18')](_0x5e7e59[_0xc771('0x2b')][_0xc771('0x18')]);_0x5d7def[_0xc771('0x17')]=qs[_0xc771('0x17')](_0x5e7e59['query'][_0xc771('0x17')]);}_0x5d7def['order']=qs[_0xc771('0x33')](_0x5e7e59[_0xc771('0x2b')][_0xc771('0x33')]);_0x5d7def[_0xc771('0x34')]=qs['filters'](_[_0xc771('0x35')](_0x5e7e59[_0xc771('0x2b')],_0x136489['filters']),_0x11c702);if(_0x5e7e59[_0xc771('0x2b')][_0xc771('0x36')]){_0x5d7def['where']=_[_0xc771('0x37')](_0x5d7def[_0xc771('0x34')],{'$or':_[_0xc771('0x24')](_0x11c702,function(_0x618d4c){if(_0x618d4c['type']!==_0xc771('0x38')){var _0xd91c65={};_0xd91c65[_0x618d4c[_0xc771('0x21')]]={'$like':'%'+_0x5e7e59[_0xc771('0x2b')]['filter']+'%'};return _0xd91c65;}})});}_0x5d7def=_[_0xc771('0x37')]({},_0x5d7def,_0x5e7e59[_0xc771('0x39')]);var _0x8c449e={'where':_0x5d7def[_0xc771('0x34')]};return db[_0xc771('0x25')]['count'](_0x8c449e)['then'](function(_0x21c6fb){_0x3210b6['count']=_0x21c6fb;if(_0x5e7e59[_0xc771('0x2b')][_0xc771('0x3a')]){_0x5d7def[_0xc771('0x3b')]=[{'all':!![]}];}return db[_0xc771('0x25')][_0xc771('0x3c')](_0x5d7def);})[_0xc771('0x1f')](function(_0x41a08a){_0x3210b6[_0xc771('0x3d')]=_0x41a08a;return _0x3210b6;})['then'](respondWithFilteredResult(_0x348f6c,_0x5d7def))['catch'](handleError(_0x348f6c,null));};exports[_0xc771('0x3e')]=function(_0x4e9717,_0x3bdf53){var _0x7aeb47={'raw':!![],'where':{'id':_0x4e9717['params']['id']}},_0x5c9472={};_0x5c9472[_0xc771('0x2a')]=_[_0xc771('0x2c')](db['JscriptyQuestionReport'][_0xc771('0x26')]);_0x5c9472[_0xc771('0x2b')]=_['keys'](_0x4e9717[_0xc771('0x2b')]);_0x5c9472[_0xc771('0x2d')]=_[_0xc771('0x2e')](_0x5c9472[_0xc771('0x2a')],_0x5c9472[_0xc771('0x2b')]);_0x7aeb47['attributes']=_[_0xc771('0x2e')](_0x5c9472[_0xc771('0x2a')],qs[_0xc771('0x30')](_0x4e9717[_0xc771('0x2b')][_0xc771('0x30')]));_0x7aeb47[_0xc771('0x2f')]=_0x7aeb47[_0xc771('0x2f')]['length']?_0x7aeb47['attributes']:_0x5c9472['model'];if(_0x4e9717[_0xc771('0x2b')][_0xc771('0x3a')]){_0x7aeb47['include']=[{'all':!![]}];}_0x7aeb47=_[_0xc771('0x37')]({},_0x7aeb47,_0x4e9717[_0xc771('0x39')]);return db[_0xc771('0x25')][_0xc771('0x3f')](_0x7aeb47)[_0xc771('0x1f')](handleEntityNotFound(_0x3bdf53,null))[_0xc771('0x1f')](respondWithResult(_0x3bdf53,null))[_0xc771('0x40')](handleError(_0x3bdf53,null));};exports[_0xc771('0x41')]=function(_0x2ce54d,_0x7bdd5d){return db[_0xc771('0x25')]['create'](_0x2ce54d['body'],{})[_0xc771('0x1f')](respondWithResult(_0x7bdd5d,0xc9))[_0xc771('0x40')](handleError(_0x7bdd5d,null));};exports[_0xc771('0x1e')]=function(_0x4f8a79,_0x3a02fc){if(_0x4f8a79[_0xc771('0x42')]['id']){delete _0x4f8a79['body']['id'];}return db[_0xc771('0x25')]['find']({'where':{'id':_0x4f8a79['params']['id']}})[_0xc771('0x1f')](handleEntityNotFound(_0x3a02fc,null))[_0xc771('0x1f')](saveUpdates(_0x4f8a79[_0xc771('0x42')],null))[_0xc771('0x1f')](respondWithResult(_0x3a02fc,null))[_0xc771('0x40')](handleError(_0x3a02fc,null));};exports[_0xc771('0x20')]=function(_0xd2f1e4,_0x4fb2ae){return db[_0xc771('0x25')][_0xc771('0x3f')]({'where':{'id':_0xd2f1e4[_0xc771('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fb2ae,null))[_0xc771('0x1f')](removeEntity(_0x4fb2ae,null))['catch'](handleError(_0x4fb2ae,null));};exports[_0xc771('0x44')]=function(_0x237155,_0x2c86c7){return db['JscriptyQuestionReport'][_0xc771('0x44')]()[_0xc771('0x1f')](respondWithResult(_0x2c86c7,null))[_0xc771('0x40')](handleError(_0x2c86c7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 005abc3..bf3f43d 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 _0xe313=['path','rimraf','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b24a2,_0x27d73b){var _0x2d1bca=function(_0x4d714b){while(--_0x4d714b){_0x1b24a2['push'](_0x1b24a2['shift']());}};_0x2d1bca(++_0x27d73b);}(_0xe313,0xe1));var _0x3e31=function(_0x2a1f3e,_0x56f3d6){_0x2a1f3e=_0x2a1f3e-0x0;var _0x57e075=_0xe313[_0x2a1f3e];return _0x57e075;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e31('0x0'))(_0x3e31('0x1'));var moment=require(_0x3e31('0x2'));var BPromise=require(_0x3e31('0x3'));var rp=require(_0x3e31('0x4'));var fs=require('fs');var path=require(_0x3e31('0x5'));var rimraf=require(_0x3e31('0x6'));var config=require('../../config/environment');var attributes=require(_0x3e31('0x7'));module[_0x3e31('0x8')]=function(_0x53e180,_0x86e152){return _0x53e180['define']('JscriptyQuestionReport',attributes,{'tableName':_0x3e31('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb60=['JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xcb60,0x113));var _0x0cb6=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xcb60[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0cb6('0x0'))(_0x0cb6('0x1'));var moment=require(_0x0cb6('0x2'));var BPromise=require(_0x0cb6('0x3'));var rp=require(_0x0cb6('0x4'));var fs=require('fs');var path=require(_0x0cb6('0x5'));var rimraf=require(_0x0cb6('0x6'));var config=require(_0x0cb6('0x7'));var attributes=require(_0x0cb6('0x8'));module[_0x0cb6('0x9')]=function(_0x36d2bd,_0x585d77){return _0x36d2bd[_0x0cb6('0xa')](_0x0cb6('0xb'),attributes,{'tableName':_0x0cb6('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 fecc569..7fba669 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 _0x7040=['stringify','error','code','message','request\x20sent','lodash','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x21c8dd,_0x343149){var _0x198dcc=function(_0x573830){while(--_0x573830){_0x21c8dd['push'](_0x21c8dd['shift']());}};_0x198dcc(++_0x343149);}(_0x7040,0x1b5));var _0x0704=function(_0x554c95,_0xb98056){_0x554c95=_0x554c95-0x0;var _0x34098d=_0x7040[_0x554c95];return _0x34098d;};'use strict';var _=require(_0x0704('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0704('0x1'));var rs=require(_0x0704('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0704('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0704('0x4'));var jayson=require(_0x0704('0x5'));var client=jayson[_0x0704('0x6')][_0x0704('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40e6a5,_0x57ba50,_0x421e35){return new BPromise(function(_0x5758a7,_0x45835a){return client[_0x0704('0x8')](_0x40e6a5,_0x421e35)[_0x0704('0x9')](function(_0x532772){logger[_0x0704('0xa')](_0x0704('0xb'),_0x57ba50,'request\x20sent');logger['debug'](_0x0704('0xc'),_0x57ba50,'request\x20sent',JSON[_0x0704('0xd')](_0x532772));if(_0x532772[_0x0704('0xe')]){if(_0x532772['error'][_0x0704('0xf')]===0x1f4){logger['error'](_0x0704('0xb'),_0x57ba50,_0x532772[_0x0704('0xe')][_0x0704('0x10')]);return _0x45835a(_0x532772[_0x0704('0xe')][_0x0704('0x10')]);}logger[_0x0704('0xe')](_0x0704('0xb'),_0x57ba50,_0x532772['error']['message']);return _0x5758a7(_0x532772[_0x0704('0xe')][_0x0704('0x10')]);}else{logger[_0x0704('0xa')](_0x0704('0xb'),_0x57ba50,_0x0704('0x11'));_0x5758a7(_0x532772['result']['message']);}})['catch'](function(_0x29e451){logger['error'](_0x0704('0xb'),_0x57ba50,_0x29e451);_0x45835a(_0x29e451);});});} \ No newline at end of file +var _0x38b1=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3ddf7f,_0x4fda35){var _0x36189f=function(_0x2e13bd){while(--_0x2e13bd){_0x3ddf7f['push'](_0x3ddf7f['shift']());}};_0x36189f(++_0x4fda35);}(_0x38b1,0x1d9));var _0x138b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x38b1[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x138b('0x0'));var util=require(_0x138b('0x1'));var moment=require(_0x138b('0x2'));var BPromise=require(_0x138b('0x3'));var rs=require(_0x138b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x138b('0x5'))['db'];var utils=require(_0x138b('0x6'));var logger=require('../../config/logger')(_0x138b('0x7'));var config=require(_0x138b('0x8'));var jayson=require(_0x138b('0x9'));var client=jayson[_0x138b('0xa')][_0x138b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58e3a7,_0x4a83ac,_0x4e6036){return new BPromise(function(_0x584696,_0x4089b3){return client[_0x138b('0xc')](_0x58e3a7,_0x4e6036)[_0x138b('0xd')](function(_0xdf9efa){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4a83ac,_0x138b('0xe'));logger[_0x138b('0xf')](_0x138b('0x10'),_0x4a83ac,'request\x20sent',JSON[_0x138b('0x11')](_0xdf9efa));if(_0xdf9efa[_0x138b('0x12')]){if(_0xdf9efa[_0x138b('0x12')][_0x138b('0x13')]===0x1f4){logger[_0x138b('0x12')](_0x138b('0x14'),_0x4a83ac,_0xdf9efa[_0x138b('0x12')][_0x138b('0x15')]);return _0x4089b3(_0xdf9efa['error'][_0x138b('0x15')]);}logger[_0x138b('0x12')](_0x138b('0x14'),_0x4a83ac,_0xdf9efa['error']['message']);return _0x584696(_0xdf9efa[_0x138b('0x12')][_0x138b('0x15')]);}else{logger[_0x138b('0x16')](_0x138b('0x14'),_0x4a83ac,_0x138b('0xe'));_0x584696(_0xdf9efa[_0x138b('0x17')][_0x138b('0x15')]);}})['catch'](function(_0x199746){logger[_0x138b('0x12')](_0x138b('0x14'),_0x4a83ac,_0x199746);_0x4089b3(_0x199746);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e012d64..2205d98 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 _0x582c=['get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','create','put','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x4f1c6d,_0x584dab){var _0xa4271=function(_0x225b76){while(--_0x225b76){_0x4f1c6d['push'](_0x4f1c6d['shift']());}};_0xa4271(++_0x584dab);}(_0x582c,0x19a));var _0xc582=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0x582c[_0x1b8d87];return _0x182b74;};'use strict';var multer=require(_0xc582('0x0'));var util=require('util');var path=require(_0xc582('0x1'));var timeout=require(_0xc582('0x2'));var express=require(_0xc582('0x3'));var router=express[_0xc582('0x4')]();var fs_extra=require(_0xc582('0x5'));var auth=require(_0xc582('0x6'));var interaction=require(_0xc582('0x7'));var config=require(_0xc582('0x8'));var controller=require(_0xc582('0x9'));router[_0xc582('0xa')]('/',auth[_0xc582('0xb')](),controller['index']);router['get'](_0xc582('0xc'),auth[_0xc582('0xb')](),controller[_0xc582('0xd')]);router[_0xc582('0xa')](_0xc582('0xe'),auth['isAuthenticated'](),controller[_0xc582('0xf')]);router[_0xc582('0xa')](_0xc582('0x10'),auth[_0xc582('0xb')](),controller[_0xc582('0x11')]);router['post']('/',auth[_0xc582('0xb')](),controller[_0xc582('0x12')]);router[_0xc582('0x13')](_0xc582('0xe'),auth[_0xc582('0xb')](),controller['update']);router['delete']('/:id',auth[_0xc582('0xb')](),controller[_0xc582('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2139=['describe','/:id','show','getQuestions','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x2139,0xf9));var _0x9213=function(_0x4b2b03,_0x31f748){_0x4b2b03=_0x4b2b03-0x0;var _0x64651c=_0x2139[_0x4b2b03];return _0x64651c;};'use strict';var multer=require(_0x9213('0x0'));var util=require('util');var path=require(_0x9213('0x1'));var timeout=require(_0x9213('0x2'));var express=require(_0x9213('0x3'));var router=express['Router']();var fs_extra=require(_0x9213('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9213('0x5'));var controller=require(_0x9213('0x6'));router[_0x9213('0x7')]('/',auth[_0x9213('0x8')](),controller[_0x9213('0x9')]);router['get'](_0x9213('0xa'),auth['isAuthenticated'](),controller[_0x9213('0xb')]);router['get'](_0x9213('0xc'),auth['isAuthenticated'](),controller[_0x9213('0xd')]);router[_0x9213('0x7')]('/:id/questions',auth[_0x9213('0x8')](),controller[_0x9213('0xe')]);router['post']('/',auth[_0x9213('0x8')](),controller[_0x9213('0xf')]);router[_0x9213('0x10')](_0x9213('0xc'),auth[_0x9213('0x8')](),controller['update']);router[_0x9213('0x11')](_0x9213('0xc'),auth['isAuthenticated'](),controller[_0x9213('0x12')]);module[_0x9213('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index be71c4b..c273a1b 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 _0x261a=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue'];(function(_0x155e0c,_0x108c1a){var _0x4904ad=function(_0x9e67c3){while(--_0x9e67c3){_0x155e0c['push'](_0x155e0c['shift']());}};_0x4904ad(++_0x108c1a);}(_0x261a,0x1e6));var _0xa261=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x261a[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xa261('0x0'));var Sequelize=require(_0xa261('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xa261('0x2')],'set':function(_0x21143a){this[_0xa261('0x3')](_0xa261('0x4'),_0x21143a);this[_0xa261('0x3')](_0xa261('0x5'),moment()[_0xa261('0x6')](_0xa261('0x7')));}},'endtime':{'type':Sequelize[_0xa261('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xa261('0x8')]},'queue':{'type':Sequelize[_0xa261('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa261('0x8')]},'calleridnum':{'type':Sequelize[_0xa261('0x8')]},'completed':{'type':Sequelize[_0xa261('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x4727=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x4727,0x70));var _0x7472=function(_0xe5df7d,_0x33adbd){_0xe5df7d=_0xe5df7d-0x0;var _0x1313a5=_0x4727[_0xe5df7d];return _0x1313a5;};'use strict';var moment=require(_0x7472('0x0'));var Sequelize=require(_0x7472('0x1'));module[_0x7472('0x2')]={'starttime':{'type':Sequelize[_0x7472('0x3')],'set':function(_0x17dff2){this[_0x7472('0x4')](_0x7472('0x5'),_0x17dff2);this[_0x7472('0x4')]('endtime',moment()[_0x7472('0x6')](_0x7472('0x7')));}},'endtime':{'type':Sequelize[_0x7472('0x3')]},'membername':{'type':Sequelize[_0x7472('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7472('0x8')]},'uniqueid':{'type':Sequelize[_0x7472('0x8')]},'calleridname':{'type':Sequelize[_0x7472('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x7472('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 72d7138..ec54fd9 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 _0xee20=['body','catch','describe','JscriptyQuestionReport','nolimit','SessionId','findAll','rows','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','set','Content-Range','apply','reject','update','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','params','find','create'];(function(_0x10fe3f,_0x21d453){var _0x3789ca=function(_0x347136){while(--_0x347136){_0x10fe3f['push'](_0x10fe3f['shift']());}};_0x3789ca(++_0x21d453);}(_0xee20,0xe9));var _0x0ee2=function(_0x37ea7b,_0x6a99be){_0x37ea7b=_0x37ea7b-0x0;var _0x484bd9=_0xee20[_0x37ea7b];return _0x484bd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ee2('0x0'));var zipdir=require(_0x0ee2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ee2('0x2'));var moment=require(_0x0ee2('0x3'));var BPromise=require(_0x0ee2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0ee2('0x5'));var sox=require('sox');var csv=require(_0x0ee2('0x6'));var ejs=require(_0x0ee2('0x7'));var fs=require('fs');var fs_extra=require(_0x0ee2('0x8'));var _=require(_0x0ee2('0x9'));var squel=require(_0x0ee2('0xa'));var crypto=require('crypto');var jsforce=require(_0x0ee2('0xb'));var deskjs=require(_0x0ee2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ee2('0xd'));var Redis=require(_0x0ee2('0xe'));var authService=require(_0x0ee2('0xf'));var qs=require(_0x0ee2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ee2('0x11'));var logger=require(_0x0ee2('0x12'))('api');var utils=require(_0x0ee2('0x13'));var config=require(_0x0ee2('0x14'));var licenseUtil=require(_0x0ee2('0x15'));var db=require(_0x0ee2('0x16'))['db'];function respondWithStatusCode(_0x41ce96,_0x2c319a){_0x2c319a=_0x2c319a||0xcc;return function(_0x309eff){if(_0x309eff){return _0x41ce96[_0x0ee2('0x17')](_0x2c319a);}return _0x41ce96['status'](_0x2c319a)[_0x0ee2('0x18')]();};}function respondWithResult(_0x519be4,_0x30c121){_0x30c121=_0x30c121||0xc8;return function(_0x3a5de3){if(_0x3a5de3){return _0x519be4[_0x0ee2('0x19')](_0x30c121)[_0x0ee2('0x1a')](_0x3a5de3);}};}function respondWithFilteredResult(_0x3ed112,_0x3f040e){return function(_0xafa714){if(_0xafa714){var _0x4f3d01=typeof _0x3f040e[_0x0ee2('0x1b')]===_0x0ee2('0x1c')&&typeof _0x3f040e[_0x0ee2('0x1d')]==='undefined';var _0x4454e4=_0xafa714[_0x0ee2('0x1e')];var _0x2b72a3=_0x4f3d01?0x0:_0x3f040e[_0x0ee2('0x1b')];var _0x73e70a=_0x4f3d01?_0xafa714[_0x0ee2('0x1e')]:_0x3f040e[_0x0ee2('0x1b')]+_0x3f040e[_0x0ee2('0x1d')];var _0x1864d2;if(_0x73e70a>=_0x4454e4){_0x73e70a=_0x4454e4;_0x1864d2=0xc8;}else{_0x1864d2=0xce;}_0x3ed112[_0x0ee2('0x19')](_0x1864d2);return _0x3ed112[_0x0ee2('0x1f')](_0x0ee2('0x20'),_0x2b72a3+'-'+_0x73e70a+'/'+_0x4454e4)[_0x0ee2('0x1a')](_0xafa714);}return null;};}function patchUpdates(_0x1991e3){return function(_0x100a3b){try{jsonpatch[_0x0ee2('0x21')](_0x100a3b,_0x1991e3,!![]);}catch(_0x29c891){return BPromise[_0x0ee2('0x22')](_0x29c891);}return _0x100a3b['save']();};}function saveUpdates(_0x1eff50,_0x2275c4){return function(_0x312e5b){if(_0x312e5b){return _0x312e5b[_0x0ee2('0x23')](_0x1eff50)['then'](function(_0x19f3e1){return _0x19f3e1;});}return null;};}function removeEntity(_0xd2933f,_0x1056a3){return function(_0x3aad42){if(_0x3aad42){return _0x3aad42['destroy']()[_0x0ee2('0x24')](function(){_0xd2933f['status'](0xcc)[_0x0ee2('0x18')]();});}};}function handleEntityNotFound(_0x1c532e,_0x2768e5){return function(_0x9c357){if(!_0x9c357){_0x1c532e[_0x0ee2('0x17')](0x194);}return _0x9c357;};}function handleError(_0x64e48b,_0x3adb1a){_0x3adb1a=_0x3adb1a||0x1f4;return function(_0x4a639d){logger[_0x0ee2('0x25')](_0x4a639d[_0x0ee2('0x26')]);if(_0x4a639d[_0x0ee2('0x27')]){delete _0x4a639d[_0x0ee2('0x27')];}_0x64e48b[_0x0ee2('0x19')](_0x3adb1a)['send'](_0x4a639d);};}exports[_0x0ee2('0x28')]=function(_0x355c02,_0x2d2bcf){var _0xc15399={},_0x456a26={},_0x417f93={'count':0x0,'rows':[]};var _0x25407a=_['map'](db['JscriptySessionReport'][_0x0ee2('0x29')],function(_0x441822){return{'name':_0x441822[_0x0ee2('0x2a')],'type':_0x441822[_0x0ee2('0x2b')]['key']};});_0x456a26[_0x0ee2('0x2c')]=_[_0x0ee2('0x2d')](_0x25407a,_0x0ee2('0x27'));_0x456a26[_0x0ee2('0x2e')]=_[_0x0ee2('0x2f')](_0x355c02[_0x0ee2('0x2e')]);_0x456a26[_0x0ee2('0x30')]=_['intersection'](_0x456a26[_0x0ee2('0x2c')],_0x456a26[_0x0ee2('0x2e')]);_0xc15399['attributes']=_[_0x0ee2('0x31')](_0x456a26[_0x0ee2('0x2c')],qs[_0x0ee2('0x32')](_0x355c02[_0x0ee2('0x2e')][_0x0ee2('0x32')]));_0xc15399[_0x0ee2('0x33')]=_0xc15399[_0x0ee2('0x33')][_0x0ee2('0x34')]?_0xc15399[_0x0ee2('0x33')]:_0x456a26[_0x0ee2('0x2c')];if(!_0x355c02[_0x0ee2('0x2e')][_0x0ee2('0x35')]('nolimit')){_0xc15399[_0x0ee2('0x1d')]=qs['limit'](_0x355c02['query'][_0x0ee2('0x1d')]);_0xc15399[_0x0ee2('0x1b')]=qs[_0x0ee2('0x1b')](_0x355c02[_0x0ee2('0x2e')][_0x0ee2('0x1b')]);}_0xc15399[_0x0ee2('0x36')]=qs[_0x0ee2('0x37')](_0x355c02['query'][_0x0ee2('0x37')]);_0xc15399[_0x0ee2('0x38')]=qs[_0x0ee2('0x30')](_['pick'](_0x355c02['query'],_0x456a26[_0x0ee2('0x30')]),_0x25407a);if(_0x355c02[_0x0ee2('0x2e')][_0x0ee2('0x39')]){_0xc15399[_0x0ee2('0x38')]=_[_0x0ee2('0x3a')](_0xc15399[_0x0ee2('0x38')],{'$or':_['map'](_0x25407a,function(_0xc78eac){if(_0xc78eac[_0x0ee2('0x2b')]!==_0x0ee2('0x3b')){var _0x4a19bf={};_0x4a19bf[_0xc78eac['name']]={'$like':'%'+_0x355c02[_0x0ee2('0x2e')][_0x0ee2('0x39')]+'%'};return _0x4a19bf;}})});}_0xc15399=_['merge']({},_0xc15399,_0x355c02[_0x0ee2('0x3c')]);var _0x5d5391={'where':_0xc15399[_0x0ee2('0x38')]};return db[_0x0ee2('0x3d')][_0x0ee2('0x1e')](_0x5d5391)[_0x0ee2('0x24')](function(_0x546f47){_0x417f93[_0x0ee2('0x1e')]=_0x546f47;if(_0x355c02[_0x0ee2('0x2e')][_0x0ee2('0x3e')]){_0xc15399[_0x0ee2('0x3f')]=[{'all':!![]}];}return db[_0x0ee2('0x3d')]['findAll'](_0xc15399);})[_0x0ee2('0x24')](function(_0x39d526){_0x417f93['rows']=_0x39d526;return _0x417f93;})['then'](respondWithFilteredResult(_0x2d2bcf,_0xc15399))['catch'](handleError(_0x2d2bcf,null));};exports['show']=function(_0x5ee416,_0x165ee4){var _0x49bf54={'raw':!![],'where':{'id':_0x5ee416[_0x0ee2('0x40')]['id']}},_0x3450c8={};_0x3450c8[_0x0ee2('0x2c')]=_[_0x0ee2('0x2f')](db[_0x0ee2('0x3d')]['rawAttributes']);_0x3450c8[_0x0ee2('0x2e')]=_[_0x0ee2('0x2f')](_0x5ee416[_0x0ee2('0x2e')]);_0x3450c8[_0x0ee2('0x30')]=_['intersection'](_0x3450c8['model'],_0x3450c8[_0x0ee2('0x2e')]);_0x49bf54[_0x0ee2('0x33')]=_['intersection'](_0x3450c8[_0x0ee2('0x2c')],qs[_0x0ee2('0x32')](_0x5ee416[_0x0ee2('0x2e')][_0x0ee2('0x32')]));_0x49bf54['attributes']=_0x49bf54['attributes'][_0x0ee2('0x34')]?_0x49bf54[_0x0ee2('0x33')]:_0x3450c8[_0x0ee2('0x2c')];if(_0x5ee416['query']['includeAll']){_0x49bf54['include']=[{'all':!![]}];}_0x49bf54=_[_0x0ee2('0x3a')]({},_0x49bf54,_0x5ee416[_0x0ee2('0x3c')]);return db[_0x0ee2('0x3d')][_0x0ee2('0x41')](_0x49bf54)[_0x0ee2('0x24')](handleEntityNotFound(_0x165ee4,null))[_0x0ee2('0x24')](respondWithResult(_0x165ee4,null))['catch'](handleError(_0x165ee4,null));};exports[_0x0ee2('0x42')]=function(_0x20fc9a,_0x118a6f){return db[_0x0ee2('0x3d')]['create'](_0x20fc9a[_0x0ee2('0x43')],{})[_0x0ee2('0x24')](respondWithResult(_0x118a6f,0xc9))[_0x0ee2('0x44')](handleError(_0x118a6f,null));};exports[_0x0ee2('0x23')]=function(_0x5b1fb3,_0x563c1e){if(_0x5b1fb3[_0x0ee2('0x43')]['id']){delete _0x5b1fb3['body']['id'];}return db[_0x0ee2('0x3d')][_0x0ee2('0x41')]({'where':{'id':_0x5b1fb3[_0x0ee2('0x40')]['id']}})[_0x0ee2('0x24')](handleEntityNotFound(_0x563c1e,null))['then'](saveUpdates(_0x5b1fb3[_0x0ee2('0x43')],null))[_0x0ee2('0x24')](respondWithResult(_0x563c1e,null))[_0x0ee2('0x44')](handleError(_0x563c1e,null));};exports['destroy']=function(_0x54ab3e,_0x5ce5c1){return db[_0x0ee2('0x3d')][_0x0ee2('0x41')]({'where':{'id':_0x54ab3e[_0x0ee2('0x40')]['id']}})[_0x0ee2('0x24')](handleEntityNotFound(_0x5ce5c1,null))[_0x0ee2('0x24')](removeEntity(_0x5ce5c1,null))[_0x0ee2('0x44')](handleError(_0x5ce5c1,null));};exports[_0x0ee2('0x45')]=function(_0xbf48ab,_0x3ec0f7){return db[_0x0ee2('0x3d')][_0x0ee2('0x45')]()['then'](respondWithResult(_0x3ec0f7,null))[_0x0ee2('0x44')](handleError(_0x3ec0f7,null));};exports['getQuestions']=function(_0x2c7614,_0x1f5255,_0x46e0bb){var _0x172abd={'raw':!![],'where':{}};var _0x4f2a04={};var _0x4414ca={'count':0x0,'rows':[]};return db[_0x0ee2('0x3d')]['findOne']({'where':{'id':_0x2c7614['params']['id']}})[_0x0ee2('0x24')](handleEntityNotFound(_0x1f5255,null))[_0x0ee2('0x24')](function(_0x28110a){if(_0x28110a){_0x4f2a04[_0x0ee2('0x2c')]=_[_0x0ee2('0x2f')](db[_0x0ee2('0x46')][_0x0ee2('0x29')]);_0x4f2a04['query']=_[_0x0ee2('0x2f')](_0x2c7614[_0x0ee2('0x2e')]);_0x4f2a04[_0x0ee2('0x30')]=_[_0x0ee2('0x31')](_0x4f2a04[_0x0ee2('0x2c')],_0x4f2a04[_0x0ee2('0x2e')]);_0x172abd[_0x0ee2('0x33')]=_['intersection'](_0x4f2a04[_0x0ee2('0x2c')],qs[_0x0ee2('0x32')](_0x2c7614[_0x0ee2('0x2e')]['fields']));_0x172abd[_0x0ee2('0x33')]=_0x172abd[_0x0ee2('0x33')][_0x0ee2('0x34')]?_0x172abd[_0x0ee2('0x33')]:_0x4f2a04['model'];if(!_0x2c7614['query'][_0x0ee2('0x35')](_0x0ee2('0x47'))){_0x172abd[_0x0ee2('0x1d')]=qs[_0x0ee2('0x1d')](_0x2c7614[_0x0ee2('0x2e')][_0x0ee2('0x1d')]);_0x172abd['offset']=qs['offset'](_0x2c7614[_0x0ee2('0x2e')][_0x0ee2('0x1b')]);}_0x172abd['order']=qs[_0x0ee2('0x37')](_0x2c7614[_0x0ee2('0x2e')][_0x0ee2('0x37')]);_0x172abd[_0x0ee2('0x38')]=qs[_0x0ee2('0x30')](_['pick'](_0x2c7614['query'],_0x4f2a04[_0x0ee2('0x30')]));_0x172abd[_0x0ee2('0x38')][_0x0ee2('0x48')]=_0x28110a['id'];if(_0x2c7614[_0x0ee2('0x2e')][_0x0ee2('0x39')]){_0x172abd[_0x0ee2('0x38')]=_[_0x0ee2('0x3a')](_0x172abd[_0x0ee2('0x38')],{'$or':_[_0x0ee2('0x2d')](_0x172abd[_0x0ee2('0x33')],function(_0x14c1d3){var _0x14188b={};_0x14188b[_0x14c1d3]={'$like':'%'+_0x2c7614['query'][_0x0ee2('0x39')]+'%'};return _0x14188b;})});}_0x172abd=_[_0x0ee2('0x3a')]({},_0x172abd,_0x2c7614[_0x0ee2('0x3c')]);return db['JscriptyQuestionReport'][_0x0ee2('0x1e')]({'where':_0x172abd['where']})[_0x0ee2('0x24')](function(_0x3c8240){_0x4414ca[_0x0ee2('0x1e')]=_0x3c8240;if(_0x2c7614['query'][_0x0ee2('0x3e')]){_0x172abd[_0x0ee2('0x3f')]=[{'all':!![]}];}return db[_0x0ee2('0x46')][_0x0ee2('0x49')](_0x172abd);})[_0x0ee2('0x24')](function(_0x2d580){_0x4414ca[_0x0ee2('0x4a')]=_0x2d580;return _0x4414ca;});}})[_0x0ee2('0x24')](respondWithFilteredResult(_0x1f5255,_0x172abd))[_0x0ee2('0x44')](handleError(_0x1f5255,null));}; \ No newline at end of file +var _0xe0a2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','error','stack','name','send','map','JscriptySessionReport','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','catch','show','params','rawAttributes','include','find','create','body','update','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','findAll','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1f9bc0,_0x1edaaf){var _0x40de7a=function(_0xa6ad68){while(--_0xa6ad68){_0x1f9bc0['push'](_0x1f9bc0['shift']());}};_0x40de7a(++_0x1edaaf);}(_0xe0a2,0x17f));var _0x2e0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0a2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2e0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e0a('0x1'));var jsonpatch=require(_0x2e0a('0x2'));var rp=require(_0x2e0a('0x3'));var moment=require(_0x2e0a('0x4'));var BPromise=require(_0x2e0a('0x5'));var Mustache=require('mustache');var util=require(_0x2e0a('0x6'));var path=require('path');var sox=require(_0x2e0a('0x7'));var csv=require('to-csv');var ejs=require(_0x2e0a('0x8'));var fs=require('fs');var fs_extra=require(_0x2e0a('0x9'));var _=require(_0x2e0a('0xa'));var squel=require(_0x2e0a('0xb'));var crypto=require(_0x2e0a('0xc'));var jsforce=require(_0x2e0a('0xd'));var deskjs=require(_0x2e0a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2e0a('0xf'));var Papa=require(_0x2e0a('0x10'));var Redis=require(_0x2e0a('0x11'));var authService=require(_0x2e0a('0x12'));var qs=require(_0x2e0a('0x13'));var as=require(_0x2e0a('0x14'));var hardwareService=require(_0x2e0a('0x15'));var logger=require(_0x2e0a('0x16'))(_0x2e0a('0x17'));var utils=require(_0x2e0a('0x18'));var config=require(_0x2e0a('0x19'));var licenseUtil=require(_0x2e0a('0x1a'));var db=require(_0x2e0a('0x1b'))['db'];function respondWithStatusCode(_0x54feb2,_0xc7d6a6){_0xc7d6a6=_0xc7d6a6||0xcc;return function(_0x2f7fb7){if(_0x2f7fb7){return _0x54feb2[_0x2e0a('0x1c')](_0xc7d6a6);}return _0x54feb2[_0x2e0a('0x1d')](_0xc7d6a6)[_0x2e0a('0x1e')]();};}function respondWithResult(_0x218a07,_0x4378c6){_0x4378c6=_0x4378c6||0xc8;return function(_0x483d49){if(_0x483d49){return _0x218a07[_0x2e0a('0x1d')](_0x4378c6)['json'](_0x483d49);}};}function respondWithFilteredResult(_0x12c745,_0x3d70c2){return function(_0x33586f){if(_0x33586f){var _0x455ba5=typeof _0x3d70c2[_0x2e0a('0x1f')]===_0x2e0a('0x20')&&typeof _0x3d70c2[_0x2e0a('0x21')]===_0x2e0a('0x20');var _0x2c2969=_0x33586f['count'];var _0x4cfea7=_0x455ba5?0x0:_0x3d70c2[_0x2e0a('0x1f')];var _0x1a02a4=_0x455ba5?_0x33586f[_0x2e0a('0x22')]:_0x3d70c2[_0x2e0a('0x1f')]+_0x3d70c2[_0x2e0a('0x21')];var _0x2013f2;if(_0x1a02a4>=_0x2c2969){_0x1a02a4=_0x2c2969;_0x2013f2=0xc8;}else{_0x2013f2=0xce;}_0x12c745[_0x2e0a('0x1d')](_0x2013f2);return _0x12c745[_0x2e0a('0x23')]('Content-Range',_0x4cfea7+'-'+_0x1a02a4+'/'+_0x2c2969)[_0x2e0a('0x24')](_0x33586f);}return null;};}function patchUpdates(_0x8de678){return function(_0x5862b9){try{jsonpatch[_0x2e0a('0x25')](_0x5862b9,_0x8de678,!![]);}catch(_0x28a9fc){return BPromise[_0x2e0a('0x26')](_0x28a9fc);}return _0x5862b9['save']();};}function saveUpdates(_0x2e8041,_0x3012f4){return function(_0x49c1d3){if(_0x49c1d3){return _0x49c1d3['update'](_0x2e8041)[_0x2e0a('0x27')](function(_0x1bdd52){return _0x1bdd52;});}return null;};}function removeEntity(_0x275a1a,_0x21fea1){return function(_0x24e5c5){if(_0x24e5c5){return _0x24e5c5[_0x2e0a('0x28')]()[_0x2e0a('0x27')](function(){_0x275a1a[_0x2e0a('0x1d')](0xcc)[_0x2e0a('0x1e')]();});}};}function handleEntityNotFound(_0x5e891b,_0x5988d9){return function(_0x3f32ba){if(!_0x3f32ba){_0x5e891b[_0x2e0a('0x1c')](0x194);}return _0x3f32ba;};}function handleError(_0x4f4751,_0x3d60c6){_0x3d60c6=_0x3d60c6||0x1f4;return function(_0x1e176b){logger[_0x2e0a('0x29')](_0x1e176b[_0x2e0a('0x2a')]);if(_0x1e176b[_0x2e0a('0x2b')]){delete _0x1e176b[_0x2e0a('0x2b')];}_0x4f4751['status'](_0x3d60c6)[_0x2e0a('0x2c')](_0x1e176b);};}exports['index']=function(_0x2430a0,_0x1e9389){var _0x4a6aac={},_0xdf4bb2={},_0x36439d={'count':0x0,'rows':[]};var _0x5c2fd4=_[_0x2e0a('0x2d')](db[_0x2e0a('0x2e')]['rawAttributes'],function(_0x2f8359){return{'name':_0x2f8359['fieldName'],'type':_0x2f8359['type']['key']};});_0xdf4bb2[_0x2e0a('0x2f')]=_[_0x2e0a('0x2d')](_0x5c2fd4,_0x2e0a('0x2b'));_0xdf4bb2['query']=_[_0x2e0a('0x30')](_0x2430a0['query']);_0xdf4bb2[_0x2e0a('0x31')]=_[_0x2e0a('0x32')](_0xdf4bb2[_0x2e0a('0x2f')],_0xdf4bb2['query']);_0x4a6aac['attributes']=_[_0x2e0a('0x32')](_0xdf4bb2[_0x2e0a('0x2f')],qs['fields'](_0x2430a0[_0x2e0a('0x33')][_0x2e0a('0x34')]));_0x4a6aac[_0x2e0a('0x35')]=_0x4a6aac[_0x2e0a('0x35')][_0x2e0a('0x36')]?_0x4a6aac[_0x2e0a('0x35')]:_0xdf4bb2[_0x2e0a('0x2f')];if(!_0x2430a0[_0x2e0a('0x33')]['hasOwnProperty'](_0x2e0a('0x37'))){_0x4a6aac['limit']=qs[_0x2e0a('0x21')](_0x2430a0[_0x2e0a('0x33')][_0x2e0a('0x21')]);_0x4a6aac[_0x2e0a('0x1f')]=qs[_0x2e0a('0x1f')](_0x2430a0[_0x2e0a('0x33')]['offset']);}_0x4a6aac[_0x2e0a('0x38')]=qs[_0x2e0a('0x39')](_0x2430a0[_0x2e0a('0x33')][_0x2e0a('0x39')]);_0x4a6aac[_0x2e0a('0x3a')]=qs[_0x2e0a('0x31')](_[_0x2e0a('0x3b')](_0x2430a0[_0x2e0a('0x33')],_0xdf4bb2[_0x2e0a('0x31')]),_0x5c2fd4);if(_0x2430a0['query']['filter']){_0x4a6aac[_0x2e0a('0x3a')]=_[_0x2e0a('0x3c')](_0x4a6aac['where'],{'$or':_[_0x2e0a('0x2d')](_0x5c2fd4,function(_0x57eed7){if(_0x57eed7['type']!=='VIRTUAL'){var _0x59db73={};_0x59db73[_0x57eed7['name']]={'$like':'%'+_0x2430a0[_0x2e0a('0x33')][_0x2e0a('0x3d')]+'%'};return _0x59db73;}})});}_0x4a6aac=_[_0x2e0a('0x3c')]({},_0x4a6aac,_0x2430a0[_0x2e0a('0x3e')]);var _0x4bd2bd={'where':_0x4a6aac['where']};return db[_0x2e0a('0x2e')][_0x2e0a('0x22')](_0x4bd2bd)['then'](function(_0x316f67){_0x36439d[_0x2e0a('0x22')]=_0x316f67;if(_0x2430a0['query'][_0x2e0a('0x3f')]){_0x4a6aac['include']=[{'all':!![]}];}return db[_0x2e0a('0x2e')]['findAll'](_0x4a6aac);})['then'](function(_0x2f6f58){_0x36439d['rows']=_0x2f6f58;return _0x36439d;})[_0x2e0a('0x27')](respondWithFilteredResult(_0x1e9389,_0x4a6aac))[_0x2e0a('0x40')](handleError(_0x1e9389,null));};exports[_0x2e0a('0x41')]=function(_0x19fb8d,_0x12c3cf){var _0x33fa8a={'raw':!![],'where':{'id':_0x19fb8d[_0x2e0a('0x42')]['id']}},_0x1f4ab8={};_0x1f4ab8[_0x2e0a('0x2f')]=_[_0x2e0a('0x30')](db[_0x2e0a('0x2e')][_0x2e0a('0x43')]);_0x1f4ab8[_0x2e0a('0x33')]=_[_0x2e0a('0x30')](_0x19fb8d[_0x2e0a('0x33')]);_0x1f4ab8[_0x2e0a('0x31')]=_['intersection'](_0x1f4ab8[_0x2e0a('0x2f')],_0x1f4ab8['query']);_0x33fa8a[_0x2e0a('0x35')]=_[_0x2e0a('0x32')](_0x1f4ab8[_0x2e0a('0x2f')],qs[_0x2e0a('0x34')](_0x19fb8d[_0x2e0a('0x33')][_0x2e0a('0x34')]));_0x33fa8a[_0x2e0a('0x35')]=_0x33fa8a[_0x2e0a('0x35')][_0x2e0a('0x36')]?_0x33fa8a[_0x2e0a('0x35')]:_0x1f4ab8['model'];if(_0x19fb8d[_0x2e0a('0x33')][_0x2e0a('0x3f')]){_0x33fa8a[_0x2e0a('0x44')]=[{'all':!![]}];}_0x33fa8a=_['merge']({},_0x33fa8a,_0x19fb8d[_0x2e0a('0x3e')]);return db['JscriptySessionReport'][_0x2e0a('0x45')](_0x33fa8a)[_0x2e0a('0x27')](handleEntityNotFound(_0x12c3cf,null))[_0x2e0a('0x27')](respondWithResult(_0x12c3cf,null))[_0x2e0a('0x40')](handleError(_0x12c3cf,null));};exports[_0x2e0a('0x46')]=function(_0x4b70bc,_0x4719b4){return db[_0x2e0a('0x2e')][_0x2e0a('0x46')](_0x4b70bc[_0x2e0a('0x47')],{})[_0x2e0a('0x27')](respondWithResult(_0x4719b4,0xc9))[_0x2e0a('0x40')](handleError(_0x4719b4,null));};exports[_0x2e0a('0x48')]=function(_0x381863,_0x12406b){if(_0x381863[_0x2e0a('0x47')]['id']){delete _0x381863[_0x2e0a('0x47')]['id'];}return db['JscriptySessionReport'][_0x2e0a('0x45')]({'where':{'id':_0x381863['params']['id']}})['then'](handleEntityNotFound(_0x12406b,null))[_0x2e0a('0x27')](saveUpdates(_0x381863[_0x2e0a('0x47')],null))[_0x2e0a('0x27')](respondWithResult(_0x12406b,null))[_0x2e0a('0x40')](handleError(_0x12406b,null));};exports[_0x2e0a('0x28')]=function(_0x18cc79,_0x54d3ed){return db[_0x2e0a('0x2e')][_0x2e0a('0x45')]({'where':{'id':_0x18cc79[_0x2e0a('0x42')]['id']}})[_0x2e0a('0x27')](handleEntityNotFound(_0x54d3ed,null))[_0x2e0a('0x27')](removeEntity(_0x54d3ed,null))['catch'](handleError(_0x54d3ed,null));};exports['describe']=function(_0x35fd69,_0x3e25c){return db[_0x2e0a('0x2e')]['describe']()[_0x2e0a('0x27')](respondWithResult(_0x3e25c,null))[_0x2e0a('0x40')](handleError(_0x3e25c,null));};exports[_0x2e0a('0x49')]=function(_0x13830b,_0x17fc94,_0x2ee43b){var _0x54726a={'raw':!![],'where':{}};var _0x12df7f={};var _0x4e42f6={'count':0x0,'rows':[]};return db[_0x2e0a('0x2e')][_0x2e0a('0x4a')]({'where':{'id':_0x13830b[_0x2e0a('0x42')]['id']}})[_0x2e0a('0x27')](handleEntityNotFound(_0x17fc94,null))[_0x2e0a('0x27')](function(_0x4b7a89){if(_0x4b7a89){_0x12df7f[_0x2e0a('0x2f')]=_['keys'](db[_0x2e0a('0x4b')]['rawAttributes']);_0x12df7f[_0x2e0a('0x33')]=_[_0x2e0a('0x30')](_0x13830b[_0x2e0a('0x33')]);_0x12df7f['filters']=_[_0x2e0a('0x32')](_0x12df7f[_0x2e0a('0x2f')],_0x12df7f[_0x2e0a('0x33')]);_0x54726a[_0x2e0a('0x35')]=_[_0x2e0a('0x32')](_0x12df7f['model'],qs[_0x2e0a('0x34')](_0x13830b[_0x2e0a('0x33')][_0x2e0a('0x34')]));_0x54726a['attributes']=_0x54726a[_0x2e0a('0x35')][_0x2e0a('0x36')]?_0x54726a[_0x2e0a('0x35')]:_0x12df7f[_0x2e0a('0x2f')];if(!_0x13830b[_0x2e0a('0x33')][_0x2e0a('0x4c')](_0x2e0a('0x37'))){_0x54726a[_0x2e0a('0x21')]=qs[_0x2e0a('0x21')](_0x13830b[_0x2e0a('0x33')]['limit']);_0x54726a[_0x2e0a('0x1f')]=qs[_0x2e0a('0x1f')](_0x13830b[_0x2e0a('0x33')][_0x2e0a('0x1f')]);}_0x54726a[_0x2e0a('0x38')]=qs[_0x2e0a('0x39')](_0x13830b[_0x2e0a('0x33')][_0x2e0a('0x39')]);_0x54726a[_0x2e0a('0x3a')]=qs[_0x2e0a('0x31')](_['pick'](_0x13830b['query'],_0x12df7f[_0x2e0a('0x31')]));_0x54726a[_0x2e0a('0x3a')][_0x2e0a('0x4d')]=_0x4b7a89['id'];if(_0x13830b[_0x2e0a('0x33')]['filter']){_0x54726a[_0x2e0a('0x3a')]=_['merge'](_0x54726a[_0x2e0a('0x3a')],{'$or':_[_0x2e0a('0x2d')](_0x54726a['attributes'],function(_0x2199c7){var _0x4d486f={};_0x4d486f[_0x2199c7]={'$like':'%'+_0x13830b[_0x2e0a('0x33')]['filter']+'%'};return _0x4d486f;})});}_0x54726a=_[_0x2e0a('0x3c')]({},_0x54726a,_0x13830b['options']);return db[_0x2e0a('0x4b')][_0x2e0a('0x22')]({'where':_0x54726a['where']})[_0x2e0a('0x27')](function(_0x9eb27){_0x4e42f6[_0x2e0a('0x22')]=_0x9eb27;if(_0x13830b[_0x2e0a('0x33')][_0x2e0a('0x3f')]){_0x54726a['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x2e0a('0x4e')](_0x54726a);})[_0x2e0a('0x27')](function(_0xbead7b){_0x4e42f6[_0x2e0a('0x4f')]=_0xbead7b;return _0x4e42f6;});}})[_0x2e0a('0x27')](respondWithFilteredResult(_0x17fc94,_0x54726a))[_0x2e0a('0x40')](handleError(_0x17fc94,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 09ce495..ea455a9 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 _0xdc97=['path','../../config/environment','./jscriptySessionReport.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x21bb01,_0x4988f2){var _0x4a8035=function(_0x1a91f9){while(--_0x1a91f9){_0x21bb01['push'](_0x21bb01['shift']());}};_0x4a8035(++_0x4988f2);}(_0xdc97,0x13b));var _0x7dc9=function(_0x4628ad,_0x302c97){_0x4628ad=_0x4628ad-0x0;var _0x51c766=_0xdc97[_0x4628ad];return _0x51c766;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa630=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x3b708e,_0x37dc38){_0x3b708e=_0x3b708e-0x0;var _0xe1022b=_0xa630[_0x3b708e];return _0xe1022b;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));module[_0x0a63('0x7')]=function(_0x37b4c9,_0x4b7474){return _0x37b4c9[_0x0a63('0x8')](_0x0a63('0x9'),attributes,{'tableName':_0x0a63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4df6580..d1b7491 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 _0x8952=['JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x224436,_0x13088b){var _0x3c694a=function(_0x5b9648){while(--_0x5b9648){_0x224436['push'](_0x224436['shift']());}};_0x3c694a(++_0x13088b);}(_0x8952,0x17e));var _0x2895=function(_0x2a031f,_0x11c1f0){_0x2a031f=_0x2a031f-0x0;var _0x5107d8=_0x8952[_0x2a031f];return _0x5107d8;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});} \ No newline at end of file +var _0xafb9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x1c6e88,_0x2c9f72){var _0x50dbb2=function(_0x1f38ae){while(--_0x1f38ae){_0x1c6e88['push'](_0x1c6e88['shift']());}};_0x50dbb2(++_0x2c9f72);}(_0xafb9,0x68));var _0x9afb=function(_0x84f1f,_0x1c2909){_0x84f1f=_0x84f1f-0x0;var _0x5853d3=_0xafb9[_0x84f1f];return _0x5853d3;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 63d2a4b..7a7b7aa 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 _0x410d=['update','exports','util','path','express','fs-extra','../../config/environment','./license.controller','index','put'];(function(_0x3c87e2,_0x4ff4c9){var _0x313fad=function(_0x347399){while(--_0x347399){_0x3c87e2['push'](_0x3c87e2['shift']());}};_0x313fad(++_0x4ff4c9);}(_0x410d,0x106));var _0xd410=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x410d[_0x231dda];return _0x3f88cb;};'use strict';var multer=require('multer');var util=require(_0xd410('0x0'));var path=require(_0xd410('0x1'));var timeout=require('connect-timeout');var express=require(_0xd410('0x2'));var router=express['Router']();var fs_extra=require(_0xd410('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd410('0x4'));var controller=require(_0xd410('0x5'));router['get']('/',controller[_0xd410('0x6')]);router[_0xd410('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd410('0x8')]);module[_0xd410('0x9')]=router; \ No newline at end of file +var _0x252f=['update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x252f,0x1e2));var _0xf252=function(_0x3eb211,_0x4a2e7f){_0x3eb211=_0x3eb211-0x0;var _0xb32a15=_0x252f[_0x3eb211];return _0xb32a15;};'use strict';var multer=require(_0xf252('0x0'));var util=require('util');var path=require(_0xf252('0x1'));var timeout=require(_0xf252('0x2'));var express=require(_0xf252('0x3'));var router=express[_0xf252('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf252('0x5'));var interaction=require(_0xf252('0x6'));var config=require(_0xf252('0x7'));var controller=require(_0xf252('0x8'));router[_0xf252('0x9')]('/',controller[_0xf252('0xa')]);router[_0xf252('0xb')](_0xf252('0xc'),auth[_0xf252('0xd')](),controller[_0xf252('0xe')]);module[_0xf252('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 ba9eaac..f68fd18 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 _0x6baa=['STRING','INTEGER','sequelize','TEXT'];(function(_0x138f76,_0x315901){var _0x533b2a=function(_0x42f8bb){while(--_0x42f8bb){_0x138f76['push'](_0x138f76['shift']());}};_0x533b2a(++_0x315901);}(_0x6baa,0x92));var _0xa6ba=function(_0x31f40a,_0x1e3464){_0x31f40a=_0x31f40a-0x0;var _0x2efc29=_0x6baa[_0x31f40a];return _0x2efc29;};'use strict';var Sequelize=require(_0xa6ba('0x0'));module['exports']={'license':{'type':Sequelize[_0xa6ba('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xa6ba('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xa6ba('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb216=['STRING','exports','TEXT'];(function(_0x2a2c6a,_0x42db0f){var _0x4d3b62=function(_0x3be1fa){while(--_0x3be1fa){_0x2a2c6a['push'](_0x2a2c6a['shift']());}};_0x4d3b62(++_0x42db0f);}(_0xb216,0xd3));var _0x6b21=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0xb216[_0x2b91c5];return _0xbd5531;};'use strict';var Sequelize=require('sequelize');module[_0x6b21('0x0')]={'license':{'type':Sequelize[_0x6b21('0x1')]},'data1':{'type':Sequelize[_0x6b21('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 7ead6de..3dcee73 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 _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13fbbf,_0x3e48f1){var _0x35fa3d=function(_0x1cdd38){while(--_0x1cdd38){_0x13fbbf['push'](_0x13fbbf['shift']());}};_0x35fa3d(++_0x3e48f1);}(_0xabce,0x103));var _0xeabc=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xabce[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file +var _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x9c8e44,_0x1705a1){var _0x412faf=function(_0x7acfcd){while(--_0x7acfcd){_0x9c8e44['push'](_0x9c8e44['shift']());}};_0x412faf(++_0x1705a1);}(_0x814b,0x1a2));var _0xb814=function(_0x56aa66,_0x1ddf52){_0x56aa66=_0x56aa66-0x0;var _0xeba9ff=_0x814b[_0x56aa66];return _0xeba9ff;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b28217f..1ff331f 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 _0x0a90=['License','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./license.attributes','exports','define'];(function(_0x16377e,_0x2fb343){var _0x420bd4=function(_0x44d1b8){while(--_0x44d1b8){_0x16377e['push'](_0x16377e['shift']());}};_0x420bd4(++_0x2fb343);}(_0x0a90,0xd2));var _0x00a9=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x0a90[_0x2080a3];return _0x8d7d17;};'use strict';var _=require('lodash');var util=require(_0x00a9('0x0'));var logger=require(_0x00a9('0x1'))(_0x00a9('0x2'));var moment=require(_0x00a9('0x3'));var BPromise=require(_0x00a9('0x4'));var rp=require(_0x00a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00a9('0x6'));var config=require('../../config/environment');var attributes=require(_0x00a9('0x7'));module[_0x00a9('0x8')]=function(_0x219763,_0x2f8198){return _0x219763[_0x00a9('0x9')](_0x00a9('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fc5=['define','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x306aa1,_0x5d1d2f){var _0x5721f3=function(_0x550a73){while(--_0x550a73){_0x306aa1['push'](_0x306aa1['shift']());}};_0x5721f3(++_0x5d1d2f);}(_0x0fc5,0x6c));var _0x50fc=function(_0x51d46c,_0x5688a8){_0x51d46c=_0x51d46c-0x0;var _0x44e6a4=_0x0fc5[_0x51d46c];return _0x44e6a4;};'use strict';var _=require(_0x50fc('0x0'));var util=require(_0x50fc('0x1'));var logger=require(_0x50fc('0x2'))(_0x50fc('0x3'));var moment=require(_0x50fc('0x4'));var BPromise=require(_0x50fc('0x5'));var rp=require(_0x50fc('0x6'));var fs=require('fs');var path=require(_0x50fc('0x7'));var rimraf=require(_0x50fc('0x8'));var config=require(_0x50fc('0x9'));var attributes=require(_0x50fc('0xa'));module[_0x50fc('0xb')]=function(_0x549059,_0x336559){return _0x549059[_0x50fc('0xc')](_0x50fc('0xd'),attributes,{'tableName':_0x50fc('0xe'),'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 b29ee17..48c91c8 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 _0xe067=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x317f33,_0x4688eb){var _0x21208a=function(_0x28b59b){while(--_0x28b59b){_0x317f33['push'](_0x317f33['shift']());}};_0x21208a(++_0x4688eb);}(_0xe067,0xf5));var _0x7e06=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xe067[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x7e06('0x0'));var util=require(_0x7e06('0x1'));var moment=require(_0x7e06('0x2'));var BPromise=require(_0x7e06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e06('0x4'));var db=require(_0x7e06('0x5'))['db'];var utils=require(_0x7e06('0x6'));var logger=require(_0x7e06('0x7'))(_0x7e06('0x8'));var config=require(_0x7e06('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7e06('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa7260a,_0x2d8a33,_0x3a6490){return new BPromise(function(_0x308714,_0x4186c3){return client[_0x7e06('0xb')](_0xa7260a,_0x3a6490)[_0x7e06('0xc')](function(_0x3e63fd){logger[_0x7e06('0xd')](_0x7e06('0xe'),_0x2d8a33,_0x7e06('0xf'));logger[_0x7e06('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x2d8a33,_0x7e06('0xf'),JSON[_0x7e06('0x11')](_0x3e63fd));if(_0x3e63fd['error']){if(_0x3e63fd[_0x7e06('0x12')]['code']===0x1f4){logger[_0x7e06('0x12')]('License,\x20%s,\x20%s',_0x2d8a33,_0x3e63fd[_0x7e06('0x12')][_0x7e06('0x13')]);return _0x4186c3(_0x3e63fd[_0x7e06('0x12')][_0x7e06('0x13')]);}logger[_0x7e06('0x12')]('License,\x20%s,\x20%s',_0x2d8a33,_0x3e63fd['error']['message']);return _0x308714(_0x3e63fd[_0x7e06('0x12')][_0x7e06('0x13')]);}else{logger['info']('License,\x20%s,\x20%s',_0x2d8a33,'request\x20sent');_0x308714(_0x3e63fd[_0x7e06('0x14')][_0x7e06('0x13')]);}})[_0x7e06('0x15')](function(_0x38f3cb){logger[_0x7e06('0x12')](_0x7e06('0xe'),_0x2d8a33,_0x38f3cb);_0x4186c3(_0x38f3cb);});});} \ No newline at end of file +var _0x038b=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0x038b,0x128));var _0xb038=function(_0xb666fd,_0x2c8c36){_0xb666fd=_0xb666fd-0x0;var _0x45e69f=_0x038b[_0xb666fd];return _0x45e69f;};'use strict';var _=require(_0xb038('0x0'));var util=require('util');var moment=require(_0xb038('0x1'));var BPromise=require(_0xb038('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb038('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb038('0x4'))(_0xb038('0x5'));var config=require(_0xb038('0x6'));var jayson=require(_0xb038('0x7'));var client=jayson[_0xb038('0x8')][_0xb038('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x643305,_0xb2453b,_0x2adb2b){return new BPromise(function(_0x46b046,_0x313772){return client[_0xb038('0xa')](_0x643305,_0x2adb2b)[_0xb038('0xb')](function(_0x274c96){logger['info']('License,\x20%s,\x20%s',_0xb2453b,_0xb038('0xc'));logger[_0xb038('0xd')](_0xb038('0xe'),_0xb2453b,_0xb038('0xc'),JSON[_0xb038('0xf')](_0x274c96));if(_0x274c96[_0xb038('0x10')]){if(_0x274c96[_0xb038('0x10')][_0xb038('0x11')]===0x1f4){logger[_0xb038('0x10')]('License,\x20%s,\x20%s',_0xb2453b,_0x274c96[_0xb038('0x10')][_0xb038('0x12')]);return _0x313772(_0x274c96[_0xb038('0x10')][_0xb038('0x12')]);}logger[_0xb038('0x10')](_0xb038('0x13'),_0xb2453b,_0x274c96['error'][_0xb038('0x12')]);return _0x46b046(_0x274c96['error'][_0xb038('0x12')]);}else{logger[_0xb038('0x14')](_0xb038('0x13'),_0xb2453b,_0xb038('0xc'));_0x46b046(_0x274c96[_0xb038('0x15')][_0xb038('0x12')]);}})[_0xb038('0x16')](function(_0x5c3af8){logger[_0xb038('0x10')](_0xb038('0x13'),_0xb2453b,_0x5c3af8);_0x313772(_0x5c3af8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index b48f6ca..87ef851 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 _0x5e5d=['delete','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','fs-extra','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/in_servers','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','/:id','update','removeDispositions'];(function(_0x431d2b,_0x7a3416){var _0x7e3d8e=function(_0x3e969b){while(--_0x3e969b){_0x431d2b['push'](_0x431d2b['shift']());}};_0x7e3d8e(++_0x7a3416);}(_0x5e5d,0x1e8));var _0xd5e5=function(_0x5f50b5,_0x461033){_0x5f50b5=_0x5f50b5-0x0;var _0x194bd4=_0x5e5d[_0x5f50b5];return _0x194bd4;};'use strict';var multer=require(_0xd5e5('0x0'));var util=require(_0xd5e5('0x1'));var path=require(_0xd5e5('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5e5('0x3'));var router=express['Router']();var fs_extra=require(_0xd5e5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd5e5('0x5'));var controller=require(_0xd5e5('0x6'));router[_0xd5e5('0x7')]('/',auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x9')]);router['get'](_0xd5e5('0xa'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0xb')]);router[_0xd5e5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd5e5('0xc')]);router[_0xd5e5('0x7')](_0xd5e5('0xd'),auth['isAuthenticated'](),controller[_0xd5e5('0xe')]);router[_0xd5e5('0x7')](_0xd5e5('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xd5e5('0x7')]('/:id/in_servers',auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x10')]);router[_0xd5e5('0x7')]('/:id/out_servers',auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x11')]);router[_0xd5e5('0x7')]('/:id/interactions',auth[_0xd5e5('0x8')](),controller['getInteractions']);router[_0xd5e5('0x7')](_0xd5e5('0x12'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x13')]);router[_0xd5e5('0x7')](_0xd5e5('0x14'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x15')]);router['get'](_0xd5e5('0x16'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x17')]);router[_0xd5e5('0x7')](_0xd5e5('0x18'),auth['isAuthenticated'](),controller[_0xd5e5('0x19')]);router[_0xd5e5('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xd5e5('0x1a')](_0xd5e5('0xf'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x1b')]);router['post']('/',auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x1c')]);router['post'](_0xd5e5('0x1d'),auth[_0xd5e5('0x8')](),controller['addImap']);router['post']('/:id/out_servers',auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x1e')]);router[_0xd5e5('0x1a')](_0xd5e5('0x1f'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x20')]);router[_0xd5e5('0x1a')](_0xd5e5('0x12'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x21')]);router['post'](_0xd5e5('0x22'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x23')]);router[_0xd5e5('0x1a')](_0xd5e5('0x18'),auth['isAuthenticated'](),controller[_0xd5e5('0x24')]);router['put'](_0xd5e5('0x25'),auth['isAuthenticated'](),controller[_0xd5e5('0x26')]);router['delete']('/:id/dispositions',auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x27')]);router[_0xd5e5('0x28')](_0xd5e5('0xf'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x29')]);router[_0xd5e5('0x28')](_0xd5e5('0x1d'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x2a')]);router[_0xd5e5('0x28')](_0xd5e5('0x2b'),auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x2c')]);router['delete'](_0xd5e5('0x25'),auth['isAuthenticated'](),controller[_0xd5e5('0x2d')]);router[_0xd5e5('0x28')]('/:id/users',auth[_0xd5e5('0x8')](),controller[_0xd5e5('0x2e')]);module[_0xd5e5('0x2f')]=router; \ No newline at end of file +var _0x900e=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/canned_answers','getAnswers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','put','/:id','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','exports'];(function(_0x4879ca,_0x4d5b70){var _0x454e60=function(_0x14241a){while(--_0x14241a){_0x4879ca['push'](_0x4879ca['shift']());}};_0x454e60(++_0x4d5b70);}(_0x900e,0x13b));var _0xe900=function(_0x3e23c1,_0xb0c332){_0x3e23c1=_0x3e23c1-0x0;var _0x393fea=_0x900e[_0x3e23c1];return _0x393fea;};'use strict';var multer=require('multer');var util=require(_0xe900('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe900('0x1'));var router=express[_0xe900('0x2')]();var fs_extra=require(_0xe900('0x3'));var auth=require(_0xe900('0x4'));var interaction=require(_0xe900('0x5'));var config=require('../../config/environment');var controller=require(_0xe900('0x6'));router[_0xe900('0x7')]('/',auth[_0xe900('0x8')](),controller[_0xe900('0x9')]);router['get'](_0xe900('0xa'),auth[_0xe900('0x8')](),controller[_0xe900('0xb')]);router[_0xe900('0x7')]('/:id',auth[_0xe900('0x8')](),controller[_0xe900('0xc')]);router[_0xe900('0x7')]('/:id/dispositions',auth[_0xe900('0x8')](),controller['getDispositions']);router[_0xe900('0x7')](_0xe900('0xd'),auth[_0xe900('0x8')](),controller[_0xe900('0xe')]);router[_0xe900('0x7')]('/:id/in_servers',auth[_0xe900('0x8')](),controller['getImap']);router[_0xe900('0x7')]('/:id/out_servers',auth[_0xe900('0x8')](),controller[_0xe900('0xf')]);router['get'](_0xe900('0x10'),auth[_0xe900('0x8')](),controller[_0xe900('0x11')]);router[_0xe900('0x7')](_0xe900('0x12'),auth[_0xe900('0x8')](),controller[_0xe900('0x13')]);router[_0xe900('0x7')](_0xe900('0x14'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/verify',auth[_0xe900('0x8')](),controller['verifySmtp']);router[_0xe900('0x7')](_0xe900('0x15'),auth[_0xe900('0x8')](),controller[_0xe900('0x16')]);router[_0xe900('0x17')](_0xe900('0x18'),auth[_0xe900('0x8')](),controller[_0xe900('0x19')]);router[_0xe900('0x17')](_0xe900('0xd'),auth[_0xe900('0x8')](),controller[_0xe900('0x1a')]);router[_0xe900('0x17')]('/',auth[_0xe900('0x8')](),controller[_0xe900('0x1b')]);router[_0xe900('0x17')](_0xe900('0x1c'),auth[_0xe900('0x8')](),controller[_0xe900('0x1d')]);router[_0xe900('0x17')]('/:id/out_servers',auth[_0xe900('0x8')](),controller[_0xe900('0x1e')]);router[_0xe900('0x17')](_0xe900('0x10'),auth[_0xe900('0x8')](),controller[_0xe900('0x1f')]);router[_0xe900('0x17')](_0xe900('0x12'),auth[_0xe900('0x8')](),controller[_0xe900('0x20')]);router[_0xe900('0x17')](_0xe900('0x21'),auth[_0xe900('0x8')](),controller['send']);router[_0xe900('0x17')](_0xe900('0x15'),auth[_0xe900('0x8')](),controller['addAgents']);router[_0xe900('0x22')](_0xe900('0x23'),auth[_0xe900('0x8')](),controller['update']);router[_0xe900('0x24')]('/:id/dispositions',auth[_0xe900('0x8')](),controller[_0xe900('0x25')]);router['delete'](_0xe900('0xd'),auth['isAuthenticated'](),controller[_0xe900('0x26')]);router[_0xe900('0x24')](_0xe900('0x1c'),auth[_0xe900('0x8')](),controller[_0xe900('0x27')]);router[_0xe900('0x24')](_0xe900('0x28'),auth['isAuthenticated'](),controller[_0xe900('0x29')]);router[_0xe900('0x24')](_0xe900('0x23'),auth['isAuthenticated'](),controller[_0xe900('0x2a')]);router['delete'](_0xe900('0x15'),auth['isAuthenticated'](),controller[_0xe900('0x2b')]);module[_0xe900('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4e8a5fe..6541a88 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 _0x130d=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x293ea5,_0x12ee60){var _0x1311ae=function(_0x12a1c6){while(--_0x12a1c6){_0x293ea5['push'](_0x293ea5['shift']());}};_0x1311ae(++_0x12ee60);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd130('0x0'));module['exports']={'description':{'type':Sequelize[_0xd130('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xd130('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xd130('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd130('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd130('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xd130('0x3')]},'markAsUnread':{'type':Sequelize[_0xd130('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd130('0x1')],'allowNull':![],'defaultValue':_0xd130('0x4')},'fontSize':{'type':Sequelize[_0xd130('0x5')](0x2)[_0xd130('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd130('0x3')],'defaultValue':function(){return _0xd130('0x7');}},'notificationSound':{'type':Sequelize[_0xd130('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd130('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd130('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd130('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd130('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd130('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd130('0x2')],'defaultValue':![],'comment':_0xd130('0x8'),'set':function(_0x4dba28){if(!_0x4dba28)this['setDataValue'](_0xd130('0x9'),null);this['setDataValue'](_0xd130('0xa'),_0x4dba28);}}}; \ No newline at end of file +var _0x615a=['setDataValue','mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x194be8,_0x1a4639){var _0x20bf84=function(_0x14f904){while(--_0x14f904){_0x194be8['push'](_0x194be8['shift']());}};_0x20bf84(++_0x1a4639);}(_0x615a,0x119));var _0xa615=function(_0x1eb82d,_0x1e23cb){_0x1eb82d=_0x1eb82d-0x0;var _0x2c9502=_0x615a[_0x1eb82d];return _0x2c9502;};'use strict';var Sequelize=require(_0xa615('0x0'));module['exports']={'description':{'type':Sequelize[_0xa615('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xa615('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa615('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa615('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa615('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xa615('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa615('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xa615('0x3')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa615('0x4')],'defaultValue':function(){return _0xa615('0x5');}},'notificationSound':{'type':Sequelize[_0xa615('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa615('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa615('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa615('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa615('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa615('0x3')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa615('0x2')],'defaultValue':![],'comment':_0xa615('0x6'),'set':function(_0x16c90b){if(!_0x16c90b)this[_0xa615('0x7')](_0xa615('0x8'),null);this['setDataValue']('mandatoryDisposition',_0x16c90b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 289e395..9b5206d 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 _0xc902=['destroy','MailAccounts','UserProfileResource','end','name','send','index','MailServerIn','Imap','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','MailServerOut','Smtp','rawAttributes','options','find','body','describe','addDisposition','Disposition','create','getDispositions','findOne','hasOwnProperty','order','MailAccountId','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','ids','email','ListId','isNil','active','description','user','cuser','pass','cpassword','authentication','host','port','service','cservice','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','basename','secure','SendMail','sendMail','defaults','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','auth','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','juice','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','./mailAccount.socket','register','client','http','then','debug','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','offset','limit','undefined','count','apply','save','update'];(function(_0x1c8cad,_0x324ee7){var _0x1884ae=function(_0x2d6e3d){while(--_0x2d6e3d){_0x1c8cad['push'](_0x1c8cad['shift']());}};_0x1884ae(++_0x324ee7);}(_0xc902,0x15c));var _0x2c90=function(_0x13025a,_0x3bafcb){_0x13025a=_0x13025a-0x0;var _0x4c3b65=_0xc902[_0x13025a];return _0x4c3b65;};'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 htmlToText=require('html-to-text');var juice=require(_0x2c90('0x11'));var Redis=require(_0x2c90('0x12'));var authService=require(_0x2c90('0x13'));var qs=require(_0x2c90('0x14'));var as=require(_0x2c90('0x15'));var hardwareService=require(_0x2c90('0x16'));var logger=require(_0x2c90('0x17'))(_0x2c90('0x18'));var utils=require('../../config/utils');var config=require(_0x2c90('0x19'));var licenseUtil=require(_0x2c90('0x1a'));var db=require('../../mysqldb')['db'];config[_0x2c90('0x1b')]=_['defaults'](config[_0x2c90('0x1b')],{'host':_0x2c90('0x1c'),'port':0x18eb});var socket=require(_0x2c90('0x1d'))(new Redis(config[_0x2c90('0x1b')]));require(_0x2c90('0x1e'))[_0x2c90('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2c90('0x20')][_0x2c90('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x2ee7be,_0x22452f,_0x46b40a,_0x102a3b){return new BPromise(function(_0x16be42,_0x45de38){var _0x445f34=_0x102a3b||client;return _0x445f34['request'](_0x2ee7be,_0x46b40a)[_0x2c90('0x22')](function(_0x2814bb){logger['info']('MailAccount,\x20%s,\x20%s',_0x22452f,'request\x20sent');logger[_0x2c90('0x23')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x22452f,_0x2c90('0x24'),JSON[_0x2c90('0x25')](_0x2814bb));if(_0x2814bb['error']){if(_0x2814bb[_0x2c90('0x26')][_0x2c90('0x27')]===0x1f4){logger[_0x2c90('0x26')](_0x2c90('0x28'),_0x22452f,_0x2814bb[_0x2c90('0x26')][_0x2c90('0x29')]);return _0x45de38(_0x2814bb[_0x2c90('0x26')][_0x2c90('0x29')]);}logger[_0x2c90('0x26')](_0x2c90('0x28'),_0x22452f,_0x2814bb[_0x2c90('0x26')][_0x2c90('0x29')]);return _0x16be42(_0x2814bb[_0x2c90('0x26')][_0x2c90('0x29')]);}else{logger[_0x2c90('0x2a')]('MailAccount,\x20%s,\x20%s',_0x22452f,_0x2c90('0x24'));_0x16be42(_0x2814bb['result']['message']);}})[_0x2c90('0x2b')](function(_0x74027e){logger[_0x2c90('0x26')](_0x2c90('0x28'),_0x22452f,_0x74027e);_0x45de38(_0x74027e);});});}function respondWithStatusCode(_0x527ec6,_0x23c59d){_0x23c59d=_0x23c59d||0xcc;return function(_0x852dc6){if(_0x852dc6){return _0x527ec6[_0x2c90('0x2c')](_0x23c59d);}return _0x527ec6[_0x2c90('0x2d')](_0x23c59d)['end']();};}function respondWithResult(_0x36267c,_0x3e924b){_0x3e924b=_0x3e924b||0xc8;return function(_0x4abd54){if(_0x4abd54){return _0x36267c[_0x2c90('0x2d')](_0x3e924b)[_0x2c90('0x2e')](_0x4abd54);}};}function respondWithFilteredResult(_0x151462,_0x19cca4){return function(_0x44d4b5){if(_0x44d4b5){var _0x48043f=typeof _0x19cca4[_0x2c90('0x2f')]==='undefined'&&typeof _0x19cca4[_0x2c90('0x30')]===_0x2c90('0x31');var _0x4e017f=_0x44d4b5[_0x2c90('0x32')];var _0x20c157=_0x48043f?0x0:_0x19cca4['offset'];var _0x46d2c5=_0x48043f?_0x44d4b5[_0x2c90('0x32')]:_0x19cca4['offset']+_0x19cca4[_0x2c90('0x30')];var _0x468afe;if(_0x46d2c5>=_0x4e017f){_0x46d2c5=_0x4e017f;_0x468afe=0xc8;}else{_0x468afe=0xce;}_0x151462[_0x2c90('0x2d')](_0x468afe);return _0x151462['set']('Content-Range',_0x20c157+'-'+_0x46d2c5+'/'+_0x4e017f)[_0x2c90('0x2e')](_0x44d4b5);}return null;};}function patchUpdates(_0x28934c){return function(_0x26b59c){try{jsonpatch[_0x2c90('0x33')](_0x26b59c,_0x28934c,!![]);}catch(_0x540f67){return BPromise['reject'](_0x540f67);}return _0x26b59c[_0x2c90('0x34')]();};}function saveUpdates(_0x4cd5c9,_0x4417b2){return function(_0x1d2896){if(_0x1d2896){return _0x1d2896[_0x2c90('0x35')](_0x4cd5c9)['then'](function(_0x5f3d3e){return _0x5f3d3e;});}return null;};}function removeEntity(_0x1516cf,_0x4e3d02){return function(_0x3a8fd9){if(_0x3a8fd9){return _0x3a8fd9[_0x2c90('0x36')]()[_0x2c90('0x22')](function(){var _0x45b6c3=_0x3a8fd9['get']({'plain':!![]});var _0x4e2f82=_0x2c90('0x37');return db[_0x2c90('0x38')][_0x2c90('0x36')]({'where':{'type':_0x4e2f82,'resourceId':_0x45b6c3['id']}})[_0x2c90('0x22')](function(){return _0x3a8fd9;});})[_0x2c90('0x22')](function(){_0x1516cf[_0x2c90('0x2d')](0xcc)[_0x2c90('0x39')]();});}};}function handleEntityNotFound(_0x3f3fd8,_0x4f0475){return function(_0x351d15){if(!_0x351d15){_0x3f3fd8[_0x2c90('0x2c')](0x194);}return _0x351d15;};}function handleError(_0x51956d,_0x26ce1c){_0x26ce1c=_0x26ce1c||0x1f4;return function(_0x1d2ff4){logger[_0x2c90('0x26')](_0x1d2ff4['stack']);if(_0x1d2ff4[_0x2c90('0x3a')]){delete _0x1d2ff4[_0x2c90('0x3a')];}_0x51956d[_0x2c90('0x2d')](_0x26ce1c)[_0x2c90('0x3b')](_0x1d2ff4);};}exports[_0x2c90('0x3c')]=function(_0x39b709,_0x5cb4f8){var _0x3e0606={'include':[{'model':db[_0x2c90('0x3d')],'as':_0x2c90('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x2c90('0x3f')],'as':_0x2c90('0x40')}]},_0x5e5f87={},_0x22a357={'count':0x0,'rows':[]};var _0x3cf036=_[_0x2c90('0x41')](db[_0x2c90('0x42')]['rawAttributes'],function(_0x1bbdc2){return{'name':_0x1bbdc2[_0x2c90('0x43')],'type':_0x1bbdc2[_0x2c90('0x44')][_0x2c90('0x45')]};});_0x5e5f87[_0x2c90('0x46')]=_[_0x2c90('0x41')](_0x3cf036,'name');_0x5e5f87[_0x2c90('0x47')]=_[_0x2c90('0x48')](_0x39b709[_0x2c90('0x47')]);_0x5e5f87[_0x2c90('0x49')]=_['intersection'](_0x5e5f87['model'],_0x5e5f87[_0x2c90('0x47')]);_0x3e0606[_0x2c90('0x4a')]=_[_0x2c90('0x4b')](_0x5e5f87[_0x2c90('0x46')],qs[_0x2c90('0x4c')](_0x39b709[_0x2c90('0x47')]['fields']));_0x3e0606[_0x2c90('0x4a')]=_0x3e0606[_0x2c90('0x4a')][_0x2c90('0x4d')]?_0x3e0606['attributes']:_0x5e5f87[_0x2c90('0x46')];if(!_0x39b709['query']['hasOwnProperty'](_0x2c90('0x4e'))){_0x3e0606[_0x2c90('0x30')]=qs[_0x2c90('0x30')](_0x39b709['query'][_0x2c90('0x30')]);_0x3e0606['offset']=qs[_0x2c90('0x2f')](_0x39b709['query']['offset']);}_0x3e0606['order']=qs['sort'](_0x39b709[_0x2c90('0x47')][_0x2c90('0x4f')]);_0x3e0606[_0x2c90('0x50')]=qs[_0x2c90('0x49')](_['pick'](_0x39b709['query'],_0x5e5f87[_0x2c90('0x49')]),_0x3cf036);if(_0x39b709[_0x2c90('0x47')]['filter']){_0x3e0606[_0x2c90('0x50')]=_[_0x2c90('0x51')](_0x3e0606[_0x2c90('0x50')],{'$or':_[_0x2c90('0x41')](_0x3cf036,function(_0x338304){if(_0x338304[_0x2c90('0x44')]!==_0x2c90('0x52')){var _0x421b93={};_0x421b93[_0x338304['name']]={'$like':'%'+_0x39b709[_0x2c90('0x47')]['filter']+'%'};return _0x421b93;}})});}_0x3e0606=_[_0x2c90('0x51')]({},_0x3e0606,_0x39b709['options']);var _0x3af3b9={'where':_0x3e0606[_0x2c90('0x50')]};return db['MailAccount']['count'](_0x3af3b9)[_0x2c90('0x22')](function(_0x3d4b1a){_0x22a357[_0x2c90('0x32')]=_0x3d4b1a;if(_0x39b709['query'][_0x2c90('0x53')]){_0x3e0606[_0x2c90('0x54')]=[{'all':!![]}];}return db[_0x2c90('0x42')][_0x2c90('0x55')](_0x3e0606);})[_0x2c90('0x22')](function(_0x543c35){_0x22a357[_0x2c90('0x56')]=_0x543c35;return _0x22a357;})[_0x2c90('0x22')](respondWithFilteredResult(_0x5cb4f8,_0x3e0606))[_0x2c90('0x2b')](handleError(_0x5cb4f8,null));};exports[_0x2c90('0x57')]=function(_0x4f83b3,_0x5639d3){var _0x1e8f2b={'raw':![],'where':{'id':_0x4f83b3[_0x2c90('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2c90('0x3e')},{'model':db[_0x2c90('0x59')],'as':_0x2c90('0x5a')},{'model':db[_0x2c90('0x3f')],'as':_0x2c90('0x40')}]},_0x4c0925={};_0x4c0925[_0x2c90('0x46')]=_[_0x2c90('0x48')](db[_0x2c90('0x42')][_0x2c90('0x5b')]);_0x4c0925[_0x2c90('0x47')]=_['keys'](_0x4f83b3[_0x2c90('0x47')]);_0x4c0925['filters']=_['intersection'](_0x4c0925[_0x2c90('0x46')],_0x4c0925[_0x2c90('0x47')]);_0x1e8f2b[_0x2c90('0x4a')]=_['intersection'](_0x4c0925['model'],qs[_0x2c90('0x4c')](_0x4f83b3[_0x2c90('0x47')][_0x2c90('0x4c')]));_0x1e8f2b[_0x2c90('0x4a')]=_0x1e8f2b['attributes'][_0x2c90('0x4d')]?_0x1e8f2b[_0x2c90('0x4a')]:_0x4c0925[_0x2c90('0x46')];if(_0x4f83b3[_0x2c90('0x47')][_0x2c90('0x53')]){_0x1e8f2b[_0x2c90('0x54')]=[{'all':!![]}];}_0x1e8f2b=_[_0x2c90('0x51')]({},_0x1e8f2b,_0x4f83b3[_0x2c90('0x5c')]);return db[_0x2c90('0x42')][_0x2c90('0x5d')](_0x1e8f2b)['then'](handleEntityNotFound(_0x5639d3,null))['then'](respondWithResult(_0x5639d3,null))[_0x2c90('0x2b')](handleError(_0x5639d3,null));};exports[_0x2c90('0x35')]=function(_0x27feef,_0x37c8ac){if(_0x27feef['body']['id']){delete _0x27feef[_0x2c90('0x5e')]['id'];}return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0x27feef[_0x2c90('0x58')]['id']},'include':[{'model':db[_0x2c90('0x3d')],'as':_0x2c90('0x3e')},{'model':db['MailServerOut'],'as':_0x2c90('0x5a')},{'model':db[_0x2c90('0x3f')],'as':_0x2c90('0x40')}]})[_0x2c90('0x22')](handleEntityNotFound(_0x37c8ac,null))['then'](saveUpdates(_0x27feef['body'],null))['then'](function(_0x5ae38b){if(_0x5ae38b&&_0x27feef[_0x2c90('0x5e')][_0x2c90('0x3e')]){return db['MailServerIn'][_0x2c90('0x35')](_0x27feef[_0x2c90('0x5e')][_0x2c90('0x3e')],{'where':{'MailAccountId':_0x5ae38b['id']}})[_0x2c90('0x22')](function(){return _0x5ae38b;});}return _0x5ae38b;})[_0x2c90('0x22')](function(_0x5e6098){if(_0x5e6098&&_0x27feef[_0x2c90('0x5e')]['Smtp']){return db[_0x2c90('0x59')][_0x2c90('0x35')](_0x27feef[_0x2c90('0x5e')][_0x2c90('0x5a')],{'where':{'MailAccountId':_0x5e6098['id']}})[_0x2c90('0x22')](function(){return _0x5e6098;});}return _0x5e6098;})['then'](respondWithResult(_0x37c8ac,null))['catch'](handleError(_0x37c8ac,null));};exports['describe']=function(_0x444655,_0x50f65d){return db['MailAccount'][_0x2c90('0x5f')]()[_0x2c90('0x22')](respondWithResult(_0x50f65d,null))[_0x2c90('0x2b')](handleError(_0x50f65d,null));};exports[_0x2c90('0x60')]=function(_0x4a36d0,_0x18b27f,_0x1b785e){if(_0x4a36d0[_0x2c90('0x5e')]['id']){delete _0x4a36d0[_0x2c90('0x5e')]['id'];}return db[_0x2c90('0x42')]['find']({'where':{'id':_0x4a36d0[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x18b27f,null))[_0x2c90('0x22')](function(_0xb5f5bd){if(_0xb5f5bd){_0x4a36d0[_0x2c90('0x5e')]['MailAccountId']=_0xb5f5bd['id'];return db[_0x2c90('0x61')][_0x2c90('0x62')](_0x4a36d0[_0x2c90('0x5e')]);}})[_0x2c90('0x22')](respondWithResult(_0x18b27f,null))[_0x2c90('0x2b')](handleError(_0x18b27f,null));};exports[_0x2c90('0x63')]=function(_0x219059,_0x56b5be,_0x57eca9){var _0x48fbc5={'raw':![],'where':{}};var _0x905ea3={};var _0x27083e={'count':0x0,'rows':[]};return db[_0x2c90('0x42')][_0x2c90('0x64')]({'where':{'id':_0x219059['params']['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x56b5be,null))['then'](function(_0x57d177){if(_0x57d177){_0x905ea3['model']=_['keys'](db['Disposition'][_0x2c90('0x5b')]);_0x905ea3['query']=_['keys'](_0x219059[_0x2c90('0x47')]);_0x905ea3[_0x2c90('0x49')]=_[_0x2c90('0x4b')](_0x905ea3['model'],_0x905ea3['query']);_0x48fbc5['attributes']=_[_0x2c90('0x4b')](_0x905ea3[_0x2c90('0x46')],qs[_0x2c90('0x4c')](_0x219059[_0x2c90('0x47')][_0x2c90('0x4c')]));_0x48fbc5[_0x2c90('0x4a')]=_0x48fbc5[_0x2c90('0x4a')][_0x2c90('0x4d')]?_0x48fbc5[_0x2c90('0x4a')]:_0x905ea3[_0x2c90('0x46')];if(!_0x219059[_0x2c90('0x47')][_0x2c90('0x65')](_0x2c90('0x4e'))){_0x48fbc5[_0x2c90('0x30')]=qs[_0x2c90('0x30')](_0x219059[_0x2c90('0x47')]['limit']);_0x48fbc5['offset']=qs[_0x2c90('0x2f')](_0x219059[_0x2c90('0x47')][_0x2c90('0x2f')]);}_0x48fbc5[_0x2c90('0x66')]=qs[_0x2c90('0x4f')](_0x219059[_0x2c90('0x47')][_0x2c90('0x4f')]);_0x48fbc5[_0x2c90('0x50')]=qs[_0x2c90('0x49')](_['pick'](_0x219059[_0x2c90('0x47')],_0x905ea3['filters']));_0x48fbc5[_0x2c90('0x50')][_0x2c90('0x67')]=_0x57d177['id'];if(_0x219059[_0x2c90('0x47')]['filter']){_0x48fbc5[_0x2c90('0x50')]=_[_0x2c90('0x51')](_0x48fbc5[_0x2c90('0x50')],{'$or':_[_0x2c90('0x41')](_0x48fbc5[_0x2c90('0x4a')],function(_0x518a9d){var _0x2dd511={};_0x2dd511[_0x518a9d]={'$like':'%'+_0x219059['query'][_0x2c90('0x68')]+'%'};return _0x2dd511;})});}_0x48fbc5=_['merge']({},_0x48fbc5,_0x219059['options']);return db[_0x2c90('0x61')][_0x2c90('0x32')]({'where':_0x48fbc5[_0x2c90('0x50')]})[_0x2c90('0x22')](function(_0x4a27ca){_0x27083e[_0x2c90('0x32')]=_0x4a27ca;if(_0x219059[_0x2c90('0x47')]['includeAll']){_0x48fbc5[_0x2c90('0x54')]=[{'all':!![]}];}return db[_0x2c90('0x61')][_0x2c90('0x55')](_0x48fbc5);})[_0x2c90('0x22')](function(_0x5a2dc7){_0x27083e['rows']=_0x5a2dc7;return _0x27083e;});}})[_0x2c90('0x22')](respondWithFilteredResult(_0x56b5be,_0x48fbc5))[_0x2c90('0x2b')](handleError(_0x56b5be,null));};exports[_0x2c90('0x69')]=function(_0x46c09c,_0x2d424f,_0x3e1245){return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0x46c09c[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x2d424f,null))[_0x2c90('0x22')](function(_0x4a9b60){if(_0x4a9b60){return _0x4a9b60[_0x2c90('0x69')](_0x46c09c[_0x2c90('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x2d424f,null))[_0x2c90('0x2b')](handleError(_0x2d424f,null));};exports[_0x2c90('0x6a')]=function(_0xb05c44,_0x53eccb,_0x5de696){if(_0xb05c44[_0x2c90('0x5e')]['id']){delete _0xb05c44[_0x2c90('0x5e')]['id'];}return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0xb05c44[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x53eccb,null))[_0x2c90('0x22')](function(_0x1cf2ac){if(_0x1cf2ac){_0xb05c44[_0x2c90('0x5e')][_0x2c90('0x67')]=_0x1cf2ac['id'];return db[_0x2c90('0x6b')][_0x2c90('0x62')](_0xb05c44[_0x2c90('0x5e')]);}})['then'](respondWithResult(_0x53eccb,null))[_0x2c90('0x2b')](handleError(_0x53eccb,null));};exports[_0x2c90('0x6c')]=function(_0x97908c,_0x4bd5ee,_0x1832d2){var _0x5d980a={'raw':![],'where':{}};var _0xa69893={};var _0xc52ea2={'count':0x0,'rows':[]};return db[_0x2c90('0x42')][_0x2c90('0x64')]({'where':{'id':_0x97908c[_0x2c90('0x58')]['id']}})['then'](handleEntityNotFound(_0x4bd5ee,null))['then'](function(_0x4230b0){if(_0x4230b0){_0xa69893[_0x2c90('0x46')]=_['keys'](db['CannedAnswer'][_0x2c90('0x5b')]);_0xa69893[_0x2c90('0x47')]=_[_0x2c90('0x48')](_0x97908c[_0x2c90('0x47')]);_0xa69893[_0x2c90('0x49')]=_[_0x2c90('0x4b')](_0xa69893[_0x2c90('0x46')],_0xa69893[_0x2c90('0x47')]);_0x5d980a['attributes']=_[_0x2c90('0x4b')](_0xa69893[_0x2c90('0x46')],qs[_0x2c90('0x4c')](_0x97908c[_0x2c90('0x47')][_0x2c90('0x4c')]));_0x5d980a[_0x2c90('0x4a')]=_0x5d980a[_0x2c90('0x4a')]['length']?_0x5d980a[_0x2c90('0x4a')]:_0xa69893[_0x2c90('0x46')];if(!_0x97908c[_0x2c90('0x47')][_0x2c90('0x65')](_0x2c90('0x4e'))){_0x5d980a[_0x2c90('0x30')]=qs[_0x2c90('0x30')](_0x97908c[_0x2c90('0x47')][_0x2c90('0x30')]);_0x5d980a['offset']=qs[_0x2c90('0x2f')](_0x97908c['query']['offset']);}_0x5d980a[_0x2c90('0x66')]=qs[_0x2c90('0x4f')](_0x97908c[_0x2c90('0x47')][_0x2c90('0x4f')]);_0x5d980a[_0x2c90('0x50')]=qs[_0x2c90('0x49')](_[_0x2c90('0x6d')](_0x97908c[_0x2c90('0x47')],_0xa69893[_0x2c90('0x49')]));_0x5d980a[_0x2c90('0x50')][_0x2c90('0x67')]=_0x4230b0['id'];if(_0x97908c['query']['filter']){_0x5d980a[_0x2c90('0x50')]=_[_0x2c90('0x51')](_0x5d980a[_0x2c90('0x50')],{'$or':_[_0x2c90('0x41')](_0x5d980a[_0x2c90('0x4a')],function(_0x4e5401){var _0x3c153f={};_0x3c153f[_0x4e5401]={'$like':'%'+_0x97908c[_0x2c90('0x47')][_0x2c90('0x68')]+'%'};return _0x3c153f;})});}_0x5d980a=_[_0x2c90('0x51')]({},_0x5d980a,_0x97908c[_0x2c90('0x5c')]);return db['CannedAnswer']['count']({'where':_0x5d980a[_0x2c90('0x50')]})[_0x2c90('0x22')](function(_0x3604b2){_0xc52ea2['count']=_0x3604b2;if(_0x97908c['query']['includeAll']){_0x5d980a[_0x2c90('0x54')]=[{'all':!![]}];}return db[_0x2c90('0x6b')][_0x2c90('0x55')](_0x5d980a);})[_0x2c90('0x22')](function(_0x1fec39){_0xc52ea2[_0x2c90('0x56')]=_0x1fec39;return _0xc52ea2;});}})[_0x2c90('0x22')](respondWithFilteredResult(_0x4bd5ee,_0x5d980a))[_0x2c90('0x2b')](handleError(_0x4bd5ee,null));};exports[_0x2c90('0x6e')]=function(_0x5b3f9c,_0x11bcc5,_0xa3ad9){return db['MailAccount'][_0x2c90('0x5d')]({'where':{'id':_0x5b3f9c[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x11bcc5,null))[_0x2c90('0x22')](function(_0x6f1a80){if(_0x6f1a80){return _0x6f1a80[_0x2c90('0x6e')](_0x5b3f9c[_0x2c90('0x47')][_0x2c90('0x6f')]);}})[_0x2c90('0x22')](respondWithStatusCode(_0x11bcc5,null))['catch'](handleError(_0x11bcc5,null));};exports[_0x2c90('0x62')]=function(_0x4cb55b,_0x48e608){var _0x104137={'name':_0x4cb55b['body'][_0x2c90('0x3a')],'key':_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x45')],'email':_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x70')],'ListId':_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x71')],'active':!_[_0x2c90('0x72')](_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x73')])?_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x73')]:!![],'description':_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x2c90('0x72')](_0x4cb55b[_0x2c90('0x5e')]['cservice'])){if(_0x4cb55b[_0x2c90('0x5e')]['cauthentication']){_0x104137['Imap'][_0x2c90('0x75')]=_0x104137[_0x2c90('0x5a')][_0x2c90('0x75')]=_0x4cb55b['body'][_0x2c90('0x76')];_0x104137[_0x2c90('0x3e')]['password']=_0x104137[_0x2c90('0x5a')][_0x2c90('0x77')]=_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x78')];}else{_0x104137['Imap'][_0x2c90('0x79')]=_0x104137['Smtp'][_0x2c90('0x79')]=![];}_0x104137[_0x2c90('0x3e')][_0x2c90('0x7a')]=_0x4cb55b[_0x2c90('0x5e')]['Imap']['host'];_0x104137[_0x2c90('0x3e')][_0x2c90('0x7b')]=_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x3e')][_0x2c90('0x7b')];_0x104137['Smtp'][_0x2c90('0x7a')]=_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x5a')]['host'];_0x104137['Smtp'][_0x2c90('0x7b')]=_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x5a')][_0x2c90('0x7b')];}else{_0x104137[_0x2c90('0x3e')][_0x2c90('0x7c')]=_0x104137['Smtp'][_0x2c90('0x7c')]=_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x7d')];_0x104137['Imap'][_0x2c90('0x75')]=_0x104137[_0x2c90('0x5a')]['user']=_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x76')];_0x104137[_0x2c90('0x3e')]['password']=_0x104137[_0x2c90('0x5a')][_0x2c90('0x77')]=_0x4cb55b[_0x2c90('0x5e')][_0x2c90('0x78')];}return db[_0x2c90('0x42')]['create'](_0x104137,{'include':[{'model':db[_0x2c90('0x59')],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x2c90('0x22')](function(_0x461261){var _0x1c9515=_0x4cb55b[_0x2c90('0x75')][_0x2c90('0x7e')]({'plain':!![]});if(!_0x1c9515)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c9515['role']===_0x2c90('0x75')){var _0x581264=_0x461261[_0x2c90('0x7e')]({'plain':!![]});return db[_0x2c90('0x7f')][_0x2c90('0x5d')]({'where':{'name':_0x2c90('0x37'),'userProfileId':_0x1c9515[_0x2c90('0x80')]},'raw':!![]})[_0x2c90('0x22')](function(_0x5e1273){if(_0x5e1273&&_0x5e1273[_0x2c90('0x81')]===0x0){return db[_0x2c90('0x38')][_0x2c90('0x62')]({'name':_0x581264[_0x2c90('0x3a')],'resourceId':_0x581264['id'],'type':_0x5e1273[_0x2c90('0x3a')],'sectionId':_0x5e1273['id']},{})['then'](function(){return _0x461261;});}else{return _0x461261;}})[_0x2c90('0x2b')](function(_0x153c24){logger['error'](_0x2c90('0x82'),_0x153c24);throw _0x153c24;});}return _0x461261;})[_0x2c90('0x22')](respondWithResult(_0x48e608,0xc9))[_0x2c90('0x2b')](handleError(_0x48e608,null));};exports[_0x2c90('0x83')]=function(_0x44dc6f,_0x1426c8,_0x36f975){return db['MailAccount'][_0x2c90('0x64')]({'where':{'id':_0x44dc6f[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x1426c8,null))[_0x2c90('0x22')](function(_0x2c4171){if(_0x2c4171){return _0x2c4171[_0x2c90('0x83')]();}return null;})[_0x2c90('0x22')](respondWithResult(_0x1426c8,null))[_0x2c90('0x2b')](handleError(_0x1426c8,null));};exports[_0x2c90('0x84')]=function(_0x1c79bc,_0xdcac56,_0x2645ae){if(_0x1c79bc[_0x2c90('0x5e')]['id']){delete _0x1c79bc['body']['id'];}return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0x1c79bc[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0xdcac56,null))[_0x2c90('0x22')](function(_0x100da8){if(_0x100da8){_0x1c79bc['body'][_0x2c90('0x67')]=_0x100da8['id'];return db[_0x2c90('0x3d')][_0x2c90('0x62')](_0x1c79bc[_0x2c90('0x5e')]);}})[_0x2c90('0x22')](respondWithResult(_0xdcac56,null))[_0x2c90('0x2b')](handleError(_0xdcac56,null));};exports[_0x2c90('0x85')]=function(_0xe5428f,_0x3d7789,_0x396ed6){return db[_0x2c90('0x42')][_0x2c90('0x64')]({'where':{'id':_0xe5428f[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x3d7789,null))['then'](function(_0x29aa3d){if(_0x29aa3d){return _0x29aa3d[_0x2c90('0x86')](null);}return null;})[_0x2c90('0x22')](respondWithStatusCode(_0x3d7789,null))[_0x2c90('0x2b')](handleError(_0x3d7789,null));};exports[_0x2c90('0x87')]=function(_0x178656,_0xb2fddc,_0x3fab07){return db['MailAccount']['findOne']({'where':{'id':_0x178656['params']['id']}})['then'](handleEntityNotFound(_0xb2fddc,null))['then'](function(_0x535b41){if(_0x535b41){return _0x535b41[_0x2c90('0x87')]();}return null;})['then'](respondWithResult(_0xb2fddc,null))[_0x2c90('0x2b')](handleError(_0xb2fddc,null));};exports[_0x2c90('0x88')]=function(_0x418c06,_0x390d4,_0x282342){if(_0x418c06[_0x2c90('0x5e')]['id']){delete _0x418c06['body']['id'];}return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0x418c06['params']['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x390d4,null))[_0x2c90('0x22')](function(_0x2cedae){if(_0x2cedae){_0x418c06[_0x2c90('0x5e')]['MailAccountId']=_0x2cedae['id'];return db[_0x2c90('0x59')][_0x2c90('0x62')](_0x418c06[_0x2c90('0x5e')]);}})[_0x2c90('0x22')](respondWithResult(_0x390d4,null))['catch'](handleError(_0x390d4,null));};exports['removeSmtp']=function(_0x34e713,_0xad0438,_0x5e1100){return db[_0x2c90('0x42')][_0x2c90('0x64')]({'where':{'id':_0x34e713[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0xad0438,null))[_0x2c90('0x22')](function(_0x3c56ec){if(_0x3c56ec){return _0x3c56ec[_0x2c90('0x89')](null);}return null;})[_0x2c90('0x22')](respondWithStatusCode(_0xad0438,null))['catch'](handleError(_0xad0438,null));};exports[_0x2c90('0x8a')]=function(_0xdb77b6,_0x27bc2d,_0x2bf742){return db['MailInteraction'][_0x2c90('0x5d')]({'where':{'id':_0xdb77b6[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x27bc2d,null))[_0x2c90('0x22')](function(_0x456b24){if(_0x456b24){return _0x456b24[_0x2c90('0x8a')](_0xdb77b6[_0x2c90('0x5e')][_0x2c90('0x6f')],_[_0x2c90('0x8b')](_0xdb77b6[_0x2c90('0x5e')],[_0x2c90('0x6f'),'id'])||{});}})[_0x2c90('0x22')](respondWithResult(_0x27bc2d,null))[_0x2c90('0x2b')](handleError(_0x27bc2d,null));};exports[_0x2c90('0x8c')]=function(_0x1c8694,_0x124dec,_0x4a3a2c){var _0x1a2754={'raw':![],'where':{}};var _0x154dcb={};var _0x127b80={'count':0x0,'rows':[]};return db['MailAccount'][_0x2c90('0x64')]({'where':{'id':_0x1c8694['params']['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x124dec,null))['then'](function(_0x923475){if(_0x923475){_0x154dcb[_0x2c90('0x46')]=_[_0x2c90('0x48')](db['MailInteraction'][_0x2c90('0x5b')]);_0x154dcb[_0x2c90('0x47')]=_[_0x2c90('0x48')](_0x1c8694[_0x2c90('0x47')]);_0x154dcb[_0x2c90('0x49')]=_[_0x2c90('0x4b')](_0x154dcb[_0x2c90('0x46')],_0x154dcb[_0x2c90('0x47')]);_0x1a2754[_0x2c90('0x4a')]=_[_0x2c90('0x4b')](_0x154dcb['model'],qs[_0x2c90('0x4c')](_0x1c8694['query'][_0x2c90('0x4c')]));_0x1a2754[_0x2c90('0x4a')]=_0x1a2754[_0x2c90('0x4a')][_0x2c90('0x4d')]?_0x1a2754[_0x2c90('0x4a')]:_0x154dcb[_0x2c90('0x46')];if(!_0x1c8694['query'][_0x2c90('0x65')](_0x2c90('0x4e'))){_0x1a2754[_0x2c90('0x30')]=qs[_0x2c90('0x30')](_0x1c8694[_0x2c90('0x47')][_0x2c90('0x30')]);_0x1a2754['offset']=qs['offset'](_0x1c8694['query']['offset']);}_0x1a2754[_0x2c90('0x66')]=qs[_0x2c90('0x4f')](_0x1c8694[_0x2c90('0x47')][_0x2c90('0x4f')]);_0x1a2754['where']=qs[_0x2c90('0x49')](_[_0x2c90('0x6d')](_0x1c8694[_0x2c90('0x47')],_0x154dcb['filters']));_0x1a2754[_0x2c90('0x50')][_0x2c90('0x67')]=_0x923475['id'];if(_0x1c8694[_0x2c90('0x47')]['filter']){_0x1a2754['where']=_[_0x2c90('0x51')](_0x1a2754[_0x2c90('0x50')],{'$or':_['map'](_0x1a2754['attributes'],function(_0xcde4df){var _0x4b7a4a={};_0x4b7a4a[_0xcde4df]={'$like':'%'+_0x1c8694[_0x2c90('0x47')][_0x2c90('0x68')]+'%'};return _0x4b7a4a;})});}_0x1a2754=_[_0x2c90('0x51')]({},_0x1a2754,_0x1c8694[_0x2c90('0x5c')]);return db[_0x2c90('0x8d')]['count']({'where':_0x1a2754[_0x2c90('0x50')]})[_0x2c90('0x22')](function(_0x16c850){_0x127b80['count']=_0x16c850;if(_0x1c8694[_0x2c90('0x47')][_0x2c90('0x53')]){_0x1a2754[_0x2c90('0x54')]=[{'model':db[_0x2c90('0x8e')],'as':_0x2c90('0x8f'),'required':![]},{'model':db[_0x2c90('0x90')],'as':_0x2c90('0x91'),'attributes':[_0x2c90('0x3a'),_0x2c90('0x92'),_0x2c90('0x93')],'required':![]},{'model':db[_0x2c90('0x94')],'as':_0x2c90('0x95'),'attributes':['id',_0x2c90('0x3a'),'color'],'where':_0x1c8694['query'][_0x2c90('0x96')]?{'id':_0x1c8694[_0x2c90('0x47')]['tag']}:undefined,'required':_0x1c8694[_0x2c90('0x47')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x2c90('0x55')](_0x1a2754);})[_0x2c90('0x22')](function(_0xfb59a2){_0x127b80[_0x2c90('0x56')]=_0xfb59a2;return _0x127b80;});}})[_0x2c90('0x22')](respondWithFilteredResult(_0x124dec,_0x1a2754))[_0x2c90('0x2b')](handleError(_0x124dec,null));};exports[_0x2c90('0x97')]=function addApplications(_0x1ead27,_0x5c4ce8){var _0xbb62ed=_0x1ead27[_0x2c90('0x58')]['id'];var _0x48d60c=_0x1ead27[_0x2c90('0x5e')];var _0x3df253=0xc8;var _0x277330=null;return db[_0x2c90('0x98')][_0x2c90('0x99')]({'isolationLevel':db['sequelize']['Transaction'][_0x2c90('0x9a')][_0x2c90('0x9b')]},function(_0x2c898e){return db['MailAccount'][_0x2c90('0x64')]({'where':{'id':_0xbb62ed},'transaction':_0x2c898e})[_0x2c90('0x22')](function(_0x3170a5){if(_0x3170a5){return db[_0x2c90('0x9c')][_0x2c90('0x36')]({'where':{'MailAccountId':_0xbb62ed},'transaction':_0x2c898e})['then'](function(){var _0x4a3fb5=_[_0x2c90('0x41')](_0x48d60c,function(_0x3d01e5){_0x3d01e5[_0x2c90('0x67')]=_0xbb62ed;return _0x3d01e5;});return db[_0x2c90('0x9c')][_0x2c90('0x9d')](_0x4a3fb5,{'transaction':_0x2c898e});});}else{_0x3df253=0x194;_0x277330=[];}});})['then'](function(){if(_0x3df253!==0x194){return db[_0x2c90('0x9c')]['findAndCountAll']({'where':{'MailAccountId':_0xbb62ed},'order':_0x2c90('0x9e')})['then'](function(_0x54697a){_0x277330=_0x54697a;});}})[_0x2c90('0x2b')](function(_0x529762){_0x3df253=0x1f4;logger[_0x2c90('0x26')](_0x529762[_0x2c90('0x9f')]);if(_0x529762[_0x2c90('0x3a')]){delete _0x529762['name'];}_0x277330=_0x529762;})[_0x2c90('0xa0')](function(){if(_0x277330===null){_0x5c4ce8[_0x2c90('0x2c')](_0x3df253);}else{if(_0x3df253===0x1f4){_0x5c4ce8[_0x2c90('0x2d')](_0x3df253)[_0x2c90('0x3b')](_0x277330);}else{_0x5c4ce8[_0x2c90('0x2d')](_0x3df253)[_0x2c90('0x2e')](_0x277330);}}});};exports['getApplications']=function(_0xf184a6,_0x39b0ec,_0xee62c1){var _0x1a2d8a={};var _0x1c5209={};var _0x423606;var _0x2c8278;return db[_0x2c90('0x42')][_0x2c90('0x64')]({'where':{'id':_0xf184a6[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x39b0ec,null))['then'](function(_0x307e05){if(_0x307e05){_0x423606=_0x307e05;_0x1c5209[_0x2c90('0x46')]=_[_0x2c90('0x48')](db[_0x2c90('0x9c')][_0x2c90('0x5b')]);_0x1c5209[_0x2c90('0x47')]=_[_0x2c90('0x48')](_0xf184a6[_0x2c90('0x47')]);_0x1c5209[_0x2c90('0x49')]=_[_0x2c90('0x4b')](_0x1c5209[_0x2c90('0x46')],_0x1c5209[_0x2c90('0x47')]);_0x1a2d8a[_0x2c90('0x4a')]=_[_0x2c90('0x4b')](_0x1c5209[_0x2c90('0x46')],qs['fields'](_0xf184a6['query'][_0x2c90('0x4c')]));_0x1a2d8a[_0x2c90('0x4a')]=_0x1a2d8a[_0x2c90('0x4a')][_0x2c90('0x4d')]?_0x1a2d8a[_0x2c90('0x4a')]:_0x1c5209[_0x2c90('0x46')];_0x1a2d8a[_0x2c90('0x66')]=qs[_0x2c90('0x4f')](_0xf184a6[_0x2c90('0x47')]['sort']);_0x1a2d8a['where']=qs[_0x2c90('0x49')](_['pick'](_0xf184a6['query'],_0x1c5209[_0x2c90('0x49')]));if(_0xf184a6[_0x2c90('0x47')][_0x2c90('0x68')]){_0x1a2d8a[_0x2c90('0x50')]=_['merge'](_0x1a2d8a[_0x2c90('0x50')],{'$or':_[_0x2c90('0x41')](_0x1a2d8a[_0x2c90('0x4a')],function(_0x4a6b0a){var _0x127121={};_0x127121[_0x4a6b0a]={'$like':'%'+_0xf184a6[_0x2c90('0x47')]['filter']+'%'};return _0x127121;})});}_0x1a2d8a=_[_0x2c90('0x51')]({},_0x1a2d8a,_0xf184a6['options']);return _0x423606[_0x2c90('0xa1')](_0x1a2d8a);}})[_0x2c90('0x22')](function(_0x2f7ebc){if(_0x2f7ebc){_0x2c8278=_0x2f7ebc[_0x2c90('0x4d')];if(!_0xf184a6[_0x2c90('0x47')][_0x2c90('0x65')](_0x2c90('0x4e'))){_0x1a2d8a[_0x2c90('0x30')]=qs[_0x2c90('0x30')](_0xf184a6['query']['limit']);_0x1a2d8a[_0x2c90('0x2f')]=qs[_0x2c90('0x2f')](_0xf184a6[_0x2c90('0x47')]['offset']);}return _0x423606[_0x2c90('0xa1')](_0x1a2d8a);}})[_0x2c90('0x22')](function(_0x327d07){if(_0x327d07){return _0x327d07?{'count':_0x2c8278,'rows':_0x327d07}:null;}})[_0x2c90('0x22')](respondWithResult(_0x39b0ec,null))[_0x2c90('0x2b')](handleError(_0x39b0ec,null));};exports[_0x2c90('0xa2')]=function(_0x1f813b,_0x1d5786,_0x4a94c4){var _0x483476={'raw':!![],'where':{}};var _0x10b1b7={};var _0x2bcbbc={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1f813b[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x1d5786,null))[_0x2c90('0x22')](function(_0x58ea37){if(_0x58ea37){_0x10b1b7['model']=_['keys'](db[_0x2c90('0xa3')][_0x2c90('0x5b')]);_0x10b1b7[_0x2c90('0x47')]=_[_0x2c90('0x48')](_0x1f813b[_0x2c90('0x47')]);_0x10b1b7[_0x2c90('0x49')]=_[_0x2c90('0x4b')](_0x10b1b7['model'],_0x10b1b7[_0x2c90('0x47')]);_0x483476[_0x2c90('0x4a')]=_[_0x2c90('0x4b')](_0x10b1b7[_0x2c90('0x46')],qs['fields'](_0x1f813b[_0x2c90('0x47')][_0x2c90('0x4c')]));_0x483476[_0x2c90('0x4a')]=_0x483476['attributes'][_0x2c90('0x4d')]?_0x483476[_0x2c90('0x4a')]:_0x10b1b7[_0x2c90('0x46')];if(!_0x1f813b[_0x2c90('0x47')][_0x2c90('0x65')](_0x2c90('0x4e'))){_0x483476[_0x2c90('0x30')]=qs[_0x2c90('0x30')](_0x1f813b[_0x2c90('0x47')]['limit']);_0x483476[_0x2c90('0x2f')]=qs[_0x2c90('0x2f')](_0x1f813b[_0x2c90('0x47')][_0x2c90('0x2f')]);}_0x483476[_0x2c90('0x66')]=qs['sort'](_0x1f813b['query'][_0x2c90('0x4f')]);_0x483476[_0x2c90('0x50')]=qs[_0x2c90('0x49')](_[_0x2c90('0x6d')](_0x1f813b[_0x2c90('0x47')],_0x10b1b7[_0x2c90('0x49')]));_0x483476[_0x2c90('0x50')][_0x2c90('0x67')]=_0x58ea37['id'];if(_0x1f813b[_0x2c90('0x47')][_0x2c90('0x68')]){_0x483476[_0x2c90('0x50')]=_['merge'](_0x483476['where'],{'$or':_[_0x2c90('0x41')](_0x483476['attributes'],function(_0x366515){var _0x63712c={};_0x63712c[_0x366515]={'$like':'%'+_0x1f813b['query'][_0x2c90('0x68')]+'%'};return _0x63712c;})});}if(_0x1f813b['query']['$gte']){var _0x25a774=_0x1f813b[_0x2c90('0x47')][_0x2c90('0xa4')][_0x2c90('0xa5')](',');var _0xfe21ed={};_0xfe21ed[_0x25a774[0x0]]={'$gte':moment(_0x25a774[0x1])[_0x2c90('0xa6')](_0x2c90('0xa7'))};_0x483476[_0x2c90('0x50')]=_[_0x2c90('0x51')](_0x483476[_0x2c90('0x50')],_0xfe21ed);}_0x483476=_[_0x2c90('0x51')]({},_0x483476,_0x1f813b[_0x2c90('0x5c')]);return db[_0x2c90('0xa3')]['count']({'where':_0x483476['where']})['then'](function(_0x191c39){_0x2bcbbc[_0x2c90('0x32')]=_0x191c39;if(_0x1f813b[_0x2c90('0x47')][_0x2c90('0x53')]){_0x483476[_0x2c90('0x54')]=[{'all':!![]}];}return db[_0x2c90('0xa3')][_0x2c90('0x55')](_0x483476);})[_0x2c90('0x22')](function(_0x360334){if(_0x1f813b[_0x2c90('0x47')][_0x2c90('0xa8')]===_0x2c90('0xa9')){for(var _0x428225=0x0;_0x428225<_0x360334[_0x2c90('0x4d')];_0x428225++){_0x360334[_0x428225]['body']=juice(_0x360334[_0x428225][_0x2c90('0x5e')]);}}_0x2bcbbc['rows']=_0x360334;return _0x2bcbbc;});}})[_0x2c90('0x22')](respondWithFilteredResult(_0x1d5786,_0x483476))[_0x2c90('0x2b')](handleError(_0x1d5786,null));};exports[_0x2c90('0x3b')]=function(_0x3b79dd,_0x3a2e93,_0x9bd907){var _0xaf8b83,_0x3ebe77={},_0x2e96e0;if(_0x3b79dd[_0x2c90('0x5e')]['to']){_0x2e96e0=_0x3b79dd[_0x2c90('0x5e')]['to']['split'](',')[0x0];}return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0x3b79dd[_0x2c90('0x58')]['id']},'include':[{'model':db[_0x2c90('0xaa')],'as':_0x2c90('0xab'),'include':[{'model':db[_0x2c90('0x8e')],'as':_0x2c90('0xac'),'where':{'email':_0x2e96e0},'limit':0x1,'order':[[_0x2c90('0xad'),_0x2c90('0xae')]]}]},{'model':db[_0x2c90('0x59')],'as':_0x2c90('0x5a'),'raw':!![]}]})[_0x2c90('0x22')](handleEntityNotFound(_0x3a2e93,null))[_0x2c90('0x22')](function(_0x870af5){if(_0x870af5){_0xaf8b83=_0x870af5;if(_0x870af5[_0x2c90('0x5a')]){if(_[_0x2c90('0x72')](_0x3b79dd[_0x2c90('0x5e')][_0x2c90('0xaf')])){_0x3b79dd['body'][_0x2c90('0xaf')]=util[_0x2c90('0xa6')](_0x2c90('0xb0'),_0x870af5[_0x2c90('0x3a')],_0x870af5[_0x2c90('0x70')]||_0x870af5[_0x2c90('0x5a')]['user']);}if(_0x3b79dd['body'][_0x2c90('0xb1')]&&_0x3b79dd[_0x2c90('0x5e')]['attachments'][_0x2c90('0x4d')]){for(var _0x299632=0x0;_0x299632<_0x3b79dd[_0x2c90('0x5e')][_0x2c90('0xb1')][_0x2c90('0x4d')];_0x299632+=0x1){_0x3b79dd[_0x2c90('0x5e')][_0x2c90('0xb1')][_0x299632]={'filename':_0x3b79dd[_0x2c90('0x5e')][_0x2c90('0xb1')][_0x299632][_0x2c90('0x3a')],'path':path['join'](config[_0x2c90('0xb2')],'server/files/attachments',_0x3b79dd[_0x2c90('0x5e')]['attachments'][_0x299632][_0x2c90('0xb3')])};}}var _0x58d2aa={'tls':{'rejectUnauthorized':![]}};if(_[_0x2c90('0x72')](_0x870af5['Smtp']['service'])){if(_0x870af5[_0x2c90('0x5a')][_0x2c90('0x79')]){_0x58d2aa['auth']={'user':_0x870af5[_0x2c90('0x5a')][_0x2c90('0x75')],'pass':_0x870af5[_0x2c90('0x5a')][_0x2c90('0x77')]};}_0x58d2aa['host']=_0x870af5[_0x2c90('0x5a')][_0x2c90('0x7a')];_0x58d2aa['port']=_0x870af5[_0x2c90('0x5a')][_0x2c90('0x7b')];_0x58d2aa[_0x2c90('0xb4')]=_0x870af5[_0x2c90('0x5a')][_0x2c90('0xb4')];}else{_0x58d2aa[_0x2c90('0x7c')]=_0x870af5['Smtp'][_0x2c90('0x7c')];_0x58d2aa['auth']={'user':_0x870af5[_0x2c90('0x5a')][_0x2c90('0x75')],'pass':_0x870af5[_0x2c90('0x5a')][_0x2c90('0x77')]};}return respondWithRpcPromise(_0x2c90('0xb5'),_0x2c90('0xb6'),{'account':_0x58d2aa,'message':_0x3b79dd[_0x2c90('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x34f666){if(_0x34f666){_0x3ebe77=_0x34f666;if(_0xaf8b83['List']){if(_0xaf8b83['List'][_0x2c90('0xac')]['length']){return _0xaf8b83[_0x2c90('0xab')][_0x2c90('0xac')][0x0];}else{return db['CmContact'][_0x2c90('0x62')](_[_0x2c90('0xb7')](_0x3b79dd['body'],{'firstName':_0x3b79dd[_0x2c90('0x5e')]['to'],'email':_0x3b79dd[_0x2c90('0x5e')]['to'],'phone':_0x3b79dd['body']['to'],'ListId':_0xaf8b83[_0x2c90('0x71')]}));}}else{throw new Error(_0x2c90('0xb8'));}}})[_0x2c90('0x22')](function(_0x696bf0){if(_0x696bf0){var _0x409ad2={'UserId':_0x3b79dd[_0x2c90('0x75')]['id'],'ContactId':_0x696bf0['id'],'MailAccountId':_0xaf8b83['id'],'inReplyTo':_0x3ebe77[_0x2c90('0xb9')],'to':_0x3b79dd[_0x2c90('0x5e')][_0x2c90('0xaf')],'cc':_0x3b79dd[_0x2c90('0x5e')]['cc'],'subject':_0x3b79dd[_0x2c90('0x5e')]['subject'],'attach':_0x3b79dd[_0x2c90('0x5e')][_0x2c90('0xba')],'firstMsgDirection':_0x2c90('0xbb'),'lastMsgAt':moment()[_0x2c90('0xa6')](_0x2c90('0xa7')),'lastMsgDirection':_0x2c90('0xbb'),'Messages':[_[_0x2c90('0x51')](_0x3b79dd[_0x2c90('0x5e')],{'messageId':_0x3ebe77[_0x2c90('0xb9')],'sentAt':moment()[_0x2c90('0xa6')](_0x2c90('0xa7')),'read':!![],'MailAccountId':_0xaf8b83['id'],'UserId':_0x3b79dd[_0x2c90('0x75')]['id'],'ContactId':_0x696bf0['id']})]};if(_0x3b79dd[_0x2c90('0x5e')]['Interaction']){_0x409ad2=_[_0x2c90('0x51')](_0x409ad2,_0x3b79dd[_0x2c90('0x5e')][_0x2c90('0xbc')]);}return db[_0x2c90('0x8d')]['create'](_0x409ad2,{'include':[{'model':db[_0x2c90('0xa3')],'as':_0x2c90('0xbd')}]});}})[_0x2c90('0x22')](respondWithResult(_0x3a2e93,null))[_0x2c90('0x2b')](handleError(_0x3a2e93,null));};exports[_0x2c90('0xbe')]=function(_0xa5a700,_0x3510a1,_0x591467){return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0xa5a700[_0x2c90('0x58')]['id']},'include':[{'model':db[_0x2c90('0x59')],'as':_0x2c90('0x5a'),'raw':!![]}]})[_0x2c90('0x22')](handleEntityNotFound(_0x3510a1,null))[_0x2c90('0x22')](function(_0x3c0359){if(_0x3c0359&&_0x3c0359[_0x2c90('0x5a')]){var _0x54f2dd={'id':_0x3c0359['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3c0359[_0x2c90('0x5a')][_0x2c90('0x7c')]){_0x54f2dd['service']=_0x3c0359['Smtp'][_0x2c90('0x7c')];}else{_0x54f2dd[_0x2c90('0x7a')]=_0x3c0359[_0x2c90('0x5a')][_0x2c90('0x7a')];_0x54f2dd[_0x2c90('0x7b')]=_0x3c0359[_0x2c90('0x5a')][_0x2c90('0x7b')];_0x54f2dd[_0x2c90('0xb4')]=_0x3c0359[_0x2c90('0x5a')]['secure'];}if(_0x3c0359[_0x2c90('0x5a')][_0x2c90('0x79')]){_0x54f2dd[_0x2c90('0xbf')]={'user':_0x3c0359['Smtp'][_0x2c90('0x75')],'pass':_0x3c0359['Smtp'][_0x2c90('0x77')]};}return respondWithRpcPromise(_0x2c90('0xc0'),'verifySmtp',{'account':_0x54f2dd});}})[_0x2c90('0x22')](respondWithResult(_0x3510a1,null))[_0x2c90('0x2b')](handleError(_0x3510a1,null));};exports['destroy']=function(_0x4ddf15,_0x2a6c3b){return db[_0x2c90('0x42')]['find']({'where':{'id':_0x4ddf15[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x2a6c3b,null))[_0x2c90('0x22')](function(_0x1beee8){if(_0x1beee8&&_0x1beee8['service']){throw new db['Sequelize']['ValidationError'](_0x2c90('0xc1'));}return _0x1beee8;})[_0x2c90('0x22')](removeEntity(_0x2a6c3b,null))[_0x2c90('0x2b')](handleError(_0x2a6c3b,null));};exports[_0x2c90('0xc2')]=function(_0x2bf1be,_0x5c35d6,_0x24e0b0){return db[_0x2c90('0x42')]['find']({'where':{'id':_0x2bf1be[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x5c35d6,null))[_0x2c90('0x22')](function(_0x154ee1){if(_0x154ee1){return _0x154ee1[_0x2c90('0xc2')](_0x2bf1be[_0x2c90('0x5e')]['ids'],_[_0x2c90('0x8b')](_0x2bf1be[_0x2c90('0x5e')],[_0x2c90('0x6f'),'id'])||{})[_0x2c90('0xc3')](function(_0x1e9209){for(var _0x42e1f4=0x0;_0x42e1f4<_0x2bf1be[_0x2c90('0x5e')][_0x2c90('0x6f')][_0x2c90('0x4d')];_0x42e1f4+=0x1){socket[_0x2c90('0xc4')](_0x2c90('0xc5'),{'UserId':Number(_0x2bf1be[_0x2c90('0x5e')][_0x2c90('0x6f')][_0x42e1f4]),'MailAccountId':Number(_0x2bf1be[_0x2c90('0x58')]['id'])});}return _0x1e9209;});}})[_0x2c90('0x22')](respondWithResult(_0x5c35d6,null))['catch'](handleError(_0x5c35d6,null));};exports[_0x2c90('0xc6')]=function(_0x1cddce,_0x162d13,_0xbb2b6){return db[_0x2c90('0x42')][_0x2c90('0x5d')]({'where':{'id':_0x1cddce[_0x2c90('0x58')]['id']}})[_0x2c90('0x22')](handleEntityNotFound(_0x162d13,null))[_0x2c90('0x22')](function(_0x15d9e7){if(_0x15d9e7){return _0x15d9e7['removeAgents'](_0x1cddce[_0x2c90('0x47')]['ids'])['then'](function(){if(_[_0x2c90('0xc7')](_0x1cddce[_0x2c90('0x47')][_0x2c90('0x6f')])){for(var _0x2edcb9=0x0;_0x2edcb9<_0x1cddce['query']['ids'][_0x2c90('0x4d')];_0x2edcb9+=0x1){socket[_0x2c90('0xc4')](_0x2c90('0xc8'),{'UserId':Number(_0x1cddce[_0x2c90('0x47')][_0x2c90('0x6f')][_0x2edcb9]),'MailAccountId':Number(_0x1cddce[_0x2c90('0x58')]['id'])});}}else{socket[_0x2c90('0xc4')]('userMailAccount:remove',{'UserId':Number(_0x1cddce[_0x2c90('0x47')][_0x2c90('0x6f')]),'MailAccountId':Number(_0x1cddce[_0x2c90('0x58')]['id'])});}});}})[_0x2c90('0x22')](respondWithStatusCode(_0x162d13,null))[_0x2c90('0x2b')](handleError(_0x162d13,null));};exports['getAgents']=function(_0x190c2a,_0x3e45be,_0x8e048d){var _0x164f4b={};var _0x2c4aba={};var _0x873bd5;var _0x2b4343;return db[_0x2c90('0x42')]['findOne']({'where':{'id':_0x190c2a['params']['id']}})['then'](handleEntityNotFound(_0x3e45be,null))[_0x2c90('0x22')](function(_0x22b815){if(_0x22b815){_0x873bd5=_0x22b815;_0x2c4aba[_0x2c90('0x46')]=_[_0x2c90('0x48')](db[_0x2c90('0x90')][_0x2c90('0x5b')]);_0x2c4aba[_0x2c90('0x47')]=_[_0x2c90('0x48')](_0x190c2a[_0x2c90('0x47')]);_0x2c4aba['filters']=_[_0x2c90('0x4b')](_0x2c4aba[_0x2c90('0x46')],_0x2c4aba[_0x2c90('0x47')]);_0x164f4b[_0x2c90('0x4a')]=_[_0x2c90('0x4b')](_0x2c4aba[_0x2c90('0x46')],qs['fields'](_0x190c2a['query'][_0x2c90('0x4c')]));_0x164f4b['attributes']=_0x164f4b[_0x2c90('0x4a')][_0x2c90('0x4d')]?_0x164f4b['attributes']:_0x2c4aba[_0x2c90('0x46')];_0x164f4b['order']=qs[_0x2c90('0x4f')](_0x190c2a[_0x2c90('0x47')][_0x2c90('0x4f')]);_0x164f4b['where']=qs['filters'](_['pick'](_0x190c2a[_0x2c90('0x47')],_0x2c4aba[_0x2c90('0x49')]));if(_0x190c2a[_0x2c90('0x47')][_0x2c90('0x68')]){_0x164f4b[_0x2c90('0x50')]=_['merge'](_0x164f4b['where'],{'$or':_[_0x2c90('0x41')](_0x164f4b[_0x2c90('0x4a')],function(_0x1db916){var _0x1991f9={};_0x1991f9[_0x1db916]={'$like':'%'+_0x190c2a['query'][_0x2c90('0x68')]+'%'};return _0x1991f9;})});}_0x164f4b=_[_0x2c90('0x51')]({},_0x164f4b,_0x190c2a['options']);return _0x873bd5['getAgents'](_0x164f4b);}})['then'](function(_0x13f132){if(_0x13f132){_0x2b4343=_0x13f132[_0x2c90('0x4d')];if(!_0x190c2a['query'][_0x2c90('0x65')]('nolimit')){_0x164f4b['limit']=qs[_0x2c90('0x30')](_0x190c2a[_0x2c90('0x47')][_0x2c90('0x30')]);_0x164f4b[_0x2c90('0x2f')]=qs['offset'](_0x190c2a['query']['offset']);}return _0x873bd5['getAgents'](_0x164f4b);}})[_0x2c90('0x22')](function(_0x545ff9){if(_0x545ff9){return _0x545ff9?{'count':_0x2b4343,'rows':_0x545ff9}:null;}})[_0x2c90('0x22')](respondWithResult(_0x3e45be,null))[_0x2c90('0x2b')](handleError(_0x3e45be,null));}; \ No newline at end of file +var _0xb346=['addAgents','removeAgents','isArray','userMailAccount:remove','emit','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','juice','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','offset','undefined','count','limit','status','set','json','apply','save','update','MailAccounts','UserProfileResource','destroy','end','name','index','Imap','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','MailServerIn','Smtp','keys','rawAttributes','intersection','include','find','body','MailServerOut','describe','addDisposition','findOne','MailAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cuser','password','pass','cpassword','authentication','host','port','service','cservice','user','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','send','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account'];(function(_0x5cfb92,_0x5797e6){var _0x1cd7c2=function(_0x1bb452){while(--_0x1bb452){_0x5cfb92['push'](_0x5cfb92['shift']());}};_0x1cd7c2(++_0x5797e6);}(_0xb346,0xcb));var _0x6b34=function(_0x25b542,_0x10bfad){_0x25b542=_0x25b542-0x0;var _0x311d66=_0xb346[_0x25b542];return _0x311d66;};'use strict';var emlformat=require(_0x6b34('0x0'));var rimraf=require(_0x6b34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b34('0x2'));var rp=require(_0x6b34('0x3'));var moment=require(_0x6b34('0x4'));var BPromise=require(_0x6b34('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6b34('0x6'));var crypto=require(_0x6b34('0x7'));var jsforce=require(_0x6b34('0x8'));var deskjs=require(_0x6b34('0x9'));var toCsv=require(_0x6b34('0xa'));var querystring=require(_0x6b34('0xb'));var Papa=require(_0x6b34('0xc'));var htmlToText=require(_0x6b34('0xd'));var juice=require(_0x6b34('0xe'));var Redis=require(_0x6b34('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b34('0x10'));var logger=require(_0x6b34('0x11'))(_0x6b34('0x12'));var utils=require(_0x6b34('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b34('0x14'));var db=require(_0x6b34('0x15'))['db'];config[_0x6b34('0x16')]=_[_0x6b34('0x17')](config[_0x6b34('0x16')],{'host':_0x6b34('0x18'),'port':0x18eb});var socket=require(_0x6b34('0x19'))(new Redis(config[_0x6b34('0x16')]));require(_0x6b34('0x1a'))[_0x6b34('0x1b')](socket);var jayson=require(_0x6b34('0x1c'));var client=jayson[_0x6b34('0x1d')]['http']({'port':0x232b});function respondWithRpcPromise(_0x533c67,_0x25b742,_0x2a29b1,_0x4948fd){return new BPromise(function(_0x12fcae,_0x3f7d12){var _0x18183c=_0x4948fd||client;return _0x18183c[_0x6b34('0x1e')](_0x533c67,_0x2a29b1)[_0x6b34('0x1f')](function(_0x45ea3d){logger[_0x6b34('0x20')]('MailAccount,\x20%s,\x20%s',_0x25b742,_0x6b34('0x21'));logger[_0x6b34('0x22')](_0x6b34('0x23'),_0x25b742,_0x6b34('0x21'),JSON[_0x6b34('0x24')](_0x45ea3d));if(_0x45ea3d[_0x6b34('0x25')]){if(_0x45ea3d[_0x6b34('0x25')][_0x6b34('0x26')]===0x1f4){logger['error'](_0x6b34('0x27'),_0x25b742,_0x45ea3d[_0x6b34('0x25')][_0x6b34('0x28')]);return _0x3f7d12(_0x45ea3d[_0x6b34('0x25')][_0x6b34('0x28')]);}logger['error'](_0x6b34('0x27'),_0x25b742,_0x45ea3d['error']['message']);return _0x12fcae(_0x45ea3d[_0x6b34('0x25')][_0x6b34('0x28')]);}else{logger[_0x6b34('0x20')](_0x6b34('0x27'),_0x25b742,_0x6b34('0x21'));_0x12fcae(_0x45ea3d[_0x6b34('0x29')]['message']);}})['catch'](function(_0x355321){logger[_0x6b34('0x25')]('MailAccount,\x20%s,\x20%s',_0x25b742,_0x355321);_0x3f7d12(_0x355321);});});}function respondWithStatusCode(_0x2f976a,_0x3529f7){_0x3529f7=_0x3529f7||0xcc;return function(_0x227e93){if(_0x227e93){return _0x2f976a[_0x6b34('0x2a')](_0x3529f7);}return _0x2f976a['status'](_0x3529f7)['end']();};}function respondWithResult(_0x34b023,_0x3dadee){_0x3dadee=_0x3dadee||0xc8;return function(_0x2f789b){if(_0x2f789b){return _0x34b023['status'](_0x3dadee)['json'](_0x2f789b);}};}function respondWithFilteredResult(_0x25ce0a,_0x2a51ae){return function(_0x12d92f){if(_0x12d92f){var _0x1547e2=typeof _0x2a51ae[_0x6b34('0x2b')]===_0x6b34('0x2c')&&typeof _0x2a51ae['limit']===_0x6b34('0x2c');var _0x4a3e3f=_0x12d92f[_0x6b34('0x2d')];var _0x1ade98=_0x1547e2?0x0:_0x2a51ae[_0x6b34('0x2b')];var _0x1d55ce=_0x1547e2?_0x12d92f[_0x6b34('0x2d')]:_0x2a51ae[_0x6b34('0x2b')]+_0x2a51ae[_0x6b34('0x2e')];var _0x34839d;if(_0x1d55ce>=_0x4a3e3f){_0x1d55ce=_0x4a3e3f;_0x34839d=0xc8;}else{_0x34839d=0xce;}_0x25ce0a[_0x6b34('0x2f')](_0x34839d);return _0x25ce0a[_0x6b34('0x30')]('Content-Range',_0x1ade98+'-'+_0x1d55ce+'/'+_0x4a3e3f)[_0x6b34('0x31')](_0x12d92f);}return null;};}function patchUpdates(_0x373bdd){return function(_0x35c9c6){try{jsonpatch[_0x6b34('0x32')](_0x35c9c6,_0x373bdd,!![]);}catch(_0x575764){return BPromise['reject'](_0x575764);}return _0x35c9c6[_0x6b34('0x33')]();};}function saveUpdates(_0x44b1c7,_0x3f0e8d){return function(_0x153bde){if(_0x153bde){return _0x153bde[_0x6b34('0x34')](_0x44b1c7)[_0x6b34('0x1f')](function(_0xb89ef6){return _0xb89ef6;});}return null;};}function removeEntity(_0x11093f,_0x2324b8){return function(_0x2e2750){if(_0x2e2750){return _0x2e2750['destroy']()[_0x6b34('0x1f')](function(){var _0x46bc8a=_0x2e2750['get']({'plain':!![]});var _0xc12713=_0x6b34('0x35');return db[_0x6b34('0x36')][_0x6b34('0x37')]({'where':{'type':_0xc12713,'resourceId':_0x46bc8a['id']}})[_0x6b34('0x1f')](function(){return _0x2e2750;});})[_0x6b34('0x1f')](function(){_0x11093f[_0x6b34('0x2f')](0xcc)[_0x6b34('0x38')]();});}};}function handleEntityNotFound(_0x25e402,_0x46db78){return function(_0x45f7b8){if(!_0x45f7b8){_0x25e402[_0x6b34('0x2a')](0x194);}return _0x45f7b8;};}function handleError(_0x26350c,_0x472c78){_0x472c78=_0x472c78||0x1f4;return function(_0x1fcb80){logger[_0x6b34('0x25')](_0x1fcb80['stack']);if(_0x1fcb80[_0x6b34('0x39')]){delete _0x1fcb80[_0x6b34('0x39')];}_0x26350c[_0x6b34('0x2f')](_0x472c78)['send'](_0x1fcb80);};}exports[_0x6b34('0x3a')]=function(_0x5c3ddc,_0x274b1f){var _0x55f56f={'include':[{'model':db['MailServerIn'],'as':_0x6b34('0x3b')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x6b34('0x3c')],'as':_0x6b34('0x3d')}]},_0x297f38={},_0x20322b={'count':0x0,'rows':[]};var _0x4d33ac=_[_0x6b34('0x3e')](db[_0x6b34('0x3f')]['rawAttributes'],function(_0x538e03){return{'name':_0x538e03[_0x6b34('0x40')],'type':_0x538e03[_0x6b34('0x41')][_0x6b34('0x42')]};});_0x297f38['model']=_[_0x6b34('0x3e')](_0x4d33ac,_0x6b34('0x39'));_0x297f38[_0x6b34('0x43')]=_['keys'](_0x5c3ddc[_0x6b34('0x43')]);_0x297f38['filters']=_['intersection'](_0x297f38[_0x6b34('0x44')],_0x297f38[_0x6b34('0x43')]);_0x55f56f[_0x6b34('0x45')]=_['intersection'](_0x297f38[_0x6b34('0x44')],qs[_0x6b34('0x46')](_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x46')]));_0x55f56f['attributes']=_0x55f56f[_0x6b34('0x45')][_0x6b34('0x47')]?_0x55f56f[_0x6b34('0x45')]:_0x297f38[_0x6b34('0x44')];if(!_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x48')](_0x6b34('0x49'))){_0x55f56f[_0x6b34('0x2e')]=qs[_0x6b34('0x2e')](_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x2e')]);_0x55f56f[_0x6b34('0x2b')]=qs['offset'](_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x2b')]);}_0x55f56f[_0x6b34('0x4a')]=qs['sort'](_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x4b')]);_0x55f56f[_0x6b34('0x4c')]=qs[_0x6b34('0x4d')](_[_0x6b34('0x4e')](_0x5c3ddc[_0x6b34('0x43')],_0x297f38[_0x6b34('0x4d')]),_0x4d33ac);if(_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x4f')]){_0x55f56f[_0x6b34('0x4c')]=_['merge'](_0x55f56f['where'],{'$or':_[_0x6b34('0x3e')](_0x4d33ac,function(_0x4cd731){if(_0x4cd731[_0x6b34('0x41')]!==_0x6b34('0x50')){var _0x14c3ff={};_0x14c3ff[_0x4cd731[_0x6b34('0x39')]]={'$like':'%'+_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x4f')]+'%'};return _0x14c3ff;}})});}_0x55f56f=_[_0x6b34('0x51')]({},_0x55f56f,_0x5c3ddc[_0x6b34('0x52')]);var _0x9248bb={'where':_0x55f56f['where']};return db[_0x6b34('0x3f')][_0x6b34('0x2d')](_0x9248bb)[_0x6b34('0x1f')](function(_0xff2e80){_0x20322b[_0x6b34('0x2d')]=_0xff2e80;if(_0x5c3ddc[_0x6b34('0x43')][_0x6b34('0x53')]){_0x55f56f['include']=[{'all':!![]}];}return db['MailAccount'][_0x6b34('0x54')](_0x55f56f);})[_0x6b34('0x1f')](function(_0x267f7f){_0x20322b[_0x6b34('0x55')]=_0x267f7f;return _0x20322b;})['then'](respondWithFilteredResult(_0x274b1f,_0x55f56f))[_0x6b34('0x56')](handleError(_0x274b1f,null));};exports['show']=function(_0x7b7e3d,_0xf6feec){var _0x1f69ef={'raw':![],'where':{'id':_0x7b7e3d[_0x6b34('0x57')]['id']},'include':[{'model':db[_0x6b34('0x58')],'as':_0x6b34('0x3b')},{'model':db['MailServerOut'],'as':_0x6b34('0x59')},{'model':db[_0x6b34('0x3c')],'as':'mandatoryDispositionPause'}]},_0x2a7ada={};_0x2a7ada[_0x6b34('0x44')]=_[_0x6b34('0x5a')](db[_0x6b34('0x3f')][_0x6b34('0x5b')]);_0x2a7ada[_0x6b34('0x43')]=_[_0x6b34('0x5a')](_0x7b7e3d[_0x6b34('0x43')]);_0x2a7ada['filters']=_[_0x6b34('0x5c')](_0x2a7ada[_0x6b34('0x44')],_0x2a7ada[_0x6b34('0x43')]);_0x1f69ef['attributes']=_[_0x6b34('0x5c')](_0x2a7ada[_0x6b34('0x44')],qs['fields'](_0x7b7e3d[_0x6b34('0x43')][_0x6b34('0x46')]));_0x1f69ef['attributes']=_0x1f69ef[_0x6b34('0x45')][_0x6b34('0x47')]?_0x1f69ef[_0x6b34('0x45')]:_0x2a7ada[_0x6b34('0x44')];if(_0x7b7e3d['query']['includeAll']){_0x1f69ef[_0x6b34('0x5d')]=[{'all':!![]}];}_0x1f69ef=_['merge']({},_0x1f69ef,_0x7b7e3d[_0x6b34('0x52')]);return db[_0x6b34('0x3f')][_0x6b34('0x5e')](_0x1f69ef)[_0x6b34('0x1f')](handleEntityNotFound(_0xf6feec,null))[_0x6b34('0x1f')](respondWithResult(_0xf6feec,null))[_0x6b34('0x56')](handleError(_0xf6feec,null));};exports[_0x6b34('0x34')]=function(_0x261fdb,_0x8d5a2b){if(_0x261fdb[_0x6b34('0x5f')]['id']){delete _0x261fdb['body']['id'];}return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x261fdb[_0x6b34('0x57')]['id']},'include':[{'model':db[_0x6b34('0x58')],'as':_0x6b34('0x3b')},{'model':db['MailServerOut'],'as':_0x6b34('0x59')},{'model':db[_0x6b34('0x3c')],'as':_0x6b34('0x3d')}]})[_0x6b34('0x1f')](handleEntityNotFound(_0x8d5a2b,null))['then'](saveUpdates(_0x261fdb[_0x6b34('0x5f')],null))[_0x6b34('0x1f')](function(_0x4fb5d7){if(_0x4fb5d7&&_0x261fdb[_0x6b34('0x5f')]['Imap']){return db['MailServerIn'][_0x6b34('0x34')](_0x261fdb[_0x6b34('0x5f')][_0x6b34('0x3b')],{'where':{'MailAccountId':_0x4fb5d7['id']}})[_0x6b34('0x1f')](function(){return _0x4fb5d7;});}return _0x4fb5d7;})['then'](function(_0x1d25cd){if(_0x1d25cd&&_0x261fdb['body'][_0x6b34('0x59')]){return db[_0x6b34('0x60')]['update'](_0x261fdb[_0x6b34('0x5f')][_0x6b34('0x59')],{'where':{'MailAccountId':_0x1d25cd['id']}})[_0x6b34('0x1f')](function(){return _0x1d25cd;});}return _0x1d25cd;})[_0x6b34('0x1f')](respondWithResult(_0x8d5a2b,null))['catch'](handleError(_0x8d5a2b,null));};exports[_0x6b34('0x61')]=function(_0x29babd,_0xb62dc3){return db[_0x6b34('0x3f')][_0x6b34('0x61')]()[_0x6b34('0x1f')](respondWithResult(_0xb62dc3,null))[_0x6b34('0x56')](handleError(_0xb62dc3,null));};exports[_0x6b34('0x62')]=function(_0x57623e,_0xb902ad,_0x47d6ad){if(_0x57623e['body']['id']){delete _0x57623e[_0x6b34('0x5f')]['id'];}return db[_0x6b34('0x3f')]['find']({'where':{'id':_0x57623e[_0x6b34('0x57')]['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0xb902ad,null))[_0x6b34('0x1f')](function(_0x55bbae){if(_0x55bbae){_0x57623e['body']['MailAccountId']=_0x55bbae['id'];return db['Disposition']['create'](_0x57623e[_0x6b34('0x5f')]);}})['then'](respondWithResult(_0xb902ad,null))['catch'](handleError(_0xb902ad,null));};exports['getDispositions']=function(_0x54db24,_0x4f5876,_0x4ee6b7){var _0xfc536={'raw':![],'where':{}};var _0x1a5aec={};var _0x3c490f={'count':0x0,'rows':[]};return db['MailAccount'][_0x6b34('0x63')]({'where':{'id':_0x54db24[_0x6b34('0x57')]['id']}})['then'](handleEntityNotFound(_0x4f5876,null))[_0x6b34('0x1f')](function(_0x1cd3f0){if(_0x1cd3f0){_0x1a5aec[_0x6b34('0x44')]=_[_0x6b34('0x5a')](db['Disposition'][_0x6b34('0x5b')]);_0x1a5aec[_0x6b34('0x43')]=_[_0x6b34('0x5a')](_0x54db24[_0x6b34('0x43')]);_0x1a5aec[_0x6b34('0x4d')]=_[_0x6b34('0x5c')](_0x1a5aec['model'],_0x1a5aec[_0x6b34('0x43')]);_0xfc536[_0x6b34('0x45')]=_[_0x6b34('0x5c')](_0x1a5aec[_0x6b34('0x44')],qs[_0x6b34('0x46')](_0x54db24[_0x6b34('0x43')][_0x6b34('0x46')]));_0xfc536[_0x6b34('0x45')]=_0xfc536['attributes'][_0x6b34('0x47')]?_0xfc536['attributes']:_0x1a5aec[_0x6b34('0x44')];if(!_0x54db24[_0x6b34('0x43')][_0x6b34('0x48')](_0x6b34('0x49'))){_0xfc536[_0x6b34('0x2e')]=qs[_0x6b34('0x2e')](_0x54db24[_0x6b34('0x43')][_0x6b34('0x2e')]);_0xfc536[_0x6b34('0x2b')]=qs[_0x6b34('0x2b')](_0x54db24[_0x6b34('0x43')][_0x6b34('0x2b')]);}_0xfc536[_0x6b34('0x4a')]=qs['sort'](_0x54db24['query']['sort']);_0xfc536[_0x6b34('0x4c')]=qs['filters'](_[_0x6b34('0x4e')](_0x54db24[_0x6b34('0x43')],_0x1a5aec[_0x6b34('0x4d')]));_0xfc536[_0x6b34('0x4c')][_0x6b34('0x64')]=_0x1cd3f0['id'];if(_0x54db24[_0x6b34('0x43')][_0x6b34('0x4f')]){_0xfc536[_0x6b34('0x4c')]=_[_0x6b34('0x51')](_0xfc536[_0x6b34('0x4c')],{'$or':_[_0x6b34('0x3e')](_0xfc536[_0x6b34('0x45')],function(_0x1fde88){var _0x2a9cd7={};_0x2a9cd7[_0x1fde88]={'$like':'%'+_0x54db24[_0x6b34('0x43')][_0x6b34('0x4f')]+'%'};return _0x2a9cd7;})});}_0xfc536=_[_0x6b34('0x51')]({},_0xfc536,_0x54db24[_0x6b34('0x52')]);return db[_0x6b34('0x65')][_0x6b34('0x2d')]({'where':_0xfc536[_0x6b34('0x4c')]})['then'](function(_0x3f57c9){_0x3c490f[_0x6b34('0x2d')]=_0x3f57c9;if(_0x54db24[_0x6b34('0x43')][_0x6b34('0x53')]){_0xfc536[_0x6b34('0x5d')]=[{'all':!![]}];}return db[_0x6b34('0x65')][_0x6b34('0x54')](_0xfc536);})['then'](function(_0x11089a){_0x3c490f[_0x6b34('0x55')]=_0x11089a;return _0x3c490f;});}})[_0x6b34('0x1f')](respondWithFilteredResult(_0x4f5876,_0xfc536))[_0x6b34('0x56')](handleError(_0x4f5876,null));};exports[_0x6b34('0x66')]=function(_0x168162,_0x1dbb2c,_0x48af3e){return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x168162[_0x6b34('0x57')]['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x1dbb2c,null))[_0x6b34('0x1f')](function(_0x12431a){if(_0x12431a){return _0x12431a[_0x6b34('0x66')](_0x168162[_0x6b34('0x43')][_0x6b34('0x67')]);}})[_0x6b34('0x1f')](respondWithStatusCode(_0x1dbb2c,null))[_0x6b34('0x56')](handleError(_0x1dbb2c,null));};exports[_0x6b34('0x68')]=function(_0x3e89cb,_0x4e078d,_0x18039d){if(_0x3e89cb[_0x6b34('0x5f')]['id']){delete _0x3e89cb[_0x6b34('0x5f')]['id'];}return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x3e89cb[_0x6b34('0x57')]['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x4e078d,null))[_0x6b34('0x1f')](function(_0x5bd742){if(_0x5bd742){_0x3e89cb[_0x6b34('0x5f')]['MailAccountId']=_0x5bd742['id'];return db[_0x6b34('0x69')]['create'](_0x3e89cb['body']);}})[_0x6b34('0x1f')](respondWithResult(_0x4e078d,null))[_0x6b34('0x56')](handleError(_0x4e078d,null));};exports[_0x6b34('0x6a')]=function(_0x290004,_0x1f2f45,_0x53c027){var _0x11129b={'raw':![],'where':{}};var _0x1b5989={};var _0x310373={'count':0x0,'rows':[]};return db[_0x6b34('0x3f')][_0x6b34('0x63')]({'where':{'id':_0x290004['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x1f2f45,null))[_0x6b34('0x1f')](function(_0x595e00){if(_0x595e00){_0x1b5989[_0x6b34('0x44')]=_[_0x6b34('0x5a')](db[_0x6b34('0x69')]['rawAttributes']);_0x1b5989[_0x6b34('0x43')]=_[_0x6b34('0x5a')](_0x290004[_0x6b34('0x43')]);_0x1b5989['filters']=_['intersection'](_0x1b5989[_0x6b34('0x44')],_0x1b5989['query']);_0x11129b['attributes']=_[_0x6b34('0x5c')](_0x1b5989[_0x6b34('0x44')],qs[_0x6b34('0x46')](_0x290004[_0x6b34('0x43')][_0x6b34('0x46')]));_0x11129b[_0x6b34('0x45')]=_0x11129b[_0x6b34('0x45')]['length']?_0x11129b[_0x6b34('0x45')]:_0x1b5989[_0x6b34('0x44')];if(!_0x290004['query'][_0x6b34('0x48')]('nolimit')){_0x11129b[_0x6b34('0x2e')]=qs[_0x6b34('0x2e')](_0x290004[_0x6b34('0x43')]['limit']);_0x11129b[_0x6b34('0x2b')]=qs[_0x6b34('0x2b')](_0x290004[_0x6b34('0x43')][_0x6b34('0x2b')]);}_0x11129b[_0x6b34('0x4a')]=qs[_0x6b34('0x4b')](_0x290004[_0x6b34('0x43')][_0x6b34('0x4b')]);_0x11129b[_0x6b34('0x4c')]=qs[_0x6b34('0x4d')](_[_0x6b34('0x4e')](_0x290004['query'],_0x1b5989[_0x6b34('0x4d')]));_0x11129b[_0x6b34('0x4c')]['MailAccountId']=_0x595e00['id'];if(_0x290004[_0x6b34('0x43')]['filter']){_0x11129b[_0x6b34('0x4c')]=_[_0x6b34('0x51')](_0x11129b[_0x6b34('0x4c')],{'$or':_['map'](_0x11129b['attributes'],function(_0x2f3cda){var _0x447825={};_0x447825[_0x2f3cda]={'$like':'%'+_0x290004[_0x6b34('0x43')][_0x6b34('0x4f')]+'%'};return _0x447825;})});}_0x11129b=_[_0x6b34('0x51')]({},_0x11129b,_0x290004[_0x6b34('0x52')]);return db[_0x6b34('0x69')]['count']({'where':_0x11129b[_0x6b34('0x4c')]})[_0x6b34('0x1f')](function(_0x86b6df){_0x310373[_0x6b34('0x2d')]=_0x86b6df;if(_0x290004[_0x6b34('0x43')][_0x6b34('0x53')]){_0x11129b[_0x6b34('0x5d')]=[{'all':!![]}];}return db[_0x6b34('0x69')][_0x6b34('0x54')](_0x11129b);})[_0x6b34('0x1f')](function(_0x26f3a4){_0x310373['rows']=_0x26f3a4;return _0x310373;});}})[_0x6b34('0x1f')](respondWithFilteredResult(_0x1f2f45,_0x11129b))['catch'](handleError(_0x1f2f45,null));};exports[_0x6b34('0x6b')]=function(_0x375b4b,_0x28ad70,_0x444c05){return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x375b4b[_0x6b34('0x57')]['id']}})['then'](handleEntityNotFound(_0x28ad70,null))[_0x6b34('0x1f')](function(_0x4d689d){if(_0x4d689d){return _0x4d689d[_0x6b34('0x6b')](_0x375b4b[_0x6b34('0x43')]['ids']);}})[_0x6b34('0x1f')](respondWithStatusCode(_0x28ad70,null))['catch'](handleError(_0x28ad70,null));};exports['create']=function(_0x1ae630,_0x522b23){var _0x828c1b={'name':_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x39')],'key':_0x1ae630['body'][_0x6b34('0x42')],'email':_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x6c')],'ListId':_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x6d')],'active':!_[_0x6b34('0x6e')](_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x6f')])?_0x1ae630[_0x6b34('0x5f')]['active']:!![],'description':_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x6b34('0x6e')](_0x1ae630[_0x6b34('0x5f')]['cservice'])){if(_0x1ae630[_0x6b34('0x5f')]['cauthentication']){_0x828c1b[_0x6b34('0x3b')]['user']=_0x828c1b[_0x6b34('0x59')]['user']=_0x1ae630['body'][_0x6b34('0x71')];_0x828c1b[_0x6b34('0x3b')][_0x6b34('0x72')]=_0x828c1b[_0x6b34('0x59')][_0x6b34('0x73')]=_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x74')];}else{_0x828c1b[_0x6b34('0x3b')][_0x6b34('0x75')]=_0x828c1b[_0x6b34('0x59')][_0x6b34('0x75')]=![];}_0x828c1b['Imap'][_0x6b34('0x76')]=_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x3b')][_0x6b34('0x76')];_0x828c1b[_0x6b34('0x3b')][_0x6b34('0x77')]=_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x3b')][_0x6b34('0x77')];_0x828c1b[_0x6b34('0x59')]['host']=_0x1ae630['body'][_0x6b34('0x59')][_0x6b34('0x76')];_0x828c1b[_0x6b34('0x59')][_0x6b34('0x77')]=_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x59')][_0x6b34('0x77')];}else{_0x828c1b['Imap']['service']=_0x828c1b['Smtp'][_0x6b34('0x78')]=_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x79')];_0x828c1b['Imap'][_0x6b34('0x7a')]=_0x828c1b['Smtp'][_0x6b34('0x7a')]=_0x1ae630['body'][_0x6b34('0x71')];_0x828c1b[_0x6b34('0x3b')][_0x6b34('0x72')]=_0x828c1b[_0x6b34('0x59')][_0x6b34('0x73')]=_0x1ae630[_0x6b34('0x5f')][_0x6b34('0x74')];}return db[_0x6b34('0x3f')][_0x6b34('0x7b')](_0x828c1b,{'include':[{'model':db[_0x6b34('0x60')],'as':'Smtp'},{'model':db[_0x6b34('0x58')],'as':'Imap'}]})[_0x6b34('0x1f')](function(_0x3d24d3){var _0x42a40a=_0x1ae630[_0x6b34('0x7a')][_0x6b34('0x7c')]({'plain':!![]});if(!_0x42a40a)throw new Error(_0x6b34('0x7d'));if(_0x42a40a[_0x6b34('0x7e')]===_0x6b34('0x7a')){var _0x2294f9=_0x3d24d3[_0x6b34('0x7c')]({'plain':!![]});return db[_0x6b34('0x7f')][_0x6b34('0x5e')]({'where':{'name':_0x6b34('0x35'),'userProfileId':_0x42a40a[_0x6b34('0x80')]},'raw':!![]})[_0x6b34('0x1f')](function(_0x1c65e0){if(_0x1c65e0&&_0x1c65e0['autoAssociation']===0x0){return db[_0x6b34('0x36')]['create']({'name':_0x2294f9['name'],'resourceId':_0x2294f9['id'],'type':_0x1c65e0['name'],'sectionId':_0x1c65e0['id']},{})['then'](function(){return _0x3d24d3;});}else{return _0x3d24d3;}})[_0x6b34('0x56')](function(_0x400ec1){logger[_0x6b34('0x25')](_0x6b34('0x81'),_0x400ec1);throw _0x400ec1;});}return _0x3d24d3;})['then'](respondWithResult(_0x522b23,0xc9))[_0x6b34('0x56')](handleError(_0x522b23,null));};exports[_0x6b34('0x82')]=function(_0x5759fe,_0x2e95ed,_0x253755){return db[_0x6b34('0x3f')][_0x6b34('0x63')]({'where':{'id':_0x5759fe[_0x6b34('0x57')]['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x2e95ed,null))[_0x6b34('0x1f')](function(_0x15dcea){if(_0x15dcea){return _0x15dcea[_0x6b34('0x82')]();}return null;})[_0x6b34('0x1f')](respondWithResult(_0x2e95ed,null))['catch'](handleError(_0x2e95ed,null));};exports['addImap']=function(_0x458b91,_0x29c61b,_0x22adf5){if(_0x458b91['body']['id']){delete _0x458b91['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x458b91[_0x6b34('0x57')]['id']}})['then'](handleEntityNotFound(_0x29c61b,null))[_0x6b34('0x1f')](function(_0x2d00a2){if(_0x2d00a2){_0x458b91[_0x6b34('0x5f')][_0x6b34('0x64')]=_0x2d00a2['id'];return db[_0x6b34('0x58')][_0x6b34('0x7b')](_0x458b91['body']);}})[_0x6b34('0x1f')](respondWithResult(_0x29c61b,null))[_0x6b34('0x56')](handleError(_0x29c61b,null));};exports['removeImap']=function(_0x198cae,_0x10ba44,_0x54b35e){return db[_0x6b34('0x3f')][_0x6b34('0x63')]({'where':{'id':_0x198cae['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x10ba44,null))['then'](function(_0x3fa4f4){if(_0x3fa4f4){return _0x3fa4f4[_0x6b34('0x83')](null);}return null;})[_0x6b34('0x1f')](respondWithStatusCode(_0x10ba44,null))['catch'](handleError(_0x10ba44,null));};exports[_0x6b34('0x84')]=function(_0x3cf41a,_0x115a23,_0x5dae9f){return db['MailAccount'][_0x6b34('0x63')]({'where':{'id':_0x3cf41a[_0x6b34('0x57')]['id']}})['then'](handleEntityNotFound(_0x115a23,null))[_0x6b34('0x1f')](function(_0x2bd0a5){if(_0x2bd0a5){return _0x2bd0a5['getSmtp']();}return null;})[_0x6b34('0x1f')](respondWithResult(_0x115a23,null))[_0x6b34('0x56')](handleError(_0x115a23,null));};exports[_0x6b34('0x85')]=function(_0x13c5d0,_0x370498,_0x18597c){if(_0x13c5d0[_0x6b34('0x5f')]['id']){delete _0x13c5d0[_0x6b34('0x5f')]['id'];}return db[_0x6b34('0x3f')]['find']({'where':{'id':_0x13c5d0['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x370498,null))[_0x6b34('0x1f')](function(_0x13dbb4){if(_0x13dbb4){_0x13c5d0[_0x6b34('0x5f')][_0x6b34('0x64')]=_0x13dbb4['id'];return db[_0x6b34('0x60')][_0x6b34('0x7b')](_0x13c5d0[_0x6b34('0x5f')]);}})[_0x6b34('0x1f')](respondWithResult(_0x370498,null))[_0x6b34('0x56')](handleError(_0x370498,null));};exports[_0x6b34('0x86')]=function(_0x176654,_0x2f7c51,_0x148d6b){return db[_0x6b34('0x3f')][_0x6b34('0x63')]({'where':{'id':_0x176654['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x2f7c51,null))[_0x6b34('0x1f')](function(_0x3787bd){if(_0x3787bd){return _0x3787bd['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x2f7c51,null))[_0x6b34('0x56')](handleError(_0x2f7c51,null));};exports[_0x6b34('0x87')]=function(_0x3c7a72,_0x517205,_0x5ac888){return db[_0x6b34('0x88')][_0x6b34('0x5e')]({'where':{'id':_0x3c7a72['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x517205,null))['then'](function(_0x4c9d11){if(_0x4c9d11){return _0x4c9d11[_0x6b34('0x87')](_0x3c7a72[_0x6b34('0x5f')][_0x6b34('0x67')],_[_0x6b34('0x89')](_0x3c7a72[_0x6b34('0x5f')],[_0x6b34('0x67'),'id'])||{});}})['then'](respondWithResult(_0x517205,null))[_0x6b34('0x56')](handleError(_0x517205,null));};exports[_0x6b34('0x8a')]=function(_0x432bd5,_0x296ef0,_0x3629db){var _0x8d7d5c={'raw':![],'where':{}};var _0x1342a7={};var _0x23ebf4={'count':0x0,'rows':[]};return db[_0x6b34('0x3f')][_0x6b34('0x63')]({'where':{'id':_0x432bd5['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x296ef0,null))['then'](function(_0x49a3b){if(_0x49a3b){_0x1342a7[_0x6b34('0x44')]=_[_0x6b34('0x5a')](db['MailInteraction'][_0x6b34('0x5b')]);_0x1342a7[_0x6b34('0x43')]=_[_0x6b34('0x5a')](_0x432bd5[_0x6b34('0x43')]);_0x1342a7['filters']=_[_0x6b34('0x5c')](_0x1342a7[_0x6b34('0x44')],_0x1342a7['query']);_0x8d7d5c[_0x6b34('0x45')]=_[_0x6b34('0x5c')](_0x1342a7[_0x6b34('0x44')],qs[_0x6b34('0x46')](_0x432bd5[_0x6b34('0x43')][_0x6b34('0x46')]));_0x8d7d5c[_0x6b34('0x45')]=_0x8d7d5c[_0x6b34('0x45')][_0x6b34('0x47')]?_0x8d7d5c['attributes']:_0x1342a7[_0x6b34('0x44')];if(!_0x432bd5[_0x6b34('0x43')][_0x6b34('0x48')]('nolimit')){_0x8d7d5c[_0x6b34('0x2e')]=qs[_0x6b34('0x2e')](_0x432bd5[_0x6b34('0x43')][_0x6b34('0x2e')]);_0x8d7d5c[_0x6b34('0x2b')]=qs[_0x6b34('0x2b')](_0x432bd5[_0x6b34('0x43')][_0x6b34('0x2b')]);}_0x8d7d5c['order']=qs['sort'](_0x432bd5[_0x6b34('0x43')][_0x6b34('0x4b')]);_0x8d7d5c[_0x6b34('0x4c')]=qs['filters'](_['pick'](_0x432bd5[_0x6b34('0x43')],_0x1342a7[_0x6b34('0x4d')]));_0x8d7d5c[_0x6b34('0x4c')]['MailAccountId']=_0x49a3b['id'];if(_0x432bd5['query'][_0x6b34('0x4f')]){_0x8d7d5c[_0x6b34('0x4c')]=_[_0x6b34('0x51')](_0x8d7d5c[_0x6b34('0x4c')],{'$or':_['map'](_0x8d7d5c[_0x6b34('0x45')],function(_0x1388de){var _0x1094fe={};_0x1094fe[_0x1388de]={'$like':'%'+_0x432bd5[_0x6b34('0x43')][_0x6b34('0x4f')]+'%'};return _0x1094fe;})});}_0x8d7d5c=_[_0x6b34('0x51')]({},_0x8d7d5c,_0x432bd5[_0x6b34('0x52')]);return db['MailInteraction'][_0x6b34('0x2d')]({'where':_0x8d7d5c[_0x6b34('0x4c')]})[_0x6b34('0x1f')](function(_0x16a13e){_0x23ebf4[_0x6b34('0x2d')]=_0x16a13e;if(_0x432bd5[_0x6b34('0x43')]['includeAll']){_0x8d7d5c[_0x6b34('0x5d')]=[{'model':db[_0x6b34('0x8b')],'as':_0x6b34('0x8c'),'required':![]},{'model':db['User'],'as':_0x6b34('0x8d'),'attributes':['name',_0x6b34('0x8e'),'internal'],'required':![]},{'model':db[_0x6b34('0x8f')],'as':_0x6b34('0x90'),'attributes':['id',_0x6b34('0x39'),_0x6b34('0x91')],'where':_0x432bd5['query'][_0x6b34('0x92')]?{'id':_0x432bd5[_0x6b34('0x43')][_0x6b34('0x92')]}:undefined,'required':_0x432bd5[_0x6b34('0x43')]['tag']?!![]:![]}];}return db[_0x6b34('0x88')][_0x6b34('0x54')](_0x8d7d5c);})[_0x6b34('0x1f')](function(_0x5deeee){_0x23ebf4[_0x6b34('0x55')]=_0x5deeee;return _0x23ebf4;});}})[_0x6b34('0x1f')](respondWithFilteredResult(_0x296ef0,_0x8d7d5c))[_0x6b34('0x56')](handleError(_0x296ef0,null));};exports[_0x6b34('0x93')]=function addApplications(_0x2ca0b1,_0x444e2a){var _0x292735=_0x2ca0b1[_0x6b34('0x57')]['id'];var _0x560de5=_0x2ca0b1['body'];var _0x4ed7b1=0xc8;var _0x43c314=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x6b34('0x94')]['Transaction'][_0x6b34('0x95')][_0x6b34('0x96')]},function(_0x266608){return db['MailAccount'][_0x6b34('0x63')]({'where':{'id':_0x292735},'transaction':_0x266608})[_0x6b34('0x1f')](function(_0x52d8b5){if(_0x52d8b5){return db[_0x6b34('0x97')]['destroy']({'where':{'MailAccountId':_0x292735},'transaction':_0x266608})[_0x6b34('0x1f')](function(){var _0x43e3b6=_['map'](_0x560de5,function(_0x596e78){_0x596e78[_0x6b34('0x64')]=_0x292735;return _0x596e78;});return db[_0x6b34('0x97')][_0x6b34('0x98')](_0x43e3b6,{'transaction':_0x266608});});}else{_0x4ed7b1=0x194;_0x43c314=[];}});})['then'](function(){if(_0x4ed7b1!==0x194){return db['MailApplication'][_0x6b34('0x99')]({'where':{'MailAccountId':_0x292735},'order':'priority'})[_0x6b34('0x1f')](function(_0x44a828){_0x43c314=_0x44a828;});}})[_0x6b34('0x56')](function(_0x25a778){_0x4ed7b1=0x1f4;logger[_0x6b34('0x25')](_0x25a778['stack']);if(_0x25a778[_0x6b34('0x39')]){delete _0x25a778[_0x6b34('0x39')];}_0x43c314=_0x25a778;})[_0x6b34('0x9a')](function(){if(_0x43c314===null){_0x444e2a[_0x6b34('0x2a')](_0x4ed7b1);}else{if(_0x4ed7b1===0x1f4){_0x444e2a[_0x6b34('0x2f')](_0x4ed7b1)[_0x6b34('0x9b')](_0x43c314);}else{_0x444e2a[_0x6b34('0x2f')](_0x4ed7b1)[_0x6b34('0x31')](_0x43c314);}}});};exports[_0x6b34('0x9c')]=function(_0x40f6c7,_0xf2fcbf,_0x5240bc){var _0x410712={};var _0x16764f={};var _0x709cec;var _0x4408cf;return db[_0x6b34('0x3f')][_0x6b34('0x63')]({'where':{'id':_0x40f6c7[_0x6b34('0x57')]['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0xf2fcbf,null))[_0x6b34('0x1f')](function(_0x6eb84f){if(_0x6eb84f){_0x709cec=_0x6eb84f;_0x16764f[_0x6b34('0x44')]=_['keys'](db[_0x6b34('0x97')][_0x6b34('0x5b')]);_0x16764f[_0x6b34('0x43')]=_[_0x6b34('0x5a')](_0x40f6c7[_0x6b34('0x43')]);_0x16764f['filters']=_[_0x6b34('0x5c')](_0x16764f[_0x6b34('0x44')],_0x16764f[_0x6b34('0x43')]);_0x410712[_0x6b34('0x45')]=_[_0x6b34('0x5c')](_0x16764f['model'],qs[_0x6b34('0x46')](_0x40f6c7['query'][_0x6b34('0x46')]));_0x410712['attributes']=_0x410712[_0x6b34('0x45')][_0x6b34('0x47')]?_0x410712[_0x6b34('0x45')]:_0x16764f[_0x6b34('0x44')];_0x410712[_0x6b34('0x4a')]=qs['sort'](_0x40f6c7[_0x6b34('0x43')][_0x6b34('0x4b')]);_0x410712[_0x6b34('0x4c')]=qs[_0x6b34('0x4d')](_['pick'](_0x40f6c7[_0x6b34('0x43')],_0x16764f[_0x6b34('0x4d')]));if(_0x40f6c7[_0x6b34('0x43')][_0x6b34('0x4f')]){_0x410712[_0x6b34('0x4c')]=_[_0x6b34('0x51')](_0x410712[_0x6b34('0x4c')],{'$or':_[_0x6b34('0x3e')](_0x410712[_0x6b34('0x45')],function(_0x407fd5){var _0x1dae74={};_0x1dae74[_0x407fd5]={'$like':'%'+_0x40f6c7[_0x6b34('0x43')][_0x6b34('0x4f')]+'%'};return _0x1dae74;})});}_0x410712=_[_0x6b34('0x51')]({},_0x410712,_0x40f6c7['options']);return _0x709cec['getApplications'](_0x410712);}})[_0x6b34('0x1f')](function(_0x48ca20){if(_0x48ca20){_0x4408cf=_0x48ca20[_0x6b34('0x47')];if(!_0x40f6c7['query'][_0x6b34('0x48')](_0x6b34('0x49'))){_0x410712[_0x6b34('0x2e')]=qs[_0x6b34('0x2e')](_0x40f6c7['query']['limit']);_0x410712[_0x6b34('0x2b')]=qs[_0x6b34('0x2b')](_0x40f6c7[_0x6b34('0x43')][_0x6b34('0x2b')]);}return _0x709cec[_0x6b34('0x9c')](_0x410712);}})['then'](function(_0x2d61c9){if(_0x2d61c9){return _0x2d61c9?{'count':_0x4408cf,'rows':_0x2d61c9}:null;}})[_0x6b34('0x1f')](respondWithResult(_0xf2fcbf,null))[_0x6b34('0x56')](handleError(_0xf2fcbf,null));};exports['getMessages']=function(_0x21ec5f,_0x5511ea,_0x437e77){var _0x3c13e8={'raw':!![],'where':{}};var _0x499594={};var _0x226bb8={'count':0x0,'rows':[]};return db[_0x6b34('0x3f')][_0x6b34('0x63')]({'where':{'id':_0x21ec5f['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x5511ea,null))[_0x6b34('0x1f')](function(_0x1cff5a){if(_0x1cff5a){_0x499594[_0x6b34('0x44')]=_[_0x6b34('0x5a')](db[_0x6b34('0x9d')]['rawAttributes']);_0x499594[_0x6b34('0x43')]=_[_0x6b34('0x5a')](_0x21ec5f['query']);_0x499594[_0x6b34('0x4d')]=_[_0x6b34('0x5c')](_0x499594[_0x6b34('0x44')],_0x499594[_0x6b34('0x43')]);_0x3c13e8[_0x6b34('0x45')]=_[_0x6b34('0x5c')](_0x499594['model'],qs['fields'](_0x21ec5f['query']['fields']));_0x3c13e8[_0x6b34('0x45')]=_0x3c13e8[_0x6b34('0x45')][_0x6b34('0x47')]?_0x3c13e8[_0x6b34('0x45')]:_0x499594[_0x6b34('0x44')];if(!_0x21ec5f['query'][_0x6b34('0x48')](_0x6b34('0x49'))){_0x3c13e8['limit']=qs['limit'](_0x21ec5f[_0x6b34('0x43')][_0x6b34('0x2e')]);_0x3c13e8[_0x6b34('0x2b')]=qs[_0x6b34('0x2b')](_0x21ec5f[_0x6b34('0x43')][_0x6b34('0x2b')]);}_0x3c13e8['order']=qs[_0x6b34('0x4b')](_0x21ec5f['query'][_0x6b34('0x4b')]);_0x3c13e8['where']=qs[_0x6b34('0x4d')](_['pick'](_0x21ec5f[_0x6b34('0x43')],_0x499594[_0x6b34('0x4d')]));_0x3c13e8['where'][_0x6b34('0x64')]=_0x1cff5a['id'];if(_0x21ec5f[_0x6b34('0x43')][_0x6b34('0x4f')]){_0x3c13e8['where']=_[_0x6b34('0x51')](_0x3c13e8[_0x6b34('0x4c')],{'$or':_['map'](_0x3c13e8[_0x6b34('0x45')],function(_0x40f0fb){var _0x353405={};_0x353405[_0x40f0fb]={'$like':'%'+_0x21ec5f[_0x6b34('0x43')][_0x6b34('0x4f')]+'%'};return _0x353405;})});}if(_0x21ec5f[_0x6b34('0x43')][_0x6b34('0x9e')]){var _0xf92fa5=_0x21ec5f[_0x6b34('0x43')][_0x6b34('0x9e')][_0x6b34('0x9f')](',');var _0x35e47a={};_0x35e47a[_0xf92fa5[0x0]]={'$gte':moment(_0xf92fa5[0x1])['format'](_0x6b34('0xa0'))};_0x3c13e8[_0x6b34('0x4c')]=_[_0x6b34('0x51')](_0x3c13e8[_0x6b34('0x4c')],_0x35e47a);}_0x3c13e8=_[_0x6b34('0x51')]({},_0x3c13e8,_0x21ec5f['options']);return db['MailMessage']['count']({'where':_0x3c13e8[_0x6b34('0x4c')]})[_0x6b34('0x1f')](function(_0x239f12){_0x226bb8[_0x6b34('0x2d')]=_0x239f12;if(_0x21ec5f[_0x6b34('0x43')]['includeAll']){_0x3c13e8[_0x6b34('0x5d')]=[{'all':!![]}];}return db[_0x6b34('0x9d')][_0x6b34('0x54')](_0x3c13e8);})['then'](function(_0x316a0b){if(_0x21ec5f[_0x6b34('0x43')]['inlineCss']===_0x6b34('0xa1')){for(var _0x32d64f=0x0;_0x32d64f<_0x316a0b[_0x6b34('0x47')];_0x32d64f++){_0x316a0b[_0x32d64f][_0x6b34('0x5f')]=juice(_0x316a0b[_0x32d64f][_0x6b34('0x5f')]);}}_0x226bb8['rows']=_0x316a0b;return _0x226bb8;});}})[_0x6b34('0x1f')](respondWithFilteredResult(_0x5511ea,_0x3c13e8))[_0x6b34('0x56')](handleError(_0x5511ea,null));};exports[_0x6b34('0x9b')]=function(_0x5cf4c3,_0x5f571a,_0x103887){var _0x365727,_0x3db265={},_0x3a8f94;if(_0x5cf4c3['body']['to']){_0x3a8f94=_0x5cf4c3[_0x6b34('0x5f')]['to'][_0x6b34('0x9f')](',')[0x0];}return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x5cf4c3[_0x6b34('0x57')]['id']},'include':[{'model':db[_0x6b34('0xa2')],'as':_0x6b34('0xa3'),'include':[{'model':db[_0x6b34('0x8b')],'as':_0x6b34('0xa4'),'where':{'email':_0x3a8f94},'limit':0x1,'order':[[_0x6b34('0xa5'),_0x6b34('0xa6')]]}]},{'model':db[_0x6b34('0x60')],'as':'Smtp','raw':!![]}]})[_0x6b34('0x1f')](handleEntityNotFound(_0x5f571a,null))[_0x6b34('0x1f')](function(_0x599a00){if(_0x599a00){_0x365727=_0x599a00;if(_0x599a00[_0x6b34('0x59')]){if(_[_0x6b34('0x6e')](_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xa7')])){_0x5cf4c3[_0x6b34('0x5f')]['from']=util[_0x6b34('0xa8')](_0x6b34('0xa9'),_0x599a00[_0x6b34('0x39')],_0x599a00[_0x6b34('0x6c')]||_0x599a00[_0x6b34('0x59')]['user']);}if(_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xaa')]&&_0x5cf4c3['body'][_0x6b34('0xaa')]['length']){for(var _0x1d34bb=0x0;_0x1d34bb<_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xaa')][_0x6b34('0x47')];_0x1d34bb+=0x1){_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xaa')][_0x1d34bb]={'filename':_0x5cf4c3['body']['attachments'][_0x1d34bb][_0x6b34('0x39')],'path':path['join'](config[_0x6b34('0xab')],_0x6b34('0xac'),_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xaa')][_0x1d34bb][_0x6b34('0xad')])};}}var _0x4ebfed={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x599a00[_0x6b34('0x59')][_0x6b34('0x78')])){if(_0x599a00[_0x6b34('0x59')][_0x6b34('0x75')]){_0x4ebfed[_0x6b34('0xae')]={'user':_0x599a00[_0x6b34('0x59')]['user'],'pass':_0x599a00[_0x6b34('0x59')][_0x6b34('0x73')]};}_0x4ebfed[_0x6b34('0x76')]=_0x599a00[_0x6b34('0x59')][_0x6b34('0x76')];_0x4ebfed['port']=_0x599a00[_0x6b34('0x59')][_0x6b34('0x77')];_0x4ebfed['secure']=_0x599a00[_0x6b34('0x59')][_0x6b34('0xaf')];}else{_0x4ebfed[_0x6b34('0x78')]=_0x599a00[_0x6b34('0x59')][_0x6b34('0x78')];_0x4ebfed['auth']={'user':_0x599a00[_0x6b34('0x59')]['user'],'pass':_0x599a00[_0x6b34('0x59')][_0x6b34('0x73')]};}return respondWithRpcPromise(_0x6b34('0xb0'),_0x6b34('0xb1'),{'account':_0x4ebfed,'message':_0x5cf4c3['body']});}else{throw new Error(_0x6b34('0xb2'));}}})['then'](function(_0x21b320){if(_0x21b320){_0x3db265=_0x21b320;if(_0x365727[_0x6b34('0xa3')]){if(_0x365727[_0x6b34('0xa3')][_0x6b34('0xa4')][_0x6b34('0x47')]){return _0x365727[_0x6b34('0xa3')]['Contacts'][0x0];}else{return db[_0x6b34('0x8b')][_0x6b34('0x7b')](_[_0x6b34('0x17')](_0x5cf4c3[_0x6b34('0x5f')],{'firstName':_0x5cf4c3['body']['to'],'email':_0x5cf4c3['body']['to'],'phone':_0x5cf4c3[_0x6b34('0x5f')]['to'],'ListId':_0x365727['ListId']}));}}else{throw new Error(_0x6b34('0xb2'));}}})[_0x6b34('0x1f')](function(_0x83551f){if(_0x83551f){var _0x5e5766={'UserId':_0x5cf4c3['user']['id'],'ContactId':_0x83551f['id'],'MailAccountId':_0x365727['id'],'inReplyTo':_0x3db265[_0x6b34('0xb3')],'to':_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xa7')],'cc':_0x5cf4c3[_0x6b34('0x5f')]['cc'],'subject':_0x5cf4c3[_0x6b34('0x5f')]['subject'],'attach':_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x6b34('0xa8')](_0x6b34('0xa0')),'lastMsgDirection':_0x6b34('0xb5'),'Messages':[_[_0x6b34('0x51')](_0x5cf4c3[_0x6b34('0x5f')],{'messageId':_0x3db265[_0x6b34('0xb3')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x365727['id'],'UserId':_0x5cf4c3[_0x6b34('0x7a')]['id'],'ContactId':_0x83551f['id']})]};if(_0x5cf4c3['body'][_0x6b34('0xb6')]){_0x5e5766=_[_0x6b34('0x51')](_0x5e5766,_0x5cf4c3[_0x6b34('0x5f')][_0x6b34('0xb6')]);}return db['MailInteraction'][_0x6b34('0x7b')](_0x5e5766,{'include':[{'model':db['MailMessage'],'as':_0x6b34('0xb7')}]});}})[_0x6b34('0x1f')](respondWithResult(_0x5f571a,null))[_0x6b34('0x56')](handleError(_0x5f571a,null));};exports['verifySmtp']=function(_0x4d259b,_0x58e4b5,_0x279810){return db['MailAccount'][_0x6b34('0x5e')]({'where':{'id':_0x4d259b[_0x6b34('0x57')]['id']},'include':[{'model':db[_0x6b34('0x60')],'as':_0x6b34('0x59'),'raw':!![]}]})[_0x6b34('0x1f')](handleEntityNotFound(_0x58e4b5,null))[_0x6b34('0x1f')](function(_0x41aa9d){if(_0x41aa9d&&_0x41aa9d[_0x6b34('0x59')]){var _0x2257e0={'id':_0x41aa9d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x41aa9d[_0x6b34('0x59')]['service']){_0x2257e0[_0x6b34('0x78')]=_0x41aa9d[_0x6b34('0x59')][_0x6b34('0x78')];}else{_0x2257e0['host']=_0x41aa9d[_0x6b34('0x59')][_0x6b34('0x76')];_0x2257e0['port']=_0x41aa9d[_0x6b34('0x59')][_0x6b34('0x77')];_0x2257e0[_0x6b34('0xaf')]=_0x41aa9d[_0x6b34('0x59')][_0x6b34('0xaf')];}if(_0x41aa9d[_0x6b34('0x59')][_0x6b34('0x75')]){_0x2257e0[_0x6b34('0xae')]={'user':_0x41aa9d[_0x6b34('0x59')][_0x6b34('0x7a')],'pass':_0x41aa9d['Smtp']['pass']};}return respondWithRpcPromise(_0x6b34('0xb8'),_0x6b34('0xb9'),{'account':_0x2257e0});}})[_0x6b34('0x1f')](respondWithResult(_0x58e4b5,null))[_0x6b34('0x56')](handleError(_0x58e4b5,null));};exports[_0x6b34('0x37')]=function(_0x121dec,_0x37e6fe){return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x121dec['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x37e6fe,null))[_0x6b34('0x1f')](function(_0x422326){if(_0x422326&&_0x422326[_0x6b34('0x78')]){throw new db[(_0x6b34('0xba'))][(_0x6b34('0xbb'))](_0x6b34('0xbc'));}return _0x422326;})[_0x6b34('0x1f')](removeEntity(_0x37e6fe,null))[_0x6b34('0x56')](handleError(_0x37e6fe,null));};exports['addAgents']=function(_0x3d46d8,_0x24cc79,_0x11614c){return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x3d46d8[_0x6b34('0x57')]['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x24cc79,null))[_0x6b34('0x1f')](function(_0xd74768){if(_0xd74768){return _0xd74768[_0x6b34('0xbd')](_0x3d46d8['body'][_0x6b34('0x67')],_['omit'](_0x3d46d8[_0x6b34('0x5f')],['ids','id'])||{})['spread'](function(_0x1e56ab){for(var _0x205ca9=0x0;_0x205ca9<_0x3d46d8[_0x6b34('0x5f')]['ids']['length'];_0x205ca9+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x3d46d8[_0x6b34('0x5f')][_0x6b34('0x67')][_0x205ca9]),'MailAccountId':Number(_0x3d46d8[_0x6b34('0x57')]['id'])});}return _0x1e56ab;});}})[_0x6b34('0x1f')](respondWithResult(_0x24cc79,null))[_0x6b34('0x56')](handleError(_0x24cc79,null));};exports[_0x6b34('0xbe')]=function(_0x41f40a,_0x57aee5,_0x439a8b){return db[_0x6b34('0x3f')][_0x6b34('0x5e')]({'where':{'id':_0x41f40a['params']['id']}})[_0x6b34('0x1f')](handleEntityNotFound(_0x57aee5,null))[_0x6b34('0x1f')](function(_0x494b03){if(_0x494b03){return _0x494b03[_0x6b34('0xbe')](_0x41f40a[_0x6b34('0x43')][_0x6b34('0x67')])[_0x6b34('0x1f')](function(){if(_[_0x6b34('0xbf')](_0x41f40a[_0x6b34('0x43')][_0x6b34('0x67')])){for(var _0x282d3b=0x0;_0x282d3b<_0x41f40a[_0x6b34('0x43')]['ids'][_0x6b34('0x47')];_0x282d3b+=0x1){socket['emit'](_0x6b34('0xc0'),{'UserId':Number(_0x41f40a[_0x6b34('0x43')][_0x6b34('0x67')][_0x282d3b]),'MailAccountId':Number(_0x41f40a['params']['id'])});}}else{socket[_0x6b34('0xc1')](_0x6b34('0xc0'),{'UserId':Number(_0x41f40a['query'][_0x6b34('0x67')]),'MailAccountId':Number(_0x41f40a[_0x6b34('0x57')]['id'])});}});}})[_0x6b34('0x1f')](respondWithStatusCode(_0x57aee5,null))[_0x6b34('0x56')](handleError(_0x57aee5,null));};exports[_0x6b34('0xc2')]=function(_0x593999,_0x22c221,_0x3c84ca){var _0x439dee={};var _0x1e325f={};var _0x29c045;var _0x57958b;return db[_0x6b34('0x3f')]['findOne']({'where':{'id':_0x593999[_0x6b34('0x57')]['id']}})['then'](handleEntityNotFound(_0x22c221,null))[_0x6b34('0x1f')](function(_0x572e0){if(_0x572e0){_0x29c045=_0x572e0;_0x1e325f[_0x6b34('0x44')]=_[_0x6b34('0x5a')](db[_0x6b34('0xc3')][_0x6b34('0x5b')]);_0x1e325f[_0x6b34('0x43')]=_[_0x6b34('0x5a')](_0x593999['query']);_0x1e325f[_0x6b34('0x4d')]=_['intersection'](_0x1e325f[_0x6b34('0x44')],_0x1e325f[_0x6b34('0x43')]);_0x439dee[_0x6b34('0x45')]=_[_0x6b34('0x5c')](_0x1e325f[_0x6b34('0x44')],qs['fields'](_0x593999[_0x6b34('0x43')][_0x6b34('0x46')]));_0x439dee['attributes']=_0x439dee[_0x6b34('0x45')][_0x6b34('0x47')]?_0x439dee[_0x6b34('0x45')]:_0x1e325f['model'];_0x439dee[_0x6b34('0x4a')]=qs[_0x6b34('0x4b')](_0x593999['query'][_0x6b34('0x4b')]);_0x439dee[_0x6b34('0x4c')]=qs[_0x6b34('0x4d')](_[_0x6b34('0x4e')](_0x593999[_0x6b34('0x43')],_0x1e325f[_0x6b34('0x4d')]));if(_0x593999[_0x6b34('0x43')][_0x6b34('0x4f')]){_0x439dee[_0x6b34('0x4c')]=_[_0x6b34('0x51')](_0x439dee[_0x6b34('0x4c')],{'$or':_['map'](_0x439dee['attributes'],function(_0x3973e2){var _0x491755={};_0x491755[_0x3973e2]={'$like':'%'+_0x593999[_0x6b34('0x43')]['filter']+'%'};return _0x491755;})});}_0x439dee=_['merge']({},_0x439dee,_0x593999[_0x6b34('0x52')]);return _0x29c045[_0x6b34('0xc2')](_0x439dee);}})[_0x6b34('0x1f')](function(_0x4f3f36){if(_0x4f3f36){_0x57958b=_0x4f3f36[_0x6b34('0x47')];if(!_0x593999['query']['hasOwnProperty'](_0x6b34('0x49'))){_0x439dee['limit']=qs[_0x6b34('0x2e')](_0x593999['query']['limit']);_0x439dee[_0x6b34('0x2b')]=qs[_0x6b34('0x2b')](_0x593999[_0x6b34('0x43')][_0x6b34('0x2b')]);}return _0x29c045['getAgents'](_0x439dee);}})[_0x6b34('0x1f')](function(_0x3f1682){if(_0x3f1682){return _0x3f1682?{'count':_0x57958b,'rows':_0x3f1682}:null;}})['then'](respondWithResult(_0x22c221,null))[_0x6b34('0x56')](handleError(_0x22c221,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 49d5e42..e76ab7a 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 _0x0023=['update','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save'];(function(_0x19dbf5,_0x2d1a17){var _0x38ede3=function(_0xf801a9){while(--_0xf801a9){_0x19dbf5['push'](_0x19dbf5['shift']());}};_0x38ede3(++_0x2d1a17);}(_0x0023,0x10a));var _0x3002=function(_0x374aad,_0x3a8e70){_0x374aad=_0x374aad-0x0;var _0x4489e6=_0x0023[_0x374aad];return _0x4489e6;};'use strict';var EventEmitter=require(_0x3002('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x3002('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3002('0x2')](0x0);var events={'afterCreate':_0x3002('0x3'),'afterUpdate':_0x3002('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1eb073){return function(_0x5b257c,_0x531e8c,_0x220c23){MailAccountEvents['emit'](_0x1eb073+':'+_0x5b257c['id'],_0x5b257c);MailAccountEvents[_0x3002('0x5')](_0x1eb073,_0x5b257c);_0x220c23(null);};}for(var e in events){if(events[_0x3002('0x6')](e)){var event=events[e];MailAccount[_0x3002('0x7')](e,emitEvent(event));}}module[_0x3002('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x3f96=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x3f96,0x1d3));var _0x63f9=function(_0x4e0606,_0x1aea57){_0x4e0606=_0x4e0606-0x0;var _0x3b1635=_0x3f96[_0x4e0606];return _0x3b1635;};'use strict';var EventEmitter=require(_0x63f9('0x0'));var MailAccount=require(_0x63f9('0x1'))['db'][_0x63f9('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x63f9('0x3')](0x0);var events={'afterCreate':_0x63f9('0x4'),'afterUpdate':'update','afterDestroy':_0x63f9('0x5')};function emitEvent(_0x113895){return function(_0x859291,_0x26ff58,_0x2109ce){MailAccountEvents['emit'](_0x113895+':'+_0x859291['id'],_0x859291);MailAccountEvents[_0x63f9('0x6')](_0x113895,_0x859291);_0x2109ce(null);};}for(var e in events){if(events[_0x63f9('0x7')](e)){var event=events[e];MailAccount[_0x63f9('0x8')](e,emitEvent(event));}}module[_0x63f9('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 13fd4b1..dbb51dd 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 _0x085e=['mail_accounts','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x085e,0x139));var _0xe085=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x085e[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xe085('0x0'));var util=require(_0xe085('0x1'));var logger=require('../../config/logger')(_0xe085('0x2'));var moment=require(_0xe085('0x3'));var BPromise=require(_0xe085('0x4'));var rp=require(_0xe085('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe085('0x6'));var attributes=require(_0xe085('0x7'));module[_0xe085('0x8')]=function(_0x3b28aa,_0x343a62){return _0x3b28aa[_0xe085('0x9')](_0xe085('0xa'),attributes,{'tableName':_0xe085('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76e6=['../../config/environment','define','mail_accounts','bluebird','request-promise','path','rimraf'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x76e6,0x96));var _0x676e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x76e6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x676e('0x0'));var rp=require(_0x676e('0x1'));var fs=require('fs');var path=require(_0x676e('0x2'));var rimraf=require(_0x676e('0x3'));var config=require(_0x676e('0x4'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x1a7e91,_0x4a94b8){return _0x1a7e91[_0x676e('0x5')]('MailAccount',attributes,{'tableName':_0x676e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 05e75f1..9db24ac 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 _0x41ac=['includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Smtp','get','omit','applications','list','orderBy','asc','autoclose','*,*,*,*','Applications','Contacts','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','attachments','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','catch','ShowMailAccount','find','NotifyMailAccount','mail','keys','CmContact','updatedAt','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x4df05a,_0x1e45e8){var _0x25a4ed=function(_0x10e206){while(--_0x10e206){_0x4df05a['push'](_0x4df05a['shift']());}};_0x25a4ed(++_0x1e45e8);}(_0x41ac,0x1d7));var _0xc41a=function(_0x198d4f,_0x407909){_0x198d4f=_0x198d4f-0x0;var _0x1f4783=_0x41ac[_0x198d4f];return _0x1f4783;};'use strict';var _=require(_0xc41a('0x0'));var util=require(_0xc41a('0x1'));var moment=require(_0xc41a('0x2'));var BPromise=require(_0xc41a('0x3'));var rs=require(_0xc41a('0x4'));var fs=require('fs');var Redis=require(_0xc41a('0x5'));var db=require(_0xc41a('0x6'))['db'];var utils=require(_0xc41a('0x7'));var logger=require('../../config/logger')(_0xc41a('0x8'));var config=require('../../config/environment');var jayson=require(_0xc41a('0x9'));var client=jayson[_0xc41a('0xa')][_0xc41a('0xb')]({'port':0x232c});config[_0xc41a('0xc')]=_[_0xc41a('0xd')](config[_0xc41a('0xc')],{'host':_0xc41a('0xe'),'port':0x18eb});var socket=require(_0xc41a('0xf'))(new Redis(config['redis']));require(_0xc41a('0x10'))['register'](socket);function respondWithRpcPromise(_0x29080f,_0x30ef08,_0x71f113){return new BPromise(function(_0x1c8328,_0x1fa8ae){return client['request'](_0x29080f,_0x71f113)[_0xc41a('0x11')](function(_0x2c5247){logger[_0xc41a('0x12')]('MailAccount,\x20%s,\x20%s',_0x30ef08,'request\x20sent');logger[_0xc41a('0x13')](_0xc41a('0x14'),_0x30ef08,_0xc41a('0x15'),JSON[_0xc41a('0x16')](_0x2c5247));if(_0x2c5247[_0xc41a('0x17')]){if(_0x2c5247[_0xc41a('0x17')][_0xc41a('0x18')]===0x1f4){logger[_0xc41a('0x17')](_0xc41a('0x19'),_0x30ef08,_0x2c5247['error'][_0xc41a('0x1a')]);return _0x1fa8ae(_0x2c5247[_0xc41a('0x17')]['message']);}logger[_0xc41a('0x17')]('MailAccount,\x20%s,\x20%s',_0x30ef08,_0x2c5247[_0xc41a('0x17')]['message']);return _0x1c8328(_0x2c5247['error'][_0xc41a('0x1a')]);}else{logger[_0xc41a('0x12')](_0xc41a('0x19'),_0x30ef08,_0xc41a('0x15'));_0x1c8328(_0x2c5247[_0xc41a('0x1b')]['message']);}})['catch'](function(_0x53021c){logger[_0xc41a('0x17')]('MailAccount,\x20%s,\x20%s',_0x30ef08,_0x53021c);_0x1fa8ae(_0x53021c);});});}exports[_0xc41a('0x1c')]=function(_0x18c82e){var _0x327b60=this;return new Promise(function(_0x1c1676,_0x193f7b){return db[_0xc41a('0x1d')][_0xc41a('0x1e')]({'raw':_0x18c82e[_0xc41a('0x1f')]?_0x18c82e[_0xc41a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x18c82e['options']?_0x18c82e[_0xc41a('0x1f')][_0xc41a('0x20')]||null:null,'attributes':_0x18c82e[_0xc41a('0x1f')]?_0x18c82e[_0xc41a('0x1f')][_0xc41a('0x21')]||null:null,'limit':_0x18c82e['options']?_0x18c82e[_0xc41a('0x1f')][_0xc41a('0x22')]||null:null,'include':_0x18c82e['options']?_0x18c82e[_0xc41a('0x1f')][_0xc41a('0x23')]?_[_0xc41a('0x24')](_0x18c82e['options'][_0xc41a('0x23')],function(_0x5a3c07){return{'model':db[_0x5a3c07[_0xc41a('0x25')]],'as':_0x5a3c07['as'],'attributes':_0x5a3c07[_0xc41a('0x21')],'include':_0x5a3c07[_0xc41a('0x23')]?_[_0xc41a('0x24')](_0x5a3c07['include'],function(_0x50bd7d){return{'model':db[_0x50bd7d[_0xc41a('0x25')]],'as':_0x50bd7d['as'],'attributes':_0x50bd7d['attributes'],'include':_0x50bd7d[_0xc41a('0x23')]?_[_0xc41a('0x24')](_0x50bd7d[_0xc41a('0x23')],function(_0x506e6d){return{'model':db[_0x506e6d['model']],'as':_0x506e6d['as'],'attributes':_0x506e6d[_0xc41a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc41a('0x11')](function(_0x5212a3){logger[_0xc41a('0x12')]('GetMailAccount',_0x18c82e);logger[_0xc41a('0x13')](_0xc41a('0x1c'),_0x18c82e,JSON['stringify'](_0x5212a3));_0x1c1676(_0x5212a3);})[_0xc41a('0x26')](function(_0x5346f5){logger[_0xc41a('0x17')](_0xc41a('0x1c'),_0x5346f5[_0xc41a('0x1a')],_0x18c82e);_0x193f7b(_0x327b60[_0xc41a('0x17')](0x1f4,_0x5346f5[_0xc41a('0x1a')]));});});};exports[_0xc41a('0x27')]=function(_0x35441b){var _0x386d16=this;return new Promise(function(_0x4b8169,_0x307e52){return db[_0xc41a('0x1d')][_0xc41a('0x28')]({'raw':_0x35441b[_0xc41a('0x1f')]?_0x35441b[_0xc41a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x35441b[_0xc41a('0x1f')]?_0x35441b['options'][_0xc41a('0x20')]||null:null,'attributes':_0x35441b[_0xc41a('0x1f')]?_0x35441b[_0xc41a('0x1f')][_0xc41a('0x21')]||null:null,'include':_0x35441b['options']?_0x35441b[_0xc41a('0x1f')]['include']?_['map'](_0x35441b[_0xc41a('0x1f')][_0xc41a('0x23')],function(_0x3ef20a){return{'model':db[_0x3ef20a[_0xc41a('0x25')]],'as':_0x3ef20a['as'],'attributes':_0x3ef20a[_0xc41a('0x21')],'include':_0x3ef20a[_0xc41a('0x23')]?_['map'](_0x3ef20a[_0xc41a('0x23')],function(_0x65d0b){return{'model':db[_0x65d0b[_0xc41a('0x25')]],'as':_0x65d0b['as'],'attributes':_0x65d0b[_0xc41a('0x21')],'include':_0x65d0b[_0xc41a('0x23')]?_[_0xc41a('0x24')](_0x65d0b[_0xc41a('0x23')],function(_0x147564){return{'model':db[_0x147564[_0xc41a('0x25')]],'as':_0x147564['as'],'attributes':_0x147564[_0xc41a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc41a('0x11')](function(_0x2ab139){logger[_0xc41a('0x12')]('ShowMailAccount',_0x35441b);logger[_0xc41a('0x13')](_0xc41a('0x27'),_0x35441b,JSON[_0xc41a('0x16')](_0x2ab139));_0x4b8169(_0x2ab139);})[_0xc41a('0x26')](function(_0x3ef3a9){logger[_0xc41a('0x17')](_0xc41a('0x27'),_0x3ef3a9[_0xc41a('0x1a')],_0x35441b);_0x307e52(_0x386d16[_0xc41a('0x17')](0x1f4,_0x3ef3a9[_0xc41a('0x1a')]));});});};exports[_0xc41a('0x29')]=function(_0x8d355c){var _0x29d140=this;return new Promise(function(_0x5f0366,_0x57d6e5){var _0x737b23={'body':_0x8d355c['body'],'channel':_0xc41a('0x2a')};var _0x1f4c3d=_['difference'](_[_0xc41a('0x2b')](db[_0xc41a('0x2c')]['rawAttributes']),['createdAt',_0xc41a('0x2d'),_0xc41a('0x2e'),_0xc41a('0x2f')]);var _0x42b1af=![];if(_0x8d355c['body']['id']){delete _0x8d355c[_0xc41a('0x30')]['id'];}if(_[_0xc41a('0x31')](_0x8d355c[_0xc41a('0x30')][_0xc41a('0x32')])){return _0x57d6e5(_0x29d140[_0xc41a('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xc41a('0x31')](_0x8d355c[_0xc41a('0x30')][_0xc41a('0x30')])||_0x8d355c[_0xc41a('0x30')][_0xc41a('0x30')]===''){return _0x57d6e5(_0x29d140['error'](0x1f4,_0xc41a('0x33')));}if(_[_0xc41a('0x31')](_0x8d355c[_0xc41a('0x30')][_0xc41a('0x34')])){return _0x57d6e5(_0x29d140[_0xc41a('0x17')](0x1f4,_0xc41a('0x35')+_0x1f4c3d));}if(!_[_0xc41a('0x36')](_0x1f4c3d,_0x8d355c[_0xc41a('0x30')][_0xc41a('0x34')])){return _0x57d6e5(_0x29d140[_0xc41a('0x17')](0x1f4,_0xc41a('0x37')+_0x1f4c3d));}var _0x5de26e={};_0x5de26e[_0x8d355c['body'][_0xc41a('0x34')]]=_0x8d355c['body'][_0xc41a('0x32')];return db[_0xc41a('0x1d')][_0xc41a('0x28')]({'where':{'id':_0x8d355c[_0xc41a('0x38')]['id']},'include':[{'model':db[_0xc41a('0x39')],'as':_0xc41a('0x3a'),'include':[{'model':db[_0xc41a('0x2c')],'as':'Contacts','where':_0x5de26e,'limit':0x1,'order':[['updatedAt',_0xc41a('0x3b')]]}]},{'model':db[_0xc41a('0x3c')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xc41a('0x3d')}]})[_0xc41a('0x11')](function(_0x43c977){if(_0x43c977&&_0x43c977['List']){var _0x521055=_0x43c977[_0xc41a('0x3e')]({'plain':!![]});_0x737b23[_0xc41a('0x38')]=_[_0xc41a('0x3f')](_0x521055,['Applications',_0xc41a('0x3a')]);_0x737b23[_0xc41a('0x40')]=_0x521055['Applications'];_0x737b23[_0xc41a('0x41')]=_0x521055['List'];_0x737b23[_0xc41a('0x40')]=_[_0xc41a('0x42')](_0x737b23[_0xc41a('0x40')],['priority'],[_0xc41a('0x43')]);if(_0x737b23[_0xc41a('0x38')]&&_0x737b23[_0xc41a('0x38')][_0xc41a('0x44')]){_0x737b23[_0xc41a('0x40')]['push']({'id':0x0,'priority':_0x737b23['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':_0xc41a('0x45')});}if(_0x737b23[_0xc41a('0x38')][_0xc41a('0x46')]){delete _0x737b23[_0xc41a('0x38')][_0xc41a('0x46')];}if(_0x737b23[_0xc41a('0x38')][_0xc41a('0x3a')]){delete _0x737b23[_0xc41a('0x38')][_0xc41a('0x3a')];}if(_0x521055[_0xc41a('0x3a')][_0xc41a('0x47')][_0xc41a('0x48')]){return _0x521055[_0xc41a('0x3a')][_0xc41a('0x47')][0x0];}var _0x4d5913=_[_0xc41a('0xd')](_0x8d355c['body'],{'firstName':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x32')],'ListId':_0x521055['ListId']});_0x4d5913[_0x8d355c[_0xc41a('0x30')]['mapKey']]=_0x8d355c[_0xc41a('0x30')][_0xc41a('0x32')];return db[_0xc41a('0x2c')][_0xc41a('0x49')](_0x4d5913);}else{throw new Error(_0xc41a('0x4a'));}})[_0xc41a('0x11')](function(_0xa2f2b0){_0x737b23[_0xc41a('0x4b')]=_0xa2f2b0;if(_0xa2f2b0){if(!_0x8d355c['body'][_0xc41a('0x1a')][_0xc41a('0x4c')]){_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')][_0xc41a('0x4c')]=rs[_0xc41a('0x4d')]()+'\x20'+_0x8d355c['body'][_0xc41a('0x1a')][_0xc41a('0x32')];}var _0x4e4811={'ContactId':_0xa2f2b0['id'],'MailAccountId':_0x8d355c[_0xc41a('0x38')]['id'],'inReplyTo':_0x8d355c[_0xc41a('0x30')]['message'][_0xc41a('0x4c')],'to':_0x8d355c['body'][_0xc41a('0x1a')][_0xc41a('0x32')],'cc':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')]['cc'],'subject':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')][_0xc41a('0x4e')],'attach':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')][_0xc41a('0x4f')],'lastMsgAt':moment()[_0xc41a('0x50')](_0xc41a('0x51')),'lastMsgDirection':'in'};return db[_0xc41a('0x52')][_0xc41a('0x28')]({'where':{'closed':![],'MailAccountId':_0x8d355c[_0xc41a('0x38')]['id']},'include':[{'model':db[_0xc41a('0x53')],'as':_0xc41a('0x54'),'attributes':[_0xc41a('0x4c')],'where':{'messageId':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')][_0xc41a('0x55')]}}]})[_0xc41a('0x11')](function(_0x1d860e){if(_0x1d860e){return[_0x1d860e,![]];}return db['MailInteraction'][_0xc41a('0x49')](_0x4e4811)['then'](function(_0x28c0df){return[_0x28c0df,!![]];});});}else{throw new Error(_0xc41a('0x56'));}})[_0xc41a('0x57')](function(_0x1b04d9,_0x4066b2){if(_0x1b04d9){_0x42b1af=_0x4066b2;if(!_0x4066b2){return _0x1b04d9[_0xc41a('0x58')]({'inReplyTo':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')][_0xc41a('0x4c')],'to':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')][_0xc41a('0x32')],'cc':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')]['cc'],'subject':_0x8d355c['body'][_0xc41a('0x1a')][_0xc41a('0x4e')],'attach':_0x1b04d9[_0xc41a('0x4f')]?_0x1b04d9['attach']:_0x8d355c['body'][_0xc41a('0x1a')][_0xc41a('0x4f')],'substatus':null,'substatusAt':moment()['format'](_0xc41a('0x51')),'lastMsgAt':moment()[_0xc41a('0x50')](_0xc41a('0x51')),'lastMsgDirection':'in'});}else{return _0x1b04d9;}}})[_0xc41a('0x11')](function(_0x159a81){_0x737b23[_0xc41a('0x59')]=_0x159a81['get']({'plain':!![]});_0x737b23[_0xc41a('0x59')][_0xc41a('0x5a')]=_0x42b1af;return db[_0xc41a('0x53')][_0xc41a('0x49')]({'body':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x30')],'MailAccountId':_0x8d355c[_0xc41a('0x38')]['id'],'MailInteractionId':_0x159a81['id'],'direction':'in','ContactId':_0x737b23[_0xc41a('0x4b')]['id'],'messageId':_0x8d355c[_0xc41a('0x30')]['message'][_0xc41a('0x4c')],'from':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')]['from'],'to':_0x8d355c[_0xc41a('0x30')]['message']['to'],'cc':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')]['cc'],'subject':_0x8d355c['body']['message'][_0xc41a('0x4e')],'attach':_0x8d355c[_0xc41a('0x30')]['message']['attach'],'Attachments':_0x8d355c['body']['message'][_0xc41a('0x5b')],'originTo':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')]['originTo'],'originCc':_0x8d355c[_0xc41a('0x30')]['message'][_0xc41a('0x5c')],'bcc':_0x8d355c['body'][_0xc41a('0x1a')][_0xc41a('0x5d')],'ChatWebsiteId':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x8d355c[_0xc41a('0x30')][_0xc41a('0x1a')][_0xc41a('0x5e')]||_0xc41a('0x5f'),'ChatOfflineMessageId':_0x8d355c['body'][_0xc41a('0x1a')][_0xc41a('0x60')]||null},{'include':[{'model':db[_0xc41a('0x61')],'as':'Attachments'}]});})[_0xc41a('0x11')](function(_0x3e776e){_0x737b23[_0xc41a('0x1a')]=_0x3e776e;if(_0x737b23['interaction'][_0xc41a('0x62')]){return db[_0xc41a('0x63')][_0xc41a('0x28')]({'attributes':['id',_0xc41a('0x64')],'where':{'id':_0x737b23['interaction'][_0xc41a('0x62')]}})[_0xc41a('0x11')](function(_0x1479b6){if(_0x1479b6){_0x737b23[_0xc41a('0x40')][_0xc41a('0x65')]({'id':0x0,'priority':0x0,'app':_0xc41a('0x66'),'appdata':_0x1479b6[_0xc41a('0x64')]+','+(_0x737b23[_0xc41a('0x38')]['waitForTheAssignedAgent']||0xa),'interval':_0xc41a('0x45')});}return respondWithRpcPromise(_0xc41a('0x67'),_0xc41a('0x68'),_0x737b23);});}return respondWithRpcPromise(_0xc41a('0x67'),_0xc41a('0x68'),_0x737b23);})[_0xc41a('0x11')](function(_0x341ce9){_0x5f0366(_0x341ce9);})[_0xc41a('0x26')](function(_0x1c9b53){_0x57d6e5(_0x29d140['error'](0x1f4,_0x1c9b53[_0xc41a('0x1a')]));});});}; \ No newline at end of file +var _0x8638=['asc','autoclose','push','length','close','*,*,*,*','defaults','ListId','create','List\x20not\x20found','contact','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','messageId','Contact\x20not\x20found','update','format','created','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','interaction','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowMailAccount','find','where','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','orderBy'];(function(_0x262996,_0x55f758){var _0x5037fe=function(_0x1c6daf){while(--_0x1c6daf){_0x262996['push'](_0x262996['shift']());}};_0x5037fe(++_0x55f758);}(_0x8638,0x1db));var _0x8863=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x8638[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x8863('0x0'));var util=require(_0x8863('0x1'));var moment=require(_0x8863('0x2'));var BPromise=require('bluebird');var rs=require(_0x8863('0x3'));var fs=require('fs');var Redis=require(_0x8863('0x4'));var db=require(_0x8863('0x5'))['db'];var utils=require(_0x8863('0x6'));var logger=require(_0x8863('0x7'))(_0x8863('0x8'));var config=require(_0x8863('0x9'));var jayson=require(_0x8863('0xa'));var client=jayson[_0x8863('0xb')][_0x8863('0xc')]({'port':0x232c});config[_0x8863('0xd')]=_['defaults'](config[_0x8863('0xd')],{'host':_0x8863('0xe'),'port':0x18eb});var socket=require(_0x8863('0xf'))(new Redis(config[_0x8863('0xd')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0xc86614,_0x1c6b30,_0x208776){return new BPromise(function(_0xd64c23,_0x3afd40){return client[_0x8863('0x10')](_0xc86614,_0x208776)[_0x8863('0x11')](function(_0x2ad2be){logger[_0x8863('0x12')](_0x8863('0x13'),_0x1c6b30,'request\x20sent');logger[_0x8863('0x14')](_0x8863('0x15'),_0x1c6b30,_0x8863('0x16'),JSON['stringify'](_0x2ad2be));if(_0x2ad2be[_0x8863('0x17')]){if(_0x2ad2be['error'][_0x8863('0x18')]===0x1f4){logger[_0x8863('0x17')](_0x8863('0x13'),_0x1c6b30,_0x2ad2be['error']['message']);return _0x3afd40(_0x2ad2be[_0x8863('0x17')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1c6b30,_0x2ad2be['error'][_0x8863('0x19')]);return _0xd64c23(_0x2ad2be[_0x8863('0x17')][_0x8863('0x19')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x1c6b30,'request\x20sent');_0xd64c23(_0x2ad2be[_0x8863('0x1a')][_0x8863('0x19')]);}})[_0x8863('0x1b')](function(_0x46dcb7){logger[_0x8863('0x17')](_0x8863('0x13'),_0x1c6b30,_0x46dcb7);_0x3afd40(_0x46dcb7);});});}exports[_0x8863('0x1c')]=function(_0x27f2d2){var _0x1f6ecb=this;return new Promise(function(_0x597a19,_0xb6dcfb){return db[_0x8863('0x1d')][_0x8863('0x1e')]({'raw':_0x27f2d2['options']?_0x27f2d2[_0x8863('0x1f')][_0x8863('0x20')]===undefined?!![]:![]:!![],'where':_0x27f2d2[_0x8863('0x1f')]?_0x27f2d2['options']['where']||null:null,'attributes':_0x27f2d2[_0x8863('0x1f')]?_0x27f2d2[_0x8863('0x1f')][_0x8863('0x21')]||null:null,'limit':_0x27f2d2['options']?_0x27f2d2['options'][_0x8863('0x22')]||null:null,'include':_0x27f2d2[_0x8863('0x1f')]?_0x27f2d2[_0x8863('0x1f')][_0x8863('0x23')]?_[_0x8863('0x24')](_0x27f2d2[_0x8863('0x1f')][_0x8863('0x23')],function(_0x2d4218){return{'model':db[_0x2d4218[_0x8863('0x25')]],'as':_0x2d4218['as'],'attributes':_0x2d4218[_0x8863('0x21')],'include':_0x2d4218[_0x8863('0x23')]?_[_0x8863('0x24')](_0x2d4218[_0x8863('0x23')],function(_0x5ecce9){return{'model':db[_0x5ecce9[_0x8863('0x25')]],'as':_0x5ecce9['as'],'attributes':_0x5ecce9[_0x8863('0x21')],'include':_0x5ecce9[_0x8863('0x23')]?_[_0x8863('0x24')](_0x5ecce9['include'],function(_0x46a868){return{'model':db[_0x46a868[_0x8863('0x25')]],'as':_0x46a868['as'],'attributes':_0x46a868[_0x8863('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8863('0x11')](function(_0x29006f){logger[_0x8863('0x12')](_0x8863('0x1c'),_0x27f2d2);logger['debug']('GetMailAccount',_0x27f2d2,JSON[_0x8863('0x26')](_0x29006f));_0x597a19(_0x29006f);})['catch'](function(_0x1af493){logger['error'](_0x8863('0x1c'),_0x1af493['message'],_0x27f2d2);_0xb6dcfb(_0x1f6ecb[_0x8863('0x17')](0x1f4,_0x1af493[_0x8863('0x19')]));});});};exports[_0x8863('0x27')]=function(_0x76009c){var _0x365193=this;return new Promise(function(_0x299c7f,_0x4f1a0a){return db[_0x8863('0x1d')][_0x8863('0x28')]({'raw':_0x76009c[_0x8863('0x1f')]?_0x76009c[_0x8863('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x76009c[_0x8863('0x1f')]?_0x76009c[_0x8863('0x1f')][_0x8863('0x29')]||null:null,'attributes':_0x76009c[_0x8863('0x1f')]?_0x76009c[_0x8863('0x1f')][_0x8863('0x21')]||null:null,'include':_0x76009c[_0x8863('0x1f')]?_0x76009c[_0x8863('0x1f')]['include']?_[_0x8863('0x24')](_0x76009c[_0x8863('0x1f')]['include'],function(_0x3bb2e1){return{'model':db[_0x3bb2e1['model']],'as':_0x3bb2e1['as'],'attributes':_0x3bb2e1[_0x8863('0x21')],'include':_0x3bb2e1[_0x8863('0x23')]?_[_0x8863('0x24')](_0x3bb2e1[_0x8863('0x23')],function(_0x5a25c9){return{'model':db[_0x5a25c9['model']],'as':_0x5a25c9['as'],'attributes':_0x5a25c9[_0x8863('0x21')],'include':_0x5a25c9['include']?_[_0x8863('0x24')](_0x5a25c9[_0x8863('0x23')],function(_0x213e80){return{'model':db[_0x213e80[_0x8863('0x25')]],'as':_0x213e80['as'],'attributes':_0x213e80[_0x8863('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x488794){logger[_0x8863('0x12')]('ShowMailAccount',_0x76009c);logger[_0x8863('0x14')](_0x8863('0x27'),_0x76009c,JSON[_0x8863('0x26')](_0x488794));_0x299c7f(_0x488794);})[_0x8863('0x1b')](function(_0x3593c1){logger[_0x8863('0x17')]('ShowMailAccount',_0x3593c1[_0x8863('0x19')],_0x76009c);_0x4f1a0a(_0x365193['error'](0x1f4,_0x3593c1[_0x8863('0x19')]));});});};exports[_0x8863('0x2a')]=function(_0x26bbf4){var _0x48c3bf=this;return new Promise(function(_0x456013,_0x317db7){var _0x56d351={'body':_0x26bbf4[_0x8863('0x2b')],'channel':_0x8863('0x2c')};var _0x1d22f5=_[_0x8863('0x2d')](_['keys'](db[_0x8863('0x2e')][_0x8863('0x2f')]),[_0x8863('0x30'),_0x8863('0x31'),_0x8863('0x32'),'ListId']);var _0x26d5c7=![];if(_0x26bbf4[_0x8863('0x2b')]['id']){delete _0x26bbf4[_0x8863('0x2b')]['id'];}if(_[_0x8863('0x33')](_0x26bbf4[_0x8863('0x2b')]['from'])){return _0x317db7(_0x48c3bf[_0x8863('0x17')](0x1f4,_0x8863('0x34')));}if(_[_0x8863('0x33')](_0x26bbf4[_0x8863('0x2b')]['body'])||_0x26bbf4[_0x8863('0x2b')][_0x8863('0x2b')]===''){return _0x317db7(_0x48c3bf['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8863('0x33')](_0x26bbf4[_0x8863('0x2b')][_0x8863('0x35')])){return _0x317db7(_0x48c3bf[_0x8863('0x17')](0x1f4,_0x8863('0x36')+_0x1d22f5));}if(!_[_0x8863('0x37')](_0x1d22f5,_0x26bbf4[_0x8863('0x2b')][_0x8863('0x35')])){return _0x317db7(_0x48c3bf[_0x8863('0x17')](0x1f4,_0x8863('0x38')+_0x1d22f5));}var _0x1d2229={};_0x1d2229[_0x26bbf4[_0x8863('0x2b')][_0x8863('0x35')]]=_0x26bbf4['body'][_0x8863('0x39')];return db[_0x8863('0x1d')][_0x8863('0x28')]({'where':{'id':_0x26bbf4[_0x8863('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0x8863('0x3b'),'include':[{'model':db['CmContact'],'as':_0x8863('0x3c'),'where':_0x1d2229,'limit':0x1,'order':[[_0x8863('0x31'),'DESC']]}]},{'model':db[_0x8863('0x3d')],'as':_0x8863('0x3e')},{'model':db[_0x8863('0x3f')],'as':_0x8863('0x40')}]})[_0x8863('0x11')](function(_0x89ba18){if(_0x89ba18&&_0x89ba18[_0x8863('0x3b')]){var _0x1b07c1=_0x89ba18[_0x8863('0x41')]({'plain':!![]});_0x56d351['account']=_[_0x8863('0x42')](_0x1b07c1,[_0x8863('0x3e'),'List']);_0x56d351['applications']=_0x1b07c1[_0x8863('0x3e')];_0x56d351[_0x8863('0x43')]=_0x1b07c1[_0x8863('0x3b')];_0x56d351[_0x8863('0x44')]=_[_0x8863('0x45')](_0x56d351[_0x8863('0x44')],['priority'],[_0x8863('0x46')]);if(_0x56d351[_0x8863('0x3a')]&&_0x56d351[_0x8863('0x3a')][_0x8863('0x47')]){_0x56d351[_0x8863('0x44')][_0x8863('0x48')]({'id':0x0,'priority':_0x56d351[_0x8863('0x44')][_0x8863('0x49')]+0x1,'app':_0x8863('0x4a'),'appdata':_0x8863('0x47'),'interval':_0x8863('0x4b')});}if(_0x56d351[_0x8863('0x3a')][_0x8863('0x3e')]){delete _0x56d351[_0x8863('0x3a')]['Applications'];}if(_0x56d351[_0x8863('0x3a')][_0x8863('0x3b')]){delete _0x56d351[_0x8863('0x3a')][_0x8863('0x3b')];}if(_0x1b07c1[_0x8863('0x3b')][_0x8863('0x3c')]['length']){return _0x1b07c1[_0x8863('0x3b')][_0x8863('0x3c')][0x0];}var _0x17faf3=_[_0x8863('0x4c')](_0x26bbf4[_0x8863('0x2b')],{'firstName':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x39')],'ListId':_0x1b07c1[_0x8863('0x4d')]});_0x17faf3[_0x26bbf4['body'][_0x8863('0x35')]]=_0x26bbf4['body']['from'];return db[_0x8863('0x2e')][_0x8863('0x4e')](_0x17faf3);}else{throw new Error(_0x8863('0x4f'));}})[_0x8863('0x11')](function(_0x1547eb){_0x56d351[_0x8863('0x50')]=_0x1547eb;if(_0x1547eb){if(!_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')]['messageId']){_0x26bbf4['body'][_0x8863('0x19')]['messageId']=rs[_0x8863('0x51')]()+'\x20'+_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')]['from'];}var _0x5519a4={'ContactId':_0x1547eb['id'],'MailAccountId':_0x26bbf4[_0x8863('0x3a')]['id'],'inReplyTo':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')]['messageId'],'to':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x39')],'cc':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')]['cc'],'subject':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x52')],'attach':_0x26bbf4['body'][_0x8863('0x19')][_0x8863('0x53')],'lastMsgAt':moment()['format'](_0x8863('0x54')),'lastMsgDirection':'in'};return db[_0x8863('0x55')][_0x8863('0x28')]({'where':{'closed':![],'MailAccountId':_0x26bbf4['account']['id']},'include':[{'model':db[_0x8863('0x56')],'as':_0x8863('0x57'),'attributes':[_0x8863('0x58')],'where':{'messageId':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')]['inReplyTo']}}]})['then'](function(_0x557953){if(_0x557953){return[_0x557953,![]];}return db[_0x8863('0x55')]['create'](_0x5519a4)[_0x8863('0x11')](function(_0x296fe6){return[_0x296fe6,!![]];});});}else{throw new Error(_0x8863('0x59'));}})['spread'](function(_0x1c71a8,_0x537057){if(_0x1c71a8){_0x26d5c7=_0x537057;if(!_0x537057){return _0x1c71a8[_0x8863('0x5a')]({'inReplyTo':_0x26bbf4[_0x8863('0x2b')]['message'][_0x8863('0x58')],'to':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x39')],'cc':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')]['cc'],'subject':_0x26bbf4[_0x8863('0x2b')]['message'][_0x8863('0x52')],'attach':_0x1c71a8[_0x8863('0x53')]?_0x1c71a8[_0x8863('0x53')]:_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x53')],'substatus':null,'substatusAt':moment()[_0x8863('0x5b')](_0x8863('0x54')),'lastMsgAt':moment()['format'](_0x8863('0x54')),'lastMsgDirection':'in'});}else{return _0x1c71a8;}}})[_0x8863('0x11')](function(_0x212dc1){_0x56d351['interaction']=_0x212dc1['get']({'plain':!![]});_0x56d351['interaction'][_0x8863('0x5c')]=_0x26d5c7;return db[_0x8863('0x56')]['create']({'body':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x2b')],'MailAccountId':_0x26bbf4[_0x8863('0x3a')]['id'],'MailInteractionId':_0x212dc1['id'],'direction':'in','ContactId':_0x56d351[_0x8863('0x50')]['id'],'messageId':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x58')],'from':_0x26bbf4['body'][_0x8863('0x19')][_0x8863('0x39')],'to':_0x26bbf4['body'][_0x8863('0x19')]['to'],'cc':_0x26bbf4[_0x8863('0x2b')]['message']['cc'],'subject':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x52')],'attach':_0x26bbf4['body'][_0x8863('0x19')][_0x8863('0x53')],'Attachments':_0x26bbf4[_0x8863('0x2b')]['message'][_0x8863('0x5d')],'originTo':_0x26bbf4['body'][_0x8863('0x19')]['originTo'],'originCc':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x5e')],'bcc':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x5f')],'ChatWebsiteId':_0x26bbf4[_0x8863('0x2b')][_0x8863('0x19')][_0x8863('0x60')]||null,'originChannel':_0x26bbf4[_0x8863('0x2b')]['message'][_0x8863('0x61')]||_0x8863('0x62'),'ChatOfflineMessageId':_0x26bbf4['body'][_0x8863('0x19')][_0x8863('0x63')]||null},{'include':[{'model':db['Attachment'],'as':_0x8863('0x64')}]});})[_0x8863('0x11')](function(_0x25abea){_0x56d351[_0x8863('0x19')]=_0x25abea;if(_0x56d351['interaction'][_0x8863('0x65')]){return db[_0x8863('0x66')][_0x8863('0x28')]({'attributes':['id',_0x8863('0x67')],'where':{'id':_0x56d351[_0x8863('0x68')]['UserId']}})['then'](function(_0x43189d){if(_0x43189d){_0x56d351[_0x8863('0x44')][_0x8863('0x69')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43189d['name']+','+(_0x56d351[_0x8863('0x3a')][_0x8863('0x6a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8863('0x6b'),_0x8863('0x6c'),_0x56d351);});}return respondWithRpcPromise(_0x8863('0x6b'),_0x8863('0x6c'),_0x56d351);})[_0x8863('0x11')](function(_0x2e7ecf){_0x456013(_0x2e7ecf);})[_0x8863('0x1b')](function(_0x502ccf){_0x317db7(_0x48c3bf[_0x8863('0x17')](0x1f4,_0x502ccf[_0x8863('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5b20f36..d8f53ba 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 _0xb240=['remove','update','emit','removeListener','register','mailAccount:','./mailAccount.events','save'];(function(_0x16d01d,_0x2d33ea){var _0x2b590d=function(_0x42426d){while(--_0x42426d){_0x16d01d['push'](_0x16d01d['shift']());}};_0x2b590d(++_0x2d33ea);}(_0xb240,0x7e));var _0x0b24=function(_0x5e6c65,_0x1c3613){_0x5e6c65=_0x5e6c65-0x0;var _0x4bb229=_0xb240[_0x5e6c65];return _0x4bb229;};'use strict';var MailAccountEvents=require(_0x0b24('0x0'));var events=[_0x0b24('0x1'),_0x0b24('0x2'),_0x0b24('0x3')];function createListener(_0x28ed39,_0x2c87e6){return function(_0x219e2d){_0x2c87e6[_0x0b24('0x4')](_0x28ed39,_0x219e2d);};}function removeListener(_0x30083a,_0x567c96){return function(){MailAccountEvents[_0x0b24('0x5')](_0x30083a,_0x567c96);};}exports[_0x0b24('0x6')]=function(_0x21c0aa){for(var _0x1cbc06=0x0,_0x162a50=events['length'];_0x1cbc06<_0x162a50;_0x1cbc06++){var _0x238a19=events[_0x1cbc06];var _0x34be24=createListener(_0x0b24('0x7')+_0x238a19,_0x21c0aa);MailAccountEvents['on'](_0x238a19,_0x34be24);}}; \ No newline at end of file +var _0x723b=['./mailAccount.events','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x11ac13,_0x4e3d72){var _0x4f37df=function(_0x15f708){while(--_0x15f708){_0x11ac13['push'](_0x11ac13['shift']());}};_0x4f37df(++_0x4e3d72);}(_0x723b,0x120));var _0xb723=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x723b[_0x20a584];return _0x4b41a8;};'use strict';var MailAccountEvents=require(_0xb723('0x0'));var events=['save',_0xb723('0x1'),_0xb723('0x2')];function createListener(_0x174476,_0x395c17){return function(_0x1c5e28){_0x395c17[_0xb723('0x3')](_0x174476,_0x1c5e28);};}function removeListener(_0x1c0b67,_0x46e339){return function(){MailAccountEvents[_0xb723('0x4')](_0x1c0b67,_0x46e339);};}exports[_0xb723('0x5')]=function(_0xbdc793){for(var _0x1c5890=0x0,_0x5b34e2=events[_0xb723('0x6')];_0x1c5890<_0x5b34e2;_0x1c5890++){var _0x1389f4=events[_0x1c5890];var _0x1aec20=createListener(_0xb723('0x7')+_0x1389f4,_0xbdc793);MailAccountEvents['on'](_0x1389f4,_0x1aec20);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 11c840d..8fea826 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 _0x3044=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','show','put','isAuthenticated','update','delete','exports'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x3044,0xa8));var _0x4304=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x3044[_0x209ec9];return _0x129b1b;};'use strict';var multer=require('multer');var util=require(_0x4304('0x0'));var path=require(_0x4304('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4304('0x2')]();var fs_extra=require(_0x4304('0x3'));var auth=require(_0x4304('0x4'));var interaction=require(_0x4304('0x5'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x4304('0x6')](_0x4304('0x7'),auth['isAuthenticated'](),controller[_0x4304('0x8')]);router[_0x4304('0x9')](_0x4304('0x7'),auth[_0x4304('0xa')](),controller[_0x4304('0xb')]);router[_0x4304('0xc')](_0x4304('0x7'),auth[_0x4304('0xa')](),controller['destroy']);module[_0x4304('0xd')]=router; \ No newline at end of file +var _0x69ef=['isAuthenticated','show','put','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x69ef,0x18c));var _0xf69e=function(_0x129f03,_0x47069f){_0x129f03=_0x129f03-0x0;var _0x55448f=_0x69ef[_0x129f03];return _0x55448f;};'use strict';var multer=require(_0xf69e('0x0'));var util=require(_0xf69e('0x1'));var path=require(_0xf69e('0x2'));var timeout=require(_0xf69e('0x3'));var express=require('express');var router=express[_0xf69e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf69e('0x5'));var interaction=require(_0xf69e('0x6'));var config=require(_0xf69e('0x7'));var controller=require('./mailApplication.controller');router[_0xf69e('0x8')]('/:id',auth[_0xf69e('0x9')](),controller[_0xf69e('0xa')]);router[_0xf69e('0xb')]('/:id',auth[_0xf69e('0x9')](),controller['update']);router[_0xf69e('0xc')](_0xf69e('0xd'),auth[_0xf69e('0x9')](),controller[_0xf69e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cae554c..d52df18 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 _0x9da2=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x8a8e8a,_0x4a4132){var _0x593206=function(_0x3fd804){while(--_0x3fd804){_0x8a8e8a['push'](_0x8a8e8a['shift']());}};_0x593206(++_0x4a4132);}(_0x9da2,0xfc));var _0x29da=function(_0x1bc4de,_0x358405){_0x1bc4de=_0x1bc4de-0x0;var _0xb73fcf=_0x9da2[_0x1bc4de];return _0xb73fcf;};'use strict';var Sequelize=require(_0x29da('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x29da('0x1')],'allowNull':![],'defaultValue':_0x29da('0x2')},'appdata':{'type':Sequelize[_0x29da('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x29da('0x1')],'defaultValue':_0x29da('0x4')}}; \ No newline at end of file +var _0x6d7f=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x44e7d2,_0x350a6d){var _0x142074=function(_0x1e96dc){while(--_0x1e96dc){_0x44e7d2['push'](_0x44e7d2['shift']());}};_0x142074(++_0x350a6d);}(_0x6d7f,0xb3));var _0xf6d7=function(_0x26d7c8,_0x300583){_0x26d7c8=_0x26d7c8-0x0;var _0x317d15=_0x6d7f[_0x26d7c8];return _0x317d15;};'use strict';var Sequelize=require(_0xf6d7('0x0'));module[_0xf6d7('0x1')]={'priority':{'type':Sequelize[_0xf6d7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf6d7('0x3')],'allowNull':![],'defaultValue':_0xf6d7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf6d7('0x3')],'defaultValue':_0xf6d7('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b02f185..269f814 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xaa88[_0x39d544];return _0x5a5ff2;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4b90c2,_0xaae537){var _0x59b4c0=function(_0x3c1c1e){while(--_0x3c1c1e){_0x4b90c2['push'](_0x4b90c2['shift']());}};_0x59b4c0(++_0xaae537);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2391dc,_0x52686e){_0x2391dc=_0x2391dc-0x0;var _0x4468d8=_0x9bde[_0x2391dc];return _0x4468d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index bcf27f3..4b7a8ee 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 _0x82d4=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x3c5206,_0x5cdbc3){var _0x299fe7=function(_0x289938){while(--_0x289938){_0x3c5206['push'](_0x3c5206['shift']());}};_0x299fe7(++_0x5cdbc3);}(_0x82d4,0x195));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x482d('0x0'));var util=require(_0x482d('0x1'));var logger=require('../../config/logger')(_0x482d('0x2'));var moment=require(_0x482d('0x3'));var BPromise=require(_0x482d('0x4'));var rp=require(_0x482d('0x5'));var fs=require('fs');var path=require(_0x482d('0x6'));var rimraf=require(_0x482d('0x7'));var config=require(_0x482d('0x8'));var attributes=require(_0x482d('0x9'));module[_0x482d('0xa')]=function(_0x5c4d98,_0xa6e840){return _0x5c4d98[_0x482d('0xb')](_0x482d('0xc'),attributes,{'tableName':_0x482d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x482d('0xe'),'collate':_0x482d('0xf')});}; \ No newline at end of file +var _0x91e9=['rimraf','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path'];(function(_0x56b613,_0x4b6720){var _0x456efd=function(_0xa2da71){while(--_0xa2da71){_0x56b613['push'](_0x56b613['shift']());}};_0x456efd(++_0x4b6720);}(_0x91e9,0x1e4));var _0x991e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x91e9[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x991e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x991e('0x1'));var moment=require(_0x991e('0x2'));var BPromise=require(_0x991e('0x3'));var rp=require(_0x991e('0x4'));var fs=require('fs');var path=require(_0x991e('0x5'));var rimraf=require(_0x991e('0x6'));var config=require('../../config/environment');var attributes=require(_0x991e('0x7'));module[_0x991e('0x8')]=function(_0x1a5e50,_0x5d51fb){return _0x1a5e50[_0x991e('0x9')](_0x991e('0xa'),attributes,{'tableName':_0x991e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x991e('0xc'),'collate':_0x991e('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b4816fc..325391a 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 _0x8779=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailApplication','update','body','options','where','attributes','limit','UpdateMailApplication','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s'];(function(_0x382166,_0x1918df){var _0x1ccf35=function(_0x148bee){while(--_0x148bee){_0x382166['push'](_0x382166['shift']());}};_0x1ccf35(++_0x1918df);}(_0x8779,0x1c3));var _0x9877=function(_0x2dc66f,_0x113b12){_0x2dc66f=_0x2dc66f-0x0;var _0xc170ae=_0x8779[_0x2dc66f];return _0xc170ae;};'use strict';var _=require(_0x9877('0x0'));var util=require('util');var moment=require(_0x9877('0x1'));var BPromise=require(_0x9877('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9877('0x3'));var db=require(_0x9877('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9877('0x5'));var jayson=require(_0x9877('0x6'));var client=jayson[_0x9877('0x7')][_0x9877('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2aee60,_0x54cb4d,_0x99d4d){return new BPromise(function(_0x58ff01,_0xdec1d0){return client[_0x9877('0x9')](_0x2aee60,_0x99d4d)[_0x9877('0xa')](function(_0x5ec89a){logger[_0x9877('0xb')](_0x9877('0xc'),_0x54cb4d,_0x9877('0xd'));logger[_0x9877('0xe')](_0x9877('0xf'),_0x54cb4d,_0x9877('0xd'),JSON[_0x9877('0x10')](_0x5ec89a));if(_0x5ec89a[_0x9877('0x11')]){if(_0x5ec89a[_0x9877('0x11')]['code']===0x1f4){logger[_0x9877('0x11')](_0x9877('0xc'),_0x54cb4d,_0x5ec89a[_0x9877('0x11')][_0x9877('0x12')]);return _0xdec1d0(_0x5ec89a['error'][_0x9877('0x12')]);}logger['error'](_0x9877('0xc'),_0x54cb4d,_0x5ec89a['error'][_0x9877('0x12')]);return _0x58ff01(_0x5ec89a[_0x9877('0x11')][_0x9877('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x54cb4d,_0x9877('0xd'));_0x58ff01(_0x5ec89a[_0x9877('0x13')][_0x9877('0x12')]);}})[_0x9877('0x14')](function(_0x286d96){logger[_0x9877('0x11')](_0x9877('0xc'),_0x54cb4d,_0x286d96);_0xdec1d0(_0x286d96);});});}exports['UpdateMailApplication']=function(_0x5d392a){var _0x3d45a1=this;return new Promise(function(_0x5ca1fa,_0x618cbf){return db[_0x9877('0x15')][_0x9877('0x16')](_0x5d392a[_0x9877('0x17')],{'raw':_0x5d392a[_0x9877('0x18')]?_0x5d392a[_0x9877('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d392a[_0x9877('0x18')]?_0x5d392a['options'][_0x9877('0x19')]||null:null,'attributes':_0x5d392a['options']?_0x5d392a[_0x9877('0x18')][_0x9877('0x1a')]||null:null,'limit':_0x5d392a[_0x9877('0x18')]?_0x5d392a[_0x9877('0x18')][_0x9877('0x1b')]||null:null})['then'](function(_0x241e6d){logger[_0x9877('0xb')](_0x9877('0x1c'),_0x5d392a);logger[_0x9877('0xe')](_0x9877('0x1c'),_0x5d392a,JSON['stringify'](_0x241e6d));_0x5ca1fa(_0x241e6d);})['catch'](function(_0xef0bb){logger[_0x9877('0x11')](_0x9877('0x1c'),_0xef0bb[_0x9877('0x12')],_0x5d392a);_0x618cbf(_0x3d45a1[_0x9877('0x11')](0x1f4,_0xef0bb['message']));});});}; \ No newline at end of file +var _0xec2b=['request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s'];(function(_0x40d3b2,_0x16785b){var _0xb9a641=function(_0x512479){while(--_0x512479){_0x40d3b2['push'](_0x40d3b2['shift']());}};_0xb9a641(++_0x16785b);}(_0xec2b,0x126));var _0xbec2=function(_0x317aae,_0xb51037){_0x317aae=_0x317aae-0x0;var _0x51c9f8=_0xec2b[_0x317aae];return _0x51c9f8;};'use strict';var _=require(_0xbec2('0x0'));var util=require(_0xbec2('0x1'));var moment=require(_0xbec2('0x2'));var BPromise=require(_0xbec2('0x3'));var rs=require(_0xbec2('0x4'));var fs=require('fs');var Redis=require(_0xbec2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbec2('0x6'));var logger=require(_0xbec2('0x7'))(_0xbec2('0x8'));var config=require(_0xbec2('0x9'));var jayson=require(_0xbec2('0xa'));var client=jayson[_0xbec2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x561fd4,_0x1f296e,_0x2d8304){return new BPromise(function(_0xc6c6c6,_0x26e02a){return client[_0xbec2('0xc')](_0x561fd4,_0x2d8304)[_0xbec2('0xd')](function(_0x3251a4){logger[_0xbec2('0xe')](_0xbec2('0xf'),_0x1f296e,_0xbec2('0x10'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x1f296e,'request\x20sent',JSON[_0xbec2('0x11')](_0x3251a4));if(_0x3251a4[_0xbec2('0x12')]){if(_0x3251a4['error'][_0xbec2('0x13')]===0x1f4){logger[_0xbec2('0x12')](_0xbec2('0xf'),_0x1f296e,_0x3251a4[_0xbec2('0x12')][_0xbec2('0x14')]);return _0x26e02a(_0x3251a4['error'][_0xbec2('0x14')]);}logger[_0xbec2('0x12')](_0xbec2('0xf'),_0x1f296e,_0x3251a4[_0xbec2('0x12')][_0xbec2('0x14')]);return _0xc6c6c6(_0x3251a4[_0xbec2('0x12')][_0xbec2('0x14')]);}else{logger[_0xbec2('0xe')](_0xbec2('0xf'),_0x1f296e,_0xbec2('0x10'));_0xc6c6c6(_0x3251a4[_0xbec2('0x15')]['message']);}})[_0xbec2('0x16')](function(_0x13c4c3){logger[_0xbec2('0x12')](_0xbec2('0xf'),_0x1f296e,_0x13c4c3);_0x26e02a(_0x13c4c3);});});}exports[_0xbec2('0x17')]=function(_0x3891f1){var _0x3bc501=this;return new Promise(function(_0x2e7e88,_0x20be17){return db[_0xbec2('0x18')]['update'](_0x3891f1[_0xbec2('0x19')],{'raw':_0x3891f1[_0xbec2('0x1a')]?_0x3891f1[_0xbec2('0x1a')][_0xbec2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3891f1[_0xbec2('0x1a')]?_0x3891f1[_0xbec2('0x1a')]['where']||null:null,'attributes':_0x3891f1[_0xbec2('0x1a')]?_0x3891f1[_0xbec2('0x1a')][_0xbec2('0x1c')]||null:null,'limit':_0x3891f1[_0xbec2('0x1a')]?_0x3891f1[_0xbec2('0x1a')][_0xbec2('0x1d')]||null:null})[_0xbec2('0xd')](function(_0x207070){logger[_0xbec2('0xe')]('UpdateMailApplication',_0x3891f1);logger[_0xbec2('0x1e')](_0xbec2('0x17'),_0x3891f1,JSON[_0xbec2('0x11')](_0x207070));_0x2e7e88(_0x207070);})[_0xbec2('0x16')](function(_0x25f85d){logger['error'](_0xbec2('0x17'),_0x25f85d[_0xbec2('0x14')],_0x3891f1);_0x20be17(_0x3bc501[_0xbec2('0x12')](0x1f4,_0x25f85d[_0xbec2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 74e4945..a3e7998 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 _0xdea9=['addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0xdea9,0x1bc));var _0x9dea=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdea9[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0x9dea('0x0'));var router=express[_0x9dea('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x9dea('0x2'));var controller=require(_0x9dea('0x3'));router[_0x9dea('0x4')]('/',auth[_0x9dea('0x5')](),controller[_0x9dea('0x6')]);router['get'](_0x9dea('0x7'),auth[_0x9dea('0x5')](),controller[_0x9dea('0x8')]);router[_0x9dea('0x4')](_0x9dea('0x9'),auth[_0x9dea('0x5')](),controller[_0x9dea('0xa')]);router[_0x9dea('0x4')](_0x9dea('0xb'),auth[_0x9dea('0x5')](),controller[_0x9dea('0xc')]);router[_0x9dea('0x4')]('/:id/download',auth[_0x9dea('0x5')](),controller[_0x9dea('0xd')]);router[_0x9dea('0xe')]('/',auth[_0x9dea('0x5')](),controller['create']);router['post'](_0x9dea('0xb'),auth['isAuthenticated'](),controller[_0x9dea('0xf')]);router[_0x9dea('0xe')](_0x9dea('0x10'),auth[_0x9dea('0x5')](),interaction['tracked'](_0x9dea('0x11'),_0x9dea('0x12')),controller[_0x9dea('0x13')]);router[_0x9dea('0x14')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x9dea('0x11'),'mailinteraction:update'),controller[_0x9dea('0x15')]);router[_0x9dea('0x16')](_0x9dea('0x9'),auth[_0x9dea('0x5')](),interaction['tracked'](_0x9dea('0x11'),_0x9dea('0x17')),controller[_0x9dea('0x18')]);router[_0x9dea('0x16')](_0x9dea('0x10'),auth[_0x9dea('0x5')](),controller[_0x9dea('0x19')]);module[_0x9dea('0x1a')]=router; \ No newline at end of file +var _0x9f6f=['exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','create','post','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x3cc8f5,_0x3fc63c){var _0xbd9e71=function(_0x11948d){while(--_0x11948d){_0x3cc8f5['push'](_0x3cc8f5['shift']());}};_0xbd9e71(++_0x3fc63c);}(_0x9f6f,0xd9));var _0xf9f6=function(_0x4c37d5,_0x33d2ae){_0x4c37d5=_0x4c37d5-0x0;var _0x45c120=_0x9f6f[_0x4c37d5];return _0x45c120;};'use strict';var express=require(_0xf9f6('0x0'));var router=express[_0xf9f6('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xf9f6('0x2'));var controller=require(_0xf9f6('0x3'));router[_0xf9f6('0x4')]('/',auth[_0xf9f6('0x5')](),controller[_0xf9f6('0x6')]);router[_0xf9f6('0x4')](_0xf9f6('0x7'),auth[_0xf9f6('0x5')](),controller[_0xf9f6('0x8')]);router[_0xf9f6('0x4')](_0xf9f6('0x9'),auth[_0xf9f6('0x5')](),controller[_0xf9f6('0xa')]);router['get'](_0xf9f6('0xb'),auth[_0xf9f6('0x5')](),controller[_0xf9f6('0xc')]);router[_0xf9f6('0x4')]('/:id/download',auth[_0xf9f6('0x5')](),controller['download']);router['post']('/',auth[_0xf9f6('0x5')](),controller[_0xf9f6('0xd')]);router['post']('/:id/messages',auth[_0xf9f6('0x5')](),controller['addMessage']);router[_0xf9f6('0xe')](_0xf9f6('0xf'),auth[_0xf9f6('0x5')](),interaction[_0xf9f6('0x10')]('mail',_0xf9f6('0x11')),controller[_0xf9f6('0x12')]);router[_0xf9f6('0x13')]('/:id',auth[_0xf9f6('0x5')](),interaction[_0xf9f6('0x10')](_0xf9f6('0x14'),'mailinteraction:update'),controller[_0xf9f6('0x15')]);router[_0xf9f6('0x16')](_0xf9f6('0x9'),auth['isAuthenticated'](),interaction[_0xf9f6('0x10')](_0xf9f6('0x14'),_0xf9f6('0x17')),controller[_0xf9f6('0x18')]);router['delete']('/:id/tags',auth[_0xf9f6('0x5')](),controller[_0xf9f6('0x19')]);module[_0xf9f6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 4061425..1d12946 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 _0xda8e=['iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize'];(function(_0x2e4bf9,_0x970ab3){var _0x3450a7=function(_0x5ef9c4){while(--_0x5ef9c4){_0x2e4bf9['push'](_0x2e4bf9['shift']());}};_0x3450a7(++_0x970ab3);}(_0xda8e,0x143));var _0xeda8=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0xda8e[_0x589f71];return _0x5763bd;};'use strict';var Sequelize=require(_0xeda8('0x0'));var iconv=require(_0xeda8('0x1'));module['exports']={'closed':{'type':Sequelize[_0xeda8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeda8('0x3')]},'disposition':{'type':Sequelize[_0xeda8('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xeda8('0x4')]},'note':{'type':Sequelize[_0xeda8('0x4')]},'inReplyTo':{'type':Sequelize[_0xeda8('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xeda8('0x5')](_0xeda8('0x6'))},'subject':{'type':Sequelize[_0xeda8('0x5')]()},'attach':{'type':Sequelize[_0xeda8('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xeda8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xeda8('0x7')]('in',_0xeda8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xeda8('0x7')]('in',_0xeda8('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xeda8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x028a=['exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','sequelize','iconv'];(function(_0x3c79fd,_0x1b9665){var _0x10fef3=function(_0x440ada){while(--_0x440ada){_0x3c79fd['push'](_0x3c79fd['shift']());}};_0x10fef3(++_0x1b9665);}(_0x028a,0x1c0));var _0xa028=function(_0x2fb8ba,_0x1950e2){_0x2fb8ba=_0x2fb8ba-0x0;var _0x1b13db=_0x028a[_0x2fb8ba];return _0x1b13db;};'use strict';var Sequelize=require(_0xa028('0x0'));var iconv=require(_0xa028('0x1'));module[_0xa028('0x2')]={'closed':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa028('0x4')]},'disposition':{'type':Sequelize[_0xa028('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa028('0x5')]},'note':{'type':Sequelize[_0xa028('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xa028('0x5')]},'cc':{'type':Sequelize[_0xa028('0x6')]('long')},'subject':{'type':Sequelize[_0xa028('0x6')]()},'attach':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa028('0x4')]},'substatus':{'type':Sequelize[_0xa028('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xa028('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa028('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa028('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa028('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index eb12491..558c594 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 _0x3b7e=['YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','addTags','setTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','build','writeFileSync','download','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','squel','juice','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','end','status','json','undefined','limit','count','offset','set','destroy','then','sendStatus','error','stack','send','map','fullname','TagIds','Tags','split','push','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','user_has_mail_interactions','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','forEach','concat','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','rows','show','includeAll','include','create','body','update','params','describe','addMessage','ids','getMessages','$gte','format'];(function(_0x4a31fe,_0x1d1904){var _0x379d01=function(_0x170e46){while(--_0x170e46){_0x4a31fe['push'](_0x4a31fe['shift']());}};_0x379d01(++_0x1d1904);}(_0x3b7e,0x10e));var _0xe3b7=function(_0x59baae,_0x235d30){_0x59baae=_0x59baae-0x0;var _0x3b1d64=_0x3b7e[_0x59baae];return _0x3b1d64;};'use strict';var emlformat=require(_0xe3b7('0x0'));var rimraf=require(_0xe3b7('0x1'));var zipdir=require(_0xe3b7('0x2'));var moment=require('moment');var BPromise=require(_0xe3b7('0x3'));var util=require(_0xe3b7('0x4'));var path=require(_0xe3b7('0x5'));var fs=require('fs');var _=require(_0xe3b7('0x6'));var squel=require(_0xe3b7('0x7'));var juice=require(_0xe3b7('0x8'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0xe3b7('0x9'));var logger=require(_0xe3b7('0xa'))(_0xe3b7('0xb'));var config=require(_0xe3b7('0xc'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config['redis']=_[_0xe3b7('0xd')](config['redis'],{'host':_0xe3b7('0xe'),'port':0x18eb});var socket=require(_0xe3b7('0xf'))(new Redis(config[_0xe3b7('0x10')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x14a143,_0x14df22){_0x14df22=_0x14df22||0xcc;return function(_0x30dcc7){if(_0x30dcc7){return _0x14a143['sendStatus'](_0x14df22);}return _0x14a143['status'](_0x14df22)[_0xe3b7('0x11')]();};}function respondWithResult(_0x5de0ae,_0x412b6d){_0x412b6d=_0x412b6d||0xc8;return function(_0x19b711){if(_0x19b711){return _0x5de0ae[_0xe3b7('0x12')](_0x412b6d)[_0xe3b7('0x13')](_0x19b711);}};}function respondWithFilteredResult(_0x1164b3,_0xcb4697){return function(_0x56d3d3){if(_0x56d3d3){var _0x4d1995=typeof _0xcb4697['offset']===_0xe3b7('0x14')&&typeof _0xcb4697[_0xe3b7('0x15')]==='undefined';var _0x219f28=_0x56d3d3[_0xe3b7('0x16')];var _0x3064bb=_0x4d1995?0x0:_0xcb4697['offset'];var _0x3b8175=_0x4d1995?_0x56d3d3[_0xe3b7('0x16')]:_0xcb4697[_0xe3b7('0x17')]+_0xcb4697[_0xe3b7('0x15')];var _0xa2f74e;if(_0x3b8175>=_0x219f28){_0x3b8175=_0x219f28;_0xa2f74e=0xc8;}else{_0xa2f74e=0xce;}_0x1164b3['status'](_0xa2f74e);return _0x1164b3[_0xe3b7('0x18')]('Content-Range',_0x3064bb+'-'+_0x3b8175+'/'+_0x219f28)['json'](_0x56d3d3);}return null;};}function saveUpdates(_0x193fcb){return function(_0x4743fd){if(_0x4743fd){return _0x4743fd['update'](_0x193fcb)['then'](function(_0x163dc4){return _0x163dc4;});}return null;};}function removeEntity(_0x47486c){return function(_0x40bf34){if(_0x40bf34){return _0x40bf34[_0xe3b7('0x19')]()[_0xe3b7('0x1a')](function(){_0x47486c[_0xe3b7('0x12')](0xcc)[_0xe3b7('0x11')]();});}};}function handleEntityNotFound(_0x35cf29){return function(_0x15ce20){if(!_0x15ce20){_0x35cf29[_0xe3b7('0x1b')](0x194);}return _0x15ce20;};}function handleError(_0x1ab165,_0x5cf794){_0x5cf794=_0x5cf794||0x1f4;return function(_0x58d4a0){logger[_0xe3b7('0x1c')](_0x58d4a0[_0xe3b7('0x1d')]);if(_0x58d4a0['name']){delete _0x58d4a0['name'];}_0x1ab165['status'](_0x5cf794)[_0xe3b7('0x1e')](_0x58d4a0);};}function getInteractionUsers(_0x5cfeac,_0x13be30){return new BPromise(function(_0x3d5acb,_0x1d4e41){try{if(_0x13be30[_0x5cfeac['id']]){_0x5cfeac['Users']=_[_0xe3b7('0x1f')](_0x13be30[_0x5cfeac['id']],function(_0x20df97){return{'id':_0x20df97['id'],'fullname':_0x20df97[_0xe3b7('0x20')]};});}}catch(_0xac3a1){_0x1d4e41(_0xac3a1);}_0x3d5acb(_0x5cfeac);});}function getInteractionTags(_0x41ea1d,_0x1320fa){return new BPromise(function(_0x15134e,_0x187637){try{if(_0x41ea1d[_0xe3b7('0x21')]){_0x41ea1d[_0xe3b7('0x22')]=[];_0x41ea1d[_0xe3b7('0x21')][_0xe3b7('0x23')](',')['forEach'](function(_0x1bbd04){_0x41ea1d[_0xe3b7('0x22')][_0xe3b7('0x24')](_0x1320fa[_0x1bbd04]);});}delete _0x41ea1d[_0xe3b7('0x21')];}catch(_0x3e8fbe){_0x187637(_0x3e8fbe);}_0x15134e(_0x41ea1d);});}function getLastMessageText(_0x25e73b){return new BPromise(function(_0xc54b0c,_0x1c42bc){return db[_0xe3b7('0x25')][_0xe3b7('0x26')]({'where':{'$and':[{'MailInteractionId':_0x25e73b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe3b7('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xe3b7('0x28'),'raw':!![]})[_0xe3b7('0x1a')](function(_0x2d8ede){if(_0x2d8ede&&_0x2d8ede[_0xe3b7('0x29')]){_0x25e73b[_0xe3b7('0x2a')]=_[_0xe3b7('0x2b')](_0x2d8ede['plainBody']);}_0xc54b0c(_0x25e73b);})[_0xe3b7('0x2c')](function(_0x35ab26){_0x1c42bc(_0x35ab26);});});}function updateMailInteraction(_0x2476ed,_0x248a52,_0x220389,_0xba6fa4){return new BPromise(function(_0x485d76,_0xfbddab){return getInteractionUsers(_0x2476ed,_0x220389)['then'](function(_0xacbb16){return getInteractionTags(_0xacbb16,_0x248a52);})['then'](function(_0x26517c){if(_0xba6fa4){_0x485d76(getLastMessageText(_0x26517c));}else{_0x485d76(_0x26517c);}})['catch'](function(_0x41bf92){_0xfbddab(_0x41bf92);});});}exports[_0xe3b7('0x2d')]=function(_0x8e733,_0x16e660){var _0x14fee6={},_0x2187d2={},_0x4dfbe6={'count':0x0,'rows':[]};var _0x37fba5=_[_0xe3b7('0x1f')](db[_0xe3b7('0x2e')][_0xe3b7('0x2f')],function(_0x3eeeab){return{'name':_0x3eeeab[_0xe3b7('0x30')],'type':_0x3eeeab['type']['key']};});_0x2187d2[_0xe3b7('0x31')]=_[_0xe3b7('0x1f')](_0x37fba5,_0xe3b7('0x32'));_0x2187d2[_0xe3b7('0x33')]=_[_0xe3b7('0x34')](_0x8e733['query']);_0x2187d2[_0xe3b7('0x35')]=_[_0xe3b7('0x36')](_0x2187d2[_0xe3b7('0x31')],_0x2187d2['query']);_0x14fee6['attributes']=_[_0xe3b7('0x36')](_0x2187d2[_0xe3b7('0x31')],qs[_0xe3b7('0x37')](_0x8e733['query']['fields']));_0x14fee6[_0xe3b7('0x38')]=_0x14fee6['attributes'][_0xe3b7('0x39')]?_0x14fee6[_0xe3b7('0x38')]:_0x2187d2[_0xe3b7('0x31')];if(!_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x3a')](_0xe3b7('0x3b'))){_0x14fee6[_0xe3b7('0x15')]=qs[_0xe3b7('0x15')](_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x15')]);_0x14fee6[_0xe3b7('0x17')]=qs[_0xe3b7('0x17')](_0x8e733['query']['offset']);}_0x14fee6[_0xe3b7('0x3c')]=qs[_0xe3b7('0x3d')](_0x8e733['query']['sort']);_0x14fee6[_0xe3b7('0x3e')]=qs[_0xe3b7('0x35')](_[_0xe3b7('0x3f')](_0x8e733['query'],_0x2187d2[_0xe3b7('0x35')]),_0x37fba5);var _0x5c17e4=[];var _0xb9158=squel[_0xe3b7('0x40')]()[_0xe3b7('0x41')]('id')[_0xe3b7('0x41')](_0xe3b7('0x32'))['field'](_0xe3b7('0x42'))[_0xe3b7('0x43')](_0xe3b7('0x44'));var _0x826311=squel[_0xe3b7('0x40')]()['field']('u.id')[_0xe3b7('0x41')](_0xe3b7('0x45'))[_0xe3b7('0x41')]('ui.MailInteractionId')[_0xe3b7('0x43')](_0xe3b7('0x46'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x2b487c=squel['select']()[_0xe3b7('0x43')](_0xe3b7('0x47'),'i')[_0xe3b7('0x48')](_0xe3b7('0x49'),'c',_0xe3b7('0x4a'))[_0xe3b7('0x48')](_0xe3b7('0x4b'),'o',_0xe3b7('0x4c'))['left_join']('mail_accounts','a',_0xe3b7('0x4d'))['left_join']('mail_messages','me',_0xe3b7('0x4e'))[_0xe3b7('0x48')](_0xe3b7('0x4f'),'it',_0xe3b7('0x50'))[_0xe3b7('0x48')](_0xe3b7('0x44'),'t',_0xe3b7('0x51'));var _0x54135a=squel[_0xe3b7('0x52')]();var _0x8efc51=[];var _0x1da971=squel[_0xe3b7('0x52')]();var _0x202a4d;if(_0x8e733['query'][_0xe3b7('0x53')]){_0x202a4d=as['parseSearch'](_0x8e733['query'][_0xe3b7('0x53')]);var _0x13880a=_0x202a4d['sqlOperator'];for(var _0x4c3950=0x0;_0x4c3950<_0x202a4d[_0xe3b7('0x54')][_0xe3b7('0x39')];_0x4c3950++){var _0x261895=_0x202a4d[_0xe3b7('0x54')][_0x4c3950];var _0x10890f='i';var _0x328e51=_[_0xe3b7('0x55')](_0x37fba5,[_0xe3b7('0x32'),_0x261895[_0xe3b7('0x41')]]);if(!_0x328e51){switch(_0x261895[_0xe3b7('0x41')]){case _0xe3b7('0x56'):if(_0x261895[_0xe3b7('0x57')]==0x1){_0x2b487c[_0xe3b7('0x58')]('`'+_0x261895['field']+_0xe3b7('0x59'));}else{_0x2b487c[_0xe3b7('0x58')]('`'+_0x261895[_0xe3b7('0x41')]+'`\x20>\x200');}break;case _0xe3b7('0x5a'):if(_0x261895[_0xe3b7('0x5b')]===_0xe3b7('0x5c')){if(_0x261895[_0xe3b7('0x57')][_0xe3b7('0x23')]('\x20')[_0xe3b7('0x39')]>0x1){_0x54135a[_0x13880a](_0xe3b7('0x5d'),qs[_0xe3b7('0x5e')](_0x261895[_0xe3b7('0x57')]),null);}else{var _0x558185='%'+_0x261895[_0xe3b7('0x57')]+'%';_0x54135a[_0x13880a](_0xe3b7('0x5f'),_0x558185,_0x558185,_0x558185);}}else{_0x328e51=_[_0xe3b7('0x55')](_0x37fba5,[_0xe3b7('0x32'),_0xe3b7('0x60')]);_0x261895['field']='ContactId';_0x51e458=as[_0xe3b7('0x61')](_0x10890f,_0x328e51[_0xe3b7('0x62')],_0x261895);_0x54135a[_0x13880a](_0x51e458[_0xe3b7('0x63')],_0x51e458[_0xe3b7('0x57')][_0xe3b7('0x64')],_0x51e458[_0xe3b7('0x57')][_0xe3b7('0x11')]);}break;case'Tag':var _0x3c994f=_0x261895['value'][_0xe3b7('0x23')](',')[_0xe3b7('0x1f')](function(_0x59bc50){return Number(_0x59bc50);});_0x3c994f['forEach'](function(_0x989ae6){_0x1da971['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x989ae6+',%');});_0x8efc51=_[_0xe3b7('0x65')](_0x8efc51,_0x3c994f);break;case _0xe3b7('0x66'):if(_0x261895['operator']==='$substring'){_0x54135a[_0x13880a](_0xe3b7('0x67'),'%'+_0x261895[_0xe3b7('0x57')]+'%',null);}else{_0x328e51=_['find'](_0x37fba5,['name','UserId']);_0x261895[_0xe3b7('0x41')]='UserId';_0x51e458=as[_0xe3b7('0x61')](_0x10890f,_0x328e51[_0xe3b7('0x62')],_0x261895);_0x54135a[_0x13880a](_0x51e458[_0xe3b7('0x63')],_0x51e458['value'][_0xe3b7('0x64')],_0x51e458['value']['end']);}break;case _0xe3b7('0x29'):_0x51e458=as[_0xe3b7('0x61')]('me',null,_0x261895);_0x54135a[_0x13880a](_0x51e458[_0xe3b7('0x63')],_0x51e458[_0xe3b7('0x57')][_0xe3b7('0x64')],_0x51e458[_0xe3b7('0x57')][_0xe3b7('0x11')]);break;}}else{var _0x51e458=as['buildExpression'](_0x10890f,_0x328e51[_0xe3b7('0x62')],_0x261895);_0x54135a[_0x13880a](_0x51e458[_0xe3b7('0x63')],_0x51e458[_0xe3b7('0x57')]['start'],_0x51e458[_0xe3b7('0x57')][_0xe3b7('0x11')]);}}}else{var _0x26d3b5=_(_0x8e733[_0xe3b7('0x33')])[_0xe3b7('0x34')]()[_0xe3b7('0x1f')](function(_0x106824){return _[_0xe3b7('0x68')](_0x37fba5,[_0xe3b7('0x32'),_0x106824])?_0x106824:undefined;})[_0xe3b7('0x69')]()[_0xe3b7('0x57')]();if(!_[_0xe3b7('0x6a')](_0x26d3b5)){_0x26d3b5[_0xe3b7('0x6b')](function(_0x2eada8){if(_0x2eada8==='MailAccountId'){_0x2b487c[_0xe3b7('0x3e')]('i.MailAccountId\x20IN\x20?',[][_0xe3b7('0x6c')](_0x8e733[_0xe3b7('0x33')][_0x2eada8]));}else if(_0x2eada8===_0xe3b7('0x6d')){var _0x153921=JSON[_0xe3b7('0x6e')](_0x8e733[_0xe3b7('0x33')][_0x2eada8])['$gte'];var _0x46f588=JSON[_0xe3b7('0x6e')](_0x8e733[_0xe3b7('0x33')][_0x2eada8])[_0xe3b7('0x6f')];_0x2b487c[_0xe3b7('0x3e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x153921,_0x46f588);}else{if(_0x8e733['query'][_0x2eada8]===_0xe3b7('0x70')){_0x2b487c['where']('i.'+_0x2eada8+'\x20IS\x20NULL');}else{_0x2b487c[_0xe3b7('0x3e')]('i.'+_0x2eada8+_0xe3b7('0x71'),_0x8e733[_0xe3b7('0x33')][_0x2eada8]);}}});}if(_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x72')]){if(_0x8e733['query'][_0xe3b7('0x72')]==0x1){_0x2b487c['having'](_0xe3b7('0x73'));}else{_0x2b487c['having'](_0xe3b7('0x74'));}}if(_0x8e733[_0xe3b7('0x33')]['tag']){_0x8efc51=_[_0xe3b7('0x75')](_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x76')])?_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x76')]:new Array(_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x76')]);_0x8efc51['forEach'](function(_0x774565){_0x1da971['or'](_0xe3b7('0x77'),'%,'+_0x774565+',%');});}if(_0x8e733['query'][_0xe3b7('0x78')]){var _0x30c9dd=_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x78')]['replace']('\x5c','\x5c\x5c')[_0xe3b7('0x79')](/'/g,'\x27\x27');if(qs[_0xe3b7('0x7a')](_0x30c9dd)){_0x54135a['or']('i.id\x20LIKE\x20?',_0x30c9dd+'%');}else if(qs[_0xe3b7('0x7b')](_0x30c9dd)){_0x54135a['or'](_0xe3b7('0x7c'),_0x30c9dd+'%');}else{_0x54135a['or'](_0xe3b7('0x7d'),qs[_0xe3b7('0x5e')](_0x30c9dd))['or'](_0xe3b7('0x7e'),qs[_0xe3b7('0x5e')](_0x30c9dd));}}}_0x2b487c['where'](_0x54135a);_0x2b487c[_0xe3b7('0x7f')](_0xe3b7('0x80'));var _0x1d5ff3={'type':db[_0xe3b7('0x81')]['QueryTypes'][_0xe3b7('0x82')],'raw':!![]};var _0x6e8658=_0x2b487c[_0xe3b7('0x83')]();_0x6e8658['field'](_0xe3b7('0x80'));_0x6e8658[_0xe3b7('0x41')](_0xe3b7('0x84'),_0xe3b7('0x56'));if(_0x14fee6[_0xe3b7('0x3c')]){_0x14fee6[_0xe3b7('0x3c')][_0xe3b7('0x6b')](function(_0x4d51cc){var _0x8ec206=_0x4d51cc[0x0]===_0xe3b7('0x85')?_0x4d51cc[0x0]:'i.'+_0x4d51cc[0x0];_0x2b487c['order'](_0x8ec206,_0x4d51cc[0x1]===_0xe3b7('0x86')?![]:!![]);});}if(!_[_0xe3b7('0x6a')](_0x8efc51)){_0x2b487c['having'](_0x1da971);_0x6e8658[_0xe3b7('0x3e')](_0xe3b7('0x87'),_0x8efc51);}BPromise[_0xe3b7('0x88')]()[_0xe3b7('0x1a')](function(){if(!_0x202a4d){if(_0x8e733[_0xe3b7('0x33')][_0xe3b7('0x89')])return;_0x6e8658['where'](_0xe3b7('0x8a'));_0x2b487c[_0xe3b7('0x3e')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x8e733[_0xe3b7('0x8b')]['role']!==_0xe3b7('0x8c'))return;return _0x8e733[_0xe3b7('0x8b')][_0xe3b7('0x8d')]({'attributes':['id'],'raw':!![]})[_0xe3b7('0x1a')](function(_0x5a25c8){if(_[_0xe3b7('0x6a')](_0x5a25c8)){_0x6e8658[_0xe3b7('0x3e')](_0xe3b7('0x8e'));_0x2b487c[_0xe3b7('0x3e')](_0xe3b7('0x8e'));}else{_0x6e8658[_0xe3b7('0x3e')](_0xe3b7('0x8f'),_[_0xe3b7('0x1f')](_0x5a25c8,'id'));_0x2b487c[_0xe3b7('0x3e')]('i.MailAccountId\x20IN\x20?',_[_0xe3b7('0x1f')](_0x5a25c8,'id'));}});})[_0xe3b7('0x1a')](function(){if(_0x8e733[_0xe3b7('0x8b')]['role']===_0xe3b7('0x8c')&&!_0x202a4d&&!_0x8e733[_0xe3b7('0x33')]['MailAccountId'])return[];return db['sequelize'][_0xe3b7('0x33')](_0x6e8658[_0xe3b7('0x90')](),_0x1d5ff3);})[_0xe3b7('0x1a')](function(_0x1ba6b6){_0x4dfbe6[_0xe3b7('0x16')]=_0x1ba6b6['length'];if(_0x4dfbe6[_0xe3b7('0x16')]===0x0)return[];return db['sequelize'][_0xe3b7('0x33')](_0xb9158['toString'](),_0x1d5ff3)['then'](function(_0x4c3501){_0x5c17e4=_['keyBy'](_0x4c3501,'id');_0x1d5ff3=_[_0xe3b7('0x91')](_0x1d5ff3,{'model':db[_0xe3b7('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8e733['query'][_0xe3b7('0x37')]){_0x14fee6[_0xe3b7('0x38')][_0xe3b7('0x6b')](function(_0x5ae785){_0x2b487c['field']('i.'+_0x5ae785);});}else{_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x84'),_0xe3b7('0x56'));_0x2b487c['field']('a.key',_0xe3b7('0x92'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x93'),_0xe3b7('0x94'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x95'),_0xe3b7('0x85'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x80'));_0x2b487c['field']('i.createdAt');_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x96'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x97'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x98'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x99'));_0x2b487c['field'](_0xe3b7('0x9a'));_0x2b487c['field'](_0xe3b7('0x9b'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x9c'));_0x2b487c['field'](_0xe3b7('0x9d'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x9e'));_0x2b487c[_0xe3b7('0x41')]('i.thirdDisposition');_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0x9f'));_0x2b487c['field'](_0xe3b7('0xa0'));_0x2b487c['field']('i.ContactId');_0x2b487c['field'](_0xe3b7('0xa1'));_0x2b487c[_0xe3b7('0x41')]('i.UserId');_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0xa2'),_0xe3b7('0xa3'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0xa4'),_0xe3b7('0xa5'));_0x2b487c[_0xe3b7('0x41')]('c.email',_0xe3b7('0xa6'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0xa7'),_0xe3b7('0xa8'));_0x2b487c[_0xe3b7('0x41')]('c.mobile',_0xe3b7('0xa9'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0xaa'),_0xe3b7('0xab'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0xac'),_0xe3b7('0xad'));_0x2b487c[_0xe3b7('0x41')](_0xe3b7('0xae'),_0xe3b7('0xaf'));_0x2b487c['field'](_0xe3b7('0xb0'),_0xe3b7('0x21'));}if(_0x14fee6[_0xe3b7('0x15')])_0x2b487c[_0xe3b7('0x15')](_0x14fee6['limit']);if(_0x14fee6['offset'])_0x2b487c[_0xe3b7('0x17')](_0x14fee6[_0xe3b7('0x17')]);return db[_0xe3b7('0xb1')][_0xe3b7('0x33')](_0x2b487c['toString'](),_0x1d5ff3);})['then'](function(_0x3c85d7){if(_0x3c85d7[_0xe3b7('0x39')]>0x0)_0x826311[_0xe3b7('0x3e')](_0xe3b7('0xb2'),_[_0xe3b7('0x1f')](_0x3c85d7,'id'));return db[_0xe3b7('0xb1')][_0xe3b7('0x33')](_0x826311[_0xe3b7('0x90')](),_0x1d5ff3)[_0xe3b7('0x1a')](function(_0x349327){var _0x3bfe1b=_[_0xe3b7('0xb3')](_0x349327,_0xe3b7('0xb4'));var _0x3957ab=[];return db['Setting'][_0xe3b7('0x26')]({'attributes':[_0xe3b7('0xb5')],'raw':!![]})[_0xe3b7('0x1a')](function(_0x82d223){var _0x3943b0=_0x82d223[_0xe3b7('0xb5')];_0x3c85d7[_0xe3b7('0x6b')](function(_0x2a916a){_0x3957ab['push'](updateMailInteraction(_0x2a916a,_0x5c17e4,_0x3bfe1b,_0x3943b0));});return BPromise['all'](_0x3957ab);});});});})[_0xe3b7('0x1a')](function(_0x29fd2d){_0x4dfbe6[_0xe3b7('0xb6')]=_0x29fd2d;return _0x4dfbe6;})[_0xe3b7('0x1a')](respondWithFilteredResult(_0x16e660,_0x14fee6))[_0xe3b7('0x2c')](handleError(_0x16e660,null));};exports[_0xe3b7('0xb7')]=function(_0xd7df3,_0x528091){var _0xe2e726={'raw':![],'where':{'id':_0xd7df3['params']['id']}},_0x3a227f={};_0x3a227f[_0xe3b7('0x31')]=_[_0xe3b7('0x34')](db['MailInteraction'][_0xe3b7('0x2f')]);_0x3a227f[_0xe3b7('0x33')]=_[_0xe3b7('0x34')](_0xd7df3[_0xe3b7('0x33')]);_0x3a227f['filters']=_[_0xe3b7('0x36')](_0x3a227f['model'],_0x3a227f[_0xe3b7('0x33')]);_0xe2e726[_0xe3b7('0x38')]=_['intersection'](_0x3a227f[_0xe3b7('0x31')],qs['fields'](_0xd7df3[_0xe3b7('0x33')][_0xe3b7('0x37')]));_0xe2e726[_0xe3b7('0x38')]=_0xe2e726[_0xe3b7('0x38')][_0xe3b7('0x39')]?_0xe2e726[_0xe3b7('0x38')]:_0x3a227f['model'];if(_0xd7df3[_0xe3b7('0x33')][_0xe3b7('0xb8')]){_0xe2e726[_0xe3b7('0xb9')]=[{'all':!![]}];}_0xe2e726=_['merge']({},_0xe2e726,_0xd7df3['options']);return db[_0xe3b7('0x2e')]['find'](_0xe2e726)[_0xe3b7('0x1a')](handleEntityNotFound(_0x528091,null))[_0xe3b7('0x1a')](respondWithResult(_0x528091,null))[_0xe3b7('0x2c')](handleError(_0x528091,null));};exports[_0xe3b7('0xba')]=function(_0x45fc8d,_0x53a809){return db[_0xe3b7('0x2e')][_0xe3b7('0xba')](_0x45fc8d[_0xe3b7('0xbb')],{})[_0xe3b7('0x1a')](respondWithResult(_0x53a809,0xc9))[_0xe3b7('0x2c')](handleError(_0x53a809,null));};exports[_0xe3b7('0xbc')]=function(_0x345e22,_0x24c4a3){if(_0x345e22[_0xe3b7('0xbb')]['id']){delete _0x345e22['body']['id'];}return db[_0xe3b7('0x2e')]['find']({'where':{'id':_0x345e22[_0xe3b7('0xbd')]['id']}})[_0xe3b7('0x1a')](handleEntityNotFound(_0x24c4a3,null))['then'](saveUpdates(_0x345e22[_0xe3b7('0xbb')],null))[_0xe3b7('0x1a')](respondWithResult(_0x24c4a3,null))[_0xe3b7('0x2c')](handleError(_0x24c4a3,null));};exports[_0xe3b7('0x19')]=function(_0x2dc5da,_0x51a32a){return db[_0xe3b7('0x2e')][_0xe3b7('0x55')]({'where':{'id':_0x2dc5da['params']['id']}})[_0xe3b7('0x1a')](handleEntityNotFound(_0x51a32a,null))[_0xe3b7('0x1a')](removeEntity(_0x51a32a,null))[_0xe3b7('0x2c')](handleError(_0x51a32a,null));};exports[_0xe3b7('0xbe')]=function(_0x401e3f,_0x1b3cce){return db['MailInteraction'][_0xe3b7('0xbe')]()['then'](respondWithResult(_0x1b3cce,null))['catch'](handleError(_0x1b3cce,null));};exports['addMessage']=function(_0x2e6803,_0x30bbc2){return db[_0xe3b7('0x25')][_0xe3b7('0x55')]({'where':{'id':_0x2e6803[_0xe3b7('0xbd')]['id']}})[_0xe3b7('0x1a')](handleEntityNotFound(_0x30bbc2,null))[_0xe3b7('0x1a')](function(_0x296a37){if(_0x296a37){return _0x296a37[_0xe3b7('0xbf')](_0x2e6803[_0xe3b7('0xbb')][_0xe3b7('0xc0')],_['omit'](_0x2e6803[_0xe3b7('0xbb')],['ids','id'])||{});}})[_0xe3b7('0x1a')](respondWithResult(_0x30bbc2,null))[_0xe3b7('0x2c')](handleError(_0x30bbc2,null));};exports[_0xe3b7('0xc1')]=function(_0x51bd29,_0x50dc25){var _0x56a16d={'raw':![],'where':{}};var _0x2b8e3a={};var _0x10e2e={'count':0x0,'rows':[]};return db['MailInteraction'][_0xe3b7('0x26')]({'where':{'id':_0x51bd29[_0xe3b7('0xbd')]['id']}})[_0xe3b7('0x1a')](handleEntityNotFound(_0x50dc25,null))['then'](function(_0x426c50){if(_0x426c50){_0x2b8e3a[_0xe3b7('0x31')]=_[_0xe3b7('0x34')](db[_0xe3b7('0x25')][_0xe3b7('0x2f')]);_0x2b8e3a[_0xe3b7('0x33')]=_['keys'](_0x51bd29[_0xe3b7('0x33')]);_0x2b8e3a['filters']=_[_0xe3b7('0x36')](_0x2b8e3a['model'],_0x2b8e3a[_0xe3b7('0x33')]);_0x56a16d['attributes']=_['intersection'](_0x2b8e3a['model'],qs['fields'](_0x51bd29[_0xe3b7('0x33')][_0xe3b7('0x37')]));_0x56a16d[_0xe3b7('0x38')]=_0x56a16d['attributes'][_0xe3b7('0x39')]?_0x56a16d[_0xe3b7('0x38')]:_0x2b8e3a[_0xe3b7('0x31')];if(!_0x51bd29[_0xe3b7('0x33')][_0xe3b7('0x3a')](_0xe3b7('0x3b'))){_0x56a16d['limit']=qs[_0xe3b7('0x15')](_0x51bd29[_0xe3b7('0x33')][_0xe3b7('0x15')]);_0x56a16d['offset']=qs[_0xe3b7('0x17')](_0x51bd29[_0xe3b7('0x33')][_0xe3b7('0x17')]);}_0x56a16d[_0xe3b7('0x3c')]=qs[_0xe3b7('0x3d')](_0x51bd29[_0xe3b7('0x33')][_0xe3b7('0x3d')]);_0x56a16d[_0xe3b7('0x3e')]=qs[_0xe3b7('0x35')](_[_0xe3b7('0x3f')](_0x51bd29[_0xe3b7('0x33')],_0x2b8e3a[_0xe3b7('0x35')]));_0x56a16d[_0xe3b7('0x3e')][_0xe3b7('0xb4')]=_0x426c50['id'];if(_0x51bd29['query'][_0xe3b7('0x78')]){_0x56a16d['where']=_[_0xe3b7('0x91')](_0x56a16d[_0xe3b7('0x3e')],{'$or':_['map'](_0x56a16d[_0xe3b7('0x38')],function(_0x397601){var _0x43def0={};_0x43def0[_0x397601]={'$like':'%'+_0x51bd29['query'][_0xe3b7('0x78')]+'%'};return _0x43def0;})});}if(_0x51bd29['query'][_0xe3b7('0xc2')]){var _0x4eb4eb=_0x51bd29[_0xe3b7('0x33')][_0xe3b7('0xc2')][_0xe3b7('0x23')](',');var _0xd37060={};_0xd37060[_0x4eb4eb[0x0]]={'$gte':moment(_0x4eb4eb[0x1])[_0xe3b7('0xc3')](_0xe3b7('0xc4'))};_0x56a16d[_0xe3b7('0x3e')]=_['merge'](_0x56a16d[_0xe3b7('0x3e')],_0xd37060);}_0x56a16d=_[_0xe3b7('0x91')]({},_0x56a16d,_0x51bd29[_0xe3b7('0xc5')]);return db['MailMessage'][_0xe3b7('0x16')]({'where':_0x56a16d[_0xe3b7('0x3e')]})['then'](function(_0x179d39){_0x10e2e[_0xe3b7('0x16')]=_0x179d39;if(_0x51bd29[_0xe3b7('0x33')]['includeAll']){_0x56a16d[_0xe3b7('0xb9')]=[{'all':!![]}];}return db[_0xe3b7('0x25')][_0xe3b7('0xc6')](_0x56a16d);})['then'](function(_0x3983d5){if(_0x51bd29[_0xe3b7('0x33')][_0xe3b7('0xc7')]===_0xe3b7('0xc8')){for(var _0x55d5b4=0x0;_0x55d5b4<_0x3983d5[_0xe3b7('0x39')];_0x55d5b4++){_0x3983d5[_0x55d5b4]['body']=juice(_0x3983d5[_0x55d5b4]['body']);}}_0x10e2e[_0xe3b7('0xb6')]=_0x3983d5;return _0x10e2e;});}})[_0xe3b7('0x1a')](respondWithFilteredResult(_0x50dc25,_0x56a16d))['catch'](handleError(_0x50dc25,null));};exports[_0xe3b7('0xc9')]=function(_0xb821f5,_0x2dc45c){return db[_0xe3b7('0x2e')]['find']({'where':{'id':_0xb821f5[_0xe3b7('0xbd')]['id']}})[_0xe3b7('0x1a')](handleEntityNotFound(_0x2dc45c,null))[_0xe3b7('0x1a')](function(_0x8493b1){if(_0x8493b1){return _0x8493b1[_0xe3b7('0xca')](_0xb821f5[_0xe3b7('0xbb')][_0xe3b7('0xc0')],_[_0xe3b7('0xcb')](_0xb821f5[_0xe3b7('0xbb')],['ids','id'])||{})[_0xe3b7('0xcc')](function(){return db[_0xe3b7('0xcd')][_0xe3b7('0xc6')]({'attributes':['id',_0xe3b7('0x32'),_0xe3b7('0x42')],'where':{'id':_0xb821f5[_0xe3b7('0xbb')][_0xe3b7('0xc0')]}});})['then'](function(_0x4be5e9){socket[_0xe3b7('0xce')](_0xe3b7('0xcf'),{'id':Number(_0xb821f5[_0xe3b7('0xbd')]['id']),'tags':_0x4be5e9||[]});return{'id':Number(_0xb821f5[_0xe3b7('0xbd')]['id']),'tags':_0x4be5e9||[]};});}})[_0xe3b7('0x1a')](respondWithResult(_0x2dc45c,null))['catch'](handleError(_0x2dc45c,null));};exports[_0xe3b7('0xd0')]=function(_0x4bcbf4,_0x4eb3d0){return db[_0xe3b7('0x2e')][_0xe3b7('0x55')]({'where':{'id':_0x4bcbf4[_0xe3b7('0xbd')]['id']}})[_0xe3b7('0x1a')](handleEntityNotFound(_0x4eb3d0,null))[_0xe3b7('0x1a')](function(_0xa424dc){if(_0xa424dc){return _0xa424dc[_0xe3b7('0xd0')](_0x4bcbf4[_0xe3b7('0x33')][_0xe3b7('0xc0')]);}})['then'](respondWithStatusCode(_0x4eb3d0,null))[_0xe3b7('0x2c')](handleError(_0x4eb3d0,null));};exports['download']=function(_0x47a618,_0x2de572){var _0x5905d6=moment()[_0xe3b7('0xd1')]()['toString']();var _0x5961d9=path[_0xe3b7('0xd2')](config[_0xe3b7('0xd3')],'server',_0xe3b7('0xd4'),_0xe3b7('0xd5'));var _0x90e5d=path['join'](config[_0xe3b7('0xd3')],_0xe3b7('0xd6'),_0xe3b7('0xd4'),_0xe3b7('0xd7'));var _0x26f024=path[_0xe3b7('0xd2')](_0x5961d9,_0x5905d6);var _0x415737=util[_0xe3b7('0xc3')]('transcript-%d-%s.zip',_0x47a618[_0xe3b7('0xbd')]['id'],_0x5905d6);var _0x44dd8f=path[_0xe3b7('0xd2')](_0x5961d9,_0x415737);var _0x392284=[];if(_0x47a618['query'][_0xe3b7('0xd7')]){_0x392284[_0xe3b7('0x24')]({'model':db[_0xe3b7('0xd8')],'as':_0xe3b7('0xd9'),'raw':!![]});}var _0x6e63cf=[{'model':db['MailMessage'],'as':_0xe3b7('0xda'),'attributes':['id','body',_0xe3b7('0x43'),'to','cc',_0xe3b7('0xdb'),_0xe3b7('0xdc'),_0xe3b7('0x6d')],'where':{'secret':![]},'order':qs[_0xe3b7('0x3d')]('id'),'include':_0x392284}];return db[_0xe3b7('0x2e')][_0xe3b7('0x55')]({'where':{'id':_0x47a618[_0xe3b7('0xbd')]['id']},'include':_0x6e63cf})[_0xe3b7('0x1a')](handleEntityNotFound(_0x2de572,null))[_0xe3b7('0x1a')](function(_0x1f0eb1){if(_0x1f0eb1&&_0x1f0eb1[_0xe3b7('0xda')]){var _0x44e62b=_0x1f0eb1[_0xe3b7('0xdd')]({'plain':!![]});fs[_0xe3b7('0xde')](_0x26f024);return BPromise[_0xe3b7('0xdf')](_0x44e62b[_0xe3b7('0xda')],function(_0x2eb4f8,_0x43e2d5){var _0xff30d0={'from':_0x2eb4f8[_0xe3b7('0x43')],'to':_0x2eb4f8['to'],'subject':_0x2eb4f8[_0xe3b7('0xdc')],'html':htmlEntities[_0xe3b7('0xe0')](_0x2eb4f8[_0xe3b7('0xbb')]),'headers':{'Date':moment(_0x2eb4f8[_0xe3b7('0x6d')])['format'](_0xe3b7('0xe1'))},'attachments':[]};if(_0x2eb4f8['cc']){_0xff30d0[_0xe3b7('0xe2')]['Cc']=_0x2eb4f8['cc'];}if(_0x2eb4f8[_0xe3b7('0xdb')]){_0xff30d0['headers']['Bcc']=_0x2eb4f8['bcc'];}return new BPromise(function(_0x1a9f25,_0x5724a3){if(_0x2eb4f8[_0xe3b7('0xd9')]){for(var _0x2d4cd0=0x0;_0x2d4cd0<_0x2eb4f8[_0xe3b7('0xd9')][_0xe3b7('0x39')];_0x2d4cd0++){var _0x3f4e3e=_0x2eb4f8['Attachments'][_0x2d4cd0];var _0x48a3ac=path[_0xe3b7('0xd2')](_0x90e5d,_0x3f4e3e[_0xe3b7('0xe3')]);if(fs[_0xe3b7('0xe4')](_0x48a3ac)){_0xff30d0['attachments'][_0xe3b7('0x24')]({'name':_0x3f4e3e[_0xe3b7('0x32')],'contentType':_0x3f4e3e[_0xe3b7('0x62')],'data':fs['readFileSync'](_0x48a3ac)});}}}emlformat[_0xe3b7('0xe5')](_0xff30d0,function(_0x5b4a20,_0x264f13){if(_0x5b4a20)return _0x5724a3(_0x5b4a20);fs[_0xe3b7('0xe6')](path[_0xe3b7('0xd2')](_0x26f024,util[_0xe3b7('0xc3')]('message%d.eml',_0x43e2d5)),_0x264f13);return _0x1a9f25(_0x264f13);});});})[_0xe3b7('0x1a')](function(){return new BPromise(function(_0x151cde,_0x239fd2){zipdir(_0x26f024,{'saveTo':_0x44dd8f},function(_0x606c42,_0x5747ae){if(_0x606c42)return _0x239fd2(_0x606c42);return _0x151cde(_0x5747ae);});})['then'](function(){return new BPromise(function(_0x283c86,_0x459c6d){rimraf(_0x26f024,function(_0x1cff48){if(_0x1cff48)_0x459c6d(_0x1cff48);return _0x283c86();});});})[_0xe3b7('0x1a')](function(){return _0x2de572[_0xe3b7('0xe7')](_0x44dd8f,_0x415737,function(_0x31f67e){if(!_0x31f67e)fs[_0xe3b7('0xe8')](_0x44dd8f);});});});}else{return _0x2de572[_0xe3b7('0x1b')](0xc8);}})[_0xe3b7('0x2c')](handleError(_0x2de572,null));}; \ No newline at end of file +var _0x333b=['redis','defaults','localhost','register','status','end','json','undefined','limit','offset','count','set','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','replace','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','enableEmailPreview','all','rows','params','includeAll','include','create','body','describe','addMessage','ids','omit','hasOwnProperty','nolimit','pick','filter','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','Tag','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','subject','mkdirSync','each','Messages','headers','bcc','Bcc','Attachments','basename','message%d.eml','unlinkSync','sendStatus','eml-format','rimraf','bluebird','util','path','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','html-entities'];(function(_0x44eca2,_0x10f7e1){var _0x14035f=function(_0x48c964){while(--_0x48c964){_0x44eca2['push'](_0x44eca2['shift']());}};_0x14035f(++_0x10f7e1);}(_0x333b,0x1a6));var _0xb333=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x333b[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0xb333('0x0'));var rimraf=require(_0xb333('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xb333('0x2'));var util=require(_0xb333('0x3'));var path=require(_0xb333('0x4'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb333('0x5'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xb333('0x6'));var as=require(_0xb333('0x7'));var logger=require(_0xb333('0x8'))('api');var config=require(_0xb333('0x9'));var db=require(_0xb333('0xa'))['db'];var htmlEntities=require(_0xb333('0xb'));config[_0xb333('0xc')]=_[_0xb333('0xd')](config[_0xb333('0xc')],{'host':_0xb333('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb333('0xc')]));require('./mailInteraction.socket')[_0xb333('0xf')](socket);function respondWithStatusCode(_0x673a96,_0x3a8cfe){_0x3a8cfe=_0x3a8cfe||0xcc;return function(_0x5b8c36){if(_0x5b8c36){return _0x673a96['sendStatus'](_0x3a8cfe);}return _0x673a96[_0xb333('0x10')](_0x3a8cfe)[_0xb333('0x11')]();};}function respondWithResult(_0x964d5e,_0x3695c8){_0x3695c8=_0x3695c8||0xc8;return function(_0x20d404){if(_0x20d404){return _0x964d5e['status'](_0x3695c8)[_0xb333('0x12')](_0x20d404);}};}function respondWithFilteredResult(_0x876ae5,_0x5b9481){return function(_0x4c084b){if(_0x4c084b){var _0x453479=typeof _0x5b9481['offset']===_0xb333('0x13')&&typeof _0x5b9481[_0xb333('0x14')]===_0xb333('0x13');var _0x4cc2dc=_0x4c084b['count'];var _0x186566=_0x453479?0x0:_0x5b9481[_0xb333('0x15')];var _0x19ef0b=_0x453479?_0x4c084b[_0xb333('0x16')]:_0x5b9481[_0xb333('0x15')]+_0x5b9481[_0xb333('0x14')];var _0x2621db;if(_0x19ef0b>=_0x4cc2dc){_0x19ef0b=_0x4cc2dc;_0x2621db=0xc8;}else{_0x2621db=0xce;}_0x876ae5['status'](_0x2621db);return _0x876ae5[_0xb333('0x17')]('Content-Range',_0x186566+'-'+_0x19ef0b+'/'+_0x4cc2dc)[_0xb333('0x12')](_0x4c084b);}return null;};}function saveUpdates(_0x34c972){return function(_0x501436){if(_0x501436){return _0x501436[_0xb333('0x18')](_0x34c972)[_0xb333('0x19')](function(_0x1153c4){return _0x1153c4;});}return null;};}function removeEntity(_0x10fcfb){return function(_0xa0f08f){if(_0xa0f08f){return _0xa0f08f[_0xb333('0x1a')]()['then'](function(){_0x10fcfb[_0xb333('0x10')](0xcc)[_0xb333('0x11')]();});}};}function handleEntityNotFound(_0x4cffd7){return function(_0x1e7d8b){if(!_0x1e7d8b){_0x4cffd7['sendStatus'](0x194);}return _0x1e7d8b;};}function handleError(_0x418b12,_0x508d78){_0x508d78=_0x508d78||0x1f4;return function(_0x3240cf){logger[_0xb333('0x1b')](_0x3240cf[_0xb333('0x1c')]);if(_0x3240cf[_0xb333('0x1d')]){delete _0x3240cf['name'];}_0x418b12['status'](_0x508d78)[_0xb333('0x1e')](_0x3240cf);};}function getInteractionUsers(_0x5d0ae5,_0x18ec6b){return new BPromise(function(_0x361f59,_0x4d3d5d){try{if(_0x18ec6b[_0x5d0ae5['id']]){_0x5d0ae5[_0xb333('0x1f')]=_[_0xb333('0x20')](_0x18ec6b[_0x5d0ae5['id']],function(_0x942e62){return{'id':_0x942e62['id'],'fullname':_0x942e62[_0xb333('0x21')]};});}}catch(_0x3f44fc){_0x4d3d5d(_0x3f44fc);}_0x361f59(_0x5d0ae5);});}function getInteractionTags(_0x41e8b0,_0x226bac){return new BPromise(function(_0x105c8b,_0x3d71a5){try{if(_0x41e8b0[_0xb333('0x22')]){_0x41e8b0[_0xb333('0x23')]=[];_0x41e8b0[_0xb333('0x22')][_0xb333('0x24')](',')[_0xb333('0x25')](function(_0x32e9bf){_0x41e8b0[_0xb333('0x23')][_0xb333('0x26')](_0x226bac[_0x32e9bf]);});}delete _0x41e8b0[_0xb333('0x22')];}catch(_0xa5e861){_0x3d71a5(_0xa5e861);}_0x105c8b(_0x41e8b0);});}function getLastMessageText(_0x400f0c){return new BPromise(function(_0xfd8899,_0xee4cf){return db[_0xb333('0x27')][_0xb333('0x28')]({'where':{'$and':[{'MailInteractionId':_0x400f0c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb333('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb333('0x2a')],'order':'-id','raw':!![]})[_0xb333('0x19')](function(_0x3df743){if(_0x3df743&&_0x3df743[_0xb333('0x2a')]){_0x400f0c[_0xb333('0x2b')]=_[_0xb333('0x2c')](_0x3df743['plainBody']);}_0xfd8899(_0x400f0c);})[_0xb333('0x2d')](function(_0x53c485){_0xee4cf(_0x53c485);});});}function updateMailInteraction(_0x4401c9,_0x13edbe,_0x2842cd,_0x5a40fa){return new BPromise(function(_0x333ddb,_0x5ef6cb){return getInteractionUsers(_0x4401c9,_0x2842cd)[_0xb333('0x19')](function(_0x4ca529){return getInteractionTags(_0x4ca529,_0x13edbe);})[_0xb333('0x19')](function(_0x33096b){if(_0x5a40fa){_0x333ddb(getLastMessageText(_0x33096b));}else{_0x333ddb(_0x33096b);}})['catch'](function(_0x33bc5d){_0x5ef6cb(_0x33bc5d);});});}exports[_0xb333('0x2e')]=function(_0x2da2ff,_0x28f738){var _0x14586d={},_0x1cf3a4={},_0x48257d={'count':0x0,'rows':[]};var _0x23fc35=_[_0xb333('0x20')](db[_0xb333('0x2f')][_0xb333('0x30')],function(_0x36eec9){return{'name':_0x36eec9[_0xb333('0x31')],'type':_0x36eec9[_0xb333('0x32')]['key']};});_0x1cf3a4[_0xb333('0x33')]=_[_0xb333('0x20')](_0x23fc35,_0xb333('0x1d'));_0x1cf3a4['query']=_[_0xb333('0x34')](_0x2da2ff[_0xb333('0x35')]);_0x1cf3a4[_0xb333('0x36')]=_[_0xb333('0x37')](_0x1cf3a4[_0xb333('0x33')],_0x1cf3a4[_0xb333('0x35')]);_0x14586d['attributes']=_[_0xb333('0x37')](_0x1cf3a4[_0xb333('0x33')],qs[_0xb333('0x38')](_0x2da2ff['query'][_0xb333('0x38')]));_0x14586d[_0xb333('0x39')]=_0x14586d[_0xb333('0x39')][_0xb333('0x3a')]?_0x14586d[_0xb333('0x39')]:_0x1cf3a4[_0xb333('0x33')];if(!_0x2da2ff['query']['hasOwnProperty']('nolimit')){_0x14586d['limit']=qs[_0xb333('0x14')](_0x2da2ff[_0xb333('0x35')]['limit']);_0x14586d['offset']=qs['offset'](_0x2da2ff[_0xb333('0x35')][_0xb333('0x15')]);}_0x14586d[_0xb333('0x3b')]=qs[_0xb333('0x3c')](_0x2da2ff[_0xb333('0x35')][_0xb333('0x3c')]);_0x14586d[_0xb333('0x3d')]=qs[_0xb333('0x36')](_['pick'](_0x2da2ff[_0xb333('0x35')],_0x1cf3a4['filters']),_0x23fc35);var _0x43f244=[];var _0x32b6c9=squel[_0xb333('0x3e')]()['field']('id')[_0xb333('0x3f')](_0xb333('0x1d'))[_0xb333('0x3f')](_0xb333('0x40'))[_0xb333('0x41')](_0xb333('0x42'));var _0x5659f3=squel[_0xb333('0x3e')]()[_0xb333('0x3f')](_0xb333('0x43'))[_0xb333('0x3f')](_0xb333('0x44'))[_0xb333('0x3f')](_0xb333('0x45'))[_0xb333('0x41')]('user_has_mail_interactions','ui')[_0xb333('0x46')](_0xb333('0x47'),'u',_0xb333('0x48'));var _0x27a1ac=squel[_0xb333('0x3e')]()[_0xb333('0x41')](_0xb333('0x49'),'i')[_0xb333('0x46')](_0xb333('0x4a'),'c',_0xb333('0x4b'))[_0xb333('0x46')](_0xb333('0x47'),'o',_0xb333('0x4c'))[_0xb333('0x46')]('mail_accounts','a',_0xb333('0x4d'))[_0xb333('0x46')](_0xb333('0x4e'),'me',_0xb333('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xb333('0x50'))[_0xb333('0x46')](_0xb333('0x42'),'t','t.id\x20=\x20it.TagId');var _0x1bc74d=squel[_0xb333('0x51')]();var _0x19f1de=[];var _0x3db5e1=squel[_0xb333('0x51')]();var _0x108bfc;if(_0x2da2ff[_0xb333('0x35')][_0xb333('0x52')]){_0x108bfc=as[_0xb333('0x53')](_0x2da2ff[_0xb333('0x35')]['search']);var _0x33956e=_0x108bfc[_0xb333('0x54')];for(var _0x129019=0x0;_0x129019<_0x108bfc[_0xb333('0x55')][_0xb333('0x3a')];_0x129019++){var _0x156e3c=_0x108bfc[_0xb333('0x55')][_0x129019];var _0x4f21c4='i';var _0x116a2e=_[_0xb333('0x56')](_0x23fc35,['name',_0x156e3c[_0xb333('0x3f')]]);if(!_0x116a2e){switch(_0x156e3c[_0xb333('0x3f')]){case _0xb333('0x57'):if(_0x156e3c[_0xb333('0x58')]==0x1){_0x27a1ac['having']('`'+_0x156e3c[_0xb333('0x3f')]+_0xb333('0x59'));}else{_0x27a1ac['having']('`'+_0x156e3c['field']+_0xb333('0x5a'));}break;case'Contact':if(_0x156e3c['operator']===_0xb333('0x5b')){if(_0x156e3c[_0xb333('0x58')]['split']('\x20')[_0xb333('0x3a')]>0x1){_0x1bc74d[_0x33956e](_0xb333('0x5c'),qs[_0xb333('0x5d')](_0x156e3c[_0xb333('0x58')]),null);}else{var _0x926e0d='%'+_0x156e3c['value']+'%';_0x1bc74d[_0x33956e](_0xb333('0x5e'),_0x926e0d,_0x926e0d,_0x926e0d);}}else{_0x116a2e=_[_0xb333('0x56')](_0x23fc35,[_0xb333('0x1d'),_0xb333('0x5f')]);_0x156e3c[_0xb333('0x3f')]=_0xb333('0x5f');_0xf61532=as[_0xb333('0x60')](_0x4f21c4,_0x116a2e[_0xb333('0x32')],_0x156e3c);_0x1bc74d[_0x33956e](_0xf61532['text'],_0xf61532['value']['start'],_0xf61532[_0xb333('0x58')]['end']);}break;case'Tag':var _0x2a1c0b=_0x156e3c['value'][_0xb333('0x24')](',')[_0xb333('0x20')](function(_0x3140ca){return Number(_0x3140ca);});_0x2a1c0b[_0xb333('0x25')](function(_0x12505b){_0x3db5e1['or'](_0xb333('0x61'),'%,'+_0x12505b+',%');});_0x19f1de=_[_0xb333('0x62')](_0x19f1de,_0x2a1c0b);break;case'User':if(_0x156e3c['operator']===_0xb333('0x5b')){_0x1bc74d[_0x33956e](_0xb333('0x63'),'%'+_0x156e3c[_0xb333('0x58')]+'%',null);}else{_0x116a2e=_['find'](_0x23fc35,[_0xb333('0x1d'),_0xb333('0x64')]);_0x156e3c[_0xb333('0x3f')]=_0xb333('0x64');_0xf61532=as['buildExpression'](_0x4f21c4,_0x116a2e[_0xb333('0x32')],_0x156e3c);_0x1bc74d[_0x33956e](_0xf61532[_0xb333('0x65')],_0xf61532[_0xb333('0x58')][_0xb333('0x66')],_0xf61532[_0xb333('0x58')]['end']);}break;case _0xb333('0x2a'):_0xf61532=as[_0xb333('0x60')]('me',null,_0x156e3c);_0x1bc74d[_0x33956e](_0xf61532[_0xb333('0x65')],_0xf61532['value'][_0xb333('0x66')],_0xf61532[_0xb333('0x58')][_0xb333('0x11')]);break;}}else{var _0xf61532=as[_0xb333('0x60')](_0x4f21c4,_0x116a2e['type'],_0x156e3c);_0x1bc74d[_0x33956e](_0xf61532[_0xb333('0x65')],_0xf61532[_0xb333('0x58')][_0xb333('0x66')],_0xf61532[_0xb333('0x58')][_0xb333('0x11')]);}}}else{var _0x26d310=_(_0x2da2ff[_0xb333('0x35')])[_0xb333('0x34')]()[_0xb333('0x20')](function(_0x1c9a5e){return _['some'](_0x23fc35,[_0xb333('0x1d'),_0x1c9a5e])?_0x1c9a5e:undefined;})[_0xb333('0x67')]()['value']();if(!_['isEmpty'](_0x26d310)){_0x26d310[_0xb333('0x25')](function(_0x213e85){if(_0x213e85===_0xb333('0x68')){_0x27a1ac[_0xb333('0x3d')](_0xb333('0x69'),[][_0xb333('0x6a')](_0x2da2ff[_0xb333('0x35')][_0x213e85]));}else if(_0x213e85===_0xb333('0x6b')){var _0x553f7f=JSON[_0xb333('0x6c')](_0x2da2ff['query'][_0x213e85])[_0xb333('0x6d')];var _0x56f2b1=JSON[_0xb333('0x6c')](_0x2da2ff[_0xb333('0x35')][_0x213e85])['$lte'];_0x27a1ac[_0xb333('0x3d')](_0xb333('0x6e'),_0x553f7f,_0x56f2b1);}else{if(_0x2da2ff[_0xb333('0x35')][_0x213e85]===_0xb333('0x6f')){_0x27a1ac[_0xb333('0x3d')]('i.'+_0x213e85+_0xb333('0x70'));}else{_0x27a1ac[_0xb333('0x3d')]('i.'+_0x213e85+_0xb333('0x71'),_0x2da2ff[_0xb333('0x35')][_0x213e85]);}}});}if(_0x2da2ff[_0xb333('0x35')][_0xb333('0x72')]){if(_0x2da2ff['query']['read']==0x1){_0x27a1ac[_0xb333('0x73')]('`unreadMessages`\x20=\x200');}else{_0x27a1ac[_0xb333('0x73')](_0xb333('0x74'));}}if(_0x2da2ff[_0xb333('0x35')][_0xb333('0x75')]){_0x19f1de=_['isArray'](_0x2da2ff[_0xb333('0x35')][_0xb333('0x75')])?_0x2da2ff[_0xb333('0x35')]['tag']:new Array(_0x2da2ff[_0xb333('0x35')][_0xb333('0x75')]);_0x19f1de[_0xb333('0x25')](function(_0x1069ff){_0x3db5e1['or'](_0xb333('0x61'),'%,'+_0x1069ff+',%');});}if(_0x2da2ff[_0xb333('0x35')]['filter']){var _0x4f3000=_0x2da2ff[_0xb333('0x35')]['filter'][_0xb333('0x76')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4f3000)){_0x1bc74d['or'](_0xb333('0x77'),_0x4f3000+'%');}else if(qs['isEmail'](_0x4f3000)){_0x1bc74d['or'](_0xb333('0x78'),_0x4f3000+'%');}else{_0x1bc74d['or'](_0xb333('0x79'),qs[_0xb333('0x5d')](_0x4f3000))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb333('0x5d')](_0x4f3000));}}}_0x27a1ac['where'](_0x1bc74d);_0x27a1ac[_0xb333('0x7a')](_0xb333('0x7b'));var _0x4043aa={'type':db['Sequelize'][_0xb333('0x7c')][_0xb333('0x7d')],'raw':!![]};var _0xc889b8=_0x27a1ac[_0xb333('0x7e')]();_0xc889b8[_0xb333('0x3f')](_0xb333('0x7b'));_0xc889b8['field'](_0xb333('0x7f'),'unreadMessages');if(_0x14586d[_0xb333('0x3b')]){_0x14586d['order'][_0xb333('0x25')](function(_0x14b726){var _0x5ded06=_0x14b726[0x0]==='contactName'?_0x14b726[0x0]:'i.'+_0x14b726[0x0];_0x27a1ac[_0xb333('0x3b')](_0x5ded06,_0x14b726[0x1]===_0xb333('0x80')?![]:!![]);});}if(!_[_0xb333('0x81')](_0x19f1de)){_0x27a1ac[_0xb333('0x73')](_0x3db5e1);_0xc889b8[_0xb333('0x3d')]('t.id\x20IN\x20?',_0x19f1de);}BPromise['resolve']()[_0xb333('0x19')](function(){if(!_0x108bfc){if(_0x2da2ff['query'][_0xb333('0x68')])return;_0xc889b8[_0xb333('0x3d')](_0xb333('0x82'));_0x27a1ac['where'](_0xb333('0x82'));return;}if(_0x2da2ff[_0xb333('0x83')]['role']!=='agent')return;return _0x2da2ff[_0xb333('0x83')]['getMailAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0xd7d51a){if(_[_0xb333('0x81')](_0xd7d51a)){_0xc889b8[_0xb333('0x3d')](_0xb333('0x84'));_0x27a1ac['where'](_0xb333('0x84'));}else{_0xc889b8[_0xb333('0x3d')](_0xb333('0x69'),_[_0xb333('0x20')](_0xd7d51a,'id'));_0x27a1ac[_0xb333('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xb333('0x20')](_0xd7d51a,'id'));}});})[_0xb333('0x19')](function(){if(_0x2da2ff[_0xb333('0x83')][_0xb333('0x85')]===_0xb333('0x86')&&!_0x108bfc&&!_0x2da2ff[_0xb333('0x35')]['MailAccountId'])return[];return db[_0xb333('0x87')][_0xb333('0x35')](_0xc889b8[_0xb333('0x88')](),_0x4043aa);})[_0xb333('0x19')](function(_0x201d86){_0x48257d[_0xb333('0x16')]=_0x201d86[_0xb333('0x3a')];if(_0x48257d[_0xb333('0x16')]===0x0)return[];return db[_0xb333('0x87')]['query'](_0x32b6c9[_0xb333('0x88')](),_0x4043aa)[_0xb333('0x19')](function(_0x37a7c0){_0x43f244=_[_0xb333('0x89')](_0x37a7c0,'id');_0x4043aa=_[_0xb333('0x8a')](_0x4043aa,{'model':db[_0xb333('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2da2ff['query']['fields']){_0x14586d['attributes']['forEach'](function(_0x3aa655){_0x27a1ac[_0xb333('0x3f')]('i.'+_0x3aa655);});}else{_0x27a1ac[_0xb333('0x3f')](_0xb333('0x7f'),_0xb333('0x57'));_0x27a1ac['field'](_0xb333('0x8b'),_0xb333('0x8c'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x8d'),_0xb333('0x8e'));_0x27a1ac['field'](_0xb333('0x8f'),_0xb333('0x90'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x7b'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x91'));_0x27a1ac['field'](_0xb333('0x92'));_0x27a1ac['field'](_0xb333('0x93'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x94'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x95'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x96'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x97'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x98'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x99'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x9a'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x9b'));_0x27a1ac['field'](_0xb333('0x9c'));_0x27a1ac['field']('i.to');_0x27a1ac['field'](_0xb333('0x9d'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x9e'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0x9f'));_0x27a1ac[_0xb333('0x3f')]('c.firstName',_0xb333('0xa0'));_0x27a1ac[_0xb333('0x3f')]('c.lastName',_0xb333('0xa1'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0xa2'),_0xb333('0xa3'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0xa4'),'Contact.phone');_0x27a1ac[_0xb333('0x3f')](_0xb333('0xa5'),'Contact.mobile');_0x27a1ac[_0xb333('0x3f')](_0xb333('0xa6'),'Contact.fax');_0x27a1ac[_0xb333('0x3f')]('o.fullname','Owner.fullname');_0x27a1ac[_0xb333('0x3f')](_0xb333('0xa7'),_0xb333('0xa8'));_0x27a1ac[_0xb333('0x3f')](_0xb333('0xa9'),_0xb333('0x22'));}if(_0x14586d[_0xb333('0x14')])_0x27a1ac['limit'](_0x14586d[_0xb333('0x14')]);if(_0x14586d[_0xb333('0x15')])_0x27a1ac[_0xb333('0x15')](_0x14586d[_0xb333('0x15')]);return db[_0xb333('0x87')][_0xb333('0x35')](_0x27a1ac[_0xb333('0x88')](),_0x4043aa);})[_0xb333('0x19')](function(_0x45c189){if(_0x45c189['length']>0x0)_0x5659f3[_0xb333('0x3d')](_0xb333('0xaa'),_[_0xb333('0x20')](_0x45c189,'id'));return db[_0xb333('0x87')][_0xb333('0x35')](_0x5659f3[_0xb333('0x88')](),_0x4043aa)[_0xb333('0x19')](function(_0x5493ae){var _0x39c8cc=_['groupBy'](_0x5493ae,'MailInteractionId');var _0x48b989=[];return db['Setting'][_0xb333('0x28')]({'attributes':[_0xb333('0xab')],'raw':!![]})[_0xb333('0x19')](function(_0x175de5){var _0xdd62a3=_0x175de5[_0xb333('0xab')];_0x45c189[_0xb333('0x25')](function(_0x445e11){_0x48b989['push'](updateMailInteraction(_0x445e11,_0x43f244,_0x39c8cc,_0xdd62a3));});return BPromise[_0xb333('0xac')](_0x48b989);});});});})['then'](function(_0x3ece93){_0x48257d[_0xb333('0xad')]=_0x3ece93;return _0x48257d;})[_0xb333('0x19')](respondWithFilteredResult(_0x28f738,_0x14586d))[_0xb333('0x2d')](handleError(_0x28f738,null));};exports['show']=function(_0x22ceb5,_0x2173e2){var _0x36f169={'raw':![],'where':{'id':_0x22ceb5[_0xb333('0xae')]['id']}},_0x4962cf={};_0x4962cf[_0xb333('0x33')]=_[_0xb333('0x34')](db[_0xb333('0x2f')][_0xb333('0x30')]);_0x4962cf[_0xb333('0x35')]=_[_0xb333('0x34')](_0x22ceb5[_0xb333('0x35')]);_0x4962cf[_0xb333('0x36')]=_[_0xb333('0x37')](_0x4962cf[_0xb333('0x33')],_0x4962cf[_0xb333('0x35')]);_0x36f169[_0xb333('0x39')]=_[_0xb333('0x37')](_0x4962cf[_0xb333('0x33')],qs[_0xb333('0x38')](_0x22ceb5[_0xb333('0x35')][_0xb333('0x38')]));_0x36f169[_0xb333('0x39')]=_0x36f169[_0xb333('0x39')]['length']?_0x36f169[_0xb333('0x39')]:_0x4962cf[_0xb333('0x33')];if(_0x22ceb5[_0xb333('0x35')][_0xb333('0xaf')]){_0x36f169[_0xb333('0xb0')]=[{'all':!![]}];}_0x36f169=_['merge']({},_0x36f169,_0x22ceb5['options']);return db[_0xb333('0x2f')][_0xb333('0x56')](_0x36f169)['then'](handleEntityNotFound(_0x2173e2,null))[_0xb333('0x19')](respondWithResult(_0x2173e2,null))['catch'](handleError(_0x2173e2,null));};exports['create']=function(_0x7efbf,_0x2cee34){return db['MailInteraction'][_0xb333('0xb1')](_0x7efbf[_0xb333('0xb2')],{})[_0xb333('0x19')](respondWithResult(_0x2cee34,0xc9))[_0xb333('0x2d')](handleError(_0x2cee34,null));};exports[_0xb333('0x18')]=function(_0x6e7205,_0x43b43e){if(_0x6e7205[_0xb333('0xb2')]['id']){delete _0x6e7205[_0xb333('0xb2')]['id'];}return db[_0xb333('0x2f')][_0xb333('0x56')]({'where':{'id':_0x6e7205[_0xb333('0xae')]['id']}})['then'](handleEntityNotFound(_0x43b43e,null))['then'](saveUpdates(_0x6e7205[_0xb333('0xb2')],null))['then'](respondWithResult(_0x43b43e,null))['catch'](handleError(_0x43b43e,null));};exports[_0xb333('0x1a')]=function(_0x367cf5,_0xfb6c13){return db[_0xb333('0x2f')][_0xb333('0x56')]({'where':{'id':_0x367cf5[_0xb333('0xae')]['id']}})[_0xb333('0x19')](handleEntityNotFound(_0xfb6c13,null))['then'](removeEntity(_0xfb6c13,null))['catch'](handleError(_0xfb6c13,null));};exports[_0xb333('0xb3')]=function(_0x369bea,_0x25e50c){return db[_0xb333('0x2f')][_0xb333('0xb3')]()[_0xb333('0x19')](respondWithResult(_0x25e50c,null))[_0xb333('0x2d')](handleError(_0x25e50c,null));};exports[_0xb333('0xb4')]=function(_0x33413e,_0x161824){return db[_0xb333('0x27')]['find']({'where':{'id':_0x33413e[_0xb333('0xae')]['id']}})[_0xb333('0x19')](handleEntityNotFound(_0x161824,null))['then'](function(_0x2e2319){if(_0x2e2319){return _0x2e2319[_0xb333('0xb4')](_0x33413e['body'][_0xb333('0xb5')],_[_0xb333('0xb6')](_0x33413e[_0xb333('0xb2')],[_0xb333('0xb5'),'id'])||{});}})[_0xb333('0x19')](respondWithResult(_0x161824,null))[_0xb333('0x2d')](handleError(_0x161824,null));};exports['getMessages']=function(_0x130119,_0xc442ff){var _0x23cf6e={'raw':![],'where':{}};var _0xc4361a={};var _0x55bf45={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x130119['params']['id']}})[_0xb333('0x19')](handleEntityNotFound(_0xc442ff,null))['then'](function(_0x19dc28){if(_0x19dc28){_0xc4361a[_0xb333('0x33')]=_[_0xb333('0x34')](db[_0xb333('0x27')][_0xb333('0x30')]);_0xc4361a[_0xb333('0x35')]=_[_0xb333('0x34')](_0x130119[_0xb333('0x35')]);_0xc4361a['filters']=_[_0xb333('0x37')](_0xc4361a['model'],_0xc4361a[_0xb333('0x35')]);_0x23cf6e[_0xb333('0x39')]=_[_0xb333('0x37')](_0xc4361a[_0xb333('0x33')],qs['fields'](_0x130119[_0xb333('0x35')][_0xb333('0x38')]));_0x23cf6e[_0xb333('0x39')]=_0x23cf6e[_0xb333('0x39')]['length']?_0x23cf6e[_0xb333('0x39')]:_0xc4361a[_0xb333('0x33')];if(!_0x130119[_0xb333('0x35')][_0xb333('0xb7')](_0xb333('0xb8'))){_0x23cf6e[_0xb333('0x14')]=qs[_0xb333('0x14')](_0x130119[_0xb333('0x35')]['limit']);_0x23cf6e[_0xb333('0x15')]=qs[_0xb333('0x15')](_0x130119[_0xb333('0x35')][_0xb333('0x15')]);}_0x23cf6e[_0xb333('0x3b')]=qs['sort'](_0x130119[_0xb333('0x35')][_0xb333('0x3c')]);_0x23cf6e['where']=qs[_0xb333('0x36')](_[_0xb333('0xb9')](_0x130119[_0xb333('0x35')],_0xc4361a[_0xb333('0x36')]));_0x23cf6e[_0xb333('0x3d')]['MailInteractionId']=_0x19dc28['id'];if(_0x130119[_0xb333('0x35')][_0xb333('0xba')]){_0x23cf6e[_0xb333('0x3d')]=_['merge'](_0x23cf6e['where'],{'$or':_[_0xb333('0x20')](_0x23cf6e[_0xb333('0x39')],function(_0x4c3fa4){var _0x4bbaa2={};_0x4bbaa2[_0x4c3fa4]={'$like':'%'+_0x130119[_0xb333('0x35')][_0xb333('0xba')]+'%'};return _0x4bbaa2;})});}if(_0x130119[_0xb333('0x35')][_0xb333('0x6d')]){var _0x4ddd2d=_0x130119[_0xb333('0x35')][_0xb333('0x6d')]['split'](',');var _0x594cfb={};_0x594cfb[_0x4ddd2d[0x0]]={'$gte':moment(_0x4ddd2d[0x1])['format'](_0xb333('0xbb'))};_0x23cf6e[_0xb333('0x3d')]=_[_0xb333('0x8a')](_0x23cf6e[_0xb333('0x3d')],_0x594cfb);}_0x23cf6e=_[_0xb333('0x8a')]({},_0x23cf6e,_0x130119[_0xb333('0xbc')]);return db[_0xb333('0x27')][_0xb333('0x16')]({'where':_0x23cf6e[_0xb333('0x3d')]})[_0xb333('0x19')](function(_0x38d778){_0x55bf45[_0xb333('0x16')]=_0x38d778;if(_0x130119['query'][_0xb333('0xaf')]){_0x23cf6e[_0xb333('0xb0')]=[{'all':!![]}];}return db['MailMessage'][_0xb333('0xbd')](_0x23cf6e);})[_0xb333('0x19')](function(_0x36aeb8){if(_0x130119[_0xb333('0x35')]['inlineCss']==='true'){for(var _0x2364db=0x0;_0x2364db<_0x36aeb8[_0xb333('0x3a')];_0x2364db++){_0x36aeb8[_0x2364db][_0xb333('0xb2')]=juice(_0x36aeb8[_0x2364db][_0xb333('0xb2')]);}}_0x55bf45[_0xb333('0xad')]=_0x36aeb8;return _0x55bf45;});}})[_0xb333('0x19')](respondWithFilteredResult(_0xc442ff,_0x23cf6e))['catch'](handleError(_0xc442ff,null));};exports[_0xb333('0xbe')]=function(_0x4a814e,_0x63547f){return db['MailInteraction'][_0xb333('0x56')]({'where':{'id':_0x4a814e[_0xb333('0xae')]['id']}})['then'](handleEntityNotFound(_0x63547f,null))[_0xb333('0x19')](function(_0xcdf122){if(_0xcdf122){return _0xcdf122[_0xb333('0xbf')](_0x4a814e[_0xb333('0xb2')][_0xb333('0xb5')],_[_0xb333('0xb6')](_0x4a814e['body'],[_0xb333('0xb5'),'id'])||{})['spread'](function(){return db[_0xb333('0xc0')]['findAll']({'attributes':['id',_0xb333('0x1d'),'color'],'where':{'id':_0x4a814e[_0xb333('0xb2')]['ids']}});})[_0xb333('0x19')](function(_0xf910fb){socket[_0xb333('0xc1')]('mailInteractionTags:save',{'id':Number(_0x4a814e[_0xb333('0xae')]['id']),'tags':_0xf910fb||[]});return{'id':Number(_0x4a814e['params']['id']),'tags':_0xf910fb||[]};});}})[_0xb333('0x19')](respondWithResult(_0x63547f,null))['catch'](handleError(_0x63547f,null));};exports[_0xb333('0xc2')]=function(_0x5b530f,_0x4c93f6){return db[_0xb333('0x2f')]['find']({'where':{'id':_0x5b530f[_0xb333('0xae')]['id']}})[_0xb333('0x19')](handleEntityNotFound(_0x4c93f6,null))[_0xb333('0x19')](function(_0x8eec4d){if(_0x8eec4d){return _0x8eec4d[_0xb333('0xc2')](_0x5b530f[_0xb333('0x35')]['ids']);}})[_0xb333('0x19')](respondWithStatusCode(_0x4c93f6,null))[_0xb333('0x2d')](handleError(_0x4c93f6,null));};exports[_0xb333('0xc3')]=function(_0x5bb132,_0x2768ef){var _0x1b37c8=moment()[_0xb333('0xc4')]()[_0xb333('0x88')]();var _0x58aeed=path[_0xb333('0xc5')](config[_0xb333('0xc6')],_0xb333('0xc7'),_0xb333('0xc8'),_0xb333('0xc9'));var _0x144ea3=path[_0xb333('0xc5')](config[_0xb333('0xc6')],'server',_0xb333('0xc8'),_0xb333('0xca'));var _0x203673=path['join'](_0x58aeed,_0x1b37c8);var _0x499862=util[_0xb333('0xcb')]('transcript-%d-%s.zip',_0x5bb132[_0xb333('0xae')]['id'],_0x1b37c8);var _0x4de223=path[_0xb333('0xc5')](_0x58aeed,_0x499862);var _0x4306c7=[];if(_0x5bb132[_0xb333('0x35')]['attachments']){_0x4306c7[_0xb333('0x26')]({'model':db[_0xb333('0xcc')],'as':'Attachments','raw':!![]});}var _0x275679=[{'model':db[_0xb333('0x27')],'as':'Messages','attributes':['id','body',_0xb333('0x41'),'to','cc','bcc',_0xb333('0xcd'),_0xb333('0x6b')],'where':{'secret':![]},'order':qs[_0xb333('0x3c')]('id'),'include':_0x4306c7}];return db[_0xb333('0x2f')][_0xb333('0x56')]({'where':{'id':_0x5bb132[_0xb333('0xae')]['id']},'include':_0x275679})[_0xb333('0x19')](handleEntityNotFound(_0x2768ef,null))['then'](function(_0x3099fa){if(_0x3099fa&&_0x3099fa['Messages']){var _0x39f1fd=_0x3099fa['get']({'plain':!![]});fs[_0xb333('0xce')](_0x203673);return BPromise[_0xb333('0xcf')](_0x39f1fd[_0xb333('0xd0')],function(_0x33e903,_0x20a96d){var _0x1646c2={'from':_0x33e903[_0xb333('0x41')],'to':_0x33e903['to'],'subject':_0x33e903[_0xb333('0xcd')],'html':htmlEntities['decode'](_0x33e903[_0xb333('0xb2')]),'headers':{'Date':moment(_0x33e903[_0xb333('0x6b')])[_0xb333('0xcb')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x33e903['cc']){_0x1646c2[_0xb333('0xd1')]['Cc']=_0x33e903['cc'];}if(_0x33e903[_0xb333('0xd2')]){_0x1646c2[_0xb333('0xd1')][_0xb333('0xd3')]=_0x33e903[_0xb333('0xd2')];}return new BPromise(function(_0x5740ec,_0x473188){if(_0x33e903[_0xb333('0xd4')]){for(var _0x255ccd=0x0;_0x255ccd<_0x33e903[_0xb333('0xd4')][_0xb333('0x3a')];_0x255ccd++){var _0x320d70=_0x33e903['Attachments'][_0x255ccd];var _0x31683d=path['join'](_0x144ea3,_0x320d70[_0xb333('0xd5')]);if(fs['existsSync'](_0x31683d)){_0x1646c2['attachments']['push']({'name':_0x320d70[_0xb333('0x1d')],'contentType':_0x320d70[_0xb333('0x32')],'data':fs['readFileSync'](_0x31683d)});}}}emlformat['build'](_0x1646c2,function(_0x5caf4c,_0x2a4f05){if(_0x5caf4c)return _0x473188(_0x5caf4c);fs['writeFileSync'](path[_0xb333('0xc5')](_0x203673,util['format'](_0xb333('0xd6'),_0x20a96d)),_0x2a4f05);return _0x5740ec(_0x2a4f05);});});})[_0xb333('0x19')](function(){return new BPromise(function(_0x28948d,_0x20617b){zipdir(_0x203673,{'saveTo':_0x4de223},function(_0x3c3199,_0x1dbf31){if(_0x3c3199)return _0x20617b(_0x3c3199);return _0x28948d(_0x1dbf31);});})[_0xb333('0x19')](function(){return new BPromise(function(_0x57a170,_0x4f1fee){rimraf(_0x203673,function(_0x257b95){if(_0x257b95)_0x4f1fee(_0x257b95);return _0x57a170();});});})[_0xb333('0x19')](function(){return _0x2768ef[_0xb333('0xc3')](_0x4de223,_0x499862,function(_0x1103b4){if(!_0x1103b4)fs[_0xb333('0xd7')](_0x4de223);});});});}else{return _0x2768ef[_0xb333('0xd8')](0xc8);}})[_0xb333('0x2d')](handleError(_0x2768ef,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a1f1dd4..0ed6136 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 _0x7b6f=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x813c4b,_0x7a6ecb){var _0x19bc1c=function(_0x25dda7){while(--_0x25dda7){_0x813c4b['push'](_0x813c4b['shift']());}};_0x19bc1c(++_0x7a6ecb);}(_0x7b6f,0x72));var _0xf7b6=function(_0x278607,_0x52f65f){_0x278607=_0x278607-0x0;var _0x162d37=_0x7b6f[_0x278607];return _0x162d37;};'use strict';var EventEmitter=require(_0xf7b6('0x0'));var MailInteraction=require(_0xf7b6('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xf7b6('0x1'))['db'][_0xf7b6('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf7b6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7b6('0x4'),'afterDestroy':_0xf7b6('0x5')};function emitEvent(_0x2e9314){return function(_0x70087a,_0x2cf5be,_0x2413a7){_0x70087a[_0xf7b6('0x6')]({'attributes':['id'],'raw':!![]})[_0xf7b6('0x7')](function(_0x467934){_0x70087a[_0xf7b6('0x8')](_0xf7b6('0x9'),_0x467934['map'](function(_0x1843a8){return{'id':_0x1843a8['id']};}));return MailMessage[_0xf7b6('0xa')]({'where':{'MailInteractionId':_0x70087a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x33a13a){_0x70087a[_0xf7b6('0x8')](_0xf7b6('0xb'),_0x33a13a[_0xf7b6('0xc')]);MailInteractionEvents[_0xf7b6('0xd')](_0x2e9314+':'+_0x70087a['id'],_0x70087a);MailInteractionEvents[_0xf7b6('0xd')](_0x2e9314,_0x70087a);_0x2413a7(null);})[_0xf7b6('0xe')](_0x2413a7(null));};}for(var e in events){if(events[_0xf7b6('0xf')](e)){var event=events[e];MailInteraction[_0xf7b6('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xbf79=['setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','emit','hasOwnProperty','hook','../../mysqldb','MailMessage'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbf79,0x66));var _0x9bf7=function(_0x5c03a1,_0x1bd47f){_0x5c03a1=_0x5c03a1-0x0;var _0x1e7142=_0xbf79[_0x5c03a1];return _0x1e7142;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x9bf7('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x9bf7('0x0'))['db'][_0x9bf7('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9bf7('0x2')](0x0);var events={'afterCreate':_0x9bf7('0x3'),'afterUpdate':_0x9bf7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x151f8a){return function(_0x57482f,_0x579a4a,_0x141258){_0x57482f[_0x9bf7('0x5')]({'attributes':['id'],'raw':!![]})[_0x9bf7('0x6')](function(_0x4abacf){_0x57482f[_0x9bf7('0x7')](_0x9bf7('0x8'),_0x4abacf['map'](function(_0x5c4c67){return{'id':_0x5c4c67['id']};}));return MailMessage[_0x9bf7('0x9')]({'where':{'MailInteractionId':_0x57482f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9bf7('0x6')](function(_0x3e9f65){_0x57482f['setDataValue']('unreadMessages',_0x3e9f65['length']);MailInteractionEvents[_0x9bf7('0xa')](_0x151f8a+':'+_0x57482f['id'],_0x57482f);MailInteractionEvents['emit'](_0x151f8a,_0x57482f);_0x141258(null);})['catch'](_0x141258(null));};}for(var e in events){if(events[_0x9bf7('0xb')](e)){var event=events[e];MailInteraction[_0x9bf7('0xc')](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 83e9c37..35237c5 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 _0x53c0=['FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions'];(function(_0x2cfd3a,_0x3f3797){var _0x48f70a=function(_0x8c4900){while(--_0x8c4900){_0x2cfd3a['push'](_0x2cfd3a['shift']());}};_0x48f70a(++_0x3f3797);}(_0x53c0,0xcc));var _0x053c=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0x53c0[_0x12b83d];return _0x1fd39d;};'use strict';var _=require(_0x053c('0x0'));var util=require(_0x053c('0x1'));var logger=require(_0x053c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x053c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x053c('0x4'));var rimraf=require(_0x053c('0x5'));var config=require(_0x053c('0x6'));var attributes=require(_0x053c('0x7'));module[_0x053c('0x8')]=function(_0x15f3c8,_0xa49529){return _0x15f3c8[_0x053c('0x9')](_0x053c('0xa'),attributes,{'tableName':_0x053c('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x053c('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5aff73,_0x2405d6,_0x4e9e35){if(_0x5aff73[_0x053c('0xd')]){_0x5aff73[_0x053c('0xe')]=moment()[_0x053c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5aff73[_0x053c('0x10')]){_0x5aff73[_0x053c('0x11')]=moment()[_0x053c('0xf')](_0x053c('0x12'));}_0x4e9e35(null,_0x2405d6);},'beforeUpdate':function(_0x2a5c84,_0x1dcbc6,_0x3026a3){if(_0x2a5c84['changed'](_0x053c('0xd'))){_0x2a5c84['substatusAt']=_0x2a5c84['substatus']?moment()[_0x053c('0xf')](_0x053c('0x12')):null;}if(_0x2a5c84[_0x053c('0x13')](_0x053c('0x10'))){_0x2a5c84['closedAt']=moment()[_0x053c('0xf')](_0x053c('0x12'));_0x2a5c84[_0x053c('0xd')]=null;_0x2a5c84[_0x053c('0xe')]=null;}_0x3026a3(null,_0x2a5c84);},'afterUpdate':function(_0x33276f,_0x1453d5,_0xeb3d97){var _0x3a34af=_0x15f3c8[_0x053c('0x14')];var _0x5c8b00=_0x33276f[_0x053c('0x15')]({'plain':!![]});if(_0x5c8b00[_0x053c('0x10')]){return _0x3a34af[_0x053c('0x16')][_0x053c('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x5c8b00['id']}})['then'](function(){_0xeb3d97();})[_0x053c('0x18')](function(_0x3770bb){_0xeb3d97(_0x3770bb);});}else{_0xeb3d97();}}},'charset':_0x053c('0x19'),'collate':_0x053c('0x1a')});}; \ No newline at end of file +var _0x1a4c=['path','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','closed','closedAt','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x41b840,_0x1a3baf){var _0x2a0adf=function(_0x2eb5a7){while(--_0x2eb5a7){_0x41b840['push'](_0x41b840['shift']());}};_0x2a0adf(++_0x1a3baf);}(_0x1a4c,0x1c5));var _0xc1a4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1a4c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc1a4('0x0'));var util=require(_0xc1a4('0x1'));var logger=require(_0xc1a4('0x2'))(_0xc1a4('0x3'));var moment=require(_0xc1a4('0x4'));var BPromise=require('bluebird');var rp=require(_0xc1a4('0x5'));var fs=require('fs');var path=require(_0xc1a4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x1fc609,_0xbab83e){return _0x1fc609[_0xc1a4('0x7')](_0xc1a4('0x8'),attributes,{'tableName':_0xc1a4('0x9'),'paranoid':![],'indexes':[{'name':_0xc1a4('0xa'),'fields':[_0xc1a4('0xb'),'to'],'type':_0xc1a4('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4c5a26,_0x8a11cd,_0x5088d9){if(_0x4c5a26[_0xc1a4('0xd')]){_0x4c5a26['substatusAt']=moment()[_0xc1a4('0xe')](_0xc1a4('0xf'));}if(_0x4c5a26['closed']){_0x4c5a26['closedAt']=moment()[_0xc1a4('0xe')](_0xc1a4('0xf'));}_0x5088d9(null,_0x8a11cd);},'beforeUpdate':function(_0x18eb52,_0x14722d,_0x5aabb5){if(_0x18eb52[_0xc1a4('0x10')](_0xc1a4('0xd'))){_0x18eb52[_0xc1a4('0x11')]=_0x18eb52[_0xc1a4('0xd')]?moment()[_0xc1a4('0xe')](_0xc1a4('0xf')):null;}if(_0x18eb52[_0xc1a4('0x10')](_0xc1a4('0x12'))){_0x18eb52[_0xc1a4('0x13')]=moment()[_0xc1a4('0xe')](_0xc1a4('0xf'));_0x18eb52[_0xc1a4('0xd')]=null;_0x18eb52[_0xc1a4('0x11')]=null;}_0x5aabb5(null,_0x18eb52);},'afterUpdate':function(_0x21faca,_0x5e7206,_0x2478ec){var _0x2a895d=_0x1fc609[_0xc1a4('0x14')];var _0x45abf9=_0x21faca['get']({'plain':!![]});if(_0x45abf9[_0xc1a4('0x12')]){return _0x2a895d[_0xc1a4('0x15')][_0xc1a4('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x45abf9['id']}})[_0xc1a4('0x17')](function(){_0x2478ec();})[_0xc1a4('0x18')](function(_0x34c485){_0x2478ec(_0x34c485);});}else{_0x2478ec();}}},'charset':_0xc1a4('0x19'),'collate':_0xc1a4('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d97442a..66f80c7 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 _0x2c31=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','debug','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./mailInteraction.socket','then','info','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2c31,0xb6));var _0x12c3=function(_0x3d1334,_0x1069ba){_0x3d1334=_0x3d1334-0x0;var _0x389bb5=_0x2c31[_0x3d1334];return _0x389bb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x12c3('0x0'));var BPromise=require(_0x12c3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12c3('0x2'));var db=require(_0x12c3('0x3'))['db'];var utils=require(_0x12c3('0x4'));var logger=require(_0x12c3('0x5'))(_0x12c3('0x6'));var config=require(_0x12c3('0x7'));var jayson=require(_0x12c3('0x8'));var client=jayson[_0x12c3('0x9')][_0x12c3('0xa')]({'port':0x232a});config['redis']=_[_0x12c3('0xb')](config['redis'],{'host':_0x12c3('0xc'),'port':0x18eb});var socket=require(_0x12c3('0xd'))(new Redis(config['redis']));require(_0x12c3('0xe'))['register'](socket);function respondWithRpcPromise(_0x52c6c8,_0xec6d20,_0x995394){return new BPromise(function(_0x73a067,_0x5e2230){return client['request'](_0x52c6c8,_0x995394)[_0x12c3('0xf')](function(_0x3c0c52){logger[_0x12c3('0x10')]('MailInteraction,\x20%s,\x20%s',_0xec6d20,_0x12c3('0x11'));logger['debug'](_0x12c3('0x12'),_0xec6d20,_0x12c3('0x11'),JSON[_0x12c3('0x13')](_0x3c0c52));if(_0x3c0c52['error']){if(_0x3c0c52[_0x12c3('0x14')][_0x12c3('0x15')]===0x1f4){logger[_0x12c3('0x14')]('MailInteraction,\x20%s,\x20%s',_0xec6d20,_0x3c0c52['error'][_0x12c3('0x16')]);return _0x5e2230(_0x3c0c52['error'][_0x12c3('0x16')]);}logger['error'](_0x12c3('0x17'),_0xec6d20,_0x3c0c52[_0x12c3('0x14')][_0x12c3('0x16')]);return _0x73a067(_0x3c0c52[_0x12c3('0x14')]['message']);}else{logger['info'](_0x12c3('0x17'),_0xec6d20,_0x12c3('0x11'));_0x73a067(_0x3c0c52[_0x12c3('0x18')][_0x12c3('0x16')]);}})[_0x12c3('0x19')](function(_0x114c06){logger[_0x12c3('0x14')](_0x12c3('0x17'),_0xec6d20,_0x114c06);_0x5e2230(_0x114c06);});});}exports[_0x12c3('0x1a')]=function(_0x421854){var _0x382a43=this;return new Promise(function(_0x36d853,_0x3f11b1){return db[_0x12c3('0x1b')][_0x12c3('0x1c')](_0x421854[_0x12c3('0x1d')],{'raw':_0x421854[_0x12c3('0x1e')]?_0x421854[_0x12c3('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x421854[_0x12c3('0x1e')]?_0x421854['options'][_0x12c3('0x1f')]||null:null,'attributes':_0x421854[_0x12c3('0x1e')]?_0x421854['options'][_0x12c3('0x20')]||null:null,'limit':_0x421854['options']?_0x421854[_0x12c3('0x1e')]['limit']||null:null})[_0x12c3('0xf')](function(_0x5ec26f){logger['info'](_0x12c3('0x1a'),_0x421854);logger[_0x12c3('0x21')](_0x12c3('0x1a'),_0x421854,JSON[_0x12c3('0x13')](_0x5ec26f));_0x36d853(_0x5ec26f);})[_0x12c3('0x19')](function(_0x789610){logger[_0x12c3('0x14')](_0x12c3('0x1a'),_0x789610[_0x12c3('0x16')],_0x421854);_0x3f11b1(_0x382a43[_0x12c3('0x14')](0x1f4,_0x789610[_0x12c3('0x16')]));});});};exports[_0x12c3('0x22')]=function(_0x57f638){return new Promise(function(_0x49e6d2,_0x59b35e){return db['MailInteraction'][_0x12c3('0x23')]({'where':_0x57f638['options']?_0x57f638[_0x12c3('0x1e')][_0x12c3('0x1f')]||null:null})[_0x12c3('0xf')](function(_0xcf9441){if(_0xcf9441){return _0xcf9441['addTags'](_0x57f638[_0x12c3('0x1d')][_0x12c3('0x24')],_[_0x12c3('0x25')](_0x57f638[_0x12c3('0x1d')],[_0x12c3('0x24'),'id'])||{});}})[_0x12c3('0x26')](function(_0xe09363){logger[_0x12c3('0x10')](_0x12c3('0x27'),_0x57f638);logger['debug']('AddTags',_0x57f638,JSON[_0x12c3('0x13')](_0xe09363));_0x49e6d2(_0xe09363);})[_0x12c3('0x19')](function(_0x75d6d1){logger[_0x12c3('0x14')](_0x12c3('0x27'),_0x75d6d1[_0x12c3('0x16')],_0x57f638);_0x59b35e(_this[_0x12c3('0x14')](0x1f4,_0x75d6d1[_0x12c3('0x16')]));});});}; \ No newline at end of file +var _0x5c84=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','update','body','options','raw','where','limit','AddTagsToMailInteraction','MailInteraction','find','omit','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x213cc1,_0x521fc7){var _0x22e97f=function(_0x47d3c1){while(--_0x47d3c1){_0x213cc1['push'](_0x213cc1['shift']());}};_0x22e97f(++_0x521fc7);}(_0x5c84,0x1ca));var _0x45c8=function(_0x1623ea,_0x415d5f){_0x1623ea=_0x1623ea-0x0;var _0x390531=_0x5c84[_0x1623ea];return _0x390531;};'use strict';var _=require(_0x45c8('0x0'));var util=require('util');var moment=require(_0x45c8('0x1'));var BPromise=require(_0x45c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45c8('0x3'));var db=require(_0x45c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45c8('0x5'))('rpc');var config=require(_0x45c8('0x6'));var jayson=require(_0x45c8('0x7'));var client=jayson[_0x45c8('0x8')][_0x45c8('0x9')]({'port':0x232a});config[_0x45c8('0xa')]=_[_0x45c8('0xb')](config[_0x45c8('0xa')],{'host':_0x45c8('0xc'),'port':0x18eb});var socket=require(_0x45c8('0xd'))(new Redis(config[_0x45c8('0xa')]));require(_0x45c8('0xe'))[_0x45c8('0xf')](socket);function respondWithRpcPromise(_0x511659,_0x49d7ba,_0x14f423){return new BPromise(function(_0x1e7998,_0x250dd3){return client[_0x45c8('0x10')](_0x511659,_0x14f423)[_0x45c8('0x11')](function(_0x2450b2){logger[_0x45c8('0x12')](_0x45c8('0x13'),_0x49d7ba,_0x45c8('0x14'));logger[_0x45c8('0x15')](_0x45c8('0x16'),_0x49d7ba,'request\x20sent',JSON[_0x45c8('0x17')](_0x2450b2));if(_0x2450b2[_0x45c8('0x18')]){if(_0x2450b2[_0x45c8('0x18')][_0x45c8('0x19')]===0x1f4){logger[_0x45c8('0x18')](_0x45c8('0x13'),_0x49d7ba,_0x2450b2[_0x45c8('0x18')][_0x45c8('0x1a')]);return _0x250dd3(_0x2450b2[_0x45c8('0x18')][_0x45c8('0x1a')]);}logger[_0x45c8('0x18')]('MailInteraction,\x20%s,\x20%s',_0x49d7ba,_0x2450b2['error'][_0x45c8('0x1a')]);return _0x1e7998(_0x2450b2[_0x45c8('0x18')][_0x45c8('0x1a')]);}else{logger[_0x45c8('0x12')]('MailInteraction,\x20%s,\x20%s',_0x49d7ba,'request\x20sent');_0x1e7998(_0x2450b2['result'][_0x45c8('0x1a')]);}})[_0x45c8('0x1b')](function(_0x142d8d){logger[_0x45c8('0x18')](_0x45c8('0x13'),_0x49d7ba,_0x142d8d);_0x250dd3(_0x142d8d);});});}exports[_0x45c8('0x1c')]=function(_0x9fc6c0){var _0x55d4d5=this;return new Promise(function(_0x586444,_0x4cfa8){return db['MailInteraction'][_0x45c8('0x1d')](_0x9fc6c0[_0x45c8('0x1e')],{'raw':_0x9fc6c0[_0x45c8('0x1f')]?_0x9fc6c0['options'][_0x45c8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9fc6c0['options']?_0x9fc6c0[_0x45c8('0x1f')][_0x45c8('0x21')]||null:null,'attributes':_0x9fc6c0[_0x45c8('0x1f')]?_0x9fc6c0[_0x45c8('0x1f')]['attributes']||null:null,'limit':_0x9fc6c0[_0x45c8('0x1f')]?_0x9fc6c0[_0x45c8('0x1f')][_0x45c8('0x22')]||null:null})[_0x45c8('0x11')](function(_0xd466b0){logger[_0x45c8('0x12')](_0x45c8('0x1c'),_0x9fc6c0);logger[_0x45c8('0x15')](_0x45c8('0x1c'),_0x9fc6c0,JSON['stringify'](_0xd466b0));_0x586444(_0xd466b0);})[_0x45c8('0x1b')](function(_0x84d25){logger['error'](_0x45c8('0x1c'),_0x84d25[_0x45c8('0x1a')],_0x9fc6c0);_0x4cfa8(_0x55d4d5[_0x45c8('0x18')](0x1f4,_0x84d25[_0x45c8('0x1a')]));});});};exports[_0x45c8('0x23')]=function(_0x1841ab){return new Promise(function(_0x56e53c,_0x1b6a55){return db[_0x45c8('0x24')][_0x45c8('0x25')]({'where':_0x1841ab[_0x45c8('0x1f')]?_0x1841ab[_0x45c8('0x1f')]['where']||null:null})[_0x45c8('0x11')](function(_0x202811){if(_0x202811){return _0x202811['addTags'](_0x1841ab[_0x45c8('0x1e')]['ids'],_[_0x45c8('0x26')](_0x1841ab[_0x45c8('0x1e')],['ids','id'])||{});}})['spread'](function(_0x45e9d5){logger[_0x45c8('0x12')](_0x45c8('0x27'),_0x1841ab);logger[_0x45c8('0x15')](_0x45c8('0x27'),_0x1841ab,JSON[_0x45c8('0x17')](_0x45e9d5));_0x56e53c(_0x45e9d5);})[_0x45c8('0x1b')](function(_0x23e56e){logger['error'](_0x45c8('0x27'),_0x23e56e[_0x45c8('0x1a')],_0x1841ab);_0x1b6a55(_this[_0x45c8('0x18')](0x1f4,_0x23e56e[_0x45c8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ecac192..336796a 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 _0x50f7=['mailInteraction:','./mailInteraction.events','save','update','removeListener','register','length'];(function(_0x41b275,_0xbe133c){var _0x570818=function(_0x450267){while(--_0x450267){_0x41b275['push'](_0x41b275['shift']());}};_0x570818(++_0xbe133c);}(_0x50f7,0xe8));var _0x750f=function(_0x52b671,_0x41b587){_0x52b671=_0x52b671-0x0;var _0x9642e9=_0x50f7[_0x52b671];return _0x9642e9;};'use strict';var MailInteractionEvents=require(_0x750f('0x0'));var events=[_0x750f('0x1'),'remove',_0x750f('0x2')];function createListener(_0x1fe87c,_0x485c29){return function(_0x3089c8){_0x485c29['emit'](_0x1fe87c,_0x3089c8);};}function removeListener(_0x477849,_0x12e205){return function(){MailInteractionEvents[_0x750f('0x3')](_0x477849,_0x12e205);};}exports[_0x750f('0x4')]=function(_0x50317d){for(var _0x2249c1=0x0,_0x1b4e48=events[_0x750f('0x5')];_0x2249c1<_0x1b4e48;_0x2249c1++){var _0x2aa91f=events[_0x2249c1];var _0x48b700=createListener(_0x750f('0x6')+_0x2aa91f,_0x50317d);MailInteractionEvents['on'](_0x2aa91f,_0x48b700);}}; \ No newline at end of file +var _0x0683=['removeListener','register','mailInteraction:','./mailInteraction.events','save','update','emit'];(function(_0x23c50c,_0x1c676f){var _0x3c9e94=function(_0x3e596a){while(--_0x3e596a){_0x23c50c['push'](_0x23c50c['shift']());}};_0x3c9e94(++_0x1c676f);}(_0x0683,0xb9));var _0x3068=function(_0x4feb76,_0x4fd056){_0x4feb76=_0x4feb76-0x0;var _0x132390=_0x0683[_0x4feb76];return _0x132390;};'use strict';var MailInteractionEvents=require(_0x3068('0x0'));var events=[_0x3068('0x1'),'remove',_0x3068('0x2')];function createListener(_0x2e6d8a,_0x4fe6f2){return function(_0x3a29ab){_0x4fe6f2[_0x3068('0x3')](_0x2e6d8a,_0x3a29ab);};}function removeListener(_0x1d2e72,_0x122bc8){return function(){MailInteractionEvents[_0x3068('0x4')](_0x1d2e72,_0x122bc8);};}exports[_0x3068('0x5')]=function(_0x3d4836){for(var _0x1585e9=0x0,_0x5de3fe=events['length'];_0x1585e9<_0x5de3fe;_0x1585e9++){var _0x2a7000=events[_0x1585e9];var _0x266ded=createListener(_0x3068('0x6')+_0x2a7000,_0x3d4836);MailInteractionEvents['on'](_0x2a7000,_0x266ded);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a0dc2d6..6e247b8 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 _0x195e=['create','put','update','/:id/accept','accept','reject','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','download','tracked','mail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x195e,0xfb));var _0xe195=function(_0x44820c,_0x277271){_0x44820c=_0x44820c-0x0;var _0x1c6373=_0x195e[_0x44820c];return _0x1c6373;};'use strict';var multer=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var path=require(_0xe195('0x2'));var timeout=require(_0xe195('0x3'));var express=require(_0xe195('0x4'));var router=express[_0xe195('0x5')]();var fs_extra=require(_0xe195('0x6'));var auth=require(_0xe195('0x7'));var interaction=require(_0xe195('0x8'));var config=require(_0xe195('0x9'));var controller=require(_0xe195('0xa'));router[_0xe195('0xb')]('/',auth[_0xe195('0xc')](),controller['index']);router[_0xe195('0xb')](_0xe195('0xd'),auth[_0xe195('0xc')](),controller[_0xe195('0xe')]);router[_0xe195('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe195('0xb')](_0xe195('0xf'),auth[_0xe195('0xc')](),controller[_0xe195('0x10')]);router['post']('/',auth[_0xe195('0xc')](),interaction[_0xe195('0x11')](_0xe195('0x12'),'mailmessage:create'),controller[_0xe195('0x13')]);router[_0xe195('0x14')]('/:id',auth[_0xe195('0xc')](),controller[_0xe195('0x15')]);router[_0xe195('0x14')](_0xe195('0x16'),auth['isAuthenticated'](),controller[_0xe195('0x17')]);router[_0xe195('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xe195('0x18')]);router['delete'](_0xe195('0x19'),auth['isAuthenticated'](),controller['destroy']);module[_0xe195('0x1a')]=router; \ No newline at end of file +var _0xd52d=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52d,0x1c7));var _0xdd52=function(_0x55d5b1,_0x47e9e2){_0x55d5b1=_0x55d5b1-0x0;var _0x47ec70=_0xd52d[_0x55d5b1];return _0x47ec70;};'use strict';var multer=require('multer');var util=require(_0xdd52('0x0'));var path=require(_0xdd52('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd52('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd52('0x3'));var interaction=require(_0xdd52('0x4'));var config=require(_0xdd52('0x5'));var controller=require(_0xdd52('0x6'));router[_0xdd52('0x7')]('/',auth[_0xdd52('0x8')](),controller[_0xdd52('0x9')]);router[_0xdd52('0x7')]('/describe',auth[_0xdd52('0x8')](),controller[_0xdd52('0xa')]);router[_0xdd52('0x7')](_0xdd52('0xb'),auth[_0xdd52('0x8')](),controller[_0xdd52('0xc')]);router[_0xdd52('0x7')](_0xdd52('0xd'),auth[_0xdd52('0x8')](),controller[_0xdd52('0xe')]);router[_0xdd52('0xf')]('/',auth[_0xdd52('0x8')](),interaction[_0xdd52('0x10')]('mail',_0xdd52('0x11')),controller[_0xdd52('0x12')]);router[_0xdd52('0x13')](_0xdd52('0xb'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x14')]);router['put'](_0xdd52('0x15'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x16')]);router['put'](_0xdd52('0x17'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x18')]);router[_0xdd52('0x19')](_0xdd52('0xb'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x1a')]);module[_0xdd52('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 82c6b89..68d84bd 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 _0x0af3=['INTEGER','ENUM','Email','Chat','sequelize','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE'];(function(_0x13bb75,_0x31a177){var _0x499e5b=function(_0x4d92fa){while(--_0x4d92fa){_0x13bb75['push'](_0x13bb75['shift']());}};_0x499e5b(++_0x31a177);}(_0x0af3,0x163));var _0x30af=function(_0x10e001,_0x2513a8){_0x10e001=_0x10e001-0x0;var _0x12fe0b=_0x0af3[_0x10e001];return _0x12fe0b;};'use strict';var Sequelize=require(_0x30af('0x0'));var _=require('lodash');module[_0x30af('0x1')]={'body':{'type':Sequelize[_0x30af('0x2')](_0x30af('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x30af('0x2')](_0x30af('0x4'))},'read':{'type':Sequelize[_0x30af('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x30af('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x30af('0x7')](0x1fe)},'from':{'type':Sequelize[_0x30af('0x7')]},'to':{'type':Sequelize[_0x30af('0x2')](_0x30af('0x3'))},'cc':{'type':Sequelize[_0x30af('0x2')](_0x30af('0x3'))},'bcc':{'type':Sequelize[_0x30af('0x2')](_0x30af('0x3'))},'subject':{'type':Sequelize[_0x30af('0x2')]},'sentAt':{'type':Sequelize[_0x30af('0x8')]},'attach':{'type':Sequelize[_0x30af('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x30af('0x8')]},'originTo':{'type':Sequelize[_0x30af('0x2')](_0x30af('0x3'))},'originCc':{'type':Sequelize[_0x30af('0x2')](_0x30af('0x3'))},'originChannel':{'type':Sequelize[_0x30af('0xa')](_0x30af('0xb'),_0x30af('0xc')),'defaultValue':_0x30af('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x6fe0=['Email','Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x35dfc1,_0x301667){var _0x1a08ea=function(_0x334087){while(--_0x334087){_0x35dfc1['push'](_0x35dfc1['shift']());}};_0x1a08ea(++_0x301667);}(_0x6fe0,0x120));var _0x06fe=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x6fe0[_0xe15270];return _0x1e813b;};'use strict';var Sequelize=require(_0x06fe('0x0'));var _=require(_0x06fe('0x1'));module[_0x06fe('0x2')]={'body':{'type':Sequelize[_0x06fe('0x3')](_0x06fe('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x06fe('0x3')]('medium')},'read':{'type':Sequelize[_0x06fe('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x06fe('0x6')]('in',_0x06fe('0x7')),'defaultValue':_0x06fe('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x06fe('0x8')](0x1fe)},'from':{'type':Sequelize[_0x06fe('0x8')]},'to':{'type':Sequelize[_0x06fe('0x3')](_0x06fe('0x4'))},'cc':{'type':Sequelize[_0x06fe('0x3')](_0x06fe('0x4'))},'bcc':{'type':Sequelize[_0x06fe('0x3')](_0x06fe('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x06fe('0x9')]},'attach':{'type':Sequelize[_0x06fe('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x06fe('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x06fe('0x3')](_0x06fe('0x4'))},'originCc':{'type':Sequelize[_0x06fe('0x3')](_0x06fe('0x4'))},'originChannel':{'type':Sequelize[_0x06fe('0x6')](_0x06fe('0xb'),_0x06fe('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e847ec0..3c2f2ef 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 _0x259c=['message','result','json','offset','undefined','limit','status','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','catch','params','rawAttributes','body','find','describe','create','direction','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','root','server/files/attachments','ListId','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','MailInteractionId','RejectMessage','rejectMessage','User','interface','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','build','writeFileSync','unlinkSync','eml-format','bluebird','util','lodash','ioredis','html-to-text','api','mail-interactions','../../mysqldb','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s'];(function(_0x3b72bb,_0x30c532){var _0x4041db=function(_0x1d8280){while(--_0x1d8280){_0x3b72bb['push'](_0x3b72bb['shift']());}};_0x4041db(++_0x30c532);}(_0x259c,0x84));var _0xc259=function(_0x5f8000,_0x4a56b1){_0x5f8000=_0x5f8000-0x0;var _0xc8f261=_0x259c[_0x5f8000];return _0xc8f261;};'use strict';var emlformat=require(_0xc259('0x0'));var moment=require('moment');var BPromise=require(_0xc259('0x1'));var util=require(_0xc259('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xc259('0x3'));var Redis=require(_0xc259('0x4'));var htmlToText=require(_0xc259('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc259('0x6'));var interaction_log=require('../../config/logger')(_0xc259('0x7'));var config=require('../../config/environment');var db=require(_0xc259('0x8'))['db'];config['redis']=_[_0xc259('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc259('0xa'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xc259('0xb'))[_0xc259('0xc')](socket);var jayson=require(_0xc259('0xd'));var client=jayson['client'][_0xc259('0xe')]({'port':0x232c});var client9003=jayson[_0xc259('0xf')][_0xc259('0xe')]({'port':0x232b});var client9002=jayson['client'][_0xc259('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x54ae12,_0xfcc790,_0x3d9bd5,_0x573ce1){return new BPromise(function(_0x542a14,_0x597926){var _0x54d712=_0x573ce1||client;return _0x54d712[_0xc259('0x10')](_0x54ae12,_0x3d9bd5)[_0xc259('0x11')](function(_0x561066){logger['info']('MailMessage,\x20%s,\x20%s',_0xfcc790,_0xc259('0x12'));logger[_0xc259('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xfcc790,_0xc259('0x12'),JSON[_0xc259('0x14')](_0x561066));if(_0x561066[_0xc259('0x15')]){if(_0x561066[_0xc259('0x15')][_0xc259('0x16')]===0x1f4){logger['error'](_0xc259('0x17'),_0xfcc790,_0x561066[_0xc259('0x15')][_0xc259('0x18')]);return _0x597926(_0x561066[_0xc259('0x15')][_0xc259('0x18')]);}logger[_0xc259('0x15')]('MailMessage,\x20%s,\x20%s',_0xfcc790,_0x561066[_0xc259('0x15')]['message']);return _0x542a14(_0x561066[_0xc259('0x15')][_0xc259('0x18')]);}else{logger['info'](_0xc259('0x17'),_0xfcc790,_0xc259('0x12'));_0x542a14(_0x561066[_0xc259('0x19')][_0xc259('0x18')]);}})['catch'](function(_0x5ec5ad){logger[_0xc259('0x15')](_0xc259('0x17'),_0xfcc790,_0x5ec5ad);_0x597926(_0x5ec5ad);});});}function respondWithResult(_0x691afa,_0xe253b5){_0xe253b5=_0xe253b5||0xc8;return function(_0x5785df){if(_0x5785df){return _0x691afa['status'](_0xe253b5)[_0xc259('0x1a')](_0x5785df);}};}function respondWithFilteredResult(_0x4d4056,_0x1de533){return function(_0x416f7f){if(_0x416f7f){var _0x3772ba=typeof _0x1de533[_0xc259('0x1b')]===_0xc259('0x1c')&&typeof _0x1de533['limit']===_0xc259('0x1c');var _0x406bf2=_0x416f7f['count'];var _0x560455=_0x3772ba?0x0:_0x1de533[_0xc259('0x1b')];var _0x444207=_0x3772ba?_0x416f7f['count']:_0x1de533[_0xc259('0x1b')]+_0x1de533[_0xc259('0x1d')];var _0x57450a;if(_0x444207>=_0x406bf2){_0x444207=_0x406bf2;_0x57450a=0xc8;}else{_0x57450a=0xce;}_0x4d4056[_0xc259('0x1e')](_0x57450a);return _0x4d4056[_0xc259('0x1f')](_0xc259('0x20'),_0x560455+'-'+_0x444207+'/'+_0x406bf2)[_0xc259('0x1a')](_0x416f7f);}return null;};}function saveUpdates(_0x2990db){return function(_0x2ea55b){if(_0x2ea55b){return _0x2ea55b['update'](_0x2990db)[_0xc259('0x11')](function(_0x128e45){return _0x128e45;});}return null;};}function removeEntity(_0x33db57){return function(_0x27c89b){if(_0x27c89b){return _0x27c89b[_0xc259('0x21')]()[_0xc259('0x11')](function(){_0x33db57['status'](0xcc)[_0xc259('0x22')]();});}};}function handleEntityNotFound(_0xacd1b0){return function(_0x410e9f){if(!_0x410e9f){_0xacd1b0[_0xc259('0x23')](0x194);}return _0x410e9f;};}function handleError(_0x334774,_0x4ed5ef){_0x4ed5ef=_0x4ed5ef||0x1f4;return function(_0x2dfc32){logger[_0xc259('0x15')](_0x2dfc32[_0xc259('0x24')]);if(_0x2dfc32[_0xc259('0x25')]){delete _0x2dfc32[_0xc259('0x25')];}_0x334774[_0xc259('0x1e')](_0x4ed5ef)[_0xc259('0x26')](_0x2dfc32);};}exports[_0xc259('0x27')]=function(_0x1043da,_0x2c2307){var _0x155c7d={},_0x457244={},_0x50bd8c={'count':0x0,'rows':[]};var _0x6088c7=_[_0xc259('0x28')](db[_0xc259('0x29')]['rawAttributes'],function(_0x2ad254){return{'name':_0x2ad254[_0xc259('0x2a')],'type':_0x2ad254[_0xc259('0x2b')][_0xc259('0x2c')]};});_0x457244[_0xc259('0x2d')]=_[_0xc259('0x28')](_0x6088c7,_0xc259('0x25'));_0x457244[_0xc259('0x2e')]=_[_0xc259('0x2f')](_0x1043da[_0xc259('0x2e')]);_0x457244[_0xc259('0x30')]=_['intersection'](_0x457244[_0xc259('0x2d')],_0x457244[_0xc259('0x2e')]);_0x155c7d[_0xc259('0x31')]=_[_0xc259('0x32')](_0x457244[_0xc259('0x2d')],qs[_0xc259('0x33')](_0x1043da[_0xc259('0x2e')][_0xc259('0x33')]));_0x155c7d[_0xc259('0x31')]=_0x155c7d[_0xc259('0x31')][_0xc259('0x34')]?_0x155c7d[_0xc259('0x31')]:_0x457244['model'];if(!_0x1043da[_0xc259('0x2e')][_0xc259('0x35')]('nolimit')){_0x155c7d['limit']=qs[_0xc259('0x1d')](_0x1043da[_0xc259('0x2e')][_0xc259('0x1d')]);_0x155c7d[_0xc259('0x1b')]=qs[_0xc259('0x1b')](_0x1043da[_0xc259('0x2e')]['offset']);}_0x155c7d[_0xc259('0x36')]=qs[_0xc259('0x37')](_0x1043da[_0xc259('0x2e')][_0xc259('0x37')]);_0x155c7d['where']=qs['filters'](_[_0xc259('0x38')](_0x1043da[_0xc259('0x2e')],_0x457244['filters']),_0x6088c7);if(_0x1043da[_0xc259('0x2e')][_0xc259('0x39')]){_0x155c7d[_0xc259('0x3a')]=_[_0xc259('0x3b')](_0x155c7d[_0xc259('0x3a')],{'$or':_[_0xc259('0x28')](_0x6088c7,function(_0x1bc662){if(_0x1bc662['type']!=='VIRTUAL'){var _0x1f2013={};_0x1f2013[_0x1bc662[_0xc259('0x25')]]={'$like':'%'+_0x1043da[_0xc259('0x2e')][_0xc259('0x39')]+'%'};return _0x1f2013;}})});}_0x155c7d=_['merge']({},_0x155c7d,_0x1043da[_0xc259('0x3c')]);var _0xe6f232={'where':_0x155c7d[_0xc259('0x3a')]};return db[_0xc259('0x29')][_0xc259('0x3d')](_0xe6f232)[_0xc259('0x11')](function(_0x29ecc7){_0x50bd8c[_0xc259('0x3d')]=_0x29ecc7;if(_0x1043da[_0xc259('0x2e')][_0xc259('0x3e')]){_0x155c7d[_0xc259('0x3f')]=[{'all':!![]}];}return db[_0xc259('0x29')][_0xc259('0x40')](_0x155c7d);})['then'](function(_0x2cb7ee){_0x50bd8c['rows']=_0x2cb7ee;return _0x50bd8c;})[_0xc259('0x11')](respondWithFilteredResult(_0x2c2307,_0x155c7d))[_0xc259('0x41')](handleError(_0x2c2307,null));};exports['show']=function(_0xd04800,_0x18b09a){var _0x53add7={'raw':!![],'where':{'id':_0xd04800[_0xc259('0x42')]['id']}},_0x5a94a7={};_0x5a94a7[_0xc259('0x2d')]=_[_0xc259('0x2f')](db[_0xc259('0x29')][_0xc259('0x43')]);_0x5a94a7['query']=_[_0xc259('0x2f')](_0xd04800['query']);_0x5a94a7[_0xc259('0x30')]=_['intersection'](_0x5a94a7['model'],_0x5a94a7[_0xc259('0x2e')]);_0x53add7[_0xc259('0x31')]=_[_0xc259('0x32')](_0x5a94a7[_0xc259('0x2d')],qs[_0xc259('0x33')](_0xd04800[_0xc259('0x2e')][_0xc259('0x33')]));_0x53add7[_0xc259('0x31')]=_0x53add7[_0xc259('0x31')][_0xc259('0x34')]?_0x53add7[_0xc259('0x31')]:_0x5a94a7[_0xc259('0x2d')];if(_0xd04800[_0xc259('0x2e')][_0xc259('0x3e')]){_0x53add7[_0xc259('0x3f')]=[{'all':!![]}];}_0x53add7=_[_0xc259('0x3b')]({},_0x53add7,_0xd04800['options']);return db[_0xc259('0x29')]['find'](_0x53add7)[_0xc259('0x11')](handleEntityNotFound(_0x18b09a,null))['then'](respondWithResult(_0x18b09a,null))[_0xc259('0x41')](handleError(_0x18b09a,null));};exports['update']=function(_0x1dd44a,_0x55e679){if(_0x1dd44a[_0xc259('0x44')]['id']){delete _0x1dd44a[_0xc259('0x44')]['id'];}return db[_0xc259('0x29')][_0xc259('0x45')]({'where':{'id':_0x1dd44a[_0xc259('0x42')]['id']}})[_0xc259('0x11')](handleEntityNotFound(_0x55e679,null))[_0xc259('0x11')](saveUpdates(_0x1dd44a[_0xc259('0x44')],null))['then'](respondWithResult(_0x55e679,null))[_0xc259('0x41')](handleError(_0x55e679,null));};exports[_0xc259('0x21')]=function(_0x107a79,_0x1a22b8){return db[_0xc259('0x29')][_0xc259('0x45')]({'where':{'id':_0x107a79[_0xc259('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a22b8,null))['then'](removeEntity(_0x1a22b8,null))['catch'](handleError(_0x1a22b8,null));};exports['describe']=function(_0x13e547,_0x3ca84d){return db[_0xc259('0x29')][_0xc259('0x46')]()['then'](respondWithResult(_0x3ca84d,null))[_0xc259('0x41')](handleError(_0x3ca84d,null));};exports[_0xc259('0x47')]=function(_0x4b1d3f,_0xf9a6db){return db[_0xc259('0x29')][_0xc259('0x47')](_0x4b1d3f['body'])[_0xc259('0x11')](function(_0x2331b2){if(_0x2331b2){if(_0x2331b2[_0xc259('0x48')]==='out'&&!_0x2331b2[_0xc259('0x49')]){var _0x57b8fb,_0x215eda,_0xe9ce89;if(_0x4b1d3f[_0xc259('0x44')]['to']){_0x215eda=_0x4b1d3f[_0xc259('0x44')]['to'][_0xc259('0x4a')](',')[0x0];}return db['MailAccount'][_0xc259('0x4b')]({'where':{'id':_0x2331b2[_0xc259('0x4c')]},'include':[{'model':db[_0xc259('0x4d')],'as':_0xc259('0x4e'),'include':[{'model':db[_0xc259('0x4f')],'as':_0xc259('0x50'),'where':{'email':_0x215eda},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xc259('0x51')],'as':_0xc259('0x52'),'raw':!![]}]})[_0xc259('0x11')](function(_0x9db225){_0x57b8fb=_0x9db225;if(_0x57b8fb&&_0x57b8fb[_0xc259('0x52')]){var _0x5d2039={'tls':{'rejectUnauthorized':![]}};if(_[_0xc259('0x53')](_0x57b8fb['Smtp'][_0xc259('0x54')])){_0x5d2039[_0xc259('0x55')]=_0x57b8fb[_0xc259('0x52')][_0xc259('0x55')];_0x5d2039[_0xc259('0x56')]=_0x57b8fb[_0xc259('0x52')][_0xc259('0x56')];_0x5d2039['secure']=_0x57b8fb[_0xc259('0x52')][_0xc259('0x57')];if(_0x57b8fb['Smtp']['authentication']){_0x5d2039[_0xc259('0x58')]={'user':_0x57b8fb['Smtp'][_0xc259('0x59')],'pass':_0x57b8fb['Smtp'][_0xc259('0x5a')]};}}else{_0x5d2039['service']=_0x57b8fb[_0xc259('0x52')][_0xc259('0x54')];_0x5d2039[_0xc259('0x58')]={'user':_0x57b8fb['Smtp'][_0xc259('0x59')],'pass':_0x57b8fb[_0xc259('0x52')][_0xc259('0x5a')]};_0x5d2039[_0xc259('0x57')]=_0x57b8fb[_0xc259('0x52')][_0xc259('0x57')];}if(_0x4b1d3f['body'][_0xc259('0x5b')]&&_0x4b1d3f['body'][_0xc259('0x5b')][_0xc259('0x34')]){for(var _0xef2e9c=0x0;_0xef2e9c<_0x4b1d3f[_0xc259('0x44')]['attachments']['length'];_0xef2e9c+=0x1){_0x4b1d3f['body']['attachments'][_0xef2e9c]={'filename':_0x4b1d3f[_0xc259('0x44')][_0xc259('0x5b')][_0xef2e9c][_0xc259('0x25')],'path':path[_0xc259('0x5c')](config[_0xc259('0x5d')],_0xc259('0x5e'),_0x4b1d3f[_0xc259('0x44')][_0xc259('0x5b')][_0xef2e9c]['basename'])};}}_0xe9ce89={'account':_0x5d2039,'message':_0x4b1d3f[_0xc259('0x44')]};return;}})['then'](function(){if(_0x57b8fb['List']){if(_0x57b8fb['List'][_0xc259('0x50')][_0xc259('0x34')]){return _0x57b8fb['List'][_0xc259('0x50')][0x0];}else{return db[_0xc259('0x4f')][_0xc259('0x47')](_[_0xc259('0x9')](_0x4b1d3f['body'],{'firstName':_0x4b1d3f[_0xc259('0x44')]['to'],'email':_0x4b1d3f['body']['to'],'phone':_0x4b1d3f[_0xc259('0x44')]['to'],'ListId':_0x57b8fb[_0xc259('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xc259('0x11')](function(){if(_0xe9ce89){return respondWithRpcPromise(_0xc259('0x60'),'sendMail',_0xe9ce89,client9003)[_0xc259('0x11')](function(_0x3a57d9){return _0x2331b2['update']({'read':!![],'messageId':_0x3a57d9[_0xc259('0x61')],'sentAt':moment()[_0xc259('0x62')](_0xc259('0x63'))});})[_0xc259('0x41')](function(_0x4403b1){logger['error']('%s',JSON[_0xc259('0x14')](_0x4403b1));return _0x2331b2;});}return _0x2331b2;});}return _0x2331b2;}})[_0xc259('0x11')](respondWithResult(_0xf9a6db,0xc9))[_0xc259('0x41')](handleError(_0xf9a6db,null));};exports[_0xc259('0x64')]=function(_0x5c9445,_0xbe1d77){var _0x1e2205={'agent':{},'channel':_0xc259('0x65')};if(_0x5c9445[_0xc259('0x44')]['id']){delete _0x5c9445[_0xc259('0x44')]['id'];}_0x5c9445['body'][_0xc259('0x66')]=!![];_0x5c9445['body'][_0xc259('0x67')]=moment()[_0xc259('0x62')](_0xc259('0x63'));_0x5c9445[_0xc259('0x44')][_0xc259('0x68')]=_0x5c9445[_0xc259('0x44')][_0xc259('0x68')]||_0x5c9445[_0xc259('0x59')]['id'];_0x1e2205[_0xc259('0x69')]['id']=_0x5c9445['body']['UserId'];return db['MailMessage'][_0xc259('0x45')]({'where':{'id':_0x5c9445[_0xc259('0x42')]['id'],'UserId':null}})[_0xc259('0x11')](handleEntityNotFound(_0xbe1d77,null))['then'](saveUpdates(_0x5c9445[_0xc259('0x44')],null))[_0xc259('0x11')](function(_0x32018f){if(_0x32018f){_0x1e2205[_0xc259('0x18')]=_0x32018f[_0xc259('0x6a')]({'plain':!![]});return db[_0xc259('0x6b')][_0xc259('0x45')]({'where':{'id':_0x32018f['MailInteractionId']}});}return null;})[_0xc259('0x11')](handleEntityNotFound(_0xbe1d77,null))[_0xc259('0x11')](function(_0x508c70){if(_0x508c70){return _0x508c70['update']({'UserId':_0x5c9445[_0xc259('0x44')][_0xc259('0x68')],'read1stAt':_[_0xc259('0x53')](_0x508c70['read1stAt'])?moment()[_0xc259('0x62')](_0xc259('0x63')):undefined});}return null;})['then'](function(_0x169d8d){if(_0x169d8d){_0x1e2205['interaction']=_0x169d8d[_0xc259('0x6a')]({'plain':!![]});interaction_log['info'](_0xc259('0x6c'),_0x5c9445[_0xc259('0x59')]['id'],_0x5c9445[_0xc259('0x59')][_0xc259('0x25')],_0x5c9445[_0xc259('0x59')][_0xc259('0x6d')],_0x1e2205[_0xc259('0x6e')]['id'],_0x5c9445[_0xc259('0x44')]?JSON[_0xc259('0x14')](_0x5c9445['body']):_0xc259('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1e2205);}return null;})[_0xc259('0x11')](function(_0x261df1){var _0x5e328a=_0xc259('0x70')+_0x261df1['message'][_0xc259('0x71')];return db[_0xc259('0x72')][_0xc259('0x2e')](_0x5e328a,{'type':db[_0xc259('0x73')][_0xc259('0x74')][_0xc259('0x75')],'raw':!![]})[_0xc259('0x11')](function(_0x5ba23c){return _0x5ba23c;});})[_0xc259('0x11')](function(_0x2ff78e){if(_0x2ff78e){_0x1e2205[_0xc259('0x18')][_0xc259('0x76')]=_0x2ff78e[0x0];if(!_0x5c9445[_0xc259('0x44')][_0xc259('0x68')])return;return db['User'][_0xc259('0x45')]({'where':{'id':_0x5c9445['body']['UserId'],'role':_0xc259('0x69')},'attributes':['id','name',_0xc259('0x77'),_0xc259('0x78'),_0xc259('0x79')],'raw':!![]});}return null;})[_0xc259('0x11')](function(_0x301574){if(!_0x301574)return null;_0x1e2205[_0xc259('0x18')][_0xc259('0x69')]=_0x301574;return _0x1e2205;})[_0xc259('0x11')](function(_0x11bc03){if(_0x11bc03){if(_0x5c9445[_0xc259('0x44')][_0xc259('0x7a')]){_0x1e2205[_0xc259('0x18')]['interface']=util[_0xc259('0x62')](_0xc259('0x7b'),_0x5c9445[_0xc259('0x59')][_0xc259('0x25')]);_0x1e2205[_0xc259('0x18')][_0xc259('0x7c')]=_0x1e2205[_0xc259('0x7c')];_0x1e2205[_0xc259('0x18')][_0xc259('0x7d')]=_0x1e2205['channel'];_0x1e2205[_0xc259('0x18')][_0xc259('0x7e')]=_0xc259('0x64');_0x1e2205[_0xc259('0x18')]['body']=htmlToText[_0xc259('0x7f')](_0x1e2205[_0xc259('0x18')][_0xc259('0x44')]);return respondWithRpcPromise(_0xc259('0x80'),_0xc259('0x80'),{'event':_0xc259('0x81'),'message':_0x1e2205[_0xc259('0x18')]},client9002)[_0xc259('0x11')](function(){return _0x1e2205;});}return _0x1e2205;}return null;})['then'](respondWithResult(_0xbe1d77,null))['catch'](handleError(_0xbe1d77,null));};exports['reject']=function(_0x4dd7ff,_0x9761ed){var _0x966bd8={'agent':{},'channel':_0xc259('0x65')};if(_0x4dd7ff[_0xc259('0x44')]['id']){delete _0x4dd7ff[_0xc259('0x44')]['id'];}_0x4dd7ff[_0xc259('0x44')]['UserId']=_0x4dd7ff[_0xc259('0x44')]['UserId']||_0x4dd7ff[_0xc259('0x59')]['id'];_0x966bd8[_0xc259('0x69')]['id']=_0x4dd7ff[_0xc259('0x44')]['UserId'];return db[_0xc259('0x29')][_0xc259('0x45')]({'where':{'id':_0x4dd7ff[_0xc259('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x9761ed,null))['then'](function(_0x315c07){if(_0x315c07){_0x966bd8[_0xc259('0x18')]=_0x315c07[_0xc259('0x6a')]({'plain':!![]});return db[_0xc259('0x6b')][_0xc259('0x45')]({'where':{'id':_0x315c07[_0xc259('0x82')]}});}return null;})[_0xc259('0x11')](handleEntityNotFound(_0x9761ed,null))['then'](function(_0x2401a2){if(_0x2401a2){_0x966bd8[_0xc259('0x6e')]=_0x2401a2[_0xc259('0x6a')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4dd7ff['user']['id'],_0x4dd7ff[_0xc259('0x59')]['name'],_0x4dd7ff[_0xc259('0x59')][_0xc259('0x6d')],_0x966bd8[_0xc259('0x6e')]['id'],_0x4dd7ff[_0xc259('0x44')]?JSON[_0xc259('0x14')](_0x4dd7ff['body']):'null');return respondWithRpcPromise(_0xc259('0x83'),_0xc259('0x84'),_0x966bd8);}return null;})[_0xc259('0x11')](function(_0x2385cc){var _0x526c2b=_0xc259('0x70')+_0x2385cc[_0xc259('0x18')][_0xc259('0x71')];return db[_0xc259('0x72')][_0xc259('0x2e')](_0x526c2b,{'type':db['Sequelize'][_0xc259('0x74')][_0xc259('0x75')],'raw':!![]})['then'](function(_0xf9637b){return _0xf9637b;});})[_0xc259('0x11')](function(_0x40fe40){if(_0x40fe40){_0x966bd8[_0xc259('0x18')][_0xc259('0x76')]=_0x40fe40[0x0];if(!_0x4dd7ff[_0xc259('0x44')][_0xc259('0x68')])return;return db[_0xc259('0x85')]['find']({'where':{'id':_0x4dd7ff[_0xc259('0x44')]['UserId'],'role':_0xc259('0x69')},'attributes':['id',_0xc259('0x25'),_0xc259('0x77'),'email',_0xc259('0x79')],'raw':!![]});}return null;})[_0xc259('0x11')](function(_0x3ba05a){if(!_0x3ba05a)return null;_0x966bd8[_0xc259('0x18')]['agent']=_0x3ba05a;return _0x966bd8;})[_0xc259('0x11')](function(_0x3a53ab){if(_0x3a53ab){_0x3a53ab[_0xc259('0x18')][_0xc259('0x86')]=util[_0xc259('0x62')](_0xc259('0x7b'),_0x4dd7ff[_0xc259('0x59')][_0xc259('0x25')]);_0x3a53ab[_0xc259('0x18')][_0xc259('0x7c')]=_0x966bd8[_0xc259('0x7c')];_0x3a53ab['message'][_0xc259('0x7d')]=_0x966bd8[_0xc259('0x7c')];_0x3a53ab['message'][_0xc259('0x7e')]='reject';_0x3a53ab[_0xc259('0x18')]['body']=htmlToText[_0xc259('0x7f')](_0x966bd8[_0xc259('0x18')]['body']);respondWithRpcPromise(_0xc259('0x80'),_0xc259('0x80'),{'event':'rejectmessage','message':_0x3a53ab[_0xc259('0x18')]},client9002);return _0x966bd8;}return null;})[_0xc259('0x11')](respondWithResult(_0x9761ed,null))[_0xc259('0x41')](handleError(_0x9761ed,null));};exports[_0xc259('0x87')]=function(_0x2b9d8f,_0xcbe225){var _0x35b6c5=moment()[_0xc259('0x88')]()[_0xc259('0x89')]();var _0x336ff7=path[_0xc259('0x5c')](config[_0xc259('0x5d')],_0xc259('0x8a'),_0xc259('0x8b'),_0xc259('0x8c'));var _0x5a72e4=path['join'](config['root'],_0xc259('0x8a'),_0xc259('0x8b'),_0xc259('0x5b'));var _0x3da34f=util['format'](_0xc259('0x8d'),_0x35b6c5);return db[_0xc259('0x29')][_0xc259('0x45')]({'where':{'id':_0x2b9d8f['params']['id']},'attributes':['id',_0xc259('0x44'),_0xc259('0x8e'),'to','cc',_0xc259('0x8f'),_0xc259('0x90'),'createdAt'],'include':_0x2b9d8f[_0xc259('0x2e')][_0xc259('0x5b')]?[{'model':db['Attachment'],'as':_0xc259('0x91')}]:undefined})[_0xc259('0x11')](handleEntityNotFound(_0xcbe225,null))[_0xc259('0x11')](function(_0x2c2327){if(_0x2c2327){var _0x4d2b23=_0x2c2327;var _0x100202={'from':_0x4d2b23[_0xc259('0x8e')],'to':_0x4d2b23['to'],'subject':_0x4d2b23[_0xc259('0x90')],'html':htmlEntities[_0xc259('0x92')](_0x4d2b23[_0xc259('0x44')]),'headers':{'Date':moment(_0x4d2b23['createdAt'])['format'](_0xc259('0x93'))},'attachments':[]};if(_0x2c2327['cc']){_0x100202[_0xc259('0x94')]['Cc']=_0x2c2327['cc'];}if(_0x2c2327[_0xc259('0x8f')]){_0x100202[_0xc259('0x94')][_0xc259('0x95')]=_0x2c2327['bcc'];}return new BPromise(function(_0x2aa5c6,_0x2a3a1b){if(_0x2c2327['Attachments']){for(var _0x2cad94=0x0;_0x2cad94<_0x2c2327[_0xc259('0x91')][_0xc259('0x34')];_0x2cad94++){var _0x27dfb0=_0x2c2327[_0xc259('0x91')][_0x2cad94];var _0x42fdd7=path['join'](_0x5a72e4,_0x27dfb0[_0xc259('0x96')]);if(fs[_0xc259('0x97')](_0x42fdd7)){_0x100202[_0xc259('0x5b')][_0xc259('0x98')]({'name':_0x27dfb0[_0xc259('0x25')],'contentType':_0x27dfb0[_0xc259('0x2b')],'data':fs['readFileSync'](_0x42fdd7)});}}}emlformat[_0xc259('0x99')](_0x100202,function(_0x857f79,_0x3edfc4){if(_0x857f79)return _0x2a3a1b(_0x857f79);fs[_0xc259('0x9a')](path['join'](_0x336ff7,_0x3da34f),_0x3edfc4);return _0x2aa5c6(_0x3edfc4);});});}})[_0xc259('0x11')](function(_0x32ae9f){if(_0x32ae9f){return _0xcbe225[_0xc259('0x87')](path['join'](_0x336ff7,_0x3da34f),_0x3da34f,function(_0xb42186){if(!_0xb42186)fs[_0xc259('0x9b')](path[_0xc259('0x5c')](_0x336ff7,_0x3da34f));});}})[_0xc259('0x41')](handleError(_0xcbe225,null));}; \ No newline at end of file +var _0x4b75=['get','MailInteraction','RejectMessage','rejectMessage','sequelize','SELECT','User','email','fromString','download','join','server','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','type','build','writeFileSync','unlinkSync','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','undefined','count','offset','limit','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','map','VIRTUAL','includeAll','findAll','rows','params','keys','rawAttributes','include','options','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','isNil','Smtp','host','port','secure','auth','pass','service','user','attachments','root','server/files/attachments','basename','CmContact','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','agent','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject'];(function(_0x15cb6d,_0x172116){var _0x454fb7=function(_0x31da50){while(--_0x31da50){_0x15cb6d['push'](_0x15cb6d['shift']());}};_0x454fb7(++_0x172116);}(_0x4b75,0xbf));var _0x54b7=function(_0x1175f5,_0x341157){_0x1175f5=_0x1175f5-0x0;var _0x5a658d=_0x4b75[_0x1175f5];return _0x5a658d;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x54b7('0x0'));var util=require(_0x54b7('0x1'));var path=require(_0x54b7('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x54b7('0x3'));var htmlToText=require(_0x54b7('0x4'));var qs=require(_0x54b7('0x5'));var logger=require(_0x54b7('0x6'))(_0x54b7('0x7'));var interaction_log=require(_0x54b7('0x6'))(_0x54b7('0x8'));var config=require(_0x54b7('0x9'));var db=require(_0x54b7('0xa'))['db'];config[_0x54b7('0xb')]=_[_0x54b7('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x54b7('0xd'))(new Redis(config[_0x54b7('0xb')]));var htmlEntities=require('html-entities');require(_0x54b7('0xe'))[_0x54b7('0xf')](socket);var jayson=require(_0x54b7('0x10'));var client=jayson['client'][_0x54b7('0x11')]({'port':0x232c});var client9003=jayson[_0x54b7('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x54b7('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5199a5,_0x7631cc,_0x19d3e7,_0x3a8719){return new BPromise(function(_0x45f728,_0x2e5746){var _0x3d7a8a=_0x3a8719||client;return _0x3d7a8a[_0x54b7('0x13')](_0x5199a5,_0x19d3e7)[_0x54b7('0x14')](function(_0x4ced7a){logger[_0x54b7('0x15')](_0x54b7('0x16'),_0x7631cc,_0x54b7('0x17'));logger[_0x54b7('0x18')](_0x54b7('0x19'),_0x7631cc,_0x54b7('0x17'),JSON[_0x54b7('0x1a')](_0x4ced7a));if(_0x4ced7a[_0x54b7('0x1b')]){if(_0x4ced7a[_0x54b7('0x1b')][_0x54b7('0x1c')]===0x1f4){logger[_0x54b7('0x1b')](_0x54b7('0x16'),_0x7631cc,_0x4ced7a[_0x54b7('0x1b')][_0x54b7('0x1d')]);return _0x2e5746(_0x4ced7a['error'][_0x54b7('0x1d')]);}logger[_0x54b7('0x1b')](_0x54b7('0x16'),_0x7631cc,_0x4ced7a['error']['message']);return _0x45f728(_0x4ced7a[_0x54b7('0x1b')][_0x54b7('0x1d')]);}else{logger[_0x54b7('0x15')](_0x54b7('0x16'),_0x7631cc,_0x54b7('0x17'));_0x45f728(_0x4ced7a[_0x54b7('0x1e')]['message']);}})[_0x54b7('0x1f')](function(_0x35ccbf){logger['error']('MailMessage,\x20%s,\x20%s',_0x7631cc,_0x35ccbf);_0x2e5746(_0x35ccbf);});});}function respondWithResult(_0xe1c876,_0x4e0095){_0x4e0095=_0x4e0095||0xc8;return function(_0x52fbf7){if(_0x52fbf7){return _0xe1c876[_0x54b7('0x20')](_0x4e0095)['json'](_0x52fbf7);}};}function respondWithFilteredResult(_0x1cd6a8,_0x39eca3){return function(_0x5c509c){if(_0x5c509c){var _0x1a063c=typeof _0x39eca3['offset']===_0x54b7('0x21')&&typeof _0x39eca3['limit']===_0x54b7('0x21');var _0x29244b=_0x5c509c[_0x54b7('0x22')];var _0x113f93=_0x1a063c?0x0:_0x39eca3[_0x54b7('0x23')];var _0xbccce2=_0x1a063c?_0x5c509c[_0x54b7('0x22')]:_0x39eca3['offset']+_0x39eca3[_0x54b7('0x24')];var _0x5d0408;if(_0xbccce2>=_0x29244b){_0xbccce2=_0x29244b;_0x5d0408=0xc8;}else{_0x5d0408=0xce;}_0x1cd6a8[_0x54b7('0x20')](_0x5d0408);return _0x1cd6a8['set'](_0x54b7('0x25'),_0x113f93+'-'+_0xbccce2+'/'+_0x29244b)[_0x54b7('0x26')](_0x5c509c);}return null;};}function saveUpdates(_0x5e2909){return function(_0x3b1b38){if(_0x3b1b38){return _0x3b1b38[_0x54b7('0x27')](_0x5e2909)[_0x54b7('0x14')](function(_0x58c5f7){return _0x58c5f7;});}return null;};}function removeEntity(_0x5cdfb9){return function(_0x548e6e){if(_0x548e6e){return _0x548e6e[_0x54b7('0x28')]()['then'](function(){_0x5cdfb9['status'](0xcc)[_0x54b7('0x29')]();});}};}function handleEntityNotFound(_0x1bf23c){return function(_0xdaf5a4){if(!_0xdaf5a4){_0x1bf23c[_0x54b7('0x2a')](0x194);}return _0xdaf5a4;};}function handleError(_0x76a8b,_0xf44709){_0xf44709=_0xf44709||0x1f4;return function(_0x42a44a){logger[_0x54b7('0x1b')](_0x42a44a[_0x54b7('0x2b')]);if(_0x42a44a[_0x54b7('0x2c')]){delete _0x42a44a['name'];}_0x76a8b['status'](_0xf44709)[_0x54b7('0x2d')](_0x42a44a);};}exports[_0x54b7('0x2e')]=function(_0x209aa2,_0xefccf0){var _0x1247a0={},_0x12e397={},_0x4795e9={'count':0x0,'rows':[]};var _0x3651a6=_['map'](db[_0x54b7('0x2f')]['rawAttributes'],function(_0x3acd30){return{'name':_0x3acd30['fieldName'],'type':_0x3acd30['type'][_0x54b7('0x30')]};});_0x12e397[_0x54b7('0x31')]=_['map'](_0x3651a6,_0x54b7('0x2c'));_0x12e397[_0x54b7('0x32')]=_['keys'](_0x209aa2[_0x54b7('0x32')]);_0x12e397['filters']=_[_0x54b7('0x33')](_0x12e397[_0x54b7('0x31')],_0x12e397[_0x54b7('0x32')]);_0x1247a0[_0x54b7('0x34')]=_['intersection'](_0x12e397[_0x54b7('0x31')],qs[_0x54b7('0x35')](_0x209aa2['query'][_0x54b7('0x35')]));_0x1247a0['attributes']=_0x1247a0[_0x54b7('0x34')][_0x54b7('0x36')]?_0x1247a0['attributes']:_0x12e397['model'];if(!_0x209aa2[_0x54b7('0x32')]['hasOwnProperty']('nolimit')){_0x1247a0[_0x54b7('0x24')]=qs[_0x54b7('0x24')](_0x209aa2[_0x54b7('0x32')]['limit']);_0x1247a0[_0x54b7('0x23')]=qs[_0x54b7('0x23')](_0x209aa2[_0x54b7('0x32')]['offset']);}_0x1247a0[_0x54b7('0x37')]=qs[_0x54b7('0x38')](_0x209aa2[_0x54b7('0x32')]['sort']);_0x1247a0[_0x54b7('0x39')]=qs['filters'](_['pick'](_0x209aa2[_0x54b7('0x32')],_0x12e397[_0x54b7('0x3a')]),_0x3651a6);if(_0x209aa2[_0x54b7('0x32')][_0x54b7('0x3b')]){_0x1247a0[_0x54b7('0x39')]=_[_0x54b7('0x3c')](_0x1247a0['where'],{'$or':_[_0x54b7('0x3d')](_0x3651a6,function(_0x5a2cff){if(_0x5a2cff['type']!==_0x54b7('0x3e')){var _0x57025e={};_0x57025e[_0x5a2cff[_0x54b7('0x2c')]]={'$like':'%'+_0x209aa2[_0x54b7('0x32')][_0x54b7('0x3b')]+'%'};return _0x57025e;}})});}_0x1247a0=_[_0x54b7('0x3c')]({},_0x1247a0,_0x209aa2['options']);var _0x7f5277={'where':_0x1247a0[_0x54b7('0x39')]};return db[_0x54b7('0x2f')]['count'](_0x7f5277)[_0x54b7('0x14')](function(_0x558d92){_0x4795e9[_0x54b7('0x22')]=_0x558d92;if(_0x209aa2['query'][_0x54b7('0x3f')]){_0x1247a0['include']=[{'all':!![]}];}return db[_0x54b7('0x2f')][_0x54b7('0x40')](_0x1247a0);})[_0x54b7('0x14')](function(_0x3e0d58){_0x4795e9[_0x54b7('0x41')]=_0x3e0d58;return _0x4795e9;})['then'](respondWithFilteredResult(_0xefccf0,_0x1247a0))[_0x54b7('0x1f')](handleError(_0xefccf0,null));};exports['show']=function(_0x47d565,_0x5f0703){var _0x4248df={'raw':!![],'where':{'id':_0x47d565[_0x54b7('0x42')]['id']}},_0x159479={};_0x159479[_0x54b7('0x31')]=_[_0x54b7('0x43')](db['MailMessage'][_0x54b7('0x44')]);_0x159479['query']=_[_0x54b7('0x43')](_0x47d565[_0x54b7('0x32')]);_0x159479[_0x54b7('0x3a')]=_[_0x54b7('0x33')](_0x159479[_0x54b7('0x31')],_0x159479['query']);_0x4248df['attributes']=_[_0x54b7('0x33')](_0x159479[_0x54b7('0x31')],qs[_0x54b7('0x35')](_0x47d565[_0x54b7('0x32')]['fields']));_0x4248df['attributes']=_0x4248df['attributes'][_0x54b7('0x36')]?_0x4248df[_0x54b7('0x34')]:_0x159479[_0x54b7('0x31')];if(_0x47d565['query'][_0x54b7('0x3f')]){_0x4248df[_0x54b7('0x45')]=[{'all':!![]}];}_0x4248df=_[_0x54b7('0x3c')]({},_0x4248df,_0x47d565[_0x54b7('0x46')]);return db['MailMessage'][_0x54b7('0x47')](_0x4248df)[_0x54b7('0x14')](handleEntityNotFound(_0x5f0703,null))[_0x54b7('0x14')](respondWithResult(_0x5f0703,null))[_0x54b7('0x1f')](handleError(_0x5f0703,null));};exports[_0x54b7('0x27')]=function(_0x1b398b,_0x1d892a){if(_0x1b398b[_0x54b7('0x48')]['id']){delete _0x1b398b[_0x54b7('0x48')]['id'];}return db[_0x54b7('0x2f')][_0x54b7('0x47')]({'where':{'id':_0x1b398b['params']['id']}})[_0x54b7('0x14')](handleEntityNotFound(_0x1d892a,null))['then'](saveUpdates(_0x1b398b[_0x54b7('0x48')],null))[_0x54b7('0x14')](respondWithResult(_0x1d892a,null))[_0x54b7('0x1f')](handleError(_0x1d892a,null));};exports[_0x54b7('0x28')]=function(_0x192c47,_0x21d306){return db[_0x54b7('0x2f')]['find']({'where':{'id':_0x192c47['params']['id']}})['then'](handleEntityNotFound(_0x21d306,null))[_0x54b7('0x14')](removeEntity(_0x21d306,null))['catch'](handleError(_0x21d306,null));};exports[_0x54b7('0x49')]=function(_0x1b4bea,_0x4461e2){return db[_0x54b7('0x2f')]['describe']()[_0x54b7('0x14')](respondWithResult(_0x4461e2,null))[_0x54b7('0x1f')](handleError(_0x4461e2,null));};exports['create']=function(_0x312be4,_0x1cdd1b){return db['MailMessage'][_0x54b7('0x4a')](_0x312be4[_0x54b7('0x48')])[_0x54b7('0x14')](function(_0x176439){if(_0x176439){if(_0x176439[_0x54b7('0x4b')]===_0x54b7('0x4c')&&!_0x176439[_0x54b7('0x4d')]){var _0x20abfb,_0x3d16a2,_0x1be3e2;if(_0x312be4[_0x54b7('0x48')]['to']){_0x3d16a2=_0x312be4[_0x54b7('0x48')]['to'][_0x54b7('0x4e')](',')[0x0];}return db[_0x54b7('0x4f')]['findOne']({'where':{'id':_0x176439[_0x54b7('0x50')]},'include':[{'model':db[_0x54b7('0x51')],'as':_0x54b7('0x52'),'include':[{'model':db['CmContact'],'as':_0x54b7('0x53'),'where':{'email':_0x3d16a2},'limit':0x1,'order':[[_0x54b7('0x54'),_0x54b7('0x55')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x54b7('0x14')](function(_0x1d7644){_0x20abfb=_0x1d7644;if(_0x20abfb&&_0x20abfb['Smtp']){var _0x429efe={'tls':{'rejectUnauthorized':![]}};if(_[_0x54b7('0x56')](_0x20abfb[_0x54b7('0x57')]['service'])){_0x429efe[_0x54b7('0x58')]=_0x20abfb[_0x54b7('0x57')]['host'];_0x429efe[_0x54b7('0x59')]=_0x20abfb[_0x54b7('0x57')]['port'];_0x429efe[_0x54b7('0x5a')]=_0x20abfb[_0x54b7('0x57')][_0x54b7('0x5a')];if(_0x20abfb[_0x54b7('0x57')]['authentication']){_0x429efe[_0x54b7('0x5b')]={'user':_0x20abfb[_0x54b7('0x57')]['user'],'pass':_0x20abfb[_0x54b7('0x57')][_0x54b7('0x5c')]};}}else{_0x429efe[_0x54b7('0x5d')]=_0x20abfb[_0x54b7('0x57')][_0x54b7('0x5d')];_0x429efe[_0x54b7('0x5b')]={'user':_0x20abfb['Smtp'][_0x54b7('0x5e')],'pass':_0x20abfb[_0x54b7('0x57')][_0x54b7('0x5c')]};_0x429efe[_0x54b7('0x5a')]=_0x20abfb[_0x54b7('0x57')][_0x54b7('0x5a')];}if(_0x312be4[_0x54b7('0x48')][_0x54b7('0x5f')]&&_0x312be4['body'][_0x54b7('0x5f')][_0x54b7('0x36')]){for(var _0x3b38eb=0x0;_0x3b38eb<_0x312be4[_0x54b7('0x48')]['attachments'][_0x54b7('0x36')];_0x3b38eb+=0x1){_0x312be4[_0x54b7('0x48')]['attachments'][_0x3b38eb]={'filename':_0x312be4['body'][_0x54b7('0x5f')][_0x3b38eb][_0x54b7('0x2c')],'path':path['join'](config[_0x54b7('0x60')],_0x54b7('0x61'),_0x312be4[_0x54b7('0x48')][_0x54b7('0x5f')][_0x3b38eb][_0x54b7('0x62')])};}}_0x1be3e2={'account':_0x429efe,'message':_0x312be4[_0x54b7('0x48')]};return;}})[_0x54b7('0x14')](function(){if(_0x20abfb['List']){if(_0x20abfb[_0x54b7('0x52')][_0x54b7('0x53')][_0x54b7('0x36')]){return _0x20abfb[_0x54b7('0x52')][_0x54b7('0x53')][0x0];}else{return db[_0x54b7('0x63')][_0x54b7('0x4a')](_[_0x54b7('0xc')](_0x312be4[_0x54b7('0x48')],{'firstName':_0x312be4[_0x54b7('0x48')]['to'],'email':_0x312be4[_0x54b7('0x48')]['to'],'phone':_0x312be4[_0x54b7('0x48')]['to'],'ListId':_0x20abfb['ListId']}));}}else{throw new Error(_0x54b7('0x64'));}})[_0x54b7('0x14')](function(){if(_0x1be3e2){return respondWithRpcPromise('SendMail',_0x54b7('0x65'),_0x1be3e2,client9003)[_0x54b7('0x14')](function(_0x245b77){return _0x176439['update']({'read':!![],'messageId':_0x245b77['messageId'],'sentAt':moment()[_0x54b7('0x66')](_0x54b7('0x67'))});})['catch'](function(_0x392351){logger[_0x54b7('0x1b')]('%s',JSON[_0x54b7('0x1a')](_0x392351));return _0x176439;});}return _0x176439;});}return _0x176439;}})[_0x54b7('0x14')](respondWithResult(_0x1cdd1b,0xc9))[_0x54b7('0x1f')](handleError(_0x1cdd1b,null));};exports['accept']=function(_0x16c426,_0x41cdf6){var _0x199062={'agent':{},'channel':_0x54b7('0x68')};if(_0x16c426[_0x54b7('0x48')]['id']){delete _0x16c426[_0x54b7('0x48')]['id'];}_0x16c426[_0x54b7('0x48')][_0x54b7('0x69')]=!![];_0x16c426[_0x54b7('0x48')][_0x54b7('0x6a')]=moment()[_0x54b7('0x66')](_0x54b7('0x67'));_0x16c426[_0x54b7('0x48')]['UserId']=_0x16c426[_0x54b7('0x48')][_0x54b7('0x6b')]||_0x16c426[_0x54b7('0x5e')]['id'];_0x199062[_0x54b7('0x6c')]['id']=_0x16c426[_0x54b7('0x48')][_0x54b7('0x6b')];return db['MailMessage']['find']({'where':{'id':_0x16c426['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x41cdf6,null))[_0x54b7('0x14')](saveUpdates(_0x16c426[_0x54b7('0x48')],null))[_0x54b7('0x14')](function(_0x112214){if(_0x112214){_0x199062['message']=_0x112214['get']({'plain':!![]});return db['MailInteraction'][_0x54b7('0x47')]({'where':{'id':_0x112214[_0x54b7('0x6d')]}});}return null;})[_0x54b7('0x14')](handleEntityNotFound(_0x41cdf6,null))[_0x54b7('0x14')](function(_0x25e576){if(_0x25e576){return _0x25e576[_0x54b7('0x27')]({'UserId':_0x16c426['body'][_0x54b7('0x6b')],'read1stAt':_[_0x54b7('0x56')](_0x25e576[_0x54b7('0x6e')])?moment()[_0x54b7('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x54b7('0x14')](function(_0x5e6c75){if(_0x5e6c75){_0x199062[_0x54b7('0x6f')]=_0x5e6c75['get']({'plain':!![]});interaction_log[_0x54b7('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x16c426[_0x54b7('0x5e')]['id'],_0x16c426['user'][_0x54b7('0x2c')],_0x16c426['user'][_0x54b7('0x70')],_0x199062[_0x54b7('0x6f')]['id'],_0x16c426[_0x54b7('0x48')]?JSON[_0x54b7('0x1a')](_0x16c426[_0x54b7('0x48')]):_0x54b7('0x71'));return respondWithRpcPromise(_0x54b7('0x72'),_0x54b7('0x73'),_0x199062);}return null;})[_0x54b7('0x14')](function(_0x2baad3){var _0x1068ed=_0x54b7('0x74')+_0x2baad3[_0x54b7('0x1d')][_0x54b7('0x75')];return db['sequelize'][_0x54b7('0x32')](_0x1068ed,{'type':db[_0x54b7('0x76')][_0x54b7('0x77')]['SELECT'],'raw':!![]})[_0x54b7('0x14')](function(_0xeaa495){return _0xeaa495;});})[_0x54b7('0x14')](function(_0x22a522){if(_0x22a522){_0x199062[_0x54b7('0x1d')][_0x54b7('0x78')]=_0x22a522[0x0];if(!_0x16c426[_0x54b7('0x48')]['UserId'])return;return db['User']['find']({'where':{'id':_0x16c426[_0x54b7('0x48')]['UserId'],'role':_0x54b7('0x6c')},'attributes':['id',_0x54b7('0x2c'),_0x54b7('0x79'),'email',_0x54b7('0x7a')],'raw':!![]});}return null;})['then'](function(_0x2ed399){if(!_0x2ed399)return null;_0x199062[_0x54b7('0x1d')][_0x54b7('0x6c')]=_0x2ed399;return _0x199062;})[_0x54b7('0x14')](function(_0x3adde3){if(_0x3adde3){if(_0x16c426[_0x54b7('0x48')][_0x54b7('0x7b')]){_0x199062['message'][_0x54b7('0x7c')]=util['format'](_0x54b7('0x7d'),_0x16c426['user']['name']);_0x199062[_0x54b7('0x1d')][_0x54b7('0x7e')]=_0x199062['channel'];_0x199062[_0x54b7('0x1d')][_0x54b7('0x7f')]=_0x199062[_0x54b7('0x7e')];_0x199062['message'][_0x54b7('0x80')]=_0x54b7('0x81');_0x199062['message']['body']=htmlToText['fromString'](_0x199062['message'][_0x54b7('0x48')]);return respondWithRpcPromise(_0x54b7('0x82'),_0x54b7('0x82'),{'event':_0x54b7('0x83'),'message':_0x199062[_0x54b7('0x1d')]},client9002)[_0x54b7('0x14')](function(){return _0x199062;});}return _0x199062;}return null;})[_0x54b7('0x14')](respondWithResult(_0x41cdf6,null))['catch'](handleError(_0x41cdf6,null));};exports[_0x54b7('0x84')]=function(_0xbaf190,_0x3ca70e){var _0x5119c3={'agent':{},'channel':_0x54b7('0x68')};if(_0xbaf190['body']['id']){delete _0xbaf190[_0x54b7('0x48')]['id'];}_0xbaf190[_0x54b7('0x48')][_0x54b7('0x6b')]=_0xbaf190[_0x54b7('0x48')]['UserId']||_0xbaf190[_0x54b7('0x5e')]['id'];_0x5119c3[_0x54b7('0x6c')]['id']=_0xbaf190['body'][_0x54b7('0x6b')];return db[_0x54b7('0x2f')][_0x54b7('0x47')]({'where':{'id':_0xbaf190[_0x54b7('0x42')]['id'],'UserId':null}})[_0x54b7('0x14')](handleEntityNotFound(_0x3ca70e,null))[_0x54b7('0x14')](function(_0x1e3591){if(_0x1e3591){_0x5119c3[_0x54b7('0x1d')]=_0x1e3591[_0x54b7('0x85')]({'plain':!![]});return db[_0x54b7('0x86')]['find']({'where':{'id':_0x1e3591[_0x54b7('0x6d')]}});}return null;})[_0x54b7('0x14')](handleEntityNotFound(_0x3ca70e,null))['then'](function(_0x46b0b4){if(_0x46b0b4){_0x5119c3[_0x54b7('0x6f')]=_0x46b0b4[_0x54b7('0x85')]({'plain':!![]});interaction_log[_0x54b7('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xbaf190['user']['id'],_0xbaf190[_0x54b7('0x5e')]['name'],_0xbaf190['user'][_0x54b7('0x70')],_0x5119c3[_0x54b7('0x6f')]['id'],_0xbaf190[_0x54b7('0x48')]?JSON[_0x54b7('0x1a')](_0xbaf190['body']):'null');return respondWithRpcPromise(_0x54b7('0x87'),_0x54b7('0x88'),_0x5119c3);}return null;})[_0x54b7('0x14')](function(_0x513117){var _0x41b937=_0x54b7('0x74')+_0x513117['message'][_0x54b7('0x75')];return db[_0x54b7('0x89')]['query'](_0x41b937,{'type':db[_0x54b7('0x76')][_0x54b7('0x77')][_0x54b7('0x8a')],'raw':!![]})[_0x54b7('0x14')](function(_0x815429){return _0x815429;});})[_0x54b7('0x14')](function(_0x21f340){if(_0x21f340){_0x5119c3['message'][_0x54b7('0x78')]=_0x21f340[0x0];if(!_0xbaf190[_0x54b7('0x48')]['UserId'])return;return db[_0x54b7('0x8b')]['find']({'where':{'id':_0xbaf190[_0x54b7('0x48')][_0x54b7('0x6b')],'role':_0x54b7('0x6c')},'attributes':['id',_0x54b7('0x2c'),_0x54b7('0x79'),_0x54b7('0x8c'),_0x54b7('0x7a')],'raw':!![]});}return null;})['then'](function(_0x478d46){if(!_0x478d46)return null;_0x5119c3[_0x54b7('0x1d')]['agent']=_0x478d46;return _0x5119c3;})[_0x54b7('0x14')](function(_0x111620){if(_0x111620){_0x111620[_0x54b7('0x1d')][_0x54b7('0x7c')]=util[_0x54b7('0x66')](_0x54b7('0x7d'),_0xbaf190['user']['name']);_0x111620['message'][_0x54b7('0x7e')]=_0x5119c3[_0x54b7('0x7e')];_0x111620['message'][_0x54b7('0x7f')]=_0x5119c3[_0x54b7('0x7e')];_0x111620['message'][_0x54b7('0x80')]=_0x54b7('0x84');_0x111620['message']['body']=htmlToText[_0x54b7('0x8d')](_0x5119c3['message']['body']);respondWithRpcPromise(_0x54b7('0x82'),'EventManager',{'event':'rejectmessage','message':_0x111620[_0x54b7('0x1d')]},client9002);return _0x5119c3;}return null;})[_0x54b7('0x14')](respondWithResult(_0x3ca70e,null))[_0x54b7('0x1f')](handleError(_0x3ca70e,null));};exports[_0x54b7('0x8e')]=function(_0x22160f,_0x15f7aa){var _0x5d9067=moment()['unix']()['toString']();var _0x4177fb=path[_0x54b7('0x8f')](config[_0x54b7('0x60')],'server','files','tmp');var _0x1181bf=path[_0x54b7('0x8f')](config['root'],_0x54b7('0x90'),'files',_0x54b7('0x5f'));var _0x40b617=util[_0x54b7('0x66')](_0x54b7('0x91'),_0x5d9067);return db['MailMessage'][_0x54b7('0x47')]({'where':{'id':_0x22160f[_0x54b7('0x42')]['id']},'attributes':['id',_0x54b7('0x48'),_0x54b7('0x92'),'to','cc',_0x54b7('0x93'),'subject',_0x54b7('0x94')],'include':_0x22160f[_0x54b7('0x32')][_0x54b7('0x5f')]?[{'model':db[_0x54b7('0x95')],'as':_0x54b7('0x96')}]:undefined})[_0x54b7('0x14')](handleEntityNotFound(_0x15f7aa,null))['then'](function(_0x2a0dc6){if(_0x2a0dc6){var _0x5268a8=_0x2a0dc6;var _0x304e5f={'from':_0x5268a8[_0x54b7('0x92')],'to':_0x5268a8['to'],'subject':_0x5268a8[_0x54b7('0x97')],'html':htmlEntities[_0x54b7('0x98')](_0x5268a8[_0x54b7('0x48')]),'headers':{'Date':moment(_0x5268a8[_0x54b7('0x94')])['format'](_0x54b7('0x99'))},'attachments':[]};if(_0x2a0dc6['cc']){_0x304e5f['headers']['Cc']=_0x2a0dc6['cc'];}if(_0x2a0dc6[_0x54b7('0x93')]){_0x304e5f[_0x54b7('0x9a')][_0x54b7('0x9b')]=_0x2a0dc6[_0x54b7('0x93')];}return new BPromise(function(_0x4642a7,_0x117f7d){if(_0x2a0dc6[_0x54b7('0x96')]){for(var _0x1a4d4d=0x0;_0x1a4d4d<_0x2a0dc6[_0x54b7('0x96')][_0x54b7('0x36')];_0x1a4d4d++){var _0x6535e1=_0x2a0dc6[_0x54b7('0x96')][_0x1a4d4d];var _0xe8ec1a=path[_0x54b7('0x8f')](_0x1181bf,_0x6535e1[_0x54b7('0x62')]);if(fs[_0x54b7('0x9c')](_0xe8ec1a)){_0x304e5f[_0x54b7('0x5f')][_0x54b7('0x9d')]({'name':_0x6535e1[_0x54b7('0x2c')],'contentType':_0x6535e1[_0x54b7('0x9e')],'data':fs['readFileSync'](_0xe8ec1a)});}}}emlformat[_0x54b7('0x9f')](_0x304e5f,function(_0x2a5cc9,_0x3106ce){if(_0x2a5cc9)return _0x117f7d(_0x2a5cc9);fs[_0x54b7('0xa0')](path[_0x54b7('0x8f')](_0x4177fb,_0x40b617),_0x3106ce);return _0x4642a7(_0x3106ce);});});}})[_0x54b7('0x14')](function(_0x55b2f){if(_0x55b2f){return _0x15f7aa[_0x54b7('0x8e')](path['join'](_0x4177fb,_0x40b617),_0x40b617,function(_0x4476c2){if(!_0x4476c2)fs[_0x54b7('0xa1')](path[_0x54b7('0x8f')](_0x4177fb,_0x40b617));});}})[_0x54b7('0x1f')](handleError(_0x15f7aa,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 2e16f0b..c8ff8a7 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 _0xd049=['setMaxListeners','save','update','remove','hook','exports','MailMessage'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xd049,0x6f));var _0x9d04=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd049[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x9d04('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9d04('0x1')](0x0);var events={'afterCreate':_0x9d04('0x2'),'afterUpdate':_0x9d04('0x3'),'afterDestroy':_0x9d04('0x4')};function emitEvent(_0x136216){return function(_0x54b342,_0x1a4536,_0x406972){MailMessageEvents['emit'](_0x136216+':'+_0x54b342['id'],_0x54b342);MailMessageEvents['emit'](_0x136216,_0x54b342);_0x406972(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x9d04('0x5')](e,emitEvent(event));}}module[_0x9d04('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x0dea=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb','MailMessage'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x0dea,0x106));var _0xa0de=function(_0x311fd4,_0x2fc056){_0x311fd4=_0x311fd4-0x0;var _0x2a7835=_0x0dea[_0x311fd4];return _0x2a7835;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xa0de('0x0'))['db'][_0xa0de('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa0de('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0de('0x3'),'afterDestroy':_0xa0de('0x4')};function emitEvent(_0x476e2b){return function(_0x434606,_0xfb1464,_0x497062){MailMessageEvents['emit'](_0x476e2b+':'+_0x434606['id'],_0x434606);MailMessageEvents[_0xa0de('0x5')](_0x476e2b,_0x434606);_0x497062(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xa0de('0x6')](e,emitEvent(event));}}module[_0xa0de('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 ee5d955..106c57d 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 _0x19c4=['body','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','path','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','plainBody'];(function(_0x20c604,_0x5d5a7f){var _0x268cf5=function(_0xef8fea){while(--_0xef8fea){_0x20c604['push'](_0x20c604['shift']());}};_0x268cf5(++_0x5d5a7f);}(_0x19c4,0xcc));var _0x419c=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x19c4[_0x4df1f5];return _0x56585b;};'use strict';var _=require(_0x419c('0x0'));var util=require('util');var logger=require(_0x419c('0x1'))('api');var moment=require(_0x419c('0x2'));var BPromise=require(_0x419c('0x3'));var rp=require(_0x419c('0x4'));var htmlToText=require(_0x419c('0x5'));var fs=require('fs');var path=require(_0x419c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x419c('0x7'));module[_0x419c('0x8')]=function(_0x5bb205,_0x4481a7){return _0x5bb205['define'](_0x419c('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x419c('0xa'),'fields':[_0x419c('0xa')]},{'name':_0x419c('0xb'),'fields':[_0x419c('0xc'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x859fdd,_0x4c0307,_0x4749e7){if(_0x859fdd['body']){_0x859fdd[_0x419c('0xc')]=htmlToText['fromString'](_0x859fdd[_0x419c('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4749e7(null,_0x4c0307);},'afterCreate':function(_0x4c73f7,_0x1a73fc,_0x32fb73){var _0x172ed8=_0x5bb205[_0x419c('0xe')];var _0x4e65c1=_0x4c73f7[_0x419c('0xf')]({'plain':!![]});if(_0x4e65c1[_0x419c('0x10')]['toLowerCase']()==='in'||_0x4e65c1[_0x419c('0x10')][_0x419c('0x11')]()==='out'&&!_0x4e65c1[_0x419c('0x12')]&&!_[_0x419c('0x13')](_0x4e65c1[_0x419c('0x14')])){_0x172ed8[_0x419c('0x15')][_0x419c('0x16')]({'where':{'id':_0x4e65c1[_0x419c('0x17')]}})[_0x419c('0x18')](function(_0x3eab59){if(_0x3eab59){_0x3eab59[_0x419c('0x19')]({'lastMsgAt':_0x4e65c1[_0x419c('0x1a')],'lastMsgDirection':_0x4e65c1['direction'][_0x419c('0x11')]()});}})[_0x419c('0x1b')](function(_0x2a0d9f){console[_0x419c('0x1c')](_0x2a0d9f);});}_0x32fb73();}},'charset':_0x419c('0x1d'),'collate':_0x419c('0x1e')});}; \ No newline at end of file +var _0x3aa4=['secret','isNil','UserId','findOne','MailInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out'];(function(_0x25109d,_0x2623f1){var _0x23cd42=function(_0x46826a){while(--_0x46826a){_0x25109d['push'](_0x25109d['shift']());}};_0x23cd42(++_0x2623f1);}(_0x3aa4,0x140));var _0x43aa=function(_0x57f69f,_0x52ac66){_0x57f69f=_0x57f69f-0x0;var _0x235f67=_0x3aa4[_0x57f69f];return _0x235f67;};'use strict';var _=require(_0x43aa('0x0'));var util=require(_0x43aa('0x1'));var logger=require(_0x43aa('0x2'))(_0x43aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x43aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43aa('0x5'));var config=require(_0x43aa('0x6'));var attributes=require(_0x43aa('0x7'));module['exports']=function(_0x294bc2,_0x320856){return _0x294bc2[_0x43aa('0x8')]('MailMessage',attributes,{'tableName':_0x43aa('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x43aa('0xa')]},{'name':_0x43aa('0xb'),'fields':[_0x43aa('0xc'),_0x43aa('0xd')],'type':_0x43aa('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x231b3d,_0x368eca,_0x25eada){if(_0x231b3d[_0x43aa('0xf')]){_0x231b3d[_0x43aa('0xc')]=htmlToText['fromString'](_0x231b3d[_0x43aa('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x25eada(null,_0x368eca);},'afterCreate':function(_0x559922,_0x1bfa24,_0xae92c8){var _0x284bfd=_0x294bc2[_0x43aa('0x10')];var _0x159cc1=_0x559922[_0x43aa('0x11')]({'plain':!![]});if(_0x159cc1[_0x43aa('0x12')][_0x43aa('0x13')]()==='in'||_0x159cc1[_0x43aa('0x12')][_0x43aa('0x13')]()===_0x43aa('0x14')&&!_0x159cc1[_0x43aa('0x15')]&&!_[_0x43aa('0x16')](_0x159cc1[_0x43aa('0x17')])){_0x284bfd['MailInteraction'][_0x43aa('0x18')]({'where':{'id':_0x159cc1[_0x43aa('0x19')]}})['then'](function(_0x58deaf){if(_0x58deaf){_0x58deaf[_0x43aa('0x1a')]({'lastMsgAt':_0x159cc1['createdAt'],'lastMsgDirection':_0x159cc1[_0x43aa('0x12')][_0x43aa('0x13')]()});}})[_0x43aa('0x1b')](function(_0x5dda3e){console[_0x43aa('0x1c')](_0x5dda3e);});}_0xae92c8();}},'charset':_0x43aa('0x1d'),'collate':_0x43aa('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 30ef35c..aa8e722 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 _0x5f2f=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x258719,_0x21214b){var _0x3da9fa=function(_0x15092d){while(--_0x15092d){_0x258719['push'](_0x258719['shift']());}};_0x3da9fa(++_0x21214b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x457808,_0x4c22fc){_0x457808=_0x457808-0x0;var _0x122088=_0x5f2f[_0x457808];return _0x122088;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./mailMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateMailMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x0b0e=['message','result','MailMessage','create','body','options','CreateMailMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s'];(function(_0x5a3890,_0x36d07c){var _0x41d87c=function(_0x540fe6){while(--_0x540fe6){_0x5a3890['push'](_0x5a3890['shift']());}};_0x41d87c(++_0x36d07c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3c2863,_0x1b2cee){_0x3c2863=_0x3c2863-0x0;var _0x2c3d27=_0x0b0e[_0x3c2863];return _0x2c3d27;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('MailMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('MailMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('MailMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateMailMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateMailMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 903636b..57bdef2 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 _0xf757=['update','emit','removeListener','register','./mailMessage.events','save','remove'];(function(_0x1add5b,_0x53cfca){var _0x1a681f=function(_0x4f201a){while(--_0x4f201a){_0x1add5b['push'](_0x1add5b['shift']());}};_0x1a681f(++_0x53cfca);}(_0xf757,0x89));var _0x7f75=function(_0x4bcfa6,_0x1c7e43){_0x4bcfa6=_0x4bcfa6-0x0;var _0x1c0165=_0xf757[_0x4bcfa6];return _0x1c0165;};'use strict';var MailMessageEvents=require(_0x7f75('0x0'));var events=[_0x7f75('0x1'),_0x7f75('0x2'),_0x7f75('0x3')];function createListener(_0xeb2164,_0x31d79b){return function(_0x542a02){_0x31d79b[_0x7f75('0x4')](_0xeb2164,_0x542a02);};}function removeListener(_0x11d0a0,_0x2ff6f2){return function(){MailMessageEvents[_0x7f75('0x5')](_0x11d0a0,_0x2ff6f2);};}exports[_0x7f75('0x6')]=function(_0x27f49a){for(var _0x50129a=0x0,_0x16fc82=events['length'];_0x50129a<_0x16fc82;_0x50129a++){var _0x87b7f1=events[_0x50129a];var _0x263928=createListener('mailMessage:'+_0x87b7f1,_0x27f49a);MailMessageEvents['on'](_0x87b7f1,_0x263928);}}; \ No newline at end of file +var _0x63db=['mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x1bd230,_0x1da01e){var _0x19a3e3=function(_0x3cb9fa){while(--_0x3cb9fa){_0x1bd230['push'](_0x1bd230['shift']());}};_0x19a3e3(++_0x1da01e);}(_0x63db,0x191));var _0xb63d=function(_0x2342f1,_0x3a7a4a){_0x2342f1=_0x2342f1-0x0;var _0x39e316=_0x63db[_0x2342f1];return _0x39e316;};'use strict';var MailMessageEvents=require(_0xb63d('0x0'));var events=[_0xb63d('0x1'),_0xb63d('0x2'),_0xb63d('0x3')];function createListener(_0x41217c,_0x3a3d43){return function(_0x5c7def){_0x3a3d43[_0xb63d('0x4')](_0x41217c,_0x5c7def);};}function removeListener(_0x320ac3,_0x1dbcc5){return function(){MailMessageEvents[_0xb63d('0x5')](_0x320ac3,_0x1dbcc5);};}exports['register']=function(_0x654fc0){for(var _0xc523d3=0x0,_0x302b3e=events[_0xb63d('0x6')];_0xc523d3<_0x302b3e;_0xc523d3++){var _0x273b47=events[_0xc523d3];var _0x2cf99b=createListener(_0xb63d('0x7')+_0x273b47,_0x654fc0);MailMessageEvents['on'](_0x273b47,_0x2cf99b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 792fba6..fc6590f 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 _0x9d28=['post','/:id/teams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents'];(function(_0x4d15c7,_0x36391c){var _0x4d6827=function(_0x3b6d42){while(--_0x3b6d42){_0x4d15c7['push'](_0x4d15c7['shift']());}};_0x4d6827(++_0x36391c);}(_0x9d28,0x1c9));var _0x89d2=function(_0x3f4bef,_0x359a87){_0x3f4bef=_0x3f4bef-0x0;var _0x1989b7=_0x9d28[_0x3f4bef];return _0x1989b7;};'use strict';var multer=require(_0x89d2('0x0'));var util=require(_0x89d2('0x1'));var path=require(_0x89d2('0x2'));var timeout=require(_0x89d2('0x3'));var express=require('express');var router=express[_0x89d2('0x4')]();var fs_extra=require(_0x89d2('0x5'));var auth=require(_0x89d2('0x6'));var interaction=require(_0x89d2('0x7'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x89d2('0x8')]('/',auth[_0x89d2('0x9')](),controller[_0x89d2('0xa')]);router[_0x89d2('0x8')](_0x89d2('0xb'),auth[_0x89d2('0x9')](),controller[_0x89d2('0xc')]);router[_0x89d2('0x8')](_0x89d2('0xd'),auth[_0x89d2('0x9')](),controller[_0x89d2('0xe')]);router[_0x89d2('0x8')](_0x89d2('0xf'),auth[_0x89d2('0x9')](),controller[_0x89d2('0x10')]);router[_0x89d2('0x8')]('/:id/teams',auth[_0x89d2('0x9')](),controller['getTeams']);router['get'](_0x89d2('0x11'),auth[_0x89d2('0x9')](),controller[_0x89d2('0x12')]);router[_0x89d2('0x13')]('/',auth[_0x89d2('0x9')](),controller['create']);router[_0x89d2('0x13')](_0x89d2('0x14'),auth[_0x89d2('0x9')](),controller['addTeams']);router[_0x89d2('0x13')]('/:id/users',auth[_0x89d2('0x9')](),controller[_0x89d2('0x15')]);router[_0x89d2('0x16')](_0x89d2('0xd'),auth[_0x89d2('0x9')](),controller['update']);router[_0x89d2('0x17')](_0x89d2('0xd'),auth['isAuthenticated'](),controller[_0x89d2('0x18')]);router[_0x89d2('0x17')](_0x89d2('0x14'),auth[_0x89d2('0x9')](),controller[_0x89d2('0x19')]);router[_0x89d2('0x17')](_0x89d2('0x11'),auth[_0x89d2('0x9')](),controller[_0x89d2('0x1a')]);module[_0x89d2('0x1b')]=router; \ No newline at end of file +var _0xec6e=['delete','destroy','/:id/teams','removeTeams','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getMembers','getTeams','/:id/users','post','addTeams','addAgents','update'];(function(_0x5d88cb,_0x1af706){var _0x9ead17=function(_0x1b76e9){while(--_0x1b76e9){_0x5d88cb['push'](_0x5d88cb['shift']());}};_0x9ead17(++_0x1af706);}(_0xec6e,0xbc));var _0xeec6=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0xec6e[_0x5e8d3e];return _0x1348c0;};'use strict';var multer=require('multer');var util=require(_0xeec6('0x0'));var path=require(_0xeec6('0x1'));var timeout=require('connect-timeout');var express=require(_0xeec6('0x2'));var router=express[_0xeec6('0x3')]();var fs_extra=require(_0xeec6('0x4'));var auth=require(_0xeec6('0x5'));var interaction=require(_0xeec6('0x6'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xeec6('0x7')]('/',auth[_0xeec6('0x8')](),controller[_0xeec6('0x9')]);router[_0xeec6('0x7')](_0xeec6('0xa'),auth[_0xeec6('0x8')](),controller['describe']);router[_0xeec6('0x7')](_0xeec6('0xb'),auth[_0xeec6('0x8')](),controller[_0xeec6('0xc')]);router[_0xeec6('0x7')]('/:id/members',auth[_0xeec6('0x8')](),controller[_0xeec6('0xd')]);router['get']('/:id/teams',auth[_0xeec6('0x8')](),controller[_0xeec6('0xe')]);router[_0xeec6('0x7')](_0xeec6('0xf'),auth[_0xeec6('0x8')](),controller['getAgents']);router[_0xeec6('0x10')]('/',auth[_0xeec6('0x8')](),controller['create']);router[_0xeec6('0x10')]('/:id/teams',auth[_0xeec6('0x8')](),controller[_0xeec6('0x11')]);router['post'](_0xeec6('0xf'),auth[_0xeec6('0x8')](),controller[_0xeec6('0x12')]);router['put']('/:id',auth[_0xeec6('0x8')](),controller[_0xeec6('0x13')]);router[_0xeec6('0x14')](_0xeec6('0xb'),auth[_0xeec6('0x8')](),controller[_0xeec6('0x15')]);router['delete'](_0xeec6('0x16'),auth[_0xeec6('0x8')](),controller[_0xeec6('0x17')]);router[_0xeec6('0x14')](_0xeec6('0xf'),auth['isAuthenticated'](),controller[_0xeec6('0x18')]);module[_0xeec6('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1cc49a3..524eb39 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 _0x965b=['beepall','roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory'];(function(_0x1f8491,_0x1e1b91){var _0x4232c1=function(_0x4fec5b){while(--_0x4fec5b){_0x1f8491['push'](_0x1f8491['shift']());}};_0x4232c1(++_0x1e1b91);}(_0x965b,0x64));var _0xb965=function(_0x44021c,_0x12d5c0){_0x44021c=_0x44021c-0x0;var _0x178bfc=_0x965b[_0x44021c];return _0x178bfc;};'use strict';var Sequelize=require(_0xb965('0x0'));module['exports']={'name':{'type':Sequelize[_0xb965('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb965('0x1')]},'timeout':{'type':Sequelize[_0xb965('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb965('0x3')](_0xb965('0x4'),_0xb965('0x5'),_0xb965('0x6'))}}; \ No newline at end of file +var _0x696e=['INTEGER','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x26b3da,_0x347f15){var _0x48142f=function(_0xd0b203){while(--_0xd0b203){_0x26b3da['push'](_0x26b3da['shift']());}};_0x48142f(++_0x347f15);}(_0x696e,0x1a0));var _0xe696=function(_0x1fe23b,_0x482c23){_0x1fe23b=_0x1fe23b-0x0;var _0x5422ad=_0x696e[_0x1fe23b];return _0x5422ad;};'use strict';var Sequelize=require(_0xe696('0x0'));module[_0xe696('0x1')]={'name':{'type':Sequelize[_0xe696('0x2')],'unique':_0xe696('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe696('0x2')]},'timeout':{'type':Sequelize[_0xe696('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe696('0x5'),'beepall',_0xe696('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 2d3165a..7ba0eb3 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 _0x03ce=['to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','MailQueueId','User','findAndCountAll','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','compact','value','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x419e1c,_0x5dc959){var _0x1970ae=function(_0xf9a88b){while(--_0xf9a88b){_0x419e1c['push'](_0x419e1c['shift']());}};_0x1970ae(++_0x5dc959);}(_0x03ce,0x1a1));var _0xe03c=function(_0x5a3af8,_0xbe9219){_0x5a3af8=_0x5a3af8-0x0;var _0x177779=_0x03ce[_0x5a3af8];return _0x177779;};'use strict';var emlformat=require(_0xe03c('0x0'));var rimraf=require(_0xe03c('0x1'));var zipdir=require(_0xe03c('0x2'));var jsonpatch=require(_0xe03c('0x3'));var rp=require('request-promise');var moment=require(_0xe03c('0x4'));var BPromise=require(_0xe03c('0x5'));var Mustache=require(_0xe03c('0x6'));var util=require('util');var path=require(_0xe03c('0x7'));var sox=require(_0xe03c('0x8'));var csv=require(_0xe03c('0x9'));var ejs=require(_0xe03c('0xa'));var fs=require('fs');var fs_extra=require(_0xe03c('0xb'));var _=require(_0xe03c('0xc'));var squel=require(_0xe03c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe03c('0xe'));var toCsv=require(_0xe03c('0x9'));var querystring=require(_0xe03c('0xf'));var Papa=require(_0xe03c('0x10'));var Redis=require(_0xe03c('0x11'));var authService=require(_0xe03c('0x12'));var qs=require(_0xe03c('0x13'));var as=require(_0xe03c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe03c('0x15'))(_0xe03c('0x16'));var utils=require(_0xe03c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe03c('0x18'));var db=require(_0xe03c('0x19'))['db'];config[_0xe03c('0x1a')]=_[_0xe03c('0x1b')](config[_0xe03c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe03c('0x1c'))(new Redis(config[_0xe03c('0x1a')]));require(_0xe03c('0x1d'))['register'](socket);function respondWithStatusCode(_0x2ffd1f,_0x18bc27){_0x18bc27=_0x18bc27||0xcc;return function(_0x35856c){if(_0x35856c){return _0x2ffd1f[_0xe03c('0x1e')](_0x18bc27);}return _0x2ffd1f[_0xe03c('0x1f')](_0x18bc27)['end']();};}function respondWithResult(_0x3d6287,_0x584cb6){_0x584cb6=_0x584cb6||0xc8;return function(_0x4887ad){if(_0x4887ad){return _0x3d6287[_0xe03c('0x1f')](_0x584cb6)[_0xe03c('0x20')](_0x4887ad);}};}function respondWithFilteredResult(_0x3b3ecc,_0x5dbdeb){return function(_0x56ec58){if(_0x56ec58){var _0x23080a=typeof _0x5dbdeb[_0xe03c('0x21')]==='undefined'&&typeof _0x5dbdeb[_0xe03c('0x22')]===_0xe03c('0x23');var _0x157882=_0x56ec58['count'];var _0x5563af=_0x23080a?0x0:_0x5dbdeb[_0xe03c('0x21')];var _0x108acd=_0x23080a?_0x56ec58[_0xe03c('0x24')]:_0x5dbdeb[_0xe03c('0x21')]+_0x5dbdeb[_0xe03c('0x22')];var _0x3f8564;if(_0x108acd>=_0x157882){_0x108acd=_0x157882;_0x3f8564=0xc8;}else{_0x3f8564=0xce;}_0x3b3ecc[_0xe03c('0x1f')](_0x3f8564);return _0x3b3ecc[_0xe03c('0x25')]('Content-Range',_0x5563af+'-'+_0x108acd+'/'+_0x157882)[_0xe03c('0x20')](_0x56ec58);}return null;};}function patchUpdates(_0x4d5c40){return function(_0x1133a4){try{jsonpatch[_0xe03c('0x26')](_0x1133a4,_0x4d5c40,!![]);}catch(_0x3ae889){return BPromise[_0xe03c('0x27')](_0x3ae889);}return _0x1133a4[_0xe03c('0x28')]();};}function saveUpdates(_0x95a4b3,_0x37f5ff){return function(_0x55605d){if(_0x55605d){return _0x55605d[_0xe03c('0x29')](_0x95a4b3)[_0xe03c('0x2a')](function(_0x353def){return _0x353def;});}return null;};}function removeEntity(_0x1ec81e,_0x35dc82){return function(_0x2a4983){if(_0x2a4983){return _0x2a4983[_0xe03c('0x2b')]()[_0xe03c('0x2a')](function(){var _0x2d3644=_0x2a4983[_0xe03c('0x2c')]({'plain':!![]});var _0xc8aecb=_0xe03c('0x2d');return db[_0xe03c('0x2e')][_0xe03c('0x2b')]({'where':{'type':_0xc8aecb,'resourceId':_0x2d3644['id']}})[_0xe03c('0x2a')](function(){return _0x2a4983;});})[_0xe03c('0x2a')](function(){_0x1ec81e['status'](0xcc)[_0xe03c('0x2f')]();});}};}function handleEntityNotFound(_0x4c0618,_0x29a0fe){return function(_0x2d8f30){if(!_0x2d8f30){_0x4c0618[_0xe03c('0x1e')](0x194);}return _0x2d8f30;};}function handleError(_0x313e8e,_0x2d4cf8){_0x2d4cf8=_0x2d4cf8||0x1f4;return function(_0x46fb63){logger[_0xe03c('0x30')](_0x46fb63[_0xe03c('0x31')]);if(_0x46fb63['name']){delete _0x46fb63[_0xe03c('0x32')];}_0x313e8e[_0xe03c('0x1f')](_0x2d4cf8)[_0xe03c('0x33')](_0x46fb63);};}exports[_0xe03c('0x34')]=function(_0x31b054,_0x4fbabc){var _0x244d90={},_0x3add01={},_0x446cce={'count':0x0,'rows':[]};var _0x356bcc=_[_0xe03c('0x35')](db[_0xe03c('0x36')][_0xe03c('0x37')],function(_0x166a00){return{'name':_0x166a00[_0xe03c('0x38')],'type':_0x166a00[_0xe03c('0x39')][_0xe03c('0x3a')]};});_0x3add01[_0xe03c('0x3b')]=_[_0xe03c('0x35')](_0x356bcc,_0xe03c('0x32'));_0x3add01[_0xe03c('0x3c')]=_[_0xe03c('0x3d')](_0x31b054[_0xe03c('0x3c')]);_0x3add01['filters']=_[_0xe03c('0x3e')](_0x3add01[_0xe03c('0x3b')],_0x3add01[_0xe03c('0x3c')]);_0x244d90[_0xe03c('0x3f')]=_['intersection'](_0x3add01[_0xe03c('0x3b')],qs['fields'](_0x31b054['query'][_0xe03c('0x40')]));_0x244d90[_0xe03c('0x3f')]=_0x244d90[_0xe03c('0x3f')][_0xe03c('0x41')]?_0x244d90['attributes']:_0x3add01[_0xe03c('0x3b')];if(!_0x31b054[_0xe03c('0x3c')]['hasOwnProperty']('nolimit')){_0x244d90['limit']=qs['limit'](_0x31b054[_0xe03c('0x3c')]['limit']);_0x244d90[_0xe03c('0x21')]=qs['offset'](_0x31b054['query'][_0xe03c('0x21')]);}_0x244d90[_0xe03c('0x42')]=qs[_0xe03c('0x43')](_0x31b054[_0xe03c('0x3c')]['sort']);_0x244d90[_0xe03c('0x44')]=qs['filters'](_[_0xe03c('0x45')](_0x31b054[_0xe03c('0x3c')],_0x3add01[_0xe03c('0x46')]),_0x356bcc);if(_0x31b054[_0xe03c('0x3c')][_0xe03c('0x47')]){_0x244d90[_0xe03c('0x44')]=_[_0xe03c('0x48')](_0x244d90['where'],{'$or':_[_0xe03c('0x35')](_0x356bcc,function(_0x4f6550){if(_0x4f6550[_0xe03c('0x39')]!==_0xe03c('0x49')){var _0x44720b={};_0x44720b[_0x4f6550[_0xe03c('0x32')]]={'$like':'%'+_0x31b054[_0xe03c('0x3c')][_0xe03c('0x47')]+'%'};return _0x44720b;}})});}_0x244d90=_['merge']({},_0x244d90,_0x31b054['options']);var _0x531f9e={'where':_0x244d90[_0xe03c('0x44')]};return db[_0xe03c('0x36')]['count'](_0x531f9e)[_0xe03c('0x2a')](function(_0x43dc4f){_0x446cce[_0xe03c('0x24')]=_0x43dc4f;if(_0x31b054[_0xe03c('0x3c')]['includeAll']){_0x244d90[_0xe03c('0x4a')]=[{'all':!![]}];}return db[_0xe03c('0x36')][_0xe03c('0x4b')](_0x244d90);})[_0xe03c('0x2a')](function(_0x40c726){_0x446cce[_0xe03c('0x4c')]=_0x40c726;return _0x446cce;})['then'](respondWithFilteredResult(_0x4fbabc,_0x244d90))[_0xe03c('0x4d')](handleError(_0x4fbabc,null));};exports[_0xe03c('0x4e')]=function(_0x211e67,_0x5d91d2){var _0x4a88c5={'raw':!![],'where':{'id':_0x211e67['params']['id']}},_0x23dba5={};_0x23dba5['model']=_[_0xe03c('0x3d')](db[_0xe03c('0x36')]['rawAttributes']);_0x23dba5[_0xe03c('0x3c')]=_[_0xe03c('0x3d')](_0x211e67[_0xe03c('0x3c')]);_0x23dba5[_0xe03c('0x46')]=_['intersection'](_0x23dba5[_0xe03c('0x3b')],_0x23dba5['query']);_0x4a88c5[_0xe03c('0x3f')]=_[_0xe03c('0x3e')](_0x23dba5[_0xe03c('0x3b')],qs[_0xe03c('0x40')](_0x211e67['query'][_0xe03c('0x40')]));_0x4a88c5['attributes']=_0x4a88c5[_0xe03c('0x3f')][_0xe03c('0x41')]?_0x4a88c5['attributes']:_0x23dba5[_0xe03c('0x3b')];if(_0x211e67[_0xe03c('0x3c')][_0xe03c('0x4f')]){_0x4a88c5[_0xe03c('0x4a')]=[{'all':!![]}];}_0x4a88c5=_[_0xe03c('0x48')]({},_0x4a88c5,_0x211e67[_0xe03c('0x50')]);return db[_0xe03c('0x36')][_0xe03c('0x51')](_0x4a88c5)[_0xe03c('0x2a')](handleEntityNotFound(_0x5d91d2,null))[_0xe03c('0x2a')](respondWithResult(_0x5d91d2,null))[_0xe03c('0x4d')](handleError(_0x5d91d2,null));};exports[_0xe03c('0x52')]=function(_0x2bbe00,_0x3f9a7a){return db[_0xe03c('0x36')][_0xe03c('0x52')](_0x2bbe00['body'],{})[_0xe03c('0x2a')](function(_0x117ddc){var _0x3d73b0=_0x2bbe00[_0xe03c('0x53')][_0xe03c('0x2c')]({'plain':!![]});if(!_0x3d73b0)throw new Error(_0xe03c('0x54'));if(_0x3d73b0[_0xe03c('0x55')]===_0xe03c('0x53')){var _0x5182ef=_0x117ddc[_0xe03c('0x2c')]({'plain':!![]});var _0x21b510=_0xe03c('0x2d');return db[_0xe03c('0x56')]['find']({'where':{'name':_0x21b510,'userProfileId':_0x3d73b0['userProfileId']},'raw':!![]})[_0xe03c('0x2a')](function(_0x11c739){if(_0x11c739&&_0x11c739[_0xe03c('0x57')]===0x0){return db[_0xe03c('0x2e')][_0xe03c('0x52')]({'name':_0x5182ef[_0xe03c('0x32')],'resourceId':_0x5182ef['id'],'type':_0x11c739[_0xe03c('0x32')],'sectionId':_0x11c739['id']},{})[_0xe03c('0x2a')](function(){return _0x117ddc;});}else{return _0x117ddc;}})['catch'](function(_0x30cf57){logger[_0xe03c('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30cf57);throw _0x30cf57;});}return _0x117ddc;})['then'](respondWithResult(_0x3f9a7a,0xc9))[_0xe03c('0x4d')](handleError(_0x3f9a7a,null));};exports[_0xe03c('0x29')]=function(_0x5eaee2,_0x51f4bb){if(_0x5eaee2[_0xe03c('0x58')]['id']){delete _0x5eaee2[_0xe03c('0x58')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x5eaee2[_0xe03c('0x59')]['id']}})[_0xe03c('0x2a')](handleEntityNotFound(_0x51f4bb,null))['then'](saveUpdates(_0x5eaee2['body'],null))['then'](respondWithResult(_0x51f4bb,null))[_0xe03c('0x4d')](handleError(_0x51f4bb,null));};exports[_0xe03c('0x2b')]=function(_0x159b03,_0x9a1535){return db[_0xe03c('0x36')][_0xe03c('0x51')]({'where':{'id':_0x159b03['params']['id']}})[_0xe03c('0x2a')](handleEntityNotFound(_0x9a1535,null))[_0xe03c('0x2a')](removeEntity(_0x9a1535,null))[_0xe03c('0x4d')](handleError(_0x9a1535,null));};exports['describe']=function(_0x1ee41c,_0x56d16){return db[_0xe03c('0x36')][_0xe03c('0x5a')]()[_0xe03c('0x2a')](respondWithResult(_0x56d16,null))[_0xe03c('0x4d')](handleError(_0x56d16,null));};exports[_0xe03c('0x5b')]=function(_0x1ba72d,_0x4ea064,_0x2831c3){var _0x5e7154={'raw':!![],'where':{}},_0xe64c90={},_0x3378a8;return db[_0xe03c('0x36')][_0xe03c('0x5c')]({'where':{'id':_0x1ba72d['params']['id']}})[_0xe03c('0x2a')](handleEntityNotFound(_0x4ea064,null))[_0xe03c('0x2a')](function(_0x2866e8){if(_0x2866e8){_0x3378a8=_0x2866e8[_0xe03c('0x2c')]({'plain':!![]});_0xe64c90[_0xe03c('0x3b')]=_[_0xe03c('0x3d')](db[_0xe03c('0x5d')][_0xe03c('0x37')]);_0xe64c90[_0xe03c('0x3c')]=_[_0xe03c('0x3d')](_0x1ba72d['query']);_0xe64c90[_0xe03c('0x46')]=_[_0xe03c('0x3e')](_0xe64c90['model'],_0xe64c90[_0xe03c('0x3c')]);_0x5e7154[_0xe03c('0x3f')]=_[_0xe03c('0x3e')](_0xe64c90[_0xe03c('0x3b')],qs[_0xe03c('0x40')](_0x1ba72d[_0xe03c('0x3c')][_0xe03c('0x40')]));_0x5e7154[_0xe03c('0x3f')]=_0x5e7154[_0xe03c('0x3f')][_0xe03c('0x41')]?_0x5e7154[_0xe03c('0x3f')]:_0xe64c90[_0xe03c('0x3b')];if(!_0x1ba72d['query'][_0xe03c('0x5e')](_0xe03c('0x5f'))){_0x5e7154[_0xe03c('0x22')]=qs[_0xe03c('0x22')](_0x1ba72d[_0xe03c('0x3c')][_0xe03c('0x22')]);_0x5e7154[_0xe03c('0x21')]=qs[_0xe03c('0x21')](_0x1ba72d[_0xe03c('0x3c')][_0xe03c('0x21')]);}_0x5e7154[_0xe03c('0x42')]=qs[_0xe03c('0x43')](_0x1ba72d[_0xe03c('0x3c')][_0xe03c('0x43')]);_0x5e7154[_0xe03c('0x44')]=qs[_0xe03c('0x46')](_[_0xe03c('0x45')](_0x1ba72d[_0xe03c('0x3c')],_0xe64c90[_0xe03c('0x46')]));_0x5e7154['where'][_0xe03c('0x60')]=_0x2866e8['id'];if(_0x1ba72d['query'][_0xe03c('0x47')]){_0x5e7154[_0xe03c('0x44')]=_[_0xe03c('0x48')](_0x5e7154[_0xe03c('0x44')],{'$or':_[_0xe03c('0x35')](_0x5e7154[_0xe03c('0x3f')],function(_0x23dac7){var _0x210a39={};_0x210a39[_0x23dac7]={'$like':'%'+_0x1ba72d[_0xe03c('0x3c')][_0xe03c('0x47')]+'%'};return _0x210a39;})});}_0x5e7154=_[_0xe03c('0x48')]({},_0x5e7154,_0x1ba72d[_0xe03c('0x50')]);return db[_0xe03c('0x5d')][_0xe03c('0x4b')](_0x5e7154);}})[_0xe03c('0x2a')](function(_0x4fd793){if(_0x4fd793){return db[_0xe03c('0x61')][_0xe03c('0x62')]({'where':{'id':_['map'](_0x4fd793,'UserId'),'role':'agent'},'attributes':['id',_0xe03c('0x32'),_0xe03c('0x63'),_0xe03c('0x64'),_0xe03c('0x65')]});}})[_0xe03c('0x2a')](function(_0x17853c){if(_0x17853c){return{'count':_0x17853c['count'],'rows':_[_0xe03c('0x35')](_0x17853c['rows'],function(_0x4eab32){return{'membername':_0x4eab32['name'],'UserId':_0x4eab32['id'],'queue_name':_0x3378a8['name'],'MailQueueId':_0x3378a8['id'],'interface':util['format'](_0xe03c('0x66'),_0xe03c('0x67'),_0x4eab32[_0xe03c('0x32')]),'penalty':0x0,'paused':_0x4eab32['mailPause'],'createdAt':_0x4eab32[_0xe03c('0x65')],'updatedAt':_0x4eab32['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ea064,_0x5e7154))['catch'](handleError(_0x4ea064,null));};exports[_0xe03c('0x68')]=function(_0xabe5b9,_0x27e6ca,_0x5db91e){var _0x578c7e={};var _0x31c3bc={};var _0xc4eff8;var _0x4de91d;return db[_0xe03c('0x36')][_0xe03c('0x5c')]({'where':{'id':_0xabe5b9['params']['id']}})[_0xe03c('0x2a')](handleEntityNotFound(_0x27e6ca,null))[_0xe03c('0x2a')](function(_0x715572){if(_0x715572){_0xc4eff8=_0x715572;_0x31c3bc[_0xe03c('0x3b')]=_[_0xe03c('0x3d')](db[_0xe03c('0x69')]['rawAttributes']);_0x31c3bc[_0xe03c('0x3c')]=_[_0xe03c('0x3d')](_0xabe5b9[_0xe03c('0x3c')]);_0x31c3bc[_0xe03c('0x46')]=_[_0xe03c('0x3e')](_0x31c3bc['model'],_0x31c3bc[_0xe03c('0x3c')]);_0x578c7e[_0xe03c('0x3f')]=_[_0xe03c('0x3e')](_0x31c3bc[_0xe03c('0x3b')],qs[_0xe03c('0x40')](_0xabe5b9[_0xe03c('0x3c')][_0xe03c('0x40')]));_0x578c7e[_0xe03c('0x3f')]=_0x578c7e[_0xe03c('0x3f')]['length']?_0x578c7e[_0xe03c('0x3f')]:_0x31c3bc[_0xe03c('0x3b')];_0x578c7e[_0xe03c('0x42')]=qs[_0xe03c('0x43')](_0xabe5b9[_0xe03c('0x3c')][_0xe03c('0x43')]);_0x578c7e[_0xe03c('0x44')]=qs[_0xe03c('0x46')](_['pick'](_0xabe5b9[_0xe03c('0x3c')],_0x31c3bc[_0xe03c('0x46')]));if(_0xabe5b9[_0xe03c('0x3c')][_0xe03c('0x47')]){_0x578c7e[_0xe03c('0x44')]=_['merge'](_0x578c7e[_0xe03c('0x44')],{'$or':_['map'](_0x578c7e[_0xe03c('0x3f')],function(_0x138b7d){var _0x5c9625={};_0x5c9625[_0x138b7d]={'$like':'%'+_0xabe5b9[_0xe03c('0x3c')][_0xe03c('0x47')]+'%'};return _0x5c9625;})});}_0x578c7e=_['merge']({},_0x578c7e,_0xabe5b9['options']);return _0xc4eff8[_0xe03c('0x68')](_0x578c7e);}})[_0xe03c('0x2a')](function(_0x4a4f5b){if(_0x4a4f5b){_0x4de91d=_0x4a4f5b[_0xe03c('0x41')];if(!_0xabe5b9[_0xe03c('0x3c')][_0xe03c('0x5e')](_0xe03c('0x5f'))){_0x578c7e[_0xe03c('0x22')]=qs[_0xe03c('0x22')](_0xabe5b9[_0xe03c('0x3c')][_0xe03c('0x22')]);_0x578c7e[_0xe03c('0x21')]=qs['offset'](_0xabe5b9[_0xe03c('0x3c')][_0xe03c('0x21')]);}return _0xc4eff8[_0xe03c('0x68')](_0x578c7e);}})['then'](function(_0x412d17){if(_0x412d17){return _0x412d17?{'count':_0x4de91d,'rows':_0x412d17}:null;}})[_0xe03c('0x2a')](respondWithResult(_0x27e6ca,null))['catch'](handleError(_0x27e6ca,null));};exports['addTeams']=function(_0x387672,_0x2e020f,_0x2f2b93){var _0x32068b=_0x387672[_0xe03c('0x58')][_0xe03c('0x6a')];return db[_0xe03c('0x69')][_0xe03c('0x4b')]({'where':{'id':_0x32068b},'attributes':['id'],'include':[{'model':db[_0xe03c('0x61')],'as':_0xe03c('0x6b'),'attributes':['id',_0xe03c('0x32'),_0xe03c('0x6c'),_0xe03c('0x6d'),_0xe03c('0x6e')],'raw':!![]}]})[_0xe03c('0x2a')](function(_0x3fafc6){if(_0x3fafc6){var _0x215356=_[_0xe03c('0x6f')](_0x3fafc6,function(_0x55f399){var _0x1c259f=_0x55f399[_0xe03c('0x2c')]({'plain':!![]});return _0x1c259f[_0xe03c('0x6b')];});return db[_0xe03c('0x36')][_0xe03c('0x51')]({'where':{'id':_0x387672[_0xe03c('0x59')]['id']}})[_0xe03c('0x2a')](function(_0x72d96e){return db[_0xe03c('0x70')][_0xe03c('0x71')](function(_0x2f9d92){return _0x72d96e[_0xe03c('0x72')](_0x32068b,{'transaction':_0x2f9d92})[_0xe03c('0x2a')](function(){return BPromise[_0xe03c('0x73')](_0x215356,function(_0x4412bd){return db[_0xe03c('0x5d')][_0xe03c('0x74')]({'where':{'UserId':_0x4412bd['id'],'MailQueueId':_0x387672[_0xe03c('0x59')]['id']},'transaction':_0x2f9d92});});})[_0xe03c('0x2a')](function(){_0x215356[_0xe03c('0x75')](function(_0x27370a){socket[_0xe03c('0x76')]('userMailQueue:save',{'UserId':_0x27370a['id'],'MailQueueId':_0x72d96e['id']});});});});});}})[_0xe03c('0x2a')](respondWithStatusCode(_0x2e020f,null))[_0xe03c('0x4d')](handleError(_0x2e020f,null));};exports[_0xe03c('0x77')]=function(_0x34c5ec,_0x33a040,_0x403314){return db['Team'][_0xe03c('0x4b')]({'where':{'id':_0x34c5ec[_0xe03c('0x3c')][_0xe03c('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xe03c('0x61')],'as':_0xe03c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xe03c('0x2a')](handleEntityNotFound(_0x33a040,null))[_0xe03c('0x2a')](function(_0x3f22df){var _0x1da7b2=_[_0xe03c('0x35')](_0x3f22df,'id');var _0x45cda4=[];var _0x332a78=[];var _0x5f5156=squel[_0xe03c('0x78')]();_0x5f5156[_0xe03c('0x79')](_0xe03c('0x7a'))[_0xe03c('0x7b')](_0xe03c('0x7c'),'tq')[_0xe03c('0x7d')](_0xe03c('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe03c('0x44')](_0xe03c('0x7f'),_0x34c5ec['params']['id']);for(var _0xdd18f5=0x0;_0xdd18f5<_0x3f22df[_0xe03c('0x41')];_0xdd18f5+=0x1){let _0x542d72=_0x3f22df[_0xdd18f5];for(var _0x4d56f4=0x0;_0x4d56f4<_0x542d72['Agents'][_0xe03c('0x41')];_0x4d56f4+=0x1){let _0x65e550=_0x542d72[_0xe03c('0x6b')][_0x4d56f4];var _0x48a375=_0x5f5156[_0xe03c('0x80')]();_0x48a375[_0xe03c('0x44')](_0xe03c('0x81'),_0x65e550['id']);_0x332a78[_0xe03c('0x82')](db[_0xe03c('0x70')]['query'](_0x48a375['toString'](),{'type':db[_0xe03c('0x70')][_0xe03c('0x83')]['SELECT']})[_0xe03c('0x2a')](function(_0x37193f){if(_0x37193f[_0xe03c('0x41')]===0x1){return _0x65e550['id'];}else{var _0x1e6167=_['every'](_[_0xe03c('0x35')](_0x37193f,_0xe03c('0x84')),function(_0x16897d){return _[_0xe03c('0x85')](_0x1da7b2,_0x16897d);});if(_0x1e6167){return _0x65e550['id'];}}}));}}return BPromise[_0xe03c('0x86')](_0x332a78)[_0xe03c('0x2a')](function(_0x24ba48){_0x45cda4=_(_0x45cda4)['union'](_0x24ba48)[_0xe03c('0x87')]()[_0xe03c('0x88')]();return db['MailQueue']['find']({'where':{'id':_0x34c5ec[_0xe03c('0x59')]['id']}})['then'](function(_0x1ec8d4){return db[_0xe03c('0x70')][_0xe03c('0x71')](function(_0x2f6412){return _0x1ec8d4['removeTeams'](_0x34c5ec[_0xe03c('0x3c')][_0xe03c('0x6a')],{'transaction':_0x2f6412})[_0xe03c('0x2a')](function(){if(!_['isEmpty'](_0x45cda4)){return _0x1ec8d4[_0xe03c('0x89')](_0x45cda4,{'transaction':_0x2f6412});}})[_0xe03c('0x2a')](function(){_0x45cda4[_0xe03c('0x75')](function(_0xcdd241){socket[_0xe03c('0x76')](_0xe03c('0x8a'),{'UserId':_0xcdd241,'MailQueueId':_0x1ec8d4['id']});});});});});});})[_0xe03c('0x2a')](respondWithStatusCode(_0x33a040,null))[_0xe03c('0x4d')](handleError(_0x33a040,null));};exports[_0xe03c('0x8b')]=function(_0x49da03,_0xee460,_0x47cec2){return db['MailQueue'][_0xe03c('0x51')]({'where':{'id':_0x49da03[_0xe03c('0x59')]['id']}})[_0xe03c('0x2a')](handleEntityNotFound(_0xee460,null))[_0xe03c('0x2a')](function(_0x5b0768){if(_0x5b0768){return _0x5b0768[_0xe03c('0x8b')](_0x49da03[_0xe03c('0x58')]['ids'],_['omit'](_0x49da03['body'],[_0xe03c('0x6a'),'id'])||{})['spread'](function(_0x49f098){for(var _0x51d8c3=0x0;_0x51d8c3<_0x49da03[_0xe03c('0x58')][_0xe03c('0x6a')][_0xe03c('0x41')];_0x51d8c3+=0x1){socket[_0xe03c('0x76')]('userMailQueue:save',{'UserId':Number(_0x49da03[_0xe03c('0x58')][_0xe03c('0x6a')][_0x51d8c3]),'MailQueueId':Number(_0x49da03[_0xe03c('0x59')]['id'])});}return _0x49f098;});}})[_0xe03c('0x2a')](respondWithResult(_0xee460,null))[_0xe03c('0x4d')](handleError(_0xee460,null));};exports[_0xe03c('0x89')]=function(_0x219444,_0x12d192,_0x1839ff){return db['MailQueue'][_0xe03c('0x51')]({'where':{'id':_0x219444[_0xe03c('0x59')]['id']}})['then'](handleEntityNotFound(_0x12d192,null))[_0xe03c('0x2a')](function(_0x1f7602){if(_0x1f7602){return _0x1f7602[_0xe03c('0x89')](_0x219444[_0xe03c('0x3c')][_0xe03c('0x6a')])[_0xe03c('0x2a')](function(){if(_[_0xe03c('0x8c')](_0x219444['query'][_0xe03c('0x6a')])){for(var _0x1e51b7=0x0;_0x1e51b7<_0x219444[_0xe03c('0x3c')]['ids'][_0xe03c('0x41')];_0x1e51b7+=0x1){socket[_0xe03c('0x76')](_0xe03c('0x8a'),{'UserId':Number(_0x219444['query'][_0xe03c('0x6a')][_0x1e51b7]),'MailQueueId':Number(_0x219444[_0xe03c('0x59')]['id'])});}}else{socket[_0xe03c('0x76')](_0xe03c('0x8a'),{'UserId':Number(_0x219444[_0xe03c('0x3c')][_0xe03c('0x6a')]),'MailQueueId':Number(_0x219444[_0xe03c('0x59')]['id'])});}});}})[_0xe03c('0x2a')](respondWithStatusCode(_0x12d192,null))[_0xe03c('0x4d')](handleError(_0x12d192,null));};exports[_0xe03c('0x8d')]=function(_0x3d9cb9,_0x32fbaa,_0x3a0851){var _0x2068ba={};var _0x1a8f38={};var _0x34a52f;var _0x17f010;return db['MailQueue'][_0xe03c('0x5c')]({'where':{'id':_0x3d9cb9[_0xe03c('0x59')]['id']}})[_0xe03c('0x2a')](handleEntityNotFound(_0x32fbaa,null))[_0xe03c('0x2a')](function(_0x436d6c){if(_0x436d6c){_0x34a52f=_0x436d6c;_0x1a8f38['model']=_[_0xe03c('0x3d')](db['User'][_0xe03c('0x37')]);_0x1a8f38[_0xe03c('0x3c')]=_[_0xe03c('0x3d')](_0x3d9cb9[_0xe03c('0x3c')]);_0x1a8f38[_0xe03c('0x46')]=_[_0xe03c('0x3e')](_0x1a8f38[_0xe03c('0x3b')],_0x1a8f38['query']);_0x2068ba[_0xe03c('0x3f')]=_['intersection'](_0x1a8f38[_0xe03c('0x3b')],qs[_0xe03c('0x40')](_0x3d9cb9[_0xe03c('0x3c')]['fields']));_0x2068ba[_0xe03c('0x3f')]=_0x2068ba[_0xe03c('0x3f')]['length']?_0x2068ba['attributes']:_0x1a8f38[_0xe03c('0x3b')];_0x2068ba[_0xe03c('0x42')]=qs[_0xe03c('0x43')](_0x3d9cb9[_0xe03c('0x3c')][_0xe03c('0x43')]);_0x2068ba[_0xe03c('0x44')]=qs[_0xe03c('0x46')](_['pick'](_0x3d9cb9['query'],_0x1a8f38[_0xe03c('0x46')]));if(_0x3d9cb9['query'][_0xe03c('0x47')]){_0x2068ba[_0xe03c('0x44')]=_[_0xe03c('0x48')](_0x2068ba['where'],{'$or':_[_0xe03c('0x35')](_0x2068ba[_0xe03c('0x3f')],function(_0x32ac2d){var _0x1048d9={};_0x1048d9[_0x32ac2d]={'$like':'%'+_0x3d9cb9[_0xe03c('0x3c')]['filter']+'%'};return _0x1048d9;})});}_0x2068ba=_[_0xe03c('0x48')]({},_0x2068ba,_0x3d9cb9[_0xe03c('0x50')]);return _0x34a52f['getAgents'](_0x2068ba);}})[_0xe03c('0x2a')](function(_0x6fd5e2){if(_0x6fd5e2){_0x17f010=_0x6fd5e2[_0xe03c('0x41')];if(!_0x3d9cb9['query'][_0xe03c('0x5e')](_0xe03c('0x5f'))){_0x2068ba[_0xe03c('0x22')]=qs[_0xe03c('0x22')](_0x3d9cb9[_0xe03c('0x3c')][_0xe03c('0x22')]);_0x2068ba[_0xe03c('0x21')]=qs[_0xe03c('0x21')](_0x3d9cb9[_0xe03c('0x3c')][_0xe03c('0x21')]);}return _0x34a52f[_0xe03c('0x8d')](_0x2068ba);}})[_0xe03c('0x2a')](function(_0x3bf715){if(_0x3bf715){return _0x3bf715?{'count':_0x17f010,'rows':_0x3bf715}:null;}})['then'](respondWithResult(_0x32fbaa,null))[_0xe03c('0x4d')](handleError(_0x32fbaa,null));}; \ No newline at end of file +var _0x6b98=['flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','union','compact','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','name','send','MailQueue','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','params','UserMailQueue','pick','MailQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause','Team','length','getTeams','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6b98,0x13a));var _0x86b9=function(_0xc694ff,_0x1498ad){_0xc694ff=_0xc694ff-0x0;var _0x59dba2=_0x6b98[_0xc694ff];return _0x59dba2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x86b9('0x0'));var jsonpatch=require(_0x86b9('0x1'));var rp=require(_0x86b9('0x2'));var moment=require(_0x86b9('0x3'));var BPromise=require(_0x86b9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x86b9('0x5'));var fs=require('fs');var fs_extra=require(_0x86b9('0x6'));var _=require(_0x86b9('0x7'));var squel=require(_0x86b9('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86b9('0x9'));var toCsv=require(_0x86b9('0xa'));var querystring=require(_0x86b9('0xb'));var Papa=require(_0x86b9('0xc'));var Redis=require(_0x86b9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x86b9('0xe'));var as=require(_0x86b9('0xf'));var hardwareService=require(_0x86b9('0x10'));var logger=require(_0x86b9('0x11'))(_0x86b9('0x12'));var utils=require(_0x86b9('0x13'));var config=require(_0x86b9('0x14'));var licenseUtil=require(_0x86b9('0x15'));var db=require(_0x86b9('0x16'))['db'];config[_0x86b9('0x17')]=_[_0x86b9('0x18')](config[_0x86b9('0x17')],{'host':_0x86b9('0x19'),'port':0x18eb});var socket=require(_0x86b9('0x1a'))(new Redis(config[_0x86b9('0x17')]));require('./mailQueue.socket')[_0x86b9('0x1b')](socket);function respondWithStatusCode(_0xb9daa3,_0x286a2a){_0x286a2a=_0x286a2a||0xcc;return function(_0x34a8d7){if(_0x34a8d7){return _0xb9daa3['sendStatus'](_0x286a2a);}return _0xb9daa3[_0x86b9('0x1c')](_0x286a2a)[_0x86b9('0x1d')]();};}function respondWithResult(_0x26c04c,_0x2f2ec6){_0x2f2ec6=_0x2f2ec6||0xc8;return function(_0x3b830d){if(_0x3b830d){return _0x26c04c[_0x86b9('0x1c')](_0x2f2ec6)[_0x86b9('0x1e')](_0x3b830d);}};}function respondWithFilteredResult(_0x609c89,_0xffd0ea){return function(_0x542b9a){if(_0x542b9a){var _0x3f36c9=typeof _0xffd0ea[_0x86b9('0x1f')]===_0x86b9('0x20')&&typeof _0xffd0ea[_0x86b9('0x21')]===_0x86b9('0x20');var _0x2ca9ac=_0x542b9a[_0x86b9('0x22')];var _0x5db65a=_0x3f36c9?0x0:_0xffd0ea[_0x86b9('0x1f')];var _0x4a22d9=_0x3f36c9?_0x542b9a[_0x86b9('0x22')]:_0xffd0ea[_0x86b9('0x1f')]+_0xffd0ea[_0x86b9('0x21')];var _0x55ed4a;if(_0x4a22d9>=_0x2ca9ac){_0x4a22d9=_0x2ca9ac;_0x55ed4a=0xc8;}else{_0x55ed4a=0xce;}_0x609c89[_0x86b9('0x1c')](_0x55ed4a);return _0x609c89[_0x86b9('0x23')]('Content-Range',_0x5db65a+'-'+_0x4a22d9+'/'+_0x2ca9ac)[_0x86b9('0x1e')](_0x542b9a);}return null;};}function patchUpdates(_0x2e180e){return function(_0x138246){try{jsonpatch[_0x86b9('0x24')](_0x138246,_0x2e180e,!![]);}catch(_0x4133d2){return BPromise[_0x86b9('0x25')](_0x4133d2);}return _0x138246['save']();};}function saveUpdates(_0x460f54,_0x39ce9f){return function(_0x38411d){if(_0x38411d){return _0x38411d['update'](_0x460f54)[_0x86b9('0x26')](function(_0x2e3023){return _0x2e3023;});}return null;};}function removeEntity(_0x273d38,_0x5168cb){return function(_0x2fd363){if(_0x2fd363){return _0x2fd363[_0x86b9('0x27')]()['then'](function(){var _0x4f925e=_0x2fd363[_0x86b9('0x28')]({'plain':!![]});var _0x46c538=_0x86b9('0x29');return db[_0x86b9('0x2a')]['destroy']({'where':{'type':_0x46c538,'resourceId':_0x4f925e['id']}})[_0x86b9('0x26')](function(){return _0x2fd363;});})[_0x86b9('0x26')](function(){_0x273d38['status'](0xcc)[_0x86b9('0x1d')]();});}};}function handleEntityNotFound(_0x444d23,_0x34a6a7){return function(_0x336673){if(!_0x336673){_0x444d23[_0x86b9('0x2b')](0x194);}return _0x336673;};}function handleError(_0x2d8b72,_0x392400){_0x392400=_0x392400||0x1f4;return function(_0x3fed0f){logger[_0x86b9('0x2c')](_0x3fed0f['stack']);if(_0x3fed0f[_0x86b9('0x2d')]){delete _0x3fed0f[_0x86b9('0x2d')];}_0x2d8b72['status'](_0x392400)[_0x86b9('0x2e')](_0x3fed0f);};}exports['index']=function(_0x7be6e3,_0x5803b){var _0xf31c5f={},_0x282c25={},_0x5022f5={'count':0x0,'rows':[]};var _0x2c7723=_['map'](db[_0x86b9('0x2f')][_0x86b9('0x30')],function(_0x3d228a){return{'name':_0x3d228a[_0x86b9('0x31')],'type':_0x3d228a[_0x86b9('0x32')]['key']};});_0x282c25[_0x86b9('0x33')]=_[_0x86b9('0x34')](_0x2c7723,_0x86b9('0x2d'));_0x282c25[_0x86b9('0x35')]=_[_0x86b9('0x36')](_0x7be6e3['query']);_0x282c25['filters']=_['intersection'](_0x282c25['model'],_0x282c25[_0x86b9('0x35')]);_0xf31c5f[_0x86b9('0x37')]=_[_0x86b9('0x38')](_0x282c25[_0x86b9('0x33')],qs[_0x86b9('0x39')](_0x7be6e3['query'][_0x86b9('0x39')]));_0xf31c5f[_0x86b9('0x37')]=_0xf31c5f[_0x86b9('0x37')]['length']?_0xf31c5f['attributes']:_0x282c25[_0x86b9('0x33')];if(!_0x7be6e3[_0x86b9('0x35')]['hasOwnProperty'](_0x86b9('0x3a'))){_0xf31c5f['limit']=qs[_0x86b9('0x21')](_0x7be6e3[_0x86b9('0x35')][_0x86b9('0x21')]);_0xf31c5f[_0x86b9('0x1f')]=qs['offset'](_0x7be6e3[_0x86b9('0x35')][_0x86b9('0x1f')]);}_0xf31c5f[_0x86b9('0x3b')]=qs['sort'](_0x7be6e3[_0x86b9('0x35')][_0x86b9('0x3c')]);_0xf31c5f[_0x86b9('0x3d')]=qs[_0x86b9('0x3e')](_['pick'](_0x7be6e3['query'],_0x282c25[_0x86b9('0x3e')]),_0x2c7723);if(_0x7be6e3['query'][_0x86b9('0x3f')]){_0xf31c5f[_0x86b9('0x3d')]=_[_0x86b9('0x40')](_0xf31c5f[_0x86b9('0x3d')],{'$or':_['map'](_0x2c7723,function(_0x5bf139){if(_0x5bf139[_0x86b9('0x32')]!=='VIRTUAL'){var _0x418d27={};_0x418d27[_0x5bf139['name']]={'$like':'%'+_0x7be6e3[_0x86b9('0x35')][_0x86b9('0x3f')]+'%'};return _0x418d27;}})});}_0xf31c5f=_[_0x86b9('0x40')]({},_0xf31c5f,_0x7be6e3['options']);var _0x2bfca5={'where':_0xf31c5f[_0x86b9('0x3d')]};return db[_0x86b9('0x2f')][_0x86b9('0x22')](_0x2bfca5)[_0x86b9('0x26')](function(_0x5af09d){_0x5022f5['count']=_0x5af09d;if(_0x7be6e3[_0x86b9('0x35')][_0x86b9('0x41')]){_0xf31c5f[_0x86b9('0x42')]=[{'all':!![]}];}return db[_0x86b9('0x2f')][_0x86b9('0x43')](_0xf31c5f);})[_0x86b9('0x26')](function(_0x10a246){_0x5022f5[_0x86b9('0x44')]=_0x10a246;return _0x5022f5;})[_0x86b9('0x26')](respondWithFilteredResult(_0x5803b,_0xf31c5f))[_0x86b9('0x45')](handleError(_0x5803b,null));};exports[_0x86b9('0x46')]=function(_0x1a9205,_0xad5e80){var _0x501882={'raw':!![],'where':{'id':_0x1a9205['params']['id']}},_0x4b4cac={};_0x4b4cac[_0x86b9('0x33')]=_['keys'](db[_0x86b9('0x2f')][_0x86b9('0x30')]);_0x4b4cac[_0x86b9('0x35')]=_[_0x86b9('0x36')](_0x1a9205[_0x86b9('0x35')]);_0x4b4cac['filters']=_['intersection'](_0x4b4cac[_0x86b9('0x33')],_0x4b4cac[_0x86b9('0x35')]);_0x501882[_0x86b9('0x37')]=_['intersection'](_0x4b4cac[_0x86b9('0x33')],qs['fields'](_0x1a9205[_0x86b9('0x35')]['fields']));_0x501882[_0x86b9('0x37')]=_0x501882[_0x86b9('0x37')]['length']?_0x501882[_0x86b9('0x37')]:_0x4b4cac[_0x86b9('0x33')];if(_0x1a9205[_0x86b9('0x35')]['includeAll']){_0x501882[_0x86b9('0x42')]=[{'all':!![]}];}_0x501882=_['merge']({},_0x501882,_0x1a9205[_0x86b9('0x47')]);return db[_0x86b9('0x2f')][_0x86b9('0x48')](_0x501882)[_0x86b9('0x26')](handleEntityNotFound(_0xad5e80,null))[_0x86b9('0x26')](respondWithResult(_0xad5e80,null))[_0x86b9('0x45')](handleError(_0xad5e80,null));};exports['create']=function(_0x5bedfc,_0x24aa23){return db[_0x86b9('0x2f')][_0x86b9('0x49')](_0x5bedfc['body'],{})[_0x86b9('0x26')](function(_0x594616){var _0x36ad52=_0x5bedfc['user'][_0x86b9('0x28')]({'plain':!![]});if(!_0x36ad52)throw new Error(_0x86b9('0x4a'));if(_0x36ad52[_0x86b9('0x4b')]===_0x86b9('0x4c')){var _0x57817c=_0x594616[_0x86b9('0x28')]({'plain':!![]});var _0x4aeaf7=_0x86b9('0x29');return db[_0x86b9('0x4d')][_0x86b9('0x48')]({'where':{'name':_0x4aeaf7,'userProfileId':_0x36ad52[_0x86b9('0x4e')]},'raw':!![]})[_0x86b9('0x26')](function(_0x1896be){if(_0x1896be&&_0x1896be[_0x86b9('0x4f')]===0x0){return db[_0x86b9('0x2a')][_0x86b9('0x49')]({'name':_0x57817c['name'],'resourceId':_0x57817c['id'],'type':_0x1896be['name'],'sectionId':_0x1896be['id']},{})[_0x86b9('0x26')](function(){return _0x594616;});}else{return _0x594616;}})[_0x86b9('0x45')](function(_0x41f260){logger[_0x86b9('0x2c')](_0x86b9('0x50'),_0x41f260);throw _0x41f260;});}return _0x594616;})['then'](respondWithResult(_0x24aa23,0xc9))[_0x86b9('0x45')](handleError(_0x24aa23,null));};exports[_0x86b9('0x51')]=function(_0x1cf27d,_0x5ea16c){if(_0x1cf27d[_0x86b9('0x52')]['id']){delete _0x1cf27d['body']['id'];}return db['MailQueue'][_0x86b9('0x48')]({'where':{'id':_0x1cf27d['params']['id']}})[_0x86b9('0x26')](handleEntityNotFound(_0x5ea16c,null))[_0x86b9('0x26')](saveUpdates(_0x1cf27d[_0x86b9('0x52')],null))[_0x86b9('0x26')](respondWithResult(_0x5ea16c,null))['catch'](handleError(_0x5ea16c,null));};exports['destroy']=function(_0xe42215,_0x5adf43){return db['MailQueue'][_0x86b9('0x48')]({'where':{'id':_0xe42215['params']['id']}})[_0x86b9('0x26')](handleEntityNotFound(_0x5adf43,null))['then'](removeEntity(_0x5adf43,null))[_0x86b9('0x45')](handleError(_0x5adf43,null));};exports[_0x86b9('0x53')]=function(_0x356734,_0x7b5e5b){return db['MailQueue']['describe']()[_0x86b9('0x26')](respondWithResult(_0x7b5e5b,null))[_0x86b9('0x45')](handleError(_0x7b5e5b,null));};exports[_0x86b9('0x54')]=function(_0x12bcff,_0x56b080,_0x4d1678){var _0x580809={'raw':!![],'where':{}},_0x5d3e5e={},_0x5bdf7d;return db[_0x86b9('0x2f')][_0x86b9('0x55')]({'where':{'id':_0x12bcff[_0x86b9('0x56')]['id']}})[_0x86b9('0x26')](handleEntityNotFound(_0x56b080,null))[_0x86b9('0x26')](function(_0x29122a){if(_0x29122a){_0x5bdf7d=_0x29122a[_0x86b9('0x28')]({'plain':!![]});_0x5d3e5e[_0x86b9('0x33')]=_[_0x86b9('0x36')](db[_0x86b9('0x57')][_0x86b9('0x30')]);_0x5d3e5e[_0x86b9('0x35')]=_[_0x86b9('0x36')](_0x12bcff[_0x86b9('0x35')]);_0x5d3e5e[_0x86b9('0x3e')]=_[_0x86b9('0x38')](_0x5d3e5e[_0x86b9('0x33')],_0x5d3e5e[_0x86b9('0x35')]);_0x580809['attributes']=_['intersection'](_0x5d3e5e[_0x86b9('0x33')],qs['fields'](_0x12bcff[_0x86b9('0x35')]['fields']));_0x580809[_0x86b9('0x37')]=_0x580809[_0x86b9('0x37')]['length']?_0x580809[_0x86b9('0x37')]:_0x5d3e5e[_0x86b9('0x33')];if(!_0x12bcff['query']['hasOwnProperty'](_0x86b9('0x3a'))){_0x580809[_0x86b9('0x21')]=qs[_0x86b9('0x21')](_0x12bcff[_0x86b9('0x35')]['limit']);_0x580809[_0x86b9('0x1f')]=qs['offset'](_0x12bcff[_0x86b9('0x35')][_0x86b9('0x1f')]);}_0x580809[_0x86b9('0x3b')]=qs['sort'](_0x12bcff[_0x86b9('0x35')][_0x86b9('0x3c')]);_0x580809[_0x86b9('0x3d')]=qs[_0x86b9('0x3e')](_[_0x86b9('0x58')](_0x12bcff['query'],_0x5d3e5e[_0x86b9('0x3e')]));_0x580809['where'][_0x86b9('0x59')]=_0x29122a['id'];if(_0x12bcff[_0x86b9('0x35')][_0x86b9('0x3f')]){_0x580809[_0x86b9('0x3d')]=_[_0x86b9('0x40')](_0x580809[_0x86b9('0x3d')],{'$or':_[_0x86b9('0x34')](_0x580809[_0x86b9('0x37')],function(_0x47be8d){var _0x4c886f={};_0x4c886f[_0x47be8d]={'$like':'%'+_0x12bcff['query'][_0x86b9('0x3f')]+'%'};return _0x4c886f;})});}_0x580809=_[_0x86b9('0x40')]({},_0x580809,_0x12bcff[_0x86b9('0x47')]);return db[_0x86b9('0x57')][_0x86b9('0x43')](_0x580809);}})[_0x86b9('0x26')](function(_0x573135){if(_0x573135){return db[_0x86b9('0x5a')][_0x86b9('0x5b')]({'where':{'id':_[_0x86b9('0x34')](_0x573135,'UserId'),'role':_0x86b9('0x5c')},'attributes':['id',_0x86b9('0x2d'),'mailPause',_0x86b9('0x5d'),_0x86b9('0x5e')]});}})[_0x86b9('0x26')](function(_0x583dec){if(_0x583dec){return{'count':_0x583dec[_0x86b9('0x22')],'rows':_[_0x86b9('0x34')](_0x583dec['rows'],function(_0x25ec63){return{'membername':_0x25ec63[_0x86b9('0x2d')],'UserId':_0x25ec63['id'],'queue_name':_0x5bdf7d[_0x86b9('0x2d')],'MailQueueId':_0x5bdf7d['id'],'interface':util[_0x86b9('0x5f')](_0x86b9('0x60'),_0x86b9('0x61'),_0x25ec63['name']),'penalty':0x0,'paused':_0x25ec63[_0x86b9('0x62')],'createdAt':_0x25ec63[_0x86b9('0x5e')],'updatedAt':_0x25ec63[_0x86b9('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x56b080,_0x580809))[_0x86b9('0x45')](handleError(_0x56b080,null));};exports['getTeams']=function(_0x56daf3,_0x28fa30,_0x2ba2a4){var _0x3168aa={};var _0x1547c4={};var _0x56d912;var _0x398e34;return db[_0x86b9('0x2f')][_0x86b9('0x55')]({'where':{'id':_0x56daf3[_0x86b9('0x56')]['id']}})[_0x86b9('0x26')](handleEntityNotFound(_0x28fa30,null))[_0x86b9('0x26')](function(_0x379f29){if(_0x379f29){_0x56d912=_0x379f29;_0x1547c4[_0x86b9('0x33')]=_[_0x86b9('0x36')](db[_0x86b9('0x63')][_0x86b9('0x30')]);_0x1547c4[_0x86b9('0x35')]=_['keys'](_0x56daf3['query']);_0x1547c4[_0x86b9('0x3e')]=_[_0x86b9('0x38')](_0x1547c4[_0x86b9('0x33')],_0x1547c4[_0x86b9('0x35')]);_0x3168aa[_0x86b9('0x37')]=_['intersection'](_0x1547c4['model'],qs[_0x86b9('0x39')](_0x56daf3[_0x86b9('0x35')][_0x86b9('0x39')]));_0x3168aa['attributes']=_0x3168aa[_0x86b9('0x37')][_0x86b9('0x64')]?_0x3168aa['attributes']:_0x1547c4['model'];_0x3168aa['order']=qs[_0x86b9('0x3c')](_0x56daf3['query'][_0x86b9('0x3c')]);_0x3168aa[_0x86b9('0x3d')]=qs[_0x86b9('0x3e')](_[_0x86b9('0x58')](_0x56daf3[_0x86b9('0x35')],_0x1547c4[_0x86b9('0x3e')]));if(_0x56daf3[_0x86b9('0x35')]['filter']){_0x3168aa['where']=_['merge'](_0x3168aa[_0x86b9('0x3d')],{'$or':_['map'](_0x3168aa[_0x86b9('0x37')],function(_0x3b1a8d){var _0x397410={};_0x397410[_0x3b1a8d]={'$like':'%'+_0x56daf3['query']['filter']+'%'};return _0x397410;})});}_0x3168aa=_[_0x86b9('0x40')]({},_0x3168aa,_0x56daf3[_0x86b9('0x47')]);return _0x56d912[_0x86b9('0x65')](_0x3168aa);}})[_0x86b9('0x26')](function(_0x540ceb){if(_0x540ceb){_0x398e34=_0x540ceb['length'];if(!_0x56daf3[_0x86b9('0x35')][_0x86b9('0x66')]('nolimit')){_0x3168aa[_0x86b9('0x21')]=qs[_0x86b9('0x21')](_0x56daf3[_0x86b9('0x35')][_0x86b9('0x21')]);_0x3168aa[_0x86b9('0x1f')]=qs[_0x86b9('0x1f')](_0x56daf3[_0x86b9('0x35')][_0x86b9('0x1f')]);}return _0x56d912['getTeams'](_0x3168aa);}})[_0x86b9('0x26')](function(_0x5f20be){if(_0x5f20be){return _0x5f20be?{'count':_0x398e34,'rows':_0x5f20be}:null;}})['then'](respondWithResult(_0x28fa30,null))[_0x86b9('0x45')](handleError(_0x28fa30,null));};exports[_0x86b9('0x67')]=function(_0x3876e7,_0x59fe93,_0x55d550){var _0x454e22=_0x3876e7[_0x86b9('0x52')][_0x86b9('0x68')];return db[_0x86b9('0x63')][_0x86b9('0x43')]({'where':{'id':_0x454e22},'attributes':['id'],'include':[{'model':db['User'],'as':_0x86b9('0x69'),'attributes':['id',_0x86b9('0x2d'),_0x86b9('0x6a'),_0x86b9('0x6b'),_0x86b9('0x6c')],'raw':!![]}]})[_0x86b9('0x26')](function(_0x39d3e5){if(_0x39d3e5){var _0x23477e=_[_0x86b9('0x6d')](_0x39d3e5,function(_0x3ddb4c){var _0x1d5dd2=_0x3ddb4c[_0x86b9('0x28')]({'plain':!![]});return _0x1d5dd2[_0x86b9('0x69')];});return db['MailQueue']['find']({'where':{'id':_0x3876e7[_0x86b9('0x56')]['id']}})[_0x86b9('0x26')](function(_0x44507a){return db[_0x86b9('0x6e')][_0x86b9('0x6f')](function(_0x30ec94){return _0x44507a[_0x86b9('0x67')](_0x454e22,{'transaction':_0x30ec94})['then'](function(){return BPromise[_0x86b9('0x70')](_0x23477e,function(_0x12c150){return db[_0x86b9('0x57')][_0x86b9('0x71')]({'where':{'UserId':_0x12c150['id'],'MailQueueId':_0x3876e7[_0x86b9('0x56')]['id']},'transaction':_0x30ec94});});})['then'](function(){_0x23477e[_0x86b9('0x72')](function(_0x4431ae){socket['emit'](_0x86b9('0x73'),{'UserId':_0x4431ae['id'],'MailQueueId':_0x44507a['id']});});});});});}})[_0x86b9('0x26')](respondWithStatusCode(_0x59fe93,null))['catch'](handleError(_0x59fe93,null));};exports[_0x86b9('0x74')]=function(_0x167dc7,_0x413330,_0x12bd3a){return db[_0x86b9('0x63')]['findAll']({'where':{'id':_0x167dc7[_0x86b9('0x35')][_0x86b9('0x68')]},'attributes':['id'],'include':[{'model':db[_0x86b9('0x5a')],'as':_0x86b9('0x69'),'attributes':['id'],'raw':!![]}]})[_0x86b9('0x26')](handleEntityNotFound(_0x413330,null))[_0x86b9('0x26')](function(_0x1b4d3e){var _0x2e504a=_[_0x86b9('0x34')](_0x1b4d3e,'id');var _0x47f220=[];var _0x198dbd=[];var _0x1731a6=squel['select']();_0x1731a6[_0x86b9('0x75')](_0x86b9('0x76'))[_0x86b9('0x77')](_0x86b9('0x78'),'tq')[_0x86b9('0x79')]('user_has_teams','ut',_0x86b9('0x7a'))['where'](_0x86b9('0x7b'),_0x167dc7[_0x86b9('0x56')]['id']);for(var _0x3b882a=0x0;_0x3b882a<_0x1b4d3e[_0x86b9('0x64')];_0x3b882a+=0x1){let _0x22c726=_0x1b4d3e[_0x3b882a];for(var _0x1431a5=0x0;_0x1431a5<_0x22c726[_0x86b9('0x69')][_0x86b9('0x64')];_0x1431a5+=0x1){let _0x413aa9=_0x22c726['Agents'][_0x1431a5];var _0x42e1e6=_0x1731a6[_0x86b9('0x7c')]();_0x42e1e6[_0x86b9('0x3d')](_0x86b9('0x7d'),_0x413aa9['id']);_0x198dbd['push'](db[_0x86b9('0x6e')]['query'](_0x42e1e6['toString'](),{'type':db[_0x86b9('0x6e')][_0x86b9('0x7e')][_0x86b9('0x7f')]})[_0x86b9('0x26')](function(_0x10b539){if(_0x10b539[_0x86b9('0x64')]===0x1){return _0x413aa9['id'];}else{var _0x59b59d=_[_0x86b9('0x80')](_[_0x86b9('0x34')](_0x10b539,_0x86b9('0x81')),function(_0x83af85){return _['includes'](_0x2e504a,_0x83af85);});if(_0x59b59d){return _0x413aa9['id'];}}}));}}return BPromise['all'](_0x198dbd)[_0x86b9('0x26')](function(_0x57e13f){_0x47f220=_(_0x47f220)[_0x86b9('0x82')](_0x57e13f)[_0x86b9('0x83')]()['value']();return db['MailQueue']['find']({'where':{'id':_0x167dc7[_0x86b9('0x56')]['id']}})[_0x86b9('0x26')](function(_0x302205){return db[_0x86b9('0x6e')][_0x86b9('0x6f')](function(_0x37d69b){return _0x302205[_0x86b9('0x74')](_0x167dc7['query'][_0x86b9('0x68')],{'transaction':_0x37d69b})['then'](function(){if(!_[_0x86b9('0x84')](_0x47f220)){return _0x302205[_0x86b9('0x85')](_0x47f220,{'transaction':_0x37d69b});}})['then'](function(){_0x47f220[_0x86b9('0x72')](function(_0x1225d6){socket[_0x86b9('0x86')](_0x86b9('0x87'),{'UserId':_0x1225d6,'MailQueueId':_0x302205['id']});});});});});});})[_0x86b9('0x26')](respondWithStatusCode(_0x413330,null))[_0x86b9('0x45')](handleError(_0x413330,null));};exports[_0x86b9('0x88')]=function(_0x1cb14e,_0x1dd2ca,_0x1372e1){return db['MailQueue'][_0x86b9('0x48')]({'where':{'id':_0x1cb14e[_0x86b9('0x56')]['id']}})[_0x86b9('0x26')](handleEntityNotFound(_0x1dd2ca,null))[_0x86b9('0x26')](function(_0xd4974f){if(_0xd4974f){return _0xd4974f['addAgents'](_0x1cb14e[_0x86b9('0x52')]['ids'],_[_0x86b9('0x89')](_0x1cb14e[_0x86b9('0x52')],[_0x86b9('0x68'),'id'])||{})[_0x86b9('0x8a')](function(_0x1da43){for(var _0x5bc4e6=0x0;_0x5bc4e6<_0x1cb14e[_0x86b9('0x52')][_0x86b9('0x68')][_0x86b9('0x64')];_0x5bc4e6+=0x1){socket[_0x86b9('0x86')](_0x86b9('0x73'),{'UserId':Number(_0x1cb14e[_0x86b9('0x52')][_0x86b9('0x68')][_0x5bc4e6]),'MailQueueId':Number(_0x1cb14e[_0x86b9('0x56')]['id'])});}return _0x1da43;});}})[_0x86b9('0x26')](respondWithResult(_0x1dd2ca,null))['catch'](handleError(_0x1dd2ca,null));};exports[_0x86b9('0x85')]=function(_0x4979e3,_0x22f32a,_0x437e02){return db['MailQueue']['find']({'where':{'id':_0x4979e3[_0x86b9('0x56')]['id']}})['then'](handleEntityNotFound(_0x22f32a,null))['then'](function(_0x2f213c){if(_0x2f213c){return _0x2f213c[_0x86b9('0x85')](_0x4979e3[_0x86b9('0x35')][_0x86b9('0x68')])[_0x86b9('0x26')](function(){if(_[_0x86b9('0x8b')](_0x4979e3[_0x86b9('0x35')]['ids'])){for(var _0x568a43=0x0;_0x568a43<_0x4979e3[_0x86b9('0x35')][_0x86b9('0x68')][_0x86b9('0x64')];_0x568a43+=0x1){socket[_0x86b9('0x86')](_0x86b9('0x87'),{'UserId':Number(_0x4979e3[_0x86b9('0x35')][_0x86b9('0x68')][_0x568a43]),'MailQueueId':Number(_0x4979e3[_0x86b9('0x56')]['id'])});}}else{socket['emit'](_0x86b9('0x87'),{'UserId':Number(_0x4979e3[_0x86b9('0x35')][_0x86b9('0x68')]),'MailQueueId':Number(_0x4979e3['params']['id'])});}});}})[_0x86b9('0x26')](respondWithStatusCode(_0x22f32a,null))[_0x86b9('0x45')](handleError(_0x22f32a,null));};exports[_0x86b9('0x8c')]=function(_0x1d2af0,_0x34b685,_0x364b11){var _0x21b9c2={};var _0x6e7a8={};var _0x1a06db;var _0x49229b;return db[_0x86b9('0x2f')][_0x86b9('0x55')]({'where':{'id':_0x1d2af0[_0x86b9('0x56')]['id']}})[_0x86b9('0x26')](handleEntityNotFound(_0x34b685,null))['then'](function(_0x564e4c){if(_0x564e4c){_0x1a06db=_0x564e4c;_0x6e7a8[_0x86b9('0x33')]=_[_0x86b9('0x36')](db[_0x86b9('0x5a')][_0x86b9('0x30')]);_0x6e7a8[_0x86b9('0x35')]=_[_0x86b9('0x36')](_0x1d2af0[_0x86b9('0x35')]);_0x6e7a8[_0x86b9('0x3e')]=_['intersection'](_0x6e7a8['model'],_0x6e7a8[_0x86b9('0x35')]);_0x21b9c2['attributes']=_[_0x86b9('0x38')](_0x6e7a8['model'],qs['fields'](_0x1d2af0[_0x86b9('0x35')]['fields']));_0x21b9c2['attributes']=_0x21b9c2[_0x86b9('0x37')][_0x86b9('0x64')]?_0x21b9c2[_0x86b9('0x37')]:_0x6e7a8[_0x86b9('0x33')];_0x21b9c2[_0x86b9('0x3b')]=qs[_0x86b9('0x3c')](_0x1d2af0['query'][_0x86b9('0x3c')]);_0x21b9c2[_0x86b9('0x3d')]=qs['filters'](_[_0x86b9('0x58')](_0x1d2af0[_0x86b9('0x35')],_0x6e7a8[_0x86b9('0x3e')]));if(_0x1d2af0[_0x86b9('0x35')][_0x86b9('0x3f')]){_0x21b9c2['where']=_['merge'](_0x21b9c2['where'],{'$or':_['map'](_0x21b9c2[_0x86b9('0x37')],function(_0x45f123){var _0x345b1d={};_0x345b1d[_0x45f123]={'$like':'%'+_0x1d2af0[_0x86b9('0x35')][_0x86b9('0x3f')]+'%'};return _0x345b1d;})});}_0x21b9c2=_[_0x86b9('0x40')]({},_0x21b9c2,_0x1d2af0['options']);return _0x1a06db[_0x86b9('0x8c')](_0x21b9c2);}})[_0x86b9('0x26')](function(_0x3b291c){if(_0x3b291c){_0x49229b=_0x3b291c[_0x86b9('0x64')];if(!_0x1d2af0[_0x86b9('0x35')][_0x86b9('0x66')](_0x86b9('0x3a'))){_0x21b9c2[_0x86b9('0x21')]=qs['limit'](_0x1d2af0[_0x86b9('0x35')][_0x86b9('0x21')]);_0x21b9c2['offset']=qs[_0x86b9('0x1f')](_0x1d2af0[_0x86b9('0x35')][_0x86b9('0x1f')]);}return _0x1a06db['getAgents'](_0x21b9c2);}})['then'](function(_0x42a4a8){if(_0x42a4a8){return _0x42a4a8?{'count':_0x49229b,'rows':_0x42a4a8}:null;}})[_0x86b9('0x26')](respondWithResult(_0x34b685,null))[_0x86b9('0x45')](handleError(_0x34b685,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c8480f5..351e65d 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 _0x8f4e=['save','update','remove','emit','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x26930f,_0x2d582e){var _0x22ec6e=function(_0x128073){while(--_0x128073){_0x26930f['push'](_0x26930f['shift']());}};_0x22ec6e(++_0x2d582e);}(_0x8f4e,0x7a));var _0xe8f4=function(_0x31ce1f,_0x11b2e2){_0x31ce1f=_0x31ce1f-0x0;var _0x1b4fb8=_0x8f4e[_0x31ce1f];return _0x1b4fb8;};'use strict';var EventEmitter=require(_0xe8f4('0x0'));var MailQueue=require(_0xe8f4('0x1'))['db'][_0xe8f4('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe8f4('0x3')](0x0);var events={'afterCreate':_0xe8f4('0x4'),'afterUpdate':_0xe8f4('0x5'),'afterDestroy':_0xe8f4('0x6')};function emitEvent(_0x391472){return function(_0x1e0a99,_0x5d3821,_0x2b39fb){MailQueueEvents[_0xe8f4('0x7')](_0x391472+':'+_0x1e0a99['id'],_0x1e0a99);MailQueueEvents['emit'](_0x391472,_0x1e0a99);_0x2b39fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xe8f4('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x9f3b=['emit','hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners','update','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f3b,0xf3));var _0xb9f3=function(_0x451402,_0x561cb8){_0x451402=_0x451402-0x0;var _0x4ffb7f=_0x9f3b[_0x451402];return _0x4ffb7f;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xb9f3('0x0'))['db'][_0xb9f3('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb9f3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb9f3('0x3'),'afterDestroy':_0xb9f3('0x4')};function emitEvent(_0x5e52bf){return function(_0x2e44dc,_0x2fc20b,_0x4f4933){MailQueueEvents[_0xb9f3('0x5')](_0x5e52bf+':'+_0x2e44dc['id'],_0x2e44dc);MailQueueEvents['emit'](_0x5e52bf,_0x2e44dc);_0x4f4933(null);};}for(var e in events){if(events[_0xb9f3('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xb9f3('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c5a56f8..120e64b 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 _0x7a1d=['bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','../../config/logger','moment'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0x7a1d,0x110));var _0xd7a1=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x7a1d[_0x231dda];return _0x3f88cb;};'use strict';var _=require(_0xd7a1('0x0'));var util=require('util');var logger=require(_0xd7a1('0x1'))('api');var moment=require(_0xd7a1('0x2'));var BPromise=require(_0xd7a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7a1('0x4'));var rimraf=require(_0xd7a1('0x5'));var config=require(_0xd7a1('0x6'));var attributes=require(_0xd7a1('0x7'));module['exports']=function(_0xf44278,_0x215dba){return _0xf44278[_0xd7a1('0x8')](_0xd7a1('0x9'),attributes,{'tableName':_0xd7a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62d7=['path','rimraf','../../config/environment','exports','define','MailQueue','lodash','util','../../config/logger','moment','request-promise'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x62d7,0xb6));var _0x762d=function(_0x2eca3a,_0x3bf7af){_0x2eca3a=_0x2eca3a-0x0;var _0x327ba3=_0x62d7[_0x2eca3a];return _0x327ba3;};'use strict';var _=require(_0x762d('0x0'));var util=require(_0x762d('0x1'));var logger=require(_0x762d('0x2'))('api');var moment=require(_0x762d('0x3'));var BPromise=require('bluebird');var rp=require(_0x762d('0x4'));var fs=require('fs');var path=require(_0x762d('0x5'));var rimraf=require(_0x762d('0x6'));var config=require(_0x762d('0x7'));var attributes=require('./mailQueue.attributes');module[_0x762d('0x8')]=function(_0x2d9055,_0x3fad89){return _0x2d9055[_0x762d('0x9')](_0x762d('0xa'),attributes,{'tableName':'mail_queues','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 a90637a..3d691f4 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 _0xc86f=['redis','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowMailQueue','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults'];(function(_0x468272,_0x3bb538){var _0x56cf74=function(_0x3f76fd){while(--_0x3f76fd){_0x468272['push'](_0x468272['shift']());}};_0x56cf74(++_0x3bb538);}(_0xc86f,0xb3));var _0xfc86=function(_0x58e575,_0x21f2b4){_0x58e575=_0x58e575-0x0;var _0x16b06a=_0xc86f[_0x58e575];return _0x16b06a;};'use strict';var _=require('lodash');var util=require(_0xfc86('0x0'));var moment=require(_0xfc86('0x1'));var BPromise=require(_0xfc86('0x2'));var rs=require(_0xfc86('0x3'));var fs=require('fs');var Redis=require(_0xfc86('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc86('0x5'));var logger=require('../../config/logger')(_0xfc86('0x6'));var config=require('../../config/environment');var jayson=require(_0xfc86('0x7'));var client=jayson[_0xfc86('0x8')][_0xfc86('0x9')]({'port':0x232a});config['redis']=_[_0xfc86('0xa')](config[_0xfc86('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc86('0xc'))(new Redis(config[_0xfc86('0xb')]));require('./mailQueue.socket')[_0xfc86('0xd')](socket);function respondWithRpcPromise(_0x201766,_0x366a52,_0x3e1d92){return new BPromise(function(_0x44f4b1,_0x5711d6){return client[_0xfc86('0xe')](_0x201766,_0x3e1d92)[_0xfc86('0xf')](function(_0x498c8a){logger[_0xfc86('0x10')](_0xfc86('0x11'),_0x366a52,_0xfc86('0x12'));logger[_0xfc86('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x366a52,_0xfc86('0x12'),JSON[_0xfc86('0x14')](_0x498c8a));if(_0x498c8a[_0xfc86('0x15')]){if(_0x498c8a[_0xfc86('0x15')]['code']===0x1f4){logger[_0xfc86('0x15')](_0xfc86('0x11'),_0x366a52,_0x498c8a[_0xfc86('0x15')]['message']);return _0x5711d6(_0x498c8a[_0xfc86('0x15')][_0xfc86('0x16')]);}logger[_0xfc86('0x15')](_0xfc86('0x11'),_0x366a52,_0x498c8a[_0xfc86('0x15')][_0xfc86('0x16')]);return _0x44f4b1(_0x498c8a['error'][_0xfc86('0x16')]);}else{logger[_0xfc86('0x10')](_0xfc86('0x11'),_0x366a52,_0xfc86('0x12'));_0x44f4b1(_0x498c8a[_0xfc86('0x17')][_0xfc86('0x16')]);}})[_0xfc86('0x18')](function(_0x117004){logger[_0xfc86('0x15')](_0xfc86('0x11'),_0x366a52,_0x117004);_0x5711d6(_0x117004);});});}exports[_0xfc86('0x19')]=function(_0x5d378b){var _0x29b27a=this;return new Promise(function(_0x56b33d,_0x598228){return db[_0xfc86('0x1a')][_0xfc86('0x1b')]({'raw':_0x5d378b['options']?_0x5d378b[_0xfc86('0x1c')][_0xfc86('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d378b['options']?_0x5d378b[_0xfc86('0x1c')][_0xfc86('0x1e')]||null:null,'attributes':_0x5d378b[_0xfc86('0x1c')]?_0x5d378b['options']['attributes']||null:null,'limit':_0x5d378b[_0xfc86('0x1c')]?_0x5d378b[_0xfc86('0x1c')][_0xfc86('0x1f')]||null:null,'include':_0x5d378b['options']?_0x5d378b[_0xfc86('0x1c')][_0xfc86('0x20')]?_[_0xfc86('0x21')](_0x5d378b['options'][_0xfc86('0x20')],function(_0xa3322f){return{'model':db[_0xa3322f[_0xfc86('0x22')]],'as':_0xa3322f['as'],'attributes':_0xa3322f[_0xfc86('0x23')],'include':_0xa3322f[_0xfc86('0x20')]?_[_0xfc86('0x21')](_0xa3322f['include'],function(_0x3131a8){return{'model':db[_0x3131a8[_0xfc86('0x22')]],'as':_0x3131a8['as'],'attributes':_0x3131a8[_0xfc86('0x23')],'include':_0x3131a8['include']?_['map'](_0x3131a8[_0xfc86('0x20')],function(_0x5e6183){return{'model':db[_0x5e6183['model']],'as':_0x5e6183['as'],'attributes':_0x5e6183[_0xfc86('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfc86('0xf')](function(_0x200be0){logger[_0xfc86('0x10')](_0xfc86('0x19'),_0x5d378b);logger[_0xfc86('0x13')]('GetMailQueue',_0x5d378b,JSON[_0xfc86('0x14')](_0x200be0));_0x56b33d(_0x200be0);})[_0xfc86('0x18')](function(_0x12b693){logger['error']('GetMailQueue',_0x12b693[_0xfc86('0x16')],_0x5d378b);_0x598228(_0x29b27a[_0xfc86('0x15')](0x1f4,_0x12b693[_0xfc86('0x16')]));});});};exports[_0xfc86('0x24')]=function(_0x170808){var _0x1ec551=this;return new Promise(function(_0x5ad4f4,_0x320f6a){return db[_0xfc86('0x1a')][_0xfc86('0x25')]({'raw':_0x170808[_0xfc86('0x1c')]?_0x170808[_0xfc86('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x170808[_0xfc86('0x1c')]?_0x170808['options'][_0xfc86('0x1e')]||null:null,'attributes':_0x170808[_0xfc86('0x1c')]?_0x170808['options']['attributes']||null:null,'include':_0x170808[_0xfc86('0x1c')]?_0x170808[_0xfc86('0x1c')][_0xfc86('0x20')]?_[_0xfc86('0x21')](_0x170808[_0xfc86('0x1c')][_0xfc86('0x20')],function(_0x389a85){return{'model':db[_0x389a85['model']],'as':_0x389a85['as'],'attributes':_0x389a85['attributes'],'include':_0x389a85['include']?_[_0xfc86('0x21')](_0x389a85['include'],function(_0x47a8ae){return{'model':db[_0x47a8ae[_0xfc86('0x22')]],'as':_0x47a8ae['as'],'attributes':_0x47a8ae[_0xfc86('0x23')],'include':_0x47a8ae[_0xfc86('0x20')]?_['map'](_0x47a8ae[_0xfc86('0x20')],function(_0x4c1bdd){return{'model':db[_0x4c1bdd[_0xfc86('0x22')]],'as':_0x4c1bdd['as'],'attributes':_0x4c1bdd['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc86('0xf')](function(_0x52b0f8){logger[_0xfc86('0x10')](_0xfc86('0x24'),_0x170808);logger[_0xfc86('0x13')](_0xfc86('0x24'),_0x170808,JSON[_0xfc86('0x14')](_0x52b0f8));_0x5ad4f4(_0x52b0f8);})['catch'](function(_0x27d8e9){logger['error']('ShowMailQueue',_0x27d8e9[_0xfc86('0x16')],_0x170808);_0x320f6a(_0x1ec551[_0xfc86('0x15')](0x1f4,_0x27d8e9[_0xfc86('0x16')]));});});}; \ No newline at end of file +var _0xf784=['where','attributes','limit','include','map','model','GetMailQueue','ShowMailQueue','MailQueue','find','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','findAll','options'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xf784,0xb4));var _0x4f78=function(_0x478288,_0xfd1066){_0x478288=_0x478288-0x0;var _0x426cbe=_0xf784[_0x478288];return _0x426cbe;};'use strict';var _=require(_0x4f78('0x0'));var util=require(_0x4f78('0x1'));var moment=require(_0x4f78('0x2'));var BPromise=require(_0x4f78('0x3'));var rs=require(_0x4f78('0x4'));var fs=require('fs');var Redis=require(_0x4f78('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f78('0x6'));var logger=require(_0x4f78('0x7'))(_0x4f78('0x8'));var config=require(_0x4f78('0x9'));var jayson=require(_0x4f78('0xa'));var client=jayson['client'][_0x4f78('0xb')]({'port':0x232a});config[_0x4f78('0xc')]=_['defaults'](config[_0x4f78('0xc')],{'host':_0x4f78('0xd'),'port':0x18eb});var socket=require(_0x4f78('0xe'))(new Redis(config['redis']));require(_0x4f78('0xf'))[_0x4f78('0x10')](socket);function respondWithRpcPromise(_0x4a4e7c,_0xf8d110,_0x5626fe){return new BPromise(function(_0x58e55e,_0x231977){return client[_0x4f78('0x11')](_0x4a4e7c,_0x5626fe)[_0x4f78('0x12')](function(_0x236f98){logger[_0x4f78('0x13')](_0x4f78('0x14'),_0xf8d110,'request\x20sent');logger[_0x4f78('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xf8d110,_0x4f78('0x16'),JSON[_0x4f78('0x17')](_0x236f98));if(_0x236f98[_0x4f78('0x18')]){if(_0x236f98[_0x4f78('0x18')][_0x4f78('0x19')]===0x1f4){logger[_0x4f78('0x18')](_0x4f78('0x14'),_0xf8d110,_0x236f98[_0x4f78('0x18')][_0x4f78('0x1a')]);return _0x231977(_0x236f98['error'][_0x4f78('0x1a')]);}logger['error'](_0x4f78('0x14'),_0xf8d110,_0x236f98[_0x4f78('0x18')][_0x4f78('0x1a')]);return _0x58e55e(_0x236f98['error']['message']);}else{logger[_0x4f78('0x13')](_0x4f78('0x14'),_0xf8d110,'request\x20sent');_0x58e55e(_0x236f98[_0x4f78('0x1b')][_0x4f78('0x1a')]);}})['catch'](function(_0x3fb51c){logger['error'](_0x4f78('0x14'),_0xf8d110,_0x3fb51c);_0x231977(_0x3fb51c);});});}exports['GetMailQueue']=function(_0xa77152){var _0x34bb24=this;return new Promise(function(_0x2d9ef9,_0x2e0f9b){return db['MailQueue'][_0x4f78('0x1c')]({'raw':_0xa77152[_0x4f78('0x1d')]?_0xa77152[_0x4f78('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xa77152[_0x4f78('0x1d')]?_0xa77152[_0x4f78('0x1d')][_0x4f78('0x1e')]||null:null,'attributes':_0xa77152['options']?_0xa77152[_0x4f78('0x1d')][_0x4f78('0x1f')]||null:null,'limit':_0xa77152[_0x4f78('0x1d')]?_0xa77152['options'][_0x4f78('0x20')]||null:null,'include':_0xa77152[_0x4f78('0x1d')]?_0xa77152[_0x4f78('0x1d')][_0x4f78('0x21')]?_[_0x4f78('0x22')](_0xa77152[_0x4f78('0x1d')]['include'],function(_0x90d835){return{'model':db[_0x90d835[_0x4f78('0x23')]],'as':_0x90d835['as'],'attributes':_0x90d835[_0x4f78('0x1f')],'include':_0x90d835[_0x4f78('0x21')]?_[_0x4f78('0x22')](_0x90d835[_0x4f78('0x21')],function(_0x3c6e20){return{'model':db[_0x3c6e20[_0x4f78('0x23')]],'as':_0x3c6e20['as'],'attributes':_0x3c6e20[_0x4f78('0x1f')],'include':_0x3c6e20[_0x4f78('0x21')]?_['map'](_0x3c6e20['include'],function(_0x37e080){return{'model':db[_0x37e080[_0x4f78('0x23')]],'as':_0x37e080['as'],'attributes':_0x37e080[_0x4f78('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cca6e){logger[_0x4f78('0x13')](_0x4f78('0x24'),_0xa77152);logger['debug'](_0x4f78('0x24'),_0xa77152,JSON[_0x4f78('0x17')](_0x5cca6e));_0x2d9ef9(_0x5cca6e);})['catch'](function(_0x3ccf5f){logger['error'](_0x4f78('0x24'),_0x3ccf5f[_0x4f78('0x1a')],_0xa77152);_0x2e0f9b(_0x34bb24[_0x4f78('0x18')](0x1f4,_0x3ccf5f[_0x4f78('0x1a')]));});});};exports[_0x4f78('0x25')]=function(_0x20c80a){var _0x1817b4=this;return new Promise(function(_0x2d4c8b,_0x584fe3){return db[_0x4f78('0x26')][_0x4f78('0x27')]({'raw':_0x20c80a[_0x4f78('0x1d')]?_0x20c80a[_0x4f78('0x1d')][_0x4f78('0x28')]===undefined?!![]:![]:!![],'where':_0x20c80a[_0x4f78('0x1d')]?_0x20c80a[_0x4f78('0x1d')][_0x4f78('0x1e')]||null:null,'attributes':_0x20c80a['options']?_0x20c80a[_0x4f78('0x1d')][_0x4f78('0x1f')]||null:null,'include':_0x20c80a[_0x4f78('0x1d')]?_0x20c80a['options']['include']?_['map'](_0x20c80a[_0x4f78('0x1d')][_0x4f78('0x21')],function(_0x3330cc){return{'model':db[_0x3330cc['model']],'as':_0x3330cc['as'],'attributes':_0x3330cc['attributes'],'include':_0x3330cc[_0x4f78('0x21')]?_[_0x4f78('0x22')](_0x3330cc['include'],function(_0x5e50a8){return{'model':db[_0x5e50a8[_0x4f78('0x23')]],'as':_0x5e50a8['as'],'attributes':_0x5e50a8[_0x4f78('0x1f')],'include':_0x5e50a8['include']?_['map'](_0x5e50a8[_0x4f78('0x21')],function(_0x1759f7){return{'model':db[_0x1759f7[_0x4f78('0x23')]],'as':_0x1759f7['as'],'attributes':_0x1759f7[_0x4f78('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4f78('0x12')](function(_0x5889b4){logger['info']('ShowMailQueue',_0x20c80a);logger[_0x4f78('0x15')](_0x4f78('0x25'),_0x20c80a,JSON[_0x4f78('0x17')](_0x5889b4));_0x2d4c8b(_0x5889b4);})[_0x4f78('0x29')](function(_0x452ae8){logger[_0x4f78('0x18')](_0x4f78('0x25'),_0x452ae8['message'],_0x20c80a);_0x584fe3(_0x1817b4[_0x4f78('0x18')](0x1f4,_0x452ae8[_0x4f78('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d0b725b..6fee42a 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 _0x1cf3=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x9f9a85,_0x51249c){var _0x58f8ef=function(_0x16ef04){while(--_0x16ef04){_0x9f9a85['push'](_0x9f9a85['shift']());}};_0x58f8ef(++_0x51249c);}(_0x1cf3,0x1be));var _0x31cf=function(_0x5c44c9,_0x451208){_0x5c44c9=_0x5c44c9-0x0;var _0x19c3f1=_0x1cf3[_0x5c44c9];return _0x19c3f1;};'use strict';var MailQueueEvents=require(_0x31cf('0x0'));var events=[_0x31cf('0x1'),_0x31cf('0x2'),_0x31cf('0x3')];function createListener(_0x54dff7,_0x20aa57){return function(_0x5a2ae7){_0x20aa57[_0x31cf('0x4')](_0x54dff7,_0x5a2ae7);};}function removeListener(_0x442009,_0x44d64d){return function(){MailQueueEvents[_0x31cf('0x5')](_0x442009,_0x44d64d);};}exports[_0x31cf('0x6')]=function(_0x44dd04){for(var _0x2b7cd4=0x0,_0x1830b4=events[_0x31cf('0x7')];_0x2b7cd4<_0x1830b4;_0x2b7cd4++){var _0x6be80=events[_0x2b7cd4];var _0x3f7b2e=createListener(_0x31cf('0x8')+_0x6be80,_0x44dd04);MailQueueEvents['on'](_0x6be80,_0x3f7b2e);}}; \ No newline at end of file +var _0x83d5=['./mailQueue.events','save','remove','emit','removeListener','register','length','mailQueue:'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x83d5,0xd8));var _0x583d=function(_0x276341,_0x4ff417){_0x276341=_0x276341-0x0;var _0x5f2f4c=_0x83d5[_0x276341];return _0x5f2f4c;};'use strict';var MailQueueEvents=require(_0x583d('0x0'));var events=[_0x583d('0x1'),_0x583d('0x2'),'update'];function createListener(_0x880fed,_0x370876){return function(_0x2c7a3a){_0x370876[_0x583d('0x3')](_0x880fed,_0x2c7a3a);};}function removeListener(_0x54bea4,_0x5573b8){return function(){MailQueueEvents[_0x583d('0x4')](_0x54bea4,_0x5573b8);};}exports[_0x583d('0x5')]=function(_0x4e91af){for(var _0x57a486=0x0,_0x2c1f5f=events[_0x583d('0x6')];_0x57a486<_0x2c1f5f;_0x57a486++){var _0x5de02e=events[_0x57a486];var _0x527da7=createListener(_0x583d('0x7')+_0x5de02e,_0x4e91af);MailQueueEvents['on'](_0x5de02e,_0x527da7);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 94a273b..66c3259 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 _0x7356=['fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x238621,_0x242cc5){var _0x5063a7=function(_0x1824d9){while(--_0x1824d9){_0x238621['push'](_0x238621['shift']());}};_0x5063a7(++_0x242cc5);}(_0x7356,0xe1));var _0x6735=function(_0x2e4667,_0x225766){_0x2e4667=_0x2e4667-0x0;var _0x24c4dc=_0x7356[_0x2e4667];return _0x24c4dc;};'use strict';var multer=require('multer');var util=require(_0x6735('0x0'));var path=require(_0x6735('0x1'));var timeout=require(_0x6735('0x2'));var express=require(_0x6735('0x3'));var router=express[_0x6735('0x4')]();var fs_extra=require(_0x6735('0x5'));var auth=require(_0x6735('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6735('0x7'));var controller=require(_0x6735('0x8'));router[_0x6735('0x9')]('/',auth[_0x6735('0xa')](),controller[_0x6735('0xb')]);router['get'](_0x6735('0xc'),auth['isAuthenticated'](),controller[_0x6735('0xd')]);router[_0x6735('0x9')](_0x6735('0xe'),auth['isAuthenticated'](),controller[_0x6735('0xf')]);router[_0x6735('0x10')]('/',auth[_0x6735('0xa')](),controller[_0x6735('0x11')]);router[_0x6735('0x12')](_0x6735('0xe'),auth['isAuthenticated'](),controller[_0x6735('0x13')]);router[_0x6735('0x14')](_0x6735('0xe'),auth['isAuthenticated'](),controller[_0x6735('0x15')]);module[_0x6735('0x16')]=router; \ No newline at end of file +var _0xf7d1=['fs-extra','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','put','delete','destroy','exports','multer','util','express','Router'];(function(_0x2795dd,_0x157893){var _0x30f875=function(_0x227a1d){while(--_0x227a1d){_0x2795dd['push'](_0x2795dd['shift']());}};_0x30f875(++_0x157893);}(_0xf7d1,0x7c));var _0x1f7d=function(_0x24a291,_0xe03d7a){_0x24a291=_0x24a291-0x0;var _0x435c62=_0xf7d1[_0x24a291];return _0x435c62;};'use strict';var multer=require(_0x1f7d('0x0'));var util=require(_0x1f7d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1f7d('0x2'));var router=express[_0x1f7d('0x3')]();var fs_extra=require(_0x1f7d('0x4'));var auth=require(_0x1f7d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1f7d('0x6'));router[_0x1f7d('0x7')]('/',auth[_0x1f7d('0x8')](),controller['index']);router['get'](_0x1f7d('0x9'),auth[_0x1f7d('0x8')](),controller[_0x1f7d('0xa')]);router['get'](_0x1f7d('0xb'),auth[_0x1f7d('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1f7d('0xc')](_0x1f7d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1f7d('0xd')](_0x1f7d('0xb'),auth[_0x1f7d('0x8')](),controller[_0x1f7d('0xe')]);module[_0x1f7d('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d6c5ea2..ac217dd 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 _0xf66b=['DATE','sequelize','exports','STRING'];(function(_0x4e93d6,_0x4278c3){var _0x50f650=function(_0x34390b){while(--_0x34390b){_0x4e93d6['push'](_0x4e93d6['shift']());}};_0x50f650(++_0x4278c3);}(_0xf66b,0x1c5));var _0xbf66=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xf66b[_0x122096];return _0x3d1966;};'use strict';var moment=require('moment');var Sequelize=require(_0xbf66('0x0'));module[_0xbf66('0x1')]={'uniqueid':{'type':Sequelize[_0xbf66('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbf66('0x3')]},'leaveAt':{'type':Sequelize[_0xbf66('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbf66('0x2')]}}; \ No newline at end of file +var _0x8307=['STRING','DATE','sequelize','exports'];(function(_0x28b379,_0x42d2e2){var _0x539db8=function(_0x33057f){while(--_0x33057f){_0x28b379['push'](_0x28b379['shift']());}};_0x539db8(++_0x42d2e2);}(_0x8307,0xca));var _0x7830=function(_0x17cb62,_0x4504e6){_0x17cb62=_0x17cb62-0x0;var _0x32178f=_0x8307[_0x17cb62];return _0x32178f;};'use strict';var moment=require('moment');var Sequelize=require(_0x7830('0x0'));module[_0x7830('0x1')]={'uniqueid':{'type':Sequelize[_0x7830('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7830('0x2')]},'joinAt':{'type':Sequelize[_0x7830('0x3')]},'leaveAt':{'type':Sequelize[_0x7830('0x3')]},'acceptAt':{'type':Sequelize[_0x7830('0x3')]},'exitAt':{'type':Sequelize[_0x7830('0x3')]},'reason':{'type':Sequelize[_0x7830('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 726ec4d..7f50af3 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 _0x32b6=['sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2d80dc,_0x57d84f){var _0x5c61b1=function(_0xc1f52f){while(--_0xc1f52f){_0x2d80dc['push'](_0x2d80dc['shift']());}};_0x5c61b1(++_0x57d84f);}(_0x32b6,0x1d1));var _0x632b=function(_0x2ea182,_0x2bd7bd){_0x2ea182=_0x2ea182-0x0;var _0x4712de=_0x32b6[_0x2ea182];return _0x4712de;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=typeof _0x40d410[_0x632b('0x1b')]==='undefined'&&typeof _0x40d410['limit']===_0x632b('0x1c');var _0x5afa1e=_0x21cdd3[_0x632b('0x1d')];var _0x3bb27f=_0x4efe39?0x0:_0x40d410[_0x632b('0x1b')];var _0x51c894=_0x4efe39?_0x21cdd3[_0x632b('0x1d')]:_0x40d410[_0x632b('0x1b')]+_0x40d410[_0x632b('0x1e')];var _0x3683e4;if(_0x51c894>=_0x5afa1e){_0x51c894=_0x5afa1e;_0x3683e4=0xc8;}else{_0x3683e4=0xce;}_0x17ff9b['status'](_0x3683e4);return _0x17ff9b[_0x632b('0x1f')](_0x632b('0x20'),_0x3bb27f+'-'+_0x51c894+'/'+_0x5afa1e)['json'](_0x21cdd3);}return null;};}function patchUpdates(_0x116f62){return function(_0x50b930){try{jsonpatch['apply'](_0x50b930,_0x116f62,!![]);}catch(_0x1b1092){return BPromise['reject'](_0x1b1092);}return _0x50b930[_0x632b('0x21')]();};}function saveUpdates(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x22')](_0x1c4530)[_0x632b('0x23')](function(_0x59d83a){return _0x59d83a;});}return null;};}function removeEntity(_0x1db8f5,_0x379dc2){return function(_0x30ffb9){if(_0x30ffb9){return _0x30ffb9[_0x632b('0x24')]()[_0x632b('0x23')](function(){_0x1db8f5[_0x632b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b20,_0x11fe61){return function(_0x4d3a70){if(!_0x4d3a70){_0x5e7b20[_0x632b('0x25')](0x194);}return _0x4d3a70;};}function handleError(_0x954fa0,_0x5d6855){_0x5d6855=_0x5d6855||0x1f4;return function(_0x273e89){logger[_0x632b('0x26')](_0x273e89[_0x632b('0x27')]);if(_0x273e89[_0x632b('0x28')]){delete _0x273e89[_0x632b('0x28')];}_0x954fa0[_0x632b('0x18')](_0x5d6855)[_0x632b('0x29')](_0x273e89);};}exports[_0x632b('0x2a')]=function(_0x33a625,_0x4f8410){var _0x1bb484={},_0x35348e={},_0x1819fa={'count':0x0,'rows':[]};var _0x3999aa=_[_0x632b('0x2b')](db[_0x632b('0x2c')][_0x632b('0x2d')],function(_0x417d62){return{'name':_0x417d62[_0x632b('0x2e')],'type':_0x417d62[_0x632b('0x2f')][_0x632b('0x30')]};});_0x35348e[_0x632b('0x31')]=_[_0x632b('0x2b')](_0x3999aa,_0x632b('0x28'));_0x35348e[_0x632b('0x32')]=_[_0x632b('0x33')](_0x33a625[_0x632b('0x32')]);_0x35348e[_0x632b('0x34')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],_0x35348e['query']);_0x1bb484[_0x632b('0x36')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],qs[_0x632b('0x37')](_0x33a625['query'][_0x632b('0x37')]));_0x1bb484['attributes']=_0x1bb484[_0x632b('0x36')][_0x632b('0x38')]?_0x1bb484['attributes']:_0x35348e[_0x632b('0x31')];if(!_0x33a625[_0x632b('0x32')][_0x632b('0x39')](_0x632b('0x3a'))){_0x1bb484[_0x632b('0x1e')]=qs[_0x632b('0x1e')](_0x33a625[_0x632b('0x32')][_0x632b('0x1e')]);_0x1bb484['offset']=qs['offset'](_0x33a625[_0x632b('0x32')][_0x632b('0x1b')]);}_0x1bb484[_0x632b('0x3b')]=qs[_0x632b('0x3c')](_0x33a625[_0x632b('0x32')][_0x632b('0x3c')]);_0x1bb484[_0x632b('0x3d')]=qs[_0x632b('0x34')](_['pick'](_0x33a625['query'],_0x35348e[_0x632b('0x34')]),_0x3999aa);if(_0x33a625['query'][_0x632b('0x3e')]){_0x1bb484[_0x632b('0x3d')]=_[_0x632b('0x3f')](_0x1bb484[_0x632b('0x3d')],{'$or':_[_0x632b('0x2b')](_0x3999aa,function(_0x38266c){if(_0x38266c[_0x632b('0x2f')]!==_0x632b('0x40')){var _0x2730c2={};_0x2730c2[_0x38266c[_0x632b('0x28')]]={'$like':'%'+_0x33a625[_0x632b('0x32')][_0x632b('0x3e')]+'%'};return _0x2730c2;}})});}_0x1bb484=_[_0x632b('0x3f')]({},_0x1bb484,_0x33a625[_0x632b('0x41')]);var _0x13beaa={'where':_0x1bb484[_0x632b('0x3d')]};return db[_0x632b('0x2c')]['count'](_0x13beaa)['then'](function(_0x58e3cc){_0x1819fa['count']=_0x58e3cc;if(_0x33a625['query'][_0x632b('0x42')]){_0x1bb484['include']=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x1bb484);})[_0x632b('0x23')](function(_0x4490d4){_0x1819fa[_0x632b('0x43')]=_0x4490d4;return _0x1819fa;})[_0x632b('0x23')](respondWithFilteredResult(_0x4f8410,_0x1bb484))['catch'](handleError(_0x4f8410,null));};exports[_0x632b('0x44')]=function(_0x238297,_0x387fce){var _0x4dbe4b={'raw':!![],'where':{'id':_0x238297[_0x632b('0x45')]['id']}},_0x15bb30={};_0x15bb30[_0x632b('0x31')]=_[_0x632b('0x33')](db[_0x632b('0x2c')][_0x632b('0x2d')]);_0x15bb30['query']=_[_0x632b('0x33')](_0x238297[_0x632b('0x32')]);_0x15bb30[_0x632b('0x34')]=_[_0x632b('0x35')](_0x15bb30['model'],_0x15bb30['query']);_0x4dbe4b[_0x632b('0x36')]=_[_0x632b('0x35')](_0x15bb30[_0x632b('0x31')],qs[_0x632b('0x37')](_0x238297[_0x632b('0x32')][_0x632b('0x37')]));_0x4dbe4b['attributes']=_0x4dbe4b[_0x632b('0x36')][_0x632b('0x38')]?_0x4dbe4b[_0x632b('0x36')]:_0x15bb30[_0x632b('0x31')];if(_0x238297[_0x632b('0x32')][_0x632b('0x42')]){_0x4dbe4b[_0x632b('0x46')]=[{'all':!![]}];}_0x4dbe4b=_[_0x632b('0x3f')]({},_0x4dbe4b,_0x238297['options']);return db[_0x632b('0x2c')]['find'](_0x4dbe4b)[_0x632b('0x23')](handleEntityNotFound(_0x387fce,null))['then'](respondWithResult(_0x387fce,null))[_0x632b('0x47')](handleError(_0x387fce,null));};exports[_0x632b('0x48')]=function(_0x16dfc7,_0x2c4561){return db[_0x632b('0x2c')]['create'](_0x16dfc7[_0x632b('0x49')],{})[_0x632b('0x23')](respondWithResult(_0x2c4561,0xc9))[_0x632b('0x47')](handleError(_0x2c4561,null));};exports['update']=function(_0x253aec,_0x16eb80){if(_0x253aec[_0x632b('0x49')]['id']){delete _0x253aec[_0x632b('0x49')]['id'];}return db[_0x632b('0x2c')]['find']({'where':{'id':_0x253aec[_0x632b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x23')](saveUpdates(_0x253aec[_0x632b('0x49')],null))[_0x632b('0x23')](respondWithResult(_0x16eb80,null))[_0x632b('0x47')](handleError(_0x16eb80,null));};exports[_0x632b('0x24')]=function(_0x52785a,_0x4c9b4e){return db[_0x632b('0x2c')][_0x632b('0x4a')]({'where':{'id':_0x52785a[_0x632b('0x45')]['id']}})[_0x632b('0x23')](handleEntityNotFound(_0x4c9b4e,null))[_0x632b('0x23')](removeEntity(_0x4c9b4e,null))[_0x632b('0x47')](handleError(_0x4c9b4e,null));};exports['describe']=function(_0xda006b,_0x1d35b2){return db[_0x632b('0x2c')]['describe']()[_0x632b('0x23')](respondWithResult(_0x1d35b2,null))[_0x632b('0x47')](handleError(_0x1d35b2,null));}; \ No newline at end of file +var _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['MailQueueReport'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f3158c4..9b75bc4 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 _0x91ff=['request-promise','path','rimraf','./mailQueueReport.attributes','MailQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x27af2a,_0x260d41){var _0x5161a2=function(_0x29ddb0){while(--_0x29ddb0){_0x27af2a['push'](_0x27af2a['shift']());}};_0x5161a2(++_0x260d41);}(_0x91ff,0x165));var _0xf91f=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x91ff[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xf91f('0x0'));var util=require(_0xf91f('0x1'));var logger=require(_0xf91f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf91f('0x3'));var fs=require('fs');var path=require(_0xf91f('0x4'));var rimraf=require(_0xf91f('0x5'));var config=require('../../config/environment');var attributes=require(_0xf91f('0x6'));module['exports']=function(_0x5cf267,_0x1fb63e){return _0x5cf267['define'](_0xf91f('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xf91f('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x12ef=['define','report_mail_queue','uniqueid','lodash','util','request-promise','path','rimraf','./mailQueueReport.attributes','exports'];(function(_0x20710f,_0x1bba0e){var _0x45d8da=function(_0x3344d4){while(--_0x3344d4){_0x20710f['push'](_0x20710f['shift']());}};_0x45d8da(++_0x1bba0e);}(_0x12ef,0x19d));var _0xf12e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x12ef[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xf12e('0x0'));var util=require(_0xf12e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf12e('0x2'));var fs=require('fs');var path=require(_0xf12e('0x3'));var rimraf=require(_0xf12e('0x4'));var config=require('../../config/environment');var attributes=require(_0xf12e('0x5'));module[_0xf12e('0x6')]=function(_0x4ff3b7,_0x55ee88){return _0x4ff3b7[_0xf12e('0x7')]('MailQueueReport',attributes,{'tableName':_0xf12e('0x8'),'paranoid':![],'indexes':[{'name':_0xf12e('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 11f19e0..550804d 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x51bfec,_0xed07bd){var _0x3ad465=function(_0x594f4e){while(--_0x594f4e){_0x51bfec['push'](_0x51bfec['shift']());}};_0x3ad465(++_0xed07bd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x26ff86,_0x41d7d4){var _0x5dd4b8=function(_0x2d990b){while(--_0x2d990b){_0x26ff86['push'](_0x26ff86['shift']());}};_0x5dd4b8(++_0x41d7d4);}(_0x1261,0x144));var _0x1126=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x1261[_0x53c4f8];return _0x416458;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d284381..7338f68 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x14dc8a,_0x4fe14d){var _0xc2be12=function(_0x3201d7){while(--_0x3201d7){_0x14dc8a['push'](_0x14dc8a['shift']());}};_0xc2be12(++_0x4fe14d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x415596,_0x494bf8){var _0x4192fa=function(_0x16b01c){while(--_0x16b01c){_0x415596['push'](_0x415596['shift']());}};_0x4192fa(++_0x494bf8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 73feca5..ba2ffb9 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 _0x0db9=['STRING','INTEGER','INBOX','sequelize','BOOLEAN'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x0db9,0xa3));var _0x90db=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x0db9[_0x1abeb2];return _0x48da20;};'use strict';var Sequelize=require(_0x90db('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x90db('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x90db('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x90db('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x90db('0x2')],'defaultValue':_0x90db('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x90db('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x90db('0x2')]}}; \ No newline at end of file +var _0xdc9b=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x44fb02,_0x16bdbc){var _0x4d3aaa=function(_0xa5ccfd){while(--_0xa5ccfd){_0x44fb02['push'](_0x44fb02['shift']());}};_0x4d3aaa(++_0x16bdbc);}(_0xdc9b,0x70));var _0xbdc9=function(_0x292be9,_0x38947e){_0x292be9=_0x292be9-0x0;var _0x3bbb61=_0xdc9b[_0x292be9];return _0x3bbb61;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'description':{'type':Sequelize[_0xbdc9('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbdc9('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xbdc9('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xbdc9('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xbdc9('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 98f499e..2b707a6 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 _0x3a32=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd0825d,_0x3d707b){var _0x300b58=function(_0x211ce3){while(--_0x211ce3){_0xd0825d['push'](_0xd0825d['shift']());}};_0x300b58(++_0x3d707b);}(_0x3a32,0x90));var _0x23a3=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x3a32[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var logger=require(_0x23a3('0x2'))(_0x23a3('0x3'));var moment=require(_0x23a3('0x4'));var BPromise=require(_0x23a3('0x5'));var rp=require(_0x23a3('0x6'));var fs=require('fs');var path=require(_0x23a3('0x7'));var rimraf=require(_0x23a3('0x8'));var config=require(_0x23a3('0x9'));var attributes=require(_0x23a3('0xa'));module[_0x23a3('0xb')]=function(_0x35a389,_0x3d3a9b){return _0x35a389[_0x23a3('0xc')](_0x23a3('0xd'),attributes,{'tableName':_0x23a3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x129e=['request-promise','rimraf','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','util','api','moment','bluebird'];(function(_0x4dc875,_0xed40c){var _0x809a63=function(_0x367762){while(--_0x367762){_0x4dc875['push'](_0x4dc875['shift']());}};_0x809a63(++_0xed40c);}(_0x129e,0x1c8));var _0xe129=function(_0x114f9a,_0x23540b){_0x114f9a=_0x114f9a-0x0;var _0x1bfee4=_0x129e[_0x114f9a];return _0x1bfee4;};'use strict';var _=require('lodash');var util=require(_0xe129('0x0'));var logger=require('../../config/logger')(_0xe129('0x1'));var moment=require(_0xe129('0x2'));var BPromise=require(_0xe129('0x3'));var rp=require(_0xe129('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe129('0x5'));var config=require('../../config/environment');var attributes=require(_0xe129('0x6'));module['exports']=function(_0x2f3460,_0xbba0ae){return _0x2f3460[_0xe129('0x7')](_0xe129('0x8'),attributes,{'tableName':_0xe129('0x9'),'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 c27e307..4e72420 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 _0x9c53=['map','model','include','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit'];(function(_0x495387,_0x42ee5c){var _0x35e169=function(_0x22156c){while(--_0x22156c){_0x495387['push'](_0x495387['shift']());}};_0x35e169(++_0x42ee5c);}(_0x9c53,0x1f4));var _0x39c5=function(_0x53d700,_0x6f7291){_0x53d700=_0x53d700-0x0;var _0x95d0b0=_0x9c53[_0x53d700];return _0x95d0b0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39c5('0x0'));var BPromise=require('bluebird');var rs=require(_0x39c5('0x1'));var fs=require('fs');var Redis=require(_0x39c5('0x2'));var db=require(_0x39c5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x39c5('0x4'))(_0x39c5('0x5'));var config=require(_0x39c5('0x6'));var jayson=require(_0x39c5('0x7'));var client=jayson[_0x39c5('0x8')][_0x39c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45a23f,_0x95728e,_0x24205b){return new BPromise(function(_0x51b1fa,_0x474158){return client['request'](_0x45a23f,_0x24205b)[_0x39c5('0xa')](function(_0x126323){logger['info'](_0x39c5('0xb'),_0x95728e,'request\x20sent');logger[_0x39c5('0xc')](_0x39c5('0xd'),_0x95728e,_0x39c5('0xe'),JSON['stringify'](_0x126323));if(_0x126323[_0x39c5('0xf')]){if(_0x126323[_0x39c5('0xf')][_0x39c5('0x10')]===0x1f4){logger[_0x39c5('0xf')]('MailServerIn,\x20%s,\x20%s',_0x95728e,_0x126323[_0x39c5('0xf')][_0x39c5('0x11')]);return _0x474158(_0x126323[_0x39c5('0xf')][_0x39c5('0x11')]);}logger[_0x39c5('0xf')](_0x39c5('0xb'),_0x95728e,_0x126323[_0x39c5('0xf')]['message']);return _0x51b1fa(_0x126323[_0x39c5('0xf')][_0x39c5('0x11')]);}else{logger[_0x39c5('0x12')](_0x39c5('0xb'),_0x95728e,_0x39c5('0xe'));_0x51b1fa(_0x126323[_0x39c5('0x13')][_0x39c5('0x11')]);}})[_0x39c5('0x14')](function(_0x5b73e5){logger['error']('MailServerIn,\x20%s,\x20%s',_0x95728e,_0x5b73e5);_0x474158(_0x5b73e5);});});}exports[_0x39c5('0x15')]=function(_0xc360c4){var _0x5c8950=this;return new Promise(function(_0x533a54,_0x336972){return db[_0x39c5('0x16')][_0x39c5('0x17')]({'raw':_0xc360c4['options']?_0xc360c4[_0x39c5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xc360c4[_0x39c5('0x18')]?_0xc360c4['options']['where']||null:null,'attributes':_0xc360c4[_0x39c5('0x18')]?_0xc360c4[_0x39c5('0x18')][_0x39c5('0x19')]||null:null,'limit':_0xc360c4[_0x39c5('0x18')]?_0xc360c4[_0x39c5('0x18')][_0x39c5('0x1a')]||null:null,'include':_0xc360c4[_0x39c5('0x18')]?_0xc360c4[_0x39c5('0x18')]['include']?_[_0x39c5('0x1b')](_0xc360c4[_0x39c5('0x18')]['include'],function(_0x276b56){return{'model':db[_0x276b56[_0x39c5('0x1c')]],'as':_0x276b56['as'],'attributes':_0x276b56[_0x39c5('0x19')],'include':_0x276b56[_0x39c5('0x1d')]?_[_0x39c5('0x1b')](_0x276b56[_0x39c5('0x1d')],function(_0x5d25c9){return{'model':db[_0x5d25c9[_0x39c5('0x1c')]],'as':_0x5d25c9['as'],'attributes':_0x5d25c9['attributes'],'include':_0x5d25c9[_0x39c5('0x1d')]?_['map'](_0x5d25c9['include'],function(_0x493100){return{'model':db[_0x493100[_0x39c5('0x1c')]],'as':_0x493100['as'],'attributes':_0x493100[_0x39c5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2156f1){logger[_0x39c5('0x12')](_0x39c5('0x15'),_0xc360c4);logger[_0x39c5('0xc')](_0x39c5('0x15'),_0xc360c4,JSON[_0x39c5('0x1e')](_0x2156f1));_0x533a54(_0x2156f1);})[_0x39c5('0x14')](function(_0x4b0b38){logger['error'](_0x39c5('0x15'),_0x4b0b38['message'],_0xc360c4);_0x336972(_0x5c8950[_0x39c5('0xf')](0x1f4,_0x4b0b38[_0x39c5('0x11')]));});});}; \ No newline at end of file +var _0x2e35=['model','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include'];(function(_0x2c8739,_0x5695c5){var _0xd17fc7=function(_0xb6aa87){while(--_0xb6aa87){_0x2c8739['push'](_0x2c8739['shift']());}};_0xd17fc7(++_0x5695c5);}(_0x2e35,0x1d0));var _0x52e3=function(_0x54aaa5,_0x1cfb52){_0x54aaa5=_0x54aaa5-0x0;var _0x4e8ce2=_0x2e35[_0x54aaa5];return _0x4e8ce2;};'use strict';var _=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var moment=require(_0x52e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x52e3('0x3'));var fs=require('fs');var Redis=require(_0x52e3('0x4'));var db=require(_0x52e3('0x5'))['db'];var utils=require(_0x52e3('0x6'));var logger=require('../../config/logger')(_0x52e3('0x7'));var config=require(_0x52e3('0x8'));var jayson=require(_0x52e3('0x9'));var client=jayson[_0x52e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x483b93,_0x507a6c,_0x21ae13){return new BPromise(function(_0x4d77a0,_0x4b2662){return client[_0x52e3('0xb')](_0x483b93,_0x21ae13)[_0x52e3('0xc')](function(_0x551848){logger[_0x52e3('0xd')](_0x52e3('0xe'),_0x507a6c,'request\x20sent');logger[_0x52e3('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x507a6c,_0x52e3('0x10'),JSON[_0x52e3('0x11')](_0x551848));if(_0x551848[_0x52e3('0x12')]){if(_0x551848['error'][_0x52e3('0x13')]===0x1f4){logger[_0x52e3('0x12')]('MailServerIn,\x20%s,\x20%s',_0x507a6c,_0x551848[_0x52e3('0x12')]['message']);return _0x4b2662(_0x551848['error']['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x507a6c,_0x551848[_0x52e3('0x12')][_0x52e3('0x14')]);return _0x4d77a0(_0x551848[_0x52e3('0x12')][_0x52e3('0x14')]);}else{logger[_0x52e3('0xd')](_0x52e3('0xe'),_0x507a6c,_0x52e3('0x10'));_0x4d77a0(_0x551848[_0x52e3('0x15')][_0x52e3('0x14')]);}})[_0x52e3('0x16')](function(_0x3355e7){logger['error'](_0x52e3('0xe'),_0x507a6c,_0x3355e7);_0x4b2662(_0x3355e7);});});}exports[_0x52e3('0x17')]=function(_0x5d55e7){var _0x3088a2=this;return new Promise(function(_0x2e82e2,_0x1ed787){return db[_0x52e3('0x18')][_0x52e3('0x19')]({'raw':_0x5d55e7[_0x52e3('0x1a')]?_0x5d55e7[_0x52e3('0x1a')][_0x52e3('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d55e7[_0x52e3('0x1a')]?_0x5d55e7[_0x52e3('0x1a')][_0x52e3('0x1c')]||null:null,'attributes':_0x5d55e7[_0x52e3('0x1a')]?_0x5d55e7[_0x52e3('0x1a')][_0x52e3('0x1d')]||null:null,'limit':_0x5d55e7[_0x52e3('0x1a')]?_0x5d55e7['options']['limit']||null:null,'include':_0x5d55e7['options']?_0x5d55e7[_0x52e3('0x1a')]['include']?_['map'](_0x5d55e7['options'][_0x52e3('0x1e')],function(_0x54f571){return{'model':db[_0x54f571[_0x52e3('0x1f')]],'as':_0x54f571['as'],'attributes':_0x54f571['attributes'],'include':_0x54f571[_0x52e3('0x1e')]?_[_0x52e3('0x20')](_0x54f571['include'],function(_0x3eefb3){return{'model':db[_0x3eefb3[_0x52e3('0x1f')]],'as':_0x3eefb3['as'],'attributes':_0x3eefb3[_0x52e3('0x1d')],'include':_0x3eefb3[_0x52e3('0x1e')]?_['map'](_0x3eefb3['include'],function(_0x5ded78){return{'model':db[_0x5ded78[_0x52e3('0x1f')]],'as':_0x5ded78['as'],'attributes':_0x5ded78[_0x52e3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x52e3('0xc')](function(_0x701259){logger[_0x52e3('0xd')]('GetMailServerIn',_0x5d55e7);logger[_0x52e3('0xf')]('GetMailServerIn',_0x5d55e7,JSON[_0x52e3('0x11')](_0x701259));_0x2e82e2(_0x701259);})[_0x52e3('0x16')](function(_0x2ceaa4){logger[_0x52e3('0x12')]('GetMailServerIn',_0x2ceaa4[_0x52e3('0x14')],_0x5d55e7);_0x1ed787(_0x3088a2[_0x52e3('0x12')](0x1f4,_0x2ceaa4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a3f6708..dd0cd23 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(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x149b45,_0x2c7e44){_0x149b45=_0x149b45-0x0;var _0x2eddc6=_0x7a54[_0x149b45];return _0x2eddc6;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9cb7817..3bbd9ad 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 _0xde25=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x2c8df0,_0x32e64b){var _0x5753b1=function(_0x279686){while(--_0x279686){_0x2c8df0['push'](_0x2c8df0['shift']());}};_0x5753b1(++_0x32e64b);}(_0xde25,0x104));var _0x5de2=function(_0x8b3abb,_0xbf49e4){_0x8b3abb=_0x8b3abb-0x0;var _0x85d906=_0xde25[_0x8b3abb];return _0x85d906;};'use strict';var Sequelize=require(_0x5de2('0x0'));module['exports']={'description':{'type':Sequelize[_0x5de2('0x1')]},'host':{'type':Sequelize[_0x5de2('0x1')]},'user':{'type':Sequelize[_0x5de2('0x1')]},'pass':{'type':Sequelize[_0x5de2('0x1')]},'port':{'type':Sequelize[_0x5de2('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x5de2('0x1')]},'authentication':{'type':Sequelize[_0x5de2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcad5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5773e7,_0x435e69){var _0x5e6621=function(_0x112829){while(--_0x112829){_0x5773e7['push'](_0x5773e7['shift']());}};_0x5e6621(++_0x435e69);}(_0xcad5,0x1cf));var _0x5cad=function(_0xbdfc0c,_0x3af36f){_0xbdfc0c=_0xbdfc0c-0x0;var _0x3ed3fe=_0xcad5[_0xbdfc0c];return _0x3ed3fe;};'use strict';var Sequelize=require(_0x5cad('0x0'));module[_0x5cad('0x1')]={'description':{'type':Sequelize[_0x5cad('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x5cad('0x2')]},'pass':{'type':Sequelize[_0x5cad('0x2')]},'port':{'type':Sequelize[_0x5cad('0x3')]},'secure':{'type':Sequelize[_0x5cad('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'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 fa25003..4849618 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 _0xab0a=['update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','reject','then','destroy','end','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','options','find','create','body'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0xab0a,0x1b7));var _0xaab0=function(_0x25755d,_0x752d39){_0x25755d=_0x25755d-0x0;var _0x2c6660=_0xab0a[_0x25755d];return _0x2c6660;};'use strict';var emlformat=require(_0xaab0('0x0'));var rimraf=require(_0xaab0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaab0('0x2'));var rp=require(_0xaab0('0x3'));var moment=require(_0xaab0('0x4'));var BPromise=require(_0xaab0('0x5'));var Mustache=require(_0xaab0('0x6'));var util=require('util');var path=require(_0xaab0('0x7'));var sox=require(_0xaab0('0x8'));var csv=require(_0xaab0('0x9'));var ejs=require(_0xaab0('0xa'));var fs=require('fs');var fs_extra=require(_0xaab0('0xb'));var _=require(_0xaab0('0xc'));var squel=require(_0xaab0('0xd'));var crypto=require(_0xaab0('0xe'));var jsforce=require(_0xaab0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaab0('0x9'));var querystring=require(_0xaab0('0x10'));var Papa=require(_0xaab0('0x11'));var Redis=require('ioredis');var authService=require(_0xaab0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaab0('0x13'));var hardwareService=require(_0xaab0('0x14'));var logger=require(_0xaab0('0x15'))(_0xaab0('0x16'));var utils=require(_0xaab0('0x17'));var config=require(_0xaab0('0x18'));var licenseUtil=require(_0xaab0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x535af2,_0x40ec93){_0x40ec93=_0x40ec93||0xcc;return function(_0x1f256c){if(_0x1f256c){return _0x535af2['sendStatus'](_0x40ec93);}return _0x535af2[_0xaab0('0x1a')](_0x40ec93)['end']();};}function respondWithResult(_0xffc434,_0x26a713){_0x26a713=_0x26a713||0xc8;return function(_0x3d429c){if(_0x3d429c){return _0xffc434[_0xaab0('0x1a')](_0x26a713)[_0xaab0('0x1b')](_0x3d429c);}};}function respondWithFilteredResult(_0x9674ea,_0x198c20){return function(_0x309116){if(_0x309116){var _0x20d462=typeof _0x198c20['offset']==='undefined'&&typeof _0x198c20['limit']==='undefined';var _0x4c4926=_0x309116[_0xaab0('0x1c')];var _0x37314f=_0x20d462?0x0:_0x198c20[_0xaab0('0x1d')];var _0x1f0ae6=_0x20d462?_0x309116[_0xaab0('0x1c')]:_0x198c20['offset']+_0x198c20[_0xaab0('0x1e')];var _0x5ac68a;if(_0x1f0ae6>=_0x4c4926){_0x1f0ae6=_0x4c4926;_0x5ac68a=0xc8;}else{_0x5ac68a=0xce;}_0x9674ea[_0xaab0('0x1a')](_0x5ac68a);return _0x9674ea[_0xaab0('0x1f')](_0xaab0('0x20'),_0x37314f+'-'+_0x1f0ae6+'/'+_0x4c4926)['json'](_0x309116);}return null;};}function patchUpdates(_0x2fc3d1){return function(_0xc77fba){try{jsonpatch['apply'](_0xc77fba,_0x2fc3d1,!![]);}catch(_0x5e5f81){return BPromise[_0xaab0('0x21')](_0x5e5f81);}return _0xc77fba['save']();};}function saveUpdates(_0x4557c6,_0x421b93){return function(_0x51bc8a){if(_0x51bc8a){return _0x51bc8a['update'](_0x4557c6)[_0xaab0('0x22')](function(_0x109d30){return _0x109d30;});}return null;};}function removeEntity(_0x369b5a,_0x3def14){return function(_0x5530ef){if(_0x5530ef){return _0x5530ef[_0xaab0('0x23')]()[_0xaab0('0x22')](function(){_0x369b5a[_0xaab0('0x1a')](0xcc)[_0xaab0('0x24')]();});}};}function handleEntityNotFound(_0x3fd953,_0x184d39){return function(_0x1137cd){if(!_0x1137cd){_0x3fd953['sendStatus'](0x194);}return _0x1137cd;};}function handleError(_0x10c5db,_0xe56df0){_0xe56df0=_0xe56df0||0x1f4;return function(_0x230834){logger['error'](_0x230834[_0xaab0('0x25')]);if(_0x230834[_0xaab0('0x26')]){delete _0x230834[_0xaab0('0x26')];}_0x10c5db[_0xaab0('0x1a')](_0xe56df0)[_0xaab0('0x27')](_0x230834);};}exports[_0xaab0('0x28')]=function(_0x223900,_0x3e9123){var _0x28df3f={},_0x5d00db={},_0x5ec4f2={'count':0x0,'rows':[]};var _0x174b70=_[_0xaab0('0x29')](db[_0xaab0('0x2a')]['rawAttributes'],function(_0x29cb2b){return{'name':_0x29cb2b[_0xaab0('0x2b')],'type':_0x29cb2b[_0xaab0('0x2c')][_0xaab0('0x2d')]};});_0x5d00db[_0xaab0('0x2e')]=_[_0xaab0('0x29')](_0x174b70,_0xaab0('0x26'));_0x5d00db[_0xaab0('0x2f')]=_['keys'](_0x223900['query']);_0x5d00db[_0xaab0('0x30')]=_[_0xaab0('0x31')](_0x5d00db['model'],_0x5d00db[_0xaab0('0x2f')]);_0x28df3f[_0xaab0('0x32')]=_[_0xaab0('0x31')](_0x5d00db[_0xaab0('0x2e')],qs[_0xaab0('0x33')](_0x223900[_0xaab0('0x2f')][_0xaab0('0x33')]));_0x28df3f[_0xaab0('0x32')]=_0x28df3f[_0xaab0('0x32')][_0xaab0('0x34')]?_0x28df3f[_0xaab0('0x32')]:_0x5d00db[_0xaab0('0x2e')];if(!_0x223900['query'][_0xaab0('0x35')](_0xaab0('0x36'))){_0x28df3f['limit']=qs[_0xaab0('0x1e')](_0x223900[_0xaab0('0x2f')][_0xaab0('0x1e')]);_0x28df3f[_0xaab0('0x1d')]=qs[_0xaab0('0x1d')](_0x223900[_0xaab0('0x2f')]['offset']);}_0x28df3f[_0xaab0('0x37')]=qs[_0xaab0('0x38')](_0x223900['query'][_0xaab0('0x38')]);_0x28df3f[_0xaab0('0x39')]=qs[_0xaab0('0x30')](_[_0xaab0('0x3a')](_0x223900[_0xaab0('0x2f')],_0x5d00db[_0xaab0('0x30')]),_0x174b70);if(_0x223900[_0xaab0('0x2f')][_0xaab0('0x3b')]){_0x28df3f[_0xaab0('0x39')]=_[_0xaab0('0x3c')](_0x28df3f['where'],{'$or':_[_0xaab0('0x29')](_0x174b70,function(_0x4bdb54){if(_0x4bdb54['type']!==_0xaab0('0x3d')){var _0x54c5bf={};_0x54c5bf[_0x4bdb54[_0xaab0('0x26')]]={'$like':'%'+_0x223900['query'][_0xaab0('0x3b')]+'%'};return _0x54c5bf;}})});}_0x28df3f=_['merge']({},_0x28df3f,_0x223900['options']);var _0x2fbb56={'where':_0x28df3f[_0xaab0('0x39')]};return db['MailServerOut']['count'](_0x2fbb56)[_0xaab0('0x22')](function(_0x438025){_0x5ec4f2[_0xaab0('0x1c')]=_0x438025;if(_0x223900[_0xaab0('0x2f')]['includeAll']){_0x28df3f[_0xaab0('0x3e')]=[{'all':!![]}];}return db[_0xaab0('0x2a')][_0xaab0('0x3f')](_0x28df3f);})[_0xaab0('0x22')](function(_0x14b6b9){_0x5ec4f2[_0xaab0('0x40')]=_0x14b6b9;return _0x5ec4f2;})[_0xaab0('0x22')](respondWithFilteredResult(_0x3e9123,_0x28df3f))[_0xaab0('0x41')](handleError(_0x3e9123,null));};exports['show']=function(_0x22a9bc,_0x3839a1){var _0x1d3f4a={'raw':!![],'where':{'id':_0x22a9bc[_0xaab0('0x42')]['id']}},_0x238b9e={};_0x238b9e[_0xaab0('0x2e')]=_[_0xaab0('0x43')](db[_0xaab0('0x2a')]['rawAttributes']);_0x238b9e[_0xaab0('0x2f')]=_[_0xaab0('0x43')](_0x22a9bc[_0xaab0('0x2f')]);_0x238b9e[_0xaab0('0x30')]=_[_0xaab0('0x31')](_0x238b9e[_0xaab0('0x2e')],_0x238b9e[_0xaab0('0x2f')]);_0x1d3f4a[_0xaab0('0x32')]=_[_0xaab0('0x31')](_0x238b9e['model'],qs['fields'](_0x22a9bc['query'][_0xaab0('0x33')]));_0x1d3f4a['attributes']=_0x1d3f4a[_0xaab0('0x32')]['length']?_0x1d3f4a[_0xaab0('0x32')]:_0x238b9e[_0xaab0('0x2e')];if(_0x22a9bc[_0xaab0('0x2f')]['includeAll']){_0x1d3f4a[_0xaab0('0x3e')]=[{'all':!![]}];}_0x1d3f4a=_['merge']({},_0x1d3f4a,_0x22a9bc[_0xaab0('0x44')]);return db[_0xaab0('0x2a')][_0xaab0('0x45')](_0x1d3f4a)[_0xaab0('0x22')](handleEntityNotFound(_0x3839a1,null))[_0xaab0('0x22')](respondWithResult(_0x3839a1,null))['catch'](handleError(_0x3839a1,null));};exports['create']=function(_0x59e20b,_0x39e1ef){return db[_0xaab0('0x2a')][_0xaab0('0x46')](_0x59e20b[_0xaab0('0x47')],{})['then'](respondWithResult(_0x39e1ef,0xc9))[_0xaab0('0x41')](handleError(_0x39e1ef,null));};exports[_0xaab0('0x48')]=function(_0x3da9b5,_0x991f7c){if(_0x3da9b5[_0xaab0('0x47')]['id']){delete _0x3da9b5[_0xaab0('0x47')]['id'];}return db[_0xaab0('0x2a')][_0xaab0('0x45')]({'where':{'id':_0x3da9b5['params']['id']}})[_0xaab0('0x22')](handleEntityNotFound(_0x991f7c,null))['then'](saveUpdates(_0x3da9b5[_0xaab0('0x47')],null))[_0xaab0('0x22')](respondWithResult(_0x991f7c,null))[_0xaab0('0x41')](handleError(_0x991f7c,null));};exports[_0xaab0('0x23')]=function(_0x19f0fb,_0x22793f){return db[_0xaab0('0x2a')][_0xaab0('0x45')]({'where':{'id':_0x19f0fb[_0xaab0('0x42')]['id']}})[_0xaab0('0x22')](handleEntityNotFound(_0x22793f,null))[_0xaab0('0x22')](removeEntity(_0x22793f,null))[_0xaab0('0x41')](handleError(_0x22793f,null));}; \ No newline at end of file +var _0x58d0=['MailServerOut','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','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/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x2c0970,_0x52c9b3){var _0x2a5596=function(_0x304ebc){while(--_0x304ebc){_0x2c0970['push'](_0x2c0970['shift']());}};_0x2a5596(++_0x52c9b3);}(_0x58d0,0x1cd));var _0x058d=function(_0x5bf609,_0x5c1e35){_0x5bf609=_0x5bf609-0x0;var _0x3c3a74=_0x58d0[_0x5bf609];return _0x3c3a74;};'use strict';var emlformat=require(_0x058d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x058d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x058d('0x2'));var moment=require(_0x058d('0x3'));var BPromise=require(_0x058d('0x4'));var Mustache=require('mustache');var util=require(_0x058d('0x5'));var path=require('path');var sox=require(_0x058d('0x6'));var csv=require(_0x058d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x058d('0x8'));var _=require(_0x058d('0x9'));var squel=require(_0x058d('0xa'));var crypto=require(_0x058d('0xb'));var jsforce=require(_0x058d('0xc'));var deskjs=require(_0x058d('0xd'));var toCsv=require(_0x058d('0x7'));var querystring=require(_0x058d('0xe'));var Papa=require(_0x058d('0xf'));var Redis=require('ioredis');var authService=require(_0x058d('0x10'));var qs=require(_0x058d('0x11'));var as=require(_0x058d('0x12'));var hardwareService=require(_0x058d('0x13'));var logger=require(_0x058d('0x14'))(_0x058d('0x15'));var utils=require('../../config/utils');var config=require(_0x058d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x058d('0x17'))['db'];function respondWithStatusCode(_0x550d78,_0x2fe86e){_0x2fe86e=_0x2fe86e||0xcc;return function(_0x2a7a48){if(_0x2a7a48){return _0x550d78[_0x058d('0x18')](_0x2fe86e);}return _0x550d78['status'](_0x2fe86e)[_0x058d('0x19')]();};}function respondWithResult(_0x309367,_0x6e2c8f){_0x6e2c8f=_0x6e2c8f||0xc8;return function(_0x53c04e){if(_0x53c04e){return _0x309367['status'](_0x6e2c8f)[_0x058d('0x1a')](_0x53c04e);}};}function respondWithFilteredResult(_0x2a842a,_0x107991){return function(_0x361e8b){if(_0x361e8b){var _0x32e225=typeof _0x107991[_0x058d('0x1b')]===_0x058d('0x1c')&&typeof _0x107991[_0x058d('0x1d')]===_0x058d('0x1c');var _0xccc1c6=_0x361e8b[_0x058d('0x1e')];var _0x885269=_0x32e225?0x0:_0x107991[_0x058d('0x1b')];var _0x3b1540=_0x32e225?_0x361e8b[_0x058d('0x1e')]:_0x107991[_0x058d('0x1b')]+_0x107991[_0x058d('0x1d')];var _0x5b4f5b;if(_0x3b1540>=_0xccc1c6){_0x3b1540=_0xccc1c6;_0x5b4f5b=0xc8;}else{_0x5b4f5b=0xce;}_0x2a842a[_0x058d('0x1f')](_0x5b4f5b);return _0x2a842a[_0x058d('0x20')](_0x058d('0x21'),_0x885269+'-'+_0x3b1540+'/'+_0xccc1c6)[_0x058d('0x1a')](_0x361e8b);}return null;};}function patchUpdates(_0x357840){return function(_0x81eeca){try{jsonpatch[_0x058d('0x22')](_0x81eeca,_0x357840,!![]);}catch(_0xf7067c){return BPromise[_0x058d('0x23')](_0xf7067c);}return _0x81eeca['save']();};}function saveUpdates(_0x45a1eb,_0x519711){return function(_0x4333c9){if(_0x4333c9){return _0x4333c9[_0x058d('0x24')](_0x45a1eb)['then'](function(_0x385ede){return _0x385ede;});}return null;};}function removeEntity(_0x1ac76f,_0x4ee60a){return function(_0xcc7ae9){if(_0xcc7ae9){return _0xcc7ae9[_0x058d('0x25')]()[_0x058d('0x26')](function(){_0x1ac76f[_0x058d('0x1f')](0xcc)[_0x058d('0x19')]();});}};}function handleEntityNotFound(_0x42d5f6,_0xba77b7){return function(_0x4e27ca){if(!_0x4e27ca){_0x42d5f6['sendStatus'](0x194);}return _0x4e27ca;};}function handleError(_0x3b0051,_0x51bdbb){_0x51bdbb=_0x51bdbb||0x1f4;return function(_0x326357){logger[_0x058d('0x27')](_0x326357['stack']);if(_0x326357[_0x058d('0x28')]){delete _0x326357['name'];}_0x3b0051['status'](_0x51bdbb)[_0x058d('0x29')](_0x326357);};}exports[_0x058d('0x2a')]=function(_0x3f1e67,_0x175c64){var _0x1829f7={},_0x2fb51c={},_0x30aa1c={'count':0x0,'rows':[]};var _0x2da9b3=_[_0x058d('0x2b')](db['MailServerOut'][_0x058d('0x2c')],function(_0xb44cf5){return{'name':_0xb44cf5['fieldName'],'type':_0xb44cf5['type'][_0x058d('0x2d')]};});_0x2fb51c['model']=_[_0x058d('0x2b')](_0x2da9b3,_0x058d('0x28'));_0x2fb51c[_0x058d('0x2e')]=_[_0x058d('0x2f')](_0x3f1e67[_0x058d('0x2e')]);_0x2fb51c[_0x058d('0x30')]=_[_0x058d('0x31')](_0x2fb51c[_0x058d('0x32')],_0x2fb51c['query']);_0x1829f7[_0x058d('0x33')]=_[_0x058d('0x31')](_0x2fb51c[_0x058d('0x32')],qs['fields'](_0x3f1e67[_0x058d('0x2e')][_0x058d('0x34')]));_0x1829f7['attributes']=_0x1829f7[_0x058d('0x33')][_0x058d('0x35')]?_0x1829f7[_0x058d('0x33')]:_0x2fb51c[_0x058d('0x32')];if(!_0x3f1e67[_0x058d('0x2e')][_0x058d('0x36')]('nolimit')){_0x1829f7[_0x058d('0x1d')]=qs[_0x058d('0x1d')](_0x3f1e67[_0x058d('0x2e')][_0x058d('0x1d')]);_0x1829f7[_0x058d('0x1b')]=qs['offset'](_0x3f1e67['query'][_0x058d('0x1b')]);}_0x1829f7[_0x058d('0x37')]=qs['sort'](_0x3f1e67[_0x058d('0x2e')][_0x058d('0x38')]);_0x1829f7['where']=qs[_0x058d('0x30')](_[_0x058d('0x39')](_0x3f1e67[_0x058d('0x2e')],_0x2fb51c[_0x058d('0x30')]),_0x2da9b3);if(_0x3f1e67[_0x058d('0x2e')][_0x058d('0x3a')]){_0x1829f7[_0x058d('0x3b')]=_[_0x058d('0x3c')](_0x1829f7[_0x058d('0x3b')],{'$or':_[_0x058d('0x2b')](_0x2da9b3,function(_0x132239){if(_0x132239[_0x058d('0x3d')]!==_0x058d('0x3e')){var _0x2b56b0={};_0x2b56b0[_0x132239[_0x058d('0x28')]]={'$like':'%'+_0x3f1e67[_0x058d('0x2e')][_0x058d('0x3a')]+'%'};return _0x2b56b0;}})});}_0x1829f7=_[_0x058d('0x3c')]({},_0x1829f7,_0x3f1e67[_0x058d('0x3f')]);var _0x3100c2={'where':_0x1829f7[_0x058d('0x3b')]};return db[_0x058d('0x40')]['count'](_0x3100c2)[_0x058d('0x26')](function(_0x313efa){_0x30aa1c[_0x058d('0x1e')]=_0x313efa;if(_0x3f1e67[_0x058d('0x2e')][_0x058d('0x41')]){_0x1829f7['include']=[{'all':!![]}];}return db[_0x058d('0x40')][_0x058d('0x42')](_0x1829f7);})['then'](function(_0x42d939){_0x30aa1c[_0x058d('0x43')]=_0x42d939;return _0x30aa1c;})[_0x058d('0x26')](respondWithFilteredResult(_0x175c64,_0x1829f7))[_0x058d('0x44')](handleError(_0x175c64,null));};exports[_0x058d('0x45')]=function(_0x12e000,_0xb06f05){var _0x238089={'raw':!![],'where':{'id':_0x12e000[_0x058d('0x46')]['id']}},_0x4525e5={};_0x4525e5[_0x058d('0x32')]=_[_0x058d('0x2f')](db[_0x058d('0x40')][_0x058d('0x2c')]);_0x4525e5[_0x058d('0x2e')]=_[_0x058d('0x2f')](_0x12e000[_0x058d('0x2e')]);_0x4525e5[_0x058d('0x30')]=_[_0x058d('0x31')](_0x4525e5[_0x058d('0x32')],_0x4525e5[_0x058d('0x2e')]);_0x238089[_0x058d('0x33')]=_[_0x058d('0x31')](_0x4525e5[_0x058d('0x32')],qs[_0x058d('0x34')](_0x12e000[_0x058d('0x2e')]['fields']));_0x238089[_0x058d('0x33')]=_0x238089[_0x058d('0x33')][_0x058d('0x35')]?_0x238089[_0x058d('0x33')]:_0x4525e5['model'];if(_0x12e000['query'][_0x058d('0x41')]){_0x238089[_0x058d('0x47')]=[{'all':!![]}];}_0x238089=_['merge']({},_0x238089,_0x12e000[_0x058d('0x3f')]);return db['MailServerOut'][_0x058d('0x48')](_0x238089)[_0x058d('0x26')](handleEntityNotFound(_0xb06f05,null))[_0x058d('0x26')](respondWithResult(_0xb06f05,null))[_0x058d('0x44')](handleError(_0xb06f05,null));};exports[_0x058d('0x49')]=function(_0x49bfa8,_0xfa5bc4){return db[_0x058d('0x40')]['create'](_0x49bfa8[_0x058d('0x4a')],{})[_0x058d('0x26')](respondWithResult(_0xfa5bc4,0xc9))[_0x058d('0x44')](handleError(_0xfa5bc4,null));};exports['update']=function(_0x2f69ee,_0x3a51d8){if(_0x2f69ee[_0x058d('0x4a')]['id']){delete _0x2f69ee[_0x058d('0x4a')]['id'];}return db[_0x058d('0x40')][_0x058d('0x48')]({'where':{'id':_0x2f69ee['params']['id']}})[_0x058d('0x26')](handleEntityNotFound(_0x3a51d8,null))[_0x058d('0x26')](saveUpdates(_0x2f69ee[_0x058d('0x4a')],null))[_0x058d('0x26')](respondWithResult(_0x3a51d8,null))[_0x058d('0x44')](handleError(_0x3a51d8,null));};exports['destroy']=function(_0x1f9416,_0x55eff4){return db[_0x058d('0x40')][_0x058d('0x48')]({'where':{'id':_0x1f9416[_0x058d('0x46')]['id']}})[_0x058d('0x26')](handleEntityNotFound(_0x55eff4,null))[_0x058d('0x26')](removeEntity(_0x55eff4,null))[_0x058d('0x44')](handleError(_0x55eff4,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f400a33..07b21ec 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 _0x46f7=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x33bf89,_0x5b0d25){var _0x114795=function(_0x47b8b7){while(--_0x47b8b7){_0x33bf89['push'](_0x33bf89['shift']());}};_0x114795(++_0x5b0d25);}(_0x46f7,0x138));var _0x746f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x46f7[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x746f('0x0'));var util=require('util');var logger=require(_0x746f('0x1'))(_0x746f('0x2'));var moment=require(_0x746f('0x3'));var BPromise=require(_0x746f('0x4'));var rp=require(_0x746f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x746f('0x6'));var config=require(_0x746f('0x7'));var attributes=require(_0x746f('0x8'));module[_0x746f('0x9')]=function(_0x18cc37,_0x58c8ec){return _0x18cc37[_0x746f('0xa')](_0x746f('0xb'),attributes,{'tableName':_0x746f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5760=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./mailServerOut.attributes','define','MailServerOut','mail_servers_out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5760,0x18c));var _0x0576=function(_0x20ae15,_0x28b3f1){_0x20ae15=_0x20ae15-0x0;var _0x3cc5dc=_0x5760[_0x20ae15];return _0x3cc5dc;};'use strict';var _=require(_0x0576('0x0'));var util=require(_0x0576('0x1'));var logger=require(_0x0576('0x2'))('api');var moment=require(_0x0576('0x3'));var BPromise=require(_0x0576('0x4'));var rp=require(_0x0576('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0576('0x6'));var config=require('../../config/environment');var attributes=require(_0x0576('0x7'));module['exports']=function(_0x15a78e,_0x1f218c){return _0x15a78e[_0x0576('0x8')](_0x0576('0x9'),attributes,{'tableName':_0x0576('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index bd12a5c..ba34d70 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x1f52e1,_0x28b827){_0x1f52e1=_0x1f52e1-0x0;var _0x277a05=_0x7a54[_0x1f52e1];return _0x277a05;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x7f40d3,_0x1c2fbf){var _0x2709dc=function(_0xd459ee){while(--_0xd459ee){_0x7f40d3['push'](_0x7f40d3['shift']());}};_0x2709dc(++_0x1c2fbf);}(_0x1261,0x144));var _0x1126=function(_0x114dbf,_0x3dd101){_0x114dbf=_0x114dbf-0x0;var _0x5953c9=_0x1261[_0x114dbf];return _0x5953c9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ffcf8a5..eb59c7c 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 _0xf4b3=['destroy','exports','multer','util','path','connect-timeout','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf4b3,0x92));var _0x3f4b=function(_0x4008de,_0x15f2e9){_0x4008de=_0x4008de-0x0;var _0x596738=_0xf4b3[_0x4008de];return _0x596738;};'use strict';var multer=require(_0x3f4b('0x0'));var util=require(_0x3f4b('0x1'));var path=require(_0x3f4b('0x2'));var timeout=require(_0x3f4b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f4b('0x4'));var controller=require(_0x3f4b('0x5'));router[_0x3f4b('0x6')]('/',auth[_0x3f4b('0x7')](),controller[_0x3f4b('0x8')]);router['get'](_0x3f4b('0x9'),auth[_0x3f4b('0x7')](),controller[_0x3f4b('0xa')]);router[_0x3f4b('0x6')](_0x3f4b('0xb'),auth[_0x3f4b('0x7')](),controller[_0x3f4b('0xc')]);router[_0x3f4b('0xd')]('/',auth[_0x3f4b('0x7')](),controller[_0x3f4b('0xe')]);router[_0x3f4b('0xf')](_0x3f4b('0xb'),auth[_0x3f4b('0x7')](),controller['update']);router['delete'](_0x3f4b('0xb'),auth[_0x3f4b('0x7')](),controller[_0x3f4b('0x10')]);module[_0x3f4b('0x11')]=router; \ No newline at end of file +var _0x21d0=['delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x4537c5,_0x5dcc60){var _0xcb1775=function(_0x432f63){while(--_0x432f63){_0x4537c5['push'](_0x4537c5['shift']());}};_0xcb1775(++_0x5dcc60);}(_0x21d0,0x17c));var _0x021d=function(_0x57960e,_0x2415e0){_0x57960e=_0x57960e-0x0;var _0x3cf54e=_0x21d0[_0x57960e];return _0x3cf54e;};'use strict';var multer=require(_0x021d('0x0'));var util=require('util');var path=require(_0x021d('0x1'));var timeout=require(_0x021d('0x2'));var express=require('express');var router=express[_0x021d('0x3')]();var fs_extra=require(_0x021d('0x4'));var auth=require(_0x021d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x021d('0x6')]('/',auth[_0x021d('0x7')](),controller[_0x021d('0x8')]);router[_0x021d('0x6')](_0x021d('0x9'),auth[_0x021d('0x7')](),controller['describe']);router[_0x021d('0x6')]('/:id',auth[_0x021d('0x7')](),controller[_0x021d('0xa')]);router[_0x021d('0xb')]('/',auth['isAuthenticated'](),controller[_0x021d('0xc')]);router[_0x021d('0xd')](_0x021d('0xe'),auth[_0x021d('0x7')](),controller[_0x021d('0xf')]);router[_0x021d('0x10')](_0x021d('0xe'),auth['isAuthenticated'](),controller[_0x021d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8a50539..437161d 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 _0xae30=['exports','STRING','sequelize'];(function(_0xbe0d54,_0x5c3362){var _0x13e619=function(_0xfa3e7f){while(--_0xfa3e7f){_0xbe0d54['push'](_0xbe0d54['shift']());}};_0x13e619(++_0x5c3362);}(_0xae30,0x10a));var _0x0ae3=function(_0x2f4afc,_0x1d0f82){_0x2f4afc=_0x2f4afc-0x0;var _0x47490c=_0xae30[_0x2f4afc];return _0x47490c;};'use strict';var Sequelize=require(_0x0ae3('0x0'));module[_0x0ae3('0x1')]={'name':{'type':Sequelize[_0x0ae3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0ae3('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','sequelize','exports'];(function(_0x16dc8e,_0x5d5cb2){var _0x3350dc=function(_0x7f8930){while(--_0x7f8930){_0x16dc8e['push'](_0x16dc8e['shift']());}};_0x3350dc(++_0x5d5cb2);}(_0x7a54,0x106));var _0x47a5=function(_0x2c3879,_0x4c8fff){_0x2c3879=_0x2c3879-0x0;var _0xc10de0=_0x7a54[_0x2c3879];return _0xc10de0;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'name':{'type':Sequelize[_0x47a5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7f704d0..6ec81c3 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 _0x6632=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailSubstatus','count','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6632,0x1b5));var _0x2663=function(_0x1e3446,_0x3f0de3){_0x1e3446=_0x1e3446-0x0;var _0x364458=_0x6632[_0x1e3446];return _0x364458;};'use strict';var emlformat=require(_0x2663('0x0'));var rimraf=require(_0x2663('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2663('0x2'));var rp=require(_0x2663('0x3'));var moment=require(_0x2663('0x4'));var BPromise=require(_0x2663('0x5'));var Mustache=require(_0x2663('0x6'));var util=require('util');var path=require(_0x2663('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2663('0x8'));var fs=require('fs');var fs_extra=require(_0x2663('0x9'));var _=require(_0x2663('0xa'));var squel=require('squel');var crypto=require(_0x2663('0xb'));var jsforce=require(_0x2663('0xc'));var deskjs=require(_0x2663('0xd'));var toCsv=require(_0x2663('0xe'));var querystring=require(_0x2663('0xf'));var Papa=require(_0x2663('0x10'));var Redis=require(_0x2663('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2663('0x12'));var as=require(_0x2663('0x13'));var hardwareService=require(_0x2663('0x14'));var logger=require(_0x2663('0x15'))(_0x2663('0x16'));var utils=require('../../config/utils');var config=require(_0x2663('0x17'));var licenseUtil=require(_0x2663('0x18'));var db=require(_0x2663('0x19'))['db'];function respondWithStatusCode(_0x2393a6,_0xed613d){_0xed613d=_0xed613d||0xcc;return function(_0x614e86){if(_0x614e86){return _0x2393a6[_0x2663('0x1a')](_0xed613d);}return _0x2393a6['status'](_0xed613d)[_0x2663('0x1b')]();};}function respondWithResult(_0x5d34e7,_0x453d0b){_0x453d0b=_0x453d0b||0xc8;return function(_0xfa4aec){if(_0xfa4aec){return _0x5d34e7[_0x2663('0x1c')](_0x453d0b)[_0x2663('0x1d')](_0xfa4aec);}};}function respondWithFilteredResult(_0x38594b,_0x243e4f){return function(_0x41b97e){if(_0x41b97e){var _0x38a917=typeof _0x243e4f['offset']===_0x2663('0x1e')&&typeof _0x243e4f[_0x2663('0x1f')]===_0x2663('0x1e');var _0x55e6fb=_0x41b97e['count'];var _0xbf7da6=_0x38a917?0x0:_0x243e4f[_0x2663('0x20')];var _0x1fe0bc=_0x38a917?_0x41b97e['count']:_0x243e4f['offset']+_0x243e4f[_0x2663('0x1f')];var _0x48bd33;if(_0x1fe0bc>=_0x55e6fb){_0x1fe0bc=_0x55e6fb;_0x48bd33=0xc8;}else{_0x48bd33=0xce;}_0x38594b[_0x2663('0x1c')](_0x48bd33);return _0x38594b['set']('Content-Range',_0xbf7da6+'-'+_0x1fe0bc+'/'+_0x55e6fb)['json'](_0x41b97e);}return null;};}function patchUpdates(_0x35e951){return function(_0x462150){try{jsonpatch[_0x2663('0x21')](_0x462150,_0x35e951,!![]);}catch(_0x3d2807){return BPromise[_0x2663('0x22')](_0x3d2807);}return _0x462150['save']();};}function saveUpdates(_0x57ca0e,_0x3a146d){return function(_0x339f59){if(_0x339f59){return _0x339f59[_0x2663('0x23')](_0x57ca0e)['then'](function(_0x10a207){return _0x10a207;});}return null;};}function removeEntity(_0x3180d0,_0x588b4f){return function(_0x4e7a40){if(_0x4e7a40){return _0x4e7a40[_0x2663('0x24')]()[_0x2663('0x25')](function(){_0x3180d0['status'](0xcc)[_0x2663('0x1b')]();});}};}function handleEntityNotFound(_0x2bbf82,_0x280037){return function(_0x11d871){if(!_0x11d871){_0x2bbf82[_0x2663('0x1a')](0x194);}return _0x11d871;};}function handleError(_0x1327c2,_0x200713){_0x200713=_0x200713||0x1f4;return function(_0x473ed0){logger[_0x2663('0x26')](_0x473ed0[_0x2663('0x27')]);if(_0x473ed0[_0x2663('0x28')]){delete _0x473ed0[_0x2663('0x28')];}_0x1327c2[_0x2663('0x1c')](_0x200713)[_0x2663('0x29')](_0x473ed0);};}exports[_0x2663('0x2a')]=function(_0x1141a0,_0x2f9797){var _0x85ad7e={},_0x367969={},_0x39ad32={'count':0x0,'rows':[]};var _0x3a6947=_[_0x2663('0x2b')](db['MailSubstatus'][_0x2663('0x2c')],function(_0x460970){return{'name':_0x460970['fieldName'],'type':_0x460970[_0x2663('0x2d')][_0x2663('0x2e')]};});_0x367969['model']=_[_0x2663('0x2b')](_0x3a6947,_0x2663('0x28'));_0x367969[_0x2663('0x2f')]=_[_0x2663('0x30')](_0x1141a0['query']);_0x367969['filters']=_[_0x2663('0x31')](_0x367969[_0x2663('0x32')],_0x367969[_0x2663('0x2f')]);_0x85ad7e['attributes']=_[_0x2663('0x31')](_0x367969['model'],qs['fields'](_0x1141a0[_0x2663('0x2f')]['fields']));_0x85ad7e['attributes']=_0x85ad7e[_0x2663('0x33')][_0x2663('0x34')]?_0x85ad7e['attributes']:_0x367969[_0x2663('0x32')];if(!_0x1141a0['query']['hasOwnProperty'](_0x2663('0x35'))){_0x85ad7e[_0x2663('0x1f')]=qs['limit'](_0x1141a0['query'][_0x2663('0x1f')]);_0x85ad7e[_0x2663('0x20')]=qs['offset'](_0x1141a0[_0x2663('0x2f')][_0x2663('0x20')]);}_0x85ad7e[_0x2663('0x36')]=qs[_0x2663('0x37')](_0x1141a0[_0x2663('0x2f')][_0x2663('0x37')]);_0x85ad7e[_0x2663('0x38')]=qs[_0x2663('0x39')](_[_0x2663('0x3a')](_0x1141a0['query'],_0x367969['filters']),_0x3a6947);if(_0x1141a0[_0x2663('0x2f')][_0x2663('0x3b')]){_0x85ad7e[_0x2663('0x38')]=_[_0x2663('0x3c')](_0x85ad7e[_0x2663('0x38')],{'$or':_['map'](_0x3a6947,function(_0x1e5a5f){if(_0x1e5a5f[_0x2663('0x2d')]!==_0x2663('0x3d')){var _0x54ea9c={};_0x54ea9c[_0x1e5a5f['name']]={'$like':'%'+_0x1141a0[_0x2663('0x2f')]['filter']+'%'};return _0x54ea9c;}})});}_0x85ad7e=_['merge']({},_0x85ad7e,_0x1141a0[_0x2663('0x3e')]);var _0x51469f={'where':_0x85ad7e[_0x2663('0x38')]};return db[_0x2663('0x3f')][_0x2663('0x40')](_0x51469f)[_0x2663('0x25')](function(_0x2a094c){_0x39ad32[_0x2663('0x40')]=_0x2a094c;if(_0x1141a0['query'][_0x2663('0x41')]){_0x85ad7e[_0x2663('0x42')]=[{'all':!![]}];}return db[_0x2663('0x3f')][_0x2663('0x43')](_0x85ad7e);})[_0x2663('0x25')](function(_0x4b90e7){_0x39ad32[_0x2663('0x44')]=_0x4b90e7;return _0x39ad32;})[_0x2663('0x25')](respondWithFilteredResult(_0x2f9797,_0x85ad7e))['catch'](handleError(_0x2f9797,null));};exports[_0x2663('0x45')]=function(_0x359348,_0x3af5ce){var _0x3d1adb={'raw':!![],'where':{'id':_0x359348[_0x2663('0x46')]['id']}},_0x3c34ea={};_0x3c34ea[_0x2663('0x32')]=_[_0x2663('0x30')](db[_0x2663('0x3f')][_0x2663('0x2c')]);_0x3c34ea['query']=_['keys'](_0x359348[_0x2663('0x2f')]);_0x3c34ea[_0x2663('0x39')]=_['intersection'](_0x3c34ea['model'],_0x3c34ea['query']);_0x3d1adb[_0x2663('0x33')]=_[_0x2663('0x31')](_0x3c34ea[_0x2663('0x32')],qs['fields'](_0x359348['query'][_0x2663('0x47')]));_0x3d1adb[_0x2663('0x33')]=_0x3d1adb[_0x2663('0x33')]['length']?_0x3d1adb[_0x2663('0x33')]:_0x3c34ea[_0x2663('0x32')];if(_0x359348[_0x2663('0x2f')]['includeAll']){_0x3d1adb[_0x2663('0x42')]=[{'all':!![]}];}_0x3d1adb=_[_0x2663('0x3c')]({},_0x3d1adb,_0x359348['options']);return db[_0x2663('0x3f')]['find'](_0x3d1adb)[_0x2663('0x25')](handleEntityNotFound(_0x3af5ce,null))[_0x2663('0x25')](respondWithResult(_0x3af5ce,null))[_0x2663('0x48')](handleError(_0x3af5ce,null));};exports[_0x2663('0x49')]=function(_0x94dcba,_0x5314bb){return db['MailSubstatus'][_0x2663('0x49')](_0x94dcba[_0x2663('0x4a')],{})[_0x2663('0x25')](respondWithResult(_0x5314bb,0xc9))[_0x2663('0x48')](handleError(_0x5314bb,null));};exports['update']=function(_0x37a33c,_0x28aa50){if(_0x37a33c['body']['id']){delete _0x37a33c[_0x2663('0x4a')]['id'];}return db[_0x2663('0x3f')][_0x2663('0x4b')]({'where':{'id':_0x37a33c[_0x2663('0x46')]['id']}})[_0x2663('0x25')](handleEntityNotFound(_0x28aa50,null))['then'](saveUpdates(_0x37a33c[_0x2663('0x4a')],null))[_0x2663('0x25')](respondWithResult(_0x28aa50,null))[_0x2663('0x48')](handleError(_0x28aa50,null));};exports['destroy']=function(_0xaf6c9d,_0x2f3253){return db[_0x2663('0x3f')]['find']({'where':{'id':_0xaf6c9d[_0x2663('0x46')]['id']}})[_0x2663('0x25')](handleEntityNotFound(_0x2f3253,null))['then'](removeEntity(_0x2f3253,null))[_0x2663('0x48')](handleError(_0x2f3253,null));};exports['describe']=function(_0x2079ef,_0x122018){return db[_0x2663('0x3f')]['describe']()[_0x2663('0x25')](respondWithResult(_0x122018,null))[_0x2663('0x48')](handleError(_0x122018,null));}; \ No newline at end of file +var _0x3f08=['describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','MailSubstatus','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','catch','show','params','keys','rawAttributes','includeAll','include','find','create','body','update','destroy'];(function(_0x287682,_0x119b1c){var _0x51309b=function(_0x4e6cc9){while(--_0x4e6cc9){_0x287682['push'](_0x287682['shift']());}};_0x51309b(++_0x119b1c);}(_0x3f08,0x9d));var _0x83f0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f08[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x83f0('0x0'));var rimraf=require(_0x83f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x83f0('0x2'));var moment=require(_0x83f0('0x3'));var BPromise=require(_0x83f0('0x4'));var Mustache=require(_0x83f0('0x5'));var util=require(_0x83f0('0x6'));var path=require(_0x83f0('0x7'));var sox=require(_0x83f0('0x8'));var csv=require(_0x83f0('0x9'));var ejs=require(_0x83f0('0xa'));var fs=require('fs');var fs_extra=require(_0x83f0('0xb'));var _=require(_0x83f0('0xc'));var squel=require(_0x83f0('0xd'));var crypto=require('crypto');var jsforce=require(_0x83f0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x83f0('0xf'));var Papa=require(_0x83f0('0x10'));var Redis=require('ioredis');var authService=require(_0x83f0('0x11'));var qs=require(_0x83f0('0x12'));var as=require(_0x83f0('0x13'));var hardwareService=require(_0x83f0('0x14'));var logger=require(_0x83f0('0x15'))(_0x83f0('0x16'));var utils=require('../../config/utils');var config=require(_0x83f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x83f0('0x18'))['db'];function respondWithStatusCode(_0x245fc9,_0x12b9eb){_0x12b9eb=_0x12b9eb||0xcc;return function(_0x174aa8){if(_0x174aa8){return _0x245fc9[_0x83f0('0x19')](_0x12b9eb);}return _0x245fc9['status'](_0x12b9eb)[_0x83f0('0x1a')]();};}function respondWithResult(_0x2b27e8,_0x134c33){_0x134c33=_0x134c33||0xc8;return function(_0xf569f7){if(_0xf569f7){return _0x2b27e8[_0x83f0('0x1b')](_0x134c33)[_0x83f0('0x1c')](_0xf569f7);}};}function respondWithFilteredResult(_0x395a6a,_0x4d65aa){return function(_0x408542){if(_0x408542){var _0x390b0c=typeof _0x4d65aa[_0x83f0('0x1d')]==='undefined'&&typeof _0x4d65aa['limit']===_0x83f0('0x1e');var _0x15c58b=_0x408542[_0x83f0('0x1f')];var _0x3b0a40=_0x390b0c?0x0:_0x4d65aa['offset'];var _0x6e9c9f=_0x390b0c?_0x408542['count']:_0x4d65aa['offset']+_0x4d65aa['limit'];var _0x2ab45f;if(_0x6e9c9f>=_0x15c58b){_0x6e9c9f=_0x15c58b;_0x2ab45f=0xc8;}else{_0x2ab45f=0xce;}_0x395a6a[_0x83f0('0x1b')](_0x2ab45f);return _0x395a6a[_0x83f0('0x20')](_0x83f0('0x21'),_0x3b0a40+'-'+_0x6e9c9f+'/'+_0x15c58b)[_0x83f0('0x1c')](_0x408542);}return null;};}function patchUpdates(_0x3de098){return function(_0x402782){try{jsonpatch['apply'](_0x402782,_0x3de098,!![]);}catch(_0x2afdf2){return BPromise[_0x83f0('0x22')](_0x2afdf2);}return _0x402782[_0x83f0('0x23')]();};}function saveUpdates(_0x5aca19,_0x48e4d0){return function(_0x5b216e){if(_0x5b216e){return _0x5b216e['update'](_0x5aca19)[_0x83f0('0x24')](function(_0x368d63){return _0x368d63;});}return null;};}function removeEntity(_0x20db02,_0x26b4eb){return function(_0x5e38b3){if(_0x5e38b3){return _0x5e38b3['destroy']()['then'](function(){_0x20db02[_0x83f0('0x1b')](0xcc)[_0x83f0('0x1a')]();});}};}function handleEntityNotFound(_0x3275f0,_0x4beaef){return function(_0x3718b7){if(!_0x3718b7){_0x3275f0[_0x83f0('0x19')](0x194);}return _0x3718b7;};}function handleError(_0x43bb76,_0x54504f){_0x54504f=_0x54504f||0x1f4;return function(_0x599cfb){logger[_0x83f0('0x25')](_0x599cfb[_0x83f0('0x26')]);if(_0x599cfb['name']){delete _0x599cfb[_0x83f0('0x27')];}_0x43bb76['status'](_0x54504f)[_0x83f0('0x28')](_0x599cfb);};}exports[_0x83f0('0x29')]=function(_0x5795d9,_0x164c44){var _0xf18a67={},_0x2ea63a={},_0x58b5ea={'count':0x0,'rows':[]};var _0x26fe2d=_['map'](db[_0x83f0('0x2a')]['rawAttributes'],function(_0x4ba2f7){return{'name':_0x4ba2f7[_0x83f0('0x2b')],'type':_0x4ba2f7['type'][_0x83f0('0x2c')]};});_0x2ea63a[_0x83f0('0x2d')]=_[_0x83f0('0x2e')](_0x26fe2d,_0x83f0('0x27'));_0x2ea63a[_0x83f0('0x2f')]=_['keys'](_0x5795d9['query']);_0x2ea63a[_0x83f0('0x30')]=_['intersection'](_0x2ea63a[_0x83f0('0x2d')],_0x2ea63a[_0x83f0('0x2f')]);_0xf18a67[_0x83f0('0x31')]=_[_0x83f0('0x32')](_0x2ea63a[_0x83f0('0x2d')],qs[_0x83f0('0x33')](_0x5795d9[_0x83f0('0x2f')][_0x83f0('0x33')]));_0xf18a67[_0x83f0('0x31')]=_0xf18a67[_0x83f0('0x31')][_0x83f0('0x34')]?_0xf18a67[_0x83f0('0x31')]:_0x2ea63a[_0x83f0('0x2d')];if(!_0x5795d9[_0x83f0('0x2f')]['hasOwnProperty'](_0x83f0('0x35'))){_0xf18a67[_0x83f0('0x36')]=qs['limit'](_0x5795d9[_0x83f0('0x2f')]['limit']);_0xf18a67[_0x83f0('0x1d')]=qs[_0x83f0('0x1d')](_0x5795d9['query'][_0x83f0('0x1d')]);}_0xf18a67[_0x83f0('0x37')]=qs['sort'](_0x5795d9[_0x83f0('0x2f')][_0x83f0('0x38')]);_0xf18a67[_0x83f0('0x39')]=qs[_0x83f0('0x30')](_[_0x83f0('0x3a')](_0x5795d9['query'],_0x2ea63a[_0x83f0('0x30')]),_0x26fe2d);if(_0x5795d9['query'][_0x83f0('0x3b')]){_0xf18a67[_0x83f0('0x39')]=_[_0x83f0('0x3c')](_0xf18a67[_0x83f0('0x39')],{'$or':_[_0x83f0('0x2e')](_0x26fe2d,function(_0x531e76){if(_0x531e76[_0x83f0('0x3d')]!==_0x83f0('0x3e')){var _0x2f7471={};_0x2f7471[_0x531e76[_0x83f0('0x27')]]={'$like':'%'+_0x5795d9['query'][_0x83f0('0x3b')]+'%'};return _0x2f7471;}})});}_0xf18a67=_[_0x83f0('0x3c')]({},_0xf18a67,_0x5795d9[_0x83f0('0x3f')]);var _0x332380={'where':_0xf18a67[_0x83f0('0x39')]};return db[_0x83f0('0x2a')][_0x83f0('0x1f')](_0x332380)[_0x83f0('0x24')](function(_0x2c4de1){_0x58b5ea[_0x83f0('0x1f')]=_0x2c4de1;if(_0x5795d9['query']['includeAll']){_0xf18a67['include']=[{'all':!![]}];}return db[_0x83f0('0x2a')]['findAll'](_0xf18a67);})[_0x83f0('0x24')](function(_0x4f9d50){_0x58b5ea[_0x83f0('0x40')]=_0x4f9d50;return _0x58b5ea;})['then'](respondWithFilteredResult(_0x164c44,_0xf18a67))[_0x83f0('0x41')](handleError(_0x164c44,null));};exports[_0x83f0('0x42')]=function(_0xdbcf7d,_0x5034a2){var _0x4c0f1b={'raw':!![],'where':{'id':_0xdbcf7d[_0x83f0('0x43')]['id']}},_0x6bd496={};_0x6bd496[_0x83f0('0x2d')]=_[_0x83f0('0x44')](db['MailSubstatus'][_0x83f0('0x45')]);_0x6bd496[_0x83f0('0x2f')]=_[_0x83f0('0x44')](_0xdbcf7d[_0x83f0('0x2f')]);_0x6bd496[_0x83f0('0x30')]=_[_0x83f0('0x32')](_0x6bd496['model'],_0x6bd496[_0x83f0('0x2f')]);_0x4c0f1b[_0x83f0('0x31')]=_[_0x83f0('0x32')](_0x6bd496['model'],qs['fields'](_0xdbcf7d['query'][_0x83f0('0x33')]));_0x4c0f1b['attributes']=_0x4c0f1b[_0x83f0('0x31')][_0x83f0('0x34')]?_0x4c0f1b[_0x83f0('0x31')]:_0x6bd496['model'];if(_0xdbcf7d['query'][_0x83f0('0x46')]){_0x4c0f1b[_0x83f0('0x47')]=[{'all':!![]}];}_0x4c0f1b=_[_0x83f0('0x3c')]({},_0x4c0f1b,_0xdbcf7d[_0x83f0('0x3f')]);return db[_0x83f0('0x2a')][_0x83f0('0x48')](_0x4c0f1b)[_0x83f0('0x24')](handleEntityNotFound(_0x5034a2,null))['then'](respondWithResult(_0x5034a2,null))[_0x83f0('0x41')](handleError(_0x5034a2,null));};exports[_0x83f0('0x49')]=function(_0x2c04a6,_0x3182ae){return db[_0x83f0('0x2a')][_0x83f0('0x49')](_0x2c04a6[_0x83f0('0x4a')],{})[_0x83f0('0x24')](respondWithResult(_0x3182ae,0xc9))[_0x83f0('0x41')](handleError(_0x3182ae,null));};exports[_0x83f0('0x4b')]=function(_0x2bd9cc,_0x145346){if(_0x2bd9cc[_0x83f0('0x4a')]['id']){delete _0x2bd9cc[_0x83f0('0x4a')]['id'];}return db['MailSubstatus'][_0x83f0('0x48')]({'where':{'id':_0x2bd9cc[_0x83f0('0x43')]['id']}})['then'](handleEntityNotFound(_0x145346,null))[_0x83f0('0x24')](saveUpdates(_0x2bd9cc['body'],null))[_0x83f0('0x24')](respondWithResult(_0x145346,null))[_0x83f0('0x41')](handleError(_0x145346,null));};exports[_0x83f0('0x4c')]=function(_0x7e5de7,_0x3aaba0){return db[_0x83f0('0x2a')]['find']({'where':{'id':_0x7e5de7[_0x83f0('0x43')]['id']}})[_0x83f0('0x24')](handleEntityNotFound(_0x3aaba0,null))[_0x83f0('0x24')](removeEntity(_0x3aaba0,null))[_0x83f0('0x41')](handleError(_0x3aaba0,null));};exports[_0x83f0('0x4d')]=function(_0x3fda43,_0x5290f8){return db[_0x83f0('0x2a')][_0x83f0('0x4d')]()[_0x83f0('0x24')](respondWithResult(_0x5290f8,null))[_0x83f0('0x41')](handleError(_0x5290f8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b40b4fc..388de31 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 _0x33e6=['update','emit','hasOwnProperty','../../mysqldb','setMaxListeners'];(function(_0x1b95a1,_0x529852){var _0x57aef1=function(_0x1cb2fd){while(--_0x1cb2fd){_0x1b95a1['push'](_0x1b95a1['shift']());}};_0x57aef1(++_0x529852);}(_0x33e6,0x85));var _0x633e=function(_0x1dea4a,_0x4b602c){_0x1dea4a=_0x1dea4a-0x0;var _0x3aa8be=_0x33e6[_0x1dea4a];return _0x3aa8be;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x633e('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x633e('0x1')](0x0);var events={'afterUpdate':_0x633e('0x2')};function emitEvent(_0x5b0e58){return function(_0x363f74,_0x5955e4,_0xb1f860){MailSubstatusEvents[_0x633e('0x3')](_0x5b0e58+':'+_0x363f74['id'],_0x363f74);MailSubstatusEvents['emit'](_0x5b0e58,_0x363f74);_0xb1f860(null);};}for(var e in events){if(events[_0x633e('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x7b12=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0x4f881a,_0x499660){var _0x4c8828=function(_0x34ee24){while(--_0x34ee24){_0x4f881a['push'](_0x4f881a['shift']());}};_0x4c8828(++_0x499660);}(_0x7b12,0x11f));var _0x27b1=function(_0x1741a1,_0x3ab2f5){_0x1741a1=_0x1741a1-0x0;var _0x20f178=_0x7b12[_0x1741a1];return _0x20f178;};'use strict';var EventEmitter=require(_0x27b1('0x0'));var MailSubstatus=require(_0x27b1('0x1'))['db'][_0x27b1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x27b1('0x3')](0x0);var events={'afterUpdate':_0x27b1('0x4')};function emitEvent(_0x247e90){return function(_0x42a1a1,_0xd0b064,_0x55df89){MailSubstatusEvents[_0x27b1('0x5')](_0x247e90+':'+_0x42a1a1['id'],_0x42a1a1);MailSubstatusEvents[_0x27b1('0x5')](_0x247e90,_0x42a1a1);_0x55df89(null);};}for(var e in events){if(events[_0x27b1('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x27b1('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 a680e9f..158e125 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 _0xafb7=['./mailSubstatus.attributes','exports','models','mail_substatuses','Condition','update','mailSubstatus','name','then','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xafb7,0x19a));var _0x7afb=function(_0x5705f4,_0x426ae7){_0x5705f4=_0x5705f4-0x0;var _0x5f116a=_0xafb7[_0x5705f4];return _0x5f116a;};'use strict';var attributes=require(_0x7afb('0x0'));module[_0x7afb('0x1')]=function(_0x5826fb){var _0x5cfff1=_0x5826fb[_0x7afb('0x2')];return _0x5826fb['define']('MailSubstatus',attributes,{'tableName':_0x7afb('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x14d5cd,_0x252c3a,_0x3037c8){return _0x5cfff1[_0x7afb('0x4')][_0x7afb('0x5')]({'value':_0x14d5cd['name']},{'where':{'field':_0x7afb('0x6'),'value':_0x14d5cd['_previousDataValues'][_0x7afb('0x7')]}})[_0x7afb('0x8')](function(){_0x3037c8();})[_0x7afb('0x9')](function(_0x1989e5){_0x3037c8(_0x1989e5);});}}});}; \ No newline at end of file +var _0x27b9=['_previousDataValues','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','update','name','mailSubstatus'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x27b9,0xe9));var _0x927b=function(_0x152c9a,_0x15db16){_0x152c9a=_0x152c9a-0x0;var _0x43a214=_0x27b9[_0x152c9a];return _0x43a214;};'use strict';var attributes=require(_0x927b('0x0'));module[_0x927b('0x1')]=function(_0x33992d){var _0x37c313=_0x33992d[_0x927b('0x2')];return _0x33992d[_0x927b('0x3')](_0x927b('0x4'),attributes,{'tableName':_0x927b('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x424553,_0x4fa6ff,_0x50b0fa){return _0x37c313['Condition'][_0x927b('0x6')]({'value':_0x424553[_0x927b('0x7')]},{'where':{'field':_0x927b('0x8'),'value':_0x424553[_0x927b('0x9')][_0x927b('0x7')]}})['then'](function(){_0x50b0fa();})[_0x927b('0xa')](function(_0x4600ae){_0x50b0fa(_0x4600ae);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8dca2d4..35976c0 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 _0x3665=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2454ba,_0x56d57c){var _0x3b34cc=function(_0x371603){while(--_0x371603){_0x2454ba['push'](_0x2454ba['shift']());}};_0x3b34cc(++_0x56d57c);}(_0x3665,0x11b));var _0x5366=function(_0x2dc5cc,_0x476e2f){_0x2dc5cc=_0x2dc5cc-0x0;var _0x2f400=_0x3665[_0x2dc5cc];return _0x2f400;};'use strict';var _=require(_0x5366('0x0'));var util=require(_0x5366('0x1'));var moment=require(_0x5366('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5366('0x3'))['db'];var utils=require(_0x5366('0x4'));var logger=require(_0x5366('0x5'))('rpc');var config=require(_0x5366('0x6'));var jayson=require(_0x5366('0x7'));var client=jayson[_0x5366('0x8')][_0x5366('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47e97f,_0x421f51,_0x4c73c9){return new BPromise(function(_0x38821f,_0x529d19){return client['request'](_0x47e97f,_0x4c73c9)[_0x5366('0xa')](function(_0x26565b){logger[_0x5366('0xb')](_0x5366('0xc'),_0x421f51,_0x5366('0xd'));logger[_0x5366('0xe')](_0x5366('0xf'),_0x421f51,_0x5366('0xd'),JSON[_0x5366('0x10')](_0x26565b));if(_0x26565b[_0x5366('0x11')]){if(_0x26565b[_0x5366('0x11')][_0x5366('0x12')]===0x1f4){logger[_0x5366('0x11')](_0x5366('0xc'),_0x421f51,_0x26565b['error']['message']);return _0x529d19(_0x26565b[_0x5366('0x11')]['message']);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x421f51,_0x26565b['error'][_0x5366('0x13')]);return _0x38821f(_0x26565b[_0x5366('0x11')][_0x5366('0x13')]);}else{logger[_0x5366('0xb')](_0x5366('0xc'),_0x421f51,'request\x20sent');_0x38821f(_0x26565b[_0x5366('0x14')][_0x5366('0x13')]);}})[_0x5366('0x15')](function(_0x1b78aa){logger[_0x5366('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x421f51,_0x1b78aa);_0x529d19(_0x1b78aa);});});} \ No newline at end of file +var _0x5039=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x129002,_0x4371a7){var _0x253f25=function(_0x21a161){while(--_0x21a161){_0x129002['push'](_0x129002['shift']());}};_0x253f25(++_0x4371a7);}(_0x5039,0xee));var _0x9503=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0x5039[_0x548200];return _0x1a6d74;};'use strict';var _=require(_0x9503('0x0'));var util=require('util');var moment=require(_0x9503('0x1'));var BPromise=require(_0x9503('0x2'));var rs=require(_0x9503('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9503('0x4'));var logger=require(_0x9503('0x5'))(_0x9503('0x6'));var config=require('../../config/environment');var jayson=require(_0x9503('0x7'));var client=jayson[_0x9503('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x439d6d,_0x4faf89,_0x2ee2e7){return new BPromise(function(_0x59b079,_0x1f0bf1){return client[_0x9503('0x9')](_0x439d6d,_0x2ee2e7)[_0x9503('0xa')](function(_0x5301d9){logger[_0x9503('0xb')](_0x9503('0xc'),_0x4faf89,'request\x20sent');logger[_0x9503('0xd')](_0x9503('0xe'),_0x4faf89,_0x9503('0xf'),JSON[_0x9503('0x10')](_0x5301d9));if(_0x5301d9[_0x9503('0x11')]){if(_0x5301d9[_0x9503('0x11')][_0x9503('0x12')]===0x1f4){logger[_0x9503('0x11')](_0x9503('0xc'),_0x4faf89,_0x5301d9['error']['message']);return _0x1f0bf1(_0x5301d9[_0x9503('0x11')][_0x9503('0x13')]);}logger[_0x9503('0x11')](_0x9503('0xc'),_0x4faf89,_0x5301d9[_0x9503('0x11')]['message']);return _0x59b079(_0x5301d9['error'][_0x9503('0x13')]);}else{logger[_0x9503('0xb')](_0x9503('0xc'),_0x4faf89,'request\x20sent');_0x59b079(_0x5301d9[_0x9503('0x14')][_0x9503('0x13')]);}})[_0x9503('0x15')](function(_0x2b31d3){logger[_0x9503('0x11')](_0x9503('0xc'),_0x4faf89,_0x2b31d3);_0x1f0bf1(_0x2b31d3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8e433de..8809a7b 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 _0x9035=['/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x16b4c6,_0x43a344){var _0x2d1b30=function(_0x1b8645){while(--_0x1b8645){_0x16b4c6['push'](_0x16b4c6['shift']());}};_0x2d1b30(++_0x43a344);}(_0x9035,0x108));var _0x5903=function(_0x1228e5,_0xd2330e){_0x1228e5=_0x1228e5-0x0;var _0x438e21=_0x9035[_0x1228e5];return _0x438e21;};'use strict';var multer=require(_0x5903('0x0'));var util=require(_0x5903('0x1'));var path=require('path');var timeout=require(_0x5903('0x2'));var express=require('express');var router=express[_0x5903('0x3')]();var fs_extra=require(_0x5903('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5903('0x5'));router[_0x5903('0x6')]('/',auth[_0x5903('0x7')](),controller['index']);router[_0x5903('0x6')](_0x5903('0x8'),auth[_0x5903('0x7')](),controller['describe']);router[_0x5903('0x6')](_0x5903('0x9'),auth['isAuthenticated'](),controller[_0x5903('0xa')]);router[_0x5903('0xb')]('/',auth['isAuthenticated'](),controller[_0x5903('0xc')]);router[_0x5903('0xd')](_0x5903('0x9'),auth[_0x5903('0x7')](),controller['update']);router[_0x5903('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5903('0xf')]);module[_0x5903('0x10')]=router; \ No newline at end of file +var _0xf9a8=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf9a8,0xfc));var _0x8f9a=function(_0x27ca98,_0x13f82a){_0x27ca98=_0x27ca98-0x0;var _0x4d656b=_0xf9a8[_0x27ca98];return _0x4d656b;};'use strict';var multer=require(_0x8f9a('0x0'));var util=require(_0x8f9a('0x1'));var path=require('path');var timeout=require(_0x8f9a('0x2'));var express=require(_0x8f9a('0x3'));var router=express['Router']();var fs_extra=require(_0x8f9a('0x4'));var auth=require(_0x8f9a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8f9a('0x6'));var controller=require(_0x8f9a('0x7'));router[_0x8f9a('0x8')]('/',auth[_0x8f9a('0x9')](),controller[_0x8f9a('0xa')]);router[_0x8f9a('0x8')]('/describe',auth[_0x8f9a('0x9')](),controller[_0x8f9a('0xb')]);router[_0x8f9a('0x8')](_0x8f9a('0xc'),auth[_0x8f9a('0x9')](),controller[_0x8f9a('0xd')]);router[_0x8f9a('0xe')]('/',auth[_0x8f9a('0x9')](),controller[_0x8f9a('0xf')]);router['put'](_0x8f9a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8f9a('0x10')](_0x8f9a('0xc'),auth['isAuthenticated'](),controller[_0x8f9a('0x11')]);module[_0x8f9a('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d23e8d0..a37842d 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3145ca,_0x12ab31){var _0x3ee071=function(_0x3e0546){while(--_0x3e0546){_0x3145ca['push'](_0x3145ca['shift']());}};_0x3ee071(++_0x12ab31);}(_0x00bb,0x1d8));var _0xb00b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00bb[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x3b8a89,_0x13e680){var _0x2beb1e=function(_0x56dca9){while(--_0x56dca9){_0x3b8a89['push'](_0x3b8a89['shift']());}};_0x2beb1e(++_0x13e680);}(_0xedd9,0xfc));var _0x9edd=function(_0x452a9d,_0x318a09){_0x452a9d=_0x452a9d-0x0;var _0x30246f=_0xedd9[_0x452a9d];return _0x30246f;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e9d30bd..afcac8a 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 _0xdf51=['create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','count','limit','status','set','Content-Range','json','apply','save','update','then','end','error','name','send','map','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','params','MailTransferReport','catch'];(function(_0x2ac2f4,_0x223abb){var _0x35e9a5=function(_0x220861){while(--_0x220861){_0x2ac2f4['push'](_0x2ac2f4['shift']());}};_0x35e9a5(++_0x223abb);}(_0xdf51,0x1bb));var _0x1df5=function(_0x25c24c,_0x3f37e1){_0x25c24c=_0x25c24c-0x0;var _0x5d896c=_0xdf51[_0x25c24c];return _0x5d896c;};'use strict';var emlformat=require(_0x1df5('0x0'));var rimraf=require(_0x1df5('0x1'));var zipdir=require(_0x1df5('0x2'));var jsonpatch=require(_0x1df5('0x3'));var rp=require(_0x1df5('0x4'));var moment=require(_0x1df5('0x5'));var BPromise=require(_0x1df5('0x6'));var Mustache=require(_0x1df5('0x7'));var util=require(_0x1df5('0x8'));var path=require('path');var sox=require(_0x1df5('0x9'));var csv=require(_0x1df5('0xa'));var ejs=require(_0x1df5('0xb'));var fs=require('fs');var fs_extra=require(_0x1df5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1df5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1df5('0xe'));var toCsv=require(_0x1df5('0xa'));var querystring=require(_0x1df5('0xf'));var Papa=require('papaparse');var Redis=require(_0x1df5('0x10'));var authService=require(_0x1df5('0x11'));var qs=require(_0x1df5('0x12'));var as=require(_0x1df5('0x13'));var hardwareService=require(_0x1df5('0x14'));var logger=require(_0x1df5('0x15'))(_0x1df5('0x16'));var utils=require(_0x1df5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1df5('0x18'));var db=require(_0x1df5('0x19'))['db'];function respondWithStatusCode(_0x3fce6f,_0x3ea25f){_0x3ea25f=_0x3ea25f||0xcc;return function(_0xbfe9a3){if(_0xbfe9a3){return _0x3fce6f[_0x1df5('0x1a')](_0x3ea25f);}return _0x3fce6f['status'](_0x3ea25f)['end']();};}function respondWithResult(_0x526ad7,_0x49ca86){_0x49ca86=_0x49ca86||0xc8;return function(_0x353ea1){if(_0x353ea1){return _0x526ad7['status'](_0x49ca86)['json'](_0x353ea1);}};}function respondWithFilteredResult(_0x445fd4,_0x4a5349){return function(_0x5bfe23){if(_0x5bfe23){var _0x50e488=typeof _0x4a5349[_0x1df5('0x1b')]===_0x1df5('0x1c')&&typeof _0x4a5349['limit']===_0x1df5('0x1c');var _0x569eb1=_0x5bfe23[_0x1df5('0x1d')];var _0x13fd1d=_0x50e488?0x0:_0x4a5349[_0x1df5('0x1b')];var _0x56608e=_0x50e488?_0x5bfe23[_0x1df5('0x1d')]:_0x4a5349[_0x1df5('0x1b')]+_0x4a5349[_0x1df5('0x1e')];var _0x1d1280;if(_0x56608e>=_0x569eb1){_0x56608e=_0x569eb1;_0x1d1280=0xc8;}else{_0x1d1280=0xce;}_0x445fd4[_0x1df5('0x1f')](_0x1d1280);return _0x445fd4[_0x1df5('0x20')](_0x1df5('0x21'),_0x13fd1d+'-'+_0x56608e+'/'+_0x569eb1)[_0x1df5('0x22')](_0x5bfe23);}return null;};}function patchUpdates(_0x2617f6){return function(_0x4f505e){try{jsonpatch[_0x1df5('0x23')](_0x4f505e,_0x2617f6,!![]);}catch(_0x2ce60c){return BPromise['reject'](_0x2ce60c);}return _0x4f505e[_0x1df5('0x24')]();};}function saveUpdates(_0x4eb9b5,_0x221ad){return function(_0x4340c6){if(_0x4340c6){return _0x4340c6[_0x1df5('0x25')](_0x4eb9b5)[_0x1df5('0x26')](function(_0x52a05b){return _0x52a05b;});}return null;};}function removeEntity(_0x3949c3,_0x44637d){return function(_0x28e0b7){if(_0x28e0b7){return _0x28e0b7['destroy']()['then'](function(){_0x3949c3[_0x1df5('0x1f')](0xcc)[_0x1df5('0x27')]();});}};}function handleEntityNotFound(_0x29f367,_0x5dab06){return function(_0x4fa3b6){if(!_0x4fa3b6){_0x29f367['sendStatus'](0x194);}return _0x4fa3b6;};}function handleError(_0x143b55,_0x51c0bb){_0x51c0bb=_0x51c0bb||0x1f4;return function(_0x38b416){logger[_0x1df5('0x28')](_0x38b416['stack']);if(_0x38b416[_0x1df5('0x29')]){delete _0x38b416[_0x1df5('0x29')];}_0x143b55[_0x1df5('0x1f')](_0x51c0bb)[_0x1df5('0x2a')](_0x38b416);};}exports['index']=function(_0x2914d2,_0xbaf703){var _0x1a81f2={},_0xd3a887={},_0x761516={'count':0x0,'rows':[]};var _0x681ec4=_[_0x1df5('0x2b')](db['MailTransferReport'][_0x1df5('0x2c')],function(_0x3dd870){return{'name':_0x3dd870['fieldName'],'type':_0x3dd870[_0x1df5('0x2d')]['key']};});_0xd3a887['model']=_[_0x1df5('0x2b')](_0x681ec4,'name');_0xd3a887[_0x1df5('0x2e')]=_[_0x1df5('0x2f')](_0x2914d2[_0x1df5('0x2e')]);_0xd3a887[_0x1df5('0x30')]=_['intersection'](_0xd3a887[_0x1df5('0x31')],_0xd3a887['query']);_0x1a81f2[_0x1df5('0x32')]=_[_0x1df5('0x33')](_0xd3a887['model'],qs[_0x1df5('0x34')](_0x2914d2['query'][_0x1df5('0x34')]));_0x1a81f2[_0x1df5('0x32')]=_0x1a81f2['attributes'][_0x1df5('0x35')]?_0x1a81f2[_0x1df5('0x32')]:_0xd3a887[_0x1df5('0x31')];if(!_0x2914d2[_0x1df5('0x2e')][_0x1df5('0x36')]('nolimit')){_0x1a81f2['limit']=qs[_0x1df5('0x1e')](_0x2914d2[_0x1df5('0x2e')][_0x1df5('0x1e')]);_0x1a81f2[_0x1df5('0x1b')]=qs[_0x1df5('0x1b')](_0x2914d2[_0x1df5('0x2e')][_0x1df5('0x1b')]);}_0x1a81f2[_0x1df5('0x37')]=qs[_0x1df5('0x38')](_0x2914d2[_0x1df5('0x2e')][_0x1df5('0x38')]);_0x1a81f2[_0x1df5('0x39')]=qs[_0x1df5('0x30')](_[_0x1df5('0x3a')](_0x2914d2[_0x1df5('0x2e')],_0xd3a887[_0x1df5('0x30')]),_0x681ec4);if(_0x2914d2[_0x1df5('0x2e')][_0x1df5('0x3b')]){_0x1a81f2[_0x1df5('0x39')]=_['merge'](_0x1a81f2[_0x1df5('0x39')],{'$or':_[_0x1df5('0x2b')](_0x681ec4,function(_0x2b2aaa){if(_0x2b2aaa[_0x1df5('0x2d')]!==_0x1df5('0x3c')){var _0x262a10={};_0x262a10[_0x2b2aaa[_0x1df5('0x29')]]={'$like':'%'+_0x2914d2['query'][_0x1df5('0x3b')]+'%'};return _0x262a10;}})});}_0x1a81f2=_[_0x1df5('0x3d')]({},_0x1a81f2,_0x2914d2[_0x1df5('0x3e')]);var _0x332c32={'where':_0x1a81f2[_0x1df5('0x39')]};return db['MailTransferReport'][_0x1df5('0x1d')](_0x332c32)['then'](function(_0x526315){_0x761516[_0x1df5('0x1d')]=_0x526315;if(_0x2914d2['query']['includeAll']){_0x1a81f2[_0x1df5('0x3f')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x1a81f2);})[_0x1df5('0x26')](function(_0x5840ca){_0x761516[_0x1df5('0x40')]=_0x5840ca;return _0x761516;})[_0x1df5('0x26')](respondWithFilteredResult(_0xbaf703,_0x1a81f2))['catch'](handleError(_0xbaf703,null));};exports['show']=function(_0x4c4b93,_0x25b554){var _0x5bdde3={'raw':!![],'where':{'id':_0x4c4b93[_0x1df5('0x41')]['id']}},_0x4d901a={};_0x4d901a[_0x1df5('0x31')]=_['keys'](db[_0x1df5('0x42')][_0x1df5('0x2c')]);_0x4d901a[_0x1df5('0x2e')]=_[_0x1df5('0x2f')](_0x4c4b93[_0x1df5('0x2e')]);_0x4d901a['filters']=_[_0x1df5('0x33')](_0x4d901a['model'],_0x4d901a[_0x1df5('0x2e')]);_0x5bdde3[_0x1df5('0x32')]=_[_0x1df5('0x33')](_0x4d901a[_0x1df5('0x31')],qs[_0x1df5('0x34')](_0x4c4b93['query'][_0x1df5('0x34')]));_0x5bdde3['attributes']=_0x5bdde3[_0x1df5('0x32')][_0x1df5('0x35')]?_0x5bdde3[_0x1df5('0x32')]:_0x4d901a[_0x1df5('0x31')];if(_0x4c4b93[_0x1df5('0x2e')]['includeAll']){_0x5bdde3['include']=[{'all':!![]}];}_0x5bdde3=_[_0x1df5('0x3d')]({},_0x5bdde3,_0x4c4b93[_0x1df5('0x3e')]);return db[_0x1df5('0x42')]['find'](_0x5bdde3)['then'](handleEntityNotFound(_0x25b554,null))['then'](respondWithResult(_0x25b554,null))[_0x1df5('0x43')](handleError(_0x25b554,null));};exports['create']=function(_0xe54302,_0x1645b6){return db['MailTransferReport'][_0x1df5('0x44')](_0xe54302['body'],{})[_0x1df5('0x26')](respondWithResult(_0x1645b6,0xc9))['catch'](handleError(_0x1645b6,null));};exports[_0x1df5('0x25')]=function(_0x98c25f,_0x5c2e97){if(_0x98c25f[_0x1df5('0x45')]['id']){delete _0x98c25f[_0x1df5('0x45')]['id'];}return db[_0x1df5('0x42')][_0x1df5('0x46')]({'where':{'id':_0x98c25f['params']['id']}})['then'](handleEntityNotFound(_0x5c2e97,null))[_0x1df5('0x26')](saveUpdates(_0x98c25f[_0x1df5('0x45')],null))[_0x1df5('0x26')](respondWithResult(_0x5c2e97,null))['catch'](handleError(_0x5c2e97,null));};exports[_0x1df5('0x47')]=function(_0x5014c2,_0xec8e9e){return db[_0x1df5('0x42')][_0x1df5('0x46')]({'where':{'id':_0x5014c2['params']['id']}})['then'](handleEntityNotFound(_0xec8e9e,null))['then'](removeEntity(_0xec8e9e,null))[_0x1df5('0x43')](handleError(_0xec8e9e,null));};exports[_0x1df5('0x48')]=function(_0x58bf6c,_0xd9ce4c){return db[_0x1df5('0x42')][_0x1df5('0x48')]()[_0x1df5('0x26')](respondWithResult(_0xd9ce4c,null))[_0x1df5('0x43')](handleError(_0xd9ce4c,null));}; \ No newline at end of file +var _0xd9bd=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','MailTransferReport','rawAttributes','type','model','map','keys'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd9bd,0x12e));var _0xdd9b=function(_0x1f9dcf,_0x382998){_0x1f9dcf=_0x1f9dcf-0x0;var _0x2e0f45=_0xd9bd[_0x1f9dcf];return _0x2e0f45;};'use strict';var emlformat=require(_0xdd9b('0x0'));var rimraf=require(_0xdd9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd9b('0x2'));var moment=require(_0xdd9b('0x3'));var BPromise=require(_0xdd9b('0x4'));var Mustache=require(_0xdd9b('0x5'));var util=require(_0xdd9b('0x6'));var path=require('path');var sox=require(_0xdd9b('0x7'));var csv=require(_0xdd9b('0x8'));var ejs=require(_0xdd9b('0x9'));var fs=require('fs');var fs_extra=require(_0xdd9b('0xa'));var _=require(_0xdd9b('0xb'));var squel=require(_0xdd9b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd9b('0xd'));var toCsv=require(_0xdd9b('0x8'));var querystring=require(_0xdd9b('0xe'));var Papa=require(_0xdd9b('0xf'));var Redis=require(_0xdd9b('0x10'));var authService=require(_0xdd9b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd9b('0x12'))('api');var utils=require(_0xdd9b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe03c1d,_0xc5ff39){_0xc5ff39=_0xc5ff39||0xcc;return function(_0x5799f3){if(_0x5799f3){return _0xe03c1d[_0xdd9b('0x14')](_0xc5ff39);}return _0xe03c1d[_0xdd9b('0x15')](_0xc5ff39)[_0xdd9b('0x16')]();};}function respondWithResult(_0x33b839,_0x4a3a85){_0x4a3a85=_0x4a3a85||0xc8;return function(_0x50376e){if(_0x50376e){return _0x33b839['status'](_0x4a3a85)[_0xdd9b('0x17')](_0x50376e);}};}function respondWithFilteredResult(_0x468e9f,_0x26e7db){return function(_0x289e76){if(_0x289e76){var _0x302762=typeof _0x26e7db[_0xdd9b('0x18')]===_0xdd9b('0x19')&&typeof _0x26e7db[_0xdd9b('0x1a')]===_0xdd9b('0x19');var _0x5afc0f=_0x289e76['count'];var _0x560929=_0x302762?0x0:_0x26e7db['offset'];var _0x1e8347=_0x302762?_0x289e76[_0xdd9b('0x1b')]:_0x26e7db[_0xdd9b('0x18')]+_0x26e7db[_0xdd9b('0x1a')];var _0x2df363;if(_0x1e8347>=_0x5afc0f){_0x1e8347=_0x5afc0f;_0x2df363=0xc8;}else{_0x2df363=0xce;}_0x468e9f[_0xdd9b('0x15')](_0x2df363);return _0x468e9f[_0xdd9b('0x1c')](_0xdd9b('0x1d'),_0x560929+'-'+_0x1e8347+'/'+_0x5afc0f)[_0xdd9b('0x17')](_0x289e76);}return null;};}function patchUpdates(_0x3892f5){return function(_0x35f6ca){try{jsonpatch[_0xdd9b('0x1e')](_0x35f6ca,_0x3892f5,!![]);}catch(_0x213f60){return BPromise[_0xdd9b('0x1f')](_0x213f60);}return _0x35f6ca[_0xdd9b('0x20')]();};}function saveUpdates(_0xa68277,_0x1e20e7){return function(_0x501895){if(_0x501895){return _0x501895['update'](_0xa68277)[_0xdd9b('0x21')](function(_0x346982){return _0x346982;});}return null;};}function removeEntity(_0x137a37,_0x5563b4){return function(_0x42101e){if(_0x42101e){return _0x42101e['destroy']()[_0xdd9b('0x21')](function(){_0x137a37[_0xdd9b('0x15')](0xcc)[_0xdd9b('0x16')]();});}};}function handleEntityNotFound(_0x1bbc34,_0x3c5cce){return function(_0x55ed87){if(!_0x55ed87){_0x1bbc34[_0xdd9b('0x14')](0x194);}return _0x55ed87;};}function handleError(_0x5e6d02,_0x30b44f){_0x30b44f=_0x30b44f||0x1f4;return function(_0x4739aa){logger[_0xdd9b('0x22')](_0x4739aa[_0xdd9b('0x23')]);if(_0x4739aa[_0xdd9b('0x24')]){delete _0x4739aa[_0xdd9b('0x24')];}_0x5e6d02[_0xdd9b('0x15')](_0x30b44f)['send'](_0x4739aa);};}exports['index']=function(_0x559202,_0x6cae0f){var _0x4eba08={},_0x1a23ed={},_0x1599d9={'count':0x0,'rows':[]};var _0x43e84f=_['map'](db[_0xdd9b('0x25')][_0xdd9b('0x26')],function(_0x59b042){return{'name':_0x59b042['fieldName'],'type':_0x59b042[_0xdd9b('0x27')]['key']};});_0x1a23ed[_0xdd9b('0x28')]=_[_0xdd9b('0x29')](_0x43e84f,'name');_0x1a23ed['query']=_[_0xdd9b('0x2a')](_0x559202[_0xdd9b('0x2b')]);_0x1a23ed[_0xdd9b('0x2c')]=_[_0xdd9b('0x2d')](_0x1a23ed[_0xdd9b('0x28')],_0x1a23ed[_0xdd9b('0x2b')]);_0x4eba08[_0xdd9b('0x2e')]=_[_0xdd9b('0x2d')](_0x1a23ed[_0xdd9b('0x28')],qs[_0xdd9b('0x2f')](_0x559202[_0xdd9b('0x2b')][_0xdd9b('0x2f')]));_0x4eba08['attributes']=_0x4eba08[_0xdd9b('0x2e')][_0xdd9b('0x30')]?_0x4eba08[_0xdd9b('0x2e')]:_0x1a23ed['model'];if(!_0x559202[_0xdd9b('0x2b')][_0xdd9b('0x31')](_0xdd9b('0x32'))){_0x4eba08[_0xdd9b('0x1a')]=qs[_0xdd9b('0x1a')](_0x559202[_0xdd9b('0x2b')][_0xdd9b('0x1a')]);_0x4eba08[_0xdd9b('0x18')]=qs[_0xdd9b('0x18')](_0x559202['query']['offset']);}_0x4eba08[_0xdd9b('0x33')]=qs['sort'](_0x559202[_0xdd9b('0x2b')][_0xdd9b('0x34')]);_0x4eba08[_0xdd9b('0x35')]=qs[_0xdd9b('0x2c')](_[_0xdd9b('0x36')](_0x559202['query'],_0x1a23ed['filters']),_0x43e84f);if(_0x559202[_0xdd9b('0x2b')][_0xdd9b('0x37')]){_0x4eba08[_0xdd9b('0x35')]=_[_0xdd9b('0x38')](_0x4eba08[_0xdd9b('0x35')],{'$or':_[_0xdd9b('0x29')](_0x43e84f,function(_0x452dac){if(_0x452dac['type']!=='VIRTUAL'){var _0x3f6802={};_0x3f6802[_0x452dac[_0xdd9b('0x24')]]={'$like':'%'+_0x559202[_0xdd9b('0x2b')][_0xdd9b('0x37')]+'%'};return _0x3f6802;}})});}_0x4eba08=_[_0xdd9b('0x38')]({},_0x4eba08,_0x559202[_0xdd9b('0x39')]);var _0x1f8227={'where':_0x4eba08['where']};return db[_0xdd9b('0x25')]['count'](_0x1f8227)['then'](function(_0x3b952b){_0x1599d9['count']=_0x3b952b;if(_0x559202[_0xdd9b('0x2b')]['includeAll']){_0x4eba08[_0xdd9b('0x3a')]=[{'all':!![]}];}return db['MailTransferReport'][_0xdd9b('0x3b')](_0x4eba08);})['then'](function(_0x35af65){_0x1599d9[_0xdd9b('0x3c')]=_0x35af65;return _0x1599d9;})['then'](respondWithFilteredResult(_0x6cae0f,_0x4eba08))[_0xdd9b('0x3d')](handleError(_0x6cae0f,null));};exports[_0xdd9b('0x3e')]=function(_0x5924e8,_0x5c310b){var _0x4ac500={'raw':!![],'where':{'id':_0x5924e8[_0xdd9b('0x3f')]['id']}},_0x1b2a70={};_0x1b2a70[_0xdd9b('0x28')]=_[_0xdd9b('0x2a')](db['MailTransferReport'][_0xdd9b('0x26')]);_0x1b2a70[_0xdd9b('0x2b')]=_['keys'](_0x5924e8[_0xdd9b('0x2b')]);_0x1b2a70[_0xdd9b('0x2c')]=_['intersection'](_0x1b2a70[_0xdd9b('0x28')],_0x1b2a70[_0xdd9b('0x2b')]);_0x4ac500[_0xdd9b('0x2e')]=_['intersection'](_0x1b2a70[_0xdd9b('0x28')],qs[_0xdd9b('0x2f')](_0x5924e8[_0xdd9b('0x2b')][_0xdd9b('0x2f')]));_0x4ac500[_0xdd9b('0x2e')]=_0x4ac500[_0xdd9b('0x2e')][_0xdd9b('0x30')]?_0x4ac500[_0xdd9b('0x2e')]:_0x1b2a70[_0xdd9b('0x28')];if(_0x5924e8[_0xdd9b('0x2b')]['includeAll']){_0x4ac500['include']=[{'all':!![]}];}_0x4ac500=_[_0xdd9b('0x38')]({},_0x4ac500,_0x5924e8[_0xdd9b('0x39')]);return db[_0xdd9b('0x25')][_0xdd9b('0x40')](_0x4ac500)['then'](handleEntityNotFound(_0x5c310b,null))[_0xdd9b('0x21')](respondWithResult(_0x5c310b,null))[_0xdd9b('0x3d')](handleError(_0x5c310b,null));};exports[_0xdd9b('0x41')]=function(_0x11c3ac,_0x507d41){return db[_0xdd9b('0x25')]['create'](_0x11c3ac['body'],{})[_0xdd9b('0x21')](respondWithResult(_0x507d41,0xc9))['catch'](handleError(_0x507d41,null));};exports['update']=function(_0x24ed6c,_0x4dcf39){if(_0x24ed6c[_0xdd9b('0x42')]['id']){delete _0x24ed6c[_0xdd9b('0x42')]['id'];}return db[_0xdd9b('0x25')]['find']({'where':{'id':_0x24ed6c[_0xdd9b('0x3f')]['id']}})[_0xdd9b('0x21')](handleEntityNotFound(_0x4dcf39,null))[_0xdd9b('0x21')](saveUpdates(_0x24ed6c[_0xdd9b('0x42')],null))['then'](respondWithResult(_0x4dcf39,null))['catch'](handleError(_0x4dcf39,null));};exports[_0xdd9b('0x43')]=function(_0x40cbbf,_0x119d94){return db['MailTransferReport'][_0xdd9b('0x40')]({'where':{'id':_0x40cbbf[_0xdd9b('0x3f')]['id']}})[_0xdd9b('0x21')](handleEntityNotFound(_0x119d94,null))[_0xdd9b('0x21')](removeEntity(_0x119d94,null))['catch'](handleError(_0x119d94,null));};exports[_0xdd9b('0x44')]=function(_0x3b6cec,_0x54c9e0){return db[_0xdd9b('0x25')][_0xdd9b('0x44')]()[_0xdd9b('0x21')](respondWithResult(_0x54c9e0,null))[_0xdd9b('0x3d')](handleError(_0x54c9e0,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7f9cd77..e643292 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 _0xf2cb=['bluebird','path','rimraf','exports','define','report_mail_transfer','uniqueid','util','api'];(function(_0x23287c,_0x1626ac){var _0x21590e=function(_0x4b8392){while(--_0x4b8392){_0x23287c['push'](_0x23287c['shift']());}};_0x21590e(++_0x1626ac);}(_0xf2cb,0x130));var _0xbf2c=function(_0x173635,_0x1b01c4){_0x173635=_0x173635-0x0;var _0x2084dc=_0xf2cb[_0x173635];return _0x2084dc;};'use strict';var _=require('lodash');var util=require(_0xbf2c('0x0'));var logger=require('../../config/logger')(_0xbf2c('0x1'));var moment=require('moment');var BPromise=require(_0xbf2c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf2c('0x3'));var rimraf=require(_0xbf2c('0x4'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0xbf2c('0x5')]=function(_0x46d282,_0x1fc371){return _0x46d282[_0xbf2c('0x6')]('MailTransferReport',attributes,{'tableName':_0xbf2c('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbf2c('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a3a=['./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x5ad2a5,_0x21cdfc){var _0x1c3ddf=function(_0x55a833){while(--_0x55a833){_0x5ad2a5['push'](_0x5ad2a5['shift']());}};_0x1c3ddf(++_0x21cdfc);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x265b2c,_0x310667){_0x265b2c=_0x265b2c-0x0;var _0x3b04ef=_0x2a3a[_0x265b2c];return _0x3b04ef;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[{'name':_0xa2a3('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0b73773..8a5c68b 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 _0xe148=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x190cdc,_0xc0b8bc){var _0x3d0eec=function(_0xa9ebcc){while(--_0xa9ebcc){_0x190cdc['push'](_0x190cdc['shift']());}};_0x3d0eec(++_0xc0b8bc);}(_0xe148,0xb4));var _0x8e14=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0xe148[_0x4f08dd];return _0x3017ee;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var moment=require(_0x8e14('0x2'));var BPromise=require(_0x8e14('0x3'));var rs=require(_0x8e14('0x4'));var fs=require('fs');var Redis=require(_0x8e14('0x5'));var db=require(_0x8e14('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e14('0x7'));var config=require(_0x8e14('0x8'));var jayson=require(_0x8e14('0x9'));var client=jayson['client'][_0x8e14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288e20,_0x2e2204,_0x222a5b){return new BPromise(function(_0x151b7f,_0xd183d1){return client[_0x8e14('0xb')](_0x288e20,_0x222a5b)[_0x8e14('0xc')](function(_0x18c858){logger[_0x8e14('0xd')](_0x8e14('0xe'),_0x2e2204,_0x8e14('0xf'));logger[_0x8e14('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2e2204,_0x8e14('0xf'),JSON[_0x8e14('0x11')](_0x18c858));if(_0x18c858[_0x8e14('0x12')]){if(_0x18c858[_0x8e14('0x12')][_0x8e14('0x13')]===0x1f4){logger[_0x8e14('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x2e2204,_0x18c858[_0x8e14('0x12')][_0x8e14('0x14')]);return _0xd183d1(_0x18c858[_0x8e14('0x12')][_0x8e14('0x14')]);}logger[_0x8e14('0x12')](_0x8e14('0xe'),_0x2e2204,_0x18c858[_0x8e14('0x12')]['message']);return _0x151b7f(_0x18c858[_0x8e14('0x12')][_0x8e14('0x14')]);}else{logger[_0x8e14('0xd')](_0x8e14('0xe'),_0x2e2204,_0x8e14('0xf'));_0x151b7f(_0x18c858[_0x8e14('0x15')][_0x8e14('0x14')]);}})[_0x8e14('0x16')](function(_0x324015){logger[_0x8e14('0x12')](_0x8e14('0xe'),_0x2e2204,_0x324015);_0xd183d1(_0x324015);});});} \ No newline at end of file +var _0xa3a8=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x2d42b7,_0x391076){var _0x3ac15a=function(_0x38ec34){while(--_0x38ec34){_0x2d42b7['push'](_0x2d42b7['shift']());}};_0x3ac15a(++_0x391076);}(_0xa3a8,0x163));var _0x8a3a=function(_0x1de545,_0xbe1a51){_0x1de545=_0x1de545-0x0;var _0x783196=_0xa3a8[_0x1de545];return _0x783196;};'use strict';var _=require(_0x8a3a('0x0'));var util=require(_0x8a3a('0x1'));var moment=require(_0x8a3a('0x2'));var BPromise=require(_0x8a3a('0x3'));var rs=require(_0x8a3a('0x4'));var fs=require('fs');var Redis=require(_0x8a3a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a3a('0x6'))(_0x8a3a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8a3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd9265b,_0x44da99,_0x1f5672){return new BPromise(function(_0x4982a7,_0x1ac9d6){return client[_0x8a3a('0x9')](_0xd9265b,_0x1f5672)[_0x8a3a('0xa')](function(_0x3b4ce5){logger['info'](_0x8a3a('0xb'),_0x44da99,'request\x20sent');logger[_0x8a3a('0xc')](_0x8a3a('0xd'),_0x44da99,_0x8a3a('0xe'),JSON[_0x8a3a('0xf')](_0x3b4ce5));if(_0x3b4ce5['error']){if(_0x3b4ce5['error'][_0x8a3a('0x10')]===0x1f4){logger[_0x8a3a('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x44da99,_0x3b4ce5[_0x8a3a('0x11')][_0x8a3a('0x12')]);return _0x1ac9d6(_0x3b4ce5[_0x8a3a('0x11')][_0x8a3a('0x12')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x44da99,_0x3b4ce5['error'][_0x8a3a('0x12')]);return _0x4982a7(_0x3b4ce5[_0x8a3a('0x11')][_0x8a3a('0x12')]);}else{logger[_0x8a3a('0x13')](_0x8a3a('0xb'),_0x44da99,'request\x20sent');_0x4982a7(_0x3b4ce5[_0x8a3a('0x14')][_0x8a3a('0x12')]);}})[_0x8a3a('0x15')](function(_0x32af42){logger['error'](_0x8a3a('0xb'),_0x44da99,_0x32af42);_0x1ac9d6(_0x32af42);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 17288d0..1a58566 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 _0xae35=['put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x363842,_0x369636){var _0x257bc2=function(_0x2516cf){while(--_0x2516cf){_0x363842['push'](_0x363842['shift']());}};_0x257bc2(++_0x369636);}(_0xae35,0x15a));var _0x5ae3=function(_0x4a3ac9,_0x5e9c32){_0x4a3ac9=_0x4a3ac9-0x0;var _0x292f6b=_0xae35[_0x4a3ac9];return _0x292f6b;};'use strict';var multer=require(_0x5ae3('0x0'));var util=require(_0x5ae3('0x1'));var path=require(_0x5ae3('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ae3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5ae3('0x4'));var interaction=require(_0x5ae3('0x5'));var config=require(_0x5ae3('0x6'));var controller=require('./memberReport.controller');router[_0x5ae3('0x7')]('/',auth[_0x5ae3('0x8')](),controller[_0x5ae3('0x9')]);router['get'](_0x5ae3('0xa'),auth[_0x5ae3('0x8')](),controller[_0x5ae3('0xb')]);router['get'](_0x5ae3('0xc'),auth[_0x5ae3('0x8')](),controller['show']);router[_0x5ae3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5ae3('0xe')](_0x5ae3('0xc'),auth[_0x5ae3('0x8')](),controller[_0x5ae3('0xf')]);router['delete'](_0x5ae3('0xc'),auth['isAuthenticated'](),controller[_0x5ae3('0x10')]);module[_0x5ae3('0x11')]=router; \ No newline at end of file +var _0xc13c=['delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','get','/describe','/:id','show','create'];(function(_0x68f77e,_0x43442e){var _0x59f8d4=function(_0x39d4e0){while(--_0x39d4e0){_0x68f77e['push'](_0x68f77e['shift']());}};_0x59f8d4(++_0x43442e);}(_0xc13c,0x19a));var _0xcc13=function(_0x3c3930,_0x56f942){_0x3c3930=_0x3c3930-0x0;var _0x2fc3d1=_0xc13c[_0x3c3930];return _0x2fc3d1;};'use strict';var multer=require(_0xcc13('0x0'));var util=require('util');var path=require(_0xcc13('0x1'));var timeout=require(_0xcc13('0x2'));var express=require('express');var router=express[_0xcc13('0x3')]();var fs_extra=require(_0xcc13('0x4'));var auth=require(_0xcc13('0x5'));var interaction=require(_0xcc13('0x6'));var config=require(_0xcc13('0x7'));var controller=require(_0xcc13('0x8'));router['get']('/',auth[_0xcc13('0x9')](),controller['index']);router[_0xcc13('0xa')](_0xcc13('0xb'),auth[_0xcc13('0x9')](),controller['describe']);router['get'](_0xcc13('0xc'),auth[_0xcc13('0x9')](),controller[_0xcc13('0xd')]);router['post']('/',auth[_0xcc13('0x9')](),controller[_0xcc13('0xe')]);router['put'](_0xcc13('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcc13('0xf')](_0xcc13('0xc'),auth[_0xcc13('0x9')](),controller['destroy']);module[_0xcc13('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7a59c7f..9bdc134 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 _0xb59b=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','seconds','setDataValue','duration'];(function(_0x58c8aa,_0x23e28b){var _0x146c62=function(_0x1d6009){while(--_0x1d6009){_0x58c8aa['push'](_0x58c8aa['shift']());}};_0x146c62(++_0x23e28b);}(_0xb59b,0x13f));var _0xbb59=function(_0x57779c,_0x45e538){_0x57779c=_0x57779c-0x0;var _0x51fe9e=_0xb59b[_0x57779c];return _0x51fe9e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbb59('0x0'));module[_0xbb59('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbb59('0x2')]},'interface':{'type':Sequelize[_0xbb59('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xbb59('0x3'),'comment':_0xbb59('0x4')},'duration':{'type':Sequelize[_0xbb59('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x17a81d){var _0x21fa19=moment(_0x17a81d);var _0x11beec=moment(this[_0xbb59('0x6')](_0xbb59('0x7')));var _0x32a97b=_0x21fa19['diff'](_0x11beec,_0xbb59('0x8'));this[_0xbb59('0x9')]('exitAt',_0x17a81d);this['setDataValue'](_0xbb59('0xa'),_0x32a97b>=0x0?_0x32a97b:null);}},'data1':{'type':Sequelize[_0xbb59('0x2')],'comment':_0xbb59('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xbb59('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xbb59('0xd')},'data4':{'type':Sequelize[_0xbb59('0x2')],'comment':_0xbb59('0xe')},'data5':{'type':Sequelize[_0xbb59('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xbb59('0x2')]},'internal':{'type':Sequelize[_0xbb59('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x494c=['enterAt','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','DATE'];(function(_0x1bf1e4,_0x1e95a7){var _0x432b17=function(_0x324504){while(--_0x324504){_0x1bf1e4['push'](_0x1bf1e4['shift']());}};_0x432b17(++_0x1e95a7);}(_0x494c,0x13f));var _0xc494=function(_0xcdbc36,_0x15a916){_0xcdbc36=_0xcdbc36-0x0;var _0x5ab354=_0x494c[_0xcdbc36];return _0x5ab354;};'use strict';var Sequelize=require(_0xc494('0x0'));var moment=require(_0xc494('0x1'));module['exports']={'channel':{'type':Sequelize[_0xc494('0x2')]},'membername':{'type':Sequelize[_0xc494('0x2')]},'interface':{'type':Sequelize[_0xc494('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xc494('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xc494('0x4')]},'exitAt':{'type':Sequelize[_0xc494('0x4')],'set':function(_0x1d8b2c){var _0x5a160c=moment(_0x1d8b2c);var _0x20b904=moment(this['getDataValue'](_0xc494('0x5')));var _0x3053e9=_0x5a160c['diff'](_0x20b904,_0xc494('0x6'));this[_0xc494('0x7')](_0xc494('0x8'),_0x1d8b2c);this['setDataValue'](_0xc494('0x9'),_0x3053e9>=0x0?_0x3053e9:null);}},'data1':{'type':Sequelize[_0xc494('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xc494('0x2')],'comment':_0xc494('0xa')},'data3':{'type':Sequelize[_0xc494('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xc494('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xc494('0x2')],'comment':_0xc494('0xb')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc494('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 6dad729..9b0cdfb 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xedd9,0xfc));var _0x9edd=function(_0x275c2f,_0x22e84c){_0x275c2f=_0x275c2f-0x0;var _0x353548=_0xedd9[_0x275c2f];return _0x353548;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55ca,0x126));var _0xa55c=function(_0x5ebe63,_0x2956bc){_0x5ebe63=_0x5ebe63-0x0;var _0x1f91ee=_0x55ca[_0x5ebe63];return _0x1f91ee;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3a10133..a8d0f54 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 _0x4da1=['exports','report_member','membername_interface','membername','lodash','util','../../config/logger','api','request-promise','path','rimraf','./memberReport.attributes'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x4da1,0x130));var _0x14da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4da1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x14da('0x0'));var util=require(_0x14da('0x1'));var logger=require(_0x14da('0x2'))(_0x14da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14da('0x4'));var fs=require('fs');var path=require(_0x14da('0x5'));var rimraf=require(_0x14da('0x6'));var config=require('../../config/environment');var attributes=require(_0x14da('0x7'));module[_0x14da('0x8')]=function(_0x4bd869,_0x22231b){return _0x4bd869['define']('MemberReport',attributes,{'tableName':_0x14da('0x9'),'paranoid':![],'indexes':[{'name':_0x14da('0xa'),'fields':[_0x14da('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc42f=['membername_interface','membername','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','MemberReport'];(function(_0x339cc0,_0x43f5b2){var _0x1984ac=function(_0x31e7c8){while(--_0x31e7c8){_0x339cc0['push'](_0x339cc0['shift']());}};_0x1984ac(++_0x43f5b2);}(_0xc42f,0xab));var _0xfc42=function(_0x5b2469,_0x5be9c0){_0x5b2469=_0x5b2469-0x0;var _0x36bc62=_0xc42f[_0x5b2469];return _0x36bc62;};'use strict';var _=require('lodash');var util=require(_0xfc42('0x0'));var logger=require(_0xfc42('0x1'))(_0xfc42('0x2'));var moment=require(_0xfc42('0x3'));var BPromise=require(_0xfc42('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc42('0x5'));var rimraf=require(_0xfc42('0x6'));var config=require(_0xfc42('0x7'));var attributes=require('./memberReport.attributes');module[_0xfc42('0x8')]=function(_0x4df648,_0x25c691){return _0x4df648[_0xfc42('0x9')](_0xfc42('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xfc42('0xb'),'fields':[_0xfc42('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 3f00d92..582ada1 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 _0xca84=['request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','MemberReport,\x20%s,\x20%s','result','catch','MemberReport','options','where','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','raw','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xca84,0xf5));var _0x4ca8=function(_0x24c733,_0x525907){_0x24c733=_0x24c733-0x0;var _0x21a2d3=_0xca84[_0x24c733];return _0x21a2d3;};'use strict';var _=require(_0x4ca8('0x0'));var util=require(_0x4ca8('0x1'));var moment=require(_0x4ca8('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ca8('0x3'));var fs=require('fs');var Redis=require(_0x4ca8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ca8('0x5'));var logger=require(_0x4ca8('0x6'))(_0x4ca8('0x7'));var config=require(_0x4ca8('0x8'));var jayson=require(_0x4ca8('0x9'));var client=jayson[_0x4ca8('0xa')][_0x4ca8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ca9f5,_0x386f34,_0x246619){return new BPromise(function(_0x52a992,_0x369958){return client['request'](_0x3ca9f5,_0x246619)[_0x4ca8('0xc')](function(_0x55748d){logger[_0x4ca8('0xd')]('MemberReport,\x20%s,\x20%s',_0x386f34,_0x4ca8('0xe'));logger[_0x4ca8('0xf')](_0x4ca8('0x10'),_0x386f34,_0x4ca8('0xe'),JSON[_0x4ca8('0x11')](_0x55748d));if(_0x55748d[_0x4ca8('0x12')]){if(_0x55748d[_0x4ca8('0x12')]['code']===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x386f34,_0x55748d['error'][_0x4ca8('0x13')]);return _0x369958(_0x55748d['error'][_0x4ca8('0x13')]);}logger[_0x4ca8('0x12')]('MemberReport,\x20%s,\x20%s',_0x386f34,_0x55748d['error'][_0x4ca8('0x13')]);return _0x52a992(_0x55748d[_0x4ca8('0x12')][_0x4ca8('0x13')]);}else{logger[_0x4ca8('0xd')](_0x4ca8('0x14'),_0x386f34,_0x4ca8('0xe'));_0x52a992(_0x55748d[_0x4ca8('0x15')][_0x4ca8('0x13')]);}})[_0x4ca8('0x16')](function(_0xd04c8a){logger[_0x4ca8('0x12')](_0x4ca8('0x14'),_0x386f34,_0xd04c8a);_0x369958(_0xd04c8a);});});}exports['GetMemberReport']=function(_0xedd3){var _0x41a736=this;return new Promise(function(_0x59e85b,_0x261e08){return db[_0x4ca8('0x17')]['findAll']({'raw':_0xedd3[_0x4ca8('0x18')]?_0xedd3[_0x4ca8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xedd3[_0x4ca8('0x18')]?_0xedd3['options'][_0x4ca8('0x19')]||null:null,'attributes':_0xedd3[_0x4ca8('0x18')]?_0xedd3[_0x4ca8('0x18')][_0x4ca8('0x1a')]||null:null,'limit':_0xedd3[_0x4ca8('0x18')]?_0xedd3['options'][_0x4ca8('0x1b')]||null:null,'include':_0xedd3[_0x4ca8('0x18')]?_0xedd3[_0x4ca8('0x18')][_0x4ca8('0x1c')]?_[_0x4ca8('0x1d')](_0xedd3['options'][_0x4ca8('0x1c')],function(_0x3691e2){return{'model':db[_0x3691e2[_0x4ca8('0x1e')]],'as':_0x3691e2['as'],'attributes':_0x3691e2[_0x4ca8('0x1a')],'include':_0x3691e2[_0x4ca8('0x1c')]?_['map'](_0x3691e2[_0x4ca8('0x1c')],function(_0x297341){return{'model':db[_0x297341[_0x4ca8('0x1e')]],'as':_0x297341['as'],'attributes':_0x297341['attributes'],'include':_0x297341[_0x4ca8('0x1c')]?_[_0x4ca8('0x1d')](_0x297341[_0x4ca8('0x1c')],function(_0x1f2231){return{'model':db[_0x1f2231['model']],'as':_0x1f2231['as'],'attributes':_0x1f2231[_0x4ca8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4ca8('0xc')](function(_0x5966d2){logger[_0x4ca8('0xd')](_0x4ca8('0x1f'),_0xedd3);logger[_0x4ca8('0xf')](_0x4ca8('0x1f'),_0xedd3,JSON[_0x4ca8('0x11')](_0x5966d2));_0x59e85b(_0x5966d2);})['catch'](function(_0xab2501){logger[_0x4ca8('0x12')]('GetMemberReport',_0xab2501[_0x4ca8('0x13')],_0xedd3);_0x261e08(_0x41a736[_0x4ca8('0x12')](0x1f4,_0xab2501[_0x4ca8('0x13')]));});});};exports[_0x4ca8('0x20')]=function(_0x4432e1){var _0x42e05f=this;return new Promise(function(_0x439b7a,_0x5b31a3){return db[_0x4ca8('0x17')][_0x4ca8('0x21')](_0x4432e1[_0x4ca8('0x22')],{'raw':_0x4432e1[_0x4ca8('0x18')]?_0x4432e1[_0x4ca8('0x18')][_0x4ca8('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x3f7c85){logger['info'](_0x4ca8('0x20'),_0x4432e1);logger[_0x4ca8('0xf')](_0x4ca8('0x20'),_0x4432e1,JSON[_0x4ca8('0x11')](_0x3f7c85));_0x439b7a(_0x3f7c85);})['catch'](function(_0x5e9d32){logger[_0x4ca8('0x12')]('CreateMemberReport',_0x5e9d32[_0x4ca8('0x13')],_0x4432e1);_0x5b31a3(_0x42e05f[_0x4ca8('0x12')](0x1f4,_0x5e9d32[_0x4ca8('0x13')]));});});};exports[_0x4ca8('0x24')]=function(_0x5a07d1){var _0x115ba0=this;return new Promise(function(_0x1f687e,_0x3e111e){return db['MemberReport']['update'](_0x5a07d1['body'],{'raw':_0x5a07d1['options']?_0x5a07d1[_0x4ca8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a07d1[_0x4ca8('0x18')]?_0x5a07d1[_0x4ca8('0x18')][_0x4ca8('0x19')]||null:null,'attributes':_0x5a07d1[_0x4ca8('0x18')]?_0x5a07d1[_0x4ca8('0x18')][_0x4ca8('0x1a')]||null:null,'limit':_0x5a07d1['options']?_0x5a07d1[_0x4ca8('0x18')][_0x4ca8('0x1b')]||null:null})[_0x4ca8('0xc')](function(_0x58a4c6){logger[_0x4ca8('0xd')](_0x4ca8('0x24'),_0x5a07d1);logger[_0x4ca8('0xf')](_0x4ca8('0x24'),_0x5a07d1,JSON[_0x4ca8('0x11')](_0x58a4c6));_0x1f687e(_0x58a4c6);})[_0x4ca8('0x16')](function(_0x31cc18){logger[_0x4ca8('0x12')](_0x4ca8('0x24'),_0x31cc18[_0x4ca8('0x13')],_0x5a07d1);_0x3e111e(_0x115ba0['error'](0x1f4,_0x31cc18[_0x4ca8('0x13')]));});});}; \ No newline at end of file +var _0xc61d=['options','raw','where','attributes','limit','include','model','map','then','stringify','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetMemberReport'];(function(_0x4f3416,_0x2910ea){var _0x229f9d=function(_0x4de2d1){while(--_0x4de2d1){_0x4f3416['push'](_0x4f3416['shift']());}};_0x229f9d(++_0x2910ea);}(_0xc61d,0xfb));var _0xdc61=function(_0x1cd567,_0x3dfd47){_0x1cd567=_0x1cd567-0x0;var _0x9c56b3=_0xc61d[_0x1cd567];return _0x9c56b3;};'use strict';var _=require(_0xdc61('0x0'));var util=require(_0xdc61('0x1'));var moment=require(_0xdc61('0x2'));var BPromise=require(_0xdc61('0x3'));var rs=require(_0xdc61('0x4'));var fs=require('fs');var Redis=require(_0xdc61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc61('0x6'));var logger=require(_0xdc61('0x7'))('rpc');var config=require(_0xdc61('0x8'));var jayson=require(_0xdc61('0x9'));var client=jayson[_0xdc61('0xa')][_0xdc61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3518fc,_0x84103c,_0x14899f){return new BPromise(function(_0x20bf1e,_0x26eb01){return client[_0xdc61('0xc')](_0x3518fc,_0x14899f)['then'](function(_0x3d38bc){logger[_0xdc61('0xd')](_0xdc61('0xe'),_0x84103c,_0xdc61('0xf'));logger[_0xdc61('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x84103c,_0xdc61('0xf'),JSON['stringify'](_0x3d38bc));if(_0x3d38bc[_0xdc61('0x11')]){if(_0x3d38bc['error'][_0xdc61('0x12')]===0x1f4){logger[_0xdc61('0x11')](_0xdc61('0xe'),_0x84103c,_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);return _0x26eb01(_0x3d38bc['error'][_0xdc61('0x13')]);}logger[_0xdc61('0x11')]('MemberReport,\x20%s,\x20%s',_0x84103c,_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);return _0x20bf1e(_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);}else{logger[_0xdc61('0xd')](_0xdc61('0xe'),_0x84103c,_0xdc61('0xf'));_0x20bf1e(_0x3d38bc[_0xdc61('0x14')][_0xdc61('0x13')]);}})['catch'](function(_0x356baf){logger[_0xdc61('0x11')](_0xdc61('0xe'),_0x84103c,_0x356baf);_0x26eb01(_0x356baf);});});}exports[_0xdc61('0x15')]=function(_0x45b7b7){var _0x393205=this;return new Promise(function(_0x2393a4,_0x5dbe97){return db['MemberReport']['findAll']({'raw':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7['options'][_0xdc61('0x17')]===undefined?!![]:![]:!![],'where':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7[_0xdc61('0x16')][_0xdc61('0x18')]||null:null,'attributes':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7['options'][_0xdc61('0x19')]||null:null,'limit':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7[_0xdc61('0x16')][_0xdc61('0x1a')]||null:null,'include':_0x45b7b7[_0xdc61('0x16')]?_0x45b7b7['options'][_0xdc61('0x1b')]?_['map'](_0x45b7b7['options']['include'],function(_0x42a52a){return{'model':db[_0x42a52a[_0xdc61('0x1c')]],'as':_0x42a52a['as'],'attributes':_0x42a52a['attributes'],'include':_0x42a52a[_0xdc61('0x1b')]?_[_0xdc61('0x1d')](_0x42a52a[_0xdc61('0x1b')],function(_0x40cf53){return{'model':db[_0x40cf53[_0xdc61('0x1c')]],'as':_0x40cf53['as'],'attributes':_0x40cf53[_0xdc61('0x19')],'include':_0x40cf53[_0xdc61('0x1b')]?_[_0xdc61('0x1d')](_0x40cf53['include'],function(_0x434095){return{'model':db[_0x434095[_0xdc61('0x1c')]],'as':_0x434095['as'],'attributes':_0x434095[_0xdc61('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdc61('0x1e')](function(_0x27109a){logger[_0xdc61('0xd')](_0xdc61('0x15'),_0x45b7b7);logger['debug'](_0xdc61('0x15'),_0x45b7b7,JSON[_0xdc61('0x1f')](_0x27109a));_0x2393a4(_0x27109a);})[_0xdc61('0x20')](function(_0xfc689f){logger['error'](_0xdc61('0x15'),_0xfc689f[_0xdc61('0x13')],_0x45b7b7);_0x5dbe97(_0x393205[_0xdc61('0x11')](0x1f4,_0xfc689f['message']));});});};exports[_0xdc61('0x21')]=function(_0x6305c1){var _0x593887=this;return new Promise(function(_0x1084de,_0x1fa029){return db[_0xdc61('0x22')][_0xdc61('0x23')](_0x6305c1[_0xdc61('0x24')],{'raw':_0x6305c1[_0xdc61('0x16')]?_0x6305c1[_0xdc61('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xdc61('0x1e')](function(_0x54c6e7){logger[_0xdc61('0xd')](_0xdc61('0x21'),_0x6305c1);logger[_0xdc61('0x10')](_0xdc61('0x21'),_0x6305c1,JSON[_0xdc61('0x1f')](_0x54c6e7));_0x1084de(_0x54c6e7);})[_0xdc61('0x20')](function(_0xa916fd){logger['error'](_0xdc61('0x21'),_0xa916fd[_0xdc61('0x13')],_0x6305c1);_0x1fa029(_0x593887[_0xdc61('0x11')](0x1f4,_0xa916fd[_0xdc61('0x13')]));});});};exports[_0xdc61('0x25')]=function(_0x5ccbed){var _0x15a6d1=this;return new Promise(function(_0x93aaa0,_0x20599c){return db['MemberReport'][_0xdc61('0x26')](_0x5ccbed[_0xdc61('0x24')],{'raw':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed[_0xdc61('0x16')][_0xdc61('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed[_0xdc61('0x16')][_0xdc61('0x18')]||null:null,'attributes':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed['options'][_0xdc61('0x19')]||null:null,'limit':_0x5ccbed[_0xdc61('0x16')]?_0x5ccbed[_0xdc61('0x16')]['limit']||null:null})[_0xdc61('0x1e')](function(_0x3f314d){logger[_0xdc61('0xd')]('UpdateMemberReport',_0x5ccbed);logger['debug'](_0xdc61('0x25'),_0x5ccbed,JSON[_0xdc61('0x1f')](_0x3f314d));_0x93aaa0(_0x3f314d);})['catch'](function(_0x555d94){logger[_0xdc61('0x11')](_0xdc61('0x25'),_0x555d94[_0xdc61('0x13')],_0x5ccbed);_0x20599c(_0x15a6d1['error'](0x1f4,_0x555d94[_0xdc61('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cd55c70..01f4114 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 _0x2e8a=['../../components/auth/service','index','exports','util','path','express','Router'];(function(_0x290800,_0x1f28ac){var _0x30e93b=function(_0x1fd14b){while(--_0x1fd14b){_0x290800['push'](_0x290800['shift']());}};_0x30e93b(++_0x1f28ac);}(_0x2e8a,0xc7));var _0xa2e8=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0x2e8a[_0xda6d0f];return _0x244540;};'use strict';var multer=require('multer');var util=require(_0xa2e8('0x0'));var path=require(_0xa2e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2e8('0x2'));var router=express[_0xa2e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa2e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller[_0xa2e8('0x5')]);module[_0xa2e8('0x6')]=router; \ No newline at end of file +var _0x4a38=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x4a38,0x1de));var _0x84a3=function(_0x446000,_0x35c950){_0x446000=_0x446000-0x0;var _0x4cd50f=_0x4a38[_0x446000];return _0x4cd50f;};'use strict';var multer=require(_0x84a3('0x0'));var util=require(_0x84a3('0x1'));var path=require('path');var timeout=require(_0x84a3('0x2'));var express=require('express');var router=express[_0x84a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x84a3('0x4'));var interaction=require(_0x84a3('0x5'));var config=require('../../config/environment');var controller=require(_0x84a3('0x6'));router[_0x84a3('0x7')]('/',controller['index']);module[_0x84a3('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 da8e877..b7b9a0d 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 _0xb9b4=['version','exports','STRING'];(function(_0x5750d4,_0x390825){var _0x1e72ce=function(_0x205a75){while(--_0x205a75){_0x5750d4['push'](_0x5750d4['shift']());}};_0x1e72ce(++_0x390825);}(_0xb9b4,0x187));var _0x4b9b=function(_0x4e18a0,_0x797094){_0x4e18a0=_0x4e18a0-0x0;var _0x5e7e32=_0xb9b4[_0x4e18a0];return _0x5e7e32;};'use strict';var Sequelize=require('sequelize');module[_0x4b9b('0x0')]={'version':{'type':Sequelize[_0x4b9b('0x1')],'unique':_0x4b9b('0x2')}}; \ No newline at end of file +var _0xec51=['STRING','version','sequelize'];(function(_0x14e1d2,_0x78d83c){var _0x11bdbd=function(_0x742841){while(--_0x742841){_0x14e1d2['push'](_0x14e1d2['shift']());}};_0x11bdbd(++_0x78d83c);}(_0xec51,0x8f));var _0x1ec5=function(_0x48bc0d,_0x30becd){_0x48bc0d=_0x48bc0d-0x0;var _0x35f641=_0xec51[_0x48bc0d];return _0x35f641;};'use strict';var Sequelize=require(_0x1ec5('0x0'));module['exports']={'version':{'type':Sequelize[_0x1ec5('0x1')],'unique':_0x1ec5('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8637991..e9bd987 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 _0x6790=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','offset','set','json','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','Migration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3d064a,_0x12cf18){var _0x5b2a83=function(_0x241866){while(--_0x241866){_0x3d064a['push'](_0x3d064a['shift']());}};_0x5b2a83(++_0x12cf18);}(_0x6790,0xba));var _0x0679=function(_0x5ae070,_0x23c722){_0x5ae070=_0x5ae070-0x0;var _0x29d88a=_0x6790[_0x5ae070];return _0x29d88a;};'use strict';var emlformat=require(_0x0679('0x0'));var rimraf=require(_0x0679('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0679('0x2'));var rp=require(_0x0679('0x3'));var moment=require(_0x0679('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0679('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0679('0x6'));var csv=require(_0x0679('0x7'));var ejs=require(_0x0679('0x8'));var fs=require('fs');var fs_extra=require(_0x0679('0x9'));var _=require(_0x0679('0xa'));var squel=require(_0x0679('0xb'));var crypto=require(_0x0679('0xc'));var jsforce=require(_0x0679('0xd'));var deskjs=require(_0x0679('0xe'));var toCsv=require(_0x0679('0x7'));var querystring=require(_0x0679('0xf'));var Papa=require(_0x0679('0x10'));var Redis=require(_0x0679('0x11'));var authService=require(_0x0679('0x12'));var qs=require(_0x0679('0x13'));var as=require(_0x0679('0x14'));var hardwareService=require(_0x0679('0x15'));var logger=require(_0x0679('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0679('0x17'));var licenseUtil=require(_0x0679('0x18'));var db=require(_0x0679('0x19'))['db'];function respondWithStatusCode(_0x5a12c8,_0x4a0cae){_0x4a0cae=_0x4a0cae||0xcc;return function(_0x2e3456){if(_0x2e3456){return _0x5a12c8['sendStatus'](_0x4a0cae);}return _0x5a12c8['status'](_0x4a0cae)['end']();};}function respondWithResult(_0x1500c8,_0x3c159b){_0x3c159b=_0x3c159b||0xc8;return function(_0x5bd7f5){if(_0x5bd7f5){return _0x1500c8[_0x0679('0x1a')](_0x3c159b)['json'](_0x5bd7f5);}};}function respondWithFilteredResult(_0x4859,_0x37595e){return function(_0xe85c8b){if(_0xe85c8b){var _0x4938b4=typeof _0x37595e['offset']===_0x0679('0x1b')&&typeof _0x37595e[_0x0679('0x1c')]===_0x0679('0x1b');var _0x367351=_0xe85c8b['count'];var _0x868357=_0x4938b4?0x0:_0x37595e[_0x0679('0x1d')];var _0x1ac361=_0x4938b4?_0xe85c8b['count']:_0x37595e[_0x0679('0x1d')]+_0x37595e[_0x0679('0x1c')];var _0x208b2e;if(_0x1ac361>=_0x367351){_0x1ac361=_0x367351;_0x208b2e=0xc8;}else{_0x208b2e=0xce;}_0x4859[_0x0679('0x1a')](_0x208b2e);return _0x4859[_0x0679('0x1e')]('Content-Range',_0x868357+'-'+_0x1ac361+'/'+_0x367351)[_0x0679('0x1f')](_0xe85c8b);}return null;};}function patchUpdates(_0xb7b9a8){return function(_0x2faec9){try{jsonpatch['apply'](_0x2faec9,_0xb7b9a8,!![]);}catch(_0x108390){return BPromise['reject'](_0x108390);}return _0x2faec9[_0x0679('0x20')]();};}function saveUpdates(_0x826a9a,_0x1ba574){return function(_0x5a320a){if(_0x5a320a){return _0x5a320a[_0x0679('0x21')](_0x826a9a)[_0x0679('0x22')](function(_0x2ee2d6){return _0x2ee2d6;});}return null;};}function removeEntity(_0x67de7e,_0x7b84e6){return function(_0x5eabcd){if(_0x5eabcd){return _0x5eabcd[_0x0679('0x23')]()['then'](function(){_0x67de7e[_0x0679('0x1a')](0xcc)[_0x0679('0x24')]();});}};}function handleEntityNotFound(_0x34311f,_0x5d2525){return function(_0x1af34f){if(!_0x1af34f){_0x34311f[_0x0679('0x25')](0x194);}return _0x1af34f;};}function handleError(_0x107233,_0x42d37c){_0x42d37c=_0x42d37c||0x1f4;return function(_0x54af35){logger[_0x0679('0x26')](_0x54af35[_0x0679('0x27')]);if(_0x54af35[_0x0679('0x28')]){delete _0x54af35[_0x0679('0x28')];}_0x107233[_0x0679('0x1a')](_0x42d37c)['send'](_0x54af35);};}exports[_0x0679('0x29')]=function(_0x8cc857,_0x28d8b4){var _0x2be961={},_0xf92c2b={},_0x646aa2={'count':0x0,'rows':[]};var _0x559977=_[_0x0679('0x2a')](db[_0x0679('0x2b')]['rawAttributes'],function(_0xdecc6c){return{'name':_0xdecc6c[_0x0679('0x2c')],'type':_0xdecc6c[_0x0679('0x2d')][_0x0679('0x2e')]};});_0xf92c2b[_0x0679('0x2f')]=_[_0x0679('0x2a')](_0x559977,_0x0679('0x28'));_0xf92c2b['query']=_[_0x0679('0x30')](_0x8cc857[_0x0679('0x31')]);_0xf92c2b[_0x0679('0x32')]=_[_0x0679('0x33')](_0xf92c2b[_0x0679('0x2f')],_0xf92c2b[_0x0679('0x31')]);_0x2be961[_0x0679('0x34')]=_[_0x0679('0x33')](_0xf92c2b[_0x0679('0x2f')],qs['fields'](_0x8cc857[_0x0679('0x31')][_0x0679('0x35')]));_0x2be961[_0x0679('0x34')]=_0x2be961[_0x0679('0x34')][_0x0679('0x36')]?_0x2be961['attributes']:_0xf92c2b[_0x0679('0x2f')];if(!_0x8cc857['query'][_0x0679('0x37')](_0x0679('0x38'))){_0x2be961[_0x0679('0x1c')]=qs[_0x0679('0x1c')](_0x8cc857[_0x0679('0x31')][_0x0679('0x1c')]);_0x2be961['offset']=qs[_0x0679('0x1d')](_0x8cc857['query']['offset']);}_0x2be961[_0x0679('0x39')]=qs['sort'](_0x8cc857['query'][_0x0679('0x3a')]);_0x2be961[_0x0679('0x3b')]=qs[_0x0679('0x32')](_[_0x0679('0x3c')](_0x8cc857[_0x0679('0x31')],_0xf92c2b[_0x0679('0x32')]),_0x559977);if(_0x8cc857['query'][_0x0679('0x3d')]){_0x2be961[_0x0679('0x3b')]=_[_0x0679('0x3e')](_0x2be961['where'],{'$or':_[_0x0679('0x2a')](_0x559977,function(_0x97f79a){if(_0x97f79a['type']!==_0x0679('0x3f')){var _0x7103b6={};_0x7103b6[_0x97f79a[_0x0679('0x28')]]={'$like':'%'+_0x8cc857['query'][_0x0679('0x3d')]+'%'};return _0x7103b6;}})});}_0x2be961=_[_0x0679('0x3e')]({},_0x2be961,_0x8cc857[_0x0679('0x40')]);var _0x526098={'where':_0x2be961[_0x0679('0x3b')]};return db[_0x0679('0x2b')][_0x0679('0x41')](_0x526098)[_0x0679('0x22')](function(_0xcfe15a){_0x646aa2['count']=_0xcfe15a;if(_0x8cc857[_0x0679('0x31')][_0x0679('0x42')]){_0x2be961[_0x0679('0x43')]=[{'all':!![]}];}return db[_0x0679('0x2b')]['findAll'](_0x2be961);})['then'](function(_0x14032e){_0x646aa2['rows']=_0x14032e;return _0x646aa2;})[_0x0679('0x22')](respondWithFilteredResult(_0x28d8b4,_0x2be961))[_0x0679('0x44')](handleError(_0x28d8b4,null));}; \ No newline at end of file +var _0xedf9=['name','send','map','Migration','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0xedf9,0x130));var _0x9edf=function(_0x1ee3e6,_0x3ef99f){_0x1ee3e6=_0x1ee3e6-0x0;var _0x4464f9=_0xedf9[_0x1ee3e6];return _0x4464f9;};'use strict';var emlformat=require(_0x9edf('0x0'));var rimraf=require(_0x9edf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9edf('0x2'));var moment=require('moment');var BPromise=require(_0x9edf('0x3'));var Mustache=require(_0x9edf('0x4'));var util=require(_0x9edf('0x5'));var path=require(_0x9edf('0x6'));var sox=require(_0x9edf('0x7'));var csv=require(_0x9edf('0x8'));var ejs=require(_0x9edf('0x9'));var fs=require('fs');var fs_extra=require(_0x9edf('0xa'));var _=require(_0x9edf('0xb'));var squel=require(_0x9edf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9edf('0xd'));var toCsv=require(_0x9edf('0x8'));var querystring=require('querystring');var Papa=require(_0x9edf('0xe'));var Redis=require(_0x9edf('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9edf('0x10'));var as=require(_0x9edf('0x11'));var hardwareService=require(_0x9edf('0x12'));var logger=require(_0x9edf('0x13'))(_0x9edf('0x14'));var utils=require(_0x9edf('0x15'));var config=require(_0x9edf('0x16'));var licenseUtil=require(_0x9edf('0x17'));var db=require(_0x9edf('0x18'))['db'];function respondWithStatusCode(_0x4dcfd8,_0x108e04){_0x108e04=_0x108e04||0xcc;return function(_0x5289c5){if(_0x5289c5){return _0x4dcfd8[_0x9edf('0x19')](_0x108e04);}return _0x4dcfd8[_0x9edf('0x1a')](_0x108e04)[_0x9edf('0x1b')]();};}function respondWithResult(_0x2d94e9,_0x5e3852){_0x5e3852=_0x5e3852||0xc8;return function(_0x3beea4){if(_0x3beea4){return _0x2d94e9[_0x9edf('0x1a')](_0x5e3852)[_0x9edf('0x1c')](_0x3beea4);}};}function respondWithFilteredResult(_0x5a54a2,_0x51659d){return function(_0x1b7247){if(_0x1b7247){var _0x2ee789=typeof _0x51659d[_0x9edf('0x1d')]===_0x9edf('0x1e')&&typeof _0x51659d[_0x9edf('0x1f')]===_0x9edf('0x1e');var _0x283841=_0x1b7247[_0x9edf('0x20')];var _0x246711=_0x2ee789?0x0:_0x51659d[_0x9edf('0x1d')];var _0x6744d4=_0x2ee789?_0x1b7247[_0x9edf('0x20')]:_0x51659d['offset']+_0x51659d[_0x9edf('0x1f')];var _0x5a652f;if(_0x6744d4>=_0x283841){_0x6744d4=_0x283841;_0x5a652f=0xc8;}else{_0x5a652f=0xce;}_0x5a54a2[_0x9edf('0x1a')](_0x5a652f);return _0x5a54a2['set'](_0x9edf('0x21'),_0x246711+'-'+_0x6744d4+'/'+_0x283841)[_0x9edf('0x1c')](_0x1b7247);}return null;};}function patchUpdates(_0x32e6ed){return function(_0x477663){try{jsonpatch[_0x9edf('0x22')](_0x477663,_0x32e6ed,!![]);}catch(_0x945520){return BPromise[_0x9edf('0x23')](_0x945520);}return _0x477663[_0x9edf('0x24')]();};}function saveUpdates(_0x40bb10,_0x409686){return function(_0x1df3c6){if(_0x1df3c6){return _0x1df3c6[_0x9edf('0x25')](_0x40bb10)[_0x9edf('0x26')](function(_0xf11c57){return _0xf11c57;});}return null;};}function removeEntity(_0x56f461,_0x4f3f9c){return function(_0x479c6f){if(_0x479c6f){return _0x479c6f['destroy']()[_0x9edf('0x26')](function(){_0x56f461[_0x9edf('0x1a')](0xcc)[_0x9edf('0x1b')]();});}};}function handleEntityNotFound(_0x43d02d,_0x35449d){return function(_0x325d1d){if(!_0x325d1d){_0x43d02d['sendStatus'](0x194);}return _0x325d1d;};}function handleError(_0x5028a8,_0x351f9d){_0x351f9d=_0x351f9d||0x1f4;return function(_0x5a2fd5){logger[_0x9edf('0x27')](_0x5a2fd5[_0x9edf('0x28')]);if(_0x5a2fd5[_0x9edf('0x29')]){delete _0x5a2fd5[_0x9edf('0x29')];}_0x5028a8['status'](_0x351f9d)[_0x9edf('0x2a')](_0x5a2fd5);};}exports['index']=function(_0x52a1ee,_0xe7b4f4){var _0x3a600c={},_0x4e4154={},_0xf2181a={'count':0x0,'rows':[]};var _0x213069=_[_0x9edf('0x2b')](db[_0x9edf('0x2c')][_0x9edf('0x2d')],function(_0x2b5c12){return{'name':_0x2b5c12[_0x9edf('0x2e')],'type':_0x2b5c12[_0x9edf('0x2f')]['key']};});_0x4e4154['model']=_[_0x9edf('0x2b')](_0x213069,'name');_0x4e4154['query']=_['keys'](_0x52a1ee[_0x9edf('0x30')]);_0x4e4154[_0x9edf('0x31')]=_[_0x9edf('0x32')](_0x4e4154[_0x9edf('0x33')],_0x4e4154[_0x9edf('0x30')]);_0x3a600c['attributes']=_['intersection'](_0x4e4154['model'],qs['fields'](_0x52a1ee[_0x9edf('0x30')][_0x9edf('0x34')]));_0x3a600c[_0x9edf('0x35')]=_0x3a600c[_0x9edf('0x35')][_0x9edf('0x36')]?_0x3a600c[_0x9edf('0x35')]:_0x4e4154[_0x9edf('0x33')];if(!_0x52a1ee[_0x9edf('0x30')][_0x9edf('0x37')](_0x9edf('0x38'))){_0x3a600c[_0x9edf('0x1f')]=qs[_0x9edf('0x1f')](_0x52a1ee[_0x9edf('0x30')][_0x9edf('0x1f')]);_0x3a600c[_0x9edf('0x1d')]=qs[_0x9edf('0x1d')](_0x52a1ee['query'][_0x9edf('0x1d')]);}_0x3a600c[_0x9edf('0x39')]=qs[_0x9edf('0x3a')](_0x52a1ee[_0x9edf('0x30')][_0x9edf('0x3a')]);_0x3a600c[_0x9edf('0x3b')]=qs[_0x9edf('0x31')](_[_0x9edf('0x3c')](_0x52a1ee[_0x9edf('0x30')],_0x4e4154[_0x9edf('0x31')]),_0x213069);if(_0x52a1ee[_0x9edf('0x30')][_0x9edf('0x3d')]){_0x3a600c['where']=_[_0x9edf('0x3e')](_0x3a600c[_0x9edf('0x3b')],{'$or':_[_0x9edf('0x2b')](_0x213069,function(_0x44d9c6){if(_0x44d9c6[_0x9edf('0x2f')]!=='VIRTUAL'){var _0x50c50a={};_0x50c50a[_0x44d9c6[_0x9edf('0x29')]]={'$like':'%'+_0x52a1ee['query']['filter']+'%'};return _0x50c50a;}})});}_0x3a600c=_['merge']({},_0x3a600c,_0x52a1ee[_0x9edf('0x3f')]);var _0x88290c={'where':_0x3a600c[_0x9edf('0x3b')]};return db[_0x9edf('0x2c')][_0x9edf('0x20')](_0x88290c)[_0x9edf('0x26')](function(_0x2d455b){_0xf2181a[_0x9edf('0x20')]=_0x2d455b;if(_0x52a1ee[_0x9edf('0x30')][_0x9edf('0x40')]){_0x3a600c[_0x9edf('0x41')]=[{'all':!![]}];}return db[_0x9edf('0x2c')][_0x9edf('0x42')](_0x3a600c);})[_0x9edf('0x26')](function(_0x7263f0){_0xf2181a[_0x9edf('0x43')]=_0x7263f0;return _0xf2181a;})[_0x9edf('0x26')](respondWithFilteredResult(_0xe7b4f4,_0x3a600c))[_0x9edf('0x44')](handleError(_0xe7b4f4,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index d57a45f..e851122 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 _0xe039=['define','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0x3f8429,_0x10d02e){var _0xd51179=function(_0x516f62){while(--_0x516f62){_0x3f8429['push'](_0x3f8429['shift']());}};_0xd51179(++_0x10d02e);}(_0xe039,0x140));var _0x9e03=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xe039[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x9e03('0x0'));var util=require(_0x9e03('0x1'));var logger=require(_0x9e03('0x2'))('api');var moment=require(_0x9e03('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e03('0x4'));var fs=require('fs');var path=require(_0x9e03('0x5'));var rimraf=require(_0x9e03('0x6'));var config=require(_0x9e03('0x7'));var attributes=require(_0x9e03('0x8'));module[_0x9e03('0x9')]=function(_0x1b8415,_0x1fae70){return _0x1b8415[_0x9e03('0xa')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa98c=['api','moment','bluebird','request-promise','../../config/environment','./migration.attributes','Migration','migrations','lodash','../../config/logger'];(function(_0x3d1c5d,_0x14bb57){var _0x33eccf=function(_0x57f1d1){while(--_0x57f1d1){_0x3d1c5d['push'](_0x3d1c5d['shift']());}};_0x33eccf(++_0x14bb57);}(_0xa98c,0xda));var _0xca98=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xa98c[_0x61b3ab];return _0x57097f;};'use strict';var _=require(_0xca98('0x0'));var util=require('util');var logger=require(_0xca98('0x1'))(_0xca98('0x2'));var moment=require(_0xca98('0x3'));var BPromise=require(_0xca98('0x4'));var rp=require(_0xca98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca98('0x6'));var attributes=require(_0xca98('0x7'));module['exports']=function(_0x1664f0,_0x57eef9){return _0x1664f0['define'](_0xca98('0x8'),attributes,{'tableName':_0xca98('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 0f3798c..f61b530 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 _0xc94f=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Migration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x18b8cf,_0x5fc643){var _0x292f08=function(_0x2a90a3){while(--_0x2a90a3){_0x18b8cf['push'](_0x18b8cf['shift']());}};_0x292f08(++_0x5fc643);}(_0xc94f,0xcd));var _0xfc94=function(_0x3ac8c9,_0x353ea9){_0x3ac8c9=_0x3ac8c9-0x0;var _0x5ee2d1=_0xc94f[_0x3ac8c9];return _0x5ee2d1;};'use strict';var _=require(_0xfc94('0x0'));var util=require('util');var moment=require(_0xfc94('0x1'));var BPromise=require(_0xfc94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc94('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc94('0x4'));var logger=require(_0xfc94('0x5'))(_0xfc94('0x6'));var config=require(_0xfc94('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x402ee9,_0xff28ad,_0x4dc395){return new BPromise(function(_0xe044e8,_0x47afb8){return client[_0xfc94('0x8')](_0x402ee9,_0x4dc395)[_0xfc94('0x9')](function(_0x4212af){logger[_0xfc94('0xa')]('Migration,\x20%s,\x20%s',_0xff28ad,'request\x20sent');logger[_0xfc94('0xb')](_0xfc94('0xc'),_0xff28ad,_0xfc94('0xd'),JSON[_0xfc94('0xe')](_0x4212af));if(_0x4212af[_0xfc94('0xf')]){if(_0x4212af[_0xfc94('0xf')]['code']===0x1f4){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0x47afb8(_0x4212af[_0xfc94('0xf')]['message']);}logger[_0xfc94('0xf')](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0xe044e8(_0x4212af[_0xfc94('0xf')]['message']);}else{logger[_0xfc94('0xa')]('Migration,\x20%s,\x20%s',_0xff28ad,_0xfc94('0xd'));_0xe044e8(_0x4212af['result'][_0xfc94('0x11')]);}})[_0xfc94('0x12')](function(_0x2f7bd6){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x2f7bd6);_0x47afb8(_0x2f7bd6);});});} \ No newline at end of file +var _0x91a7=['message','Migration,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0xd8684d,_0x1f84e8){var _0x1ff661=function(_0x16a85b){while(--_0x16a85b){_0xd8684d['push'](_0xd8684d['shift']());}};_0x1ff661(++_0x1f84e8);}(_0x91a7,0xe7));var _0x791a=function(_0x3c1328,_0x237895){_0x3c1328=_0x3c1328-0x0;var _0x3a0544=_0x91a7[_0x3c1328];return _0x3a0544;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('Migration,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('Migration,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('Migration,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('Migration,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 403f997..f631477 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 _0x804d=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2dc7ae,_0xd42e10){var _0x50d64e=function(_0x3d5881){while(--_0x3d5881){_0x2dc7ae['push'](_0x2dc7ae['shift']());}};_0x50d64e(++_0xd42e10);}(_0x804d,0x116));var _0xd804=function(_0x590cf1,_0x1ed895){_0x590cf1=_0x590cf1-0x0;var _0x57e326=_0x804d[_0x590cf1];return _0x57e326;};'use strict';var multer=require(_0xd804('0x0'));var util=require(_0xd804('0x1'));var path=require(_0xd804('0x2'));var timeout=require(_0xd804('0x3'));var express=require(_0xd804('0x4'));var router=express[_0xd804('0x5')]();var fs_extra=require(_0xd804('0x6'));var auth=require(_0xd804('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd804('0x8'));var controller=require(_0xd804('0x9'));router[_0xd804('0xa')]('/',auth[_0xd804('0xb')](),controller[_0xd804('0xc')]);router[_0xd804('0xa')](_0xd804('0xd'),auth[_0xd804('0xb')](),controller[_0xd804('0xe')]);router[_0xd804('0xf')]('/',auth[_0xd804('0xb')](),controller[_0xd804('0x10')]);router['put'](_0xd804('0xd'),auth[_0xd804('0xb')](),controller[_0xd804('0x11')]);router[_0xd804('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd804('0x13')]);module[_0xd804('0x14')]=router; \ No newline at end of file +var _0x543b=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var path=require(_0xb543('0x2'));var timeout=require('connect-timeout');var express=require(_0xb543('0x3'));var router=express[_0xb543('0x4')]();var fs_extra=require(_0xb543('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb543('0x6'));var config=require(_0xb543('0x7'));var controller=require(_0xb543('0x8'));router[_0xb543('0x9')]('/',auth[_0xb543('0xa')](),controller[_0xb543('0xb')]);router[_0xb543('0x9')](_0xb543('0xc'),auth[_0xb543('0xa')](),controller[_0xb543('0xd')]);router[_0xb543('0xe')]('/',auth[_0xb543('0xa')](),controller['create']);router[_0xb543('0xf')]('/:id',auth[_0xb543('0xa')](),controller[_0xb543('0x10')]);router[_0xb543('0x11')](_0xb543('0xc'),auth[_0xb543('0xa')](),controller[_0xb543('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9d010a0..0fb4093 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 _0x9550=['externip','turn','STRING','sequelize','ENUM','localnet'];(function(_0xfc6c4,_0x127a42){var _0x40fb3c=function(_0x1f5e92){while(--_0x1f5e92){_0xfc6c4['push'](_0xfc6c4['shift']());}};_0x40fb3c(++_0x127a42);}(_0x9550,0x1d7));var _0x0955=function(_0x3d076f,_0x56c0a1){_0x3d076f=_0x3d076f-0x0;var _0xd2c14d=_0x9550[_0x3d076f];return _0xd2c14d;};'use strict';var Sequelize=require(_0x0955('0x0'));module['exports']={'type':{'type':Sequelize[_0x0955('0x1')](_0x0955('0x2'),_0x0955('0x3'),'stun',_0x0955('0x4'))},'value':{'type':Sequelize[_0x0955('0x5')]},'username':{'type':Sequelize[_0x0955('0x5')]},'password':{'type':Sequelize[_0x0955('0x5')]}}; \ No newline at end of file +var _0x815b=['externip','stun','turn','STRING','exports','ENUM','localnet'];(function(_0x502c05,_0x551c7f){var _0x3c45c8=function(_0x1509cb){while(--_0x1509cb){_0x502c05['push'](_0x502c05['shift']());}};_0x3c45c8(++_0x551c7f);}(_0x815b,0x66));var _0xb815=function(_0x5a7bda,_0x29629f){_0x5a7bda=_0x5a7bda-0x0;var _0x25505d=_0x815b[_0x5a7bda];return _0x25505d;};'use strict';var Sequelize=require('sequelize');module[_0xb815('0x0')]={'type':{'type':Sequelize[_0xb815('0x1')](_0xb815('0x2'),_0xb815('0x3'),_0xb815('0x4'),_0xb815('0x5'))},'value':{'type':Sequelize[_0xb815('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb815('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 34c1f09..c0ec3c5 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 _0xcba7=['info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','filter','where','merge','options','Network','include','findAll','rows','show','params','fields','includeAll','catch','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','transaction','find','server/files/templates/stun_multiple.ejs','update','TURN','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcba7,0x199));var _0x7cba=function(_0x5767b2,_0x4da302){_0x5767b2=_0x5767b2-0x0;var _0x5c746a=_0xcba7[_0x5767b2];return _0x5c746a;};'use strict';var emlformat=require(_0x7cba('0x0'));var rimraf=require(_0x7cba('0x1'));var zipdir=require(_0x7cba('0x2'));var jsonpatch=require(_0x7cba('0x3'));var rp=require('request-promise');var moment=require(_0x7cba('0x4'));var BPromise=require(_0x7cba('0x5'));var Mustache=require(_0x7cba('0x6'));var util=require('util');var path=require(_0x7cba('0x7'));var sox=require(_0x7cba('0x8'));var csv=require(_0x7cba('0x9'));var ejs=require(_0x7cba('0xa'));var fs=require('fs');var fs_extra=require(_0x7cba('0xb'));var _=require(_0x7cba('0xc'));var squel=require(_0x7cba('0xd'));var crypto=require(_0x7cba('0xe'));var jsforce=require(_0x7cba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7cba('0x9'));var querystring=require(_0x7cba('0x10'));var Papa=require(_0x7cba('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7cba('0x12'));var as=require(_0x7cba('0x13'));var hardwareService=require(_0x7cba('0x14'));var logger=require(_0x7cba('0x15'))('api');var utils=require(_0x7cba('0x16'));var config=require(_0x7cba('0x17'));var licenseUtil=require(_0x7cba('0x18'));var db=require(_0x7cba('0x19'))['db'];var jayson=require(_0x7cba('0x1a'));var client=jayson[_0x7cba('0x1b')][_0x7cba('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3ed673,_0x2647b9,_0x406553,_0x156734){return new BPromise(function(_0x1be614,_0x584769){var _0x5877da=_0x156734||client;return _0x5877da[_0x7cba('0x1d')](_0x3ed673,_0x406553)[_0x7cba('0x1e')](function(_0x39585b){logger[_0x7cba('0x1f')](_0x7cba('0x20'),_0x2647b9,_0x7cba('0x21'));logger[_0x7cba('0x22')](_0x7cba('0x23'),_0x2647b9,_0x7cba('0x21'),JSON[_0x7cba('0x24')](_0x39585b));if(_0x39585b['error']){if(_0x39585b[_0x7cba('0x25')]['code']===0x1f4){logger['error'](_0x7cba('0x20'),_0x2647b9,_0x39585b[_0x7cba('0x25')][_0x7cba('0x26')]);return _0x584769(_0x39585b['error'][_0x7cba('0x26')]);}logger['error'](_0x7cba('0x20'),_0x2647b9,_0x39585b['error']['message']);return _0x1be614(_0x39585b[_0x7cba('0x25')][_0x7cba('0x26')]);}else{logger[_0x7cba('0x1f')](_0x7cba('0x20'),_0x2647b9,_0x7cba('0x21'));_0x1be614(_0x39585b['result'][_0x7cba('0x26')]);}})['catch'](function(_0xb8ae3d){logger[_0x7cba('0x25')](_0x7cba('0x20'),_0x2647b9,_0xb8ae3d);_0x584769(_0xb8ae3d);});});}function respondWithStatusCode(_0x3b3b75,_0xf41e2b){_0xf41e2b=_0xf41e2b||0xcc;return function(_0x3cd540){if(_0x3cd540){return _0x3b3b75[_0x7cba('0x27')](_0xf41e2b);}return _0x3b3b75[_0x7cba('0x28')](_0xf41e2b)[_0x7cba('0x29')]();};}function respondWithResult(_0x5b5c81,_0x4e5974){_0x4e5974=_0x4e5974||0xc8;return function(_0x1c9535){if(_0x1c9535){return _0x5b5c81['status'](_0x4e5974)[_0x7cba('0x2a')](_0x1c9535);}};}function respondWithFilteredResult(_0x3c9dc0,_0x369b14){return function(_0x109dfa){if(_0x109dfa){var _0x1cb91a=typeof _0x369b14['offset']===_0x7cba('0x2b')&&typeof _0x369b14['limit']==='undefined';var _0xd9b2af=_0x109dfa[_0x7cba('0x2c')];var _0x34a121=_0x1cb91a?0x0:_0x369b14[_0x7cba('0x2d')];var _0x2f4f15=_0x1cb91a?_0x109dfa[_0x7cba('0x2c')]:_0x369b14[_0x7cba('0x2d')]+_0x369b14[_0x7cba('0x2e')];var _0x2d7d3c;if(_0x2f4f15>=_0xd9b2af){_0x2f4f15=_0xd9b2af;_0x2d7d3c=0xc8;}else{_0x2d7d3c=0xce;}_0x3c9dc0['status'](_0x2d7d3c);return _0x3c9dc0[_0x7cba('0x2f')]('Content-Range',_0x34a121+'-'+_0x2f4f15+'/'+_0xd9b2af)[_0x7cba('0x2a')](_0x109dfa);}return null;};}function patchUpdates(_0x404dec){return function(_0x34b9e6){try{jsonpatch[_0x7cba('0x30')](_0x34b9e6,_0x404dec,!![]);}catch(_0x42f825){return BPromise[_0x7cba('0x31')](_0x42f825);}return _0x34b9e6[_0x7cba('0x32')]();};}function saveUpdates(_0x22f7bc,_0x4e9e93){return function(_0x27837b){if(_0x27837b){return _0x27837b['update'](_0x22f7bc)[_0x7cba('0x1e')](function(_0x13fdbd){return _0x13fdbd;});}return null;};}function removeEntity(_0x3d29d1,_0x1863d0){return function(_0x11d6a0){if(_0x11d6a0){return _0x11d6a0[_0x7cba('0x33')]()['then'](function(){_0x3d29d1['status'](0xcc)[_0x7cba('0x29')]();});}};}function handleEntityNotFound(_0x76b32d,_0x73614f){return function(_0x51061b){if(!_0x51061b){_0x76b32d['sendStatus'](0x194);}return _0x51061b;};}function handleError(_0x15da45,_0x49651b){_0x49651b=_0x49651b||0x1f4;return function(_0x3a2844){logger[_0x7cba('0x25')](_0x3a2844[_0x7cba('0x34')]);if(_0x3a2844[_0x7cba('0x35')]){delete _0x3a2844[_0x7cba('0x35')];}_0x15da45['status'](_0x49651b)[_0x7cba('0x36')](_0x3a2844);};}exports[_0x7cba('0x37')]=function(_0x4687ac,_0x540b9a){var _0x4c91af={},_0x1dc306={},_0x5c4558={'count':0x0,'rows':[]};var _0x202c55=_[_0x7cba('0x38')](db['Network'][_0x7cba('0x39')],function(_0x2b8460){return{'name':_0x2b8460[_0x7cba('0x3a')],'type':_0x2b8460[_0x7cba('0x3b')][_0x7cba('0x3c')]};});_0x1dc306[_0x7cba('0x3d')]=_[_0x7cba('0x38')](_0x202c55,_0x7cba('0x35'));_0x1dc306['query']=_[_0x7cba('0x3e')](_0x4687ac[_0x7cba('0x3f')]);_0x1dc306[_0x7cba('0x40')]=_[_0x7cba('0x41')](_0x1dc306[_0x7cba('0x3d')],_0x1dc306[_0x7cba('0x3f')]);_0x4c91af[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x1dc306[_0x7cba('0x3d')],qs['fields'](_0x4687ac['query']['fields']));_0x4c91af['attributes']=_0x4c91af['attributes'][_0x7cba('0x43')]?_0x4c91af[_0x7cba('0x42')]:_0x1dc306[_0x7cba('0x3d')];if(!_0x4687ac['query']['hasOwnProperty'](_0x7cba('0x44'))){_0x4c91af[_0x7cba('0x2e')]=qs['limit'](_0x4687ac[_0x7cba('0x3f')][_0x7cba('0x2e')]);_0x4c91af[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x4687ac[_0x7cba('0x3f')]['offset']);}_0x4c91af[_0x7cba('0x45')]=qs[_0x7cba('0x46')](_0x4687ac[_0x7cba('0x3f')][_0x7cba('0x46')]);_0x4c91af['where']=qs[_0x7cba('0x40')](_['pick'](_0x4687ac[_0x7cba('0x3f')],_0x1dc306[_0x7cba('0x40')]),_0x202c55);if(_0x4687ac[_0x7cba('0x3f')][_0x7cba('0x47')]){_0x4c91af[_0x7cba('0x48')]=_[_0x7cba('0x49')](_0x4c91af[_0x7cba('0x48')],{'$or':_['map'](_0x202c55,function(_0x52630c){if(_0x52630c[_0x7cba('0x3b')]!=='VIRTUAL'){var _0x56772a={};_0x56772a[_0x52630c[_0x7cba('0x35')]]={'$like':'%'+_0x4687ac[_0x7cba('0x3f')][_0x7cba('0x47')]+'%'};return _0x56772a;}})});}_0x4c91af=_[_0x7cba('0x49')]({},_0x4c91af,_0x4687ac[_0x7cba('0x4a')]);var _0x367604={'where':_0x4c91af[_0x7cba('0x48')]};return db[_0x7cba('0x4b')][_0x7cba('0x2c')](_0x367604)[_0x7cba('0x1e')](function(_0x371443){_0x5c4558['count']=_0x371443;if(_0x4687ac['query']['includeAll']){_0x4c91af[_0x7cba('0x4c')]=[{'all':!![]}];}return db['Network'][_0x7cba('0x4d')](_0x4c91af);})[_0x7cba('0x1e')](function(_0xe5a337){_0x5c4558[_0x7cba('0x4e')]=_0xe5a337;return _0x5c4558;})[_0x7cba('0x1e')](respondWithFilteredResult(_0x540b9a,_0x4c91af))['catch'](handleError(_0x540b9a,null));};exports[_0x7cba('0x4f')]=function(_0x3acbf2,_0x5b077f){var _0x6e8ab7={'raw':!![],'where':{'id':_0x3acbf2[_0x7cba('0x50')]['id']}},_0x42d1b0={};_0x42d1b0['model']=_['keys'](db[_0x7cba('0x4b')][_0x7cba('0x39')]);_0x42d1b0[_0x7cba('0x3f')]=_[_0x7cba('0x3e')](_0x3acbf2['query']);_0x42d1b0[_0x7cba('0x40')]=_[_0x7cba('0x41')](_0x42d1b0[_0x7cba('0x3d')],_0x42d1b0[_0x7cba('0x3f')]);_0x6e8ab7[_0x7cba('0x42')]=_['intersection'](_0x42d1b0[_0x7cba('0x3d')],qs['fields'](_0x3acbf2[_0x7cba('0x3f')][_0x7cba('0x51')]));_0x6e8ab7[_0x7cba('0x42')]=_0x6e8ab7['attributes'][_0x7cba('0x43')]?_0x6e8ab7[_0x7cba('0x42')]:_0x42d1b0[_0x7cba('0x3d')];if(_0x3acbf2['query'][_0x7cba('0x52')]){_0x6e8ab7[_0x7cba('0x4c')]=[{'all':!![]}];}_0x6e8ab7=_[_0x7cba('0x49')]({},_0x6e8ab7,_0x3acbf2['options']);return db[_0x7cba('0x4b')]['find'](_0x6e8ab7)['then'](handleEntityNotFound(_0x5b077f,null))[_0x7cba('0x1e')](respondWithResult(_0x5b077f,null))[_0x7cba('0x53')](handleError(_0x5b077f,null));};exports[_0x7cba('0x54')]=function(_0x59709c,_0x23f2a0,_0x1d84f3){var _0x46abb9;return db['sequelize']['transaction'](function(_0x4a3c52){return db[_0x7cba('0x4b')][_0x7cba('0x54')](_0x59709c['body'],{'raw':!![]})['then'](function(_0x101f19){_0x46abb9=_0x101f19;return db[_0x7cba('0x4b')]['findAll']({'where':{'type':_0x59709c[_0x7cba('0x55')][_0x7cba('0x3b')]},'raw':!![]});})[_0x7cba('0x1e')](function(_0x45b0ab){if(_0x46abb9[_0x7cba('0x3b')][_0x7cba('0x56')]()==_0x7cba('0x57')){var _0x3c2e46=fs[_0x7cba('0x58')](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x7cba('0x5b'));var _0x31af29=ejs['render'](_0x3c2e46,{'networks':_0x45b0ab||[]});fs[_0x7cba('0x5c')](_0x7cba('0x5d'),_0x31af29);return respondWithRpcPromise(_0x7cba('0x5e'),'create',{'module':_0x7cba('0x5f')});}else if(_0x46abb9['type'][_0x7cba('0x56')]()=='TURN'){var _0x3d21a2=fs[_0x7cba('0x58')](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],_0x7cba('0x60')),_0x7cba('0x5b'));var _0x15ffaf=ejs['render'](_0x3d21a2,{'networks':_0x45b0ab||[]});fs[_0x7cba('0x5c')](_0x7cba('0x61'),_0x15ffaf);return respondWithRpcPromise(_0x7cba('0x5e'),_0x7cba('0x54'),{'module':_0x7cba('0x5f')});}else{var _0x4c6dfc=fs['readFileSync'](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],_0x7cba('0x62')),_0x7cba('0x5b'));var _0x1eae7d=ejs[_0x7cba('0x63')](_0x4c6dfc,{'networks':_0x45b0ab||[]});fs[_0x7cba('0x5c')](util[_0x7cba('0x64')](_0x7cba('0x65'),_0x59709c[_0x7cba('0x55')][_0x7cba('0x3b')][_0x7cba('0x66')]()),_0x1eae7d);return respondWithRpcPromise(_0x7cba('0x5e'),_0x7cba('0x54'),{'module':_0x7cba('0x67')});}return null;})[_0x7cba('0x1e')](function(){return _0x46abb9;});})[_0x7cba('0x1e')](respondWithResult(_0x23f2a0,0xc9))[_0x7cba('0x53')](handleError(_0x23f2a0,null));};exports['update']=function(_0x3e86f9,_0x29ba2e,_0x4d0ab3){var _0x27282a;return db[_0x7cba('0x68')][_0x7cba('0x69')](function(_0x22c6c1){return db['Network'][_0x7cba('0x6a')]({'where':{'id':_0x3e86f9[_0x7cba('0x50')]['id']}})[_0x7cba('0x1e')](handleEntityNotFound(_0x29ba2e,null))[_0x7cba('0x1e')](saveUpdates(_0x3e86f9[_0x7cba('0x55')],null))[_0x7cba('0x1e')](function(_0x5e8a7a){if(_0x5e8a7a){_0x27282a=_0x5e8a7a;return db[_0x7cba('0x4b')][_0x7cba('0x4d')]({'where':{'type':_0x27282a[_0x7cba('0x3b')]},'raw':!![]});}return null;})[_0x7cba('0x1e')](function(_0x339146){if(_0x27282a[_0x7cba('0x3b')][_0x7cba('0x56')]()==_0x7cba('0x57')){var _0x3f2c78=fs[_0x7cba('0x58')](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],_0x7cba('0x6b')),_0x7cba('0x5b'));var _0x4245e2=ejs[_0x7cba('0x63')](_0x3f2c78,{'networks':_0x339146||[]});fs[_0x7cba('0x5c')](_0x7cba('0x5d'),_0x4245e2);return respondWithRpcPromise('Reload',_0x7cba('0x6c'),{'module':_0x7cba('0x5f')});}else if(_0x27282a[_0x7cba('0x3b')][_0x7cba('0x56')]()==_0x7cba('0x6d')){var _0x10ebab=fs['readFileSync'](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],_0x7cba('0x60')),_0x7cba('0x5b'));var _0xeecb64=ejs[_0x7cba('0x63')](_0x10ebab,{'networks':_0x339146||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xeecb64);return respondWithRpcPromise(_0x7cba('0x5e'),_0x7cba('0x6c'),{'module':_0x7cba('0x5f')});}else{var _0xea1242=fs[_0x7cba('0x58')](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],_0x7cba('0x62')),_0x7cba('0x5b'));var _0x396cec=ejs[_0x7cba('0x63')](_0xea1242,{'networks':_0x339146||[]});fs['writeFileSync'](util['format'](_0x7cba('0x65'),_0x3e86f9[_0x7cba('0x55')][_0x7cba('0x3b')][_0x7cba('0x66')]()),_0x396cec);return respondWithRpcPromise(_0x7cba('0x5e'),_0x7cba('0x6c'),{'module':_0x7cba('0x67')});}return null;})['then'](function(_0x265eed){if(_0x265eed){return _0x27282a;}return null;});})[_0x7cba('0x1e')](respondWithResult(_0x29ba2e,null))[_0x7cba('0x53')](handleError(_0x29ba2e,null));};exports[_0x7cba('0x33')]=function(_0x2d88d0,_0x276741,_0x392a15){var _0xa315df;return db['Network'][_0x7cba('0x6a')]({'where':{'id':_0x2d88d0[_0x7cba('0x50')]['id']}})[_0x7cba('0x1e')](function(_0x3dec63){_0xa315df=_0x3dec63;return _0x3dec63;})[_0x7cba('0x1e')](handleEntityNotFound(_0x276741,null))[_0x7cba('0x1e')](removeEntity(_0x276741,null))[_0x7cba('0x1e')](function(){if(_0xa315df){return db[_0x7cba('0x4b')][_0x7cba('0x4d')]({'where':{'type':_0xa315df[_0x7cba('0x3b')]},'raw':!![]});}})[_0x7cba('0x1e')](function(_0x4d6ff5){if(_0xa315df[_0x7cba('0x3b')][_0x7cba('0x56')]()==_0x7cba('0x57')){var _0x47f6a1=fs[_0x7cba('0x58')](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],_0x7cba('0x6b')),_0x7cba('0x5b'));var _0x5ddc79=ejs[_0x7cba('0x63')](_0x47f6a1,{'networks':_0x4d6ff5||[]});fs[_0x7cba('0x5c')](_0x7cba('0x5d'),_0x5ddc79);return respondWithRpcPromise(_0x7cba('0x5e'),_0x7cba('0x33'),{'module':_0x7cba('0x5f')});}else if(_0xa315df['type'][_0x7cba('0x56')]()==_0x7cba('0x6d')){var _0x4ab664=fs[_0x7cba('0x58')](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],_0x7cba('0x60')),_0x7cba('0x5b'));var _0x799ef1=ejs['render'](_0x4ab664,{'networks':_0x4d6ff5||[]});fs[_0x7cba('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x799ef1);return respondWithRpcPromise('Reload',_0x7cba('0x33'),{'module':_0x7cba('0x5f')});}else{var _0x5d0700=fs[_0x7cba('0x58')](path[_0x7cba('0x59')](config[_0x7cba('0x5a')],'server/files/templates/network.ejs'),_0x7cba('0x5b'));var _0x3538f9=ejs['render'](_0x5d0700,{'networks':_0x4d6ff5||[]});fs[_0x7cba('0x5c')](util['format'](_0x7cba('0x65'),_0x2d88d0[_0x7cba('0x55')][_0x7cba('0x3b')][_0x7cba('0x66')]()),_0x3538f9);return respondWithRpcPromise('Reload',_0x7cba('0x33'),{'module':_0x7cba('0x67')});}return null;})[_0x7cba('0x53')](handleError(_0x276741,null));}; \ No newline at end of file +var _0x16c9=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','name','send','map','Network','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','show','params','include','find','create','transaction','findAll','body','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','readFileSync','server/files/templates/turn_multiple.ejs','render','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','STUN','TURN','chan_sip.so','destroy'];(function(_0x5be8e3,_0x4eb86b){var _0x171b85=function(_0x5bf371){while(--_0x5bf371){_0x5be8e3['push'](_0x5be8e3['shift']());}};_0x171b85(++_0x4eb86b);}(_0x16c9,0x6a));var _0x916c=function(_0x209f17,_0x168932){_0x209f17=_0x209f17-0x0;var _0x19a393=_0x16c9[_0x209f17];return _0x19a393;};'use strict';var emlformat=require(_0x916c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x916c('0x1'));var jsonpatch=require(_0x916c('0x2'));var rp=require('request-promise');var moment=require(_0x916c('0x3'));var BPromise=require(_0x916c('0x4'));var Mustache=require(_0x916c('0x5'));var util=require(_0x916c('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x916c('0x7'));var fs=require('fs');var fs_extra=require(_0x916c('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x916c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x916c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x916c('0xb'));var Papa=require(_0x916c('0xc'));var Redis=require(_0x916c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x916c('0xe'));var as=require(_0x916c('0xf'));var hardwareService=require(_0x916c('0x10'));var logger=require(_0x916c('0x11'))('api');var utils=require(_0x916c('0x12'));var config=require(_0x916c('0x13'));var licenseUtil=require(_0x916c('0x14'));var db=require(_0x916c('0x15'))['db'];var jayson=require(_0x916c('0x16'));var client=jayson[_0x916c('0x17')][_0x916c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5ada92,_0x23d0d2,_0x375f1c,_0x14b6f2){return new BPromise(function(_0x46275b,_0x106aab){var _0x5a7652=_0x14b6f2||client;return _0x5a7652[_0x916c('0x19')](_0x5ada92,_0x375f1c)[_0x916c('0x1a')](function(_0x2064e5){logger[_0x916c('0x1b')]('Network,\x20%s,\x20%s',_0x23d0d2,'request\x20sent');logger[_0x916c('0x1c')](_0x916c('0x1d'),_0x23d0d2,_0x916c('0x1e'),JSON[_0x916c('0x1f')](_0x2064e5));if(_0x2064e5[_0x916c('0x20')]){if(_0x2064e5['error'][_0x916c('0x21')]===0x1f4){logger['error'](_0x916c('0x22'),_0x23d0d2,_0x2064e5[_0x916c('0x20')]['message']);return _0x106aab(_0x2064e5['error'][_0x916c('0x23')]);}logger[_0x916c('0x20')]('Network,\x20%s,\x20%s',_0x23d0d2,_0x2064e5[_0x916c('0x20')][_0x916c('0x23')]);return _0x46275b(_0x2064e5['error'][_0x916c('0x23')]);}else{logger['info'](_0x916c('0x22'),_0x23d0d2,'request\x20sent');_0x46275b(_0x2064e5[_0x916c('0x24')][_0x916c('0x23')]);}})[_0x916c('0x25')](function(_0x52960e){logger[_0x916c('0x20')](_0x916c('0x22'),_0x23d0d2,_0x52960e);_0x106aab(_0x52960e);});});}function respondWithStatusCode(_0x27a0d8,_0x4bd655){_0x4bd655=_0x4bd655||0xcc;return function(_0x4b5fd5){if(_0x4b5fd5){return _0x27a0d8[_0x916c('0x26')](_0x4bd655);}return _0x27a0d8[_0x916c('0x27')](_0x4bd655)[_0x916c('0x28')]();};}function respondWithResult(_0xb67ad1,_0x413e4a){_0x413e4a=_0x413e4a||0xc8;return function(_0x45c4be){if(_0x45c4be){return _0xb67ad1[_0x916c('0x27')](_0x413e4a)[_0x916c('0x29')](_0x45c4be);}};}function respondWithFilteredResult(_0x113e3e,_0x1a7137){return function(_0x6ad19c){if(_0x6ad19c){var _0x19026f=typeof _0x1a7137[_0x916c('0x2a')]===_0x916c('0x2b')&&typeof _0x1a7137[_0x916c('0x2c')]===_0x916c('0x2b');var _0x4dfc2a=_0x6ad19c[_0x916c('0x2d')];var _0x274364=_0x19026f?0x0:_0x1a7137[_0x916c('0x2a')];var _0x2535aa=_0x19026f?_0x6ad19c['count']:_0x1a7137[_0x916c('0x2a')]+_0x1a7137[_0x916c('0x2c')];var _0x43cb06;if(_0x2535aa>=_0x4dfc2a){_0x2535aa=_0x4dfc2a;_0x43cb06=0xc8;}else{_0x43cb06=0xce;}_0x113e3e[_0x916c('0x27')](_0x43cb06);return _0x113e3e[_0x916c('0x2e')]('Content-Range',_0x274364+'-'+_0x2535aa+'/'+_0x4dfc2a)['json'](_0x6ad19c);}return null;};}function patchUpdates(_0x29f6d2){return function(_0x5ebfae){try{jsonpatch[_0x916c('0x2f')](_0x5ebfae,_0x29f6d2,!![]);}catch(_0x1d554a){return BPromise['reject'](_0x1d554a);}return _0x5ebfae[_0x916c('0x30')]();};}function saveUpdates(_0x1cf6fe,_0x410a7d){return function(_0x1c1975){if(_0x1c1975){return _0x1c1975[_0x916c('0x31')](_0x1cf6fe)['then'](function(_0x5bd281){return _0x5bd281;});}return null;};}function removeEntity(_0x48dc93,_0x5771b2){return function(_0x2954cb){if(_0x2954cb){return _0x2954cb['destroy']()['then'](function(){_0x48dc93[_0x916c('0x27')](0xcc)[_0x916c('0x28')]();});}};}function handleEntityNotFound(_0x4d83ca,_0x317830){return function(_0x5950e1){if(!_0x5950e1){_0x4d83ca[_0x916c('0x26')](0x194);}return _0x5950e1;};}function handleError(_0x356a9c,_0xe630a9){_0xe630a9=_0xe630a9||0x1f4;return function(_0x518fa2){logger[_0x916c('0x20')](_0x518fa2['stack']);if(_0x518fa2[_0x916c('0x32')]){delete _0x518fa2[_0x916c('0x32')];}_0x356a9c[_0x916c('0x27')](_0xe630a9)[_0x916c('0x33')](_0x518fa2);};}exports['index']=function(_0x536bb6,_0x50359a){var _0x4f9ca5={},_0x5b8f5a={},_0x5763f4={'count':0x0,'rows':[]};var _0x1c21f9=_[_0x916c('0x34')](db[_0x916c('0x35')][_0x916c('0x36')],function(_0x402e5a){return{'name':_0x402e5a['fieldName'],'type':_0x402e5a[_0x916c('0x37')][_0x916c('0x38')]};});_0x5b8f5a[_0x916c('0x39')]=_['map'](_0x1c21f9,_0x916c('0x32'));_0x5b8f5a['query']=_[_0x916c('0x3a')](_0x536bb6[_0x916c('0x3b')]);_0x5b8f5a['filters']=_['intersection'](_0x5b8f5a[_0x916c('0x39')],_0x5b8f5a[_0x916c('0x3b')]);_0x4f9ca5[_0x916c('0x3c')]=_[_0x916c('0x3d')](_0x5b8f5a[_0x916c('0x39')],qs['fields'](_0x536bb6[_0x916c('0x3b')][_0x916c('0x3e')]));_0x4f9ca5['attributes']=_0x4f9ca5[_0x916c('0x3c')][_0x916c('0x3f')]?_0x4f9ca5[_0x916c('0x3c')]:_0x5b8f5a[_0x916c('0x39')];if(!_0x536bb6['query'][_0x916c('0x40')](_0x916c('0x41'))){_0x4f9ca5['limit']=qs[_0x916c('0x2c')](_0x536bb6['query'][_0x916c('0x2c')]);_0x4f9ca5[_0x916c('0x2a')]=qs['offset'](_0x536bb6[_0x916c('0x3b')][_0x916c('0x2a')]);}_0x4f9ca5[_0x916c('0x42')]=qs[_0x916c('0x43')](_0x536bb6['query'][_0x916c('0x43')]);_0x4f9ca5[_0x916c('0x44')]=qs[_0x916c('0x45')](_[_0x916c('0x46')](_0x536bb6[_0x916c('0x3b')],_0x5b8f5a[_0x916c('0x45')]),_0x1c21f9);if(_0x536bb6['query'][_0x916c('0x47')]){_0x4f9ca5['where']=_['merge'](_0x4f9ca5['where'],{'$or':_[_0x916c('0x34')](_0x1c21f9,function(_0x1bbe79){if(_0x1bbe79['type']!==_0x916c('0x48')){var _0xf073e5={};_0xf073e5[_0x1bbe79[_0x916c('0x32')]]={'$like':'%'+_0x536bb6[_0x916c('0x3b')][_0x916c('0x47')]+'%'};return _0xf073e5;}})});}_0x4f9ca5=_[_0x916c('0x49')]({},_0x4f9ca5,_0x536bb6[_0x916c('0x4a')]);var _0x5bb474={'where':_0x4f9ca5[_0x916c('0x44')]};return db['Network'][_0x916c('0x2d')](_0x5bb474)[_0x916c('0x1a')](function(_0x2d7996){_0x5763f4[_0x916c('0x2d')]=_0x2d7996;if(_0x536bb6['query'][_0x916c('0x4b')]){_0x4f9ca5['include']=[{'all':!![]}];}return db[_0x916c('0x35')]['findAll'](_0x4f9ca5);})[_0x916c('0x1a')](function(_0x54ae52){_0x5763f4['rows']=_0x54ae52;return _0x5763f4;})['then'](respondWithFilteredResult(_0x50359a,_0x4f9ca5))['catch'](handleError(_0x50359a,null));};exports[_0x916c('0x4c')]=function(_0x3be6ff,_0x23a294){var _0x9a41f8={'raw':!![],'where':{'id':_0x3be6ff[_0x916c('0x4d')]['id']}},_0x168812={};_0x168812[_0x916c('0x39')]=_[_0x916c('0x3a')](db[_0x916c('0x35')][_0x916c('0x36')]);_0x168812['query']=_[_0x916c('0x3a')](_0x3be6ff[_0x916c('0x3b')]);_0x168812[_0x916c('0x45')]=_['intersection'](_0x168812[_0x916c('0x39')],_0x168812[_0x916c('0x3b')]);_0x9a41f8[_0x916c('0x3c')]=_['intersection'](_0x168812[_0x916c('0x39')],qs[_0x916c('0x3e')](_0x3be6ff[_0x916c('0x3b')][_0x916c('0x3e')]));_0x9a41f8[_0x916c('0x3c')]=_0x9a41f8[_0x916c('0x3c')]['length']?_0x9a41f8['attributes']:_0x168812[_0x916c('0x39')];if(_0x3be6ff[_0x916c('0x3b')][_0x916c('0x4b')]){_0x9a41f8[_0x916c('0x4e')]=[{'all':!![]}];}_0x9a41f8=_[_0x916c('0x49')]({},_0x9a41f8,_0x3be6ff['options']);return db['Network'][_0x916c('0x4f')](_0x9a41f8)[_0x916c('0x1a')](handleEntityNotFound(_0x23a294,null))['then'](respondWithResult(_0x23a294,null))[_0x916c('0x25')](handleError(_0x23a294,null));};exports[_0x916c('0x50')]=function(_0x1da5f5,_0x454798,_0x3bb7d9){var _0x3e5e07;return db['sequelize'][_0x916c('0x51')](function(_0x2353a5){return db[_0x916c('0x35')][_0x916c('0x50')](_0x1da5f5['body'],{'raw':!![]})['then'](function(_0x5b40aa){_0x3e5e07=_0x5b40aa;return db[_0x916c('0x35')][_0x916c('0x52')]({'where':{'type':_0x1da5f5[_0x916c('0x53')]['type']},'raw':!![]});})[_0x916c('0x1a')](function(_0x71d6d2){if(_0x3e5e07[_0x916c('0x37')]['toUpperCase']()=='STUN'){var _0xa1848e=fs['readFileSync'](path[_0x916c('0x54')](config[_0x916c('0x55')],_0x916c('0x56')),_0x916c('0x57'));var _0x1e1fae=ejs['render'](_0xa1848e,{'networks':_0x71d6d2||[]});fs['writeFileSync'](_0x916c('0x58'),_0x1e1fae);return respondWithRpcPromise(_0x916c('0x59'),'create',{'module':_0x916c('0x5a')});}else if(_0x3e5e07['type'][_0x916c('0x5b')]()=='TURN'){var _0x238122=fs[_0x916c('0x5c')](path['join'](config[_0x916c('0x55')],_0x916c('0x5d')),_0x916c('0x57'));var _0x1eb4c8=ejs[_0x916c('0x5e')](_0x238122,{'networks':_0x71d6d2||[]});fs[_0x916c('0x5f')](_0x916c('0x60'),_0x1eb4c8);return respondWithRpcPromise('Reload',_0x916c('0x50'),{'module':_0x916c('0x5a')});}else{var _0x50c690=fs[_0x916c('0x5c')](path[_0x916c('0x54')](config[_0x916c('0x55')],_0x916c('0x61')),_0x916c('0x57'));var _0x8f9c07=ejs[_0x916c('0x5e')](_0x50c690,{'networks':_0x71d6d2||[]});fs[_0x916c('0x5f')](util[_0x916c('0x62')](_0x916c('0x63'),_0x1da5f5['body'][_0x916c('0x37')][_0x916c('0x64')]()),_0x8f9c07);return respondWithRpcPromise(_0x916c('0x59'),_0x916c('0x50'),{'module':'chan_sip.so'});}return null;})[_0x916c('0x1a')](function(){return _0x3e5e07;});})[_0x916c('0x1a')](respondWithResult(_0x454798,0xc9))[_0x916c('0x25')](handleError(_0x454798,null));};exports['update']=function(_0x33590f,_0x43b1c1,_0x55afd2){var _0xfc0bb2;return db[_0x916c('0x65')][_0x916c('0x51')](function(_0x3e9eb7){return db[_0x916c('0x35')][_0x916c('0x4f')]({'where':{'id':_0x33590f[_0x916c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43b1c1,null))[_0x916c('0x1a')](saveUpdates(_0x33590f[_0x916c('0x53')],null))[_0x916c('0x1a')](function(_0x5c8f57){if(_0x5c8f57){_0xfc0bb2=_0x5c8f57;return db[_0x916c('0x35')][_0x916c('0x52')]({'where':{'type':_0xfc0bb2[_0x916c('0x37')]},'raw':!![]});}return null;})[_0x916c('0x1a')](function(_0x880f6d){if(_0xfc0bb2[_0x916c('0x37')][_0x916c('0x5b')]()==_0x916c('0x66')){var _0x132da2=fs[_0x916c('0x5c')](path[_0x916c('0x54')](config[_0x916c('0x55')],_0x916c('0x56')),_0x916c('0x57'));var _0xf8ef9c=ejs[_0x916c('0x5e')](_0x132da2,{'networks':_0x880f6d||[]});fs['writeFileSync'](_0x916c('0x58'),_0xf8ef9c);return respondWithRpcPromise(_0x916c('0x59'),_0x916c('0x31'),{'module':'res_stun_monitor.so'});}else if(_0xfc0bb2['type']['toUpperCase']()==_0x916c('0x67')){var _0x2e41b9=fs['readFileSync'](path[_0x916c('0x54')](config[_0x916c('0x55')],_0x916c('0x5d')),'utf8');var _0x111f1e=ejs[_0x916c('0x5e')](_0x2e41b9,{'networks':_0x880f6d||[]});fs[_0x916c('0x5f')]('/etc/asterisk/turn_xcally.conf',_0x111f1e);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else{var _0x2e38e3=fs['readFileSync'](path[_0x916c('0x54')](config[_0x916c('0x55')],_0x916c('0x61')),_0x916c('0x57'));var _0x31aa11=ejs[_0x916c('0x5e')](_0x2e38e3,{'networks':_0x880f6d||[]});fs[_0x916c('0x5f')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x33590f['body'][_0x916c('0x37')][_0x916c('0x64')]()),_0x31aa11);return respondWithRpcPromise(_0x916c('0x59'),_0x916c('0x31'),{'module':_0x916c('0x68')});}return null;})[_0x916c('0x1a')](function(_0x361ced){if(_0x361ced){return _0xfc0bb2;}return null;});})[_0x916c('0x1a')](respondWithResult(_0x43b1c1,null))['catch'](handleError(_0x43b1c1,null));};exports[_0x916c('0x69')]=function(_0x2ee2b2,_0x585f44,_0x1f002f){var _0x396d27;return db[_0x916c('0x35')][_0x916c('0x4f')]({'where':{'id':_0x2ee2b2[_0x916c('0x4d')]['id']}})[_0x916c('0x1a')](function(_0x105be8){_0x396d27=_0x105be8;return _0x105be8;})[_0x916c('0x1a')](handleEntityNotFound(_0x585f44,null))[_0x916c('0x1a')](removeEntity(_0x585f44,null))[_0x916c('0x1a')](function(){if(_0x396d27){return db[_0x916c('0x35')]['findAll']({'where':{'type':_0x396d27['type']},'raw':!![]});}})['then'](function(_0x21e25e){if(_0x396d27['type'][_0x916c('0x5b')]()==_0x916c('0x66')){var _0x4c5091=fs[_0x916c('0x5c')](path[_0x916c('0x54')](config[_0x916c('0x55')],_0x916c('0x56')),'utf8');var _0x5e680d=ejs[_0x916c('0x5e')](_0x4c5091,{'networks':_0x21e25e||[]});fs['writeFileSync'](_0x916c('0x58'),_0x5e680d);return respondWithRpcPromise(_0x916c('0x59'),_0x916c('0x69'),{'module':_0x916c('0x5a')});}else if(_0x396d27[_0x916c('0x37')][_0x916c('0x5b')]()=='TURN'){var _0x1b8c02=fs[_0x916c('0x5c')](path['join'](config[_0x916c('0x55')],_0x916c('0x5d')),_0x916c('0x57'));var _0x2f4d8a=ejs['render'](_0x1b8c02,{'networks':_0x21e25e||[]});fs[_0x916c('0x5f')](_0x916c('0x60'),_0x2f4d8a);return respondWithRpcPromise('Reload','destroy',{'module':_0x916c('0x5a')});}else{var _0x2b71cf=fs[_0x916c('0x5c')](path[_0x916c('0x54')](config[_0x916c('0x55')],'server/files/templates/network.ejs'),_0x916c('0x57'));var _0x844417=ejs['render'](_0x2b71cf,{'networks':_0x21e25e||[]});fs['writeFileSync'](util['format'](_0x916c('0x63'),_0x2ee2b2[_0x916c('0x53')][_0x916c('0x37')][_0x916c('0x64')]()),_0x844417);return respondWithRpcPromise(_0x916c('0x59'),_0x916c('0x69'),{'module':_0x916c('0x68')});}return null;})[_0x916c('0x25')](handleError(_0x585f44,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bb03054..86ab23b 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 _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./network.attributes','define','network'];(function(_0x4b3289,_0x49dea6){var _0x31e5a0=function(_0x5355b6){while(--_0x5355b6){_0x4b3289['push'](_0x4b3289['shift']());}};_0x31e5a0(++_0x49dea6);}(_0xac4a,0x13f));var _0xaac4=function(_0x21b471,_0xcb546e){_0x21b471=_0x21b471-0x0;var _0x338369=_0xac4a[_0x21b471];return _0x338369;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('Network',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d2d=['../../config/logger','api','moment','request-promise','../../config/environment','./network.attributes','exports','define','network','lodash','util'];(function(_0x39d236,_0x21125c){var _0x34ad13=function(_0x3a1e3d){while(--_0x3a1e3d){_0x39d236['push'](_0x39d236['shift']());}};_0x34ad13(++_0x21125c);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x4482c6,_0x137943){_0x4482c6=_0x4482c6-0x0;var _0x22e742=_0x1d2d[_0x4482c6];return _0x22e742;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var moment=require(_0xd1d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd1d2('0x6'));var attributes=require(_0xd1d2('0x7'));module[_0xd1d2('0x8')]=function(_0x269613,_0x2f930d){return _0x269613[_0xd1d2('0x9')]('Network',attributes,{'tableName':_0xd1d2('0xa'),'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 c6b1c96..44e4443 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x3ae6e0,_0x4d688b){_0x3ae6e0=_0x3ae6e0-0x0;var _0x2f7887=_0x7a54[_0x3ae6e0];return _0x2f7887;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2469eb,_0x6c228c){var _0x25d692=function(_0x119afd){while(--_0x119afd){_0x2469eb['push'](_0x2469eb['shift']());}};_0x25d692(++_0x6c228c);}(_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 c20366e..98d22b9 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 _0xf901=['addAgents','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','/:id/users'];(function(_0x4bfe96,_0x3e63a7){var _0x2c40b0=function(_0x5b4be3){while(--_0x5b4be3){_0x4bfe96['push'](_0x4bfe96['shift']());}};_0x2c40b0(++_0x3e63a7);}(_0xf901,0xf3));var _0x1f90=function(_0x1368b5,_0x2624ca){_0x1368b5=_0x1368b5-0x0;var _0x38cdac=_0xf901[_0x1368b5];return _0x38cdac;};'use strict';var multer=require(_0x1f90('0x0'));var util=require('util');var path=require(_0x1f90('0x1'));var timeout=require(_0x1f90('0x2'));var express=require(_0x1f90('0x3'));var router=express[_0x1f90('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1f90('0x5'));var interaction=require(_0x1f90('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x1f90('0x7')]('/',auth['isAuthenticated'](),controller[_0x1f90('0x8')]);router[_0x1f90('0x7')](_0x1f90('0x9'),auth[_0x1f90('0xa')](),controller[_0x1f90('0xb')]);router['get'](_0x1f90('0xc'),auth[_0x1f90('0xa')](),controller[_0x1f90('0xd')]);router[_0x1f90('0x7')](_0x1f90('0xe'),auth['isAuthenticated'](),controller[_0x1f90('0xf')]);router[_0x1f90('0x7')](_0x1f90('0x10'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x11')]);router[_0x1f90('0x7')](_0x1f90('0x12'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x13')]);router['get'](_0x1f90('0x14'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x15')]);router[_0x1f90('0x7')]('/:id/users',auth[_0x1f90('0xa')](),controller[_0x1f90('0x16')]);router[_0x1f90('0x17')]('/',auth[_0x1f90('0xa')](),controller[_0x1f90('0x18')]);router[_0x1f90('0x17')](_0x1f90('0xe'),auth['isAuthenticated'](),controller[_0x1f90('0x19')]);router[_0x1f90('0x17')](_0x1f90('0x10'),auth[_0x1f90('0xa')](),controller['addAnswer']);router[_0x1f90('0x17')](_0x1f90('0x1a'),controller[_0x1f90('0x1b')]);router['post'](_0x1f90('0x12'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x1c')]);router['post'](_0x1f90('0x1d'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x1e')]);router[_0x1f90('0x17')]('/:id/send',auth[_0x1f90('0xa')](),controller[_0x1f90('0x1f')]);router[_0x1f90('0x20')](_0x1f90('0xc'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x21')]);router['delete'](_0x1f90('0xc'),auth[_0x1f90('0xa')](),controller['destroy']);router[_0x1f90('0x22')](_0x1f90('0xe'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x23')]);router[_0x1f90('0x22')](_0x1f90('0x10'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x24')]);router[_0x1f90('0x22')](_0x1f90('0x1d'),auth[_0x1f90('0xa')](),controller[_0x1f90('0x25')]);module[_0x1f90('0x26')]=router; \ No newline at end of file +var _0xdf7f=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x1a572e,_0x56b928){var _0xfab77b=function(_0x26aea1){while(--_0x26aea1){_0x1a572e['push'](_0x1a572e['shift']());}};_0xfab77b(++_0x56b928);}(_0xdf7f,0xa8));var _0xfdf7=function(_0x1c986d,_0x4baf4e){_0x1c986d=_0x1c986d-0x0;var _0x3ba063=_0xdf7f[_0x1c986d];return _0x3ba063;};'use strict';var multer=require(_0xfdf7('0x0'));var util=require(_0xfdf7('0x1'));var path=require(_0xfdf7('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdf7('0x3'));var router=express[_0xfdf7('0x4')]();var fs_extra=require(_0xfdf7('0x5'));var auth=require(_0xfdf7('0x6'));var interaction=require(_0xfdf7('0x7'));var config=require(_0xfdf7('0x8'));var controller=require(_0xfdf7('0x9'));router['get']('/',auth[_0xfdf7('0xa')](),controller['index']);router[_0xfdf7('0xb')](_0xfdf7('0xc'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0xd')]);router[_0xfdf7('0xb')](_0xfdf7('0xe'),auth['isAuthenticated'](),controller[_0xfdf7('0xf')]);router['get'](_0xfdf7('0x10'),auth['isAuthenticated'](),controller[_0xfdf7('0x11')]);router['get'](_0xfdf7('0x12'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x13')]);router[_0xfdf7('0xb')](_0xfdf7('0x14'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x15')]);router[_0xfdf7('0xb')](_0xfdf7('0x16'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x17')]);router['get'](_0xfdf7('0x18'),auth['isAuthenticated'](),controller['getAgents']);router[_0xfdf7('0x19')]('/',auth['isAuthenticated'](),controller[_0xfdf7('0x1a')]);router['post'](_0xfdf7('0x10'),auth[_0xfdf7('0xa')](),controller['addDisposition']);router[_0xfdf7('0x19')](_0xfdf7('0x12'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x1b')]);router[_0xfdf7('0x19')](_0xfdf7('0x1c'),controller[_0xfdf7('0x1d')]);router[_0xfdf7('0x19')](_0xfdf7('0x14'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x1e')]);router[_0xfdf7('0x19')](_0xfdf7('0x18'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x1f')]);router[_0xfdf7('0x19')](_0xfdf7('0x20'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x21')]);router[_0xfdf7('0x22')](_0xfdf7('0xe'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x23')]);router[_0xfdf7('0x24')](_0xfdf7('0xe'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x25')]);router[_0xfdf7('0x24')]('/:id/dispositions',auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x26')]);router[_0xfdf7('0x24')](_0xfdf7('0x12'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x27')]);router['delete']('/:id/users',auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x28')]);module[_0xfdf7('0x29')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 1d7d6cf..afb8d47 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 _0x4327=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','generate'];(function(_0x4ac8c3,_0x1c03e5){var _0x443d81=function(_0x2405ba){while(--_0x2405ba){_0x4ac8c3['push'](_0x4ac8c3['shift']());}};_0x443d81(++_0x1c03e5);}(_0x4327,0xef));var _0x7432=function(_0x162f4b,_0x31b569){_0x162f4b=_0x162f4b-0x0;var _0x57b00b=_0x4327[_0x162f4b];return _0x57b00b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x7432('0x0')]={'name':{'type':Sequelize[_0x7432('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x7432('0x1')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7432('0x2')]();}},'replyUri':{'type':Sequelize[_0x7432('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7432('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7432('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7432('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7432('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7432('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7432('0x1')]},'queueTransfer':{'type':Sequelize[_0x7432('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7432('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7432('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7432('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7432('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x7432('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x7432('0x4')],'defaultValue':![],'comment':_0x7432('0x7'),'set':function(_0x5a92e1){if(!_0x5a92e1)this['setDataValue'](_0x7432('0x8'),null);this[_0x7432('0x9')](_0x7432('0xa'),_0x5a92e1);}}}; \ No newline at end of file +var _0xac3f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0xac3f,0xf6));var _0xfac3=function(_0x64b31d,_0x393b36){_0x64b31d=_0x64b31d-0x0;var _0x42c45b=_0xac3f[_0x64b31d];return _0x42c45b;};'use strict';var Sequelize=require(_0xfac3('0x0'));var rs=require('randomstring');module[_0xfac3('0x1')]={'name':{'type':Sequelize[_0xfac3('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xfac3('0x2')],'defaultValue':function(){return rs[_0xfac3('0x3')]();}},'replyUri':{'type':Sequelize[_0xfac3('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xfac3('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfac3('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfac3('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfac3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfac3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfac3('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfac3('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xfac3('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xfac3('0x4')],'defaultValue':![],'comment':_0xfac3('0x7'),'set':function(_0x44e0e9){if(!_0x44e0e9)this[_0xfac3('0x8')](_0xfac3('0x9'),null);this[_0xfac3('0x8')](_0xfac3('0xa'),_0x44e0e9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index e9bb7ac..cae3476 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 _0xcbef=['hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','Pause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','options','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','from','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','unshift','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','getApplications','Contact','fullname','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','user','out','Messages','dataValues','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x4c941f,_0x13e01d){var _0x59f360=function(_0xd660e0){while(--_0xd660e0){_0x4c941f['push'](_0x4c941f['shift']());}};_0x59f360(++_0x13e01d);}(_0xcbef,0x1e1));var _0xfcbe=function(_0x5d1d99,_0x10ca23){_0x5d1d99=_0x5d1d99-0x0;var _0x2957ec=_0xcbef[_0x5d1d99];return _0x2957ec;};'use strict';var emlformat=require(_0xfcbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcbe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcbe('0x2'));var BPromise=require(_0xfcbe('0x3'));var Mustache=require('mustache');var util=require(_0xfcbe('0x4'));var path=require(_0xfcbe('0x5'));var sox=require(_0xfcbe('0x6'));var csv=require(_0xfcbe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcbe('0x8'));var squel=require('squel');var crypto=require(_0xfcbe('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfcbe('0x7'));var querystring=require(_0xfcbe('0xa'));var Papa=require(_0xfcbe('0xb'));var Redis=require(_0xfcbe('0xc'));var authService=require(_0xfcbe('0xd'));var qs=require(_0xfcbe('0xe'));var as=require(_0xfcbe('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfcbe('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfcbe('0x11'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xfcbe('0x12')],{'host':_0xfcbe('0x13'),'port':0x18eb});var socket=require(_0xfcbe('0x14'))(new Redis(config[_0xfcbe('0x12')]));require(_0xfcbe('0x15'))[_0xfcbe('0x16')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfcbe('0x17')]({'port':0x232c});var client9002=jayson[_0xfcbe('0x18')][_0xfcbe('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x22a21c,_0x55685c,_0x1362bb,_0x4613ee){return new BPromise(function(_0x2bd5c1,_0x4ba647){var _0x5a95f1=_0x4613ee||client;return _0x5a95f1[_0xfcbe('0x19')](_0x22a21c,_0x1362bb)[_0xfcbe('0x1a')](function(_0x53bb79){logger['info'](_0xfcbe('0x1b'),_0x55685c,_0xfcbe('0x1c'));logger[_0xfcbe('0x1d')](_0xfcbe('0x1e'),_0x55685c,_0xfcbe('0x1c'),JSON[_0xfcbe('0x1f')](_0x53bb79));if(_0x53bb79['error']){if(_0x53bb79['error']['code']===0x1f4){logger[_0xfcbe('0x20')](_0xfcbe('0x1b'),_0x55685c,_0x53bb79[_0xfcbe('0x20')][_0xfcbe('0x21')]);return _0x4ba647(_0x53bb79['error']['message']);}logger[_0xfcbe('0x20')](_0xfcbe('0x1b'),_0x55685c,_0x53bb79[_0xfcbe('0x20')][_0xfcbe('0x21')]);return _0x2bd5c1(_0x53bb79[_0xfcbe('0x20')]['message']);}else{logger['info'](_0xfcbe('0x1b'),_0x55685c,_0xfcbe('0x1c'));_0x2bd5c1(_0x53bb79['result'][_0xfcbe('0x21')]);}})[_0xfcbe('0x22')](function(_0x3cf5c6){logger[_0xfcbe('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x55685c,_0x3cf5c6);_0x4ba647(_0x3cf5c6);});});}function respondWithStatusCode(_0x2be710,_0x2c4bfe){_0x2c4bfe=_0x2c4bfe||0xcc;return function(_0xe4d457){if(_0xe4d457){return _0x2be710[_0xfcbe('0x23')](_0x2c4bfe);}return _0x2be710[_0xfcbe('0x24')](_0x2c4bfe)[_0xfcbe('0x25')]();};}function respondWithResult(_0xd6a315,_0x1943e3){_0x1943e3=_0x1943e3||0xc8;return function(_0xb7cb3e){if(_0xb7cb3e){return _0xd6a315[_0xfcbe('0x24')](_0x1943e3)[_0xfcbe('0x26')](_0xb7cb3e);}};}function respondWithFilteredResult(_0x116ae8,_0x99f291){return function(_0xe5c7b6){if(_0xe5c7b6){var _0x25db31=typeof _0x99f291[_0xfcbe('0x27')]==='undefined'&&typeof _0x99f291['limit']===_0xfcbe('0x28');var _0x10a36c=_0xe5c7b6[_0xfcbe('0x29')];var _0x180d10=_0x25db31?0x0:_0x99f291[_0xfcbe('0x27')];var _0x3aceae=_0x25db31?_0xe5c7b6['count']:_0x99f291['offset']+_0x99f291[_0xfcbe('0x2a')];var _0x3f2ce0;if(_0x3aceae>=_0x10a36c){_0x3aceae=_0x10a36c;_0x3f2ce0=0xc8;}else{_0x3f2ce0=0xce;}_0x116ae8[_0xfcbe('0x24')](_0x3f2ce0);return _0x116ae8[_0xfcbe('0x2b')](_0xfcbe('0x2c'),_0x180d10+'-'+_0x3aceae+'/'+_0x10a36c)[_0xfcbe('0x26')](_0xe5c7b6);}return null;};}function patchUpdates(_0x3b8478){return function(_0x1418ed){try{jsonpatch['apply'](_0x1418ed,_0x3b8478,!![]);}catch(_0x25e289){return BPromise['reject'](_0x25e289);}return _0x1418ed[_0xfcbe('0x2d')]();};}function saveUpdates(_0x25b5ff,_0x2f954a){return function(_0xb350de){if(_0xb350de){return _0xb350de['update'](_0x25b5ff)[_0xfcbe('0x1a')](function(_0x1c0e92){return _0x1c0e92;});}return null;};}function removeEntity(_0x487d70,_0x129b38){return function(_0x5a4cf9){if(_0x5a4cf9){return _0x5a4cf9[_0xfcbe('0x2e')]()['then'](function(){var _0x45eb5c=_0x5a4cf9[_0xfcbe('0x2f')]({'plain':!![]});var _0x305613=_0xfcbe('0x30');return db[_0xfcbe('0x31')]['destroy']({'where':{'type':_0x305613,'resourceId':_0x45eb5c['id']}})['then'](function(){return _0x5a4cf9;});})[_0xfcbe('0x1a')](function(){_0x487d70['status'](0xcc)[_0xfcbe('0x25')]();});}};}function handleEntityNotFound(_0x2bd5c4,_0x4e9f07){return function(_0x323a42){if(!_0x323a42){_0x2bd5c4[_0xfcbe('0x23')](0x194);}return _0x323a42;};}function handleError(_0x253744,_0x1438e5){_0x1438e5=_0x1438e5||0x1f4;return function(_0x509fcf){logger[_0xfcbe('0x20')](_0x509fcf['stack']);if(_0x509fcf[_0xfcbe('0x32')]){delete _0x509fcf[_0xfcbe('0x32')];}_0x253744[_0xfcbe('0x24')](_0x1438e5)[_0xfcbe('0x33')](_0x509fcf);};}exports[_0xfcbe('0x34')]=function(_0x52a0b4,_0x58ae6f){var _0x3527a2={'include':[{'model':db['Pause'],'as':_0xfcbe('0x35')}]},_0x5dea82={},_0x5c691f={'count':0x0,'rows':[]};var _0x2c0bdd=_[_0xfcbe('0x36')](db[_0xfcbe('0x37')][_0xfcbe('0x38')],function(_0x1461bc){return{'name':_0x1461bc[_0xfcbe('0x39')],'type':_0x1461bc[_0xfcbe('0x3a')][_0xfcbe('0x3b')]};});_0x5dea82['model']=_[_0xfcbe('0x36')](_0x2c0bdd,'name');_0x5dea82[_0xfcbe('0x3c')]=_[_0xfcbe('0x3d')](_0x52a0b4[_0xfcbe('0x3c')]);_0x5dea82[_0xfcbe('0x3e')]=_[_0xfcbe('0x3f')](_0x5dea82[_0xfcbe('0x40')],_0x5dea82[_0xfcbe('0x3c')]);_0x3527a2['attributes']=_[_0xfcbe('0x3f')](_0x5dea82['model'],qs[_0xfcbe('0x41')](_0x52a0b4['query']['fields']));_0x3527a2[_0xfcbe('0x42')]=_0x3527a2[_0xfcbe('0x42')][_0xfcbe('0x43')]?_0x3527a2[_0xfcbe('0x42')]:_0x5dea82['model'];if(!_0x52a0b4['query'][_0xfcbe('0x44')]('nolimit')){_0x3527a2['limit']=qs[_0xfcbe('0x2a')](_0x52a0b4['query'][_0xfcbe('0x2a')]);_0x3527a2[_0xfcbe('0x27')]=qs[_0xfcbe('0x27')](_0x52a0b4[_0xfcbe('0x3c')][_0xfcbe('0x27')]);}_0x3527a2[_0xfcbe('0x45')]=qs[_0xfcbe('0x46')](_0x52a0b4['query'][_0xfcbe('0x46')]);_0x3527a2[_0xfcbe('0x47')]=qs[_0xfcbe('0x3e')](_[_0xfcbe('0x48')](_0x52a0b4['query'],_0x5dea82['filters']),_0x2c0bdd);if(_0x52a0b4[_0xfcbe('0x3c')][_0xfcbe('0x49')]){_0x3527a2[_0xfcbe('0x47')]=_[_0xfcbe('0x4a')](_0x3527a2[_0xfcbe('0x47')],{'$or':_[_0xfcbe('0x36')](_0x2c0bdd,function(_0x3649e4){if(_0x3649e4[_0xfcbe('0x3a')]!=='VIRTUAL'){var _0x6bfa82={};_0x6bfa82[_0x3649e4[_0xfcbe('0x32')]]={'$like':'%'+_0x52a0b4['query'][_0xfcbe('0x49')]+'%'};return _0x6bfa82;}})});}_0x3527a2=_[_0xfcbe('0x4a')]({},_0x3527a2,_0x52a0b4['options']);var _0x250e6a={'where':_0x3527a2[_0xfcbe('0x47')]};return db[_0xfcbe('0x37')][_0xfcbe('0x29')](_0x250e6a)[_0xfcbe('0x1a')](function(_0x229ed7){_0x5c691f['count']=_0x229ed7;if(_0x52a0b4[_0xfcbe('0x3c')]['includeAll']){_0x3527a2[_0xfcbe('0x4b')]=[{'all':!![]}];}return db[_0xfcbe('0x37')][_0xfcbe('0x4c')](_0x3527a2);})[_0xfcbe('0x1a')](function(_0x390d39){_0x5c691f[_0xfcbe('0x4d')]=_0x390d39;return _0x5c691f;})[_0xfcbe('0x1a')](respondWithFilteredResult(_0x58ae6f,_0x3527a2))[_0xfcbe('0x22')](handleError(_0x58ae6f,null));};exports[_0xfcbe('0x4e')]=function(_0xf1f10c,_0x3d7fa9){var _0x5ed5eb={'raw':![],'where':{'id':_0xf1f10c[_0xfcbe('0x4f')]['id']},'include':[{'model':db[_0xfcbe('0x50')],'as':_0xfcbe('0x35')}]},_0x235673={};_0x235673['model']=_[_0xfcbe('0x3d')](db['OpenchannelAccount']['rawAttributes']);_0x235673[_0xfcbe('0x3c')]=_[_0xfcbe('0x3d')](_0xf1f10c['query']);_0x235673[_0xfcbe('0x3e')]=_[_0xfcbe('0x3f')](_0x235673[_0xfcbe('0x40')],_0x235673[_0xfcbe('0x3c')]);_0x5ed5eb[_0xfcbe('0x42')]=_[_0xfcbe('0x3f')](_0x235673[_0xfcbe('0x40')],qs[_0xfcbe('0x41')](_0xf1f10c[_0xfcbe('0x3c')][_0xfcbe('0x41')]));_0x5ed5eb['attributes']=_0x5ed5eb[_0xfcbe('0x42')]['length']?_0x5ed5eb[_0xfcbe('0x42')]:_0x235673['model'];if(_0xf1f10c[_0xfcbe('0x3c')]['includeAll']){_0x5ed5eb[_0xfcbe('0x4b')]=[{'all':!![]}];}_0x5ed5eb=_[_0xfcbe('0x4a')]({},_0x5ed5eb,_0xf1f10c['options']);return db[_0xfcbe('0x37')][_0xfcbe('0x51')](_0x5ed5eb)[_0xfcbe('0x1a')](handleEntityNotFound(_0x3d7fa9,null))[_0xfcbe('0x1a')](respondWithResult(_0x3d7fa9,null))[_0xfcbe('0x22')](handleError(_0x3d7fa9,null));};exports[_0xfcbe('0x52')]=function(_0x142205,_0x3b4376){return db['OpenchannelAccount'][_0xfcbe('0x52')](_0x142205[_0xfcbe('0x53')],{})[_0xfcbe('0x1a')](function(_0x3bb06b){var _0x19b885=_0x142205['user'][_0xfcbe('0x2f')]({'plain':!![]});if(!_0x19b885)throw new Error(_0xfcbe('0x54'));if(_0x19b885[_0xfcbe('0x55')]==='user'){var _0x299c7d=_0x3bb06b[_0xfcbe('0x2f')]({'plain':!![]});var _0x329b5d='OpenchannelAccounts';return db['UserProfileSection'][_0xfcbe('0x51')]({'where':{'name':_0x329b5d,'userProfileId':_0x19b885[_0xfcbe('0x56')]},'raw':!![]})['then'](function(_0x994e4d){if(_0x994e4d&&_0x994e4d[_0xfcbe('0x57')]===0x0){return db[_0xfcbe('0x31')][_0xfcbe('0x52')]({'name':_0x299c7d[_0xfcbe('0x32')],'resourceId':_0x299c7d['id'],'type':_0x994e4d[_0xfcbe('0x32')],'sectionId':_0x994e4d['id']},{})[_0xfcbe('0x1a')](function(){return _0x3bb06b;});}else{return _0x3bb06b;}})[_0xfcbe('0x22')](function(_0x2db5e4){logger[_0xfcbe('0x20')](_0xfcbe('0x58'),_0x2db5e4);throw _0x2db5e4;});}return _0x3bb06b;})[_0xfcbe('0x1a')](respondWithResult(_0x3b4376,0xc9))['catch'](handleError(_0x3b4376,null));};exports[_0xfcbe('0x59')]=function(_0x4fa6e5,_0x1832e1){if(_0x4fa6e5['body']['id']){delete _0x4fa6e5[_0xfcbe('0x53')]['id'];}return db[_0xfcbe('0x37')][_0xfcbe('0x51')]({'where':{'id':_0x4fa6e5[_0xfcbe('0x4f')]['id']},'include':[{'model':db[_0xfcbe('0x50')],'as':_0xfcbe('0x35')}]})['then'](handleEntityNotFound(_0x1832e1,null))[_0xfcbe('0x1a')](saveUpdates(_0x4fa6e5[_0xfcbe('0x53')],null))[_0xfcbe('0x1a')](respondWithResult(_0x1832e1,null))[_0xfcbe('0x22')](handleError(_0x1832e1,null));};exports['destroy']=function(_0x3173af,_0x2f939c){return db[_0xfcbe('0x37')][_0xfcbe('0x51')]({'where':{'id':_0x3173af[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x2f939c,null))[_0xfcbe('0x1a')](removeEntity(_0x2f939c,null))['catch'](handleError(_0x2f939c,null));};exports[_0xfcbe('0x5a')]=function(_0x11f6d4,_0x21fe91){return db[_0xfcbe('0x37')][_0xfcbe('0x5a')]()[_0xfcbe('0x1a')](respondWithResult(_0x21fe91,null))['catch'](handleError(_0x21fe91,null));};exports[_0xfcbe('0x5b')]=function(_0x464d92,_0x52051a,_0x1da23d){if(_0x464d92['body']['id']){delete _0x464d92[_0xfcbe('0x53')]['id'];}return db[_0xfcbe('0x37')]['find']({'where':{'id':_0x464d92['params']['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x52051a,null))[_0xfcbe('0x1a')](function(_0x2b9aa3){if(_0x2b9aa3){_0x464d92['body'][_0xfcbe('0x5c')]=_0x2b9aa3['id'];return db[_0xfcbe('0x5d')][_0xfcbe('0x52')](_0x464d92[_0xfcbe('0x53')]);}})[_0xfcbe('0x1a')](respondWithResult(_0x52051a,null))[_0xfcbe('0x22')](handleError(_0x52051a,null));};exports[_0xfcbe('0x5e')]=function(_0x3c4ee5,_0x532626,_0x42ff71){var _0x55adaa={'raw':![],'where':{}};var _0x2093df={};var _0x1327b1={'count':0x0,'rows':[]};return db[_0xfcbe('0x37')][_0xfcbe('0x5f')]({'where':{'id':_0x3c4ee5[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x532626,null))[_0xfcbe('0x1a')](function(_0x40eb8e){if(_0x40eb8e){_0x2093df[_0xfcbe('0x40')]=_[_0xfcbe('0x3d')](db['Disposition'][_0xfcbe('0x38')]);_0x2093df[_0xfcbe('0x3c')]=_[_0xfcbe('0x3d')](_0x3c4ee5[_0xfcbe('0x3c')]);_0x2093df['filters']=_[_0xfcbe('0x3f')](_0x2093df['model'],_0x2093df[_0xfcbe('0x3c')]);_0x55adaa[_0xfcbe('0x42')]=_[_0xfcbe('0x3f')](_0x2093df[_0xfcbe('0x40')],qs[_0xfcbe('0x41')](_0x3c4ee5['query'][_0xfcbe('0x41')]));_0x55adaa[_0xfcbe('0x42')]=_0x55adaa['attributes'][_0xfcbe('0x43')]?_0x55adaa[_0xfcbe('0x42')]:_0x2093df['model'];if(!_0x3c4ee5[_0xfcbe('0x3c')][_0xfcbe('0x44')](_0xfcbe('0x60'))){_0x55adaa['limit']=qs[_0xfcbe('0x2a')](_0x3c4ee5[_0xfcbe('0x3c')][_0xfcbe('0x2a')]);_0x55adaa[_0xfcbe('0x27')]=qs['offset'](_0x3c4ee5[_0xfcbe('0x3c')][_0xfcbe('0x27')]);}_0x55adaa[_0xfcbe('0x45')]=qs['sort'](_0x3c4ee5[_0xfcbe('0x3c')][_0xfcbe('0x46')]);_0x55adaa[_0xfcbe('0x47')]=qs['filters'](_['pick'](_0x3c4ee5[_0xfcbe('0x3c')],_0x2093df[_0xfcbe('0x3e')]));_0x55adaa['where'][_0xfcbe('0x5c')]=_0x40eb8e['id'];if(_0x3c4ee5['query'][_0xfcbe('0x49')]){_0x55adaa[_0xfcbe('0x47')]=_['merge'](_0x55adaa['where'],{'$or':_[_0xfcbe('0x36')](_0x55adaa[_0xfcbe('0x42')],function(_0x36dd4a){var _0x1b6d2d={};_0x1b6d2d[_0x36dd4a]={'$like':'%'+_0x3c4ee5[_0xfcbe('0x3c')][_0xfcbe('0x49')]+'%'};return _0x1b6d2d;})});}_0x55adaa=_['merge']({},_0x55adaa,_0x3c4ee5[_0xfcbe('0x61')]);return db[_0xfcbe('0x5d')]['count']({'where':_0x55adaa[_0xfcbe('0x47')]})['then'](function(_0x2856ba){_0x1327b1[_0xfcbe('0x29')]=_0x2856ba;if(_0x3c4ee5[_0xfcbe('0x3c')][_0xfcbe('0x62')]){_0x55adaa['include']=[{'all':!![]}];}return db['Disposition'][_0xfcbe('0x4c')](_0x55adaa);})[_0xfcbe('0x1a')](function(_0x37bca0){_0x1327b1[_0xfcbe('0x4d')]=_0x37bca0;return _0x1327b1;});}})[_0xfcbe('0x1a')](respondWithFilteredResult(_0x532626,_0x55adaa))[_0xfcbe('0x22')](handleError(_0x532626,null));};exports[_0xfcbe('0x63')]=function(_0x45a10b,_0x557d0c,_0x2a7295){return db[_0xfcbe('0x37')][_0xfcbe('0x51')]({'where':{'id':_0x45a10b[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x557d0c,null))[_0xfcbe('0x1a')](function(_0x4a0c22){if(_0x4a0c22){return _0x4a0c22['removeDispositions'](_0x45a10b[_0xfcbe('0x3c')][_0xfcbe('0x64')]);}})[_0xfcbe('0x1a')](respondWithStatusCode(_0x557d0c,null))[_0xfcbe('0x22')](handleError(_0x557d0c,null));};exports['addAnswer']=function(_0x25efad,_0x1f5a22,_0x1a4657){if(_0x25efad[_0xfcbe('0x53')]['id']){delete _0x25efad[_0xfcbe('0x53')]['id'];}return db[_0xfcbe('0x37')]['find']({'where':{'id':_0x25efad[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x1f5a22,null))[_0xfcbe('0x1a')](function(_0x3c7da5){if(_0x3c7da5){_0x25efad[_0xfcbe('0x53')][_0xfcbe('0x5c')]=_0x3c7da5['id'];return db[_0xfcbe('0x65')][_0xfcbe('0x52')](_0x25efad[_0xfcbe('0x53')]);}})[_0xfcbe('0x1a')](respondWithResult(_0x1f5a22,null))[_0xfcbe('0x22')](handleError(_0x1f5a22,null));};exports[_0xfcbe('0x66')]=function(_0x179677,_0x4a4533,_0x2a8786){var _0x4d7a3f={'raw':![],'where':{}};var _0x91a94a={};var _0x2c7370={'count':0x0,'rows':[]};return db[_0xfcbe('0x37')][_0xfcbe('0x5f')]({'where':{'id':_0x179677[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x4a4533,null))[_0xfcbe('0x1a')](function(_0x5f3744){if(_0x5f3744){_0x91a94a['model']=_['keys'](db[_0xfcbe('0x65')][_0xfcbe('0x38')]);_0x91a94a[_0xfcbe('0x3c')]=_[_0xfcbe('0x3d')](_0x179677[_0xfcbe('0x3c')]);_0x91a94a[_0xfcbe('0x3e')]=_[_0xfcbe('0x3f')](_0x91a94a[_0xfcbe('0x40')],_0x91a94a[_0xfcbe('0x3c')]);_0x4d7a3f[_0xfcbe('0x42')]=_[_0xfcbe('0x3f')](_0x91a94a[_0xfcbe('0x40')],qs[_0xfcbe('0x41')](_0x179677[_0xfcbe('0x3c')][_0xfcbe('0x41')]));_0x4d7a3f[_0xfcbe('0x42')]=_0x4d7a3f['attributes'][_0xfcbe('0x43')]?_0x4d7a3f[_0xfcbe('0x42')]:_0x91a94a[_0xfcbe('0x40')];if(!_0x179677[_0xfcbe('0x3c')][_0xfcbe('0x44')](_0xfcbe('0x60'))){_0x4d7a3f[_0xfcbe('0x2a')]=qs[_0xfcbe('0x2a')](_0x179677[_0xfcbe('0x3c')]['limit']);_0x4d7a3f['offset']=qs[_0xfcbe('0x27')](_0x179677[_0xfcbe('0x3c')][_0xfcbe('0x27')]);}_0x4d7a3f[_0xfcbe('0x45')]=qs[_0xfcbe('0x46')](_0x179677['query'][_0xfcbe('0x46')]);_0x4d7a3f['where']=qs[_0xfcbe('0x3e')](_[_0xfcbe('0x48')](_0x179677['query'],_0x91a94a['filters']));_0x4d7a3f[_0xfcbe('0x47')][_0xfcbe('0x5c')]=_0x5f3744['id'];if(_0x179677[_0xfcbe('0x3c')][_0xfcbe('0x49')]){_0x4d7a3f[_0xfcbe('0x47')]=_[_0xfcbe('0x4a')](_0x4d7a3f[_0xfcbe('0x47')],{'$or':_[_0xfcbe('0x36')](_0x4d7a3f[_0xfcbe('0x42')],function(_0x2febee){var _0xd15466={};_0xd15466[_0x2febee]={'$like':'%'+_0x179677['query'][_0xfcbe('0x49')]+'%'};return _0xd15466;})});}_0x4d7a3f=_[_0xfcbe('0x4a')]({},_0x4d7a3f,_0x179677[_0xfcbe('0x61')]);return db[_0xfcbe('0x65')][_0xfcbe('0x29')]({'where':_0x4d7a3f[_0xfcbe('0x47')]})[_0xfcbe('0x1a')](function(_0x3b5ae4){_0x2c7370[_0xfcbe('0x29')]=_0x3b5ae4;if(_0x179677[_0xfcbe('0x3c')][_0xfcbe('0x62')]){_0x4d7a3f[_0xfcbe('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfcbe('0x4c')](_0x4d7a3f);})[_0xfcbe('0x1a')](function(_0x1fd038){_0x2c7370[_0xfcbe('0x4d')]=_0x1fd038;return _0x2c7370;});}})[_0xfcbe('0x1a')](respondWithFilteredResult(_0x4a4533,_0x4d7a3f))['catch'](handleError(_0x4a4533,null));};exports[_0xfcbe('0x67')]=function(_0x590284,_0xf217ad,_0x309f45){return db[_0xfcbe('0x37')][_0xfcbe('0x51')]({'where':{'id':_0x590284[_0xfcbe('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf217ad,null))[_0xfcbe('0x1a')](function(_0x43596d){if(_0x43596d){return _0x43596d[_0xfcbe('0x67')](_0x590284[_0xfcbe('0x3c')]['ids']);}})[_0xfcbe('0x1a')](respondWithStatusCode(_0xf217ad,null))[_0xfcbe('0x22')](handleError(_0xf217ad,null));};exports[_0xfcbe('0x68')]=function(_0x472ab8,_0x4b70dd,_0x58a9ac){var _0x45b256={'body':_0x472ab8[_0xfcbe('0x53')],'channel':_0xfcbe('0x69')};var _0x52de74=[];var _0x52bd8a=[];var _0x38bb66={};var _0x50e6e2=![];return db['CmContact'][_0xfcbe('0x5a')]()[_0xfcbe('0x1a')](function(_0x3bbcf0){if(!_0x3bbcf0){throw new db[(_0xfcbe('0x6a'))][(_0xfcbe('0x6b'))](_0xfcbe('0x6c'));}_0x52de74=_[_0xfcbe('0x6d')](_['keys'](_0x3bbcf0),['createdAt',_0xfcbe('0x6e')]);_0x52bd8a=_[_0xfcbe('0x6d')](_[_0xfcbe('0x3d')](_0x3bbcf0),[_0xfcbe('0x6f'),'updatedAt',_0xfcbe('0x70'),_0xfcbe('0x71')]);if(_0x472ab8[_0xfcbe('0x53')]['id']){delete _0x472ab8[_0xfcbe('0x53')]['id'];}if(_[_0xfcbe('0x72')](_0x472ab8['body']['from'])){throw new db['Sequelize'][(_0xfcbe('0x6b'))](_0xfcbe('0x73'));}if(_['isNil'](_0x472ab8[_0xfcbe('0x53')]['body'])||_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x53')]===''){throw new db[(_0xfcbe('0x6a'))]['ValidationError'](_0xfcbe('0x74'));}if(_[_0xfcbe('0x72')](_0x472ab8['body'][_0xfcbe('0x75')])){throw new db[(_0xfcbe('0x6a'))]['ValidationError'](_0xfcbe('0x76')+_0x52bd8a);}if(!_[_0xfcbe('0x77')](_0x52bd8a,_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x75')])){throw new db['Sequelize'][(_0xfcbe('0x6b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52bd8a);}_0x38bb66[_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x75')]]=_0x472ab8[_0xfcbe('0x53')]['from'];})[_0xfcbe('0x1a')](function(){return db['OpenchannelAccount'][_0xfcbe('0x51')]({'where':{'id':_0x472ab8[_0xfcbe('0x4f')]['id']},'include':[{'model':db[_0xfcbe('0x78')],'as':_0xfcbe('0x79'),'include':[{'model':db[_0xfcbe('0x7a')],'as':_0xfcbe('0x7b'),'where':_0x38bb66,'limit':0x1,'order':[[_0xfcbe('0x6e'),_0xfcbe('0x7c')]]}]},{'model':db[_0xfcbe('0x7d')],'as':_0xfcbe('0x7e')}]});})[_0xfcbe('0x1a')](handleEntityNotFound(_0x4b70dd,null))[_0xfcbe('0x1a')](function(_0x442a4c){if(_0x442a4c&&_0x442a4c['List']){_0x45b256[_0xfcbe('0x7f')]=_0x442a4c;_0x45b256[_0xfcbe('0x80')]=_0x442a4c[_0xfcbe('0x7e')];_0x45b256[_0xfcbe('0x81')]=_0x442a4c[_0xfcbe('0x79')];_0x45b256[_0xfcbe('0x80')]=_[_0xfcbe('0x82')](_0x45b256['applications'],[_0xfcbe('0x83')],[_0xfcbe('0x84')]);if(_0x45b256[_0xfcbe('0x7f')][_0xfcbe('0x7e')]){delete _0x45b256[_0xfcbe('0x7f')][_0xfcbe('0x7e')];}if(_0x45b256['account'][_0xfcbe('0x79')]&&_0x45b256['account']['List'][_0xfcbe('0x7b')][_0xfcbe('0x43')]){return _0x45b256[_0xfcbe('0x7f')][_0xfcbe('0x79')][_0xfcbe('0x7b')][0x0];}var _0x36b3ed=_[_0xfcbe('0x85')](_0x472ab8['body'],{'firstName':_0x472ab8['body'][_0xfcbe('0x86')],'ListId':_0x442a4c[_0xfcbe('0x71')]});_0x36b3ed[_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x75')]]=_0x472ab8[_0xfcbe('0x53')]['from'];return db['CmContact'][_0xfcbe('0x52')](_0x36b3ed,{'fields':_0x52de74,'raw':!![]});}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x4b70dd,null))[_0xfcbe('0x1a')](function(_0x548653){_0x45b256[_0xfcbe('0x87')]=_0x548653;if(_0x548653){var _0x921118={'ContactId':_0x548653['id'],'OpenchannelAccountId':_0x472ab8[_0xfcbe('0x4f')]['id'],'from':(_0x548653[_0xfcbe('0x88')]||'')+'\x20'+(_0x548653[_0xfcbe('0x89')]||'')};var _0x38dee3={'OpenchannelAccountId':_0x472ab8[_0xfcbe('0x4f')]['id'],'closed':![]};if(_0x472ab8['body'][_0xfcbe('0x8a')]){_0x38dee3[_0xfcbe('0x8a')]=_0x472ab8[_0xfcbe('0x53')]['threadId'];return db[_0xfcbe('0x8b')][_0xfcbe('0x51')]({'where':_0x38dee3})[_0xfcbe('0x1a')](function(_0x13683a){if(_0x13683a){return[_0x13683a,![]];}_0x921118[_0xfcbe('0x8a')]=_0x472ab8[_0xfcbe('0x53')]['threadId'];_0x921118[_0xfcbe('0x8c')]=_0x472ab8[_0xfcbe('0x53')]['externalUrl'];return db['OpenchannelInteraction'][_0xfcbe('0x52')](_0x921118)['then'](function(_0x45a91e){return[_0x45a91e,!![]];});});}else{_0x38dee3['threadId']=null;}_0x38dee3['ContactId']=_0x548653['id'];return db[_0xfcbe('0x8b')][_0xfcbe('0x51')]({'where':_0x38dee3})['then'](function(_0x480e50){if(_0x480e50){return[_0x480e50,![]];}return db[_0xfcbe('0x8b')][_0xfcbe('0x52')](_0x921118)[_0xfcbe('0x1a')](function(_0xc0e687){return[_0xc0e687,!![]];});});}})[_0xfcbe('0x8d')](function(_0x543364,_0x5d419a){if(_0x543364){_0x50e6e2=_0x5d419a;if(!_0x5d419a){var _0x139960={'from':(_0x45b256[_0xfcbe('0x87')][_0xfcbe('0x88')]||'')+'\x20'+(_0x45b256['contact']['lastName']||'')};if(_0x472ab8['body'][_0xfcbe('0x8a')]&&_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x8e')]&&_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x8a')]!=_0x472ab8['body']['messageId']){_0x139960[_0xfcbe('0x8a')]=_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x8e')];}return _0x543364[_0xfcbe('0x59')](_0x139960);}else{return _0x543364;}}})[_0xfcbe('0x1a')](function(_0x47147d){_0x45b256['interaction']=_0x47147d[_0xfcbe('0x2f')]({'plain':!![]});_0x45b256['interaction']['created']=_0x50e6e2;if(_0x45b256[_0xfcbe('0x8f')][_0xfcbe('0x90')]){if(_0x45b256[_0xfcbe('0x7f')][_0xfcbe('0x91')]){_0x45b256[_0xfcbe('0x80')][_0xfcbe('0x92')]({'id':0x0,'priority':_0x45b256[_0xfcbe('0x80')][_0xfcbe('0x43')]+0x1,'app':'close','appdata':_0xfcbe('0x93'),'interval':'*,*,*,*'});}}return db[_0xfcbe('0x94')]['create']({'body':_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x53')],'OpenchannelAccountId':_0x472ab8[_0xfcbe('0x4f')]['id'],'OpenchannelInteractionId':_0x47147d['id'],'direction':'in','ContactId':_0x45b256[_0xfcbe('0x87')]['id'],'AttachmentId':_0x472ab8[_0xfcbe('0x53')][_0xfcbe('0x95')]});})[_0xfcbe('0x1a')](function(_0x142646){_0x45b256[_0xfcbe('0x21')]=_0x142646;if(_0x45b256[_0xfcbe('0x8f')]['UserId']){return db[_0xfcbe('0x96')]['find']({'attributes':['id',_0xfcbe('0x32')],'where':{'id':_0x45b256['interaction'][_0xfcbe('0x97')]}})[_0xfcbe('0x1a')](function(_0x3af709){if(_0x3af709){_0x45b256['applications'][_0xfcbe('0x98')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3af709[_0xfcbe('0x32')]+','+(_0x45b256[_0xfcbe('0x7f')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x45b256[_0xfcbe('0x99')]=![];}return respondWithRpcPromise(_0xfcbe('0x9a'),'startRouting',_0x45b256);});}return respondWithRpcPromise('Start',_0xfcbe('0x9b'),_0x45b256);})['then'](function(_0x2902f5){respondWithRpcPromise(_0xfcbe('0x9c'),_0xfcbe('0x9c'),{'event':_0xfcbe('0x68'),'message':_0x2902f5},client9002);return _0x2902f5;})[_0xfcbe('0x1a')](respondWithResult(_0x4b70dd,null))[_0xfcbe('0x22')](handleError(_0x4b70dd,null));};exports[_0xfcbe('0x9d')]=function(_0x22355e,_0x5b5c19){var _0x26c3a0=_0x22355e[_0xfcbe('0x4f')]['id'];var _0x40c6aa=_0x22355e['body'];var _0x2d6c9a=0xc8;var _0x38bd53=null;return db[_0xfcbe('0x9e')][_0xfcbe('0x9f')]({'isolationLevel':db[_0xfcbe('0x9e')]['Transaction'][_0xfcbe('0xa0')][_0xfcbe('0xa1')]},function(_0x365053){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x26c3a0},'transaction':_0x365053})[_0xfcbe('0x1a')](function(_0x448b1b){if(_0x448b1b){return db[_0xfcbe('0x7d')][_0xfcbe('0x2e')]({'where':{'OpenchannelAccountId':_0x26c3a0},'transaction':_0x365053})[_0xfcbe('0x1a')](function(){var _0x4ff85d=_[_0xfcbe('0x36')](_0x40c6aa,function(_0x7bc719){_0x7bc719['OpenchannelAccountId']=_0x26c3a0;return _0x7bc719;});return db['OpenchannelApplication']['bulkCreate'](_0x4ff85d,{'transaction':_0x365053});});}else{_0x2d6c9a=0x194;_0x38bd53=[];}});})['then'](function(){if(_0x2d6c9a!==0x194){return db[_0xfcbe('0x7d')][_0xfcbe('0xa2')]({'where':{'OpenchannelAccountId':_0x26c3a0},'order':_0xfcbe('0x83')})[_0xfcbe('0x1a')](function(_0x1f85c6){_0x38bd53=_0x1f85c6;});}})[_0xfcbe('0x22')](function(_0x29cefb){_0x2d6c9a=0x1f4;logger[_0xfcbe('0x20')](_0x29cefb[_0xfcbe('0xa3')]);if(_0x29cefb['name']){delete _0x29cefb[_0xfcbe('0x32')];}_0x38bd53=_0x29cefb;})['finally'](function(){if(_0x38bd53===null){_0x5b5c19[_0xfcbe('0x23')](_0x2d6c9a);}else{if(_0x2d6c9a===0x1f4){_0x5b5c19[_0xfcbe('0x24')](_0x2d6c9a)[_0xfcbe('0x33')](_0x38bd53);}else{_0x5b5c19['status'](_0x2d6c9a)['json'](_0x38bd53);}}});};exports['getApplications']=function(_0x841fb5,_0x52ebb9,_0x1ca8f0){var _0x1b0d25={};var _0x2713ed={};var _0x58bf3f;var _0x5d618c;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x841fb5[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x52ebb9,null))[_0xfcbe('0x1a')](function(_0x2836e6){if(_0x2836e6){_0x58bf3f=_0x2836e6;_0x2713ed[_0xfcbe('0x40')]=_[_0xfcbe('0x3d')](db[_0xfcbe('0x7d')]['rawAttributes']);_0x2713ed[_0xfcbe('0x3c')]=_[_0xfcbe('0x3d')](_0x841fb5['query']);_0x2713ed['filters']=_[_0xfcbe('0x3f')](_0x2713ed['model'],_0x2713ed[_0xfcbe('0x3c')]);_0x1b0d25[_0xfcbe('0x42')]=_[_0xfcbe('0x3f')](_0x2713ed['model'],qs[_0xfcbe('0x41')](_0x841fb5['query'][_0xfcbe('0x41')]));_0x1b0d25[_0xfcbe('0x42')]=_0x1b0d25[_0xfcbe('0x42')]['length']?_0x1b0d25[_0xfcbe('0x42')]:_0x2713ed['model'];_0x1b0d25[_0xfcbe('0x45')]=qs['sort'](_0x841fb5[_0xfcbe('0x3c')][_0xfcbe('0x46')]);_0x1b0d25['where']=qs[_0xfcbe('0x3e')](_[_0xfcbe('0x48')](_0x841fb5['query'],_0x2713ed[_0xfcbe('0x3e')]));if(_0x841fb5['query']['filter']){_0x1b0d25[_0xfcbe('0x47')]=_[_0xfcbe('0x4a')](_0x1b0d25[_0xfcbe('0x47')],{'$or':_[_0xfcbe('0x36')](_0x1b0d25[_0xfcbe('0x42')],function(_0xa1ff78){var _0x47e6e7={};_0x47e6e7[_0xa1ff78]={'$like':'%'+_0x841fb5[_0xfcbe('0x3c')][_0xfcbe('0x49')]+'%'};return _0x47e6e7;})});}_0x1b0d25=_[_0xfcbe('0x4a')]({},_0x1b0d25,_0x841fb5[_0xfcbe('0x61')]);return _0x58bf3f[_0xfcbe('0xa4')](_0x1b0d25);}})[_0xfcbe('0x1a')](function(_0x2c1d6f){if(_0x2c1d6f){_0x5d618c=_0x2c1d6f[_0xfcbe('0x43')];if(!_0x841fb5['query'][_0xfcbe('0x44')](_0xfcbe('0x60'))){_0x1b0d25[_0xfcbe('0x2a')]=qs[_0xfcbe('0x2a')](_0x841fb5[_0xfcbe('0x3c')]['limit']);_0x1b0d25[_0xfcbe('0x27')]=qs['offset'](_0x841fb5[_0xfcbe('0x3c')][_0xfcbe('0x27')]);}return _0x58bf3f[_0xfcbe('0xa4')](_0x1b0d25);}})['then'](function(_0x401437){if(_0x401437){return _0x401437?{'count':_0x5d618c,'rows':_0x401437}:null;}})[_0xfcbe('0x1a')](respondWithResult(_0x52ebb9,null))[_0xfcbe('0x22')](handleError(_0x52ebb9,null));};exports['getInteractions']=function(_0x28d7a5,_0x2cd4f9,_0x3f3591){var _0xa40ef4={'raw':![],'where':{}};var _0x2f5813={};var _0x179528={'count':0x0,'rows':[]};return db[_0xfcbe('0x37')][_0xfcbe('0x5f')]({'where':{'id':_0x28d7a5['params']['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x2cd4f9,null))[_0xfcbe('0x1a')](function(_0x11192e){if(_0x11192e){_0x2f5813[_0xfcbe('0x40')]=_[_0xfcbe('0x3d')](db['OpenchannelInteraction'][_0xfcbe('0x38')]);_0x2f5813[_0xfcbe('0x3c')]=_[_0xfcbe('0x3d')](_0x28d7a5['query']);_0x2f5813['filters']=_[_0xfcbe('0x3f')](_0x2f5813[_0xfcbe('0x40')],_0x2f5813[_0xfcbe('0x3c')]);_0xa40ef4[_0xfcbe('0x42')]=_['intersection'](_0x2f5813[_0xfcbe('0x40')],qs[_0xfcbe('0x41')](_0x28d7a5[_0xfcbe('0x3c')]['fields']));_0xa40ef4[_0xfcbe('0x42')]=_0xa40ef4[_0xfcbe('0x42')][_0xfcbe('0x43')]?_0xa40ef4[_0xfcbe('0x42')]:_0x2f5813[_0xfcbe('0x40')];if(!_0x28d7a5['query'][_0xfcbe('0x44')](_0xfcbe('0x60'))){_0xa40ef4['limit']=qs[_0xfcbe('0x2a')](_0x28d7a5['query'][_0xfcbe('0x2a')]);_0xa40ef4[_0xfcbe('0x27')]=qs[_0xfcbe('0x27')](_0x28d7a5[_0xfcbe('0x3c')][_0xfcbe('0x27')]);}_0xa40ef4[_0xfcbe('0x45')]=qs[_0xfcbe('0x46')](_0x28d7a5[_0xfcbe('0x3c')][_0xfcbe('0x46')]);_0xa40ef4[_0xfcbe('0x47')]=qs[_0xfcbe('0x3e')](_[_0xfcbe('0x48')](_0x28d7a5[_0xfcbe('0x3c')],_0x2f5813['filters']));_0xa40ef4[_0xfcbe('0x47')][_0xfcbe('0x5c')]=_0x11192e['id'];if(_0x28d7a5[_0xfcbe('0x3c')]['filter']){_0xa40ef4[_0xfcbe('0x47')]=_[_0xfcbe('0x4a')](_0xa40ef4['where'],{'$or':_[_0xfcbe('0x36')](_0xa40ef4[_0xfcbe('0x42')],function(_0x49d197){var _0x40737d={};_0x40737d[_0x49d197]={'$like':'%'+_0x28d7a5[_0xfcbe('0x3c')][_0xfcbe('0x49')]+'%'};return _0x40737d;})});}_0xa40ef4=_[_0xfcbe('0x4a')]({},_0xa40ef4,_0x28d7a5[_0xfcbe('0x61')]);return db[_0xfcbe('0x8b')][_0xfcbe('0x29')]({'where':_0xa40ef4[_0xfcbe('0x47')]})[_0xfcbe('0x1a')](function(_0x22eca4){_0x179528['count']=_0x22eca4;if(_0x28d7a5[_0xfcbe('0x3c')][_0xfcbe('0x62')]){_0xa40ef4['include']=[{'model':db[_0xfcbe('0x7a')],'as':_0xfcbe('0xa5'),'required':![]},{'model':db[_0xfcbe('0x96')],'as':'Owner','attributes':[_0xfcbe('0x32'),_0xfcbe('0xa6'),'internal'],'required':![]},{'model':db[_0xfcbe('0xa7')],'as':_0xfcbe('0xa8'),'attributes':['id',_0xfcbe('0x32'),_0xfcbe('0xa9')],'where':_0x28d7a5['query'][_0xfcbe('0xaa')]?{'id':_0x28d7a5['query'][_0xfcbe('0xaa')]}:undefined,'required':_0x28d7a5[_0xfcbe('0x3c')][_0xfcbe('0xaa')]?!![]:![]}];}return db[_0xfcbe('0x8b')][_0xfcbe('0x4c')](_0xa40ef4);})['then'](function(_0x1acb88){_0x179528[_0xfcbe('0x4d')]=_0x1acb88;return _0x179528;});}})[_0xfcbe('0x1a')](respondWithFilteredResult(_0x2cd4f9,_0xa40ef4))['catch'](handleError(_0x2cd4f9,null));};exports[_0xfcbe('0xab')]=function(_0x48463b,_0x854b82,_0x44117e){return db['OpenchannelAccount'][_0xfcbe('0x51')]({'where':{'id':_0x48463b[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x854b82,null))[_0xfcbe('0x1a')](function(_0x141c65){if(_0x141c65){return _0x141c65['addAgents'](_0x48463b[_0xfcbe('0x53')]['ids'],_[_0xfcbe('0xac')](_0x48463b[_0xfcbe('0x53')],[_0xfcbe('0x64'),'id'])||{})[_0xfcbe('0x8d')](function(_0x2310d7){for(var _0x2aa179=0x0;_0x2aa179<_0x48463b[_0xfcbe('0x53')]['ids'][_0xfcbe('0x43')];_0x2aa179+=0x1){socket['emit'](_0xfcbe('0xad'),{'UserId':Number(_0x48463b[_0xfcbe('0x53')][_0xfcbe('0x64')][_0x2aa179]),'OpenchannelAccountId':Number(_0x48463b[_0xfcbe('0x4f')]['id'])});}return _0x2310d7;});}})[_0xfcbe('0x1a')](respondWithResult(_0x854b82,null))['catch'](handleError(_0x854b82,null));};exports[_0xfcbe('0xae')]=function(_0x1835e8,_0x450058,_0x1ae619){return db[_0xfcbe('0x37')][_0xfcbe('0x51')]({'where':{'id':_0x1835e8['params']['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x450058,null))[_0xfcbe('0x1a')](function(_0x52f20d){if(_0x52f20d){return _0x52f20d[_0xfcbe('0xae')](_0x1835e8[_0xfcbe('0x3c')][_0xfcbe('0x64')])['then'](function(){if(_[_0xfcbe('0xaf')](_0x1835e8[_0xfcbe('0x3c')][_0xfcbe('0x64')])){for(var _0x1dc0c8=0x0;_0x1dc0c8<_0x1835e8[_0xfcbe('0x3c')][_0xfcbe('0x64')][_0xfcbe('0x43')];_0x1dc0c8+=0x1){socket[_0xfcbe('0xb0')](_0xfcbe('0xb1'),{'UserId':Number(_0x1835e8[_0xfcbe('0x3c')]['ids'][_0x1dc0c8]),'OpenchannelAccountId':Number(_0x1835e8[_0xfcbe('0x4f')]['id'])});}}else{socket[_0xfcbe('0xb0')](_0xfcbe('0xb1'),{'UserId':Number(_0x1835e8[_0xfcbe('0x3c')][_0xfcbe('0x64')]),'OpenchannelAccountId':Number(_0x1835e8[_0xfcbe('0x4f')]['id'])});}});}})[_0xfcbe('0x1a')](respondWithStatusCode(_0x450058,null))['catch'](handleError(_0x450058,null));};exports[_0xfcbe('0xb2')]=function(_0x541c81,_0x57eea0,_0x1cd4be){var _0x4b1172={};var _0x3dd107={};var _0x5df84c;var _0x85bbad;return db[_0xfcbe('0x37')][_0xfcbe('0x5f')]({'where':{'id':_0x541c81['params']['id']}})['then'](handleEntityNotFound(_0x57eea0,null))[_0xfcbe('0x1a')](function(_0xe84c7d){if(_0xe84c7d){_0x5df84c=_0xe84c7d;_0x3dd107[_0xfcbe('0x40')]=_[_0xfcbe('0x3d')](db[_0xfcbe('0x96')]['rawAttributes']);_0x3dd107[_0xfcbe('0x3c')]=_[_0xfcbe('0x3d')](_0x541c81[_0xfcbe('0x3c')]);_0x3dd107[_0xfcbe('0x3e')]=_[_0xfcbe('0x3f')](_0x3dd107['model'],_0x3dd107[_0xfcbe('0x3c')]);_0x4b1172[_0xfcbe('0x42')]=_[_0xfcbe('0x3f')](_0x3dd107['model'],qs[_0xfcbe('0x41')](_0x541c81[_0xfcbe('0x3c')][_0xfcbe('0x41')]));_0x4b1172[_0xfcbe('0x42')]=_0x4b1172[_0xfcbe('0x42')]['length']?_0x4b1172[_0xfcbe('0x42')]:_0x3dd107['model'];_0x4b1172['order']=qs[_0xfcbe('0x46')](_0x541c81['query'][_0xfcbe('0x46')]);_0x4b1172[_0xfcbe('0x47')]=qs[_0xfcbe('0x3e')](_[_0xfcbe('0x48')](_0x541c81['query'],_0x3dd107[_0xfcbe('0x3e')]));if(_0x541c81['query'][_0xfcbe('0x49')]){_0x4b1172[_0xfcbe('0x47')]=_['merge'](_0x4b1172[_0xfcbe('0x47')],{'$or':_[_0xfcbe('0x36')](_0x4b1172[_0xfcbe('0x42')],function(_0x4aea63){var _0x552d3b={};_0x552d3b[_0x4aea63]={'$like':'%'+_0x541c81[_0xfcbe('0x3c')]['filter']+'%'};return _0x552d3b;})});}_0x4b1172=_[_0xfcbe('0x4a')]({},_0x4b1172,_0x541c81[_0xfcbe('0x61')]);return _0x5df84c[_0xfcbe('0xb2')](_0x4b1172);}})[_0xfcbe('0x1a')](function(_0x1f0bae){if(_0x1f0bae){_0x85bbad=_0x1f0bae[_0xfcbe('0x43')];if(!_0x541c81[_0xfcbe('0x3c')][_0xfcbe('0x44')](_0xfcbe('0x60'))){_0x4b1172[_0xfcbe('0x2a')]=qs[_0xfcbe('0x2a')](_0x541c81[_0xfcbe('0x3c')]['limit']);_0x4b1172[_0xfcbe('0x27')]=qs[_0xfcbe('0x27')](_0x541c81[_0xfcbe('0x3c')][_0xfcbe('0x27')]);}return _0x5df84c['getAgents'](_0x4b1172);}})['then'](function(_0x33d859){if(_0x33d859){return _0x33d859?{'count':_0x85bbad,'rows':_0x33d859}:null;}})[_0xfcbe('0x1a')](respondWithResult(_0x57eea0,null))[_0xfcbe('0x22')](handleError(_0x57eea0,null));};exports[_0xfcbe('0x33')]=function(_0x29c319,_0x451d6b,_0x5afe3d){var _0x38e200,_0x1487dd,_0x50a0bf;if(_[_0xfcbe('0x72')](_0x29c319[_0xfcbe('0x53')][_0xfcbe('0x53')])||_0x29c319[_0xfcbe('0x53')][_0xfcbe('0x53')]===''){throw new db['Sequelize'][(_0xfcbe('0x6b'))](_0xfcbe('0x74'));}if(_[_0xfcbe('0x72')](_0x29c319['body']['to'])){}_0x38e200=_0x29c319['body']['to'];return db['OpenchannelAccount'][_0xfcbe('0x5f')]({'where':{'id':_0x29c319[_0xfcbe('0x4f')]['id']}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x451d6b,null))[_0xfcbe('0x1a')](function(_0x5dbf26){if(_0x5dbf26){return db[_0xfcbe('0x37')][_0xfcbe('0x51')]({'where':{'id':_0x5dbf26['id']},'include':[{'model':db[_0xfcbe('0x78')],'as':_0xfcbe('0x79'),'include':[{'model':db[_0xfcbe('0x7a')],'as':_0xfcbe('0x7b'),'where':{[_0x5dbf26[_0xfcbe('0x75')]]:_0x38e200},'limit':0x1,'order':[['updatedAt',_0xfcbe('0x7c')]]}]}]})[_0xfcbe('0x1a')](handleEntityNotFound(_0x451d6b,null))[_0xfcbe('0x1a')](function(_0x40465f){if(_0x40465f&&_0x40465f[_0xfcbe('0x79')]){_0x1487dd=_0x40465f[_0xfcbe('0x2f')]({'plain':!![]});if(_0x1487dd[_0xfcbe('0x79')]&&_0x1487dd['List'][_0xfcbe('0x7b')]['length']){return _0x1487dd['List'][_0xfcbe('0x7b')][0x0];}return db[_0xfcbe('0x7a')][_0xfcbe('0x52')](_[_0xfcbe('0x85')](_0x29c319[_0xfcbe('0x53')],{'firstName':_0x38e200,[_0x40465f[_0xfcbe('0x75')]]:_0x38e200,'phone':_0x38e200,'ListId':_0x1487dd[_0xfcbe('0x71')]}));}})[_0xfcbe('0x1a')](handleEntityNotFound(_0x451d6b,null))[_0xfcbe('0x1a')](function(_0x49d54e){if(_0x49d54e){_0x50a0bf=_0x49d54e;return db[_0xfcbe('0x8b')][_0xfcbe('0x51')]({'where':{'ContactId':_0x50a0bf['id'],'closed':![],'OpenchannelAccountId':_0x1487dd['id']}})[_0xfcbe('0x1a')](function(_0x57fdb5){if(_0x57fdb5){return[_0x57fdb5,![]];}return db[_0xfcbe('0x8b')][_0xfcbe('0x52')]({'UserId':_0x29c319[_0xfcbe('0xb3')]['id'],'ContactId':_0x50a0bf['id'],'OpenchannelAccountId':_0x1487dd['id'],'lastMsgDirection':_0xfcbe('0xb4'),'Messages':[_[_0xfcbe('0x4a')](_0x29c319['body'],{'read':![],'body':_0x29c319[_0xfcbe('0x53')][_0xfcbe('0x53')],'OpenchannelAccountId':_0x1487dd['id'],'UserId':_0x29c319[_0xfcbe('0xb3')]['id'],'ContactId':_0x50a0bf['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xfcbe('0xb5')}]})[_0xfcbe('0x1a')](function(_0x29dcc0){return[_0x29dcc0,!![]];});});}})[_0xfcbe('0x8d')](function(_0x42bd1d,_0xa3f130){if(_0xa3f130){return _0x42bd1d;}return db[_0xfcbe('0x94')][_0xfcbe('0x52')](_[_0xfcbe('0x4a')](_0x29c319[_0xfcbe('0x53')],{'read':![],'body':_0x29c319[_0xfcbe('0x53')][_0xfcbe('0x53')],'OpenchannelAccountId':_0x1487dd['id'],'OpenchannelInteractionId':_0x42bd1d['id'],'UserId':_0x29c319['user']['id'],'ContactId':_0x50a0bf['id']}))[_0xfcbe('0x1a')](function(_0x50980c){_0x42bd1d[_0xfcbe('0xb6')]['Messages']=[];_0x42bd1d[_0xfcbe('0xb6')][_0xfcbe('0xb5')][_0xfcbe('0x92')](_0x50980c[_0xfcbe('0xb6')]);return _0x42bd1d;});});}})[_0xfcbe('0x1a')](respondWithResult(_0x451d6b,null))['catch'](handleError(_0x451d6b,null));}; \ No newline at end of file +var _0x83bb=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','limit','undefined','count','offset','set','json','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','intersection','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','OpenchannelAccountId','Disposition','getDispositions','findOne','filter','removeDispositions','addAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','describe','ValidationError','createdAt','updatedAt','difference','CompanyId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','Applications','List','applications','list','orderBy','asc','account','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x529351,_0x3ac704){var _0x41cd56=function(_0x540861){while(--_0x540861){_0x529351['push'](_0x529351['shift']());}};_0x41cd56(++_0x3ac704);}(_0x83bb,0x173));var _0xb83b=function(_0x2fe653,_0x426d20){_0x2fe653=_0x2fe653-0x0;var _0x1f640d=_0x83bb[_0x2fe653];return _0x1f640d;};'use strict';var emlformat=require(_0xb83b('0x0'));var rimraf=require(_0xb83b('0x1'));var zipdir=require(_0xb83b('0x2'));var jsonpatch=require(_0xb83b('0x3'));var rp=require('request-promise');var moment=require(_0xb83b('0x4'));var BPromise=require(_0xb83b('0x5'));var Mustache=require(_0xb83b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb83b('0x7'));var csv=require(_0xb83b('0x8'));var ejs=require(_0xb83b('0x9'));var fs=require('fs');var fs_extra=require(_0xb83b('0xa'));var _=require(_0xb83b('0xb'));var squel=require(_0xb83b('0xc'));var crypto=require(_0xb83b('0xd'));var jsforce=require(_0xb83b('0xe'));var deskjs=require(_0xb83b('0xf'));var toCsv=require(_0xb83b('0x8'));var querystring=require('querystring');var Papa=require(_0xb83b('0x10'));var Redis=require('ioredis');var authService=require(_0xb83b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb83b('0x12'));var hardwareService=require(_0xb83b('0x13'));var logger=require(_0xb83b('0x14'))(_0xb83b('0x15'));var utils=require(_0xb83b('0x16'));var config=require(_0xb83b('0x17'));var licenseUtil=require(_0xb83b('0x18'));var db=require(_0xb83b('0x19'))['db'];config['redis']=_[_0xb83b('0x1a')](config[_0xb83b('0x1b')],{'host':_0xb83b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb83b('0x1b')]));require(_0xb83b('0x1d'))[_0xb83b('0x1e')](socket);var jayson=require(_0xb83b('0x1f'));var client=jayson[_0xb83b('0x20')][_0xb83b('0x21')]({'port':0x232c});var client9002=jayson[_0xb83b('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x296a7f,_0x395403,_0x511b3e,_0x4bf9a4){return new BPromise(function(_0x5bc487,_0x2c64b4){var _0x5e4737=_0x4bf9a4||client;return _0x5e4737['request'](_0x296a7f,_0x511b3e)[_0xb83b('0x22')](function(_0x259843){logger[_0xb83b('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x395403,_0xb83b('0x24'));logger[_0xb83b('0x25')](_0xb83b('0x26'),_0x395403,_0xb83b('0x24'),JSON['stringify'](_0x259843));if(_0x259843[_0xb83b('0x27')]){if(_0x259843[_0xb83b('0x27')][_0xb83b('0x28')]===0x1f4){logger[_0xb83b('0x27')](_0xb83b('0x29'),_0x395403,_0x259843[_0xb83b('0x27')]['message']);return _0x2c64b4(_0x259843[_0xb83b('0x27')][_0xb83b('0x2a')]);}logger[_0xb83b('0x27')](_0xb83b('0x29'),_0x395403,_0x259843[_0xb83b('0x27')][_0xb83b('0x2a')]);return _0x5bc487(_0x259843[_0xb83b('0x27')][_0xb83b('0x2a')]);}else{logger[_0xb83b('0x23')](_0xb83b('0x29'),_0x395403,_0xb83b('0x24'));_0x5bc487(_0x259843[_0xb83b('0x2b')][_0xb83b('0x2a')]);}})[_0xb83b('0x2c')](function(_0x2f67ef){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x395403,_0x2f67ef);_0x2c64b4(_0x2f67ef);});});}function respondWithStatusCode(_0xf93fa7,_0x2a8093){_0x2a8093=_0x2a8093||0xcc;return function(_0x50f0c0){if(_0x50f0c0){return _0xf93fa7[_0xb83b('0x2d')](_0x2a8093);}return _0xf93fa7['status'](_0x2a8093)[_0xb83b('0x2e')]();};}function respondWithResult(_0x422c69,_0x596763){_0x596763=_0x596763||0xc8;return function(_0x43b829){if(_0x43b829){return _0x422c69[_0xb83b('0x2f')](_0x596763)['json'](_0x43b829);}};}function respondWithFilteredResult(_0x5d7d00,_0x244f90){return function(_0x5613e6){if(_0x5613e6){var _0x2d952d=typeof _0x244f90['offset']==='undefined'&&typeof _0x244f90[_0xb83b('0x30')]===_0xb83b('0x31');var _0x33aa0b=_0x5613e6[_0xb83b('0x32')];var _0x1c2711=_0x2d952d?0x0:_0x244f90[_0xb83b('0x33')];var _0x43ddb9=_0x2d952d?_0x5613e6[_0xb83b('0x32')]:_0x244f90[_0xb83b('0x33')]+_0x244f90[_0xb83b('0x30')];var _0x55694d;if(_0x43ddb9>=_0x33aa0b){_0x43ddb9=_0x33aa0b;_0x55694d=0xc8;}else{_0x55694d=0xce;}_0x5d7d00[_0xb83b('0x2f')](_0x55694d);return _0x5d7d00[_0xb83b('0x34')]('Content-Range',_0x1c2711+'-'+_0x43ddb9+'/'+_0x33aa0b)[_0xb83b('0x35')](_0x5613e6);}return null;};}function patchUpdates(_0x4d7938){return function(_0x3aa2c0){try{jsonpatch['apply'](_0x3aa2c0,_0x4d7938,!![]);}catch(_0x1eb708){return BPromise[_0xb83b('0x36')](_0x1eb708);}return _0x3aa2c0[_0xb83b('0x37')]();};}function saveUpdates(_0x3a9176,_0x10c64c){return function(_0xddfd6b){if(_0xddfd6b){return _0xddfd6b[_0xb83b('0x38')](_0x3a9176)[_0xb83b('0x22')](function(_0x25b84d){return _0x25b84d;});}return null;};}function removeEntity(_0x20c211,_0x5d565e){return function(_0x51bdf1){if(_0x51bdf1){return _0x51bdf1[_0xb83b('0x39')]()[_0xb83b('0x22')](function(){var _0x24d86d=_0x51bdf1[_0xb83b('0x3a')]({'plain':!![]});var _0x2f7b05=_0xb83b('0x3b');return db[_0xb83b('0x3c')][_0xb83b('0x39')]({'where':{'type':_0x2f7b05,'resourceId':_0x24d86d['id']}})[_0xb83b('0x22')](function(){return _0x51bdf1;});})[_0xb83b('0x22')](function(){_0x20c211[_0xb83b('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x2c4b38){return function(_0x15bb44){if(!_0x15bb44){_0x4f31f6['sendStatus'](0x194);}return _0x15bb44;};}function handleError(_0xb7a9ac,_0x460bb0){_0x460bb0=_0x460bb0||0x1f4;return function(_0x338b62){logger['error'](_0x338b62[_0xb83b('0x3d')]);if(_0x338b62[_0xb83b('0x3e')]){delete _0x338b62['name'];}_0xb7a9ac[_0xb83b('0x2f')](_0x460bb0)['send'](_0x338b62);};}exports[_0xb83b('0x3f')]=function(_0x1f356b,_0x21365d){var _0x3eee80={'include':[{'model':db[_0xb83b('0x40')],'as':'mandatoryDispositionPause'}]},_0x166d13={},_0x28aeee={'count':0x0,'rows':[]};var _0x2f45ff=_[_0xb83b('0x41')](db[_0xb83b('0x42')][_0xb83b('0x43')],function(_0xf68c36){return{'name':_0xf68c36[_0xb83b('0x44')],'type':_0xf68c36[_0xb83b('0x45')]['key']};});_0x166d13['model']=_['map'](_0x2f45ff,_0xb83b('0x3e'));_0x166d13['query']=_['keys'](_0x1f356b['query']);_0x166d13['filters']=_['intersection'](_0x166d13[_0xb83b('0x46')],_0x166d13[_0xb83b('0x47')]);_0x3eee80[_0xb83b('0x48')]=_['intersection'](_0x166d13[_0xb83b('0x46')],qs[_0xb83b('0x49')](_0x1f356b[_0xb83b('0x47')][_0xb83b('0x49')]));_0x3eee80[_0xb83b('0x48')]=_0x3eee80[_0xb83b('0x48')][_0xb83b('0x4a')]?_0x3eee80[_0xb83b('0x48')]:_0x166d13[_0xb83b('0x46')];if(!_0x1f356b[_0xb83b('0x47')][_0xb83b('0x4b')](_0xb83b('0x4c'))){_0x3eee80[_0xb83b('0x30')]=qs['limit'](_0x1f356b[_0xb83b('0x47')][_0xb83b('0x30')]);_0x3eee80[_0xb83b('0x33')]=qs['offset'](_0x1f356b[_0xb83b('0x47')][_0xb83b('0x33')]);}_0x3eee80[_0xb83b('0x4d')]=qs[_0xb83b('0x4e')](_0x1f356b[_0xb83b('0x47')][_0xb83b('0x4e')]);_0x3eee80[_0xb83b('0x4f')]=qs[_0xb83b('0x50')](_[_0xb83b('0x51')](_0x1f356b[_0xb83b('0x47')],_0x166d13[_0xb83b('0x50')]),_0x2f45ff);if(_0x1f356b['query']['filter']){_0x3eee80[_0xb83b('0x4f')]=_[_0xb83b('0x52')](_0x3eee80[_0xb83b('0x4f')],{'$or':_[_0xb83b('0x41')](_0x2f45ff,function(_0x170b0e){if(_0x170b0e[_0xb83b('0x45')]!==_0xb83b('0x53')){var _0x588c41={};_0x588c41[_0x170b0e[_0xb83b('0x3e')]]={'$like':'%'+_0x1f356b[_0xb83b('0x47')]['filter']+'%'};return _0x588c41;}})});}_0x3eee80=_[_0xb83b('0x52')]({},_0x3eee80,_0x1f356b['options']);var _0x373994={'where':_0x3eee80[_0xb83b('0x4f')]};return db[_0xb83b('0x42')][_0xb83b('0x32')](_0x373994)[_0xb83b('0x22')](function(_0x689720){_0x28aeee['count']=_0x689720;if(_0x1f356b[_0xb83b('0x47')][_0xb83b('0x54')]){_0x3eee80['include']=[{'all':!![]}];}return db[_0xb83b('0x42')][_0xb83b('0x55')](_0x3eee80);})[_0xb83b('0x22')](function(_0x5c88b6){_0x28aeee[_0xb83b('0x56')]=_0x5c88b6;return _0x28aeee;})[_0xb83b('0x22')](respondWithFilteredResult(_0x21365d,_0x3eee80))[_0xb83b('0x2c')](handleError(_0x21365d,null));};exports[_0xb83b('0x57')]=function(_0x245797,_0x29403e){var _0x54572f={'raw':![],'where':{'id':_0x245797[_0xb83b('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2c64c1={};_0x2c64c1[_0xb83b('0x46')]=_[_0xb83b('0x59')](db[_0xb83b('0x42')][_0xb83b('0x43')]);_0x2c64c1['query']=_[_0xb83b('0x59')](_0x245797[_0xb83b('0x47')]);_0x2c64c1[_0xb83b('0x50')]=_['intersection'](_0x2c64c1[_0xb83b('0x46')],_0x2c64c1['query']);_0x54572f[_0xb83b('0x48')]=_[_0xb83b('0x5a')](_0x2c64c1[_0xb83b('0x46')],qs['fields'](_0x245797[_0xb83b('0x47')]['fields']));_0x54572f[_0xb83b('0x48')]=_0x54572f['attributes'][_0xb83b('0x4a')]?_0x54572f['attributes']:_0x2c64c1[_0xb83b('0x46')];if(_0x245797[_0xb83b('0x47')][_0xb83b('0x54')]){_0x54572f[_0xb83b('0x5b')]=[{'all':!![]}];}_0x54572f=_[_0xb83b('0x52')]({},_0x54572f,_0x245797[_0xb83b('0x5c')]);return db['OpenchannelAccount'][_0xb83b('0x5d')](_0x54572f)[_0xb83b('0x22')](handleEntityNotFound(_0x29403e,null))[_0xb83b('0x22')](respondWithResult(_0x29403e,null))[_0xb83b('0x2c')](handleError(_0x29403e,null));};exports[_0xb83b('0x5e')]=function(_0x228101,_0x51321e){return db[_0xb83b('0x42')][_0xb83b('0x5e')](_0x228101[_0xb83b('0x5f')],{})[_0xb83b('0x22')](function(_0x333615){var _0x326437=_0x228101[_0xb83b('0x60')][_0xb83b('0x3a')]({'plain':!![]});if(!_0x326437)throw new Error(_0xb83b('0x61'));if(_0x326437[_0xb83b('0x62')]===_0xb83b('0x60')){var _0x572b4f=_0x333615[_0xb83b('0x3a')]({'plain':!![]});var _0x4167b2=_0xb83b('0x3b');return db[_0xb83b('0x63')][_0xb83b('0x5d')]({'where':{'name':_0x4167b2,'userProfileId':_0x326437[_0xb83b('0x64')]},'raw':!![]})[_0xb83b('0x22')](function(_0x41f47c){if(_0x41f47c&&_0x41f47c[_0xb83b('0x65')]===0x0){return db[_0xb83b('0x3c')][_0xb83b('0x5e')]({'name':_0x572b4f[_0xb83b('0x3e')],'resourceId':_0x572b4f['id'],'type':_0x41f47c[_0xb83b('0x3e')],'sectionId':_0x41f47c['id']},{})['then'](function(){return _0x333615;});}else{return _0x333615;}})[_0xb83b('0x2c')](function(_0x21a3b1){logger[_0xb83b('0x27')](_0xb83b('0x66'),_0x21a3b1);throw _0x21a3b1;});}return _0x333615;})[_0xb83b('0x22')](respondWithResult(_0x51321e,0xc9))['catch'](handleError(_0x51321e,null));};exports[_0xb83b('0x38')]=function(_0x2fdb8a,_0x4d16fa){if(_0x2fdb8a[_0xb83b('0x5f')]['id']){delete _0x2fdb8a[_0xb83b('0x5f')]['id'];}return db['OpenchannelAccount'][_0xb83b('0x5d')]({'where':{'id':_0x2fdb8a[_0xb83b('0x58')]['id']},'include':[{'model':db[_0xb83b('0x40')],'as':'mandatoryDispositionPause'}]})[_0xb83b('0x22')](handleEntityNotFound(_0x4d16fa,null))[_0xb83b('0x22')](saveUpdates(_0x2fdb8a[_0xb83b('0x5f')],null))[_0xb83b('0x22')](respondWithResult(_0x4d16fa,null))[_0xb83b('0x2c')](handleError(_0x4d16fa,null));};exports[_0xb83b('0x39')]=function(_0x4ae535,_0x223648){return db[_0xb83b('0x42')]['find']({'where':{'id':_0x4ae535['params']['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x223648,null))['then'](removeEntity(_0x223648,null))[_0xb83b('0x2c')](handleError(_0x223648,null));};exports['describe']=function(_0x5ae370,_0x1a4f64){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x1a4f64,null))[_0xb83b('0x2c')](handleError(_0x1a4f64,null));};exports['addDisposition']=function(_0x18c664,_0x298349,_0x1923b3){if(_0x18c664[_0xb83b('0x5f')]['id']){delete _0x18c664[_0xb83b('0x5f')]['id'];}return db[_0xb83b('0x42')][_0xb83b('0x5d')]({'where':{'id':_0x18c664[_0xb83b('0x58')]['id']}})['then'](handleEntityNotFound(_0x298349,null))[_0xb83b('0x22')](function(_0x5c7f14){if(_0x5c7f14){_0x18c664['body'][_0xb83b('0x67')]=_0x5c7f14['id'];return db[_0xb83b('0x68')][_0xb83b('0x5e')](_0x18c664[_0xb83b('0x5f')]);}})[_0xb83b('0x22')](respondWithResult(_0x298349,null))[_0xb83b('0x2c')](handleError(_0x298349,null));};exports[_0xb83b('0x69')]=function(_0x2a7c23,_0x3fe3e4,_0x4f4497){var _0x5f2503={'raw':![],'where':{}};var _0x23b99f={};var _0x57fffe={'count':0x0,'rows':[]};return db[_0xb83b('0x42')][_0xb83b('0x6a')]({'where':{'id':_0x2a7c23[_0xb83b('0x58')]['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x3fe3e4,null))['then'](function(_0xda4352){if(_0xda4352){_0x23b99f[_0xb83b('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x23b99f[_0xb83b('0x47')]=_[_0xb83b('0x59')](_0x2a7c23[_0xb83b('0x47')]);_0x23b99f['filters']=_[_0xb83b('0x5a')](_0x23b99f[_0xb83b('0x46')],_0x23b99f[_0xb83b('0x47')]);_0x5f2503[_0xb83b('0x48')]=_[_0xb83b('0x5a')](_0x23b99f[_0xb83b('0x46')],qs[_0xb83b('0x49')](_0x2a7c23[_0xb83b('0x47')][_0xb83b('0x49')]));_0x5f2503['attributes']=_0x5f2503[_0xb83b('0x48')][_0xb83b('0x4a')]?_0x5f2503['attributes']:_0x23b99f[_0xb83b('0x46')];if(!_0x2a7c23[_0xb83b('0x47')][_0xb83b('0x4b')](_0xb83b('0x4c'))){_0x5f2503[_0xb83b('0x30')]=qs[_0xb83b('0x30')](_0x2a7c23[_0xb83b('0x47')][_0xb83b('0x30')]);_0x5f2503[_0xb83b('0x33')]=qs[_0xb83b('0x33')](_0x2a7c23[_0xb83b('0x47')]['offset']);}_0x5f2503[_0xb83b('0x4d')]=qs[_0xb83b('0x4e')](_0x2a7c23['query'][_0xb83b('0x4e')]);_0x5f2503[_0xb83b('0x4f')]=qs[_0xb83b('0x50')](_[_0xb83b('0x51')](_0x2a7c23[_0xb83b('0x47')],_0x23b99f[_0xb83b('0x50')]));_0x5f2503['where'][_0xb83b('0x67')]=_0xda4352['id'];if(_0x2a7c23['query'][_0xb83b('0x6b')]){_0x5f2503[_0xb83b('0x4f')]=_[_0xb83b('0x52')](_0x5f2503[_0xb83b('0x4f')],{'$or':_[_0xb83b('0x41')](_0x5f2503[_0xb83b('0x48')],function(_0x543abc){var _0x373bc1={};_0x373bc1[_0x543abc]={'$like':'%'+_0x2a7c23[_0xb83b('0x47')][_0xb83b('0x6b')]+'%'};return _0x373bc1;})});}_0x5f2503=_[_0xb83b('0x52')]({},_0x5f2503,_0x2a7c23[_0xb83b('0x5c')]);return db[_0xb83b('0x68')][_0xb83b('0x32')]({'where':_0x5f2503[_0xb83b('0x4f')]})['then'](function(_0x54712c){_0x57fffe[_0xb83b('0x32')]=_0x54712c;if(_0x2a7c23[_0xb83b('0x47')][_0xb83b('0x54')]){_0x5f2503['include']=[{'all':!![]}];}return db['Disposition'][_0xb83b('0x55')](_0x5f2503);})[_0xb83b('0x22')](function(_0x4c0bd5){_0x57fffe[_0xb83b('0x56')]=_0x4c0bd5;return _0x57fffe;});}})[_0xb83b('0x22')](respondWithFilteredResult(_0x3fe3e4,_0x5f2503))['catch'](handleError(_0x3fe3e4,null));};exports[_0xb83b('0x6c')]=function(_0x5587f0,_0x393a77,_0x33bca1){return db[_0xb83b('0x42')][_0xb83b('0x5d')]({'where':{'id':_0x5587f0[_0xb83b('0x58')]['id']}})['then'](handleEntityNotFound(_0x393a77,null))[_0xb83b('0x22')](function(_0x2244db){if(_0x2244db){return _0x2244db[_0xb83b('0x6c')](_0x5587f0[_0xb83b('0x47')]['ids']);}})[_0xb83b('0x22')](respondWithStatusCode(_0x393a77,null))['catch'](handleError(_0x393a77,null));};exports[_0xb83b('0x6d')]=function(_0x32ce24,_0x3a2a38,_0x38b5c6){if(_0x32ce24[_0xb83b('0x5f')]['id']){delete _0x32ce24[_0xb83b('0x5f')]['id'];}return db['OpenchannelAccount'][_0xb83b('0x5d')]({'where':{'id':_0x32ce24[_0xb83b('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a2a38,null))[_0xb83b('0x22')](function(_0x5042f0){if(_0x5042f0){_0x32ce24[_0xb83b('0x5f')][_0xb83b('0x67')]=_0x5042f0['id'];return db['CannedAnswer'][_0xb83b('0x5e')](_0x32ce24[_0xb83b('0x5f')]);}})['then'](respondWithResult(_0x3a2a38,null))[_0xb83b('0x2c')](handleError(_0x3a2a38,null));};exports[_0xb83b('0x6e')]=function(_0xc0ef9a,_0x74e66d,_0x114b7f){var _0x11cb34={'raw':![],'where':{}};var _0x96b686={};var _0x485ae1={'count':0x0,'rows':[]};return db[_0xb83b('0x42')][_0xb83b('0x6a')]({'where':{'id':_0xc0ef9a['params']['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x74e66d,null))[_0xb83b('0x22')](function(_0x49e292){if(_0x49e292){_0x96b686['model']=_['keys'](db['CannedAnswer'][_0xb83b('0x43')]);_0x96b686['query']=_[_0xb83b('0x59')](_0xc0ef9a['query']);_0x96b686[_0xb83b('0x50')]=_[_0xb83b('0x5a')](_0x96b686[_0xb83b('0x46')],_0x96b686[_0xb83b('0x47')]);_0x11cb34[_0xb83b('0x48')]=_[_0xb83b('0x5a')](_0x96b686['model'],qs[_0xb83b('0x49')](_0xc0ef9a[_0xb83b('0x47')][_0xb83b('0x49')]));_0x11cb34['attributes']=_0x11cb34[_0xb83b('0x48')]['length']?_0x11cb34[_0xb83b('0x48')]:_0x96b686[_0xb83b('0x46')];if(!_0xc0ef9a['query'][_0xb83b('0x4b')](_0xb83b('0x4c'))){_0x11cb34[_0xb83b('0x30')]=qs['limit'](_0xc0ef9a[_0xb83b('0x47')]['limit']);_0x11cb34[_0xb83b('0x33')]=qs[_0xb83b('0x33')](_0xc0ef9a['query'][_0xb83b('0x33')]);}_0x11cb34['order']=qs['sort'](_0xc0ef9a['query'][_0xb83b('0x4e')]);_0x11cb34[_0xb83b('0x4f')]=qs['filters'](_[_0xb83b('0x51')](_0xc0ef9a[_0xb83b('0x47')],_0x96b686[_0xb83b('0x50')]));_0x11cb34[_0xb83b('0x4f')][_0xb83b('0x67')]=_0x49e292['id'];if(_0xc0ef9a[_0xb83b('0x47')][_0xb83b('0x6b')]){_0x11cb34[_0xb83b('0x4f')]=_['merge'](_0x11cb34['where'],{'$or':_[_0xb83b('0x41')](_0x11cb34[_0xb83b('0x48')],function(_0x24de64){var _0x1bfe87={};_0x1bfe87[_0x24de64]={'$like':'%'+_0xc0ef9a[_0xb83b('0x47')][_0xb83b('0x6b')]+'%'};return _0x1bfe87;})});}_0x11cb34=_[_0xb83b('0x52')]({},_0x11cb34,_0xc0ef9a[_0xb83b('0x5c')]);return db['CannedAnswer'][_0xb83b('0x32')]({'where':_0x11cb34[_0xb83b('0x4f')]})[_0xb83b('0x22')](function(_0x2f18ca){_0x485ae1[_0xb83b('0x32')]=_0x2f18ca;if(_0xc0ef9a[_0xb83b('0x47')][_0xb83b('0x54')]){_0x11cb34[_0xb83b('0x5b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x11cb34);})[_0xb83b('0x22')](function(_0x37f9cd){_0x485ae1[_0xb83b('0x56')]=_0x37f9cd;return _0x485ae1;});}})[_0xb83b('0x22')](respondWithFilteredResult(_0x74e66d,_0x11cb34))[_0xb83b('0x2c')](handleError(_0x74e66d,null));};exports[_0xb83b('0x6f')]=function(_0x3a6176,_0x1f5be4,_0x72fc20){return db[_0xb83b('0x42')][_0xb83b('0x5d')]({'where':{'id':_0x3a6176[_0xb83b('0x58')]['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x1f5be4,null))[_0xb83b('0x22')](function(_0x51c0a9){if(_0x51c0a9){return _0x51c0a9[_0xb83b('0x6f')](_0x3a6176[_0xb83b('0x47')][_0xb83b('0x70')]);}})['then'](respondWithStatusCode(_0x1f5be4,null))['catch'](handleError(_0x1f5be4,null));};exports[_0xb83b('0x71')]=function(_0xd363ea,_0x3f149e,_0xe2e0f7){var _0x34b50d={'body':_0xd363ea[_0xb83b('0x5f')],'channel':_0xb83b('0x72')};var _0x4232e3=[];var _0x150414=[];var _0x3a932a={};var _0x4c0634=![];return db[_0xb83b('0x73')][_0xb83b('0x74')]()[_0xb83b('0x22')](function(_0xc49af1){if(!_0xc49af1){throw new db['Sequelize'][(_0xb83b('0x75'))]('no\x20available\x20attributes');}_0x4232e3=_['difference'](_[_0xb83b('0x59')](_0xc49af1),[_0xb83b('0x76'),_0xb83b('0x77')]);_0x150414=_[_0xb83b('0x78')](_['keys'](_0xc49af1),[_0xb83b('0x76'),'updatedAt',_0xb83b('0x79'),'ListId']);if(_0xd363ea[_0xb83b('0x5f')]['id']){delete _0xd363ea[_0xb83b('0x5f')]['id'];}if(_['isNil'](_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x7a')])){throw new db[(_0xb83b('0x7b'))]['ValidationError'](_0xb83b('0x7c'));}if(_[_0xb83b('0x7d')](_0xd363ea[_0xb83b('0x5f')]['body'])||_0xd363ea['body']['body']===''){throw new db[(_0xb83b('0x7b'))]['ValidationError'](_0xb83b('0x7e'));}if(_[_0xb83b('0x7d')](_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x7f')])){throw new db[(_0xb83b('0x7b'))][(_0xb83b('0x75'))](_0xb83b('0x80')+_0x150414);}if(!_['includes'](_0x150414,_0xd363ea[_0xb83b('0x5f')]['mapKey'])){throw new db[(_0xb83b('0x7b'))][(_0xb83b('0x75'))](_0xb83b('0x81')+_0x150414);}_0x3a932a[_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x7f')]]=_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x7a')];})[_0xb83b('0x22')](function(){return db['OpenchannelAccount'][_0xb83b('0x5d')]({'where':{'id':_0xd363ea[_0xb83b('0x58')]['id']},'include':[{'model':db[_0xb83b('0x82')],'as':'List','include':[{'model':db[_0xb83b('0x73')],'as':_0xb83b('0x83'),'where':_0x3a932a,'limit':0x1,'order':[[_0xb83b('0x77'),_0xb83b('0x84')]]}]},{'model':db['OpenchannelApplication'],'as':_0xb83b('0x85')}]});})[_0xb83b('0x22')](handleEntityNotFound(_0x3f149e,null))[_0xb83b('0x22')](function(_0x56ee92){if(_0x56ee92&&_0x56ee92[_0xb83b('0x86')]){_0x34b50d['account']=_0x56ee92;_0x34b50d[_0xb83b('0x87')]=_0x56ee92[_0xb83b('0x85')];_0x34b50d[_0xb83b('0x88')]=_0x56ee92[_0xb83b('0x86')];_0x34b50d[_0xb83b('0x87')]=_[_0xb83b('0x89')](_0x34b50d[_0xb83b('0x87')],['priority'],[_0xb83b('0x8a')]);if(_0x34b50d[_0xb83b('0x8b')][_0xb83b('0x85')]){delete _0x34b50d[_0xb83b('0x8b')][_0xb83b('0x85')];}if(_0x34b50d[_0xb83b('0x8b')][_0xb83b('0x86')]&&_0x34b50d[_0xb83b('0x8b')][_0xb83b('0x86')][_0xb83b('0x83')][_0xb83b('0x4a')]){return _0x34b50d[_0xb83b('0x8b')][_0xb83b('0x86')][_0xb83b('0x83')][0x0];}var _0x4eae20=_[_0xb83b('0x1a')](_0xd363ea[_0xb83b('0x5f')],{'firstName':_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x7a')],'ListId':_0x56ee92[_0xb83b('0x8c')]});_0x4eae20[_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x7f')]]=_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x7a')];return db[_0xb83b('0x73')]['create'](_0x4eae20,{'fields':_0x4232e3,'raw':!![]});}})[_0xb83b('0x22')](handleEntityNotFound(_0x3f149e,null))[_0xb83b('0x22')](function(_0x4d6555){_0x34b50d[_0xb83b('0x8d')]=_0x4d6555;if(_0x4d6555){var _0x223812={'ContactId':_0x4d6555['id'],'OpenchannelAccountId':_0xd363ea[_0xb83b('0x58')]['id'],'from':(_0x4d6555['firstName']||'')+'\x20'+(_0x4d6555[_0xb83b('0x8e')]||'')};var _0x5c0bf2={'OpenchannelAccountId':_0xd363ea[_0xb83b('0x58')]['id'],'closed':![]};if(_0xd363ea['body'][_0xb83b('0x8f')]){_0x5c0bf2[_0xb83b('0x8f')]=_0xd363ea['body'][_0xb83b('0x8f')];return db[_0xb83b('0x90')][_0xb83b('0x5d')]({'where':_0x5c0bf2})[_0xb83b('0x22')](function(_0x9490e9){if(_0x9490e9){return[_0x9490e9,![]];}_0x223812[_0xb83b('0x8f')]=_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x8f')];_0x223812[_0xb83b('0x91')]=_0xd363ea['body'][_0xb83b('0x91')];return db['OpenchannelInteraction'][_0xb83b('0x5e')](_0x223812)[_0xb83b('0x22')](function(_0x2325c1){return[_0x2325c1,!![]];});});}else{_0x5c0bf2[_0xb83b('0x8f')]=null;}_0x5c0bf2[_0xb83b('0x92')]=_0x4d6555['id'];return db['OpenchannelInteraction'][_0xb83b('0x5d')]({'where':_0x5c0bf2})['then'](function(_0x5ec5da){if(_0x5ec5da){return[_0x5ec5da,![]];}return db[_0xb83b('0x90')]['create'](_0x223812)[_0xb83b('0x22')](function(_0x11dca2){return[_0x11dca2,!![]];});});}})[_0xb83b('0x93')](function(_0x14abf1,_0x9c3546){if(_0x14abf1){_0x4c0634=_0x9c3546;if(!_0x9c3546){var _0x155190={'from':(_0x34b50d[_0xb83b('0x8d')][_0xb83b('0x94')]||'')+'\x20'+(_0x34b50d[_0xb83b('0x8d')][_0xb83b('0x8e')]||'')};if(_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x8f')]&&_0xd363ea[_0xb83b('0x5f')]['messageId']&&_0xd363ea['body'][_0xb83b('0x8f')]!=_0xd363ea[_0xb83b('0x5f')]['messageId']){_0x155190[_0xb83b('0x8f')]=_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x95')];}return _0x14abf1[_0xb83b('0x38')](_0x155190);}else{return _0x14abf1;}}})['then'](function(_0x3e7dd7){_0x34b50d[_0xb83b('0x96')]=_0x3e7dd7['get']({'plain':!![]});_0x34b50d[_0xb83b('0x96')]['created']=_0x4c0634;if(_0x34b50d['interaction'][_0xb83b('0x97')]){if(_0x34b50d[_0xb83b('0x8b')][_0xb83b('0x98')]){_0x34b50d[_0xb83b('0x87')]['push']({'id':0x0,'priority':_0x34b50d['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xb83b('0x99')});}}return db[_0xb83b('0x9a')][_0xb83b('0x5e')]({'body':_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x5f')],'OpenchannelAccountId':_0xd363ea[_0xb83b('0x58')]['id'],'OpenchannelInteractionId':_0x3e7dd7['id'],'direction':'in','ContactId':_0x34b50d[_0xb83b('0x8d')]['id'],'AttachmentId':_0xd363ea[_0xb83b('0x5f')][_0xb83b('0x9b')]});})[_0xb83b('0x22')](function(_0x514a39){_0x34b50d['message']=_0x514a39;if(_0x34b50d['interaction'][_0xb83b('0x9c')]){return db[_0xb83b('0x9d')][_0xb83b('0x5d')]({'attributes':['id',_0xb83b('0x3e')],'where':{'id':_0x34b50d[_0xb83b('0x96')][_0xb83b('0x9c')]}})[_0xb83b('0x22')](function(_0x31d5be){if(_0x31d5be){_0x34b50d[_0xb83b('0x87')][_0xb83b('0x9e')]({'id':0x0,'priority':0x0,'app':_0xb83b('0x9f'),'appdata':_0x31d5be[_0xb83b('0x3e')]+','+(_0x34b50d['account'][_0xb83b('0xa0')]||0xa),'interval':_0xb83b('0x99')});_0x34b50d[_0xb83b('0xa1')]=![];}return respondWithRpcPromise(_0xb83b('0xa2'),_0xb83b('0xa3'),_0x34b50d);});}return respondWithRpcPromise('Start',_0xb83b('0xa3'),_0x34b50d);})[_0xb83b('0x22')](function(_0x1cdf14){respondWithRpcPromise(_0xb83b('0xa4'),_0xb83b('0xa4'),{'event':'notify','message':_0x1cdf14},client9002);return _0x1cdf14;})[_0xb83b('0x22')](respondWithResult(_0x3f149e,null))[_0xb83b('0x2c')](handleError(_0x3f149e,null));};exports[_0xb83b('0xa5')]=function(_0x31c914,_0x396406){var _0x58ef49=_0x31c914[_0xb83b('0x58')]['id'];var _0x3fdfad=_0x31c914['body'];var _0x26b07b=0xc8;var _0x189001=null;return db[_0xb83b('0xa6')]['transaction']({'isolationLevel':db[_0xb83b('0xa6')][_0xb83b('0xa7')][_0xb83b('0xa8')][_0xb83b('0xa9')]},function(_0xd59dd2){return db[_0xb83b('0x42')]['findOne']({'where':{'id':_0x58ef49},'transaction':_0xd59dd2})[_0xb83b('0x22')](function(_0x3d3b44){if(_0x3d3b44){return db[_0xb83b('0xaa')]['destroy']({'where':{'OpenchannelAccountId':_0x58ef49},'transaction':_0xd59dd2})[_0xb83b('0x22')](function(){var _0x5ad42c=_[_0xb83b('0x41')](_0x3fdfad,function(_0x274baa){_0x274baa[_0xb83b('0x67')]=_0x58ef49;return _0x274baa;});return db[_0xb83b('0xaa')][_0xb83b('0xab')](_0x5ad42c,{'transaction':_0xd59dd2});});}else{_0x26b07b=0x194;_0x189001=[];}});})['then'](function(){if(_0x26b07b!==0x194){return db['OpenchannelApplication'][_0xb83b('0xac')]({'where':{'OpenchannelAccountId':_0x58ef49},'order':_0xb83b('0xad')})[_0xb83b('0x22')](function(_0x478c83){_0x189001=_0x478c83;});}})[_0xb83b('0x2c')](function(_0x5842c3){_0x26b07b=0x1f4;logger['error'](_0x5842c3[_0xb83b('0x3d')]);if(_0x5842c3[_0xb83b('0x3e')]){delete _0x5842c3[_0xb83b('0x3e')];}_0x189001=_0x5842c3;})[_0xb83b('0xae')](function(){if(_0x189001===null){_0x396406[_0xb83b('0x2d')](_0x26b07b);}else{if(_0x26b07b===0x1f4){_0x396406[_0xb83b('0x2f')](_0x26b07b)['send'](_0x189001);}else{_0x396406['status'](_0x26b07b)[_0xb83b('0x35')](_0x189001);}}});};exports[_0xb83b('0xaf')]=function(_0x513524,_0x31eaa4,_0x348b99){var _0x5dc009={};var _0x4f454c={};var _0x1f8335;var _0x558f8a;return db[_0xb83b('0x42')][_0xb83b('0x6a')]({'where':{'id':_0x513524['params']['id']}})['then'](handleEntityNotFound(_0x31eaa4,null))[_0xb83b('0x22')](function(_0x40e603){if(_0x40e603){_0x1f8335=_0x40e603;_0x4f454c[_0xb83b('0x46')]=_[_0xb83b('0x59')](db[_0xb83b('0xaa')][_0xb83b('0x43')]);_0x4f454c[_0xb83b('0x47')]=_[_0xb83b('0x59')](_0x513524[_0xb83b('0x47')]);_0x4f454c['filters']=_[_0xb83b('0x5a')](_0x4f454c['model'],_0x4f454c['query']);_0x5dc009[_0xb83b('0x48')]=_[_0xb83b('0x5a')](_0x4f454c[_0xb83b('0x46')],qs[_0xb83b('0x49')](_0x513524['query'][_0xb83b('0x49')]));_0x5dc009[_0xb83b('0x48')]=_0x5dc009['attributes'][_0xb83b('0x4a')]?_0x5dc009[_0xb83b('0x48')]:_0x4f454c[_0xb83b('0x46')];_0x5dc009[_0xb83b('0x4d')]=qs['sort'](_0x513524[_0xb83b('0x47')][_0xb83b('0x4e')]);_0x5dc009[_0xb83b('0x4f')]=qs[_0xb83b('0x50')](_[_0xb83b('0x51')](_0x513524['query'],_0x4f454c['filters']));if(_0x513524[_0xb83b('0x47')][_0xb83b('0x6b')]){_0x5dc009['where']=_[_0xb83b('0x52')](_0x5dc009[_0xb83b('0x4f')],{'$or':_[_0xb83b('0x41')](_0x5dc009['attributes'],function(_0x4919c4){var _0xf81ef2={};_0xf81ef2[_0x4919c4]={'$like':'%'+_0x513524['query']['filter']+'%'};return _0xf81ef2;})});}_0x5dc009=_[_0xb83b('0x52')]({},_0x5dc009,_0x513524[_0xb83b('0x5c')]);return _0x1f8335[_0xb83b('0xaf')](_0x5dc009);}})['then'](function(_0x54c8b0){if(_0x54c8b0){_0x558f8a=_0x54c8b0['length'];if(!_0x513524['query'][_0xb83b('0x4b')](_0xb83b('0x4c'))){_0x5dc009[_0xb83b('0x30')]=qs[_0xb83b('0x30')](_0x513524[_0xb83b('0x47')][_0xb83b('0x30')]);_0x5dc009['offset']=qs[_0xb83b('0x33')](_0x513524[_0xb83b('0x47')][_0xb83b('0x33')]);}return _0x1f8335[_0xb83b('0xaf')](_0x5dc009);}})['then'](function(_0x2fdcf6){if(_0x2fdcf6){return _0x2fdcf6?{'count':_0x558f8a,'rows':_0x2fdcf6}:null;}})[_0xb83b('0x22')](respondWithResult(_0x31eaa4,null))['catch'](handleError(_0x31eaa4,null));};exports[_0xb83b('0xb0')]=function(_0x40c77f,_0x193791,_0x35421c){var _0x7453a8={'raw':![],'where':{}};var _0x586e8f={};var _0x574333={'count':0x0,'rows':[]};return db[_0xb83b('0x42')][_0xb83b('0x6a')]({'where':{'id':_0x40c77f[_0xb83b('0x58')]['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x193791,null))[_0xb83b('0x22')](function(_0x54b459){if(_0x54b459){_0x586e8f[_0xb83b('0x46')]=_[_0xb83b('0x59')](db[_0xb83b('0x90')][_0xb83b('0x43')]);_0x586e8f[_0xb83b('0x47')]=_[_0xb83b('0x59')](_0x40c77f[_0xb83b('0x47')]);_0x586e8f[_0xb83b('0x50')]=_[_0xb83b('0x5a')](_0x586e8f[_0xb83b('0x46')],_0x586e8f[_0xb83b('0x47')]);_0x7453a8[_0xb83b('0x48')]=_[_0xb83b('0x5a')](_0x586e8f[_0xb83b('0x46')],qs[_0xb83b('0x49')](_0x40c77f[_0xb83b('0x47')]['fields']));_0x7453a8['attributes']=_0x7453a8['attributes'][_0xb83b('0x4a')]?_0x7453a8[_0xb83b('0x48')]:_0x586e8f['model'];if(!_0x40c77f[_0xb83b('0x47')][_0xb83b('0x4b')](_0xb83b('0x4c'))){_0x7453a8[_0xb83b('0x30')]=qs['limit'](_0x40c77f['query'][_0xb83b('0x30')]);_0x7453a8['offset']=qs[_0xb83b('0x33')](_0x40c77f[_0xb83b('0x47')][_0xb83b('0x33')]);}_0x7453a8[_0xb83b('0x4d')]=qs[_0xb83b('0x4e')](_0x40c77f[_0xb83b('0x47')][_0xb83b('0x4e')]);_0x7453a8[_0xb83b('0x4f')]=qs[_0xb83b('0x50')](_[_0xb83b('0x51')](_0x40c77f[_0xb83b('0x47')],_0x586e8f[_0xb83b('0x50')]));_0x7453a8['where']['OpenchannelAccountId']=_0x54b459['id'];if(_0x40c77f['query'][_0xb83b('0x6b')]){_0x7453a8['where']=_[_0xb83b('0x52')](_0x7453a8[_0xb83b('0x4f')],{'$or':_['map'](_0x7453a8[_0xb83b('0x48')],function(_0x11b140){var _0x35f649={};_0x35f649[_0x11b140]={'$like':'%'+_0x40c77f[_0xb83b('0x47')][_0xb83b('0x6b')]+'%'};return _0x35f649;})});}_0x7453a8=_[_0xb83b('0x52')]({},_0x7453a8,_0x40c77f[_0xb83b('0x5c')]);return db[_0xb83b('0x90')][_0xb83b('0x32')]({'where':_0x7453a8[_0xb83b('0x4f')]})[_0xb83b('0x22')](function(_0x53a5bc){_0x574333[_0xb83b('0x32')]=_0x53a5bc;if(_0x40c77f[_0xb83b('0x47')][_0xb83b('0x54')]){_0x7453a8['include']=[{'model':db[_0xb83b('0x73')],'as':_0xb83b('0xb1'),'required':![]},{'model':db[_0xb83b('0x9d')],'as':_0xb83b('0xb2'),'attributes':[_0xb83b('0x3e'),_0xb83b('0xb3'),_0xb83b('0xb4')],'required':![]},{'model':db[_0xb83b('0xb5')],'as':_0xb83b('0xb6'),'attributes':['id',_0xb83b('0x3e'),_0xb83b('0xb7')],'where':_0x40c77f[_0xb83b('0x47')]['tag']?{'id':_0x40c77f['query']['tag']}:undefined,'required':_0x40c77f['query'][_0xb83b('0xb8')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xb83b('0x55')](_0x7453a8);})[_0xb83b('0x22')](function(_0x10760c){_0x574333[_0xb83b('0x56')]=_0x10760c;return _0x574333;});}})['then'](respondWithFilteredResult(_0x193791,_0x7453a8))[_0xb83b('0x2c')](handleError(_0x193791,null));};exports[_0xb83b('0xb9')]=function(_0x230c33,_0x3a5492,_0x57b012){return db[_0xb83b('0x42')][_0xb83b('0x5d')]({'where':{'id':_0x230c33[_0xb83b('0x58')]['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x3a5492,null))[_0xb83b('0x22')](function(_0x17e556){if(_0x17e556){return _0x17e556['addAgents'](_0x230c33[_0xb83b('0x5f')][_0xb83b('0x70')],_['omit'](_0x230c33['body'],[_0xb83b('0x70'),'id'])||{})[_0xb83b('0x93')](function(_0x285afa){for(var _0x1d49e2=0x0;_0x1d49e2<_0x230c33[_0xb83b('0x5f')][_0xb83b('0x70')]['length'];_0x1d49e2+=0x1){socket[_0xb83b('0xba')](_0xb83b('0xbb'),{'UserId':Number(_0x230c33['body']['ids'][_0x1d49e2]),'OpenchannelAccountId':Number(_0x230c33[_0xb83b('0x58')]['id'])});}return _0x285afa;});}})[_0xb83b('0x22')](respondWithResult(_0x3a5492,null))[_0xb83b('0x2c')](handleError(_0x3a5492,null));};exports[_0xb83b('0xbc')]=function(_0x23bb99,_0x141359,_0x307c63){return db[_0xb83b('0x42')][_0xb83b('0x5d')]({'where':{'id':_0x23bb99['params']['id']}})['then'](handleEntityNotFound(_0x141359,null))['then'](function(_0x3cce83){if(_0x3cce83){return _0x3cce83[_0xb83b('0xbc')](_0x23bb99[_0xb83b('0x47')]['ids'])[_0xb83b('0x22')](function(){if(_[_0xb83b('0xbd')](_0x23bb99[_0xb83b('0x47')]['ids'])){for(var _0xbd2dc6=0x0;_0xbd2dc6<_0x23bb99[_0xb83b('0x47')][_0xb83b('0x70')][_0xb83b('0x4a')];_0xbd2dc6+=0x1){socket['emit'](_0xb83b('0xbe'),{'UserId':Number(_0x23bb99['query']['ids'][_0xbd2dc6]),'OpenchannelAccountId':Number(_0x23bb99[_0xb83b('0x58')]['id'])});}}else{socket[_0xb83b('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x23bb99[_0xb83b('0x47')][_0xb83b('0x70')]),'OpenchannelAccountId':Number(_0x23bb99[_0xb83b('0x58')]['id'])});}});}})[_0xb83b('0x22')](respondWithStatusCode(_0x141359,null))['catch'](handleError(_0x141359,null));};exports[_0xb83b('0xbf')]=function(_0x343fa8,_0x1fc710,_0x5c8d65){var _0x5254e7={};var _0x34022e={};var _0x1e6460;var _0x54ad51;return db[_0xb83b('0x42')][_0xb83b('0x6a')]({'where':{'id':_0x343fa8[_0xb83b('0x58')]['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x1fc710,null))[_0xb83b('0x22')](function(_0x542c2b){if(_0x542c2b){_0x1e6460=_0x542c2b;_0x34022e[_0xb83b('0x46')]=_[_0xb83b('0x59')](db[_0xb83b('0x9d')][_0xb83b('0x43')]);_0x34022e['query']=_[_0xb83b('0x59')](_0x343fa8[_0xb83b('0x47')]);_0x34022e['filters']=_['intersection'](_0x34022e[_0xb83b('0x46')],_0x34022e['query']);_0x5254e7[_0xb83b('0x48')]=_[_0xb83b('0x5a')](_0x34022e[_0xb83b('0x46')],qs['fields'](_0x343fa8[_0xb83b('0x47')]['fields']));_0x5254e7[_0xb83b('0x48')]=_0x5254e7['attributes']['length']?_0x5254e7['attributes']:_0x34022e['model'];_0x5254e7[_0xb83b('0x4d')]=qs[_0xb83b('0x4e')](_0x343fa8[_0xb83b('0x47')][_0xb83b('0x4e')]);_0x5254e7[_0xb83b('0x4f')]=qs['filters'](_[_0xb83b('0x51')](_0x343fa8['query'],_0x34022e[_0xb83b('0x50')]));if(_0x343fa8[_0xb83b('0x47')][_0xb83b('0x6b')]){_0x5254e7[_0xb83b('0x4f')]=_[_0xb83b('0x52')](_0x5254e7[_0xb83b('0x4f')],{'$or':_[_0xb83b('0x41')](_0x5254e7['attributes'],function(_0x4c15ce){var _0x8fdad5={};_0x8fdad5[_0x4c15ce]={'$like':'%'+_0x343fa8['query'][_0xb83b('0x6b')]+'%'};return _0x8fdad5;})});}_0x5254e7=_['merge']({},_0x5254e7,_0x343fa8[_0xb83b('0x5c')]);return _0x1e6460['getAgents'](_0x5254e7);}})['then'](function(_0x4b726b){if(_0x4b726b){_0x54ad51=_0x4b726b[_0xb83b('0x4a')];if(!_0x343fa8[_0xb83b('0x47')][_0xb83b('0x4b')](_0xb83b('0x4c'))){_0x5254e7[_0xb83b('0x30')]=qs[_0xb83b('0x30')](_0x343fa8['query'][_0xb83b('0x30')]);_0x5254e7[_0xb83b('0x33')]=qs[_0xb83b('0x33')](_0x343fa8['query']['offset']);}return _0x1e6460[_0xb83b('0xbf')](_0x5254e7);}})[_0xb83b('0x22')](function(_0x5826ab){if(_0x5826ab){return _0x5826ab?{'count':_0x54ad51,'rows':_0x5826ab}:null;}})['then'](respondWithResult(_0x1fc710,null))[_0xb83b('0x2c')](handleError(_0x1fc710,null));};exports['send']=function(_0x193309,_0x1f0c69,_0x4d09a8){var _0xdc5650,_0x8bf34a,_0x5b3a58;if(_['isNil'](_0x193309[_0xb83b('0x5f')][_0xb83b('0x5f')])||_0x193309[_0xb83b('0x5f')]['body']===''){throw new db[(_0xb83b('0x7b'))][(_0xb83b('0x75'))](_0xb83b('0x7e'));}if(_[_0xb83b('0x7d')](_0x193309[_0xb83b('0x5f')]['to'])){}_0xdc5650=_0x193309['body']['to'];return db[_0xb83b('0x42')][_0xb83b('0x6a')]({'where':{'id':_0x193309[_0xb83b('0x58')]['id']}})[_0xb83b('0x22')](handleEntityNotFound(_0x1f0c69,null))[_0xb83b('0x22')](function(_0x5dbed3){if(_0x5dbed3){return db[_0xb83b('0x42')][_0xb83b('0x5d')]({'where':{'id':_0x5dbed3['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xb83b('0x83'),'where':{[_0x5dbed3[_0xb83b('0x7f')]]:_0xdc5650},'limit':0x1,'order':[[_0xb83b('0x77'),_0xb83b('0x84')]]}]}]})[_0xb83b('0x22')](handleEntityNotFound(_0x1f0c69,null))[_0xb83b('0x22')](function(_0x58ae51){if(_0x58ae51&&_0x58ae51[_0xb83b('0x86')]){_0x8bf34a=_0x58ae51[_0xb83b('0x3a')]({'plain':!![]});if(_0x8bf34a[_0xb83b('0x86')]&&_0x8bf34a[_0xb83b('0x86')][_0xb83b('0x83')][_0xb83b('0x4a')]){return _0x8bf34a[_0xb83b('0x86')][_0xb83b('0x83')][0x0];}return db['CmContact']['create'](_['defaults'](_0x193309[_0xb83b('0x5f')],{'firstName':_0xdc5650,[_0x58ae51[_0xb83b('0x7f')]]:_0xdc5650,'phone':_0xdc5650,'ListId':_0x8bf34a[_0xb83b('0x8c')]}));}})[_0xb83b('0x22')](handleEntityNotFound(_0x1f0c69,null))[_0xb83b('0x22')](function(_0x3176b6){if(_0x3176b6){_0x5b3a58=_0x3176b6;return db[_0xb83b('0x90')]['find']({'where':{'ContactId':_0x5b3a58['id'],'closed':![],'OpenchannelAccountId':_0x8bf34a['id']}})[_0xb83b('0x22')](function(_0x151d8f){if(_0x151d8f){return[_0x151d8f,![]];}return db[_0xb83b('0x90')][_0xb83b('0x5e')]({'UserId':_0x193309[_0xb83b('0x60')]['id'],'ContactId':_0x5b3a58['id'],'OpenchannelAccountId':_0x8bf34a['id'],'lastMsgDirection':_0xb83b('0xc0'),'Messages':[_[_0xb83b('0x52')](_0x193309[_0xb83b('0x5f')],{'read':![],'body':_0x193309[_0xb83b('0x5f')][_0xb83b('0x5f')],'OpenchannelAccountId':_0x8bf34a['id'],'UserId':_0x193309[_0xb83b('0x60')]['id'],'ContactId':_0x5b3a58['id']})]},{'include':[{'model':db[_0xb83b('0x9a')],'as':_0xb83b('0xc1')}]})[_0xb83b('0x22')](function(_0x44568e){return[_0x44568e,!![]];});});}})[_0xb83b('0x93')](function(_0x3fa720,_0x339296){if(_0x339296){return _0x3fa720;}return db[_0xb83b('0x9a')][_0xb83b('0x5e')](_['merge'](_0x193309['body'],{'read':![],'body':_0x193309['body'][_0xb83b('0x5f')],'OpenchannelAccountId':_0x8bf34a['id'],'OpenchannelInteractionId':_0x3fa720['id'],'UserId':_0x193309[_0xb83b('0x60')]['id'],'ContactId':_0x5b3a58['id']}))['then'](function(_0x35b6a0){_0x3fa720[_0xb83b('0xc2')]['Messages']=[];_0x3fa720[_0xb83b('0xc2')][_0xb83b('0xc1')][_0xb83b('0xc3')](_0x35b6a0['dataValues']);return _0x3fa720;});});}})[_0xb83b('0x22')](respondWithResult(_0x1f0c69,null))[_0xb83b('0x2c')](handleError(_0x1f0c69,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 50c016c..5f493d0 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x208705,_0x1ee99d){var _0x101594=function(_0x2c9f2f){while(--_0x2c9f2f){_0x208705['push'](_0x208705['shift']());}};_0x101594(++_0x1ee99d);}(_0x750a,0x140));var _0xa750=function(_0x2d3f75,_0x1b5028){_0x2d3f75=_0x2d3f75-0x0;var _0x35dc24=_0x750a[_0x2d3f75];return _0x35dc24;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x203f60,_0x10704f){var _0x515b57=function(_0x1a8444){while(--_0x1a8444){_0x203f60['push'](_0x203f60['shift']());}};_0x515b57(++_0x10704f);}(_0x54ef,0x112));var _0xf54e=function(_0x41c5b6,_0x417e7e){_0x41c5b6=_0x41c5b6-0x0;var _0x2a8f54=_0x54ef[_0x41c5b6];return _0x2a8f54;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 702ae81..15ba5e3 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(_0x186816,_0x12a126){var _0x247877=function(_0x1a3e40){while(--_0x1a3e40){_0x186816['push'](_0x186816['shift']());}};_0x247877(++_0x12a126);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x384c42,_0x3c23b5){var _0x361a7b=function(_0x7ce4f1){while(--_0x7ce4f1){_0x384c42['push'](_0x384c42['shift']());}};_0x361a7b(++_0x3c23b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d820635..45474d7 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 _0x9d9b=['./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x41eec8,_0x1cc853){var _0x58be39=function(_0x323faf){while(--_0x323faf){_0x41eec8['push'](_0x41eec8['shift']());}};_0x58be39(++_0x1cc853);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x31d528,_0x2e776c){_0x31d528=_0x31d528-0x0;var _0x36512a=_0x9d9b[_0x31d528];return _0x36512a;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var moment=require(_0xb9d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d9('0x3'))['db'];var utils=require(_0xb9d9('0x4'));var logger=require(_0xb9d9('0x5'))('rpc');var config=require(_0xb9d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x7')][_0xb9d9('0x8')]({'port':0x232a});config['redis']=_[_0xb9d9('0x9')](config[_0xb9d9('0xa')],{'host':_0xb9d9('0xb'),'port':0x18eb});var socket=require(_0xb9d9('0xc'))(new Redis(config[_0xb9d9('0xa')]));require(_0xb9d9('0xd'))[_0xb9d9('0xe')](socket);function respondWithRpcPromise(_0x5a9c18,_0x5b591e,_0x5f14e7){return new BPromise(function(_0x4cde40,_0x45f507){return client[_0xb9d9('0xf')](_0x5a9c18,_0x5f14e7)[_0xb9d9('0x10')](function(_0x5e226e){logger[_0xb9d9('0x11')](_0xb9d9('0x12'),_0x5b591e,'request\x20sent');logger[_0xb9d9('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'),JSON[_0xb9d9('0x15')](_0x5e226e));if(_0x5e226e[_0xb9d9('0x16')]){if(_0x5e226e[_0xb9d9('0x16')][_0xb9d9('0x17')]===0x1f4){logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x45f507(_0x5e226e['error'][_0xb9d9('0x18')]);}logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x4cde40(_0x5e226e['error'][_0xb9d9('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'));_0x4cde40(_0x5e226e[_0xb9d9('0x19')][_0xb9d9('0x18')]);}})['catch'](function(_0x473b89){logger[_0xb9d9('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0x473b89);_0x45f507(_0x473b89);});});} \ No newline at end of file +var _0xa478=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util'];(function(_0x40e3e6,_0x141bc1){var _0x601283=function(_0x4afaf4){while(--_0x4afaf4){_0x40e3e6['push'](_0x40e3e6['shift']());}};_0x601283(++_0x141bc1);}(_0xa478,0x136));var _0x8a47=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xa478[_0x4c0622];return _0x1799d8;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});config[_0x8a47('0xd')]=_[_0x8a47('0xe')](config[_0x8a47('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a47('0xf'))(new Redis(config['redis']));require(_0x8a47('0x10'))[_0x8a47('0x11')](socket);function respondWithRpcPromise(_0x3a6cc4,_0x574c96,_0xe65646){return new BPromise(function(_0x230a11,_0x493d7b){return client[_0x8a47('0x12')](_0x3a6cc4,_0xe65646)['then'](function(_0x39da50){logger[_0x8a47('0x13')](_0x8a47('0x14'),_0x574c96,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x574c96,_0x8a47('0x15'),JSON[_0x8a47('0x16')](_0x39da50));if(_0x39da50['error']){if(_0x39da50[_0x8a47('0x17')][_0x8a47('0x18')]===0x1f4){logger[_0x8a47('0x17')](_0x8a47('0x14'),_0x574c96,_0x39da50[_0x8a47('0x17')][_0x8a47('0x19')]);return _0x493d7b(_0x39da50[_0x8a47('0x17')][_0x8a47('0x19')]);}logger[_0x8a47('0x17')](_0x8a47('0x14'),_0x574c96,_0x39da50[_0x8a47('0x17')][_0x8a47('0x19')]);return _0x230a11(_0x39da50[_0x8a47('0x17')]['message']);}else{logger[_0x8a47('0x13')](_0x8a47('0x14'),_0x574c96,_0x8a47('0x15'));_0x230a11(_0x39da50['result'][_0x8a47('0x19')]);}})['catch'](function(_0x538ed2){logger[_0x8a47('0x17')](_0x8a47('0x14'),_0x574c96,_0x538ed2);_0x493d7b(_0x538ed2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2b1046c..277ff98 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 _0xfc03=['removeListener','register','openchannelAccount:','./openchannelAccount.events','remove','update','emit'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0xfc03,0x16f));var _0x3fc0=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xfc03[_0x20ef64];return _0x3707d8;};'use strict';var OpenchannelAccountEvents=require(_0x3fc0('0x0'));var events=['save',_0x3fc0('0x1'),_0x3fc0('0x2')];function createListener(_0x4a3641,_0x39420d){return function(_0x47eb14){_0x39420d[_0x3fc0('0x3')](_0x4a3641,_0x47eb14);};}function removeListener(_0x1eeb62,_0x390f7e){return function(){OpenchannelAccountEvents[_0x3fc0('0x4')](_0x1eeb62,_0x390f7e);};}exports[_0x3fc0('0x5')]=function(_0x389bfb){for(var _0x2b4ef6=0x0,_0xeeb912=events['length'];_0x2b4ef6<_0xeeb912;_0x2b4ef6++){var _0x2fb1a6=events[_0x2b4ef6];var _0x5f52b5=createListener(_0x3fc0('0x6')+_0x2fb1a6,_0x389bfb);OpenchannelAccountEvents['on'](_0x2fb1a6,_0x5f52b5);}}; \ No newline at end of file +var _0x6e16=['length','openchannelAccount:','remove','emit','register'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x6e16,0x1d3));var _0x66e1=function(_0x3c8422,_0x3240ea){_0x3c8422=_0x3c8422-0x0;var _0x5e50aa=_0x6e16[_0x3c8422];return _0x5e50aa;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x66e1('0x0'),'update'];function createListener(_0xac185,_0x4e3854){return function(_0x4f811b){_0x4e3854[_0x66e1('0x1')](_0xac185,_0x4f811b);};}function removeListener(_0x491345,_0x892e60){return function(){OpenchannelAccountEvents['removeListener'](_0x491345,_0x892e60);};}exports[_0x66e1('0x2')]=function(_0x204db8){for(var _0x3f95fa=0x0,_0x5d1175=events[_0x66e1('0x3')];_0x3f95fa<_0x5d1175;_0x3f95fa++){var _0x43b549=events[_0x3f95fa];var _0x257ecd=createListener(_0x66e1('0x4')+_0x43b549,_0x204db8);OpenchannelAccountEvents['on'](_0x43b549,_0x257ecd);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index e60d438..eeb69b2 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 _0x279a=['../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','path','express','Router','../../components/interaction/service'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x279a,0x182));var _0xa279=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x279a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa279('0x0'));var timeout=require('connect-timeout');var express=require(_0xa279('0x1'));var router=express[_0xa279('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa279('0x3'));var config=require(_0xa279('0x4'));var controller=require(_0xa279('0x5'));router[_0xa279('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa279('0x6')](_0xa279('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa279('0x8')](),controller['create']);router[_0xa279('0x9')](_0xa279('0x7'),auth['isAuthenticated'](),controller[_0xa279('0xa')]);router[_0xa279('0xb')](_0xa279('0x7'),auth[_0xa279('0x8')](),controller[_0xa279('0xc')]);module['exports']=router; \ No newline at end of file +var _0x7816=['put','update','destroy','exports','multer','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x5d4f2b,_0x172439){var _0x1e6dd0=function(_0x3bca46){while(--_0x3bca46){_0x5d4f2b['push'](_0x5d4f2b['shift']());}};_0x1e6dd0(++_0x172439);}(_0x7816,0x154));var _0x6781=function(_0x58b5b0,_0x599f81){_0x58b5b0=_0x58b5b0-0x0;var _0x1463ab=_0x7816[_0x58b5b0];return _0x1463ab;};'use strict';var multer=require(_0x6781('0x0'));var util=require('util');var path=require(_0x6781('0x1'));var timeout=require(_0x6781('0x2'));var express=require('express');var router=express[_0x6781('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6781('0x4'));var controller=require('./openchannelApplication.controller');router[_0x6781('0x5')]('/',auth[_0x6781('0x6')](),controller['index']);router['get'](_0x6781('0x7'),auth[_0x6781('0x6')](),controller[_0x6781('0x8')]);router[_0x6781('0x9')]('/',auth[_0x6781('0x6')](),controller['create']);router[_0x6781('0xa')](_0x6781('0x7'),auth[_0x6781('0x6')](),controller[_0x6781('0xb')]);router['delete'](_0x6781('0x7'),auth[_0x6781('0x6')](),controller[_0x6781('0xc')]);module[_0x6781('0xd')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 045d569..b7ba61c 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 _0xc8b3=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x4d4188,_0x23e126){var _0x3f9c84=function(_0x216d1e){while(--_0x216d1e){_0x4d4188['push'](_0x4d4188['shift']());}};_0x3f9c84(++_0x23e126);}(_0xc8b3,0x136));var _0x3c8b=function(_0x2d034d,_0x532a40){_0x2d034d=_0x2d034d-0x0;var _0x286474=_0xc8b3[_0x2d034d];return _0x286474;};'use strict';var Sequelize=require(_0x3c8b('0x0'));module[_0x3c8b('0x1')]={'priority':{'type':Sequelize[_0x3c8b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3c8b('0x3')],'allowNull':![],'defaultValue':_0x3c8b('0x4')},'appdata':{'type':Sequelize[_0x3c8b('0x5')]()},'description':{'type':Sequelize[_0x3c8b('0x3')]},'interval':{'type':Sequelize[_0x3c8b('0x3')],'defaultValue':_0x3c8b('0x6')}}; \ No newline at end of file +var _0x7788=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x49a56b,_0x1b8a1c){var _0x218d25=function(_0x4ce27d){while(--_0x4ce27d){_0x49a56b['push'](_0x49a56b['shift']());}};_0x218d25(++_0x1b8a1c);}(_0x7788,0x116));var _0x8778=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0x7788[_0x2e68db];return _0x12df4c;};'use strict';var Sequelize=require(_0x8778('0x0'));module[_0x8778('0x1')]={'priority':{'type':Sequelize[_0x8778('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8778('0x3')],'allowNull':![],'defaultValue':_0x8778('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8778('0x3')]},'interval':{'type':Sequelize[_0x8778('0x3')],'defaultValue':_0x8778('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1e3bc0b..7fa230f 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 _0xcc13=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','save','update','destroy','stack','name','send','index','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','OpenchannelApplication','then','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x5624a4,_0x1af663){var _0x51ad8e=function(_0xa9a13a){while(--_0xa9a13a){_0x5624a4['push'](_0x5624a4['shift']());}};_0x51ad8e(++_0x1af663);}(_0xcc13,0x7d));var _0x3cc1=function(_0x3659dc,_0x4e91f0){_0x3659dc=_0x3659dc-0x0;var _0x918c8a=_0xcc13[_0x3659dc];return _0x918c8a;};'use strict';var emlformat=require(_0x3cc1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3cc1('0x1'));var rp=require(_0x3cc1('0x2'));var moment=require(_0x3cc1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3cc1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3cc1('0x5'));var csv=require(_0x3cc1('0x6'));var ejs=require(_0x3cc1('0x7'));var fs=require('fs');var fs_extra=require(_0x3cc1('0x8'));var _=require(_0x3cc1('0x9'));var squel=require('squel');var crypto=require(_0x3cc1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3cc1('0xb'));var toCsv=require(_0x3cc1('0x6'));var querystring=require(_0x3cc1('0xc'));var Papa=require(_0x3cc1('0xd'));var Redis=require(_0x3cc1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3cc1('0xf'));var as=require(_0x3cc1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cc1('0x11'))('api');var utils=require(_0x3cc1('0x12'));var config=require(_0x3cc1('0x13'));var licenseUtil=require(_0x3cc1('0x14'));var db=require(_0x3cc1('0x15'))['db'];function respondWithStatusCode(_0x5a779b,_0x13921e){_0x13921e=_0x13921e||0xcc;return function(_0x5a8e63){if(_0x5a8e63){return _0x5a779b[_0x3cc1('0x16')](_0x13921e);}return _0x5a779b['status'](_0x13921e)[_0x3cc1('0x17')]();};}function respondWithResult(_0x42d069,_0x5eb4c2){_0x5eb4c2=_0x5eb4c2||0xc8;return function(_0x2e21cd){if(_0x2e21cd){return _0x42d069['status'](_0x5eb4c2)[_0x3cc1('0x18')](_0x2e21cd);}};}function respondWithFilteredResult(_0x4f0abe,_0x36ee62){return function(_0x54f736){if(_0x54f736){var _0x3d9201=typeof _0x36ee62[_0x3cc1('0x19')]===_0x3cc1('0x1a')&&typeof _0x36ee62['limit']===_0x3cc1('0x1a');var _0x1b71d1=_0x54f736[_0x3cc1('0x1b')];var _0x28c96d=_0x3d9201?0x0:_0x36ee62[_0x3cc1('0x19')];var _0x353b31=_0x3d9201?_0x54f736['count']:_0x36ee62['offset']+_0x36ee62[_0x3cc1('0x1c')];var _0x293558;if(_0x353b31>=_0x1b71d1){_0x353b31=_0x1b71d1;_0x293558=0xc8;}else{_0x293558=0xce;}_0x4f0abe[_0x3cc1('0x1d')](_0x293558);return _0x4f0abe['set']('Content-Range',_0x28c96d+'-'+_0x353b31+'/'+_0x1b71d1)['json'](_0x54f736);}return null;};}function patchUpdates(_0x380977){return function(_0x564d4a){try{jsonpatch['apply'](_0x564d4a,_0x380977,!![]);}catch(_0x27ea7a){return BPromise['reject'](_0x27ea7a);}return _0x564d4a[_0x3cc1('0x1e')]();};}function saveUpdates(_0x2e334b,_0x522b57){return function(_0xd1ab18){if(_0xd1ab18){return _0xd1ab18[_0x3cc1('0x1f')](_0x2e334b)['then'](function(_0x57bb8d){return _0x57bb8d;});}return null;};}function removeEntity(_0x1b8c74,_0x195175){return function(_0x62dd1e){if(_0x62dd1e){return _0x62dd1e[_0x3cc1('0x20')]()['then'](function(){_0x1b8c74[_0x3cc1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f702,_0x150e3b){return function(_0x1f9899){if(!_0x1f9899){_0x39f702[_0x3cc1('0x16')](0x194);}return _0x1f9899;};}function handleError(_0x54ef54,_0x5b31d0){_0x5b31d0=_0x5b31d0||0x1f4;return function(_0xd9024){logger['error'](_0xd9024[_0x3cc1('0x21')]);if(_0xd9024[_0x3cc1('0x22')]){delete _0xd9024[_0x3cc1('0x22')];}_0x54ef54[_0x3cc1('0x1d')](_0x5b31d0)[_0x3cc1('0x23')](_0xd9024);};}exports[_0x3cc1('0x24')]=function(_0x392b3d,_0x4fd080){var _0x324baa={},_0x5e7698={},_0x3b4221={'count':0x0,'rows':[]};var _0x44c602=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x4a532f){return{'name':_0x4a532f[_0x3cc1('0x25')],'type':_0x4a532f[_0x3cc1('0x26')]['key']};});_0x5e7698[_0x3cc1('0x27')]=_['map'](_0x44c602,'name');_0x5e7698[_0x3cc1('0x28')]=_[_0x3cc1('0x29')](_0x392b3d[_0x3cc1('0x28')]);_0x5e7698[_0x3cc1('0x2a')]=_[_0x3cc1('0x2b')](_0x5e7698[_0x3cc1('0x27')],_0x5e7698[_0x3cc1('0x28')]);_0x324baa[_0x3cc1('0x2c')]=_[_0x3cc1('0x2b')](_0x5e7698[_0x3cc1('0x27')],qs[_0x3cc1('0x2d')](_0x392b3d[_0x3cc1('0x28')][_0x3cc1('0x2d')]));_0x324baa[_0x3cc1('0x2c')]=_0x324baa[_0x3cc1('0x2c')][_0x3cc1('0x2e')]?_0x324baa[_0x3cc1('0x2c')]:_0x5e7698[_0x3cc1('0x27')];if(!_0x392b3d[_0x3cc1('0x28')][_0x3cc1('0x2f')](_0x3cc1('0x30'))){_0x324baa['limit']=qs['limit'](_0x392b3d['query']['limit']);_0x324baa[_0x3cc1('0x19')]=qs[_0x3cc1('0x19')](_0x392b3d['query']['offset']);}_0x324baa['order']=qs[_0x3cc1('0x31')](_0x392b3d[_0x3cc1('0x28')]['sort']);_0x324baa[_0x3cc1('0x32')]=qs[_0x3cc1('0x2a')](_[_0x3cc1('0x33')](_0x392b3d[_0x3cc1('0x28')],_0x5e7698[_0x3cc1('0x2a')]),_0x44c602);if(_0x392b3d[_0x3cc1('0x28')][_0x3cc1('0x34')]){_0x324baa['where']=_['merge'](_0x324baa[_0x3cc1('0x32')],{'$or':_['map'](_0x44c602,function(_0x49676c){if(_0x49676c[_0x3cc1('0x26')]!=='VIRTUAL'){var _0x37904f={};_0x37904f[_0x49676c[_0x3cc1('0x22')]]={'$like':'%'+_0x392b3d['query'][_0x3cc1('0x34')]+'%'};return _0x37904f;}})});}_0x324baa=_[_0x3cc1('0x35')]({},_0x324baa,_0x392b3d[_0x3cc1('0x36')]);var _0x23eeb1={'where':_0x324baa['where']};return db[_0x3cc1('0x37')]['count'](_0x23eeb1)[_0x3cc1('0x38')](function(_0x563a8f){_0x3b4221['count']=_0x563a8f;if(_0x392b3d['query'][_0x3cc1('0x39')]){_0x324baa[_0x3cc1('0x3a')]=[{'all':!![]}];}return db[_0x3cc1('0x37')][_0x3cc1('0x3b')](_0x324baa);})['then'](function(_0x19274f){_0x3b4221[_0x3cc1('0x3c')]=_0x19274f;return _0x3b4221;})['then'](respondWithFilteredResult(_0x4fd080,_0x324baa))['catch'](handleError(_0x4fd080,null));};exports[_0x3cc1('0x3d')]=function(_0x3c71d7,_0x197fb3){var _0x1f4fcf={'raw':!![],'where':{'id':_0x3c71d7['params']['id']}},_0x25c512={};_0x25c512['model']=_[_0x3cc1('0x29')](db['OpenchannelApplication'][_0x3cc1('0x3e')]);_0x25c512['query']=_['keys'](_0x3c71d7['query']);_0x25c512[_0x3cc1('0x2a')]=_['intersection'](_0x25c512[_0x3cc1('0x27')],_0x25c512['query']);_0x1f4fcf[_0x3cc1('0x2c')]=_[_0x3cc1('0x2b')](_0x25c512[_0x3cc1('0x27')],qs[_0x3cc1('0x2d')](_0x3c71d7['query']['fields']));_0x1f4fcf[_0x3cc1('0x2c')]=_0x1f4fcf[_0x3cc1('0x2c')][_0x3cc1('0x2e')]?_0x1f4fcf[_0x3cc1('0x2c')]:_0x25c512[_0x3cc1('0x27')];if(_0x3c71d7[_0x3cc1('0x28')][_0x3cc1('0x39')]){_0x1f4fcf['include']=[{'all':!![]}];}_0x1f4fcf=_[_0x3cc1('0x35')]({},_0x1f4fcf,_0x3c71d7[_0x3cc1('0x36')]);return db['OpenchannelApplication'][_0x3cc1('0x3f')](_0x1f4fcf)[_0x3cc1('0x38')](handleEntityNotFound(_0x197fb3,null))[_0x3cc1('0x38')](respondWithResult(_0x197fb3,null))[_0x3cc1('0x40')](handleError(_0x197fb3,null));};exports[_0x3cc1('0x41')]=function(_0x358377,_0x19e81a){return db[_0x3cc1('0x37')][_0x3cc1('0x41')](_0x358377['body'],{})[_0x3cc1('0x38')](respondWithResult(_0x19e81a,0xc9))[_0x3cc1('0x40')](handleError(_0x19e81a,null));};exports[_0x3cc1('0x1f')]=function(_0x159025,_0x3c6172){if(_0x159025[_0x3cc1('0x42')]['id']){delete _0x159025[_0x3cc1('0x42')]['id'];}return db['OpenchannelApplication'][_0x3cc1('0x3f')]({'where':{'id':_0x159025[_0x3cc1('0x43')]['id']}})[_0x3cc1('0x38')](handleEntityNotFound(_0x3c6172,null))[_0x3cc1('0x38')](saveUpdates(_0x159025[_0x3cc1('0x42')],null))['then'](respondWithResult(_0x3c6172,null))[_0x3cc1('0x40')](handleError(_0x3c6172,null));};exports[_0x3cc1('0x20')]=function(_0x3db369,_0x344890){return db[_0x3cc1('0x37')][_0x3cc1('0x3f')]({'where':{'id':_0x3db369[_0x3cc1('0x43')]['id']}})[_0x3cc1('0x38')](handleEntityNotFound(_0x344890,null))[_0x3cc1('0x38')](removeEntity(_0x344890,null))['catch'](handleError(_0x344890,null));}; \ No newline at end of file +var _0x0c2a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelApplication','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','create','body','params','destroy','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xc44f91,_0x285b20){var _0x187fcb=function(_0x37f3a4){while(--_0x37f3a4){_0xc44f91['push'](_0xc44f91['shift']());}};_0x187fcb(++_0x285b20);}(_0x0c2a,0x126));var _0xa0c2=function(_0x4983be,_0xc257c1){_0x4983be=_0x4983be-0x0;var _0x49f120=_0x0c2a[_0x4983be];return _0x49f120;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0c2('0x0'));var zipdir=require(_0xa0c2('0x1'));var jsonpatch=require(_0xa0c2('0x2'));var rp=require('request-promise');var moment=require(_0xa0c2('0x3'));var BPromise=require(_0xa0c2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa0c2('0x5'));var sox=require('sox');var csv=require(_0xa0c2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0c2('0x7'));var _=require(_0xa0c2('0x8'));var squel=require(_0xa0c2('0x9'));var crypto=require(_0xa0c2('0xa'));var jsforce=require(_0xa0c2('0xb'));var deskjs=require(_0xa0c2('0xc'));var toCsv=require(_0xa0c2('0x6'));var querystring=require(_0xa0c2('0xd'));var Papa=require(_0xa0c2('0xe'));var Redis=require(_0xa0c2('0xf'));var authService=require(_0xa0c2('0x10'));var qs=require(_0xa0c2('0x11'));var as=require(_0xa0c2('0x12'));var hardwareService=require(_0xa0c2('0x13'));var logger=require(_0xa0c2('0x14'))(_0xa0c2('0x15'));var utils=require(_0xa0c2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa0c2('0x17'));var db=require(_0xa0c2('0x18'))['db'];function respondWithStatusCode(_0x1b9658,_0x3fe85b){_0x3fe85b=_0x3fe85b||0xcc;return function(_0x1eded4){if(_0x1eded4){return _0x1b9658[_0xa0c2('0x19')](_0x3fe85b);}return _0x1b9658[_0xa0c2('0x1a')](_0x3fe85b)[_0xa0c2('0x1b')]();};}function respondWithResult(_0x26ac22,_0x241edc){_0x241edc=_0x241edc||0xc8;return function(_0x4f8c09){if(_0x4f8c09){return _0x26ac22[_0xa0c2('0x1a')](_0x241edc)[_0xa0c2('0x1c')](_0x4f8c09);}};}function respondWithFilteredResult(_0x14d496,_0x5af6fd){return function(_0x4e6d7d){if(_0x4e6d7d){var _0x4ff2ac=typeof _0x5af6fd[_0xa0c2('0x1d')]===_0xa0c2('0x1e')&&typeof _0x5af6fd[_0xa0c2('0x1f')]===_0xa0c2('0x1e');var _0xcd4ebd=_0x4e6d7d[_0xa0c2('0x20')];var _0x33d3f2=_0x4ff2ac?0x0:_0x5af6fd[_0xa0c2('0x1d')];var _0xde1100=_0x4ff2ac?_0x4e6d7d['count']:_0x5af6fd[_0xa0c2('0x1d')]+_0x5af6fd['limit'];var _0x3ab851;if(_0xde1100>=_0xcd4ebd){_0xde1100=_0xcd4ebd;_0x3ab851=0xc8;}else{_0x3ab851=0xce;}_0x14d496[_0xa0c2('0x1a')](_0x3ab851);return _0x14d496['set'](_0xa0c2('0x21'),_0x33d3f2+'-'+_0xde1100+'/'+_0xcd4ebd)[_0xa0c2('0x1c')](_0x4e6d7d);}return null;};}function patchUpdates(_0xdfdb3e){return function(_0x3a7f66){try{jsonpatch[_0xa0c2('0x22')](_0x3a7f66,_0xdfdb3e,!![]);}catch(_0x1e09be){return BPromise[_0xa0c2('0x23')](_0x1e09be);}return _0x3a7f66[_0xa0c2('0x24')]();};}function saveUpdates(_0x31c671,_0x3abf5c){return function(_0x10323b){if(_0x10323b){return _0x10323b[_0xa0c2('0x25')](_0x31c671)[_0xa0c2('0x26')](function(_0x12a707){return _0x12a707;});}return null;};}function removeEntity(_0x2d6e54,_0xae2962){return function(_0xdc4697){if(_0xdc4697){return _0xdc4697['destroy']()[_0xa0c2('0x26')](function(){_0x2d6e54[_0xa0c2('0x1a')](0xcc)[_0xa0c2('0x1b')]();});}};}function handleEntityNotFound(_0x42c80b,_0x29076d){return function(_0x392a35){if(!_0x392a35){_0x42c80b[_0xa0c2('0x19')](0x194);}return _0x392a35;};}function handleError(_0x3445df,_0x4cbea1){_0x4cbea1=_0x4cbea1||0x1f4;return function(_0x33b4e9){logger[_0xa0c2('0x27')](_0x33b4e9[_0xa0c2('0x28')]);if(_0x33b4e9[_0xa0c2('0x29')]){delete _0x33b4e9[_0xa0c2('0x29')];}_0x3445df[_0xa0c2('0x1a')](_0x4cbea1)[_0xa0c2('0x2a')](_0x33b4e9);};}exports[_0xa0c2('0x2b')]=function(_0x595807,_0x206526){var _0x1e394a={},_0x588f12={},_0x1b30b9={'count':0x0,'rows':[]};var _0x2442ef=_[_0xa0c2('0x2c')](db[_0xa0c2('0x2d')]['rawAttributes'],function(_0x74743a){return{'name':_0x74743a[_0xa0c2('0x2e')],'type':_0x74743a['type'][_0xa0c2('0x2f')]};});_0x588f12[_0xa0c2('0x30')]=_[_0xa0c2('0x2c')](_0x2442ef,_0xa0c2('0x29'));_0x588f12[_0xa0c2('0x31')]=_['keys'](_0x595807[_0xa0c2('0x31')]);_0x588f12[_0xa0c2('0x32')]=_[_0xa0c2('0x33')](_0x588f12[_0xa0c2('0x30')],_0x588f12[_0xa0c2('0x31')]);_0x1e394a[_0xa0c2('0x34')]=_[_0xa0c2('0x33')](_0x588f12[_0xa0c2('0x30')],qs[_0xa0c2('0x35')](_0x595807[_0xa0c2('0x31')]['fields']));_0x1e394a['attributes']=_0x1e394a[_0xa0c2('0x34')]['length']?_0x1e394a[_0xa0c2('0x34')]:_0x588f12[_0xa0c2('0x30')];if(!_0x595807[_0xa0c2('0x31')][_0xa0c2('0x36')](_0xa0c2('0x37'))){_0x1e394a[_0xa0c2('0x1f')]=qs[_0xa0c2('0x1f')](_0x595807[_0xa0c2('0x31')]['limit']);_0x1e394a[_0xa0c2('0x1d')]=qs[_0xa0c2('0x1d')](_0x595807[_0xa0c2('0x31')][_0xa0c2('0x1d')]);}_0x1e394a[_0xa0c2('0x38')]=qs[_0xa0c2('0x39')](_0x595807[_0xa0c2('0x31')][_0xa0c2('0x39')]);_0x1e394a['where']=qs[_0xa0c2('0x32')](_[_0xa0c2('0x3a')](_0x595807[_0xa0c2('0x31')],_0x588f12[_0xa0c2('0x32')]),_0x2442ef);if(_0x595807[_0xa0c2('0x31')]['filter']){_0x1e394a[_0xa0c2('0x3b')]=_[_0xa0c2('0x3c')](_0x1e394a[_0xa0c2('0x3b')],{'$or':_[_0xa0c2('0x2c')](_0x2442ef,function(_0x139a28){if(_0x139a28[_0xa0c2('0x3d')]!==_0xa0c2('0x3e')){var _0x5443fb={};_0x5443fb[_0x139a28['name']]={'$like':'%'+_0x595807['query'][_0xa0c2('0x3f')]+'%'};return _0x5443fb;}})});}_0x1e394a=_['merge']({},_0x1e394a,_0x595807[_0xa0c2('0x40')]);var _0x1050b8={'where':_0x1e394a[_0xa0c2('0x3b')]};return db[_0xa0c2('0x2d')][_0xa0c2('0x20')](_0x1050b8)[_0xa0c2('0x26')](function(_0x527ccf){_0x1b30b9[_0xa0c2('0x20')]=_0x527ccf;if(_0x595807['query'][_0xa0c2('0x41')]){_0x1e394a[_0xa0c2('0x42')]=[{'all':!![]}];}return db[_0xa0c2('0x2d')][_0xa0c2('0x43')](_0x1e394a);})[_0xa0c2('0x26')](function(_0x2320ca){_0x1b30b9[_0xa0c2('0x44')]=_0x2320ca;return _0x1b30b9;})['then'](respondWithFilteredResult(_0x206526,_0x1e394a))[_0xa0c2('0x45')](handleError(_0x206526,null));};exports[_0xa0c2('0x46')]=function(_0x4f5fe8,_0x197ddd){var _0x5490f0={'raw':!![],'where':{'id':_0x4f5fe8['params']['id']}},_0x19cfdc={};_0x19cfdc[_0xa0c2('0x30')]=_[_0xa0c2('0x47')](db[_0xa0c2('0x2d')]['rawAttributes']);_0x19cfdc['query']=_['keys'](_0x4f5fe8[_0xa0c2('0x31')]);_0x19cfdc[_0xa0c2('0x32')]=_['intersection'](_0x19cfdc['model'],_0x19cfdc['query']);_0x5490f0['attributes']=_[_0xa0c2('0x33')](_0x19cfdc['model'],qs[_0xa0c2('0x35')](_0x4f5fe8['query'][_0xa0c2('0x35')]));_0x5490f0['attributes']=_0x5490f0[_0xa0c2('0x34')][_0xa0c2('0x48')]?_0x5490f0[_0xa0c2('0x34')]:_0x19cfdc[_0xa0c2('0x30')];if(_0x4f5fe8[_0xa0c2('0x31')][_0xa0c2('0x41')]){_0x5490f0[_0xa0c2('0x42')]=[{'all':!![]}];}_0x5490f0=_[_0xa0c2('0x3c')]({},_0x5490f0,_0x4f5fe8[_0xa0c2('0x40')]);return db[_0xa0c2('0x2d')]['find'](_0x5490f0)['then'](handleEntityNotFound(_0x197ddd,null))[_0xa0c2('0x26')](respondWithResult(_0x197ddd,null))[_0xa0c2('0x45')](handleError(_0x197ddd,null));};exports[_0xa0c2('0x49')]=function(_0x3b7040,_0x3ef4e5){return db[_0xa0c2('0x2d')]['create'](_0x3b7040[_0xa0c2('0x4a')],{})[_0xa0c2('0x26')](respondWithResult(_0x3ef4e5,0xc9))[_0xa0c2('0x45')](handleError(_0x3ef4e5,null));};exports['update']=function(_0x3c6f11,_0x382799){if(_0x3c6f11[_0xa0c2('0x4a')]['id']){delete _0x3c6f11[_0xa0c2('0x4a')]['id'];}return db[_0xa0c2('0x2d')]['find']({'where':{'id':_0x3c6f11[_0xa0c2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x382799,null))[_0xa0c2('0x26')](saveUpdates(_0x3c6f11['body'],null))[_0xa0c2('0x26')](respondWithResult(_0x382799,null))[_0xa0c2('0x45')](handleError(_0x382799,null));};exports[_0xa0c2('0x4c')]=function(_0x4d5a96,_0x110154){return db[_0xa0c2('0x2d')][_0xa0c2('0x4d')]({'where':{'id':_0x4d5a96['params']['id']}})['then'](handleEntityNotFound(_0x110154,null))[_0xa0c2('0x26')](removeEntity(_0x110154,null))[_0xa0c2('0x45')](handleError(_0x110154,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 17435c2..438c7a7 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 _0xafab=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xafab,0xf7));var _0xbafa=function(_0x5b6a3f,_0xd5887b){_0x5b6a3f=_0x5b6a3f-0x0;var _0x2bffd6=_0xafab[_0x5b6a3f];return _0x2bffd6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbafa('0x0'));var moment=require(_0xbafa('0x1'));var BPromise=require(_0xbafa('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbafa('0x3'));var rimraf=require(_0xbafa('0x4'));var config=require(_0xbafa('0x5'));var attributes=require(_0xbafa('0x6'));module[_0xbafa('0x7')]=function(_0x40572a,_0x3ce97a){return _0x40572a[_0xbafa('0x8')](_0xbafa('0x9'),attributes,{'tableName':_0xbafa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbafa('0xb'),'collate':_0xbafa('0xc')});}; \ No newline at end of file +var _0xea5d=['moment','bluebird','../../config/environment','exports','define','OpenchannelApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xea5d,0x1a9));var _0xdea5=function(_0x1efb12,_0x2cd2f3){_0x1efb12=_0x1efb12-0x0;var _0x7bcca7=_0xea5d[_0x1efb12];return _0x7bcca7;};'use strict';var _=require(_0xdea5('0x0'));var util=require(_0xdea5('0x1'));var logger=require(_0xdea5('0x2'))(_0xdea5('0x3'));var moment=require(_0xdea5('0x4'));var BPromise=require(_0xdea5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdea5('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0xdea5('0x7')]=function(_0x249115,_0x2c924b){return _0x249115[_0xdea5('0x8')](_0xdea5('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdea5('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 03aad66..522b996 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 _0xfc97=['update','body','options','where','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x5b7695,_0x139b46){var _0xae72fb=function(_0x97edf8){while(--_0x97edf8){_0x5b7695['push'](_0x5b7695['shift']());}};_0xae72fb(++_0x139b46);}(_0xfc97,0x1d8));var _0x7fc9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfc97[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7fc9('0x0'));var util=require('util');var moment=require(_0x7fc9('0x1'));var BPromise=require(_0x7fc9('0x2'));var rs=require(_0x7fc9('0x3'));var fs=require('fs');var Redis=require(_0x7fc9('0x4'));var db=require(_0x7fc9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fc9('0x6'))(_0x7fc9('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fc9('0x8'));var client=jayson['client'][_0x7fc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f2d4f,_0x36c8cc,_0x20b269){return new BPromise(function(_0x5e7cda,_0xf431de){return client[_0x7fc9('0xa')](_0x2f2d4f,_0x20b269)[_0x7fc9('0xb')](function(_0x3dc0fe){logger['info'](_0x7fc9('0xc'),_0x36c8cc,'request\x20sent');logger['debug'](_0x7fc9('0xd'),_0x36c8cc,'request\x20sent',JSON[_0x7fc9('0xe')](_0x3dc0fe));if(_0x3dc0fe['error']){if(_0x3dc0fe[_0x7fc9('0xf')][_0x7fc9('0x10')]===0x1f4){logger[_0x7fc9('0xf')](_0x7fc9('0xc'),_0x36c8cc,_0x3dc0fe['error'][_0x7fc9('0x11')]);return _0xf431de(_0x3dc0fe[_0x7fc9('0xf')][_0x7fc9('0x11')]);}logger[_0x7fc9('0xf')](_0x7fc9('0xc'),_0x36c8cc,_0x3dc0fe[_0x7fc9('0xf')][_0x7fc9('0x11')]);return _0x5e7cda(_0x3dc0fe[_0x7fc9('0xf')][_0x7fc9('0x11')]);}else{logger[_0x7fc9('0x12')](_0x7fc9('0xc'),_0x36c8cc,_0x7fc9('0x13'));_0x5e7cda(_0x3dc0fe[_0x7fc9('0x14')]['message']);}})[_0x7fc9('0x15')](function(_0x17cb73){logger[_0x7fc9('0xf')](_0x7fc9('0xc'),_0x36c8cc,_0x17cb73);_0xf431de(_0x17cb73);});});}exports[_0x7fc9('0x16')]=function(_0x3ea7d5){var _0x2a7b4f=this;return new Promise(function(_0x3b8524,_0xcff708){return db[_0x7fc9('0x17')][_0x7fc9('0x18')](_0x3ea7d5[_0x7fc9('0x19')],{'raw':_0x3ea7d5[_0x7fc9('0x1a')]?_0x3ea7d5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ea7d5[_0x7fc9('0x1a')]?_0x3ea7d5[_0x7fc9('0x1a')][_0x7fc9('0x1b')]||null:null,'attributes':_0x3ea7d5[_0x7fc9('0x1a')]?_0x3ea7d5['options'][_0x7fc9('0x1c')]||null:null,'limit':_0x3ea7d5[_0x7fc9('0x1a')]?_0x3ea7d5[_0x7fc9('0x1a')][_0x7fc9('0x1d')]||null:null})[_0x7fc9('0xb')](function(_0x23d43f){logger['info'](_0x7fc9('0x16'),_0x3ea7d5);logger[_0x7fc9('0x1e')](_0x7fc9('0x16'),_0x3ea7d5,JSON[_0x7fc9('0xe')](_0x23d43f));_0x3b8524(_0x23d43f);})[_0x7fc9('0x15')](function(_0x29afa4){logger['error'](_0x7fc9('0x16'),_0x29afa4[_0x7fc9('0x11')],_0x3ea7d5);_0xcff708(_0x2a7b4f[_0x7fc9('0xf')](0x1f4,_0x29afa4['message']));});});}; \ No newline at end of file +var _0x7baf=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7baf,0x1a7));var _0xf7ba=function(_0x3d4768,_0x5a378f){_0x3d4768=_0x3d4768-0x0;var _0x4984d4=_0x7baf[_0x3d4768];return _0x4984d4;};'use strict';var _=require(_0xf7ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf7ba('0x1'));var rs=require(_0xf7ba('0x2'));var fs=require('fs');var Redis=require(_0xf7ba('0x3'));var db=require(_0xf7ba('0x4'))['db'];var utils=require(_0xf7ba('0x5'));var logger=require('../../config/logger')(_0xf7ba('0x6'));var config=require(_0xf7ba('0x7'));var jayson=require(_0xf7ba('0x8'));var client=jayson[_0xf7ba('0x9')][_0xf7ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3af557,_0x2cc985,_0x22620a){return new BPromise(function(_0x23c8d,_0x59b421){return client[_0xf7ba('0xb')](_0x3af557,_0x22620a)[_0xf7ba('0xc')](function(_0xce171f){logger[_0xf7ba('0xd')](_0xf7ba('0xe'),_0x2cc985,_0xf7ba('0xf'));logger[_0xf7ba('0x10')](_0xf7ba('0x11'),_0x2cc985,_0xf7ba('0xf'),JSON[_0xf7ba('0x12')](_0xce171f));if(_0xce171f['error']){if(_0xce171f['error'][_0xf7ba('0x13')]===0x1f4){logger[_0xf7ba('0x14')](_0xf7ba('0xe'),_0x2cc985,_0xce171f['error'][_0xf7ba('0x15')]);return _0x59b421(_0xce171f[_0xf7ba('0x14')][_0xf7ba('0x15')]);}logger[_0xf7ba('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x2cc985,_0xce171f['error'][_0xf7ba('0x15')]);return _0x23c8d(_0xce171f[_0xf7ba('0x14')][_0xf7ba('0x15')]);}else{logger[_0xf7ba('0xd')](_0xf7ba('0xe'),_0x2cc985,_0xf7ba('0xf'));_0x23c8d(_0xce171f[_0xf7ba('0x16')][_0xf7ba('0x15')]);}})[_0xf7ba('0x17')](function(_0x590b4e){logger[_0xf7ba('0x14')](_0xf7ba('0xe'),_0x2cc985,_0x590b4e);_0x59b421(_0x590b4e);});});}exports[_0xf7ba('0x18')]=function(_0xa7a2e2){var _0xb13d2b=this;return new Promise(function(_0x5885fc,_0x206c6e){return db[_0xf7ba('0x19')][_0xf7ba('0x1a')](_0xa7a2e2[_0xf7ba('0x1b')],{'raw':_0xa7a2e2[_0xf7ba('0x1c')]?_0xa7a2e2[_0xf7ba('0x1c')][_0xf7ba('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7a2e2[_0xf7ba('0x1c')]?_0xa7a2e2[_0xf7ba('0x1c')][_0xf7ba('0x1e')]||null:null,'attributes':_0xa7a2e2[_0xf7ba('0x1c')]?_0xa7a2e2[_0xf7ba('0x1c')][_0xf7ba('0x1f')]||null:null,'limit':_0xa7a2e2[_0xf7ba('0x1c')]?_0xa7a2e2['options'][_0xf7ba('0x20')]||null:null})[_0xf7ba('0xc')](function(_0x4a8632){logger[_0xf7ba('0xd')](_0xf7ba('0x18'),_0xa7a2e2);logger[_0xf7ba('0x10')]('UpdateOpenchannelApplication',_0xa7a2e2,JSON[_0xf7ba('0x12')](_0x4a8632));_0x5885fc(_0x4a8632);})[_0xf7ba('0x17')](function(_0x5b555d){logger['error'](_0xf7ba('0x18'),_0x5b555d[_0xf7ba('0x15')],_0xa7a2e2);_0x206c6e(_0xb13d2b[_0xf7ba('0x14')](0x1f4,_0x5b555d[_0xf7ba('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 01e6e6a..afcad5d 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 _0x005f=['./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','addMessage','post','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','destroy','delete','removeTags','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x147fab,_0x4233f4){var _0x51595a=function(_0x13b739){while(--_0x13b739){_0x147fab['push'](_0x147fab['shift']());}};_0x51595a(++_0x4233f4);}(_0x005f,0x1c9));var _0xf005=function(_0x259be6,_0x291c94){_0x259be6=_0x259be6-0x0;var _0x4a93c4=_0x005f[_0x259be6];return _0x4a93c4;};'use strict';var multer=require('multer');var util=require(_0xf005('0x0'));var path=require('path');var timeout=require(_0xf005('0x1'));var express=require(_0xf005('0x2'));var router=express[_0xf005('0x3')]();var fs_extra=require(_0xf005('0x4'));var auth=require(_0xf005('0x5'));var interaction=require(_0xf005('0x6'));var config=require(_0xf005('0x7'));var controller=require(_0xf005('0x8'));router[_0xf005('0x9')]('/',auth[_0xf005('0xa')](),controller[_0xf005('0xb')]);router[_0xf005('0x9')](_0xf005('0xc'),auth[_0xf005('0xa')](),controller[_0xf005('0xd')]);router[_0xf005('0x9')](_0xf005('0xe'),auth[_0xf005('0xa')](),controller[_0xf005('0xf')]);router[_0xf005('0x9')](_0xf005('0x10'),auth[_0xf005('0xa')](),controller[_0xf005('0x11')]);router['get'](_0xf005('0x12'),auth[_0xf005('0xa')](),controller['download']);router['post']('/',auth[_0xf005('0xa')](),controller[_0xf005('0x13')]);router['post'](_0xf005('0x10'),auth['isAuthenticated'](),controller[_0xf005('0x14')]);router[_0xf005('0x15')]('/:id/tags',auth[_0xf005('0xa')](),interaction[_0xf005('0x16')](_0xf005('0x17'),_0xf005('0x18')),controller['addTags']);router[_0xf005('0x19')](_0xf005('0xe'),auth[_0xf005('0xa')](),interaction['tracked'](_0xf005('0x17'),_0xf005('0x1a')),controller[_0xf005('0x1b')]);router['delete'](_0xf005('0xe'),auth['isAuthenticated'](),interaction[_0xf005('0x16')]('openchannel','openchannelinteraction:destroy'),controller[_0xf005('0x1c')]);router[_0xf005('0x1d')]('/:id/tags',auth[_0xf005('0xa')](),controller[_0xf005('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x5e89=['addTags','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/download','post','create','/:id/messages','/:id/tags','tracked','openchannel'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x5e89,0x13b));var _0x95e8=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5e89[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x95e8('0x0'));var util=require(_0x95e8('0x1'));var path=require(_0x95e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x95e8('0x3'));var router=express['Router']();var fs_extra=require(_0x95e8('0x4'));var auth=require(_0x95e8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x95e8('0x6'));var controller=require(_0x95e8('0x7'));router['get']('/',auth[_0x95e8('0x8')](),controller[_0x95e8('0x9')]);router['get'](_0x95e8('0xa'),auth[_0x95e8('0x8')](),controller['describe']);router[_0x95e8('0xb')](_0x95e8('0xc'),auth[_0x95e8('0x8')](),controller[_0x95e8('0xd')]);router[_0x95e8('0xb')]('/:id/messages',auth[_0x95e8('0x8')](),controller['getMessages']);router[_0x95e8('0xb')](_0x95e8('0xe'),auth[_0x95e8('0x8')](),controller['download']);router[_0x95e8('0xf')]('/',auth[_0x95e8('0x8')](),controller[_0x95e8('0x10')]);router[_0x95e8('0xf')](_0x95e8('0x11'),auth[_0x95e8('0x8')](),controller['addMessage']);router[_0x95e8('0xf')](_0x95e8('0x12'),auth['isAuthenticated'](),interaction[_0x95e8('0x13')](_0x95e8('0x14'),'openchannelinteraction:addtags'),controller[_0x95e8('0x15')]);router['put'](_0x95e8('0xc'),auth['isAuthenticated'](),interaction[_0x95e8('0x13')](_0x95e8('0x14'),'openchannelinteraction:update'),controller[_0x95e8('0x16')]);router[_0x95e8('0x17')](_0x95e8('0xc'),auth[_0x95e8('0x8')](),interaction[_0x95e8('0x13')](_0x95e8('0x14'),_0x95e8('0x18')),controller[_0x95e8('0x19')]);router[_0x95e8('0x17')](_0x95e8('0x12'),auth[_0x95e8('0x8')](),controller[_0x95e8('0x1a')]);module[_0x95e8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4a9bcad..885f2f2 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 _0x61be=['DATE','sequelize','exports','BOOLEAN','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x61be,0x1d7));var _0xe61b=function(_0x22d1c5,_0x3a3182){_0x22d1c5=_0x22d1c5-0x0;var _0x188c2a=_0x61be[_0x22d1c5];return _0x188c2a;};'use strict';var Sequelize=require(_0xe61b('0x0'));module[_0xe61b('0x1')]={'closed':{'type':Sequelize[_0xe61b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe61b('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe61b('0x4')]},'threadId':{'type':Sequelize[_0xe61b('0x3')]},'externalUrl':{'type':Sequelize[_0xe61b('0x3')]},'lastMsgAt':{'type':Sequelize[_0xe61b('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe61b('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfcda=['out','BOOLEAN','sequelize','exports','DATE','STRING','ENUM'];(function(_0x3780b8,_0x32224a){var _0x96d8da=function(_0x228634){while(--_0x228634){_0x3780b8['push'](_0x3780b8['shift']());}};_0x96d8da(++_0x32224a);}(_0xfcda,0x198));var _0xafcd=function(_0x51d882,_0x557062){_0x51d882=_0x51d882-0x0;var _0x35926f=_0xfcda[_0x51d882];return _0x35926f;};'use strict';var Sequelize=require(_0xafcd('0x0'));module[_0xafcd('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xafcd('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xafcd('0x3')]},'read1stAt':{'type':Sequelize[_0xafcd('0x2')]},'threadId':{'type':Sequelize[_0xafcd('0x3')]},'externalUrl':{'type':Sequelize[_0xafcd('0x3')]},'lastMsgAt':{'type':Sequelize[_0xafcd('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xafcd('0x4')]('in',_0xafcd('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xafcd('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 2a3eb9a..cc0202b 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 _0x7b57=['socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','push','catch','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','null','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','OpenchannelInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','show','params','includeAll','include','options','destroy','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','rawAttributes','pick','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','emit','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','closedAt','disposition','threadId','Public','basename','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x58ab32,_0x4f976d){var _0x50dcb8=function(_0xc9b9a8){while(--_0xc9b9a8){_0x58ab32['push'](_0x58ab32['shift']());}};_0x50dcb8(++_0x4f976d);}(_0x7b57,0xd9));var _0x77b5=function(_0x105821,_0x2ebbee){_0x105821=_0x105821-0x0;var _0x3e23f0=_0x7b57[_0x105821];return _0x3e23f0;};'use strict';var emlformat=require(_0x77b5('0x0'));var rimraf=require(_0x77b5('0x1'));var zipdir=require(_0x77b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77b5('0x3'));var moment=require(_0x77b5('0x4'));var BPromise=require(_0x77b5('0x5'));var Mustache=require(_0x77b5('0x6'));var util=require(_0x77b5('0x7'));var path=require(_0x77b5('0x8'));var sox=require('sox');var csv=require(_0x77b5('0x9'));var ejs=require(_0x77b5('0xa'));var fs=require('fs');var fs_extra=require(_0x77b5('0xb'));var _=require(_0x77b5('0xc'));var squel=require(_0x77b5('0xd'));var crypto=require(_0x77b5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x77b5('0xf'));var toCsv=require(_0x77b5('0x9'));var querystring=require(_0x77b5('0x10'));var Papa=require(_0x77b5('0x11'));var Redis=require(_0x77b5('0x12'));var authService=require(_0x77b5('0x13'));var qs=require(_0x77b5('0x14'));var as=require(_0x77b5('0x15'));var pdf=require(_0x77b5('0x16'));var hardwareService=require(_0x77b5('0x17'));var logger=require(_0x77b5('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x77b5('0x19'));var licenseUtil=require(_0x77b5('0x1a'));var db=require(_0x77b5('0x1b'))['db'];config[_0x77b5('0x1c')]=_[_0x77b5('0x1d')](config[_0x77b5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x77b5('0x1e'))(new Redis(config[_0x77b5('0x1c')]));require(_0x77b5('0x1f'))['register'](socket);function respondWithStatusCode(_0x1cf467,_0x4c6c84){_0x4c6c84=_0x4c6c84||0xcc;return function(_0xdd1d0f){if(_0xdd1d0f){return _0x1cf467[_0x77b5('0x20')](_0x4c6c84);}return _0x1cf467[_0x77b5('0x21')](_0x4c6c84)[_0x77b5('0x22')]();};}function respondWithResult(_0x9bdc9d,_0x4b0756){_0x4b0756=_0x4b0756||0xc8;return function(_0x2ccab3){if(_0x2ccab3){return _0x9bdc9d[_0x77b5('0x21')](_0x4b0756)[_0x77b5('0x23')](_0x2ccab3);}};}function respondWithFilteredResult(_0x4eba97,_0x1e24b7){return function(_0x584d4b){if(_0x584d4b){var _0x468819=typeof _0x1e24b7[_0x77b5('0x24')]===_0x77b5('0x25')&&typeof _0x1e24b7[_0x77b5('0x26')]===_0x77b5('0x25');var _0x395967=_0x584d4b[_0x77b5('0x27')];var _0x1f34a2=_0x468819?0x0:_0x1e24b7[_0x77b5('0x24')];var _0x3d9576=_0x468819?_0x584d4b[_0x77b5('0x27')]:_0x1e24b7[_0x77b5('0x24')]+_0x1e24b7[_0x77b5('0x26')];var _0xe0c217;if(_0x3d9576>=_0x395967){_0x3d9576=_0x395967;_0xe0c217=0xc8;}else{_0xe0c217=0xce;}_0x4eba97[_0x77b5('0x21')](_0xe0c217);return _0x4eba97['set']('Content-Range',_0x1f34a2+'-'+_0x3d9576+'/'+_0x395967)[_0x77b5('0x23')](_0x584d4b);}return null;};}function patchUpdates(_0x18e775){return function(_0x53d57c){try{jsonpatch[_0x77b5('0x28')](_0x53d57c,_0x18e775,!![]);}catch(_0x30e293){return BPromise[_0x77b5('0x29')](_0x30e293);}return _0x53d57c[_0x77b5('0x2a')]();};}function saveUpdates(_0x37a660,_0x5f13ca){return function(_0x2e14b3){if(_0x2e14b3){return _0x2e14b3[_0x77b5('0x2b')](_0x37a660)[_0x77b5('0x2c')](function(_0x3c29d9){return _0x3c29d9;});}return null;};}function removeEntity(_0x323121,_0x1ea534){return function(_0x5c09ba){if(_0x5c09ba){return _0x5c09ba['destroy']()[_0x77b5('0x2c')](function(){_0x323121[_0x77b5('0x21')](0xcc)[_0x77b5('0x22')]();});}};}function handleEntityNotFound(_0x4a6479,_0x2ecbf4){return function(_0x43e46b){if(!_0x43e46b){_0x4a6479[_0x77b5('0x20')](0x194);}return _0x43e46b;};}function handleError(_0x12e6c4,_0x606a7d){_0x606a7d=_0x606a7d||0x1f4;return function(_0x4b71ad){logger[_0x77b5('0x2d')](_0x4b71ad[_0x77b5('0x2e')]);if(_0x4b71ad['name']){delete _0x4b71ad[_0x77b5('0x2f')];}_0x12e6c4[_0x77b5('0x21')](_0x606a7d)[_0x77b5('0x30')](_0x4b71ad);};}function getInteractionUsers(_0xcbc692,_0x1eecee){return new BPromise(function(_0x487dc0,_0x10e819){try{if(_0x1eecee[_0xcbc692['id']]){_0xcbc692[_0x77b5('0x31')]=_[_0x77b5('0x32')](_0x1eecee[_0xcbc692['id']],function(_0x5d9d86){return{'id':_0x5d9d86['id'],'fullname':_0x5d9d86[_0x77b5('0x33')]};});}}catch(_0x28abda){_0x10e819(_0x28abda);}_0x487dc0(_0xcbc692);});}function getInteractionTags(_0xb94f8a,_0x516ded){return new BPromise(function(_0x36d79b,_0x31cbff){try{if(_0xb94f8a[_0x77b5('0x34')]){_0xb94f8a['Tags']=[];_0xb94f8a['TagIds']['split'](',')['forEach'](function(_0x402c9e){_0xb94f8a[_0x77b5('0x35')][_0x77b5('0x36')](_0x516ded[_0x402c9e]);});}delete _0xb94f8a[_0x77b5('0x34')];}catch(_0x4e3a2a){_0x31cbff(_0x4e3a2a);}_0x36d79b(_0xb94f8a);});}function updateOpenchannelInteraction(_0x4f7c51,_0x57a1f0,_0x5048dc){return new BPromise(function(_0x24c979,_0x40cb56){return getInteractionUsers(_0x4f7c51,_0x5048dc)[_0x77b5('0x2c')](function(_0x53465e){return getInteractionTags(_0x53465e,_0x57a1f0);})[_0x77b5('0x2c')](function(_0x8afc1a){_0x24c979(_0x8afc1a);})[_0x77b5('0x37')](function(_0x214bdb){_0x40cb56(_0x214bdb);});});}exports[_0x77b5('0x38')]=function(_0x562734,_0x3e01c3){var _0x17c2cf={},_0x4d0ed0={},_0x316ad6={'count':0x0,'rows':[]};var _0x18c809=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x2f5468){return{'name':_0x2f5468[_0x77b5('0x39')],'type':_0x2f5468['type'][_0x77b5('0x3a')]};});_0x4d0ed0[_0x77b5('0x3b')]=_['map'](_0x18c809,_0x77b5('0x2f'));_0x4d0ed0[_0x77b5('0x3c')]=_[_0x77b5('0x3d')](_0x562734[_0x77b5('0x3c')]);_0x4d0ed0[_0x77b5('0x3e')]=_[_0x77b5('0x3f')](_0x4d0ed0['model'],_0x4d0ed0[_0x77b5('0x3c')]);_0x17c2cf[_0x77b5('0x40')]=_[_0x77b5('0x3f')](_0x4d0ed0[_0x77b5('0x3b')],qs[_0x77b5('0x41')](_0x562734[_0x77b5('0x3c')]['fields']));_0x17c2cf['attributes']=_0x17c2cf['attributes']['length']?_0x17c2cf[_0x77b5('0x40')]:_0x4d0ed0[_0x77b5('0x3b')];if(!_0x562734[_0x77b5('0x3c')][_0x77b5('0x42')](_0x77b5('0x43'))){_0x17c2cf['limit']=qs[_0x77b5('0x26')](_0x562734['query']['limit']);_0x17c2cf[_0x77b5('0x24')]=qs[_0x77b5('0x24')](_0x562734[_0x77b5('0x3c')][_0x77b5('0x24')]);}_0x17c2cf[_0x77b5('0x44')]=qs[_0x77b5('0x45')](_0x562734[_0x77b5('0x3c')][_0x77b5('0x45')]);_0x17c2cf['where']=qs['filters'](_['pick'](_0x562734[_0x77b5('0x3c')],_0x4d0ed0[_0x77b5('0x3e')]),_0x18c809);var _0x5de3c9=[];var _0x43be80=squel[_0x77b5('0x46')]()[_0x77b5('0x47')]('id')[_0x77b5('0x47')](_0x77b5('0x2f'))[_0x77b5('0x47')](_0x77b5('0x48'))['from'](_0x77b5('0x49'));var _0x280543=squel[_0x77b5('0x46')]()[_0x77b5('0x47')](_0x77b5('0x4a'))['field'](_0x77b5('0x4b'))['field'](_0x77b5('0x4c'))[_0x77b5('0x4d')](_0x77b5('0x4e'),'ui')['left_join'](_0x77b5('0x4f'),'u',_0x77b5('0x50'));var _0x2714f5=squel[_0x77b5('0x46')]()[_0x77b5('0x4d')]('openchannel_interactions','i')['left_join'](_0x77b5('0x51'),'c',_0x77b5('0x52'))[_0x77b5('0x53')](_0x77b5('0x4f'),'o',_0x77b5('0x54'))[_0x77b5('0x53')](_0x77b5('0x55'),'a',_0x77b5('0x56'))[_0x77b5('0x53')](_0x77b5('0x57'),'me',_0x77b5('0x58'))[_0x77b5('0x53')](_0x77b5('0x59'),'it',_0x77b5('0x5a'))[_0x77b5('0x53')](_0x77b5('0x49'),'t',_0x77b5('0x5b'));var _0x1b9dd5=squel['expr']();var _0x4a1ce8=[];var _0x47c9f1=squel[_0x77b5('0x5c')]();var _0x43e8a5;if(_0x562734[_0x77b5('0x3c')][_0x77b5('0x5d')]){_0x43e8a5=as[_0x77b5('0x5e')](_0x562734['query'][_0x77b5('0x5d')]);var _0x3c6ead=_0x43e8a5['sqlOperator'];for(var _0x61b63d=0x0;_0x61b63d<_0x43e8a5['conditions']['length'];_0x61b63d++){var _0x1891cb=_0x43e8a5[_0x77b5('0x5f')][_0x61b63d];var _0x12783a='i';var _0x5a9295=_[_0x77b5('0x60')](_0x18c809,[_0x77b5('0x2f'),_0x1891cb[_0x77b5('0x47')]]);if(!_0x5a9295){switch(_0x1891cb[_0x77b5('0x47')]){case _0x77b5('0x61'):if(_0x1891cb[_0x77b5('0x62')]==0x1){_0x2714f5[_0x77b5('0x63')]('`'+_0x1891cb[_0x77b5('0x47')]+_0x77b5('0x64'));}else{_0x2714f5[_0x77b5('0x63')]('`'+_0x1891cb[_0x77b5('0x47')]+'`\x20>\x200');}break;case _0x77b5('0x65'):if(_0x1891cb[_0x77b5('0x66')]===_0x77b5('0x67')){if(_0x1891cb[_0x77b5('0x62')][_0x77b5('0x68')]('\x20')[_0x77b5('0x69')]>0x1){_0x1b9dd5[_0x3c6ead](_0x77b5('0x6a'),qs[_0x77b5('0x6b')](_0x1891cb[_0x77b5('0x62')]),null);}else{var _0x1e192e='%'+_0x1891cb[_0x77b5('0x62')]+'%';_0x1b9dd5[_0x3c6ead]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1e192e,_0x1e192e,_0x1e192e);}}else{_0x5a9295=_[_0x77b5('0x60')](_0x18c809,[_0x77b5('0x2f'),_0x77b5('0x6c')]);_0x1891cb[_0x77b5('0x47')]=_0x77b5('0x6c');_0x45634a=as[_0x77b5('0x6d')](_0x12783a,_0x5a9295[_0x77b5('0x6e')],_0x1891cb);_0x1b9dd5[_0x3c6ead](_0x45634a[_0x77b5('0x6f')],_0x45634a[_0x77b5('0x62')]['start'],_0x45634a[_0x77b5('0x62')][_0x77b5('0x22')]);}break;case _0x77b5('0x70'):var _0x4d9641=_0x1891cb['value'][_0x77b5('0x68')](',')[_0x77b5('0x32')](function(_0x5487b2){return Number(_0x5487b2);});_0x4d9641[_0x77b5('0x71')](function(_0x13e568){_0x47c9f1['or'](_0x77b5('0x72'),'%,'+_0x13e568+',%');});_0x4a1ce8=_[_0x77b5('0x73')](_0x4a1ce8,_0x4d9641);break;case _0x77b5('0x74'):if(_0x1891cb[_0x77b5('0x66')]===_0x77b5('0x67')){_0x1b9dd5[_0x3c6ead](_0x77b5('0x75'),'%'+_0x1891cb['value']+'%',null);}else{_0x5a9295=_[_0x77b5('0x60')](_0x18c809,['name','UserId']);_0x1891cb[_0x77b5('0x47')]='UserId';_0x45634a=as[_0x77b5('0x6d')](_0x12783a,_0x5a9295[_0x77b5('0x6e')],_0x1891cb);_0x1b9dd5[_0x3c6ead](_0x45634a[_0x77b5('0x6f')],_0x45634a['value']['start'],_0x45634a['value'][_0x77b5('0x22')]);}break;case _0x77b5('0x76'):_0x45634a=as[_0x77b5('0x6d')]('me',null,_0x1891cb);_0x1b9dd5[_0x3c6ead](_0x45634a[_0x77b5('0x6f')],_0x45634a[_0x77b5('0x62')][_0x77b5('0x77')],_0x45634a[_0x77b5('0x62')][_0x77b5('0x22')]);break;}}else{var _0x45634a=as['buildExpression'](_0x12783a,_0x5a9295[_0x77b5('0x6e')],_0x1891cb);_0x1b9dd5[_0x3c6ead](_0x45634a[_0x77b5('0x6f')],_0x45634a['value'][_0x77b5('0x77')],_0x45634a[_0x77b5('0x62')][_0x77b5('0x22')]);}}}else{var _0x188375=_(_0x562734[_0x77b5('0x3c')])[_0x77b5('0x3d')]()['map'](function(_0x17c0e4){return _[_0x77b5('0x78')](_0x18c809,[_0x77b5('0x2f'),_0x17c0e4])?_0x17c0e4:undefined;})[_0x77b5('0x79')]()[_0x77b5('0x62')]();if(!_[_0x77b5('0x7a')](_0x188375)){_0x188375[_0x77b5('0x71')](function(_0x326904){if(_0x326904===_0x77b5('0x7b')){_0x2714f5['where'](_0x77b5('0x7c'),[][_0x77b5('0x7d')](_0x562734['query'][_0x326904]));}else if(_0x326904===_0x77b5('0x7e')){var _0x30def7=JSON[_0x77b5('0x7f')](_0x562734['query'][_0x326904])[_0x77b5('0x80')];var _0x532211=JSON['parse'](_0x562734[_0x77b5('0x3c')][_0x326904])[_0x77b5('0x81')];_0x2714f5[_0x77b5('0x82')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x30def7,_0x532211);}else{if(_0x562734[_0x77b5('0x3c')][_0x326904]===_0x77b5('0x83')){_0x2714f5['where']('i.'+_0x326904+_0x77b5('0x84'));}else{_0x2714f5['where']('i.'+_0x326904+_0x77b5('0x85'),_0x562734[_0x77b5('0x3c')][_0x326904]);}}});}if(_0x562734[_0x77b5('0x3c')]['read']){if(_0x562734[_0x77b5('0x3c')][_0x77b5('0x86')]==0x1){_0x2714f5[_0x77b5('0x63')]('`unreadMessages`\x20=\x200');}else{_0x2714f5[_0x77b5('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x562734[_0x77b5('0x3c')]['tag']){_0x4a1ce8=_['isArray'](_0x562734['query'][_0x77b5('0x87')])?_0x562734[_0x77b5('0x3c')][_0x77b5('0x87')]:new Array(_0x562734[_0x77b5('0x3c')][_0x77b5('0x87')]);_0x4a1ce8[_0x77b5('0x71')](function(_0x56dcd3){_0x47c9f1['or'](_0x77b5('0x72'),'%,'+_0x56dcd3+',%');});}if(_0x562734[_0x77b5('0x3c')]['filter']){var _0x3ba7f1=_0x562734[_0x77b5('0x3c')][_0x77b5('0x88')][_0x77b5('0x89')]('\x5c','\x5c\x5c')[_0x77b5('0x89')](/'/g,'\x27\x27');if(qs[_0x77b5('0x8a')](_0x3ba7f1)){_0x1b9dd5['or']('i.id\x20LIKE\x20?',_0x3ba7f1+'%');}else{_0x1b9dd5['or'](_0x77b5('0x8b'),qs[_0x77b5('0x6b')](_0x3ba7f1))['or'](_0x77b5('0x8c'),_0x3ba7f1+'%')['or'](_0x77b5('0x8d'),_0x3ba7f1+'%');}}}_0x2714f5[_0x77b5('0x82')](_0x1b9dd5);_0x2714f5[_0x77b5('0x8e')](_0x77b5('0x8f'));var _0x2e9423={'type':db[_0x77b5('0x90')][_0x77b5('0x91')][_0x77b5('0x92')],'raw':!![]};var _0x5d8589=_0x2714f5[_0x77b5('0x93')]();_0x5d8589['field'](_0x77b5('0x8f'));_0x5d8589[_0x77b5('0x47')](_0x77b5('0x94'),_0x77b5('0x61'));if(_0x17c2cf[_0x77b5('0x44')]){_0x17c2cf[_0x77b5('0x44')][_0x77b5('0x71')](function(_0xf0f182){var _0x11d57c=_0xf0f182[0x0]===_0x77b5('0x95')?_0xf0f182[0x0]:'i.'+_0xf0f182[0x0];_0x2714f5['order'](_0x11d57c,_0xf0f182[0x1]==='DESC'?![]:!![]);});}if(!_[_0x77b5('0x7a')](_0x4a1ce8)){_0x2714f5[_0x77b5('0x63')](_0x47c9f1);_0x5d8589[_0x77b5('0x82')](_0x77b5('0x96'),_0x4a1ce8);}BPromise[_0x77b5('0x97')]()[_0x77b5('0x2c')](function(){if(!_0x43e8a5){if(_0x562734['query']['OpenchannelAccountId'])return;_0x5d8589['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2714f5[_0x77b5('0x82')](_0x77b5('0x98'));return;}if(_0x562734['user'][_0x77b5('0x99')]!==_0x77b5('0x9a'))return;return _0x562734[_0x77b5('0x9b')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x330106){if(_['isEmpty'](_0x330106)){_0x5d8589[_0x77b5('0x82')](_0x77b5('0x9c'));_0x2714f5[_0x77b5('0x82')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x5d8589[_0x77b5('0x82')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x77b5('0x32')](_0x330106,'id'));_0x2714f5[_0x77b5('0x82')](_0x77b5('0x7c'),_[_0x77b5('0x32')](_0x330106,'id'));}});})[_0x77b5('0x2c')](function(){if(_0x562734[_0x77b5('0x9b')][_0x77b5('0x99')]===_0x77b5('0x9a')&&!_0x43e8a5&&!_0x562734[_0x77b5('0x3c')][_0x77b5('0x7b')])return[];return db[_0x77b5('0x9d')][_0x77b5('0x3c')](_0x5d8589[_0x77b5('0x9e')](),_0x2e9423);})[_0x77b5('0x2c')](function(_0x35a15c){_0x316ad6[_0x77b5('0x27')]=_0x35a15c[_0x77b5('0x69')];if(_0x316ad6[_0x77b5('0x27')]===0x0)return[];return db[_0x77b5('0x9d')][_0x77b5('0x3c')](_0x43be80[_0x77b5('0x9e')](),_0x2e9423)[_0x77b5('0x2c')](function(_0x1a08a2){_0x5de3c9=_[_0x77b5('0x9f')](_0x1a08a2,'id');_0x2e9423=_[_0x77b5('0xa0')](_0x2e9423,{'model':db[_0x77b5('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x562734[_0x77b5('0x3c')][_0x77b5('0x41')]){_0x17c2cf['attributes'][_0x77b5('0x71')](function(_0x3db73d){_0x2714f5[_0x77b5('0x47')]('i.'+_0x3db73d);});}else{_0x2714f5[_0x77b5('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2714f5[_0x77b5('0x47')](_0x77b5('0xa2'),'Account.key');_0x2714f5[_0x77b5('0x47')](_0x77b5('0xa3'),_0x77b5('0xa4'));_0x2714f5[_0x77b5('0x47')](_0x77b5('0xa5'),_0x77b5('0x95'));_0x2714f5['field'](_0x77b5('0xa6'));_0x2714f5[_0x77b5('0x47')](_0x77b5('0xa7'),_0x77b5('0xa8'));_0x2714f5['field'](_0x77b5('0xa9'),_0x77b5('0xaa'));_0x2714f5[_0x77b5('0x47')](_0x77b5('0xab'),_0x77b5('0xac'));_0x2714f5[_0x77b5('0x47')](_0x77b5('0xad'),_0x77b5('0xae'));_0x2714f5['field'](_0x77b5('0xaf'),'Contact.mobile');_0x2714f5[_0x77b5('0x47')]('c.fax',_0x77b5('0xb0'));_0x2714f5['field'](_0x77b5('0xb1'),_0x77b5('0xb2'));_0x2714f5['field'](_0x77b5('0xb3'),_0x77b5('0xb4'));_0x2714f5['field'](_0x77b5('0xb5'),_0x77b5('0x34'));}if(_0x17c2cf[_0x77b5('0x26')])_0x2714f5[_0x77b5('0x26')](_0x17c2cf[_0x77b5('0x26')]);if(_0x17c2cf['offset'])_0x2714f5['offset'](_0x17c2cf[_0x77b5('0x24')]);return db[_0x77b5('0x9d')]['query'](_0x2714f5[_0x77b5('0x9e')](),_0x2e9423);})[_0x77b5('0x2c')](function(_0x5177b5){if(_0x5177b5['length']>0x0)_0x280543[_0x77b5('0x82')](_0x77b5('0xb6'),_[_0x77b5('0x32')](_0x5177b5,'id'));return db[_0x77b5('0x9d')][_0x77b5('0x3c')](_0x280543[_0x77b5('0x9e')](),_0x2e9423)[_0x77b5('0x2c')](function(_0x2aa2f6){var _0x2cdb36=_['groupBy'](_0x2aa2f6,_0x77b5('0xb7'));var _0x3b9f30=[];_0x5177b5[_0x77b5('0x71')](function(_0x4e1631){_0x3b9f30[_0x77b5('0x36')](updateOpenchannelInteraction(_0x4e1631,_0x5de3c9,_0x2cdb36));});return BPromise[_0x77b5('0xb8')](_0x3b9f30);});});})[_0x77b5('0x2c')](function(_0x6fb4c6){_0x316ad6['rows']=_0x6fb4c6;return _0x316ad6;})['then'](respondWithFilteredResult(_0x3e01c3,_0x17c2cf))[_0x77b5('0x37')](handleError(_0x3e01c3,null));};exports[_0x77b5('0xb9')]=function(_0x5d0732,_0x5e6426){var _0x4a6999={};if(_0x5d0732[_0x77b5('0x3c')]['type']&&_0x5d0732['query'][_0x77b5('0x6e')]===_0x77b5('0x4d')){_0x4a6999[_0x77b5('0x4d')]=_0x5d0732['params']['id'];}else{_0x4a6999['id']=_0x5d0732[_0x77b5('0xba')]['id'];}var _0x542431={'raw':![],'where':_0x4a6999},_0x3b0b97={};_0x3b0b97[_0x77b5('0x3b')]=_[_0x77b5('0x3d')](db[_0x77b5('0xa1')]['rawAttributes']);_0x3b0b97[_0x77b5('0x3c')]=_['keys'](_0x5d0732[_0x77b5('0x3c')]);_0x3b0b97[_0x77b5('0x3e')]=_[_0x77b5('0x3f')](_0x3b0b97[_0x77b5('0x3b')],_0x3b0b97[_0x77b5('0x3c')]);_0x542431[_0x77b5('0x40')]=_['intersection'](_0x3b0b97[_0x77b5('0x3b')],qs[_0x77b5('0x41')](_0x5d0732[_0x77b5('0x3c')]['fields']));_0x542431[_0x77b5('0x40')]=_0x542431[_0x77b5('0x40')][_0x77b5('0x69')]?_0x542431[_0x77b5('0x40')]:_0x3b0b97['model'];if(_0x5d0732['query'][_0x77b5('0xbb')]){_0x542431[_0x77b5('0xbc')]=[{'all':!![]}];}_0x542431=_[_0x77b5('0xa0')]({},_0x542431,_0x5d0732[_0x77b5('0xbd')]);return db[_0x77b5('0xa1')][_0x77b5('0x60')](_0x542431)[_0x77b5('0x2c')](handleEntityNotFound(_0x5e6426,null))[_0x77b5('0x2c')](respondWithResult(_0x5e6426,null))['catch'](handleError(_0x5e6426,null));};exports['create']=function(_0x336a14,_0x87bb74){return db[_0x77b5('0xa1')]['create'](_0x336a14[_0x77b5('0x76')],{})[_0x77b5('0x2c')](respondWithResult(_0x87bb74,0xc9))[_0x77b5('0x37')](handleError(_0x87bb74,null));};exports[_0x77b5('0x2b')]=function(_0x599aab,_0x5d251d){if(_0x599aab['body']['id']){delete _0x599aab[_0x77b5('0x76')]['id'];}return db[_0x77b5('0xa1')][_0x77b5('0x60')]({'where':{'id':_0x599aab[_0x77b5('0xba')]['id']}})[_0x77b5('0x2c')](handleEntityNotFound(_0x5d251d,null))[_0x77b5('0x2c')](saveUpdates(_0x599aab[_0x77b5('0x76')],null))[_0x77b5('0x2c')](respondWithResult(_0x5d251d,null))[_0x77b5('0x37')](handleError(_0x5d251d,null));};exports[_0x77b5('0xbe')]=function(_0x4c269d,_0x4e7583){return db[_0x77b5('0xa1')][_0x77b5('0x60')]({'where':{'id':_0x4c269d[_0x77b5('0xba')]['id']}})[_0x77b5('0x2c')](handleEntityNotFound(_0x4e7583,null))['then'](removeEntity(_0x4e7583,null))['catch'](handleError(_0x4e7583,null));};exports[_0x77b5('0xbf')]=function(_0xcdd839,_0x2870fb){return db['OpenchannelInteraction']['describe']()['then'](respondWithResult(_0x2870fb,null))['catch'](handleError(_0x2870fb,null));};exports['addMessage']=function(_0x87373b,_0x3b1de6,_0x213a65){return db[_0x77b5('0xc0')][_0x77b5('0x60')]({'where':{'id':_0x87373b['params']['id']}})[_0x77b5('0x2c')](handleEntityNotFound(_0x3b1de6,null))[_0x77b5('0x2c')](function(_0x3bf9c2){if(_0x3bf9c2){return _0x3bf9c2[_0x77b5('0xc1')](_0x87373b[_0x77b5('0x76')][_0x77b5('0xc2')],_['omit'](_0x87373b[_0x77b5('0x76')],[_0x77b5('0xc2'),'id'])||{});}})['then'](respondWithResult(_0x3b1de6,null))[_0x77b5('0x37')](handleError(_0x3b1de6,null));};exports[_0x77b5('0xc3')]=function(_0x2656ad,_0x25b548,_0x2d6d53){var _0x54f335={'raw':![],'where':{}};var _0x1c24cc={};var _0x79a9e={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x77b5('0xc4')]({'where':{'id':_0x2656ad[_0x77b5('0xba')]['id']}})['then'](handleEntityNotFound(_0x25b548,null))[_0x77b5('0x2c')](function(_0x49d34e){if(_0x49d34e){_0x1c24cc['model']=_[_0x77b5('0x3d')](db['OpenchannelMessage'][_0x77b5('0xc5')]);_0x1c24cc[_0x77b5('0x3c')]=_[_0x77b5('0x3d')](_0x2656ad[_0x77b5('0x3c')]);_0x1c24cc[_0x77b5('0x3e')]=_[_0x77b5('0x3f')](_0x1c24cc[_0x77b5('0x3b')],_0x1c24cc[_0x77b5('0x3c')]);_0x54f335[_0x77b5('0x40')]=_[_0x77b5('0x3f')](_0x1c24cc[_0x77b5('0x3b')],qs[_0x77b5('0x41')](_0x2656ad[_0x77b5('0x3c')][_0x77b5('0x41')]));_0x54f335[_0x77b5('0x40')]=_0x54f335[_0x77b5('0x40')][_0x77b5('0x69')]?_0x54f335[_0x77b5('0x40')]:_0x1c24cc[_0x77b5('0x3b')];if(!_0x2656ad[_0x77b5('0x3c')][_0x77b5('0x42')](_0x77b5('0x43'))){_0x54f335[_0x77b5('0x26')]=qs[_0x77b5('0x26')](_0x2656ad[_0x77b5('0x3c')][_0x77b5('0x26')]);_0x54f335['offset']=qs[_0x77b5('0x24')](_0x2656ad['query']['offset']);}_0x54f335[_0x77b5('0x44')]=qs[_0x77b5('0x45')](_0x2656ad['query'][_0x77b5('0x45')]);_0x54f335[_0x77b5('0x82')]=qs['filters'](_[_0x77b5('0xc6')](_0x2656ad[_0x77b5('0x3c')],_0x1c24cc[_0x77b5('0x3e')]));_0x54f335['where'][_0x77b5('0xb7')]=_0x49d34e['id'];if(_0x2656ad[_0x77b5('0x3c')][_0x77b5('0x88')]){_0x54f335[_0x77b5('0x82')]=_[_0x77b5('0xa0')](_0x54f335['where'],{'$or':_[_0x77b5('0x32')](_0x54f335['attributes'],function(_0x58e1ca){var _0x36cc3d={};_0x36cc3d[_0x58e1ca]={'$like':'%'+_0x2656ad[_0x77b5('0x3c')][_0x77b5('0x88')]+'%'};return _0x36cc3d;})});}if(_0x2656ad[_0x77b5('0x3c')][_0x77b5('0x80')]){var _0x4c5546=_0x2656ad[_0x77b5('0x3c')]['$gte']['split'](',');var _0x29d9af={};_0x29d9af[_0x4c5546[0x0]]={'$gte':moment(_0x4c5546[0x1])[_0x77b5('0xc7')](_0x77b5('0xc8'))};_0x54f335[_0x77b5('0x82')]=_['merge'](_0x54f335['where'],_0x29d9af);}_0x54f335=_[_0x77b5('0xa0')]({},_0x54f335,_0x2656ad[_0x77b5('0xbd')]);return db[_0x77b5('0xc0')]['count']({'where':_0x54f335[_0x77b5('0x82')]})[_0x77b5('0x2c')](function(_0x2ea733){_0x79a9e[_0x77b5('0x27')]=_0x2ea733;if(_0x2656ad[_0x77b5('0x3c')][_0x77b5('0xbb')]){_0x54f335[_0x77b5('0xbc')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x54f335);})[_0x77b5('0x2c')](function(_0x14acaf){_0x79a9e[_0x77b5('0xc9')]=_0x14acaf;return _0x79a9e;});}})['then'](respondWithFilteredResult(_0x25b548,_0x54f335))[_0x77b5('0x37')](handleError(_0x25b548,null));};exports[_0x77b5('0xca')]=function(_0x361f82,_0x53fc5c,_0x3f072f){return db[_0x77b5('0xa1')][_0x77b5('0x60')]({'where':{'id':_0x361f82[_0x77b5('0xba')]['id']}})[_0x77b5('0x2c')](handleEntityNotFound(_0x53fc5c,null))[_0x77b5('0x2c')](function(_0x3fdb85){if(_0x3fdb85){return _0x3fdb85[_0x77b5('0xcb')](_0x361f82[_0x77b5('0x76')][_0x77b5('0xc2')],_[_0x77b5('0xcc')](_0x361f82[_0x77b5('0x76')],[_0x77b5('0xc2'),'id'])||{})[_0x77b5('0xcd')](function(){return db[_0x77b5('0x70')][_0x77b5('0xce')]({'attributes':['id','name','color'],'where':{'id':_0x361f82['body'][_0x77b5('0xc2')]}});})[_0x77b5('0x2c')](function(_0x508769){socket[_0x77b5('0xcf')]('openchannelInteractionTags:save',{'id':Number(_0x361f82[_0x77b5('0xba')]['id']),'tags':_0x508769||[]});return{'id':Number(_0x361f82[_0x77b5('0xba')]['id']),'tags':_0x508769||[]};});}})[_0x77b5('0x2c')](respondWithResult(_0x53fc5c,null))[_0x77b5('0x37')](handleError(_0x53fc5c,null));};exports[_0x77b5('0xd0')]=function(_0x137539,_0x5ca1f2,_0x3a3df2){return db[_0x77b5('0xa1')][_0x77b5('0x60')]({'where':{'id':_0x137539[_0x77b5('0xba')]['id']}})[_0x77b5('0x2c')](handleEntityNotFound(_0x5ca1f2,null))[_0x77b5('0x2c')](function(_0x2b1530){if(_0x2b1530){return _0x2b1530['removeTags'](_0x137539['query']['ids']);}})[_0x77b5('0x2c')](respondWithStatusCode(_0x5ca1f2,null))[_0x77b5('0x37')](handleError(_0x5ca1f2,null));};exports[_0x77b5('0xd1')]=function(_0x13bdd2,_0x5c6890){var _0x14cc44=moment()['unix']()[_0x77b5('0x9e')]();var _0x5135a7=path[_0x77b5('0xd2')](config[_0x77b5('0xd3')],_0x77b5('0xd4'),_0x77b5('0xd5'),_0x77b5('0xd6'));var _0x151101=path[_0x77b5('0xd2')](config['root'],_0x77b5('0xd4'),_0x77b5('0xd5'),_0x77b5('0xd7'));var _0x5d005c=path[_0x77b5('0xd2')](_0x5135a7,_0x14cc44);var _0x32b816=util[_0x77b5('0xc7')](_0x77b5('0xd8'),_0x13bdd2[_0x77b5('0xba')]['id'],_0x14cc44);var _0x55188a=path['join'](_0x5135a7,_0x32b816);var _0x20befd=[];_0x20befd[_0x77b5('0x36')]({'model':db[_0x77b5('0x74')],'as':_0x77b5('0x74'),'attributes':['id',_0x77b5('0x33')],'raw':!![]});_0x20befd[_0x77b5('0x36')]({'model':db[_0x77b5('0xd9')],'as':_0x77b5('0x65'),'attributes':['id',_0x77b5('0xda'),_0x77b5('0xdb')],'raw':!![]});if(_0x13bdd2['query'][_0x77b5('0xd7')]){_0x20befd['push']({'model':db[_0x77b5('0xdc')],'as':'Attachment','raw':!![]});}var _0x5a948f=[{'model':db[_0x77b5('0xc0')],'as':_0x77b5('0xdd'),'attributes':['id',_0x77b5('0x76'),_0x77b5('0x7e'),_0x77b5('0xde'),'secret','read'],'include':_0x20befd}];_0x5a948f[_0x77b5('0x36')]({'model':db[_0x77b5('0xdf')],'as':_0x77b5('0xe0'),'attributes':['id',_0x77b5('0x2f')]});_0x5a948f[_0x77b5('0x36')]({'model':db[_0x77b5('0x74')],'as':_0x77b5('0xe1'),'attributes':['id',_0x77b5('0x33')]});return db['OpenchannelInteraction'][_0x77b5('0x60')]({'where':{'id':_0x13bdd2['params']['id']},'include':_0x5a948f})['then'](handleEntityNotFound(_0x5c6890,null))[_0x77b5('0x2c')](function(_0x317fbb){if(_0x317fbb){var _0x5c0749=_0x317fbb[_0x77b5('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x5d005c);var _0x3976cd={'channel':_0x77b5('0xe3'),'account':_0x5c0749[_0x77b5('0xe0')][_0x77b5('0x2f')],'agent':_0x5c0749[_0x77b5('0xe1')]?_0x5c0749[_0x77b5('0xe1')]['fullname']:_0x77b5('0xe4'),'createdAt':moment(_0x5c0749[_0x77b5('0x7e')])['format'](_0x77b5('0xc8'))['toString'](),'closedAt':_0x5c0749['closed']?moment(_0x5c0749[_0x77b5('0xe5')])[_0x77b5('0xc7')](_0x77b5('0xc8'))[_0x77b5('0x9e')]():'','disposition':_0x5c0749[_0x77b5('0xe6')],'visibility':_0x5c0749[_0x77b5('0xe7')]?_0x77b5('0xe8'):'Private','messages':_(_0x5c0749[_0x77b5('0xdd')])[_0x77b5('0x88')]({'secret':![]})[_0x77b5('0x32')](function(_0x38169e){if(_0x38169e[_0x77b5('0xdc')]){var _0x309fa8=path[_0x77b5('0xd2')](_0x151101,_0x38169e[_0x77b5('0xdc')][_0x77b5('0xe9')]);if(fs['existsSync'](_0x309fa8)){fs[_0x77b5('0xea')](_0x309fa8)[_0x77b5('0xeb')](fs[_0x77b5('0xec')](path[_0x77b5('0xd2')](_0x5d005c,_0x38169e[_0x77b5('0xdc')][_0x77b5('0xe9')])));}}return{'date':moment(_0x38169e['createdAt'])[_0x77b5('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x77b5('0x9e')](),'sender':_0x38169e[_0x77b5('0xde')]===_0x77b5('0xed')?_0x38169e[_0x77b5('0x74')]?_0x38169e[_0x77b5('0x74')][_0x77b5('0x33')]:_0x77b5('0xee'):_0x38169e[_0x77b5('0x65')]['firstName']+(_0x38169e['Contact'][_0x77b5('0xdb')]?'\x20'+_0x38169e[_0x77b5('0x65')][_0x77b5('0xdb')]:''),'body':_0x38169e['Attachment']?_0x38169e[_0x77b5('0xdc')]['basename']:_0x38169e['body'],'direction':_0x38169e['direction']===_0x77b5('0xed')?'A':'C','secret':_0x38169e[_0x77b5('0xef')],'read':_0x38169e[_0x77b5('0x86')],'attachment':_0x38169e['Attachment']};})[_0x77b5('0x62')]()};return ejs[_0x77b5('0xf0')](path[_0x77b5('0xd2')](config[_0x77b5('0xd3')],_0x77b5('0xd4'),'views',_0x77b5('0xf1')),{'interaction':_0x3976cd})[_0x77b5('0x2c')](function(_0x5b814e){var _0x1f876=path[_0x77b5('0xd2')](_0x5d005c,_0x77b5('0xf2')+_0x5c0749['id']+'-'+_0x14cc44+_0x77b5('0xf3'));var _0x86ad5b={'path':_0x1f876,'channel':_0x77b5('0xe3'),'interactionId':_0x5c0749['id']};return pdf[_0x77b5('0xf4')](_0x5b814e,_0x86ad5b);})[_0x77b5('0x2c')](function(){return new BPromise(function(_0x1ce395,_0x4e8ada){zipdir(_0x5d005c,{'saveTo':_0x55188a},function(_0x30b67c,_0x47e02b){if(_0x30b67c)return _0x4e8ada(_0x30b67c);return _0x1ce395(_0x47e02b);});})[_0x77b5('0x2c')](function(){return new BPromise(function(_0x5d99ad,_0x1c2194){rimraf(_0x5d005c,function(_0x4ccd97){if(_0x4ccd97)_0x1c2194(_0x4ccd97);return _0x5d99ad();});});})[_0x77b5('0x2c')](function(){return _0x5c6890['download'](_0x55188a,_0x32b816,function(_0x5de40a){if(_0x5de40a){console['log'](_0x77b5('0xf5'),_0x5de40a);}else{fs[_0x77b5('0xf6')](_0x55188a);}});});});}else{return _0x5c6890['sendStatus'](0xc8);}})['catch'](handleError(_0x5c6890,null));}; \ No newline at end of file +var _0xe76c=['findAll','addTags','setTags','omit','spread','removeTags','join','root','server','files','tmp','format','transcript-%d-%s.zip','Contact','firstName','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','N.A.','disposition','threadId','Public','basename','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','map','fullname','TagIds','Tags','forEach','push','catch','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','params','OpenchannelInteraction','include','options','create','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll'];(function(_0x568cdb,_0x2c1159){var _0xcef151=function(_0x20708f){while(--_0x20708f){_0x568cdb['push'](_0x568cdb['shift']());}};_0xcef151(++_0x2c1159);}(_0xe76c,0x118));var _0xce76=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xe76c[_0x96f74c];return _0x379222;};'use strict';var emlformat=require(_0xce76('0x0'));var rimraf=require(_0xce76('0x1'));var zipdir=require(_0xce76('0x2'));var jsonpatch=require(_0xce76('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce76('0x4'));var Mustache=require(_0xce76('0x5'));var util=require(_0xce76('0x6'));var path=require(_0xce76('0x7'));var sox=require(_0xce76('0x8'));var csv=require(_0xce76('0x9'));var ejs=require(_0xce76('0xa'));var fs=require('fs');var fs_extra=require(_0xce76('0xb'));var _=require(_0xce76('0xc'));var squel=require('squel');var crypto=require(_0xce76('0xd'));var jsforce=require(_0xce76('0xe'));var deskjs=require(_0xce76('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce76('0x10'));var Papa=require(_0xce76('0x11'));var Redis=require(_0xce76('0x12'));var authService=require(_0xce76('0x13'));var qs=require(_0xce76('0x14'));var as=require(_0xce76('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xce76('0x16'));var logger=require(_0xce76('0x17'))(_0xce76('0x18'));var utils=require('../../config/utils');var config=require(_0xce76('0x19'));var licenseUtil=require(_0xce76('0x1a'));var db=require(_0xce76('0x1b'))['db'];config[_0xce76('0x1c')]=_[_0xce76('0x1d')](config['redis'],{'host':_0xce76('0x1e'),'port':0x18eb});var socket=require(_0xce76('0x1f'))(new Redis(config[_0xce76('0x1c')]));require('./openchannelInteraction.socket')[_0xce76('0x20')](socket);function respondWithStatusCode(_0x2a6791,_0x4eed92){_0x4eed92=_0x4eed92||0xcc;return function(_0x193985){if(_0x193985){return _0x2a6791[_0xce76('0x21')](_0x4eed92);}return _0x2a6791['status'](_0x4eed92)[_0xce76('0x22')]();};}function respondWithResult(_0x4dc74d,_0x1ef3f9){_0x1ef3f9=_0x1ef3f9||0xc8;return function(_0x2a5106){if(_0x2a5106){return _0x4dc74d[_0xce76('0x23')](_0x1ef3f9)['json'](_0x2a5106);}};}function respondWithFilteredResult(_0x47d0fe,_0x30c5a1){return function(_0x2923f9){if(_0x2923f9){var _0x3b78fe=typeof _0x30c5a1[_0xce76('0x24')]==='undefined'&&typeof _0x30c5a1[_0xce76('0x25')]==='undefined';var _0x19f5d4=_0x2923f9[_0xce76('0x26')];var _0x2abedb=_0x3b78fe?0x0:_0x30c5a1[_0xce76('0x24')];var _0x128f05=_0x3b78fe?_0x2923f9[_0xce76('0x26')]:_0x30c5a1[_0xce76('0x24')]+_0x30c5a1[_0xce76('0x25')];var _0x1526f1;if(_0x128f05>=_0x19f5d4){_0x128f05=_0x19f5d4;_0x1526f1=0xc8;}else{_0x1526f1=0xce;}_0x47d0fe[_0xce76('0x23')](_0x1526f1);return _0x47d0fe[_0xce76('0x27')](_0xce76('0x28'),_0x2abedb+'-'+_0x128f05+'/'+_0x19f5d4)[_0xce76('0x29')](_0x2923f9);}return null;};}function patchUpdates(_0x3f071f){return function(_0x119e3a){try{jsonpatch[_0xce76('0x2a')](_0x119e3a,_0x3f071f,!![]);}catch(_0x1b5319){return BPromise[_0xce76('0x2b')](_0x1b5319);}return _0x119e3a[_0xce76('0x2c')]();};}function saveUpdates(_0x5f56fa,_0x6c7ea0){return function(_0xcbd442){if(_0xcbd442){return _0xcbd442[_0xce76('0x2d')](_0x5f56fa)[_0xce76('0x2e')](function(_0x2115eb){return _0x2115eb;});}return null;};}function removeEntity(_0x22afdb,_0x55be52){return function(_0x666400){if(_0x666400){return _0x666400['destroy']()['then'](function(){_0x22afdb[_0xce76('0x23')](0xcc)[_0xce76('0x22')]();});}};}function handleEntityNotFound(_0x4a0f9f,_0x5d315a){return function(_0x5a29e8){if(!_0x5a29e8){_0x4a0f9f['sendStatus'](0x194);}return _0x5a29e8;};}function handleError(_0x16bbe1,_0x4e5b88){_0x4e5b88=_0x4e5b88||0x1f4;return function(_0x1538d6){logger[_0xce76('0x2f')](_0x1538d6['stack']);if(_0x1538d6['name']){delete _0x1538d6[_0xce76('0x30')];}_0x16bbe1[_0xce76('0x23')](_0x4e5b88)['send'](_0x1538d6);};}function getInteractionUsers(_0xddf3aa,_0x3ede84){return new BPromise(function(_0x32169f,_0x5a87e4){try{if(_0x3ede84[_0xddf3aa['id']]){_0xddf3aa['Users']=_[_0xce76('0x31')](_0x3ede84[_0xddf3aa['id']],function(_0xc55192){return{'id':_0xc55192['id'],'fullname':_0xc55192[_0xce76('0x32')]};});}}catch(_0x2a42bb){_0x5a87e4(_0x2a42bb);}_0x32169f(_0xddf3aa);});}function getInteractionTags(_0x392857,_0x175987){return new BPromise(function(_0x5e3620,_0x1bd5bd){try{if(_0x392857[_0xce76('0x33')]){_0x392857[_0xce76('0x34')]=[];_0x392857[_0xce76('0x33')]['split'](',')[_0xce76('0x35')](function(_0x44280f){_0x392857[_0xce76('0x34')][_0xce76('0x36')](_0x175987[_0x44280f]);});}delete _0x392857[_0xce76('0x33')];}catch(_0x12d84d){_0x1bd5bd(_0x12d84d);}_0x5e3620(_0x392857);});}function updateOpenchannelInteraction(_0xe2143e,_0x3e32d9,_0x30a415){return new BPromise(function(_0xa94930,_0x3ad737){return getInteractionUsers(_0xe2143e,_0x30a415)[_0xce76('0x2e')](function(_0x5b5a1b){return getInteractionTags(_0x5b5a1b,_0x3e32d9);})[_0xce76('0x2e')](function(_0x3426ec){_0xa94930(_0x3426ec);})[_0xce76('0x37')](function(_0x1506f2){_0x3ad737(_0x1506f2);});});}exports[_0xce76('0x38')]=function(_0x10d599,_0x4ee557){var _0x4353e3={},_0x3cf7ed={},_0x37b944={'count':0x0,'rows':[]};var _0x1b041e=_[_0xce76('0x31')](db['OpenchannelInteraction'][_0xce76('0x39')],function(_0x2427ca){return{'name':_0x2427ca[_0xce76('0x3a')],'type':_0x2427ca[_0xce76('0x3b')][_0xce76('0x3c')]};});_0x3cf7ed['model']=_[_0xce76('0x31')](_0x1b041e,_0xce76('0x30'));_0x3cf7ed[_0xce76('0x3d')]=_[_0xce76('0x3e')](_0x10d599[_0xce76('0x3d')]);_0x3cf7ed[_0xce76('0x3f')]=_[_0xce76('0x40')](_0x3cf7ed[_0xce76('0x41')],_0x3cf7ed[_0xce76('0x3d')]);_0x4353e3[_0xce76('0x42')]=_['intersection'](_0x3cf7ed[_0xce76('0x41')],qs[_0xce76('0x43')](_0x10d599['query']['fields']));_0x4353e3[_0xce76('0x42')]=_0x4353e3[_0xce76('0x42')][_0xce76('0x44')]?_0x4353e3[_0xce76('0x42')]:_0x3cf7ed[_0xce76('0x41')];if(!_0x10d599[_0xce76('0x3d')][_0xce76('0x45')](_0xce76('0x46'))){_0x4353e3[_0xce76('0x25')]=qs[_0xce76('0x25')](_0x10d599[_0xce76('0x3d')][_0xce76('0x25')]);_0x4353e3[_0xce76('0x24')]=qs[_0xce76('0x24')](_0x10d599[_0xce76('0x3d')][_0xce76('0x24')]);}_0x4353e3[_0xce76('0x47')]=qs[_0xce76('0x48')](_0x10d599[_0xce76('0x3d')][_0xce76('0x48')]);_0x4353e3[_0xce76('0x49')]=qs[_0xce76('0x3f')](_[_0xce76('0x4a')](_0x10d599['query'],_0x3cf7ed[_0xce76('0x3f')]),_0x1b041e);var _0x267948=[];var _0x37859e=squel[_0xce76('0x4b')]()['field']('id')[_0xce76('0x4c')](_0xce76('0x30'))[_0xce76('0x4c')](_0xce76('0x4d'))[_0xce76('0x4e')](_0xce76('0x4f'));var _0x2dd26d=squel[_0xce76('0x4b')]()[_0xce76('0x4c')](_0xce76('0x50'))['field'](_0xce76('0x51'))[_0xce76('0x4c')]('ui.OpenchannelInteractionId')[_0xce76('0x4e')](_0xce76('0x52'),'ui')[_0xce76('0x53')](_0xce76('0x54'),'u',_0xce76('0x55'));var _0x4f9a79=squel[_0xce76('0x4b')]()[_0xce76('0x4e')](_0xce76('0x56'),'i')[_0xce76('0x53')]('cm_contacts','c',_0xce76('0x57'))[_0xce76('0x53')](_0xce76('0x54'),'o',_0xce76('0x58'))[_0xce76('0x53')]('openchannel_accounts','a',_0xce76('0x59'))[_0xce76('0x53')](_0xce76('0x5a'),'me',_0xce76('0x5b'))[_0xce76('0x53')](_0xce76('0x5c'),'it',_0xce76('0x5d'))['left_join'](_0xce76('0x4f'),'t',_0xce76('0x5e'));var _0x5c0fdf=squel[_0xce76('0x5f')]();var _0xa30f53=[];var _0x27a525=squel[_0xce76('0x5f')]();var _0x2a563e;if(_0x10d599['query'][_0xce76('0x60')]){_0x2a563e=as['parseSearch'](_0x10d599['query']['search']);var _0x2c2a8f=_0x2a563e['sqlOperator'];for(var _0x29cbe5=0x0;_0x29cbe5<_0x2a563e['conditions'][_0xce76('0x44')];_0x29cbe5++){var _0xcb9aec=_0x2a563e[_0xce76('0x61')][_0x29cbe5];var _0x2fded8='i';var _0x500590=_[_0xce76('0x62')](_0x1b041e,[_0xce76('0x30'),_0xcb9aec[_0xce76('0x4c')]]);if(!_0x500590){switch(_0xcb9aec[_0xce76('0x4c')]){case _0xce76('0x63'):if(_0xcb9aec[_0xce76('0x64')]==0x1){_0x4f9a79[_0xce76('0x65')]('`'+_0xcb9aec[_0xce76('0x4c')]+'`\x20=\x200');}else{_0x4f9a79[_0xce76('0x65')]('`'+_0xcb9aec['field']+_0xce76('0x66'));}break;case'Contact':if(_0xcb9aec[_0xce76('0x67')]==='$substring'){if(_0xcb9aec[_0xce76('0x64')]['split']('\x20')[_0xce76('0x44')]>0x1){_0x5c0fdf[_0x2c2a8f](_0xce76('0x68'),qs[_0xce76('0x69')](_0xcb9aec[_0xce76('0x64')]),null);}else{var _0x21de01='%'+_0xcb9aec[_0xce76('0x64')]+'%';_0x5c0fdf[_0x2c2a8f](_0xce76('0x6a'),_0x21de01,_0x21de01,_0x21de01);}}else{_0x500590=_['find'](_0x1b041e,[_0xce76('0x30'),_0xce76('0x6b')]);_0xcb9aec['field']='ContactId';_0x5b588c=as[_0xce76('0x6c')](_0x2fded8,_0x500590[_0xce76('0x3b')],_0xcb9aec);_0x5c0fdf[_0x2c2a8f](_0x5b588c[_0xce76('0x6d')],_0x5b588c['value'][_0xce76('0x6e')],_0x5b588c[_0xce76('0x64')][_0xce76('0x22')]);}break;case _0xce76('0x6f'):var _0x345cee=_0xcb9aec[_0xce76('0x64')][_0xce76('0x70')](',')['map'](function(_0xcc277){return Number(_0xcc277);});_0x345cee['forEach'](function(_0x2575ee){_0x27a525['or'](_0xce76('0x71'),'%,'+_0x2575ee+',%');});_0xa30f53=_[_0xce76('0x72')](_0xa30f53,_0x345cee);break;case _0xce76('0x73'):if(_0xcb9aec[_0xce76('0x67')]===_0xce76('0x74')){_0x5c0fdf[_0x2c2a8f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xcb9aec['value']+'%',null);}else{_0x500590=_[_0xce76('0x62')](_0x1b041e,[_0xce76('0x30'),_0xce76('0x75')]);_0xcb9aec[_0xce76('0x4c')]=_0xce76('0x75');_0x5b588c=as[_0xce76('0x6c')](_0x2fded8,_0x500590[_0xce76('0x3b')],_0xcb9aec);_0x5c0fdf[_0x2c2a8f](_0x5b588c[_0xce76('0x6d')],_0x5b588c[_0xce76('0x64')][_0xce76('0x6e')],_0x5b588c[_0xce76('0x64')]['end']);}break;case _0xce76('0x76'):_0x5b588c=as['buildExpression']('me',null,_0xcb9aec);_0x5c0fdf[_0x2c2a8f](_0x5b588c[_0xce76('0x6d')],_0x5b588c[_0xce76('0x64')][_0xce76('0x6e')],_0x5b588c[_0xce76('0x64')][_0xce76('0x22')]);break;}}else{var _0x5b588c=as[_0xce76('0x6c')](_0x2fded8,_0x500590[_0xce76('0x3b')],_0xcb9aec);_0x5c0fdf[_0x2c2a8f](_0x5b588c[_0xce76('0x6d')],_0x5b588c[_0xce76('0x64')][_0xce76('0x6e')],_0x5b588c['value']['end']);}}}else{var _0x3909fb=_(_0x10d599[_0xce76('0x3d')])[_0xce76('0x3e')]()[_0xce76('0x31')](function(_0x23ee56){return _[_0xce76('0x77')](_0x1b041e,[_0xce76('0x30'),_0x23ee56])?_0x23ee56:undefined;})[_0xce76('0x78')]()[_0xce76('0x64')]();if(!_[_0xce76('0x79')](_0x3909fb)){_0x3909fb[_0xce76('0x35')](function(_0x2249da){if(_0x2249da===_0xce76('0x7a')){_0x4f9a79[_0xce76('0x49')](_0xce76('0x7b'),[][_0xce76('0x7c')](_0x10d599['query'][_0x2249da]));}else if(_0x2249da===_0xce76('0x7d')){var _0x4d9d4d=JSON['parse'](_0x10d599[_0xce76('0x3d')][_0x2249da])[_0xce76('0x7e')];var _0x56da61=JSON[_0xce76('0x7f')](_0x10d599[_0xce76('0x3d')][_0x2249da])[_0xce76('0x80')];_0x4f9a79['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4d9d4d,_0x56da61);}else{if(_0x10d599[_0xce76('0x3d')][_0x2249da]===_0xce76('0x81')){_0x4f9a79[_0xce76('0x49')]('i.'+_0x2249da+_0xce76('0x82'));}else{_0x4f9a79['where']('i.'+_0x2249da+_0xce76('0x83'),_0x10d599['query'][_0x2249da]);}}});}if(_0x10d599[_0xce76('0x3d')][_0xce76('0x84')]){if(_0x10d599['query']['read']==0x1){_0x4f9a79[_0xce76('0x65')](_0xce76('0x85'));}else{_0x4f9a79[_0xce76('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x10d599['query']['tag']){_0xa30f53=_['isArray'](_0x10d599[_0xce76('0x3d')][_0xce76('0x86')])?_0x10d599[_0xce76('0x3d')][_0xce76('0x86')]:new Array(_0x10d599['query']['tag']);_0xa30f53['forEach'](function(_0x280d86){_0x27a525['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x280d86+',%');});}if(_0x10d599[_0xce76('0x3d')]['filter']){var _0x17459c=_0x10d599[_0xce76('0x3d')][_0xce76('0x87')][_0xce76('0x88')]('\x5c','\x5c\x5c')[_0xce76('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x17459c)){_0x5c0fdf['or'](_0xce76('0x89'),_0x17459c+'%');}else{_0x5c0fdf['or'](_0xce76('0x8a'),qs[_0xce76('0x69')](_0x17459c))['or'](_0xce76('0x8b'),_0x17459c+'%')['or'](_0xce76('0x8c'),_0x17459c+'%');}}}_0x4f9a79[_0xce76('0x49')](_0x5c0fdf);_0x4f9a79[_0xce76('0x8d')](_0xce76('0x8e'));var _0x40c8f8={'type':db['Sequelize'][_0xce76('0x8f')][_0xce76('0x90')],'raw':!![]};var _0x1e5d22=_0x4f9a79[_0xce76('0x91')]();_0x1e5d22[_0xce76('0x4c')](_0xce76('0x8e'));_0x1e5d22[_0xce76('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xce76('0x63'));if(_0x4353e3['order']){_0x4353e3['order'][_0xce76('0x35')](function(_0x2373e7){var _0x38bf7d=_0x2373e7[0x0]===_0xce76('0x92')?_0x2373e7[0x0]:'i.'+_0x2373e7[0x0];_0x4f9a79[_0xce76('0x47')](_0x38bf7d,_0x2373e7[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xa30f53)){_0x4f9a79[_0xce76('0x65')](_0x27a525);_0x1e5d22[_0xce76('0x49')](_0xce76('0x93'),_0xa30f53);}BPromise[_0xce76('0x94')]()[_0xce76('0x2e')](function(){if(!_0x2a563e){if(_0x10d599[_0xce76('0x3d')]['OpenchannelAccountId'])return;_0x1e5d22[_0xce76('0x49')](_0xce76('0x95'));_0x4f9a79['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x10d599['user'][_0xce76('0x96')]!==_0xce76('0x97'))return;return _0x10d599[_0xce76('0x98')][_0xce76('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5511ab){if(_['isEmpty'](_0x5511ab)){_0x1e5d22[_0xce76('0x49')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4f9a79['where'](_0xce76('0x9a'));}else{_0x1e5d22[_0xce76('0x49')](_0xce76('0x7b'),_[_0xce76('0x31')](_0x5511ab,'id'));_0x4f9a79[_0xce76('0x49')](_0xce76('0x7b'),_[_0xce76('0x31')](_0x5511ab,'id'));}});})[_0xce76('0x2e')](function(){if(_0x10d599[_0xce76('0x98')][_0xce76('0x96')]===_0xce76('0x97')&&!_0x2a563e&&!_0x10d599[_0xce76('0x3d')][_0xce76('0x7a')])return[];return db[_0xce76('0x9b')][_0xce76('0x3d')](_0x1e5d22[_0xce76('0x9c')](),_0x40c8f8);})['then'](function(_0x35c956){_0x37b944[_0xce76('0x26')]=_0x35c956['length'];if(_0x37b944['count']===0x0)return[];return db[_0xce76('0x9b')][_0xce76('0x3d')](_0x37859e[_0xce76('0x9c')](),_0x40c8f8)[_0xce76('0x2e')](function(_0x25506b){_0x267948=_[_0xce76('0x9d')](_0x25506b,'id');_0x40c8f8=_[_0xce76('0x9e')](_0x40c8f8,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10d599[_0xce76('0x3d')][_0xce76('0x43')]){_0x4353e3[_0xce76('0x42')][_0xce76('0x35')](function(_0x209bcf){_0x4f9a79[_0xce76('0x4c')]('i.'+_0x209bcf);});}else{_0x4f9a79['field'](_0xce76('0x9f'),'unreadMessages');_0x4f9a79[_0xce76('0x4c')]('a.key',_0xce76('0xa0'));_0x4f9a79[_0xce76('0x4c')](_0xce76('0xa1'),'Account.mandatoryDisposition');_0x4f9a79[_0xce76('0x4c')](_0xce76('0xa2'),_0xce76('0x92'));_0x4f9a79['field'](_0xce76('0xa3'));_0x4f9a79[_0xce76('0x4c')](_0xce76('0xa4'),_0xce76('0xa5'));_0x4f9a79[_0xce76('0x4c')](_0xce76('0xa6'),'Contact.lastName');_0x4f9a79[_0xce76('0x4c')](_0xce76('0xa7'),_0xce76('0xa8'));_0x4f9a79[_0xce76('0x4c')]('c.phone',_0xce76('0xa9'));_0x4f9a79[_0xce76('0x4c')](_0xce76('0xaa'),_0xce76('0xab'));_0x4f9a79['field'](_0xce76('0xac'),_0xce76('0xad'));_0x4f9a79[_0xce76('0x4c')](_0xce76('0xae'),'Owner.fullname');_0x4f9a79['field']('o.internal',_0xce76('0xaf'));_0x4f9a79[_0xce76('0x4c')](_0xce76('0xb0'),'TagIds');}if(_0x4353e3[_0xce76('0x25')])_0x4f9a79[_0xce76('0x25')](_0x4353e3['limit']);if(_0x4353e3[_0xce76('0x24')])_0x4f9a79['offset'](_0x4353e3[_0xce76('0x24')]);return db['sequelize'][_0xce76('0x3d')](_0x4f9a79[_0xce76('0x9c')](),_0x40c8f8);})[_0xce76('0x2e')](function(_0x5acb6f){if(_0x5acb6f[_0xce76('0x44')]>0x0)_0x2dd26d[_0xce76('0x49')](_0xce76('0xb1'),_[_0xce76('0x31')](_0x5acb6f,'id'));return db['sequelize'][_0xce76('0x3d')](_0x2dd26d[_0xce76('0x9c')](),_0x40c8f8)[_0xce76('0x2e')](function(_0x221502){var _0x218398=_['groupBy'](_0x221502,_0xce76('0xb2'));var _0x414d18=[];_0x5acb6f[_0xce76('0x35')](function(_0x120cb2){_0x414d18[_0xce76('0x36')](updateOpenchannelInteraction(_0x120cb2,_0x267948,_0x218398));});return BPromise[_0xce76('0xb3')](_0x414d18);});});})[_0xce76('0x2e')](function(_0xcaec61){_0x37b944[_0xce76('0xb4')]=_0xcaec61;return _0x37b944;})[_0xce76('0x2e')](respondWithFilteredResult(_0x4ee557,_0x4353e3))['catch'](handleError(_0x4ee557,null));};exports['show']=function(_0x2f4375,_0x56f2ec){var _0x44ed80={};if(_0x2f4375[_0xce76('0x3d')][_0xce76('0x3b')]&&_0x2f4375[_0xce76('0x3d')]['type']===_0xce76('0x4e')){_0x44ed80[_0xce76('0x4e')]=_0x2f4375[_0xce76('0xb5')]['id'];}else{_0x44ed80['id']=_0x2f4375[_0xce76('0xb5')]['id'];}var _0x46d899={'raw':![],'where':_0x44ed80},_0x3db9b8={};_0x3db9b8[_0xce76('0x41')]=_[_0xce76('0x3e')](db[_0xce76('0xb6')][_0xce76('0x39')]);_0x3db9b8[_0xce76('0x3d')]=_[_0xce76('0x3e')](_0x2f4375[_0xce76('0x3d')]);_0x3db9b8[_0xce76('0x3f')]=_[_0xce76('0x40')](_0x3db9b8[_0xce76('0x41')],_0x3db9b8['query']);_0x46d899['attributes']=_[_0xce76('0x40')](_0x3db9b8['model'],qs['fields'](_0x2f4375[_0xce76('0x3d')][_0xce76('0x43')]));_0x46d899[_0xce76('0x42')]=_0x46d899[_0xce76('0x42')][_0xce76('0x44')]?_0x46d899[_0xce76('0x42')]:_0x3db9b8[_0xce76('0x41')];if(_0x2f4375[_0xce76('0x3d')]['includeAll']){_0x46d899[_0xce76('0xb7')]=[{'all':!![]}];}_0x46d899=_[_0xce76('0x9e')]({},_0x46d899,_0x2f4375[_0xce76('0xb8')]);return db[_0xce76('0xb6')][_0xce76('0x62')](_0x46d899)[_0xce76('0x2e')](handleEntityNotFound(_0x56f2ec,null))['then'](respondWithResult(_0x56f2ec,null))[_0xce76('0x37')](handleError(_0x56f2ec,null));};exports[_0xce76('0xb9')]=function(_0x45b518,_0xe7af5c){return db['OpenchannelInteraction'][_0xce76('0xb9')](_0x45b518[_0xce76('0x76')],{})[_0xce76('0x2e')](respondWithResult(_0xe7af5c,0xc9))[_0xce76('0x37')](handleError(_0xe7af5c,null));};exports[_0xce76('0x2d')]=function(_0x5e3526,_0x65b9f5){if(_0x5e3526['body']['id']){delete _0x5e3526[_0xce76('0x76')]['id'];}return db[_0xce76('0xb6')][_0xce76('0x62')]({'where':{'id':_0x5e3526[_0xce76('0xb5')]['id']}})[_0xce76('0x2e')](handleEntityNotFound(_0x65b9f5,null))['then'](saveUpdates(_0x5e3526[_0xce76('0x76')],null))[_0xce76('0x2e')](respondWithResult(_0x65b9f5,null))[_0xce76('0x37')](handleError(_0x65b9f5,null));};exports['destroy']=function(_0x5b1a45,_0x950eed){return db[_0xce76('0xb6')][_0xce76('0x62')]({'where':{'id':_0x5b1a45[_0xce76('0xb5')]['id']}})[_0xce76('0x2e')](handleEntityNotFound(_0x950eed,null))['then'](removeEntity(_0x950eed,null))[_0xce76('0x37')](handleError(_0x950eed,null));};exports[_0xce76('0xba')]=function(_0x3219f1,_0x6d3b56){return db['OpenchannelInteraction'][_0xce76('0xba')]()[_0xce76('0x2e')](respondWithResult(_0x6d3b56,null))[_0xce76('0x37')](handleError(_0x6d3b56,null));};exports[_0xce76('0xbb')]=function(_0x20d309,_0x43180e,_0x2a0fc8){return db[_0xce76('0xbc')][_0xce76('0x62')]({'where':{'id':_0x20d309['params']['id']}})[_0xce76('0x2e')](handleEntityNotFound(_0x43180e,null))[_0xce76('0x2e')](function(_0x368a8f){if(_0x368a8f){return _0x368a8f[_0xce76('0xbb')](_0x20d309[_0xce76('0x76')][_0xce76('0xbd')],_['omit'](_0x20d309[_0xce76('0x76')],[_0xce76('0xbd'),'id'])||{});}})[_0xce76('0x2e')](respondWithResult(_0x43180e,null))[_0xce76('0x37')](handleError(_0x43180e,null));};exports[_0xce76('0xbe')]=function(_0x3cb9ff,_0x3b74b5,_0x5bc119){var _0x18f3be={'raw':![],'where':{}};var _0xf655f5={};var _0x1fc88a={'count':0x0,'rows':[]};return db[_0xce76('0xb6')][_0xce76('0xbf')]({'where':{'id':_0x3cb9ff[_0xce76('0xb5')]['id']}})[_0xce76('0x2e')](handleEntityNotFound(_0x3b74b5,null))['then'](function(_0x4e2eaf){if(_0x4e2eaf){_0xf655f5[_0xce76('0x41')]=_[_0xce76('0x3e')](db[_0xce76('0xbc')][_0xce76('0x39')]);_0xf655f5[_0xce76('0x3d')]=_[_0xce76('0x3e')](_0x3cb9ff[_0xce76('0x3d')]);_0xf655f5[_0xce76('0x3f')]=_[_0xce76('0x40')](_0xf655f5[_0xce76('0x41')],_0xf655f5[_0xce76('0x3d')]);_0x18f3be[_0xce76('0x42')]=_[_0xce76('0x40')](_0xf655f5[_0xce76('0x41')],qs[_0xce76('0x43')](_0x3cb9ff['query'][_0xce76('0x43')]));_0x18f3be['attributes']=_0x18f3be[_0xce76('0x42')]['length']?_0x18f3be['attributes']:_0xf655f5['model'];if(!_0x3cb9ff[_0xce76('0x3d')][_0xce76('0x45')](_0xce76('0x46'))){_0x18f3be[_0xce76('0x25')]=qs[_0xce76('0x25')](_0x3cb9ff[_0xce76('0x3d')][_0xce76('0x25')]);_0x18f3be[_0xce76('0x24')]=qs[_0xce76('0x24')](_0x3cb9ff['query'][_0xce76('0x24')]);}_0x18f3be[_0xce76('0x47')]=qs['sort'](_0x3cb9ff['query'][_0xce76('0x48')]);_0x18f3be['where']=qs[_0xce76('0x3f')](_[_0xce76('0x4a')](_0x3cb9ff[_0xce76('0x3d')],_0xf655f5[_0xce76('0x3f')]));_0x18f3be[_0xce76('0x49')][_0xce76('0xb2')]=_0x4e2eaf['id'];if(_0x3cb9ff[_0xce76('0x3d')]['filter']){_0x18f3be[_0xce76('0x49')]=_['merge'](_0x18f3be[_0xce76('0x49')],{'$or':_[_0xce76('0x31')](_0x18f3be['attributes'],function(_0x492140){var _0x2af045={};_0x2af045[_0x492140]={'$like':'%'+_0x3cb9ff['query'][_0xce76('0x87')]+'%'};return _0x2af045;})});}if(_0x3cb9ff[_0xce76('0x3d')][_0xce76('0x7e')]){var _0x47a57e=_0x3cb9ff[_0xce76('0x3d')][_0xce76('0x7e')][_0xce76('0x70')](',');var _0x2d6889={};_0x2d6889[_0x47a57e[0x0]]={'$gte':moment(_0x47a57e[0x1])['format'](_0xce76('0xc0'))};_0x18f3be[_0xce76('0x49')]=_[_0xce76('0x9e')](_0x18f3be[_0xce76('0x49')],_0x2d6889);}_0x18f3be=_['merge']({},_0x18f3be,_0x3cb9ff[_0xce76('0xb8')]);return db[_0xce76('0xbc')][_0xce76('0x26')]({'where':_0x18f3be[_0xce76('0x49')]})[_0xce76('0x2e')](function(_0x40cce6){_0x1fc88a[_0xce76('0x26')]=_0x40cce6;if(_0x3cb9ff[_0xce76('0x3d')][_0xce76('0xc1')]){_0x18f3be[_0xce76('0xb7')]=[{'all':!![]}];}return db[_0xce76('0xbc')][_0xce76('0xc2')](_0x18f3be);})['then'](function(_0xe78619){_0x1fc88a[_0xce76('0xb4')]=_0xe78619;return _0x1fc88a;});}})[_0xce76('0x2e')](respondWithFilteredResult(_0x3b74b5,_0x18f3be))[_0xce76('0x37')](handleError(_0x3b74b5,null));};exports[_0xce76('0xc3')]=function(_0x4958a2,_0x2718ff,_0x3e3d00){return db[_0xce76('0xb6')][_0xce76('0x62')]({'where':{'id':_0x4958a2['params']['id']}})['then'](handleEntityNotFound(_0x2718ff,null))[_0xce76('0x2e')](function(_0x38df45){if(_0x38df45){return _0x38df45[_0xce76('0xc4')](_0x4958a2[_0xce76('0x76')][_0xce76('0xbd')],_[_0xce76('0xc5')](_0x4958a2[_0xce76('0x76')],[_0xce76('0xbd'),'id'])||{})[_0xce76('0xc6')](function(){return db[_0xce76('0x6f')][_0xce76('0xc2')]({'attributes':['id',_0xce76('0x30'),_0xce76('0x4d')],'where':{'id':_0x4958a2[_0xce76('0x76')][_0xce76('0xbd')]}});})[_0xce76('0x2e')](function(_0x4280ec){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x4958a2[_0xce76('0xb5')]['id']),'tags':_0x4280ec||[]});return{'id':Number(_0x4958a2[_0xce76('0xb5')]['id']),'tags':_0x4280ec||[]};});}})[_0xce76('0x2e')](respondWithResult(_0x2718ff,null))[_0xce76('0x37')](handleError(_0x2718ff,null));};exports[_0xce76('0xc7')]=function(_0x26d099,_0x4de1ad,_0x578aa5){return db['OpenchannelInteraction'][_0xce76('0x62')]({'where':{'id':_0x26d099[_0xce76('0xb5')]['id']}})[_0xce76('0x2e')](handleEntityNotFound(_0x4de1ad,null))['then'](function(_0x3ac55c){if(_0x3ac55c){return _0x3ac55c[_0xce76('0xc7')](_0x26d099['query'][_0xce76('0xbd')]);}})[_0xce76('0x2e')](respondWithStatusCode(_0x4de1ad,null))['catch'](handleError(_0x4de1ad,null));};exports['download']=function(_0x124872,_0x19b577){var _0xcc320c=moment()['unix']()[_0xce76('0x9c')]();var _0x5c93b2=path[_0xce76('0xc8')](config[_0xce76('0xc9')],_0xce76('0xca'),_0xce76('0xcb'),_0xce76('0xcc'));var _0x1f3fa6=path[_0xce76('0xc8')](config[_0xce76('0xc9')],_0xce76('0xca'),'files','attachments');var _0x112e8b=path[_0xce76('0xc8')](_0x5c93b2,_0xcc320c);var _0x5172b4=util[_0xce76('0xcd')](_0xce76('0xce'),_0x124872[_0xce76('0xb5')]['id'],_0xcc320c);var _0x14a1e7=path[_0xce76('0xc8')](_0x5c93b2,_0x5172b4);var _0x316c99=[];_0x316c99[_0xce76('0x36')]({'model':db[_0xce76('0x73')],'as':'User','attributes':['id',_0xce76('0x32')],'raw':!![]});_0x316c99['push']({'model':db['CmContact'],'as':_0xce76('0xcf'),'attributes':['id',_0xce76('0xd0'),_0xce76('0xd1')],'raw':!![]});if(_0x124872[_0xce76('0x3d')][_0xce76('0xd2')]){_0x316c99[_0xce76('0x36')]({'model':db[_0xce76('0xd3')],'as':_0xce76('0xd3'),'raw':!![]});}var _0x27ce1d=[{'model':db[_0xce76('0xbc')],'as':_0xce76('0xd4'),'attributes':['id','body',_0xce76('0x7d'),_0xce76('0xd5'),_0xce76('0xd6'),_0xce76('0x84')],'include':_0x316c99}];_0x27ce1d[_0xce76('0x36')]({'model':db[_0xce76('0xd7')],'as':_0xce76('0xd8'),'attributes':['id',_0xce76('0x30')]});_0x27ce1d[_0xce76('0x36')]({'model':db[_0xce76('0x73')],'as':'Owner','attributes':['id',_0xce76('0x32')]});return db[_0xce76('0xb6')]['find']({'where':{'id':_0x124872[_0xce76('0xb5')]['id']},'include':_0x27ce1d})[_0xce76('0x2e')](handleEntityNotFound(_0x19b577,null))[_0xce76('0x2e')](function(_0x1ed198){if(_0x1ed198){var _0x4513aa=_0x1ed198['get']({'plain':!![]});fs['mkdirSync'](_0x112e8b);var _0x35565d={'channel':'Openchannel','account':_0x4513aa[_0xce76('0xd8')]['name'],'agent':_0x4513aa[_0xce76('0xd9')]?_0x4513aa[_0xce76('0xd9')][_0xce76('0x32')]:_0xce76('0xda'),'createdAt':moment(_0x4513aa[_0xce76('0x7d')])[_0xce76('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4513aa['closed']?moment(_0x4513aa['closedAt'])[_0xce76('0xcd')](_0xce76('0xc0'))[_0xce76('0x9c')]():'','disposition':_0x4513aa[_0xce76('0xdb')],'visibility':_0x4513aa[_0xce76('0xdc')]?_0xce76('0xdd'):'Private','messages':_(_0x4513aa[_0xce76('0xd4')])[_0xce76('0x87')]({'secret':![]})['map'](function(_0x485da3){if(_0x485da3[_0xce76('0xd3')]){var _0x4fe1f6=path[_0xce76('0xc8')](_0x1f3fa6,_0x485da3[_0xce76('0xd3')][_0xce76('0xde')]);if(fs['existsSync'](_0x4fe1f6)){fs[_0xce76('0xdf')](_0x4fe1f6)[_0xce76('0xe0')](fs[_0xce76('0xe1')](path[_0xce76('0xc8')](_0x112e8b,_0x485da3[_0xce76('0xd3')][_0xce76('0xde')])));}}return{'date':moment(_0x485da3[_0xce76('0x7d')])[_0xce76('0xcd')](_0xce76('0xc0'))[_0xce76('0x9c')](),'sender':_0x485da3[_0xce76('0xd5')]===_0xce76('0xe2')?_0x485da3[_0xce76('0x73')]?_0x485da3[_0xce76('0x73')][_0xce76('0x32')]:_0xce76('0xe3'):_0x485da3['Contact'][_0xce76('0xd0')]+(_0x485da3[_0xce76('0xcf')][_0xce76('0xd1')]?'\x20'+_0x485da3[_0xce76('0xcf')][_0xce76('0xd1')]:''),'body':_0x485da3[_0xce76('0xd3')]?_0x485da3['Attachment'][_0xce76('0xde')]:_0x485da3[_0xce76('0x76')],'direction':_0x485da3['direction']==='out'?'A':'C','secret':_0x485da3[_0xce76('0xd6')],'read':_0x485da3['read'],'attachment':_0x485da3[_0xce76('0xd3')]};})['value']()};return ejs[_0xce76('0xe4')](path[_0xce76('0xc8')](config['root'],_0xce76('0xca'),_0xce76('0xe5'),_0xce76('0xe6')),{'interaction':_0x35565d})[_0xce76('0x2e')](function(_0x476b56){var _0x430b66=path[_0xce76('0xc8')](_0x112e8b,_0xce76('0xe7')+_0x4513aa['id']+'-'+_0xcc320c+'.pdf');var _0x37ee3c={'path':_0x430b66,'channel':_0xce76('0xe8'),'interactionId':_0x4513aa['id']};return pdf[_0xce76('0xe9')](_0x476b56,_0x37ee3c);})[_0xce76('0x2e')](function(){return new BPromise(function(_0x40b54b,_0x189f75){zipdir(_0x112e8b,{'saveTo':_0x14a1e7},function(_0x47ede9,_0x47532c){if(_0x47ede9)return _0x189f75(_0x47ede9);return _0x40b54b(_0x47532c);});})[_0xce76('0x2e')](function(){return new BPromise(function(_0x1bac0a,_0x227c36){rimraf(_0x112e8b,function(_0x50e8da){if(_0x50e8da)_0x227c36(_0x50e8da);return _0x1bac0a();});});})['then'](function(){return _0x19b577[_0xce76('0xea')](_0x14a1e7,_0x5172b4,function(_0x379b0c){if(_0x379b0c){console['log'](_0xce76('0xeb'),_0x379b0c);}else{fs[_0xce76('0xec')](_0x14a1e7);}});});});}else{return _0x19b577['sendStatus'](0xc8);}})[_0xce76('0x37')](handleError(_0x19b577,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ce0ecf9..10b9b45 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 _0xe647=['setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','then'];(function(_0x1f1f3b,_0x227aa9){var _0x2e63aa=function(_0x165a34){while(--_0x165a34){_0x1f1f3b['push'](_0x1f1f3b['shift']());}};_0x2e63aa(++_0x227aa9);}(_0xe647,0xa8));var _0x7e64=function(_0x45f67a,_0x54d9be){_0x45f67a=_0x45f67a-0x0;var _0x1463d7=_0xe647[_0x45f67a];return _0x1463d7;};'use strict';var EventEmitter=require(_0x7e64('0x0'));var OpenchannelInteraction=require(_0x7e64('0x1'))['db'][_0x7e64('0x2')];var OpenchannelMessage=require(_0x7e64('0x1'))['db'][_0x7e64('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7e64('0x4')](0x0);var events={'afterCreate':_0x7e64('0x5'),'afterUpdate':_0x7e64('0x6'),'afterDestroy':'remove'};function emitEvent(_0x564c26){return function(_0x302453,_0x52408f,_0x52031f){_0x302453['getUsers']({'attributes':['id'],'raw':!![]})[_0x7e64('0x7')](function(_0x34e92c){_0x302453[_0x7e64('0x8')](_0x7e64('0x9'),_0x34e92c[_0x7e64('0xa')](function(_0x8d1358){return{'id':_0x8d1358['id']};}));return OpenchannelMessage[_0x7e64('0xb')]({'where':{'OpenchannelInteractionId':_0x302453['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7e64('0x7')](function(_0x11ded2){_0x302453[_0x7e64('0x8')](_0x7e64('0xc'),_0x11ded2[_0x7e64('0xd')]);OpenchannelInteractionEvents[_0x7e64('0xe')](_0x564c26+':'+_0x302453['id'],_0x302453);OpenchannelInteractionEvents[_0x7e64('0xe')](_0x564c26,_0x302453);_0x52031f(null);})['catch'](_0x52031f(null));};}for(var e in events){if(events[_0x7e64('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3774=['setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then'];(function(_0x14fdb2,_0x1da1e7){var _0x520738=function(_0x5a31fc){while(--_0x5a31fc){_0x14fdb2['push'](_0x14fdb2['shift']());}};_0x520738(++_0x1da1e7);}(_0x3774,0xcf));var _0x4377=function(_0x254849,_0x321ff6){_0x254849=_0x254849-0x0;var _0x4f73d1=_0x3774[_0x254849];return _0x4f73d1;};'use strict';var EventEmitter=require(_0x4377('0x0'));var OpenchannelInteraction=require(_0x4377('0x1'))['db'][_0x4377('0x2')];var OpenchannelMessage=require(_0x4377('0x1'))['db'][_0x4377('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4377('0x4'),'afterUpdate':_0x4377('0x5'),'afterDestroy':_0x4377('0x6')};function emitEvent(_0x520de0){return function(_0x48e001,_0xfbab0,_0x4cf16b){_0x48e001[_0x4377('0x7')]({'attributes':['id'],'raw':!![]})[_0x4377('0x8')](function(_0x387e1d){_0x48e001[_0x4377('0x9')]('Users',_0x387e1d[_0x4377('0xa')](function(_0x5b61a9){return{'id':_0x5b61a9['id']};}));return OpenchannelMessage[_0x4377('0xb')]({'where':{'OpenchannelInteractionId':_0x48e001['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x497c33){_0x48e001[_0x4377('0x9')]('unreadMessages',_0x497c33[_0x4377('0xc')]);OpenchannelInteractionEvents['emit'](_0x520de0+':'+_0x48e001['id'],_0x48e001);OpenchannelInteractionEvents[_0x4377('0xd')](_0x520de0,_0x48e001);_0x4cf16b(null);})[_0x4377('0xe')](_0x4cf16b(null));};}for(var e in events){if(events[_0x4377('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x4377('0x10')](e,emitEvent(event));}}module[_0x4377('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index af976c3..54f59a0 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 _0xa3e2=['exports','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes'];(function(_0x482743,_0x285f3f){var _0x315468=function(_0x5012a6){while(--_0x5012a6){_0x482743['push'](_0x482743['shift']());}};_0x315468(++_0x285f3f);}(_0xa3e2,0x75));var _0x2a3e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xa3e2[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x2a3e('0x0'));var logger=require(_0x2a3e('0x1'))(_0x2a3e('0x2'));var moment=require(_0x2a3e('0x3'));var BPromise=require(_0x2a3e('0x4'));var rp=require(_0x2a3e('0x5'));var fs=require('fs');var path=require(_0x2a3e('0x6'));var rimraf=require('rimraf');var config=require(_0x2a3e('0x7'));var attributes=require(_0x2a3e('0x8'));module[_0x2a3e('0x9')]=function(_0x354493,_0x3c48a2){return _0x354493['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a3e('0xa'),'collate':_0x2a3e('0xb'),'hooks':{'beforeUpdate':function(_0x40bff9,_0x4c7768,_0xcb9d3d){if(_0x40bff9[_0x2a3e('0xc')]('closed')){_0x40bff9[_0x2a3e('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xcb9d3d(null,_0x40bff9);}}});}; \ No newline at end of file +var _0x3dce=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','openchannel_interactions','utf8mb4_unicode_ci'];(function(_0xefae74,_0x5b110c){var _0x2fc009=function(_0x4ebf34){while(--_0x4ebf34){_0xefae74['push'](_0xefae74['shift']());}};_0x2fc009(++_0x5b110c);}(_0x3dce,0xc4));var _0xe3dc=function(_0x18a680,_0x22c66b){_0x18a680=_0x18a680-0x0;var _0x28fe0a=_0x3dce[_0x18a680];return _0x28fe0a;};'use strict';var _=require(_0xe3dc('0x0'));var util=require(_0xe3dc('0x1'));var logger=require(_0xe3dc('0x2'))(_0xe3dc('0x3'));var moment=require(_0xe3dc('0x4'));var BPromise=require(_0xe3dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3dc('0x6'));var rimraf=require('rimraf');var config=require(_0xe3dc('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xe3dc('0x8')]=function(_0x267ff0,_0x293a87){return _0x267ff0[_0xe3dc('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0xe3dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe3dc('0xb'),'hooks':{'beforeUpdate':function(_0x56e567,_0x55e62e,_0xe1f919){if(_0x56e567['changed'](_0xe3dc('0xc'))){_0x56e567[_0xe3dc('0xd')]=moment()[_0xe3dc('0xe')](_0xe3dc('0xf'));}_0xe1f919(null,_0x56e567);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 23f9bbc..c1dae4b 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 _0x6c54=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','where','attributes','stringify','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x6c54,0xeb));var _0x46c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c54[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x46c5('0x0'));var util=require(_0x46c5('0x1'));var moment=require(_0x46c5('0x2'));var BPromise=require(_0x46c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46c5('0x4'));var db=require(_0x46c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46c5('0x6'))(_0x46c5('0x7'));var config=require(_0x46c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46c5('0x9')][_0x46c5('0xa')]({'port':0x232a});config[_0x46c5('0xb')]=_[_0x46c5('0xc')](config['redis'],{'host':_0x46c5('0xd'),'port':0x18eb});var socket=require(_0x46c5('0xe'))(new Redis(config[_0x46c5('0xb')]));require(_0x46c5('0xf'))[_0x46c5('0x10')](socket);function respondWithRpcPromise(_0x4ccfbf,_0x4c53a7,_0x36c24b){return new BPromise(function(_0x324b9a,_0x7d07f5){return client[_0x46c5('0x11')](_0x4ccfbf,_0x36c24b)[_0x46c5('0x12')](function(_0x4e6d3e){logger[_0x46c5('0x13')](_0x46c5('0x14'),_0x4c53a7,'request\x20sent');logger[_0x46c5('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4c53a7,_0x46c5('0x16'),JSON['stringify'](_0x4e6d3e));if(_0x4e6d3e['error']){if(_0x4e6d3e[_0x46c5('0x17')][_0x46c5('0x18')]===0x1f4){logger[_0x46c5('0x17')](_0x46c5('0x14'),_0x4c53a7,_0x4e6d3e[_0x46c5('0x17')][_0x46c5('0x19')]);return _0x7d07f5(_0x4e6d3e[_0x46c5('0x17')][_0x46c5('0x19')]);}logger[_0x46c5('0x17')](_0x46c5('0x14'),_0x4c53a7,_0x4e6d3e[_0x46c5('0x17')][_0x46c5('0x19')]);return _0x324b9a(_0x4e6d3e[_0x46c5('0x17')]['message']);}else{logger[_0x46c5('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4c53a7,_0x46c5('0x16'));_0x324b9a(_0x4e6d3e['result'][_0x46c5('0x19')]);}})[_0x46c5('0x1a')](function(_0x4f5246){logger[_0x46c5('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4c53a7,_0x4f5246);_0x7d07f5(_0x4f5246);});});}exports[_0x46c5('0x1b')]=function(_0x556e4c){var _0x1bd3f0=this;return new Promise(function(_0x45fa51,_0x40cc84){return db[_0x46c5('0x1c')][_0x46c5('0x1d')](_0x556e4c['body'],{'raw':_0x556e4c['options']?_0x556e4c[_0x46c5('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x556e4c['options']?_0x556e4c[_0x46c5('0x1e')][_0x46c5('0x1f')]||null:null,'attributes':_0x556e4c[_0x46c5('0x1e')]?_0x556e4c[_0x46c5('0x1e')][_0x46c5('0x20')]||null:null,'limit':_0x556e4c[_0x46c5('0x1e')]?_0x556e4c[_0x46c5('0x1e')]['limit']||null:null})[_0x46c5('0x12')](function(_0x4ff5c5){logger[_0x46c5('0x13')](_0x46c5('0x1b'),_0x556e4c);logger[_0x46c5('0x15')](_0x46c5('0x1b'),_0x556e4c,JSON[_0x46c5('0x21')](_0x4ff5c5));_0x45fa51(_0x4ff5c5);})[_0x46c5('0x1a')](function(_0x23378a){logger[_0x46c5('0x17')](_0x46c5('0x1b'),_0x23378a[_0x46c5('0x19')],_0x556e4c);_0x40cc84(_0x1bd3f0['error'](0x1f4,_0x23378a[_0x46c5('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x5a2a9){return new Promise(function(_0x23dc17,_0x4f475a){return db[_0x46c5('0x1c')][_0x46c5('0x22')]({'where':_0x5a2a9[_0x46c5('0x1e')]?_0x5a2a9[_0x46c5('0x1e')]['where']||null:null})[_0x46c5('0x12')](function(_0x3e9986){if(_0x3e9986){return _0x3e9986[_0x46c5('0x23')](_0x5a2a9[_0x46c5('0x24')]['ids'],_[_0x46c5('0x25')](_0x5a2a9[_0x46c5('0x24')],[_0x46c5('0x26'),'id'])||{});}})[_0x46c5('0x27')](function(_0x1142db){logger[_0x46c5('0x13')](_0x46c5('0x28'),_0x5a2a9);logger[_0x46c5('0x15')](_0x46c5('0x28'),_0x5a2a9,JSON['stringify'](_0x1142db));_0x23dc17(_0x1142db);})['catch'](function(_0x751e69){logger['error'](_0x46c5('0x28'),_0x751e69[_0x46c5('0x19')],_0x5a2a9);_0x4f475a(_this[_0x46c5('0x17')](0x1f4,_0x751e69['message']));});});}; \ No newline at end of file +var _0x4288=['find','addTags','body','ids','spread','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateOpenchannelInteraction','update','options','raw','where','then','AddTagsToOpenchannelInteraction','OpenchannelInteraction'];(function(_0x4cf220,_0x2d9810){var _0x425c24=function(_0x52ba86){while(--_0x52ba86){_0x4cf220['push'](_0x4cf220['shift']());}};_0x425c24(++_0x2d9810);}(_0x4288,0x75));var _0x8428=function(_0x6f982a,_0x437009){_0x6f982a=_0x6f982a-0x0;var _0x46856c=_0x4288[_0x6f982a];return _0x46856c;};'use strict';var _=require('lodash');var util=require(_0x8428('0x0'));var moment=require(_0x8428('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8428('0x2'))['db'];var utils=require(_0x8428('0x3'));var logger=require(_0x8428('0x4'))(_0x8428('0x5'));var config=require('../../config/environment');var jayson=require(_0x8428('0x6'));var client=jayson[_0x8428('0x7')]['http']({'port':0x232a});config['redis']=_[_0x8428('0x8')](config[_0x8428('0x9')],{'host':_0x8428('0xa'),'port':0x18eb});var socket=require(_0x8428('0xb'))(new Redis(config['redis']));require(_0x8428('0xc'))['register'](socket);function respondWithRpcPromise(_0x53a9df,_0x164acc,_0x47f040){return new BPromise(function(_0x5823fa,_0x1f85dd){return client[_0x8428('0xd')](_0x53a9df,_0x47f040)['then'](function(_0x161d99){logger[_0x8428('0xe')](_0x8428('0xf'),_0x164acc,_0x8428('0x10'));logger[_0x8428('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x164acc,_0x8428('0x10'),JSON[_0x8428('0x12')](_0x161d99));if(_0x161d99[_0x8428('0x13')]){if(_0x161d99[_0x8428('0x13')]['code']===0x1f4){logger[_0x8428('0x13')](_0x8428('0xf'),_0x164acc,_0x161d99[_0x8428('0x13')][_0x8428('0x14')]);return _0x1f85dd(_0x161d99['error']['message']);}logger[_0x8428('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x164acc,_0x161d99['error'][_0x8428('0x14')]);return _0x5823fa(_0x161d99['error'][_0x8428('0x14')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x164acc,_0x8428('0x10'));_0x5823fa(_0x161d99[_0x8428('0x15')]['message']);}})[_0x8428('0x16')](function(_0x2cef6f){logger['error'](_0x8428('0xf'),_0x164acc,_0x2cef6f);_0x1f85dd(_0x2cef6f);});});}exports[_0x8428('0x17')]=function(_0x27dc62){var _0x54a536=this;return new Promise(function(_0x4a1e10,_0x3e69ab){return db['OpenchannelInteraction'][_0x8428('0x18')](_0x27dc62['body'],{'raw':_0x27dc62[_0x8428('0x19')]?_0x27dc62[_0x8428('0x19')][_0x8428('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27dc62[_0x8428('0x19')]?_0x27dc62['options'][_0x8428('0x1b')]||null:null,'attributes':_0x27dc62[_0x8428('0x19')]?_0x27dc62[_0x8428('0x19')]['attributes']||null:null,'limit':_0x27dc62[_0x8428('0x19')]?_0x27dc62[_0x8428('0x19')]['limit']||null:null})[_0x8428('0x1c')](function(_0x505e07){logger[_0x8428('0xe')](_0x8428('0x17'),_0x27dc62);logger[_0x8428('0x11')](_0x8428('0x17'),_0x27dc62,JSON[_0x8428('0x12')](_0x505e07));_0x4a1e10(_0x505e07);})[_0x8428('0x16')](function(_0x3ef076){logger[_0x8428('0x13')](_0x8428('0x17'),_0x3ef076['message'],_0x27dc62);_0x3e69ab(_0x54a536[_0x8428('0x13')](0x1f4,_0x3ef076[_0x8428('0x14')]));});});};exports[_0x8428('0x1d')]=function(_0x1e9d99){return new Promise(function(_0x1017b4,_0xd9737e){return db[_0x8428('0x1e')][_0x8428('0x1f')]({'where':_0x1e9d99['options']?_0x1e9d99[_0x8428('0x19')][_0x8428('0x1b')]||null:null})[_0x8428('0x1c')](function(_0x5d9fef){if(_0x5d9fef){return _0x5d9fef[_0x8428('0x20')](_0x1e9d99[_0x8428('0x21')][_0x8428('0x22')],_['omit'](_0x1e9d99[_0x8428('0x21')],['ids','id'])||{});}})[_0x8428('0x23')](function(_0x46ee85){logger[_0x8428('0xe')]('AddTags',_0x1e9d99);logger[_0x8428('0x11')](_0x8428('0x24'),_0x1e9d99,JSON[_0x8428('0x12')](_0x46ee85));_0x1017b4(_0x46ee85);})['catch'](function(_0x39985d){logger[_0x8428('0x13')](_0x8428('0x24'),_0x39985d[_0x8428('0x14')],_0x1e9d99);_0xd9737e(_this[_0x8428('0x13')](0x1f4,_0x39985d[_0x8428('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 21758fe..f058a98 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 _0x3200=['./openchannelInteraction.events','save','emit','removeListener','length','openchannelInteraction:'];(function(_0x5032ff,_0x4afe7b){var _0xcb088b=function(_0x46c10d){while(--_0x46c10d){_0x5032ff['push'](_0x5032ff['shift']());}};_0xcb088b(++_0x4afe7b);}(_0x3200,0x17a));var _0x0320=function(_0x67a7e9,_0x3557d9){_0x67a7e9=_0x67a7e9-0x0;var _0x1faa8b=_0x3200[_0x67a7e9];return _0x1faa8b;};'use strict';var OpenchannelInteractionEvents=require(_0x0320('0x0'));var events=[_0x0320('0x1'),'remove','update'];function createListener(_0x165521,_0x40bce2){return function(_0x1d51f7){_0x40bce2[_0x0320('0x2')](_0x165521,_0x1d51f7);};}function removeListener(_0x499f6a,_0x2e7c06){return function(){OpenchannelInteractionEvents[_0x0320('0x3')](_0x499f6a,_0x2e7c06);};}exports['register']=function(_0x555ad8){for(var _0x5f5669=0x0,_0x22a386=events[_0x0320('0x4')];_0x5f5669<_0x22a386;_0x5f5669++){var _0x51ebfe=events[_0x5f5669];var _0x1d64c0=createListener(_0x0320('0x5')+_0x51ebfe,_0x555ad8);OpenchannelInteractionEvents['on'](_0x51ebfe,_0x1d64c0);}}; \ No newline at end of file +var _0x5ff8=['update','removeListener','register','length','./openchannelInteraction.events','save','remove'];(function(_0x23fbef,_0x4e78b1){var _0x4d25bc=function(_0x90db93){while(--_0x90db93){_0x23fbef['push'](_0x23fbef['shift']());}};_0x4d25bc(++_0x4e78b1);}(_0x5ff8,0x13f));var _0x85ff=function(_0x3c597c,_0x224da9){_0x3c597c=_0x3c597c-0x0;var _0x9295fb=_0x5ff8[_0x3c597c];return _0x9295fb;};'use strict';var OpenchannelInteractionEvents=require(_0x85ff('0x0'));var events=[_0x85ff('0x1'),_0x85ff('0x2'),_0x85ff('0x3')];function createListener(_0x5bdd6b,_0x43ca27){return function(_0x399264){_0x43ca27['emit'](_0x5bdd6b,_0x399264);};}function removeListener(_0x1fdc8b,_0x26a2a8){return function(){OpenchannelInteractionEvents[_0x85ff('0x4')](_0x1fdc8b,_0x26a2a8);};}exports[_0x85ff('0x5')]=function(_0x116d6a){for(var _0x4c3581=0x0,_0x285c81=events[_0x85ff('0x6')];_0x4c3581<_0x285c81;_0x4c3581++){var _0x2fe0ea=events[_0x4c3581];var _0x16dd1a=createListener('openchannelInteraction:'+_0x2fe0ea,_0x116d6a);OpenchannelInteractionEvents['on'](_0x2fe0ea,_0x16dd1a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 489e53e..4958d38 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x400671,_0x429648){_0x400671=_0x400671-0x0;var _0x2dcd6c=_0x70e0[_0x400671];return _0x2dcd6c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +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(_0x5944bc,_0x2136e6){var _0x567aee=function(_0x48ac28){while(--_0x48ac28){_0x5944bc['push'](_0x5944bc['shift']());}};_0x567aee(++_0x2136e6);}(_0xe706,0xa3));var _0x6e70=function(_0x13be43,_0x1261e8){_0x13be43=_0x13be43-0x0;var _0x2b5d2f=_0xe706[_0x13be43];return _0x2b5d2f;};'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 aa65fd5..42f26a6 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 _0xf3aa=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x101c99,_0x27a8ed){var _0x250a4e=function(_0x662be4){while(--_0x662be4){_0x101c99['push'](_0x101c99['shift']());}};_0x250a4e(++_0x27a8ed);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x3fd737,_0x263d58){_0x3fd737=_0x3fd737-0x0;var _0x4b9e85=_0xf3aa[_0x3fd737];return _0x4b9e85;};'use strict';var Sequelize=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]={'body':{'type':Sequelize[_0xaf3a('0x2')](_0xaf3a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xaf3a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xaf3a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaf3a('0x6')]},'providerName':{'type':Sequelize[_0xaf3a('0x7')]},'providerResponse':{'type':Sequelize[_0xaf3a('0x2')]}}; \ No newline at end of file +var _0xa693=['BOOLEAN','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x4add00,_0x10e60e){var _0x1e9ecb=function(_0x28d104){while(--_0x28d104){_0x4add00['push'](_0x4add00['shift']());}};_0x1e9ecb(++_0x10e60e);}(_0xa693,0xf1));var _0x3a69=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xa693[_0x111e94];return _0x3de107;};'use strict';var Sequelize=require(_0x3a69('0x0'));module[_0x3a69('0x1')]={'body':{'type':Sequelize[_0x3a69('0x2')](_0x3a69('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3a69('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3a69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3a69('0x5')]},'providerName':{'type':Sequelize[_0x3a69('0x6')]},'providerResponse':{'type':Sequelize[_0x3a69('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c8703e3..286df2d 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 _0x1543=['RejectMessage','rejectMessage','sequelize','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','OpenchannelMessage','includeAll','findAll','catch','show','params','keys','length','include','options','find','create','body','destroy','describe','openchannel-interactions','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','format','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x24a0e6,_0x1746ed){var _0x2c425e=function(_0x5ea3fd){while(--_0x5ea3fd){_0x24a0e6['push'](_0x24a0e6['shift']());}};_0x2c425e(++_0x1746ed);}(_0x1543,0x109));var _0x3154=function(_0x5f409c,_0x163551){_0x5f409c=_0x5f409c-0x0;var _0x1791bc=_0x1543[_0x5f409c];return _0x1791bc;};'use strict';var emlformat=require(_0x3154('0x0'));var rimraf=require(_0x3154('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3154('0x2'));var rp=require(_0x3154('0x3'));var moment=require(_0x3154('0x4'));var BPromise=require(_0x3154('0x5'));var Mustache=require(_0x3154('0x6'));var util=require(_0x3154('0x7'));var path=require(_0x3154('0x8'));var sox=require(_0x3154('0x9'));var csv=require(_0x3154('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3154('0xb'));var _=require(_0x3154('0xc'));var squel=require(_0x3154('0xd'));var crypto=require('crypto');var jsforce=require(_0x3154('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3154('0xa'));var querystring=require(_0x3154('0xf'));var Papa=require(_0x3154('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3154('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3154('0x12'))(_0x3154('0x13'));var utils=require(_0x3154('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3154('0x15'));var db=require(_0x3154('0x16'))['db'];config[_0x3154('0x17')]=_[_0x3154('0x18')](config[_0x3154('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3154('0x19'))(new Redis(config[_0x3154('0x17')]));require(_0x3154('0x1a'))[_0x3154('0x1b')](socket);var jayson=require(_0x3154('0x1c'));var client=jayson['client'][_0x3154('0x1d')]({'port':0x232c});var client9002=jayson[_0x3154('0x1e')][_0x3154('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4eb22f,_0x3be9a0,_0x24f625,_0x3cd4f6){return new BPromise(function(_0x3d2953,_0x146214){var _0x3c3953=_0x3cd4f6||client;return _0x3c3953[_0x3154('0x1f')](_0x4eb22f,_0x24f625)['then'](function(_0x1b0c47){logger['info'](_0x3154('0x20'),_0x3be9a0,_0x3154('0x21'));logger[_0x3154('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3be9a0,_0x3154('0x21'),JSON[_0x3154('0x23')](_0x1b0c47));if(_0x1b0c47[_0x3154('0x24')]){if(_0x1b0c47[_0x3154('0x24')][_0x3154('0x25')]===0x1f4){logger[_0x3154('0x24')](_0x3154('0x20'),_0x3be9a0,_0x1b0c47[_0x3154('0x24')][_0x3154('0x26')]);return _0x146214(_0x1b0c47[_0x3154('0x24')][_0x3154('0x26')]);}logger[_0x3154('0x24')](_0x3154('0x20'),_0x3be9a0,_0x1b0c47['error'][_0x3154('0x26')]);return _0x3d2953(_0x1b0c47[_0x3154('0x24')][_0x3154('0x26')]);}else{logger[_0x3154('0x27')](_0x3154('0x20'),_0x3be9a0,'request\x20sent');_0x3d2953(_0x1b0c47[_0x3154('0x28')][_0x3154('0x26')]);}})['catch'](function(_0x1b0697){logger[_0x3154('0x24')](_0x3154('0x20'),_0x3be9a0,_0x1b0697);_0x146214(_0x1b0697);});});}function respondWithStatusCode(_0x38e224,_0x106e5c){_0x106e5c=_0x106e5c||0xcc;return function(_0xb75caf){if(_0xb75caf){return _0x38e224[_0x3154('0x29')](_0x106e5c);}return _0x38e224[_0x3154('0x2a')](_0x106e5c)[_0x3154('0x2b')]();};}function respondWithResult(_0x3abb0,_0x5cbad7){_0x5cbad7=_0x5cbad7||0xc8;return function(_0x4ed309){if(_0x4ed309){return _0x3abb0[_0x3154('0x2a')](_0x5cbad7)[_0x3154('0x2c')](_0x4ed309);}};}function respondWithFilteredResult(_0xfec9da,_0x20131d){return function(_0x49c284){if(_0x49c284){var _0x36a805=typeof _0x20131d[_0x3154('0x2d')]===_0x3154('0x2e')&&typeof _0x20131d[_0x3154('0x2f')]===_0x3154('0x2e');var _0x1425c7=_0x49c284[_0x3154('0x30')];var _0x42c184=_0x36a805?0x0:_0x20131d[_0x3154('0x2d')];var _0x4bbbd4=_0x36a805?_0x49c284[_0x3154('0x30')]:_0x20131d[_0x3154('0x2d')]+_0x20131d['limit'];var _0x5b9acd;if(_0x4bbbd4>=_0x1425c7){_0x4bbbd4=_0x1425c7;_0x5b9acd=0xc8;}else{_0x5b9acd=0xce;}_0xfec9da[_0x3154('0x2a')](_0x5b9acd);return _0xfec9da[_0x3154('0x31')](_0x3154('0x32'),_0x42c184+'-'+_0x4bbbd4+'/'+_0x1425c7)['json'](_0x49c284);}return null;};}function patchUpdates(_0x27ab82){return function(_0x36997a){try{jsonpatch['apply'](_0x36997a,_0x27ab82,!![]);}catch(_0x3e5eb1){return BPromise[_0x3154('0x33')](_0x3e5eb1);}return _0x36997a[_0x3154('0x34')]();};}function saveUpdates(_0x3150eb,_0x5c1472){return function(_0x342915){if(_0x342915){return _0x342915[_0x3154('0x35')](_0x3150eb)['then'](function(_0x37c7ef){return _0x37c7ef;});}return null;};}function removeEntity(_0x2bc743,_0x3e95c1){return function(_0xac897c){if(_0xac897c){return _0xac897c['destroy']()[_0x3154('0x36')](function(){_0x2bc743['status'](0xcc)[_0x3154('0x2b')]();});}};}function handleEntityNotFound(_0x32fbb2,_0x3bc81b){return function(_0x1955f4){if(!_0x1955f4){_0x32fbb2['sendStatus'](0x194);}return _0x1955f4;};}function handleError(_0x1e0902,_0x32b742){_0x32b742=_0x32b742||0x1f4;return function(_0x3f20a8){logger[_0x3154('0x24')](_0x3f20a8[_0x3154('0x37')]);if(_0x3f20a8['name']){delete _0x3f20a8[_0x3154('0x38')];}_0x1e0902[_0x3154('0x2a')](_0x32b742)[_0x3154('0x39')](_0x3f20a8);};}exports[_0x3154('0x3a')]=function(_0x3ad99a,_0x5452e1){var _0x2a31ed={},_0x36a7ec={},_0x100c89={'count':0x0,'rows':[]};var _0x4ce719=_['map'](db['OpenchannelMessage'][_0x3154('0x3b')],function(_0x123ddc){return{'name':_0x123ddc[_0x3154('0x3c')],'type':_0x123ddc['type']['key']};});_0x36a7ec[_0x3154('0x3d')]=_[_0x3154('0x3e')](_0x4ce719,'name');_0x36a7ec[_0x3154('0x3f')]=_['keys'](_0x3ad99a['query']);_0x36a7ec[_0x3154('0x40')]=_[_0x3154('0x41')](_0x36a7ec[_0x3154('0x3d')],_0x36a7ec[_0x3154('0x3f')]);_0x2a31ed['attributes']=_[_0x3154('0x41')](_0x36a7ec[_0x3154('0x3d')],qs[_0x3154('0x42')](_0x3ad99a['query']['fields']));_0x2a31ed[_0x3154('0x43')]=_0x2a31ed['attributes']['length']?_0x2a31ed[_0x3154('0x43')]:_0x36a7ec[_0x3154('0x3d')];if(!_0x3ad99a[_0x3154('0x3f')][_0x3154('0x44')](_0x3154('0x45'))){_0x2a31ed['limit']=qs[_0x3154('0x2f')](_0x3ad99a['query'][_0x3154('0x2f')]);_0x2a31ed['offset']=qs[_0x3154('0x2d')](_0x3ad99a[_0x3154('0x3f')][_0x3154('0x2d')]);}_0x2a31ed['order']=qs[_0x3154('0x46')](_0x3ad99a[_0x3154('0x3f')][_0x3154('0x46')]);_0x2a31ed[_0x3154('0x47')]=qs[_0x3154('0x40')](_[_0x3154('0x48')](_0x3ad99a[_0x3154('0x3f')],_0x36a7ec[_0x3154('0x40')]),_0x4ce719);if(_0x3ad99a[_0x3154('0x3f')][_0x3154('0x49')]){_0x2a31ed['where']=_['merge'](_0x2a31ed['where'],{'$or':_[_0x3154('0x3e')](_0x4ce719,function(_0x2bc5c2){if(_0x2bc5c2[_0x3154('0x4a')]!==_0x3154('0x4b')){var _0x42bf80={};_0x42bf80[_0x2bc5c2[_0x3154('0x38')]]={'$like':'%'+_0x3ad99a[_0x3154('0x3f')]['filter']+'%'};return _0x42bf80;}})});}_0x2a31ed=_[_0x3154('0x4c')]({},_0x2a31ed,_0x3ad99a['options']);var _0x546124={'where':_0x2a31ed[_0x3154('0x47')]};return db[_0x3154('0x4d')][_0x3154('0x30')](_0x546124)[_0x3154('0x36')](function(_0x589852){_0x100c89[_0x3154('0x30')]=_0x589852;if(_0x3ad99a['query'][_0x3154('0x4e')]){_0x2a31ed['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3154('0x4f')](_0x2a31ed);})['then'](function(_0x4a8a2a){_0x100c89['rows']=_0x4a8a2a;return _0x100c89;})[_0x3154('0x36')](respondWithFilteredResult(_0x5452e1,_0x2a31ed))[_0x3154('0x50')](handleError(_0x5452e1,null));};exports[_0x3154('0x51')]=function(_0x453eec,_0x3adab3){var _0x2c4d12={'raw':!![],'where':{'id':_0x453eec[_0x3154('0x52')]['id']}},_0xa3cdfc={};_0xa3cdfc[_0x3154('0x3d')]=_['keys'](db[_0x3154('0x4d')][_0x3154('0x3b')]);_0xa3cdfc[_0x3154('0x3f')]=_[_0x3154('0x53')](_0x453eec['query']);_0xa3cdfc[_0x3154('0x40')]=_[_0x3154('0x41')](_0xa3cdfc[_0x3154('0x3d')],_0xa3cdfc[_0x3154('0x3f')]);_0x2c4d12[_0x3154('0x43')]=_['intersection'](_0xa3cdfc['model'],qs[_0x3154('0x42')](_0x453eec[_0x3154('0x3f')][_0x3154('0x42')]));_0x2c4d12[_0x3154('0x43')]=_0x2c4d12['attributes'][_0x3154('0x54')]?_0x2c4d12[_0x3154('0x43')]:_0xa3cdfc['model'];if(_0x453eec['query']['includeAll']){_0x2c4d12[_0x3154('0x55')]=[{'all':!![]}];}_0x2c4d12=_['merge']({},_0x2c4d12,_0x453eec[_0x3154('0x56')]);return db['OpenchannelMessage'][_0x3154('0x57')](_0x2c4d12)['then'](handleEntityNotFound(_0x3adab3,null))['then'](respondWithResult(_0x3adab3,null))[_0x3154('0x50')](handleError(_0x3adab3,null));};exports[_0x3154('0x58')]=function(_0x5a41ac,_0x3f06a2){return db[_0x3154('0x4d')]['create'](_0x5a41ac['body'],{})['then'](respondWithResult(_0x3f06a2,0xc9))[_0x3154('0x50')](handleError(_0x3f06a2,null));};exports['update']=function(_0xfa7558,_0x4b2ca1){if(_0xfa7558['body']['id']){delete _0xfa7558[_0x3154('0x59')]['id'];}return db[_0x3154('0x4d')][_0x3154('0x57')]({'where':{'id':_0xfa7558[_0x3154('0x52')]['id']}})[_0x3154('0x36')](handleEntityNotFound(_0x4b2ca1,null))['then'](saveUpdates(_0xfa7558[_0x3154('0x59')],null))[_0x3154('0x36')](respondWithResult(_0x4b2ca1,null))['catch'](handleError(_0x4b2ca1,null));};exports[_0x3154('0x5a')]=function(_0x30aa50,_0xef1f2f){return db[_0x3154('0x4d')][_0x3154('0x57')]({'where':{'id':_0x30aa50[_0x3154('0x52')]['id']}})['then'](handleEntityNotFound(_0xef1f2f,null))[_0x3154('0x36')](removeEntity(_0xef1f2f,null))[_0x3154('0x50')](handleError(_0xef1f2f,null));};exports[_0x3154('0x5b')]=function(_0x2ec608,_0x502420){return db[_0x3154('0x4d')]['describe']()[_0x3154('0x36')](respondWithResult(_0x502420,null))['catch'](handleError(_0x502420,null));};var interaction_log=require('../../config/logger')(_0x3154('0x5c'));exports[_0x3154('0x5d')]=function(_0x4de449,_0x3cf90c,_0x5d92e9){var _0x3bdccc={'agent':{},'channel':'openchannel'};if(_0x4de449['body']['id']){delete _0x4de449[_0x3154('0x59')]['id'];}_0x4de449[_0x3154('0x59')]['read']=!![];_0x4de449['body']['readAt']=moment()['format'](_0x3154('0x5e'));_0x4de449[_0x3154('0x59')][_0x3154('0x5f')]=_0x4de449[_0x3154('0x59')][_0x3154('0x5f')]||_0x4de449[_0x3154('0x60')]['id'];_0x3bdccc[_0x3154('0x61')]['id']=_0x4de449[_0x3154('0x59')]['UserId'];return db['OpenchannelMessage'][_0x3154('0x57')]({'where':{'id':_0x4de449['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3cf90c,null))[_0x3154('0x36')](saveUpdates(_0x4de449[_0x3154('0x59')],null))[_0x3154('0x36')](function(_0x4f465f){if(_0x4f465f){_0x3bdccc['message']=_0x4f465f[_0x3154('0x62')]({'plain':!![]});return db[_0x3154('0x63')]['find']({'where':{'id':_0x4f465f['OpenchannelInteractionId']}});}return null;})[_0x3154('0x36')](handleEntityNotFound(_0x3cf90c,null))[_0x3154('0x36')](function(_0x1e0c09){if(_0x1e0c09){return _0x1e0c09[_0x3154('0x35')]({'UserId':_0x4de449[_0x3154('0x59')][_0x3154('0x5f')],'read1stAt':_[_0x3154('0x64')](_0x1e0c09['read1stAt'])?moment()[_0x3154('0x65')](_0x3154('0x5e')):undefined});}return null;})['then'](function(_0x4cda90){if(_0x4cda90){_0x3bdccc[_0x3154('0x66')]=_0x4cda90[_0x3154('0x62')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4de449[_0x3154('0x60')]['id'],_0x4de449[_0x3154('0x60')][_0x3154('0x38')],_0x4de449[_0x3154('0x60')]['role'],_0x3bdccc[_0x3154('0x66')]['id'],_0x4de449['body']?JSON[_0x3154('0x23')](_0x4de449[_0x3154('0x59')]):_0x3154('0x67'));return respondWithRpcPromise(_0x3154('0x68'),_0x3154('0x69'),_0x3bdccc);}return null;})[_0x3154('0x36')](function(_0x5f1267){var _0x56aeca=_0x3154('0x6a')+_0x5f1267[_0x3154('0x26')][_0x3154('0x6b')];return db['sequelize']['query'](_0x56aeca,{'type':db[_0x3154('0x6c')][_0x3154('0x6d')][_0x3154('0x6e')],'raw':!![]})[_0x3154('0x36')](function(_0x4ac812){return _0x4ac812;});})[_0x3154('0x36')](function(_0x4d3cb2){if(_0x4d3cb2){_0x3bdccc['message'][_0x3154('0x6f')]=_0x4d3cb2[0x0];if(!_0x4de449[_0x3154('0x59')][_0x3154('0x5f')])return;return db[_0x3154('0x70')]['find']({'where':{'id':_0x4de449[_0x3154('0x59')][_0x3154('0x5f')],'role':_0x3154('0x61')},'attributes':['id',_0x3154('0x38'),_0x3154('0x71'),_0x3154('0x72'),_0x3154('0x73')],'raw':!![]});}return null;})[_0x3154('0x36')](function(_0x2b92bf){if(!_0x2b92bf)return null;_0x3bdccc['message']['agent']=_0x2b92bf;return _0x3bdccc;})['then'](function(_0xe56d13){if(_0xe56d13){if(_0x4de449[_0x3154('0x59')][_0x3154('0x74')]){_0x3bdccc[_0x3154('0x26')][_0x3154('0x75')]=util[_0x3154('0x65')]('SIP/%s',_0x4de449[_0x3154('0x60')]['name']);_0x3bdccc[_0x3154('0x26')][_0x3154('0x76')]=_0x3bdccc[_0x3154('0x76')];_0x3bdccc[_0x3154('0x26')]['motionChannel']=_0x3bdccc['channel'];_0x3bdccc[_0x3154('0x26')][_0x3154('0x77')]='accept';return respondWithRpcPromise(_0x3154('0x78'),_0x3154('0x78'),{'event':_0x3154('0x79'),'message':_0x3bdccc[_0x3154('0x26')]},client9002)['then'](function(){return _0x3bdccc;});}return _0x3bdccc;}return null;})[_0x3154('0x36')](respondWithResult(_0x3cf90c,null))[_0x3154('0x50')](handleError(_0x3cf90c,null));};var interaction_log=require(_0x3154('0x12'))(_0x3154('0x5c'));exports[_0x3154('0x33')]=function(_0x39c060,_0x2947cc,_0x69e091){var _0x444efc={'agent':{},'channel':'openchannel'};if(_0x39c060[_0x3154('0x59')]['id']){delete _0x39c060['body']['id'];}_0x39c060[_0x3154('0x59')]['UserId']=_0x39c060['body'][_0x3154('0x5f')]||_0x39c060[_0x3154('0x60')]['id'];_0x444efc[_0x3154('0x61')]['id']=_0x39c060[_0x3154('0x59')][_0x3154('0x5f')];return db['OpenchannelMessage'][_0x3154('0x57')]({'where':{'id':_0x39c060[_0x3154('0x52')]['id'],'UserId':null}})[_0x3154('0x36')](handleEntityNotFound(_0x2947cc,null))[_0x3154('0x36')](function(_0xb1723d){if(_0xb1723d){_0x444efc[_0x3154('0x26')]=_0xb1723d[_0x3154('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3154('0x57')]({'where':{'id':_0xb1723d[_0x3154('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x2947cc,null))[_0x3154('0x36')](function(_0x579f5d){if(_0x579f5d){_0x444efc[_0x3154('0x66')]=_0x579f5d[_0x3154('0x62')]({'plain':!![]});interaction_log[_0x3154('0x27')](_0x3154('0x7b'),_0x39c060['user']['id'],_0x39c060[_0x3154('0x60')][_0x3154('0x38')],_0x39c060[_0x3154('0x60')][_0x3154('0x7c')],_0x444efc[_0x3154('0x66')]['id'],_0x39c060[_0x3154('0x59')]?JSON['stringify'](_0x39c060[_0x3154('0x59')]):'null');return respondWithRpcPromise(_0x3154('0x7d'),_0x3154('0x7e'),_0x444efc);}return null;})[_0x3154('0x36')](function(_0x2eb267){var _0x1c6ea6=_0x3154('0x6a')+_0x2eb267[_0x3154('0x26')][_0x3154('0x6b')];return db[_0x3154('0x7f')][_0x3154('0x3f')](_0x1c6ea6,{'type':db[_0x3154('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3154('0x36')](function(_0x194ba3){return _0x194ba3;});})[_0x3154('0x36')](function(_0x40f982){if(_0x40f982){_0x444efc['message'][_0x3154('0x6f')]=_0x40f982[0x0];if(!_0x39c060[_0x3154('0x59')][_0x3154('0x5f')])return;return db[_0x3154('0x70')][_0x3154('0x57')]({'where':{'id':_0x39c060['body'][_0x3154('0x5f')],'role':_0x3154('0x61')},'attributes':['id',_0x3154('0x38'),_0x3154('0x71'),_0x3154('0x72'),'internal'],'raw':!![]});}return null;})[_0x3154('0x36')](function(_0x333632){if(!_0x333632)return null;_0x444efc['message'][_0x3154('0x61')]=_0x333632;return _0x444efc;})[_0x3154('0x36')](function(_0x2ce231){if(_0x2ce231){_0x2ce231[_0x3154('0x26')][_0x3154('0x75')]=util[_0x3154('0x65')](_0x3154('0x80'),_0x39c060[_0x3154('0x60')][_0x3154('0x38')]);_0x2ce231[_0x3154('0x26')][_0x3154('0x76')]=_0x444efc[_0x3154('0x76')];_0x2ce231[_0x3154('0x26')]['motionChannel']=_0x444efc[_0x3154('0x76')];_0x2ce231['message'][_0x3154('0x77')]=_0x3154('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0x3154('0x81'),'message':_0x2ce231[_0x3154('0x26')]},client9002);return _0x444efc;}return null;})[_0x3154('0x36')](respondWithResult(_0x2947cc,null))['catch'](handleError(_0x2947cc,null));}; \ No newline at end of file +var _0x3809=['map','OpenchannelMessage','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','where','pick','filter','merge','options','rows','show','includeAll','include','find','create','body','params','destroy','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','Sequelize','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','name','send','index'];(function(_0x491cb9,_0x37c22c){var _0x1e761a=function(_0x181b22){while(--_0x181b22){_0x491cb9['push'](_0x491cb9['shift']());}};_0x1e761a(++_0x37c22c);}(_0x3809,0xca));var _0x9380=function(_0x11d671,_0x311054){_0x11d671=_0x11d671-0x0;var _0x57af9e=_0x3809[_0x11d671];return _0x57af9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9380('0x0'));var zipdir=require(_0x9380('0x1'));var jsonpatch=require(_0x9380('0x2'));var rp=require('request-promise');var moment=require(_0x9380('0x3'));var BPromise=require(_0x9380('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9380('0x5'));var sox=require(_0x9380('0x6'));var csv=require(_0x9380('0x7'));var ejs=require(_0x9380('0x8'));var fs=require('fs');var fs_extra=require(_0x9380('0x9'));var _=require(_0x9380('0xa'));var squel=require(_0x9380('0xb'));var crypto=require(_0x9380('0xc'));var jsforce=require(_0x9380('0xd'));var deskjs=require(_0x9380('0xe'));var toCsv=require(_0x9380('0x7'));var querystring=require('querystring');var Papa=require(_0x9380('0xf'));var Redis=require(_0x9380('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9380('0x11'));var as=require(_0x9380('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9380('0x13'))('api');var utils=require(_0x9380('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9380('0x15'));var db=require(_0x9380('0x16'))['db'];config[_0x9380('0x17')]=_[_0x9380('0x18')](config[_0x9380('0x17')],{'host':_0x9380('0x19'),'port':0x18eb});var socket=require(_0x9380('0x1a'))(new Redis(config[_0x9380('0x17')]));require(_0x9380('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9380('0x1c')][_0x9380('0x1d')]({'port':0x232c});var client9002=jayson[_0x9380('0x1c')][_0x9380('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2bdc45,_0x4fdef6,_0x4c2e9b,_0x2766d2){return new BPromise(function(_0x3e0911,_0x59ad8e){var _0x4d0cbc=_0x2766d2||client;return _0x4d0cbc[_0x9380('0x1e')](_0x2bdc45,_0x4c2e9b)[_0x9380('0x1f')](function(_0x7ed0c5){logger[_0x9380('0x20')](_0x9380('0x21'),_0x4fdef6,'request\x20sent');logger[_0x9380('0x22')](_0x9380('0x23'),_0x4fdef6,_0x9380('0x24'),JSON[_0x9380('0x25')](_0x7ed0c5));if(_0x7ed0c5[_0x9380('0x26')]){if(_0x7ed0c5[_0x9380('0x26')]['code']===0x1f4){logger['error'](_0x9380('0x21'),_0x4fdef6,_0x7ed0c5[_0x9380('0x26')][_0x9380('0x27')]);return _0x59ad8e(_0x7ed0c5['error'][_0x9380('0x27')]);}logger[_0x9380('0x26')](_0x9380('0x21'),_0x4fdef6,_0x7ed0c5[_0x9380('0x26')]['message']);return _0x3e0911(_0x7ed0c5[_0x9380('0x26')][_0x9380('0x27')]);}else{logger[_0x9380('0x20')](_0x9380('0x21'),_0x4fdef6,_0x9380('0x24'));_0x3e0911(_0x7ed0c5[_0x9380('0x28')][_0x9380('0x27')]);}})[_0x9380('0x29')](function(_0x34bd9d){logger[_0x9380('0x26')](_0x9380('0x21'),_0x4fdef6,_0x34bd9d);_0x59ad8e(_0x34bd9d);});});}function respondWithStatusCode(_0x525456,_0x7dedf){_0x7dedf=_0x7dedf||0xcc;return function(_0x4d852a){if(_0x4d852a){return _0x525456[_0x9380('0x2a')](_0x7dedf);}return _0x525456[_0x9380('0x2b')](_0x7dedf)[_0x9380('0x2c')]();};}function respondWithResult(_0x43840b,_0x1a6c10){_0x1a6c10=_0x1a6c10||0xc8;return function(_0x4e8e7b){if(_0x4e8e7b){return _0x43840b[_0x9380('0x2b')](_0x1a6c10)[_0x9380('0x2d')](_0x4e8e7b);}};}function respondWithFilteredResult(_0x27a95c,_0x322c73){return function(_0x5daa36){if(_0x5daa36){var _0x2258bc=typeof _0x322c73[_0x9380('0x2e')]===_0x9380('0x2f')&&typeof _0x322c73['limit']==='undefined';var _0xd8db52=_0x5daa36[_0x9380('0x30')];var _0x2e0112=_0x2258bc?0x0:_0x322c73[_0x9380('0x2e')];var _0xc3adaa=_0x2258bc?_0x5daa36[_0x9380('0x30')]:_0x322c73[_0x9380('0x2e')]+_0x322c73[_0x9380('0x31')];var _0x34bbe2;if(_0xc3adaa>=_0xd8db52){_0xc3adaa=_0xd8db52;_0x34bbe2=0xc8;}else{_0x34bbe2=0xce;}_0x27a95c['status'](_0x34bbe2);return _0x27a95c[_0x9380('0x32')](_0x9380('0x33'),_0x2e0112+'-'+_0xc3adaa+'/'+_0xd8db52)[_0x9380('0x2d')](_0x5daa36);}return null;};}function patchUpdates(_0x289436){return function(_0x50b4bd){try{jsonpatch[_0x9380('0x34')](_0x50b4bd,_0x289436,!![]);}catch(_0x3949d5){return BPromise[_0x9380('0x35')](_0x3949d5);}return _0x50b4bd['save']();};}function saveUpdates(_0x548faa,_0x525148){return function(_0x4f1fb2){if(_0x4f1fb2){return _0x4f1fb2[_0x9380('0x36')](_0x548faa)[_0x9380('0x1f')](function(_0x281340){return _0x281340;});}return null;};}function removeEntity(_0x1bd04a,_0x21ed33){return function(_0x3fc711){if(_0x3fc711){return _0x3fc711['destroy']()['then'](function(){_0x1bd04a['status'](0xcc)[_0x9380('0x2c')]();});}};}function handleEntityNotFound(_0x9f98e9,_0x35e80c){return function(_0xcad87a){if(!_0xcad87a){_0x9f98e9['sendStatus'](0x194);}return _0xcad87a;};}function handleError(_0x593827,_0x3bd904){_0x3bd904=_0x3bd904||0x1f4;return function(_0x5d7873){logger[_0x9380('0x26')](_0x5d7873['stack']);if(_0x5d7873[_0x9380('0x37')]){delete _0x5d7873[_0x9380('0x37')];}_0x593827['status'](_0x3bd904)[_0x9380('0x38')](_0x5d7873);};}exports[_0x9380('0x39')]=function(_0x13afa5,_0x5da931){var _0x6661af={},_0x524bb7={},_0x450931={'count':0x0,'rows':[]};var _0x57319e=_[_0x9380('0x3a')](db[_0x9380('0x3b')][_0x9380('0x3c')],function(_0x4210d3){return{'name':_0x4210d3['fieldName'],'type':_0x4210d3[_0x9380('0x3d')][_0x9380('0x3e')]};});_0x524bb7['model']=_['map'](_0x57319e,_0x9380('0x37'));_0x524bb7[_0x9380('0x3f')]=_[_0x9380('0x40')](_0x13afa5[_0x9380('0x3f')]);_0x524bb7[_0x9380('0x41')]=_['intersection'](_0x524bb7[_0x9380('0x42')],_0x524bb7[_0x9380('0x3f')]);_0x6661af[_0x9380('0x43')]=_[_0x9380('0x44')](_0x524bb7[_0x9380('0x42')],qs[_0x9380('0x45')](_0x13afa5[_0x9380('0x3f')][_0x9380('0x45')]));_0x6661af[_0x9380('0x43')]=_0x6661af[_0x9380('0x43')][_0x9380('0x46')]?_0x6661af['attributes']:_0x524bb7['model'];if(!_0x13afa5[_0x9380('0x3f')]['hasOwnProperty']('nolimit')){_0x6661af[_0x9380('0x31')]=qs['limit'](_0x13afa5['query'][_0x9380('0x31')]);_0x6661af[_0x9380('0x2e')]=qs[_0x9380('0x2e')](_0x13afa5[_0x9380('0x3f')][_0x9380('0x2e')]);}_0x6661af[_0x9380('0x47')]=qs['sort'](_0x13afa5[_0x9380('0x3f')]['sort']);_0x6661af[_0x9380('0x48')]=qs['filters'](_[_0x9380('0x49')](_0x13afa5[_0x9380('0x3f')],_0x524bb7[_0x9380('0x41')]),_0x57319e);if(_0x13afa5['query'][_0x9380('0x4a')]){_0x6661af['where']=_[_0x9380('0x4b')](_0x6661af[_0x9380('0x48')],{'$or':_['map'](_0x57319e,function(_0xf861d8){if(_0xf861d8[_0x9380('0x3d')]!=='VIRTUAL'){var _0x10ec3f={};_0x10ec3f[_0xf861d8[_0x9380('0x37')]]={'$like':'%'+_0x13afa5[_0x9380('0x3f')][_0x9380('0x4a')]+'%'};return _0x10ec3f;}})});}_0x6661af=_[_0x9380('0x4b')]({},_0x6661af,_0x13afa5[_0x9380('0x4c')]);var _0x5d3315={'where':_0x6661af['where']};return db[_0x9380('0x3b')][_0x9380('0x30')](_0x5d3315)[_0x9380('0x1f')](function(_0x41ee4f){_0x450931['count']=_0x41ee4f;if(_0x13afa5[_0x9380('0x3f')]['includeAll']){_0x6661af['include']=[{'all':!![]}];}return db[_0x9380('0x3b')]['findAll'](_0x6661af);})['then'](function(_0x3357bb){_0x450931[_0x9380('0x4d')]=_0x3357bb;return _0x450931;})[_0x9380('0x1f')](respondWithFilteredResult(_0x5da931,_0x6661af))[_0x9380('0x29')](handleError(_0x5da931,null));};exports[_0x9380('0x4e')]=function(_0xf91c39,_0x5d1075){var _0x45096f={'raw':!![],'where':{'id':_0xf91c39['params']['id']}},_0x17b73d={};_0x17b73d['model']=_[_0x9380('0x40')](db[_0x9380('0x3b')][_0x9380('0x3c')]);_0x17b73d['query']=_[_0x9380('0x40')](_0xf91c39[_0x9380('0x3f')]);_0x17b73d[_0x9380('0x41')]=_[_0x9380('0x44')](_0x17b73d['model'],_0x17b73d[_0x9380('0x3f')]);_0x45096f['attributes']=_[_0x9380('0x44')](_0x17b73d[_0x9380('0x42')],qs[_0x9380('0x45')](_0xf91c39['query'][_0x9380('0x45')]));_0x45096f[_0x9380('0x43')]=_0x45096f[_0x9380('0x43')][_0x9380('0x46')]?_0x45096f['attributes']:_0x17b73d[_0x9380('0x42')];if(_0xf91c39[_0x9380('0x3f')][_0x9380('0x4f')]){_0x45096f[_0x9380('0x50')]=[{'all':!![]}];}_0x45096f=_[_0x9380('0x4b')]({},_0x45096f,_0xf91c39['options']);return db['OpenchannelMessage'][_0x9380('0x51')](_0x45096f)['then'](handleEntityNotFound(_0x5d1075,null))[_0x9380('0x1f')](respondWithResult(_0x5d1075,null))['catch'](handleError(_0x5d1075,null));};exports[_0x9380('0x52')]=function(_0x3289c3,_0x5a2140){return db['OpenchannelMessage'][_0x9380('0x52')](_0x3289c3[_0x9380('0x53')],{})['then'](respondWithResult(_0x5a2140,0xc9))[_0x9380('0x29')](handleError(_0x5a2140,null));};exports[_0x9380('0x36')]=function(_0x3eb696,_0x1b6437){if(_0x3eb696[_0x9380('0x53')]['id']){delete _0x3eb696[_0x9380('0x53')]['id'];}return db[_0x9380('0x3b')][_0x9380('0x51')]({'where':{'id':_0x3eb696[_0x9380('0x54')]['id']}})[_0x9380('0x1f')](handleEntityNotFound(_0x1b6437,null))['then'](saveUpdates(_0x3eb696[_0x9380('0x53')],null))['then'](respondWithResult(_0x1b6437,null))[_0x9380('0x29')](handleError(_0x1b6437,null));};exports[_0x9380('0x55')]=function(_0x3636f1,_0x15c690){return db['OpenchannelMessage'][_0x9380('0x51')]({'where':{'id':_0x3636f1[_0x9380('0x54')]['id']}})['then'](handleEntityNotFound(_0x15c690,null))[_0x9380('0x1f')](removeEntity(_0x15c690,null))[_0x9380('0x29')](handleError(_0x15c690,null));};exports[_0x9380('0x56')]=function(_0x27c191,_0x3de448){return db['OpenchannelMessage'][_0x9380('0x56')]()['then'](respondWithResult(_0x3de448,null))[_0x9380('0x29')](handleError(_0x3de448,null));};var interaction_log=require(_0x9380('0x13'))('openchannel-interactions');exports[_0x9380('0x57')]=function(_0x5d41e4,_0x58cb56,_0x7f347f){var _0x1503a0={'agent':{},'channel':_0x9380('0x58')};if(_0x5d41e4[_0x9380('0x53')]['id']){delete _0x5d41e4[_0x9380('0x53')]['id'];}_0x5d41e4[_0x9380('0x53')][_0x9380('0x59')]=!![];_0x5d41e4[_0x9380('0x53')][_0x9380('0x5a')]=moment()[_0x9380('0x5b')](_0x9380('0x5c'));_0x5d41e4[_0x9380('0x53')][_0x9380('0x5d')]=_0x5d41e4['body'][_0x9380('0x5d')]||_0x5d41e4[_0x9380('0x5e')]['id'];_0x1503a0['agent']['id']=_0x5d41e4[_0x9380('0x53')][_0x9380('0x5d')];return db[_0x9380('0x3b')][_0x9380('0x51')]({'where':{'id':_0x5d41e4[_0x9380('0x54')]['id'],'UserId':null}})[_0x9380('0x1f')](handleEntityNotFound(_0x58cb56,null))[_0x9380('0x1f')](saveUpdates(_0x5d41e4['body'],null))[_0x9380('0x1f')](function(_0x3e60f0){if(_0x3e60f0){_0x1503a0['message']=_0x3e60f0[_0x9380('0x5f')]({'plain':!![]});return db[_0x9380('0x60')][_0x9380('0x51')]({'where':{'id':_0x3e60f0[_0x9380('0x61')]}});}return null;})[_0x9380('0x1f')](handleEntityNotFound(_0x58cb56,null))['then'](function(_0x452445){if(_0x452445){return _0x452445[_0x9380('0x36')]({'UserId':_0x5d41e4[_0x9380('0x53')][_0x9380('0x5d')],'read1stAt':_[_0x9380('0x62')](_0x452445[_0x9380('0x63')])?moment()[_0x9380('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9380('0x1f')](function(_0x337c5f){if(_0x337c5f){_0x1503a0[_0x9380('0x64')]=_0x337c5f[_0x9380('0x5f')]({'plain':!![]});interaction_log[_0x9380('0x20')](_0x9380('0x65'),_0x5d41e4[_0x9380('0x5e')]['id'],_0x5d41e4['user'][_0x9380('0x37')],_0x5d41e4[_0x9380('0x5e')][_0x9380('0x66')],_0x1503a0[_0x9380('0x64')]['id'],_0x5d41e4[_0x9380('0x53')]?JSON[_0x9380('0x25')](_0x5d41e4[_0x9380('0x53')]):_0x9380('0x67'));return respondWithRpcPromise(_0x9380('0x68'),_0x9380('0x69'),_0x1503a0);}return null;})['then'](function(_0x4d6e07){var _0x5e9b1e=_0x9380('0x6a')+_0x4d6e07[_0x9380('0x27')][_0x9380('0x6b')];return db['sequelize']['query'](_0x5e9b1e,{'type':db['Sequelize'][_0x9380('0x6c')][_0x9380('0x6d')],'raw':!![]})[_0x9380('0x1f')](function(_0x32ac45){return _0x32ac45;});})['then'](function(_0xab424){if(_0xab424){_0x1503a0[_0x9380('0x27')][_0x9380('0x6e')]=_0xab424[0x0];if(!_0x5d41e4['body'][_0x9380('0x5d')])return;return db[_0x9380('0x6f')]['find']({'where':{'id':_0x5d41e4[_0x9380('0x53')][_0x9380('0x5d')],'role':_0x9380('0x70')},'attributes':['id',_0x9380('0x37'),_0x9380('0x71'),_0x9380('0x72'),_0x9380('0x73')],'raw':!![]});}return null;})[_0x9380('0x1f')](function(_0x222134){if(!_0x222134)return null;_0x1503a0[_0x9380('0x27')][_0x9380('0x70')]=_0x222134;return _0x1503a0;})[_0x9380('0x1f')](function(_0x15115b){if(_0x15115b){if(_0x5d41e4['body'][_0x9380('0x74')]){_0x1503a0['message'][_0x9380('0x75')]=util['format'](_0x9380('0x76'),_0x5d41e4[_0x9380('0x5e')][_0x9380('0x37')]);_0x1503a0[_0x9380('0x27')][_0x9380('0x77')]=_0x1503a0[_0x9380('0x77')];_0x1503a0[_0x9380('0x27')][_0x9380('0x78')]=_0x1503a0['channel'];_0x1503a0[_0x9380('0x27')][_0x9380('0x79')]=_0x9380('0x57');return respondWithRpcPromise(_0x9380('0x7a'),_0x9380('0x7a'),{'event':_0x9380('0x7b'),'message':_0x1503a0[_0x9380('0x27')]},client9002)[_0x9380('0x1f')](function(){return _0x1503a0;});}return _0x1503a0;}return null;})[_0x9380('0x1f')](respondWithResult(_0x58cb56,null))[_0x9380('0x29')](handleError(_0x58cb56,null));};var interaction_log=require(_0x9380('0x13'))(_0x9380('0x7c'));exports['reject']=function(_0x4a5d2f,_0x397430,_0x239723){var _0x29ccd7={'agent':{},'channel':_0x9380('0x58')};if(_0x4a5d2f['body']['id']){delete _0x4a5d2f[_0x9380('0x53')]['id'];}_0x4a5d2f[_0x9380('0x53')][_0x9380('0x5d')]=_0x4a5d2f[_0x9380('0x53')][_0x9380('0x5d')]||_0x4a5d2f[_0x9380('0x5e')]['id'];_0x29ccd7['agent']['id']=_0x4a5d2f[_0x9380('0x53')]['UserId'];return db['OpenchannelMessage'][_0x9380('0x51')]({'where':{'id':_0x4a5d2f[_0x9380('0x54')]['id'],'UserId':null}})[_0x9380('0x1f')](handleEntityNotFound(_0x397430,null))[_0x9380('0x1f')](function(_0xcdc890){if(_0xcdc890){_0x29ccd7[_0x9380('0x27')]=_0xcdc890[_0x9380('0x5f')]({'plain':!![]});return db[_0x9380('0x60')][_0x9380('0x51')]({'where':{'id':_0xcdc890[_0x9380('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x397430,null))[_0x9380('0x1f')](function(_0x5f3300){if(_0x5f3300){_0x29ccd7[_0x9380('0x64')]=_0x5f3300[_0x9380('0x5f')]({'plain':!![]});interaction_log['info'](_0x9380('0x7d'),_0x4a5d2f[_0x9380('0x5e')]['id'],_0x4a5d2f[_0x9380('0x5e')][_0x9380('0x37')],_0x4a5d2f['user'][_0x9380('0x66')],_0x29ccd7[_0x9380('0x64')]['id'],_0x4a5d2f[_0x9380('0x53')]?JSON[_0x9380('0x25')](_0x4a5d2f['body']):_0x9380('0x67'));return respondWithRpcPromise('RejectMessage',_0x9380('0x7e'),_0x29ccd7);}return null;})[_0x9380('0x1f')](function(_0x4a6d16){var _0x38ef7d=_0x9380('0x6a')+_0x4a6d16[_0x9380('0x27')][_0x9380('0x6b')];return db[_0x9380('0x7f')][_0x9380('0x3f')](_0x38ef7d,{'type':db[_0x9380('0x80')][_0x9380('0x6c')][_0x9380('0x6d')],'raw':!![]})[_0x9380('0x1f')](function(_0x4e0a3e){return _0x4e0a3e;});})[_0x9380('0x1f')](function(_0x2c4d72){if(_0x2c4d72){_0x29ccd7[_0x9380('0x27')][_0x9380('0x6e')]=_0x2c4d72[0x0];if(!_0x4a5d2f[_0x9380('0x53')]['UserId'])return;return db[_0x9380('0x6f')]['find']({'where':{'id':_0x4a5d2f[_0x9380('0x53')][_0x9380('0x5d')],'role':_0x9380('0x70')},'attributes':['id',_0x9380('0x37'),_0x9380('0x71'),_0x9380('0x72'),_0x9380('0x73')],'raw':!![]});}return null;})[_0x9380('0x1f')](function(_0x371488){if(!_0x371488)return null;_0x29ccd7['message'][_0x9380('0x70')]=_0x371488;return _0x29ccd7;})[_0x9380('0x1f')](function(_0x5882a8){if(_0x5882a8){_0x5882a8['message'][_0x9380('0x75')]=util['format'](_0x9380('0x76'),_0x4a5d2f[_0x9380('0x5e')][_0x9380('0x37')]);_0x5882a8[_0x9380('0x27')]['channel']=_0x29ccd7[_0x9380('0x77')];_0x5882a8[_0x9380('0x27')][_0x9380('0x78')]=_0x29ccd7[_0x9380('0x77')];_0x5882a8[_0x9380('0x27')][_0x9380('0x79')]=_0x9380('0x35');respondWithRpcPromise(_0x9380('0x7a'),'EventManager',{'event':_0x9380('0x81'),'message':_0x5882a8['message']},client9002);return _0x29ccd7;}return null;})[_0x9380('0x1f')](respondWithResult(_0x397430,null))[_0x9380('0x29')](handleError(_0x397430,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 23ce1fb..3bb714e 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 _0x298c=['hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit'];(function(_0x5bfd38,_0x40c0dc){var _0x129906=function(_0x136bbf){while(--_0x136bbf){_0x5bfd38['push'](_0x5bfd38['shift']());}};_0x129906(++_0x40c0dc);}(_0x298c,0xaa));var _0xc298=function(_0x4ac729,_0x98a8fa){_0x4ac729=_0x4ac729-0x0;var _0x4a1faf=_0x298c[_0x4ac729];return _0x4a1faf;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xc298('0x0'))['db'][_0xc298('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc298('0x2')](0x0);var events={'afterCreate':_0xc298('0x3'),'afterUpdate':_0xc298('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3789ae){return function(_0xd9fc0e,_0x25600f,_0x174b47){OpenchannelMessageEvents[_0xc298('0x5')](_0x3789ae+':'+_0xd9fc0e['id'],_0xd9fc0e);OpenchannelMessageEvents[_0xc298('0x5')](_0x3789ae,_0xd9fc0e);_0x174b47(null);};}for(var e in events){if(events[_0xc298('0x6')](e)){var event=events[e];OpenchannelMessage[_0xc298('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xb9db=['hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x18a313,_0x54020e){var _0x44ac80=function(_0xf53027){while(--_0xf53027){_0x18a313['push'](_0x18a313['shift']());}};_0x44ac80(++_0x54020e);}(_0xb9db,0x1cd));var _0xbb9d=function(_0x1385ab,_0x43f13d){_0x1385ab=_0x1385ab-0x0;var _0x31e851=_0xb9db[_0x1385ab];return _0x31e851;};'use strict';var EventEmitter=require(_0xbb9d('0x0'));var OpenchannelMessage=require(_0xbb9d('0x1'))['db'][_0xbb9d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbb9d('0x3')](0x0);var events={'afterCreate':_0xbb9d('0x4'),'afterUpdate':_0xbb9d('0x5'),'afterDestroy':_0xbb9d('0x6')};function emitEvent(_0x2855d9){return function(_0x3755aa,_0x5baa2d,_0x3207a0){OpenchannelMessageEvents[_0xbb9d('0x7')](_0x2855d9+':'+_0x3755aa['id'],_0x3755aa);OpenchannelMessageEvents['emit'](_0x2855d9,_0x3755aa);_0x3207a0(null);};}for(var e in events){if(events[_0xbb9d('0x8')](e)){var event=events[e];OpenchannelMessage[_0xbb9d('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 33025ed..ba6e824 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 _0x9348=['catch','error','CmContact','describe','find','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt'];(function(_0x1eb260,_0x342b91){var _0x111a8d=function(_0x5b7695){while(--_0x5b7695){_0x1eb260['push'](_0x1eb260['shift']());}};_0x111a8d(++_0x342b91);}(_0x9348,0x10d));var _0x8934=function(_0x309504,_0x54642d){_0x309504=_0x309504-0x0;var _0x56992e=_0x9348[_0x309504];return _0x56992e;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[{'name':_0x8934('0xc'),'fields':[_0x8934('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b470d,_0x5ec16d,_0x5336f0){var _0x2c722b=_0x2bce03['models'];var _0xe1adf4=_0x4b470d[_0x8934('0xe')]({'plain':!![]});if(_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()==='in'||_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()===_0x8934('0x11')&&!_0xe1adf4[_0x8934('0x12')]&&!_['isNil'](_0xe1adf4[_0x8934('0x13')])){_0x2c722b[_0x8934('0x14')][_0x8934('0x15')]({'where':{'id':_0xe1adf4[_0x8934('0x16')]}})[_0x8934('0x17')](function(_0xdf59f4){if(_0xdf59f4){_0xdf59f4['update']({'lastMsgAt':_0xe1adf4[_0x8934('0x18')],'lastMsgDirection':_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()});}})[_0x8934('0x19')](function(_0x34d4dc){console[_0x8934('0x1a')](_0x34d4dc);});}if(_0xe1adf4[_0x8934('0xf')]===_0x8934('0x11')&&!_0xe1adf4['secret']){var _0xb86bc9;_0x2c722b[_0x8934('0x1b')][_0x8934('0x1c')]()['then'](function(_0x47f25e){return _0x2c722b['OpenchannelAccount'][_0x8934('0x1d')]({'where':{'id':_0xe1adf4['OpenchannelAccountId']},'include':[{'model':_0x2c722b[_0x8934('0x14')],'as':_0x8934('0x1e'),'where':{'id':_0xe1adf4[_0x8934('0x16')]},'limit':0x1,'include':[{'model':_0x2c722b[_0x8934('0x1b')],'as':_0x8934('0x1f'),'attributes':_['keys'](_0x47f25e)}]}]});})[_0x8934('0x17')](function(_0x5ae49f){_0xb86bc9=_0x5ae49f[_0x8934('0xe')]({'plain':!![]});if(_0xb86bc9&&_0xb86bc9[_0x8934('0x20')]){logger[_0x8934('0x21')](_0x8934('0x22'),_0x8934('0x23'),util[_0x8934('0x24')](_0x8934('0x25'),_0xe1adf4['id'],_0xb86bc9['replyUri']));if(_0xb86bc9[_0x8934('0x1e')]&&_0xb86bc9[_0x8934('0x1e')][_0x8934('0x26')]){_0xe1adf4[_0x8934('0x27')]=_[_0x8934('0x28')](_0xb86bc9['Interactions'][0x0],_0x8934('0x1f'));_0xe1adf4[_0x8934('0x1f')]=_0xb86bc9[_0x8934('0x1e')][0x0]['Contact'];}var _0x5ec16d={'method':'POST','uri':encodeURI(_0xb86bc9[_0x8934('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5ec16d[_0x8934('0x29')]){case _0x8934('0x2a'):_0x5ec16d['qs']=_0xe1adf4;break;case'POST':_0x5ec16d[_0x8934('0xd')]=_0xe1adf4;break;}return rp(_0x5ec16d)[_0x8934('0x17')](function(_0x310454){logger[_0x8934('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x8934('0x23'),util[_0x8934('0x24')](_0x8934('0x2b'),_0xe1adf4['id'],_0xb86bc9[_0x8934('0x20')]));if(_0x310454[_0x8934('0xd')][_0x8934('0x2c')]&&_0x310454[_0x8934('0xd')][_0x8934('0x2c')]!=_0xe1adf4[_0x8934('0x27')][_0x8934('0x2c')]){return _0x2c722b['OpenchannelInteraction'][_0x8934('0x2d')]({'threadId':_0x310454[_0x8934('0xd')]['threadId']},{'logging':!![],'where':{'id':_0xe1adf4[_0x8934('0x27')]['id']}});}else{return;}})[_0x8934('0x17')](function(){return _0x4b470d[_0x8934('0x2d')]({'read':!![]});})[_0x8934('0x19')](function(_0x4b3cb9){logger[_0x8934('0x1a')](_0x8934('0x22'),_0x8934('0x23'),util[_0x8934('0x2e')](_0x4b3cb9,{'showHidden':![],'depth':null}));_0x5336f0();});}else{_0x5336f0();}})[_0x8934('0x2f')](function(){_0x5336f0();});}else{_0x5336f0();}}},'charset':'utf8mb4','collate':_0x8934('0x30')});}; \ No newline at end of file +var _0x9c00=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccountId','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4_unicode_ci'];(function(_0x36443d,_0x5b43d2){var _0x923c6=function(_0x3842f3){while(--_0x3842f3){_0x36443d['push'](_0x36443d['shift']());}};_0x923c6(++_0x5b43d2);}(_0x9c00,0x1a0));var _0x09c0=function(_0x328f97,_0x1d5876){_0x328f97=_0x328f97-0x0;var _0x4b27bc=_0x9c00[_0x328f97];return _0x4b27bc;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[{'name':_0x09c0('0xc'),'fields':[_0x09c0('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6558ca,_0x1c1246,_0xa20b5c){var _0x1feb1d=_0x5914eb[_0x09c0('0xe')];var _0x1e16f4=_0x6558ca[_0x09c0('0xf')]({'plain':!![]});if(_0x1e16f4[_0x09c0('0x10')][_0x09c0('0x11')]()==='in'||_0x1e16f4[_0x09c0('0x10')][_0x09c0('0x11')]()===_0x09c0('0x12')&&!_0x1e16f4[_0x09c0('0x13')]&&!_[_0x09c0('0x14')](_0x1e16f4[_0x09c0('0x15')])){_0x1feb1d[_0x09c0('0x16')][_0x09c0('0x17')]({'where':{'id':_0x1e16f4[_0x09c0('0x18')]}})[_0x09c0('0x19')](function(_0x3649d2){if(_0x3649d2){_0x3649d2[_0x09c0('0x1a')]({'lastMsgAt':_0x1e16f4[_0x09c0('0x1b')],'lastMsgDirection':_0x1e16f4[_0x09c0('0x10')][_0x09c0('0x11')]()});}})[_0x09c0('0x1c')](function(_0x2fdf11){console['error'](_0x2fdf11);});}if(_0x1e16f4['direction']==='out'&&!_0x1e16f4[_0x09c0('0x13')]){var _0x11f4b2;_0x1feb1d[_0x09c0('0x1d')][_0x09c0('0x1e')]()['then'](function(_0x2c4440){return _0x1feb1d['OpenchannelAccount']['find']({'where':{'id':_0x1e16f4[_0x09c0('0x1f')]},'include':[{'model':_0x1feb1d['OpenchannelInteraction'],'as':_0x09c0('0x20'),'where':{'id':_0x1e16f4[_0x09c0('0x18')]},'limit':0x1,'include':[{'model':_0x1feb1d[_0x09c0('0x1d')],'as':'Contact','attributes':_[_0x09c0('0x21')](_0x2c4440)}]}]});})[_0x09c0('0x19')](function(_0x8ad645){_0x11f4b2=_0x8ad645[_0x09c0('0xf')]({'plain':!![]});if(_0x11f4b2&&_0x11f4b2[_0x09c0('0x22')]){logger[_0x09c0('0x23')](_0x09c0('0x24'),'afterCreate',util[_0x09c0('0x25')](_0x09c0('0x26'),_0x1e16f4['id'],_0x11f4b2[_0x09c0('0x22')]));if(_0x11f4b2[_0x09c0('0x20')]&&_0x11f4b2['Interactions']['length']){_0x1e16f4[_0x09c0('0x27')]=_[_0x09c0('0x28')](_0x11f4b2[_0x09c0('0x20')][0x0],_0x09c0('0x29'));_0x1e16f4['Contact']=_0x11f4b2[_0x09c0('0x20')][0x0][_0x09c0('0x29')];}var _0x1c1246={'method':_0x09c0('0x2a'),'uri':encodeURI(_0x11f4b2[_0x09c0('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c1246[_0x09c0('0x2b')]){case _0x09c0('0x2c'):_0x1c1246['qs']=_0x1e16f4;break;case _0x09c0('0x2a'):_0x1c1246[_0x09c0('0xd')]=_0x1e16f4;break;}return rp(_0x1c1246)[_0x09c0('0x19')](function(_0x35b61c){logger[_0x09c0('0x23')](_0x09c0('0x24'),_0x09c0('0x2d'),util['format'](_0x09c0('0x2e'),_0x1e16f4['id'],_0x11f4b2[_0x09c0('0x22')]));if(_0x35b61c['body'][_0x09c0('0x2f')]&&_0x35b61c['body'][_0x09c0('0x2f')]!=_0x1e16f4['Interaction'][_0x09c0('0x2f')]){return _0x1feb1d[_0x09c0('0x16')][_0x09c0('0x1a')]({'threadId':_0x35b61c[_0x09c0('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x1e16f4['Interaction']['id']}});}else{return;}})[_0x09c0('0x19')](function(){return _0x6558ca[_0x09c0('0x1a')]({'read':!![]});})[_0x09c0('0x1c')](function(_0x5c93ca){logger[_0x09c0('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x09c0('0x2d'),util[_0x09c0('0x31')](_0x5c93ca,{'showHidden':![],'depth':null}));_0xa20b5c();});}else{_0xa20b5c();}})[_0x09c0('0x32')](function(){_0xa20b5c();});}else{_0xa20b5c();}}},'charset':'utf8mb4','collate':_0x09c0('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 537ea9c..9dd3bc4 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(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0xdb28,0x106));var _0x8db2=function(_0x4ce62f,_0x3ab69b){_0x4ce62f=_0x4ce62f-0x0;var _0x294f50=_0xdb28[_0x4ce62f];return _0x294f50;};'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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2f60aa,_0x463268){var _0x2d2a2a=function(_0x4b71b0){while(--_0x4b71b0){_0x2f60aa['push'](_0x2f60aa['shift']());}};_0x2d2a2a(++_0x463268);}(_0x7a54,0x106));var _0x47a5=function(_0x416b26,_0x1eb2e5){_0x416b26=_0x416b26-0x0;var _0x80de24=_0x7a54[_0x416b26];return _0x80de24;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a4fec23..395fb20 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 _0x444f=['remove','update','emit','removeListener','register','length','save'];(function(_0x14488f,_0x5c609d){var _0x3e5f7d=function(_0x35f492){while(--_0x35f492){_0x14488f['push'](_0x14488f['shift']());}};_0x3e5f7d(++_0x5c609d);}(_0x444f,0xb5));var _0xf444=function(_0x2e1ef0,_0x15c4fb){_0x2e1ef0=_0x2e1ef0-0x0;var _0x1146b2=_0x444f[_0x2e1ef0];return _0x1146b2;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xf444('0x0'),_0xf444('0x1'),_0xf444('0x2')];function createListener(_0x5e08d5,_0x54b3de){return function(_0x2fcecd){_0x54b3de[_0xf444('0x3')](_0x5e08d5,_0x2fcecd);};}function removeListener(_0x1d62ab,_0x3ba0d1){return function(){OpenchannelMessageEvents[_0xf444('0x4')](_0x1d62ab,_0x3ba0d1);};}exports[_0xf444('0x5')]=function(_0x4c9730){for(var _0x1110cf=0x0,_0x2d4eb2=events[_0xf444('0x6')];_0x1110cf<_0x2d4eb2;_0x1110cf++){var _0x2980f1=events[_0x1110cf];var _0x23bd37=createListener('openchannelMessage:'+_0x2980f1,_0x4c9730);OpenchannelMessageEvents['on'](_0x2980f1,_0x23bd37);}}; \ No newline at end of file +var _0xdcd8=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0xaabcd1,_0x2d481a){var _0x30cace=function(_0xb36671){while(--_0xb36671){_0xaabcd1['push'](_0xaabcd1['shift']());}};_0x30cace(++_0x2d481a);}(_0xdcd8,0x7b));var _0x8dcd=function(_0x1755a9,_0x1b0e63){_0x1755a9=_0x1755a9-0x0;var _0x307035=_0xdcd8[_0x1755a9];return _0x307035;};'use strict';var OpenchannelMessageEvents=require(_0x8dcd('0x0'));var events=[_0x8dcd('0x1'),_0x8dcd('0x2'),'update'];function createListener(_0x5b72be,_0x398b23){return function(_0x508cce){_0x398b23[_0x8dcd('0x3')](_0x5b72be,_0x508cce);};}function removeListener(_0x3fc675,_0x43a99e){return function(){OpenchannelMessageEvents[_0x8dcd('0x4')](_0x3fc675,_0x43a99e);};}exports[_0x8dcd('0x5')]=function(_0x4f3dfb){for(var _0x13141d=0x0,_0x54f10d=events[_0x8dcd('0x6')];_0x13141d<_0x54f10d;_0x13141d++){var _0x2b8327=events[_0x13141d];var _0x5b2916=createListener(_0x8dcd('0x7')+_0x2b8327,_0x4f3dfb);OpenchannelMessageEvents['on'](_0x2b8327,_0x5b2916);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8dfafdb..0a62837 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 _0x6c08=['removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6c08,0x1d4));var _0x86c0=function(_0x57ee8a,_0x2d5573){_0x57ee8a=_0x57ee8a-0x0;var _0x523e9a=_0x6c08[_0x57ee8a];return _0x523e9a;};'use strict';var multer=require('multer');var util=require(_0x86c0('0x0'));var path=require(_0x86c0('0x1'));var timeout=require(_0x86c0('0x2'));var express=require(_0x86c0('0x3'));var router=express[_0x86c0('0x4')]();var fs_extra=require(_0x86c0('0x5'));var auth=require(_0x86c0('0x6'));var interaction=require(_0x86c0('0x7'));var config=require(_0x86c0('0x8'));var controller=require(_0x86c0('0x9'));router[_0x86c0('0xa')]('/',auth[_0x86c0('0xb')](),controller['index']);router[_0x86c0('0xa')](_0x86c0('0xc'),auth[_0x86c0('0xb')](),controller[_0x86c0('0xd')]);router[_0x86c0('0xa')](_0x86c0('0xe'),auth[_0x86c0('0xb')](),controller[_0x86c0('0xf')]);router['get'](_0x86c0('0x10'),auth[_0x86c0('0xb')](),controller[_0x86c0('0x11')]);router[_0x86c0('0xa')](_0x86c0('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0x86c0('0xa')](_0x86c0('0x13'),auth[_0x86c0('0xb')](),controller[_0x86c0('0x14')]);router[_0x86c0('0x15')]('/',auth['isAuthenticated'](),controller[_0x86c0('0x16')]);router[_0x86c0('0x15')](_0x86c0('0x12'),auth[_0x86c0('0xb')](),controller[_0x86c0('0x17')]);router[_0x86c0('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x86c0('0x18')]);router[_0x86c0('0x19')]('/:id',auth[_0x86c0('0xb')](),controller['update']);router[_0x86c0('0x1a')](_0x86c0('0xe'),auth[_0x86c0('0xb')](),controller[_0x86c0('0x1b')]);router['delete']('/:id/teams',auth[_0x86c0('0xb')](),controller[_0x86c0('0x1c')]);router[_0x86c0('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0x86c0('0x1d')]);module[_0x86c0('0x1e')]=router; \ No newline at end of file +var _0xce98=['/:id/teams','getTeams','/:id/users','getAgents','create','post','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers'];(function(_0xd94171,_0x33729a){var _0x4dc7bf=function(_0x26cf0d){while(--_0x26cf0d){_0xd94171['push'](_0xd94171['shift']());}};_0x4dc7bf(++_0x33729a);}(_0xce98,0x108));var _0x8ce9=function(_0x41e77b,_0x17b2a0){_0x41e77b=_0x41e77b-0x0;var _0xd56cac=_0xce98[_0x41e77b];return _0xd56cac;};'use strict';var multer=require(_0x8ce9('0x0'));var util=require(_0x8ce9('0x1'));var path=require('path');var timeout=require(_0x8ce9('0x2'));var express=require('express');var router=express[_0x8ce9('0x3')]();var fs_extra=require(_0x8ce9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8ce9('0x5'));var config=require(_0x8ce9('0x6'));var controller=require(_0x8ce9('0x7'));router[_0x8ce9('0x8')]('/',auth[_0x8ce9('0x9')](),controller[_0x8ce9('0xa')]);router['get']('/describe',auth[_0x8ce9('0x9')](),controller[_0x8ce9('0xb')]);router[_0x8ce9('0x8')](_0x8ce9('0xc'),auth[_0x8ce9('0x9')](),controller[_0x8ce9('0xd')]);router[_0x8ce9('0x8')](_0x8ce9('0xe'),auth[_0x8ce9('0x9')](),controller[_0x8ce9('0xf')]);router[_0x8ce9('0x8')](_0x8ce9('0x10'),auth[_0x8ce9('0x9')](),controller[_0x8ce9('0x11')]);router[_0x8ce9('0x8')](_0x8ce9('0x12'),auth['isAuthenticated'](),controller[_0x8ce9('0x13')]);router['post']('/',auth[_0x8ce9('0x9')](),controller[_0x8ce9('0x14')]);router[_0x8ce9('0x15')]('/:id/teams',auth[_0x8ce9('0x9')](),controller['addTeams']);router[_0x8ce9('0x15')](_0x8ce9('0x12'),auth[_0x8ce9('0x9')](),controller['addAgents']);router[_0x8ce9('0x16')]('/:id',auth[_0x8ce9('0x9')](),controller[_0x8ce9('0x17')]);router[_0x8ce9('0x18')]('/:id',auth[_0x8ce9('0x9')](),controller[_0x8ce9('0x19')]);router[_0x8ce9('0x18')](_0x8ce9('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x8ce9('0x18')](_0x8ce9('0x12'),auth['isAuthenticated'](),controller[_0x8ce9('0x1a')]);module[_0x8ce9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4d5e48f..241df6e 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 _0xe705=['rrmemory','roundrobin','exports','STRING','name','ENUM'];(function(_0x58a364,_0x3439f6){var _0x409b74=function(_0xff5c15){while(--_0xff5c15){_0x58a364['push'](_0x58a364['shift']());}};_0x409b74(++_0x3439f6);}(_0xe705,0x104));var _0x5e70=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xe705[_0x5a95fa];return _0x1a61b8;};'use strict';var Sequelize=require('sequelize');module[_0x5e70('0x0')]={'name':{'type':Sequelize[_0x5e70('0x1')],'unique':_0x5e70('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e70('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e70('0x3')](_0x5e70('0x4'),'beepall',_0x5e70('0x5'))}}; \ No newline at end of file +var _0x865b=['name','INTEGER','rrmemory','beepall','sequelize','STRING'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x865b,0x15a));var _0xb865=function(_0x3676e8,_0x2d7097){_0x3676e8=_0x3676e8-0x0;var _0x3b9c7d=_0x865b[_0x3676e8];return _0x3b9c7d;};'use strict';var Sequelize=require(_0xb865('0x0'));module['exports']={'name':{'type':Sequelize[_0xb865('0x1')],'unique':_0xb865('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb865('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb865('0x4'),_0xb865('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4d3e59b..7216888 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 _0xf543=['getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','merge','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','OpenchannelQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','options','include','findAll','rows','catch','show','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','userProfileId','params','describe'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xf543,0x1d9));var _0x3f54=function(_0x488abd,_0x145a29){_0x488abd=_0x488abd-0x0;var _0x3a31be=_0xf543[_0x488abd];return _0x3a31be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f54('0x0'));var zipdir=require(_0x3f54('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f54('0x2'));var moment=require(_0x3f54('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3f54('0x4'));var util=require(_0x3f54('0x5'));var path=require(_0x3f54('0x6'));var sox=require(_0x3f54('0x7'));var csv=require('to-csv');var ejs=require(_0x3f54('0x8'));var fs=require('fs');var fs_extra=require(_0x3f54('0x9'));var _=require('lodash');var squel=require(_0x3f54('0xa'));var crypto=require(_0x3f54('0xb'));var jsforce=require(_0x3f54('0xc'));var deskjs=require(_0x3f54('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3f54('0xe'));var Papa=require(_0x3f54('0xf'));var Redis=require(_0x3f54('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3f54('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f54('0x12'));var logger=require('../../config/logger')(_0x3f54('0x13'));var utils=require(_0x3f54('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3f54('0x15'));var db=require(_0x3f54('0x16'))['db'];config[_0x3f54('0x17')]=_[_0x3f54('0x18')](config['redis'],{'host':_0x3f54('0x19'),'port':0x18eb});var socket=require(_0x3f54('0x1a'))(new Redis(config[_0x3f54('0x17')]));require(_0x3f54('0x1b'))[_0x3f54('0x1c')](socket);function respondWithStatusCode(_0x1c1d19,_0x34cea1){_0x34cea1=_0x34cea1||0xcc;return function(_0x102684){if(_0x102684){return _0x1c1d19[_0x3f54('0x1d')](_0x34cea1);}return _0x1c1d19['status'](_0x34cea1)[_0x3f54('0x1e')]();};}function respondWithResult(_0x13dc65,_0x359196){_0x359196=_0x359196||0xc8;return function(_0x382a92){if(_0x382a92){return _0x13dc65[_0x3f54('0x1f')](_0x359196)[_0x3f54('0x20')](_0x382a92);}};}function respondWithFilteredResult(_0x5b9f97,_0x4b3517){return function(_0x4ebfad){if(_0x4ebfad){var _0x1636e5=typeof _0x4b3517[_0x3f54('0x21')]===_0x3f54('0x22')&&typeof _0x4b3517[_0x3f54('0x23')]===_0x3f54('0x22');var _0x287e9b=_0x4ebfad[_0x3f54('0x24')];var _0x205432=_0x1636e5?0x0:_0x4b3517[_0x3f54('0x21')];var _0x18bd0b=_0x1636e5?_0x4ebfad['count']:_0x4b3517[_0x3f54('0x21')]+_0x4b3517[_0x3f54('0x23')];var _0xc3157a;if(_0x18bd0b>=_0x287e9b){_0x18bd0b=_0x287e9b;_0xc3157a=0xc8;}else{_0xc3157a=0xce;}_0x5b9f97[_0x3f54('0x1f')](_0xc3157a);return _0x5b9f97[_0x3f54('0x25')]('Content-Range',_0x205432+'-'+_0x18bd0b+'/'+_0x287e9b)['json'](_0x4ebfad);}return null;};}function patchUpdates(_0xcd0d5d){return function(_0x460ac5){try{jsonpatch[_0x3f54('0x26')](_0x460ac5,_0xcd0d5d,!![]);}catch(_0x120c53){return BPromise[_0x3f54('0x27')](_0x120c53);}return _0x460ac5['save']();};}function saveUpdates(_0x13da9d,_0x2690d5){return function(_0x3c34eb){if(_0x3c34eb){return _0x3c34eb[_0x3f54('0x28')](_0x13da9d)[_0x3f54('0x29')](function(_0x34bbd9){return _0x34bbd9;});}return null;};}function removeEntity(_0x19a186,_0x1a12ba){return function(_0x2f1a96){if(_0x2f1a96){return _0x2f1a96[_0x3f54('0x2a')]()[_0x3f54('0x29')](function(){var _0x450074=_0x2f1a96['get']({'plain':!![]});var _0x52bb86='OpenchannelQueues';return db[_0x3f54('0x2b')][_0x3f54('0x2a')]({'where':{'type':_0x52bb86,'resourceId':_0x450074['id']}})[_0x3f54('0x29')](function(){return _0x2f1a96;});})[_0x3f54('0x29')](function(){_0x19a186['status'](0xcc)[_0x3f54('0x1e')]();});}};}function handleEntityNotFound(_0x2ecd91,_0x2de615){return function(_0x44edb0){if(!_0x44edb0){_0x2ecd91['sendStatus'](0x194);}return _0x44edb0;};}function handleError(_0x2d9aa2,_0x12bdf9){_0x12bdf9=_0x12bdf9||0x1f4;return function(_0x3cdbbb){logger[_0x3f54('0x2c')](_0x3cdbbb[_0x3f54('0x2d')]);if(_0x3cdbbb[_0x3f54('0x2e')]){delete _0x3cdbbb['name'];}_0x2d9aa2[_0x3f54('0x1f')](_0x12bdf9)[_0x3f54('0x2f')](_0x3cdbbb);};}exports['index']=function(_0x21e3d6,_0x32613c){var _0x34beb3={},_0x156d84={},_0x20c5d3={'count':0x0,'rows':[]};var _0x344ee9=_['map'](db[_0x3f54('0x30')][_0x3f54('0x31')],function(_0x72ea64){return{'name':_0x72ea64[_0x3f54('0x32')],'type':_0x72ea64['type'][_0x3f54('0x33')]};});_0x156d84[_0x3f54('0x34')]=_['map'](_0x344ee9,_0x3f54('0x2e'));_0x156d84['query']=_[_0x3f54('0x35')](_0x21e3d6[_0x3f54('0x36')]);_0x156d84[_0x3f54('0x37')]=_[_0x3f54('0x38')](_0x156d84[_0x3f54('0x34')],_0x156d84[_0x3f54('0x36')]);_0x34beb3[_0x3f54('0x39')]=_[_0x3f54('0x38')](_0x156d84[_0x3f54('0x34')],qs['fields'](_0x21e3d6[_0x3f54('0x36')]['fields']));_0x34beb3[_0x3f54('0x39')]=_0x34beb3[_0x3f54('0x39')][_0x3f54('0x3a')]?_0x34beb3[_0x3f54('0x39')]:_0x156d84[_0x3f54('0x34')];if(!_0x21e3d6[_0x3f54('0x36')][_0x3f54('0x3b')](_0x3f54('0x3c'))){_0x34beb3[_0x3f54('0x23')]=qs[_0x3f54('0x23')](_0x21e3d6[_0x3f54('0x36')][_0x3f54('0x23')]);_0x34beb3[_0x3f54('0x21')]=qs['offset'](_0x21e3d6[_0x3f54('0x36')][_0x3f54('0x21')]);}_0x34beb3[_0x3f54('0x3d')]=qs[_0x3f54('0x3e')](_0x21e3d6[_0x3f54('0x36')][_0x3f54('0x3e')]);_0x34beb3[_0x3f54('0x3f')]=qs['filters'](_[_0x3f54('0x40')](_0x21e3d6[_0x3f54('0x36')],_0x156d84[_0x3f54('0x37')]),_0x344ee9);if(_0x21e3d6[_0x3f54('0x36')][_0x3f54('0x41')]){_0x34beb3['where']=_['merge'](_0x34beb3[_0x3f54('0x3f')],{'$or':_[_0x3f54('0x42')](_0x344ee9,function(_0x354597){if(_0x354597[_0x3f54('0x43')]!==_0x3f54('0x44')){var _0x2619fa={};_0x2619fa[_0x354597['name']]={'$like':'%'+_0x21e3d6[_0x3f54('0x36')]['filter']+'%'};return _0x2619fa;}})});}_0x34beb3=_['merge']({},_0x34beb3,_0x21e3d6[_0x3f54('0x45')]);var _0x5b915e={'where':_0x34beb3[_0x3f54('0x3f')]};return db[_0x3f54('0x30')][_0x3f54('0x24')](_0x5b915e)[_0x3f54('0x29')](function(_0x4f84c2){_0x20c5d3['count']=_0x4f84c2;if(_0x21e3d6[_0x3f54('0x36')]['includeAll']){_0x34beb3[_0x3f54('0x46')]=[{'all':!![]}];}return db[_0x3f54('0x30')][_0x3f54('0x47')](_0x34beb3);})[_0x3f54('0x29')](function(_0x4a44f2){_0x20c5d3[_0x3f54('0x48')]=_0x4a44f2;return _0x20c5d3;})[_0x3f54('0x29')](respondWithFilteredResult(_0x32613c,_0x34beb3))[_0x3f54('0x49')](handleError(_0x32613c,null));};exports[_0x3f54('0x4a')]=function(_0x31e1b9,_0x1600d7){var _0x333d2b={'raw':!![],'where':{'id':_0x31e1b9['params']['id']}},_0x152f5e={};_0x152f5e[_0x3f54('0x34')]=_[_0x3f54('0x35')](db[_0x3f54('0x30')][_0x3f54('0x31')]);_0x152f5e[_0x3f54('0x36')]=_['keys'](_0x31e1b9[_0x3f54('0x36')]);_0x152f5e[_0x3f54('0x37')]=_[_0x3f54('0x38')](_0x152f5e[_0x3f54('0x34')],_0x152f5e[_0x3f54('0x36')]);_0x333d2b[_0x3f54('0x39')]=_['intersection'](_0x152f5e[_0x3f54('0x34')],qs[_0x3f54('0x4b')](_0x31e1b9[_0x3f54('0x36')][_0x3f54('0x4b')]));_0x333d2b[_0x3f54('0x39')]=_0x333d2b['attributes'][_0x3f54('0x3a')]?_0x333d2b['attributes']:_0x152f5e[_0x3f54('0x34')];if(_0x31e1b9['query']['includeAll']){_0x333d2b[_0x3f54('0x46')]=[{'all':!![]}];}_0x333d2b=_['merge']({},_0x333d2b,_0x31e1b9[_0x3f54('0x45')]);return db[_0x3f54('0x30')][_0x3f54('0x4c')](_0x333d2b)[_0x3f54('0x29')](handleEntityNotFound(_0x1600d7,null))[_0x3f54('0x29')](respondWithResult(_0x1600d7,null))[_0x3f54('0x49')](handleError(_0x1600d7,null));};exports['create']=function(_0x11bc30,_0x2ffa2e){return db[_0x3f54('0x30')][_0x3f54('0x4d')](_0x11bc30[_0x3f54('0x4e')],{})[_0x3f54('0x29')](function(_0x5e43fc){var _0x10a050=_0x11bc30[_0x3f54('0x4f')][_0x3f54('0x50')]({'plain':!![]});if(!_0x10a050)throw new Error(_0x3f54('0x51'));if(_0x10a050[_0x3f54('0x52')]===_0x3f54('0x4f')){var _0x5308c8=_0x5e43fc[_0x3f54('0x50')]({'plain':!![]});var _0x3651ac=_0x3f54('0x53');return db['UserProfileSection'][_0x3f54('0x4c')]({'where':{'name':_0x3651ac,'userProfileId':_0x10a050[_0x3f54('0x54')]},'raw':!![]})['then'](function(_0x5b1179){if(_0x5b1179&&_0x5b1179['autoAssociation']===0x0){return db[_0x3f54('0x2b')][_0x3f54('0x4d')]({'name':_0x5308c8['name'],'resourceId':_0x5308c8['id'],'type':_0x5b1179[_0x3f54('0x2e')],'sectionId':_0x5b1179['id']},{})['then'](function(){return _0x5e43fc;});}else{return _0x5e43fc;}})[_0x3f54('0x49')](function(_0xdd6e36){logger[_0x3f54('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdd6e36);throw _0xdd6e36;});}return _0x5e43fc;})[_0x3f54('0x29')](respondWithResult(_0x2ffa2e,0xc9))['catch'](handleError(_0x2ffa2e,null));};exports[_0x3f54('0x28')]=function(_0x5f5e0b,_0x192004){if(_0x5f5e0b['body']['id']){delete _0x5f5e0b[_0x3f54('0x4e')]['id'];}return db[_0x3f54('0x30')][_0x3f54('0x4c')]({'where':{'id':_0x5f5e0b[_0x3f54('0x55')]['id']}})[_0x3f54('0x29')](handleEntityNotFound(_0x192004,null))[_0x3f54('0x29')](saveUpdates(_0x5f5e0b[_0x3f54('0x4e')],null))[_0x3f54('0x29')](respondWithResult(_0x192004,null))[_0x3f54('0x49')](handleError(_0x192004,null));};exports[_0x3f54('0x2a')]=function(_0x2e0eed,_0x4a03d0){return db[_0x3f54('0x30')][_0x3f54('0x4c')]({'where':{'id':_0x2e0eed['params']['id']}})['then'](handleEntityNotFound(_0x4a03d0,null))[_0x3f54('0x29')](removeEntity(_0x4a03d0,null))[_0x3f54('0x49')](handleError(_0x4a03d0,null));};exports[_0x3f54('0x56')]=function(_0xfcb4cd,_0xa4f11){return db[_0x3f54('0x30')][_0x3f54('0x56')]()['then'](respondWithResult(_0xa4f11,null))[_0x3f54('0x49')](handleError(_0xa4f11,null));};exports[_0x3f54('0x57')]=function(_0x5c865c,_0x5b93a3,_0x1ba00a){var _0x403cb3={'raw':!![],'where':{}},_0x421ff9={},_0x3073b4;return db[_0x3f54('0x30')][_0x3f54('0x58')]({'where':{'id':_0x5c865c[_0x3f54('0x55')]['id']}})[_0x3f54('0x29')](handleEntityNotFound(_0x5b93a3,null))[_0x3f54('0x29')](function(_0x26fff0){if(_0x26fff0){_0x3073b4=_0x26fff0[_0x3f54('0x50')]({'plain':!![]});_0x421ff9[_0x3f54('0x34')]=_[_0x3f54('0x35')](db[_0x3f54('0x59')][_0x3f54('0x31')]);_0x421ff9[_0x3f54('0x36')]=_['keys'](_0x5c865c[_0x3f54('0x36')]);_0x421ff9[_0x3f54('0x37')]=_['intersection'](_0x421ff9['model'],_0x421ff9[_0x3f54('0x36')]);_0x403cb3['attributes']=_['intersection'](_0x421ff9[_0x3f54('0x34')],qs[_0x3f54('0x4b')](_0x5c865c['query'][_0x3f54('0x4b')]));_0x403cb3['attributes']=_0x403cb3[_0x3f54('0x39')]['length']?_0x403cb3[_0x3f54('0x39')]:_0x421ff9['model'];if(!_0x5c865c[_0x3f54('0x36')][_0x3f54('0x3b')](_0x3f54('0x3c'))){_0x403cb3['limit']=qs['limit'](_0x5c865c['query'][_0x3f54('0x23')]);_0x403cb3[_0x3f54('0x21')]=qs[_0x3f54('0x21')](_0x5c865c[_0x3f54('0x36')][_0x3f54('0x21')]);}_0x403cb3[_0x3f54('0x3d')]=qs[_0x3f54('0x3e')](_0x5c865c['query'][_0x3f54('0x3e')]);_0x403cb3['where']=qs[_0x3f54('0x37')](_[_0x3f54('0x40')](_0x5c865c['query'],_0x421ff9[_0x3f54('0x37')]));_0x403cb3[_0x3f54('0x3f')][_0x3f54('0x5a')]=_0x26fff0['id'];if(_0x5c865c['query']['filter']){_0x403cb3[_0x3f54('0x3f')]=_[_0x3f54('0x5b')](_0x403cb3[_0x3f54('0x3f')],{'$or':_['map'](_0x403cb3['attributes'],function(_0xbae5d2){var _0x18f489={};_0x18f489[_0xbae5d2]={'$like':'%'+_0x5c865c[_0x3f54('0x36')][_0x3f54('0x41')]+'%'};return _0x18f489;})});}_0x403cb3=_[_0x3f54('0x5b')]({},_0x403cb3,_0x5c865c[_0x3f54('0x45')]);return db['UserOpenchannelQueue'][_0x3f54('0x47')](_0x403cb3);}})[_0x3f54('0x29')](function(_0xe5f51e){if(_0xe5f51e){return db[_0x3f54('0x5c')][_0x3f54('0x5d')]({'where':{'id':_[_0x3f54('0x42')](_0xe5f51e,_0x3f54('0x5e')),'role':_0x3f54('0x5f')},'attributes':['id',_0x3f54('0x2e'),_0x3f54('0x60'),_0x3f54('0x61'),_0x3f54('0x62')]});}})[_0x3f54('0x29')](function(_0x1e07d5){if(_0x1e07d5){return{'count':_0x1e07d5[_0x3f54('0x24')],'rows':_[_0x3f54('0x42')](_0x1e07d5[_0x3f54('0x48')],function(_0x199288){return{'membername':_0x199288[_0x3f54('0x2e')],'UserId':_0x199288['id'],'queue_name':_0x3073b4[_0x3f54('0x2e')],'OpenchannelQueueId':_0x3073b4['id'],'interface':util[_0x3f54('0x63')](_0x3f54('0x64'),_0x3f54('0x65'),_0x199288[_0x3f54('0x2e')]),'penalty':0x0,'paused':_0x199288['openchannelPause'],'createdAt':_0x199288[_0x3f54('0x62')],'updatedAt':_0x199288[_0x3f54('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3f54('0x29')](respondWithFilteredResult(_0x5b93a3,_0x403cb3))[_0x3f54('0x49')](handleError(_0x5b93a3,null));};exports[_0x3f54('0x66')]=function(_0x34dc57,_0x176f59,_0x47a092){var _0x2d8d7e={};var _0x515cea={};var _0x569ab4;var _0x5ad0bd;return db[_0x3f54('0x30')][_0x3f54('0x58')]({'where':{'id':_0x34dc57[_0x3f54('0x55')]['id']}})[_0x3f54('0x29')](handleEntityNotFound(_0x176f59,null))[_0x3f54('0x29')](function(_0x27116f){if(_0x27116f){_0x569ab4=_0x27116f;_0x515cea[_0x3f54('0x34')]=_[_0x3f54('0x35')](db[_0x3f54('0x67')]['rawAttributes']);_0x515cea['query']=_[_0x3f54('0x35')](_0x34dc57[_0x3f54('0x36')]);_0x515cea['filters']=_[_0x3f54('0x38')](_0x515cea[_0x3f54('0x34')],_0x515cea[_0x3f54('0x36')]);_0x2d8d7e[_0x3f54('0x39')]=_['intersection'](_0x515cea[_0x3f54('0x34')],qs['fields'](_0x34dc57[_0x3f54('0x36')][_0x3f54('0x4b')]));_0x2d8d7e[_0x3f54('0x39')]=_0x2d8d7e[_0x3f54('0x39')][_0x3f54('0x3a')]?_0x2d8d7e['attributes']:_0x515cea[_0x3f54('0x34')];_0x2d8d7e[_0x3f54('0x3d')]=qs[_0x3f54('0x3e')](_0x34dc57[_0x3f54('0x36')][_0x3f54('0x3e')]);_0x2d8d7e[_0x3f54('0x3f')]=qs[_0x3f54('0x37')](_['pick'](_0x34dc57[_0x3f54('0x36')],_0x515cea[_0x3f54('0x37')]));if(_0x34dc57[_0x3f54('0x36')][_0x3f54('0x41')]){_0x2d8d7e[_0x3f54('0x3f')]=_[_0x3f54('0x5b')](_0x2d8d7e[_0x3f54('0x3f')],{'$or':_[_0x3f54('0x42')](_0x2d8d7e['attributes'],function(_0x50fcf1){var _0x177dea={};_0x177dea[_0x50fcf1]={'$like':'%'+_0x34dc57[_0x3f54('0x36')][_0x3f54('0x41')]+'%'};return _0x177dea;})});}_0x2d8d7e=_[_0x3f54('0x5b')]({},_0x2d8d7e,_0x34dc57[_0x3f54('0x45')]);return _0x569ab4['getTeams'](_0x2d8d7e);}})['then'](function(_0x556233){if(_0x556233){_0x5ad0bd=_0x556233[_0x3f54('0x3a')];if(!_0x34dc57['query'][_0x3f54('0x3b')](_0x3f54('0x3c'))){_0x2d8d7e[_0x3f54('0x23')]=qs[_0x3f54('0x23')](_0x34dc57[_0x3f54('0x36')][_0x3f54('0x23')]);_0x2d8d7e[_0x3f54('0x21')]=qs[_0x3f54('0x21')](_0x34dc57['query'][_0x3f54('0x21')]);}return _0x569ab4[_0x3f54('0x66')](_0x2d8d7e);}})['then'](function(_0x475533){if(_0x475533){return _0x475533?{'count':_0x5ad0bd,'rows':_0x475533}:null;}})['then'](respondWithResult(_0x176f59,null))[_0x3f54('0x49')](handleError(_0x176f59,null));};exports[_0x3f54('0x68')]=function(_0x3e8e83,_0x2f2857,_0x1617f0){var _0xe8edd1=_0x3e8e83[_0x3f54('0x4e')][_0x3f54('0x69')];return db[_0x3f54('0x67')][_0x3f54('0x47')]({'where':{'id':_0xe8edd1},'attributes':['id'],'include':[{'model':db[_0x3f54('0x5c')],'as':_0x3f54('0x6a'),'attributes':['id','name',_0x3f54('0x6b'),'voicePause',_0x3f54('0x6c')],'raw':!![]}]})[_0x3f54('0x29')](function(_0x44fdac){if(_0x44fdac){var _0x159869=_['flatMap'](_0x44fdac,function(_0x4a2a14){var _0x38dbef=_0x4a2a14['get']({'plain':!![]});return _0x38dbef['Agents'];});return db[_0x3f54('0x30')][_0x3f54('0x4c')]({'where':{'id':_0x3e8e83['params']['id']}})['then'](function(_0x3f3467){return db[_0x3f54('0x6d')][_0x3f54('0x6e')](function(_0x3bd593){return _0x3f3467[_0x3f54('0x68')](_0xe8edd1,{'transaction':_0x3bd593})[_0x3f54('0x29')](function(){return BPromise[_0x3f54('0x6f')](_0x159869,function(_0x4df0c6){return db[_0x3f54('0x59')]['findOrCreate']({'where':{'UserId':_0x4df0c6['id'],'OpenchannelQueueId':_0x3e8e83[_0x3f54('0x55')]['id']},'transaction':_0x3bd593});});})['then'](function(){_0x159869['forEach'](function(_0x1aa12e){socket[_0x3f54('0x70')](_0x3f54('0x71'),{'UserId':_0x1aa12e['id'],'OpenchannelQueueId':_0x3f3467['id']});});});});});}})[_0x3f54('0x29')](respondWithStatusCode(_0x2f2857,null))[_0x3f54('0x49')](handleError(_0x2f2857,null));};exports[_0x3f54('0x72')]=function(_0x167dc7,_0x114416,_0x4be106){return db['Team'][_0x3f54('0x47')]({'where':{'id':_0x167dc7[_0x3f54('0x36')][_0x3f54('0x69')]},'attributes':['id'],'include':[{'model':db[_0x3f54('0x5c')],'as':_0x3f54('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x3f54('0x29')](handleEntityNotFound(_0x114416,null))[_0x3f54('0x29')](function(_0x30aec8){var _0x362c79=_[_0x3f54('0x42')](_0x30aec8,'id');var _0x19e1d5=[];var _0x50c01c=[];var _0x2dc866=squel[_0x3f54('0x73')]();_0x2dc866['field'](_0x3f54('0x74'))[_0x3f54('0x75')](_0x3f54('0x76'),'tq')['join'](_0x3f54('0x77'),'ut',_0x3f54('0x78'))[_0x3f54('0x3f')](_0x3f54('0x79'),_0x167dc7[_0x3f54('0x55')]['id']);for(var _0x2ccacd=0x0;_0x2ccacd<_0x30aec8[_0x3f54('0x3a')];_0x2ccacd+=0x1){let _0x4bee27=_0x30aec8[_0x2ccacd];for(var _0xc443b3=0x0;_0xc443b3<_0x4bee27[_0x3f54('0x6a')]['length'];_0xc443b3+=0x1){let _0x470c04=_0x4bee27[_0x3f54('0x6a')][_0xc443b3];var _0x3027c1=_0x2dc866[_0x3f54('0x7a')]();_0x3027c1[_0x3f54('0x3f')]('ut.UserId\x20=\x20?',_0x470c04['id']);_0x50c01c[_0x3f54('0x7b')](db[_0x3f54('0x6d')][_0x3f54('0x36')](_0x3027c1[_0x3f54('0x7c')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x3f54('0x29')](function(_0x5ae34b){if(_0x5ae34b[_0x3f54('0x3a')]===0x1){return _0x470c04['id'];}else{var _0x4d2268=_[_0x3f54('0x7d')](_['map'](_0x5ae34b,_0x3f54('0x7e')),function(_0x5523f2){return _[_0x3f54('0x7f')](_0x362c79,_0x5523f2);});if(_0x4d2268){return _0x470c04['id'];}}}));}}return BPromise[_0x3f54('0x80')](_0x50c01c)['then'](function(_0x2b181b){_0x19e1d5=_(_0x19e1d5)[_0x3f54('0x81')](_0x2b181b)[_0x3f54('0x82')]()[_0x3f54('0x83')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x167dc7[_0x3f54('0x55')]['id']}})[_0x3f54('0x29')](function(_0x206202){return db[_0x3f54('0x6d')][_0x3f54('0x6e')](function(_0x11f639){return _0x206202['removeTeams'](_0x167dc7['query'][_0x3f54('0x69')],{'transaction':_0x11f639})[_0x3f54('0x29')](function(){if(!_[_0x3f54('0x84')](_0x19e1d5)){return _0x206202[_0x3f54('0x85')](_0x19e1d5,{'transaction':_0x11f639});}})[_0x3f54('0x29')](function(){_0x19e1d5[_0x3f54('0x86')](function(_0x1818d5){socket[_0x3f54('0x70')](_0x3f54('0x87'),{'UserId':_0x1818d5,'OpenchannelQueueId':_0x206202['id']});});});});});});})['then'](respondWithStatusCode(_0x114416,null))['catch'](handleError(_0x114416,null));};exports[_0x3f54('0x88')]=function(_0x340715,_0x40f6df,_0x53b79c){return db['OpenchannelQueue']['find']({'where':{'id':_0x340715[_0x3f54('0x55')]['id']}})[_0x3f54('0x29')](handleEntityNotFound(_0x40f6df,null))[_0x3f54('0x29')](function(_0x41e2a5){if(_0x41e2a5){return _0x41e2a5[_0x3f54('0x88')](_0x340715[_0x3f54('0x4e')][_0x3f54('0x69')],_[_0x3f54('0x89')](_0x340715[_0x3f54('0x4e')],[_0x3f54('0x69'),'id'])||{})['spread'](function(_0x43a932){for(var _0x134897=0x0;_0x134897<_0x340715[_0x3f54('0x4e')]['ids'][_0x3f54('0x3a')];_0x134897+=0x1){socket[_0x3f54('0x70')]('userOpenchannelQueue:save',{'UserId':Number(_0x340715[_0x3f54('0x4e')]['ids'][_0x134897]),'OpenchannelQueueId':Number(_0x340715['params']['id'])});}return _0x43a932;});}})[_0x3f54('0x29')](respondWithResult(_0x40f6df,null))[_0x3f54('0x49')](handleError(_0x40f6df,null));};exports[_0x3f54('0x85')]=function(_0x3433b9,_0x3029f2,_0x25a4ae){return db[_0x3f54('0x30')][_0x3f54('0x4c')]({'where':{'id':_0x3433b9[_0x3f54('0x55')]['id']}})[_0x3f54('0x29')](handleEntityNotFound(_0x3029f2,null))['then'](function(_0x4de1b2){if(_0x4de1b2){return _0x4de1b2[_0x3f54('0x85')](_0x3433b9[_0x3f54('0x36')][_0x3f54('0x69')])['then'](function(){if(_[_0x3f54('0x8a')](_0x3433b9['query']['ids'])){for(var _0x44a7db=0x0;_0x44a7db<_0x3433b9[_0x3f54('0x36')][_0x3f54('0x69')][_0x3f54('0x3a')];_0x44a7db+=0x1){socket[_0x3f54('0x70')](_0x3f54('0x87'),{'UserId':Number(_0x3433b9[_0x3f54('0x36')][_0x3f54('0x69')][_0x44a7db]),'OpenchannelQueueId':Number(_0x3433b9[_0x3f54('0x55')]['id'])});}}else{socket[_0x3f54('0x70')](_0x3f54('0x87'),{'UserId':Number(_0x3433b9[_0x3f54('0x36')][_0x3f54('0x69')]),'OpenchannelQueueId':Number(_0x3433b9[_0x3f54('0x55')]['id'])});}});}})[_0x3f54('0x29')](respondWithStatusCode(_0x3029f2,null))[_0x3f54('0x49')](handleError(_0x3029f2,null));};exports[_0x3f54('0x8b')]=function(_0x5b443b,_0x83d185,_0x24f04e){var _0xa27f6d={};var _0x20433b={};var _0x526333;var _0x520f8a;return db['OpenchannelQueue'][_0x3f54('0x58')]({'where':{'id':_0x5b443b['params']['id']}})['then'](handleEntityNotFound(_0x83d185,null))['then'](function(_0x5ddbf7){if(_0x5ddbf7){_0x526333=_0x5ddbf7;_0x20433b[_0x3f54('0x34')]=_[_0x3f54('0x35')](db[_0x3f54('0x5c')]['rawAttributes']);_0x20433b['query']=_['keys'](_0x5b443b['query']);_0x20433b[_0x3f54('0x37')]=_[_0x3f54('0x38')](_0x20433b[_0x3f54('0x34')],_0x20433b[_0x3f54('0x36')]);_0xa27f6d[_0x3f54('0x39')]=_['intersection'](_0x20433b[_0x3f54('0x34')],qs[_0x3f54('0x4b')](_0x5b443b[_0x3f54('0x36')]['fields']));_0xa27f6d[_0x3f54('0x39')]=_0xa27f6d[_0x3f54('0x39')][_0x3f54('0x3a')]?_0xa27f6d[_0x3f54('0x39')]:_0x20433b[_0x3f54('0x34')];_0xa27f6d[_0x3f54('0x3d')]=qs[_0x3f54('0x3e')](_0x5b443b['query'][_0x3f54('0x3e')]);_0xa27f6d[_0x3f54('0x3f')]=qs['filters'](_['pick'](_0x5b443b[_0x3f54('0x36')],_0x20433b[_0x3f54('0x37')]));if(_0x5b443b[_0x3f54('0x36')][_0x3f54('0x41')]){_0xa27f6d[_0x3f54('0x3f')]=_['merge'](_0xa27f6d[_0x3f54('0x3f')],{'$or':_[_0x3f54('0x42')](_0xa27f6d[_0x3f54('0x39')],function(_0x3247db){var _0x2b84c6={};_0x2b84c6[_0x3247db]={'$like':'%'+_0x5b443b[_0x3f54('0x36')][_0x3f54('0x41')]+'%'};return _0x2b84c6;})});}_0xa27f6d=_['merge']({},_0xa27f6d,_0x5b443b[_0x3f54('0x45')]);return _0x526333[_0x3f54('0x8b')](_0xa27f6d);}})['then'](function(_0x3e4936){if(_0x3e4936){_0x520f8a=_0x3e4936[_0x3f54('0x3a')];if(!_0x5b443b[_0x3f54('0x36')][_0x3f54('0x3b')](_0x3f54('0x3c'))){_0xa27f6d['limit']=qs[_0x3f54('0x23')](_0x5b443b['query'][_0x3f54('0x23')]);_0xa27f6d[_0x3f54('0x21')]=qs[_0x3f54('0x21')](_0x5b443b[_0x3f54('0x36')]['offset']);}return _0x526333[_0x3f54('0x8b')](_0xa27f6d);}})[_0x3f54('0x29')](function(_0x1f75a2){if(_0x1f75a2){return _0x1f75a2?{'count':_0x520f8a,'rows':_0x1f75a2}:null;}})[_0x3f54('0x29')](respondWithResult(_0x83d185,null))[_0x3f54('0x49')](handleError(_0x83d185,null));}; \ No newline at end of file +var _0x1951=['each','userOpenchannelQueue:save','User','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','index','map','fieldName','type','key','query','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAndCountAll','UserId','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','rawAttributes','order','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction'];(function(_0x413af5,_0x454a2a){var _0x22754a=function(_0x41458d){while(--_0x41458d){_0x413af5['push'](_0x413af5['shift']());}};_0x22754a(++_0x454a2a);}(_0x1951,0x14e));var _0x1195=function(_0xb64ac8,_0x2d66cc){_0xb64ac8=_0xb64ac8-0x0;var _0x20ae62=_0x1951[_0xb64ac8];return _0x20ae62;};'use strict';var emlformat=require(_0x1195('0x0'));var rimraf=require(_0x1195('0x1'));var zipdir=require(_0x1195('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1195('0x3'));var moment=require('moment');var BPromise=require(_0x1195('0x4'));var Mustache=require(_0x1195('0x5'));var util=require(_0x1195('0x6'));var path=require(_0x1195('0x7'));var sox=require(_0x1195('0x8'));var csv=require(_0x1195('0x9'));var ejs=require(_0x1195('0xa'));var fs=require('fs');var fs_extra=require(_0x1195('0xb'));var _=require(_0x1195('0xc'));var squel=require(_0x1195('0xd'));var crypto=require(_0x1195('0xe'));var jsforce=require(_0x1195('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1195('0x9'));var querystring=require(_0x1195('0x10'));var Papa=require(_0x1195('0x11'));var Redis=require(_0x1195('0x12'));var authService=require(_0x1195('0x13'));var qs=require(_0x1195('0x14'));var as=require(_0x1195('0x15'));var hardwareService=require(_0x1195('0x16'));var logger=require(_0x1195('0x17'))(_0x1195('0x18'));var utils=require(_0x1195('0x19'));var config=require(_0x1195('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x1195('0x1b'))['db'];config[_0x1195('0x1c')]=_['defaults'](config[_0x1195('0x1c')],{'host':_0x1195('0x1d'),'port':0x18eb});var socket=require(_0x1195('0x1e'))(new Redis(config['redis']));require(_0x1195('0x1f'))[_0x1195('0x20')](socket);function respondWithStatusCode(_0x1bd725,_0x46102e){_0x46102e=_0x46102e||0xcc;return function(_0x36aa81){if(_0x36aa81){return _0x1bd725[_0x1195('0x21')](_0x46102e);}return _0x1bd725[_0x1195('0x22')](_0x46102e)['end']();};}function respondWithResult(_0x142989,_0xdc9ce){_0xdc9ce=_0xdc9ce||0xc8;return function(_0x59712b){if(_0x59712b){return _0x142989[_0x1195('0x22')](_0xdc9ce)[_0x1195('0x23')](_0x59712b);}};}function respondWithFilteredResult(_0x29e6d8,_0x50e475){return function(_0x37fa33){if(_0x37fa33){var _0x2aedb2=typeof _0x50e475['offset']==='undefined'&&typeof _0x50e475['limit']==='undefined';var _0x3df1bd=_0x37fa33[_0x1195('0x24')];var _0x352a62=_0x2aedb2?0x0:_0x50e475['offset'];var _0x418f36=_0x2aedb2?_0x37fa33[_0x1195('0x24')]:_0x50e475[_0x1195('0x25')]+_0x50e475[_0x1195('0x26')];var _0x4e5d74;if(_0x418f36>=_0x3df1bd){_0x418f36=_0x3df1bd;_0x4e5d74=0xc8;}else{_0x4e5d74=0xce;}_0x29e6d8[_0x1195('0x22')](_0x4e5d74);return _0x29e6d8['set'](_0x1195('0x27'),_0x352a62+'-'+_0x418f36+'/'+_0x3df1bd)[_0x1195('0x23')](_0x37fa33);}return null;};}function patchUpdates(_0x48adad){return function(_0x3f8cfd){try{jsonpatch[_0x1195('0x28')](_0x3f8cfd,_0x48adad,!![]);}catch(_0x5437b0){return BPromise[_0x1195('0x29')](_0x5437b0);}return _0x3f8cfd[_0x1195('0x2a')]();};}function saveUpdates(_0x595597,_0x5d0edf){return function(_0x554a00){if(_0x554a00){return _0x554a00[_0x1195('0x2b')](_0x595597)[_0x1195('0x2c')](function(_0x5ee8c9){return _0x5ee8c9;});}return null;};}function removeEntity(_0x2f24a8,_0x3f26cc){return function(_0x3b89c1){if(_0x3b89c1){return _0x3b89c1[_0x1195('0x2d')]()[_0x1195('0x2c')](function(){var _0x4203b1=_0x3b89c1[_0x1195('0x2e')]({'plain':!![]});var _0x260d3f=_0x1195('0x2f');return db[_0x1195('0x30')][_0x1195('0x2d')]({'where':{'type':_0x260d3f,'resourceId':_0x4203b1['id']}})[_0x1195('0x2c')](function(){return _0x3b89c1;});})[_0x1195('0x2c')](function(){_0x2f24a8[_0x1195('0x22')](0xcc)[_0x1195('0x31')]();});}};}function handleEntityNotFound(_0x4bbd7e,_0xe336fe){return function(_0x4df327){if(!_0x4df327){_0x4bbd7e[_0x1195('0x21')](0x194);}return _0x4df327;};}function handleError(_0x1d3f30,_0x374958){_0x374958=_0x374958||0x1f4;return function(_0x3e72b4){logger[_0x1195('0x32')](_0x3e72b4[_0x1195('0x33')]);if(_0x3e72b4[_0x1195('0x34')]){delete _0x3e72b4['name'];}_0x1d3f30['status'](_0x374958)['send'](_0x3e72b4);};}exports[_0x1195('0x35')]=function(_0x1a6349,_0xbd3e92){var _0x5809fd={},_0x5a0de9={},_0x490a5f={'count':0x0,'rows':[]};var _0x5d8195=_[_0x1195('0x36')](db['OpenchannelQueue']['rawAttributes'],function(_0x1e93c7){return{'name':_0x1e93c7[_0x1195('0x37')],'type':_0x1e93c7[_0x1195('0x38')][_0x1195('0x39')]};});_0x5a0de9['model']=_['map'](_0x5d8195,'name');_0x5a0de9[_0x1195('0x3a')]=_['keys'](_0x1a6349[_0x1195('0x3a')]);_0x5a0de9['filters']=_['intersection'](_0x5a0de9[_0x1195('0x3b')],_0x5a0de9[_0x1195('0x3a')]);_0x5809fd[_0x1195('0x3c')]=_['intersection'](_0x5a0de9[_0x1195('0x3b')],qs[_0x1195('0x3d')](_0x1a6349[_0x1195('0x3a')][_0x1195('0x3d')]));_0x5809fd[_0x1195('0x3c')]=_0x5809fd[_0x1195('0x3c')]['length']?_0x5809fd[_0x1195('0x3c')]:_0x5a0de9[_0x1195('0x3b')];if(!_0x1a6349[_0x1195('0x3a')][_0x1195('0x3e')](_0x1195('0x3f'))){_0x5809fd[_0x1195('0x26')]=qs[_0x1195('0x26')](_0x1a6349['query'][_0x1195('0x26')]);_0x5809fd[_0x1195('0x25')]=qs[_0x1195('0x25')](_0x1a6349[_0x1195('0x3a')][_0x1195('0x25')]);}_0x5809fd['order']=qs[_0x1195('0x40')](_0x1a6349[_0x1195('0x3a')][_0x1195('0x40')]);_0x5809fd['where']=qs[_0x1195('0x41')](_[_0x1195('0x42')](_0x1a6349[_0x1195('0x3a')],_0x5a0de9[_0x1195('0x41')]),_0x5d8195);if(_0x1a6349[_0x1195('0x3a')][_0x1195('0x43')]){_0x5809fd[_0x1195('0x44')]=_[_0x1195('0x45')](_0x5809fd[_0x1195('0x44')],{'$or':_[_0x1195('0x36')](_0x5d8195,function(_0xa2fc){if(_0xa2fc[_0x1195('0x38')]!==_0x1195('0x46')){var _0x4b4714={};_0x4b4714[_0xa2fc[_0x1195('0x34')]]={'$like':'%'+_0x1a6349['query'][_0x1195('0x43')]+'%'};return _0x4b4714;}})});}_0x5809fd=_[_0x1195('0x45')]({},_0x5809fd,_0x1a6349[_0x1195('0x47')]);var _0x3085a3={'where':_0x5809fd[_0x1195('0x44')]};return db[_0x1195('0x48')][_0x1195('0x24')](_0x3085a3)[_0x1195('0x2c')](function(_0x113bca){_0x490a5f[_0x1195('0x24')]=_0x113bca;if(_0x1a6349[_0x1195('0x3a')][_0x1195('0x49')]){_0x5809fd[_0x1195('0x4a')]=[{'all':!![]}];}return db[_0x1195('0x48')][_0x1195('0x4b')](_0x5809fd);})[_0x1195('0x2c')](function(_0x12f275){_0x490a5f[_0x1195('0x4c')]=_0x12f275;return _0x490a5f;})[_0x1195('0x2c')](respondWithFilteredResult(_0xbd3e92,_0x5809fd))[_0x1195('0x4d')](handleError(_0xbd3e92,null));};exports[_0x1195('0x4e')]=function(_0x15657e,_0x26ef3a){var _0x431705={'raw':!![],'where':{'id':_0x15657e[_0x1195('0x4f')]['id']}},_0x252134={};_0x252134['model']=_[_0x1195('0x50')](db[_0x1195('0x48')]['rawAttributes']);_0x252134['query']=_[_0x1195('0x50')](_0x15657e[_0x1195('0x3a')]);_0x252134[_0x1195('0x41')]=_[_0x1195('0x51')](_0x252134['model'],_0x252134[_0x1195('0x3a')]);_0x431705[_0x1195('0x3c')]=_[_0x1195('0x51')](_0x252134[_0x1195('0x3b')],qs[_0x1195('0x3d')](_0x15657e[_0x1195('0x3a')]['fields']));_0x431705[_0x1195('0x3c')]=_0x431705['attributes'][_0x1195('0x52')]?_0x431705['attributes']:_0x252134['model'];if(_0x15657e[_0x1195('0x3a')][_0x1195('0x49')]){_0x431705[_0x1195('0x4a')]=[{'all':!![]}];}_0x431705=_[_0x1195('0x45')]({},_0x431705,_0x15657e[_0x1195('0x47')]);return db[_0x1195('0x48')][_0x1195('0x53')](_0x431705)[_0x1195('0x2c')](handleEntityNotFound(_0x26ef3a,null))['then'](respondWithResult(_0x26ef3a,null))[_0x1195('0x4d')](handleError(_0x26ef3a,null));};exports[_0x1195('0x54')]=function(_0x38b7b1,_0x42203f){return db[_0x1195('0x48')][_0x1195('0x54')](_0x38b7b1[_0x1195('0x55')],{})[_0x1195('0x2c')](function(_0x1f2e55){var _0x3ff7c7=_0x38b7b1[_0x1195('0x56')][_0x1195('0x2e')]({'plain':!![]});if(!_0x3ff7c7)throw new Error(_0x1195('0x57'));if(_0x3ff7c7[_0x1195('0x58')]===_0x1195('0x56')){var _0x49cce3=_0x1f2e55[_0x1195('0x2e')]({'plain':!![]});var _0x5c12c4='OpenchannelQueues';return db[_0x1195('0x59')][_0x1195('0x53')]({'where':{'name':_0x5c12c4,'userProfileId':_0x3ff7c7['userProfileId']},'raw':!![]})[_0x1195('0x2c')](function(_0x28aee1){if(_0x28aee1&&_0x28aee1['autoAssociation']===0x0){return db[_0x1195('0x30')][_0x1195('0x54')]({'name':_0x49cce3['name'],'resourceId':_0x49cce3['id'],'type':_0x28aee1['name'],'sectionId':_0x28aee1['id']},{})[_0x1195('0x2c')](function(){return _0x1f2e55;});}else{return _0x1f2e55;}})[_0x1195('0x4d')](function(_0x5ec722){logger[_0x1195('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ec722);throw _0x5ec722;});}return _0x1f2e55;})[_0x1195('0x2c')](respondWithResult(_0x42203f,0xc9))[_0x1195('0x4d')](handleError(_0x42203f,null));};exports['update']=function(_0x5c6e8d,_0x5d1ff9){if(_0x5c6e8d[_0x1195('0x55')]['id']){delete _0x5c6e8d['body']['id'];}return db[_0x1195('0x48')][_0x1195('0x53')]({'where':{'id':_0x5c6e8d[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](handleEntityNotFound(_0x5d1ff9,null))[_0x1195('0x2c')](saveUpdates(_0x5c6e8d[_0x1195('0x55')],null))[_0x1195('0x2c')](respondWithResult(_0x5d1ff9,null))[_0x1195('0x4d')](handleError(_0x5d1ff9,null));};exports[_0x1195('0x2d')]=function(_0xd0ef49,_0x262688){return db[_0x1195('0x48')]['find']({'where':{'id':_0xd0ef49[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](handleEntityNotFound(_0x262688,null))[_0x1195('0x2c')](removeEntity(_0x262688,null))[_0x1195('0x4d')](handleError(_0x262688,null));};exports[_0x1195('0x5a')]=function(_0x1d6c0d,_0x4fb3e6){return db[_0x1195('0x48')]['describe']()['then'](respondWithResult(_0x4fb3e6,null))[_0x1195('0x4d')](handleError(_0x4fb3e6,null));};exports[_0x1195('0x5b')]=function(_0x19b04b,_0x5e4a53,_0x15f0c5){var _0x871946={'raw':!![],'where':{}},_0x239f9d={},_0x2fdf39;return db[_0x1195('0x48')][_0x1195('0x5c')]({'where':{'id':_0x19b04b[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](handleEntityNotFound(_0x5e4a53,null))[_0x1195('0x2c')](function(_0x333314){if(_0x333314){_0x2fdf39=_0x333314[_0x1195('0x2e')]({'plain':!![]});_0x239f9d[_0x1195('0x3b')]=_['keys'](db['UserOpenchannelQueue']['rawAttributes']);_0x239f9d[_0x1195('0x3a')]=_[_0x1195('0x50')](_0x19b04b[_0x1195('0x3a')]);_0x239f9d[_0x1195('0x41')]=_[_0x1195('0x51')](_0x239f9d[_0x1195('0x3b')],_0x239f9d[_0x1195('0x3a')]);_0x871946[_0x1195('0x3c')]=_[_0x1195('0x51')](_0x239f9d[_0x1195('0x3b')],qs[_0x1195('0x3d')](_0x19b04b['query'][_0x1195('0x3d')]));_0x871946['attributes']=_0x871946['attributes'][_0x1195('0x52')]?_0x871946[_0x1195('0x3c')]:_0x239f9d['model'];if(!_0x19b04b['query'][_0x1195('0x3e')](_0x1195('0x3f'))){_0x871946[_0x1195('0x26')]=qs[_0x1195('0x26')](_0x19b04b[_0x1195('0x3a')][_0x1195('0x26')]);_0x871946[_0x1195('0x25')]=qs[_0x1195('0x25')](_0x19b04b[_0x1195('0x3a')][_0x1195('0x25')]);}_0x871946['order']=qs[_0x1195('0x40')](_0x19b04b[_0x1195('0x3a')][_0x1195('0x40')]);_0x871946['where']=qs['filters'](_[_0x1195('0x42')](_0x19b04b[_0x1195('0x3a')],_0x239f9d[_0x1195('0x41')]));_0x871946[_0x1195('0x44')][_0x1195('0x5d')]=_0x333314['id'];if(_0x19b04b['query'][_0x1195('0x43')]){_0x871946[_0x1195('0x44')]=_[_0x1195('0x45')](_0x871946['where'],{'$or':_['map'](_0x871946[_0x1195('0x3c')],function(_0x2aea3a){var _0x295e3f={};_0x295e3f[_0x2aea3a]={'$like':'%'+_0x19b04b[_0x1195('0x3a')]['filter']+'%'};return _0x295e3f;})});}_0x871946=_['merge']({},_0x871946,_0x19b04b[_0x1195('0x47')]);return db[_0x1195('0x5e')][_0x1195('0x4b')](_0x871946);}})[_0x1195('0x2c')](function(_0x58bef9){if(_0x58bef9){return db['User'][_0x1195('0x5f')]({'where':{'id':_[_0x1195('0x36')](_0x58bef9,_0x1195('0x60')),'role':'agent'},'attributes':['id','name',_0x1195('0x61'),'updatedAt',_0x1195('0x62')]});}})[_0x1195('0x2c')](function(_0x25a5bd){if(_0x25a5bd){return{'count':_0x25a5bd[_0x1195('0x24')],'rows':_[_0x1195('0x36')](_0x25a5bd['rows'],function(_0x2fc529){return{'membername':_0x2fc529[_0x1195('0x34')],'UserId':_0x2fc529['id'],'queue_name':_0x2fdf39['name'],'OpenchannelQueueId':_0x2fdf39['id'],'interface':util[_0x1195('0x63')](_0x1195('0x64'),_0x1195('0x65'),_0x2fc529[_0x1195('0x34')]),'penalty':0x0,'paused':_0x2fc529[_0x1195('0x61')],'createdAt':_0x2fc529[_0x1195('0x62')],'updatedAt':_0x2fc529[_0x1195('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1195('0x2c')](respondWithFilteredResult(_0x5e4a53,_0x871946))[_0x1195('0x4d')](handleError(_0x5e4a53,null));};exports[_0x1195('0x67')]=function(_0x1b3a15,_0x3d009f,_0x2040fe){var _0x1e5976={};var _0x33fbb4={};var _0x4fe24d;var _0x52eb24;return db[_0x1195('0x48')]['findOne']({'where':{'id':_0x1b3a15[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](handleEntityNotFound(_0x3d009f,null))[_0x1195('0x2c')](function(_0x3c9a0e){if(_0x3c9a0e){_0x4fe24d=_0x3c9a0e;_0x33fbb4[_0x1195('0x3b')]=_[_0x1195('0x50')](db['Team'][_0x1195('0x68')]);_0x33fbb4[_0x1195('0x3a')]=_[_0x1195('0x50')](_0x1b3a15[_0x1195('0x3a')]);_0x33fbb4[_0x1195('0x41')]=_['intersection'](_0x33fbb4[_0x1195('0x3b')],_0x33fbb4[_0x1195('0x3a')]);_0x1e5976[_0x1195('0x3c')]=_[_0x1195('0x51')](_0x33fbb4[_0x1195('0x3b')],qs[_0x1195('0x3d')](_0x1b3a15[_0x1195('0x3a')][_0x1195('0x3d')]));_0x1e5976[_0x1195('0x3c')]=_0x1e5976['attributes'][_0x1195('0x52')]?_0x1e5976['attributes']:_0x33fbb4[_0x1195('0x3b')];_0x1e5976[_0x1195('0x69')]=qs[_0x1195('0x40')](_0x1b3a15['query'][_0x1195('0x40')]);_0x1e5976[_0x1195('0x44')]=qs[_0x1195('0x41')](_[_0x1195('0x42')](_0x1b3a15['query'],_0x33fbb4['filters']));if(_0x1b3a15[_0x1195('0x3a')][_0x1195('0x43')]){_0x1e5976[_0x1195('0x44')]=_['merge'](_0x1e5976['where'],{'$or':_['map'](_0x1e5976['attributes'],function(_0x57c09e){var _0x54dba3={};_0x54dba3[_0x57c09e]={'$like':'%'+_0x1b3a15[_0x1195('0x3a')][_0x1195('0x43')]+'%'};return _0x54dba3;})});}_0x1e5976=_[_0x1195('0x45')]({},_0x1e5976,_0x1b3a15[_0x1195('0x47')]);return _0x4fe24d[_0x1195('0x67')](_0x1e5976);}})[_0x1195('0x2c')](function(_0x28831d){if(_0x28831d){_0x52eb24=_0x28831d[_0x1195('0x52')];if(!_0x1b3a15['query'][_0x1195('0x3e')]('nolimit')){_0x1e5976[_0x1195('0x26')]=qs[_0x1195('0x26')](_0x1b3a15['query'][_0x1195('0x26')]);_0x1e5976[_0x1195('0x25')]=qs[_0x1195('0x25')](_0x1b3a15[_0x1195('0x3a')][_0x1195('0x25')]);}return _0x4fe24d[_0x1195('0x67')](_0x1e5976);}})[_0x1195('0x2c')](function(_0x1c7659){if(_0x1c7659){return _0x1c7659?{'count':_0x52eb24,'rows':_0x1c7659}:null;}})['then'](respondWithResult(_0x3d009f,null))[_0x1195('0x4d')](handleError(_0x3d009f,null));};exports[_0x1195('0x6a')]=function(_0x308dcd,_0x32c3c0,_0x1191cc){var _0x13e6de=_0x308dcd[_0x1195('0x55')][_0x1195('0x6b')];return db[_0x1195('0x6c')][_0x1195('0x4b')]({'where':{'id':_0x13e6de},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1195('0x6d'),'attributes':['id','name',_0x1195('0x6e'),_0x1195('0x6f'),_0x1195('0x70')],'raw':!![]}]})[_0x1195('0x2c')](function(_0x17388a){if(_0x17388a){var _0xed3130=_[_0x1195('0x71')](_0x17388a,function(_0x1c3f2a){var _0x2a5b59=_0x1c3f2a[_0x1195('0x2e')]({'plain':!![]});return _0x2a5b59[_0x1195('0x6d')];});return db[_0x1195('0x48')][_0x1195('0x53')]({'where':{'id':_0x308dcd[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](function(_0x1ef762){return db[_0x1195('0x72')][_0x1195('0x73')](function(_0x3e9e3a){return _0x1ef762[_0x1195('0x6a')](_0x13e6de,{'transaction':_0x3e9e3a})['then'](function(){return BPromise[_0x1195('0x74')](_0xed3130,function(_0x46beae){return db[_0x1195('0x5e')]['findOrCreate']({'where':{'UserId':_0x46beae['id'],'OpenchannelQueueId':_0x308dcd['params']['id']},'transaction':_0x3e9e3a});});})[_0x1195('0x2c')](function(){_0xed3130['forEach'](function(_0x117324){socket['emit'](_0x1195('0x75'),{'UserId':_0x117324['id'],'OpenchannelQueueId':_0x1ef762['id']});});});});});}})['then'](respondWithStatusCode(_0x32c3c0,null))[_0x1195('0x4d')](handleError(_0x32c3c0,null));};exports['removeTeams']=function(_0x1b3f63,_0x4e7406,_0x24e6f1){return db[_0x1195('0x6c')][_0x1195('0x4b')]({'where':{'id':_0x1b3f63[_0x1195('0x3a')][_0x1195('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x1195('0x76')],'as':_0x1195('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4e7406,null))[_0x1195('0x2c')](function(_0x560e9a){var _0xb72753=_[_0x1195('0x36')](_0x560e9a,'id');var _0x389fe8=[];var _0xc0abed=[];var _0x391dea=squel[_0x1195('0x77')]();_0x391dea[_0x1195('0x78')](_0x1195('0x79'))[_0x1195('0x7a')](_0x1195('0x7b'),'tq')[_0x1195('0x7c')](_0x1195('0x7d'),'ut',_0x1195('0x7e'))[_0x1195('0x44')](_0x1195('0x7f'),_0x1b3f63[_0x1195('0x4f')]['id']);for(var _0x38ad76=0x0;_0x38ad76<_0x560e9a['length'];_0x38ad76+=0x1){let _0xd75466=_0x560e9a[_0x38ad76];for(var _0xb2ac92=0x0;_0xb2ac92<_0xd75466[_0x1195('0x6d')][_0x1195('0x52')];_0xb2ac92+=0x1){let _0x2b4a79=_0xd75466['Agents'][_0xb2ac92];var _0x7771a2=_0x391dea[_0x1195('0x80')]();_0x7771a2[_0x1195('0x44')](_0x1195('0x81'),_0x2b4a79['id']);_0xc0abed[_0x1195('0x82')](db[_0x1195('0x72')]['query'](_0x7771a2[_0x1195('0x83')](),{'type':db[_0x1195('0x72')][_0x1195('0x84')][_0x1195('0x85')]})[_0x1195('0x2c')](function(_0x28e3fb){if(_0x28e3fb[_0x1195('0x52')]===0x1){return _0x2b4a79['id'];}else{var _0x125875=_[_0x1195('0x86')](_['map'](_0x28e3fb,_0x1195('0x87')),function(_0x502286){return _[_0x1195('0x88')](_0xb72753,_0x502286);});if(_0x125875){return _0x2b4a79['id'];}}}));}}return BPromise[_0x1195('0x89')](_0xc0abed)[_0x1195('0x2c')](function(_0x433af9){_0x389fe8=_(_0x389fe8)[_0x1195('0x8a')](_0x433af9)[_0x1195('0x8b')]()[_0x1195('0x8c')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x1b3f63['params']['id']}})[_0x1195('0x2c')](function(_0x2442da){return db[_0x1195('0x72')]['transaction'](function(_0x5184d9){return _0x2442da[_0x1195('0x8d')](_0x1b3f63[_0x1195('0x3a')][_0x1195('0x6b')],{'transaction':_0x5184d9})[_0x1195('0x2c')](function(){if(!_['isEmpty'](_0x389fe8)){return _0x2442da[_0x1195('0x8e')](_0x389fe8,{'transaction':_0x5184d9});}})['then'](function(){_0x389fe8[_0x1195('0x8f')](function(_0x21f09d){socket['emit'](_0x1195('0x90'),{'UserId':_0x21f09d,'OpenchannelQueueId':_0x2442da['id']});});});});});});})[_0x1195('0x2c')](respondWithStatusCode(_0x4e7406,null))[_0x1195('0x4d')](handleError(_0x4e7406,null));};exports[_0x1195('0x91')]=function(_0x2b2bee,_0x2411bc,_0x211b5b){return db[_0x1195('0x48')][_0x1195('0x53')]({'where':{'id':_0x2b2bee[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](handleEntityNotFound(_0x2411bc,null))[_0x1195('0x2c')](function(_0x305423){if(_0x305423){return _0x305423[_0x1195('0x91')](_0x2b2bee[_0x1195('0x55')][_0x1195('0x6b')],_[_0x1195('0x92')](_0x2b2bee['body'],[_0x1195('0x6b'),'id'])||{})[_0x1195('0x93')](function(_0x351752){for(var _0x57653a=0x0;_0x57653a<_0x2b2bee[_0x1195('0x55')][_0x1195('0x6b')]['length'];_0x57653a+=0x1){socket[_0x1195('0x94')](_0x1195('0x75'),{'UserId':Number(_0x2b2bee[_0x1195('0x55')][_0x1195('0x6b')][_0x57653a]),'OpenchannelQueueId':Number(_0x2b2bee['params']['id'])});}return _0x351752;});}})[_0x1195('0x2c')](respondWithResult(_0x2411bc,null))['catch'](handleError(_0x2411bc,null));};exports[_0x1195('0x8e')]=function(_0x190ddb,_0xcae490,_0x16d96b){return db['OpenchannelQueue'][_0x1195('0x53')]({'where':{'id':_0x190ddb[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](handleEntityNotFound(_0xcae490,null))[_0x1195('0x2c')](function(_0x1e7291){if(_0x1e7291){return _0x1e7291['removeAgents'](_0x190ddb['query']['ids'])[_0x1195('0x2c')](function(){if(_['isArray'](_0x190ddb[_0x1195('0x3a')][_0x1195('0x6b')])){for(var _0x48d2f2=0x0;_0x48d2f2<_0x190ddb[_0x1195('0x3a')][_0x1195('0x6b')][_0x1195('0x52')];_0x48d2f2+=0x1){socket[_0x1195('0x94')](_0x1195('0x90'),{'UserId':Number(_0x190ddb[_0x1195('0x3a')][_0x1195('0x6b')][_0x48d2f2]),'OpenchannelQueueId':Number(_0x190ddb[_0x1195('0x4f')]['id'])});}}else{socket[_0x1195('0x94')]('userOpenchannelQueue:remove',{'UserId':Number(_0x190ddb[_0x1195('0x3a')]['ids']),'OpenchannelQueueId':Number(_0x190ddb[_0x1195('0x4f')]['id'])});}});}})[_0x1195('0x2c')](respondWithStatusCode(_0xcae490,null))[_0x1195('0x4d')](handleError(_0xcae490,null));};exports['getAgents']=function(_0x38b6f9,_0x432cfe,_0x5aa863){var _0x5cbefc={};var _0x3e4851={};var _0x375ffa;var _0xaf3afe;return db['OpenchannelQueue'][_0x1195('0x5c')]({'where':{'id':_0x38b6f9[_0x1195('0x4f')]['id']}})[_0x1195('0x2c')](handleEntityNotFound(_0x432cfe,null))['then'](function(_0x71d0a4){if(_0x71d0a4){_0x375ffa=_0x71d0a4;_0x3e4851[_0x1195('0x3b')]=_[_0x1195('0x50')](db['User'][_0x1195('0x68')]);_0x3e4851['query']=_[_0x1195('0x50')](_0x38b6f9['query']);_0x3e4851[_0x1195('0x41')]=_[_0x1195('0x51')](_0x3e4851[_0x1195('0x3b')],_0x3e4851[_0x1195('0x3a')]);_0x5cbefc[_0x1195('0x3c')]=_['intersection'](_0x3e4851[_0x1195('0x3b')],qs[_0x1195('0x3d')](_0x38b6f9[_0x1195('0x3a')][_0x1195('0x3d')]));_0x5cbefc[_0x1195('0x3c')]=_0x5cbefc[_0x1195('0x3c')]['length']?_0x5cbefc[_0x1195('0x3c')]:_0x3e4851[_0x1195('0x3b')];_0x5cbefc[_0x1195('0x69')]=qs['sort'](_0x38b6f9[_0x1195('0x3a')]['sort']);_0x5cbefc[_0x1195('0x44')]=qs[_0x1195('0x41')](_[_0x1195('0x42')](_0x38b6f9[_0x1195('0x3a')],_0x3e4851[_0x1195('0x41')]));if(_0x38b6f9[_0x1195('0x3a')]['filter']){_0x5cbefc['where']=_['merge'](_0x5cbefc[_0x1195('0x44')],{'$or':_['map'](_0x5cbefc[_0x1195('0x3c')],function(_0xa786d){var _0x3c12b2={};_0x3c12b2[_0xa786d]={'$like':'%'+_0x38b6f9['query'][_0x1195('0x43')]+'%'};return _0x3c12b2;})});}_0x5cbefc=_[_0x1195('0x45')]({},_0x5cbefc,_0x38b6f9[_0x1195('0x47')]);return _0x375ffa[_0x1195('0x95')](_0x5cbefc);}})[_0x1195('0x2c')](function(_0x506fd3){if(_0x506fd3){_0xaf3afe=_0x506fd3[_0x1195('0x52')];if(!_0x38b6f9[_0x1195('0x3a')][_0x1195('0x3e')]('nolimit')){_0x5cbefc[_0x1195('0x26')]=qs[_0x1195('0x26')](_0x38b6f9[_0x1195('0x3a')]['limit']);_0x5cbefc['offset']=qs[_0x1195('0x25')](_0x38b6f9[_0x1195('0x3a')][_0x1195('0x25')]);}return _0x375ffa[_0x1195('0x95')](_0x5cbefc);}})[_0x1195('0x2c')](function(_0x358aab){if(_0x358aab){return _0x358aab?{'count':_0xaf3afe,'rows':_0x358aab}:null;}})[_0x1195('0x2c')](respondWithResult(_0x432cfe,null))[_0x1195('0x4d')](handleError(_0x432cfe,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 651fc28..68e5bcd 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 _0x6712=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','OpenchannelQueue'];(function(_0x55326b,_0x2a567c){var _0x2b6de6=function(_0x5e17ea){while(--_0x5e17ea){_0x55326b['push'](_0x55326b['shift']());}};_0x2b6de6(++_0x2a567c);}(_0x6712,0x12f));var _0x2671=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6712[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0x2671('0x0'));var OpenchannelQueue=require(_0x2671('0x1'))['db'][_0x2671('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2671('0x3')](0x0);var events={'afterCreate':_0x2671('0x4'),'afterUpdate':_0x2671('0x5'),'afterDestroy':_0x2671('0x6')};function emitEvent(_0x115f36){return function(_0x299cba,_0x5a7b55,_0x5cd229){OpenchannelQueueEvents[_0x2671('0x7')](_0x115f36+':'+_0x299cba['id'],_0x299cba);OpenchannelQueueEvents[_0x2671('0x7')](_0x115f36,_0x299cba);_0x5cd229(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2671('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xb240=['hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0xe18b9f,_0x5154db){var _0x1aa3e9=function(_0x67a470){while(--_0x67a470){_0xe18b9f['push'](_0xe18b9f['shift']());}};_0x1aa3e9(++_0x5154db);}(_0xb240,0x1d9));var _0x0b24=function(_0x34cfff,_0x174b21){_0x34cfff=_0x34cfff-0x0;var _0x5ee85c=_0xb240[_0x34cfff];return _0x5ee85c;};'use strict';var EventEmitter=require(_0x0b24('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x0b24('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0b24('0x2')](0x0);var events={'afterCreate':_0x0b24('0x3'),'afterUpdate':_0x0b24('0x4'),'afterDestroy':_0x0b24('0x5')};function emitEvent(_0x248199){return function(_0x388ad6,_0x732230,_0x1589c9){OpenchannelQueueEvents[_0x0b24('0x6')](_0x248199+':'+_0x388ad6['id'],_0x388ad6);OpenchannelQueueEvents['emit'](_0x248199,_0x388ad6);_0x1589c9(null);};}for(var e in events){if(events[_0x0b24('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0b24('0x8')](e,emitEvent(event));}}module[_0x0b24('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e983f12..5b2088d 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 _0xd960=['./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29eeec,_0x337c09){var _0x2cf46e=function(_0x491b79){while(--_0x491b79){_0x29eeec['push'](_0x29eeec['shift']());}};_0x2cf46e(++_0x337c09);}(_0xd960,0xf4));var _0x0d96=function(_0x40e42f,_0x5a83a3){_0x40e42f=_0x40e42f-0x0;var _0x21b28b=_0xd960[_0x40e42f];return _0x21b28b;};'use strict';var _=require(_0x0d96('0x0'));var util=require(_0x0d96('0x1'));var logger=require('../../config/logger')(_0x0d96('0x2'));var moment=require('moment');var BPromise=require(_0x0d96('0x3'));var rp=require(_0x0d96('0x4'));var fs=require('fs');var path=require(_0x0d96('0x5'));var rimraf=require(_0x0d96('0x6'));var config=require(_0x0d96('0x7'));var attributes=require(_0x0d96('0x8'));module[_0x0d96('0x9')]=function(_0x2f0c9e,_0x480309){return _0x2f0c9e[_0x0d96('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x0d96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb492=['../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x121583,_0x36fb42){var _0x4da64f=function(_0x1f406a){while(--_0x1f406a){_0x121583['push'](_0x121583['shift']());}};_0x4da64f(++_0x36fb42);}(_0xb492,0x87));var _0x2b49=function(_0x1212f6,_0x3da93d){_0x1212f6=_0x1212f6-0x0;var _0x25fd4d=_0xb492[_0x1212f6];return _0x25fd4d;};'use strict';var _=require(_0x2b49('0x0'));var util=require(_0x2b49('0x1'));var logger=require('../../config/logger')(_0x2b49('0x2'));var moment=require(_0x2b49('0x3'));var BPromise=require(_0x2b49('0x4'));var rp=require(_0x2b49('0x5'));var fs=require('fs');var path=require(_0x2b49('0x6'));var rimraf=require(_0x2b49('0x7'));var config=require(_0x2b49('0x8'));var attributes=require(_0x2b49('0x9'));module[_0x2b49('0xa')]=function(_0x26eb1a,_0x2031c8){return _0x26eb1a[_0x2b49('0xb')](_0x2b49('0xc'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e09e231..4b88798 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 _0x703b=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0xfabdf,_0x3240f3){var _0x311de7=function(_0x304bce){while(--_0x304bce){_0xfabdf['push'](_0xfabdf['shift']());}};_0x311de7(++_0x3240f3);}(_0x703b,0x104));var _0xb703=function(_0x1c913c,_0x4155c6){_0x1c913c=_0x1c913c-0x0;var _0x2dd65e=_0x703b[_0x1c913c];return _0x2dd65e;};'use strict';var _=require(_0xb703('0x0'));var util=require(_0xb703('0x1'));var moment=require(_0xb703('0x2'));var BPromise=require('bluebird');var rs=require(_0xb703('0x3'));var fs=require('fs');var Redis=require(_0xb703('0x4'));var db=require(_0xb703('0x5'))['db'];var utils=require(_0xb703('0x6'));var logger=require(_0xb703('0x7'))(_0xb703('0x8'));var config=require(_0xb703('0x9'));var jayson=require(_0xb703('0xa'));var client=jayson['client'][_0xb703('0xb')]({'port':0x232a});config[_0xb703('0xc')]=_[_0xb703('0xd')](config[_0xb703('0xc')],{'host':_0xb703('0xe'),'port':0x18eb});var socket=require(_0xb703('0xf'))(new Redis(config[_0xb703('0xc')]));require('./openchannelQueue.socket')[_0xb703('0x10')](socket);function respondWithRpcPromise(_0x2714e5,_0x24dc93,_0x4a4dfe){return new BPromise(function(_0x113027,_0x47dcd9){return client[_0xb703('0x11')](_0x2714e5,_0x4a4dfe)[_0xb703('0x12')](function(_0x243f85){logger[_0xb703('0x13')](_0xb703('0x14'),_0x24dc93,'request\x20sent');logger[_0xb703('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x24dc93,_0xb703('0x16'),JSON[_0xb703('0x17')](_0x243f85));if(_0x243f85[_0xb703('0x18')]){if(_0x243f85[_0xb703('0x18')][_0xb703('0x19')]===0x1f4){logger[_0xb703('0x18')](_0xb703('0x14'),_0x24dc93,_0x243f85[_0xb703('0x18')]['message']);return _0x47dcd9(_0x243f85[_0xb703('0x18')][_0xb703('0x1a')]);}logger[_0xb703('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x24dc93,_0x243f85[_0xb703('0x18')][_0xb703('0x1a')]);return _0x113027(_0x243f85[_0xb703('0x18')][_0xb703('0x1a')]);}else{logger[_0xb703('0x13')](_0xb703('0x14'),_0x24dc93,'request\x20sent');_0x113027(_0x243f85[_0xb703('0x1b')][_0xb703('0x1a')]);}})[_0xb703('0x1c')](function(_0x128c2a){logger[_0xb703('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x24dc93,_0x128c2a);_0x47dcd9(_0x128c2a);});});}exports[_0xb703('0x1d')]=function(_0x14fa7a){var _0x2ed30c=this;return new Promise(function(_0x4f1fa3,_0x4824c1){return db[_0xb703('0x1e')][_0xb703('0x1f')]({'raw':_0x14fa7a[_0xb703('0x20')]?_0x14fa7a['options'][_0xb703('0x21')]===undefined?!![]:![]:!![],'where':_0x14fa7a[_0xb703('0x20')]?_0x14fa7a[_0xb703('0x20')]['where']||null:null,'attributes':_0x14fa7a['options']?_0x14fa7a[_0xb703('0x20')][_0xb703('0x22')]||null:null,'limit':_0x14fa7a[_0xb703('0x20')]?_0x14fa7a[_0xb703('0x20')][_0xb703('0x23')]||null:null,'include':_0x14fa7a[_0xb703('0x20')]?_0x14fa7a[_0xb703('0x20')][_0xb703('0x24')]?_[_0xb703('0x25')](_0x14fa7a[_0xb703('0x20')][_0xb703('0x24')],function(_0x43f186){return{'model':db[_0x43f186[_0xb703('0x26')]],'as':_0x43f186['as'],'attributes':_0x43f186[_0xb703('0x22')],'include':_0x43f186['include']?_[_0xb703('0x25')](_0x43f186['include'],function(_0xb080ba){return{'model':db[_0xb080ba[_0xb703('0x26')]],'as':_0xb080ba['as'],'attributes':_0xb080ba[_0xb703('0x22')],'include':_0xb080ba[_0xb703('0x24')]?_[_0xb703('0x25')](_0xb080ba[_0xb703('0x24')],function(_0x45fd0e){return{'model':db[_0x45fd0e[_0xb703('0x26')]],'as':_0x45fd0e['as'],'attributes':_0x45fd0e[_0xb703('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb703('0x12')](function(_0xe91a66){logger['info'](_0xb703('0x1d'),_0x14fa7a);logger['debug']('GetOpenchannelQueue',_0x14fa7a,JSON['stringify'](_0xe91a66));_0x4f1fa3(_0xe91a66);})[_0xb703('0x1c')](function(_0x4321f7){logger[_0xb703('0x18')](_0xb703('0x1d'),_0x4321f7['message'],_0x14fa7a);_0x4824c1(_0x2ed30c[_0xb703('0x18')](0x1f4,_0x4321f7['message']));});});};exports[_0xb703('0x27')]=function(_0xafb33b){var _0x1c506c=this;return new Promise(function(_0x18252d,_0x4d514a){return db[_0xb703('0x1e')][_0xb703('0x28')]({'raw':_0xafb33b[_0xb703('0x20')]?_0xafb33b[_0xb703('0x20')][_0xb703('0x21')]===undefined?!![]:![]:!![],'where':_0xafb33b['options']?_0xafb33b[_0xb703('0x20')]['where']||null:null,'attributes':_0xafb33b['options']?_0xafb33b[_0xb703('0x20')][_0xb703('0x22')]||null:null,'include':_0xafb33b[_0xb703('0x20')]?_0xafb33b[_0xb703('0x20')][_0xb703('0x24')]?_['map'](_0xafb33b['options'][_0xb703('0x24')],function(_0x5a1737){return{'model':db[_0x5a1737['model']],'as':_0x5a1737['as'],'attributes':_0x5a1737[_0xb703('0x22')],'include':_0x5a1737['include']?_[_0xb703('0x25')](_0x5a1737[_0xb703('0x24')],function(_0x43757b){return{'model':db[_0x43757b[_0xb703('0x26')]],'as':_0x43757b['as'],'attributes':_0x43757b[_0xb703('0x22')],'include':_0x43757b['include']?_['map'](_0x43757b[_0xb703('0x24')],function(_0x18b245){return{'model':db[_0x18b245[_0xb703('0x26')]],'as':_0x18b245['as'],'attributes':_0x18b245[_0xb703('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb703('0x12')](function(_0x18d264){logger[_0xb703('0x13')](_0xb703('0x27'),_0xafb33b);logger['debug'](_0xb703('0x27'),_0xafb33b,JSON[_0xb703('0x17')](_0x18d264));_0x18252d(_0x18d264);})[_0xb703('0x1c')](function(_0x52a5ca){logger[_0xb703('0x18')](_0xb703('0x27'),_0x52a5ca[_0xb703('0x1a')],_0xafb33b);_0x4d514a(_0x1c506c[_0xb703('0x18')](0x1f4,_0x52a5ca['message']));});});}; \ No newline at end of file +var _0xe112=['error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0xe112,0x6a));var _0x2e11=function(_0x2e2008,_0x12ac93){_0x2e2008=_0x2e2008-0x0;var _0x376dd6=_0xe112[_0x2e2008];return _0x376dd6;};'use strict';var _=require(_0x2e11('0x0'));var util=require(_0x2e11('0x1'));var moment=require(_0x2e11('0x2'));var BPromise=require(_0x2e11('0x3'));var rs=require(_0x2e11('0x4'));var fs=require('fs');var Redis=require(_0x2e11('0x5'));var db=require(_0x2e11('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e11('0x7'))(_0x2e11('0x8'));var config=require('../../config/environment');var jayson=require(_0x2e11('0x9'));var client=jayson[_0x2e11('0xa')][_0x2e11('0xb')]({'port':0x232a});config[_0x2e11('0xc')]=_[_0x2e11('0xd')](config['redis'],{'host':_0x2e11('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e11('0xc')]));require(_0x2e11('0xf'))[_0x2e11('0x10')](socket);function respondWithRpcPromise(_0x35f2b7,_0x9a2020,_0x4d5c49){return new BPromise(function(_0x3cec3e,_0x5d99d3){return client[_0x2e11('0x11')](_0x35f2b7,_0x4d5c49)['then'](function(_0x211d43){logger[_0x2e11('0x12')](_0x2e11('0x13'),_0x9a2020,_0x2e11('0x14'));logger['debug'](_0x2e11('0x15'),_0x9a2020,'request\x20sent',JSON[_0x2e11('0x16')](_0x211d43));if(_0x211d43[_0x2e11('0x17')]){if(_0x211d43[_0x2e11('0x17')][_0x2e11('0x18')]===0x1f4){logger[_0x2e11('0x17')](_0x2e11('0x13'),_0x9a2020,_0x211d43[_0x2e11('0x17')][_0x2e11('0x19')]);return _0x5d99d3(_0x211d43[_0x2e11('0x17')][_0x2e11('0x19')]);}logger[_0x2e11('0x17')](_0x2e11('0x13'),_0x9a2020,_0x211d43[_0x2e11('0x17')]['message']);return _0x3cec3e(_0x211d43[_0x2e11('0x17')][_0x2e11('0x19')]);}else{logger[_0x2e11('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x9a2020,'request\x20sent');_0x3cec3e(_0x211d43[_0x2e11('0x1a')]['message']);}})[_0x2e11('0x1b')](function(_0x17f94f){logger[_0x2e11('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x9a2020,_0x17f94f);_0x5d99d3(_0x17f94f);});});}exports[_0x2e11('0x1c')]=function(_0x111369){var _0x32e94e=this;return new Promise(function(_0x2ea07d,_0x50b2e6){return db[_0x2e11('0x1d')][_0x2e11('0x1e')]({'raw':_0x111369['options']?_0x111369[_0x2e11('0x1f')][_0x2e11('0x20')]===undefined?!![]:![]:!![],'where':_0x111369['options']?_0x111369[_0x2e11('0x1f')][_0x2e11('0x21')]||null:null,'attributes':_0x111369['options']?_0x111369[_0x2e11('0x1f')][_0x2e11('0x22')]||null:null,'limit':_0x111369['options']?_0x111369[_0x2e11('0x1f')][_0x2e11('0x23')]||null:null,'include':_0x111369['options']?_0x111369[_0x2e11('0x1f')][_0x2e11('0x24')]?_[_0x2e11('0x25')](_0x111369[_0x2e11('0x1f')]['include'],function(_0x2aeb54){return{'model':db[_0x2aeb54[_0x2e11('0x26')]],'as':_0x2aeb54['as'],'attributes':_0x2aeb54[_0x2e11('0x22')],'include':_0x2aeb54['include']?_[_0x2e11('0x25')](_0x2aeb54[_0x2e11('0x24')],function(_0x5e7faa){return{'model':db[_0x5e7faa['model']],'as':_0x5e7faa['as'],'attributes':_0x5e7faa['attributes'],'include':_0x5e7faa[_0x2e11('0x24')]?_['map'](_0x5e7faa[_0x2e11('0x24')],function(_0x310fd8){return{'model':db[_0x310fd8[_0x2e11('0x26')]],'as':_0x310fd8['as'],'attributes':_0x310fd8[_0x2e11('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2e11('0x27')](function(_0x31ba9b){logger['info'](_0x2e11('0x1c'),_0x111369);logger[_0x2e11('0x28')](_0x2e11('0x1c'),_0x111369,JSON[_0x2e11('0x16')](_0x31ba9b));_0x2ea07d(_0x31ba9b);})[_0x2e11('0x1b')](function(_0x5a1362){logger[_0x2e11('0x17')](_0x2e11('0x1c'),_0x5a1362['message'],_0x111369);_0x50b2e6(_0x32e94e[_0x2e11('0x17')](0x1f4,_0x5a1362[_0x2e11('0x19')]));});});};exports[_0x2e11('0x29')]=function(_0x15b631){var _0x507265=this;return new Promise(function(_0x100314,_0x2829ea){return db[_0x2e11('0x1d')][_0x2e11('0x2a')]({'raw':_0x15b631[_0x2e11('0x1f')]?_0x15b631['options'][_0x2e11('0x20')]===undefined?!![]:![]:!![],'where':_0x15b631[_0x2e11('0x1f')]?_0x15b631[_0x2e11('0x1f')][_0x2e11('0x21')]||null:null,'attributes':_0x15b631[_0x2e11('0x1f')]?_0x15b631[_0x2e11('0x1f')][_0x2e11('0x22')]||null:null,'include':_0x15b631['options']?_0x15b631['options']['include']?_[_0x2e11('0x25')](_0x15b631[_0x2e11('0x1f')]['include'],function(_0x2ae8df){return{'model':db[_0x2ae8df[_0x2e11('0x26')]],'as':_0x2ae8df['as'],'attributes':_0x2ae8df['attributes'],'include':_0x2ae8df[_0x2e11('0x24')]?_[_0x2e11('0x25')](_0x2ae8df['include'],function(_0x357367){return{'model':db[_0x357367[_0x2e11('0x26')]],'as':_0x357367['as'],'attributes':_0x357367[_0x2e11('0x22')],'include':_0x357367[_0x2e11('0x24')]?_[_0x2e11('0x25')](_0x357367[_0x2e11('0x24')],function(_0x5666fb){return{'model':db[_0x5666fb[_0x2e11('0x26')]],'as':_0x5666fb['as'],'attributes':_0x5666fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e11('0x27')](function(_0x4fdc7f){logger[_0x2e11('0x12')](_0x2e11('0x29'),_0x15b631);logger[_0x2e11('0x28')](_0x2e11('0x29'),_0x15b631,JSON[_0x2e11('0x16')](_0x4fdc7f));_0x100314(_0x4fdc7f);})[_0x2e11('0x1b')](function(_0x56ab94){logger[_0x2e11('0x17')]('ShowOpenchannelQueue',_0x56ab94[_0x2e11('0x19')],_0x15b631);_0x2829ea(_0x507265[_0x2e11('0x17')](0x1f4,_0x56ab94[_0x2e11('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 29fd3be..4995f41 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 _0xacee=['save','remove','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x1a3d77,_0x5e04aa){var _0x22fc49=function(_0x3c0f39){while(--_0x3c0f39){_0x1a3d77['push'](_0x1a3d77['shift']());}};_0x22fc49(++_0x5e04aa);}(_0xacee,0x12c));var _0xeace=function(_0x1be08f,_0x355d53){_0x1be08f=_0x1be08f-0x0;var _0x39b913=_0xacee[_0x1be08f];return _0x39b913;};'use strict';var OpenchannelQueueEvents=require(_0xeace('0x0'));var events=[_0xeace('0x1'),_0xeace('0x2'),'update'];function createListener(_0x3df56f,_0x107db3){return function(_0x58f51c){_0x107db3['emit'](_0x3df56f,_0x58f51c);};}function removeListener(_0x42201b,_0x406c86){return function(){OpenchannelQueueEvents[_0xeace('0x3')](_0x42201b,_0x406c86);};}exports[_0xeace('0x4')]=function(_0x2f4c17){for(var _0x34e79c=0x0,_0x35d1db=events[_0xeace('0x5')];_0x34e79c<_0x35d1db;_0x34e79c++){var _0x337d69=events[_0x34e79c];var _0x142bff=createListener(_0xeace('0x6')+_0x337d69,_0x2f4c17);OpenchannelQueueEvents['on'](_0x337d69,_0x142bff);}}; \ No newline at end of file +var _0x2bc5=['openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register'];(function(_0x8ed69d,_0x396ed6){var _0x3e38c0=function(_0x3fe78c){while(--_0x3fe78c){_0x8ed69d['push'](_0x8ed69d['shift']());}};_0x3e38c0(++_0x396ed6);}(_0x2bc5,0xef));var _0x52bc=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x2bc5[_0xcaf223];return _0x17e00d;};'use strict';var OpenchannelQueueEvents=require(_0x52bc('0x0'));var events=[_0x52bc('0x1'),'remove',_0x52bc('0x2')];function createListener(_0x1fbe8c,_0x327459){return function(_0x63705e){_0x327459[_0x52bc('0x3')](_0x1fbe8c,_0x63705e);};}function removeListener(_0x50cb63,_0x76e41d){return function(){OpenchannelQueueEvents[_0x52bc('0x4')](_0x50cb63,_0x76e41d);};}exports[_0x52bc('0x5')]=function(_0x5de69c){for(var _0x41f353=0x0,_0xaf5d52=events['length'];_0x41f353<_0xaf5d52;_0x41f353++){var _0x258c60=events[_0x41f353];var _0x36ed94=createListener(_0x52bc('0x6')+_0x258c60,_0x5de69c);OpenchannelQueueEvents['on'](_0x258c60,_0x36ed94);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 4d30861..bd8d3bc 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 _0x6f5c=['./openchannelQueueReport.controller','get','isAuthenticated','index','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5d6008,_0xd5985){var _0x308e0d=function(_0x11499a){while(--_0x11499a){_0x5d6008['push'](_0x5d6008['shift']());}};_0x308e0d(++_0xd5985);}(_0x6f5c,0x199));var _0xc6f5=function(_0x54c00e,_0x5bebe2){_0x54c00e=_0x54c00e-0x0;var _0x3dd1ad=_0x6f5c[_0x54c00e];return _0x3dd1ad;};'use strict';var multer=require(_0xc6f5('0x0'));var util=require(_0xc6f5('0x1'));var path=require(_0xc6f5('0x2'));var timeout=require(_0xc6f5('0x3'));var express=require(_0xc6f5('0x4'));var router=express[_0xc6f5('0x5')]();var fs_extra=require(_0xc6f5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc6f5('0x7'));var config=require(_0xc6f5('0x8'));var controller=require(_0xc6f5('0x9'));router[_0xc6f5('0xa')]('/',auth[_0xc6f5('0xb')](),controller[_0xc6f5('0xc')]);router[_0xc6f5('0xa')]('/describe',auth[_0xc6f5('0xb')](),controller['describe']);router['get']('/:id',auth[_0xc6f5('0xb')](),controller['show']);router[_0xc6f5('0xd')]('/',auth[_0xc6f5('0xb')](),controller[_0xc6f5('0xe')]);router['put'](_0xc6f5('0xf'),auth[_0xc6f5('0xb')](),controller['update']);router[_0xc6f5('0x10')](_0xc6f5('0xf'),auth[_0xc6f5('0xb')](),controller[_0xc6f5('0x11')]);module[_0xc6f5('0x12')]=router; \ No newline at end of file +var _0x2812=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','exports','multer'];(function(_0x267d29,_0x27f1fe){var _0x4cd7c9=function(_0x4526d4){while(--_0x4526d4){_0x267d29['push'](_0x267d29['shift']());}};_0x4cd7c9(++_0x27f1fe);}(_0x2812,0x9f));var _0x2281=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x2812[_0x3ed054];return _0x16dd95;};'use strict';var multer=require(_0x2281('0x0'));var util=require(_0x2281('0x1'));var path=require('path');var timeout=require(_0x2281('0x2'));var express=require(_0x2281('0x3'));var router=express[_0x2281('0x4')]();var fs_extra=require(_0x2281('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2281('0x6'));var config=require(_0x2281('0x7'));var controller=require(_0x2281('0x8'));router[_0x2281('0x9')]('/',auth[_0x2281('0xa')](),controller[_0x2281('0xb')]);router[_0x2281('0x9')](_0x2281('0xc'),auth[_0x2281('0xa')](),controller[_0x2281('0xd')]);router[_0x2281('0x9')](_0x2281('0xe'),auth[_0x2281('0xa')](),controller['show']);router[_0x2281('0xf')]('/',auth['isAuthenticated'](),controller[_0x2281('0x10')]);router[_0x2281('0x11')](_0x2281('0xe'),auth[_0x2281('0xa')](),controller['update']);router[_0x2281('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2281('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index e47bf23..d2549e3 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 _0xed3a=['moment','sequelize','exports','STRING','DATE'];(function(_0x470506,_0x45c78e){var _0x492fdf=function(_0xb900c4){while(--_0xb900c4){_0x470506['push'](_0x470506['shift']());}};_0x492fdf(++_0x45c78e);}(_0xed3a,0x1ef));var _0xaed3=function(_0x1bdc18,_0x791a6a){_0x1bdc18=_0x1bdc18-0x0;var _0x1e429a=_0xed3a[_0x1bdc18];return _0x1e429a;};'use strict';var moment=require(_0xaed3('0x0'));var Sequelize=require(_0xaed3('0x1'));module[_0xaed3('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaed3('0x3')]},'joinAt':{'type':Sequelize[_0xaed3('0x4')]},'leaveAt':{'type':Sequelize[_0xaed3('0x4')]},'acceptAt':{'type':Sequelize[_0xaed3('0x4')]},'exitAt':{'type':Sequelize[_0xaed3('0x4')]},'reason':{'type':Sequelize[_0xaed3('0x3')]}}; \ No newline at end of file +var _0x8488=['sequelize','exports','STRING','DATE','moment'];(function(_0x31eb0c,_0x4695b5){var _0x4248c2=function(_0x1436c8){while(--_0x1436c8){_0x31eb0c['push'](_0x31eb0c['shift']());}};_0x4248c2(++_0x4695b5);}(_0x8488,0x1b7));var _0x8848=function(_0x4cb93b,_0x571334){_0x4cb93b=_0x4cb93b-0x0;var _0x1e6d15=_0x8488[_0x4cb93b];return _0x1e6d15;};'use strict';var moment=require(_0x8848('0x0'));var Sequelize=require(_0x8848('0x1'));module[_0x8848('0x2')]={'uniqueid':{'type':Sequelize[_0x8848('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8848('0x3')]},'joinAt':{'type':Sequelize[_0x8848('0x4')]},'leaveAt':{'type':Sequelize[_0x8848('0x4')]},'acceptAt':{'type':Sequelize[_0x8848('0x4')]},'exitAt':{'type':Sequelize[_0x8848('0x4')]},'reason':{'type':Sequelize[_0x8848('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3ca51d9..158cdff 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 _0x6958=['findAll','catch','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','then','destroy','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x6958,0x166));var _0x8695=function(_0xeb3bf7,_0x4444bf){_0xeb3bf7=_0xeb3bf7-0x0;var _0x11ae9e=_0x6958[_0xeb3bf7];return _0x11ae9e;};'use strict';var emlformat=require(_0x8695('0x0'));var rimraf=require(_0x8695('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8695('0x2'));var rp=require('request-promise');var moment=require(_0x8695('0x3'));var BPromise=require(_0x8695('0x4'));var Mustache=require('mustache');var util=require(_0x8695('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8695('0x6'));var ejs=require(_0x8695('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8695('0x8'));var jsforce=require(_0x8695('0x9'));var deskjs=require(_0x8695('0xa'));var toCsv=require(_0x8695('0x6'));var querystring=require(_0x8695('0xb'));var Papa=require(_0x8695('0xc'));var Redis=require(_0x8695('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8695('0xe'));var hardwareService=require(_0x8695('0xf'));var logger=require(_0x8695('0x10'))(_0x8695('0x11'));var utils=require(_0x8695('0x12'));var config=require(_0x8695('0x13'));var licenseUtil=require(_0x8695('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e087f,_0x20fd76){_0x20fd76=_0x20fd76||0xcc;return function(_0x43705e){if(_0x43705e){return _0x2e087f[_0x8695('0x15')](_0x20fd76);}return _0x2e087f[_0x8695('0x16')](_0x20fd76)[_0x8695('0x17')]();};}function respondWithResult(_0x45fd4c,_0x14b0ce){_0x14b0ce=_0x14b0ce||0xc8;return function(_0x3d7ec8){if(_0x3d7ec8){return _0x45fd4c[_0x8695('0x16')](_0x14b0ce)[_0x8695('0x18')](_0x3d7ec8);}};}function respondWithFilteredResult(_0x1cfa48,_0x188264){return function(_0x461314){if(_0x461314){var _0x14693c=typeof _0x188264[_0x8695('0x19')]===_0x8695('0x1a')&&typeof _0x188264[_0x8695('0x1b')]===_0x8695('0x1a');var _0x37250c=_0x461314['count'];var _0x3ada3c=_0x14693c?0x0:_0x188264[_0x8695('0x19')];var _0x3786c9=_0x14693c?_0x461314['count']:_0x188264['offset']+_0x188264[_0x8695('0x1b')];var _0x59f9a1;if(_0x3786c9>=_0x37250c){_0x3786c9=_0x37250c;_0x59f9a1=0xc8;}else{_0x59f9a1=0xce;}_0x1cfa48[_0x8695('0x16')](_0x59f9a1);return _0x1cfa48['set']('Content-Range',_0x3ada3c+'-'+_0x3786c9+'/'+_0x37250c)['json'](_0x461314);}return null;};}function patchUpdates(_0x34ec7f){return function(_0x51dec3){try{jsonpatch[_0x8695('0x1c')](_0x51dec3,_0x34ec7f,!![]);}catch(_0x141c1f){return BPromise[_0x8695('0x1d')](_0x141c1f);}return _0x51dec3[_0x8695('0x1e')]();};}function saveUpdates(_0x361acd,_0x9f89af){return function(_0x52c288){if(_0x52c288){return _0x52c288[_0x8695('0x1f')](_0x361acd)[_0x8695('0x20')](function(_0x29caf7){return _0x29caf7;});}return null;};}function removeEntity(_0x1670e7,_0x4c60f8){return function(_0x5f3bcb){if(_0x5f3bcb){return _0x5f3bcb[_0x8695('0x21')]()[_0x8695('0x20')](function(){_0x1670e7['status'](0xcc)[_0x8695('0x17')]();});}};}function handleEntityNotFound(_0x18ce8a,_0x569ee4){return function(_0xa52f9b){if(!_0xa52f9b){_0x18ce8a['sendStatus'](0x194);}return _0xa52f9b;};}function handleError(_0x1d90ec,_0x566a20){_0x566a20=_0x566a20||0x1f4;return function(_0x4c8123){logger[_0x8695('0x22')](_0x4c8123[_0x8695('0x23')]);if(_0x4c8123[_0x8695('0x24')]){delete _0x4c8123[_0x8695('0x24')];}_0x1d90ec[_0x8695('0x16')](_0x566a20)['send'](_0x4c8123);};}exports['index']=function(_0x1585b6,_0x4e33b0){var _0x584f86={},_0x4d71aa={},_0x3f2216={'count':0x0,'rows':[]};var _0x265df9=_[_0x8695('0x25')](db[_0x8695('0x26')][_0x8695('0x27')],function(_0x40fde5){return{'name':_0x40fde5[_0x8695('0x28')],'type':_0x40fde5[_0x8695('0x29')][_0x8695('0x2a')]};});_0x4d71aa[_0x8695('0x2b')]=_[_0x8695('0x25')](_0x265df9,_0x8695('0x24'));_0x4d71aa[_0x8695('0x2c')]=_['keys'](_0x1585b6[_0x8695('0x2c')]);_0x4d71aa[_0x8695('0x2d')]=_['intersection'](_0x4d71aa['model'],_0x4d71aa[_0x8695('0x2c')]);_0x584f86[_0x8695('0x2e')]=_[_0x8695('0x2f')](_0x4d71aa[_0x8695('0x2b')],qs[_0x8695('0x30')](_0x1585b6[_0x8695('0x2c')][_0x8695('0x30')]));_0x584f86[_0x8695('0x2e')]=_0x584f86['attributes'][_0x8695('0x31')]?_0x584f86[_0x8695('0x2e')]:_0x4d71aa[_0x8695('0x2b')];if(!_0x1585b6[_0x8695('0x2c')][_0x8695('0x32')](_0x8695('0x33'))){_0x584f86[_0x8695('0x1b')]=qs[_0x8695('0x1b')](_0x1585b6[_0x8695('0x2c')][_0x8695('0x1b')]);_0x584f86['offset']=qs[_0x8695('0x19')](_0x1585b6[_0x8695('0x2c')]['offset']);}_0x584f86[_0x8695('0x34')]=qs['sort'](_0x1585b6[_0x8695('0x2c')][_0x8695('0x35')]);_0x584f86[_0x8695('0x36')]=qs['filters'](_['pick'](_0x1585b6[_0x8695('0x2c')],_0x4d71aa[_0x8695('0x2d')]),_0x265df9);if(_0x1585b6[_0x8695('0x2c')]['filter']){_0x584f86[_0x8695('0x36')]=_[_0x8695('0x37')](_0x584f86[_0x8695('0x36')],{'$or':_[_0x8695('0x25')](_0x265df9,function(_0x3adb62){if(_0x3adb62[_0x8695('0x29')]!==_0x8695('0x38')){var _0x2f38ca={};_0x2f38ca[_0x3adb62[_0x8695('0x24')]]={'$like':'%'+_0x1585b6[_0x8695('0x2c')][_0x8695('0x39')]+'%'};return _0x2f38ca;}})});}_0x584f86=_[_0x8695('0x37')]({},_0x584f86,_0x1585b6[_0x8695('0x3a')]);var _0xa5b367={'where':_0x584f86['where']};return db[_0x8695('0x26')]['count'](_0xa5b367)[_0x8695('0x20')](function(_0x42290d){_0x3f2216[_0x8695('0x3b')]=_0x42290d;if(_0x1585b6[_0x8695('0x2c')][_0x8695('0x3c')]){_0x584f86[_0x8695('0x3d')]=[{'all':!![]}];}return db[_0x8695('0x26')][_0x8695('0x3e')](_0x584f86);})[_0x8695('0x20')](function(_0x1cd732){_0x3f2216['rows']=_0x1cd732;return _0x3f2216;})[_0x8695('0x20')](respondWithFilteredResult(_0x4e33b0,_0x584f86))[_0x8695('0x3f')](handleError(_0x4e33b0,null));};exports['show']=function(_0xbac84e,_0xaa2339){var _0x50e5c6={'raw':!![],'where':{'id':_0xbac84e[_0x8695('0x40')]['id']}},_0x506073={};_0x506073[_0x8695('0x2b')]=_['keys'](db[_0x8695('0x26')][_0x8695('0x27')]);_0x506073[_0x8695('0x2c')]=_[_0x8695('0x41')](_0xbac84e[_0x8695('0x2c')]);_0x506073['filters']=_[_0x8695('0x2f')](_0x506073[_0x8695('0x2b')],_0x506073[_0x8695('0x2c')]);_0x50e5c6[_0x8695('0x2e')]=_[_0x8695('0x2f')](_0x506073['model'],qs[_0x8695('0x30')](_0xbac84e['query'][_0x8695('0x30')]));_0x50e5c6[_0x8695('0x2e')]=_0x50e5c6[_0x8695('0x2e')]['length']?_0x50e5c6['attributes']:_0x506073['model'];if(_0xbac84e[_0x8695('0x2c')][_0x8695('0x3c')]){_0x50e5c6[_0x8695('0x3d')]=[{'all':!![]}];}_0x50e5c6=_[_0x8695('0x37')]({},_0x50e5c6,_0xbac84e[_0x8695('0x3a')]);return db[_0x8695('0x26')][_0x8695('0x42')](_0x50e5c6)[_0x8695('0x20')](handleEntityNotFound(_0xaa2339,null))[_0x8695('0x20')](respondWithResult(_0xaa2339,null))[_0x8695('0x3f')](handleError(_0xaa2339,null));};exports[_0x8695('0x43')]=function(_0x11478f,_0x6ed68){return db[_0x8695('0x26')]['create'](_0x11478f['body'],{})[_0x8695('0x20')](respondWithResult(_0x6ed68,0xc9))[_0x8695('0x3f')](handleError(_0x6ed68,null));};exports[_0x8695('0x1f')]=function(_0x27ac45,_0x431c06){if(_0x27ac45[_0x8695('0x44')]['id']){delete _0x27ac45[_0x8695('0x44')]['id'];}return db[_0x8695('0x26')][_0x8695('0x42')]({'where':{'id':_0x27ac45[_0x8695('0x40')]['id']}})[_0x8695('0x20')](handleEntityNotFound(_0x431c06,null))['then'](saveUpdates(_0x27ac45['body'],null))[_0x8695('0x20')](respondWithResult(_0x431c06,null))[_0x8695('0x3f')](handleError(_0x431c06,null));};exports[_0x8695('0x21')]=function(_0xedb4ff,_0x10e275){return db[_0x8695('0x26')][_0x8695('0x42')]({'where':{'id':_0xedb4ff[_0x8695('0x40')]['id']}})[_0x8695('0x20')](handleEntityNotFound(_0x10e275,null))[_0x8695('0x20')](removeEntity(_0x10e275,null))[_0x8695('0x3f')](handleError(_0x10e275,null));};exports['describe']=function(_0x570181,_0x46445c){return db[_0x8695('0x26')][_0x8695('0x45')]()[_0x8695('0x20')](respondWithResult(_0x46445c,null))['catch'](handleError(_0x46445c,null));}; \ No newline at end of file +var _0x0626=['filter','VIRTUAL','options','includeAll','include','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x213c41,_0x27407c){var _0x2e9236=function(_0x5e26db){while(--_0x5e26db){_0x213c41['push'](_0x213c41['shift']());}};_0x2e9236(++_0x27407c);}(_0x0626,0xa0));var _0x6062=function(_0x4b8896,_0x529b95){_0x4b8896=_0x4b8896-0x0;var _0x36b29e=_0x0626[_0x4b8896];return _0x36b29e;};'use strict';var emlformat=require(_0x6062('0x0'));var rimraf=require(_0x6062('0x1'));var zipdir=require(_0x6062('0x2'));var jsonpatch=require(_0x6062('0x3'));var rp=require(_0x6062('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6062('0x5'));var util=require(_0x6062('0x6'));var path=require(_0x6062('0x7'));var sox=require(_0x6062('0x8'));var csv=require(_0x6062('0x9'));var ejs=require(_0x6062('0xa'));var fs=require('fs');var fs_extra=require(_0x6062('0xb'));var _=require(_0x6062('0xc'));var squel=require(_0x6062('0xd'));var crypto=require(_0x6062('0xe'));var jsforce=require(_0x6062('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6062('0x9'));var querystring=require(_0x6062('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6062('0x11'));var qs=require(_0x6062('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6062('0x13'));var logger=require(_0x6062('0x14'))(_0x6062('0x15'));var utils=require('../../config/utils');var config=require(_0x6062('0x16'));var licenseUtil=require(_0x6062('0x17'));var db=require(_0x6062('0x18'))['db'];function respondWithStatusCode(_0x2760d8,_0x283d0b){_0x283d0b=_0x283d0b||0xcc;return function(_0x53e533){if(_0x53e533){return _0x2760d8['sendStatus'](_0x283d0b);}return _0x2760d8[_0x6062('0x19')](_0x283d0b)[_0x6062('0x1a')]();};}function respondWithResult(_0x1fd59b,_0xb5965){_0xb5965=_0xb5965||0xc8;return function(_0x574624){if(_0x574624){return _0x1fd59b[_0x6062('0x19')](_0xb5965)[_0x6062('0x1b')](_0x574624);}};}function respondWithFilteredResult(_0x99bea9,_0x14f53c){return function(_0x4010d2){if(_0x4010d2){var _0xc183f7=typeof _0x14f53c['offset']===_0x6062('0x1c')&&typeof _0x14f53c[_0x6062('0x1d')]===_0x6062('0x1c');var _0x47302d=_0x4010d2[_0x6062('0x1e')];var _0x38c993=_0xc183f7?0x0:_0x14f53c['offset'];var _0x29d4a7=_0xc183f7?_0x4010d2[_0x6062('0x1e')]:_0x14f53c[_0x6062('0x1f')]+_0x14f53c[_0x6062('0x1d')];var _0x45c734;if(_0x29d4a7>=_0x47302d){_0x29d4a7=_0x47302d;_0x45c734=0xc8;}else{_0x45c734=0xce;}_0x99bea9[_0x6062('0x19')](_0x45c734);return _0x99bea9[_0x6062('0x20')]('Content-Range',_0x38c993+'-'+_0x29d4a7+'/'+_0x47302d)[_0x6062('0x1b')](_0x4010d2);}return null;};}function patchUpdates(_0x424a71){return function(_0x5674a6){try{jsonpatch[_0x6062('0x21')](_0x5674a6,_0x424a71,!![]);}catch(_0x2a1c9d){return BPromise[_0x6062('0x22')](_0x2a1c9d);}return _0x5674a6[_0x6062('0x23')]();};}function saveUpdates(_0xbe0a95,_0x1e3dcc){return function(_0x20222d){if(_0x20222d){return _0x20222d[_0x6062('0x24')](_0xbe0a95)[_0x6062('0x25')](function(_0x144bad){return _0x144bad;});}return null;};}function removeEntity(_0x185c12,_0x4b2e98){return function(_0xf4efd7){if(_0xf4efd7){return _0xf4efd7[_0x6062('0x26')]()[_0x6062('0x25')](function(){_0x185c12[_0x6062('0x19')](0xcc)[_0x6062('0x1a')]();});}};}function handleEntityNotFound(_0x6aece8,_0x335820){return function(_0x5146a9){if(!_0x5146a9){_0x6aece8['sendStatus'](0x194);}return _0x5146a9;};}function handleError(_0x31bcf8,_0x1ef51a){_0x1ef51a=_0x1ef51a||0x1f4;return function(_0x1581a3){logger[_0x6062('0x27')](_0x1581a3[_0x6062('0x28')]);if(_0x1581a3[_0x6062('0x29')]){delete _0x1581a3['name'];}_0x31bcf8[_0x6062('0x19')](_0x1ef51a)[_0x6062('0x2a')](_0x1581a3);};}exports[_0x6062('0x2b')]=function(_0x15f825,_0xb2273e){var _0x133bd2={},_0x12fb7c={},_0x472bf1={'count':0x0,'rows':[]};var _0x10ff3c=_['map'](db[_0x6062('0x2c')][_0x6062('0x2d')],function(_0x1afefc){return{'name':_0x1afefc['fieldName'],'type':_0x1afefc[_0x6062('0x2e')][_0x6062('0x2f')]};});_0x12fb7c[_0x6062('0x30')]=_[_0x6062('0x31')](_0x10ff3c,_0x6062('0x29'));_0x12fb7c[_0x6062('0x32')]=_[_0x6062('0x33')](_0x15f825[_0x6062('0x32')]);_0x12fb7c[_0x6062('0x34')]=_[_0x6062('0x35')](_0x12fb7c[_0x6062('0x30')],_0x12fb7c[_0x6062('0x32')]);_0x133bd2[_0x6062('0x36')]=_[_0x6062('0x35')](_0x12fb7c[_0x6062('0x30')],qs[_0x6062('0x37')](_0x15f825[_0x6062('0x32')][_0x6062('0x37')]));_0x133bd2[_0x6062('0x36')]=_0x133bd2[_0x6062('0x36')][_0x6062('0x38')]?_0x133bd2['attributes']:_0x12fb7c[_0x6062('0x30')];if(!_0x15f825[_0x6062('0x32')]['hasOwnProperty'](_0x6062('0x39'))){_0x133bd2[_0x6062('0x1d')]=qs[_0x6062('0x1d')](_0x15f825[_0x6062('0x32')][_0x6062('0x1d')]);_0x133bd2[_0x6062('0x1f')]=qs[_0x6062('0x1f')](_0x15f825['query'][_0x6062('0x1f')]);}_0x133bd2[_0x6062('0x3a')]=qs['sort'](_0x15f825[_0x6062('0x32')][_0x6062('0x3b')]);_0x133bd2[_0x6062('0x3c')]=qs['filters'](_[_0x6062('0x3d')](_0x15f825[_0x6062('0x32')],_0x12fb7c['filters']),_0x10ff3c);if(_0x15f825[_0x6062('0x32')][_0x6062('0x3e')]){_0x133bd2[_0x6062('0x3c')]=_['merge'](_0x133bd2[_0x6062('0x3c')],{'$or':_['map'](_0x10ff3c,function(_0x4723bb){if(_0x4723bb['type']!==_0x6062('0x3f')){var _0x4990dd={};_0x4990dd[_0x4723bb[_0x6062('0x29')]]={'$like':'%'+_0x15f825[_0x6062('0x32')]['filter']+'%'};return _0x4990dd;}})});}_0x133bd2=_['merge']({},_0x133bd2,_0x15f825[_0x6062('0x40')]);var _0x1ea867={'where':_0x133bd2[_0x6062('0x3c')]};return db['OpenchannelQueueReport']['count'](_0x1ea867)['then'](function(_0x1d8b36){_0x472bf1[_0x6062('0x1e')]=_0x1d8b36;if(_0x15f825['query'][_0x6062('0x41')]){_0x133bd2[_0x6062('0x42')]=[{'all':!![]}];}return db[_0x6062('0x2c')]['findAll'](_0x133bd2);})[_0x6062('0x25')](function(_0x509376){_0x472bf1['rows']=_0x509376;return _0x472bf1;})[_0x6062('0x25')](respondWithFilteredResult(_0xb2273e,_0x133bd2))[_0x6062('0x43')](handleError(_0xb2273e,null));};exports[_0x6062('0x44')]=function(_0x25f997,_0x3981f6){var _0x2cffd2={'raw':!![],'where':{'id':_0x25f997['params']['id']}},_0x9dda8b={};_0x9dda8b[_0x6062('0x30')]=_[_0x6062('0x33')](db['OpenchannelQueueReport'][_0x6062('0x2d')]);_0x9dda8b[_0x6062('0x32')]=_[_0x6062('0x33')](_0x25f997[_0x6062('0x32')]);_0x9dda8b[_0x6062('0x34')]=_[_0x6062('0x35')](_0x9dda8b['model'],_0x9dda8b['query']);_0x2cffd2['attributes']=_['intersection'](_0x9dda8b['model'],qs[_0x6062('0x37')](_0x25f997[_0x6062('0x32')][_0x6062('0x37')]));_0x2cffd2[_0x6062('0x36')]=_0x2cffd2[_0x6062('0x36')][_0x6062('0x38')]?_0x2cffd2['attributes']:_0x9dda8b[_0x6062('0x30')];if(_0x25f997[_0x6062('0x32')][_0x6062('0x41')]){_0x2cffd2['include']=[{'all':!![]}];}_0x2cffd2=_['merge']({},_0x2cffd2,_0x25f997['options']);return db[_0x6062('0x2c')]['find'](_0x2cffd2)['then'](handleEntityNotFound(_0x3981f6,null))[_0x6062('0x25')](respondWithResult(_0x3981f6,null))[_0x6062('0x43')](handleError(_0x3981f6,null));};exports[_0x6062('0x45')]=function(_0x388ae4,_0x418292){return db[_0x6062('0x2c')]['create'](_0x388ae4[_0x6062('0x46')],{})[_0x6062('0x25')](respondWithResult(_0x418292,0xc9))[_0x6062('0x43')](handleError(_0x418292,null));};exports[_0x6062('0x24')]=function(_0xa971f4,_0x3b7de3){if(_0xa971f4[_0x6062('0x46')]['id']){delete _0xa971f4[_0x6062('0x46')]['id'];}return db[_0x6062('0x2c')][_0x6062('0x47')]({'where':{'id':_0xa971f4[_0x6062('0x48')]['id']}})[_0x6062('0x25')](handleEntityNotFound(_0x3b7de3,null))[_0x6062('0x25')](saveUpdates(_0xa971f4[_0x6062('0x46')],null))[_0x6062('0x25')](respondWithResult(_0x3b7de3,null))[_0x6062('0x43')](handleError(_0x3b7de3,null));};exports[_0x6062('0x26')]=function(_0xc97edc,_0x26ea7b){return db[_0x6062('0x2c')][_0x6062('0x47')]({'where':{'id':_0xc97edc[_0x6062('0x48')]['id']}})[_0x6062('0x25')](handleEntityNotFound(_0x26ea7b,null))['then'](removeEntity(_0x26ea7b,null))['catch'](handleError(_0x26ea7b,null));};exports[_0x6062('0x49')]=function(_0x56abd5,_0x3ce5c4){return db[_0x6062('0x2c')][_0x6062('0x49')]()[_0x6062('0x25')](respondWithResult(_0x3ce5c4,null))['catch'](handleError(_0x3ce5c4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b760090..ee2ada7 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0xd55940,_0x70e21d){var _0x39248a=function(_0x3b282a){while(--_0x3b282a){_0xd55940['push'](_0xd55940['shift']());}};_0x39248a(++_0x70e21d);}(_0x326f,0xd1));var _0xf326=function(_0x2ff54b,_0x5a88a5){_0x2ff54b=_0x2ff54b-0x0;var _0xe65fb2=_0x326f[_0x2ff54b];return _0xe65fb2;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x365976,_0x16ca19){var _0x1413e4=function(_0x4d7164){while(--_0x4d7164){_0x365976['push'](_0x365976['shift']());}};_0x1413e4(++_0x16ca19);}(_0x1261,0x144));var _0x1126=function(_0x28bfdc,_0x50fd27){_0x28bfdc=_0x28bfdc-0x0;var _0x25bf45=_0x1261[_0x28bfdc];return _0x25bf45;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 97a0e61..831f07e 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 _0x5204=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4b68a9,_0x29d910){var _0x304c5b=function(_0x34e829){while(--_0x34e829){_0x4b68a9['push'](_0x4b68a9['shift']());}};_0x304c5b(++_0x29d910);}(_0x5204,0xdf));var _0x4520=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0x5204[_0xa4928c];return _0x27cc29;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateOpenchannelQueueReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});};exports[_0x4520('0x1c')]=function(_0x3a4680){var _0x2a8528=this;return new Promise(function(_0x552da1,_0x3774bd){return db[_0x4520('0x18')][_0x4520('0x1d')](_0x3a4680[_0x4520('0x1a')],{'raw':_0x3a4680['options']?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1f')]||null:null,'attributes':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x20')]||null:null,'limit':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')]['limit']||null:null})[_0x4520('0x21')](function(_0x5c1a0b){logger[_0x4520('0xc')](_0x4520('0x1c'),_0x3a4680);logger[_0x4520('0xf')](_0x4520('0x1c'),_0x3a4680,JSON[_0x4520('0x11')](_0x5c1a0b));_0x552da1(_0x5c1a0b);})[_0x4520('0x16')](function(_0x5bb163){logger[_0x4520('0x12')]('UpdateOpenchannelQueueReport',_0x5bb163[_0x4520('0x14')],_0x3a4680);_0x3774bd(_0x2a8528['error'](0x1f4,_0x5bb163[_0x4520('0x14')]));});});}; \ No newline at end of file +var _0xcae2=['where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','then','stringify','update','body'];(function(_0x201e20,_0x5e1c42){var _0x210eea=function(_0x4f5e3e){while(--_0x4f5e3e){_0x201e20['push'](_0x201e20['shift']());}};_0x210eea(++_0x5e1c42);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cae('0x0'));var util=require(_0x2cae('0x1'));var moment=require(_0x2cae('0x2'));var BPromise=require(_0x2cae('0x3'));var rs=require(_0x2cae('0x4'));var fs=require('fs');var Redis=require(_0x2cae('0x5'));var db=require(_0x2cae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cae('0x7'))(_0x2cae('0x8'));var config=require(_0x2cae('0x9'));var jayson=require(_0x2cae('0xa'));var client=jayson['client'][_0x2cae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1feff6,_0x1e1a3d,_0x25b6a2){return new BPromise(function(_0x2e7498,_0x49e1d1){return client['request'](_0x1feff6,_0x25b6a2)['then'](function(_0x49f0d3){logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));logger[_0x2cae('0xf')](_0x2cae('0x10'),_0x1e1a3d,_0x2cae('0xe'),JSON['stringify'](_0x49f0d3));if(_0x49f0d3[_0x2cae('0x11')]){if(_0x49f0d3['error'][_0x2cae('0x12')]===0x1f4){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x49e1d1(_0x49f0d3[_0x2cae('0x11')]['message']);}logger[_0x2cae('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x2e7498(_0x49f0d3['error'][_0x2cae('0x13')]);}else{logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));_0x2e7498(_0x49f0d3['result'][_0x2cae('0x13')]);}})[_0x2cae('0x14')](function(_0x4a89e1){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x4a89e1);_0x49e1d1(_0x4a89e1);});});}exports[_0x2cae('0x15')]=function(_0xe6314f){var _0x2813b1=this;return new Promise(function(_0x164aee,_0x398290){return db[_0x2cae('0x16')]['create'](_0xe6314f['body'],{'raw':_0xe6314f[_0x2cae('0x17')]?_0xe6314f[_0x2cae('0x17')][_0x2cae('0x18')]===undefined?!![]:![]:!![]})[_0x2cae('0x19')](function(_0x2f4f5c){logger[_0x2cae('0xc')](_0x2cae('0x15'),_0xe6314f);logger['debug']('CreateOpenchannelQueueReport',_0xe6314f,JSON[_0x2cae('0x1a')](_0x2f4f5c));_0x164aee(_0x2f4f5c);})[_0x2cae('0x14')](function(_0x5d800e){logger['error']('CreateOpenchannelQueueReport',_0x5d800e[_0x2cae('0x13')],_0xe6314f);_0x398290(_0x2813b1[_0x2cae('0x11')](0x1f4,_0x5d800e['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x309ae3){var _0x1c8063=this;return new Promise(function(_0x407324,_0x2fdc92){return db[_0x2cae('0x16')][_0x2cae('0x1b')](_0x309ae3[_0x2cae('0x1c')],{'raw':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x1d')]||null:null,'attributes':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x1e')]||null:null,'limit':_0x309ae3['options']?_0x309ae3['options']['limit']||null:null})['then'](function(_0x7d5421){logger[_0x2cae('0xc')](_0x2cae('0x1f'),_0x309ae3);logger[_0x2cae('0xf')]('UpdateOpenchannelQueueReport',_0x309ae3,JSON[_0x2cae('0x1a')](_0x7d5421));_0x407324(_0x7d5421);})[_0x2cae('0x14')](function(_0xd53da6){logger['error'](_0x2cae('0x1f'),_0xd53da6['message'],_0x309ae3);_0x2fdc92(_0x1c8063[_0x2cae('0x11')](0x1f4,_0xd53da6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8eb6434..5e871ff 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 _0xac5c=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','create'];(function(_0x2f066e,_0x56a7ff){var _0x3deb5b=function(_0x36bb3f){while(--_0x36bb3f){_0x2f066e['push'](_0x2f066e['shift']());}};_0x3deb5b(++_0x56a7ff);}(_0xac5c,0x122));var _0xcac5=function(_0x4a1f20,_0x44d045){_0x4a1f20=_0x4a1f20-0x0;var _0x43540b=_0xac5c[_0x4a1f20];return _0x43540b;};'use strict';var multer=require(_0xcac5('0x0'));var util=require(_0xcac5('0x1'));var path=require(_0xcac5('0x2'));var timeout=require(_0xcac5('0x3'));var express=require(_0xcac5('0x4'));var router=express[_0xcac5('0x5')]();var fs_extra=require(_0xcac5('0x6'));var auth=require(_0xcac5('0x7'));var interaction=require(_0xcac5('0x8'));var config=require('../../config/environment');var controller=require(_0xcac5('0x9'));router['get']('/',auth[_0xcac5('0xa')](),controller['index']);router[_0xcac5('0xb')](_0xcac5('0xc'),auth[_0xcac5('0xa')](),controller[_0xcac5('0xd')]);router[_0xcac5('0xb')](_0xcac5('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xcac5('0xa')](),controller[_0xcac5('0xf')]);router['put'](_0xcac5('0xe'),auth[_0xcac5('0xa')](),controller[_0xcac5('0x10')]);router['delete'](_0xcac5('0xe'),auth[_0xcac5('0xa')](),controller[_0xcac5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6a7b=['Router','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x323b1e,_0x200ed9){var _0xcd35bd=function(_0x5a68ea){while(--_0x5a68ea){_0x323b1e['push'](_0x323b1e['shift']());}};_0xcd35bd(++_0x200ed9);}(_0x6a7b,0x161));var _0xb6a7=function(_0x3610f1,_0x4112a2){_0x3610f1=_0x3610f1-0x0;var _0x115942=_0x6a7b[_0x3610f1];return _0x115942;};'use strict';var multer=require(_0xb6a7('0x0'));var util=require(_0xb6a7('0x1'));var path=require(_0xb6a7('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6a7('0x3'));var router=express[_0xb6a7('0x4')]();var fs_extra=require(_0xb6a7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb6a7('0x6'));var config=require('../../config/environment');var controller=require(_0xb6a7('0x7'));router[_0xb6a7('0x8')]('/',auth[_0xb6a7('0x9')](),controller[_0xb6a7('0xa')]);router[_0xb6a7('0x8')](_0xb6a7('0xb'),auth['isAuthenticated'](),controller[_0xb6a7('0xc')]);router[_0xb6a7('0x8')](_0xb6a7('0xd'),auth[_0xb6a7('0x9')](),controller['show']);router[_0xb6a7('0xe')]('/',auth[_0xb6a7('0x9')](),controller[_0xb6a7('0xf')]);router[_0xb6a7('0x10')]('/:id',auth[_0xb6a7('0x9')](),controller[_0xb6a7('0x11')]);router[_0xb6a7('0x12')](_0xb6a7('0xd'),auth['isAuthenticated'](),controller[_0xb6a7('0x13')]);module[_0xb6a7('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 45915d0..3a71ffa 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4a1412,_0x2b6ee8){var _0x2cc456=function(_0x2cf4a4){while(--_0x2cf4a4){_0x4a1412['push'](_0x4a1412['shift']());}};_0x2cc456(++_0x2b6ee8);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x370f1b,_0xeca4b0){var _0x20166e=function(_0x2b4bc7){while(--_0x2b4bc7){_0x370f1b['push'](_0x370f1b['shift']());}};_0x20166e(++_0xeca4b0);}(_0xedd9,0xfc));var _0x9edd=function(_0x27a196,_0x226638){_0x27a196=_0x27a196-0x0;var _0x1063fc=_0xedd9[_0x27a196];return _0x1063fc;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index cda0aab..2891e00 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 _0xdc49=['error','stack','name','send','OpenchannelTransferReport','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','body','params','catch','destroy','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xdc49,0x158));var _0x9dc4=function(_0x22101e,_0x548968){_0x22101e=_0x22101e-0x0;var _0x1545ca=_0xdc49[_0x22101e];return _0x1545ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dc4('0x0'));var zipdir=require(_0x9dc4('0x1'));var jsonpatch=require(_0x9dc4('0x2'));var rp=require('request-promise');var moment=require(_0x9dc4('0x3'));var BPromise=require(_0x9dc4('0x4'));var Mustache=require(_0x9dc4('0x5'));var util=require(_0x9dc4('0x6'));var path=require('path');var sox=require(_0x9dc4('0x7'));var csv=require(_0x9dc4('0x8'));var ejs=require(_0x9dc4('0x9'));var fs=require('fs');var fs_extra=require(_0x9dc4('0xa'));var _=require(_0x9dc4('0xb'));var squel=require('squel');var crypto=require(_0x9dc4('0xc'));var jsforce=require(_0x9dc4('0xd'));var deskjs=require(_0x9dc4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9dc4('0xf'));var Papa=require(_0x9dc4('0x10'));var Redis=require(_0x9dc4('0x11'));var authService=require(_0x9dc4('0x12'));var qs=require(_0x9dc4('0x13'));var as=require(_0x9dc4('0x14'));var hardwareService=require(_0x9dc4('0x15'));var logger=require(_0x9dc4('0x16'))(_0x9dc4('0x17'));var utils=require(_0x9dc4('0x18'));var config=require(_0x9dc4('0x19'));var licenseUtil=require(_0x9dc4('0x1a'));var db=require(_0x9dc4('0x1b'))['db'];function respondWithStatusCode(_0x47f80d,_0x4522f9){_0x4522f9=_0x4522f9||0xcc;return function(_0x3fd12d){if(_0x3fd12d){return _0x47f80d[_0x9dc4('0x1c')](_0x4522f9);}return _0x47f80d[_0x9dc4('0x1d')](_0x4522f9)['end']();};}function respondWithResult(_0x2010b7,_0x176012){_0x176012=_0x176012||0xc8;return function(_0x49290e){if(_0x49290e){return _0x2010b7[_0x9dc4('0x1d')](_0x176012)['json'](_0x49290e);}};}function respondWithFilteredResult(_0x5b3021,_0x573718){return function(_0x284723){if(_0x284723){var _0x4c46c1=typeof _0x573718[_0x9dc4('0x1e')]===_0x9dc4('0x1f')&&typeof _0x573718[_0x9dc4('0x20')]===_0x9dc4('0x1f');var _0x328fe4=_0x284723[_0x9dc4('0x21')];var _0x36fdc0=_0x4c46c1?0x0:_0x573718[_0x9dc4('0x1e')];var _0x2e72c4=_0x4c46c1?_0x284723[_0x9dc4('0x21')]:_0x573718[_0x9dc4('0x1e')]+_0x573718['limit'];var _0x4cd860;if(_0x2e72c4>=_0x328fe4){_0x2e72c4=_0x328fe4;_0x4cd860=0xc8;}else{_0x4cd860=0xce;}_0x5b3021[_0x9dc4('0x1d')](_0x4cd860);return _0x5b3021[_0x9dc4('0x22')](_0x9dc4('0x23'),_0x36fdc0+'-'+_0x2e72c4+'/'+_0x328fe4)['json'](_0x284723);}return null;};}function patchUpdates(_0x95b2e2){return function(_0x5e5590){try{jsonpatch[_0x9dc4('0x24')](_0x5e5590,_0x95b2e2,!![]);}catch(_0x251ad5){return BPromise['reject'](_0x251ad5);}return _0x5e5590[_0x9dc4('0x25')]();};}function saveUpdates(_0x2f33f2,_0x5d0cfd){return function(_0x315f34){if(_0x315f34){return _0x315f34[_0x9dc4('0x26')](_0x2f33f2)[_0x9dc4('0x27')](function(_0x89026f){return _0x89026f;});}return null;};}function removeEntity(_0xfcd94,_0x558a41){return function(_0x2195f6){if(_0x2195f6){return _0x2195f6['destroy']()[_0x9dc4('0x27')](function(){_0xfcd94[_0x9dc4('0x1d')](0xcc)[_0x9dc4('0x28')]();});}};}function handleEntityNotFound(_0x3d3332,_0xbb13f5){return function(_0x1b8380){if(!_0x1b8380){_0x3d3332['sendStatus'](0x194);}return _0x1b8380;};}function handleError(_0x45cb66,_0x17c1c4){_0x17c1c4=_0x17c1c4||0x1f4;return function(_0x28ba61){logger[_0x9dc4('0x29')](_0x28ba61[_0x9dc4('0x2a')]);if(_0x28ba61[_0x9dc4('0x2b')]){delete _0x28ba61['name'];}_0x45cb66[_0x9dc4('0x1d')](_0x17c1c4)[_0x9dc4('0x2c')](_0x28ba61);};}exports['index']=function(_0x214252,_0x367132){var _0x914472={},_0x481639={},_0x13cf0d={'count':0x0,'rows':[]};var _0x33ccde=_['map'](db[_0x9dc4('0x2d')]['rawAttributes'],function(_0x439887){return{'name':_0x439887[_0x9dc4('0x2e')],'type':_0x439887[_0x9dc4('0x2f')][_0x9dc4('0x30')]};});_0x481639[_0x9dc4('0x31')]=_[_0x9dc4('0x32')](_0x33ccde,_0x9dc4('0x2b'));_0x481639[_0x9dc4('0x33')]=_[_0x9dc4('0x34')](_0x214252[_0x9dc4('0x33')]);_0x481639['filters']=_[_0x9dc4('0x35')](_0x481639['model'],_0x481639[_0x9dc4('0x33')]);_0x914472[_0x9dc4('0x36')]=_[_0x9dc4('0x35')](_0x481639['model'],qs[_0x9dc4('0x37')](_0x214252[_0x9dc4('0x33')][_0x9dc4('0x37')]));_0x914472[_0x9dc4('0x36')]=_0x914472[_0x9dc4('0x36')][_0x9dc4('0x38')]?_0x914472['attributes']:_0x481639[_0x9dc4('0x31')];if(!_0x214252[_0x9dc4('0x33')][_0x9dc4('0x39')]('nolimit')){_0x914472[_0x9dc4('0x20')]=qs[_0x9dc4('0x20')](_0x214252[_0x9dc4('0x33')][_0x9dc4('0x20')]);_0x914472['offset']=qs[_0x9dc4('0x1e')](_0x214252[_0x9dc4('0x33')][_0x9dc4('0x1e')]);}_0x914472['order']=qs[_0x9dc4('0x3a')](_0x214252['query'][_0x9dc4('0x3a')]);_0x914472[_0x9dc4('0x3b')]=qs[_0x9dc4('0x3c')](_[_0x9dc4('0x3d')](_0x214252[_0x9dc4('0x33')],_0x481639['filters']),_0x33ccde);if(_0x214252['query'][_0x9dc4('0x3e')]){_0x914472[_0x9dc4('0x3b')]=_[_0x9dc4('0x3f')](_0x914472['where'],{'$or':_[_0x9dc4('0x32')](_0x33ccde,function(_0x4f8a6d){if(_0x4f8a6d[_0x9dc4('0x2f')]!==_0x9dc4('0x40')){var _0x239370={};_0x239370[_0x4f8a6d[_0x9dc4('0x2b')]]={'$like':'%'+_0x214252[_0x9dc4('0x33')][_0x9dc4('0x3e')]+'%'};return _0x239370;}})});}_0x914472=_['merge']({},_0x914472,_0x214252[_0x9dc4('0x41')]);var _0x2457ec={'where':_0x914472[_0x9dc4('0x3b')]};return db[_0x9dc4('0x2d')][_0x9dc4('0x21')](_0x2457ec)[_0x9dc4('0x27')](function(_0x430fc6){_0x13cf0d[_0x9dc4('0x21')]=_0x430fc6;if(_0x214252[_0x9dc4('0x33')]['includeAll']){_0x914472[_0x9dc4('0x42')]=[{'all':!![]}];}return db[_0x9dc4('0x2d')][_0x9dc4('0x43')](_0x914472);})[_0x9dc4('0x27')](function(_0x1aedc4){_0x13cf0d[_0x9dc4('0x44')]=_0x1aedc4;return _0x13cf0d;})['then'](respondWithFilteredResult(_0x367132,_0x914472))['catch'](handleError(_0x367132,null));};exports[_0x9dc4('0x45')]=function(_0x4a8199,_0xd1116a){var _0x5e4cd0={'raw':!![],'where':{'id':_0x4a8199['params']['id']}},_0x5efd82={};_0x5efd82['model']=_[_0x9dc4('0x34')](db[_0x9dc4('0x2d')]['rawAttributes']);_0x5efd82[_0x9dc4('0x33')]=_[_0x9dc4('0x34')](_0x4a8199[_0x9dc4('0x33')]);_0x5efd82[_0x9dc4('0x3c')]=_[_0x9dc4('0x35')](_0x5efd82[_0x9dc4('0x31')],_0x5efd82[_0x9dc4('0x33')]);_0x5e4cd0[_0x9dc4('0x36')]=_[_0x9dc4('0x35')](_0x5efd82[_0x9dc4('0x31')],qs[_0x9dc4('0x37')](_0x4a8199[_0x9dc4('0x33')]['fields']));_0x5e4cd0['attributes']=_0x5e4cd0[_0x9dc4('0x36')][_0x9dc4('0x38')]?_0x5e4cd0['attributes']:_0x5efd82[_0x9dc4('0x31')];if(_0x4a8199[_0x9dc4('0x33')][_0x9dc4('0x46')]){_0x5e4cd0[_0x9dc4('0x42')]=[{'all':!![]}];}_0x5e4cd0=_[_0x9dc4('0x3f')]({},_0x5e4cd0,_0x4a8199[_0x9dc4('0x41')]);return db[_0x9dc4('0x2d')]['find'](_0x5e4cd0)['then'](handleEntityNotFound(_0xd1116a,null))[_0x9dc4('0x27')](respondWithResult(_0xd1116a,null))['catch'](handleError(_0xd1116a,null));};exports['create']=function(_0x30ec8c,_0x228e45){return db[_0x9dc4('0x2d')]['create'](_0x30ec8c[_0x9dc4('0x47')],{})[_0x9dc4('0x27')](respondWithResult(_0x228e45,0xc9))['catch'](handleError(_0x228e45,null));};exports[_0x9dc4('0x26')]=function(_0x19b675,_0x797770){if(_0x19b675[_0x9dc4('0x47')]['id']){delete _0x19b675[_0x9dc4('0x47')]['id'];}return db[_0x9dc4('0x2d')]['find']({'where':{'id':_0x19b675[_0x9dc4('0x48')]['id']}})[_0x9dc4('0x27')](handleEntityNotFound(_0x797770,null))[_0x9dc4('0x27')](saveUpdates(_0x19b675[_0x9dc4('0x47')],null))[_0x9dc4('0x27')](respondWithResult(_0x797770,null))[_0x9dc4('0x49')](handleError(_0x797770,null));};exports[_0x9dc4('0x4a')]=function(_0x52a0a3,_0x15af3f){return db['OpenchannelTransferReport'][_0x9dc4('0x4b')]({'where':{'id':_0x52a0a3['params']['id']}})['then'](handleEntityNotFound(_0x15af3f,null))['then'](removeEntity(_0x15af3f,null))[_0x9dc4('0x49')](handleError(_0x15af3f,null));};exports[_0x9dc4('0x4c')]=function(_0x6c45f9,_0x9946b9){return db[_0x9dc4('0x2d')][_0x9dc4('0x4c')]()[_0x9dc4('0x27')](respondWithResult(_0x9946b9,null))[_0x9dc4('0x49')](handleError(_0x9946b9,null));}; \ No newline at end of file +var _0x2998=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','OpenchannelTransferReport','includeAll','rows','catch','show','params','intersection','merge','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x2998,0xd4));var _0x8299=function(_0x4b571f,_0x3fa898){_0x4b571f=_0x4b571f-0x0;var _0x5e8026=_0x2998[_0x4b571f];return _0x5e8026;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8299('0x0'));var jsonpatch=require(_0x8299('0x1'));var rp=require(_0x8299('0x2'));var moment=require(_0x8299('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8299('0x4'));var util=require(_0x8299('0x5'));var path=require(_0x8299('0x6'));var sox=require('sox');var csv=require(_0x8299('0x7'));var ejs=require(_0x8299('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8299('0x9'));var crypto=require(_0x8299('0xa'));var jsforce=require(_0x8299('0xb'));var deskjs=require(_0x8299('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8299('0xd'));var Papa=require(_0x8299('0xe'));var Redis=require(_0x8299('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8299('0x10'));var as=require(_0x8299('0x11'));var hardwareService=require(_0x8299('0x12'));var logger=require(_0x8299('0x13'))(_0x8299('0x14'));var utils=require('../../config/utils');var config=require(_0x8299('0x15'));var licenseUtil=require(_0x8299('0x16'));var db=require(_0x8299('0x17'))['db'];function respondWithStatusCode(_0x4c7662,_0xf7e9d8){_0xf7e9d8=_0xf7e9d8||0xcc;return function(_0x3bb591){if(_0x3bb591){return _0x4c7662[_0x8299('0x18')](_0xf7e9d8);}return _0x4c7662[_0x8299('0x19')](_0xf7e9d8)[_0x8299('0x1a')]();};}function respondWithResult(_0x52f3f9,_0x2ff97c){_0x2ff97c=_0x2ff97c||0xc8;return function(_0x24818c){if(_0x24818c){return _0x52f3f9[_0x8299('0x19')](_0x2ff97c)[_0x8299('0x1b')](_0x24818c);}};}function respondWithFilteredResult(_0xba4ca7,_0x3d72b4){return function(_0x59c57f){if(_0x59c57f){var _0x3ddf78=typeof _0x3d72b4[_0x8299('0x1c')]===_0x8299('0x1d')&&typeof _0x3d72b4[_0x8299('0x1e')]==='undefined';var _0x4717b5=_0x59c57f[_0x8299('0x1f')];var _0x2f0232=_0x3ddf78?0x0:_0x3d72b4[_0x8299('0x1c')];var _0x2b24bb=_0x3ddf78?_0x59c57f[_0x8299('0x1f')]:_0x3d72b4[_0x8299('0x1c')]+_0x3d72b4[_0x8299('0x1e')];var _0x16fca8;if(_0x2b24bb>=_0x4717b5){_0x2b24bb=_0x4717b5;_0x16fca8=0xc8;}else{_0x16fca8=0xce;}_0xba4ca7[_0x8299('0x19')](_0x16fca8);return _0xba4ca7[_0x8299('0x20')](_0x8299('0x21'),_0x2f0232+'-'+_0x2b24bb+'/'+_0x4717b5)['json'](_0x59c57f);}return null;};}function patchUpdates(_0x35f541){return function(_0x7d1759){try{jsonpatch[_0x8299('0x22')](_0x7d1759,_0x35f541,!![]);}catch(_0x3436e2){return BPromise['reject'](_0x3436e2);}return _0x7d1759['save']();};}function saveUpdates(_0x5672b3,_0x29f909){return function(_0x56e5ad){if(_0x56e5ad){return _0x56e5ad[_0x8299('0x23')](_0x5672b3)['then'](function(_0x186083){return _0x186083;});}return null;};}function removeEntity(_0x47310f,_0x516e8f){return function(_0xe85e94){if(_0xe85e94){return _0xe85e94[_0x8299('0x24')]()[_0x8299('0x25')](function(){_0x47310f[_0x8299('0x19')](0xcc)[_0x8299('0x1a')]();});}};}function handleEntityNotFound(_0x211606,_0x2438a9){return function(_0x4de85a){if(!_0x4de85a){_0x211606[_0x8299('0x18')](0x194);}return _0x4de85a;};}function handleError(_0xeec197,_0x34bd71){_0x34bd71=_0x34bd71||0x1f4;return function(_0x4bdafe){logger[_0x8299('0x26')](_0x4bdafe[_0x8299('0x27')]);if(_0x4bdafe[_0x8299('0x28')]){delete _0x4bdafe[_0x8299('0x28')];}_0xeec197[_0x8299('0x19')](_0x34bd71)[_0x8299('0x29')](_0x4bdafe);};}exports[_0x8299('0x2a')]=function(_0x3da92e,_0x43397a){var _0x1747cb={},_0x110419={},_0x2f06b0={'count':0x0,'rows':[]};var _0x20de3a=_[_0x8299('0x2b')](db['OpenchannelTransferReport'][_0x8299('0x2c')],function(_0x79cf8){return{'name':_0x79cf8['fieldName'],'type':_0x79cf8[_0x8299('0x2d')][_0x8299('0x2e')]};});_0x110419['model']=_[_0x8299('0x2b')](_0x20de3a,_0x8299('0x28'));_0x110419[_0x8299('0x2f')]=_[_0x8299('0x30')](_0x3da92e[_0x8299('0x2f')]);_0x110419['filters']=_['intersection'](_0x110419['model'],_0x110419[_0x8299('0x2f')]);_0x1747cb[_0x8299('0x31')]=_['intersection'](_0x110419[_0x8299('0x32')],qs['fields'](_0x3da92e['query'][_0x8299('0x33')]));_0x1747cb[_0x8299('0x31')]=_0x1747cb[_0x8299('0x31')][_0x8299('0x34')]?_0x1747cb[_0x8299('0x31')]:_0x110419[_0x8299('0x32')];if(!_0x3da92e[_0x8299('0x2f')][_0x8299('0x35')](_0x8299('0x36'))){_0x1747cb[_0x8299('0x1e')]=qs[_0x8299('0x1e')](_0x3da92e[_0x8299('0x2f')]['limit']);_0x1747cb[_0x8299('0x1c')]=qs['offset'](_0x3da92e[_0x8299('0x2f')][_0x8299('0x1c')]);}_0x1747cb[_0x8299('0x37')]=qs[_0x8299('0x38')](_0x3da92e[_0x8299('0x2f')]['sort']);_0x1747cb[_0x8299('0x39')]=qs['filters'](_[_0x8299('0x3a')](_0x3da92e[_0x8299('0x2f')],_0x110419[_0x8299('0x3b')]),_0x20de3a);if(_0x3da92e[_0x8299('0x2f')][_0x8299('0x3c')]){_0x1747cb[_0x8299('0x39')]=_['merge'](_0x1747cb['where'],{'$or':_[_0x8299('0x2b')](_0x20de3a,function(_0x4d431f){if(_0x4d431f[_0x8299('0x2d')]!==_0x8299('0x3d')){var _0x3505c3={};_0x3505c3[_0x4d431f[_0x8299('0x28')]]={'$like':'%'+_0x3da92e[_0x8299('0x2f')]['filter']+'%'};return _0x3505c3;}})});}_0x1747cb=_['merge']({},_0x1747cb,_0x3da92e['options']);var _0x222e2f={'where':_0x1747cb[_0x8299('0x39')]};return db[_0x8299('0x3e')]['count'](_0x222e2f)['then'](function(_0x39014b){_0x2f06b0[_0x8299('0x1f')]=_0x39014b;if(_0x3da92e['query'][_0x8299('0x3f')]){_0x1747cb['include']=[{'all':!![]}];}return db[_0x8299('0x3e')]['findAll'](_0x1747cb);})['then'](function(_0x17bfa2){_0x2f06b0[_0x8299('0x40')]=_0x17bfa2;return _0x2f06b0;})[_0x8299('0x25')](respondWithFilteredResult(_0x43397a,_0x1747cb))[_0x8299('0x41')](handleError(_0x43397a,null));};exports[_0x8299('0x42')]=function(_0x4135db,_0x21e3c8){var _0x4dfa48={'raw':!![],'where':{'id':_0x4135db[_0x8299('0x43')]['id']}},_0x407c34={};_0x407c34[_0x8299('0x32')]=_[_0x8299('0x30')](db[_0x8299('0x3e')][_0x8299('0x2c')]);_0x407c34[_0x8299('0x2f')]=_[_0x8299('0x30')](_0x4135db['query']);_0x407c34['filters']=_['intersection'](_0x407c34['model'],_0x407c34['query']);_0x4dfa48['attributes']=_[_0x8299('0x44')](_0x407c34['model'],qs['fields'](_0x4135db[_0x8299('0x2f')]['fields']));_0x4dfa48[_0x8299('0x31')]=_0x4dfa48[_0x8299('0x31')][_0x8299('0x34')]?_0x4dfa48[_0x8299('0x31')]:_0x407c34[_0x8299('0x32')];if(_0x4135db['query']['includeAll']){_0x4dfa48['include']=[{'all':!![]}];}_0x4dfa48=_[_0x8299('0x45')]({},_0x4dfa48,_0x4135db['options']);return db[_0x8299('0x3e')][_0x8299('0x46')](_0x4dfa48)[_0x8299('0x25')](handleEntityNotFound(_0x21e3c8,null))[_0x8299('0x25')](respondWithResult(_0x21e3c8,null))[_0x8299('0x41')](handleError(_0x21e3c8,null));};exports['create']=function(_0x27edf4,_0x41a9ae){return db[_0x8299('0x3e')][_0x8299('0x47')](_0x27edf4[_0x8299('0x48')],{})[_0x8299('0x25')](respondWithResult(_0x41a9ae,0xc9))[_0x8299('0x41')](handleError(_0x41a9ae,null));};exports[_0x8299('0x23')]=function(_0x1be749,_0x4a334c){if(_0x1be749['body']['id']){delete _0x1be749[_0x8299('0x48')]['id'];}return db[_0x8299('0x3e')]['find']({'where':{'id':_0x1be749[_0x8299('0x43')]['id']}})[_0x8299('0x25')](handleEntityNotFound(_0x4a334c,null))['then'](saveUpdates(_0x1be749[_0x8299('0x48')],null))[_0x8299('0x25')](respondWithResult(_0x4a334c,null))['catch'](handleError(_0x4a334c,null));};exports['destroy']=function(_0xf649e2,_0x1d4d9b){return db[_0x8299('0x3e')][_0x8299('0x46')]({'where':{'id':_0xf649e2[_0x8299('0x43')]['id']}})[_0x8299('0x25')](handleEntityNotFound(_0x1d4d9b,null))[_0x8299('0x25')](removeEntity(_0x1d4d9b,null))[_0x8299('0x41')](handleError(_0x1d4d9b,null));};exports[_0x8299('0x49')]=function(_0x3f9256,_0x466029){return db['OpenchannelTransferReport'][_0x8299('0x49')]()[_0x8299('0x25')](respondWithResult(_0x466029,null))[_0x8299('0x41')](handleError(_0x466029,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c54bd63..e5ceffd 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 _0xf87b=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x47d43d,_0x3ea066){var _0x3307f9=function(_0x1da2b8){while(--_0x1da2b8){_0x47d43d['push'](_0x47d43d['shift']());}};_0x3307f9(++_0x3ea066);}(_0xf87b,0x12d));var _0xbf87=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf87b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xbf87('0x0'));var logger=require(_0xbf87('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbf87('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf87('0x3'));var rimraf=require(_0xbf87('0x4'));var config=require(_0xbf87('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0xbf87('0x6')]=function(_0x21fd17,_0x5f64f4){return _0x21fd17[_0xbf87('0x7')](_0xbf87('0x8'),attributes,{'tableName':_0xbf87('0x9'),'paranoid':![],'indexes':[{'name':_0xbf87('0xa'),'fields':[_0xbf87('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1d4=['../../config/logger','api','moment','bluebird','request-promise','path','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','util'];(function(_0x4fa0e6,_0x5e2464){var _0x43ec33=function(_0x591eb3){while(--_0x591eb3){_0x4fa0e6['push'](_0x4fa0e6['shift']());}};_0x43ec33(++_0x5e2464);}(_0xb1d4,0x14f));var _0x4b1d=function(_0x48326a,_0x8cfa0c){_0x48326a=_0x48326a-0x0;var _0x466709=_0xb1d4[_0x48326a];return _0x466709;};'use strict';var _=require('lodash');var util=require(_0x4b1d('0x0'));var logger=require(_0x4b1d('0x1'))(_0x4b1d('0x2'));var moment=require(_0x4b1d('0x3'));var BPromise=require(_0x4b1d('0x4'));var rp=require(_0x4b1d('0x5'));var fs=require('fs');var path=require(_0x4b1d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4b1d('0x7'));module[_0x4b1d('0x8')]=function(_0x27f4be,_0x1a5331){return _0x27f4be[_0x4b1d('0x9')](_0x4b1d('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4b1d('0xb'),'fields':[_0x4b1d('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 07a8e28..d0d3b96 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 _0xf69d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2a913b,_0x19676e){var _0xa143d=function(_0x1ad3b8){while(--_0x1ad3b8){_0x2a913b['push'](_0x2a913b['shift']());}};_0xa143d(++_0x19676e);}(_0xf69d,0xd3));var _0xdf69=function(_0x531743,_0x2df4cf){_0x531743=_0x531743-0x0;var _0x2ea72f=_0xf69d[_0x531743];return _0x2ea72f;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});} \ No newline at end of file +var _0x7a08=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x7a08,0x11e));var _0x87a0=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x7a08[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x87a0('0x2'));var fs=require('fs');var Redis=require(_0x87a0('0x3'));var db=require(_0x87a0('0x4'))['db'];var utils=require(_0x87a0('0x5'));var logger=require(_0x87a0('0x6'))(_0x87a0('0x7'));var config=require(_0x87a0('0x8'));var jayson=require(_0x87a0('0x9'));var client=jayson[_0x87a0('0xa')][_0x87a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xde806e,_0x584442,_0x27736f){return new BPromise(function(_0x1bb04b,_0x18185c){return client[_0x87a0('0xc')](_0xde806e,_0x27736f)[_0x87a0('0xd')](function(_0x515301){logger['info'](_0x87a0('0xe'),_0x584442,_0x87a0('0xf'));logger[_0x87a0('0x10')](_0x87a0('0x11'),_0x584442,_0x87a0('0xf'),JSON['stringify'](_0x515301));if(_0x515301[_0x87a0('0x12')]){if(_0x515301[_0x87a0('0x12')][_0x87a0('0x13')]===0x1f4){logger['error'](_0x87a0('0xe'),_0x584442,_0x515301[_0x87a0('0x12')][_0x87a0('0x14')]);return _0x18185c(_0x515301[_0x87a0('0x12')]['message']);}logger[_0x87a0('0x12')](_0x87a0('0xe'),_0x584442,_0x515301[_0x87a0('0x12')]['message']);return _0x1bb04b(_0x515301[_0x87a0('0x12')][_0x87a0('0x14')]);}else{logger[_0x87a0('0x15')](_0x87a0('0xe'),_0x584442,'request\x20sent');_0x1bb04b(_0x515301[_0x87a0('0x16')]['message']);}})[_0x87a0('0x17')](function(_0x410490){logger[_0x87a0('0x12')](_0x87a0('0xe'),_0x584442,_0x410490);_0x18185c(_0x410490);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d17dda3..f9737ef 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 _0x8ba0=['./pause.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4be48c,_0x262a21){var _0x3c5b29=function(_0x48eb66){while(--_0x48eb66){_0x4be48c['push'](_0x4be48c['shift']());}};_0x3c5b29(++_0x262a21);}(_0x8ba0,0xd0));var _0x08ba=function(_0x3e9991,_0x4867d7){_0x3e9991=_0x3e9991-0x0;var _0x4a70a5=_0x8ba0[_0x3e9991];return _0x4a70a5;};'use strict';var multer=require(_0x08ba('0x0'));var util=require('util');var path=require(_0x08ba('0x1'));var timeout=require(_0x08ba('0x2'));var express=require(_0x08ba('0x3'));var router=express['Router']();var fs_extra=require(_0x08ba('0x4'));var auth=require(_0x08ba('0x5'));var interaction=require(_0x08ba('0x6'));var config=require(_0x08ba('0x7'));var controller=require(_0x08ba('0x8'));router[_0x08ba('0x9')]('/',auth[_0x08ba('0xa')](),controller[_0x08ba('0xb')]);router[_0x08ba('0x9')](_0x08ba('0xc'),auth[_0x08ba('0xa')](),controller[_0x08ba('0xd')]);router[_0x08ba('0xe')]('/',auth[_0x08ba('0xa')](),controller['create']);router[_0x08ba('0xf')]('/:id',auth[_0x08ba('0xa')](),controller['update']);router[_0x08ba('0x10')](_0x08ba('0xc'),auth[_0x08ba('0xa')](),controller[_0x08ba('0x11')]);module['exports']=router; \ No newline at end of file +var _0x85e6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0x262624,_0x2dac03){var _0x3f5b0a=function(_0x18e7f8){while(--_0x18e7f8){_0x262624['push'](_0x262624['shift']());}};_0x3f5b0a(++_0x2dac03);}(_0x85e6,0xa6));var _0x685e=function(_0x443957,_0x65308c){_0x443957=_0x443957-0x0;var _0x44bf41=_0x85e6[_0x443957];return _0x44bf41;};'use strict';var multer=require(_0x685e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x685e('0x1'));var express=require(_0x685e('0x2'));var router=express['Router']();var fs_extra=require(_0x685e('0x3'));var auth=require(_0x685e('0x4'));var interaction=require(_0x685e('0x5'));var config=require(_0x685e('0x6'));var controller=require(_0x685e('0x7'));router[_0x685e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x685e('0x9'),auth[_0x685e('0xa')](),controller[_0x685e('0xb')]);router[_0x685e('0xc')]('/',auth[_0x685e('0xa')](),controller[_0x685e('0xd')]);router['put']('/:id',auth[_0x685e('0xa')](),controller['update']);router[_0x685e('0xe')]('/:id',auth[_0x685e('0xa')](),controller[_0x685e('0xf')]);module[_0x685e('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index add5939..3eec875 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 _0x6929=['name','sequelize','exports','STRING'];(function(_0x34db21,_0x4256bb){var _0x5e7d82=function(_0x5bee79){while(--_0x5bee79){_0x34db21['push'](_0x34db21['shift']());}};_0x5e7d82(++_0x4256bb);}(_0x6929,0x175));var _0x9692=function(_0x43450f,_0x109af9){_0x43450f=_0x43450f-0x0;var _0x496603=_0x6929[_0x43450f];return _0x496603;};'use strict';var Sequelize=require(_0x9692('0x0'));module[_0x9692('0x1')]={'name':{'type':Sequelize[_0x9692('0x2')],'unique':_0x9692('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9692('0x2')]}}; \ No newline at end of file +var _0x9340=['exports'];(function(_0x55f202,_0xbe6b3){var _0x28d7e6=function(_0x29db8e){while(--_0x29db8e){_0x55f202['push'](_0x55f202['shift']());}};_0x28d7e6(++_0xbe6b3);}(_0x9340,0x188));var _0x0934=function(_0xb157a0,_0x326c91){_0xb157a0=_0xb157a0-0x0;var _0x1a674b=_0x9340[_0xb157a0];return _0x1a674b;};'use strict';var Sequelize=require('sequelize');module[_0x0934('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 63dcd8e..1abe7d9 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 _0x7795=['UserProfileResource','end','error','stack','name','index','map','Pause','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','Pauses'];(function(_0x5be5ab,_0x2800ba){var _0x5008e8=function(_0x58e48d){while(--_0x58e48d){_0x5be5ab['push'](_0x5be5ab['shift']());}};_0x5008e8(++_0x2800ba);}(_0x7795,0x160));var _0x5779=function(_0x17a2d9,_0xf8c5a9){_0x17a2d9=_0x17a2d9-0x0;var _0xcf62a6=_0x7795[_0x17a2d9];return _0xcf62a6;};'use strict';var emlformat=require(_0x5779('0x0'));var rimraf=require(_0x5779('0x1'));var zipdir=require(_0x5779('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5779('0x3'));var moment=require(_0x5779('0x4'));var BPromise=require(_0x5779('0x5'));var Mustache=require(_0x5779('0x6'));var util=require('util');var path=require(_0x5779('0x7'));var sox=require(_0x5779('0x8'));var csv=require(_0x5779('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5779('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5779('0xb'));var deskjs=require(_0x5779('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5779('0xd'));var Papa=require('papaparse');var Redis=require(_0x5779('0xe'));var authService=require(_0x5779('0xf'));var qs=require(_0x5779('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5779('0x11'));var logger=require('../../config/logger')(_0x5779('0x12'));var utils=require('../../config/utils');var config=require(_0x5779('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fe5f4,_0x46535b){_0x46535b=_0x46535b||0xcc;return function(_0x2a0be7){if(_0x2a0be7){return _0x1fe5f4[_0x5779('0x14')](_0x46535b);}return _0x1fe5f4[_0x5779('0x15')](_0x46535b)['end']();};}function respondWithResult(_0x1312ff,_0x24fa6c){_0x24fa6c=_0x24fa6c||0xc8;return function(_0xd2d126){if(_0xd2d126){return _0x1312ff['status'](_0x24fa6c)[_0x5779('0x16')](_0xd2d126);}};}function respondWithFilteredResult(_0x48b624,_0x54bf40){return function(_0x19bff1){if(_0x19bff1){var _0x948010=typeof _0x54bf40[_0x5779('0x17')]===_0x5779('0x18')&&typeof _0x54bf40[_0x5779('0x19')]===_0x5779('0x18');var _0x4d92d1=_0x19bff1['count'];var _0x226b53=_0x948010?0x0:_0x54bf40[_0x5779('0x17')];var _0x540d71=_0x948010?_0x19bff1[_0x5779('0x1a')]:_0x54bf40[_0x5779('0x17')]+_0x54bf40[_0x5779('0x19')];var _0x448f5f;if(_0x540d71>=_0x4d92d1){_0x540d71=_0x4d92d1;_0x448f5f=0xc8;}else{_0x448f5f=0xce;}_0x48b624[_0x5779('0x15')](_0x448f5f);return _0x48b624['set'](_0x5779('0x1b'),_0x226b53+'-'+_0x540d71+'/'+_0x4d92d1)[_0x5779('0x16')](_0x19bff1);}return null;};}function patchUpdates(_0x47559e){return function(_0x2aaab1){try{jsonpatch['apply'](_0x2aaab1,_0x47559e,!![]);}catch(_0x57ac1b){return BPromise[_0x5779('0x1c')](_0x57ac1b);}return _0x2aaab1['save']();};}function saveUpdates(_0x25cf61,_0x432611){return function(_0x48ccc2){if(_0x48ccc2){return _0x48ccc2[_0x5779('0x1d')](_0x25cf61)[_0x5779('0x1e')](function(_0xd2d32e){return _0xd2d32e;});}return null;};}function removeEntity(_0x5d2957,_0x19f4b2){return function(_0x1d5364){if(_0x1d5364){return _0x1d5364[_0x5779('0x1f')]()[_0x5779('0x1e')](function(){var _0x29386f=_0x1d5364['get']({'plain':!![]});var _0x14db3e=_0x5779('0x20');return db[_0x5779('0x21')][_0x5779('0x1f')]({'where':{'type':_0x14db3e,'resourceId':_0x29386f['id']}})[_0x5779('0x1e')](function(){return _0x1d5364;});})[_0x5779('0x1e')](function(){_0x5d2957[_0x5779('0x15')](0xcc)[_0x5779('0x22')]();});}};}function handleEntityNotFound(_0xca4779,_0x156e5){return function(_0x48b7f0){if(!_0x48b7f0){_0xca4779[_0x5779('0x14')](0x194);}return _0x48b7f0;};}function handleError(_0x45d827,_0x128832){_0x128832=_0x128832||0x1f4;return function(_0x1210e0){logger[_0x5779('0x23')](_0x1210e0[_0x5779('0x24')]);if(_0x1210e0[_0x5779('0x25')]){delete _0x1210e0[_0x5779('0x25')];}_0x45d827[_0x5779('0x15')](_0x128832)['send'](_0x1210e0);};}exports[_0x5779('0x26')]=function(_0x58de46,_0x525872){var _0x2df92d={},_0x5347e5={},_0x4ee110={'count':0x0,'rows':[]};var _0x84d1b2=_[_0x5779('0x27')](db[_0x5779('0x28')][_0x5779('0x29')],function(_0x4d6c8e){return{'name':_0x4d6c8e['fieldName'],'type':_0x4d6c8e['type'][_0x5779('0x2a')]};});_0x5347e5[_0x5779('0x2b')]=_[_0x5779('0x27')](_0x84d1b2,_0x5779('0x25'));_0x5347e5[_0x5779('0x2c')]=_[_0x5779('0x2d')](_0x58de46[_0x5779('0x2c')]);_0x5347e5[_0x5779('0x2e')]=_['intersection'](_0x5347e5[_0x5779('0x2b')],_0x5347e5[_0x5779('0x2c')]);_0x2df92d[_0x5779('0x2f')]=_[_0x5779('0x30')](_0x5347e5['model'],qs['fields'](_0x58de46[_0x5779('0x2c')][_0x5779('0x31')]));_0x2df92d['attributes']=_0x2df92d[_0x5779('0x2f')]['length']?_0x2df92d[_0x5779('0x2f')]:_0x5347e5[_0x5779('0x2b')];if(!_0x58de46['query'][_0x5779('0x32')](_0x5779('0x33'))){_0x2df92d[_0x5779('0x19')]=qs[_0x5779('0x19')](_0x58de46[_0x5779('0x2c')][_0x5779('0x19')]);_0x2df92d['offset']=qs[_0x5779('0x17')](_0x58de46['query']['offset']);}_0x2df92d['order']=qs[_0x5779('0x34')](_0x58de46['query']['sort']);_0x2df92d[_0x5779('0x35')]=qs[_0x5779('0x2e')](_[_0x5779('0x36')](_0x58de46[_0x5779('0x2c')],_0x5347e5['filters']),_0x84d1b2);if(_0x58de46[_0x5779('0x2c')]['filter']){_0x2df92d[_0x5779('0x35')]=_[_0x5779('0x37')](_0x2df92d[_0x5779('0x35')],{'$or':_[_0x5779('0x27')](_0x84d1b2,function(_0x501c67){if(_0x501c67[_0x5779('0x38')]!=='VIRTUAL'){var _0x2f96c6={};_0x2f96c6[_0x501c67['name']]={'$like':'%'+_0x58de46[_0x5779('0x2c')][_0x5779('0x39')]+'%'};return _0x2f96c6;}})});}_0x2df92d=_['merge']({},_0x2df92d,_0x58de46[_0x5779('0x3a')]);var _0xa0217={'where':_0x2df92d[_0x5779('0x35')]};return db[_0x5779('0x28')][_0x5779('0x1a')](_0xa0217)['then'](function(_0x18d8eb){_0x4ee110[_0x5779('0x1a')]=_0x18d8eb;if(_0x58de46['query'][_0x5779('0x3b')]){_0x2df92d[_0x5779('0x3c')]=[{'all':!![]}];}return db[_0x5779('0x28')][_0x5779('0x3d')](_0x2df92d);})[_0x5779('0x1e')](function(_0x408dd4){_0x4ee110[_0x5779('0x3e')]=_0x408dd4;return _0x4ee110;})[_0x5779('0x1e')](respondWithFilteredResult(_0x525872,_0x2df92d))[_0x5779('0x3f')](handleError(_0x525872,null));};exports[_0x5779('0x40')]=function(_0x513412,_0x2bc624){var _0x548219={'raw':!![],'where':{'id':_0x513412[_0x5779('0x41')]['id']}},_0x2398dd={};_0x2398dd[_0x5779('0x2b')]=_[_0x5779('0x2d')](db[_0x5779('0x28')][_0x5779('0x29')]);_0x2398dd[_0x5779('0x2c')]=_[_0x5779('0x2d')](_0x513412[_0x5779('0x2c')]);_0x2398dd[_0x5779('0x2e')]=_[_0x5779('0x30')](_0x2398dd[_0x5779('0x2b')],_0x2398dd[_0x5779('0x2c')]);_0x548219[_0x5779('0x2f')]=_[_0x5779('0x30')](_0x2398dd[_0x5779('0x2b')],qs['fields'](_0x513412[_0x5779('0x2c')]['fields']));_0x548219[_0x5779('0x2f')]=_0x548219[_0x5779('0x2f')][_0x5779('0x42')]?_0x548219[_0x5779('0x2f')]:_0x2398dd[_0x5779('0x2b')];if(_0x513412['query']['includeAll']){_0x548219[_0x5779('0x3c')]=[{'all':!![]}];}_0x548219=_[_0x5779('0x37')]({},_0x548219,_0x513412['options']);return db[_0x5779('0x28')]['find'](_0x548219)[_0x5779('0x1e')](handleEntityNotFound(_0x2bc624,null))[_0x5779('0x1e')](respondWithResult(_0x2bc624,null))['catch'](handleError(_0x2bc624,null));};exports[_0x5779('0x43')]=function(_0x335aca,_0x4ea4c5){return db[_0x5779('0x28')][_0x5779('0x43')](_0x335aca['body'],{})[_0x5779('0x1e')](function(_0x3489c1){var _0x455bd4=_0x335aca['user'][_0x5779('0x44')]({'plain':!![]});if(!_0x455bd4)throw new Error(_0x5779('0x45'));if(_0x455bd4[_0x5779('0x46')]===_0x5779('0x47')){var _0x39a71e=_0x3489c1[_0x5779('0x44')]({'plain':!![]});var _0x5b146c=_0x5779('0x20');return db[_0x5779('0x48')][_0x5779('0x49')]({'where':{'name':_0x5b146c,'userProfileId':_0x455bd4[_0x5779('0x4a')]},'raw':!![]})[_0x5779('0x1e')](function(_0x54e8c3){if(_0x54e8c3&&_0x54e8c3['autoAssociation']===0x0){return db[_0x5779('0x21')][_0x5779('0x43')]({'name':_0x39a71e[_0x5779('0x25')],'resourceId':_0x39a71e['id'],'type':_0x54e8c3[_0x5779('0x25')],'sectionId':_0x54e8c3['id']},{})[_0x5779('0x1e')](function(){return _0x3489c1;});}else{return _0x3489c1;}})[_0x5779('0x3f')](function(_0x414d5c){logger[_0x5779('0x23')](_0x5779('0x4b'),_0x414d5c);throw _0x414d5c;});}return _0x3489c1;})[_0x5779('0x1e')](respondWithResult(_0x4ea4c5,0xc9))[_0x5779('0x3f')](handleError(_0x4ea4c5,null));};exports[_0x5779('0x1d')]=function(_0x54500e,_0x2bae48){if(_0x54500e[_0x5779('0x4c')]['id']){delete _0x54500e[_0x5779('0x4c')]['id'];}return db['Pause'][_0x5779('0x49')]({'where':{'id':_0x54500e[_0x5779('0x41')]['id']}})['then'](handleEntityNotFound(_0x2bae48,null))[_0x5779('0x1e')](saveUpdates(_0x54500e[_0x5779('0x4c')],null))[_0x5779('0x1e')](respondWithResult(_0x2bae48,null))[_0x5779('0x3f')](handleError(_0x2bae48,null));};exports[_0x5779('0x1f')]=function(_0x231290,_0x281d06){return db[_0x5779('0x28')][_0x5779('0x49')]({'where':{'id':_0x231290[_0x5779('0x41')]['id']}})[_0x5779('0x1e')](handleEntityNotFound(_0x281d06,null))['then'](removeEntity(_0x281d06,null))['catch'](handleError(_0x281d06,null));}; \ No newline at end of file +var _0x7d53=['options','includeAll','findAll','catch','show','params','rawAttributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','name','send','index','map','Pause','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','type','VIRTUAL'];(function(_0x389a03,_0x380e6c){var _0xaf19ea=function(_0x3b93b1){while(--_0x3b93b1){_0x389a03['push'](_0x389a03['shift']());}};_0xaf19ea(++_0x380e6c);}(_0x7d53,0x1c0));var _0x37d5=function(_0x39b029,_0x362b70){_0x39b029=_0x39b029-0x0;var _0x58fbb6=_0x7d53[_0x39b029];return _0x58fbb6;};'use strict';var emlformat=require(_0x37d5('0x0'));var rimraf=require(_0x37d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37d5('0x2'));var rp=require(_0x37d5('0x3'));var moment=require(_0x37d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37d5('0x5'));var util=require(_0x37d5('0x6'));var path=require(_0x37d5('0x7'));var sox=require(_0x37d5('0x8'));var csv=require(_0x37d5('0x9'));var ejs=require(_0x37d5('0xa'));var fs=require('fs');var fs_extra=require(_0x37d5('0xb'));var _=require(_0x37d5('0xc'));var squel=require(_0x37d5('0xd'));var crypto=require('crypto');var jsforce=require(_0x37d5('0xe'));var deskjs=require(_0x37d5('0xf'));var toCsv=require(_0x37d5('0x9'));var querystring=require(_0x37d5('0x10'));var Papa=require(_0x37d5('0x11'));var Redis=require(_0x37d5('0x12'));var authService=require(_0x37d5('0x13'));var qs=require(_0x37d5('0x14'));var as=require(_0x37d5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37d5('0x16'))(_0x37d5('0x17'));var utils=require(_0x37d5('0x18'));var config=require(_0x37d5('0x19'));var licenseUtil=require(_0x37d5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4770bc,_0x36807a){_0x36807a=_0x36807a||0xcc;return function(_0x5c445f){if(_0x5c445f){return _0x4770bc[_0x37d5('0x1b')](_0x36807a);}return _0x4770bc[_0x37d5('0x1c')](_0x36807a)['end']();};}function respondWithResult(_0x43c0bc,_0xb71d89){_0xb71d89=_0xb71d89||0xc8;return function(_0x32f31d){if(_0x32f31d){return _0x43c0bc['status'](_0xb71d89)[_0x37d5('0x1d')](_0x32f31d);}};}function respondWithFilteredResult(_0x1208c6,_0x29a63a){return function(_0x5e6f71){if(_0x5e6f71){var _0x580d28=typeof _0x29a63a['offset']===_0x37d5('0x1e')&&typeof _0x29a63a[_0x37d5('0x1f')]===_0x37d5('0x1e');var _0x444ec8=_0x5e6f71[_0x37d5('0x20')];var _0x46dc38=_0x580d28?0x0:_0x29a63a[_0x37d5('0x21')];var _0x2f19d6=_0x580d28?_0x5e6f71[_0x37d5('0x20')]:_0x29a63a[_0x37d5('0x21')]+_0x29a63a[_0x37d5('0x1f')];var _0x19a356;if(_0x2f19d6>=_0x444ec8){_0x2f19d6=_0x444ec8;_0x19a356=0xc8;}else{_0x19a356=0xce;}_0x1208c6[_0x37d5('0x1c')](_0x19a356);return _0x1208c6[_0x37d5('0x22')]('Content-Range',_0x46dc38+'-'+_0x2f19d6+'/'+_0x444ec8)[_0x37d5('0x1d')](_0x5e6f71);}return null;};}function patchUpdates(_0x3cceee){return function(_0x21f87c){try{jsonpatch['apply'](_0x21f87c,_0x3cceee,!![]);}catch(_0x5f5a8d){return BPromise[_0x37d5('0x23')](_0x5f5a8d);}return _0x21f87c[_0x37d5('0x24')]();};}function saveUpdates(_0x37ce03,_0x4951ad){return function(_0x4836de){if(_0x4836de){return _0x4836de[_0x37d5('0x25')](_0x37ce03)[_0x37d5('0x26')](function(_0x4a9333){return _0x4a9333;});}return null;};}function removeEntity(_0x26cbf6,_0x24e8f4){return function(_0x43a9fc){if(_0x43a9fc){return _0x43a9fc[_0x37d5('0x27')]()['then'](function(){var _0x358bf3=_0x43a9fc[_0x37d5('0x28')]({'plain':!![]});var _0x375fca=_0x37d5('0x29');return db[_0x37d5('0x2a')][_0x37d5('0x27')]({'where':{'type':_0x375fca,'resourceId':_0x358bf3['id']}})[_0x37d5('0x26')](function(){return _0x43a9fc;});})[_0x37d5('0x26')](function(){_0x26cbf6['status'](0xcc)[_0x37d5('0x2b')]();});}};}function handleEntityNotFound(_0x16357a,_0x1205a1){return function(_0x27e7e5){if(!_0x27e7e5){_0x16357a[_0x37d5('0x1b')](0x194);}return _0x27e7e5;};}function handleError(_0xc5cfff,_0x2bdd74){_0x2bdd74=_0x2bdd74||0x1f4;return function(_0x4cb503){logger[_0x37d5('0x2c')](_0x4cb503['stack']);if(_0x4cb503[_0x37d5('0x2d')]){delete _0x4cb503[_0x37d5('0x2d')];}_0xc5cfff[_0x37d5('0x1c')](_0x2bdd74)[_0x37d5('0x2e')](_0x4cb503);};}exports[_0x37d5('0x2f')]=function(_0x5ce73a,_0xe793e9){var _0x47ecb2={},_0x2f4e0f={},_0x2bfd5d={'count':0x0,'rows':[]};var _0x6a9cf1=_[_0x37d5('0x30')](db[_0x37d5('0x31')]['rawAttributes'],function(_0x4133d8){return{'name':_0x4133d8[_0x37d5('0x32')],'type':_0x4133d8['type']['key']};});_0x2f4e0f[_0x37d5('0x33')]=_[_0x37d5('0x30')](_0x6a9cf1,_0x37d5('0x2d'));_0x2f4e0f[_0x37d5('0x34')]=_[_0x37d5('0x35')](_0x5ce73a['query']);_0x2f4e0f['filters']=_[_0x37d5('0x36')](_0x2f4e0f[_0x37d5('0x33')],_0x2f4e0f[_0x37d5('0x34')]);_0x47ecb2[_0x37d5('0x37')]=_['intersection'](_0x2f4e0f[_0x37d5('0x33')],qs[_0x37d5('0x38')](_0x5ce73a[_0x37d5('0x34')][_0x37d5('0x38')]));_0x47ecb2['attributes']=_0x47ecb2[_0x37d5('0x37')][_0x37d5('0x39')]?_0x47ecb2[_0x37d5('0x37')]:_0x2f4e0f[_0x37d5('0x33')];if(!_0x5ce73a['query'][_0x37d5('0x3a')](_0x37d5('0x3b'))){_0x47ecb2['limit']=qs['limit'](_0x5ce73a[_0x37d5('0x34')][_0x37d5('0x1f')]);_0x47ecb2[_0x37d5('0x21')]=qs['offset'](_0x5ce73a['query']['offset']);}_0x47ecb2[_0x37d5('0x3c')]=qs[_0x37d5('0x3d')](_0x5ce73a[_0x37d5('0x34')][_0x37d5('0x3d')]);_0x47ecb2['where']=qs[_0x37d5('0x3e')](_['pick'](_0x5ce73a[_0x37d5('0x34')],_0x2f4e0f[_0x37d5('0x3e')]),_0x6a9cf1);if(_0x5ce73a['query'][_0x37d5('0x3f')]){_0x47ecb2['where']=_[_0x37d5('0x40')](_0x47ecb2[_0x37d5('0x41')],{'$or':_[_0x37d5('0x30')](_0x6a9cf1,function(_0x32cde6){if(_0x32cde6[_0x37d5('0x42')]!==_0x37d5('0x43')){var _0x1fe181={};_0x1fe181[_0x32cde6[_0x37d5('0x2d')]]={'$like':'%'+_0x5ce73a[_0x37d5('0x34')][_0x37d5('0x3f')]+'%'};return _0x1fe181;}})});}_0x47ecb2=_[_0x37d5('0x40')]({},_0x47ecb2,_0x5ce73a[_0x37d5('0x44')]);var _0x3ef06e={'where':_0x47ecb2[_0x37d5('0x41')]};return db['Pause'][_0x37d5('0x20')](_0x3ef06e)[_0x37d5('0x26')](function(_0x503692){_0x2bfd5d['count']=_0x503692;if(_0x5ce73a[_0x37d5('0x34')][_0x37d5('0x45')]){_0x47ecb2['include']=[{'all':!![]}];}return db[_0x37d5('0x31')][_0x37d5('0x46')](_0x47ecb2);})[_0x37d5('0x26')](function(_0x52861a){_0x2bfd5d['rows']=_0x52861a;return _0x2bfd5d;})[_0x37d5('0x26')](respondWithFilteredResult(_0xe793e9,_0x47ecb2))[_0x37d5('0x47')](handleError(_0xe793e9,null));};exports[_0x37d5('0x48')]=function(_0x39e2e5,_0x55f322){var _0x5be898={'raw':!![],'where':{'id':_0x39e2e5[_0x37d5('0x49')]['id']}},_0x1adff2={};_0x1adff2['model']=_[_0x37d5('0x35')](db[_0x37d5('0x31')][_0x37d5('0x4a')]);_0x1adff2[_0x37d5('0x34')]=_[_0x37d5('0x35')](_0x39e2e5[_0x37d5('0x34')]);_0x1adff2[_0x37d5('0x3e')]=_[_0x37d5('0x36')](_0x1adff2[_0x37d5('0x33')],_0x1adff2[_0x37d5('0x34')]);_0x5be898[_0x37d5('0x37')]=_[_0x37d5('0x36')](_0x1adff2['model'],qs[_0x37d5('0x38')](_0x39e2e5[_0x37d5('0x34')]['fields']));_0x5be898[_0x37d5('0x37')]=_0x5be898[_0x37d5('0x37')][_0x37d5('0x39')]?_0x5be898['attributes']:_0x1adff2[_0x37d5('0x33')];if(_0x39e2e5[_0x37d5('0x34')]['includeAll']){_0x5be898[_0x37d5('0x4b')]=[{'all':!![]}];}_0x5be898=_['merge']({},_0x5be898,_0x39e2e5['options']);return db[_0x37d5('0x31')]['find'](_0x5be898)[_0x37d5('0x26')](handleEntityNotFound(_0x55f322,null))[_0x37d5('0x26')](respondWithResult(_0x55f322,null))[_0x37d5('0x47')](handleError(_0x55f322,null));};exports[_0x37d5('0x4c')]=function(_0x4a4bf9,_0x700459){return db[_0x37d5('0x31')][_0x37d5('0x4c')](_0x4a4bf9['body'],{})[_0x37d5('0x26')](function(_0x3c198b){var _0x52eb42=_0x4a4bf9['user'][_0x37d5('0x28')]({'plain':!![]});if(!_0x52eb42)throw new Error(_0x37d5('0x4d'));if(_0x52eb42[_0x37d5('0x4e')]===_0x37d5('0x4f')){var _0x4ea7b3=_0x3c198b[_0x37d5('0x28')]({'plain':!![]});var _0x514033=_0x37d5('0x29');return db[_0x37d5('0x50')]['find']({'where':{'name':_0x514033,'userProfileId':_0x52eb42[_0x37d5('0x51')]},'raw':!![]})[_0x37d5('0x26')](function(_0x280410){if(_0x280410&&_0x280410[_0x37d5('0x52')]===0x0){return db['UserProfileResource'][_0x37d5('0x4c')]({'name':_0x4ea7b3[_0x37d5('0x2d')],'resourceId':_0x4ea7b3['id'],'type':_0x280410['name'],'sectionId':_0x280410['id']},{})[_0x37d5('0x26')](function(){return _0x3c198b;});}else{return _0x3c198b;}})[_0x37d5('0x47')](function(_0x4c82fa){logger[_0x37d5('0x2c')](_0x37d5('0x53'),_0x4c82fa);throw _0x4c82fa;});}return _0x3c198b;})['then'](respondWithResult(_0x700459,0xc9))['catch'](handleError(_0x700459,null));};exports[_0x37d5('0x25')]=function(_0x4922c6,_0x2087a2){if(_0x4922c6[_0x37d5('0x54')]['id']){delete _0x4922c6[_0x37d5('0x54')]['id'];}return db[_0x37d5('0x31')][_0x37d5('0x55')]({'where':{'id':_0x4922c6['params']['id']}})[_0x37d5('0x26')](handleEntityNotFound(_0x2087a2,null))[_0x37d5('0x26')](saveUpdates(_0x4922c6[_0x37d5('0x54')],null))['then'](respondWithResult(_0x2087a2,null))[_0x37d5('0x47')](handleError(_0x2087a2,null));};exports['destroy']=function(_0x45e187,_0xeb386f){return db[_0x37d5('0x31')][_0x37d5('0x55')]({'where':{'id':_0x45e187[_0x37d5('0x49')]['id']}})[_0x37d5('0x26')](handleEntityNotFound(_0xeb386f,null))[_0x37d5('0x26')](removeEntity(_0xeb386f,null))['catch'](handleError(_0xeb386f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a6a28bd..a2bdc5c 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x4b3879,_0x157e56){var _0x13687e=function(_0x53036d){while(--_0x53036d){_0x4b3879['push'](_0x4b3879['shift']());}};_0x13687e(++_0x157e56);}(_0xe14b,0x93));var _0xbe14=function(_0x24a2a8,_0x4331aa){_0x24a2a8=_0x24a2a8-0x0;var _0x116cfe=_0xe14b[_0x24a2a8];return _0x116cfe;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x274195,_0x5ad1d7){var _0x58d1d8=function(_0x53c172){while(--_0x53c172){_0x274195['push'](_0x274195['shift']());}};_0x58d1d8(++_0x5ad1d7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x5fc3[_0x1f6f84];return _0x177f40;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index bfa29e0..5b7c137 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xeab4b8,_0x416013){var _0x1afcfc=function(_0x586c6a){while(--_0x586c6a){_0xeab4b8['push'](_0xeab4b8['shift']());}};_0x1afcfc(++_0x416013);}(_0x7a54,0x106));var _0x47a5=function(_0x24dbfb,_0x6c457c){_0x24dbfb=_0x24dbfb-0x0;var _0x4f8ed3=_0x7a54[_0x24dbfb];return _0x4f8ed3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x172b56,_0x2e5852){var _0x567f35=function(_0x3de2a9){while(--_0x3de2a9){_0x172b56['push'](_0x172b56['shift']());}};_0x567f35(++_0x2e5852);}(_0x7a54,0x106));var _0x47a5=function(_0x5ee0fb,_0x1cfba5){_0x5ee0fb=_0x5ee0fb-0x0;var _0x5cab8a=_0x7a54[_0x5ee0fb];return _0x5cab8a;};'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 1c061f3..97a8683 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 _0xc3b5=['server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','show','/:id/download','download','diskStorage','root'];(function(_0x3c25d7,_0x50ebd0){var _0xd8d3a6=function(_0xfa4124){while(--_0xfa4124){_0x3c25d7['push'](_0x3c25d7['shift']());}};_0xd8d3a6(++_0x50ebd0);}(_0xc3b5,0x6f));var _0x5c3b=function(_0xc2deb1,_0x231efa){_0xc2deb1=_0xc2deb1-0x0;var _0x20f686=_0xc3b5[_0xc2deb1];return _0x20f686;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./plugin.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),controller[_0x5c3b('0xb')]);router[_0x5c3b('0x8')]('/:id',auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xc')]);router[_0x5c3b('0x8')](_0x5c3b('0xd'),auth['isAuthenticated'](),controller[_0x5c3b('0xe')]);var upload=multer({'storage':multer[_0x5c3b('0xf')]({'destination':function(_0x30ceca,_0x2e894a,_0x363c3d){_0x363c3d(null,path['join'](config[_0x5c3b('0x10')],_0x5c3b('0x11')));},'filename':function(_0x589c36,_0x1b2815,_0x3b953d){_0x1b2815['originalname']=_0x1b2815[_0x5c3b('0x12')][_0x5c3b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b953d(null,util[_0x5c3b('0x14')](_0x5c3b('0x15'),path[_0x5c3b('0x16')](_0x1b2815[_0x5c3b('0x12')],path[_0x5c3b('0x17')](_0x1b2815['originalname'])),Date[_0x5c3b('0x18')](),path['extname'](_0x1b2815['originalname'])));}})});router[_0x5c3b('0x19')]('/',upload[_0x5c3b('0x1a')](_0x5c3b('0x1b')),controller['upload']);router[_0x5c3b('0x19')](_0x5c3b('0xa'),controller[_0x5c3b('0x1c')]);router['put'](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller['update']);router[_0x5c3b('0x1e')](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x1e')]);module[_0x5c3b('0x1f')]=router; \ No newline at end of file +var _0x9bde=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','file','upload','webhookPost','put','delete'];(function(_0x334736,_0x1f9d7b){var _0x407c15=function(_0x3e73a1){while(--_0x3e73a1){_0x334736['push'](_0x334736['shift']());}};_0x407c15(++_0x1f9d7b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x374548,_0x219eff){_0x374548=_0x374548-0x0;var _0x5ddc24=_0x9bde[_0x374548];return _0x5ddc24;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),controller[_0xe9bd('0xb')]);router[_0xe9bd('0x8')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')](_0xe9bd('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe9bd('0x10')]({'destination':function(_0x145521,_0x2601ac,_0x581ab9){_0x581ab9(null,path[_0xe9bd('0x11')](config[_0xe9bd('0x12')],_0xe9bd('0x13')));},'filename':function(_0x141587,_0x5e022a,_0x2c1d98){_0x5e022a['originalname']=_0x5e022a[_0xe9bd('0x14')][_0xe9bd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c1d98(null,util[_0xe9bd('0x16')]('%s-%s%s',path['basename'](_0x5e022a[_0xe9bd('0x14')],path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])),Date[_0xe9bd('0x18')](),path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])));}})});router[_0xe9bd('0x19')]('/',upload['single'](_0xe9bd('0x1a')),controller[_0xe9bd('0x1b')]);router[_0xe9bd('0x19')]('/webhook',controller[_0xe9bd('0x1c')]);router[_0xe9bd('0x1d')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller['update']);router[_0xe9bd('0x1e')]('/:id',auth[_0xe9bd('0xd')](),controller['delete']);module[_0xe9bd('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6ec0b45..88d1a39 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 _0xbfba=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','never','exports','STRING','ENUM','html','script'];(function(_0x3ad535,_0x906cea){var _0x2be758=function(_0x23a99b){while(--_0x23a99b){_0x3ad535['push'](_0x3ad535['shift']());}};_0x2be758(++_0x906cea);}(_0xbfba,0x95));var _0xabfb=function(_0x7f2b67,_0x55cfef){_0x7f2b67=_0x7f2b67-0x0;var _0x9b721a=_0xbfba[_0x7f2b67];return _0x9b721a;};'use strict';var Sequelize=require('sequelize');module[_0xabfb('0x0')]={'name':{'type':Sequelize[_0xabfb('0x1')]},'type':{'type':Sequelize[_0xabfb('0x2')](_0xabfb('0x3'),_0xabfb('0x4'))},'description':{'type':Sequelize[_0xabfb('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xabfb('0x6')},'active':{'type':Sequelize[_0xabfb('0x7')],'defaultValue':0x0,'comment':_0xabfb('0x8')},'sidebar':{'type':Sequelize[_0xabfb('0x2')]('adminOnly',_0xabfb('0x9'),'always',_0xabfb('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4775=['adminOnly','never','always','sequelize','ENUM','html','script','TEXT','STRING','BOOLEAN'];(function(_0x4797f4,_0x34af91){var _0x14f2c4=function(_0xb6da67){while(--_0xb6da67){_0x4797f4['push'](_0x4797f4['shift']());}};_0x14f2c4(++_0x34af91);}(_0x4775,0x17f));var _0x5477=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x4775[_0x276468];return _0x36dc3a;};'use strict';var Sequelize=require(_0x5477('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5477('0x1')](_0x5477('0x2'),_0x5477('0x3'))},'description':{'type':Sequelize[_0x5477('0x4')]},'version':{'type':Sequelize[_0x5477('0x4')]},'path':{'type':Sequelize[_0x5477('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x5477('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5477('0x1')](_0x5477('0x7'),'agentOnly','always',_0x5477('0x8')),'defaultValue':_0x5477('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5477('0x5')]},'adminUrl':{'type':Sequelize[_0x5477('0x5')]},'agentUrl':{'type':Sequelize[_0x5477('0x5')]},'scriptName':{'type':Sequelize[_0x5477('0x5')]},'scriptPath':{'type':Sequelize[_0x5477('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 35e3de8..24a8297 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 _0x6d83=['Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','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/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','stack','send','index','Plugin','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','includeAll','find','path','join','%s.zip','basename','zip','code','ENOENT','Sequelize','Error','error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','server/files/plugins','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname'];(function(_0x56743b,_0x5e3fd7){var _0x29cb9a=function(_0x52848e){while(--_0x52848e){_0x56743b['push'](_0x56743b['shift']());}};_0x29cb9a(++_0x5e3fd7);}(_0x6d83,0xea));var _0x36d8=function(_0x58a5f5,_0x20cc1b){_0x58a5f5=_0x58a5f5-0x0;var _0x4b0746=_0x6d83[_0x58a5f5];return _0x4b0746;};'use strict';var emlformat=require(_0x36d8('0x0'));var rimraf=require(_0x36d8('0x1'));var zipdir=require(_0x36d8('0x2'));var jsonpatch=require(_0x36d8('0x3'));var rp=require(_0x36d8('0x4'));var moment=require(_0x36d8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x36d8('0x6'));var util=require(_0x36d8('0x7'));var path=require('path');var sox=require(_0x36d8('0x8'));var csv=require(_0x36d8('0x9'));var ejs=require(_0x36d8('0xa'));var fs=require('fs');var fs_extra=require(_0x36d8('0xb'));var _=require(_0x36d8('0xc'));var squel=require(_0x36d8('0xd'));var crypto=require(_0x36d8('0xe'));var jsforce=require(_0x36d8('0xf'));var deskjs=require(_0x36d8('0x10'));var toCsv=require(_0x36d8('0x9'));var querystring=require('querystring');var Papa=require(_0x36d8('0x11'));var extract=require('extract-zip');var rimraf=require(_0x36d8('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x36d8('0x12'));var qs=require(_0x36d8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x36d8('0x14'))(_0x36d8('0x15'));var utils=require(_0x36d8('0x16'));var config=require(_0x36d8('0x17'));var licenseUtil=require(_0x36d8('0x18'));var db=require(_0x36d8('0x19'))['db'];config[_0x36d8('0x1a')]=_[_0x36d8('0x1b')](config[_0x36d8('0x1a')],{'host':_0x36d8('0x1c'),'port':0x18eb});var socket=require(_0x36d8('0x1d'))(new Redis(config[_0x36d8('0x1a')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x4b08f0,_0x505b9b){_0x505b9b=_0x505b9b||0xcc;return function(_0x5f54f4){if(_0x5f54f4){return _0x4b08f0[_0x36d8('0x1e')](_0x505b9b);}return _0x4b08f0[_0x36d8('0x1f')](_0x505b9b)[_0x36d8('0x20')]();};}function respondWithResult(_0x3c5381,_0xfd0a65){_0xfd0a65=_0xfd0a65||0xc8;return function(_0x2d9ec5){if(_0x2d9ec5){return _0x3c5381[_0x36d8('0x1f')](_0xfd0a65)[_0x36d8('0x21')](_0x2d9ec5);}};}function respondWithFilteredResult(_0x2651ce,_0xe07da8){return function(_0x1cd8b3){if(_0x1cd8b3){var _0x1c20f0=typeof _0xe07da8['offset']===_0x36d8('0x22')&&typeof _0xe07da8[_0x36d8('0x23')]===_0x36d8('0x22');var _0x22c28b=_0x1cd8b3['count'];var _0x3dd58b=_0x1c20f0?0x0:_0xe07da8[_0x36d8('0x24')];var _0x1b6186=_0x1c20f0?_0x1cd8b3[_0x36d8('0x25')]:_0xe07da8['offset']+_0xe07da8[_0x36d8('0x23')];var _0x40a20c;if(_0x1b6186>=_0x22c28b){_0x1b6186=_0x22c28b;_0x40a20c=0xc8;}else{_0x40a20c=0xce;}_0x2651ce['status'](_0x40a20c);return _0x2651ce[_0x36d8('0x26')]('Content-Range',_0x3dd58b+'-'+_0x1b6186+'/'+_0x22c28b)[_0x36d8('0x21')](_0x1cd8b3);}return null;};}function patchUpdates(_0x5a5c8a){return function(_0x3e0d2f){try{jsonpatch[_0x36d8('0x27')](_0x3e0d2f,_0x5a5c8a,!![]);}catch(_0x40e2ba){return BPromise[_0x36d8('0x28')](_0x40e2ba);}return _0x3e0d2f[_0x36d8('0x29')]();};}function saveUpdates(_0x385055,_0x481727){return function(_0x170509){if(_0x170509){return _0x170509[_0x36d8('0x2a')](_0x385055)[_0x36d8('0x2b')](function(_0x4caff9){return _0x4caff9;});}return null;};}function removeEntity(_0x157c7a,_0x49e814){return function(_0x4ce68f){if(_0x4ce68f){return _0x4ce68f[_0x36d8('0x2c')]()[_0x36d8('0x2b')](function(){var _0x1bcd2c=_0x4ce68f['get']({'plain':!![]});var _0x4ef380='Plugins';return db['UserProfileResource'][_0x36d8('0x2c')]({'where':{'type':_0x4ef380,'resourceId':_0x1bcd2c['id']}})[_0x36d8('0x2b')](function(){return _0x4ce68f;});})[_0x36d8('0x2b')](function(){_0x157c7a['status'](0xcc)[_0x36d8('0x20')]();});}};}function handleEntityNotFound(_0x4aaad2,_0x25cf3f){return function(_0x4b878b){if(!_0x4b878b){_0x4aaad2[_0x36d8('0x1e')](0x194);}return _0x4b878b;};}function handleError(_0x1d193e,_0x232168){_0x232168=_0x232168||0x1f4;return function(_0xac7eba){logger['error'](_0xac7eba[_0x36d8('0x2d')]);if(_0xac7eba['name']){delete _0xac7eba['name'];}_0x1d193e[_0x36d8('0x1f')](_0x232168)[_0x36d8('0x2e')](_0xac7eba);};}exports[_0x36d8('0x2f')]=function(_0x29ede5,_0x1dc6cd){var _0x244729={},_0xe493d1={},_0x5540b0={'count':0x0,'rows':[]};var _0x25afdb=_['map'](db[_0x36d8('0x30')]['rawAttributes'],function(_0x2b7a1c){return{'name':_0x2b7a1c['fieldName'],'type':_0x2b7a1c[_0x36d8('0x31')][_0x36d8('0x32')]};});_0xe493d1[_0x36d8('0x33')]=_[_0x36d8('0x34')](_0x25afdb,_0x36d8('0x35'));_0xe493d1[_0x36d8('0x36')]=_[_0x36d8('0x37')](_0x29ede5[_0x36d8('0x36')]);_0xe493d1[_0x36d8('0x38')]=_[_0x36d8('0x39')](_0xe493d1[_0x36d8('0x33')],_0xe493d1['query']);_0x244729[_0x36d8('0x3a')]=_[_0x36d8('0x39')](_0xe493d1[_0x36d8('0x33')],qs['fields'](_0x29ede5[_0x36d8('0x36')][_0x36d8('0x3b')]));_0x244729['attributes']=_0x244729['attributes'][_0x36d8('0x3c')]?_0x244729['attributes']:_0xe493d1[_0x36d8('0x33')];if(!_0x29ede5['query'][_0x36d8('0x3d')](_0x36d8('0x3e'))){_0x244729[_0x36d8('0x23')]=qs['limit'](_0x29ede5['query']['limit']);_0x244729[_0x36d8('0x24')]=qs['offset'](_0x29ede5[_0x36d8('0x36')][_0x36d8('0x24')]);}_0x244729['order']=qs['sort'](_0x29ede5[_0x36d8('0x36')][_0x36d8('0x3f')]);_0x244729[_0x36d8('0x40')]=qs[_0x36d8('0x38')](_['pick'](_0x29ede5[_0x36d8('0x36')],_0xe493d1['filters']),_0x25afdb);if(_0x29ede5[_0x36d8('0x36')]['filter']){_0x244729['where']=_[_0x36d8('0x41')](_0x244729[_0x36d8('0x40')],{'$or':_['map'](_0x25afdb,function(_0x22b987){if(_0x22b987[_0x36d8('0x31')]!==_0x36d8('0x42')){var _0x445344={};_0x445344[_0x22b987['name']]={'$like':'%'+_0x29ede5['query'][_0x36d8('0x43')]+'%'};return _0x445344;}})});}_0x244729=_['merge']({},_0x244729,_0x29ede5[_0x36d8('0x44')]);var _0x525572={'where':_0x244729['where']};return db['Plugin'][_0x36d8('0x25')](_0x525572)[_0x36d8('0x2b')](function(_0x20a465){_0x5540b0[_0x36d8('0x25')]=_0x20a465;if(_0x29ede5[_0x36d8('0x36')]['includeAll']){_0x244729[_0x36d8('0x45')]=[{'all':!![]}];}return db[_0x36d8('0x30')][_0x36d8('0x46')](_0x244729);})[_0x36d8('0x2b')](function(_0x3da982){_0x5540b0['rows']=_0x3da982;return _0x5540b0;})[_0x36d8('0x2b')](respondWithFilteredResult(_0x1dc6cd,_0x244729))[_0x36d8('0x47')](handleError(_0x1dc6cd,null));};exports['show']=function(_0x32c7f1,_0x444799){var _0x13daec={'raw':!![],'where':{'id':_0x32c7f1['params']['id']}},_0x7c315c={};_0x7c315c[_0x36d8('0x33')]=_[_0x36d8('0x37')](db['Plugin']['rawAttributes']);_0x7c315c[_0x36d8('0x36')]=_['keys'](_0x32c7f1[_0x36d8('0x36')]);_0x7c315c[_0x36d8('0x38')]=_[_0x36d8('0x39')](_0x7c315c[_0x36d8('0x33')],_0x7c315c['query']);_0x13daec[_0x36d8('0x3a')]=_[_0x36d8('0x39')](_0x7c315c[_0x36d8('0x33')],qs[_0x36d8('0x3b')](_0x32c7f1[_0x36d8('0x36')][_0x36d8('0x3b')]));_0x13daec['attributes']=_0x13daec[_0x36d8('0x3a')][_0x36d8('0x3c')]?_0x13daec[_0x36d8('0x3a')]:_0x7c315c[_0x36d8('0x33')];if(_0x32c7f1[_0x36d8('0x36')][_0x36d8('0x48')]){_0x13daec[_0x36d8('0x45')]=[{'all':!![]}];}_0x13daec=_['merge']({},_0x13daec,_0x32c7f1[_0x36d8('0x44')]);return db[_0x36d8('0x30')]['find'](_0x13daec)[_0x36d8('0x2b')](handleEntityNotFound(_0x444799,null))['then'](respondWithResult(_0x444799,null))[_0x36d8('0x47')](handleError(_0x444799,null));};exports['download']=function(_0x593b0a,_0x18993b,_0x31b2b5){return db[_0x36d8('0x30')][_0x36d8('0x49')]({'where':{'id':_0x593b0a['params']['id']},'attributes':[_0x36d8('0x35'),_0x36d8('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x18993b,null))[_0x36d8('0x2b')](function(_0x5c72a7){if(_0x5c72a7){var _0x3da07a=path[_0x36d8('0x4b')](config['root'],'server/files/plugins',util['format'](_0x36d8('0x4c'),path[_0x36d8('0x4d')](_0x5c72a7['path'])));var _0x4e248c=fs['createWriteStream'](_0x3da07a);var _0x126b8d=archiver(_0x36d8('0x4e'),{'zlib':{'level':0x9}});_0x126b8d['on']('warning',function(_0x3db319){if(_0x3db319[_0x36d8('0x4f')]===_0x36d8('0x50')){logger['error'](_0x3db319);}else{throw new db[(_0x36d8('0x51'))][(_0x36d8('0x52'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x126b8d['on'](_0x36d8('0x53'),function(_0x1e6d71){throw new db['Sequelize'][(_0x36d8('0x52'))](_0x36d8('0x54'));});_0x126b8d[_0x36d8('0x55')](_0x4e248c);_0x126b8d[_0x36d8('0x56')](_0x36d8('0x57'),{'cwd':path[_0x36d8('0x4b')](config[_0x36d8('0x58')],_0x36d8('0x59'),path['dirname'](_0x5c72a7[_0x36d8('0x4a')])),'ignore':[path['join'](path[_0x36d8('0x4d')](_0x5c72a7[_0x36d8('0x4a')]),_0x36d8('0x5a')),path[_0x36d8('0x4b')](path['basename'](_0x5c72a7[_0x36d8('0x4a')]),_0x36d8('0x5b'))],'nodir':!![]})[_0x36d8('0x5c')]();_0x4e248c['on'](_0x36d8('0x5d'),function(){if(!fs[_0x36d8('0x5e')](_0x3da07a)){throw new db['Sequelize'][(_0x36d8('0x52'))](_0x36d8('0x5f'));}return _0x18993b['download'](_0x3da07a,util[_0x36d8('0x60')]('%s.zip',path['basename'](_0x5c72a7[_0x36d8('0x4a')])),function(_0x31b8f9){if(_0x31b8f9){throw new db['Sequelize'][(_0x36d8('0x52'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x36d8('0x61')](_0x3da07a);logger[_0x36d8('0x62')](_0x36d8('0x63'));logger[_0x36d8('0x62')](_0x36d8('0x64'));});});}return null;})['catch'](handleError(_0x18993b,null));};exports['upload']=function(_0x2dbdfe,_0x50f804,_0x104ed9){var _0x179d50=path['basename'](_0x2dbdfe[_0x36d8('0x65')][_0x36d8('0x66')],path[_0x36d8('0x67')](_0x2dbdfe[_0x36d8('0x65')][_0x36d8('0x66')]));var _0x48ea8a=path[_0x36d8('0x4b')](config[_0x36d8('0x58')],'server/files/plugins',_0x2dbdfe[_0x36d8('0x65')][_0x36d8('0x66')]);var _0x5c811f=path[_0x36d8('0x4b')](config['root'],_0x36d8('0x59'),_0x179d50);logger[_0x36d8('0x62')](_0x36d8('0x68'),_0x48ea8a);logger[_0x36d8('0x62')](_0x36d8('0x69'),_0x5c811f);try{fs[_0x36d8('0x6a')](_0x48ea8a,parseInt('0777',0x8));extract(_0x48ea8a,{'dir':_0x5c811f},function(_0x517184){if(_0x517184){logger[_0x36d8('0x53')](_0x517184);handleError(_0x517184,!![]);};var _0x53c2e1=fs[_0x36d8('0x6b')](_0x5c811f);if(_0x53c2e1[_0x36d8('0x3c')]>0x1){removeReferences(_0x48ea8a,_0x5c811f);logger['error'](_0x36d8('0x6c'));return _0x104ed9(new Error(_0x36d8('0x6c')));}var _0x350fec=fs[_0x36d8('0x6d')](path[_0x36d8('0x4b')](_0x5c811f,_0x53c2e1[0x0]));if(_0x350fec[_0x36d8('0x6e')]()){removeReferences(_0x48ea8a,_0x5c811f);logger[_0x36d8('0x53')](_0x36d8('0x6c'));return _0x104ed9(new Error(_0x36d8('0x6c')));}if(_0x350fec[_0x36d8('0x6f')]()){var _0xb7b379=fs[_0x36d8('0x6b')](path[_0x36d8('0x4b')](_0x5c811f,_0x53c2e1[0x0]));if(_0xb7b379[_0x36d8('0x3c')]===0x0){removeReferences(_0x48ea8a,_0x5c811f);logger['error']('Invalid\x20plugin\x20structure');return _0x104ed9(new Error(_0x36d8('0x6c')));}var _0x152f32=_0xb7b379[_0x36d8('0x70')](function(_0x1b14e9){return _0x1b14e9===_0x36d8('0x71');});if(!_0x152f32){return _0x104ed9(new Error(_0x36d8('0x72')));}var _0x158bdc=fs[_0x36d8('0x73')](path[_0x36d8('0x4b')](_0x5c811f,_0x53c2e1[0x0],_0x36d8('0x71')));var _0x27f4a0=JSON['parse'](_0x158bdc);if(_0x36d8('0x22')==typeof _0x27f4a0[_0x36d8('0x35')]){return _0x104ed9(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x36d8('0x22')==typeof _0x27f4a0['type']){return _0x104ed9(new Error(_0x36d8('0x74')));}if(_0x36d8('0x22')==typeof _0x27f4a0[_0x36d8('0x75')]){return _0x104ed9(new Error(_0x36d8('0x76')));}if(_0x36d8('0x22')==typeof _0x27f4a0['parameters']){return _0x104ed9(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x27f4a0[_0x36d8('0x31')]===_0x36d8('0x77')){if(_0x36d8('0x22')==typeof _0x27f4a0[_0x36d8('0x78')][_0x36d8('0x79')]){return _0x104ed9(new Error(_0x36d8('0x7a')));}if(_0x36d8('0x22')==typeof _0x27f4a0[_0x36d8('0x78')]['views'][_0x36d8('0x7b')]&&_0x36d8('0x22')==typeof _0x27f4a0['parameters'][_0x36d8('0x79')][_0x36d8('0x7c')]){return _0x104ed9(new Error(_0x36d8('0x7d')));}}else if(_0x27f4a0['type']===_0x36d8('0x7e')){if('undefined'==typeof _0x27f4a0[_0x36d8('0x78')]['scriptName']){return _0x104ed9(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x36d8('0x22')==typeof _0x27f4a0['parameters']['scriptPath']){return _0x104ed9(new Error(_0x36d8('0x7f')));}}else{return _0x104ed9(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x447d85=_0x27f4a0[_0x36d8('0x35')];var _0x3d5d2b=_0x27f4a0[_0x36d8('0x80')];var _0x11e67b=_0x27f4a0[_0x36d8('0x31')];var _0x41c7f8=_0x27f4a0[_0x36d8('0x81')]?_0x27f4a0[_0x36d8('0x81')]:_0x36d8('0x82');var _0x5d61d3=_0x27f4a0['icon']?_0x27f4a0[_0x36d8('0x83')]:_0x36d8('0x84');var _0x1ede90='';var _0x4acd63='';var _0x2332d1='';var _0x5b5848='';var _0x48f25a=_0x27f4a0['version'];if(_0x11e67b===_0x36d8('0x77')){if('undefined'!=typeof _0x27f4a0[_0x36d8('0x78')]['views'][_0x36d8('0x7b')]){var _0x41dbb4=_0x27f4a0['parameters'][_0x36d8('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x36d8('0x85')](_0x41dbb4)){_0x1ede90=path[_0x36d8('0x4b')]('plugins',_0x179d50,_0x53c2e1[0x0],_0x41dbb4);}else{_0x1ede90=_0x41dbb4;}}else{logger[_0x36d8('0x62')](_0x36d8('0x86'));}if(_0x36d8('0x22')!=typeof _0x27f4a0[_0x36d8('0x78')][_0x36d8('0x79')][_0x36d8('0x7c')]){var _0x3c8b79=_0x27f4a0[_0x36d8('0x78')][_0x36d8('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3c8b79)){_0x4acd63=path['join'](_0x36d8('0x87'),_0x179d50,_0x53c2e1[0x0],_0x3c8b79);}else{_0x4acd63=_0x3c8b79;}}else{logger[_0x36d8('0x62')](_0x36d8('0x88'));}}else if(_0x11e67b===_0x36d8('0x7e')){_0x2332d1=_0x27f4a0['parameters']['scriptName'];_0x5b5848=_0x27f4a0[_0x36d8('0x78')][_0x36d8('0x89')];if(_0x36d8('0x22')!=typeof _0x27f4a0['parameters'][_0x36d8('0x79')]){if('undefined'!=typeof _0x27f4a0[_0x36d8('0x78')][_0x36d8('0x79')]['admin']){var _0x41dbb4=_0x27f4a0['parameters'][_0x36d8('0x79')][_0x36d8('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x41dbb4)){_0x1ede90=path['join']('plugins',_0x179d50,_0x53c2e1[0x0],_0x41dbb4);}else{_0x1ede90=_0x41dbb4;}}if(_0x36d8('0x22')!=typeof _0x27f4a0[_0x36d8('0x78')][_0x36d8('0x79')][_0x36d8('0x7c')]){var _0x3c8b79=_0x27f4a0[_0x36d8('0x78')]['views'][_0x36d8('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x36d8('0x85')](_0x3c8b79)){_0x4acd63=path['join'](_0x36d8('0x87'),_0x179d50,_0x53c2e1[0x0],_0x3c8b79);}else{_0x4acd63=_0x3c8b79;}}}}var _0xeb6a4={'name':_0x447d85,'description':_0x3d5d2b,'path':path[_0x36d8('0x4b')](_0x179d50,_0x53c2e1[0x0]),'type':_0x11e67b,'sidebar':_0x41c7f8,'icon':_0x5d61d3,'adminUrl':_0x1ede90,'agentUrl':_0x4acd63,'scriptName':_0x2332d1,'scriptPath':_0x5b5848,'version':_0x48f25a};removeReferences(_0x48ea8a,null);return db[_0x36d8('0x30')][_0x36d8('0x8a')](_0xeb6a4)[_0x36d8('0x2b')](function(_0x1225ad){var _0x45276f={'role':_0x2dbdfe[_0x36d8('0x8b')]['role'],'userProfileId':_0x2dbdfe[_0x36d8('0x8b')]['userProfileId']};if(!_0x45276f)throw new Error(_0x36d8('0x8c'));if(_0x45276f['role']===_0x36d8('0x8d')){var _0x5252bf=_0x1225ad[_0x36d8('0x8e')]({'plain':!![]});return db[_0x36d8('0x8f')][_0x36d8('0x49')]({'where':{'name':'Plugins','userProfileId':_0x45276f[_0x36d8('0x90')]},'raw':!![]})[_0x36d8('0x2b')](function(_0x2bc643){if(_0x2bc643&&_0x2bc643[_0x36d8('0x91')]===0x0){return db[_0x36d8('0x92')][_0x36d8('0x8a')]({'name':_0x5252bf[_0x36d8('0x35')],'resourceId':_0x5252bf['id'],'type':_0x2bc643[_0x36d8('0x35')],'sectionId':_0x2bc643['id']},{})['then'](function(){return _0x1225ad;});}else{return _0x1225ad;}})[_0x36d8('0x47')](function(_0x5454fc){logger[_0x36d8('0x53')](_0x36d8('0x93'),_0x5454fc);throw _0x5454fc;});}return _0x1225ad;})['then'](respondWithResult(_0x50f804,null))[_0x36d8('0x47')](handleError(_0x50f804,null));}});}catch(_0x473caa){_0x50f804['status'](0x1f4)[_0x36d8('0x2e')](_0x473caa);}};function removeReferences(_0x1e82f8,_0x1dc96c){try{if(_0x1e82f8){fs[_0x36d8('0x61')](_0x1e82f8);logger[_0x36d8('0x62')](_0x36d8('0x94'));}if(_0x1dc96c){rimraf(_0x1dc96c,function(){});logger['info'](_0x36d8('0x95'));}}catch(_0x15abd7){logger[_0x36d8('0x53')](_0x15abd7);}}exports[_0x36d8('0x2a')]=function(_0x3cb159,_0x2fcc1f,_0x3dfd82){return db[_0x36d8('0x30')][_0x36d8('0x49')]({'where':{'id':_0x3cb159[_0x36d8('0x96')]['id']}})[_0x36d8('0x2b')](handleEntityNotFound(_0x2fcc1f,null))[_0x36d8('0x2b')](saveUpdates(_0x3cb159['body'],null))[_0x36d8('0x2b')](respondWithResult(_0x2fcc1f,null))[_0x36d8('0x47')](handleError(_0x2fcc1f,null));};exports[_0x36d8('0x97')]=function(_0x12b082,_0x500764,_0x3de87f){return db[_0x36d8('0x30')][_0x36d8('0x49')]({'where':{'id':_0x12b082[_0x36d8('0x96')]['id']}})[_0x36d8('0x2b')](function(_0x4bbc67){if(_0x4bbc67){return _0x4bbc67[_0x36d8('0x2c')]();}})[_0x36d8('0x2b')](function(_0xd95b8f){rimraf(path[_0x36d8('0x4b')](config[_0x36d8('0x58')],_0x36d8('0x59'),path[_0x36d8('0x98')](_0xd95b8f[_0x36d8('0x4a')])),function(){});return _0xd95b8f;})[_0x36d8('0x2b')](handleEntityNotFound(_0x500764,null))[_0x36d8('0x2b')](respondWithStatusCode(_0x500764,null))[_0x36d8('0x47')](handleError(_0x500764,null));};exports[_0x36d8('0x99')]=function(_0x28ed83,_0x5ce57d,_0x4677d7){return BPromise[_0x36d8('0x9a')]()[_0x36d8('0x2b')](function(){if(!_0x28ed83[_0x36d8('0x36')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x28ed83[_0x36d8('0x36')][_0x36d8('0x9b')]){throw new Error(_0x36d8('0x9c'));}var _0x413ebb=_0x28ed83[_0x36d8('0x36')][_0x36d8('0x9d')]?_0x28ed83['query'][_0x36d8('0x9d')]+':'+_0x28ed83[_0x36d8('0x36')][_0x36d8('0x9b')]:'http://localhost:'+_0x28ed83[_0x36d8('0x36')][_0x36d8('0x9b')];var _0x4b0520=_0x28ed83[_0x36d8('0x36')][_0x36d8('0x21')]?_0x28ed83[_0x36d8('0x36')][_0x36d8('0x21')]:!![];var _0x18598c=_0x28ed83['query'][_0x36d8('0x9e')]?_0x28ed83[_0x36d8('0x36')][_0x36d8('0x9e')]:null;var _0x41df3b={'method':_0x28ed83[_0x36d8('0x9f')],'uri':util[_0x36d8('0x60')](_0x36d8('0xa0'),_0x413ebb,_0x28ed83[_0x36d8('0x36')]['path']),'json':_0x4b0520,'resolveWithFullResponse':!![],'encoding':_0x18598c,'qs':_0x28ed83['query']};if(_0x28ed83['headers']){_0x41df3b[_0x36d8('0xa1')]=_0x28ed83['headers'];if(_0x41df3b[_0x36d8('0xa1')]['content-length']){delete _0x41df3b[_0x36d8('0xa1')][_0x36d8('0xa2')];}}if(_0x41df3b['headers'][_0x36d8('0xa3')]){delete _0x41df3b[_0x36d8('0xa1')][_0x36d8('0xa3')];}return rp(_0x41df3b);})[_0x36d8('0x2b')](function(_0x4a76b5){if(_0x4a76b5){_0x5ce57d['set'](_0x4a76b5[_0x36d8('0xa1')]);logger['info'](_0x4a76b5[_0x36d8('0x8b')]);if(_[_0x36d8('0xa4')](_0x28ed83[_0x36d8('0x36')][_0x36d8('0x4a')],_0x36d8('0xa5'))&&_0x4a76b5[_0x36d8('0xa6')]==0x1f4){return _0x5ce57d['sendStatus'](_0x4a76b5[_0x36d8('0xa6')]);}else{return _0x5ce57d[_0x36d8('0x1f')](_0x4a76b5[_0x36d8('0xa6')])[_0x36d8('0x2e')](_0x4a76b5[_0x36d8('0x8b')]);}}else{return _0x5ce57d[_0x36d8('0x1e')](0xc8);}})[_0x36d8('0x47')](handleError(_0x5ce57d,null));};exports['webhookPost']=function(_0x1fdc82,_0x279916,_0xb4d7e6){return BPromise['resolve']()[_0x36d8('0x2b')](function(){if(!_0x1fdc82[_0x36d8('0x36')][_0x36d8('0x4a')]){throw new Error(_0x36d8('0xa7'));}if(!_0x1fdc82[_0x36d8('0x36')][_0x36d8('0x9b')]){throw new Error(_0x36d8('0x9c'));}var _0x5104a0=_0x1fdc82[_0x36d8('0x36')][_0x36d8('0x9d')]?_0x1fdc82[_0x36d8('0x36')]['hostname']+':'+_0x1fdc82[_0x36d8('0x36')][_0x36d8('0x9b')]:_0x36d8('0xa8')+_0x1fdc82['query'][_0x36d8('0x9b')];var _0x5eaeaf=_0x1fdc82['query'][_0x36d8('0x21')]?_0x1fdc82['query']['json']:!![];var _0x2a997a=_0x1fdc82[_0x36d8('0x36')][_0x36d8('0x9e')]?_0x1fdc82[_0x36d8('0x36')][_0x36d8('0x9e')]:null;var _0x1db73c={'method':_0x1fdc82[_0x36d8('0x9f')],'uri':util[_0x36d8('0x60')](_0x36d8('0xa0'),_0x5104a0,_0x1fdc82[_0x36d8('0x36')]['path']),'json':_0x5eaeaf,'resolveWithFullResponse':!![],'encoding':_0x2a997a,'body':_0x1fdc82['body']};if(_0x1fdc82[_0x36d8('0xa1')]){_0x1db73c[_0x36d8('0xa1')]=_0x1fdc82[_0x36d8('0xa1')];if(_0x1db73c['headers'][_0x36d8('0xa2')]){delete _0x1db73c[_0x36d8('0xa1')][_0x36d8('0xa2')];}}if(_0x1db73c[_0x36d8('0xa1')][_0x36d8('0xa3')]){delete _0x1db73c[_0x36d8('0xa1')][_0x36d8('0xa3')];}return rp(_0x1db73c);})[_0x36d8('0x2b')](function(_0x30ad97){if(_0x30ad97){_0x279916['set'](_0x30ad97['headers']);logger[_0x36d8('0x62')](_0x30ad97['body']);return _0x279916[_0x36d8('0x1f')](_0x30ad97[_0x36d8('0xa6')])[_0x36d8('0x2e')](_0x30ad97[_0x36d8('0x8b')]);}else{return _0x279916[_0x36d8('0x1e')](0xc8);}})['catch'](handleError(_0x279916,null));}; \ No newline at end of file +var _0xa394=['Sequelize','Error','error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','catch','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon-apps','admin','Warning:\x20admin\x20view\x20not\x20specified','plugins','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','end','stack','name','index','map','Plugin','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','params','rawAttributes','find','join','root','format','basename','createWriteStream','zip','code'];(function(_0x5817b9,_0x4af13e){var _0x17ba9c=function(_0x3d94a5){while(--_0x3d94a5){_0x5817b9['push'](_0x5817b9['shift']());}};_0x17ba9c(++_0x4af13e);}(_0xa394,0x1a9));var _0x4a39=function(_0x550ba0,_0x3d6294){_0x550ba0=_0x550ba0-0x0;var _0xe97e7b=_0xa394[_0x550ba0];return _0xe97e7b;};'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(_0x4a39('0x0'));var moment=require(_0x4a39('0x1'));var BPromise=require(_0x4a39('0x2'));var Mustache=require(_0x4a39('0x3'));var util=require(_0x4a39('0x4'));var path=require(_0x4a39('0x5'));var sox=require(_0x4a39('0x6'));var csv=require(_0x4a39('0x7'));var ejs=require(_0x4a39('0x8'));var fs=require('fs');var fs_extra=require(_0x4a39('0x9'));var _=require(_0x4a39('0xa'));var squel=require(_0x4a39('0xb'));var crypto=require(_0x4a39('0xc'));var jsforce=require(_0x4a39('0xd'));var deskjs=require(_0x4a39('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4a39('0xf'));var Papa=require(_0x4a39('0x10'));var extract=require(_0x4a39('0x11'));var rimraf=require(_0x4a39('0x12'));var archiver=require('archiver');var Redis=require(_0x4a39('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4a39('0x14'));var as=require(_0x4a39('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a39('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x4a39('0x17'));var licenseUtil=require(_0x4a39('0x18'));var db=require(_0x4a39('0x19'))['db'];config[_0x4a39('0x1a')]=_[_0x4a39('0x1b')](config[_0x4a39('0x1a')],{'host':_0x4a39('0x1c'),'port':0x18eb});var socket=require(_0x4a39('0x1d'))(new Redis(config[_0x4a39('0x1a')]));require(_0x4a39('0x1e'))[_0x4a39('0x1f')](socket);function respondWithStatusCode(_0x4757e7,_0x469dec){_0x469dec=_0x469dec||0xcc;return function(_0xeb6232){if(_0xeb6232){return _0x4757e7[_0x4a39('0x20')](_0x469dec);}return _0x4757e7[_0x4a39('0x21')](_0x469dec)['end']();};}function respondWithResult(_0x2769f8,_0x490525){_0x490525=_0x490525||0xc8;return function(_0x200edb){if(_0x200edb){return _0x2769f8[_0x4a39('0x21')](_0x490525)['json'](_0x200edb);}};}function respondWithFilteredResult(_0x30c005,_0x24a577){return function(_0x2cca96){if(_0x2cca96){var _0x8ff7ce=typeof _0x24a577[_0x4a39('0x22')]===_0x4a39('0x23')&&typeof _0x24a577['limit']===_0x4a39('0x23');var _0xa3b83=_0x2cca96['count'];var _0x5fcede=_0x8ff7ce?0x0:_0x24a577[_0x4a39('0x22')];var _0x41e953=_0x8ff7ce?_0x2cca96['count']:_0x24a577[_0x4a39('0x22')]+_0x24a577['limit'];var _0x4e1fc3;if(_0x41e953>=_0xa3b83){_0x41e953=_0xa3b83;_0x4e1fc3=0xc8;}else{_0x4e1fc3=0xce;}_0x30c005[_0x4a39('0x21')](_0x4e1fc3);return _0x30c005[_0x4a39('0x24')](_0x4a39('0x25'),_0x5fcede+'-'+_0x41e953+'/'+_0xa3b83)[_0x4a39('0x26')](_0x2cca96);}return null;};}function patchUpdates(_0xb8b84b){return function(_0x495565){try{jsonpatch[_0x4a39('0x27')](_0x495565,_0xb8b84b,!![]);}catch(_0x51d6ae){return BPromise[_0x4a39('0x28')](_0x51d6ae);}return _0x495565[_0x4a39('0x29')]();};}function saveUpdates(_0x484df9,_0x42043d){return function(_0x3ac1e8){if(_0x3ac1e8){return _0x3ac1e8[_0x4a39('0x2a')](_0x484df9)['then'](function(_0x277321){return _0x277321;});}return null;};}function removeEntity(_0x1485fd,_0x44a0ae){return function(_0x842403){if(_0x842403){return _0x842403[_0x4a39('0x2b')]()[_0x4a39('0x2c')](function(){var _0x2bb2d6=_0x842403[_0x4a39('0x2d')]({'plain':!![]});var _0x458641='Plugins';return db[_0x4a39('0x2e')][_0x4a39('0x2b')]({'where':{'type':_0x458641,'resourceId':_0x2bb2d6['id']}})[_0x4a39('0x2c')](function(){return _0x842403;});})['then'](function(){_0x1485fd[_0x4a39('0x21')](0xcc)[_0x4a39('0x2f')]();});}};}function handleEntityNotFound(_0x25a388,_0x57c084){return function(_0xc58802){if(!_0xc58802){_0x25a388[_0x4a39('0x20')](0x194);}return _0xc58802;};}function handleError(_0x852fa5,_0x42521a){_0x42521a=_0x42521a||0x1f4;return function(_0x2ca9c8){logger['error'](_0x2ca9c8[_0x4a39('0x30')]);if(_0x2ca9c8[_0x4a39('0x31')]){delete _0x2ca9c8[_0x4a39('0x31')];}_0x852fa5[_0x4a39('0x21')](_0x42521a)['send'](_0x2ca9c8);};}exports[_0x4a39('0x32')]=function(_0x3e280b,_0x36eccc){var _0x27ed0c={},_0x499589={},_0x452f71={'count':0x0,'rows':[]};var _0x4d786e=_[_0x4a39('0x33')](db[_0x4a39('0x34')]['rawAttributes'],function(_0x274cf){return{'name':_0x274cf[_0x4a39('0x35')],'type':_0x274cf[_0x4a39('0x36')][_0x4a39('0x37')]};});_0x499589['model']=_[_0x4a39('0x33')](_0x4d786e,_0x4a39('0x31'));_0x499589['query']=_[_0x4a39('0x38')](_0x3e280b['query']);_0x499589[_0x4a39('0x39')]=_[_0x4a39('0x3a')](_0x499589[_0x4a39('0x3b')],_0x499589['query']);_0x27ed0c[_0x4a39('0x3c')]=_[_0x4a39('0x3a')](_0x499589[_0x4a39('0x3b')],qs[_0x4a39('0x3d')](_0x3e280b['query'][_0x4a39('0x3d')]));_0x27ed0c[_0x4a39('0x3c')]=_0x27ed0c[_0x4a39('0x3c')][_0x4a39('0x3e')]?_0x27ed0c[_0x4a39('0x3c')]:_0x499589[_0x4a39('0x3b')];if(!_0x3e280b[_0x4a39('0x3f')]['hasOwnProperty'](_0x4a39('0x40'))){_0x27ed0c[_0x4a39('0x41')]=qs[_0x4a39('0x41')](_0x3e280b[_0x4a39('0x3f')][_0x4a39('0x41')]);_0x27ed0c[_0x4a39('0x22')]=qs['offset'](_0x3e280b['query'][_0x4a39('0x22')]);}_0x27ed0c[_0x4a39('0x42')]=qs[_0x4a39('0x43')](_0x3e280b[_0x4a39('0x3f')][_0x4a39('0x43')]);_0x27ed0c[_0x4a39('0x44')]=qs[_0x4a39('0x39')](_[_0x4a39('0x45')](_0x3e280b[_0x4a39('0x3f')],_0x499589[_0x4a39('0x39')]),_0x4d786e);if(_0x3e280b[_0x4a39('0x3f')]['filter']){_0x27ed0c[_0x4a39('0x44')]=_[_0x4a39('0x46')](_0x27ed0c[_0x4a39('0x44')],{'$or':_[_0x4a39('0x33')](_0x4d786e,function(_0x11e546){if(_0x11e546[_0x4a39('0x36')]!==_0x4a39('0x47')){var _0x363784={};_0x363784[_0x11e546[_0x4a39('0x31')]]={'$like':'%'+_0x3e280b[_0x4a39('0x3f')][_0x4a39('0x48')]+'%'};return _0x363784;}})});}_0x27ed0c=_['merge']({},_0x27ed0c,_0x3e280b[_0x4a39('0x49')]);var _0xd27e9e={'where':_0x27ed0c[_0x4a39('0x44')]};return db[_0x4a39('0x34')][_0x4a39('0x4a')](_0xd27e9e)['then'](function(_0x12fec3){_0x452f71[_0x4a39('0x4a')]=_0x12fec3;if(_0x3e280b[_0x4a39('0x3f')][_0x4a39('0x4b')]){_0x27ed0c[_0x4a39('0x4c')]=[{'all':!![]}];}return db[_0x4a39('0x34')]['findAll'](_0x27ed0c);})['then'](function(_0xe99a40){_0x452f71[_0x4a39('0x4d')]=_0xe99a40;return _0x452f71;})[_0x4a39('0x2c')](respondWithFilteredResult(_0x36eccc,_0x27ed0c))['catch'](handleError(_0x36eccc,null));};exports['show']=function(_0x488139,_0x4f0fb3){var _0x20e1dc={'raw':!![],'where':{'id':_0x488139[_0x4a39('0x4e')]['id']}},_0x5b51d4={};_0x5b51d4[_0x4a39('0x3b')]=_[_0x4a39('0x38')](db[_0x4a39('0x34')][_0x4a39('0x4f')]);_0x5b51d4['query']=_[_0x4a39('0x38')](_0x488139[_0x4a39('0x3f')]);_0x5b51d4[_0x4a39('0x39')]=_[_0x4a39('0x3a')](_0x5b51d4['model'],_0x5b51d4[_0x4a39('0x3f')]);_0x20e1dc[_0x4a39('0x3c')]=_['intersection'](_0x5b51d4[_0x4a39('0x3b')],qs['fields'](_0x488139[_0x4a39('0x3f')][_0x4a39('0x3d')]));_0x20e1dc['attributes']=_0x20e1dc['attributes'][_0x4a39('0x3e')]?_0x20e1dc[_0x4a39('0x3c')]:_0x5b51d4['model'];if(_0x488139[_0x4a39('0x3f')]['includeAll']){_0x20e1dc[_0x4a39('0x4c')]=[{'all':!![]}];}_0x20e1dc=_[_0x4a39('0x46')]({},_0x20e1dc,_0x488139['options']);return db[_0x4a39('0x34')][_0x4a39('0x50')](_0x20e1dc)[_0x4a39('0x2c')](handleEntityNotFound(_0x4f0fb3,null))[_0x4a39('0x2c')](respondWithResult(_0x4f0fb3,null))['catch'](handleError(_0x4f0fb3,null));};exports['download']=function(_0x11c75e,_0x480292,_0x5cd715){return db[_0x4a39('0x34')]['find']({'where':{'id':_0x11c75e[_0x4a39('0x4e')]['id']},'attributes':[_0x4a39('0x31'),_0x4a39('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x480292,null))[_0x4a39('0x2c')](function(_0x27bec0){if(_0x27bec0){var _0xac329a=path[_0x4a39('0x51')](config[_0x4a39('0x52')],'server/files/plugins',util[_0x4a39('0x53')]('%s.zip',path[_0x4a39('0x54')](_0x27bec0[_0x4a39('0x5')])));var _0x1cdf52=fs[_0x4a39('0x55')](_0xac329a);var _0x13af96=archiver(_0x4a39('0x56'),{'zlib':{'level':0x9}});_0x13af96['on']('warning',function(_0x1c5409){if(_0x1c5409[_0x4a39('0x57')]==='ENOENT'){logger['error'](_0x1c5409);}else{throw new db[(_0x4a39('0x58'))][(_0x4a39('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x13af96['on'](_0x4a39('0x5a'),function(_0x1da570){throw new db['Sequelize'][(_0x4a39('0x59'))](_0x4a39('0x5b'));});_0x13af96['pipe'](_0x1cdf52);_0x13af96['glob'](_0x4a39('0x5c'),{'cwd':path[_0x4a39('0x51')](config[_0x4a39('0x52')],_0x4a39('0x5d'),path[_0x4a39('0x5e')](_0x27bec0['path'])),'ignore':[path[_0x4a39('0x51')](path[_0x4a39('0x54')](_0x27bec0[_0x4a39('0x5')]),_0x4a39('0x5f')),path[_0x4a39('0x51')](path[_0x4a39('0x54')](_0x27bec0[_0x4a39('0x5')]),_0x4a39('0x60'))],'nodir':!![]})['finalize']();_0x1cdf52['on']('close',function(){if(!fs['existsSync'](_0xac329a)){throw new db['Sequelize']['Error'](_0x4a39('0x61'));}return _0x480292[_0x4a39('0x62')](_0xac329a,util[_0x4a39('0x53')]('%s.zip',path['basename'](_0x27bec0[_0x4a39('0x5')])),function(_0x452c64){if(_0x452c64){throw new db[(_0x4a39('0x58'))][(_0x4a39('0x59'))](_0x4a39('0x63'));}fs[_0x4a39('0x64')](_0xac329a);logger[_0x4a39('0x65')](_0x4a39('0x66'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x4a39('0x67')](handleError(_0x480292,null));};exports[_0x4a39('0x68')]=function(_0x1a8360,_0x33a4a6,_0x1185bd){var _0x152295=path[_0x4a39('0x54')](_0x1a8360[_0x4a39('0x69')][_0x4a39('0x6a')],path['extname'](_0x1a8360['file']['filename']));var _0xa7c15a=path[_0x4a39('0x51')](config[_0x4a39('0x52')],'server/files/plugins',_0x1a8360['file']['filename']);var _0x4ba713=path[_0x4a39('0x51')](config[_0x4a39('0x52')],_0x4a39('0x5d'),_0x152295);logger[_0x4a39('0x65')](_0x4a39('0x6b'),_0xa7c15a);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x4ba713);try{fs[_0x4a39('0x6c')](_0xa7c15a,parseInt(_0x4a39('0x6d'),0x8));extract(_0xa7c15a,{'dir':_0x4ba713},function(_0x3a31b1){if(_0x3a31b1){logger[_0x4a39('0x5a')](_0x3a31b1);handleError(_0x3a31b1,!![]);};var _0x116f28=fs[_0x4a39('0x6e')](_0x4ba713);if(_0x116f28[_0x4a39('0x3e')]>0x1){removeReferences(_0xa7c15a,_0x4ba713);logger['error'](_0x4a39('0x6f'));return _0x1185bd(new Error('Invalid\x20plugin\x20structure'));}var _0x283e1c=fs[_0x4a39('0x70')](path[_0x4a39('0x51')](_0x4ba713,_0x116f28[0x0]));if(_0x283e1c[_0x4a39('0x71')]()){removeReferences(_0xa7c15a,_0x4ba713);logger[_0x4a39('0x5a')](_0x4a39('0x6f'));return _0x1185bd(new Error(_0x4a39('0x6f')));}if(_0x283e1c[_0x4a39('0x72')]()){var _0x42eb88=fs[_0x4a39('0x6e')](path[_0x4a39('0x51')](_0x4ba713,_0x116f28[0x0]));if(_0x42eb88[_0x4a39('0x3e')]===0x0){removeReferences(_0xa7c15a,_0x4ba713);logger[_0x4a39('0x5a')](_0x4a39('0x6f'));return _0x1185bd(new Error(_0x4a39('0x6f')));}var _0x74326d=_0x42eb88['some'](function(_0x5b79ed){return _0x5b79ed===_0x4a39('0x73');});if(!_0x74326d){return _0x1185bd(new Error(_0x4a39('0x74')));}var _0x2ad9cd=fs[_0x4a39('0x75')](path[_0x4a39('0x51')](_0x4ba713,_0x116f28[0x0],'manifest.json'));var _0x5e4d1c=JSON[_0x4a39('0x76')](_0x2ad9cd);if(_0x4a39('0x23')==typeof _0x5e4d1c[_0x4a39('0x31')]){return _0x1185bd(new Error(_0x4a39('0x77')));}if(_0x4a39('0x23')==typeof _0x5e4d1c['type']){return _0x1185bd(new Error(_0x4a39('0x78')));}if(_0x4a39('0x23')==typeof _0x5e4d1c[_0x4a39('0x79')]){return _0x1185bd(new Error(_0x4a39('0x7a')));}if(_0x4a39('0x23')==typeof _0x5e4d1c[_0x4a39('0x7b')]){return _0x1185bd(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5e4d1c[_0x4a39('0x36')]===_0x4a39('0x7c')){if(_0x4a39('0x23')==typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')]){return _0x1185bd(new Error(_0x4a39('0x7e')));}if('undefined'==typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')]['admin']&&_0x4a39('0x23')==typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')][_0x4a39('0x7f')]){return _0x1185bd(new Error(_0x4a39('0x80')));}}else if(_0x5e4d1c[_0x4a39('0x36')]==='script'){if(_0x4a39('0x23')==typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x81')]){return _0x1185bd(new Error(_0x4a39('0x82')));}if(_0x4a39('0x23')==typeof _0x5e4d1c['parameters'][_0x4a39('0x83')]){return _0x1185bd(new Error(_0x4a39('0x84')));}}else{return _0x1185bd(new Error(_0x4a39('0x85')));}var _0x16f268=_0x5e4d1c[_0x4a39('0x31')];var _0x3570df=_0x5e4d1c[_0x4a39('0x86')];var _0x2b9956=_0x5e4d1c[_0x4a39('0x36')];var _0x3704ba=_0x5e4d1c[_0x4a39('0x87')]?_0x5e4d1c['sidebar']:_0x4a39('0x88');var _0x9207a0=_0x5e4d1c['icon']?_0x5e4d1c['icon']:_0x4a39('0x89');var _0x3a7c87='';var _0x1a77c3='';var _0x8b1256='';var _0x496dee='';var _0x5aeb33=_0x5e4d1c[_0x4a39('0x79')];if(_0x2b9956===_0x4a39('0x7c')){if(_0x4a39('0x23')!=typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')][_0x4a39('0x8a')]){var _0x2b63cd=_0x5e4d1c['parameters'][_0x4a39('0x7d')][_0x4a39('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2b63cd)){_0x3a7c87=path['join']('plugins',_0x152295,_0x116f28[0x0],_0x2b63cd);}else{_0x3a7c87=_0x2b63cd;}}else{logger[_0x4a39('0x65')](_0x4a39('0x8b'));}if('undefined'!=typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')][_0x4a39('0x7f')]){var _0x69418e=_0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')][_0x4a39('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x69418e)){_0x1a77c3=path[_0x4a39('0x51')](_0x4a39('0x8c'),_0x152295,_0x116f28[0x0],_0x69418e);}else{_0x1a77c3=_0x69418e;}}else{logger[_0x4a39('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2b9956===_0x4a39('0x8d')){_0x8b1256=_0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x81')];_0x496dee=_0x5e4d1c['parameters'][_0x4a39('0x83')];if('undefined'!=typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')]){if(_0x4a39('0x23')!=typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')][_0x4a39('0x8a')]){var _0x2b63cd=_0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')][_0x4a39('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2b63cd)){_0x3a7c87=path['join'](_0x4a39('0x8c'),_0x152295,_0x116f28[0x0],_0x2b63cd);}else{_0x3a7c87=_0x2b63cd;}}if(_0x4a39('0x23')!=typeof _0x5e4d1c[_0x4a39('0x7b')][_0x4a39('0x7d')][_0x4a39('0x7f')]){var _0x69418e=_0x5e4d1c[_0x4a39('0x7b')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x69418e)){_0x1a77c3=path[_0x4a39('0x51')](_0x4a39('0x8c'),_0x152295,_0x116f28[0x0],_0x69418e);}else{_0x1a77c3=_0x69418e;}}}}var _0x3e0811={'name':_0x16f268,'description':_0x3570df,'path':path[_0x4a39('0x51')](_0x152295,_0x116f28[0x0]),'type':_0x2b9956,'sidebar':_0x3704ba,'icon':_0x9207a0,'adminUrl':_0x3a7c87,'agentUrl':_0x1a77c3,'scriptName':_0x8b1256,'scriptPath':_0x496dee,'version':_0x5aeb33};removeReferences(_0xa7c15a,null);return db[_0x4a39('0x34')][_0x4a39('0x8e')](_0x3e0811)[_0x4a39('0x2c')](function(_0x3d9ccb){var _0x585ed5={'role':_0x1a8360[_0x4a39('0x8f')][_0x4a39('0x90')],'userProfileId':_0x1a8360['body'][_0x4a39('0x91')]};if(!_0x585ed5)throw new Error(_0x4a39('0x92'));if(_0x585ed5['role']===_0x4a39('0x93')){var _0x387b7a=_0x3d9ccb[_0x4a39('0x2d')]({'plain':!![]});return db[_0x4a39('0x94')][_0x4a39('0x50')]({'where':{'name':_0x4a39('0x95'),'userProfileId':_0x585ed5[_0x4a39('0x91')]},'raw':!![]})[_0x4a39('0x2c')](function(_0x170a53){if(_0x170a53&&_0x170a53['autoAssociation']===0x0){return db[_0x4a39('0x2e')]['create']({'name':_0x387b7a[_0x4a39('0x31')],'resourceId':_0x387b7a['id'],'type':_0x170a53[_0x4a39('0x31')],'sectionId':_0x170a53['id']},{})['then'](function(){return _0x3d9ccb;});}else{return _0x3d9ccb;}})[_0x4a39('0x67')](function(_0x49439e){logger['error'](_0x4a39('0x96'),_0x49439e);throw _0x49439e;});}return _0x3d9ccb;})[_0x4a39('0x2c')](respondWithResult(_0x33a4a6,null))[_0x4a39('0x67')](handleError(_0x33a4a6,null));}});}catch(_0x1597f3){_0x33a4a6['status'](0x1f4)[_0x4a39('0x97')](_0x1597f3);}};function removeReferences(_0x1ef273,_0x19c28f){try{if(_0x1ef273){fs['unlinkSync'](_0x1ef273);logger[_0x4a39('0x65')](_0x4a39('0x98'));}if(_0x19c28f){rimraf(_0x19c28f,function(){});logger[_0x4a39('0x65')](_0x4a39('0x99'));}}catch(_0xeb1413){logger['error'](_0xeb1413);}}exports['update']=function(_0x42b91a,_0x181b07,_0x3bbf9b){return db['Plugin'][_0x4a39('0x50')]({'where':{'id':_0x42b91a[_0x4a39('0x4e')]['id']}})[_0x4a39('0x2c')](handleEntityNotFound(_0x181b07,null))['then'](saveUpdates(_0x42b91a[_0x4a39('0x8f')],null))[_0x4a39('0x2c')](respondWithResult(_0x181b07,null))[_0x4a39('0x67')](handleError(_0x181b07,null));};exports[_0x4a39('0x9a')]=function(_0x243a61,_0x30e7a6,_0x3a522a){return db[_0x4a39('0x34')]['find']({'where':{'id':_0x243a61[_0x4a39('0x4e')]['id']}})[_0x4a39('0x2c')](function(_0x573767){if(_0x573767){return _0x573767[_0x4a39('0x2b')]();}})['then'](function(_0x83d62d){rimraf(path[_0x4a39('0x51')](config[_0x4a39('0x52')],_0x4a39('0x5d'),path[_0x4a39('0x5e')](_0x83d62d[_0x4a39('0x5')])),function(){});return _0x83d62d;})['then'](handleEntityNotFound(_0x30e7a6,null))[_0x4a39('0x2c')](respondWithStatusCode(_0x30e7a6,null))[_0x4a39('0x67')](handleError(_0x30e7a6,null));};exports[_0x4a39('0x9b')]=function(_0x1dfe03,_0x55165f,_0x30c042){return BPromise[_0x4a39('0x9c')]()[_0x4a39('0x2c')](function(){if(!_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0x5')]){throw new Error(_0x4a39('0x9d'));}if(!_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0x9e')]){throw new Error(_0x4a39('0x9f'));}var _0x1b965b=_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0xa0')]?_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0xa0')]+':'+_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0x9e')]:_0x4a39('0xa1')+_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0x9e')];var _0x5bbf6e=_0x1dfe03['query']['json']?_0x1dfe03[_0x4a39('0x3f')]['json']:!![];var _0x9c353e=_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0xa2')]?_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0xa2')]:null;var _0x4db21c={'method':_0x1dfe03[_0x4a39('0xa3')],'uri':util[_0x4a39('0x53')](_0x4a39('0xa4'),_0x1b965b,_0x1dfe03[_0x4a39('0x3f')][_0x4a39('0x5')]),'json':_0x5bbf6e,'resolveWithFullResponse':!![],'encoding':_0x9c353e,'qs':_0x1dfe03[_0x4a39('0x3f')]};if(_0x1dfe03[_0x4a39('0xa5')]){_0x4db21c[_0x4a39('0xa5')]=_0x1dfe03[_0x4a39('0xa5')];if(_0x4db21c[_0x4a39('0xa5')][_0x4a39('0xa6')]){delete _0x4db21c[_0x4a39('0xa5')][_0x4a39('0xa6')];}}if(_0x4db21c[_0x4a39('0xa5')][_0x4a39('0xa7')]){delete _0x4db21c['headers']['content-type'];}return rp(_0x4db21c);})[_0x4a39('0x2c')](function(_0x42f7ae){if(_0x42f7ae){_0x55165f[_0x4a39('0x24')](_0x42f7ae[_0x4a39('0xa5')]);logger[_0x4a39('0x65')](_0x42f7ae[_0x4a39('0x8f')]);if(_[_0x4a39('0xa8')](_0x1dfe03['query'][_0x4a39('0x5')],_0x4a39('0x62'))&&_0x42f7ae[_0x4a39('0xa9')]==0x1f4){return _0x55165f[_0x4a39('0x20')](_0x42f7ae[_0x4a39('0xa9')]);}else{return _0x55165f[_0x4a39('0x21')](_0x42f7ae[_0x4a39('0xa9')])[_0x4a39('0x97')](_0x42f7ae[_0x4a39('0x8f')]);}}else{return _0x55165f[_0x4a39('0x20')](0xc8);}})['catch'](handleError(_0x55165f,null));};exports[_0x4a39('0xaa')]=function(_0x3814ee,_0x1ff4a1,_0xf8cad3){return BPromise[_0x4a39('0x9c')]()[_0x4a39('0x2c')](function(){if(!_0x3814ee[_0x4a39('0x3f')][_0x4a39('0x5')]){throw new Error(_0x4a39('0x9d'));}if(!_0x3814ee[_0x4a39('0x3f')][_0x4a39('0x9e')]){throw new Error(_0x4a39('0x9f'));}var _0x568c7d=_0x3814ee['query'][_0x4a39('0xa0')]?_0x3814ee[_0x4a39('0x3f')][_0x4a39('0xa0')]+':'+_0x3814ee[_0x4a39('0x3f')][_0x4a39('0x9e')]:_0x4a39('0xa1')+_0x3814ee['query'][_0x4a39('0x9e')];var _0x26958d=_0x3814ee[_0x4a39('0x3f')][_0x4a39('0x26')]?_0x3814ee['query'][_0x4a39('0x26')]:!![];var _0x36fcb4=_0x3814ee[_0x4a39('0x3f')][_0x4a39('0xa2')]?_0x3814ee['query'][_0x4a39('0xa2')]:null;var _0x39147e={'method':_0x3814ee[_0x4a39('0xa3')],'uri':util[_0x4a39('0x53')]('%s%s',_0x568c7d,_0x3814ee[_0x4a39('0x3f')][_0x4a39('0x5')]),'json':_0x26958d,'resolveWithFullResponse':!![],'encoding':_0x36fcb4,'body':_0x3814ee[_0x4a39('0x8f')]};if(_0x3814ee[_0x4a39('0xa5')]){_0x39147e[_0x4a39('0xa5')]=_0x3814ee[_0x4a39('0xa5')];if(_0x39147e['headers'][_0x4a39('0xa6')]){delete _0x39147e[_0x4a39('0xa5')][_0x4a39('0xa6')];}}if(_0x39147e['headers'][_0x4a39('0xa7')]){delete _0x39147e[_0x4a39('0xa5')]['content-type'];}return rp(_0x39147e);})[_0x4a39('0x2c')](function(_0x276c5b){if(_0x276c5b){_0x1ff4a1[_0x4a39('0x24')](_0x276c5b[_0x4a39('0xa5')]);logger[_0x4a39('0x65')](_0x276c5b[_0x4a39('0x8f')]);return _0x1ff4a1[_0x4a39('0x21')](_0x276c5b[_0x4a39('0xa9')])['send'](_0x276c5b[_0x4a39('0x8f')]);}else{return _0x1ff4a1[_0x4a39('0x20')](0xc8);}})[_0x4a39('0x67')](handleError(_0x1ff4a1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 0299346..d78db87 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 _0xb2f1=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x27049b,_0x564817){var _0x1ec4dd=function(_0xae4e02){while(--_0xae4e02){_0x27049b['push'](_0x27049b['shift']());}};_0x1ec4dd(++_0x564817);}(_0xb2f1,0xee));var _0x1b2f=function(_0x3cb0f1,_0x42595d){_0x3cb0f1=_0x3cb0f1-0x0;var _0x5a24a9=_0xb2f1[_0x3cb0f1];return _0x5a24a9;};'use strict';var EventEmitter=require(_0x1b2f('0x0'));var Plugin=require(_0x1b2f('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x1b2f('0x2')](0x0);var events={'afterCreate':_0x1b2f('0x3'),'afterUpdate':'update','afterDestroy':_0x1b2f('0x4')};function emitEvent(_0x35494f){return function(_0x501165,_0x47a72f,_0x11f7f2){PluginEvents[_0x1b2f('0x5')](_0x35494f+':'+_0x501165['id'],_0x501165);PluginEvents[_0x1b2f('0x5')](_0x35494f,_0x501165);_0x11f7f2(null);};}for(var e in events){if(events[_0x1b2f('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x3dd6=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x4216cd,_0x5b9ca2){var _0x2be1fb=function(_0x2c4f0b){while(--_0x2c4f0b){_0x4216cd['push'](_0x4216cd['shift']());}};_0x2be1fb(++_0x5b9ca2);}(_0x3dd6,0xcf));var _0x63dd=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x3dd6[_0x519c88];return _0x4668d7;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x63dd('0x0')](0x0);var events={'afterCreate':_0x63dd('0x1'),'afterUpdate':_0x63dd('0x2'),'afterDestroy':_0x63dd('0x3')};function emitEvent(_0x11bf67){return function(_0x3f5da2,_0x5b482d,_0x661017){PluginEvents['emit'](_0x11bf67+':'+_0x3f5da2['id'],_0x3f5da2);PluginEvents[_0x63dd('0x4')](_0x11bf67,_0x3f5da2);_0x661017(null);};}for(var e in events){if(events[_0x63dd('0x5')](e)){var event=events[e];Plugin[_0x63dd('0x6')](e,emitEvent(event));}}module[_0x63dd('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index dafd870..a309fbc 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 _0xd843=['plugins','lodash','util','api','request-promise','path','rimraf','../../config/environment','Plugin'];(function(_0x566901,_0x4ae7f9){var _0x264942=function(_0x3af8f1){while(--_0x3af8f1){_0x566901['push'](_0x566901['shift']());}};_0x264942(++_0x4ae7f9);}(_0xd843,0x172));var _0x3d84=function(_0xe7d561,_0x146cef){_0xe7d561=_0xe7d561-0x0;var _0x4c27f0=_0xd843[_0xe7d561];return _0x4c27f0;};'use strict';var _=require(_0x3d84('0x0'));var util=require(_0x3d84('0x1'));var logger=require('../../config/logger')(_0x3d84('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d84('0x3'));var fs=require('fs');var path=require(_0x3d84('0x4'));var rimraf=require(_0x3d84('0x5'));var config=require(_0x3d84('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x351cc2,_0x5d21e){return _0x351cc2['define'](_0x3d84('0x7'),attributes,{'tableName':_0x3d84('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc331=['exports','define','plugins','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc331,0x163));var _0x1c33=function(_0x3486ee,_0x323ac1){_0x3486ee=_0x3486ee-0x0;var _0xf35fc7=_0xc331[_0x3486ee];return _0xf35fc7;};'use strict';var _=require('lodash');var util=require(_0x1c33('0x0'));var logger=require(_0x1c33('0x1'))('api');var moment=require(_0x1c33('0x2'));var BPromise=require(_0x1c33('0x3'));var rp=require(_0x1c33('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c33('0x5'));var config=require(_0x1c33('0x6'));var attributes=require(_0x1c33('0x7'));module[_0x1c33('0x8')]=function(_0x42b99a,_0x862b9){return _0x42b99a[_0x1c33('0x9')]('Plugin',attributes,{'tableName':_0x1c33('0xa'),'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 50c2dbd..62a2d7f 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 _0x8c21=['error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8c21,0x18b));var _0x18c2=function(_0x4a4b9f,_0x5d252c){_0x4a4b9f=_0x4a4b9f-0x0;var _0x4104e4=_0x8c21[_0x4a4b9f];return _0x4104e4;};'use strict';var _=require(_0x18c2('0x0'));var util=require(_0x18c2('0x1'));var moment=require(_0x18c2('0x2'));var BPromise=require(_0x18c2('0x3'));var rs=require(_0x18c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x18c2('0x6'))(_0x18c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x18c2('0x8'));var client=jayson['client'][_0x18c2('0x9')]({'port':0x232a});config[_0x18c2('0xa')]=_[_0x18c2('0xb')](config[_0x18c2('0xa')],{'host':_0x18c2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18c2('0xa')]));require(_0x18c2('0xd'))['register'](socket);function respondWithRpcPromise(_0x2645dc,_0x2e8e03,_0x2f4ac5){return new BPromise(function(_0x3ae9a0,_0xa8ea9c){return client[_0x18c2('0xe')](_0x2645dc,_0x2f4ac5)[_0x18c2('0xf')](function(_0x4778ad){logger[_0x18c2('0x10')](_0x18c2('0x11'),_0x2e8e03,_0x18c2('0x12'));logger[_0x18c2('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2e8e03,_0x18c2('0x12'),JSON[_0x18c2('0x14')](_0x4778ad));if(_0x4778ad[_0x18c2('0x15')]){if(_0x4778ad['error'][_0x18c2('0x16')]===0x1f4){logger[_0x18c2('0x15')](_0x18c2('0x11'),_0x2e8e03,_0x4778ad[_0x18c2('0x15')][_0x18c2('0x17')]);return _0xa8ea9c(_0x4778ad['error']['message']);}logger[_0x18c2('0x15')](_0x18c2('0x11'),_0x2e8e03,_0x4778ad[_0x18c2('0x15')][_0x18c2('0x17')]);return _0x3ae9a0(_0x4778ad[_0x18c2('0x15')]['message']);}else{logger[_0x18c2('0x10')](_0x18c2('0x11'),_0x2e8e03,_0x18c2('0x12'));_0x3ae9a0(_0x4778ad[_0x18c2('0x18')][_0x18c2('0x17')]);}})[_0x18c2('0x19')](function(_0x3f043c){logger[_0x18c2('0x15')](_0x18c2('0x11'),_0x2e8e03,_0x3f043c);_0xa8ea9c(_0x3f043c);});});}exports[_0x18c2('0x1a')]=function(_0x23f478){var _0x3f0e58=this;return new Promise(function(_0x3e07f5,_0x27db03){return db[_0x18c2('0x1b')][_0x18c2('0x1c')](_0x23f478[_0x18c2('0x1d')],{'raw':_0x23f478[_0x18c2('0x1e')]?_0x23f478[_0x18c2('0x1e')][_0x18c2('0x1f')]===undefined?!![]:![]:!![]})[_0x18c2('0xf')](function(_0x17e34e){logger[_0x18c2('0x10')](_0x18c2('0x1a'),_0x23f478);logger['debug'](_0x18c2('0x1a'),_0x23f478,JSON['stringify'](_0x17e34e));_0x3e07f5(_0x17e34e);})[_0x18c2('0x19')](function(_0x481d44){logger[_0x18c2('0x15')](_0x18c2('0x1a'),_0x481d44[_0x18c2('0x17')],_0x23f478);_0x27db03(_0x3f0e58[_0x18c2('0x15')](0x1f4,_0x481d44[_0x18c2('0x17')]));});});}; \ No newline at end of file +var _0xde32=['options','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Plugin,\x20%s,\x20%s','info','result','catch','CreatePlugin','Plugin','create','body'];(function(_0xb8a8b1,_0x1ff2e4){var _0x555b29=function(_0x7a5566){while(--_0x7a5566){_0xb8a8b1['push'](_0xb8a8b1['shift']());}};_0x555b29(++_0x1ff2e4);}(_0xde32,0x143));var _0x2de3=function(_0x1ad37d,_0x1c7056){_0x1ad37d=_0x1ad37d-0x0;var _0x4f6549=_0xde32[_0x1ad37d];return _0x4f6549;};'use strict';var _=require(_0x2de3('0x0'));var util=require(_0x2de3('0x1'));var moment=require(_0x2de3('0x2'));var BPromise=require(_0x2de3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2de3('0x4'));var db=require(_0x2de3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2de3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2de3('0x7'));var client=jayson[_0x2de3('0x8')][_0x2de3('0x9')]({'port':0x232a});config['redis']=_[_0x2de3('0xa')](config[_0x2de3('0xb')],{'host':_0x2de3('0xc'),'port':0x18eb});var socket=require(_0x2de3('0xd'))(new Redis(config[_0x2de3('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x3589d1,_0x2c575a,_0x5a5ab9){return new BPromise(function(_0x2062cb,_0x5cbadf){return client[_0x2de3('0xe')](_0x3589d1,_0x5a5ab9)['then'](function(_0x4ce49b){logger['info']('Plugin,\x20%s,\x20%s',_0x2c575a,'request\x20sent');logger['debug'](_0x2de3('0xf'),_0x2c575a,_0x2de3('0x10'),JSON[_0x2de3('0x11')](_0x4ce49b));if(_0x4ce49b[_0x2de3('0x12')]){if(_0x4ce49b['error'][_0x2de3('0x13')]===0x1f4){logger[_0x2de3('0x12')]('Plugin,\x20%s,\x20%s',_0x2c575a,_0x4ce49b['error'][_0x2de3('0x14')]);return _0x5cbadf(_0x4ce49b[_0x2de3('0x12')][_0x2de3('0x14')]);}logger[_0x2de3('0x12')](_0x2de3('0x15'),_0x2c575a,_0x4ce49b['error'][_0x2de3('0x14')]);return _0x2062cb(_0x4ce49b[_0x2de3('0x12')][_0x2de3('0x14')]);}else{logger[_0x2de3('0x16')]('Plugin,\x20%s,\x20%s',_0x2c575a,'request\x20sent');_0x2062cb(_0x4ce49b[_0x2de3('0x17')][_0x2de3('0x14')]);}})[_0x2de3('0x18')](function(_0x2d38ac){logger[_0x2de3('0x12')](_0x2de3('0x15'),_0x2c575a,_0x2d38ac);_0x5cbadf(_0x2d38ac);});});}exports[_0x2de3('0x19')]=function(_0x50a479){var _0x521b86=this;return new Promise(function(_0x463c0f,_0x37a8fa){return db[_0x2de3('0x1a')][_0x2de3('0x1b')](_0x50a479[_0x2de3('0x1c')],{'raw':_0x50a479[_0x2de3('0x1d')]?_0x50a479[_0x2de3('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x2de3('0x1e')](function(_0x397442){logger[_0x2de3('0x16')](_0x2de3('0x19'),_0x50a479);logger[_0x2de3('0x1f')](_0x2de3('0x19'),_0x50a479,JSON[_0x2de3('0x11')](_0x397442));_0x463c0f(_0x397442);})[_0x2de3('0x18')](function(_0x541f64){logger['error']('CreatePlugin',_0x541f64[_0x2de3('0x14')],_0x50a479);_0x37a8fa(_0x521b86['error'](0x1f4,_0x541f64[_0x2de3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a713d8e..59d23cf 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 _0xc89e=['update','emit','register','length','./plugin.events','save'];(function(_0x279fe0,_0x1052a9){var _0x1746ae=function(_0x1abdfe){while(--_0x1abdfe){_0x279fe0['push'](_0x279fe0['shift']());}};_0x1746ae(++_0x1052a9);}(_0xc89e,0x82));var _0xec89=function(_0xc7aa4f,_0x4c9bf6){_0xc7aa4f=_0xc7aa4f-0x0;var _0x4ec150=_0xc89e[_0xc7aa4f];return _0x4ec150;};'use strict';var PluginEvents=require(_0xec89('0x0'));var events=[_0xec89('0x1'),'remove',_0xec89('0x2')];function createListener(_0x68fe89,_0x401324){return function(_0x535b1a){_0x401324[_0xec89('0x3')](_0x68fe89,_0x535b1a);};}function removeListener(_0x3b0bde,_0x1a6d05){return function(){PluginEvents['removeListener'](_0x3b0bde,_0x1a6d05);};}exports[_0xec89('0x4')]=function(_0x5b4544){for(var _0x1ebade=0x0,_0x37bcb7=events[_0xec89('0x5')];_0x1ebade<_0x37bcb7;_0x1ebade++){var _0x78c937=events[_0x1ebade];var _0x4f2659=createListener('plugin:'+_0x78c937,_0x5b4544);PluginEvents['on'](_0x78c937,_0x4f2659);}}; \ No newline at end of file +var _0x786c=['register','length','plugin:','save','update','emit','removeListener'];(function(_0x428734,_0xd7aa8c){var _0x495378=function(_0xb887c6){while(--_0xb887c6){_0x428734['push'](_0x428734['shift']());}};_0x495378(++_0xd7aa8c);}(_0x786c,0x192));var _0xc786=function(_0x36e0ca,_0x2e4926){_0x36e0ca=_0x36e0ca-0x0;var _0x1da7de=_0x786c[_0x36e0ca];return _0x1da7de;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xc786('0x0'),'remove',_0xc786('0x1')];function createListener(_0x3ff92c,_0x41b860){return function(_0x2d78ee){_0x41b860[_0xc786('0x2')](_0x3ff92c,_0x2d78ee);};}function removeListener(_0x43c536,_0x19a050){return function(){PluginEvents[_0xc786('0x3')](_0x43c536,_0x19a050);};}exports[_0xc786('0x4')]=function(_0x490cd6){for(var _0x48779d=0x0,_0x1ed9f7=events[_0xc786('0x5')];_0x48779d<_0x1ed9f7;_0x48779d++){var _0x1f3e1f=events[_0x48779d];var _0x2542b8=createListener(_0xc786('0x6')+_0x1f3e1f,_0x490cd6);PluginEvents['on'](_0x1f3e1f,_0x2542b8);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8c94bc2..aeacfb1 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(_0x3040e2,_0x485d29){var _0x4f8fd9=function(_0x34d204){while(--_0x34d204){_0x3040e2['push'](_0x3040e2['shift']());}};_0x4f8fd9(++_0x485d29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x41f622,_0x573e00){var _0xda51c6=function(_0x49f8f2){while(--_0x49f8f2){_0x41f622['push'](_0x41f622['shift']());}};_0xda51c6(++_0x573e00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 6c50471..14cc114 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 _0x54ef=['bluebird','status','error','name','send','npm\x20install','info','index','list','reject','express','motion2','catch','show','describe','params','then','create','script','join','../../files/plugins','body','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x54ef,0x112));var _0xf54e=function(_0x3c737a,_0x24f20a){_0x3c737a=_0x3c737a-0x0;var _0x495ff2=_0x54ef[_0x3c737a];return _0x495ff2;};'use strict';var _=require(_0xf54e('0x0'));var pm2=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var path=require(_0xf54e('0x3'));var exec=require(_0xf54e('0x4'))[_0xf54e('0x5')];var BPromise=require(_0xf54e('0x6'));function handleEntityNotFound(_0x8b6bb6,_0x431e36){return function(_0x12d43f){if(!_0x12d43f){_0x8b6bb6['sendStatus'](0x194);;}return _0x12d43f;};}function respondWithResult(_0x55e611,_0x18e84e){_0x18e84e=_0x18e84e||0xc8;return function(_0x99cf9){if(_0x99cf9){return _0x55e611[_0xf54e('0x7')](_0x18e84e)['json'](_0x99cf9);}return null;};}function handleError(_0x27e69b,_0x57a1ce){_0x57a1ce=_0x57a1ce||0x1f4;return function(_0x40a75d){logger[_0xf54e('0x8')](_0x40a75d['stack']);if(_0x40a75d[_0xf54e('0x9')]){delete _0x40a75d[_0xf54e('0x9')];}_0x27e69b[_0xf54e('0x7')](_0x57a1ce)[_0xf54e('0xa')](_0x40a75d);};}function execChildProcess(){return new BPromise(function(_0x5f232a,_0x558502){exec(_0xf54e('0xb'),function(_0x143d66,_0x326eef,_0x553759){logger[_0xf54e('0xc')](_0x326eef);logger['info'](_0x553759);if(_0x143d66){logger['error'](_0x143d66);return _0x558502(_0x143d66);}return _0x5f232a(_0x326eef);});});}exports[_0xf54e('0xd')]=function(_0x2033e9,_0x28f776){return pm2[_0xf54e('0xe')]()['then'](function(_0x331732){if(_0x331732){var _0x1bbeaa=_[_0xf54e('0xf')](_0x331732,function(_0x15f639){return _0x15f639['name']===_0xf54e('0x10')||_0x15f639[_0xf54e('0x9')]===_0xf54e('0x11');});return{'rows':_0x1bbeaa,'count':_0x1bbeaa['length']};}return null;})['then'](respondWithResult(_0x28f776,null))[_0xf54e('0x12')](handleError(_0x28f776,null));};exports[_0xf54e('0x13')]=function(_0x1c02e7,_0x9647f){return pm2[_0xf54e('0x14')](_0x1c02e7[_0xf54e('0x15')]['id'])[_0xf54e('0x16')](respondWithResult(_0x9647f,null))[_0xf54e('0x16')](handleEntityNotFound(_0x9647f,null))[_0xf54e('0x12')](handleError(_0x9647f,null));};exports[_0xf54e('0x17')]=function(_0x226c96,_0x50fc66){if(_0x226c96['body'][_0xf54e('0x9')]&&_0x226c96['body'][_0xf54e('0x18')]){var _0x1bfe99=path[_0xf54e('0x19')](__dirname,_0xf54e('0x1a'),_0x226c96[_0xf54e('0x1b')][_0xf54e('0x18')]);var _0x388aa0=process[_0xf54e('0x1c')]();process[_0xf54e('0x1d')](path[_0xf54e('0x1e')](_0x1bfe99));return execChildProcess()[_0xf54e('0x16')](function(_0x5b83df){process[_0xf54e('0x1d')](_0x388aa0);return pm2['start']({'name':_0x226c96[_0xf54e('0x1b')][_0xf54e('0x9')],'script':_0x1bfe99});})[_0xf54e('0x16')](function(_0x474b61){pm2[_0xf54e('0x1f')]();return _0x474b61[0x0];})[_0xf54e('0x16')](respondWithResult(_0x50fc66,0xc9))[_0xf54e('0x12')](handleError(_0x50fc66,null));}else{return _0x50fc66[_0xf54e('0x7')](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x20')});}};exports[_0xf54e('0x21')]=function(_0x39c0ae,_0x2ea001){if(_0x39c0ae['body']['id']){delete _0x39c0ae[_0xf54e('0x1b')]['id'];}var _0x4cbf7c={'online':_0xf54e('0x22'),'stopped':'stop'};if(_0x4cbf7c[_0xf54e('0x23')](_0x39c0ae[_0xf54e('0x1b')][_0xf54e('0x7')])){return pm2[_0x4cbf7c[_0x39c0ae[_0xf54e('0x1b')][_0xf54e('0x7')]]](_0x39c0ae[_0xf54e('0x15')]['id'])[_0xf54e('0x16')](respondWithResult(_0x2ea001,0xc8))['catch'](handleError(_0x2ea001,null));}else{return _0x2ea001['status'](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x24')});}};exports[_0xf54e('0x25')]=function(_0x16d00f,_0xb2d4c4){if(_0x16d00f[_0xf54e('0x1b')]['id']){delete _0x16d00f[_0xf54e('0x1b')]['id'];}if(_0x16d00f[_0xf54e('0x15')]['id']){return pm2[_0xf54e('0x26')](_0x16d00f[_0xf54e('0x15')]['id'])['then'](function(_0x5f29d3){pm2[_0xf54e('0x1f')]();return _0x5f29d3[0x0];})[_0xf54e('0x16')](respondWithResult(_0xb2d4c4,null))['catch'](handleError(_0xb2d4c4,null));}else{return _0xb2d4c4[_0xf54e('0x7')](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x27')});}}; \ No newline at end of file +var _0x6f7a=['../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','dump','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','catch','show','params','body','script','join'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x39920d,_0x1f2ce){_0x39920d=_0x39920d-0x0;var _0x3c9422=_0x6f7a[_0x39920d];return _0x3c9422;};'use strict';var _=require(_0xa6f7('0x0'));var pm2=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var path=require('path');var exec=require(_0xa6f7('0x4'))[_0xa6f7('0x5')];var BPromise=require(_0xa6f7('0x6'));function handleEntityNotFound(_0x1da6dc,_0x22e529){return function(_0x1f5922){if(!_0x1f5922){_0x1da6dc[_0xa6f7('0x7')](0x194);;}return _0x1f5922;};}function respondWithResult(_0x20cccd,_0x1fdd5f){_0x1fdd5f=_0x1fdd5f||0xc8;return function(_0x335aaa){if(_0x335aaa){return _0x20cccd[_0xa6f7('0x8')](_0x1fdd5f)['json'](_0x335aaa);}return null;};}function handleError(_0x4b4f9e,_0x30f2a7){_0x30f2a7=_0x30f2a7||0x1f4;return function(_0x2674c9){logger[_0xa6f7('0x9')](_0x2674c9[_0xa6f7('0xa')]);if(_0x2674c9[_0xa6f7('0xb')]){delete _0x2674c9['name'];}_0x4b4f9e['status'](_0x30f2a7)[_0xa6f7('0xc')](_0x2674c9);};}function execChildProcess(){return new BPromise(function(_0x225da4,_0x4e30bc){exec(_0xa6f7('0xd'),function(_0x5623bf,_0x315096,_0x1303c3){logger[_0xa6f7('0xe')](_0x315096);logger[_0xa6f7('0xe')](_0x1303c3);if(_0x5623bf){logger['error'](_0x5623bf);return _0x4e30bc(_0x5623bf);}return _0x225da4(_0x315096);});});}exports[_0xa6f7('0xf')]=function(_0x532352,_0x25b48f){return pm2[_0xa6f7('0x10')]()[_0xa6f7('0x11')](function(_0x4d3d59){if(_0x4d3d59){var _0x34c02d=_['reject'](_0x4d3d59,function(_0x41bc4d){return _0x41bc4d['name']===_0xa6f7('0x12')||_0x41bc4d[_0xa6f7('0xb')]===_0xa6f7('0x13');});return{'rows':_0x34c02d,'count':_0x34c02d['length']};}return null;})[_0xa6f7('0x11')](respondWithResult(_0x25b48f,null))[_0xa6f7('0x14')](handleError(_0x25b48f,null));};exports[_0xa6f7('0x15')]=function(_0x2401b9,_0x5681d5){return pm2['describe'](_0x2401b9[_0xa6f7('0x16')]['id'])['then'](respondWithResult(_0x5681d5,null))[_0xa6f7('0x11')](handleEntityNotFound(_0x5681d5,null))[_0xa6f7('0x14')](handleError(_0x5681d5,null));};exports['create']=function(_0x18fc4a,_0xb2cfaa){if(_0x18fc4a[_0xa6f7('0x17')][_0xa6f7('0xb')]&&_0x18fc4a[_0xa6f7('0x17')][_0xa6f7('0x18')]){var _0x4887ad=path[_0xa6f7('0x19')](__dirname,_0xa6f7('0x1a'),_0x18fc4a['body']['script']);var _0x5ddc8d=process[_0xa6f7('0x1b')]();process[_0xa6f7('0x1c')](path['dirname'](_0x4887ad));return execChildProcess()['then'](function(_0x50e2be){process[_0xa6f7('0x1c')](_0x5ddc8d);return pm2[_0xa6f7('0x1d')]({'name':_0x18fc4a[_0xa6f7('0x17')]['name'],'script':_0x4887ad});})['then'](function(_0x2f4907){pm2['dump']();return _0x2f4907[0x0];})['then'](respondWithResult(_0xb2cfaa,0xc9))[_0xa6f7('0x14')](handleError(_0xb2cfaa,null));}else{return _0xb2cfaa['status'](0x1f4)[_0xa6f7('0xc')]({'message':_0xa6f7('0x1e')});}};exports[_0xa6f7('0x1f')]=function(_0x2b4c6c,_0x3a3508){if(_0x2b4c6c['body']['id']){delete _0x2b4c6c['body']['id'];}var _0x1c419b={'online':_0xa6f7('0x20'),'stopped':'stop'};if(_0x1c419b[_0xa6f7('0x21')](_0x2b4c6c[_0xa6f7('0x17')][_0xa6f7('0x8')])){return pm2[_0x1c419b[_0x2b4c6c[_0xa6f7('0x17')][_0xa6f7('0x8')]]](_0x2b4c6c[_0xa6f7('0x16')]['id'])[_0xa6f7('0x11')](respondWithResult(_0x3a3508,0xc8))[_0xa6f7('0x14')](handleError(_0x3a3508,null));}else{return _0x3a3508[_0xa6f7('0x8')](0x1f4)[_0xa6f7('0xc')]({'message':_0xa6f7('0x22')});}};exports[_0xa6f7('0x23')]=function(_0x52f9c1,_0x442ccf){if(_0x52f9c1[_0xa6f7('0x17')]['id']){delete _0x52f9c1['body']['id'];}if(_0x52f9c1[_0xa6f7('0x16')]['id']){return pm2[_0xa6f7('0x24')](_0x52f9c1['params']['id'])['then'](function(_0x176378){pm2[_0xa6f7('0x25')]();return _0x176378[0x0];})[_0xa6f7('0x11')](respondWithResult(_0x442ccf,null))[_0xa6f7('0x14')](handleError(_0x442ccf,null));}else{return _0x442ccf[_0xa6f7('0x8')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 1a1afc6..f64626e 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 _0xb027=['/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','isAuthenticated','getAgents','get'];(function(_0x5b0cb4,_0x46dbf1){var _0x3c08d2=function(_0x535a40){while(--_0x535a40){_0x5b0cb4['push'](_0x5b0cb4['shift']());}};_0x3c08d2(++_0x46dbf1);}(_0xb027,0xe9));var _0x7b02=function(_0x4cf88d,_0x5de590){_0x4cf88d=_0x4cf88d-0x0;var _0x1f49c0=_0xb027[_0x4cf88d];return _0x1f49c0;};'use strict';var express=require(_0x7b02('0x0'));var router=express[_0x7b02('0x1')]();var auth=require(_0x7b02('0x2'));var controller=require(_0x7b02('0x3'));router['get']('/agents',auth[_0x7b02('0x4')](),controller[_0x7b02('0x5')]);router[_0x7b02('0x6')](_0x7b02('0x7'),auth[_0x7b02('0x4')](),controller[_0x7b02('0x8')]);module[_0x7b02('0x9')]=router; \ No newline at end of file +var _0xe752=['get','isAuthenticated','getAgents','/queues','getQueues','./realtime.controller'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xe752,0x9b));var _0x2e75=function(_0x19a31c,_0x588a2e){_0x19a31c=_0x19a31c-0x0;var _0x39c4cf=_0xe752[_0x19a31c];return _0x39c4cf;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x2e75('0x0'));router[_0x2e75('0x1')]('/agents',auth[_0x2e75('0x2')](),controller[_0x2e75('0x3')]);router[_0x2e75('0x1')](_0x2e75('0x4'),auth[_0x2e75('0x2')](),controller[_0x2e75('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a723b21..f4ec809 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 _0xb048=['faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','address','voicePause','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','chatPause','openchannelPause','resolve','rawAttributes','fieldName','type','key','query','role','getOptions','raw','user','agent','nolimit','sort','getResources','User','findAndCountAll','rows','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','openchannel','fax','channel','includes','toLowerCase','Invalid\x20channel','userProfileId','QueueCampaigns','all','util','lodash','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','status','set','Content-Range','error','stack','name','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','outbound','push','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','map','agents','loggedIn','busy','pTalking','pick','length','some','connectedlinenum','internal','getMembers','UserId','accountcode','paused','online','loggedInDb','Queue','findAll','QueueId','find','idle','unknown','isNil','faxPause','mailPause','smsPause','whatsappPause','filter','pause','every','chatStatus'];(function(_0x1466c4,_0xb703c4){var _0x5994ff=function(_0x1b3740){while(--_0x1b3740){_0x1466c4['push'](_0x1466c4['shift']());}};_0x5994ff(++_0xb703c4);}(_0xb048,0x163));var _0x8b04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb048[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x8b04('0x0'));var _=require(_0x8b04('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x8b04('0x2'))(_0x8b04('0x3'));var db=require(_0x8b04('0x4'))['db'];var amiClient=jayson[_0x8b04('0x5')][_0x8b04('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0x8b04('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x102be2,_0x327fd0){return function(_0xe346b5){if(_0xe346b5){var _0x26591f=typeof _0x327fd0['offset']===_0x8b04('0x7')&&typeof _0x327fd0[_0x8b04('0x8')]===_0x8b04('0x7');var _0x18c35c=_0xe346b5[_0x8b04('0x9')];var _0x3edb2d=_0x26591f?0x0:_0x327fd0[_0x8b04('0xa')];var _0x17e17e=_0x26591f?_0xe346b5[_0x8b04('0x9')]:_0x327fd0['offset']+_0x327fd0[_0x8b04('0x8')];var _0x4dcdaa;if(_0x17e17e>=_0x18c35c){_0x17e17e=_0x18c35c;_0x4dcdaa=0xc8;}else{_0x4dcdaa=0xce;}_0x102be2[_0x8b04('0xb')](_0x4dcdaa);return _0x102be2[_0x8b04('0xc')](_0x8b04('0xd'),_0x3edb2d+'-'+_0x17e17e+'/'+_0x18c35c)['json'](_0xe346b5);}return null;};}function handleError(_0x54c89e,_0x60f887){_0x60f887=_0x60f887||0x1f4;return function(_0x31d3d2){logger[_0x8b04('0xe')](_0x31d3d2[_0x8b04('0xf')]);if(_0x31d3d2[_0x8b04('0x10')]){delete _0x31d3d2[_0x8b04('0x10')];}_0x54c89e[_0x8b04('0xb')](_0x60f887)['send'](_0x31d3d2);};}function getRealtimeAgents(){return new Promise(function(_0x3fdef2,_0x2338b1){return amiClient['request'](_0x8b04('0x11'),{})[_0x8b04('0x12')](function(_0x215ce6){if(_0x215ce6['error'])throw new Error(_0x8b04('0x13'));var _0x2c2ed5=_0x215ce6[_0x8b04('0x14')];return routingClient[_0x8b04('0x15')](_0x8b04('0x11'),{})[_0x8b04('0x12')](function(_0x488d65){if(_0x488d65[_0x8b04('0xe')])throw new Error(_0x8b04('0x16'));var _0x1400eb=_0x488d65['result'];return _0x3fdef2(_[_0x8b04('0x17')]({},_0x2c2ed5,_0x1400eb));});})[_0x8b04('0x18')](function(_0x2bb5ce){_0x2338b1(_0x2bb5ce);});});}function getRealtimeQueues(_0x58a17f,_0x34618e){return new Promise(function(_0x5cd289,_0x137f39){var _0x3f1620=_0x34618e===_0x8b04('0x19')?amiClient:routingClient;return _0x3f1620[_0x8b04('0x15')](_[_0x8b04('0x1a')](_0x34618e)+'Queues',_0x58a17f)[_0x8b04('0x12')](function(_0x22ef73){if(_0x22ef73[_0x8b04('0xe')])throw new Error(util[_0x8b04('0x1b')](_0x8b04('0x1c'),_0x34618e));return _0x5cd289(_0x22ef73[_0x8b04('0x14')]);})[_0x8b04('0x18')](function(_0x4ab95b){_0x137f39(_0x4ab95b);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5d255e,_0x1657e7){return amiClient[_0x8b04('0x15')]('VoiceQueuesChannels',{})[_0x8b04('0x12')](function(_0x4717a8){if(_0x4717a8[_0x8b04('0xe')])throw new Error(_0x8b04('0x1d'));return _0x5d255e(_0x4717a8[_0x8b04('0x14')]);})[_0x8b04('0x18')](function(_0x55b77a){_0x1657e7(_0x55b77a);});});}function initializeQueues(_0x448929,_0x3d577f,_0x4d0a19,_0x4de9e1){var _0x3cab63=['loggedIn',_0x8b04('0x1e'),_0x8b04('0x1f'),_0x8b04('0x20'),'paused'];if(_0x4d0a19===_0x8b04('0x19')&&_0x4de9e1===_0x8b04('0x21')){_0x3cab63[_0x8b04('0x22')]('pTalking',_0x8b04('0x23'),_0x8b04('0x24'),_0x8b04('0x25'),_0x8b04('0x26'),_0x8b04('0x27'),_0x8b04('0x28'),_0x8b04('0x29'),_0x8b04('0x2a'),_0x8b04('0x2b'),_0x8b04('0x2c'),'erlangBusyFactor',_0x8b04('0x2d'),_0x8b04('0x2e'),_0x8b04('0x2f'),_0x8b04('0x30'),'predictiveIntervalTotalCalls',_0x8b04('0x31'),_0x8b04('0x32'),_0x8b04('0x33'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}return _0x448929[_0x8b04('0x34')](function(_0x3f42c1){var _0x1d6f33=_0x3f42c1['get']({'plain':!![]});_0x1d6f33[_0x8b04('0x35')]=[];_0x1d6f33['paused']=0x0;_0x1d6f33['loggedInDb']=0x0;_0x1d6f33[_0x8b04('0x36')]=0x0;_0x1d6f33[_0x8b04('0x1e')]=0x0;_0x1d6f33[_0x8b04('0x1f')]=0x0;if(_0x4d0a19===_0x8b04('0x19')){_0x1d6f33[_0x8b04('0x20')]=0x0;_0x1d6f33[_0x8b04('0x37')]=0x0;if(_0x4de9e1==='outbound'){_0x1d6f33[_0x8b04('0x38')]=0x0;_0x1d6f33[_0x8b04('0x23')]=0x0;}}var _0x59c9a4=_['find'](_0x3d577f,['id',_0x1d6f33['id']]);if(_0x59c9a4)_[_0x8b04('0x17')](_0x1d6f33,_[_0x8b04('0x39')](_0x59c9a4,_0x3cab63));return _0x1d6f33;});}function updateAgentVoiceStatus(_0x3c9a9e,_0xef6fdb,_0x493b72){var _0x1d2db4=_['filter'](_0x493b72,['queue',_0xef6fdb[_0x8b04('0x10')]]);if(_0x1d2db4[_0x8b04('0x3a')]===0x0)return _0x3c9a9e[_0x8b04('0x37')]=!![];if(_[_0x8b04('0x3b')](_0x1d2db4,[_0x8b04('0x3c'),_0x3c9a9e[_0x8b04('0x3d')]['toString']()]))return _0x3c9a9e[_0x8b04('0x20')]=!![];if(!_0x3c9a9e[_0x8b04('0x20')])return _0x3c9a9e[_0x8b04('0x37')]=!![];}function getVoiceQueueAgents(_0x15d3ee,_0x4d6b0d,_0x35efdf,_0x2279b8){var _0x4252cb=_['find'](_0x4d6b0d,['id',_0x15d3ee['id']]);if(!_0x4252cb)return _0x15d3ee;return _0x4252cb[_0x8b04('0x3e')]({'raw':!![]})[_0x8b04('0x12')](function(_0x37889f){for(var _0x2e5fb5=0x0;_0x2e5fb5<_0x37889f['length'];_0x2e5fb5++){var _0x44d8bb=_['find'](_0x35efdf,['id',_0x37889f[_0x2e5fb5][_0x8b04('0x3f')]]);if(!_0x44d8bb){_0x44d8bb={'id':_0x37889f[_0x2e5fb5][_0x8b04('0x3f')],'name':_0x37889f[_0x2e5fb5][_0x8b04('0x3f')],'accountcode':'','online':![]};}var _0xe64a14={'id':_0x44d8bb['id'],'name':_0x44d8bb['name'],'internal':_0x44d8bb[_0x8b04('0x40')],'online':Boolean(_0x44d8bb['online']),'paused':Boolean(_0x37889f[_0x2e5fb5][_0x8b04('0x41')])};if(_0x44d8bb['voiceStatus']==='talking')updateAgentVoiceStatus(_0xe64a14,_0x15d3ee,_0x2279b8);if(_0xe64a14[_0x8b04('0x42')])_0x15d3ee[_0x8b04('0x43')]++;if(_0xe64a14[_0x8b04('0x37')])_0x15d3ee['busy']++;if(_0xe64a14[_0x8b04('0x41')]&&!_0xe64a14[_0x8b04('0x37')]&&!_0xe64a14[_0x8b04('0x20')])_0x15d3ee[_0x8b04('0x41')]++;_0x15d3ee[_0x8b04('0x35')][_0x8b04('0x22')](_0xe64a14);}return _0x15d3ee;});}function getQueueAgents(_0x3c1c26,_0x45ec29,_0x3d5b67){var _0x483903='User'+_[_0x8b04('0x1a')](_0x3d5b67)+_0x8b04('0x44');var _0x315e97=_0x3d5b67+'Pause';return db[_0x483903][_0x8b04('0x45')]({'where':{[_[_0x8b04('0x1a')](_0x3d5b67)+_0x8b04('0x46')]:_0x3c1c26['id']},'raw':!![]})['then'](function(_0x5a7a5b){for(var _0xb0cef7=0x0;_0xb0cef7<_0x5a7a5b[_0x8b04('0x3a')];_0xb0cef7++){var _0x5e05bc=_[_0x8b04('0x47')](_0x45ec29,['id',_0x5a7a5b[_0xb0cef7][_0x8b04('0x3f')]]);if(!_0x5e05bc){_0x5e05bc={'id':_0x5a7a5b[_0xb0cef7][_0x8b04('0x3f')],'name':_0x5a7a5b[_0xb0cef7]['UserId'],'online':![],['pauseField']:![]};}var _0x2637da={'id':_0x5e05bc['id'],'name':_0x5e05bc[_0x8b04('0x10')],'online':Boolean(_0x5e05bc['online']),'paused':Boolean(_0x5e05bc[_0x315e97])};if(_0x2637da[_0x8b04('0x42')])_0x3c1c26[_0x8b04('0x43')]++;_0x3c1c26['agents']['push'](_0x2637da);}return _0x3c1c26;});}function isIdle(_0x361d2e){return _0x361d2e===_0x8b04('0x48')||_0x361d2e===_0x8b04('0x49')||_0x361d2e==='unavailable'||_0x361d2e==='ringing'||_[_0x8b04('0x4a')](_0x361d2e);}function isAgentPaused(_0xb9065d,_0x4d55d6){var _0x256ecd=[_0xb9065d['chatPause'],_0xb9065d[_0x8b04('0x4b')],_0xb9065d[_0x8b04('0x4c')],_0xb9065d['openchannelPause'],_0xb9065d[_0x8b04('0x4d')],_0xb9065d['voicePause'],_0xb9065d[_0x8b04('0x4e')]];if(!_0x4d55d6)return _['every'](_0x256ecd);var _0x253b4c=_[_0x8b04('0x4f')](_0x256ecd);return _0x253b4c['length']>0x0&&_0x253b4c['length']<_0x256ecd[_0x8b04('0x3a')]?!![]:![];}function isAgentIdle(_0x12a8c0){if(_0x12a8c0['voiceStatus']!=='idle'&&_0x12a8c0['voicePause']){_0x12a8c0['voiceStatus']=_0x8b04('0x50');return![];}return _[_0x8b04('0x51')]([_0x12a8c0[_0x8b04('0x52')],_0x12a8c0[_0x8b04('0x53')],_0x12a8c0[_0x8b04('0x54')],_0x12a8c0[_0x8b04('0x55')],_0x12a8c0[_0x8b04('0x56')],_0x12a8c0[_0x8b04('0x57')],_0x12a8c0[_0x8b04('0x58')]],isIdle);}function getAgentStatus(_0x2f54ef){var _0x2abe05=_0x8b04('0x49');if(isAgentPaused(_0x2f54ef))_0x2abe05=_0x8b04('0x50');else if(isAgentPaused(_0x2f54ef,!![]))_0x2abe05='*pause';else if(isAgentIdle(_0x2f54ef))_0x2abe05=_0x8b04('0x48');else _0x2abe05=_0x8b04('0x37');return _0x2abe05;}exports[_0x8b04('0x59')]=function(_0x110c5a,_0x9f3d98){var _0x32a3f3={'count':0x0,'rows':[]},_0x5ca48c={},_0x518568,_0x58684d,_0x8d0474=[_0x8b04('0x5a'),'online',_0x8b04('0x5b'),_0x8b04('0x5c'),_0x8b04('0x5d'),'lastPauseAt',_0x8b04('0x3d'),_0x8b04('0x5e'),'chatPause','openchannelPause',_0x8b04('0x4c'),_0x8b04('0x4d'),_0x8b04('0x4e'),'faxPause',_0x8b04('0x5f'),'chatCapacity','openchannelCapacity',_0x8b04('0x60'),'smsCapacity',_0x8b04('0x61'),_0x8b04('0x62'),'chatCurrentCapacity',_0x8b04('0x63'),_0x8b04('0x64'),_0x8b04('0x65'),_0x8b04('0x66'),_0x8b04('0x67'),_0x8b04('0x52'),_0x8b04('0x55'),_0x8b04('0x54'),'smsStatus','whatsappStatus',_0x8b04('0x53'),_0x8b04('0x57'),_0x8b04('0x68'),_0x8b04('0x69'),_0x8b04('0x6a'),_0x8b04('0x6b'),_0x8b04('0x6c'),_0x8b04('0x6d'),'voiceStatusTime','queue',_0x8b04('0x6e'),_0x8b04('0x6f'),_0x8b04('0x70'),'phoneBarEnableAutomaticScreenRecording',_0x8b04('0x71')],_0x43381b=[_0x8b04('0x72'),_0x8b04('0x73'),_0x8b04('0x4c'),'smsPause',_0x8b04('0x4e'),_0x8b04('0x4b'),_0x8b04('0x5f'),'online'];Promise[_0x8b04('0x74')]()['then'](function(){var _0x1402c=_[_0x8b04('0x34')](db['User'][_0x8b04('0x75')],function(_0x5e5cd6){return{'name':_0x5e5cd6[_0x8b04('0x76')],'type':_0x5e5cd6[_0x8b04('0x77')][_0x8b04('0x78')]};});_0x110c5a[_0x8b04('0x79')][_0x8b04('0x7a')]='agent';_0x110c5a[_0x8b04('0x79')]['online']=!![];_0x5ca48c=qs[_0x8b04('0x7b')](_0x1402c,_0x110c5a);_0x5ca48c[_0x8b04('0x7c')]=!![];if(_0x110c5a[_0x8b04('0x7d')]['role']===_0x8b04('0x7d')){var _0x25f6da={'params':{'id':_0x110c5a[_0x8b04('0x7d')]['userProfileId']},'query':{'section':_0x8b04('0x11'),'role':_0x8b04('0x7e'),'online':!![],'nolimit':_0x110c5a[_0x8b04('0x79')][_0x8b04('0x7f')],'sort':_0x110c5a['query'][_0x8b04('0x80')],'filter':_0x110c5a[_0x8b04('0x79')][_0x8b04('0x4f')]},'raw':!![]};return db['UserProfile'][_0x8b04('0x81')](_0x25f6da);}return db[_0x8b04('0x82')][_0x8b04('0x83')](_0x5ca48c);})['then'](function(_0xd12287){_0x32a3f3[_0x8b04('0x9')]=_0xd12287[_0x8b04('0x9')];_0x518568=_0xd12287[_0x8b04('0x84')];return getRealtimeAgents();})[_0x8b04('0x12')](function(_0x28fe83){_0x58684d=_0x28fe83[_0x8b04('0x84')];return _0x518568[_0x8b04('0x34')](function(_0x9fdf4a){var _0x380c84=_[_0x8b04('0x47')](_0x58684d,['id',_0x9fdf4a['id']]);if(_0x380c84)_[_0x8b04('0x17')](_0x9fdf4a,_[_0x8b04('0x39')](_['omit'](_0x380c84,_0x43381b),_0x8d0474));_0x9fdf4a[_0x8b04('0x85')]=getAgentStatus(_0x9fdf4a);return _0x9fdf4a;});})[_0x8b04('0x12')](function(_0x4e830f){if(_0x110c5a['query'][_0x8b04('0x86')]){var _0x53542f=_[_0x8b04('0x4f')](_0x4e830f,['globalStatus',_0x110c5a[_0x8b04('0x79')][_0x8b04('0x86')]]);if(_0x110c5a[_0x8b04('0x79')]['pauseTypeFilter']){_0x53542f=_[_0x8b04('0x4f')](_0x53542f,[_0x8b04('0x5d'),_0x110c5a[_0x8b04('0x79')][_0x8b04('0x87')]]);}}_0x32a3f3['rows']=_0x53542f||_0x4e830f;return _0x32a3f3;})[_0x8b04('0x12')](respondWithFilteredResult(_0x9f3d98,_0x5ca48c))['catch'](handleError(_0x9f3d98,null));};exports[_0x8b04('0x88')]=function(_0x361372,_0x237049){var _0x1260a4=['mail','chat','sms',_0x8b04('0x89'),_0x8b04('0x8a'),'whatsapp',_0x8b04('0x19')];var _0x588665={'count':0x0,'rows':[]},_0x247515={},_0x45c7bb,_0xf23c73,_0xeef554,_0x68f725,_0x1b1117;Promise[_0x8b04('0x74')]()['then'](function(){if(_0x361372[_0x8b04('0x79')][_0x8b04('0x8b')]){if(!_[_0x8b04('0x8c')](_0x1260a4,_0x361372['query'][_0x8b04('0x8b')][_0x8b04('0x8d')]()))throw new Error(_0x8b04('0x8e'));_0x45c7bb=_0x361372[_0x8b04('0x79')][_0x8b04('0x8b')][_0x8b04('0x8d')]();}var _0x1c110c=_[_0x8b04('0x1a')](_0x45c7bb)+'Queue';var _0x45c35f=_[_0x8b04('0x34')](db[_0x1c110c][_0x8b04('0x75')],function(_0x500617){return{'name':_0x500617['fieldName'],'type':_0x500617[_0x8b04('0x77')][_0x8b04('0x78')]};});_0x247515=qs[_0x8b04('0x7b')](_0x45c35f,_0x361372);if(_0x361372[_0x8b04('0x7d')][_0x8b04('0x7a')]==='user'){var _0x307db0={'params':{'id':_0x361372['user'][_0x8b04('0x8f')]},'query':{'section':_0x45c7bb==='voice'&&_0x361372['query'][_0x8b04('0x77')]===_0x8b04('0x21')?_0x8b04('0x90'):_[_0x8b04('0x1a')](_0x45c7bb)+'Queues','type':_0x361372[_0x8b04('0x79')][_0x8b04('0x77')],'nolimit':!![],'sort':_0x8b04('0x10'),'filter':_0x361372[_0x8b04('0x79')][_0x8b04('0x4f')]}};return db['UserProfile'][_0x8b04('0x81')](_0x307db0);}return db[_0x1c110c][_0x8b04('0x83')](_0x247515);})[_0x8b04('0x12')](function(_0x2ecb9d){_0x588665[_0x8b04('0x9')]=_0x2ecb9d[_0x8b04('0x9')];_0xf23c73=_0x2ecb9d[_0x8b04('0x84')];return getRealtimeQueues(_0x361372,_0x45c7bb);})[_0x8b04('0x12')](function(_0x4aedee){_0x68f725=_0x4aedee[_0x8b04('0x84')];return getRealtimeAgents();})[_0x8b04('0x12')](function(_0x5335ef){_0xeef554=_0x5335ef[_0x8b04('0x84')];if(_0x45c7bb!=_0x8b04('0x19'))return;return getRealtimeVoiceQueueChannels();})[_0x8b04('0x12')](function(_0x2e642e){_0x1b1117=_0x2e642e?_0x2e642e['rows']:[];return initializeQueues(_0xf23c73,_0x68f725,_0x45c7bb,_0x361372['query']['type']);})[_0x8b04('0x12')](function(_0x36896b){var _0x387b87=_0x36896b[_0x8b04('0x34')](function(_0x4dc849){if(_0x45c7bb===_0x8b04('0x19'))return getVoiceQueueAgents(_0x4dc849,_0xf23c73,_0xeef554,_0x1b1117);else return getQueueAgents(_0x4dc849,_0xeef554,_0x45c7bb);});return Promise[_0x8b04('0x91')](_0x387b87);})[_0x8b04('0x12')](function(_0x20f436){_0x588665[_0x8b04('0x84')]=_0x20f436;return _0x588665;})[_0x8b04('0x12')](respondWithFilteredResult(_0x237049,_0x247515))['catch'](handleError(_0x237049,null));}; \ No newline at end of file +var _0x8891=['http','undefined','limit','count','offset','status','set','json','error','name','send','request','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','outbound','push','pTalking','originated','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvgTalktime','get','agents','loggedInDb','loggedIn','busy','find','filter','queue','some','connectedlinenum','internal','toString','length','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','faxStatus','smsStatus','whatsappStatus','*pause','getAgents','userpic','lastLoginAt','pauseType','lastPauseAt','address','mailPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','mailStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','type','role','agent','query','getOptions','user','userProfileId','nolimit','sort','UserProfile','rows','pick','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','sms','openchannel','fax','whatsapp','includes','channel','toLowerCase','Invalid\x20channel','key','findAndCountAll','all','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb'];(function(_0x3475c6,_0x1b10f4){var _0x44667e=function(_0x32f647){while(--_0x32f647){_0x3475c6['push'](_0x3475c6['shift']());}};_0x44667e(++_0x1b10f4);}(_0x8891,0x119));var _0x1889=function(_0x591d44,_0x2b43a3){_0x591d44=_0x591d44-0x0;var _0x41dd26=_0x8891[_0x591d44];return _0x41dd26;};'use strict';var util=require(_0x1889('0x0'));var _=require(_0x1889('0x1'));var jayson=require('jayson/promise');var qs=require(_0x1889('0x2'));var logger=require(_0x1889('0x3'))('api');var db=require(_0x1889('0x4'))['db'];var amiClient=jayson['client'][_0x1889('0x5')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x4d7441,_0x422bda){return function(_0x46b16b){if(_0x46b16b){var _0x3fc592=typeof _0x422bda['offset']===_0x1889('0x6')&&typeof _0x422bda[_0x1889('0x7')]===_0x1889('0x6');var _0x3c8ab0=_0x46b16b[_0x1889('0x8')];var _0x35262d=_0x3fc592?0x0:_0x422bda[_0x1889('0x9')];var _0xbac9ff=_0x3fc592?_0x46b16b['count']:_0x422bda[_0x1889('0x9')]+_0x422bda[_0x1889('0x7')];var _0x445b1b;if(_0xbac9ff>=_0x3c8ab0){_0xbac9ff=_0x3c8ab0;_0x445b1b=0xc8;}else{_0x445b1b=0xce;}_0x4d7441[_0x1889('0xa')](_0x445b1b);return _0x4d7441[_0x1889('0xb')]('Content-Range',_0x35262d+'-'+_0xbac9ff+'/'+_0x3c8ab0)[_0x1889('0xc')](_0x46b16b);}return null;};}function handleError(_0x3744b8,_0x5aa8d8){_0x5aa8d8=_0x5aa8d8||0x1f4;return function(_0x159434){logger[_0x1889('0xd')](_0x159434['stack']);if(_0x159434['name']){delete _0x159434[_0x1889('0xe')];}_0x3744b8['status'](_0x5aa8d8)[_0x1889('0xf')](_0x159434);};}function getRealtimeAgents(){return new Promise(function(_0x2297b8,_0x18d47c){return amiClient[_0x1889('0x10')](_0x1889('0x11'),{})[_0x1889('0x12')](function(_0x3a6dfa){if(_0x3a6dfa[_0x1889('0xd')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0xb9ae39=_0x3a6dfa[_0x1889('0x13')];return routingClient[_0x1889('0x10')](_0x1889('0x11'),{})[_0x1889('0x12')](function(_0x3f8e14){if(_0x3f8e14[_0x1889('0xd')])throw new Error(_0x1889('0x14'));var _0x4c0abe=_0x3f8e14[_0x1889('0x13')];return _0x2297b8(_[_0x1889('0x15')]({},_0xb9ae39,_0x4c0abe));});})[_0x1889('0x16')](function(_0x50e7e3){_0x18d47c(_0x50e7e3);});});}function getRealtimeQueues(_0x5d4135,_0x163dfc){return new Promise(function(_0xc59e4a,_0x5c18b8){var _0x353a71=_0x163dfc===_0x1889('0x17')?amiClient:routingClient;return _0x353a71[_0x1889('0x10')](_[_0x1889('0x18')](_0x163dfc)+_0x1889('0x19'),_0x5d4135)[_0x1889('0x12')](function(_0x4a57c0){if(_0x4a57c0['error'])throw new Error(util[_0x1889('0x1a')](_0x1889('0x1b'),_0x163dfc));return _0xc59e4a(_0x4a57c0[_0x1889('0x13')]);})[_0x1889('0x16')](function(_0x5a77c0){_0x5c18b8(_0x5a77c0);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0xf7d9f7,_0x420e69){return amiClient[_0x1889('0x10')](_0x1889('0x1c'),{})[_0x1889('0x12')](function(_0x382b9f){if(_0x382b9f['error'])throw new Error(_0x1889('0x1d'));return _0xf7d9f7(_0x382b9f[_0x1889('0x13')]);})['catch'](function(_0x3a9c5f){_0x420e69(_0x3a9c5f);});});}function initializeQueues(_0x12fd3f,_0x490be9,_0x14e6b0,_0x2712f9){var _0x1c3e1b=['loggedIn',_0x1889('0x1e'),_0x1889('0x1f'),_0x1889('0x20'),_0x1889('0x21')];if(_0x14e6b0===_0x1889('0x17')&&_0x2712f9===_0x1889('0x22')){_0x1c3e1b[_0x1889('0x23')](_0x1889('0x24'),_0x1889('0x25'),'message',_0x1889('0x26'),_0x1889('0x27'),'Trunk',_0x1889('0x28'),_0x1889('0x29'),_0x1889('0x2a'),'erlangCallToSecond','erlangAbandonmentRate',_0x1889('0x2b'),_0x1889('0x2c'),'dialPredictiveIntervalMaxThreshold',_0x1889('0x2d'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x1889('0x2e'));}return _0x12fd3f['map'](function(_0x318e6e){var _0x328066=_0x318e6e[_0x1889('0x2f')]({'plain':!![]});_0x328066[_0x1889('0x30')]=[];_0x328066[_0x1889('0x21')]=0x0;_0x328066[_0x1889('0x31')]=0x0;_0x328066[_0x1889('0x32')]=0x0;_0x328066[_0x1889('0x1e')]=0x0;_0x328066['waiting']=0x0;if(_0x14e6b0===_0x1889('0x17')){_0x328066['talking']=0x0;_0x328066[_0x1889('0x33')]=0x0;if(_0x2712f9===_0x1889('0x22')){_0x328066[_0x1889('0x24')]=0x0;_0x328066['originated']=0x0;}}var _0x22bb80=_[_0x1889('0x34')](_0x490be9,['id',_0x328066['id']]);if(_0x22bb80)_[_0x1889('0x15')](_0x328066,_['pick'](_0x22bb80,_0x1c3e1b));return _0x328066;});}function updateAgentVoiceStatus(_0x509ab3,_0x49e6c1,_0x141a0d){var _0x349af6=_[_0x1889('0x35')](_0x141a0d,[_0x1889('0x36'),_0x49e6c1['name']]);if(_0x349af6['length']===0x0)return _0x509ab3[_0x1889('0x33')]=!![];if(_[_0x1889('0x37')](_0x349af6,[_0x1889('0x38'),_0x509ab3[_0x1889('0x39')][_0x1889('0x3a')]()]))return _0x509ab3[_0x1889('0x20')]=!![];if(!_0x509ab3[_0x1889('0x20')])return _0x509ab3[_0x1889('0x33')]=!![];}function getVoiceQueueAgents(_0x44909c,_0x34b0ca,_0x973e40,_0x2a43ae){var _0x2ecacb=_['find'](_0x34b0ca,['id',_0x44909c['id']]);if(!_0x2ecacb)return _0x44909c;return _0x2ecacb['getMembers']({'raw':!![]})['then'](function(_0x2c577d){for(var _0x51e965=0x0;_0x51e965<_0x2c577d[_0x1889('0x3b')];_0x51e965++){var _0x5b9ae4=_[_0x1889('0x34')](_0x973e40,['id',_0x2c577d[_0x51e965][_0x1889('0x3c')]]);if(!_0x5b9ae4){_0x5b9ae4={'id':_0x2c577d[_0x51e965][_0x1889('0x3c')],'name':_0x2c577d[_0x51e965]['UserId'],'accountcode':'','online':![]};}var _0x4caf16={'id':_0x5b9ae4['id'],'name':_0x5b9ae4[_0x1889('0xe')],'internal':_0x5b9ae4[_0x1889('0x3d')],'online':Boolean(_0x5b9ae4[_0x1889('0x3e')]),'paused':Boolean(_0x2c577d[_0x51e965][_0x1889('0x21')])};if(_0x5b9ae4[_0x1889('0x3f')]==='talking')updateAgentVoiceStatus(_0x4caf16,_0x44909c,_0x2a43ae);if(_0x4caf16['online'])_0x44909c[_0x1889('0x31')]++;if(_0x4caf16[_0x1889('0x33')])_0x44909c[_0x1889('0x33')]++;if(_0x4caf16[_0x1889('0x21')]&&!_0x4caf16[_0x1889('0x33')]&&!_0x4caf16['talking'])_0x44909c['paused']++;_0x44909c[_0x1889('0x30')]['push'](_0x4caf16);}return _0x44909c;});}function getQueueAgents(_0x11857b,_0x3e144c,_0x19f1e3){var _0x385eab=_0x1889('0x40')+_['startCase'](_0x19f1e3)+_0x1889('0x41');var _0x3060d7=_0x19f1e3+_0x1889('0x42');return db[_0x385eab][_0x1889('0x43')]({'where':{[_['startCase'](_0x19f1e3)+'QueueId']:_0x11857b['id']},'raw':!![]})[_0x1889('0x12')](function(_0x5238f0){for(var _0x116b49=0x0;_0x116b49<_0x5238f0[_0x1889('0x3b')];_0x116b49++){var _0xb31253=_[_0x1889('0x34')](_0x3e144c,['id',_0x5238f0[_0x116b49][_0x1889('0x3c')]]);if(!_0xb31253){_0xb31253={'id':_0x5238f0[_0x116b49][_0x1889('0x3c')],'name':_0x5238f0[_0x116b49]['UserId'],'online':![],['pauseField']:![]};}var _0x67e1e3={'id':_0xb31253['id'],'name':_0xb31253[_0x1889('0xe')],'online':Boolean(_0xb31253[_0x1889('0x3e')]),'paused':Boolean(_0xb31253[_0x3060d7])};if(_0x67e1e3[_0x1889('0x3e')])_0x11857b['loggedInDb']++;_0x11857b['agents'][_0x1889('0x23')](_0x67e1e3);}return _0x11857b;});}function isIdle(_0x5d7bdc){return _0x5d7bdc===_0x1889('0x44')||_0x5d7bdc===_0x1889('0x45')||_0x5d7bdc===_0x1889('0x46')||_0x5d7bdc===_0x1889('0x47')||_[_0x1889('0x48')](_0x5d7bdc);}function isAgentPaused(_0x536b14,_0x49bd81){var _0x2fb1fb=[_0x536b14[_0x1889('0x49')],_0x536b14[_0x1889('0x4a')],_0x536b14['mailPause'],_0x536b14[_0x1889('0x4b')],_0x536b14[_0x1889('0x4c')],_0x536b14[_0x1889('0x4d')],_0x536b14[_0x1889('0x4e')]];if(!_0x49bd81)return _[_0x1889('0x4f')](_0x2fb1fb);var _0x47afb6=_[_0x1889('0x35')](_0x2fb1fb);return _0x47afb6[_0x1889('0x3b')]>0x0&&_0x47afb6[_0x1889('0x3b')]<_0x2fb1fb[_0x1889('0x3b')]?!![]:![];}function isAgentIdle(_0x20655f){if(_0x20655f['voiceStatus']!==_0x1889('0x44')&&_0x20655f['voicePause']){_0x20655f[_0x1889('0x3f')]=_0x1889('0x50');return![];}return _[_0x1889('0x4f')]([_0x20655f['chatStatus'],_0x20655f[_0x1889('0x51')],_0x20655f['mailStatus'],_0x20655f['openchannelStatus'],_0x20655f[_0x1889('0x52')],_0x20655f[_0x1889('0x3f')],_0x20655f[_0x1889('0x53')]],isIdle);}function getAgentStatus(_0x3d3a6b){var _0x29750d=_0x1889('0x45');if(isAgentPaused(_0x3d3a6b))_0x29750d=_0x1889('0x50');else if(isAgentPaused(_0x3d3a6b,!![]))_0x29750d=_0x1889('0x54');else if(isAgentIdle(_0x3d3a6b))_0x29750d=_0x1889('0x44');else _0x29750d=_0x1889('0x33');return _0x29750d;}exports[_0x1889('0x55')]=function(_0x2e5967,_0x3432f4){var _0x2dd88e={'count':0x0,'rows':[]},_0x4260c2={},_0x26006b,_0x4e9f35,_0x1b2efd=[_0x1889('0x56'),'online',_0x1889('0x57'),'lastPauseAt',_0x1889('0x58'),_0x1889('0x59'),_0x1889('0x39'),_0x1889('0x5a'),_0x1889('0x49'),'openchannelPause',_0x1889('0x5b'),_0x1889('0x4c'),_0x1889('0x4e'),_0x1889('0x4a'),_0x1889('0x4d'),_0x1889('0x5c'),_0x1889('0x5d'),'mailCapacity',_0x1889('0x5e'),_0x1889('0x5f'),_0x1889('0x60'),'chatCurrentCapacity',_0x1889('0x61'),'mailCurrentCapacity','smsCurrentCapacity',_0x1889('0x62'),_0x1889('0x63'),_0x1889('0x64'),_0x1889('0x65'),_0x1889('0x66'),_0x1889('0x52'),_0x1889('0x53'),_0x1889('0x51'),'voiceStatus',_0x1889('0x67'),'openchannelStatusTime',_0x1889('0x68'),_0x1889('0x69'),_0x1889('0x6a'),'faxStatusTime',_0x1889('0x6b'),_0x1889('0x36'),'destconnectedlinenum',_0x1889('0x6c'),'phoneBarEnableScreenRecordingByAgent',_0x1889('0x6d'),_0x1889('0x6e')],_0x374577=[_0x1889('0x49'),'openchannelPause',_0x1889('0x5b'),_0x1889('0x4c'),_0x1889('0x4e'),'faxPause','voicePause','online'];Promise[_0x1889('0x6f')]()[_0x1889('0x12')](function(){var _0x177881=_[_0x1889('0x70')](db['User'][_0x1889('0x71')],function(_0x59388f){return{'name':_0x59388f[_0x1889('0x72')],'type':_0x59388f[_0x1889('0x73')]['key']};});_0x2e5967['query'][_0x1889('0x74')]=_0x1889('0x75');_0x2e5967[_0x1889('0x76')][_0x1889('0x3e')]=!![];_0x4260c2=qs[_0x1889('0x77')](_0x177881,_0x2e5967);_0x4260c2['raw']=!![];if(_0x2e5967['user']['role']===_0x1889('0x78')){var _0x7c29fd={'params':{'id':_0x2e5967[_0x1889('0x78')][_0x1889('0x79')]},'query':{'section':_0x1889('0x11'),'role':'agent','online':!![],'nolimit':_0x2e5967[_0x1889('0x76')][_0x1889('0x7a')],'sort':_0x2e5967[_0x1889('0x76')][_0x1889('0x7b')],'filter':_0x2e5967['query'][_0x1889('0x35')]},'raw':!![]};return db[_0x1889('0x7c')]['getResources'](_0x7c29fd);}return db[_0x1889('0x40')]['findAndCountAll'](_0x4260c2);})[_0x1889('0x12')](function(_0x51e986){_0x2dd88e[_0x1889('0x8')]=_0x51e986[_0x1889('0x8')];_0x26006b=_0x51e986[_0x1889('0x7d')];return getRealtimeAgents();})[_0x1889('0x12')](function(_0x3e2fda){_0x4e9f35=_0x3e2fda[_0x1889('0x7d')];return _0x26006b['map'](function(_0x13a2dc){var _0x358d67=_[_0x1889('0x34')](_0x4e9f35,['id',_0x13a2dc['id']]);if(_0x358d67)_['merge'](_0x13a2dc,_[_0x1889('0x7e')](_['omit'](_0x358d67,_0x374577),_0x1b2efd));_0x13a2dc[_0x1889('0x7f')]=getAgentStatus(_0x13a2dc);return _0x13a2dc;});})['then'](function(_0x233dd8){if(_0x2e5967['query'][_0x1889('0x80')]){var _0x13b638=_['filter'](_0x233dd8,[_0x1889('0x7f'),_0x2e5967[_0x1889('0x76')][_0x1889('0x80')]]);if(_0x2e5967[_0x1889('0x76')][_0x1889('0x81')]){_0x13b638=_['filter'](_0x13b638,['pauseType',_0x2e5967[_0x1889('0x76')][_0x1889('0x81')]]);}}_0x2dd88e[_0x1889('0x7d')]=_0x13b638||_0x233dd8;return _0x2dd88e;})[_0x1889('0x12')](respondWithFilteredResult(_0x3432f4,_0x4260c2))[_0x1889('0x16')](handleError(_0x3432f4,null));};exports[_0x1889('0x82')]=function(_0x2e733d,_0x51f64c){var _0xbab7b2=[_0x1889('0x83'),'chat',_0x1889('0x84'),_0x1889('0x85'),_0x1889('0x86'),_0x1889('0x87'),'voice'];var _0x24bf4e={'count':0x0,'rows':[]},_0x1224f9={},_0x15840a,_0x5ee02e,_0x437ae5,_0x2a9505,_0x330f97;Promise[_0x1889('0x6f')]()['then'](function(){if(_0x2e733d[_0x1889('0x76')]['channel']){if(!_[_0x1889('0x88')](_0xbab7b2,_0x2e733d[_0x1889('0x76')][_0x1889('0x89')][_0x1889('0x8a')]()))throw new Error(_0x1889('0x8b'));_0x15840a=_0x2e733d[_0x1889('0x76')][_0x1889('0x89')][_0x1889('0x8a')]();}var _0x5177c3=_[_0x1889('0x18')](_0x15840a)+_0x1889('0x41');var _0x2b3046=_[_0x1889('0x70')](db[_0x5177c3]['rawAttributes'],function(_0x2bdab6){return{'name':_0x2bdab6[_0x1889('0x72')],'type':_0x2bdab6[_0x1889('0x73')][_0x1889('0x8c')]};});_0x1224f9=qs[_0x1889('0x77')](_0x2b3046,_0x2e733d);if(_0x2e733d['user']['role']===_0x1889('0x78')){var _0x5295d7={'params':{'id':_0x2e733d['user'][_0x1889('0x79')]},'query':{'section':_0x15840a===_0x1889('0x17')&&_0x2e733d['query'][_0x1889('0x73')]===_0x1889('0x22')?'QueueCampaigns':_[_0x1889('0x18')](_0x15840a)+'Queues','type':_0x2e733d['query'][_0x1889('0x73')],'nolimit':!![],'sort':'name','filter':_0x2e733d['query'][_0x1889('0x35')]}};return db[_0x1889('0x7c')]['getResources'](_0x5295d7);}return db[_0x5177c3][_0x1889('0x8d')](_0x1224f9);})[_0x1889('0x12')](function(_0x249392){_0x24bf4e['count']=_0x249392[_0x1889('0x8')];_0x5ee02e=_0x249392['rows'];return getRealtimeQueues(_0x2e733d,_0x15840a);})[_0x1889('0x12')](function(_0x532420){_0x2a9505=_0x532420[_0x1889('0x7d')];return getRealtimeAgents();})[_0x1889('0x12')](function(_0x168eac){_0x437ae5=_0x168eac[_0x1889('0x7d')];if(_0x15840a!=_0x1889('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0x1889('0x12')](function(_0x2058c0){_0x330f97=_0x2058c0?_0x2058c0[_0x1889('0x7d')]:[];return initializeQueues(_0x5ee02e,_0x2a9505,_0x15840a,_0x2e733d[_0x1889('0x76')][_0x1889('0x73')]);})[_0x1889('0x12')](function(_0x439339){var _0x57bf33=_0x439339[_0x1889('0x70')](function(_0x4c16d6){if(_0x15840a===_0x1889('0x17'))return getVoiceQueueAgents(_0x4c16d6,_0x5ee02e,_0x437ae5,_0x330f97);else return getQueueAgents(_0x4c16d6,_0x437ae5,_0x15840a);});return Promise[_0x1889('0x8e')](_0x57bf33);})['then'](function(_0x44a5e8){_0x24bf4e[_0x1889('0x7d')]=_0x44a5e8;return _0x24bf4e;})[_0x1889('0x12')](respondWithFilteredResult(_0x51f64c,_0x1224f9))[_0x1889('0x16')](handleError(_0x51f64c,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 339468a..fd1fe90 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x55a7c2,_0x365314){var _0xd12715=function(_0x1ba366){while(--_0x1ba366){_0x55a7c2['push'](_0x55a7c2['shift']());}};_0xd12715(++_0x365314);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3242f8,_0x452998){var _0x47e17f=function(_0x4caf30){while(--_0x4caf30){_0x3242f8['push'](_0x3242f8['shift']());}};_0x47e17f(++_0x452998);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index d1b5f0d..1c513fd 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 _0x01db=['sequelize','STRING','DATE'];(function(_0x377c08,_0x4414a2){var _0x2be04f=function(_0xe62d4d){while(--_0xe62d4d){_0x377c08['push'](_0x377c08['shift']());}};_0x2be04f(++_0x4414a2);}(_0x01db,0x171));var _0xb01d=function(_0x37afe4,_0x405c60){_0x37afe4=_0x37afe4-0x0;var _0x2d3251=_0x01db[_0x37afe4];return _0x2d3251;};'use strict';var Sequelize=require(_0xb01d('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb01d('0x1')]},'scheduledat':{'type':Sequelize[_0xb01d('0x2')]},'uniqueid':{'type':Sequelize[_0xb01d('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb01d('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb01d('0x1')]},'membername':{'type':Sequelize[_0xb01d('0x1')]}}; \ No newline at end of file +var _0x8506=['exports','STRING','DATE','INTEGER'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x8506,0xe8));var _0x6850=function(_0x3f9e88,_0x2081bd){_0x3f9e88=_0x3f9e88-0x0;var _0x35af57=_0x8506[_0x3f9e88];return _0x35af57;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6850('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x6850('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6850('0x2')]},'ringtime':{'type':Sequelize[_0x6850('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6850('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6850('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 7fcff13..6d361c0 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 _0x66e5=['rimraf','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1fe082,_0x47a571){var _0x29c7fb=function(_0xdc85f5){while(--_0xdc85f5){_0x1fe082['push'](_0x1fe082['shift']());}};_0x29c7fb(++_0x47a571);}(_0x66e5,0x1cc));var _0x566e=function(_0x37a40c,_0xb8c51d){_0x37a40c=_0x37a40c-0x0;var _0x484731=_0x66e5[_0x37a40c];return _0x484731;};'use strict';var _=require(_0x566e('0x0'));var util=require(_0x566e('0x1'));var logger=require(_0x566e('0x2'))(_0x566e('0x3'));var moment=require(_0x566e('0x4'));var BPromise=require(_0x566e('0x5'));var rp=require(_0x566e('0x6'));var fs=require('fs');var path=require(_0x566e('0x7'));var rimraf=require(_0x566e('0x8'));var config=require('../../config/environment');var attributes=require(_0x566e('0x9'));module['exports']=function(_0x4907a1,_0x2df8ec){return _0x4907a1[_0x566e('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x566e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa726=['../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xa726,0x185));var _0x6a72=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa726[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x6a72('0x0'));var util=require(_0x6a72('0x1'));var logger=require('../../config/logger')(_0x6a72('0x2'));var moment=require(_0x6a72('0x3'));var BPromise=require('bluebird');var rp=require(_0x6a72('0x4'));var fs=require('fs');var path=require(_0x6a72('0x5'));var rimraf=require(_0x6a72('0x6'));var config=require(_0x6a72('0x7'));var attributes=require(_0x6a72('0x8'));module[_0x6a72('0x9')]=function(_0x18ee02,_0x151947){return _0x18ee02['define'](_0x6a72('0xa'),attributes,{'tableName':_0x6a72('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 5288934..4d39eaa 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 _0x76af=['result','ReportAgentPreview','create','body','options','CreateReportAgentPreview','stringify','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x76af,0x102));var _0xf76a=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x76af[_0x903228];return _0xcec81d;};'use strict';var _=require('lodash');var util=require(_0xf76a('0x0'));var moment=require('moment');var BPromise=require(_0xf76a('0x1'));var rs=require(_0xf76a('0x2'));var fs=require('fs');var Redis=require(_0xf76a('0x3'));var db=require(_0xf76a('0x4'))['db'];var utils=require(_0xf76a('0x5'));var logger=require(_0xf76a('0x6'))(_0xf76a('0x7'));var config=require(_0xf76a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf76a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d960a,_0x1548f3,_0x16dab5){return new BPromise(function(_0x35fc19,_0x132d92){return client['request'](_0x4d960a,_0x16dab5)[_0xf76a('0xa')](function(_0x1471ac){logger[_0xf76a('0xb')](_0xf76a('0xc'),_0x1548f3,'request\x20sent');logger['debug'](_0xf76a('0xd'),_0x1548f3,_0xf76a('0xe'),JSON['stringify'](_0x1471ac));if(_0x1471ac[_0xf76a('0xf')]){if(_0x1471ac['error']['code']===0x1f4){logger[_0xf76a('0xf')](_0xf76a('0xc'),_0x1548f3,_0x1471ac['error']['message']);return _0x132d92(_0x1471ac[_0xf76a('0xf')][_0xf76a('0x10')]);}logger['error'](_0xf76a('0xc'),_0x1548f3,_0x1471ac[_0xf76a('0xf')][_0xf76a('0x10')]);return _0x35fc19(_0x1471ac[_0xf76a('0xf')][_0xf76a('0x10')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1548f3,'request\x20sent');_0x35fc19(_0x1471ac[_0xf76a('0x11')][_0xf76a('0x10')]);}})['catch'](function(_0x396b1a){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1548f3,_0x396b1a);_0x132d92(_0x396b1a);});});}exports['CreateReportAgentPreview']=function(_0x2fa90f){var _0x20e6d6=this;return new Promise(function(_0x1de0e9,_0x3c4864){return db[_0xf76a('0x12')][_0xf76a('0x13')](_0x2fa90f[_0xf76a('0x14')],{'raw':_0x2fa90f[_0xf76a('0x15')]?_0x2fa90f[_0xf76a('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xf76a('0xa')](function(_0x55ef51){logger['info'](_0xf76a('0x16'),_0x2fa90f);logger['debug'](_0xf76a('0x16'),_0x2fa90f,JSON[_0xf76a('0x17')](_0x55ef51));_0x1de0e9(_0x55ef51);})[_0xf76a('0x18')](function(_0x1e6036){logger[_0xf76a('0xf')](_0xf76a('0x16'),_0x1e6036[_0xf76a('0x10')],_0x2fa90f);_0x3c4864(_0x20e6d6[_0xf76a('0xf')](0x1f4,_0x1e6036['message']));});});}; \ No newline at end of file +var _0x1c1a=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x230949,_0x790da6){var _0x54a3dd=function(_0x510d0d){while(--_0x510d0d){_0x230949['push'](_0x230949['shift']());}};_0x54a3dd(++_0x790da6);}(_0x1c1a,0x1b9));var _0xa1c1=function(_0xe94083,_0x15ab2c){_0xe94083=_0xe94083-0x0;var _0x91225=_0x1c1a[_0xe94083];return _0x91225;};'use strict';var _=require(_0xa1c1('0x0'));var util=require('util');var moment=require(_0xa1c1('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c1('0x2'));var fs=require('fs');var Redis=require(_0xa1c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1c1('0x4'));var logger=require(_0xa1c1('0x5'))(_0xa1c1('0x6'));var config=require(_0xa1c1('0x7'));var jayson=require(_0xa1c1('0x8'));var client=jayson[_0xa1c1('0x9')][_0xa1c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31c113,_0x7398f9,_0x35e0ee){return new BPromise(function(_0x1b5fd5,_0x31fc0d){return client[_0xa1c1('0xb')](_0x31c113,_0x35e0ee)[_0xa1c1('0xc')](function(_0x16c913){logger[_0xa1c1('0xd')](_0xa1c1('0xe'),_0x7398f9,_0xa1c1('0xf'));logger[_0xa1c1('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x7398f9,'request\x20sent',JSON[_0xa1c1('0x11')](_0x16c913));if(_0x16c913[_0xa1c1('0x12')]){if(_0x16c913[_0xa1c1('0x12')][_0xa1c1('0x13')]===0x1f4){logger[_0xa1c1('0x12')](_0xa1c1('0xe'),_0x7398f9,_0x16c913['error'][_0xa1c1('0x14')]);return _0x31fc0d(_0x16c913['error'][_0xa1c1('0x14')]);}logger['error'](_0xa1c1('0xe'),_0x7398f9,_0x16c913[_0xa1c1('0x12')]['message']);return _0x1b5fd5(_0x16c913['error'][_0xa1c1('0x14')]);}else{logger[_0xa1c1('0xd')](_0xa1c1('0xe'),_0x7398f9,_0xa1c1('0xf'));_0x1b5fd5(_0x16c913[_0xa1c1('0x15')][_0xa1c1('0x14')]);}})[_0xa1c1('0x16')](function(_0x1fa9f9){logger['error'](_0xa1c1('0xe'),_0x7398f9,_0x1fa9f9);_0x31fc0d(_0x1fa9f9);});});}exports[_0xa1c1('0x17')]=function(_0x270bae){var _0x303df1=this;return new Promise(function(_0x5de484,_0x4c3e8d){return db[_0xa1c1('0x18')][_0xa1c1('0x19')](_0x270bae[_0xa1c1('0x1a')],{'raw':_0x270bae[_0xa1c1('0x1b')]?_0x270bae[_0xa1c1('0x1b')][_0xa1c1('0x1c')]===undefined?!![]:![]:!![]})[_0xa1c1('0xc')](function(_0x130d7f){logger[_0xa1c1('0xd')](_0xa1c1('0x17'),_0x270bae);logger['debug'](_0xa1c1('0x17'),_0x270bae,JSON[_0xa1c1('0x11')](_0x130d7f));_0x5de484(_0x130d7f);})[_0xa1c1('0x16')](function(_0x39bad1){logger['error']('CreateReportAgentPreview',_0x39bad1[_0xa1c1('0x14')],_0x270bae);_0x4c3e8d(_0x303df1[_0xa1c1('0x12')](0x1f4,_0x39bad1['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e1137cc..db2676b 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 _0x3294=['showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','telephones','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id'];(function(_0x441c17,_0x1ada5b){var _0x2a22c4=function(_0x2b35eb){while(--_0x2b35eb){_0x441c17['push'](_0x441c17['shift']());}};_0x2a22c4(++_0x1ada5b);}(_0x3294,0x131));var _0x4329=function(_0x4031e5,_0x5d9cd0){_0x4031e5=_0x4031e5-0x0;var _0x25b248=_0x3294[_0x4031e5];return _0x25b248;};'use strict';var multer=require(_0x4329('0x0'));var util=require(_0x4329('0x1'));var path=require(_0x4329('0x2'));var express=require('express');var router=express[_0x4329('0x3')]();var auth=require(_0x4329('0x4'));var controller=require(_0x4329('0x5'));router['get'](_0x4329('0x6'),auth[_0x4329('0x7')](),controller['voiceChannels']);router[_0x4329('0x8')](_0x4329('0x9'),auth[_0x4329('0x7')](),controller[_0x4329('0xa')]);router[_0x4329('0x8')](_0x4329('0xb'),auth['isAuthenticated'](),controller[_0x4329('0xc')]);router['get']('/voice/queues',auth['isAuthenticated'](),controller[_0x4329('0xd')]);router[_0x4329('0x8')]('/chat/queues',auth[_0x4329('0x7')](),controller[_0x4329('0xe')]);router[_0x4329('0x8')](_0x4329('0xf'),auth[_0x4329('0x7')](),controller[_0x4329('0x10')]);router[_0x4329('0x8')]('/mail/accounts',auth[_0x4329('0x7')](),controller[_0x4329('0x11')]);router[_0x4329('0x8')](_0x4329('0x12'),auth[_0x4329('0x7')](),controller['openchannelQueues']);router[_0x4329('0x8')]('/sms/queues',auth[_0x4329('0x7')](),controller[_0x4329('0x13')]);router[_0x4329('0x8')](_0x4329('0x14'),auth[_0x4329('0x7')](),controller[_0x4329('0x15')]);router[_0x4329('0x8')](_0x4329('0x16'),auth['isAuthenticated'](),controller[_0x4329('0x17')]);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x4329('0x18')]);router[_0x4329('0x8')](_0x4329('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x4329('0x8')](_0x4329('0x1a'),auth[_0x4329('0x7')](),controller[_0x4329('0x1b')]);router[_0x4329('0x8')](_0x4329('0x1c'),auth[_0x4329('0x7')](),controller[_0x4329('0x1d')]);router['get'](_0x4329('0x1e'),auth[_0x4329('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x4329('0x8')](_0x4329('0x1f'),auth[_0x4329('0x7')](),controller['showVoiceQueues']);router['put'](_0x4329('0x1f'),auth[_0x4329('0x7')](),controller['updateVoiceQueue']);router[_0x4329('0x8')](_0x4329('0x20'),auth[_0x4329('0x7')](),controller[_0x4329('0x21')]);router[_0x4329('0x8')](_0x4329('0x22'),auth[_0x4329('0x7')](),controller[_0x4329('0x23')]);router[_0x4329('0x8')]('/agents',auth['isAuthenticated'](),controller[_0x4329('0x24')]);router['put'](_0x4329('0x25'),auth[_0x4329('0x7')](),controller[_0x4329('0x26')]);router['get']('/telephones',auth['isAuthenticated'](),controller[_0x4329('0x27')]);router['get']('/trunks',auth[_0x4329('0x7')](),controller['trunks']);router[_0x4329('0x8')](_0x4329('0x28'),auth[_0x4329('0x7')](),controller['campaigns']);router['get'](_0x4329('0x29'),auth['isAuthenticated'](),controller['faxAccounts']);router['get'](_0x4329('0x2a'),auth[_0x4329('0x7')](),controller[_0x4329('0x2b')]);router[_0x4329('0x8')](_0x4329('0x2c'),auth[_0x4329('0x7')](),controller[_0x4329('0x2d')]);router['get'](_0x4329('0x2e'),auth[_0x4329('0x7')](),controller[_0x4329('0x2f')]);router['get'](_0x4329('0x30'),auth[_0x4329('0x7')](),controller[_0x4329('0x31')]);router[_0x4329('0x8')](_0x4329('0x32'),auth[_0x4329('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0x4329('0x8')](_0x4329('0x33'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x4329('0x8')](_0x4329('0x34'),auth[_0x4329('0x7')](),controller[_0x4329('0x35')]);router[_0x4329('0x36')](_0x4329('0x37'),auth['isAuthenticated'](),controller[_0x4329('0x38')](_0x4329('0x39')));router[_0x4329('0x8')]('/mail/queues/:id',auth[_0x4329('0x7')](),controller[_0x4329('0x3a')]);router[_0x4329('0x36')](_0x4329('0x3b'),auth[_0x4329('0x7')](),controller['queueNotify']('chat'));router[_0x4329('0x8')](_0x4329('0x3c'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x4329('0x36')](_0x4329('0x3d'),auth[_0x4329('0x7')](),controller['queueNotify']('fax'));router[_0x4329('0x8')](_0x4329('0x3e'),auth[_0x4329('0x7')](),controller[_0x4329('0x3f')]);router[_0x4329('0x36')](_0x4329('0x40'),auth[_0x4329('0x7')](),controller['queueNotify'](_0x4329('0x41')));router['get']('/openchannel/queues/:id',auth[_0x4329('0x7')](),controller[_0x4329('0x42')]);router[_0x4329('0x36')](_0x4329('0x43'),auth[_0x4329('0x7')](),controller['queueNotify']('sms'));router[_0x4329('0x36')](_0x4329('0x44'),auth[_0x4329('0x7')](),controller['queueNotify']('whatsapp'));router[_0x4329('0x8')](_0x4329('0x45'),auth['isAuthenticated'](),controller[_0x4329('0x46')]);router[_0x4329('0x8')](_0x4329('0x47'),auth['isAuthenticated'](),controller[_0x4329('0x48')]);router['post']('/agents/:id/notify',auth[_0x4329('0x7')](),controller[_0x4329('0x49')]);module[_0x4329('0x4a')]=router; \ No newline at end of file +var _0x1b23=['chatQueues','/mail/queues','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues'];(function(_0x135f47,_0x160ad7){var _0x2de36d=function(_0x47b4b5){while(--_0x47b4b5){_0x135f47['push'](_0x135f47['shift']());}};_0x2de36d(++_0x160ad7);}(_0x1b23,0xd0));var _0x31b2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1b23[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x31b2('0x0'));var path=require(_0x31b2('0x1'));var express=require(_0x31b2('0x2'));var router=express[_0x31b2('0x3')]();var auth=require(_0x31b2('0x4'));var controller=require(_0x31b2('0x5'));router['get'](_0x31b2('0x6'),auth[_0x31b2('0x7')](),controller['voiceChannels']);router[_0x31b2('0x8')](_0x31b2('0x9'),auth[_0x31b2('0x7')](),controller[_0x31b2('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x31b2('0xb')]);router['get'](_0x31b2('0xc'),auth[_0x31b2('0x7')](),controller[_0x31b2('0xd')]);router[_0x31b2('0x8')]('/chat/queues',auth[_0x31b2('0x7')](),controller[_0x31b2('0xe')]);router['get'](_0x31b2('0xf'),auth[_0x31b2('0x7')](),controller['mailQueues']);router[_0x31b2('0x8')]('/mail/accounts',auth[_0x31b2('0x7')](),controller[_0x31b2('0x10')]);router[_0x31b2('0x8')](_0x31b2('0x11'),auth['isAuthenticated'](),controller['openchannelQueues']);router['get'](_0x31b2('0x12'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x31b2('0x8')](_0x31b2('0x13'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x14')]);router[_0x31b2('0x8')](_0x31b2('0x15'),auth[_0x31b2('0x7')](),controller['faxQueues']);router[_0x31b2('0x8')](_0x31b2('0x16'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x17')]);router[_0x31b2('0x8')](_0x31b2('0x18'),auth[_0x31b2('0x7')](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth[_0x31b2('0x7')](),controller['voiceQueuesChannel']);router['get'](_0x31b2('0x19'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x1a')]);router[_0x31b2('0x8')](_0x31b2('0x1b'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x1c')]);router[_0x31b2('0x8')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x31b2('0x1d')]);router[_0x31b2('0x1e')](_0x31b2('0x1f'),auth['isAuthenticated'](),controller[_0x31b2('0x20')]);router[_0x31b2('0x8')](_0x31b2('0x21'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x22')]);router['get'](_0x31b2('0x23'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x24')]);router[_0x31b2('0x8')](_0x31b2('0x25'),auth[_0x31b2('0x7')](),controller['agents']);router['put'](_0x31b2('0x26'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x27')]);router[_0x31b2('0x8')](_0x31b2('0x28'),auth['isAuthenticated'](),controller['telephones']);router[_0x31b2('0x8')]('/trunks',auth[_0x31b2('0x7')](),controller[_0x31b2('0x29')]);router[_0x31b2('0x8')](_0x31b2('0x2a'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x2b')]);router[_0x31b2('0x8')]('/fax/accounts',auth[_0x31b2('0x7')](),controller[_0x31b2('0x2c')]);router[_0x31b2('0x8')](_0x31b2('0x2d'),auth['isAuthenticated'](),controller[_0x31b2('0x2e')]);router[_0x31b2('0x8')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x31b2('0x8')]('/openchannel/queues/waitinginteractions',auth[_0x31b2('0x7')](),controller[_0x31b2('0x2f')]);router[_0x31b2('0x8')]('/openchannel/queues/:id/waitinginteractions',auth[_0x31b2('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x31b2('0x8')](_0x31b2('0x30'),auth[_0x31b2('0x7')](),controller['smsQueuesWaitingInteractions']);router['get'](_0x31b2('0x31'),auth[_0x31b2('0x7')](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x31b2('0x32')]);router[_0x31b2('0x33')](_0x31b2('0x34'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x35')](_0x31b2('0x36')));router['get'](_0x31b2('0x37'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x38')]);router[_0x31b2('0x33')](_0x31b2('0x39'),auth['isAuthenticated'](),controller[_0x31b2('0x35')](_0x31b2('0x3a')));router[_0x31b2('0x8')](_0x31b2('0x3b'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x3c')]);router['post']('/fax/queues/:id/notify',auth[_0x31b2('0x7')](),controller['queueNotify']('fax'));router[_0x31b2('0x8')](_0x31b2('0x3d'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x3e')]);router[_0x31b2('0x33')](_0x31b2('0x3f'),auth['isAuthenticated'](),controller[_0x31b2('0x35')](_0x31b2('0x40')));router['get']('/openchannel/queues/:id',auth[_0x31b2('0x7')](),controller[_0x31b2('0x41')]);router[_0x31b2('0x33')](_0x31b2('0x42'),auth['isAuthenticated'](),controller[_0x31b2('0x35')](_0x31b2('0x43')));router['post'](_0x31b2('0x44'),auth['isAuthenticated'](),controller[_0x31b2('0x35')](_0x31b2('0x45')));router[_0x31b2('0x8')](_0x31b2('0x46'),auth[_0x31b2('0x7')](),controller['showSmsQueues']);router[_0x31b2('0x8')](_0x31b2('0x47'),auth[_0x31b2('0x7')](),controller[_0x31b2('0x48')]);router[_0x31b2('0x33')]('/agents/:id/notify',auth[_0x31b2('0x7')](),controller['agentNotify']);module[_0x31b2('0x49')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index fa66156..dbd7137 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 _0xdc97=['agents','Agents','agentCapacity','user','interaction','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Interaction','update','MessageId','From','TransferReport','create','Start','queue','*,*,*,*','channel','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','InteractionId','bluebird','moment','lodash','../../mysqldb','api','jayson/promise','http','client','request','then','error','code','message','json','sendStatus','name','status','send','isNil','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels'];(function(_0x89cf04,_0x4ca2f6){var _0xe20d05=function(_0x35aad2){while(--_0x35aad2){_0x89cf04['push'](_0x89cf04['shift']());}};_0xe20d05(++_0x4ca2f6);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2a1c8a,_0xa8a2d8){_0x2a1c8a=_0x2a1c8a-0x0;var _0x161120=_0xdc97[_0x2a1c8a];return _0x161120;};'use strict';var BPromise=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var _=require(_0x7dc9('0x2'));var util=require('util');var db=require(_0x7dc9('0x3'))['db'];var logger=require('../../config/logger')(_0x7dc9('0x4'));var jayson=require(_0x7dc9('0x5'));var amiClient=jayson['client'][_0x7dc9('0x6')]({'port':0x232a});var mailClient=jayson[_0x7dc9('0x7')][_0x7dc9('0x6')]({'port':0x232b});var routingClient=jayson[_0x7dc9('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){var _0x3318ea=_0x4b3229?_0x4b3229:amiClient;return _0x3318ea[_0x7dc9('0x8')](_0x2636ef,_0x4f91c7)[_0x7dc9('0x9')](function(_0x5ca05b){if(_0x5ca05b[_0x7dc9('0xa')]){if(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xb')]===0x1f4){return _0x23737d(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}return _0x2ff923(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}else{_0x2ff923(_0x5ca05b['result']);}})['catch'](function(_0x4be1c8){_0x23737d(_0x4be1c8);});});}function respondWithResult(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xc8;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['status'](_0x94c75a)[_0x7dc9('0xd')](_0x14e5db);}return _0x599ef1[_0x7dc9('0xe')](0x194);};}function handleError(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0x1f4;return function(_0x31d43d){logger[_0x7dc9('0xa')](_0x31d43d['stack']);if(_0x31d43d[_0x7dc9('0xf')]){delete _0x31d43d[_0x7dc9('0xf')];}_0xaadf2[_0x7dc9('0x10')](_0xf37bc7)[_0x7dc9('0x11')](_0x31d43d);};}function findById(_0x11606f){return function(_0xbe0437){if(!_[_0x7dc9('0x12')](_0x11606f)&&!_[_0x7dc9('0x12')](_0xbe0437)&&!_[_0x7dc9('0x12')](_0xbe0437['rows'])){return _[_0x7dc9('0x13')](_0xbe0437['rows'],function(_0x1f5906){return _0x1f5906['id']==_0x11606f;});}return null;};}exports[_0x7dc9('0x14')]=function(_0x5d61d7,_0x41f66e){return respondWithRpcPromise(_0x7dc9('0x15'),_0x5d61d7[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x41f66e,null))[_0x7dc9('0x17')](handleError(_0x41f66e,null));};exports[_0x7dc9('0x18')]=function(_0x2dad65,_0x2895f5){return respondWithRpcPromise(_0x7dc9('0x19'),_[_0x7dc9('0x1a')](_0x2dad65['query'],_0x2dad65['params']))[_0x7dc9('0x9')](respondWithResult(_0x2895f5,null))[_0x7dc9('0x17')](handleError(_0x2895f5,null));};exports['voiceChannelStopMixMonitor']=function(_0x349001,_0x27f7fa){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7dc9('0x1a')](_0x349001[_0x7dc9('0x16')],_0x349001[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x27f7fa,null))[_0x7dc9('0x17')](handleError(_0x27f7fa,null));};exports[_0x7dc9('0x1c')]=function(_0xf95336,_0x55a482){return respondWithRpcPromise('VoiceQueues',_0xf95336['query'])[_0x7dc9('0x9')](respondWithResult(_0x55a482,null))[_0x7dc9('0x17')](handleError(_0x55a482,null));};exports['showVoiceQueues']=function(_0x585eef,_0x47771b){return respondWithRpcPromise('VoiceQueues',_0x585eef[_0x7dc9('0x16')])[_0x7dc9('0x9')](findById(_0x585eef[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x47771b,null))[_0x7dc9('0x17')](handleError(_0x47771b,null));};exports[_0x7dc9('0x1d')]=function(_0x236d42,_0x229f8e){return respondWithRpcPromise(_0x7dc9('0x1e'),_[_0x7dc9('0x1a')](_0x236d42[_0x7dc9('0x1f')],_0x236d42[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x229f8e,null))['catch'](handleError(_0x229f8e,null));};exports['voiceQueuesPreview']=function(_0x49a4a5,_0x4a68f0){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x49a4a5['query'],_0x49a4a5[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4a68f0,null))[_0x7dc9('0x17')](handleError(_0x4a68f0,null));};exports[_0x7dc9('0x20')]=function(_0x3300ff,_0x154e22){return respondWithRpcPromise('VoiceQueuesChannels',_0x3300ff['query'])['then'](respondWithResult(_0x154e22,null))[_0x7dc9('0x17')](handleError(_0x154e22,null));};exports['voiceQueuesChannel']=function(_0x2b9ca0,_0x448e46){return respondWithRpcPromise(_0x7dc9('0x21'),_[_0x7dc9('0x1a')](_0x2b9ca0[_0x7dc9('0x16')],_0x2b9ca0[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x448e46,null))[_0x7dc9('0x17')](handleError(_0x448e46,null));};exports['voiceQueuesChannelHangup']=function(_0x2b56d7,_0x4cdec4){return respondWithRpcPromise(_0x7dc9('0x22'),_[_0x7dc9('0x1a')](_0x2b56d7[_0x7dc9('0x16')],_0x2b56d7[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x4cdec4,null))[_0x7dc9('0x17')](handleError(_0x4cdec4,null));};exports['voiceQueuesChannelRedirect']=function(_0x289560,_0x4f47af){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x7dc9('0x1a')](_0x289560[_0x7dc9('0x16')],_0x289560[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4f47af,null))['catch'](handleError(_0x4f47af,null));};exports[_0x7dc9('0x23')]=function(_0x183d87,_0x138f33){return respondWithRpcPromise(_0x7dc9('0x24'),_0x183d87[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x138f33,null))[_0x7dc9('0x17')](handleError(_0x138f33,null));};exports[_0x7dc9('0x25')]=function(_0x166906,_0x21bcfc){return respondWithRpcPromise(_0x7dc9('0x26'),_0x166906[_0x7dc9('0x16')])['then'](respondWithResult(_0x21bcfc,null))[_0x7dc9('0x17')](handleError(_0x21bcfc,null));};exports[_0x7dc9('0x27')]=function(_0x466b02,_0xfd2612){var _0x4bcdce;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')])[_0x7dc9('0x9')](function(_0x3876b6){_0x4bcdce=_0x3876b6;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')],routingClient);})['then'](function(_0x553230){return _[_0x7dc9('0x1a')]({},_0x553230,_0x4bcdce);})[_0x7dc9('0x9')](respondWithResult(_0xfd2612,null))['catch'](handleError(_0xfd2612,null));};exports[_0x7dc9('0x29')]=function(_0x4a37ec,_0x315d65){if(_0x4a37ec[_0x7dc9('0x1f')]&&_0x4a37ec[_0x7dc9('0x1f')]['interaction']&&_0x4a37ec[_0x7dc9('0x2a')]&&_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]){for(var _0x95513c in _0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')]){if(_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x7dc9('0x2c')](_0x95513c)){db['MemberReport']['findAll']({'where':{'channel':_0x95513c,'membername':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')],'type':_0x7dc9('0x2d'),'exitAt':null,'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c]&&_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')]?{'$notIn':_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x95513c]}:{'$ne':null}}})[_0x7dc9('0x9')](function(_0x1971c7){var _0x3c4d4c=moment()[_0x7dc9('0x2f')](_0x7dc9('0x30'));for(var _0x19957f=0x0,_0x575393=_0x1971c7[_0x7dc9('0x2e')];_0x19957f<_0x575393;_0x19957f+=0x1){_0x1971c7[_0x19957f][_0x7dc9('0x31')]({'exitAt':_0x3c4d4c});}});for(var _0x49bffe=0x0;_0x49bffe<_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')];_0x49bffe+=0x1){db['MemberReport'][_0x7dc9('0x32')]({'where':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'type':_0x7dc9('0x2d'),'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe],'exitAt':null},'defaults':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'interface':_[_0x7dc9('0x12')](_0x4a37ec['user'][_0x7dc9('0x33')])?util[_0x7dc9('0x2f')]('SIP/%s',_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]):_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x33')],'type':_0x7dc9('0x2d'),'enterAt':moment()[_0x7dc9('0x2f')](_0x7dc9('0x30')),'role':_0x7dc9('0x34'),'internal':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x35')],'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe]}});}}}}return respondWithRpcPromise(_0x7dc9('0x36'),{'id':_0x4a37ec['params']['id'],'capacity':_0x4a37ec[_0x7dc9('0x1f')]['capacity']},routingClient)['then'](respondWithResult(_0x315d65,null))[_0x7dc9('0x17')](handleError(_0x315d65,null));};exports[_0x7dc9('0x37')]=function(_0x40e382,_0x3902aa){return respondWithRpcPromise(_0x7dc9('0x38'),_0x40e382['query'])[_0x7dc9('0x9')](respondWithResult(_0x3902aa,null))[_0x7dc9('0x17')](handleError(_0x3902aa,null));};exports[_0x7dc9('0x39')]=function(_0x4a9b75,_0x341909){return respondWithRpcPromise(_0x7dc9('0x3a'),_0x4a9b75[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x341909,null))[_0x7dc9('0x17')](handleError(_0x341909,null));};exports[_0x7dc9('0x3b')]=function(_0x593132,_0x366b8b){return respondWithRpcPromise(_0x7dc9('0x3c'),_0x593132[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x17')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x3d')]=function(_0x31baf1,_0x24abb6){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x31baf1[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x24abb6,null))[_0x7dc9('0x17')](handleError(_0x24abb6,null));};exports['showChatQueues']=function(_0x1767b6,_0x39be46){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x1767b6[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x1767b6['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x39be46,null))[_0x7dc9('0x17')](handleError(_0x39be46,null));};exports[_0x7dc9('0x3f')]=function(_0x17ed6c,_0x2a1db8){return respondWithRpcPromise(_0x7dc9('0x40'),_0x17ed6c['query'],routingClient)['then'](respondWithResult(_0x2a1db8,null))['catch'](handleError(_0x2a1db8,null));};exports[_0x7dc9('0x41')]=function(_0x3daf33,_0x32a64f){return respondWithRpcPromise(_0x7dc9('0x40'),_0x3daf33['query'],routingClient)['then'](findById(_0x3daf33[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x32a64f,null))[_0x7dc9('0x17')](handleError(_0x32a64f,null));};exports[_0x7dc9('0x42')]=function(_0x2caf7f,_0x2272ef){return respondWithRpcPromise(_0x7dc9('0x43'),_0x2caf7f['query'],mailClient)[_0x7dc9('0x9')](respondWithResult(_0x2272ef,null))[_0x7dc9('0x17')](handleError(_0x2272ef,null));};exports[_0x7dc9('0x44')]=function(_0x1dad95,_0x4683b3){return respondWithRpcPromise('OpenchannelQueues',_0x1dad95[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x4683b3,null))[_0x7dc9('0x17')](handleError(_0x4683b3,null));};exports[_0x7dc9('0x45')]=function(_0x2454d7,_0x3a93c4){return respondWithRpcPromise(_0x7dc9('0x46'),_0x2454d7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x2454d7[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x3a93c4,null))[_0x7dc9('0x17')](handleError(_0x3a93c4,null));};exports[_0x7dc9('0x47')]=function(_0x5eee27,_0x3485b6){return respondWithRpcPromise('SmsQueues',_0x5eee27[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3485b6,null))['catch'](handleError(_0x3485b6,null));};exports[_0x7dc9('0x48')]=function(_0x24d2c7,_0x50e9a9){return respondWithRpcPromise(_0x7dc9('0x49'),_0x24d2c7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x24d2c7['params']['id']))['then'](respondWithResult(_0x50e9a9,null))[_0x7dc9('0x17')](handleError(_0x50e9a9,null));};exports[_0x7dc9('0x4a')]=function(_0x4ed60e,_0x3aba59){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x4ed60e[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3aba59,null))[_0x7dc9('0x17')](handleError(_0x3aba59,null));};exports[_0x7dc9('0x4c')]=function(_0x51b834,_0x35f31e){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x51b834[_0x7dc9('0x16')],routingClient)['then'](findById(_0x51b834['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x35f31e,null))[_0x7dc9('0x17')](handleError(_0x35f31e,null));};exports[_0x7dc9('0x4d')]=function(_0x2cf485,_0x59f3bd){return respondWithRpcPromise('FaxQueues',_0x2cf485[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x59f3bd,null))[_0x7dc9('0x17')](handleError(_0x59f3bd,null));};exports[_0x7dc9('0x4e')]=function(_0x5d211b,_0xea1728){return respondWithRpcPromise(_0x7dc9('0x4f'),_0x5d211b[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x5d211b[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0xea1728,null))[_0x7dc9('0x17')](handleError(_0xea1728,null));};exports['faxAccounts']=function(_0x2d7c33,_0x2cde0c){return respondWithRpcPromise('FaxAccounts',_0x2d7c33['query'])[_0x7dc9('0x9')](respondWithResult(_0x2cde0c,null))['catch'](handleError(_0x2cde0c,null));};exports[_0x7dc9('0x50')]=function(_0x466602,_0xd99a2){return respondWithRpcPromise(_0x7dc9('0x51'),_0x466602[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0xd99a2,null))[_0x7dc9('0x17')](handleError(_0xd99a2,null));};exports[_0x7dc9('0x52')]=function(_0x25f970,_0x30ce2f){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x25f970[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x30ce2f,null))[_0x7dc9('0x17')](handleError(_0x30ce2f,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x45c1b3,_0x585e42){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x45c1b3[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x585e42,null))['catch'](handleError(_0x585e42,null));};exports[_0x7dc9('0x53')]=function(_0x533738,_0x5a585a){return respondWithRpcPromise(_0x7dc9('0x54'),_0x533738[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](function(_0xb8be9){if(_0x533738['query'][_0x7dc9('0x55')]!==undefined){var _0xe944a4=_(_0xb8be9[_0x7dc9('0x56')])[_0x7dc9('0x57')]([_0x533738[_0x7dc9('0x16')][_0x7dc9('0x55')],_0x533738[_0x7dc9('0x1b')]['id']])[_0x7dc9('0x58')]('queue_id')['uniq']()[_0x7dc9('0x59')]();return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x1da142){return _0xe944a4[_0x7dc9('0x5a')](_0x1da142[_0x7dc9('0x5b')])>-0x1;});}else{return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x51a7e5){return _0x51a7e5['queue_id']===parseInt(_0x533738[_0x7dc9('0x1b')]['id']);});}})[_0x7dc9('0x9')](respondWithResult(_0x5a585a,null))[_0x7dc9('0x17')](handleError(_0x5a585a,null));};exports[_0x7dc9('0x5c')]=function(_0x5bc1c3,_0x2c3434){return respondWithRpcPromise(_0x7dc9('0x5d'),_0x5bc1c3['query'],routingClient)['then'](respondWithResult(_0x2c3434,null))[_0x7dc9('0x17')](handleError(_0x2c3434,null));};exports[_0x7dc9('0x5e')]=function(_0x49d7ef,_0x114078){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x49d7ef[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x114078,null))[_0x7dc9('0x17')](handleError(_0x114078,null));};exports['faxQueuesWaitingInteractions']=function(_0x33d68c,_0x3c7daf){return respondWithRpcPromise(_0x7dc9('0x5f'),_0x33d68c['query'],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3c7daf,null))['catch'](handleError(_0x3c7daf,null));};exports['queueNotify']=function(_0xa899){return function(_0x26244a,_0x31faa4){var _0x3657b6,_0x26d94e;var _0x56a00d=_[_0x7dc9('0x60')](_0xa899);var _0x1daf80=_0xa899===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x56a00d+'Queue'][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x26244a[_0x7dc9('0x1b')]['id']}})[_0x7dc9('0x9')](function(_0x200df7){if(_['isNil'](_0x200df7)){throw new Error(_0x56a00d+_0x7dc9('0x65'));}_0x3657b6=_0x200df7;return db[_0x56a00d+'Message']['findOne']({'where':{'id':_0x26244a[_0x7dc9('0x1f')]['messageId']},'include':[{'model':db[_0x56a00d+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x56a00d+_0x1daf80],'as':_0x7dc9('0x63')}]});})[_0x7dc9('0x9')](function(_0x38dccc){if(_[_0x7dc9('0x12')](_0x38dccc)){throw new Error(_0x56a00d+'\x20Message\x20not\x20found');}_0x26d94e=_0x38dccc;return _0x38dccc[_0x7dc9('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x1a4bfb={'uniqueid':_0xa899+'.'+_0x26d94e['id']+'.'+_0x26d94e[_0x7dc9('0x66')]['id'],'FromUserId':_0x26244a[_0x7dc9('0x2a')]['id'],'type':'queue'};_0x1a4bfb[_0x56a00d+_0x7dc9('0x68')]=_0x26d94e['id'];_0x1a4bfb[_0x56a00d+'InteractionId']=_0x26d94e[_0x7dc9('0x66')]['id'];_0x1a4bfb[_0x7dc9('0x69')+_0x56a00d+_0x1daf80+'Id']=_0x26d94e[_0x7dc9('0x63')]['id'];_0x1a4bfb['To'+_0x56a00d+'QueueId']=_0x3657b6['id'];return db[_0x56a00d+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x1a4bfb);})['then'](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0xa899,'interaction':_0x26d94e[_0x7dc9('0x66')],'message':_0x26d94e,'account':_0x26d94e[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x6d'),'appdata':_0x3657b6['name']+','+(_0x26d94e[_0x7dc9('0x63')]['queueTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})[_0x7dc9('0x9')](respondWithResult(_0x31faa4,null))[_0x7dc9('0x17')](handleError(_0x31faa4,null));};};exports['agentNotify']=function(_0x160bf0,_0x4588a7){var _0x23da2e,_0x568705;if(_['isNil'](_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x573fa9=_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')];var _0x5f3487=_[_0x7dc9('0x60')](_0x573fa9);var _0x5a44a1=_0x573fa9===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x7dc9('0x70')][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x160bf0[_0x7dc9('0x1b')]['id'],'role':'agent'}})[_0x7dc9('0x9')](function(_0x3fb268){if(_[_0x7dc9('0x12')](_0x3fb268)){throw new Error(_0x7dc9('0x71'));}_0x23da2e=_0x3fb268;return db[_0x5f3487+_0x7dc9('0x72')]['findOne']({'where':{'id':_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x73')]},'include':[{'model':db[_0x5f3487+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x5f3487+_0x5a44a1],'as':'Account'}]});})[_0x7dc9('0x9')](function(_0x54bd64){if(_['isNil'](_0x54bd64)){throw new Error(_0x5f3487+_0x7dc9('0x74'));}_0x568705=_0x54bd64;return _0x54bd64['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x19c880={'uniqueid':_0x573fa9+'.'+_0x568705['id']+'.'+_0x568705[_0x7dc9('0x66')]['id'],'FromUserId':_0x160bf0[_0x7dc9('0x2a')]['id'],'type':_0x7dc9('0x6d'),'ToUserId':_0x23da2e['id']};_0x19c880[_0x5f3487+_0x7dc9('0x68')]=_0x568705['id'];_0x19c880[_0x5f3487+_0x7dc9('0x75')]=_0x568705[_0x7dc9('0x66')]['id'];_0x19c880['From'+_0x5f3487+_0x5a44a1+'Id']=_0x568705[_0x7dc9('0x63')]['id'];return db[_0x5f3487+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x19c880);})[_0x7dc9('0x9')](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0x573fa9,'interaction':_0x568705['Interaction'],'message':_0x568705,'account':_0x568705[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x34'),'appdata':_0x23da2e[_0x7dc9('0xf')]+','+(_0x568705[_0x7dc9('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})['then'](respondWithResult(_0x4588a7,null))[_0x7dc9('0x17')](handleError(_0x4588a7,null));}; \ No newline at end of file +var _0x33c5=['VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','INTERACTION','length','format','updateAttributes','findOrCreate','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Account','findOne','Message','messageId','Interaction','update','queue','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x33c5,0xe6));var _0x533c=function(_0x324d02,_0x6d9c0b){_0x324d02=_0x324d02-0x0;var _0x3d4f59=_0x33c5[_0x324d02];return _0x3d4f59;};'use strict';var BPromise=require('bluebird');var moment=require(_0x533c('0x0'));var _=require(_0x533c('0x1'));var util=require('util');var db=require(_0x533c('0x2'))['db'];var logger=require(_0x533c('0x3'))(_0x533c('0x4'));var jayson=require(_0x533c('0x5'));var amiClient=jayson[_0x533c('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x533c('0x6')][_0x533c('0x7')]({'port':0x232b});var routingClient=jayson[_0x533c('0x6')][_0x533c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){var _0x1b929b=_0x3a009b?_0x3a009b:amiClient;return _0x1b929b[_0x533c('0x8')](_0x34ca89,_0x1699d5)[_0x533c('0x9')](function(_0x2c0214){if(_0x2c0214[_0x533c('0xa')]){if(_0x2c0214[_0x533c('0xa')][_0x533c('0xb')]===0x1f4){return _0x2c297c(_0x2c0214['error'][_0x533c('0xc')]);}return _0x36d74e(_0x2c0214[_0x533c('0xa')][_0x533c('0xc')]);}else{_0x36d74e(_0x2c0214[_0x533c('0xd')]);}})[_0x533c('0xe')](function(_0x346e0f){_0x2c297c(_0x346e0f);});});}function respondWithResult(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xc8;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0xf')](_0x5c9462)[_0x533c('0x10')](_0xf93007);}return _0x530e10[_0x533c('0x11')](0x194);};}function handleError(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0x1f4;return function(_0xa616ca){logger['error'](_0xa616ca[_0x533c('0x12')]);if(_0xa616ca[_0x533c('0x13')]){delete _0xa616ca[_0x533c('0x13')];}_0x1a2a83[_0x533c('0xf')](_0x8d7c66)['send'](_0xa616ca);};}function findById(_0x1031e7){return function(_0x1ed6ba){if(!_[_0x533c('0x14')](_0x1031e7)&&!_[_0x533c('0x14')](_0x1ed6ba)&&!_[_0x533c('0x14')](_0x1ed6ba[_0x533c('0x15')])){return _[_0x533c('0x16')](_0x1ed6ba[_0x533c('0x15')],function(_0x1f9f85){return _0x1f9f85['id']==_0x1031e7;});}return null;};}exports[_0x533c('0x17')]=function(_0x287b9e,_0x2c41e9){return respondWithRpcPromise(_0x533c('0x18'),_0x287b9e[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x2c41e9,null))[_0x533c('0xe')](handleError(_0x2c41e9,null));};exports[_0x533c('0x1a')]=function(_0x2bc58f,_0x4ba0bd){return respondWithRpcPromise(_0x533c('0x1b'),_['merge'](_0x2bc58f['query'],_0x2bc58f[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x4ba0bd,null))['catch'](handleError(_0x4ba0bd,null));};exports[_0x533c('0x1d')]=function(_0x37651e,_0x3839fe){return respondWithRpcPromise(_0x533c('0x1e'),_['merge'](_0x37651e[_0x533c('0x19')],_0x37651e[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x3839fe,null))[_0x533c('0xe')](handleError(_0x3839fe,null));};exports[_0x533c('0x1f')]=function(_0x140269,_0xb51a5){return respondWithRpcPromise(_0x533c('0x20'),_0x140269[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0xb51a5,null))['catch'](handleError(_0xb51a5,null));};exports[_0x533c('0x21')]=function(_0xfab4da,_0x503c2e){return respondWithRpcPromise(_0x533c('0x20'),_0xfab4da['query'])[_0x533c('0x9')](findById(_0xfab4da[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x503c2e,null))[_0x533c('0xe')](handleError(_0x503c2e,null));};exports[_0x533c('0x22')]=function(_0x146a8e,_0x212d1b){return respondWithRpcPromise(_0x533c('0x23'),_[_0x533c('0x24')](_0x146a8e[_0x533c('0x25')],_0x146a8e[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x212d1b,null))['catch'](handleError(_0x212d1b,null));};exports[_0x533c('0x26')]=function(_0x591499,_0x3290de){return respondWithRpcPromise(_0x533c('0x27'),_[_0x533c('0x24')](_0x591499[_0x533c('0x19')],_0x591499[_0x533c('0x1c')]))[_0x533c('0x9')](respondWithResult(_0x3290de,null))[_0x533c('0xe')](handleError(_0x3290de,null));};exports[_0x533c('0x28')]=function(_0x287ee5,_0x47831f){return respondWithRpcPromise(_0x533c('0x29'),_0x287ee5[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x47831f,null))[_0x533c('0xe')](handleError(_0x47831f,null));};exports[_0x533c('0x2a')]=function(_0x5ac6b4,_0x2b801e){return respondWithRpcPromise(_0x533c('0x2b'),_[_0x533c('0x24')](_0x5ac6b4[_0x533c('0x19')],_0x5ac6b4['params']))[_0x533c('0x9')](respondWithResult(_0x2b801e,null))[_0x533c('0xe')](handleError(_0x2b801e,null));};exports[_0x533c('0x2c')]=function(_0x40f077,_0x1255b1){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x40f077['query'],_0x40f077['params']))['then'](respondWithResult(_0x1255b1,null))[_0x533c('0xe')](handleError(_0x1255b1,null));};exports['voiceQueuesChannelRedirect']=function(_0x42994d,_0x55726a){return respondWithRpcPromise(_0x533c('0x2d'),_[_0x533c('0x24')](_0x42994d[_0x533c('0x19')],_0x42994d['params']))[_0x533c('0x9')](respondWithResult(_0x55726a,null))[_0x533c('0xe')](handleError(_0x55726a,null));};exports[_0x533c('0x2e')]=function(_0x55b010,_0x160d4b){return respondWithRpcPromise(_0x533c('0x2f'),_0x55b010[_0x533c('0x19')])['then'](respondWithResult(_0x160d4b,null))[_0x533c('0xe')](handleError(_0x160d4b,null));};exports[_0x533c('0x30')]=function(_0x2cd02f,_0x3f2b53){return respondWithRpcPromise(_0x533c('0x31'),_0x2cd02f[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x3f2b53,null))[_0x533c('0xe')](handleError(_0x3f2b53,null));};exports[_0x533c('0x32')]=function(_0x2c03fa,_0x298cea){var _0x55af6e;return respondWithRpcPromise(_0x533c('0x33'),_0x2c03fa[_0x533c('0x19')])[_0x533c('0x9')](function(_0x3562b8){_0x55af6e=_0x3562b8;return respondWithRpcPromise(_0x533c('0x33'),_0x2c03fa[_0x533c('0x19')],routingClient);})['then'](function(_0x88ea5d){return _[_0x533c('0x24')]({},_0x88ea5d,_0x55af6e);})[_0x533c('0x9')](respondWithResult(_0x298cea,null))['catch'](handleError(_0x298cea,null));};exports[_0x533c('0x34')]=function(_0x4170e4,_0x315e67){if(_0x4170e4[_0x533c('0x25')]&&_0x4170e4['body'][_0x533c('0x35')]&&_0x4170e4['user']&&_0x4170e4[_0x533c('0x36')][_0x533c('0x13')]){for(var _0x55a372 in _0x4170e4[_0x533c('0x25')][_0x533c('0x35')]){if(_0x4170e4[_0x533c('0x25')]['interaction']['hasOwnProperty'](_0x55a372)){db['MemberReport']['findAll']({'where':{'channel':_0x55a372,'membername':_0x4170e4[_0x533c('0x36')]['name'],'type':_0x533c('0x37'),'exitAt':null,'uniqueid':_0x4170e4['body'][_0x533c('0x35')][_0x55a372]&&_0x4170e4['body'][_0x533c('0x35')][_0x55a372][_0x533c('0x38')]?{'$notIn':_0x4170e4['body'][_0x533c('0x35')][_0x55a372]}:{'$ne':null}}})[_0x533c('0x9')](function(_0x27ac8e){var _0x10e374=moment()[_0x533c('0x39')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x47cca7=0x0,_0x22dc87=_0x27ac8e[_0x533c('0x38')];_0x47cca7<_0x22dc87;_0x47cca7+=0x1){_0x27ac8e[_0x47cca7][_0x533c('0x3a')]({'exitAt':_0x10e374});}});for(var _0x4fcdc5=0x0;_0x4fcdc5<_0x4170e4[_0x533c('0x25')][_0x533c('0x35')][_0x55a372]['length'];_0x4fcdc5+=0x1){db['MemberReport'][_0x533c('0x3b')]({'where':{'channel':_0x55a372,'membername':_0x4170e4['user'][_0x533c('0x13')],'type':_0x533c('0x37'),'uniqueid':_0x4170e4[_0x533c('0x25')][_0x533c('0x35')][_0x55a372][_0x4fcdc5],'exitAt':null},'defaults':{'channel':_0x55a372,'membername':_0x4170e4[_0x533c('0x36')][_0x533c('0x13')],'interface':_[_0x533c('0x14')](_0x4170e4[_0x533c('0x36')]['interface'])?util[_0x533c('0x39')](_0x533c('0x3c'),_0x4170e4[_0x533c('0x36')]['name']):_0x4170e4[_0x533c('0x36')][_0x533c('0x3d')],'type':'INTERACTION','enterAt':moment()[_0x533c('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x533c('0x3e'),'internal':_0x4170e4[_0x533c('0x36')][_0x533c('0x3f')],'uniqueid':_0x4170e4[_0x533c('0x25')][_0x533c('0x35')][_0x55a372][_0x4fcdc5]}});}}}}return respondWithRpcPromise(_0x533c('0x40'),{'id':_0x4170e4[_0x533c('0x1c')]['id'],'capacity':_0x4170e4['body'][_0x533c('0x41')]},routingClient)[_0x533c('0x9')](respondWithResult(_0x315e67,null))[_0x533c('0xe')](handleError(_0x315e67,null));};exports[_0x533c('0x42')]=function(_0x24ca50,_0x1558ef){return respondWithRpcPromise(_0x533c('0x43'),_0x24ca50['query'])['then'](respondWithResult(_0x1558ef,null))['catch'](handleError(_0x1558ef,null));};exports['trunks']=function(_0xc99f96,_0x4434a1){return respondWithRpcPromise('Trunks',_0xc99f96[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x4434a1,null))[_0x533c('0xe')](handleError(_0x4434a1,null));};exports['campaigns']=function(_0x1de19e,_0x564a31){return respondWithRpcPromise('Campaigns',_0x1de19e[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x564a31,null))[_0x533c('0xe')](handleError(_0x564a31,null));};exports[_0x533c('0x44')]=function(_0x381544,_0x3bb176){return respondWithRpcPromise(_0x533c('0x45'),_0x381544['query'],routingClient)[_0x533c('0x9')](respondWithResult(_0x3bb176,null))['catch'](handleError(_0x3bb176,null));};exports[_0x533c('0x46')]=function(_0x26645d,_0x274686){return respondWithRpcPromise(_0x533c('0x45'),_0x26645d[_0x533c('0x19')],routingClient)[_0x533c('0x9')](findById(_0x26645d[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x274686,null))['catch'](handleError(_0x274686,null));};exports[_0x533c('0x47')]=function(_0x43a333,_0x163563){return respondWithRpcPromise(_0x533c('0x48'),_0x43a333[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x163563,null))['catch'](handleError(_0x163563,null));};exports[_0x533c('0x49')]=function(_0x554a9f,_0x43383e){return respondWithRpcPromise(_0x533c('0x48'),_0x554a9f[_0x533c('0x19')],routingClient)[_0x533c('0x9')](findById(_0x554a9f[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x43383e,null))['catch'](handleError(_0x43383e,null));};exports['mailAccounts']=function(_0x1005a6,_0x376619){return respondWithRpcPromise(_0x533c('0x4a'),_0x1005a6[_0x533c('0x19')],mailClient)['then'](respondWithResult(_0x376619,null))[_0x533c('0xe')](handleError(_0x376619,null));};exports[_0x533c('0x4b')]=function(_0x8e04c7,_0x352e07){return respondWithRpcPromise(_0x533c('0x4c'),_0x8e04c7[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x352e07,null))[_0x533c('0xe')](handleError(_0x352e07,null));};exports[_0x533c('0x4d')]=function(_0x3aba19,_0x404a93){return respondWithRpcPromise(_0x533c('0x4c'),_0x3aba19[_0x533c('0x19')],routingClient)[_0x533c('0x9')](findById(_0x3aba19[_0x533c('0x1c')]['id']))[_0x533c('0x9')](respondWithResult(_0x404a93,null))[_0x533c('0xe')](handleError(_0x404a93,null));};exports['smsQueues']=function(_0x31bba1,_0x5206ad){return respondWithRpcPromise('SmsQueues',_0x31bba1[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x5206ad,null))[_0x533c('0xe')](handleError(_0x5206ad,null));};exports[_0x533c('0x4e')]=function(_0x417158,_0x1eaf34){return respondWithRpcPromise(_0x533c('0x4f'),_0x417158['query'],routingClient)[_0x533c('0x9')](findById(_0x417158[_0x533c('0x1c')]['id']))['then'](respondWithResult(_0x1eaf34,null))[_0x533c('0xe')](handleError(_0x1eaf34,null));};exports[_0x533c('0x50')]=function(_0x8174d0,_0x3e3b25){return respondWithRpcPromise('WhatsappQueues',_0x8174d0[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x3e3b25,null))['catch'](handleError(_0x3e3b25,null));};exports[_0x533c('0x51')]=function(_0x3e8d57,_0x5f2b8b){return respondWithRpcPromise(_0x533c('0x52'),_0x3e8d57[_0x533c('0x19')],routingClient)['then'](findById(_0x3e8d57[_0x533c('0x1c')]['id']))['then'](respondWithResult(_0x5f2b8b,null))['catch'](handleError(_0x5f2b8b,null));};exports[_0x533c('0x53')]=function(_0x28239c,_0x451def){return respondWithRpcPromise(_0x533c('0x54'),_0x28239c['query'],routingClient)[_0x533c('0x9')](respondWithResult(_0x451def,null))[_0x533c('0xe')](handleError(_0x451def,null));};exports[_0x533c('0x55')]=function(_0x245792,_0x20d344){return respondWithRpcPromise('FaxQueues',_0x245792[_0x533c('0x19')],routingClient)['then'](findById(_0x245792[_0x533c('0x1c')]['id']))['then'](respondWithResult(_0x20d344,null))[_0x533c('0xe')](handleError(_0x20d344,null));};exports['faxAccounts']=function(_0x4bd014,_0x511f74){return respondWithRpcPromise(_0x533c('0x56'),_0x4bd014[_0x533c('0x19')])[_0x533c('0x9')](respondWithResult(_0x511f74,null))['catch'](handleError(_0x511f74,null));};exports[_0x533c('0x57')]=function(_0x24a00c,_0x3fbb08){return respondWithRpcPromise(_0x533c('0x58'),_0x24a00c[_0x533c('0x19')],routingClient)['then'](respondWithResult(_0x3fbb08,null))['catch'](handleError(_0x3fbb08,null));};exports[_0x533c('0x59')]=function(_0x313fa5,_0x2c0f59){return respondWithRpcPromise(_0x533c('0x5a'),_0x313fa5[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x2c0f59,null))[_0x533c('0xe')](handleError(_0x2c0f59,null));};exports[_0x533c('0x5b')]=function(_0x45c4ca,_0x4f0961){return respondWithRpcPromise(_0x533c('0x5c'),_0x45c4ca[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x4f0961,null))[_0x533c('0xe')](handleError(_0x4f0961,null));};exports[_0x533c('0x5d')]=function(_0x18102b,_0x1b9816){return respondWithRpcPromise(_0x533c('0x5c'),_0x18102b[_0x533c('0x19')],routingClient)[_0x533c('0x9')](function(_0xfd598d){if(_0x18102b[_0x533c('0x19')][_0x533c('0x5e')]!==undefined){var _0x452915=_(_0xfd598d[_0x533c('0x15')])[_0x533c('0x5f')]([_0x18102b[_0x533c('0x19')]['type'],_0x18102b[_0x533c('0x1c')]['id']])[_0x533c('0x60')]('queue_id')['uniq']()[_0x533c('0x61')]();return _0xfd598d['rows'][_0x533c('0x5f')](function(_0x307fe5){return _0x452915[_0x533c('0x62')](_0x307fe5[_0x533c('0x63')])>-0x1;});}else{return _0xfd598d[_0x533c('0x15')]['filter'](function(_0x275db2){return _0x275db2[_0x533c('0x63')]===parseInt(_0x18102b[_0x533c('0x1c')]['id']);});}})[_0x533c('0x9')](respondWithResult(_0x1b9816,null))[_0x533c('0xe')](handleError(_0x1b9816,null));};exports[_0x533c('0x64')]=function(_0x1aa938,_0x248ede){return respondWithRpcPromise(_0x533c('0x65'),_0x1aa938[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x248ede,null))[_0x533c('0xe')](handleError(_0x248ede,null));};exports[_0x533c('0x66')]=function(_0x452759,_0x9c8d2){return respondWithRpcPromise(_0x533c('0x67'),_0x452759[_0x533c('0x19')],routingClient)[_0x533c('0x9')](respondWithResult(_0x9c8d2,null))['catch'](handleError(_0x9c8d2,null));};exports[_0x533c('0x68')]=function(_0x15d09a,_0x247915){return respondWithRpcPromise(_0x533c('0x69'),_0x15d09a['query'],routingClient)[_0x533c('0x9')](respondWithResult(_0x247915,null))[_0x533c('0xe')](handleError(_0x247915,null));};exports['queueNotify']=function(_0x411f86){return function(_0x5b8ead,_0x291be3){var _0x4be94e,_0x11654c;var _0x33a661=_[_0x533c('0x6a')](_0x411f86);var _0x5c938c=_0x411f86==='chat'?'Website':_0x533c('0x6b');return db[_0x33a661+'Queue'][_0x533c('0x6c')]({'raw':!![],'where':{'id':_0x5b8ead[_0x533c('0x1c')]['id']}})[_0x533c('0x9')](function(_0x450152){if(_['isNil'](_0x450152)){throw new Error(_0x33a661+'\x20Queue\x20not\x20found');}_0x4be94e=_0x450152;return db[_0x33a661+_0x533c('0x6d')]['findOne']({'where':{'id':_0x5b8ead[_0x533c('0x25')][_0x533c('0x6e')]},'include':[{'model':db[_0x33a661+_0x533c('0x6f')],'as':'Interaction'},{'model':db[_0x33a661+_0x5c938c],'as':_0x533c('0x6b')}]});})['then'](function(_0x6e0d38){if(_[_0x533c('0x14')](_0x6e0d38)){throw new Error(_0x33a661+'\x20Message\x20not\x20found');}_0x11654c=_0x6e0d38;return _0x6e0d38[_0x533c('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x533c('0x9')](function(){var _0x1c9381={'uniqueid':_0x411f86+'.'+_0x11654c['id']+'.'+_0x11654c[_0x533c('0x6f')]['id'],'FromUserId':_0x5b8ead[_0x533c('0x36')]['id'],'type':_0x533c('0x71')};_0x1c9381[_0x33a661+'MessageId']=_0x11654c['id'];_0x1c9381[_0x33a661+_0x533c('0x72')]=_0x11654c[_0x533c('0x6f')]['id'];_0x1c9381[_0x533c('0x73')+_0x33a661+_0x5c938c+'Id']=_0x11654c['Account']['id'];_0x1c9381['To'+_0x33a661+_0x533c('0x74')]=_0x4be94e['id'];return db[_0x33a661+'TransferReport']['create'](_0x1c9381);})[_0x533c('0x9')](function(){return respondWithRpcPromise(_0x533c('0x75'),{'channel':_0x411f86,'interaction':_0x11654c['Interaction'],'message':_0x11654c,'account':_0x11654c[_0x533c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x533c('0x71'),'appdata':_0x4be94e[_0x533c('0x13')]+','+(_0x11654c[_0x533c('0x6b')][_0x533c('0x76')]||0x12c),'interval':_0x533c('0x77')}]},routingClient);})[_0x533c('0x9')](respondWithResult(_0x291be3,null))[_0x533c('0xe')](handleError(_0x291be3,null));};};exports[_0x533c('0x78')]=function(_0x299f43,_0x14db14){var _0x243d1a,_0x368552;if(_['isNil'](_0x299f43[_0x533c('0x25')][_0x533c('0x79')])){throw new Error(_0x533c('0x7a'));}var _0x4c3f6d=_0x299f43[_0x533c('0x25')]['channel'];var _0x2c7faf=_[_0x533c('0x6a')](_0x4c3f6d);var _0x2377a3=_0x4c3f6d==='chat'?_0x533c('0x7b'):_0x533c('0x6b');return db[_0x533c('0x7c')]['findOne']({'raw':!![],'where':{'id':_0x299f43['params']['id'],'role':_0x533c('0x3e')}})['then'](function(_0x392968){if(_['isNil'](_0x392968)){throw new Error(_0x533c('0x7d'));}_0x243d1a=_0x392968;return db[_0x2c7faf+_0x533c('0x6d')][_0x533c('0x6c')]({'where':{'id':_0x299f43['body']['messageId']},'include':[{'model':db[_0x2c7faf+_0x533c('0x6f')],'as':_0x533c('0x6f')},{'model':db[_0x2c7faf+_0x2377a3],'as':_0x533c('0x6b')}]});})[_0x533c('0x9')](function(_0x313916){if(_[_0x533c('0x14')](_0x313916)){throw new Error(_0x2c7faf+_0x533c('0x7e'));}_0x368552=_0x313916;return _0x313916[_0x533c('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x533c('0x9')](function(){var _0x5307b3={'uniqueid':_0x4c3f6d+'.'+_0x368552['id']+'.'+_0x368552[_0x533c('0x6f')]['id'],'FromUserId':_0x299f43[_0x533c('0x36')]['id'],'type':_0x533c('0x71'),'ToUserId':_0x243d1a['id']};_0x5307b3[_0x2c7faf+'MessageId']=_0x368552['id'];_0x5307b3[_0x2c7faf+_0x533c('0x72')]=_0x368552[_0x533c('0x6f')]['id'];_0x5307b3[_0x533c('0x73')+_0x2c7faf+_0x2377a3+'Id']=_0x368552[_0x533c('0x6b')]['id'];return db[_0x2c7faf+_0x533c('0x7f')][_0x533c('0x80')](_0x5307b3);})[_0x533c('0x9')](function(){return respondWithRpcPromise(_0x533c('0x75'),{'channel':_0x4c3f6d,'interaction':_0x368552[_0x533c('0x6f')],'message':_0x368552,'account':_0x368552[_0x533c('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x533c('0x3e'),'appdata':_0x243d1a[_0x533c('0x13')]+','+(_0x368552['Account'][_0x533c('0x81')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x533c('0x9')](respondWithResult(_0x14db14,null))[_0x533c('0xe')](handleError(_0x14db14,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8bd7f2e..92ff1a5 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 _0xd6f5=['isAuthenticated','index','/:id','show','run','post','create','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd6f5,0x173));var _0x5d6f=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xd6f5[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x5d6f('0x0'));var util=require('util');var path=require(_0x5d6f('0x1'));var timeout=require(_0x5d6f('0x2'));var express=require('express');var router=express[_0x5d6f('0x3')]();var fs_extra=require(_0x5d6f('0x4'));var auth=require(_0x5d6f('0x5'));var interaction=require(_0x5d6f('0x6'));var config=require(_0x5d6f('0x7'));var controller=require('./schedule.controller');router[_0x5d6f('0x8')]('/',auth[_0x5d6f('0x9')](),controller[_0x5d6f('0xa')]);router[_0x5d6f('0x8')](_0x5d6f('0xb'),auth['isAuthenticated'](),controller[_0x5d6f('0xc')]);router['get']('/:id/run',auth[_0x5d6f('0x9')](),controller[_0x5d6f('0xd')]);router[_0x5d6f('0xe')]('/',auth[_0x5d6f('0x9')](),controller[_0x5d6f('0xf')]);router['put']('/:id',auth[_0x5d6f('0x9')](),controller[_0x5d6f('0x10')]);router['delete'](_0x5d6f('0xb'),auth[_0x5d6f('0x9')](),controller[_0x5d6f('0x11')]);module[_0x5d6f('0x12')]=router; \ No newline at end of file +var _0x5084=['post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x5084,0x1be));var _0x4508=function(_0x85bc8a,_0x1bf88e){_0x85bc8a=_0x85bc8a-0x0;var _0x2a7175=_0x5084[_0x85bc8a];return _0x2a7175;};'use strict';var multer=require(_0x4508('0x0'));var util=require(_0x4508('0x1'));var path=require('path');var timeout=require(_0x4508('0x2'));var express=require(_0x4508('0x3'));var router=express[_0x4508('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4508('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4508('0x6'));router[_0x4508('0x7')]('/',auth[_0x4508('0x8')](),controller[_0x4508('0x9')]);router[_0x4508('0x7')](_0x4508('0xa'),auth[_0x4508('0x8')](),controller[_0x4508('0xb')]);router[_0x4508('0x7')](_0x4508('0xc'),auth[_0x4508('0x8')](),controller[_0x4508('0xd')]);router[_0x4508('0xe')]('/',auth[_0x4508('0x8')](),controller['create']);router[_0x4508('0xf')](_0x4508('0xa'),auth['isAuthenticated'](),controller[_0x4508('0x10')]);router[_0x4508('0x11')](_0x4508('0xa'),auth[_0x4508('0x8')](),controller[_0x4508('0x12')]);module[_0x4508('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index df3094e..323635f 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 _0x63e2=['hours','csv','pdf','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x55c7d6,_0x405d2e){var _0x426b13=function(_0x3ca2fa){while(--_0x3ca2fa){_0x55c7d6['push'](_0x55c7d6['shift']());}};_0x426b13(++_0x405d2e);}(_0x63e2,0xd2));var _0x263e=function(_0x290062,_0x97edf3){_0x290062=_0x290062-0x0;var _0x1f520e=_0x63e2[_0x290062];return _0x1f520e;};'use strict';var Sequelize=require(_0x263e('0x0'));module[_0x263e('0x1')]={'name':{'type':Sequelize[_0x263e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x263e('0x2')]},'active':{'type':Sequelize[_0x263e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x263e('0x2')],'allowNull':![],'defaultValue':_0x263e('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x263e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x263e('0x6')](_0x263e('0x7'),_0x263e('0x8'),_0x263e('0x9'),_0x263e('0xa'),'days',_0x263e('0xb'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x263e('0x6')](_0x263e('0xc'),_0x263e('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x263e('0xe'),_0x263e('0xf')),'allowNull':![],'defaultValue':_0x263e('0xe')},'sendMail':{'type':Sequelize[_0x263e('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x263e('0x10')]},'bcc':{'type':Sequelize[_0x263e('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x263e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x145b=['years','months','days','hours','ENUM','xlsx','csv','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0x145b,0x64));var _0xb145=function(_0x2a685c,_0x2c34df){_0x2a685c=_0x2a685c-0x0;var _0x5233dd=_0x145b[_0x2a685c];return _0x5233dd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb145('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xb145('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb145('0x0')],'allowNull':![],'defaultValue':_0xb145('0x2')},'startAt':{'type':Sequelize[_0xb145('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb145('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb145('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xb145('0x5'),'quarters',_0xb145('0x6'),'weeks',_0xb145('0x7'),_0xb145('0x8'),'minutes'),'allowNull':![],'defaultValue':_0xb145('0x7')},'output':{'type':Sequelize[_0xb145('0x9')]('csv','pdf',_0xb145('0xa')),'allowNull':![],'defaultValue':_0xb145('0xb')},'type':{'type':Sequelize[_0xb145('0x9')](_0xb145('0xc'),_0xb145('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xb145('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xb145('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xb145('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8175181..3451dec 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 _0xffc7=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','get','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','Schedule','includeAll','include','findAll','catch','show','params','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xffc7,0x100));var _0x7ffc=function(_0x375d22,_0x30ecd0){_0x375d22=_0x375d22-0x0;var _0x4102d8=_0xffc7[_0x375d22];return _0x4102d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ffc('0x0'));var zipdir=require(_0x7ffc('0x1'));var jsonpatch=require(_0x7ffc('0x2'));var rp=require(_0x7ffc('0x3'));var moment=require(_0x7ffc('0x4'));var BPromise=require(_0x7ffc('0x5'));var Mustache=require(_0x7ffc('0x6'));var util=require(_0x7ffc('0x7'));var path=require('path');var sox=require(_0x7ffc('0x8'));var csv=require('to-csv');var ejs=require(_0x7ffc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ffc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ffc('0xb'));var deskjs=require(_0x7ffc('0xc'));var toCsv=require(_0x7ffc('0xd'));var querystring=require(_0x7ffc('0xe'));var Papa=require(_0x7ffc('0xf'));var Redis=require(_0x7ffc('0x10'));var authService=require(_0x7ffc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7ffc('0x12'));var hardwareService=require(_0x7ffc('0x13'));var logger=require(_0x7ffc('0x14'))(_0x7ffc('0x15'));var utils=require('../../config/utils');var config=require(_0x7ffc('0x16'));var licenseUtil=require(_0x7ffc('0x17'));var db=require(_0x7ffc('0x18'))['db'];function respondWithStatusCode(_0x13e54f,_0x440952){_0x440952=_0x440952||0xcc;return function(_0x5a659b){if(_0x5a659b){return _0x13e54f[_0x7ffc('0x19')](_0x440952);}return _0x13e54f[_0x7ffc('0x1a')](_0x440952)[_0x7ffc('0x1b')]();};}function respondWithResult(_0x2db6f7,_0x529c6e){_0x529c6e=_0x529c6e||0xc8;return function(_0x5114b2){if(_0x5114b2){return _0x2db6f7[_0x7ffc('0x1a')](_0x529c6e)['json'](_0x5114b2);}};}function respondWithFilteredResult(_0x3f0bea,_0x5526c4){return function(_0x49fcc5){if(_0x49fcc5){var _0xf9d496=typeof _0x5526c4['offset']===_0x7ffc('0x1c')&&typeof _0x5526c4[_0x7ffc('0x1d')]===_0x7ffc('0x1c');var _0x38172b=_0x49fcc5[_0x7ffc('0x1e')];var _0x41949c=_0xf9d496?0x0:_0x5526c4[_0x7ffc('0x1f')];var _0x56dabb=_0xf9d496?_0x49fcc5['count']:_0x5526c4[_0x7ffc('0x1f')]+_0x5526c4[_0x7ffc('0x1d')];var _0x3596d9;if(_0x56dabb>=_0x38172b){_0x56dabb=_0x38172b;_0x3596d9=0xc8;}else{_0x3596d9=0xce;}_0x3f0bea[_0x7ffc('0x1a')](_0x3596d9);return _0x3f0bea[_0x7ffc('0x20')](_0x7ffc('0x21'),_0x41949c+'-'+_0x56dabb+'/'+_0x38172b)[_0x7ffc('0x22')](_0x49fcc5);}return null;};}function patchUpdates(_0x795a3a){return function(_0x1229fe){try{jsonpatch['apply'](_0x1229fe,_0x795a3a,!![]);}catch(_0x4ad091){return BPromise[_0x7ffc('0x23')](_0x4ad091);}return _0x1229fe['save']();};}function saveUpdates(_0x412ad9,_0x3283fe){return function(_0x52f9b6){if(_0x52f9b6){return _0x52f9b6[_0x7ffc('0x24')](_0x412ad9)[_0x7ffc('0x25')](function(_0x5c0eec){return _0x5c0eec;});}return null;};}function removeEntity(_0x38878d,_0x49b5ed){return function(_0x52e1b1){if(_0x52e1b1){return _0x52e1b1[_0x7ffc('0x26')]()[_0x7ffc('0x25')](function(){var _0x23be83=_0x52e1b1[_0x7ffc('0x27')]({'plain':!![]});var _0x500ab1='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x500ab1,'resourceId':_0x23be83['id']}})['then'](function(){return _0x52e1b1;});})['then'](function(){_0x38878d[_0x7ffc('0x1a')](0xcc)[_0x7ffc('0x1b')]();});}};}function handleEntityNotFound(_0x1717a5,_0x1dc7a3){return function(_0xb6904d){if(!_0xb6904d){_0x1717a5[_0x7ffc('0x19')](0x194);}return _0xb6904d;};}function handleError(_0x41e46e,_0x3b71b4){_0x3b71b4=_0x3b71b4||0x1f4;return function(_0x10b327){logger['error'](_0x10b327[_0x7ffc('0x28')]);if(_0x10b327[_0x7ffc('0x29')]){delete _0x10b327['name'];}_0x41e46e[_0x7ffc('0x1a')](_0x3b71b4)[_0x7ffc('0x2a')](_0x10b327);};}exports[_0x7ffc('0x2b')]=function(_0x20db84,_0x5b00fa){var _0x418106={},_0x13490b={},_0x24422e={'count':0x0,'rows':[]};var _0x4a6093=_[_0x7ffc('0x2c')](db['Schedule'][_0x7ffc('0x2d')],function(_0x178ebf){return{'name':_0x178ebf[_0x7ffc('0x2e')],'type':_0x178ebf[_0x7ffc('0x2f')]['key']};});_0x13490b[_0x7ffc('0x30')]=_[_0x7ffc('0x2c')](_0x4a6093,'name');_0x13490b[_0x7ffc('0x31')]=_[_0x7ffc('0x32')](_0x20db84[_0x7ffc('0x31')]);_0x13490b[_0x7ffc('0x33')]=_['intersection'](_0x13490b[_0x7ffc('0x30')],_0x13490b[_0x7ffc('0x31')]);_0x418106[_0x7ffc('0x34')]=_[_0x7ffc('0x35')](_0x13490b[_0x7ffc('0x30')],qs['fields'](_0x20db84['query'][_0x7ffc('0x36')]));_0x418106[_0x7ffc('0x34')]=_0x418106[_0x7ffc('0x34')][_0x7ffc('0x37')]?_0x418106['attributes']:_0x13490b['model'];if(!_0x20db84[_0x7ffc('0x31')]['hasOwnProperty'](_0x7ffc('0x38'))){_0x418106['limit']=qs[_0x7ffc('0x1d')](_0x20db84[_0x7ffc('0x31')][_0x7ffc('0x1d')]);_0x418106[_0x7ffc('0x1f')]=qs[_0x7ffc('0x1f')](_0x20db84[_0x7ffc('0x31')]['offset']);}_0x418106[_0x7ffc('0x39')]=qs['sort'](_0x20db84[_0x7ffc('0x31')][_0x7ffc('0x3a')]);_0x418106[_0x7ffc('0x3b')]=qs[_0x7ffc('0x33')](_['pick'](_0x20db84[_0x7ffc('0x31')],_0x13490b[_0x7ffc('0x33')]),_0x4a6093);if(_0x20db84[_0x7ffc('0x31')]['filter']){_0x418106['where']=_['merge'](_0x418106['where'],{'$or':_[_0x7ffc('0x2c')](_0x4a6093,function(_0x4b33cc){if(_0x4b33cc[_0x7ffc('0x2f')]!=='VIRTUAL'){var _0xc8f8bf={};_0xc8f8bf[_0x4b33cc[_0x7ffc('0x29')]]={'$like':'%'+_0x20db84[_0x7ffc('0x31')][_0x7ffc('0x3c')]+'%'};return _0xc8f8bf;}})});}_0x418106=_['merge']({},_0x418106,_0x20db84['options']);var _0x465d3c={'where':_0x418106[_0x7ffc('0x3b')]};return db[_0x7ffc('0x3d')][_0x7ffc('0x1e')](_0x465d3c)[_0x7ffc('0x25')](function(_0x1b32e6){_0x24422e['count']=_0x1b32e6;if(_0x20db84['query'][_0x7ffc('0x3e')]){_0x418106[_0x7ffc('0x3f')]=[{'all':!![]}];}return db[_0x7ffc('0x3d')][_0x7ffc('0x40')](_0x418106);})[_0x7ffc('0x25')](function(_0x4e4ec8){_0x24422e['rows']=_0x4e4ec8;return _0x24422e;})[_0x7ffc('0x25')](respondWithFilteredResult(_0x5b00fa,_0x418106))[_0x7ffc('0x41')](handleError(_0x5b00fa,null));};exports[_0x7ffc('0x42')]=function(_0x12cec9,_0x490b72){var _0x186e7b={'raw':![],'where':{'id':_0x12cec9[_0x7ffc('0x43')]['id']}},_0x5ee4b6={};_0x5ee4b6['model']=_[_0x7ffc('0x32')](db[_0x7ffc('0x3d')]['rawAttributes']);_0x5ee4b6[_0x7ffc('0x31')]=_['keys'](_0x12cec9[_0x7ffc('0x31')]);_0x5ee4b6[_0x7ffc('0x33')]=_[_0x7ffc('0x35')](_0x5ee4b6[_0x7ffc('0x30')],_0x5ee4b6[_0x7ffc('0x31')]);_0x186e7b[_0x7ffc('0x34')]=_[_0x7ffc('0x35')](_0x5ee4b6[_0x7ffc('0x30')],qs['fields'](_0x12cec9[_0x7ffc('0x31')][_0x7ffc('0x36')]));_0x186e7b[_0x7ffc('0x34')]=_0x186e7b[_0x7ffc('0x34')][_0x7ffc('0x37')]?_0x186e7b['attributes']:_0x5ee4b6['model'];if(_0x12cec9[_0x7ffc('0x31')][_0x7ffc('0x3e')]){_0x186e7b[_0x7ffc('0x3f')]=[{'all':!![]}];}_0x186e7b=_[_0x7ffc('0x44')]({},_0x186e7b,_0x12cec9[_0x7ffc('0x45')]);return db[_0x7ffc('0x3d')][_0x7ffc('0x46')](_0x186e7b)[_0x7ffc('0x25')](handleEntityNotFound(_0x490b72,null))[_0x7ffc('0x25')](respondWithResult(_0x490b72,null))['catch'](handleError(_0x490b72,null));};exports[_0x7ffc('0x47')]=function(_0x483b32,_0x363067){return db[_0x7ffc('0x3d')][_0x7ffc('0x47')](_0x483b32['body'],{})[_0x7ffc('0x25')](function(_0x23b14){var _0x58888d=_0x483b32[_0x7ffc('0x48')][_0x7ffc('0x27')]({'plain':!![]});if(!_0x58888d)throw new Error(_0x7ffc('0x49'));if(_0x58888d['role']===_0x7ffc('0x48')){var _0x3e6506=_0x23b14[_0x7ffc('0x27')]({'plain':!![]});var _0x4202b1=_0x7ffc('0x4a');return db[_0x7ffc('0x4b')][_0x7ffc('0x46')]({'where':{'name':_0x4202b1,'userProfileId':_0x58888d[_0x7ffc('0x4c')]},'raw':!![]})['then'](function(_0x5769d0){if(_0x5769d0&&_0x5769d0[_0x7ffc('0x4d')]===0x0){return db[_0x7ffc('0x4e')][_0x7ffc('0x47')]({'name':_0x3e6506[_0x7ffc('0x29')],'resourceId':_0x3e6506['id'],'type':_0x5769d0[_0x7ffc('0x29')],'sectionId':_0x5769d0['id']},{})[_0x7ffc('0x25')](function(){return _0x23b14;});}else{return _0x23b14;}})['catch'](function(_0x413e3b){logger[_0x7ffc('0x4f')](_0x7ffc('0x50'),_0x413e3b);throw _0x413e3b;});}return _0x23b14;})['then'](respondWithResult(_0x363067,0xc9))[_0x7ffc('0x41')](handleError(_0x363067,null));};exports[_0x7ffc('0x24')]=function(_0x286fa2,_0x1fa1d8){if(_0x286fa2[_0x7ffc('0x51')]['id']){delete _0x286fa2[_0x7ffc('0x51')]['id'];}return db[_0x7ffc('0x3d')][_0x7ffc('0x46')]({'where':{'id':_0x286fa2[_0x7ffc('0x43')]['id']}})['then'](handleEntityNotFound(_0x1fa1d8,null))[_0x7ffc('0x25')](saveUpdates(_0x286fa2[_0x7ffc('0x51')],null))[_0x7ffc('0x25')](respondWithResult(_0x1fa1d8,null))['catch'](handleError(_0x1fa1d8,null));};exports[_0x7ffc('0x26')]=function(_0x14271b,_0x1c9726){return db[_0x7ffc('0x3d')]['find']({'where':{'id':_0x14271b[_0x7ffc('0x43')]['id']}})[_0x7ffc('0x25')](handleEntityNotFound(_0x1c9726,null))['then'](removeEntity(_0x1c9726,null))[_0x7ffc('0x41')](handleError(_0x1c9726,null));};exports[_0x7ffc('0x52')]=function(_0x5b3ab7,_0x134a12,_0x51b5ce){var _0x25edea=require(_0x7ffc('0x53'));return db[_0x7ffc('0x3d')][_0x7ffc('0x46')]({'where':{'id':_0x5b3ab7['params']['id']},'raw':!![]})[_0x7ffc('0x25')](handleEntityNotFound(_0x134a12,null))[_0x7ffc('0x25')](function(){_0x25edea[_0x7ffc('0x52')](_0x5b3ab7[_0x7ffc('0x43')]['id']);})['then'](respondWithStatusCode(_0x134a12,null))[_0x7ffc('0x41')](handleError(_0x134a12,null));}; \ No newline at end of file +var _0x3926=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','error','stack','name','index','Schedule','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','rows','catch','show','include','find'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x3926,0xb1));var _0x6392=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3926[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x6392('0x0'));var rimraf=require(_0x6392('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6392('0x2'));var rp=require(_0x6392('0x3'));var moment=require(_0x6392('0x4'));var BPromise=require(_0x6392('0x5'));var Mustache=require(_0x6392('0x6'));var util=require(_0x6392('0x7'));var path=require(_0x6392('0x8'));var sox=require(_0x6392('0x9'));var csv=require(_0x6392('0xa'));var ejs=require(_0x6392('0xb'));var fs=require('fs');var fs_extra=require(_0x6392('0xc'));var _=require(_0x6392('0xd'));var squel=require(_0x6392('0xe'));var crypto=require(_0x6392('0xf'));var jsforce=require(_0x6392('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6392('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6392('0x11'));var qs=require(_0x6392('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6392('0x13'));var logger=require(_0x6392('0x14'))(_0x6392('0x15'));var utils=require(_0x6392('0x16'));var config=require(_0x6392('0x17'));var licenseUtil=require(_0x6392('0x18'));var db=require(_0x6392('0x19'))['db'];function respondWithStatusCode(_0x2613bf,_0x18bbe3){_0x18bbe3=_0x18bbe3||0xcc;return function(_0x2f76f2){if(_0x2f76f2){return _0x2613bf[_0x6392('0x1a')](_0x18bbe3);}return _0x2613bf[_0x6392('0x1b')](_0x18bbe3)['end']();};}function respondWithResult(_0x942cc4,_0x5f1dd6){_0x5f1dd6=_0x5f1dd6||0xc8;return function(_0x199390){if(_0x199390){return _0x942cc4['status'](_0x5f1dd6)[_0x6392('0x1c')](_0x199390);}};}function respondWithFilteredResult(_0x3f4fe2,_0x56ac12){return function(_0x19e058){if(_0x19e058){var _0x5674c1=typeof _0x56ac12[_0x6392('0x1d')]===_0x6392('0x1e')&&typeof _0x56ac12[_0x6392('0x1f')]===_0x6392('0x1e');var _0x2e6abf=_0x19e058[_0x6392('0x20')];var _0x3beec3=_0x5674c1?0x0:_0x56ac12[_0x6392('0x1d')];var _0x3716ed=_0x5674c1?_0x19e058[_0x6392('0x20')]:_0x56ac12[_0x6392('0x1d')]+_0x56ac12[_0x6392('0x1f')];var _0x5761b2;if(_0x3716ed>=_0x2e6abf){_0x3716ed=_0x2e6abf;_0x5761b2=0xc8;}else{_0x5761b2=0xce;}_0x3f4fe2[_0x6392('0x1b')](_0x5761b2);return _0x3f4fe2[_0x6392('0x21')](_0x6392('0x22'),_0x3beec3+'-'+_0x3716ed+'/'+_0x2e6abf)[_0x6392('0x1c')](_0x19e058);}return null;};}function patchUpdates(_0x26b2c5){return function(_0x537391){try{jsonpatch[_0x6392('0x23')](_0x537391,_0x26b2c5,!![]);}catch(_0x3cadc3){return BPromise['reject'](_0x3cadc3);}return _0x537391[_0x6392('0x24')]();};}function saveUpdates(_0x3333e5,_0x98fd03){return function(_0x4fd519){if(_0x4fd519){return _0x4fd519[_0x6392('0x25')](_0x3333e5)[_0x6392('0x26')](function(_0x349e86){return _0x349e86;});}return null;};}function removeEntity(_0x1a62bc,_0x38b846){return function(_0x19f088){if(_0x19f088){return _0x19f088[_0x6392('0x27')]()[_0x6392('0x26')](function(){var _0x3ba24e=_0x19f088[_0x6392('0x28')]({'plain':!![]});var _0x41e228=_0x6392('0x29');return db['UserProfileResource'][_0x6392('0x27')]({'where':{'type':_0x41e228,'resourceId':_0x3ba24e['id']}})[_0x6392('0x26')](function(){return _0x19f088;});})[_0x6392('0x26')](function(){_0x1a62bc[_0x6392('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e1a3,_0x4aa9c2){return function(_0x250d49){if(!_0x250d49){_0x18e1a3[_0x6392('0x1a')](0x194);}return _0x250d49;};}function handleError(_0x5df99d,_0x46cb42){_0x46cb42=_0x46cb42||0x1f4;return function(_0x2c9680){logger[_0x6392('0x2a')](_0x2c9680[_0x6392('0x2b')]);if(_0x2c9680['name']){delete _0x2c9680[_0x6392('0x2c')];}_0x5df99d[_0x6392('0x1b')](_0x46cb42)['send'](_0x2c9680);};}exports[_0x6392('0x2d')]=function(_0x993e3e,_0xfda5f9){var _0x45e68a={},_0xa26f2f={},_0x16deef={'count':0x0,'rows':[]};var _0xa9136a=_['map'](db[_0x6392('0x2e')][_0x6392('0x2f')],function(_0x4a0c70){return{'name':_0x4a0c70['fieldName'],'type':_0x4a0c70['type'][_0x6392('0x30')]};});_0xa26f2f[_0x6392('0x31')]=_['map'](_0xa9136a,_0x6392('0x2c'));_0xa26f2f[_0x6392('0x32')]=_[_0x6392('0x33')](_0x993e3e[_0x6392('0x32')]);_0xa26f2f[_0x6392('0x34')]=_[_0x6392('0x35')](_0xa26f2f[_0x6392('0x31')],_0xa26f2f[_0x6392('0x32')]);_0x45e68a[_0x6392('0x36')]=_['intersection'](_0xa26f2f[_0x6392('0x31')],qs['fields'](_0x993e3e[_0x6392('0x32')][_0x6392('0x37')]));_0x45e68a[_0x6392('0x36')]=_0x45e68a['attributes'][_0x6392('0x38')]?_0x45e68a[_0x6392('0x36')]:_0xa26f2f[_0x6392('0x31')];if(!_0x993e3e[_0x6392('0x32')]['hasOwnProperty'](_0x6392('0x39'))){_0x45e68a['limit']=qs[_0x6392('0x1f')](_0x993e3e['query'][_0x6392('0x1f')]);_0x45e68a[_0x6392('0x1d')]=qs[_0x6392('0x1d')](_0x993e3e[_0x6392('0x32')][_0x6392('0x1d')]);}_0x45e68a[_0x6392('0x3a')]=qs[_0x6392('0x3b')](_0x993e3e[_0x6392('0x32')]['sort']);_0x45e68a['where']=qs[_0x6392('0x34')](_[_0x6392('0x3c')](_0x993e3e[_0x6392('0x32')],_0xa26f2f[_0x6392('0x34')]),_0xa9136a);if(_0x993e3e[_0x6392('0x32')][_0x6392('0x3d')]){_0x45e68a[_0x6392('0x3e')]=_[_0x6392('0x3f')](_0x45e68a[_0x6392('0x3e')],{'$or':_[_0x6392('0x40')](_0xa9136a,function(_0x1ab8f3){if(_0x1ab8f3['type']!==_0x6392('0x41')){var _0x38f662={};_0x38f662[_0x1ab8f3['name']]={'$like':'%'+_0x993e3e['query'][_0x6392('0x3d')]+'%'};return _0x38f662;}})});}_0x45e68a=_[_0x6392('0x3f')]({},_0x45e68a,_0x993e3e['options']);var _0x351bce={'where':_0x45e68a[_0x6392('0x3e')]};return db[_0x6392('0x2e')][_0x6392('0x20')](_0x351bce)[_0x6392('0x26')](function(_0x4b0525){_0x16deef[_0x6392('0x20')]=_0x4b0525;if(_0x993e3e[_0x6392('0x32')][_0x6392('0x42')]){_0x45e68a['include']=[{'all':!![]}];}return db[_0x6392('0x2e')]['findAll'](_0x45e68a);})[_0x6392('0x26')](function(_0x3e0f93){_0x16deef[_0x6392('0x43')]=_0x3e0f93;return _0x16deef;})[_0x6392('0x26')](respondWithFilteredResult(_0xfda5f9,_0x45e68a))[_0x6392('0x44')](handleError(_0xfda5f9,null));};exports[_0x6392('0x45')]=function(_0x6e5703,_0xd610c9){var _0x5283b6={'raw':![],'where':{'id':_0x6e5703['params']['id']}},_0x195855={};_0x195855[_0x6392('0x31')]=_[_0x6392('0x33')](db[_0x6392('0x2e')][_0x6392('0x2f')]);_0x195855[_0x6392('0x32')]=_[_0x6392('0x33')](_0x6e5703[_0x6392('0x32')]);_0x195855['filters']=_[_0x6392('0x35')](_0x195855['model'],_0x195855[_0x6392('0x32')]);_0x5283b6[_0x6392('0x36')]=_[_0x6392('0x35')](_0x195855[_0x6392('0x31')],qs['fields'](_0x6e5703[_0x6392('0x32')]['fields']));_0x5283b6[_0x6392('0x36')]=_0x5283b6['attributes'][_0x6392('0x38')]?_0x5283b6[_0x6392('0x36')]:_0x195855['model'];if(_0x6e5703['query'][_0x6392('0x42')]){_0x5283b6[_0x6392('0x46')]=[{'all':!![]}];}_0x5283b6=_[_0x6392('0x3f')]({},_0x5283b6,_0x6e5703['options']);return db[_0x6392('0x2e')][_0x6392('0x47')](_0x5283b6)[_0x6392('0x26')](handleEntityNotFound(_0xd610c9,null))['then'](respondWithResult(_0xd610c9,null))[_0x6392('0x44')](handleError(_0xd610c9,null));};exports[_0x6392('0x48')]=function(_0x53311f,_0x1174ad){return db[_0x6392('0x2e')][_0x6392('0x48')](_0x53311f[_0x6392('0x49')],{})[_0x6392('0x26')](function(_0x134bad){var _0x3d3d41=_0x53311f[_0x6392('0x4a')]['get']({'plain':!![]});if(!_0x3d3d41)throw new Error(_0x6392('0x4b'));if(_0x3d3d41[_0x6392('0x4c')]===_0x6392('0x4a')){var _0xb59592=_0x134bad[_0x6392('0x28')]({'plain':!![]});var _0x5e5ea8='Scheduler';return db[_0x6392('0x4d')][_0x6392('0x47')]({'where':{'name':_0x5e5ea8,'userProfileId':_0x3d3d41['userProfileId']},'raw':!![]})['then'](function(_0x300107){if(_0x300107&&_0x300107[_0x6392('0x4e')]===0x0){return db[_0x6392('0x4f')][_0x6392('0x48')]({'name':_0xb59592[_0x6392('0x2c')],'resourceId':_0xb59592['id'],'type':_0x300107[_0x6392('0x2c')],'sectionId':_0x300107['id']},{})[_0x6392('0x26')](function(){return _0x134bad;});}else{return _0x134bad;}})[_0x6392('0x44')](function(_0x27b7ac){logger['error'](_0x6392('0x50'),_0x27b7ac);throw _0x27b7ac;});}return _0x134bad;})[_0x6392('0x26')](respondWithResult(_0x1174ad,0xc9))[_0x6392('0x44')](handleError(_0x1174ad,null));};exports[_0x6392('0x25')]=function(_0x2dbf76,_0x3a6b26){if(_0x2dbf76[_0x6392('0x49')]['id']){delete _0x2dbf76[_0x6392('0x49')]['id'];}return db[_0x6392('0x2e')][_0x6392('0x47')]({'where':{'id':_0x2dbf76['params']['id']}})[_0x6392('0x26')](handleEntityNotFound(_0x3a6b26,null))[_0x6392('0x26')](saveUpdates(_0x2dbf76[_0x6392('0x49')],null))[_0x6392('0x26')](respondWithResult(_0x3a6b26,null))[_0x6392('0x44')](handleError(_0x3a6b26,null));};exports[_0x6392('0x27')]=function(_0x3d9e0a,_0x381671){return db[_0x6392('0x2e')][_0x6392('0x47')]({'where':{'id':_0x3d9e0a[_0x6392('0x51')]['id']}})[_0x6392('0x26')](handleEntityNotFound(_0x381671,null))[_0x6392('0x26')](removeEntity(_0x381671,null))[_0x6392('0x44')](handleError(_0x381671,null));};exports['run']=function(_0x1be869,_0x16b282,_0x19b610){var _0x100689=require(_0x6392('0x52'));return db[_0x6392('0x2e')][_0x6392('0x47')]({'where':{'id':_0x1be869['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x16b282,null))[_0x6392('0x26')](function(){_0x100689['run'](_0x1be869[_0x6392('0x51')]['id']);})[_0x6392('0x26')](respondWithStatusCode(_0x16b282,null))[_0x6392('0x44')](handleError(_0x16b282,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b8ac949..cf1cdcf 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 _0x6406=['api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x6406,0x107));var _0x6640=function(_0x22789a,_0x4a1c8c){_0x22789a=_0x22789a-0x0;var _0xede88=_0x6406[_0x22789a];return _0xede88;};'use strict';var _=require(_0x6640('0x0'));var util=require(_0x6640('0x1'));var logger=require(_0x6640('0x2'))(_0x6640('0x3'));var moment=require('moment');var BPromise=require(_0x6640('0x4'));var rp=require(_0x6640('0x5'));var fs=require('fs');var path=require(_0x6640('0x6'));var rimraf=require(_0x6640('0x7'));var config=require(_0x6640('0x8'));var attributes=require(_0x6640('0x9'));module[_0x6640('0xa')]=function(_0x375ab4,_0x5009d2){return _0x375ab4[_0x6640('0xb')](_0x6640('0xc'),attributes,{'tableName':_0x6640('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b7b=['define','Schedule','tools_schedules','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3b7b,0x12c));var _0xb3b7=function(_0x2bc677,_0x18d062){_0x2bc677=_0x2bc677-0x0;var _0x49ff88=_0x3b7b[_0x2bc677];return _0x49ff88;};'use strict';var _=require(_0xb3b7('0x0'));var util=require(_0xb3b7('0x1'));var logger=require(_0xb3b7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb3b7('0x3'));var rp=require(_0xb3b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3b7('0x5'));var config=require(_0xb3b7('0x6'));var attributes=require(_0xb3b7('0x7'));module['exports']=function(_0x94e19d,_0x411a49){return _0x94e19d[_0xb3b7('0x8')](_0xb3b7('0x9'),attributes,{'tableName':_0xb3b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index c696ade..d4c24e9 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 _0x4c31=['jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x4c31,0x19a));var _0x14c3=function(_0x37beac,_0x8f71e6){_0x37beac=_0x37beac-0x0;var _0x7ced97=_0x4c31[_0x37beac];return _0x7ced97;};'use strict';var _=require('lodash');var util=require(_0x14c3('0x0'));var moment=require(_0x14c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x14c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14c3('0x3'))['db'];var utils=require(_0x14c3('0x4'));var logger=require(_0x14c3('0x5'))(_0x14c3('0x6'));var config=require(_0x14c3('0x7'));var jayson=require(_0x14c3('0x8'));var client=jayson[_0x14c3('0x9')][_0x14c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc442a7,_0x1da379,_0x121d67){return new BPromise(function(_0x35e73a,_0x3af37d){return client[_0x14c3('0xb')](_0xc442a7,_0x121d67)['then'](function(_0x1c6fe5){logger[_0x14c3('0xc')](_0x14c3('0xd'),_0x1da379,_0x14c3('0xe'));logger[_0x14c3('0xf')](_0x14c3('0x10'),_0x1da379,_0x14c3('0xe'),JSON[_0x14c3('0x11')](_0x1c6fe5));if(_0x1c6fe5[_0x14c3('0x12')]){if(_0x1c6fe5[_0x14c3('0x12')][_0x14c3('0x13')]===0x1f4){logger[_0x14c3('0x12')](_0x14c3('0xd'),_0x1da379,_0x1c6fe5[_0x14c3('0x12')][_0x14c3('0x14')]);return _0x3af37d(_0x1c6fe5[_0x14c3('0x12')]['message']);}logger[_0x14c3('0x12')](_0x14c3('0xd'),_0x1da379,_0x1c6fe5['error']['message']);return _0x35e73a(_0x1c6fe5[_0x14c3('0x12')][_0x14c3('0x14')]);}else{logger[_0x14c3('0xc')]('Schedule,\x20%s,\x20%s',_0x1da379,'request\x20sent');_0x35e73a(_0x1c6fe5['result']['message']);}})[_0x14c3('0x15')](function(_0x4cd562){logger[_0x14c3('0x12')](_0x14c3('0xd'),_0x1da379,_0x4cd562);_0x3af37d(_0x4cd562);});});} \ No newline at end of file +var _0x02df=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1cf340,_0x3aea83){var _0x2c1fbe=function(_0x5581a1){while(--_0x5581a1){_0x1cf340['push'](_0x1cf340['shift']());}};_0x2c1fbe(++_0x3aea83);}(_0x02df,0x9f));var _0xf02d=function(_0x5c9fd7,_0x14a378){_0x5c9fd7=_0x5c9fd7-0x0;var _0x1ff92f=_0x02df[_0x5c9fd7];return _0x1ff92f;};'use strict';var _=require(_0xf02d('0x0'));var util=require(_0xf02d('0x1'));var moment=require(_0xf02d('0x2'));var BPromise=require(_0xf02d('0x3'));var rs=require(_0xf02d('0x4'));var fs=require('fs');var Redis=require(_0xf02d('0x5'));var db=require(_0xf02d('0x6'))['db'];var utils=require(_0xf02d('0x7'));var logger=require(_0xf02d('0x8'))('rpc');var config=require(_0xf02d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf02d('0xa')][_0xf02d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c7d99,_0x21a7d8,_0x36de0d){return new BPromise(function(_0x54aa0b,_0x18ddde){return client[_0xf02d('0xc')](_0x2c7d99,_0x36de0d)[_0xf02d('0xd')](function(_0x76d2af){logger['info'](_0xf02d('0xe'),_0x21a7d8,_0xf02d('0xf'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x21a7d8,_0xf02d('0xf'),JSON[_0xf02d('0x10')](_0x76d2af));if(_0x76d2af[_0xf02d('0x11')]){if(_0x76d2af[_0xf02d('0x11')][_0xf02d('0x12')]===0x1f4){logger[_0xf02d('0x11')](_0xf02d('0xe'),_0x21a7d8,_0x76d2af[_0xf02d('0x11')][_0xf02d('0x13')]);return _0x18ddde(_0x76d2af[_0xf02d('0x11')][_0xf02d('0x13')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x21a7d8,_0x76d2af[_0xf02d('0x11')][_0xf02d('0x13')]);return _0x54aa0b(_0x76d2af[_0xf02d('0x11')][_0xf02d('0x13')]);}else{logger[_0xf02d('0x14')](_0xf02d('0xe'),_0x21a7d8,'request\x20sent');_0x54aa0b(_0x76d2af[_0xf02d('0x15')][_0xf02d('0x13')]);}})['catch'](function(_0x222892){logger[_0xf02d('0x11')](_0xf02d('0xe'),_0x21a7d8,_0x222892);_0x18ddde(_0x222892);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 7b42c5c..4880d8f 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 _0xb91c=['show','/:id/download','create','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x29c42b,_0x2cf9ee){var _0x4f4ec8=function(_0x4e8e0c){while(--_0x4e8e0c){_0x29c42b['push'](_0x29c42b['shift']());}};_0x4f4ec8(++_0x2cf9ee);}(_0xb91c,0x19d));var _0xcb91=function(_0x2e9197,_0x3670d1){_0x2e9197=_0x2e9197-0x0;var _0x16290a=_0xb91c[_0x2e9197];return _0x16290a;};'use strict';var multer=require('multer');var util=require(_0xcb91('0x0'));var path=require(_0xcb91('0x1'));var timeout=require(_0xcb91('0x2'));var express=require(_0xcb91('0x3'));var router=express[_0xcb91('0x4')]();var fs_extra=require(_0xcb91('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb91('0x6'));var config=require(_0xcb91('0x7'));var controller=require('./screenRecording.controller');router[_0xcb91('0x8')]('/',auth[_0xcb91('0x9')](),controller['index']);router[_0xcb91('0x8')]('/describe',auth[_0xcb91('0x9')](),controller[_0xcb91('0xa')]);router[_0xcb91('0x8')](_0xcb91('0xb'),auth['isAuthenticated'](),controller[_0xcb91('0xc')]);router[_0xcb91('0x8')](_0xcb91('0xd'),auth[_0xcb91('0x9')](),controller['download']);router['post']('/',auth[_0xcb91('0x9')](),controller[_0xcb91('0xe')]);router['put'](_0xcb91('0xb'),auth[_0xcb91('0x9')](),controller['update']);router['delete'](_0xcb91('0xb'),auth[_0xcb91('0x9')](),controller[_0xcb91('0xf')]);module[_0xcb91('0x10')]=router; \ No newline at end of file +var _0x3b7d=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x5a96b9,_0x1fa1c5){var _0x2fb264=function(_0x624c60){while(--_0x624c60){_0x5a96b9['push'](_0x5a96b9['shift']());}};_0x2fb264(++_0x1fa1c5);}(_0x3b7d,0x13f));var _0xd3b7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3b7d[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xd3b7('0x0'));var util=require(_0xd3b7('0x1'));var path=require(_0xd3b7('0x2'));var timeout=require(_0xd3b7('0x3'));var express=require(_0xd3b7('0x4'));var router=express['Router']();var fs_extra=require(_0xd3b7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd3b7('0x6'));var config=require(_0xd3b7('0x7'));var controller=require(_0xd3b7('0x8'));router[_0xd3b7('0x9')]('/',auth[_0xd3b7('0xa')](),controller[_0xd3b7('0xb')]);router['get'](_0xd3b7('0xc'),auth[_0xd3b7('0xa')](),controller[_0xd3b7('0xd')]);router[_0xd3b7('0x9')](_0xd3b7('0xe'),auth[_0xd3b7('0xa')](),controller[_0xd3b7('0xf')]);router[_0xd3b7('0x9')](_0xd3b7('0x10'),auth[_0xd3b7('0xa')](),controller['download']);router[_0xd3b7('0x11')]('/',auth[_0xd3b7('0xa')](),controller[_0xd3b7('0x12')]);router[_0xd3b7('0x13')](_0xd3b7('0xe'),auth['isAuthenticated'](),controller[_0xd3b7('0x14')]);router[_0xd3b7('0x15')](_0xd3b7('0xe'),auth[_0xd3b7('0xa')](),controller[_0xd3b7('0x16')]);module[_0xd3b7('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 94ac13d..1479ff8 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 _0x42c3=['toString','DATE','createdAt','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm'];(function(_0x27ef14,_0x19a720){var _0x44ab74=function(_0x3f25a0){while(--_0x3f25a0){_0x27ef14['push'](_0x27ef14['shift']());}};_0x44ab74(++_0x19a720);}(_0x42c3,0x1bc));var _0x342c=function(_0x250b81,_0x5381a9){_0x250b81=_0x250b81-0x0;var _0x3abf82=_0x42c3[_0x250b81];return _0x3abf82;};'use strict';var Sequelize=require(_0x342c('0x0'));var moment=require(_0x342c('0x1'));var path=require(_0x342c('0x2'));var config=require('../../config/environment');module[_0x342c('0x3')]={'format':{'type':Sequelize[_0x342c('0x4')],'get':function(){return this[_0x342c('0x5')]('value')?path[_0x342c('0x6')](this['getDataValue'](_0x342c('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x342c('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x3f6d68){var _0x364f48=_0x3f6d68[_0x342c('0x9')](/\\/g,'/');this[_0x342c('0xa')]('value',_0x364f48);}},'rating':{'type':Sequelize[_0x342c('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x342c('0xb')],'set':function(_0x3bc287){this[_0x342c('0xa')](_0x342c('0xc'),moment()['subtract'](_0x3bc287,'ms'));this[_0x342c('0xa')](_0x342c('0xd'),moment());this[_0x342c('0xa')]('duration',_0x3bc287);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x342c('0xc')))[_0x342c('0xe')](_0x342c('0xf'))[_0x342c('0x10')]();}},'closedAt':{'type':Sequelize[_0x342c('0x11')],'get':function(){return moment(this[_0x342c('0x5')](_0x342c('0xd')))[_0x342c('0xe')](_0x342c('0xf'))[_0x342c('0x10')]();}},'createdAt':{'type':Sequelize[_0x342c('0x11')],'get':function(){return moment(this[_0x342c('0x5')](_0x342c('0x12')))[_0x342c('0xe')](_0x342c('0xf'))[_0x342c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x342c('0x11')],'get':function(){return moment(this['getDataValue'](_0x342c('0x13')))['format'](_0x342c('0xf'))[_0x342c('0x10')]();}}}; \ No newline at end of file +var _0xf08c=['replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x47a2bf,_0x3ca795){var _0x323b07=function(_0x33a0ce){while(--_0x33a0ce){_0x47a2bf['push'](_0x47a2bf['shift']());}};_0x323b07(++_0x3ca795);}(_0xf08c,0xb5));var _0xcf08=function(_0x1aa8f4,_0x5d14ea){_0x1aa8f4=_0x1aa8f4-0x0;var _0x39b42f=_0xf08c[_0x1aa8f4];return _0x39b42f;};'use strict';var Sequelize=require(_0xcf08('0x0'));var moment=require(_0xcf08('0x1'));var path=require(_0xcf08('0x2'));var config=require('../../config/environment');module[_0xcf08('0x3')]={'format':{'type':Sequelize[_0xcf08('0x4')],'get':function(){return this[_0xcf08('0x5')](_0xcf08('0x6'))?path['extname'](this['getDataValue'](_0xcf08('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xcf08('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xcf08('0x7')],'set':function(_0x37efab){var _0x13b89c=_0x37efab[_0xcf08('0x8')](/\\/g,'/');this['setDataValue']('value',_0x13b89c);}},'rating':{'type':Sequelize[_0xcf08('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1ab45d){this[_0xcf08('0xa')](_0xcf08('0xb'),moment()[_0xcf08('0xc')](_0x1ab45d,'ms'));this['setDataValue'](_0xcf08('0xd'),moment());this[_0xcf08('0xa')](_0xcf08('0xe'),_0x1ab45d);}},'startedAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this[_0xcf08('0x5')](_0xcf08('0xb')))[_0xcf08('0x10')](_0xcf08('0x11'))[_0xcf08('0x12')]();}},'closedAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this[_0xcf08('0x5')]('closedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xcf08('0x12')]();}},'createdAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this['getDataValue'](_0xcf08('0x13')))[_0xcf08('0x10')](_0xcf08('0x11'))[_0xcf08('0x12')]();}},'updatedAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this['getDataValue'](_0xcf08('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0xcf08('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index b4c09ac..59e5575 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 _0xd6d6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x544432,_0x575b05){var _0x3530b5=function(_0x2dbd7f){while(--_0x2dbd7f){_0x544432['push'](_0x544432['shift']());}};_0x3530b5(++_0x575b05);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1759f8,_0x1a45cd){_0x1759f8=_0x1759f8-0x0;var _0x16769f=_0xd6d6[_0x1759f8];return _0x16769f;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](_['map'](_0xde3272,_0x6d6d('0x2b')),['format']);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x553645[_0x6d6d('0x35')]);_0x8a9a84[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x8a9a84['model'],qs[_0x6d6d('0x3a')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3a')]));_0x5273cd[_0x6d6d('0x38')]=_0x5273cd[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x5273cd[_0x6d6d('0x38')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x35')]['limit']);_0x5273cd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x1f')]);}_0x5273cd['order']=qs['sort'](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x5273cd[_0x6d6d('0x3f')]=qs['filters'](_[_0x6d6d('0x40')](_0x553645[_0x6d6d('0x35')],_0x8a9a84[_0x6d6d('0x37')]),_0xde3272);if(_0x553645[_0x6d6d('0x35')]['filter']){_0x5273cd['where']=_['merge'](_0x5273cd[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0xde3272,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x31')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2b')]]={'$like':'%'+_0x553645[_0x6d6d('0x35')][_0x6d6d('0x41')]+'%'};return _0x253416;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x4b457d={'where':_0x5273cd[_0x6d6d('0x3f')]};return db[_0x6d6d('0x2e')][_0x6d6d('0x20')](_0x4b457d)[_0x6d6d('0x27')](function(_0x32275b){_0x57341f[_0x6d6d('0x20')]=_0x32275b;if(_0x553645[_0x6d6d('0x35')]['includeAll']){_0x5273cd[_0x6d6d('0x44')]=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x5273cd);})[_0x6d6d('0x27')](function(_0xe1aa77){_0x57341f['rows']=_0xe1aa77;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))[_0x6d6d('0x46')](handleError(_0x3edcce,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x43c03c[_0x6d6d('0x35')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x37')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x35')]);_0x15bf62[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x43c03c['model'],qs[_0x6d6d('0x3a')](_0x452de2['query'][_0x6d6d('0x3a')]));_0x15bf62[_0x6d6d('0x38')]=_0x15bf62[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x15bf62[_0x6d6d('0x38')]:_0x43c03c[_0x6d6d('0x33')];if(_0x452de2[_0x6d6d('0x35')]['includeAll']){_0x15bf62[_0x6d6d('0x44')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x42')]({},_0x15bf62,_0x452de2[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x47')](_0x15bf62)[_0x6d6d('0x27')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x27')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x46')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x48')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2e')][_0x6d6d('0x48')](_0x5e4c04[_0x6d6d('0x49')],{})[_0x6d6d('0x27')](respondWithResult(_0x4d78bb,0xc9))[_0x6d6d('0x46')](handleError(_0x4d78bb,null));};exports['update']=function(_0x47170d,_0x27b396){if(_0x47170d[_0x6d6d('0x49')]['id']){delete _0x47170d[_0x6d6d('0x49')]['id'];}delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4a')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4b')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4c')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4d')];return db['ScreenRecording'][_0x6d6d('0x47')]({'where':{'id':_0x47170d[_0x6d6d('0x4e')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x27b396,null))[_0x6d6d('0x27')](saveUpdates(_0x47170d[_0x6d6d('0x49')],null))['then'](respondWithResult(_0x27b396,null))[_0x6d6d('0x46')](handleError(_0x27b396,null));};exports[_0x6d6d('0x4f')]=function(_0x45340b,_0x4e4c3e){return db['ScreenRecording'][_0x6d6d('0x4f')]()['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x46')](handleError(_0x4e4c3e,null));};exports[_0x6d6d('0x50')]=function(_0x32aaae,_0x268361,_0x4777a5){var _0x18e2de=require(_0x6d6d('0x51'));var _0x26c23a=![];var _0x1a8f33={};if(_0x32aaae[_0x6d6d('0x35')]['type']&&_0x32aaae[_0x6d6d('0x35')][_0x6d6d('0x31')]===_0x6d6d('0x52')){_0x1a8f33[_0x6d6d('0x52')]=_0x32aaae[_0x6d6d('0x4e')]['id'];}else{_0x1a8f33['id']=_0x32aaae[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')]['find']({'where':_0x1a8f33,'attributes':['id','value'],'raw':!![]})[_0x6d6d('0x27')](handleEntityNotFound(_0x268361,null))[_0x6d6d('0x27')](function(_0x5cc644){if(_0x5cc644){var _0x3e98a0=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x5cc644[_0x6d6d('0x4d')]);var _0xc6b96e=util[_0x6d6d('0x56')](_0x6d6d('0x57'),_0x3e98a0);if(fs[_0x6d6d('0x58')](_0xc6b96e)){_0x26c23a=!![];return _0x18e2de[_0x6d6d('0x59')](_0xc6b96e,_0x3e98a0,config[_0x6d6d('0x5a')][_0x6d6d('0x5b')])[_0x6d6d('0x27')](function(){return _0x5cc644;});}return _0x5cc644;}})[_0x6d6d('0x27')](function(_0x3065ea){if(_0x3065ea){var _0x50d8dd=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],'server/files/screen_recordings',_0x3065ea[_0x6d6d('0x4d')]);if(!fs[_0x6d6d('0x58')](_0x50d8dd)){throw new db[(_0x6d6d('0x5c'))][(_0x6d6d('0x5d'))](_0x6d6d('0x5e'));}if(_0x3065ea[_0x6d6d('0x5f')]){return _0x268361[_0x6d6d('0x50')](_0x50d8dd,_0x3065ea[_0x6d6d('0x5f')]+path[_0x6d6d('0x60')](_0x50d8dd),function(){if(_0x26c23a){fs['unlink'](_0x50d8dd);}});}else{return _0x268361['download'](_0x50d8dd,function(_0x22c3a1){if(_0x26c23a){fs[_0x6d6d('0x61')](_0x50d8dd);}});}}})[_0x6d6d('0x46')](function(_0x5de33f){if(_0x5de33f['message']===_0x6d6d('0x5e')){_0x268361['status'](0x194)[_0x6d6d('0x2c')]('Not\x20found');}else{return handleError(_0x268361,null);}});};exports[_0x6d6d('0x28')]=function(_0x367a6f,_0x21f14c){return db[_0x6d6d('0x2e')][_0x6d6d('0x47')]({'where':{'id':_0x367a6f[_0x6d6d('0x4e')]['id']}})['then'](function(_0x41e576){if(_['isNil'](_0x41e576)){throw new ReferenceError(_0x6d6d('0x62'));}return _0x41e576;})['then'](function(_0x2a21d8){var _0x3e48f7=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x2a21d8[_0x6d6d('0x4d')]);logger[_0x6d6d('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x3e48f7);if(!_['isNil'](_0x2a21d8[_0x6d6d('0x4d')])&&fs['existsSync'](_0x3e48f7)){logger[_0x6d6d('0x63')]('File:\x20\x22'+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}_0x3e48f7=_0x3e48f7+_0x6d6d('0x66');if(!_[_0x6d6d('0x67')](_0x2a21d8[_0x6d6d('0x4d')])&&fs[_0x6d6d('0x58')](_0x3e48f7)){logger['info'](_0x6d6d('0x68')+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}return _0x2a21d8;})[_0x6d6d('0x27')](function(_0x1ba731){if(!_0x1ba731)throw new InternalError();return _0x1ba731[_0x6d6d('0x28')]();})[_0x6d6d('0x27')](function(){_0x21f14c['status'](0xcc)[_0x6d6d('0x1b')]();})[_0x6d6d('0x46')](handleError(_0x21f14c,null));}; \ No newline at end of file +var _0xac31=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','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','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','then','includeAll','findAll','rows','catch','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher'];(function(_0x4c67b8,_0x571e13){var _0xbc26e=function(_0x16e9ac){while(--_0x16e9ac){_0x4c67b8['push'](_0x4c67b8['shift']());}};_0xbc26e(++_0x571e13);}(_0xac31,0xca));var _0x1ac3=function(_0x1c1ac6,_0x416962){_0x1c1ac6=_0x1c1ac6-0x0;var _0x268ab3=_0xac31[_0x1c1ac6];return _0x268ab3;};'use strict';var emlformat=require(_0x1ac3('0x0'));var rimraf=require(_0x1ac3('0x1'));var zipdir=require(_0x1ac3('0x2'));var jsonpatch=require(_0x1ac3('0x3'));var rp=require(_0x1ac3('0x4'));var moment=require(_0x1ac3('0x5'));var BPromise=require(_0x1ac3('0x6'));var Mustache=require('mustache');var util=require(_0x1ac3('0x7'));var path=require(_0x1ac3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ac3('0xa'));var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac3('0x18'));var db=require(_0x1ac3('0x19'))['db'];function respondWithStatusCode(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xcc;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0x1a')](_0x2338b9);}return _0x2eeabf[_0x1ac3('0x1b')](_0x2338b9)[_0x1ac3('0x1c')]();};}function respondWithResult(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0xc8;return function(_0x24bb5e){if(_0x24bb5e){return _0x2def9f[_0x1ac3('0x1b')](_0x53cc35)['json'](_0x24bb5e);}};}function respondWithFilteredResult(_0x29a7b3,_0x1f9641){return function(_0x38b52a){if(_0x38b52a){var _0x51f1e4=typeof _0x1f9641[_0x1ac3('0x1d')]===_0x1ac3('0x1e')&&typeof _0x1f9641[_0x1ac3('0x1f')]==='undefined';var _0x195683=_0x38b52a['count'];var _0x291616=_0x51f1e4?0x0:_0x1f9641[_0x1ac3('0x1d')];var _0x20091d=_0x51f1e4?_0x38b52a[_0x1ac3('0x20')]:_0x1f9641[_0x1ac3('0x1d')]+_0x1f9641['limit'];var _0x136e73;if(_0x20091d>=_0x195683){_0x20091d=_0x195683;_0x136e73=0xc8;}else{_0x136e73=0xce;}_0x29a7b3[_0x1ac3('0x1b')](_0x136e73);return _0x29a7b3[_0x1ac3('0x21')](_0x1ac3('0x22'),_0x291616+'-'+_0x20091d+'/'+_0x195683)['json'](_0x38b52a);}return null;};}function patchUpdates(_0x48d18a){return function(_0x2879d8){try{jsonpatch[_0x1ac3('0x23')](_0x2879d8,_0x48d18a,!![]);}catch(_0x14070b){return BPromise[_0x1ac3('0x24')](_0x14070b);}return _0x2879d8[_0x1ac3('0x25')]();};}function saveUpdates(_0x319988,_0x23b767){return function(_0x10912a){if(_0x10912a){return _0x10912a[_0x1ac3('0x26')](_0x319988)['then'](function(_0x1e277f){return _0x1e277f;});}return null;};}function removeEntity(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(_0x2b5182){return _0x2b5182[_0x1ac3('0x27')]()['then'](function(){_0x231b7f[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();});}};}function handleEntityNotFound(_0x145486,_0x2dfdb7){return function(_0x10db3d){if(!_0x10db3d){_0x145486['sendStatus'](0x194);}return _0x10db3d;};}function handleError(_0x5a2ab2,_0x503a64){_0x503a64=_0x503a64||0x1f4;return function(_0x528807){logger['error'](_0x528807[_0x1ac3('0x28')]);if(_0x528807['name']){delete _0x528807[_0x1ac3('0x29')];}_0x5a2ab2[_0x1ac3('0x1b')](_0x503a64)[_0x1ac3('0x2a')](_0x528807);};}exports[_0x1ac3('0x2b')]=function(_0x4b3d3c,_0x61441d){var _0x541da0={},_0x2ddd73={},_0x4000b0={'count':0x0,'rows':[]};var _0x440aed=_[_0x1ac3('0x2c')](db[_0x1ac3('0x2d')][_0x1ac3('0x2e')],function(_0x9c17c2){return{'name':_0x9c17c2['fieldName'],'type':_0x9c17c2[_0x1ac3('0x2f')][_0x1ac3('0x30')]};});_0x2ddd73[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_['map'](_0x440aed,_0x1ac3('0x29')),[_0x1ac3('0x33')]);_0x2ddd73[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4b3d3c[_0x1ac3('0x34')]);_0x2ddd73['filters']=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],_0x2ddd73[_0x1ac3('0x34')]);_0x541da0[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],qs['fields'](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x541da0[_0x1ac3('0x37')]=_0x541da0[_0x1ac3('0x37')]['length']?_0x541da0[_0x1ac3('0x37')]:_0x2ddd73[_0x1ac3('0x31')];if(!_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x39')](_0x1ac3('0x3a'))){_0x541da0[_0x1ac3('0x1f')]=qs[_0x1ac3('0x1f')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x1f')]);_0x541da0['offset']=qs[_0x1ac3('0x1d')](_0x4b3d3c[_0x1ac3('0x34')]['offset']);}_0x541da0[_0x1ac3('0x3b')]=qs[_0x1ac3('0x3c')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x3c')]);_0x541da0[_0x1ac3('0x3d')]=qs[_0x1ac3('0x3e')](_[_0x1ac3('0x3f')](_0x4b3d3c[_0x1ac3('0x34')],_0x2ddd73['filters']),_0x440aed);if(_0x4b3d3c[_0x1ac3('0x34')]['filter']){_0x541da0[_0x1ac3('0x3d')]=_[_0x1ac3('0x40')](_0x541da0[_0x1ac3('0x3d')],{'$or':_[_0x1ac3('0x2c')](_0x440aed,function(_0x3141ae){if(_0x3141ae[_0x1ac3('0x2f')]!=='VIRTUAL'){var _0x3b5c1c={};_0x3b5c1c[_0x3141ae[_0x1ac3('0x29')]]={'$like':'%'+_0x4b3d3c[_0x1ac3('0x34')]['filter']+'%'};return _0x3b5c1c;}})});}_0x541da0=_[_0x1ac3('0x40')]({},_0x541da0,_0x4b3d3c[_0x1ac3('0x41')]);var _0x5cec6b={'where':_0x541da0[_0x1ac3('0x3d')]};return db[_0x1ac3('0x2d')][_0x1ac3('0x20')](_0x5cec6b)[_0x1ac3('0x42')](function(_0x466a45){_0x4000b0[_0x1ac3('0x20')]=_0x466a45;if(_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x541da0['include']=[{'all':!![]}];}return db[_0x1ac3('0x2d')][_0x1ac3('0x44')](_0x541da0);})[_0x1ac3('0x42')](function(_0x254a77){_0x4000b0[_0x1ac3('0x45')]=_0x254a77;return _0x4000b0;})[_0x1ac3('0x42')](respondWithFilteredResult(_0x61441d,_0x541da0))[_0x1ac3('0x46')](handleError(_0x61441d,null));};exports['show']=function(_0x4edc4d,_0x2c2099){var _0x3f60ca={'raw':![],'where':{'id':_0x4edc4d[_0x1ac3('0x47')]['id']}},_0x4972d1={};_0x4972d1[_0x1ac3('0x31')]=_['keys'](db[_0x1ac3('0x2d')]['rawAttributes']);_0x4972d1[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4edc4d[_0x1ac3('0x34')]);_0x4972d1[_0x1ac3('0x3e')]=_['intersection'](_0x4972d1[_0x1ac3('0x31')],_0x4972d1[_0x1ac3('0x34')]);_0x3f60ca[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x4972d1[_0x1ac3('0x31')],qs['fields'](_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x3f60ca[_0x1ac3('0x37')]=_0x3f60ca[_0x1ac3('0x37')]['length']?_0x3f60ca[_0x1ac3('0x37')]:_0x4972d1[_0x1ac3('0x31')];if(_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x3f60ca['include']=[{'all':!![]}];}_0x3f60ca=_[_0x1ac3('0x40')]({},_0x3f60ca,_0x4edc4d[_0x1ac3('0x41')]);return db[_0x1ac3('0x2d')][_0x1ac3('0x48')](_0x3f60ca)['then'](handleEntityNotFound(_0x2c2099,null))[_0x1ac3('0x42')](respondWithResult(_0x2c2099,null))['catch'](handleError(_0x2c2099,null));};exports[_0x1ac3('0x49')]=function(_0x10bcaf,_0x2e3347){return db[_0x1ac3('0x2d')][_0x1ac3('0x49')](_0x10bcaf[_0x1ac3('0x4a')],{})[_0x1ac3('0x42')](respondWithResult(_0x2e3347,0xc9))['catch'](handleError(_0x2e3347,null));};exports['update']=function(_0xe8f33c,_0x249c2d){if(_0xe8f33c[_0x1ac3('0x4a')]['id']){delete _0xe8f33c['body']['id'];}delete _0xe8f33c['body']['duration'];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4b')];delete _0xe8f33c['body'][_0x1ac3('0x4c')];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4d')];return db[_0x1ac3('0x2d')]['find']({'where':{'id':_0xe8f33c['params']['id']}})[_0x1ac3('0x42')](handleEntityNotFound(_0x249c2d,null))[_0x1ac3('0x42')](saveUpdates(_0xe8f33c['body'],null))[_0x1ac3('0x42')](respondWithResult(_0x249c2d,null))['catch'](handleError(_0x249c2d,null));};exports['describe']=function(_0x2d628d,_0x220dd0){return db['ScreenRecording'][_0x1ac3('0x4e')]()['then'](respondWithResult(_0x220dd0,null))[_0x1ac3('0x46')](handleError(_0x220dd0,null));};exports[_0x1ac3('0x4f')]=function(_0x3586b9,_0x3a0320,_0x34ad43){var _0x40e9c7=require(_0x1ac3('0x50'));var _0x331374=![];var _0xeb7e49={};if(_0x3586b9[_0x1ac3('0x34')][_0x1ac3('0x2f')]&&_0x3586b9['query']['type']===_0x1ac3('0x51')){_0xeb7e49[_0x1ac3('0x51')]=_0x3586b9[_0x1ac3('0x47')]['id'];}else{_0xeb7e49['id']=_0x3586b9[_0x1ac3('0x47')]['id'];}return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':_0xeb7e49,'attributes':['id',_0x1ac3('0x4d')],'raw':!![]})[_0x1ac3('0x42')](handleEntityNotFound(_0x3a0320,null))[_0x1ac3('0x42')](function(_0x3149f6){if(_0x3149f6){var _0x541bba=path[_0x1ac3('0x52')](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x3149f6[_0x1ac3('0x4d')]);var _0x20c195=util['format'](_0x1ac3('0x55'),_0x541bba);if(fs[_0x1ac3('0x56')](_0x20c195)){_0x331374=!![];return _0x40e9c7['decryptFile'](_0x20c195,_0x541bba,config['secrets']['recording'])[_0x1ac3('0x42')](function(){return _0x3149f6;});}return _0x3149f6;}})[_0x1ac3('0x42')](function(_0x2a1f66){if(_0x2a1f66){var _0x5ad546=path[_0x1ac3('0x52')](config['root'],'server/files/screen_recordings',_0x2a1f66['value']);if(!fs['existsSync'](_0x5ad546)){throw new db[(_0x1ac3('0x57'))][(_0x1ac3('0x58'))](_0x1ac3('0x59'));}if(_0x2a1f66[_0x1ac3('0x5a')]){return _0x3a0320[_0x1ac3('0x4f')](_0x5ad546,_0x2a1f66['filename']+path[_0x1ac3('0x5b')](_0x5ad546),function(){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}else{return _0x3a0320['download'](_0x5ad546,function(_0x2bcb4b){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}}})[_0x1ac3('0x46')](function(_0x2e79b2){if(_0x2e79b2[_0x1ac3('0x5d')]==='ScreenRecording\x20not\x20found'){_0x3a0320[_0x1ac3('0x1b')](0x194)[_0x1ac3('0x2a')](_0x1ac3('0x5e'));}else{return handleError(_0x3a0320,null);}});};exports[_0x1ac3('0x27')]=function(_0x4cfa04,_0x19407a){return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':{'id':_0x4cfa04[_0x1ac3('0x47')]['id']}})[_0x1ac3('0x42')](function(_0x1ac283){if(_['isNil'](_0x1ac283)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ac283;})['then'](function(_0x582fe2){var _0x3b930b=path['join'](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x582fe2[_0x1ac3('0x4d')]);logger[_0x1ac3('0x5f')](_0x1ac3('0x60'),_0x3b930b);if(!_[_0x1ac3('0x61')](_0x582fe2['value'])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')](_0x1ac3('0x62')+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}_0x3b930b=_0x3b930b+_0x1ac3('0x64');if(!_[_0x1ac3('0x61')](_0x582fe2[_0x1ac3('0x4d')])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')]('File:\x20\x22'+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}return _0x582fe2;})['then'](function(_0x402507){if(!_0x402507)throw new InternalError();return _0x402507[_0x1ac3('0x27')]();})[_0x1ac3('0x42')](function(){_0x19407a[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();})[_0x1ac3('0x46')](handleError(_0x19407a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 618bf6b..4a72927 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 _0x8f02=['../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8f02,0x19b));var _0x28f0=function(_0x5e018f,_0x431235){_0x5e018f=_0x5e018f-0x0;var _0x3b2561=_0x8f02[_0x5e018f];return _0x3b2561;};'use strict';var _=require(_0x28f0('0x0'));var util=require(_0x28f0('0x1'));var logger=require(_0x28f0('0x2'))(_0x28f0('0x3'));var moment=require(_0x28f0('0x4'));var BPromise=require(_0x28f0('0x5'));var rp=require(_0x28f0('0x6'));var fs=require('fs');var path=require(_0x28f0('0x7'));var rimraf=require(_0x28f0('0x8'));var config=require(_0x28f0('0x9'));var attributes=require(_0x28f0('0xa'));module['exports']=function(_0x4c3ecc,_0x369b2f){return _0x4c3ecc[_0x28f0('0xb')](_0x28f0('0xc'),attributes,{'tableName':_0x28f0('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x28f0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f3c=['exports','screen_recordings','interactionid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x2b25b3,_0x1a6e93){var _0x79f2fa=function(_0x27f8bb){while(--_0x27f8bb){_0x2b25b3['push'](_0x2b25b3['shift']());}};_0x79f2fa(++_0x1a6e93);}(_0x2f3c,0x1b3));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc2f3('0x0'));var util=require(_0xc2f3('0x1'));var logger=require(_0xc2f3('0x2'))('api');var moment=require(_0xc2f3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc2f3('0x4'));var fs=require('fs');var path=require(_0xc2f3('0x5'));var rimraf=require(_0xc2f3('0x6'));var config=require(_0xc2f3('0x7'));var attributes=require(_0xc2f3('0x8'));module[_0xc2f3('0x9')]=function(_0x378764,_0x37569d){return _0x378764['define']('ScreenRecording',attributes,{'tableName':_0xc2f3('0xa'),'paranoid':![],'indexes':[{'name':_0xc2f3('0xb'),'fields':[_0xc2f3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3463ca0..69c6829 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 _0x844e=['../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x844e,0x71));var _0xe844=function(_0x1ac461,_0x2ef4f6){_0x1ac461=_0x1ac461-0x0;var _0x4dfdda=_0x844e[_0x1ac461];return _0x4dfdda;};'use strict';var _=require('lodash');var util=require(_0xe844('0x0'));var moment=require(_0xe844('0x1'));var BPromise=require(_0xe844('0x2'));var rs=require(_0xe844('0x3'));var fs=require('fs');var Redis=require(_0xe844('0x4'));var db=require(_0xe844('0x5'))['db'];var utils=require(_0xe844('0x6'));var logger=require(_0xe844('0x7'))(_0xe844('0x8'));var config=require('../../config/environment');var jayson=require(_0xe844('0x9'));var client=jayson[_0xe844('0xa')][_0xe844('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34cbd6,_0x433471,_0xac3c99){return new BPromise(function(_0x9148e8,_0x30f6ed){return client[_0xe844('0xc')](_0x34cbd6,_0xac3c99)['then'](function(_0x4c1382){logger[_0xe844('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x433471,_0xe844('0xe'));logger[_0xe844('0xf')](_0xe844('0x10'),_0x433471,_0xe844('0xe'),JSON[_0xe844('0x11')](_0x4c1382));if(_0x4c1382['error']){if(_0x4c1382[_0xe844('0x12')][_0xe844('0x13')]===0x1f4){logger['error'](_0xe844('0x14'),_0x433471,_0x4c1382[_0xe844('0x12')][_0xe844('0x15')]);return _0x30f6ed(_0x4c1382[_0xe844('0x12')][_0xe844('0x15')]);}logger[_0xe844('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x433471,_0x4c1382['error'][_0xe844('0x15')]);return _0x9148e8(_0x4c1382[_0xe844('0x12')][_0xe844('0x15')]);}else{logger[_0xe844('0xd')](_0xe844('0x14'),_0x433471,_0xe844('0xe'));_0x9148e8(_0x4c1382[_0xe844('0x16')][_0xe844('0x15')]);}})[_0xe844('0x17')](function(_0x76d50a){logger[_0xe844('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x433471,_0x76d50a);_0x30f6ed(_0x76d50a);});});} \ No newline at end of file +var _0xb314=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message'];(function(_0x2cae32,_0x12b31c){var _0xf25987=function(_0x9773a5){while(--_0x9773a5){_0x2cae32['push'](_0x2cae32['shift']());}};_0xf25987(++_0x12b31c);}(_0xb314,0xb2));var _0x4b31=function(_0x4a09de,_0x548dac){_0x4a09de=_0x4a09de-0x0;var _0x35a81e=_0xb314[_0x4a09de];return _0x35a81e;};'use strict';var _=require('lodash');var util=require(_0x4b31('0x0'));var moment=require('moment');var BPromise=require(_0x4b31('0x1'));var rs=require(_0x4b31('0x2'));var fs=require('fs');var Redis=require(_0x4b31('0x3'));var db=require(_0x4b31('0x4'))['db'];var utils=require(_0x4b31('0x5'));var logger=require(_0x4b31('0x6'))(_0x4b31('0x7'));var config=require(_0x4b31('0x8'));var jayson=require(_0x4b31('0x9'));var client=jayson['client'][_0x4b31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x198c93,_0x56214f,_0x45f8d3){return new BPromise(function(_0x3cdabe,_0x5a67e6){return client[_0x4b31('0xb')](_0x198c93,_0x45f8d3)[_0x4b31('0xc')](function(_0x3f61ea){logger[_0x4b31('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x56214f,_0x4b31('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x56214f,_0x4b31('0xe'),JSON[_0x4b31('0xf')](_0x3f61ea));if(_0x3f61ea['error']){if(_0x3f61ea[_0x4b31('0x10')][_0x4b31('0x11')]===0x1f4){logger['error'](_0x4b31('0x12'),_0x56214f,_0x3f61ea[_0x4b31('0x10')]['message']);return _0x5a67e6(_0x3f61ea['error'][_0x4b31('0x13')]);}logger['error'](_0x4b31('0x12'),_0x56214f,_0x3f61ea[_0x4b31('0x10')]['message']);return _0x3cdabe(_0x3f61ea[_0x4b31('0x10')][_0x4b31('0x13')]);}else{logger[_0x4b31('0xd')](_0x4b31('0x12'),_0x56214f,_0x4b31('0xe'));_0x3cdabe(_0x3f61ea[_0x4b31('0x14')][_0x4b31('0x13')]);}})[_0x4b31('0x15')](function(_0x19c431){logger['error'](_0x4b31('0x12'),_0x56214f,_0x19c431);_0x5a67e6(_0x19c431);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 06f10ae..eca9bab 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 _0xadbc=['gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','%s%s','logo','extname','originalname','post','/:id/logo','single','addLogo','logologin','addLogoLogin','preferred','addPreferred','server/files/images/logos/','file','put','update','exports','util','path','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin'];(function(_0x35339c,_0x4b95f){var _0x455a45=function(_0x1c74d7){while(--_0x1c74d7){_0x35339c['push'](_0x35339c['shift']());}};_0x455a45(++_0x4b95f);}(_0xadbc,0x150));var _0xcadb=function(_0x125734,_0x13fa3f){_0x125734=_0x125734-0x0;var _0x3771f3=_0xadbc[_0x125734];return _0x3771f3;};'use strict';var multer=require('multer');var util=require(_0xcadb('0x0'));var path=require(_0xcadb('0x1'));var timeout=require('connect-timeout');var express=require(_0xcadb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcadb('0x3'));var config=require(_0xcadb('0x4'));var controller=require(_0xcadb('0x5'));router[_0xcadb('0x6')]('/',auth[_0xcadb('0x7')](),controller[_0xcadb('0x8')]);router['get'](_0xcadb('0x9'),controller[_0xcadb('0xa')]);router['get'](_0xcadb('0xb'),controller['show']);router['get']('/:id/logo',controller[_0xcadb('0xc')]);router['get'](_0xcadb('0xd'),controller[_0xcadb('0xe')]);router[_0xcadb('0x6')]('/:id/gdpr',controller[_0xcadb('0xf')]);router['get'](_0xcadb('0x10'),controller['getPreferred']);router[_0xcadb('0x6')](_0xcadb('0x11'),controller[_0xcadb('0x12')]);var upload=multer({'storage':multer[_0xcadb('0x13')]({'destination':function(_0x516587,_0x51c222,_0x30b2da){_0x30b2da(null,path[_0xcadb('0x14')](config[_0xcadb('0x15')],'server/files/images/logos/'));},'filename':function(_0x4a17ff,_0x24c756,_0x12f5d3){_0x12f5d3(null,util['format'](_0xcadb('0x16'),_0xcadb('0x17'),path[_0xcadb('0x18')](_0x24c756[_0xcadb('0x19')])));}})});router[_0xcadb('0x1a')](_0xcadb('0x1b'),upload[_0xcadb('0x1c')]('file'),controller[_0xcadb('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x117ffd,_0x2a31fe,_0x31cb48){_0x31cb48(null,path[_0xcadb('0x14')](config[_0xcadb('0x15')],'server/files/images/logos/'));},'filename':function(_0x4bad2e,_0xed020f,_0xd75df8){_0xd75df8(null,util['format']('%s%s',_0xcadb('0x1e'),path[_0xcadb('0x18')](_0xed020f[_0xcadb('0x19')])));}})});router[_0xcadb('0x1a')](_0xcadb('0xd'),upload[_0xcadb('0x1c')]('file'),controller[_0xcadb('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x21a256,_0xe7a8ab,_0x3f7666){_0x3f7666(null,path[_0xcadb('0x14')](config[_0xcadb('0x15')],'server/files/images/logos/'));},'filename':function(_0x1e89cb,_0x3feb8c,_0x105f83){_0x105f83(null,util['format'](_0xcadb('0x16'),_0xcadb('0x20'),path['extname'](_0x3feb8c['originalname'])));}})});router[_0xcadb('0x1a')](_0xcadb('0x10'),upload['single']('file'),controller[_0xcadb('0x21')]);var upload=multer({'storage':multer[_0xcadb('0x13')]({'destination':function(_0x53c43e,_0x8bda7e,_0x54d8a6){_0x54d8a6(null,path[_0xcadb('0x14')](config[_0xcadb('0x15')],_0xcadb('0x22')));},'filename':function(_0x409203,_0x5d4613,_0xffe445){_0xffe445(null,util['format'](_0xcadb('0x16'),'favicon',path[_0xcadb('0x18')](_0x5d4613['originalname'])));}})});router[_0xcadb('0x1a')](_0xcadb('0x11'),upload[_0xcadb('0x1c')](_0xcadb('0x23')),controller['addFavicon']);router[_0xcadb('0x24')]('/:id',auth[_0xcadb('0x7')](),controller[_0xcadb('0x25')]);module[_0xcadb('0x26')]=router; \ No newline at end of file +var _0x8bcf=['../../components/interaction/service','./setting.controller','get','isAuthenticated','/now','getDate','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','addLogo','logologin','file','addLogoLogin','server/files/images/logos/','addPreferred','addFavicon','put','/:id','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x53fedb,_0x5b98ed){var _0x5d08fc=function(_0x1b3cea){while(--_0x1b3cea){_0x53fedb['push'](_0x53fedb['shift']());}};_0x5d08fc(++_0x5b98ed);}(_0x8bcf,0xa5));var _0xf8bc=function(_0x38eea7,_0x112bf4){_0x38eea7=_0x38eea7-0x0;var _0x31265d=_0x8bcf[_0x38eea7];return _0x31265d;};'use strict';var multer=require(_0xf8bc('0x0'));var util=require('util');var path=require(_0xf8bc('0x1'));var timeout=require(_0xf8bc('0x2'));var express=require(_0xf8bc('0x3'));var router=express[_0xf8bc('0x4')]();var fs_extra=require(_0xf8bc('0x5'));var auth=require(_0xf8bc('0x6'));var interaction=require(_0xf8bc('0x7'));var config=require('../../config/environment');var controller=require(_0xf8bc('0x8'));router[_0xf8bc('0x9')]('/',auth[_0xf8bc('0xa')](),controller['index']);router[_0xf8bc('0x9')](_0xf8bc('0xb'),controller[_0xf8bc('0xc')]);router[_0xf8bc('0x9')]('/:id',controller['show']);router[_0xf8bc('0x9')](_0xf8bc('0xd'),controller['getLogo']);router['get'](_0xf8bc('0xe'),controller[_0xf8bc('0xf')]);router['get'](_0xf8bc('0x10'),controller[_0xf8bc('0x11')]);router['get'](_0xf8bc('0x12'),controller[_0xf8bc('0x13')]);router[_0xf8bc('0x9')](_0xf8bc('0x14'),controller[_0xf8bc('0x15')]);var upload=multer({'storage':multer[_0xf8bc('0x16')]({'destination':function(_0x168a1f,_0x4edbda,_0x151d66){_0x151d66(null,path[_0xf8bc('0x17')](config[_0xf8bc('0x18')],'server/files/images/logos/'));},'filename':function(_0x370323,_0x5ef2ae,_0x358d45){_0x358d45(null,util[_0xf8bc('0x19')](_0xf8bc('0x1a'),_0xf8bc('0x1b'),path[_0xf8bc('0x1c')](_0x5ef2ae[_0xf8bc('0x1d')])));}})});router[_0xf8bc('0x1e')]('/:id/logo',upload[_0xf8bc('0x1f')]('file'),controller[_0xf8bc('0x20')]);var upload=multer({'storage':multer[_0xf8bc('0x16')]({'destination':function(_0x447836,_0x445b28,_0x3d3749){_0x3d3749(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x172cba,_0x1b339a,_0x27f9eb){_0x27f9eb(null,util[_0xf8bc('0x19')](_0xf8bc('0x1a'),_0xf8bc('0x21'),path['extname'](_0x1b339a['originalname'])));}})});router[_0xf8bc('0x1e')]('/:id/logo_login',upload[_0xf8bc('0x1f')](_0xf8bc('0x22')),controller[_0xf8bc('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3214a3,_0x2b2ffe,_0x4dfaad){_0x4dfaad(null,path[_0xf8bc('0x17')](config[_0xf8bc('0x18')],_0xf8bc('0x24')));},'filename':function(_0x47ab74,_0x3fb697,_0x5aeff3){_0x5aeff3(null,util[_0xf8bc('0x19')](_0xf8bc('0x1a'),'preferred',path[_0xf8bc('0x1c')](_0x3fb697[_0xf8bc('0x1d')])));}})});router['post'](_0xf8bc('0x12'),upload[_0xf8bc('0x1f')](_0xf8bc('0x22')),controller[_0xf8bc('0x25')]);var upload=multer({'storage':multer[_0xf8bc('0x16')]({'destination':function(_0x56ecee,_0xdc64ee,_0x4cec5e){_0x4cec5e(null,path[_0xf8bc('0x17')](config[_0xf8bc('0x18')],_0xf8bc('0x24')));},'filename':function(_0xd5a643,_0x2697a9,_0x3d88a2){_0x3d88a2(null,util[_0xf8bc('0x19')](_0xf8bc('0x1a'),'favicon',path[_0xf8bc('0x1c')](_0x2697a9[_0xf8bc('0x1d')])));}})});router[_0xf8bc('0x1e')](_0xf8bc('0x14'),upload[_0xf8bc('0x1f')](_0xf8bc('0x22')),controller[_0xf8bc('0x26')]);router[_0xf8bc('0x27')](_0xf8bc('0x28'),auth[_0xf8bc('0xa')](),controller[_0xf8bc('0x29')]);module[_0xf8bc('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 99495fb..ffbef0c 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 _0xa20a=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER'];(function(_0x34f9a1,_0x592850){var _0x5f55ed=function(_0x453cec){while(--_0x453cec){_0x34f9a1['push'](_0x34f9a1['shift']());}};_0x5f55ed(++_0x592850);}(_0xa20a,0x74));var _0xaa20=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xa20a[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0xaa20('0x0')](0xb),'unique':_0xaa20('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xaa20('0x0')](0xb),'unique':_0xaa20('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xaa20('0x3')],'defaultValue':_0xaa20('0x4')},'logo':{'type':Sequelize[_0xaa20('0x3')]},'defaultLogo':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xaa20('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xaa20('0x3')]},'turnaddr':{'type':Sequelize[_0xaa20('0x3')]},'turnusername':{'type':Sequelize[_0xaa20('0x3')]},'turnpassword':{'type':Sequelize[_0xaa20('0x3')]},'pageTitle':{'type':Sequelize[_0xaa20('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xaa20('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xaa20('0x3')],'defaultValue':_0xaa20('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xaa20('0x3')],'defaultValue':_0xaa20('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xaa20('0x3')]},'defaultPreferred':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xaa20('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xaa20('0x3')]},'defaultFavicon':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xaa20('0x0')]},'transcribeRegion':{'type':Sequelize[_0xaa20('0x3')]},'sentiment':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xaa20('0x0')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaa20('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xaa20('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xaa20('0x0')](0x2)[_0xaa20('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xaa20('0x0')](0x2)[_0xaa20('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xaa20('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7e6a=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','alternate'];(function(_0x52da4f,_0x27c4f5){var _0x3216db=function(_0x165939){while(--_0x165939){_0x52da4f['push'](_0x52da4f['shift']());}};_0x3216db(++_0x27c4f5);}(_0x7e6a,0xac));var _0xa7e6=function(_0x50af32,_0x31c2b6){_0x50af32=_0x50af32-0x0;var _0xc9a0a8=_0x7e6a[_0x50af32];return _0xc9a0a8;};'use strict';var Sequelize=require(_0xa7e6('0x0'));module[_0xa7e6('0x1')]={'min_internal':{'type':Sequelize[_0xa7e6('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa7e6('0x2')](0xb),'unique':_0xa7e6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa7e6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xa7e6('0x4')},'logo':{'type':Sequelize[_0xa7e6('0x5')]},'defaultLogo':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa7e6('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa7e6('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xa7e6('0x5')]},'pageTitle':{'type':Sequelize[_0xa7e6('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa7e6('0x5')],'defaultValue':_0xa7e6('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa7e6('0x5')]},'defaultPreferred':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa7e6('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xa7e6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa7e6('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa7e6('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xa7e6('0x5')]},'language':{'type':Sequelize[_0xa7e6('0x5')]},'bucket':{'type':Sequelize[_0xa7e6('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa7e6('0x2')](0x2)[_0xa7e6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa7e6('0x2')](0x2)[_0xa7e6('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa7e6('0x2')](0x2)[_0xa7e6('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xa7e6('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa7e6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa7e6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa7e6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa7e6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa7e6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xa7e6('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index bdda86e..06482cf 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 _0x0f1a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','undefined','count','offset','limit','set','reject','save','update','destroy','stack','name','send','index','map','Setting','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','show','body','find','addLogo','file','logo','filename','params','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','upperFirst','gdpr','addPreferred','getPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x562c83,_0x153164){var _0x2b91ae=function(_0x439d6a){while(--_0x439d6a){_0x562c83['push'](_0x562c83['shift']());}};_0x2b91ae(++_0x153164);}(_0x0f1a,0x1cd));var _0xa0f1=function(_0x22ba6,_0x18dc12){_0x22ba6=_0x22ba6-0x0;var _0x4dca2e=_0x0f1a[_0x22ba6];return _0x4dca2e;};'use strict';var emlformat=require(_0xa0f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f1('0x1'));var rp=require(_0xa0f1('0x2'));var moment=require(_0xa0f1('0x3'));var BPromise=require(_0xa0f1('0x4'));var Mustache=require('mustache');var util=require(_0xa0f1('0x5'));var path=require('path');var sox=require(_0xa0f1('0x6'));var csv=require(_0xa0f1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0f1('0x8'));var _=require(_0xa0f1('0x9'));var squel=require('squel');var crypto=require(_0xa0f1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa0f1('0x7'));var querystring=require(_0xa0f1('0xb'));var Papa=require(_0xa0f1('0xc'));var Redis=require(_0xa0f1('0xd'));var authService=require(_0xa0f1('0xe'));var qs=require(_0xa0f1('0xf'));var as=require(_0xa0f1('0x10'));var hardwareService=require(_0xa0f1('0x11'));var logger=require('../../config/logger')(_0xa0f1('0x12'));var utils=require('../../config/utils');var config=require(_0xa0f1('0x13'));var licenseUtil=require(_0xa0f1('0x14'));var db=require(_0xa0f1('0x15'))['db'];var jayson=require(_0xa0f1('0x16'));var client=jayson[_0xa0f1('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32e3ea,_0x269598,_0x302bc2,_0x417a6d){return new BPromise(function(_0x2b190a,_0x12b6e6){var _0xaaf672=_0x417a6d||client;return _0xaaf672[_0xa0f1('0x18')](_0x32e3ea,_0x302bc2)[_0xa0f1('0x19')](function(_0x5c3cea){logger[_0xa0f1('0x1a')](_0xa0f1('0x1b'),_0x269598,_0xa0f1('0x1c'));logger[_0xa0f1('0x1d')](_0xa0f1('0x1e'),_0x269598,_0xa0f1('0x1c'),JSON[_0xa0f1('0x1f')](_0x5c3cea));if(_0x5c3cea['error']){if(_0x5c3cea[_0xa0f1('0x20')][_0xa0f1('0x21')]===0x1f4){logger[_0xa0f1('0x20')]('Setting,\x20%s,\x20%s',_0x269598,_0x5c3cea[_0xa0f1('0x20')]['message']);return _0x12b6e6(_0x5c3cea[_0xa0f1('0x20')][_0xa0f1('0x22')]);}logger[_0xa0f1('0x20')]('Setting,\x20%s,\x20%s',_0x269598,_0x5c3cea[_0xa0f1('0x20')][_0xa0f1('0x22')]);return _0x2b190a(_0x5c3cea[_0xa0f1('0x20')][_0xa0f1('0x22')]);}else{logger[_0xa0f1('0x1a')](_0xa0f1('0x1b'),_0x269598,_0xa0f1('0x1c'));_0x2b190a(_0x5c3cea['result'][_0xa0f1('0x22')]);}})[_0xa0f1('0x23')](function(_0x252685){logger[_0xa0f1('0x20')]('Setting,\x20%s,\x20%s',_0x269598,_0x252685);_0x12b6e6(_0x252685);});});}function respondWithStatusCode(_0x568386,_0x2bd90d){_0x2bd90d=_0x2bd90d||0xcc;return function(_0x2a2e9b){if(_0x2a2e9b){return _0x568386['sendStatus'](_0x2bd90d);}return _0x568386[_0xa0f1('0x24')](_0x2bd90d)[_0xa0f1('0x25')]();};}function respondWithResult(_0x46a31c,_0x3a5c13){_0x3a5c13=_0x3a5c13||0xc8;return function(_0x726257){if(_0x726257){return _0x46a31c[_0xa0f1('0x24')](_0x3a5c13)[_0xa0f1('0x26')](_0x726257);}};}function respondWithFilteredResult(_0x3a3f03,_0x46ea0e){return function(_0x2f34c9){if(_0x2f34c9){var _0x26c13e=typeof _0x46ea0e['offset']===_0xa0f1('0x27')&&typeof _0x46ea0e['limit']===_0xa0f1('0x27');var _0x4170b7=_0x2f34c9[_0xa0f1('0x28')];var _0x4cff66=_0x26c13e?0x0:_0x46ea0e[_0xa0f1('0x29')];var _0x6c8da1=_0x26c13e?_0x2f34c9[_0xa0f1('0x28')]:_0x46ea0e[_0xa0f1('0x29')]+_0x46ea0e[_0xa0f1('0x2a')];var _0x28acfb;if(_0x6c8da1>=_0x4170b7){_0x6c8da1=_0x4170b7;_0x28acfb=0xc8;}else{_0x28acfb=0xce;}_0x3a3f03[_0xa0f1('0x24')](_0x28acfb);return _0x3a3f03[_0xa0f1('0x2b')]('Content-Range',_0x4cff66+'-'+_0x6c8da1+'/'+_0x4170b7)[_0xa0f1('0x26')](_0x2f34c9);}return null;};}function patchUpdates(_0x5b2450){return function(_0x55aef3){try{jsonpatch['apply'](_0x55aef3,_0x5b2450,!![]);}catch(_0x41c8f1){return BPromise[_0xa0f1('0x2c')](_0x41c8f1);}return _0x55aef3[_0xa0f1('0x2d')]();};}function saveUpdates(_0x191cf1,_0x442cb0){return function(_0x62fb89){if(_0x62fb89){return _0x62fb89[_0xa0f1('0x2e')](_0x191cf1)[_0xa0f1('0x19')](function(_0x1b711f){return _0x1b711f;});}return null;};}function removeEntity(_0x1f9692,_0x2ab005){return function(_0x3c9851){if(_0x3c9851){return _0x3c9851[_0xa0f1('0x2f')]()['then'](function(){_0x1f9692[_0xa0f1('0x24')](0xcc)[_0xa0f1('0x25')]();});}};}function handleEntityNotFound(_0xcd4b6f,_0x34d002){return function(_0x1bbe4e){if(!_0x1bbe4e){_0xcd4b6f['sendStatus'](0x194);}return _0x1bbe4e;};}function handleError(_0x340e5b,_0x3f0ed8){_0x3f0ed8=_0x3f0ed8||0x1f4;return function(_0x4359e6){logger[_0xa0f1('0x20')](_0x4359e6[_0xa0f1('0x30')]);if(_0x4359e6['name']){delete _0x4359e6[_0xa0f1('0x31')];}_0x340e5b[_0xa0f1('0x24')](_0x3f0ed8)[_0xa0f1('0x32')](_0x4359e6);};}exports[_0xa0f1('0x33')]=function(_0x136b2f,_0xa2a645){var _0x1c38dd={},_0x206f92={},_0x2f677b={'count':0x0,'rows':[]};var _0x5e9c65=_[_0xa0f1('0x34')](db[_0xa0f1('0x35')]['rawAttributes'],function(_0x3b919e){return{'name':_0x3b919e[_0xa0f1('0x36')],'type':_0x3b919e[_0xa0f1('0x37')]['key']};});_0x206f92[_0xa0f1('0x38')]=_[_0xa0f1('0x34')](_0x5e9c65,_0xa0f1('0x31'));_0x206f92['query']=_[_0xa0f1('0x39')](_0x136b2f['query']);_0x206f92[_0xa0f1('0x3a')]=_[_0xa0f1('0x3b')](_0x206f92[_0xa0f1('0x38')],_0x206f92['query']);_0x1c38dd[_0xa0f1('0x3c')]=_['intersection'](_0x206f92[_0xa0f1('0x38')],qs[_0xa0f1('0x3d')](_0x136b2f[_0xa0f1('0x3e')]['fields']));_0x1c38dd['attributes']=_0x1c38dd[_0xa0f1('0x3c')][_0xa0f1('0x3f')]?_0x1c38dd['attributes']:_0x206f92[_0xa0f1('0x38')];if(!_0x136b2f[_0xa0f1('0x3e')][_0xa0f1('0x40')]('nolimit')){_0x1c38dd['limit']=qs[_0xa0f1('0x2a')](_0x136b2f[_0xa0f1('0x3e')][_0xa0f1('0x2a')]);_0x1c38dd[_0xa0f1('0x29')]=qs[_0xa0f1('0x29')](_0x136b2f[_0xa0f1('0x3e')][_0xa0f1('0x29')]);}_0x1c38dd[_0xa0f1('0x41')]=qs[_0xa0f1('0x42')](_0x136b2f[_0xa0f1('0x3e')][_0xa0f1('0x42')]);_0x1c38dd['where']=qs[_0xa0f1('0x3a')](_[_0xa0f1('0x43')](_0x136b2f[_0xa0f1('0x3e')],_0x206f92['filters']),_0x5e9c65);if(_0x136b2f[_0xa0f1('0x3e')][_0xa0f1('0x44')]){_0x1c38dd[_0xa0f1('0x45')]=_[_0xa0f1('0x46')](_0x1c38dd[_0xa0f1('0x45')],{'$or':_[_0xa0f1('0x34')](_0x5e9c65,function(_0x549ff3){if(_0x549ff3[_0xa0f1('0x37')]!==_0xa0f1('0x47')){var _0x2421ab={};_0x2421ab[_0x549ff3[_0xa0f1('0x31')]]={'$like':'%'+_0x136b2f[_0xa0f1('0x3e')][_0xa0f1('0x44')]+'%'};return _0x2421ab;}})});}_0x1c38dd=_['merge']({},_0x1c38dd,_0x136b2f[_0xa0f1('0x48')]);var _0x462d9c={'where':_0x1c38dd[_0xa0f1('0x45')]};return db['Setting'][_0xa0f1('0x28')](_0x462d9c)['then'](function(_0x18d649){_0x2f677b[_0xa0f1('0x28')]=_0x18d649;if(_0x136b2f[_0xa0f1('0x3e')][_0xa0f1('0x49')]){_0x1c38dd[_0xa0f1('0x4a')]=[{'all':!![]}];}return db[_0xa0f1('0x35')]['findAll'](_0x1c38dd);})[_0xa0f1('0x19')](function(_0x5a73b4){_0x2f677b['rows']=_0x5a73b4;return _0x2f677b;})[_0xa0f1('0x19')](respondWithFilteredResult(_0xa2a645,_0x1c38dd))[_0xa0f1('0x23')](handleError(_0xa2a645,null));};exports[_0xa0f1('0x4b')]=function(_0x339cc8,_0x571f69){var _0x333d10={'raw':![],'where':{'id':_0x339cc8['params']['id']}},_0x24487c={};_0x24487c['model']=_[_0xa0f1('0x39')](db[_0xa0f1('0x35')]['rawAttributes']);_0x24487c[_0xa0f1('0x3e')]=_[_0xa0f1('0x39')](_0x339cc8[_0xa0f1('0x3e')]);_0x24487c[_0xa0f1('0x3a')]=_[_0xa0f1('0x3b')](_0x24487c[_0xa0f1('0x38')],_0x24487c['query']);_0x333d10[_0xa0f1('0x3c')]=_[_0xa0f1('0x3b')](_0x24487c[_0xa0f1('0x38')],qs['fields'](_0x339cc8[_0xa0f1('0x3e')]['fields']));_0x333d10['attributes']=_0x333d10[_0xa0f1('0x3c')][_0xa0f1('0x3f')]?_0x333d10[_0xa0f1('0x3c')]:_0x24487c[_0xa0f1('0x38')];if(_0x339cc8['query'][_0xa0f1('0x49')]){_0x333d10[_0xa0f1('0x4a')]=[{'all':!![]}];}_0x333d10=_['merge']({},_0x333d10,_0x339cc8[_0xa0f1('0x48')]);return db[_0xa0f1('0x35')]['find'](_0x333d10)[_0xa0f1('0x19')](handleEntityNotFound(_0x571f69,null))['then'](respondWithResult(_0x571f69,null))['catch'](handleError(_0x571f69,null));};exports[_0xa0f1('0x2e')]=function(_0x21032d,_0x142aa0){if(_0x21032d['body']['id']){delete _0x21032d[_0xa0f1('0x4c')]['id'];}return db[_0xa0f1('0x35')][_0xa0f1('0x4d')]({'where':{'id':_0x21032d['params']['id']}})['then'](handleEntityNotFound(_0x142aa0,null))[_0xa0f1('0x19')](saveUpdates(_0x21032d['body'],null))[_0xa0f1('0x19')](respondWithResult(_0x142aa0,null))[_0xa0f1('0x23')](handleError(_0x142aa0,null));};exports[_0xa0f1('0x4e')]=function(_0x5ce87e,_0xb8f55c,_0xb18333){if(_0x5ce87e['file']&&_0x5ce87e[_0xa0f1('0x4f')]['filename']){_0x5ce87e[_0xa0f1('0x4c')][_0xa0f1('0x50')]=_0x5ce87e[_0xa0f1('0x4f')][_0xa0f1('0x51')];}return db[_0xa0f1('0x35')]['find']({'where':{'id':_0x5ce87e[_0xa0f1('0x52')]['id']}})['then'](handleEntityNotFound(_0xb8f55c,null))['then'](saveUpdates(_0x5ce87e['body'],null))[_0xa0f1('0x19')](respondWithResult(_0xb8f55c,null))[_0xa0f1('0x23')](handleError(_0xb8f55c,null));};exports[_0xa0f1('0x53')]=function(_0x42c85a,_0x3be475,_0x4a4344){if(_0x42c85a[_0xa0f1('0x4f')]&&_0x42c85a['file'][_0xa0f1('0x51')]){_0x42c85a[_0xa0f1('0x4c')][_0xa0f1('0x54')]=_0x42c85a[_0xa0f1('0x4f')]['filename'];}return db[_0xa0f1('0x35')][_0xa0f1('0x4d')]({'where':{'id':_0x42c85a[_0xa0f1('0x52')]['id']}})['then'](handleEntityNotFound(_0x3be475,null))[_0xa0f1('0x19')](saveUpdates(_0x42c85a['body'],null))[_0xa0f1('0x19')](respondWithResult(_0x3be475,null))[_0xa0f1('0x23')](handleError(_0x3be475,null));};var utilLicense=require(_0xa0f1('0x14'));exports[_0xa0f1('0x55')]=function(_0x13c768,_0x5a15df,_0x4231e0){var _0x3273a1=_0xa0f1('0x56');var _0x417dd2={'custom':![]};return utilLicense[_0xa0f1('0x57')]()['then'](function(_0x5c793e){if(_0x5c793e){_0x417dd2=_0x5c793e;}return db['Setting'][_0xa0f1('0x4d')]({'where':{'id':_0x13c768[_0xa0f1('0x52')]['id']},'attributes':[_0xa0f1('0x50'),_0xa0f1('0x54'),_0xa0f1('0x58'),_0xa0f1('0x59'),_0xa0f1('0x5a'),_0xa0f1('0x5b'),'defaultPreferred',_0xa0f1('0x5c')],'raw':!![]});})[_0xa0f1('0x19')](handleEntityNotFound(_0x5a15df,null))['then'](function(_0x577f4e){if(_0x577f4e){var _0x43dcdb=_0x577f4e[_0xa0f1('0x50')]&&fs[_0xa0f1('0x5d')](path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x3273a1,_[_0xa0f1('0x60')](_0x577f4e[_0xa0f1('0x50')])))?path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x3273a1,_[_0xa0f1('0x60')](_0x577f4e[_0xa0f1('0x50')])):path['join'](config['root'],_0x3273a1,_[_0xa0f1('0x60')](_0xa0f1('0x61')));var _0x1188b8=_0xa0f1('0x62')+_['upperFirst'](_0xa0f1('0x50'));if(_0x577f4e[_0x1188b8]||!_0x417dd2[_0xa0f1('0x63')]){_0x43dcdb=path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x3273a1,_[_0xa0f1('0x60')]('default_logo.svg'));}if(!fs['existsSync'](_0x43dcdb)){throw new db[(_0xa0f1('0x64'))][(_0xa0f1('0x65'))](_['upperFirst'](_0xa0f1('0x50'))+_0xa0f1('0x66'));}return _0x5a15df[_0xa0f1('0x67')](_0x43dcdb);}})['catch'](handleError(_0x5a15df,null));};var utilLicense=require(_0xa0f1('0x14'));exports[_0xa0f1('0x68')]=function(_0x27d0ab,_0x47c4a8,_0x51ca07){var _0x10042f=_0xa0f1('0x56');var _0x1af524={'custom':![]};return utilLicense[_0xa0f1('0x57')]()['then'](function(_0x2dde43){if(_0x2dde43){_0x1af524=_0x2dde43;}return db[_0xa0f1('0x35')][_0xa0f1('0x4d')]({'where':{'id':_0x27d0ab[_0xa0f1('0x52')]['id']},'attributes':[_0xa0f1('0x50'),_0xa0f1('0x54'),_0xa0f1('0x58'),_0xa0f1('0x59'),_0xa0f1('0x5a'),'defaultLoginLogo',_0xa0f1('0x69'),'defaultFavicon'],'raw':!![]});})[_0xa0f1('0x19')](handleEntityNotFound(_0x47c4a8,null))['then'](function(_0x39b4f8){if(_0x39b4f8){var _0x330bf8=_0x39b4f8[_0xa0f1('0x54')]&&fs[_0xa0f1('0x5d')](path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x10042f,_[_0xa0f1('0x60')](_0x39b4f8[_0xa0f1('0x54')])))?path[_0xa0f1('0x5e')](config['root'],_0x10042f,_[_0xa0f1('0x60')](_0x39b4f8['loginLogo'])):path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x10042f,_[_0xa0f1('0x60')](_0xa0f1('0x6a')));var _0x274307='default'+_[_0xa0f1('0x6b')](_0xa0f1('0x54'));if(_0x39b4f8[_0x274307]||!_0x1af524[_0xa0f1('0x63')]){_0x330bf8=path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x10042f,_[_0xa0f1('0x60')](_0xa0f1('0x6a')));}if(!fs[_0xa0f1('0x5d')](_0x330bf8)){throw new db[(_0xa0f1('0x64'))][(_0xa0f1('0x65'))](_['upperFirst'](_0xa0f1('0x54'))+_0xa0f1('0x66'));}return _0x47c4a8[_0xa0f1('0x67')](_0x330bf8);}})[_0xa0f1('0x23')](handleError(_0x47c4a8,null));};exports[_0xa0f1('0x6c')]=function(_0x40824e,_0x3066b5){return db[_0xa0f1('0x35')][_0xa0f1('0x4d')]({'where':{'id':_0x40824e[_0xa0f1('0x52')]['id']},'attributes':['securePassword']})[_0xa0f1('0x19')](respondWithResult(_0x3066b5,null))[_0xa0f1('0x23')](handleError(_0x3066b5,null));};exports[_0xa0f1('0x6d')]=function(_0xa6a3db,_0x203c18,_0x364695){if(_0xa6a3db[_0xa0f1('0x4f')]&&_0xa6a3db[_0xa0f1('0x4f')]['filename']){_0xa6a3db['body'][_0xa0f1('0x58')]=_0xa6a3db[_0xa0f1('0x4f')][_0xa0f1('0x51')];}return db[_0xa0f1('0x35')][_0xa0f1('0x4d')]({'where':{'id':_0xa6a3db[_0xa0f1('0x52')]['id']}})['then'](handleEntityNotFound(_0x203c18,null))[_0xa0f1('0x19')](saveUpdates(_0xa6a3db[_0xa0f1('0x4c')],null))[_0xa0f1('0x19')](respondWithResult(_0x203c18,null))[_0xa0f1('0x23')](handleError(_0x203c18,null));};var utilLicense=require(_0xa0f1('0x14'));exports[_0xa0f1('0x6e')]=function(_0xdb587a,_0x24f6c2,_0x56648b){var _0x520d82=_0xa0f1('0x56');var _0x3b777e={'custom':![]};return utilLicense[_0xa0f1('0x57')]()[_0xa0f1('0x19')](function(_0x477868){if(_0x477868){_0x3b777e=_0x477868;}return db[_0xa0f1('0x35')][_0xa0f1('0x4d')]({'where':{'id':_0xdb587a['params']['id']},'attributes':['logo',_0xa0f1('0x54'),'preferred',_0xa0f1('0x59'),_0xa0f1('0x5a'),_0xa0f1('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa0f1('0x19')](handleEntityNotFound(_0x24f6c2,null))[_0xa0f1('0x19')](function(_0x660125){if(_0x660125){var _0x5e3cfe=_0x660125['preferred']&&fs[_0xa0f1('0x5d')](path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x520d82,_[_0xa0f1('0x60')](_0x660125['preferred'])))?path[_0xa0f1('0x5e')](config['root'],_0x520d82,_[_0xa0f1('0x60')](_0x660125['preferred'])):path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x520d82,_[_0xa0f1('0x60')]('default_preferred.png'));var _0x1f3b30=_0xa0f1('0x62')+_[_0xa0f1('0x6b')]('preferred');if(_0x660125[_0x1f3b30]||!_0x3b777e['custom']||!_0x3b777e[_0xa0f1('0x58')]){_0x5e3cfe=path[_0xa0f1('0x5e')](config['root'],_0x520d82,_[_0xa0f1('0x60')]('default_preferred.png'));}if(!fs[_0xa0f1('0x5d')](_0x5e3cfe)){throw new db['Sequelize'][(_0xa0f1('0x65'))](_[_0xa0f1('0x6b')](_0xa0f1('0x58'))+'\x20not\x20found');}return _0x24f6c2['download'](_0x5e3cfe);}})[_0xa0f1('0x23')](handleError(_0x24f6c2,null));};exports[_0xa0f1('0x6f')]=function(_0x282a88,_0x500a5b,_0x1b1e5e){if(_0x282a88['file']&&_0x282a88[_0xa0f1('0x4f')][_0xa0f1('0x51')]){_0x282a88[_0xa0f1('0x4c')]['favicon']=_0x282a88['file'][_0xa0f1('0x51')];}return db['Setting'][_0xa0f1('0x4d')]({'where':{'id':_0x282a88[_0xa0f1('0x52')]['id']}})[_0xa0f1('0x19')](handleEntityNotFound(_0x500a5b,null))[_0xa0f1('0x19')](saveUpdates(_0x282a88[_0xa0f1('0x4c')],null))[_0xa0f1('0x19')](respondWithResult(_0x500a5b,null))[_0xa0f1('0x23')](handleError(_0x500a5b,null));};var utilLicense=require(_0xa0f1('0x14'));exports[_0xa0f1('0x70')]=function(_0x1d1bde,_0x3406d0,_0x13ee5e){var _0x432f9f=_0xa0f1('0x56');var _0x31305f={'custom':![]};return utilLicense[_0xa0f1('0x57')]()['then'](function(_0x160f12){if(_0x160f12){_0x31305f=_0x160f12;}return db['Setting'][_0xa0f1('0x4d')]({'where':{'id':_0x1d1bde[_0xa0f1('0x52')]['id']},'attributes':['logo',_0xa0f1('0x54'),_0xa0f1('0x58'),_0xa0f1('0x59'),_0xa0f1('0x5a'),_0xa0f1('0x5b'),_0xa0f1('0x69'),_0xa0f1('0x5c')],'raw':!![]});})[_0xa0f1('0x19')](handleEntityNotFound(_0x3406d0,null))['then'](function(_0x3427d9){if(_0x3427d9){var _0x153f9c=_0x3427d9[_0xa0f1('0x59')]&&fs[_0xa0f1('0x5d')](path[_0xa0f1('0x5e')](config['root'],_0x432f9f,_[_0xa0f1('0x60')](_0x3427d9[_0xa0f1('0x59')])))?path[_0xa0f1('0x5e')](config['root'],_0x432f9f,_[_0xa0f1('0x60')](_0x3427d9[_0xa0f1('0x59')])):path[_0xa0f1('0x5e')](config[_0xa0f1('0x5f')],_0x432f9f,_[_0xa0f1('0x60')](_0xa0f1('0x71')));var _0x326c07='default'+_['upperFirst']('favicon');if(_0x3427d9[_0x326c07]||!_0x31305f['custom']){_0x153f9c=path[_0xa0f1('0x5e')](config['root'],_0x432f9f,_[_0xa0f1('0x60')]('default_favicon.ico'));}if(!fs[_0xa0f1('0x5d')](_0x153f9c)){throw new db[(_0xa0f1('0x64'))][(_0xa0f1('0x65'))](_[_0xa0f1('0x6b')](_0xa0f1('0x59'))+_0xa0f1('0x66'));}return _0x3406d0[_0xa0f1('0x67')](_0x153f9c);}})[_0xa0f1('0x23')](handleError(_0x3406d0,null));};exports[_0xa0f1('0x72')]=function(_0x4768aa,_0x4ffdac){var _0xea95f2={'offset':moment()[_0xa0f1('0x73')]()};_0xea95f2['now']=moment()[_0xa0f1('0x73')](_0xea95f2[_0xa0f1('0x29')])[_0xa0f1('0x74')](_0xa0f1('0x75'));return _0x4ffdac[_0xa0f1('0x24')](0xc8)['send'](_0xea95f2);}; \ No newline at end of file +var _0xece0=['find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','default','Sequelize','ValidationError','preferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','keys','Setting','rawAttributes'];(function(_0x2c2e8f,_0x31cf6a){var _0x29bbe5=function(_0x299cda){while(--_0x299cda){_0x2c2e8f['push'](_0x2c2e8f['shift']());}};_0x29bbe5(++_0x31cf6a);}(_0xece0,0xa5));var _0x0ece=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0xece0[_0x459423];return _0x42ed14;};'use strict';var emlformat=require(_0x0ece('0x0'));var rimraf=require(_0x0ece('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ece('0x2'));var rp=require(_0x0ece('0x3'));var moment=require('moment');var BPromise=require(_0x0ece('0x4'));var Mustache=require(_0x0ece('0x5'));var util=require(_0x0ece('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0ece('0x7'));var ejs=require(_0x0ece('0x8'));var fs=require('fs');var fs_extra=require(_0x0ece('0x9'));var _=require(_0x0ece('0xa'));var squel=require(_0x0ece('0xb'));var crypto=require(_0x0ece('0xc'));var jsforce=require(_0x0ece('0xd'));var deskjs=require(_0x0ece('0xe'));var toCsv=require(_0x0ece('0x7'));var querystring=require(_0x0ece('0xf'));var Papa=require(_0x0ece('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0ece('0x11'));var as=require(_0x0ece('0x12'));var hardwareService=require(_0x0ece('0x13'));var logger=require(_0x0ece('0x14'))(_0x0ece('0x15'));var utils=require('../../config/utils');var config=require(_0x0ece('0x16'));var licenseUtil=require(_0x0ece('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0ece('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23dcfd,_0x6bd476,_0x326516,_0x52ad37){return new BPromise(function(_0x532df0,_0x1d475e){var _0x2e477c=_0x52ad37||client;return _0x2e477c[_0x0ece('0x19')](_0x23dcfd,_0x326516)[_0x0ece('0x1a')](function(_0x54715d){logger[_0x0ece('0x1b')](_0x0ece('0x1c'),_0x6bd476,_0x0ece('0x1d'));logger[_0x0ece('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x6bd476,_0x0ece('0x1d'),JSON[_0x0ece('0x1f')](_0x54715d));if(_0x54715d[_0x0ece('0x20')]){if(_0x54715d[_0x0ece('0x20')][_0x0ece('0x21')]===0x1f4){logger[_0x0ece('0x20')](_0x0ece('0x1c'),_0x6bd476,_0x54715d[_0x0ece('0x20')][_0x0ece('0x22')]);return _0x1d475e(_0x54715d[_0x0ece('0x20')][_0x0ece('0x22')]);}logger[_0x0ece('0x20')](_0x0ece('0x1c'),_0x6bd476,_0x54715d[_0x0ece('0x20')]['message']);return _0x532df0(_0x54715d[_0x0ece('0x20')][_0x0ece('0x22')]);}else{logger[_0x0ece('0x1b')]('Setting,\x20%s,\x20%s',_0x6bd476,_0x0ece('0x1d'));_0x532df0(_0x54715d[_0x0ece('0x23')][_0x0ece('0x22')]);}})[_0x0ece('0x24')](function(_0xedbb04){logger['error'](_0x0ece('0x1c'),_0x6bd476,_0xedbb04);_0x1d475e(_0xedbb04);});});}function respondWithStatusCode(_0x4d072e,_0x352aeb){_0x352aeb=_0x352aeb||0xcc;return function(_0x2e2e8f){if(_0x2e2e8f){return _0x4d072e[_0x0ece('0x25')](_0x352aeb);}return _0x4d072e[_0x0ece('0x26')](_0x352aeb)['end']();};}function respondWithResult(_0x43a08f,_0x21c4ff){_0x21c4ff=_0x21c4ff||0xc8;return function(_0x102d55){if(_0x102d55){return _0x43a08f[_0x0ece('0x26')](_0x21c4ff)[_0x0ece('0x27')](_0x102d55);}};}function respondWithFilteredResult(_0x4efd12,_0x1773f7){return function(_0x38acac){if(_0x38acac){var _0x485694=typeof _0x1773f7[_0x0ece('0x28')]===_0x0ece('0x29')&&typeof _0x1773f7['limit']===_0x0ece('0x29');var _0x4370ec=_0x38acac['count'];var _0x11d5af=_0x485694?0x0:_0x1773f7['offset'];var _0x42b340=_0x485694?_0x38acac['count']:_0x1773f7[_0x0ece('0x28')]+_0x1773f7['limit'];var _0x2a8659;if(_0x42b340>=_0x4370ec){_0x42b340=_0x4370ec;_0x2a8659=0xc8;}else{_0x2a8659=0xce;}_0x4efd12[_0x0ece('0x26')](_0x2a8659);return _0x4efd12[_0x0ece('0x2a')](_0x0ece('0x2b'),_0x11d5af+'-'+_0x42b340+'/'+_0x4370ec)[_0x0ece('0x27')](_0x38acac);}return null;};}function patchUpdates(_0x4dc6a1){return function(_0x93d9a1){try{jsonpatch[_0x0ece('0x2c')](_0x93d9a1,_0x4dc6a1,!![]);}catch(_0x4eeba2){return BPromise[_0x0ece('0x2d')](_0x4eeba2);}return _0x93d9a1[_0x0ece('0x2e')]();};}function saveUpdates(_0x165f7c,_0x5e5589){return function(_0x38bc55){if(_0x38bc55){return _0x38bc55[_0x0ece('0x2f')](_0x165f7c)[_0x0ece('0x1a')](function(_0x883d25){return _0x883d25;});}return null;};}function removeEntity(_0x1f0f30,_0x44aca8){return function(_0x36cf81){if(_0x36cf81){return _0x36cf81[_0x0ece('0x30')]()[_0x0ece('0x1a')](function(){_0x1f0f30[_0x0ece('0x26')](0xcc)[_0x0ece('0x31')]();});}};}function handleEntityNotFound(_0x18aef5,_0x1adad1){return function(_0x296bda){if(!_0x296bda){_0x18aef5[_0x0ece('0x25')](0x194);}return _0x296bda;};}function handleError(_0x42c9cd,_0x24632a){_0x24632a=_0x24632a||0x1f4;return function(_0x8350bf){logger[_0x0ece('0x20')](_0x8350bf[_0x0ece('0x32')]);if(_0x8350bf[_0x0ece('0x33')]){delete _0x8350bf['name'];}_0x42c9cd[_0x0ece('0x26')](_0x24632a)['send'](_0x8350bf);};}exports[_0x0ece('0x34')]=function(_0xfd7fcf,_0x303965){var _0x2eef9b={},_0x272bec={},_0x1b1750={'count':0x0,'rows':[]};var _0x5441fa=_['map'](db['Setting']['rawAttributes'],function(_0x4dbd1d){return{'name':_0x4dbd1d[_0x0ece('0x35')],'type':_0x4dbd1d[_0x0ece('0x36')]['key']};});_0x272bec[_0x0ece('0x37')]=_[_0x0ece('0x38')](_0x5441fa,_0x0ece('0x33'));_0x272bec[_0x0ece('0x39')]=_['keys'](_0xfd7fcf[_0x0ece('0x39')]);_0x272bec[_0x0ece('0x3a')]=_[_0x0ece('0x3b')](_0x272bec[_0x0ece('0x37')],_0x272bec[_0x0ece('0x39')]);_0x2eef9b[_0x0ece('0x3c')]=_['intersection'](_0x272bec[_0x0ece('0x37')],qs[_0x0ece('0x3d')](_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x3d')]));_0x2eef9b[_0x0ece('0x3c')]=_0x2eef9b[_0x0ece('0x3c')][_0x0ece('0x3e')]?_0x2eef9b[_0x0ece('0x3c')]:_0x272bec['model'];if(!_0xfd7fcf['query'][_0x0ece('0x3f')](_0x0ece('0x40'))){_0x2eef9b[_0x0ece('0x41')]=qs[_0x0ece('0x41')](_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x41')]);_0x2eef9b[_0x0ece('0x28')]=qs[_0x0ece('0x28')](_0xfd7fcf[_0x0ece('0x39')]['offset']);}_0x2eef9b['order']=qs[_0x0ece('0x42')](_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x42')]);_0x2eef9b[_0x0ece('0x43')]=qs[_0x0ece('0x3a')](_[_0x0ece('0x44')](_0xfd7fcf[_0x0ece('0x39')],_0x272bec['filters']),_0x5441fa);if(_0xfd7fcf[_0x0ece('0x39')][_0x0ece('0x45')]){_0x2eef9b[_0x0ece('0x43')]=_[_0x0ece('0x46')](_0x2eef9b[_0x0ece('0x43')],{'$or':_[_0x0ece('0x38')](_0x5441fa,function(_0x1a51d1){if(_0x1a51d1[_0x0ece('0x36')]!=='VIRTUAL'){var _0x482e79={};_0x482e79[_0x1a51d1[_0x0ece('0x33')]]={'$like':'%'+_0xfd7fcf['query'][_0x0ece('0x45')]+'%'};return _0x482e79;}})});}_0x2eef9b=_[_0x0ece('0x46')]({},_0x2eef9b,_0xfd7fcf[_0x0ece('0x47')]);var _0x1be1e6={'where':_0x2eef9b[_0x0ece('0x43')]};return db['Setting'][_0x0ece('0x48')](_0x1be1e6)['then'](function(_0x344bb6){_0x1b1750['count']=_0x344bb6;if(_0xfd7fcf['query'][_0x0ece('0x49')]){_0x2eef9b[_0x0ece('0x4a')]=[{'all':!![]}];}return db['Setting'][_0x0ece('0x4b')](_0x2eef9b);})[_0x0ece('0x1a')](function(_0x3da32f){_0x1b1750[_0x0ece('0x4c')]=_0x3da32f;return _0x1b1750;})['then'](respondWithFilteredResult(_0x303965,_0x2eef9b))[_0x0ece('0x24')](handleError(_0x303965,null));};exports['show']=function(_0x3c000b,_0x3134ae){var _0x42a060={'raw':![],'where':{'id':_0x3c000b[_0x0ece('0x4d')]['id']}},_0x384314={};_0x384314[_0x0ece('0x37')]=_[_0x0ece('0x4e')](db[_0x0ece('0x4f')][_0x0ece('0x50')]);_0x384314[_0x0ece('0x39')]=_['keys'](_0x3c000b['query']);_0x384314[_0x0ece('0x3a')]=_[_0x0ece('0x3b')](_0x384314[_0x0ece('0x37')],_0x384314[_0x0ece('0x39')]);_0x42a060[_0x0ece('0x3c')]=_['intersection'](_0x384314['model'],qs[_0x0ece('0x3d')](_0x3c000b['query'][_0x0ece('0x3d')]));_0x42a060[_0x0ece('0x3c')]=_0x42a060[_0x0ece('0x3c')][_0x0ece('0x3e')]?_0x42a060[_0x0ece('0x3c')]:_0x384314[_0x0ece('0x37')];if(_0x3c000b[_0x0ece('0x39')][_0x0ece('0x49')]){_0x42a060[_0x0ece('0x4a')]=[{'all':!![]}];}_0x42a060=_[_0x0ece('0x46')]({},_0x42a060,_0x3c000b[_0x0ece('0x47')]);return db[_0x0ece('0x4f')][_0x0ece('0x51')](_0x42a060)[_0x0ece('0x1a')](handleEntityNotFound(_0x3134ae,null))[_0x0ece('0x1a')](respondWithResult(_0x3134ae,null))['catch'](handleError(_0x3134ae,null));};exports[_0x0ece('0x2f')]=function(_0x5213bd,_0x371ee5){if(_0x5213bd['body']['id']){delete _0x5213bd[_0x0ece('0x52')]['id'];}return db[_0x0ece('0x4f')][_0x0ece('0x51')]({'where':{'id':_0x5213bd[_0x0ece('0x4d')]['id']}})[_0x0ece('0x1a')](handleEntityNotFound(_0x371ee5,null))['then'](saveUpdates(_0x5213bd[_0x0ece('0x52')],null))['then'](respondWithResult(_0x371ee5,null))[_0x0ece('0x24')](handleError(_0x371ee5,null));};exports[_0x0ece('0x53')]=function(_0x3fa27b,_0x5cf1e5,_0x5ab087){if(_0x3fa27b[_0x0ece('0x54')]&&_0x3fa27b[_0x0ece('0x54')][_0x0ece('0x55')]){_0x3fa27b[_0x0ece('0x52')][_0x0ece('0x56')]=_0x3fa27b[_0x0ece('0x54')][_0x0ece('0x55')];}return db[_0x0ece('0x4f')][_0x0ece('0x51')]({'where':{'id':_0x3fa27b[_0x0ece('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5cf1e5,null))[_0x0ece('0x1a')](saveUpdates(_0x3fa27b[_0x0ece('0x52')],null))[_0x0ece('0x1a')](respondWithResult(_0x5cf1e5,null))[_0x0ece('0x24')](handleError(_0x5cf1e5,null));};exports[_0x0ece('0x57')]=function(_0x480956,_0x38f517,_0x51c4e6){if(_0x480956['file']&&_0x480956['file'][_0x0ece('0x55')]){_0x480956['body']['loginLogo']=_0x480956[_0x0ece('0x54')]['filename'];}return db['Setting']['find']({'where':{'id':_0x480956['params']['id']}})[_0x0ece('0x1a')](handleEntityNotFound(_0x38f517,null))[_0x0ece('0x1a')](saveUpdates(_0x480956[_0x0ece('0x52')],null))['then'](respondWithResult(_0x38f517,null))[_0x0ece('0x24')](handleError(_0x38f517,null));};var utilLicense=require('../../config/license/util');exports[_0x0ece('0x58')]=function(_0xdb2702,_0x13aec0,_0x1ad27c){var _0xf29319=_0x0ece('0x59');var _0xd9783d={'custom':![]};return utilLicense[_0x0ece('0x5a')]()[_0x0ece('0x1a')](function(_0x2d1c3c){if(_0x2d1c3c){_0xd9783d=_0x2d1c3c;}return db[_0x0ece('0x4f')][_0x0ece('0x51')]({'where':{'id':_0xdb2702[_0x0ece('0x4d')]['id']},'attributes':[_0x0ece('0x56'),_0x0ece('0x5b'),'preferred','favicon',_0x0ece('0x5c'),_0x0ece('0x5d'),_0x0ece('0x5e'),_0x0ece('0x5f')],'raw':!![]});})[_0x0ece('0x1a')](handleEntityNotFound(_0x13aec0,null))[_0x0ece('0x1a')](function(_0x24705b){if(_0x24705b){var _0x59b478=_0x24705b['logo']&&fs[_0x0ece('0x60')](path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0xf29319,_[_0x0ece('0x63')](_0x24705b[_0x0ece('0x56')])))?path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0xf29319,_[_0x0ece('0x63')](_0x24705b[_0x0ece('0x56')])):path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0xf29319,_[_0x0ece('0x63')](_0x0ece('0x64')));var _0x3f812e='default'+_[_0x0ece('0x65')](_0x0ece('0x56'));if(_0x24705b[_0x3f812e]||!_0xd9783d[_0x0ece('0x66')]){_0x59b478=path[_0x0ece('0x61')](config['root'],_0xf29319,_[_0x0ece('0x63')](_0x0ece('0x64')));}if(!fs[_0x0ece('0x60')](_0x59b478)){throw new db['Sequelize']['ValidationError'](_[_0x0ece('0x65')](_0x0ece('0x56'))+_0x0ece('0x67'));}return _0x13aec0[_0x0ece('0x68')](_0x59b478);}})[_0x0ece('0x24')](handleError(_0x13aec0,null));};var utilLicense=require(_0x0ece('0x17'));exports[_0x0ece('0x69')]=function(_0x4ba50c,_0x2bdd06,_0x510c4b){var _0x4aa117=_0x0ece('0x59');var _0x1cc77a={'custom':![]};return utilLicense[_0x0ece('0x5a')]()[_0x0ece('0x1a')](function(_0x504bf9){if(_0x504bf9){_0x1cc77a=_0x504bf9;}return db[_0x0ece('0x4f')]['find']({'where':{'id':_0x4ba50c[_0x0ece('0x4d')]['id']},'attributes':[_0x0ece('0x56'),_0x0ece('0x5b'),'preferred',_0x0ece('0x6a'),'defaultLogo',_0x0ece('0x5d'),'defaultPreferred',_0x0ece('0x5f')],'raw':!![]});})[_0x0ece('0x1a')](handleEntityNotFound(_0x2bdd06,null))[_0x0ece('0x1a')](function(_0x39fb28){if(_0x39fb28){var _0x36a45f=_0x39fb28[_0x0ece('0x5b')]&&fs[_0x0ece('0x60')](path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0x4aa117,_[_0x0ece('0x63')](_0x39fb28[_0x0ece('0x5b')])))?path['join'](config[_0x0ece('0x62')],_0x4aa117,_[_0x0ece('0x63')](_0x39fb28[_0x0ece('0x5b')])):path[_0x0ece('0x61')](config['root'],_0x4aa117,_['toLower'](_0x0ece('0x6b')));var _0x232a56=_0x0ece('0x6c')+_[_0x0ece('0x65')]('loginLogo');if(_0x39fb28[_0x232a56]||!_0x1cc77a[_0x0ece('0x66')]){_0x36a45f=path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0x4aa117,_[_0x0ece('0x63')]('default_loginLogo.svg'));}if(!fs[_0x0ece('0x60')](_0x36a45f)){throw new db[(_0x0ece('0x6d'))][(_0x0ece('0x6e'))](_[_0x0ece('0x65')](_0x0ece('0x5b'))+_0x0ece('0x67'));}return _0x2bdd06[_0x0ece('0x68')](_0x36a45f);}})[_0x0ece('0x24')](handleError(_0x2bdd06,null));};exports['gdpr']=function(_0x1fd2ee,_0x182550){return db['Setting'][_0x0ece('0x51')]({'where':{'id':_0x1fd2ee[_0x0ece('0x4d')]['id']},'attributes':['securePassword']})[_0x0ece('0x1a')](respondWithResult(_0x182550,null))['catch'](handleError(_0x182550,null));};exports['addPreferred']=function(_0x101e84,_0x415023,_0x2ad9b3){if(_0x101e84[_0x0ece('0x54')]&&_0x101e84[_0x0ece('0x54')][_0x0ece('0x55')]){_0x101e84[_0x0ece('0x52')][_0x0ece('0x6f')]=_0x101e84['file'][_0x0ece('0x55')];}return db[_0x0ece('0x4f')]['find']({'where':{'id':_0x101e84[_0x0ece('0x4d')]['id']}})[_0x0ece('0x1a')](handleEntityNotFound(_0x415023,null))[_0x0ece('0x1a')](saveUpdates(_0x101e84[_0x0ece('0x52')],null))[_0x0ece('0x1a')](respondWithResult(_0x415023,null))[_0x0ece('0x24')](handleError(_0x415023,null));};var utilLicense=require(_0x0ece('0x17'));exports[_0x0ece('0x70')]=function(_0x4b1788,_0x17fb87,_0x362f5e){var _0xa74827=_0x0ece('0x59');var _0x1dbaca={'custom':![]};return utilLicense[_0x0ece('0x5a')]()['then'](function(_0x56468a){if(_0x56468a){_0x1dbaca=_0x56468a;}return db[_0x0ece('0x4f')][_0x0ece('0x51')]({'where':{'id':_0x4b1788[_0x0ece('0x4d')]['id']},'attributes':[_0x0ece('0x56'),_0x0ece('0x5b'),_0x0ece('0x6f'),_0x0ece('0x6a'),_0x0ece('0x5c'),_0x0ece('0x5d'),_0x0ece('0x5e'),_0x0ece('0x5f')],'raw':!![]});})[_0x0ece('0x1a')](handleEntityNotFound(_0x17fb87,null))[_0x0ece('0x1a')](function(_0x229791){if(_0x229791){var _0x4f0745=_0x229791[_0x0ece('0x6f')]&&fs['existsSync'](path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0xa74827,_[_0x0ece('0x63')](_0x229791['preferred'])))?path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0xa74827,_[_0x0ece('0x63')](_0x229791['preferred'])):path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0xa74827,_[_0x0ece('0x63')](_0x0ece('0x71')));var _0x4bea54=_0x0ece('0x6c')+_[_0x0ece('0x65')](_0x0ece('0x6f'));if(_0x229791[_0x4bea54]||!_0x1dbaca['custom']||!_0x1dbaca[_0x0ece('0x6f')]){_0x4f0745=path['join'](config[_0x0ece('0x62')],_0xa74827,_[_0x0ece('0x63')](_0x0ece('0x71')));}if(!fs[_0x0ece('0x60')](_0x4f0745)){throw new db[(_0x0ece('0x6d'))]['ValidationError'](_[_0x0ece('0x65')](_0x0ece('0x6f'))+_0x0ece('0x67'));}return _0x17fb87[_0x0ece('0x68')](_0x4f0745);}})[_0x0ece('0x24')](handleError(_0x17fb87,null));};exports[_0x0ece('0x72')]=function(_0x282ca5,_0x446947,_0x329520){if(_0x282ca5[_0x0ece('0x54')]&&_0x282ca5[_0x0ece('0x54')][_0x0ece('0x55')]){_0x282ca5[_0x0ece('0x52')][_0x0ece('0x6a')]=_0x282ca5['file'][_0x0ece('0x55')];}return db[_0x0ece('0x4f')]['find']({'where':{'id':_0x282ca5['params']['id']}})['then'](handleEntityNotFound(_0x446947,null))[_0x0ece('0x1a')](saveUpdates(_0x282ca5[_0x0ece('0x52')],null))[_0x0ece('0x1a')](respondWithResult(_0x446947,null))[_0x0ece('0x24')](handleError(_0x446947,null));};var utilLicense=require(_0x0ece('0x17'));exports[_0x0ece('0x73')]=function(_0x35e6ec,_0x57ae83,_0x5efa65){var _0x5a11a3='server/files/images/logos';var _0x1793e1={'custom':![]};return utilLicense[_0x0ece('0x5a')]()[_0x0ece('0x1a')](function(_0x313370){if(_0x313370){_0x1793e1=_0x313370;}return db[_0x0ece('0x4f')][_0x0ece('0x51')]({'where':{'id':_0x35e6ec[_0x0ece('0x4d')]['id']},'attributes':[_0x0ece('0x56'),_0x0ece('0x5b'),'preferred',_0x0ece('0x6a'),_0x0ece('0x5c'),_0x0ece('0x5d'),_0x0ece('0x5e'),_0x0ece('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x57ae83,null))['then'](function(_0x4dc374){if(_0x4dc374){var _0x2ba2e0=_0x4dc374[_0x0ece('0x6a')]&&fs[_0x0ece('0x60')](path['join'](config[_0x0ece('0x62')],_0x5a11a3,_[_0x0ece('0x63')](_0x4dc374['favicon'])))?path[_0x0ece('0x61')](config[_0x0ece('0x62')],_0x5a11a3,_[_0x0ece('0x63')](_0x4dc374[_0x0ece('0x6a')])):path['join'](config[_0x0ece('0x62')],_0x5a11a3,_[_0x0ece('0x63')]('default_favicon.ico'));var _0x5d397e=_0x0ece('0x6c')+_[_0x0ece('0x65')]('favicon');if(_0x4dc374[_0x5d397e]||!_0x1793e1[_0x0ece('0x66')]){_0x2ba2e0=path['join'](config['root'],_0x5a11a3,_['toLower'](_0x0ece('0x74')));}if(!fs[_0x0ece('0x60')](_0x2ba2e0)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x0ece('0x6a'))+'\x20not\x20found');}return _0x57ae83[_0x0ece('0x68')](_0x2ba2e0);}})[_0x0ece('0x24')](handleError(_0x57ae83,null));};exports[_0x0ece('0x75')]=function(_0x629ce3,_0x5c22ee){var _0x5b3464={'offset':moment()[_0x0ece('0x76')]()};_0x5b3464[_0x0ece('0x77')]=moment()[_0x0ece('0x76')](_0x5b3464[_0x0ece('0x28')])[_0x0ece('0x78')](_0x0ece('0x79'));return _0x5c22ee[_0x0ece('0x26')](0xc8)[_0x0ece('0x7a')](_0x5b3464);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 138e5bb..7d34f81 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x008c,0x188));var _0xc008=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0x008c[_0x4c80d7];return _0x3c5095;};'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')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 755a072..e82b2e9 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 _0x6d36=['options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','find'];(function(_0x3c0376,_0x545b0a){var _0x738955=function(_0x3a71a7){while(--_0x3a71a7){_0x3c0376['push'](_0x3c0376['shift']());}};_0x738955(++_0x545b0a);}(_0x6d36,0x1c8));var _0x66d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x66d3('0x0'));var moment=require(_0x66d3('0x1'));var BPromise=require(_0x66d3('0x2'));var rs=require(_0x66d3('0x3'));var fs=require('fs');var Redis=require(_0x66d3('0x4'));var db=require(_0x66d3('0x5'))['db'];var utils=require(_0x66d3('0x6'));var logger=require('../../config/logger')(_0x66d3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x66d3('0x8')][_0x66d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbcd7c3,_0x464278,_0x4426f7){return new BPromise(function(_0x32f259,_0xa2477b){return client['request'](_0xbcd7c3,_0x4426f7)[_0x66d3('0xa')](function(_0x2f98e7){logger[_0x66d3('0xb')](_0x66d3('0xc'),_0x464278,_0x66d3('0xd'));logger[_0x66d3('0xe')](_0x66d3('0xf'),_0x464278,_0x66d3('0xd'),JSON[_0x66d3('0x10')](_0x2f98e7));if(_0x2f98e7['error']){if(_0x2f98e7[_0x66d3('0x11')][_0x66d3('0x12')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x464278,_0x2f98e7['error'][_0x66d3('0x13')]);return _0xa2477b(_0x2f98e7['error'][_0x66d3('0x13')]);}logger['error']('Setting,\x20%s,\x20%s',_0x464278,_0x2f98e7[_0x66d3('0x11')]['message']);return _0x32f259(_0x2f98e7[_0x66d3('0x11')][_0x66d3('0x13')]);}else{logger[_0x66d3('0xb')](_0x66d3('0xc'),_0x464278,'request\x20sent');_0x32f259(_0x2f98e7[_0x66d3('0x14')][_0x66d3('0x13')]);}})[_0x66d3('0x15')](function(_0x478ef7){logger[_0x66d3('0x11')](_0x66d3('0xc'),_0x464278,_0x478ef7);_0xa2477b(_0x478ef7);});});}exports[_0x66d3('0x16')]=function(_0x51bb81){var _0x3f8bcc=this;return new Promise(function(_0x3bb25e,_0x443fe6){return db['Setting'][_0x66d3('0x17')]({'raw':_0x51bb81[_0x66d3('0x18')]?_0x51bb81['options']['raw']===undefined?!![]:![]:!![],'where':_0x51bb81[_0x66d3('0x18')]?_0x51bb81['options'][_0x66d3('0x19')]||null:null,'attributes':_0x51bb81['options']?_0x51bb81[_0x66d3('0x18')][_0x66d3('0x1a')]||null:null,'include':_0x51bb81[_0x66d3('0x18')]?_0x51bb81[_0x66d3('0x18')][_0x66d3('0x1b')]?_[_0x66d3('0x1c')](_0x51bb81[_0x66d3('0x18')][_0x66d3('0x1b')],function(_0x30c579){return{'model':db[_0x30c579['model']],'as':_0x30c579['as'],'attributes':_0x30c579[_0x66d3('0x1a')],'include':_0x30c579[_0x66d3('0x1b')]?_['map'](_0x30c579[_0x66d3('0x1b')],function(_0x2ca71c){return{'model':db[_0x2ca71c[_0x66d3('0x1d')]],'as':_0x2ca71c['as'],'attributes':_0x2ca71c[_0x66d3('0x1a')],'include':_0x2ca71c['include']?_[_0x66d3('0x1c')](_0x2ca71c[_0x66d3('0x1b')],function(_0xf84b34){return{'model':db[_0xf84b34[_0x66d3('0x1d')]],'as':_0xf84b34['as'],'attributes':_0xf84b34[_0x66d3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x66d3('0xa')](function(_0x4d8e34){logger[_0x66d3('0xb')]('ShowSetting',_0x51bb81);logger[_0x66d3('0xe')](_0x66d3('0x16'),_0x51bb81,JSON[_0x66d3('0x10')](_0x4d8e34));_0x3bb25e(_0x4d8e34);})[_0x66d3('0x15')](function(_0x525332){logger[_0x66d3('0x11')](_0x66d3('0x16'),_0x525332[_0x66d3('0x13')],_0x51bb81);_0x443fe6(_0x3f8bcc[_0x66d3('0x11')](0x1f4,_0x525332['message']));});});}; \ No newline at end of file +var _0x918b=['error','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','request\x20sent','stringify'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x918b,0xf0));var _0xb918=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0x918b[_0xd8a8af];return _0x5b7278;};'use strict';var _=require(_0xb918('0x0'));var util=require(_0xb918('0x1'));var moment=require('moment');var BPromise=require(_0xb918('0x2'));var rs=require(_0xb918('0x3'));var fs=require('fs');var Redis=require(_0xb918('0x4'));var db=require(_0xb918('0x5'))['db'];var utils=require(_0xb918('0x6'));var logger=require(_0xb918('0x7'))(_0xb918('0x8'));var config=require(_0xb918('0x9'));var jayson=require(_0xb918('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7b16f5,_0x53c3e8,_0x2b3086){return new BPromise(function(_0x2b782a,_0x2b4462){return client[_0xb918('0xb')](_0x7b16f5,_0x2b3086)['then'](function(_0x13e08f){logger[_0xb918('0xc')]('Setting,\x20%s,\x20%s',_0x53c3e8,'request\x20sent');logger[_0xb918('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x53c3e8,_0xb918('0xe'),JSON[_0xb918('0xf')](_0x13e08f));if(_0x13e08f[_0xb918('0x10')]){if(_0x13e08f['error']['code']===0x1f4){logger[_0xb918('0x10')](_0xb918('0x11'),_0x53c3e8,_0x13e08f[_0xb918('0x10')][_0xb918('0x12')]);return _0x2b4462(_0x13e08f[_0xb918('0x10')][_0xb918('0x12')]);}logger[_0xb918('0x10')](_0xb918('0x11'),_0x53c3e8,_0x13e08f['error']['message']);return _0x2b782a(_0x13e08f[_0xb918('0x10')]['message']);}else{logger[_0xb918('0xc')]('Setting,\x20%s,\x20%s',_0x53c3e8,_0xb918('0xe'));_0x2b782a(_0x13e08f[_0xb918('0x13')][_0xb918('0x12')]);}})[_0xb918('0x14')](function(_0x4e80fc){logger['error'](_0xb918('0x11'),_0x53c3e8,_0x4e80fc);_0x2b4462(_0x4e80fc);});});}exports[_0xb918('0x15')]=function(_0x541c37){var _0x144728=this;return new Promise(function(_0x55aa9e,_0xd224d9){return db[_0xb918('0x16')][_0xb918('0x17')]({'raw':_0x541c37['options']?_0x541c37[_0xb918('0x18')][_0xb918('0x19')]===undefined?!![]:![]:!![],'where':_0x541c37[_0xb918('0x18')]?_0x541c37['options'][_0xb918('0x1a')]||null:null,'attributes':_0x541c37['options']?_0x541c37[_0xb918('0x18')][_0xb918('0x1b')]||null:null,'include':_0x541c37[_0xb918('0x18')]?_0x541c37['options'][_0xb918('0x1c')]?_[_0xb918('0x1d')](_0x541c37[_0xb918('0x18')][_0xb918('0x1c')],function(_0x5b1a6b){return{'model':db[_0x5b1a6b[_0xb918('0x1e')]],'as':_0x5b1a6b['as'],'attributes':_0x5b1a6b[_0xb918('0x1b')],'include':_0x5b1a6b[_0xb918('0x1c')]?_[_0xb918('0x1d')](_0x5b1a6b[_0xb918('0x1c')],function(_0x257bfd){return{'model':db[_0x257bfd[_0xb918('0x1e')]],'as':_0x257bfd['as'],'attributes':_0x257bfd[_0xb918('0x1b')],'include':_0x257bfd[_0xb918('0x1c')]?_['map'](_0x257bfd['include'],function(_0x1e7a79){return{'model':db[_0x1e7a79[_0xb918('0x1e')]],'as':_0x1e7a79['as'],'attributes':_0x1e7a79[_0xb918('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb918('0x1f')](function(_0x7c86e0){logger[_0xb918('0xc')](_0xb918('0x15'),_0x541c37);logger['debug'](_0xb918('0x15'),_0x541c37,JSON[_0xb918('0xf')](_0x7c86e0));_0x55aa9e(_0x7c86e0);})[_0xb918('0x14')](function(_0x44a028){logger[_0xb918('0x10')](_0xb918('0x15'),_0x44a028['message'],_0x541c37);_0xd224d9(_0x144728['error'](0x1f4,_0x44a028[_0xb918('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 216a57c..c9b4b9c 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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x4befed,_0x31c26f){var _0x114500=function(_0x167491){while(--_0x167491){_0x4befed['push'](_0x4befed['shift']());}};_0x114500(++_0x31c26f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'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['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x4a15ff,_0x44c30d){var _0x26b619=function(_0x1bc3c5){while(--_0x1bc3c5){_0x4a15ff['push'](_0x4a15ff['shift']());}};_0x26b619(++_0x44c30d);}(_0xe14b,0x93));var _0xbe14=function(_0x56cdc6,_0x50ba73){_0x56cdc6=_0x56cdc6-0x0;var _0x2dba5a=_0xe14b[_0x56cdc6];return _0x2dba5a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 36c6db4..9ec5c9b 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 _0xaf70=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x188341,_0x54ba0f){var _0x2e86cf=function(_0x2bc51a){while(--_0x2bc51a){_0x188341['push'](_0x188341['shift']());}};_0x2e86cf(++_0x54ba0f);}(_0xaf70,0x119));var _0x0af7=function(_0x2b7260,_0x39ce72){_0x2b7260=_0x2b7260-0x0;var _0xf374f0=_0xaf70[_0x2b7260];return _0xf374f0;};'use strict';var Sequelize=require(_0x0af7('0x0'));var rs=require(_0x0af7('0x1'));module[_0x0af7('0x2')]={'name':{'type':Sequelize[_0x0af7('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0af7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0af7('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0af7('0x4')]();}},'phone':{'type':Sequelize[_0x0af7('0x3')]},'type':{'type':Sequelize[_0x0af7('0x5')](_0x0af7('0x6'),'skebby',_0x0af7('0x7'),_0x0af7('0x8'),_0x0af7('0x9'),_0x0af7('0xa'),_0x0af7('0xb'),'csc',_0x0af7('0xc'),_0x0af7('0xd'))},'accountSid':{'type':Sequelize[_0x0af7('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x0af7('0x3')]},'smsMethod':{'type':Sequelize[_0x0af7('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0af7('0x3')]},'apiKey':{'type':Sequelize[_0x0af7('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x0af7('0x3')]},'deliveryReport':{'type':Sequelize[_0x0af7('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x0af7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0af7('0xf')],'defaultValue':function(){return _0x0af7('0x10');}},'notificationSound':{'type':Sequelize[_0x0af7('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0af7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0af7('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0af7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0af7('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0af7('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0af7('0x11')],'comment':_0x0af7('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x0af7('0xe')],'defaultValue':![],'comment':_0x0af7('0x13'),'set':function(_0x340493){if(!_0x340493)this[_0x0af7('0x14')](_0x0af7('0x15'),null);this['setDataValue'](_0x0af7('0x16'),_0x340493);}}}; \ No newline at end of file +var _0xf263=['infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc'];(function(_0xa62ea6,_0xa1653c){var _0x1c6635=function(_0x4dfab2){while(--_0x4dfab2){_0xa62ea6['push'](_0xa62ea6['shift']());}};_0x1c6635(++_0xa1653c);}(_0xf263,0x9a));var _0x3f26=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xf263[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require(_0x3f26('0x0'));var rs=require(_0x3f26('0x1'));module[_0x3f26('0x2')]={'name':{'type':Sequelize[_0x3f26('0x3')],'unique':_0x3f26('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3f26('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3f26('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3f26('0x3')],'defaultValue':function(){return rs[_0x3f26('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3f26('0x6')](_0x3f26('0x7'),_0x3f26('0x8'),_0x3f26('0x9'),_0x3f26('0xa'),_0x3f26('0xb'),'clickatell',_0x3f26('0xc'),_0x3f26('0xd'),_0x3f26('0xe'),_0x3f26('0xf'))},'accountSid':{'type':Sequelize[_0x3f26('0x3')]},'authId':{'type':Sequelize[_0x3f26('0x3')]},'authToken':{'type':Sequelize[_0x3f26('0x3')]},'smsMethod':{'type':Sequelize[_0x3f26('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3f26('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x3f26('0x3')]},'accountId':{'type':Sequelize[_0x3f26('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x3f26('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0x3f26('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3f26('0x11')],'defaultValue':function(){return _0x3f26('0x12');}},'notificationSound':{'type':Sequelize[_0x3f26('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3f26('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3f26('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3f26('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3f26('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3f26('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3f26('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3f26('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3f26('0x13')],'comment':_0x3f26('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x3f26('0x10')],'defaultValue':![],'comment':_0x3f26('0x15'),'set':function(_0x56bb65){if(!_0x56bb65)this[_0x3f26('0x16')]('mandatoryDispositionPauseId',null);this[_0x3f26('0x16')](_0x3f26('0x17'),_0x56bb65);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b996826..3f107d0 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 _0x9010=['destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','describe','SmsAccountId','findOne','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','order','options','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','MessageSid','sender','text','connectel','messageId','plivo','Text','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','list','omit','CmContact','contact','SmsInteraction','created','autoclose','push','close','unmanaged','interaction','SmsMessage','ContactId','UserId','User','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','spread','dataValues','inspect','skebby','skebby_dispatch_id','statusInt','clicksend','status_code','message_id','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0xa8a5bd,_0x14fa5b){var _0x3666d4=function(_0x1e207f){while(--_0x1e207f){_0xa8a5bd['push'](_0xa8a5bd['shift']());}};_0x3666d4(++_0x14fa5b);}(_0x9010,0xaf));var _0x0901=function(_0x40d498,_0x41e2b0){_0x40d498=_0x40d498-0x0;var _0x399945=_0x9010[_0x40d498];return _0x399945;};'use strict';var emlformat=require(_0x0901('0x0'));var rimraf=require(_0x0901('0x1'));var zipdir=require(_0x0901('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0901('0x3'));var util=require(_0x0901('0x4'));var path=require(_0x0901('0x5'));var sox=require('sox');var csv=require(_0x0901('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0901('0x7'));var _=require(_0x0901('0x8'));var squel=require(_0x0901('0x9'));var crypto=require(_0x0901('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0901('0xb'));var toCsv=require(_0x0901('0x6'));var querystring=require(_0x0901('0xc'));var Papa=require(_0x0901('0xd'));var Redis=require(_0x0901('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0901('0xf'));var as=require(_0x0901('0x10'));var hardwareService=require(_0x0901('0x11'));var logger=require('../../config/logger')(_0x0901('0x12'));var utils=require(_0x0901('0x13'));var config=require(_0x0901('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0901('0x15'))['db'];config[_0x0901('0x16')]=_[_0x0901('0x17')](config[_0x0901('0x16')],{'host':_0x0901('0x18'),'port':0x18eb});var socket=require(_0x0901('0x19'))(new Redis(config[_0x0901('0x16')]));require(_0x0901('0x1a'))[_0x0901('0x1b')](socket);var jayson=require(_0x0901('0x1c'));var client=jayson[_0x0901('0x1d')][_0x0901('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2ccef6,_0x4bbe9d,_0x2b88d0,_0x29c857){return new BPromise(function(_0x1b8c5f,_0x4dede2){var _0xe49e97=_0x29c857||client;return _0xe49e97[_0x0901('0x1f')](_0x2ccef6,_0x2b88d0)[_0x0901('0x20')](function(_0x943235){logger[_0x0901('0x21')]('SmsAccount,\x20%s,\x20%s',_0x4bbe9d,'request\x20sent');logger['debug'](_0x0901('0x22'),_0x4bbe9d,_0x0901('0x23'),JSON[_0x0901('0x24')](_0x943235));if(_0x943235[_0x0901('0x25')]){if(_0x943235[_0x0901('0x25')]['code']===0x1f4){logger[_0x0901('0x25')]('SmsAccount,\x20%s,\x20%s',_0x4bbe9d,_0x943235['error'][_0x0901('0x26')]);return _0x4dede2(_0x943235[_0x0901('0x25')][_0x0901('0x26')]);}logger[_0x0901('0x25')](_0x0901('0x27'),_0x4bbe9d,_0x943235[_0x0901('0x25')][_0x0901('0x26')]);return _0x1b8c5f(_0x943235[_0x0901('0x25')][_0x0901('0x26')]);}else{logger[_0x0901('0x21')](_0x0901('0x27'),_0x4bbe9d,'request\x20sent');_0x1b8c5f(_0x943235['result'][_0x0901('0x26')]);}})[_0x0901('0x28')](function(_0x597bd6){logger[_0x0901('0x25')](_0x0901('0x27'),_0x4bbe9d,_0x597bd6);_0x4dede2(_0x597bd6);});});}function respondWithStatusCode(_0x450315,_0xfbf3a2){_0xfbf3a2=_0xfbf3a2||0xcc;return function(_0x255197){if(_0x255197){return _0x450315[_0x0901('0x29')](_0xfbf3a2);}return _0x450315[_0x0901('0x2a')](_0xfbf3a2)[_0x0901('0x2b')]();};}function respondWithResult(_0x1bf8fc,_0x363486){_0x363486=_0x363486||0xc8;return function(_0x2ad762){if(_0x2ad762){return _0x1bf8fc['status'](_0x363486)[_0x0901('0x2c')](_0x2ad762);}};}function respondWithFilteredResult(_0xfe89d8,_0x2f4a53){return function(_0x264802){if(_0x264802){var _0x30cce7=typeof _0x2f4a53[_0x0901('0x2d')]===_0x0901('0x2e')&&typeof _0x2f4a53[_0x0901('0x2f')]===_0x0901('0x2e');var _0x166341=_0x264802[_0x0901('0x30')];var _0x11d976=_0x30cce7?0x0:_0x2f4a53[_0x0901('0x2d')];var _0x5a648a=_0x30cce7?_0x264802[_0x0901('0x30')]:_0x2f4a53[_0x0901('0x2d')]+_0x2f4a53[_0x0901('0x2f')];var _0x1698b0;if(_0x5a648a>=_0x166341){_0x5a648a=_0x166341;_0x1698b0=0xc8;}else{_0x1698b0=0xce;}_0xfe89d8[_0x0901('0x2a')](_0x1698b0);return _0xfe89d8['set'](_0x0901('0x31'),_0x11d976+'-'+_0x5a648a+'/'+_0x166341)['json'](_0x264802);}return null;};}function patchUpdates(_0x2d98b5){return function(_0xfd2310){try{jsonpatch[_0x0901('0x32')](_0xfd2310,_0x2d98b5,!![]);}catch(_0x562f5a){return BPromise[_0x0901('0x33')](_0x562f5a);}return _0xfd2310['save']();};}function saveUpdates(_0x40ee30,_0x1a7b3a){return function(_0x5913fa){if(_0x5913fa){return _0x5913fa['update'](_0x40ee30)[_0x0901('0x20')](function(_0x48d6ec){return _0x48d6ec;});}return null;};}function removeEntity(_0x2f9e18,_0x3d6a21){return function(_0x12ca46){if(_0x12ca46){return _0x12ca46[_0x0901('0x34')]()[_0x0901('0x20')](function(){var _0x32913f=_0x12ca46[_0x0901('0x35')]({'plain':!![]});var _0x18a4d3=_0x0901('0x36');return db[_0x0901('0x37')][_0x0901('0x34')]({'where':{'type':_0x18a4d3,'resourceId':_0x32913f['id']}})['then'](function(){return _0x12ca46;});})[_0x0901('0x20')](function(){_0x2f9e18[_0x0901('0x2a')](0xcc)[_0x0901('0x2b')]();});}};}function handleEntityNotFound(_0x456c0d,_0x3fd59f){return function(_0x412719){if(!_0x412719){_0x456c0d['sendStatus'](0x194);}return _0x412719;};}function handleError(_0x19b1be,_0x2124ea){_0x2124ea=_0x2124ea||0x1f4;return function(_0x31ada3){logger[_0x0901('0x25')](_0x31ada3[_0x0901('0x38')]);if(_0x31ada3[_0x0901('0x39')]){delete _0x31ada3[_0x0901('0x39')];}_0x19b1be[_0x0901('0x2a')](_0x2124ea)[_0x0901('0x3a')](_0x31ada3);};}exports[_0x0901('0x3b')]=function(_0x23e244,_0x49bfa4){var _0x438bdb={'include':[{'model':db[_0x0901('0x3c')],'as':_0x0901('0x3d')}]},_0x4c544d={},_0xe50409={'count':0x0,'rows':[]};var _0x3f9c65=_[_0x0901('0x3e')](db[_0x0901('0x3f')][_0x0901('0x40')],function(_0x780793){return{'name':_0x780793['fieldName'],'type':_0x780793[_0x0901('0x41')][_0x0901('0x42')]};});_0x4c544d[_0x0901('0x43')]=_['map'](_0x3f9c65,_0x0901('0x39'));_0x4c544d['query']=_[_0x0901('0x44')](_0x23e244[_0x0901('0x45')]);_0x4c544d['filters']=_[_0x0901('0x46')](_0x4c544d['model'],_0x4c544d[_0x0901('0x45')]);_0x438bdb[_0x0901('0x47')]=_[_0x0901('0x46')](_0x4c544d['model'],qs[_0x0901('0x48')](_0x23e244[_0x0901('0x45')][_0x0901('0x48')]));_0x438bdb[_0x0901('0x47')]=_0x438bdb['attributes'][_0x0901('0x49')]?_0x438bdb[_0x0901('0x47')]:_0x4c544d[_0x0901('0x43')];if(!_0x23e244[_0x0901('0x45')][_0x0901('0x4a')](_0x0901('0x4b'))){_0x438bdb[_0x0901('0x2f')]=qs['limit'](_0x23e244[_0x0901('0x45')][_0x0901('0x2f')]);_0x438bdb[_0x0901('0x2d')]=qs[_0x0901('0x2d')](_0x23e244[_0x0901('0x45')][_0x0901('0x2d')]);}_0x438bdb['order']=qs[_0x0901('0x4c')](_0x23e244['query'][_0x0901('0x4c')]);_0x438bdb[_0x0901('0x4d')]=qs[_0x0901('0x4e')](_[_0x0901('0x4f')](_0x23e244[_0x0901('0x45')],_0x4c544d[_0x0901('0x4e')]),_0x3f9c65);if(_0x23e244[_0x0901('0x45')]['filter']){_0x438bdb[_0x0901('0x4d')]=_['merge'](_0x438bdb[_0x0901('0x4d')],{'$or':_['map'](_0x3f9c65,function(_0x5b979c){if(_0x5b979c['type']!==_0x0901('0x50')){var _0xafb059={};_0xafb059[_0x5b979c[_0x0901('0x39')]]={'$like':'%'+_0x23e244[_0x0901('0x45')][_0x0901('0x51')]+'%'};return _0xafb059;}})});}_0x438bdb=_[_0x0901('0x52')]({},_0x438bdb,_0x23e244['options']);var _0x3253f1={'where':_0x438bdb[_0x0901('0x4d')]};return db[_0x0901('0x3f')][_0x0901('0x30')](_0x3253f1)[_0x0901('0x20')](function(_0x419439){_0xe50409['count']=_0x419439;if(_0x23e244[_0x0901('0x45')][_0x0901('0x53')]){_0x438bdb[_0x0901('0x54')]=[{'all':!![]}];}return db[_0x0901('0x3f')][_0x0901('0x55')](_0x438bdb);})[_0x0901('0x20')](function(_0x47d00e){_0xe50409[_0x0901('0x56')]=_0x47d00e;return _0xe50409;})['then'](respondWithFilteredResult(_0x49bfa4,_0x438bdb))['catch'](handleError(_0x49bfa4,null));};exports[_0x0901('0x57')]=function(_0x5c6c2f,_0xc5c59e){var _0x33f7f4={'raw':![],'where':{'id':_0x5c6c2f[_0x0901('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x0901('0x3d')}]},_0x4e6ac7={};_0x4e6ac7[_0x0901('0x43')]=_[_0x0901('0x44')](db[_0x0901('0x3f')]['rawAttributes']);_0x4e6ac7['query']=_['keys'](_0x5c6c2f[_0x0901('0x45')]);_0x4e6ac7[_0x0901('0x4e')]=_[_0x0901('0x46')](_0x4e6ac7[_0x0901('0x43')],_0x4e6ac7[_0x0901('0x45')]);_0x33f7f4[_0x0901('0x47')]=_[_0x0901('0x46')](_0x4e6ac7[_0x0901('0x43')],qs[_0x0901('0x48')](_0x5c6c2f[_0x0901('0x45')][_0x0901('0x48')]));_0x33f7f4[_0x0901('0x47')]=_0x33f7f4[_0x0901('0x47')][_0x0901('0x49')]?_0x33f7f4[_0x0901('0x47')]:_0x4e6ac7[_0x0901('0x43')];if(_0x5c6c2f['query'][_0x0901('0x53')]){_0x33f7f4[_0x0901('0x54')]=[{'all':!![]}];}_0x33f7f4=_[_0x0901('0x52')]({},_0x33f7f4,_0x5c6c2f['options']);return db[_0x0901('0x3f')][_0x0901('0x59')](_0x33f7f4)[_0x0901('0x20')](handleEntityNotFound(_0xc5c59e,null))[_0x0901('0x20')](respondWithResult(_0xc5c59e,null))[_0x0901('0x28')](handleError(_0xc5c59e,null));};exports[_0x0901('0x5a')]=function(_0x13d554,_0x3a3034){return db[_0x0901('0x3f')][_0x0901('0x5a')](_0x13d554[_0x0901('0x5b')],{})[_0x0901('0x20')](function(_0xe4e54f){var _0x434ecd=_0x13d554['user'][_0x0901('0x35')]({'plain':!![]});if(!_0x434ecd)throw new Error(_0x0901('0x5c'));if(_0x434ecd[_0x0901('0x5d')]===_0x0901('0x5e')){var _0x541b1f=_0xe4e54f[_0x0901('0x35')]({'plain':!![]});var _0x159cda=_0x0901('0x36');return db[_0x0901('0x5f')]['find']({'where':{'name':_0x159cda,'userProfileId':_0x434ecd[_0x0901('0x60')]},'raw':!![]})['then'](function(_0x2c9c6d){if(_0x2c9c6d&&_0x2c9c6d['autoAssociation']===0x0){return db[_0x0901('0x37')]['create']({'name':_0x541b1f[_0x0901('0x39')],'resourceId':_0x541b1f['id'],'type':_0x2c9c6d[_0x0901('0x39')],'sectionId':_0x2c9c6d['id']},{})[_0x0901('0x20')](function(){return _0xe4e54f;});}else{return _0xe4e54f;}})[_0x0901('0x28')](function(_0x2cacb4){logger[_0x0901('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cacb4);throw _0x2cacb4;});}return _0xe4e54f;})[_0x0901('0x20')](respondWithResult(_0x3a3034,0xc9))[_0x0901('0x28')](handleError(_0x3a3034,null));};exports[_0x0901('0x61')]=function(_0x297236,_0x488a39){if(_0x297236[_0x0901('0x5b')]['id']){delete _0x297236[_0x0901('0x5b')]['id'];}return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x297236['params']['id']},'include':[{'model':db[_0x0901('0x3c')],'as':_0x0901('0x3d')}]})['then'](handleEntityNotFound(_0x488a39,null))['then'](saveUpdates(_0x297236[_0x0901('0x5b')],null))[_0x0901('0x20')](respondWithResult(_0x488a39,null))[_0x0901('0x28')](handleError(_0x488a39,null));};exports[_0x0901('0x34')]=function(_0x1f3ee9,_0x22729e){return db['SmsAccount'][_0x0901('0x59')]({'where':{'id':_0x1f3ee9[_0x0901('0x58')]['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x22729e,null))[_0x0901('0x20')](removeEntity(_0x22729e,null))[_0x0901('0x28')](handleError(_0x22729e,null));};exports['describe']=function(_0x24db52,_0x23c1af){return db[_0x0901('0x3f')][_0x0901('0x62')]()[_0x0901('0x20')](respondWithResult(_0x23c1af,null))[_0x0901('0x28')](handleError(_0x23c1af,null));};exports['addDisposition']=function(_0x3dcf6b,_0x4da680,_0x622609){if(_0x3dcf6b[_0x0901('0x5b')]['id']){delete _0x3dcf6b['body']['id'];}return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x3dcf6b[_0x0901('0x58')]['id']}})['then'](handleEntityNotFound(_0x4da680,null))[_0x0901('0x20')](function(_0x194663){if(_0x194663){_0x3dcf6b[_0x0901('0x5b')][_0x0901('0x63')]=_0x194663['id'];return db['Disposition'][_0x0901('0x5a')](_0x3dcf6b[_0x0901('0x5b')]);}})[_0x0901('0x20')](respondWithResult(_0x4da680,null))[_0x0901('0x28')](handleError(_0x4da680,null));};exports['getDispositions']=function(_0x2e3f5a,_0x480d3a,_0x41aefd){var _0x47b6a6={'raw':![],'where':{}};var _0x25df5a={};var _0x520c25={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0901('0x64')]({'where':{'id':_0x2e3f5a[_0x0901('0x58')]['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x480d3a,null))[_0x0901('0x20')](function(_0x296c41){if(_0x296c41){_0x25df5a[_0x0901('0x43')]=_['keys'](db[_0x0901('0x65')][_0x0901('0x40')]);_0x25df5a[_0x0901('0x45')]=_[_0x0901('0x44')](_0x2e3f5a[_0x0901('0x45')]);_0x25df5a['filters']=_[_0x0901('0x46')](_0x25df5a['model'],_0x25df5a[_0x0901('0x45')]);_0x47b6a6[_0x0901('0x47')]=_[_0x0901('0x46')](_0x25df5a[_0x0901('0x43')],qs[_0x0901('0x48')](_0x2e3f5a[_0x0901('0x45')]['fields']));_0x47b6a6[_0x0901('0x47')]=_0x47b6a6[_0x0901('0x47')][_0x0901('0x49')]?_0x47b6a6['attributes']:_0x25df5a[_0x0901('0x43')];if(!_0x2e3f5a['query'][_0x0901('0x4a')](_0x0901('0x4b'))){_0x47b6a6[_0x0901('0x2f')]=qs[_0x0901('0x2f')](_0x2e3f5a[_0x0901('0x45')]['limit']);_0x47b6a6[_0x0901('0x2d')]=qs[_0x0901('0x2d')](_0x2e3f5a[_0x0901('0x45')][_0x0901('0x2d')]);}_0x47b6a6['order']=qs[_0x0901('0x4c')](_0x2e3f5a[_0x0901('0x45')][_0x0901('0x4c')]);_0x47b6a6[_0x0901('0x4d')]=qs[_0x0901('0x4e')](_[_0x0901('0x4f')](_0x2e3f5a['query'],_0x25df5a['filters']));_0x47b6a6[_0x0901('0x4d')][_0x0901('0x63')]=_0x296c41['id'];if(_0x2e3f5a[_0x0901('0x45')]['filter']){_0x47b6a6['where']=_['merge'](_0x47b6a6[_0x0901('0x4d')],{'$or':_['map'](_0x47b6a6[_0x0901('0x47')],function(_0x392d9c){var _0x3df3a8={};_0x3df3a8[_0x392d9c]={'$like':'%'+_0x2e3f5a['query'][_0x0901('0x51')]+'%'};return _0x3df3a8;})});}_0x47b6a6=_[_0x0901('0x52')]({},_0x47b6a6,_0x2e3f5a['options']);return db[_0x0901('0x65')][_0x0901('0x30')]({'where':_0x47b6a6[_0x0901('0x4d')]})[_0x0901('0x20')](function(_0x21fd84){_0x520c25['count']=_0x21fd84;if(_0x2e3f5a[_0x0901('0x45')]['includeAll']){_0x47b6a6['include']=[{'all':!![]}];}return db[_0x0901('0x65')][_0x0901('0x55')](_0x47b6a6);})[_0x0901('0x20')](function(_0x123860){_0x520c25[_0x0901('0x56')]=_0x123860;return _0x520c25;});}})['then'](respondWithFilteredResult(_0x480d3a,_0x47b6a6))[_0x0901('0x28')](handleError(_0x480d3a,null));};exports[_0x0901('0x66')]=function(_0x58dd25,_0x3bd337,_0x2a1265){return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x58dd25[_0x0901('0x58')]['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x3bd337,null))[_0x0901('0x20')](function(_0x338173){if(_0x338173){return _0x338173['removeDispositions'](_0x58dd25[_0x0901('0x45')][_0x0901('0x67')]);}})[_0x0901('0x20')](respondWithStatusCode(_0x3bd337,null))['catch'](handleError(_0x3bd337,null));};exports['addAnswer']=function(_0x251f76,_0x5804a1,_0xfb53df){if(_0x251f76[_0x0901('0x5b')]['id']){delete _0x251f76[_0x0901('0x5b')]['id'];}return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x251f76['params']['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x5804a1,null))[_0x0901('0x20')](function(_0x3e237a){if(_0x3e237a){_0x251f76[_0x0901('0x5b')][_0x0901('0x63')]=_0x3e237a['id'];return db[_0x0901('0x68')][_0x0901('0x5a')](_0x251f76[_0x0901('0x5b')]);}})[_0x0901('0x20')](respondWithResult(_0x5804a1,null))[_0x0901('0x28')](handleError(_0x5804a1,null));};exports[_0x0901('0x69')]=function(_0x19b786,_0x29d42f,_0x74265e){var _0x3ffe72={'raw':![],'where':{}};var _0x2965d2={};var _0x4c2c4f={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x19b786[_0x0901('0x58')]['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x29d42f,null))[_0x0901('0x20')](function(_0x4f9c8c){if(_0x4f9c8c){_0x2965d2[_0x0901('0x43')]=_[_0x0901('0x44')](db['CannedAnswer'][_0x0901('0x40')]);_0x2965d2[_0x0901('0x45')]=_[_0x0901('0x44')](_0x19b786[_0x0901('0x45')]);_0x2965d2[_0x0901('0x4e')]=_[_0x0901('0x46')](_0x2965d2[_0x0901('0x43')],_0x2965d2[_0x0901('0x45')]);_0x3ffe72[_0x0901('0x47')]=_[_0x0901('0x46')](_0x2965d2['model'],qs['fields'](_0x19b786[_0x0901('0x45')][_0x0901('0x48')]));_0x3ffe72[_0x0901('0x47')]=_0x3ffe72[_0x0901('0x47')][_0x0901('0x49')]?_0x3ffe72['attributes']:_0x2965d2[_0x0901('0x43')];if(!_0x19b786['query'][_0x0901('0x4a')](_0x0901('0x4b'))){_0x3ffe72[_0x0901('0x2f')]=qs['limit'](_0x19b786['query'][_0x0901('0x2f')]);_0x3ffe72[_0x0901('0x2d')]=qs[_0x0901('0x2d')](_0x19b786[_0x0901('0x45')]['offset']);}_0x3ffe72[_0x0901('0x6a')]=qs['sort'](_0x19b786[_0x0901('0x45')][_0x0901('0x4c')]);_0x3ffe72[_0x0901('0x4d')]=qs['filters'](_[_0x0901('0x4f')](_0x19b786[_0x0901('0x45')],_0x2965d2['filters']));_0x3ffe72[_0x0901('0x4d')]['SmsAccountId']=_0x4f9c8c['id'];if(_0x19b786['query'][_0x0901('0x51')]){_0x3ffe72[_0x0901('0x4d')]=_['merge'](_0x3ffe72[_0x0901('0x4d')],{'$or':_[_0x0901('0x3e')](_0x3ffe72[_0x0901('0x47')],function(_0x5d8f0c){var _0x2cd433={};_0x2cd433[_0x5d8f0c]={'$like':'%'+_0x19b786[_0x0901('0x45')][_0x0901('0x51')]+'%'};return _0x2cd433;})});}_0x3ffe72=_[_0x0901('0x52')]({},_0x3ffe72,_0x19b786[_0x0901('0x6b')]);return db[_0x0901('0x68')][_0x0901('0x30')]({'where':_0x3ffe72[_0x0901('0x4d')]})[_0x0901('0x20')](function(_0x33d6d0){_0x4c2c4f[_0x0901('0x30')]=_0x33d6d0;if(_0x19b786[_0x0901('0x45')][_0x0901('0x53')]){_0x3ffe72[_0x0901('0x54')]=[{'all':!![]}];}return db[_0x0901('0x68')][_0x0901('0x55')](_0x3ffe72);})[_0x0901('0x20')](function(_0x1ee414){_0x4c2c4f[_0x0901('0x56')]=_0x1ee414;return _0x4c2c4f;});}})[_0x0901('0x20')](respondWithFilteredResult(_0x29d42f,_0x3ffe72))['catch'](handleError(_0x29d42f,null));};exports[_0x0901('0x6c')]=function(_0x49871d,_0x2ef1af,_0x42d8ee){return db['SmsAccount'][_0x0901('0x59')]({'where':{'id':_0x49871d['params']['id']}})['then'](handleEntityNotFound(_0x2ef1af,null))['then'](function(_0x50557f){if(_0x50557f){return _0x50557f[_0x0901('0x6c')](_0x49871d[_0x0901('0x45')][_0x0901('0x67')]);}})[_0x0901('0x20')](respondWithStatusCode(_0x2ef1af,null))[_0x0901('0x28')](handleError(_0x2ef1af,null));};exports[_0x0901('0x6d')]=function(_0x37a541,_0x883064,_0x1f2fe6){var _0x18c675={'channel':_0x0901('0x6e')};var _0xc0a0d9=[];var _0x4d4132=[];var _0x18ee8a={};return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x37a541['params']['id']},'include':[{'model':db[_0x0901('0x6f')],'as':_0x0901('0x70')}]})['then'](handleEntityNotFound(_0x883064,null))['then'](function(_0x21fac1){_0x18c675['account']=_0x21fac1;_0x18c675[_0x0901('0x71')]=_[_0x0901('0x72')](_0x21fac1[_0x0901('0x70')],[_0x0901('0x73')],[_0x0901('0x74')]);if(_0x18c675[_0x0901('0x75')]['Applications']){delete _0x18c675[_0x0901('0x75')][_0x0901('0x70')];}return db['CmContact'][_0x0901('0x62')]();})[_0x0901('0x20')](function(_0x22feaf){if(!_0x22feaf){throw new db[(_0x0901('0x76'))][(_0x0901('0x77'))](_0x0901('0x78'));}_0xc0a0d9=_[_0x0901('0x79')](_[_0x0901('0x44')](_0x22feaf),[_0x0901('0x7a'),_0x0901('0x7b')]);_0x4d4132=_['difference'](_[_0x0901('0x44')](_0x22feaf),['createdAt',_0x0901('0x7b'),_0x0901('0x7c'),_0x0901('0x7d')]);_0x18c675[_0x0901('0x5b')]={'mapKey':_0x0901('0x7e')};if(_0x18c675[_0x0901('0x75')][_0x0901('0x41')]){switch(_0x18c675[_0x0901('0x75')][_0x0901('0x41')]){case _0x0901('0x7f'):_0x18c675[_0x0901('0x5b')][_0x0901('0x80')]=_0x37a541['body'][_0x0901('0x81')];_0x18c675[_0x0901('0x5b')][_0x0901('0x5b')]=_0x37a541[_0x0901('0x5b')]['Body'];_0x18c675[_0x0901('0x5b')]['messageId']=_0x37a541[_0x0901('0x5b')][_0x0901('0x82')];break;case'skebby':_0x18c675['body'][_0x0901('0x80')]='+'+_0x37a541[_0x0901('0x5b')][_0x0901('0x83')];_0x18c675[_0x0901('0x5b')][_0x0901('0x5b')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x84')];break;case _0x0901('0x85'):_0x18c675[_0x0901('0x5b')]['from']=_0x37a541[_0x0901('0x5b')][_0x0901('0x80')];_0x18c675[_0x0901('0x5b')][_0x0901('0x5b')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x26')];break;case'clicksend':_0x18c675[_0x0901('0x5b')][_0x0901('0x80')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x80')];_0x18c675[_0x0901('0x5b')][_0x0901('0x5b')]=_0x37a541['body']['body'];_0x18c675[_0x0901('0x5b')][_0x0901('0x86')]=_0x37a541['body']['message_id'];break;case _0x0901('0x87'):_0x18c675[_0x0901('0x5b')][_0x0901('0x80')]=_0x37a541['body'][_0x0901('0x81')];_0x18c675['body'][_0x0901('0x5b')]=_0x37a541['body'][_0x0901('0x88')];_0x18c675['body']['messageId']=_0x37a541[_0x0901('0x5b')][_0x0901('0x89')];break;case'infobip':_0x18c675[_0x0901('0x5b')][_0x0901('0x80')]='+'+_0x37a541[_0x0901('0x5b')][_0x0901('0x8a')][0x0][_0x0901('0x80')];_0x18c675['body'][_0x0901('0x5b')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x8a')][0x0][_0x0901('0x84')];_0x18c675[_0x0901('0x5b')][_0x0901('0x86')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x8a')][0x0]['messageId'];break;case'csc':_0x18c675['body'][_0x0901('0x80')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x8b')];_0x18c675[_0x0901('0x5b')][_0x0901('0x5b')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x8c')]['message'];break;case _0x0901('0x8d'):_0x18c675[_0x0901('0x5b')][_0x0901('0x80')]=_0x37a541['body'][_0x0901('0x8e')];_0x18c675[_0x0901('0x5b')]['body']=_0x37a541['body'][_0x0901('0x84')];_0x18c675['body'][_0x0901('0x86')]=_0x37a541[_0x0901('0x5b')]['replyMessageId'];break;case _0x0901('0x8f'):_0x18c675[_0x0901('0x5b')]['messageId']=_0x37a541[_0x0901('0x5b')][0x0][_0x0901('0x26')]['id'];_0x18c675[_0x0901('0x5b')]['from']=_0x37a541[_0x0901('0x5b')][0x0]['message'][_0x0901('0x80')];_0x18c675[_0x0901('0x5b')][_0x0901('0x5b')]=_0x37a541['body'][0x0][_0x0901('0x26')][_0x0901('0x84')];break;case _0x0901('0x90'):_0x18c675['body']['from']=_0x37a541[_0x0901('0x5b')][_0x0901('0x80')];_0x18c675['body'][_0x0901('0x5b')]=_0x37a541['body'][_0x0901('0x26')];_0x18c675[_0x0901('0x5b')][_0x0901('0x86')]=_0x37a541[_0x0901('0x5b')][_0x0901('0x91')];break;}}if(_0x18c675[_0x0901('0x5b')]['id']){delete _0x18c675['body']['id'];}if(_[_0x0901('0x92')](_0x18c675[_0x0901('0x5b')]['from'])){throw new db[(_0x0901('0x76'))][(_0x0901('0x77'))](_0x0901('0x93'));}if(_['isNil'](_0x18c675[_0x0901('0x5b')][_0x0901('0x5b')])||_0x18c675[_0x0901('0x5b')]['body']===''){throw new db[(_0x0901('0x76'))][(_0x0901('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x18c675['body']['mapKey'])){throw new db[(_0x0901('0x76'))]['ValidationError'](_0x0901('0x94')+_0x4d4132);}if(!_[_0x0901('0x95')](_0x4d4132,_0x18c675[_0x0901('0x5b')][_0x0901('0x96')])){throw new db['Sequelize'][(_0x0901('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d4132);}_0x18ee8a[_0x18c675[_0x0901('0x5b')][_0x0901('0x96')]]=_0x18c675['body'][_0x0901('0x80')];return db[_0x0901('0x97')][_0x0901('0x59')]({'where':{'id':_0x18c675[_0x0901('0x75')][_0x0901('0x7d')]},'include':[{'model':db['CmContact'],'as':_0x0901('0x98'),'where':_0x18ee8a,'limit':0x1,'order':[[_0x0901('0x7b'),_0x0901('0x99')]]}]});})[_0x0901('0x20')](handleEntityNotFound(_0x883064,null))[_0x0901('0x20')](function(_0x323273){if(_0x323273){_0x18c675[_0x0901('0x9a')]=_[_0x0901('0x9b')](_0x323273,[_0x0901('0x98')]);if(_0x323273[_0x0901('0x98')][_0x0901('0x49')]){return _0x323273[_0x0901('0x98')][0x0];}var _0x56394c=_[_0x0901('0x17')](_0x18c675[_0x0901('0x5b')],{'firstName':_0x18c675[_0x0901('0x5b')][_0x0901('0x80')],'ListId':_0x323273['id']});_0x56394c[_0x18c675['body'][_0x0901('0x96')]]=_0x18c675[_0x0901('0x5b')][_0x0901('0x80')];return db[_0x0901('0x9c')]['create'](_0x56394c,{'fields':_0xc0a0d9,'raw':!![]});}})[_0x0901('0x20')](handleEntityNotFound(_0x883064,null))['then'](function(_0x4062b9){if(_0x4062b9){_0x18c675[_0x0901('0x9d')]=_0x4062b9;var _0xa2b434={'ContactId':_0x4062b9['id'],'phone':_0x18c675[_0x0901('0x5b')]['from'],'SmsAccountId':_0x37a541[_0x0901('0x58')]['id']};var _0x3c19e1={'ContactId':_0x4062b9['id'],'SmsAccountId':_0x37a541[_0x0901('0x58')]['id'],'closed':![]};return db[_0x0901('0x9e')][_0x0901('0x59')]({'where':_0x3c19e1})[_0x0901('0x20')](function(_0x52edad){if(_0x52edad){return[_0x52edad,![]];}return db[_0x0901('0x9e')][_0x0901('0x5a')](_0xa2b434)['then'](function(_0x59b340){return[_0x59b340,!![]];});});}})['spread'](function(_0x429137,_0x5ded02){_0x18c675['interaction']=_0x429137[_0x0901('0x35')]({'plain':!![]});_0x18c675['interaction'][_0x0901('0x9f')]=![];if(_0x5ded02){if(_0x18c675['account'][_0x0901('0xa0')]){_0x18c675[_0x0901('0x71')][_0x0901('0xa1')]({'id':0x0,'priority':_0x18c675[_0x0901('0x71')]['length']+0x1,'app':_0x0901('0xa2'),'appdata':_0x0901('0xa3'),'interval':'*,*,*,*'});}_0x18c675[_0x0901('0xa4')][_0x0901('0x9f')]=!![];}return db[_0x0901('0xa5')][_0x0901('0x5a')]({'phone':_0x18c675['body'][_0x0901('0x80')],'messageId':_0x18c675[_0x0901('0x5b')][_0x0901('0x86')],'body':_0x18c675[_0x0901('0x5b')]['body'],'SmsAccountId':_0x37a541['params']['id'],'SmsInteractionId':_0x429137['id'],'direction':'in','ContactId':_0x429137[_0x0901('0xa6')],'AttachmentId':_0x18c675[_0x0901('0x5b')]['AttachmentId']});})['then'](function(_0x3557c0){_0x18c675[_0x0901('0x26')]=_0x3557c0;if(_0x18c675[_0x0901('0xa4')][_0x0901('0xa7')]){return db[_0x0901('0xa8')][_0x0901('0x59')]({'attributes':['id',_0x0901('0x39')],'where':{'id':_0x18c675['interaction']['UserId']}})[_0x0901('0x20')](function(_0x57e0d7){if(_0x57e0d7){_0x18c675[_0x0901('0x71')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x57e0d7[_0x0901('0x39')]+','+(_0x18c675[_0x0901('0x75')][_0x0901('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0901('0xaa'),_0x0901('0xab'),_0x18c675);});}return respondWithRpcPromise(_0x0901('0xaa'),'startRouting',_0x18c675);})[_0x0901('0x20')](function(_0xae87b6){if(_0xae87b6){var _0x56efc9=0xc8;var _0x3190ef=_0x0901('0xac');logger[_0x0901('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3190ef,_0x56efc9,'entity\x20found');logger[_0x0901('0xad')](_0x0901('0xae'),_0x3190ef,_0x56efc9,_0x0901('0xaf'),JSON['stringify'](_0xae87b6));if(_0x18c675[_0x0901('0x75')][_0x0901('0x41')]===_0x0901('0x7f')){return _0x883064[_0x0901('0x2a')](_0x56efc9)['set'](_0x0901('0xb0'),_0x0901('0xb1'))['send'](_0x0901('0xb2'));}else{return _0x883064[_0x0901('0x2a')](_0x56efc9)['json'](_0xae87b6);}}})[_0x0901('0x28')](handleError(_0x883064,null));};exports[_0x0901('0xb3')]=function(_0x42654b,_0x162289){var _0x4e7948=_0x42654b['params']['id'];var _0x2f4a32=_0x42654b[_0x0901('0x5b')];var _0x20e565=0xc8;var _0x326200=null;return db[_0x0901('0xb4')][_0x0901('0xb5')]({'isolationLevel':db[_0x0901('0xb4')]['Transaction'][_0x0901('0xb6')][_0x0901('0xb7')]},function(_0x4a42e5){return db[_0x0901('0x3f')][_0x0901('0x64')]({'where':{'id':_0x4e7948},'transaction':_0x4a42e5})[_0x0901('0x20')](function(_0x9b427b){if(_0x9b427b){return db[_0x0901('0x6f')][_0x0901('0x34')]({'where':{'SmsAccountId':_0x4e7948},'transaction':_0x4a42e5})[_0x0901('0x20')](function(){var _0x4f8514=_[_0x0901('0x3e')](_0x2f4a32,function(_0x411208){_0x411208[_0x0901('0x63')]=_0x4e7948;return _0x411208;});return db[_0x0901('0x6f')]['bulkCreate'](_0x4f8514,{'transaction':_0x4a42e5});});}else{_0x20e565=0x194;_0x326200=[];}});})['then'](function(){if(_0x20e565!==0x194){return db[_0x0901('0x6f')][_0x0901('0xb8')]({'where':{'SmsAccountId':_0x4e7948},'order':_0x0901('0x73')})[_0x0901('0x20')](function(_0xc71988){_0x326200=_0xc71988;});}})[_0x0901('0x28')](function(_0x2f705a){_0x20e565=0x1f4;logger[_0x0901('0x25')](_0x2f705a[_0x0901('0x38')]);if(_0x2f705a[_0x0901('0x39')]){delete _0x2f705a[_0x0901('0x39')];}_0x326200=_0x2f705a;})[_0x0901('0xb9')](function(){if(_0x326200===null){_0x162289['sendStatus'](_0x20e565);}else{if(_0x20e565===0x1f4){_0x162289[_0x0901('0x2a')](_0x20e565)[_0x0901('0x3a')](_0x326200);}else{_0x162289[_0x0901('0x2a')](_0x20e565)[_0x0901('0x2c')](_0x326200);}}});};exports['getApplications']=function(_0x13d03b,_0x277384,_0x59be91){var _0x4064bd={};var _0x3a1dd8={};var _0x48b4d7;var _0x167b72;return db[_0x0901('0x3f')][_0x0901('0x64')]({'where':{'id':_0x13d03b[_0x0901('0x58')]['id']}})['then'](handleEntityNotFound(_0x277384,null))[_0x0901('0x20')](function(_0x18b7e0){if(_0x18b7e0){_0x48b4d7=_0x18b7e0;_0x3a1dd8[_0x0901('0x43')]=_[_0x0901('0x44')](db['SmsApplication'][_0x0901('0x40')]);_0x3a1dd8[_0x0901('0x45')]=_[_0x0901('0x44')](_0x13d03b['query']);_0x3a1dd8[_0x0901('0x4e')]=_[_0x0901('0x46')](_0x3a1dd8['model'],_0x3a1dd8[_0x0901('0x45')]);_0x4064bd[_0x0901('0x47')]=_[_0x0901('0x46')](_0x3a1dd8['model'],qs[_0x0901('0x48')](_0x13d03b[_0x0901('0x45')][_0x0901('0x48')]));_0x4064bd[_0x0901('0x47')]=_0x4064bd['attributes']['length']?_0x4064bd[_0x0901('0x47')]:_0x3a1dd8[_0x0901('0x43')];_0x4064bd[_0x0901('0x6a')]=qs[_0x0901('0x4c')](_0x13d03b['query'][_0x0901('0x4c')]);_0x4064bd[_0x0901('0x4d')]=qs[_0x0901('0x4e')](_[_0x0901('0x4f')](_0x13d03b[_0x0901('0x45')],_0x3a1dd8[_0x0901('0x4e')]));if(_0x13d03b[_0x0901('0x45')]['filter']){_0x4064bd['where']=_[_0x0901('0x52')](_0x4064bd['where'],{'$or':_[_0x0901('0x3e')](_0x4064bd[_0x0901('0x47')],function(_0xd42c28){var _0x2757d9={};_0x2757d9[_0xd42c28]={'$like':'%'+_0x13d03b[_0x0901('0x45')][_0x0901('0x51')]+'%'};return _0x2757d9;})});}_0x4064bd=_['merge']({},_0x4064bd,_0x13d03b[_0x0901('0x6b')]);return _0x48b4d7[_0x0901('0xba')](_0x4064bd);}})[_0x0901('0x20')](function(_0x5d73ac){if(_0x5d73ac){_0x167b72=_0x5d73ac[_0x0901('0x49')];if(!_0x13d03b[_0x0901('0x45')]['hasOwnProperty']('nolimit')){_0x4064bd['limit']=qs[_0x0901('0x2f')](_0x13d03b['query'][_0x0901('0x2f')]);_0x4064bd[_0x0901('0x2d')]=qs[_0x0901('0x2d')](_0x13d03b[_0x0901('0x45')][_0x0901('0x2d')]);}return _0x48b4d7['getApplications'](_0x4064bd);}})[_0x0901('0x20')](function(_0x2cdaef){if(_0x2cdaef){return _0x2cdaef?{'count':_0x167b72,'rows':_0x2cdaef}:null;}})[_0x0901('0x20')](respondWithResult(_0x277384,null))[_0x0901('0x28')](handleError(_0x277384,null));};exports[_0x0901('0xbb')]=function(_0x1ae135,_0x5324de,_0x1ad0fe){var _0x547f81={'raw':![],'where':{}};var _0xa92ef8={};var _0x26ad05={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0901('0x64')]({'where':{'id':_0x1ae135[_0x0901('0x58')]['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x5324de,null))['then'](function(_0x736152){if(_0x736152){_0xa92ef8[_0x0901('0x43')]=_['keys'](db[_0x0901('0x9e')][_0x0901('0x40')]);_0xa92ef8[_0x0901('0x45')]=_[_0x0901('0x44')](_0x1ae135[_0x0901('0x45')]);_0xa92ef8[_0x0901('0x4e')]=_[_0x0901('0x46')](_0xa92ef8[_0x0901('0x43')],_0xa92ef8[_0x0901('0x45')]);_0x547f81[_0x0901('0x47')]=_['intersection'](_0xa92ef8['model'],qs[_0x0901('0x48')](_0x1ae135[_0x0901('0x45')][_0x0901('0x48')]));_0x547f81[_0x0901('0x47')]=_0x547f81[_0x0901('0x47')]['length']?_0x547f81[_0x0901('0x47')]:_0xa92ef8[_0x0901('0x43')];if(!_0x1ae135[_0x0901('0x45')][_0x0901('0x4a')](_0x0901('0x4b'))){_0x547f81[_0x0901('0x2f')]=qs[_0x0901('0x2f')](_0x1ae135[_0x0901('0x45')]['limit']);_0x547f81[_0x0901('0x2d')]=qs[_0x0901('0x2d')](_0x1ae135[_0x0901('0x45')][_0x0901('0x2d')]);}_0x547f81[_0x0901('0x6a')]=qs['sort'](_0x1ae135[_0x0901('0x45')][_0x0901('0x4c')]);_0x547f81[_0x0901('0x4d')]=qs[_0x0901('0x4e')](_[_0x0901('0x4f')](_0x1ae135[_0x0901('0x45')],_0xa92ef8['filters']));_0x547f81['where']['SmsAccountId']=_0x736152['id'];if(_0x1ae135[_0x0901('0x45')][_0x0901('0x51')]){_0x547f81['where']=_['merge'](_0x547f81['where'],{'$or':_[_0x0901('0x3e')](_0x547f81[_0x0901('0x47')],function(_0x1f4baa){var _0x27caeb={};_0x27caeb[_0x1f4baa]={'$like':'%'+_0x1ae135[_0x0901('0x45')][_0x0901('0x51')]+'%'};return _0x27caeb;})});}_0x547f81=_[_0x0901('0x52')]({},_0x547f81,_0x1ae135[_0x0901('0x6b')]);return db[_0x0901('0x9e')][_0x0901('0x30')]({'where':_0x547f81[_0x0901('0x4d')]})['then'](function(_0xad7827){_0x26ad05[_0x0901('0x30')]=_0xad7827;if(_0x1ae135[_0x0901('0x45')][_0x0901('0x53')]){_0x547f81[_0x0901('0x54')]=[{'model':db['CmContact'],'as':_0x0901('0xbc'),'required':![]},{'model':db[_0x0901('0xa8')],'as':_0x0901('0xbd'),'attributes':[_0x0901('0x39'),'fullname',_0x0901('0xbe')],'required':![]},{'model':db[_0x0901('0xbf')],'as':'Tags','attributes':['id',_0x0901('0x39'),'color'],'where':_0x1ae135[_0x0901('0x45')][_0x0901('0xc0')]?{'id':_0x1ae135[_0x0901('0x45')][_0x0901('0xc0')]}:undefined,'required':_0x1ae135[_0x0901('0x45')][_0x0901('0xc0')]?!![]:![]}];}return db[_0x0901('0x9e')]['findAll'](_0x547f81);})['then'](function(_0xbfad41){_0x26ad05[_0x0901('0x56')]=_0xbfad41;return _0x26ad05;});}})[_0x0901('0x20')](respondWithFilteredResult(_0x5324de,_0x547f81))[_0x0901('0x28')](handleError(_0x5324de,null));};exports['send']=function(_0x433367,_0x1624b2,_0x40e596){var _0x1dff8f,_0x4acef1,_0x27a013;if(_[_0x0901('0x92')](_0x433367['body'][_0x0901('0x5b')])||_0x433367[_0x0901('0x5b')][_0x0901('0x5b')]===''){throw new db[(_0x0901('0x76'))][(_0x0901('0x77'))](_0x0901('0xc1'));}if(_['isNil'](_0x433367['body']['to'])){throw new db[(_0x0901('0x76'))][(_0x0901('0x77'))]('to\x20is\x20mandatory');}_0x1dff8f=_0x433367[_0x0901('0x5b')]['to'];return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x433367[_0x0901('0x58')]['id']},'include':[{'model':db[_0x0901('0x97')],'as':_0x0901('0xc2'),'include':[{'model':db[_0x0901('0x9c')],'as':'Contacts','where':{'mobile':_0x1dff8f},'limit':0x1,'order':[[_0x0901('0x7b'),_0x0901('0x99')]]}]}]})[_0x0901('0x20')](handleEntityNotFound(_0x1624b2,null))[_0x0901('0x20')](function(_0x5cda7d){if(_0x5cda7d&&_0x5cda7d[_0x0901('0xc2')]){_0x4acef1=_0x5cda7d['get']({'plain':!![]});if(_0x4acef1[_0x0901('0xc2')]&&_0x4acef1[_0x0901('0xc2')][_0x0901('0x98')][_0x0901('0x49')]){return _0x4acef1[_0x0901('0xc2')][_0x0901('0x98')][0x0];}return db[_0x0901('0x9c')][_0x0901('0x5a')](_[_0x0901('0x17')](_0x433367[_0x0901('0x5b')],{'firstName':_0x1dff8f,'mobile':_0x1dff8f,'phone':_0x1dff8f,'ListId':_0x4acef1[_0x0901('0x7d')]}));}})['then'](handleEntityNotFound(_0x1624b2,null))[_0x0901('0x20')](function(_0x5bd9b1){if(_0x5bd9b1){_0x27a013=_0x5bd9b1;return db['SmsInteraction'][_0x0901('0x59')]({'where':{'ContactId':_0x27a013['id'],'closed':![],'SmsAccountId':_0x4acef1['id']}})[_0x0901('0x20')](function(_0x21b2a3){if(_0x21b2a3){return[_0x21b2a3,![]];}return db[_0x0901('0x9e')]['create']({'UserId':_0x433367[_0x0901('0x5e')]['id'],'ContactId':_0x27a013['id'],'SmsAccountId':_0x4acef1['id'],'phone':_0x1dff8f,'firstMsgDirection':_0x0901('0xc3'),'Messages':[_['merge'](_0x433367['body'],{'read':![],'body':_0x433367[_0x0901('0x5b')][_0x0901('0x5b')],'phone':_0x1dff8f,'SmsAccountId':_0x4acef1['id'],'UserId':_0x433367[_0x0901('0x5e')]['id'],'ContactId':_0x27a013['id']})]},{'include':[{'model':db[_0x0901('0xa5')],'as':_0x0901('0xc4')}]})[_0x0901('0x20')](function(_0x15ca2a){return[_0x15ca2a,!![]];});});}})[_0x0901('0xc5')](function(_0x39c3d8,_0x2a6975){if(_0x2a6975){return _0x39c3d8;}return db['SmsMessage'][_0x0901('0x5a')](_[_0x0901('0x52')](_0x433367[_0x0901('0x5b')],{'read':![],'body':_0x433367[_0x0901('0x5b')][_0x0901('0x5b')],'phone':_0x1dff8f,'SmsAccountId':_0x4acef1['id'],'SmsInteractionId':_0x39c3d8['id'],'UserId':_0x433367[_0x0901('0x5e')]['id'],'ContactId':_0x27a013['id']}))[_0x0901('0x20')](function(_0x36117f){_0x39c3d8[_0x0901('0xc6')][_0x0901('0xc4')]=[];_0x39c3d8['dataValues']['Messages']['push'](_0x36117f[_0x0901('0xc6')]);return _0x39c3d8;});})[_0x0901('0x20')](respondWithResult(_0x1624b2,null))[_0x0901('0x28')](handleError(_0x1624b2,null));};exports[_0x0901('0x2a')]=function(_0x5c05cc,_0x55cee7,_0x39dc12){if(_0x5c05cc[_0x0901('0x5b')]['id']){delete _0x5c05cc[_0x0901('0x5b')]['id'];}var _0x4fbf4f,_0x45cda9,_0x4e2476;return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x5c05cc[_0x0901('0x58')]['id']}})['then'](handleEntityNotFound(_0x55cee7,null))['then'](function(_0x2b0cfd){if(_0x2b0cfd){_0x4e2476=_0x2b0cfd;logger[_0x0901('0xad')](_0x0901('0x22'),'status','received\x20delivery\x20report\x20from',_0x2b0cfd[_0x0901('0x41')],util[_0x0901('0xc7')](_0x5c05cc[_0x0901('0x5b')],{'showHidden':![],'depth':null}));switch(_0x2b0cfd[_0x0901('0x41')]){case _0x0901('0xc8'):if(_0x5c05cc[_0x0901('0x5b')][_0x0901('0xc9')]&&_0x5c05cc[_0x0901('0x5b')][_0x0901('0x2a')]){_0x45cda9=_0x5c05cc[_0x0901('0x5b')][_0x0901('0x2a')];return db[_0x0901('0xa5')][_0x0901('0x59')]({'where':{'messageId':_0x5c05cc[_0x0901('0x5b')][_0x0901('0xc9')]}});}break;case _0x0901('0x85'):if(_0x5c05cc[_0x0901('0x5b')]['requestid']&&_0x5c05cc[_0x0901('0x5b')][_0x0901('0xca')]){_0x45cda9=_0x5c05cc[_0x0901('0x5b')]['statusInt'];return db[_0x0901('0xa5')]['find']({'where':{'messageId':_0x5c05cc[_0x0901('0x5b')]['requestid']}});}break;case _0x0901('0xcb'):if(_0x5c05cc[_0x0901('0x5b')]['message_id']&&_0x5c05cc[_0x0901('0x5b')]['status_code']){_0x45cda9=_0x5c05cc[_0x0901('0x5b')][_0x0901('0xcc')];return db[_0x0901('0xa5')]['find']({'where':{'messageId':_0x5c05cc[_0x0901('0x5b')][_0x0901('0xcd')]}});}break;case _0x0901('0xce'):var _0x1be9fb=_0x5c05cc[_0x0901('0x5b')][_0x0901('0x8a')][0x0];if(_0x1be9fb[_0x0901('0x86')]&&_0x1be9fb[_0x0901('0x2a')][_0x0901('0xcf')]==='DELIVERED'){_0x45cda9=_0x1be9fb[_0x0901('0x2a')][_0x0901('0xcf')];return db['SmsMessage'][_0x0901('0x59')]({'where':{'messageId':_0x1be9fb[_0x0901('0x86')]}});}break;case _0x0901('0x8d'):if(_0x5c05cc[_0x0901('0x5b')]['messageId']&&_0x5c05cc[_0x0901('0x5b')][_0x0901('0x2a')]){_0x45cda9=_0x5c05cc['body'][_0x0901('0x2a')];return db[_0x0901('0xa5')]['find']({'where':{'messageId':_0x5c05cc[_0x0901('0x5b')][_0x0901('0x86')]}});}break;case _0x0901('0x8f'):if(_0x5c05cc[_0x0901('0x5b')][0x0][_0x0901('0x26')]['id']){_0x45cda9=_0x5c05cc[_0x0901('0x5b')][0x0][_0x0901('0x41')];return db[_0x0901('0xa5')]['find']({'where':{'messageId':_0x5c05cc['body'][0x0][_0x0901('0x26')]['id']}});}break;case _0x0901('0x90'):if(_0x5c05cc[_0x0901('0x5b')][_0x0901('0xd0')]&&_0x5c05cc[_0x0901('0x5b')]['status']){_0x45cda9=_0x5c05cc['body'][_0x0901('0x2a')];return db[_0x0901('0xa5')][_0x0901('0x59')]({'where':{'messageId':_0x5c05cc[_0x0901('0x5b')][_0x0901('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x55cee7,null))['then'](function(_0x1bdf91){if(_0x1bdf91){_0x4fbf4f=_0x1bdf91;switch(_0x4e2476[_0x0901('0x41')]){case _0x0901('0xc8'):if(_0x45cda9===_0x0901('0xd1')){return _0x4fbf4f[_0x0901('0x61')]({'read':!![]});}else{logger[_0x0901('0x25')](_0x0901('0x22'),_0x0901('0x2a'),_0x0901('0xc8'),util['inspect'](_0x5c05cc['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x45cda9==='1'){return _0x4fbf4f[_0x0901('0x61')]({'read':!![]});}else{logger[_0x0901('0x25')](_0x0901('0x22'),_0x0901('0x2a'),_0x0901('0xc8'),util['inspect'](_0x5c05cc[_0x0901('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5c05cc[_0x0901('0x5b')][_0x0901('0xd2')]&&_0x45cda9>=0xc8&&_0x45cda9<=0xce){return _0x4fbf4f[_0x0901('0x61')]({'read':!![]});}else{logger[_0x0901('0x25')](_0x0901('0x22'),'status','clicksend',util[_0x0901('0xc7')](_0x5c05cc[_0x0901('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x0901('0xce'):var _0x133b88=_0x5c05cc[_0x0901('0x5b')]['results'][0x0];if(_0x133b88[_0x0901('0x2a')]['groupName']==='DELIVERED'){return _0x4fbf4f[_0x0901('0x61')]({'read':!![]});}else{logger[_0x0901('0x25')](_0x0901('0x22'),'status',_0x0901('0xce'),util[_0x0901('0xc7')](_0x5c05cc['body'],{'showHidden':![],'depth':null}));}break;case _0x0901('0x8d'):if(_0x45cda9==_0x0901('0xd3')||_0x45cda9=='RECEIVED_BY_RECIPIENT'){return _0x4fbf4f['update']({'read':!![]});}else{logger[_0x0901('0x25')](_0x0901('0x22'),'status',_0x0901('0x8d'),util[_0x0901('0xc7')](_0x5c05cc[_0x0901('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x0901('0x8f'):if(_0x45cda9==_0x0901('0xd4')){return _0x4fbf4f[_0x0901('0x61')]({'read':!![]});}else{logger['error'](_0x0901('0x22'),_0x0901('0x2a'),'bandwidth',util[_0x0901('0xc7')](_0x5c05cc['body'],{'showHidden':![],'depth':null}));}break;case _0x0901('0x90'):if(_0x45cda9===_0x0901('0xd5')||_0x45cda9===_0x0901('0xd6')){return _0x4fbf4f[_0x0901('0x61')]({'read':!![]});}else{logger[_0x0901('0x25')](_0x0901('0x22'),_0x0901('0x2a'),'intelepeer',util['inspect'](_0x5c05cc['body'],{'showHidden':![],'depth':null}));}break;}return _0x4fbf4f;}})[_0x0901('0x20')](respondWithResult(_0x55cee7,null))[_0x0901('0x28')](handleError(_0x55cee7,null));};exports[_0x0901('0xd7')]=function(_0x530941,_0x22709e,_0x146ff1){var _0x3aaebf,_0x55864e,_0x122d1f;return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x530941[_0x0901('0x58')]['id']}})['then'](handleEntityNotFound(_0x22709e,null))[_0x0901('0x20')](function(_0x472293){if(_0x472293){_0x122d1f=_0x472293;logger['debug'](_0x0901('0x22'),_0x0901('0x2a'),_0x0901('0xd8'),_0x472293[_0x0901('0x41')],util[_0x0901('0xc7')](_0x530941['query'],{'showHidden':![],'depth':null}));switch(_0x472293[_0x0901('0x41')]){case _0x0901('0xd9'):if(_0x530941[_0x0901('0x45')][_0x0901('0xda')]&&_0x530941[_0x0901('0x45')]['state']){_0x55864e=_0x530941[_0x0901('0x45')][_0x0901('0xdb')];return db[_0x0901('0xa5')][_0x0901('0x59')]({'where':{'messageId':_0x530941[_0x0901('0x45')][_0x0901('0xda')]}});}break;}}})[_0x0901('0x20')](handleEntityNotFound(_0x22709e,null))[_0x0901('0x20')](function(_0x1c83d5){if(_0x1c83d5){_0x3aaebf=_0x1c83d5;switch(_0x122d1f[_0x0901('0x41')]){case _0x0901('0xd9'):if(_0x55864e==='2'||_0x55864e==='6'){return _0x3aaebf['update']({'read':!![]});}else{logger[_0x0901('0x25')](_0x0901('0x22'),_0x0901('0x2a'),'csc',util['inspect'](_0x530941['query'],{'showHidden':![],'depth':null}));};break;}return _0x3aaebf;}})[_0x0901('0x20')](respondWithResult(_0x22709e,null))['catch'](handleError(_0x22709e,null));};exports[_0x0901('0xdc')]=function(_0x3fabf2,_0x1cbc0e,_0x4100ee){return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x3fabf2['params']['id']}})['then'](handleEntityNotFound(_0x1cbc0e,null))[_0x0901('0x20')](function(_0x2d34eb){if(_0x2d34eb){return _0x2d34eb[_0x0901('0xdc')](_0x3fabf2['body']['ids'],_[_0x0901('0x9b')](_0x3fabf2[_0x0901('0x5b')],[_0x0901('0x67'),'id'])||{})['spread'](function(_0x157f46){for(var _0x1e53bc=0x0;_0x1e53bc<_0x3fabf2[_0x0901('0x5b')][_0x0901('0x67')]['length'];_0x1e53bc+=0x1){socket[_0x0901('0xdd')](_0x0901('0xde'),{'UserId':Number(_0x3fabf2['body']['ids'][_0x1e53bc]),'SmsAccountId':Number(_0x3fabf2[_0x0901('0x58')]['id'])});}return _0x157f46;});}})['then'](respondWithResult(_0x1cbc0e,null))['catch'](handleError(_0x1cbc0e,null));};exports[_0x0901('0xdf')]=function(_0x4b37ca,_0x4b01f8,_0x116197){return db[_0x0901('0x3f')][_0x0901('0x59')]({'where':{'id':_0x4b37ca[_0x0901('0x58')]['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x4b01f8,null))[_0x0901('0x20')](function(_0x4674e0){if(_0x4674e0){return _0x4674e0[_0x0901('0xdf')](_0x4b37ca['query']['ids'])[_0x0901('0x20')](function(){if(_[_0x0901('0xe0')](_0x4b37ca[_0x0901('0x45')]['ids'])){for(var _0x361c04=0x0;_0x361c04<_0x4b37ca['query'][_0x0901('0x67')]['length'];_0x361c04+=0x1){socket[_0x0901('0xdd')](_0x0901('0xe1'),{'UserId':Number(_0x4b37ca[_0x0901('0x45')][_0x0901('0x67')][_0x361c04]),'SmsAccountId':Number(_0x4b37ca[_0x0901('0x58')]['id'])});}}else{socket[_0x0901('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0x4b37ca[_0x0901('0x45')][_0x0901('0x67')]),'SmsAccountId':Number(_0x4b37ca[_0x0901('0x58')]['id'])});}});}})[_0x0901('0x20')](respondWithStatusCode(_0x4b01f8,null))[_0x0901('0x28')](handleError(_0x4b01f8,null));};exports[_0x0901('0xe2')]=function(_0x14821f,_0x415b78,_0x4f2210){var _0x5debdd={};var _0x20a3c1={};var _0x3c3f93;var _0x421132;return db['SmsAccount'][_0x0901('0x64')]({'where':{'id':_0x14821f[_0x0901('0x58')]['id']}})[_0x0901('0x20')](handleEntityNotFound(_0x415b78,null))[_0x0901('0x20')](function(_0x161e28){if(_0x161e28){_0x3c3f93=_0x161e28;_0x20a3c1['model']=_[_0x0901('0x44')](db[_0x0901('0xa8')][_0x0901('0x40')]);_0x20a3c1[_0x0901('0x45')]=_[_0x0901('0x44')](_0x14821f['query']);_0x20a3c1[_0x0901('0x4e')]=_[_0x0901('0x46')](_0x20a3c1[_0x0901('0x43')],_0x20a3c1[_0x0901('0x45')]);_0x5debdd[_0x0901('0x47')]=_[_0x0901('0x46')](_0x20a3c1['model'],qs[_0x0901('0x48')](_0x14821f[_0x0901('0x45')][_0x0901('0x48')]));_0x5debdd[_0x0901('0x47')]=_0x5debdd[_0x0901('0x47')][_0x0901('0x49')]?_0x5debdd['attributes']:_0x20a3c1[_0x0901('0x43')];_0x5debdd[_0x0901('0x6a')]=qs[_0x0901('0x4c')](_0x14821f['query']['sort']);_0x5debdd[_0x0901('0x4d')]=qs[_0x0901('0x4e')](_[_0x0901('0x4f')](_0x14821f[_0x0901('0x45')],_0x20a3c1[_0x0901('0x4e')]));if(_0x14821f[_0x0901('0x45')][_0x0901('0x51')]){_0x5debdd['where']=_['merge'](_0x5debdd['where'],{'$or':_['map'](_0x5debdd['attributes'],function(_0x451fc1){var _0x36a2e3={};_0x36a2e3[_0x451fc1]={'$like':'%'+_0x14821f[_0x0901('0x45')][_0x0901('0x51')]+'%'};return _0x36a2e3;})});}_0x5debdd=_['merge']({},_0x5debdd,_0x14821f[_0x0901('0x6b')]);return _0x3c3f93[_0x0901('0xe2')](_0x5debdd);}})[_0x0901('0x20')](function(_0x22e164){if(_0x22e164){_0x421132=_0x22e164['length'];if(!_0x14821f[_0x0901('0x45')][_0x0901('0x4a')](_0x0901('0x4b'))){_0x5debdd['limit']=qs[_0x0901('0x2f')](_0x14821f[_0x0901('0x45')][_0x0901('0x2f')]);_0x5debdd[_0x0901('0x2d')]=qs[_0x0901('0x2d')](_0x14821f[_0x0901('0x45')][_0x0901('0x2d')]);}return _0x3c3f93[_0x0901('0xe2')](_0x5debdd);}})[_0x0901('0x20')](function(_0x488516){if(_0x488516){return _0x488516?{'count':_0x421132,'rows':_0x488516}:null;}})['then'](respondWithResult(_0x415b78,null))[_0x0901('0x28')](handleError(_0x415b78,null));}; \ No newline at end of file +var _0x3fff=['received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','filters','pick','filter','merge','where','options','include','findAll','rows','show','params','Pause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsAccounts','find','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','nolimit','sort','SmsAccountId','removeDispositions','ids','CannedAnswer','getAnswers','findOne','includeAll','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','Text','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','mapKey','CmList','CmContact','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','List','out','Messages','SmsMessage','dataValues'];(function(_0x5d7005,_0x41f35a){var _0x31ed20=function(_0x3624f8){while(--_0x3624f8){_0x5d7005['push'](_0x5d7005['shift']());}};_0x31ed20(++_0x41f35a);}(_0x3fff,0x1d6));var _0xf3ff=function(_0x111ee6,_0xd8a3ea){_0x111ee6=_0x111ee6-0x0;var _0x8bbb51=_0x3fff[_0x111ee6];return _0x8bbb51;};'use strict';var emlformat=require(_0xf3ff('0x0'));var rimraf=require(_0xf3ff('0x1'));var zipdir=require(_0xf3ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3ff('0x3'));var moment=require(_0xf3ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf3ff('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf3ff('0x6'));var csv=require('to-csv');var ejs=require(_0xf3ff('0x7'));var fs=require('fs');var fs_extra=require(_0xf3ff('0x8'));var _=require(_0xf3ff('0x9'));var squel=require('squel');var crypto=require(_0xf3ff('0xa'));var jsforce=require(_0xf3ff('0xb'));var deskjs=require(_0xf3ff('0xc'));var toCsv=require(_0xf3ff('0xd'));var querystring=require('querystring');var Papa=require(_0xf3ff('0xe'));var Redis=require(_0xf3ff('0xf'));var authService=require(_0xf3ff('0x10'));var qs=require(_0xf3ff('0x11'));var as=require(_0xf3ff('0x12'));var hardwareService=require(_0xf3ff('0x13'));var logger=require('../../config/logger')(_0xf3ff('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf3ff('0x15'));var db=require('../../mysqldb')['db'];config[_0xf3ff('0x16')]=_['defaults'](config[_0xf3ff('0x16')],{'host':_0xf3ff('0x17'),'port':0x18eb});var socket=require(_0xf3ff('0x18'))(new Redis(config[_0xf3ff('0x16')]));require(_0xf3ff('0x19'))['register'](socket);var jayson=require(_0xf3ff('0x1a'));var client=jayson[_0xf3ff('0x1b')][_0xf3ff('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5df898,_0x1ebe85,_0x5e44a8,_0x1e854f){return new BPromise(function(_0x3957b2,_0x36334a){var _0x40d22b=_0x1e854f||client;return _0x40d22b[_0xf3ff('0x1d')](_0x5df898,_0x5e44a8)['then'](function(_0x571ed3){logger[_0xf3ff('0x1e')](_0xf3ff('0x1f'),_0x1ebe85,_0xf3ff('0x20'));logger[_0xf3ff('0x21')](_0xf3ff('0x22'),_0x1ebe85,_0xf3ff('0x20'),JSON[_0xf3ff('0x23')](_0x571ed3));if(_0x571ed3[_0xf3ff('0x24')]){if(_0x571ed3[_0xf3ff('0x24')][_0xf3ff('0x25')]===0x1f4){logger['error'](_0xf3ff('0x1f'),_0x1ebe85,_0x571ed3[_0xf3ff('0x24')][_0xf3ff('0x26')]);return _0x36334a(_0x571ed3[_0xf3ff('0x24')]['message']);}logger[_0xf3ff('0x24')](_0xf3ff('0x1f'),_0x1ebe85,_0x571ed3[_0xf3ff('0x24')][_0xf3ff('0x26')]);return _0x3957b2(_0x571ed3[_0xf3ff('0x24')][_0xf3ff('0x26')]);}else{logger['info'](_0xf3ff('0x1f'),_0x1ebe85,'request\x20sent');_0x3957b2(_0x571ed3[_0xf3ff('0x27')][_0xf3ff('0x26')]);}})[_0xf3ff('0x28')](function(_0x165b49){logger['error'](_0xf3ff('0x1f'),_0x1ebe85,_0x165b49);_0x36334a(_0x165b49);});});}function respondWithStatusCode(_0xdf7ed,_0x2bd262){_0x2bd262=_0x2bd262||0xcc;return function(_0x1d480d){if(_0x1d480d){return _0xdf7ed['sendStatus'](_0x2bd262);}return _0xdf7ed[_0xf3ff('0x29')](_0x2bd262)[_0xf3ff('0x2a')]();};}function respondWithResult(_0x474d60,_0x1ee689){_0x1ee689=_0x1ee689||0xc8;return function(_0x259bd0){if(_0x259bd0){return _0x474d60[_0xf3ff('0x29')](_0x1ee689)[_0xf3ff('0x2b')](_0x259bd0);}};}function respondWithFilteredResult(_0xdb835,_0x36f327){return function(_0x38486d){if(_0x38486d){var _0x49f8b6=typeof _0x36f327[_0xf3ff('0x2c')]===_0xf3ff('0x2d')&&typeof _0x36f327[_0xf3ff('0x2e')]===_0xf3ff('0x2d');var _0x150e7a=_0x38486d[_0xf3ff('0x2f')];var _0x1cea3d=_0x49f8b6?0x0:_0x36f327[_0xf3ff('0x2c')];var _0x1dab89=_0x49f8b6?_0x38486d[_0xf3ff('0x2f')]:_0x36f327[_0xf3ff('0x2c')]+_0x36f327[_0xf3ff('0x2e')];var _0x439adb;if(_0x1dab89>=_0x150e7a){_0x1dab89=_0x150e7a;_0x439adb=0xc8;}else{_0x439adb=0xce;}_0xdb835[_0xf3ff('0x29')](_0x439adb);return _0xdb835['set'](_0xf3ff('0x30'),_0x1cea3d+'-'+_0x1dab89+'/'+_0x150e7a)[_0xf3ff('0x2b')](_0x38486d);}return null;};}function patchUpdates(_0x33ad2a){return function(_0x56007f){try{jsonpatch['apply'](_0x56007f,_0x33ad2a,!![]);}catch(_0x3c61c5){return BPromise['reject'](_0x3c61c5);}return _0x56007f[_0xf3ff('0x31')]();};}function saveUpdates(_0x39428d,_0x348cbe){return function(_0x56b695){if(_0x56b695){return _0x56b695[_0xf3ff('0x32')](_0x39428d)[_0xf3ff('0x33')](function(_0x439fe1){return _0x439fe1;});}return null;};}function removeEntity(_0x2d41c1,_0x345082){return function(_0x2e6a0d){if(_0x2e6a0d){return _0x2e6a0d[_0xf3ff('0x34')]()[_0xf3ff('0x33')](function(){var _0x5454f8=_0x2e6a0d[_0xf3ff('0x35')]({'plain':!![]});var _0x400765='SmsAccounts';return db[_0xf3ff('0x36')][_0xf3ff('0x34')]({'where':{'type':_0x400765,'resourceId':_0x5454f8['id']}})[_0xf3ff('0x33')](function(){return _0x2e6a0d;});})['then'](function(){_0x2d41c1['status'](0xcc)[_0xf3ff('0x2a')]();});}};}function handleEntityNotFound(_0x512c3e,_0x488ece){return function(_0x1c6be8){if(!_0x1c6be8){_0x512c3e[_0xf3ff('0x37')](0x194);}return _0x1c6be8;};}function handleError(_0x5c6410,_0x4b05b1){_0x4b05b1=_0x4b05b1||0x1f4;return function(_0x124b06){logger[_0xf3ff('0x24')](_0x124b06[_0xf3ff('0x38')]);if(_0x124b06['name']){delete _0x124b06[_0xf3ff('0x39')];}_0x5c6410[_0xf3ff('0x29')](_0x4b05b1)[_0xf3ff('0x3a')](_0x124b06);};}exports['index']=function(_0x37bbfa,_0x125f8f){var _0x3baac4={'include':[{'model':db['Pause'],'as':_0xf3ff('0x3b')}]},_0x5dfcdd={},_0xf8edb8={'count':0x0,'rows':[]};var _0x5c7311=_[_0xf3ff('0x3c')](db[_0xf3ff('0x3d')][_0xf3ff('0x3e')],function(_0xf3c125){return{'name':_0xf3c125['fieldName'],'type':_0xf3c125[_0xf3ff('0x3f')][_0xf3ff('0x40')]};});_0x5dfcdd['model']=_[_0xf3ff('0x3c')](_0x5c7311,'name');_0x5dfcdd[_0xf3ff('0x41')]=_[_0xf3ff('0x42')](_0x37bbfa[_0xf3ff('0x41')]);_0x5dfcdd['filters']=_['intersection'](_0x5dfcdd[_0xf3ff('0x43')],_0x5dfcdd[_0xf3ff('0x41')]);_0x3baac4['attributes']=_[_0xf3ff('0x44')](_0x5dfcdd[_0xf3ff('0x43')],qs[_0xf3ff('0x45')](_0x37bbfa[_0xf3ff('0x41')]['fields']));_0x3baac4[_0xf3ff('0x46')]=_0x3baac4['attributes'][_0xf3ff('0x47')]?_0x3baac4[_0xf3ff('0x46')]:_0x5dfcdd[_0xf3ff('0x43')];if(!_0x37bbfa[_0xf3ff('0x41')][_0xf3ff('0x48')]('nolimit')){_0x3baac4[_0xf3ff('0x2e')]=qs[_0xf3ff('0x2e')](_0x37bbfa[_0xf3ff('0x41')]['limit']);_0x3baac4['offset']=qs[_0xf3ff('0x2c')](_0x37bbfa['query'][_0xf3ff('0x2c')]);}_0x3baac4[_0xf3ff('0x49')]=qs['sort'](_0x37bbfa[_0xf3ff('0x41')]['sort']);_0x3baac4['where']=qs[_0xf3ff('0x4a')](_[_0xf3ff('0x4b')](_0x37bbfa[_0xf3ff('0x41')],_0x5dfcdd[_0xf3ff('0x4a')]),_0x5c7311);if(_0x37bbfa[_0xf3ff('0x41')][_0xf3ff('0x4c')]){_0x3baac4['where']=_[_0xf3ff('0x4d')](_0x3baac4[_0xf3ff('0x4e')],{'$or':_[_0xf3ff('0x3c')](_0x5c7311,function(_0x3f3262){if(_0x3f3262[_0xf3ff('0x3f')]!=='VIRTUAL'){var _0x4e62c6={};_0x4e62c6[_0x3f3262[_0xf3ff('0x39')]]={'$like':'%'+_0x37bbfa[_0xf3ff('0x41')][_0xf3ff('0x4c')]+'%'};return _0x4e62c6;}})});}_0x3baac4=_['merge']({},_0x3baac4,_0x37bbfa[_0xf3ff('0x4f')]);var _0x32d687={'where':_0x3baac4[_0xf3ff('0x4e')]};return db['SmsAccount'][_0xf3ff('0x2f')](_0x32d687)[_0xf3ff('0x33')](function(_0x4d8878){_0xf8edb8[_0xf3ff('0x2f')]=_0x4d8878;if(_0x37bbfa['query']['includeAll']){_0x3baac4[_0xf3ff('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0xf3ff('0x51')](_0x3baac4);})['then'](function(_0x10d4cc){_0xf8edb8[_0xf3ff('0x52')]=_0x10d4cc;return _0xf8edb8;})[_0xf3ff('0x33')](respondWithFilteredResult(_0x125f8f,_0x3baac4))[_0xf3ff('0x28')](handleError(_0x125f8f,null));};exports[_0xf3ff('0x53')]=function(_0x51ff30,_0x3b2b8b){var _0x237a17={'raw':![],'where':{'id':_0x51ff30[_0xf3ff('0x54')]['id']},'include':[{'model':db[_0xf3ff('0x55')],'as':'mandatoryDispositionPause'}]},_0x30e1c4={};_0x30e1c4[_0xf3ff('0x43')]=_[_0xf3ff('0x42')](db['SmsAccount'][_0xf3ff('0x3e')]);_0x30e1c4['query']=_[_0xf3ff('0x42')](_0x51ff30[_0xf3ff('0x41')]);_0x30e1c4['filters']=_[_0xf3ff('0x44')](_0x30e1c4[_0xf3ff('0x43')],_0x30e1c4[_0xf3ff('0x41')]);_0x237a17['attributes']=_[_0xf3ff('0x44')](_0x30e1c4[_0xf3ff('0x43')],qs['fields'](_0x51ff30[_0xf3ff('0x41')][_0xf3ff('0x45')]));_0x237a17[_0xf3ff('0x46')]=_0x237a17[_0xf3ff('0x46')][_0xf3ff('0x47')]?_0x237a17[_0xf3ff('0x46')]:_0x30e1c4[_0xf3ff('0x43')];if(_0x51ff30[_0xf3ff('0x41')]['includeAll']){_0x237a17[_0xf3ff('0x50')]=[{'all':!![]}];}_0x237a17=_[_0xf3ff('0x4d')]({},_0x237a17,_0x51ff30[_0xf3ff('0x4f')]);return db[_0xf3ff('0x3d')]['find'](_0x237a17)['then'](handleEntityNotFound(_0x3b2b8b,null))[_0xf3ff('0x33')](respondWithResult(_0x3b2b8b,null))[_0xf3ff('0x28')](handleError(_0x3b2b8b,null));};exports[_0xf3ff('0x56')]=function(_0x34fe99,_0x52ac49){return db[_0xf3ff('0x3d')][_0xf3ff('0x56')](_0x34fe99[_0xf3ff('0x57')],{})[_0xf3ff('0x33')](function(_0x4027f4){var _0xf642f8=_0x34fe99['user']['get']({'plain':!![]});if(!_0xf642f8)throw new Error(_0xf3ff('0x58'));if(_0xf642f8['role']===_0xf3ff('0x59')){var _0x419085=_0x4027f4[_0xf3ff('0x35')]({'plain':!![]});var _0x44d675=_0xf3ff('0x5a');return db['UserProfileSection'][_0xf3ff('0x5b')]({'where':{'name':_0x44d675,'userProfileId':_0xf642f8[_0xf3ff('0x5c')]},'raw':!![]})[_0xf3ff('0x33')](function(_0x274a24){if(_0x274a24&&_0x274a24[_0xf3ff('0x5d')]===0x0){return db[_0xf3ff('0x36')][_0xf3ff('0x56')]({'name':_0x419085[_0xf3ff('0x39')],'resourceId':_0x419085['id'],'type':_0x274a24['name'],'sectionId':_0x274a24['id']},{})[_0xf3ff('0x33')](function(){return _0x4027f4;});}else{return _0x4027f4;}})['catch'](function(_0x209c2e){logger[_0xf3ff('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x209c2e);throw _0x209c2e;});}return _0x4027f4;})[_0xf3ff('0x33')](respondWithResult(_0x52ac49,0xc9))['catch'](handleError(_0x52ac49,null));};exports['update']=function(_0x17954d,_0x192699){if(_0x17954d[_0xf3ff('0x57')]['id']){delete _0x17954d[_0xf3ff('0x57')]['id'];}return db[_0xf3ff('0x3d')][_0xf3ff('0x5b')]({'where':{'id':_0x17954d['params']['id']},'include':[{'model':db[_0xf3ff('0x55')],'as':_0xf3ff('0x3b')}]})[_0xf3ff('0x33')](handleEntityNotFound(_0x192699,null))[_0xf3ff('0x33')](saveUpdates(_0x17954d[_0xf3ff('0x57')],null))[_0xf3ff('0x33')](respondWithResult(_0x192699,null))[_0xf3ff('0x28')](handleError(_0x192699,null));};exports[_0xf3ff('0x34')]=function(_0x16d3b3,_0x553db4){return db['SmsAccount'][_0xf3ff('0x5b')]({'where':{'id':_0x16d3b3[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x553db4,null))['then'](removeEntity(_0x553db4,null))[_0xf3ff('0x28')](handleError(_0x553db4,null));};exports[_0xf3ff('0x5e')]=function(_0x5adf9e,_0x29f1b5){return db['SmsAccount'][_0xf3ff('0x5e')]()[_0xf3ff('0x33')](respondWithResult(_0x29f1b5,null))[_0xf3ff('0x28')](handleError(_0x29f1b5,null));};exports[_0xf3ff('0x5f')]=function(_0x228404,_0x144a3a,_0x1717b0){if(_0x228404[_0xf3ff('0x57')]['id']){delete _0x228404['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x228404[_0xf3ff('0x54')]['id']}})['then'](handleEntityNotFound(_0x144a3a,null))[_0xf3ff('0x33')](function(_0x5e641e){if(_0x5e641e){_0x228404[_0xf3ff('0x57')]['SmsAccountId']=_0x5e641e['id'];return db[_0xf3ff('0x60')]['create'](_0x228404[_0xf3ff('0x57')]);}})['then'](respondWithResult(_0x144a3a,null))[_0xf3ff('0x28')](handleError(_0x144a3a,null));};exports[_0xf3ff('0x61')]=function(_0x5d1799,_0x22048f,_0x301bb5){var _0xc89c46={'raw':![],'where':{}};var _0x49b664={};var _0x242977={'count':0x0,'rows':[]};return db[_0xf3ff('0x3d')]['findOne']({'where':{'id':_0x5d1799[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x22048f,null))[_0xf3ff('0x33')](function(_0xa1a5f2){if(_0xa1a5f2){_0x49b664[_0xf3ff('0x43')]=_[_0xf3ff('0x42')](db['Disposition'][_0xf3ff('0x3e')]);_0x49b664[_0xf3ff('0x41')]=_['keys'](_0x5d1799['query']);_0x49b664[_0xf3ff('0x4a')]=_['intersection'](_0x49b664[_0xf3ff('0x43')],_0x49b664[_0xf3ff('0x41')]);_0xc89c46[_0xf3ff('0x46')]=_[_0xf3ff('0x44')](_0x49b664[_0xf3ff('0x43')],qs[_0xf3ff('0x45')](_0x5d1799[_0xf3ff('0x41')][_0xf3ff('0x45')]));_0xc89c46[_0xf3ff('0x46')]=_0xc89c46[_0xf3ff('0x46')][_0xf3ff('0x47')]?_0xc89c46[_0xf3ff('0x46')]:_0x49b664[_0xf3ff('0x43')];if(!_0x5d1799[_0xf3ff('0x41')]['hasOwnProperty'](_0xf3ff('0x62'))){_0xc89c46[_0xf3ff('0x2e')]=qs['limit'](_0x5d1799[_0xf3ff('0x41')][_0xf3ff('0x2e')]);_0xc89c46[_0xf3ff('0x2c')]=qs[_0xf3ff('0x2c')](_0x5d1799[_0xf3ff('0x41')][_0xf3ff('0x2c')]);}_0xc89c46[_0xf3ff('0x49')]=qs[_0xf3ff('0x63')](_0x5d1799[_0xf3ff('0x41')]['sort']);_0xc89c46['where']=qs[_0xf3ff('0x4a')](_[_0xf3ff('0x4b')](_0x5d1799[_0xf3ff('0x41')],_0x49b664[_0xf3ff('0x4a')]));_0xc89c46[_0xf3ff('0x4e')][_0xf3ff('0x64')]=_0xa1a5f2['id'];if(_0x5d1799[_0xf3ff('0x41')][_0xf3ff('0x4c')]){_0xc89c46['where']=_[_0xf3ff('0x4d')](_0xc89c46[_0xf3ff('0x4e')],{'$or':_[_0xf3ff('0x3c')](_0xc89c46[_0xf3ff('0x46')],function(_0x4d3d30){var _0x528857={};_0x528857[_0x4d3d30]={'$like':'%'+_0x5d1799['query']['filter']+'%'};return _0x528857;})});}_0xc89c46=_[_0xf3ff('0x4d')]({},_0xc89c46,_0x5d1799[_0xf3ff('0x4f')]);return db[_0xf3ff('0x60')]['count']({'where':_0xc89c46[_0xf3ff('0x4e')]})[_0xf3ff('0x33')](function(_0x4e2510){_0x242977[_0xf3ff('0x2f')]=_0x4e2510;if(_0x5d1799[_0xf3ff('0x41')]['includeAll']){_0xc89c46['include']=[{'all':!![]}];}return db[_0xf3ff('0x60')][_0xf3ff('0x51')](_0xc89c46);})[_0xf3ff('0x33')](function(_0x4b27e6){_0x242977[_0xf3ff('0x52')]=_0x4b27e6;return _0x242977;});}})[_0xf3ff('0x33')](respondWithFilteredResult(_0x22048f,_0xc89c46))[_0xf3ff('0x28')](handleError(_0x22048f,null));};exports[_0xf3ff('0x65')]=function(_0x5e1bf9,_0x4dfef4,_0x4642dd){return db[_0xf3ff('0x3d')][_0xf3ff('0x5b')]({'where':{'id':_0x5e1bf9[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x4dfef4,null))[_0xf3ff('0x33')](function(_0x928489){if(_0x928489){return _0x928489['removeDispositions'](_0x5e1bf9['query'][_0xf3ff('0x66')]);}})['then'](respondWithStatusCode(_0x4dfef4,null))[_0xf3ff('0x28')](handleError(_0x4dfef4,null));};exports['addAnswer']=function(_0xc56c1b,_0x3b95a7,_0xc93482){if(_0xc56c1b[_0xf3ff('0x57')]['id']){delete _0xc56c1b[_0xf3ff('0x57')]['id'];}return db[_0xf3ff('0x3d')][_0xf3ff('0x5b')]({'where':{'id':_0xc56c1b['params']['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x3b95a7,null))[_0xf3ff('0x33')](function(_0x5ed01a){if(_0x5ed01a){_0xc56c1b[_0xf3ff('0x57')][_0xf3ff('0x64')]=_0x5ed01a['id'];return db[_0xf3ff('0x67')][_0xf3ff('0x56')](_0xc56c1b['body']);}})[_0xf3ff('0x33')](respondWithResult(_0x3b95a7,null))[_0xf3ff('0x28')](handleError(_0x3b95a7,null));};exports[_0xf3ff('0x68')]=function(_0x5099d2,_0x245e18,_0x3dfc23){var _0x2cd036={'raw':![],'where':{}};var _0x2b92be={};var _0x7a061e={'count':0x0,'rows':[]};return db[_0xf3ff('0x3d')][_0xf3ff('0x69')]({'where':{'id':_0x5099d2[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x245e18,null))[_0xf3ff('0x33')](function(_0x382741){if(_0x382741){_0x2b92be[_0xf3ff('0x43')]=_[_0xf3ff('0x42')](db[_0xf3ff('0x67')][_0xf3ff('0x3e')]);_0x2b92be[_0xf3ff('0x41')]=_[_0xf3ff('0x42')](_0x5099d2[_0xf3ff('0x41')]);_0x2b92be['filters']=_[_0xf3ff('0x44')](_0x2b92be[_0xf3ff('0x43')],_0x2b92be['query']);_0x2cd036['attributes']=_['intersection'](_0x2b92be['model'],qs[_0xf3ff('0x45')](_0x5099d2[_0xf3ff('0x41')]['fields']));_0x2cd036[_0xf3ff('0x46')]=_0x2cd036[_0xf3ff('0x46')][_0xf3ff('0x47')]?_0x2cd036[_0xf3ff('0x46')]:_0x2b92be[_0xf3ff('0x43')];if(!_0x5099d2[_0xf3ff('0x41')]['hasOwnProperty'](_0xf3ff('0x62'))){_0x2cd036[_0xf3ff('0x2e')]=qs[_0xf3ff('0x2e')](_0x5099d2[_0xf3ff('0x41')][_0xf3ff('0x2e')]);_0x2cd036[_0xf3ff('0x2c')]=qs[_0xf3ff('0x2c')](_0x5099d2[_0xf3ff('0x41')]['offset']);}_0x2cd036[_0xf3ff('0x49')]=qs[_0xf3ff('0x63')](_0x5099d2[_0xf3ff('0x41')]['sort']);_0x2cd036['where']=qs['filters'](_[_0xf3ff('0x4b')](_0x5099d2['query'],_0x2b92be[_0xf3ff('0x4a')]));_0x2cd036[_0xf3ff('0x4e')][_0xf3ff('0x64')]=_0x382741['id'];if(_0x5099d2['query'][_0xf3ff('0x4c')]){_0x2cd036[_0xf3ff('0x4e')]=_[_0xf3ff('0x4d')](_0x2cd036['where'],{'$or':_[_0xf3ff('0x3c')](_0x2cd036[_0xf3ff('0x46')],function(_0x45885e){var _0x2a9830={};_0x2a9830[_0x45885e]={'$like':'%'+_0x5099d2[_0xf3ff('0x41')][_0xf3ff('0x4c')]+'%'};return _0x2a9830;})});}_0x2cd036=_[_0xf3ff('0x4d')]({},_0x2cd036,_0x5099d2['options']);return db['CannedAnswer'][_0xf3ff('0x2f')]({'where':_0x2cd036['where']})['then'](function(_0x15aa8c){_0x7a061e[_0xf3ff('0x2f')]=_0x15aa8c;if(_0x5099d2[_0xf3ff('0x41')][_0xf3ff('0x6a')]){_0x2cd036[_0xf3ff('0x50')]=[{'all':!![]}];}return db[_0xf3ff('0x67')]['findAll'](_0x2cd036);})[_0xf3ff('0x33')](function(_0x3f40be){_0x7a061e[_0xf3ff('0x52')]=_0x3f40be;return _0x7a061e;});}})['then'](respondWithFilteredResult(_0x245e18,_0x2cd036))[_0xf3ff('0x28')](handleError(_0x245e18,null));};exports[_0xf3ff('0x6b')]=function(_0x4ed734,_0x11f0f7,_0x98f52f){return db[_0xf3ff('0x3d')][_0xf3ff('0x5b')]({'where':{'id':_0x4ed734[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x11f0f7,null))[_0xf3ff('0x33')](function(_0x4eb118){if(_0x4eb118){return _0x4eb118[_0xf3ff('0x6b')](_0x4ed734['query'][_0xf3ff('0x66')]);}})[_0xf3ff('0x33')](respondWithStatusCode(_0x11f0f7,null))[_0xf3ff('0x28')](handleError(_0x11f0f7,null));};exports[_0xf3ff('0x6c')]=function(_0x12ff39,_0x372857,_0x529ef0){var _0x45b941={'channel':'sms'};var _0x33aaf2=[];var _0x258786=[];var _0x19c4a5={};return db['SmsAccount'][_0xf3ff('0x5b')]({'where':{'id':_0x12ff39[_0xf3ff('0x54')]['id']},'include':[{'model':db[_0xf3ff('0x6d')],'as':_0xf3ff('0x6e')}]})['then'](handleEntityNotFound(_0x372857,null))[_0xf3ff('0x33')](function(_0x56e3d7){_0x45b941[_0xf3ff('0x6f')]=_0x56e3d7;_0x45b941[_0xf3ff('0x70')]=_[_0xf3ff('0x71')](_0x56e3d7[_0xf3ff('0x6e')],['priority'],['asc']);if(_0x45b941[_0xf3ff('0x6f')][_0xf3ff('0x6e')]){delete _0x45b941[_0xf3ff('0x6f')][_0xf3ff('0x6e')];}return db['CmContact'][_0xf3ff('0x5e')]();})[_0xf3ff('0x33')](function(_0xc5f11){if(!_0xc5f11){throw new db[(_0xf3ff('0x72'))][(_0xf3ff('0x73'))](_0xf3ff('0x74'));}_0x33aaf2=_[_0xf3ff('0x75')](_[_0xf3ff('0x42')](_0xc5f11),[_0xf3ff('0x76'),_0xf3ff('0x77')]);_0x258786=_[_0xf3ff('0x75')](_[_0xf3ff('0x42')](_0xc5f11),[_0xf3ff('0x76'),'updatedAt',_0xf3ff('0x78'),_0xf3ff('0x79')]);_0x45b941[_0xf3ff('0x57')]={'mapKey':_0xf3ff('0x7a')};if(_0x45b941['account'][_0xf3ff('0x3f')]){switch(_0x45b941[_0xf3ff('0x6f')][_0xf3ff('0x3f')]){case _0xf3ff('0x7b'):_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7c')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x7d')];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')]=_0x12ff39['body'][_0xf3ff('0x7e')];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7f')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x80')];break;case _0xf3ff('0x81'):_0x45b941['body'][_0xf3ff('0x7c')]='+'+_0x12ff39[_0xf3ff('0x57')]['sender'];_0x45b941[_0xf3ff('0x57')]['body']=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x82')];break;case _0xf3ff('0x83'):_0x45b941[_0xf3ff('0x57')]['from']=_0x12ff39['body'][_0xf3ff('0x7c')];_0x45b941['body'][_0xf3ff('0x57')]=_0x12ff39[_0xf3ff('0x57')]['message'];break;case _0xf3ff('0x84'):_0x45b941['body'][_0xf3ff('0x7c')]=_0x12ff39['body']['from'];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')]=_0x12ff39[_0xf3ff('0x57')]['body'];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7f')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x85')];break;case _0xf3ff('0x86'):_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7c')]=_0x12ff39[_0xf3ff('0x57')]['From'];_0x45b941[_0xf3ff('0x57')]['body']=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x87')];_0x45b941['body'][_0xf3ff('0x7f')]=_0x12ff39[_0xf3ff('0x57')]['MessageUUID'];break;case _0xf3ff('0x88'):_0x45b941[_0xf3ff('0x57')]['from']='+'+_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x89')][0x0][_0xf3ff('0x7c')];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x89')][0x0][_0xf3ff('0x82')];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7f')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x89')][0x0]['messageId'];break;case _0xf3ff('0x8a'):_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7c')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x8b')];_0x45b941[_0xf3ff('0x57')]['body']=_0x12ff39['body']['segmentedMessage'][_0xf3ff('0x26')];break;case _0xf3ff('0x8c'):_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7c')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x8d')];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x82')];_0x45b941['body'][_0xf3ff('0x7f')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x8e')];break;case _0xf3ff('0x8f'):_0x45b941['body'][_0xf3ff('0x7f')]=_0x12ff39[_0xf3ff('0x57')][0x0]['message']['id'];_0x45b941['body'][_0xf3ff('0x7c')]=_0x12ff39['body'][0x0][_0xf3ff('0x26')][_0xf3ff('0x7c')];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')]=_0x12ff39[_0xf3ff('0x57')][0x0][_0xf3ff('0x26')][_0xf3ff('0x82')];break;case _0xf3ff('0x90'):_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7c')]=_0x12ff39[_0xf3ff('0x57')]['from'];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')]=_0x12ff39[_0xf3ff('0x57')][_0xf3ff('0x26')];_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7f')]=_0x12ff39['body'][_0xf3ff('0x91')];break;}}if(_0x45b941['body']['id']){delete _0x45b941[_0xf3ff('0x57')]['id'];}if(_['isNil'](_0x45b941['body'][_0xf3ff('0x7c')])){throw new db[(_0xf3ff('0x72'))][(_0xf3ff('0x73'))]('from\x20is\x20mandatory');}if(_[_0xf3ff('0x92')](_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')])||_0x45b941[_0xf3ff('0x57')]['body']===''){throw new db[(_0xf3ff('0x72'))][(_0xf3ff('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf3ff('0x92')](_0x45b941['body'][_0xf3ff('0x93')])){throw new db[(_0xf3ff('0x72'))][(_0xf3ff('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x258786);}if(!_['includes'](_0x258786,_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x93')])){throw new db[(_0xf3ff('0x72'))][(_0xf3ff('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x258786);}_0x19c4a5[_0x45b941[_0xf3ff('0x57')]['mapKey']]=_0x45b941[_0xf3ff('0x57')]['from'];return db[_0xf3ff('0x94')]['find']({'where':{'id':_0x45b941[_0xf3ff('0x6f')]['ListId']},'include':[{'model':db[_0xf3ff('0x95')],'as':'Contacts','where':_0x19c4a5,'limit':0x1,'order':[[_0xf3ff('0x77'),'DESC']]}]});})[_0xf3ff('0x33')](handleEntityNotFound(_0x372857,null))[_0xf3ff('0x33')](function(_0x133e77){if(_0x133e77){_0x45b941[_0xf3ff('0x96')]=_[_0xf3ff('0x97')](_0x133e77,[_0xf3ff('0x98')]);if(_0x133e77['Contacts']['length']){return _0x133e77[_0xf3ff('0x98')][0x0];}var _0x40b0cd=_[_0xf3ff('0x99')](_0x45b941['body'],{'firstName':_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7c')],'ListId':_0x133e77['id']});_0x40b0cd[_0x45b941[_0xf3ff('0x57')]['mapKey']]=_0x45b941['body'][_0xf3ff('0x7c')];return db['CmContact'][_0xf3ff('0x56')](_0x40b0cd,{'fields':_0x33aaf2,'raw':!![]});}})['then'](handleEntityNotFound(_0x372857,null))[_0xf3ff('0x33')](function(_0x3b07e0){if(_0x3b07e0){_0x45b941[_0xf3ff('0x9a')]=_0x3b07e0;var _0x4e5799={'ContactId':_0x3b07e0['id'],'phone':_0x45b941[_0xf3ff('0x57')]['from'],'SmsAccountId':_0x12ff39[_0xf3ff('0x54')]['id']};var _0x31f971={'ContactId':_0x3b07e0['id'],'SmsAccountId':_0x12ff39[_0xf3ff('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0xf3ff('0x5b')]({'where':_0x31f971})['then'](function(_0x3c95cc){if(_0x3c95cc){return[_0x3c95cc,![]];}return db[_0xf3ff('0x9b')]['create'](_0x4e5799)[_0xf3ff('0x33')](function(_0x136110){return[_0x136110,!![]];});});}})[_0xf3ff('0x9c')](function(_0x462b08,_0x4ba277){_0x45b941[_0xf3ff('0x9d')]=_0x462b08[_0xf3ff('0x35')]({'plain':!![]});_0x45b941[_0xf3ff('0x9d')][_0xf3ff('0x9e')]=![];if(_0x4ba277){if(_0x45b941[_0xf3ff('0x6f')]['autoclose']){_0x45b941['applications']['push']({'id':0x0,'priority':_0x45b941['applications'][_0xf3ff('0x47')]+0x1,'app':'close','appdata':_0xf3ff('0x9f'),'interval':_0xf3ff('0xa0')});}_0x45b941[_0xf3ff('0x9d')][_0xf3ff('0x9e')]=!![];}return db['SmsMessage']['create']({'phone':_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7c')],'messageId':_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x7f')],'body':_0x45b941[_0xf3ff('0x57')][_0xf3ff('0x57')],'SmsAccountId':_0x12ff39[_0xf3ff('0x54')]['id'],'SmsInteractionId':_0x462b08['id'],'direction':'in','ContactId':_0x462b08[_0xf3ff('0xa1')],'AttachmentId':_0x45b941[_0xf3ff('0x57')][_0xf3ff('0xa2')]});})[_0xf3ff('0x33')](function(_0x2925df){_0x45b941['message']=_0x2925df;if(_0x45b941[_0xf3ff('0x9d')]['UserId']){return db['User']['find']({'attributes':['id',_0xf3ff('0x39')],'where':{'id':_0x45b941[_0xf3ff('0x9d')][_0xf3ff('0xa3')]}})['then'](function(_0x3405c8){if(_0x3405c8){_0x45b941['applications'][_0xf3ff('0xa4')]({'id':0x0,'priority':0x0,'app':_0xf3ff('0xa5'),'appdata':_0x3405c8[_0xf3ff('0x39')]+','+(_0x45b941['account'][_0xf3ff('0xa6')]||0xa),'interval':_0xf3ff('0xa0')});}return respondWithRpcPromise(_0xf3ff('0xa7'),_0xf3ff('0xa8'),_0x45b941);});}return respondWithRpcPromise(_0xf3ff('0xa7'),'startRouting',_0x45b941);})[_0xf3ff('0x33')](function(_0x5b79c5){if(_0x5b79c5){var _0x4afee6=0xc8;var _0x2a66e3='receiveMessage';logger[_0xf3ff('0x1e')](_0xf3ff('0x22'),_0x2a66e3,_0x4afee6,_0xf3ff('0xa9'));logger[_0xf3ff('0x21')](_0xf3ff('0xaa'),_0x2a66e3,_0x4afee6,_0xf3ff('0xa9'),JSON[_0xf3ff('0x23')](_0x5b79c5));if(_0x45b941['account']['type']===_0xf3ff('0x7b')){return _0x372857[_0xf3ff('0x29')](_0x4afee6)[_0xf3ff('0xab')](_0xf3ff('0xac'),_0xf3ff('0xad'))[_0xf3ff('0x3a')](_0xf3ff('0xae'));}else{return _0x372857['status'](_0x4afee6)[_0xf3ff('0x2b')](_0x5b79c5);}}})['catch'](handleError(_0x372857,null));};exports[_0xf3ff('0xaf')]=function(_0x1399fc,_0x5695af){var _0x22f5c6=_0x1399fc[_0xf3ff('0x54')]['id'];var _0xbbc19c=_0x1399fc[_0xf3ff('0x57')];var _0x2c33ee=0xc8;var _0x1f4d15=null;return db[_0xf3ff('0xb0')][_0xf3ff('0xb1')]({'isolationLevel':db['sequelize'][_0xf3ff('0xb2')][_0xf3ff('0xb3')][_0xf3ff('0xb4')]},function(_0x125ca2){return db['SmsAccount'][_0xf3ff('0x69')]({'where':{'id':_0x22f5c6},'transaction':_0x125ca2})['then'](function(_0xa7db1d){if(_0xa7db1d){return db[_0xf3ff('0x6d')][_0xf3ff('0x34')]({'where':{'SmsAccountId':_0x22f5c6},'transaction':_0x125ca2})[_0xf3ff('0x33')](function(){var _0x3601f3=_[_0xf3ff('0x3c')](_0xbbc19c,function(_0x2a01d3){_0x2a01d3['SmsAccountId']=_0x22f5c6;return _0x2a01d3;});return db[_0xf3ff('0x6d')][_0xf3ff('0xb5')](_0x3601f3,{'transaction':_0x125ca2});});}else{_0x2c33ee=0x194;_0x1f4d15=[];}});})['then'](function(){if(_0x2c33ee!==0x194){return db[_0xf3ff('0x6d')][_0xf3ff('0xb6')]({'where':{'SmsAccountId':_0x22f5c6},'order':_0xf3ff('0xb7')})[_0xf3ff('0x33')](function(_0x289d66){_0x1f4d15=_0x289d66;});}})[_0xf3ff('0x28')](function(_0x2d0c8d){_0x2c33ee=0x1f4;logger[_0xf3ff('0x24')](_0x2d0c8d[_0xf3ff('0x38')]);if(_0x2d0c8d[_0xf3ff('0x39')]){delete _0x2d0c8d['name'];}_0x1f4d15=_0x2d0c8d;})[_0xf3ff('0xb8')](function(){if(_0x1f4d15===null){_0x5695af['sendStatus'](_0x2c33ee);}else{if(_0x2c33ee===0x1f4){_0x5695af['status'](_0x2c33ee)[_0xf3ff('0x3a')](_0x1f4d15);}else{_0x5695af[_0xf3ff('0x29')](_0x2c33ee)[_0xf3ff('0x2b')](_0x1f4d15);}}});};exports[_0xf3ff('0xb9')]=function(_0x340d23,_0x11eef4,_0x3dde8f){var _0x318507={};var _0x27975b={};var _0x185013;var _0xcf9db2;return db[_0xf3ff('0x3d')][_0xf3ff('0x69')]({'where':{'id':_0x340d23[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x11eef4,null))[_0xf3ff('0x33')](function(_0x31bd12){if(_0x31bd12){_0x185013=_0x31bd12;_0x27975b['model']=_[_0xf3ff('0x42')](db[_0xf3ff('0x6d')][_0xf3ff('0x3e')]);_0x27975b['query']=_['keys'](_0x340d23['query']);_0x27975b[_0xf3ff('0x4a')]=_[_0xf3ff('0x44')](_0x27975b[_0xf3ff('0x43')],_0x27975b['query']);_0x318507['attributes']=_[_0xf3ff('0x44')](_0x27975b[_0xf3ff('0x43')],qs[_0xf3ff('0x45')](_0x340d23[_0xf3ff('0x41')][_0xf3ff('0x45')]));_0x318507['attributes']=_0x318507[_0xf3ff('0x46')][_0xf3ff('0x47')]?_0x318507[_0xf3ff('0x46')]:_0x27975b['model'];_0x318507[_0xf3ff('0x49')]=qs['sort'](_0x340d23[_0xf3ff('0x41')][_0xf3ff('0x63')]);_0x318507['where']=qs[_0xf3ff('0x4a')](_[_0xf3ff('0x4b')](_0x340d23[_0xf3ff('0x41')],_0x27975b[_0xf3ff('0x4a')]));if(_0x340d23[_0xf3ff('0x41')][_0xf3ff('0x4c')]){_0x318507[_0xf3ff('0x4e')]=_[_0xf3ff('0x4d')](_0x318507[_0xf3ff('0x4e')],{'$or':_[_0xf3ff('0x3c')](_0x318507['attributes'],function(_0x109734){var _0x44a924={};_0x44a924[_0x109734]={'$like':'%'+_0x340d23[_0xf3ff('0x41')][_0xf3ff('0x4c')]+'%'};return _0x44a924;})});}_0x318507=_[_0xf3ff('0x4d')]({},_0x318507,_0x340d23[_0xf3ff('0x4f')]);return _0x185013['getApplications'](_0x318507);}})[_0xf3ff('0x33')](function(_0x3e9124){if(_0x3e9124){_0xcf9db2=_0x3e9124[_0xf3ff('0x47')];if(!_0x340d23['query'][_0xf3ff('0x48')](_0xf3ff('0x62'))){_0x318507['limit']=qs['limit'](_0x340d23['query'][_0xf3ff('0x2e')]);_0x318507[_0xf3ff('0x2c')]=qs[_0xf3ff('0x2c')](_0x340d23[_0xf3ff('0x41')][_0xf3ff('0x2c')]);}return _0x185013['getApplications'](_0x318507);}})[_0xf3ff('0x33')](function(_0x57de52){if(_0x57de52){return _0x57de52?{'count':_0xcf9db2,'rows':_0x57de52}:null;}})[_0xf3ff('0x33')](respondWithResult(_0x11eef4,null))[_0xf3ff('0x28')](handleError(_0x11eef4,null));};exports['getInteractions']=function(_0x42c420,_0xb837c,_0x298ff4){var _0x5b5293={'raw':![],'where':{}};var _0x323ce7={};var _0x2432fe={'count':0x0,'rows':[]};return db['SmsAccount'][_0xf3ff('0x69')]({'where':{'id':_0x42c420['params']['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0xb837c,null))[_0xf3ff('0x33')](function(_0x1e34bd){if(_0x1e34bd){_0x323ce7['model']=_[_0xf3ff('0x42')](db['SmsInteraction'][_0xf3ff('0x3e')]);_0x323ce7['query']=_[_0xf3ff('0x42')](_0x42c420[_0xf3ff('0x41')]);_0x323ce7[_0xf3ff('0x4a')]=_['intersection'](_0x323ce7['model'],_0x323ce7[_0xf3ff('0x41')]);_0x5b5293['attributes']=_[_0xf3ff('0x44')](_0x323ce7['model'],qs[_0xf3ff('0x45')](_0x42c420[_0xf3ff('0x41')][_0xf3ff('0x45')]));_0x5b5293[_0xf3ff('0x46')]=_0x5b5293[_0xf3ff('0x46')][_0xf3ff('0x47')]?_0x5b5293[_0xf3ff('0x46')]:_0x323ce7[_0xf3ff('0x43')];if(!_0x42c420[_0xf3ff('0x41')][_0xf3ff('0x48')](_0xf3ff('0x62'))){_0x5b5293[_0xf3ff('0x2e')]=qs[_0xf3ff('0x2e')](_0x42c420['query'][_0xf3ff('0x2e')]);_0x5b5293[_0xf3ff('0x2c')]=qs[_0xf3ff('0x2c')](_0x42c420[_0xf3ff('0x41')][_0xf3ff('0x2c')]);}_0x5b5293[_0xf3ff('0x49')]=qs[_0xf3ff('0x63')](_0x42c420['query'][_0xf3ff('0x63')]);_0x5b5293[_0xf3ff('0x4e')]=qs[_0xf3ff('0x4a')](_[_0xf3ff('0x4b')](_0x42c420[_0xf3ff('0x41')],_0x323ce7[_0xf3ff('0x4a')]));_0x5b5293['where'][_0xf3ff('0x64')]=_0x1e34bd['id'];if(_0x42c420[_0xf3ff('0x41')]['filter']){_0x5b5293[_0xf3ff('0x4e')]=_[_0xf3ff('0x4d')](_0x5b5293[_0xf3ff('0x4e')],{'$or':_[_0xf3ff('0x3c')](_0x5b5293['attributes'],function(_0x11ec3d){var _0x476b5e={};_0x476b5e[_0x11ec3d]={'$like':'%'+_0x42c420['query'][_0xf3ff('0x4c')]+'%'};return _0x476b5e;})});}_0x5b5293=_['merge']({},_0x5b5293,_0x42c420[_0xf3ff('0x4f')]);return db[_0xf3ff('0x9b')][_0xf3ff('0x2f')]({'where':_0x5b5293[_0xf3ff('0x4e')]})[_0xf3ff('0x33')](function(_0x3ff551){_0x2432fe['count']=_0x3ff551;if(_0x42c420[_0xf3ff('0x41')][_0xf3ff('0x6a')]){_0x5b5293[_0xf3ff('0x50')]=[{'model':db[_0xf3ff('0x95')],'as':_0xf3ff('0xba'),'required':![]},{'model':db[_0xf3ff('0xbb')],'as':_0xf3ff('0xbc'),'attributes':[_0xf3ff('0x39'),_0xf3ff('0xbd'),_0xf3ff('0xbe')],'required':![]},{'model':db[_0xf3ff('0xbf')],'as':_0xf3ff('0xc0'),'attributes':['id',_0xf3ff('0x39'),_0xf3ff('0xc1')],'where':_0x42c420[_0xf3ff('0x41')][_0xf3ff('0xc2')]?{'id':_0x42c420[_0xf3ff('0x41')][_0xf3ff('0xc2')]}:undefined,'required':_0x42c420[_0xf3ff('0x41')]['tag']?!![]:![]}];}return db[_0xf3ff('0x9b')]['findAll'](_0x5b5293);})[_0xf3ff('0x33')](function(_0x99bd0a){_0x2432fe[_0xf3ff('0x52')]=_0x99bd0a;return _0x2432fe;});}})['then'](respondWithFilteredResult(_0xb837c,_0x5b5293))['catch'](handleError(_0xb837c,null));};exports[_0xf3ff('0x3a')]=function(_0x42cadc,_0x582542,_0x15a381){var _0x4b5f5f,_0x3ff153,_0x5103be;if(_[_0xf3ff('0x92')](_0x42cadc['body']['body'])||_0x42cadc[_0xf3ff('0x57')][_0xf3ff('0x57')]===''){throw new db[(_0xf3ff('0x72'))][(_0xf3ff('0x73'))](_0xf3ff('0xc3'));}if(_[_0xf3ff('0x92')](_0x42cadc[_0xf3ff('0x57')]['to'])){throw new db['Sequelize'][(_0xf3ff('0x73'))]('to\x20is\x20mandatory');}_0x4b5f5f=_0x42cadc[_0xf3ff('0x57')]['to'];return db['SmsAccount'][_0xf3ff('0x5b')]({'where':{'id':_0x42cadc[_0xf3ff('0x54')]['id']},'include':[{'model':db[_0xf3ff('0x94')],'as':'List','include':[{'model':db['CmContact'],'as':_0xf3ff('0x98'),'where':{'mobile':_0x4b5f5f},'limit':0x1,'order':[[_0xf3ff('0x77'),_0xf3ff('0xc4')]]}]}]})[_0xf3ff('0x33')](handleEntityNotFound(_0x582542,null))[_0xf3ff('0x33')](function(_0x1c5ccd){if(_0x1c5ccd&&_0x1c5ccd[_0xf3ff('0xc5')]){_0x3ff153=_0x1c5ccd[_0xf3ff('0x35')]({'plain':!![]});if(_0x3ff153[_0xf3ff('0xc5')]&&_0x3ff153[_0xf3ff('0xc5')]['Contacts'][_0xf3ff('0x47')]){return _0x3ff153[_0xf3ff('0xc5')][_0xf3ff('0x98')][0x0];}return db[_0xf3ff('0x95')][_0xf3ff('0x56')](_['defaults'](_0x42cadc[_0xf3ff('0x57')],{'firstName':_0x4b5f5f,'mobile':_0x4b5f5f,'phone':_0x4b5f5f,'ListId':_0x3ff153[_0xf3ff('0x79')]}));}})[_0xf3ff('0x33')](handleEntityNotFound(_0x582542,null))[_0xf3ff('0x33')](function(_0x262de5){if(_0x262de5){_0x5103be=_0x262de5;return db[_0xf3ff('0x9b')]['find']({'where':{'ContactId':_0x5103be['id'],'closed':![],'SmsAccountId':_0x3ff153['id']}})[_0xf3ff('0x33')](function(_0x101ea3){if(_0x101ea3){return[_0x101ea3,![]];}return db[_0xf3ff('0x9b')][_0xf3ff('0x56')]({'UserId':_0x42cadc[_0xf3ff('0x59')]['id'],'ContactId':_0x5103be['id'],'SmsAccountId':_0x3ff153['id'],'phone':_0x4b5f5f,'firstMsgDirection':_0xf3ff('0xc6'),'Messages':[_[_0xf3ff('0x4d')](_0x42cadc['body'],{'read':![],'body':_0x42cadc[_0xf3ff('0x57')][_0xf3ff('0x57')],'phone':_0x4b5f5f,'SmsAccountId':_0x3ff153['id'],'UserId':_0x42cadc[_0xf3ff('0x59')]['id'],'ContactId':_0x5103be['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xf3ff('0xc7')}]})[_0xf3ff('0x33')](function(_0x37c048){return[_0x37c048,!![]];});});}})[_0xf3ff('0x9c')](function(_0x2dce43,_0x1b1773){if(_0x1b1773){return _0x2dce43;}return db[_0xf3ff('0xc8')][_0xf3ff('0x56')](_['merge'](_0x42cadc[_0xf3ff('0x57')],{'read':![],'body':_0x42cadc[_0xf3ff('0x57')][_0xf3ff('0x57')],'phone':_0x4b5f5f,'SmsAccountId':_0x3ff153['id'],'SmsInteractionId':_0x2dce43['id'],'UserId':_0x42cadc['user']['id'],'ContactId':_0x5103be['id']}))[_0xf3ff('0x33')](function(_0x45d876){_0x2dce43[_0xf3ff('0xc9')][_0xf3ff('0xc7')]=[];_0x2dce43[_0xf3ff('0xc9')][_0xf3ff('0xc7')]['push'](_0x45d876[_0xf3ff('0xc9')]);return _0x2dce43;});})[_0xf3ff('0x33')](respondWithResult(_0x582542,null))[_0xf3ff('0x28')](handleError(_0x582542,null));};exports[_0xf3ff('0x29')]=function(_0x15a2df,_0x24edb0,_0x51a3f6){if(_0x15a2df[_0xf3ff('0x57')]['id']){delete _0x15a2df[_0xf3ff('0x57')]['id'];}var _0x887b67,_0x208f61,_0x31e313;return db[_0xf3ff('0x3d')]['find']({'where':{'id':_0x15a2df['params']['id']}})['then'](handleEntityNotFound(_0x24edb0,null))[_0xf3ff('0x33')](function(_0x2b4668){if(_0x2b4668){_0x31e313=_0x2b4668;logger[_0xf3ff('0x21')](_0xf3ff('0x22'),_0xf3ff('0x29'),_0xf3ff('0xca'),_0x2b4668[_0xf3ff('0x3f')],util[_0xf3ff('0xcb')](_0x15a2df[_0xf3ff('0x57')],{'showHidden':![],'depth':null}));switch(_0x2b4668[_0xf3ff('0x3f')]){case'skebby':if(_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0xcc')]&&_0x15a2df[_0xf3ff('0x57')]['status']){_0x208f61=_0x15a2df['body'][_0xf3ff('0x29')];return db['SmsMessage'][_0xf3ff('0x5b')]({'where':{'messageId':_0x15a2df['body'][_0xf3ff('0xcc')]}});}break;case'connectel':if(_0x15a2df[_0xf3ff('0x57')]['requestid']&&_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0xcd')]){_0x208f61=_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0xcd')];return db[_0xf3ff('0xc8')][_0xf3ff('0x5b')]({'where':{'messageId':_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0xce')]}});}break;case _0xf3ff('0x84'):if(_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x85')]&&_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0xcf')]){_0x208f61=_0x15a2df[_0xf3ff('0x57')]['status_code'];return db[_0xf3ff('0xc8')][_0xf3ff('0x5b')]({'where':{'messageId':_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x85')]}});}break;case'infobip':var _0xa673f6=_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x89')][0x0];if(_0xa673f6[_0xf3ff('0x7f')]&&_0xa673f6[_0xf3ff('0x29')][_0xf3ff('0xd0')]===_0xf3ff('0xd1')){_0x208f61=_0xa673f6[_0xf3ff('0x29')][_0xf3ff('0xd0')];return db[_0xf3ff('0xc8')][_0xf3ff('0x5b')]({'where':{'messageId':_0xa673f6[_0xf3ff('0x7f')]}});}break;case _0xf3ff('0x8c'):if(_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x7f')]&&_0x15a2df[_0xf3ff('0x57')]['status']){_0x208f61=_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x29')];return db['SmsMessage'][_0xf3ff('0x5b')]({'where':{'messageId':_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x7f')]}});}break;case _0xf3ff('0x8f'):if(_0x15a2df[_0xf3ff('0x57')][0x0][_0xf3ff('0x26')]['id']){_0x208f61=_0x15a2df['body'][0x0][_0xf3ff('0x3f')];return db['SmsMessage'][_0xf3ff('0x5b')]({'where':{'messageId':_0x15a2df[_0xf3ff('0x57')][0x0][_0xf3ff('0x26')]['id']}});}break;case _0xf3ff('0x90'):if(_0x15a2df[_0xf3ff('0x57')]['redif']&&_0x15a2df[_0xf3ff('0x57')]['status']){_0x208f61=_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x29')];return db[_0xf3ff('0xc8')][_0xf3ff('0x5b')]({'where':{'messageId':_0x15a2df['body'][_0xf3ff('0xd2')]}});}break;}}})[_0xf3ff('0x33')](handleEntityNotFound(_0x24edb0,null))[_0xf3ff('0x33')](function(_0x22bbae){if(_0x22bbae){_0x887b67=_0x22bbae;switch(_0x31e313[_0xf3ff('0x3f')]){case _0xf3ff('0x81'):if(_0x208f61==='DELIVERED'){return _0x887b67[_0xf3ff('0x32')]({'read':!![]});}else{logger['error'](_0xf3ff('0x22'),_0xf3ff('0x29'),_0xf3ff('0x81'),util['inspect'](_0x15a2df['body'],{'showHidden':![],'depth':null}));}break;case _0xf3ff('0x83'):if(_0x208f61==='1'){return _0x887b67['update']({'read':!![]});}else{logger[_0xf3ff('0x24')](_0xf3ff('0x22'),_0xf3ff('0x29'),_0xf3ff('0x81'),util[_0xf3ff('0xcb')](_0x15a2df[_0xf3ff('0x57')],{'showHidden':![],'depth':null}));}break;case _0xf3ff('0x84'):if(!_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0xd3')]&&_0x208f61>=0xc8&&_0x208f61<=0xce){return _0x887b67[_0xf3ff('0x32')]({'read':!![]});}else{logger[_0xf3ff('0x24')](_0xf3ff('0x22'),'status',_0xf3ff('0x84'),util[_0xf3ff('0xcb')](_0x15a2df[_0xf3ff('0x57')],{'showHidden':![],'depth':null}));}break;case _0xf3ff('0x88'):var _0x5e2be1=_0x15a2df[_0xf3ff('0x57')][_0xf3ff('0x89')][0x0];if(_0x5e2be1[_0xf3ff('0x29')][_0xf3ff('0xd0')]==='DELIVERED'){return _0x887b67['update']({'read':!![]});}else{logger['error'](_0xf3ff('0x22'),'status',_0xf3ff('0x88'),util[_0xf3ff('0xcb')](_0x15a2df[_0xf3ff('0x57')],{'showHidden':![],'depth':null}));}break;case _0xf3ff('0x8c'):if(_0x208f61==_0xf3ff('0xd4')||_0x208f61=='RECEIVED_BY_RECIPIENT'){return _0x887b67['update']({'read':!![]});}else{logger[_0xf3ff('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf3ff('0x29'),'clickatell',util['inspect'](_0x15a2df[_0xf3ff('0x57')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x208f61=='message-delivered'){return _0x887b67['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf3ff('0x29'),_0xf3ff('0x8f'),util[_0xf3ff('0xcb')](_0x15a2df[_0xf3ff('0x57')],{'showHidden':![],'depth':null}));}break;case _0xf3ff('0x90'):if(_0x208f61===_0xf3ff('0xd5')||_0x208f61===_0xf3ff('0xd6')){return _0x887b67[_0xf3ff('0x32')]({'read':!![]});}else{logger[_0xf3ff('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf3ff('0x29'),_0xf3ff('0x90'),util['inspect'](_0x15a2df[_0xf3ff('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x887b67;}})[_0xf3ff('0x33')](respondWithResult(_0x24edb0,null))[_0xf3ff('0x28')](handleError(_0x24edb0,null));};exports[_0xf3ff('0xd7')]=function(_0x477a5f,_0x4b20fb,_0x221549){var _0x4af9ed,_0x590026,_0xe8e12a;return db[_0xf3ff('0x3d')][_0xf3ff('0x5b')]({'where':{'id':_0x477a5f[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x4b20fb,null))[_0xf3ff('0x33')](function(_0x37537b){if(_0x37537b){_0xe8e12a=_0x37537b;logger[_0xf3ff('0x21')](_0xf3ff('0x22'),_0xf3ff('0x29'),'received\x20delivery\x20report\x20from',_0x37537b[_0xf3ff('0x3f')],util['inspect'](_0x477a5f[_0xf3ff('0x41')],{'showHidden':![],'depth':null}));switch(_0x37537b['type']){case _0xf3ff('0x8a'):if(_0x477a5f[_0xf3ff('0x41')][_0xf3ff('0xd8')]&&_0x477a5f[_0xf3ff('0x41')]['state']){_0x590026=_0x477a5f[_0xf3ff('0x41')][_0xf3ff('0xd9')];return db[_0xf3ff('0xc8')]['find']({'where':{'messageId':_0x477a5f[_0xf3ff('0x41')][_0xf3ff('0xd8')]}});}break;}}})[_0xf3ff('0x33')](handleEntityNotFound(_0x4b20fb,null))[_0xf3ff('0x33')](function(_0x2e7b00){if(_0x2e7b00){_0x4af9ed=_0x2e7b00;switch(_0xe8e12a[_0xf3ff('0x3f')]){case _0xf3ff('0x8a'):if(_0x590026==='2'||_0x590026==='6'){return _0x4af9ed[_0xf3ff('0x32')]({'read':!![]});}else{logger[_0xf3ff('0x24')](_0xf3ff('0x22'),_0xf3ff('0x29'),_0xf3ff('0x8a'),util[_0xf3ff('0xcb')](_0x477a5f[_0xf3ff('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x4af9ed;}})[_0xf3ff('0x33')](respondWithResult(_0x4b20fb,null))[_0xf3ff('0x28')](handleError(_0x4b20fb,null));};exports[_0xf3ff('0xda')]=function(_0x10aa91,_0x269147,_0xc58fdf){return db[_0xf3ff('0x3d')][_0xf3ff('0x5b')]({'where':{'id':_0x10aa91[_0xf3ff('0x54')]['id']}})['then'](handleEntityNotFound(_0x269147,null))['then'](function(_0x14b89c){if(_0x14b89c){return _0x14b89c[_0xf3ff('0xda')](_0x10aa91[_0xf3ff('0x57')][_0xf3ff('0x66')],_[_0xf3ff('0x97')](_0x10aa91['body'],['ids','id'])||{})[_0xf3ff('0x9c')](function(_0x441013){for(var _0xde9c82=0x0;_0xde9c82<_0x10aa91[_0xf3ff('0x57')]['ids'][_0xf3ff('0x47')];_0xde9c82+=0x1){socket[_0xf3ff('0xdb')](_0xf3ff('0xdc'),{'UserId':Number(_0x10aa91[_0xf3ff('0x57')][_0xf3ff('0x66')][_0xde9c82]),'SmsAccountId':Number(_0x10aa91[_0xf3ff('0x54')]['id'])});}return _0x441013;});}})[_0xf3ff('0x33')](respondWithResult(_0x269147,null))[_0xf3ff('0x28')](handleError(_0x269147,null));};exports[_0xf3ff('0xdd')]=function(_0x218ad6,_0x51c89b,_0x5ef5ed){return db[_0xf3ff('0x3d')][_0xf3ff('0x5b')]({'where':{'id':_0x218ad6[_0xf3ff('0x54')]['id']}})[_0xf3ff('0x33')](handleEntityNotFound(_0x51c89b,null))[_0xf3ff('0x33')](function(_0x1466ba){if(_0x1466ba){return _0x1466ba[_0xf3ff('0xdd')](_0x218ad6['query'][_0xf3ff('0x66')])['then'](function(){if(_['isArray'](_0x218ad6['query'][_0xf3ff('0x66')])){for(var _0xdc7fc4=0x0;_0xdc7fc4<_0x218ad6[_0xf3ff('0x41')][_0xf3ff('0x66')]['length'];_0xdc7fc4+=0x1){socket['emit'](_0xf3ff('0xde'),{'UserId':Number(_0x218ad6[_0xf3ff('0x41')][_0xf3ff('0x66')][_0xdc7fc4]),'SmsAccountId':Number(_0x218ad6['params']['id'])});}}else{socket[_0xf3ff('0xdb')](_0xf3ff('0xde'),{'UserId':Number(_0x218ad6[_0xf3ff('0x41')][_0xf3ff('0x66')]),'SmsAccountId':Number(_0x218ad6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x51c89b,null))[_0xf3ff('0x28')](handleError(_0x51c89b,null));};exports[_0xf3ff('0xdf')]=function(_0x2b74ff,_0x1e0642,_0x4a44a7){var _0x1eb1be={};var _0x493c2e={};var _0x4ee02e;var _0x51ae3b;return db[_0xf3ff('0x3d')][_0xf3ff('0x69')]({'where':{'id':_0x2b74ff[_0xf3ff('0x54')]['id']}})['then'](handleEntityNotFound(_0x1e0642,null))['then'](function(_0x2b3159){if(_0x2b3159){_0x4ee02e=_0x2b3159;_0x493c2e[_0xf3ff('0x43')]=_[_0xf3ff('0x42')](db[_0xf3ff('0xbb')][_0xf3ff('0x3e')]);_0x493c2e[_0xf3ff('0x41')]=_['keys'](_0x2b74ff[_0xf3ff('0x41')]);_0x493c2e[_0xf3ff('0x4a')]=_[_0xf3ff('0x44')](_0x493c2e[_0xf3ff('0x43')],_0x493c2e[_0xf3ff('0x41')]);_0x1eb1be[_0xf3ff('0x46')]=_[_0xf3ff('0x44')](_0x493c2e[_0xf3ff('0x43')],qs[_0xf3ff('0x45')](_0x2b74ff[_0xf3ff('0x41')][_0xf3ff('0x45')]));_0x1eb1be[_0xf3ff('0x46')]=_0x1eb1be['attributes'][_0xf3ff('0x47')]?_0x1eb1be[_0xf3ff('0x46')]:_0x493c2e[_0xf3ff('0x43')];_0x1eb1be[_0xf3ff('0x49')]=qs['sort'](_0x2b74ff[_0xf3ff('0x41')][_0xf3ff('0x63')]);_0x1eb1be[_0xf3ff('0x4e')]=qs[_0xf3ff('0x4a')](_[_0xf3ff('0x4b')](_0x2b74ff[_0xf3ff('0x41')],_0x493c2e['filters']));if(_0x2b74ff['query']['filter']){_0x1eb1be[_0xf3ff('0x4e')]=_[_0xf3ff('0x4d')](_0x1eb1be['where'],{'$or':_[_0xf3ff('0x3c')](_0x1eb1be[_0xf3ff('0x46')],function(_0x2e05db){var _0x7ee8e7={};_0x7ee8e7[_0x2e05db]={'$like':'%'+_0x2b74ff[_0xf3ff('0x41')][_0xf3ff('0x4c')]+'%'};return _0x7ee8e7;})});}_0x1eb1be=_[_0xf3ff('0x4d')]({},_0x1eb1be,_0x2b74ff[_0xf3ff('0x4f')]);return _0x4ee02e[_0xf3ff('0xdf')](_0x1eb1be);}})['then'](function(_0x110f85){if(_0x110f85){_0x51ae3b=_0x110f85['length'];if(!_0x2b74ff[_0xf3ff('0x41')][_0xf3ff('0x48')](_0xf3ff('0x62'))){_0x1eb1be[_0xf3ff('0x2e')]=qs[_0xf3ff('0x2e')](_0x2b74ff[_0xf3ff('0x41')][_0xf3ff('0x2e')]);_0x1eb1be[_0xf3ff('0x2c')]=qs[_0xf3ff('0x2c')](_0x2b74ff[_0xf3ff('0x41')][_0xf3ff('0x2c')]);}return _0x4ee02e[_0xf3ff('0xdf')](_0x1eb1be);}})[_0xf3ff('0x33')](function(_0x582f41){if(_0x582f41){return _0x582f41?{'count':_0x51ae3b,'rows':_0x582f41}:null;}})[_0xf3ff('0x33')](respondWithResult(_0x1e0642,null))[_0xf3ff('0x28')](handleError(_0x1e0642,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2925f58..51da874 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 _0xe4a9=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4e8d6e,_0xa587c8){var _0x1beecd=function(_0x34ce27){while(--_0x34ce27){_0x4e8d6e['push'](_0x4e8d6e['shift']());}};_0x1beecd(++_0xa587c8);}(_0xe4a9,0xcf));var _0x9e4a=function(_0x27e7e2,_0x3ddb8a){_0x27e7e2=_0x27e7e2-0x0;var _0x55431f=_0xe4a9[_0x27e7e2];return _0x55431f;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x9e4a('0x0'))['db'][_0x9e4a('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9e4a('0x2')](0x0);var events={'afterCreate':_0x9e4a('0x3'),'afterUpdate':_0x9e4a('0x4'),'afterDestroy':_0x9e4a('0x5')};function emitEvent(_0x465bbd){return function(_0x1db18f,_0x2c5eba,_0x1509e1){SmsAccountEvents[_0x9e4a('0x6')](_0x465bbd+':'+_0x1db18f['id'],_0x1db18f);SmsAccountEvents[_0x9e4a('0x6')](_0x465bbd,_0x1db18f);_0x1509e1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x9e4a('0x7')](e,emitEvent(event));}}module[_0x9e4a('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x59fe=['../../mysqldb','SmsAccount','setMaxListeners','remove','emit','hook','events'];(function(_0x499e07,_0xc3e76a){var _0x388db7=function(_0x44e450){while(--_0x44e450){_0x499e07['push'](_0x499e07['shift']());}};_0x388db7(++_0xc3e76a);}(_0x59fe,0xca));var _0xe59f=function(_0x5006d5,_0x1f7744){_0x5006d5=_0x5006d5-0x0;var _0x52963a=_0x59fe[_0x5006d5];return _0x52963a;};'use strict';var EventEmitter=require(_0xe59f('0x0'));var SmsAccount=require(_0xe59f('0x1'))['db'][_0xe59f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe59f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe59f('0x4')};function emitEvent(_0x7cccea){return function(_0x50c6fe,_0x3fd775,_0x437340){SmsAccountEvents[_0xe59f('0x5')](_0x7cccea+':'+_0x50c6fe['id'],_0x50c6fe);SmsAccountEvents['emit'](_0x7cccea,_0x50c6fe);_0x437340(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xe59f('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d64c564..832adf2 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 _0x1537=['./smsAccount.attributes','exports','SmsAccount','lodash','util','api','path','rimraf'];(function(_0x162ee0,_0x291661){var _0x48fc5e=function(_0x297a35){while(--_0x297a35){_0x162ee0['push'](_0x162ee0['shift']());}};_0x48fc5e(++_0x291661);}(_0x1537,0x83));var _0x7153=function(_0x2ae282,_0x2e68cb){_0x2ae282=_0x2ae282-0x0;var _0x982c98=_0x1537[_0x2ae282];return _0x982c98;};'use strict';var _=require(_0x7153('0x0'));var util=require(_0x7153('0x1'));var logger=require('../../config/logger')(_0x7153('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7153('0x3'));var rimraf=require(_0x7153('0x4'));var config=require('../../config/environment');var attributes=require(_0x7153('0x5'));module[_0x7153('0x6')]=function(_0x19b587,_0x53f3c1){return _0x19b587['define'](_0x7153('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee01=['exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','./smsAccount.attributes'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0xee01,0xa3));var _0x1ee0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xee01[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1ee0('0x0'));var util=require(_0x1ee0('0x1'));var logger=require(_0x1ee0('0x2'))('api');var moment=require(_0x1ee0('0x3'));var BPromise=require(_0x1ee0('0x4'));var rp=require(_0x1ee0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ee0('0x6'));module[_0x1ee0('0x7')]=function(_0x3d0e77,_0x462a58){return _0x3d0e77['define'](_0x1ee0('0x8'),attributes,{'tableName':_0x1ee0('0x9'),'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 8950ade..1b0b586 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 _0xb5d2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsAccount','options','raw','where','attributes','include','map','model','ShowSmsAccount','lodash'];(function(_0x53b9e2,_0x5e3769){var _0x4cf430=function(_0x1fd66e){while(--_0x1fd66e){_0x53b9e2['push'](_0x53b9e2['shift']());}};_0x4cf430(++_0x5e3769);}(_0xb5d2,0x196));var _0x2b5d=function(_0x3f381b,_0x2503a1){_0x3f381b=_0x3f381b-0x0;var _0x18a49c=_0xb5d2[_0x3f381b];return _0x18a49c;};'use strict';var _=require(_0x2b5d('0x0'));var util=require('util');var moment=require(_0x2b5d('0x1'));var BPromise=require(_0x2b5d('0x2'));var rs=require(_0x2b5d('0x3'));var fs=require('fs');var Redis=require(_0x2b5d('0x4'));var db=require(_0x2b5d('0x5'))['db'];var utils=require(_0x2b5d('0x6'));var logger=require(_0x2b5d('0x7'))(_0x2b5d('0x8'));var config=require('../../config/environment');var jayson=require(_0x2b5d('0x9'));var client=jayson[_0x2b5d('0xa')][_0x2b5d('0xb')]({'port':0x232a});config[_0x2b5d('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2b5d('0xd'))(new Redis(config[_0x2b5d('0xc')]));require(_0x2b5d('0xe'))[_0x2b5d('0xf')](socket);function respondWithRpcPromise(_0x11de7e,_0x230f2b,_0x301b36){return new BPromise(function(_0x47b2c9,_0x4d9ef9){return client[_0x2b5d('0x10')](_0x11de7e,_0x301b36)[_0x2b5d('0x11')](function(_0x33125f){logger[_0x2b5d('0x12')](_0x2b5d('0x13'),_0x230f2b,_0x2b5d('0x14'));logger[_0x2b5d('0x15')](_0x2b5d('0x16'),_0x230f2b,'request\x20sent',JSON[_0x2b5d('0x17')](_0x33125f));if(_0x33125f[_0x2b5d('0x18')]){if(_0x33125f[_0x2b5d('0x18')]['code']===0x1f4){logger[_0x2b5d('0x18')](_0x2b5d('0x13'),_0x230f2b,_0x33125f[_0x2b5d('0x18')][_0x2b5d('0x19')]);return _0x4d9ef9(_0x33125f['error'][_0x2b5d('0x19')]);}logger[_0x2b5d('0x18')]('SmsAccount,\x20%s,\x20%s',_0x230f2b,_0x33125f[_0x2b5d('0x18')]['message']);return _0x47b2c9(_0x33125f[_0x2b5d('0x18')][_0x2b5d('0x19')]);}else{logger[_0x2b5d('0x12')](_0x2b5d('0x13'),_0x230f2b,_0x2b5d('0x14'));_0x47b2c9(_0x33125f[_0x2b5d('0x1a')][_0x2b5d('0x19')]);}})[_0x2b5d('0x1b')](function(_0x14847b){logger['error'](_0x2b5d('0x13'),_0x230f2b,_0x14847b);_0x4d9ef9(_0x14847b);});});}exports['ShowSmsAccount']=function(_0x5145ee){var _0x6a2ff2=this;return new Promise(function(_0x4edda8,_0x1d8515){return db[_0x2b5d('0x1c')]['find']({'raw':_0x5145ee[_0x2b5d('0x1d')]?_0x5145ee[_0x2b5d('0x1d')][_0x2b5d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5145ee[_0x2b5d('0x1d')]?_0x5145ee[_0x2b5d('0x1d')][_0x2b5d('0x1f')]||null:null,'attributes':_0x5145ee[_0x2b5d('0x1d')]?_0x5145ee[_0x2b5d('0x1d')][_0x2b5d('0x20')]||null:null,'include':_0x5145ee[_0x2b5d('0x1d')]?_0x5145ee[_0x2b5d('0x1d')][_0x2b5d('0x21')]?_[_0x2b5d('0x22')](_0x5145ee[_0x2b5d('0x1d')][_0x2b5d('0x21')],function(_0x24d593){return{'model':db[_0x24d593[_0x2b5d('0x23')]],'as':_0x24d593['as'],'attributes':_0x24d593[_0x2b5d('0x20')],'include':_0x24d593[_0x2b5d('0x21')]?_[_0x2b5d('0x22')](_0x24d593['include'],function(_0x396af7){return{'model':db[_0x396af7[_0x2b5d('0x23')]],'as':_0x396af7['as'],'attributes':_0x396af7['attributes'],'include':_0x396af7[_0x2b5d('0x21')]?_[_0x2b5d('0x22')](_0x396af7[_0x2b5d('0x21')],function(_0x50a0cd){return{'model':db[_0x50a0cd[_0x2b5d('0x23')]],'as':_0x50a0cd['as'],'attributes':_0x50a0cd[_0x2b5d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2b5d('0x11')](function(_0x19fbb0){logger[_0x2b5d('0x12')](_0x2b5d('0x24'),_0x5145ee);logger[_0x2b5d('0x15')](_0x2b5d('0x24'),_0x5145ee,JSON[_0x2b5d('0x17')](_0x19fbb0));_0x4edda8(_0x19fbb0);})[_0x2b5d('0x1b')](function(_0x593cb8){logger[_0x2b5d('0x18')](_0x2b5d('0x24'),_0x593cb8['message'],_0x5145ee);_0x1d8515(_0x6a2ff2[_0x2b5d('0x18')](0x1f4,_0x593cb8['message']));});});}; \ No newline at end of file +var _0xfeea=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./smsAccount.socket','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','find','options','raw','include','map','attributes','then','ShowSmsAccount','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x6fae5a,_0x24f017){var _0x461da6=function(_0xa260fa){while(--_0xa260fa){_0x6fae5a['push'](_0x6fae5a['shift']());}};_0x461da6(++_0x24f017);}(_0xfeea,0x1ae));var _0xafee=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0xfeea[_0x743701];return _0x5a141d;};'use strict';var _=require(_0xafee('0x0'));var util=require(_0xafee('0x1'));var moment=require('moment');var BPromise=require(_0xafee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafee('0x3'))['db'];var utils=require(_0xafee('0x4'));var logger=require(_0xafee('0x5'))(_0xafee('0x6'));var config=require(_0xafee('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xafee('0x8')]({'port':0x232a});config[_0xafee('0x9')]=_['defaults'](config[_0xafee('0x9')],{'host':_0xafee('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xafee('0x9')]));require(_0xafee('0xb'))[_0xafee('0xc')](socket);function respondWithRpcPromise(_0x2bb7b9,_0x3c6985,_0x5799c0){return new BPromise(function(_0x1d89e6,_0x280c4a){return client['request'](_0x2bb7b9,_0x5799c0)['then'](function(_0x77807a){logger[_0xafee('0xd')](_0xafee('0xe'),_0x3c6985,_0xafee('0xf'));logger[_0xafee('0x10')](_0xafee('0x11'),_0x3c6985,_0xafee('0xf'),JSON[_0xafee('0x12')](_0x77807a));if(_0x77807a[_0xafee('0x13')]){if(_0x77807a['error'][_0xafee('0x14')]===0x1f4){logger['error'](_0xafee('0xe'),_0x3c6985,_0x77807a[_0xafee('0x13')][_0xafee('0x15')]);return _0x280c4a(_0x77807a[_0xafee('0x13')][_0xafee('0x15')]);}logger[_0xafee('0x13')]('SmsAccount,\x20%s,\x20%s',_0x3c6985,_0x77807a['error'][_0xafee('0x15')]);return _0x1d89e6(_0x77807a[_0xafee('0x13')][_0xafee('0x15')]);}else{logger[_0xafee('0xd')]('SmsAccount,\x20%s,\x20%s',_0x3c6985,_0xafee('0xf'));_0x1d89e6(_0x77807a['result'][_0xafee('0x15')]);}})['catch'](function(_0x38c6df){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3c6985,_0x38c6df);_0x280c4a(_0x38c6df);});});}exports['ShowSmsAccount']=function(_0x4401f2){var _0x1708e2=this;return new Promise(function(_0x105a47,_0x24cead){return db['SmsAccount'][_0xafee('0x16')]({'raw':_0x4401f2['options']?_0x4401f2[_0xafee('0x17')][_0xafee('0x18')]===undefined?!![]:![]:!![],'where':_0x4401f2['options']?_0x4401f2['options']['where']||null:null,'attributes':_0x4401f2['options']?_0x4401f2[_0xafee('0x17')]['attributes']||null:null,'include':_0x4401f2['options']?_0x4401f2[_0xafee('0x17')][_0xafee('0x19')]?_[_0xafee('0x1a')](_0x4401f2['options'][_0xafee('0x19')],function(_0x1fffa7){return{'model':db[_0x1fffa7['model']],'as':_0x1fffa7['as'],'attributes':_0x1fffa7[_0xafee('0x1b')],'include':_0x1fffa7[_0xafee('0x19')]?_[_0xafee('0x1a')](_0x1fffa7[_0xafee('0x19')],function(_0x5badaa){return{'model':db[_0x5badaa['model']],'as':_0x5badaa['as'],'attributes':_0x5badaa['attributes'],'include':_0x5badaa[_0xafee('0x19')]?_[_0xafee('0x1a')](_0x5badaa[_0xafee('0x19')],function(_0x19a12d){return{'model':db[_0x19a12d['model']],'as':_0x19a12d['as'],'attributes':_0x19a12d[_0xafee('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xafee('0x1c')](function(_0x3ed34e){logger[_0xafee('0xd')](_0xafee('0x1d'),_0x4401f2);logger['debug']('ShowSmsAccount',_0x4401f2,JSON[_0xafee('0x12')](_0x3ed34e));_0x105a47(_0x3ed34e);})[_0xafee('0x1e')](function(_0x4dde62){logger['error'](_0xafee('0x1d'),_0x4dde62['message'],_0x4401f2);_0x24cead(_0x1708e2[_0xafee('0x13')](0x1f4,_0x4dde62['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 08b46f1..e56824c 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 4d37865..a9feecd 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x332146,_0x3ae694){var _0x3b78a1=function(_0x177704){while(--_0x177704){_0x332146['push'](_0x332146['shift']());}};_0x3b78a1(++_0x3ae694);}(_0xedd9,0xfc));var _0x9edd=function(_0xbdbdf0,_0x16aec3){_0xbdbdf0=_0xbdbdf0-0x0;var _0x1097df=_0xedd9[_0xbdbdf0];return _0x1097df;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24e3f0,_0x291458){var _0x36b770=function(_0xc2ccf7){while(--_0xc2ccf7){_0x24e3f0['push'](_0x24e3f0['shift']());}};_0x36b770(++_0x291458);}(_0x34e8,0x12c));var _0x834e=function(_0x33eaf6,_0x508049){_0x33eaf6=_0x33eaf6-0x0;var _0x4e6e4d=_0x34e8[_0x33eaf6];return _0x4e6e4d;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b764d70..93a759d 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 _0xba93=['noop','TEXT','exports','INTEGER','STRING'];(function(_0x45b3b7,_0x2b645e){var _0x2849dd=function(_0x2e79bd){while(--_0x2e79bd){_0x45b3b7['push'](_0x45b3b7['shift']());}};_0x2849dd(++_0x2b645e);}(_0xba93,0x1e2));var _0x3ba9=function(_0x70b97a,_0xe4f9f9){_0x70b97a=_0x70b97a-0x0;var _0x32242b=_0xba93[_0x70b97a];return _0x32242b;};'use strict';var Sequelize=require('sequelize');module[_0x3ba9('0x0')]={'priority':{'type':Sequelize[_0x3ba9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3ba9('0x2')],'allowNull':![],'defaultValue':_0x3ba9('0x3')},'appdata':{'type':Sequelize[_0x3ba9('0x4')]()},'description':{'type':Sequelize[_0x3ba9('0x2')]},'interval':{'type':Sequelize[_0x3ba9('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x99af=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x278fe2,_0x3cdb63){var _0x3464a0=function(_0x2f327e){while(--_0x2f327e){_0x278fe2['push'](_0x278fe2['shift']());}};_0x3464a0(++_0x3cdb63);}(_0x99af,0x13c));var _0xf99a=function(_0x2907de,_0x25a671){_0x2907de=_0x2907de-0x0;var _0xb4fa37=_0x99af[_0x2907de];return _0xb4fa37;};'use strict';var Sequelize=require(_0xf99a('0x0'));module[_0xf99a('0x1')]={'priority':{'type':Sequelize[_0xf99a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf99a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf99a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf99a('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2c3486a..86f537e 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 _0x5f46=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','name','send','index','SmsApplication','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util'];(function(_0x5da6f4,_0x2587a3){var _0x4d1954=function(_0x58bdfb){while(--_0x58bdfb){_0x5da6f4['push'](_0x5da6f4['shift']());}};_0x4d1954(++_0x2587a3);}(_0x5f46,0x19f));var _0x65f4=function(_0x11e094,_0x1562c9){_0x11e094=_0x11e094-0x0;var _0x2f507f=_0x5f46[_0x11e094];return _0x2f507f;};'use strict';var emlformat=require(_0x65f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f4('0x1'));var jsonpatch=require(_0x65f4('0x2'));var rp=require(_0x65f4('0x3'));var moment=require(_0x65f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65f4('0x5'));var util=require(_0x65f4('0x6'));var path=require(_0x65f4('0x7'));var sox=require(_0x65f4('0x8'));var csv=require('to-csv');var ejs=require(_0x65f4('0x9'));var fs=require('fs');var fs_extra=require(_0x65f4('0xa'));var _=require(_0x65f4('0xb'));var squel=require('squel');var crypto=require(_0x65f4('0xc'));var jsforce=require(_0x65f4('0xd'));var deskjs=require(_0x65f4('0xe'));var toCsv=require(_0x65f4('0xf'));var querystring=require('querystring');var Papa=require(_0x65f4('0x10'));var Redis=require('ioredis');var authService=require(_0x65f4('0x11'));var qs=require(_0x65f4('0x12'));var as=require(_0x65f4('0x13'));var hardwareService=require(_0x65f4('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x65f4('0x15'));var licenseUtil=require(_0x65f4('0x16'));var db=require(_0x65f4('0x17'))['db'];function respondWithStatusCode(_0x201bd3,_0x5169c7){_0x5169c7=_0x5169c7||0xcc;return function(_0x404218){if(_0x404218){return _0x201bd3[_0x65f4('0x18')](_0x5169c7);}return _0x201bd3[_0x65f4('0x19')](_0x5169c7)[_0x65f4('0x1a')]();};}function respondWithResult(_0x2b782e,_0x29c4d0){_0x29c4d0=_0x29c4d0||0xc8;return function(_0x5ac340){if(_0x5ac340){return _0x2b782e[_0x65f4('0x19')](_0x29c4d0)[_0x65f4('0x1b')](_0x5ac340);}};}function respondWithFilteredResult(_0x1b91e3,_0x58c7bc){return function(_0xd69864){if(_0xd69864){var _0x6637fe=typeof _0x58c7bc[_0x65f4('0x1c')]===_0x65f4('0x1d')&&typeof _0x58c7bc[_0x65f4('0x1e')]===_0x65f4('0x1d');var _0x255cb4=_0xd69864[_0x65f4('0x1f')];var _0x234ee6=_0x6637fe?0x0:_0x58c7bc['offset'];var _0x43b33e=_0x6637fe?_0xd69864[_0x65f4('0x1f')]:_0x58c7bc[_0x65f4('0x1c')]+_0x58c7bc[_0x65f4('0x1e')];var _0x1f7ac5;if(_0x43b33e>=_0x255cb4){_0x43b33e=_0x255cb4;_0x1f7ac5=0xc8;}else{_0x1f7ac5=0xce;}_0x1b91e3['status'](_0x1f7ac5);return _0x1b91e3[_0x65f4('0x20')](_0x65f4('0x21'),_0x234ee6+'-'+_0x43b33e+'/'+_0x255cb4)[_0x65f4('0x1b')](_0xd69864);}return null;};}function patchUpdates(_0x260cc3){return function(_0x3c8e14){try{jsonpatch['apply'](_0x3c8e14,_0x260cc3,!![]);}catch(_0x100403){return BPromise[_0x65f4('0x22')](_0x100403);}return _0x3c8e14['save']();};}function saveUpdates(_0x1763df,_0x4f6b2a){return function(_0x18a925){if(_0x18a925){return _0x18a925[_0x65f4('0x23')](_0x1763df)['then'](function(_0x4f6010){return _0x4f6010;});}return null;};}function removeEntity(_0xe2abdd,_0x2d39a8){return function(_0x2a9bd7){if(_0x2a9bd7){return _0x2a9bd7['destroy']()['then'](function(){_0xe2abdd[_0x65f4('0x19')](0xcc)[_0x65f4('0x1a')]();});}};}function handleEntityNotFound(_0x373cf4,_0x4a912c){return function(_0x23f5d8){if(!_0x23f5d8){_0x373cf4[_0x65f4('0x18')](0x194);}return _0x23f5d8;};}function handleError(_0x1b529f,_0x2efe42){_0x2efe42=_0x2efe42||0x1f4;return function(_0x454d0){logger['error'](_0x454d0['stack']);if(_0x454d0[_0x65f4('0x24')]){delete _0x454d0[_0x65f4('0x24')];}_0x1b529f[_0x65f4('0x19')](_0x2efe42)[_0x65f4('0x25')](_0x454d0);};}exports[_0x65f4('0x26')]=function(_0x547d6f,_0x2f4e6a){var _0x3be3c4={},_0x34c3c2={},_0x4a0931={'count':0x0,'rows':[]};var _0x2aee10=_['map'](db[_0x65f4('0x27')][_0x65f4('0x28')],function(_0x30a175){return{'name':_0x30a175['fieldName'],'type':_0x30a175[_0x65f4('0x29')][_0x65f4('0x2a')]};});_0x34c3c2[_0x65f4('0x2b')]=_[_0x65f4('0x2c')](_0x2aee10,'name');_0x34c3c2[_0x65f4('0x2d')]=_['keys'](_0x547d6f[_0x65f4('0x2d')]);_0x34c3c2[_0x65f4('0x2e')]=_['intersection'](_0x34c3c2['model'],_0x34c3c2[_0x65f4('0x2d')]);_0x3be3c4[_0x65f4('0x2f')]=_[_0x65f4('0x30')](_0x34c3c2['model'],qs['fields'](_0x547d6f[_0x65f4('0x2d')][_0x65f4('0x31')]));_0x3be3c4[_0x65f4('0x2f')]=_0x3be3c4[_0x65f4('0x2f')][_0x65f4('0x32')]?_0x3be3c4[_0x65f4('0x2f')]:_0x34c3c2[_0x65f4('0x2b')];if(!_0x547d6f['query'][_0x65f4('0x33')](_0x65f4('0x34'))){_0x3be3c4[_0x65f4('0x1e')]=qs[_0x65f4('0x1e')](_0x547d6f[_0x65f4('0x2d')]['limit']);_0x3be3c4['offset']=qs[_0x65f4('0x1c')](_0x547d6f[_0x65f4('0x2d')]['offset']);}_0x3be3c4[_0x65f4('0x35')]=qs[_0x65f4('0x36')](_0x547d6f[_0x65f4('0x2d')]['sort']);_0x3be3c4['where']=qs[_0x65f4('0x2e')](_[_0x65f4('0x37')](_0x547d6f[_0x65f4('0x2d')],_0x34c3c2[_0x65f4('0x2e')]),_0x2aee10);if(_0x547d6f[_0x65f4('0x2d')][_0x65f4('0x38')]){_0x3be3c4[_0x65f4('0x39')]=_[_0x65f4('0x3a')](_0x3be3c4['where'],{'$or':_['map'](_0x2aee10,function(_0x453f17){if(_0x453f17[_0x65f4('0x29')]!==_0x65f4('0x3b')){var _0x4e3566={};_0x4e3566[_0x453f17[_0x65f4('0x24')]]={'$like':'%'+_0x547d6f[_0x65f4('0x2d')][_0x65f4('0x38')]+'%'};return _0x4e3566;}})});}_0x3be3c4=_[_0x65f4('0x3a')]({},_0x3be3c4,_0x547d6f[_0x65f4('0x3c')]);var _0x40a4fa={'where':_0x3be3c4['where']};return db['SmsApplication'][_0x65f4('0x1f')](_0x40a4fa)[_0x65f4('0x3d')](function(_0x3df903){_0x4a0931[_0x65f4('0x1f')]=_0x3df903;if(_0x547d6f[_0x65f4('0x2d')][_0x65f4('0x3e')]){_0x3be3c4[_0x65f4('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0x65f4('0x40')](_0x3be3c4);})[_0x65f4('0x3d')](function(_0x3979a9){_0x4a0931[_0x65f4('0x41')]=_0x3979a9;return _0x4a0931;})['then'](respondWithFilteredResult(_0x2f4e6a,_0x3be3c4))['catch'](handleError(_0x2f4e6a,null));};exports[_0x65f4('0x42')]=function(_0x1bd779,_0xa837cc){var _0x3be979={'raw':!![],'where':{'id':_0x1bd779[_0x65f4('0x43')]['id']}},_0x2d3f70={};_0x2d3f70[_0x65f4('0x2b')]=_['keys'](db[_0x65f4('0x27')][_0x65f4('0x28')]);_0x2d3f70[_0x65f4('0x2d')]=_['keys'](_0x1bd779[_0x65f4('0x2d')]);_0x2d3f70[_0x65f4('0x2e')]=_['intersection'](_0x2d3f70[_0x65f4('0x2b')],_0x2d3f70[_0x65f4('0x2d')]);_0x3be979[_0x65f4('0x2f')]=_['intersection'](_0x2d3f70['model'],qs[_0x65f4('0x31')](_0x1bd779['query'][_0x65f4('0x31')]));_0x3be979[_0x65f4('0x2f')]=_0x3be979[_0x65f4('0x2f')][_0x65f4('0x32')]?_0x3be979[_0x65f4('0x2f')]:_0x2d3f70['model'];if(_0x1bd779[_0x65f4('0x2d')][_0x65f4('0x3e')]){_0x3be979[_0x65f4('0x3f')]=[{'all':!![]}];}_0x3be979=_['merge']({},_0x3be979,_0x1bd779['options']);return db[_0x65f4('0x27')][_0x65f4('0x44')](_0x3be979)[_0x65f4('0x3d')](handleEntityNotFound(_0xa837cc,null))['then'](respondWithResult(_0xa837cc,null))[_0x65f4('0x45')](handleError(_0xa837cc,null));};exports['create']=function(_0x2655c4,_0x525858){return db[_0x65f4('0x27')][_0x65f4('0x46')](_0x2655c4[_0x65f4('0x47')],{})['then'](respondWithResult(_0x525858,0xc9))[_0x65f4('0x45')](handleError(_0x525858,null));};exports[_0x65f4('0x23')]=function(_0x34984e,_0xf8a24a){if(_0x34984e[_0x65f4('0x47')]['id']){delete _0x34984e[_0x65f4('0x47')]['id'];}return db[_0x65f4('0x27')][_0x65f4('0x44')]({'where':{'id':_0x34984e[_0x65f4('0x43')]['id']}})[_0x65f4('0x3d')](handleEntityNotFound(_0xf8a24a,null))[_0x65f4('0x3d')](saveUpdates(_0x34984e['body'],null))['then'](respondWithResult(_0xf8a24a,null))['catch'](handleError(_0xf8a24a,null));};exports[_0x65f4('0x48')]=function(_0x12c506,_0x1c1129){return db[_0x65f4('0x27')][_0x65f4('0x44')]({'where':{'id':_0x12c506[_0x65f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c1129,null))[_0x65f4('0x3d')](removeEntity(_0x1c1129,null))[_0x65f4('0x45')](handleError(_0x1c1129,null));}; \ No newline at end of file +var _0x1df6=['Content-Range','json','apply','reject','save','update','destroy','then','stack','index','map','SmsApplication','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','show','params','filters','includeAll','find','catch','create','body','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset'];(function(_0x3664ab,_0x45c71c){var _0x31f1fe=function(_0x584636){while(--_0x584636){_0x3664ab['push'](_0x3664ab['shift']());}};_0x31f1fe(++_0x45c71c);}(_0x1df6,0x19b));var _0x61df=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1df6[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61df('0x0'));var jsonpatch=require(_0x61df('0x1'));var rp=require(_0x61df('0x2'));var moment=require(_0x61df('0x3'));var BPromise=require(_0x61df('0x4'));var Mustache=require(_0x61df('0x5'));var util=require(_0x61df('0x6'));var path=require(_0x61df('0x7'));var sox=require(_0x61df('0x8'));var csv=require(_0x61df('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61df('0xa'));var _=require(_0x61df('0xb'));var squel=require(_0x61df('0xc'));var crypto=require('crypto');var jsforce=require(_0x61df('0xd'));var deskjs=require(_0x61df('0xe'));var toCsv=require(_0x61df('0x9'));var querystring=require(_0x61df('0xf'));var Papa=require(_0x61df('0x10'));var Redis=require(_0x61df('0x11'));var authService=require(_0x61df('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x61df('0x13'));var hardwareService=require(_0x61df('0x14'));var logger=require(_0x61df('0x15'))(_0x61df('0x16'));var utils=require(_0x61df('0x17'));var config=require(_0x61df('0x18'));var licenseUtil=require(_0x61df('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9c0e53,_0x366ca0){_0x366ca0=_0x366ca0||0xcc;return function(_0x1fa474){if(_0x1fa474){return _0x9c0e53[_0x61df('0x1a')](_0x366ca0);}return _0x9c0e53[_0x61df('0x1b')](_0x366ca0)[_0x61df('0x1c')]();};}function respondWithResult(_0x3249ea,_0x28e55d){_0x28e55d=_0x28e55d||0xc8;return function(_0x448b14){if(_0x448b14){return _0x3249ea['status'](_0x28e55d)['json'](_0x448b14);}};}function respondWithFilteredResult(_0x4f2817,_0x5204b5){return function(_0x9440e3){if(_0x9440e3){var _0x3194e0=typeof _0x5204b5['offset']==='undefined'&&typeof _0x5204b5[_0x61df('0x1d')]===_0x61df('0x1e');var _0x1ef818=_0x9440e3[_0x61df('0x1f')];var _0x5b5645=_0x3194e0?0x0:_0x5204b5['offset'];var _0x32a9d4=_0x3194e0?_0x9440e3[_0x61df('0x1f')]:_0x5204b5[_0x61df('0x20')]+_0x5204b5['limit'];var _0x20f05f;if(_0x32a9d4>=_0x1ef818){_0x32a9d4=_0x1ef818;_0x20f05f=0xc8;}else{_0x20f05f=0xce;}_0x4f2817['status'](_0x20f05f);return _0x4f2817['set'](_0x61df('0x21'),_0x5b5645+'-'+_0x32a9d4+'/'+_0x1ef818)[_0x61df('0x22')](_0x9440e3);}return null;};}function patchUpdates(_0x4d4b81){return function(_0x192044){try{jsonpatch[_0x61df('0x23')](_0x192044,_0x4d4b81,!![]);}catch(_0x1273ed){return BPromise[_0x61df('0x24')](_0x1273ed);}return _0x192044[_0x61df('0x25')]();};}function saveUpdates(_0x2bdbe4,_0x471fb1){return function(_0x1a63b9){if(_0x1a63b9){return _0x1a63b9[_0x61df('0x26')](_0x2bdbe4)['then'](function(_0x3cd1e4){return _0x3cd1e4;});}return null;};}function removeEntity(_0x30b381,_0x3e1357){return function(_0x2a2d4c){if(_0x2a2d4c){return _0x2a2d4c[_0x61df('0x27')]()[_0x61df('0x28')](function(){_0x30b381[_0x61df('0x1b')](0xcc)[_0x61df('0x1c')]();});}};}function handleEntityNotFound(_0x23b2de,_0x468614){return function(_0xbcb607){if(!_0xbcb607){_0x23b2de[_0x61df('0x1a')](0x194);}return _0xbcb607;};}function handleError(_0x480b8c,_0x521cff){_0x521cff=_0x521cff||0x1f4;return function(_0x4cd18b){logger['error'](_0x4cd18b[_0x61df('0x29')]);if(_0x4cd18b['name']){delete _0x4cd18b['name'];}_0x480b8c[_0x61df('0x1b')](_0x521cff)['send'](_0x4cd18b);};}exports[_0x61df('0x2a')]=function(_0x599fc2,_0xd7f4aa){var _0x419d23={},_0x196a30={},_0x40409d={'count':0x0,'rows':[]};var _0xe03548=_[_0x61df('0x2b')](db[_0x61df('0x2c')]['rawAttributes'],function(_0x1c75fc){return{'name':_0x1c75fc[_0x61df('0x2d')],'type':_0x1c75fc[_0x61df('0x2e')][_0x61df('0x2f')]};});_0x196a30[_0x61df('0x30')]=_[_0x61df('0x2b')](_0xe03548,_0x61df('0x31'));_0x196a30[_0x61df('0x32')]=_[_0x61df('0x33')](_0x599fc2[_0x61df('0x32')]);_0x196a30['filters']=_[_0x61df('0x34')](_0x196a30['model'],_0x196a30[_0x61df('0x32')]);_0x419d23[_0x61df('0x35')]=_[_0x61df('0x34')](_0x196a30['model'],qs[_0x61df('0x36')](_0x599fc2[_0x61df('0x32')][_0x61df('0x36')]));_0x419d23[_0x61df('0x35')]=_0x419d23[_0x61df('0x35')][_0x61df('0x37')]?_0x419d23[_0x61df('0x35')]:_0x196a30['model'];if(!_0x599fc2[_0x61df('0x32')][_0x61df('0x38')](_0x61df('0x39'))){_0x419d23['limit']=qs[_0x61df('0x1d')](_0x599fc2[_0x61df('0x32')][_0x61df('0x1d')]);_0x419d23[_0x61df('0x20')]=qs[_0x61df('0x20')](_0x599fc2['query'][_0x61df('0x20')]);}_0x419d23[_0x61df('0x3a')]=qs[_0x61df('0x3b')](_0x599fc2[_0x61df('0x32')]['sort']);_0x419d23[_0x61df('0x3c')]=qs['filters'](_[_0x61df('0x3d')](_0x599fc2[_0x61df('0x32')],_0x196a30['filters']),_0xe03548);if(_0x599fc2[_0x61df('0x32')][_0x61df('0x3e')]){_0x419d23[_0x61df('0x3c')]=_[_0x61df('0x3f')](_0x419d23['where'],{'$or':_[_0x61df('0x2b')](_0xe03548,function(_0x150de2){if(_0x150de2[_0x61df('0x2e')]!==_0x61df('0x40')){var _0x57fcac={};_0x57fcac[_0x150de2[_0x61df('0x31')]]={'$like':'%'+_0x599fc2['query'][_0x61df('0x3e')]+'%'};return _0x57fcac;}})});}_0x419d23=_[_0x61df('0x3f')]({},_0x419d23,_0x599fc2['options']);var _0x3e6589={'where':_0x419d23['where']};return db[_0x61df('0x2c')][_0x61df('0x1f')](_0x3e6589)[_0x61df('0x28')](function(_0x12e3ea){_0x40409d[_0x61df('0x1f')]=_0x12e3ea;if(_0x599fc2['query']['includeAll']){_0x419d23[_0x61df('0x41')]=[{'all':!![]}];}return db[_0x61df('0x2c')]['findAll'](_0x419d23);})['then'](function(_0x40fbd6){_0x40409d['rows']=_0x40fbd6;return _0x40409d;})[_0x61df('0x28')](respondWithFilteredResult(_0xd7f4aa,_0x419d23))['catch'](handleError(_0xd7f4aa,null));};exports[_0x61df('0x42')]=function(_0xd54ae4,_0x1d48eb){var _0x47b1e1={'raw':!![],'where':{'id':_0xd54ae4[_0x61df('0x43')]['id']}},_0x25f852={};_0x25f852['model']=_[_0x61df('0x33')](db[_0x61df('0x2c')]['rawAttributes']);_0x25f852[_0x61df('0x32')]=_[_0x61df('0x33')](_0xd54ae4[_0x61df('0x32')]);_0x25f852[_0x61df('0x44')]=_[_0x61df('0x34')](_0x25f852[_0x61df('0x30')],_0x25f852[_0x61df('0x32')]);_0x47b1e1['attributes']=_['intersection'](_0x25f852[_0x61df('0x30')],qs[_0x61df('0x36')](_0xd54ae4[_0x61df('0x32')][_0x61df('0x36')]));_0x47b1e1['attributes']=_0x47b1e1[_0x61df('0x35')]['length']?_0x47b1e1['attributes']:_0x25f852['model'];if(_0xd54ae4[_0x61df('0x32')][_0x61df('0x45')]){_0x47b1e1['include']=[{'all':!![]}];}_0x47b1e1=_[_0x61df('0x3f')]({},_0x47b1e1,_0xd54ae4['options']);return db[_0x61df('0x2c')][_0x61df('0x46')](_0x47b1e1)[_0x61df('0x28')](handleEntityNotFound(_0x1d48eb,null))['then'](respondWithResult(_0x1d48eb,null))[_0x61df('0x47')](handleError(_0x1d48eb,null));};exports[_0x61df('0x48')]=function(_0x580f94,_0x253131){return db[_0x61df('0x2c')][_0x61df('0x48')](_0x580f94[_0x61df('0x49')],{})['then'](respondWithResult(_0x253131,0xc9))[_0x61df('0x47')](handleError(_0x253131,null));};exports[_0x61df('0x26')]=function(_0x42fd5e,_0x55d707){if(_0x42fd5e['body']['id']){delete _0x42fd5e[_0x61df('0x49')]['id'];}return db[_0x61df('0x2c')][_0x61df('0x46')]({'where':{'id':_0x42fd5e[_0x61df('0x43')]['id']}})['then'](handleEntityNotFound(_0x55d707,null))[_0x61df('0x28')](saveUpdates(_0x42fd5e[_0x61df('0x49')],null))[_0x61df('0x28')](respondWithResult(_0x55d707,null))[_0x61df('0x47')](handleError(_0x55d707,null));};exports[_0x61df('0x27')]=function(_0x39ec3d,_0x488cac){return db[_0x61df('0x2c')][_0x61df('0x46')]({'where':{'id':_0x39ec3d[_0x61df('0x43')]['id']}})[_0x61df('0x28')](handleEntityNotFound(_0x488cac,null))[_0x61df('0x28')](removeEntity(_0x488cac,null))[_0x61df('0x47')](handleError(_0x488cac,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 74c4f06..3594cab 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 _0xfaab=['rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path'];(function(_0x584446,_0x5c5ea7){var _0x59f782=function(_0x4dc125){while(--_0x4dc125){_0x584446['push'](_0x584446['shift']());}};_0x59f782(++_0x5c5ea7);}(_0xfaab,0xcb));var _0xbfaa=function(_0x3f48ef,_0x484dd0){_0x3f48ef=_0x3f48ef-0x0;var _0x77cd64=_0xfaab[_0x3f48ef];return _0x77cd64;};'use strict';var _=require(_0xbfaa('0x0'));var util=require(_0xbfaa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbfaa('0x2'));var BPromise=require('bluebird');var rp=require(_0xbfaa('0x3'));var fs=require('fs');var path=require(_0xbfaa('0x4'));var rimraf=require(_0xbfaa('0x5'));var config=require(_0xbfaa('0x6'));var attributes=require(_0xbfaa('0x7'));module['exports']=function(_0x244ee2,_0x377376){return _0x244ee2[_0xbfaa('0x8')](_0xbfaa('0x9'),attributes,{'tableName':_0xbfaa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbfaa('0xb'),'collate':_0xbfaa('0xc')});}; \ No newline at end of file +var _0xe84a=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xe84a,0x97));var _0xae84=function(_0x390c46,_0x5873a0){_0x390c46=_0x390c46-0x0;var _0x2db77e=_0xe84a[_0x390c46];return _0x2db77e;};'use strict';var _=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var logger=require(_0xae84('0x2'))(_0xae84('0x3'));var moment=require('moment');var BPromise=require(_0xae84('0x4'));var rp=require(_0xae84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae84('0x6'));var config=require(_0xae84('0x7'));var attributes=require(_0xae84('0x8'));module[_0xae84('0x9')]=function(_0x4a0334,_0x10dd3b){return _0x4a0334[_0xae84('0xa')](_0xae84('0xb'),attributes,{'tableName':_0xae84('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae84('0xd'),'collate':_0xae84('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 1ccde73..1f9a91d 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 _0xde9f=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xde9f,0x118));var _0xfde9=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xde9f[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('SmsApplication,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});} \ No newline at end of file +var _0x4f7b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x586ee0,_0x2184ec){var _0x4eca18=function(_0x383596){while(--_0x383596){_0x586ee0['push'](_0x586ee0['shift']());}};_0x4eca18(++_0x2184ec);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x48c30d,_0x130278){_0x48c30d=_0x48c30d-0x0;var _0x11db6d=_0x4f7b[_0x48c30d];return _0x11db6d;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 160599b..edcac93 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 _0x4213=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','update','sms','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4213,0x77));var _0x3421=function(_0x569dcd,_0x174f9c){_0x569dcd=_0x569dcd-0x0;var _0x2d83c6=_0x4213[_0x569dcd];return _0x2d83c6;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/messages',auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x13')]);router['post'](_0x3421('0x14'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router[_0x3421('0x12')](_0x3421('0x16'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')]('sms',_0x3421('0x18')),controller['addTags']);router[_0x3421('0x19')](_0x3421('0xe'),auth['isAuthenticated'](),interaction[_0x3421('0x17')]('sms',_0x3421('0x1a')),controller[_0x3421('0x1b')]);router['delete'](_0x3421('0xe'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')](_0x3421('0x1c'),_0x3421('0x1d')),controller[_0x3421('0x1e')]);router[_0x3421('0x1f')](_0x3421('0x16'),auth[_0x3421('0xa')](),controller[_0x3421('0x20')]);module[_0x3421('0x21')]=router; \ No newline at end of file +var _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf2d57d,_0x114ea0){var _0xf424b7=function(_0x277940){while(--_0x277940){_0xf2d57d['push'](_0xf2d57d['shift']());}};_0xf424b7(++_0x114ea0);}(_0xe605,0x92));var _0x5e60=function(_0x1c61a4,_0x1593e4){_0x1c61a4=_0x1c61a4-0x0;var _0x49b55d=_0xe605[_0x1c61a4];return _0x49b55d;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 29169a9..8c13b65 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 _0x16d8=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x1648d5,_0x5bc6e4){var _0x1b70d4=function(_0x466ece){while(--_0x466ece){_0x1648d5['push'](_0x1648d5['shift']());}};_0x1b70d4(++_0x5bc6e4);}(_0x16d8,0xa3));var _0x816d=function(_0x1cd66e,_0x21de93){_0x1cd66e=_0x1cd66e-0x0;var _0x25c7e7=_0x16d8[_0x1cd66e];return _0x25c7e7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x816d('0x0'));module[_0x816d('0x1')]={'closed':{'type':Sequelize[_0x816d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x816d('0x3')]},'disposition':{'type':Sequelize[_0x816d('0x4')]},'secondDisposition':{'type':Sequelize[_0x816d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x816d('0x4')]},'note':{'type':Sequelize[_0x816d('0x4')]},'phone':{'type':Sequelize[_0x816d('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x816d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x816d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x816d('0x5')]('in',_0x816d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x816d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x38e4=['DATE','STRING','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x38e4,0x9e));var _0x438e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38e4[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x438e('0x0'));var moment=require(_0x438e('0x1'));module['exports']={'closed':{'type':Sequelize[_0x438e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x438e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x438e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x438e('0x4')]},'note':{'type':Sequelize[_0x438e('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x438e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x438e('0x5')]('in',_0x438e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x438e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x438e('0x5')]('in',_0x438e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 5dc90ca..c99b240 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 _0x8c9d=['filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','order','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','sequelize','groupBy','SmsInteractionId','push','rows','show','params','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','$gte','findAll','addTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','direction','secret','Account','Owner','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','out','System','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','sendStatus','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','model','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','select','field','from','u.id','u.fullname','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','keys','some','isEmpty','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x8c9d,0x69));var _0xd8c9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c9d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd8c9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd8c9('0x1'));var rp=require(_0xd8c9('0x2'));var moment=require(_0xd8c9('0x3'));var BPromise=require(_0xd8c9('0x4'));var Mustache=require(_0xd8c9('0x5'));var util=require(_0xd8c9('0x6'));var path=require(_0xd8c9('0x7'));var sox=require(_0xd8c9('0x8'));var csv=require(_0xd8c9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8c9('0xa'));var _=require(_0xd8c9('0xb'));var squel=require(_0xd8c9('0xc'));var crypto=require(_0xd8c9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd8c9('0xe'));var toCsv=require(_0xd8c9('0x9'));var querystring=require(_0xd8c9('0xf'));var Papa=require(_0xd8c9('0x10'));var Redis=require(_0xd8c9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd8c9('0x12'));var as=require(_0xd8c9('0x13'));var pdf=require(_0xd8c9('0x14'));var hardwareService=require(_0xd8c9('0x15'));var logger=require(_0xd8c9('0x16'))(_0xd8c9('0x17'));var utils=require('../../config/utils');var config=require(_0xd8c9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8c9('0x19'))['db'];config['redis']=_[_0xd8c9('0x1a')](config['redis'],{'host':_0xd8c9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x32fd2b,_0x40e0e5){_0x40e0e5=_0x40e0e5||0xcc;return function(_0x54b5be){if(_0x54b5be){return _0x32fd2b['sendStatus'](_0x40e0e5);}return _0x32fd2b[_0xd8c9('0x1c')](_0x40e0e5)[_0xd8c9('0x1d')]();};}function respondWithResult(_0x34fe72,_0x152e9f){_0x152e9f=_0x152e9f||0xc8;return function(_0x2976dd){if(_0x2976dd){return _0x34fe72['status'](_0x152e9f)['json'](_0x2976dd);}};}function respondWithFilteredResult(_0x107c4a,_0x10f1dc){return function(_0x574cd9){if(_0x574cd9){var _0xeb00cc=typeof _0x10f1dc[_0xd8c9('0x1e')]==='undefined'&&typeof _0x10f1dc[_0xd8c9('0x1f')]===_0xd8c9('0x20');var _0xff5416=_0x574cd9[_0xd8c9('0x21')];var _0x21698a=_0xeb00cc?0x0:_0x10f1dc[_0xd8c9('0x1e')];var _0x103587=_0xeb00cc?_0x574cd9[_0xd8c9('0x21')]:_0x10f1dc[_0xd8c9('0x1e')]+_0x10f1dc[_0xd8c9('0x1f')];var _0x49541a;if(_0x103587>=_0xff5416){_0x103587=_0xff5416;_0x49541a=0xc8;}else{_0x49541a=0xce;}_0x107c4a[_0xd8c9('0x1c')](_0x49541a);return _0x107c4a[_0xd8c9('0x22')](_0xd8c9('0x23'),_0x21698a+'-'+_0x103587+'/'+_0xff5416)['json'](_0x574cd9);}return null;};}function patchUpdates(_0x57883f){return function(_0x42c45b){try{jsonpatch[_0xd8c9('0x24')](_0x42c45b,_0x57883f,!![]);}catch(_0x4e72ed){return BPromise[_0xd8c9('0x25')](_0x4e72ed);}return _0x42c45b[_0xd8c9('0x26')]();};}function saveUpdates(_0x5e281d,_0x5e318e){return function(_0x140978){if(_0x140978){return _0x140978[_0xd8c9('0x27')](_0x5e281d)[_0xd8c9('0x28')](function(_0x439a68){return _0x439a68;});}return null;};}function removeEntity(_0x53a823,_0x5dbc9b){return function(_0x4727a1){if(_0x4727a1){return _0x4727a1[_0xd8c9('0x29')]()[_0xd8c9('0x28')](function(){_0x53a823[_0xd8c9('0x1c')](0xcc)[_0xd8c9('0x1d')]();});}};}function handleEntityNotFound(_0x3ea9ca,_0x2badd2){return function(_0x1b14bf){if(!_0x1b14bf){_0x3ea9ca['sendStatus'](0x194);}return _0x1b14bf;};}function handleError(_0x235228,_0x45b698){_0x45b698=_0x45b698||0x1f4;return function(_0x525dab){logger[_0xd8c9('0x2a')](_0x525dab[_0xd8c9('0x2b')]);if(_0x525dab[_0xd8c9('0x2c')]){delete _0x525dab[_0xd8c9('0x2c')];}_0x235228[_0xd8c9('0x1c')](_0x45b698)[_0xd8c9('0x2d')](_0x525dab);};}function getInteractionUsers(_0x5c8999,_0x426ace){return new BPromise(function(_0x5e6b9a,_0x1c543f){try{if(_0x426ace[_0x5c8999['id']]){_0x5c8999[_0xd8c9('0x2e')]=_['map'](_0x426ace[_0x5c8999['id']],function(_0x897e56){return{'id':_0x897e56['id'],'fullname':_0x897e56['fullname']};});}}catch(_0x2f26ff){_0x1c543f(_0x2f26ff);}_0x5e6b9a(_0x5c8999);});}function getInteractionTags(_0x657f55,_0x182ca5){return new BPromise(function(_0x1e453b,_0x3f10ee){try{if(_0x657f55[_0xd8c9('0x2f')]){_0x657f55[_0xd8c9('0x30')]=[];_0x657f55[_0xd8c9('0x2f')][_0xd8c9('0x31')](',')[_0xd8c9('0x32')](function(_0x3da02f){_0x657f55['Tags']['push'](_0x182ca5[_0x3da02f]);});}delete _0x657f55['TagIds'];}catch(_0x3a8011){_0x3f10ee(_0x3a8011);}_0x1e453b(_0x657f55);});}function updateSmsInteraction(_0x41ef44,_0x31301e,_0x3cdc4e){return new BPromise(function(_0x24811d,_0x702646){return getInteractionUsers(_0x41ef44,_0x3cdc4e)['then'](function(_0x5574a4){return getInteractionTags(_0x5574a4,_0x31301e);})[_0xd8c9('0x28')](function(_0x5bb8e3){_0x24811d(_0x5bb8e3);})[_0xd8c9('0x33')](function(_0x1cbdfd){_0x702646(_0x1cbdfd);});});}exports[_0xd8c9('0x34')]=function(_0x541681,_0x3e87ff){var _0x4f1d23={},_0x5520fa={},_0x9bc451={'count':0x0,'rows':[]};var _0x1a2307=_['map'](db[_0xd8c9('0x35')][_0xd8c9('0x36')],function(_0x562dcf){return{'name':_0x562dcf[_0xd8c9('0x37')],'type':_0x562dcf[_0xd8c9('0x38')]['key']};});_0x5520fa[_0xd8c9('0x39')]=_[_0xd8c9('0x3a')](_0x1a2307,_0xd8c9('0x2c'));_0x5520fa['query']=_['keys'](_0x541681['query']);_0x5520fa[_0xd8c9('0x3b')]=_[_0xd8c9('0x3c')](_0x5520fa[_0xd8c9('0x39')],_0x5520fa['query']);_0x4f1d23[_0xd8c9('0x3d')]=_['intersection'](_0x5520fa[_0xd8c9('0x39')],qs[_0xd8c9('0x3e')](_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x3e')]));_0x4f1d23[_0xd8c9('0x3d')]=_0x4f1d23['attributes'][_0xd8c9('0x40')]?_0x4f1d23[_0xd8c9('0x3d')]:_0x5520fa[_0xd8c9('0x39')];if(!_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x41')](_0xd8c9('0x42'))){_0x4f1d23[_0xd8c9('0x1f')]=qs[_0xd8c9('0x1f')](_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x1f')]);_0x4f1d23['offset']=qs[_0xd8c9('0x1e')](_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x1e')]);}_0x4f1d23['order']=qs['sort'](_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x43')]);_0x4f1d23[_0xd8c9('0x44')]=qs[_0xd8c9('0x3b')](_[_0xd8c9('0x45')](_0x541681['query'],_0x5520fa[_0xd8c9('0x3b')]),_0x1a2307);var _0x47717e=[];var _0x1200d0=squel[_0xd8c9('0x46')]()['field']('id')[_0xd8c9('0x47')](_0xd8c9('0x2c'))[_0xd8c9('0x47')]('color')[_0xd8c9('0x48')]('tools_tags');var _0x12026f=squel[_0xd8c9('0x46')]()['field'](_0xd8c9('0x49'))[_0xd8c9('0x47')](_0xd8c9('0x4a'))[_0xd8c9('0x47')]('ui.SmsInteractionId')[_0xd8c9('0x48')](_0xd8c9('0x4b'),'ui')['left_join']('users','u',_0xd8c9('0x4c'));var _0x25fcd9=squel[_0xd8c9('0x46')]()[_0xd8c9('0x48')](_0xd8c9('0x4d'),'i')[_0xd8c9('0x4e')](_0xd8c9('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd8c9('0x4e')](_0xd8c9('0x50'),'o',_0xd8c9('0x51'))[_0xd8c9('0x4e')](_0xd8c9('0x52'),'a',_0xd8c9('0x53'))[_0xd8c9('0x4e')](_0xd8c9('0x54'),'me',_0xd8c9('0x55'))['left_join'](_0xd8c9('0x56'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xd8c9('0x57'),'t',_0xd8c9('0x58'));var _0x3bec27=squel[_0xd8c9('0x59')]();var _0x2f199c=[];var _0x23d09f=squel[_0xd8c9('0x59')]();var _0x24b375;if(_0x541681[_0xd8c9('0x3f')]['search']){_0x24b375=as[_0xd8c9('0x5a')](_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x5b')]);var _0x2a1041=_0x24b375[_0xd8c9('0x5c')];for(var _0x379826=0x0;_0x379826<_0x24b375['conditions'][_0xd8c9('0x40')];_0x379826++){var _0x52428d=_0x24b375[_0xd8c9('0x5d')][_0x379826];var _0x1a3fbb='i';var _0x4bbd1f=_[_0xd8c9('0x5e')](_0x1a2307,['name',_0x52428d[_0xd8c9('0x47')]]);if(!_0x4bbd1f){switch(_0x52428d['field']){case _0xd8c9('0x5f'):if(_0x52428d[_0xd8c9('0x60')]==0x1){_0x25fcd9[_0xd8c9('0x61')]('`'+_0x52428d['field']+'`\x20=\x200');}else{_0x25fcd9[_0xd8c9('0x61')]('`'+_0x52428d[_0xd8c9('0x47')]+_0xd8c9('0x62'));}break;case'Contact':if(_0x52428d[_0xd8c9('0x63')]===_0xd8c9('0x64')){if(_0x52428d[_0xd8c9('0x60')][_0xd8c9('0x31')]('\x20')[_0xd8c9('0x40')]>0x1){_0x3bec27[_0x2a1041]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x52428d[_0xd8c9('0x60')]),null);}else{var _0x1201cf='%'+_0x52428d[_0xd8c9('0x60')]+'%';_0x3bec27[_0x2a1041](_0xd8c9('0x65'),_0x1201cf,_0x1201cf,_0x1201cf);}}else{_0x4bbd1f=_[_0xd8c9('0x5e')](_0x1a2307,['name',_0xd8c9('0x66')]);_0x52428d['field']=_0xd8c9('0x66');_0x5e68ca=as[_0xd8c9('0x67')](_0x1a3fbb,_0x4bbd1f[_0xd8c9('0x38')],_0x52428d);_0x3bec27[_0x2a1041](_0x5e68ca['text'],_0x5e68ca[_0xd8c9('0x60')]['start'],_0x5e68ca['value'][_0xd8c9('0x1d')]);}break;case _0xd8c9('0x68'):var _0x45a3fa=_0x52428d[_0xd8c9('0x60')][_0xd8c9('0x31')](',')[_0xd8c9('0x3a')](function(_0x260d94){return Number(_0x260d94);});_0x45a3fa['forEach'](function(_0x524e1d){_0x23d09f['or'](_0xd8c9('0x69'),'%,'+_0x524e1d+',%');});_0x2f199c=_[_0xd8c9('0x6a')](_0x2f199c,_0x45a3fa);break;case'User':if(_0x52428d[_0xd8c9('0x63')]===_0xd8c9('0x64')){_0x3bec27[_0x2a1041](_0xd8c9('0x6b'),'%'+_0x52428d[_0xd8c9('0x60')]+'%',null);}else{_0x4bbd1f=_['find'](_0x1a2307,[_0xd8c9('0x2c'),_0xd8c9('0x6c')]);_0x52428d[_0xd8c9('0x47')]=_0xd8c9('0x6c');_0x5e68ca=as[_0xd8c9('0x67')](_0x1a3fbb,_0x4bbd1f[_0xd8c9('0x38')],_0x52428d);_0x3bec27[_0x2a1041](_0x5e68ca[_0xd8c9('0x6d')],_0x5e68ca['value'][_0xd8c9('0x6e')],_0x5e68ca[_0xd8c9('0x60')][_0xd8c9('0x1d')]);}break;case'body':_0x5e68ca=as[_0xd8c9('0x67')]('me',null,_0x52428d);_0x3bec27[_0x2a1041](_0x5e68ca[_0xd8c9('0x6d')],_0x5e68ca['value'][_0xd8c9('0x6e')],_0x5e68ca[_0xd8c9('0x60')][_0xd8c9('0x1d')]);break;}}else{var _0x5e68ca=as[_0xd8c9('0x67')](_0x1a3fbb,_0x4bbd1f[_0xd8c9('0x38')],_0x52428d);_0x3bec27[_0x2a1041](_0x5e68ca['text'],_0x5e68ca[_0xd8c9('0x60')]['start'],_0x5e68ca[_0xd8c9('0x60')][_0xd8c9('0x1d')]);}}}else{var _0x3a2035=_(_0x541681['query'])[_0xd8c9('0x6f')]()[_0xd8c9('0x3a')](function(_0x35a46b){return _[_0xd8c9('0x70')](_0x1a2307,[_0xd8c9('0x2c'),_0x35a46b])?_0x35a46b:undefined;})['compact']()[_0xd8c9('0x60')]();if(!_[_0xd8c9('0x71')](_0x3a2035)){_0x3a2035[_0xd8c9('0x32')](function(_0x3a50ce){if(_0x3a50ce==='SmsAccountId'){_0x25fcd9[_0xd8c9('0x44')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x541681[_0xd8c9('0x3f')][_0x3a50ce]));}else if(_0x3a50ce===_0xd8c9('0x72')){var _0x5bf60b=JSON[_0xd8c9('0x73')](_0x541681[_0xd8c9('0x3f')][_0x3a50ce])['$gte'];var _0x42e952=JSON['parse'](_0x541681['query'][_0x3a50ce])[_0xd8c9('0x74')];_0x25fcd9[_0xd8c9('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5bf60b,_0x42e952);}else{if(_0x541681[_0xd8c9('0x3f')][_0x3a50ce]==='null'){_0x25fcd9['where']('i.'+_0x3a50ce+_0xd8c9('0x75'));}else{_0x25fcd9[_0xd8c9('0x44')]('i.'+_0x3a50ce+_0xd8c9('0x76'),_0x541681[_0xd8c9('0x3f')][_0x3a50ce]);}}});}if(_0x541681['query'][_0xd8c9('0x77')]){if(_0x541681['query'][_0xd8c9('0x77')]==0x1){_0x25fcd9['having'](_0xd8c9('0x78'));}else{_0x25fcd9[_0xd8c9('0x61')](_0xd8c9('0x79'));}}if(_0x541681[_0xd8c9('0x3f')]['tag']){_0x2f199c=_[_0xd8c9('0x7a')](_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x7b')])?_0x541681[_0xd8c9('0x3f')]['tag']:new Array(_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x7b')]);_0x2f199c[_0xd8c9('0x32')](function(_0x38688e){_0x23d09f['or'](_0xd8c9('0x69'),'%,'+_0x38688e+',%');});}if(_0x541681['query'][_0xd8c9('0x7c')]){var _0x1bbced=_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x7c')][_0xd8c9('0x7d')]('\x5c','\x5c\x5c')[_0xd8c9('0x7d')](/'/g,'\x27\x27');if(qs[_0xd8c9('0x7e')](_0x1bbced)){_0x3bec27['or']('i.id\x20LIKE\x20?',_0x1bbced+'%')['or'](_0xd8c9('0x7f'),_0x1bbced+'%');}else{_0x3bec27['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1bbced))['or'](_0xd8c9('0x80'),_0x1bbced+'%');}}}_0x25fcd9[_0xd8c9('0x44')](_0x3bec27);_0x25fcd9['group'](_0xd8c9('0x81'));var _0x4c5d61={'type':db[_0xd8c9('0x82')][_0xd8c9('0x83')]['SELECT'],'raw':!![]};var _0x1d9e7e=_0x25fcd9['clone']();_0x1d9e7e[_0xd8c9('0x47')](_0xd8c9('0x81'));_0x1d9e7e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4f1d23[_0xd8c9('0x84')]){_0x4f1d23[_0xd8c9('0x84')]['forEach'](function(_0x586611){var _0x4c8b54=_0x586611[0x0]===_0xd8c9('0x85')?_0x586611[0x0]:'i.'+_0x586611[0x0];_0x25fcd9[_0xd8c9('0x84')](_0x4c8b54,_0x586611[0x1]===_0xd8c9('0x86')?![]:!![]);});}if(!_[_0xd8c9('0x71')](_0x2f199c)){_0x25fcd9[_0xd8c9('0x61')](_0x23d09f);_0x1d9e7e[_0xd8c9('0x44')](_0xd8c9('0x87'),_0x2f199c);}BPromise[_0xd8c9('0x88')]()[_0xd8c9('0x28')](function(){if(!_0x24b375){if(_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x89')])return;_0x1d9e7e['where'](_0xd8c9('0x8a'));_0x25fcd9[_0xd8c9('0x44')](_0xd8c9('0x8a'));return;}if(_0x541681['user'][_0xd8c9('0x8b')]!==_0xd8c9('0x8c'))return;return _0x541681['user'][_0xd8c9('0x8d')]({'attributes':['id'],'raw':!![]})[_0xd8c9('0x28')](function(_0x4f90c0){if(_[_0xd8c9('0x71')](_0x4f90c0)){_0x1d9e7e[_0xd8c9('0x44')](_0xd8c9('0x8e'));_0x25fcd9[_0xd8c9('0x44')](_0xd8c9('0x8e'));}else{_0x1d9e7e[_0xd8c9('0x44')]('i.SmsAccountId\x20IN\x20?',_[_0xd8c9('0x3a')](_0x4f90c0,'id'));_0x25fcd9[_0xd8c9('0x44')](_0xd8c9('0x8f'),_['map'](_0x4f90c0,'id'));}});})['then'](function(){if(_0x541681['user'][_0xd8c9('0x8b')]==='agent'&&!_0x24b375&&!_0x541681[_0xd8c9('0x3f')]['SmsAccountId'])return[];return db['sequelize'][_0xd8c9('0x3f')](_0x1d9e7e[_0xd8c9('0x90')](),_0x4c5d61);})[_0xd8c9('0x28')](function(_0x2af41d){_0x9bc451['count']=_0x2af41d[_0xd8c9('0x40')];if(_0x9bc451['count']===0x0)return[];return db['sequelize'][_0xd8c9('0x3f')](_0x1200d0['toString'](),_0x4c5d61)[_0xd8c9('0x28')](function(_0x2a0007){_0x47717e=_[_0xd8c9('0x91')](_0x2a0007,'id');_0x4c5d61=_[_0xd8c9('0x92')](_0x4c5d61,{'model':db[_0xd8c9('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x541681[_0xd8c9('0x3f')][_0xd8c9('0x3e')]){_0x4f1d23[_0xd8c9('0x3d')][_0xd8c9('0x32')](function(_0x3dae58){_0x25fcd9[_0xd8c9('0x47')]('i.'+_0x3dae58);});}else{_0x25fcd9[_0xd8c9('0x47')](_0xd8c9('0x93'),_0xd8c9('0x5f'));_0x25fcd9['field'](_0xd8c9('0x94'),'Account.key');_0x25fcd9[_0xd8c9('0x47')]('a.mandatoryDisposition',_0xd8c9('0x95'));_0x25fcd9[_0xd8c9('0x47')](_0xd8c9('0x96'),'contactName');_0x25fcd9[_0xd8c9('0x47')]('i.*');_0x25fcd9[_0xd8c9('0x47')](_0xd8c9('0x97'),'Contact.firstName');_0x25fcd9[_0xd8c9('0x47')]('c.lastName',_0xd8c9('0x98'));_0x25fcd9[_0xd8c9('0x47')](_0xd8c9('0x99'),_0xd8c9('0x9a'));_0x25fcd9['field'](_0xd8c9('0x9b'),_0xd8c9('0x9c'));_0x25fcd9[_0xd8c9('0x47')](_0xd8c9('0x9d'),_0xd8c9('0x9e'));_0x25fcd9[_0xd8c9('0x47')](_0xd8c9('0x9f'),_0xd8c9('0xa0'));_0x25fcd9['field'](_0xd8c9('0xa1'),_0xd8c9('0xa2'));_0x25fcd9[_0xd8c9('0x47')](_0xd8c9('0xa3'),_0xd8c9('0xa4'));_0x25fcd9['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4f1d23[_0xd8c9('0x1f')])_0x25fcd9['limit'](_0x4f1d23[_0xd8c9('0x1f')]);if(_0x4f1d23[_0xd8c9('0x1e')])_0x25fcd9[_0xd8c9('0x1e')](_0x4f1d23[_0xd8c9('0x1e')]);return db['sequelize'][_0xd8c9('0x3f')](_0x25fcd9[_0xd8c9('0x90')](),_0x4c5d61);})[_0xd8c9('0x28')](function(_0x1f392f){if(_0x1f392f[_0xd8c9('0x40')]>0x0)_0x12026f[_0xd8c9('0x44')]('ui.SmsInteractionId\x20IN\x20?',_[_0xd8c9('0x3a')](_0x1f392f,'id'));return db[_0xd8c9('0xa5')][_0xd8c9('0x3f')](_0x12026f['toString'](),_0x4c5d61)[_0xd8c9('0x28')](function(_0x3d8593){var _0x343f06=_[_0xd8c9('0xa6')](_0x3d8593,_0xd8c9('0xa7'));var _0x379269=[];_0x1f392f[_0xd8c9('0x32')](function(_0x51a201){_0x379269[_0xd8c9('0xa8')](updateSmsInteraction(_0x51a201,_0x47717e,_0x343f06));});return BPromise['all'](_0x379269);});});})[_0xd8c9('0x28')](function(_0x3443a2){_0x9bc451[_0xd8c9('0xa9')]=_0x3443a2;return _0x9bc451;})[_0xd8c9('0x28')](respondWithFilteredResult(_0x3e87ff,_0x4f1d23))[_0xd8c9('0x33')](handleError(_0x3e87ff,null));};exports[_0xd8c9('0xaa')]=function(_0xfc7d53,_0x560b13){var _0x1f3df7={'raw':![],'where':{'id':_0xfc7d53[_0xd8c9('0xab')]['id']}},_0x1d04b0={};_0x1d04b0[_0xd8c9('0x39')]=_[_0xd8c9('0x6f')](db[_0xd8c9('0x35')][_0xd8c9('0x36')]);_0x1d04b0[_0xd8c9('0x3f')]=_[_0xd8c9('0x6f')](_0xfc7d53[_0xd8c9('0x3f')]);_0x1d04b0[_0xd8c9('0x3b')]=_['intersection'](_0x1d04b0['model'],_0x1d04b0[_0xd8c9('0x3f')]);_0x1f3df7[_0xd8c9('0x3d')]=_[_0xd8c9('0x3c')](_0x1d04b0[_0xd8c9('0x39')],qs[_0xd8c9('0x3e')](_0xfc7d53[_0xd8c9('0x3f')][_0xd8c9('0x3e')]));_0x1f3df7[_0xd8c9('0x3d')]=_0x1f3df7[_0xd8c9('0x3d')][_0xd8c9('0x40')]?_0x1f3df7[_0xd8c9('0x3d')]:_0x1d04b0[_0xd8c9('0x39')];if(_0xfc7d53[_0xd8c9('0x3f')][_0xd8c9('0xac')]){_0x1f3df7[_0xd8c9('0xad')]=[{'all':!![]}];}_0x1f3df7=_[_0xd8c9('0x92')]({},_0x1f3df7,_0xfc7d53[_0xd8c9('0xae')]);return db[_0xd8c9('0x35')]['find'](_0x1f3df7)['then'](handleEntityNotFound(_0x560b13,null))[_0xd8c9('0x28')](respondWithResult(_0x560b13,null))[_0xd8c9('0x33')](handleError(_0x560b13,null));};exports[_0xd8c9('0xaf')]=function(_0x231ac4,_0x253a8f){return db['SmsInteraction'][_0xd8c9('0xaf')](_0x231ac4[_0xd8c9('0xb0')],{})[_0xd8c9('0x28')](respondWithResult(_0x253a8f,0xc9))[_0xd8c9('0x33')](handleError(_0x253a8f,null));};exports['update']=function(_0x56a2f4,_0x23cb96){if(_0x56a2f4[_0xd8c9('0xb0')]['id']){delete _0x56a2f4[_0xd8c9('0xb0')]['id'];}return db['SmsInteraction'][_0xd8c9('0x5e')]({'where':{'id':_0x56a2f4[_0xd8c9('0xab')]['id']}})['then'](handleEntityNotFound(_0x23cb96,null))['then'](saveUpdates(_0x56a2f4[_0xd8c9('0xb0')],null))[_0xd8c9('0x28')](respondWithResult(_0x23cb96,null))[_0xd8c9('0x33')](handleError(_0x23cb96,null));};exports['destroy']=function(_0x52eed4,_0x549e3b){return db[_0xd8c9('0x35')][_0xd8c9('0x5e')]({'where':{'id':_0x52eed4[_0xd8c9('0xab')]['id']}})[_0xd8c9('0x28')](handleEntityNotFound(_0x549e3b,null))[_0xd8c9('0x28')](removeEntity(_0x549e3b,null))[_0xd8c9('0x33')](handleError(_0x549e3b,null));};exports[_0xd8c9('0xb1')]=function(_0x1c6b02,_0x823d7){return db[_0xd8c9('0x35')][_0xd8c9('0xb1')]()[_0xd8c9('0x28')](respondWithResult(_0x823d7,null))[_0xd8c9('0x33')](handleError(_0x823d7,null));};exports['addMessage']=function(_0x393f22,_0x455bfd,_0x3d0c0c){return db[_0xd8c9('0xb2')][_0xd8c9('0x5e')]({'where':{'id':_0x393f22['params']['id']}})[_0xd8c9('0x28')](handleEntityNotFound(_0x455bfd,null))[_0xd8c9('0x28')](function(_0x3eef50){if(_0x3eef50){return _0x3eef50[_0xd8c9('0xb3')](_0x393f22[_0xd8c9('0xb0')][_0xd8c9('0xb4')],_[_0xd8c9('0xb5')](_0x393f22['body'],['ids','id'])||{});}})[_0xd8c9('0x28')](respondWithResult(_0x455bfd,null))[_0xd8c9('0x33')](handleError(_0x455bfd,null));};exports[_0xd8c9('0xb6')]=function(_0xc6c183,_0x5b2f44,_0x3e0e20){var _0x257e21={'raw':![],'where':{}};var _0x80e40e={};var _0x458b9b={'count':0x0,'rows':[]};return db[_0xd8c9('0x35')][_0xd8c9('0xb7')]({'where':{'id':_0xc6c183['params']['id']}})[_0xd8c9('0x28')](handleEntityNotFound(_0x5b2f44,null))['then'](function(_0x4de242){if(_0x4de242){_0x80e40e[_0xd8c9('0x39')]=_[_0xd8c9('0x6f')](db[_0xd8c9('0xb2')][_0xd8c9('0x36')]);_0x80e40e['query']=_[_0xd8c9('0x6f')](_0xc6c183['query']);_0x80e40e['filters']=_[_0xd8c9('0x3c')](_0x80e40e[_0xd8c9('0x39')],_0x80e40e['query']);_0x257e21[_0xd8c9('0x3d')]=_[_0xd8c9('0x3c')](_0x80e40e[_0xd8c9('0x39')],qs['fields'](_0xc6c183[_0xd8c9('0x3f')][_0xd8c9('0x3e')]));_0x257e21[_0xd8c9('0x3d')]=_0x257e21[_0xd8c9('0x3d')]['length']?_0x257e21[_0xd8c9('0x3d')]:_0x80e40e[_0xd8c9('0x39')];if(!_0xc6c183['query'][_0xd8c9('0x41')](_0xd8c9('0x42'))){_0x257e21[_0xd8c9('0x1f')]=qs['limit'](_0xc6c183['query'][_0xd8c9('0x1f')]);_0x257e21[_0xd8c9('0x1e')]=qs['offset'](_0xc6c183[_0xd8c9('0x3f')][_0xd8c9('0x1e')]);}_0x257e21[_0xd8c9('0x84')]=qs['sort'](_0xc6c183['query'][_0xd8c9('0x43')]);_0x257e21['where']=qs['filters'](_['pick'](_0xc6c183[_0xd8c9('0x3f')],_0x80e40e['filters']));_0x257e21[_0xd8c9('0x44')][_0xd8c9('0xa7')]=_0x4de242['id'];if(_0xc6c183[_0xd8c9('0x3f')][_0xd8c9('0x7c')]){_0x257e21[_0xd8c9('0x44')]=_[_0xd8c9('0x92')](_0x257e21['where'],{'$or':_[_0xd8c9('0x3a')](_0x257e21['attributes'],function(_0x44bf98){var _0x43afa6={};_0x43afa6[_0x44bf98]={'$like':'%'+_0xc6c183[_0xd8c9('0x3f')][_0xd8c9('0x7c')]+'%'};return _0x43afa6;})});}if(_0xc6c183[_0xd8c9('0x3f')][_0xd8c9('0xb8')]){var _0x2a1909=_0xc6c183[_0xd8c9('0x3f')][_0xd8c9('0xb8')][_0xd8c9('0x31')](',');var _0x443ecb={};_0x443ecb[_0x2a1909[0x0]]={'$gte':moment(_0x2a1909[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x257e21[_0xd8c9('0x44')]=_[_0xd8c9('0x92')](_0x257e21[_0xd8c9('0x44')],_0x443ecb);}_0x257e21=_[_0xd8c9('0x92')]({},_0x257e21,_0xc6c183['options']);return db[_0xd8c9('0xb2')][_0xd8c9('0x21')]({'where':_0x257e21[_0xd8c9('0x44')]})[_0xd8c9('0x28')](function(_0x2a5e5a){_0x458b9b[_0xd8c9('0x21')]=_0x2a5e5a;if(_0xc6c183['query'][_0xd8c9('0xac')]){_0x257e21[_0xd8c9('0xad')]=[{'all':!![]}];}return db[_0xd8c9('0xb2')][_0xd8c9('0xb9')](_0x257e21);})[_0xd8c9('0x28')](function(_0x4269dc){_0x458b9b[_0xd8c9('0xa9')]=_0x4269dc;return _0x458b9b;});}})['then'](respondWithFilteredResult(_0x5b2f44,_0x257e21))['catch'](handleError(_0x5b2f44,null));};exports[_0xd8c9('0xba')]=function(_0x8c065c,_0x35048f,_0x2a4267){return db[_0xd8c9('0x35')][_0xd8c9('0x5e')]({'where':{'id':_0x8c065c[_0xd8c9('0xab')]['id']}})[_0xd8c9('0x28')](handleEntityNotFound(_0x35048f,null))[_0xd8c9('0x28')](function(_0x4ea343){if(_0x4ea343){return _0x4ea343['setTags'](_0x8c065c[_0xd8c9('0xb0')][_0xd8c9('0xb4')],_[_0xd8c9('0xb5')](_0x8c065c[_0xd8c9('0xb0')],[_0xd8c9('0xb4'),'id'])||{})[_0xd8c9('0xbb')](function(){return db[_0xd8c9('0x68')][_0xd8c9('0xb9')]({'attributes':['id',_0xd8c9('0x2c'),_0xd8c9('0xbc')],'where':{'id':_0x8c065c[_0xd8c9('0xb0')][_0xd8c9('0xb4')]}});})['then'](function(_0x21d11c){socket[_0xd8c9('0xbd')](_0xd8c9('0xbe'),{'id':Number(_0x8c065c[_0xd8c9('0xab')]['id']),'tags':_0x21d11c||[]});return{'id':Number(_0x8c065c['params']['id']),'tags':_0x21d11c||[]};});}})[_0xd8c9('0x28')](respondWithResult(_0x35048f,null))[_0xd8c9('0x33')](handleError(_0x35048f,null));};exports[_0xd8c9('0xbf')]=function(_0x2345f4,_0x5aa39a,_0x4fbb57){return db[_0xd8c9('0x35')][_0xd8c9('0x5e')]({'where':{'id':_0x2345f4[_0xd8c9('0xab')]['id']}})[_0xd8c9('0x28')](handleEntityNotFound(_0x5aa39a,null))['then'](function(_0x51e8fe){if(_0x51e8fe){return _0x51e8fe[_0xd8c9('0xbf')](_0x2345f4[_0xd8c9('0x3f')]['ids']);}})[_0xd8c9('0x28')](respondWithStatusCode(_0x5aa39a,null))['catch'](handleError(_0x5aa39a,null));};exports[_0xd8c9('0xc0')]=function(_0x4fc3a2,_0xfb72e5){var _0x4d7a39=moment()[_0xd8c9('0xc1')]()[_0xd8c9('0x90')]();var _0x3570a4=path['join'](config[_0xd8c9('0xc2')],_0xd8c9('0xc3'),_0xd8c9('0xc4'),'tmp');var _0x2ab693=path[_0xd8c9('0xc5')](config[_0xd8c9('0xc2')],_0xd8c9('0xc3'),_0xd8c9('0xc4'),_0xd8c9('0xc6'));var _0x2b4c35=path[_0xd8c9('0xc5')](_0x3570a4,_0x4d7a39);var _0x14a24a=util[_0xd8c9('0xc7')](_0xd8c9('0xc8'),_0x4fc3a2['params']['id'],_0x4d7a39);var _0x141a4e=path['join'](_0x3570a4,_0x14a24a);var _0xb3ffab=[];_0xb3ffab[_0xd8c9('0xa8')]({'model':db[_0xd8c9('0xc9')],'as':_0xd8c9('0xc9'),'attributes':['id',_0xd8c9('0xca')],'raw':!![]});_0xb3ffab[_0xd8c9('0xa8')]({'model':db[_0xd8c9('0xcb')],'as':_0xd8c9('0xcc'),'attributes':['id',_0xd8c9('0xcd'),_0xd8c9('0xce')],'raw':!![]});var _0xaf7876=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xd8c9('0xb0'),_0xd8c9('0x72'),_0xd8c9('0xcf'),_0xd8c9('0xd0'),_0xd8c9('0x77')],'include':_0xb3ffab}];_0xaf7876['push']({'model':db['SmsAccount'],'as':_0xd8c9('0xd1'),'attributes':['id','name']});_0xaf7876[_0xd8c9('0xa8')]({'model':db['User'],'as':_0xd8c9('0xd2'),'attributes':['id','fullname']});return db[_0xd8c9('0x35')][_0xd8c9('0x5e')]({'where':{'id':_0x4fc3a2[_0xd8c9('0xab')]['id']},'include':_0xaf7876})[_0xd8c9('0x28')](handleEntityNotFound(_0xfb72e5,null))['then'](function(_0x3ad80d){if(_0x3ad80d){var _0x36bf17=_0x3ad80d[_0xd8c9('0xd3')]({'plain':!![]});fs[_0xd8c9('0xd4')](_0x2b4c35);var _0x5bcd68={'channel':_0xd8c9('0xd5'),'account':_0x36bf17[_0xd8c9('0xd1')][_0xd8c9('0x2c')],'agent':_0x36bf17['Owner']?_0x36bf17[_0xd8c9('0xd2')][_0xd8c9('0xca')]:_0xd8c9('0xd6'),'createdAt':moment(_0x36bf17[_0xd8c9('0x72')])[_0xd8c9('0xc7')](_0xd8c9('0xd7'))['toString'](),'closedAt':_0x36bf17[_0xd8c9('0xd8')]?moment(_0x36bf17[_0xd8c9('0xd9')])['format'](_0xd8c9('0xd7'))['toString']():'','disposition':_0x36bf17[_0xd8c9('0xda')],'messages':_(_0x36bf17[_0xd8c9('0xdb')])['filter']({'secret':![]})[_0xd8c9('0x3a')](function(_0x214d81){return{'date':moment(_0x214d81['createdAt'])[_0xd8c9('0xc7')](_0xd8c9('0xd7'))[_0xd8c9('0x90')](),'sender':_0x214d81[_0xd8c9('0xcf')]===_0xd8c9('0xdc')?_0x214d81[_0xd8c9('0xc9')]?_0x214d81[_0xd8c9('0xc9')][_0xd8c9('0xca')]:_0xd8c9('0xdd'):_0x214d81[_0xd8c9('0xcc')][_0xd8c9('0xcd')]+(_0x214d81[_0xd8c9('0xcc')][_0xd8c9('0xce')]?'\x20'+_0x214d81['Contact'][_0xd8c9('0xce')]:''),'body':_0x214d81[_0xd8c9('0xb0')],'direction':_0x214d81[_0xd8c9('0xcf')]===_0xd8c9('0xdc')?'A':'C','secret':_0x214d81['secret'],'read':_0x214d81[_0xd8c9('0x77')]};})['value']()};return ejs[_0xd8c9('0xde')](path[_0xd8c9('0xc5')](config[_0xd8c9('0xc2')],'server','views',_0xd8c9('0xdf')),{'interaction':_0x5bcd68})['then'](function(_0x105c4e){var _0x2fec69=path[_0xd8c9('0xc5')](_0x2b4c35,_0xd8c9('0xe0')+_0x36bf17['id']+'-'+_0x4d7a39+'.pdf');var _0x18ede5={'path':_0x2fec69,'channel':'Sms','interactionId':_0x36bf17['id']};return pdf[_0xd8c9('0xe1')](_0x105c4e,_0x18ede5);})[_0xd8c9('0x28')](function(){return new BPromise(function(_0x297c22,_0x3bdee9){zipdir(_0x2b4c35,{'saveTo':_0x141a4e},function(_0x2b3e62,_0x16be0b){if(_0x2b3e62)return _0x3bdee9(_0x2b3e62);return _0x297c22(_0x16be0b);});})[_0xd8c9('0x28')](function(){return new BPromise(function(_0x224843,_0x3bdcfe){rimraf(_0x2b4c35,function(_0x4079ed){if(_0x4079ed)_0x3bdcfe(_0x4079ed);return _0x224843();});});})['then'](function(){return _0xfb72e5[_0xd8c9('0xc0')](_0x141a4e,_0x14a24a,function(_0xda3816){if(_0xda3816){console[_0xd8c9('0xe2')](_0xd8c9('0xe3'),_0xda3816);}else{fs['unlinkSync'](_0x141a4e);}});});});}else{return _0xfb72e5[_0xd8c9('0xe4')](0xc8);}})['catch'](handleError(_0xfb72e5,null));}; \ No newline at end of file +var _0xdf97=['Sms','Account','Owner','N.A.','closed','closedAt','disposition','Messages','out','System','firstName','renderFile','views','transcript-','log','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','./smsInteraction.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','text','body','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','params','includeAll','include','options','create','update','describe','addMessage','ids','getMessages','findOne','SmsMessage','pick','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','User','CmContact','lastName','direction','SmsAccount','get','mkdirSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf97,0x1ce));var _0x7df9=function(_0x542465,_0x5a5874){_0x542465=_0x542465-0x0;var _0x2cd7ff=_0xdf97[_0x542465];return _0x2cd7ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7df9('0x0'));var zipdir=require(_0x7df9('0x1'));var jsonpatch=require(_0x7df9('0x2'));var rp=require('request-promise');var moment=require(_0x7df9('0x3'));var BPromise=require(_0x7df9('0x4'));var Mustache=require(_0x7df9('0x5'));var util=require('util');var path=require(_0x7df9('0x6'));var sox=require('sox');var csv=require(_0x7df9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7df9('0x8'));var _=require(_0x7df9('0x9'));var squel=require(_0x7df9('0xa'));var crypto=require(_0x7df9('0xb'));var jsforce=require(_0x7df9('0xc'));var deskjs=require(_0x7df9('0xd'));var toCsv=require(_0x7df9('0x7'));var querystring=require(_0x7df9('0xe'));var Papa=require(_0x7df9('0xf'));var Redis=require(_0x7df9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7df9('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x7df9('0x12'));var logger=require('../../config/logger')(_0x7df9('0x13'));var utils=require(_0x7df9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7df9('0x15'))['db'];config[_0x7df9('0x16')]=_[_0x7df9('0x17')](config[_0x7df9('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7df9('0x16')]));require(_0x7df9('0x18'))['register'](socket);function respondWithStatusCode(_0x4348cd,_0x17352c){_0x17352c=_0x17352c||0xcc;return function(_0x53d952){if(_0x53d952){return _0x4348cd[_0x7df9('0x19')](_0x17352c);}return _0x4348cd[_0x7df9('0x1a')](_0x17352c)[_0x7df9('0x1b')]();};}function respondWithResult(_0x35a236,_0x5782f7){_0x5782f7=_0x5782f7||0xc8;return function(_0x217504){if(_0x217504){return _0x35a236['status'](_0x5782f7)[_0x7df9('0x1c')](_0x217504);}};}function respondWithFilteredResult(_0xec1f46,_0xddf7eb){return function(_0x1d25d1){if(_0x1d25d1){var _0x1c2b7b=typeof _0xddf7eb['offset']==='undefined'&&typeof _0xddf7eb['limit']==='undefined';var _0x26cff0=_0x1d25d1['count'];var _0x48f78=_0x1c2b7b?0x0:_0xddf7eb[_0x7df9('0x1d')];var _0x3b434a=_0x1c2b7b?_0x1d25d1['count']:_0xddf7eb[_0x7df9('0x1d')]+_0xddf7eb[_0x7df9('0x1e')];var _0x15e56c;if(_0x3b434a>=_0x26cff0){_0x3b434a=_0x26cff0;_0x15e56c=0xc8;}else{_0x15e56c=0xce;}_0xec1f46['status'](_0x15e56c);return _0xec1f46[_0x7df9('0x1f')](_0x7df9('0x20'),_0x48f78+'-'+_0x3b434a+'/'+_0x26cff0)['json'](_0x1d25d1);}return null;};}function patchUpdates(_0x5c2b2b){return function(_0x441f4a){try{jsonpatch[_0x7df9('0x21')](_0x441f4a,_0x5c2b2b,!![]);}catch(_0x141dab){return BPromise[_0x7df9('0x22')](_0x141dab);}return _0x441f4a[_0x7df9('0x23')]();};}function saveUpdates(_0xfb34a0,_0x2b96d0){return function(_0x2152e7){if(_0x2152e7){return _0x2152e7['update'](_0xfb34a0)['then'](function(_0x48b3af){return _0x48b3af;});}return null;};}function removeEntity(_0x3c23b2,_0x246139){return function(_0x20b5b0){if(_0x20b5b0){return _0x20b5b0[_0x7df9('0x24')]()[_0x7df9('0x25')](function(){_0x3c23b2[_0x7df9('0x1a')](0xcc)[_0x7df9('0x1b')]();});}};}function handleEntityNotFound(_0x2032fa,_0x10531c){return function(_0x557b97){if(!_0x557b97){_0x2032fa['sendStatus'](0x194);}return _0x557b97;};}function handleError(_0xf96555,_0x39777d){_0x39777d=_0x39777d||0x1f4;return function(_0xc3c069){logger[_0x7df9('0x26')](_0xc3c069['stack']);if(_0xc3c069[_0x7df9('0x27')]){delete _0xc3c069[_0x7df9('0x27')];}_0xf96555[_0x7df9('0x1a')](_0x39777d)[_0x7df9('0x28')](_0xc3c069);};}function getInteractionUsers(_0x59ebb1,_0x37d086){return new BPromise(function(_0x94e402,_0x2c1af8){try{if(_0x37d086[_0x59ebb1['id']]){_0x59ebb1[_0x7df9('0x29')]=_[_0x7df9('0x2a')](_0x37d086[_0x59ebb1['id']],function(_0x1048fd){return{'id':_0x1048fd['id'],'fullname':_0x1048fd[_0x7df9('0x2b')]};});}}catch(_0x33ee0c){_0x2c1af8(_0x33ee0c);}_0x94e402(_0x59ebb1);});}function getInteractionTags(_0x2bb3e7,_0x2b3021){return new BPromise(function(_0x4f12e5,_0x2d8000){try{if(_0x2bb3e7[_0x7df9('0x2c')]){_0x2bb3e7[_0x7df9('0x2d')]=[];_0x2bb3e7[_0x7df9('0x2c')]['split'](',')[_0x7df9('0x2e')](function(_0x21488c){_0x2bb3e7[_0x7df9('0x2d')][_0x7df9('0x2f')](_0x2b3021[_0x21488c]);});}delete _0x2bb3e7['TagIds'];}catch(_0x352415){_0x2d8000(_0x352415);}_0x4f12e5(_0x2bb3e7);});}function updateSmsInteraction(_0x184b5f,_0x2e2d09,_0x2255cf){return new BPromise(function(_0x25004b,_0x286d8d){return getInteractionUsers(_0x184b5f,_0x2255cf)[_0x7df9('0x25')](function(_0x9ef004){return getInteractionTags(_0x9ef004,_0x2e2d09);})[_0x7df9('0x25')](function(_0x1fb189){_0x25004b(_0x1fb189);})[_0x7df9('0x30')](function(_0x429328){_0x286d8d(_0x429328);});});}exports[_0x7df9('0x31')]=function(_0x24f525,_0x5e73ed){var _0x300207={},_0x560b89={},_0x19194a={'count':0x0,'rows':[]};var _0x2272f9=_[_0x7df9('0x2a')](db[_0x7df9('0x32')][_0x7df9('0x33')],function(_0x2a2545){return{'name':_0x2a2545[_0x7df9('0x34')],'type':_0x2a2545['type'][_0x7df9('0x35')]};});_0x560b89[_0x7df9('0x36')]=_[_0x7df9('0x2a')](_0x2272f9,_0x7df9('0x27'));_0x560b89[_0x7df9('0x37')]=_[_0x7df9('0x38')](_0x24f525[_0x7df9('0x37')]);_0x560b89[_0x7df9('0x39')]=_[_0x7df9('0x3a')](_0x560b89[_0x7df9('0x36')],_0x560b89['query']);_0x300207[_0x7df9('0x3b')]=_[_0x7df9('0x3a')](_0x560b89[_0x7df9('0x36')],qs[_0x7df9('0x3c')](_0x24f525['query'][_0x7df9('0x3c')]));_0x300207['attributes']=_0x300207[_0x7df9('0x3b')][_0x7df9('0x3d')]?_0x300207[_0x7df9('0x3b')]:_0x560b89['model'];if(!_0x24f525[_0x7df9('0x37')][_0x7df9('0x3e')](_0x7df9('0x3f'))){_0x300207[_0x7df9('0x1e')]=qs[_0x7df9('0x1e')](_0x24f525[_0x7df9('0x37')][_0x7df9('0x1e')]);_0x300207[_0x7df9('0x1d')]=qs[_0x7df9('0x1d')](_0x24f525[_0x7df9('0x37')][_0x7df9('0x1d')]);}_0x300207[_0x7df9('0x40')]=qs['sort'](_0x24f525[_0x7df9('0x37')][_0x7df9('0x41')]);_0x300207[_0x7df9('0x42')]=qs[_0x7df9('0x39')](_['pick'](_0x24f525['query'],_0x560b89['filters']),_0x2272f9);var _0x28c5a7=[];var _0x1c37dd=squel['select']()['field']('id')[_0x7df9('0x43')]('name')[_0x7df9('0x43')](_0x7df9('0x44'))[_0x7df9('0x45')](_0x7df9('0x46'));var _0x4da160=squel[_0x7df9('0x47')]()[_0x7df9('0x43')](_0x7df9('0x48'))['field']('u.fullname')[_0x7df9('0x43')](_0x7df9('0x49'))[_0x7df9('0x45')](_0x7df9('0x4a'),'ui')[_0x7df9('0x4b')](_0x7df9('0x4c'),'u',_0x7df9('0x4d'));var _0x29f9f3=squel[_0x7df9('0x47')]()[_0x7df9('0x45')]('sms_interactions','i')[_0x7df9('0x4b')](_0x7df9('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x7df9('0x4b')]('users','o','o.id\x20=\x20i.UserId')[_0x7df9('0x4b')](_0x7df9('0x4f'),'a',_0x7df9('0x50'))[_0x7df9('0x4b')](_0x7df9('0x51'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x7df9('0x4b')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x7df9('0x4b')]('tools_tags','t',_0x7df9('0x52'));var _0x52b119=squel['expr']();var _0x88f76c=[];var _0x50e11d=squel[_0x7df9('0x53')]();var _0x5c5127;if(_0x24f525[_0x7df9('0x37')][_0x7df9('0x54')]){_0x5c5127=as[_0x7df9('0x55')](_0x24f525['query'][_0x7df9('0x54')]);var _0x546e6d=_0x5c5127[_0x7df9('0x56')];for(var _0x21119d=0x0;_0x21119d<_0x5c5127['conditions']['length'];_0x21119d++){var _0xf23a84=_0x5c5127[_0x7df9('0x57')][_0x21119d];var _0x19f0c3='i';var _0x2e8755=_[_0x7df9('0x58')](_0x2272f9,['name',_0xf23a84[_0x7df9('0x43')]]);if(!_0x2e8755){switch(_0xf23a84['field']){case _0x7df9('0x59'):if(_0xf23a84[_0x7df9('0x5a')]==0x1){_0x29f9f3[_0x7df9('0x5b')]('`'+_0xf23a84[_0x7df9('0x43')]+'`\x20=\x200');}else{_0x29f9f3[_0x7df9('0x5b')]('`'+_0xf23a84[_0x7df9('0x43')]+'`\x20>\x200');}break;case _0x7df9('0x5c'):if(_0xf23a84[_0x7df9('0x5d')]===_0x7df9('0x5e')){if(_0xf23a84[_0x7df9('0x5a')][_0x7df9('0x5f')]('\x20')['length']>0x1){_0x52b119[_0x546e6d](_0x7df9('0x60'),qs[_0x7df9('0x61')](_0xf23a84[_0x7df9('0x5a')]),null);}else{var _0x1d5770='%'+_0xf23a84['value']+'%';_0x52b119[_0x546e6d](_0x7df9('0x62'),_0x1d5770,_0x1d5770,_0x1d5770);}}else{_0x2e8755=_[_0x7df9('0x58')](_0x2272f9,[_0x7df9('0x27'),_0x7df9('0x63')]);_0xf23a84[_0x7df9('0x43')]=_0x7df9('0x63');_0x746d42=as[_0x7df9('0x64')](_0x19f0c3,_0x2e8755[_0x7df9('0x65')],_0xf23a84);_0x52b119[_0x546e6d](_0x746d42['text'],_0x746d42[_0x7df9('0x5a')][_0x7df9('0x66')],_0x746d42[_0x7df9('0x5a')]['end']);}break;case'Tag':var _0x3cbefb=_0xf23a84[_0x7df9('0x5a')][_0x7df9('0x5f')](',')['map'](function(_0x4413f0){return Number(_0x4413f0);});_0x3cbefb['forEach'](function(_0x4eff1f){_0x50e11d['or'](_0x7df9('0x67'),'%,'+_0x4eff1f+',%');});_0x88f76c=_[_0x7df9('0x68')](_0x88f76c,_0x3cbefb);break;case'User':if(_0xf23a84['operator']===_0x7df9('0x5e')){_0x52b119[_0x546e6d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xf23a84['value']+'%',null);}else{_0x2e8755=_[_0x7df9('0x58')](_0x2272f9,[_0x7df9('0x27'),_0x7df9('0x69')]);_0xf23a84['field']=_0x7df9('0x69');_0x746d42=as[_0x7df9('0x64')](_0x19f0c3,_0x2e8755['type'],_0xf23a84);_0x52b119[_0x546e6d](_0x746d42[_0x7df9('0x6a')],_0x746d42['value']['start'],_0x746d42[_0x7df9('0x5a')]['end']);}break;case _0x7df9('0x6b'):_0x746d42=as[_0x7df9('0x64')]('me',null,_0xf23a84);_0x52b119[_0x546e6d](_0x746d42[_0x7df9('0x6a')],_0x746d42[_0x7df9('0x5a')][_0x7df9('0x66')],_0x746d42[_0x7df9('0x5a')]['end']);break;}}else{var _0x746d42=as[_0x7df9('0x64')](_0x19f0c3,_0x2e8755['type'],_0xf23a84);_0x52b119[_0x546e6d](_0x746d42[_0x7df9('0x6a')],_0x746d42[_0x7df9('0x5a')][_0x7df9('0x66')],_0x746d42[_0x7df9('0x5a')][_0x7df9('0x1b')]);}}}else{var _0x40665d=_(_0x24f525[_0x7df9('0x37')])[_0x7df9('0x38')]()[_0x7df9('0x2a')](function(_0x525887){return _['some'](_0x2272f9,['name',_0x525887])?_0x525887:undefined;})['compact']()[_0x7df9('0x5a')]();if(!_[_0x7df9('0x6c')](_0x40665d)){_0x40665d['forEach'](function(_0x9e69f8){if(_0x9e69f8==='SmsAccountId'){_0x29f9f3[_0x7df9('0x42')](_0x7df9('0x6d'),[][_0x7df9('0x6e')](_0x24f525[_0x7df9('0x37')][_0x9e69f8]));}else if(_0x9e69f8===_0x7df9('0x6f')){var _0x1e7c71=JSON['parse'](_0x24f525['query'][_0x9e69f8])[_0x7df9('0x70')];var _0x95aee0=JSON[_0x7df9('0x71')](_0x24f525[_0x7df9('0x37')][_0x9e69f8])['$lte'];_0x29f9f3['where'](_0x7df9('0x72'),_0x1e7c71,_0x95aee0);}else{if(_0x24f525[_0x7df9('0x37')][_0x9e69f8]===_0x7df9('0x73')){_0x29f9f3['where']('i.'+_0x9e69f8+_0x7df9('0x74'));}else{_0x29f9f3[_0x7df9('0x42')]('i.'+_0x9e69f8+_0x7df9('0x75'),_0x24f525[_0x7df9('0x37')][_0x9e69f8]);}}});}if(_0x24f525[_0x7df9('0x37')]['read']){if(_0x24f525[_0x7df9('0x37')][_0x7df9('0x76')]==0x1){_0x29f9f3[_0x7df9('0x5b')](_0x7df9('0x77'));}else{_0x29f9f3[_0x7df9('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x24f525[_0x7df9('0x37')][_0x7df9('0x78')]){_0x88f76c=_[_0x7df9('0x79')](_0x24f525[_0x7df9('0x37')][_0x7df9('0x78')])?_0x24f525[_0x7df9('0x37')][_0x7df9('0x78')]:new Array(_0x24f525[_0x7df9('0x37')][_0x7df9('0x78')]);_0x88f76c['forEach'](function(_0x3556ea){_0x50e11d['or'](_0x7df9('0x67'),'%,'+_0x3556ea+',%');});}if(_0x24f525[_0x7df9('0x37')][_0x7df9('0x7a')]){var _0x290f55=_0x24f525[_0x7df9('0x37')][_0x7df9('0x7a')]['replace']('\x5c','\x5c\x5c')[_0x7df9('0x7b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x290f55)){_0x52b119['or'](_0x7df9('0x7c'),_0x290f55+'%')['or']('i.phone\x20LIKE\x20?',_0x290f55+'%');}else{_0x52b119['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7df9('0x61')](_0x290f55))['or'](_0x7df9('0x7d'),_0x290f55+'%');}}}_0x29f9f3[_0x7df9('0x42')](_0x52b119);_0x29f9f3[_0x7df9('0x7e')]('i.id');var _0x1f2da7={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x5d4b14=_0x29f9f3['clone']();_0x5d4b14[_0x7df9('0x43')](_0x7df9('0x7f'));_0x5d4b14['field'](_0x7df9('0x80'),_0x7df9('0x59'));if(_0x300207['order']){_0x300207[_0x7df9('0x40')][_0x7df9('0x2e')](function(_0x14c3c3){var _0x572adc=_0x14c3c3[0x0]===_0x7df9('0x81')?_0x14c3c3[0x0]:'i.'+_0x14c3c3[0x0];_0x29f9f3[_0x7df9('0x40')](_0x572adc,_0x14c3c3[0x1]===_0x7df9('0x82')?![]:!![]);});}if(!_[_0x7df9('0x6c')](_0x88f76c)){_0x29f9f3[_0x7df9('0x5b')](_0x50e11d);_0x5d4b14[_0x7df9('0x42')](_0x7df9('0x83'),_0x88f76c);}BPromise[_0x7df9('0x84')]()[_0x7df9('0x25')](function(){if(!_0x5c5127){if(_0x24f525[_0x7df9('0x37')][_0x7df9('0x85')])return;_0x5d4b14['where'](_0x7df9('0x86'));_0x29f9f3[_0x7df9('0x42')](_0x7df9('0x86'));return;}if(_0x24f525[_0x7df9('0x87')][_0x7df9('0x88')]!==_0x7df9('0x89'))return;return _0x24f525[_0x7df9('0x87')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x7df9('0x25')](function(_0x10d406){if(_[_0x7df9('0x6c')](_0x10d406)){_0x5d4b14[_0x7df9('0x42')](_0x7df9('0x8a'));_0x29f9f3[_0x7df9('0x42')](_0x7df9('0x8a'));}else{_0x5d4b14[_0x7df9('0x42')](_0x7df9('0x6d'),_['map'](_0x10d406,'id'));_0x29f9f3[_0x7df9('0x42')](_0x7df9('0x6d'),_['map'](_0x10d406,'id'));}});})[_0x7df9('0x25')](function(){if(_0x24f525[_0x7df9('0x87')]['role']==='agent'&&!_0x5c5127&&!_0x24f525['query'][_0x7df9('0x85')])return[];return db[_0x7df9('0x8b')][_0x7df9('0x37')](_0x5d4b14['toString'](),_0x1f2da7);})[_0x7df9('0x25')](function(_0x3a6d26){_0x19194a['count']=_0x3a6d26[_0x7df9('0x3d')];if(_0x19194a[_0x7df9('0x8c')]===0x0)return[];return db[_0x7df9('0x8b')][_0x7df9('0x37')](_0x1c37dd['toString'](),_0x1f2da7)['then'](function(_0x22daff){_0x28c5a7=_[_0x7df9('0x8d')](_0x22daff,'id');_0x1f2da7=_['merge'](_0x1f2da7,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x24f525[_0x7df9('0x37')][_0x7df9('0x3c')]){_0x300207[_0x7df9('0x3b')][_0x7df9('0x2e')](function(_0x208764){_0x29f9f3[_0x7df9('0x43')]('i.'+_0x208764);});}else{_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x80'),_0x7df9('0x59'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x8e'),_0x7df9('0x8f'));_0x29f9f3['field'](_0x7df9('0x90'),_0x7df9('0x91'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x92'),'contactName');_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x93'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x94'),_0x7df9('0x95'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x96'),_0x7df9('0x97'));_0x29f9f3['field'](_0x7df9('0x98'),_0x7df9('0x99'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x9a'),_0x7df9('0x9b'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x9c'),_0x7df9('0x9d'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0x9e'),_0x7df9('0x9f'));_0x29f9f3['field'](_0x7df9('0xa0'),'Owner.fullname');_0x29f9f3[_0x7df9('0x43')]('o.internal',_0x7df9('0xa1'));_0x29f9f3[_0x7df9('0x43')](_0x7df9('0xa2'),_0x7df9('0x2c'));}if(_0x300207['limit'])_0x29f9f3[_0x7df9('0x1e')](_0x300207[_0x7df9('0x1e')]);if(_0x300207['offset'])_0x29f9f3[_0x7df9('0x1d')](_0x300207['offset']);return db[_0x7df9('0x8b')][_0x7df9('0x37')](_0x29f9f3[_0x7df9('0xa3')](),_0x1f2da7);})[_0x7df9('0x25')](function(_0x63e42a){if(_0x63e42a[_0x7df9('0x3d')]>0x0)_0x4da160[_0x7df9('0x42')](_0x7df9('0xa4'),_[_0x7df9('0x2a')](_0x63e42a,'id'));return db[_0x7df9('0x8b')]['query'](_0x4da160['toString'](),_0x1f2da7)[_0x7df9('0x25')](function(_0x55eed1){var _0x3fb65e=_[_0x7df9('0xa5')](_0x55eed1,_0x7df9('0xa6'));var _0x271767=[];_0x63e42a[_0x7df9('0x2e')](function(_0x31f0f1){_0x271767['push'](updateSmsInteraction(_0x31f0f1,_0x28c5a7,_0x3fb65e));});return BPromise['all'](_0x271767);});});})[_0x7df9('0x25')](function(_0xf97b72){_0x19194a[_0x7df9('0xa7')]=_0xf97b72;return _0x19194a;})[_0x7df9('0x25')](respondWithFilteredResult(_0x5e73ed,_0x300207))[_0x7df9('0x30')](handleError(_0x5e73ed,null));};exports['show']=function(_0x6773c8,_0xaff5ca){var _0x5f597b={'raw':![],'where':{'id':_0x6773c8[_0x7df9('0xa8')]['id']}},_0x31cc57={};_0x31cc57[_0x7df9('0x36')]=_[_0x7df9('0x38')](db['SmsInteraction'][_0x7df9('0x33')]);_0x31cc57[_0x7df9('0x37')]=_[_0x7df9('0x38')](_0x6773c8[_0x7df9('0x37')]);_0x31cc57['filters']=_[_0x7df9('0x3a')](_0x31cc57[_0x7df9('0x36')],_0x31cc57['query']);_0x5f597b[_0x7df9('0x3b')]=_['intersection'](_0x31cc57[_0x7df9('0x36')],qs['fields'](_0x6773c8[_0x7df9('0x37')][_0x7df9('0x3c')]));_0x5f597b[_0x7df9('0x3b')]=_0x5f597b[_0x7df9('0x3b')][_0x7df9('0x3d')]?_0x5f597b[_0x7df9('0x3b')]:_0x31cc57[_0x7df9('0x36')];if(_0x6773c8[_0x7df9('0x37')][_0x7df9('0xa9')]){_0x5f597b[_0x7df9('0xaa')]=[{'all':!![]}];}_0x5f597b=_['merge']({},_0x5f597b,_0x6773c8[_0x7df9('0xab')]);return db[_0x7df9('0x32')][_0x7df9('0x58')](_0x5f597b)[_0x7df9('0x25')](handleEntityNotFound(_0xaff5ca,null))[_0x7df9('0x25')](respondWithResult(_0xaff5ca,null))['catch'](handleError(_0xaff5ca,null));};exports[_0x7df9('0xac')]=function(_0x14cacb,_0x33bba6){return db[_0x7df9('0x32')][_0x7df9('0xac')](_0x14cacb[_0x7df9('0x6b')],{})['then'](respondWithResult(_0x33bba6,0xc9))[_0x7df9('0x30')](handleError(_0x33bba6,null));};exports[_0x7df9('0xad')]=function(_0x239d5c,_0x44764f){if(_0x239d5c[_0x7df9('0x6b')]['id']){delete _0x239d5c[_0x7df9('0x6b')]['id'];}return db[_0x7df9('0x32')]['find']({'where':{'id':_0x239d5c[_0x7df9('0xa8')]['id']}})['then'](handleEntityNotFound(_0x44764f,null))[_0x7df9('0x25')](saveUpdates(_0x239d5c[_0x7df9('0x6b')],null))[_0x7df9('0x25')](respondWithResult(_0x44764f,null))[_0x7df9('0x30')](handleError(_0x44764f,null));};exports[_0x7df9('0x24')]=function(_0x512bf5,_0x331a1c){return db['SmsInteraction']['find']({'where':{'id':_0x512bf5[_0x7df9('0xa8')]['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x331a1c,null))[_0x7df9('0x25')](removeEntity(_0x331a1c,null))[_0x7df9('0x30')](handleError(_0x331a1c,null));};exports[_0x7df9('0xae')]=function(_0x15b3c8,_0x31098){return db['SmsInteraction'][_0x7df9('0xae')]()[_0x7df9('0x25')](respondWithResult(_0x31098,null))[_0x7df9('0x30')](handleError(_0x31098,null));};exports[_0x7df9('0xaf')]=function(_0xd26b86,_0x412f55,_0x240d0a){return db['SmsMessage'][_0x7df9('0x58')]({'where':{'id':_0xd26b86[_0x7df9('0xa8')]['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x412f55,null))[_0x7df9('0x25')](function(_0xd058b1){if(_0xd058b1){return _0xd058b1[_0x7df9('0xaf')](_0xd26b86[_0x7df9('0x6b')][_0x7df9('0xb0')],_['omit'](_0xd26b86['body'],[_0x7df9('0xb0'),'id'])||{});}})['then'](respondWithResult(_0x412f55,null))[_0x7df9('0x30')](handleError(_0x412f55,null));};exports[_0x7df9('0xb1')]=function(_0x43d6eb,_0x2bb1cf,_0x106136){var _0x15df19={'raw':![],'where':{}};var _0x48fc85={};var _0x22482c={'count':0x0,'rows':[]};return db[_0x7df9('0x32')][_0x7df9('0xb2')]({'where':{'id':_0x43d6eb['params']['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x2bb1cf,null))[_0x7df9('0x25')](function(_0x482367){if(_0x482367){_0x48fc85[_0x7df9('0x36')]=_['keys'](db[_0x7df9('0xb3')][_0x7df9('0x33')]);_0x48fc85[_0x7df9('0x37')]=_[_0x7df9('0x38')](_0x43d6eb[_0x7df9('0x37')]);_0x48fc85[_0x7df9('0x39')]=_[_0x7df9('0x3a')](_0x48fc85[_0x7df9('0x36')],_0x48fc85[_0x7df9('0x37')]);_0x15df19[_0x7df9('0x3b')]=_[_0x7df9('0x3a')](_0x48fc85[_0x7df9('0x36')],qs[_0x7df9('0x3c')](_0x43d6eb[_0x7df9('0x37')][_0x7df9('0x3c')]));_0x15df19[_0x7df9('0x3b')]=_0x15df19[_0x7df9('0x3b')][_0x7df9('0x3d')]?_0x15df19[_0x7df9('0x3b')]:_0x48fc85['model'];if(!_0x43d6eb[_0x7df9('0x37')][_0x7df9('0x3e')](_0x7df9('0x3f'))){_0x15df19[_0x7df9('0x1e')]=qs[_0x7df9('0x1e')](_0x43d6eb[_0x7df9('0x37')][_0x7df9('0x1e')]);_0x15df19[_0x7df9('0x1d')]=qs[_0x7df9('0x1d')](_0x43d6eb[_0x7df9('0x37')][_0x7df9('0x1d')]);}_0x15df19[_0x7df9('0x40')]=qs[_0x7df9('0x41')](_0x43d6eb[_0x7df9('0x37')][_0x7df9('0x41')]);_0x15df19[_0x7df9('0x42')]=qs[_0x7df9('0x39')](_[_0x7df9('0xb4')](_0x43d6eb[_0x7df9('0x37')],_0x48fc85[_0x7df9('0x39')]));_0x15df19['where'][_0x7df9('0xa6')]=_0x482367['id'];if(_0x43d6eb[_0x7df9('0x37')][_0x7df9('0x7a')]){_0x15df19['where']=_[_0x7df9('0xb5')](_0x15df19['where'],{'$or':_[_0x7df9('0x2a')](_0x15df19[_0x7df9('0x3b')],function(_0x24177a){var _0x412171={};_0x412171[_0x24177a]={'$like':'%'+_0x43d6eb['query'][_0x7df9('0x7a')]+'%'};return _0x412171;})});}if(_0x43d6eb['query'][_0x7df9('0x70')]){var _0x24530e=_0x43d6eb['query'][_0x7df9('0x70')][_0x7df9('0x5f')](',');var _0x7af32f={};_0x7af32f[_0x24530e[0x0]]={'$gte':moment(_0x24530e[0x1])[_0x7df9('0xb6')](_0x7df9('0xb7'))};_0x15df19[_0x7df9('0x42')]=_[_0x7df9('0xb5')](_0x15df19[_0x7df9('0x42')],_0x7af32f);}_0x15df19=_[_0x7df9('0xb5')]({},_0x15df19,_0x43d6eb[_0x7df9('0xab')]);return db[_0x7df9('0xb3')][_0x7df9('0x8c')]({'where':_0x15df19[_0x7df9('0x42')]})['then'](function(_0x3c892d){_0x22482c[_0x7df9('0x8c')]=_0x3c892d;if(_0x43d6eb['query']['includeAll']){_0x15df19[_0x7df9('0xaa')]=[{'all':!![]}];}return db[_0x7df9('0xb3')][_0x7df9('0xb8')](_0x15df19);})['then'](function(_0x2336e4){_0x22482c['rows']=_0x2336e4;return _0x22482c;});}})[_0x7df9('0x25')](respondWithFilteredResult(_0x2bb1cf,_0x15df19))['catch'](handleError(_0x2bb1cf,null));};exports[_0x7df9('0xb9')]=function(_0x216c5e,_0x15e50b,_0x29442c){return db[_0x7df9('0x32')]['find']({'where':{'id':_0x216c5e['params']['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x15e50b,null))[_0x7df9('0x25')](function(_0x4b985e){if(_0x4b985e){return _0x4b985e['setTags'](_0x216c5e[_0x7df9('0x6b')][_0x7df9('0xb0')],_[_0x7df9('0xba')](_0x216c5e['body'],[_0x7df9('0xb0'),'id'])||{})[_0x7df9('0xbb')](function(){return db['Tag']['findAll']({'attributes':['id',_0x7df9('0x27'),_0x7df9('0x44')],'where':{'id':_0x216c5e[_0x7df9('0x6b')][_0x7df9('0xb0')]}});})['then'](function(_0xbea510){socket[_0x7df9('0xbc')](_0x7df9('0xbd'),{'id':Number(_0x216c5e[_0x7df9('0xa8')]['id']),'tags':_0xbea510||[]});return{'id':Number(_0x216c5e[_0x7df9('0xa8')]['id']),'tags':_0xbea510||[]};});}})[_0x7df9('0x25')](respondWithResult(_0x15e50b,null))['catch'](handleError(_0x15e50b,null));};exports[_0x7df9('0xbe')]=function(_0x581fde,_0x383777,_0x3ba48e){return db[_0x7df9('0x32')]['find']({'where':{'id':_0x581fde[_0x7df9('0xa8')]['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x383777,null))['then'](function(_0x35674a){if(_0x35674a){return _0x35674a['removeTags'](_0x581fde[_0x7df9('0x37')][_0x7df9('0xb0')]);}})[_0x7df9('0x25')](respondWithStatusCode(_0x383777,null))[_0x7df9('0x30')](handleError(_0x383777,null));};exports[_0x7df9('0xbf')]=function(_0x3e96ad,_0x1f1f87){var _0x2214a9=moment()[_0x7df9('0xc0')]()[_0x7df9('0xa3')]();var _0x2d8a66=path['join'](config[_0x7df9('0xc1')],_0x7df9('0xc2'),'files',_0x7df9('0xc3'));var _0x4ca578=path[_0x7df9('0xc4')](config['root'],_0x7df9('0xc2'),_0x7df9('0xc5'),_0x7df9('0xc6'));var _0x294304=path[_0x7df9('0xc4')](_0x2d8a66,_0x2214a9);var _0x4d6844=util[_0x7df9('0xb6')](_0x7df9('0xc7'),_0x3e96ad[_0x7df9('0xa8')]['id'],_0x2214a9);var _0x3c5aea=path[_0x7df9('0xc4')](_0x2d8a66,_0x4d6844);var _0x113044=[];_0x113044[_0x7df9('0x2f')]({'model':db[_0x7df9('0xc8')],'as':_0x7df9('0xc8'),'attributes':['id','fullname'],'raw':!![]});_0x113044[_0x7df9('0x2f')]({'model':db[_0x7df9('0xc9')],'as':'Contact','attributes':['id','firstName',_0x7df9('0xca')],'raw':!![]});var _0x25f3ae=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x7df9('0x6b'),_0x7df9('0x6f'),_0x7df9('0xcb'),'secret',_0x7df9('0x76')],'include':_0x113044}];_0x25f3ae[_0x7df9('0x2f')]({'model':db[_0x7df9('0xcc')],'as':'Account','attributes':['id',_0x7df9('0x27')]});_0x25f3ae[_0x7df9('0x2f')]({'model':db[_0x7df9('0xc8')],'as':'Owner','attributes':['id','fullname']});return db[_0x7df9('0x32')][_0x7df9('0x58')]({'where':{'id':_0x3e96ad[_0x7df9('0xa8')]['id']},'include':_0x25f3ae})[_0x7df9('0x25')](handleEntityNotFound(_0x1f1f87,null))['then'](function(_0x3383e0){if(_0x3383e0){var _0x1ed619=_0x3383e0[_0x7df9('0xcd')]({'plain':!![]});fs[_0x7df9('0xce')](_0x294304);var _0x2d200a={'channel':_0x7df9('0xcf'),'account':_0x1ed619[_0x7df9('0xd0')][_0x7df9('0x27')],'agent':_0x1ed619['Owner']?_0x1ed619[_0x7df9('0xd1')][_0x7df9('0x2b')]:_0x7df9('0xd2'),'createdAt':moment(_0x1ed619[_0x7df9('0x6f')])[_0x7df9('0xb6')](_0x7df9('0xb7'))[_0x7df9('0xa3')](),'closedAt':_0x1ed619[_0x7df9('0xd3')]?moment(_0x1ed619[_0x7df9('0xd4')])[_0x7df9('0xb6')](_0x7df9('0xb7'))[_0x7df9('0xa3')]():'','disposition':_0x1ed619[_0x7df9('0xd5')],'messages':_(_0x1ed619[_0x7df9('0xd6')])['filter']({'secret':![]})[_0x7df9('0x2a')](function(_0x3f9d63){return{'date':moment(_0x3f9d63['createdAt'])[_0x7df9('0xb6')](_0x7df9('0xb7'))['toString'](),'sender':_0x3f9d63[_0x7df9('0xcb')]===_0x7df9('0xd7')?_0x3f9d63[_0x7df9('0xc8')]?_0x3f9d63[_0x7df9('0xc8')][_0x7df9('0x2b')]:_0x7df9('0xd8'):_0x3f9d63[_0x7df9('0x5c')][_0x7df9('0xd9')]+(_0x3f9d63[_0x7df9('0x5c')][_0x7df9('0xca')]?'\x20'+_0x3f9d63[_0x7df9('0x5c')][_0x7df9('0xca')]:''),'body':_0x3f9d63['body'],'direction':_0x3f9d63[_0x7df9('0xcb')]===_0x7df9('0xd7')?'A':'C','secret':_0x3f9d63['secret'],'read':_0x3f9d63['read']};})[_0x7df9('0x5a')]()};return ejs[_0x7df9('0xda')](path[_0x7df9('0xc4')](config['root'],_0x7df9('0xc2'),_0x7df9('0xdb'),'downloadInteraction.ejs'),{'interaction':_0x2d200a})[_0x7df9('0x25')](function(_0x2867c5){var _0x4d0542=path['join'](_0x294304,_0x7df9('0xdc')+_0x1ed619['id']+'-'+_0x2214a9+'.pdf');var _0x8f06a={'path':_0x4d0542,'channel':_0x7df9('0xcf'),'interactionId':_0x1ed619['id']};return pdf['createPdfFromHTML'](_0x2867c5,_0x8f06a);})[_0x7df9('0x25')](function(){return new BPromise(function(_0x52360a,_0x227e09){zipdir(_0x294304,{'saveTo':_0x3c5aea},function(_0x557b1e,_0x4926ee){if(_0x557b1e)return _0x227e09(_0x557b1e);return _0x52360a(_0x4926ee);});})['then'](function(){return new BPromise(function(_0x2c7df3,_0x267eca){rimraf(_0x294304,function(_0xd53347){if(_0xd53347)_0x267eca(_0xd53347);return _0x2c7df3();});});})[_0x7df9('0x25')](function(){return _0x1f1f87['download'](_0x3c5aea,_0x4d6844,function(_0x2afb3b){if(_0x2afb3b){console[_0x7df9('0xdd')]('err',_0x2afb3b);}else{fs[_0x7df9('0xde')](_0x3c5aea);}});});});}else{return _0x1f1f87['sendStatus'](0xc8);}})[_0x7df9('0x30')](handleError(_0x1f1f87,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8f39425..cdb5a05 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 _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x54281e,_0x568007){var _0x392158=function(_0xba7dcd){while(--_0xba7dcd){_0x54281e['push'](_0x54281e['shift']());}};_0x392158(++_0x568007);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x257261,_0x1f5f15){_0x257261=_0x257261-0x0;var _0x127d77=_0xdd4f[_0x257261];return _0x127d77;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x781d=['map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users'];(function(_0x309e94,_0x4c33f6){var _0x297c03=function(_0x231c47){while(--_0x231c47){_0x309e94['push'](_0x309e94['shift']());}};_0x297c03(++_0x4c33f6);}(_0x781d,0x14a));var _0xd781=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x781d[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0xd781('0x0'));var SmsInteraction=require(_0xd781('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xd781('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xd781('0x3')](0x0);var events={'afterCreate':_0xd781('0x4'),'afterUpdate':_0xd781('0x5'),'afterDestroy':_0xd781('0x6')};function emitEvent(_0x42258e){return function(_0x446534,_0x1d4f4e,_0x830b){_0x446534[_0xd781('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x133509){_0x446534[_0xd781('0x8')](_0xd781('0x9'),_0x133509[_0xd781('0xa')](function(_0x4b1a57){return{'id':_0x4b1a57['id']};}));return SmsMessage[_0xd781('0xb')]({'where':{'SmsInteractionId':_0x446534['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x43d863){_0x446534[_0xd781('0x8')]('unreadMessages',_0x43d863[_0xd781('0xc')]);SmsInteractionEvents[_0xd781('0xd')](_0x42258e+':'+_0x446534['id'],_0x446534);SmsInteractionEvents['emit'](_0x42258e,_0x446534);_0x830b(null);})['catch'](_0x830b(null));};}for(var e in events){if(events[_0xd781('0xe')](e)){var event=events[e];SmsInteraction[_0xd781('0xf')](e,emitEvent(event));}}module[_0xd781('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 535761f..8273abf 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 _0x3bae=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format','util','../../config/logger'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x3bae,0x1c0));var _0xe3ba=function(_0x20b750,_0x3f6d3f){_0x20b750=_0x20b750-0x0;var _0x57d42c=_0x3bae[_0x20b750];return _0x57d42c;};'use strict';var _=require('lodash');var util=require(_0xe3ba('0x0'));var logger=require(_0xe3ba('0x1'))(_0xe3ba('0x2'));var moment=require('moment');var BPromise=require(_0xe3ba('0x3'));var rp=require(_0xe3ba('0x4'));var fs=require('fs');var path=require(_0xe3ba('0x5'));var rimraf=require(_0xe3ba('0x6'));var config=require(_0xe3ba('0x7'));var attributes=require('./smsInteraction.attributes');module[_0xe3ba('0x8')]=function(_0x567986,_0x119f99){return _0x567986[_0xe3ba('0x9')](_0xe3ba('0xa'),attributes,{'tableName':_0xe3ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf512a2,_0x29b374,_0x2007ca){if(_0xf512a2[_0xe3ba('0xc')]('closed')){_0xf512a2[_0xe3ba('0xd')]=moment()[_0xe3ba('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2007ca(null,_0xf512a2);}}});}; \ No newline at end of file +var _0x907e=['path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','util','api','bluebird','request-promise'];(function(_0x567775,_0x39c274){var _0x1434a2=function(_0x44af53){while(--_0x44af53){_0x567775['push'](_0x567775['shift']());}};_0x1434a2(++_0x39c274);}(_0x907e,0x106));var _0xe907=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x907e[_0x1aab74];return _0x396af2;};'use strict';var _=require('lodash');var util=require(_0xe907('0x0'));var logger=require('../../config/logger')(_0xe907('0x1'));var moment=require('moment');var BPromise=require(_0xe907('0x2'));var rp=require(_0xe907('0x3'));var fs=require('fs');var path=require(_0xe907('0x4'));var rimraf=require(_0xe907('0x5'));var config=require(_0xe907('0x6'));var attributes=require(_0xe907('0x7'));module[_0xe907('0x8')]=function(_0x28863c,_0x42fb61){return _0x28863c[_0xe907('0x9')]('SmsInteraction',attributes,{'tableName':_0xe907('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58dd61,_0x2a0809,_0x1cb0c1){if(_0x58dd61[_0xe907('0xb')](_0xe907('0xc'))){_0x58dd61[_0xe907('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1cb0c1(null,_0x58dd61);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 1cc3411..f288dc4 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 _0xba37=['../../config/utils','rpc','../../config/environment','client','redis','./smsInteraction.socket','register','then','info','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','body','options','raw','attributes','limit','debug','AddTagsToSmsInteraction','SmsInteraction','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x461935,_0xeaeb6e){var _0x1f809f=function(_0x56c009){while(--_0x56c009){_0x461935['push'](_0x461935['shift']());}};_0x1f809f(++_0xeaeb6e);}(_0xba37,0x19b));var _0x7ba3=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xba37[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x7ba3('0x0'));var util=require(_0x7ba3('0x1'));var moment=require(_0x7ba3('0x2'));var BPromise=require(_0x7ba3('0x3'));var rs=require(_0x7ba3('0x4'));var fs=require('fs');var Redis=require(_0x7ba3('0x5'));var db=require(_0x7ba3('0x6'))['db'];var utils=require(_0x7ba3('0x7'));var logger=require('../../config/logger')(_0x7ba3('0x8'));var config=require(_0x7ba3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ba3('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7ba3('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ba3('0xb')]));require(_0x7ba3('0xc'))[_0x7ba3('0xd')](socket);function respondWithRpcPromise(_0x39165c,_0x53ca01,_0x257fba){return new BPromise(function(_0x570fed,_0x4e52ec){return client['request'](_0x39165c,_0x257fba)[_0x7ba3('0xe')](function(_0x14d422){logger[_0x7ba3('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x53ca01,_0x7ba3('0x10'));logger['debug'](_0x7ba3('0x11'),_0x53ca01,'request\x20sent',JSON[_0x7ba3('0x12')](_0x14d422));if(_0x14d422['error']){if(_0x14d422[_0x7ba3('0x13')]['code']===0x1f4){logger[_0x7ba3('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x53ca01,_0x14d422['error'][_0x7ba3('0x14')]);return _0x4e52ec(_0x14d422['error'][_0x7ba3('0x14')]);}logger[_0x7ba3('0x13')](_0x7ba3('0x15'),_0x53ca01,_0x14d422[_0x7ba3('0x13')][_0x7ba3('0x14')]);return _0x570fed(_0x14d422[_0x7ba3('0x13')][_0x7ba3('0x14')]);}else{logger[_0x7ba3('0xf')](_0x7ba3('0x15'),_0x53ca01,'request\x20sent');_0x570fed(_0x14d422[_0x7ba3('0x16')]['message']);}})[_0x7ba3('0x17')](function(_0x8147a){logger[_0x7ba3('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x53ca01,_0x8147a);_0x4e52ec(_0x8147a);});});}exports[_0x7ba3('0x18')]=function(_0x453b2d){var _0x436f0f=this;return new Promise(function(_0x444fd3,_0x2eba95){return db['SmsInteraction']['update'](_0x453b2d[_0x7ba3('0x19')],{'raw':_0x453b2d[_0x7ba3('0x1a')]?_0x453b2d[_0x7ba3('0x1a')][_0x7ba3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453b2d[_0x7ba3('0x1a')]?_0x453b2d[_0x7ba3('0x1a')]['where']||null:null,'attributes':_0x453b2d[_0x7ba3('0x1a')]?_0x453b2d[_0x7ba3('0x1a')][_0x7ba3('0x1c')]||null:null,'limit':_0x453b2d[_0x7ba3('0x1a')]?_0x453b2d[_0x7ba3('0x1a')][_0x7ba3('0x1d')]||null:null})['then'](function(_0xb63981){logger[_0x7ba3('0xf')](_0x7ba3('0x18'),_0x453b2d);logger[_0x7ba3('0x1e')](_0x7ba3('0x18'),_0x453b2d,JSON[_0x7ba3('0x12')](_0xb63981));_0x444fd3(_0xb63981);})['catch'](function(_0x1b1b2c){logger[_0x7ba3('0x13')](_0x7ba3('0x18'),_0x1b1b2c[_0x7ba3('0x14')],_0x453b2d);_0x2eba95(_0x436f0f['error'](0x1f4,_0x1b1b2c[_0x7ba3('0x14')]));});});};exports[_0x7ba3('0x1f')]=function(_0x213d45){return new Promise(function(_0x22d3a6,_0x56b114){return db[_0x7ba3('0x20')]['find']({'where':_0x213d45[_0x7ba3('0x1a')]?_0x213d45[_0x7ba3('0x1a')][_0x7ba3('0x21')]||null:null})[_0x7ba3('0xe')](function(_0xfaad7b){if(_0xfaad7b){return _0xfaad7b[_0x7ba3('0x22')](_0x213d45[_0x7ba3('0x19')][_0x7ba3('0x23')],_[_0x7ba3('0x24')](_0x213d45[_0x7ba3('0x19')],[_0x7ba3('0x23'),'id'])||{});}})['spread'](function(_0x2e3072){logger['info'](_0x7ba3('0x25'),_0x213d45);logger[_0x7ba3('0x1e')](_0x7ba3('0x25'),_0x213d45,JSON['stringify'](_0x2e3072));_0x22d3a6(_0x2e3072);})['catch'](function(_0x23ccda){logger['error'](_0x7ba3('0x25'),_0x23ccda[_0x7ba3('0x14')],_0x213d45);_0x56b114(_this[_0x7ba3('0x13')](0x1f4,_0x23ccda[_0x7ba3('0x14')]));});});}; \ No newline at end of file +var _0x7548=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','ids','spread','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e328a,_0x5ecab9){var _0x224783=function(_0x2311a7){while(--_0x2311a7){_0x1e328a['push'](_0x1e328a['shift']());}};_0x224783(++_0x5ecab9);}(_0x7548,0xd6));var _0x8754=function(_0x4fca07,_0x50acf2){_0x4fca07=_0x4fca07-0x0;var _0x34a133=_0x7548[_0x4fca07];return _0x34a133;};'use strict';var _=require('lodash');var util=require(_0x8754('0x0'));var moment=require(_0x8754('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8754('0x2'));var db=require(_0x8754('0x3'))['db'];var utils=require(_0x8754('0x4'));var logger=require(_0x8754('0x5'))(_0x8754('0x6'));var config=require(_0x8754('0x7'));var jayson=require(_0x8754('0x8'));var client=jayson['client'][_0x8754('0x9')]({'port':0x232a});config[_0x8754('0xa')]=_[_0x8754('0xb')](config[_0x8754('0xa')],{'host':_0x8754('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8754('0xd'))[_0x8754('0xe')](socket);function respondWithRpcPromise(_0x33a2e2,_0x1f31e0,_0x653b5){return new BPromise(function(_0x16525c,_0x46e603){return client[_0x8754('0xf')](_0x33a2e2,_0x653b5)[_0x8754('0x10')](function(_0x1ac27d){logger['info'](_0x8754('0x11'),_0x1f31e0,_0x8754('0x12'));logger[_0x8754('0x13')](_0x8754('0x14'),_0x1f31e0,_0x8754('0x12'),JSON[_0x8754('0x15')](_0x1ac27d));if(_0x1ac27d['error']){if(_0x1ac27d[_0x8754('0x16')]['code']===0x1f4){logger[_0x8754('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x1f31e0,_0x1ac27d[_0x8754('0x16')][_0x8754('0x17')]);return _0x46e603(_0x1ac27d[_0x8754('0x16')][_0x8754('0x17')]);}logger[_0x8754('0x16')](_0x8754('0x11'),_0x1f31e0,_0x1ac27d[_0x8754('0x16')][_0x8754('0x17')]);return _0x16525c(_0x1ac27d['error'][_0x8754('0x17')]);}else{logger[_0x8754('0x18')](_0x8754('0x11'),_0x1f31e0,_0x8754('0x12'));_0x16525c(_0x1ac27d[_0x8754('0x19')][_0x8754('0x17')]);}})[_0x8754('0x1a')](function(_0x2e4a30){logger[_0x8754('0x16')](_0x8754('0x11'),_0x1f31e0,_0x2e4a30);_0x46e603(_0x2e4a30);});});}exports[_0x8754('0x1b')]=function(_0x11fc3d){var _0x3fdfc0=this;return new Promise(function(_0x5295e5,_0x257fb0){return db[_0x8754('0x1c')][_0x8754('0x1d')](_0x11fc3d[_0x8754('0x1e')],{'raw':_0x11fc3d[_0x8754('0x1f')]?_0x11fc3d[_0x8754('0x1f')][_0x8754('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11fc3d[_0x8754('0x1f')]?_0x11fc3d[_0x8754('0x1f')][_0x8754('0x21')]||null:null,'attributes':_0x11fc3d[_0x8754('0x1f')]?_0x11fc3d[_0x8754('0x1f')][_0x8754('0x22')]||null:null,'limit':_0x11fc3d[_0x8754('0x1f')]?_0x11fc3d['options'][_0x8754('0x23')]||null:null})['then'](function(_0x2b7937){logger['info'](_0x8754('0x1b'),_0x11fc3d);logger[_0x8754('0x13')](_0x8754('0x1b'),_0x11fc3d,JSON['stringify'](_0x2b7937));_0x5295e5(_0x2b7937);})[_0x8754('0x1a')](function(_0x2264fe){logger[_0x8754('0x16')](_0x8754('0x1b'),_0x2264fe['message'],_0x11fc3d);_0x257fb0(_0x3fdfc0[_0x8754('0x16')](0x1f4,_0x2264fe[_0x8754('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x15f477){return new Promise(function(_0x598eca,_0x3dd48c){return db[_0x8754('0x1c')]['find']({'where':_0x15f477[_0x8754('0x1f')]?_0x15f477[_0x8754('0x1f')][_0x8754('0x21')]||null:null})['then'](function(_0x4e8b35){if(_0x4e8b35){return _0x4e8b35['addTags'](_0x15f477[_0x8754('0x1e')][_0x8754('0x24')],_['omit'](_0x15f477['body'],[_0x8754('0x24'),'id'])||{});}})[_0x8754('0x25')](function(_0xd666b5){logger['info'](_0x8754('0x26'),_0x15f477);logger['debug'](_0x8754('0x26'),_0x15f477,JSON[_0x8754('0x15')](_0xd666b5));_0x598eca(_0xd666b5);})[_0x8754('0x1a')](function(_0x50aa77){logger['error'](_0x8754('0x26'),_0x50aa77[_0x8754('0x17')],_0x15f477);_0x3dd48c(_this['error'](0x1f4,_0x50aa77['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e8aa1f2..186dfd5 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 _0x01c2=['removeListener','register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0x01c2,0x1d4));var _0x201c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01c2[_0x321bb2];return _0x9c12ed;};'use strict';var SmsInteractionEvents=require(_0x201c('0x0'));var events=['save',_0x201c('0x1'),_0x201c('0x2')];function createListener(_0x2800a5,_0x29db76){return function(_0x299180){_0x29db76[_0x201c('0x3')](_0x2800a5,_0x299180);};}function removeListener(_0x151c03,_0x3e530b){return function(){SmsInteractionEvents[_0x201c('0x4')](_0x151c03,_0x3e530b);};}exports[_0x201c('0x5')]=function(_0x2b3d36){for(var _0x49536e=0x0,_0x5e56fc=events[_0x201c('0x6')];_0x49536e<_0x5e56fc;_0x49536e++){var _0x286738=events[_0x49536e];var _0x448ee1=createListener(_0x201c('0x7')+_0x286738,_0x2b3d36);SmsInteractionEvents['on'](_0x286738,_0x448ee1);}}; \ No newline at end of file +var _0x963d=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','register'];(function(_0x2efb49,_0x5cf738){var _0x3cd8bb=function(_0x4fed45){while(--_0x4fed45){_0x2efb49['push'](_0x2efb49['shift']());}};_0x3cd8bb(++_0x5cf738);}(_0x963d,0x15f));var _0xd963=function(_0x1f013b,_0x113a8f){_0x1f013b=_0x1f013b-0x0;var _0x599196=_0x963d[_0x1f013b];return _0x599196;};'use strict';var SmsInteractionEvents=require(_0xd963('0x0'));var events=[_0xd963('0x1'),_0xd963('0x2'),_0xd963('0x3')];function createListener(_0x5a15e7,_0x5b0e2e){return function(_0x44a392){_0x5b0e2e[_0xd963('0x4')](_0x5a15e7,_0x44a392);};}function removeListener(_0x4ca2fe,_0x204d89){return function(){SmsInteractionEvents['removeListener'](_0x4ca2fe,_0x204d89);};}exports[_0xd963('0x5')]=function(_0x6d18d7){for(var _0x56de17=0x0,_0x3d0a84=events['length'];_0x56de17<_0x3d0a84;_0x56de17++){var _0x30d5d2=events[_0x56de17];var _0x2e572a=createListener(_0xd963('0x6')+_0x30d5d2,_0x6d18d7);SmsInteractionEvents['on'](_0x30d5d2,_0x2e572a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a6ffc16..4a7e435 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 _0x0b70=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','get','/:id','show','tracked','sms','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','destroy','exports'];(function(_0x320c71,_0x2fbd37){var _0x585258=function(_0x48e482){while(--_0x48e482){_0x320c71['push'](_0x320c71['shift']());}};_0x585258(++_0x2fbd37);}(_0x0b70,0x159));var _0x00b7=function(_0x2b449f,_0x519726){_0x2b449f=_0x2b449f-0x0;var _0xec7ab5=_0x0b70[_0x2b449f];return _0xec7ab5;};'use strict';var multer=require('multer');var util=require(_0x00b7('0x0'));var path=require('path');var timeout=require(_0x00b7('0x1'));var express=require(_0x00b7('0x2'));var router=express['Router']();var fs_extra=require(_0x00b7('0x3'));var auth=require(_0x00b7('0x4'));var interaction=require(_0x00b7('0x5'));var config=require('../../config/environment');var controller=require(_0x00b7('0x6'));router['get']('/',auth[_0x00b7('0x7')](),controller['index']);router[_0x00b7('0x8')]('/describe',auth[_0x00b7('0x7')](),controller['describe']);router[_0x00b7('0x8')](_0x00b7('0x9'),auth[_0x00b7('0x7')](),controller[_0x00b7('0xa')]);router['post']('/',auth[_0x00b7('0x7')](),interaction[_0x00b7('0xb')](_0x00b7('0xc'),'smsmessage:create'),controller[_0x00b7('0xd')]);router['post'](_0x00b7('0xe'),controller[_0x00b7('0xf')]);router[_0x00b7('0x10')](_0x00b7('0x9'),auth[_0x00b7('0x7')](),controller[_0x00b7('0x11')]);router[_0x00b7('0x10')](_0x00b7('0x12'),auth[_0x00b7('0x7')](),controller[_0x00b7('0x13')]);router['put'](_0x00b7('0x14'),auth[_0x00b7('0x7')](),controller['reject']);router['delete'](_0x00b7('0x9'),auth[_0x00b7('0x7')](),controller[_0x00b7('0x15')]);module[_0x00b7('0x16')]=router; \ No newline at end of file +var _0x7d8a=['/describe','describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x7d8a[_0x279d37];return _0x530173;};'use strict';var multer=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var path=require(_0xa7d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xa7d8('0x3'));var router=express['Router']();var fs_extra=require(_0xa7d8('0x4'));var auth=require(_0xa7d8('0x5'));var interaction=require(_0xa7d8('0x6'));var config=require(_0xa7d8('0x7'));var controller=require(_0xa7d8('0x8'));router['get']('/',auth[_0xa7d8('0x9')](),controller[_0xa7d8('0xa')]);router[_0xa7d8('0xb')](_0xa7d8('0xc'),auth['isAuthenticated'](),controller[_0xa7d8('0xd')]);router[_0xa7d8('0xb')](_0xa7d8('0xe'),auth['isAuthenticated'](),controller[_0xa7d8('0xf')]);router[_0xa7d8('0x10')]('/',auth[_0xa7d8('0x9')](),interaction['tracked'](_0xa7d8('0x11'),_0xa7d8('0x12')),controller[_0xa7d8('0x13')]);router[_0xa7d8('0x10')](_0xa7d8('0x14'),controller['status']);router['put'](_0xa7d8('0xe'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x15')]);router[_0xa7d8('0x16')](_0xa7d8('0x17'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x18')]);router[_0xa7d8('0x16')](_0xa7d8('0x19'),auth[_0xa7d8('0x9')](),controller['reject']);router[_0xa7d8('0x1a')](_0xa7d8('0xe'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x1b')]);module[_0xa7d8('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 2ddfb2f..3a27d2d 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 _0x6eb6=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','medium'];(function(_0x398127,_0xd49bca){var _0x28ec61=function(_0x2ae406){while(--_0x2ae406){_0x398127['push'](_0x398127['shift']());}};_0x28ec61(++_0xd49bca);}(_0x6eb6,0xbe));var _0x66eb=function(_0x5d7cfa,_0x3cbd7f){_0x5d7cfa=_0x5d7cfa-0x0;var _0x3ada3f=_0x6eb6[_0x5d7cfa];return _0x3ada3f;};'use strict';var Sequelize=require(_0x66eb('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x66eb('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x66eb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x66eb('0x3')]('in',_0x66eb('0x4')),'defaultValue':_0x66eb('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x66eb('0x5')](0xbe)},'phone':{'type':Sequelize[_0x66eb('0x5')]},'readAt':{'type':Sequelize[_0x66eb('0x6')]},'secret':{'type':Sequelize[_0x66eb('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x66eb('0x7')]}}; \ No newline at end of file +var _0x1aca=['out','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x91d06a,_0x16801f){var _0x36491f=function(_0x4dc6c3){while(--_0x4dc6c3){_0x91d06a['push'](_0x91d06a['shift']());}};_0x36491f(++_0x16801f);}(_0x1aca,0x19f));var _0xa1ac=function(_0x3b3466,_0x228276){_0x3b3466=_0x3b3466-0x0;var _0x16157f=_0x1aca[_0x3b3466];return _0x16157f;};'use strict';var Sequelize=require('sequelize');module[_0xa1ac('0x0')]={'body':{'type':Sequelize[_0xa1ac('0x1')](_0xa1ac('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa1ac('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa1ac('0x4')]('in',_0xa1ac('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa1ac('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa1ac('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa1ac('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa1ac('0x6')]},'providerResponse':{'type':Sequelize[_0xa1ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e0b7554..d6bd9c0 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 _0x75b6=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./smsMessage.socket','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsMessage','includeAll','include','show','params','rawAttributes','length','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','rejectmessage','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x2aa755,_0x1e2a10){var _0x45cbae=function(_0x349759){while(--_0x349759){_0x2aa755['push'](_0x2aa755['shift']());}};_0x45cbae(++_0x1e2a10);}(_0x75b6,0x1a4));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x675b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x675b('0x1'));var rp=require(_0x675b('0x2'));var moment=require(_0x675b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x675b('0x4'));var util=require(_0x675b('0x5'));var path=require(_0x675b('0x6'));var sox=require('sox');var csv=require(_0x675b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x675b('0x8'));var _=require(_0x675b('0x9'));var squel=require(_0x675b('0xa'));var crypto=require('crypto');var jsforce=require(_0x675b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x675b('0x7'));var querystring=require(_0x675b('0xc'));var Papa=require(_0x675b('0xd'));var Redis=require(_0x675b('0xe'));var authService=require(_0x675b('0xf'));var qs=require(_0x675b('0x10'));var as=require(_0x675b('0x11'));var hardwareService=require(_0x675b('0x12'));var logger=require(_0x675b('0x13'))(_0x675b('0x14'));var utils=require('../../config/utils');var config=require(_0x675b('0x15'));var licenseUtil=require(_0x675b('0x16'));var db=require(_0x675b('0x17'))['db'];config[_0x675b('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x675b('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x675b('0x1a')][_0x675b('0x1b')]({'port':0x232c});var client9002=jayson[_0x675b('0x1a')][_0x675b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4ef56a,_0x3243ea,_0x1ddd4f,_0x1ebce7){return new BPromise(function(_0x17c3fc,_0x16e632){var _0x17608c=_0x1ebce7||client;return _0x17608c[_0x675b('0x1c')](_0x4ef56a,_0x1ddd4f)[_0x675b('0x1d')](function(_0x5cf336){logger['info'](_0x675b('0x1e'),_0x3243ea,_0x675b('0x1f'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3243ea,_0x675b('0x1f'),JSON[_0x675b('0x20')](_0x5cf336));if(_0x5cf336[_0x675b('0x21')]){if(_0x5cf336['error'][_0x675b('0x22')]===0x1f4){logger[_0x675b('0x21')]('SmsMessage,\x20%s,\x20%s',_0x3243ea,_0x5cf336['error'][_0x675b('0x23')]);return _0x16e632(_0x5cf336[_0x675b('0x21')][_0x675b('0x23')]);}logger[_0x675b('0x21')](_0x675b('0x1e'),_0x3243ea,_0x5cf336[_0x675b('0x21')][_0x675b('0x23')]);return _0x17c3fc(_0x5cf336[_0x675b('0x21')][_0x675b('0x23')]);}else{logger[_0x675b('0x24')]('SmsMessage,\x20%s,\x20%s',_0x3243ea,_0x675b('0x1f'));_0x17c3fc(_0x5cf336[_0x675b('0x25')][_0x675b('0x23')]);}})[_0x675b('0x26')](function(_0x507088){logger[_0x675b('0x21')](_0x675b('0x1e'),_0x3243ea,_0x507088);_0x16e632(_0x507088);});});}function respondWithStatusCode(_0x4e7a65,_0x129654){_0x129654=_0x129654||0xcc;return function(_0x53b4a2){if(_0x53b4a2){return _0x4e7a65[_0x675b('0x27')](_0x129654);}return _0x4e7a65[_0x675b('0x28')](_0x129654)['end']();};}function respondWithResult(_0x1377ef,_0x44d8e3){_0x44d8e3=_0x44d8e3||0xc8;return function(_0x13fb8d){if(_0x13fb8d){return _0x1377ef[_0x675b('0x28')](_0x44d8e3)[_0x675b('0x29')](_0x13fb8d);}};}function respondWithFilteredResult(_0x59dbbe,_0x9f0401){return function(_0x1fff8d){if(_0x1fff8d){var _0x4c464d=typeof _0x9f0401[_0x675b('0x2a')]===_0x675b('0x2b')&&typeof _0x9f0401[_0x675b('0x2c')]===_0x675b('0x2b');var _0x5f2cde=_0x1fff8d[_0x675b('0x2d')];var _0xe7c579=_0x4c464d?0x0:_0x9f0401[_0x675b('0x2a')];var _0x2b2aca=_0x4c464d?_0x1fff8d['count']:_0x9f0401[_0x675b('0x2a')]+_0x9f0401[_0x675b('0x2c')];var _0x122927;if(_0x2b2aca>=_0x5f2cde){_0x2b2aca=_0x5f2cde;_0x122927=0xc8;}else{_0x122927=0xce;}_0x59dbbe[_0x675b('0x28')](_0x122927);return _0x59dbbe[_0x675b('0x2e')](_0x675b('0x2f'),_0xe7c579+'-'+_0x2b2aca+'/'+_0x5f2cde)[_0x675b('0x29')](_0x1fff8d);}return null;};}function patchUpdates(_0x2c6583){return function(_0x4a5ede){try{jsonpatch[_0x675b('0x30')](_0x4a5ede,_0x2c6583,!![]);}catch(_0x5815b2){return BPromise[_0x675b('0x31')](_0x5815b2);}return _0x4a5ede[_0x675b('0x32')]();};}function saveUpdates(_0x5aafcd,_0x4f56de){return function(_0x2ceea5){if(_0x2ceea5){return _0x2ceea5[_0x675b('0x33')](_0x5aafcd)['then'](function(_0x407a60){return _0x407a60;});}return null;};}function removeEntity(_0x1be657,_0x21777a){return function(_0x2d8d9){if(_0x2d8d9){return _0x2d8d9[_0x675b('0x34')]()[_0x675b('0x1d')](function(){_0x1be657['status'](0xcc)[_0x675b('0x35')]();});}};}function handleEntityNotFound(_0x25fdc6,_0x5437d4){return function(_0x4b239e){if(!_0x4b239e){_0x25fdc6[_0x675b('0x27')](0x194);}return _0x4b239e;};}function handleError(_0x432f41,_0x3e411b){_0x3e411b=_0x3e411b||0x1f4;return function(_0x3d3824){logger[_0x675b('0x21')](_0x3d3824[_0x675b('0x36')]);if(_0x3d3824[_0x675b('0x37')]){delete _0x3d3824[_0x675b('0x37')];}_0x432f41[_0x675b('0x28')](_0x3e411b)[_0x675b('0x38')](_0x3d3824);};}exports[_0x675b('0x39')]=function(_0x573061,_0x496d15){var _0x3cbc1c={},_0x5a777c={},_0x90b3f6={'count':0x0,'rows':[]};var _0x457a37=_[_0x675b('0x3a')](db['SmsMessage']['rawAttributes'],function(_0x5b40b3){return{'name':_0x5b40b3[_0x675b('0x3b')],'type':_0x5b40b3['type'][_0x675b('0x3c')]};});_0x5a777c['model']=_['map'](_0x457a37,_0x675b('0x37'));_0x5a777c[_0x675b('0x3d')]=_[_0x675b('0x3e')](_0x573061['query']);_0x5a777c[_0x675b('0x3f')]=_[_0x675b('0x40')](_0x5a777c[_0x675b('0x41')],_0x5a777c[_0x675b('0x3d')]);_0x3cbc1c[_0x675b('0x42')]=_['intersection'](_0x5a777c[_0x675b('0x41')],qs[_0x675b('0x43')](_0x573061[_0x675b('0x3d')][_0x675b('0x43')]));_0x3cbc1c[_0x675b('0x42')]=_0x3cbc1c[_0x675b('0x42')]['length']?_0x3cbc1c[_0x675b('0x42')]:_0x5a777c[_0x675b('0x41')];if(!_0x573061[_0x675b('0x3d')]['hasOwnProperty'](_0x675b('0x44'))){_0x3cbc1c[_0x675b('0x2c')]=qs[_0x675b('0x2c')](_0x573061[_0x675b('0x3d')]['limit']);_0x3cbc1c[_0x675b('0x2a')]=qs[_0x675b('0x2a')](_0x573061['query'][_0x675b('0x2a')]);}_0x3cbc1c[_0x675b('0x45')]=qs[_0x675b('0x46')](_0x573061[_0x675b('0x3d')]['sort']);_0x3cbc1c[_0x675b('0x47')]=qs[_0x675b('0x3f')](_[_0x675b('0x48')](_0x573061[_0x675b('0x3d')],_0x5a777c[_0x675b('0x3f')]),_0x457a37);if(_0x573061[_0x675b('0x3d')][_0x675b('0x49')]){_0x3cbc1c['where']=_[_0x675b('0x4a')](_0x3cbc1c[_0x675b('0x47')],{'$or':_[_0x675b('0x3a')](_0x457a37,function(_0x5188de){if(_0x5188de[_0x675b('0x4b')]!==_0x675b('0x4c')){var _0xfb4afe={};_0xfb4afe[_0x5188de[_0x675b('0x37')]]={'$like':'%'+_0x573061[_0x675b('0x3d')][_0x675b('0x49')]+'%'};return _0xfb4afe;}})});}_0x3cbc1c=_[_0x675b('0x4a')]({},_0x3cbc1c,_0x573061[_0x675b('0x4d')]);var _0x25f9e7={'where':_0x3cbc1c['where']};return db[_0x675b('0x4e')][_0x675b('0x2d')](_0x25f9e7)[_0x675b('0x1d')](function(_0x4d5cd2){_0x90b3f6[_0x675b('0x2d')]=_0x4d5cd2;if(_0x573061[_0x675b('0x3d')][_0x675b('0x4f')]){_0x3cbc1c[_0x675b('0x50')]=[{'all':!![]}];}return db[_0x675b('0x4e')]['findAll'](_0x3cbc1c);})[_0x675b('0x1d')](function(_0x3bdefd){_0x90b3f6['rows']=_0x3bdefd;return _0x90b3f6;})[_0x675b('0x1d')](respondWithFilteredResult(_0x496d15,_0x3cbc1c))[_0x675b('0x26')](handleError(_0x496d15,null));};exports[_0x675b('0x51')]=function(_0xfb084f,_0x20dfcf){var _0xa89a4d={'raw':!![],'where':{'id':_0xfb084f[_0x675b('0x52')]['id']}},_0x4671e3={};_0x4671e3[_0x675b('0x41')]=_[_0x675b('0x3e')](db['SmsMessage'][_0x675b('0x53')]);_0x4671e3[_0x675b('0x3d')]=_[_0x675b('0x3e')](_0xfb084f[_0x675b('0x3d')]);_0x4671e3[_0x675b('0x3f')]=_['intersection'](_0x4671e3[_0x675b('0x41')],_0x4671e3[_0x675b('0x3d')]);_0xa89a4d[_0x675b('0x42')]=_[_0x675b('0x40')](_0x4671e3[_0x675b('0x41')],qs[_0x675b('0x43')](_0xfb084f[_0x675b('0x3d')][_0x675b('0x43')]));_0xa89a4d[_0x675b('0x42')]=_0xa89a4d['attributes'][_0x675b('0x54')]?_0xa89a4d[_0x675b('0x42')]:_0x4671e3['model'];if(_0xfb084f[_0x675b('0x3d')]['includeAll']){_0xa89a4d[_0x675b('0x50')]=[{'all':!![]}];}_0xa89a4d=_[_0x675b('0x4a')]({},_0xa89a4d,_0xfb084f[_0x675b('0x4d')]);return db[_0x675b('0x4e')]['find'](_0xa89a4d)[_0x675b('0x1d')](handleEntityNotFound(_0x20dfcf,null))[_0x675b('0x1d')](respondWithResult(_0x20dfcf,null))[_0x675b('0x26')](handleError(_0x20dfcf,null));};exports[_0x675b('0x55')]=function(_0x15d195,_0x30c6eb){return db[_0x675b('0x4e')][_0x675b('0x55')](_0x15d195[_0x675b('0x56')],{})['then'](respondWithResult(_0x30c6eb,0xc9))[_0x675b('0x26')](handleError(_0x30c6eb,null));};exports['update']=function(_0x731dc5,_0x1b8e5b){if(_0x731dc5[_0x675b('0x56')]['id']){delete _0x731dc5[_0x675b('0x56')]['id'];}return db[_0x675b('0x4e')][_0x675b('0x57')]({'where':{'id':_0x731dc5[_0x675b('0x52')]['id']}})[_0x675b('0x1d')](handleEntityNotFound(_0x1b8e5b,null))['then'](saveUpdates(_0x731dc5['body'],null))[_0x675b('0x1d')](respondWithResult(_0x1b8e5b,null))[_0x675b('0x26')](handleError(_0x1b8e5b,null));};exports[_0x675b('0x34')]=function(_0xa520c9,_0x4cbec9){return db[_0x675b('0x4e')]['find']({'where':{'id':_0xa520c9[_0x675b('0x52')]['id']}})[_0x675b('0x1d')](handleEntityNotFound(_0x4cbec9,null))[_0x675b('0x1d')](removeEntity(_0x4cbec9,null))[_0x675b('0x26')](handleError(_0x4cbec9,null));};exports['describe']=function(_0x231cf2,_0x3ccf38){return db[_0x675b('0x4e')][_0x675b('0x58')]()[_0x675b('0x1d')](respondWithResult(_0x3ccf38,null))[_0x675b('0x26')](handleError(_0x3ccf38,null));};var interaction_log=require(_0x675b('0x13'))(_0x675b('0x59'));exports[_0x675b('0x5a')]=function(_0x56cb6f,_0x27e48b,_0x3181ce){var _0x3de076={'agent':{},'channel':_0x675b('0x5b')};if(_0x56cb6f[_0x675b('0x56')]['id']){delete _0x56cb6f[_0x675b('0x56')]['id'];}_0x56cb6f['body'][_0x675b('0x5c')]=!![];_0x56cb6f['body'][_0x675b('0x5d')]=moment()[_0x675b('0x5e')](_0x675b('0x5f'));_0x56cb6f[_0x675b('0x56')]['UserId']=_0x56cb6f['body'][_0x675b('0x60')]||_0x56cb6f[_0x675b('0x61')]['id'];_0x3de076[_0x675b('0x62')]['id']=_0x56cb6f[_0x675b('0x56')][_0x675b('0x60')];return db[_0x675b('0x4e')][_0x675b('0x57')]({'where':{'id':_0x56cb6f[_0x675b('0x52')]['id'],'UserId':null}})[_0x675b('0x1d')](handleEntityNotFound(_0x27e48b,null))[_0x675b('0x1d')](saveUpdates(_0x56cb6f[_0x675b('0x56')],null))['then'](function(_0x47e985){if(_0x47e985){_0x3de076['message']=_0x47e985['get']({'plain':!![]});return db[_0x675b('0x63')][_0x675b('0x57')]({'where':{'id':_0x47e985[_0x675b('0x64')]}});}return null;})[_0x675b('0x1d')](handleEntityNotFound(_0x27e48b,null))[_0x675b('0x1d')](function(_0x3a1a35){if(_0x3a1a35){return _0x3a1a35[_0x675b('0x33')]({'UserId':_0x56cb6f[_0x675b('0x56')]['UserId'],'read1stAt':_[_0x675b('0x65')](_0x3a1a35[_0x675b('0x66')])?moment()[_0x675b('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x675b('0x1d')](function(_0x59b8cc){if(_0x59b8cc){_0x3de076[_0x675b('0x67')]=_0x59b8cc[_0x675b('0x68')]({'plain':!![]});interaction_log[_0x675b('0x24')](_0x675b('0x69'),_0x56cb6f[_0x675b('0x61')]['id'],_0x56cb6f['user']['name'],_0x56cb6f[_0x675b('0x61')][_0x675b('0x6a')],_0x3de076['interaction']['id'],_0x56cb6f['body']?JSON[_0x675b('0x20')](_0x56cb6f[_0x675b('0x56')]):_0x675b('0x6b'));return respondWithRpcPromise(_0x675b('0x6c'),_0x675b('0x6d'),_0x3de076);}return null;})[_0x675b('0x1d')](function(_0x28bb10){var _0x17a890=_0x675b('0x6e')+_0x28bb10[_0x675b('0x23')][_0x675b('0x6f')];return db[_0x675b('0x70')][_0x675b('0x3d')](_0x17a890,{'type':db['Sequelize'][_0x675b('0x71')][_0x675b('0x72')],'raw':!![]})[_0x675b('0x1d')](function(_0x25ec85){return _0x25ec85;});})[_0x675b('0x1d')](function(_0x301a8a){if(_0x301a8a){_0x3de076['message'][_0x675b('0x73')]=_0x301a8a[0x0];if(!_0x56cb6f[_0x675b('0x56')]['UserId'])return;return db['User'][_0x675b('0x57')]({'where':{'id':_0x56cb6f[_0x675b('0x56')]['UserId'],'role':_0x675b('0x62')},'attributes':['id',_0x675b('0x37'),_0x675b('0x74'),_0x675b('0x75'),_0x675b('0x76')],'raw':!![]});}return null;})[_0x675b('0x1d')](function(_0x5eeecf){if(!_0x5eeecf)return null;_0x3de076[_0x675b('0x23')][_0x675b('0x62')]=_0x5eeecf;return _0x3de076;})['then'](function(_0x38a949){if(_0x38a949){if(_0x56cb6f[_0x675b('0x56')]['manual']){_0x3de076[_0x675b('0x23')][_0x675b('0x77')]=util[_0x675b('0x5e')](_0x675b('0x78'),_0x56cb6f[_0x675b('0x61')]['name']);_0x3de076[_0x675b('0x23')][_0x675b('0x79')]=_0x3de076[_0x675b('0x79')];_0x3de076['message'][_0x675b('0x7a')]=_0x3de076[_0x675b('0x79')];_0x3de076[_0x675b('0x23')][_0x675b('0x7b')]=_0x675b('0x5a');return respondWithRpcPromise(_0x675b('0x7c'),_0x675b('0x7c'),{'event':'acceptmessage','message':_0x3de076[_0x675b('0x23')]},client9002)[_0x675b('0x1d')](function(){return _0x3de076;});}return _0x3de076;}return null;})['then'](respondWithResult(_0x27e48b,null))[_0x675b('0x26')](handleError(_0x27e48b,null));};var interaction_log=require(_0x675b('0x13'))('sms-interactions');exports[_0x675b('0x31')]=function(_0x2ae6ed,_0x5d6bfa,_0x5aa623){var _0x4d41cc={'agent':{},'channel':_0x675b('0x5b')};if(_0x2ae6ed[_0x675b('0x56')]['id']){delete _0x2ae6ed['body']['id'];}_0x2ae6ed['body'][_0x675b('0x60')]=_0x2ae6ed['body'][_0x675b('0x60')]||_0x2ae6ed[_0x675b('0x61')]['id'];_0x4d41cc['agent']['id']=_0x2ae6ed[_0x675b('0x56')][_0x675b('0x60')];return db[_0x675b('0x4e')][_0x675b('0x57')]({'where':{'id':_0x2ae6ed[_0x675b('0x52')]['id'],'UserId':null}})[_0x675b('0x1d')](handleEntityNotFound(_0x5d6bfa,null))[_0x675b('0x1d')](function(_0x3f4ba9){if(_0x3f4ba9){_0x4d41cc['message']=_0x3f4ba9[_0x675b('0x68')]({'plain':!![]});return db[_0x675b('0x63')][_0x675b('0x57')]({'where':{'id':_0x3f4ba9[_0x675b('0x64')]}});}return null;})[_0x675b('0x1d')](handleEntityNotFound(_0x5d6bfa,null))[_0x675b('0x1d')](function(_0x1b3f1d){if(_0x1b3f1d){_0x4d41cc[_0x675b('0x67')]=_0x1b3f1d[_0x675b('0x68')]({'plain':!![]});interaction_log[_0x675b('0x24')](_0x675b('0x7d'),_0x2ae6ed[_0x675b('0x61')]['id'],_0x2ae6ed['user'][_0x675b('0x37')],_0x2ae6ed[_0x675b('0x61')]['role'],_0x4d41cc['interaction']['id'],_0x2ae6ed['body']?JSON[_0x675b('0x20')](_0x2ae6ed[_0x675b('0x56')]):_0x675b('0x6b'));return respondWithRpcPromise(_0x675b('0x7e'),'rejectMessage',_0x4d41cc);}return null;})[_0x675b('0x1d')](function(_0x197022){var _0x3faa49=_0x675b('0x6e')+_0x197022['message']['ContactId'];return db[_0x675b('0x70')][_0x675b('0x3d')](_0x3faa49,{'type':db['Sequelize']['QueryTypes'][_0x675b('0x72')],'raw':!![]})['then'](function(_0xb2e313){return _0xb2e313;});})['then'](function(_0xb7dbb6){if(_0xb7dbb6){_0x4d41cc[_0x675b('0x23')][_0x675b('0x73')]=_0xb7dbb6[0x0];if(!_0x2ae6ed[_0x675b('0x56')]['UserId'])return;return db[_0x675b('0x7f')][_0x675b('0x57')]({'where':{'id':_0x2ae6ed[_0x675b('0x56')][_0x675b('0x60')],'role':_0x675b('0x62')},'attributes':['id','name',_0x675b('0x74'),'email',_0x675b('0x76')],'raw':!![]});}return null;})[_0x675b('0x1d')](function(_0x3be4df){if(!_0x3be4df)return null;_0x4d41cc[_0x675b('0x23')][_0x675b('0x62')]=_0x3be4df;return _0x4d41cc;})['then'](function(_0x51df87){if(_0x51df87){_0x51df87[_0x675b('0x23')][_0x675b('0x77')]=util[_0x675b('0x5e')](_0x675b('0x78'),_0x2ae6ed[_0x675b('0x61')][_0x675b('0x37')]);_0x51df87['message'][_0x675b('0x79')]=_0x4d41cc['channel'];_0x51df87[_0x675b('0x23')][_0x675b('0x7a')]=_0x4d41cc['channel'];_0x51df87[_0x675b('0x23')][_0x675b('0x7b')]=_0x675b('0x31');respondWithRpcPromise(_0x675b('0x7c'),_0x675b('0x7c'),{'event':_0x675b('0x80'),'message':_0x51df87[_0x675b('0x23')]},client9002);return _0x4d41cc;}return null;})[_0x675b('0x1d')](respondWithResult(_0x5d6bfa,null))[_0x675b('0x26')](handleError(_0x5d6bfa,null));};exports['status']=function(_0x304f2a,_0x12367d,_0x452513){if(_0x304f2a[_0x675b('0x56')]['id']){delete _0x304f2a['body']['id'];}var _0x164d38;return db['SmsMessage']['find']({'where':{'id':_0x304f2a[_0x675b('0x52')]['id']}})['then'](handleEntityNotFound(_0x12367d,null))[_0x675b('0x1d')](function(_0xd863d4){if(_0xd863d4){_0x164d38=_0xd863d4;return db['SmsAccount']['find']({'where':{'id':_0xd863d4['SmsAccountId']}});}})[_0x675b('0x1d')](handleEntityNotFound(_0x12367d,null))[_0x675b('0x1d')](function(_0x4f2339){if(_0x4f2339){logger['debug'](_0x675b('0x81'),_0x675b('0x28'),_0x675b('0x82'),_0x4f2339[_0x675b('0x4b')],util[_0x675b('0x83')](_0x304f2a['body'],{'showHidden':![],'depth':null}));switch(_0x4f2339[_0x675b('0x4b')]){case _0x675b('0x84'):if(_0x304f2a[_0x675b('0x56')][_0x675b('0x85')]&&_0x304f2a[_0x675b('0x56')][_0x675b('0x85')]===_0x164d38[_0x675b('0x86')]){return _0x164d38[_0x675b('0x33')]({'read':!![]});}else{logger[_0x675b('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x675b('0x28'),'twilio',util[_0x675b('0x83')](_0x304f2a[_0x675b('0x56')],{'showHidden':![],'depth':null}));}break;case _0x675b('0x87'):if(_0x304f2a[_0x675b('0x56')][_0x675b('0x88')]&&_0x304f2a[_0x675b('0x56')][_0x675b('0x88')]===_0x164d38['messageId']&&_[_0x675b('0x89')]([_0x675b('0x8a'),_0x675b('0x8b')],_0x304f2a[_0x675b('0x56')][_0x675b('0x8c')])>=0x0){return _0x164d38[_0x675b('0x33')]({'read':!![]});}else{logger[_0x675b('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x675b('0x8d'),util[_0x675b('0x83')](_0x304f2a['body'],{'showHidden':![],'depth':null}));}break;case _0x675b('0x8e'):var _0x35a8c1=_0x304f2a[_0x675b('0x56')][_0x675b('0x8f')][0x0];if(_0x35a8c1[_0x675b('0x28')]['groupName']==='DELIVERED'){return _0x164d38[_0x675b('0x33')]({'read':!![]});}else{logger[_0x675b('0x21')](_0x675b('0x90'),_0x675b('0x28'),_0x675b('0x8e'),util[_0x675b('0x83')](_0x304f2a[_0x675b('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x164d38;}})[_0x675b('0x1d')](respondWithResult(_0x12367d,null))['catch'](handleError(_0x12367d,null));}; \ No newline at end of file +var _0x2a07=['client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','SmsMessage','rawAttributes','fieldName','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','sms-interactions','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','format','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2a07,0x74));var _0x72a0=function(_0x437560,_0xc5d67f){_0x437560=_0x437560-0x0;var _0x278361=_0x2a07[_0x437560];return _0x278361;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];config[_0x72a0('0x1c')]=_[_0x72a0('0x1d')](config[_0x72a0('0x1c')],{'host':_0x72a0('0x1e'),'port':0x18eb});var socket=require(_0x72a0('0x1f'))(new Redis(config[_0x72a0('0x1c')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x72a0('0x20'));var client=jayson[_0x72a0('0x21')][_0x72a0('0x22')]({'port':0x232c});var client9002=jayson[_0x72a0('0x21')][_0x72a0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3f3d62,_0x4ab55e,_0x30248e,_0x2e7552){return new BPromise(function(_0x16ac70,_0xb7e22d){var _0x2d1e95=_0x2e7552||client;return _0x2d1e95['request'](_0x3f3d62,_0x30248e)[_0x72a0('0x23')](function(_0x42e9ec){logger[_0x72a0('0x24')]('SmsMessage,\x20%s,\x20%s',_0x4ab55e,_0x72a0('0x25'));logger[_0x72a0('0x26')](_0x72a0('0x27'),_0x4ab55e,_0x72a0('0x25'),JSON['stringify'](_0x42e9ec));if(_0x42e9ec[_0x72a0('0x28')]){if(_0x42e9ec['error'][_0x72a0('0x29')]===0x1f4){logger[_0x72a0('0x28')](_0x72a0('0x2a'),_0x4ab55e,_0x42e9ec['error'][_0x72a0('0x2b')]);return _0xb7e22d(_0x42e9ec[_0x72a0('0x28')][_0x72a0('0x2b')]);}logger[_0x72a0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x4ab55e,_0x42e9ec[_0x72a0('0x28')][_0x72a0('0x2b')]);return _0x16ac70(_0x42e9ec[_0x72a0('0x28')][_0x72a0('0x2b')]);}else{logger[_0x72a0('0x24')](_0x72a0('0x2a'),_0x4ab55e,'request\x20sent');_0x16ac70(_0x42e9ec['result'][_0x72a0('0x2b')]);}})[_0x72a0('0x2c')](function(_0x123df4){logger[_0x72a0('0x28')](_0x72a0('0x2a'),_0x4ab55e,_0x123df4);_0xb7e22d(_0x123df4);});});}function respondWithStatusCode(_0x27ca5a,_0xa5bda0){_0xa5bda0=_0xa5bda0||0xcc;return function(_0x15922a){if(_0x15922a){return _0x27ca5a[_0x72a0('0x2d')](_0xa5bda0);}return _0x27ca5a[_0x72a0('0x2e')](_0xa5bda0)['end']();};}function respondWithResult(_0x304b92,_0x553641){_0x553641=_0x553641||0xc8;return function(_0xc22d18){if(_0xc22d18){return _0x304b92[_0x72a0('0x2e')](_0x553641)[_0x72a0('0x2f')](_0xc22d18);}};}function respondWithFilteredResult(_0x177a3a,_0x432179){return function(_0x12eda2){if(_0x12eda2){var _0x23c96a=typeof _0x432179[_0x72a0('0x30')]==='undefined'&&typeof _0x432179[_0x72a0('0x31')]===_0x72a0('0x32');var _0x39136d=_0x12eda2[_0x72a0('0x33')];var _0x13c04=_0x23c96a?0x0:_0x432179[_0x72a0('0x30')];var _0x3a5e54=_0x23c96a?_0x12eda2['count']:_0x432179[_0x72a0('0x30')]+_0x432179[_0x72a0('0x31')];var _0x316e1d;if(_0x3a5e54>=_0x39136d){_0x3a5e54=_0x39136d;_0x316e1d=0xc8;}else{_0x316e1d=0xce;}_0x177a3a[_0x72a0('0x2e')](_0x316e1d);return _0x177a3a[_0x72a0('0x34')](_0x72a0('0x35'),_0x13c04+'-'+_0x3a5e54+'/'+_0x39136d)[_0x72a0('0x2f')](_0x12eda2);}return null;};}function patchUpdates(_0x313287){return function(_0x5e93f8){try{jsonpatch[_0x72a0('0x36')](_0x5e93f8,_0x313287,!![]);}catch(_0x1fb485){return BPromise[_0x72a0('0x37')](_0x1fb485);}return _0x5e93f8['save']();};}function saveUpdates(_0x2ae61c,_0x4ada83){return function(_0x4b2b44){if(_0x4b2b44){return _0x4b2b44[_0x72a0('0x38')](_0x2ae61c)[_0x72a0('0x23')](function(_0x3a293f){return _0x3a293f;});}return null;};}function removeEntity(_0x44a008,_0xbcb2a4){return function(_0x20f023){if(_0x20f023){return _0x20f023[_0x72a0('0x39')]()[_0x72a0('0x23')](function(){_0x44a008[_0x72a0('0x2e')](0xcc)[_0x72a0('0x3a')]();});}};}function handleEntityNotFound(_0x3ff191,_0x5b6326){return function(_0x265d96){if(!_0x265d96){_0x3ff191['sendStatus'](0x194);}return _0x265d96;};}function handleError(_0x1d0fa8,_0x13c251){_0x13c251=_0x13c251||0x1f4;return function(_0x446222){logger[_0x72a0('0x28')](_0x446222[_0x72a0('0x3b')]);if(_0x446222[_0x72a0('0x3c')]){delete _0x446222[_0x72a0('0x3c')];}_0x1d0fa8[_0x72a0('0x2e')](_0x13c251)[_0x72a0('0x3d')](_0x446222);};}exports['index']=function(_0x4a973a,_0x41cfc3){var _0x1d9403={},_0x332051={},_0x2f8f42={'count':0x0,'rows':[]};var _0x15c381=_['map'](db[_0x72a0('0x3e')][_0x72a0('0x3f')],function(_0x582c90){return{'name':_0x582c90[_0x72a0('0x40')],'type':_0x582c90['type']['key']};});_0x332051['model']=_[_0x72a0('0x41')](_0x15c381,'name');_0x332051[_0x72a0('0x42')]=_[_0x72a0('0x43')](_0x4a973a[_0x72a0('0x42')]);_0x332051[_0x72a0('0x44')]=_['intersection'](_0x332051['model'],_0x332051['query']);_0x1d9403['attributes']=_[_0x72a0('0x45')](_0x332051[_0x72a0('0x46')],qs['fields'](_0x4a973a[_0x72a0('0x42')][_0x72a0('0x47')]));_0x1d9403['attributes']=_0x1d9403[_0x72a0('0x48')][_0x72a0('0x49')]?_0x1d9403[_0x72a0('0x48')]:_0x332051[_0x72a0('0x46')];if(!_0x4a973a[_0x72a0('0x42')][_0x72a0('0x4a')]('nolimit')){_0x1d9403[_0x72a0('0x31')]=qs['limit'](_0x4a973a[_0x72a0('0x42')]['limit']);_0x1d9403[_0x72a0('0x30')]=qs[_0x72a0('0x30')](_0x4a973a['query'][_0x72a0('0x30')]);}_0x1d9403['order']=qs[_0x72a0('0x4b')](_0x4a973a[_0x72a0('0x42')][_0x72a0('0x4b')]);_0x1d9403['where']=qs[_0x72a0('0x44')](_[_0x72a0('0x4c')](_0x4a973a[_0x72a0('0x42')],_0x332051['filters']),_0x15c381);if(_0x4a973a['query'][_0x72a0('0x4d')]){_0x1d9403['where']=_[_0x72a0('0x4e')](_0x1d9403[_0x72a0('0x4f')],{'$or':_[_0x72a0('0x41')](_0x15c381,function(_0x2b4d36){if(_0x2b4d36[_0x72a0('0x50')]!==_0x72a0('0x51')){var _0x451558={};_0x451558[_0x2b4d36[_0x72a0('0x3c')]]={'$like':'%'+_0x4a973a[_0x72a0('0x42')]['filter']+'%'};return _0x451558;}})});}_0x1d9403=_[_0x72a0('0x4e')]({},_0x1d9403,_0x4a973a[_0x72a0('0x52')]);var _0x134150={'where':_0x1d9403[_0x72a0('0x4f')]};return db[_0x72a0('0x3e')][_0x72a0('0x33')](_0x134150)[_0x72a0('0x23')](function(_0x4a72fd){_0x2f8f42['count']=_0x4a72fd;if(_0x4a973a[_0x72a0('0x42')][_0x72a0('0x53')]){_0x1d9403[_0x72a0('0x54')]=[{'all':!![]}];}return db[_0x72a0('0x3e')][_0x72a0('0x55')](_0x1d9403);})[_0x72a0('0x23')](function(_0x43de45){_0x2f8f42[_0x72a0('0x56')]=_0x43de45;return _0x2f8f42;})[_0x72a0('0x23')](respondWithFilteredResult(_0x41cfc3,_0x1d9403))[_0x72a0('0x2c')](handleError(_0x41cfc3,null));};exports['show']=function(_0x230e2e,_0x28186f){var _0x480d49={'raw':!![],'where':{'id':_0x230e2e[_0x72a0('0x57')]['id']}},_0x241dcc={};_0x241dcc['model']=_[_0x72a0('0x43')](db['SmsMessage']['rawAttributes']);_0x241dcc[_0x72a0('0x42')]=_[_0x72a0('0x43')](_0x230e2e[_0x72a0('0x42')]);_0x241dcc[_0x72a0('0x44')]=_[_0x72a0('0x45')](_0x241dcc['model'],_0x241dcc[_0x72a0('0x42')]);_0x480d49[_0x72a0('0x48')]=_['intersection'](_0x241dcc['model'],qs[_0x72a0('0x47')](_0x230e2e[_0x72a0('0x42')][_0x72a0('0x47')]));_0x480d49[_0x72a0('0x48')]=_0x480d49[_0x72a0('0x48')][_0x72a0('0x49')]?_0x480d49[_0x72a0('0x48')]:_0x241dcc[_0x72a0('0x46')];if(_0x230e2e['query'][_0x72a0('0x53')]){_0x480d49['include']=[{'all':!![]}];}_0x480d49=_['merge']({},_0x480d49,_0x230e2e['options']);return db[_0x72a0('0x3e')][_0x72a0('0x58')](_0x480d49)['then'](handleEntityNotFound(_0x28186f,null))[_0x72a0('0x23')](respondWithResult(_0x28186f,null))['catch'](handleError(_0x28186f,null));};exports[_0x72a0('0x59')]=function(_0x5a0ec6,_0x51335e){return db[_0x72a0('0x3e')][_0x72a0('0x59')](_0x5a0ec6['body'],{})[_0x72a0('0x23')](respondWithResult(_0x51335e,0xc9))['catch'](handleError(_0x51335e,null));};exports[_0x72a0('0x38')]=function(_0x4f5188,_0x48df1d){if(_0x4f5188[_0x72a0('0x5a')]['id']){delete _0x4f5188[_0x72a0('0x5a')]['id'];}return db[_0x72a0('0x3e')]['find']({'where':{'id':_0x4f5188['params']['id']}})[_0x72a0('0x23')](handleEntityNotFound(_0x48df1d,null))['then'](saveUpdates(_0x4f5188[_0x72a0('0x5a')],null))[_0x72a0('0x23')](respondWithResult(_0x48df1d,null))[_0x72a0('0x2c')](handleError(_0x48df1d,null));};exports[_0x72a0('0x39')]=function(_0x11a750,_0x2628dd){return db[_0x72a0('0x3e')][_0x72a0('0x58')]({'where':{'id':_0x11a750[_0x72a0('0x57')]['id']}})[_0x72a0('0x23')](handleEntityNotFound(_0x2628dd,null))[_0x72a0('0x23')](removeEntity(_0x2628dd,null))[_0x72a0('0x2c')](handleError(_0x2628dd,null));};exports['describe']=function(_0x39c3a2,_0x5c17a6){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x5c17a6,null))[_0x72a0('0x2c')](handleError(_0x5c17a6,null));};var interaction_log=require(_0x72a0('0x17'))(_0x72a0('0x5b'));exports['accept']=function(_0x27398d,_0x484700,_0xd6ab19){var _0x1ef23f={'agent':{},'channel':'sms'};if(_0x27398d[_0x72a0('0x5a')]['id']){delete _0x27398d[_0x72a0('0x5a')]['id'];}_0x27398d[_0x72a0('0x5a')][_0x72a0('0x5c')]=!![];_0x27398d['body'][_0x72a0('0x5d')]=moment()['format'](_0x72a0('0x5e'));_0x27398d[_0x72a0('0x5a')][_0x72a0('0x5f')]=_0x27398d['body'][_0x72a0('0x5f')]||_0x27398d[_0x72a0('0x60')]['id'];_0x1ef23f[_0x72a0('0x61')]['id']=_0x27398d[_0x72a0('0x5a')][_0x72a0('0x5f')];return db['SmsMessage']['find']({'where':{'id':_0x27398d[_0x72a0('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x484700,null))[_0x72a0('0x23')](saveUpdates(_0x27398d['body'],null))[_0x72a0('0x23')](function(_0xd9ae1a){if(_0xd9ae1a){_0x1ef23f['message']=_0xd9ae1a[_0x72a0('0x62')]({'plain':!![]});return db[_0x72a0('0x63')][_0x72a0('0x58')]({'where':{'id':_0xd9ae1a['SmsInteractionId']}});}return null;})[_0x72a0('0x23')](handleEntityNotFound(_0x484700,null))['then'](function(_0x2ea1bb){if(_0x2ea1bb){return _0x2ea1bb[_0x72a0('0x38')]({'UserId':_0x27398d['body'][_0x72a0('0x5f')],'read1stAt':_['isNil'](_0x2ea1bb['read1stAt'])?moment()['format'](_0x72a0('0x5e')):undefined});}return null;})['then'](function(_0x115ba8){if(_0x115ba8){_0x1ef23f['interaction']=_0x115ba8[_0x72a0('0x62')]({'plain':!![]});interaction_log[_0x72a0('0x24')](_0x72a0('0x64'),_0x27398d['user']['id'],_0x27398d[_0x72a0('0x60')][_0x72a0('0x3c')],_0x27398d[_0x72a0('0x60')][_0x72a0('0x65')],_0x1ef23f[_0x72a0('0x66')]['id'],_0x27398d['body']?JSON[_0x72a0('0x67')](_0x27398d[_0x72a0('0x5a')]):_0x72a0('0x68'));return respondWithRpcPromise(_0x72a0('0x69'),'acceptMessage',_0x1ef23f);}return null;})[_0x72a0('0x23')](function(_0x647e75){var _0x4ebce5=_0x72a0('0x6a')+_0x647e75['message'][_0x72a0('0x6b')];return db[_0x72a0('0x6c')][_0x72a0('0x42')](_0x4ebce5,{'type':db[_0x72a0('0x6d')][_0x72a0('0x6e')][_0x72a0('0x6f')],'raw':!![]})[_0x72a0('0x23')](function(_0x5e3e81){return _0x5e3e81;});})['then'](function(_0x5676e3){if(_0x5676e3){_0x1ef23f[_0x72a0('0x2b')][_0x72a0('0x70')]=_0x5676e3[0x0];if(!_0x27398d[_0x72a0('0x5a')][_0x72a0('0x5f')])return;return db[_0x72a0('0x71')][_0x72a0('0x58')]({'where':{'id':_0x27398d['body'][_0x72a0('0x5f')],'role':_0x72a0('0x61')},'attributes':['id',_0x72a0('0x3c'),_0x72a0('0x72'),_0x72a0('0x73'),_0x72a0('0x74')],'raw':!![]});}return null;})[_0x72a0('0x23')](function(_0x5d5dd8){if(!_0x5d5dd8)return null;_0x1ef23f[_0x72a0('0x2b')][_0x72a0('0x61')]=_0x5d5dd8;return _0x1ef23f;})[_0x72a0('0x23')](function(_0x116493){if(_0x116493){if(_0x27398d[_0x72a0('0x5a')][_0x72a0('0x75')]){_0x1ef23f['message'][_0x72a0('0x76')]=util['format'](_0x72a0('0x77'),_0x27398d[_0x72a0('0x60')][_0x72a0('0x3c')]);_0x1ef23f[_0x72a0('0x2b')][_0x72a0('0x78')]=_0x1ef23f['channel'];_0x1ef23f[_0x72a0('0x2b')][_0x72a0('0x79')]=_0x1ef23f['channel'];_0x1ef23f[_0x72a0('0x2b')][_0x72a0('0x7a')]=_0x72a0('0x7b');return respondWithRpcPromise(_0x72a0('0x7c'),'EventManager',{'event':_0x72a0('0x7d'),'message':_0x1ef23f[_0x72a0('0x2b')]},client9002)[_0x72a0('0x23')](function(){return _0x1ef23f;});}return _0x1ef23f;}return null;})[_0x72a0('0x23')](respondWithResult(_0x484700,null))[_0x72a0('0x2c')](handleError(_0x484700,null));};var interaction_log=require(_0x72a0('0x17'))(_0x72a0('0x5b'));exports[_0x72a0('0x37')]=function(_0xd771f1,_0x3d02e6,_0x2fd7e2){var _0x109e9e={'agent':{},'channel':'sms'};if(_0xd771f1[_0x72a0('0x5a')]['id']){delete _0xd771f1[_0x72a0('0x5a')]['id'];}_0xd771f1[_0x72a0('0x5a')][_0x72a0('0x5f')]=_0xd771f1[_0x72a0('0x5a')][_0x72a0('0x5f')]||_0xd771f1[_0x72a0('0x60')]['id'];_0x109e9e[_0x72a0('0x61')]['id']=_0xd771f1['body'][_0x72a0('0x5f')];return db['SmsMessage']['find']({'where':{'id':_0xd771f1[_0x72a0('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d02e6,null))['then'](function(_0x25f9e5){if(_0x25f9e5){_0x109e9e['message']=_0x25f9e5[_0x72a0('0x62')]({'plain':!![]});return db[_0x72a0('0x63')][_0x72a0('0x58')]({'where':{'id':_0x25f9e5['SmsInteractionId']}});}return null;})[_0x72a0('0x23')](handleEntityNotFound(_0x3d02e6,null))[_0x72a0('0x23')](function(_0x3832d7){if(_0x3832d7){_0x109e9e[_0x72a0('0x66')]=_0x3832d7[_0x72a0('0x62')]({'plain':!![]});interaction_log['info'](_0x72a0('0x7e'),_0xd771f1[_0x72a0('0x60')]['id'],_0xd771f1[_0x72a0('0x60')]['name'],_0xd771f1[_0x72a0('0x60')][_0x72a0('0x65')],_0x109e9e[_0x72a0('0x66')]['id'],_0xd771f1['body']?JSON[_0x72a0('0x67')](_0xd771f1[_0x72a0('0x5a')]):_0x72a0('0x68'));return respondWithRpcPromise(_0x72a0('0x7f'),_0x72a0('0x80'),_0x109e9e);}return null;})[_0x72a0('0x23')](function(_0xff26b1){var _0x1b5e55=_0x72a0('0x6a')+_0xff26b1['message'][_0x72a0('0x6b')];return db[_0x72a0('0x6c')][_0x72a0('0x42')](_0x1b5e55,{'type':db[_0x72a0('0x6d')][_0x72a0('0x6e')]['SELECT'],'raw':!![]})[_0x72a0('0x23')](function(_0x2c72fd){return _0x2c72fd;});})[_0x72a0('0x23')](function(_0x4124e7){if(_0x4124e7){_0x109e9e['message'][_0x72a0('0x70')]=_0x4124e7[0x0];if(!_0xd771f1[_0x72a0('0x5a')][_0x72a0('0x5f')])return;return db['User']['find']({'where':{'id':_0xd771f1[_0x72a0('0x5a')][_0x72a0('0x5f')],'role':_0x72a0('0x61')},'attributes':['id',_0x72a0('0x3c'),_0x72a0('0x72'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x410f6b){if(!_0x410f6b)return null;_0x109e9e['message'][_0x72a0('0x61')]=_0x410f6b;return _0x109e9e;})['then'](function(_0x54724b){if(_0x54724b){_0x54724b['message']['interface']=util[_0x72a0('0x81')](_0x72a0('0x77'),_0xd771f1[_0x72a0('0x60')][_0x72a0('0x3c')]);_0x54724b['message'][_0x72a0('0x78')]=_0x109e9e[_0x72a0('0x78')];_0x54724b['message'][_0x72a0('0x79')]=_0x109e9e[_0x72a0('0x78')];_0x54724b['message'][_0x72a0('0x7a')]=_0x72a0('0x37');respondWithRpcPromise(_0x72a0('0x7c'),_0x72a0('0x7c'),{'event':'rejectmessage','message':_0x54724b['message']},client9002);return _0x109e9e;}return null;})[_0x72a0('0x23')](respondWithResult(_0x3d02e6,null))[_0x72a0('0x2c')](handleError(_0x3d02e6,null));};exports[_0x72a0('0x2e')]=function(_0x2d4fec,_0x2ac5b0,_0x12e919){if(_0x2d4fec['body']['id']){delete _0x2d4fec['body']['id'];}var _0x32d5bd;return db[_0x72a0('0x3e')]['find']({'where':{'id':_0x2d4fec[_0x72a0('0x57')]['id']}})[_0x72a0('0x23')](handleEntityNotFound(_0x2ac5b0,null))[_0x72a0('0x23')](function(_0x27279b){if(_0x27279b){_0x32d5bd=_0x27279b;return db[_0x72a0('0x82')][_0x72a0('0x58')]({'where':{'id':_0x27279b[_0x72a0('0x83')]}});}})['then'](handleEntityNotFound(_0x2ac5b0,null))[_0x72a0('0x23')](function(_0x271a39){if(_0x271a39){logger[_0x72a0('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72a0('0x2e'),_0x72a0('0x84'),_0x271a39[_0x72a0('0x50')],util[_0x72a0('0x85')](_0x2d4fec[_0x72a0('0x5a')],{'showHidden':![],'depth':null}));switch(_0x271a39['type']){case _0x72a0('0x86'):if(_0x2d4fec[_0x72a0('0x5a')][_0x72a0('0x87')]&&_0x2d4fec[_0x72a0('0x5a')][_0x72a0('0x87')]===_0x32d5bd[_0x72a0('0x88')]){return _0x32d5bd['update']({'read':!![]});}else{logger[_0x72a0('0x28')](_0x72a0('0x89'),_0x72a0('0x2e'),_0x72a0('0x86'),util[_0x72a0('0x85')](_0x2d4fec[_0x72a0('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x72a0('0x8a'):if(_0x2d4fec[_0x72a0('0x5a')][_0x72a0('0x8b')]&&_0x2d4fec['body'][_0x72a0('0x8b')]===_0x32d5bd['messageId']&&_[_0x72a0('0x8c')]([_0x72a0('0x8d'),_0x72a0('0x8e')],_0x2d4fec[_0x72a0('0x5a')][_0x72a0('0x8f')])>=0x0){return _0x32d5bd[_0x72a0('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x72a0('0x2e'),_0x72a0('0x90'),util[_0x72a0('0x85')](_0x2d4fec[_0x72a0('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x72a0('0x91'):var _0x3657e2=_0x2d4fec[_0x72a0('0x5a')][_0x72a0('0x92')][0x0];if(_0x3657e2[_0x72a0('0x2e')][_0x72a0('0x93')]===_0x72a0('0x94')){return _0x32d5bd[_0x72a0('0x38')]({'read':!![]});}else{logger[_0x72a0('0x28')](_0x72a0('0x89'),_0x72a0('0x2e'),'infobip',util[_0x72a0('0x85')](_0x2d4fec['body'],{'showHidden':![],'depth':null}));}break;}return _0x32d5bd;}})[_0x72a0('0x23')](respondWithResult(_0x2ac5b0,null))['catch'](handleError(_0x2ac5b0,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1ee0ea4..81dc5b4 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 _0x1df3=['hasOwnProperty','exports','events','SmsMessage','setMaxListeners','update','remove','emit'];(function(_0x500818,_0x5a9d1d){var _0x5df6f1=function(_0x3aa352){while(--_0x3aa352){_0x500818['push'](_0x500818['shift']());}};_0x5df6f1(++_0x5a9d1d);}(_0x1df3,0x122));var _0x31df=function(_0x53b91d,_0xa9071c){_0x53b91d=_0x53b91d-0x0;var _0x32df75=_0x1df3[_0x53b91d];return _0x32df75;};'use strict';var EventEmitter=require(_0x31df('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x31df('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x31df('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x31df('0x3'),'afterDestroy':_0x31df('0x4')};function emitEvent(_0xc2312c){return function(_0x1738b0,_0x27f674,_0x2ecdd2){SmsMessageEvents[_0x31df('0x5')](_0xc2312c+':'+_0x1738b0['id'],_0x1738b0);SmsMessageEvents[_0x31df('0x5')](_0xc2312c,_0x1738b0);_0x2ecdd2(null);};}for(var e in events){if(events[_0x31df('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x31df('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x40e2=['update','remove','emit','hasOwnProperty','hook','exports','events','SmsMessage','save'];(function(_0xc4770a,_0x1c9d20){var _0x2dfe7e=function(_0x2ff672){while(--_0x2ff672){_0xc4770a['push'](_0xc4770a['shift']());}};_0x2dfe7e(++_0x1c9d20);}(_0x40e2,0x165));var _0x240e=function(_0x5f153b,_0x458a34){_0x5f153b=_0x5f153b-0x0;var _0x579a83=_0x40e2[_0x5f153b];return _0x579a83;};'use strict';var EventEmitter=require(_0x240e('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x240e('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x240e('0x2'),'afterUpdate':_0x240e('0x3'),'afterDestroy':_0x240e('0x4')};function emitEvent(_0x352293){return function(_0xb532ea,_0x544cb3,_0x16b37c){SmsMessageEvents['emit'](_0x352293+':'+_0xb532ea['id'],_0xb532ea);SmsMessageEvents[_0x240e('0x5')](_0x352293,_0xb532ea);_0x16b37c(null);};}for(var e in events){if(events[_0x240e('0x6')](e)){var event=events[e];SmsMessage[_0x240e('0x7')](e,emitEvent(event));}}module[_0x240e('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 8147d9e..01bd848 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 _0x0366=['inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','hex','signature=','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','login?username=','username','&password=','GET','sms','user_key','session_key','total_sent','read'];(function(_0x43c877,_0x1e11a8){var _0x1688cd=function(_0x49d949){while(--_0x49d949){_0x43c877['push'](_0x43c877['shift']());}};_0x1688cd(++_0x1e11a8);}(_0x0366,0x13e));var _0x6036=function(_0x478673,_0x3180bf){_0x478673=_0x478673-0x0;var _0x4c36b7=_0x0366[_0x478673];return _0x4c36b7;};'use strict';var _=require('lodash');var util=require(_0x6036('0x0'));var logger=require('../../config/logger')(_0x6036('0x1'));var moment=require('moment');var BPromise=require(_0x6036('0x2'));var rp=require(_0x6036('0x3'));var fs=require('fs');var path=require(_0x6036('0x4'));var rimraf=require(_0x6036('0x5'));var config=require('../../config/environment');var attributes=require(_0x6036('0x6'));module[_0x6036('0x7')]=function(_0x32239a,_0x12c676){return _0x32239a[_0x6036('0x8')](_0x6036('0x9'),attributes,{'tableName':_0x6036('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x6036('0xb'),'fields':[_0x6036('0xc')],'type':_0x6036('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d1d3c,_0x516c9f,_0x2ac30a){var _0x5c7e23=_0x32239a[_0x6036('0xe')];var _0x10b345=_0x3d1d3c[_0x6036('0xf')]({'plain':!![]});if(_0x10b345[_0x6036('0x10')][_0x6036('0x11')]()==='in'||_0x10b345[_0x6036('0x10')]['toLowerCase']()===_0x6036('0x12')&&!_0x10b345[_0x6036('0x13')]&&!_['isNil'](_0x10b345[_0x6036('0x14')])&&!_[_0x6036('0x15')](_0x10b345[_0x6036('0x16')])){_0x5c7e23[_0x6036('0x17')][_0x6036('0x18')]({'where':{'id':_0x10b345[_0x6036('0x16')]}})[_0x6036('0x19')](function(_0x1bb022){if(_0x1bb022){_0x1bb022[_0x6036('0x1a')]({'lastMsgAt':_0x10b345['createdAt'],'lastMsgDirection':_0x10b345[_0x6036('0x10')][_0x6036('0x11')]()});}})[_0x6036('0x1b')](function(_0xc059f0){console['error'](_0xc059f0);});}if(_0x10b345[_0x6036('0x10')]===_0x6036('0x12')&&!_0x10b345[_0x6036('0x13')]){var _0x50a8d7;_0x5c7e23[_0x6036('0x1c')][_0x6036('0x1d')]({'where':{'id':_0x10b345[_0x6036('0x1e')]},'raw':!![]})[_0x6036('0x19')](function(_0x44376f){_0x50a8d7=_0x44376f;if(_0x50a8d7&&_0x50a8d7[_0x6036('0x1f')]){switch(_0x50a8d7[_0x6036('0x1f')]){case _0x6036('0x20'):var _0x35c32e=require(_0x6036('0x20'));if(_0x50a8d7[_0x6036('0x21')]&&_0x50a8d7[_0x6036('0x22')]&&_0x50a8d7[_0x6036('0x23')]){var _0xe83f51=new _0x35c32e(_0x50a8d7[_0x6036('0x21')],_0x50a8d7['authToken']);_0xe83f51[_0x6036('0x24')][_0x6036('0x25')]({'body':_0x10b345[_0x6036('0xc')],'to':_0x10b345[_0x6036('0x23')],'from':_0x50a8d7['phone'],'statusCallback':_0x50a8d7[_0x6036('0x26')]+_0x6036('0x27')+_0x10b345['id']+_0x6036('0x28')+_0x50a8d7[_0x6036('0x29')]})[_0x6036('0x19')](function(_0x305036){if(_0x305036[_0x6036('0x2a')]){return _0x3d1d3c[_0x6036('0x1a')]({'messageId':_0x305036[_0x6036('0x2a')]});}})['catch'](function(_0x5202fd){logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x20'),util['inspect'](_0x5202fd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x20'),_0x6036('0x2e'));}break;case _0x6036('0x2f'):var _0x1f2fe3='https://api.skebby.it/API/v1.0/REST/';if(_0x50a8d7['username']&&_0x50a8d7[_0x6036('0x30')]){var _0x1026be={'recipient':[_0x10b345[_0x6036('0x23')]],'message':_0x10b345[_0x6036('0xc')],'message_type':_0x50a8d7[_0x6036('0x31')]};if(_0x50a8d7['smsMethod']&&_0x50a8d7[_0x6036('0x31')]!=='SI'){_0x1026be[_0x6036('0x32')]=_0x50a8d7[_0x6036('0x23')];}var _0x18af1c={'url':_0x1f2fe3+_0x6036('0x33')+_0x50a8d7[_0x6036('0x34')]+_0x6036('0x35')+_0x50a8d7[_0x6036('0x30')],'method':_0x6036('0x36')};rp(_0x18af1c)[_0x6036('0x19')](function(_0x19ba99){var _0x4386a5=_0x19ba99['split'](';');var _0x4a4a0d={'user_key':_0x4386a5[0x0],'session_key':_0x4386a5[0x1]};_0x18af1c={'url':_0x1f2fe3+_0x6036('0x37'),'method':'POST','headers':{'user_key':_0x4a4a0d[_0x6036('0x38')],'Session_key':_0x4a4a0d[_0x6036('0x39')]},'json':!![],'body':_0x1026be};return rp(_0x18af1c);})['then'](function(_0x4b9756){if(_0x4b9756[_0x6036('0x3a')]>=0x1){var _0x28bab9={'messageId':_0x4b9756['internal_order_id']};if(_0x50a8d7[_0x6036('0x31')]!=='GP'||!_0x50a8d7['deliveryReport']){_0x28bab9[_0x6036('0x3b')]=!![];}return _0x3d1d3c[_0x6036('0x1a')](_0x28bab9);}else{return logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x2f'),util[_0x6036('0x3c')](_0x4b9756,{'showHidden':![],'depth':null}));}})[_0x6036('0x1b')](function(_0x5d0a5a){return logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),'skebby',util[_0x6036('0x3c')](_0x5d0a5a,{'showHidden':![],'depth':null}));});}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x2f'),_0x6036('0x3d'));}break;case _0x6036('0x3e'):if(_0x50a8d7[_0x6036('0x22')]){var _0x351be1={'recipient':_0x10b345['phone'],'message':_0x10b345[_0x6036('0xc')],'sender':_0x50a8d7[_0x6036('0x3f')]||_0x50a8d7[_0x6036('0x23')],'authorization':_0x50a8d7[_0x6036('0x22')]};var _0x516c9f={'method':_0x6036('0x40'),'uri':_0x6036('0x41'),'body':_0x351be1,'json':!![]};rp(_0x516c9f)[_0x6036('0x19')](function(_0x4854dd){var _0x4ff0ca={'messageId':_0x4854dd['requestid']};if(!_0x50a8d7[_0x6036('0x42')]){_0x4ff0ca[_0x6036('0x3b')]=!![];}return _0x3d1d3c['update'](_0x4ff0ca);})[_0x6036('0x1b')](function(_0x2389af){logger[_0x6036('0x2b')](_0x6036('0x2c'),'afterCreate',_0x6036('0x3e'),util[_0x6036('0x3c')](_0x2389af,{'showHidden':![],'depth':null}));});}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x3e'),_0x6036('0x43'));}break;case _0x6036('0x44'):if(_0x50a8d7[_0x6036('0x34')]&&_0x50a8d7[_0x6036('0x30')]){var _0x351be1={'messages':[{'source':'xCALLY\x20Motion','to':_0x10b345['phone'],'body':_0x10b345[_0x6036('0xc')],'from':_0x50a8d7[_0x6036('0x3f')]||_0x50a8d7[_0x6036('0x23')]}]};var _0x5089c7=util[_0x6036('0x45')](_0x6036('0x46'),_0x50a8d7[_0x6036('0x34')],_0x50a8d7['password']);var _0x516c9f={'method':_0x6036('0x40'),'uri':_0x6036('0x47'),'body':_0x351be1,'headers':{'Authorization':util[_0x6036('0x45')](_0x6036('0x48'),new Buffer(_0x5089c7)[_0x6036('0x49')](_0x6036('0x4a')))},'json':!![]};rp(_0x516c9f)[_0x6036('0x19')](function(_0xa66df3){if(_0xa66df3[_0x6036('0x4b')]>=0xc8&&_0xa66df3[_0x6036('0x4b')]<=0xce){if(_0xa66df3[_0x6036('0x4c')]&&_0xa66df3[_0x6036('0x4c')][_0x6036('0x4d')]>0x0){var _0x4a7a59=_[_0x6036('0x4e')](_0xa66df3[_0x6036('0x4c')]['messages']);var _0x11ffb7={'messageId':_0x4a7a59[_0x6036('0x4f')]};if(!_0x50a8d7[_0x6036('0x42')]){_0x11ffb7['read']=!![];}return _0x3d1d3c['update'](_0x11ffb7);}else{logger[_0x6036('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6036('0x50'),util[_0x6036('0x3c')](_0xa66df3,{'showHidden':![],'depth':null}));}}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),'clickSend',util[_0x6036('0x3c')](_0xa66df3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4fcb80){logger['error'](_0x6036('0x2c'),'afterCreate','clickSend',util[_0x6036('0x3c')](_0x4fcb80,{'showHidden':![],'depth':null}));});}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x50'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6036('0x51'):if(_0x50a8d7[_0x6036('0x52')]&&_0x50a8d7[_0x6036('0x22')]){var _0x351be1={'dst':_0x10b345[_0x6036('0x23')],'text':_0x10b345[_0x6036('0xc')],'src':_0x50a8d7['senderString']||_0x50a8d7[_0x6036('0x23')],'url':_0x50a8d7[_0x6036('0x26')]+_0x6036('0x27')+_0x10b345['id']+'/status?token='+_0x50a8d7['token']};var _0x5089c7=util[_0x6036('0x45')](_0x6036('0x46'),_0x50a8d7['authId'],_0x50a8d7[_0x6036('0x22')]);var _0x516c9f={'method':_0x6036('0x40'),'uri':util['format'](_0x6036('0x53'),_0x50a8d7[_0x6036('0x52')]),'body':_0x351be1,'headers':{'Authorization':util[_0x6036('0x45')](_0x6036('0x48'),new Buffer(_0x5089c7)[_0x6036('0x49')](_0x6036('0x4a')))},'json':!![]};rp(_0x516c9f)[_0x6036('0x19')](function(_0xa56396){var _0x283c9c={'messageId':_0xa56396[_0x6036('0x54')][0x0]};return _0x3d1d3c[_0x6036('0x1a')](_0x283c9c);})['catch'](function(_0x185906){logger['error'](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x51'),util['inspect'](_0x185906,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6036('0x51'),_0x6036('0x55'));}break;case'infobip':if(_0x50a8d7[_0x6036('0x34')]&&_0x50a8d7['password']){if(_0x50a8d7[_0x6036('0x56')]){var _0x509a7e={'method':_0x6036('0x40'),'uri':_0x50a8d7[_0x6036('0x56')]+_0x6036('0x57'),'body':{'username':_0x50a8d7['username'],'password':_0x50a8d7['password']},'json':!![]};return rp(_0x509a7e)['then'](function(_0x5beb03){var _0xeead3={'method':_0x6036('0x40'),'uri':_0x50a8d7[_0x6036('0x56')]+_0x6036('0x58'),'body':{'messages':[{'from':_0x50a8d7[_0x6036('0x23')],'destinations':[{'to':_0x10b345[_0x6036('0x23')]}],'text':_0x10b345[_0x6036('0xc')],'notifyUrl':_0x50a8d7[_0x6036('0x26')]+_0x6036('0x27')+_0x10b345['id']+'/status?token='+_0x50a8d7[_0x6036('0x29')],'notifyContentType':_0x6036('0x59'),'callbackData':_0x50a8d7[_0x6036('0x23')]+';'+_0x10b345['body']}]},'headers':{'Authorization':_0x6036('0x5a')+_0x5beb03['token']},'json':!![]};return rp(_0xeead3)[_0x6036('0x19')](function(_0x157349){if(_0x157349[_0x6036('0x24')]){var _0x4905eb={'messageId':_0x157349[_0x6036('0x24')][0x0]['messageId']};if(!_0x50a8d7[_0x6036('0x42')]){_0x4905eb[_0x6036('0x3b')]=!![];}return _0x3d1d3c['update'](_0x4905eb);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6036('0x2d'),_0x6036('0x5b'),util[_0x6036('0x3c')](_0x157349,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3ac531){return logger[_0x6036('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x6036('0x3c')](_0x3ac531,{'showHidden':![],'depth':null}));});}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),'afterCreate','infobip',_0x6036('0x5c'));}}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x5b'),_0x6036('0x3d'));}break;case _0x6036('0x5d'):var _0x555454=require(_0x6036('0x5e'));if(_0x50a8d7[_0x6036('0x5f')]){var _0x39c320={};_0x39c320[_0x6036('0x60')]=_0x50a8d7[_0x6036('0x34')];_0x39c320['phone']=_0x10b345[_0x6036('0x23')];_0x39c320['sender']=_0x50a8d7[_0x6036('0x23')];_0x39c320[_0x6036('0x61')]=_0x10b345[_0x6036('0xc')];_0x39c320[_0x6036('0x62')]=+new Date();var _0x18994a='';var _0x34c99d='';var _0x48a671=Object[_0x6036('0x63')](_0x39c320);_0x48a671['sort']();for(var _0x567a71=0x0;_0x567a71<_0x48a671[_0x6036('0x64')];_0x567a71++){if(_0x18994a!=''){_0x18994a+='&';}_0x18994a+=_0x48a671[_0x567a71]+'='+encodeURIComponent(_0x39c320[_0x48a671[_0x567a71]]);_0x34c99d+=_0x39c320[_0x48a671[_0x567a71]];}_0x34c99d+=_0x50a8d7[_0x6036('0x5f')];_0x34c99d=_0x555454[_0x6036('0x65')](_0x6036('0x66'))[_0x6036('0x1a')](_0x34c99d)['digest'](_0x6036('0x67'));if(_0x18994a!==''){_0x18994a+='&';}_0x18994a+=_0x6036('0x68')+_0x34c99d;var _0x18af1c={'method':_0x6036('0x36'),'uri':_0x50a8d7[_0x6036('0x56')]+'/external/get/send.php?'+_0x18994a,'json':!![]};return rp(_0x18af1c)['then'](function(_0x14ce79){var _0x36c9dc=Object[_0x6036('0x63')](_0x14ce79);if(_0x14ce79[_0x36c9dc[0x0]][_0x6036('0x2b')]&&parseInt(_0x14ce79[_0x36c9dc[0x0]][_0x6036('0x2b')])===0x0){var _0x3fbfdb={'messageId':_0x14ce79[_0x36c9dc[0x0]]['id_sms']};if(!_0x50a8d7[_0x6036('0x42')]){_0x3fbfdb[_0x6036('0x3b')]=!![];}return _0x3d1d3c[_0x6036('0x1a')](_0x3fbfdb);}else{return logger[_0x6036('0x2b')](_0x6036('0x2c'),'afterCreate',_0x6036('0x5d'),util[_0x6036('0x3c')](_0x14ce79['error'],{'showHidden':![],'depth':null}));}})[_0x6036('0x1b')](function(_0x23d755){return logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x5d'),util[_0x6036('0x3c')](_0x23d755,{'showHidden':![],'depth':null}));});}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x5d'),_0x6036('0x69'));}break;case'clickatell':if(_0x50a8d7['apiKey']){var _0x40dc8c={'method':_0x6036('0x40'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x50a8d7[_0x6036('0x5f')]},'body':{'content':_0x10b345['body'],'to':[_0x10b345[_0x6036('0x23')]],'from':_0x50a8d7[_0x6036('0x23')],'binary':![],'clientMessageId':_0x6036('0x6a'),'charset':_0x6036('0x6b')},'json':!![]};rp(_0x40dc8c)[_0x6036('0x19')](function(_0x50c087){if(!_0x50c087[_0x6036('0x2b')]){var _0x448f9f={'messageId':_0x50c087[_0x6036('0x24')][0x0][_0x6036('0x6c')]};if(!_0x50a8d7[_0x6036('0x42')]){_0x448f9f[_0x6036('0x3b')]=!![];}return _0x3d1d3c[_0x6036('0x1a')](_0x448f9f);}else{return logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x6d'),util[_0x6036('0x3c')](_0x50c087[_0x6036('0x2b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2b33d0){return logger[_0x6036('0x2b')](_0x6036('0x2c'),'afterCreate',_0x6036('0x6d'),util[_0x6036('0x3c')](_0x2b33d0,{'showHidden':![],'depth':null}));});}else{logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x6d'),_0x6036('0x69'));}break;case'bandwidth':if(_0x50a8d7['username']&&_0x50a8d7[_0x6036('0x30')]){var _0x5089c7=util[_0x6036('0x45')](_0x6036('0x46'),_0x50a8d7['username'],_0x50a8d7[_0x6036('0x30')]);var _0x516c9f={'method':_0x6036('0x40'),'uri':_0x6036('0x6e')+_0x50a8d7[_0x6036('0x6f')]+_0x6036('0x70'),'body':{'to':[_0x10b345[_0x6036('0x23')]],'text':_0x10b345['body'],'from':_0x50a8d7[_0x6036('0x23')],'applicationId':_0x50a8d7[_0x6036('0x71')]},'headers':{'Authorization':util[_0x6036('0x45')](_0x6036('0x48'),new Buffer(_0x5089c7)[_0x6036('0x49')](_0x6036('0x4a')))},'json':!![]};rp(_0x516c9f)[_0x6036('0x19')](function(_0x220ac4){if(_0x220ac4['id']){var _0x5e243f={'messageId':_0x220ac4['id']};return _0x3d1d3c[_0x6036('0x1a')](_0x5e243f);}else{logger['error'](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x72'),util[_0x6036('0x3c')](_0x220ac4,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c4840){logger['error'](_0x6036('0x2c'),_0x6036('0x2d'),'bandwidth',util[_0x6036('0x3c')](_0x3c4840,{'showHidden':![],'depth':null}));});}else{logger[_0x6036('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6036('0x2d'),_0x6036('0x72'),_0x6036('0x3d'));}break;case'intelepeer':if(_0x50a8d7[_0x6036('0x5f')]){var _0x424675={};var _0x18af1c={'method':_0x6036('0x40'),'uri':_0x6036('0x73'),'headers':{'Authorization':_0x6036('0x74')+_0x50a8d7[_0x6036('0x5f')],'Content-Type':_0x6036('0x59')},'body':{'from':_0x50a8d7['phone'],'to':_0x10b345[_0x6036('0x23')],'text':_0x10b345[_0x6036('0xc')]},'json':!![]};return rp(_0x18af1c)[_0x6036('0x19')](function(_0x161c83){if(_0x161c83[_0x6036('0x75')]==0xca){_0x424675[_0x6036('0x76')]=_0x161c83;var _0x57b8c3={'method':_0x6036('0x40'),'uri':_0x6036('0x77'),'headers':{'Authorization':_0x6036('0x74')+_0x50a8d7[_0x6036('0x5f')],'Content-Type':_0x6036('0x59')},'body':{'refid':_0x424675[_0x6036('0x76')][_0x6036('0x78')]},'json':!![]};return rp(_0x57b8c3)[_0x6036('0x19')](function(_0x5d0a9d){_0x424675[_0x6036('0x79')]=_0x5d0a9d;var _0x50cb15={'messageId':_0x424675['message'][_0x6036('0x78')],'read':!![]};return _0x3d1d3c[_0x6036('0x1a')](_0x50cb15);});}else{return logger[_0x6036('0x2b')](_0x6036('0x2c'),'afterCreate',_0x6036('0x7a'),util['inspect'](_0x161c83,{'showHidden':![],'depth':null}));}})[_0x6036('0x1b')](function(_0xd431f8){return logger[_0x6036('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6036('0x7a'),util[_0x6036('0x3c')](_0xd431f8,{'showHidden':![],'depth':null}));});}else{return logger[_0x6036('0x2b')](_0x6036('0x2c'),_0x6036('0x2d'),_0x6036('0x7a'),_0x6036('0x7b'));}break;}}})[_0x6036('0x7c')](function(){_0x2ac30a();});}else{_0x2ac30a();}}},'charset':'utf8mb4','collate':_0x6036('0x7d')});}; \ No newline at end of file +var _0xc7a1=['SmsMessage','sms_messages','messageId','FULLTEXT','models','get','direction','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','toLowerCase','error','out','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','body','remote','/api/sms/messages/','token','sid','update','catch','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','username','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','queued_count','head','read','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','sender','text','timestamp','keys','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./smsMessage.attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc7a1,0xee));var _0x1c7a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc7a1[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1c7a('0x0'));var util=require(_0x1c7a('0x1'));var logger=require(_0x1c7a('0x2'))('api');var moment=require(_0x1c7a('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c7a('0x4'));var fs=require('fs');var path=require(_0x1c7a('0x5'));var rimraf=require(_0x1c7a('0x6'));var config=require('../../config/environment');var attributes=require(_0x1c7a('0x7'));module['exports']=function(_0x36acdc,_0x4f55c9){return _0x36acdc['define'](_0x1c7a('0x8'),attributes,{'tableName':_0x1c7a('0x9'),'paranoid':![],'indexes':[{'name':_0x1c7a('0xa'),'fields':[_0x1c7a('0xa')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x1c7a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e4c63,_0x410612,_0xeac0){var _0x1eda3a=_0x36acdc[_0x1c7a('0xc')];var _0x4d40bd=_0x2e4c63[_0x1c7a('0xd')]({'plain':!![]});if(_0x4d40bd[_0x1c7a('0xe')]['toLowerCase']()==='in'||_0x4d40bd[_0x1c7a('0xe')]['toLowerCase']()==='out'&&!_0x4d40bd['secret']&&!_[_0x1c7a('0xf')](_0x4d40bd[_0x1c7a('0x10')])&&!_[_0x1c7a('0xf')](_0x4d40bd[_0x1c7a('0x11')])){_0x1eda3a[_0x1c7a('0x12')][_0x1c7a('0x13')]({'where':{'id':_0x4d40bd[_0x1c7a('0x11')]}})[_0x1c7a('0x14')](function(_0x59fdbf){if(_0x59fdbf){_0x59fdbf['update']({'lastMsgAt':_0x4d40bd[_0x1c7a('0x15')],'lastMsgDirection':_0x4d40bd['direction'][_0x1c7a('0x16')]()});}})['catch'](function(_0x32be4d){console[_0x1c7a('0x17')](_0x32be4d);});}if(_0x4d40bd[_0x1c7a('0xe')]===_0x1c7a('0x18')&&!_0x4d40bd[_0x1c7a('0x19')]){var _0x3b5590;_0x1eda3a[_0x1c7a('0x1a')][_0x1c7a('0x1b')]({'where':{'id':_0x4d40bd[_0x1c7a('0x1c')]},'raw':!![]})[_0x1c7a('0x14')](function(_0x2ce437){_0x3b5590=_0x2ce437;if(_0x3b5590&&_0x3b5590['type']){switch(_0x3b5590[_0x1c7a('0x1d')]){case _0x1c7a('0x1e'):var _0x5a9d54=require('twilio');if(_0x3b5590[_0x1c7a('0x1f')]&&_0x3b5590[_0x1c7a('0x20')]&&_0x3b5590[_0x1c7a('0x21')]){var _0x4635f1=new _0x5a9d54(_0x3b5590[_0x1c7a('0x1f')],_0x3b5590['authToken']);_0x4635f1[_0x1c7a('0x22')]['create']({'body':_0x4d40bd[_0x1c7a('0x23')],'to':_0x4d40bd['phone'],'from':_0x3b5590['phone'],'statusCallback':_0x3b5590[_0x1c7a('0x24')]+_0x1c7a('0x25')+_0x4d40bd['id']+'/status?token='+_0x3b5590[_0x1c7a('0x26')]})[_0x1c7a('0x14')](function(_0x26bd2c){if(_0x26bd2c[_0x1c7a('0x27')]){return _0x2e4c63[_0x1c7a('0x28')]({'messageId':_0x26bd2c['sid']});}})[_0x1c7a('0x29')](function(_0x246f31){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c7a('0x2a'),_0x1c7a('0x1e'),util[_0x1c7a('0x2b')](_0x246f31,{'showHidden':![],'depth':null}));});}else{logger[_0x1c7a('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c7a('0x2a'),_0x1c7a('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x1c7a('0x2c'):var _0x478c82=_0x1c7a('0x2d');if(_0x3b5590['username']&&_0x3b5590[_0x1c7a('0x2e')]){var _0x4633fd={'recipient':[_0x4d40bd[_0x1c7a('0x21')]],'message':_0x4d40bd['body'],'message_type':_0x3b5590[_0x1c7a('0x2f')]};if(_0x3b5590['smsMethod']&&_0x3b5590['smsMethod']!=='SI'){_0x4633fd['sender']=_0x3b5590[_0x1c7a('0x21')];}var _0x4abd05={'url':_0x478c82+'login?username='+_0x3b5590[_0x1c7a('0x30')]+'&password='+_0x3b5590[_0x1c7a('0x2e')],'method':_0x1c7a('0x31')};rp(_0x4abd05)[_0x1c7a('0x14')](function(_0x594f47){var _0x5f1157=_0x594f47[_0x1c7a('0x32')](';');var _0x388244={'user_key':_0x5f1157[0x0],'session_key':_0x5f1157[0x1]};_0x4abd05={'url':_0x478c82+'sms','method':_0x1c7a('0x33'),'headers':{'user_key':_0x388244[_0x1c7a('0x34')],'Session_key':_0x388244['session_key']},'json':!![],'body':_0x4633fd};return rp(_0x4abd05);})[_0x1c7a('0x14')](function(_0x1a0e18){if(_0x1a0e18[_0x1c7a('0x35')]>=0x1){var _0x800359={'messageId':_0x1a0e18[_0x1c7a('0x36')]};if(_0x3b5590[_0x1c7a('0x2f')]!=='GP'||!_0x3b5590[_0x1c7a('0x37')]){_0x800359['read']=!![];}return _0x2e4c63[_0x1c7a('0x28')](_0x800359);}else{return logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x2c'),util[_0x1c7a('0x2b')](_0x1a0e18,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3be039){return logger[_0x1c7a('0x17')](_0x1c7a('0x38'),'afterCreate','skebby',util['inspect'](_0x3be039,{'showHidden':![],'depth':null}));});}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x2c'),_0x1c7a('0x39'));}break;case _0x1c7a('0x3a'):if(_0x3b5590[_0x1c7a('0x20')]){var _0x5a2afe={'recipient':_0x4d40bd['phone'],'message':_0x4d40bd['body'],'sender':_0x3b5590[_0x1c7a('0x3b')]||_0x3b5590[_0x1c7a('0x21')],'authorization':_0x3b5590[_0x1c7a('0x20')]};var _0x410612={'method':_0x1c7a('0x33'),'uri':_0x1c7a('0x3c'),'body':_0x5a2afe,'json':!![]};rp(_0x410612)[_0x1c7a('0x14')](function(_0x206374){var _0x3df3c3={'messageId':_0x206374[_0x1c7a('0x3d')]};if(!_0x3b5590[_0x1c7a('0x37')]){_0x3df3c3['read']=!![];}return _0x2e4c63[_0x1c7a('0x28')](_0x3df3c3);})['catch'](function(_0x3cd6fd){logger[_0x1c7a('0x17')](_0x1c7a('0x38'),'afterCreate',_0x1c7a('0x3a'),util[_0x1c7a('0x2b')](_0x3cd6fd,{'showHidden':![],'depth':null}));});}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),'afterCreate',_0x1c7a('0x3a'),_0x1c7a('0x3e'));}break;case _0x1c7a('0x3f'):if(_0x3b5590[_0x1c7a('0x30')]&&_0x3b5590[_0x1c7a('0x2e')]){var _0x5a2afe={'messages':[{'source':_0x1c7a('0x40'),'to':_0x4d40bd[_0x1c7a('0x21')],'body':_0x4d40bd[_0x1c7a('0x23')],'from':_0x3b5590[_0x1c7a('0x3b')]||_0x3b5590[_0x1c7a('0x21')]}]};var _0x53abbd=util['format'](_0x1c7a('0x41'),_0x3b5590[_0x1c7a('0x30')],_0x3b5590[_0x1c7a('0x2e')]);var _0x410612={'method':'POST','uri':_0x1c7a('0x42'),'body':_0x5a2afe,'headers':{'Authorization':util[_0x1c7a('0x43')]('Basic\x20%s',new Buffer(_0x53abbd)[_0x1c7a('0x44')](_0x1c7a('0x45')))},'json':!![]};rp(_0x410612)[_0x1c7a('0x14')](function(_0x365775){if(_0x365775[_0x1c7a('0x46')]>=0xc8&&_0x365775[_0x1c7a('0x46')]<=0xce){if(_0x365775[_0x1c7a('0x47')]&&_0x365775[_0x1c7a('0x47')][_0x1c7a('0x48')]>0x0){var _0x2dd1f1=_[_0x1c7a('0x49')](_0x365775[_0x1c7a('0x47')][_0x1c7a('0x22')]);var _0x29aefc={'messageId':_0x2dd1f1['message_id']};if(!_0x3b5590[_0x1c7a('0x37')]){_0x29aefc[_0x1c7a('0x4a')]=!![];}return _0x2e4c63[_0x1c7a('0x28')](_0x29aefc);}else{logger['error'](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x4b'),util[_0x1c7a('0x2b')](_0x365775,{'showHidden':![],'depth':null}));}}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),'clickSend',util[_0x1c7a('0x2b')](_0x365775,{'showHidden':![],'depth':null}));}})[_0x1c7a('0x29')](function(_0x3e5740){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c7a('0x2a'),_0x1c7a('0x4b'),util[_0x1c7a('0x2b')](_0x3e5740,{'showHidden':![],'depth':null}));});}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),'afterCreate',_0x1c7a('0x4b'),_0x1c7a('0x39'));}break;case _0x1c7a('0x4c'):if(_0x3b5590[_0x1c7a('0x4d')]&&_0x3b5590[_0x1c7a('0x20')]){var _0x5a2afe={'dst':_0x4d40bd[_0x1c7a('0x21')],'text':_0x4d40bd['body'],'src':_0x3b5590[_0x1c7a('0x3b')]||_0x3b5590[_0x1c7a('0x21')],'url':_0x3b5590[_0x1c7a('0x24')]+_0x1c7a('0x25')+_0x4d40bd['id']+_0x1c7a('0x4e')+_0x3b5590[_0x1c7a('0x26')]};var _0x53abbd=util[_0x1c7a('0x43')](_0x1c7a('0x41'),_0x3b5590[_0x1c7a('0x4d')],_0x3b5590['authToken']);var _0x410612={'method':_0x1c7a('0x33'),'uri':util[_0x1c7a('0x43')](_0x1c7a('0x4f'),_0x3b5590[_0x1c7a('0x4d')]),'body':_0x5a2afe,'headers':{'Authorization':util[_0x1c7a('0x43')]('Basic\x20%s',new Buffer(_0x53abbd)['toString'](_0x1c7a('0x45')))},'json':!![]};rp(_0x410612)[_0x1c7a('0x14')](function(_0x589c4a){var _0x5a1df1={'messageId':_0x589c4a['message_uuid'][0x0]};return _0x2e4c63[_0x1c7a('0x28')](_0x5a1df1);})[_0x1c7a('0x29')](function(_0x321d29){logger[_0x1c7a('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c7a('0x2a'),'plivo',util[_0x1c7a('0x2b')](_0x321d29,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1c7a('0x38'),'afterCreate',_0x1c7a('0x4c'),_0x1c7a('0x50'));}break;case _0x1c7a('0x51'):if(_0x3b5590[_0x1c7a('0x30')]&&_0x3b5590[_0x1c7a('0x2e')]){if(_0x3b5590[_0x1c7a('0x52')]){var _0x5c1ab6={'method':_0x1c7a('0x33'),'uri':_0x3b5590[_0x1c7a('0x52')]+_0x1c7a('0x53'),'body':{'username':_0x3b5590['username'],'password':_0x3b5590[_0x1c7a('0x2e')]},'json':!![]};return rp(_0x5c1ab6)[_0x1c7a('0x14')](function(_0x171191){var _0x528563={'method':_0x1c7a('0x33'),'uri':_0x3b5590['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3b5590[_0x1c7a('0x21')],'destinations':[{'to':_0x4d40bd[_0x1c7a('0x21')]}],'text':_0x4d40bd[_0x1c7a('0x23')],'notifyUrl':_0x3b5590[_0x1c7a('0x24')]+_0x1c7a('0x25')+_0x4d40bd['id']+_0x1c7a('0x4e')+_0x3b5590[_0x1c7a('0x26')],'notifyContentType':_0x1c7a('0x54'),'callbackData':_0x3b5590[_0x1c7a('0x21')]+';'+_0x4d40bd['body']}]},'headers':{'Authorization':_0x1c7a('0x55')+_0x171191['token']},'json':!![]};return rp(_0x528563)['then'](function(_0x40c0d9){if(_0x40c0d9[_0x1c7a('0x22')]){var _0xb7232d={'messageId':_0x40c0d9[_0x1c7a('0x22')][0x0][_0x1c7a('0xa')]};if(!_0x3b5590[_0x1c7a('0x37')]){_0xb7232d[_0x1c7a('0x4a')]=!![];}return _0x2e4c63[_0x1c7a('0x28')](_0xb7232d);}else{return logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x51'),util[_0x1c7a('0x2b')](_0x40c0d9,{'showHidden':![],'depth':null}));}});})[_0x1c7a('0x29')](function(_0x23fabb){return logger['error'](_0x1c7a('0x38'),'afterCreate',_0x1c7a('0x51'),util[_0x1c7a('0x2b')](_0x23fabb,{'showHidden':![],'depth':null}));});}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),'infobip',_0x1c7a('0x56'));}}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x51'),_0x1c7a('0x39'));}break;case _0x1c7a('0x57'):var _0x381123=require('crypto');if(_0x3b5590[_0x1c7a('0x58')]){var _0x37a4a0={};_0x37a4a0[_0x1c7a('0x59')]=_0x3b5590[_0x1c7a('0x30')];_0x37a4a0[_0x1c7a('0x21')]=_0x4d40bd[_0x1c7a('0x21')];_0x37a4a0[_0x1c7a('0x5a')]=_0x3b5590['phone'];_0x37a4a0[_0x1c7a('0x5b')]=_0x4d40bd[_0x1c7a('0x23')];_0x37a4a0[_0x1c7a('0x5c')]=+new Date();var _0x43a100='';var _0xbacdb='';var _0x320083=Object[_0x1c7a('0x5d')](_0x37a4a0);_0x320083[_0x1c7a('0x5e')]();for(var _0x6cb184=0x0;_0x6cb184<_0x320083[_0x1c7a('0x5f')];_0x6cb184++){if(_0x43a100!=''){_0x43a100+='&';}_0x43a100+=_0x320083[_0x6cb184]+'='+encodeURIComponent(_0x37a4a0[_0x320083[_0x6cb184]]);_0xbacdb+=_0x37a4a0[_0x320083[_0x6cb184]];}_0xbacdb+=_0x3b5590['apiKey'];_0xbacdb=_0x381123[_0x1c7a('0x60')](_0x1c7a('0x61'))[_0x1c7a('0x28')](_0xbacdb)['digest'](_0x1c7a('0x62'));if(_0x43a100!==''){_0x43a100+='&';}_0x43a100+=_0x1c7a('0x63')+_0xbacdb;var _0x4abd05={'method':_0x1c7a('0x31'),'uri':_0x3b5590[_0x1c7a('0x52')]+_0x1c7a('0x64')+_0x43a100,'json':!![]};return rp(_0x4abd05)[_0x1c7a('0x14')](function(_0x2ef601){var _0x4dedb8=Object[_0x1c7a('0x5d')](_0x2ef601);if(_0x2ef601[_0x4dedb8[0x0]][_0x1c7a('0x17')]&&parseInt(_0x2ef601[_0x4dedb8[0x0]][_0x1c7a('0x17')])===0x0){var _0x4f3043={'messageId':_0x2ef601[_0x4dedb8[0x0]][_0x1c7a('0x65')]};if(!_0x3b5590[_0x1c7a('0x37')]){_0x4f3043[_0x1c7a('0x4a')]=!![];}return _0x2e4c63[_0x1c7a('0x28')](_0x4f3043);}else{return logger[_0x1c7a('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c7a('0x2a'),_0x1c7a('0x57'),util[_0x1c7a('0x2b')](_0x2ef601[_0x1c7a('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xb8af38){return logger[_0x1c7a('0x17')](_0x1c7a('0x38'),'afterCreate',_0x1c7a('0x57'),util[_0x1c7a('0x2b')](_0xb8af38,{'showHidden':![],'depth':null}));});}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x57'),_0x1c7a('0x66'));}break;case'clickatell':if(_0x3b5590[_0x1c7a('0x58')]){var _0x56259f={'method':_0x1c7a('0x33'),'uri':_0x1c7a('0x67'),'headers':{'Authorization':_0x3b5590['apiKey']},'body':{'content':_0x4d40bd[_0x1c7a('0x23')],'to':[_0x4d40bd[_0x1c7a('0x21')]],'from':_0x3b5590[_0x1c7a('0x21')],'binary':![],'clientMessageId':_0x1c7a('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x56259f)[_0x1c7a('0x14')](function(_0x52a264){if(!_0x52a264[_0x1c7a('0x17')]){var _0x1e7510={'messageId':_0x52a264[_0x1c7a('0x22')][0x0][_0x1c7a('0x69')]};if(!_0x3b5590['deliveryReport']){_0x1e7510[_0x1c7a('0x4a')]=!![];}return _0x2e4c63[_0x1c7a('0x28')](_0x1e7510);}else{return logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x6a'),util['inspect'](_0x52a264[_0x1c7a('0x17')],{'showHidden':![],'depth':null}));}})[_0x1c7a('0x29')](function(_0x3a3a0f){return logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),'clickatell',util[_0x1c7a('0x2b')](_0x3a3a0f,{'showHidden':![],'depth':null}));});}else{logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x6a'),_0x1c7a('0x66'));}break;case _0x1c7a('0x6b'):if(_0x3b5590[_0x1c7a('0x30')]&&_0x3b5590[_0x1c7a('0x2e')]){var _0x53abbd=util[_0x1c7a('0x43')](_0x1c7a('0x41'),_0x3b5590['username'],_0x3b5590[_0x1c7a('0x2e')]);var _0x410612={'method':_0x1c7a('0x33'),'uri':_0x1c7a('0x6c')+_0x3b5590[_0x1c7a('0x6d')]+_0x1c7a('0x6e'),'body':{'to':[_0x4d40bd[_0x1c7a('0x21')]],'text':_0x4d40bd[_0x1c7a('0x23')],'from':_0x3b5590['phone'],'applicationId':_0x3b5590[_0x1c7a('0x6f')]},'headers':{'Authorization':util[_0x1c7a('0x43')]('Basic\x20%s',new Buffer(_0x53abbd)['toString'](_0x1c7a('0x45')))},'json':!![]};rp(_0x410612)['then'](function(_0x4cd5b4){if(_0x4cd5b4['id']){var _0x25d103={'messageId':_0x4cd5b4['id']};return _0x2e4c63[_0x1c7a('0x28')](_0x25d103);}else{logger['error'](_0x1c7a('0x38'),_0x1c7a('0x2a'),'bandwidth',util[_0x1c7a('0x2b')](_0x4cd5b4,{'showHidden':![],'depth':null}));}})['catch'](function(_0xd1dcae){logger[_0x1c7a('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c7a('0x2a'),'bandwidth',util[_0x1c7a('0x2b')](_0xd1dcae,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x6b'),_0x1c7a('0x39'));}break;case _0x1c7a('0x70'):if(_0x3b5590['apiKey']){var _0x2ce3e3={};var _0x4abd05={'method':_0x1c7a('0x33'),'uri':_0x1c7a('0x71'),'headers':{'Authorization':_0x1c7a('0x72')+_0x3b5590[_0x1c7a('0x58')],'Content-Type':_0x1c7a('0x54')},'body':{'from':_0x3b5590[_0x1c7a('0x21')],'to':_0x4d40bd[_0x1c7a('0x21')],'text':_0x4d40bd[_0x1c7a('0x23')]},'json':!![]};return rp(_0x4abd05)[_0x1c7a('0x14')](function(_0x3e1c7d){if(_0x3e1c7d[_0x1c7a('0x73')]==0xca){_0x2ce3e3[_0x1c7a('0x74')]=_0x3e1c7d;var _0x1b4370={'method':_0x1c7a('0x33'),'uri':_0x1c7a('0x75'),'headers':{'Authorization':_0x1c7a('0x72')+_0x3b5590['apiKey'],'Content-Type':_0x1c7a('0x54')},'body':{'refid':_0x2ce3e3['message']['refid']},'json':!![]};return rp(_0x1b4370)[_0x1c7a('0x14')](function(_0x2b4046){_0x2ce3e3[_0x1c7a('0x76')]=_0x2b4046;var _0xfbbf8c={'messageId':_0x2ce3e3[_0x1c7a('0x74')][_0x1c7a('0x77')],'read':!![]};return _0x2e4c63[_0x1c7a('0x28')](_0xfbbf8c);});}else{return logger['error'](_0x1c7a('0x38'),_0x1c7a('0x2a'),_0x1c7a('0x70'),util['inspect'](_0x3e1c7d,{'showHidden':![],'depth':null}));}})[_0x1c7a('0x29')](function(_0x20ebd0){return logger[_0x1c7a('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c7a('0x2a'),'intelepeer',util[_0x1c7a('0x2b')](_0x20ebd0,{'showHidden':![],'depth':null}));});}else{return logger[_0x1c7a('0x17')](_0x1c7a('0x38'),_0x1c7a('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x1c7a('0x78')](function(){_0xeac0();});}else{_0xeac0();}}},'charset':_0x1c7a('0x79'),'collate':_0x1c7a('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e6f0f56..6339f08 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 _0x3f3b=['SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','register','then','info'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3f3b,0xe8));var _0xb3f3=function(_0x16ad22,_0x38d191){_0x16ad22=_0x16ad22-0x0;var _0x4dfa8d=_0x3f3b[_0x16ad22];return _0x4dfa8d;};'use strict';var _=require(_0xb3f3('0x0'));var util=require(_0xb3f3('0x1'));var moment=require(_0xb3f3('0x2'));var BPromise=require(_0xb3f3('0x3'));var rs=require(_0xb3f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3f3('0x5'))['db'];var utils=require(_0xb3f3('0x6'));var logger=require(_0xb3f3('0x7'))(_0xb3f3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb3f3('0x9')]['http']({'port':0x232a});config[_0xb3f3('0xa')]=_[_0xb3f3('0xb')](config[_0xb3f3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3f3('0xc'))(new Redis(config[_0xb3f3('0xa')]));require('./smsMessage.socket')[_0xb3f3('0xd')](socket);function respondWithRpcPromise(_0x296f00,_0x9679aa,_0x16d518){return new BPromise(function(_0x6230ac,_0x958445){return client['request'](_0x296f00,_0x16d518)[_0xb3f3('0xe')](function(_0x292ce0){logger[_0xb3f3('0xf')](_0xb3f3('0x10'),_0x9679aa,'request\x20sent');logger[_0xb3f3('0x11')](_0xb3f3('0x12'),_0x9679aa,_0xb3f3('0x13'),JSON[_0xb3f3('0x14')](_0x292ce0));if(_0x292ce0[_0xb3f3('0x15')]){if(_0x292ce0[_0xb3f3('0x15')][_0xb3f3('0x16')]===0x1f4){logger[_0xb3f3('0x15')]('SmsMessage,\x20%s,\x20%s',_0x9679aa,_0x292ce0[_0xb3f3('0x15')][_0xb3f3('0x17')]);return _0x958445(_0x292ce0[_0xb3f3('0x15')]['message']);}logger['error'](_0xb3f3('0x10'),_0x9679aa,_0x292ce0['error'][_0xb3f3('0x17')]);return _0x6230ac(_0x292ce0[_0xb3f3('0x15')][_0xb3f3('0x17')]);}else{logger[_0xb3f3('0xf')](_0xb3f3('0x10'),_0x9679aa,_0xb3f3('0x13'));_0x6230ac(_0x292ce0['result'][_0xb3f3('0x17')]);}})[_0xb3f3('0x18')](function(_0xd43648){logger['error'](_0xb3f3('0x10'),_0x9679aa,_0xd43648);_0x958445(_0xd43648);});});}exports[_0xb3f3('0x19')]=function(_0x51e279){var _0x33b9a0=this;return new Promise(function(_0x34d0c3,_0x48cccf){return db[_0xb3f3('0x1a')][_0xb3f3('0x1b')](_0x51e279[_0xb3f3('0x1c')],{'raw':_0x51e279[_0xb3f3('0x1d')]?_0x51e279['options'][_0xb3f3('0x1e')]===undefined?!![]:![]:!![]})[_0xb3f3('0xe')](function(_0x216ce6){logger[_0xb3f3('0xf')](_0xb3f3('0x19'),_0x51e279);logger[_0xb3f3('0x11')](_0xb3f3('0x19'),_0x51e279,JSON[_0xb3f3('0x14')](_0x216ce6));_0x34d0c3(_0x216ce6);})['catch'](function(_0x1c842a){logger['error'](_0xb3f3('0x19'),_0x1c842a[_0xb3f3('0x17')],_0x51e279);_0x48cccf(_0x33b9a0['error'](0x1f4,_0x1c842a[_0xb3f3('0x17')]));});});}; \ No newline at end of file +var _0xc12b=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request'];(function(_0x57c013,_0x5ae397){var _0x53d261=function(_0x38c1c8){while(--_0x38c1c8){_0x57c013['push'](_0x57c013['shift']());}};_0x53d261(++_0x5ae397);}(_0xc12b,0x1ef));var _0xbc12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbc12('0x0'));var util=require(_0xbc12('0x1'));var moment=require(_0xbc12('0x2'));var BPromise=require(_0xbc12('0x3'));var rs=require(_0xbc12('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc12('0x5'))['db'];var utils=require(_0xbc12('0x6'));var logger=require(_0xbc12('0x7'))('rpc');var config=require(_0xbc12('0x8'));var jayson=require(_0xbc12('0x9'));var client=jayson['client'][_0xbc12('0xa')]({'port':0x232a});config[_0xbc12('0xb')]=_['defaults'](config[_0xbc12('0xb')],{'host':_0xbc12('0xc'),'port':0x18eb});var socket=require(_0xbc12('0xd'))(new Redis(config[_0xbc12('0xb')]));require(_0xbc12('0xe'))[_0xbc12('0xf')](socket);function respondWithRpcPromise(_0xa339dd,_0x4dd084,_0x304397){return new BPromise(function(_0x4d0ac,_0x1c2a64){return client[_0xbc12('0x10')](_0xa339dd,_0x304397)[_0xbc12('0x11')](function(_0x127a85){logger[_0xbc12('0x12')](_0xbc12('0x13'),_0x4dd084,_0xbc12('0x14'));logger[_0xbc12('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4dd084,_0xbc12('0x14'),JSON['stringify'](_0x127a85));if(_0x127a85[_0xbc12('0x16')]){if(_0x127a85[_0xbc12('0x16')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4dd084,_0x127a85[_0xbc12('0x16')][_0xbc12('0x17')]);return _0x1c2a64(_0x127a85['error'][_0xbc12('0x17')]);}logger[_0xbc12('0x16')](_0xbc12('0x13'),_0x4dd084,_0x127a85[_0xbc12('0x16')][_0xbc12('0x17')]);return _0x4d0ac(_0x127a85[_0xbc12('0x16')]['message']);}else{logger[_0xbc12('0x12')](_0xbc12('0x13'),_0x4dd084,'request\x20sent');_0x4d0ac(_0x127a85[_0xbc12('0x18')]['message']);}})[_0xbc12('0x19')](function(_0x5b19c8){logger[_0xbc12('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4dd084,_0x5b19c8);_0x1c2a64(_0x5b19c8);});});}exports[_0xbc12('0x1a')]=function(_0x362a9b){var _0x53d350=this;return new Promise(function(_0x1a7fc0,_0x2cac8c){return db[_0xbc12('0x1b')][_0xbc12('0x1c')](_0x362a9b[_0xbc12('0x1d')],{'raw':_0x362a9b[_0xbc12('0x1e')]?_0x362a9b[_0xbc12('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xbc12('0x11')](function(_0x4a0fde){logger[_0xbc12('0x12')]('CreateSmsMessage',_0x362a9b);logger[_0xbc12('0x15')]('CreateSmsMessage',_0x362a9b,JSON[_0xbc12('0x1f')](_0x4a0fde));_0x1a7fc0(_0x4a0fde);})[_0xbc12('0x19')](function(_0xc66cb){logger[_0xbc12('0x16')](_0xbc12('0x1a'),_0xc66cb[_0xbc12('0x17')],_0x362a9b);_0x2cac8c(_0x53d350[_0xbc12('0x16')](0x1f4,_0xc66cb[_0xbc12('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ddd989f..81d853b 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 _0x7fbe=['register','length','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x7fbe,0x16a));var _0xe7fb=function(_0x202ea3,_0x38ab41){_0x202ea3=_0x202ea3-0x0;var _0x58787b=_0x7fbe[_0x202ea3];return _0x58787b;};'use strict';var SmsMessageEvents=require(_0xe7fb('0x0'));var events=[_0xe7fb('0x1'),_0xe7fb('0x2'),_0xe7fb('0x3')];function createListener(_0x2d0ff7,_0x32f8e6){return function(_0x580563){_0x32f8e6[_0xe7fb('0x4')](_0x2d0ff7,_0x580563);};}function removeListener(_0x404b6b,_0xd20876){return function(){SmsMessageEvents[_0xe7fb('0x5')](_0x404b6b,_0xd20876);};}exports[_0xe7fb('0x6')]=function(_0x4f4821){for(var _0x23ae2b=0x0,_0x2584fc=events[_0xe7fb('0x7')];_0x23ae2b<_0x2584fc;_0x23ae2b++){var _0x2b6ef0=events[_0x23ae2b];var _0x101c61=createListener('smsMessage:'+_0x2b6ef0,_0x4f4821);SmsMessageEvents['on'](_0x2b6ef0,_0x101c61);}}; \ No newline at end of file +var _0x8ad5=['removeListener','register','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x5a6503,_0x5e0178){var _0x115dab=function(_0x53b7c3){while(--_0x53b7c3){_0x5a6503['push'](_0x5a6503['shift']());}};_0x115dab(++_0x5e0178);}(_0x8ad5,0x1a7));var _0x58ad=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8ad5[_0x1ac595];return _0x455fff;};'use strict';var SmsMessageEvents=require(_0x58ad('0x0'));var events=[_0x58ad('0x1'),_0x58ad('0x2'),_0x58ad('0x3')];function createListener(_0x3bd08c,_0x1de198){return function(_0x1af4f9){_0x1de198['emit'](_0x3bd08c,_0x1af4f9);};}function removeListener(_0x49f1a2,_0x1d91d8){return function(){SmsMessageEvents[_0x58ad('0x4')](_0x49f1a2,_0x1d91d8);};}exports[_0x58ad('0x5')]=function(_0x4fd20d){for(var _0x2cf4c9=0x0,_0x3d6feb=events['length'];_0x2cf4c9<_0x3d6feb;_0x2cf4c9++){var _0x5d5fef=events[_0x2cf4c9];var _0x30e6b5=createListener(_0x58ad('0x6')+_0x5d5fef,_0x4fd20d);SmsMessageEvents['on'](_0x5d5fef,_0x30e6b5);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ed8084a..70cf802 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 _0xf1b5=['Router','fs-extra','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','put','update','destroy','/:id/teams','removeTeams','delete','removeAgents','exports','util','path','connect-timeout','express'];(function(_0xc2fcd0,_0x1fbdeb){var _0x1dd2b3=function(_0x4cc969){while(--_0x4cc969){_0xc2fcd0['push'](_0xc2fcd0['shift']());}};_0x1dd2b3(++_0x1fbdeb);}(_0xf1b5,0x1cc));var _0x5f1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf1b5[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x5f1b('0x0'));var path=require(_0x5f1b('0x1'));var timeout=require(_0x5f1b('0x2'));var express=require(_0x5f1b('0x3'));var router=express[_0x5f1b('0x4')]();var fs_extra=require(_0x5f1b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5f1b('0x6'));var controller=require(_0x5f1b('0x7'));router[_0x5f1b('0x8')]('/',auth[_0x5f1b('0x9')](),controller['index']);router['get'](_0x5f1b('0xa'),auth[_0x5f1b('0x9')](),controller[_0x5f1b('0xb')]);router[_0x5f1b('0x8')](_0x5f1b('0xc'),auth['isAuthenticated'](),controller[_0x5f1b('0xd')]);router[_0x5f1b('0x8')](_0x5f1b('0xe'),auth['isAuthenticated'](),controller[_0x5f1b('0xf')]);router[_0x5f1b('0x8')]('/:id/teams',auth[_0x5f1b('0x9')](),controller[_0x5f1b('0x10')]);router['get'](_0x5f1b('0x11'),auth[_0x5f1b('0x9')](),controller[_0x5f1b('0x12')]);router['post']('/',auth[_0x5f1b('0x9')](),controller['create']);router[_0x5f1b('0x13')]('/:id/teams',auth[_0x5f1b('0x9')](),controller[_0x5f1b('0x14')]);router[_0x5f1b('0x13')](_0x5f1b('0x11'),auth[_0x5f1b('0x9')](),controller['addAgents']);router[_0x5f1b('0x15')]('/:id',auth[_0x5f1b('0x9')](),controller[_0x5f1b('0x16')]);router['delete'](_0x5f1b('0xc'),auth[_0x5f1b('0x9')](),controller[_0x5f1b('0x17')]);router['delete'](_0x5f1b('0x18'),auth[_0x5f1b('0x9')](),controller[_0x5f1b('0x19')]);router[_0x5f1b('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0x5f1b('0x1b')]);module[_0x5f1b('0x1c')]=router; \ No newline at end of file +var _0x61b7=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents'];(function(_0x224616,_0x42bced){var _0x2823b4=function(_0x4a72d8){while(--_0x4a72d8){_0x224616['push'](_0x224616['shift']());}};_0x2823b4(++_0x42bced);}(_0x61b7,0x144));var _0x761b=function(_0x57e49d,_0x2070e5){_0x57e49d=_0x57e49d-0x0;var _0x5bdafb=_0x61b7[_0x57e49d];return _0x5bdafb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x761b('0x0'));var express=require('express');var router=express[_0x761b('0x1')]();var fs_extra=require(_0x761b('0x2'));var auth=require(_0x761b('0x3'));var interaction=require(_0x761b('0x4'));var config=require(_0x761b('0x5'));var controller=require('./smsQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x761b('0x6')]);router['get'](_0x761b('0x7'),auth[_0x761b('0x8')](),controller[_0x761b('0x9')]);router[_0x761b('0xa')](_0x761b('0xb'),auth['isAuthenticated'](),controller[_0x761b('0xc')]);router[_0x761b('0xa')](_0x761b('0xd'),auth[_0x761b('0x8')](),controller[_0x761b('0xe')]);router['get'](_0x761b('0xf'),auth[_0x761b('0x8')](),controller[_0x761b('0x10')]);router[_0x761b('0xa')](_0x761b('0x11'),auth[_0x761b('0x8')](),controller[_0x761b('0x12')]);router[_0x761b('0x13')]('/',auth[_0x761b('0x8')](),controller['create']);router[_0x761b('0x13')](_0x761b('0xf'),auth['isAuthenticated'](),controller[_0x761b('0x14')]);router[_0x761b('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x761b('0x15')]);router[_0x761b('0x16')](_0x761b('0xb'),auth[_0x761b('0x8')](),controller['update']);router['delete']('/:id',auth[_0x761b('0x8')](),controller[_0x761b('0x17')]);router[_0x761b('0x18')](_0x761b('0xf'),auth['isAuthenticated'](),controller[_0x761b('0x19')]);router[_0x761b('0x18')](_0x761b('0x11'),auth[_0x761b('0x8')](),controller[_0x761b('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7e6b321..7869e5b 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 _0x5b92=['beepall','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x5b92,0x79));var _0x25b9=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5b92[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x25b9('0x0'));module['exports']={'name':{'type':Sequelize[_0x25b9('0x1')],'unique':_0x25b9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x25b9('0x1')]},'timeout':{'type':Sequelize[_0x25b9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x25b9('0x4'),_0x25b9('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xc61c=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x37862a,_0x2bc98e){var _0x5b0104=function(_0x391413){while(--_0x391413){_0x37862a['push'](_0x37862a['shift']());}};_0x5b0104(++_0x2bc98e);}(_0xc61c,0x187));var _0xcc61=function(_0x407a3e,_0x15acb0){_0x407a3e=_0x407a3e-0x0;var _0x129fe3=_0xc61c[_0x407a3e];return _0x129fe3;};'use strict';var Sequelize=require(_0xcc61('0x0'));module[_0xcc61('0x1')]={'name':{'type':Sequelize[_0xcc61('0x2')],'unique':_0xcc61('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcc61('0x2')]},'timeout':{'type':Sequelize[_0xcc61('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc61('0x5')](_0xcc61('0x6'),_0xcc61('0x7'),_0xcc61('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 7b76c06..9853dd8 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 _0xb749=['getTeams','Team','addTeams','ids','User','Agents','online','voicePause','sequelize','each','emit','userSmsQueue:save','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','QueryTypes','SELECT','TeamId','includes','compact','value','transaction','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','findOne','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','get','UserProfileResource','end','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','SmsQueue','include','findAll','rows','catch','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','params','describe','getMembers','UserSmsQueue','sort','SmsQueueId','map','UserId','agent','updatedAt','createdAt','format','%s/%s','smsPause'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0xb749,0xac));var _0x9b74=function(_0x4d2ec7,_0x457d53){_0x4d2ec7=_0x4d2ec7-0x0;var _0x41cd7d=_0xb749[_0x4d2ec7];return _0x41cd7d;};'use strict';var emlformat=require(_0x9b74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b74('0x1'));var jsonpatch=require(_0x9b74('0x2'));var rp=require('request-promise');var moment=require(_0x9b74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9b74('0x4'));var util=require(_0x9b74('0x5'));var path=require(_0x9b74('0x6'));var sox=require(_0x9b74('0x7'));var csv=require(_0x9b74('0x8'));var ejs=require(_0x9b74('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b74('0xa'));var squel=require('squel');var crypto=require(_0x9b74('0xb'));var jsforce=require(_0x9b74('0xc'));var deskjs=require(_0x9b74('0xd'));var toCsv=require(_0x9b74('0x8'));var querystring=require(_0x9b74('0xe'));var Papa=require('papaparse');var Redis=require(_0x9b74('0xf'));var authService=require(_0x9b74('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9b74('0x11'));var hardwareService=require(_0x9b74('0x12'));var logger=require(_0x9b74('0x13'))('api');var utils=require(_0x9b74('0x14'));var config=require(_0x9b74('0x15'));var licenseUtil=require(_0x9b74('0x16'));var db=require(_0x9b74('0x17'))['db'];config['redis']=_['defaults'](config[_0x9b74('0x18')],{'host':_0x9b74('0x19'),'port':0x18eb});var socket=require(_0x9b74('0x1a'))(new Redis(config[_0x9b74('0x18')]));require('./smsQueue.socket')[_0x9b74('0x1b')](socket);function respondWithStatusCode(_0x440027,_0x260532){_0x260532=_0x260532||0xcc;return function(_0x31c30d){if(_0x31c30d){return _0x440027[_0x9b74('0x1c')](_0x260532);}return _0x440027[_0x9b74('0x1d')](_0x260532)['end']();};}function respondWithResult(_0x4d5105,_0x6d921a){_0x6d921a=_0x6d921a||0xc8;return function(_0x29a86d){if(_0x29a86d){return _0x4d5105[_0x9b74('0x1d')](_0x6d921a)[_0x9b74('0x1e')](_0x29a86d);}};}function respondWithFilteredResult(_0x4cb6d7,_0x4ceee8){return function(_0x2c56d4){if(_0x2c56d4){var _0x3cebd3=typeof _0x4ceee8['offset']===_0x9b74('0x1f')&&typeof _0x4ceee8[_0x9b74('0x20')]===_0x9b74('0x1f');var _0x5696b1=_0x2c56d4[_0x9b74('0x21')];var _0x2a3498=_0x3cebd3?0x0:_0x4ceee8[_0x9b74('0x22')];var _0x2f2464=_0x3cebd3?_0x2c56d4['count']:_0x4ceee8['offset']+_0x4ceee8['limit'];var _0x1a743f;if(_0x2f2464>=_0x5696b1){_0x2f2464=_0x5696b1;_0x1a743f=0xc8;}else{_0x1a743f=0xce;}_0x4cb6d7['status'](_0x1a743f);return _0x4cb6d7[_0x9b74('0x23')]('Content-Range',_0x2a3498+'-'+_0x2f2464+'/'+_0x5696b1)[_0x9b74('0x1e')](_0x2c56d4);}return null;};}function patchUpdates(_0x1ff224){return function(_0x3897a2){try{jsonpatch[_0x9b74('0x24')](_0x3897a2,_0x1ff224,!![]);}catch(_0x15370e){return BPromise['reject'](_0x15370e);}return _0x3897a2[_0x9b74('0x25')]();};}function saveUpdates(_0x42450c,_0x548655){return function(_0x2fa7f6){if(_0x2fa7f6){return _0x2fa7f6[_0x9b74('0x26')](_0x42450c)['then'](function(_0x5d370d){return _0x5d370d;});}return null;};}function removeEntity(_0x413946,_0x1d41ca){return function(_0xa266ba){if(_0xa266ba){return _0xa266ba[_0x9b74('0x27')]()[_0x9b74('0x28')](function(){var _0x4f9cd7=_0xa266ba[_0x9b74('0x29')]({'plain':!![]});var _0x35d202='SmsQueues';return db[_0x9b74('0x2a')]['destroy']({'where':{'type':_0x35d202,'resourceId':_0x4f9cd7['id']}})[_0x9b74('0x28')](function(){return _0xa266ba;});})['then'](function(){_0x413946['status'](0xcc)[_0x9b74('0x2b')]();});}};}function handleEntityNotFound(_0x1df36d,_0x365cb2){return function(_0x5a0319){if(!_0x5a0319){_0x1df36d['sendStatus'](0x194);}return _0x5a0319;};}function handleError(_0x19ccf0,_0xe5e961){_0xe5e961=_0xe5e961||0x1f4;return function(_0x25960a){logger['error'](_0x25960a[_0x9b74('0x2c')]);if(_0x25960a[_0x9b74('0x2d')]){delete _0x25960a[_0x9b74('0x2d')];}_0x19ccf0[_0x9b74('0x1d')](_0xe5e961)[_0x9b74('0x2e')](_0x25960a);};}exports[_0x9b74('0x2f')]=function(_0x3ea908,_0xac978a){var _0x61e0cb={},_0x2c2a46={},_0x4f7271={'count':0x0,'rows':[]};var _0x54a253=_['map'](db['SmsQueue'][_0x9b74('0x30')],function(_0x3cd831){return{'name':_0x3cd831[_0x9b74('0x31')],'type':_0x3cd831['type'][_0x9b74('0x32')]};});_0x2c2a46[_0x9b74('0x33')]=_['map'](_0x54a253,'name');_0x2c2a46[_0x9b74('0x34')]=_[_0x9b74('0x35')](_0x3ea908[_0x9b74('0x34')]);_0x2c2a46[_0x9b74('0x36')]=_[_0x9b74('0x37')](_0x2c2a46['model'],_0x2c2a46[_0x9b74('0x34')]);_0x61e0cb[_0x9b74('0x38')]=_[_0x9b74('0x37')](_0x2c2a46[_0x9b74('0x33')],qs['fields'](_0x3ea908[_0x9b74('0x34')][_0x9b74('0x39')]));_0x61e0cb[_0x9b74('0x38')]=_0x61e0cb[_0x9b74('0x38')][_0x9b74('0x3a')]?_0x61e0cb[_0x9b74('0x38')]:_0x2c2a46[_0x9b74('0x33')];if(!_0x3ea908[_0x9b74('0x34')][_0x9b74('0x3b')](_0x9b74('0x3c'))){_0x61e0cb[_0x9b74('0x20')]=qs[_0x9b74('0x20')](_0x3ea908[_0x9b74('0x34')][_0x9b74('0x20')]);_0x61e0cb[_0x9b74('0x22')]=qs[_0x9b74('0x22')](_0x3ea908[_0x9b74('0x34')][_0x9b74('0x22')]);}_0x61e0cb[_0x9b74('0x3d')]=qs['sort'](_0x3ea908[_0x9b74('0x34')]['sort']);_0x61e0cb[_0x9b74('0x3e')]=qs[_0x9b74('0x36')](_[_0x9b74('0x3f')](_0x3ea908[_0x9b74('0x34')],_0x2c2a46[_0x9b74('0x36')]),_0x54a253);if(_0x3ea908[_0x9b74('0x34')][_0x9b74('0x40')]){_0x61e0cb[_0x9b74('0x3e')]=_[_0x9b74('0x41')](_0x61e0cb[_0x9b74('0x3e')],{'$or':_['map'](_0x54a253,function(_0x479d67){if(_0x479d67[_0x9b74('0x42')]!==_0x9b74('0x43')){var _0x13b3cf={};_0x13b3cf[_0x479d67[_0x9b74('0x2d')]]={'$like':'%'+_0x3ea908[_0x9b74('0x34')][_0x9b74('0x40')]+'%'};return _0x13b3cf;}})});}_0x61e0cb=_[_0x9b74('0x41')]({},_0x61e0cb,_0x3ea908[_0x9b74('0x44')]);var _0x2c692e={'where':_0x61e0cb[_0x9b74('0x3e')]};return db[_0x9b74('0x45')]['count'](_0x2c692e)['then'](function(_0x34a04b){_0x4f7271['count']=_0x34a04b;if(_0x3ea908[_0x9b74('0x34')]['includeAll']){_0x61e0cb[_0x9b74('0x46')]=[{'all':!![]}];}return db[_0x9b74('0x45')][_0x9b74('0x47')](_0x61e0cb);})[_0x9b74('0x28')](function(_0x318d05){_0x4f7271[_0x9b74('0x48')]=_0x318d05;return _0x4f7271;})[_0x9b74('0x28')](respondWithFilteredResult(_0xac978a,_0x61e0cb))[_0x9b74('0x49')](handleError(_0xac978a,null));};exports[_0x9b74('0x4a')]=function(_0x435963,_0x273ddd){var _0x1401c6={'raw':!![],'where':{'id':_0x435963['params']['id']}},_0x256f48={};_0x256f48[_0x9b74('0x33')]=_[_0x9b74('0x35')](db[_0x9b74('0x45')][_0x9b74('0x30')]);_0x256f48[_0x9b74('0x34')]=_['keys'](_0x435963[_0x9b74('0x34')]);_0x256f48[_0x9b74('0x36')]=_['intersection'](_0x256f48[_0x9b74('0x33')],_0x256f48[_0x9b74('0x34')]);_0x1401c6['attributes']=_[_0x9b74('0x37')](_0x256f48['model'],qs[_0x9b74('0x39')](_0x435963[_0x9b74('0x34')][_0x9b74('0x39')]));_0x1401c6[_0x9b74('0x38')]=_0x1401c6['attributes'][_0x9b74('0x3a')]?_0x1401c6[_0x9b74('0x38')]:_0x256f48[_0x9b74('0x33')];if(_0x435963[_0x9b74('0x34')][_0x9b74('0x4b')]){_0x1401c6[_0x9b74('0x46')]=[{'all':!![]}];}_0x1401c6=_[_0x9b74('0x41')]({},_0x1401c6,_0x435963[_0x9b74('0x44')]);return db[_0x9b74('0x45')][_0x9b74('0x4c')](_0x1401c6)[_0x9b74('0x28')](handleEntityNotFound(_0x273ddd,null))['then'](respondWithResult(_0x273ddd,null))['catch'](handleError(_0x273ddd,null));};exports['create']=function(_0x2d3666,_0x597382){return db[_0x9b74('0x45')][_0x9b74('0x4d')](_0x2d3666[_0x9b74('0x4e')],{})[_0x9b74('0x28')](function(_0x1dec0b){var _0x4c0f1e=_0x2d3666['user'][_0x9b74('0x29')]({'plain':!![]});if(!_0x4c0f1e)throw new Error(_0x9b74('0x4f'));if(_0x4c0f1e[_0x9b74('0x50')]===_0x9b74('0x51')){var _0x4ea97a=_0x1dec0b[_0x9b74('0x29')]({'plain':!![]});var _0x464825='SmsQueues';return db[_0x9b74('0x52')][_0x9b74('0x4c')]({'where':{'name':_0x464825,'userProfileId':_0x4c0f1e['userProfileId']},'raw':!![]})[_0x9b74('0x28')](function(_0x46618a){if(_0x46618a&&_0x46618a['autoAssociation']===0x0){return db[_0x9b74('0x2a')][_0x9b74('0x4d')]({'name':_0x4ea97a[_0x9b74('0x2d')],'resourceId':_0x4ea97a['id'],'type':_0x46618a[_0x9b74('0x2d')],'sectionId':_0x46618a['id']},{})['then'](function(){return _0x1dec0b;});}else{return _0x1dec0b;}})[_0x9b74('0x49')](function(_0x25bff1){logger[_0x9b74('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25bff1);throw _0x25bff1;});}return _0x1dec0b;})[_0x9b74('0x28')](respondWithResult(_0x597382,0xc9))[_0x9b74('0x49')](handleError(_0x597382,null));};exports[_0x9b74('0x26')]=function(_0x4cf138,_0x1a0754){if(_0x4cf138[_0x9b74('0x4e')]['id']){delete _0x4cf138[_0x9b74('0x4e')]['id'];}return db[_0x9b74('0x45')][_0x9b74('0x4c')]({'where':{'id':_0x4cf138[_0x9b74('0x54')]['id']}})[_0x9b74('0x28')](handleEntityNotFound(_0x1a0754,null))[_0x9b74('0x28')](saveUpdates(_0x4cf138[_0x9b74('0x4e')],null))[_0x9b74('0x28')](respondWithResult(_0x1a0754,null))[_0x9b74('0x49')](handleError(_0x1a0754,null));};exports[_0x9b74('0x27')]=function(_0x5b8ec1,_0x235f67){return db[_0x9b74('0x45')][_0x9b74('0x4c')]({'where':{'id':_0x5b8ec1[_0x9b74('0x54')]['id']}})[_0x9b74('0x28')](handleEntityNotFound(_0x235f67,null))[_0x9b74('0x28')](removeEntity(_0x235f67,null))[_0x9b74('0x49')](handleError(_0x235f67,null));};exports[_0x9b74('0x55')]=function(_0x237ae7,_0x25128f){return db[_0x9b74('0x45')][_0x9b74('0x55')]()[_0x9b74('0x28')](respondWithResult(_0x25128f,null))[_0x9b74('0x49')](handleError(_0x25128f,null));};exports[_0x9b74('0x56')]=function(_0x884ab0,_0x1b150e,_0x4da92c){var _0x4bb1f2={'raw':!![],'where':{}},_0x15f53e={},_0x5a1ee1;return db[_0x9b74('0x45')]['findOne']({'where':{'id':_0x884ab0[_0x9b74('0x54')]['id']}})[_0x9b74('0x28')](handleEntityNotFound(_0x1b150e,null))[_0x9b74('0x28')](function(_0x5b6bab){if(_0x5b6bab){_0x5a1ee1=_0x5b6bab['get']({'plain':!![]});_0x15f53e[_0x9b74('0x33')]=_[_0x9b74('0x35')](db[_0x9b74('0x57')]['rawAttributes']);_0x15f53e[_0x9b74('0x34')]=_[_0x9b74('0x35')](_0x884ab0['query']);_0x15f53e[_0x9b74('0x36')]=_['intersection'](_0x15f53e[_0x9b74('0x33')],_0x15f53e['query']);_0x4bb1f2[_0x9b74('0x38')]=_[_0x9b74('0x37')](_0x15f53e[_0x9b74('0x33')],qs[_0x9b74('0x39')](_0x884ab0[_0x9b74('0x34')][_0x9b74('0x39')]));_0x4bb1f2['attributes']=_0x4bb1f2['attributes'][_0x9b74('0x3a')]?_0x4bb1f2['attributes']:_0x15f53e['model'];if(!_0x884ab0[_0x9b74('0x34')]['hasOwnProperty']('nolimit')){_0x4bb1f2[_0x9b74('0x20')]=qs['limit'](_0x884ab0[_0x9b74('0x34')]['limit']);_0x4bb1f2['offset']=qs[_0x9b74('0x22')](_0x884ab0[_0x9b74('0x34')][_0x9b74('0x22')]);}_0x4bb1f2['order']=qs[_0x9b74('0x58')](_0x884ab0[_0x9b74('0x34')]['sort']);_0x4bb1f2[_0x9b74('0x3e')]=qs['filters'](_[_0x9b74('0x3f')](_0x884ab0[_0x9b74('0x34')],_0x15f53e[_0x9b74('0x36')]));_0x4bb1f2['where'][_0x9b74('0x59')]=_0x5b6bab['id'];if(_0x884ab0[_0x9b74('0x34')][_0x9b74('0x40')]){_0x4bb1f2[_0x9b74('0x3e')]=_[_0x9b74('0x41')](_0x4bb1f2[_0x9b74('0x3e')],{'$or':_[_0x9b74('0x5a')](_0x4bb1f2[_0x9b74('0x38')],function(_0x2333bb){var _0xa0e6b7={};_0xa0e6b7[_0x2333bb]={'$like':'%'+_0x884ab0[_0x9b74('0x34')][_0x9b74('0x40')]+'%'};return _0xa0e6b7;})});}_0x4bb1f2=_[_0x9b74('0x41')]({},_0x4bb1f2,_0x884ab0[_0x9b74('0x44')]);return db[_0x9b74('0x57')]['findAll'](_0x4bb1f2);}})[_0x9b74('0x28')](function(_0x534982){if(_0x534982){return db['User']['findAndCountAll']({'where':{'id':_[_0x9b74('0x5a')](_0x534982,_0x9b74('0x5b')),'role':_0x9b74('0x5c')},'attributes':['id',_0x9b74('0x2d'),'smsPause',_0x9b74('0x5d'),_0x9b74('0x5e')]});}})['then'](function(_0x580d48){if(_0x580d48){return{'count':_0x580d48[_0x9b74('0x21')],'rows':_[_0x9b74('0x5a')](_0x580d48[_0x9b74('0x48')],function(_0x1ef210){return{'membername':_0x1ef210[_0x9b74('0x2d')],'UserId':_0x1ef210['id'],'queue_name':_0x5a1ee1[_0x9b74('0x2d')],'SmsQueueId':_0x5a1ee1['id'],'interface':util[_0x9b74('0x5f')](_0x9b74('0x60'),'SIP',_0x1ef210[_0x9b74('0x2d')]),'penalty':0x0,'paused':_0x1ef210[_0x9b74('0x61')],'createdAt':_0x1ef210[_0x9b74('0x5e')],'updatedAt':_0x1ef210[_0x9b74('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9b74('0x28')](respondWithFilteredResult(_0x1b150e,_0x4bb1f2))[_0x9b74('0x49')](handleError(_0x1b150e,null));};exports[_0x9b74('0x62')]=function(_0xb0e6ad,_0x4bda18,_0x888edc){var _0x51079f={};var _0x46a30d={};var _0x488612;var _0xba6341;return db[_0x9b74('0x45')]['findOne']({'where':{'id':_0xb0e6ad[_0x9b74('0x54')]['id']}})[_0x9b74('0x28')](handleEntityNotFound(_0x4bda18,null))[_0x9b74('0x28')](function(_0x1bbee2){if(_0x1bbee2){_0x488612=_0x1bbee2;_0x46a30d[_0x9b74('0x33')]=_[_0x9b74('0x35')](db[_0x9b74('0x63')]['rawAttributes']);_0x46a30d['query']=_['keys'](_0xb0e6ad[_0x9b74('0x34')]);_0x46a30d[_0x9b74('0x36')]=_[_0x9b74('0x37')](_0x46a30d[_0x9b74('0x33')],_0x46a30d[_0x9b74('0x34')]);_0x51079f['attributes']=_['intersection'](_0x46a30d[_0x9b74('0x33')],qs[_0x9b74('0x39')](_0xb0e6ad[_0x9b74('0x34')][_0x9b74('0x39')]));_0x51079f[_0x9b74('0x38')]=_0x51079f[_0x9b74('0x38')][_0x9b74('0x3a')]?_0x51079f['attributes']:_0x46a30d[_0x9b74('0x33')];_0x51079f['order']=qs[_0x9b74('0x58')](_0xb0e6ad[_0x9b74('0x34')][_0x9b74('0x58')]);_0x51079f[_0x9b74('0x3e')]=qs[_0x9b74('0x36')](_[_0x9b74('0x3f')](_0xb0e6ad[_0x9b74('0x34')],_0x46a30d[_0x9b74('0x36')]));if(_0xb0e6ad[_0x9b74('0x34')]['filter']){_0x51079f[_0x9b74('0x3e')]=_[_0x9b74('0x41')](_0x51079f['where'],{'$or':_[_0x9b74('0x5a')](_0x51079f[_0x9b74('0x38')],function(_0x4433f4){var _0x6f8135={};_0x6f8135[_0x4433f4]={'$like':'%'+_0xb0e6ad['query'][_0x9b74('0x40')]+'%'};return _0x6f8135;})});}_0x51079f=_[_0x9b74('0x41')]({},_0x51079f,_0xb0e6ad[_0x9b74('0x44')]);return _0x488612[_0x9b74('0x62')](_0x51079f);}})[_0x9b74('0x28')](function(_0x424565){if(_0x424565){_0xba6341=_0x424565[_0x9b74('0x3a')];if(!_0xb0e6ad['query'][_0x9b74('0x3b')](_0x9b74('0x3c'))){_0x51079f[_0x9b74('0x20')]=qs[_0x9b74('0x20')](_0xb0e6ad[_0x9b74('0x34')]['limit']);_0x51079f[_0x9b74('0x22')]=qs[_0x9b74('0x22')](_0xb0e6ad[_0x9b74('0x34')][_0x9b74('0x22')]);}return _0x488612[_0x9b74('0x62')](_0x51079f);}})['then'](function(_0x24d068){if(_0x24d068){return _0x24d068?{'count':_0xba6341,'rows':_0x24d068}:null;}})[_0x9b74('0x28')](respondWithResult(_0x4bda18,null))[_0x9b74('0x49')](handleError(_0x4bda18,null));};exports[_0x9b74('0x64')]=function(_0x169547,_0x581a66,_0x5170a9){var _0x39bd3d=_0x169547['body'][_0x9b74('0x65')];return db[_0x9b74('0x63')][_0x9b74('0x47')]({'where':{'id':_0x39bd3d},'attributes':['id'],'include':[{'model':db[_0x9b74('0x66')],'as':_0x9b74('0x67'),'attributes':['id',_0x9b74('0x2d'),_0x9b74('0x68'),_0x9b74('0x69'),'interface'],'raw':!![]}]})[_0x9b74('0x28')](function(_0x51743b){if(_0x51743b){var _0x4b8d05=_['flatMap'](_0x51743b,function(_0x4a2e79){var _0xcafbf7=_0x4a2e79['get']({'plain':!![]});return _0xcafbf7[_0x9b74('0x67')];});return db[_0x9b74('0x45')][_0x9b74('0x4c')]({'where':{'id':_0x169547[_0x9b74('0x54')]['id']}})[_0x9b74('0x28')](function(_0x1d70b2){return db[_0x9b74('0x6a')]['transaction'](function(_0x14b90a){return _0x1d70b2[_0x9b74('0x64')](_0x39bd3d,{'transaction':_0x14b90a})[_0x9b74('0x28')](function(){return BPromise[_0x9b74('0x6b')](_0x4b8d05,function(_0x5437b1){return db[_0x9b74('0x57')]['findOrCreate']({'where':{'UserId':_0x5437b1['id'],'SmsQueueId':_0x169547[_0x9b74('0x54')]['id']},'transaction':_0x14b90a});});})['then'](function(){_0x4b8d05['forEach'](function(_0x33cdd3){socket[_0x9b74('0x6c')](_0x9b74('0x6d'),{'UserId':_0x33cdd3['id'],'SmsQueueId':_0x1d70b2['id']});});});});});}})[_0x9b74('0x28')](respondWithStatusCode(_0x581a66,null))[_0x9b74('0x49')](handleError(_0x581a66,null));};exports['removeTeams']=function(_0x5d6b3c,_0x20b8f6,_0x2d4e97){return db['Team']['findAll']({'where':{'id':_0x5d6b3c[_0x9b74('0x34')][_0x9b74('0x65')]},'attributes':['id'],'include':[{'model':db[_0x9b74('0x66')],'as':_0x9b74('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x20b8f6,null))['then'](function(_0x2e15e3){var _0x4f2034=_['map'](_0x2e15e3,'id');var _0x4cb1bb=[];var _0x58ba84=[];var _0x3f8954=squel[_0x9b74('0x6e')]();_0x3f8954[_0x9b74('0x6f')]('tq.TeamId')[_0x9b74('0x70')](_0x9b74('0x71'),'tq')[_0x9b74('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9b74('0x73'),_0x5d6b3c[_0x9b74('0x54')]['id']);for(var _0x53f2fd=0x0;_0x53f2fd<_0x2e15e3[_0x9b74('0x3a')];_0x53f2fd+=0x1){let _0x363612=_0x2e15e3[_0x53f2fd];for(var _0x1e21a1=0x0;_0x1e21a1<_0x363612[_0x9b74('0x67')]['length'];_0x1e21a1+=0x1){let _0x36fa35=_0x363612[_0x9b74('0x67')][_0x1e21a1];var _0x42e923=_0x3f8954[_0x9b74('0x74')]();_0x42e923[_0x9b74('0x3e')]('ut.UserId\x20=\x20?',_0x36fa35['id']);_0x58ba84['push'](db[_0x9b74('0x6a')][_0x9b74('0x34')](_0x42e923['toString'](),{'type':db[_0x9b74('0x6a')][_0x9b74('0x75')][_0x9b74('0x76')]})[_0x9b74('0x28')](function(_0x5ce84f){if(_0x5ce84f[_0x9b74('0x3a')]===0x1){return _0x36fa35['id'];}else{var _0x5ed0ef=_['every'](_[_0x9b74('0x5a')](_0x5ce84f,_0x9b74('0x77')),function(_0x4da889){return _[_0x9b74('0x78')](_0x4f2034,_0x4da889);});if(_0x5ed0ef){return _0x36fa35['id'];}}}));}}return BPromise['all'](_0x58ba84)['then'](function(_0x3cf838){_0x4cb1bb=_(_0x4cb1bb)['union'](_0x3cf838)[_0x9b74('0x79')]()[_0x9b74('0x7a')]();return db[_0x9b74('0x45')][_0x9b74('0x4c')]({'where':{'id':_0x5d6b3c[_0x9b74('0x54')]['id']}})['then'](function(_0xd133b5){return db['sequelize'][_0x9b74('0x7b')](function(_0x14826d){return _0xd133b5[_0x9b74('0x7c')](_0x5d6b3c[_0x9b74('0x34')][_0x9b74('0x65')],{'transaction':_0x14826d})[_0x9b74('0x28')](function(){if(!_[_0x9b74('0x7d')](_0x4cb1bb)){return _0xd133b5[_0x9b74('0x7e')](_0x4cb1bb,{'transaction':_0x14826d});}})[_0x9b74('0x28')](function(){_0x4cb1bb[_0x9b74('0x7f')](function(_0x457fdc){socket[_0x9b74('0x6c')]('userSmsQueue:remove',{'UserId':_0x457fdc,'SmsQueueId':_0xd133b5['id']});});});});});});})['then'](respondWithStatusCode(_0x20b8f6,null))[_0x9b74('0x49')](handleError(_0x20b8f6,null));};exports[_0x9b74('0x80')]=function(_0x1bbb55,_0x2d48cb,_0x5f56d0){return db[_0x9b74('0x45')]['find']({'where':{'id':_0x1bbb55[_0x9b74('0x54')]['id']}})[_0x9b74('0x28')](handleEntityNotFound(_0x2d48cb,null))[_0x9b74('0x28')](function(_0x1f96d4){if(_0x1f96d4){return _0x1f96d4[_0x9b74('0x80')](_0x1bbb55[_0x9b74('0x4e')][_0x9b74('0x65')],_[_0x9b74('0x81')](_0x1bbb55[_0x9b74('0x4e')],[_0x9b74('0x65'),'id'])||{})[_0x9b74('0x82')](function(_0x4a8262){for(var _0x2f5abe=0x0;_0x2f5abe<_0x1bbb55[_0x9b74('0x4e')][_0x9b74('0x65')]['length'];_0x2f5abe+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x1bbb55[_0x9b74('0x4e')][_0x9b74('0x65')][_0x2f5abe]),'SmsQueueId':Number(_0x1bbb55[_0x9b74('0x54')]['id'])});}return _0x4a8262;});}})[_0x9b74('0x28')](respondWithResult(_0x2d48cb,null))[_0x9b74('0x49')](handleError(_0x2d48cb,null));};exports[_0x9b74('0x7e')]=function(_0x6e7fcc,_0x1059f4,_0x3a3ecf){return db[_0x9b74('0x45')][_0x9b74('0x4c')]({'where':{'id':_0x6e7fcc['params']['id']}})[_0x9b74('0x28')](handleEntityNotFound(_0x1059f4,null))[_0x9b74('0x28')](function(_0xb3c554){if(_0xb3c554){return _0xb3c554['removeAgents'](_0x6e7fcc[_0x9b74('0x34')][_0x9b74('0x65')])[_0x9b74('0x28')](function(){if(_[_0x9b74('0x83')](_0x6e7fcc[_0x9b74('0x34')][_0x9b74('0x65')])){for(var _0x42fbc7=0x0;_0x42fbc7<_0x6e7fcc[_0x9b74('0x34')][_0x9b74('0x65')][_0x9b74('0x3a')];_0x42fbc7+=0x1){socket[_0x9b74('0x6c')](_0x9b74('0x84'),{'UserId':Number(_0x6e7fcc[_0x9b74('0x34')][_0x9b74('0x65')][_0x42fbc7]),'SmsQueueId':Number(_0x6e7fcc[_0x9b74('0x54')]['id'])});}}else{socket[_0x9b74('0x6c')](_0x9b74('0x84'),{'UserId':Number(_0x6e7fcc[_0x9b74('0x34')][_0x9b74('0x65')]),'SmsQueueId':Number(_0x6e7fcc[_0x9b74('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x1059f4,null))[_0x9b74('0x49')](handleError(_0x1059f4,null));};exports[_0x9b74('0x85')]=function(_0x257eb0,_0x3edc7d,_0x6247fa){var _0x29918b={};var _0x1431ff={};var _0x338ef1;var _0x5b616f;return db['SmsQueue'][_0x9b74('0x86')]({'where':{'id':_0x257eb0[_0x9b74('0x54')]['id']}})['then'](handleEntityNotFound(_0x3edc7d,null))[_0x9b74('0x28')](function(_0x51fe77){if(_0x51fe77){_0x338ef1=_0x51fe77;_0x1431ff[_0x9b74('0x33')]=_[_0x9b74('0x35')](db[_0x9b74('0x66')]['rawAttributes']);_0x1431ff[_0x9b74('0x34')]=_[_0x9b74('0x35')](_0x257eb0[_0x9b74('0x34')]);_0x1431ff[_0x9b74('0x36')]=_[_0x9b74('0x37')](_0x1431ff[_0x9b74('0x33')],_0x1431ff[_0x9b74('0x34')]);_0x29918b[_0x9b74('0x38')]=_[_0x9b74('0x37')](_0x1431ff['model'],qs[_0x9b74('0x39')](_0x257eb0[_0x9b74('0x34')][_0x9b74('0x39')]));_0x29918b[_0x9b74('0x38')]=_0x29918b[_0x9b74('0x38')]['length']?_0x29918b[_0x9b74('0x38')]:_0x1431ff[_0x9b74('0x33')];_0x29918b[_0x9b74('0x3d')]=qs[_0x9b74('0x58')](_0x257eb0[_0x9b74('0x34')][_0x9b74('0x58')]);_0x29918b[_0x9b74('0x3e')]=qs[_0x9b74('0x36')](_[_0x9b74('0x3f')](_0x257eb0[_0x9b74('0x34')],_0x1431ff[_0x9b74('0x36')]));if(_0x257eb0[_0x9b74('0x34')][_0x9b74('0x40')]){_0x29918b[_0x9b74('0x3e')]=_[_0x9b74('0x41')](_0x29918b[_0x9b74('0x3e')],{'$or':_['map'](_0x29918b['attributes'],function(_0x26be27){var _0x4e5997={};_0x4e5997[_0x26be27]={'$like':'%'+_0x257eb0['query'][_0x9b74('0x40')]+'%'};return _0x4e5997;})});}_0x29918b=_[_0x9b74('0x41')]({},_0x29918b,_0x257eb0[_0x9b74('0x44')]);return _0x338ef1['getAgents'](_0x29918b);}})['then'](function(_0x131f48){if(_0x131f48){_0x5b616f=_0x131f48['length'];if(!_0x257eb0[_0x9b74('0x34')][_0x9b74('0x3b')](_0x9b74('0x3c'))){_0x29918b[_0x9b74('0x20')]=qs[_0x9b74('0x20')](_0x257eb0[_0x9b74('0x34')][_0x9b74('0x20')]);_0x29918b[_0x9b74('0x22')]=qs[_0x9b74('0x22')](_0x257eb0[_0x9b74('0x34')]['offset']);}return _0x338ef1['getAgents'](_0x29918b);}})[_0x9b74('0x28')](function(_0x589f5e){if(_0x589f5e){return _0x589f5e?{'count':_0x5b616f,'rows':_0x589f5e}:null;}})['then'](respondWithResult(_0x3edc7d,null))[_0x9b74('0x49')](handleError(_0x3edc7d,null));}; \ No newline at end of file +var _0xa73a=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','each','UserSmsQueue','forEach','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','emit','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','destroy','end','error','send','index','map','SmsQueue','rawAttributes','fieldName','type','key'];(function(_0x581306,_0x4cfae4){var _0x49fb6d=function(_0x245f41){while(--_0x245f41){_0x581306['push'](_0x581306['shift']());}};_0x49fb6d(++_0x4cfae4);}(_0xa73a,0xe5));var _0xaa73=function(_0x5cd7a3,_0x1aa14f){_0x5cd7a3=_0x5cd7a3-0x0;var _0x21235d=_0xa73a[_0x5cd7a3];return _0x21235d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa73('0x1'));var rp=require(_0xaa73('0x2'));var moment=require(_0xaa73('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaa73('0x4'));var util=require(_0xaa73('0x5'));var path=require(_0xaa73('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaa73('0x7'));var fs=require('fs');var fs_extra=require(_0xaa73('0x8'));var _=require(_0xaa73('0x9'));var squel=require(_0xaa73('0xa'));var crypto=require(_0xaa73('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaa73('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa73('0xd'));var Redis=require(_0xaa73('0xe'));var authService=require(_0xaa73('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaa73('0x10'));var hardwareService=require(_0xaa73('0x11'));var logger=require(_0xaa73('0x12'))('api');var utils=require(_0xaa73('0x13'));var config=require(_0xaa73('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa73('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xaa73('0x16'),'port':0x18eb});var socket=require(_0xaa73('0x17'))(new Redis(config[_0xaa73('0x18')]));require('./smsQueue.socket')[_0xaa73('0x19')](socket);function respondWithStatusCode(_0x3c2b61,_0x37afd6){_0x37afd6=_0x37afd6||0xcc;return function(_0x5c65b6){if(_0x5c65b6){return _0x3c2b61[_0xaa73('0x1a')](_0x37afd6);}return _0x3c2b61['status'](_0x37afd6)['end']();};}function respondWithResult(_0x20962b,_0x4b1761){_0x4b1761=_0x4b1761||0xc8;return function(_0x82f755){if(_0x82f755){return _0x20962b[_0xaa73('0x1b')](_0x4b1761)[_0xaa73('0x1c')](_0x82f755);}};}function respondWithFilteredResult(_0x5ec62d,_0x803b77){return function(_0x417bad){if(_0x417bad){var _0x485aad=typeof _0x803b77[_0xaa73('0x1d')]===_0xaa73('0x1e')&&typeof _0x803b77[_0xaa73('0x1f')]===_0xaa73('0x1e');var _0xfeb1f4=_0x417bad['count'];var _0x4787d2=_0x485aad?0x0:_0x803b77[_0xaa73('0x1d')];var _0x47c7cf=_0x485aad?_0x417bad[_0xaa73('0x20')]:_0x803b77[_0xaa73('0x1d')]+_0x803b77[_0xaa73('0x1f')];var _0x263751;if(_0x47c7cf>=_0xfeb1f4){_0x47c7cf=_0xfeb1f4;_0x263751=0xc8;}else{_0x263751=0xce;}_0x5ec62d[_0xaa73('0x1b')](_0x263751);return _0x5ec62d[_0xaa73('0x21')](_0xaa73('0x22'),_0x4787d2+'-'+_0x47c7cf+'/'+_0xfeb1f4)[_0xaa73('0x1c')](_0x417bad);}return null;};}function patchUpdates(_0x3bf599){return function(_0x58ade1){try{jsonpatch[_0xaa73('0x23')](_0x58ade1,_0x3bf599,!![]);}catch(_0x3f211c){return BPromise[_0xaa73('0x24')](_0x3f211c);}return _0x58ade1[_0xaa73('0x25')]();};}function saveUpdates(_0x279048,_0x47a5c4){return function(_0x883cfa){if(_0x883cfa){return _0x883cfa[_0xaa73('0x26')](_0x279048)['then'](function(_0x40a81d){return _0x40a81d;});}return null;};}function removeEntity(_0x21520c,_0x539c65){return function(_0x501cc4){if(_0x501cc4){return _0x501cc4['destroy']()[_0xaa73('0x27')](function(){var _0x55e08a=_0x501cc4[_0xaa73('0x28')]({'plain':!![]});var _0x4082d1=_0xaa73('0x29');return db['UserProfileResource'][_0xaa73('0x2a')]({'where':{'type':_0x4082d1,'resourceId':_0x55e08a['id']}})[_0xaa73('0x27')](function(){return _0x501cc4;});})[_0xaa73('0x27')](function(){_0x21520c[_0xaa73('0x1b')](0xcc)[_0xaa73('0x2b')]();});}};}function handleEntityNotFound(_0x161c14,_0x1b96be){return function(_0x1e1c1c){if(!_0x1e1c1c){_0x161c14[_0xaa73('0x1a')](0x194);}return _0x1e1c1c;};}function handleError(_0x2a801e,_0x35306d){_0x35306d=_0x35306d||0x1f4;return function(_0x40c64f){logger[_0xaa73('0x2c')](_0x40c64f['stack']);if(_0x40c64f['name']){delete _0x40c64f['name'];}_0x2a801e[_0xaa73('0x1b')](_0x35306d)[_0xaa73('0x2d')](_0x40c64f);};}exports[_0xaa73('0x2e')]=function(_0x29ba4c,_0x5ba81c){var _0x3d9f24={},_0x104ca1={},_0x1e59e2={'count':0x0,'rows':[]};var _0x4e2783=_[_0xaa73('0x2f')](db[_0xaa73('0x30')][_0xaa73('0x31')],function(_0x1db9e4){return{'name':_0x1db9e4[_0xaa73('0x32')],'type':_0x1db9e4[_0xaa73('0x33')][_0xaa73('0x34')]};});_0x104ca1['model']=_[_0xaa73('0x2f')](_0x4e2783,'name');_0x104ca1[_0xaa73('0x35')]=_[_0xaa73('0x36')](_0x29ba4c['query']);_0x104ca1[_0xaa73('0x37')]=_[_0xaa73('0x38')](_0x104ca1[_0xaa73('0x39')],_0x104ca1[_0xaa73('0x35')]);_0x3d9f24[_0xaa73('0x3a')]=_[_0xaa73('0x38')](_0x104ca1[_0xaa73('0x39')],qs[_0xaa73('0x3b')](_0x29ba4c[_0xaa73('0x35')][_0xaa73('0x3b')]));_0x3d9f24['attributes']=_0x3d9f24[_0xaa73('0x3a')]['length']?_0x3d9f24['attributes']:_0x104ca1['model'];if(!_0x29ba4c[_0xaa73('0x35')][_0xaa73('0x3c')]('nolimit')){_0x3d9f24['limit']=qs[_0xaa73('0x1f')](_0x29ba4c[_0xaa73('0x35')][_0xaa73('0x1f')]);_0x3d9f24[_0xaa73('0x1d')]=qs[_0xaa73('0x1d')](_0x29ba4c[_0xaa73('0x35')]['offset']);}_0x3d9f24[_0xaa73('0x3d')]=qs[_0xaa73('0x3e')](_0x29ba4c[_0xaa73('0x35')]['sort']);_0x3d9f24[_0xaa73('0x3f')]=qs[_0xaa73('0x37')](_[_0xaa73('0x40')](_0x29ba4c[_0xaa73('0x35')],_0x104ca1[_0xaa73('0x37')]),_0x4e2783);if(_0x29ba4c[_0xaa73('0x35')][_0xaa73('0x41')]){_0x3d9f24[_0xaa73('0x3f')]=_['merge'](_0x3d9f24[_0xaa73('0x3f')],{'$or':_[_0xaa73('0x2f')](_0x4e2783,function(_0x5850cc){if(_0x5850cc[_0xaa73('0x33')]!==_0xaa73('0x42')){var _0x5e28a2={};_0x5e28a2[_0x5850cc[_0xaa73('0x43')]]={'$like':'%'+_0x29ba4c['query'][_0xaa73('0x41')]+'%'};return _0x5e28a2;}})});}_0x3d9f24=_['merge']({},_0x3d9f24,_0x29ba4c[_0xaa73('0x44')]);var _0x35a4df={'where':_0x3d9f24[_0xaa73('0x3f')]};return db[_0xaa73('0x30')]['count'](_0x35a4df)[_0xaa73('0x27')](function(_0x55a95b){_0x1e59e2[_0xaa73('0x20')]=_0x55a95b;if(_0x29ba4c[_0xaa73('0x35')][_0xaa73('0x45')]){_0x3d9f24[_0xaa73('0x46')]=[{'all':!![]}];}return db['SmsQueue'][_0xaa73('0x47')](_0x3d9f24);})[_0xaa73('0x27')](function(_0x26266b){_0x1e59e2[_0xaa73('0x48')]=_0x26266b;return _0x1e59e2;})['then'](respondWithFilteredResult(_0x5ba81c,_0x3d9f24))[_0xaa73('0x49')](handleError(_0x5ba81c,null));};exports['show']=function(_0x387035,_0x5eb0d6){var _0x1c6978={'raw':!![],'where':{'id':_0x387035[_0xaa73('0x4a')]['id']}},_0x43e1c4={};_0x43e1c4[_0xaa73('0x39')]=_[_0xaa73('0x36')](db['SmsQueue'][_0xaa73('0x31')]);_0x43e1c4[_0xaa73('0x35')]=_['keys'](_0x387035[_0xaa73('0x35')]);_0x43e1c4[_0xaa73('0x37')]=_['intersection'](_0x43e1c4['model'],_0x43e1c4[_0xaa73('0x35')]);_0x1c6978[_0xaa73('0x3a')]=_['intersection'](_0x43e1c4[_0xaa73('0x39')],qs[_0xaa73('0x3b')](_0x387035[_0xaa73('0x35')][_0xaa73('0x3b')]));_0x1c6978[_0xaa73('0x3a')]=_0x1c6978[_0xaa73('0x3a')][_0xaa73('0x4b')]?_0x1c6978[_0xaa73('0x3a')]:_0x43e1c4[_0xaa73('0x39')];if(_0x387035[_0xaa73('0x35')][_0xaa73('0x45')]){_0x1c6978[_0xaa73('0x46')]=[{'all':!![]}];}_0x1c6978=_[_0xaa73('0x4c')]({},_0x1c6978,_0x387035[_0xaa73('0x44')]);return db['SmsQueue']['find'](_0x1c6978)[_0xaa73('0x27')](handleEntityNotFound(_0x5eb0d6,null))[_0xaa73('0x27')](respondWithResult(_0x5eb0d6,null))[_0xaa73('0x49')](handleError(_0x5eb0d6,null));};exports[_0xaa73('0x4d')]=function(_0xd4b2cc,_0x1e50a7){return db[_0xaa73('0x30')][_0xaa73('0x4d')](_0xd4b2cc[_0xaa73('0x4e')],{})[_0xaa73('0x27')](function(_0x23762b){var _0x1764f2=_0xd4b2cc[_0xaa73('0x4f')][_0xaa73('0x28')]({'plain':!![]});if(!_0x1764f2)throw new Error(_0xaa73('0x50'));if(_0x1764f2[_0xaa73('0x51')]===_0xaa73('0x4f')){var _0x2d0e39=_0x23762b[_0xaa73('0x28')]({'plain':!![]});var _0x591634=_0xaa73('0x29');return db[_0xaa73('0x52')]['find']({'where':{'name':_0x591634,'userProfileId':_0x1764f2[_0xaa73('0x53')]},'raw':!![]})[_0xaa73('0x27')](function(_0x397064){if(_0x397064&&_0x397064[_0xaa73('0x54')]===0x0){return db[_0xaa73('0x55')][_0xaa73('0x4d')]({'name':_0x2d0e39['name'],'resourceId':_0x2d0e39['id'],'type':_0x397064[_0xaa73('0x43')],'sectionId':_0x397064['id']},{})['then'](function(){return _0x23762b;});}else{return _0x23762b;}})['catch'](function(_0xe047fd){logger['error'](_0xaa73('0x56'),_0xe047fd);throw _0xe047fd;});}return _0x23762b;})[_0xaa73('0x27')](respondWithResult(_0x1e50a7,0xc9))[_0xaa73('0x49')](handleError(_0x1e50a7,null));};exports['update']=function(_0x52f33e,_0x517b65){if(_0x52f33e[_0xaa73('0x4e')]['id']){delete _0x52f33e[_0xaa73('0x4e')]['id'];}return db[_0xaa73('0x30')][_0xaa73('0x57')]({'where':{'id':_0x52f33e[_0xaa73('0x4a')]['id']}})[_0xaa73('0x27')](handleEntityNotFound(_0x517b65,null))['then'](saveUpdates(_0x52f33e[_0xaa73('0x4e')],null))[_0xaa73('0x27')](respondWithResult(_0x517b65,null))[_0xaa73('0x49')](handleError(_0x517b65,null));};exports[_0xaa73('0x2a')]=function(_0x3eba73,_0x1b6730){return db['SmsQueue'][_0xaa73('0x57')]({'where':{'id':_0x3eba73[_0xaa73('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b6730,null))[_0xaa73('0x27')](removeEntity(_0x1b6730,null))[_0xaa73('0x49')](handleError(_0x1b6730,null));};exports[_0xaa73('0x58')]=function(_0x3dd2f1,_0x23cd82){return db['SmsQueue'][_0xaa73('0x58')]()[_0xaa73('0x27')](respondWithResult(_0x23cd82,null))[_0xaa73('0x49')](handleError(_0x23cd82,null));};exports['getMembers']=function(_0x2de70b,_0xb36da1,_0x2f8390){var _0x1b19a8={'raw':!![],'where':{}},_0x52323a={},_0x400013;return db[_0xaa73('0x30')][_0xaa73('0x59')]({'where':{'id':_0x2de70b[_0xaa73('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb36da1,null))[_0xaa73('0x27')](function(_0x30408c){if(_0x30408c){_0x400013=_0x30408c['get']({'plain':!![]});_0x52323a['model']=_[_0xaa73('0x36')](db['UserSmsQueue'][_0xaa73('0x31')]);_0x52323a[_0xaa73('0x35')]=_[_0xaa73('0x36')](_0x2de70b['query']);_0x52323a[_0xaa73('0x37')]=_[_0xaa73('0x38')](_0x52323a[_0xaa73('0x39')],_0x52323a[_0xaa73('0x35')]);_0x1b19a8[_0xaa73('0x3a')]=_[_0xaa73('0x38')](_0x52323a[_0xaa73('0x39')],qs[_0xaa73('0x3b')](_0x2de70b[_0xaa73('0x35')][_0xaa73('0x3b')]));_0x1b19a8['attributes']=_0x1b19a8[_0xaa73('0x3a')][_0xaa73('0x4b')]?_0x1b19a8[_0xaa73('0x3a')]:_0x52323a['model'];if(!_0x2de70b[_0xaa73('0x35')]['hasOwnProperty']('nolimit')){_0x1b19a8[_0xaa73('0x1f')]=qs[_0xaa73('0x1f')](_0x2de70b[_0xaa73('0x35')][_0xaa73('0x1f')]);_0x1b19a8[_0xaa73('0x1d')]=qs[_0xaa73('0x1d')](_0x2de70b[_0xaa73('0x35')]['offset']);}_0x1b19a8[_0xaa73('0x3d')]=qs[_0xaa73('0x3e')](_0x2de70b[_0xaa73('0x35')][_0xaa73('0x3e')]);_0x1b19a8[_0xaa73('0x3f')]=qs[_0xaa73('0x37')](_[_0xaa73('0x40')](_0x2de70b[_0xaa73('0x35')],_0x52323a[_0xaa73('0x37')]));_0x1b19a8[_0xaa73('0x3f')]['SmsQueueId']=_0x30408c['id'];if(_0x2de70b['query'][_0xaa73('0x41')]){_0x1b19a8[_0xaa73('0x3f')]=_[_0xaa73('0x4c')](_0x1b19a8[_0xaa73('0x3f')],{'$or':_[_0xaa73('0x2f')](_0x1b19a8[_0xaa73('0x3a')],function(_0x340596){var _0x43a7e4={};_0x43a7e4[_0x340596]={'$like':'%'+_0x2de70b[_0xaa73('0x35')][_0xaa73('0x41')]+'%'};return _0x43a7e4;})});}_0x1b19a8=_[_0xaa73('0x4c')]({},_0x1b19a8,_0x2de70b[_0xaa73('0x44')]);return db['UserSmsQueue'][_0xaa73('0x47')](_0x1b19a8);}})[_0xaa73('0x27')](function(_0x443841){if(_0x443841){return db[_0xaa73('0x5a')][_0xaa73('0x5b')]({'where':{'id':_[_0xaa73('0x2f')](_0x443841,_0xaa73('0x5c')),'role':_0xaa73('0x5d')},'attributes':['id',_0xaa73('0x43'),_0xaa73('0x5e'),_0xaa73('0x5f'),_0xaa73('0x60')]});}})[_0xaa73('0x27')](function(_0x24ee38){if(_0x24ee38){return{'count':_0x24ee38[_0xaa73('0x20')],'rows':_[_0xaa73('0x2f')](_0x24ee38[_0xaa73('0x48')],function(_0x4fd963){return{'membername':_0x4fd963[_0xaa73('0x43')],'UserId':_0x4fd963['id'],'queue_name':_0x400013[_0xaa73('0x43')],'SmsQueueId':_0x400013['id'],'interface':util['format'](_0xaa73('0x61'),_0xaa73('0x62'),_0x4fd963[_0xaa73('0x43')]),'penalty':0x0,'paused':_0x4fd963['smsPause'],'createdAt':_0x4fd963['createdAt'],'updatedAt':_0x4fd963[_0xaa73('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa73('0x27')](respondWithFilteredResult(_0xb36da1,_0x1b19a8))[_0xaa73('0x49')](handleError(_0xb36da1,null));};exports[_0xaa73('0x63')]=function(_0x5943df,_0x5819b9,_0x3e5376){var _0x285733={};var _0x415a09={};var _0x528cfe;var _0x3c1cd7;return db[_0xaa73('0x30')][_0xaa73('0x59')]({'where':{'id':_0x5943df[_0xaa73('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5819b9,null))['then'](function(_0x43f578){if(_0x43f578){_0x528cfe=_0x43f578;_0x415a09[_0xaa73('0x39')]=_['keys'](db[_0xaa73('0x64')]['rawAttributes']);_0x415a09[_0xaa73('0x35')]=_[_0xaa73('0x36')](_0x5943df['query']);_0x415a09['filters']=_[_0xaa73('0x38')](_0x415a09['model'],_0x415a09[_0xaa73('0x35')]);_0x285733[_0xaa73('0x3a')]=_[_0xaa73('0x38')](_0x415a09[_0xaa73('0x39')],qs[_0xaa73('0x3b')](_0x5943df['query'][_0xaa73('0x3b')]));_0x285733[_0xaa73('0x3a')]=_0x285733[_0xaa73('0x3a')]['length']?_0x285733[_0xaa73('0x3a')]:_0x415a09['model'];_0x285733[_0xaa73('0x3d')]=qs['sort'](_0x5943df[_0xaa73('0x35')]['sort']);_0x285733[_0xaa73('0x3f')]=qs['filters'](_[_0xaa73('0x40')](_0x5943df[_0xaa73('0x35')],_0x415a09[_0xaa73('0x37')]));if(_0x5943df['query'][_0xaa73('0x41')]){_0x285733[_0xaa73('0x3f')]=_['merge'](_0x285733['where'],{'$or':_[_0xaa73('0x2f')](_0x285733['attributes'],function(_0x474381){var _0x2d6271={};_0x2d6271[_0x474381]={'$like':'%'+_0x5943df[_0xaa73('0x35')][_0xaa73('0x41')]+'%'};return _0x2d6271;})});}_0x285733=_[_0xaa73('0x4c')]({},_0x285733,_0x5943df[_0xaa73('0x44')]);return _0x528cfe[_0xaa73('0x63')](_0x285733);}})['then'](function(_0xf6d1c9){if(_0xf6d1c9){_0x3c1cd7=_0xf6d1c9['length'];if(!_0x5943df[_0xaa73('0x35')][_0xaa73('0x3c')]('nolimit')){_0x285733[_0xaa73('0x1f')]=qs['limit'](_0x5943df[_0xaa73('0x35')][_0xaa73('0x1f')]);_0x285733['offset']=qs[_0xaa73('0x1d')](_0x5943df[_0xaa73('0x35')][_0xaa73('0x1d')]);}return _0x528cfe[_0xaa73('0x63')](_0x285733);}})[_0xaa73('0x27')](function(_0x418ef4){if(_0x418ef4){return _0x418ef4?{'count':_0x3c1cd7,'rows':_0x418ef4}:null;}})[_0xaa73('0x27')](respondWithResult(_0x5819b9,null))[_0xaa73('0x49')](handleError(_0x5819b9,null));};exports[_0xaa73('0x65')]=function(_0x1890e9,_0x7ca606,_0x404ec5){var _0x127710=_0x1890e9[_0xaa73('0x4e')][_0xaa73('0x66')];return db['Team'][_0xaa73('0x47')]({'where':{'id':_0x127710},'attributes':['id'],'include':[{'model':db[_0xaa73('0x5a')],'as':_0xaa73('0x67'),'attributes':['id',_0xaa73('0x43'),'online',_0xaa73('0x68'),'interface'],'raw':!![]}]})[_0xaa73('0x27')](function(_0x2fd4d7){if(_0x2fd4d7){var _0x2558c9=_[_0xaa73('0x69')](_0x2fd4d7,function(_0x52f932){var _0x1ea7e0=_0x52f932[_0xaa73('0x28')]({'plain':!![]});return _0x1ea7e0['Agents'];});return db[_0xaa73('0x30')][_0xaa73('0x57')]({'where':{'id':_0x1890e9[_0xaa73('0x4a')]['id']}})[_0xaa73('0x27')](function(_0x2ecbec){return db[_0xaa73('0x6a')][_0xaa73('0x6b')](function(_0x1a3c12){return _0x2ecbec['addTeams'](_0x127710,{'transaction':_0x1a3c12})[_0xaa73('0x27')](function(){return BPromise[_0xaa73('0x6c')](_0x2558c9,function(_0x4a7b78){return db[_0xaa73('0x6d')]['findOrCreate']({'where':{'UserId':_0x4a7b78['id'],'SmsQueueId':_0x1890e9[_0xaa73('0x4a')]['id']},'transaction':_0x1a3c12});});})[_0xaa73('0x27')](function(){_0x2558c9[_0xaa73('0x6e')](function(_0xfa550a){socket['emit']('userSmsQueue:save',{'UserId':_0xfa550a['id'],'SmsQueueId':_0x2ecbec['id']});});});});});}})['then'](respondWithStatusCode(_0x7ca606,null))['catch'](handleError(_0x7ca606,null));};exports['removeTeams']=function(_0x1b294e,_0x5227f9,_0x413201){return db[_0xaa73('0x64')][_0xaa73('0x47')]({'where':{'id':_0x1b294e[_0xaa73('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xaa73('0x5a')],'as':_0xaa73('0x67'),'attributes':['id'],'raw':!![]}]})[_0xaa73('0x27')](handleEntityNotFound(_0x5227f9,null))[_0xaa73('0x27')](function(_0x5efb0e){var _0x29213c=_[_0xaa73('0x2f')](_0x5efb0e,'id');var _0x5077f1=[];var _0x20a2da=[];var _0x215130=squel[_0xaa73('0x6f')]();_0x215130[_0xaa73('0x70')](_0xaa73('0x71'))[_0xaa73('0x72')](_0xaa73('0x73'),'tq')[_0xaa73('0x74')](_0xaa73('0x75'),'ut',_0xaa73('0x76'))[_0xaa73('0x3f')](_0xaa73('0x77'),_0x1b294e[_0xaa73('0x4a')]['id']);for(var _0x35e7aa=0x0;_0x35e7aa<_0x5efb0e[_0xaa73('0x4b')];_0x35e7aa+=0x1){let _0x583d61=_0x5efb0e[_0x35e7aa];for(var _0x705344=0x0;_0x705344<_0x583d61[_0xaa73('0x67')]['length'];_0x705344+=0x1){let _0xa4271=_0x583d61['Agents'][_0x705344];var _0x371d12=_0x215130[_0xaa73('0x78')]();_0x371d12[_0xaa73('0x3f')](_0xaa73('0x79'),_0xa4271['id']);_0x20a2da['push'](db['sequelize'][_0xaa73('0x35')](_0x371d12[_0xaa73('0x7a')](),{'type':db[_0xaa73('0x6a')][_0xaa73('0x7b')][_0xaa73('0x7c')]})[_0xaa73('0x27')](function(_0x4585a8){if(_0x4585a8[_0xaa73('0x4b')]===0x1){return _0xa4271['id'];}else{var _0x1a946b=_[_0xaa73('0x7d')](_[_0xaa73('0x2f')](_0x4585a8,_0xaa73('0x7e')),function(_0x23326e){return _[_0xaa73('0x7f')](_0x29213c,_0x23326e);});if(_0x1a946b){return _0xa4271['id'];}}}));}}return BPromise[_0xaa73('0x80')](_0x20a2da)[_0xaa73('0x27')](function(_0x1efa41){_0x5077f1=_(_0x5077f1)[_0xaa73('0x81')](_0x1efa41)[_0xaa73('0x82')]()[_0xaa73('0x83')]();return db['SmsQueue'][_0xaa73('0x57')]({'where':{'id':_0x1b294e[_0xaa73('0x4a')]['id']}})[_0xaa73('0x27')](function(_0x3e2d39){return db[_0xaa73('0x6a')][_0xaa73('0x6b')](function(_0x4bfa0e){return _0x3e2d39['removeTeams'](_0x1b294e[_0xaa73('0x35')][_0xaa73('0x66')],{'transaction':_0x4bfa0e})['then'](function(){if(!_['isEmpty'](_0x5077f1)){return _0x3e2d39['removeAgents'](_0x5077f1,{'transaction':_0x4bfa0e});}})['then'](function(){_0x5077f1[_0xaa73('0x6e')](function(_0x4ce984){socket[_0xaa73('0x84')](_0xaa73('0x85'),{'UserId':_0x4ce984,'SmsQueueId':_0x3e2d39['id']});});});});});});})[_0xaa73('0x27')](respondWithStatusCode(_0x5227f9,null))['catch'](handleError(_0x5227f9,null));};exports[_0xaa73('0x86')]=function(_0x376f2c,_0x43d52f,_0x28c5ac){return db['SmsQueue'][_0xaa73('0x57')]({'where':{'id':_0x376f2c['params']['id']}})[_0xaa73('0x27')](handleEntityNotFound(_0x43d52f,null))[_0xaa73('0x27')](function(_0x2ad69d){if(_0x2ad69d){return _0x2ad69d[_0xaa73('0x86')](_0x376f2c[_0xaa73('0x4e')][_0xaa73('0x66')],_[_0xaa73('0x87')](_0x376f2c['body'],[_0xaa73('0x66'),'id'])||{})[_0xaa73('0x88')](function(_0x5217ed){for(var _0x5eba8e=0x0;_0x5eba8e<_0x376f2c['body'][_0xaa73('0x66')][_0xaa73('0x4b')];_0x5eba8e+=0x1){socket[_0xaa73('0x84')](_0xaa73('0x89'),{'UserId':Number(_0x376f2c['body'][_0xaa73('0x66')][_0x5eba8e]),'SmsQueueId':Number(_0x376f2c['params']['id'])});}return _0x5217ed;});}})[_0xaa73('0x27')](respondWithResult(_0x43d52f,null))[_0xaa73('0x49')](handleError(_0x43d52f,null));};exports[_0xaa73('0x8a')]=function(_0xb18925,_0x478126,_0x22efcd){return db[_0xaa73('0x30')][_0xaa73('0x57')]({'where':{'id':_0xb18925[_0xaa73('0x4a')]['id']}})[_0xaa73('0x27')](handleEntityNotFound(_0x478126,null))[_0xaa73('0x27')](function(_0x450af9){if(_0x450af9){return _0x450af9[_0xaa73('0x8a')](_0xb18925['query'][_0xaa73('0x66')])['then'](function(){if(_[_0xaa73('0x8b')](_0xb18925['query'][_0xaa73('0x66')])){for(var _0x5221cd=0x0;_0x5221cd<_0xb18925['query'][_0xaa73('0x66')][_0xaa73('0x4b')];_0x5221cd+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0xb18925[_0xaa73('0x35')][_0xaa73('0x66')][_0x5221cd]),'SmsQueueId':Number(_0xb18925[_0xaa73('0x4a')]['id'])});}}else{socket[_0xaa73('0x84')](_0xaa73('0x85'),{'UserId':Number(_0xb18925[_0xaa73('0x35')][_0xaa73('0x66')]),'SmsQueueId':Number(_0xb18925[_0xaa73('0x4a')]['id'])});}});}})[_0xaa73('0x27')](respondWithStatusCode(_0x478126,null))[_0xaa73('0x49')](handleError(_0x478126,null));};exports['getAgents']=function(_0x3e86b5,_0x19b040,_0x131824){var _0x4ab32b={};var _0x4b6a1f={};var _0x15d0ca;var _0x16c8ff;return db['SmsQueue'][_0xaa73('0x59')]({'where':{'id':_0x3e86b5[_0xaa73('0x4a')]['id']}})[_0xaa73('0x27')](handleEntityNotFound(_0x19b040,null))[_0xaa73('0x27')](function(_0x26ec15){if(_0x26ec15){_0x15d0ca=_0x26ec15;_0x4b6a1f[_0xaa73('0x39')]=_[_0xaa73('0x36')](db[_0xaa73('0x5a')][_0xaa73('0x31')]);_0x4b6a1f[_0xaa73('0x35')]=_['keys'](_0x3e86b5[_0xaa73('0x35')]);_0x4b6a1f[_0xaa73('0x37')]=_[_0xaa73('0x38')](_0x4b6a1f[_0xaa73('0x39')],_0x4b6a1f[_0xaa73('0x35')]);_0x4ab32b[_0xaa73('0x3a')]=_[_0xaa73('0x38')](_0x4b6a1f[_0xaa73('0x39')],qs[_0xaa73('0x3b')](_0x3e86b5[_0xaa73('0x35')][_0xaa73('0x3b')]));_0x4ab32b['attributes']=_0x4ab32b[_0xaa73('0x3a')][_0xaa73('0x4b')]?_0x4ab32b[_0xaa73('0x3a')]:_0x4b6a1f[_0xaa73('0x39')];_0x4ab32b[_0xaa73('0x3d')]=qs[_0xaa73('0x3e')](_0x3e86b5[_0xaa73('0x35')][_0xaa73('0x3e')]);_0x4ab32b[_0xaa73('0x3f')]=qs[_0xaa73('0x37')](_['pick'](_0x3e86b5[_0xaa73('0x35')],_0x4b6a1f[_0xaa73('0x37')]));if(_0x3e86b5['query'][_0xaa73('0x41')]){_0x4ab32b[_0xaa73('0x3f')]=_[_0xaa73('0x4c')](_0x4ab32b[_0xaa73('0x3f')],{'$or':_[_0xaa73('0x2f')](_0x4ab32b[_0xaa73('0x3a')],function(_0x7982ec){var _0x4baaf9={};_0x4baaf9[_0x7982ec]={'$like':'%'+_0x3e86b5[_0xaa73('0x35')][_0xaa73('0x41')]+'%'};return _0x4baaf9;})});}_0x4ab32b=_[_0xaa73('0x4c')]({},_0x4ab32b,_0x3e86b5['options']);return _0x15d0ca[_0xaa73('0x8c')](_0x4ab32b);}})['then'](function(_0x121522){if(_0x121522){_0x16c8ff=_0x121522[_0xaa73('0x4b')];if(!_0x3e86b5[_0xaa73('0x35')][_0xaa73('0x3c')]('nolimit')){_0x4ab32b['limit']=qs[_0xaa73('0x1f')](_0x3e86b5['query'][_0xaa73('0x1f')]);_0x4ab32b['offset']=qs['offset'](_0x3e86b5[_0xaa73('0x35')][_0xaa73('0x1d')]);}return _0x15d0ca[_0xaa73('0x8c')](_0x4ab32b);}})[_0xaa73('0x27')](function(_0x2581de){if(_0x2581de){return _0x2581de?{'count':_0x16c8ff,'rows':_0x2581de}:null;}})['then'](respondWithResult(_0x19b040,null))[_0xaa73('0x49')](handleError(_0x19b040,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b0c2d1d..cf09b3a 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 _0x7a3a=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue'];(function(_0x58d54b,_0x2fec3b){var _0xdfadef=function(_0x4e218e){while(--_0x4e218e){_0x58d54b['push'](_0x58d54b['shift']());}};_0xdfadef(++_0x2fec3b);}(_0x7a3a,0x1b6));var _0xa7a3=function(_0x2bac10,_0x486fe6){_0x2bac10=_0x2bac10-0x0;var _0x38096f=_0x7a3a[_0x2bac10];return _0x38096f;};'use strict';var EventEmitter=require(_0xa7a3('0x0'));var SmsQueue=require(_0xa7a3('0x1'))['db'][_0xa7a3('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7a3('0x3'),'afterUpdate':_0xa7a3('0x4'),'afterDestroy':_0xa7a3('0x5')};function emitEvent(_0x105e14){return function(_0x2f7a41,_0x2abfe6,_0x3f115a){SmsQueueEvents[_0xa7a3('0x6')](_0x105e14+':'+_0x2f7a41['id'],_0x2f7a41);SmsQueueEvents['emit'](_0x105e14,_0x2f7a41);_0x3f115a(null);};}for(var e in events){if(events[_0xa7a3('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xa7a3('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x3c87=['exports','events','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5d9f37,_0x242afa){var _0x423f72=function(_0x3e2f87){while(--_0x3e2f87){_0x5d9f37['push'](_0x5d9f37['shift']());}};_0x423f72(++_0x242afa);}(_0x3c87,0xb5));var _0x73c8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3c87[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x73c8('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x73c8('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x73c8('0x2')](0x0);var events={'afterCreate':_0x73c8('0x3'),'afterUpdate':_0x73c8('0x4'),'afterDestroy':_0x73c8('0x5')};function emitEvent(_0x12c1e6){return function(_0x155019,_0x2342f8,_0x10bfc3){SmsQueueEvents[_0x73c8('0x6')](_0x12c1e6+':'+_0x155019['id'],_0x155019);SmsQueueEvents['emit'](_0x12c1e6,_0x155019);_0x10bfc3(null);};}for(var e in events){if(events[_0x73c8('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x73c8('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 8c04bd9..ba1286c 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 _0x6db8=['request-promise','rimraf','./smsQueue.attributes','exports','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x286d45,_0x19f78d){var _0x32fc79=function(_0x59fe8d){while(--_0x59fe8d){_0x286d45['push'](_0x286d45['shift']());}};_0x32fc79(++_0x19f78d);}(_0x6db8,0x1d3));var _0x86db=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x6db8[_0x204eb7];return _0x37e444;};'use strict';var _=require(_0x86db('0x0'));var util=require(_0x86db('0x1'));var logger=require(_0x86db('0x2'))(_0x86db('0x3'));var moment=require(_0x86db('0x4'));var BPromise=require(_0x86db('0x5'));var rp=require(_0x86db('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86db('0x7'));var config=require('../../config/environment');var attributes=require(_0x86db('0x8'));module[_0x86db('0x9')]=function(_0x3f09db,_0x1f2e74){return _0x3f09db['define']('SmsQueue',attributes,{'tableName':_0x86db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb49b=['SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x4f200b,_0x5ebf20){var _0x401d11=function(_0x549005){while(--_0x549005){_0x4f200b['push'](_0x4f200b['shift']());}};_0x401d11(++_0x5ebf20);}(_0xb49b,0x1ba));var _0xbb49=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb49b[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xbb49('0x0'));var logger=require(_0xbb49('0x1'))(_0xbb49('0x2'));var moment=require(_0xbb49('0x3'));var BPromise=require(_0xbb49('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbb49('0x5'));var config=require(_0xbb49('0x6'));var attributes=require(_0xbb49('0x7'));module[_0xbb49('0x8')]=function(_0x566dfd,_0x5f441e){return _0x566dfd['define'](_0xbb49('0x9'),attributes,{'tableName':_0xbb49('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 2d53fc6..2bd86e5 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 _0x7a05=['SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','attributes','include','map','model','ShowSmsQueue','SmsQueue','find','info','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','SmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x50a81a,_0x41a480){var _0x2874bf=function(_0x2a7022){while(--_0x2a7022){_0x50a81a['push'](_0x50a81a['shift']());}};_0x2874bf(++_0x41a480);}(_0x7a05,0xdc));var _0x57a0=function(_0x480bbd,_0x2a2f7b){_0x480bbd=_0x480bbd-0x0;var _0x2e36de=_0x7a05[_0x480bbd];return _0x2e36de;};'use strict';var _=require(_0x57a0('0x0'));var util=require(_0x57a0('0x1'));var moment=require('moment');var BPromise=require(_0x57a0('0x2'));var rs=require(_0x57a0('0x3'));var fs=require('fs');var Redis=require(_0x57a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x57a0('0x5'));var logger=require(_0x57a0('0x6'))(_0x57a0('0x7'));var config=require(_0x57a0('0x8'));var jayson=require(_0x57a0('0x9'));var client=jayson[_0x57a0('0xa')][_0x57a0('0xb')]({'port':0x232a});config[_0x57a0('0xc')]=_[_0x57a0('0xd')](config[_0x57a0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x57a0('0xe'))(new Redis(config[_0x57a0('0xc')]));require(_0x57a0('0xf'))[_0x57a0('0x10')](socket);function respondWithRpcPromise(_0x4d0deb,_0x3930b7,_0x36fae2){return new BPromise(function(_0x4c0222,_0x4579b9){return client['request'](_0x4d0deb,_0x36fae2)['then'](function(_0xa27211){logger['info'](_0x57a0('0x11'),_0x3930b7,_0x57a0('0x12'));logger[_0x57a0('0x13')](_0x57a0('0x14'),_0x3930b7,'request\x20sent',JSON[_0x57a0('0x15')](_0xa27211));if(_0xa27211[_0x57a0('0x16')]){if(_0xa27211[_0x57a0('0x16')]['code']===0x1f4){logger[_0x57a0('0x16')](_0x57a0('0x11'),_0x3930b7,_0xa27211[_0x57a0('0x16')][_0x57a0('0x17')]);return _0x4579b9(_0xa27211[_0x57a0('0x16')][_0x57a0('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x3930b7,_0xa27211[_0x57a0('0x16')][_0x57a0('0x17')]);return _0x4c0222(_0xa27211['error'][_0x57a0('0x17')]);}else{logger['info'](_0x57a0('0x11'),_0x3930b7,'request\x20sent');_0x4c0222(_0xa27211[_0x57a0('0x18')][_0x57a0('0x17')]);}})[_0x57a0('0x19')](function(_0x392338){logger[_0x57a0('0x16')](_0x57a0('0x11'),_0x3930b7,_0x392338);_0x4579b9(_0x392338);});});}exports[_0x57a0('0x1a')]=function(_0x3f58cd){var _0x17fc12=this;return new Promise(function(_0x2e9247,_0x5859da){return db['SmsQueue'][_0x57a0('0x1b')]({'raw':_0x3f58cd['options']?_0x3f58cd[_0x57a0('0x1c')][_0x57a0('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f58cd[_0x57a0('0x1c')]?_0x3f58cd[_0x57a0('0x1c')][_0x57a0('0x1e')]||null:null,'attributes':_0x3f58cd[_0x57a0('0x1c')]?_0x3f58cd[_0x57a0('0x1c')]['attributes']||null:null,'limit':_0x3f58cd[_0x57a0('0x1c')]?_0x3f58cd['options'][_0x57a0('0x1f')]||null:null,'include':_0x3f58cd[_0x57a0('0x1c')]?_0x3f58cd[_0x57a0('0x1c')]['include']?_['map'](_0x3f58cd['options']['include'],function(_0x232501){return{'model':db[_0x232501['model']],'as':_0x232501['as'],'attributes':_0x232501[_0x57a0('0x20')],'include':_0x232501[_0x57a0('0x21')]?_[_0x57a0('0x22')](_0x232501[_0x57a0('0x21')],function(_0xf716f){return{'model':db[_0xf716f['model']],'as':_0xf716f['as'],'attributes':_0xf716f[_0x57a0('0x20')],'include':_0xf716f[_0x57a0('0x21')]?_['map'](_0xf716f[_0x57a0('0x21')],function(_0xbca61f){return{'model':db[_0xbca61f[_0x57a0('0x23')]],'as':_0xbca61f['as'],'attributes':_0xbca61f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fb567){logger['info'](_0x57a0('0x1a'),_0x3f58cd);logger[_0x57a0('0x13')]('GetSmsQueue',_0x3f58cd,JSON['stringify'](_0x3fb567));_0x2e9247(_0x3fb567);})[_0x57a0('0x19')](function(_0x2edb94){logger[_0x57a0('0x16')](_0x57a0('0x1a'),_0x2edb94[_0x57a0('0x17')],_0x3f58cd);_0x5859da(_0x17fc12[_0x57a0('0x16')](0x1f4,_0x2edb94['message']));});});};exports[_0x57a0('0x24')]=function(_0x1fea9c){var _0xed9923=this;return new Promise(function(_0x56148c,_0x1476f3){return db[_0x57a0('0x25')][_0x57a0('0x26')]({'raw':_0x1fea9c['options']?_0x1fea9c[_0x57a0('0x1c')][_0x57a0('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fea9c[_0x57a0('0x1c')]?_0x1fea9c[_0x57a0('0x1c')]['where']||null:null,'attributes':_0x1fea9c[_0x57a0('0x1c')]?_0x1fea9c[_0x57a0('0x1c')]['attributes']||null:null,'include':_0x1fea9c['options']?_0x1fea9c['options'][_0x57a0('0x21')]?_[_0x57a0('0x22')](_0x1fea9c[_0x57a0('0x1c')][_0x57a0('0x21')],function(_0x531f61){return{'model':db[_0x531f61[_0x57a0('0x23')]],'as':_0x531f61['as'],'attributes':_0x531f61[_0x57a0('0x20')],'include':_0x531f61[_0x57a0('0x21')]?_['map'](_0x531f61[_0x57a0('0x21')],function(_0x58b693){return{'model':db[_0x58b693[_0x57a0('0x23')]],'as':_0x58b693['as'],'attributes':_0x58b693[_0x57a0('0x20')],'include':_0x58b693['include']?_['map'](_0x58b693[_0x57a0('0x21')],function(_0x35dd97){return{'model':db[_0x35dd97[_0x57a0('0x23')]],'as':_0x35dd97['as'],'attributes':_0x35dd97['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c766b){logger[_0x57a0('0x27')]('ShowSmsQueue',_0x1fea9c);logger[_0x57a0('0x13')](_0x57a0('0x24'),_0x1fea9c,JSON['stringify'](_0x5c766b));_0x56148c(_0x5c766b);})[_0x57a0('0x19')](function(_0x618e1c){logger[_0x57a0('0x16')]('ShowSmsQueue',_0x618e1c[_0x57a0('0x17')],_0x1fea9c);_0x1476f3(_0xed9923[_0x57a0('0x16')](0x1f4,_0x618e1c[_0x57a0('0x17')]));});});}; \ No newline at end of file +var _0xc452=['GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','ShowSmsQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xb2e4c2,_0x3834e5){var _0x22438b=function(_0x286bed){while(--_0x286bed){_0xb2e4c2['push'](_0xb2e4c2['shift']());}};_0x22438b(++_0x3834e5);}(_0xc452,0xd7));var _0x2c45=function(_0x5c31f3,_0x4fbc37){_0x5c31f3=_0x5c31f3-0x0;var _0x2e8166=_0xc452[_0x5c31f3];return _0x2e8166;};'use strict';var _=require(_0x2c45('0x0'));var util=require(_0x2c45('0x1'));var moment=require(_0x2c45('0x2'));var BPromise=require(_0x2c45('0x3'));var rs=require(_0x2c45('0x4'));var fs=require('fs');var Redis=require(_0x2c45('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c45('0x6'))(_0x2c45('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c45('0x8'));var client=jayson[_0x2c45('0x9')]['http']({'port':0x232a});config[_0x2c45('0xa')]=_[_0x2c45('0xb')](config[_0x2c45('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c45('0xc'))(new Redis(config[_0x2c45('0xa')]));require(_0x2c45('0xd'))[_0x2c45('0xe')](socket);function respondWithRpcPromise(_0x2dd269,_0x16c7a8,_0x1b57bb){return new BPromise(function(_0x27f818,_0x9fabd2){return client[_0x2c45('0xf')](_0x2dd269,_0x1b57bb)['then'](function(_0x35442f){logger[_0x2c45('0x10')](_0x2c45('0x11'),_0x16c7a8,_0x2c45('0x12'));logger['debug'](_0x2c45('0x13'),_0x16c7a8,_0x2c45('0x12'),JSON[_0x2c45('0x14')](_0x35442f));if(_0x35442f[_0x2c45('0x15')]){if(_0x35442f[_0x2c45('0x15')][_0x2c45('0x16')]===0x1f4){logger[_0x2c45('0x15')]('SmsQueue,\x20%s,\x20%s',_0x16c7a8,_0x35442f['error'][_0x2c45('0x17')]);return _0x9fabd2(_0x35442f[_0x2c45('0x15')][_0x2c45('0x17')]);}logger[_0x2c45('0x15')](_0x2c45('0x11'),_0x16c7a8,_0x35442f[_0x2c45('0x15')]['message']);return _0x27f818(_0x35442f['error']['message']);}else{logger[_0x2c45('0x10')](_0x2c45('0x11'),_0x16c7a8,_0x2c45('0x12'));_0x27f818(_0x35442f[_0x2c45('0x18')]['message']);}})['catch'](function(_0x3d978b){logger[_0x2c45('0x15')]('SmsQueue,\x20%s,\x20%s',_0x16c7a8,_0x3d978b);_0x9fabd2(_0x3d978b);});});}exports[_0x2c45('0x19')]=function(_0x4c6a61){var _0xe2d646=this;return new Promise(function(_0x3b29de,_0x480755){return db[_0x2c45('0x1a')][_0x2c45('0x1b')]({'raw':_0x4c6a61[_0x2c45('0x1c')]?_0x4c6a61[_0x2c45('0x1c')][_0x2c45('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c6a61['options']?_0x4c6a61[_0x2c45('0x1c')][_0x2c45('0x1e')]||null:null,'attributes':_0x4c6a61[_0x2c45('0x1c')]?_0x4c6a61[_0x2c45('0x1c')][_0x2c45('0x1f')]||null:null,'limit':_0x4c6a61[_0x2c45('0x1c')]?_0x4c6a61[_0x2c45('0x1c')][_0x2c45('0x20')]||null:null,'include':_0x4c6a61[_0x2c45('0x1c')]?_0x4c6a61['options']['include']?_[_0x2c45('0x21')](_0x4c6a61[_0x2c45('0x1c')][_0x2c45('0x22')],function(_0x4cce80){return{'model':db[_0x4cce80[_0x2c45('0x23')]],'as':_0x4cce80['as'],'attributes':_0x4cce80[_0x2c45('0x1f')],'include':_0x4cce80['include']?_['map'](_0x4cce80[_0x2c45('0x22')],function(_0xe9fe28){return{'model':db[_0xe9fe28[_0x2c45('0x23')]],'as':_0xe9fe28['as'],'attributes':_0xe9fe28[_0x2c45('0x1f')],'include':_0xe9fe28[_0x2c45('0x22')]?_['map'](_0xe9fe28['include'],function(_0x5df05a){return{'model':db[_0x5df05a[_0x2c45('0x23')]],'as':_0x5df05a['as'],'attributes':_0x5df05a[_0x2c45('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2c45('0x24')](function(_0x2bc899){logger[_0x2c45('0x10')](_0x2c45('0x19'),_0x4c6a61);logger[_0x2c45('0x25')](_0x2c45('0x19'),_0x4c6a61,JSON[_0x2c45('0x14')](_0x2bc899));_0x3b29de(_0x2bc899);})['catch'](function(_0x54ee32){logger[_0x2c45('0x15')](_0x2c45('0x19'),_0x54ee32['message'],_0x4c6a61);_0x480755(_0xe2d646[_0x2c45('0x15')](0x1f4,_0x54ee32[_0x2c45('0x17')]));});});};exports[_0x2c45('0x26')]=function(_0x376d38){var _0xf3143c=this;return new Promise(function(_0x4f6518,_0x506c98){return db[_0x2c45('0x1a')]['find']({'raw':_0x376d38[_0x2c45('0x1c')]?_0x376d38[_0x2c45('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x376d38[_0x2c45('0x1c')]?_0x376d38[_0x2c45('0x1c')][_0x2c45('0x1e')]||null:null,'attributes':_0x376d38[_0x2c45('0x1c')]?_0x376d38[_0x2c45('0x1c')]['attributes']||null:null,'include':_0x376d38[_0x2c45('0x1c')]?_0x376d38[_0x2c45('0x1c')][_0x2c45('0x22')]?_['map'](_0x376d38['options'][_0x2c45('0x22')],function(_0x3aeb01){return{'model':db[_0x3aeb01['model']],'as':_0x3aeb01['as'],'attributes':_0x3aeb01[_0x2c45('0x1f')],'include':_0x3aeb01[_0x2c45('0x22')]?_[_0x2c45('0x21')](_0x3aeb01[_0x2c45('0x22')],function(_0x3e5fae){return{'model':db[_0x3e5fae[_0x2c45('0x23')]],'as':_0x3e5fae['as'],'attributes':_0x3e5fae[_0x2c45('0x1f')],'include':_0x3e5fae[_0x2c45('0x22')]?_[_0x2c45('0x21')](_0x3e5fae['include'],function(_0xe7a7de){return{'model':db[_0xe7a7de['model']],'as':_0xe7a7de['as'],'attributes':_0xe7a7de['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c45('0x24')](function(_0x22a472){logger[_0x2c45('0x10')](_0x2c45('0x26'),_0x376d38);logger[_0x2c45('0x25')]('ShowSmsQueue',_0x376d38,JSON[_0x2c45('0x14')](_0x22a472));_0x4f6518(_0x22a472);})[_0x2c45('0x27')](function(_0x3b6906){logger[_0x2c45('0x15')]('ShowSmsQueue',_0x3b6906[_0x2c45('0x17')],_0x376d38);_0x506c98(_0xf3143c[_0x2c45('0x15')](0x1f4,_0x3b6906['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 6ef8cd9..8627b2a 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 _0x79f0=['remove','update','removeListener','register','length','save'];(function(_0x1ff7f9,_0x7f4e5d){var _0x42f261=function(_0xa4451a){while(--_0xa4451a){_0x1ff7f9['push'](_0x1ff7f9['shift']());}};_0x42f261(++_0x7f4e5d);}(_0x79f0,0x191));var _0x079f=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x79f0[_0x30ae5e];return _0x1f2e93;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x079f('0x0'),_0x079f('0x1'),_0x079f('0x2')];function createListener(_0x9256be,_0x2d99a7){return function(_0x4d2893){_0x2d99a7['emit'](_0x9256be,_0x4d2893);};}function removeListener(_0x30641b,_0x30a8d8){return function(){SmsQueueEvents[_0x079f('0x3')](_0x30641b,_0x30a8d8);};}exports[_0x079f('0x4')]=function(_0x32e35f){for(var _0x53807a=0x0,_0x272394=events[_0x079f('0x5')];_0x53807a<_0x272394;_0x53807a++){var _0x43c977=events[_0x53807a];var _0x5918ca=createListener('smsQueue:'+_0x43c977,_0x32e35f);SmsQueueEvents['on'](_0x43c977,_0x5918ca);}}; \ No newline at end of file +var _0xa850=['register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x2f793f,_0x22ad41){var _0x1e8fb1=function(_0x10e1a5){while(--_0x10e1a5){_0x2f793f['push'](_0x2f793f['shift']());}};_0x1e8fb1(++_0x22ad41);}(_0xa850,0x1d7));var _0x0a85=function(_0x585c06,_0x5f8836){_0x585c06=_0x585c06-0x0;var _0x5a91cd=_0xa850[_0x585c06];return _0x5a91cd;};'use strict';var SmsQueueEvents=require(_0x0a85('0x0'));var events=[_0x0a85('0x1'),_0x0a85('0x2'),'update'];function createListener(_0x285331,_0x549e1d){return function(_0x7be857){_0x549e1d['emit'](_0x285331,_0x7be857);};}function removeListener(_0x5c5247,_0x52e4b8){return function(){SmsQueueEvents['removeListener'](_0x5c5247,_0x52e4b8);};}exports[_0x0a85('0x3')]=function(_0x584f1c){for(var _0x766107=0x0,_0x3ef135=events[_0x0a85('0x4')];_0x766107<_0x3ef135;_0x766107++){var _0x507095=events[_0x766107];var _0x241669=createListener(_0x0a85('0x5')+_0x507095,_0x584f1c);SmsQueueEvents['on'](_0x507095,_0x241669);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5f88f09..9fe3787 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 _0x1987=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x533edb,_0x1d92dd){var _0x43eb93=function(_0x543445){while(--_0x543445){_0x533edb['push'](_0x533edb['shift']());}};_0x43eb93(++_0x1d92dd);}(_0x1987,0x1cd));var _0x7198=function(_0x597c69,_0x19032a){_0x597c69=_0x597c69-0x0;var _0x7aad9b=_0x1987[_0x597c69];return _0x7aad9b;};'use strict';var multer=require('multer');var util=require(_0x7198('0x0'));var path=require(_0x7198('0x1'));var timeout=require(_0x7198('0x2'));var express=require('express');var router=express[_0x7198('0x3')]();var fs_extra=require(_0x7198('0x4'));var auth=require(_0x7198('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7198('0x6'));var controller=require('./smsQueueReport.controller');router[_0x7198('0x7')]('/',auth[_0x7198('0x8')](),controller[_0x7198('0x9')]);router[_0x7198('0x7')](_0x7198('0xa'),auth[_0x7198('0x8')](),controller[_0x7198('0xb')]);router[_0x7198('0x7')](_0x7198('0xc'),auth[_0x7198('0x8')](),controller['show']);router[_0x7198('0xd')]('/',auth['isAuthenticated'](),controller[_0x7198('0xe')]);router[_0x7198('0xf')]('/:id',auth[_0x7198('0x8')](),controller[_0x7198('0x10')]);router[_0x7198('0x11')](_0x7198('0xc'),auth[_0x7198('0x8')](),controller[_0x7198('0x12')]);module[_0x7198('0x13')]=router; \ No newline at end of file +var _0x2c4d=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x2c4d,0x188));var _0xd2c4=function(_0x30c133,_0x20e3bd){_0x30c133=_0x30c133-0x0;var _0x38a446=_0x2c4d[_0x30c133];return _0x38a446;};'use strict';var multer=require(_0xd2c4('0x0'));var util=require('util');var path=require(_0xd2c4('0x1'));var timeout=require(_0xd2c4('0x2'));var express=require(_0xd2c4('0x3'));var router=express[_0xd2c4('0x4')]();var fs_extra=require(_0xd2c4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd2c4('0x6'));var config=require(_0xd2c4('0x7'));var controller=require('./smsQueueReport.controller');router[_0xd2c4('0x8')]('/',auth['isAuthenticated'](),controller[_0xd2c4('0x9')]);router[_0xd2c4('0x8')](_0xd2c4('0xa'),auth['isAuthenticated'](),controller[_0xd2c4('0xb')]);router['get'](_0xd2c4('0xc'),auth[_0xd2c4('0xd')](),controller[_0xd2c4('0xe')]);router[_0xd2c4('0xf')]('/',auth['isAuthenticated'](),controller[_0xd2c4('0x10')]);router[_0xd2c4('0x11')]('/:id',auth[_0xd2c4('0xd')](),controller[_0xd2c4('0x12')]);router[_0xd2c4('0x13')]('/:id',auth[_0xd2c4('0xd')](),controller[_0xd2c4('0x14')]);module[_0xd2c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 02c8494..a0ab6c2 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 _0xc33e=['exports','STRING','DATE','sequelize'];(function(_0x1ec836,_0x1ce2d6){var _0x4baf71=function(_0x5b640e){while(--_0x5b640e){_0x1ec836['push'](_0x1ec836['shift']());}};_0x4baf71(++_0x1ce2d6);}(_0xc33e,0x153));var _0xec33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc33e[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var Sequelize=require(_0xec33('0x0'));module[_0xec33('0x1')]={'uniqueid':{'type':Sequelize[_0xec33('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xec33('0x2')]},'joinAt':{'type':Sequelize[_0xec33('0x3')]},'leaveAt':{'type':Sequelize[_0xec33('0x3')]},'acceptAt':{'type':Sequelize[_0xec33('0x3')]},'exitAt':{'type':Sequelize[_0xec33('0x3')]},'reason':{'type':Sequelize[_0xec33('0x2')]}}; \ No newline at end of file +var _0xc9c6=['DATE','moment','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9c6,0x14d));var _0x6c9c=function(_0x412ae1,_0x20a4c4){_0x412ae1=_0x412ae1-0x0;var _0x50bea0=_0xc9c6[_0x412ae1];return _0x50bea0;};'use strict';var moment=require(_0x6c9c('0x0'));var Sequelize=require(_0x6c9c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6c9c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6c9c('0x2')]},'joinAt':{'type':Sequelize[_0x6c9c('0x3')]},'leaveAt':{'type':Sequelize[_0x6c9c('0x3')]},'acceptAt':{'type':Sequelize[_0x6c9c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2f62020..fb7588a 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 _0x0782=['keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes'];(function(_0x1e1ee9,_0x455248){var _0x5eb869=function(_0x59facf){while(--_0x59facf){_0x1e1ee9['push'](_0x1e1ee9['shift']());}};_0x5eb869(++_0x455248);}(_0x0782,0x1c2));var _0x2078=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x0782[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require(_0x2078('0x0'));var rimraf=require(_0x2078('0x1'));var zipdir=require(_0x2078('0x2'));var jsonpatch=require(_0x2078('0x3'));var rp=require('request-promise');var moment=require(_0x2078('0x4'));var BPromise=require(_0x2078('0x5'));var Mustache=require(_0x2078('0x6'));var util=require('util');var path=require(_0x2078('0x7'));var sox=require('sox');var csv=require(_0x2078('0x8'));var ejs=require(_0x2078('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2078('0xa'));var squel=require('squel');var crypto=require(_0x2078('0xb'));var jsforce=require(_0x2078('0xc'));var deskjs=require(_0x2078('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2078('0xe'));var Papa=require(_0x2078('0xf'));var Redis=require('ioredis');var authService=require(_0x2078('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2078('0x11'));var hardwareService=require(_0x2078('0x12'));var logger=require(_0x2078('0x13'))(_0x2078('0x14'));var utils=require('../../config/utils');var config=require(_0x2078('0x15'));var licenseUtil=require(_0x2078('0x16'));var db=require(_0x2078('0x17'))['db'];function respondWithStatusCode(_0x54e12d,_0x1394ab){_0x1394ab=_0x1394ab||0xcc;return function(_0x4688f3){if(_0x4688f3){return _0x54e12d[_0x2078('0x18')](_0x1394ab);}return _0x54e12d[_0x2078('0x19')](_0x1394ab)[_0x2078('0x1a')]();};}function respondWithResult(_0x593f64,_0x18c8fc){_0x18c8fc=_0x18c8fc||0xc8;return function(_0x2fdc47){if(_0x2fdc47){return _0x593f64[_0x2078('0x19')](_0x18c8fc)[_0x2078('0x1b')](_0x2fdc47);}};}function respondWithFilteredResult(_0xfb5b4c,_0x542f6c){return function(_0x4b456e){if(_0x4b456e){var _0xce1739=typeof _0x542f6c[_0x2078('0x1c')]===_0x2078('0x1d')&&typeof _0x542f6c[_0x2078('0x1e')]===_0x2078('0x1d');var _0x3de748=_0x4b456e[_0x2078('0x1f')];var _0x423411=_0xce1739?0x0:_0x542f6c[_0x2078('0x1c')];var _0x14c380=_0xce1739?_0x4b456e[_0x2078('0x1f')]:_0x542f6c['offset']+_0x542f6c[_0x2078('0x1e')];var _0x42ab06;if(_0x14c380>=_0x3de748){_0x14c380=_0x3de748;_0x42ab06=0xc8;}else{_0x42ab06=0xce;}_0xfb5b4c[_0x2078('0x19')](_0x42ab06);return _0xfb5b4c[_0x2078('0x20')](_0x2078('0x21'),_0x423411+'-'+_0x14c380+'/'+_0x3de748)[_0x2078('0x1b')](_0x4b456e);}return null;};}function patchUpdates(_0xdcb3d){return function(_0x4a492c){try{jsonpatch['apply'](_0x4a492c,_0xdcb3d,!![]);}catch(_0x177900){return BPromise[_0x2078('0x22')](_0x177900);}return _0x4a492c[_0x2078('0x23')]();};}function saveUpdates(_0x37ea6a,_0x89630b){return function(_0x45c89b){if(_0x45c89b){return _0x45c89b[_0x2078('0x24')](_0x37ea6a)[_0x2078('0x25')](function(_0x5419e9){return _0x5419e9;});}return null;};}function removeEntity(_0x53e709,_0xcc9365){return function(_0x5343bd){if(_0x5343bd){return _0x5343bd['destroy']()[_0x2078('0x25')](function(){_0x53e709[_0x2078('0x19')](0xcc)[_0x2078('0x1a')]();});}};}function handleEntityNotFound(_0x19bf1c,_0x4cd71f){return function(_0x157c54){if(!_0x157c54){_0x19bf1c[_0x2078('0x18')](0x194);}return _0x157c54;};}function handleError(_0x114314,_0x486e0e){_0x486e0e=_0x486e0e||0x1f4;return function(_0x2007f2){logger[_0x2078('0x26')](_0x2007f2[_0x2078('0x27')]);if(_0x2007f2[_0x2078('0x28')]){delete _0x2007f2[_0x2078('0x28')];}_0x114314[_0x2078('0x19')](_0x486e0e)[_0x2078('0x29')](_0x2007f2);};}exports[_0x2078('0x2a')]=function(_0x1c6090,_0x295ed6){var _0x1b6166={},_0x1eb3a3={},_0x3dd1b0={'count':0x0,'rows':[]};var _0x483791=_[_0x2078('0x2b')](db[_0x2078('0x2c')]['rawAttributes'],function(_0x4b3e99){return{'name':_0x4b3e99[_0x2078('0x2d')],'type':_0x4b3e99[_0x2078('0x2e')][_0x2078('0x2f')]};});_0x1eb3a3[_0x2078('0x30')]=_[_0x2078('0x2b')](_0x483791,'name');_0x1eb3a3[_0x2078('0x31')]=_['keys'](_0x1c6090['query']);_0x1eb3a3['filters']=_[_0x2078('0x32')](_0x1eb3a3['model'],_0x1eb3a3[_0x2078('0x31')]);_0x1b6166['attributes']=_[_0x2078('0x32')](_0x1eb3a3[_0x2078('0x30')],qs[_0x2078('0x33')](_0x1c6090[_0x2078('0x31')]['fields']));_0x1b6166['attributes']=_0x1b6166[_0x2078('0x34')][_0x2078('0x35')]?_0x1b6166[_0x2078('0x34')]:_0x1eb3a3['model'];if(!_0x1c6090[_0x2078('0x31')]['hasOwnProperty'](_0x2078('0x36'))){_0x1b6166['limit']=qs['limit'](_0x1c6090[_0x2078('0x31')]['limit']);_0x1b6166['offset']=qs['offset'](_0x1c6090[_0x2078('0x31')][_0x2078('0x1c')]);}_0x1b6166[_0x2078('0x37')]=qs[_0x2078('0x38')](_0x1c6090[_0x2078('0x31')][_0x2078('0x38')]);_0x1b6166[_0x2078('0x39')]=qs['filters'](_[_0x2078('0x3a')](_0x1c6090[_0x2078('0x31')],_0x1eb3a3['filters']),_0x483791);if(_0x1c6090[_0x2078('0x31')]['filter']){_0x1b6166['where']=_[_0x2078('0x3b')](_0x1b6166[_0x2078('0x39')],{'$or':_['map'](_0x483791,function(_0x4fa216){if(_0x4fa216['type']!=='VIRTUAL'){var _0xe74c22={};_0xe74c22[_0x4fa216[_0x2078('0x28')]]={'$like':'%'+_0x1c6090['query']['filter']+'%'};return _0xe74c22;}})});}_0x1b6166=_[_0x2078('0x3b')]({},_0x1b6166,_0x1c6090[_0x2078('0x3c')]);var _0x20318d={'where':_0x1b6166[_0x2078('0x39')]};return db[_0x2078('0x2c')][_0x2078('0x1f')](_0x20318d)['then'](function(_0x91e3d5){_0x3dd1b0['count']=_0x91e3d5;if(_0x1c6090['query'][_0x2078('0x3d')]){_0x1b6166['include']=[{'all':!![]}];}return db[_0x2078('0x2c')][_0x2078('0x3e')](_0x1b6166);})[_0x2078('0x25')](function(_0x325b88){_0x3dd1b0[_0x2078('0x3f')]=_0x325b88;return _0x3dd1b0;})[_0x2078('0x25')](respondWithFilteredResult(_0x295ed6,_0x1b6166))[_0x2078('0x40')](handleError(_0x295ed6,null));};exports[_0x2078('0x41')]=function(_0x36ea3f,_0x16c542){var _0x3a4d9a={'raw':!![],'where':{'id':_0x36ea3f[_0x2078('0x42')]['id']}},_0x3ae469={};_0x3ae469[_0x2078('0x30')]=_['keys'](db[_0x2078('0x2c')][_0x2078('0x43')]);_0x3ae469[_0x2078('0x31')]=_[_0x2078('0x44')](_0x36ea3f[_0x2078('0x31')]);_0x3ae469['filters']=_[_0x2078('0x32')](_0x3ae469['model'],_0x3ae469[_0x2078('0x31')]);_0x3a4d9a[_0x2078('0x34')]=_[_0x2078('0x32')](_0x3ae469['model'],qs['fields'](_0x36ea3f[_0x2078('0x31')][_0x2078('0x33')]));_0x3a4d9a['attributes']=_0x3a4d9a[_0x2078('0x34')][_0x2078('0x35')]?_0x3a4d9a[_0x2078('0x34')]:_0x3ae469[_0x2078('0x30')];if(_0x36ea3f[_0x2078('0x31')]['includeAll']){_0x3a4d9a[_0x2078('0x45')]=[{'all':!![]}];}_0x3a4d9a=_[_0x2078('0x3b')]({},_0x3a4d9a,_0x36ea3f['options']);return db['SmsQueueReport'][_0x2078('0x46')](_0x3a4d9a)[_0x2078('0x25')](handleEntityNotFound(_0x16c542,null))[_0x2078('0x25')](respondWithResult(_0x16c542,null))[_0x2078('0x40')](handleError(_0x16c542,null));};exports[_0x2078('0x47')]=function(_0x482e61,_0xa87cf7){return db[_0x2078('0x2c')][_0x2078('0x47')](_0x482e61['body'],{})[_0x2078('0x25')](respondWithResult(_0xa87cf7,0xc9))[_0x2078('0x40')](handleError(_0xa87cf7,null));};exports[_0x2078('0x24')]=function(_0x1583e9,_0x28a013){if(_0x1583e9['body']['id']){delete _0x1583e9[_0x2078('0x48')]['id'];}return db[_0x2078('0x2c')]['find']({'where':{'id':_0x1583e9[_0x2078('0x42')]['id']}})[_0x2078('0x25')](handleEntityNotFound(_0x28a013,null))['then'](saveUpdates(_0x1583e9['body'],null))['then'](respondWithResult(_0x28a013,null))['catch'](handleError(_0x28a013,null));};exports['destroy']=function(_0x2b67f6,_0x135067){return db['SmsQueueReport'][_0x2078('0x46')]({'where':{'id':_0x2b67f6[_0x2078('0x42')]['id']}})[_0x2078('0x25')](handleEntityNotFound(_0x135067,null))[_0x2078('0x25')](removeEntity(_0x135067,null))[_0x2078('0x40')](handleError(_0x135067,null));};exports[_0x2078('0x49')]=function(_0x237a9d,_0x26da7d){return db[_0x2078('0x2c')][_0x2078('0x49')]()[_0x2078('0x25')](respondWithResult(_0x26da7d,null))[_0x2078('0x40')](handleError(_0x26da7d,null));}; \ No newline at end of file +var _0x5695=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','rows','catch','params','includeAll','include','options','find','update','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5695,0x81));var _0x5569=function(_0x48043a,_0x2b99c1){_0x48043a=_0x48043a-0x0;var _0x7d92d2=_0x5695[_0x48043a];return _0x7d92d2;};'use strict';var emlformat=require(_0x5569('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5569('0x1'));var rp=require(_0x5569('0x2'));var moment=require(_0x5569('0x3'));var BPromise=require(_0x5569('0x4'));var Mustache=require(_0x5569('0x5'));var util=require(_0x5569('0x6'));var path=require(_0x5569('0x7'));var sox=require(_0x5569('0x8'));var csv=require(_0x5569('0x9'));var ejs=require(_0x5569('0xa'));var fs=require('fs');var fs_extra=require(_0x5569('0xb'));var _=require(_0x5569('0xc'));var squel=require(_0x5569('0xd'));var crypto=require('crypto');var jsforce=require(_0x5569('0xe'));var deskjs=require(_0x5569('0xf'));var toCsv=require(_0x5569('0x9'));var querystring=require(_0x5569('0x10'));var Papa=require('papaparse');var Redis=require(_0x5569('0x11'));var authService=require(_0x5569('0x12'));var qs=require(_0x5569('0x13'));var as=require(_0x5569('0x14'));var hardwareService=require(_0x5569('0x15'));var logger=require(_0x5569('0x16'))(_0x5569('0x17'));var utils=require(_0x5569('0x18'));var config=require(_0x5569('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5569('0x1a'))['db'];function respondWithStatusCode(_0x3ca319,_0x48e3a2){_0x48e3a2=_0x48e3a2||0xcc;return function(_0x54145a){if(_0x54145a){return _0x3ca319[_0x5569('0x1b')](_0x48e3a2);}return _0x3ca319[_0x5569('0x1c')](_0x48e3a2)[_0x5569('0x1d')]();};}function respondWithResult(_0x944980,_0x132cdc){_0x132cdc=_0x132cdc||0xc8;return function(_0xcc059b){if(_0xcc059b){return _0x944980[_0x5569('0x1c')](_0x132cdc)[_0x5569('0x1e')](_0xcc059b);}};}function respondWithFilteredResult(_0x5b7024,_0x1cabd8){return function(_0x34adf1){if(_0x34adf1){var _0xb5b1d6=typeof _0x1cabd8[_0x5569('0x1f')]===_0x5569('0x20')&&typeof _0x1cabd8[_0x5569('0x21')]==='undefined';var _0x5d70d0=_0x34adf1[_0x5569('0x22')];var _0x3a1ff4=_0xb5b1d6?0x0:_0x1cabd8[_0x5569('0x1f')];var _0x508c56=_0xb5b1d6?_0x34adf1[_0x5569('0x22')]:_0x1cabd8[_0x5569('0x1f')]+_0x1cabd8[_0x5569('0x21')];var _0x3c4783;if(_0x508c56>=_0x5d70d0){_0x508c56=_0x5d70d0;_0x3c4783=0xc8;}else{_0x3c4783=0xce;}_0x5b7024[_0x5569('0x1c')](_0x3c4783);return _0x5b7024[_0x5569('0x23')](_0x5569('0x24'),_0x3a1ff4+'-'+_0x508c56+'/'+_0x5d70d0)[_0x5569('0x1e')](_0x34adf1);}return null;};}function patchUpdates(_0x3cea57){return function(_0x14135d){try{jsonpatch[_0x5569('0x25')](_0x14135d,_0x3cea57,!![]);}catch(_0x34a6dd){return BPromise['reject'](_0x34a6dd);}return _0x14135d[_0x5569('0x26')]();};}function saveUpdates(_0x40b36b,_0x29e4ad){return function(_0x1634af){if(_0x1634af){return _0x1634af['update'](_0x40b36b)[_0x5569('0x27')](function(_0x215f05){return _0x215f05;});}return null;};}function removeEntity(_0x4f0ad0,_0x4c5335){return function(_0x406613){if(_0x406613){return _0x406613[_0x5569('0x28')]()[_0x5569('0x27')](function(){_0x4f0ad0[_0x5569('0x1c')](0xcc)[_0x5569('0x1d')]();});}};}function handleEntityNotFound(_0x12c7c6,_0x334680){return function(_0x4f370b){if(!_0x4f370b){_0x12c7c6[_0x5569('0x1b')](0x194);}return _0x4f370b;};}function handleError(_0xe83824,_0x3e1d4c){_0x3e1d4c=_0x3e1d4c||0x1f4;return function(_0x5dcb63){logger[_0x5569('0x29')](_0x5dcb63['stack']);if(_0x5dcb63['name']){delete _0x5dcb63[_0x5569('0x2a')];}_0xe83824[_0x5569('0x1c')](_0x3e1d4c)[_0x5569('0x2b')](_0x5dcb63);};}exports['index']=function(_0x5c8cfa,_0x8911d0){var _0x5911ad={},_0x43f6ac={},_0x3fa762={'count':0x0,'rows':[]};var _0x22e24e=_[_0x5569('0x2c')](db[_0x5569('0x2d')][_0x5569('0x2e')],function(_0xed8662){return{'name':_0xed8662[_0x5569('0x2f')],'type':_0xed8662[_0x5569('0x30')][_0x5569('0x31')]};});_0x43f6ac[_0x5569('0x32')]=_[_0x5569('0x2c')](_0x22e24e,_0x5569('0x2a'));_0x43f6ac[_0x5569('0x33')]=_[_0x5569('0x34')](_0x5c8cfa[_0x5569('0x33')]);_0x43f6ac[_0x5569('0x35')]=_[_0x5569('0x36')](_0x43f6ac[_0x5569('0x32')],_0x43f6ac[_0x5569('0x33')]);_0x5911ad[_0x5569('0x37')]=_[_0x5569('0x36')](_0x43f6ac[_0x5569('0x32')],qs[_0x5569('0x38')](_0x5c8cfa['query']['fields']));_0x5911ad[_0x5569('0x37')]=_0x5911ad[_0x5569('0x37')]['length']?_0x5911ad[_0x5569('0x37')]:_0x43f6ac['model'];if(!_0x5c8cfa[_0x5569('0x33')][_0x5569('0x39')](_0x5569('0x3a'))){_0x5911ad[_0x5569('0x21')]=qs['limit'](_0x5c8cfa['query'][_0x5569('0x21')]);_0x5911ad[_0x5569('0x1f')]=qs[_0x5569('0x1f')](_0x5c8cfa['query'][_0x5569('0x1f')]);}_0x5911ad[_0x5569('0x3b')]=qs[_0x5569('0x3c')](_0x5c8cfa[_0x5569('0x33')][_0x5569('0x3c')]);_0x5911ad[_0x5569('0x3d')]=qs[_0x5569('0x35')](_[_0x5569('0x3e')](_0x5c8cfa[_0x5569('0x33')],_0x43f6ac[_0x5569('0x35')]),_0x22e24e);if(_0x5c8cfa[_0x5569('0x33')]['filter']){_0x5911ad[_0x5569('0x3d')]=_[_0x5569('0x3f')](_0x5911ad['where'],{'$or':_[_0x5569('0x2c')](_0x22e24e,function(_0x3d99c0){if(_0x3d99c0[_0x5569('0x30')]!==_0x5569('0x40')){var _0x5a0dfc={};_0x5a0dfc[_0x3d99c0[_0x5569('0x2a')]]={'$like':'%'+_0x5c8cfa['query']['filter']+'%'};return _0x5a0dfc;}})});}_0x5911ad=_['merge']({},_0x5911ad,_0x5c8cfa['options']);var _0x1a7e20={'where':_0x5911ad[_0x5569('0x3d')]};return db[_0x5569('0x2d')][_0x5569('0x22')](_0x1a7e20)[_0x5569('0x27')](function(_0x24bc84){_0x3fa762[_0x5569('0x22')]=_0x24bc84;if(_0x5c8cfa[_0x5569('0x33')]['includeAll']){_0x5911ad['include']=[{'all':!![]}];}return db[_0x5569('0x2d')]['findAll'](_0x5911ad);})[_0x5569('0x27')](function(_0x41fac9){_0x3fa762[_0x5569('0x41')]=_0x41fac9;return _0x3fa762;})[_0x5569('0x27')](respondWithFilteredResult(_0x8911d0,_0x5911ad))[_0x5569('0x42')](handleError(_0x8911d0,null));};exports['show']=function(_0x198ad0,_0x2e2f8b){var _0x46bac3={'raw':!![],'where':{'id':_0x198ad0[_0x5569('0x43')]['id']}},_0x1c1efc={};_0x1c1efc[_0x5569('0x32')]=_[_0x5569('0x34')](db[_0x5569('0x2d')][_0x5569('0x2e')]);_0x1c1efc[_0x5569('0x33')]=_[_0x5569('0x34')](_0x198ad0[_0x5569('0x33')]);_0x1c1efc['filters']=_[_0x5569('0x36')](_0x1c1efc['model'],_0x1c1efc['query']);_0x46bac3[_0x5569('0x37')]=_['intersection'](_0x1c1efc['model'],qs[_0x5569('0x38')](_0x198ad0[_0x5569('0x33')]['fields']));_0x46bac3[_0x5569('0x37')]=_0x46bac3[_0x5569('0x37')]['length']?_0x46bac3['attributes']:_0x1c1efc['model'];if(_0x198ad0[_0x5569('0x33')][_0x5569('0x44')]){_0x46bac3[_0x5569('0x45')]=[{'all':!![]}];}_0x46bac3=_[_0x5569('0x3f')]({},_0x46bac3,_0x198ad0[_0x5569('0x46')]);return db[_0x5569('0x2d')][_0x5569('0x47')](_0x46bac3)[_0x5569('0x27')](handleEntityNotFound(_0x2e2f8b,null))['then'](respondWithResult(_0x2e2f8b,null))['catch'](handleError(_0x2e2f8b,null));};exports['create']=function(_0x5054f3,_0xfd243d){return db[_0x5569('0x2d')]['create'](_0x5054f3['body'],{})['then'](respondWithResult(_0xfd243d,0xc9))[_0x5569('0x42')](handleError(_0xfd243d,null));};exports[_0x5569('0x48')]=function(_0x1541a5,_0x5e886e){if(_0x1541a5['body']['id']){delete _0x1541a5[_0x5569('0x49')]['id'];}return db[_0x5569('0x2d')]['find']({'where':{'id':_0x1541a5[_0x5569('0x43')]['id']}})[_0x5569('0x27')](handleEntityNotFound(_0x5e886e,null))[_0x5569('0x27')](saveUpdates(_0x1541a5[_0x5569('0x49')],null))[_0x5569('0x27')](respondWithResult(_0x5e886e,null))['catch'](handleError(_0x5e886e,null));};exports[_0x5569('0x28')]=function(_0x3ae93d,_0x1016b5){return db[_0x5569('0x2d')][_0x5569('0x47')]({'where':{'id':_0x3ae93d[_0x5569('0x43')]['id']}})['then'](handleEntityNotFound(_0x1016b5,null))[_0x5569('0x27')](removeEntity(_0x1016b5,null))[_0x5569('0x42')](handleError(_0x1016b5,null));};exports[_0x5569('0x4a')]=function(_0x189dcb,_0x31e528){return db[_0x5569('0x2d')]['describe']()[_0x5569('0x27')](respondWithResult(_0x31e528,null))[_0x5569('0x42')](handleError(_0x31e528,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index a3022bf..a594d49 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1d7905,_0x562560){var _0x2fe9d7=function(_0x579b04){while(--_0x579b04){_0x1d7905['push'](_0x1d7905['shift']());}};_0x2fe9d7(++_0x562560);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xcb91[_0x519c88];return _0x4668d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x4334af,_0x21e066){var _0xec5be0=function(_0x1ee788){while(--_0x1ee788){_0x4334af['push'](_0x4334af['shift']());}};_0xec5be0(++_0x21e066);}(_0xe706,0xa3));var _0x6e70=function(_0x57172c,_0x1df512){_0x57172c=_0x57172c-0x0;var _0x38e8a4=_0xe706[_0x57172c];return _0x38e8a4;};'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'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 53f0f65..0db4a7d 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 _0xbbfc=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','raw','where','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s'];(function(_0x656ab1,_0x17b64f){var _0xdf193f=function(_0x384002){while(--_0x384002){_0x656ab1['push'](_0x656ab1['shift']());}};_0xdf193f(++_0x17b64f);}(_0xbbfc,0x9a));var _0xcbbf=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xbbfc[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require(_0xcbbf('0x0'));var util=require(_0xcbbf('0x1'));var moment=require(_0xcbbf('0x2'));var BPromise=require(_0xcbbf('0x3'));var rs=require(_0xcbbf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbbf('0x5'))['db'];var utils=require(_0xcbbf('0x6'));var logger=require(_0xcbbf('0x7'))(_0xcbbf('0x8'));var config=require(_0xcbbf('0x9'));var jayson=require(_0xcbbf('0xa'));var client=jayson[_0xcbbf('0xb')][_0xcbbf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27ef31,_0x29a670,_0x5cf21c){return new BPromise(function(_0x2de6e6,_0x1c686b){return client[_0xcbbf('0xd')](_0x27ef31,_0x5cf21c)[_0xcbbf('0xe')](function(_0x4ef177){logger['info'](_0xcbbf('0xf'),_0x29a670,_0xcbbf('0x10'));logger[_0xcbbf('0x11')](_0xcbbf('0x12'),_0x29a670,_0xcbbf('0x10'),JSON[_0xcbbf('0x13')](_0x4ef177));if(_0x4ef177['error']){if(_0x4ef177[_0xcbbf('0x14')]['code']===0x1f4){logger[_0xcbbf('0x14')](_0xcbbf('0xf'),_0x29a670,_0x4ef177[_0xcbbf('0x14')]['message']);return _0x1c686b(_0x4ef177[_0xcbbf('0x14')][_0xcbbf('0x15')]);}logger[_0xcbbf('0x14')](_0xcbbf('0xf'),_0x29a670,_0x4ef177['error'][_0xcbbf('0x15')]);return _0x2de6e6(_0x4ef177[_0xcbbf('0x14')][_0xcbbf('0x15')]);}else{logger[_0xcbbf('0x16')]('SmsQueueReport,\x20%s,\x20%s',_0x29a670,_0xcbbf('0x10'));_0x2de6e6(_0x4ef177[_0xcbbf('0x17')]['message']);}})['catch'](function(_0x18c54c){logger[_0xcbbf('0x14')](_0xcbbf('0xf'),_0x29a670,_0x18c54c);_0x1c686b(_0x18c54c);});});}exports[_0xcbbf('0x18')]=function(_0x550ca3){var _0x4699a8=this;return new Promise(function(_0x2b7f5e,_0x236b33){return db[_0xcbbf('0x19')][_0xcbbf('0x1a')](_0x550ca3[_0xcbbf('0x1b')],{'raw':_0x550ca3[_0xcbbf('0x1c')]?_0x550ca3['options']['raw']===undefined?!![]:![]:!![]})[_0xcbbf('0xe')](function(_0x566059){logger['info'](_0xcbbf('0x18'),_0x550ca3);logger[_0xcbbf('0x11')](_0xcbbf('0x18'),_0x550ca3,JSON[_0xcbbf('0x13')](_0x566059));_0x2b7f5e(_0x566059);})['catch'](function(_0xb2882c){logger[_0xcbbf('0x14')]('CreateSmsQueueReport',_0xb2882c[_0xcbbf('0x15')],_0x550ca3);_0x236b33(_0x4699a8['error'](0x1f4,_0xb2882c[_0xcbbf('0x15')]));});});};exports[_0xcbbf('0x1d')]=function(_0x296096){var _0x2f86cc=this;return new Promise(function(_0x52fd31,_0x4aa153){return db[_0xcbbf('0x19')][_0xcbbf('0x1e')](_0x296096['body'],{'raw':_0x296096[_0xcbbf('0x1c')]?_0x296096[_0xcbbf('0x1c')][_0xcbbf('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x296096[_0xcbbf('0x1c')]?_0x296096['options'][_0xcbbf('0x20')]||null:null,'attributes':_0x296096[_0xcbbf('0x1c')]?_0x296096[_0xcbbf('0x1c')]['attributes']||null:null,'limit':_0x296096[_0xcbbf('0x1c')]?_0x296096['options']['limit']||null:null})[_0xcbbf('0xe')](function(_0x321718){logger[_0xcbbf('0x16')](_0xcbbf('0x1d'),_0x296096);logger[_0xcbbf('0x11')](_0xcbbf('0x1d'),_0x296096,JSON[_0xcbbf('0x13')](_0x321718));_0x52fd31(_0x321718);})[_0xcbbf('0x21')](function(_0x51dd2f){logger[_0xcbbf('0x14')](_0xcbbf('0x1d'),_0x51dd2f[_0xcbbf('0x15')],_0x296096);_0x4aa153(_0x2f86cc['error'](0x1f4,_0x51dd2f[_0xcbbf('0x15')]));});});}; \ No newline at end of file +var _0x4a1e=['where','attributes','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSmsQueueReport','create','options','raw','info','UpdateSmsQueueReport','SmsQueueReport','update','body'];(function(_0x2d0434,_0x289dda){var _0x566be6=function(_0x4d12ba){while(--_0x4d12ba){_0x2d0434['push'](_0x2d0434['shift']());}};_0x566be6(++_0x289dda);}(_0x4a1e,0x14d));var _0xe4a1=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x4a1e[_0x3fcc20];return _0x15d3ce;};'use strict';var _=require(_0xe4a1('0x0'));var util=require('util');var moment=require(_0xe4a1('0x1'));var BPromise=require(_0xe4a1('0x2'));var rs=require(_0xe4a1('0x3'));var fs=require('fs');var Redis=require(_0xe4a1('0x4'));var db=require(_0xe4a1('0x5'))['db'];var utils=require(_0xe4a1('0x6'));var logger=require('../../config/logger')(_0xe4a1('0x7'));var config=require(_0xe4a1('0x8'));var jayson=require(_0xe4a1('0x9'));var client=jayson[_0xe4a1('0xa')][_0xe4a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31278b,_0x29c67e,_0x541409){return new BPromise(function(_0x18e37d,_0x368bb2){return client['request'](_0x31278b,_0x541409)[_0xe4a1('0xc')](function(_0x5235ae){logger['info'](_0xe4a1('0xd'),_0x29c67e,'request\x20sent');logger[_0xe4a1('0xe')](_0xe4a1('0xf'),_0x29c67e,_0xe4a1('0x10'),JSON[_0xe4a1('0x11')](_0x5235ae));if(_0x5235ae[_0xe4a1('0x12')]){if(_0x5235ae['error'][_0xe4a1('0x13')]===0x1f4){logger[_0xe4a1('0x12')](_0xe4a1('0xd'),_0x29c67e,_0x5235ae[_0xe4a1('0x12')]['message']);return _0x368bb2(_0x5235ae[_0xe4a1('0x12')][_0xe4a1('0x14')]);}logger['error'](_0xe4a1('0xd'),_0x29c67e,_0x5235ae['error']['message']);return _0x18e37d(_0x5235ae[_0xe4a1('0x12')]['message']);}else{logger['info'](_0xe4a1('0xd'),_0x29c67e,_0xe4a1('0x10'));_0x18e37d(_0x5235ae['result']['message']);}})['catch'](function(_0x5b20b1){logger[_0xe4a1('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x29c67e,_0x5b20b1);_0x368bb2(_0x5b20b1);});});}exports[_0xe4a1('0x15')]=function(_0x2e47f9){var _0x274807=this;return new Promise(function(_0x5adf20,_0x2e9c6b){return db['SmsQueueReport'][_0xe4a1('0x16')](_0x2e47f9['body'],{'raw':_0x2e47f9[_0xe4a1('0x17')]?_0x2e47f9[_0xe4a1('0x17')][_0xe4a1('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3f7937){logger[_0xe4a1('0x19')]('CreateSmsQueueReport',_0x2e47f9);logger[_0xe4a1('0xe')](_0xe4a1('0x15'),_0x2e47f9,JSON[_0xe4a1('0x11')](_0x3f7937));_0x5adf20(_0x3f7937);})['catch'](function(_0x400a46){logger[_0xe4a1('0x12')]('CreateSmsQueueReport',_0x400a46[_0xe4a1('0x14')],_0x2e47f9);_0x2e9c6b(_0x274807[_0xe4a1('0x12')](0x1f4,_0x400a46[_0xe4a1('0x14')]));});});};exports[_0xe4a1('0x1a')]=function(_0xf87eb6){var _0x52b0c8=this;return new Promise(function(_0x57eb30,_0x584bd0){return db[_0xe4a1('0x1b')][_0xe4a1('0x1c')](_0xf87eb6[_0xe4a1('0x1d')],{'raw':_0xf87eb6[_0xe4a1('0x17')]?_0xf87eb6[_0xe4a1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf87eb6['options']?_0xf87eb6[_0xe4a1('0x17')][_0xe4a1('0x1e')]||null:null,'attributes':_0xf87eb6[_0xe4a1('0x17')]?_0xf87eb6[_0xe4a1('0x17')][_0xe4a1('0x1f')]||null:null,'limit':_0xf87eb6[_0xe4a1('0x17')]?_0xf87eb6['options']['limit']||null:null})[_0xe4a1('0xc')](function(_0xceb990){logger[_0xe4a1('0x19')](_0xe4a1('0x1a'),_0xf87eb6);logger[_0xe4a1('0xe')]('UpdateSmsQueueReport',_0xf87eb6,JSON[_0xe4a1('0x11')](_0xceb990));_0x57eb30(_0xceb990);})[_0xe4a1('0x20')](function(_0x23fbd1){logger[_0xe4a1('0x12')](_0xe4a1('0x1a'),_0x23fbd1[_0xe4a1('0x14')],_0xf87eb6);_0x584bd0(_0x52b0c8[_0xe4a1('0x12')](0x1f4,_0x23fbd1[_0xe4a1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 184667d..0a58a94 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 _0x3435=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','exports','multer','util'];(function(_0x598b8e,_0x599217){var _0x134a08=function(_0x4e6cfc){while(--_0x4e6cfc){_0x598b8e['push'](_0x598b8e['shift']());}};_0x134a08(++_0x599217);}(_0x3435,0xfa));var _0x5343=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x3435[_0x313c96];return _0x522f53;};'use strict';var multer=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var path=require(_0x5343('0x2'));var timeout=require(_0x5343('0x3'));var express=require(_0x5343('0x4'));var router=express[_0x5343('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5343('0x6'));var interaction=require(_0x5343('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x5343('0x8')]('/',auth[_0x5343('0x9')](),controller['index']);router['get'](_0x5343('0xa'),auth[_0x5343('0x9')](),controller[_0x5343('0xb')]);router[_0x5343('0x8')](_0x5343('0xc'),auth['isAuthenticated'](),controller[_0x5343('0xd')]);router['post']('/',auth[_0x5343('0x9')](),controller[_0x5343('0xe')]);router[_0x5343('0xf')](_0x5343('0xc'),auth[_0x5343('0x9')](),controller['update']);router[_0x5343('0x10')](_0x5343('0xc'),auth[_0x5343('0x9')](),controller['destroy']);module[_0x5343('0x11')]=router; \ No newline at end of file +var _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x4a8fdb,_0x111e80){var _0x4258a8=function(_0x86a1a6){while(--_0x86a1a6){_0x4a8fdb['push'](_0x4a8fdb['shift']());}};_0x4258a8(++_0x111e80);}(_0x5178,0x171));var _0x8517=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5178[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./smsTransferReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);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 60d08d1..4a498ad 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x470276,_0x36d7ff){var _0x440bce=function(_0xfc9574){while(--_0xfc9574){_0x470276['push'](_0x470276['shift']());}};_0x440bce(++_0x36d7ff);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x352401,_0x5c29d3){var _0x2982c5=function(_0x3df520){while(--_0x3df520){_0x352401['push'](_0x352401['shift']());}};_0x2982c5(++_0x5c29d3);}(_0x008c,0x188));var _0xc008=function(_0x459573,_0x35679e){_0x459573=_0x459573-0x0;var _0x51ffcd=_0x008c[_0x459573];return _0x51ffcd;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0cba84f..3088f20 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 _0xc6b0=['stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','then','includeAll','include','findAll','rows','catch','show','length','merge','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','destroy'];(function(_0xd3717b,_0x58eea3){var _0x5874f0=function(_0x4de06d){while(--_0x4de06d){_0xd3717b['push'](_0xd3717b['shift']());}};_0x5874f0(++_0x58eea3);}(_0xc6b0,0x71));var _0x0c6b=function(_0x281367,_0x33eaab){_0x281367=_0x281367-0x0;var _0x51d099=_0xc6b0[_0x281367];return _0x51d099;};'use strict';var emlformat=require(_0x0c6b('0x0'));var rimraf=require(_0x0c6b('0x1'));var zipdir=require(_0x0c6b('0x2'));var jsonpatch=require(_0x0c6b('0x3'));var rp=require(_0x0c6b('0x4'));var moment=require(_0x0c6b('0x5'));var BPromise=require(_0x0c6b('0x6'));var Mustache=require('mustache');var util=require(_0x0c6b('0x7'));var path=require(_0x0c6b('0x8'));var sox=require('sox');var csv=require(_0x0c6b('0x9'));var ejs=require(_0x0c6b('0xa'));var fs=require('fs');var fs_extra=require(_0x0c6b('0xb'));var _=require(_0x0c6b('0xc'));var squel=require(_0x0c6b('0xd'));var crypto=require(_0x0c6b('0xe'));var jsforce=require(_0x0c6b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0c6b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0c6b('0x10'));var authService=require(_0x0c6b('0x11'));var qs=require(_0x0c6b('0x12'));var as=require(_0x0c6b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c6b('0x14'))('api');var utils=require(_0x0c6b('0x15'));var config=require(_0x0c6b('0x16'));var licenseUtil=require(_0x0c6b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39688b,_0xd36c0e){_0xd36c0e=_0xd36c0e||0xcc;return function(_0x113551){if(_0x113551){return _0x39688b[_0x0c6b('0x18')](_0xd36c0e);}return _0x39688b[_0x0c6b('0x19')](_0xd36c0e)[_0x0c6b('0x1a')]();};}function respondWithResult(_0x59e1ca,_0x16ee05){_0x16ee05=_0x16ee05||0xc8;return function(_0x5ba25b){if(_0x5ba25b){return _0x59e1ca[_0x0c6b('0x19')](_0x16ee05)[_0x0c6b('0x1b')](_0x5ba25b);}};}function respondWithFilteredResult(_0x5f5a8d,_0x17ad39){return function(_0x3df7f3){if(_0x3df7f3){var _0x8923c3=typeof _0x17ad39[_0x0c6b('0x1c')]===_0x0c6b('0x1d')&&typeof _0x17ad39[_0x0c6b('0x1e')]===_0x0c6b('0x1d');var _0x86b79b=_0x3df7f3[_0x0c6b('0x1f')];var _0x34dd23=_0x8923c3?0x0:_0x17ad39[_0x0c6b('0x1c')];var _0x3f9616=_0x8923c3?_0x3df7f3[_0x0c6b('0x1f')]:_0x17ad39[_0x0c6b('0x1c')]+_0x17ad39['limit'];var _0x2a877a;if(_0x3f9616>=_0x86b79b){_0x3f9616=_0x86b79b;_0x2a877a=0xc8;}else{_0x2a877a=0xce;}_0x5f5a8d[_0x0c6b('0x19')](_0x2a877a);return _0x5f5a8d['set']('Content-Range',_0x34dd23+'-'+_0x3f9616+'/'+_0x86b79b)[_0x0c6b('0x1b')](_0x3df7f3);}return null;};}function patchUpdates(_0x33cb54){return function(_0xdfd1ce){try{jsonpatch[_0x0c6b('0x20')](_0xdfd1ce,_0x33cb54,!![]);}catch(_0x4c92ba){return BPromise['reject'](_0x4c92ba);}return _0xdfd1ce[_0x0c6b('0x21')]();};}function saveUpdates(_0x497ee9,_0x227301){return function(_0x58fc73){if(_0x58fc73){return _0x58fc73['update'](_0x497ee9)['then'](function(_0x16d478){return _0x16d478;});}return null;};}function removeEntity(_0x306e9d,_0xa27d13){return function(_0x3d65e1){if(_0x3d65e1){return _0x3d65e1[_0x0c6b('0x22')]()['then'](function(){_0x306e9d['status'](0xcc)[_0x0c6b('0x1a')]();});}};}function handleEntityNotFound(_0x5c357a,_0x431603){return function(_0x2102a7){if(!_0x2102a7){_0x5c357a[_0x0c6b('0x18')](0x194);}return _0x2102a7;};}function handleError(_0xe1ca51,_0x49fc7e){_0x49fc7e=_0x49fc7e||0x1f4;return function(_0x36b43a){logger['error'](_0x36b43a[_0x0c6b('0x23')]);if(_0x36b43a[_0x0c6b('0x24')]){delete _0x36b43a[_0x0c6b('0x24')];}_0xe1ca51['status'](_0x49fc7e)[_0x0c6b('0x25')](_0x36b43a);};}exports[_0x0c6b('0x26')]=function(_0x219003,_0x4e2831){var _0x3fcb9a={},_0x4cf96d={},_0x5ea0f4={'count':0x0,'rows':[]};var _0x81e90f=_[_0x0c6b('0x27')](db[_0x0c6b('0x28')][_0x0c6b('0x29')],function(_0x2cfd6f){return{'name':_0x2cfd6f[_0x0c6b('0x2a')],'type':_0x2cfd6f[_0x0c6b('0x2b')]['key']};});_0x4cf96d[_0x0c6b('0x2c')]=_['map'](_0x81e90f,_0x0c6b('0x24'));_0x4cf96d[_0x0c6b('0x2d')]=_[_0x0c6b('0x2e')](_0x219003[_0x0c6b('0x2d')]);_0x4cf96d[_0x0c6b('0x2f')]=_[_0x0c6b('0x30')](_0x4cf96d[_0x0c6b('0x2c')],_0x4cf96d['query']);_0x3fcb9a[_0x0c6b('0x31')]=_['intersection'](_0x4cf96d['model'],qs[_0x0c6b('0x32')](_0x219003[_0x0c6b('0x2d')][_0x0c6b('0x32')]));_0x3fcb9a[_0x0c6b('0x31')]=_0x3fcb9a[_0x0c6b('0x31')]['length']?_0x3fcb9a[_0x0c6b('0x31')]:_0x4cf96d[_0x0c6b('0x2c')];if(!_0x219003[_0x0c6b('0x2d')][_0x0c6b('0x33')](_0x0c6b('0x34'))){_0x3fcb9a[_0x0c6b('0x1e')]=qs[_0x0c6b('0x1e')](_0x219003['query']['limit']);_0x3fcb9a[_0x0c6b('0x1c')]=qs[_0x0c6b('0x1c')](_0x219003[_0x0c6b('0x2d')]['offset']);}_0x3fcb9a[_0x0c6b('0x35')]=qs[_0x0c6b('0x36')](_0x219003[_0x0c6b('0x2d')][_0x0c6b('0x36')]);_0x3fcb9a[_0x0c6b('0x37')]=qs[_0x0c6b('0x2f')](_[_0x0c6b('0x38')](_0x219003['query'],_0x4cf96d[_0x0c6b('0x2f')]),_0x81e90f);if(_0x219003[_0x0c6b('0x2d')][_0x0c6b('0x39')]){_0x3fcb9a['where']=_['merge'](_0x3fcb9a[_0x0c6b('0x37')],{'$or':_['map'](_0x81e90f,function(_0x5cfece){if(_0x5cfece[_0x0c6b('0x2b')]!=='VIRTUAL'){var _0x360e75={};_0x360e75[_0x5cfece[_0x0c6b('0x24')]]={'$like':'%'+_0x219003[_0x0c6b('0x2d')][_0x0c6b('0x39')]+'%'};return _0x360e75;}})});}_0x3fcb9a=_['merge']({},_0x3fcb9a,_0x219003['options']);var _0x5b057e={'where':_0x3fcb9a[_0x0c6b('0x37')]};return db['SmsTransferReport']['count'](_0x5b057e)[_0x0c6b('0x3a')](function(_0x335bf7){_0x5ea0f4['count']=_0x335bf7;if(_0x219003[_0x0c6b('0x2d')][_0x0c6b('0x3b')]){_0x3fcb9a[_0x0c6b('0x3c')]=[{'all':!![]}];}return db[_0x0c6b('0x28')][_0x0c6b('0x3d')](_0x3fcb9a);})[_0x0c6b('0x3a')](function(_0x3f6cec){_0x5ea0f4[_0x0c6b('0x3e')]=_0x3f6cec;return _0x5ea0f4;})['then'](respondWithFilteredResult(_0x4e2831,_0x3fcb9a))[_0x0c6b('0x3f')](handleError(_0x4e2831,null));};exports[_0x0c6b('0x40')]=function(_0x364954,_0x430bbf){var _0x20f1db={'raw':!![],'where':{'id':_0x364954['params']['id']}},_0x5679d9={};_0x5679d9[_0x0c6b('0x2c')]=_[_0x0c6b('0x2e')](db[_0x0c6b('0x28')][_0x0c6b('0x29')]);_0x5679d9['query']=_[_0x0c6b('0x2e')](_0x364954[_0x0c6b('0x2d')]);_0x5679d9['filters']=_[_0x0c6b('0x30')](_0x5679d9[_0x0c6b('0x2c')],_0x5679d9[_0x0c6b('0x2d')]);_0x20f1db[_0x0c6b('0x31')]=_[_0x0c6b('0x30')](_0x5679d9[_0x0c6b('0x2c')],qs['fields'](_0x364954[_0x0c6b('0x2d')]['fields']));_0x20f1db['attributes']=_0x20f1db['attributes'][_0x0c6b('0x41')]?_0x20f1db[_0x0c6b('0x31')]:_0x5679d9[_0x0c6b('0x2c')];if(_0x364954[_0x0c6b('0x2d')][_0x0c6b('0x3b')]){_0x20f1db['include']=[{'all':!![]}];}_0x20f1db=_[_0x0c6b('0x42')]({},_0x20f1db,_0x364954[_0x0c6b('0x43')]);return db[_0x0c6b('0x28')][_0x0c6b('0x44')](_0x20f1db)[_0x0c6b('0x3a')](handleEntityNotFound(_0x430bbf,null))[_0x0c6b('0x3a')](respondWithResult(_0x430bbf,null))['catch'](handleError(_0x430bbf,null));};exports[_0x0c6b('0x45')]=function(_0x39d13b,_0x204276){return db[_0x0c6b('0x28')]['create'](_0x39d13b[_0x0c6b('0x46')],{})[_0x0c6b('0x3a')](respondWithResult(_0x204276,0xc9))[_0x0c6b('0x3f')](handleError(_0x204276,null));};exports[_0x0c6b('0x47')]=function(_0x4eb295,_0x260a1d){if(_0x4eb295[_0x0c6b('0x46')]['id']){delete _0x4eb295['body']['id'];}return db['SmsTransferReport'][_0x0c6b('0x44')]({'where':{'id':_0x4eb295[_0x0c6b('0x48')]['id']}})[_0x0c6b('0x3a')](handleEntityNotFound(_0x260a1d,null))[_0x0c6b('0x3a')](saveUpdates(_0x4eb295[_0x0c6b('0x46')],null))[_0x0c6b('0x3a')](respondWithResult(_0x260a1d,null))[_0x0c6b('0x3f')](handleError(_0x260a1d,null));};exports[_0x0c6b('0x22')]=function(_0x4ab5cc,_0x142909){return db[_0x0c6b('0x28')][_0x0c6b('0x44')]({'where':{'id':_0x4ab5cc['params']['id']}})[_0x0c6b('0x3a')](handleEntityNotFound(_0x142909,null))[_0x0c6b('0x3a')](removeEntity(_0x142909,null))[_0x0c6b('0x3f')](handleError(_0x142909,null));};exports[_0x0c6b('0x49')]=function(_0x59c05f,_0x2ebc5e){return db[_0x0c6b('0x28')]['describe']()[_0x0c6b('0x3a')](respondWithResult(_0x2ebc5e,null))['catch'](handleError(_0x2ebc5e,null));}; \ No newline at end of file +var _0xa29a=['bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xa29a,0xe7));var _0xaa29=function(_0x4631a1,_0x4475f5){_0x4631a1=_0x4631a1-0x0;var _0x2f459e=_0xa29a[_0x4631a1];return _0x2f459e;};'use strict';var emlformat=require(_0xaa29('0x0'));var rimraf=require(_0xaa29('0x1'));var zipdir=require(_0xaa29('0x2'));var jsonpatch=require(_0xaa29('0x3'));var rp=require(_0xaa29('0x4'));var moment=require(_0xaa29('0x5'));var BPromise=require(_0xaa29('0x6'));var Mustache=require(_0xaa29('0x7'));var util=require('util');var path=require('path');var sox=require(_0xaa29('0x8'));var csv=require(_0xaa29('0x9'));var ejs=require(_0xaa29('0xa'));var fs=require('fs');var fs_extra=require(_0xaa29('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa29('0xc'));var deskjs=require(_0xaa29('0xd'));var toCsv=require(_0xaa29('0x9'));var querystring=require(_0xaa29('0xe'));var Papa=require(_0xaa29('0xf'));var Redis=require('ioredis');var authService=require(_0xaa29('0x10'));var qs=require(_0xaa29('0x11'));var as=require(_0xaa29('0x12'));var hardwareService=require(_0xaa29('0x13'));var logger=require(_0xaa29('0x14'))(_0xaa29('0x15'));var utils=require(_0xaa29('0x16'));var config=require(_0xaa29('0x17'));var licenseUtil=require(_0xaa29('0x18'));var db=require(_0xaa29('0x19'))['db'];function respondWithStatusCode(_0x32dda7,_0x21973){_0x21973=_0x21973||0xcc;return function(_0x325299){if(_0x325299){return _0x32dda7[_0xaa29('0x1a')](_0x21973);}return _0x32dda7[_0xaa29('0x1b')](_0x21973)[_0xaa29('0x1c')]();};}function respondWithResult(_0x3bbecb,_0x17c3c1){_0x17c3c1=_0x17c3c1||0xc8;return function(_0x5d95b2){if(_0x5d95b2){return _0x3bbecb[_0xaa29('0x1b')](_0x17c3c1)['json'](_0x5d95b2);}};}function respondWithFilteredResult(_0x3892a,_0x58144d){return function(_0x189344){if(_0x189344){var _0x121828=typeof _0x58144d['offset']===_0xaa29('0x1d')&&typeof _0x58144d[_0xaa29('0x1e')]==='undefined';var _0x2482ca=_0x189344[_0xaa29('0x1f')];var _0x4a0009=_0x121828?0x0:_0x58144d[_0xaa29('0x20')];var _0xd11d80=_0x121828?_0x189344[_0xaa29('0x1f')]:_0x58144d[_0xaa29('0x20')]+_0x58144d[_0xaa29('0x1e')];var _0x85305;if(_0xd11d80>=_0x2482ca){_0xd11d80=_0x2482ca;_0x85305=0xc8;}else{_0x85305=0xce;}_0x3892a[_0xaa29('0x1b')](_0x85305);return _0x3892a[_0xaa29('0x21')]('Content-Range',_0x4a0009+'-'+_0xd11d80+'/'+_0x2482ca)[_0xaa29('0x22')](_0x189344);}return null;};}function patchUpdates(_0x4832ec){return function(_0x5db56e){try{jsonpatch[_0xaa29('0x23')](_0x5db56e,_0x4832ec,!![]);}catch(_0x355245){return BPromise[_0xaa29('0x24')](_0x355245);}return _0x5db56e[_0xaa29('0x25')]();};}function saveUpdates(_0x23ab66,_0x173129){return function(_0xb4915f){if(_0xb4915f){return _0xb4915f['update'](_0x23ab66)[_0xaa29('0x26')](function(_0xfb8789){return _0xfb8789;});}return null;};}function removeEntity(_0xaed3ff,_0x5d5bdf){return function(_0x5c10f6){if(_0x5c10f6){return _0x5c10f6['destroy']()[_0xaa29('0x26')](function(){_0xaed3ff[_0xaa29('0x1b')](0xcc)[_0xaa29('0x1c')]();});}};}function handleEntityNotFound(_0xe4fa7b,_0x54f947){return function(_0x2aa528){if(!_0x2aa528){_0xe4fa7b[_0xaa29('0x1a')](0x194);}return _0x2aa528;};}function handleError(_0x3ec692,_0x3f85f9){_0x3f85f9=_0x3f85f9||0x1f4;return function(_0x282734){logger[_0xaa29('0x27')](_0x282734[_0xaa29('0x28')]);if(_0x282734['name']){delete _0x282734[_0xaa29('0x29')];}_0x3ec692[_0xaa29('0x1b')](_0x3f85f9)[_0xaa29('0x2a')](_0x282734);};}exports[_0xaa29('0x2b')]=function(_0x377daa,_0x48c05b){var _0x29a87c={},_0x64882c={},_0x9873c9={'count':0x0,'rows':[]};var _0x493c79=_[_0xaa29('0x2c')](db[_0xaa29('0x2d')][_0xaa29('0x2e')],function(_0x979aca){return{'name':_0x979aca['fieldName'],'type':_0x979aca[_0xaa29('0x2f')][_0xaa29('0x30')]};});_0x64882c['model']=_[_0xaa29('0x2c')](_0x493c79,_0xaa29('0x29'));_0x64882c[_0xaa29('0x31')]=_[_0xaa29('0x32')](_0x377daa[_0xaa29('0x31')]);_0x64882c['filters']=_[_0xaa29('0x33')](_0x64882c[_0xaa29('0x34')],_0x64882c[_0xaa29('0x31')]);_0x29a87c[_0xaa29('0x35')]=_['intersection'](_0x64882c[_0xaa29('0x34')],qs[_0xaa29('0x36')](_0x377daa[_0xaa29('0x31')][_0xaa29('0x36')]));_0x29a87c[_0xaa29('0x35')]=_0x29a87c[_0xaa29('0x35')][_0xaa29('0x37')]?_0x29a87c['attributes']:_0x64882c['model'];if(!_0x377daa[_0xaa29('0x31')][_0xaa29('0x38')](_0xaa29('0x39'))){_0x29a87c['limit']=qs[_0xaa29('0x1e')](_0x377daa['query'][_0xaa29('0x1e')]);_0x29a87c[_0xaa29('0x20')]=qs[_0xaa29('0x20')](_0x377daa['query'][_0xaa29('0x20')]);}_0x29a87c[_0xaa29('0x3a')]=qs[_0xaa29('0x3b')](_0x377daa['query']['sort']);_0x29a87c[_0xaa29('0x3c')]=qs[_0xaa29('0x3d')](_[_0xaa29('0x3e')](_0x377daa[_0xaa29('0x31')],_0x64882c['filters']),_0x493c79);if(_0x377daa[_0xaa29('0x31')][_0xaa29('0x3f')]){_0x29a87c[_0xaa29('0x3c')]=_['merge'](_0x29a87c[_0xaa29('0x3c')],{'$or':_[_0xaa29('0x2c')](_0x493c79,function(_0x4bfaf1){if(_0x4bfaf1[_0xaa29('0x2f')]!=='VIRTUAL'){var _0x1845bf={};_0x1845bf[_0x4bfaf1[_0xaa29('0x29')]]={'$like':'%'+_0x377daa[_0xaa29('0x31')][_0xaa29('0x3f')]+'%'};return _0x1845bf;}})});}_0x29a87c=_['merge']({},_0x29a87c,_0x377daa[_0xaa29('0x40')]);var _0x2473f7={'where':_0x29a87c[_0xaa29('0x3c')]};return db[_0xaa29('0x2d')][_0xaa29('0x1f')](_0x2473f7)['then'](function(_0x4f66c2){_0x9873c9['count']=_0x4f66c2;if(_0x377daa[_0xaa29('0x31')]['includeAll']){_0x29a87c[_0xaa29('0x41')]=[{'all':!![]}];}return db[_0xaa29('0x2d')][_0xaa29('0x42')](_0x29a87c);})['then'](function(_0x24b601){_0x9873c9[_0xaa29('0x43')]=_0x24b601;return _0x9873c9;})[_0xaa29('0x26')](respondWithFilteredResult(_0x48c05b,_0x29a87c))[_0xaa29('0x44')](handleError(_0x48c05b,null));};exports[_0xaa29('0x45')]=function(_0x39192f,_0x545db6){var _0x31f083={'raw':!![],'where':{'id':_0x39192f[_0xaa29('0x46')]['id']}},_0xd06963={};_0xd06963[_0xaa29('0x34')]=_[_0xaa29('0x32')](db[_0xaa29('0x2d')][_0xaa29('0x2e')]);_0xd06963[_0xaa29('0x31')]=_[_0xaa29('0x32')](_0x39192f[_0xaa29('0x31')]);_0xd06963[_0xaa29('0x3d')]=_[_0xaa29('0x33')](_0xd06963[_0xaa29('0x34')],_0xd06963[_0xaa29('0x31')]);_0x31f083[_0xaa29('0x35')]=_[_0xaa29('0x33')](_0xd06963[_0xaa29('0x34')],qs[_0xaa29('0x36')](_0x39192f['query'][_0xaa29('0x36')]));_0x31f083[_0xaa29('0x35')]=_0x31f083[_0xaa29('0x35')][_0xaa29('0x37')]?_0x31f083[_0xaa29('0x35')]:_0xd06963[_0xaa29('0x34')];if(_0x39192f[_0xaa29('0x31')][_0xaa29('0x47')]){_0x31f083[_0xaa29('0x41')]=[{'all':!![]}];}_0x31f083=_[_0xaa29('0x48')]({},_0x31f083,_0x39192f[_0xaa29('0x40')]);return db[_0xaa29('0x2d')][_0xaa29('0x49')](_0x31f083)[_0xaa29('0x26')](handleEntityNotFound(_0x545db6,null))['then'](respondWithResult(_0x545db6,null))[_0xaa29('0x44')](handleError(_0x545db6,null));};exports[_0xaa29('0x4a')]=function(_0x12c623,_0x285689){return db[_0xaa29('0x2d')][_0xaa29('0x4a')](_0x12c623[_0xaa29('0x4b')],{})['then'](respondWithResult(_0x285689,0xc9))[_0xaa29('0x44')](handleError(_0x285689,null));};exports[_0xaa29('0x4c')]=function(_0x31b083,_0x422d4a){if(_0x31b083[_0xaa29('0x4b')]['id']){delete _0x31b083[_0xaa29('0x4b')]['id'];}return db['SmsTransferReport'][_0xaa29('0x49')]({'where':{'id':_0x31b083['params']['id']}})[_0xaa29('0x26')](handleEntityNotFound(_0x422d4a,null))[_0xaa29('0x26')](saveUpdates(_0x31b083['body'],null))[_0xaa29('0x26')](respondWithResult(_0x422d4a,null))[_0xaa29('0x44')](handleError(_0x422d4a,null));};exports[_0xaa29('0x4d')]=function(_0x5db3a3,_0x28cfa7){return db[_0xaa29('0x2d')][_0xaa29('0x49')]({'where':{'id':_0x5db3a3[_0xaa29('0x46')]['id']}})['then'](handleEntityNotFound(_0x28cfa7,null))[_0xaa29('0x26')](removeEntity(_0x28cfa7,null))[_0xaa29('0x44')](handleError(_0x28cfa7,null));};exports['describe']=function(_0x284784,_0x367df9){return db[_0xaa29('0x2d')][_0xaa29('0x4e')]()[_0xaa29('0x26')](respondWithResult(_0x367df9,null))[_0xaa29('0x44')](handleError(_0x367df9,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d88b340..abbbb94 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 _0x7326=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1cefe5,_0x15f97f){var _0x12f6e7=function(_0x3fe355){while(--_0x3fe355){_0x1cefe5['push'](_0x1cefe5['shift']());}};_0x12f6e7(++_0x15f97f);}(_0x7326,0xc7));var _0x6732=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x7326[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6732('0x0'))('api');var moment=require(_0x6732('0x1'));var BPromise=require(_0x6732('0x2'));var rp=require(_0x6732('0x3'));var fs=require('fs');var path=require(_0x6732('0x4'));var rimraf=require(_0x6732('0x5'));var config=require(_0x6732('0x6'));var attributes=require(_0x6732('0x7'));module[_0x6732('0x8')]=function(_0x39dbde,_0x46372b){return _0x39dbde['define'](_0x6732('0x9'),attributes,{'tableName':_0x6732('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6732('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e8f=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x1c4004,_0x5bb18d){var _0x2b9169=function(_0x21192a){while(--_0x21192a){_0x1c4004['push'](_0x1c4004['shift']());}};_0x2b9169(++_0x5bb18d);}(_0x5e8f,0x12e));var _0xf5e8=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x5e8f[_0x14477e];return _0x5d4a05;};'use strict';var _=require(_0xf5e8('0x0'));var util=require(_0xf5e8('0x1'));var logger=require(_0xf5e8('0x2'))('api');var moment=require(_0xf5e8('0x3'));var BPromise=require(_0xf5e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf5e8('0x5'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0xf5e8('0x6')]=function(_0x50c746,_0x151a27){return _0x50c746[_0xf5e8('0x7')](_0xf5e8('0x8'),attributes,{'tableName':_0xf5e8('0x9'),'paranoid':![],'indexes':[{'name':_0xf5e8('0xa'),'fields':[_0xf5e8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a085412..4054682 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 _0xeec6=['then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xeec6,0x1c2));var _0x6eec=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xeec6[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +var _0x45d1=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','result','lodash','util','bluebird'];(function(_0x5f11f7,_0x4a4b67){var _0x2c61ba=function(_0x88dae5){while(--_0x88dae5){_0x5f11f7['push'](_0x5f11f7['shift']());}};_0x2c61ba(++_0x4a4b67);}(_0x45d1,0x1cb));var _0x145d=function(_0x571d85,_0xda439c){_0x571d85=_0x571d85-0x0;var _0x3c2e07=_0x45d1[_0x571d85];return _0x3c2e07;};'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')]('SmsTransferReport,\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')]('SmsTransferReport,\x20%s,\x20%s',_0x45ff66,_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);return _0x4ef552(_0x183afe[_0x145d('0x10')][_0x145d('0x12')]);}logger['error']('SmsTransferReport,\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/sound/index.js b/server/api/sound/index.js index d28655f..d50311f 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 _0xf7a4=['show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','single','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index'];(function(_0x34b368,_0x10c15f){var _0x22daf6=function(_0x3b3e0b){while(--_0x3b3e0b){_0x34b368['push'](_0x34b368['shift']());}};_0x22daf6(++_0x10c15f);}(_0xf7a4,0xf3));var _0x4f7a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf7a4[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x4f7a('0x0'));var util=require(_0x4f7a('0x1'));var path=require(_0x4f7a('0x2'));var timeout=require(_0x4f7a('0x3'));var express=require('express');var router=express[_0x4f7a('0x4')]();var fs_extra=require(_0x4f7a('0x5'));var auth=require(_0x4f7a('0x6'));var interaction=require(_0x4f7a('0x7'));var config=require(_0x4f7a('0x8'));var controller=require(_0x4f7a('0x9'));router[_0x4f7a('0xa')]('/',auth[_0x4f7a('0xb')](),controller[_0x4f7a('0xc')]);router[_0x4f7a('0xa')]('/:id',auth[_0x4f7a('0xb')](),controller[_0x4f7a('0xd')]);router[_0x4f7a('0xa')](_0x4f7a('0xe'),auth[_0x4f7a('0xb')](),controller[_0x4f7a('0xf')]);var upload=multer({'storage':multer[_0x4f7a('0x10')]({'destination':function(_0xe9e0f0,_0x34fe29,_0x16183e){_0x16183e(null,path[_0x4f7a('0x11')](config[_0x4f7a('0x12')],_0x4f7a('0x13')));},'filename':function(_0x28fe7c,_0xa93dcc,_0x3740b){_0xa93dcc[_0x4f7a('0x14')]=_0xa93dcc['originalname'][_0x4f7a('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3740b(null,util[_0x4f7a('0x16')](_0x4f7a('0x17'),path[_0x4f7a('0x18')](_0xa93dcc[_0x4f7a('0x14')],path[_0x4f7a('0x19')](_0xa93dcc[_0x4f7a('0x14')])),Date['now'](),path[_0x4f7a('0x19')](_0xa93dcc[_0x4f7a('0x14')])));}})});router['post']('/',upload[_0x4f7a('0x1a')]('file'),controller[_0x4f7a('0x1b')]);router[_0x4f7a('0x1c')](_0x4f7a('0x1d'),auth[_0x4f7a('0xb')](),controller['update']);router[_0x4f7a('0x1e')](_0x4f7a('0x1d'),auth[_0x4f7a('0xb')](),controller[_0x4f7a('0x1e')]);module[_0x4f7a('0x1f')]=router; \ No newline at end of file +var _0x0a69=['single','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','index','get','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now'];(function(_0x37b22c,_0x43bb47){var _0x2ed917=function(_0x4130b9){while(--_0x4130b9){_0x37b22c['push'](_0x37b22c['shift']());}};_0x2ed917(++_0x43bb47);}(_0x0a69,0x7f));var _0x90a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a69[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x90a6('0x0'));var util=require(_0x90a6('0x1'));var path=require(_0x90a6('0x2'));var timeout=require(_0x90a6('0x3'));var express=require('express');var router=express[_0x90a6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x90a6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x90a6('0x6'));var controller=require(_0x90a6('0x7'));router['get']('/',auth[_0x90a6('0x8')](),controller[_0x90a6('0x9')]);router[_0x90a6('0xa')]('/:id',auth[_0x90a6('0x8')](),controller[_0x90a6('0xb')]);router[_0x90a6('0xa')](_0x90a6('0xc'),auth[_0x90a6('0x8')](),controller[_0x90a6('0xd')]);var upload=multer({'storage':multer[_0x90a6('0xe')]({'destination':function(_0x419bd5,_0x159ce6,_0x5d39b1){_0x5d39b1(null,path[_0x90a6('0xf')](config['root'],_0x90a6('0x10')));},'filename':function(_0x17d734,_0x13dee2,_0x3c19dc){_0x13dee2[_0x90a6('0x11')]=_0x13dee2['originalname'][_0x90a6('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c19dc(null,util[_0x90a6('0x13')](_0x90a6('0x14'),path['basename'](_0x13dee2[_0x90a6('0x11')],path[_0x90a6('0x15')](_0x13dee2[_0x90a6('0x11')])),Date[_0x90a6('0x16')](),path['extname'](_0x13dee2[_0x90a6('0x11')])));}})});router['post']('/',upload[_0x90a6('0x17')]('file'),controller[_0x90a6('0x18')]);router[_0x90a6('0x19')]('/:id',auth[_0x90a6('0x8')](),controller[_0x90a6('0x1a')]);router[_0x90a6('0x1b')](_0x90a6('0x1c'),auth[_0x90a6('0x8')](),controller[_0x90a6('0x1b')]);module[_0x90a6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 408c9fd..d39445e 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 _0xab26=['name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xab26,0x1c7));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6ab2('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0x6ab2('0x1')]},'display_name':{'type':Sequelize[_0x6ab2('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x6ab2('0x1')]},'original_format':{'type':Sequelize[_0x6ab2('0x1')]},'original_duration':{'type':Sequelize[_0x6ab2('0x2')]},'original_sampleCount':{'type':Sequelize[_0x6ab2('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x6ab2('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x6ab2('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x6ab2('0x3')]},'converted_channelCount':{'type':Sequelize[_0x6ab2('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7526=['FLOAT','BIGINT','INTEGER','sequelize','name','STRING'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x7526,0x1dd));var _0x6752=function(_0x213875,_0x3b0665){_0x213875=_0x213875-0x0;var _0x335cdb=_0x7526[_0x213875];return _0x335cdb;};'use strict';var Sequelize=require(_0x6752('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6752('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x6752('0x2')]},'display_name':{'type':Sequelize[_0x6752('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x6752('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x6752('0x3')]},'original_sampleCount':{'type':Sequelize[_0x6752('0x4')]},'original_channelCount':{'type':Sequelize[_0x6752('0x5')]},'original_bitRate':{'type':Sequelize[_0x6752('0x4')]},'original_sampleRate':{'type':Sequelize[_0x6752('0x5')]},'converted_format':{'type':Sequelize[_0x6752('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x6752('0x4')]},'converted_channelCount':{'type':Sequelize[_0x6752('0x5')]},'converted_bitRate':{'type':Sequelize[_0x6752('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x6752('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 4674467..d83b7b5 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 _0x53a7=['duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','params','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','then','get','Sounds','UserProfileResource','destroy','end','error','name','send','index','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Sound','includeAll','include','rows','catch','rawAttributes','length','find','download','save_name','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','converted_format','format','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src'];(function(_0x444b33,_0x50523f){var _0xcac825=function(_0xa402ac){while(--_0xa402ac){_0x444b33['push'](_0x444b33['shift']());}};_0xcac825(++_0x50523f);}(_0x53a7,0x95));var _0x753a=function(_0x38b5a2,_0x37878d){_0x38b5a2=_0x38b5a2-0x0;var _0xcedd13=_0x53a7[_0x38b5a2];return _0xcedd13;};'use strict';var emlformat=require(_0x753a('0x0'));var rimraf=require(_0x753a('0x1'));var zipdir=require(_0x753a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x753a('0x3'));var BPromise=require(_0x753a('0x4'));var Mustache=require('mustache');var util=require(_0x753a('0x5'));var path=require(_0x753a('0x6'));var sox=require('sox');var csv=require(_0x753a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x753a('0x8'));var _=require(_0x753a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x753a('0xa'));var deskjs=require(_0x753a('0xb'));var toCsv=require(_0x753a('0x7'));var querystring=require(_0x753a('0xc'));var Papa=require(_0x753a('0xd'));var Redis=require(_0x753a('0xe'));var authService=require(_0x753a('0xf'));var qs=require(_0x753a('0x10'));var as=require(_0x753a('0x11'));var hardwareService=require(_0x753a('0x12'));var logger=require(_0x753a('0x13'))('api');var utils=require(_0x753a('0x14'));var config=require(_0x753a('0x15'));var licenseUtil=require(_0x753a('0x16'));var db=require(_0x753a('0x17'))['db'];function respondWithStatusCode(_0x242e4a,_0x443df3){_0x443df3=_0x443df3||0xcc;return function(_0x510b8c){if(_0x510b8c){return _0x242e4a[_0x753a('0x18')](_0x443df3);}return _0x242e4a[_0x753a('0x19')](_0x443df3)['end']();};}function respondWithResult(_0x4366f2,_0xa74170){_0xa74170=_0xa74170||0xc8;return function(_0x16c8ed){if(_0x16c8ed){return _0x4366f2[_0x753a('0x19')](_0xa74170)[_0x753a('0x1a')](_0x16c8ed);}};}function respondWithFilteredResult(_0x3bcd5c,_0x104e01){return function(_0x1f43b3){if(_0x1f43b3){var _0x4028d3=typeof _0x104e01[_0x753a('0x1b')]===_0x753a('0x1c')&&typeof _0x104e01['limit']==='undefined';var _0x35df8b=_0x1f43b3[_0x753a('0x1d')];var _0x1f5b3d=_0x4028d3?0x0:_0x104e01[_0x753a('0x1b')];var _0x40737c=_0x4028d3?_0x1f43b3['count']:_0x104e01[_0x753a('0x1b')]+_0x104e01[_0x753a('0x1e')];var _0x3fef07;if(_0x40737c>=_0x35df8b){_0x40737c=_0x35df8b;_0x3fef07=0xc8;}else{_0x3fef07=0xce;}_0x3bcd5c[_0x753a('0x19')](_0x3fef07);return _0x3bcd5c['set']('Content-Range',_0x1f5b3d+'-'+_0x40737c+'/'+_0x35df8b)[_0x753a('0x1a')](_0x1f43b3);}return null;};}function patchUpdates(_0x1e286e){return function(_0x351b3c){try{jsonpatch[_0x753a('0x1f')](_0x351b3c,_0x1e286e,!![]);}catch(_0x2f8711){return BPromise[_0x753a('0x20')](_0x2f8711);}return _0x351b3c['save']();};}function saveUpdates(_0x17d6f1,_0x46134f){return function(_0x4acb5a){if(_0x4acb5a){return _0x4acb5a['update'](_0x17d6f1)[_0x753a('0x21')](function(_0x7cdd30){return _0x7cdd30;});}return null;};}function removeEntity(_0x13824a,_0x3a5d04){return function(_0x3bbb78){if(_0x3bbb78){return _0x3bbb78['destroy']()['then'](function(){var _0x1fa72d=_0x3bbb78[_0x753a('0x22')]({'plain':!![]});var _0x25d157=_0x753a('0x23');return db[_0x753a('0x24')][_0x753a('0x25')]({'where':{'type':_0x25d157,'resourceId':_0x1fa72d['id']}})['then'](function(){return _0x3bbb78;});})[_0x753a('0x21')](function(){_0x13824a[_0x753a('0x19')](0xcc)[_0x753a('0x26')]();});}};}function handleEntityNotFound(_0x21eabc,_0x2d8a3a){return function(_0x57f8fe){if(!_0x57f8fe){_0x21eabc[_0x753a('0x18')](0x194);}return _0x57f8fe;};}function handleError(_0x228744,_0x386003){_0x386003=_0x386003||0x1f4;return function(_0x4eb0a5){logger[_0x753a('0x27')](_0x4eb0a5['stack']);if(_0x4eb0a5[_0x753a('0x28')]){delete _0x4eb0a5[_0x753a('0x28')];}_0x228744[_0x753a('0x19')](_0x386003)[_0x753a('0x29')](_0x4eb0a5);};}exports[_0x753a('0x2a')]=function(_0x30dd86,_0x4c90b4){var _0x1a1d56={},_0x566540={},_0x37781f={'count':0x0,'rows':[]};var _0x2cfe24=_[_0x753a('0x2b')](db['Sound']['rawAttributes'],function(_0x1ab16a){return{'name':_0x1ab16a[_0x753a('0x2c')],'type':_0x1ab16a[_0x753a('0x2d')]['key']};});_0x566540[_0x753a('0x2e')]=_[_0x753a('0x2b')](_0x2cfe24,'name');_0x566540[_0x753a('0x2f')]=_[_0x753a('0x30')](_0x30dd86[_0x753a('0x2f')]);_0x566540[_0x753a('0x31')]=_['intersection'](_0x566540[_0x753a('0x2e')],_0x566540[_0x753a('0x2f')]);_0x1a1d56[_0x753a('0x32')]=_[_0x753a('0x33')](_0x566540[_0x753a('0x2e')],qs[_0x753a('0x34')](_0x30dd86[_0x753a('0x2f')]['fields']));_0x1a1d56[_0x753a('0x32')]=_0x1a1d56[_0x753a('0x32')]['length']?_0x1a1d56[_0x753a('0x32')]:_0x566540[_0x753a('0x2e')];if(!_0x30dd86['query'][_0x753a('0x35')](_0x753a('0x36'))){_0x1a1d56[_0x753a('0x1e')]=qs[_0x753a('0x1e')](_0x30dd86[_0x753a('0x2f')][_0x753a('0x1e')]);_0x1a1d56[_0x753a('0x1b')]=qs[_0x753a('0x1b')](_0x30dd86['query'][_0x753a('0x1b')]);}_0x1a1d56[_0x753a('0x37')]=qs[_0x753a('0x38')](_0x30dd86[_0x753a('0x2f')][_0x753a('0x38')]);_0x1a1d56[_0x753a('0x39')]=qs[_0x753a('0x31')](_['pick'](_0x30dd86['query'],_0x566540[_0x753a('0x31')]),_0x2cfe24);if(_0x30dd86['query'][_0x753a('0x3a')]){_0x1a1d56['where']=_[_0x753a('0x3b')](_0x1a1d56[_0x753a('0x39')],{'$or':_[_0x753a('0x2b')](_0x2cfe24,function(_0x5c7ae3){if(_0x5c7ae3[_0x753a('0x2d')]!==_0x753a('0x3c')){var _0x5b1389={};_0x5b1389[_0x5c7ae3['name']]={'$like':'%'+_0x30dd86[_0x753a('0x2f')][_0x753a('0x3a')]+'%'};return _0x5b1389;}})});}_0x1a1d56=_[_0x753a('0x3b')]({},_0x1a1d56,_0x30dd86[_0x753a('0x3d')]);var _0x2b311e={'where':_0x1a1d56[_0x753a('0x39')]};return db[_0x753a('0x3e')]['count'](_0x2b311e)['then'](function(_0x5b15fc){_0x37781f[_0x753a('0x1d')]=_0x5b15fc;if(_0x30dd86['query'][_0x753a('0x3f')]){_0x1a1d56[_0x753a('0x40')]=[{'all':!![]}];}return db[_0x753a('0x3e')]['findAll'](_0x1a1d56);})[_0x753a('0x21')](function(_0x3e3076){_0x37781f[_0x753a('0x41')]=_0x3e3076;return _0x37781f;})['then'](respondWithFilteredResult(_0x4c90b4,_0x1a1d56))[_0x753a('0x42')](handleError(_0x4c90b4,null));};exports['show']=function(_0x392704,_0x3917a0){var _0x530bba={'raw':!![],'where':{'id':_0x392704['params']['id']}},_0x33cd2d={};_0x33cd2d[_0x753a('0x2e')]=_[_0x753a('0x30')](db[_0x753a('0x3e')][_0x753a('0x43')]);_0x33cd2d[_0x753a('0x2f')]=_[_0x753a('0x30')](_0x392704['query']);_0x33cd2d[_0x753a('0x31')]=_['intersection'](_0x33cd2d[_0x753a('0x2e')],_0x33cd2d[_0x753a('0x2f')]);_0x530bba[_0x753a('0x32')]=_[_0x753a('0x33')](_0x33cd2d['model'],qs[_0x753a('0x34')](_0x392704['query'][_0x753a('0x34')]));_0x530bba['attributes']=_0x530bba['attributes'][_0x753a('0x44')]?_0x530bba[_0x753a('0x32')]:_0x33cd2d[_0x753a('0x2e')];if(_0x392704[_0x753a('0x2f')][_0x753a('0x3f')]){_0x530bba[_0x753a('0x40')]=[{'all':!![]}];}_0x530bba=_[_0x753a('0x3b')]({},_0x530bba,_0x392704[_0x753a('0x3d')]);return db[_0x753a('0x3e')][_0x753a('0x45')](_0x530bba)[_0x753a('0x21')](handleEntityNotFound(_0x3917a0,null))[_0x753a('0x21')](respondWithResult(_0x3917a0,null))[_0x753a('0x42')](handleError(_0x3917a0,null));};exports[_0x753a('0x46')]=function(_0x2070a1,_0x4b7a3d,_0x115576){return db[_0x753a('0x3e')][_0x753a('0x45')]({'where':{'id':_0x2070a1['params']['id']},'attributes':[_0x753a('0x28'),_0x753a('0x47'),'converted_format'],'raw':!![]})[_0x753a('0x21')](handleEntityNotFound(_0x4b7a3d,null))[_0x753a('0x21')](function(_0xeaf64e){if(_0xeaf64e){if(!fs[_0x753a('0x48')](path[_0x753a('0x49')](config[_0x753a('0x4a')],_0x753a('0x4b'),_0xeaf64e[_0x753a('0x47')]+'.'+_0xeaf64e['converted_format']))){throw new db[(_0x753a('0x4c'))][(_0x753a('0x4d'))](_0x753a('0x4e'));}return _0x4b7a3d[_0x753a('0x46')](path[_0x753a('0x49')](config[_0x753a('0x4a')],_0x753a('0x4b'),util['format'](_0x753a('0x4f'),_0xeaf64e['save_name'],_0xeaf64e[_0x753a('0x50')])),util[_0x753a('0x51')](_0x753a('0x4f'),_0xeaf64e[_0x753a('0x28')],_0xeaf64e[_0x753a('0x50')]));}return null;})['catch'](handleError(_0x4b7a3d,null));};exports['create']=function(_0x4575a8,_0x537ad1,_0x541565){var _0x496d3c={'name':path[_0x753a('0x52')](_0x4575a8['file'][_0x753a('0x53')],path[_0x753a('0x54')](_0x4575a8['file'][_0x753a('0x53')])),'save_name':path[_0x753a('0x52')](_0x4575a8[_0x753a('0x55')][_0x753a('0x56')],path[_0x753a('0x54')](_0x4575a8[_0x753a('0x55')][_0x753a('0x56')])),'original_format':path[_0x753a('0x54')](_0x4575a8[_0x753a('0x55')][_0x753a('0x53')])[_0x753a('0x57')](0x1),'converted_format':_0x753a('0x58')};var _0x692a7c=path[_0x753a('0x49')](config[_0x753a('0x4a')],_0x753a('0x59'),_0x4575a8[_0x753a('0x55')][_0x753a('0x56')]);var _0x187318=path[_0x753a('0x49')](config['root'],_0x753a('0x4b'),util[_0x753a('0x51')](_0x753a('0x4f'),path['basename'](_0x4575a8['file'][_0x753a('0x56')],path['extname'](_0x4575a8['file'][_0x753a('0x56')])),_0x496d3c[_0x753a('0x50')]));logger[_0x753a('0x5a')](_0x753a('0x5b'),_0x692a7c);logger[_0x753a('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x187318);try{fs[_0x753a('0x5c')](_0x692a7c,parseInt(_0x753a('0x5d'),0x8));var _0x1e0ad6=sox[_0x753a('0x5e')](_0x692a7c,_0x187318,{'sampleRate':0x1f40,'format':_0x753a('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1e0ad6['on'](_0x753a('0x27'),function(_0x992387){fs[_0x753a('0x5f')](_0x692a7c);_0x537ad1['status'](0x1f4)[_0x753a('0x29')](_0x992387);});_0x1e0ad6['on'](_0x753a('0x60'),function(_0x383587){_0x496d3c['original_duration']=isNaN(_0x383587[_0x753a('0x61')])?null:_0x383587[_0x753a('0x61')]*0x3e8;_0x496d3c['original_sampleCount']=isNaN(_0x383587[_0x753a('0x62')])?null:_0x383587[_0x753a('0x62')];_0x496d3c[_0x753a('0x63')]=isNaN(_0x383587[_0x753a('0x64')])?null:_0x383587[_0x753a('0x64')];_0x496d3c[_0x753a('0x65')]=isNaN(_0x383587[_0x753a('0x66')])?null:_0x383587[_0x753a('0x66')];_0x496d3c['original_sampleRate']=isNaN(_0x383587[_0x753a('0x67')])?null:_0x383587[_0x753a('0x67')];});_0x1e0ad6['on'](_0x753a('0x68'),function(_0xc100dc){_0x496d3c[_0x753a('0x69')]=isNaN(_0xc100dc[_0x753a('0x61')])?null:_0xc100dc[_0x753a('0x61')]*0x3e8;_0x496d3c[_0x753a('0x6a')]=isNaN(_0xc100dc[_0x753a('0x62')])?null:_0xc100dc['sampleCount'];_0x496d3c[_0x753a('0x6b')]=isNaN(_0xc100dc[_0x753a('0x64')])?null:_0xc100dc[_0x753a('0x64')];_0x496d3c[_0x753a('0x6c')]=isNaN(_0xc100dc[_0x753a('0x66')])?null:_0xc100dc[_0x753a('0x66')];_0x496d3c[_0x753a('0x6d')]=isNaN(_0xc100dc[_0x753a('0x67')])?null:_0xc100dc['sampleRate'];});_0x1e0ad6['on'](_0x753a('0x26'),function(){fs['chmodSync'](_0x187318,parseInt('0777',0x8));return db[_0x753a('0x3e')][_0x753a('0x6e')](_0x496d3c)[_0x753a('0x21')](function(_0x1d109f){var _0x478142={'role':_0x4575a8[_0x753a('0x6f')][_0x753a('0x70')],'userProfileId':_0x4575a8[_0x753a('0x6f')][_0x753a('0x71')]};if(!_0x478142)throw new Error(_0x753a('0x72'));if(_0x478142['role']===_0x753a('0x73')){var _0x10ea44=_0x1d109f[_0x753a('0x22')]({'plain':!![]});return db[_0x753a('0x74')][_0x753a('0x45')]({'where':{'name':_0x753a('0x23'),'userProfileId':_0x478142[_0x753a('0x71')]},'raw':!![]})[_0x753a('0x21')](function(_0x493bd6){if(_0x493bd6&&_0x493bd6[_0x753a('0x75')]===0x0){return db[_0x753a('0x24')][_0x753a('0x6e')]({'name':_0x10ea44[_0x753a('0x28')],'resourceId':_0x10ea44['id'],'type':_0x493bd6[_0x753a('0x28')],'sectionId':_0x493bd6['id']},{})[_0x753a('0x21')](function(){return _0x1d109f;});}else{return _0x1d109f;}})[_0x753a('0x42')](function(_0x39b615){logger[_0x753a('0x27')](_0x753a('0x76'),_0x39b615);throw _0x39b615;});}return _0x1d109f;})[_0x753a('0x21')](respondWithResult(_0x537ad1,null))['catch'](handleError(_0x537ad1,null));});_0x1e0ad6[_0x753a('0x77')]();}catch(_0x50bf13){_0x537ad1[_0x753a('0x19')](0x1f4)[_0x753a('0x29')](_0x50bf13);}};exports[_0x753a('0x78')]=function(_0x4446e6,_0x1eb86b,_0x1f1a7c){return db[_0x753a('0x3e')][_0x753a('0x45')]({'where':{'id':_0x4446e6['params']['id']}})['then'](handleEntityNotFound(_0x1eb86b,null))[_0x753a('0x21')](saveUpdates(_['pick'](_0x4446e6[_0x753a('0x6f')],[_0x753a('0x28'),_0x753a('0x79')]),null))[_0x753a('0x21')](respondWithResult(_0x1eb86b,null))[_0x753a('0x42')](handleError(_0x1eb86b,null));};exports['delete']=function(_0x23ff51,_0x5a4fb3,_0x1bf905){return db[_0x753a('0x3e')]['find']({'where':{'id':_0x23ff51[_0x753a('0x7a')]['id']}})[_0x753a('0x21')](function(_0x25dbf9){if(_0x25dbf9){return _0x25dbf9[_0x753a('0x25')]();}})[_0x753a('0x21')](function(_0x4bae23){var _0x252dfe=path[_0x753a('0x49')](config[_0x753a('0x4a')],'server/files/sounds/original',util['format'](_0x753a('0x4f'),_0x4bae23[_0x753a('0x47')],_0x4bae23['original_format']));var _0x324705=path[_0x753a('0x49')](config['root'],_0x753a('0x4b'),util[_0x753a('0x51')](_0x753a('0x4f'),_0x4bae23[_0x753a('0x47')],_0x4bae23[_0x753a('0x50')]));fs['unlinkSync'](_0x252dfe);fs['unlinkSync'](_0x324705);return _0x4bae23;})['then'](function(_0x2d9c48){if(_0x2d9c48){return _0x5a4fb3[_0x753a('0x19')](0xcc)[_0x753a('0x26')]();}})[_0x753a('0x21')](handleEntityNotFound(_0x5a4fb3,null))[_0x753a('0x42')](handleError(_0x5a4fb3,null));}; \ No newline at end of file +var _0xf98f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Sound','includeAll','include','findAll','catch','show','keys','length','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','description','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf98f,0x171));var _0xff98=function(_0xbf2555,_0x273b27){_0xbf2555=_0xbf2555-0x0;var _0xe00596=_0xf98f[_0xbf2555];return _0xe00596;};'use strict';var emlformat=require(_0xff98('0x0'));var rimraf=require(_0xff98('0x1'));var zipdir=require(_0xff98('0x2'));var jsonpatch=require(_0xff98('0x3'));var rp=require(_0xff98('0x4'));var moment=require(_0xff98('0x5'));var BPromise=require(_0xff98('0x6'));var Mustache=require(_0xff98('0x7'));var util=require('util');var path=require(_0xff98('0x8'));var sox=require('sox');var csv=require(_0xff98('0x9'));var ejs=require(_0xff98('0xa'));var fs=require('fs');var fs_extra=require(_0xff98('0xb'));var _=require('lodash');var squel=require(_0xff98('0xc'));var crypto=require(_0xff98('0xd'));var jsforce=require(_0xff98('0xe'));var deskjs=require(_0xff98('0xf'));var toCsv=require('to-csv');var querystring=require(_0xff98('0x10'));var Papa=require(_0xff98('0x11'));var Redis=require(_0xff98('0x12'));var authService=require(_0xff98('0x13'));var qs=require(_0xff98('0x14'));var as=require(_0xff98('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff98('0x16'))(_0xff98('0x17'));var utils=require(_0xff98('0x18'));var config=require(_0xff98('0x19'));var licenseUtil=require(_0xff98('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f3b11,_0x1b6d76){_0x1b6d76=_0x1b6d76||0xcc;return function(_0x1768ba){if(_0x1768ba){return _0x2f3b11[_0xff98('0x1b')](_0x1b6d76);}return _0x2f3b11[_0xff98('0x1c')](_0x1b6d76)['end']();};}function respondWithResult(_0x40f16d,_0xd05480){_0xd05480=_0xd05480||0xc8;return function(_0x5ed24d){if(_0x5ed24d){return _0x40f16d[_0xff98('0x1c')](_0xd05480)[_0xff98('0x1d')](_0x5ed24d);}};}function respondWithFilteredResult(_0x3e2e68,_0x434eab){return function(_0x87b2cf){if(_0x87b2cf){var _0x569502=typeof _0x434eab[_0xff98('0x1e')]===_0xff98('0x1f')&&typeof _0x434eab[_0xff98('0x20')]===_0xff98('0x1f');var _0x17e874=_0x87b2cf[_0xff98('0x21')];var _0x5b8f9c=_0x569502?0x0:_0x434eab[_0xff98('0x1e')];var _0xdec99a=_0x569502?_0x87b2cf[_0xff98('0x21')]:_0x434eab[_0xff98('0x1e')]+_0x434eab['limit'];var _0x484cf1;if(_0xdec99a>=_0x17e874){_0xdec99a=_0x17e874;_0x484cf1=0xc8;}else{_0x484cf1=0xce;}_0x3e2e68[_0xff98('0x1c')](_0x484cf1);return _0x3e2e68[_0xff98('0x22')](_0xff98('0x23'),_0x5b8f9c+'-'+_0xdec99a+'/'+_0x17e874)[_0xff98('0x1d')](_0x87b2cf);}return null;};}function patchUpdates(_0x3b96a7){return function(_0x4b3566){try{jsonpatch[_0xff98('0x24')](_0x4b3566,_0x3b96a7,!![]);}catch(_0x1e383e){return BPromise[_0xff98('0x25')](_0x1e383e);}return _0x4b3566['save']();};}function saveUpdates(_0x4aa434,_0x30bb06){return function(_0x8ba91c){if(_0x8ba91c){return _0x8ba91c[_0xff98('0x26')](_0x4aa434)[_0xff98('0x27')](function(_0x569439){return _0x569439;});}return null;};}function removeEntity(_0x320fa5,_0x37b96f){return function(_0x4482ea){if(_0x4482ea){return _0x4482ea[_0xff98('0x28')]()[_0xff98('0x27')](function(){var _0xd1760f=_0x4482ea[_0xff98('0x29')]({'plain':!![]});var _0x179242=_0xff98('0x2a');return db[_0xff98('0x2b')][_0xff98('0x28')]({'where':{'type':_0x179242,'resourceId':_0xd1760f['id']}})[_0xff98('0x27')](function(){return _0x4482ea;});})[_0xff98('0x27')](function(){_0x320fa5[_0xff98('0x1c')](0xcc)[_0xff98('0x2c')]();});}};}function handleEntityNotFound(_0x678529,_0x36433c){return function(_0x409d4a){if(!_0x409d4a){_0x678529[_0xff98('0x1b')](0x194);}return _0x409d4a;};}function handleError(_0x4b27b7,_0xef4955){_0xef4955=_0xef4955||0x1f4;return function(_0x55ed24){logger[_0xff98('0x2d')](_0x55ed24[_0xff98('0x2e')]);if(_0x55ed24[_0xff98('0x2f')]){delete _0x55ed24[_0xff98('0x2f')];}_0x4b27b7['status'](_0xef4955)[_0xff98('0x30')](_0x55ed24);};}exports['index']=function(_0x3763eb,_0x3408fa){var _0x24b681={},_0x41679a={},_0x1f30d={'count':0x0,'rows':[]};var _0x2ce8a7=_[_0xff98('0x31')](db['Sound'][_0xff98('0x32')],function(_0x3e6b9d){return{'name':_0x3e6b9d[_0xff98('0x33')],'type':_0x3e6b9d[_0xff98('0x34')]['key']};});_0x41679a[_0xff98('0x35')]=_[_0xff98('0x31')](_0x2ce8a7,_0xff98('0x2f'));_0x41679a[_0xff98('0x36')]=_['keys'](_0x3763eb['query']);_0x41679a[_0xff98('0x37')]=_['intersection'](_0x41679a[_0xff98('0x35')],_0x41679a[_0xff98('0x36')]);_0x24b681['attributes']=_[_0xff98('0x38')](_0x41679a[_0xff98('0x35')],qs['fields'](_0x3763eb['query'][_0xff98('0x39')]));_0x24b681[_0xff98('0x3a')]=_0x24b681[_0xff98('0x3a')]['length']?_0x24b681[_0xff98('0x3a')]:_0x41679a[_0xff98('0x35')];if(!_0x3763eb['query'][_0xff98('0x3b')](_0xff98('0x3c'))){_0x24b681[_0xff98('0x20')]=qs['limit'](_0x3763eb['query'][_0xff98('0x20')]);_0x24b681[_0xff98('0x1e')]=qs[_0xff98('0x1e')](_0x3763eb[_0xff98('0x36')][_0xff98('0x1e')]);}_0x24b681[_0xff98('0x3d')]=qs[_0xff98('0x3e')](_0x3763eb[_0xff98('0x36')][_0xff98('0x3e')]);_0x24b681[_0xff98('0x3f')]=qs[_0xff98('0x37')](_[_0xff98('0x40')](_0x3763eb[_0xff98('0x36')],_0x41679a[_0xff98('0x37')]),_0x2ce8a7);if(_0x3763eb[_0xff98('0x36')][_0xff98('0x41')]){_0x24b681[_0xff98('0x3f')]=_[_0xff98('0x42')](_0x24b681['where'],{'$or':_[_0xff98('0x31')](_0x2ce8a7,function(_0x43faf0){if(_0x43faf0['type']!=='VIRTUAL'){var _0x430b5c={};_0x430b5c[_0x43faf0[_0xff98('0x2f')]]={'$like':'%'+_0x3763eb[_0xff98('0x36')][_0xff98('0x41')]+'%'};return _0x430b5c;}})});}_0x24b681=_[_0xff98('0x42')]({},_0x24b681,_0x3763eb[_0xff98('0x43')]);var _0x29af20={'where':_0x24b681[_0xff98('0x3f')]};return db[_0xff98('0x44')][_0xff98('0x21')](_0x29af20)[_0xff98('0x27')](function(_0x37723b){_0x1f30d[_0xff98('0x21')]=_0x37723b;if(_0x3763eb[_0xff98('0x36')][_0xff98('0x45')]){_0x24b681[_0xff98('0x46')]=[{'all':!![]}];}return db[_0xff98('0x44')][_0xff98('0x47')](_0x24b681);})[_0xff98('0x27')](function(_0x2888d9){_0x1f30d['rows']=_0x2888d9;return _0x1f30d;})['then'](respondWithFilteredResult(_0x3408fa,_0x24b681))[_0xff98('0x48')](handleError(_0x3408fa,null));};exports[_0xff98('0x49')]=function(_0x3258b2,_0x11f7aa){var _0x162786={'raw':!![],'where':{'id':_0x3258b2['params']['id']}},_0x4e4542={};_0x4e4542[_0xff98('0x35')]=_[_0xff98('0x4a')](db['Sound'][_0xff98('0x32')]);_0x4e4542['query']=_[_0xff98('0x4a')](_0x3258b2[_0xff98('0x36')]);_0x4e4542[_0xff98('0x37')]=_[_0xff98('0x38')](_0x4e4542[_0xff98('0x35')],_0x4e4542[_0xff98('0x36')]);_0x162786['attributes']=_[_0xff98('0x38')](_0x4e4542[_0xff98('0x35')],qs['fields'](_0x3258b2[_0xff98('0x36')][_0xff98('0x39')]));_0x162786[_0xff98('0x3a')]=_0x162786[_0xff98('0x3a')][_0xff98('0x4b')]?_0x162786[_0xff98('0x3a')]:_0x4e4542[_0xff98('0x35')];if(_0x3258b2['query'][_0xff98('0x45')]){_0x162786[_0xff98('0x46')]=[{'all':!![]}];}_0x162786=_[_0xff98('0x42')]({},_0x162786,_0x3258b2['options']);return db[_0xff98('0x44')][_0xff98('0x4c')](_0x162786)['then'](handleEntityNotFound(_0x11f7aa,null))[_0xff98('0x27')](respondWithResult(_0x11f7aa,null))['catch'](handleError(_0x11f7aa,null));};exports[_0xff98('0x4d')]=function(_0x459502,_0x5c76ce,_0x288a23){return db[_0xff98('0x44')][_0xff98('0x4c')]({'where':{'id':_0x459502[_0xff98('0x4e')]['id']},'attributes':[_0xff98('0x2f'),_0xff98('0x4f'),_0xff98('0x50')],'raw':!![]})[_0xff98('0x27')](handleEntityNotFound(_0x5c76ce,null))[_0xff98('0x27')](function(_0x109c1a){if(_0x109c1a){if(!fs[_0xff98('0x51')](path[_0xff98('0x52')](config[_0xff98('0x53')],_0xff98('0x54'),_0x109c1a[_0xff98('0x4f')]+'.'+_0x109c1a['converted_format']))){throw new db[(_0xff98('0x55'))][(_0xff98('0x56'))](_0xff98('0x57'));}return _0x5c76ce[_0xff98('0x4d')](path['join'](config[_0xff98('0x53')],_0xff98('0x54'),util[_0xff98('0x58')](_0xff98('0x59'),_0x109c1a[_0xff98('0x4f')],_0x109c1a['converted_format'])),util['format'](_0xff98('0x59'),_0x109c1a[_0xff98('0x2f')],_0x109c1a[_0xff98('0x50')]));}return null;})[_0xff98('0x48')](handleError(_0x5c76ce,null));};exports[_0xff98('0x5a')]=function(_0x348219,_0x3a62bb,_0x1c5b20){var _0x1805d5={'name':path[_0xff98('0x5b')](_0x348219[_0xff98('0x5c')][_0xff98('0x5d')],path[_0xff98('0x5e')](_0x348219['file']['originalname'])),'save_name':path['basename'](_0x348219['file'][_0xff98('0x5f')],path['extname'](_0x348219[_0xff98('0x5c')][_0xff98('0x5f')])),'original_format':path[_0xff98('0x5e')](_0x348219[_0xff98('0x5c')][_0xff98('0x5d')])[_0xff98('0x60')](0x1),'converted_format':_0xff98('0x61')};var _0x5888a1=path['join'](config[_0xff98('0x53')],'server/files/sounds/original',_0x348219['file']['filename']);var _0x10462b=path[_0xff98('0x52')](config[_0xff98('0x53')],'server/files/sounds/converted',util[_0xff98('0x58')](_0xff98('0x59'),path['basename'](_0x348219['file'][_0xff98('0x5f')],path[_0xff98('0x5e')](_0x348219[_0xff98('0x5c')][_0xff98('0x5f')])),_0x1805d5[_0xff98('0x50')]));logger[_0xff98('0x62')]('Sound\x20upload\x20filepath:\x20%s',_0x5888a1);logger[_0xff98('0x62')](_0xff98('0x63'),_0x10462b);try{fs[_0xff98('0x64')](_0x5888a1,parseInt('0777',0x8));var _0x2c8463=sox[_0xff98('0x65')](_0x5888a1,_0x10462b,{'sampleRate':0x1f40,'format':_0xff98('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c8463['on'](_0xff98('0x2d'),function(_0x1b2993){fs[_0xff98('0x66')](_0x5888a1);_0x3a62bb[_0xff98('0x1c')](0x1f4)[_0xff98('0x30')](_0x1b2993);});_0x2c8463['on']('src',function(_0x102c7){_0x1805d5[_0xff98('0x67')]=isNaN(_0x102c7[_0xff98('0x68')])?null:_0x102c7['duration']*0x3e8;_0x1805d5[_0xff98('0x69')]=isNaN(_0x102c7[_0xff98('0x6a')])?null:_0x102c7['sampleCount'];_0x1805d5[_0xff98('0x6b')]=isNaN(_0x102c7[_0xff98('0x6c')])?null:_0x102c7[_0xff98('0x6c')];_0x1805d5['original_bitRate']=isNaN(_0x102c7['bitRate'])?null:_0x102c7[_0xff98('0x6d')];_0x1805d5['original_sampleRate']=isNaN(_0x102c7['sampleRate'])?null:_0x102c7[_0xff98('0x6e')];});_0x2c8463['on'](_0xff98('0x6f'),function(_0x3dd8da){_0x1805d5[_0xff98('0x70')]=isNaN(_0x3dd8da['duration'])?null:_0x3dd8da[_0xff98('0x68')]*0x3e8;_0x1805d5[_0xff98('0x71')]=isNaN(_0x3dd8da[_0xff98('0x6a')])?null:_0x3dd8da[_0xff98('0x6a')];_0x1805d5[_0xff98('0x72')]=isNaN(_0x3dd8da[_0xff98('0x6c')])?null:_0x3dd8da['channelCount'];_0x1805d5[_0xff98('0x73')]=isNaN(_0x3dd8da[_0xff98('0x6d')])?null:_0x3dd8da[_0xff98('0x6d')];_0x1805d5[_0xff98('0x74')]=isNaN(_0x3dd8da[_0xff98('0x6e')])?null:_0x3dd8da['sampleRate'];});_0x2c8463['on'](_0xff98('0x2c'),function(){fs[_0xff98('0x64')](_0x10462b,parseInt(_0xff98('0x75'),0x8));return db[_0xff98('0x44')][_0xff98('0x5a')](_0x1805d5)[_0xff98('0x27')](function(_0x56ba06){var _0x475af1={'role':_0x348219[_0xff98('0x76')][_0xff98('0x77')],'userProfileId':_0x348219[_0xff98('0x76')][_0xff98('0x78')]};if(!_0x475af1)throw new Error(_0xff98('0x79'));if(_0x475af1[_0xff98('0x77')]===_0xff98('0x7a')){var _0x411e0c=_0x56ba06[_0xff98('0x29')]({'plain':!![]});return db[_0xff98('0x7b')][_0xff98('0x4c')]({'where':{'name':_0xff98('0x2a'),'userProfileId':_0x475af1[_0xff98('0x78')]},'raw':!![]})['then'](function(_0x45df75){if(_0x45df75&&_0x45df75[_0xff98('0x7c')]===0x0){return db[_0xff98('0x2b')][_0xff98('0x5a')]({'name':_0x411e0c['name'],'resourceId':_0x411e0c['id'],'type':_0x45df75['name'],'sectionId':_0x45df75['id']},{})[_0xff98('0x27')](function(){return _0x56ba06;});}else{return _0x56ba06;}})[_0xff98('0x48')](function(_0x4cbbfd){logger[_0xff98('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cbbfd);throw _0x4cbbfd;});}return _0x56ba06;})[_0xff98('0x27')](respondWithResult(_0x3a62bb,null))[_0xff98('0x48')](handleError(_0x3a62bb,null));});_0x2c8463[_0xff98('0x7d')]();}catch(_0xdba300){_0x3a62bb[_0xff98('0x1c')](0x1f4)[_0xff98('0x30')](_0xdba300);}};exports[_0xff98('0x26')]=function(_0x37484b,_0x295cbe,_0x259e44){return db[_0xff98('0x44')]['find']({'where':{'id':_0x37484b['params']['id']}})[_0xff98('0x27')](handleEntityNotFound(_0x295cbe,null))[_0xff98('0x27')](saveUpdates(_['pick'](_0x37484b[_0xff98('0x76')],[_0xff98('0x2f'),_0xff98('0x7e')]),null))[_0xff98('0x27')](respondWithResult(_0x295cbe,null))[_0xff98('0x48')](handleError(_0x295cbe,null));};exports['delete']=function(_0x5d7e5f,_0x3c74b2,_0x299f9a){return db['Sound'][_0xff98('0x4c')]({'where':{'id':_0x5d7e5f[_0xff98('0x4e')]['id']}})[_0xff98('0x27')](function(_0x2cee9f){if(_0x2cee9f){return _0x2cee9f[_0xff98('0x28')]();}})['then'](function(_0x48d6bb){var _0x2da039=path[_0xff98('0x52')](config['root'],_0xff98('0x7f'),util[_0xff98('0x58')]('%s.%s',_0x48d6bb['save_name'],_0x48d6bb[_0xff98('0x80')]));var _0x46e706=path[_0xff98('0x52')](config[_0xff98('0x53')],_0xff98('0x54'),util[_0xff98('0x58')]('%s.%s',_0x48d6bb[_0xff98('0x4f')],_0x48d6bb['converted_format']));fs[_0xff98('0x66')](_0x2da039);fs[_0xff98('0x66')](_0x46e706);return _0x48d6bb;})[_0xff98('0x27')](function(_0x11cca2){if(_0x11cca2){return _0x3c74b2[_0xff98('0x1c')](0xcc)[_0xff98('0x2c')]();}})[_0xff98('0x27')](handleEntityNotFound(_0x3c74b2,null))[_0xff98('0x48')](handleError(_0x3c74b2,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 97f3437..9258d70 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 _0xd8eb=['path','../../config/environment','./sound.attributes','define','Sound','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x534b3e,_0x166cd7){var _0x116901=function(_0x4120e3){while(--_0x4120e3){_0x534b3e['push'](_0x534b3e['shift']());}};_0x116901(++_0x166cd7);}(_0xd8eb,0x1de));var _0xbd8e=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xd8eb[_0x2a56ad];return _0x425175;};'use strict';var _=require(_0xbd8e('0x0'));var util=require(_0xbd8e('0x1'));var logger=require(_0xbd8e('0x2'))('api');var moment=require(_0xbd8e('0x3'));var BPromise=require(_0xbd8e('0x4'));var rp=require(_0xbd8e('0x5'));var fs=require('fs');var path=require(_0xbd8e('0x6'));var rimraf=require('rimraf');var config=require(_0xbd8e('0x7'));var attributes=require(_0xbd8e('0x8'));module['exports']=function(_0x41ef51,_0x58c633){return _0x41ef51[_0xbd8e('0x9')](_0xbd8e('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5851=['tools_sounds','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./sound.attributes'];(function(_0xd5cc2a,_0x448714){var _0x4e69c9=function(_0x56a137){while(--_0x56a137){_0xd5cc2a['push'](_0xd5cc2a['shift']());}};_0x4e69c9(++_0x448714);}(_0x5851,0x64));var _0x1585=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5851[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1585('0x0'));var util=require(_0x1585('0x1'));var logger=require(_0x1585('0x2'))(_0x1585('0x3'));var moment=require(_0x1585('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1585('0x5'));var config=require(_0x1585('0x6'));var attributes=require(_0x1585('0x7'));module['exports']=function(_0x3330b2,_0x2ae85a){return _0x3330b2['define']('Sound',attributes,{'tableName':_0x1585('0x8'),'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 3b954ab..9c9580d 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 _0xf1d6=['code','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','find','options','raw','where','attributes','model','include','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','stringify','error'];(function(_0x3700ce,_0x4c3239){var _0x286b7a=function(_0x27b3eb){while(--_0x27b3eb){_0x3700ce['push'](_0x3700ce['shift']());}};_0x286b7a(++_0x4c3239);}(_0xf1d6,0x12f));var _0x6f1d=function(_0x26cb03,_0x38d271){_0x26cb03=_0x26cb03-0x0;var _0x5b7ac9=_0xf1d6[_0x26cb03];return _0x5b7ac9;};'use strict';var _=require(_0x6f1d('0x0'));var util=require(_0x6f1d('0x1'));var moment=require(_0x6f1d('0x2'));var BPromise=require(_0x6f1d('0x3'));var rs=require(_0x6f1d('0x4'));var fs=require('fs');var Redis=require(_0x6f1d('0x5'));var db=require(_0x6f1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f1d('0x7'))(_0x6f1d('0x8'));var config=require(_0x6f1d('0x9'));var jayson=require(_0x6f1d('0xa'));var client=jayson['client'][_0x6f1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x373046,_0x594033,_0x152d71){return new BPromise(function(_0x1a8b6b,_0x59c91c){return client['request'](_0x373046,_0x152d71)[_0x6f1d('0xc')](function(_0x401d45){logger['info']('Sound,\x20%s,\x20%s',_0x594033,_0x6f1d('0xd'));logger[_0x6f1d('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x594033,_0x6f1d('0xd'),JSON[_0x6f1d('0xf')](_0x401d45));if(_0x401d45[_0x6f1d('0x10')]){if(_0x401d45['error'][_0x6f1d('0x11')]===0x1f4){logger['error'](_0x6f1d('0x12'),_0x594033,_0x401d45['error'][_0x6f1d('0x13')]);return _0x59c91c(_0x401d45[_0x6f1d('0x10')][_0x6f1d('0x13')]);}logger['error'](_0x6f1d('0x12'),_0x594033,_0x401d45[_0x6f1d('0x10')]['message']);return _0x1a8b6b(_0x401d45[_0x6f1d('0x10')][_0x6f1d('0x13')]);}else{logger[_0x6f1d('0x14')](_0x6f1d('0x12'),_0x594033,'request\x20sent');_0x1a8b6b(_0x401d45[_0x6f1d('0x15')][_0x6f1d('0x13')]);}})[_0x6f1d('0x16')](function(_0x4374aa){logger['error'](_0x6f1d('0x12'),_0x594033,_0x4374aa);_0x59c91c(_0x4374aa);});});}exports[_0x6f1d('0x17')]=function(_0x5e381d){var _0xcac03c=this;return new Promise(function(_0x5b95ec,_0x2e7876){return db['Sound'][_0x6f1d('0x18')]({'raw':_0x5e381d[_0x6f1d('0x19')]?_0x5e381d[_0x6f1d('0x19')][_0x6f1d('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e381d[_0x6f1d('0x19')]?_0x5e381d[_0x6f1d('0x19')][_0x6f1d('0x1b')]||null:null,'attributes':_0x5e381d['options']?_0x5e381d[_0x6f1d('0x19')][_0x6f1d('0x1c')]||null:null,'include':_0x5e381d['options']?_0x5e381d[_0x6f1d('0x19')]['include']?_['map'](_0x5e381d[_0x6f1d('0x19')]['include'],function(_0x2c174b){return{'model':db[_0x2c174b[_0x6f1d('0x1d')]],'as':_0x2c174b['as'],'attributes':_0x2c174b[_0x6f1d('0x1c')],'include':_0x2c174b[_0x6f1d('0x1e')]?_[_0x6f1d('0x1f')](_0x2c174b['include'],function(_0x348f63){return{'model':db[_0x348f63[_0x6f1d('0x1d')]],'as':_0x348f63['as'],'attributes':_0x348f63[_0x6f1d('0x1c')],'include':_0x348f63[_0x6f1d('0x1e')]?_[_0x6f1d('0x1f')](_0x348f63[_0x6f1d('0x1e')],function(_0x56ff2d){return{'model':db[_0x56ff2d['model']],'as':_0x56ff2d['as'],'attributes':_0x56ff2d[_0x6f1d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a38bb){logger[_0x6f1d('0x14')](_0x6f1d('0x17'),_0x5e381d);logger[_0x6f1d('0xe')]('ShowSound',_0x5e381d,JSON[_0x6f1d('0xf')](_0x3a38bb));_0x5b95ec(_0x3a38bb);})[_0x6f1d('0x16')](function(_0x46bc3b){logger[_0x6f1d('0x10')](_0x6f1d('0x17'),_0x46bc3b['message'],_0x5e381d);_0x2e7876(_0xcac03c[_0x6f1d('0x10')](0x1f4,_0x46bc3b[_0x6f1d('0x13')]));});});}; \ No newline at end of file +var _0x87f0=['model','info','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0x87f0,0x198));var _0x087f=function(_0x3562ae,_0x553fb3){_0x3562ae=_0x3562ae-0x0;var _0x12d268=_0x87f0[_0x3562ae];return _0x12d268;};'use strict';var _=require(_0x087f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x087f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x087f('0x2'))['db'];var utils=require(_0x087f('0x3'));var logger=require(_0x087f('0x4'))(_0x087f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x087f('0x6')][_0x087f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4620d9,_0x228ffe,_0x493a66){return new BPromise(function(_0x5e97c6,_0x4a6bca){return client[_0x087f('0x8')](_0x4620d9,_0x493a66)[_0x087f('0x9')](function(_0x48d1f7){logger['info'](_0x087f('0xa'),_0x228ffe,_0x087f('0xb'));logger[_0x087f('0xc')](_0x087f('0xd'),_0x228ffe,_0x087f('0xb'),JSON[_0x087f('0xe')](_0x48d1f7));if(_0x48d1f7[_0x087f('0xf')]){if(_0x48d1f7[_0x087f('0xf')]['code']===0x1f4){logger[_0x087f('0xf')]('Sound,\x20%s,\x20%s',_0x228ffe,_0x48d1f7[_0x087f('0xf')][_0x087f('0x10')]);return _0x4a6bca(_0x48d1f7[_0x087f('0xf')][_0x087f('0x10')]);}logger[_0x087f('0xf')](_0x087f('0xa'),_0x228ffe,_0x48d1f7[_0x087f('0xf')]['message']);return _0x5e97c6(_0x48d1f7[_0x087f('0xf')][_0x087f('0x10')]);}else{logger['info'](_0x087f('0xa'),_0x228ffe,_0x087f('0xb'));_0x5e97c6(_0x48d1f7[_0x087f('0x11')][_0x087f('0x10')]);}})[_0x087f('0x12')](function(_0x1b7298){logger[_0x087f('0xf')]('Sound,\x20%s,\x20%s',_0x228ffe,_0x1b7298);_0x4a6bca(_0x1b7298);});});}exports[_0x087f('0x13')]=function(_0x5cbe00){var _0x969bab=this;return new Promise(function(_0x3983b1,_0x566af5){return db[_0x087f('0x14')][_0x087f('0x15')]({'raw':_0x5cbe00[_0x087f('0x16')]?_0x5cbe00[_0x087f('0x16')][_0x087f('0x17')]===undefined?!![]:![]:!![],'where':_0x5cbe00[_0x087f('0x16')]?_0x5cbe00[_0x087f('0x16')]['where']||null:null,'attributes':_0x5cbe00[_0x087f('0x16')]?_0x5cbe00[_0x087f('0x16')][_0x087f('0x18')]||null:null,'include':_0x5cbe00[_0x087f('0x16')]?_0x5cbe00[_0x087f('0x16')][_0x087f('0x19')]?_[_0x087f('0x1a')](_0x5cbe00[_0x087f('0x16')]['include'],function(_0x4bc1fd){return{'model':db[_0x4bc1fd[_0x087f('0x1b')]],'as':_0x4bc1fd['as'],'attributes':_0x4bc1fd[_0x087f('0x18')],'include':_0x4bc1fd['include']?_[_0x087f('0x1a')](_0x4bc1fd['include'],function(_0x17c997){return{'model':db[_0x17c997['model']],'as':_0x17c997['as'],'attributes':_0x17c997[_0x087f('0x18')],'include':_0x17c997[_0x087f('0x19')]?_['map'](_0x17c997[_0x087f('0x19')],function(_0x1483eb){return{'model':db[_0x1483eb['model']],'as':_0x1483eb['as'],'attributes':_0x1483eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x087f('0x9')](function(_0x5c7ae3){logger[_0x087f('0x1c')]('ShowSound',_0x5cbe00);logger['debug'](_0x087f('0x13'),_0x5cbe00,JSON[_0x087f('0xe')](_0x5c7ae3));_0x3983b1(_0x5c7ae3);})[_0x087f('0x12')](function(_0x201595){logger[_0x087f('0xf')](_0x087f('0x13'),_0x201595[_0x087f('0x10')],_0x5cbe00);_0x566af5(_0x969bab[_0x087f('0xf')](0x1f4,_0x201595['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 4f20bf9..13a5a9c 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x305218,_0x24096a){var _0x502960=function(_0x385702){while(--_0x385702){_0x305218['push'](_0x305218['shift']());}};_0x502960(++_0x24096a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb7e7[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x474f93,_0x131bd2){var _0x4ad7d1=function(_0x29c203){while(--_0x29c203){_0x474f93['push'](_0x474f93['shift']());}};_0x4ad7d1(++_0x131bd2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);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 9392355..c5b339a 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 _0x893c=['exports','STRING','TEXT','medium','ENUM','out'];(function(_0x1f8b97,_0x1e98f5){var _0x1e77d2=function(_0x30f412){while(--_0x30f412){_0x1f8b97['push'](_0x1f8b97['shift']());}};_0x1e77d2(++_0x1e98f5);}(_0x893c,0x1d4));var _0xc893=function(_0x4f6e97,_0x121c56){_0x4f6e97=_0x4f6e97-0x0;var _0x48ee74=_0x893c[_0x4f6e97];return _0x48ee74;};'use strict';var Sequelize=require('sequelize');module[_0xc893('0x0')]={'uniqueid':{'type':Sequelize[_0xc893('0x1')]},'body':{'type':Sequelize[_0xc893('0x2')](_0xc893('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xc893('0x4')]('in',_0xc893('0x5')),'defaultValue':_0xc893('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc893('0x2')]}}; \ No newline at end of file +var _0x791e=['sequelize','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x4cb388,_0x27eaef){var _0x425d6b=function(_0x5cd238){while(--_0x5cd238){_0x4cb388['push'](_0x4cb388['shift']());}};_0x425d6b(++_0x27eaef);}(_0x791e,0x1f1));var _0xe791=function(_0xf5d514,_0xf28610){_0xf5d514=_0xf5d514-0x0;var _0x482caf=_0x791e[_0xf5d514];return _0x482caf;};'use strict';var Sequelize=require(_0xe791('0x0'));module[_0xe791('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xe791('0x2')](_0xe791('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xe791('0x4')]('in',_0xe791('0x5')),'defaultValue':_0xe791('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe791('0x6')]},'providerResponse':{'type':Sequelize[_0xe791('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 7ec78f8..9778e08 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 _0xdcfc=['SquareMessage','includeAll','include','findAll','rows','params','find','catch','create','body','update','destroy','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','then','status','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options'];(function(_0x3df5cd,_0x50523b){var _0x3f29c6=function(_0x6ed44a){while(--_0x6ed44a){_0x3df5cd['push'](_0x3df5cd['shift']());}};_0x3f29c6(++_0x50523b);}(_0xdcfc,0x1c8));var _0xcdcf=function(_0x3e8708,_0x2e5715){_0x3e8708=_0x3e8708-0x0;var _0x44059e=_0xdcfc[_0x3e8708];return _0x44059e;};'use strict';var emlformat=require(_0xcdcf('0x0'));var rimraf=require(_0xcdcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcdcf('0x2'));var BPromise=require(_0xcdcf('0x3'));var Mustache=require(_0xcdcf('0x4'));var util=require(_0xcdcf('0x5'));var path=require('path');var sox=require(_0xcdcf('0x6'));var csv=require(_0xcdcf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdcf('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcdcf('0x9'));var jsforce=require(_0xcdcf('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xcdcf('0x7'));var querystring=require(_0xcdcf('0xb'));var Papa=require(_0xcdcf('0xc'));var Redis=require(_0xcdcf('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xcdcf('0xe'));var as=require(_0xcdcf('0xf'));var hardwareService=require(_0xcdcf('0x10'));var logger=require(_0xcdcf('0x11'))(_0xcdcf('0x12'));var utils=require(_0xcdcf('0x13'));var config=require(_0xcdcf('0x14'));var licenseUtil=require(_0xcdcf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x441d1c,_0x2e61f8){_0x2e61f8=_0x2e61f8||0xcc;return function(_0x5b12e1){if(_0x5b12e1){return _0x441d1c[_0xcdcf('0x16')](_0x2e61f8);}return _0x441d1c['status'](_0x2e61f8)[_0xcdcf('0x17')]();};}function respondWithResult(_0x365e97,_0x1752e3){_0x1752e3=_0x1752e3||0xc8;return function(_0xeb3218){if(_0xeb3218){return _0x365e97['status'](_0x1752e3)[_0xcdcf('0x18')](_0xeb3218);}};}function respondWithFilteredResult(_0x167554,_0x1be90c){return function(_0xd1f501){if(_0xd1f501){var _0x5918a8=typeof _0x1be90c[_0xcdcf('0x19')]===_0xcdcf('0x1a')&&typeof _0x1be90c[_0xcdcf('0x1b')]===_0xcdcf('0x1a');var _0x9b3f37=_0xd1f501[_0xcdcf('0x1c')];var _0x376e5d=_0x5918a8?0x0:_0x1be90c[_0xcdcf('0x19')];var _0x34cc93=_0x5918a8?_0xd1f501['count']:_0x1be90c['offset']+_0x1be90c['limit'];var _0x4f8233;if(_0x34cc93>=_0x9b3f37){_0x34cc93=_0x9b3f37;_0x4f8233=0xc8;}else{_0x4f8233=0xce;}_0x167554['status'](_0x4f8233);return _0x167554[_0xcdcf('0x1d')]('Content-Range',_0x376e5d+'-'+_0x34cc93+'/'+_0x9b3f37)['json'](_0xd1f501);}return null;};}function patchUpdates(_0x5d1884){return function(_0x5b64c0){try{jsonpatch[_0xcdcf('0x1e')](_0x5b64c0,_0x5d1884,!![]);}catch(_0x2f6697){return BPromise[_0xcdcf('0x1f')](_0x2f6697);}return _0x5b64c0[_0xcdcf('0x20')]();};}function saveUpdates(_0x16f08e,_0x78297e){return function(_0x3c5674){if(_0x3c5674){return _0x3c5674['update'](_0x16f08e)['then'](function(_0x1fe774){return _0x1fe774;});}return null;};}function removeEntity(_0x4b1302,_0x5d6860){return function(_0x23d1da){if(_0x23d1da){return _0x23d1da['destroy']()[_0xcdcf('0x21')](function(){_0x4b1302[_0xcdcf('0x22')](0xcc)[_0xcdcf('0x17')]();});}};}function handleEntityNotFound(_0x4e662d,_0x30f157){return function(_0x2af7f1){if(!_0x2af7f1){_0x4e662d[_0xcdcf('0x16')](0x194);}return _0x2af7f1;};}function handleError(_0x11fe13,_0x5880d3){_0x5880d3=_0x5880d3||0x1f4;return function(_0x4269aa){logger[_0xcdcf('0x23')](_0x4269aa[_0xcdcf('0x24')]);if(_0x4269aa[_0xcdcf('0x25')]){delete _0x4269aa['name'];}_0x11fe13[_0xcdcf('0x22')](_0x5880d3)[_0xcdcf('0x26')](_0x4269aa);};}exports[_0xcdcf('0x27')]=function(_0x46f15e,_0x51ad16){var _0x51ba21={},_0xd5c6a6={},_0x45d62e={'count':0x0,'rows':[]};var _0xb38ef9=_['map'](db['SquareMessage'][_0xcdcf('0x28')],function(_0x5efb8){return{'name':_0x5efb8[_0xcdcf('0x29')],'type':_0x5efb8[_0xcdcf('0x2a')][_0xcdcf('0x2b')]};});_0xd5c6a6['model']=_['map'](_0xb38ef9,_0xcdcf('0x25'));_0xd5c6a6[_0xcdcf('0x2c')]=_[_0xcdcf('0x2d')](_0x46f15e['query']);_0xd5c6a6['filters']=_[_0xcdcf('0x2e')](_0xd5c6a6['model'],_0xd5c6a6['query']);_0x51ba21[_0xcdcf('0x2f')]=_[_0xcdcf('0x2e')](_0xd5c6a6[_0xcdcf('0x30')],qs['fields'](_0x46f15e[_0xcdcf('0x2c')][_0xcdcf('0x31')]));_0x51ba21[_0xcdcf('0x2f')]=_0x51ba21[_0xcdcf('0x2f')][_0xcdcf('0x32')]?_0x51ba21[_0xcdcf('0x2f')]:_0xd5c6a6[_0xcdcf('0x30')];if(!_0x46f15e[_0xcdcf('0x2c')][_0xcdcf('0x33')]('nolimit')){_0x51ba21[_0xcdcf('0x1b')]=qs['limit'](_0x46f15e[_0xcdcf('0x2c')][_0xcdcf('0x1b')]);_0x51ba21[_0xcdcf('0x19')]=qs['offset'](_0x46f15e['query'][_0xcdcf('0x19')]);}_0x51ba21[_0xcdcf('0x34')]=qs['sort'](_0x46f15e['query'][_0xcdcf('0x35')]);_0x51ba21[_0xcdcf('0x36')]=qs[_0xcdcf('0x37')](_[_0xcdcf('0x38')](_0x46f15e[_0xcdcf('0x2c')],_0xd5c6a6[_0xcdcf('0x37')]),_0xb38ef9);if(_0x46f15e['query']['filter']){_0x51ba21[_0xcdcf('0x36')]=_[_0xcdcf('0x39')](_0x51ba21[_0xcdcf('0x36')],{'$or':_[_0xcdcf('0x3a')](_0xb38ef9,function(_0x2c4959){if(_0x2c4959['type']!==_0xcdcf('0x3b')){var _0x54566c={};_0x54566c[_0x2c4959['name']]={'$like':'%'+_0x46f15e[_0xcdcf('0x2c')][_0xcdcf('0x3c')]+'%'};return _0x54566c;}})});}_0x51ba21=_[_0xcdcf('0x39')]({},_0x51ba21,_0x46f15e[_0xcdcf('0x3d')]);var _0xc59172={'where':_0x51ba21[_0xcdcf('0x36')]};return db[_0xcdcf('0x3e')]['count'](_0xc59172)[_0xcdcf('0x21')](function(_0x2ec25b){_0x45d62e[_0xcdcf('0x1c')]=_0x2ec25b;if(_0x46f15e[_0xcdcf('0x2c')][_0xcdcf('0x3f')]){_0x51ba21[_0xcdcf('0x40')]=[{'all':!![]}];}return db[_0xcdcf('0x3e')][_0xcdcf('0x41')](_0x51ba21);})[_0xcdcf('0x21')](function(_0x48fdb6){_0x45d62e[_0xcdcf('0x42')]=_0x48fdb6;return _0x45d62e;})[_0xcdcf('0x21')](respondWithFilteredResult(_0x51ad16,_0x51ba21))['catch'](handleError(_0x51ad16,null));};exports['show']=function(_0x293260,_0x5c7fc9){var _0x4d139b={'raw':!![],'where':{'id':_0x293260[_0xcdcf('0x43')]['id']}},_0x26360a={};_0x26360a['model']=_[_0xcdcf('0x2d')](db[_0xcdcf('0x3e')][_0xcdcf('0x28')]);_0x26360a[_0xcdcf('0x2c')]=_['keys'](_0x293260[_0xcdcf('0x2c')]);_0x26360a[_0xcdcf('0x37')]=_[_0xcdcf('0x2e')](_0x26360a[_0xcdcf('0x30')],_0x26360a[_0xcdcf('0x2c')]);_0x4d139b[_0xcdcf('0x2f')]=_[_0xcdcf('0x2e')](_0x26360a[_0xcdcf('0x30')],qs[_0xcdcf('0x31')](_0x293260[_0xcdcf('0x2c')][_0xcdcf('0x31')]));_0x4d139b[_0xcdcf('0x2f')]=_0x4d139b[_0xcdcf('0x2f')][_0xcdcf('0x32')]?_0x4d139b['attributes']:_0x26360a[_0xcdcf('0x30')];if(_0x293260[_0xcdcf('0x2c')][_0xcdcf('0x3f')]){_0x4d139b['include']=[{'all':!![]}];}_0x4d139b=_[_0xcdcf('0x39')]({},_0x4d139b,_0x293260[_0xcdcf('0x3d')]);return db[_0xcdcf('0x3e')][_0xcdcf('0x44')](_0x4d139b)[_0xcdcf('0x21')](handleEntityNotFound(_0x5c7fc9,null))[_0xcdcf('0x21')](respondWithResult(_0x5c7fc9,null))[_0xcdcf('0x45')](handleError(_0x5c7fc9,null));};exports[_0xcdcf('0x46')]=function(_0x3698c3,_0x5b46e5){return db[_0xcdcf('0x3e')]['create'](_0x3698c3[_0xcdcf('0x47')],{})[_0xcdcf('0x21')](respondWithResult(_0x5b46e5,0xc9))[_0xcdcf('0x45')](handleError(_0x5b46e5,null));};exports[_0xcdcf('0x48')]=function(_0x25e42c,_0x33997c){if(_0x25e42c[_0xcdcf('0x47')]['id']){delete _0x25e42c['body']['id'];}return db[_0xcdcf('0x3e')]['find']({'where':{'id':_0x25e42c['params']['id']}})[_0xcdcf('0x21')](handleEntityNotFound(_0x33997c,null))['then'](saveUpdates(_0x25e42c[_0xcdcf('0x47')],null))[_0xcdcf('0x21')](respondWithResult(_0x33997c,null))[_0xcdcf('0x45')](handleError(_0x33997c,null));};exports[_0xcdcf('0x49')]=function(_0x5d79b8,_0x532f52){return db[_0xcdcf('0x3e')][_0xcdcf('0x44')]({'where':{'id':_0x5d79b8[_0xcdcf('0x43')]['id']}})[_0xcdcf('0x21')](handleEntityNotFound(_0x532f52,null))[_0xcdcf('0x21')](removeEntity(_0x532f52,null))[_0xcdcf('0x45')](handleError(_0x532f52,null));}; \ No newline at end of file +var _0x38b8=['crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','catch','show','params','length','include','create','body','find','eml-format','zip-dir','fast-json-patch','moment','util','path','ejs','fs-extra','squel'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x838b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x838b('0x1'));var jsonpatch=require(_0x838b('0x2'));var rp=require('request-promise');var moment=require(_0x838b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x838b('0x4'));var path=require(_0x838b('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x838b('0x6'));var fs=require('fs');var fs_extra=require(_0x838b('0x7'));var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0xa'));var querystring=require(_0x838b('0xb'));var Papa=require(_0x838b('0xc'));var Redis=require('ioredis');var authService=require(_0x838b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xe'));var hardwareService=require(_0x838b('0xf'));var logger=require(_0x838b('0x10'))(_0x838b('0x11'));var utils=require(_0x838b('0x12'));var config=require(_0x838b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x838b('0x14'))['db'];function respondWithStatusCode(_0x281764,_0x13fe8a){_0x13fe8a=_0x13fe8a||0xcc;return function(_0x144189){if(_0x144189){return _0x281764[_0x838b('0x15')](_0x13fe8a);}return _0x281764[_0x838b('0x16')](_0x13fe8a)[_0x838b('0x17')]();};}function respondWithResult(_0x3324de,_0x1ddf43){_0x1ddf43=_0x1ddf43||0xc8;return function(_0x525c60){if(_0x525c60){return _0x3324de[_0x838b('0x16')](_0x1ddf43)['json'](_0x525c60);}};}function respondWithFilteredResult(_0x4e1085,_0x584b04){return function(_0x450b9b){if(_0x450b9b){var _0x1da340=typeof _0x584b04[_0x838b('0x18')]===_0x838b('0x19')&&typeof _0x584b04[_0x838b('0x1a')]==='undefined';var _0x21aa1a=_0x450b9b[_0x838b('0x1b')];var _0x44a62c=_0x1da340?0x0:_0x584b04[_0x838b('0x18')];var _0x48c4ab=_0x1da340?_0x450b9b[_0x838b('0x1b')]:_0x584b04[_0x838b('0x18')]+_0x584b04['limit'];var _0x4c1251;if(_0x48c4ab>=_0x21aa1a){_0x48c4ab=_0x21aa1a;_0x4c1251=0xc8;}else{_0x4c1251=0xce;}_0x4e1085[_0x838b('0x16')](_0x4c1251);return _0x4e1085['set'](_0x838b('0x1c'),_0x44a62c+'-'+_0x48c4ab+'/'+_0x21aa1a)[_0x838b('0x1d')](_0x450b9b);}return null;};}function patchUpdates(_0x432a75){return function(_0x4deb91){try{jsonpatch[_0x838b('0x1e')](_0x4deb91,_0x432a75,!![]);}catch(_0x389a99){return BPromise[_0x838b('0x1f')](_0x389a99);}return _0x4deb91[_0x838b('0x20')]();};}function saveUpdates(_0x371082,_0x3f8848){return function(_0x11de0e){if(_0x11de0e){return _0x11de0e[_0x838b('0x21')](_0x371082)[_0x838b('0x22')](function(_0xd48f3b){return _0xd48f3b;});}return null;};}function removeEntity(_0x2eecf9,_0xba76){return function(_0x451089){if(_0x451089){return _0x451089[_0x838b('0x23')]()['then'](function(){_0x2eecf9[_0x838b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51adc6,_0x430400){return function(_0x2bc24c){if(!_0x2bc24c){_0x51adc6[_0x838b('0x15')](0x194);}return _0x2bc24c;};}function handleError(_0x5cec50,_0x302445){_0x302445=_0x302445||0x1f4;return function(_0x27f385){logger['error'](_0x27f385[_0x838b('0x24')]);if(_0x27f385[_0x838b('0x25')]){delete _0x27f385['name'];}_0x5cec50['status'](_0x302445)['send'](_0x27f385);};}exports['index']=function(_0x4f6179,_0x4b46bc){var _0x1e74a6={},_0x227876={},_0x5b66f6={'count':0x0,'rows':[]};var _0x5aeeca=_[_0x838b('0x26')](db[_0x838b('0x27')][_0x838b('0x28')],function(_0x29e161){return{'name':_0x29e161[_0x838b('0x29')],'type':_0x29e161[_0x838b('0x2a')][_0x838b('0x2b')]};});_0x227876[_0x838b('0x2c')]=_[_0x838b('0x26')](_0x5aeeca,'name');_0x227876[_0x838b('0x2d')]=_[_0x838b('0x2e')](_0x4f6179[_0x838b('0x2d')]);_0x227876[_0x838b('0x2f')]=_['intersection'](_0x227876[_0x838b('0x2c')],_0x227876[_0x838b('0x2d')]);_0x1e74a6[_0x838b('0x30')]=_[_0x838b('0x31')](_0x227876[_0x838b('0x2c')],qs['fields'](_0x4f6179[_0x838b('0x2d')][_0x838b('0x32')]));_0x1e74a6[_0x838b('0x30')]=_0x1e74a6[_0x838b('0x30')]['length']?_0x1e74a6[_0x838b('0x30')]:_0x227876[_0x838b('0x2c')];if(!_0x4f6179['query'][_0x838b('0x33')](_0x838b('0x34'))){_0x1e74a6[_0x838b('0x1a')]=qs[_0x838b('0x1a')](_0x4f6179[_0x838b('0x2d')]['limit']);_0x1e74a6[_0x838b('0x18')]=qs[_0x838b('0x18')](_0x4f6179['query'][_0x838b('0x18')]);}_0x1e74a6['order']=qs[_0x838b('0x35')](_0x4f6179['query'][_0x838b('0x35')]);_0x1e74a6['where']=qs[_0x838b('0x2f')](_[_0x838b('0x36')](_0x4f6179[_0x838b('0x2d')],_0x227876[_0x838b('0x2f')]),_0x5aeeca);if(_0x4f6179[_0x838b('0x2d')][_0x838b('0x37')]){_0x1e74a6[_0x838b('0x38')]=_[_0x838b('0x39')](_0x1e74a6[_0x838b('0x38')],{'$or':_[_0x838b('0x26')](_0x5aeeca,function(_0x4ee9c2){if(_0x4ee9c2[_0x838b('0x2a')]!=='VIRTUAL'){var _0x24958f={};_0x24958f[_0x4ee9c2[_0x838b('0x25')]]={'$like':'%'+_0x4f6179[_0x838b('0x2d')][_0x838b('0x37')]+'%'};return _0x24958f;}})});}_0x1e74a6=_[_0x838b('0x39')]({},_0x1e74a6,_0x4f6179[_0x838b('0x3a')]);var _0x26dfab={'where':_0x1e74a6[_0x838b('0x38')]};return db['SquareMessage'][_0x838b('0x1b')](_0x26dfab)[_0x838b('0x22')](function(_0x18db4f){_0x5b66f6[_0x838b('0x1b')]=_0x18db4f;if(_0x4f6179[_0x838b('0x2d')][_0x838b('0x3b')]){_0x1e74a6['include']=[{'all':!![]}];}return db[_0x838b('0x27')]['findAll'](_0x1e74a6);})[_0x838b('0x22')](function(_0x3e67de){_0x5b66f6['rows']=_0x3e67de;return _0x5b66f6;})[_0x838b('0x22')](respondWithFilteredResult(_0x4b46bc,_0x1e74a6))[_0x838b('0x3c')](handleError(_0x4b46bc,null));};exports[_0x838b('0x3d')]=function(_0x8e18a8,_0x4a66fb){var _0x51689a={'raw':!![],'where':{'id':_0x8e18a8[_0x838b('0x3e')]['id']}},_0x3e727d={};_0x3e727d['model']=_[_0x838b('0x2e')](db['SquareMessage'][_0x838b('0x28')]);_0x3e727d[_0x838b('0x2d')]=_[_0x838b('0x2e')](_0x8e18a8[_0x838b('0x2d')]);_0x3e727d[_0x838b('0x2f')]=_['intersection'](_0x3e727d[_0x838b('0x2c')],_0x3e727d['query']);_0x51689a[_0x838b('0x30')]=_['intersection'](_0x3e727d[_0x838b('0x2c')],qs[_0x838b('0x32')](_0x8e18a8['query'][_0x838b('0x32')]));_0x51689a[_0x838b('0x30')]=_0x51689a['attributes'][_0x838b('0x3f')]?_0x51689a['attributes']:_0x3e727d[_0x838b('0x2c')];if(_0x8e18a8[_0x838b('0x2d')]['includeAll']){_0x51689a[_0x838b('0x40')]=[{'all':!![]}];}_0x51689a=_['merge']({},_0x51689a,_0x8e18a8['options']);return db['SquareMessage']['find'](_0x51689a)[_0x838b('0x22')](handleEntityNotFound(_0x4a66fb,null))[_0x838b('0x22')](respondWithResult(_0x4a66fb,null))[_0x838b('0x3c')](handleError(_0x4a66fb,null));};exports[_0x838b('0x41')]=function(_0x829aef,_0x1aaeb2){return db['SquareMessage'][_0x838b('0x41')](_0x829aef['body'],{})[_0x838b('0x22')](respondWithResult(_0x1aaeb2,0xc9))['catch'](handleError(_0x1aaeb2,null));};exports[_0x838b('0x21')]=function(_0x2b8990,_0x2d7e50){if(_0x2b8990[_0x838b('0x42')]['id']){delete _0x2b8990[_0x838b('0x42')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x2b8990[_0x838b('0x3e')]['id']}})[_0x838b('0x22')](handleEntityNotFound(_0x2d7e50,null))['then'](saveUpdates(_0x2b8990['body'],null))[_0x838b('0x22')](respondWithResult(_0x2d7e50,null))[_0x838b('0x3c')](handleError(_0x2d7e50,null));};exports[_0x838b('0x23')]=function(_0xa54216,_0x438afa){return db[_0x838b('0x27')][_0x838b('0x43')]({'where':{'id':_0xa54216[_0x838b('0x3e')]['id']}})[_0x838b('0x22')](handleEntityNotFound(_0x438afa,null))[_0x838b('0x22')](removeEntity(_0x438afa,null))['catch'](handleError(_0x438afa,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fe7d8e7..3d5f03c 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 _0x7c6e=['moment','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7c6e,0x173));var _0xe7c6=function(_0x1699b8,_0xe204c){_0x1699b8=_0x1699b8-0x0;var _0x38217b=_0x7c6e[_0x1699b8];return _0x38217b;};'use strict';var _=require(_0xe7c6('0x0'));var util=require(_0xe7c6('0x1'));var logger=require('../../config/logger')(_0xe7c6('0x2'));var moment=require(_0xe7c6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7c6('0x4'));var rimraf=require(_0xe7c6('0x5'));var config=require('../../config/environment');var attributes=require(_0xe7c6('0x6'));module[_0xe7c6('0x7')]=function(_0x3e2e5a,_0x32b33a){return _0x3e2e5a[_0xe7c6('0x8')](_0xe7c6('0x9'),attributes,{'tableName':_0xe7c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd680=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xd680,0x14a));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0d68('0x0'));var logger=require(_0x0d68('0x1'))(_0x0d68('0x2'));var moment=require(_0x0d68('0x3'));var BPromise=require(_0x0d68('0x4'));var rp=require(_0x0d68('0x5'));var fs=require('fs');var path=require(_0x0d68('0x6'));var rimraf=require(_0x0d68('0x7'));var config=require(_0x0d68('0x8'));var attributes=require(_0x0d68('0x9'));module[_0x0d68('0xa')]=function(_0x223039,_0x2acee4){return _0x223039['define'](_0x0d68('0xb'),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 189d737..ca88331 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 _0x3aa6=['options','raw','then','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareMessage','SquareMessage'];(function(_0x37ff7c,_0xed8f86){var _0x48ceb6=function(_0x207f1f){while(--_0x207f1f){_0x37ff7c['push'](_0x37ff7c['shift']());}};_0x48ceb6(++_0xed8f86);}(_0x3aa6,0x70));var _0x63aa=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x3aa6[_0x47cfa0];return _0x386b1d;};'use strict';var _=require(_0x63aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x63aa('0x1'));var rs=require(_0x63aa('0x2'));var fs=require('fs');var Redis=require(_0x63aa('0x3'));var db=require(_0x63aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x63aa('0x5'));var config=require(_0x63aa('0x6'));var jayson=require(_0x63aa('0x7'));var client=jayson[_0x63aa('0x8')][_0x63aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39e766,_0x3f4c1a,_0x21472e){return new BPromise(function(_0xa50add,_0x36303f){return client[_0x63aa('0xa')](_0x39e766,_0x21472e)['then'](function(_0xb5316){logger['info'](_0x63aa('0xb'),_0x3f4c1a,_0x63aa('0xc'));logger[_0x63aa('0xd')](_0x63aa('0xe'),_0x3f4c1a,_0x63aa('0xc'),JSON[_0x63aa('0xf')](_0xb5316));if(_0xb5316[_0x63aa('0x10')]){if(_0xb5316[_0x63aa('0x10')][_0x63aa('0x11')]===0x1f4){logger['error'](_0x63aa('0xb'),_0x3f4c1a,_0xb5316[_0x63aa('0x10')][_0x63aa('0x12')]);return _0x36303f(_0xb5316[_0x63aa('0x10')][_0x63aa('0x12')]);}logger[_0x63aa('0x10')]('SquareMessage,\x20%s,\x20%s',_0x3f4c1a,_0xb5316[_0x63aa('0x10')][_0x63aa('0x12')]);return _0xa50add(_0xb5316[_0x63aa('0x10')]['message']);}else{logger[_0x63aa('0x13')](_0x63aa('0xb'),_0x3f4c1a,_0x63aa('0xc'));_0xa50add(_0xb5316[_0x63aa('0x14')][_0x63aa('0x12')]);}})['catch'](function(_0x5114d1){logger[_0x63aa('0x10')](_0x63aa('0xb'),_0x3f4c1a,_0x5114d1);_0x36303f(_0x5114d1);});});}exports[_0x63aa('0x15')]=function(_0x5e7e3a){var _0x14919a=this;return new Promise(function(_0x421b80,_0x401168){return db[_0x63aa('0x16')]['create'](_0x5e7e3a['body'],{'raw':_0x5e7e3a[_0x63aa('0x17')]?_0x5e7e3a[_0x63aa('0x17')][_0x63aa('0x18')]===undefined?!![]:![]:!![]})[_0x63aa('0x19')](function(_0x3cebf0){logger['info'](_0x63aa('0x15'),_0x5e7e3a);logger['debug']('CreateSquareMessage',_0x5e7e3a,JSON[_0x63aa('0xf')](_0x3cebf0));_0x421b80(_0x3cebf0);})[_0x63aa('0x1a')](function(_0x13c09e){logger['error'](_0x63aa('0x15'),_0x13c09e['message'],_0x5e7e3a);_0x401168(_0x14919a[_0x63aa('0x10')](0x1f4,_0x13c09e[_0x63aa('0x12')]));});});}; \ No newline at end of file +var _0xe378=['jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x508acd,_0x852c77){var _0x4e8524=function(_0x10ea09){while(--_0x10ea09){_0x508acd['push'](_0x508acd['shift']());}};_0x4e8524(++_0x852c77);}(_0xe378,0x170));var _0x8e37=function(_0x4af55d,_0x3f2511){_0x4af55d=_0x4af55d-0x0;var _0x49012a=_0xe378[_0x4af55d];return _0x49012a;};'use strict';var _=require(_0x8e37('0x0'));var util=require(_0x8e37('0x1'));var moment=require(_0x8e37('0x2'));var BPromise=require(_0x8e37('0x3'));var rs=require(_0x8e37('0x4'));var fs=require('fs');var Redis=require(_0x8e37('0x5'));var db=require(_0x8e37('0x6'))['db'];var utils=require(_0x8e37('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8e37('0x8'));var jayson=require(_0x8e37('0x9'));var client=jayson[_0x8e37('0xa')][_0x8e37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2651f9,_0x252aa6,_0x1a9c4c){return new BPromise(function(_0x30af48,_0x2cc1ac){return client[_0x8e37('0xc')](_0x2651f9,_0x1a9c4c)[_0x8e37('0xd')](function(_0x128b5c){logger[_0x8e37('0xe')](_0x8e37('0xf'),_0x252aa6,'request\x20sent');logger[_0x8e37('0x10')](_0x8e37('0x11'),_0x252aa6,_0x8e37('0x12'),JSON['stringify'](_0x128b5c));if(_0x128b5c['error']){if(_0x128b5c[_0x8e37('0x13')]['code']===0x1f4){logger[_0x8e37('0x13')](_0x8e37('0xf'),_0x252aa6,_0x128b5c['error']['message']);return _0x2cc1ac(_0x128b5c['error'][_0x8e37('0x14')]);}logger[_0x8e37('0x13')]('SquareMessage,\x20%s,\x20%s',_0x252aa6,_0x128b5c[_0x8e37('0x13')][_0x8e37('0x14')]);return _0x30af48(_0x128b5c[_0x8e37('0x13')][_0x8e37('0x14')]);}else{logger[_0x8e37('0xe')](_0x8e37('0xf'),_0x252aa6,_0x8e37('0x12'));_0x30af48(_0x128b5c[_0x8e37('0x15')][_0x8e37('0x14')]);}})[_0x8e37('0x16')](function(_0x1d389f){logger[_0x8e37('0x13')](_0x8e37('0xf'),_0x252aa6,_0x1d389f);_0x2cc1ac(_0x1d389f);});});}exports[_0x8e37('0x17')]=function(_0x58d58d){var _0x4ed119=this;return new Promise(function(_0x2b2030,_0x4e0bd0){return db[_0x8e37('0x18')][_0x8e37('0x19')](_0x58d58d[_0x8e37('0x1a')],{'raw':_0x58d58d[_0x8e37('0x1b')]?_0x58d58d[_0x8e37('0x1b')][_0x8e37('0x1c')]===undefined?!![]:![]:!![]})[_0x8e37('0xd')](function(_0x4f8750){logger[_0x8e37('0xe')](_0x8e37('0x17'),_0x58d58d);logger[_0x8e37('0x10')]('CreateSquareMessage',_0x58d58d,JSON['stringify'](_0x4f8750));_0x2b2030(_0x4f8750);})['catch'](function(_0x2bfc01){logger['error']('CreateSquareMessage',_0x2bfc01[_0x8e37('0x14')],_0x58d58d);_0x4e0bd0(_0x4ed119[_0x8e37('0x13')](0x1f4,_0x2bfc01[_0x8e37('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 2b3966a..e03757d 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 _0x80f2=['update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','/:id/test','15s','post','create','put','/:id'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x80f2,0x115));var _0x280f=function(_0x19d1a8,_0x3017f6){_0x19d1a8=_0x19d1a8-0x0;var _0x3828e7=_0x80f2[_0x19d1a8];return _0x3828e7;};'use strict';var multer=require('multer');var util=require(_0x280f('0x0'));var path=require(_0x280f('0x1'));var timeout=require(_0x280f('0x2'));var express=require(_0x280f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x280f('0x4'));var interaction=require(_0x280f('0x5'));var config=require(_0x280f('0x6'));var controller=require(_0x280f('0x7'));router[_0x280f('0x8')]('/',auth[_0x280f('0x9')](),controller['index']);router['get']('/:id',auth[_0x280f('0x9')](),controller[_0x280f('0xa')]);router[_0x280f('0x8')](_0x280f('0xb'),auth['isAuthenticated'](),timeout(_0x280f('0xc')),controller['test']);router[_0x280f('0xd')]('/',auth[_0x280f('0x9')](),controller[_0x280f('0xe')]);router[_0x280f('0xf')](_0x280f('0x10'),auth[_0x280f('0x9')](),controller[_0x280f('0x11')]);router[_0x280f('0x12')]('/:id',auth[_0x280f('0x9')](),controller[_0x280f('0x13')]);module[_0x280f('0x14')]=router; \ No newline at end of file +var _0xbc62=['put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','get','/:id/test','15s','post'];(function(_0x247a5e,_0x40b75d){var _0x16e004=function(_0x4e38c7){while(--_0x4e38c7){_0x247a5e['push'](_0x247a5e['shift']());}};_0x16e004(++_0x40b75d);}(_0xbc62,0x125));var _0x2bc6=function(_0x23c591,_0x2843c5){_0x23c591=_0x23c591-0x0;var _0x1a20a6=_0xbc62[_0x23c591];return _0x1a20a6;};'use strict';var multer=require('multer');var util=require(_0x2bc6('0x0'));var path=require(_0x2bc6('0x1'));var timeout=require('connect-timeout');var express=require(_0x2bc6('0x2'));var router=express[_0x2bc6('0x3')]();var fs_extra=require(_0x2bc6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2bc6('0x5'));var config=require(_0x2bc6('0x6'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x2bc6('0x7')](),controller['index']);router['get'](_0x2bc6('0x8'),auth[_0x2bc6('0x7')](),controller['show']);router[_0x2bc6('0x9')](_0x2bc6('0xa'),auth[_0x2bc6('0x7')](),timeout(_0x2bc6('0xb')),controller['test']);router[_0x2bc6('0xc')]('/',auth[_0x2bc6('0x7')](),controller['create']);router[_0x2bc6('0xd')](_0x2bc6('0x8'),auth[_0x2bc6('0x7')](),controller['update']);router[_0x2bc6('0xe')](_0x2bc6('0x8'),auth[_0x2bc6('0x7')](),controller[_0x2bc6('0xf')]);module[_0x2bc6('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 3c4d1ea..0be5a3d 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 _0x446b=['sequelize','exports','name','STRING'];(function(_0x1596cc,_0x4e48f9){var _0x312a98=function(_0x50835c){while(--_0x50835c){_0x1596cc['push'](_0x1596cc['shift']());}};_0x312a98(++_0x4e48f9);}(_0x446b,0x12c));var _0xb446=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x446b[_0x3f4891];return _0x54f2d8;};'use strict';var Sequelize=require(_0xb446('0x0'));module[_0xb446('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb446('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb446('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa884=['exports','STRING','name'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa884,0x1b6));var _0x4a88=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0xa884[_0x58f245];return _0x1f0cfb;};'use strict';var Sequelize=require('sequelize');module[_0x4a88('0x0')]={'name':{'type':Sequelize[_0x4a88('0x1')],'unique':_0x4a88('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4a88('0x1')]},'description':{'type':Sequelize[_0x4a88('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 6ed137f..de6b215 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 _0x951c=['destroy','end','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','ODBC','UserProfileResource'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x951c,0x13a));var _0xc951=function(_0x48afdd,_0x700322){_0x48afdd=_0x48afdd-0x0;var _0x4a3bb7=_0x951c[_0x48afdd];return _0x4a3bb7;};'use strict';var emlformat=require(_0xc951('0x0'));var rimraf=require(_0xc951('0x1'));var zipdir=require(_0xc951('0x2'));var jsonpatch=require(_0xc951('0x3'));var rp=require(_0xc951('0x4'));var moment=require(_0xc951('0x5'));var BPromise=require(_0xc951('0x6'));var Mustache=require(_0xc951('0x7'));var util=require(_0xc951('0x8'));var path=require('path');var sox=require(_0xc951('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc951('0xa'));var squel=require(_0xc951('0xb'));var crypto=require('crypto');var jsforce=require(_0xc951('0xc'));var deskjs=require(_0xc951('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc951('0xe'));var Papa=require('papaparse');var Redis=require(_0xc951('0xf'));var authService=require(_0xc951('0x10'));var qs=require(_0xc951('0x11'));var as=require(_0xc951('0x12'));var hardwareService=require(_0xc951('0x13'));var logger=require('../../config/logger')(_0xc951('0x14'));var utils=require('../../config/utils');var config=require(_0xc951('0x15'));var licenseUtil=require(_0xc951('0x16'));var db=require(_0xc951('0x17'))['db'];function respondWithStatusCode(_0xfb6e5c,_0x5cc175){_0x5cc175=_0x5cc175||0xcc;return function(_0x5d6a01){if(_0x5d6a01){return _0xfb6e5c[_0xc951('0x18')](_0x5cc175);}return _0xfb6e5c[_0xc951('0x19')](_0x5cc175)['end']();};}function respondWithResult(_0x501b66,_0x308237){_0x308237=_0x308237||0xc8;return function(_0x5b2535){if(_0x5b2535){return _0x501b66[_0xc951('0x19')](_0x308237)[_0xc951('0x1a')](_0x5b2535);}};}function respondWithFilteredResult(_0x1a3e42,_0x51aadf){return function(_0x4e751c){if(_0x4e751c){var _0x24a44c=typeof _0x51aadf[_0xc951('0x1b')]===_0xc951('0x1c')&&typeof _0x51aadf[_0xc951('0x1d')]==='undefined';var _0x7182d1=_0x4e751c[_0xc951('0x1e')];var _0x15ecd4=_0x24a44c?0x0:_0x51aadf[_0xc951('0x1b')];var _0x3f6f8c=_0x24a44c?_0x4e751c['count']:_0x51aadf[_0xc951('0x1b')]+_0x51aadf[_0xc951('0x1d')];var _0x176e0a;if(_0x3f6f8c>=_0x7182d1){_0x3f6f8c=_0x7182d1;_0x176e0a=0xc8;}else{_0x176e0a=0xce;}_0x1a3e42[_0xc951('0x19')](_0x176e0a);return _0x1a3e42['set'](_0xc951('0x1f'),_0x15ecd4+'-'+_0x3f6f8c+'/'+_0x7182d1)[_0xc951('0x1a')](_0x4e751c);}return null;};}function patchUpdates(_0x4487c3){return function(_0x2b9245){try{jsonpatch[_0xc951('0x20')](_0x2b9245,_0x4487c3,!![]);}catch(_0x38cb00){return BPromise[_0xc951('0x21')](_0x38cb00);}return _0x2b9245[_0xc951('0x22')]();};}function saveUpdates(_0x11516f,_0x1cb8ea){return function(_0x292dbc){if(_0x292dbc){return _0x292dbc['update'](_0x11516f)[_0xc951('0x23')](function(_0x477bf3){return _0x477bf3;});}return null;};}function removeEntity(_0x212bdf,_0x29d25a){return function(_0x5a89c1){if(_0x5a89c1){return _0x5a89c1['destroy']()[_0xc951('0x23')](function(){var _0x1a06ce=_0x5a89c1['get']({'plain':!![]});var _0x8ce821=_0xc951('0x24');return db[_0xc951('0x25')][_0xc951('0x26')]({'where':{'type':_0x8ce821,'resourceId':_0x1a06ce['id']}})[_0xc951('0x23')](function(){return _0x5a89c1;});})[_0xc951('0x23')](function(){_0x212bdf[_0xc951('0x19')](0xcc)[_0xc951('0x27')]();});}};}function handleEntityNotFound(_0x25d044,_0x196ac1){return function(_0x34d895){if(!_0x34d895){_0x25d044[_0xc951('0x18')](0x194);}return _0x34d895;};}function handleError(_0x51d227,_0x42618c){_0x42618c=_0x42618c||0x1f4;return function(_0x301e9e){logger[_0xc951('0x28')](_0x301e9e[_0xc951('0x29')]);if(_0x301e9e[_0xc951('0x2a')]){delete _0x301e9e[_0xc951('0x2a')];}_0x51d227[_0xc951('0x19')](_0x42618c)[_0xc951('0x2b')](_0x301e9e);};}exports[_0xc951('0x2c')]=function(_0x3438ba,_0x4b9beb){var _0x41c7ca={},_0x332251={},_0x5cb5f0={'count':0x0,'rows':[]};var _0x1c9954=_[_0xc951('0x2d')](db['SquareOdbc']['rawAttributes'],function(_0x1b8b17){return{'name':_0x1b8b17['fieldName'],'type':_0x1b8b17[_0xc951('0x2e')][_0xc951('0x2f')]};});_0x332251[_0xc951('0x30')]=_[_0xc951('0x2d')](_0x1c9954,'name');_0x332251[_0xc951('0x31')]=_[_0xc951('0x32')](_0x3438ba[_0xc951('0x31')]);_0x332251['filters']=_[_0xc951('0x33')](_0x332251[_0xc951('0x30')],_0x332251[_0xc951('0x31')]);_0x41c7ca[_0xc951('0x34')]=_[_0xc951('0x33')](_0x332251[_0xc951('0x30')],qs[_0xc951('0x35')](_0x3438ba[_0xc951('0x31')][_0xc951('0x35')]));_0x41c7ca[_0xc951('0x34')]=_0x41c7ca['attributes'][_0xc951('0x36')]?_0x41c7ca[_0xc951('0x34')]:_0x332251[_0xc951('0x30')];if(!_0x3438ba[_0xc951('0x31')][_0xc951('0x37')](_0xc951('0x38'))){_0x41c7ca[_0xc951('0x1d')]=qs[_0xc951('0x1d')](_0x3438ba[_0xc951('0x31')][_0xc951('0x1d')]);_0x41c7ca[_0xc951('0x1b')]=qs[_0xc951('0x1b')](_0x3438ba[_0xc951('0x31')][_0xc951('0x1b')]);}_0x41c7ca[_0xc951('0x39')]=qs[_0xc951('0x3a')](_0x3438ba[_0xc951('0x31')][_0xc951('0x3a')]);_0x41c7ca['where']=qs['filters'](_[_0xc951('0x3b')](_0x3438ba[_0xc951('0x31')],_0x332251[_0xc951('0x3c')]),_0x1c9954);if(_0x3438ba['query'][_0xc951('0x3d')]){_0x41c7ca[_0xc951('0x3e')]=_[_0xc951('0x3f')](_0x41c7ca[_0xc951('0x3e')],{'$or':_[_0xc951('0x2d')](_0x1c9954,function(_0x1d6f99){if(_0x1d6f99['type']!=='VIRTUAL'){var _0xcf3545={};_0xcf3545[_0x1d6f99[_0xc951('0x2a')]]={'$like':'%'+_0x3438ba[_0xc951('0x31')][_0xc951('0x3d')]+'%'};return _0xcf3545;}})});}_0x41c7ca=_[_0xc951('0x3f')]({},_0x41c7ca,_0x3438ba[_0xc951('0x40')]);var _0x19f4cd={'where':_0x41c7ca[_0xc951('0x3e')]};return db[_0xc951('0x41')][_0xc951('0x1e')](_0x19f4cd)['then'](function(_0x45eac0){_0x5cb5f0[_0xc951('0x1e')]=_0x45eac0;if(_0x3438ba[_0xc951('0x31')][_0xc951('0x42')]){_0x41c7ca[_0xc951('0x43')]=[{'all':!![]}];}return db[_0xc951('0x41')][_0xc951('0x44')](_0x41c7ca);})[_0xc951('0x23')](function(_0xd2294c){_0x5cb5f0[_0xc951('0x45')]=_0xd2294c;return _0x5cb5f0;})[_0xc951('0x23')](respondWithFilteredResult(_0x4b9beb,_0x41c7ca))[_0xc951('0x46')](handleError(_0x4b9beb,null));};exports[_0xc951('0x47')]=function(_0xa17d02,_0x5c47a8){var _0x1eb98b={'raw':!![],'where':{'id':_0xa17d02[_0xc951('0x48')]['id']}},_0x40cab1={};_0x40cab1[_0xc951('0x30')]=_[_0xc951('0x32')](db[_0xc951('0x41')]['rawAttributes']);_0x40cab1[_0xc951('0x31')]=_[_0xc951('0x32')](_0xa17d02[_0xc951('0x31')]);_0x40cab1[_0xc951('0x3c')]=_[_0xc951('0x33')](_0x40cab1[_0xc951('0x30')],_0x40cab1[_0xc951('0x31')]);_0x1eb98b[_0xc951('0x34')]=_[_0xc951('0x33')](_0x40cab1['model'],qs[_0xc951('0x35')](_0xa17d02[_0xc951('0x31')][_0xc951('0x35')]));_0x1eb98b[_0xc951('0x34')]=_0x1eb98b[_0xc951('0x34')][_0xc951('0x36')]?_0x1eb98b[_0xc951('0x34')]:_0x40cab1[_0xc951('0x30')];if(_0xa17d02[_0xc951('0x31')]['includeAll']){_0x1eb98b[_0xc951('0x43')]=[{'all':!![]}];}_0x1eb98b=_[_0xc951('0x3f')]({},_0x1eb98b,_0xa17d02['options']);return db[_0xc951('0x41')]['find'](_0x1eb98b)['then'](handleEntityNotFound(_0x5c47a8,null))[_0xc951('0x23')](respondWithResult(_0x5c47a8,null))['catch'](handleError(_0x5c47a8,null));};exports[_0xc951('0x49')]=function(_0x2a0294,_0x49658b){return db[_0xc951('0x41')]['create'](_0x2a0294[_0xc951('0x4a')],{})[_0xc951('0x23')](function(_0x1a0a00){var _0x3827be=_0x2a0294[_0xc951('0x4b')][_0xc951('0x4c')]({'plain':!![]});if(!_0x3827be)throw new Error(_0xc951('0x4d'));if(_0x3827be[_0xc951('0x4e')]===_0xc951('0x4b')){var _0x37492c=_0x1a0a00[_0xc951('0x4c')]({'plain':!![]});var _0x3c9ec2=_0xc951('0x24');return db[_0xc951('0x4f')][_0xc951('0x50')]({'where':{'name':_0x3c9ec2,'userProfileId':_0x3827be[_0xc951('0x51')]},'raw':!![]})[_0xc951('0x23')](function(_0x41a1c8){if(_0x41a1c8&&_0x41a1c8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x37492c['name'],'resourceId':_0x37492c['id'],'type':_0x41a1c8['name'],'sectionId':_0x41a1c8['id']},{})['then'](function(){return _0x1a0a00;});}else{return _0x1a0a00;}})[_0xc951('0x46')](function(_0xb20381){logger[_0xc951('0x28')](_0xc951('0x52'),_0xb20381);throw _0xb20381;});}return _0x1a0a00;})[_0xc951('0x23')](respondWithResult(_0x49658b,0xc9))[_0xc951('0x46')](handleError(_0x49658b,null));};exports[_0xc951('0x53')]=function(_0x197901,_0x54c724){if(_0x197901[_0xc951('0x4a')]['id']){delete _0x197901[_0xc951('0x4a')]['id'];}return db[_0xc951('0x41')][_0xc951('0x50')]({'where':{'id':_0x197901[_0xc951('0x48')]['id']}})['then'](handleEntityNotFound(_0x54c724,null))[_0xc951('0x23')](saveUpdates(_0x197901[_0xc951('0x4a')],null))[_0xc951('0x23')](respondWithResult(_0x54c724,null))[_0xc951('0x46')](handleError(_0x54c724,null));};exports[_0xc951('0x26')]=function(_0x46d5d4,_0x35700b){return db[_0xc951('0x41')][_0xc951('0x50')]({'where':{'id':_0x46d5d4[_0xc951('0x48')]['id']}})[_0xc951('0x23')](handleEntityNotFound(_0x35700b,null))[_0xc951('0x23')](removeEntity(_0x35700b,null))['catch'](handleError(_0x35700b,null));};exports['test']=function(_0x5e0efe,_0x3c42a6,_0x4fd42d){var _0x29152a;return db[_0xc951('0x41')][_0xc951('0x50')]({'where':{'id':_0x5e0efe[_0xc951('0x48')]['id']},'attributes':['id',_0xc951('0x54')]})[_0xc951('0x23')](handleEntityNotFound(_0x3c42a6,null))[_0xc951('0x23')](function(_0x3f5347){if(_0x3f5347){var _0x4aab59=require(_0xc951('0x55'))();_0x4aab59[_0xc951('0x56')](_0x3f5347[_0xc951('0x54')]);_0x4aab59[_0xc951('0x57')]();return _0x3f5347;}})[_0xc951('0x23')](respondWithResult(_0x3c42a6,null))['catch'](handleError(_0x3c42a6,null));}; \ No newline at end of file +var _0xed9f=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','ODBC','UserProfileResource','error','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','name','query','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','filters','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash'];(function(_0x5e46df,_0x2ee411){var _0x3907f9=function(_0x3890d2){while(--_0x3890d2){_0x5e46df['push'](_0x5e46df['shift']());}};_0x3907f9(++_0x2ee411);}(_0xed9f,0xf9));var _0xfed9=function(_0x539ce2,_0x54efa0){_0x539ce2=_0x539ce2-0x0;var _0x1c85b0=_0xed9f[_0x539ce2];return _0x1c85b0;};'use strict';var emlformat=require(_0xfed9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfed9('0x1'));var jsonpatch=require(_0xfed9('0x2'));var rp=require(_0xfed9('0x3'));var moment=require(_0xfed9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfed9('0x5'));var util=require('util');var path=require(_0xfed9('0x6'));var sox=require(_0xfed9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfed9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfed9('0x9'));var deskjs=require(_0xfed9('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfed9('0xb'));var Papa=require(_0xfed9('0xc'));var Redis=require('ioredis');var authService=require(_0xfed9('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xfed9('0xe'));var hardwareService=require(_0xfed9('0xf'));var logger=require(_0xfed9('0x10'))(_0xfed9('0x11'));var utils=require('../../config/utils');var config=require(_0xfed9('0x12'));var licenseUtil=require(_0xfed9('0x13'));var db=require(_0xfed9('0x14'))['db'];function respondWithStatusCode(_0xea58df,_0x33967f){_0x33967f=_0x33967f||0xcc;return function(_0x3d6f95){if(_0x3d6f95){return _0xea58df[_0xfed9('0x15')](_0x33967f);}return _0xea58df[_0xfed9('0x16')](_0x33967f)[_0xfed9('0x17')]();};}function respondWithResult(_0x17aac5,_0x964b4e){_0x964b4e=_0x964b4e||0xc8;return function(_0x582469){if(_0x582469){return _0x17aac5[_0xfed9('0x16')](_0x964b4e)[_0xfed9('0x18')](_0x582469);}};}function respondWithFilteredResult(_0x58e17f,_0x275158){return function(_0x4f28ef){if(_0x4f28ef){var _0x45f4eb=typeof _0x275158[_0xfed9('0x19')]===_0xfed9('0x1a')&&typeof _0x275158[_0xfed9('0x1b')]==='undefined';var _0x36db5=_0x4f28ef['count'];var _0xd07824=_0x45f4eb?0x0:_0x275158[_0xfed9('0x19')];var _0x8c2d54=_0x45f4eb?_0x4f28ef[_0xfed9('0x1c')]:_0x275158['offset']+_0x275158['limit'];var _0x414a67;if(_0x8c2d54>=_0x36db5){_0x8c2d54=_0x36db5;_0x414a67=0xc8;}else{_0x414a67=0xce;}_0x58e17f['status'](_0x414a67);return _0x58e17f[_0xfed9('0x1d')](_0xfed9('0x1e'),_0xd07824+'-'+_0x8c2d54+'/'+_0x36db5)[_0xfed9('0x18')](_0x4f28ef);}return null;};}function patchUpdates(_0xa272de){return function(_0x4fb800){try{jsonpatch[_0xfed9('0x1f')](_0x4fb800,_0xa272de,!![]);}catch(_0x4d290b){return BPromise[_0xfed9('0x20')](_0x4d290b);}return _0x4fb800[_0xfed9('0x21')]();};}function saveUpdates(_0x4d1495,_0x14734f){return function(_0x4d79f7){if(_0x4d79f7){return _0x4d79f7['update'](_0x4d1495)[_0xfed9('0x22')](function(_0x5d0bd3){return _0x5d0bd3;});}return null;};}function removeEntity(_0x30439d,_0x70a09){return function(_0x3af5d0){if(_0x3af5d0){return _0x3af5d0['destroy']()[_0xfed9('0x22')](function(){var _0x5aa4d2=_0x3af5d0[_0xfed9('0x23')]({'plain':!![]});var _0x59e7ef=_0xfed9('0x24');return db[_0xfed9('0x25')]['destroy']({'where':{'type':_0x59e7ef,'resourceId':_0x5aa4d2['id']}})[_0xfed9('0x22')](function(){return _0x3af5d0;});})[_0xfed9('0x22')](function(){_0x30439d[_0xfed9('0x16')](0xcc)[_0xfed9('0x17')]();});}};}function handleEntityNotFound(_0x2c752d,_0x43f8c3){return function(_0x47a051){if(!_0x47a051){_0x2c752d[_0xfed9('0x15')](0x194);}return _0x47a051;};}function handleError(_0x761fef,_0x18165d){_0x18165d=_0x18165d||0x1f4;return function(_0x1e3df3){logger[_0xfed9('0x26')](_0x1e3df3['stack']);if(_0x1e3df3['name']){delete _0x1e3df3['name'];}_0x761fef[_0xfed9('0x16')](_0x18165d)[_0xfed9('0x27')](_0x1e3df3);};}exports[_0xfed9('0x28')]=function(_0x39177f,_0x4a1287){var _0x469e30={},_0x59ee13={},_0x4537de={'count':0x0,'rows':[]};var _0x2ee82d=_[_0xfed9('0x29')](db[_0xfed9('0x2a')][_0xfed9('0x2b')],function(_0x2c10c0){return{'name':_0x2c10c0[_0xfed9('0x2c')],'type':_0x2c10c0[_0xfed9('0x2d')][_0xfed9('0x2e')]};});_0x59ee13['model']=_[_0xfed9('0x29')](_0x2ee82d,_0xfed9('0x2f'));_0x59ee13[_0xfed9('0x30')]=_['keys'](_0x39177f[_0xfed9('0x30')]);_0x59ee13['filters']=_['intersection'](_0x59ee13[_0xfed9('0x31')],_0x59ee13[_0xfed9('0x30')]);_0x469e30[_0xfed9('0x32')]=_['intersection'](_0x59ee13['model'],qs[_0xfed9('0x33')](_0x39177f[_0xfed9('0x30')]['fields']));_0x469e30[_0xfed9('0x32')]=_0x469e30[_0xfed9('0x32')]['length']?_0x469e30['attributes']:_0x59ee13[_0xfed9('0x31')];if(!_0x39177f[_0xfed9('0x30')]['hasOwnProperty'](_0xfed9('0x34'))){_0x469e30[_0xfed9('0x1b')]=qs['limit'](_0x39177f[_0xfed9('0x30')][_0xfed9('0x1b')]);_0x469e30[_0xfed9('0x19')]=qs['offset'](_0x39177f[_0xfed9('0x30')][_0xfed9('0x19')]);}_0x469e30[_0xfed9('0x35')]=qs[_0xfed9('0x36')](_0x39177f[_0xfed9('0x30')][_0xfed9('0x36')]);_0x469e30[_0xfed9('0x37')]=qs['filters'](_[_0xfed9('0x38')](_0x39177f[_0xfed9('0x30')],_0x59ee13['filters']),_0x2ee82d);if(_0x39177f[_0xfed9('0x30')][_0xfed9('0x39')]){_0x469e30[_0xfed9('0x37')]=_[_0xfed9('0x3a')](_0x469e30['where'],{'$or':_[_0xfed9('0x29')](_0x2ee82d,function(_0x4a9b7f){if(_0x4a9b7f[_0xfed9('0x2d')]!==_0xfed9('0x3b')){var _0x2918a9={};_0x2918a9[_0x4a9b7f[_0xfed9('0x2f')]]={'$like':'%'+_0x39177f['query'][_0xfed9('0x39')]+'%'};return _0x2918a9;}})});}_0x469e30=_['merge']({},_0x469e30,_0x39177f['options']);var _0x2aa70b={'where':_0x469e30[_0xfed9('0x37')]};return db[_0xfed9('0x2a')][_0xfed9('0x1c')](_0x2aa70b)[_0xfed9('0x22')](function(_0x20c8f6){_0x4537de[_0xfed9('0x1c')]=_0x20c8f6;if(_0x39177f[_0xfed9('0x30')][_0xfed9('0x3c')]){_0x469e30[_0xfed9('0x3d')]=[{'all':!![]}];}return db[_0xfed9('0x2a')][_0xfed9('0x3e')](_0x469e30);})[_0xfed9('0x22')](function(_0x500a79){_0x4537de[_0xfed9('0x3f')]=_0x500a79;return _0x4537de;})[_0xfed9('0x22')](respondWithFilteredResult(_0x4a1287,_0x469e30))[_0xfed9('0x40')](handleError(_0x4a1287,null));};exports[_0xfed9('0x41')]=function(_0x2065bc,_0x58743f){var _0x5890bc={'raw':!![],'where':{'id':_0x2065bc['params']['id']}},_0x470b3b={};_0x470b3b[_0xfed9('0x31')]=_[_0xfed9('0x42')](db['SquareOdbc'][_0xfed9('0x2b')]);_0x470b3b[_0xfed9('0x30')]=_[_0xfed9('0x42')](_0x2065bc[_0xfed9('0x30')]);_0x470b3b[_0xfed9('0x43')]=_[_0xfed9('0x44')](_0x470b3b['model'],_0x470b3b['query']);_0x5890bc[_0xfed9('0x32')]=_[_0xfed9('0x44')](_0x470b3b['model'],qs['fields'](_0x2065bc[_0xfed9('0x30')][_0xfed9('0x33')]));_0x5890bc[_0xfed9('0x32')]=_0x5890bc[_0xfed9('0x32')][_0xfed9('0x45')]?_0x5890bc['attributes']:_0x470b3b[_0xfed9('0x31')];if(_0x2065bc['query'][_0xfed9('0x3c')]){_0x5890bc[_0xfed9('0x3d')]=[{'all':!![]}];}_0x5890bc=_[_0xfed9('0x3a')]({},_0x5890bc,_0x2065bc[_0xfed9('0x46')]);return db[_0xfed9('0x2a')][_0xfed9('0x47')](_0x5890bc)[_0xfed9('0x22')](handleEntityNotFound(_0x58743f,null))[_0xfed9('0x22')](respondWithResult(_0x58743f,null))[_0xfed9('0x40')](handleError(_0x58743f,null));};exports[_0xfed9('0x48')]=function(_0x4a3b01,_0x5c5e7f){return db['SquareOdbc'][_0xfed9('0x48')](_0x4a3b01[_0xfed9('0x49')],{})[_0xfed9('0x22')](function(_0x1f48ed){var _0x232918=_0x4a3b01[_0xfed9('0x4a')][_0xfed9('0x23')]({'plain':!![]});if(!_0x232918)throw new Error(_0xfed9('0x4b'));if(_0x232918['role']===_0xfed9('0x4a')){var _0x1d64dd=_0x1f48ed['get']({'plain':!![]});var _0x308afd=_0xfed9('0x24');return db[_0xfed9('0x4c')][_0xfed9('0x47')]({'where':{'name':_0x308afd,'userProfileId':_0x232918[_0xfed9('0x4d')]},'raw':!![]})[_0xfed9('0x22')](function(_0x611492){if(_0x611492&&_0x611492[_0xfed9('0x4e')]===0x0){return db['UserProfileResource'][_0xfed9('0x48')]({'name':_0x1d64dd['name'],'resourceId':_0x1d64dd['id'],'type':_0x611492[_0xfed9('0x2f')],'sectionId':_0x611492['id']},{})[_0xfed9('0x22')](function(){return _0x1f48ed;});}else{return _0x1f48ed;}})[_0xfed9('0x40')](function(_0x51c4a8){logger[_0xfed9('0x26')](_0xfed9('0x4f'),_0x51c4a8);throw _0x51c4a8;});}return _0x1f48ed;})[_0xfed9('0x22')](respondWithResult(_0x5c5e7f,0xc9))[_0xfed9('0x40')](handleError(_0x5c5e7f,null));};exports[_0xfed9('0x50')]=function(_0x291238,_0x276b4b){if(_0x291238['body']['id']){delete _0x291238[_0xfed9('0x49')]['id'];}return db[_0xfed9('0x2a')][_0xfed9('0x47')]({'where':{'id':_0x291238[_0xfed9('0x51')]['id']}})[_0xfed9('0x22')](handleEntityNotFound(_0x276b4b,null))[_0xfed9('0x22')](saveUpdates(_0x291238[_0xfed9('0x49')],null))['then'](respondWithResult(_0x276b4b,null))[_0xfed9('0x40')](handleError(_0x276b4b,null));};exports['destroy']=function(_0x5c6524,_0x1d0a03){return db['SquareOdbc'][_0xfed9('0x47')]({'where':{'id':_0x5c6524[_0xfed9('0x51')]['id']}})[_0xfed9('0x22')](handleEntityNotFound(_0x1d0a03,null))[_0xfed9('0x22')](removeEntity(_0x1d0a03,null))[_0xfed9('0x40')](handleError(_0x1d0a03,null));};exports['test']=function(_0x2fb3d0,_0x5aa439,_0x8dfc5d){var _0x445c14;return db[_0xfed9('0x2a')][_0xfed9('0x47')]({'where':{'id':_0x2fb3d0['params']['id']},'attributes':['id',_0xfed9('0x52')]})['then'](handleEntityNotFound(_0x5aa439,null))[_0xfed9('0x22')](function(_0x142309){if(_0x142309){var _0x59f379=require(_0xfed9('0x53'))();_0x59f379[_0xfed9('0x54')](_0x142309[_0xfed9('0x52')]);_0x59f379[_0xfed9('0x55')]();return _0x142309;}})[_0xfed9('0x22')](respondWithResult(_0x5aa439,null))[_0xfed9('0x40')](handleError(_0x5aa439,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d8367e1..64cd44e 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 _0xbdc6=['../../config/environment','./squareOdbc.attributes','exports','define','lodash','util','moment','path','rimraf'];(function(_0x448e8d,_0x43a056){var _0x46e774=function(_0x22f0be){while(--_0x22f0be){_0x448e8d['push'](_0x448e8d['shift']());}};_0x46e774(++_0x43a056);}(_0xbdc6,0xdc));var _0x6bdc=function(_0x3454ee,_0x26dbcb){_0x3454ee=_0x3454ee-0x0;var _0x263ac7=_0xbdc6[_0x3454ee];return _0x263ac7;};'use strict';var _=require(_0x6bdc('0x0'));var util=require(_0x6bdc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6bdc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bdc('0x3'));var rimraf=require(_0x6bdc('0x4'));var config=require(_0x6bdc('0x5'));var attributes=require(_0x6bdc('0x6'));module[_0x6bdc('0x7')]=function(_0xb15bc4,_0x105bad){return _0xb15bc4[_0x6bdc('0x8')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ccb=['square_odbc','../../config/logger','api','moment','request-promise','path','rimraf','./squareOdbc.attributes','exports','SquareOdbc'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1ccb,0x105));var _0xb1cc=function(_0x456449,_0x43455a){_0x456449=_0x456449-0x0;var _0x36c297=_0x1ccb[_0x456449];return _0x36c297;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb1cc('0x0'))(_0xb1cc('0x1'));var moment=require(_0xb1cc('0x2'));var BPromise=require('bluebird');var rp=require(_0xb1cc('0x3'));var fs=require('fs');var path=require(_0xb1cc('0x4'));var rimraf=require(_0xb1cc('0x5'));var config=require('../../config/environment');var attributes=require(_0xb1cc('0x6'));module[_0xb1cc('0x7')]=function(_0x2a29f9,_0x5302f7){return _0x2a29f9['define'](_0xb1cc('0x8'),attributes,{'tableName':_0xb1cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 03eb54f..a8fbd5b 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 _0x9c10=['jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','find','options','raw','attributes','include','map','model','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9c10,0x156));var _0x09c1=function(_0x3cd787,_0x5f3f4f){_0x3cd787=_0x3cd787-0x0;var _0x1dcb65=_0x9c10[_0x3cd787];return _0x1dcb65;};'use strict';var _=require(_0x09c1('0x0'));var util=require(_0x09c1('0x1'));var moment=require('moment');var BPromise=require(_0x09c1('0x2'));var rs=require(_0x09c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x09c1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x09c1('0x5'));var jayson=require(_0x09c1('0x6'));var client=jayson[_0x09c1('0x7')][_0x09c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe2b310,_0x220d51,_0x514dbc){return new BPromise(function(_0x33f2a9,_0x28a0ef){return client[_0x09c1('0x9')](_0xe2b310,_0x514dbc)[_0x09c1('0xa')](function(_0x57f90d){logger[_0x09c1('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x220d51,_0x09c1('0xc'));logger[_0x09c1('0xd')](_0x09c1('0xe'),_0x220d51,_0x09c1('0xc'),JSON[_0x09c1('0xf')](_0x57f90d));if(_0x57f90d[_0x09c1('0x10')]){if(_0x57f90d['error']['code']===0x1f4){logger[_0x09c1('0x10')](_0x09c1('0x11'),_0x220d51,_0x57f90d[_0x09c1('0x10')][_0x09c1('0x12')]);return _0x28a0ef(_0x57f90d[_0x09c1('0x10')][_0x09c1('0x12')]);}logger[_0x09c1('0x10')](_0x09c1('0x11'),_0x220d51,_0x57f90d[_0x09c1('0x10')][_0x09c1('0x12')]);return _0x33f2a9(_0x57f90d[_0x09c1('0x10')][_0x09c1('0x12')]);}else{logger['info'](_0x09c1('0x11'),_0x220d51,_0x09c1('0xc'));_0x33f2a9(_0x57f90d[_0x09c1('0x13')][_0x09c1('0x12')]);}})[_0x09c1('0x14')](function(_0x496079){logger[_0x09c1('0x10')](_0x09c1('0x11'),_0x220d51,_0x496079);_0x28a0ef(_0x496079);});});}exports[_0x09c1('0x15')]=function(_0x299540){var _0x4f94d2=this;return new Promise(function(_0x3ddfc2,_0x7c9369){return db['SquareOdbc'][_0x09c1('0x16')]({'raw':_0x299540[_0x09c1('0x17')]?_0x299540[_0x09c1('0x17')][_0x09c1('0x18')]===undefined?!![]:![]:!![],'where':_0x299540[_0x09c1('0x17')]?_0x299540[_0x09c1('0x17')]['where']||null:null,'attributes':_0x299540[_0x09c1('0x17')]?_0x299540[_0x09c1('0x17')][_0x09c1('0x19')]||null:null,'include':_0x299540[_0x09c1('0x17')]?_0x299540[_0x09c1('0x17')][_0x09c1('0x1a')]?_[_0x09c1('0x1b')](_0x299540[_0x09c1('0x17')][_0x09c1('0x1a')],function(_0x56f3bb){return{'model':db[_0x56f3bb['model']],'as':_0x56f3bb['as'],'attributes':_0x56f3bb[_0x09c1('0x19')],'include':_0x56f3bb[_0x09c1('0x1a')]?_[_0x09c1('0x1b')](_0x56f3bb[_0x09c1('0x1a')],function(_0xdf225){return{'model':db[_0xdf225[_0x09c1('0x1c')]],'as':_0xdf225['as'],'attributes':_0xdf225[_0x09c1('0x19')],'include':_0xdf225['include']?_[_0x09c1('0x1b')](_0xdf225[_0x09c1('0x1a')],function(_0x239806){return{'model':db[_0x239806[_0x09c1('0x1c')]],'as':_0x239806['as'],'attributes':_0x239806[_0x09c1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x09c1('0xa')](function(_0x477cb5){logger[_0x09c1('0xb')]('ShowSquareOdbc',_0x299540);logger[_0x09c1('0xd')](_0x09c1('0x15'),_0x299540,JSON[_0x09c1('0xf')](_0x477cb5));_0x3ddfc2(_0x477cb5);})[_0x09c1('0x14')](function(_0x2ac41a){logger[_0x09c1('0x10')]('ShowSquareOdbc',_0x2ac41a[_0x09c1('0x12')],_0x299540);_0x7c9369(_0x4f94d2[_0x09c1('0x10')](0x1f4,_0x2ac41a[_0x09c1('0x12')]));});});}; \ No newline at end of file +var _0x4f38=['SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareOdbc','find','options','where','attributes','include','map','model','ShowSquareOdbc','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x4f38,0x14d));var _0x84f3=function(_0xc9833e,_0x39bb10){_0xc9833e=_0xc9833e-0x0;var _0x1857d2=_0x4f38[_0xc9833e];return _0x1857d2;};'use strict';var _=require(_0x84f3('0x0'));var util=require(_0x84f3('0x1'));var moment=require(_0x84f3('0x2'));var BPromise=require(_0x84f3('0x3'));var rs=require(_0x84f3('0x4'));var fs=require('fs');var Redis=require(_0x84f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x84f3('0x6'));var logger=require(_0x84f3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x84f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x548cc5,_0x1eaa25,_0x1baf3e){return new BPromise(function(_0x594ac8,_0x4d8105){return client[_0x84f3('0x9')](_0x548cc5,_0x1baf3e)[_0x84f3('0xa')](function(_0x2a0021){logger[_0x84f3('0xb')](_0x84f3('0xc'),_0x1eaa25,_0x84f3('0xd'));logger[_0x84f3('0xe')](_0x84f3('0xf'),_0x1eaa25,_0x84f3('0xd'),JSON[_0x84f3('0x10')](_0x2a0021));if(_0x2a0021['error']){if(_0x2a0021[_0x84f3('0x11')]['code']===0x1f4){logger['error'](_0x84f3('0xc'),_0x1eaa25,_0x2a0021[_0x84f3('0x11')][_0x84f3('0x12')]);return _0x4d8105(_0x2a0021[_0x84f3('0x11')][_0x84f3('0x12')]);}logger[_0x84f3('0x11')](_0x84f3('0xc'),_0x1eaa25,_0x2a0021[_0x84f3('0x11')]['message']);return _0x594ac8(_0x2a0021[_0x84f3('0x11')][_0x84f3('0x12')]);}else{logger[_0x84f3('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x1eaa25,'request\x20sent');_0x594ac8(_0x2a0021['result'][_0x84f3('0x12')]);}})['catch'](function(_0x261442){logger[_0x84f3('0x11')](_0x84f3('0xc'),_0x1eaa25,_0x261442);_0x4d8105(_0x261442);});});}exports['ShowSquareOdbc']=function(_0x165eb2){var _0x400727=this;return new Promise(function(_0x3ef34f,_0x8bd7ea){return db[_0x84f3('0x13')][_0x84f3('0x14')]({'raw':_0x165eb2[_0x84f3('0x15')]?_0x165eb2[_0x84f3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x165eb2['options']?_0x165eb2[_0x84f3('0x15')][_0x84f3('0x16')]||null:null,'attributes':_0x165eb2[_0x84f3('0x15')]?_0x165eb2[_0x84f3('0x15')][_0x84f3('0x17')]||null:null,'include':_0x165eb2[_0x84f3('0x15')]?_0x165eb2[_0x84f3('0x15')][_0x84f3('0x18')]?_[_0x84f3('0x19')](_0x165eb2[_0x84f3('0x15')][_0x84f3('0x18')],function(_0x6d19c1){return{'model':db[_0x6d19c1[_0x84f3('0x1a')]],'as':_0x6d19c1['as'],'attributes':_0x6d19c1[_0x84f3('0x17')],'include':_0x6d19c1[_0x84f3('0x18')]?_['map'](_0x6d19c1[_0x84f3('0x18')],function(_0x2fe76e){return{'model':db[_0x2fe76e[_0x84f3('0x1a')]],'as':_0x2fe76e['as'],'attributes':_0x2fe76e[_0x84f3('0x17')],'include':_0x2fe76e['include']?_[_0x84f3('0x19')](_0x2fe76e[_0x84f3('0x18')],function(_0x5a37d1){return{'model':db[_0x5a37d1[_0x84f3('0x1a')]],'as':_0x5a37d1['as'],'attributes':_0x5a37d1[_0x84f3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x84f3('0xa')](function(_0x1ca4e4){logger[_0x84f3('0xb')]('ShowSquareOdbc',_0x165eb2);logger[_0x84f3('0xe')](_0x84f3('0x1b'),_0x165eb2,JSON['stringify'](_0x1ca4e4));_0x3ef34f(_0x1ca4e4);})[_0x84f3('0x1c')](function(_0x3e3d46){logger['error'](_0x84f3('0x1b'),_0x3e3d46['message'],_0x165eb2);_0x8bd7ea(_0x400727['error'](0x1f4,_0x3e3d46[_0x84f3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b9a6eec..43a17e3 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 _0x7cfa=['/:id/users','post','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0x7cfa,0x137));var _0xa7cf=function(_0x18a0ce,_0x423686){_0x18a0ce=_0x18a0ce-0x0;var _0x9387ff=_0x7cfa[_0x18a0ce];return _0x9387ff;};'use strict';var multer=require(_0xa7cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa7cf('0x1'));var express=require(_0xa7cf('0x2'));var router=express[_0xa7cf('0x3')]();var fs_extra=require(_0xa7cf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa7cf('0x5'));var config=require('../../config/environment');var controller=require(_0xa7cf('0x6'));router[_0xa7cf('0x7')]('/',auth[_0xa7cf('0x8')](),controller[_0xa7cf('0x9')]);router[_0xa7cf('0x7')](_0xa7cf('0xa'),auth[_0xa7cf('0x8')](),controller[_0xa7cf('0xb')]);router[_0xa7cf('0x7')](_0xa7cf('0xc'),auth[_0xa7cf('0x8')](),controller['getUsers']);router[_0xa7cf('0xd')]('/',auth[_0xa7cf('0x8')](),controller['create']);router[_0xa7cf('0xd')](_0xa7cf('0xc'),auth[_0xa7cf('0x8')](),controller['addUsers']);router['put'](_0xa7cf('0xa'),auth[_0xa7cf('0x8')](),controller[_0xa7cf('0xe')]);router['delete'](_0xa7cf('0xa'),auth['isAuthenticated'](),controller[_0xa7cf('0xf')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeUsers']);module[_0xa7cf('0x10')]=router; \ No newline at end of file +var _0x316b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','getUsers','post','/:id/users','addUsers','put','update','delete','destroy','removeUsers','exports','multer','path'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x316b,0x17e));var _0xb316=function(_0x20d73e,_0x39f9ec){_0x20d73e=_0x20d73e-0x0;var _0x52e84b=_0x316b[_0x20d73e];return _0x52e84b;};'use strict';var multer=require(_0xb316('0x0'));var util=require('util');var path=require(_0xb316('0x1'));var timeout=require('connect-timeout');var express=require(_0xb316('0x2'));var router=express[_0xb316('0x3')]();var fs_extra=require(_0xb316('0x4'));var auth=require(_0xb316('0x5'));var interaction=require(_0xb316('0x6'));var config=require(_0xb316('0x7'));var controller=require(_0xb316('0x8'));router['get']('/',auth[_0xb316('0x9')](),controller[_0xb316('0xa')]);router[_0xb316('0xb')](_0xb316('0xc'),auth['isAuthenticated'](),controller[_0xb316('0xd')]);router[_0xb316('0xb')]('/:id/users',auth[_0xb316('0x9')](),controller[_0xb316('0xe')]);router[_0xb316('0xf')]('/',auth[_0xb316('0x9')](),controller['create']);router[_0xb316('0xf')](_0xb316('0x10'),auth[_0xb316('0x9')](),controller[_0xb316('0x11')]);router[_0xb316('0x12')](_0xb316('0xc'),auth[_0xb316('0x9')](),controller[_0xb316('0x13')]);router[_0xb316('0x14')](_0xb316('0xc'),auth['isAuthenticated'](),controller[_0xb316('0x15')]);router[_0xb316('0x14')]('/:id/users',auth[_0xb316('0x9')](),controller[_0xb316('0x16')]);module[_0xb316('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2f186ee..d58d149 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 _0x5e1d=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name'];(function(_0xb18f5f,_0x598bf1){var _0xe5852a=function(_0x1ae459){while(--_0x1ae459){_0xb18f5f['push'](_0xb18f5f['shift']());}};_0xe5852a(++_0x598bf1);}(_0x5e1d,0x1b6));var _0xd5e1=function(_0x17785e,_0x407d4e){_0x17785e=_0x17785e-0x0;var _0x5ccb41=_0x5e1d[_0x17785e];return _0x5ccb41;};'use strict';var Sequelize=require(_0xd5e1('0x0'));module[_0xd5e1('0x1')]={'name':{'type':Sequelize[_0xd5e1('0x2')],'unique':_0xd5e1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd5e1('0x2')]},'notes':{'type':Sequelize[_0xd5e1('0x4')]},'preproduction':{'type':Sequelize[_0xd5e1('0x5')](_0xd5e1('0x6')),'get':function(){if(this[_0xd5e1('0x7')](_0xd5e1('0x8'))){return this[_0xd5e1('0x7')](_0xd5e1('0x8'))[_0xd5e1('0x9')](_0xd5e1('0xa'));}}},'production':{'type':Sequelize[_0xd5e1('0x5')](_0xd5e1('0x6')),'get':function(){if(this[_0xd5e1('0x7')]('production')){return this['getDataValue'](_0xd5e1('0xb'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xd5e1('0xc')]},'publishedAt':{'type':Sequelize[_0xd5e1('0xc')]}}; \ No newline at end of file +var _0x5f6f=['sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x375bec,_0x2f32d9){var _0x3cb1f1=function(_0x45fff8){while(--_0x45fff8){_0x375bec['push'](_0x375bec['shift']());}};_0x3cb1f1(++_0x2f32d9);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x592238,_0xc8ff1e){_0x592238=_0x592238-0x0;var _0x4bdf33=_0x5f6f[_0x592238];return _0x4bdf33;};'use strict';var Sequelize=require(_0xf5f6('0x0'));module[_0xf5f6('0x1')]={'name':{'type':Sequelize[_0xf5f6('0x2')],'unique':_0xf5f6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf5f6('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xf5f6('0x4')](_0xf5f6('0x5')),'get':function(){if(this[_0xf5f6('0x6')]('preproduction')){return this[_0xf5f6('0x6')](_0xf5f6('0x7'))[_0xf5f6('0x8')](_0xf5f6('0x9'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xf5f6('0x6')](_0xf5f6('0xa'))){return this[_0xf5f6('0x6')](_0xf5f6('0xa'))[_0xf5f6('0x8')](_0xf5f6('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index c242c68..3919c62 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 _0xcac2=['pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','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','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','options','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','request-promise','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','end','offset','limit','undefined','count','Content-Range','json','reject','update','then','get','SquareProjects','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcac2,0x14a));var _0x2cac=function(_0xe0e520,_0x15e93a){_0xe0e520=_0xe0e520-0x0;var _0x2bdec2=_0xcac2[_0xe0e520];return _0x2bdec2;};'use strict';var emlformat=require(_0x2cac('0x0'));var rimraf=require(_0x2cac('0x1'));var zipdir=require(_0x2cac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2cac('0x4'));var path=require('path');var sox=require(_0x2cac('0x5'));var csv=require('to-csv');var ejs=require(_0x2cac('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cac('0x7'));var squel=require(_0x2cac('0x8'));var crypto=require('crypto');var jsforce=require(_0x2cac('0x9'));var deskjs=require(_0x2cac('0xa'));var toCsv=require(_0x2cac('0xb'));var querystring=require(_0x2cac('0xc'));var Papa=require(_0x2cac('0xd'));var Redis=require(_0x2cac('0xe'));var authService=require(_0x2cac('0xf'));var qs=require(_0x2cac('0x10'));var as=require(_0x2cac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cac('0x12'))(_0x2cac('0x13'));var utils=require(_0x2cac('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2cac('0x15'));var db=require(_0x2cac('0x16'))['db'];config['redis']=_[_0x2cac('0x17')](config[_0x2cac('0x18')],{'host':_0x2cac('0x19'),'port':0x18eb});var socket=require(_0x2cac('0x1a'))(new Redis(config[_0x2cac('0x18')]));require(_0x2cac('0x1b'))[_0x2cac('0x1c')](socket);function respondWithStatusCode(_0x6f26ec,_0x4d50eb){_0x4d50eb=_0x4d50eb||0xcc;return function(_0x475753){if(_0x475753){return _0x6f26ec['sendStatus'](_0x4d50eb);}return _0x6f26ec[_0x2cac('0x1d')](_0x4d50eb)[_0x2cac('0x1e')]();};}function respondWithResult(_0x1beeac,_0xae399){_0xae399=_0xae399||0xc8;return function(_0x3f867c){if(_0x3f867c){return _0x1beeac[_0x2cac('0x1d')](_0xae399)['json'](_0x3f867c);}};}function respondWithFilteredResult(_0x554d03,_0xa1295b){return function(_0x4b0f6e){if(_0x4b0f6e){var _0x1d16ab=typeof _0xa1295b[_0x2cac('0x1f')]==='undefined'&&typeof _0xa1295b[_0x2cac('0x20')]===_0x2cac('0x21');var _0x86de67=_0x4b0f6e[_0x2cac('0x22')];var _0x2c3cc2=_0x1d16ab?0x0:_0xa1295b[_0x2cac('0x1f')];var _0x569b6f=_0x1d16ab?_0x4b0f6e['count']:_0xa1295b[_0x2cac('0x1f')]+_0xa1295b[_0x2cac('0x20')];var _0x306339;if(_0x569b6f>=_0x86de67){_0x569b6f=_0x86de67;_0x306339=0xc8;}else{_0x306339=0xce;}_0x554d03[_0x2cac('0x1d')](_0x306339);return _0x554d03['set'](_0x2cac('0x23'),_0x2c3cc2+'-'+_0x569b6f+'/'+_0x86de67)[_0x2cac('0x24')](_0x4b0f6e);}return null;};}function patchUpdates(_0x267776){return function(_0x5bc675){try{jsonpatch['apply'](_0x5bc675,_0x267776,!![]);}catch(_0x472f36){return BPromise[_0x2cac('0x25')](_0x472f36);}return _0x5bc675['save']();};}function saveUpdates(_0xee932f,_0x1e66ee){return function(_0x2bc6b8){if(_0x2bc6b8){return _0x2bc6b8[_0x2cac('0x26')](_0xee932f)['then'](function(_0x656468){return _0x656468;});}return null;};}function removeEntity(_0x1bb4ba,_0x29e97d){return function(_0x5653f5){if(_0x5653f5){return _0x5653f5['destroy']()[_0x2cac('0x27')](function(){var _0x20dc94=_0x5653f5[_0x2cac('0x28')]({'plain':!![]});var _0x218427=_0x2cac('0x29');return db[_0x2cac('0x2a')][_0x2cac('0x2b')]({'where':{'type':_0x218427,'resourceId':_0x20dc94['id']}})[_0x2cac('0x27')](function(){return _0x5653f5;});})[_0x2cac('0x27')](function(){_0x1bb4ba[_0x2cac('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e06c,_0x53884b){return function(_0x47552f){if(!_0x47552f){_0x39e06c[_0x2cac('0x2c')](0x194);}return _0x47552f;};}function handleError(_0x169ad1,_0x3e29b3){_0x3e29b3=_0x3e29b3||0x1f4;return function(_0x16ddd1){logger[_0x2cac('0x2d')](_0x16ddd1[_0x2cac('0x2e')]);if(_0x16ddd1[_0x2cac('0x2f')]){delete _0x16ddd1[_0x2cac('0x2f')];}_0x169ad1[_0x2cac('0x1d')](_0x3e29b3)[_0x2cac('0x30')](_0x16ddd1);};}exports[_0x2cac('0x31')]=function(_0xfbde9e,_0x14a192){var _0x169ed7={},_0x2cb754={},_0x3eb02d={'count':0x0,'rows':[]};var _0x1f51bb=_[_0x2cac('0x32')](db[_0x2cac('0x33')][_0x2cac('0x34')],function(_0xc0dc71){return{'name':_0xc0dc71[_0x2cac('0x35')],'type':_0xc0dc71['type'][_0x2cac('0x36')]};});_0x2cb754[_0x2cac('0x37')]=_['map'](_0x1f51bb,_0x2cac('0x2f'));_0x2cb754['query']=_[_0x2cac('0x38')](_0xfbde9e[_0x2cac('0x39')]);_0x2cb754[_0x2cac('0x3a')]=_[_0x2cac('0x3b')](_0x2cb754[_0x2cac('0x37')],_0x2cb754[_0x2cac('0x39')]);_0x169ed7[_0x2cac('0x3c')]=_[_0x2cac('0x3b')](_0x2cb754[_0x2cac('0x37')],qs['fields'](_0xfbde9e[_0x2cac('0x39')][_0x2cac('0x3d')]));_0x169ed7[_0x2cac('0x3c')]=_0x169ed7['attributes'][_0x2cac('0x3e')]?_0x169ed7['attributes']:_0x2cb754[_0x2cac('0x37')];if(!_0xfbde9e[_0x2cac('0x39')]['hasOwnProperty']('nolimit')){_0x169ed7['limit']=qs[_0x2cac('0x20')](_0xfbde9e[_0x2cac('0x39')][_0x2cac('0x20')]);_0x169ed7[_0x2cac('0x1f')]=qs[_0x2cac('0x1f')](_0xfbde9e[_0x2cac('0x39')][_0x2cac('0x1f')]);}_0x169ed7[_0x2cac('0x3f')]=qs['sort'](_0xfbde9e['query'][_0x2cac('0x40')]);_0x169ed7[_0x2cac('0x41')]=qs['filters'](_[_0x2cac('0x42')](_0xfbde9e[_0x2cac('0x39')],_0x2cb754[_0x2cac('0x3a')]),_0x1f51bb);if(_0xfbde9e[_0x2cac('0x39')][_0x2cac('0x43')]){_0x169ed7['where']=_[_0x2cac('0x44')](_0x169ed7[_0x2cac('0x41')],{'$or':_[_0x2cac('0x32')](_0x1f51bb,function(_0x255cdf){if(_0x255cdf[_0x2cac('0x45')]!==_0x2cac('0x46')){var _0x237afc={};_0x237afc[_0x255cdf['name']]={'$like':'%'+_0xfbde9e['query'][_0x2cac('0x43')]+'%'};return _0x237afc;}})});}_0x169ed7=_[_0x2cac('0x44')]({},_0x169ed7,_0xfbde9e['options']);var _0x5be8a8={'where':_0x169ed7[_0x2cac('0x41')]};return db['SquareProject']['count'](_0x5be8a8)[_0x2cac('0x27')](function(_0x275f43){_0x3eb02d[_0x2cac('0x22')]=_0x275f43;if(_0xfbde9e[_0x2cac('0x39')][_0x2cac('0x47')]){_0x169ed7[_0x2cac('0x48')]=[{'all':!![]}];}return db[_0x2cac('0x33')][_0x2cac('0x49')](_0x169ed7);})[_0x2cac('0x27')](function(_0x5193f7){_0x3eb02d[_0x2cac('0x4a')]=_0x5193f7;return _0x3eb02d;})[_0x2cac('0x27')](respondWithFilteredResult(_0x14a192,_0x169ed7))[_0x2cac('0x4b')](handleError(_0x14a192,null));};exports['show']=function(_0x4c46cc,_0x3809b0){var _0x25c758={'raw':![],'where':{'id':_0x4c46cc['params']['id']}},_0xd5ae5f={};_0xd5ae5f['model']=_[_0x2cac('0x38')](db[_0x2cac('0x33')]['rawAttributes']);_0xd5ae5f[_0x2cac('0x39')]=_[_0x2cac('0x38')](_0x4c46cc[_0x2cac('0x39')]);_0xd5ae5f[_0x2cac('0x3a')]=_['intersection'](_0xd5ae5f[_0x2cac('0x37')],_0xd5ae5f[_0x2cac('0x39')]);_0x25c758['attributes']=_['intersection'](_0xd5ae5f['model'],qs[_0x2cac('0x3d')](_0x4c46cc['query']['fields']));_0x25c758[_0x2cac('0x3c')]=_0x25c758[_0x2cac('0x3c')][_0x2cac('0x3e')]?_0x25c758['attributes']:_0xd5ae5f[_0x2cac('0x37')];if(_0x4c46cc['query'][_0x2cac('0x47')]){_0x25c758[_0x2cac('0x48')]=[{'all':!![]}];}_0x25c758=_[_0x2cac('0x44')]({},_0x25c758,_0x4c46cc['options']);return db[_0x2cac('0x33')][_0x2cac('0x4c')](_0x25c758)[_0x2cac('0x27')](handleEntityNotFound(_0x3809b0,null))[_0x2cac('0x27')](respondWithResult(_0x3809b0,null))['catch'](handleError(_0x3809b0,null));};exports[_0x2cac('0x4d')]=function(_0x43ba9b,_0x1656ae){return db[_0x2cac('0x33')]['create'](_0x43ba9b[_0x2cac('0x4e')],{})[_0x2cac('0x27')](function(_0x45ee45){var _0x24f786=_0x43ba9b[_0x2cac('0x4f')]['get']({'plain':!![]});if(!_0x24f786)throw new Error(_0x2cac('0x50'));if(_0x24f786[_0x2cac('0x51')]==='user'){var _0x1525ca=_0x45ee45['get']({'plain':!![]});var _0x301dfa=_0x2cac('0x29');return db[_0x2cac('0x52')]['find']({'where':{'name':_0x301dfa,'userProfileId':_0x24f786[_0x2cac('0x53')]},'raw':!![]})[_0x2cac('0x27')](function(_0x46199c){if(_0x46199c&&_0x46199c[_0x2cac('0x54')]===0x0){return db[_0x2cac('0x2a')][_0x2cac('0x4d')]({'name':_0x1525ca[_0x2cac('0x2f')],'resourceId':_0x1525ca['id'],'type':_0x46199c[_0x2cac('0x2f')],'sectionId':_0x46199c['id']},{})['then'](function(){return _0x45ee45;});}else{return _0x45ee45;}})[_0x2cac('0x4b')](function(_0x17dc64){logger['error'](_0x2cac('0x55'),_0x17dc64);throw _0x17dc64;});}return _0x45ee45;})[_0x2cac('0x27')](respondWithResult(_0x1656ae,0xc9))[_0x2cac('0x4b')](handleError(_0x1656ae,null));};exports[_0x2cac('0x26')]=function(_0x515121,_0x36a079){if(_0x515121[_0x2cac('0x4e')]['id']){delete _0x515121[_0x2cac('0x4e')]['id'];}return db[_0x2cac('0x33')][_0x2cac('0x4c')]({'where':{'id':_0x515121[_0x2cac('0x56')]['id']}})[_0x2cac('0x27')](handleEntityNotFound(_0x36a079,null))[_0x2cac('0x27')](saveUpdates(_0x515121[_0x2cac('0x4e')],null))['then'](respondWithResult(_0x36a079,null))[_0x2cac('0x4b')](handleError(_0x36a079,null));};exports[_0x2cac('0x2b')]=function(_0x3835c4,_0x413d0e){return db['SquareProject'][_0x2cac('0x4c')]({'where':{'id':_0x3835c4[_0x2cac('0x56')]['id']}})[_0x2cac('0x27')](handleEntityNotFound(_0x413d0e,null))[_0x2cac('0x27')](removeEntity(_0x413d0e,null))[_0x2cac('0x4b')](handleError(_0x413d0e,null));};exports[_0x2cac('0x57')]=function(_0x173c49,_0x3deaf5,_0x41c7bd){return db['SquareProject'][_0x2cac('0x4c')]({'where':{'id':_0x173c49[_0x2cac('0x56')]['id']}})[_0x2cac('0x27')](handleEntityNotFound(_0x3deaf5,null))['then'](function(_0x312ef5){if(_0x312ef5){return _0x312ef5[_0x2cac('0x57')](_0x173c49[_0x2cac('0x4e')][_0x2cac('0x58')],_[_0x2cac('0x59')](_0x173c49[_0x2cac('0x4e')],[_0x2cac('0x58'),'id'])||{});}})[_0x2cac('0x27')](respondWithResult(_0x3deaf5,null))[_0x2cac('0x4b')](handleError(_0x3deaf5,null));};exports[_0x2cac('0x5a')]=function(_0x2cee5b,_0x4976ee,_0x48c2e3){return db['SquareProject'][_0x2cac('0x4c')]({'where':{'id':_0x2cee5b[_0x2cac('0x56')]['id']}})[_0x2cac('0x27')](handleEntityNotFound(_0x4976ee,null))[_0x2cac('0x27')](function(_0x5b3143){if(_0x5b3143){return _0x5b3143['removeUsers'](_0x2cee5b['query']['ids'])[_0x2cac('0x27')](function(){if(_[_0x2cac('0x5b')](_0x2cee5b[_0x2cac('0x39')][_0x2cac('0x58')])){for(var _0x29bc50=0x0;_0x29bc50<_0x2cee5b[_0x2cac('0x39')][_0x2cac('0x58')][_0x2cac('0x3e')];_0x29bc50+=0x1){socket[_0x2cac('0x5c')](_0x2cac('0x5d'),{'UserId':Number(_0x2cee5b['query'][_0x2cac('0x58')][_0x29bc50]),'SquareProjectId':Number(_0x2cee5b[_0x2cac('0x56')]['id'])});}}else{socket['emit'](_0x2cac('0x5d'),{'UserId':Number(_0x2cee5b[_0x2cac('0x39')][_0x2cac('0x58')]),'SquareProjectId':Number(_0x2cee5b[_0x2cac('0x56')]['id'])});}});}})[_0x2cac('0x27')](respondWithStatusCode(_0x4976ee,null))[_0x2cac('0x4b')](handleError(_0x4976ee,null));};exports[_0x2cac('0x5e')]=function(_0x2ad188,_0x5c7db9,_0x303c64){var _0x2cedc8={};var _0x28a38f={};var _0x171638;var _0x48e3e1;return db[_0x2cac('0x33')][_0x2cac('0x5f')]({'where':{'id':_0x2ad188[_0x2cac('0x56')]['id']}})[_0x2cac('0x27')](handleEntityNotFound(_0x5c7db9,null))[_0x2cac('0x27')](function(_0x271ec5){if(_0x271ec5){_0x171638=_0x271ec5;_0x28a38f[_0x2cac('0x37')]=_[_0x2cac('0x38')](db['User'][_0x2cac('0x34')]);_0x28a38f[_0x2cac('0x39')]=_[_0x2cac('0x38')](_0x2ad188[_0x2cac('0x39')]);_0x28a38f[_0x2cac('0x3a')]=_[_0x2cac('0x3b')](_0x28a38f[_0x2cac('0x37')],_0x28a38f[_0x2cac('0x39')]);_0x2cedc8[_0x2cac('0x3c')]=_[_0x2cac('0x3b')](_0x28a38f[_0x2cac('0x37')],qs[_0x2cac('0x3d')](_0x2ad188['query'][_0x2cac('0x3d')]));_0x2cedc8['attributes']=_0x2cedc8['attributes'][_0x2cac('0x3e')]?_0x2cedc8[_0x2cac('0x3c')]:_0x28a38f[_0x2cac('0x37')];_0x2cedc8[_0x2cac('0x3f')]=qs['sort'](_0x2ad188['query'][_0x2cac('0x40')]);_0x2cedc8[_0x2cac('0x41')]=qs[_0x2cac('0x3a')](_['pick'](_0x2ad188[_0x2cac('0x39')],_0x28a38f['filters']));if(_0x2ad188[_0x2cac('0x39')][_0x2cac('0x43')]){_0x2cedc8['where']=_[_0x2cac('0x44')](_0x2cedc8['where'],{'$or':_[_0x2cac('0x32')](_0x2cedc8[_0x2cac('0x3c')],function(_0xfca90e){var _0x411b25={};_0x411b25[_0xfca90e]={'$like':'%'+_0x2ad188['query'][_0x2cac('0x43')]+'%'};return _0x411b25;})});}_0x2cedc8=_[_0x2cac('0x44')]({},_0x2cedc8,_0x2ad188[_0x2cac('0x60')]);return _0x171638[_0x2cac('0x5e')](_0x2cedc8);}})[_0x2cac('0x27')](function(_0x511de4){if(_0x511de4){_0x48e3e1=_0x511de4['length'];if(!_0x2ad188[_0x2cac('0x39')][_0x2cac('0x61')](_0x2cac('0x62'))){_0x2cedc8['limit']=qs[_0x2cac('0x20')](_0x2ad188[_0x2cac('0x39')][_0x2cac('0x20')]);_0x2cedc8[_0x2cac('0x1f')]=qs['offset'](_0x2ad188['query'][_0x2cac('0x1f')]);}return _0x171638['getUsers'](_0x2cedc8);}})[_0x2cac('0x27')](function(_0x59de83){if(_0x59de83){return _0x59de83?{'count':_0x48e3e1,'rows':_0x59de83}:null;}})[_0x2cac('0x27')](respondWithResult(_0x5c7db9,null))[_0x2cac('0x4b')](handleError(_0x5c7db9,null));}; \ No newline at end of file +var _0x45d3=['getUsers','findOne','User','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','SquareProjects','UserProfileResource','error','stack','name','send','index','SquareProject','rawAttributes','type','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove'];(function(_0x4804e3,_0x3e15a2){var _0x3bd101=function(_0x3dd9f8){while(--_0x3dd9f8){_0x4804e3['push'](_0x4804e3['shift']());}};_0x3bd101(++_0x3e15a2);}(_0x45d3,0xc7));var _0x345d=function(_0x54722a,_0x179b71){_0x54722a=_0x54722a-0x0;var _0x352a58=_0x45d3[_0x54722a];return _0x352a58;};'use strict';var emlformat=require(_0x345d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x345d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x345d('0x2'));var moment=require('moment');var BPromise=require(_0x345d('0x3'));var Mustache=require(_0x345d('0x4'));var util=require(_0x345d('0x5'));var path=require(_0x345d('0x6'));var sox=require(_0x345d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x345d('0x8'));var _=require(_0x345d('0x9'));var squel=require('squel');var crypto=require(_0x345d('0xa'));var jsforce=require(_0x345d('0xb'));var deskjs=require(_0x345d('0xc'));var toCsv=require(_0x345d('0xd'));var querystring=require(_0x345d('0xe'));var Papa=require(_0x345d('0xf'));var Redis=require(_0x345d('0x10'));var authService=require(_0x345d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x345d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x345d('0x13'));var utils=require(_0x345d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x345d('0x15'));var db=require(_0x345d('0x16'))['db'];config[_0x345d('0x17')]=_[_0x345d('0x18')](config[_0x345d('0x17')],{'host':_0x345d('0x19'),'port':0x18eb});var socket=require(_0x345d('0x1a'))(new Redis(config[_0x345d('0x17')]));require('./squareProject.socket')[_0x345d('0x1b')](socket);function respondWithStatusCode(_0x2c0689,_0x4f3e5b){_0x4f3e5b=_0x4f3e5b||0xcc;return function(_0x1f4ebd){if(_0x1f4ebd){return _0x2c0689[_0x345d('0x1c')](_0x4f3e5b);}return _0x2c0689[_0x345d('0x1d')](_0x4f3e5b)[_0x345d('0x1e')]();};}function respondWithResult(_0x3cda44,_0xd31adb){_0xd31adb=_0xd31adb||0xc8;return function(_0x190a55){if(_0x190a55){return _0x3cda44[_0x345d('0x1d')](_0xd31adb)[_0x345d('0x1f')](_0x190a55);}};}function respondWithFilteredResult(_0x26735a,_0x45a80c){return function(_0x573606){if(_0x573606){var _0x3f23ab=typeof _0x45a80c['offset']==='undefined'&&typeof _0x45a80c[_0x345d('0x20')]===_0x345d('0x21');var _0x3b3396=_0x573606[_0x345d('0x22')];var _0x45fa46=_0x3f23ab?0x0:_0x45a80c[_0x345d('0x23')];var _0x564983=_0x3f23ab?_0x573606['count']:_0x45a80c[_0x345d('0x23')]+_0x45a80c[_0x345d('0x20')];var _0x352f76;if(_0x564983>=_0x3b3396){_0x564983=_0x3b3396;_0x352f76=0xc8;}else{_0x352f76=0xce;}_0x26735a['status'](_0x352f76);return _0x26735a['set'](_0x345d('0x24'),_0x45fa46+'-'+_0x564983+'/'+_0x3b3396)[_0x345d('0x1f')](_0x573606);}return null;};}function patchUpdates(_0x5569bc){return function(_0x276e1c){try{jsonpatch[_0x345d('0x25')](_0x276e1c,_0x5569bc,!![]);}catch(_0x10a9c2){return BPromise[_0x345d('0x26')](_0x10a9c2);}return _0x276e1c[_0x345d('0x27')]();};}function saveUpdates(_0x23a3ab,_0x4911c0){return function(_0x290319){if(_0x290319){return _0x290319[_0x345d('0x28')](_0x23a3ab)['then'](function(_0x4dcdb6){return _0x4dcdb6;});}return null;};}function removeEntity(_0x2b3c27,_0x24b840){return function(_0x37cb8c){if(_0x37cb8c){return _0x37cb8c[_0x345d('0x29')]()[_0x345d('0x2a')](function(){var _0xd22031=_0x37cb8c[_0x345d('0x2b')]({'plain':!![]});var _0x53b974=_0x345d('0x2c');return db[_0x345d('0x2d')]['destroy']({'where':{'type':_0x53b974,'resourceId':_0xd22031['id']}})[_0x345d('0x2a')](function(){return _0x37cb8c;});})[_0x345d('0x2a')](function(){_0x2b3c27[_0x345d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44eece,_0x392e35){return function(_0xa9dadd){if(!_0xa9dadd){_0x44eece[_0x345d('0x1c')](0x194);}return _0xa9dadd;};}function handleError(_0x524ffe,_0x22f226){_0x22f226=_0x22f226||0x1f4;return function(_0x3ea1fe){logger[_0x345d('0x2e')](_0x3ea1fe[_0x345d('0x2f')]);if(_0x3ea1fe[_0x345d('0x30')]){delete _0x3ea1fe[_0x345d('0x30')];}_0x524ffe['status'](_0x22f226)[_0x345d('0x31')](_0x3ea1fe);};}exports[_0x345d('0x32')]=function(_0xa53791,_0x3c06d3){var _0x32507e={},_0x639f4a={},_0x552181={'count':0x0,'rows':[]};var _0x5a5e61=_['map'](db[_0x345d('0x33')][_0x345d('0x34')],function(_0x51edaa){return{'name':_0x51edaa['fieldName'],'type':_0x51edaa[_0x345d('0x35')]['key']};});_0x639f4a[_0x345d('0x36')]=_[_0x345d('0x37')](_0x5a5e61,_0x345d('0x30'));_0x639f4a[_0x345d('0x38')]=_['keys'](_0xa53791[_0x345d('0x38')]);_0x639f4a['filters']=_['intersection'](_0x639f4a['model'],_0x639f4a['query']);_0x32507e[_0x345d('0x39')]=_[_0x345d('0x3a')](_0x639f4a['model'],qs[_0x345d('0x3b')](_0xa53791[_0x345d('0x38')][_0x345d('0x3b')]));_0x32507e[_0x345d('0x39')]=_0x32507e[_0x345d('0x39')][_0x345d('0x3c')]?_0x32507e[_0x345d('0x39')]:_0x639f4a[_0x345d('0x36')];if(!_0xa53791[_0x345d('0x38')][_0x345d('0x3d')](_0x345d('0x3e'))){_0x32507e[_0x345d('0x20')]=qs[_0x345d('0x20')](_0xa53791['query'][_0x345d('0x20')]);_0x32507e['offset']=qs[_0x345d('0x23')](_0xa53791['query'][_0x345d('0x23')]);}_0x32507e['order']=qs[_0x345d('0x3f')](_0xa53791[_0x345d('0x38')][_0x345d('0x3f')]);_0x32507e[_0x345d('0x40')]=qs[_0x345d('0x41')](_[_0x345d('0x42')](_0xa53791[_0x345d('0x38')],_0x639f4a['filters']),_0x5a5e61);if(_0xa53791['query'][_0x345d('0x43')]){_0x32507e[_0x345d('0x40')]=_[_0x345d('0x44')](_0x32507e[_0x345d('0x40')],{'$or':_[_0x345d('0x37')](_0x5a5e61,function(_0x228182){if(_0x228182[_0x345d('0x35')]!==_0x345d('0x45')){var _0x20577f={};_0x20577f[_0x228182[_0x345d('0x30')]]={'$like':'%'+_0xa53791[_0x345d('0x38')][_0x345d('0x43')]+'%'};return _0x20577f;}})});}_0x32507e=_[_0x345d('0x44')]({},_0x32507e,_0xa53791[_0x345d('0x46')]);var _0x4e679e={'where':_0x32507e[_0x345d('0x40')]};return db[_0x345d('0x33')][_0x345d('0x22')](_0x4e679e)[_0x345d('0x2a')](function(_0x4533d9){_0x552181[_0x345d('0x22')]=_0x4533d9;if(_0xa53791[_0x345d('0x38')][_0x345d('0x47')]){_0x32507e[_0x345d('0x48')]=[{'all':!![]}];}return db[_0x345d('0x33')][_0x345d('0x49')](_0x32507e);})[_0x345d('0x2a')](function(_0x323655){_0x552181[_0x345d('0x4a')]=_0x323655;return _0x552181;})[_0x345d('0x2a')](respondWithFilteredResult(_0x3c06d3,_0x32507e))[_0x345d('0x4b')](handleError(_0x3c06d3,null));};exports[_0x345d('0x4c')]=function(_0x43e68a,_0x2dd1cc){var _0x354f19={'raw':![],'where':{'id':_0x43e68a['params']['id']}},_0x45dc7a={};_0x45dc7a[_0x345d('0x36')]=_[_0x345d('0x4d')](db[_0x345d('0x33')]['rawAttributes']);_0x45dc7a[_0x345d('0x38')]=_[_0x345d('0x4d')](_0x43e68a['query']);_0x45dc7a['filters']=_['intersection'](_0x45dc7a[_0x345d('0x36')],_0x45dc7a[_0x345d('0x38')]);_0x354f19[_0x345d('0x39')]=_['intersection'](_0x45dc7a[_0x345d('0x36')],qs[_0x345d('0x3b')](_0x43e68a['query'][_0x345d('0x3b')]));_0x354f19[_0x345d('0x39')]=_0x354f19[_0x345d('0x39')][_0x345d('0x3c')]?_0x354f19['attributes']:_0x45dc7a[_0x345d('0x36')];if(_0x43e68a[_0x345d('0x38')][_0x345d('0x47')]){_0x354f19[_0x345d('0x48')]=[{'all':!![]}];}_0x354f19=_[_0x345d('0x44')]({},_0x354f19,_0x43e68a['options']);return db['SquareProject'][_0x345d('0x4e')](_0x354f19)['then'](handleEntityNotFound(_0x2dd1cc,null))[_0x345d('0x2a')](respondWithResult(_0x2dd1cc,null))[_0x345d('0x4b')](handleError(_0x2dd1cc,null));};exports[_0x345d('0x4f')]=function(_0x2e5bc6,_0x52b757){return db[_0x345d('0x33')][_0x345d('0x4f')](_0x2e5bc6[_0x345d('0x50')],{})[_0x345d('0x2a')](function(_0x14a78a){var _0x30bfb7=_0x2e5bc6['user']['get']({'plain':!![]});if(!_0x30bfb7)throw new Error(_0x345d('0x51'));if(_0x30bfb7[_0x345d('0x52')]===_0x345d('0x53')){var _0x3adff7=_0x14a78a[_0x345d('0x2b')]({'plain':!![]});var _0x1b3748=_0x345d('0x2c');return db[_0x345d('0x54')][_0x345d('0x4e')]({'where':{'name':_0x1b3748,'userProfileId':_0x30bfb7['userProfileId']},'raw':!![]})['then'](function(_0x127b46){if(_0x127b46&&_0x127b46[_0x345d('0x55')]===0x0){return db['UserProfileResource'][_0x345d('0x4f')]({'name':_0x3adff7['name'],'resourceId':_0x3adff7['id'],'type':_0x127b46[_0x345d('0x30')],'sectionId':_0x127b46['id']},{})['then'](function(){return _0x14a78a;});}else{return _0x14a78a;}})[_0x345d('0x4b')](function(_0x5bf66f){logger[_0x345d('0x2e')](_0x345d('0x56'),_0x5bf66f);throw _0x5bf66f;});}return _0x14a78a;})['then'](respondWithResult(_0x52b757,0xc9))['catch'](handleError(_0x52b757,null));};exports[_0x345d('0x28')]=function(_0x5bb3bb,_0x2280b6){if(_0x5bb3bb['body']['id']){delete _0x5bb3bb[_0x345d('0x50')]['id'];}return db[_0x345d('0x33')][_0x345d('0x4e')]({'where':{'id':_0x5bb3bb[_0x345d('0x57')]['id']}})[_0x345d('0x2a')](handleEntityNotFound(_0x2280b6,null))[_0x345d('0x2a')](saveUpdates(_0x5bb3bb['body'],null))[_0x345d('0x2a')](respondWithResult(_0x2280b6,null))[_0x345d('0x4b')](handleError(_0x2280b6,null));};exports[_0x345d('0x29')]=function(_0x284ece,_0x335237){return db[_0x345d('0x33')]['find']({'where':{'id':_0x284ece[_0x345d('0x57')]['id']}})['then'](handleEntityNotFound(_0x335237,null))[_0x345d('0x2a')](removeEntity(_0x335237,null))[_0x345d('0x4b')](handleError(_0x335237,null));};exports['addUsers']=function(_0x5966d1,_0x1bd7f6,_0x487b38){return db[_0x345d('0x33')][_0x345d('0x4e')]({'where':{'id':_0x5966d1['params']['id']}})[_0x345d('0x2a')](handleEntityNotFound(_0x1bd7f6,null))[_0x345d('0x2a')](function(_0x55689a){if(_0x55689a){return _0x55689a[_0x345d('0x58')](_0x5966d1['body'][_0x345d('0x59')],_[_0x345d('0x5a')](_0x5966d1[_0x345d('0x50')],[_0x345d('0x59'),'id'])||{});}})[_0x345d('0x2a')](respondWithResult(_0x1bd7f6,null))[_0x345d('0x4b')](handleError(_0x1bd7f6,null));};exports[_0x345d('0x5b')]=function(_0x5c4389,_0x48f1a6,_0xba4c4e){return db[_0x345d('0x33')][_0x345d('0x4e')]({'where':{'id':_0x5c4389[_0x345d('0x57')]['id']}})[_0x345d('0x2a')](handleEntityNotFound(_0x48f1a6,null))[_0x345d('0x2a')](function(_0x12331d){if(_0x12331d){return _0x12331d[_0x345d('0x5b')](_0x5c4389[_0x345d('0x38')][_0x345d('0x59')])[_0x345d('0x2a')](function(){if(_[_0x345d('0x5c')](_0x5c4389['query']['ids'])){for(var _0x16f3b6=0x0;_0x16f3b6<_0x5c4389[_0x345d('0x38')]['ids'][_0x345d('0x3c')];_0x16f3b6+=0x1){socket[_0x345d('0x5d')](_0x345d('0x5e'),{'UserId':Number(_0x5c4389[_0x345d('0x38')][_0x345d('0x59')][_0x16f3b6]),'SquareProjectId':Number(_0x5c4389['params']['id'])});}}else{socket[_0x345d('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x5c4389['query'][_0x345d('0x59')]),'SquareProjectId':Number(_0x5c4389['params']['id'])});}});}})[_0x345d('0x2a')](respondWithStatusCode(_0x48f1a6,null))[_0x345d('0x4b')](handleError(_0x48f1a6,null));};exports[_0x345d('0x5f')]=function(_0x29d695,_0xff9d9b,_0x4983c8){var _0x33afbc={};var _0x180b57={};var _0x6fbc93;var _0x4a9217;return db['SquareProject'][_0x345d('0x60')]({'where':{'id':_0x29d695[_0x345d('0x57')]['id']}})[_0x345d('0x2a')](handleEntityNotFound(_0xff9d9b,null))['then'](function(_0xc12f7a){if(_0xc12f7a){_0x6fbc93=_0xc12f7a;_0x180b57['model']=_[_0x345d('0x4d')](db[_0x345d('0x61')][_0x345d('0x34')]);_0x180b57[_0x345d('0x38')]=_[_0x345d('0x4d')](_0x29d695[_0x345d('0x38')]);_0x180b57[_0x345d('0x41')]=_[_0x345d('0x3a')](_0x180b57[_0x345d('0x36')],_0x180b57['query']);_0x33afbc[_0x345d('0x39')]=_[_0x345d('0x3a')](_0x180b57['model'],qs['fields'](_0x29d695[_0x345d('0x38')][_0x345d('0x3b')]));_0x33afbc[_0x345d('0x39')]=_0x33afbc[_0x345d('0x39')][_0x345d('0x3c')]?_0x33afbc[_0x345d('0x39')]:_0x180b57[_0x345d('0x36')];_0x33afbc['order']=qs['sort'](_0x29d695[_0x345d('0x38')][_0x345d('0x3f')]);_0x33afbc['where']=qs[_0x345d('0x41')](_[_0x345d('0x42')](_0x29d695[_0x345d('0x38')],_0x180b57[_0x345d('0x41')]));if(_0x29d695[_0x345d('0x38')]['filter']){_0x33afbc['where']=_['merge'](_0x33afbc[_0x345d('0x40')],{'$or':_[_0x345d('0x37')](_0x33afbc['attributes'],function(_0x432ac1){var _0x571791={};_0x571791[_0x432ac1]={'$like':'%'+_0x29d695['query'][_0x345d('0x43')]+'%'};return _0x571791;})});}_0x33afbc=_[_0x345d('0x44')]({},_0x33afbc,_0x29d695[_0x345d('0x46')]);return _0x6fbc93['getUsers'](_0x33afbc);}})['then'](function(_0x4801be){if(_0x4801be){_0x4a9217=_0x4801be['length'];if(!_0x29d695['query'][_0x345d('0x3d')](_0x345d('0x3e'))){_0x33afbc[_0x345d('0x20')]=qs['limit'](_0x29d695[_0x345d('0x38')][_0x345d('0x20')]);_0x33afbc[_0x345d('0x23')]=qs['offset'](_0x29d695[_0x345d('0x38')][_0x345d('0x23')]);}return _0x6fbc93['getUsers'](_0x33afbc);}})[_0x345d('0x2a')](function(_0x2e6664){if(_0x2e6664){return _0x2e6664?{'count':_0x4a9217,'rows':_0x2e6664}:null;}})[_0x345d('0x2a')](respondWithResult(_0xff9d9b,null))[_0x345d('0x4b')](handleError(_0xff9d9b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e4455fe..0a05f50 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 _0x0f7b=['SquareProject','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0f7b,0x194));var _0xb0f7=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x0f7b[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0xb0f7('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xb0f7('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb0f7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb0f7('0x3'),'afterDestroy':_0xb0f7('0x4')};function emitEvent(_0xc59d07){return function(_0x20b6cc,_0x4324f2,_0x5d98d7){SquareProjectEvents[_0xb0f7('0x5')](_0xc59d07+':'+_0x20b6cc['id'],_0x20b6cc);SquareProjectEvents[_0xb0f7('0x5')](_0xc59d07,_0x20b6cc);_0x5d98d7(null);};}for(var e in events){if(events[_0xb0f7('0x6')](e)){var event=events[e];SquareProject[_0xb0f7('0x7')](e,emitEvent(event));}}module[_0xb0f7('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x0d0f=['SquareProject','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x29a572,_0x3ebd75){var _0x2ee12f=function(_0x469dac){while(--_0x469dac){_0x29a572['push'](_0x29a572['shift']());}};_0x2ee12f(++_0x3ebd75);}(_0x0d0f,0xac));var _0xf0d0=function(_0xa43cc7,_0x1f13ac){_0xa43cc7=_0xa43cc7-0x0;var _0x2ebed4=_0x0d0f[_0xa43cc7];return _0x2ebed4;};'use strict';var EventEmitter=require(_0xf0d0('0x0'));var SquareProject=require(_0xf0d0('0x1'))['db'][_0xf0d0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5445e7){return function(_0x3f208e,_0x3362c9,_0x52181b){SquareProjectEvents['emit'](_0x5445e7+':'+_0x3f208e['id'],_0x3f208e);SquareProjectEvents[_0xf0d0('0x3')](_0x5445e7,_0x3f208e);_0x52181b(null);};}for(var e in events){if(events[_0xf0d0('0x4')](e)){var event=events[e];SquareProject[_0xf0d0('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 76ca572..c3eb752 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 _0xcc60=['SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x424b97,_0x436e4a){var _0x5d8cb7=function(_0x4db2ea){while(--_0x4db2ea){_0x424b97['push'](_0x424b97['shift']());}};_0x5d8cb7(++_0x436e4a);}(_0xcc60,0x117));var _0x0cc6=function(_0x416ea6,_0x2375d9){_0x416ea6=_0x416ea6-0x0;var _0x590656=_0xcc60[_0x416ea6];return _0x590656;};'use strict';var _=require('lodash');var util=require(_0x0cc6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0cc6('0x1'));var BPromise=require(_0x0cc6('0x2'));var rp=require(_0x0cc6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cc6('0x4'));var config=require(_0x0cc6('0x5'));var attributes=require(_0x0cc6('0x6'));module[_0x0cc6('0x7')]=function(_0xfe1b88,_0x16aeed){return _0xfe1b88[_0x0cc6('0x8')](_0x0cc6('0x9'),attributes,{'tableName':_0x0cc6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ef702,_0x40abd0,_0x50c173){if(_0x4ef702[_0x0cc6('0xb')](_0x0cc6('0xc'))){_0x4ef702[_0x0cc6('0xd')]=moment()[_0x0cc6('0xe')](_0x0cc6('0xf'));}if(_0x4ef702[_0x0cc6('0xb')]('production')){_0x4ef702['publishedAt']=moment()[_0x0cc6('0xe')](_0x0cc6('0xf'));}_0x50c173(null,_0x4ef702);}}});}; \ No newline at end of file +var _0xfa53=['define','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfa53,0x127));var _0x3fa5=function(_0x3a078b,_0x25bc3f){_0x3a078b=_0x3a078b-0x0;var _0x1152f1=_0xfa53[_0x3a078b];return _0x1152f1;};'use strict';var _=require('lodash');var util=require(_0x3fa5('0x0'));var logger=require(_0x3fa5('0x1'))(_0x3fa5('0x2'));var moment=require(_0x3fa5('0x3'));var BPromise=require(_0x3fa5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fa5('0x5'));var rimraf=require(_0x3fa5('0x6'));var config=require(_0x3fa5('0x7'));var attributes=require('./squareProject.attributes');module[_0x3fa5('0x8')]=function(_0x5ec733,_0x3412f2){return _0x5ec733[_0x3fa5('0x9')]('SquareProject',attributes,{'tableName':_0x3fa5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52c401,_0x54f273,_0x50ce81){if(_0x52c401[_0x3fa5('0xb')](_0x3fa5('0xc'))){_0x52c401[_0x3fa5('0xd')]=moment()['format'](_0x3fa5('0xe'));}if(_0x52c401[_0x3fa5('0xb')](_0x3fa5('0xf'))){_0x52c401['publishedAt']=moment()['format'](_0x3fa5('0xe'));}_0x50ce81(null,_0x52c401);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7e6469f..9352ec3 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 _0x3db6=['error','message','info','result','catch','SquareProject','find','options','where','attributes','include','map','model','ShowSquareProject','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x3db6,0x1ca));var _0x63db=function(_0x1c4db4,_0x158732){_0x1c4db4=_0x1c4db4-0x0;var _0xbc21a7=_0x3db6[_0x1c4db4];return _0xbc21a7;};'use strict';var _=require(_0x63db('0x0'));var util=require(_0x63db('0x1'));var moment=require(_0x63db('0x2'));var BPromise=require(_0x63db('0x3'));var rs=require(_0x63db('0x4'));var fs=require('fs');var Redis=require(_0x63db('0x5'));var db=require(_0x63db('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x63db('0x7'));var config=require(_0x63db('0x8'));var jayson=require(_0x63db('0x9'));var client=jayson[_0x63db('0xa')][_0x63db('0xb')]({'port':0x232a});config[_0x63db('0xc')]=_[_0x63db('0xd')](config[_0x63db('0xc')],{'host':_0x63db('0xe'),'port':0x18eb});var socket=require(_0x63db('0xf'))(new Redis(config[_0x63db('0xc')]));require(_0x63db('0x10'))[_0x63db('0x11')](socket);function respondWithRpcPromise(_0x67a60d,_0x42b491,_0x48ce69){return new BPromise(function(_0x19e9f4,_0xfd6a72){return client[_0x63db('0x12')](_0x67a60d,_0x48ce69)[_0x63db('0x13')](function(_0x32e0fa){logger['info'](_0x63db('0x14'),_0x42b491,_0x63db('0x15'));logger[_0x63db('0x16')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x42b491,_0x63db('0x15'),JSON['stringify'](_0x32e0fa));if(_0x32e0fa[_0x63db('0x17')]){if(_0x32e0fa[_0x63db('0x17')]['code']===0x1f4){logger['error'](_0x63db('0x14'),_0x42b491,_0x32e0fa[_0x63db('0x17')][_0x63db('0x18')]);return _0xfd6a72(_0x32e0fa[_0x63db('0x17')][_0x63db('0x18')]);}logger['error'](_0x63db('0x14'),_0x42b491,_0x32e0fa[_0x63db('0x17')][_0x63db('0x18')]);return _0x19e9f4(_0x32e0fa['error'][_0x63db('0x18')]);}else{logger[_0x63db('0x19')](_0x63db('0x14'),_0x42b491,_0x63db('0x15'));_0x19e9f4(_0x32e0fa[_0x63db('0x1a')][_0x63db('0x18')]);}})[_0x63db('0x1b')](function(_0x5336c7){logger[_0x63db('0x17')](_0x63db('0x14'),_0x42b491,_0x5336c7);_0xfd6a72(_0x5336c7);});});}exports['ShowSquareProject']=function(_0x3477ed){var _0x4daffc=this;return new Promise(function(_0x39667f,_0x8e1270){return db[_0x63db('0x1c')][_0x63db('0x1d')]({'raw':_0x3477ed['options']?_0x3477ed[_0x63db('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3477ed[_0x63db('0x1e')]?_0x3477ed[_0x63db('0x1e')][_0x63db('0x1f')]||null:null,'attributes':_0x3477ed[_0x63db('0x1e')]?_0x3477ed[_0x63db('0x1e')][_0x63db('0x20')]||null:null,'include':_0x3477ed[_0x63db('0x1e')]?_0x3477ed[_0x63db('0x1e')][_0x63db('0x21')]?_[_0x63db('0x22')](_0x3477ed['options'][_0x63db('0x21')],function(_0xb89a15){return{'model':db[_0xb89a15[_0x63db('0x23')]],'as':_0xb89a15['as'],'attributes':_0xb89a15[_0x63db('0x20')],'include':_0xb89a15[_0x63db('0x21')]?_[_0x63db('0x22')](_0xb89a15[_0x63db('0x21')],function(_0xcd40){return{'model':db[_0xcd40['model']],'as':_0xcd40['as'],'attributes':_0xcd40['attributes'],'include':_0xcd40[_0x63db('0x21')]?_[_0x63db('0x22')](_0xcd40[_0x63db('0x21')],function(_0x1d5a41){return{'model':db[_0x1d5a41[_0x63db('0x23')]],'as':_0x1d5a41['as'],'attributes':_0x1d5a41[_0x63db('0x20')]};}):[]};}):[]};}):[]:[]})[_0x63db('0x13')](function(_0x4dca4b){logger[_0x63db('0x19')](_0x63db('0x24'),_0x3477ed);logger[_0x63db('0x16')](_0x63db('0x24'),_0x3477ed,JSON['stringify'](_0x4dca4b));_0x39667f(_0x4dca4b);})[_0x63db('0x1b')](function(_0x28eb60){logger[_0x63db('0x17')](_0x63db('0x24'),_0x28eb60[_0x63db('0x18')],_0x3477ed);_0x8e1270(_0x4daffc['error'](0x1f4,_0x28eb60[_0x63db('0x18')]));});});}; \ No newline at end of file +var _0x2501=['bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','model','include','map','lodash','moment'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x2501,0x127));var _0x1250=function(_0x2a46e9,_0x58254a){_0x2a46e9=_0x2a46e9-0x0;var _0x33c393=_0x2501[_0x2a46e9];return _0x33c393;};'use strict';var _=require(_0x1250('0x0'));var util=require('util');var moment=require(_0x1250('0x1'));var BPromise=require(_0x1250('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1250('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1250('0x4'))(_0x1250('0x5'));var config=require(_0x1250('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1250('0x7')][_0x1250('0x8')]({'port':0x232a});config['redis']=_[_0x1250('0x9')](config[_0x1250('0xa')],{'host':_0x1250('0xb'),'port':0x18eb});var socket=require(_0x1250('0xc'))(new Redis(config[_0x1250('0xa')]));require('./squareProject.socket')[_0x1250('0xd')](socket);function respondWithRpcPromise(_0x11dcdf,_0x4256ac,_0x283699){return new BPromise(function(_0x327450,_0x5d9843){return client['request'](_0x11dcdf,_0x283699)[_0x1250('0xe')](function(_0x289c4d){logger[_0x1250('0xf')](_0x1250('0x10'),_0x4256ac,_0x1250('0x11'));logger[_0x1250('0x12')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x4256ac,_0x1250('0x11'),JSON['stringify'](_0x289c4d));if(_0x289c4d['error']){if(_0x289c4d[_0x1250('0x13')][_0x1250('0x14')]===0x1f4){logger[_0x1250('0x13')](_0x1250('0x10'),_0x4256ac,_0x289c4d[_0x1250('0x13')]['message']);return _0x5d9843(_0x289c4d[_0x1250('0x13')][_0x1250('0x15')]);}logger[_0x1250('0x13')](_0x1250('0x10'),_0x4256ac,_0x289c4d[_0x1250('0x13')][_0x1250('0x15')]);return _0x327450(_0x289c4d['error'][_0x1250('0x15')]);}else{logger[_0x1250('0xf')](_0x1250('0x10'),_0x4256ac,_0x1250('0x11'));_0x327450(_0x289c4d[_0x1250('0x16')][_0x1250('0x15')]);}})[_0x1250('0x17')](function(_0x3890fd){logger[_0x1250('0x13')](_0x1250('0x10'),_0x4256ac,_0x3890fd);_0x5d9843(_0x3890fd);});});}exports[_0x1250('0x18')]=function(_0x5c0678){var _0x16a8d8=this;return new Promise(function(_0x2ff999,_0x58cbc7){return db[_0x1250('0x19')][_0x1250('0x1a')]({'raw':_0x5c0678[_0x1250('0x1b')]?_0x5c0678[_0x1250('0x1b')][_0x1250('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c0678[_0x1250('0x1b')]?_0x5c0678[_0x1250('0x1b')]['where']||null:null,'attributes':_0x5c0678[_0x1250('0x1b')]?_0x5c0678[_0x1250('0x1b')][_0x1250('0x1d')]||null:null,'include':_0x5c0678[_0x1250('0x1b')]?_0x5c0678[_0x1250('0x1b')]['include']?_['map'](_0x5c0678[_0x1250('0x1b')]['include'],function(_0x39a881){return{'model':db[_0x39a881[_0x1250('0x1e')]],'as':_0x39a881['as'],'attributes':_0x39a881[_0x1250('0x1d')],'include':_0x39a881[_0x1250('0x1f')]?_['map'](_0x39a881['include'],function(_0x467ede){return{'model':db[_0x467ede[_0x1250('0x1e')]],'as':_0x467ede['as'],'attributes':_0x467ede['attributes'],'include':_0x467ede[_0x1250('0x1f')]?_[_0x1250('0x20')](_0x467ede[_0x1250('0x1f')],function(_0x186171){return{'model':db[_0x186171[_0x1250('0x1e')]],'as':_0x186171['as'],'attributes':_0x186171[_0x1250('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1250('0xe')](function(_0x114800){logger[_0x1250('0xf')](_0x1250('0x18'),_0x5c0678);logger[_0x1250('0x12')](_0x1250('0x18'),_0x5c0678,JSON['stringify'](_0x114800));_0x2ff999(_0x114800);})[_0x1250('0x17')](function(_0x2ebd0b){logger[_0x1250('0x13')](_0x1250('0x18'),_0x2ebd0b[_0x1250('0x15')],_0x5c0678);_0x58cbc7(_0x16a8d8[_0x1250('0x13')](0x1f4,_0x2ebd0b[_0x1250('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 099db7d..f56f6cf 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 _0xba17=['remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x5ad4dc,_0x585b84){var _0x504c6f=function(_0x21cc06){while(--_0x21cc06){_0x5ad4dc['push'](_0x5ad4dc['shift']());}};_0x504c6f(++_0x585b84);}(_0xba17,0xb2));var _0x7ba1=function(_0x1f8dc7,_0x49f961){_0x1f8dc7=_0x1f8dc7-0x0;var _0x2dea47=_0xba17[_0x1f8dc7];return _0x2dea47;};'use strict';var SquareProjectEvents=require(_0x7ba1('0x0'));var events=[_0x7ba1('0x1'),_0x7ba1('0x2'),_0x7ba1('0x3')];function createListener(_0x44f3dc,_0x2057b6){return function(_0x52d6d4){_0x2057b6[_0x7ba1('0x4')](_0x44f3dc,_0x52d6d4);};}function removeListener(_0x465d48,_0x1dbbc5){return function(){SquareProjectEvents[_0x7ba1('0x5')](_0x465d48,_0x1dbbc5);};}exports[_0x7ba1('0x6')]=function(_0x1a4224){for(var _0x44f568=0x0,_0x533728=events[_0x7ba1('0x7')];_0x44f568<_0x533728;_0x44f568++){var _0x11c343=events[_0x44f568];var _0x1fec56=createListener(_0x7ba1('0x8')+_0x11c343,_0x1a4224);SquareProjectEvents['on'](_0x11c343,_0x1fec56);}}; \ No newline at end of file +var _0xc5d7=['remove','update','removeListener','length','squareProject:','./squareProject.events','save'];(function(_0x5479d7,_0x2691bb){var _0x4edca6=function(_0x21cffc){while(--_0x21cffc){_0x5479d7['push'](_0x5479d7['shift']());}};_0x4edca6(++_0x2691bb);}(_0xc5d7,0xe5));var _0x7c5d=function(_0x29801d,_0x2ce447){_0x29801d=_0x29801d-0x0;var _0x16a5ee=_0xc5d7[_0x29801d];return _0x16a5ee;};'use strict';var SquareProjectEvents=require(_0x7c5d('0x0'));var events=[_0x7c5d('0x1'),_0x7c5d('0x2'),_0x7c5d('0x3')];function createListener(_0x5b8da2,_0x315f10){return function(_0x317bee){_0x315f10['emit'](_0x5b8da2,_0x317bee);};}function removeListener(_0x532592,_0x9aea58){return function(){SquareProjectEvents[_0x7c5d('0x4')](_0x532592,_0x9aea58);};}exports['register']=function(_0x16bf27){for(var _0x3507e9=0x0,_0xb216aa=events[_0x7c5d('0x5')];_0x3507e9<_0xb216aa;_0x3507e9++){var _0x703e1=events[_0x3507e9];var _0x47de0f=createListener(_0x7c5d('0x6')+_0x703e1,_0x16bf27);SquareProjectEvents['on'](_0x703e1,_0x47de0f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d97cf6f..f5bd3b6 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x546409,_0x2d6782){var _0x371e61=function(_0x5f0649){while(--_0x5f0649){_0x546409['push'](_0x546409['shift']());}};_0x371e61(++_0x2d6782);}(_0xe14b,0x93));var _0xbe14=function(_0x515adb,_0x3f8dc5){_0x515adb=_0x515adb-0x0;var _0x24c637=_0xe14b[_0x515adb];return _0x24c637;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x7217,0x19e));var _0x7721=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x7217[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3ea0ec6..a880c60 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 _0xb4c7=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x40d2c9,_0x48c65a){var _0x43a1d3=function(_0x589ec1){while(--_0x589ec1){_0x40d2c9['push'](_0x40d2c9['shift']());}};_0x43a1d3(++_0x48c65a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4baec6,_0x3cc795){_0x4baec6=_0x4baec6-0x0;var _0x2422da=_0xb4c7[_0x4baec6];return _0x2422da;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'callerid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize[_0x7b4c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize[_0x7b4c('0x2')]},'dnid':{'type':Sequelize[_0x7b4c('0x2')]},'projectName':{'type':Sequelize[_0x7b4c('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7b4c('0x2')]},'savePath':{'type':Sequelize[_0x7b4c('0x2')]},'format':{'type':Sequelize[_0x7b4c('0x3')],'get':function(){var _0x4bf85d='';var _0x2d7b7e=this[_0x7b4c('0x4')]('savePath');if(_0x2d7b7e){_0x4bf85d=_0x2d7b7e[_0x7b4c('0x5')](_0x2d7b7e[_0x7b4c('0x6')]('.'));}return _0x4bf85d;}}}; \ No newline at end of file +var _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x18eaf1,_0x44b2a2){var _0x4ce917=function(_0x4539be){while(--_0x4539be){_0x18eaf1['push'](_0x18eaf1['shift']());}};_0x4ce917(++_0x44b2a2);}(_0x6f47,0xc7));var _0x76f4=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x6f47[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 79852bd..15fae4d 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 _0x1b0b=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','options','findAll','catch','params','intersection','fields','includeAll','include','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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'];(function(_0x18ad55,_0x490824){var _0x4e3acd=function(_0x25855d){while(--_0x25855d){_0x18ad55['push'](_0x18ad55['shift']());}};_0x4e3acd(++_0x490824);}(_0x1b0b,0x112));var _0xb1b0=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1b0b[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xb1b0('0x0'));var rimraf=require(_0xb1b0('0x1'));var zipdir=require(_0xb1b0('0x2'));var jsonpatch=require(_0xb1b0('0x3'));var rp=require(_0xb1b0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb1b0('0x5'));var util=require('util');var path=require(_0xb1b0('0x6'));var sox=require(_0xb1b0('0x7'));var csv=require(_0xb1b0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1b0('0x9'));var _=require(_0xb1b0('0xa'));var squel=require(_0xb1b0('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1b0('0xc'));var deskjs=require(_0xb1b0('0xd'));var toCsv=require(_0xb1b0('0x8'));var querystring=require(_0xb1b0('0xe'));var Papa=require(_0xb1b0('0xf'));var Redis=require(_0xb1b0('0x10'));var authService=require(_0xb1b0('0x11'));var qs=require(_0xb1b0('0x12'));var as=require(_0xb1b0('0x13'));var hardwareService=require(_0xb1b0('0x14'));var logger=require(_0xb1b0('0x15'))(_0xb1b0('0x16'));var utils=require(_0xb1b0('0x17'));var config=require(_0xb1b0('0x18'));var licenseUtil=require(_0xb1b0('0x19'));var db=require(_0xb1b0('0x1a'))['db'];function respondWithStatusCode(_0x43786d,_0xbb64fa){_0xbb64fa=_0xbb64fa||0xcc;return function(_0x1bda35){if(_0x1bda35){return _0x43786d['sendStatus'](_0xbb64fa);}return _0x43786d[_0xb1b0('0x1b')](_0xbb64fa)[_0xb1b0('0x1c')]();};}function respondWithResult(_0x539d6f,_0x3e0b47){_0x3e0b47=_0x3e0b47||0xc8;return function(_0x332a6a){if(_0x332a6a){return _0x539d6f['status'](_0x3e0b47)[_0xb1b0('0x1d')](_0x332a6a);}};}function respondWithFilteredResult(_0x49de76,_0x228d20){return function(_0x4afced){if(_0x4afced){var _0x366bfc=typeof _0x228d20[_0xb1b0('0x1e')]===_0xb1b0('0x1f')&&typeof _0x228d20[_0xb1b0('0x20')]===_0xb1b0('0x1f');var _0x4a5bd8=_0x4afced[_0xb1b0('0x21')];var _0x2619b0=_0x366bfc?0x0:_0x228d20[_0xb1b0('0x1e')];var _0x3ec6e5=_0x366bfc?_0x4afced[_0xb1b0('0x21')]:_0x228d20['offset']+_0x228d20[_0xb1b0('0x20')];var _0x385558;if(_0x3ec6e5>=_0x4a5bd8){_0x3ec6e5=_0x4a5bd8;_0x385558=0xc8;}else{_0x385558=0xce;}_0x49de76[_0xb1b0('0x1b')](_0x385558);return _0x49de76[_0xb1b0('0x22')](_0xb1b0('0x23'),_0x2619b0+'-'+_0x3ec6e5+'/'+_0x4a5bd8)[_0xb1b0('0x1d')](_0x4afced);}return null;};}function patchUpdates(_0x53838a){return function(_0x26ddee){try{jsonpatch['apply'](_0x26ddee,_0x53838a,!![]);}catch(_0x53f43e){return BPromise[_0xb1b0('0x24')](_0x53f43e);}return _0x26ddee['save']();};}function saveUpdates(_0x43f038,_0x4c450a){return function(_0x50b218){if(_0x50b218){return _0x50b218['update'](_0x43f038)[_0xb1b0('0x25')](function(_0x50a2c9){return _0x50a2c9;});}return null;};}function removeEntity(_0x485ba1,_0x983d8b){return function(_0x3f9def){if(_0x3f9def){return _0x3f9def[_0xb1b0('0x26')]()['then'](function(){_0x485ba1[_0xb1b0('0x1b')](0xcc)[_0xb1b0('0x1c')]();});}};}function handleEntityNotFound(_0x3a2c92,_0x518c42){return function(_0x449b3b){if(!_0x449b3b){_0x3a2c92['sendStatus'](0x194);}return _0x449b3b;};}function handleError(_0x56042e,_0xbddf98){_0xbddf98=_0xbddf98||0x1f4;return function(_0x3b541b){logger[_0xb1b0('0x27')](_0x3b541b[_0xb1b0('0x28')]);if(_0x3b541b[_0xb1b0('0x29')]){delete _0x3b541b[_0xb1b0('0x29')];}_0x56042e[_0xb1b0('0x1b')](_0xbddf98)[_0xb1b0('0x2a')](_0x3b541b);};}exports[_0xb1b0('0x2b')]=function(_0x5e3ed6,_0x3d856a){var _0x2dbe60={},_0x17e1f9={},_0x31fa34={'count':0x0,'rows':[]};var _0x344e0c=_['map'](db[_0xb1b0('0x2c')][_0xb1b0('0x2d')],function(_0x4b026e){return{'name':_0x4b026e[_0xb1b0('0x2e')],'type':_0x4b026e[_0xb1b0('0x2f')][_0xb1b0('0x30')]};});_0x17e1f9['model']=_['map'](_0x344e0c,'name');_0x17e1f9[_0xb1b0('0x31')]=_[_0xb1b0('0x32')](_0x5e3ed6[_0xb1b0('0x31')]);_0x17e1f9[_0xb1b0('0x33')]=_['intersection'](_0x17e1f9['model'],_0x17e1f9[_0xb1b0('0x31')]);_0x2dbe60[_0xb1b0('0x34')]=_['intersection'](_0x17e1f9['model'],qs['fields'](_0x5e3ed6[_0xb1b0('0x31')]['fields']));_0x2dbe60['attributes']=_0x2dbe60[_0xb1b0('0x34')]['length']?_0x2dbe60['attributes']:_0x17e1f9[_0xb1b0('0x35')];if(!_0x5e3ed6[_0xb1b0('0x31')][_0xb1b0('0x36')]('nolimit')){_0x2dbe60[_0xb1b0('0x20')]=qs[_0xb1b0('0x20')](_0x5e3ed6['query'][_0xb1b0('0x20')]);_0x2dbe60[_0xb1b0('0x1e')]=qs[_0xb1b0('0x1e')](_0x5e3ed6['query']['offset']);}_0x2dbe60[_0xb1b0('0x37')]=qs[_0xb1b0('0x38')](_0x5e3ed6[_0xb1b0('0x31')][_0xb1b0('0x38')]);_0x2dbe60['where']=qs[_0xb1b0('0x33')](_[_0xb1b0('0x39')](_0x5e3ed6[_0xb1b0('0x31')],_0x17e1f9['filters']),_0x344e0c);if(_0x5e3ed6[_0xb1b0('0x31')]['filter']){_0x2dbe60['where']=_[_0xb1b0('0x3a')](_0x2dbe60[_0xb1b0('0x3b')],{'$or':_['map'](_0x344e0c,function(_0x38ffcc){if(_0x38ffcc[_0xb1b0('0x2f')]!==_0xb1b0('0x3c')){var _0x3803bd={};_0x3803bd[_0x38ffcc['name']]={'$like':'%'+_0x5e3ed6[_0xb1b0('0x31')]['filter']+'%'};return _0x3803bd;}})});}_0x2dbe60=_[_0xb1b0('0x3a')]({},_0x2dbe60,_0x5e3ed6[_0xb1b0('0x3d')]);var _0x322608={'where':_0x2dbe60[_0xb1b0('0x3b')]};return db[_0xb1b0('0x2c')][_0xb1b0('0x21')](_0x322608)[_0xb1b0('0x25')](function(_0x199e7b){_0x31fa34[_0xb1b0('0x21')]=_0x199e7b;if(_0x5e3ed6[_0xb1b0('0x31')]['includeAll']){_0x2dbe60['include']=[{'all':!![]}];}return db['SquareRecording'][_0xb1b0('0x3e')](_0x2dbe60);})[_0xb1b0('0x25')](function(_0x31f6fa){_0x31fa34['rows']=_0x31f6fa;return _0x31fa34;})[_0xb1b0('0x25')](respondWithFilteredResult(_0x3d856a,_0x2dbe60))[_0xb1b0('0x3f')](handleError(_0x3d856a,null));};exports['show']=function(_0x4213ff,_0x19ad60){var _0x426bd1={'raw':!![],'where':{'id':_0x4213ff[_0xb1b0('0x40')]['id']}},_0x5928c8={};_0x5928c8[_0xb1b0('0x35')]=_['keys'](db['SquareRecording'][_0xb1b0('0x2d')]);_0x5928c8[_0xb1b0('0x31')]=_[_0xb1b0('0x32')](_0x4213ff[_0xb1b0('0x31')]);_0x5928c8[_0xb1b0('0x33')]=_[_0xb1b0('0x41')](_0x5928c8['model'],_0x5928c8[_0xb1b0('0x31')]);_0x426bd1[_0xb1b0('0x34')]=_[_0xb1b0('0x41')](_0x5928c8[_0xb1b0('0x35')],qs['fields'](_0x4213ff[_0xb1b0('0x31')][_0xb1b0('0x42')]));_0x426bd1[_0xb1b0('0x34')]=_0x426bd1[_0xb1b0('0x34')]['length']?_0x426bd1['attributes']:_0x5928c8[_0xb1b0('0x35')];if(_0x4213ff[_0xb1b0('0x31')][_0xb1b0('0x43')]){_0x426bd1[_0xb1b0('0x44')]=[{'all':!![]}];}_0x426bd1=_[_0xb1b0('0x3a')]({},_0x426bd1,_0x4213ff[_0xb1b0('0x3d')]);return db[_0xb1b0('0x2c')][_0xb1b0('0x45')](_0x426bd1)[_0xb1b0('0x25')](handleEntityNotFound(_0x19ad60,null))[_0xb1b0('0x25')](respondWithResult(_0x19ad60,null))['catch'](handleError(_0x19ad60,null));};exports[_0xb1b0('0x46')]=function(_0x22652e,_0x3edb62){return db[_0xb1b0('0x2c')]['create'](_0x22652e[_0xb1b0('0x47')],{})[_0xb1b0('0x25')](respondWithResult(_0x3edb62,0xc9))['catch'](handleError(_0x3edb62,null));};exports[_0xb1b0('0x48')]=function(_0xb8830a,_0x4a9c12){if(_0xb8830a[_0xb1b0('0x47')]['id']){delete _0xb8830a['body']['id'];}return db[_0xb1b0('0x2c')]['find']({'where':{'id':_0xb8830a[_0xb1b0('0x40')]['id']}})[_0xb1b0('0x25')](handleEntityNotFound(_0x4a9c12,null))[_0xb1b0('0x25')](saveUpdates(_0xb8830a[_0xb1b0('0x47')],null))[_0xb1b0('0x25')](respondWithResult(_0x4a9c12,null))[_0xb1b0('0x3f')](handleError(_0x4a9c12,null));};exports[_0xb1b0('0x49')]=function(_0x570a5a,_0x571c77,_0x581e2a){var _0x498f63=require(_0xb1b0('0x4a'));var _0x3aac40=![];var _0x3ca920={};if(_0x570a5a[_0xb1b0('0x31')][_0xb1b0('0x2f')]&&_0x570a5a[_0xb1b0('0x31')][_0xb1b0('0x2f')]===_0xb1b0('0x4b')){_0x3ca920[_0xb1b0('0x4b')]=_0x570a5a[_0xb1b0('0x40')]['id'];}else{_0x3ca920['id']=_0x570a5a[_0xb1b0('0x40')]['id'];}return db['SquareRecording'][_0xb1b0('0x45')]({'where':_0x3ca920,'attributes':['id',_0xb1b0('0x4c'),_0xb1b0('0x4d')],'raw':!![]})[_0xb1b0('0x25')](handleEntityNotFound(_0x571c77,null))[_0xb1b0('0x25')](function(_0x4f55bb){if(_0x4f55bb){var _0x5616b6=_0x4f55bb['savePath'];var _0x1f4c26=util[_0xb1b0('0x4e')](_0xb1b0('0x4f'),_0x5616b6);if(fs[_0xb1b0('0x50')](_0x1f4c26)){_0x3aac40=!![];return _0x498f63[_0xb1b0('0x51')](_0x1f4c26,_0x5616b6,config[_0xb1b0('0x52')][_0xb1b0('0x53')])[_0xb1b0('0x25')](function(){return _0x4f55bb;});}return _0x4f55bb;}})['then'](function(_0x51d61b){if(_0x51d61b){var _0xe55a30=_0x51d61b[_0xb1b0('0x4c')];if(!fs[_0xb1b0('0x50')](_0xe55a30)){throw new db[(_0xb1b0('0x54'))][(_0xb1b0('0x55'))](_0xb1b0('0x56'));}if(_0x51d61b[_0xb1b0('0x4d')]){return _0x571c77['download'](_0xe55a30,_0x51d61b[_0xb1b0('0x4d')]+path[_0xb1b0('0x57')](_0xe55a30),function(){if(_0x3aac40){fs[_0xb1b0('0x58')](_0xe55a30);}});}else{return _0x571c77[_0xb1b0('0x49')](_0xe55a30,function(_0x32606d){if(_0x3aac40){fs[_0xb1b0('0x58')](_0xe55a30);}});}}})[_0xb1b0('0x3f')](function(_0x1784fb){if(_0x1784fb[_0xb1b0('0x59')]===_0xb1b0('0x56')){_0x571c77[_0xb1b0('0x1b')](0x194)['send'](_0xb1b0('0x5a'));}else{return handleError(_0x571c77,null);}});};exports[_0xb1b0('0x26')]=function(_0x3454fd,_0x21756e){return db[_0xb1b0('0x2c')]['find']({'where':{'id':_0x3454fd[_0xb1b0('0x40')]['id']}})[_0xb1b0('0x25')](function(_0x1fcf58){if(_[_0xb1b0('0x5b')](_0x1fcf58)){throw new ReferenceError(_0xb1b0('0x5c'));}return _0x1fcf58;})[_0xb1b0('0x25')](function(_0x1130ba){var _0x2276c4=_0x1130ba[_0xb1b0('0x4c')];logger[_0xb1b0('0x5d')](_0xb1b0('0x5e'),_0x2276c4);if(!_[_0xb1b0('0x5b')](_0x1130ba[_0xb1b0('0x4c')])&&fs['existsSync'](_0x2276c4)){logger['info'](_0xb1b0('0x5f')+_0x2276c4+_0xb1b0('0x60'));fs[_0xb1b0('0x61')](_0x2276c4);}_0x2276c4=_0x2276c4+_0xb1b0('0x62');if(!_[_0xb1b0('0x5b')](_0x1130ba[_0xb1b0('0x4c')])&&fs[_0xb1b0('0x50')](_0x2276c4)){logger['info'](_0xb1b0('0x5f')+_0x2276c4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb1b0('0x61')](_0x2276c4);}return _0x1130ba;})[_0xb1b0('0x25')](function(_0x2f6448){if(!_0x2f6448)throw new InternalError();return _0x2f6448['destroy']();})['then'](function(){_0x21756e[_0xb1b0('0x1b')](0xcc)[_0xb1b0('0x1c')]();})[_0xb1b0('0x3f')](handleError(_0x21756e,null));}; \ No newline at end of file +var _0x2f37=['end','sendStatus','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','existsSync','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x5cb3ea,_0x2c9f96){var _0x5af664=function(_0x551616){while(--_0x551616){_0x5cb3ea['push'](_0x5cb3ea['shift']());}};_0x5af664(++_0x2c9f96);}(_0x2f37,0xa7));var _0x72f3=function(_0x3d4cf0,_0x33c6d6){_0x3d4cf0=_0x3d4cf0-0x0;var _0x3577bd=_0x2f37[_0x3d4cf0];return _0x3577bd;};'use strict';var emlformat=require(_0x72f3('0x0'));var rimraf=require(_0x72f3('0x1'));var zipdir=require(_0x72f3('0x2'));var jsonpatch=require(_0x72f3('0x3'));var rp=require(_0x72f3('0x4'));var moment=require(_0x72f3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x72f3('0x6'));var util=require(_0x72f3('0x7'));var path=require(_0x72f3('0x8'));var sox=require(_0x72f3('0x9'));var csv=require(_0x72f3('0xa'));var ejs=require(_0x72f3('0xb'));var fs=require('fs');var fs_extra=require(_0x72f3('0xc'));var _=require(_0x72f3('0xd'));var squel=require(_0x72f3('0xe'));var crypto=require(_0x72f3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x72f3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x72f3('0x11'));var Papa=require(_0x72f3('0x12'));var Redis=require(_0x72f3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x72f3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72f3('0x15'));var logger=require(_0x72f3('0x16'))(_0x72f3('0x17'));var utils=require(_0x72f3('0x18'));var config=require(_0x72f3('0x19'));var licenseUtil=require(_0x72f3('0x1a'));var db=require(_0x72f3('0x1b'))['db'];function respondWithStatusCode(_0x57ff7b,_0x384c58){_0x384c58=_0x384c58||0xcc;return function(_0x39b10f){if(_0x39b10f){return _0x57ff7b['sendStatus'](_0x384c58);}return _0x57ff7b[_0x72f3('0x1c')](_0x384c58)['end']();};}function respondWithResult(_0x402769,_0x338f7d){_0x338f7d=_0x338f7d||0xc8;return function(_0x2d4387){if(_0x2d4387){return _0x402769[_0x72f3('0x1c')](_0x338f7d)[_0x72f3('0x1d')](_0x2d4387);}};}function respondWithFilteredResult(_0x3f8002,_0x5b2664){return function(_0x2133ec){if(_0x2133ec){var _0x5cdb24=typeof _0x5b2664[_0x72f3('0x1e')]===_0x72f3('0x1f')&&typeof _0x5b2664[_0x72f3('0x20')]==='undefined';var _0x108a34=_0x2133ec[_0x72f3('0x21')];var _0x3a4e68=_0x5cdb24?0x0:_0x5b2664[_0x72f3('0x1e')];var _0x3939af=_0x5cdb24?_0x2133ec[_0x72f3('0x21')]:_0x5b2664[_0x72f3('0x1e')]+_0x5b2664['limit'];var _0x1e814c;if(_0x3939af>=_0x108a34){_0x3939af=_0x108a34;_0x1e814c=0xc8;}else{_0x1e814c=0xce;}_0x3f8002[_0x72f3('0x1c')](_0x1e814c);return _0x3f8002[_0x72f3('0x22')](_0x72f3('0x23'),_0x3a4e68+'-'+_0x3939af+'/'+_0x108a34)['json'](_0x2133ec);}return null;};}function patchUpdates(_0x1e4dd7){return function(_0x7f0e24){try{jsonpatch[_0x72f3('0x24')](_0x7f0e24,_0x1e4dd7,!![]);}catch(_0x43213d){return BPromise[_0x72f3('0x25')](_0x43213d);}return _0x7f0e24['save']();};}function saveUpdates(_0xf94355,_0x22ca0c){return function(_0x2fd610){if(_0x2fd610){return _0x2fd610[_0x72f3('0x26')](_0xf94355)[_0x72f3('0x27')](function(_0x55f78d){return _0x55f78d;});}return null;};}function removeEntity(_0x1ddd6b,_0x4bd1f9){return function(_0x32fcd8){if(_0x32fcd8){return _0x32fcd8[_0x72f3('0x28')]()[_0x72f3('0x27')](function(){_0x1ddd6b[_0x72f3('0x1c')](0xcc)[_0x72f3('0x29')]();});}};}function handleEntityNotFound(_0x5bff56,_0x3676a7){return function(_0x52f668){if(!_0x52f668){_0x5bff56[_0x72f3('0x2a')](0x194);}return _0x52f668;};}function handleError(_0x180de4,_0x403132){_0x403132=_0x403132||0x1f4;return function(_0x306ce8){logger[_0x72f3('0x2b')](_0x306ce8[_0x72f3('0x2c')]);if(_0x306ce8[_0x72f3('0x2d')]){delete _0x306ce8['name'];}_0x180de4['status'](_0x403132)[_0x72f3('0x2e')](_0x306ce8);};}exports[_0x72f3('0x2f')]=function(_0x1f85a4,_0x877a){var _0x23e582={},_0x3b996b={},_0x5cf574={'count':0x0,'rows':[]};var _0x5e84aa=_['map'](db[_0x72f3('0x30')][_0x72f3('0x31')],function(_0x26721b){return{'name':_0x26721b[_0x72f3('0x32')],'type':_0x26721b[_0x72f3('0x33')][_0x72f3('0x34')]};});_0x3b996b[_0x72f3('0x35')]=_['map'](_0x5e84aa,_0x72f3('0x2d'));_0x3b996b[_0x72f3('0x36')]=_[_0x72f3('0x37')](_0x1f85a4[_0x72f3('0x36')]);_0x3b996b['filters']=_[_0x72f3('0x38')](_0x3b996b['model'],_0x3b996b['query']);_0x23e582[_0x72f3('0x39')]=_[_0x72f3('0x38')](_0x3b996b['model'],qs[_0x72f3('0x3a')](_0x1f85a4[_0x72f3('0x36')][_0x72f3('0x3a')]));_0x23e582[_0x72f3('0x39')]=_0x23e582['attributes']['length']?_0x23e582['attributes']:_0x3b996b[_0x72f3('0x35')];if(!_0x1f85a4[_0x72f3('0x36')][_0x72f3('0x3b')](_0x72f3('0x3c'))){_0x23e582[_0x72f3('0x20')]=qs['limit'](_0x1f85a4[_0x72f3('0x36')][_0x72f3('0x20')]);_0x23e582[_0x72f3('0x1e')]=qs[_0x72f3('0x1e')](_0x1f85a4['query'][_0x72f3('0x1e')]);}_0x23e582[_0x72f3('0x3d')]=qs[_0x72f3('0x3e')](_0x1f85a4[_0x72f3('0x36')]['sort']);_0x23e582[_0x72f3('0x3f')]=qs['filters'](_['pick'](_0x1f85a4[_0x72f3('0x36')],_0x3b996b[_0x72f3('0x40')]),_0x5e84aa);if(_0x1f85a4[_0x72f3('0x36')][_0x72f3('0x41')]){_0x23e582[_0x72f3('0x3f')]=_['merge'](_0x23e582[_0x72f3('0x3f')],{'$or':_[_0x72f3('0x42')](_0x5e84aa,function(_0x55ea0d){if(_0x55ea0d[_0x72f3('0x33')]!==_0x72f3('0x43')){var _0x25c4f3={};_0x25c4f3[_0x55ea0d[_0x72f3('0x2d')]]={'$like':'%'+_0x1f85a4[_0x72f3('0x36')][_0x72f3('0x41')]+'%'};return _0x25c4f3;}})});}_0x23e582=_[_0x72f3('0x44')]({},_0x23e582,_0x1f85a4['options']);var _0xd74ad5={'where':_0x23e582['where']};return db[_0x72f3('0x30')][_0x72f3('0x21')](_0xd74ad5)[_0x72f3('0x27')](function(_0x290da8){_0x5cf574['count']=_0x290da8;if(_0x1f85a4[_0x72f3('0x36')][_0x72f3('0x45')]){_0x23e582[_0x72f3('0x46')]=[{'all':!![]}];}return db[_0x72f3('0x30')][_0x72f3('0x47')](_0x23e582);})[_0x72f3('0x27')](function(_0x201495){_0x5cf574[_0x72f3('0x48')]=_0x201495;return _0x5cf574;})[_0x72f3('0x27')](respondWithFilteredResult(_0x877a,_0x23e582))['catch'](handleError(_0x877a,null));};exports[_0x72f3('0x49')]=function(_0x1c5015,_0x20c180){var _0xb00f04={'raw':!![],'where':{'id':_0x1c5015[_0x72f3('0x4a')]['id']}},_0x2114ed={};_0x2114ed[_0x72f3('0x35')]=_[_0x72f3('0x37')](db[_0x72f3('0x30')][_0x72f3('0x31')]);_0x2114ed[_0x72f3('0x36')]=_[_0x72f3('0x37')](_0x1c5015[_0x72f3('0x36')]);_0x2114ed[_0x72f3('0x40')]=_[_0x72f3('0x38')](_0x2114ed[_0x72f3('0x35')],_0x2114ed['query']);_0xb00f04['attributes']=_[_0x72f3('0x38')](_0x2114ed[_0x72f3('0x35')],qs[_0x72f3('0x3a')](_0x1c5015[_0x72f3('0x36')][_0x72f3('0x3a')]));_0xb00f04[_0x72f3('0x39')]=_0xb00f04[_0x72f3('0x39')]['length']?_0xb00f04['attributes']:_0x2114ed[_0x72f3('0x35')];if(_0x1c5015[_0x72f3('0x36')][_0x72f3('0x45')]){_0xb00f04[_0x72f3('0x46')]=[{'all':!![]}];}_0xb00f04=_['merge']({},_0xb00f04,_0x1c5015[_0x72f3('0x4b')]);return db[_0x72f3('0x30')][_0x72f3('0x4c')](_0xb00f04)['then'](handleEntityNotFound(_0x20c180,null))[_0x72f3('0x27')](respondWithResult(_0x20c180,null))['catch'](handleError(_0x20c180,null));};exports[_0x72f3('0x4d')]=function(_0x54f5ca,_0x18a8fd){return db[_0x72f3('0x30')]['create'](_0x54f5ca[_0x72f3('0x4e')],{})[_0x72f3('0x27')](respondWithResult(_0x18a8fd,0xc9))[_0x72f3('0x4f')](handleError(_0x18a8fd,null));};exports[_0x72f3('0x26')]=function(_0xcc2c39,_0x476699){if(_0xcc2c39[_0x72f3('0x4e')]['id']){delete _0xcc2c39[_0x72f3('0x4e')]['id'];}return db[_0x72f3('0x30')][_0x72f3('0x4c')]({'where':{'id':_0xcc2c39[_0x72f3('0x4a')]['id']}})[_0x72f3('0x27')](handleEntityNotFound(_0x476699,null))[_0x72f3('0x27')](saveUpdates(_0xcc2c39[_0x72f3('0x4e')],null))[_0x72f3('0x27')](respondWithResult(_0x476699,null))[_0x72f3('0x4f')](handleError(_0x476699,null));};exports[_0x72f3('0x50')]=function(_0x1736e5,_0x39c2e6,_0x356fd7){var _0x5e891d=require(_0x72f3('0x51'));var _0x51e0cc=![];var _0xa59e7e={};if(_0x1736e5[_0x72f3('0x36')]['type']&&_0x1736e5['query'][_0x72f3('0x33')]===_0x72f3('0x52')){_0xa59e7e[_0x72f3('0x52')]=_0x1736e5[_0x72f3('0x4a')]['id'];}else{_0xa59e7e['id']=_0x1736e5['params']['id'];}return db[_0x72f3('0x30')][_0x72f3('0x4c')]({'where':_0xa59e7e,'attributes':['id',_0x72f3('0x53'),_0x72f3('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x39c2e6,null))['then'](function(_0x575ad0){if(_0x575ad0){var _0x401017=_0x575ad0[_0x72f3('0x53')];var _0x4a62df=util[_0x72f3('0x55')](_0x72f3('0x56'),_0x401017);if(fs['existsSync'](_0x4a62df)){_0x51e0cc=!![];return _0x5e891d['decryptFile'](_0x4a62df,_0x401017,config[_0x72f3('0x57')]['recording'])['then'](function(){return _0x575ad0;});}return _0x575ad0;}})['then'](function(_0x22e2ab){if(_0x22e2ab){var _0x587603=_0x22e2ab[_0x72f3('0x53')];if(!fs['existsSync'](_0x587603)){throw new db[(_0x72f3('0x58'))][(_0x72f3('0x59'))](_0x72f3('0x5a'));}if(_0x22e2ab[_0x72f3('0x54')]){return _0x39c2e6[_0x72f3('0x50')](_0x587603,_0x22e2ab['filename']+path[_0x72f3('0x5b')](_0x587603),function(){if(_0x51e0cc){fs[_0x72f3('0x5c')](_0x587603);}});}else{return _0x39c2e6[_0x72f3('0x50')](_0x587603,function(_0x4c0601){if(_0x51e0cc){fs['unlink'](_0x587603);}});}}})['catch'](function(_0xfc71e5){if(_0xfc71e5[_0x72f3('0x5d')]===_0x72f3('0x5a')){_0x39c2e6[_0x72f3('0x1c')](0x194)[_0x72f3('0x2e')](_0x72f3('0x5e'));}else{return handleError(_0x39c2e6,null);}});};exports[_0x72f3('0x28')]=function(_0x488f50,_0x38376f){return db[_0x72f3('0x30')][_0x72f3('0x4c')]({'where':{'id':_0x488f50[_0x72f3('0x4a')]['id']}})[_0x72f3('0x27')](function(_0xc25dce){if(_[_0x72f3('0x5f')](_0xc25dce)){throw new ReferenceError(_0x72f3('0x60'));}return _0xc25dce;})[_0x72f3('0x27')](function(_0x3ad757){var _0x24472e=_0x3ad757['savePath'];logger['info'](_0x72f3('0x61'),_0x24472e);if(!_[_0x72f3('0x5f')](_0x3ad757[_0x72f3('0x53')])&&fs[_0x72f3('0x62')](_0x24472e)){logger[_0x72f3('0x63')]('File:\x20\x22'+_0x24472e+_0x72f3('0x64'));fs[_0x72f3('0x65')](_0x24472e);}_0x24472e=_0x24472e+_0x72f3('0x66');if(!_[_0x72f3('0x5f')](_0x3ad757[_0x72f3('0x53')])&&fs[_0x72f3('0x62')](_0x24472e)){logger[_0x72f3('0x63')](_0x72f3('0x67')+_0x24472e+_0x72f3('0x64'));fs[_0x72f3('0x65')](_0x24472e);}return _0x3ad757;})['then'](function(_0x40fde9){if(!_0x40fde9)throw new InternalError();return _0x40fde9['destroy']();})[_0x72f3('0x27')](function(){_0x38376f[_0x72f3('0x1c')](0xcc)[_0x72f3('0x29')]();})['catch'](handleError(_0x38376f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0202c48..6662434 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 _0x292c=['define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x292c,0x66));var _0xc292=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x292c[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var logger=require(_0xc292('0x1'))(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require(_0xc292('0x4'));var rp=require(_0xc292('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc292('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xc292('0x7')]=function(_0x1c45ed,_0x2c01eb){return _0x1c45ed[_0xc292('0x8')](_0xc292('0x9'),attributes,{'tableName':_0xc292('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d10=['SquareRecording','square_recordings','util','../../config/logger','moment','bluebird','path','rimraf','./squareRecording.attributes','exports'];(function(_0x1b6a3f,_0x9cd071){var _0x33a33a=function(_0x44c53f){while(--_0x44c53f){_0x1b6a3f['push'](_0x1b6a3f['shift']());}};_0x33a33a(++_0x9cd071);}(_0x7d10,0x1ce));var _0x07d1=function(_0x546a9d,_0x447cef){_0x546a9d=_0x546a9d-0x0;var _0x3430bd=_0x7d10[_0x546a9d];return _0x3430bd;};'use strict';var _=require('lodash');var util=require(_0x07d1('0x0'));var logger=require(_0x07d1('0x1'))('api');var moment=require(_0x07d1('0x2'));var BPromise=require(_0x07d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07d1('0x4'));var rimraf=require(_0x07d1('0x5'));var config=require('../../config/environment');var attributes=require(_0x07d1('0x6'));module[_0x07d1('0x7')]=function(_0x1c8f3d,_0x36198a){return _0x1c8f3d['define'](_0x07d1('0x8'),attributes,{'tableName':_0x07d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 81cb85f..9de8e54 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 _0xffd4=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x16404c,_0x51eb1a){var _0x44d76c=function(_0x47c493){while(--_0x47c493){_0x16404c['push'](_0x16404c['shift']());}};_0x44d76c(++_0x51eb1a);}(_0xffd4,0x6e));var _0x4ffd=function(_0x595022,_0x3dc6f7){_0x595022=_0x595022-0x0;var _0x164f9a=_0xffd4[_0x595022];return _0x164f9a;};'use strict';var _=require(_0x4ffd('0x0'));var util=require('util');var moment=require(_0x4ffd('0x1'));var BPromise=require(_0x4ffd('0x2'));var rs=require(_0x4ffd('0x3'));var fs=require('fs');var Redis=require(_0x4ffd('0x4'));var db=require(_0x4ffd('0x5'))['db'];var utils=require(_0x4ffd('0x6'));var logger=require(_0x4ffd('0x7'))(_0x4ffd('0x8'));var config=require(_0x4ffd('0x9'));var jayson=require(_0x4ffd('0xa'));var client=jayson[_0x4ffd('0xb')][_0x4ffd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc9f81b,_0x1e76f1,_0x120c1b){return new BPromise(function(_0xedb145,_0x5c9476){return client[_0x4ffd('0xd')](_0xc9f81b,_0x120c1b)[_0x4ffd('0xe')](function(_0x1aeb56){logger[_0x4ffd('0xf')](_0x4ffd('0x10'),_0x1e76f1,_0x4ffd('0x11'));logger['debug'](_0x4ffd('0x12'),_0x1e76f1,_0x4ffd('0x11'),JSON[_0x4ffd('0x13')](_0x1aeb56));if(_0x1aeb56['error']){if(_0x1aeb56['error'][_0x4ffd('0x14')]===0x1f4){logger['error'](_0x4ffd('0x10'),_0x1e76f1,_0x1aeb56[_0x4ffd('0x15')][_0x4ffd('0x16')]);return _0x5c9476(_0x1aeb56['error'][_0x4ffd('0x16')]);}logger[_0x4ffd('0x15')]('SquareRecording,\x20%s,\x20%s',_0x1e76f1,_0x1aeb56[_0x4ffd('0x15')]['message']);return _0xedb145(_0x1aeb56[_0x4ffd('0x15')]['message']);}else{logger['info'](_0x4ffd('0x10'),_0x1e76f1,_0x4ffd('0x11'));_0xedb145(_0x1aeb56['result'][_0x4ffd('0x16')]);}})[_0x4ffd('0x17')](function(_0x101719){logger[_0x4ffd('0x15')](_0x4ffd('0x10'),_0x1e76f1,_0x101719);_0x5c9476(_0x101719);});});}exports[_0x4ffd('0x18')]=function(_0x42fd30){var _0x19d134=this;return new Promise(function(_0x1dc72b,_0x178878){return db[_0x4ffd('0x19')][_0x4ffd('0x1a')](_0x42fd30[_0x4ffd('0x1b')],{'raw':_0x42fd30[_0x4ffd('0x1c')]?_0x42fd30['options'][_0x4ffd('0x1d')]===undefined?!![]:![]:!![]})[_0x4ffd('0xe')](function(_0x14f56d){logger[_0x4ffd('0xf')](_0x4ffd('0x18'),_0x42fd30);logger[_0x4ffd('0x1e')](_0x4ffd('0x18'),_0x42fd30,JSON[_0x4ffd('0x13')](_0x14f56d));_0x1dc72b(_0x14f56d);})[_0x4ffd('0x17')](function(_0x8a06f0){logger[_0x4ffd('0x15')](_0x4ffd('0x18'),_0x8a06f0[_0x4ffd('0x16')],_0x42fd30);_0x178878(_0x19d134[_0x4ffd('0x15')](0x1f4,_0x8a06f0[_0x4ffd('0x16')]));});});}; \ No newline at end of file +var _0x6655=['catch','CreateSquareRecording','SquareRecording','create','options','then','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6655,0x19f));var _0x5665=function(_0x508564,_0x23c709){_0x508564=_0x508564-0x0;var _0x35e8c9=_0x6655[_0x508564];return _0x35e8c9;};'use strict';var _=require(_0x5665('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5665('0x1'));var rs=require(_0x5665('0x2'));var fs=require('fs');var Redis=require(_0x5665('0x3'));var db=require(_0x5665('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5665('0x5'))(_0x5665('0x6'));var config=require('../../config/environment');var jayson=require(_0x5665('0x7'));var client=jayson['client'][_0x5665('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16ab6c,_0x52cdc0,_0x1f9b02){return new BPromise(function(_0x3b1758,_0x4f255f){return client['request'](_0x16ab6c,_0x1f9b02)['then'](function(_0x435e13){logger[_0x5665('0x9')](_0x5665('0xa'),_0x52cdc0,_0x5665('0xb'));logger[_0x5665('0xc')](_0x5665('0xd'),_0x52cdc0,_0x5665('0xb'),JSON['stringify'](_0x435e13));if(_0x435e13['error']){if(_0x435e13[_0x5665('0xe')]['code']===0x1f4){logger[_0x5665('0xe')](_0x5665('0xa'),_0x52cdc0,_0x435e13['error']['message']);return _0x4f255f(_0x435e13[_0x5665('0xe')][_0x5665('0xf')]);}logger['error'](_0x5665('0xa'),_0x52cdc0,_0x435e13[_0x5665('0xe')][_0x5665('0xf')]);return _0x3b1758(_0x435e13[_0x5665('0xe')]['message']);}else{logger[_0x5665('0x9')]('SquareRecording,\x20%s,\x20%s',_0x52cdc0,_0x5665('0xb'));_0x3b1758(_0x435e13[_0x5665('0x10')]['message']);}})[_0x5665('0x11')](function(_0x2e096a){logger[_0x5665('0xe')]('SquareRecording,\x20%s,\x20%s',_0x52cdc0,_0x2e096a);_0x4f255f(_0x2e096a);});});}exports[_0x5665('0x12')]=function(_0x12afc6){var _0x1093bd=this;return new Promise(function(_0x37bc7b,_0xd76ff0){return db[_0x5665('0x13')][_0x5665('0x14')](_0x12afc6['body'],{'raw':_0x12afc6[_0x5665('0x15')]?_0x12afc6[_0x5665('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x5665('0x16')](function(_0x170167){logger[_0x5665('0x9')](_0x5665('0x12'),_0x12afc6);logger[_0x5665('0xc')]('CreateSquareRecording',_0x12afc6,JSON[_0x5665('0x17')](_0x170167));_0x37bc7b(_0x170167);})[_0x5665('0x11')](function(_0x21cb21){logger[_0x5665('0xe')](_0x5665('0x12'),_0x21cb21['message'],_0x12afc6);_0xd76ff0(_0x1093bd[_0x5665('0xe')](0x1f4,_0x21cb21[_0x5665('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 745019d..f5a427a 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_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'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_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'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index b3a60c1..3695099 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 _0xe8dd=['DATE','BOOLEAN','exports','STRING'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xe8dd,0x146));var _0xde8d=function(_0x8325ae,_0x3ad812){_0x8325ae=_0x8325ae-0x0;var _0xd3801d=_0xe8dd[_0x8325ae];return _0xd3801d;};'use strict';var Sequelize=require('sequelize');module[_0xde8d('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xde8d('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xde8d('0x1')]},'type':{'type':Sequelize[_0xde8d('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xde8d('0x1')]},'calleridname':{'type':Sequelize[_0xde8d('0x1')]},'callingpres':{'type':Sequelize[_0xde8d('0x1')]},'callingani2':{'type':Sequelize[_0xde8d('0x1')]},'callington':{'type':Sequelize[_0xde8d('0x1')]},'callingtns':{'type':Sequelize[_0xde8d('0x1')]},'dnid':{'type':Sequelize[_0xde8d('0x1')]},'rdnis':{'type':Sequelize[_0xde8d('0x1')]},'context':{'type':Sequelize[_0xde8d('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xde8d('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xde8d('0x1')]},'threadid':{'type':Sequelize[_0xde8d('0x1')]},'project_name':{'type':Sequelize[_0xde8d('0x1')]},'joinAt':{'type':Sequelize[_0xde8d('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xde8d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9389=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0xaa4455,_0x43f1e2){var _0x1e35a7=function(_0x61941){while(--_0x61941){_0xaa4455['push'](_0xaa4455['shift']());}};_0x1e35a7(++_0x43f1e2);}(_0x9389,0x13b));var _0x9938=function(_0x41905f,_0x554c33){_0x41905f=_0x41905f-0x0;var _0x10226f=_0x9389[_0x41905f];return _0x10226f;};'use strict';var Sequelize=require(_0x9938('0x0'));module[_0x9938('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x9938('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9938('0x2')]},'language':{'type':Sequelize[_0x9938('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9938('0x2')]},'version':{'type':Sequelize[_0x9938('0x2')]},'callerid':{'type':Sequelize[_0x9938('0x2')]},'calleridname':{'type':Sequelize[_0x9938('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x9938('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x9938('0x2')]},'dnid':{'type':Sequelize[_0x9938('0x2')]},'rdnis':{'type':Sequelize[_0x9938('0x2')]},'context':{'type':Sequelize[_0x9938('0x2')]},'extension':{'type':Sequelize[_0x9938('0x2')]},'priority':{'type':Sequelize[_0x9938('0x2')]},'enhanced':{'type':Sequelize[_0x9938('0x2')]},'accountcode':{'type':Sequelize[_0x9938('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9938('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x9938('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 b6e9ad8..d9be208 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 _0xc449=['sort','merge','where','type','options','include','findAll','catch','show','params','length','includeAll','find','create','body','update','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty'];(function(_0x4af7c9,_0x52ee2e){var _0x1fb996=function(_0x5d1c3b){while(--_0x5d1c3b){_0x4af7c9['push'](_0x4af7c9['shift']());}};_0x1fb996(++_0x52ee2e);}(_0xc449,0x1c1));var _0x9c44=function(_0x27f650,_0xde89f){_0x27f650=_0x27f650-0x0;var _0x2ed06d=_0xc449[_0x27f650];return _0x2ed06d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c44('0x0'));var jsonpatch=require(_0x9c44('0x1'));var rp=require(_0x9c44('0x2'));var moment=require(_0x9c44('0x3'));var BPromise=require(_0x9c44('0x4'));var Mustache=require(_0x9c44('0x5'));var util=require(_0x9c44('0x6'));var path=require(_0x9c44('0x7'));var sox=require(_0x9c44('0x8'));var csv=require(_0x9c44('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c44('0xa'));var _=require(_0x9c44('0xb'));var squel=require(_0x9c44('0xc'));var crypto=require(_0x9c44('0xd'));var jsforce=require(_0x9c44('0xe'));var deskjs=require(_0x9c44('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9c44('0x10'));var Papa=require(_0x9c44('0x11'));var Redis=require(_0x9c44('0x12'));var authService=require(_0x9c44('0x13'));var qs=require(_0x9c44('0x14'));var as=require(_0x9c44('0x15'));var hardwareService=require(_0x9c44('0x16'));var logger=require('../../config/logger')(_0x9c44('0x17'));var utils=require(_0x9c44('0x18'));var config=require(_0x9c44('0x19'));var licenseUtil=require(_0x9c44('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d1fb7,_0x50a8cf){_0x50a8cf=_0x50a8cf||0xcc;return function(_0x3a5690){if(_0x3a5690){return _0x5d1fb7[_0x9c44('0x1b')](_0x50a8cf);}return _0x5d1fb7[_0x9c44('0x1c')](_0x50a8cf)['end']();};}function respondWithResult(_0x3dc26c,_0x25445d){_0x25445d=_0x25445d||0xc8;return function(_0x4564b9){if(_0x4564b9){return _0x3dc26c[_0x9c44('0x1c')](_0x25445d)[_0x9c44('0x1d')](_0x4564b9);}};}function respondWithFilteredResult(_0x2d0288,_0x16895e){return function(_0x18f916){if(_0x18f916){var _0x421b96=typeof _0x16895e[_0x9c44('0x1e')]===_0x9c44('0x1f')&&typeof _0x16895e[_0x9c44('0x20')]===_0x9c44('0x1f');var _0x199f74=_0x18f916[_0x9c44('0x21')];var _0x369b09=_0x421b96?0x0:_0x16895e['offset'];var _0x1e8f40=_0x421b96?_0x18f916['count']:_0x16895e[_0x9c44('0x1e')]+_0x16895e['limit'];var _0x311f13;if(_0x1e8f40>=_0x199f74){_0x1e8f40=_0x199f74;_0x311f13=0xc8;}else{_0x311f13=0xce;}_0x2d0288[_0x9c44('0x1c')](_0x311f13);return _0x2d0288[_0x9c44('0x22')]('Content-Range',_0x369b09+'-'+_0x1e8f40+'/'+_0x199f74)['json'](_0x18f916);}return null;};}function patchUpdates(_0x5abb26){return function(_0x55ff50){try{jsonpatch[_0x9c44('0x23')](_0x55ff50,_0x5abb26,!![]);}catch(_0x511759){return BPromise['reject'](_0x511759);}return _0x55ff50[_0x9c44('0x24')]();};}function saveUpdates(_0x5add75,_0x545dc8){return function(_0x1f98b5){if(_0x1f98b5){return _0x1f98b5['update'](_0x5add75)[_0x9c44('0x25')](function(_0x173f0f){return _0x173f0f;});}return null;};}function removeEntity(_0x7847d2,_0xeb223b){return function(_0x32f1e6){if(_0x32f1e6){return _0x32f1e6[_0x9c44('0x26')]()[_0x9c44('0x25')](function(){_0x7847d2[_0x9c44('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19de7e,_0x22df57){return function(_0x30c4b9){if(!_0x30c4b9){_0x19de7e[_0x9c44('0x1b')](0x194);}return _0x30c4b9;};}function handleError(_0x2140fa,_0x10ab73){_0x10ab73=_0x10ab73||0x1f4;return function(_0x28f8be){logger[_0x9c44('0x27')](_0x28f8be['stack']);if(_0x28f8be[_0x9c44('0x28')]){delete _0x28f8be[_0x9c44('0x28')];}_0x2140fa[_0x9c44('0x1c')](_0x10ab73)[_0x9c44('0x29')](_0x28f8be);};}exports[_0x9c44('0x2a')]=function(_0x5ef0d6,_0x23e90d){var _0x3ede17={},_0x16cf4e={},_0x53704b={'count':0x0,'rows':[]};var _0x7828=_[_0x9c44('0x2b')](db[_0x9c44('0x2c')][_0x9c44('0x2d')],function(_0x42f52f){return{'name':_0x42f52f['fieldName'],'type':_0x42f52f['type'][_0x9c44('0x2e')]};});_0x16cf4e['model']=_['map'](_0x7828,'name');_0x16cf4e[_0x9c44('0x2f')]=_[_0x9c44('0x30')](_0x5ef0d6[_0x9c44('0x2f')]);_0x16cf4e[_0x9c44('0x31')]=_[_0x9c44('0x32')](_0x16cf4e['model'],_0x16cf4e['query']);_0x3ede17[_0x9c44('0x33')]=_[_0x9c44('0x32')](_0x16cf4e[_0x9c44('0x34')],qs[_0x9c44('0x35')](_0x5ef0d6[_0x9c44('0x2f')]['fields']));_0x3ede17[_0x9c44('0x33')]=_0x3ede17['attributes']['length']?_0x3ede17['attributes']:_0x16cf4e['model'];if(!_0x5ef0d6[_0x9c44('0x2f')][_0x9c44('0x36')]('nolimit')){_0x3ede17[_0x9c44('0x20')]=qs[_0x9c44('0x20')](_0x5ef0d6['query'][_0x9c44('0x20')]);_0x3ede17[_0x9c44('0x1e')]=qs[_0x9c44('0x1e')](_0x5ef0d6['query']['offset']);}_0x3ede17['order']=qs[_0x9c44('0x37')](_0x5ef0d6['query'][_0x9c44('0x37')]);_0x3ede17['where']=qs[_0x9c44('0x31')](_['pick'](_0x5ef0d6[_0x9c44('0x2f')],_0x16cf4e[_0x9c44('0x31')]),_0x7828);if(_0x5ef0d6['query']['filter']){_0x3ede17['where']=_[_0x9c44('0x38')](_0x3ede17[_0x9c44('0x39')],{'$or':_[_0x9c44('0x2b')](_0x7828,function(_0xaf240){if(_0xaf240[_0x9c44('0x3a')]!=='VIRTUAL'){var _0x48f39f={};_0x48f39f[_0xaf240[_0x9c44('0x28')]]={'$like':'%'+_0x5ef0d6['query']['filter']+'%'};return _0x48f39f;}})});}_0x3ede17=_[_0x9c44('0x38')]({},_0x3ede17,_0x5ef0d6[_0x9c44('0x3b')]);var _0x114f2d={'where':_0x3ede17[_0x9c44('0x39')]};return db['SquareReport'][_0x9c44('0x21')](_0x114f2d)[_0x9c44('0x25')](function(_0x45172d){_0x53704b[_0x9c44('0x21')]=_0x45172d;if(_0x5ef0d6[_0x9c44('0x2f')]['includeAll']){_0x3ede17[_0x9c44('0x3c')]=[{'all':!![]}];}return db[_0x9c44('0x2c')][_0x9c44('0x3d')](_0x3ede17);})[_0x9c44('0x25')](function(_0x4d02d6){_0x53704b['rows']=_0x4d02d6;return _0x53704b;})['then'](respondWithFilteredResult(_0x23e90d,_0x3ede17))[_0x9c44('0x3e')](handleError(_0x23e90d,null));};exports[_0x9c44('0x3f')]=function(_0x3dce6e,_0x2e90bd){var _0x741ad7={'raw':!![],'where':{'id':_0x3dce6e[_0x9c44('0x40')]['id']}},_0x5090ef={};_0x5090ef[_0x9c44('0x34')]=_[_0x9c44('0x30')](db['SquareReport'][_0x9c44('0x2d')]);_0x5090ef['query']=_[_0x9c44('0x30')](_0x3dce6e[_0x9c44('0x2f')]);_0x5090ef['filters']=_['intersection'](_0x5090ef[_0x9c44('0x34')],_0x5090ef[_0x9c44('0x2f')]);_0x741ad7['attributes']=_[_0x9c44('0x32')](_0x5090ef[_0x9c44('0x34')],qs[_0x9c44('0x35')](_0x3dce6e[_0x9c44('0x2f')]['fields']));_0x741ad7[_0x9c44('0x33')]=_0x741ad7['attributes'][_0x9c44('0x41')]?_0x741ad7[_0x9c44('0x33')]:_0x5090ef[_0x9c44('0x34')];if(_0x3dce6e[_0x9c44('0x2f')][_0x9c44('0x42')]){_0x741ad7[_0x9c44('0x3c')]=[{'all':!![]}];}_0x741ad7=_[_0x9c44('0x38')]({},_0x741ad7,_0x3dce6e['options']);return db['SquareReport'][_0x9c44('0x43')](_0x741ad7)[_0x9c44('0x25')](handleEntityNotFound(_0x2e90bd,null))['then'](respondWithResult(_0x2e90bd,null))[_0x9c44('0x3e')](handleError(_0x2e90bd,null));};exports[_0x9c44('0x44')]=function(_0x23a48c,_0xc80a05){return db[_0x9c44('0x2c')]['create'](_0x23a48c[_0x9c44('0x45')],{})[_0x9c44('0x25')](respondWithResult(_0xc80a05,0xc9))[_0x9c44('0x3e')](handleError(_0xc80a05,null));};exports[_0x9c44('0x46')]=function(_0x616cba,_0x4a9125){if(_0x616cba[_0x9c44('0x45')]['id']){delete _0x616cba[_0x9c44('0x45')]['id'];}return db[_0x9c44('0x2c')][_0x9c44('0x43')]({'where':{'id':_0x616cba[_0x9c44('0x40')]['id']}})[_0x9c44('0x25')](handleEntityNotFound(_0x4a9125,null))[_0x9c44('0x25')](saveUpdates(_0x616cba['body'],null))[_0x9c44('0x25')](respondWithResult(_0x4a9125,null))[_0x9c44('0x3e')](handleError(_0x4a9125,null));};exports[_0x9c44('0x26')]=function(_0x17417a,_0x157e67){return db[_0x9c44('0x2c')][_0x9c44('0x43')]({'where':{'id':_0x17417a['params']['id']}})['then'](handleEntityNotFound(_0x157e67,null))[_0x9c44('0x25')](removeEntity(_0x157e67,null))['catch'](handleError(_0x157e67,null));};exports['describe']=function(_0x2e2906,_0x35aee2){return db[_0x9c44('0x2c')][_0x9c44('0x47')]()['then'](respondWithResult(_0x35aee2,null))[_0x9c44('0x3e')](handleError(_0x35aee2,null));}; \ No newline at end of file +var _0xaf01=['status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SquareReport','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','catch','show','params','keys','rawAttributes','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','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'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xaf01,0x112));var _0x1af0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xaf01[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x1af0('0x0'));var rimraf=require(_0x1af0('0x1'));var zipdir=require(_0x1af0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1af0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1af0('0x4'));var util=require(_0x1af0('0x5'));var path=require(_0x1af0('0x6'));var sox=require('sox');var csv=require(_0x1af0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1af0('0x8'));var jsforce=require(_0x1af0('0x9'));var deskjs=require(_0x1af0('0xa'));var toCsv=require(_0x1af0('0x7'));var querystring=require(_0x1af0('0xb'));var Papa=require(_0x1af0('0xc'));var Redis=require(_0x1af0('0xd'));var authService=require(_0x1af0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1af0('0xf'));var hardwareService=require(_0x1af0('0x10'));var logger=require(_0x1af0('0x11'))(_0x1af0('0x12'));var utils=require(_0x1af0('0x13'));var config=require(_0x1af0('0x14'));var licenseUtil=require(_0x1af0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd275,_0x4f7918){_0x4f7918=_0x4f7918||0xcc;return function(_0x51bed6){if(_0x51bed6){return _0x3cd275['sendStatus'](_0x4f7918);}return _0x3cd275[_0x1af0('0x16')](_0x4f7918)[_0x1af0('0x17')]();};}function respondWithResult(_0x467bdb,_0x450625){_0x450625=_0x450625||0xc8;return function(_0x586a45){if(_0x586a45){return _0x467bdb[_0x1af0('0x16')](_0x450625)['json'](_0x586a45);}};}function respondWithFilteredResult(_0x2b9adc,_0x1e8593){return function(_0x29352d){if(_0x29352d){var _0x493dbc=typeof _0x1e8593[_0x1af0('0x18')]===_0x1af0('0x19')&&typeof _0x1e8593['limit']===_0x1af0('0x19');var _0x21ac0e=_0x29352d[_0x1af0('0x1a')];var _0x4154f0=_0x493dbc?0x0:_0x1e8593[_0x1af0('0x18')];var _0x15e090=_0x493dbc?_0x29352d[_0x1af0('0x1a')]:_0x1e8593[_0x1af0('0x18')]+_0x1e8593[_0x1af0('0x1b')];var _0x505429;if(_0x15e090>=_0x21ac0e){_0x15e090=_0x21ac0e;_0x505429=0xc8;}else{_0x505429=0xce;}_0x2b9adc[_0x1af0('0x16')](_0x505429);return _0x2b9adc[_0x1af0('0x1c')](_0x1af0('0x1d'),_0x4154f0+'-'+_0x15e090+'/'+_0x21ac0e)['json'](_0x29352d);}return null;};}function patchUpdates(_0x588f92){return function(_0x7467e9){try{jsonpatch[_0x1af0('0x1e')](_0x7467e9,_0x588f92,!![]);}catch(_0x28e8b3){return BPromise[_0x1af0('0x1f')](_0x28e8b3);}return _0x7467e9[_0x1af0('0x20')]();};}function saveUpdates(_0x322609,_0xb04578){return function(_0x45ba22){if(_0x45ba22){return _0x45ba22[_0x1af0('0x21')](_0x322609)[_0x1af0('0x22')](function(_0x4efc98){return _0x4efc98;});}return null;};}function removeEntity(_0x4a0c09,_0x1d6396){return function(_0x35eda0){if(_0x35eda0){return _0x35eda0[_0x1af0('0x23')]()[_0x1af0('0x22')](function(){_0x4a0c09[_0x1af0('0x16')](0xcc)[_0x1af0('0x17')]();});}};}function handleEntityNotFound(_0x17ce3d,_0x33e27e){return function(_0x5502d2){if(!_0x5502d2){_0x17ce3d[_0x1af0('0x24')](0x194);}return _0x5502d2;};}function handleError(_0x2afecc,_0xb7ede5){_0xb7ede5=_0xb7ede5||0x1f4;return function(_0x19b364){logger['error'](_0x19b364[_0x1af0('0x25')]);if(_0x19b364['name']){delete _0x19b364[_0x1af0('0x26')];}_0x2afecc[_0x1af0('0x16')](_0xb7ede5)[_0x1af0('0x27')](_0x19b364);};}exports[_0x1af0('0x28')]=function(_0x53e5fe,_0x58f2c5){var _0x57dd7c={},_0x466318={},_0x3cf746={'count':0x0,'rows':[]};var _0x9197f6=_[_0x1af0('0x29')](db[_0x1af0('0x2a')]['rawAttributes'],function(_0x2cace5){return{'name':_0x2cace5[_0x1af0('0x2b')],'type':_0x2cace5[_0x1af0('0x2c')][_0x1af0('0x2d')]};});_0x466318['model']=_['map'](_0x9197f6,_0x1af0('0x26'));_0x466318[_0x1af0('0x2e')]=_['keys'](_0x53e5fe[_0x1af0('0x2e')]);_0x466318['filters']=_[_0x1af0('0x2f')](_0x466318[_0x1af0('0x30')],_0x466318[_0x1af0('0x2e')]);_0x57dd7c[_0x1af0('0x31')]=_[_0x1af0('0x2f')](_0x466318['model'],qs[_0x1af0('0x32')](_0x53e5fe[_0x1af0('0x2e')][_0x1af0('0x32')]));_0x57dd7c[_0x1af0('0x31')]=_0x57dd7c[_0x1af0('0x31')][_0x1af0('0x33')]?_0x57dd7c['attributes']:_0x466318[_0x1af0('0x30')];if(!_0x53e5fe[_0x1af0('0x2e')][_0x1af0('0x34')](_0x1af0('0x35'))){_0x57dd7c['limit']=qs[_0x1af0('0x1b')](_0x53e5fe[_0x1af0('0x2e')][_0x1af0('0x1b')]);_0x57dd7c['offset']=qs[_0x1af0('0x18')](_0x53e5fe[_0x1af0('0x2e')]['offset']);}_0x57dd7c[_0x1af0('0x36')]=qs[_0x1af0('0x37')](_0x53e5fe[_0x1af0('0x2e')][_0x1af0('0x37')]);_0x57dd7c[_0x1af0('0x38')]=qs[_0x1af0('0x39')](_[_0x1af0('0x3a')](_0x53e5fe[_0x1af0('0x2e')],_0x466318[_0x1af0('0x39')]),_0x9197f6);if(_0x53e5fe[_0x1af0('0x2e')][_0x1af0('0x3b')]){_0x57dd7c['where']=_[_0x1af0('0x3c')](_0x57dd7c[_0x1af0('0x38')],{'$or':_[_0x1af0('0x29')](_0x9197f6,function(_0x4b9afa){if(_0x4b9afa[_0x1af0('0x2c')]!==_0x1af0('0x3d')){var _0x395206={};_0x395206[_0x4b9afa[_0x1af0('0x26')]]={'$like':'%'+_0x53e5fe['query'][_0x1af0('0x3b')]+'%'};return _0x395206;}})});}_0x57dd7c=_[_0x1af0('0x3c')]({},_0x57dd7c,_0x53e5fe[_0x1af0('0x3e')]);var _0x90b3a6={'where':_0x57dd7c[_0x1af0('0x38')]};return db['SquareReport'][_0x1af0('0x1a')](_0x90b3a6)[_0x1af0('0x22')](function(_0x52ac64){_0x3cf746[_0x1af0('0x1a')]=_0x52ac64;if(_0x53e5fe['query']['includeAll']){_0x57dd7c['include']=[{'all':!![]}];}return db[_0x1af0('0x2a')]['findAll'](_0x57dd7c);})[_0x1af0('0x22')](function(_0x4fca2f){_0x3cf746['rows']=_0x4fca2f;return _0x3cf746;})[_0x1af0('0x22')](respondWithFilteredResult(_0x58f2c5,_0x57dd7c))[_0x1af0('0x3f')](handleError(_0x58f2c5,null));};exports[_0x1af0('0x40')]=function(_0x139539,_0x4cd377){var _0x31513a={'raw':!![],'where':{'id':_0x139539[_0x1af0('0x41')]['id']}},_0x351208={};_0x351208[_0x1af0('0x30')]=_[_0x1af0('0x42')](db['SquareReport'][_0x1af0('0x43')]);_0x351208['query']=_[_0x1af0('0x42')](_0x139539['query']);_0x351208['filters']=_['intersection'](_0x351208[_0x1af0('0x30')],_0x351208[_0x1af0('0x2e')]);_0x31513a[_0x1af0('0x31')]=_[_0x1af0('0x2f')](_0x351208[_0x1af0('0x30')],qs[_0x1af0('0x32')](_0x139539[_0x1af0('0x2e')][_0x1af0('0x32')]));_0x31513a['attributes']=_0x31513a[_0x1af0('0x31')][_0x1af0('0x33')]?_0x31513a['attributes']:_0x351208['model'];if(_0x139539[_0x1af0('0x2e')][_0x1af0('0x44')]){_0x31513a[_0x1af0('0x45')]=[{'all':!![]}];}_0x31513a=_[_0x1af0('0x3c')]({},_0x31513a,_0x139539[_0x1af0('0x3e')]);return db[_0x1af0('0x2a')][_0x1af0('0x46')](_0x31513a)['then'](handleEntityNotFound(_0x4cd377,null))['then'](respondWithResult(_0x4cd377,null))[_0x1af0('0x3f')](handleError(_0x4cd377,null));};exports['create']=function(_0x1d6b1d,_0x289239){return db[_0x1af0('0x2a')][_0x1af0('0x47')](_0x1d6b1d[_0x1af0('0x48')],{})[_0x1af0('0x22')](respondWithResult(_0x289239,0xc9))['catch'](handleError(_0x289239,null));};exports[_0x1af0('0x21')]=function(_0x343fa3,_0x1a81f1){if(_0x343fa3['body']['id']){delete _0x343fa3[_0x1af0('0x48')]['id'];}return db[_0x1af0('0x2a')][_0x1af0('0x46')]({'where':{'id':_0x343fa3[_0x1af0('0x41')]['id']}})[_0x1af0('0x22')](handleEntityNotFound(_0x1a81f1,null))[_0x1af0('0x22')](saveUpdates(_0x343fa3['body'],null))[_0x1af0('0x22')](respondWithResult(_0x1a81f1,null))[_0x1af0('0x3f')](handleError(_0x1a81f1,null));};exports[_0x1af0('0x23')]=function(_0x8bc4e2,_0x3dcc52){return db[_0x1af0('0x2a')][_0x1af0('0x46')]({'where':{'id':_0x8bc4e2[_0x1af0('0x41')]['id']}})[_0x1af0('0x22')](handleEntityNotFound(_0x3dcc52,null))[_0x1af0('0x22')](removeEntity(_0x3dcc52,null))[_0x1af0('0x3f')](handleError(_0x3dcc52,null));};exports[_0x1af0('0x49')]=function(_0x198301,_0x13d2da){return db['SquareReport'][_0x1af0('0x49')]()[_0x1af0('0x22')](respondWithResult(_0x13d2da,null))[_0x1af0('0x3f')](handleError(_0x13d2da,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 70974bf..f109b94 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 _0x6b87=['moment','request-promise','path','rimraf','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b87,0x97));var _0x76b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76b8('0x0'));var util=require(_0x76b8('0x1'));var logger=require(_0x76b8('0x2'))('api');var moment=require(_0x76b8('0x3'));var BPromise=require('bluebird');var rp=require(_0x76b8('0x4'));var fs=require('fs');var path=require(_0x76b8('0x5'));var rimraf=require(_0x76b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x76b8('0x7'));module[_0x76b8('0x8')]=function(_0x2f6718,_0xee1554){return _0x2f6718['define'](_0x76b8('0x9'),attributes,{'tableName':_0x76b8('0xa'),'paranoid':![],'indexes':[{'name':_0x76b8('0xb'),'fields':['uniqueid',_0x76b8('0xc')]},{'name':_0x76b8('0xd'),'fields':[_0x76b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0799=['define','report_square','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','moment','bluebird','path','rimraf','exports'];(function(_0x106cac,_0x133799){var _0x131596=function(_0x5d9555){while(--_0x5d9555){_0x106cac['push'](_0x106cac['shift']());}};_0x131596(++_0x133799);}(_0x0799,0x16e));var _0x9079=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x0799[_0x1ed116];return _0x574066;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9079('0x0'))('api');var moment=require(_0x9079('0x1'));var BPromise=require(_0x9079('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9079('0x3'));var rimraf=require(_0x9079('0x4'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x9079('0x5')]=function(_0x789695,_0x3eb129){return _0x789695[_0x9079('0x6')]('SquareReport',attributes,{'tableName':_0x9079('0x7'),'paranoid':![],'indexes':[{'name':_0x9079('0x8'),'fields':[_0x9079('0x9'),_0x9079('0xa')]},{'name':_0x9079('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 68fb845..860a2aa 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 _0xd5a5=['../../config/environment','jayson/promise','client','http','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','update','body','where','attributes','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4f1507,_0x771c04){var _0x3adf28=function(_0x231010){while(--_0x231010){_0x4f1507['push'](_0x4f1507['shift']());}};_0x3adf28(++_0x771c04);}(_0xd5a5,0x183));var _0x5d5a=function(_0x243f1b,_0x42beea){_0x243f1b=_0x243f1b-0x0;var _0x1ad184=_0xd5a5[_0x243f1b];return _0x1ad184;};'use strict';var _=require(_0x5d5a('0x0'));var util=require(_0x5d5a('0x1'));var moment=require(_0x5d5a('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d5a('0x3'));var fs=require('fs');var Redis=require(_0x5d5a('0x4'));var db=require(_0x5d5a('0x5'))['db'];var utils=require(_0x5d5a('0x6'));var logger=require(_0x5d5a('0x7'))(_0x5d5a('0x8'));var config=require(_0x5d5a('0x9'));var jayson=require(_0x5d5a('0xa'));var client=jayson[_0x5d5a('0xb')][_0x5d5a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1286b5,_0x45f6dc,_0x2a6383){return new BPromise(function(_0x366209,_0x3c2b51){return client['request'](_0x1286b5,_0x2a6383)[_0x5d5a('0xd')](function(_0x357c55){logger[_0x5d5a('0xe')]('SquareReport,\x20%s,\x20%s',_0x45f6dc,'request\x20sent');logger[_0x5d5a('0xf')](_0x5d5a('0x10'),_0x45f6dc,_0x5d5a('0x11'),JSON[_0x5d5a('0x12')](_0x357c55));if(_0x357c55[_0x5d5a('0x13')]){if(_0x357c55[_0x5d5a('0x13')][_0x5d5a('0x14')]===0x1f4){logger[_0x5d5a('0x13')](_0x5d5a('0x15'),_0x45f6dc,_0x357c55['error'][_0x5d5a('0x16')]);return _0x3c2b51(_0x357c55['error'][_0x5d5a('0x16')]);}logger[_0x5d5a('0x13')](_0x5d5a('0x15'),_0x45f6dc,_0x357c55['error'][_0x5d5a('0x16')]);return _0x366209(_0x357c55[_0x5d5a('0x13')][_0x5d5a('0x16')]);}else{logger[_0x5d5a('0xe')](_0x5d5a('0x15'),_0x45f6dc,_0x5d5a('0x11'));_0x366209(_0x357c55[_0x5d5a('0x17')][_0x5d5a('0x16')]);}})[_0x5d5a('0x18')](function(_0x51b143){logger[_0x5d5a('0x13')](_0x5d5a('0x15'),_0x45f6dc,_0x51b143);_0x3c2b51(_0x51b143);});});}exports[_0x5d5a('0x19')]=function(_0x256e31){var _0x16e5a3=this;return new Promise(function(_0x5666f4,_0x293e50){return db[_0x5d5a('0x1a')][_0x5d5a('0x1b')](_0x256e31['body'],{'raw':_0x256e31[_0x5d5a('0x1c')]?_0x256e31[_0x5d5a('0x1c')][_0x5d5a('0x1d')]===undefined?!![]:![]:!![]})[_0x5d5a('0xd')](function(_0x5a9aa0){logger[_0x5d5a('0xe')]('CreateSquareReport',_0x256e31);logger[_0x5d5a('0xf')](_0x5d5a('0x19'),_0x256e31,JSON['stringify'](_0x5a9aa0));_0x5666f4(_0x5a9aa0);})[_0x5d5a('0x18')](function(_0x16bca1){logger[_0x5d5a('0x13')](_0x5d5a('0x19'),_0x16bca1[_0x5d5a('0x16')],_0x256e31);_0x293e50(_0x16e5a3[_0x5d5a('0x13')](0x1f4,_0x16bca1[_0x5d5a('0x16')]));});});};exports['UpdateSquareReport']=function(_0x200a7e){var _0x1fab50=this;return new Promise(function(_0xcbf09c,_0x2d5246){return db[_0x5d5a('0x1a')][_0x5d5a('0x1e')](_0x200a7e[_0x5d5a('0x1f')],{'raw':_0x200a7e[_0x5d5a('0x1c')]?_0x200a7e[_0x5d5a('0x1c')][_0x5d5a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200a7e[_0x5d5a('0x1c')]?_0x200a7e[_0x5d5a('0x1c')][_0x5d5a('0x20')]||null:null,'attributes':_0x200a7e[_0x5d5a('0x1c')]?_0x200a7e['options'][_0x5d5a('0x21')]||null:null,'limit':_0x200a7e['options']?_0x200a7e[_0x5d5a('0x1c')][_0x5d5a('0x22')]||null:null})[_0x5d5a('0xd')](function(_0x2b2503){logger[_0x5d5a('0xe')](_0x5d5a('0x23'),_0x200a7e);logger['debug'](_0x5d5a('0x23'),_0x200a7e,JSON[_0x5d5a('0x12')](_0x2b2503));_0xcbf09c(_0x2b2503);})['catch'](function(_0x5f0953){logger['error'](_0x5d5a('0x23'),_0x5f0953[_0x5d5a('0x16')],_0x200a7e);_0x2d5246(_0x1fab50[_0x5d5a('0x13')](0x1f4,_0x5f0953['message']));});});}; \ No newline at end of file +var _0x043a=['jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','stringify','UpdateSquareReport','update','where','attributes','limit','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e7f7c,_0x436747){var _0x361583=function(_0x2f33ad){while(--_0x2f33ad){_0x4e7f7c['push'](_0x4e7f7c['shift']());}};_0x361583(++_0x436747);}(_0x043a,0x138));var _0xa043=function(_0x1d2ac3,_0xab576){_0x1d2ac3=_0x1d2ac3-0x0;var _0x4ae404=_0x043a[_0x1d2ac3];return _0x4ae404;};'use strict';var _=require('lodash');var util=require(_0xa043('0x0'));var moment=require(_0xa043('0x1'));var BPromise=require(_0xa043('0x2'));var rs=require(_0xa043('0x3'));var fs=require('fs');var Redis=require(_0xa043('0x4'));var db=require(_0xa043('0x5'))['db'];var utils=require(_0xa043('0x6'));var logger=require(_0xa043('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa043('0x8'));var client=jayson[_0xa043('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59eba1,_0x1a81e4,_0x2b5092){return new BPromise(function(_0x40d341,_0x155633){return client[_0xa043('0xa')](_0x59eba1,_0x2b5092)[_0xa043('0xb')](function(_0x33dbda){logger['info'](_0xa043('0xc'),_0x1a81e4,'request\x20sent');logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1a81e4,_0xa043('0xd'),JSON['stringify'](_0x33dbda));if(_0x33dbda['error']){if(_0x33dbda['error'][_0xa043('0xe')]===0x1f4){logger[_0xa043('0xf')](_0xa043('0xc'),_0x1a81e4,_0x33dbda[_0xa043('0xf')][_0xa043('0x10')]);return _0x155633(_0x33dbda[_0xa043('0xf')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x1a81e4,_0x33dbda[_0xa043('0xf')][_0xa043('0x10')]);return _0x40d341(_0x33dbda[_0xa043('0xf')][_0xa043('0x10')]);}else{logger[_0xa043('0x11')](_0xa043('0xc'),_0x1a81e4,'request\x20sent');_0x40d341(_0x33dbda[_0xa043('0x12')][_0xa043('0x10')]);}})[_0xa043('0x13')](function(_0x3d6733){logger[_0xa043('0xf')](_0xa043('0xc'),_0x1a81e4,_0x3d6733);_0x155633(_0x3d6733);});});}exports[_0xa043('0x14')]=function(_0x2f7a43){var _0x7c30d1=this;return new Promise(function(_0x4ff601,_0x2d93b2){return db[_0xa043('0x15')][_0xa043('0x16')](_0x2f7a43[_0xa043('0x17')],{'raw':_0x2f7a43[_0xa043('0x18')]?_0x2f7a43[_0xa043('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa043('0xb')](function(_0x58cc30){logger[_0xa043('0x11')]('CreateSquareReport',_0x2f7a43);logger['debug'](_0xa043('0x14'),_0x2f7a43,JSON[_0xa043('0x19')](_0x58cc30));_0x4ff601(_0x58cc30);})[_0xa043('0x13')](function(_0x3f53aa){logger[_0xa043('0xf')]('CreateSquareReport',_0x3f53aa['message'],_0x2f7a43);_0x2d93b2(_0x7c30d1[_0xa043('0xf')](0x1f4,_0x3f53aa[_0xa043('0x10')]));});});};exports[_0xa043('0x1a')]=function(_0x5cfa8f){var _0x318087=this;return new Promise(function(_0x3a60bc,_0x541dd1){return db[_0xa043('0x15')][_0xa043('0x1b')](_0x5cfa8f['body'],{'raw':_0x5cfa8f[_0xa043('0x18')]?_0x5cfa8f[_0xa043('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cfa8f['options']?_0x5cfa8f[_0xa043('0x18')][_0xa043('0x1c')]||null:null,'attributes':_0x5cfa8f['options']?_0x5cfa8f[_0xa043('0x18')][_0xa043('0x1d')]||null:null,'limit':_0x5cfa8f['options']?_0x5cfa8f[_0xa043('0x18')][_0xa043('0x1e')]||null:null})[_0xa043('0xb')](function(_0x4ff0fc){logger[_0xa043('0x11')](_0xa043('0x1a'),_0x5cfa8f);logger[_0xa043('0x1f')](_0xa043('0x1a'),_0x5cfa8f,JSON[_0xa043('0x19')](_0x4ff0fc));_0x3a60bc(_0x4ff0fc);})[_0xa043('0x13')](function(_0x383678){logger[_0xa043('0xf')](_0xa043('0x1a'),_0x383678['message'],_0x5cfa8f);_0x541dd1(_0x318087[_0xa043('0xf')](0x1f4,_0x383678[_0xa043('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7668425..60d5419 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 _0xbc93=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x1650d9,_0x24a9a0){var _0x45c143=function(_0x1d45df){while(--_0x1d45df){_0x1650d9['push'](_0x1650d9['shift']());}};_0x45c143(++_0x24a9a0);}(_0xbc93,0xfb));var _0x3bc9=function(_0x513e85,_0x1cbc95){_0x513e85=_0x513e85-0x0;var _0x2cbc25=_0xbc93[_0x513e85];return _0x2cbc25;};'use strict';var multer=require(_0x3bc9('0x0'));var util=require('util');var path=require(_0x3bc9('0x1'));var timeout=require(_0x3bc9('0x2'));var express=require(_0x3bc9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3bc9('0x4'));var interaction=require(_0x3bc9('0x5'));var config=require(_0x3bc9('0x6'));var controller=require(_0x3bc9('0x7'));router[_0x3bc9('0x8')]('/',auth[_0x3bc9('0x9')](),controller[_0x3bc9('0xa')]);router[_0x3bc9('0x8')](_0x3bc9('0xb'),auth[_0x3bc9('0x9')](),controller[_0x3bc9('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3bc9('0xd')]);router[_0x3bc9('0xe')]('/',auth['isAuthenticated'](),controller[_0x3bc9('0xf')]);router[_0x3bc9('0x10')](_0x3bc9('0x11'),auth[_0x3bc9('0x9')](),controller[_0x3bc9('0x12')]);router['delete']('/:id',auth[_0x3bc9('0x9')](),controller[_0x3bc9('0x13')]);module[_0x3bc9('0x14')]=router; \ No newline at end of file +var _0x8183=['isAuthenticated','index','get','/describe','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b12a6,_0x1baa40){var _0x56264a=function(_0x1f7651){while(--_0x1f7651){_0x2b12a6['push'](_0x2b12a6['shift']());}};_0x56264a(++_0x1baa40);}(_0x8183,0x19b));var _0x3818=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x8183[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x3818('0x0'));var util=require(_0x3818('0x1'));var path=require(_0x3818('0x2'));var timeout=require('connect-timeout');var express=require(_0x3818('0x3'));var router=express['Router']();var fs_extra=require(_0x3818('0x4'));var auth=require(_0x3818('0x5'));var interaction=require(_0x3818('0x6'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x3818('0x7')](),controller[_0x3818('0x8')]);router[_0x3818('0x9')](_0x3818('0xa'),auth[_0x3818('0x7')](),controller[_0x3818('0xb')]);router[_0x3818('0x9')]('/:id',auth[_0x3818('0x7')](),controller['show']);router[_0x3818('0xc')]('/',auth[_0x3818('0x7')](),controller['create']);router[_0x3818('0xd')](_0x3818('0xe'),auth['isAuthenticated'](),controller[_0x3818('0xf')]);router[_0x3818('0x10')](_0x3818('0xe'),auth[_0x3818('0x7')](),controller[_0x3818('0x11')]);module[_0x3818('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b19e59f..a803880 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 _0x0ff0=['sequelize','STRING','TEXT'];(function(_0x501695,_0xda9d02){var _0xca4b6c=function(_0x362f34){while(--_0x362f34){_0x501695['push'](_0x501695['shift']());}};_0xca4b6c(++_0xda9d02);}(_0x0ff0,0x9c));var _0x00ff=function(_0x4995b1,_0x39e8c4){_0x4995b1=_0x4995b1-0x0;var _0x2a9345=_0x0ff0[_0x4995b1];return _0x2a9345;};'use strict';var Sequelize=require(_0x00ff('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x00ff('0x1')]},'application':{'type':Sequelize[_0x00ff('0x1')]},'data':{'type':Sequelize[_0x00ff('0x2')]},'project_name':{'type':Sequelize[_0x00ff('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1ceb=['exports','STRING','TEXT','sequelize'];(function(_0x47dd2d,_0x2b45b7){var _0x359159=function(_0x1cb969){while(--_0x1cb969){_0x47dd2d['push'](_0x47dd2d['shift']());}};_0x359159(++_0x2b45b7);}(_0x1ceb,0x15f));var _0xb1ce=function(_0x288b4a,_0x1dc014){_0x288b4a=_0x288b4a-0x0;var _0x4dbc32=_0x1ceb[_0x288b4a];return _0x4dbc32;};'use strict';var Sequelize=require(_0xb1ce('0x0'));module[_0xb1ce('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xb1ce('0x2')]},'data':{'type':Sequelize[_0xb1ce('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 703cce4..6494d43 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 _0x1149=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','end','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','keys','intersection','create','body','find','destroy','describe','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3cac3b,_0x4ddb21){var _0x3d6bbc=function(_0x15d1d0){while(--_0x15d1d0){_0x3cac3b['push'](_0x3cac3b['shift']());}};_0x3d6bbc(++_0x4ddb21);}(_0x1149,0x1f3));var _0x9114=function(_0x47bcc8,_0x1c321e){_0x47bcc8=_0x47bcc8-0x0;var _0x436a36=_0x1149[_0x47bcc8];return _0x436a36;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9114('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9114('0x1'));var moment=require(_0x9114('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9114('0x3'));var util=require(_0x9114('0x4'));var path=require(_0x9114('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9114('0x6'));var fs=require('fs');var fs_extra=require(_0x9114('0x7'));var _=require(_0x9114('0x8'));var squel=require('squel');var crypto=require(_0x9114('0x9'));var jsforce=require(_0x9114('0xa'));var deskjs=require(_0x9114('0xb'));var toCsv=require(_0x9114('0xc'));var querystring=require(_0x9114('0xd'));var Papa=require('papaparse');var Redis=require(_0x9114('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9114('0xf'));var as=require(_0x9114('0x10'));var hardwareService=require(_0x9114('0x11'));var logger=require('../../config/logger')(_0x9114('0x12'));var utils=require(_0x9114('0x13'));var config=require(_0x9114('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9114('0x15'))['db'];function respondWithStatusCode(_0x1d54d9,_0x5bd8ca){_0x5bd8ca=_0x5bd8ca||0xcc;return function(_0x2a9b34){if(_0x2a9b34){return _0x1d54d9[_0x9114('0x16')](_0x5bd8ca);}return _0x1d54d9[_0x9114('0x17')](_0x5bd8ca)['end']();};}function respondWithResult(_0x5b8ebf,_0x2dbefb){_0x2dbefb=_0x2dbefb||0xc8;return function(_0x4d83c2){if(_0x4d83c2){return _0x5b8ebf[_0x9114('0x17')](_0x2dbefb)[_0x9114('0x18')](_0x4d83c2);}};}function respondWithFilteredResult(_0x2fc867,_0xeecadf){return function(_0x35fe3f){if(_0x35fe3f){var _0x1f157d=typeof _0xeecadf[_0x9114('0x19')]==='undefined'&&typeof _0xeecadf[_0x9114('0x1a')]===_0x9114('0x1b');var _0x547e67=_0x35fe3f[_0x9114('0x1c')];var _0x2d34e7=_0x1f157d?0x0:_0xeecadf[_0x9114('0x19')];var _0x1230ba=_0x1f157d?_0x35fe3f[_0x9114('0x1c')]:_0xeecadf[_0x9114('0x19')]+_0xeecadf[_0x9114('0x1a')];var _0x4785cb;if(_0x1230ba>=_0x547e67){_0x1230ba=_0x547e67;_0x4785cb=0xc8;}else{_0x4785cb=0xce;}_0x2fc867[_0x9114('0x17')](_0x4785cb);return _0x2fc867[_0x9114('0x1d')](_0x9114('0x1e'),_0x2d34e7+'-'+_0x1230ba+'/'+_0x547e67)[_0x9114('0x18')](_0x35fe3f);}return null;};}function patchUpdates(_0x1f7945){return function(_0x230577){try{jsonpatch[_0x9114('0x1f')](_0x230577,_0x1f7945,!![]);}catch(_0xaa3ca8){return BPromise['reject'](_0xaa3ca8);}return _0x230577['save']();};}function saveUpdates(_0x47c156,_0x2fd6e7){return function(_0x57069c){if(_0x57069c){return _0x57069c[_0x9114('0x20')](_0x47c156)['then'](function(_0x5ec5b6){return _0x5ec5b6;});}return null;};}function removeEntity(_0x7b8c72,_0xb8ea4b){return function(_0x163af2){if(_0x163af2){return _0x163af2['destroy']()['then'](function(){_0x7b8c72[_0x9114('0x17')](0xcc)[_0x9114('0x21')]();});}};}function handleEntityNotFound(_0xe6d04f,_0x4b859b){return function(_0x19ec7a){if(!_0x19ec7a){_0xe6d04f[_0x9114('0x16')](0x194);}return _0x19ec7a;};}function handleError(_0x426862,_0x3a4c51){_0x3a4c51=_0x3a4c51||0x1f4;return function(_0x3a0b2f){logger[_0x9114('0x22')](_0x3a0b2f[_0x9114('0x23')]);if(_0x3a0b2f[_0x9114('0x24')]){delete _0x3a0b2f[_0x9114('0x24')];}_0x426862[_0x9114('0x17')](_0x3a4c51)[_0x9114('0x25')](_0x3a0b2f);};}exports[_0x9114('0x26')]=function(_0x55a5d0,_0x1d576a){var _0x25d873={},_0x4ebebc={},_0x5b4e13={'count':0x0,'rows':[]};var _0x3684db=_['map'](db[_0x9114('0x27')][_0x9114('0x28')],function(_0x5dfbda){return{'name':_0x5dfbda[_0x9114('0x29')],'type':_0x5dfbda[_0x9114('0x2a')][_0x9114('0x2b')]};});_0x4ebebc[_0x9114('0x2c')]=_[_0x9114('0x2d')](_0x3684db,_0x9114('0x24'));_0x4ebebc[_0x9114('0x2e')]=_['keys'](_0x55a5d0[_0x9114('0x2e')]);_0x4ebebc[_0x9114('0x2f')]=_['intersection'](_0x4ebebc['model'],_0x4ebebc['query']);_0x25d873[_0x9114('0x30')]=_['intersection'](_0x4ebebc[_0x9114('0x2c')],qs['fields'](_0x55a5d0['query'][_0x9114('0x31')]));_0x25d873[_0x9114('0x30')]=_0x25d873[_0x9114('0x30')][_0x9114('0x32')]?_0x25d873[_0x9114('0x30')]:_0x4ebebc[_0x9114('0x2c')];if(!_0x55a5d0[_0x9114('0x2e')][_0x9114('0x33')](_0x9114('0x34'))){_0x25d873[_0x9114('0x1a')]=qs[_0x9114('0x1a')](_0x55a5d0[_0x9114('0x2e')][_0x9114('0x1a')]);_0x25d873[_0x9114('0x19')]=qs['offset'](_0x55a5d0[_0x9114('0x2e')]['offset']);}_0x25d873[_0x9114('0x35')]=qs['sort'](_0x55a5d0['query'][_0x9114('0x36')]);_0x25d873[_0x9114('0x37')]=qs[_0x9114('0x2f')](_['pick'](_0x55a5d0[_0x9114('0x2e')],_0x4ebebc['filters']),_0x3684db);if(_0x55a5d0[_0x9114('0x2e')][_0x9114('0x38')]){_0x25d873[_0x9114('0x37')]=_[_0x9114('0x39')](_0x25d873[_0x9114('0x37')],{'$or':_[_0x9114('0x2d')](_0x3684db,function(_0x3ed7ad){if(_0x3ed7ad['type']!==_0x9114('0x3a')){var _0x4f5b07={};_0x4f5b07[_0x3ed7ad[_0x9114('0x24')]]={'$like':'%'+_0x55a5d0[_0x9114('0x2e')][_0x9114('0x38')]+'%'};return _0x4f5b07;}})});}_0x25d873=_['merge']({},_0x25d873,_0x55a5d0[_0x9114('0x3b')]);var _0x554a46={'where':_0x25d873['where']};return db[_0x9114('0x27')]['count'](_0x554a46)['then'](function(_0x499ad5){_0x5b4e13[_0x9114('0x1c')]=_0x499ad5;if(_0x55a5d0['query'][_0x9114('0x3c')]){_0x25d873[_0x9114('0x3d')]=[{'all':!![]}];}return db[_0x9114('0x27')][_0x9114('0x3e')](_0x25d873);})[_0x9114('0x3f')](function(_0x4f2251){_0x5b4e13['rows']=_0x4f2251;return _0x5b4e13;})['then'](respondWithFilteredResult(_0x1d576a,_0x25d873))[_0x9114('0x40')](handleError(_0x1d576a,null));};exports[_0x9114('0x41')]=function(_0x549e50,_0x306e40){var _0x746075={'raw':!![],'where':{'id':_0x549e50[_0x9114('0x42')]['id']}},_0x208a40={};_0x208a40[_0x9114('0x2c')]=_[_0x9114('0x43')](db[_0x9114('0x27')][_0x9114('0x28')]);_0x208a40[_0x9114('0x2e')]=_['keys'](_0x549e50[_0x9114('0x2e')]);_0x208a40[_0x9114('0x2f')]=_[_0x9114('0x44')](_0x208a40[_0x9114('0x2c')],_0x208a40[_0x9114('0x2e')]);_0x746075[_0x9114('0x30')]=_[_0x9114('0x44')](_0x208a40['model'],qs[_0x9114('0x31')](_0x549e50[_0x9114('0x2e')]['fields']));_0x746075[_0x9114('0x30')]=_0x746075[_0x9114('0x30')][_0x9114('0x32')]?_0x746075[_0x9114('0x30')]:_0x208a40[_0x9114('0x2c')];if(_0x549e50[_0x9114('0x2e')][_0x9114('0x3c')]){_0x746075[_0x9114('0x3d')]=[{'all':!![]}];}_0x746075=_[_0x9114('0x39')]({},_0x746075,_0x549e50['options']);return db[_0x9114('0x27')]['find'](_0x746075)[_0x9114('0x3f')](handleEntityNotFound(_0x306e40,null))[_0x9114('0x3f')](respondWithResult(_0x306e40,null))[_0x9114('0x40')](handleError(_0x306e40,null));};exports[_0x9114('0x45')]=function(_0x3032f8,_0x37f40b){return db['SquareDetailsReport'][_0x9114('0x45')](_0x3032f8[_0x9114('0x46')],{})['then'](respondWithResult(_0x37f40b,0xc9))[_0x9114('0x40')](handleError(_0x37f40b,null));};exports[_0x9114('0x20')]=function(_0x5c5de2,_0x540a29){if(_0x5c5de2[_0x9114('0x46')]['id']){delete _0x5c5de2[_0x9114('0x46')]['id'];}return db[_0x9114('0x27')][_0x9114('0x47')]({'where':{'id':_0x5c5de2[_0x9114('0x42')]['id']}})[_0x9114('0x3f')](handleEntityNotFound(_0x540a29,null))['then'](saveUpdates(_0x5c5de2[_0x9114('0x46')],null))[_0x9114('0x3f')](respondWithResult(_0x540a29,null))[_0x9114('0x40')](handleError(_0x540a29,null));};exports[_0x9114('0x48')]=function(_0x38ebe9,_0x5c71cc){return db[_0x9114('0x27')]['find']({'where':{'id':_0x38ebe9[_0x9114('0x42')]['id']}})[_0x9114('0x3f')](handleEntityNotFound(_0x5c71cc,null))['then'](removeEntity(_0x5c71cc,null))[_0x9114('0x40')](handleError(_0x5c71cc,null));};exports[_0x9114('0x49')]=function(_0x8dba80,_0xbc0d8e){return db[_0x9114('0x27')][_0x9114('0x49')]()[_0x9114('0x3f')](respondWithResult(_0xbc0d8e,null))[_0x9114('0x40')](handleError(_0xbc0d8e,null));}; \ No newline at end of file +var _0xddf4=['request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','name','index','SquareDetailsReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','length','options','find','create','update','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xddf4,0x189));var _0x4ddf=function(_0x4a5c5d,_0x4699b1){_0x4a5c5d=_0x4a5c5d-0x0;var _0x3a89a4=_0xddf4[_0x4a5c5d];return _0x3a89a4;};'use strict';var emlformat=require(_0x4ddf('0x0'));var rimraf=require(_0x4ddf('0x1'));var zipdir=require(_0x4ddf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ddf('0x3'));var moment=require(_0x4ddf('0x4'));var BPromise=require(_0x4ddf('0x5'));var Mustache=require(_0x4ddf('0x6'));var util=require(_0x4ddf('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4ddf('0x8'));var ejs=require(_0x4ddf('0x9'));var fs=require('fs');var fs_extra=require(_0x4ddf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ddf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ddf('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x4ddf('0xd'));var hardwareService=require(_0x4ddf('0xe'));var logger=require('../../config/logger')(_0x4ddf('0xf'));var utils=require('../../config/utils');var config=require(_0x4ddf('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ddf('0x11'))['db'];function respondWithStatusCode(_0x3d749e,_0x45d047){_0x45d047=_0x45d047||0xcc;return function(_0x49fc2c){if(_0x49fc2c){return _0x3d749e[_0x4ddf('0x12')](_0x45d047);}return _0x3d749e[_0x4ddf('0x13')](_0x45d047)[_0x4ddf('0x14')]();};}function respondWithResult(_0x304560,_0x45bcb6){_0x45bcb6=_0x45bcb6||0xc8;return function(_0x53f9c3){if(_0x53f9c3){return _0x304560[_0x4ddf('0x13')](_0x45bcb6)[_0x4ddf('0x15')](_0x53f9c3);}};}function respondWithFilteredResult(_0x404fd7,_0x3f6c8c){return function(_0x5236e8){if(_0x5236e8){var _0x2c4474=typeof _0x3f6c8c[_0x4ddf('0x16')]===_0x4ddf('0x17')&&typeof _0x3f6c8c[_0x4ddf('0x18')]===_0x4ddf('0x17');var _0x220e43=_0x5236e8[_0x4ddf('0x19')];var _0x54c5db=_0x2c4474?0x0:_0x3f6c8c[_0x4ddf('0x16')];var _0x5bdc87=_0x2c4474?_0x5236e8[_0x4ddf('0x19')]:_0x3f6c8c[_0x4ddf('0x16')]+_0x3f6c8c['limit'];var _0x3a8947;if(_0x5bdc87>=_0x220e43){_0x5bdc87=_0x220e43;_0x3a8947=0xc8;}else{_0x3a8947=0xce;}_0x404fd7[_0x4ddf('0x13')](_0x3a8947);return _0x404fd7[_0x4ddf('0x1a')](_0x4ddf('0x1b'),_0x54c5db+'-'+_0x5bdc87+'/'+_0x220e43)[_0x4ddf('0x15')](_0x5236e8);}return null;};}function patchUpdates(_0x2943b5){return function(_0x13749c){try{jsonpatch[_0x4ddf('0x1c')](_0x13749c,_0x2943b5,!![]);}catch(_0x400193){return BPromise[_0x4ddf('0x1d')](_0x400193);}return _0x13749c['save']();};}function saveUpdates(_0x49ac83,_0x3223cd){return function(_0xad74ee){if(_0xad74ee){return _0xad74ee['update'](_0x49ac83)[_0x4ddf('0x1e')](function(_0x33d9c9){return _0x33d9c9;});}return null;};}function removeEntity(_0x3be41f,_0x101689){return function(_0x48e08d){if(_0x48e08d){return _0x48e08d['destroy']()['then'](function(){_0x3be41f['status'](0xcc)[_0x4ddf('0x14')]();});}};}function handleEntityNotFound(_0x21d47a,_0x2f7e13){return function(_0x1d398d){if(!_0x1d398d){_0x21d47a[_0x4ddf('0x12')](0x194);}return _0x1d398d;};}function handleError(_0x272d03,_0x47af0b){_0x47af0b=_0x47af0b||0x1f4;return function(_0x2d2c66){logger[_0x4ddf('0x1f')](_0x2d2c66['stack']);if(_0x2d2c66[_0x4ddf('0x20')]){delete _0x2d2c66[_0x4ddf('0x20')];}_0x272d03[_0x4ddf('0x13')](_0x47af0b)['send'](_0x2d2c66);};}exports[_0x4ddf('0x21')]=function(_0x289e44,_0xf4e338){var _0xdd6740={},_0x1b4905={},_0x11b17b={'count':0x0,'rows':[]};var _0x189a1c=_['map'](db[_0x4ddf('0x22')][_0x4ddf('0x23')],function(_0x13cf8c){return{'name':_0x13cf8c[_0x4ddf('0x24')],'type':_0x13cf8c[_0x4ddf('0x25')][_0x4ddf('0x26')]};});_0x1b4905['model']=_[_0x4ddf('0x27')](_0x189a1c,_0x4ddf('0x20'));_0x1b4905[_0x4ddf('0x28')]=_[_0x4ddf('0x29')](_0x289e44['query']);_0x1b4905['filters']=_[_0x4ddf('0x2a')](_0x1b4905['model'],_0x1b4905['query']);_0xdd6740['attributes']=_['intersection'](_0x1b4905[_0x4ddf('0x2b')],qs[_0x4ddf('0x2c')](_0x289e44[_0x4ddf('0x28')][_0x4ddf('0x2c')]));_0xdd6740[_0x4ddf('0x2d')]=_0xdd6740[_0x4ddf('0x2d')]['length']?_0xdd6740['attributes']:_0x1b4905['model'];if(!_0x289e44[_0x4ddf('0x28')][_0x4ddf('0x2e')]('nolimit')){_0xdd6740[_0x4ddf('0x18')]=qs[_0x4ddf('0x18')](_0x289e44['query']['limit']);_0xdd6740['offset']=qs[_0x4ddf('0x16')](_0x289e44[_0x4ddf('0x28')][_0x4ddf('0x16')]);}_0xdd6740[_0x4ddf('0x2f')]=qs['sort'](_0x289e44[_0x4ddf('0x28')]['sort']);_0xdd6740[_0x4ddf('0x30')]=qs[_0x4ddf('0x31')](_['pick'](_0x289e44[_0x4ddf('0x28')],_0x1b4905['filters']),_0x189a1c);if(_0x289e44[_0x4ddf('0x28')][_0x4ddf('0x32')]){_0xdd6740[_0x4ddf('0x30')]=_[_0x4ddf('0x33')](_0xdd6740[_0x4ddf('0x30')],{'$or':_['map'](_0x189a1c,function(_0x47f4b0){if(_0x47f4b0[_0x4ddf('0x25')]!==_0x4ddf('0x34')){var _0x32d37f={};_0x32d37f[_0x47f4b0[_0x4ddf('0x20')]]={'$like':'%'+_0x289e44[_0x4ddf('0x28')][_0x4ddf('0x32')]+'%'};return _0x32d37f;}})});}_0xdd6740=_[_0x4ddf('0x33')]({},_0xdd6740,_0x289e44['options']);var _0x283431={'where':_0xdd6740['where']};return db[_0x4ddf('0x22')][_0x4ddf('0x19')](_0x283431)[_0x4ddf('0x1e')](function(_0x1cc5df){_0x11b17b['count']=_0x1cc5df;if(_0x289e44['query'][_0x4ddf('0x35')]){_0xdd6740[_0x4ddf('0x36')]=[{'all':!![]}];}return db[_0x4ddf('0x22')]['findAll'](_0xdd6740);})[_0x4ddf('0x1e')](function(_0x5d3ee5){_0x11b17b[_0x4ddf('0x37')]=_0x5d3ee5;return _0x11b17b;})['then'](respondWithFilteredResult(_0xf4e338,_0xdd6740))[_0x4ddf('0x38')](handleError(_0xf4e338,null));};exports['show']=function(_0x4a8a9f,_0x499674){var _0x4ce01a={'raw':!![],'where':{'id':_0x4a8a9f[_0x4ddf('0x39')]['id']}},_0x17296c={};_0x17296c[_0x4ddf('0x2b')]=_[_0x4ddf('0x29')](db[_0x4ddf('0x22')][_0x4ddf('0x23')]);_0x17296c[_0x4ddf('0x28')]=_[_0x4ddf('0x29')](_0x4a8a9f[_0x4ddf('0x28')]);_0x17296c['filters']=_[_0x4ddf('0x2a')](_0x17296c[_0x4ddf('0x2b')],_0x17296c[_0x4ddf('0x28')]);_0x4ce01a[_0x4ddf('0x2d')]=_[_0x4ddf('0x2a')](_0x17296c[_0x4ddf('0x2b')],qs['fields'](_0x4a8a9f[_0x4ddf('0x28')]['fields']));_0x4ce01a[_0x4ddf('0x2d')]=_0x4ce01a[_0x4ddf('0x2d')][_0x4ddf('0x3a')]?_0x4ce01a[_0x4ddf('0x2d')]:_0x17296c[_0x4ddf('0x2b')];if(_0x4a8a9f[_0x4ddf('0x28')][_0x4ddf('0x35')]){_0x4ce01a[_0x4ddf('0x36')]=[{'all':!![]}];}_0x4ce01a=_['merge']({},_0x4ce01a,_0x4a8a9f[_0x4ddf('0x3b')]);return db['SquareDetailsReport'][_0x4ddf('0x3c')](_0x4ce01a)['then'](handleEntityNotFound(_0x499674,null))[_0x4ddf('0x1e')](respondWithResult(_0x499674,null))[_0x4ddf('0x38')](handleError(_0x499674,null));};exports[_0x4ddf('0x3d')]=function(_0x47281f,_0x1152e8){return db[_0x4ddf('0x22')][_0x4ddf('0x3d')](_0x47281f['body'],{})['then'](respondWithResult(_0x1152e8,0xc9))['catch'](handleError(_0x1152e8,null));};exports[_0x4ddf('0x3e')]=function(_0x4e0109,_0x475324){if(_0x4e0109[_0x4ddf('0x3f')]['id']){delete _0x4e0109[_0x4ddf('0x3f')]['id'];}return db[_0x4ddf('0x22')][_0x4ddf('0x3c')]({'where':{'id':_0x4e0109['params']['id']}})[_0x4ddf('0x1e')](handleEntityNotFound(_0x475324,null))['then'](saveUpdates(_0x4e0109[_0x4ddf('0x3f')],null))['then'](respondWithResult(_0x475324,null))[_0x4ddf('0x38')](handleError(_0x475324,null));};exports[_0x4ddf('0x40')]=function(_0x33ffdf,_0x13f35d){return db[_0x4ddf('0x22')][_0x4ddf('0x3c')]({'where':{'id':_0x33ffdf['params']['id']}})['then'](handleEntityNotFound(_0x13f35d,null))[_0x4ddf('0x1e')](removeEntity(_0x13f35d,null))[_0x4ddf('0x38')](handleError(_0x13f35d,null));};exports['describe']=function(_0x2bbbdd,_0x4b8239){return db[_0x4ddf('0x22')][_0x4ddf('0x41')]()[_0x4ddf('0x1e')](respondWithResult(_0x4b8239,null))['catch'](handleError(_0x4b8239,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 0d8f128..6e188e6 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 _0x72ab=['util','../../config/logger','moment','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x1caf4f,_0xd0b32d){var _0x11b9e2=function(_0xabd605){while(--_0xabd605){_0x1caf4f['push'](_0x1caf4f['shift']());}};_0x11b9e2(++_0xd0b32d);}(_0x72ab,0x176));var _0xb72a=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x72ab[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0xb72a('0x0'));var logger=require(_0xb72a('0x1'))('api');var moment=require(_0xb72a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb72a('0x3'));var rimraf=require(_0xb72a('0x4'));var config=require(_0xb72a('0x5'));var attributes=require(_0xb72a('0x6'));module[_0xb72a('0x7')]=function(_0x31a4a8,_0x19b28d){return _0x31a4a8[_0xb72a('0x8')](_0xb72a('0x9'),attributes,{'tableName':_0xb72a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5403=['bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment'];(function(_0x348364,_0x1b1cf4){var _0x41f520=function(_0x32c1c8){while(--_0x32c1c8){_0x348364['push'](_0x348364['shift']());}};_0x41f520(++_0x1b1cf4);}(_0x5403,0x1c2));var _0x3540=function(_0x3ede9d,_0x4abf88){_0x3ede9d=_0x3ede9d-0x0;var _0x2a0e59=_0x5403[_0x3ede9d];return _0x2a0e59;};'use strict';var _=require(_0x3540('0x0'));var util=require(_0x3540('0x1'));var logger=require(_0x3540('0x2'))(_0x3540('0x3'));var moment=require(_0x3540('0x4'));var BPromise=require(_0x3540('0x5'));var rp=require(_0x3540('0x6'));var fs=require('fs');var path=require(_0x3540('0x7'));var rimraf=require(_0x3540('0x8'));var config=require('../../config/environment');var attributes=require(_0x3540('0x9'));module[_0x3540('0xa')]=function(_0x405490,_0x3990c2){return _0x405490[_0x3540('0xb')](_0x3540('0xc'),attributes,{'tableName':'report_square_details','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 4cf47ee..fc6c98c 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 _0xa5fa=['../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0xa5fa,0xc4));var _0xaa5f=function(_0xc2b9ae,_0x515445){_0xc2b9ae=_0xc2b9ae-0x0;var _0x31deda=_0xa5fa[_0xc2b9ae];return _0x31deda;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')](_0x3d874f[_0xaa5f('0x19')],{'raw':_0x3d874f[_0xaa5f('0x1a')]?_0x3d874f[_0xaa5f('0x1a')][_0xaa5f('0x1b')]===undefined?!![]:![]:!![]})[_0xaa5f('0x1c')](function(_0x194691){logger[_0xaa5f('0xc')](_0xaa5f('0x16'),_0x3d874f);logger[_0xaa5f('0xd')](_0xaa5f('0x16'),_0x3d874f,JSON[_0xaa5f('0xe')](_0x194691));_0x1019e8(_0x194691);})['catch'](function(_0x1e917d){logger['error'](_0xaa5f('0x16'),_0x1e917d[_0xaa5f('0x12')],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x1e917d[_0xaa5f('0x12')]));});});}; \ No newline at end of file +var _0xf7b4=['debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options','then','CreateSquareDetailsReport','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0xf7b4,0x152));var _0x4f7b=function(_0x45cff9,_0x39c866){_0x45cff9=_0x45cff9-0x0;var _0x1f541c=_0xf7b4[_0x45cff9];return _0x1f541c;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['CreateSquareDetailsReport']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')](_0x24e5cf[_0x4f7b('0x17')],{'raw':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4f7b('0x19')](function(_0x12374b){logger[_0x4f7b('0xb')](_0x4f7b('0x1a'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x1a'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x12374b));_0x519d90(_0x12374b);})[_0x4f7b('0x14')](function(_0x2a8b50){logger['error'](_0x4f7b('0x1a'),_0x2a8b50[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da[_0x4f7b('0x10')](0x1f4,_0x2a8b50['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 478753c..174ec38 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 _0xd399=['Router','./system.controller','get','index','isAuthenticated','killProcess','express'];(function(_0x54175f,_0x2aa1fe){var _0x775a37=function(_0x1db6c6){while(--_0x1db6c6){_0x54175f['push'](_0x54175f['shift']());}};_0x775a37(++_0x2aa1fe);}(_0xd399,0x187));var _0x9d39=function(_0x144258,_0x2767b6){_0x144258=_0x144258-0x0;var _0x5aefff=_0xd399[_0x144258];return _0x5aefff;};'use strict';var express=require(_0x9d39('0x0'));var router=express[_0x9d39('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9d39('0x2'));router[_0x9d39('0x3')]('/',auth['isAuthenticated'](),controller[_0x9d39('0x4')]);router[_0x9d39('0x3')]('/process/:pid/kill',auth[_0x9d39('0x5')](),controller[_0x9d39('0x6')]);module['exports']=router; \ No newline at end of file +var _0x414b=['exports','express','Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x5129c9,_0x69d36f){var _0x2cba19=function(_0x366a29){while(--_0x366a29){_0x5129c9['push'](_0x5129c9['shift']());}};_0x2cba19(++_0x69d36f);}(_0x414b,0x13c));var _0xb414=function(_0xcf72f8,_0x403e78){_0xcf72f8=_0xcf72f8-0x0;var _0x1a7b96=_0x414b[_0xcf72f8];return _0x1a7b96;};'use strict';var express=require(_0xb414('0x0'));var router=express[_0xb414('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb414('0x2'));router[_0xb414('0x3')]('/',auth[_0xb414('0x4')](),controller[_0xb414('0x5')]);router[_0xb414('0x3')](_0xb414('0x6'),auth['isAuthenticated'](),controller[_0xb414('0x7')]);module[_0xb414('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index bc8d396..5dbbb1f 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 _0xb495=['pid','split','length','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','lodash','inspect','name','status','send','getAllData','then','json','catch','killProcess','components/import/cm','format'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xb495,0xed));var _0x5b49=function(_0x2625c7,_0xd36313){_0x2625c7=_0x2625c7-0x0;var _0x1b3e13=_0xb495[_0x2625c7];return _0x1b3e13;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x5b49('0x0')];var logger=require(_0x5b49('0x1'))(_0x5b49('0x2'));var util=require(_0x5b49('0x3'));var BPromise=require('bluebird');var _=require(_0x5b49('0x4'));function handleError(_0x40d6f8,_0x42fc97,_0x1c2131){_0x42fc97=_0x42fc97||0x1f4;return function(_0x430283){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1c2131,_0x42fc97,util[_0x5b49('0x5')](_0x430283,{'showHidden':![],'depth':null}));delete _0x430283[_0x5b49('0x6')];_0x40d6f8[_0x5b49('0x7')](_0x42fc97)[_0x5b49('0x8')](_0x430283);};}exports['index']=function(_0x4e76b1,_0x4b6f23){return info[_0x5b49('0x9')]()[_0x5b49('0xa')](function(_0xa3b6bb){return _0x4b6f23[_0x5b49('0x7')](0xc8)[_0x5b49('0xb')](_0xa3b6bb);})[_0x5b49('0xc')](function(_0x4fc782){return _0x4b6f23[_0x5b49('0x7')](0x1f4)['json'](_0x4fc782);});};exports[_0x5b49('0xd')]=function(_0x19da07,_0x30a442){var _0x33316a=[_0x5b49('0xe')];return new BPromise(function(_0x481dca,_0x376fd2){return exec(util[_0x5b49('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x19da07['params'][_0x5b49('0x10')]),function(_0x4707fd,_0x3df8e1,_0x58e8bd){if(_0x4707fd){return _0x376fd2(_0x4707fd);}return _0x481dca(_0x3df8e1);});})[_0x5b49('0xa')](function(_0x194e2c){var _0xdcc9fb=![];var _0x36efb1=_0x194e2c[_0x5b49('0x11')](/\n/);for(var _0x3c827a=0x0,_0xf16936=_0x33316a[_0x5b49('0x12')];_0x3c827a<_0xf16936,_0xdcc9fb===![];_0x3c827a+=0x1){if(_0x194e2c['indexOf'](_0x33316a[_0x3c827a])>=0x0){_0xdcc9fb=!![];}}if(!_0xdcc9fb){throw new Error(util[_0x5b49('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x19da07[_0x5b49('0x13')][_0x5b49('0x10')]));}process[_0x5b49('0x14')](_0x19da07[_0x5b49('0x13')][_0x5b49('0x10')],_0x5b49('0x15'));return _0x30a442[_0x5b49('0x7')](0xc8)[_0x5b49('0xb')]({'message':util['format'](_0x5b49('0x16'),_0x19da07[_0x5b49('0x13')][_0x5b49('0x10')])});})[_0x5b49('0xc')](handleError(_0x30a442,null,_0x5b49('0xd')));}; \ No newline at end of file +var _0x249e=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','catch','json','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x5ce453,_0x1f078a){var _0x369227=function(_0x5ed447){while(--_0x5ed447){_0x5ce453['push'](_0x5ce453['shift']());}};_0x369227(++_0x1f078a);}(_0x249e,0x14c));var _0xe249=function(_0x145735,_0x3c2ffb){_0x145735=_0x145735-0x0;var _0x127c48=_0x249e[_0x145735];return _0x127c48;};'use strict';var info=require(_0xe249('0x0'));var exec=require(_0xe249('0x1'))[_0xe249('0x2')];var logger=require(_0xe249('0x3'))(_0xe249('0x4'));var util=require(_0xe249('0x5'));var BPromise=require(_0xe249('0x6'));var _=require(_0xe249('0x7'));function handleError(_0x324966,_0x537676,_0x31b39a){_0x537676=_0x537676||0x1f4;return function(_0x3e698f){logger[_0xe249('0x8')](_0xe249('0x9'),_0x31b39a,_0x537676,util[_0xe249('0xa')](_0x3e698f,{'showHidden':![],'depth':null}));delete _0x3e698f[_0xe249('0xb')];_0x324966[_0xe249('0xc')](_0x537676)[_0xe249('0xd')](_0x3e698f);};}exports[_0xe249('0xe')]=function(_0x22e300,_0x5e4dcd){return info[_0xe249('0xf')]()['then'](function(_0x1793f5){return _0x5e4dcd[_0xe249('0xc')](0xc8)['json'](_0x1793f5);})[_0xe249('0x10')](function(_0x373c5a){return _0x5e4dcd[_0xe249('0xc')](0x1f4)[_0xe249('0x11')](_0x373c5a);});};exports['killProcess']=function(_0xeaa7fe,_0x577aba){var _0x3d5530=[_0xe249('0x12')];return new BPromise(function(_0x1c5c4e,_0x4d82ba){return exec(util['format'](_0xe249('0x13'),_0xeaa7fe[_0xe249('0x14')][_0xe249('0x15')]),function(_0x3a6350,_0x3388ea,_0x5b511f){if(_0x3a6350){return _0x4d82ba(_0x3a6350);}return _0x1c5c4e(_0x3388ea);});})[_0xe249('0x16')](function(_0x3fb3a3){var _0x3de854=![];var _0x49d6a7=_0x3fb3a3[_0xe249('0x17')](/\n/);for(var _0x335407=0x0,_0x46716b=_0x3d5530[_0xe249('0x18')];_0x335407<_0x46716b,_0x3de854===![];_0x335407+=0x1){if(_0x3fb3a3[_0xe249('0x19')](_0x3d5530[_0x335407])>=0x0){_0x3de854=!![];}}if(!_0x3de854){throw new Error(util[_0xe249('0x1a')](_0xe249('0x1b'),_0xeaa7fe['params'][_0xe249('0x15')]));}process[_0xe249('0x1c')](_0xeaa7fe[_0xe249('0x14')][_0xe249('0x15')],'SIGINT');return _0x577aba['status'](0xc8)['json']({'message':util[_0xe249('0x1a')](_0xe249('0x1d'),_0xeaa7fe[_0xe249('0x14')][_0xe249('0x15')])});})['catch'](handleError(_0x577aba,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4d01061..2cdae45 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 _0xf503=['fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','/:id','isAuthenticated','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x32a671,_0x54a06c){var _0x5aa260=function(_0x55aac3){while(--_0x55aac3){_0x32a671['push'](_0x32a671['shift']());}};_0x5aa260(++_0x54a06c);}(_0xf503,0x11a));var _0x3f50=function(_0x102123,_0x5c1a48){_0x102123=_0x102123-0x0;var _0x151fee=_0xf503[_0x102123];return _0x151fee;};'use strict';var multer=require(_0x3f50('0x0'));var util=require(_0x3f50('0x1'));var path=require(_0x3f50('0x2'));var timeout=require(_0x3f50('0x3'));var express=require(_0x3f50('0x4'));var router=express[_0x3f50('0x5')]();var fs_extra=require(_0x3f50('0x6'));var auth=require(_0x3f50('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3f50('0x8'));var controller=require(_0x3f50('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3f50('0xa')](_0x3f50('0xb'),auth[_0x3f50('0xc')](),controller[_0x3f50('0xd')]);router[_0x3f50('0xe')]('/',auth[_0x3f50('0xc')](),controller['create']);router[_0x3f50('0xf')]('/:id',auth[_0x3f50('0xc')](),controller[_0x3f50('0x10')]);router['delete'](_0x3f50('0xb'),auth[_0x3f50('0xc')](),controller['destroy']);module[_0x3f50('0x11')]=router; \ No newline at end of file +var _0xf0e3=['../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','Router','fs-extra'];(function(_0x58e3be,_0x691ccf){var _0x4e78c8=function(_0x1b6552){while(--_0x1b6552){_0x58e3be['push'](_0x58e3be['shift']());}};_0x4e78c8(++_0x691ccf);}(_0xf0e3,0xd9));var _0x3f0e=function(_0x5ee139,_0x3706a1){_0x5ee139=_0x5ee139-0x0;var _0x3974fe=_0xf0e3[_0x5ee139];return _0x3974fe;};'use strict';var multer=require('multer');var util=require(_0x3f0e('0x0'));var path=require(_0x3f0e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f0e('0x2')]();var fs_extra=require(_0x3f0e('0x3'));var auth=require(_0x3f0e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f0e('0x5'));var controller=require(_0x3f0e('0x6'));router[_0x3f0e('0x7')]('/',auth[_0x3f0e('0x8')](),controller['index']);router['get'](_0x3f0e('0x9'),auth['isAuthenticated'](),controller[_0x3f0e('0xa')]);router[_0x3f0e('0xb')]('/',auth[_0x3f0e('0x8')](),controller[_0x3f0e('0xc')]);router[_0x3f0e('0xd')](_0x3f0e('0x9'),auth[_0x3f0e('0x8')](),controller['update']);router[_0x3f0e('0xe')](_0x3f0e('0x9'),auth[_0x3f0e('0x8')](),controller[_0x3f0e('0xf')]);module[_0x3f0e('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b33b104..d14a760 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 _0x30fc=['sequelize','exports','name','STRING','#0091EA'];(function(_0x2e0661,_0x22ad87){var _0x2185d5=function(_0x58f56f){while(--_0x58f56f){_0x2e0661['push'](_0x2e0661['shift']());}};_0x2185d5(++_0x22ad87);}(_0x30fc,0x64));var _0xc30f=function(_0x3644b9,_0x5cd3a6){_0x3644b9=_0x3644b9-0x0;var _0x4d196d=_0x30fc[_0x3644b9];return _0x4d196d;};'use strict';var Sequelize=require(_0xc30f('0x0'));module[_0xc30f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc30f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc30f('0x3')],'defaultValue':_0xc30f('0x4')},'description':{'type':Sequelize[_0xc30f('0x3')]}}; \ No newline at end of file +var _0x2deb=['exports','STRING','name','sequelize'];(function(_0x23224c,_0x482d9b){var _0xa86d0d=function(_0x4cfa72){while(--_0x4cfa72){_0x23224c['push'](_0x23224c['shift']());}};_0xa86d0d(++_0x482d9b);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb2de('0x0'));module[_0xb2de('0x1')]={'name':{'type':Sequelize[_0xb2de('0x2')],'unique':_0xb2de('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb2de('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 806a1bd..6c8b1d5 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 _0x24cd=['undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','Tag','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x196047,_0x3208eb){var _0x55307f=function(_0x280827){while(--_0x280827){_0x196047['push'](_0x196047['shift']());}};_0x55307f(++_0x3208eb);}(_0x24cd,0x83));var _0xd24c=function(_0x4ab7e0,_0x3c2e26){_0x4ab7e0=_0x4ab7e0-0x0;var _0x34b469=_0x24cd[_0x4ab7e0];return _0x34b469;};'use strict';var emlformat=require(_0xd24c('0x0'));var rimraf=require(_0xd24c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd24c('0x2'));var rp=require('request-promise');var moment=require(_0xd24c('0x3'));var BPromise=require(_0xd24c('0x4'));var Mustache=require(_0xd24c('0x5'));var util=require('util');var path=require(_0xd24c('0x6'));var sox=require(_0xd24c('0x7'));var csv=require('to-csv');var ejs=require(_0xd24c('0x8'));var fs=require('fs');var fs_extra=require(_0xd24c('0x9'));var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0x10'));var authService=require(_0xd24c('0x11'));var qs=require(_0xd24c('0x12'));var as=require(_0xd24c('0x13'));var hardwareService=require(_0xd24c('0x14'));var logger=require(_0xd24c('0x15'))(_0xd24c('0x16'));var utils=require(_0xd24c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x18'));var db=require(_0xd24c('0x19'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x1a')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1b')](_0x3296ea)[_0xd24c('0x1c')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1d')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=typeof _0x528489[_0xd24c('0x1e')]===_0xd24c('0x1f')&&typeof _0x528489['limit']==='undefined';var _0xc87bb7=_0x34aa92[_0xd24c('0x20')];var _0x170d59=_0x3aa193?0x0:_0x528489['offset'];var _0x9f2d2d=_0x3aa193?_0x34aa92[_0xd24c('0x20')]:_0x528489[_0xd24c('0x1e')]+_0x528489[_0xd24c('0x21')];var _0x478a0f;if(_0x9f2d2d>=_0xc87bb7){_0x9f2d2d=_0xc87bb7;_0x478a0f=0xc8;}else{_0x478a0f=0xce;}_0xe096c[_0xd24c('0x1b')](_0x478a0f);return _0xe096c['set'](_0xd24c('0x22'),_0x170d59+'-'+_0x9f2d2d+'/'+_0xc87bb7)[_0xd24c('0x1d')](_0x34aa92);}return null;};}function patchUpdates(_0x1b3a2f){return function(_0x38c380){try{jsonpatch[_0xd24c('0x23')](_0x38c380,_0x1b3a2f,!![]);}catch(_0x4964e5){return BPromise[_0xd24c('0x24')](_0x4964e5);}return _0x38c380[_0xd24c('0x25')]();};}function saveUpdates(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')](_0x17375b)[_0xd24c('0x27')](function(_0x2549d0){return _0x2549d0;});}return null;};}function removeEntity(_0x5c862f,_0x44471f){return function(_0x2c3328){if(_0x2c3328){return _0x2c3328[_0xd24c('0x28')]()['then'](function(){var _0x4539e7=_0x2c3328[_0xd24c('0x29')]({'plain':!![]});var _0x848e0e=_0xd24c('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x848e0e,'resourceId':_0x4539e7['id']}})[_0xd24c('0x27')](function(){return _0x2c3328;});})['then'](function(){_0x5c862f[_0xd24c('0x1b')](0xcc)[_0xd24c('0x1c')]();});}};}function handleEntityNotFound(_0x325fcc,_0x4c0d99){return function(_0x4cb1b3){if(!_0x4cb1b3){_0x325fcc[_0xd24c('0x1a')](0x194);}return _0x4cb1b3;};}function handleError(_0x14d44a,_0x1a18b7){_0x1a18b7=_0x1a18b7||0x1f4;return function(_0x160f03){logger[_0xd24c('0x2b')](_0x160f03[_0xd24c('0x2c')]);if(_0x160f03[_0xd24c('0x2d')]){delete _0x160f03[_0xd24c('0x2d')];}_0x14d44a[_0xd24c('0x1b')](_0x1a18b7)[_0xd24c('0x2e')](_0x160f03);};}exports[_0xd24c('0x2f')]=function(_0x59cbb6,_0x4e128b){var _0x305e90={},_0x445bc6={},_0x1dc70b={'count':0x0,'rows':[]};var _0x56260c=_['map'](db[_0xd24c('0x30')][_0xd24c('0x31')],function(_0x34a64c){return{'name':_0x34a64c[_0xd24c('0x32')],'type':_0x34a64c['type'][_0xd24c('0x33')]};});_0x445bc6[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x56260c,_0xd24c('0x2d'));_0x445bc6[_0xd24c('0x36')]=_[_0xd24c('0x37')](_0x59cbb6[_0xd24c('0x36')]);_0x445bc6[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x445bc6['model'],_0x445bc6[_0xd24c('0x36')]);_0x305e90['attributes']=_['intersection'](_0x445bc6[_0xd24c('0x34')],qs[_0xd24c('0x3a')](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3a')]));_0x305e90[_0xd24c('0x3b')]=_0x305e90[_0xd24c('0x3b')][_0xd24c('0x3c')]?_0x305e90['attributes']:_0x445bc6[_0xd24c('0x34')];if(!_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3d')](_0xd24c('0x3e'))){_0x305e90[_0xd24c('0x21')]=qs[_0xd24c('0x21')](_0x59cbb6['query'][_0xd24c('0x21')]);_0x305e90[_0xd24c('0x1e')]=qs['offset'](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x1e')]);}_0x305e90['order']=qs[_0xd24c('0x3f')](_0x59cbb6[_0xd24c('0x36')]['sort']);_0x305e90[_0xd24c('0x40')]=qs[_0xd24c('0x38')](_[_0xd24c('0x41')](_0x59cbb6[_0xd24c('0x36')],_0x445bc6['filters']),_0x56260c);if(_0x59cbb6[_0xd24c('0x36')]['filter']){_0x305e90[_0xd24c('0x40')]=_['merge'](_0x305e90['where'],{'$or':_['map'](_0x56260c,function(_0x4160fb){if(_0x4160fb['type']!=='VIRTUAL'){var _0x66f45={};_0x66f45[_0x4160fb[_0xd24c('0x2d')]]={'$like':'%'+_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x42')]+'%'};return _0x66f45;}})});}_0x305e90=_['merge']({},_0x305e90,_0x59cbb6[_0xd24c('0x43')]);var _0x54a924={'where':_0x305e90[_0xd24c('0x40')]};return db[_0xd24c('0x30')][_0xd24c('0x20')](_0x54a924)[_0xd24c('0x27')](function(_0x27eefa){_0x1dc70b[_0xd24c('0x20')]=_0x27eefa;if(_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x44')]){_0x305e90[_0xd24c('0x45')]=[{'all':!![]}];}return db[_0xd24c('0x30')]['findAll'](_0x305e90);})[_0xd24c('0x27')](function(_0x742082){_0x1dc70b['rows']=_0x742082;return _0x1dc70b;})[_0xd24c('0x27')](respondWithFilteredResult(_0x4e128b,_0x305e90))[_0xd24c('0x46')](handleError(_0x4e128b,null));};exports['show']=function(_0x2f2981,_0x5d91fe){var _0x39cd94={'raw':!![],'where':{'id':_0x2f2981[_0xd24c('0x47')]['id']}},_0x2d46b8={};_0x2d46b8[_0xd24c('0x34')]=_[_0xd24c('0x37')](db['Tag'][_0xd24c('0x31')]);_0x2d46b8['query']=_[_0xd24c('0x37')](_0x2f2981['query']);_0x2d46b8[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x2d46b8['model'],_0x2d46b8[_0xd24c('0x36')]);_0x39cd94[_0xd24c('0x3b')]=_['intersection'](_0x2d46b8[_0xd24c('0x34')],qs['fields'](_0x2f2981['query']['fields']));_0x39cd94[_0xd24c('0x3b')]=_0x39cd94[_0xd24c('0x3b')]['length']?_0x39cd94['attributes']:_0x2d46b8[_0xd24c('0x34')];if(_0x2f2981[_0xd24c('0x36')][_0xd24c('0x44')]){_0x39cd94[_0xd24c('0x45')]=[{'all':!![]}];}_0x39cd94=_['merge']({},_0x39cd94,_0x2f2981[_0xd24c('0x43')]);return db[_0xd24c('0x30')]['find'](_0x39cd94)[_0xd24c('0x27')](handleEntityNotFound(_0x5d91fe,null))[_0xd24c('0x27')](respondWithResult(_0x5d91fe,null))[_0xd24c('0x46')](handleError(_0x5d91fe,null));};exports['create']=function(_0x3039aa,_0x4b10c6){return db[_0xd24c('0x30')][_0xd24c('0x48')](_0x3039aa[_0xd24c('0x49')],{})[_0xd24c('0x27')](function(_0x47d5ce){var _0x14684c=_0x3039aa[_0xd24c('0x4a')][_0xd24c('0x29')]({'plain':!![]});if(!_0x14684c)throw new Error(_0xd24c('0x4b'));if(_0x14684c[_0xd24c('0x4c')]===_0xd24c('0x4a')){var _0x3ce7d0=_0x47d5ce[_0xd24c('0x29')]({'plain':!![]});var _0x47067c=_0xd24c('0x2a');return db[_0xd24c('0x4d')]['find']({'where':{'name':_0x47067c,'userProfileId':_0x14684c[_0xd24c('0x4e')]},'raw':!![]})[_0xd24c('0x27')](function(_0x48f011){if(_0x48f011&&_0x48f011['autoAssociation']===0x0){return db['UserProfileResource'][_0xd24c('0x48')]({'name':_0x3ce7d0[_0xd24c('0x2d')],'resourceId':_0x3ce7d0['id'],'type':_0x48f011[_0xd24c('0x2d')],'sectionId':_0x48f011['id']},{})[_0xd24c('0x27')](function(){return _0x47d5ce;});}else{return _0x47d5ce;}})[_0xd24c('0x46')](function(_0x2ea05a){logger[_0xd24c('0x2b')](_0xd24c('0x4f'),_0x2ea05a);throw _0x2ea05a;});}return _0x47d5ce;})[_0xd24c('0x27')](respondWithResult(_0x4b10c6,0xc9))[_0xd24c('0x46')](handleError(_0x4b10c6,null));};exports[_0xd24c('0x26')]=function(_0x4fbb0b,_0x3a8e76){if(_0x4fbb0b[_0xd24c('0x49')]['id']){delete _0x4fbb0b['body']['id'];}return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x4fbb0b[_0xd24c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a8e76,null))['then'](saveUpdates(_0x4fbb0b[_0xd24c('0x49')],null))[_0xd24c('0x27')](respondWithResult(_0x3a8e76,null))[_0xd24c('0x46')](handleError(_0x3a8e76,null));};exports[_0xd24c('0x28')]=function(_0x148685,_0x3dee09){return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x148685['params']['id']}})[_0xd24c('0x27')](handleEntityNotFound(_0x3dee09,null))['then'](removeEntity(_0x3dee09,null))['catch'](handleError(_0x3dee09,null));}; \ No newline at end of file +var _0x4c6d=['apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','find','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','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'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x4b8a8a,_0x157c1e){_0x4b8a8a=_0x4b8a8a-0x0;var _0x297423=_0x4c6d[_0x4b8a8a];return _0x297423;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require('moment');var BPromise=require(_0xd4c6('0x5'));var Mustache=require(_0xd4c6('0x6'));var util=require(_0xd4c6('0x7'));var path=require('path');var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4c6('0xa'));var _=require(_0xd4c6('0xb'));var squel=require(_0xd4c6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xd'));var deskjs=require(_0xd4c6('0xe'));var toCsv=require(_0xd4c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd4c6('0xf'));var Redis=require(_0xd4c6('0x10'));var authService=require(_0xd4c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require(_0xd4c6('0x16'));var config=require(_0xd4c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b902,_0x489171){_0x489171=_0x489171||0xcc;return function(_0x162681){if(_0x162681){return _0x35b902[_0xd4c6('0x18')](_0x489171);}return _0x35b902[_0xd4c6('0x19')](_0x489171)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x3a2143,_0x384a98){_0x384a98=_0x384a98||0xc8;return function(_0x94f42e){if(_0x94f42e){return _0x3a2143['status'](_0x384a98)['json'](_0x94f42e);}};}function respondWithFilteredResult(_0x11e6c2,_0x3deb85){return function(_0x25e1fb){if(_0x25e1fb){var _0x25204d=typeof _0x3deb85[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x3deb85[_0xd4c6('0x1d')]==='undefined';var _0x761a3e=_0x25e1fb[_0xd4c6('0x1e')];var _0x23a16f=_0x25204d?0x0:_0x3deb85[_0xd4c6('0x1b')];var _0x31f328=_0x25204d?_0x25e1fb['count']:_0x3deb85[_0xd4c6('0x1b')]+_0x3deb85[_0xd4c6('0x1d')];var _0x359577;if(_0x31f328>=_0x761a3e){_0x31f328=_0x761a3e;_0x359577=0xc8;}else{_0x359577=0xce;}_0x11e6c2['status'](_0x359577);return _0x11e6c2[_0xd4c6('0x1f')](_0xd4c6('0x20'),_0x23a16f+'-'+_0x31f328+'/'+_0x761a3e)[_0xd4c6('0x21')](_0x25e1fb);}return null;};}function patchUpdates(_0x3b1658){return function(_0x48dbf8){try{jsonpatch[_0xd4c6('0x22')](_0x48dbf8,_0x3b1658,!![]);}catch(_0x4a10d8){return BPromise[_0xd4c6('0x23')](_0x4a10d8);}return _0x48dbf8[_0xd4c6('0x24')]();};}function saveUpdates(_0x2750c9,_0x222813){return function(_0xf536e0){if(_0xf536e0){return _0xf536e0[_0xd4c6('0x25')](_0x2750c9)[_0xd4c6('0x26')](function(_0x3f99e8){return _0x3f99e8;});}return null;};}function removeEntity(_0x155cb3,_0x466330){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0xd4c6('0x27')]()['then'](function(){var _0x582326=_0x1ebb17[_0xd4c6('0x28')]({'plain':!![]});var _0x2febbf='Tags';return db[_0xd4c6('0x29')][_0xd4c6('0x27')]({'where':{'type':_0x2febbf,'resourceId':_0x582326['id']}})[_0xd4c6('0x26')](function(){return _0x1ebb17;});})['then'](function(){_0x155cb3[_0xd4c6('0x19')](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x5614f3,_0x406ed0){return function(_0x8ce066){if(!_0x8ce066){_0x5614f3[_0xd4c6('0x18')](0x194);}return _0x8ce066;};}function handleError(_0x488e7e,_0x3ce942){_0x3ce942=_0x3ce942||0x1f4;return function(_0x3b656d){logger[_0xd4c6('0x2a')](_0x3b656d[_0xd4c6('0x2b')]);if(_0x3b656d[_0xd4c6('0x2c')]){delete _0x3b656d[_0xd4c6('0x2c')];}_0x488e7e[_0xd4c6('0x19')](_0x3ce942)[_0xd4c6('0x2d')](_0x3b656d);};}exports[_0xd4c6('0x2e')]=function(_0x1de7ae,_0x441119){var _0x31e3d0={},_0x15d312={},_0x112969={'count':0x0,'rows':[]};var _0x5d7997=_[_0xd4c6('0x2f')](db[_0xd4c6('0x30')][_0xd4c6('0x31')],function(_0x38d423){return{'name':_0x38d423['fieldName'],'type':_0x38d423['type']['key']};});_0x15d312[_0xd4c6('0x32')]=_[_0xd4c6('0x2f')](_0x5d7997,_0xd4c6('0x2c'));_0x15d312[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x1de7ae[_0xd4c6('0x33')]);_0x15d312[_0xd4c6('0x35')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],_0x15d312[_0xd4c6('0x33')]);_0x31e3d0[_0xd4c6('0x36')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x1de7ae[_0xd4c6('0x33')]['fields']));_0x31e3d0[_0xd4c6('0x36')]=_0x31e3d0[_0xd4c6('0x36')][_0xd4c6('0x38')]?_0x31e3d0[_0xd4c6('0x36')]:_0x15d312['model'];if(!_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x39')](_0xd4c6('0x3a'))){_0x31e3d0[_0xd4c6('0x1d')]=qs[_0xd4c6('0x1d')](_0x1de7ae['query'][_0xd4c6('0x1d')]);_0x31e3d0[_0xd4c6('0x1b')]=qs[_0xd4c6('0x1b')](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x1b')]);}_0x31e3d0[_0xd4c6('0x3b')]=qs['sort'](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3c')]);_0x31e3d0[_0xd4c6('0x3d')]=qs['filters'](_[_0xd4c6('0x3e')](_0x1de7ae[_0xd4c6('0x33')],_0x15d312[_0xd4c6('0x35')]),_0x5d7997);if(_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]){_0x31e3d0[_0xd4c6('0x3d')]=_[_0xd4c6('0x40')](_0x31e3d0[_0xd4c6('0x3d')],{'$or':_[_0xd4c6('0x2f')](_0x5d7997,function(_0x4c00f0){if(_0x4c00f0[_0xd4c6('0x41')]!=='VIRTUAL'){var _0x55063c={};_0x55063c[_0x4c00f0[_0xd4c6('0x2c')]]={'$like':'%'+_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]+'%'};return _0x55063c;}})});}_0x31e3d0=_[_0xd4c6('0x40')]({},_0x31e3d0,_0x1de7ae[_0xd4c6('0x42')]);var _0x536d65={'where':_0x31e3d0['where']};return db[_0xd4c6('0x30')][_0xd4c6('0x1e')](_0x536d65)[_0xd4c6('0x26')](function(_0x14ee8f){_0x112969['count']=_0x14ee8f;if(_0x1de7ae[_0xd4c6('0x33')]['includeAll']){_0x31e3d0[_0xd4c6('0x43')]=[{'all':!![]}];}return db[_0xd4c6('0x30')][_0xd4c6('0x44')](_0x31e3d0);})['then'](function(_0x470157){_0x112969[_0xd4c6('0x45')]=_0x470157;return _0x112969;})[_0xd4c6('0x26')](respondWithFilteredResult(_0x441119,_0x31e3d0))[_0xd4c6('0x46')](handleError(_0x441119,null));};exports[_0xd4c6('0x47')]=function(_0x3ef1b0,_0x11f62e){var _0x3beb89={'raw':!![],'where':{'id':_0x3ef1b0['params']['id']}},_0x343d94={};_0x343d94[_0xd4c6('0x32')]=_[_0xd4c6('0x34')](db[_0xd4c6('0x30')]['rawAttributes']);_0x343d94[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x3ef1b0[_0xd4c6('0x33')]);_0x343d94['filters']=_['intersection'](_0x343d94[_0xd4c6('0x32')],_0x343d94[_0xd4c6('0x33')]);_0x3beb89[_0xd4c6('0x36')]=_['intersection'](_0x343d94[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x37')]));_0x3beb89[_0xd4c6('0x36')]=_0x3beb89[_0xd4c6('0x36')]['length']?_0x3beb89[_0xd4c6('0x36')]:_0x343d94[_0xd4c6('0x32')];if(_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x48')]){_0x3beb89[_0xd4c6('0x43')]=[{'all':!![]}];}_0x3beb89=_[_0xd4c6('0x40')]({},_0x3beb89,_0x3ef1b0[_0xd4c6('0x42')]);return db[_0xd4c6('0x30')]['find'](_0x3beb89)['then'](handleEntityNotFound(_0x11f62e,null))[_0xd4c6('0x26')](respondWithResult(_0x11f62e,null))[_0xd4c6('0x46')](handleError(_0x11f62e,null));};exports[_0xd4c6('0x49')]=function(_0x5bb875,_0x37aa81){return db[_0xd4c6('0x30')][_0xd4c6('0x49')](_0x5bb875['body'],{})[_0xd4c6('0x26')](function(_0xa6bd55){var _0x17193f=_0x5bb875[_0xd4c6('0x4a')]['get']({'plain':!![]});if(!_0x17193f)throw new Error(_0xd4c6('0x4b'));if(_0x17193f[_0xd4c6('0x4c')]===_0xd4c6('0x4a')){var _0x14279d=_0xa6bd55[_0xd4c6('0x28')]({'plain':!![]});var _0x2803ef=_0xd4c6('0x4d');return db['UserProfileSection'][_0xd4c6('0x4e')]({'where':{'name':_0x2803ef,'userProfileId':_0x17193f[_0xd4c6('0x4f')]},'raw':!![]})[_0xd4c6('0x26')](function(_0x4a62a8){if(_0x4a62a8&&_0x4a62a8[_0xd4c6('0x50')]===0x0){return db[_0xd4c6('0x29')][_0xd4c6('0x49')]({'name':_0x14279d[_0xd4c6('0x2c')],'resourceId':_0x14279d['id'],'type':_0x4a62a8[_0xd4c6('0x2c')],'sectionId':_0x4a62a8['id']},{})[_0xd4c6('0x26')](function(){return _0xa6bd55;});}else{return _0xa6bd55;}})[_0xd4c6('0x46')](function(_0x591c7c){logger[_0xd4c6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x591c7c);throw _0x591c7c;});}return _0xa6bd55;})['then'](respondWithResult(_0x37aa81,0xc9))[_0xd4c6('0x46')](handleError(_0x37aa81,null));};exports['update']=function(_0x868da9,_0x574665){if(_0x868da9[_0xd4c6('0x51')]['id']){delete _0x868da9['body']['id'];}return db['Tag'][_0xd4c6('0x4e')]({'where':{'id':_0x868da9[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x574665,null))[_0xd4c6('0x26')](saveUpdates(_0x868da9[_0xd4c6('0x51')],null))[_0xd4c6('0x26')](respondWithResult(_0x574665,null))[_0xd4c6('0x46')](handleError(_0x574665,null));};exports[_0xd4c6('0x27')]=function(_0x33fac6,_0x5e52db){return db[_0xd4c6('0x30')][_0xd4c6('0x4e')]({'where':{'id':_0x33fac6[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x5e52db,null))[_0xd4c6('0x26')](removeEntity(_0x5e52db,null))[_0xd4c6('0x46')](handleError(_0x5e52db,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 23b2091..3dc8e0c 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 _0x44e9=['define','tools_tags','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports'];(function(_0x121c87,_0x5995e8){var _0x5810d3=function(_0x2af75a){while(--_0x2af75a){_0x121c87['push'](_0x121c87['shift']());}};_0x5810d3(++_0x5995e8);}(_0x44e9,0x138));var _0x944e=function(_0x18878f,_0x269660){_0x18878f=_0x18878f-0x0;var _0x1cd282=_0x44e9[_0x18878f];return _0x1cd282;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x944e('0x0'));var moment=require(_0x944e('0x1'));var BPromise=require(_0x944e('0x2'));var rp=require(_0x944e('0x3'));var fs=require('fs');var path=require(_0x944e('0x4'));var rimraf=require(_0x944e('0x5'));var config=require('../../config/environment');var attributes=require(_0x944e('0x6'));module[_0x944e('0x7')]=function(_0x10e5fa,_0x37fb2d){return _0x10e5fa[_0x944e('0x8')]('Tag',attributes,{'tableName':_0x944e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbc3=['tools_tags','lodash','util','api','request-promise','path','rimraf','./tag.attributes','exports','Tag'];(function(_0x43e19a,_0x3127f2){var _0x35099e=function(_0x3bbc47){while(--_0x3bbc47){_0x43e19a['push'](_0x43e19a['shift']());}};_0x35099e(++_0x3127f2);}(_0xcbc3,0x1a5));var _0x3cbc=function(_0x3a2798,_0x2e2ec6){_0x3a2798=_0x3a2798-0x0;var _0x2c5a84=_0xcbc3[_0x3a2798];return _0x2c5a84;};'use strict';var _=require(_0x3cbc('0x0'));var util=require(_0x3cbc('0x1'));var logger=require('../../config/logger')(_0x3cbc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3cbc('0x3'));var fs=require('fs');var path=require(_0x3cbc('0x4'));var rimraf=require(_0x3cbc('0x5'));var config=require('../../config/environment');var attributes=require(_0x3cbc('0x6'));module[_0x3cbc('0x7')]=function(_0x55f3fc,_0x4d1752){return _0x55f3fc['define'](_0x3cbc('0x8'),attributes,{'tableName':_0x3cbc('0x9'),'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 7f6c7cb..c6a2188 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 _0xe181=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0xe181,0x68));var _0x1e18=function(_0xd72d83,_0x114be1){_0xd72d83=_0xd72d83-0x0;var _0x485937=_0xe181[_0xd72d83];return _0x485937;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x182c98,_0x46ba95,_0x25b786){return new BPromise(function(_0x9f9541,_0x398f77){return client['request'](_0x182c98,_0x25b786)[_0x1e18('0xa')](function(_0x40fda9){logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));logger[_0x1e18('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x46ba95,_0x1e18('0xd'),JSON[_0x1e18('0xf')](_0x40fda9));if(_0x40fda9[_0x1e18('0x10')]){if(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x11')]===0x1f4){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x40fda9[_0x1e18('0x10')]['message']);return _0x398f77(_0x40fda9[_0x1e18('0x10')]['message']);}logger[_0x1e18('0x10')]('Tag,\x20%s,\x20%s',_0x46ba95,_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);return _0x9f9541(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);}else{logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));_0x9f9541(_0x40fda9[_0x1e18('0x13')][_0x1e18('0x12')]);}})[_0x1e18('0x14')](function(_0x12ef98){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x12ef98);_0x398f77(_0x12ef98);});});} \ No newline at end of file +var _0x32ef=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x4eec5d,_0xd7e83b){var _0x35443f=function(_0x409932){while(--_0x409932){_0x4eec5d['push'](_0x4eec5d['shift']());}};_0x35443f(++_0xd7e83b);}(_0x32ef,0xf9));var _0xf32e=function(_0x2a281a,_0x37e983){_0x2a281a=_0x2a281a-0x0;var _0xe6cd39=_0x32ef[_0x2a281a];return _0xe6cd39;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var moment=require(_0xf32e('0x2'));var BPromise=require(_0xf32e('0x3'));var rs=require(_0xf32e('0x4'));var fs=require('fs');var Redis=require(_0xf32e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf32e('0x6'));var logger=require(_0xf32e('0x7'))('rpc');var config=require(_0xf32e('0x8'));var jayson=require(_0xf32e('0x9'));var client=jayson[_0xf32e('0xa')][_0xf32e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xefc0a7,_0x899efc,_0x5aa5c8){return new BPromise(function(_0xdac5e,_0x5b3463){return client[_0xf32e('0xc')](_0xefc0a7,_0x5aa5c8)[_0xf32e('0xd')](function(_0xc37ea7){logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,'request\x20sent');logger[_0xf32e('0x10')](_0xf32e('0x11'),_0x899efc,_0xf32e('0x12'),JSON[_0xf32e('0x13')](_0xc37ea7));if(_0xc37ea7[_0xf32e('0x14')]){if(_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x15')]===0x1f4){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0x5b3463(_0xc37ea7['error'][_0xf32e('0x16')]);}logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0xdac5e(_0xc37ea7[_0xf32e('0x14')]['message']);}else{logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,_0xf32e('0x12'));_0xdac5e(_0xc37ea7[_0xf32e('0x17')][_0xf32e('0x16')]);}})[_0xf32e('0x18')](function(_0x6a0231){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0x6a0231);_0x5b3463(_0x6a0231);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6d3456d..f9fce4c 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 7b9bcc0..ec11231 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 _0xb10b=['name','sequelize','STRING'];(function(_0x51515c,_0x2f2605){var _0x569e88=function(_0xdb14d6){while(--_0xdb14d6){_0x51515c['push'](_0x51515c['shift']());}};_0x569e88(++_0x2f2605);}(_0xb10b,0x12a));var _0xbb10=function(_0x1abfac,_0x45ae54){_0x1abfac=_0x1abfac-0x0;var _0x2f97e6=_0xb10b[_0x1abfac];return _0x2f97e6;};'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 +var _0x0713=['STRING','name'];(function(_0x2dcdad,_0x288367){var _0x2d08dc=function(_0x4b8dc0){while(--_0x4b8dc0){_0x2dcdad['push'](_0x2dcdad['shift']());}};_0x2d08dc(++_0x288367);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f7c1dd7..e0d7a1e 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 _0xee37=['../../config/license/util','../../mysqldb','redis','./team.socket','register','sendStatus','status','json','offset','limit','count','apply','reject','save','update','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','keys','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','pick','Queues','addQueues','add','toLowerCase','ids','findOne','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','Queue','emit','User','findAll','online','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','voicePause','all','spread','removeAgents','Chat','transaction','getAgents','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x338460,_0x563ef8){var _0x889332=function(_0x47e695){while(--_0x47e695){_0x338460['push'](_0x338460['shift']());}};_0x889332(++_0x563ef8);}(_0xee37,0x7e));var _0x7ee3=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xee37[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0x7ee3('0x0'));var rimraf=require(_0x7ee3('0x1'));var zipdir=require(_0x7ee3('0x2'));var jsonpatch=require(_0x7ee3('0x3'));var rp=require(_0x7ee3('0x4'));var moment=require(_0x7ee3('0x5'));var BPromise=require(_0x7ee3('0x6'));var Mustache=require(_0x7ee3('0x7'));var util=require(_0x7ee3('0x8'));var path=require(_0x7ee3('0x9'));var sox=require(_0x7ee3('0xa'));var csv=require(_0x7ee3('0xb'));var ejs=require(_0x7ee3('0xc'));var fs=require('fs');var fs_extra=require(_0x7ee3('0xd'));var _=require(_0x7ee3('0xe'));var squel=require(_0x7ee3('0xf'));var crypto=require(_0x7ee3('0x10'));var jsforce=require(_0x7ee3('0x11'));var deskjs=require(_0x7ee3('0x12'));var toCsv=require(_0x7ee3('0xb'));var querystring=require(_0x7ee3('0x13'));var Papa=require(_0x7ee3('0x14'));var Redis=require(_0x7ee3('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x7ee3('0x16'));var as=require(_0x7ee3('0x17'));var hardwareService=require(_0x7ee3('0x18'));var logger=require(_0x7ee3('0x19'))(_0x7ee3('0x1a'));var utils=require(_0x7ee3('0x1b'));var config=require(_0x7ee3('0x1c'));var licenseUtil=require(_0x7ee3('0x1d'));var db=require(_0x7ee3('0x1e'))['db'];config[_0x7ee3('0x1f')]=_['defaults'](config[_0x7ee3('0x1f')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ee3('0x1f')]));require(_0x7ee3('0x20'))[_0x7ee3('0x21')](socket);function respondWithStatusCode(_0x37322d,_0x586d65){_0x586d65=_0x586d65||0xcc;return function(_0x31e093){if(_0x31e093){return _0x37322d[_0x7ee3('0x22')](_0x586d65);}return _0x37322d['status'](_0x586d65)['end']();};}function respondWithResult(_0x5c2024,_0x456098){_0x456098=_0x456098||0xc8;return function(_0x2265ee){if(_0x2265ee){return _0x5c2024[_0x7ee3('0x23')](_0x456098)[_0x7ee3('0x24')](_0x2265ee);}};}function respondWithFilteredResult(_0x5941e4,_0x26d480){return function(_0x474748){if(_0x474748){var _0xc0d237=typeof _0x26d480[_0x7ee3('0x25')]==='undefined'&&typeof _0x26d480[_0x7ee3('0x26')]==='undefined';var _0x53d462=_0x474748[_0x7ee3('0x27')];var _0x46c9bc=_0xc0d237?0x0:_0x26d480[_0x7ee3('0x25')];var _0x7ec6c5=_0xc0d237?_0x474748['count']:_0x26d480[_0x7ee3('0x25')]+_0x26d480[_0x7ee3('0x26')];var _0x1d6430;if(_0x7ec6c5>=_0x53d462){_0x7ec6c5=_0x53d462;_0x1d6430=0xc8;}else{_0x1d6430=0xce;}_0x5941e4[_0x7ee3('0x23')](_0x1d6430);return _0x5941e4['set']('Content-Range',_0x46c9bc+'-'+_0x7ec6c5+'/'+_0x53d462)[_0x7ee3('0x24')](_0x474748);}return null;};}function patchUpdates(_0x126f79){return function(_0x51abcc){try{jsonpatch[_0x7ee3('0x28')](_0x51abcc,_0x126f79,!![]);}catch(_0x274256){return BPromise[_0x7ee3('0x29')](_0x274256);}return _0x51abcc[_0x7ee3('0x2a')]();};}function saveUpdates(_0x589283,_0x4b72f9){return function(_0x5d175f){if(_0x5d175f){return _0x5d175f[_0x7ee3('0x2b')](_0x589283)[_0x7ee3('0x2c')](function(_0xbd1a93){return _0xbd1a93;});}return null;};}function handleEntityNotFound(_0x297762,_0x3485f3){return function(_0x57f2aa){if(!_0x57f2aa){_0x297762[_0x7ee3('0x22')](0x194);}return _0x57f2aa;};}function handleError(_0x359c52,_0x3e8405){_0x3e8405=_0x3e8405||0x1f4;return function(_0x554952){logger[_0x7ee3('0x2d')](_0x554952['stack']);if(_0x554952[_0x7ee3('0x2e')]){delete _0x554952[_0x7ee3('0x2e')];}_0x359c52['status'](_0x3e8405)[_0x7ee3('0x2f')](_0x554952);};}exports[_0x7ee3('0x30')]=function(_0x418657,_0x4282a8){var _0x28c690={},_0x1113d3={},_0x18e440={'count':0x0,'rows':[]};var _0x4ca5b2=_[_0x7ee3('0x31')](db[_0x7ee3('0x32')][_0x7ee3('0x33')],function(_0x1fd34f){return{'name':_0x1fd34f[_0x7ee3('0x34')],'type':_0x1fd34f[_0x7ee3('0x35')][_0x7ee3('0x36')]};});_0x1113d3[_0x7ee3('0x37')]=_['map'](_0x4ca5b2,_0x7ee3('0x2e'));_0x1113d3['query']=_['keys'](_0x418657['query']);_0x1113d3[_0x7ee3('0x38')]=_[_0x7ee3('0x39')](_0x1113d3[_0x7ee3('0x37')],_0x1113d3[_0x7ee3('0x3a')]);_0x28c690['attributes']=_['intersection'](_0x1113d3['model'],qs[_0x7ee3('0x3b')](_0x418657[_0x7ee3('0x3a')]['fields']));_0x28c690[_0x7ee3('0x3c')]=_0x28c690[_0x7ee3('0x3c')]['length']?_0x28c690[_0x7ee3('0x3c')]:_0x1113d3[_0x7ee3('0x37')];if(!_0x418657[_0x7ee3('0x3a')][_0x7ee3('0x3d')](_0x7ee3('0x3e'))){_0x28c690[_0x7ee3('0x26')]=qs[_0x7ee3('0x26')](_0x418657[_0x7ee3('0x3a')][_0x7ee3('0x26')]);_0x28c690[_0x7ee3('0x25')]=qs['offset'](_0x418657[_0x7ee3('0x3a')][_0x7ee3('0x25')]);}_0x28c690[_0x7ee3('0x3f')]=qs[_0x7ee3('0x40')](_0x418657[_0x7ee3('0x3a')][_0x7ee3('0x40')]);_0x28c690[_0x7ee3('0x41')]=qs[_0x7ee3('0x38')](_['pick'](_0x418657[_0x7ee3('0x3a')],_0x1113d3[_0x7ee3('0x38')]),_0x4ca5b2);if(_0x418657[_0x7ee3('0x3a')][_0x7ee3('0x42')]){_0x28c690[_0x7ee3('0x41')]=_[_0x7ee3('0x43')](_0x28c690['where'],{'$or':_[_0x7ee3('0x31')](_0x4ca5b2,function(_0x458c4f){if(_0x458c4f[_0x7ee3('0x35')]!=='VIRTUAL'){var _0x49aabe={};_0x49aabe[_0x458c4f[_0x7ee3('0x2e')]]={'$like':'%'+_0x418657['query']['filter']+'%'};return _0x49aabe;}})});}_0x28c690=_[_0x7ee3('0x43')]({},_0x28c690,_0x418657[_0x7ee3('0x44')]);var _0x293ac8={'where':_0x28c690['where']};return db[_0x7ee3('0x32')]['count'](_0x293ac8)['then'](function(_0x5438a5){_0x18e440[_0x7ee3('0x27')]=_0x5438a5;if(_0x418657[_0x7ee3('0x3a')][_0x7ee3('0x45')]){_0x28c690[_0x7ee3('0x46')]=[{'all':!![]}];}return db[_0x7ee3('0x32')]['findAll'](_0x28c690);})[_0x7ee3('0x2c')](function(_0x484781){_0x18e440['rows']=_0x484781;return _0x18e440;})[_0x7ee3('0x2c')](respondWithFilteredResult(_0x4282a8,_0x28c690))[_0x7ee3('0x47')](handleError(_0x4282a8,null));};exports[_0x7ee3('0x48')]=function(_0x2bc163,_0x23bb33){var _0x310277={'raw':![],'where':{'id':_0x2bc163[_0x7ee3('0x49')]['id']}},_0x78a980={};_0x78a980[_0x7ee3('0x37')]=_[_0x7ee3('0x4a')](db[_0x7ee3('0x32')]['rawAttributes']);_0x78a980[_0x7ee3('0x3a')]=_['keys'](_0x2bc163[_0x7ee3('0x3a')]);_0x78a980['filters']=_[_0x7ee3('0x39')](_0x78a980[_0x7ee3('0x37')],_0x78a980[_0x7ee3('0x3a')]);_0x310277['attributes']=_[_0x7ee3('0x39')](_0x78a980['model'],qs[_0x7ee3('0x3b')](_0x2bc163[_0x7ee3('0x3a')]['fields']));_0x310277['attributes']=_0x310277['attributes'][_0x7ee3('0x4b')]?_0x310277[_0x7ee3('0x3c')]:_0x78a980[_0x7ee3('0x37')];if(_0x2bc163[_0x7ee3('0x3a')][_0x7ee3('0x45')]){_0x310277[_0x7ee3('0x46')]=[{'all':!![]}];}_0x310277=_[_0x7ee3('0x43')]({},_0x310277,_0x2bc163[_0x7ee3('0x44')]);return db[_0x7ee3('0x32')][_0x7ee3('0x4c')](_0x310277)[_0x7ee3('0x2c')](handleEntityNotFound(_0x23bb33,null))['then'](respondWithResult(_0x23bb33,null))[_0x7ee3('0x47')](handleError(_0x23bb33,null));};exports['create']=function(_0x5a0e6e,_0x461b1b){return db[_0x7ee3('0x32')][_0x7ee3('0x4d')](_0x5a0e6e['body'],{})[_0x7ee3('0x2c')](function(_0x23651c){var _0x529da0=_0x5a0e6e[_0x7ee3('0x4e')][_0x7ee3('0x4f')]({'plain':!![]});if(!_0x529da0)throw new Error(_0x7ee3('0x50'));if(_0x529da0[_0x7ee3('0x51')]===_0x7ee3('0x4e')){var _0x50ce15=_0x23651c[_0x7ee3('0x4f')]({'plain':!![]});var _0x4606fd=_0x7ee3('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x4606fd,'userProfileId':_0x529da0[_0x7ee3('0x53')]},'raw':!![]})[_0x7ee3('0x2c')](function(_0x2e84b5){if(_0x2e84b5&&_0x2e84b5[_0x7ee3('0x54')]===0x0){return db[_0x7ee3('0x55')][_0x7ee3('0x4d')]({'name':_0x50ce15[_0x7ee3('0x2e')],'resourceId':_0x50ce15['id'],'type':_0x2e84b5[_0x7ee3('0x2e')],'sectionId':_0x2e84b5['id']},{})['then'](function(){return _0x23651c;});}else{return _0x23651c;}})[_0x7ee3('0x47')](function(_0x5cc330){logger[_0x7ee3('0x2d')](_0x7ee3('0x56'),_0x5cc330);throw _0x5cc330;});}return _0x23651c;})[_0x7ee3('0x2c')](respondWithResult(_0x461b1b,0xc9))[_0x7ee3('0x47')](handleError(_0x461b1b,null));};exports[_0x7ee3('0x2b')]=function(_0x25321c,_0x3dac37){if(_0x25321c['body']['id']){delete _0x25321c[_0x7ee3('0x57')]['id'];}return db[_0x7ee3('0x32')]['find']({'where':{'id':_0x25321c[_0x7ee3('0x49')]['id']}})['then'](handleEntityNotFound(_0x3dac37,null))[_0x7ee3('0x2c')](saveUpdates(_0x25321c[_0x7ee3('0x57')],null))[_0x7ee3('0x2c')](respondWithResult(_0x3dac37,null))[_0x7ee3('0x47')](handleError(_0x3dac37,null));};exports[_0x7ee3('0x58')]=function(_0x23ccd4,_0x37331e){var _0x4c5ba6=_0x23ccd4[_0x7ee3('0x49')]['id'];var _0x1a8842=[];return db[_0x7ee3('0x59')]['transaction'](function(_0x32a753){var _0x14c335=_0x7ee3('0x5a')+_0x4c5ba6;return db[_0x7ee3('0x59')][_0x7ee3('0x3a')](_0x14c335,{'type':db[_0x7ee3('0x5b')][_0x7ee3('0x5c')][_0x7ee3('0x5d')],'raw':!![],'transaction':_0x32a753})[_0x7ee3('0x2c')](function(_0x26b4f1){_0x1a8842=_[_0x7ee3('0x31')](_0x26b4f1,function(_0x110120){return Number(_0x110120[_0x7ee3('0x5e')]);});})[_0x7ee3('0x2c')](function(){var _0x25f51a=_0x7ee3('0x5f')+_0x4c5ba6;return db[_0x7ee3('0x59')][_0x7ee3('0x3a')](_0x25f51a,{'type':db[_0x7ee3('0x5b')][_0x7ee3('0x5c')]['SELECT'],'raw':!![],'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(_0x5b9aad){var _0x804348=_['map'](_0x5b9aad,function(_0x469ac3){return Number(_0x469ac3['VoiceQueueId']);});return db['UserVoiceQueue'][_0x7ee3('0x58')]({'where':{'UserId':{'$in':_0x1a8842},'VoiceQueueId':{'$in':_0x804348}},'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(){var _0x122267=_0x7ee3('0x60')+_0x4c5ba6;return db[_0x7ee3('0x59')][_0x7ee3('0x3a')](_0x122267,{'type':db['Sequelize'][_0x7ee3('0x5c')][_0x7ee3('0x5d')],'raw':!![],'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(_0x549eca){var _0xe06b5b=_[_0x7ee3('0x31')](_0x549eca,function(_0x416029){return Number(_0x416029[_0x7ee3('0x61')]);});return db[_0x7ee3('0x62')][_0x7ee3('0x58')]({'where':{'UserId':{'$in':_0x1a8842},'MailQueueId':{'$in':_0xe06b5b}},'transaction':_0x32a753});})['then'](function(){var _0x276c0e=_0x7ee3('0x63')+_0x4c5ba6;return db[_0x7ee3('0x59')][_0x7ee3('0x3a')](_0x276c0e,{'type':db[_0x7ee3('0x5b')][_0x7ee3('0x5c')][_0x7ee3('0x5d')],'raw':!![],'transaction':_0x32a753});})['then'](function(_0x13f9b){var _0x48b717=_[_0x7ee3('0x31')](_0x13f9b,function(_0x158958){return Number(_0x158958['SmsQueueId']);});return db['UserSmsQueue'][_0x7ee3('0x58')]({'where':{'UserId':{'$in':_0x1a8842},'SmsQueueId':{'$in':_0x48b717}},'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(){var _0x4b3fb7=_0x7ee3('0x64')+_0x4c5ba6;return db[_0x7ee3('0x59')][_0x7ee3('0x3a')](_0x4b3fb7,{'type':db['Sequelize'][_0x7ee3('0x5c')][_0x7ee3('0x5d')],'raw':!![],'transaction':_0x32a753});})['then'](function(_0x1e9e9f){var _0x4429f1=_[_0x7ee3('0x31')](_0x1e9e9f,function(_0x12c69b){return Number(_0x12c69b[_0x7ee3('0x65')]);});return db[_0x7ee3('0x66')]['destroy']({'where':{'UserId':{'$in':_0x1a8842},'ChatQueueId':{'$in':_0x4429f1}},'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(){var _0x1749a4='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4c5ba6;return db[_0x7ee3('0x59')][_0x7ee3('0x3a')](_0x1749a4,{'type':db[_0x7ee3('0x5b')][_0x7ee3('0x5c')]['SELECT'],'raw':!![],'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(_0x5e4bd7){var _0x70c1ea=_[_0x7ee3('0x31')](_0x5e4bd7,function(_0x3a1713){return Number(_0x3a1713['FaxQueueId']);});return db[_0x7ee3('0x67')][_0x7ee3('0x58')]({'where':{'UserId':{'$in':_0x1a8842},'FaxQueueId':{'$in':_0x70c1ea}},'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(){var _0x5221c2=_0x7ee3('0x68')+_0x4c5ba6;return db[_0x7ee3('0x59')][_0x7ee3('0x3a')](_0x5221c2,{'type':db[_0x7ee3('0x5b')][_0x7ee3('0x5c')][_0x7ee3('0x5d')],'raw':!![],'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(_0x675393){var _0x4c94d8=_[_0x7ee3('0x31')](_0x675393,function(_0x939f61){return Number(_0x939f61[_0x7ee3('0x69')]);});return db[_0x7ee3('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x1a8842},'OpenchannelQueueId':{'$in':_0x4c94d8}},'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(){var _0x2a3551=_0x7ee3('0x6b')+_0x4c5ba6;return db['sequelize'][_0x7ee3('0x3a')](_0x2a3551,{'type':db[_0x7ee3('0x5b')][_0x7ee3('0x5c')]['SELECT'],'raw':!![],'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(_0xae47c3){var _0x4cc723=_[_0x7ee3('0x31')](_0xae47c3,function(_0x420ffe){return Number(_0x420ffe[_0x7ee3('0x6c')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x1a8842},'WhatsappQueueId':{'$in':_0x4cc723}},'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(){return db[_0x7ee3('0x6d')][_0x7ee3('0x4c')]({'where':{'TeamId':_0x4c5ba6}});})['then'](function(_0x1e1ce6){if(_0x1e1ce6===null){return;}return db[_0x7ee3('0x6e')][_0x7ee3('0x58')]({'where':{'UserId':{'$in':_0x1a8842},'VoicePrefixId':_0x1e1ce6[_0x7ee3('0x6f')]},'transaction':_0x32a753});})['then'](function(){return db[_0x7ee3('0x32')][_0x7ee3('0x58')]({'where':{'id':_0x4c5ba6},'cascade':!![],'transaction':_0x32a753});})[_0x7ee3('0x2c')](function(_0x5d4f09){if(_0x5d4f09===0x0){_0x37331e[_0x7ee3('0x22')](0x194);}else{return db[_0x7ee3('0x55')][_0x7ee3('0x58')]({'where':{'type':_0x7ee3('0x52'),'resourceId':_0x4c5ba6},'cascade':!![],'transaction':_0x32a753})[_0x7ee3('0x2c')](function(){_0x37331e[_0x7ee3('0x23')](0xcc)[_0x7ee3('0x70')]();});}})['catch'](function(_0x12cddf){_0x37331e['status'](0x1f4)['send'](_0x12cddf);});});};exports[_0x7ee3('0x71')]=function(_0x2bdedb,_0x1d3d61,_0x60d57f){return db[_0x7ee3('0x32')]['findOne']({'where':{'id':_0x2bdedb[_0x7ee3('0x49')]['id']}})[_0x7ee3('0x2c')](handleEntityNotFound(_0x1d3d61,null))[_0x7ee3('0x2c')](function(_0x4310e2){if(!_0x2bdedb[_0x7ee3('0x3a')][_0x7ee3('0x72')]||!utils[_0x7ee3('0x73')](_0x2bdedb['query']['channel'])){throw new db['Sequelize'][(_0x7ee3('0x74'))](_0x7ee3('0x75'));}var _0xed5a94={};var _0x3b3ee7={};_0x3b3ee7[_0x7ee3('0x37')]=_[_0x7ee3('0x4a')](db[_[_0x7ee3('0x76')](_0x2bdedb[_0x7ee3('0x3a')][_0x7ee3('0x72')]['toLowerCase']())+'Queue'][_0x7ee3('0x33')]);_0x3b3ee7[_0x7ee3('0x3a')]=_[_0x7ee3('0x4a')](_0x2bdedb['query']);_0x3b3ee7['filters']=_['intersection'](_0x3b3ee7[_0x7ee3('0x37')],_0x3b3ee7[_0x7ee3('0x3a')]);_0xed5a94[_0x7ee3('0x3c')]=_[_0x7ee3('0x39')](_0x3b3ee7['model'],qs[_0x7ee3('0x3b')](_0x2bdedb['query'][_0x7ee3('0x3b')]));_0xed5a94[_0x7ee3('0x3c')]=_0xed5a94['attributes'][_0x7ee3('0x4b')]?_0xed5a94[_0x7ee3('0x3c')]:_0x3b3ee7[_0x7ee3('0x37')];_0xed5a94[_0x7ee3('0x26')]=qs[_0x7ee3('0x26')](_0x2bdedb[_0x7ee3('0x3a')][_0x7ee3('0x26')]);_0xed5a94[_0x7ee3('0x25')]=qs[_0x7ee3('0x25')](_0x2bdedb[_0x7ee3('0x3a')][_0x7ee3('0x25')]);_0xed5a94[_0x7ee3('0x3f')]=qs[_0x7ee3('0x40')](_0x2bdedb[_0x7ee3('0x3a')][_0x7ee3('0x40')]);_0xed5a94['where']=qs[_0x7ee3('0x38')](_[_0x7ee3('0x77')](_0x2bdedb[_0x7ee3('0x3a')],_0x3b3ee7[_0x7ee3('0x38')]));_0xed5a94=_[_0x7ee3('0x43')]({},_0xed5a94,_0x2bdedb[_0x7ee3('0x44')]);return _0x4310e2[_0x7ee3('0x4f')+_['capitalize'](_0x2bdedb[_0x7ee3('0x3a')][_0x7ee3('0x72')]['toLowerCase']())+_0x7ee3('0x78')](_0xed5a94);})['then'](respondWithResult(_0x1d3d61,null))[_0x7ee3('0x47')](handleError(_0x1d3d61,null));};exports[_0x7ee3('0x79')]=function(_0x2c937c,_0xda132c,_0x13d588){return db[_0x7ee3('0x32')]['findOne']({'where':{'id':_0x2c937c['params']['id']}})[_0x7ee3('0x2c')](function(_0x2fc859){if(_0x2fc859){if(!_0x2c937c[_0x7ee3('0x57')][_0x7ee3('0x72')]||!utils[_0x7ee3('0x73')](_0x2c937c[_0x7ee3('0x57')][_0x7ee3('0x72')])){throw new db[(_0x7ee3('0x5b'))][(_0x7ee3('0x74'))]('Unknown\x20channel');}return _0x2fc859[_0x7ee3('0x7a')+_[_0x7ee3('0x76')](_0x2c937c['body']['channel'][_0x7ee3('0x7b')]())+_0x7ee3('0x78')](_0x2c937c['body'][_0x7ee3('0x7c')]);}return null;})['then'](handleEntityNotFound(_0xda132c,null))[_0x7ee3('0x2c')](respondWithStatusCode(_0xda132c,null))[_0x7ee3('0x47')](handleError(_0xda132c,null));};exports['removeQueues']=function(_0x58813f,_0x11c660,_0x562dac){return db[_0x7ee3('0x32')][_0x7ee3('0x7d')]({'where':{'id':_0x58813f['params']['id']}})[_0x7ee3('0x2c')](function(_0x5cd970){if(_0x5cd970){if(!_0x58813f[_0x7ee3('0x3a')]['channel']||!utils[_0x7ee3('0x73')](_0x58813f[_0x7ee3('0x3a')][_0x7ee3('0x72')])){throw new db['Sequelize'][(_0x7ee3('0x74'))]('Unknown\x20channel');}return _0x5cd970['remove'+_[_0x7ee3('0x76')](_0x58813f[_0x7ee3('0x3a')]['channel']['toLowerCase']())+_0x7ee3('0x78')](_0x58813f[_0x7ee3('0x3a')][_0x7ee3('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x11c660,null))[_0x7ee3('0x2c')](respondWithStatusCode(_0x11c660,null))['catch'](handleError(_0x11c660,null));};exports[_0x7ee3('0x7e')]=function(_0x40101b,_0x4249b0){var _0xc04bac=_[_0x7ee3('0x7f')](_0x40101b['body'][_0x7ee3('0x7c')])?_0x40101b['body'][_0x7ee3('0x7c')]:[_0x40101b[_0x7ee3('0x57')][_0x7ee3('0x7c')]];var _0x9ad72c=_0x40101b[_0x7ee3('0x49')]['id'];return db[_0x7ee3('0x32')][_0x7ee3('0x4c')]({'where':{'id':_0x9ad72c}})['then'](handleEntityNotFound(_0x4249b0,null))[_0x7ee3('0x2c')](function(_0x2eb7f7){if(_0x2eb7f7){var _0x5ebcda=[_0x7ee3('0x80'),'Chat',_0x7ee3('0x81'),_0x7ee3('0x82'),_0x7ee3('0x83'),_0x7ee3('0x84'),_0x7ee3('0x85')];return db['sequelize']['transaction'](function(_0x2bd991){var _0x9cfeda=_[_0x7ee3('0x31')](_0x5ebcda,function(_0x395e18){var _0x5644f2={'attributes':['id',_0x7ee3('0x2e')]};if(_0x395e18===_0x7ee3('0x80')){_0x5644f2['through']={'attributes':[_0x7ee3('0x86')]};}return _0x2eb7f7[_0x7ee3('0x4f')+_0x395e18+_0x7ee3('0x78')](_0x5644f2)[_0x7ee3('0x2c')](function(_0x4dc654){var _0x3ee134=_['map'](_0x4dc654,function(_0x50bb8b){var _0x197b86=_[_0x7ee3('0x31')](_0xc04bac,function(_0x52f4ab){var _0x209db6={'where':{'UserId':_0x52f4ab,[_0x395e18+_0x7ee3('0x87')]:_0x50bb8b['id']},'transaction':_0x2bd991};if(_0x395e18===_0x7ee3('0x80')){_0x209db6['defaults']={'penalty':_0x50bb8b[_0x7ee3('0x88')][_0x7ee3('0x86')]};}return db['User'+_0x395e18+_0x7ee3('0x89')]['findOrCreate'](_0x209db6)[_0x7ee3('0x2c')](function(){socket[_0x7ee3('0x8a')](_0x7ee3('0x4e')+_0x395e18+'Queue:save',{'UserId':_0x52f4ab,[_0x395e18+_0x7ee3('0x87')]:_0x50bb8b['id']});if(_0x395e18!==_0x7ee3('0x80')){return;}return db[_0x7ee3('0x8b')][_0x7ee3('0x8c')]({'where':{'id':_0xc04bac,'online':0x1},'attributes':['id','name',_0x7ee3('0x8d'),'voicePause','interface'],'raw':!![]})[_0x7ee3('0x2c')](function(_0x282cd3){var _0x13e451=_[_0x7ee3('0x31')](_0x282cd3,function(_0x5bba79){return db[_0x7ee3('0x8e')][_0x7ee3('0x8f')]({'membername':_0x5bba79['name'],'UserId':_0x5bba79['id'],'queue_name':_0x50bb8b[_0x7ee3('0x2e')],'VoiceQueueId':_0x50bb8b['id'],'interface':_[_0x7ee3('0x90')](_0x5bba79[_0x7ee3('0x91')])?util[_0x7ee3('0x92')](_0x7ee3('0x93'),_0x5bba79[_0x7ee3('0x2e')]):_0x5bba79[_0x7ee3('0x91')],'paused':_0x5bba79[_0x7ee3('0x94')]||![],'penalty':_0x50bb8b[_0x7ee3('0x88')]['penalty']},{'transaction':_0x2bd991});});return Promise[_0x7ee3('0x95')](_0x13e451);});});});return Promise[_0x7ee3('0x95')](_0x197b86);});return Promise[_0x7ee3('0x95')](_0x3ee134);})[_0x7ee3('0x2c')](function(){return db[_0x7ee3('0x6d')][_0x7ee3('0x7d')]({'where':{'teamId':_0x9ad72c}})['then'](function(_0x5528e0){if(_0x5528e0){var _0x15b52c=_[_0x7ee3('0x31')](_0xc04bac,function(_0x1db706){db[_0x7ee3('0x6e')][_0x7ee3('0x8f')]({'UserId':_0x1db706,'VoicePrefixId':_0x5528e0[_0x7ee3('0x6f')]});});return Promise['all'](_0x15b52c);}});});});return Promise[_0x7ee3('0x95')](_0x9cfeda)[_0x7ee3('0x2c')](function(){return _0x2eb7f7[_0x7ee3('0x7e')](_0xc04bac,{'transaction':_0x2bd991})[_0x7ee3('0x96')](function(_0x21ffe0){return _0x21ffe0;});});});}})[_0x7ee3('0x2c')](respondWithResult(_0x4249b0,null))[_0x7ee3('0x47')](handleError(_0x4249b0,null));};exports[_0x7ee3('0x97')]=function(_0x20ee7f,_0x4b0439){var _0x27123a=_[_0x7ee3('0x7f')](_0x20ee7f[_0x7ee3('0x3a')]['ids'])?_0x20ee7f[_0x7ee3('0x3a')]['ids']:[_0x20ee7f[_0x7ee3('0x3a')][_0x7ee3('0x7c')]];var _0x2f757a=_0x20ee7f['params']['id'];return db[_0x7ee3('0x32')][_0x7ee3('0x4c')]({'where':{'id':_0x2f757a}})[_0x7ee3('0x2c')](handleEntityNotFound(_0x4b0439,null))[_0x7ee3('0x2c')](function(_0x1413df){if(_0x1413df){var _0xfc4944=[_0x7ee3('0x80'),_0x7ee3('0x98'),'Mail',_0x7ee3('0x82'),_0x7ee3('0x83'),_0x7ee3('0x84'),_0x7ee3('0x85')];return db[_0x7ee3('0x59')][_0x7ee3('0x99')](function(_0x46df78){var _0x2c219e=_[_0x7ee3('0x31')](_0xfc4944,function(_0x58f828){var _0x57376e={'attributes':['id','name']};return _0x1413df[_0x7ee3('0x4f')+_0x58f828+_0x7ee3('0x78')](_0x57376e)[_0x7ee3('0x2c')](function(_0x20ca21){var _0x494975=_[_0x7ee3('0x31')](_0x20ca21,function(_0x506c16){return _0x506c16[_0x7ee3('0x97')](_0x27123a,{'transaction':_0x46df78})[_0x7ee3('0x2c')](function(){var _0x235c84=_[_0x7ee3('0x31')](_0x27123a,function(_0x4b24d2){socket['emit'](_0x7ee3('0x4e')+_0x58f828+'Queue:remove',{'UserId':Number(_0x4b24d2),[_0x58f828+_0x7ee3('0x87')]:_0x506c16['id']});if(_0x58f828!==_0x7ee3('0x80')){return;}return db[_0x7ee3('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x506c16['id'],'UserId':_0x4b24d2},'transaction':_0x46df78});});return Promise[_0x7ee3('0x95')](_0x235c84);});});return Promise['all'](_0x494975);});});return Promise[_0x7ee3('0x95')](_0x2c219e)[_0x7ee3('0x2c')](function(){return _0x1413df[_0x7ee3('0x97')](_0x27123a,{'transaction':_0x46df78});})[_0x7ee3('0x2c')](function(){return db[_0x7ee3('0x6d')]['findOne']({'where':{'teamId':_0x2f757a}})[_0x7ee3('0x2c')](function(_0x14fd4f){if(_0x14fd4f){var _0x12d049=_[_0x7ee3('0x31')](_0x27123a,function(_0x102cc2){db['UserVoicePrefix'][_0x7ee3('0x58')]({'where':{'UserId':_0x102cc2,'VoicePrefixId':_0x14fd4f[_0x7ee3('0x6f')]}});});return Promise[_0x7ee3('0x95')](_0x12d049);}});});});}})[_0x7ee3('0x2c')](respondWithStatusCode(_0x4b0439,null))[_0x7ee3('0x47')](handleError(_0x4b0439,null));};exports['getAgents']=function(_0x13ab72,_0x64105,_0x4e5e73){var _0x4e431f={};var _0x20b510={};var _0x55e59f;var _0x5c9b52;return db[_0x7ee3('0x32')]['findOne']({'where':{'id':_0x13ab72[_0x7ee3('0x49')]['id']}})['then'](handleEntityNotFound(_0x64105,null))[_0x7ee3('0x2c')](function(_0x2b30cd){if(_0x2b30cd){_0x55e59f=_0x2b30cd;_0x20b510[_0x7ee3('0x37')]=_[_0x7ee3('0x4a')](db[_0x7ee3('0x8b')][_0x7ee3('0x33')]);_0x20b510['query']=_[_0x7ee3('0x4a')](_0x13ab72[_0x7ee3('0x3a')]);_0x20b510[_0x7ee3('0x38')]=_[_0x7ee3('0x39')](_0x20b510[_0x7ee3('0x37')],_0x20b510[_0x7ee3('0x3a')]);_0x4e431f['attributes']=_[_0x7ee3('0x39')](_0x20b510['model'],qs['fields'](_0x13ab72['query'][_0x7ee3('0x3b')]));_0x4e431f['attributes']=_0x4e431f[_0x7ee3('0x3c')][_0x7ee3('0x4b')]?_0x4e431f[_0x7ee3('0x3c')]:_0x20b510[_0x7ee3('0x37')];_0x4e431f['order']=qs[_0x7ee3('0x40')](_0x13ab72['query'][_0x7ee3('0x40')]);_0x4e431f[_0x7ee3('0x41')]=qs[_0x7ee3('0x38')](_[_0x7ee3('0x77')](_0x13ab72['query'],_0x20b510[_0x7ee3('0x38')]));if(_0x13ab72[_0x7ee3('0x3a')][_0x7ee3('0x42')]){_0x4e431f[_0x7ee3('0x41')]=_[_0x7ee3('0x43')](_0x4e431f[_0x7ee3('0x41')],{'$or':_[_0x7ee3('0x31')](_0x4e431f[_0x7ee3('0x3c')],function(_0x40deaa){var _0x376a9a={};_0x376a9a[_0x40deaa]={'$like':'%'+_0x13ab72[_0x7ee3('0x3a')][_0x7ee3('0x42')]+'%'};return _0x376a9a;})});}_0x4e431f=_[_0x7ee3('0x43')]({},_0x4e431f,_0x13ab72[_0x7ee3('0x44')]);return _0x55e59f[_0x7ee3('0x9a')](_0x4e431f);}})[_0x7ee3('0x2c')](function(_0x5db6ef){if(_0x5db6ef){_0x5c9b52=_0x5db6ef['length'];if(!_0x13ab72[_0x7ee3('0x3a')][_0x7ee3('0x3d')](_0x7ee3('0x3e'))){_0x4e431f[_0x7ee3('0x26')]=qs['limit'](_0x13ab72['query'][_0x7ee3('0x26')]);_0x4e431f[_0x7ee3('0x25')]=qs['offset'](_0x13ab72[_0x7ee3('0x3a')][_0x7ee3('0x25')]);}return _0x55e59f['getAgents'](_0x4e431f);}})[_0x7ee3('0x2c')](function(_0xb602ad){if(_0xb602ad){return _0xb602ad?{'count':_0x5c9b52,'rows':_0xb602ad}:null;}})['then'](respondWithResult(_0x64105,null))[_0x7ee3('0x47')](handleError(_0x64105,null));}; \ No newline at end of file +var _0x12e4=['upsert','spread','removeAgents','isArray','Mail','Queue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./team.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','name','index','Team','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','include','findAll','rows','show','params','keys','length','includeAll','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','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','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','send','findOne','channel','ValidationError','Unknown\x20channel','capitalize','Queue','order','toLowerCase','Queues','addQueues','isValidChannel','add','ids','remove','addAgents','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','through','QueueId','defaults','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','voicePause','interface','isNil','SIP/%s','all'];(function(_0x1d574c,_0x51bd70){var _0x5713ef=function(_0x119294){while(--_0x119294){_0x1d574c['push'](_0x1d574c['shift']());}};_0x5713ef(++_0x51bd70);}(_0x12e4,0x13f));var _0x412e=function(_0x46ee3c,_0x1ce457){_0x46ee3c=_0x46ee3c-0x0;var _0x1277c6=_0x12e4[_0x46ee3c];return _0x1277c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x412e('0x0'));var zipdir=require(_0x412e('0x1'));var jsonpatch=require(_0x412e('0x2'));var rp=require(_0x412e('0x3'));var moment=require(_0x412e('0x4'));var BPromise=require(_0x412e('0x5'));var Mustache=require(_0x412e('0x6'));var util=require(_0x412e('0x7'));var path=require(_0x412e('0x8'));var sox=require(_0x412e('0x9'));var csv=require(_0x412e('0xa'));var ejs=require(_0x412e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x412e('0xc'));var squel=require(_0x412e('0xd'));var crypto=require('crypto');var jsforce=require(_0x412e('0xe'));var deskjs=require(_0x412e('0xf'));var toCsv=require(_0x412e('0xa'));var querystring=require('querystring');var Papa=require(_0x412e('0x10'));var Redis=require(_0x412e('0x11'));var authService=require(_0x412e('0x12'));var qs=require(_0x412e('0x13'));var as=require(_0x412e('0x14'));var hardwareService=require(_0x412e('0x15'));var logger=require('../../config/logger')(_0x412e('0x16'));var utils=require(_0x412e('0x17'));var config=require(_0x412e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x412e('0x19'))['db'];config[_0x412e('0x1a')]=_['defaults'](config[_0x412e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x412e('0x1a')]));require(_0x412e('0x1b'))['register'](socket);function respondWithStatusCode(_0x2562cd,_0x30986e){_0x30986e=_0x30986e||0xcc;return function(_0x3c0992){if(_0x3c0992){return _0x2562cd[_0x412e('0x1c')](_0x30986e);}return _0x2562cd[_0x412e('0x1d')](_0x30986e)[_0x412e('0x1e')]();};}function respondWithResult(_0x1d579c,_0x4070fa){_0x4070fa=_0x4070fa||0xc8;return function(_0x59241f){if(_0x59241f){return _0x1d579c[_0x412e('0x1d')](_0x4070fa)['json'](_0x59241f);}};}function respondWithFilteredResult(_0x39bbfa,_0x2abfec){return function(_0x1204af){if(_0x1204af){var _0x4a305f=typeof _0x2abfec[_0x412e('0x1f')]===_0x412e('0x20')&&typeof _0x2abfec[_0x412e('0x21')]===_0x412e('0x20');var _0xf74091=_0x1204af[_0x412e('0x22')];var _0xb71022=_0x4a305f?0x0:_0x2abfec['offset'];var _0x111be8=_0x4a305f?_0x1204af[_0x412e('0x22')]:_0x2abfec['offset']+_0x2abfec[_0x412e('0x21')];var _0x54a827;if(_0x111be8>=_0xf74091){_0x111be8=_0xf74091;_0x54a827=0xc8;}else{_0x54a827=0xce;}_0x39bbfa['status'](_0x54a827);return _0x39bbfa[_0x412e('0x23')](_0x412e('0x24'),_0xb71022+'-'+_0x111be8+'/'+_0xf74091)[_0x412e('0x25')](_0x1204af);}return null;};}function patchUpdates(_0x23ab7b){return function(_0x4a5406){try{jsonpatch['apply'](_0x4a5406,_0x23ab7b,!![]);}catch(_0x2afab4){return BPromise['reject'](_0x2afab4);}return _0x4a5406['save']();};}function saveUpdates(_0x5a1fa9,_0x3ea492){return function(_0x3b8788){if(_0x3b8788){return _0x3b8788[_0x412e('0x26')](_0x5a1fa9)[_0x412e('0x27')](function(_0x262f07){return _0x262f07;});}return null;};}function handleEntityNotFound(_0x1058a2,_0x46afa0){return function(_0x3d0cd7){if(!_0x3d0cd7){_0x1058a2['sendStatus'](0x194);}return _0x3d0cd7;};}function handleError(_0x5391fc,_0xe2967d){_0xe2967d=_0xe2967d||0x1f4;return function(_0xaf2b8a){logger[_0x412e('0x28')](_0xaf2b8a['stack']);if(_0xaf2b8a[_0x412e('0x29')]){delete _0xaf2b8a[_0x412e('0x29')];}_0x5391fc[_0x412e('0x1d')](_0xe2967d)['send'](_0xaf2b8a);};}exports[_0x412e('0x2a')]=function(_0x4e1eb1,_0xa76900){var _0x1c39b1={},_0x439fec={},_0x3e8895={'count':0x0,'rows':[]};var _0x3a9eb8=_['map'](db[_0x412e('0x2b')][_0x412e('0x2c')],function(_0x58b0cb){return{'name':_0x58b0cb[_0x412e('0x2d')],'type':_0x58b0cb['type'][_0x412e('0x2e')]};});_0x439fec['model']=_['map'](_0x3a9eb8,_0x412e('0x29'));_0x439fec[_0x412e('0x2f')]=_['keys'](_0x4e1eb1[_0x412e('0x2f')]);_0x439fec[_0x412e('0x30')]=_[_0x412e('0x31')](_0x439fec[_0x412e('0x32')],_0x439fec[_0x412e('0x2f')]);_0x1c39b1[_0x412e('0x33')]=_[_0x412e('0x31')](_0x439fec[_0x412e('0x32')],qs[_0x412e('0x34')](_0x4e1eb1[_0x412e('0x2f')]['fields']));_0x1c39b1[_0x412e('0x33')]=_0x1c39b1[_0x412e('0x33')]['length']?_0x1c39b1[_0x412e('0x33')]:_0x439fec[_0x412e('0x32')];if(!_0x4e1eb1['query'][_0x412e('0x35')](_0x412e('0x36'))){_0x1c39b1[_0x412e('0x21')]=qs[_0x412e('0x21')](_0x4e1eb1[_0x412e('0x2f')][_0x412e('0x21')]);_0x1c39b1[_0x412e('0x1f')]=qs[_0x412e('0x1f')](_0x4e1eb1[_0x412e('0x2f')]['offset']);}_0x1c39b1['order']=qs['sort'](_0x4e1eb1[_0x412e('0x2f')][_0x412e('0x37')]);_0x1c39b1[_0x412e('0x38')]=qs[_0x412e('0x30')](_[_0x412e('0x39')](_0x4e1eb1[_0x412e('0x2f')],_0x439fec['filters']),_0x3a9eb8);if(_0x4e1eb1[_0x412e('0x2f')][_0x412e('0x3a')]){_0x1c39b1[_0x412e('0x38')]=_[_0x412e('0x3b')](_0x1c39b1[_0x412e('0x38')],{'$or':_[_0x412e('0x3c')](_0x3a9eb8,function(_0x2ef448){if(_0x2ef448[_0x412e('0x3d')]!==_0x412e('0x3e')){var _0x10d503={};_0x10d503[_0x2ef448[_0x412e('0x29')]]={'$like':'%'+_0x4e1eb1[_0x412e('0x2f')][_0x412e('0x3a')]+'%'};return _0x10d503;}})});}_0x1c39b1=_[_0x412e('0x3b')]({},_0x1c39b1,_0x4e1eb1['options']);var _0x2e860b={'where':_0x1c39b1[_0x412e('0x38')]};return db[_0x412e('0x2b')][_0x412e('0x22')](_0x2e860b)[_0x412e('0x27')](function(_0x23f9ad){_0x3e8895[_0x412e('0x22')]=_0x23f9ad;if(_0x4e1eb1[_0x412e('0x2f')]['includeAll']){_0x1c39b1[_0x412e('0x3f')]=[{'all':!![]}];}return db[_0x412e('0x2b')][_0x412e('0x40')](_0x1c39b1);})['then'](function(_0x4e6390){_0x3e8895[_0x412e('0x41')]=_0x4e6390;return _0x3e8895;})[_0x412e('0x27')](respondWithFilteredResult(_0xa76900,_0x1c39b1))['catch'](handleError(_0xa76900,null));};exports[_0x412e('0x42')]=function(_0x46fd8e,_0x2b9633){var _0x139034={'raw':![],'where':{'id':_0x46fd8e[_0x412e('0x43')]['id']}},_0x4b5e3d={};_0x4b5e3d[_0x412e('0x32')]=_[_0x412e('0x44')](db['Team'][_0x412e('0x2c')]);_0x4b5e3d[_0x412e('0x2f')]=_[_0x412e('0x44')](_0x46fd8e[_0x412e('0x2f')]);_0x4b5e3d[_0x412e('0x30')]=_[_0x412e('0x31')](_0x4b5e3d[_0x412e('0x32')],_0x4b5e3d[_0x412e('0x2f')]);_0x139034[_0x412e('0x33')]=_['intersection'](_0x4b5e3d[_0x412e('0x32')],qs['fields'](_0x46fd8e[_0x412e('0x2f')][_0x412e('0x34')]));_0x139034['attributes']=_0x139034[_0x412e('0x33')][_0x412e('0x45')]?_0x139034[_0x412e('0x33')]:_0x4b5e3d[_0x412e('0x32')];if(_0x46fd8e[_0x412e('0x2f')][_0x412e('0x46')]){_0x139034[_0x412e('0x3f')]=[{'all':!![]}];}_0x139034=_[_0x412e('0x3b')]({},_0x139034,_0x46fd8e[_0x412e('0x47')]);return db[_0x412e('0x2b')][_0x412e('0x48')](_0x139034)[_0x412e('0x27')](handleEntityNotFound(_0x2b9633,null))[_0x412e('0x27')](respondWithResult(_0x2b9633,null))[_0x412e('0x49')](handleError(_0x2b9633,null));};exports[_0x412e('0x4a')]=function(_0x3d7fc3,_0x29f2cf){return db[_0x412e('0x2b')][_0x412e('0x4a')](_0x3d7fc3[_0x412e('0x4b')],{})[_0x412e('0x27')](function(_0x26a546){var _0x2f364d=_0x3d7fc3['user'][_0x412e('0x4c')]({'plain':!![]});if(!_0x2f364d)throw new Error(_0x412e('0x4d'));if(_0x2f364d[_0x412e('0x4e')]===_0x412e('0x4f')){var _0x2858c1=_0x26a546[_0x412e('0x4c')]({'plain':!![]});var _0x4d2cd7=_0x412e('0x50');return db[_0x412e('0x51')]['find']({'where':{'name':_0x4d2cd7,'userProfileId':_0x2f364d[_0x412e('0x52')]},'raw':!![]})[_0x412e('0x27')](function(_0x328293){if(_0x328293&&_0x328293[_0x412e('0x53')]===0x0){return db['UserProfileResource'][_0x412e('0x4a')]({'name':_0x2858c1[_0x412e('0x29')],'resourceId':_0x2858c1['id'],'type':_0x328293[_0x412e('0x29')],'sectionId':_0x328293['id']},{})['then'](function(){return _0x26a546;});}else{return _0x26a546;}})[_0x412e('0x49')](function(_0xcc6838){logger[_0x412e('0x28')](_0x412e('0x54'),_0xcc6838);throw _0xcc6838;});}return _0x26a546;})[_0x412e('0x27')](respondWithResult(_0x29f2cf,0xc9))['catch'](handleError(_0x29f2cf,null));};exports[_0x412e('0x26')]=function(_0x3bad89,_0x35a2f9){if(_0x3bad89['body']['id']){delete _0x3bad89[_0x412e('0x4b')]['id'];}return db['Team'][_0x412e('0x48')]({'where':{'id':_0x3bad89[_0x412e('0x43')]['id']}})[_0x412e('0x27')](handleEntityNotFound(_0x35a2f9,null))['then'](saveUpdates(_0x3bad89['body'],null))[_0x412e('0x27')](respondWithResult(_0x35a2f9,null))['catch'](handleError(_0x35a2f9,null));};exports[_0x412e('0x55')]=function(_0x24ce05,_0x2c56eb){var _0x2eb82b=_0x24ce05['params']['id'];var _0x522daf=[];return db['sequelize'][_0x412e('0x56')](function(_0x5108db){var _0x13d9ed='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x2eb82b;return db['sequelize'][_0x412e('0x2f')](_0x13d9ed,{'type':db[_0x412e('0x57')]['QueryTypes'][_0x412e('0x58')],'raw':!![],'transaction':_0x5108db})[_0x412e('0x27')](function(_0x2c3835){_0x522daf=_[_0x412e('0x3c')](_0x2c3835,function(_0x4d5c06){return Number(_0x4d5c06[_0x412e('0x59')]);});})[_0x412e('0x27')](function(){var _0x245138=_0x412e('0x5a')+_0x2eb82b;return db[_0x412e('0x5b')][_0x412e('0x2f')](_0x245138,{'type':db[_0x412e('0x57')][_0x412e('0x5c')][_0x412e('0x58')],'raw':!![],'transaction':_0x5108db});})[_0x412e('0x27')](function(_0x5633f1){var _0xb7f9ac=_['map'](_0x5633f1,function(_0x1cb4d6){return Number(_0x1cb4d6[_0x412e('0x5d')]);});return db[_0x412e('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x522daf},'VoiceQueueId':{'$in':_0xb7f9ac}},'transaction':_0x5108db});})['then'](function(){var _0x16bf3d=_0x412e('0x5f')+_0x2eb82b;return db['sequelize']['query'](_0x16bf3d,{'type':db[_0x412e('0x57')][_0x412e('0x5c')]['SELECT'],'raw':!![],'transaction':_0x5108db});})[_0x412e('0x27')](function(_0x46fd88){var _0x5d8701=_[_0x412e('0x3c')](_0x46fd88,function(_0x4416cd){return Number(_0x4416cd[_0x412e('0x60')]);});return db['UserMailQueue'][_0x412e('0x55')]({'where':{'UserId':{'$in':_0x522daf},'MailQueueId':{'$in':_0x5d8701}},'transaction':_0x5108db});})[_0x412e('0x27')](function(){var _0x274679=_0x412e('0x61')+_0x2eb82b;return db[_0x412e('0x5b')]['query'](_0x274679,{'type':db[_0x412e('0x57')][_0x412e('0x5c')][_0x412e('0x58')],'raw':!![],'transaction':_0x5108db});})[_0x412e('0x27')](function(_0x3be7e0){var _0x5f0fb6=_['map'](_0x3be7e0,function(_0x3f2094){return Number(_0x3f2094[_0x412e('0x62')]);});return db[_0x412e('0x63')]['destroy']({'where':{'UserId':{'$in':_0x522daf},'SmsQueueId':{'$in':_0x5f0fb6}},'transaction':_0x5108db});})[_0x412e('0x27')](function(){var _0x49ed27=_0x412e('0x64')+_0x2eb82b;return db['sequelize'][_0x412e('0x2f')](_0x49ed27,{'type':db[_0x412e('0x57')][_0x412e('0x5c')][_0x412e('0x58')],'raw':!![],'transaction':_0x5108db});})[_0x412e('0x27')](function(_0x341e0f){var _0x2db62b=_[_0x412e('0x3c')](_0x341e0f,function(_0x2388f2){return Number(_0x2388f2[_0x412e('0x65')]);});return db[_0x412e('0x66')][_0x412e('0x55')]({'where':{'UserId':{'$in':_0x522daf},'ChatQueueId':{'$in':_0x2db62b}},'transaction':_0x5108db});})[_0x412e('0x27')](function(){var _0x28c24f=_0x412e('0x67')+_0x2eb82b;return db[_0x412e('0x5b')][_0x412e('0x2f')](_0x28c24f,{'type':db[_0x412e('0x57')][_0x412e('0x5c')][_0x412e('0x58')],'raw':!![],'transaction':_0x5108db});})[_0x412e('0x27')](function(_0x49d0e0){var _0x49aec5=_[_0x412e('0x3c')](_0x49d0e0,function(_0x573881){return Number(_0x573881[_0x412e('0x68')]);});return db['UserFaxQueue'][_0x412e('0x55')]({'where':{'UserId':{'$in':_0x522daf},'FaxQueueId':{'$in':_0x49aec5}},'transaction':_0x5108db});})[_0x412e('0x27')](function(){var _0x414aa2='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2eb82b;return db[_0x412e('0x5b')][_0x412e('0x2f')](_0x414aa2,{'type':db['Sequelize'][_0x412e('0x5c')][_0x412e('0x58')],'raw':!![],'transaction':_0x5108db});})[_0x412e('0x27')](function(_0x543c08){var _0x479f50=_[_0x412e('0x3c')](_0x543c08,function(_0x660537){return Number(_0x660537[_0x412e('0x69')]);});return db[_0x412e('0x6a')][_0x412e('0x55')]({'where':{'UserId':{'$in':_0x522daf},'OpenchannelQueueId':{'$in':_0x479f50}},'transaction':_0x5108db});})['then'](function(){var _0x579b2b=_0x412e('0x6b')+_0x2eb82b;return db[_0x412e('0x5b')][_0x412e('0x2f')](_0x579b2b,{'type':db[_0x412e('0x57')]['QueryTypes'][_0x412e('0x58')],'raw':!![],'transaction':_0x5108db});})['then'](function(_0x224bf0){var _0x53c1c7=_[_0x412e('0x3c')](_0x224bf0,function(_0x3ca1db){return Number(_0x3ca1db[_0x412e('0x6c')]);});return db[_0x412e('0x6d')][_0x412e('0x55')]({'where':{'UserId':{'$in':_0x522daf},'WhatsappQueueId':{'$in':_0x53c1c7}},'transaction':_0x5108db});})[_0x412e('0x27')](function(){return db[_0x412e('0x6e')][_0x412e('0x48')]({'where':{'TeamId':_0x2eb82b}});})[_0x412e('0x27')](function(_0x15e444){if(_0x15e444===null){return;}return db[_0x412e('0x6f')][_0x412e('0x55')]({'where':{'UserId':{'$in':_0x522daf},'VoicePrefixId':_0x15e444[_0x412e('0x70')]},'transaction':_0x5108db});})[_0x412e('0x27')](function(){return db[_0x412e('0x2b')][_0x412e('0x55')]({'where':{'id':_0x2eb82b},'cascade':!![],'transaction':_0x5108db});})[_0x412e('0x27')](function(_0x2761b9){if(_0x2761b9===0x0){_0x2c56eb['sendStatus'](0x194);}else{return db[_0x412e('0x71')]['destroy']({'where':{'type':'Teams','resourceId':_0x2eb82b},'cascade':!![],'transaction':_0x5108db})[_0x412e('0x27')](function(){_0x2c56eb[_0x412e('0x1d')](0xcc)[_0x412e('0x1e')]();});}})[_0x412e('0x49')](function(_0x45231b){_0x2c56eb['status'](0x1f4)[_0x412e('0x72')](_0x45231b);});});};exports['getQueues']=function(_0x442565,_0x28e9ce,_0x12b67a){return db[_0x412e('0x2b')][_0x412e('0x73')]({'where':{'id':_0x442565[_0x412e('0x43')]['id']}})['then'](handleEntityNotFound(_0x28e9ce,null))[_0x412e('0x27')](function(_0x3d9b42){if(!_0x442565[_0x412e('0x2f')][_0x412e('0x74')]||!utils['isValidChannel'](_0x442565['query'][_0x412e('0x74')])){throw new db[(_0x412e('0x57'))][(_0x412e('0x75'))](_0x412e('0x76'));}var _0x15c1fc={};var _0x487842={};_0x487842['model']=_[_0x412e('0x44')](db[_[_0x412e('0x77')](_0x442565[_0x412e('0x2f')][_0x412e('0x74')]['toLowerCase']())+_0x412e('0x78')][_0x412e('0x2c')]);_0x487842[_0x412e('0x2f')]=_['keys'](_0x442565[_0x412e('0x2f')]);_0x487842[_0x412e('0x30')]=_[_0x412e('0x31')](_0x487842['model'],_0x487842[_0x412e('0x2f')]);_0x15c1fc[_0x412e('0x33')]=_[_0x412e('0x31')](_0x487842['model'],qs[_0x412e('0x34')](_0x442565[_0x412e('0x2f')][_0x412e('0x34')]));_0x15c1fc[_0x412e('0x33')]=_0x15c1fc[_0x412e('0x33')][_0x412e('0x45')]?_0x15c1fc[_0x412e('0x33')]:_0x487842[_0x412e('0x32')];_0x15c1fc[_0x412e('0x21')]=qs[_0x412e('0x21')](_0x442565[_0x412e('0x2f')][_0x412e('0x21')]);_0x15c1fc[_0x412e('0x1f')]=qs[_0x412e('0x1f')](_0x442565[_0x412e('0x2f')][_0x412e('0x1f')]);_0x15c1fc[_0x412e('0x79')]=qs[_0x412e('0x37')](_0x442565[_0x412e('0x2f')][_0x412e('0x37')]);_0x15c1fc[_0x412e('0x38')]=qs[_0x412e('0x30')](_[_0x412e('0x39')](_0x442565[_0x412e('0x2f')],_0x487842[_0x412e('0x30')]));_0x15c1fc=_[_0x412e('0x3b')]({},_0x15c1fc,_0x442565[_0x412e('0x47')]);return _0x3d9b42[_0x412e('0x4c')+_[_0x412e('0x77')](_0x442565['query'][_0x412e('0x74')][_0x412e('0x7a')]())+_0x412e('0x7b')](_0x15c1fc);})[_0x412e('0x27')](respondWithResult(_0x28e9ce,null))[_0x412e('0x49')](handleError(_0x28e9ce,null));};exports[_0x412e('0x7c')]=function(_0x472b37,_0x1de11d,_0x3eadcb){return db[_0x412e('0x2b')][_0x412e('0x73')]({'where':{'id':_0x472b37['params']['id']}})[_0x412e('0x27')](function(_0x41096b){if(_0x41096b){if(!_0x472b37[_0x412e('0x4b')][_0x412e('0x74')]||!utils[_0x412e('0x7d')](_0x472b37['body']['channel'])){throw new db[(_0x412e('0x57'))][(_0x412e('0x75'))](_0x412e('0x76'));}return _0x41096b[_0x412e('0x7e')+_[_0x412e('0x77')](_0x472b37['body'][_0x412e('0x74')][_0x412e('0x7a')]())+_0x412e('0x7b')](_0x472b37[_0x412e('0x4b')][_0x412e('0x7f')]);}return null;})[_0x412e('0x27')](handleEntityNotFound(_0x1de11d,null))[_0x412e('0x27')](respondWithStatusCode(_0x1de11d,null))['catch'](handleError(_0x1de11d,null));};exports['removeQueues']=function(_0xf1a541,_0xe4489,_0x1c5d2b){return db[_0x412e('0x2b')][_0x412e('0x73')]({'where':{'id':_0xf1a541[_0x412e('0x43')]['id']}})['then'](function(_0x362845){if(_0x362845){if(!_0xf1a541[_0x412e('0x2f')][_0x412e('0x74')]||!utils[_0x412e('0x7d')](_0xf1a541[_0x412e('0x2f')][_0x412e('0x74')])){throw new db[(_0x412e('0x57'))][(_0x412e('0x75'))](_0x412e('0x76'));}return _0x362845[_0x412e('0x80')+_[_0x412e('0x77')](_0xf1a541[_0x412e('0x2f')][_0x412e('0x74')][_0x412e('0x7a')]())+_0x412e('0x7b')](_0xf1a541[_0x412e('0x2f')][_0x412e('0x7f')]);}return null;})[_0x412e('0x27')](handleEntityNotFound(_0xe4489,null))[_0x412e('0x27')](respondWithStatusCode(_0xe4489,null))['catch'](handleError(_0xe4489,null));};exports[_0x412e('0x81')]=function(_0x39cedf,_0x30363a){var _0x5e5ee7=_['isArray'](_0x39cedf['body'][_0x412e('0x7f')])?_0x39cedf[_0x412e('0x4b')][_0x412e('0x7f')]:[_0x39cedf['body'][_0x412e('0x7f')]];var _0x4735fb=_0x39cedf[_0x412e('0x43')]['id'];return db[_0x412e('0x2b')][_0x412e('0x48')]({'where':{'id':_0x4735fb}})['then'](handleEntityNotFound(_0x30363a,null))[_0x412e('0x27')](function(_0x2077ed){if(_0x2077ed){var _0x34bdef=[_0x412e('0x82'),_0x412e('0x83'),'Mail',_0x412e('0x84'),_0x412e('0x85'),_0x412e('0x86'),_0x412e('0x87')];return db[_0x412e('0x5b')]['transaction'](function(_0x2475d8){var _0x2c7098=_['map'](_0x34bdef,function(_0xded559){var _0x34344d={'attributes':['id',_0x412e('0x29')]};if(_0xded559==='Voice'){_0x34344d[_0x412e('0x88')]={'attributes':['penalty']};}return _0x2077ed[_0x412e('0x4c')+_0xded559+_0x412e('0x7b')](_0x34344d)[_0x412e('0x27')](function(_0x3fba88){var _0x2b7a7a=_[_0x412e('0x3c')](_0x3fba88,function(_0x198046){var _0x3ac6d1=_[_0x412e('0x3c')](_0x5e5ee7,function(_0x26dfc8){var _0x2a5015={'where':{'UserId':_0x26dfc8,[_0xded559+_0x412e('0x89')]:_0x198046['id']},'transaction':_0x2475d8};if(_0xded559==='Voice'){_0x2a5015[_0x412e('0x8a')]={'penalty':_0x198046[_0x412e('0x8b')][_0x412e('0x8c')]};}return db[_0x412e('0x8d')+_0xded559+_0x412e('0x78')][_0x412e('0x8e')](_0x2a5015)[_0x412e('0x27')](function(){socket['emit'](_0x412e('0x4f')+_0xded559+_0x412e('0x8f'),{'UserId':_0x26dfc8,[_0xded559+'QueueId']:_0x198046['id']});if(_0xded559!==_0x412e('0x82')){return;}return db[_0x412e('0x8d')][_0x412e('0x40')]({'where':{'id':_0x5e5ee7,'online':0x1},'attributes':['id','name','online',_0x412e('0x90'),_0x412e('0x91')],'raw':!![]})['then'](function(_0x4bcf68){var _0x2489fa=_[_0x412e('0x3c')](_0x4bcf68,function(_0x1cffc1){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1cffc1['name'],'UserId':_0x1cffc1['id'],'queue_name':_0x198046[_0x412e('0x29')],'VoiceQueueId':_0x198046['id'],'interface':_[_0x412e('0x92')](_0x1cffc1[_0x412e('0x91')])?util['format'](_0x412e('0x93'),_0x1cffc1[_0x412e('0x29')]):_0x1cffc1[_0x412e('0x91')],'paused':_0x1cffc1[_0x412e('0x90')]||![],'penalty':_0x198046[_0x412e('0x8b')]['penalty']},{'transaction':_0x2475d8});});return Promise['all'](_0x2489fa);});});});return Promise[_0x412e('0x94')](_0x3ac6d1);});return Promise[_0x412e('0x94')](_0x2b7a7a);})['then'](function(){return db[_0x412e('0x6e')][_0x412e('0x73')]({'where':{'teamId':_0x4735fb}})[_0x412e('0x27')](function(_0x23c9cc){if(_0x23c9cc){var _0x5e0cd9=_['map'](_0x5e5ee7,function(_0x550c43){db[_0x412e('0x6f')][_0x412e('0x95')]({'UserId':_0x550c43,'VoicePrefixId':_0x23c9cc[_0x412e('0x70')]});});return Promise[_0x412e('0x94')](_0x5e0cd9);}});});});return Promise[_0x412e('0x94')](_0x2c7098)[_0x412e('0x27')](function(){return _0x2077ed[_0x412e('0x81')](_0x5e5ee7,{'transaction':_0x2475d8})[_0x412e('0x96')](function(_0x126843){return _0x126843;});});});}})['then'](respondWithResult(_0x30363a,null))['catch'](handleError(_0x30363a,null));};exports[_0x412e('0x97')]=function(_0x1a6887,_0x16e1c7){var _0x39f958=_[_0x412e('0x98')](_0x1a6887[_0x412e('0x2f')][_0x412e('0x7f')])?_0x1a6887[_0x412e('0x2f')][_0x412e('0x7f')]:[_0x1a6887[_0x412e('0x2f')][_0x412e('0x7f')]];var _0x151906=_0x1a6887[_0x412e('0x43')]['id'];return db[_0x412e('0x2b')][_0x412e('0x48')]({'where':{'id':_0x151906}})[_0x412e('0x27')](handleEntityNotFound(_0x16e1c7,null))['then'](function(_0xf3ac42){if(_0xf3ac42){var _0xe5d2bd=['Voice',_0x412e('0x83'),_0x412e('0x99'),_0x412e('0x84'),_0x412e('0x85'),_0x412e('0x86'),_0x412e('0x87')];return db[_0x412e('0x5b')][_0x412e('0x56')](function(_0x1afee2){var _0x33e577=_['map'](_0xe5d2bd,function(_0x357e52){var _0x3f2d06={'attributes':['id',_0x412e('0x29')]};return _0xf3ac42[_0x412e('0x4c')+_0x357e52+_0x412e('0x7b')](_0x3f2d06)[_0x412e('0x27')](function(_0x46b386){var _0x1a3a01=_[_0x412e('0x3c')](_0x46b386,function(_0x5d82b0){return _0x5d82b0[_0x412e('0x97')](_0x39f958,{'transaction':_0x1afee2})[_0x412e('0x27')](function(){var _0x3ba4e9=_['map'](_0x39f958,function(_0x28b777){socket['emit']('user'+_0x357e52+_0x412e('0x9a'),{'UserId':Number(_0x28b777),[_0x357e52+_0x412e('0x89')]:_0x5d82b0['id']});if(_0x357e52!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x412e('0x55')]({'where':{'VoiceQueueId':_0x5d82b0['id'],'UserId':_0x28b777},'transaction':_0x1afee2});});return Promise[_0x412e('0x94')](_0x3ba4e9);});});return Promise[_0x412e('0x94')](_0x1a3a01);});});return Promise[_0x412e('0x94')](_0x33e577)['then'](function(){return _0xf3ac42[_0x412e('0x97')](_0x39f958,{'transaction':_0x1afee2});})[_0x412e('0x27')](function(){return db[_0x412e('0x6e')]['findOne']({'where':{'teamId':_0x151906}})[_0x412e('0x27')](function(_0x1a07ea){if(_0x1a07ea){var _0x21d676=_['map'](_0x39f958,function(_0x623083){db[_0x412e('0x6f')]['destroy']({'where':{'UserId':_0x623083,'VoicePrefixId':_0x1a07ea[_0x412e('0x70')]}});});return Promise[_0x412e('0x94')](_0x21d676);}});});});}})['then'](respondWithStatusCode(_0x16e1c7,null))[_0x412e('0x49')](handleError(_0x16e1c7,null));};exports[_0x412e('0x9b')]=function(_0x17f73d,_0x2a5b29,_0x37fa58){var _0x29070a={};var _0x245764={};var _0x21d902;var _0x5aa445;return db[_0x412e('0x2b')][_0x412e('0x73')]({'where':{'id':_0x17f73d['params']['id']}})['then'](handleEntityNotFound(_0x2a5b29,null))[_0x412e('0x27')](function(_0xda6b2e){if(_0xda6b2e){_0x21d902=_0xda6b2e;_0x245764[_0x412e('0x32')]=_[_0x412e('0x44')](db['User'][_0x412e('0x2c')]);_0x245764[_0x412e('0x2f')]=_[_0x412e('0x44')](_0x17f73d[_0x412e('0x2f')]);_0x245764['filters']=_[_0x412e('0x31')](_0x245764[_0x412e('0x32')],_0x245764[_0x412e('0x2f')]);_0x29070a['attributes']=_[_0x412e('0x31')](_0x245764['model'],qs[_0x412e('0x34')](_0x17f73d[_0x412e('0x2f')][_0x412e('0x34')]));_0x29070a[_0x412e('0x33')]=_0x29070a[_0x412e('0x33')][_0x412e('0x45')]?_0x29070a[_0x412e('0x33')]:_0x245764['model'];_0x29070a['order']=qs['sort'](_0x17f73d[_0x412e('0x2f')][_0x412e('0x37')]);_0x29070a[_0x412e('0x38')]=qs[_0x412e('0x30')](_[_0x412e('0x39')](_0x17f73d[_0x412e('0x2f')],_0x245764[_0x412e('0x30')]));if(_0x17f73d[_0x412e('0x2f')][_0x412e('0x3a')]){_0x29070a[_0x412e('0x38')]=_[_0x412e('0x3b')](_0x29070a['where'],{'$or':_[_0x412e('0x3c')](_0x29070a[_0x412e('0x33')],function(_0x3f492f){var _0x34f713={};_0x34f713[_0x3f492f]={'$like':'%'+_0x17f73d[_0x412e('0x2f')][_0x412e('0x3a')]+'%'};return _0x34f713;})});}_0x29070a=_['merge']({},_0x29070a,_0x17f73d[_0x412e('0x47')]);return _0x21d902[_0x412e('0x9b')](_0x29070a);}})[_0x412e('0x27')](function(_0x1ae652){if(_0x1ae652){_0x5aa445=_0x1ae652['length'];if(!_0x17f73d[_0x412e('0x2f')][_0x412e('0x35')]('nolimit')){_0x29070a[_0x412e('0x21')]=qs[_0x412e('0x21')](_0x17f73d[_0x412e('0x2f')][_0x412e('0x21')]);_0x29070a[_0x412e('0x1f')]=qs[_0x412e('0x1f')](_0x17f73d[_0x412e('0x2f')][_0x412e('0x1f')]);}return _0x21d902[_0x412e('0x9b')](_0x29070a);}})[_0x412e('0x27')](function(_0x13a93e){if(_0x13a93e){return _0x13a93e?{'count':_0x5aa445,'rows':_0x13a93e}:null;}})[_0x412e('0x27')](respondWithResult(_0x2a5b29,null))['catch'](handleError(_0x2a5b29,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c1d5710..823b14f 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 _0xf543=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x10ef19,_0x3af3e8){var _0x52957c=function(_0xb08ffa){while(--_0xb08ffa){_0x10ef19['push'](_0x10ef19['shift']());}};_0x52957c(++_0x3af3e8);}(_0xf543,0x94));var _0x3f54=function(_0x556974,_0x3542cf){_0x556974=_0x556974-0x0;var _0xba6c32=_0xf543[_0x556974];return _0xba6c32;};'use strict';var EventEmitter=require(_0x3f54('0x0'));var Team=require(_0x3f54('0x1'))['db'][_0x3f54('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x3f54('0x3')](0x0);var events={'afterCreate':_0x3f54('0x4'),'afterUpdate':_0x3f54('0x5'),'afterDestroy':_0x3f54('0x6')};function emitEvent(_0x14db5d){return function(_0x4b873d,_0xf9d097,_0x5c7bbd){TeamEvents[_0x3f54('0x7')](_0x14db5d+':'+_0x4b873d['id'],_0x4b873d);TeamEvents[_0x3f54('0x7')](_0x14db5d,_0x4b873d);_0x5c7bbd(null);};}for(var e in events){if(events[_0x3f54('0x8')](e)){var event=events[e];Team[_0x3f54('0x9')](e,emitEvent(event));}}module[_0x3f54('0xa')]=TeamEvents; \ No newline at end of file +var _0x995f=['hasOwnProperty','hook','../../mysqldb','Team','setMaxListeners','save','update','emit'];(function(_0x41d09a,_0x2a2699){var _0x26e807=function(_0x20a9fe){while(--_0x20a9fe){_0x41d09a['push'](_0x41d09a['shift']());}};_0x26e807(++_0x2a2699);}(_0x995f,0xca));var _0xf995=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0x995f[_0x6978c0];return _0x361377;};'use strict';var EventEmitter=require('events');var Team=require(_0xf995('0x0'))['db'][_0xf995('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xf995('0x2')](0x0);var events={'afterCreate':_0xf995('0x3'),'afterUpdate':_0xf995('0x4'),'afterDestroy':'remove'};function emitEvent(_0x76800d){return function(_0x2943d1,_0x5e8d1e,_0x2dcbfc){TeamEvents['emit'](_0x76800d+':'+_0x2943d1['id'],_0x2943d1);TeamEvents[_0xf995('0x5')](_0x76800d,_0x2943d1);_0x2dcbfc(null);};}for(var e in events){if(events[_0xf995('0x6')](e)){var event=events[e];Team[_0xf995('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4136338..00803a0 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 _0xb46a=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./team.attributes','exports','teams','lodash','util'];(function(_0x36f1be,_0x44e4f8){var _0x46008a=function(_0x45dad2){while(--_0x45dad2){_0x36f1be['push'](_0x36f1be['shift']());}};_0x46008a(++_0x44e4f8);}(_0xb46a,0x11c));var _0xab46=function(_0x5ee37c,_0x1badab){_0x5ee37c=_0x5ee37c-0x0;var _0x5786fc=_0xb46a[_0x5ee37c];return _0x5786fc;};'use strict';var _=require(_0xab46('0x0'));var util=require(_0xab46('0x1'));var logger=require(_0xab46('0x2'))(_0xab46('0x3'));var moment=require(_0xab46('0x4'));var BPromise=require(_0xab46('0x5'));var rp=require(_0xab46('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab46('0x7'));var attributes=require(_0xab46('0x8'));module[_0xab46('0x9')]=function(_0x210ccf,_0x134dfc){return _0x210ccf['define']('Team',attributes,{'tableName':_0xab46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d5=['request-promise','path','rimraf','../../config/environment','./team.attributes','Team','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd1d5,0x16e));var _0x5d1d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd1d5[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x5d1d('0x0'));var util=require(_0x5d1d('0x1'));var logger=require(_0x5d1d('0x2'))(_0x5d1d('0x3'));var moment=require(_0x5d1d('0x4'));var BPromise=require(_0x5d1d('0x5'));var rp=require(_0x5d1d('0x6'));var fs=require('fs');var path=require(_0x5d1d('0x7'));var rimraf=require(_0x5d1d('0x8'));var config=require(_0x5d1d('0x9'));var attributes=require(_0x5d1d('0xa'));module['exports']=function(_0x5ca109,_0x1cfa1c){return _0x5ca109['define'](_0x5d1d('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 5d2b04e..b904925 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 _0xcb64=['rpc','../../config/environment','jayson/promise','http','redis','localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xcb64,0x1db));var _0x4cb6=function(_0x5bcfb8,_0x1e5317){_0x5bcfb8=_0x5bcfb8-0x0;var _0x25fd12=_0xcb64[_0x5bcfb8];return _0x25fd12;};'use strict';var _=require(_0x4cb6('0x0'));var util=require('util');var moment=require(_0x4cb6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cb6('0x2'));var db=require(_0x4cb6('0x3'))['db'];var utils=require(_0x4cb6('0x4'));var logger=require('../../config/logger')(_0x4cb6('0x5'));var config=require(_0x4cb6('0x6'));var jayson=require(_0x4cb6('0x7'));var client=jayson['client'][_0x4cb6('0x8')]({'port':0x232a});config[_0x4cb6('0x9')]=_['defaults'](config['redis'],{'host':_0x4cb6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4cb6('0x9')]));require(_0x4cb6('0xb'))['register'](socket);function respondWithRpcPromise(_0x6f9c87,_0x2cb5ff,_0x4ac35e){return new BPromise(function(_0x4d2a5f,_0x179e54){return client[_0x4cb6('0xc')](_0x6f9c87,_0x4ac35e)[_0x4cb6('0xd')](function(_0x4d33b2){logger[_0x4cb6('0xe')](_0x4cb6('0xf'),_0x2cb5ff,_0x4cb6('0x10'));logger[_0x4cb6('0x11')](_0x4cb6('0x12'),_0x2cb5ff,_0x4cb6('0x10'),JSON['stringify'](_0x4d33b2));if(_0x4d33b2[_0x4cb6('0x13')]){if(_0x4d33b2[_0x4cb6('0x13')][_0x4cb6('0x14')]===0x1f4){logger[_0x4cb6('0x13')](_0x4cb6('0xf'),_0x2cb5ff,_0x4d33b2[_0x4cb6('0x13')][_0x4cb6('0x15')]);return _0x179e54(_0x4d33b2[_0x4cb6('0x13')][_0x4cb6('0x15')]);}logger[_0x4cb6('0x13')](_0x4cb6('0xf'),_0x2cb5ff,_0x4d33b2[_0x4cb6('0x13')][_0x4cb6('0x15')]);return _0x4d2a5f(_0x4d33b2[_0x4cb6('0x13')][_0x4cb6('0x15')]);}else{logger[_0x4cb6('0xe')]('Team,\x20%s,\x20%s',_0x2cb5ff,_0x4cb6('0x10'));_0x4d2a5f(_0x4d33b2[_0x4cb6('0x16')][_0x4cb6('0x15')]);}})[_0x4cb6('0x17')](function(_0x2b6de6){logger['error'](_0x4cb6('0xf'),_0x2cb5ff,_0x2b6de6);_0x179e54(_0x2b6de6);});});} \ No newline at end of file +var _0x75f8=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0x75f8,0xfc));var _0x875f=function(_0xe5b3e1,_0x57a645){_0xe5b3e1=_0xe5b3e1-0x0;var _0x121dad=_0x75f8[_0xe5b3e1];return _0x121dad;};'use strict';var _=require(_0x875f('0x0'));var util=require(_0x875f('0x1'));var moment=require(_0x875f('0x2'));var BPromise=require(_0x875f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x875f('0x4'))['db'];var utils=require(_0x875f('0x5'));var logger=require(_0x875f('0x6'))(_0x875f('0x7'));var config=require(_0x875f('0x8'));var jayson=require(_0x875f('0x9'));var client=jayson[_0x875f('0xa')][_0x875f('0xb')]({'port':0x232a});config[_0x875f('0xc')]=_[_0x875f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x875f('0xe'))(new Redis(config[_0x875f('0xc')]));require(_0x875f('0xf'))[_0x875f('0x10')](socket);function respondWithRpcPromise(_0x74a400,_0x3a7cfd,_0x44a4cf){return new BPromise(function(_0x4965ea,_0x466068){return client[_0x875f('0x11')](_0x74a400,_0x44a4cf)[_0x875f('0x12')](function(_0x4ae6da){logger[_0x875f('0x13')](_0x875f('0x14'),_0x3a7cfd,_0x875f('0x15'));logger[_0x875f('0x16')](_0x875f('0x17'),_0x3a7cfd,'request\x20sent',JSON[_0x875f('0x18')](_0x4ae6da));if(_0x4ae6da[_0x875f('0x19')]){if(_0x4ae6da[_0x875f('0x19')][_0x875f('0x1a')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x3a7cfd,_0x4ae6da['error']['message']);return _0x466068(_0x4ae6da[_0x875f('0x19')][_0x875f('0x1b')]);}logger[_0x875f('0x19')](_0x875f('0x14'),_0x3a7cfd,_0x4ae6da['error']['message']);return _0x4965ea(_0x4ae6da[_0x875f('0x19')]['message']);}else{logger[_0x875f('0x13')](_0x875f('0x14'),_0x3a7cfd,_0x875f('0x15'));_0x4965ea(_0x4ae6da[_0x875f('0x1c')][_0x875f('0x1b')]);}})['catch'](function(_0x3715b7){logger[_0x875f('0x19')](_0x875f('0x14'),_0x3a7cfd,_0x3715b7);_0x466068(_0x3715b7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9fb61b5..faf255b 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 _0xe2cf=['removeListener','register','length','team:','save','update','emit'];(function(_0x496e52,_0x316090){var _0x542f98=function(_0x2c3037){while(--_0x2c3037){_0x496e52['push'](_0x496e52['shift']());}};_0x542f98(++_0x316090);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x19fa2e,_0x15755b){_0x19fa2e=_0x19fa2e-0x0;var _0x2118ec=_0xe2cf[_0x19fa2e];return _0x2118ec;};'use strict';var TeamEvents=require('./team.events');var events=[_0xfe2c('0x0'),'remove',_0xfe2c('0x1')];function createListener(_0x5a6259,_0xa644a2){return function(_0x1f39d3){_0xa644a2[_0xfe2c('0x2')](_0x5a6259,_0x1f39d3);};}function removeListener(_0x11b6b8,_0x494978){return function(){TeamEvents[_0xfe2c('0x3')](_0x11b6b8,_0x494978);};}exports[_0xfe2c('0x4')]=function(_0x55bb12){for(var _0x4fa079=0x0,_0x4e0b97=events[_0xfe2c('0x5')];_0x4fa079<_0x4e0b97;_0x4fa079++){var _0x5e5b46=events[_0x4fa079];var _0x485a24=createListener(_0xfe2c('0x6')+_0x5e5b46,_0x55bb12);TeamEvents['on'](_0x5e5b46,_0x485a24);}}; \ No newline at end of file +var _0xcfd1=['./team.events','save','remove','update','emit','register','length','team:'];(function(_0x341c7d,_0x4ca460){var _0x5ab893=function(_0x364b68){while(--_0x364b68){_0x341c7d['push'](_0x341c7d['shift']());}};_0x5ab893(++_0x4ca460);}(_0xcfd1,0x1b8));var _0x1cfd=function(_0x13cdda,_0x4a0cd1){_0x13cdda=_0x13cdda-0x0;var _0x324b40=_0xcfd1[_0x13cdda];return _0x324b40;};'use strict';var TeamEvents=require(_0x1cfd('0x0'));var events=[_0x1cfd('0x1'),_0x1cfd('0x2'),_0x1cfd('0x3')];function createListener(_0x4e60dd,_0x10bd1b){return function(_0xa03e47){_0x10bd1b[_0x1cfd('0x4')](_0x4e60dd,_0xa03e47);};}function removeListener(_0x5e074b,_0x4f182d){return function(){TeamEvents['removeListener'](_0x5e074b,_0x4f182d);};}exports[_0x1cfd('0x5')]=function(_0x512b92){for(var _0x262146=0x0,_0x1a95c3=events[_0x1cfd('0x6')];_0x262146<_0x1a95c3;_0x262146++){var _0x4f6534=events[_0x262146];var _0x32f89f=createListener(_0x1cfd('0x7')+_0x4f6534,_0x512b92);TeamEvents['on'](_0x4f6534,_0x32f89f);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6396d00..dc85dfa 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 _0xd2ea=['sequelize','exports','INTEGER'];(function(_0x364a8a,_0x441c48){var _0x34f51d=function(_0x1fded9){while(--_0x1fded9){_0x364a8a['push'](_0x364a8a['shift']());}};_0x34f51d(++_0x441c48);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1cb20a,_0x2c9d9e){_0x1cb20a=_0x1cb20a-0x0;var _0xe69e23=_0xd2ea[_0x1cb20a];return _0xe69e23;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'TeamId':{'type':Sequelize[_0xad2e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file +var _0x403a=['sequelize','INTEGER'];(function(_0x3fc5d8,_0x3eb153){var _0x25307a=function(_0x45ccda){while(--_0x45ccda){_0x3fc5d8['push'](_0x3fc5d8['shift']());}};_0x25307a(++_0x3eb153);}(_0x403a,0x19e));var _0xa403=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x403a[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0xa403('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xa403('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 01c5d81..8886fad 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 _0xaa1b=['exports','define','team_has_voice_prefixes','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x14d76f,_0x5afeb1){var _0x1e9f73=function(_0x382ccd){while(--_0x382ccd){_0x14d76f['push'](_0x14d76f['shift']());}};_0x1e9f73(++_0x5afeb1);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var logger=require(_0xbaa1('0x2'))('api');var moment=require(_0xbaa1('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaa1('0x4'));var fs=require('fs');var path=require(_0xbaa1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xbaa1('0x6')]=function(_0x27b99c,_0x4a5735){return _0x27b99c[_0xbaa1('0x7')]('TeamVoicePrefix',attributes,{'tableName':_0xbaa1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb84e=['TeamVoicePrefix','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x44b828,_0x2a3e8e){var _0x1ad671=function(_0x3ccda3){while(--_0x3ccda3){_0x44b828['push'](_0x44b828['shift']());}};_0x1ad671(++_0x2a3e8e);}(_0xb84e,0xbf));var _0xeb84=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xb84e[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require(_0xeb84('0x0'));var logger=require(_0xeb84('0x1'))(_0xeb84('0x2'));var moment=require(_0xeb84('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb84('0x4'));var rimraf=require(_0xeb84('0x5'));var config=require(_0xeb84('0x6'));var attributes=require(_0xeb84('0x7'));module[_0xeb84('0x8')]=function(_0x3c25e2,_0x5f27c1){return _0x3c25e2['define'](_0xeb84('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index b5ad46b..a23155c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x45e8fd,_0x4614eb){var _0x2e3815=function(_0x1ecce7){while(--_0x1ecce7){_0x45e8fd['push'](_0x45e8fd['shift']());}};_0x2e3815(++_0x4614eb);}(_0xe706,0xa3));var _0x6e70=function(_0x12314f,_0x2ac7ae){_0x12314f=_0x12314f-0x0;var _0x3b6e61=_0xe706[_0x12314f];return _0x3b6e61;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xe99039,_0x3a81b7){var _0x208763=function(_0x4abb6c){while(--_0x4abb6c){_0xe99039['push'](_0xe99039['shift']());}};_0x208763(++_0x3a81b7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xcb91[_0x31a938];return _0x1bf341;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 3798c02..6f51b0c 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 _0xeefd=['exports','sequelize'];(function(_0x2fd22c,_0x5f1f42){var _0x5c8af6=function(_0x55cd39){while(--_0x55cd39){_0x2fd22c['push'](_0x2fd22c['shift']());}};_0x5c8af6(++_0x5f1f42);}(_0xeefd,0xeb));var _0xdeef=function(_0x1e00a1,_0x1a208f){_0x1e00a1=_0x1e00a1-0x0;var _0x1d0c12=_0xeefd[_0x1e00a1];return _0x1d0c12;};'use strict';var Sequelize=require(_0xdeef('0x0'));module[_0xdeef('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x179b=['exports','INTEGER','sequelize'];(function(_0x2145bc,_0x5650a8){var _0x2f72a4=function(_0x3a2f48){while(--_0x3a2f48){_0x2145bc['push'](_0x2145bc['shift']());}};_0x2f72a4(++_0x5650a8);}(_0x179b,0x65));var _0xb179=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x179b[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xb179('0x0'));module[_0xb179('0x1')]={'penalty':{'type':Sequelize[_0xb179('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 40e6177..89ef15d 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 _0xac21=['team_has_voice_queues','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','TeamVoiceQueue'];(function(_0x4efb2a,_0x301338){var _0x18b361=function(_0x539887){while(--_0x539887){_0x4efb2a['push'](_0x4efb2a['shift']());}};_0x18b361(++_0x301338);}(_0xac21,0x1af));var _0x1ac2=function(_0xefaaa2,_0x50712d){_0xefaaa2=_0xefaaa2-0x0;var _0x331ce6=_0xac21[_0xefaaa2];return _0x331ce6;};'use strict';var _=require('lodash');var util=require(_0x1ac2('0x0'));var logger=require(_0x1ac2('0x1'))('api');var moment=require(_0x1ac2('0x2'));var BPromise=require('bluebird');var rp=require(_0x1ac2('0x3'));var fs=require('fs');var path=require(_0x1ac2('0x4'));var rimraf=require('rimraf');var config=require(_0x1ac2('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0x1ac2('0x6')]=function(_0x21a183,_0x2c4cf2){return _0x21a183[_0x1ac2('0x7')](_0x1ac2('0x8'),attributes,{'tableName':_0x1ac2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4d1=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./teamVoiceQueue.attributes','define'];(function(_0x1e7a05,_0x5e09b4){var _0x5347db=function(_0x2d5dc6){while(--_0x2d5dc6){_0x1e7a05['push'](_0x1e7a05['shift']());}};_0x5347db(++_0x5e09b4);}(_0xd4d1,0x123));var _0x1d4d=function(_0x1f0e04,_0x59281a){_0x1f0e04=_0x1f0e04-0x0;var _0x477956=_0xd4d1[_0x1f0e04];return _0x477956;};'use strict';var _=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var logger=require(_0x1d4d('0x2'))(_0x1d4d('0x3'));var moment=require(_0x1d4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d4d('0x7'));module['exports']=function(_0x2bc295,_0x184978){return _0x2bc295[_0x1d4d('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0x1d4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 1eecf5f..4dddb9f 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 _0x9b69=['request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x9b69,0x196));var _0x99b6=function(_0x35ecc9,_0x22d5b4){_0x35ecc9=_0x35ecc9-0x0;var _0x53d5fc=_0x9b69[_0x35ecc9];return _0x53d5fc;};'use strict';var _=require(_0x99b6('0x0'));var util=require('util');var moment=require(_0x99b6('0x1'));var BPromise=require(_0x99b6('0x2'));var rs=require(_0x99b6('0x3'));var fs=require('fs');var Redis=require(_0x99b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99b6('0x5'));var logger=require('../../config/logger')(_0x99b6('0x6'));var config=require(_0x99b6('0x7'));var jayson=require(_0x99b6('0x8'));var client=jayson[_0x99b6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55a5ad,_0x5d0ca6,_0x49d176){return new BPromise(function(_0x38c76a,_0x2d14a8){return client[_0x99b6('0xa')](_0x55a5ad,_0x49d176)[_0x99b6('0xb')](function(_0xaf4c11){logger[_0x99b6('0xc')](_0x99b6('0xd'),_0x5d0ca6,_0x99b6('0xe'));logger['debug'](_0x99b6('0xf'),_0x5d0ca6,'request\x20sent',JSON['stringify'](_0xaf4c11));if(_0xaf4c11[_0x99b6('0x10')]){if(_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x11')]===0x1f4){logger[_0x99b6('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5d0ca6,_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x12')]);return _0x2d14a8(_0xaf4c11['error']['message']);}logger['error'](_0x99b6('0xd'),_0x5d0ca6,_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x12')]);return _0x38c76a(_0xaf4c11['error']['message']);}else{logger[_0x99b6('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5d0ca6,_0x99b6('0xe'));_0x38c76a(_0xaf4c11[_0x99b6('0x13')][_0x99b6('0x12')]);}})[_0x99b6('0x14')](function(_0x389ded){logger[_0x99b6('0x10')](_0x99b6('0xd'),_0x5d0ca6,_0x389ded);_0x2d14a8(_0x389ded);});});} \ No newline at end of file +var _0xd4b6=['util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x12ed52,_0x4e5e22){var _0x2bb2be=function(_0x1db204){while(--_0x1db204){_0x12ed52['push'](_0x12ed52['shift']());}};_0x2bb2be(++_0x4e5e22);}(_0xd4b6,0x13f));var _0x6d4b=function(_0xab1547,_0x55601d){_0xab1547=_0xab1547-0x0;var _0x3eb95f=_0xd4b6[_0xab1547];return _0x3eb95f;};'use strict';var _=require(_0x6d4b('0x0'));var util=require(_0x6d4b('0x1'));var moment=require('moment');var BPromise=require(_0x6d4b('0x2'));var rs=require(_0x6d4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d4b('0x5'));var jayson=require(_0x6d4b('0x6'));var client=jayson[_0x6d4b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f52a,_0x42a52a,_0x424690){return new BPromise(function(_0x262eed,_0x4dcf3d){return client[_0x6d4b('0x8')](_0x20f52a,_0x424690)[_0x6d4b('0x9')](function(_0xb2567b){logger[_0x6d4b('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x42a52a,_0x6d4b('0xb'));logger[_0x6d4b('0xc')](_0x6d4b('0xd'),_0x42a52a,_0x6d4b('0xb'),JSON[_0x6d4b('0xe')](_0xb2567b));if(_0xb2567b[_0x6d4b('0xf')]){if(_0xb2567b[_0x6d4b('0xf')]['code']===0x1f4){logger[_0x6d4b('0xf')](_0x6d4b('0x10'),_0x42a52a,_0xb2567b[_0x6d4b('0xf')]['message']);return _0x4dcf3d(_0xb2567b[_0x6d4b('0xf')][_0x6d4b('0x11')]);}logger[_0x6d4b('0xf')](_0x6d4b('0x10'),_0x42a52a,_0xb2567b[_0x6d4b('0xf')][_0x6d4b('0x11')]);return _0x262eed(_0xb2567b[_0x6d4b('0xf')][_0x6d4b('0x11')]);}else{logger[_0x6d4b('0xa')](_0x6d4b('0x10'),_0x42a52a,'request\x20sent');_0x262eed(_0xb2567b[_0x6d4b('0x12')]['message']);}})[_0x6d4b('0x13')](function(_0x428b75){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x42a52a,_0x428b75);_0x4dcf3d(_0x428b75);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 780c6f9..9f0cb29 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 _0x78f4=['isAuthenticated','index','/:id','post','create','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x17e4ac,_0x315ed6){var _0x7a9a6a=function(_0x5ec68f){while(--_0x5ec68f){_0x17e4ac['push'](_0x17e4ac['shift']());}};_0x7a9a6a(++_0x315ed6);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x478f('0x0'));var path=require(_0x478f('0x1'));var timeout=require(_0x478f('0x2'));var express=require(_0x478f('0x3'));var router=express['Router']();var fs_extra=require(_0x478f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x478f('0x5'));var config=require(_0x478f('0x6'));var controller=require(_0x478f('0x7'));router['get']('/',auth[_0x478f('0x8')](),controller[_0x478f('0x9')]);router['get'](_0x478f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x478f('0xb')]('/',auth['isAuthenticated'](),controller[_0x478f('0xc')]);router[_0x478f('0xd')](_0x478f('0xa'),auth[_0x478f('0x8')](),controller['update']);router['delete'](_0x478f('0xa'),auth[_0x478f('0x8')](),controller[_0x478f('0xe')]);module[_0x478f('0xf')]=router; \ No newline at end of file +var _0x7e27=['post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','get','/:id','show'];(function(_0x226b97,_0x200b04){var _0x336bae=function(_0x5bac35){while(--_0x5bac35){_0x226b97['push'](_0x226b97['shift']());}};_0x336bae(++_0x200b04);}(_0x7e27,0xdd));var _0x77e2=function(_0x44d0af,_0x2416d6){_0x44d0af=_0x44d0af-0x0;var _0x1db5ff=_0x7e27[_0x44d0af];return _0x1db5ff;};'use strict';var multer=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var path=require('path');var timeout=require(_0x77e2('0x2'));var express=require(_0x77e2('0x3'));var router=express[_0x77e2('0x4')]();var fs_extra=require(_0x77e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77e2('0x6'));var config=require(_0x77e2('0x7'));var controller=require(_0x77e2('0x8'));router['get']('/',auth[_0x77e2('0x9')](),controller['index']);router[_0x77e2('0xa')](_0x77e2('0xb'),auth['isAuthenticated'](),controller[_0x77e2('0xc')]);router[_0x77e2('0xd')]('/',auth[_0x77e2('0x9')](),controller[_0x77e2('0xe')]);router[_0x77e2('0xf')](_0x77e2('0xb'),auth[_0x77e2('0x9')](),controller['update']);router['delete'](_0x77e2('0xb'),auth['isAuthenticated'](),controller[_0x77e2('0x10')]);module[_0x77e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 193da7d..0d61e25 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 _0xb58e=['STRING','TEXT','exports'];(function(_0x340479,_0x20167c){var _0x3875f9=function(_0x4ec78e){while(--_0x4ec78e){_0x340479['push'](_0x340479['shift']());}};_0x3875f9(++_0x20167c);}(_0xb58e,0x1df));var _0xeb58=function(_0xe373d,_0x284ccd){_0xe373d=_0xe373d-0x0;var _0x575f02=_0xb58e[_0xe373d];return _0x575f02;};'use strict';var Sequelize=require('sequelize');module[_0xeb58('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb58('0x1')]},'html':{'type':Sequelize[_0xeb58('0x2')]}}; \ No newline at end of file +var _0x860f=['STRING','TEXT','sequelize','exports'];(function(_0x21e2e2,_0x38c92f){var _0x38461e=function(_0x3250db){while(--_0x3250db){_0x21e2e2['push'](_0x21e2e2['shift']());}};_0x38461e(++_0x38c92f);}(_0x860f,0x1de));var _0xf860=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x860f[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0xf860('0x0'));module[_0xf860('0x1')]={'name':{'type':Sequelize[_0xf860('0x2')]},'description':{'type':Sequelize[_0xf860('0x2')]},'html':{'type':Sequelize[_0xf860('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 037f8c2..5a8f720 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 _0xc29f=['update','then','destroy','Templates','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','fields','include','find','catch','create','get','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0xf2d1bf,_0x19c53a){var _0x388d2c=function(_0x217e55){while(--_0x217e55){_0xf2d1bf['push'](_0xf2d1bf['shift']());}};_0x388d2c(++_0x19c53a);}(_0xc29f,0xcd));var _0xfc29=function(_0x140a31,_0x5aeb80){_0x140a31=_0x140a31-0x0;var _0x426b30=_0xc29f[_0x140a31];return _0x426b30;};'use strict';var emlformat=require(_0xfc29('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc29('0x1'));var moment=require('moment');var BPromise=require(_0xfc29('0x2'));var Mustache=require(_0xfc29('0x3'));var util=require('util');var path=require(_0xfc29('0x4'));var sox=require(_0xfc29('0x5'));var csv=require(_0xfc29('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc29('0x7'));var _=require(_0xfc29('0x8'));var squel=require(_0xfc29('0x9'));var crypto=require(_0xfc29('0xa'));var jsforce=require(_0xfc29('0xb'));var deskjs=require(_0xfc29('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfc29('0xd'));var Papa=require(_0xfc29('0xe'));var Redis=require('ioredis');var authService=require(_0xfc29('0xf'));var qs=require(_0xfc29('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc29('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xfc29('0x12'));var config=require(_0xfc29('0x13'));var licenseUtil=require(_0xfc29('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b9398,_0x55c270){_0x55c270=_0x55c270||0xcc;return function(_0x39754a){if(_0x39754a){return _0x1b9398[_0xfc29('0x15')](_0x55c270);}return _0x1b9398[_0xfc29('0x16')](_0x55c270)['end']();};}function respondWithResult(_0x468bec,_0xa5ed7b){_0xa5ed7b=_0xa5ed7b||0xc8;return function(_0x54bb18){if(_0x54bb18){return _0x468bec[_0xfc29('0x16')](_0xa5ed7b)[_0xfc29('0x17')](_0x54bb18);}};}function respondWithFilteredResult(_0x133179,_0x385715){return function(_0x49130f){if(_0x49130f){var _0x32e78e=typeof _0x385715[_0xfc29('0x18')]===_0xfc29('0x19')&&typeof _0x385715[_0xfc29('0x1a')]==='undefined';var _0x251d28=_0x49130f['count'];var _0x5835cc=_0x32e78e?0x0:_0x385715[_0xfc29('0x18')];var _0x347afd=_0x32e78e?_0x49130f[_0xfc29('0x1b')]:_0x385715['offset']+_0x385715[_0xfc29('0x1a')];var _0x49e24c;if(_0x347afd>=_0x251d28){_0x347afd=_0x251d28;_0x49e24c=0xc8;}else{_0x49e24c=0xce;}_0x133179['status'](_0x49e24c);return _0x133179[_0xfc29('0x1c')](_0xfc29('0x1d'),_0x5835cc+'-'+_0x347afd+'/'+_0x251d28)[_0xfc29('0x17')](_0x49130f);}return null;};}function patchUpdates(_0x10d344){return function(_0x1d253f){try{jsonpatch[_0xfc29('0x1e')](_0x1d253f,_0x10d344,!![]);}catch(_0x2f31ef){return BPromise['reject'](_0x2f31ef);}return _0x1d253f[_0xfc29('0x1f')]();};}function saveUpdates(_0xcfb0cf,_0xc740e8){return function(_0x1d9815){if(_0x1d9815){return _0x1d9815[_0xfc29('0x20')](_0xcfb0cf)[_0xfc29('0x21')](function(_0x3962bf){return _0x3962bf;});}return null;};}function removeEntity(_0x5bb7de,_0x2f115f){return function(_0x1b8875){if(_0x1b8875){return _0x1b8875[_0xfc29('0x22')]()[_0xfc29('0x21')](function(){var _0x4295be=_0x1b8875['get']({'plain':!![]});var _0x22242c=_0xfc29('0x23');return db['UserProfileResource'][_0xfc29('0x22')]({'where':{'type':_0x22242c,'resourceId':_0x4295be['id']}})[_0xfc29('0x21')](function(){return _0x1b8875;});})[_0xfc29('0x21')](function(){_0x5bb7de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a749,_0xceddb){return function(_0x1b90ab){if(!_0x1b90ab){_0x15a749[_0xfc29('0x15')](0x194);}return _0x1b90ab;};}function handleError(_0x2686f3,_0x1876a8){_0x1876a8=_0x1876a8||0x1f4;return function(_0x3127f6){logger[_0xfc29('0x24')](_0x3127f6[_0xfc29('0x25')]);if(_0x3127f6[_0xfc29('0x26')]){delete _0x3127f6[_0xfc29('0x26')];}_0x2686f3[_0xfc29('0x16')](_0x1876a8)[_0xfc29('0x27')](_0x3127f6);};}exports['index']=function(_0x35915d,_0x14e480){var _0x464748={},_0x1db66a={},_0x56209e={'count':0x0,'rows':[]};var _0x309f07=_[_0xfc29('0x28')](db[_0xfc29('0x29')][_0xfc29('0x2a')],function(_0x1aa0a6){return{'name':_0x1aa0a6[_0xfc29('0x2b')],'type':_0x1aa0a6[_0xfc29('0x2c')][_0xfc29('0x2d')]};});_0x1db66a['model']=_[_0xfc29('0x28')](_0x309f07,_0xfc29('0x26'));_0x1db66a[_0xfc29('0x2e')]=_[_0xfc29('0x2f')](_0x35915d['query']);_0x1db66a[_0xfc29('0x30')]=_[_0xfc29('0x31')](_0x1db66a[_0xfc29('0x32')],_0x1db66a[_0xfc29('0x2e')]);_0x464748[_0xfc29('0x33')]=_[_0xfc29('0x31')](_0x1db66a[_0xfc29('0x32')],qs['fields'](_0x35915d[_0xfc29('0x2e')]['fields']));_0x464748[_0xfc29('0x33')]=_0x464748[_0xfc29('0x33')][_0xfc29('0x34')]?_0x464748[_0xfc29('0x33')]:_0x1db66a[_0xfc29('0x32')];if(!_0x35915d[_0xfc29('0x2e')][_0xfc29('0x35')](_0xfc29('0x36'))){_0x464748['limit']=qs[_0xfc29('0x1a')](_0x35915d[_0xfc29('0x2e')][_0xfc29('0x1a')]);_0x464748['offset']=qs[_0xfc29('0x18')](_0x35915d[_0xfc29('0x2e')][_0xfc29('0x18')]);}_0x464748[_0xfc29('0x37')]=qs[_0xfc29('0x38')](_0x35915d['query'][_0xfc29('0x38')]);_0x464748[_0xfc29('0x39')]=qs[_0xfc29('0x30')](_['pick'](_0x35915d[_0xfc29('0x2e')],_0x1db66a[_0xfc29('0x30')]),_0x309f07);if(_0x35915d['query'][_0xfc29('0x3a')]){_0x464748[_0xfc29('0x39')]=_[_0xfc29('0x3b')](_0x464748['where'],{'$or':_[_0xfc29('0x28')](_0x309f07,function(_0x4cbd96){if(_0x4cbd96[_0xfc29('0x2c')]!==_0xfc29('0x3c')){var _0x367d2f={};_0x367d2f[_0x4cbd96[_0xfc29('0x26')]]={'$like':'%'+_0x35915d['query'][_0xfc29('0x3a')]+'%'};return _0x367d2f;}})});}_0x464748=_[_0xfc29('0x3b')]({},_0x464748,_0x35915d[_0xfc29('0x3d')]);var _0x12cf71={'where':_0x464748[_0xfc29('0x39')]};return db[_0xfc29('0x29')][_0xfc29('0x1b')](_0x12cf71)[_0xfc29('0x21')](function(_0x122f65){_0x56209e[_0xfc29('0x1b')]=_0x122f65;if(_0x35915d[_0xfc29('0x2e')][_0xfc29('0x3e')]){_0x464748['include']=[{'all':!![]}];}return db['Template'][_0xfc29('0x3f')](_0x464748);})['then'](function(_0x2a9ebc){_0x56209e['rows']=_0x2a9ebc;return _0x56209e;})[_0xfc29('0x21')](respondWithFilteredResult(_0x14e480,_0x464748))['catch'](handleError(_0x14e480,null));};exports[_0xfc29('0x40')]=function(_0x4bce4d,_0x43c77a){var _0x4c3556={'raw':!![],'where':{'id':_0x4bce4d['params']['id']}},_0x3c366f={};_0x3c366f['model']=_[_0xfc29('0x2f')](db[_0xfc29('0x29')][_0xfc29('0x2a')]);_0x3c366f[_0xfc29('0x2e')]=_[_0xfc29('0x2f')](_0x4bce4d[_0xfc29('0x2e')]);_0x3c366f[_0xfc29('0x30')]=_[_0xfc29('0x31')](_0x3c366f[_0xfc29('0x32')],_0x3c366f[_0xfc29('0x2e')]);_0x4c3556[_0xfc29('0x33')]=_['intersection'](_0x3c366f['model'],qs[_0xfc29('0x41')](_0x4bce4d['query'][_0xfc29('0x41')]));_0x4c3556[_0xfc29('0x33')]=_0x4c3556[_0xfc29('0x33')][_0xfc29('0x34')]?_0x4c3556[_0xfc29('0x33')]:_0x3c366f['model'];if(_0x4bce4d['query'][_0xfc29('0x3e')]){_0x4c3556[_0xfc29('0x42')]=[{'all':!![]}];}_0x4c3556=_[_0xfc29('0x3b')]({},_0x4c3556,_0x4bce4d[_0xfc29('0x3d')]);return db[_0xfc29('0x29')][_0xfc29('0x43')](_0x4c3556)[_0xfc29('0x21')](handleEntityNotFound(_0x43c77a,null))[_0xfc29('0x21')](respondWithResult(_0x43c77a,null))[_0xfc29('0x44')](handleError(_0x43c77a,null));};exports['create']=function(_0x3a94ed,_0x59593b){return db[_0xfc29('0x29')][_0xfc29('0x45')](_0x3a94ed['body'],{})[_0xfc29('0x21')](function(_0x5991db){var _0x366cfd=_0x3a94ed['user'][_0xfc29('0x46')]({'plain':!![]});if(!_0x366cfd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x366cfd['role']===_0xfc29('0x47')){var _0x30c495=_0x5991db['get']({'plain':!![]});var _0x205aee=_0xfc29('0x23');return db[_0xfc29('0x48')][_0xfc29('0x43')]({'where':{'name':_0x205aee,'userProfileId':_0x366cfd[_0xfc29('0x49')]},'raw':!![]})[_0xfc29('0x21')](function(_0x366458){if(_0x366458&&_0x366458[_0xfc29('0x4a')]===0x0){return db[_0xfc29('0x4b')][_0xfc29('0x45')]({'name':_0x30c495[_0xfc29('0x26')],'resourceId':_0x30c495['id'],'type':_0x366458[_0xfc29('0x26')],'sectionId':_0x366458['id']},{})[_0xfc29('0x21')](function(){return _0x5991db;});}else{return _0x5991db;}})[_0xfc29('0x44')](function(_0xe92f75){logger['error'](_0xfc29('0x4c'),_0xe92f75);throw _0xe92f75;});}return _0x5991db;})[_0xfc29('0x21')](respondWithResult(_0x59593b,0xc9))[_0xfc29('0x44')](handleError(_0x59593b,null));};exports[_0xfc29('0x20')]=function(_0x88eeae,_0x3e627e){if(_0x88eeae[_0xfc29('0x4d')]['id']){delete _0x88eeae[_0xfc29('0x4d')]['id'];}return db[_0xfc29('0x29')][_0xfc29('0x43')]({'where':{'id':_0x88eeae[_0xfc29('0x4e')]['id']}})[_0xfc29('0x21')](handleEntityNotFound(_0x3e627e,null))['then'](saveUpdates(_0x88eeae[_0xfc29('0x4d')],null))[_0xfc29('0x21')](respondWithResult(_0x3e627e,null))[_0xfc29('0x44')](handleError(_0x3e627e,null));};exports[_0xfc29('0x22')]=function(_0xe7825e,_0x448706){return db[_0xfc29('0x29')][_0xfc29('0x43')]({'where':{'id':_0xe7825e[_0xfc29('0x4e')]['id']}})[_0xfc29('0x21')](handleEntityNotFound(_0x448706,null))[_0xfc29('0x21')](removeEntity(_0x448706,null))[_0xfc29('0x44')](handleError(_0x448706,null));}; \ No newline at end of file +var _0xdd79=['zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','get','Templates','error','stack','name','send','Template','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','filter','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','length','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','body','params','eml-format','rimraf'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xdd79,0x198));var _0x9dd7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd79[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9dd7('0x0'));var rimraf=require(_0x9dd7('0x1'));var zipdir=require(_0x9dd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9dd7('0x3'));var moment=require(_0x9dd7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9dd7('0x5'));var util=require(_0x9dd7('0x6'));var path=require(_0x9dd7('0x7'));var sox=require(_0x9dd7('0x8'));var csv=require(_0x9dd7('0x9'));var ejs=require(_0x9dd7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9dd7('0xb'));var squel=require(_0x9dd7('0xc'));var crypto=require(_0x9dd7('0xd'));var jsforce=require(_0x9dd7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9dd7('0x9'));var querystring=require(_0x9dd7('0xf'));var Papa=require(_0x9dd7('0x10'));var Redis=require(_0x9dd7('0x11'));var authService=require(_0x9dd7('0x12'));var qs=require(_0x9dd7('0x13'));var as=require(_0x9dd7('0x14'));var hardwareService=require(_0x9dd7('0x15'));var logger=require(_0x9dd7('0x16'))(_0x9dd7('0x17'));var utils=require(_0x9dd7('0x18'));var config=require(_0x9dd7('0x19'));var licenseUtil=require(_0x9dd7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425e6d,_0x166eca){_0x166eca=_0x166eca||0xcc;return function(_0x1d4304){if(_0x1d4304){return _0x425e6d[_0x9dd7('0x1b')](_0x166eca);}return _0x425e6d[_0x9dd7('0x1c')](_0x166eca)[_0x9dd7('0x1d')]();};}function respondWithResult(_0x43e5fa,_0x1ef4ac){_0x1ef4ac=_0x1ef4ac||0xc8;return function(_0x5f2110){if(_0x5f2110){return _0x43e5fa[_0x9dd7('0x1c')](_0x1ef4ac)['json'](_0x5f2110);}};}function respondWithFilteredResult(_0x162032,_0x2764b2){return function(_0x3ce86c){if(_0x3ce86c){var _0x2495ba=typeof _0x2764b2[_0x9dd7('0x1e')]===_0x9dd7('0x1f')&&typeof _0x2764b2['limit']===_0x9dd7('0x1f');var _0x1ed32c=_0x3ce86c['count'];var _0x1c33b2=_0x2495ba?0x0:_0x2764b2[_0x9dd7('0x1e')];var _0x17d44f=_0x2495ba?_0x3ce86c[_0x9dd7('0x20')]:_0x2764b2[_0x9dd7('0x1e')]+_0x2764b2['limit'];var _0x3dd91a;if(_0x17d44f>=_0x1ed32c){_0x17d44f=_0x1ed32c;_0x3dd91a=0xc8;}else{_0x3dd91a=0xce;}_0x162032[_0x9dd7('0x1c')](_0x3dd91a);return _0x162032[_0x9dd7('0x21')](_0x9dd7('0x22'),_0x1c33b2+'-'+_0x17d44f+'/'+_0x1ed32c)[_0x9dd7('0x23')](_0x3ce86c);}return null;};}function patchUpdates(_0xfa6fd){return function(_0x5d6430){try{jsonpatch[_0x9dd7('0x24')](_0x5d6430,_0xfa6fd,!![]);}catch(_0x25138a){return BPromise['reject'](_0x25138a);}return _0x5d6430[_0x9dd7('0x25')]();};}function saveUpdates(_0x5c2572,_0x552d82){return function(_0x36302a){if(_0x36302a){return _0x36302a[_0x9dd7('0x26')](_0x5c2572)[_0x9dd7('0x27')](function(_0x3d1d67){return _0x3d1d67;});}return null;};}function removeEntity(_0x30b7ed,_0x3edbd5){return function(_0x106d97){if(_0x106d97){return _0x106d97[_0x9dd7('0x28')]()[_0x9dd7('0x27')](function(){var _0x609a7f=_0x106d97[_0x9dd7('0x29')]({'plain':!![]});var _0x5e0830=_0x9dd7('0x2a');return db['UserProfileResource'][_0x9dd7('0x28')]({'where':{'type':_0x5e0830,'resourceId':_0x609a7f['id']}})[_0x9dd7('0x27')](function(){return _0x106d97;});})[_0x9dd7('0x27')](function(){_0x30b7ed[_0x9dd7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497385,_0x4bf4e3){return function(_0x4cba80){if(!_0x4cba80){_0x497385[_0x9dd7('0x1b')](0x194);}return _0x4cba80;};}function handleError(_0x3a212f,_0x2c37f6){_0x2c37f6=_0x2c37f6||0x1f4;return function(_0xddeecd){logger[_0x9dd7('0x2b')](_0xddeecd[_0x9dd7('0x2c')]);if(_0xddeecd[_0x9dd7('0x2d')]){delete _0xddeecd[_0x9dd7('0x2d')];}_0x3a212f[_0x9dd7('0x1c')](_0x2c37f6)[_0x9dd7('0x2e')](_0xddeecd);};}exports['index']=function(_0x232e8a,_0x22638d){var _0x49cf5b={},_0x3a30e4={},_0x37f778={'count':0x0,'rows':[]};var _0x558b91=_['map'](db[_0x9dd7('0x2f')][_0x9dd7('0x30')],function(_0x3bc7bd){return{'name':_0x3bc7bd[_0x9dd7('0x31')],'type':_0x3bc7bd['type'][_0x9dd7('0x32')]};});_0x3a30e4[_0x9dd7('0x33')]=_[_0x9dd7('0x34')](_0x558b91,_0x9dd7('0x2d'));_0x3a30e4[_0x9dd7('0x35')]=_['keys'](_0x232e8a[_0x9dd7('0x35')]);_0x3a30e4[_0x9dd7('0x36')]=_[_0x9dd7('0x37')](_0x3a30e4[_0x9dd7('0x33')],_0x3a30e4['query']);_0x49cf5b[_0x9dd7('0x38')]=_['intersection'](_0x3a30e4[_0x9dd7('0x33')],qs[_0x9dd7('0x39')](_0x232e8a[_0x9dd7('0x35')][_0x9dd7('0x39')]));_0x49cf5b[_0x9dd7('0x38')]=_0x49cf5b['attributes']['length']?_0x49cf5b[_0x9dd7('0x38')]:_0x3a30e4['model'];if(!_0x232e8a[_0x9dd7('0x35')][_0x9dd7('0x3a')]('nolimit')){_0x49cf5b[_0x9dd7('0x3b')]=qs[_0x9dd7('0x3b')](_0x232e8a['query'][_0x9dd7('0x3b')]);_0x49cf5b[_0x9dd7('0x1e')]=qs['offset'](_0x232e8a['query'][_0x9dd7('0x1e')]);}_0x49cf5b[_0x9dd7('0x3c')]=qs[_0x9dd7('0x3d')](_0x232e8a[_0x9dd7('0x35')][_0x9dd7('0x3d')]);_0x49cf5b['where']=qs[_0x9dd7('0x36')](_['pick'](_0x232e8a[_0x9dd7('0x35')],_0x3a30e4[_0x9dd7('0x36')]),_0x558b91);if(_0x232e8a[_0x9dd7('0x35')][_0x9dd7('0x3e')]){_0x49cf5b[_0x9dd7('0x3f')]=_['merge'](_0x49cf5b[_0x9dd7('0x3f')],{'$or':_[_0x9dd7('0x34')](_0x558b91,function(_0x5202a3){if(_0x5202a3[_0x9dd7('0x40')]!==_0x9dd7('0x41')){var _0x4dae0b={};_0x4dae0b[_0x5202a3[_0x9dd7('0x2d')]]={'$like':'%'+_0x232e8a[_0x9dd7('0x35')][_0x9dd7('0x3e')]+'%'};return _0x4dae0b;}})});}_0x49cf5b=_['merge']({},_0x49cf5b,_0x232e8a[_0x9dd7('0x42')]);var _0x4c03c9={'where':_0x49cf5b[_0x9dd7('0x3f')]};return db[_0x9dd7('0x2f')]['count'](_0x4c03c9)[_0x9dd7('0x27')](function(_0x3f72af){_0x37f778['count']=_0x3f72af;if(_0x232e8a[_0x9dd7('0x35')][_0x9dd7('0x43')]){_0x49cf5b[_0x9dd7('0x44')]=[{'all':!![]}];}return db[_0x9dd7('0x2f')]['findAll'](_0x49cf5b);})[_0x9dd7('0x27')](function(_0x52bb73){_0x37f778[_0x9dd7('0x45')]=_0x52bb73;return _0x37f778;})[_0x9dd7('0x27')](respondWithFilteredResult(_0x22638d,_0x49cf5b))[_0x9dd7('0x46')](handleError(_0x22638d,null));};exports[_0x9dd7('0x47')]=function(_0x241193,_0x5a4583){var _0x41db3a={'raw':!![],'where':{'id':_0x241193['params']['id']}},_0x44f380={};_0x44f380[_0x9dd7('0x33')]=_[_0x9dd7('0x48')](db[_0x9dd7('0x2f')]['rawAttributes']);_0x44f380[_0x9dd7('0x35')]=_['keys'](_0x241193['query']);_0x44f380[_0x9dd7('0x36')]=_[_0x9dd7('0x37')](_0x44f380['model'],_0x44f380[_0x9dd7('0x35')]);_0x41db3a[_0x9dd7('0x38')]=_[_0x9dd7('0x37')](_0x44f380[_0x9dd7('0x33')],qs[_0x9dd7('0x39')](_0x241193[_0x9dd7('0x35')][_0x9dd7('0x39')]));_0x41db3a[_0x9dd7('0x38')]=_0x41db3a['attributes'][_0x9dd7('0x49')]?_0x41db3a['attributes']:_0x44f380[_0x9dd7('0x33')];if(_0x241193[_0x9dd7('0x35')]['includeAll']){_0x41db3a['include']=[{'all':!![]}];}_0x41db3a=_[_0x9dd7('0x4a')]({},_0x41db3a,_0x241193['options']);return db['Template'][_0x9dd7('0x4b')](_0x41db3a)[_0x9dd7('0x27')](handleEntityNotFound(_0x5a4583,null))['then'](respondWithResult(_0x5a4583,null))[_0x9dd7('0x46')](handleError(_0x5a4583,null));};exports[_0x9dd7('0x4c')]=function(_0x1169d4,_0x1d7871){return db[_0x9dd7('0x2f')]['create'](_0x1169d4['body'],{})[_0x9dd7('0x27')](function(_0x542fd0){var _0x2fded4=_0x1169d4['user'][_0x9dd7('0x29')]({'plain':!![]});if(!_0x2fded4)throw new Error(_0x9dd7('0x4d'));if(_0x2fded4['role']==='user'){var _0x40bce7=_0x542fd0['get']({'plain':!![]});var _0x2a3be3=_0x9dd7('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x2a3be3,'userProfileId':_0x2fded4['userProfileId']},'raw':!![]})[_0x9dd7('0x27')](function(_0x3101cf){if(_0x3101cf&&_0x3101cf[_0x9dd7('0x4e')]===0x0){return db[_0x9dd7('0x4f')][_0x9dd7('0x4c')]({'name':_0x40bce7['name'],'resourceId':_0x40bce7['id'],'type':_0x3101cf[_0x9dd7('0x2d')],'sectionId':_0x3101cf['id']},{})[_0x9dd7('0x27')](function(){return _0x542fd0;});}else{return _0x542fd0;}})[_0x9dd7('0x46')](function(_0x49c89b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49c89b);throw _0x49c89b;});}return _0x542fd0;})[_0x9dd7('0x27')](respondWithResult(_0x1d7871,0xc9))[_0x9dd7('0x46')](handleError(_0x1d7871,null));};exports[_0x9dd7('0x26')]=function(_0x2e8311,_0x2018e3){if(_0x2e8311[_0x9dd7('0x50')]['id']){delete _0x2e8311[_0x9dd7('0x50')]['id'];}return db[_0x9dd7('0x2f')][_0x9dd7('0x4b')]({'where':{'id':_0x2e8311[_0x9dd7('0x51')]['id']}})[_0x9dd7('0x27')](handleEntityNotFound(_0x2018e3,null))[_0x9dd7('0x27')](saveUpdates(_0x2e8311['body'],null))[_0x9dd7('0x27')](respondWithResult(_0x2018e3,null))[_0x9dd7('0x46')](handleError(_0x2018e3,null));};exports['destroy']=function(_0x309c01,_0x2d691f){return db[_0x9dd7('0x2f')][_0x9dd7('0x4b')]({'where':{'id':_0x309c01[_0x9dd7('0x51')]['id']}})[_0x9dd7('0x27')](handleEntityNotFound(_0x2d691f,null))[_0x9dd7('0x27')](removeEntity(_0x2d691f,null))[_0x9dd7('0x46')](handleError(_0x2d691f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ea5cd9b..f130851 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 _0x93cd=['path','exports','Template','tools_templates','lodash','util','../../config/logger','moment','bluebird'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x93cd,0xb8));var _0xd93c=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x93cd[_0x2ee790];return _0x5a54a5;};'use strict';var _=require(_0xd93c('0x0'));var util=require(_0xd93c('0x1'));var logger=require(_0xd93c('0x2'))('api');var moment=require(_0xd93c('0x3'));var BPromise=require(_0xd93c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd93c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xd93c('0x6')]=function(_0x1d4f8e,_0x3d9367){return _0x1d4f8e['define'](_0xd93c('0x7'),attributes,{'tableName':_0xd93c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60a7=['rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4af356,_0x298d74){var _0x40566=function(_0x3cd2b2){while(--_0x3cd2b2){_0x4af356['push'](_0x4af356['shift']());}};_0x40566(++_0x298d74);}(_0x60a7,0x18c));var _0x760a=function(_0xff933a,_0x3e4a16){_0xff933a=_0xff933a-0x0;var _0x512090=_0x60a7[_0xff933a];return _0x512090;};'use strict';var _=require(_0x760a('0x0'));var util=require(_0x760a('0x1'));var logger=require(_0x760a('0x2'))(_0x760a('0x3'));var moment=require('moment');var BPromise=require(_0x760a('0x4'));var rp=require(_0x760a('0x5'));var fs=require('fs');var path=require(_0x760a('0x6'));var rimraf=require(_0x760a('0x7'));var config=require(_0x760a('0x8'));var attributes=require(_0x760a('0x9'));module[_0x760a('0xa')]=function(_0x56ca9f,_0x557c80){return _0x56ca9f[_0x760a('0xb')](_0x760a('0xc'),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 3ec8398..17e55aa 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 _0x1546=['info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTemplate','options','limit','include','map','model','attributes','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x555d2d,_0x28c648){var _0x2550e0=function(_0x3d563f){while(--_0x3d563f){_0x555d2d['push'](_0x555d2d['shift']());}};_0x2550e0(++_0x28c648);}(_0x1546,0x18b));var _0x6154=function(_0x27b259,_0x2c0b6b){_0x27b259=_0x27b259-0x0;var _0x599d47=_0x1546[_0x27b259];return _0x599d47;};'use strict';var _=require('lodash');var util=require(_0x6154('0x0'));var moment=require(_0x6154('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6154('0x2'))['db'];var utils=require(_0x6154('0x3'));var logger=require(_0x6154('0x4'))(_0x6154('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6154('0x6')][_0x6154('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x314d28,_0x39b763,_0x102541){return new BPromise(function(_0x44c302,_0x403229){return client[_0x6154('0x8')](_0x314d28,_0x102541)[_0x6154('0x9')](function(_0x4d0a7e){logger[_0x6154('0xa')](_0x6154('0xb'),_0x39b763,'request\x20sent');logger[_0x6154('0xc')](_0x6154('0xd'),_0x39b763,_0x6154('0xe'),JSON[_0x6154('0xf')](_0x4d0a7e));if(_0x4d0a7e[_0x6154('0x10')]){if(_0x4d0a7e[_0x6154('0x10')]['code']===0x1f4){logger[_0x6154('0x10')](_0x6154('0xb'),_0x39b763,_0x4d0a7e[_0x6154('0x10')]['message']);return _0x403229(_0x4d0a7e[_0x6154('0x10')][_0x6154('0x11')]);}logger[_0x6154('0x10')](_0x6154('0xb'),_0x39b763,_0x4d0a7e['error'][_0x6154('0x11')]);return _0x44c302(_0x4d0a7e[_0x6154('0x10')]['message']);}else{logger[_0x6154('0xa')](_0x6154('0xb'),_0x39b763,_0x6154('0xe'));_0x44c302(_0x4d0a7e[_0x6154('0x12')][_0x6154('0x11')]);}})[_0x6154('0x13')](function(_0x479a89){logger[_0x6154('0x10')](_0x6154('0xb'),_0x39b763,_0x479a89);_0x403229(_0x479a89);});});}exports[_0x6154('0x14')]=function(_0x283e31){var _0x34be0f=this;return new Promise(function(_0x53eb2b,_0x55af38){return db['Template']['findAll']({'raw':_0x283e31[_0x6154('0x15')]?_0x283e31[_0x6154('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x283e31[_0x6154('0x15')]?_0x283e31['options']['where']||null:null,'attributes':_0x283e31[_0x6154('0x15')]?_0x283e31[_0x6154('0x15')]['attributes']||null:null,'limit':_0x283e31['options']?_0x283e31[_0x6154('0x15')][_0x6154('0x16')]||null:null,'include':_0x283e31['options']?_0x283e31['options'][_0x6154('0x17')]?_[_0x6154('0x18')](_0x283e31[_0x6154('0x15')][_0x6154('0x17')],function(_0x477ff6){return{'model':db[_0x477ff6[_0x6154('0x19')]],'as':_0x477ff6['as'],'attributes':_0x477ff6[_0x6154('0x1a')],'include':_0x477ff6[_0x6154('0x17')]?_[_0x6154('0x18')](_0x477ff6[_0x6154('0x17')],function(_0x4d46fc){return{'model':db[_0x4d46fc['model']],'as':_0x4d46fc['as'],'attributes':_0x4d46fc[_0x6154('0x1a')],'include':_0x4d46fc[_0x6154('0x17')]?_[_0x6154('0x18')](_0x4d46fc[_0x6154('0x17')],function(_0x1fffd2){return{'model':db[_0x1fffd2[_0x6154('0x19')]],'as':_0x1fffd2['as'],'attributes':_0x1fffd2[_0x6154('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6154('0x9')](function(_0x5773ec){logger['info'](_0x6154('0x14'),_0x283e31);logger[_0x6154('0xc')](_0x6154('0x14'),_0x283e31,JSON[_0x6154('0xf')](_0x5773ec));_0x53eb2b(_0x5773ec);})[_0x6154('0x13')](function(_0x56aaae){logger[_0x6154('0x10')](_0x6154('0x14'),_0x56aaae['message'],_0x283e31);_0x55af38(_0x34be0f[_0x6154('0x10')](0x1f4,_0x56aaae[_0x6154('0x11')]));});});}; \ No newline at end of file +var _0xbfda=['raw','options','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTemplate','Template','findAll'];(function(_0x48e1ef,_0x51f0c6){var _0xd35dc0=function(_0x1aa159){while(--_0x1aa159){_0x48e1ef['push'](_0x48e1ef['shift']());}};_0xd35dc0(++_0x51f0c6);}(_0xbfda,0x193));var _0xabfd=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0xbfda[_0x1911ed];return _0x11edaa;};'use strict';var _=require(_0xabfd('0x0'));var util=require(_0xabfd('0x1'));var moment=require(_0xabfd('0x2'));var BPromise=require(_0xabfd('0x3'));var rs=require(_0xabfd('0x4'));var fs=require('fs');var Redis=require(_0xabfd('0x5'));var db=require(_0xabfd('0x6'))['db'];var utils=require(_0xabfd('0x7'));var logger=require('../../config/logger')(_0xabfd('0x8'));var config=require('../../config/environment');var jayson=require(_0xabfd('0x9'));var client=jayson[_0xabfd('0xa')][_0xabfd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e595e,_0x5c06e0,_0x3ae842){return new BPromise(function(_0x177520,_0x16fef9){return client['request'](_0x3e595e,_0x3ae842)[_0xabfd('0xc')](function(_0x4d82a4){logger[_0xabfd('0xd')](_0xabfd('0xe'),_0x5c06e0,_0xabfd('0xf'));logger[_0xabfd('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x5c06e0,_0xabfd('0xf'),JSON[_0xabfd('0x11')](_0x4d82a4));if(_0x4d82a4[_0xabfd('0x12')]){if(_0x4d82a4[_0xabfd('0x12')][_0xabfd('0x13')]===0x1f4){logger[_0xabfd('0x12')]('Template,\x20%s,\x20%s',_0x5c06e0,_0x4d82a4[_0xabfd('0x12')][_0xabfd('0x14')]);return _0x16fef9(_0x4d82a4[_0xabfd('0x12')]['message']);}logger[_0xabfd('0x12')](_0xabfd('0xe'),_0x5c06e0,_0x4d82a4[_0xabfd('0x12')]['message']);return _0x177520(_0x4d82a4['error'][_0xabfd('0x14')]);}else{logger[_0xabfd('0xd')](_0xabfd('0xe'),_0x5c06e0,'request\x20sent');_0x177520(_0x4d82a4[_0xabfd('0x15')]['message']);}})[_0xabfd('0x16')](function(_0x336d79){logger[_0xabfd('0x12')](_0xabfd('0xe'),_0x5c06e0,_0x336d79);_0x16fef9(_0x336d79);});});}exports[_0xabfd('0x17')]=function(_0x2d7249){var _0x2f2bdd=this;return new Promise(function(_0x252466,_0x34f44d){return db[_0xabfd('0x18')][_0xabfd('0x19')]({'raw':_0x2d7249['options']?_0x2d7249['options'][_0xabfd('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d7249[_0xabfd('0x1b')]?_0x2d7249[_0xabfd('0x1b')][_0xabfd('0x1c')]||null:null,'attributes':_0x2d7249['options']?_0x2d7249[_0xabfd('0x1b')][_0xabfd('0x1d')]||null:null,'limit':_0x2d7249[_0xabfd('0x1b')]?_0x2d7249[_0xabfd('0x1b')]['limit']||null:null,'include':_0x2d7249[_0xabfd('0x1b')]?_0x2d7249[_0xabfd('0x1b')][_0xabfd('0x1e')]?_['map'](_0x2d7249['options'][_0xabfd('0x1e')],function(_0x309d9b){return{'model':db[_0x309d9b[_0xabfd('0x1f')]],'as':_0x309d9b['as'],'attributes':_0x309d9b['attributes'],'include':_0x309d9b[_0xabfd('0x1e')]?_[_0xabfd('0x20')](_0x309d9b[_0xabfd('0x1e')],function(_0xdef6c0){return{'model':db[_0xdef6c0[_0xabfd('0x1f')]],'as':_0xdef6c0['as'],'attributes':_0xdef6c0[_0xabfd('0x1d')],'include':_0xdef6c0[_0xabfd('0x1e')]?_[_0xabfd('0x20')](_0xdef6c0[_0xabfd('0x1e')],function(_0x4add2b){return{'model':db[_0x4add2b[_0xabfd('0x1f')]],'as':_0x4add2b['as'],'attributes':_0x4add2b[_0xabfd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xabfd('0xc')](function(_0x2e66b6){logger[_0xabfd('0xd')](_0xabfd('0x17'),_0x2d7249);logger[_0xabfd('0x10')](_0xabfd('0x17'),_0x2d7249,JSON[_0xabfd('0x11')](_0x2e66b6));_0x252466(_0x2e66b6);})[_0xabfd('0x16')](function(_0x59f73e){logger[_0xabfd('0x12')](_0xabfd('0x17'),_0x59f73e['message'],_0x2d7249);_0x34f44d(_0x2f2bdd['error'](0x1f4,_0x59f73e[_0xabfd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index d11c952..0028335 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 _0xeacb=['addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','util','path','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post'];(function(_0x4b9fe8,_0x2c9e1b){var _0x57ffa1=function(_0x606beb){while(--_0x606beb){_0x4b9fe8['push'](_0x4b9fe8['shift']());}};_0x57ffa1(++_0x2c9e1b);}(_0xeacb,0xcf));var _0xbeac=function(_0x31a8ef,_0x589319){_0x31a8ef=_0x31a8ef-0x0;var _0x34d377=_0xeacb[_0x31a8ef];return _0x34d377;};'use strict';var multer=require('multer');var util=require(_0xbeac('0x0'));var path=require(_0xbeac('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeac('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xbeac('0x3'));var config=require(_0xbeac('0x4'));var controller=require(_0xbeac('0x5'));router['get']('/',auth[_0xbeac('0x6')](),controller[_0xbeac('0x7')]);router[_0xbeac('0x8')](_0xbeac('0x9'),auth[_0xbeac('0x6')](),controller[_0xbeac('0xa')]);router[_0xbeac('0x8')](_0xbeac('0xb'),auth[_0xbeac('0x6')](),controller[_0xbeac('0xc')]);router[_0xbeac('0x8')](_0xbeac('0xd'),auth['isAuthenticated'](),controller[_0xbeac('0xe')]);router[_0xbeac('0x8')](_0xbeac('0xf'),auth[_0xbeac('0x6')](),controller[_0xbeac('0x10')]);router[_0xbeac('0x11')]('/',auth[_0xbeac('0x6')](),controller['create']);router[_0xbeac('0x11')](_0xbeac('0xb'),auth[_0xbeac('0x6')](),controller[_0xbeac('0x12')]);router['post'](_0xbeac('0xd'),auth[_0xbeac('0x6')](),controller[_0xbeac('0x13')]);router[_0xbeac('0x11')]('/:id/actions',auth[_0xbeac('0x6')](),controller[_0xbeac('0x14')]);router[_0xbeac('0x15')](_0xbeac('0x9'),auth[_0xbeac('0x6')](),controller[_0xbeac('0x16')]);router[_0xbeac('0x17')](_0xbeac('0x9'),auth['isAuthenticated'](),controller[_0xbeac('0x18')]);module['exports']=router; \ No newline at end of file +var _0x3a22=['/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show'];(function(_0x574395,_0x8aa7df){var _0xa2e7fa=function(_0x5b2df9){while(--_0x5b2df9){_0x574395['push'](_0x574395['shift']());}};_0xa2e7fa(++_0x8aa7df);}(_0x3a22,0xa9));var _0x23a2=function(_0x1010c8,_0x158802){_0x1010c8=_0x1010c8-0x0;var _0x35bb1f=_0x3a22[_0x1010c8];return _0x35bb1f;};'use strict';var multer=require(_0x23a2('0x0'));var util=require('util');var path=require(_0x23a2('0x1'));var timeout=require(_0x23a2('0x2'));var express=require(_0x23a2('0x3'));var router=express[_0x23a2('0x4')]();var fs_extra=require(_0x23a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x23a2('0x6'));var config=require(_0x23a2('0x7'));var controller=require(_0x23a2('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x23a2('0x9')](_0x23a2('0xa'),auth[_0x23a2('0xb')](),controller[_0x23a2('0xc')]);router[_0x23a2('0x9')](_0x23a2('0xd'),auth[_0x23a2('0xb')](),controller[_0x23a2('0xe')]);router[_0x23a2('0x9')](_0x23a2('0xf'),auth[_0x23a2('0xb')](),controller[_0x23a2('0x10')]);router['get'](_0x23a2('0x11'),auth['isAuthenticated'](),controller[_0x23a2('0x12')]);router[_0x23a2('0x13')]('/',auth[_0x23a2('0xb')](),controller[_0x23a2('0x14')]);router[_0x23a2('0x13')](_0x23a2('0xd'),auth[_0x23a2('0xb')](),controller[_0x23a2('0x15')]);router[_0x23a2('0x13')](_0x23a2('0xf'),auth['isAuthenticated'](),controller[_0x23a2('0x16')]);router['post']('/:id/actions',auth[_0x23a2('0xb')](),controller['addAction']);router['put'](_0x23a2('0xa'),auth[_0x23a2('0xb')](),controller[_0x23a2('0x17')]);router[_0x23a2('0x18')](_0x23a2('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x23a2('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d7db7cb..a51ffc8 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 _0x356c=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5a7e72,_0x1dee0b){var _0xc671cf=function(_0x5360e3){while(--_0x5360e3){_0x5a7e72['push'](_0x5a7e72['shift']());}};_0xc671cf(++_0x1dee0b);}(_0x356c,0x143));var _0xc356=function(_0x1bfe54,_0x28177a){_0x1bfe54=_0x1bfe54-0x0;var _0x3c6200=_0x356c[_0x1bfe54];return _0x3c6200;};'use strict';var Sequelize=require(_0xc356('0x0'));module[_0xc356('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc356('0x2')]},'status':{'type':Sequelize[_0xc356('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0e1a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0e1a,0x1e1));var _0xa0e1=function(_0x2be3f2,_0x3aa592){_0x2be3f2=_0x2be3f2-0x0;var _0x2728c8=_0x0e1a[_0x2be3f2];return _0x2728c8;};'use strict';var Sequelize=require(_0xa0e1('0x0'));module[_0xa0e1('0x1')]={'name':{'type':Sequelize[_0xa0e1('0x2')]},'channel':{'type':Sequelize[_0xa0e1('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa0e1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index af79f18..b46e5bd 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 _0x35f8=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','json','apply','reject','update','then','destroy','get','sendStatus','error','stack','name','send','index','Trigger','rawAttributes','type','key','model','map','query','keys'];(function(_0x107605,_0xa629a3){var _0x10885b=function(_0x25c2ae){while(--_0x25c2ae){_0x107605['push'](_0x107605['shift']());}};_0x10885b(++_0xa629a3);}(_0x35f8,0x1a2));var _0x835f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x35f8[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x835f('0x0'));var rimraf=require(_0x835f('0x1'));var zipdir=require(_0x835f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x835f('0x3'));var moment=require(_0x835f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x835f('0x5'));var util=require(_0x835f('0x6'));var path=require(_0x835f('0x7'));var sox=require(_0x835f('0x8'));var csv=require(_0x835f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x835f('0xa'));var _=require('lodash');var squel=require(_0x835f('0xb'));var crypto=require(_0x835f('0xc'));var jsforce=require(_0x835f('0xd'));var deskjs=require(_0x835f('0xe'));var toCsv=require(_0x835f('0x9'));var querystring=require(_0x835f('0xf'));var Papa=require(_0x835f('0x10'));var Redis=require(_0x835f('0x11'));var authService=require(_0x835f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x835f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x835f('0x14'));var utils=require('../../config/utils');var config=require(_0x835f('0x15'));var licenseUtil=require(_0x835f('0x16'));var db=require(_0x835f('0x17'))['db'];function respondWithStatusCode(_0x25d314,_0xbdf55e){_0xbdf55e=_0xbdf55e||0xcc;return function(_0x5d26d8){if(_0x5d26d8){return _0x25d314['sendStatus'](_0xbdf55e);}return _0x25d314['status'](_0xbdf55e)[_0x835f('0x18')]();};}function respondWithResult(_0x3358bd,_0x351adc){_0x351adc=_0x351adc||0xc8;return function(_0x1ed91c){if(_0x1ed91c){return _0x3358bd[_0x835f('0x19')](_0x351adc)['json'](_0x1ed91c);}};}function respondWithFilteredResult(_0x2963bc,_0x4eb0e8){return function(_0x877d43){if(_0x877d43){var _0x50523f=typeof _0x4eb0e8[_0x835f('0x1a')]===_0x835f('0x1b')&&typeof _0x4eb0e8['limit']===_0x835f('0x1b');var _0x570464=_0x877d43[_0x835f('0x1c')];var _0x1bca86=_0x50523f?0x0:_0x4eb0e8[_0x835f('0x1a')];var _0x343fe2=_0x50523f?_0x877d43[_0x835f('0x1c')]:_0x4eb0e8[_0x835f('0x1a')]+_0x4eb0e8[_0x835f('0x1d')];var _0x569d97;if(_0x343fe2>=_0x570464){_0x343fe2=_0x570464;_0x569d97=0xc8;}else{_0x569d97=0xce;}_0x2963bc[_0x835f('0x19')](_0x569d97);return _0x2963bc[_0x835f('0x1e')]('Content-Range',_0x1bca86+'-'+_0x343fe2+'/'+_0x570464)[_0x835f('0x1f')](_0x877d43);}return null;};}function patchUpdates(_0x127433){return function(_0x1ec37b){try{jsonpatch[_0x835f('0x20')](_0x1ec37b,_0x127433,!![]);}catch(_0x7d99f7){return BPromise[_0x835f('0x21')](_0x7d99f7);}return _0x1ec37b['save']();};}function saveUpdates(_0x43ef3f,_0x32f616){return function(_0xafc5e0){if(_0xafc5e0){return _0xafc5e0[_0x835f('0x22')](_0x43ef3f)[_0x835f('0x23')](function(_0x3acaf8){return _0x3acaf8;});}return null;};}function removeEntity(_0x321bda,_0x414ce6){return function(_0x32f117){if(_0x32f117){return _0x32f117[_0x835f('0x24')]()[_0x835f('0x23')](function(){var _0x5c467e=_0x32f117[_0x835f('0x25')]({'plain':!![]});var _0x399936='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x399936,'resourceId':_0x5c467e['id']}})[_0x835f('0x23')](function(){return _0x32f117;});})[_0x835f('0x23')](function(){_0x321bda[_0x835f('0x19')](0xcc)[_0x835f('0x18')]();});}};}function handleEntityNotFound(_0x3ffcb8,_0x41b72f){return function(_0x54bced){if(!_0x54bced){_0x3ffcb8[_0x835f('0x26')](0x194);}return _0x54bced;};}function handleError(_0x1b6771,_0x5004d8){_0x5004d8=_0x5004d8||0x1f4;return function(_0x3ebd66){logger[_0x835f('0x27')](_0x3ebd66[_0x835f('0x28')]);if(_0x3ebd66[_0x835f('0x29')]){delete _0x3ebd66[_0x835f('0x29')];}_0x1b6771[_0x835f('0x19')](_0x5004d8)[_0x835f('0x2a')](_0x3ebd66);};}exports[_0x835f('0x2b')]=function(_0x4a227e,_0x502fc2){var _0x5efd4f={},_0x42e79d={},_0x2a8996={'count':0x0,'rows':[]};var _0x22ea22=_['map'](db[_0x835f('0x2c')][_0x835f('0x2d')],function(_0x4c66c3){return{'name':_0x4c66c3['fieldName'],'type':_0x4c66c3[_0x835f('0x2e')][_0x835f('0x2f')]};});_0x42e79d[_0x835f('0x30')]=_[_0x835f('0x31')](_0x22ea22,_0x835f('0x29'));_0x42e79d[_0x835f('0x32')]=_[_0x835f('0x33')](_0x4a227e['query']);_0x42e79d[_0x835f('0x34')]=_[_0x835f('0x35')](_0x42e79d[_0x835f('0x30')],_0x42e79d['query']);_0x5efd4f[_0x835f('0x36')]=_[_0x835f('0x35')](_0x42e79d[_0x835f('0x30')],qs[_0x835f('0x37')](_0x4a227e[_0x835f('0x32')][_0x835f('0x37')]));_0x5efd4f['attributes']=_0x5efd4f[_0x835f('0x36')][_0x835f('0x38')]?_0x5efd4f[_0x835f('0x36')]:_0x42e79d['model'];if(!_0x4a227e['query'][_0x835f('0x39')](_0x835f('0x3a'))){_0x5efd4f[_0x835f('0x1d')]=qs['limit'](_0x4a227e[_0x835f('0x32')]['limit']);_0x5efd4f['offset']=qs[_0x835f('0x1a')](_0x4a227e[_0x835f('0x32')][_0x835f('0x1a')]);}_0x5efd4f[_0x835f('0x3b')]=qs[_0x835f('0x3c')](_0x4a227e[_0x835f('0x32')]['sort']);_0x5efd4f[_0x835f('0x3d')]=qs['filters'](_[_0x835f('0x3e')](_0x4a227e[_0x835f('0x32')],_0x42e79d[_0x835f('0x34')]),_0x22ea22);if(_0x4a227e[_0x835f('0x32')]['filter']){_0x5efd4f['where']=_[_0x835f('0x3f')](_0x5efd4f[_0x835f('0x3d')],{'$or':_['map'](_0x22ea22,function(_0x24c837){if(_0x24c837[_0x835f('0x2e')]!==_0x835f('0x40')){var _0x20c241={};_0x20c241[_0x24c837[_0x835f('0x29')]]={'$like':'%'+_0x4a227e[_0x835f('0x32')][_0x835f('0x41')]+'%'};return _0x20c241;}})});}_0x5efd4f=_[_0x835f('0x3f')]({},_0x5efd4f,_0x4a227e[_0x835f('0x42')]);var _0x4e9609={'where':_0x5efd4f[_0x835f('0x3d')]};return db[_0x835f('0x2c')][_0x835f('0x1c')](_0x4e9609)['then'](function(_0xd39a37){_0x2a8996[_0x835f('0x1c')]=_0xd39a37;if(_0x4a227e[_0x835f('0x32')]['includeAll']){_0x5efd4f['include']=[{'all':!![]}];}return db[_0x835f('0x2c')][_0x835f('0x43')](_0x5efd4f);})[_0x835f('0x23')](function(_0x34f72f){_0x2a8996['rows']=_0x34f72f;return _0x2a8996;})[_0x835f('0x23')](respondWithFilteredResult(_0x502fc2,_0x5efd4f))[_0x835f('0x44')](handleError(_0x502fc2,null));};exports[_0x835f('0x45')]=function(_0x525f78,_0x1fb3d2){var _0x466265={'raw':![],'where':{'id':_0x525f78[_0x835f('0x46')]['id']}},_0x511b9e={};_0x511b9e[_0x835f('0x30')]=_[_0x835f('0x33')](db[_0x835f('0x2c')][_0x835f('0x2d')]);_0x511b9e[_0x835f('0x32')]=_[_0x835f('0x33')](_0x525f78['query']);_0x511b9e[_0x835f('0x34')]=_[_0x835f('0x35')](_0x511b9e[_0x835f('0x30')],_0x511b9e[_0x835f('0x32')]);_0x466265[_0x835f('0x36')]=_[_0x835f('0x35')](_0x511b9e[_0x835f('0x30')],qs[_0x835f('0x37')](_0x525f78[_0x835f('0x32')]['fields']));_0x466265[_0x835f('0x36')]=_0x466265['attributes'][_0x835f('0x38')]?_0x466265['attributes']:_0x511b9e[_0x835f('0x30')];if(_0x525f78['query'][_0x835f('0x47')]){_0x466265[_0x835f('0x48')]=[{'all':!![]}];}_0x466265=_[_0x835f('0x3f')]({},_0x466265,_0x525f78['options']);return db[_0x835f('0x2c')][_0x835f('0x49')](_0x466265)['then'](handleEntityNotFound(_0x1fb3d2,null))[_0x835f('0x23')](respondWithResult(_0x1fb3d2,null))[_0x835f('0x44')](handleError(_0x1fb3d2,null));};exports[_0x835f('0x4a')]=function(_0x148cc2,_0x313441){return db[_0x835f('0x2c')][_0x835f('0x4a')](_0x148cc2[_0x835f('0x4b')],{})[_0x835f('0x23')](function(_0x105d5e){var _0x2582cc=_0x148cc2['user']['get']({'plain':!![]});if(!_0x2582cc)throw new Error(_0x835f('0x4c'));if(_0x2582cc[_0x835f('0x4d')]===_0x835f('0x4e')){var _0x2771fb=_0x105d5e[_0x835f('0x25')]({'plain':!![]});var _0x46384a='Triggers';return db['UserProfileSection'][_0x835f('0x49')]({'where':{'name':_0x46384a,'userProfileId':_0x2582cc['userProfileId']},'raw':!![]})[_0x835f('0x23')](function(_0x4f7de1){if(_0x4f7de1&&_0x4f7de1[_0x835f('0x4f')]===0x0){return db[_0x835f('0x50')][_0x835f('0x4a')]({'name':_0x2771fb[_0x835f('0x29')],'resourceId':_0x2771fb['id'],'type':_0x4f7de1[_0x835f('0x29')],'sectionId':_0x4f7de1['id']},{})[_0x835f('0x23')](function(){return _0x105d5e;});}else{return _0x105d5e;}})[_0x835f('0x44')](function(_0x3a037e){logger['error'](_0x835f('0x51'),_0x3a037e);throw _0x3a037e;});}return _0x105d5e;})['then'](respondWithResult(_0x313441,0xc9))[_0x835f('0x44')](handleError(_0x313441,null));};exports[_0x835f('0x22')]=function(_0xe75bc3,_0x183550){if(_0xe75bc3[_0x835f('0x4b')]['id']){delete _0xe75bc3[_0x835f('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0xe75bc3[_0x835f('0x46')]['id']}})['then'](handleEntityNotFound(_0x183550,null))[_0x835f('0x23')](saveUpdates(_0xe75bc3['body'],null))[_0x835f('0x23')](respondWithResult(_0x183550,null))[_0x835f('0x44')](handleError(_0x183550,null));};exports[_0x835f('0x24')]=function(_0x224f5c,_0x324a14){return db['Trigger']['find']({'where':{'id':_0x224f5c[_0x835f('0x46')]['id']}})[_0x835f('0x23')](handleEntityNotFound(_0x324a14,null))[_0x835f('0x23')](removeEntity(_0x324a14,null))[_0x835f('0x44')](handleError(_0x324a14,null));};exports[_0x835f('0x52')]=function(_0x2bdedd,_0x376a0e,_0x4e6175){if(_0x2bdedd[_0x835f('0x4b')]['id']){delete _0x2bdedd[_0x835f('0x4b')]['id'];}return db[_0x835f('0x2c')][_0x835f('0x49')]({'where':{'id':_0x2bdedd[_0x835f('0x46')]['id']}})[_0x835f('0x23')](handleEntityNotFound(_0x376a0e,null))[_0x835f('0x23')](function(_0x19390b){if(_0x19390b){_0x2bdedd[_0x835f('0x4b')][_0x835f('0x53')]=_0x19390b['id'];return db['Condition']['create'](_0x2bdedd[_0x835f('0x4b')]);}})[_0x835f('0x23')](respondWithResult(_0x376a0e,null))[_0x835f('0x44')](handleError(_0x376a0e,null));};exports[_0x835f('0x54')]=function(_0xc7c50f,_0x37aadf,_0x292e90){if(_0xc7c50f['body']['id']){delete _0xc7c50f[_0x835f('0x4b')]['id'];}return db[_0x835f('0x2c')][_0x835f('0x49')]({'where':{'id':_0xc7c50f['params']['id']}})[_0x835f('0x23')](handleEntityNotFound(_0x37aadf,null))[_0x835f('0x23')](function(_0x374ca3){if(_0x374ca3){_0xc7c50f['body'][_0x835f('0x55')]=_0x374ca3['id'];return db[_0x835f('0x56')][_0x835f('0x4a')](_0xc7c50f['body']);}})[_0x835f('0x23')](respondWithResult(_0x37aadf,null))[_0x835f('0x44')](handleError(_0x37aadf,null));};exports[_0x835f('0x57')]=function(_0x40ae2d,_0x458f9e,_0x5b4cff){var _0x32e5a5={};var _0x35a279={};var _0x9bdaaf;var _0xd0e9b9;return db[_0x835f('0x2c')]['findOne']({'where':{'id':_0x40ae2d[_0x835f('0x46')]['id']}})[_0x835f('0x23')](handleEntityNotFound(_0x458f9e,null))['then'](function(_0x72d6c3){if(_0x72d6c3){_0x9bdaaf=_0x72d6c3;_0x35a279[_0x835f('0x30')]=_['keys'](db[_0x835f('0x56')]['rawAttributes']);_0x35a279[_0x835f('0x32')]=_[_0x835f('0x33')](_0x40ae2d[_0x835f('0x32')]);_0x35a279[_0x835f('0x34')]=_[_0x835f('0x35')](_0x35a279[_0x835f('0x30')],_0x35a279[_0x835f('0x32')]);_0x32e5a5[_0x835f('0x36')]=_['intersection'](_0x35a279[_0x835f('0x30')],qs[_0x835f('0x37')](_0x40ae2d[_0x835f('0x32')]['fields']));_0x32e5a5[_0x835f('0x36')]=_0x32e5a5[_0x835f('0x36')][_0x835f('0x38')]?_0x32e5a5[_0x835f('0x36')]:_0x35a279[_0x835f('0x30')];_0x32e5a5[_0x835f('0x3b')]=qs[_0x835f('0x3c')](_0x40ae2d[_0x835f('0x32')][_0x835f('0x3c')]);_0x32e5a5[_0x835f('0x3d')]=qs[_0x835f('0x34')](_[_0x835f('0x3e')](_0x40ae2d[_0x835f('0x32')],_0x35a279[_0x835f('0x34')]));if(_0x40ae2d[_0x835f('0x32')][_0x835f('0x41')]){_0x32e5a5[_0x835f('0x3d')]=_[_0x835f('0x3f')](_0x32e5a5[_0x835f('0x3d')],{'$or':_['map'](_0x32e5a5[_0x835f('0x36')],function(_0x4b046b){var _0x24fea4={};_0x24fea4[_0x4b046b]={'$like':'%'+_0x40ae2d['query']['filter']+'%'};return _0x24fea4;})});}_0x32e5a5=_[_0x835f('0x3f')]({},_0x32e5a5,_0x40ae2d[_0x835f('0x42')]);return _0x9bdaaf[_0x835f('0x57')](_0x32e5a5);}})[_0x835f('0x23')](function(_0x53a462){if(_0x53a462){_0xd0e9b9=_0x53a462['length'];if(!_0x40ae2d[_0x835f('0x32')]['hasOwnProperty']('nolimit')){_0x32e5a5[_0x835f('0x1d')]=qs['limit'](_0x40ae2d[_0x835f('0x32')]['limit']);_0x32e5a5[_0x835f('0x1a')]=qs[_0x835f('0x1a')](_0x40ae2d[_0x835f('0x32')][_0x835f('0x1a')]);}return _0x9bdaaf['getAllConditions'](_0x32e5a5);}})['then'](function(_0x56b3ae){if(_0x56b3ae){return _0x56b3ae?{'count':_0xd0e9b9,'rows':_0x56b3ae}:null;}})['then'](respondWithResult(_0x458f9e,null))[_0x835f('0x44')](handleError(_0x458f9e,null));};exports[_0x835f('0x58')]=function(_0x302132,_0x187b33,_0x1762aa){var _0x404e71={};var _0x1707f5={};var _0x391c35;var _0xd2dbf6;return db[_0x835f('0x2c')][_0x835f('0x59')]({'where':{'id':_0x302132[_0x835f('0x46')]['id']}})[_0x835f('0x23')](handleEntityNotFound(_0x187b33,null))[_0x835f('0x23')](function(_0x2ee184){if(_0x2ee184){_0x391c35=_0x2ee184;_0x1707f5['model']=_[_0x835f('0x33')](db['Condition'][_0x835f('0x2d')]);_0x1707f5['query']=_[_0x835f('0x33')](_0x302132[_0x835f('0x32')]);_0x1707f5[_0x835f('0x34')]=_[_0x835f('0x35')](_0x1707f5['model'],_0x1707f5[_0x835f('0x32')]);_0x404e71[_0x835f('0x36')]=_[_0x835f('0x35')](_0x1707f5[_0x835f('0x30')],qs['fields'](_0x302132[_0x835f('0x32')]['fields']));_0x404e71[_0x835f('0x36')]=_0x404e71[_0x835f('0x36')][_0x835f('0x38')]?_0x404e71[_0x835f('0x36')]:_0x1707f5[_0x835f('0x30')];_0x404e71[_0x835f('0x3b')]=qs['sort'](_0x302132[_0x835f('0x32')]['sort']);_0x404e71[_0x835f('0x3d')]=qs[_0x835f('0x34')](_[_0x835f('0x3e')](_0x302132[_0x835f('0x32')],_0x1707f5[_0x835f('0x34')]));if(_0x302132['query']['filter']){_0x404e71['where']=_[_0x835f('0x3f')](_0x404e71[_0x835f('0x3d')],{'$or':_['map'](_0x404e71[_0x835f('0x36')],function(_0x2ae714){var _0x4a69b3={};_0x4a69b3[_0x2ae714]={'$like':'%'+_0x302132[_0x835f('0x32')][_0x835f('0x41')]+'%'};return _0x4a69b3;})});}_0x404e71=_[_0x835f('0x3f')]({},_0x404e71,_0x302132[_0x835f('0x42')]);return _0x391c35['getAnyConditions'](_0x404e71);}})['then'](function(_0x2d900f){if(_0x2d900f){_0xd2dbf6=_0x2d900f[_0x835f('0x38')];if(!_0x302132['query'][_0x835f('0x39')](_0x835f('0x3a'))){_0x404e71['limit']=qs['limit'](_0x302132[_0x835f('0x32')]['limit']);_0x404e71['offset']=qs[_0x835f('0x1a')](_0x302132[_0x835f('0x32')]['offset']);}return _0x391c35[_0x835f('0x58')](_0x404e71);}})[_0x835f('0x23')](function(_0x4da0d0){if(_0x4da0d0){return _0x4da0d0?{'count':_0xd2dbf6,'rows':_0x4da0d0}:null;}})[_0x835f('0x23')](respondWithResult(_0x187b33,null))['catch'](handleError(_0x187b33,null));};exports[_0x835f('0x5a')]=function(_0xf9bfcd,_0x519bb5,_0x3416fb){if(_0xf9bfcd['body']['id']){delete _0xf9bfcd['body']['id'];}return db['Trigger'][_0x835f('0x49')]({'where':{'id':_0xf9bfcd[_0x835f('0x46')]['id']}})[_0x835f('0x23')](handleEntityNotFound(_0x519bb5,null))[_0x835f('0x23')](function(_0x3a6b63){if(_0x3a6b63){_0xf9bfcd[_0x835f('0x4b')][_0x835f('0x5b')]=_0x3a6b63['id'];return db[_0x835f('0x5c')]['create'](_0xf9bfcd['body']);}})[_0x835f('0x23')](respondWithResult(_0x519bb5,null))[_0x835f('0x44')](handleError(_0x519bb5,null));};exports[_0x835f('0x5d')]=function(_0x3b8e4c,_0x5235df,_0x25a1f8){var _0x41e2ed={};var _0xb5f097={};var _0x24739a;var _0x4c219d;return db[_0x835f('0x2c')][_0x835f('0x59')]({'where':{'id':_0x3b8e4c['params']['id']}})[_0x835f('0x23')](handleEntityNotFound(_0x5235df,null))[_0x835f('0x23')](function(_0x598e23){if(_0x598e23){_0x24739a=_0x598e23;_0xb5f097[_0x835f('0x30')]=_[_0x835f('0x33')](db['Action'][_0x835f('0x2d')]);_0xb5f097[_0x835f('0x32')]=_['keys'](_0x3b8e4c['query']);_0xb5f097[_0x835f('0x34')]=_['intersection'](_0xb5f097[_0x835f('0x30')],_0xb5f097[_0x835f('0x32')]);_0x41e2ed[_0x835f('0x36')]=_['intersection'](_0xb5f097[_0x835f('0x30')],qs[_0x835f('0x37')](_0x3b8e4c[_0x835f('0x32')]['fields']));_0x41e2ed[_0x835f('0x36')]=_0x41e2ed['attributes'][_0x835f('0x38')]?_0x41e2ed['attributes']:_0xb5f097['model'];_0x41e2ed['order']=qs[_0x835f('0x3c')](_0x3b8e4c[_0x835f('0x32')][_0x835f('0x3c')]);_0x41e2ed[_0x835f('0x3d')]=qs[_0x835f('0x34')](_[_0x835f('0x3e')](_0x3b8e4c[_0x835f('0x32')],_0xb5f097[_0x835f('0x34')]));if(_0x3b8e4c[_0x835f('0x32')][_0x835f('0x41')]){_0x41e2ed['where']=_['merge'](_0x41e2ed[_0x835f('0x3d')],{'$or':_[_0x835f('0x31')](_0x41e2ed[_0x835f('0x36')],function(_0x3dabe4){var _0x1b5822={};_0x1b5822[_0x3dabe4]={'$like':'%'+_0x3b8e4c[_0x835f('0x32')][_0x835f('0x41')]+'%'};return _0x1b5822;})});}_0x41e2ed=_[_0x835f('0x3f')]({},_0x41e2ed,_0x3b8e4c[_0x835f('0x42')]);return _0x24739a[_0x835f('0x5d')](_0x41e2ed);}})[_0x835f('0x23')](function(_0x9a8864){if(_0x9a8864){_0x4c219d=_0x9a8864[_0x835f('0x38')];if(!_0x3b8e4c[_0x835f('0x32')][_0x835f('0x39')](_0x835f('0x3a'))){_0x41e2ed['limit']=qs[_0x835f('0x1d')](_0x3b8e4c[_0x835f('0x32')][_0x835f('0x1d')]);_0x41e2ed[_0x835f('0x1a')]=qs['offset'](_0x3b8e4c[_0x835f('0x32')][_0x835f('0x1a')]);}return _0x24739a[_0x835f('0x5d')](_0x41e2ed);}})[_0x835f('0x23')](function(_0x192185){if(_0x192185){return _0x192185?{'count':_0x4c219d,'rows':_0x192185}:null;}})['then'](respondWithResult(_0x5235df,null))[_0x835f('0x44')](handleError(_0x5235df,null));}; \ No newline at end of file +var _0x7e7b=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','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/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','Trigger','includeAll','include','findAll','rows','catch','show','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf'];(function(_0x49f540,_0x4ad237){var _0x162bd1=function(_0x159541){while(--_0x159541){_0x49f540['push'](_0x49f540['shift']());}};_0x162bd1(++_0x4ad237);}(_0x7e7b,0xbe));var _0xb7e7=function(_0xe36298,_0x392677){_0xe36298=_0xe36298-0x0;var _0x4d8796=_0x7e7b[_0xe36298];return _0x4d8796;};'use strict';var emlformat=require(_0xb7e7('0x0'));var rimraf=require(_0xb7e7('0x1'));var zipdir=require(_0xb7e7('0x2'));var jsonpatch=require(_0xb7e7('0x3'));var rp=require(_0xb7e7('0x4'));var moment=require(_0xb7e7('0x5'));var BPromise=require(_0xb7e7('0x6'));var Mustache=require(_0xb7e7('0x7'));var util=require('util');var path=require(_0xb7e7('0x8'));var sox=require(_0xb7e7('0x9'));var csv=require('to-csv');var ejs=require(_0xb7e7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb7e7('0xb'));var crypto=require(_0xb7e7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb7e7('0xd'));var toCsv=require(_0xb7e7('0xe'));var querystring=require(_0xb7e7('0xf'));var Papa=require(_0xb7e7('0x10'));var Redis=require(_0xb7e7('0x11'));var authService=require(_0xb7e7('0x12'));var qs=require(_0xb7e7('0x13'));var as=require(_0xb7e7('0x14'));var hardwareService=require(_0xb7e7('0x15'));var logger=require(_0xb7e7('0x16'))(_0xb7e7('0x17'));var utils=require(_0xb7e7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb7e7('0x19'));var db=require(_0xb7e7('0x1a'))['db'];function respondWithStatusCode(_0x4af7d5,_0x1168e7){_0x1168e7=_0x1168e7||0xcc;return function(_0x6e0f90){if(_0x6e0f90){return _0x4af7d5[_0xb7e7('0x1b')](_0x1168e7);}return _0x4af7d5[_0xb7e7('0x1c')](_0x1168e7)[_0xb7e7('0x1d')]();};}function respondWithResult(_0x38044a,_0x5ef686){_0x5ef686=_0x5ef686||0xc8;return function(_0x1f16f9){if(_0x1f16f9){return _0x38044a[_0xb7e7('0x1c')](_0x5ef686)[_0xb7e7('0x1e')](_0x1f16f9);}};}function respondWithFilteredResult(_0xc6c5bc,_0x48a49f){return function(_0xa5054c){if(_0xa5054c){var _0x4fe481=typeof _0x48a49f['offset']==='undefined'&&typeof _0x48a49f[_0xb7e7('0x1f')]==='undefined';var _0x234d76=_0xa5054c[_0xb7e7('0x20')];var _0x27f25e=_0x4fe481?0x0:_0x48a49f[_0xb7e7('0x21')];var _0x3b0681=_0x4fe481?_0xa5054c[_0xb7e7('0x20')]:_0x48a49f[_0xb7e7('0x21')]+_0x48a49f[_0xb7e7('0x1f')];var _0x41421e;if(_0x3b0681>=_0x234d76){_0x3b0681=_0x234d76;_0x41421e=0xc8;}else{_0x41421e=0xce;}_0xc6c5bc[_0xb7e7('0x1c')](_0x41421e);return _0xc6c5bc[_0xb7e7('0x22')]('Content-Range',_0x27f25e+'-'+_0x3b0681+'/'+_0x234d76)['json'](_0xa5054c);}return null;};}function patchUpdates(_0x33e675){return function(_0x52561f){try{jsonpatch[_0xb7e7('0x23')](_0x52561f,_0x33e675,!![]);}catch(_0x153172){return BPromise[_0xb7e7('0x24')](_0x153172);}return _0x52561f[_0xb7e7('0x25')]();};}function saveUpdates(_0x10d5dc,_0x4226e0){return function(_0x4b31e9){if(_0x4b31e9){return _0x4b31e9[_0xb7e7('0x26')](_0x10d5dc)[_0xb7e7('0x27')](function(_0x1f8308){return _0x1f8308;});}return null;};}function removeEntity(_0x383107,_0x22f70f){return function(_0x47012){if(_0x47012){return _0x47012[_0xb7e7('0x28')]()[_0xb7e7('0x27')](function(){var _0x37385a=_0x47012[_0xb7e7('0x29')]({'plain':!![]});var _0x397a0f='Triggers';return db[_0xb7e7('0x2a')][_0xb7e7('0x28')]({'where':{'type':_0x397a0f,'resourceId':_0x37385a['id']}})[_0xb7e7('0x27')](function(){return _0x47012;});})[_0xb7e7('0x27')](function(){_0x383107[_0xb7e7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa43ba9,_0x1f618f){return function(_0x766121){if(!_0x766121){_0xa43ba9[_0xb7e7('0x1b')](0x194);}return _0x766121;};}function handleError(_0x4f5586,_0x182d4c){_0x182d4c=_0x182d4c||0x1f4;return function(_0x153240){logger[_0xb7e7('0x2b')](_0x153240[_0xb7e7('0x2c')]);if(_0x153240[_0xb7e7('0x2d')]){delete _0x153240[_0xb7e7('0x2d')];}_0x4f5586[_0xb7e7('0x1c')](_0x182d4c)['send'](_0x153240);};}exports[_0xb7e7('0x2e')]=function(_0x19aa29,_0x4aac98){var _0x540bfa={},_0x3637a6={},_0x502800={'count':0x0,'rows':[]};var _0xbf5021=_[_0xb7e7('0x2f')](db['Trigger'][_0xb7e7('0x30')],function(_0xaf6cbc){return{'name':_0xaf6cbc[_0xb7e7('0x31')],'type':_0xaf6cbc[_0xb7e7('0x32')][_0xb7e7('0x33')]};});_0x3637a6['model']=_[_0xb7e7('0x2f')](_0xbf5021,_0xb7e7('0x2d'));_0x3637a6['query']=_[_0xb7e7('0x34')](_0x19aa29[_0xb7e7('0x35')]);_0x3637a6['filters']=_[_0xb7e7('0x36')](_0x3637a6[_0xb7e7('0x37')],_0x3637a6[_0xb7e7('0x35')]);_0x540bfa[_0xb7e7('0x38')]=_[_0xb7e7('0x36')](_0x3637a6[_0xb7e7('0x37')],qs['fields'](_0x19aa29[_0xb7e7('0x35')]['fields']));_0x540bfa[_0xb7e7('0x38')]=_0x540bfa[_0xb7e7('0x38')][_0xb7e7('0x39')]?_0x540bfa['attributes']:_0x3637a6[_0xb7e7('0x37')];if(!_0x19aa29[_0xb7e7('0x35')][_0xb7e7('0x3a')](_0xb7e7('0x3b'))){_0x540bfa['limit']=qs[_0xb7e7('0x1f')](_0x19aa29['query'][_0xb7e7('0x1f')]);_0x540bfa['offset']=qs[_0xb7e7('0x21')](_0x19aa29[_0xb7e7('0x35')][_0xb7e7('0x21')]);}_0x540bfa[_0xb7e7('0x3c')]=qs['sort'](_0x19aa29[_0xb7e7('0x35')][_0xb7e7('0x3d')]);_0x540bfa[_0xb7e7('0x3e')]=qs['filters'](_[_0xb7e7('0x3f')](_0x19aa29[_0xb7e7('0x35')],_0x3637a6[_0xb7e7('0x40')]),_0xbf5021);if(_0x19aa29[_0xb7e7('0x35')][_0xb7e7('0x41')]){_0x540bfa[_0xb7e7('0x3e')]=_[_0xb7e7('0x42')](_0x540bfa['where'],{'$or':_[_0xb7e7('0x2f')](_0xbf5021,function(_0x1bfda6){if(_0x1bfda6['type']!=='VIRTUAL'){var _0x1b2f0e={};_0x1b2f0e[_0x1bfda6[_0xb7e7('0x2d')]]={'$like':'%'+_0x19aa29[_0xb7e7('0x35')][_0xb7e7('0x41')]+'%'};return _0x1b2f0e;}})});}_0x540bfa=_[_0xb7e7('0x42')]({},_0x540bfa,_0x19aa29[_0xb7e7('0x43')]);var _0x582e4d={'where':_0x540bfa['where']};return db[_0xb7e7('0x44')]['count'](_0x582e4d)[_0xb7e7('0x27')](function(_0x339450){_0x502800[_0xb7e7('0x20')]=_0x339450;if(_0x19aa29[_0xb7e7('0x35')][_0xb7e7('0x45')]){_0x540bfa[_0xb7e7('0x46')]=[{'all':!![]}];}return db[_0xb7e7('0x44')][_0xb7e7('0x47')](_0x540bfa);})[_0xb7e7('0x27')](function(_0x29b293){_0x502800[_0xb7e7('0x48')]=_0x29b293;return _0x502800;})[_0xb7e7('0x27')](respondWithFilteredResult(_0x4aac98,_0x540bfa))[_0xb7e7('0x49')](handleError(_0x4aac98,null));};exports[_0xb7e7('0x4a')]=function(_0x50c159,_0x4b032d){var _0x26f1e2={'raw':![],'where':{'id':_0x50c159['params']['id']}},_0x428476={};_0x428476[_0xb7e7('0x37')]=_[_0xb7e7('0x34')](db[_0xb7e7('0x44')][_0xb7e7('0x30')]);_0x428476[_0xb7e7('0x35')]=_[_0xb7e7('0x34')](_0x50c159[_0xb7e7('0x35')]);_0x428476['filters']=_[_0xb7e7('0x36')](_0x428476['model'],_0x428476[_0xb7e7('0x35')]);_0x26f1e2[_0xb7e7('0x38')]=_['intersection'](_0x428476[_0xb7e7('0x37')],qs[_0xb7e7('0x4b')](_0x50c159[_0xb7e7('0x35')]['fields']));_0x26f1e2['attributes']=_0x26f1e2[_0xb7e7('0x38')][_0xb7e7('0x39')]?_0x26f1e2[_0xb7e7('0x38')]:_0x428476['model'];if(_0x50c159[_0xb7e7('0x35')]['includeAll']){_0x26f1e2['include']=[{'all':!![]}];}_0x26f1e2=_['merge']({},_0x26f1e2,_0x50c159['options']);return db[_0xb7e7('0x44')][_0xb7e7('0x4c')](_0x26f1e2)['then'](handleEntityNotFound(_0x4b032d,null))[_0xb7e7('0x27')](respondWithResult(_0x4b032d,null))['catch'](handleError(_0x4b032d,null));};exports[_0xb7e7('0x4d')]=function(_0x3f1398,_0x21a01f){return db['Trigger'][_0xb7e7('0x4d')](_0x3f1398['body'],{})[_0xb7e7('0x27')](function(_0x5af176){var _0x2f8897=_0x3f1398['user'][_0xb7e7('0x29')]({'plain':!![]});if(!_0x2f8897)throw new Error(_0xb7e7('0x4e'));if(_0x2f8897['role']===_0xb7e7('0x4f')){var _0x5c850=_0x5af176[_0xb7e7('0x29')]({'plain':!![]});var _0x588507=_0xb7e7('0x50');return db['UserProfileSection'][_0xb7e7('0x4c')]({'where':{'name':_0x588507,'userProfileId':_0x2f8897[_0xb7e7('0x51')]},'raw':!![]})[_0xb7e7('0x27')](function(_0xff71bc){if(_0xff71bc&&_0xff71bc[_0xb7e7('0x52')]===0x0){return db[_0xb7e7('0x2a')][_0xb7e7('0x4d')]({'name':_0x5c850[_0xb7e7('0x2d')],'resourceId':_0x5c850['id'],'type':_0xff71bc[_0xb7e7('0x2d')],'sectionId':_0xff71bc['id']},{})[_0xb7e7('0x27')](function(){return _0x5af176;});}else{return _0x5af176;}})[_0xb7e7('0x49')](function(_0x29e040){logger[_0xb7e7('0x2b')](_0xb7e7('0x53'),_0x29e040);throw _0x29e040;});}return _0x5af176;})[_0xb7e7('0x27')](respondWithResult(_0x21a01f,0xc9))[_0xb7e7('0x49')](handleError(_0x21a01f,null));};exports['update']=function(_0x1ac50a,_0x236b05){if(_0x1ac50a[_0xb7e7('0x54')]['id']){delete _0x1ac50a['body']['id'];}return db[_0xb7e7('0x44')][_0xb7e7('0x4c')]({'where':{'id':_0x1ac50a['params']['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x236b05,null))['then'](saveUpdates(_0x1ac50a[_0xb7e7('0x54')],null))['then'](respondWithResult(_0x236b05,null))[_0xb7e7('0x49')](handleError(_0x236b05,null));};exports[_0xb7e7('0x28')]=function(_0xd9d2ea,_0x3843b5){return db[_0xb7e7('0x44')][_0xb7e7('0x4c')]({'where':{'id':_0xd9d2ea[_0xb7e7('0x55')]['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x3843b5,null))[_0xb7e7('0x27')](removeEntity(_0x3843b5,null))['catch'](handleError(_0x3843b5,null));};exports[_0xb7e7('0x56')]=function(_0x8274ff,_0x2eb5ed,_0x26726a){if(_0x8274ff[_0xb7e7('0x54')]['id']){delete _0x8274ff['body']['id'];}return db[_0xb7e7('0x44')][_0xb7e7('0x4c')]({'where':{'id':_0x8274ff[_0xb7e7('0x55')]['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x2eb5ed,null))[_0xb7e7('0x27')](function(_0x3d4b7a){if(_0x3d4b7a){_0x8274ff[_0xb7e7('0x54')]['TriggerAllId']=_0x3d4b7a['id'];return db[_0xb7e7('0x57')][_0xb7e7('0x4d')](_0x8274ff[_0xb7e7('0x54')]);}})[_0xb7e7('0x27')](respondWithResult(_0x2eb5ed,null))[_0xb7e7('0x49')](handleError(_0x2eb5ed,null));};exports[_0xb7e7('0x58')]=function(_0x16676b,_0x525ebd,_0x171cf4){if(_0x16676b['body']['id']){delete _0x16676b['body']['id'];}return db['Trigger'][_0xb7e7('0x4c')]({'where':{'id':_0x16676b['params']['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x525ebd,null))[_0xb7e7('0x27')](function(_0x1959db){if(_0x1959db){_0x16676b[_0xb7e7('0x54')][_0xb7e7('0x59')]=_0x1959db['id'];return db[_0xb7e7('0x57')][_0xb7e7('0x4d')](_0x16676b['body']);}})['then'](respondWithResult(_0x525ebd,null))[_0xb7e7('0x49')](handleError(_0x525ebd,null));};exports[_0xb7e7('0x5a')]=function(_0x46779c,_0x1c5579,_0x48aac5){var _0x18878c={};var _0xe8de73={};var _0x1c58dd;var _0x45ff1f;return db[_0xb7e7('0x44')][_0xb7e7('0x5b')]({'where':{'id':_0x46779c[_0xb7e7('0x55')]['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x1c5579,null))['then'](function(_0x4ea1b5){if(_0x4ea1b5){_0x1c58dd=_0x4ea1b5;_0xe8de73[_0xb7e7('0x37')]=_[_0xb7e7('0x34')](db[_0xb7e7('0x57')][_0xb7e7('0x30')]);_0xe8de73['query']=_['keys'](_0x46779c[_0xb7e7('0x35')]);_0xe8de73['filters']=_[_0xb7e7('0x36')](_0xe8de73['model'],_0xe8de73[_0xb7e7('0x35')]);_0x18878c[_0xb7e7('0x38')]=_[_0xb7e7('0x36')](_0xe8de73[_0xb7e7('0x37')],qs[_0xb7e7('0x4b')](_0x46779c['query']['fields']));_0x18878c[_0xb7e7('0x38')]=_0x18878c[_0xb7e7('0x38')][_0xb7e7('0x39')]?_0x18878c['attributes']:_0xe8de73[_0xb7e7('0x37')];_0x18878c[_0xb7e7('0x3c')]=qs[_0xb7e7('0x3d')](_0x46779c[_0xb7e7('0x35')][_0xb7e7('0x3d')]);_0x18878c['where']=qs[_0xb7e7('0x40')](_[_0xb7e7('0x3f')](_0x46779c[_0xb7e7('0x35')],_0xe8de73[_0xb7e7('0x40')]));if(_0x46779c[_0xb7e7('0x35')][_0xb7e7('0x41')]){_0x18878c[_0xb7e7('0x3e')]=_['merge'](_0x18878c['where'],{'$or':_[_0xb7e7('0x2f')](_0x18878c[_0xb7e7('0x38')],function(_0x49149f){var _0x3d1a67={};_0x3d1a67[_0x49149f]={'$like':'%'+_0x46779c[_0xb7e7('0x35')][_0xb7e7('0x41')]+'%'};return _0x3d1a67;})});}_0x18878c=_[_0xb7e7('0x42')]({},_0x18878c,_0x46779c[_0xb7e7('0x43')]);return _0x1c58dd[_0xb7e7('0x5a')](_0x18878c);}})[_0xb7e7('0x27')](function(_0x2b3c7b){if(_0x2b3c7b){_0x45ff1f=_0x2b3c7b[_0xb7e7('0x39')];if(!_0x46779c['query']['hasOwnProperty'](_0xb7e7('0x3b'))){_0x18878c['limit']=qs[_0xb7e7('0x1f')](_0x46779c[_0xb7e7('0x35')][_0xb7e7('0x1f')]);_0x18878c['offset']=qs[_0xb7e7('0x21')](_0x46779c['query']['offset']);}return _0x1c58dd[_0xb7e7('0x5a')](_0x18878c);}})[_0xb7e7('0x27')](function(_0x58b599){if(_0x58b599){return _0x58b599?{'count':_0x45ff1f,'rows':_0x58b599}:null;}})[_0xb7e7('0x27')](respondWithResult(_0x1c5579,null))[_0xb7e7('0x49')](handleError(_0x1c5579,null));};exports['getAnyConditions']=function(_0x512b06,_0x1f720f,_0x596fc5){var _0x443ba6={};var _0x114f72={};var _0x3390bd;var _0x4e3134;return db['Trigger'][_0xb7e7('0x5b')]({'where':{'id':_0x512b06[_0xb7e7('0x55')]['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x1f720f,null))['then'](function(_0x5910b6){if(_0x5910b6){_0x3390bd=_0x5910b6;_0x114f72[_0xb7e7('0x37')]=_[_0xb7e7('0x34')](db['Condition'][_0xb7e7('0x30')]);_0x114f72[_0xb7e7('0x35')]=_[_0xb7e7('0x34')](_0x512b06[_0xb7e7('0x35')]);_0x114f72[_0xb7e7('0x40')]=_[_0xb7e7('0x36')](_0x114f72['model'],_0x114f72['query']);_0x443ba6[_0xb7e7('0x38')]=_[_0xb7e7('0x36')](_0x114f72[_0xb7e7('0x37')],qs[_0xb7e7('0x4b')](_0x512b06[_0xb7e7('0x35')]['fields']));_0x443ba6[_0xb7e7('0x38')]=_0x443ba6[_0xb7e7('0x38')][_0xb7e7('0x39')]?_0x443ba6[_0xb7e7('0x38')]:_0x114f72['model'];_0x443ba6[_0xb7e7('0x3c')]=qs['sort'](_0x512b06[_0xb7e7('0x35')][_0xb7e7('0x3d')]);_0x443ba6[_0xb7e7('0x3e')]=qs['filters'](_[_0xb7e7('0x3f')](_0x512b06[_0xb7e7('0x35')],_0x114f72[_0xb7e7('0x40')]));if(_0x512b06[_0xb7e7('0x35')][_0xb7e7('0x41')]){_0x443ba6[_0xb7e7('0x3e')]=_[_0xb7e7('0x42')](_0x443ba6[_0xb7e7('0x3e')],{'$or':_[_0xb7e7('0x2f')](_0x443ba6[_0xb7e7('0x38')],function(_0x132c47){var _0x313f16={};_0x313f16[_0x132c47]={'$like':'%'+_0x512b06[_0xb7e7('0x35')]['filter']+'%'};return _0x313f16;})});}_0x443ba6=_['merge']({},_0x443ba6,_0x512b06[_0xb7e7('0x43')]);return _0x3390bd[_0xb7e7('0x5c')](_0x443ba6);}})[_0xb7e7('0x27')](function(_0x413ac5){if(_0x413ac5){_0x4e3134=_0x413ac5[_0xb7e7('0x39')];if(!_0x512b06[_0xb7e7('0x35')][_0xb7e7('0x3a')](_0xb7e7('0x3b'))){_0x443ba6[_0xb7e7('0x1f')]=qs[_0xb7e7('0x1f')](_0x512b06['query'][_0xb7e7('0x1f')]);_0x443ba6['offset']=qs[_0xb7e7('0x21')](_0x512b06[_0xb7e7('0x35')][_0xb7e7('0x21')]);}return _0x3390bd[_0xb7e7('0x5c')](_0x443ba6);}})[_0xb7e7('0x27')](function(_0xc3cbd8){if(_0xc3cbd8){return _0xc3cbd8?{'count':_0x4e3134,'rows':_0xc3cbd8}:null;}})[_0xb7e7('0x27')](respondWithResult(_0x1f720f,null))[_0xb7e7('0x49')](handleError(_0x1f720f,null));};exports['addAction']=function(_0xaf5292,_0x2d2058,_0x125aee){if(_0xaf5292['body']['id']){delete _0xaf5292[_0xb7e7('0x54')]['id'];}return db[_0xb7e7('0x44')][_0xb7e7('0x4c')]({'where':{'id':_0xaf5292[_0xb7e7('0x55')]['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x2d2058,null))[_0xb7e7('0x27')](function(_0x431ae5){if(_0x431ae5){_0xaf5292[_0xb7e7('0x54')][_0xb7e7('0x5d')]=_0x431ae5['id'];return db[_0xb7e7('0x5e')][_0xb7e7('0x4d')](_0xaf5292[_0xb7e7('0x54')]);}})[_0xb7e7('0x27')](respondWithResult(_0x2d2058,null))[_0xb7e7('0x49')](handleError(_0x2d2058,null));};exports[_0xb7e7('0x5f')]=function(_0x51c098,_0x1b1aec,_0x17daa8){var _0x4e94b7={};var _0x54f413={};var _0xe92040;var _0x296b7c;return db[_0xb7e7('0x44')][_0xb7e7('0x5b')]({'where':{'id':_0x51c098[_0xb7e7('0x55')]['id']}})[_0xb7e7('0x27')](handleEntityNotFound(_0x1b1aec,null))[_0xb7e7('0x27')](function(_0x5186d0){if(_0x5186d0){_0xe92040=_0x5186d0;_0x54f413[_0xb7e7('0x37')]=_[_0xb7e7('0x34')](db['Action'][_0xb7e7('0x30')]);_0x54f413[_0xb7e7('0x35')]=_[_0xb7e7('0x34')](_0x51c098['query']);_0x54f413[_0xb7e7('0x40')]=_[_0xb7e7('0x36')](_0x54f413[_0xb7e7('0x37')],_0x54f413[_0xb7e7('0x35')]);_0x4e94b7[_0xb7e7('0x38')]=_[_0xb7e7('0x36')](_0x54f413['model'],qs[_0xb7e7('0x4b')](_0x51c098['query']['fields']));_0x4e94b7[_0xb7e7('0x38')]=_0x4e94b7['attributes'][_0xb7e7('0x39')]?_0x4e94b7[_0xb7e7('0x38')]:_0x54f413[_0xb7e7('0x37')];_0x4e94b7[_0xb7e7('0x3c')]=qs[_0xb7e7('0x3d')](_0x51c098[_0xb7e7('0x35')][_0xb7e7('0x3d')]);_0x4e94b7[_0xb7e7('0x3e')]=qs['filters'](_[_0xb7e7('0x3f')](_0x51c098[_0xb7e7('0x35')],_0x54f413[_0xb7e7('0x40')]));if(_0x51c098[_0xb7e7('0x35')][_0xb7e7('0x41')]){_0x4e94b7[_0xb7e7('0x3e')]=_['merge'](_0x4e94b7[_0xb7e7('0x3e')],{'$or':_['map'](_0x4e94b7['attributes'],function(_0x190cb4){var _0x266e34={};_0x266e34[_0x190cb4]={'$like':'%'+_0x51c098[_0xb7e7('0x35')][_0xb7e7('0x41')]+'%'};return _0x266e34;})});}_0x4e94b7=_['merge']({},_0x4e94b7,_0x51c098[_0xb7e7('0x43')]);return _0xe92040['getActions'](_0x4e94b7);}})['then'](function(_0xf1e9f5){if(_0xf1e9f5){_0x296b7c=_0xf1e9f5[_0xb7e7('0x39')];if(!_0x51c098['query'][_0xb7e7('0x3a')]('nolimit')){_0x4e94b7[_0xb7e7('0x1f')]=qs[_0xb7e7('0x1f')](_0x51c098[_0xb7e7('0x35')]['limit']);_0x4e94b7[_0xb7e7('0x21')]=qs[_0xb7e7('0x21')](_0x51c098[_0xb7e7('0x35')][_0xb7e7('0x21')]);}return _0xe92040[_0xb7e7('0x5f')](_0x4e94b7);}})['then'](function(_0x52c3e4){if(_0x52c3e4){return _0x52c3e4?{'count':_0x296b7c,'rows':_0x52c3e4}:null;}})[_0xb7e7('0x27')](respondWithResult(_0x1b1aec,null))[_0xb7e7('0x49')](handleError(_0x1b1aec,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 921873c..c4021fb 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x48b263,_0x4dae59){var _0x186a57=function(_0xb10ed3){while(--_0xb10ed3){_0x48b263['push'](_0x48b263['shift']());}};_0x186a57(++_0x4dae59);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4d2c26,_0x2701f9){_0x4d2c26=_0x4d2c26-0x0;var _0x5bf9b4=_0xf3cd[_0x4d2c26];return _0x5bf9b4;};'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('./trigger.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 +var _0x2d17=['define','tools_triggers','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x5505eb,_0x5cba04){var _0x15f451=function(_0x57f4e5){while(--_0x57f4e5){_0x5505eb['push'](_0x5505eb['shift']());}};_0x15f451(++_0x5cba04);}(_0x2d17,0x17e));var _0x72d1=function(_0x57aaa7,_0x10f17b){_0x57aaa7=_0x57aaa7-0x0;var _0x19e0fc=_0x2d17[_0x57aaa7];return _0x19e0fc;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./trigger.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('Trigger',attributes,{'tableName':_0x72d1('0x9'),'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 92d8c03..30afdd6 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 _0xb537=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowTrigger','find','where','lodash','moment','randomstring'];(function(_0xcfbc99,_0xde1d4c){var _0x260b33=function(_0x8e9a13){while(--_0x8e9a13){_0xcfbc99['push'](_0xcfbc99['shift']());}};_0x260b33(++_0xde1d4c);}(_0xb537,0x138));var _0x7b53=function(_0x1b3422,_0x56ad35){_0x1b3422=_0x1b3422-0x0;var _0x5f0227=_0xb537[_0x1b3422];return _0x5f0227;};'use strict';var _=require(_0x7b53('0x0'));var util=require('util');var moment=require(_0x7b53('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b53('0x2'));var fs=require('fs');var Redis=require(_0x7b53('0x3'));var db=require(_0x7b53('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b53('0x5'));var config=require(_0x7b53('0x6'));var jayson=require(_0x7b53('0x7'));var client=jayson[_0x7b53('0x8')][_0x7b53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x566f6e,_0x534643,_0x5ba8fb){return new BPromise(function(_0x365771,_0x233f37){return client['request'](_0x566f6e,_0x5ba8fb)[_0x7b53('0xa')](function(_0x544c05){logger['info'](_0x7b53('0xb'),_0x534643,_0x7b53('0xc'));logger[_0x7b53('0xd')](_0x7b53('0xe'),_0x534643,_0x7b53('0xc'),JSON['stringify'](_0x544c05));if(_0x544c05[_0x7b53('0xf')]){if(_0x544c05['error'][_0x7b53('0x10')]===0x1f4){logger['error'](_0x7b53('0xb'),_0x534643,_0x544c05[_0x7b53('0xf')][_0x7b53('0x11')]);return _0x233f37(_0x544c05[_0x7b53('0xf')][_0x7b53('0x11')]);}logger[_0x7b53('0xf')](_0x7b53('0xb'),_0x534643,_0x544c05[_0x7b53('0xf')][_0x7b53('0x11')]);return _0x365771(_0x544c05[_0x7b53('0xf')][_0x7b53('0x11')]);}else{logger[_0x7b53('0x12')](_0x7b53('0xb'),_0x534643,_0x7b53('0xc'));_0x365771(_0x544c05[_0x7b53('0x13')][_0x7b53('0x11')]);}})[_0x7b53('0x14')](function(_0x431d8d){logger['error'](_0x7b53('0xb'),_0x534643,_0x431d8d);_0x233f37(_0x431d8d);});});}exports[_0x7b53('0x15')]=function(_0x400ac8){var _0x3e4927=this;return new Promise(function(_0x126834,_0x4c9190){return db[_0x7b53('0x16')][_0x7b53('0x17')]({'raw':_0x400ac8[_0x7b53('0x18')]?_0x400ac8[_0x7b53('0x18')][_0x7b53('0x19')]===undefined?!![]:![]:!![],'where':_0x400ac8[_0x7b53('0x18')]?_0x400ac8[_0x7b53('0x18')]['where']||null:null,'attributes':_0x400ac8[_0x7b53('0x18')]?_0x400ac8[_0x7b53('0x18')][_0x7b53('0x1a')]||null:null,'limit':_0x400ac8[_0x7b53('0x18')]?_0x400ac8['options'][_0x7b53('0x1b')]||null:null,'include':_0x400ac8[_0x7b53('0x18')]?_0x400ac8[_0x7b53('0x18')][_0x7b53('0x1c')]?_[_0x7b53('0x1d')](_0x400ac8[_0x7b53('0x18')]['include'],function(_0x3df661){return{'model':db[_0x3df661[_0x7b53('0x1e')]],'as':_0x3df661['as'],'attributes':_0x3df661[_0x7b53('0x1a')],'include':_0x3df661['include']?_[_0x7b53('0x1d')](_0x3df661[_0x7b53('0x1c')],function(_0x1e9156){return{'model':db[_0x1e9156[_0x7b53('0x1e')]],'as':_0x1e9156['as'],'attributes':_0x1e9156[_0x7b53('0x1a')],'include':_0x1e9156[_0x7b53('0x1c')]?_[_0x7b53('0x1d')](_0x1e9156['include'],function(_0x335199){return{'model':db[_0x335199[_0x7b53('0x1e')]],'as':_0x335199['as'],'attributes':_0x335199[_0x7b53('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb6ffc7){logger['info'](_0x7b53('0x15'),_0x400ac8);logger[_0x7b53('0xd')](_0x7b53('0x15'),_0x400ac8,JSON[_0x7b53('0x1f')](_0xb6ffc7));_0x126834(_0xb6ffc7);})['catch'](function(_0x22b70e){logger[_0x7b53('0xf')](_0x7b53('0x15'),_0x22b70e[_0x7b53('0x11')],_0x400ac8);_0x4c9190(_0x3e4927[_0x7b53('0xf')](0x1f4,_0x22b70e['message']));});});};exports[_0x7b53('0x20')]=function(_0x23641b){var _0x3e6733=this;return new Promise(function(_0x466081,_0x42ab91){return db[_0x7b53('0x16')][_0x7b53('0x21')]({'raw':_0x23641b[_0x7b53('0x18')]?_0x23641b[_0x7b53('0x18')][_0x7b53('0x19')]===undefined?!![]:![]:!![],'where':_0x23641b[_0x7b53('0x18')]?_0x23641b[_0x7b53('0x18')][_0x7b53('0x22')]||null:null,'attributes':_0x23641b[_0x7b53('0x18')]?_0x23641b['options'][_0x7b53('0x1a')]||null:null,'include':_0x23641b[_0x7b53('0x18')]?_0x23641b[_0x7b53('0x18')][_0x7b53('0x1c')]?_['map'](_0x23641b[_0x7b53('0x18')][_0x7b53('0x1c')],function(_0x5ab54d){return{'model':db[_0x5ab54d['model']],'as':_0x5ab54d['as'],'attributes':_0x5ab54d[_0x7b53('0x1a')],'include':_0x5ab54d[_0x7b53('0x1c')]?_[_0x7b53('0x1d')](_0x5ab54d[_0x7b53('0x1c')],function(_0x36f62f){return{'model':db[_0x36f62f[_0x7b53('0x1e')]],'as':_0x36f62f['as'],'attributes':_0x36f62f['attributes'],'include':_0x36f62f['include']?_[_0x7b53('0x1d')](_0x36f62f[_0x7b53('0x1c')],function(_0x24df13){return{'model':db[_0x24df13[_0x7b53('0x1e')]],'as':_0x24df13['as'],'attributes':_0x24df13[_0x7b53('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7b53('0xa')](function(_0x1dad0b){logger['info'](_0x7b53('0x20'),_0x23641b);logger[_0x7b53('0xd')](_0x7b53('0x20'),_0x23641b,JSON[_0x7b53('0x1f')](_0x1dad0b));_0x466081(_0x1dad0b);})['catch'](function(_0x6847e5){logger[_0x7b53('0xf')](_0x7b53('0x20'),_0x6847e5['message'],_0x23641b);_0x42ab91(_0x3e6733['error'](0x1f4,_0x6847e5['message']));});});}; \ No newline at end of file +var _0x6957=['request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','include','map','model','attributes','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s'];(function(_0x4c68b0,_0x1c13d6){var _0x50ae4c=function(_0x51c729){while(--_0x51c729){_0x4c68b0['push'](_0x4c68b0['shift']());}};_0x50ae4c(++_0x1c13d6);}(_0x6957,0xe5));var _0x7695=function(_0x3e3687,_0x3d4535){_0x3e3687=_0x3e3687-0x0;var _0xfc13d=_0x6957[_0x3e3687];return _0xfc13d;};'use strict';var _=require(_0x7695('0x0'));var util=require(_0x7695('0x1'));var moment=require(_0x7695('0x2'));var BPromise=require(_0x7695('0x3'));var rs=require(_0x7695('0x4'));var fs=require('fs');var Redis=require(_0x7695('0x5'));var db=require(_0x7695('0x6'))['db'];var utils=require(_0x7695('0x7'));var logger=require('../../config/logger')(_0x7695('0x8'));var config=require(_0x7695('0x9'));var jayson=require(_0x7695('0xa'));var client=jayson[_0x7695('0xb')][_0x7695('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3360e8,_0x526592,_0x4287fb){return new BPromise(function(_0xb6e3ad,_0x38cc8e){return client['request'](_0x3360e8,_0x4287fb)[_0x7695('0xd')](function(_0x51a0bf){logger[_0x7695('0xe')](_0x7695('0xf'),_0x526592,_0x7695('0x10'));logger[_0x7695('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x526592,_0x7695('0x10'),JSON[_0x7695('0x12')](_0x51a0bf));if(_0x51a0bf['error']){if(_0x51a0bf[_0x7695('0x13')][_0x7695('0x14')]===0x1f4){logger[_0x7695('0x13')](_0x7695('0xf'),_0x526592,_0x51a0bf[_0x7695('0x13')][_0x7695('0x15')]);return _0x38cc8e(_0x51a0bf[_0x7695('0x13')][_0x7695('0x15')]);}logger[_0x7695('0x13')](_0x7695('0xf'),_0x526592,_0x51a0bf[_0x7695('0x13')][_0x7695('0x15')]);return _0xb6e3ad(_0x51a0bf[_0x7695('0x13')][_0x7695('0x15')]);}else{logger[_0x7695('0xe')](_0x7695('0xf'),_0x526592,_0x7695('0x10'));_0xb6e3ad(_0x51a0bf[_0x7695('0x16')]['message']);}})[_0x7695('0x17')](function(_0xe356aa){logger['error'](_0x7695('0xf'),_0x526592,_0xe356aa);_0x38cc8e(_0xe356aa);});});}exports[_0x7695('0x18')]=function(_0x254125){var _0x182733=this;return new Promise(function(_0x3fb6be,_0x28e19e){return db[_0x7695('0x19')]['findAll']({'raw':_0x254125['options']?_0x254125[_0x7695('0x1a')][_0x7695('0x1b')]===undefined?!![]:![]:!![],'where':_0x254125[_0x7695('0x1a')]?_0x254125['options'][_0x7695('0x1c')]||null:null,'attributes':_0x254125['options']?_0x254125[_0x7695('0x1a')]['attributes']||null:null,'limit':_0x254125[_0x7695('0x1a')]?_0x254125[_0x7695('0x1a')]['limit']||null:null,'include':_0x254125[_0x7695('0x1a')]?_0x254125['options'][_0x7695('0x1d')]?_[_0x7695('0x1e')](_0x254125[_0x7695('0x1a')]['include'],function(_0x1ed4b1){return{'model':db[_0x1ed4b1[_0x7695('0x1f')]],'as':_0x1ed4b1['as'],'attributes':_0x1ed4b1[_0x7695('0x20')],'include':_0x1ed4b1[_0x7695('0x1d')]?_[_0x7695('0x1e')](_0x1ed4b1['include'],function(_0x5ca786){return{'model':db[_0x5ca786[_0x7695('0x1f')]],'as':_0x5ca786['as'],'attributes':_0x5ca786['attributes'],'include':_0x5ca786['include']?_[_0x7695('0x1e')](_0x5ca786[_0x7695('0x1d')],function(_0x249fd9){return{'model':db[_0x249fd9[_0x7695('0x1f')]],'as':_0x249fd9['as'],'attributes':_0x249fd9[_0x7695('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7695('0xd')](function(_0x244e87){logger[_0x7695('0xe')](_0x7695('0x18'),_0x254125);logger[_0x7695('0x11')]('GetTrigger',_0x254125,JSON[_0x7695('0x12')](_0x244e87));_0x3fb6be(_0x244e87);})['catch'](function(_0x17f868){logger[_0x7695('0x13')](_0x7695('0x18'),_0x17f868[_0x7695('0x15')],_0x254125);_0x28e19e(_0x182733[_0x7695('0x13')](0x1f4,_0x17f868[_0x7695('0x15')]));});});};exports[_0x7695('0x21')]=function(_0x364820){var _0x1cf3bc=this;return new Promise(function(_0x2b40ee,_0x165be4){return db[_0x7695('0x19')][_0x7695('0x22')]({'raw':_0x364820['options']?_0x364820[_0x7695('0x1a')][_0x7695('0x1b')]===undefined?!![]:![]:!![],'where':_0x364820[_0x7695('0x1a')]?_0x364820[_0x7695('0x1a')][_0x7695('0x1c')]||null:null,'attributes':_0x364820[_0x7695('0x1a')]?_0x364820[_0x7695('0x1a')]['attributes']||null:null,'include':_0x364820['options']?_0x364820[_0x7695('0x1a')][_0x7695('0x1d')]?_[_0x7695('0x1e')](_0x364820['options'][_0x7695('0x1d')],function(_0x15d699){return{'model':db[_0x15d699[_0x7695('0x1f')]],'as':_0x15d699['as'],'attributes':_0x15d699[_0x7695('0x20')],'include':_0x15d699[_0x7695('0x1d')]?_['map'](_0x15d699[_0x7695('0x1d')],function(_0x56431d){return{'model':db[_0x56431d['model']],'as':_0x56431d['as'],'attributes':_0x56431d[_0x7695('0x20')],'include':_0x56431d[_0x7695('0x1d')]?_[_0x7695('0x1e')](_0x56431d[_0x7695('0x1d')],function(_0x47a21d){return{'model':db[_0x47a21d[_0x7695('0x1f')]],'as':_0x47a21d['as'],'attributes':_0x47a21d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7695('0xd')](function(_0x48170b){logger[_0x7695('0xe')](_0x7695('0x21'),_0x364820);logger[_0x7695('0x11')](_0x7695('0x21'),_0x364820,JSON[_0x7695('0x12')](_0x48170b));_0x2b40ee(_0x48170b);})[_0x7695('0x17')](function(_0x4a3a25){logger['error'](_0x7695('0x21'),_0x4a3a25['message'],_0x364820);_0x165be4(_0x1cf3bc['error'](0x1f4,_0x4a3a25[_0x7695('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index fc961e8..9886c9a 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 _0x20ab=['clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','post','/:id/clone'];(function(_0x5dad94,_0x388d38){var _0x590218=function(_0x519d8f){while(--_0x519d8f){_0x5dad94['push'](_0x5dad94['shift']());}};_0x590218(++_0x388d38);}(_0x20ab,0x18e));var _0xb20a=function(_0x14652e,_0x59fb87){_0x14652e=_0x14652e-0x0;var _0x1e3b87=_0x20ab[_0x14652e];return _0x1e3b87;};'use strict';var multer=require(_0xb20a('0x0'));var util=require(_0xb20a('0x1'));var path=require(_0xb20a('0x2'));var timeout=require(_0xb20a('0x3'));var express=require(_0xb20a('0x4'));var router=express[_0xb20a('0x5')]();var fs_extra=require(_0xb20a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb20a('0x7'));var config=require(_0xb20a('0x8'));var controller=require(_0xb20a('0x9'));router[_0xb20a('0xa')]('/',auth['isAuthenticated'](),controller[_0xb20a('0xb')]);router['get'](_0xb20a('0xc'),auth[_0xb20a('0xd')](),controller['show']);router[_0xb20a('0xe')](_0xb20a('0xf'),auth[_0xb20a('0xd')](),controller[_0xb20a('0x10')]);router[_0xb20a('0xe')]('/',auth['isAuthenticated'](),controller[_0xb20a('0x11')]);router[_0xb20a('0x12')](_0xb20a('0xc'),auth[_0xb20a('0xd')](),controller[_0xb20a('0x13')]);router[_0xb20a('0x14')](_0xb20a('0xc'),auth[_0xb20a('0xd')](),controller[_0xb20a('0x15')]);module[_0xb20a('0x16')]=router; \ No newline at end of file +var _0x8177=['../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','clone','update','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4391c6,_0x549dad){var _0x4dcf43=function(_0x295cf3){while(--_0x295cf3){_0x4391c6['push'](_0x4391c6['shift']());}};_0x4dcf43(++_0x549dad);}(_0x8177,0x78));var _0x7817=function(_0x56631b,_0xf16088){_0x56631b=_0x56631b-0x0;var _0x599fca=_0x8177[_0x56631b];return _0x599fca;};'use strict';var multer=require(_0x7817('0x0'));var util=require('util');var path=require(_0x7817('0x1'));var timeout=require(_0x7817('0x2'));var express=require(_0x7817('0x3'));var router=express[_0x7817('0x4')]();var fs_extra=require(_0x7817('0x5'));var auth=require(_0x7817('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7817('0x7'));var controller=require(_0x7817('0x8'));router['get']('/',auth[_0x7817('0x9')](),controller[_0x7817('0xa')]);router[_0x7817('0xb')](_0x7817('0xc'),auth[_0x7817('0x9')](),controller[_0x7817('0xd')]);router[_0x7817('0xe')]('/:id/clone',auth[_0x7817('0x9')](),controller[_0x7817('0xf')]);router['post']('/',auth[_0x7817('0x9')](),controller['create']);router['put'](_0x7817('0xc'),auth[_0x7817('0x9')](),controller[_0x7817('0x10')]);router['delete']('/:id',auth[_0x7817('0x9')](),controller[_0x7817('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 08b212e..125f04c 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 _0x9585=['pai','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','rfc2833','info','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','split','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','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac'];(function(_0x253806,_0x3cf272){var _0x369f4d=function(_0x2c1409){while(--_0x2c1409){_0x253806['push'](_0x253806['shift']());}};_0x369f4d(++_0x3cf272);}(_0x9585,0x15e));var _0x5958=function(_0x38323e,_0x5f55bf){_0x38323e=_0x38323e-0x0;var _0x1536f0=_0x9585[_0x38323e];return _0x1536f0;};'use strict';var Sequelize=require('sequelize');module[_0x5958('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5958('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x3'),_0x5958('0x4'),_0x5958('0x5')),'allowNull':![],'defaultValue':_0x5958('0x3')},'context':{'type':Sequelize[_0x5958('0x6')],'allowNull':![],'defaultValue':_0x5958('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x5958('0x8'),'ALLOWED_PASSED_SCREEN',_0x5958('0x9'),_0x5958('0xa'),_0x5958('0xb'),'PROHIB_PASSED_SCREEN',_0x5958('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x5958('0x6')]},'permit':{'type':Sequelize[_0x5958('0x6')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x5958('0x6')]},'transport':{'type':Sequelize[_0x5958('0x6')],'defaultValue':_0x5958('0xd'),'set':function(_0x22967b){this[_0x5958('0xe')]('transport',_0x22967b?_0x22967b[_0x5958('0xf')](','):null);},'get':function(){return this[_0x5958('0x10')](_0x5958('0x11'))?this[_0x5958('0x10')](_0x5958('0x11'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x12'),_0x5958('0x13'),'shortinfo',_0x5958('0x14'),_0x5958('0x15')),'defaultValue':_0x5958('0x12')},'directmedia':{'type':Sequelize[_0x5958('0x2')]('yes','no',_0x5958('0x16'),_0x5958('0x17'),_0x5958('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5958('0x6')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x5958('0x6')],'defaultValue':_0x5958('0x1a'),'set':function(_0x146ef3){this[_0x5958('0xe')](_0x5958('0x1b'),_0x146ef3?_0x146ef3['join'](','):null);},'get':function(){return this[_0x5958('0x10')](_0x5958('0x1b'))?this[_0x5958('0x10')](_0x5958('0x1b'))[_0x5958('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5958('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x5958('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5958('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5958('0x6')],'defaultValue':_0x5958('0x1d')},'allow':{'type':Sequelize[_0x5958('0x6')],'allowNull':![],'defaultValue':_0x5958('0x1e'),'set':function(_0x588945){this['setDataValue']('allow',_0x588945?_0x588945[_0x5958('0xf')](';'):_0x5958('0x1e'));},'get':function(){return this[_0x5958('0x10')](_0x5958('0x1f'))?this['getDataValue'](_0x5958('0x1f'))[_0x5958('0x1c')](';'):null;},'comment':_0x5958('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0x5958('0x19'),'no')},'insecure':{'type':Sequelize[_0x5958('0x6')],'defaultValue':_0x5958('0x21'),'set':function(_0x29b7f7){this[_0x5958('0xe')](_0x5958('0x22'),_0x29b7f7?_0x29b7f7[_0x5958('0xf')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x5958('0x10')](_0x5958('0x22'))[_0x5958('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no',_0x5958('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no')},'accountcode':{'type':Sequelize[_0x5958('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x5958('0x25')},'amaflags':{'type':Sequelize[_0x5958('0x6')]},'callcounter':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no'),'defaultValue':_0x5958('0x19')},'busylevel':{'type':Sequelize[_0x5958('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x5958('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x5958('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x5958('0x6')]},'template':{'type':Sequelize[_0x5958('0x6')]},'videosupport':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no',_0x5958('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no')},'mailbox':{'type':Sequelize[_0x5958('0x6')]},'session_timers':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x27'),_0x5958('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x5958('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x5958('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x29'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x5958('0x6')]},'regexten':{'type':Sequelize[_0x5958('0x6')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x5958('0x6')]},'port':{'type':Sequelize[_0x5958('0x24')](0x5)},'qualify':{'type':Sequelize[_0x5958('0x2')]('yes','no'),'defaultValue':_0x5958('0x19')},'keepalive':{'type':Sequelize[_0x5958('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x5958('0x6')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x5958('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5958('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5958('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no',_0x5958('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5958('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x5958('0x24')](0xb)},'timerb':{'type':Sequelize[_0x5958('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x5958('0x6')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x5958('0x6')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x5958('0x6')]},'maxforwards':{'type':Sequelize[_0x5958('0x24')](0xb)},'encryption':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5958('0x19'),'no')},'force_avp':{'type':Sequelize[_0x5958('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x5958('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no',_0x5958('0x2b'),_0x5958('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x5958('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x5958('0x6')]},'dtlscipher':{'type':Sequelize[_0x5958('0x6')]},'dtlscafile':{'type':Sequelize[_0x5958('0x6')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x5958('0x2')]('active',_0x5958('0x2d'),_0x5958('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5958('0x6')]},'recordofffeature':{'type':Sequelize[_0x5958('0x6')]},'call_limit':{'type':Sequelize[_0x5958('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5958('0x2')](_0x5958('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x5958('0x19'),'no')},'vmexten':{'type':Sequelize[_0x5958('0x6')]},'mohinterpret':{'type':Sequelize[_0x5958('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x5958('0x6')]},'description':{'type':Sequelize[_0x5958('0x6')]},'host':{'type':Sequelize[_0x5958('0x6')],'defaultValue':_0x5958('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x5958('0x19'),'no',_0x5958('0x16'),_0x5958('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5958('0x6')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5958('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xc1ff=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','originate','uas','fingerprint','passive','actpass','dynamic','update','update,nonat','BOOLEAN','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','STRING','setDataValue','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','rfc2833','yes','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x350c87,_0x2b44ef){var _0x163800=function(_0xb99c9){while(--_0xb99c9){_0x350c87['push'](_0x350c87['shift']());}};_0x163800(++_0x2b44ef);}(_0xc1ff,0xb9));var _0xfc1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ff[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xfc1f('0x0'),_0xfc1f('0x1'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfc1f('0x2')},'callingpres':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x4'),_0xfc1f('0x5'),_0xfc1f('0x6'),'ALLOWED','PROHIB_NOT_SCREENED',_0xfc1f('0x7'),_0xfc1f('0x8'),'PROHIB')},'deny':{'type':Sequelize[_0xfc1f('0x9')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xfc1f('0x9')]},'md5secret':{'type':Sequelize[_0xfc1f('0x9')]},'remotesecret':{'type':Sequelize[_0xfc1f('0x9')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x7c7095){this[_0xfc1f('0xa')]('transport',_0x7c7095?_0x7c7095[_0xfc1f('0xb')](','):null);},'get':function(){return this['getDataValue'](_0xfc1f('0xc'))?this['getDataValue'](_0xfc1f('0xc'))[_0xfc1f('0xd')](','):null;},'comment':_0xfc1f('0xe')},'dtmfmode':{'type':Sequelize[_0xfc1f('0x3')]('rfc2833','info',_0xfc1f('0xf'),'inband','auto'),'defaultValue':_0xfc1f('0x10')},'directmedia':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no','nonat','update',_0xfc1f('0x12')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfc1f('0x9')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xfc1f('0x13'),'set':function(_0x3035e0){this[_0xfc1f('0xa')](_0xfc1f('0x14'),_0x3035e0?_0x3035e0[_0xfc1f('0xb')](','):null);},'get':function(){return this[_0xfc1f('0x15')]('nat')?this[_0xfc1f('0x15')](_0xfc1f('0x14'))[_0xfc1f('0xd')](','):null;},'comment':_0xfc1f('0x16')},'callgroup':{'type':Sequelize[_0xfc1f('0x9')]},'namedcallgroup':{'type':Sequelize[_0xfc1f('0x9')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xfc1f('0x9')]},'language':{'type':Sequelize[_0xfc1f('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfc1f('0x9')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xfc1f('0x9')],'defaultValue':_0xfc1f('0x17')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfc1f('0x18'),'set':function(_0x50175c){this[_0xfc1f('0xa')](_0xfc1f('0x19'),_0x50175c?_0x50175c['join'](';'):_0xfc1f('0x18'));},'get':function(){return this[_0xfc1f('0x15')](_0xfc1f('0x19'))?this[_0xfc1f('0x15')](_0xfc1f('0x19'))[_0xfc1f('0xd')](';'):null;},'comment':_0xfc1f('0x1a')},'autoframing':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x455cc0){this[_0xfc1f('0xa')](_0xfc1f('0x1b'),_0x455cc0?_0x455cc0[_0xfc1f('0xb')](','):null);},'get':function(){return this[_0xfc1f('0x15')](_0xfc1f('0x1b'))?this[_0xfc1f('0x15')](_0xfc1f('0x1b'))[_0xfc1f('0xd')](','):null;},'comment':_0xfc1f('0x1c')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfc1f('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no',_0xfc1f('0x1d'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'accountcode':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xfc1f('0x1f')},'amaflags':{'type':Sequelize[_0xfc1f('0x9')]},'callcounter':{'type':Sequelize[_0xfc1f('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'allowoverlap':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'allowsubscribe':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'allowtransfer':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xfc1f('0x11'),'no')},'subscribecontext':{'type':Sequelize[_0xfc1f('0x9')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xfc1f('0x20')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xfc1f('0x3')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xfc1f('0x3')]('accept','refuse',_0xfc1f('0x21'))},'session_expires':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xfc1f('0x22')),'defaultValue':_0xfc1f('0x22')},'t38pt_usertpsource':{'type':Sequelize[_0xfc1f('0x9')]},'regexten':{'type':Sequelize[_0xfc1f('0x9')]},'fromdomain':{'type':Sequelize[_0xfc1f('0x9')]},'fromuser':{'type':Sequelize[_0xfc1f('0x9')]},'port':{'type':Sequelize[_0xfc1f('0x1e')](0x5)},'qualify':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xfc1f('0x9')]},'defaultuser':{'type':Sequelize[_0xfc1f('0x9')]},'rtptimeout':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'sendrpid':{'type':Sequelize[_0xfc1f('0x3')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfc1f('0x9')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xfc1f('0x9')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xfc1f('0x9')]},'unsolicited_mailbox':{'type':Sequelize[_0xfc1f('0x9')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfc1f('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xfc1f('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no',_0xfc1f('0x23'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xfc1f('0x1e')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xfc1f('0x9')]},'dtlscafile':{'type':Sequelize[_0xfc1f('0x9')]},'dtlscapath':{'type':Sequelize[_0xfc1f('0x9')]},'dtlssetup':{'type':Sequelize[_0xfc1f('0x3')]('active',_0xfc1f('0x24'),_0xfc1f('0x25')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfc1f('0x9')]},'usereqphone':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfc1f('0x9')]},'recordofffeature':{'type':Sequelize[_0xfc1f('0x9')]},'call_limit':{'type':Sequelize[_0xfc1f('0x1e')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'subscribemwi':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no')},'vmexten':{'type':Sequelize[_0xfc1f('0x9')]},'mohinterpret':{'type':Sequelize[_0xfc1f('0x9')]},'mohsuggest':{'type':Sequelize[_0xfc1f('0x9')]},'parkinglot':{'type':Sequelize[_0xfc1f('0x9')]},'description':{'type':Sequelize[_0xfc1f('0x9')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xfc1f('0x26')},'canreinvite':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x11'),'no','nonat',_0xfc1f('0x27'),_0xfc1f('0x28')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xfc1f('0x9')]},'active':{'type':Sequelize[_0xfc1f('0x29')],'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 185c39b..05c259e 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 _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x12c289,_0x3376b8){var _0x9e28d5=function(_0x33cb58){while(--_0x33cb58){_0x12c289['push'](_0x12c289['shift']());}};_0x9e28d5(++_0x3376b8);}(_0x9f62,0x154));var _0x29f6=function(_0x78779e,_0x175e4f){_0x78779e=_0x78779e-0x0;var _0x289b1a=_0x9f62[_0x78779e];return _0x289b1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x1cd726,_0x2bf581){var _0x179932=function(_0x1eadbc){while(--_0x1eadbc){_0x1cd726['push'](_0x1cd726['shift']());}};_0x179932(++_0x2bf581);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2a3527,_0x43ee54){_0x2a3527=_0x2a3527-0x0;var _0x4b920d=_0x9bde[_0x2a3527];return _0x4b920d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1ea780d..4b77c29 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 _0x96b5=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash'];(function(_0x35d458,_0x380e93){var _0x449599=function(_0x266e51){while(--_0x266e51){_0x35d458['push'](_0x35d458['shift']());}};_0x449599(++_0x380e93);}(_0x96b5,0x11d));var _0x596b=function(_0x275bb9,_0x30596a){_0x275bb9=_0x275bb9-0x0;var _0x65cd1d=_0x96b5[_0x275bb9];return _0x65cd1d;};'use strict';var _=require(_0x596b('0x0'));var util=require(_0x596b('0x1'));var logger=require(_0x596b('0x2'))(_0x596b('0x3'));var moment=require(_0x596b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x596b('0x5'));var rimraf=require(_0x596b('0x6'));var config=require(_0x596b('0x7'));var attributes=require(_0x596b('0x8'));module[_0x596b('0x9')]=function(_0x2837fc,_0x12aa45){return _0x2837fc[_0x596b('0xa')](_0x596b('0xb'),attributes,{'tableName':_0x596b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa890=['define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa890,0x162));var _0x0a89=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xa890[_0x33554b];return _0x256954;};'use strict';var _=require(_0x0a89('0x0'));var util=require(_0x0a89('0x1'));var logger=require(_0x0a89('0x2'))('api');var moment=require(_0x0a89('0x3'));var BPromise=require(_0x0a89('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a89('0x5'));var rimraf=require(_0x0a89('0x6'));var config=require(_0x0a89('0x7'));var attributes=require(_0x0a89('0x8'));module[_0x0a89('0x9')]=function(_0x282955,_0x3f9bf2){return _0x282955[_0x0a89('0xa')](_0x0a89('0xb'),attributes,{'tableName':_0x0a89('0xc'),'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 6cc737a..d70e072 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 _0xb68a=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','findAll','options','raw','where','attributes','include','map','model','then','ShowTrunk','Trunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb68a,0xac));var _0xab68=function(_0x45daf0,_0x57883f){_0x45daf0=_0x45daf0-0x0;var _0x21dcbe=_0xb68a[_0x45daf0];return _0x21dcbe;};'use strict';var _=require(_0xab68('0x0'));var util=require(_0xab68('0x1'));var moment=require(_0xab68('0x2'));var BPromise=require(_0xab68('0x3'));var rs=require(_0xab68('0x4'));var fs=require('fs');var Redis=require(_0xab68('0x5'));var db=require(_0xab68('0x6'))['db'];var utils=require(_0xab68('0x7'));var logger=require(_0xab68('0x8'))(_0xab68('0x9'));var config=require(_0xab68('0xa'));var jayson=require(_0xab68('0xb'));var client=jayson[_0xab68('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3620ab,_0x1292c4,_0xc9815c){return new BPromise(function(_0x3c2df5,_0x31c948){return client['request'](_0x3620ab,_0xc9815c)['then'](function(_0x26c76a){logger[_0xab68('0xd')](_0xab68('0xe'),_0x1292c4,_0xab68('0xf'));logger[_0xab68('0x10')](_0xab68('0x11'),_0x1292c4,'request\x20sent',JSON[_0xab68('0x12')](_0x26c76a));if(_0x26c76a['error']){if(_0x26c76a[_0xab68('0x13')][_0xab68('0x14')]===0x1f4){logger[_0xab68('0x13')](_0xab68('0xe'),_0x1292c4,_0x26c76a[_0xab68('0x13')]['message']);return _0x31c948(_0x26c76a[_0xab68('0x13')][_0xab68('0x15')]);}logger[_0xab68('0x13')]('Trunk,\x20%s,\x20%s',_0x1292c4,_0x26c76a[_0xab68('0x13')]['message']);return _0x3c2df5(_0x26c76a[_0xab68('0x13')]['message']);}else{logger[_0xab68('0xd')](_0xab68('0xe'),_0x1292c4,_0xab68('0xf'));_0x3c2df5(_0x26c76a[_0xab68('0x16')][_0xab68('0x15')]);}})[_0xab68('0x17')](function(_0x5a9aa7){logger[_0xab68('0x13')]('Trunk,\x20%s,\x20%s',_0x1292c4,_0x5a9aa7);_0x31c948(_0x5a9aa7);});});}exports[_0xab68('0x18')]=function(_0xdf7458){var _0x31f21d=this;return new Promise(function(_0x1c8810,_0x176ed1){return db['Trunk'][_0xab68('0x19')]({'raw':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')][_0xab68('0x1b')]===undefined?!![]:![]:!![],'where':_0xdf7458['options']?_0xdf7458['options'][_0xab68('0x1c')]||null:null,'attributes':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')][_0xab68('0x1d')]||null:null,'limit':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')]['limit']||null:null,'include':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')][_0xab68('0x1e')]?_[_0xab68('0x1f')](_0xdf7458[_0xab68('0x1a')]['include'],function(_0x5a8a6f){return{'model':db[_0x5a8a6f[_0xab68('0x20')]],'as':_0x5a8a6f['as'],'attributes':_0x5a8a6f[_0xab68('0x1d')],'include':_0x5a8a6f['include']?_[_0xab68('0x1f')](_0x5a8a6f[_0xab68('0x1e')],function(_0x736118){return{'model':db[_0x736118[_0xab68('0x20')]],'as':_0x736118['as'],'attributes':_0x736118[_0xab68('0x1d')],'include':_0x736118['include']?_[_0xab68('0x1f')](_0x736118[_0xab68('0x1e')],function(_0x139d93){return{'model':db[_0x139d93[_0xab68('0x20')]],'as':_0x139d93['as'],'attributes':_0x139d93['attributes']};}):[]};}):[]};}):[]:[]})[_0xab68('0x21')](function(_0x235ae0){logger[_0xab68('0xd')](_0xab68('0x18'),_0xdf7458);logger[_0xab68('0x10')]('GetTrunk',_0xdf7458,JSON[_0xab68('0x12')](_0x235ae0));_0x1c8810(_0x235ae0);})[_0xab68('0x17')](function(_0x4af83a){logger[_0xab68('0x13')]('GetTrunk',_0x4af83a['message'],_0xdf7458);_0x176ed1(_0x31f21d[_0xab68('0x13')](0x1f4,_0x4af83a[_0xab68('0x15')]));});});};exports[_0xab68('0x22')]=function(_0x120373){var _0x342c46=this;return new Promise(function(_0x15dece,_0x569155){return db[_0xab68('0x23')][_0xab68('0x24')]({'raw':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1b')]===undefined?!![]:![]:!![],'where':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1c')]||null:null,'attributes':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1d')]||null:null,'include':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1e')]?_[_0xab68('0x1f')](_0x120373[_0xab68('0x1a')]['include'],function(_0x3708a6){return{'model':db[_0x3708a6['model']],'as':_0x3708a6['as'],'attributes':_0x3708a6[_0xab68('0x1d')],'include':_0x3708a6[_0xab68('0x1e')]?_[_0xab68('0x1f')](_0x3708a6['include'],function(_0x1c8976){return{'model':db[_0x1c8976[_0xab68('0x20')]],'as':_0x1c8976['as'],'attributes':_0x1c8976[_0xab68('0x1d')],'include':_0x1c8976['include']?_[_0xab68('0x1f')](_0x1c8976[_0xab68('0x1e')],function(_0x2f8d14){return{'model':db[_0x2f8d14['model']],'as':_0x2f8d14['as'],'attributes':_0x2f8d14['attributes']};}):[]};}):[]};}):[]:[]})[_0xab68('0x21')](function(_0xaf8980){logger[_0xab68('0xd')]('ShowTrunk',_0x120373);logger[_0xab68('0x10')](_0xab68('0x22'),_0x120373,JSON[_0xab68('0x12')](_0xaf8980));_0x15dece(_0xaf8980);})[_0xab68('0x17')](function(_0x5a896c){logger['error'](_0xab68('0x22'),_0x5a896c[_0xab68('0x15')],_0x120373);_0x569155(_0x342c46[_0xab68('0x13')](0x1f4,_0x5a896c['message']));});});}; \ No newline at end of file +var _0x6409=['code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','ShowTrunk','find','where','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0x6409,0x118));var _0x9640=function(_0x2ec5f0,_0x31735e){_0x2ec5f0=_0x2ec5f0-0x0;var _0x35d96a=_0x6409[_0x2ec5f0];return _0x35d96a;};'use strict';var _=require('lodash');var util=require(_0x9640('0x0'));var moment=require('moment');var BPromise=require(_0x9640('0x1'));var rs=require(_0x9640('0x2'));var fs=require('fs');var Redis=require(_0x9640('0x3'));var db=require(_0x9640('0x4'))['db'];var utils=require(_0x9640('0x5'));var logger=require(_0x9640('0x6'))(_0x9640('0x7'));var config=require(_0x9640('0x8'));var jayson=require(_0x9640('0x9'));var client=jayson[_0x9640('0xa')][_0x9640('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43eab4,_0x267f7b,_0x3a6ed9){return new BPromise(function(_0x4dad4c,_0x221147){return client[_0x9640('0xc')](_0x43eab4,_0x3a6ed9)['then'](function(_0x1c7dae){logger[_0x9640('0xd')]('Trunk,\x20%s,\x20%s',_0x267f7b,_0x9640('0xe'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x267f7b,_0x9640('0xe'),JSON['stringify'](_0x1c7dae));if(_0x1c7dae[_0x9640('0xf')]){if(_0x1c7dae[_0x9640('0xf')][_0x9640('0x10')]===0x1f4){logger[_0x9640('0xf')]('Trunk,\x20%s,\x20%s',_0x267f7b,_0x1c7dae[_0x9640('0xf')][_0x9640('0x11')]);return _0x221147(_0x1c7dae[_0x9640('0xf')]['message']);}logger[_0x9640('0xf')](_0x9640('0x12'),_0x267f7b,_0x1c7dae[_0x9640('0xf')]['message']);return _0x4dad4c(_0x1c7dae['error']['message']);}else{logger[_0x9640('0xd')](_0x9640('0x12'),_0x267f7b,_0x9640('0xe'));_0x4dad4c(_0x1c7dae[_0x9640('0x13')][_0x9640('0x11')]);}})[_0x9640('0x14')](function(_0x1bd2cb){logger[_0x9640('0xf')](_0x9640('0x12'),_0x267f7b,_0x1bd2cb);_0x221147(_0x1bd2cb);});});}exports[_0x9640('0x15')]=function(_0x3f832f){var _0x32e5ee=this;return new Promise(function(_0x45de61,_0x250f9e){return db[_0x9640('0x16')][_0x9640('0x17')]({'raw':_0x3f832f['options']?_0x3f832f[_0x9640('0x18')][_0x9640('0x19')]===undefined?!![]:![]:!![],'where':_0x3f832f[_0x9640('0x18')]?_0x3f832f[_0x9640('0x18')]['where']||null:null,'attributes':_0x3f832f[_0x9640('0x18')]?_0x3f832f[_0x9640('0x18')][_0x9640('0x1a')]||null:null,'limit':_0x3f832f[_0x9640('0x18')]?_0x3f832f[_0x9640('0x18')][_0x9640('0x1b')]||null:null,'include':_0x3f832f[_0x9640('0x18')]?_0x3f832f[_0x9640('0x18')][_0x9640('0x1c')]?_[_0x9640('0x1d')](_0x3f832f[_0x9640('0x18')]['include'],function(_0x24545f){return{'model':db[_0x24545f[_0x9640('0x1e')]],'as':_0x24545f['as'],'attributes':_0x24545f[_0x9640('0x1a')],'include':_0x24545f[_0x9640('0x1c')]?_[_0x9640('0x1d')](_0x24545f[_0x9640('0x1c')],function(_0x3896fb){return{'model':db[_0x3896fb[_0x9640('0x1e')]],'as':_0x3896fb['as'],'attributes':_0x3896fb['attributes'],'include':_0x3896fb[_0x9640('0x1c')]?_['map'](_0x3896fb[_0x9640('0x1c')],function(_0x2ee058){return{'model':db[_0x2ee058['model']],'as':_0x2ee058['as'],'attributes':_0x2ee058[_0x9640('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47336a){logger[_0x9640('0xd')]('GetTrunk',_0x3f832f);logger[_0x9640('0x1f')](_0x9640('0x15'),_0x3f832f,JSON[_0x9640('0x20')](_0x47336a));_0x45de61(_0x47336a);})[_0x9640('0x14')](function(_0x5c64d5){logger['error'](_0x9640('0x15'),_0x5c64d5[_0x9640('0x11')],_0x3f832f);_0x250f9e(_0x32e5ee[_0x9640('0xf')](0x1f4,_0x5c64d5[_0x9640('0x11')]));});});};exports[_0x9640('0x21')]=function(_0x1bf339){var _0x137d89=this;return new Promise(function(_0x3a377e,_0xcf5662){return db[_0x9640('0x16')][_0x9640('0x22')]({'raw':_0x1bf339[_0x9640('0x18')]?_0x1bf339[_0x9640('0x18')][_0x9640('0x19')]===undefined?!![]:![]:!![],'where':_0x1bf339[_0x9640('0x18')]?_0x1bf339[_0x9640('0x18')][_0x9640('0x23')]||null:null,'attributes':_0x1bf339['options']?_0x1bf339[_0x9640('0x18')][_0x9640('0x1a')]||null:null,'include':_0x1bf339[_0x9640('0x18')]?_0x1bf339['options'][_0x9640('0x1c')]?_[_0x9640('0x1d')](_0x1bf339[_0x9640('0x18')][_0x9640('0x1c')],function(_0x4a67ca){return{'model':db[_0x4a67ca[_0x9640('0x1e')]],'as':_0x4a67ca['as'],'attributes':_0x4a67ca[_0x9640('0x1a')],'include':_0x4a67ca['include']?_[_0x9640('0x1d')](_0x4a67ca[_0x9640('0x1c')],function(_0x4c6c40){return{'model':db[_0x4c6c40['model']],'as':_0x4c6c40['as'],'attributes':_0x4c6c40['attributes'],'include':_0x4c6c40[_0x9640('0x1c')]?_[_0x9640('0x1d')](_0x4c6c40[_0x9640('0x1c')],function(_0x194608){return{'model':db[_0x194608[_0x9640('0x1e')]],'as':_0x194608['as'],'attributes':_0x194608[_0x9640('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9640('0x24')](function(_0x2d3714){logger[_0x9640('0xd')]('ShowTrunk',_0x1bf339);logger[_0x9640('0x1f')](_0x9640('0x21'),_0x1bf339,JSON[_0x9640('0x20')](_0x2d3714));_0x3a377e(_0x2d3714);})['catch'](function(_0x7d97ee){logger[_0x9640('0xf')](_0x9640('0x21'),_0x7d97ee[_0x9640('0x11')],_0x1bf339);_0xcf5662(_0x137d89['error'](0x1f4,_0x7d97ee[_0x9640('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 71e2074..98d2039 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 _0x9a6d=['/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','describe','/whoami','isAuthenticated','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts'];(function(_0x325507,_0x1968ab){var _0x1a5253=function(_0x591c8e){while(--_0x591c8e){_0x325507['push'](_0x325507['shift']());}};_0x1a5253(++_0x1968ab);}(_0x9a6d,0x146));var _0xd9a6=function(_0x35143a,_0x1b4336){_0x35143a=_0x35143a-0x0;var _0x3ca6d3=_0x9a6d[_0x35143a];return _0x3ca6d3;};'use strict';var multer=require(_0xd9a6('0x0'));var util=require(_0xd9a6('0x1'));var path=require(_0xd9a6('0x2'));var timeout=require(_0xd9a6('0x3'));var express=require(_0xd9a6('0x4'));var router=express[_0xd9a6('0x5')]();var fs_extra=require(_0xd9a6('0x6'));var auth=require(_0xd9a6('0x7'));var interaction=require(_0xd9a6('0x8'));var config=require('../../config/environment');var controller=require(_0xd9a6('0x9'));router[_0xd9a6('0xa')]('/',auth['isAuthenticated'](),controller[_0xd9a6('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd9a6('0xc')]);router['get'](_0xd9a6('0xd'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0xf')]);router[_0xd9a6('0xa')](_0xd9a6('0x10'),auth['isAuthenticated'](),controller[_0xd9a6('0x11')]);router[_0xd9a6('0xa')]('/:id',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x12')]);router[_0xd9a6('0xa')](_0xd9a6('0x13'),controller[_0xd9a6('0x14')]);router[_0xd9a6('0xa')](_0xd9a6('0x15'),auth['isAuthenticated'](),controller[_0xd9a6('0x16')]);router[_0xd9a6('0xa')](_0xd9a6('0x17'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x18')]);router[_0xd9a6('0xa')](_0xd9a6('0x19'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x1a')]);router['get'](_0xd9a6('0x1b'),auth['isAuthenticated'](),controller[_0xd9a6('0x1c')]);router[_0xd9a6('0xa')](_0xd9a6('0x1d'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x1e')]);router[_0xd9a6('0xa')](_0xd9a6('0x1f'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x20')]);router['get'](_0xd9a6('0x21'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x22')]);router[_0xd9a6('0xa')](_0xd9a6('0x23'),auth[_0xd9a6('0xe')](),controller['getChatInteractions']);router[_0xd9a6('0xa')]('/:id/openchannel/interactions',auth[_0xd9a6('0xe')](),controller['getOpenchannelInteractions']);router['get'](_0xd9a6('0x24'),auth[_0xd9a6('0xe')](),controller['getMailInteractions']);router['get'](_0xd9a6('0x25'),auth[_0xd9a6('0xe')](),controller['getSmsInteractions']);router[_0xd9a6('0xa')](_0xd9a6('0x26'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x27')]);router['get'](_0xd9a6('0x28'),auth['isAuthenticated'](),controller[_0xd9a6('0x29')]);router['get'](_0xd9a6('0x2a'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x2b')]);router[_0xd9a6('0xa')](_0xd9a6('0x2c'),auth[_0xd9a6('0xe')](),controller['getLists']);router[_0xd9a6('0xa')]('/:id/agents',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x2d')]);router['get'](_0xd9a6('0x2e'),auth['isAuthenticated'](),controller[_0xd9a6('0x2f')]);router['get'](_0xd9a6('0x30'),auth['isAuthenticated'](),controller[_0xd9a6('0x31')]);router['get']('/:id/mail_accounts',auth[_0xd9a6('0xe')](),controller['getMailAccounts']);router[_0xd9a6('0xa')](_0xd9a6('0x32'),auth[_0xd9a6('0xe')](),controller['getOpenchannelAccounts']);router[_0xd9a6('0xa')](_0xd9a6('0x33'),auth[_0xd9a6('0xe')](),controller['getSmsAccounts']);router['get'](_0xd9a6('0x34'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x35')]);router[_0xd9a6('0xa')](_0xd9a6('0x36'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x37')]);router[_0xd9a6('0xa')](_0xd9a6('0x38'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x39')]);router['get'](_0xd9a6('0x3a'),auth[_0xd9a6('0xe')](),controller['getScheduledCalls']);router[_0xd9a6('0xa')](_0xd9a6('0x3b'),auth['isAuthenticated'](),controller['getApiKey']);router[_0xd9a6('0x3c')](_0xd9a6('0x17'),auth['isAuthenticated'](),controller[_0xd9a6('0x3d')]);router[_0xd9a6('0x3c')]('/',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x3e')]);router[_0xd9a6('0x3c')](_0xd9a6('0x3f'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x40')]);router[_0xd9a6('0x3c')]('/:id/queues',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x41')]);var upload=multer({'storage':multer[_0xd9a6('0x42')]({'destination':function(_0x42b822,_0x261816,_0x2aeb12){_0x2aeb12(null,path['join'](config['root'],_0xd9a6('0x43')));},'filename':function(_0x3bc62a,_0x4593f6,_0x3e7225){_0x3e7225(null,util[_0xd9a6('0x44')](_0xd9a6('0x45'),Date[_0xd9a6('0x46')](),_0x4593f6[_0xd9a6('0x47')]));}})});router[_0xd9a6('0x3c')](_0xd9a6('0x13'),upload[_0xd9a6('0x48')](_0xd9a6('0x49')),controller[_0xd9a6('0x4a')]);router['post']('/:id/login',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x4b')]);router[_0xd9a6('0x3c')]('/:id/logout',auth['isAuthenticated'](),controller['logout']);router[_0xd9a6('0x3c')]('/:id/pause',auth['isAuthenticated'](),controller[_0xd9a6('0x4c')]);router[_0xd9a6('0x3c')](_0xd9a6('0x4d'),auth[_0xd9a6('0xe')](),controller['unpause']);router['post'](_0xd9a6('0x2a'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x4e')]);router['post']('/:id/chat_interactions',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x4f')]);router[_0xd9a6('0x3c')](_0xd9a6('0x50'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x51')]);router[_0xd9a6('0x3c')](_0xd9a6('0x52'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x53')]);router[_0xd9a6('0x3c')](_0xd9a6('0x54'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x55')]);router[_0xd9a6('0x3c')](_0xd9a6('0x56'),auth[_0xd9a6('0xe')](),controller['addOpenchannelInteractions']);router[_0xd9a6('0x3c')](_0xd9a6('0x57'),auth['isAuthenticated'](),controller[_0xd9a6('0x58')]);router[_0xd9a6('0x3c')](_0xd9a6('0x30'),auth[_0xd9a6('0xe')](),controller['addFaxAccounts']);router[_0xd9a6('0x3c')](_0xd9a6('0x59'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x5a')]);router[_0xd9a6('0x3c')](_0xd9a6('0x32'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x5b')]);router['post']('/:id/sms_accounts',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x5c')]);router[_0xd9a6('0x3c')](_0xd9a6('0x34'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x5d')]);router[_0xd9a6('0x3c')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0xd9a6('0x3c')](_0xd9a6('0x38'),auth['isAuthenticated'](),controller[_0xd9a6('0x5e')]);router[_0xd9a6('0x3c')]('/:id/api_key',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x5f')]);router[_0xd9a6('0x60')]('/:id',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x61')]);router[_0xd9a6('0x60')](_0xd9a6('0x62'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x63')]);router[_0xd9a6('0x64')]('/:id/queues',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x65')]);router[_0xd9a6('0x64')](_0xd9a6('0x2a'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x66')]);router['delete'](_0xd9a6('0x67'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x68')]);router[_0xd9a6('0x64')](_0xd9a6('0x69'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x6a')]);router['delete']('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router['delete']('/:id/fax_interactions',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x6b')]);router['delete']('/:id/sms_interactions',auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x6c')]);router[_0xd9a6('0x64')](_0xd9a6('0x56'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x6d')]);router['delete'](_0xd9a6('0x57'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x6e')]);router['delete'](_0xd9a6('0x30'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x6f')]);router[_0xd9a6('0x64')](_0xd9a6('0x59'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x70')]);router[_0xd9a6('0x64')](_0xd9a6('0x32'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x71')]);router['delete'](_0xd9a6('0x33'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router['delete'](_0xd9a6('0x34'),auth['isAuthenticated'](),controller[_0xd9a6('0x72')]);router[_0xd9a6('0x64')](_0xd9a6('0x36'),auth[_0xd9a6('0xe')](),controller[_0xd9a6('0x73')]);router['delete'](_0xd9a6('0x38'),auth['isAuthenticated'](),controller[_0xd9a6('0x74')]);router[_0xd9a6('0x64')](_0xd9a6('0x3b'),auth[_0xd9a6('0xe')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0xefe0=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./user.controller','isAuthenticated','index','get','/describe','describe','/presence','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put','/:id','update','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts'];(function(_0x2e55b0,_0x450265){var _0x5e84d2=function(_0x1f7716){while(--_0x1f7716){_0x2e55b0['push'](_0x2e55b0['shift']());}};_0x5e84d2(++_0x450265);}(_0xefe0,0x71));var _0x0efe=function(_0x1731a9,_0x4fb551){_0x1731a9=_0x1731a9-0x0;var _0x22b9a5=_0xefe0[_0x1731a9];return _0x22b9a5;};'use strict';var multer=require(_0x0efe('0x0'));var util=require('util');var path=require(_0x0efe('0x1'));var timeout=require(_0x0efe('0x2'));var express=require(_0x0efe('0x3'));var router=express[_0x0efe('0x4')]();var fs_extra=require(_0x0efe('0x5'));var auth=require(_0x0efe('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0efe('0x7'));router['get']('/',auth[_0x0efe('0x8')](),controller[_0x0efe('0x9')]);router[_0x0efe('0xa')](_0x0efe('0xb'),auth[_0x0efe('0x8')](),controller[_0x0efe('0xc')]);router['get']('/whoami',auth['isAuthenticated'](),controller['whoami']);router[_0x0efe('0xa')](_0x0efe('0xd'),auth[_0x0efe('0x8')](),controller['getPresence']);router[_0x0efe('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0efe('0xe')]);router[_0x0efe('0xa')](_0x0efe('0xf'),controller['getAvatar']);router['get']('/:id/open_tabs',auth[_0x0efe('0x8')](),controller[_0x0efe('0x10')]);router[_0x0efe('0xa')](_0x0efe('0x11'),auth['isAuthenticated'](),controller[_0x0efe('0x12')]);router[_0x0efe('0xa')](_0x0efe('0x13'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x14')]);router['get'](_0x0efe('0x15'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x16')]);router[_0x0efe('0xa')](_0x0efe('0x17'),auth['isAuthenticated'](),controller[_0x0efe('0x18')]);router[_0x0efe('0xa')](_0x0efe('0x19'),auth['isAuthenticated'](),controller[_0x0efe('0x1a')]);router['get'](_0x0efe('0x1b'),auth[_0x0efe('0x8')](),controller['getScreenRecordings']);router[_0x0efe('0xa')](_0x0efe('0x1c'),auth[_0x0efe('0x8')](),controller['getChatInteractions']);router[_0x0efe('0xa')]('/:id/openchannel/interactions',auth[_0x0efe('0x8')](),controller[_0x0efe('0x1d')]);router[_0x0efe('0xa')](_0x0efe('0x1e'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x1f')]);router[_0x0efe('0xa')](_0x0efe('0x20'),auth[_0x0efe('0x8')](),controller['getSmsInteractions']);router[_0x0efe('0xa')]('/:id/fax/interactions',auth[_0x0efe('0x8')](),controller[_0x0efe('0x21')]);router[_0x0efe('0xa')](_0x0efe('0x22'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x23')]);router[_0x0efe('0xa')](_0x0efe('0x24'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x25')]);router[_0x0efe('0xa')](_0x0efe('0x26'),auth['isAuthenticated'](),controller[_0x0efe('0x27')]);router['get'](_0x0efe('0x28'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x29')]);router[_0x0efe('0xa')](_0x0efe('0x2a'),auth[_0x0efe('0x8')](),controller['getVoicePrefixes']);router[_0x0efe('0xa')](_0x0efe('0x2b'),auth[_0x0efe('0x8')](),controller['getFaxAccounts']);router[_0x0efe('0xa')](_0x0efe('0x2c'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x2d')]);router[_0x0efe('0xa')](_0x0efe('0x2e'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x2f')]);router[_0x0efe('0xa')](_0x0efe('0x30'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x31')]);router[_0x0efe('0xa')](_0x0efe('0x32'),auth[_0x0efe('0x8')](),controller['getChatWebsites']);router['get'](_0x0efe('0x33'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x34')]);router[_0x0efe('0xa')]('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router['get'](_0x0efe('0x35'),auth['isAuthenticated'](),controller[_0x0efe('0x36')]);router[_0x0efe('0xa')](_0x0efe('0x37'),auth['isAuthenticated'](),controller[_0x0efe('0x38')]);router[_0x0efe('0x39')](_0x0efe('0x11'),auth['isAuthenticated'](),controller[_0x0efe('0x3a')]);router[_0x0efe('0x39')]('/',auth[_0x0efe('0x8')](),controller[_0x0efe('0x3b')]);router[_0x0efe('0x39')](_0x0efe('0x3c'),auth[_0x0efe('0x8')](),controller['bulkCreate']);router[_0x0efe('0x39')]('/:id/queues',auth[_0x0efe('0x8')](),controller[_0x0efe('0x3d')]);var upload=multer({'storage':multer[_0x0efe('0x3e')]({'destination':function(_0x5de1f8,_0x1e1efd,_0x44ab43){_0x44ab43(null,path[_0x0efe('0x3f')](config[_0x0efe('0x40')],_0x0efe('0x41')));},'filename':function(_0x434949,_0x4abdf5,_0x178cce){_0x178cce(null,util[_0x0efe('0x42')](_0x0efe('0x43'),Date['now'](),_0x4abdf5[_0x0efe('0x44')]));}})});router[_0x0efe('0x39')](_0x0efe('0xf'),upload['single'](_0x0efe('0x45')),controller[_0x0efe('0x46')]);router[_0x0efe('0x39')](_0x0efe('0x47'),auth[_0x0efe('0x8')](),controller['login']);router['post'](_0x0efe('0x48'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x49')]);router[_0x0efe('0x39')](_0x0efe('0x4a'),auth['isAuthenticated'](),controller['pause']);router[_0x0efe('0x39')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x0efe('0x4b')]);router[_0x0efe('0x39')](_0x0efe('0x24'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x4c')]);router[_0x0efe('0x39')](_0x0efe('0x4d'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x4e')]);router['post'](_0x0efe('0x4f'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x50')]);router['post'](_0x0efe('0x51'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x52')]);router[_0x0efe('0x39')](_0x0efe('0x53'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x54')]);router[_0x0efe('0x39')]('/:id/openchannel_interactions',auth[_0x0efe('0x8')](),controller[_0x0efe('0x55')]);router[_0x0efe('0x39')]('/:id/whatsapp_interactions',auth[_0x0efe('0x8')](),controller['addWhatsappInteractions']);router[_0x0efe('0x39')]('/:id/fax_accounts',auth[_0x0efe('0x8')](),controller['addFaxAccounts']);router[_0x0efe('0x39')]('/:id/mail_accounts',auth[_0x0efe('0x8')](),controller[_0x0efe('0x56')]);router[_0x0efe('0x39')](_0x0efe('0x2e'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x57')]);router[_0x0efe('0x39')]('/:id/sms_accounts',auth[_0x0efe('0x8')](),controller[_0x0efe('0x58')]);router['post'](_0x0efe('0x32'),auth['isAuthenticated'](),controller[_0x0efe('0x59')]);router['post'](_0x0efe('0x33'),auth['isAuthenticated'](),controller[_0x0efe('0x5a')]);router[_0x0efe('0x39')](_0x0efe('0x5b'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x5c')]);router[_0x0efe('0x39')](_0x0efe('0x37'),auth[_0x0efe('0x8')](),controller['createApiKey']);router[_0x0efe('0x5d')](_0x0efe('0x5e'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x5f')]);router[_0x0efe('0x5d')]('/:id/password',auth[_0x0efe('0x8')](),controller[_0x0efe('0x60')]);router[_0x0efe('0x61')](_0x0efe('0x13'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x62')]);router[_0x0efe('0x61')](_0x0efe('0x24'),auth['isAuthenticated'](),controller[_0x0efe('0x63')]);router[_0x0efe('0x61')](_0x0efe('0x5e'),auth['isAuthenticated'](),controller[_0x0efe('0x64')]);router[_0x0efe('0x61')](_0x0efe('0x4d'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x65')]);router[_0x0efe('0x61')](_0x0efe('0x4f'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x66')]);router['delete'](_0x0efe('0x51'),auth[_0x0efe('0x8')](),controller['removeFaxInteractions']);router[_0x0efe('0x61')](_0x0efe('0x53'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x67')]);router['delete'](_0x0efe('0x68'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x69')]);router[_0x0efe('0x61')](_0x0efe('0x6a'),auth['isAuthenticated'](),controller[_0x0efe('0x6b')]);router[_0x0efe('0x61')](_0x0efe('0x2b'),auth[_0x0efe('0x8')](),controller[_0x0efe('0x6c')]);router['delete'](_0x0efe('0x2c'),auth[_0x0efe('0x8')](),controller['removeMailAccounts']);router[_0x0efe('0x61')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x0efe('0x6d')]);router['delete']('/:id/sms_accounts',auth[_0x0efe('0x8')](),controller[_0x0efe('0x6e')]);router[_0x0efe('0x61')]('/:id/chat_websites',auth[_0x0efe('0x8')](),controller['removeChatWebsites']);router[_0x0efe('0x61')](_0x0efe('0x33'),auth[_0x0efe('0x8')](),controller['removeWhatsappAccounts']);router[_0x0efe('0x61')]('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);router['delete'](_0x0efe('0x37'),auth[_0x0efe('0x8')](),controller['removeApiKey']);module[_0x0efe('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 124e7e4..e1d300d 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 _0xd493=['user','agent','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','update','TEXT','transport','isArray','wss','encryption','force_avp','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','icesupport','dtlsenable','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin'];(function(_0x55863d,_0x5cfa5b){var _0x3ca4b1=function(_0x465644){while(--_0x465644){_0x55863d['push'](_0x55863d['shift']());}};_0x3ca4b1(++_0x5cfa5b);}(_0xd493,0x1bd));var _0x3d49=function(_0x3256c2,_0x3704e4){_0x3256c2=_0x3256c2-0x0;var _0x1a60a=_0xd493[_0x3256c2];return _0x1a60a;};'use strict';var Sequelize=require(_0x3d49('0x0'));var moment=require('moment');var util=require(_0x3d49('0x1'));var _=require(_0x3d49('0x2'));module['exports']={'name':{'type':Sequelize[_0x3d49('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x58dce8){this[_0x3d49('0x4')](_0x3d49('0x5'),_0x58dce8);this['setDataValue']('defaultuser',_0x58dce8);},'comment':_0x3d49('0x6')},'fullname':{'type':Sequelize[_0x3d49('0x3')],'allowNull':![],'set':function(_0x1ef537){this[_0x3d49('0x4')]('fullname',_0x1ef537);this[_0x3d49('0x4')](_0x3d49('0x7'),util[_0x3d49('0x8')](_0x3d49('0x9'),_0x1ef537,this[_0x3d49('0xa')](_0x3d49('0xb'))));}},'alias':{'type':Sequelize[_0x3d49('0x3')]},'email':{'type':Sequelize[_0x3d49('0x3')],'allowNull':![],'unique':_0x3d49('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3e1fd0){if(_0x3e1fd0){this['setDataValue'](_0x3d49('0xc'),_0x3e1fd0['toLowerCase']());}}},'role':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0xe'),_0x3d49('0xf'),_0x3d49('0x10'),_0x3d49('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x3d49('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3d49('0x3')],'defaultValue':_0x3d49('0x12')},'internal':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':![],'unique':_0x3d49('0xb'),'set':function(_0x342cf7){this[_0x3d49('0x4')](_0x3d49('0xb'),_0x342cf7);this['setDataValue'](_0x3d49('0x14'),_0x342cf7);this[_0x3d49('0x4')](_0x3d49('0x7'),util[_0x3d49('0x8')](_0x3d49('0x9'),this[_0x3d49('0xa')](_0x3d49('0x15')),_0x342cf7));}},'salt':{'type':Sequelize[_0x3d49('0x3')]},'phone':{'type':Sequelize[_0x3d49('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x3d49('0x3')]},'zipcode':{'type':Sequelize[_0x3d49('0x3')]},'userpic':{'type':Sequelize[_0x3d49('0x3')]},'city':{'type':Sequelize[_0x3d49('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3d49('0x17')]},'voicePause':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3d49('0x3')],'defaultValue':_0x3d49('0x18')},'lastPauseAt':{'type':Sequelize[_0x3d49('0x17')]},'chatCapacity':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3d49('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3d49('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![],'defaultValue':_0x3d49('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x3d49('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x3d49('0x1a'),_0x3d49('0xf'),_0x3d49('0x1b')),'allowNull':!![],'defaultValue':_0x3d49('0x1a')},'context':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![],'defaultValue':_0x3d49('0x1c')},'callingpres':{'type':Sequelize[_0x3d49('0xd')]('ALLOWED_NOT_SCREENED',_0x3d49('0x1d'),_0x3d49('0x1e'),_0x3d49('0x1f'),_0x3d49('0x20'),_0x3d49('0x21'),_0x3d49('0x22'),_0x3d49('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3d49('0x24'),'set':function(_0x4056c1){this[_0x3d49('0x4')]('transport',_0x4056c1?_0x4056c1[_0x3d49('0x25')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue']('transport')[_0x3d49('0x26')](','):null;},'comment':_0x3d49('0x27')},'dtmfmode':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x28'),'info',_0x3d49('0x29'),_0x3d49('0x2a'),_0x3d49('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x3d49('0x2c'),'no',_0x3d49('0x2d'),'update',_0x3d49('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4b48dc){this[_0x3d49('0x4')]('nat',_0x4b48dc?_0x4b48dc[_0x3d49('0x25')](','):null);},'get':function(){return this[_0x3d49('0xa')](_0x3d49('0x2f'))?this['getDataValue']('nat')[_0x3d49('0x26')](','):null;},'comment':_0x3d49('0x30')},'callgroup':{'type':Sequelize[_0x3d49('0x3')]},'namedcallgroup':{'type':Sequelize[_0x3d49('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3d49('0x3')]},'language':{'type':Sequelize[_0x3d49('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3d49('0x3')]},'disallow':{'type':Sequelize[_0x3d49('0x3')],'allowNull':![],'defaultValue':_0x3d49('0x31')},'allow':{'type':Sequelize[_0x3d49('0x3')],'allowNull':![],'defaultValue':_0x3d49('0x32'),'set':function(_0x3633e3){this[_0x3d49('0x4')](_0x3d49('0x33'),_0x3633e3?_0x3633e3['join'](';'):_0x3d49('0x32'));},'get':function(){return this[_0x3d49('0xa')](_0x3d49('0x33'))?this[_0x3d49('0xa')]('allow')[_0x3d49('0x26')](';'):null;},'comment':_0x3d49('0x34')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![],'set':function(_0xf35673){this[_0x3d49('0x4')](_0x3d49('0x35'),_0xf35673?_0xf35673['join'](','):null);},'get':function(){return this[_0x3d49('0xa')](_0x3d49('0x35'))?this[_0x3d49('0xa')](_0x3d49('0x35'))[_0x3d49('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3d49('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x3d49('0x2c'),'no',_0x3d49('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![],'defaultValue':_0x3d49('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x3d49('0x2c')},'busylevel':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3d49('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3d49('0xd')]('yes','no',_0x3d49('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x3d49('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x39'),_0x3d49('0x3a'),_0x3d49('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3d49('0xd')]('uac','uas'),'allowNull':!![],'defaultValue':_0x3d49('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x3d49('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3d49('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no','fingerprint',_0x3d49('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x3e'),_0x3d49('0x3f'),_0x3d49('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3d49('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3d49('0xd')](_0x3d49('0x2c'),'no','nonat',_0x3d49('0x41'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x3d49('0x17')]},'passwordResetAt':{'type':Sequelize[_0x3d49('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3d49('0x42')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3e13d0){this[_0x3d49('0x4')]('showWebBar',_0x3e13d0);var _0x598338=this['get']({'plain':!![]});switch(_0x3e13d0){case 0x0:case 0x1:var _0x26bfbe=_0x598338[_0x3d49('0x43')]?_[_0x3d49('0x44')](_0x598338['transport'])?_0x598338[_0x3d49('0x43')][_0x3d49('0x25')]():_0x598338['transport']:_0x3d49('0x24');if(_0x26bfbe===_0x3d49('0x45')){_0x26bfbe='udp';}this[_0x3d49('0x4')](_0x3d49('0x43'),_0x26bfbe);this['setDataValue'](_0x3d49('0x46'),'no');this[_0x3d49('0x4')]('avpf',null);this['setDataValue'](_0x3d49('0x47'),null);this['setDataValue']('icesupport',null);this[_0x3d49('0x4')]('dtlsenable',null);this[_0x3d49('0x4')](_0x3d49('0x48'),null);this[_0x3d49('0x4')]('dtlssetup',null);this[_0x3d49('0x4')](_0x3d49('0x49'),null);this[_0x3d49('0x4')](_0x3d49('0x4a'),null);this['setDataValue'](_0x3d49('0x4b'),'no');break;case 0x2:this[_0x3d49('0x4')](_0x3d49('0x43'),_0x3d49('0x45'));this[_0x3d49('0x4')](_0x3d49('0x46'),_0x3d49('0x2c'));this[_0x3d49('0x4')](_0x3d49('0x4c'),_0x3d49('0x2c'));this[_0x3d49('0x4')](_0x3d49('0x47'),_0x3d49('0x2c'));this[_0x3d49('0x4')](_0x3d49('0x4d'),_0x3d49('0x2c'));this['setDataValue'](_0x3d49('0x4e'),_0x3d49('0x2c'));this[_0x3d49('0x4')](_0x3d49('0x48'),'no');this[_0x3d49('0x4')](_0x3d49('0x4f'),'actpass');this[_0x3d49('0x4')](_0x3d49('0x49'),_0x598338['dtlscertfile']||_0x3d49('0x50'));this[_0x3d49('0x4')]('dtlsprivatekey',_0x598338['dtlsprivatekey']||_0x3d49('0x51'));this[_0x3d49('0x4')](_0x3d49('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x3d49('0x42')],'set':function(_0x550884){this['setDataValue'](_0x3d49('0x52'),_0x550884?_0x550884[_0x3d49('0x25')](','):[]);},'get':function(){return this['getDataValue'](_0x3d49('0x52'))?_[_0x3d49('0x53')](this[_0x3d49('0xa')]('permissions')[_0x3d49('0x26')](','),function(_0xd3f4cf){return parseInt(_0xd3f4cf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3d49('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x3d49('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3d49('0x54')],'get':function(){return this[_0x3d49('0xa')](_0x3d49('0x55'))?this[_0x3d49('0xa')](_0x3d49('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x3d49('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3d49('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x30c325){if(typeof _0x30c325===_0x3d49('0x56')){var _0xb6f384=_0x30c325==='1'?!![]:_0x30c325==='0'?![]:_0x30c325===_0x3d49('0x57')?!![]:_0x30c325==='false'?![]:![];this[_0x3d49('0x4')](_0x3d49('0x58'),_0xb6f384);}else{this[_0x3d49('0x4')](_0x3d49('0x58'),_0x30c325);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3e4ae7){this[_0x3d49('0x4')](_0x3d49('0x59'),_0x3e4ae7);if(_0x3e4ae7===!![]){this['setDataValue'](_0x3d49('0x5a'),moment());this[_0x3d49('0x4')](_0x3d49('0x5b'),0x0);}else{this['setDataValue'](_0x3d49('0x5a'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3d49('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x3d49('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x3379=['get','udp','encryption','avpf','force_avp','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','wss','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','string','true','false','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','internal','accountcode','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','TEXT'];(function(_0x542e14,_0x5dfd4b){var _0xe3bbb=function(_0x5c2ac7){while(--_0x5c2ac7){_0x542e14['push'](_0x542e14['shift']());}};_0xe3bbb(++_0x5dfd4b);}(_0x3379,0x115));var _0x9337=function(_0x4fa088,_0x418f2d){_0x4fa088=_0x4fa088-0x0;var _0x2a5225=_0x3379[_0x4fa088];return _0x2a5225;};'use strict';var Sequelize=require(_0x9337('0x0'));var moment=require(_0x9337('0x1'));var util=require(_0x9337('0x2'));var _=require(_0x9337('0x3'));module['exports']={'name':{'type':Sequelize[_0x9337('0x4')],'allowNull':![],'unique':_0x9337('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x144317){this[_0x9337('0x6')]('name',_0x144317);this[_0x9337('0x6')](_0x9337('0x7'),_0x144317);},'comment':_0x9337('0x8')},'fullname':{'type':Sequelize[_0x9337('0x4')],'allowNull':![],'set':function(_0x5a59ab){this[_0x9337('0x6')]('fullname',_0x5a59ab);this[_0x9337('0x6')](_0x9337('0x9'),util[_0x9337('0xa')](_0x9337('0xb'),_0x5a59ab,this[_0x9337('0xc')]('internal')));}},'alias':{'type':Sequelize[_0x9337('0x4')]},'email':{'type':Sequelize[_0x9337('0x4')],'allowNull':![],'unique':_0x9337('0xd'),'validate':{'isEmail':!![]},'set':function(_0x9a2dcc){if(_0x9a2dcc){this[_0x9337('0x6')]('email',_0x9a2dcc[_0x9337('0xe')]());}}},'role':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x10'),_0x9337('0x11'),_0x9337('0x12'),_0x9337('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x9337('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':![],'unique':_0x9337('0x15'),'set':function(_0x12f1f1){this[_0x9337('0x6')]('internal',_0x12f1f1);this['setDataValue'](_0x9337('0x16'),_0x12f1f1);this['setDataValue']('callerid',util[_0x9337('0xa')](_0x9337('0xb'),this[_0x9337('0xc')]('fullname'),_0x12f1f1));}},'salt':{'type':Sequelize[_0x9337('0x4')]},'phone':{'type':Sequelize[_0x9337('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x9337('0x4')]},'userpic':{'type':Sequelize[_0x9337('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9337('0x4')]},'online':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9337('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x9337('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9337('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9337('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9337('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9337('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9337('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![],'defaultValue':_0x9337('0x19')},'ipaddr':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9337('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x1a'),'user','peer'),'allowNull':!![],'defaultValue':_0x9337('0x1a')},'context':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![],'defaultValue':_0x9337('0x1b')},'callingpres':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x1c'),'ALLOWED_PASSED_SCREEN',_0x9337('0x1d'),'ALLOWED',_0x9337('0x1e'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x47f137){this[_0x9337('0x6')](_0x9337('0x1f'),_0x47f137?_0x47f137[_0x9337('0x20')](','):null);},'get':function(){return this[_0x9337('0xc')](_0x9337('0x1f'))?this[_0x9337('0xc')]('transport')[_0x9337('0x21')](','):null;},'comment':_0x9337('0x22')},'dtmfmode':{'type':Sequelize[_0x9337('0xf')]('rfc2833',_0x9337('0x23'),'shortinfo',_0x9337('0x24'),_0x9337('0x25')),'allowNull':!![],'defaultValue':_0x9337('0x26')},'directmedia':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no',_0x9337('0x28'),_0x9337('0x29'),_0x9337('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![],'defaultValue':_0x9337('0x2b'),'set':function(_0x4f6bd9){this[_0x9337('0x6')](_0x9337('0x2c'),_0x4f6bd9?_0x4f6bd9['join'](','):null);},'get':function(){return this[_0x9337('0xc')](_0x9337('0x2c'))?this[_0x9337('0xc')](_0x9337('0x2c'))['split'](','):null;},'comment':_0x9337('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9337('0x4')]},'pickupgroup':{'type':Sequelize[_0x9337('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x9337('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9337('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x9337('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x58c033){this[_0x9337('0x6')]('allow',_0x58c033?_0x58c033[_0x9337('0x20')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x9337('0x2e'))?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x9337('0x2f')},'autoframing':{'type':Sequelize[_0x9337('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![],'set':function(_0x3b77d3){this[_0x9337('0x6')](_0x9337('0x30'),_0x3b77d3?_0x3b77d3['join'](','):null);},'get':function(){return this[_0x9337('0xc')](_0x9337('0x30'))?this[_0x9337('0xc')](_0x9337('0x30'))[_0x9337('0x21')](','):null;},'comment':_0x9337('0x31')},'trustrpid':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no',_0x9337('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![],'defaultValue':_0x9337('0x33')},'amaflags':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':_0x9337('0x27')},'busylevel':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9337('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no',_0x9337('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x35'),_0x9337('0x36'),_0x9337('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x38'),_0x9337('0x39')),'allowNull':!![],'defaultValue':_0x9337('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x9337('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no',_0x9337('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x9337('0x3b'),_0x9337('0x3c'),_0x9337('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9337('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x9337('0x27'),'no',_0x9337('0x28'),_0x9337('0x29'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9337('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x9337('0x18')]},'passwordResetAt':{'type':Sequelize[_0x9337('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x9337('0x3e')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0xfe6872){this[_0x9337('0x6')]('showWebBar',_0xfe6872);var _0x35eccf=this[_0x9337('0x3f')]({'plain':!![]});switch(_0xfe6872){case 0x0:case 0x1:var _0x12fae=_0x35eccf[_0x9337('0x1f')]?_['isArray'](_0x35eccf[_0x9337('0x1f')])?_0x35eccf['transport'][_0x9337('0x20')]():_0x35eccf['transport']:_0x9337('0x40');if(_0x12fae==='wss'){_0x12fae=_0x9337('0x40');}this[_0x9337('0x6')](_0x9337('0x1f'),_0x12fae);this[_0x9337('0x6')](_0x9337('0x41'),'no');this[_0x9337('0x6')](_0x9337('0x42'),null);this['setDataValue'](_0x9337('0x43'),null);this[_0x9337('0x6')]('icesupport',null);this[_0x9337('0x6')](_0x9337('0x44'),null);this[_0x9337('0x6')]('dtlsverify',null);this[_0x9337('0x6')](_0x9337('0x45'),null);this[_0x9337('0x6')](_0x9337('0x46'),null);this['setDataValue'](_0x9337('0x47'),null);this[_0x9337('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x9337('0x6')](_0x9337('0x1f'),_0x9337('0x48'));this[_0x9337('0x6')](_0x9337('0x41'),'yes');this['setDataValue']('avpf',_0x9337('0x27'));this['setDataValue']('force_avp',_0x9337('0x27'));this[_0x9337('0x6')](_0x9337('0x49'),'yes');this[_0x9337('0x6')](_0x9337('0x44'),_0x9337('0x27'));this[_0x9337('0x6')]('dtlsverify','no');this['setDataValue'](_0x9337('0x45'),_0x9337('0x3d'));this[_0x9337('0x6')](_0x9337('0x46'),_0x35eccf[_0x9337('0x46')]||_0x9337('0x4a'));this[_0x9337('0x6')](_0x9337('0x47'),_0x35eccf[_0x9337('0x47')]||_0x9337('0x4b'));this[_0x9337('0x6')](_0x9337('0x4c'),_0x9337('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x9337('0x3e')],'set':function(_0x282864){this[_0x9337('0x6')]('permissions',_0x282864?_0x282864['join'](','):[]);},'get':function(){return this[_0x9337('0xc')](_0x9337('0x4d'))?_['map'](this[_0x9337('0xc')](_0x9337('0x4d'))[_0x9337('0x21')](','),function(_0x2914b6){return parseInt(_0x2914b6,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9337('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9337('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9337('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9337('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9337('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9337('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9337('0xf')](_0x9337('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9337('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9337('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9337('0x4e')],'get':function(){return this[_0x9337('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0x9337('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9337('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9337('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![],'set':function(_0xb23a7e){if(typeof _0xb23a7e===_0x9337('0x4f')){var _0x25c9db=_0xb23a7e==='1'?!![]:_0xb23a7e==='0'?![]:_0xb23a7e===_0x9337('0x50')?!![]:_0xb23a7e===_0x9337('0x51')?![]:![];this[_0x9337('0x6')]('screenrecording',_0x25c9db);}else{this[_0x9337('0x6')]('screenrecording',_0xb23a7e);}}},'blocked':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![],'set':function(_0x4bf01a){this[_0x9337('0x6')]('blocked',_0x4bf01a);if(_0x4bf01a===!![]){this[_0x9337('0x6')](_0x9337('0x52'),moment());this['setDataValue'](_0x9337('0x53'),0x0);}else{this['setDataValue'](_0x9337('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0x9337('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9337('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9337('0x14')](0x5)[_0x9337('0x54')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x9337('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9337('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9337('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9337('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d3e89de..3e22ee4 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 _0x9f0e=['bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','each','create','isEmpty','autoAssociation','changePassword','oldPassword','newPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','online','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','Unknown\x20channel','remove','Queues','isArray','Queue:remove','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','findOne','sort','pick','getContacts','hasOwnProperty','CmList','List','Tag','Tags','tag','getQueues','Queue','order','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','UserId','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','format','intrf','user:%s','user:forcelogout','headers','socket','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','logout','pause','QueuePause','type','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','unpause','manual','%s%s','Pause','Team','getTeams','addTeams','getVoiceQueues','setDataValue','Voice','getChatQueues','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Chat','getMailQueues','Sms','getOpenchannelQueues','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$any','firstName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','iat','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','queues','teams','inbound','getAgents','lower','col','toString','desc','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','busy','slice','toUpperCase','QueryTypes','field','ui.','InteractionId','user_has_','_interactions','OpenTabs','moment','bluebird','util','path','lodash','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','client','http','then','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','role','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','find','value','name','sendStatus','stack','send','index','rawAttributes','fieldName','key','getOptions','where','User','query','includeAll','include','attributes','findAll','openTabs','true','length','push','chat','rows','dataValues','sms','fax','mail','openchannel','whatsapp','show','params','model','differenceBy','keys','password','filters','intersection','fields','merge','options','includes','body','describe','addContacts','ids','omit','internal','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)','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','104','105','107','108','109','100','111','114','Unauthorized','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','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x281e06,_0x4126a0){var _0x2cf295=function(_0x13093c){while(--_0x13093c){_0x281e06['push'](_0x281e06['shift']());}};_0x2cf295(++_0x4126a0);}(_0x9f0e,0x116));var _0xe9f0=function(_0x397034,_0x57d11f){_0x397034=_0x397034-0x0;var _0x586c83=_0x9f0e[_0x397034];return _0x586c83;};'use strict';var moment=require(_0xe9f0('0x0'));var BPromise=require(_0xe9f0('0x1'));var util=require(_0xe9f0('0x2'));var path=require(_0xe9f0('0x3'));var fs=require('fs');var _=require(_0xe9f0('0x4'));var squel=require('squel');var jayson=require('jayson/promise');var Redis=require(_0xe9f0('0x5'));var authService=require(_0xe9f0('0x6'));var qs=require(_0xe9f0('0x7'));var logger=require(_0xe9f0('0x8'))(_0xe9f0('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe9f0('0xa'));var db=require(_0xe9f0('0xb'))['db'];var socket=require(_0xe9f0('0xc'))(new Redis(config['redis']));require(_0xe9f0('0xd'))[_0xe9f0('0xe')](socket);config[_0xe9f0('0xf')]=_[_0xe9f0('0x10')](config[_0xe9f0('0xf')],{'host':_0xe9f0('0x11'),'port':0x18eb});var client=jayson[_0xe9f0('0x12')][_0xe9f0('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x6acfb,_0x5352e0,_0x39b5b1,_0x329ecd){return new BPromise(function(_0x2d2863,_0x4a82aa){var _0x207fac=_0x329ecd||client;return _0x207fac['request'](_0x6acfb,_0x39b5b1)[_0xe9f0('0x14')](function(_0xd82420){logger[_0xe9f0('0x15')](_0xe9f0('0x16'),_0x5352e0,'request\x20sent');logger[_0xe9f0('0x17')]('User,\x20%s,\x20%s,\x20%s',_0x5352e0,_0xe9f0('0x18'),JSON[_0xe9f0('0x19')](_0xd82420));if(_0xd82420[_0xe9f0('0x1a')]){if(_0xd82420['error'][_0xe9f0('0x1b')]===0x1f4){logger[_0xe9f0('0x1a')](_0xe9f0('0x16'),_0x5352e0,_0xd82420['error'][_0xe9f0('0x1c')]);return _0x4a82aa(_0xd82420[_0xe9f0('0x1a')][_0xe9f0('0x1c')]);}logger[_0xe9f0('0x1a')](_0xe9f0('0x16'),_0x5352e0,_0xd82420[_0xe9f0('0x1a')][_0xe9f0('0x1c')]);return _0x2d2863(_0xd82420['error'][_0xe9f0('0x1c')]);}else{logger[_0xe9f0('0x15')](_0xe9f0('0x16'),_0x5352e0,'request\x20sent');_0x2d2863(_0xd82420[_0xe9f0('0x1d')][_0xe9f0('0x1c')]);}})[_0xe9f0('0x1e')](function(_0x43f399){logger['error'](_0xe9f0('0x16'),_0x5352e0,_0x43f399);_0x4a82aa(_0x43f399);});});}function respondWithStatusCode(_0xfaa312,_0x583687){_0x583687=_0x583687||0xcc;return function(_0x51e03f){if(_0x51e03f){return _0xfaa312['sendStatus'](_0x583687);}return _0xfaa312[_0xe9f0('0x1f')](_0x583687)[_0xe9f0('0x20')]();};}function respondWithResult(_0x1211ae,_0x316cdf){_0x316cdf=_0x316cdf||0xc8;return function(_0x3ce106){if(_0x3ce106){return _0x1211ae['status'](_0x316cdf)[_0xe9f0('0x21')](_0x3ce106);}};}function respondWithFilteredResult(_0x38b7ee,_0x437d43){return function(_0x10801b){if(_0x10801b){var _0x3ca991=typeof _0x437d43[_0xe9f0('0x22')]===_0xe9f0('0x23')&&typeof _0x437d43[_0xe9f0('0x24')]===_0xe9f0('0x23');var _0x3fce54=_0x10801b['count'];var _0x371095=_0x3ca991?0x0:_0x437d43[_0xe9f0('0x22')];var _0x2ddfba=_0x3ca991?_0x10801b[_0xe9f0('0x25')]:_0x437d43['offset']+_0x437d43[_0xe9f0('0x24')];var _0x2613fd;if(_0x2ddfba>=_0x3fce54){_0x2ddfba=_0x3fce54;_0x2613fd=0xc8;}else{_0x2613fd=0xce;}_0x38b7ee[_0xe9f0('0x1f')](_0x2613fd);return _0x38b7ee[_0xe9f0('0x26')](_0xe9f0('0x27'),_0x371095+'-'+_0x2ddfba+'/'+_0x3fce54)['json'](_0x10801b);}return null;};}function saveUpdates(_0x130f96){return function(_0xdc16bc){if(_0xdc16bc){return _0xdc16bc[_0xe9f0('0x28')](_0x130f96)[_0xe9f0('0x14')](function(_0xa27c84){return _0xa27c84;});}return null;};}function removeEntity(_0xd19788){return function(_0x1d788a){if(_0x1d788a){return _0x1d788a[_0xe9f0('0x29')]()[_0xe9f0('0x14')](function(){var _0x3dbe49=_0x1d788a[_0xe9f0('0x2a')]({'plain':!![]});if(_0x3dbe49[_0xe9f0('0x2b')]===_0xe9f0('0x2c'))return;var _0x2ab77d=[{'name':_0xe9f0('0x2d'),'value':_0xe9f0('0x2e'),'ignore':!![]},{'name':_0xe9f0('0x2f'),'value':_0xe9f0('0x30'),'ignore':![]},{'name':_0xe9f0('0x31'),'value':_0xe9f0('0x32'),'ignore':![]}];var _0x4089cc=_(_0x2ab77d)[_0xe9f0('0x33')](_0xe9f0('0x34'))[_0xe9f0('0x35')]('value')['value']();if(_['includes'](_0x4089cc,_0x3dbe49[_0xe9f0('0x2b')])){return;}var _0x585742=_[_0xe9f0('0x36')](_0x2ab77d,[_0xe9f0('0x37'),_0x3dbe49['role']])[_0xe9f0('0x38')];return db['UserProfileResource']['destroy']({'where':{'type':_0x585742,'resourceId':_0x3dbe49['id']}})['then'](function(){return _0x1d788a;});})[_0xe9f0('0x14')](function(){_0xd19788[_0xe9f0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3becb9){return function(_0xb0cfc){if(!_0xb0cfc){_0x3becb9[_0xe9f0('0x39')](0x194);}return _0xb0cfc;};}function handleError(_0x4d4186,_0x523fbc){_0x523fbc=_0x523fbc||0x1f4;return function(_0x3fb04e){logger[_0xe9f0('0x1a')](_0x3fb04e[_0xe9f0('0x3a')]);if(_0x3fb04e['name']){delete _0x3fb04e[_0xe9f0('0x38')];}_0x4d4186[_0xe9f0('0x1f')](_0x523fbc)[_0xe9f0('0x3b')](_0x3fb04e);};}exports[_0xe9f0('0x3c')]=function(_0x2b38de,_0x552ec2){var _0x2ab492={},_0x3a2b23={'count':0x0,'rows':[]};var _0x2ede2=_(db['User'][_0xe9f0('0x3d')])[_0xe9f0('0x35')](function(_0x4825f2){return{'name':_0x4825f2[_0xe9f0('0x3e')],'type':_0x4825f2['type'][_0xe9f0('0x3f')]};})['filter'](function(_0x5dcbeb){return!_['includes'](['password','salt'],_0x5dcbeb[_0xe9f0('0x38')]);})[_0xe9f0('0x37')]();_0x2ab492=qs[_0xe9f0('0x40')](_0x2ede2,_0x2b38de);var _0x40c2c6={'where':_0x2ab492[_0xe9f0('0x41')]};return db[_0xe9f0('0x42')][_0xe9f0('0x25')](_0x40c2c6)[_0xe9f0('0x14')](function(_0xb06e04){_0x3a2b23['count']=_0xb06e04;if(_0x2b38de[_0xe9f0('0x43')][_0xe9f0('0x44')]){_0x2ab492[_0xe9f0('0x45')]=[{'all':!![]}];}if(!_['includes'](_0x2ab492['attributes'],'id')){_0x2ab492[_0xe9f0('0x46')]['push']('id');}return db[_0xe9f0('0x42')][_0xe9f0('0x47')](_0x2ab492);})[_0xe9f0('0x14')](function(_0x42d9d2){_0x3a2b23['rows']=_0x42d9d2;if(_0x2b38de[_0xe9f0('0x43')][_0xe9f0('0x48')]===_0xe9f0('0x49')){var _0x18faaf=[];for(var _0x37a2ac=0x0;_0x37a2ac<_0x3a2b23['rows'][_0xe9f0('0x4a')];_0x37a2ac++){_0x18faaf[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x4c'),_0x3a2b23[_0xe9f0('0x4d')][_0x37a2ac][_0xe9f0('0x4e')]));_0x18faaf['push'](get_open_tabs(_0xe9f0('0x4f'),_0x3a2b23['rows'][_0x37a2ac]['dataValues']));_0x18faaf[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x50'),_0x3a2b23['rows'][_0x37a2ac][_0xe9f0('0x4e')]));_0x18faaf[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x51'),_0x3a2b23[_0xe9f0('0x4d')][_0x37a2ac][_0xe9f0('0x4e')]));_0x18faaf[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x52'),_0x3a2b23['rows'][_0x37a2ac][_0xe9f0('0x4e')]));_0x18faaf['push'](get_open_tabs(_0xe9f0('0x53'),_0x3a2b23['rows'][_0x37a2ac][_0xe9f0('0x4e')]));}return BPromise['all'](_0x18faaf)[_0xe9f0('0x14')](function(_0x2023b4){return _0x3a2b23;});}else{return _0x3a2b23;}})[_0xe9f0('0x14')](respondWithFilteredResult(_0x552ec2,_0x2ab492))['catch'](handleError(_0x552ec2,null));};exports[_0xe9f0('0x54')]=function(_0xcf426d,_0x3e351a){var _0x22fce6={'raw':![],'where':{'id':_0xcf426d[_0xe9f0('0x55')]['id']}},_0x9a25fb={};_0x9a25fb[_0xe9f0('0x56')]=_[_0xe9f0('0x57')](_[_0xe9f0('0x58')](db[_0xe9f0('0x42')][_0xe9f0('0x3d')]),[_0xe9f0('0x59'),'salt']);_0x9a25fb['query']=_[_0xe9f0('0x58')](_0xcf426d[_0xe9f0('0x43')]);_0x9a25fb[_0xe9f0('0x5a')]=_['intersection'](_0x9a25fb[_0xe9f0('0x56')],_0x9a25fb['query']);_0x22fce6[_0xe9f0('0x46')]=_[_0xe9f0('0x5b')](_0x9a25fb[_0xe9f0('0x56')],qs[_0xe9f0('0x5c')](_0xcf426d['query'][_0xe9f0('0x5c')]));_0x22fce6[_0xe9f0('0x46')]=_0x22fce6['attributes'][_0xe9f0('0x4a')]?_0x22fce6[_0xe9f0('0x46')]:_0x9a25fb[_0xe9f0('0x56')];if(_0xcf426d[_0xe9f0('0x43')]['includeAll']){_0x22fce6[_0xe9f0('0x45')]=[{'all':!![]}];}_0x22fce6=_[_0xe9f0('0x5d')]({},_0x22fce6,_0xcf426d[_0xe9f0('0x5e')]);if(!_[_0xe9f0('0x5f')](_0x22fce6[_0xe9f0('0x46')],'id')){_0x22fce6[_0xe9f0('0x46')][_0xe9f0('0x4b')]('id');}return db[_0xe9f0('0x42')]['find'](_0x22fce6)[_0xe9f0('0x14')](handleEntityNotFound(_0x3e351a,null))[_0xe9f0('0x14')](function(_0x465380){var _0x4728e7=[];values=_0x465380;if(_0xcf426d[_0xe9f0('0x43')][_0xe9f0('0x48')]===_0xe9f0('0x49')){_0x4728e7[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x4c'),_0x465380[_0xe9f0('0x4e')]));_0x4728e7[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x4f'),_0x465380[_0xe9f0('0x4e')]));_0x4728e7[_0xe9f0('0x4b')](get_open_tabs('openchannel',_0x465380[_0xe9f0('0x4e')]));_0x4728e7[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x53'),_0x465380['dataValues']));_0x4728e7['push'](get_open_tabs(_0xe9f0('0x50'),_0x465380['dataValues']));_0x4728e7[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x51'),_0x465380[_0xe9f0('0x4e')]));return BPromise['all'](_0x4728e7);}else{return values;}})[_0xe9f0('0x14')](function(_0x454b8a){return values;})[_0xe9f0('0x14')](respondWithResult(_0x3e351a,null))[_0xe9f0('0x1e')](handleError(_0x3e351a,null));};exports['update']=function(_0x392eae,_0x3a05e7){if(_0x392eae[_0xe9f0('0x60')]['id']){delete _0x392eae[_0xe9f0('0x60')]['id'];}delete _0x392eae['body']['role'];return db[_0xe9f0('0x42')][_0xe9f0('0x36')]({'where':{'id':_0x392eae[_0xe9f0('0x55')]['id']}})[_0xe9f0('0x14')](handleEntityNotFound(_0x3a05e7,null))[_0xe9f0('0x14')](saveUpdates(_0x392eae['body'],null))[_0xe9f0('0x14')](respondWithResult(_0x3a05e7,null))['catch'](handleError(_0x3a05e7,null));};exports[_0xe9f0('0x61')]=function(_0x5858a9,_0x7c05aa){return db[_0xe9f0('0x42')][_0xe9f0('0x61')]()[_0xe9f0('0x14')](respondWithResult(_0x7c05aa,null))[_0xe9f0('0x1e')](handleError(_0x7c05aa,null));};exports['addContacts']=function(_0x4e972e,_0x4bfb6d){return db[_0xe9f0('0x42')][_0xe9f0('0x36')]({'where':{'id':_0x4e972e['params']['id']}})[_0xe9f0('0x14')](handleEntityNotFound(_0x4bfb6d,null))['then'](function(_0x4f6a5b){if(_0x4f6a5b){return _0x4f6a5b[_0xe9f0('0x62')](_0x4e972e[_0xe9f0('0x60')][_0xe9f0('0x63')],_[_0xe9f0('0x64')](_0x4e972e[_0xe9f0('0x60')],[_0xe9f0('0x63'),'id'])||{});}})['then'](respondWithResult(_0x4bfb6d,null))['catch'](handleError(_0x4bfb6d,null));};function validateUser(_0x1255e6){return new BPromise(function(_0x248f10,_0x12d40a){if(_0x1255e6[_0xe9f0('0x65')])return _0x248f10(_0x1255e6);return db['Setting'][_0xe9f0('0x66')](0x1)[_0xe9f0('0x14')](function(_0x22b44a){if(_0x22b44a[_0xe9f0('0x67')])authService[_0xe9f0('0x68')](_0x1255e6[_0xe9f0('0x59')]);db['User'][_0xe9f0('0x69')](_0xe9f0('0x65'))[_0xe9f0('0x14')](function(_0x16f19f){if(_[_0xe9f0('0x6a')](_0x16f19f)){_0x1255e6['internal']=_0x22b44a[_0xe9f0('0x6b')]||0x1;return;}if(_[_0xe9f0('0x6a')](_0x22b44a[_0xe9f0('0x6b')])||_0x22b44a[_0xe9f0('0x6b')]===_0x16f19f){_0x1255e6[_0xe9f0('0x65')]=_0x16f19f+0x1;return;}if(_0x22b44a[_0xe9f0('0x6b')]>_0x16f19f){_0x1255e6[_0xe9f0('0x65')]=_0x22b44a[_0xe9f0('0x6b')];return;}return db[_0xe9f0('0x6c')][_0xe9f0('0x43')](_0xe9f0('0x6d'),{'type':db[_0xe9f0('0x6c')]['QueryTypes'][_0xe9f0('0x6e')]})[_0xe9f0('0x14')](function(_0x78fcdb){if(_0x78fcdb&&_0x78fcdb[_0xe9f0('0x4a')]){for(var _0x3c700e=0x0,_0x2428aa=_0x78fcdb[_0xe9f0('0x4a')];_0x3c700e<_0x2428aa&&_['isNil'](_0x1255e6[_0xe9f0('0x65')]);_0x3c700e++){if(_0x22b44a[_0xe9f0('0x6b')]<=_0x78fcdb[_0x3c700e]['from']){_0x1255e6[_0xe9f0('0x65')]=_0x78fcdb[_0x3c700e][_0xe9f0('0x6f')];}else if(_0x22b44a[_0xe9f0('0x6b')]>_0x78fcdb[_0x3c700e]['from']&&_0x22b44a[_0xe9f0('0x6b')]<=_0x78fcdb[_0x3c700e]['to']){_0x1255e6[_0xe9f0('0x65')]=_0x22b44a['min_internal'];}}}if(_[_0xe9f0('0x6a')](_0x1255e6[_0xe9f0('0x65')])){_0x1255e6['internal']=_0x16f19f+0x1;}return _0x248f10(_0x1255e6);});});})['catch'](function(_0x45466b){_0x12d40a(_0x45466b);});});}function updateUser(_0x507e02){return new BPromise(function(_0x386d7b,_0x3afb6c){try{if(_0x507e02['voicemail']){_0x507e02[_0xe9f0('0x70')]=_0x507e02[_0xe9f0('0x65')];_0x507e02[_0xe9f0('0x71')]={'mailbox':_0x507e02[_0xe9f0('0x65')],'password':_0x507e02[_0xe9f0('0x59')],'fullname':_0x507e02[_0xe9f0('0x72')],'email':_0x507e02[_0xe9f0('0x73')]};}if(_0x507e02[_0xe9f0('0x2b')]===_0xe9f0('0x30')){if(!_0x507e02['permissions'])_0x507e02[_0xe9f0('0x74')]=[_0xe9f0('0x75'),_0xe9f0('0x76'),_0xe9f0('0x77'),_0xe9f0('0x78'),_0xe9f0('0x79'),_0xe9f0('0x7a'),_0xe9f0('0x7b'),'106',_0xe9f0('0x7c'),_0xe9f0('0x7d'),_0xe9f0('0x7e'),_0xe9f0('0x7f'),_0xe9f0('0x80'),_0xe9f0('0x81'),'115'];}_0x386d7b(_0x507e02);}catch(_0x12e663){_0x3afb6c(_0x12e663);}});}exports['create']=function(_0x5dda96,_0x5ca5e5){if(_0x5dda96[_0xe9f0('0x2e')][_0xe9f0('0x2b')]===_0xe9f0('0x30'))throw new Error(_0xe9f0('0x82'));if(_0x5dda96[_0xe9f0('0x60')][_0xe9f0('0x2b')]===_0xe9f0('0x2e')&&_0x5dda96[_0xe9f0('0x2e')][_0xe9f0('0x2b')]!=='admin'){throw new Error(_0xe9f0('0x83'));}if(_0x5dda96[_0xe9f0('0x60')][_0xe9f0('0x2b')]===_0xe9f0('0x2c')&&_0x5dda96[_0xe9f0('0x2e')][_0xe9f0('0x2b')]!==_0xe9f0('0x2c')){throw new Error(_0xe9f0('0x84'));}return licenseUtil[_0xe9f0('0x85')]([_0x5dda96[_0xe9f0('0x60')]])['then'](function(){return validateUser(_0x5dda96['body']);})[_0xe9f0('0x14')](function(_0x27ff72){return updateUser(_0x27ff72)[_0xe9f0('0x14')](function(_0x2b4a03){if(_0x2b4a03[_0xe9f0('0x2b')]===_0xe9f0('0x2c')){_0x2b4a03[_0xe9f0('0x86')]=_0x5dda96[_0xe9f0('0x2e')]['settingsEnabled'];delete _0x2b4a03['userProfileId'];}return _0x2b4a03;});})[_0xe9f0('0x14')](function(_0x449a6a){return db['User']['create'](_0x449a6a,{'include':[{'model':db[_0xe9f0('0x71')],'as':_0xe9f0('0x71')}]});})[_0xe9f0('0x14')](function(_0xab92b){if(_0x5dda96[_0xe9f0('0x60')]['role']===_0xe9f0('0x2e'))return _0xab92b;if(_0x5dda96[_0xe9f0('0x2e')][_0xe9f0('0x2b')]!==_0xe9f0('0x2e'))return _0xab92b;return db[_0xe9f0('0x87')][_0xe9f0('0x36')]({'where':{'name':_0xab92b[_0xe9f0('0x2b')]==='agent'?'Agents':'Telephones','userProfileId':_0x5dda96[_0xe9f0('0x2e')][_0xe9f0('0x88')]},'raw':!![]})[_0xe9f0('0x14')](function(_0x39affc){if(!_0x39affc||_0x39affc['autoAssociation']!=0x0)return _0xab92b;return db[_0xe9f0('0x89')]['create']({'name':_0xab92b[_0xe9f0('0x38')],'resourceId':_0xab92b['id'],'type':_0x39affc['name'],'sectionId':_0x39affc['id']},{})[_0xe9f0('0x14')](function(){return _0xab92b;});})[_0xe9f0('0x1e')](function(_0x83cb0b){logger[_0xe9f0('0x1a')](_0xe9f0('0x8a'),_0x83cb0b);throw _0x83cb0b;});})[_0xe9f0('0x14')](respondWithResult(_0x5ca5e5,0xc9))['catch'](handleError(_0x5ca5e5,null));};exports[_0xe9f0('0x8b')]=function(_0x1820f6,_0x7a0ccc){var _0x470c5a=_0x1820f6[_0xe9f0('0x60')];var _0x5da556=[];if(_0x1820f6[_0xe9f0('0x2e')][_0xe9f0('0x2b')]==='agent')throw new Error(_0xe9f0('0x82'));if(_['some'](_0x470c5a,[_0xe9f0('0x2b'),_0xe9f0('0x2e')])&&_0x1820f6[_0xe9f0('0x2e')]['role']!==_0xe9f0('0x2c')){throw new Error(_0xe9f0('0x83'));}if(_[_0xe9f0('0x8c')](_0x470c5a,['role',_0xe9f0('0x2c')])&&_0x1820f6[_0xe9f0('0x2e')][_0xe9f0('0x2b')]!==_0xe9f0('0x2c')){throw new Error(_0xe9f0('0x8d'));}return licenseUtil[_0xe9f0('0x85')](_0x470c5a)[_0xe9f0('0x14')](function(){return validateUser(_0x470c5a[0x0]);})['then'](function(){for(var _0x4a416c=0x1;_0x4a416c<_0x470c5a[_0xe9f0('0x4a')];_0x4a416c++){var _0x37a475=_0x470c5a[_0x4a416c-0x1][_0xe9f0('0x65')];if(!_0x470c5a[_0x4a416c]['internal'])_0x470c5a[_0x4a416c][_0xe9f0('0x65')]=_0x37a475+0x1;_0x5da556[_0xe9f0('0x4b')](validateUser(_0x470c5a[_0x4a416c]));}return BPromise[_0xe9f0('0x8e')](_0x5da556);})[_0xe9f0('0x14')](function(){_0x5da556=[];for(var _0x592592=0x0;_0x592592<_0x470c5a['length'];_0x592592++){_0x5da556[_0xe9f0('0x4b')](updateUser(_0x470c5a[_0x592592]));}return BPromise[_0xe9f0('0x8e')](_0x5da556);})['then'](function(){return BPromise[_0xe9f0('0x8f')](_0x470c5a,function(_0x5b26b1){return db['User'][_0xe9f0('0x90')](_0x5b26b1,{'include':[{'model':db[_0xe9f0('0x71')],'as':_0xe9f0('0x71')}]})[_0xe9f0('0x14')](function(_0x10c4cf){_0x5b26b1['id']=_0x10c4cf['id'];return _0x5b26b1;});});})['then'](function(_0x5761d3){if(_0x1820f6[_0xe9f0('0x60')][_0xe9f0('0x2b')]===_0xe9f0('0x2e'))return _0x5761d3;if(_0x1820f6[_0xe9f0('0x2e')][_0xe9f0('0x2b')]!=='user')return _0x5761d3;var _0x57b0d0=_['some'](_0x5761d3,function(_0xb78361){return _0xb78361['role']===_0xe9f0('0x30')||_0xb78361[_0xe9f0('0x2b')]===_0xe9f0('0x32');});if(!_0x57b0d0)return _0x5761d3;return db[_0xe9f0('0x87')][_0xe9f0('0x47')]({'where':{'name':{'$or':[_0xe9f0('0x2f'),'Telephones']},'userProfileId':_0x1820f6['user'][_0xe9f0('0x88')]},'raw':!![]})[_0xe9f0('0x14')](function(_0x55bcc4){if(_[_0xe9f0('0x91')](_0x55bcc4)||!_[_0xe9f0('0x8c')](_0x55bcc4,[_0xe9f0('0x92'),0x0]))return _0x5761d3;_0x5da556=[];var _0x22d878=_(_0x55bcc4)[_0xe9f0('0x35')](function(_0x29764d){if(_0x29764d[_0xe9f0('0x92')]===0x1)return;return _0x29764d[_0xe9f0('0x38')]===_0xe9f0('0x2f')?_0xe9f0('0x30'):_0xe9f0('0x32');})['compact']()[_0xe9f0('0x37')]();for(var _0x169951=0x0;_0x169951<_0x5761d3[_0xe9f0('0x4a')];_0x169951++){if(!_[_0xe9f0('0x5f')](_0x22d878,_0x5761d3[_0x169951][_0xe9f0('0x2b')]))return;var _0x34203f=_0x5761d3[_0x169951][_0xe9f0('0x2b')]===_0xe9f0('0x30')?_0xe9f0('0x2f'):_0xe9f0('0x31');_0x5da556[_0xe9f0('0x4b')](db['UserProfileResource'][_0xe9f0('0x90')]({'name':_0x5761d3[_0x169951][_0xe9f0('0x38')],'resourceId':_0x5761d3[_0x169951]['id'],'type':_0x34203f,'sectionId':_[_0xe9f0('0x36')](_0x55bcc4,[_0xe9f0('0x38'),_0x34203f])['id']},{}));}return BPromise[_0xe9f0('0x8e')](_0x5da556);});})[_0xe9f0('0x14')](respondWithResult(_0x7a0ccc,0xc9))[_0xe9f0('0x1e')](handleError(_0x7a0ccc,null));};exports[_0xe9f0('0x93')]=function(_0x5b32f2,_0x5c5ac9){if(_0x5b32f2[_0xe9f0('0x60')]['id']){delete _0x5b32f2[_0xe9f0('0x60')]['id'];}return db['User']['find']({'where':{'id':_0x5b32f2[_0xe9f0('0x55')]['id']}})[_0xe9f0('0x14')](function(_0x37a080){if(!_0x37a080)return null;if(_0x37a080['id']===_0x5b32f2[_0xe9f0('0x2e')]['id']){if(!_0x5b32f2[_0xe9f0('0x60')][_0xe9f0('0x94')]||!_0x5b32f2['body'][_0xe9f0('0x95')]){throw new db[(_0xe9f0('0x96'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x37a080[_0xe9f0('0x97')](_0x5b32f2[_0xe9f0('0x60')]['oldPassword'])){throw new db[(_0xe9f0('0x96'))][(_0xe9f0('0x98'))](_0xe9f0('0x99'));}if(_0x5b32f2['body'][_0xe9f0('0x94')]===_0x5b32f2[_0xe9f0('0x60')][_0xe9f0('0x95')]){throw new db[(_0xe9f0('0x96'))]['ValidationError'](_0xe9f0('0x9a'));}}else if(_0x5b32f2[_0xe9f0('0x2e')][_0xe9f0('0x2b')]==='admin'){if(!_0x5b32f2['body']['newPassword']){throw new db[(_0xe9f0('0x96'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5b32f2[_0xe9f0('0x2e')]['role']===_0xe9f0('0x2e')){if(!_0x5b32f2[_0xe9f0('0x60')][_0xe9f0('0x95')]){throw new db[(_0xe9f0('0x96'))]['ValidationError'](_0xe9f0('0x9b'));}if(_0x37a080[_0xe9f0('0x2b')]!==_0xe9f0('0x30')){throw new db[(_0xe9f0('0x96'))][(_0xe9f0('0x98'))](_0xe9f0('0x82'));}}else{throw new db[(_0xe9f0('0x96'))][(_0xe9f0('0x98'))](_0xe9f0('0x82'));}return _0x37a080;})[_0xe9f0('0x14')](handleEntityNotFound(_0x5c5ac9,null))[_0xe9f0('0x14')](function(_0x1ceb54){return db[_0xe9f0('0x9c')]['findOne']({'attributes':['id',_0xe9f0('0x67'),_0xe9f0('0x9d'),'passwordHistoryLimit']})['then'](function(_0xec006){if(_0xec006[_0xe9f0('0x67')])authService[_0xe9f0('0x68')](_0x5b32f2[_0xe9f0('0x60')]['newPassword']);if(!_0xec006[_0xe9f0('0x9d')]||!_0x1ceb54[_0xe9f0('0x9e')])return _0x1ceb54;authService[_0xe9f0('0x9f')](_0x5b32f2['body'][_0xe9f0('0x95')],_0x1ceb54[_0xe9f0('0x9e')],_0xec006[_0xe9f0('0xa0')]);return _0x1ceb54;})[_0xe9f0('0x14')](saveUpdates({'password':_0x5b32f2[_0xe9f0('0x60')]['newPassword'],'passwordResetAt':_0x5b32f2['user']['id']==_0x5b32f2[_0xe9f0('0x55')]['id']?moment():null,'previousPasswords':authService[_0xe9f0('0xa1')](_0x5b32f2[_0xe9f0('0x60')][_0xe9f0('0x95')],_0x1ceb54[_0xe9f0('0x9e')])},null));})[_0xe9f0('0x14')](respondWithResult(_0x5c5ac9,null))[_0xe9f0('0x1e')](handleError(_0x5c5ac9,null));};exports[_0xe9f0('0xa2')]=function(_0x5ae9f1,_0x1aacfa){var _0x4eea8f=_0x5ae9f1['body'][_0xe9f0('0xa3')];return db[_0xe9f0('0x42')][_0xe9f0('0x36')]({'where':{'id':_0x5ae9f1['params']['id']},'attributes':['id',_0xe9f0('0x38'),_0xe9f0('0x2b'),'online',_0xe9f0('0xa4'),_0xe9f0('0xa5'),_0xe9f0('0xa6')]})[_0xe9f0('0x14')](handleEntityNotFound(_0x1aacfa,null))['then'](function(_0x25750e){if(_0x25750e){if(!utils['isValidChannel'](_0x4eea8f)){throw new db[(_0xe9f0('0x96'))]['ValidationError']('Unknown\x20channel');}return _0x25750e['add'+_[_0xe9f0('0xa7')](_0x4eea8f[_0xe9f0('0xa8')]())+'Queues'](_0x5ae9f1[_0xe9f0('0x60')][_0xe9f0('0x63')],{'penalty':_0x5ae9f1[_0xe9f0('0x60')][_0xe9f0('0xa9')]||0x0})[_0xe9f0('0xaa')](function(_0x40306a){for(var _0x1cfb29=0x0;_0x1cfb29<_0x5ae9f1['body'][_0xe9f0('0x63')][_0xe9f0('0x4a')];_0x1cfb29+=0x1){var _0x32eb6c={'UserId':Number(_0x5ae9f1['params']['id'])};_0x32eb6c[_[_0xe9f0('0xa7')](_0x4eea8f[_0xe9f0('0xa8')]())+_0xe9f0('0xab')]=Number(_0x5ae9f1['body'][_0xe9f0('0x63')][_0x1cfb29]);socket[_0xe9f0('0xac')]('user'+_[_0xe9f0('0xa7')](_0x4eea8f['toLowerCase']())+_0xe9f0('0xad'),_0x32eb6c);}return _0x40306a;})[_0xe9f0('0x14')](function(){if(_0x4eea8f===_0xe9f0('0xae')){return db[_0xe9f0('0xaf')][_0xe9f0('0x47')]({'where':{'id':_0x5ae9f1[_0xe9f0('0x60')]['ids']||[]},'raw':!![],'attributes':['id',_0xe9f0('0x38')]});}})[_0xe9f0('0x14')](function(_0xfe329a){var _0x1684a7=_0x25750e[_0xe9f0('0x2a')]({'plain':!![]});var _0x45e390=[];if(_0x4eea8f===_0xe9f0('0xae')&&_0x1684a7['role']==='agent'&&_0x1684a7[_0xe9f0('0xb0')]){for(var _0x3e8745=0x0;_0x3e8745<_0xfe329a['length'];_0x3e8745+=0x1){_0x45e390[_0xe9f0('0x4b')]({'membername':_0x1684a7['name'],'UserId':_0x1684a7['id'],'queue_name':_0xfe329a[_0x3e8745][_0xe9f0('0x38')],'VoiceQueueId':_0xfe329a[_0x3e8745]['id'],'interface':_[_0xe9f0('0x6a')](_0x1684a7['interface'])?util['format'](_0xe9f0('0xb1'),_0x1684a7[_0xe9f0('0x38')]):_0x1684a7[_0xe9f0('0xa6')],'paused':_0x1684a7['voicePause']||![],'penalty':_0x5ae9f1['body'][_0xe9f0('0xa9')]||0x0});}return BPromise[_0xe9f0('0x8f')](_0x45e390,function(_0x249c41){return db[_0xe9f0('0xb2')][_0xe9f0('0xb3')](_0x249c41);});}return _0x25750e;});}})[_0xe9f0('0x14')](respondWithStatusCode(_0x1aacfa,null))[_0xe9f0('0x1e')](handleError(_0x1aacfa,null));};exports[_0xe9f0('0xb4')]=function(_0x2f65a6,_0x45edd9){var _0x423364;return db[_0xe9f0('0x42')][_0xe9f0('0x36')]({'where':{'id':_0x2f65a6[_0xe9f0('0x55')]['id']},'attributes':['id','name',_0xe9f0('0x2b')]})['then'](handleEntityNotFound(_0x45edd9,null))[_0xe9f0('0x14')](function(_0x229e28){if(_0x229e28){_0x423364=_0x229e28;if(!_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0xa3')]||!utils[_0xe9f0('0xb5')](_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0xa3')])){throw new db[(_0xe9f0('0x96'))]['ValidationError'](_0xe9f0('0xb6'));}return _0x229e28[_0xe9f0('0xb7')+_[_0xe9f0('0xa7')](_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0xa3')][_0xe9f0('0xa8')]())+_0xe9f0('0xb8')](_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0x63')]);}})[_0xe9f0('0x14')](function(_0x896068){if(_[_0xe9f0('0xb9')](_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0x63')])){for(var _0x46705f=0x0;_0x46705f<_0x2f65a6[_0xe9f0('0x43')]['ids'][_0xe9f0('0x4a')];_0x46705f+=0x1){var _0x4a98e8={'UserId':Number(_0x2f65a6['params']['id'])};_0x4a98e8[_[_0xe9f0('0xa7')](_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0xa3')][_0xe9f0('0xa8')]())+'QueueId']=Number(_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0x63')][_0x46705f]);socket[_0xe9f0('0xac')](_0xe9f0('0x2e')+_['capitalize'](_0x2f65a6[_0xe9f0('0x43')]['channel']['toLowerCase']())+_0xe9f0('0xba'),_0x4a98e8);}}else{var _0x4a98e8={'UserId':Number(_0x2f65a6['params']['id'])};_0x4a98e8[_[_0xe9f0('0xa7')](_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0xa3')][_0xe9f0('0xa8')]())+_0xe9f0('0xab')]=Number(_0x2f65a6['query'][_0xe9f0('0x63')]);socket[_0xe9f0('0xac')]('user'+_[_0xe9f0('0xa7')](_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0xa3')][_0xe9f0('0xa8')]())+_0xe9f0('0xba'),_0x4a98e8);}return _0x896068;})[_0xe9f0('0x14')](function(){if(_0x2f65a6[_0xe9f0('0x43')][_0xe9f0('0xa3')]===_0xe9f0('0xae')){return db['UserVoiceQueueRt'][_0xe9f0('0x29')]({'where':{'UserId':_0x2f65a6[_0xe9f0('0x55')]['id'],'VoiceQueueId':_0x2f65a6['query'][_0xe9f0('0x63')]},'individualHooks':!![]})[_0xe9f0('0x14')](function(){return _0x423364;});}return _0x423364;})[_0xe9f0('0x14')](respondWithStatusCode(_0x45edd9,null))[_0xe9f0('0x1e')](handleError(_0x45edd9,null));};exports[_0xe9f0('0xbb')]=function(_0x4e7e1a,_0x54efec){_0x4e7e1a[_0xe9f0('0x60')][_0xe9f0('0xbc')]=_0x4e7e1a[_0xe9f0('0xbd')]['filename'];return db[_0xe9f0('0x42')][_0xe9f0('0x36')]({'where':{'id':_0x4e7e1a[_0xe9f0('0x55')]['id']}})[_0xe9f0('0x14')](handleEntityNotFound(_0x54efec,null))[_0xe9f0('0x14')](saveUpdates(_0x4e7e1a[_0xe9f0('0x60')],null))[_0xe9f0('0x14')](respondWithResult(_0x54efec,null))[_0xe9f0('0x1e')](handleError(_0x54efec,null));};exports[_0xe9f0('0xbe')]=function(_0x1869c1,_0x162c2e){var _0xf63dd8=path[_0xe9f0('0xbf')](config[_0xe9f0('0xc0')],_0xe9f0('0xc1'));return db[_0xe9f0('0x42')][_0xe9f0('0x36')]({'where':{'id':_0x1869c1['params']['id']},'attributes':['id',_0xe9f0('0xbc')],'raw':!![]})[_0xe9f0('0x14')](handleEntityNotFound(_0x162c2e,null))[_0xe9f0('0x14')](function(_0x58fe38){if(_0x58fe38){if(_[_0xe9f0('0x6a')](_0x58fe38['userpic'])){return _0x162c2e['download'](_0xf63dd8);}else{if(!fs[_0xe9f0('0xc2')](path['join'](config[_0xe9f0('0xc0')],'server/files/images/',_0x58fe38['userpic']))){return _0x162c2e[_0xe9f0('0xc3')](_0xf63dd8);}return _0x162c2e[_0xe9f0('0xc3')](path[_0xe9f0('0xbf')](config['root'],_0xe9f0('0xc4'),_0x58fe38[_0xe9f0('0xbc')]));}}})[_0xe9f0('0x1e')](handleError(_0x162c2e,null));};exports[_0xe9f0('0xc5')]=function(_0x1646cb,_0x3957d7){return db[_0xe9f0('0x42')][_0xe9f0('0x36')]({'where':{'id':_0x1646cb[_0xe9f0('0x55')]['id']},'attributes':['id']})[_0xe9f0('0x14')](handleEntityNotFound(_0x3957d7,null))[_0xe9f0('0x14')](function(_0x360e00){var _0x1c925b=[];values=_0x360e00[_0xe9f0('0x4e')];_0x1c925b['push'](get_open_tabs(_0xe9f0('0x4c'),_0x360e00[_0xe9f0('0x4e')]));_0x1c925b[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x4f'),_0x360e00[_0xe9f0('0x4e')]));_0x1c925b[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x52'),_0x360e00[_0xe9f0('0x4e')]));_0x1c925b['push'](get_open_tabs(_0xe9f0('0x53'),_0x360e00['dataValues']));_0x1c925b[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x50'),_0x360e00[_0xe9f0('0x4e')]));_0x1c925b[_0xe9f0('0x4b')](get_open_tabs(_0xe9f0('0x51'),_0x360e00[_0xe9f0('0x4e')]));return BPromise[_0xe9f0('0x8e')](_0x1c925b);})['then'](function(_0x17a367){var _0x5a6222=[];if(_0x17a367){for(var _0x1de13b=0x0;_0x1de13b=_0x557809){_0x3cbe43=_0x557809;_0xc52d0f=0xc8;}else{_0xc52d0f=0xce;}_0x1818d3[_0x901d('0x22')](_0xc52d0f);return _0x1818d3[_0x901d('0x28')](_0x901d('0x29'),_0x23fd43+'-'+_0x3cbe43+'/'+_0x557809)[_0x901d('0x23')](_0x45b6a8);}return null;};}function saveUpdates(_0x48e86e){return function(_0xae6dfe){if(_0xae6dfe){return _0xae6dfe['update'](_0x48e86e)[_0x901d('0x2a')](function(_0x389fd9){return _0x389fd9;});}return null;};}function removeEntity(_0x20dbc5){return function(_0x287ff2){if(_0x287ff2){return _0x287ff2[_0x901d('0x2b')]()[_0x901d('0x2a')](function(){var _0x4137b7=_0x287ff2[_0x901d('0x2c')]({'plain':!![]});if(_0x4137b7[_0x901d('0x2d')]===_0x901d('0x2e'))return;var _0x16770e=[{'name':_0x901d('0x2f'),'value':_0x901d('0x30'),'ignore':!![]},{'name':_0x901d('0x31'),'value':_0x901d('0x32'),'ignore':![]},{'name':'Telephones','value':_0x901d('0x33'),'ignore':![]}];var _0x1c280b=_(_0x16770e)[_0x901d('0x34')]('ignore')[_0x901d('0x35')](_0x901d('0x36'))[_0x901d('0x36')]();if(_[_0x901d('0x37')](_0x1c280b,_0x4137b7[_0x901d('0x2d')])){return;}var _0x3962c2=_[_0x901d('0x38')](_0x16770e,[_0x901d('0x36'),_0x4137b7[_0x901d('0x2d')]])[_0x901d('0x39')];return db['UserProfileResource']['destroy']({'where':{'type':_0x3962c2,'resourceId':_0x4137b7['id']}})[_0x901d('0x2a')](function(){return _0x287ff2;});})['then'](function(){_0x20dbc5[_0x901d('0x22')](0xcc)[_0x901d('0x3a')]();});}};}function handleEntityNotFound(_0x5f483b){return function(_0x3716fa){if(!_0x3716fa){_0x5f483b[_0x901d('0x21')](0x194);}return _0x3716fa;};}function handleError(_0x2f5e22,_0x508ac6){_0x508ac6=_0x508ac6||0x1f4;return function(_0x1a1be6){logger[_0x901d('0x1d')](_0x1a1be6[_0x901d('0x3b')]);if(_0x1a1be6[_0x901d('0x39')]){delete _0x1a1be6[_0x901d('0x39')];}_0x2f5e22[_0x901d('0x22')](_0x508ac6)[_0x901d('0x3c')](_0x1a1be6);};}exports[_0x901d('0x3d')]=function(_0xe56a2c,_0x384d82){var _0x30adcd={},_0x3d4f8b={'count':0x0,'rows':[]};var _0x27b101=_(db[_0x901d('0x3e')][_0x901d('0x3f')])[_0x901d('0x35')](function(_0x54a654){return{'name':_0x54a654[_0x901d('0x40')],'type':_0x54a654[_0x901d('0x41')]['key']};})['filter'](function(_0x28725d){return!_['includes']([_0x901d('0x42'),_0x901d('0x43')],_0x28725d[_0x901d('0x39')]);})[_0x901d('0x36')]();_0x30adcd=qs[_0x901d('0x44')](_0x27b101,_0xe56a2c);var _0xb1f35e={'where':_0x30adcd['where']};return db['User']['count'](_0xb1f35e)['then'](function(_0x3a5c9c){_0x3d4f8b[_0x901d('0x27')]=_0x3a5c9c;if(_0xe56a2c['query'][_0x901d('0x45')]){_0x30adcd[_0x901d('0x46')]=[{'all':!![]}];}if(!_['includes'](_0x30adcd[_0x901d('0x47')],'id')){_0x30adcd[_0x901d('0x47')][_0x901d('0x48')]('id');}return db[_0x901d('0x3e')]['findAll'](_0x30adcd);})['then'](function(_0xa9c008){_0x3d4f8b[_0x901d('0x49')]=_0xa9c008;if(_0xe56a2c[_0x901d('0x4a')][_0x901d('0x4b')]===_0x901d('0x4c')){var _0x199ff5=[];for(var _0x88bb50=0x0;_0x88bb50<_0x3d4f8b[_0x901d('0x49')][_0x901d('0x4d')];_0x88bb50++){_0x199ff5[_0x901d('0x48')](get_open_tabs(_0x901d('0x4e'),_0x3d4f8b['rows'][_0x88bb50][_0x901d('0x4f')]));_0x199ff5['push'](get_open_tabs(_0x901d('0x50'),_0x3d4f8b['rows'][_0x88bb50][_0x901d('0x4f')]));_0x199ff5['push'](get_open_tabs(_0x901d('0x51'),_0x3d4f8b[_0x901d('0x49')][_0x88bb50][_0x901d('0x4f')]));_0x199ff5[_0x901d('0x48')](get_open_tabs(_0x901d('0x52'),_0x3d4f8b[_0x901d('0x49')][_0x88bb50][_0x901d('0x4f')]));_0x199ff5[_0x901d('0x48')](get_open_tabs(_0x901d('0x53'),_0x3d4f8b[_0x901d('0x49')][_0x88bb50][_0x901d('0x4f')]));_0x199ff5['push'](get_open_tabs(_0x901d('0x54'),_0x3d4f8b[_0x901d('0x49')][_0x88bb50][_0x901d('0x4f')]));}return BPromise[_0x901d('0x55')](_0x199ff5)[_0x901d('0x2a')](function(_0x24b6fa){return _0x3d4f8b;});}else{return _0x3d4f8b;}})[_0x901d('0x2a')](respondWithFilteredResult(_0x384d82,_0x30adcd))[_0x901d('0x56')](handleError(_0x384d82,null));};exports[_0x901d('0x57')]=function(_0x1c0732,_0x3e01fd){var _0x107017={'raw':![],'where':{'id':_0x1c0732[_0x901d('0x58')]['id']}},_0x2cd965={};_0x2cd965['model']=_['differenceBy'](_[_0x901d('0x59')](db[_0x901d('0x3e')][_0x901d('0x3f')]),[_0x901d('0x42'),_0x901d('0x43')]);_0x2cd965['query']=_['keys'](_0x1c0732[_0x901d('0x4a')]);_0x2cd965[_0x901d('0x5a')]=_['intersection'](_0x2cd965[_0x901d('0x5b')],_0x2cd965[_0x901d('0x4a')]);_0x107017['attributes']=_[_0x901d('0x5c')](_0x2cd965['model'],qs[_0x901d('0x5d')](_0x1c0732[_0x901d('0x4a')][_0x901d('0x5d')]));_0x107017[_0x901d('0x47')]=_0x107017['attributes'][_0x901d('0x4d')]?_0x107017[_0x901d('0x47')]:_0x2cd965[_0x901d('0x5b')];if(_0x1c0732[_0x901d('0x4a')][_0x901d('0x45')]){_0x107017[_0x901d('0x46')]=[{'all':!![]}];}_0x107017=_[_0x901d('0x5e')]({},_0x107017,_0x1c0732[_0x901d('0x5f')]);if(!_[_0x901d('0x37')](_0x107017[_0x901d('0x47')],'id')){_0x107017['attributes'][_0x901d('0x48')]('id');}return db['User'][_0x901d('0x38')](_0x107017)[_0x901d('0x2a')](handleEntityNotFound(_0x3e01fd,null))[_0x901d('0x2a')](function(_0x2aa9b4){var _0x3e3487=[];values=_0x2aa9b4;if(_0x1c0732[_0x901d('0x4a')][_0x901d('0x4b')]===_0x901d('0x4c')){_0x3e3487['push'](get_open_tabs(_0x901d('0x4e'),_0x2aa9b4[_0x901d('0x4f')]));_0x3e3487[_0x901d('0x48')](get_open_tabs('sms',_0x2aa9b4[_0x901d('0x4f')]));_0x3e3487['push'](get_open_tabs(_0x901d('0x53'),_0x2aa9b4[_0x901d('0x4f')]));_0x3e3487[_0x901d('0x48')](get_open_tabs('whatsapp',_0x2aa9b4[_0x901d('0x4f')]));_0x3e3487[_0x901d('0x48')](get_open_tabs(_0x901d('0x51'),_0x2aa9b4[_0x901d('0x4f')]));_0x3e3487[_0x901d('0x48')](get_open_tabs(_0x901d('0x52'),_0x2aa9b4['dataValues']));return BPromise[_0x901d('0x55')](_0x3e3487);}else{return values;}})[_0x901d('0x2a')](function(_0x267f40){return values;})[_0x901d('0x2a')](respondWithResult(_0x3e01fd,null))[_0x901d('0x56')](handleError(_0x3e01fd,null));};exports[_0x901d('0x60')]=function(_0x52eb30,_0x12cd9d){if(_0x52eb30['body']['id']){delete _0x52eb30['body']['id'];}delete _0x52eb30['body']['role'];return db[_0x901d('0x3e')][_0x901d('0x38')]({'where':{'id':_0x52eb30[_0x901d('0x58')]['id']}})['then'](handleEntityNotFound(_0x12cd9d,null))[_0x901d('0x2a')](saveUpdates(_0x52eb30['body'],null))[_0x901d('0x2a')](respondWithResult(_0x12cd9d,null))[_0x901d('0x56')](handleError(_0x12cd9d,null));};exports[_0x901d('0x61')]=function(_0x23440d,_0x24d5ef){return db[_0x901d('0x3e')][_0x901d('0x61')]()[_0x901d('0x2a')](respondWithResult(_0x24d5ef,null))[_0x901d('0x56')](handleError(_0x24d5ef,null));};exports[_0x901d('0x62')]=function(_0x174b73,_0xaa6553){return db[_0x901d('0x3e')][_0x901d('0x38')]({'where':{'id':_0x174b73['params']['id']}})['then'](handleEntityNotFound(_0xaa6553,null))[_0x901d('0x2a')](function(_0x44db18){if(_0x44db18){return _0x44db18[_0x901d('0x62')](_0x174b73[_0x901d('0x63')][_0x901d('0x64')],_[_0x901d('0x65')](_0x174b73[_0x901d('0x63')],['ids','id'])||{});}})['then'](respondWithResult(_0xaa6553,null))['catch'](handleError(_0xaa6553,null));};function validateUser(_0x3e12fd){return new BPromise(function(_0x1f37dc,_0x22b518){if(_0x3e12fd[_0x901d('0x66')])return _0x1f37dc(_0x3e12fd);return db[_0x901d('0x67')][_0x901d('0x68')](0x1)[_0x901d('0x2a')](function(_0x2aeeb9){if(_0x2aeeb9[_0x901d('0x69')])authService['validatePasswordPattern'](_0x3e12fd['password']);db[_0x901d('0x3e')][_0x901d('0x6a')](_0x901d('0x66'))[_0x901d('0x2a')](function(_0x1c4aab){if(_[_0x901d('0x6b')](_0x1c4aab)){_0x3e12fd[_0x901d('0x66')]=_0x2aeeb9[_0x901d('0x6c')]||0x1;return;}if(_[_0x901d('0x6b')](_0x2aeeb9[_0x901d('0x6c')])||_0x2aeeb9['min_internal']===_0x1c4aab){_0x3e12fd[_0x901d('0x66')]=_0x1c4aab+0x1;return;}if(_0x2aeeb9[_0x901d('0x6c')]>_0x1c4aab){_0x3e12fd['internal']=_0x2aeeb9['min_internal'];return;}return db[_0x901d('0x6d')][_0x901d('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[_0x901d('0x6d')][_0x901d('0x6e')][_0x901d('0x6f')]})[_0x901d('0x2a')](function(_0x56c84f){if(_0x56c84f&&_0x56c84f[_0x901d('0x4d')]){for(var _0x22d805=0x0,_0x461d92=_0x56c84f[_0x901d('0x4d')];_0x22d805<_0x461d92&&_[_0x901d('0x6b')](_0x3e12fd[_0x901d('0x66')]);_0x22d805++){if(_0x2aeeb9['min_internal']<=_0x56c84f[_0x22d805][_0x901d('0x70')]){_0x3e12fd[_0x901d('0x66')]=_0x56c84f[_0x22d805][_0x901d('0x70')];}else if(_0x2aeeb9['min_internal']>_0x56c84f[_0x22d805][_0x901d('0x70')]&&_0x2aeeb9[_0x901d('0x6c')]<=_0x56c84f[_0x22d805]['to']){_0x3e12fd[_0x901d('0x66')]=_0x2aeeb9['min_internal'];}}}if(_['isNil'](_0x3e12fd['internal'])){_0x3e12fd[_0x901d('0x66')]=_0x1c4aab+0x1;}return _0x1f37dc(_0x3e12fd);});});})[_0x901d('0x56')](function(_0x5dd45e){_0x22b518(_0x5dd45e);});});}function updateUser(_0x5b01f9){return new BPromise(function(_0x1512f0,_0x31f4ee){try{if(_0x5b01f9[_0x901d('0x71')]){_0x5b01f9[_0x901d('0x72')]=_0x5b01f9[_0x901d('0x66')];_0x5b01f9['VoiceMail']={'mailbox':_0x5b01f9[_0x901d('0x66')],'password':_0x5b01f9[_0x901d('0x42')],'fullname':_0x5b01f9[_0x901d('0x73')],'email':_0x5b01f9[_0x901d('0x74')]};}if(_0x5b01f9['role']===_0x901d('0x32')){if(!_0x5b01f9['permissions'])_0x5b01f9[_0x901d('0x75')]=['101',_0x901d('0x76'),_0x901d('0x77'),_0x901d('0x78'),_0x901d('0x79'),_0x901d('0x7a'),_0x901d('0x7b'),_0x901d('0x7c'),'107',_0x901d('0x7d'),_0x901d('0x7e'),'100',_0x901d('0x7f'),'114','115'];}_0x1512f0(_0x5b01f9);}catch(_0x52196f){_0x31f4ee(_0x52196f);}});}exports['create']=function(_0xee8b2d,_0x2cdbe9){if(_0xee8b2d['user'][_0x901d('0x2d')]===_0x901d('0x32'))throw new Error(_0x901d('0x80'));if(_0xee8b2d[_0x901d('0x63')][_0x901d('0x2d')]==='user'&&_0xee8b2d[_0x901d('0x30')][_0x901d('0x2d')]!==_0x901d('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xee8b2d[_0x901d('0x63')][_0x901d('0x2d')]===_0x901d('0x2e')&&_0xee8b2d[_0x901d('0x30')][_0x901d('0x2d')]!==_0x901d('0x2e')){throw new Error(_0x901d('0x81'));}return licenseUtil[_0x901d('0x82')]([_0xee8b2d[_0x901d('0x63')]])[_0x901d('0x2a')](function(){return validateUser(_0xee8b2d[_0x901d('0x63')]);})[_0x901d('0x2a')](function(_0x3aece5){return updateUser(_0x3aece5)['then'](function(_0x2f0f86){if(_0x2f0f86[_0x901d('0x2d')]===_0x901d('0x2e')){_0x2f0f86[_0x901d('0x83')]=_0xee8b2d[_0x901d('0x30')][_0x901d('0x83')];delete _0x2f0f86[_0x901d('0x84')];}return _0x2f0f86;});})[_0x901d('0x2a')](function(_0x4b2c8c){return db[_0x901d('0x3e')][_0x901d('0x85')](_0x4b2c8c,{'include':[{'model':db[_0x901d('0x86')],'as':'VoiceMail'}]});})[_0x901d('0x2a')](function(_0x865b26){if(_0xee8b2d[_0x901d('0x63')][_0x901d('0x2d')]===_0x901d('0x30'))return _0x865b26;if(_0xee8b2d[_0x901d('0x30')][_0x901d('0x2d')]!==_0x901d('0x30'))return _0x865b26;return db[_0x901d('0x87')][_0x901d('0x38')]({'where':{'name':_0x865b26[_0x901d('0x2d')]===_0x901d('0x32')?_0x901d('0x31'):_0x901d('0x88'),'userProfileId':_0xee8b2d[_0x901d('0x30')][_0x901d('0x84')]},'raw':!![]})['then'](function(_0x2c8c6d){if(!_0x2c8c6d||_0x2c8c6d[_0x901d('0x89')]!=0x0)return _0x865b26;return db[_0x901d('0x8a')][_0x901d('0x85')]({'name':_0x865b26[_0x901d('0x39')],'resourceId':_0x865b26['id'],'type':_0x2c8c6d[_0x901d('0x39')],'sectionId':_0x2c8c6d['id']},{})['then'](function(){return _0x865b26;});})[_0x901d('0x56')](function(_0x12a238){logger[_0x901d('0x1d')](_0x901d('0x8b'),_0x12a238);throw _0x12a238;});})[_0x901d('0x2a')](respondWithResult(_0x2cdbe9,0xc9))[_0x901d('0x56')](handleError(_0x2cdbe9,null));};exports[_0x901d('0x8c')]=function(_0x519cf5,_0xb9ad91){var _0x48c441=_0x519cf5[_0x901d('0x63')];var _0x276fe8=[];if(_0x519cf5[_0x901d('0x30')][_0x901d('0x2d')]==='agent')throw new Error('Unauthorized');if(_['some'](_0x48c441,['role',_0x901d('0x30')])&&_0x519cf5[_0x901d('0x30')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x901d('0x8d')](_0x48c441,['role',_0x901d('0x2e')])&&_0x519cf5[_0x901d('0x30')][_0x901d('0x2d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x901d('0x82')](_0x48c441)[_0x901d('0x2a')](function(){return validateUser(_0x48c441[0x0]);})[_0x901d('0x2a')](function(){for(var _0x4d4548=0x1;_0x4d4548<_0x48c441['length'];_0x4d4548++){var _0x496e6a=_0x48c441[_0x4d4548-0x1][_0x901d('0x66')];if(!_0x48c441[_0x4d4548][_0x901d('0x66')])_0x48c441[_0x4d4548]['internal']=_0x496e6a+0x1;_0x276fe8[_0x901d('0x48')](validateUser(_0x48c441[_0x4d4548]));}return BPromise['all'](_0x276fe8);})['then'](function(){_0x276fe8=[];for(var _0x18fa00=0x0;_0x18fa00<_0x48c441['length'];_0x18fa00++){_0x276fe8[_0x901d('0x48')](updateUser(_0x48c441[_0x18fa00]));}return BPromise[_0x901d('0x55')](_0x276fe8);})[_0x901d('0x2a')](function(){return BPromise[_0x901d('0x8e')](_0x48c441,function(_0x29f7fd){return db[_0x901d('0x3e')]['create'](_0x29f7fd,{'include':[{'model':db[_0x901d('0x86')],'as':_0x901d('0x86')}]})[_0x901d('0x2a')](function(_0x1ee563){_0x29f7fd['id']=_0x1ee563['id'];return _0x29f7fd;});});})[_0x901d('0x2a')](function(_0x995b5f){if(_0x519cf5['body']['role']===_0x901d('0x30'))return _0x995b5f;if(_0x519cf5[_0x901d('0x30')][_0x901d('0x2d')]!==_0x901d('0x30'))return _0x995b5f;var _0x77f5f6=_[_0x901d('0x8d')](_0x995b5f,function(_0x12e0c4){return _0x12e0c4[_0x901d('0x2d')]===_0x901d('0x32')||_0x12e0c4[_0x901d('0x2d')]==='telephone';});if(!_0x77f5f6)return _0x995b5f;return db[_0x901d('0x87')][_0x901d('0x8f')]({'where':{'name':{'$or':[_0x901d('0x31'),_0x901d('0x88')]},'userProfileId':_0x519cf5[_0x901d('0x30')][_0x901d('0x84')]},'raw':!![]})[_0x901d('0x2a')](function(_0x37635a){if(_[_0x901d('0x90')](_0x37635a)||!_[_0x901d('0x8d')](_0x37635a,[_0x901d('0x89'),0x0]))return _0x995b5f;_0x276fe8=[];var _0x1d4c67=_(_0x37635a)[_0x901d('0x35')](function(_0xd9051f){if(_0xd9051f['autoAssociation']===0x1)return;return _0xd9051f[_0x901d('0x39')]===_0x901d('0x31')?_0x901d('0x32'):_0x901d('0x33');})[_0x901d('0x91')]()[_0x901d('0x36')]();for(var _0x402822=0x0;_0x402822<_0x995b5f[_0x901d('0x4d')];_0x402822++){if(!_[_0x901d('0x37')](_0x1d4c67,_0x995b5f[_0x402822]['role']))return;var _0x1268fc=_0x995b5f[_0x402822][_0x901d('0x2d')]===_0x901d('0x32')?_0x901d('0x31'):_0x901d('0x88');_0x276fe8[_0x901d('0x48')](db['UserProfileResource'][_0x901d('0x85')]({'name':_0x995b5f[_0x402822][_0x901d('0x39')],'resourceId':_0x995b5f[_0x402822]['id'],'type':_0x1268fc,'sectionId':_[_0x901d('0x38')](_0x37635a,[_0x901d('0x39'),_0x1268fc])['id']},{}));}return BPromise[_0x901d('0x55')](_0x276fe8);});})['then'](respondWithResult(_0xb9ad91,0xc9))['catch'](handleError(_0xb9ad91,null));};exports[_0x901d('0x92')]=function(_0x57ba5e,_0x3bc3b6){if(_0x57ba5e[_0x901d('0x63')]['id']){delete _0x57ba5e['body']['id'];}return db[_0x901d('0x3e')]['find']({'where':{'id':_0x57ba5e[_0x901d('0x58')]['id']}})['then'](function(_0x3118f5){if(!_0x3118f5)return null;if(_0x3118f5['id']===_0x57ba5e[_0x901d('0x30')]['id']){if(!_0x57ba5e['body'][_0x901d('0x93')]||!_0x57ba5e['body']['newPassword']){throw new db[(_0x901d('0x94'))][(_0x901d('0x95'))](_0x901d('0x96'));}if(!_0x3118f5[_0x901d('0x97')](_0x57ba5e[_0x901d('0x63')][_0x901d('0x93')])){throw new db['Sequelize'][(_0x901d('0x95'))](_0x901d('0x98'));}if(_0x57ba5e['body'][_0x901d('0x93')]===_0x57ba5e[_0x901d('0x63')]['newPassword']){throw new db[(_0x901d('0x94'))][(_0x901d('0x95'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x57ba5e['user'][_0x901d('0x2d')]===_0x901d('0x2e')){if(!_0x57ba5e[_0x901d('0x63')][_0x901d('0x99')]){throw new db[(_0x901d('0x94'))][(_0x901d('0x95'))](_0x901d('0x9a'));}}else if(_0x57ba5e[_0x901d('0x30')][_0x901d('0x2d')]===_0x901d('0x30')){if(!_0x57ba5e[_0x901d('0x63')][_0x901d('0x99')]){throw new db[(_0x901d('0x94'))][(_0x901d('0x95'))](_0x901d('0x9a'));}if(_0x3118f5[_0x901d('0x2d')]!==_0x901d('0x32')){throw new db[(_0x901d('0x94'))][(_0x901d('0x95'))](_0x901d('0x80'));}}else{throw new db[(_0x901d('0x94'))][(_0x901d('0x95'))](_0x901d('0x80'));}return _0x3118f5;})[_0x901d('0x2a')](handleEntityNotFound(_0x3bc3b6,null))[_0x901d('0x2a')](function(_0x7a5c92){return db[_0x901d('0x67')][_0x901d('0x9b')]({'attributes':['id',_0x901d('0x69'),_0x901d('0x9c'),_0x901d('0x9d')]})[_0x901d('0x2a')](function(_0x9b86f8){if(_0x9b86f8[_0x901d('0x69')])authService['validatePasswordPattern'](_0x57ba5e['body'][_0x901d('0x99')]);if(!_0x9b86f8[_0x901d('0x9c')]||!_0x7a5c92[_0x901d('0x9e')])return _0x7a5c92;authService['validatePasswordHistory'](_0x57ba5e['body'][_0x901d('0x99')],_0x7a5c92[_0x901d('0x9e')],_0x9b86f8['passwordHistoryLimit']);return _0x7a5c92;})[_0x901d('0x2a')](saveUpdates({'password':_0x57ba5e[_0x901d('0x63')]['newPassword'],'passwordResetAt':_0x57ba5e[_0x901d('0x30')]['id']==_0x57ba5e[_0x901d('0x58')]['id']?moment():null,'previousPasswords':authService[_0x901d('0x9f')](_0x57ba5e[_0x901d('0x63')][_0x901d('0x99')],_0x7a5c92[_0x901d('0x9e')])},null));})[_0x901d('0x2a')](respondWithResult(_0x3bc3b6,null))[_0x901d('0x56')](handleError(_0x3bc3b6,null));};exports[_0x901d('0xa0')]=function(_0x23420d,_0x23be96){var _0x5eea7f=_0x23420d[_0x901d('0x63')]['channel'];return db[_0x901d('0x3e')][_0x901d('0x38')]({'where':{'id':_0x23420d['params']['id']},'attributes':['id',_0x901d('0x39'),_0x901d('0x2d'),_0x901d('0xa1'),_0x901d('0xa2'),'voicePause',_0x901d('0xa3')]})[_0x901d('0x2a')](handleEntityNotFound(_0x23be96,null))[_0x901d('0x2a')](function(_0x521511){if(_0x521511){if(!utils[_0x901d('0xa4')](_0x5eea7f)){throw new db[(_0x901d('0x94'))]['ValidationError'](_0x901d('0xa5'));}return _0x521511[_0x901d('0xa6')+_['capitalize'](_0x5eea7f[_0x901d('0xa7')]())+'Queues'](_0x23420d['body'][_0x901d('0x64')],{'penalty':_0x23420d[_0x901d('0x63')][_0x901d('0xa8')]||0x0})['spread'](function(_0x8cc655){for(var _0x2fb62a=0x0;_0x2fb62a<_0x23420d[_0x901d('0x63')]['ids'][_0x901d('0x4d')];_0x2fb62a+=0x1){var _0x2bc3c8={'UserId':Number(_0x23420d[_0x901d('0x58')]['id'])};_0x2bc3c8[_['capitalize'](_0x5eea7f[_0x901d('0xa7')]())+'QueueId']=Number(_0x23420d['body'][_0x901d('0x64')][_0x2fb62a]);socket[_0x901d('0xa9')](_0x901d('0x30')+_[_0x901d('0xaa')](_0x5eea7f[_0x901d('0xa7')]())+_0x901d('0xab'),_0x2bc3c8);}return _0x8cc655;})[_0x901d('0x2a')](function(){if(_0x5eea7f===_0x901d('0xac')){return db[_0x901d('0xad')]['findAll']({'where':{'id':_0x23420d['body'][_0x901d('0x64')]||[]},'raw':!![],'attributes':['id',_0x901d('0x39')]});}})[_0x901d('0x2a')](function(_0x271b0e){var _0x311b0e=_0x521511[_0x901d('0x2c')]({'plain':!![]});var _0x4cee21=[];if(_0x5eea7f===_0x901d('0xac')&&_0x311b0e[_0x901d('0x2d')]===_0x901d('0x32')&&_0x311b0e[_0x901d('0xa1')]){for(var _0x11a732=0x0;_0x11a732<_0x271b0e[_0x901d('0x4d')];_0x11a732+=0x1){_0x4cee21[_0x901d('0x48')]({'membername':_0x311b0e[_0x901d('0x39')],'UserId':_0x311b0e['id'],'queue_name':_0x271b0e[_0x11a732]['name'],'VoiceQueueId':_0x271b0e[_0x11a732]['id'],'interface':_[_0x901d('0x6b')](_0x311b0e[_0x901d('0xa3')])?util[_0x901d('0xae')](_0x901d('0xaf'),_0x311b0e['name']):_0x311b0e[_0x901d('0xa3')],'paused':_0x311b0e[_0x901d('0xb0')]||![],'penalty':_0x23420d[_0x901d('0x63')][_0x901d('0xa8')]||0x0});}return BPromise[_0x901d('0x8e')](_0x4cee21,function(_0x5abe6c){return db[_0x901d('0xb1')]['upsert'](_0x5abe6c);});}return _0x521511;});}})['then'](respondWithStatusCode(_0x23be96,null))[_0x901d('0x56')](handleError(_0x23be96,null));};exports[_0x901d('0xb2')]=function(_0x1d924e,_0x15fb34){var _0x38b46f;return db[_0x901d('0x3e')][_0x901d('0x38')]({'where':{'id':_0x1d924e[_0x901d('0x58')]['id']},'attributes':['id','name',_0x901d('0x2d')]})[_0x901d('0x2a')](handleEntityNotFound(_0x15fb34,null))[_0x901d('0x2a')](function(_0x3ae7ac){if(_0x3ae7ac){_0x38b46f=_0x3ae7ac;if(!_0x1d924e['query'][_0x901d('0xb3')]||!utils[_0x901d('0xa4')](_0x1d924e[_0x901d('0x4a')][_0x901d('0xb3')])){throw new db[(_0x901d('0x94'))][(_0x901d('0x95'))](_0x901d('0xa5'));}return _0x3ae7ac[_0x901d('0xb4')+_[_0x901d('0xaa')](_0x1d924e[_0x901d('0x4a')][_0x901d('0xb3')][_0x901d('0xa7')]())+_0x901d('0xb5')](_0x1d924e['query'][_0x901d('0x64')]);}})['then'](function(_0x4dca47){if(_['isArray'](_0x1d924e['query'][_0x901d('0x64')])){for(var _0x2223e9=0x0;_0x2223e9<_0x1d924e[_0x901d('0x4a')]['ids'][_0x901d('0x4d')];_0x2223e9+=0x1){var _0x4aea70={'UserId':Number(_0x1d924e[_0x901d('0x58')]['id'])};_0x4aea70[_['capitalize'](_0x1d924e[_0x901d('0x4a')]['channel'][_0x901d('0xa7')]())+_0x901d('0xb6')]=Number(_0x1d924e['query'][_0x901d('0x64')][_0x2223e9]);socket[_0x901d('0xa9')](_0x901d('0x30')+_[_0x901d('0xaa')](_0x1d924e['query'][_0x901d('0xb3')][_0x901d('0xa7')]())+_0x901d('0xb7'),_0x4aea70);}}else{var _0x4aea70={'UserId':Number(_0x1d924e[_0x901d('0x58')]['id'])};_0x4aea70[_[_0x901d('0xaa')](_0x1d924e[_0x901d('0x4a')][_0x901d('0xb3')][_0x901d('0xa7')]())+_0x901d('0xb6')]=Number(_0x1d924e[_0x901d('0x4a')][_0x901d('0x64')]);socket[_0x901d('0xa9')](_0x901d('0x30')+_[_0x901d('0xaa')](_0x1d924e[_0x901d('0x4a')][_0x901d('0xb3')][_0x901d('0xa7')]())+'Queue:remove',_0x4aea70);}return _0x4dca47;})[_0x901d('0x2a')](function(){if(_0x1d924e[_0x901d('0x4a')][_0x901d('0xb3')]===_0x901d('0xac')){return db['UserVoiceQueueRt'][_0x901d('0x2b')]({'where':{'UserId':_0x1d924e['params']['id'],'VoiceQueueId':_0x1d924e[_0x901d('0x4a')]['ids']},'individualHooks':!![]})[_0x901d('0x2a')](function(){return _0x38b46f;});}return _0x38b46f;})[_0x901d('0x2a')](respondWithStatusCode(_0x15fb34,null))[_0x901d('0x56')](handleError(_0x15fb34,null));};exports[_0x901d('0xb8')]=function(_0x29583e,_0x207eac){_0x29583e[_0x901d('0x63')][_0x901d('0xb9')]=_0x29583e[_0x901d('0xba')][_0x901d('0xbb')];return db[_0x901d('0x3e')]['find']({'where':{'id':_0x29583e['params']['id']}})[_0x901d('0x2a')](handleEntityNotFound(_0x207eac,null))[_0x901d('0x2a')](saveUpdates(_0x29583e[_0x901d('0x63')],null))[_0x901d('0x2a')](respondWithResult(_0x207eac,null))['catch'](handleError(_0x207eac,null));};exports[_0x901d('0xbc')]=function(_0x12afcc,_0x1c0e6a){var _0x46eec7=path[_0x901d('0xbd')](config[_0x901d('0xbe')],_0x901d('0xbf'));return db[_0x901d('0x3e')][_0x901d('0x38')]({'where':{'id':_0x12afcc['params']['id']},'attributes':['id',_0x901d('0xb9')],'raw':!![]})[_0x901d('0x2a')](handleEntityNotFound(_0x1c0e6a,null))['then'](function(_0x4e9def){if(_0x4e9def){if(_[_0x901d('0x6b')](_0x4e9def[_0x901d('0xb9')])){return _0x1c0e6a['download'](_0x46eec7);}else{if(!fs[_0x901d('0xc0')](path[_0x901d('0xbd')](config['root'],_0x901d('0xc1'),_0x4e9def['userpic']))){return _0x1c0e6a[_0x901d('0xc2')](_0x46eec7);}return _0x1c0e6a[_0x901d('0xc2')](path[_0x901d('0xbd')](config[_0x901d('0xbe')],'server/files/images/',_0x4e9def['userpic']));}}})['catch'](handleError(_0x1c0e6a,null));};exports[_0x901d('0xc3')]=function(_0x3c5403,_0x4e3acd){return db[_0x901d('0x3e')][_0x901d('0x38')]({'where':{'id':_0x3c5403[_0x901d('0x58')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4e3acd,null))[_0x901d('0x2a')](function(_0x2df740){var _0x4dddb4=[];values=_0x2df740[_0x901d('0x4f')];_0x4dddb4[_0x901d('0x48')](get_open_tabs(_0x901d('0x4e'),_0x2df740[_0x901d('0x4f')]));_0x4dddb4[_0x901d('0x48')](get_open_tabs(_0x901d('0x50'),_0x2df740[_0x901d('0x4f')]));_0x4dddb4[_0x901d('0x48')](get_open_tabs(_0x901d('0x53'),_0x2df740[_0x901d('0x4f')]));_0x4dddb4[_0x901d('0x48')](get_open_tabs(_0x901d('0x54'),_0x2df740[_0x901d('0x4f')]));_0x4dddb4[_0x901d('0x48')](get_open_tabs(_0x901d('0x51'),_0x2df740[_0x901d('0x4f')]));_0x4dddb4[_0x901d('0x48')](get_open_tabs(_0x901d('0x52'),_0x2df740[_0x901d('0x4f')]));return BPromise['all'](_0x4dddb4);})['then'](function(_0x1f9776){var _0x1b6ec3=[];if(_0x1f9776){for(var _0x1138b0=0x0;_0x1138b0=_0x3857df[_0xaf5d('0x52')]){throw new Error(_0xaf5d('0x53'));}})[_0xaf5d('0xf')](function(){if(_0x35d0c6){return db[_0xaf5d('0x3f')][_0xaf5d('0x4b')]({'where':{'membername':_0x35d0c6[_0xaf5d('0x33')]},'individualHooks':!![]});}})[_0xaf5d('0xf')](function(){if(_0x35d0c6){return _0x35d0c6[_0xaf5d('0x54')]({'raw':!![]});}})[_0xaf5d('0xf')](function(_0x3eb50e){if(_0x35d0c6){if(_0x3eb50e){var _0x4f1b6a=[];_0x33258b=_0x3eb50e;if(_0x33258b[_0xaf5d('0x2d')]){for(var _0x2cc23f=0x0;_0x2cc23f<_0x33258b[_0xaf5d('0x2d')];_0x2cc23f++){_0x4f1b6a[_0xaf5d('0x32')](db[_0xaf5d('0x3f')][_0xaf5d('0x55')]({'membername':_0x35d0c6[_0xaf5d('0x33')],'UserId':_0x35d0c6['id'],'queue_name':_0x33258b[_0x2cc23f][_0xaf5d('0x33')],'VoiceQueueId':_0x33258b[_0x2cc23f]['id'],'interface':_0x3aea16,'paused':_0x35d0c6[_0xaf5d('0x56')]||![],'penalty':_0x33258b[_0x2cc23f][_0xaf5d('0x57')]||0x0}));}return BPromise['all'](_0x4f1b6a);}}}})['then'](function(){if(_0x35d0c6){return db[_0xaf5d('0x2c')][_0xaf5d('0x1d')]({'where':{'membername':_0x35d0c6[_0xaf5d('0x33')],'exitAt':null}});}})[_0xaf5d('0xf')](function(_0x293996){if(_0x35d0c6){if(_0x293996&&_0x293996[_0xaf5d('0x2d')]){var _0x2db688=[];_0x293996[_0xaf5d('0x31')](function(_0x54f1ee){_0x2db688[_0xaf5d('0x32')](_0x54f1ee[_0xaf5d('0x2b')]({'exitAt':moment()[_0xaf5d('0x2e')](_0xaf5d('0x2f'))}));});return BPromise[_0xaf5d('0x49')](_0x2db688);}}})['then'](function(_0x49743c){if(_0x35d0c6){var _0x421c38=[];var _0x3afc78=[];var _0x447bb1=utils[_0xaf5d('0x58')]();var _0x5c8c71={'membername':_0x35d0c6[_0xaf5d('0x33')],'interface':_0x3aea16,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x35d0c6[_0xaf5d('0x29')],'internal':_0x35d0c6[_0xaf5d('0x59')]};_0x447bb1['forEach'](function(_0x1805fd){_0x421c38[_0xaf5d('0x32')](_[_0xaf5d('0x5a')]({'channel':_0x1805fd,'type':_0xaf5d('0x5b'),'data1':_0xaf5d('0x5c'),'data2':_0x3aea16},_0x5c8c71));if(_0x35d0c6[_0xaf5d('0x56')]){_0x3afc78[_0xaf5d('0x32')](_[_0xaf5d('0x5a')]({'channel':_0x1805fd,'type':_0xaf5d('0x36'),'data1':_0xaf5d('0x5d')},_0x5c8c71));}});return db[_0xaf5d('0x2c')][_0xaf5d('0x3a')](_0x421c38[_0xaf5d('0x5e')](_0x3afc78),{'individualHooks':!![]});}})['then'](function(){if(_0x35d0c6){return _0x35d0c6[_0xaf5d('0x2b')]({'online':!![],'lastLoginAt':moment()['format'](_0xaf5d('0x2f')),'voicePause':_0x35d0c6[_0xaf5d('0x56')]||![],'mailPause':_0x35d0c6['loginInPause']||![],'chatPause':_0x35d0c6['loginInPause']||![],'faxPause':_0x35d0c6[_0xaf5d('0x56')]||![],'smsPause':_0x35d0c6[_0xaf5d('0x56')]||![],'openchannelPause':_0x35d0c6[_0xaf5d('0x56')]||![],'pauseType':_0x35d0c6[_0xaf5d('0x56')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xaf5d('0x2e')](_0xaf5d('0x2f')),'interface':_0x3aea16});}})[_0xaf5d('0xf')](function(_0x40f9be){_0x5f252d(_0x40f9be);})[_0xaf5d('0x1a')](function(_0x422311){_0xaaea17(_0x48fbba[_0xaf5d('0x16')](0x1f4,_0x422311[_0xaf5d('0x18')]));});});}; \ No newline at end of file +var _0x2e1d=['concat','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','localhost','socket.io-emitter','redis','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','User','findAll','options','raw','where','attributes','include','map','model','GetUser','stringify','ShowUser','PauseUser','find','name','role','UserVoiceQueueRt','update','MemberReport','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','push','isNil','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','findOne','channel','isValidChannel','voice','system','fax','sms','openchannel','set','%s%s','Pause','forEach','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','interface','count','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','merge','callysquare','LOGININPAUSE'];(function(_0x194e96,_0x4ac4fd){var _0x58acfd=function(_0x45de5a){while(--_0x45de5a){_0x194e96['push'](_0x194e96['shift']());}};_0x58acfd(++_0x4ac4fd);}(_0x2e1d,0xb5));var _0xd2e1=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x2e1d[_0x507403];return _0x1327c;};'use strict';var _=require('lodash');var util=require(_0xd2e1('0x0'));var moment=require(_0xd2e1('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2e1('0x2'));var fs=require('fs');var Redis=require(_0xd2e1('0x3'));var db=require(_0xd2e1('0x4'))['db'];var utils=require(_0xd2e1('0x5'));var logger=require('../../config/logger')(_0xd2e1('0x6'));var config=require(_0xd2e1('0x7'));var jayson=require(_0xd2e1('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd2e1('0x9'),'port':0x18eb});var socket=require(_0xd2e1('0xa'))(new Redis(config[_0xd2e1('0xb')]));require(_0xd2e1('0xc'))[_0xd2e1('0xd')](socket);function respondWithRpcPromise(_0x5112d2,_0x4d9c19,_0x4b7b37){return new BPromise(function(_0x27cd99,_0x52cc51){return client[_0xd2e1('0xe')](_0x5112d2,_0x4b7b37)[_0xd2e1('0xf')](function(_0x20ca9b){logger[_0xd2e1('0x10')](_0xd2e1('0x11'),_0x4d9c19,_0xd2e1('0x12'));logger[_0xd2e1('0x13')](_0xd2e1('0x14'),_0x4d9c19,'request\x20sent',JSON['stringify'](_0x20ca9b));if(_0x20ca9b['error']){if(_0x20ca9b[_0xd2e1('0x15')][_0xd2e1('0x16')]===0x1f4){logger[_0xd2e1('0x15')](_0xd2e1('0x11'),_0x4d9c19,_0x20ca9b[_0xd2e1('0x15')][_0xd2e1('0x17')]);return _0x52cc51(_0x20ca9b[_0xd2e1('0x15')]['message']);}logger[_0xd2e1('0x15')](_0xd2e1('0x11'),_0x4d9c19,_0x20ca9b['error']['message']);return _0x27cd99(_0x20ca9b['error']['message']);}else{logger[_0xd2e1('0x10')](_0xd2e1('0x11'),_0x4d9c19,_0xd2e1('0x12'));_0x27cd99(_0x20ca9b[_0xd2e1('0x18')][_0xd2e1('0x17')]);}})[_0xd2e1('0x19')](function(_0x3ce990){logger[_0xd2e1('0x15')]('User,\x20%s,\x20%s',_0x4d9c19,_0x3ce990);_0x52cc51(_0x3ce990);});});}exports['GetUser']=function(_0x2b2552){var _0x513b75=this;return new Promise(function(_0x470fce,_0xe90d4b){return db[_0xd2e1('0x1a')][_0xd2e1('0x1b')]({'raw':_0x2b2552['options']?_0x2b2552[_0xd2e1('0x1c')][_0xd2e1('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b2552[_0xd2e1('0x1c')]?_0x2b2552['options'][_0xd2e1('0x1e')]||null:null,'attributes':_0x2b2552['options']?_0x2b2552[_0xd2e1('0x1c')][_0xd2e1('0x1f')]||null:null,'limit':_0x2b2552[_0xd2e1('0x1c')]?_0x2b2552[_0xd2e1('0x1c')]['limit']||null:null,'include':_0x2b2552[_0xd2e1('0x1c')]?_0x2b2552['options'][_0xd2e1('0x20')]?_[_0xd2e1('0x21')](_0x2b2552[_0xd2e1('0x1c')][_0xd2e1('0x20')],function(_0x2a8436){return{'model':db[_0x2a8436[_0xd2e1('0x22')]],'as':_0x2a8436['as'],'attributes':_0x2a8436[_0xd2e1('0x1f')],'include':_0x2a8436[_0xd2e1('0x20')]?_[_0xd2e1('0x21')](_0x2a8436['include'],function(_0x21abb7){return{'model':db[_0x21abb7[_0xd2e1('0x22')]],'as':_0x21abb7['as'],'attributes':_0x21abb7[_0xd2e1('0x1f')],'include':_0x21abb7[_0xd2e1('0x20')]?_[_0xd2e1('0x21')](_0x21abb7[_0xd2e1('0x20')],function(_0x1a5e89){return{'model':db[_0x1a5e89[_0xd2e1('0x22')]],'as':_0x1a5e89['as'],'attributes':_0x1a5e89[_0xd2e1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2728aa){logger[_0xd2e1('0x10')](_0xd2e1('0x23'),_0x2b2552);logger[_0xd2e1('0x13')]('GetUser',_0x2b2552,JSON[_0xd2e1('0x24')](_0x2728aa));_0x470fce(_0x2728aa);})[_0xd2e1('0x19')](function(_0x2f540c){logger['error'](_0xd2e1('0x23'),_0x2f540c[_0xd2e1('0x17')],_0x2b2552);_0xe90d4b(_0x513b75[_0xd2e1('0x15')](0x1f4,_0x2f540c[_0xd2e1('0x17')]));});});};exports[_0xd2e1('0x25')]=function(_0x5db385){var _0x14fcfb=this;return new Promise(function(_0x12a3a4,_0x132e6e){return db['User']['find']({'raw':_0x5db385[_0xd2e1('0x1c')]?_0x5db385['options'][_0xd2e1('0x1d')]===undefined?!![]:![]:!![],'where':_0x5db385[_0xd2e1('0x1c')]?_0x5db385['options']['where']||null:null,'attributes':_0x5db385[_0xd2e1('0x1c')]?_0x5db385[_0xd2e1('0x1c')][_0xd2e1('0x1f')]||null:null,'include':_0x5db385['options']?_0x5db385['options'][_0xd2e1('0x20')]?_[_0xd2e1('0x21')](_0x5db385[_0xd2e1('0x1c')]['include'],function(_0x18182a){return{'model':db[_0x18182a[_0xd2e1('0x22')]],'as':_0x18182a['as'],'attributes':_0x18182a[_0xd2e1('0x1f')],'include':_0x18182a[_0xd2e1('0x20')]?_[_0xd2e1('0x21')](_0x18182a[_0xd2e1('0x20')],function(_0x526563){return{'model':db[_0x526563[_0xd2e1('0x22')]],'as':_0x526563['as'],'attributes':_0x526563[_0xd2e1('0x1f')],'include':_0x526563[_0xd2e1('0x20')]?_[_0xd2e1('0x21')](_0x526563[_0xd2e1('0x20')],function(_0x8147ec){return{'model':db[_0x8147ec[_0xd2e1('0x22')]],'as':_0x8147ec['as'],'attributes':_0x8147ec[_0xd2e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd2e1('0xf')](function(_0x3a6b55){logger[_0xd2e1('0x10')](_0xd2e1('0x25'),_0x5db385);logger[_0xd2e1('0x13')](_0xd2e1('0x25'),_0x5db385,JSON[_0xd2e1('0x24')](_0x3a6b55));_0x12a3a4(_0x3a6b55);})['catch'](function(_0x52c57e){logger['error']('ShowUser',_0x52c57e[_0xd2e1('0x17')],_0x5db385);_0x132e6e(_0x14fcfb[_0xd2e1('0x15')](0x1f4,_0x52c57e[_0xd2e1('0x17')]));});});};exports[_0xd2e1('0x26')]=function(_0xffb1a7){var _0x239646=this;return new Promise(function(_0x20eb2e,_0x4c67f0){var _0x254b53;return db[_0xd2e1('0x1a')][_0xd2e1('0x27')]({'where':_0xffb1a7[_0xd2e1('0x1c')]['where']||{},'attributes':['id',_0xd2e1('0x28'),_0xd2e1('0x29'),'internal','interface']})[_0xd2e1('0xf')](function(_0x32f8eb){if(_0x32f8eb){_0x254b53=_0x32f8eb;return db[_0xd2e1('0x2a')][_0xd2e1('0x2b')]({'paused':0x1},{'where':{'UserId':_0x254b53['id']},'individualHooks':!![]});}})[_0xd2e1('0xf')](function(){if(_0x254b53){return db[_0xd2e1('0x2c')][_0xd2e1('0x1b')]({'where':{'membername':_0x254b53[_0xd2e1('0x28')],'type':'PAUSE','exitAt':null}});}})[_0xd2e1('0xf')](function(_0x37dd2c){if(_0x254b53){if(_0x37dd2c&&_0x37dd2c['length']){var _0x33ce9d=moment()[_0xd2e1('0x2d')](_0xd2e1('0x2e'));for(var _0x51d99f=0x0,_0x44fec7=_0x37dd2c[_0xd2e1('0x2f')];_0x51d99f<_0x44fec7;_0x51d99f++){_0x37dd2c[_0x51d99f][_0xd2e1('0x30')]({'exitAt':_0x33ce9d});}}}})[_0xd2e1('0xf')](function(){if(_0x254b53){var _0x25ee4a=[];var _0x37012f=utils[_0xd2e1('0x31')]();_0x37012f['forEach'](function(_0xdb6e5d){_0x25ee4a[_0xd2e1('0x32')]({'channel':_0xdb6e5d,'membername':_0x254b53['name'],'interface':_[_0xd2e1('0x33')](_0x254b53['interface'])?util[_0xd2e1('0x2d')](_0xd2e1('0x34'),_0x254b53[_0xd2e1('0x28')]):_0x254b53['interface'],'type':_0xd2e1('0x35'),'enterAt':moment()['format'](_0xd2e1('0x2e')),'data1':_0xffb1a7[_0xd2e1('0x36')][_0xd2e1('0x37')]||_0xd2e1('0x38'),'role':_0x254b53[_0xd2e1('0x29')],'internal':_0x254b53[_0xd2e1('0x39')],'uniqueid':_0xffb1a7[_0xd2e1('0x36')][_0xd2e1('0x3a')]||null});});return db[_0xd2e1('0x2c')][_0xd2e1('0x3b')](_0x25ee4a,{'individualHooks':!![]});}})[_0xd2e1('0xf')](function(){if(_0x254b53){return _0x254b53[_0xd2e1('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xffb1a7[_0xd2e1('0x36')][_0xd2e1('0x37')]||_0xd2e1('0x38'),'lastPauseAt':moment()[_0xd2e1('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x4fb9d2){_0x20eb2e(_0x4fb9d2);})[_0xd2e1('0x19')](function(_0x314848){_0x4c67f0(_0x239646[_0xd2e1('0x15')](0x1f4,_0x314848['message']));});});};exports['UnpauseUser']=function(_0x14be82){var _0x328f58=this;return new Promise(function(_0x1b6990,_0x50beaa){var _0x33795a;return db[_0xd2e1('0x1a')][_0xd2e1('0x3c')]({'where':_0x14be82[_0xd2e1('0x1c')][_0xd2e1('0x1e')]||{},'attributes':['id','name']})[_0xd2e1('0xf')](function(_0x10f115){if(_0x10f115){_0x33795a=_0x10f115;if(_0x14be82[_0xd2e1('0x36')][_0xd2e1('0x3d')]&&!utils[_0xd2e1('0x3e')](_0x14be82[_0xd2e1('0x36')][_0xd2e1('0x3d')])){throw new Error('Unknown\x20channel');}switch(_0x14be82[_0xd2e1('0x36')][_0xd2e1('0x3d')]){case _0xd2e1('0x3f'):return db[_0xd2e1('0x2a')]['update']({'paused':0x0},{'where':{'UserId':_0x33795a['id']}})[_0xd2e1('0xf')](function(){return db['MemberReport'][_0xd2e1('0x27')]({'where':{'channel':_0x14be82[_0xd2e1('0x36')][_0xd2e1('0x3d')],'membername':_0x33795a['name'],'type':_0xd2e1('0x35'),'exitAt':null}});})[_0xd2e1('0xf')](function(_0x365a01){if(_0x365a01){return _0x365a01['update']({'exitAt':moment()[_0xd2e1('0x2d')](_0xd2e1('0x2e')),'data2':_0xd2e1('0x40')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x33795a['update']({'voicePause':![]});});case'mail':case'chat':case _0xd2e1('0x41'):case _0xd2e1('0x42'):case _0xd2e1('0x43'):case'whatsapp':return db[_0xd2e1('0x2c')][_0xd2e1('0x27')]({'where':{'channel':_0x14be82[_0xd2e1('0x36')][_0xd2e1('0x3d')],'membername':_0x33795a[_0xd2e1('0x28')],'type':_0xd2e1('0x35'),'exitAt':null}})[_0xd2e1('0xf')](function(_0x3a21bc){return _0x3a21bc['update']({'exitAt':moment()[_0xd2e1('0x2d')](_0xd2e1('0x2e')),'data2':_0xd2e1('0x40')},{'individualHooks':!![]});})[_0xd2e1('0xf')](function(){var _0x25ffde={};_[_0xd2e1('0x44')](_0x25ffde,util[_0xd2e1('0x2d')](_0xd2e1('0x45'),_0x14be82[_0xd2e1('0x36')]['channel'],_0xd2e1('0x46')),![]);return _0x33795a[_0xd2e1('0x2b')](_0x25ffde);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x33795a['id']}})[_0xd2e1('0xf')](function(){return db[_0xd2e1('0x2c')]['findAll']({'where':{'membername':_0x33795a[_0xd2e1('0x28')],'type':_0xd2e1('0x35'),'exitAt':null}});})[_0xd2e1('0xf')](function(_0x25400d){var _0x3c628e=[];_0x25400d[_0xd2e1('0x47')](function(_0x4ece2c){_0x3c628e[_0xd2e1('0x32')](_0x4ece2c[_0xd2e1('0x2b')]({'exitAt':moment()[_0xd2e1('0x2d')](_0xd2e1('0x2e')),'data2':'system'}));});return BPromise[_0xd2e1('0x48')](_0x3c628e);})[_0xd2e1('0xf')](function(){return _0x33795a[_0xd2e1('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xd2e1('0xf')](function(_0xf6a1b3){_0x1b6990(_0xf6a1b3);})['catch'](function(_0x16aea4){_0x50beaa(_0x328f58[_0xd2e1('0x15')](0x1f4,_0x16aea4[_0xd2e1('0x17')]));});});};exports[_0xd2e1('0x49')]=function(_0x5a4586){var _0x1ffaa2=this;return new Promise(function(_0x184e8a,_0x47ba86){var _0x5e51c8;return db[_0xd2e1('0x1a')][_0xd2e1('0x3c')]({'where':_0x5a4586[_0xd2e1('0x1c')][_0xd2e1('0x1e')]||{},'attributes':['id','name']})[_0xd2e1('0xf')](function(_0x876df6){if(_0x876df6){_0x5e51c8=_0x876df6;return db[_0xd2e1('0x2a')][_0xd2e1('0x4a')]({'where':{'membername':_0x5e51c8[_0xd2e1('0x28')]},'individualHooks':!![]});}})[_0xd2e1('0xf')](function(){if(_0x5e51c8){return db[_0xd2e1('0x2c')]['findAll']({'where':{'membername':_0x5e51c8['name'],'exitAt':null}});}})[_0xd2e1('0xf')](function(_0x1c14e4){if(_0x5e51c8){if(_0x1c14e4&&_0x1c14e4[_0xd2e1('0x2f')]){var _0x1d4a03=[];_0x1c14e4[_0xd2e1('0x47')](function(_0x33b8ad){_0x1d4a03['push'](_0x33b8ad['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd2e1('0x48')](_0x1d4a03);}}})[_0xd2e1('0xf')](function(){if(_0x5e51c8){return _0x5e51c8[_0xd2e1('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd2e1('0xf')](function(_0x10f8db){_0x184e8a(_0x10f8db);})[_0xd2e1('0x19')](function(_0x5dfaaa){_0x47ba86(_0x1ffaa2['error'](0x1f4,_0x5dfaaa['message']));});});};exports[_0xd2e1('0x4b')]=function(_0x3dbddb){var _0x3e021e=this;return new Promise(function(_0x150989,_0x541b10){var _0x173afd;var _0x32af3d;var _0x235e98;var _0x461f4e;return db[_0xd2e1('0x1a')][_0xd2e1('0x3c')]({'where':_0x3dbddb['options']['where']||{},'attributes':['id',_0xd2e1('0x28'),_0xd2e1('0x29'),_0xd2e1('0x4c'),_0xd2e1('0x4d'),'internal',_0xd2e1('0x4e'),_0xd2e1('0x4f')]})[_0xd2e1('0xf')](function(_0xd6e0db){if(_0xd6e0db){_0x173afd=_0xd6e0db;_0x461f4e=_0x3dbddb[_0xd2e1('0x36')]['interface']?_0x3dbddb[_0xd2e1('0x36')][_0xd2e1('0x4f')]:util[_0xd2e1('0x2d')]('SIP/%s',_0x173afd[_0xd2e1('0x28')]);return db[_0xd2e1('0x1a')][_0xd2e1('0x50')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x173afd['id']}}});}})[_0xd2e1('0xf')](function(_0x1eec8a){if(_0x1eec8a){_0x235e98=_0x1eec8a;return require(_0xd2e1('0x51'))[_0xd2e1('0x52')]();}})[_0xd2e1('0xf')](function(_0x1e79a4){if(_0x1e79a4&&_0x1e79a4[_0xd2e1('0x53')]&&_0x235e98>=_0x1e79a4['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xd2e1('0xf')](function(){if(_0x173afd){return db[_0xd2e1('0x2a')][_0xd2e1('0x4a')]({'where':{'membername':_0x173afd[_0xd2e1('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x173afd){return _0x173afd[_0xd2e1('0x54')]({'raw':!![]});}})[_0xd2e1('0xf')](function(_0x17b79b){if(_0x173afd){if(_0x17b79b){var _0x43956d=[];_0x32af3d=_0x17b79b;if(_0x32af3d[_0xd2e1('0x2f')]){for(var _0x73136b=0x0;_0x73136b<_0x32af3d[_0xd2e1('0x2f')];_0x73136b++){_0x43956d['push'](db[_0xd2e1('0x2a')][_0xd2e1('0x55')]({'membername':_0x173afd['name'],'UserId':_0x173afd['id'],'queue_name':_0x32af3d[_0x73136b]['name'],'VoiceQueueId':_0x32af3d[_0x73136b]['id'],'interface':_0x461f4e,'paused':_0x173afd[_0xd2e1('0x4e')]||![],'penalty':_0x32af3d[_0x73136b]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd2e1('0x48')](_0x43956d);}}}})[_0xd2e1('0xf')](function(){if(_0x173afd){return db[_0xd2e1('0x2c')][_0xd2e1('0x1b')]({'where':{'membername':_0x173afd[_0xd2e1('0x28')],'exitAt':null}});}})[_0xd2e1('0xf')](function(_0x17c6fe){if(_0x173afd){if(_0x17c6fe&&_0x17c6fe[_0xd2e1('0x2f')]){var _0x504fe1=[];_0x17c6fe[_0xd2e1('0x47')](function(_0x164aed){_0x504fe1['push'](_0x164aed[_0xd2e1('0x2b')]({'exitAt':moment()[_0xd2e1('0x2d')](_0xd2e1('0x2e'))}));});return BPromise[_0xd2e1('0x48')](_0x504fe1);}}})[_0xd2e1('0xf')](function(_0x1db41c){if(_0x173afd){var _0x2e5795=[];var _0x18d0c0=[];var _0x3c0020=utils['getChannels']();var _0x4faef0={'membername':_0x173afd[_0xd2e1('0x28')],'interface':_0x461f4e,'enterAt':moment()[_0xd2e1('0x2d')](_0xd2e1('0x2e')),'role':_0x173afd[_0xd2e1('0x29')],'internal':_0x173afd[_0xd2e1('0x39')]};_0x3c0020['forEach'](function(_0x571872){_0x2e5795[_0xd2e1('0x32')](_[_0xd2e1('0x56')]({'channel':_0x571872,'type':'LOGIN','data1':_0xd2e1('0x57'),'data2':_0x461f4e},_0x4faef0));if(_0x173afd[_0xd2e1('0x4e')]){_0x18d0c0[_0xd2e1('0x32')](_[_0xd2e1('0x56')]({'channel':_0x571872,'type':_0xd2e1('0x35'),'data1':_0xd2e1('0x58')},_0x4faef0));}});return db[_0xd2e1('0x2c')][_0xd2e1('0x3b')](_0x2e5795[_0xd2e1('0x59')](_0x18d0c0),{'individualHooks':!![]});}})[_0xd2e1('0xf')](function(){if(_0x173afd){return _0x173afd['update']({'online':!![],'lastLoginAt':moment()[_0xd2e1('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x173afd[_0xd2e1('0x4e')]||![],'mailPause':_0x173afd['loginInPause']||![],'chatPause':_0x173afd[_0xd2e1('0x4e')]||![],'faxPause':_0x173afd[_0xd2e1('0x4e')]||![],'smsPause':_0x173afd[_0xd2e1('0x4e')]||![],'openchannelPause':_0x173afd[_0xd2e1('0x4e')]||![],'pauseType':_0x173afd[_0xd2e1('0x4e')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xd2e1('0x2e')),'interface':_0x461f4e});}})[_0xd2e1('0xf')](function(_0x3a78a2){_0x150989(_0x3a78a2);})[_0xd2e1('0x19')](function(_0x4e5237){_0x541b10(_0x3e021e[_0xd2e1('0x15')](0x1f4,_0x4e5237[_0xd2e1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 929ced5..78fae4b 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 _0x1199=['remove','update','emit','register','user:','./user.events'];(function(_0x3fba46,_0x25cf19){var _0x727e61=function(_0x1ce468){while(--_0x1ce468){_0x3fba46['push'](_0x3fba46['shift']());}};_0x727e61(++_0x25cf19);}(_0x1199,0xad));var _0x9119=function(_0x2609f8,_0x378553){_0x2609f8=_0x2609f8-0x0;var _0x2c39e0=_0x1199[_0x2609f8];return _0x2c39e0;};'use strict';var UserEvents=require(_0x9119('0x0'));var events=['save',_0x9119('0x1'),_0x9119('0x2')];function createListener(_0x118fb8,_0xf7c147){return function(_0x4d0dc7){_0xf7c147[_0x9119('0x3')](_0x118fb8,_0x4d0dc7);};}function removeListener(_0x5f21cd,_0x22cb50){return function(){UserEvents['removeListener'](_0x5f21cd,_0x22cb50);};}exports[_0x9119('0x4')]=function(_0x5b144e){for(var _0x2ce71a=0x0,_0x2f317d=events['length'];_0x2ce71a<_0x2f317d;_0x2ce71a++){var _0x59d0c6=events[_0x2ce71a];var _0x576040=createListener(_0x9119('0x5')+_0x59d0c6,_0x5b144e);UserEvents['on'](_0x59d0c6,_0x576040);}}; \ No newline at end of file +var _0xc489=['remove','removeListener','register','length','user:','save'];(function(_0x313163,_0x4c317a){var _0x141333=function(_0x184a8f){while(--_0x184a8f){_0x313163['push'](_0x313163['shift']());}};_0x141333(++_0x4c317a);}(_0xc489,0x11f));var _0x9c48=function(_0x41f4b3,_0x4c535c){_0x41f4b3=_0x41f4b3-0x0;var _0x3a4866=_0xc489[_0x41f4b3];return _0x3a4866;};'use strict';var UserEvents=require('./user.events');var events=[_0x9c48('0x0'),_0x9c48('0x1'),'update'];function createListener(_0x14b80e,_0x5bd022){return function(_0x457d48){_0x5bd022['emit'](_0x14b80e,_0x457d48);};}function removeListener(_0x3b2cc6,_0x1cf4cc){return function(){UserEvents[_0x9c48('0x2')](_0x3b2cc6,_0x1cf4cc);};}exports[_0x9c48('0x3')]=function(_0x43a8eb){for(var _0x2a5e4c=0x0,_0x3b5720=events[_0x9c48('0x4')];_0x2a5e4c<_0x3b5720;_0x2a5e4c++){var _0x2567cd=events[_0x2a5e4c];var _0x251455=createListener(_0x9c48('0x5')+_0x2567cd,_0x43a8eb);UserEvents['on'](_0x2567cd,_0x251455);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 3d91f25..ef03b21 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x259ce8,_0x798276){var _0x5ef5c2=function(_0x1bb84e){while(--_0x1bb84e){_0x259ce8['push'](_0x259ce8['shift']());}};_0x5ef5c2(++_0x798276);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xcf807,_0x4c736b){var _0x2ef9e9=function(_0x33ed42){while(--_0x33ed42){_0xcf807['push'](_0xcf807['shift']());}};_0x2ef9e9(++_0x4c736b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b9761d6..c781183 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 _0x060a=['INTEGER','sequelize','exports'];(function(_0x2bb9f9,_0x41b9f0){var _0x231156=function(_0x2d167f){while(--_0x2d167f){_0x2bb9f9['push'](_0x2bb9f9['shift']());}};_0x231156(++_0x41b9f0);}(_0x060a,0xd3));var _0xa060=function(_0x57b179,_0x4d1cb0){_0x57b179=_0x57b179-0x0;var _0x337be1=_0x060a[_0x57b179];return _0x337be1;};'use strict';var Sequelize=require(_0xa060('0x0'));module[_0xa060('0x1')]={'penalty':{'type':Sequelize[_0xa060('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf4f3=['sequelize','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf4f3,0x94));var _0x3f4f=function(_0x23c48b,_0x272d02){_0x23c48b=_0x23c48b-0x0;var _0x9683ed=_0xf4f3[_0x23c48b];return _0x9683ed;};'use strict';var Sequelize=require(_0x3f4f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3f4f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 5b0fab2..3328218 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 _0x07d9=['bluebird','../../config/environment','exports','define','UserChatQueue','lodash','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x07d9,0xed));var _0x907d=function(_0x145841,_0x25faa6){_0x145841=_0x145841-0x0;var _0x13a71c=_0x07d9[_0x145841];return _0x13a71c;};'use strict';var _=require(_0x907d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x907d('0x1'));var moment=require(_0x907d('0x2'));var BPromise=require(_0x907d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x907d('0x4'));var attributes=require('./userChatQueue.attributes');module[_0x907d('0x5')]=function(_0xf6534c,_0x3d3127){return _0xf6534c[_0x907d('0x6')](_0x907d('0x7'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4009=['bluebird','request-promise','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment'];(function(_0x4d6f55,_0x5d434d){var _0x414ef8=function(_0x487110){while(--_0x487110){_0x4d6f55['push'](_0x4d6f55['shift']());}};_0x414ef8(++_0x5d434d);}(_0x4009,0x80));var _0x9400=function(_0x285a0c,_0x3a46df){_0x285a0c=_0x285a0c-0x0;var _0x5df6a8=_0x4009[_0x285a0c];return _0x5df6a8;};'use strict';var _=require(_0x9400('0x0'));var util=require(_0x9400('0x1'));var logger=require('../../config/logger')(_0x9400('0x2'));var moment=require(_0x9400('0x3'));var BPromise=require(_0x9400('0x4'));var rp=require(_0x9400('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9400('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x9400('0x7')]=function(_0x30c99d,_0x5035f9){return _0x30c99d[_0x9400('0x8')](_0x9400('0x9'),attributes,{'tableName':_0x9400('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 059975d..fa9fe7f 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 _0xecec=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xecec,0x19b));var _0xcece=function(_0x47099e,_0x518d61){_0x47099e=_0x47099e-0x0;var _0x3109be=_0xecec[_0x47099e];return _0x3109be;};'use strict';var _=require(_0xcece('0x0'));var util=require('util');var moment=require(_0xcece('0x1'));var BPromise=require(_0xcece('0x2'));var rs=require(_0xcece('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcece('0x4'))['db'];var utils=require(_0xcece('0x5'));var logger=require(_0xcece('0x6'))(_0xcece('0x7'));var config=require(_0xcece('0x8'));var jayson=require(_0xcece('0x9'));var client=jayson['client'][_0xcece('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12a322,_0x1e9b49,_0xb10522){return new BPromise(function(_0x5bdafe,_0x4191eb){return client['request'](_0x12a322,_0xb10522)[_0xcece('0xb')](function(_0x522f03){logger[_0xcece('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x1e9b49,'request\x20sent');logger[_0xcece('0xd')](_0xcece('0xe'),_0x1e9b49,_0xcece('0xf'),JSON[_0xcece('0x10')](_0x522f03));if(_0x522f03[_0xcece('0x11')]){if(_0x522f03[_0xcece('0x11')][_0xcece('0x12')]===0x1f4){logger['error'](_0xcece('0x13'),_0x1e9b49,_0x522f03['error'][_0xcece('0x14')]);return _0x4191eb(_0x522f03[_0xcece('0x11')][_0xcece('0x14')]);}logger['error'](_0xcece('0x13'),_0x1e9b49,_0x522f03[_0xcece('0x11')]['message']);return _0x5bdafe(_0x522f03[_0xcece('0x11')][_0xcece('0x14')]);}else{logger[_0xcece('0xc')](_0xcece('0x13'),_0x1e9b49,_0xcece('0xf'));_0x5bdafe(_0x522f03[_0xcece('0x15')][_0xcece('0x14')]);}})[_0xcece('0x16')](function(_0x1d4a0d){logger[_0xcece('0x11')](_0xcece('0x13'),_0x1e9b49,_0x1d4a0d);_0x4191eb(_0x1d4a0d);});});} \ No newline at end of file +var _0x3f1f=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x498648,_0x42a80e){var _0x98a425=function(_0x6f8e1d){while(--_0x6f8e1d){_0x498648['push'](_0x498648['shift']());}};_0x98a425(++_0x42a80e);}(_0x3f1f,0x1e7));var _0xf3f1=function(_0x173428,_0x255471){_0x173428=_0x173428-0x0;var _0x1f6b29=_0x3f1f[_0x173428];return _0x1f6b29;};'use strict';var _=require(_0xf3f1('0x0'));var util=require(_0xf3f1('0x1'));var moment=require(_0xf3f1('0x2'));var BPromise=require(_0xf3f1('0x3'));var rs=require(_0xf3f1('0x4'));var fs=require('fs');var Redis=require(_0xf3f1('0x5'));var db=require(_0xf3f1('0x6'))['db'];var utils=require(_0xf3f1('0x7'));var logger=require('../../config/logger')(_0xf3f1('0x8'));var config=require(_0xf3f1('0x9'));var jayson=require(_0xf3f1('0xa'));var client=jayson[_0xf3f1('0xb')][_0xf3f1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x594f43,_0x119dda,_0x2f92a9){return new BPromise(function(_0x59b0f5,_0x3e1ba9){return client[_0xf3f1('0xd')](_0x594f43,_0x2f92a9)[_0xf3f1('0xe')](function(_0xb8f311){logger[_0xf3f1('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x119dda,_0xf3f1('0x10'));logger[_0xf3f1('0x11')](_0xf3f1('0x12'),_0x119dda,_0xf3f1('0x10'),JSON['stringify'](_0xb8f311));if(_0xb8f311['error']){if(_0xb8f311['error']['code']===0x1f4){logger['error'](_0xf3f1('0x13'),_0x119dda,_0xb8f311[_0xf3f1('0x14')][_0xf3f1('0x15')]);return _0x3e1ba9(_0xb8f311[_0xf3f1('0x14')][_0xf3f1('0x15')]);}logger[_0xf3f1('0x14')](_0xf3f1('0x13'),_0x119dda,_0xb8f311['error'][_0xf3f1('0x15')]);return _0x59b0f5(_0xb8f311['error'][_0xf3f1('0x15')]);}else{logger[_0xf3f1('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x119dda,'request\x20sent');_0x59b0f5(_0xb8f311[_0xf3f1('0x16')][_0xf3f1('0x15')]);}})[_0xf3f1('0x17')](function(_0x1996ea){logger[_0xf3f1('0x14')](_0xf3f1('0x13'),_0x119dda,_0x1996ea);_0x3e1ba9(_0x1996ea);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 220e05d..0bab53f 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x395c88,_0x23562b){var _0x265fcc=function(_0x57b6f2){while(--_0x57b6f2){_0x395c88['push'](_0x395c88['shift']());}};_0x265fcc(++_0x23562b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xcb91[_0x48ec91];return _0x22766c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x687125,_0x5d83e3){var _0xb74695=function(_0x935306){while(--_0x935306){_0x687125['push'](_0x687125['shift']());}};_0xb74695(++_0x5d83e3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xcb91[_0x5e4563];return _0x8d1bf5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index cb15313..ae3389e 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 _0xbc07=['exports','INTEGER','STRING','sequelize'];(function(_0x2b5b5d,_0x1a84f4){var _0x17aab7=function(_0xc33556){while(--_0xc33556){_0x2b5b5d['push'](_0x2b5b5d['shift']());}};_0x17aab7(++_0x1a84f4);}(_0xbc07,0x103));var _0x7bc0=function(_0x147707,_0x2b43fb){_0x147707=_0x147707-0x0;var _0x1d35b0=_0xbc07[_0x147707];return _0x1d35b0;};'use strict';var Sequelize=require(_0x7bc0('0x0'));module[_0x7bc0('0x1')]={'penalty':{'type':Sequelize[_0x7bc0('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7bc0('0x3')]}}; \ No newline at end of file +var _0x7d2b=['STRING','INTEGER'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7d2b,0xcf));var _0xb7d2=function(_0x1c621c,_0x1c6fde){_0x1c621c=_0x1c621c-0x0;var _0x8361ec=_0x7d2b[_0x1c621c];return _0x8361ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xb7d2('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb7d2('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index bc88d62..d1f2fb7 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 _0x62c6=['rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4f9617,_0x16a10a){var _0x55b7d0=function(_0x43824a){while(--_0x43824a){_0x4f9617['push'](_0x4f9617['shift']());}};_0x55b7d0(++_0x16a10a);}(_0x62c6,0x103));var _0x662c=function(_0x44528a,_0x5b8cc7){_0x44528a=_0x44528a-0x0;var _0x5d296c=_0x62c6[_0x44528a];return _0x5d296c;};'use strict';var _=require(_0x662c('0x0'));var util=require('util');var logger=require(_0x662c('0x1'))(_0x662c('0x2'));var moment=require(_0x662c('0x3'));var BPromise=require('bluebird');var rp=require(_0x662c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x662c('0x5'));var config=require(_0x662c('0x6'));var attributes=require(_0x662c('0x7'));module['exports']=function(_0x12521a,_0x26f225){return _0x12521a[_0x662c('0x8')](_0x662c('0x9'),attributes,{'tableName':_0x662c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a96=['moment','bluebird','path','./userFaxQueue.attributes','exports','UserFaxQueue','lodash','util','api'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x8a96,0x11d));var _0x68a9=function(_0x46bd7e,_0x55f146){_0x46bd7e=_0x46bd7e-0x0;var _0x2b8e37=_0x8a96[_0x46bd7e];return _0x2b8e37;};'use strict';var _=require(_0x68a9('0x0'));var util=require(_0x68a9('0x1'));var logger=require('../../config/logger')(_0x68a9('0x2'));var moment=require(_0x68a9('0x3'));var BPromise=require(_0x68a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x68a9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x68a9('0x6'));module[_0x68a9('0x7')]=function(_0xadc925,_0x11dbed){return _0xadc925['define'](_0x68a9('0x8'),attributes,{'tableName':'user_has_fax_queues','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 ad91e54..4e381b3 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 _0x9a4b=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x401494,_0x5967c9){var _0x5a2581=function(_0x5b6dca){while(--_0x5b6dca){_0x401494['push'](_0x401494['shift']());}};_0x5a2581(++_0x5967c9);}(_0x9a4b,0x9c));var _0xb9a4=function(_0x5942d9,_0x569c84){_0x5942d9=_0x5942d9-0x0;var _0x4aa2b0=_0x9a4b[_0x5942d9];return _0x4aa2b0;};'use strict';var _=require(_0xb9a4('0x0'));var util=require(_0xb9a4('0x1'));var moment=require(_0xb9a4('0x2'));var BPromise=require(_0xb9a4('0x3'));var rs=require(_0xb9a4('0x4'));var fs=require('fs');var Redis=require(_0xb9a4('0x5'));var db=require(_0xb9a4('0x6'))['db'];var utils=require(_0xb9a4('0x7'));var logger=require('../../config/logger')(_0xb9a4('0x8'));var config=require('../../config/environment');var jayson=require(_0xb9a4('0x9'));var client=jayson[_0xb9a4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x61228f,_0x350d70,_0x7a0398){return new BPromise(function(_0x28a095,_0x377df3){return client['request'](_0x61228f,_0x7a0398)[_0xb9a4('0xb')](function(_0xedf532){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x350d70,_0xb9a4('0xc'));logger[_0xb9a4('0xd')](_0xb9a4('0xe'),_0x350d70,'request\x20sent',JSON[_0xb9a4('0xf')](_0xedf532));if(_0xedf532['error']){if(_0xedf532[_0xb9a4('0x10')][_0xb9a4('0x11')]===0x1f4){logger[_0xb9a4('0x10')](_0xb9a4('0x12'),_0x350d70,_0xedf532[_0xb9a4('0x10')][_0xb9a4('0x13')]);return _0x377df3(_0xedf532[_0xb9a4('0x10')]['message']);}logger[_0xb9a4('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x350d70,_0xedf532['error'][_0xb9a4('0x13')]);return _0x28a095(_0xedf532[_0xb9a4('0x10')]['message']);}else{logger[_0xb9a4('0x14')](_0xb9a4('0x12'),_0x350d70,_0xb9a4('0xc'));_0x28a095(_0xedf532[_0xb9a4('0x15')][_0xb9a4('0x13')]);}})[_0xb9a4('0x16')](function(_0x19287a){logger[_0xb9a4('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x350d70,_0x19287a);_0x377df3(_0x19287a);});});} \ No newline at end of file +var _0xfc84=['then','info','request\x20sent','debug','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0xfc84,0x7c));var _0x4fc8=function(_0x58b369,_0x3c3e1e){_0x58b369=_0x58b369-0x0;var _0x1e3a43=_0xfc84[_0x58b369];return _0x1e3a43;};'use strict';var _=require(_0x4fc8('0x0'));var util=require(_0x4fc8('0x1'));var moment=require(_0x4fc8('0x2'));var BPromise=require(_0x4fc8('0x3'));var rs=require(_0x4fc8('0x4'));var fs=require('fs');var Redis=require(_0x4fc8('0x5'));var db=require(_0x4fc8('0x6'))['db'];var utils=require(_0x4fc8('0x7'));var logger=require(_0x4fc8('0x8'))(_0x4fc8('0x9'));var config=require(_0x4fc8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4fc8('0xb')][_0x4fc8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2831e2,_0xee2abb,_0xf0fe07){return new BPromise(function(_0x1d7e93,_0x1dc236){return client[_0x4fc8('0xd')](_0x2831e2,_0xf0fe07)[_0x4fc8('0xe')](function(_0x3dc60c){logger[_0x4fc8('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0xee2abb,_0x4fc8('0x10'));logger[_0x4fc8('0x11')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0xee2abb,_0x4fc8('0x10'),JSON[_0x4fc8('0x12')](_0x3dc60c));if(_0x3dc60c['error']){if(_0x3dc60c['error']['code']===0x1f4){logger[_0x4fc8('0x13')](_0x4fc8('0x14'),_0xee2abb,_0x3dc60c['error'][_0x4fc8('0x15')]);return _0x1dc236(_0x3dc60c[_0x4fc8('0x13')][_0x4fc8('0x15')]);}logger[_0x4fc8('0x13')](_0x4fc8('0x14'),_0xee2abb,_0x3dc60c[_0x4fc8('0x13')][_0x4fc8('0x15')]);return _0x1d7e93(_0x3dc60c[_0x4fc8('0x13')][_0x4fc8('0x15')]);}else{logger[_0x4fc8('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0xee2abb,'request\x20sent');_0x1d7e93(_0x3dc60c[_0x4fc8('0x16')]['message']);}})['catch'](function(_0x373fb6){logger[_0x4fc8('0x13')](_0x4fc8('0x14'),_0xee2abb,_0x373fb6);_0x1dc236(_0x373fb6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5130b13..bf0ce61 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(_0x53d7ac,_0x224c30){var _0x292e51=function(_0x9105b6){while(--_0x9105b6){_0x53d7ac['push'](_0x53d7ac['shift']());}};_0x292e51(++_0x224c30);}(_0xe706,0xa3));var _0x6e70=function(_0x84a189,_0x323ae4){_0x84a189=_0x84a189-0x0;var _0x476af8=_0xe706[_0x84a189];return _0x476af8;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x165ae5,_0x4baa55){var _0x3fca11=function(_0x2997bb){while(--_0x2997bb){_0x165ae5['push'](_0x165ae5['shift']());}};_0x3fca11(++_0x4baa55);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xcb91[_0x53abe5];return _0xc1c37e;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 81316b9..c3f42c8 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 _0x4f6e=['INTEGER','sequelize'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x4f6e,0x1e5));var _0xe4f6=function(_0x4d91c5,_0x3eb4cd){_0x4d91c5=_0x4d91c5-0x0;var _0x12020e=_0x4f6e[_0x4d91c5];return _0x12020e;};'use strict';var Sequelize=require(_0xe4f6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe4f6('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46f2=['exports','INTEGER'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x46f2,0x1ba));var _0x246f=function(_0x208452,_0x209cbc){_0x208452=_0x208452-0x0;var _0x1905cf=_0x46f2[_0x208452];return _0x1905cf;};'use strict';var Sequelize=require('sequelize');module[_0x246f('0x0')]={'penalty':{'type':Sequelize[_0x246f('0x1')],'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 6c1efda..613ce00 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 _0x66a5=['./userMailQueue.attributes','define','UserMailQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3d449c,_0x23f73d){var _0xb32a58=function(_0x32f87f){while(--_0x32f87f){_0x3d449c['push'](_0x3d449c['shift']());}};_0xb32a58(++_0x23f73d);}(_0x66a5,0x71));var _0x566a=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0x66a5[_0xb65ffb];return _0x58f55c;};'use strict';var _=require(_0x566a('0x0'));var util=require(_0x566a('0x1'));var logger=require(_0x566a('0x2'))('api');var moment=require(_0x566a('0x3'));var BPromise=require(_0x566a('0x4'));var rp=require(_0x566a('0x5'));var fs=require('fs');var path=require(_0x566a('0x6'));var rimraf=require(_0x566a('0x7'));var config=require('../../config/environment');var attributes=require(_0x566a('0x8'));module['exports']=function(_0x1de9bb,_0x1e63a2){return _0x1de9bb[_0x566a('0x9')](_0x566a('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9962=['path','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','lodash','util','moment','request-promise'];(function(_0x2434c3,_0x4e7e8f){var _0x2dc348=function(_0x36e641){while(--_0x36e641){_0x2434c3['push'](_0x2434c3['shift']());}};_0x2dc348(++_0x4e7e8f);}(_0x9962,0x17f));var _0x2996=function(_0x2a5990,_0x4fb264){_0x2a5990=_0x2a5990-0x0;var _0x1b2102=_0x9962[_0x2a5990];return _0x1b2102;};'use strict';var _=require(_0x2996('0x0'));var util=require(_0x2996('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2996('0x2'));var BPromise=require('bluebird');var rp=require(_0x2996('0x3'));var fs=require('fs');var path=require(_0x2996('0x4'));var rimraf=require('rimraf');var config=require(_0x2996('0x5'));var attributes=require(_0x2996('0x6'));module['exports']=function(_0x187f63,_0x300815){return _0x187f63[_0x2996('0x7')](_0x2996('0x8'),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 43fe9c1..05a8a13 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0xd6d59e,_0x27d2a3){var _0x8d112e=function(_0x5a524a){while(--_0x5a524a){_0xd6d59e['push'](_0xd6d59e['shift']());}};_0x8d112e(++_0x27d2a3);}(_0x3e74,0x175));var _0x43e7=function(_0x194c4e,_0x21a5a5){_0x194c4e=_0x194c4e-0x0;var _0x5fd73e=_0x3e74[_0x194c4e];return _0x5fd73e;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ 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(_0x88db83,_0x4441a1){var _0x4233ca=function(_0x25ee11){while(--_0x25ee11){_0x88db83['push'](_0x88db83['shift']());}};_0x4233ca(++_0x4441a1);}(_0x4b84,0x1cc));var _0x44b8=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x4b84[_0xa2b098];return _0x29502e;};'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 d3414c6..8ff49ad 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 _0xf4f1=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','multer','util','connect-timeout'];(function(_0x359054,_0x440d6b){var _0x10793e=function(_0x1cc3bc){while(--_0x1cc3bc){_0x359054['push'](_0x359054['shift']());}};_0x10793e(++_0x440d6b);}(_0xf4f1,0x194));var _0x1f4f=function(_0x58ba77,_0x1a46e3){_0x58ba77=_0x58ba77-0x0;var _0x158827=_0xf4f1[_0x58ba77];return _0x158827;};'use strict';var multer=require(_0x1f4f('0x0'));var util=require(_0x1f4f('0x1'));var path=require('path');var timeout=require(_0x1f4f('0x2'));var express=require(_0x1f4f('0x3'));var router=express[_0x1f4f('0x4')]();var fs_extra=require(_0x1f4f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f4f('0x6'));var config=require(_0x1f4f('0x7'));var controller=require(_0x1f4f('0x8'));router[_0x1f4f('0x9')]('/',auth[_0x1f4f('0xa')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0xe569=['./userNotification.controller','sendUserNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x9c8599,_0x53a9b9){var _0x1fafd0=function(_0x2989fb){while(--_0x2989fb){_0x9c8599['push'](_0x9c8599['shift']());}};_0x1fafd0(++_0x53a9b9);}(_0xe569,0x158));var _0x9e56=function(_0x42a44a,_0x15ca12){_0x42a44a=_0x42a44a-0x0;var _0x1e6ab6=_0xe569[_0x42a44a];return _0x1e6ab6;};'use strict';var multer=require(_0x9e56('0x0'));var util=require(_0x9e56('0x1'));var path=require(_0x9e56('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e56('0x3'));var router=express[_0x9e56('0x4')]();var fs_extra=require(_0x9e56('0x5'));var auth=require(_0x9e56('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e56('0x7'));var controller=require(_0x9e56('0x8'));router['post']('/',auth['isAuthenticated'](),controller[_0x9e56('0x9')]);module[_0x9e56('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f7a9363..12edb08 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 _0x56cd=['BOOLEAN','exports','STRING','TEXT'];(function(_0x100d69,_0x178130){var _0x480fc5=function(_0x57a16c){while(--_0x57a16c){_0x100d69['push'](_0x100d69['shift']());}};_0x480fc5(++_0x178130);}(_0x56cd,0x109));var _0xd56c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x56cd[_0x32d457];return _0x338386;};'use strict';var Sequelize=require('sequelize');module[_0xd56c('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xd56c('0x1')]},'recipientsId':{'type':Sequelize[_0xd56c('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd56c('0x1')]},'beep':{'type':Sequelize[_0xd56c('0x3')]}}; \ No newline at end of file +var _0x86a4=['exports','TEXT'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0x86a4,0x1b2));var _0x486a=function(_0x17c897,_0x184db9){_0x17c897=_0x17c897-0x0;var _0x5b20a4=_0x86a4[_0x17c897];return _0x5b20a4;};'use strict';var Sequelize=require('sequelize');module[_0x486a('0x0')]={'body':{'type':Sequelize[_0x486a('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x486a('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 40fd299..8e81e2c 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 _0x05cd=['body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Sequelize','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','create','forEach','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','toLowerCase','User','union','ids','replace','queue','Queue','push','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x05cd,0x1d5));var _0xd05c=function(_0xa029a,_0x2771d5){_0xa029a=_0xa029a-0x0;var _0x495458=_0x05cd[_0xa029a];return _0x495458;};'use strict';var emlformat=require(_0xd05c('0x0'));var rimraf=require(_0xd05c('0x1'));var zipdir=require(_0xd05c('0x2'));var jsonpatch=require(_0xd05c('0x3'));var rp=require(_0xd05c('0x4'));var moment=require(_0xd05c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd05c('0x6'));var path=require(_0xd05c('0x7'));var sox=require(_0xd05c('0x8'));var csv=require(_0xd05c('0x9'));var ejs=require(_0xd05c('0xa'));var fs=require('fs');var fs_extra=require(_0xd05c('0xb'));var _=require('lodash');var squel=require(_0xd05c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd05c('0xd'));var deskjs=require(_0xd05c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd05c('0xf'));var Papa=require(_0xd05c('0x10'));var Redis=require(_0xd05c('0x11'));var authService=require(_0xd05c('0x12'));var qs=require(_0xd05c('0x13'));var as=require(_0xd05c('0x14'));var hardwareService=require(_0xd05c('0x15'));var logger=require('../../config/logger')(_0xd05c('0x16'));var utils=require(_0xd05c('0x17'));var config=require(_0xd05c('0x18'));var licenseUtil=require(_0xd05c('0x19'));var db=require(_0xd05c('0x1a'))['db'];config[_0xd05c('0x1b')]=_[_0xd05c('0x1c')](config[_0xd05c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd05c('0x1d'))(new Redis(config[_0xd05c('0x1b')]));require(_0xd05c('0x1e'))[_0xd05c('0x1f')](socket);function respondWithStatusCode(_0x200b15,_0x17526b){_0x17526b=_0x17526b||0xcc;return function(_0x5ef217){if(_0x5ef217){return _0x200b15[_0xd05c('0x20')](_0x17526b);}return _0x200b15[_0xd05c('0x21')](_0x17526b)[_0xd05c('0x22')]();};}function respondWithResult(_0x3f2a03,_0x96d3a3){_0x96d3a3=_0x96d3a3||0xc8;return function(_0x281204){if(_0x281204){return _0x3f2a03['status'](_0x96d3a3)[_0xd05c('0x23')](_0x281204);}};}function respondWithFilteredResult(_0x274198,_0x3962a8){return function(_0x1ebb66){if(_0x1ebb66){var _0x4eaf49=typeof _0x3962a8[_0xd05c('0x24')]===_0xd05c('0x25')&&typeof _0x3962a8[_0xd05c('0x26')]===_0xd05c('0x25');var _0x316dbe=_0x1ebb66[_0xd05c('0x27')];var _0x7e6908=_0x4eaf49?0x0:_0x3962a8['offset'];var _0x49ab92=_0x4eaf49?_0x1ebb66['count']:_0x3962a8[_0xd05c('0x24')]+_0x3962a8['limit'];var _0x2fdf68;if(_0x49ab92>=_0x316dbe){_0x49ab92=_0x316dbe;_0x2fdf68=0xc8;}else{_0x2fdf68=0xce;}_0x274198[_0xd05c('0x21')](_0x2fdf68);return _0x274198['set']('Content-Range',_0x7e6908+'-'+_0x49ab92+'/'+_0x316dbe)[_0xd05c('0x23')](_0x1ebb66);}return null;};}function patchUpdates(_0x7bddcf){return function(_0x37dc6f){try{jsonpatch[_0xd05c('0x28')](_0x37dc6f,_0x7bddcf,!![]);}catch(_0x5a3f0f){return BPromise[_0xd05c('0x29')](_0x5a3f0f);}return _0x37dc6f[_0xd05c('0x2a')]();};}function saveUpdates(_0x300680,_0x1b007d){return function(_0x1eb14){if(_0x1eb14){return _0x1eb14[_0xd05c('0x2b')](_0x300680)[_0xd05c('0x2c')](function(_0x481600){return _0x481600;});}return null;};}function removeEntity(_0x79a974,_0x2bb908){return function(_0x706860){if(_0x706860){return _0x706860[_0xd05c('0x2d')]()['then'](function(){_0x79a974[_0xd05c('0x21')](0xcc)[_0xd05c('0x22')]();});}};}function handleEntityNotFound(_0x11cf1b,_0x54b119){return function(_0x23d7c1){if(!_0x23d7c1){_0x11cf1b[_0xd05c('0x20')](0x194);}return _0x23d7c1;};}function handleError(_0x229da8,_0x441990){_0x441990=_0x441990||0x1f4;return function(_0x1fa91e){logger[_0xd05c('0x2e')](_0x1fa91e[_0xd05c('0x2f')]);if(_0x1fa91e[_0xd05c('0x30')]){delete _0x1fa91e[_0xd05c('0x30')];}_0x229da8['status'](_0x441990)[_0xd05c('0x31')](_0x1fa91e);};}exports[_0xd05c('0x32')]=function(_0x2b1963,_0x5a5725,_0x3fa3a){if(!_0x2b1963[_0xd05c('0x33')]['hasOwnProperty'](_0xd05c('0x34'))&&!_0x2b1963[_0xd05c('0x33')][_0xd05c('0x35')](_0xd05c('0x36'))){throw new db['Sequelize'][(_0xd05c('0x37'))](_0xd05c('0x38'));}else{if(_0x2b1963[_0xd05c('0x33')]['hasOwnProperty'](_0xd05c('0x36'))&&!_0x2b1963['body'][_0xd05c('0x35')]('view')){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x2b1963[_0xd05c('0x33')]['hasOwnProperty'](_0xd05c('0x39'))){throw new db['Sequelize'][(_0xd05c('0x37'))](_0xd05c('0x3a'));}else{try{var _0xddc69c=JSON[_0xd05c('0x3b')](_0x2b1963[_0xd05c('0x33')]['recipients']);}catch(_0x21ea09){logger[_0xd05c('0x2e')](_0x21ea09);throw new db[(_0xd05c('0x3c'))][(_0xd05c('0x37'))](_0xd05c('0x3d'));}var _0x4d5f90=[_0xd05c('0x3e'),_0xd05c('0x3f'),_0xd05c('0x40'),_0xd05c('0x41'),_0xd05c('0x42'),_0xd05c('0x43'),_0xd05c('0x44'),_0xd05c('0x45'),_0xd05c('0x46')];if(_[_0xd05c('0x47')](_0xddc69c,function(_0x57255a){return!_[_0xd05c('0x48')](_0x4d5f90,_0x57255a[_0xd05c('0x49')]['toLowerCase']());})){throw new db[(_0xd05c('0x3c'))][(_0xd05c('0x37'))](_0xd05c('0x4a'));}}}var _0x4255ce={};_0x4255ce[_0xd05c('0x4b')]=_0x2b1963['body'][_0xd05c('0x35')](_0xd05c('0x4b'))?_0x2b1963[_0xd05c('0x33')][_0xd05c('0x4b')]:_0x2b1963[_0xd05c('0x46')][_0xd05c('0x4c')];_0x4255ce[_0xd05c('0x4d')]=_[_0xd05c('0x4e')](_0x2b1963['body'][_0xd05c('0x4d')])?null:_0x2b1963[_0xd05c('0x33')]['recipientsDescription'];_0x4255ce[_0xd05c('0x4f')]=_0x2b1963[_0xd05c('0x33')][_0xd05c('0x4f')]||![];_0x4255ce[_0xd05c('0x50')]=_0x2b1963[_0xd05c('0x46')]['id'];return getContent(_0x2b1963[_0xd05c('0x33')])[_0xd05c('0x2c')](function(_0x5bb5dc){_0x4255ce[_0xd05c('0x33')]=_0x5bb5dc;return getRecipients(_0xddc69c);})[_0xd05c('0x2c')](function(_0x558ba7){_0x4255ce[_0xd05c('0x51')]=_[_0xd05c('0x52')](_0x558ba7)[_0xd05c('0x53')](',');return db['sequelize']['transaction'](function(_0x28f0e0){return db['UserNotification'][_0xd05c('0x54')](_0x4255ce,{'raw':!![],'transaction':_0x28f0e0})[_0xd05c('0x2c')](function(_0x5b0806){var _0x5ac5e3={'sender':_0x4255ce[_0xd05c('0x4b')],'description':_0x4255ce[_0xd05c('0x4d')],'content':_0x4255ce['body'],'beep':_0x4255ce[_0xd05c('0x4f')]};_0x558ba7[_0xd05c('0x55')](function(_0x170a3d){_0x5ac5e3[_0xd05c('0x56')]=_0x170a3d;socket['emit'](_0xd05c('0x57'),_0x5ac5e3);});return _0x5b0806;});});})[_0xd05c('0x2c')](respondWithResult(_0x5a5725,0xc9))[_0xd05c('0x58')](handleError(_0x5a5725,null));};function getContent(_0x55bf51){return new BPromise(function(_0x30be20,_0x4d385d){if(_0x55bf51[_0xd05c('0x34')]){_0x30be20(_0x55bf51['text']);return;}return db[_0xd05c('0x59')][_0xd05c('0x5a')]({'attributes':[_0xd05c('0x5b')],'where':{'id':_0x55bf51[_0xd05c('0x36')]},'raw':!![]})['then'](function(_0x21bb71){if(!_0x21bb71)throw new db[(_0xd05c('0x3c'))]['ValidationError'](_0xd05c('0x5c'));var _0x5dc4e7=Mustache[_0xd05c('0x5d')](_0x21bb71[_0xd05c('0x5b')],_0x55bf51['view']);_0x30be20(_0x5dc4e7);})[_0xd05c('0x58')](function(_0x2c1eba){_0x4d385d(_0x2c1eba);});});}function getRecipients(_0x11f313){return new BPromise(function(_0x46fe29,_0x39c870){var _0x4c8b45=[];var _0x35975e=[];_0x11f313[_0xd05c('0x55')](function(_0x1edd9d){var _0x21900d=_['startCase'](_0x1edd9d['model'][_0xd05c('0x5e')]());if(_0x21900d===_0xd05c('0x5f')){_0x4c8b45=_[_0xd05c('0x60')](_0x4c8b45,_0x1edd9d[_0xd05c('0x61')]);}else{if(_[_0xd05c('0x48')](_0x21900d,'queue'))_0x21900d=_0x21900d[_0xd05c('0x62')](_0xd05c('0x63'),_0xd05c('0x64'));_0x1edd9d[_0xd05c('0x61')]['forEach'](function(_0x2572e3){_0x35975e[_0xd05c('0x65')](getAgents(_0x21900d,_0x2572e3));});}});return BPromise['all'](_0x35975e)['then'](function(_0x30326d){_0x4c8b45=_[_0xd05c('0x60')](_0x4c8b45,_['flatten'](_0x30326d));_0x46fe29(_0x4c8b45);})[_0xd05c('0x58')](function(_0x86dc73){_0x39c870(_0x86dc73);});});}function getAgents(_0x1dda05,_0x507084){return new BPromise(function(_0x7a65a9,_0x1a52a6){return db[_0x1dda05][_0xd05c('0x5a')]({'where':{'id':_0x507084}})[_0xd05c('0x2c')](function(_0x7cc34a){return _0x7cc34a[_0xd05c('0x66')]({'attributes':['id'],'raw':!![]})[_0xd05c('0x2c')](function(_0x47d1fb){var _0x119962=_[_0xd05c('0x67')](_0x47d1fb,'id');_0x7a65a9(_0x119962);});})['catch'](function(_0x5135b6){_0x1a52a6(_0x5135b6);});});} \ No newline at end of file +var _0x3f8b=['emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','toLowerCase','User','union','ids','queue','replace','Queue','forEach','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','./userNotification.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','hasOwnProperty','text','body','TemplateId','Sequelize','view','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient'];(function(_0x479bbb,_0x3011d3){var _0x221754=function(_0x3b53e5){while(--_0x3b53e5){_0x479bbb['push'](_0x479bbb['shift']());}};_0x221754(++_0x3011d3);}(_0x3f8b,0xe5));var _0xb3f8=function(_0x710418,_0x123ee2){_0x710418=_0x710418-0x0;var _0x15d8ef=_0x3f8b[_0x710418];return _0x15d8ef;};'use strict';var emlformat=require(_0xb3f8('0x0'));var rimraf=require(_0xb3f8('0x1'));var zipdir=require(_0xb3f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb3f8('0x3'));var Mustache=require(_0xb3f8('0x4'));var util=require(_0xb3f8('0x5'));var path=require(_0xb3f8('0x6'));var sox=require('sox');var csv=require(_0xb3f8('0x7'));var ejs=require(_0xb3f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3f8('0x9'));var squel=require(_0xb3f8('0xa'));var crypto=require('crypto');var jsforce=require(_0xb3f8('0xb'));var deskjs=require(_0xb3f8('0xc'));var toCsv=require(_0xb3f8('0x7'));var querystring=require(_0xb3f8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3f8('0xe'));var qs=require(_0xb3f8('0xf'));var as=require(_0xb3f8('0x10'));var hardwareService=require(_0xb3f8('0x11'));var logger=require(_0xb3f8('0x12'))('api');var utils=require(_0xb3f8('0x13'));var config=require(_0xb3f8('0x14'));var licenseUtil=require(_0xb3f8('0x15'));var db=require(_0xb3f8('0x16'))['db'];config['redis']=_[_0xb3f8('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb3f8('0x18'))[_0xb3f8('0x19')](socket);function respondWithStatusCode(_0xa2076a,_0x5ca105){_0x5ca105=_0x5ca105||0xcc;return function(_0x1df4d3){if(_0x1df4d3){return _0xa2076a[_0xb3f8('0x1a')](_0x5ca105);}return _0xa2076a['status'](_0x5ca105)[_0xb3f8('0x1b')]();};}function respondWithResult(_0x3b5c93,_0x32289d){_0x32289d=_0x32289d||0xc8;return function(_0xeeda9){if(_0xeeda9){return _0x3b5c93[_0xb3f8('0x1c')](_0x32289d)[_0xb3f8('0x1d')](_0xeeda9);}};}function respondWithFilteredResult(_0x62836e,_0x1c996e){return function(_0x560743){if(_0x560743){var _0x2b4e7d=typeof _0x1c996e[_0xb3f8('0x1e')]===_0xb3f8('0x1f')&&typeof _0x1c996e[_0xb3f8('0x20')]===_0xb3f8('0x1f');var _0x183045=_0x560743[_0xb3f8('0x21')];var _0xec830=_0x2b4e7d?0x0:_0x1c996e['offset'];var _0x24b904=_0x2b4e7d?_0x560743['count']:_0x1c996e[_0xb3f8('0x1e')]+_0x1c996e['limit'];var _0x6ee3b1;if(_0x24b904>=_0x183045){_0x24b904=_0x183045;_0x6ee3b1=0xc8;}else{_0x6ee3b1=0xce;}_0x62836e[_0xb3f8('0x1c')](_0x6ee3b1);return _0x62836e[_0xb3f8('0x22')](_0xb3f8('0x23'),_0xec830+'-'+_0x24b904+'/'+_0x183045)['json'](_0x560743);}return null;};}function patchUpdates(_0x1b0181){return function(_0xb161b2){try{jsonpatch[_0xb3f8('0x24')](_0xb161b2,_0x1b0181,!![]);}catch(_0x260f0e){return BPromise[_0xb3f8('0x25')](_0x260f0e);}return _0xb161b2['save']();};}function saveUpdates(_0x52fe71,_0x5a4d2c){return function(_0x953267){if(_0x953267){return _0x953267[_0xb3f8('0x26')](_0x52fe71)['then'](function(_0x5c12e0){return _0x5c12e0;});}return null;};}function removeEntity(_0x5778ac,_0x5cbf0b){return function(_0x2cbac3){if(_0x2cbac3){return _0x2cbac3[_0xb3f8('0x27')]()['then'](function(){_0x5778ac[_0xb3f8('0x1c')](0xcc)[_0xb3f8('0x1b')]();});}};}function handleEntityNotFound(_0x3adaff,_0x459cdc){return function(_0x2c7be8){if(!_0x2c7be8){_0x3adaff['sendStatus'](0x194);}return _0x2c7be8;};}function handleError(_0x37c89a,_0x5ab9a8){_0x5ab9a8=_0x5ab9a8||0x1f4;return function(_0x29e62a){logger[_0xb3f8('0x28')](_0x29e62a[_0xb3f8('0x29')]);if(_0x29e62a[_0xb3f8('0x2a')]){delete _0x29e62a[_0xb3f8('0x2a')];}_0x37c89a[_0xb3f8('0x1c')](_0x5ab9a8)[_0xb3f8('0x2b')](_0x29e62a);};}exports['sendUserNotification']=function(_0x54a29f,_0x426a2d,_0x4973af){if(!_0x54a29f['body'][_0xb3f8('0x2c')](_0xb3f8('0x2d'))&&!_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x2c')](_0xb3f8('0x2f'))){throw new db[(_0xb3f8('0x30'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x2c')](_0xb3f8('0x2f'))&&!_0x54a29f['body']['hasOwnProperty'](_0xb3f8('0x31'))){throw new db[(_0xb3f8('0x30'))]['ValidationError'](_0xb3f8('0x32'));}if(!_0x54a29f[_0xb3f8('0x2e')]['hasOwnProperty'](_0xb3f8('0x33'))){throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x35'));}else{try{var _0x5ca69a=JSON[_0xb3f8('0x36')](_0x54a29f[_0xb3f8('0x2e')]['recipients']);}catch(_0x373776){logger[_0xb3f8('0x28')](_0x373776);throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x37'));}var _0x1467e5=[_0xb3f8('0x38'),_0xb3f8('0x39'),_0xb3f8('0x3a'),_0xb3f8('0x3b'),_0xb3f8('0x3c'),'voicequeue',_0xb3f8('0x3d'),_0xb3f8('0x3e'),_0xb3f8('0x3f')];if(_[_0xb3f8('0x40')](_0x5ca69a,function(_0x2739d9){return!_[_0xb3f8('0x41')](_0x1467e5,_0x2739d9[_0xb3f8('0x42')]['toLowerCase']());})){throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x43'));}}}var _0x42ed86={};_0x42ed86['senderName']=_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x2c')](_0xb3f8('0x44'))?_0x54a29f['body'][_0xb3f8('0x44')]:_0x54a29f[_0xb3f8('0x3f')][_0xb3f8('0x45')];_0x42ed86[_0xb3f8('0x46')]=_[_0xb3f8('0x47')](_0x54a29f[_0xb3f8('0x2e')]['recipientsDescription'])?null:_0x54a29f[_0xb3f8('0x2e')]['recipientsDescription'];_0x42ed86[_0xb3f8('0x48')]=_0x54a29f[_0xb3f8('0x2e')][_0xb3f8('0x48')]||![];_0x42ed86[_0xb3f8('0x49')]=_0x54a29f[_0xb3f8('0x3f')]['id'];return getContent(_0x54a29f[_0xb3f8('0x2e')])[_0xb3f8('0x4a')](function(_0x1c0595){_0x42ed86['body']=_0x1c0595;return getRecipients(_0x5ca69a);})[_0xb3f8('0x4a')](function(_0x5a087a){_0x42ed86[_0xb3f8('0x4b')]=_[_0xb3f8('0x4c')](_0x5a087a)[_0xb3f8('0x4d')](',');return db[_0xb3f8('0x4e')][_0xb3f8('0x4f')](function(_0x1af2e3){return db[_0xb3f8('0x50')][_0xb3f8('0x51')](_0x42ed86,{'raw':!![],'transaction':_0x1af2e3})['then'](function(_0x1e510f){var _0x32b878={'sender':_0x42ed86['senderName'],'description':_0x42ed86[_0xb3f8('0x46')],'content':_0x42ed86[_0xb3f8('0x2e')],'beep':_0x42ed86['beep']};_0x5a087a['forEach'](function(_0x35047c){_0x32b878[_0xb3f8('0x52')]=_0x35047c;socket[_0xb3f8('0x53')](_0xb3f8('0x54'),_0x32b878);});return _0x1e510f;});});})[_0xb3f8('0x4a')](respondWithResult(_0x426a2d,0xc9))[_0xb3f8('0x55')](handleError(_0x426a2d,null));};function getContent(_0x3f7bb7){return new BPromise(function(_0x19a87f,_0x585e65){if(_0x3f7bb7[_0xb3f8('0x2d')]){_0x19a87f(_0x3f7bb7[_0xb3f8('0x2d')]);return;}return db[_0xb3f8('0x56')][_0xb3f8('0x57')]({'attributes':['html'],'where':{'id':_0x3f7bb7['TemplateId']},'raw':!![]})[_0xb3f8('0x4a')](function(_0x10d157){if(!_0x10d157)throw new db[(_0xb3f8('0x30'))][(_0xb3f8('0x34'))](_0xb3f8('0x58'));var _0xaceb05=Mustache[_0xb3f8('0x59')](_0x10d157[_0xb3f8('0x5a')],_0x3f7bb7['view']);_0x19a87f(_0xaceb05);})['catch'](function(_0x1439ce){_0x585e65(_0x1439ce);});});}function getRecipients(_0x38f787){return new BPromise(function(_0x5b4ea9,_0x4cc44c){var _0x4d0ebf=[];var _0x251ac0=[];_0x38f787['forEach'](function(_0x4543da){var _0x3897bf=_[_0xb3f8('0x5b')](_0x4543da[_0xb3f8('0x42')][_0xb3f8('0x5c')]());if(_0x3897bf===_0xb3f8('0x5d')){_0x4d0ebf=_[_0xb3f8('0x5e')](_0x4d0ebf,_0x4543da[_0xb3f8('0x5f')]);}else{if(_[_0xb3f8('0x41')](_0x3897bf,_0xb3f8('0x60')))_0x3897bf=_0x3897bf[_0xb3f8('0x61')](_0xb3f8('0x60'),_0xb3f8('0x62'));_0x4543da[_0xb3f8('0x5f')][_0xb3f8('0x63')](function(_0xeb773e){_0x251ac0['push'](getAgents(_0x3897bf,_0xeb773e));});}});return BPromise[_0xb3f8('0x64')](_0x251ac0)[_0xb3f8('0x4a')](function(_0x49b316){_0x4d0ebf=_[_0xb3f8('0x5e')](_0x4d0ebf,_[_0xb3f8('0x65')](_0x49b316));_0x5b4ea9(_0x4d0ebf);})[_0xb3f8('0x55')](function(_0x5bd4fe){_0x4cc44c(_0x5bd4fe);});});}function getAgents(_0x1b936a,_0x2717b3){return new BPromise(function(_0x191ab5,_0xe96be2){return db[_0x1b936a][_0xb3f8('0x57')]({'where':{'id':_0x2717b3}})['then'](function(_0x544af2){return _0x544af2[_0xb3f8('0x66')]({'attributes':['id'],'raw':!![]})[_0xb3f8('0x4a')](function(_0x1edd04){var _0x18c88b=_[_0xb3f8('0x67')](_0x1edd04,'id');_0x191ab5(_0x18c88b);});})['catch'](function(_0xd5095){_0xe96be2(_0xd5095);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index baba87c..a6de48b 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 _0xd5bd=['UserNotification','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x554d58,_0x10ad9c){var _0x5be140=function(_0x36f846){while(--_0x36f846){_0x554d58['push'](_0x554d58['shift']());}};_0x5be140(++_0x10ad9c);}(_0xd5bd,0x125));var _0xdd5b=function(_0x5d5373,_0x10cd97){_0x5d5373=_0x5d5373-0x0;var _0x360a4a=_0xd5bd[_0x5d5373];return _0x360a4a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xdd5b('0x0'))['db'][_0xdd5b('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd5b('0x2'),'afterDestroy':'remove'};function emitEvent(_0x14e566){return function(_0x311a67,_0x38ee6e,_0x3a8dff){UserNotificationEvents[_0xdd5b('0x3')](_0x14e566+':'+_0x311a67['id'],_0x311a67);UserNotificationEvents[_0xdd5b('0x3')](_0x14e566,_0x311a67);_0x3a8dff(null);};}for(var e in events){if(events[_0xdd5b('0x4')](e)){var event=events[e];UserNotification[_0xdd5b('0x5')](e,emitEvent(event));}}module[_0xdd5b('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x9b55=['UserNotification','setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9b55,0x176));var _0x59b5=function(_0x432def,_0x2c638b){_0x432def=_0x432def-0x0;var _0x49684a=_0x9b55[_0x432def];return _0x49684a;};'use strict';var EventEmitter=require(_0x59b5('0x0'));var UserNotification=require(_0x59b5('0x1'))['db'][_0x59b5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x59b5('0x3')](0x0);var events={'afterCreate':_0x59b5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x246db4){return function(_0x532d07,_0x5ab807,_0x1dad97){UserNotificationEvents['emit'](_0x246db4+':'+_0x532d07['id'],_0x532d07);UserNotificationEvents[_0x59b5('0x5')](_0x246db4,_0x532d07);_0x1dad97(null);};}for(var e in events){if(events[_0x59b5('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x59b5('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index eee26bb..deeee4e 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 _0x52dc=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','lodash','util'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x52dc,0x1cc));var _0xc52d=function(_0x1f0693,_0x5e8cc3){_0x1f0693=_0x1f0693-0x0;var _0x2355de=_0x52dc[_0x1f0693];return _0x2355de;};'use strict';var _=require(_0xc52d('0x0'));var util=require(_0xc52d('0x1'));var logger=require(_0xc52d('0x2'))(_0xc52d('0x3'));var moment=require('moment');var BPromise=require(_0xc52d('0x4'));var rp=require(_0xc52d('0x5'));var fs=require('fs');var path=require(_0xc52d('0x6'));var rimraf=require(_0xc52d('0x7'));var config=require(_0xc52d('0x8'));var attributes=require(_0xc52d('0x9'));module[_0xc52d('0xa')]=function(_0x16e318,_0x2462cc){return _0x16e318[_0xc52d('0xb')]('UserNotification',attributes,{'tableName':_0xc52d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc52d('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x02da=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports'];(function(_0x45f1f5,_0x3824ab){var _0x45060b=function(_0x337ab9){while(--_0x337ab9){_0x45f1f5['push'](_0x45f1f5['shift']());}};_0x45060b(++_0x3824ab);}(_0x02da,0x1bd));var _0xa02d=function(_0x243a49,_0x5594b2){_0x243a49=_0x243a49-0x0;var _0x211dd4=_0x02da[_0x243a49];return _0x211dd4;};'use strict';var _=require(_0xa02d('0x0'));var util=require(_0xa02d('0x1'));var logger=require('../../config/logger')(_0xa02d('0x2'));var moment=require(_0xa02d('0x3'));var BPromise=require(_0xa02d('0x4'));var rp=require(_0xa02d('0x5'));var fs=require('fs');var path=require(_0xa02d('0x6'));var rimraf=require('rimraf');var config=require(_0xa02d('0x7'));var attributes=require(_0xa02d('0x8'));module[_0xa02d('0x9')]=function(_0x59ac42,_0x23656e){return _0x59ac42['define']('UserNotification',attributes,{'tableName':_0xa02d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa02d('0xb'),'collate':_0xa02d('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9f1b829..cce901d 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 _0x8295=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x1b0587,_0x348e1d){var _0x43776f=function(_0x4b2d54){while(--_0x4b2d54){_0x1b0587['push'](_0x1b0587['shift']());}};_0x43776f(++_0x348e1d);}(_0x8295,0x109));var _0x5829=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x8295[_0x5466ab];return _0x40751a;};'use strict';var _=require(_0x5829('0x0'));var util=require(_0x5829('0x1'));var moment=require(_0x5829('0x2'));var BPromise=require(_0x5829('0x3'));var rs=require(_0x5829('0x4'));var fs=require('fs');var Redis=require(_0x5829('0x5'));var db=require(_0x5829('0x6'))['db'];var utils=require(_0x5829('0x7'));var logger=require(_0x5829('0x8'))(_0x5829('0x9'));var config=require(_0x5829('0xa'));var jayson=require(_0x5829('0xb'));var client=jayson[_0x5829('0xc')][_0x5829('0xd')]({'port':0x232a});config[_0x5829('0xe')]=_[_0x5829('0xf')](config[_0x5829('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5829('0xe')]));require(_0x5829('0x10'))['register'](socket);function respondWithRpcPromise(_0x34f88b,_0x4c1ee0,_0x4aff86){return new BPromise(function(_0x1a566c,_0x5e75f5){return client[_0x5829('0x11')](_0x34f88b,_0x4aff86)[_0x5829('0x12')](function(_0x568abf){logger[_0x5829('0x13')](_0x5829('0x14'),_0x4c1ee0,'request\x20sent');logger[_0x5829('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x4c1ee0,_0x5829('0x16'),JSON[_0x5829('0x17')](_0x568abf));if(_0x568abf[_0x5829('0x18')]){if(_0x568abf[_0x5829('0x18')][_0x5829('0x19')]===0x1f4){logger['error'](_0x5829('0x14'),_0x4c1ee0,_0x568abf[_0x5829('0x18')][_0x5829('0x1a')]);return _0x5e75f5(_0x568abf['error'][_0x5829('0x1a')]);}logger[_0x5829('0x18')](_0x5829('0x14'),_0x4c1ee0,_0x568abf[_0x5829('0x18')][_0x5829('0x1a')]);return _0x1a566c(_0x568abf['error']['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x4c1ee0,_0x5829('0x16'));_0x1a566c(_0x568abf[_0x5829('0x1b')][_0x5829('0x1a')]);}})[_0x5829('0x1c')](function(_0x3950b2){logger['error']('UserNotification,\x20%s,\x20%s',_0x4c1ee0,_0x3950b2);_0x5e75f5(_0x3950b2);});});} \ No newline at end of file +var _0xce04=['info','result','lodash','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0xce04,0x18e));var _0x4ce0=function(_0x294127,_0x44c7bf){_0x294127=_0x294127-0x0;var _0x4d49a2=_0xce04[_0x294127];return _0x4d49a2;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ce0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ce0('0x3'));var logger=require(_0x4ce0('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4ce0('0x5'));var client=jayson[_0x4ce0('0x6')][_0x4ce0('0x7')]({'port':0x232a});config['redis']=_[_0x4ce0('0x8')](config[_0x4ce0('0x9')],{'host':_0x4ce0('0xa'),'port':0x18eb});var socket=require(_0x4ce0('0xb'))(new Redis(config[_0x4ce0('0x9')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x14520e,_0x5b5eba,_0x15dfcc){return new BPromise(function(_0x593d04,_0x584bb8){return client['request'](_0x14520e,_0x15dfcc)[_0x4ce0('0xc')](function(_0x9d4b04){logger['info'](_0x4ce0('0xd'),_0x5b5eba,_0x4ce0('0xe'));logger[_0x4ce0('0xf')](_0x4ce0('0x10'),_0x5b5eba,_0x4ce0('0xe'),JSON['stringify'](_0x9d4b04));if(_0x9d4b04[_0x4ce0('0x11')]){if(_0x9d4b04[_0x4ce0('0x11')][_0x4ce0('0x12')]===0x1f4){logger[_0x4ce0('0x11')](_0x4ce0('0xd'),_0x5b5eba,_0x9d4b04[_0x4ce0('0x11')]['message']);return _0x584bb8(_0x9d4b04[_0x4ce0('0x11')][_0x4ce0('0x13')]);}logger['error'](_0x4ce0('0xd'),_0x5b5eba,_0x9d4b04[_0x4ce0('0x11')][_0x4ce0('0x13')]);return _0x593d04(_0x9d4b04[_0x4ce0('0x11')]['message']);}else{logger[_0x4ce0('0x14')](_0x4ce0('0xd'),_0x5b5eba,'request\x20sent');_0x593d04(_0x9d4b04[_0x4ce0('0x15')][_0x4ce0('0x13')]);}})['catch'](function(_0x5b773b){logger['error'](_0x4ce0('0xd'),_0x5b5eba,_0x5b773b);_0x584bb8(_0x5b773b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1d790fc..4dbe29d 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 _0xcda1=['update','emit','register','length','save','remove'];(function(_0xca4b42,_0x5f4b2c){var _0x3309cd=function(_0x37a2eb){while(--_0x37a2eb){_0xca4b42['push'](_0xca4b42['shift']());}};_0x3309cd(++_0x5f4b2c);}(_0xcda1,0x106));var _0x1cda=function(_0x2c3e58,_0x36a8d8){_0x2c3e58=_0x2c3e58-0x0;var _0x388c4e=_0xcda1[_0x2c3e58];return _0x388c4e;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1cda('0x0'),_0x1cda('0x1'),_0x1cda('0x2')];function createListener(_0x5e8f9e,_0x3f9afd){return function(_0x53eceb){_0x3f9afd[_0x1cda('0x3')](_0x5e8f9e,_0x53eceb);};}function removeListener(_0x1fa3c2,_0x3569e5){return function(){UserNotificationEvents['removeListener'](_0x1fa3c2,_0x3569e5);};}exports[_0x1cda('0x4')]=function(_0x49a60c){for(var _0x217d32=0x0,_0xfe9bfa=events[_0x1cda('0x5')];_0x217d32<_0xfe9bfa;_0x217d32++){var _0x1a34c0=events[_0x217d32];var _0x2e03f8=createListener('userNotification:'+_0x1a34c0,_0x49a60c);UserNotificationEvents['on'](_0x1a34c0,_0x2e03f8);}}; \ No newline at end of file +var _0xc716=['emit','register','length','userNotification:','./userNotification.events','save','update'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xc716,0xa5));var _0x6c71=function(_0x42cfaf,_0x391680){_0x42cfaf=_0x42cfaf-0x0;var _0x4cbabb=_0xc716[_0x42cfaf];return _0x4cbabb;};'use strict';var UserNotificationEvents=require(_0x6c71('0x0'));var events=[_0x6c71('0x1'),'remove',_0x6c71('0x2')];function createListener(_0x10cfb4,_0x2b03ee){return function(_0x2deba5){_0x2b03ee[_0x6c71('0x3')](_0x10cfb4,_0x2deba5);};}function removeListener(_0x1f1180,_0x254461){return function(){UserNotificationEvents['removeListener'](_0x1f1180,_0x254461);};}exports[_0x6c71('0x4')]=function(_0x34c8eb){for(var _0xbf872d=0x0,_0x188e7e=events[_0x6c71('0x5')];_0xbf872d<_0x188e7e;_0xbf872d++){var _0x43cd5c=events[_0xbf872d];var _0x48b566=createListener(_0x6c71('0x6')+_0x43cd5c,_0x34c8eb);UserNotificationEvents['on'](_0x43cd5c,_0x48b566);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 74942d2..1367a2f 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x35655f,_0x23dfc3){var _0x1f2ae8=function(_0x120ff7){while(--_0x120ff7){_0x35655f['push'](_0x35655f['shift']());}};_0x1f2ae8(++_0x23dfc3);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 6f29dc4..59dbb7f 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 _0xec56=['exports','INTEGER','sequelize'];(function(_0x298de3,_0x43e88d){var _0x2bcf0a=function(_0x4ac970){while(--_0x4ac970){_0x298de3['push'](_0x298de3['shift']());}};_0x2bcf0a(++_0x43e88d);}(_0xec56,0x12e));var _0x6ec5=function(_0x2ce80f,_0x434a7b){_0x2ce80f=_0x2ce80f-0x0;var _0x222da4=_0xec56[_0x2ce80f];return _0x222da4;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module[_0x6ec5('0x1')]={'penalty':{'type':Sequelize[_0x6ec5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6990=['INTEGER','sequelize','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6990,0x199));var _0x0699=function(_0x3befd6,_0x4a4eec){_0x3befd6=_0x3befd6-0x0;var _0x31f27e=_0x6990[_0x3befd6];return _0x31f27e;};'use strict';var Sequelize=require(_0x0699('0x0'));module[_0x0699('0x1')]={'penalty':{'type':Sequelize[_0x0699('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 0ba0e9f..7100b56 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 _0xc344=['util','api','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash'];(function(_0x18a16d,_0x199976){var _0x21cf0c=function(_0x2717d1){while(--_0x2717d1){_0x18a16d['push'](_0x18a16d['shift']());}};_0x21cf0c(++_0x199976);}(_0xc344,0x1d5));var _0x4c34=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xc344[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x4c34('0x0'));var util=require(_0x4c34('0x1'));var logger=require('../../config/logger')(_0x4c34('0x2'));var moment=require(_0x4c34('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c34('0x4'));var fs=require('fs');var path=require(_0x4c34('0x5'));var rimraf=require(_0x4c34('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c34('0x7'));module['exports']=function(_0x7c09cf,_0x4eba3b){return _0x7c09cf[_0x4c34('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x4c34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69b8=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_openchannel_queues'];(function(_0x3c9d39,_0x4f25c8){var _0x6a0f08=function(_0x665b54){while(--_0x665b54){_0x3c9d39['push'](_0x3c9d39['shift']());}};_0x6a0f08(++_0x4f25c8);}(_0x69b8,0xa5));var _0x869b=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x69b8[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x869b('0x0'));var util=require(_0x869b('0x1'));var logger=require('../../config/logger')(_0x869b('0x2'));var moment=require('moment');var BPromise=require(_0x869b('0x3'));var rp=require(_0x869b('0x4'));var fs=require('fs');var path=require(_0x869b('0x5'));var rimraf=require(_0x869b('0x6'));var config=require(_0x869b('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x869b('0x8')]=function(_0x21c478,_0x334eb5){return _0x21c478[_0x869b('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x869b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index d732bbd..0227e21 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 _0xc854=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','randomstring'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0xc854,0x18c));var _0x4c85=function(_0x49aed9,_0x4a7b44){_0x49aed9=_0x49aed9-0x0;var _0x5c913e=_0xc854[_0x49aed9];return _0x5c913e;};'use strict';var _=require(_0x4c85('0x0'));var util=require(_0x4c85('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c85('0x2'));var fs=require('fs');var Redis=require(_0x4c85('0x3'));var db=require(_0x4c85('0x4'))['db'];var utils=require(_0x4c85('0x5'));var logger=require(_0x4c85('0x6'))(_0x4c85('0x7'));var config=require(_0x4c85('0x8'));var jayson=require(_0x4c85('0x9'));var client=jayson[_0x4c85('0xa')][_0x4c85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58814c,_0x453776,_0x215c84){return new BPromise(function(_0x2a38d0,_0x5114dd){return client[_0x4c85('0xc')](_0x58814c,_0x215c84)[_0x4c85('0xd')](function(_0x1ae0b8){logger['info'](_0x4c85('0xe'),_0x453776,'request\x20sent');logger['debug'](_0x4c85('0xf'),_0x453776,_0x4c85('0x10'),JSON[_0x4c85('0x11')](_0x1ae0b8));if(_0x1ae0b8[_0x4c85('0x12')]){if(_0x1ae0b8[_0x4c85('0x12')]['code']===0x1f4){logger[_0x4c85('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x453776,_0x1ae0b8[_0x4c85('0x12')][_0x4c85('0x13')]);return _0x5114dd(_0x1ae0b8[_0x4c85('0x12')][_0x4c85('0x13')]);}logger['error'](_0x4c85('0xe'),_0x453776,_0x1ae0b8['error'][_0x4c85('0x13')]);return _0x2a38d0(_0x1ae0b8[_0x4c85('0x12')]['message']);}else{logger['info'](_0x4c85('0xe'),_0x453776,_0x4c85('0x10'));_0x2a38d0(_0x1ae0b8['result'][_0x4c85('0x13')]);}})[_0x4c85('0x14')](function(_0x21f8c0){logger[_0x4c85('0x12')](_0x4c85('0xe'),_0x453776,_0x21f8c0);_0x5114dd(_0x21f8c0);});});} \ No newline at end of file +var _0xc3c3=['../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x284d2a,_0x2781cf){var _0x362050=function(_0x10085a){while(--_0x10085a){_0x284d2a['push'](_0x284d2a['shift']());}};_0x362050(++_0x2781cf);}(_0xc3c3,0xad));var _0x3c3c=function(_0x28b336,_0x2caf78){_0x28b336=_0x28b336-0x0;var _0x3968d2=_0xc3c3[_0x28b336];return _0x3968d2;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require(_0x3c3c('0x2'));var BPromise=require(_0x3c3c('0x3'));var rs=require(_0x3c3c('0x4'));var fs=require('fs');var Redis=require(_0x3c3c('0x5'));var db=require(_0x3c3c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c3c('0x7'))(_0x3c3c('0x8'));var config=require(_0x3c3c('0x9'));var jayson=require(_0x3c3c('0xa'));var client=jayson[_0x3c3c('0xb')][_0x3c3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b6094,_0x4dfecd,_0x35079f){return new BPromise(function(_0x58d829,_0x30c377){return client[_0x3c3c('0xd')](_0x3b6094,_0x35079f)[_0x3c3c('0xe')](function(_0x409cec){logger['info'](_0x3c3c('0xf'),_0x4dfecd,'request\x20sent');logger[_0x3c3c('0x10')](_0x3c3c('0x11'),_0x4dfecd,'request\x20sent',JSON[_0x3c3c('0x12')](_0x409cec));if(_0x409cec[_0x3c3c('0x13')]){if(_0x409cec[_0x3c3c('0x13')][_0x3c3c('0x14')]===0x1f4){logger[_0x3c3c('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4dfecd,_0x409cec[_0x3c3c('0x13')][_0x3c3c('0x15')]);return _0x30c377(_0x409cec['error'][_0x3c3c('0x15')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4dfecd,_0x409cec[_0x3c3c('0x13')][_0x3c3c('0x15')]);return _0x58d829(_0x409cec[_0x3c3c('0x13')][_0x3c3c('0x15')]);}else{logger[_0x3c3c('0x16')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4dfecd,_0x3c3c('0x17'));_0x58d829(_0x409cec[_0x3c3c('0x18')][_0x3c3c('0x15')]);}})[_0x3c3c('0x19')](function(_0x3b0761){logger['error'](_0x3c3c('0xf'),_0x4dfecd,_0x3b0761);_0x30c377(_0x3b0761);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index c55fa44..6039a42 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 _0x321e=['post','create','clone','/:id/sections','addSections','put','/:id','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','getSections','/:id/resources'];(function(_0x2d275a,_0x2307a3){var _0x4038e9=function(_0x3ea8eb){while(--_0x3ea8eb){_0x2d275a['push'](_0x2d275a['shift']());}};_0x4038e9(++_0x2307a3);}(_0x321e,0xba));var _0xe321=function(_0x2743a2,_0x572988){_0x2743a2=_0x2743a2-0x0;var _0x47f135=_0x321e[_0x2743a2];return _0x47f135;};'use strict';var multer=require(_0xe321('0x0'));var util=require(_0xe321('0x1'));var path=require(_0xe321('0x2'));var timeout=require(_0xe321('0x3'));var express=require(_0xe321('0x4'));var router=express[_0xe321('0x5')]();var fs_extra=require(_0xe321('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe321('0x7'));var config=require('../../config/environment');var controller=require(_0xe321('0x8'));router[_0xe321('0x9')]('/',auth[_0xe321('0xa')](),controller[_0xe321('0xb')]);router[_0xe321('0x9')](_0xe321('0xc'),auth[_0xe321('0xa')](),controller[_0xe321('0xd')]);router[_0xe321('0x9')]('/:id',auth[_0xe321('0xa')](),controller[_0xe321('0xe')]);router[_0xe321('0x9')]('/:id/sections',auth['isAuthenticated'](),controller[_0xe321('0xf')]);router['get'](_0xe321('0x10'),auth['isAuthenticated'](),controller['getResources']);router[_0xe321('0x11')]('/',auth[_0xe321('0xa')](),controller[_0xe321('0x12')]);router[_0xe321('0x11')]('/:id/clone',auth[_0xe321('0xa')](),controller[_0xe321('0x13')]);router[_0xe321('0x11')](_0xe321('0x14'),auth[_0xe321('0xa')](),controller[_0xe321('0x15')]);router[_0xe321('0x11')]('/:id/resources',auth[_0xe321('0xa')](),controller['addResources']);router[_0xe321('0x16')](_0xe321('0x17'),auth[_0xe321('0xa')](),controller[_0xe321('0x18')]);router[_0xe321('0x19')](_0xe321('0x17'),auth[_0xe321('0xa')](),controller[_0xe321('0x1a')]);router['delete'](_0xe321('0x14'),auth[_0xe321('0xa')](),controller[_0xe321('0x1b')]);router[_0xe321('0x19')](_0xe321('0x10'),auth[_0xe321('0xa')](),controller['removeResources']);module[_0xe321('0x1c')]=router; \ No newline at end of file +var _0x99a0=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','getResources','create','/:id/clone','post','addSections','addResources','update','delete','destroy','exports','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x99a0,0x136));var _0x099a=function(_0x5ccc52,_0x2c1472){_0x5ccc52=_0x5ccc52-0x0;var _0x2fc248=_0x99a0[_0x5ccc52];return _0x2fc248;};'use strict';var multer=require(_0x099a('0x0'));var util=require('util');var path=require(_0x099a('0x1'));var timeout=require(_0x099a('0x2'));var express=require(_0x099a('0x3'));var router=express['Router']();var fs_extra=require(_0x099a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x099a('0x5'));var config=require(_0x099a('0x6'));var controller=require(_0x099a('0x7'));router[_0x099a('0x8')]('/',auth[_0x099a('0x9')](),controller[_0x099a('0xa')]);router['get'](_0x099a('0xb'),auth[_0x099a('0x9')](),controller[_0x099a('0xc')]);router[_0x099a('0x8')](_0x099a('0xd'),auth[_0x099a('0x9')](),controller['show']);router[_0x099a('0x8')](_0x099a('0xe'),auth[_0x099a('0x9')](),controller[_0x099a('0xf')]);router[_0x099a('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0x099a('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x099a('0x11')]);router['post'](_0x099a('0x12'),auth['isAuthenticated'](),controller['clone']);router[_0x099a('0x13')]('/:id/sections',auth[_0x099a('0x9')](),controller[_0x099a('0x14')]);router[_0x099a('0x13')]('/:id/resources',auth[_0x099a('0x9')](),controller[_0x099a('0x15')]);router['put'](_0x099a('0xd'),auth[_0x099a('0x9')](),controller[_0x099a('0x16')]);router[_0x099a('0x17')](_0x099a('0xd'),auth['isAuthenticated'](),controller[_0x099a('0x18')]);router[_0x099a('0x17')](_0x099a('0xe'),auth[_0x099a('0x9')](),controller['removeSections']);router[_0x099a('0x17')]('/:id/resources',auth[_0x099a('0x9')](),controller['removeResources']);module[_0x099a('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 94eb863..94e6e69 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 _0x2927=['BOOLEAN','sequelize','exports','name','STRING','crudPermissions','join','getDataValue'];(function(_0x3f57db,_0x10e075){var _0x8cc430=function(_0x81d29b){while(--_0x81d29b){_0x3f57db['push'](_0x3f57db['shift']());}};_0x8cc430(++_0x10e075);}(_0x2927,0x151));var _0x7292=function(_0x4e31ed,_0xebdee7){_0x4e31ed=_0x4e31ed-0x0;var _0x3277c1=_0x2927[_0x4e31ed];return _0x3277c1;};'use strict';var Sequelize=require(_0x7292('0x0'));module[_0x7292('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7292('0x2')},'crudPermissions':{'type':Sequelize[_0x7292('0x3')],'set':function(_0x32d119){this['setDataValue'](_0x7292('0x4'),_0x32d119?_0x32d119[_0x7292('0x5')](''):[]);},'get':function(){return this[_0x7292('0x6')]('crudPermissions')?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7292('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7292('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7292('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7292('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7292('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6899=['sequelize','exports','name','STRING','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x3b2675,_0x1423a4){var _0x2e92ae=function(_0x2268a0){while(--_0x2268a0){_0x3b2675['push'](_0x3b2675['shift']());}};_0x2e92ae(++_0x1423a4);}(_0x6899,0x1dd));var _0x9689=function(_0x3cc43a,_0x343453){_0x3cc43a=_0x3cc43a-0x0;var _0x5924f1=_0x6899[_0x3cc43a];return _0x5924f1;};'use strict';var Sequelize=require(_0x9689('0x0'));module[_0x9689('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9689('0x2')},'crudPermissions':{'type':Sequelize[_0x9689('0x3')],'set':function(_0x16f897){this['setDataValue'](_0x9689('0x4'),_0x16f897?_0x16f897[_0x9689('0x5')](''):[]);},'get':function(){return this[_0x9689('0x6')](_0x9689('0x4'))?this['getDataValue'](_0x9689('0x4'))[_0x9689('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9689('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9689('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9689('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9689('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9689('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9689('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 0cdb94c..4e3239b 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 _0x531a=['find','create','includeAll','get','createdAt','updatedAt','crudPermissions','omit','body','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','sequelize','transaction','getSections','enabled','includes','subsections','push','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','map','UserProfile','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','catch','show','params','rawAttributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x531a,0x100));var _0xa531=function(_0x203467,_0xfff719){_0x203467=_0x203467-0x0;var _0x3f2d37=_0x531a[_0x203467];return _0x3f2d37;};'use strict';var emlformat=require(_0xa531('0x0'));var rimraf=require(_0xa531('0x1'));var zipdir=require(_0xa531('0x2'));var jsonpatch=require(_0xa531('0x3'));var rp=require(_0xa531('0x4'));var moment=require(_0xa531('0x5'));var BPromise=require(_0xa531('0x6'));var Mustache=require(_0xa531('0x7'));var util=require(_0xa531('0x8'));var path=require(_0xa531('0x9'));var sox=require('sox');var csv=require(_0xa531('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa531('0xb'));var _=require(_0xa531('0xc'));var squel=require(_0xa531('0xd'));var crypto=require(_0xa531('0xe'));var jsforce=require(_0xa531('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa531('0xa'));var querystring=require(_0xa531('0x10'));var Papa=require('papaparse');var Redis=require(_0xa531('0x11'));var authService=require(_0xa531('0x12'));var qs=require(_0xa531('0x13'));var as=require(_0xa531('0x14'));var hardwareService=require(_0xa531('0x15'));var logger=require('../../config/logger')(_0xa531('0x16'));var utils=require('../../config/utils');var config=require(_0xa531('0x17'));var licenseUtil=require(_0xa531('0x18'));var db=require(_0xa531('0x19'))['db'];config['redis']=_[_0xa531('0x1a')](config[_0xa531('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa531('0x1c'))(new Redis(config[_0xa531('0x1b')]));require('./userProfile.socket')[_0xa531('0x1d')](socket);function respondWithStatusCode(_0x319f1f,_0x2e2753){_0x2e2753=_0x2e2753||0xcc;return function(_0x5f3cba){if(_0x5f3cba){return _0x319f1f['sendStatus'](_0x2e2753);}return _0x319f1f['status'](_0x2e2753)[_0xa531('0x1e')]();};}function respondWithResult(_0x1668aa,_0x3c0798){_0x3c0798=_0x3c0798||0xc8;return function(_0x2082b4){if(_0x2082b4){return _0x1668aa[_0xa531('0x1f')](_0x3c0798)[_0xa531('0x20')](_0x2082b4);}};}function respondWithFilteredResult(_0x580761,_0x2d664d){return function(_0x5124a1){if(_0x5124a1){var _0x412b84=typeof _0x2d664d[_0xa531('0x21')]==='undefined'&&typeof _0x2d664d['limit']===_0xa531('0x22');var _0x40848c=_0x5124a1[_0xa531('0x23')];var _0x55a731=_0x412b84?0x0:_0x2d664d[_0xa531('0x21')];var _0x468b75=_0x412b84?_0x5124a1[_0xa531('0x23')]:_0x2d664d['offset']+_0x2d664d[_0xa531('0x24')];var _0x13904e;if(_0x468b75>=_0x40848c){_0x468b75=_0x40848c;_0x13904e=0xc8;}else{_0x13904e=0xce;}_0x580761['status'](_0x13904e);return _0x580761[_0xa531('0x25')](_0xa531('0x26'),_0x55a731+'-'+_0x468b75+'/'+_0x40848c)[_0xa531('0x20')](_0x5124a1);}return null;};}function patchUpdates(_0x18d0ef){return function(_0x240989){try{jsonpatch[_0xa531('0x27')](_0x240989,_0x18d0ef,!![]);}catch(_0x3270a6){return BPromise[_0xa531('0x28')](_0x3270a6);}return _0x240989[_0xa531('0x29')]();};}function saveUpdates(_0x39f640,_0x8e9ab3){return function(_0x3ac4eb){if(_0x3ac4eb){return _0x3ac4eb['update'](_0x39f640)[_0xa531('0x2a')](function(_0x1d0217){return _0x1d0217;});}return null;};}function removeEntity(_0x1d32ed,_0x487a8c){return function(_0x7fb52d){if(_0x7fb52d){return _0x7fb52d[_0xa531('0x2b')]()['then'](function(){_0x1d32ed['status'](0xcc)[_0xa531('0x1e')]();});}};}function handleEntityNotFound(_0x56b96d,_0x3acffc){return function(_0x2be143){if(!_0x2be143){_0x56b96d['sendStatus'](0x194);}return _0x2be143;};}function handleError(_0x40f43c,_0x5f2b51){_0x5f2b51=_0x5f2b51||0x1f4;return function(_0x36a8e6){logger['error'](_0x36a8e6['stack']);if(_0x36a8e6['name']){delete _0x36a8e6[_0xa531('0x2c')];}_0x40f43c[_0xa531('0x1f')](_0x5f2b51)['send'](_0x36a8e6);};}exports['index']=function(_0x380cec,_0x59a10f){var _0x97df27={},_0x133431={},_0x556f56={'count':0x0,'rows':[]};var _0x3590f4=_[_0xa531('0x2d')](db[_0xa531('0x2e')]['rawAttributes'],function(_0x362691){return{'name':_0x362691[_0xa531('0x2f')],'type':_0x362691['type'][_0xa531('0x30')]};});_0x133431[_0xa531('0x31')]=_['map'](_0x3590f4,_0xa531('0x2c'));_0x133431[_0xa531('0x32')]=_[_0xa531('0x33')](_0x380cec[_0xa531('0x32')]);_0x133431[_0xa531('0x34')]=_[_0xa531('0x35')](_0x133431[_0xa531('0x31')],_0x133431['query']);_0x97df27['attributes']=_[_0xa531('0x35')](_0x133431[_0xa531('0x31')],qs[_0xa531('0x36')](_0x380cec[_0xa531('0x32')][_0xa531('0x36')]));_0x97df27['attributes']=_0x97df27[_0xa531('0x37')][_0xa531('0x38')]?_0x97df27[_0xa531('0x37')]:_0x133431[_0xa531('0x31')];if(!_0x380cec[_0xa531('0x32')][_0xa531('0x39')](_0xa531('0x3a'))){_0x97df27[_0xa531('0x24')]=qs[_0xa531('0x24')](_0x380cec[_0xa531('0x32')][_0xa531('0x24')]);_0x97df27['offset']=qs[_0xa531('0x21')](_0x380cec[_0xa531('0x32')][_0xa531('0x21')]);}_0x97df27[_0xa531('0x3b')]=qs[_0xa531('0x3c')](_0x380cec['query'][_0xa531('0x3c')]);_0x97df27[_0xa531('0x3d')]=qs[_0xa531('0x34')](_[_0xa531('0x3e')](_0x380cec['query'],_0x133431[_0xa531('0x34')]),_0x3590f4);if(_0x380cec[_0xa531('0x32')][_0xa531('0x3f')]){_0x97df27['where']=_['merge'](_0x97df27[_0xa531('0x3d')],{'$or':_['map'](_0x3590f4,function(_0x43d459){if(_0x43d459[_0xa531('0x40')]!==_0xa531('0x41')){var _0x4bc4ee={};_0x4bc4ee[_0x43d459['name']]={'$like':'%'+_0x380cec[_0xa531('0x32')]['filter']+'%'};return _0x4bc4ee;}})});}_0x97df27=_[_0xa531('0x42')]({},_0x97df27,_0x380cec[_0xa531('0x43')]);var _0x2024ce={'where':_0x97df27[_0xa531('0x3d')]};return db[_0xa531('0x2e')][_0xa531('0x23')](_0x2024ce)[_0xa531('0x2a')](function(_0x24e0ab){_0x556f56[_0xa531('0x23')]=_0x24e0ab;if(_0x380cec['query']['includeAll']){_0x97df27[_0xa531('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0xa531('0x45')](_0x97df27);})[_0xa531('0x2a')](function(_0x12d2e0){_0x556f56['rows']=_0x12d2e0;return _0x556f56;})[_0xa531('0x2a')](respondWithFilteredResult(_0x59a10f,_0x97df27))[_0xa531('0x46')](handleError(_0x59a10f,null));};exports[_0xa531('0x47')]=function(_0xfaa238,_0x3e74f6){var _0x3bf073={'raw':![],'where':{'id':_0xfaa238[_0xa531('0x48')]['id']}},_0x28eff1={};_0x28eff1[_0xa531('0x31')]=_[_0xa531('0x33')](db[_0xa531('0x2e')][_0xa531('0x49')]);_0x28eff1[_0xa531('0x32')]=_['keys'](_0xfaa238[_0xa531('0x32')]);_0x28eff1['filters']=_[_0xa531('0x35')](_0x28eff1[_0xa531('0x31')],_0x28eff1[_0xa531('0x32')]);_0x3bf073[_0xa531('0x37')]=_['intersection'](_0x28eff1['model'],qs['fields'](_0xfaa238[_0xa531('0x32')][_0xa531('0x36')]));_0x3bf073[_0xa531('0x37')]=_0x3bf073['attributes'][_0xa531('0x38')]?_0x3bf073[_0xa531('0x37')]:_0x28eff1[_0xa531('0x31')];if(_0xfaa238[_0xa531('0x32')]['includeAll']){_0x3bf073[_0xa531('0x44')]=[{'all':!![]}];}_0x3bf073=_['merge']({},_0x3bf073,_0xfaa238[_0xa531('0x43')]);return db[_0xa531('0x2e')][_0xa531('0x4a')](_0x3bf073)[_0xa531('0x2a')](handleEntityNotFound(_0x3e74f6,null))[_0xa531('0x2a')](respondWithResult(_0x3e74f6,null))['catch'](handleError(_0x3e74f6,null));};exports[_0xa531('0x4b')]=function(_0x2a5973,_0x333b61){return db[_0xa531('0x2e')][_0xa531('0x4b')](_0x2a5973['body'],{})[_0xa531('0x2a')](respondWithResult(_0x333b61,0xc9))[_0xa531('0x46')](handleError(_0x333b61,null));};exports['clone']=function(_0x19ba40,_0x4abca4){var _0x1b9331={'where':{'id':_0x19ba40[_0xa531('0x48')]['id']}},_0x271bfa={};_0x271bfa['model']=_[_0xa531('0x33')](db['UserProfile'][_0xa531('0x49')]);_0x1b9331[_0xa531('0x37')]=_[_0xa531('0x35')](_0x271bfa['model'],qs['fields'](_0x19ba40['query'][_0xa531('0x36')]));_0x1b9331[_0xa531('0x37')]=_0x1b9331[_0xa531('0x37')]['length']?_0x1b9331[_0xa531('0x37')]:_0x271bfa[_0xa531('0x31')];if(_0x19ba40[_0xa531('0x32')][_0xa531('0x4c')]){_0x1b9331[_0xa531('0x44')]=[{'all':!![]}];}_0x1b9331=_[_0xa531('0x42')]({},_0x1b9331,_0x19ba40['options']);return db[_0xa531('0x2e')]['find'](_0x1b9331)[_0xa531('0x2a')](handleEntityNotFound(_0x4abca4,null))[_0xa531('0x2a')](function(_0x8eeecf){if(_0x8eeecf){var _0x435e40=_0x8eeecf[_0xa531('0x4d')]({'plain':!![]});_0x435e40=qs['omit'](_0x435e40,['id',_0xa531('0x4e'),_0xa531('0x4f'),_0xa531('0x50')]);_0x19ba40['body']=_[_0xa531('0x51')](_0x19ba40['body'],['id',_0xa531('0x4e'),'updatedAt']);return db['sequelize']['transaction'](function(_0x48b75c){return db['UserProfile'][_0xa531('0x4b')](_[_0xa531('0x42')](_0x435e40,_0x19ba40[_0xa531('0x52')]),{'include':_0x19ba40[_0xa531('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x48b75c})[_0xa531('0x2a')](function(_0x2dc197){var _0x1237ee=_0x2dc197['get']({'plain':!![]});return db[_0xa531('0x53')]['findAll']({'where':{'userProfileId':_0x19ba40[_0xa531('0x48')]['id']},'raw':!![]})[_0xa531('0x2a')](function(_0xb30d0c){if(_0xb30d0c){return BPromise['each'](_0xb30d0c,function(_0xc03a25){return new BPromise(function(_0x271edf,_0x4f9b65){if(_0xc03a25['autoAssociation']===null||_0xc03a25[_0xa531('0x54')]===0x1)_0x271edf(null);return db[_0xa531('0x55')][_0xa531('0x45')]({'where':{'sectionId':_0xc03a25['id']},'raw':!![]})['then'](function(_0x40a286){var _0x5c11a9=_[_0xa531('0x2d')](_0x40a286,function(_0x204cf3){return qs[_0xa531('0x51')](_0x204cf3,['id',_0xa531('0x4e'),_0xa531('0x4f'),_0xa531('0x56')]);});_0x271edf(_0x5c11a9);})['catch'](function(_0x4bb672){_0x4f9b65(_0x4bb672);});})[_0xa531('0x2a')](function(_0x8040e4){var _0x4fe582=qs[_0xa531('0x51')](_0xc03a25,['id',_0xa531('0x4e'),_0xa531('0x4f')]);_0x4fe582[_0xa531('0x57')]=_0x1237ee['id'];if(_0x8040e4)_0x4fe582[_0xa531('0x58')]=_0x8040e4;return _0x4fe582;})[_0xa531('0x2a')](function(_0x51d1e0){return db[_0xa531('0x53')][_0xa531('0x4b')](_0x51d1e0,{'include':[{'model':db[_0xa531('0x55')],'as':_0xa531('0x58')}],'raw':!![],'transaction':_0x48b75c});});})[_0xa531('0x2a')](function(){return _0x1237ee;});}});});});}})['then'](respondWithResult(_0x4abca4,0xc9))['catch'](handleError(_0x4abca4,null));};exports[_0xa531('0x59')]=function(_0x41342a,_0x103e1d){if(_0x41342a[_0xa531('0x52')]['id']){delete _0x41342a[_0xa531('0x52')]['id'];}return db[_0xa531('0x2e')][_0xa531('0x4a')]({'where':{'id':_0x41342a[_0xa531('0x48')]['id']}})[_0xa531('0x2a')](handleEntityNotFound(_0x103e1d,null))[_0xa531('0x2a')](saveUpdates(_0x41342a[_0xa531('0x52')],null))[_0xa531('0x2a')](respondWithResult(_0x103e1d,null))['catch'](handleError(_0x103e1d,null));};exports['destroy']=function(_0x20c25f,_0xb7fa73){return db['UserProfile'][_0xa531('0x4a')]({'where':{'id':_0x20c25f[_0xa531('0x48')]['id']}})[_0xa531('0x2a')](handleEntityNotFound(_0xb7fa73,null))[_0xa531('0x2a')](removeEntity(_0xb7fa73,null))['catch'](handleError(_0xb7fa73,null));};exports['describe']=function(_0x245cb7,_0x579e7f){return db[_0xa531('0x2e')][_0xa531('0x5a')]()[_0xa531('0x2a')](respondWithResult(_0x579e7f,null))[_0xa531('0x46')](handleError(_0x579e7f,null));};exports[_0xa531('0x5b')]=function(_0x1033a5,_0x196ea3){var _0xadbd2d=_0x1033a5[_0xa531('0x52')];return db['UserProfile'][_0xa531('0x4a')]({'where':{'id':_0x1033a5['params']['id']}})[_0xa531('0x2a')](handleEntityNotFound(_0x196ea3,null))[_0xa531('0x2a')](function(_0x3fbeab){if(_0x3fbeab){return db[_0xa531('0x5c')][_0xa531('0x5d')](function(_0x23985e){return db[_0xa531('0x53')]['destroy']({'where':{'userProfileId':_0x1033a5[_0xa531('0x48')]['id'],'sectionId':_[_0xa531('0x2d')](_0xadbd2d,function(_0x404a01){return _0x404a01[_0xa531('0x56')];})},'transaction':_0x23985e})[_0xa531('0x2a')](function(){var _0x2c8a5c=_[_0xa531('0x2d')](_0xadbd2d,function(_0x30d3d0){_0x30d3d0[_0xa531('0x57')]=_0x1033a5[_0xa531('0x48')]['id'];return _0x30d3d0;});var _0x40b1a0=[];return BPromise['each'](_0x2c8a5c,function(_0x273274){return db[_0xa531('0x53')]['create'](_0x273274,{'include':[{'model':db[_0xa531('0x55')],'as':_0xa531('0x58')}],'raw':!![],'transaction':_0x23985e})['then'](function(_0x36c29c){_0x40b1a0['push'](_0x36c29c[_0xa531('0x4d')]({'plain':!![]}));});})[_0xa531('0x2a')](function(){return _0x40b1a0;});});});}})[_0xa531('0x2a')](function(_0x5b2f3d){return _0x5b2f3d;})['then'](respondWithResult(_0x196ea3,null))[_0xa531('0x46')](handleError(_0x196ea3,null));};exports['removeSections']=function(_0x9654b7,_0x3b854d){var _0x44e590;return db[_0xa531('0x2e')]['find']({'where':{'id':_0x9654b7['params']['id']},'attributes':['id','name']})[_0xa531('0x2a')](handleEntityNotFound(_0x3b854d,null))[_0xa531('0x2a')](function(_0x544bdc){if(_0x544bdc){_0x44e590=_0x544bdc;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x9654b7['params']['id'],'sectionId':_0x9654b7['query']['ids']}});}})[_0xa531('0x2a')](function(){return _0x44e590;})[_0xa531('0x2a')](respondWithStatusCode(_0x3b854d,null))[_0xa531('0x46')](handleError(_0x3b854d,null));};exports[_0xa531('0x5e')]=function(_0x497d30,_0x2e86ce){var _0x82d6bb=[];var _0x24f75e=[];return db[_0xa531('0x53')][_0xa531('0x45')]({'where':{'userProfileId':_0x497d30['params']['id']},'raw':!![]})[_0xa531('0x2a')](function(_0x31c094){_0x82d6bb=_[_0xa531('0x3f')](_0x31c094,function(_0x3ce38c){return _0x3ce38c[_0xa531('0x5f')]===0x1||_[_0xa531('0x60')]([0x3eb,0x709],_0x3ce38c[_0xa531('0x56')]);});if(!_['isEmpty'](_0x82d6bb)){return _['map'](_0x82d6bb,function(_0x45e1bf){return _0x45e1bf[_0xa531('0x56')];});}else{return;}})[_0xa531('0x2a')](function(_0x3a7e28){if(_0x3a7e28)_0x24f75e=_0x3a7e28;if(_[_0xa531('0x60')](_0x24f75e,0x64)){var _0x3f5e78=_[_0xa531('0x4a')](_0x82d6bb,{'sectionId':0x64});return hasDefaultDashboard(_0x3f5e78)[_0xa531('0x2a')](function(_0x260396){return _[_0xa531('0x2d')](_0x82d6bb,function(_0x23d7e6){if(_0x23d7e6[_0xa531('0x56')]===0x64){_0x23d7e6[_0xa531('0x61')]=_0x260396;}return _0x23d7e6;});});}else{return;}})['then'](function(_0x1b99b6){if(_0x1b99b6)_0x82d6bb=_0x1b99b6;if(_[_0xa531('0x60')](_0x24f75e,0x3eb)){var _0x4410b5=_['find'](_0x82d6bb,{'sectionId':0x3eb});return getCustomDashboards(_0x4410b5)[_0xa531('0x2a')](function(_0x212d40){return _[_0xa531('0x2d')](_0x82d6bb,function(_0x2b8b3a){if(_0x4410b5[_0xa531('0x5f')]){if(_0x2b8b3a['sectionId']===0x3eb){_0x2b8b3a[_0xa531('0x61')]=_0x212d40;}}else{if(_0x2b8b3a['sectionId']===0x64){_0x2b8b3a[_0xa531('0x61')]=_0x212d40;}}return _0x2b8b3a;});});}else{return;}})[_0xa531('0x2a')](function(_0x415b27){if(_0x415b27)_0x82d6bb=_0x415b27;if(_['includes'](_0x24f75e,0x709)){var _0x5c46ab=_[_0xa531('0x4a')](_0x82d6bb,{'sectionId':0x709});return getPlugins(_0x5c46ab)['then'](function(_0x58b737){if(_0x5c46ab[_0xa531('0x5f')]){return _['map'](_0x82d6bb,function(_0x3ff0e3){if(_0x3ff0e3[_0xa531('0x56')]===0x709){_0x3ff0e3[_0xa531('0x61')]=_0x58b737;}return _0x3ff0e3;});}else{var _0x1df4a7={'sectionId':0x76c,'enabled':0x1,'subsections':_0x58b737};var _0x54dd4e=_[_0xa531('0x2d')](_0x82d6bb);_0x54dd4e[_0xa531('0x62')](_0x1df4a7);return _0x54dd4e;}});}else{return;}})[_0xa531('0x2a')](function(_0x34f691){if(_0x34f691)_0x82d6bb=_0x34f691;return _[_0xa531('0x3f')](_0x82d6bb,['enabled',0x1]);})[_0xa531('0x2a')](respondWithResult(_0x2e86ce,null))[_0xa531('0x46')](handleError(_0x2e86ce,null));};function hasDefaultDashboard(_0x1b7eab){var _0xaa2fc9=[0x65];return new BPromise(function(_0x154651,_0x7a68b7){try{if(_0x1b7eab['autoAssociation']){_0x154651(_0xaa2fc9);}else{return db['UserProfileResource'][_0xa531('0x63')]({'where':{'sectionId':_0x1b7eab['id']},'raw':!![]})[_0xa531('0x2a')](function(_0xbfdc02){_0xbfdc02?_0x154651(_0xaa2fc9):_0x154651();});}}catch(_0x15c8bd){_0x7a68b7(_0x15c8bd);}});}function getCustomDashboards(_0x265a11){var _0xc0ca65=[];return new BPromise(function(_0x5d4832,_0x16bbf0){try{if(_0x265a11[_0xa531('0x54')]){return db[_0xa531('0x64')][_0xa531('0x45')]({'raw':!![]})[_0xa531('0x2a')](function(_0x21f985){_0x21f985[_0xa531('0x65')](function(_0x424d40){_0xc0ca65[_0xa531('0x62')](_0x424d40['id']+0x1869f);});_0x5d4832(_0xc0ca65);});}else{return db[_0xa531('0x55')][_0xa531('0x45')]({'where':{'sectionId':_0x265a11['id']},'raw':!![]})['then'](function(_0x371886){_0x371886[_0xa531('0x65')](function(_0x4e2c31){_0xc0ca65[_0xa531('0x62')](_0x4e2c31['resourceId']+0x1869f);});_0x5d4832(_0xc0ca65);});}}catch(_0x51c66e){_0x16bbf0(_0x51c66e);}});}function getPlugins(_0x5e0846){var _0x47f939=[];return new BPromise(function(_0x36db49,_0x202337){try{if(_0x5e0846['autoAssociation']){return db[_0xa531('0x66')][_0xa531('0x45')]({'raw':!![]})[_0xa531('0x2a')](function(_0x3b3354){_0x3b3354['forEach'](function(_0x16215b){_0x47f939[_0xa531('0x62')](_0x16215b['id']+0x15b38);});_0x36db49(_0x47f939);});}else{return db[_0xa531('0x55')]['findAll']({'where':{'sectionId':_0x5e0846['id']},'raw':!![]})[_0xa531('0x2a')](function(_0x467848){_0x467848[_0xa531('0x65')](function(_0x219da9){_0x47f939['push'](_0x219da9[_0xa531('0x67')]+0x15b38);});_0x36db49(_0x47f939);});}}catch(_0x196794){_0x202337(_0x196794);}});}exports[_0xa531('0x68')]=function(_0x1896df,_0x5978b3){return db['UserProfile'][_0xa531('0x4a')]({'where':{'id':_0x1896df['params']['id']}})['then'](handleEntityNotFound(_0x5978b3,null))['then'](function(_0x1b6ecc){if(_0x1b6ecc){return db[_0xa531('0x5c')]['transaction'](function(_0x49dd06){return db[_0xa531('0x53')]['findAll']({'where':{'userProfileId':_0x1896df[_0xa531('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xb24ec5){if(_0xb24ec5){return db[_0xa531('0x53')][_0xa531('0x2b')]({'where':{'userProfileId':_0x1896df['params']['id'],'id':_[_0xa531('0x2d')](_0xb24ec5,function(_0xcea188){return _0xcea188['id'];})},'transaction':_0x49dd06});}})[_0xa531('0x2a')](function(_0x21f90e){var _0x4a9bf2=_['map'](_0x1896df[_0xa531('0x52')],function(_0x3c8665){_0x3c8665[_0xa531('0x57')]=_0x1896df[_0xa531('0x48')]['id'];return _0x3c8665;});return db['UserProfileSection']['bulkCreate'](_0x4a9bf2,{'raw':!![],'transaction':_0x49dd06});})['then'](function(_0x34dbe9){var _0x6b40=_['filter'](_[_0xa531('0x2d')](_0x34dbe9,function(_0x5c678f){return _0x5c678f[_0xa531('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x6b40){return db[_0xa531('0x53')]['findAll']({'where':{'userProfileId':_0x1896df[_0xa531('0x48')]['id'],'sectionId':_[_0xa531('0x2d')](_0x6b40,function(_0x1b42bb){return _0x1b42bb['sectionId'];})},'attributes':['id',_0xa531('0x56')],'raw':!![]})[_0xa531('0x2a')](function(_0x6adc1d){var _0x4c5f8a=_[_0xa531('0x2d')](_0x1896df[_0xa531('0x52')],function(_0x560264){_0x560264[_0xa531('0x57')]=_0x1896df[_0xa531('0x48')]['id'];return _0x560264;});return db[_0xa531('0x55')][_0xa531('0x69')](_0x4c5f8a,{'raw':!![],'transaction':_0x49dd06});});}})[_0xa531('0x46')](handleError(_0x5978b3,null));});}})[_0xa531('0x2a')](function(_0x49dda6){var _0x4d98fd=_[_0xa531('0x2d')](_0x49dda6,function(_0x50fd28){return _0x50fd28[_0xa531('0x4d')]({'plain':!![]});});})[_0xa531('0x2a')](respondWithResult(_0x5978b3,null))['catch'](handleError(_0x5978b3,null));};exports['removeResources']=function(_0xe22dd7,_0x2af973,_0x3f40d4){return db['UserProfile'][_0xa531('0x4a')]({'where':{'id':_0xe22dd7['params']['id']}})[_0xa531('0x2a')](handleEntityNotFound(_0x2af973,null))[_0xa531('0x2a')](function(_0x50441b){if(_0x50441b){return _0x50441b[_0xa531('0x6a')](_0xe22dd7['query']['ids']);}})[_0xa531('0x2a')](respondWithStatusCode(_0x2af973,null))['catch'](handleError(_0x2af973,null));};exports['getResources']=function(_0x6acce0,_0x106b4e){var _0x55ef32={};if(!_0x6acce0['query'][_0xa531('0x6b')])throw new Error('Missing\x20section\x20parameter');if(!_0x6acce0[_0xa531('0x32')][_0xa531('0x39')](_0xa531('0x3a'))){_0x55ef32[_0xa531('0x24')]=qs[_0xa531('0x24')](_0x6acce0[_0xa531('0x32')][_0xa531('0x24')]);_0x55ef32[_0xa531('0x21')]=qs[_0xa531('0x21')](_0x6acce0[_0xa531('0x32')][_0xa531('0x21')]);}return db['UserProfile'][_0xa531('0x4a')]({'where':{'id':_0x6acce0[_0xa531('0x48')]['id']}})[_0xa531('0x2a')](function(_0x2b22db){if(!_0x2b22db)throw new Error(_0xa531('0x6c')+_0x6acce0[_0xa531('0x48')]['id']);return db[_0xa531('0x2e')][_0xa531('0x6d')](_0x6acce0);})[_0xa531('0x2a')](respondWithFilteredResult(_0x106b4e,_0x55ef32))[_0xa531('0x46')](handleError(_0x106b4e,null));}; \ No newline at end of file +var _0x96d8=['removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','error','stack','name','send','index','UserProfile','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','params','include','find','create','body','clone','rawAttributes','get','omit','updatedAt','createdAt','sequelize','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','UserProfileSection','destroy','each','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','autoAssociation','Plugin','addResources','bulkCreate'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0x96d8,0x1e2));var _0x896d=function(_0x374ed0,_0x580f98){_0x374ed0=_0x374ed0-0x0;var _0x4c2b90=_0x96d8[_0x374ed0];return _0x4c2b90;};'use strict';var emlformat=require(_0x896d('0x0'));var rimraf=require(_0x896d('0x1'));var zipdir=require(_0x896d('0x2'));var jsonpatch=require(_0x896d('0x3'));var rp=require(_0x896d('0x4'));var moment=require(_0x896d('0x5'));var BPromise=require(_0x896d('0x6'));var Mustache=require(_0x896d('0x7'));var util=require(_0x896d('0x8'));var path=require(_0x896d('0x9'));var sox=require(_0x896d('0xa'));var csv=require(_0x896d('0xb'));var ejs=require(_0x896d('0xc'));var fs=require('fs');var fs_extra=require(_0x896d('0xd'));var _=require('lodash');var squel=require(_0x896d('0xe'));var crypto=require(_0x896d('0xf'));var jsforce=require(_0x896d('0x10'));var deskjs=require(_0x896d('0x11'));var toCsv=require(_0x896d('0xb'));var querystring=require(_0x896d('0x12'));var Papa=require(_0x896d('0x13'));var Redis=require(_0x896d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x896d('0x15'));var as=require(_0x896d('0x16'));var hardwareService=require(_0x896d('0x17'));var logger=require(_0x896d('0x18'))(_0x896d('0x19'));var utils=require('../../config/utils');var config=require(_0x896d('0x1a'));var licenseUtil=require(_0x896d('0x1b'));var db=require(_0x896d('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x896d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x896d('0x1e')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x10cf46,_0x10d472){_0x10d472=_0x10d472||0xcc;return function(_0x5a3674){if(_0x5a3674){return _0x10cf46[_0x896d('0x1f')](_0x10d472);}return _0x10cf46[_0x896d('0x20')](_0x10d472)[_0x896d('0x21')]();};}function respondWithResult(_0x332eba,_0x1cd959){_0x1cd959=_0x1cd959||0xc8;return function(_0x28514a){if(_0x28514a){return _0x332eba[_0x896d('0x20')](_0x1cd959)[_0x896d('0x22')](_0x28514a);}};}function respondWithFilteredResult(_0x28be1e,_0x50c5ff){return function(_0x34732b){if(_0x34732b){var _0x26d64e=typeof _0x50c5ff['offset']===_0x896d('0x23')&&typeof _0x50c5ff[_0x896d('0x24')]===_0x896d('0x23');var _0x598cd9=_0x34732b[_0x896d('0x25')];var _0x446838=_0x26d64e?0x0:_0x50c5ff[_0x896d('0x26')];var _0xa41442=_0x26d64e?_0x34732b['count']:_0x50c5ff[_0x896d('0x26')]+_0x50c5ff[_0x896d('0x24')];var _0x3e626a;if(_0xa41442>=_0x598cd9){_0xa41442=_0x598cd9;_0x3e626a=0xc8;}else{_0x3e626a=0xce;}_0x28be1e[_0x896d('0x20')](_0x3e626a);return _0x28be1e[_0x896d('0x27')](_0x896d('0x28'),_0x446838+'-'+_0xa41442+'/'+_0x598cd9)[_0x896d('0x22')](_0x34732b);}return null;};}function patchUpdates(_0x235bbc){return function(_0xdf2542){try{jsonpatch[_0x896d('0x29')](_0xdf2542,_0x235bbc,!![]);}catch(_0x4c8264){return BPromise[_0x896d('0x2a')](_0x4c8264);}return _0xdf2542[_0x896d('0x2b')]();};}function saveUpdates(_0x2d550c,_0xcd926){return function(_0x262e6a){if(_0x262e6a){return _0x262e6a['update'](_0x2d550c)['then'](function(_0x1ed355){return _0x1ed355;});}return null;};}function removeEntity(_0x5acbea,_0x49985f){return function(_0x46e762){if(_0x46e762){return _0x46e762['destroy']()['then'](function(){_0x5acbea[_0x896d('0x20')](0xcc)[_0x896d('0x21')]();});}};}function handleEntityNotFound(_0x36a04e,_0x2a58a4){return function(_0x2b3d4){if(!_0x2b3d4){_0x36a04e[_0x896d('0x1f')](0x194);}return _0x2b3d4;};}function handleError(_0x1428a3,_0x5ecab6){_0x5ecab6=_0x5ecab6||0x1f4;return function(_0x390b16){logger[_0x896d('0x2c')](_0x390b16[_0x896d('0x2d')]);if(_0x390b16[_0x896d('0x2e')]){delete _0x390b16['name'];}_0x1428a3[_0x896d('0x20')](_0x5ecab6)[_0x896d('0x2f')](_0x390b16);};}exports[_0x896d('0x30')]=function(_0xc97104,_0x221545){var _0xfb9d38={},_0x469f1f={},_0x4aa97b={'count':0x0,'rows':[]};var _0x5bf090=_['map'](db[_0x896d('0x31')]['rawAttributes'],function(_0xde98cb){return{'name':_0xde98cb[_0x896d('0x32')],'type':_0xde98cb[_0x896d('0x33')][_0x896d('0x34')]};});_0x469f1f['model']=_[_0x896d('0x35')](_0x5bf090,_0x896d('0x2e'));_0x469f1f[_0x896d('0x36')]=_[_0x896d('0x37')](_0xc97104[_0x896d('0x36')]);_0x469f1f[_0x896d('0x38')]=_[_0x896d('0x39')](_0x469f1f[_0x896d('0x3a')],_0x469f1f[_0x896d('0x36')]);_0xfb9d38[_0x896d('0x3b')]=_[_0x896d('0x39')](_0x469f1f[_0x896d('0x3a')],qs[_0x896d('0x3c')](_0xc97104['query'][_0x896d('0x3c')]));_0xfb9d38[_0x896d('0x3b')]=_0xfb9d38['attributes'][_0x896d('0x3d')]?_0xfb9d38[_0x896d('0x3b')]:_0x469f1f[_0x896d('0x3a')];if(!_0xc97104['query']['hasOwnProperty'](_0x896d('0x3e'))){_0xfb9d38[_0x896d('0x24')]=qs[_0x896d('0x24')](_0xc97104['query'][_0x896d('0x24')]);_0xfb9d38[_0x896d('0x26')]=qs[_0x896d('0x26')](_0xc97104[_0x896d('0x36')][_0x896d('0x26')]);}_0xfb9d38[_0x896d('0x3f')]=qs[_0x896d('0x40')](_0xc97104[_0x896d('0x36')][_0x896d('0x40')]);_0xfb9d38['where']=qs['filters'](_['pick'](_0xc97104[_0x896d('0x36')],_0x469f1f[_0x896d('0x38')]),_0x5bf090);if(_0xc97104[_0x896d('0x36')][_0x896d('0x41')]){_0xfb9d38['where']=_['merge'](_0xfb9d38[_0x896d('0x42')],{'$or':_[_0x896d('0x35')](_0x5bf090,function(_0x4f32d7){if(_0x4f32d7['type']!==_0x896d('0x43')){var _0x416180={};_0x416180[_0x4f32d7['name']]={'$like':'%'+_0xc97104[_0x896d('0x36')][_0x896d('0x41')]+'%'};return _0x416180;}})});}_0xfb9d38=_[_0x896d('0x44')]({},_0xfb9d38,_0xc97104[_0x896d('0x45')]);var _0x4419cf={'where':_0xfb9d38[_0x896d('0x42')]};return db['UserProfile']['count'](_0x4419cf)[_0x896d('0x46')](function(_0x698a1d){_0x4aa97b[_0x896d('0x25')]=_0x698a1d;if(_0xc97104['query'][_0x896d('0x47')]){_0xfb9d38['include']=[{'all':!![]}];}return db[_0x896d('0x31')][_0x896d('0x48')](_0xfb9d38);})[_0x896d('0x46')](function(_0x4a4c90){_0x4aa97b[_0x896d('0x49')]=_0x4a4c90;return _0x4aa97b;})[_0x896d('0x46')](respondWithFilteredResult(_0x221545,_0xfb9d38))[_0x896d('0x4a')](handleError(_0x221545,null));};exports['show']=function(_0x209f35,_0x519151){var _0x13bdee={'raw':![],'where':{'id':_0x209f35[_0x896d('0x4b')]['id']}},_0x241685={};_0x241685[_0x896d('0x3a')]=_[_0x896d('0x37')](db[_0x896d('0x31')]['rawAttributes']);_0x241685[_0x896d('0x36')]=_[_0x896d('0x37')](_0x209f35[_0x896d('0x36')]);_0x241685['filters']=_[_0x896d('0x39')](_0x241685['model'],_0x241685[_0x896d('0x36')]);_0x13bdee['attributes']=_[_0x896d('0x39')](_0x241685[_0x896d('0x3a')],qs[_0x896d('0x3c')](_0x209f35[_0x896d('0x36')][_0x896d('0x3c')]));_0x13bdee[_0x896d('0x3b')]=_0x13bdee[_0x896d('0x3b')][_0x896d('0x3d')]?_0x13bdee[_0x896d('0x3b')]:_0x241685[_0x896d('0x3a')];if(_0x209f35[_0x896d('0x36')][_0x896d('0x47')]){_0x13bdee[_0x896d('0x4c')]=[{'all':!![]}];}_0x13bdee=_[_0x896d('0x44')]({},_0x13bdee,_0x209f35[_0x896d('0x45')]);return db['UserProfile'][_0x896d('0x4d')](_0x13bdee)[_0x896d('0x46')](handleEntityNotFound(_0x519151,null))[_0x896d('0x46')](respondWithResult(_0x519151,null))[_0x896d('0x4a')](handleError(_0x519151,null));};exports[_0x896d('0x4e')]=function(_0x46d25c,_0x1a14aa){return db[_0x896d('0x31')][_0x896d('0x4e')](_0x46d25c[_0x896d('0x4f')],{})[_0x896d('0x46')](respondWithResult(_0x1a14aa,0xc9))[_0x896d('0x4a')](handleError(_0x1a14aa,null));};exports[_0x896d('0x50')]=function(_0x16372c,_0x58e5a4){var _0x4c3651={'where':{'id':_0x16372c[_0x896d('0x4b')]['id']}},_0x42a187={};_0x42a187['model']=_[_0x896d('0x37')](db[_0x896d('0x31')][_0x896d('0x51')]);_0x4c3651['attributes']=_[_0x896d('0x39')](_0x42a187[_0x896d('0x3a')],qs['fields'](_0x16372c[_0x896d('0x36')][_0x896d('0x3c')]));_0x4c3651[_0x896d('0x3b')]=_0x4c3651[_0x896d('0x3b')][_0x896d('0x3d')]?_0x4c3651['attributes']:_0x42a187[_0x896d('0x3a')];if(_0x16372c[_0x896d('0x36')][_0x896d('0x47')]){_0x4c3651['include']=[{'all':!![]}];}_0x4c3651=_[_0x896d('0x44')]({},_0x4c3651,_0x16372c[_0x896d('0x45')]);return db[_0x896d('0x31')][_0x896d('0x4d')](_0x4c3651)[_0x896d('0x46')](handleEntityNotFound(_0x58e5a4,null))[_0x896d('0x46')](function(_0x50d040){if(_0x50d040){var _0x7a4d5f=_0x50d040[_0x896d('0x52')]({'plain':!![]});_0x7a4d5f=qs[_0x896d('0x53')](_0x7a4d5f,['id','createdAt',_0x896d('0x54'),'crudPermissions']);_0x16372c[_0x896d('0x4f')]=_[_0x896d('0x53')](_0x16372c[_0x896d('0x4f')],['id',_0x896d('0x55'),_0x896d('0x54')]);return db[_0x896d('0x56')]['transaction'](function(_0x5c47ea){return db[_0x896d('0x31')][_0x896d('0x4e')](_['merge'](_0x7a4d5f,_0x16372c['body']),{'include':_0x16372c['query'][_0x896d('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x5c47ea})['then'](function(_0x2c32ee){var _0x4fce76=_0x2c32ee[_0x896d('0x52')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x16372c[_0x896d('0x4b')]['id']},'raw':!![]})[_0x896d('0x46')](function(_0x2d8f18){if(_0x2d8f18){return BPromise['each'](_0x2d8f18,function(_0x1fae73){return new BPromise(function(_0x23503b,_0x3de1a3){if(_0x1fae73['autoAssociation']===null||_0x1fae73['autoAssociation']===0x1)_0x23503b(null);return db[_0x896d('0x57')][_0x896d('0x48')]({'where':{'sectionId':_0x1fae73['id']},'raw':!![]})[_0x896d('0x46')](function(_0x4fea65){var _0x32f46f=_[_0x896d('0x35')](_0x4fea65,function(_0x3c6f8c){return qs['omit'](_0x3c6f8c,['id',_0x896d('0x55'),_0x896d('0x54'),_0x896d('0x58')]);});_0x23503b(_0x32f46f);})['catch'](function(_0x97d82a){_0x3de1a3(_0x97d82a);});})[_0x896d('0x46')](function(_0xf3bf59){var _0x137acc=qs[_0x896d('0x53')](_0x1fae73,['id',_0x896d('0x55'),_0x896d('0x54')]);_0x137acc[_0x896d('0x59')]=_0x4fce76['id'];if(_0xf3bf59)_0x137acc['Resources']=_0xf3bf59;return _0x137acc;})[_0x896d('0x46')](function(_0x45c153){return db['UserProfileSection'][_0x896d('0x4e')](_0x45c153,{'include':[{'model':db[_0x896d('0x57')],'as':_0x896d('0x5a')}],'raw':!![],'transaction':_0x5c47ea});});})['then'](function(){return _0x4fce76;});}});});});}})['then'](respondWithResult(_0x58e5a4,0xc9))[_0x896d('0x4a')](handleError(_0x58e5a4,null));};exports[_0x896d('0x5b')]=function(_0x3dfff2,_0x5ca1c8){if(_0x3dfff2['body']['id']){delete _0x3dfff2[_0x896d('0x4f')]['id'];}return db[_0x896d('0x31')][_0x896d('0x4d')]({'where':{'id':_0x3dfff2[_0x896d('0x4b')]['id']}})[_0x896d('0x46')](handleEntityNotFound(_0x5ca1c8,null))[_0x896d('0x46')](saveUpdates(_0x3dfff2['body'],null))[_0x896d('0x46')](respondWithResult(_0x5ca1c8,null))[_0x896d('0x4a')](handleError(_0x5ca1c8,null));};exports['destroy']=function(_0x1a37f7,_0x1dee4d){return db[_0x896d('0x31')]['find']({'where':{'id':_0x1a37f7[_0x896d('0x4b')]['id']}})[_0x896d('0x46')](handleEntityNotFound(_0x1dee4d,null))[_0x896d('0x46')](removeEntity(_0x1dee4d,null))[_0x896d('0x4a')](handleError(_0x1dee4d,null));};exports[_0x896d('0x5c')]=function(_0x126c83,_0x5869d2){return db[_0x896d('0x31')][_0x896d('0x5c')]()[_0x896d('0x46')](respondWithResult(_0x5869d2,null))['catch'](handleError(_0x5869d2,null));};exports[_0x896d('0x5d')]=function(_0x3bf464,_0x33facf){var _0x3da584=_0x3bf464[_0x896d('0x4f')];return db[_0x896d('0x31')][_0x896d('0x4d')]({'where':{'id':_0x3bf464[_0x896d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33facf,null))[_0x896d('0x46')](function(_0x35eac9){if(_0x35eac9){return db[_0x896d('0x56')]['transaction'](function(_0x417cfe){return db[_0x896d('0x5e')][_0x896d('0x5f')]({'where':{'userProfileId':_0x3bf464['params']['id'],'sectionId':_[_0x896d('0x35')](_0x3da584,function(_0x3029e7){return _0x3029e7[_0x896d('0x58')];})},'transaction':_0x417cfe})[_0x896d('0x46')](function(){var _0x2cf00e=_['map'](_0x3da584,function(_0x21d48d){_0x21d48d['userProfileId']=_0x3bf464[_0x896d('0x4b')]['id'];return _0x21d48d;});var _0x30eaa6=[];return BPromise[_0x896d('0x60')](_0x2cf00e,function(_0x580562){return db[_0x896d('0x5e')][_0x896d('0x4e')](_0x580562,{'include':[{'model':db['UserProfileResource'],'as':_0x896d('0x5a')}],'raw':!![],'transaction':_0x417cfe})[_0x896d('0x46')](function(_0x5cc826){_0x30eaa6[_0x896d('0x61')](_0x5cc826[_0x896d('0x52')]({'plain':!![]}));});})[_0x896d('0x46')](function(){return _0x30eaa6;});});});}})['then'](function(_0x2a668f){return _0x2a668f;})['then'](respondWithResult(_0x33facf,null))[_0x896d('0x4a')](handleError(_0x33facf,null));};exports[_0x896d('0x62')]=function(_0x98243d,_0x5d356a){var _0x523d97;return db[_0x896d('0x31')][_0x896d('0x4d')]({'where':{'id':_0x98243d[_0x896d('0x4b')]['id']},'attributes':['id',_0x896d('0x2e')]})[_0x896d('0x46')](handleEntityNotFound(_0x5d356a,null))[_0x896d('0x46')](function(_0x4fba9a){if(_0x4fba9a){_0x523d97=_0x4fba9a;return db[_0x896d('0x5e')][_0x896d('0x5f')]({'where':{'userProfileId':_0x98243d[_0x896d('0x4b')]['id'],'sectionId':_0x98243d['query'][_0x896d('0x63')]}});}})[_0x896d('0x46')](function(){return _0x523d97;})[_0x896d('0x46')](respondWithStatusCode(_0x5d356a,null))['catch'](handleError(_0x5d356a,null));};exports[_0x896d('0x64')]=function(_0x12cbb5,_0x2296d4){var _0x3185c1=[];var _0x399962=[];return db[_0x896d('0x5e')][_0x896d('0x48')]({'where':{'userProfileId':_0x12cbb5['params']['id']},'raw':!![]})[_0x896d('0x46')](function(_0x2e448a){_0x3185c1=_[_0x896d('0x41')](_0x2e448a,function(_0x37b0d7){return _0x37b0d7[_0x896d('0x65')]===0x1||_[_0x896d('0x66')]([0x3eb,0x709],_0x37b0d7[_0x896d('0x58')]);});if(!_[_0x896d('0x67')](_0x3185c1)){return _[_0x896d('0x35')](_0x3185c1,function(_0x252eca){return _0x252eca['sectionId'];});}else{return;}})[_0x896d('0x46')](function(_0x539407){if(_0x539407)_0x399962=_0x539407;if(_[_0x896d('0x66')](_0x399962,0x64)){var _0x59bca2=_[_0x896d('0x4d')](_0x3185c1,{'sectionId':0x64});return hasDefaultDashboard(_0x59bca2)[_0x896d('0x46')](function(_0x915ea7){return _['map'](_0x3185c1,function(_0x2c9792){if(_0x2c9792[_0x896d('0x58')]===0x64){_0x2c9792['subsections']=_0x915ea7;}return _0x2c9792;});});}else{return;}})['then'](function(_0x167b16){if(_0x167b16)_0x3185c1=_0x167b16;if(_[_0x896d('0x66')](_0x399962,0x3eb)){var _0x2aa49c=_[_0x896d('0x4d')](_0x3185c1,{'sectionId':0x3eb});return getCustomDashboards(_0x2aa49c)[_0x896d('0x46')](function(_0x276c79){return _[_0x896d('0x35')](_0x3185c1,function(_0x224827){if(_0x2aa49c[_0x896d('0x65')]){if(_0x224827[_0x896d('0x58')]===0x3eb){_0x224827[_0x896d('0x68')]=_0x276c79;}}else{if(_0x224827['sectionId']===0x64){_0x224827['subsections']=_0x276c79;}}return _0x224827;});});}else{return;}})[_0x896d('0x46')](function(_0x134c94){if(_0x134c94)_0x3185c1=_0x134c94;if(_['includes'](_0x399962,0x709)){var _0x484499=_['find'](_0x3185c1,{'sectionId':0x709});return getPlugins(_0x484499)['then'](function(_0x927b11){if(_0x484499['enabled']){return _[_0x896d('0x35')](_0x3185c1,function(_0x412dc8){if(_0x412dc8[_0x896d('0x58')]===0x709){_0x412dc8['subsections']=_0x927b11;}return _0x412dc8;});}else{var _0xe15c3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x927b11};var _0x2e0912=_[_0x896d('0x35')](_0x3185c1);_0x2e0912[_0x896d('0x61')](_0xe15c3);return _0x2e0912;}});}else{return;}})[_0x896d('0x46')](function(_0x7f003a){if(_0x7f003a)_0x3185c1=_0x7f003a;return _[_0x896d('0x41')](_0x3185c1,[_0x896d('0x65'),0x1]);})[_0x896d('0x46')](respondWithResult(_0x2296d4,null))[_0x896d('0x4a')](handleError(_0x2296d4,null));};function hasDefaultDashboard(_0x984fa7){var _0x555714=[0x65];return new BPromise(function(_0x59d980,_0x35b9df){try{if(_0x984fa7['autoAssociation']){_0x59d980(_0x555714);}else{return db['UserProfileResource'][_0x896d('0x69')]({'where':{'sectionId':_0x984fa7['id']},'raw':!![]})['then'](function(_0x112981){_0x112981?_0x59d980(_0x555714):_0x59d980();});}}catch(_0x50524e){_0x35b9df(_0x50524e);}});}function getCustomDashboards(_0x3188e4){var _0x291b16=[];return new BPromise(function(_0xc5d2d1,_0x32933e){try{if(_0x3188e4['autoAssociation']){return db[_0x896d('0x6a')]['findAll']({'raw':!![]})[_0x896d('0x46')](function(_0x576240){_0x576240[_0x896d('0x6b')](function(_0x9e8272){_0x291b16[_0x896d('0x61')](_0x9e8272['id']+0x1869f);});_0xc5d2d1(_0x291b16);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3188e4['id']},'raw':!![]})[_0x896d('0x46')](function(_0x3fd8b7){_0x3fd8b7[_0x896d('0x6b')](function(_0x11c658){_0x291b16[_0x896d('0x61')](_0x11c658[_0x896d('0x6c')]+0x1869f);});_0xc5d2d1(_0x291b16);});}}catch(_0x218c64){_0x32933e(_0x218c64);}});}function getPlugins(_0x2b80cc){var _0x5220ce=[];return new BPromise(function(_0xeebbb6,_0x47679e){try{if(_0x2b80cc[_0x896d('0x6d')]){return db[_0x896d('0x6e')]['findAll']({'raw':!![]})['then'](function(_0x56659e){_0x56659e[_0x896d('0x6b')](function(_0x17cfd5){_0x5220ce[_0x896d('0x61')](_0x17cfd5['id']+0x15b38);});_0xeebbb6(_0x5220ce);});}else{return db['UserProfileResource'][_0x896d('0x48')]({'where':{'sectionId':_0x2b80cc['id']},'raw':!![]})[_0x896d('0x46')](function(_0x3c2265){_0x3c2265[_0x896d('0x6b')](function(_0x50ff46){_0x5220ce[_0x896d('0x61')](_0x50ff46[_0x896d('0x6c')]+0x15b38);});_0xeebbb6(_0x5220ce);});}}catch(_0x3e4d7c){_0x47679e(_0x3e4d7c);}});}exports[_0x896d('0x6f')]=function(_0x3e9c43,_0x357b00){return db['UserProfile']['find']({'where':{'id':_0x3e9c43[_0x896d('0x4b')]['id']}})[_0x896d('0x46')](handleEntityNotFound(_0x357b00,null))[_0x896d('0x46')](function(_0x34ac88){if(_0x34ac88){return db[_0x896d('0x56')]['transaction'](function(_0x1753bd){return db['UserProfileSection'][_0x896d('0x48')]({'where':{'userProfileId':_0x3e9c43['params']['id']},'attributes':['id'],'raw':!![]})[_0x896d('0x46')](function(_0x4c8f24){if(_0x4c8f24){return db[_0x896d('0x5e')][_0x896d('0x5f')]({'where':{'userProfileId':_0x3e9c43[_0x896d('0x4b')]['id'],'id':_[_0x896d('0x35')](_0x4c8f24,function(_0x482aef){return _0x482aef['id'];})},'transaction':_0x1753bd});}})[_0x896d('0x46')](function(_0x3e0e93){var _0x361c53=_[_0x896d('0x35')](_0x3e9c43[_0x896d('0x4f')],function(_0x421f85){_0x421f85['userProfileId']=_0x3e9c43[_0x896d('0x4b')]['id'];return _0x421f85;});return db[_0x896d('0x5e')]['bulkCreate'](_0x361c53,{'raw':!![],'transaction':_0x1753bd});})['then'](function(_0x1f810b){var _0x107562=_['filter'](_['map'](_0x1f810b,function(_0x390a67){return _0x390a67['get']({'plain':!![]});}),{'includeAll':![]});if(_0x107562){return db[_0x896d('0x5e')]['findAll']({'where':{'userProfileId':_0x3e9c43[_0x896d('0x4b')]['id'],'sectionId':_[_0x896d('0x35')](_0x107562,function(_0x2499bf){return _0x2499bf[_0x896d('0x58')];})},'attributes':['id',_0x896d('0x58')],'raw':!![]})[_0x896d('0x46')](function(_0x2ef50a){var _0x1db74c=_['map'](_0x3e9c43[_0x896d('0x4f')],function(_0x1bbf89){_0x1bbf89[_0x896d('0x59')]=_0x3e9c43[_0x896d('0x4b')]['id'];return _0x1bbf89;});return db[_0x896d('0x57')][_0x896d('0x70')](_0x1db74c,{'raw':!![],'transaction':_0x1753bd});});}})[_0x896d('0x4a')](handleError(_0x357b00,null));});}})['then'](function(_0x4f0636){var _0x20e882=_['map'](_0x4f0636,function(_0x17c39b){return _0x17c39b['get']({'plain':!![]});});})[_0x896d('0x46')](respondWithResult(_0x357b00,null))[_0x896d('0x4a')](handleError(_0x357b00,null));};exports[_0x896d('0x71')]=function(_0x36cbd8,_0xa22e50,_0x255926){return db[_0x896d('0x31')]['find']({'where':{'id':_0x36cbd8[_0x896d('0x4b')]['id']}})[_0x896d('0x46')](handleEntityNotFound(_0xa22e50,null))[_0x896d('0x46')](function(_0x589ba2){if(_0x589ba2){return _0x589ba2[_0x896d('0x71')](_0x36cbd8[_0x896d('0x36')][_0x896d('0x63')]);}})[_0x896d('0x46')](respondWithStatusCode(_0xa22e50,null))[_0x896d('0x4a')](handleError(_0xa22e50,null));};exports['getResources']=function(_0x12d0e7,_0x1849ab){var _0x4231e9={};if(!_0x12d0e7['query'][_0x896d('0x72')])throw new Error(_0x896d('0x73'));if(!_0x12d0e7['query'][_0x896d('0x74')](_0x896d('0x3e'))){_0x4231e9['limit']=qs[_0x896d('0x24')](_0x12d0e7['query'][_0x896d('0x24')]);_0x4231e9[_0x896d('0x26')]=qs[_0x896d('0x26')](_0x12d0e7[_0x896d('0x36')][_0x896d('0x26')]);}return db['UserProfile'][_0x896d('0x4d')]({'where':{'id':_0x12d0e7[_0x896d('0x4b')]['id']}})['then'](function(_0xf75441){if(!_0xf75441)throw new Error(_0x896d('0x75')+_0x12d0e7[_0x896d('0x4b')]['id']);return db[_0x896d('0x31')][_0x896d('0x76')](_0x12d0e7);})[_0x896d('0x46')](respondWithFilteredResult(_0x1849ab,_0x4231e9))[_0x896d('0x4a')](handleError(_0x1849ab,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index cf7a3a5..f152c73 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 _0x002d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','update','remove'];(function(_0xc77c92,_0x8a9f1){var _0x51319b=function(_0x45b041){while(--_0x45b041){_0xc77c92['push'](_0xc77c92['shift']());}};_0x51319b(++_0x8a9f1);}(_0x002d,0xca));var _0xd002=function(_0x46d21b,_0x24dd6c){_0x46d21b=_0x46d21b-0x0;var _0x138301=_0x002d[_0x46d21b];return _0x138301;};'use strict';var EventEmitter=require(_0xd002('0x0'));var UserProfile=require(_0xd002('0x1'))['db'][_0xd002('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd002('0x3'),'afterDestroy':_0xd002('0x4')};function emitEvent(_0x1c0d0a){return function(_0x24ff42,_0x1323f0,_0x179915){UserProfileEvents[_0xd002('0x5')](_0x1c0d0a+':'+_0x24ff42['id'],_0x24ff42);UserProfileEvents[_0xd002('0x5')](_0x1c0d0a,_0x24ff42);_0x179915(null);};}for(var e in events){if(events[_0xd002('0x6')](e)){var event=events[e];UserProfile[_0xd002('0x7')](e,emitEvent(event));}}module[_0xd002('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x0a1c=['UserProfile','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x429215,_0x5ba5cc){var _0x1b2a6e=function(_0x39dcc8){while(--_0x39dcc8){_0x429215['push'](_0x429215['shift']());}};_0x1b2a6e(++_0x5ba5cc);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x0a1c[_0x152136];return _0x20df44;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0xc0a1('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc0a1('0x1')](0x0);var events={'afterCreate':_0xc0a1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e1b0a){return function(_0x411ce9,_0x108afd,_0x1df4bf){UserProfileEvents[_0xc0a1('0x3')](_0x3e1b0a+':'+_0x411ce9['id'],_0x411ce9);UserProfileEvents[_0xc0a1('0x3')](_0x3e1b0a,_0x411ce9);_0x1df4bf(null);};}for(var e in events){if(events[_0xc0a1('0x4')](e)){var event=events[e];UserProfile[_0xc0a1('0x5')](e,emitEvent(event));}}module[_0xc0a1('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c17222c..e89e3e3 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 _0x1967=['rows','Tags','color','ThroughTags','tag','openTabs','true','sms','dataValues','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','value','catch','resolve','UserProfileResource','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','name','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','voicequeues','queuecampaigns','users','agents','telephones','Users','user','ZendeskAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','Plugin','extractedreports','AnalyticExtractedReport','Reports','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','model','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','sort','merge','key','VIRTUAL','foreignKey','length','forEach','options','autoAssociation','includeAll','include','default','reportId','DefaultReports','custom','CustomReports','count'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1967,0x173));var _0x7196=function(_0x15063b,_0x59984a){_0x15063b=_0x15063b-0x0;var _0x5d8cdd=_0x1967[_0x15063b];return _0x5d8cdd;};'use strict';var _=require('lodash');var attributes=require(_0x7196('0x0'));var qs=require(_0x7196('0x1'));var squel=require(_0x7196('0x2'));module[_0x7196('0x3')]=function(_0x3319fa){var _0xa80a3f=_0x3319fa[_0x7196('0x4')];function _0x1aaddd(_0x458ae8,_0x3ae43f){return new Promise(function(_0x5c128f,_0x36b01e){if(!_0x3ae43f)return _0x5c128f(null);var _0x186175=_0x3ae43f[_0x7196('0x5')]?{[_0x3ae43f[_0x7196('0x5')][_0x7196('0x6')]]:_0x3ae43f[_0x7196('0x5')]['value']}:undefined;return _0xa80a3f[_0x458ae8][_0x7196('0x7')]({'where':_0x186175,'raw':!![]})[_0x7196('0x8')](function(_0x3f846e){_0x3ae43f[_0x7196('0x9')]=_[_0x7196('0xa')](_0x3f846e,'id');_0x5c128f(_0x3ae43f);})['catch'](function(_0x49e5fb){_0x36b01e(_0x49e5fb);});});}function _0x2028dd(_0x10459b,_0x97bbff){return new Promise(function(_0x107759,_0x25b780){var _0x46f26c=_0x10459b[_0x7196('0x5')]?{[_0x10459b[_0x7196('0x5')][_0x7196('0x6')]]:_0x10459b[_0x7196('0x5')][_0x7196('0xb')]}:undefined;return _0xa80a3f[_0x10459b['model']][_0x7196('0x7')]({'where':_0x46f26c,'raw':!![]})[_0x7196('0x8')](function(_0x3545aa){_0x97bbff[_0x7196('0x9')]=_['map'](_0x3545aa,function(_0x31c778){return _0x31c778['name'];});_0x107759(_0x97bbff);})[_0x7196('0xc')](function(_0x2590a6){_0x25b780(_0x2590a6);});});}function _0xf7e97(_0x3ed1ad,_0x12dce7,_0x2e3e0e){if(!_0x12dce7)return Promise[_0x7196('0xd')](null);return new Promise(function(_0x1ed296,_0x3e4e69){return _0xa80a3f[_0x7196('0xe')][_0x7196('0x7')]({'where':{'sectionId':_0x12dce7['id']},'raw':!![]})['then'](function(_0x4c4f91){if(_0x3ed1ad[_0x7196('0x6')]&&_0x3ed1ad[_0x7196('0x6')]!=='id'){_0x12dce7[_0x7196('0x9')]=_['map'](_0x4c4f91,function(_0x39b944){return _0x39b944[_0x3ed1ad['field']];});}else{if(_0x2e3e0e==='AnalyticExtractedReport'){_0x12dce7[_0x7196('0x9')]=_[_0x7196('0xa')](_0x4c4f91,function(_0x8dee9d){return{'id':_0x8dee9d['resourceId'],'type':_0x8dee9d['type']};});}else{_0x12dce7[_0x7196('0x9')]=_[_0x7196('0xa')](_0x4c4f91,function(_0x598a26){return _0x598a26[_0x7196('0xf')];});}}_0x1ed296(_0x12dce7);})[_0x7196('0xc')](function(_0x6e22e5){_0x3e4e69(_0x6e22e5);});});}function _0x18d389(_0x38b3d6,_0x549f34){var _0x3f8178={'parentSections':[]};switch(_0x38b3d6['toLowerCase']()){case _0x7196('0x10'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x12');break;case _0x7196('0x13'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x14');break;case'squarerecordings':_0x3f8178['childModel']=_0x7196('0x15');_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x7196('0x18'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x19');break;case'contacts':_0x3f8178[_0x7196('0x11')]='CmContact';_0x3f8178[_0x7196('0x16')]=[{'name':'Lists','field':'id','foreignKey':_0x7196('0x1a')}];break;case _0x7196('0x1b'):_0x3f8178[_0x7196('0x11')]='CmList';break;case _0x7196('0x1c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x1d');break;case _0x7196('0x1e'):_0x3f8178['childModel']=_0x7196('0x1f');break;case _0x7196('0x20'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x21');break;case _0x7196('0x22'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x23');break;case _0x7196('0x24'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x25');break;case _0x7196('0x26'):_0x3f8178['childModel']=_0x7196('0x27');break;case'inboundroutes':case _0x7196('0x28'):case'outboundroutes':_0x3f8178[_0x7196('0x11')]=_0x7196('0x29');break;case'contexts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x2a');break;case _0x7196('0x2b'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x2c');break;case'voicerecordings':_0x3f8178[_0x7196('0x11')]=_0x7196('0x2d');_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x2e'),'field':_0x7196('0x2f'),'foreignKey':_0x7196('0x30'),'model':'User','filter':{'field':_0x7196('0x31'),'value':[_0x7196('0x32')]}},{'name':_0x7196('0x33'),'field':'name','foreignKey':_0x7196('0x30'),'model':_0x7196('0x34'),'filter':{'field':_0x7196('0x31'),'value':[_0x7196('0x35')]}},{'name':_0x7196('0x36'),'field':_0x7196('0x2f'),'foreignKey':_0x7196('0x37'),'model':_0x7196('0x38'),'filter':{'field':_0x7196('0x39'),'value':[_0x7196('0x3a')]}},{'name':'QueueCampaigns','field':_0x7196('0x2f'),'foreignKey':_0x7196('0x37'),'model':'VoiceQueue','filter':{'field':_0x7196('0x39'),'value':['outbound']}}];break;case'musiconholds':_0x3f8178[_0x7196('0x11')]=_0x7196('0x3b');break;case'chanspies':_0x3f8178['childModel']=_0x7196('0x3c');break;case _0x7196('0x3d'):_0x3f8178[_0x7196('0x11')]='VoicePrefix';break;case _0x7196('0x3e'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x3f');break;case _0x7196('0x40'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x41');break;case _0x7196('0x42'):_0x3f8178[_0x7196('0x11')]='MailAccount';break;case _0x7196('0x43'):_0x3f8178[_0x7196('0x11')]='MailSubstatus';break;case _0x7196('0x44'):_0x3f8178[_0x7196('0x11')]='OpenchannelQueue';break;case _0x7196('0x45'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x46');break;case'smsqueues':_0x3f8178[_0x7196('0x11')]=_0x7196('0x47');break;case'smsaccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x48');break;case'whatsappqueues':_0x3f8178[_0x7196('0x11')]='WhatsappQueue';break;case'whatsappaccounts':_0x3f8178['childModel']='WhatsappAccount';break;case'teams':_0x3f8178[_0x7196('0x11')]='Team';break;case _0x7196('0x49'):case _0x7196('0x4a'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x38');if(_0x549f34){_0x3f8178['parentSections']=[{'name':_0x7196('0x36')},{'name':'QueueCampaigns'}];}break;case _0x7196('0x4b'):case _0x7196('0x4c'):case _0x7196('0x4d'):_0x3f8178['childModel']=_0x7196('0x34');if(_0x549f34){_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x4e'),'filter':{'field':'role','value':['admin',_0x7196('0x4f')]},'ignore':!![]},{'name':'Agents'},{'name':_0x7196('0x33')}];}break;case'zendeskaccounts':_0x3f8178['childModel']=_0x7196('0x50');break;case'salesforceaccounts':_0x3f8178['childModel']='SalesforceAccount';break;case _0x7196('0x51'):_0x3f8178['childModel']='FreshdeskAccount';break;case _0x7196('0x52'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x53');break;case _0x7196('0x54'):_0x3f8178['childModel']=_0x7196('0x55');break;case'zohoaccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x56');break;case'vtigeraccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x34');break;case _0x7196('0x57'):_0x3f8178['childModel']=_0x7196('0x58');break;case'dispositions':_0x3f8178[_0x7196('0x11')]=_0x7196('0x59');break;case _0x7196('0x5a'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x5b');break;case _0x7196('0x5c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x5d');break;case'pauses':_0x3f8178['childModel']=_0x7196('0x5e');break;case _0x7196('0x5f'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x60');break;case'sounds':_0x3f8178[_0x7196('0x11')]=_0x7196('0x61');break;case _0x7196('0x62'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x63');break;case _0x7196('0x64'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x65');break;case _0x7196('0x66'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x67');break;case'trunks':_0x3f8178[_0x7196('0x11')]=_0x7196('0x68');break;case _0x7196('0x69'):_0x3f8178['childModel']=_0x7196('0x6a');break;case'plugins':_0x3f8178[_0x7196('0x11')]=_0x7196('0x6b');break;case _0x7196('0x6c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x6d');_0x3f8178['parentSections']=[{'name':_0x7196('0x6e'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x3f8178['childModel']=_0x7196('0x6f');break;}return _0x3f8178;}function _0x3be180(_0x20d306,_0x35f342){var _0x105a3f=_0x20d306[_0x7196('0x70')](0x0)[_0x7196('0x71')]()+_0x20d306['slice'](0x1);var _0x293467={'type':_0xa80a3f[_0x7196('0x72')][_0x7196('0x73')][_0x7196('0x74')],'raw':!![]};return new Promise(function(_0x196f12,_0x5ef1eb){var _0x49282d=squel[_0x7196('0x75')]()[_0x7196('0x6')](_0x7196('0x76')+_0x105a3f+_0x7196('0x77'),'id')[_0x7196('0x6')](_0x7196('0x78'))[_0x7196('0x79')](_0x7196('0x7a')+_0x20d306+_0x7196('0x7b'),'ui')[_0x7196('0x7c')](_0x7196('0x7d'),_0x35f342['id']);return _0xa80a3f['sequelize'][_0x7196('0x7e')](_0x49282d[_0x7196('0x7f')](),_0x293467)[_0x7196('0x8')](function(_0x33f43b){_0x35f342[_0x105a3f+'OpenTabs']=_0x33f43b;_0x196f12(_0x33f43b);})[_0x7196('0xc')](function(_0x204c3a){_0x5ef1eb(_0x204c3a);});});}return _0x3319fa[_0x7196('0x80')](_0x7196('0x81'),attributes,{'tableName':_0x7196('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3c3d64){var _0x1d9e75={'raw':![],'where':{}};var _0x559b68={};var _0x7a12d8={'count':0x0,'rows':[]};var _0x2c5cba=_0x3c3d64[_0x7196('0x7e')][_0x7196('0x83')];var _0x52827f=_0x3c3d64[_0x7196('0x7e')][_0x7196('0x84')]||![];var _0x10f376=_0x18d389(_0x2c5cba,_0x52827f);if(!_0x10f376[_0x7196('0x11')])throw new Error(_0x7196('0x85')+_0x2c5cba+'\x27');var _0x37c6be=[{'name':_0x2c5cba}];if(!_[_0x7196('0x86')](_0x10f376['parentSections']))_0x37c6be=_0x10f376['parentSections'];var _0x56955e=[];for(var _0x72f6f1=0x0;_0x72f6f1<_0x37c6be['length'];_0x72f6f1++){_0x56955e[_0x7196('0x87')](_0xa80a3f[_0x7196('0x88')][_0x7196('0x89')]({'where':{'userProfileId':_0x3c3d64[_0x7196('0x8a')]['id'],'name':_0x37c6be[_0x72f6f1][_0x7196('0x2f')]},'raw':!![]}));}return Promise[_0x7196('0x8b')](_0x56955e)[_0x7196('0x8')](function(_0x71dc04){var _0x3881a5=_['filter'](_0x71dc04,function(_0x5c001a){return _0x5c001a?_0x5c001a:undefined;});var _0x4542c1=_[_0x7196('0x5')](_0x37c6be,[_0x7196('0x8c'),!![]]);var _0x2904a6=_[_0x7196('0x86')](_0x3881a5)&&_[_0x7196('0x86')](_0x4542c1)?null:_[_0x7196('0x8d')](_0x4542c1,_0x3881a5);if(!_0x2904a6)return null;var _0x2f36f8=[];for(var _0x4cc5e3=0x0;_0x4cc5e3<_0x2904a6['length'];_0x4cc5e3++){var _0x1a736a=_['find'](_0x37c6be,function(_0x30d114){return _0x2904a6[_0x4cc5e3]?_0x30d114['name']===_0x2904a6[_0x4cc5e3][_0x7196('0x2f')]:null;});if(_0x1a736a){if(_0x2904a6[_0x4cc5e3][_0x7196('0x8c')]){_0x2f36f8[_0x7196('0x87')](_0x1aaddd(_0x10f376[_0x7196('0x11')],_0x2904a6[_0x4cc5e3]));}else{if(!_0x2904a6[_0x4cc5e3]['autoAssociation']){_0x2f36f8['push'](_0xf7e97(_0x1a736a,_0x2904a6[_0x4cc5e3],_0x10f376[_0x7196('0x11')]));}else{if(_0x1a736a['model']){_0x2f36f8[_0x7196('0x87')](_0x2028dd(_0x1a736a,_0x2904a6[_0x4cc5e3]));}}}}}return Promise[_0x7196('0x8b')](_0x2f36f8);})[_0x7196('0x8')](function(_0x38c1b3){var _0xd4c784=_0x38c1b3;var _0x1af971=null;if(_0xd4c784){_0x1af971=_0xd4c784['length']===0x1?_0xd4c784[0x0]:null;}if(!_0x1af971&&!_0xd4c784)return _0x7a12d8;var _0x3128e6=_0xa80a3f[_0x10f376[_0x7196('0x11')]][_0x7196('0x8e')];_0x559b68[_0x7196('0x8f')]=_[_0x7196('0x90')](_0x3128e6);_0x559b68[_0x7196('0x7e')]=_[_0x7196('0x90')](_0x3c3d64[_0x7196('0x7e')]);_0x559b68[_0x7196('0x91')]=_[_0x7196('0x92')](_0x559b68[_0x7196('0x8f')],_0x559b68[_0x7196('0x7e')]);_0x1d9e75['attributes']=_[_0x7196('0x92')](_0x559b68[_0x7196('0x8f')],qs['fields'](_0x3c3d64['query'][_0x7196('0x93')]));_0x1d9e75[_0x7196('0x94')]=_0x1d9e75[_0x7196('0x94')]['length']?_0x1d9e75[_0x7196('0x94')]:_0x559b68['model'];if(!_0x3c3d64[_0x7196('0x7e')][_0x7196('0x95')]('nolimit')){_0x1d9e75[_0x7196('0x96')]=qs['limit'](_0x3c3d64['query'][_0x7196('0x96')]);_0x1d9e75[_0x7196('0x97')]=qs[_0x7196('0x97')](_0x3c3d64['query'][_0x7196('0x97')]);}_0x1d9e75['order']=qs[_0x7196('0x98')](_0x3c3d64[_0x7196('0x7e')][_0x7196('0x98')]);_0x1d9e75[_0x7196('0x7c')]=qs[_0x7196('0x91')](_['pick'](_0x3c3d64[_0x7196('0x7e')],_0x559b68[_0x7196('0x91')]));if(_0x3c3d64[_0x7196('0x7e')][_0x7196('0x5')]){_0x1d9e75[_0x7196('0x7c')]=_[_0x7196('0x99')](_0x1d9e75[_0x7196('0x7c')],{'$or':_[_0x7196('0xa')](_0x3128e6,function(_0x544630){if(_0x544630[_0x7196('0x39')][_0x7196('0x9a')]!==_0x7196('0x9b')){var _0x2b899d={};_0x2b899d[_0x544630['field']]={'$like':'%'+_0x3c3d64[_0x7196('0x7e')][_0x7196('0x5')]+'%'};return _0x2b899d;}})});}var _0x4fe2cb=[];var _0x2e4807=null;var _0x53d470={};if(_0x1af971){_0x2e4807=_[_0x7196('0x89')](_0x37c6be,['name',_0x1af971[_0x7196('0x2f')]]);if(_0x2e4807[_0x7196('0x6')]){_0x53d470={};if(_0x10f376['childModel']===_0x7196('0x6d')){_0x53d470[_0x2e4807[_0x7196('0x9c')]]=_[_0x7196('0xa')](_0x1af971['associatedResources'],'id');}else{_0x53d470[_0x2e4807['foreignKey']]=_0x1af971[_0x7196('0x9')];}_0x4fe2cb['push'](_0x53d470);}else{_0x1d9e75['where']['id']=_0x1af971[_0x7196('0x9')];}}else{for(var _0x72c765=0x0;_0x72c765<_0xd4c784[_0x7196('0x9d')];_0x72c765++){_0x2e4807=_['find'](_0x37c6be,[_0x7196('0x2f'),_0xd4c784[_0x72c765][_0x7196('0x2f')]]);if(_0x2e4807[_0x7196('0x6')]){_0x53d470={};_0x53d470[_0x2e4807[_0x7196('0x9c')]]=_0xd4c784[_0x72c765][_0x7196('0x9')];_0x4fe2cb[_0x7196('0x87')](_0x53d470);}else{if(!_0x1d9e75[_0x7196('0x7c')]['id'])_0x1d9e75[_0x7196('0x7c')]['id']=[];_0xd4c784[_0x72c765][_0x7196('0x9')][_0x7196('0x9e')](function(_0x173fe5){_0x1d9e75['where']['id']['push'](_0x173fe5);});}}}if(!_[_0x7196('0x86')](_0x4fe2cb)){_0x1d9e75['where']=_['merge'](_0x1d9e75[_0x7196('0x7c')],{'$and':{'$or':_0x4fe2cb}});}_0x1d9e75=_[_0x7196('0x99')]({},_0x1d9e75,_0x3c3d64[_0x7196('0x9f')]);if(_0x1af971&&!_0x1af971[_0x7196('0xa0')]&&_0x10f376['childModel']==='AnalyticExtractedReport'){if(_0x3c3d64[_0x7196('0x7e')][_0x7196('0xa1')]){_0x1d9e75[_0x7196('0xa2')]=[{'all':!![]}];}return _0xa80a3f[_0x10f376[_0x7196('0x11')]]['findAll'](_0x1d9e75)[_0x7196('0x8')](function(_0x4afbee){var _0x4e8ba8=[];_0x4afbee[_0x7196('0x9e')](function(_0x884d80){var _0x1e14da;switch(_0x884d80['reportType']){case _0x7196('0xa3'):_0x1e14da=_[_0x7196('0x89')](_0x1af971[_0x7196('0x9')],function(_0x30c54b){return _0x30c54b['id']===_0x884d80[_0x7196('0xa4')]&&_0x30c54b[_0x7196('0x39')]===_0x7196('0xa5');});break;case _0x7196('0xa6'):_0x1e14da=_['find'](_0x1af971[_0x7196('0x9')],function(_0x2479b9){return _0x2479b9['id']===_0x884d80[_0x7196('0xa4')]&&_0x2479b9[_0x7196('0x39')]===_0x7196('0xa7');});break;}if(_0x1e14da)_0x4e8ba8['push'](_0x884d80);});_0x7a12d8[_0x7196('0xa8')]=_0x4e8ba8[_0x7196('0x9d')];_0x7a12d8[_0x7196('0xa9')]=_0x4e8ba8;return _0x7a12d8;});}else{return _0xa80a3f[_0x10f376['childModel']][_0x7196('0xa8')]({'where':_0x1d9e75['where']})['then'](function(_0x1dcf93){_0x7a12d8[_0x7196('0xa8')]=_0x1dcf93;if(_0x3c3d64['query'][_0x7196('0xa1')]){if(_0x10f376[_0x7196('0x11')]==='CmContact'){_0x1d9e75[_0x7196('0xa2')]=[{'model':_0xa80a3f[_0x7196('0x63')],'as':_0x7196('0xaa'),'attributes':['id',_0x7196('0x2f'),_0x7196('0xab')],'required':_0x3c3d64[_0x7196('0x7e')]['tag']?!![]:![]},{'model':_0xa80a3f[_0x7196('0x63')],'as':_0x7196('0xac'),'attributes':['id',_0x7196('0x2f'),'color'],'through':_0x3c3d64['query']['tag']?{'attributes':[],'where':{'TagId':_0x3c3d64[_0x7196('0x7e')][_0x7196('0xad')]||undefined}}:{},'required':_0x3c3d64[_0x7196('0x7e')]['tag']?!![]:![]}];}else{_0x1d9e75[_0x7196('0xa2')]=[{'all':!![]}];}}return _0xa80a3f[_0x10f376['childModel']][_0x7196('0x7')](_0x1d9e75);})['then'](function(_0x389b5b){_0x7a12d8[_0x7196('0xa9')]=_0x389b5b;if(_0x2c5cba===_0x7196('0x2e')&&_0x3c3d64[_0x7196('0x7e')][_0x7196('0xae')]===_0x7196('0xaf')){var _0x43e7d5=[];for(var _0x48608b=0x0;_0x48608b<_0x7a12d8[_0x7196('0xa9')]['length'];_0x48608b++){_0x43e7d5['push'](_0x3be180('chat',_0x7a12d8['rows'][_0x48608b]['dataValues']));_0x43e7d5[_0x7196('0x87')](_0x3be180(_0x7196('0xb0'),_0x7a12d8[_0x7196('0xa9')][_0x48608b]['dataValues']));_0x43e7d5[_0x7196('0x87')](_0x3be180('fax',_0x7a12d8['rows'][_0x48608b]['dataValues']));_0x43e7d5[_0x7196('0x87')](_0x3be180('mail',_0x7a12d8[_0x7196('0xa9')][_0x48608b][_0x7196('0xb1')]));_0x43e7d5[_0x7196('0x87')](_0x3be180(_0x7196('0xb2'),_0x7a12d8[_0x7196('0xa9')][_0x48608b][_0x7196('0xb1')]));_0x43e7d5[_0x7196('0x87')](_0x3be180(_0x7196('0xb3'),_0x7a12d8['rows'][_0x48608b][_0x7196('0xb1')]));}return Promise[_0x7196('0x8b')](_0x43e7d5)[_0x7196('0x8')](function(){return _0x7a12d8;});}return _0x7a12d8;});}});}}});}; \ No newline at end of file +var _0xd046=['OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','Template','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','query','toString','OpenTabs','UserProfile','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','all','ignore','union','find','push','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','foreignKey','forEach','merge','autoAssociation','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','Tags','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','fax','mail','openchannel','./userProfile.attributes','../../components/parsers/qs','squel','filter','value','map','field','model','findAll','then','associatedResources','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','Campaign','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues'];(function(_0x36b15e,_0x104dcb){var _0x334692=function(_0xb09030){while(--_0xb09030){_0x36b15e['push'](_0x36b15e['shift']());}};_0x334692(++_0x104dcb);}(_0xd046,0x129));var _0x6d04=function(_0x166c5c,_0x28c744){_0x166c5c=_0x166c5c-0x0;var _0x2f4706=_0xd046[_0x166c5c];return _0x2f4706;};'use strict';var _=require('lodash');var attributes=require(_0x6d04('0x0'));var qs=require(_0x6d04('0x1'));var squel=require(_0x6d04('0x2'));module['exports']=function(_0xedb518){var _0x55be3b=_0xedb518['models'];function _0x33720a(_0x4d2121,_0x174d65){return new Promise(function(_0x4a1d47,_0x4bacb1){if(!_0x174d65)return _0x4a1d47(null);var _0xf3b4e7=_0x174d65[_0x6d04('0x3')]?{[_0x174d65['filter']['field']]:_0x174d65[_0x6d04('0x3')][_0x6d04('0x4')]}:undefined;return _0x55be3b[_0x4d2121]['findAll']({'where':_0xf3b4e7,'raw':!![]})['then'](function(_0x27a3d6){_0x174d65['associatedResources']=_[_0x6d04('0x5')](_0x27a3d6,'id');_0x4a1d47(_0x174d65);})['catch'](function(_0x5a2dbb){_0x4bacb1(_0x5a2dbb);});});}function _0x4d3a31(_0x36ae3e,_0x417b7d){return new Promise(function(_0x3397ea,_0x1acfcc){var _0x500adc=_0x36ae3e[_0x6d04('0x3')]?{[_0x36ae3e[_0x6d04('0x3')][_0x6d04('0x6')]]:_0x36ae3e[_0x6d04('0x3')][_0x6d04('0x4')]}:undefined;return _0x55be3b[_0x36ae3e[_0x6d04('0x7')]][_0x6d04('0x8')]({'where':_0x500adc,'raw':!![]})[_0x6d04('0x9')](function(_0x3667cf){_0x417b7d[_0x6d04('0xa')]=_[_0x6d04('0x5')](_0x3667cf,function(_0x43f451){return _0x43f451[_0x6d04('0xb')];});_0x3397ea(_0x417b7d);})[_0x6d04('0xc')](function(_0x2da704){_0x1acfcc(_0x2da704);});});}function _0x14f13c(_0x18170c,_0x2c69e0,_0xed5538){if(!_0x2c69e0)return Promise[_0x6d04('0xd')](null);return new Promise(function(_0x14190b,_0x41dc21){return _0x55be3b[_0x6d04('0xe')][_0x6d04('0x8')]({'where':{'sectionId':_0x2c69e0['id']},'raw':!![]})['then'](function(_0x3657a1){if(_0x18170c[_0x6d04('0x6')]&&_0x18170c[_0x6d04('0x6')]!=='id'){_0x2c69e0[_0x6d04('0xa')]=_[_0x6d04('0x5')](_0x3657a1,function(_0x2c6bb4){return _0x2c6bb4[_0x18170c[_0x6d04('0x6')]];});}else{if(_0xed5538===_0x6d04('0xf')){_0x2c69e0[_0x6d04('0xa')]=_[_0x6d04('0x5')](_0x3657a1,function(_0xbddecb){return{'id':_0xbddecb[_0x6d04('0x10')],'type':_0xbddecb[_0x6d04('0x11')]};});}else{_0x2c69e0['associatedResources']=_[_0x6d04('0x5')](_0x3657a1,function(_0x280eab){return _0x280eab['resourceId'];});}}_0x14190b(_0x2c69e0);})['catch'](function(_0x3bd862){_0x41dc21(_0x3bd862);});});}function _0x326276(_0x4386bd,_0xe8f198){var _0x36113c={'parentSections':[]};switch(_0x4386bd[_0x6d04('0x12')]()){case _0x6d04('0x13'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x15');break;case _0x6d04('0x16'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x17');break;case _0x6d04('0x18'):_0x36113c[_0x6d04('0x14')]='SquareRecording';_0x36113c[_0x6d04('0x19')]=[{'name':_0x6d04('0x1a'),'field':_0x6d04('0xb'),'foreignKey':_0x6d04('0x1b')}];break;case _0x6d04('0x1c'):_0x36113c[_0x6d04('0x14')]='JscriptyProject';break;case _0x6d04('0x1d'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x1e');_0x36113c[_0x6d04('0x19')]=[{'name':_0x6d04('0x1f'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x36113c['childModel']='CmList';break;case _0x6d04('0x20'):_0x36113c['childModel']=_0x6d04('0x21');break;case'globalcustomfields':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x22');break;case _0x6d04('0x23'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x24');break;case _0x6d04('0x25'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x26');break;case _0x6d04('0x27'):_0x36113c[_0x6d04('0x14')]='FaxQueue';break;case'faxaccounts':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x28');break;case _0x6d04('0x29'):case _0x6d04('0x2a'):case'outboundroutes':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x2b');break;case _0x6d04('0x2c'):_0x36113c[_0x6d04('0x14')]='VoiceContext';break;case _0x6d04('0x2d'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x2e');break;case _0x6d04('0x2f'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x30');_0x36113c[_0x6d04('0x19')]=[{'name':_0x6d04('0x31'),'field':_0x6d04('0xb'),'foreignKey':_0x6d04('0x32'),'model':_0x6d04('0x33'),'filter':{'field':_0x6d04('0x34'),'value':[_0x6d04('0x35')]}},{'name':_0x6d04('0x36'),'field':_0x6d04('0xb'),'foreignKey':'membername','model':_0x6d04('0x33'),'filter':{'field':'role','value':[_0x6d04('0x37')]}},{'name':_0x6d04('0x38'),'field':'name','foreignKey':_0x6d04('0x39'),'model':_0x6d04('0x3a'),'filter':{'field':_0x6d04('0x11'),'value':[_0x6d04('0x3b')]}},{'name':_0x6d04('0x3c'),'field':_0x6d04('0xb'),'foreignKey':_0x6d04('0x39'),'model':_0x6d04('0x3a'),'filter':{'field':'type','value':[_0x6d04('0x3d')]}}];break;case _0x6d04('0x3e'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x3f');break;case _0x6d04('0x40'):_0x36113c['childModel']=_0x6d04('0x41');break;case'voiceprefixes':_0x36113c['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x36113c['childModel']=_0x6d04('0x42');break;case'mailqueues':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x43');break;case _0x6d04('0x44'):_0x36113c[_0x6d04('0x14')]='MailAccount';break;case _0x6d04('0x45'):_0x36113c[_0x6d04('0x14')]='MailSubstatus';break;case _0x6d04('0x46'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x47');break;case _0x6d04('0x48'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x49');break;case _0x6d04('0x4a'):_0x36113c['childModel']=_0x6d04('0x4b');break;case'smsaccounts':_0x36113c['childModel']=_0x6d04('0x4c');break;case'whatsappqueues':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x4d');break;case'whatsappaccounts':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x4e');break;case _0x6d04('0x4f'):_0x36113c['childModel']='Team';break;case _0x6d04('0x50'):case _0x6d04('0x51'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x3a');if(_0xe8f198){_0x36113c[_0x6d04('0x19')]=[{'name':'VoiceQueues'},{'name':_0x6d04('0x3c')}];}break;case _0x6d04('0x52'):case _0x6d04('0x53'):case _0x6d04('0x54'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x33');if(_0xe8f198){_0x36113c['parentSections']=[{'name':_0x6d04('0x55'),'filter':{'field':_0x6d04('0x34'),'value':[_0x6d04('0x56'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x6d04('0x36')}];}break;case _0x6d04('0x57'):_0x36113c['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x36113c['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x58');break;case _0x6d04('0x59'):_0x36113c[_0x6d04('0x14')]='SugarcrmAccount';break;case _0x6d04('0x5a'):_0x36113c[_0x6d04('0x14')]='DeskAccount';break;case _0x6d04('0x5b'):_0x36113c['childModel']=_0x6d04('0x5c');break;case'vtigeraccounts':_0x36113c['childModel']=_0x6d04('0x33');break;case _0x6d04('0x5d'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x5e');break;case _0x6d04('0x5f'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x60');break;case _0x6d04('0x61'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x62');break;case _0x6d04('0x63'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x64');break;case _0x6d04('0x65'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x66');break;case'scheduler':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x67');break;case _0x6d04('0x68'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x69');break;case _0x6d04('0x6a'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x6b');break;case'templates':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x6c');break;case'triggers':_0x36113c[_0x6d04('0x14')]=_0x6d04('0x6d');break;case _0x6d04('0x6e'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x6f');break;case _0x6d04('0x70'):_0x36113c['childModel']='Variable';break;case _0x6d04('0x71'):_0x36113c['childModel']=_0x6d04('0x72');break;case _0x6d04('0x73'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0xf');_0x36113c['parentSections']=[{'name':_0x6d04('0x74'),'field':'id','foreignKey':_0x6d04('0x75')}];break;case _0x6d04('0x76'):_0x36113c[_0x6d04('0x14')]=_0x6d04('0x77');break;}return _0x36113c;}function _0x1f870e(_0x1def59,_0x1581f3){var _0x5d729f=_0x1def59[_0x6d04('0x78')](0x0)[_0x6d04('0x79')]()+_0x1def59[_0x6d04('0x7a')](0x1);var _0x485e4a={'type':_0x55be3b[_0x6d04('0x7b')][_0x6d04('0x7c')]['SELECT'],'raw':!![]};return new Promise(function(_0x5c42a4,_0x492927){var _0x3b5ee6=squel[_0x6d04('0x7d')]()[_0x6d04('0x6')](_0x6d04('0x7e')+_0x5d729f+_0x6d04('0x7f'),'id')[_0x6d04('0x6')](_0x6d04('0x80'))[_0x6d04('0x81')](_0x6d04('0x82')+_0x1def59+_0x6d04('0x83'),'ui')['where']('ui.UserId\x20=\x20?',_0x1581f3['id']);return _0x55be3b['sequelize'][_0x6d04('0x84')](_0x3b5ee6[_0x6d04('0x85')](),_0x485e4a)[_0x6d04('0x9')](function(_0x148839){_0x1581f3[_0x5d729f+_0x6d04('0x86')]=_0x148839;_0x5c42a4(_0x148839);})['catch'](function(_0x17c577){_0x492927(_0x17c577);});});}return _0xedb518['define'](_0x6d04('0x87'),attributes,{'tableName':_0x6d04('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4758d5){var _0x1391b0={'raw':![],'where':{}};var _0x30e2f4={};var _0x4430b4={'count':0x0,'rows':[]};var _0x11d4f7=_0x4758d5[_0x6d04('0x84')]['section'];var _0x12a11b=_0x4758d5[_0x6d04('0x84')][_0x6d04('0x89')]||![];var _0x46299e=_0x326276(_0x11d4f7,_0x12a11b);if(!_0x46299e[_0x6d04('0x14')])throw new Error(_0x6d04('0x8a')+_0x11d4f7+'\x27');var _0x352673=[{'name':_0x11d4f7}];if(!_[_0x6d04('0x8b')](_0x46299e['parentSections']))_0x352673=_0x46299e[_0x6d04('0x19')];var _0x375fb9=[];for(var _0x1e2785=0x0;_0x1e2785<_0x352673[_0x6d04('0x8c')];_0x1e2785++){_0x375fb9['push'](_0x55be3b[_0x6d04('0x8d')]['find']({'where':{'userProfileId':_0x4758d5['params']['id'],'name':_0x352673[_0x1e2785][_0x6d04('0xb')]},'raw':!![]}));}return Promise[_0x6d04('0x8e')](_0x375fb9)[_0x6d04('0x9')](function(_0x330158){var _0x56ca61=_[_0x6d04('0x3')](_0x330158,function(_0x2c7447){return _0x2c7447?_0x2c7447:undefined;});var _0x1e5fb2=_[_0x6d04('0x3')](_0x352673,[_0x6d04('0x8f'),!![]]);var _0x27cd06=_[_0x6d04('0x8b')](_0x56ca61)&&_[_0x6d04('0x8b')](_0x1e5fb2)?null:_[_0x6d04('0x90')](_0x1e5fb2,_0x56ca61);if(!_0x27cd06)return null;var _0x19ddd1=[];for(var _0x3fc088=0x0;_0x3fc088<_0x27cd06[_0x6d04('0x8c')];_0x3fc088++){var _0x559719=_[_0x6d04('0x91')](_0x352673,function(_0x4115c6){return _0x27cd06[_0x3fc088]?_0x4115c6[_0x6d04('0xb')]===_0x27cd06[_0x3fc088][_0x6d04('0xb')]:null;});if(_0x559719){if(_0x27cd06[_0x3fc088][_0x6d04('0x8f')]){_0x19ddd1['push'](_0x33720a(_0x46299e[_0x6d04('0x14')],_0x27cd06[_0x3fc088]));}else{if(!_0x27cd06[_0x3fc088]['autoAssociation']){_0x19ddd1['push'](_0x14f13c(_0x559719,_0x27cd06[_0x3fc088],_0x46299e[_0x6d04('0x14')]));}else{if(_0x559719[_0x6d04('0x7')]){_0x19ddd1[_0x6d04('0x92')](_0x4d3a31(_0x559719,_0x27cd06[_0x3fc088]));}}}}}return Promise[_0x6d04('0x8e')](_0x19ddd1);})[_0x6d04('0x9')](function(_0x5d3ac8){var _0x127f0b=_0x5d3ac8;var _0x182dda=null;if(_0x127f0b){_0x182dda=_0x127f0b['length']===0x1?_0x127f0b[0x0]:null;}if(!_0x182dda&&!_0x127f0b)return _0x4430b4;var _0x5439b9=_0x55be3b[_0x46299e[_0x6d04('0x14')]][_0x6d04('0x93')];_0x30e2f4[_0x6d04('0x7')]=_[_0x6d04('0x94')](_0x5439b9);_0x30e2f4[_0x6d04('0x84')]=_[_0x6d04('0x94')](_0x4758d5[_0x6d04('0x84')]);_0x30e2f4[_0x6d04('0x95')]=_[_0x6d04('0x96')](_0x30e2f4[_0x6d04('0x7')],_0x30e2f4[_0x6d04('0x84')]);_0x1391b0[_0x6d04('0x97')]=_['intersection'](_0x30e2f4['model'],qs[_0x6d04('0x98')](_0x4758d5['query']['fields']));_0x1391b0['attributes']=_0x1391b0['attributes'][_0x6d04('0x8c')]?_0x1391b0[_0x6d04('0x97')]:_0x30e2f4[_0x6d04('0x7')];if(!_0x4758d5[_0x6d04('0x84')][_0x6d04('0x99')](_0x6d04('0x9a'))){_0x1391b0[_0x6d04('0x9b')]=qs['limit'](_0x4758d5[_0x6d04('0x84')][_0x6d04('0x9b')]);_0x1391b0[_0x6d04('0x9c')]=qs[_0x6d04('0x9c')](_0x4758d5[_0x6d04('0x84')]['offset']);}_0x1391b0[_0x6d04('0x9d')]=qs['sort'](_0x4758d5[_0x6d04('0x84')][_0x6d04('0x9e')]);_0x1391b0[_0x6d04('0x9f')]=qs[_0x6d04('0x95')](_[_0x6d04('0xa0')](_0x4758d5[_0x6d04('0x84')],_0x30e2f4[_0x6d04('0x95')]));if(_0x4758d5[_0x6d04('0x84')]['filter']){_0x1391b0[_0x6d04('0x9f')]=_['merge'](_0x1391b0['where'],{'$or':_[_0x6d04('0x5')](_0x5439b9,function(_0xf61477){if(_0xf61477['type']['key']!=='VIRTUAL'){var _0x28c6bc={};_0x28c6bc[_0xf61477[_0x6d04('0x6')]]={'$like':'%'+_0x4758d5[_0x6d04('0x84')]['filter']+'%'};return _0x28c6bc;}})});}var _0x534ccc=[];var _0x2d9b4a=null;var _0x146ba6={};if(_0x182dda){_0x2d9b4a=_[_0x6d04('0x91')](_0x352673,[_0x6d04('0xb'),_0x182dda[_0x6d04('0xb')]]);if(_0x2d9b4a['field']){_0x146ba6={};if(_0x46299e['childModel']==='AnalyticExtractedReport'){_0x146ba6[_0x2d9b4a['foreignKey']]=_[_0x6d04('0x5')](_0x182dda[_0x6d04('0xa')],'id');}else{_0x146ba6[_0x2d9b4a[_0x6d04('0xa1')]]=_0x182dda[_0x6d04('0xa')];}_0x534ccc[_0x6d04('0x92')](_0x146ba6);}else{_0x1391b0['where']['id']=_0x182dda[_0x6d04('0xa')];}}else{for(var _0x4d487c=0x0;_0x4d487c<_0x127f0b[_0x6d04('0x8c')];_0x4d487c++){_0x2d9b4a=_[_0x6d04('0x91')](_0x352673,[_0x6d04('0xb'),_0x127f0b[_0x4d487c][_0x6d04('0xb')]]);if(_0x2d9b4a[_0x6d04('0x6')]){_0x146ba6={};_0x146ba6[_0x2d9b4a[_0x6d04('0xa1')]]=_0x127f0b[_0x4d487c]['associatedResources'];_0x534ccc[_0x6d04('0x92')](_0x146ba6);}else{if(!_0x1391b0[_0x6d04('0x9f')]['id'])_0x1391b0['where']['id']=[];_0x127f0b[_0x4d487c][_0x6d04('0xa')][_0x6d04('0xa2')](function(_0x9a88eb){_0x1391b0[_0x6d04('0x9f')]['id'][_0x6d04('0x92')](_0x9a88eb);});}}}if(!_[_0x6d04('0x8b')](_0x534ccc)){_0x1391b0[_0x6d04('0x9f')]=_[_0x6d04('0xa3')](_0x1391b0[_0x6d04('0x9f')],{'$and':{'$or':_0x534ccc}});}_0x1391b0=_[_0x6d04('0xa3')]({},_0x1391b0,_0x4758d5['options']);if(_0x182dda&&!_0x182dda[_0x6d04('0xa4')]&&_0x46299e['childModel']===_0x6d04('0xf')){if(_0x4758d5['query'][_0x6d04('0xa5')]){_0x1391b0[_0x6d04('0xa6')]=[{'all':!![]}];}return _0x55be3b[_0x46299e[_0x6d04('0x14')]][_0x6d04('0x8')](_0x1391b0)[_0x6d04('0x9')](function(_0x5622b1){var _0x1e92dd=[];_0x5622b1[_0x6d04('0xa2')](function(_0x5670b9){var _0x43af5f;switch(_0x5670b9[_0x6d04('0xa7')]){case'default':_0x43af5f=_[_0x6d04('0x91')](_0x182dda['associatedResources'],function(_0x3fccf0){return _0x3fccf0['id']===_0x5670b9['reportId']&&_0x3fccf0[_0x6d04('0x11')]===_0x6d04('0xa8');});break;case _0x6d04('0xa9'):_0x43af5f=_[_0x6d04('0x91')](_0x182dda[_0x6d04('0xa')],function(_0x2ec022){return _0x2ec022['id']===_0x5670b9[_0x6d04('0x75')]&&_0x2ec022[_0x6d04('0x11')]===_0x6d04('0xaa');});break;}if(_0x43af5f)_0x1e92dd[_0x6d04('0x92')](_0x5670b9);});_0x4430b4[_0x6d04('0xab')]=_0x1e92dd[_0x6d04('0x8c')];_0x4430b4['rows']=_0x1e92dd;return _0x4430b4;});}else{return _0x55be3b[_0x46299e[_0x6d04('0x14')]][_0x6d04('0xab')]({'where':_0x1391b0[_0x6d04('0x9f')]})[_0x6d04('0x9')](function(_0x498d58){_0x4430b4[_0x6d04('0xab')]=_0x498d58;if(_0x4758d5[_0x6d04('0x84')][_0x6d04('0xa5')]){if(_0x46299e[_0x6d04('0x14')]===_0x6d04('0x1e')){_0x1391b0[_0x6d04('0xa6')]=[{'model':_0x55be3b[_0x6d04('0x6b')],'as':_0x6d04('0xac'),'attributes':['id','name',_0x6d04('0xad')],'required':_0x4758d5['query'][_0x6d04('0xae')]?!![]:![]},{'model':_0x55be3b['Tag'],'as':_0x6d04('0xaf'),'attributes':['id',_0x6d04('0xb'),_0x6d04('0xad')],'through':_0x4758d5[_0x6d04('0x84')][_0x6d04('0xae')]?{'attributes':[],'where':{'TagId':_0x4758d5[_0x6d04('0x84')]['tag']||undefined}}:{},'required':_0x4758d5[_0x6d04('0x84')][_0x6d04('0xae')]?!![]:![]}];}else{_0x1391b0['include']=[{'all':!![]}];}}return _0x55be3b[_0x46299e[_0x6d04('0x14')]][_0x6d04('0x8')](_0x1391b0);})[_0x6d04('0x9')](function(_0x4b7a37){_0x4430b4[_0x6d04('0xb0')]=_0x4b7a37;if(_0x11d4f7===_0x6d04('0x31')&&_0x4758d5[_0x6d04('0x84')][_0x6d04('0xb1')]===_0x6d04('0xb2')){var _0x7f5790=[];for(var _0xe07034=0x0;_0xe07034<_0x4430b4[_0x6d04('0xb0')][_0x6d04('0x8c')];_0xe07034++){_0x7f5790[_0x6d04('0x92')](_0x1f870e(_0x6d04('0xb3'),_0x4430b4[_0x6d04('0xb0')][_0xe07034][_0x6d04('0xb4')]));_0x7f5790[_0x6d04('0x92')](_0x1f870e('sms',_0x4430b4[_0x6d04('0xb0')][_0xe07034][_0x6d04('0xb4')]));_0x7f5790[_0x6d04('0x92')](_0x1f870e(_0x6d04('0xb5'),_0x4430b4['rows'][_0xe07034][_0x6d04('0xb4')]));_0x7f5790[_0x6d04('0x92')](_0x1f870e(_0x6d04('0xb6'),_0x4430b4['rows'][_0xe07034][_0x6d04('0xb4')]));_0x7f5790[_0x6d04('0x92')](_0x1f870e(_0x6d04('0xb7'),_0x4430b4[_0x6d04('0xb0')][_0xe07034][_0x6d04('0xb4')]));_0x7f5790[_0x6d04('0x92')](_0x1f870e('whatsapp',_0x4430b4[_0x6d04('0xb0')][_0xe07034][_0x6d04('0xb4')]));}return Promise['all'](_0x7f5790)[_0x6d04('0x9')](function(){return _0x4430b4;});}return _0x4430b4;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index a282c33..31393d1 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 _0x2da6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x171f07,_0x1078c4){var _0x2fb5d9=function(_0x4bce40){while(--_0x4bce40){_0x171f07['push'](_0x171f07['shift']());}};_0x2fb5d9(++_0x1078c4);}(_0x2da6,0x1dd));var _0x62da=function(_0x3dbffd,_0x4ab370){_0x3dbffd=_0x3dbffd-0x0;var _0x22e0eb=_0x2da6[_0x3dbffd];return _0x22e0eb;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});config[_0x62da('0xc')]=_[_0x62da('0xd')](config[_0x62da('0xc')],{'host':_0x62da('0xe'),'port':0x18eb});var socket=require(_0x62da('0xf'))(new Redis(config['redis']));require(_0x62da('0x10'))[_0x62da('0x11')](socket);function respondWithRpcPromise(_0x2a3d7c,_0x1b68f8,_0x4cd5a2){return new BPromise(function(_0x241090,_0x3afe3b){return client[_0x62da('0x12')](_0x2a3d7c,_0x4cd5a2)[_0x62da('0x13')](function(_0x23be32){logger['info'](_0x62da('0x14'),_0x1b68f8,_0x62da('0x15'));logger[_0x62da('0x16')](_0x62da('0x17'),_0x1b68f8,_0x62da('0x15'),JSON['stringify'](_0x23be32));if(_0x23be32['error']){if(_0x23be32[_0x62da('0x18')][_0x62da('0x19')]===0x1f4){logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x3afe3b(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x241090(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x1b68f8,_0x62da('0x15'));_0x241090(_0x23be32['result'][_0x62da('0x1a')]);}})[_0x62da('0x1b')](function(_0x15b8d0){logger['error'](_0x62da('0x14'),_0x1b68f8,_0x15b8d0);_0x3afe3b(_0x15b8d0);});});} \ No newline at end of file +var _0x4a03=['http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1162b1,_0x35b69f){var _0x2165b0=function(_0x1125f9){while(--_0x1125f9){_0x1162b1['push'](_0x1162b1['shift']());}};_0x2165b0(++_0x35b69f);}(_0x4a03,0x16e));var _0x34a0=function(_0x3e567c,_0xd721cf){_0x3e567c=_0x3e567c-0x0;var _0x2eed46=_0x4a03[_0x3e567c];return _0x2eed46;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});config['redis']=_[_0x34a0('0xa')](config[_0x34a0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x34a0('0xc'))(new Redis(config[_0x34a0('0xb')]));require(_0x34a0('0xd'))[_0x34a0('0xe')](socket);function respondWithRpcPromise(_0x761a80,_0x4faf06,_0x40d73d){return new BPromise(function(_0x2c39bf,_0x21e702){return client[_0x34a0('0xf')](_0x761a80,_0x40d73d)[_0x34a0('0x10')](function(_0x343d24){logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,'request\x20sent');logger['debug'](_0x34a0('0x13'),_0x4faf06,_0x34a0('0x14'),JSON['stringify'](_0x343d24));if(_0x343d24[_0x34a0('0x15')]){if(_0x343d24[_0x34a0('0x15')][_0x34a0('0x16')]===0x1f4){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x21e702(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x2c39bf(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}else{logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,_0x34a0('0x14'));_0x2c39bf(_0x343d24[_0x34a0('0x18')][_0x34a0('0x17')]);}})['catch'](function(_0x466525){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x466525);_0x21e702(_0x466525);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ed69a20..5acec4e 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 _0x4766=['userProfile:','update','emit','register','length'];(function(_0x478f41,_0x456747){var _0x519a77=function(_0xf77a35){while(--_0xf77a35){_0x478f41['push'](_0x478f41['shift']());}};_0x519a77(++_0x456747);}(_0x4766,0x1e6));var _0x6476=function(_0x3e0b94,_0x5d2777){_0x3e0b94=_0x3e0b94-0x0;var _0xb426e5=_0x4766[_0x3e0b94];return _0xb426e5;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0x6476('0x0')];function createListener(_0x3a61f3,_0x18976d){return function(_0x5a7027){_0x18976d[_0x6476('0x1')](_0x3a61f3,_0x5a7027);};}function removeListener(_0x5a71e7,_0x456e0c){return function(){UserProfileEvents['removeListener'](_0x5a71e7,_0x456e0c);};}exports[_0x6476('0x2')]=function(_0x59e976){for(var _0x2535ae=0x0,_0x1abcd8=events[_0x6476('0x3')];_0x2535ae<_0x1abcd8;_0x2535ae++){var _0xd2d6da=events[_0x2535ae];var _0x579030=createListener(_0x6476('0x4')+_0xd2d6da,_0x59e976);UserProfileEvents['on'](_0xd2d6da,_0x579030);}}; \ No newline at end of file +var _0xceb7=['save','remove','update','emit','removeListener','length','userProfile:'];(function(_0x372ab6,_0x1b9e57){var _0x14b88f=function(_0x346975){while(--_0x346975){_0x372ab6['push'](_0x372ab6['shift']());}};_0x14b88f(++_0x1b9e57);}(_0xceb7,0x69));var _0x7ceb=function(_0x420701,_0x2192ff){_0x420701=_0x420701-0x0;var _0x58091e=_0xceb7[_0x420701];return _0x58091e;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x7ceb('0x0'),_0x7ceb('0x1'),_0x7ceb('0x2')];function createListener(_0x4db6a6,_0x1dbbf7){return function(_0x1e6a26){_0x1dbbf7[_0x7ceb('0x3')](_0x4db6a6,_0x1e6a26);};}function removeListener(_0x5d537e,_0x5c85a0){return function(){UserProfileEvents[_0x7ceb('0x4')](_0x5d537e,_0x5c85a0);};}exports['register']=function(_0x575680){for(var _0x2e24ae=0x0,_0x3c4640=events[_0x7ceb('0x5')];_0x2e24ae<_0x3c4640;_0x2e24ae++){var _0x3af4b1=events[_0x2e24ae];var _0x443de4=createListener(_0x7ceb('0x6')+_0x3af4b1,_0x575680);UserProfileEvents['on'](_0x3af4b1,_0x443de4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 70eaae3..3f75208 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 _0x6118=['put','update','destroy','multer','util','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x6118,0x17c));var _0x8611=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x6118[_0x30f030];return _0xf7614f;};'use strict';var multer=require(_0x8611('0x0'));var util=require(_0x8611('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8611('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8611('0x3'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x8611('0x4')]('/',auth[_0x8611('0x5')](),controller['index']);router[_0x8611('0x4')](_0x8611('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x8611('0x4')](_0x8611('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x8611('0x8')]('/',auth[_0x8611('0x5')](),controller[_0x8611('0x9')]);router[_0x8611('0xa')](_0x8611('0x7'),auth[_0x8611('0x5')](),controller[_0x8611('0xb')]);router['delete'](_0x8611('0x7'),auth[_0x8611('0x5')](),controller[_0x8611('0xc')]);module['exports']=router; \ No newline at end of file +var _0x303b=['/describe','isAuthenticated','describe','/:id','show','post','create','put','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','get'];(function(_0x2b338b,_0x4a06ba){var _0x256f66=function(_0x13c9c4){while(--_0x13c9c4){_0x2b338b['push'](_0x2b338b['shift']());}};_0x256f66(++_0x4a06ba);}(_0x303b,0x1b1));var _0xb303=function(_0x13300d,_0x443637){_0x13300d=_0x13300d-0x0;var _0x54aa75=_0x303b[_0x13300d];return _0x54aa75;};'use strict';var multer=require(_0xb303('0x0'));var util=require('util');var path=require(_0xb303('0x1'));var timeout=require(_0xb303('0x2'));var express=require(_0xb303('0x3'));var router=express[_0xb303('0x4')]();var fs_extra=require(_0xb303('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb303('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb303('0x7')]);router[_0xb303('0x8')](_0xb303('0x9'),auth[_0xb303('0xa')](),controller[_0xb303('0xb')]);router[_0xb303('0x8')](_0xb303('0xc'),auth['isAuthenticated'](),controller[_0xb303('0xd')]);router[_0xb303('0xe')]('/',auth[_0xb303('0xa')](),controller[_0xb303('0xf')]);router[_0xb303('0x10')](_0xb303('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb303('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index bb978bc..3090722 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 _0xb9ae=['sequelize','exports','STRING','INTEGER'];(function(_0x2c3458,_0x1f7efd){var _0x3f7e02=function(_0x261040){while(--_0x261040){_0x2c3458['push'](_0x2c3458['shift']());}};_0x3f7e02(++_0x1f7efd);}(_0xb9ae,0x140));var _0xeb9a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb9ae[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xeb9a('0x0'));module[_0xeb9a('0x1')]={'name':{'type':Sequelize[_0xeb9a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xeb9a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xeb9a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcb30=['STRING','INTEGER','sequelize','exports'];(function(_0x396ac0,_0x2f55d8){var _0x3e10ad=function(_0x53129c){while(--_0x53129c){_0x396ac0['push'](_0x396ac0['shift']());}};_0x3e10ad(++_0x2f55d8);}(_0xcb30,0x166));var _0x0cb3=function(_0xb8df25,_0x2b87e7){_0xb8df25=_0xb8df25-0x0;var _0x554c3d=_0xcb30[_0xb8df25];return _0x554c3d;};'use strict';var Sequelize=require(_0x0cb3('0x0'));module[_0x0cb3('0x1')]={'name':{'type':Sequelize[_0x0cb3('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0cb3('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c783347..9300260 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 _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','UserProfileResource','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x8952,0x17e));var _0x2895=function(_0x20c546,_0x14681d){_0x20c546=_0x20c546-0x0;var _0x2a158d=_0x8952[_0x20c546];return _0x2a158d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['UserProfileResource'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file +var _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x6d38,0x1ef));var _0x86d3=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6d38[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['UserProfileResource'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 91b84b3..ec0dda1 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 _0x191e=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash'];(function(_0x219d60,_0x387d1e){var _0x4da940=function(_0x1d29fb){while(--_0x1d29fb){_0x219d60['push'](_0x219d60['shift']());}};_0x4da940(++_0x387d1e);}(_0x191e,0x15e));var _0xe191=function(_0x36075c,_0x3714c8){_0x36075c=_0x36075c-0x0;var _0x50bd75=_0x191e[_0x36075c];return _0x50bd75;};'use strict';var _=require(_0xe191('0x0'));var util=require(_0xe191('0x1'));var logger=require(_0xe191('0x2'))(_0xe191('0x3'));var moment=require(_0xe191('0x4'));var BPromise=require('bluebird');var rp=require(_0xe191('0x5'));var fs=require('fs');var path=require(_0xe191('0x6'));var rimraf=require('rimraf');var config=require(_0xe191('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x29bea1,_0x4a3cb3){return _0x29bea1[_0xe191('0x8')](_0xe191('0x9'),attributes,{'tableName':_0xe191('0xa'),'paranoid':![],'indexes':[{'name':_0xe191('0xb'),'fields':[_0xe191('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a87=['path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x7c6572,_0x5f4449){var _0x3ed0e6=function(_0xae965d){while(--_0xae965d){_0x7c6572['push'](_0x7c6572['shift']());}};_0x3ed0e6(++_0x5f4449);}(_0x1a87,0xba));var _0x71a8=function(_0x28555b,_0x342cdc){_0x28555b=_0x28555b-0x0;var _0x4d11fb=_0x1a87[_0x28555b];return _0x4d11fb;};'use strict';var _=require(_0x71a8('0x0'));var util=require(_0x71a8('0x1'));var logger=require(_0x71a8('0x2'))(_0x71a8('0x3'));var moment=require(_0x71a8('0x4'));var BPromise=require(_0x71a8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71a8('0x6'));var rimraf=require(_0x71a8('0x7'));var config=require(_0x71a8('0x8'));var attributes=require(_0x71a8('0x9'));module[_0x71a8('0xa')]=function(_0x47a7df,_0x49ff6d){return _0x47a7df[_0x71a8('0xb')]('UserProfileResource',attributes,{'tableName':_0x71a8('0xc'),'paranoid':![],'indexes':[{'name':_0x71a8('0xd'),'fields':[_0x71a8('0xe'),_0x71a8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4adafa6..e8c94f7 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 _0xa590=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x339c96,_0x12d086){var _0x52fd7b=function(_0x376add){while(--_0x376add){_0x339c96['push'](_0x339c96['shift']());}};_0x52fd7b(++_0x12d086);}(_0xa590,0x1c1));var _0x0a59=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0xa590[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x0a59('0x0'));var util=require('util');var moment=require(_0x0a59('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a59('0x2'));var db=require(_0x0a59('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0a59('0x4'));var config=require(_0x0a59('0x5'));var jayson=require(_0x0a59('0x6'));var client=jayson[_0x0a59('0x7')][_0x0a59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10ac77,_0xb3806e,_0x2b409d){return new BPromise(function(_0x467cb0,_0xf41e7d){return client[_0x0a59('0x9')](_0x10ac77,_0x2b409d)[_0x0a59('0xa')](function(_0x4a57c1){logger[_0x0a59('0xb')](_0x0a59('0xc'),_0xb3806e,'request\x20sent');logger[_0x0a59('0xd')](_0x0a59('0xe'),_0xb3806e,_0x0a59('0xf'),JSON[_0x0a59('0x10')](_0x4a57c1));if(_0x4a57c1[_0x0a59('0x11')]){if(_0x4a57c1[_0x0a59('0x11')][_0x0a59('0x12')]===0x1f4){logger[_0x0a59('0x11')](_0x0a59('0xc'),_0xb3806e,_0x4a57c1[_0x0a59('0x11')][_0x0a59('0x13')]);return _0xf41e7d(_0x4a57c1['error'][_0x0a59('0x13')]);}logger[_0x0a59('0x11')](_0x0a59('0xc'),_0xb3806e,_0x4a57c1[_0x0a59('0x11')][_0x0a59('0x13')]);return _0x467cb0(_0x4a57c1['error'][_0x0a59('0x13')]);}else{logger['info'](_0x0a59('0xc'),_0xb3806e,_0x0a59('0xf'));_0x467cb0(_0x4a57c1[_0x0a59('0x14')][_0x0a59('0x13')]);}})[_0x0a59('0x15')](function(_0x1b462c){logger['error'](_0x0a59('0xc'),_0xb3806e,_0x1b462c);_0xf41e7d(_0x1b462c);});});} \ No newline at end of file +var _0x013f=['error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3f3a53,_0x2bce56){var _0x11718f=function(_0x18e488){while(--_0x18e488){_0x3f3a53['push'](_0x3f3a53['shift']());}};_0x11718f(++_0x2bce56);}(_0x013f,0xa6));var _0xf013=function(_0x354162,_0xd048da){_0x354162=_0x354162-0x0;var _0x23585c=_0x013f[_0x354162];return _0x23585c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf013('0x0'));var BPromise=require('bluebird');var rs=require(_0xf013('0x1'));var fs=require('fs');var Redis=require(_0xf013('0x2'));var db=require(_0xf013('0x3'))['db'];var utils=require(_0xf013('0x4'));var logger=require(_0xf013('0x5'))(_0xf013('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf013('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b82d4,_0x55ea91,_0x3d9ca3){return new BPromise(function(_0x1011ee,_0x625048){return client[_0xf013('0x8')](_0x3b82d4,_0x3d9ca3)['then'](function(_0xbc0deb){logger[_0xf013('0x9')](_0xf013('0xa'),_0x55ea91,'request\x20sent');logger[_0xf013('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x55ea91,_0xf013('0xc'),JSON[_0xf013('0xd')](_0xbc0deb));if(_0xbc0deb[_0xf013('0xe')]){if(_0xbc0deb[_0xf013('0xe')][_0xf013('0xf')]===0x1f4){logger[_0xf013('0xe')](_0xf013('0xa'),_0x55ea91,_0xbc0deb[_0xf013('0xe')][_0xf013('0x10')]);return _0x625048(_0xbc0deb['error']['message']);}logger[_0xf013('0xe')](_0xf013('0xa'),_0x55ea91,_0xbc0deb[_0xf013('0xe')][_0xf013('0x10')]);return _0x1011ee(_0xbc0deb[_0xf013('0xe')][_0xf013('0x10')]);}else{logger[_0xf013('0x9')](_0xf013('0xa'),_0x55ea91,_0xf013('0xc'));_0x1011ee(_0xbc0deb[_0xf013('0x11')]['message']);}})['catch'](function(_0x5c6625){logger[_0xf013('0xe')](_0xf013('0xa'),_0x55ea91,_0x5c6625);_0x625048(_0x5c6625);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 667da45..2e2bff9 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 _0x3a4b=['destroy','util','path','express','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete'];(function(_0xd037f,_0x2bc50b){var _0x2b8fa4=function(_0x4da448){while(--_0x4da448){_0xd037f['push'](_0xd037f['shift']());}};_0x2b8fa4(++_0x2bc50b);}(_0x3a4b,0x151));var _0xb3a4=function(_0x522e40,_0x4f6825){_0x522e40=_0x522e40-0x0;var _0x14191f=_0x3a4b[_0x522e40];return _0x14191f;};'use strict';var multer=require('multer');var util=require(_0xb3a4('0x0'));var path=require(_0xb3a4('0x1'));var timeout=require('connect-timeout');var express=require(_0xb3a4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb3a4('0x3'));var config=require('../../config/environment');var controller=require(_0xb3a4('0x4'));router[_0xb3a4('0x5')]('/',auth[_0xb3a4('0x6')](),controller[_0xb3a4('0x7')]);router[_0xb3a4('0x5')](_0xb3a4('0x8'),auth[_0xb3a4('0x6')](),controller['describe']);router['get'](_0xb3a4('0x9'),auth[_0xb3a4('0x6')](),controller[_0xb3a4('0xa')]);router['post']('/',auth[_0xb3a4('0x6')](),controller[_0xb3a4('0xb')]);router[_0xb3a4('0xc')](_0xb3a4('0x9'),auth[_0xb3a4('0x6')](),controller[_0xb3a4('0xd')]);router[_0xb3a4('0xe')](_0xb3a4('0x9'),auth[_0xb3a4('0x6')](),controller[_0xb3a4('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb192=['fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','express','Router'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xb192,0x107));var _0x2b19=function(_0x1bb5bd,_0x4d159c){_0x1bb5bd=_0x1bb5bd-0x0;var _0x34edee=_0xb192[_0x1bb5bd];return _0x34edee;};'use strict';var multer=require(_0x2b19('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2b19('0x1'));var router=express[_0x2b19('0x2')]();var fs_extra=require(_0x2b19('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2b19('0x4'));var config=require(_0x2b19('0x5'));var controller=require(_0x2b19('0x6'));router[_0x2b19('0x7')]('/',auth[_0x2b19('0x8')](),controller[_0x2b19('0x9')]);router[_0x2b19('0x7')](_0x2b19('0xa'),auth[_0x2b19('0x8')](),controller[_0x2b19('0xb')]);router[_0x2b19('0x7')](_0x2b19('0xc'),auth[_0x2b19('0x8')](),controller[_0x2b19('0xd')]);router['post']('/',auth[_0x2b19('0x8')](),controller[_0x2b19('0xe')]);router[_0x2b19('0xf')](_0x2b19('0xc'),auth[_0x2b19('0x8')](),controller[_0x2b19('0x10')]);router[_0x2b19('0x11')](_0x2b19('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x2b19('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 195dde5..e8d7a67 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 _0xd824=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x55fd92,_0x264441){var _0x396f87=function(_0x215587){while(--_0x215587){_0x55fd92['push'](_0x55fd92['shift']());}};_0x396f87(++_0x264441);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d82('0x4')],'set':function(_0x287fbf){this[_0x4d82('0x5')]('crudPermissions',_0x287fbf?_0x287fbf['join'](''):[]);},'get':function(){return this[_0x4d82('0x6')]('crudPermissions')?this['getDataValue'](_0x4d82('0x7'))[_0x4d82('0x8')](''):[];}}}; \ No newline at end of file +var _0x4e81=['join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0x4e81,0x1bc));var _0x14e8=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x4e81[_0x476b00];return _0x44ec8e;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'name':{'type':Sequelize[_0x14e8('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x14e8('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x14e8('0x2')],'set':function(_0x224121){this[_0x14e8('0x4')](_0x14e8('0x5'),_0x224121?_0x224121[_0x14e8('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x14e8('0x7')](_0x14e8('0x5'))[_0x14e8('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index de808d5..113eef8 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 _0x1334=['send','index','map','UserProfileSection','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x4d394d,_0x40e7b3){var _0x4f0003=function(_0x56d25d){while(--_0x56d25d){_0x4d394d['push'](_0x4d394d['shift']());}};_0x4f0003(++_0x40e7b3);}(_0x1334,0xbc));var _0x4133=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x1334[_0x454018];return _0x24697d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4133('0x0'));var jsonpatch=require(_0x4133('0x1'));var rp=require(_0x4133('0x2'));var moment=require(_0x4133('0x3'));var BPromise=require(_0x4133('0x4'));var Mustache=require(_0x4133('0x5'));var util=require(_0x4133('0x6'));var path=require('path');var sox=require(_0x4133('0x7'));var csv=require(_0x4133('0x8'));var ejs=require(_0x4133('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4133('0xa'));var squel=require(_0x4133('0xb'));var crypto=require(_0x4133('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4133('0x8'));var querystring=require(_0x4133('0xd'));var Papa=require(_0x4133('0xe'));var Redis=require(_0x4133('0xf'));var authService=require(_0x4133('0x10'));var qs=require(_0x4133('0x11'));var as=require(_0x4133('0x12'));var hardwareService=require(_0x4133('0x13'));var logger=require('../../config/logger')(_0x4133('0x14'));var utils=require('../../config/utils');var config=require(_0x4133('0x15'));var licenseUtil=require(_0x4133('0x16'));var db=require(_0x4133('0x17'))['db'];function respondWithStatusCode(_0x396fb5,_0x13054c){_0x13054c=_0x13054c||0xcc;return function(_0x13ef26){if(_0x13ef26){return _0x396fb5['sendStatus'](_0x13054c);}return _0x396fb5[_0x4133('0x18')](_0x13054c)[_0x4133('0x19')]();};}function respondWithResult(_0x89a0dc,_0x121fc0){_0x121fc0=_0x121fc0||0xc8;return function(_0x24094b){if(_0x24094b){return _0x89a0dc['status'](_0x121fc0)[_0x4133('0x1a')](_0x24094b);}};}function respondWithFilteredResult(_0x2a694c,_0x5ada90){return function(_0x5ffbbb){if(_0x5ffbbb){var _0x50b7e9=typeof _0x5ada90[_0x4133('0x1b')]==='undefined'&&typeof _0x5ada90['limit']===_0x4133('0x1c');var _0x137cc5=_0x5ffbbb[_0x4133('0x1d')];var _0x99c805=_0x50b7e9?0x0:_0x5ada90['offset'];var _0x549dcf=_0x50b7e9?_0x5ffbbb[_0x4133('0x1d')]:_0x5ada90[_0x4133('0x1b')]+_0x5ada90[_0x4133('0x1e')];var _0x3c45d2;if(_0x549dcf>=_0x137cc5){_0x549dcf=_0x137cc5;_0x3c45d2=0xc8;}else{_0x3c45d2=0xce;}_0x2a694c[_0x4133('0x18')](_0x3c45d2);return _0x2a694c[_0x4133('0x1f')](_0x4133('0x20'),_0x99c805+'-'+_0x549dcf+'/'+_0x137cc5)[_0x4133('0x1a')](_0x5ffbbb);}return null;};}function patchUpdates(_0x336d86){return function(_0x14b455){try{jsonpatch[_0x4133('0x21')](_0x14b455,_0x336d86,!![]);}catch(_0x703485){return BPromise[_0x4133('0x22')](_0x703485);}return _0x14b455[_0x4133('0x23')]();};}function saveUpdates(_0x59e9d2,_0x36ecc9){return function(_0x3c6f64){if(_0x3c6f64){return _0x3c6f64[_0x4133('0x24')](_0x59e9d2)[_0x4133('0x25')](function(_0x3686eb){return _0x3686eb;});}return null;};}function removeEntity(_0x37f22c,_0x4c04ba){return function(_0x5205e9){if(_0x5205e9){return _0x5205e9[_0x4133('0x26')]()[_0x4133('0x25')](function(){_0x37f22c[_0x4133('0x18')](0xcc)[_0x4133('0x19')]();});}};}function handleEntityNotFound(_0xd757ed,_0x2f0a69){return function(_0x3484ae){if(!_0x3484ae){_0xd757ed[_0x4133('0x27')](0x194);}return _0x3484ae;};}function handleError(_0x3a9365,_0x595760){_0x595760=_0x595760||0x1f4;return function(_0x2ae9ff){logger[_0x4133('0x28')](_0x2ae9ff[_0x4133('0x29')]);if(_0x2ae9ff[_0x4133('0x2a')]){delete _0x2ae9ff['name'];}_0x3a9365['status'](_0x595760)[_0x4133('0x2b')](_0x2ae9ff);};}exports[_0x4133('0x2c')]=function(_0x4687f6,_0x1ba25c){var _0x4e474c={},_0x3ac138={},_0x225df9={'count':0x0,'rows':[]};var _0x45cd5b=_[_0x4133('0x2d')](db[_0x4133('0x2e')][_0x4133('0x2f')],function(_0x48083d){return{'name':_0x48083d['fieldName'],'type':_0x48083d['type'][_0x4133('0x30')]};});_0x3ac138[_0x4133('0x31')]=_['map'](_0x45cd5b,'name');_0x3ac138[_0x4133('0x32')]=_[_0x4133('0x33')](_0x4687f6[_0x4133('0x32')]);_0x3ac138[_0x4133('0x34')]=_['intersection'](_0x3ac138[_0x4133('0x31')],_0x3ac138['query']);_0x4e474c[_0x4133('0x35')]=_[_0x4133('0x36')](_0x3ac138['model'],qs[_0x4133('0x37')](_0x4687f6[_0x4133('0x32')]['fields']));_0x4e474c[_0x4133('0x35')]=_0x4e474c[_0x4133('0x35')][_0x4133('0x38')]?_0x4e474c[_0x4133('0x35')]:_0x3ac138['model'];if(!_0x4687f6[_0x4133('0x32')][_0x4133('0x39')](_0x4133('0x3a'))){_0x4e474c[_0x4133('0x1e')]=qs[_0x4133('0x1e')](_0x4687f6[_0x4133('0x32')]['limit']);_0x4e474c[_0x4133('0x1b')]=qs[_0x4133('0x1b')](_0x4687f6[_0x4133('0x32')][_0x4133('0x1b')]);}_0x4e474c[_0x4133('0x3b')]=qs[_0x4133('0x3c')](_0x4687f6['query'][_0x4133('0x3c')]);_0x4e474c['where']=qs[_0x4133('0x34')](_[_0x4133('0x3d')](_0x4687f6[_0x4133('0x32')],_0x3ac138['filters']),_0x45cd5b);if(_0x4687f6[_0x4133('0x32')][_0x4133('0x3e')]){_0x4e474c[_0x4133('0x3f')]=_[_0x4133('0x40')](_0x4e474c['where'],{'$or':_[_0x4133('0x2d')](_0x45cd5b,function(_0x3d6bb9){if(_0x3d6bb9['type']!==_0x4133('0x41')){var _0x10718f={};_0x10718f[_0x3d6bb9[_0x4133('0x2a')]]={'$like':'%'+_0x4687f6[_0x4133('0x32')][_0x4133('0x3e')]+'%'};return _0x10718f;}})});}_0x4e474c=_[_0x4133('0x40')]({},_0x4e474c,_0x4687f6[_0x4133('0x42')]);var _0x5f48ab={'where':_0x4e474c[_0x4133('0x3f')]};return db['UserProfileSection'][_0x4133('0x1d')](_0x5f48ab)[_0x4133('0x25')](function(_0x5b19ce){_0x225df9[_0x4133('0x1d')]=_0x5b19ce;if(_0x4687f6[_0x4133('0x32')]['includeAll']){_0x4e474c[_0x4133('0x43')]=[{'all':!![]}];}return db[_0x4133('0x2e')]['findAll'](_0x4e474c);})[_0x4133('0x25')](function(_0x6225ad){_0x225df9[_0x4133('0x44')]=_0x6225ad;return _0x225df9;})[_0x4133('0x25')](respondWithFilteredResult(_0x1ba25c,_0x4e474c))[_0x4133('0x45')](handleError(_0x1ba25c,null));};exports[_0x4133('0x46')]=function(_0x236573,_0x52c4c6){var _0x24dfb4={'raw':![],'where':{'id':_0x236573[_0x4133('0x47')]['id']}},_0x18d331={};_0x18d331[_0x4133('0x31')]=_[_0x4133('0x33')](db['UserProfileSection']['rawAttributes']);_0x18d331[_0x4133('0x32')]=_[_0x4133('0x33')](_0x236573[_0x4133('0x32')]);_0x18d331[_0x4133('0x34')]=_[_0x4133('0x36')](_0x18d331[_0x4133('0x31')],_0x18d331[_0x4133('0x32')]);_0x24dfb4['attributes']=_['intersection'](_0x18d331['model'],qs[_0x4133('0x37')](_0x236573[_0x4133('0x32')][_0x4133('0x37')]));_0x24dfb4[_0x4133('0x35')]=_0x24dfb4[_0x4133('0x35')]['length']?_0x24dfb4[_0x4133('0x35')]:_0x18d331[_0x4133('0x31')];if(_0x236573[_0x4133('0x32')][_0x4133('0x48')]){_0x24dfb4[_0x4133('0x43')]=[{'all':!![]}];}_0x24dfb4=_[_0x4133('0x40')]({},_0x24dfb4,_0x236573['options']);return db['UserProfileSection'][_0x4133('0x49')](_0x24dfb4)['then'](handleEntityNotFound(_0x52c4c6,null))[_0x4133('0x25')](respondWithResult(_0x52c4c6,null))[_0x4133('0x45')](handleError(_0x52c4c6,null));};exports[_0x4133('0x4a')]=function(_0x59c4c4,_0x1b045c){return db[_0x4133('0x2e')][_0x4133('0x4a')](_0x59c4c4['body'],{})[_0x4133('0x25')](respondWithResult(_0x1b045c,0xc9))[_0x4133('0x45')](handleError(_0x1b045c,null));};exports['update']=function(_0x4bba13,_0x350666){if(_0x4bba13['body']['id']){delete _0x4bba13[_0x4133('0x4b')]['id'];}return db[_0x4133('0x2e')][_0x4133('0x49')]({'where':{'id':_0x4bba13[_0x4133('0x47')]['id']}})[_0x4133('0x25')](handleEntityNotFound(_0x350666,null))[_0x4133('0x25')](saveUpdates(_0x4bba13[_0x4133('0x4b')],null))['then'](respondWithResult(_0x350666,null))['catch'](handleError(_0x350666,null));};exports[_0x4133('0x26')]=function(_0x421438,_0x2a47c2){return db[_0x4133('0x2e')][_0x4133('0x49')]({'where':{'id':_0x421438[_0x4133('0x47')]['id']}})[_0x4133('0x25')](handleEntityNotFound(_0x2a47c2,null))[_0x4133('0x25')](removeEntity(_0x2a47c2,null))[_0x4133('0x45')](handleError(_0x2a47c2,null));};exports[_0x4133('0x4c')]=function(_0x1d2c55,_0x1dc1d9){return db[_0x4133('0x2e')][_0x4133('0x4c')]()[_0x4133('0x25')](respondWithResult(_0x1dc1d9,null))[_0x4133('0x45')](handleError(_0x1dc1d9,null));}; \ No newline at end of file +var _0x823e=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','sendStatus','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x823e,0x195));var _0xe823=function(_0x26fa88,_0x5c193f){_0x26fa88=_0x26fa88-0x0;var _0x552030=_0x823e[_0x26fa88];return _0x552030;};'use strict';var emlformat=require(_0xe823('0x0'));var rimraf=require(_0xe823('0x1'));var zipdir=require(_0xe823('0x2'));var jsonpatch=require(_0xe823('0x3'));var rp=require(_0xe823('0x4'));var moment=require(_0xe823('0x5'));var BPromise=require(_0xe823('0x6'));var Mustache=require(_0xe823('0x7'));var util=require(_0xe823('0x8'));var path=require(_0xe823('0x9'));var sox=require('sox');var csv=require(_0xe823('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe823('0xb'));var _=require('lodash');var squel=require(_0xe823('0xc'));var crypto=require(_0xe823('0xd'));var jsforce=require(_0xe823('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe823('0xf'));var Papa=require(_0xe823('0x10'));var Redis=require(_0xe823('0x11'));var authService=require(_0xe823('0x12'));var qs=require(_0xe823('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe823('0x14'))(_0xe823('0x15'));var utils=require(_0xe823('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe823('0x17'));var db=require(_0xe823('0x18'))['db'];function respondWithStatusCode(_0x404252,_0x3efbc9){_0x3efbc9=_0x3efbc9||0xcc;return function(_0x4cfde3){if(_0x4cfde3){return _0x404252['sendStatus'](_0x3efbc9);}return _0x404252[_0xe823('0x19')](_0x3efbc9)['end']();};}function respondWithResult(_0x1195e1,_0x26c7f3){_0x26c7f3=_0x26c7f3||0xc8;return function(_0x557ea6){if(_0x557ea6){return _0x1195e1['status'](_0x26c7f3)[_0xe823('0x1a')](_0x557ea6);}};}function respondWithFilteredResult(_0x23f8a5,_0x1f8e58){return function(_0xcc6306){if(_0xcc6306){var _0x2e9d1e=typeof _0x1f8e58[_0xe823('0x1b')]===_0xe823('0x1c')&&typeof _0x1f8e58[_0xe823('0x1d')]===_0xe823('0x1c');var _0x330747=_0xcc6306[_0xe823('0x1e')];var _0x4c0842=_0x2e9d1e?0x0:_0x1f8e58[_0xe823('0x1b')];var _0x16fa2d=_0x2e9d1e?_0xcc6306[_0xe823('0x1e')]:_0x1f8e58[_0xe823('0x1b')]+_0x1f8e58[_0xe823('0x1d')];var _0x4d25da;if(_0x16fa2d>=_0x330747){_0x16fa2d=_0x330747;_0x4d25da=0xc8;}else{_0x4d25da=0xce;}_0x23f8a5[_0xe823('0x19')](_0x4d25da);return _0x23f8a5[_0xe823('0x1f')]('Content-Range',_0x4c0842+'-'+_0x16fa2d+'/'+_0x330747)[_0xe823('0x1a')](_0xcc6306);}return null;};}function patchUpdates(_0x1b37b1){return function(_0xe503a0){try{jsonpatch[_0xe823('0x20')](_0xe503a0,_0x1b37b1,!![]);}catch(_0x17e3c2){return BPromise['reject'](_0x17e3c2);}return _0xe503a0[_0xe823('0x21')]();};}function saveUpdates(_0x1023a9,_0x423c27){return function(_0xc9e208){if(_0xc9e208){return _0xc9e208[_0xe823('0x22')](_0x1023a9)[_0xe823('0x23')](function(_0x2f8c2d){return _0x2f8c2d;});}return null;};}function removeEntity(_0x5b6bb6,_0x47369f){return function(_0x403c15){if(_0x403c15){return _0x403c15[_0xe823('0x24')]()[_0xe823('0x23')](function(){_0x5b6bb6[_0xe823('0x19')](0xcc)[_0xe823('0x25')]();});}};}function handleEntityNotFound(_0x2d9d76,_0x1475df){return function(_0x59eede){if(!_0x59eede){_0x2d9d76[_0xe823('0x26')](0x194);}return _0x59eede;};}function handleError(_0x587f40,_0x54eaee){_0x54eaee=_0x54eaee||0x1f4;return function(_0x559180){logger[_0xe823('0x27')](_0x559180['stack']);if(_0x559180[_0xe823('0x28')]){delete _0x559180['name'];}_0x587f40[_0xe823('0x19')](_0x54eaee)[_0xe823('0x29')](_0x559180);};}exports['index']=function(_0x31ee5f,_0x9f863d){var _0x182e67={},_0x224f47={},_0x35f38d={'count':0x0,'rows':[]};var _0x318284=_[_0xe823('0x2a')](db[_0xe823('0x2b')][_0xe823('0x2c')],function(_0x2df70d){return{'name':_0x2df70d[_0xe823('0x2d')],'type':_0x2df70d[_0xe823('0x2e')][_0xe823('0x2f')]};});_0x224f47['model']=_['map'](_0x318284,'name');_0x224f47[_0xe823('0x30')]=_[_0xe823('0x31')](_0x31ee5f['query']);_0x224f47[_0xe823('0x32')]=_[_0xe823('0x33')](_0x224f47['model'],_0x224f47[_0xe823('0x30')]);_0x182e67['attributes']=_['intersection'](_0x224f47[_0xe823('0x34')],qs[_0xe823('0x35')](_0x31ee5f[_0xe823('0x30')][_0xe823('0x35')]));_0x182e67[_0xe823('0x36')]=_0x182e67['attributes'][_0xe823('0x37')]?_0x182e67['attributes']:_0x224f47[_0xe823('0x34')];if(!_0x31ee5f['query'][_0xe823('0x38')](_0xe823('0x39'))){_0x182e67[_0xe823('0x1d')]=qs[_0xe823('0x1d')](_0x31ee5f[_0xe823('0x30')][_0xe823('0x1d')]);_0x182e67[_0xe823('0x1b')]=qs[_0xe823('0x1b')](_0x31ee5f[_0xe823('0x30')][_0xe823('0x1b')]);}_0x182e67[_0xe823('0x3a')]=qs[_0xe823('0x3b')](_0x31ee5f['query'][_0xe823('0x3b')]);_0x182e67[_0xe823('0x3c')]=qs[_0xe823('0x32')](_[_0xe823('0x3d')](_0x31ee5f[_0xe823('0x30')],_0x224f47[_0xe823('0x32')]),_0x318284);if(_0x31ee5f[_0xe823('0x30')][_0xe823('0x3e')]){_0x182e67[_0xe823('0x3c')]=_[_0xe823('0x3f')](_0x182e67[_0xe823('0x3c')],{'$or':_['map'](_0x318284,function(_0x453207){if(_0x453207[_0xe823('0x2e')]!==_0xe823('0x40')){var _0x216f70={};_0x216f70[_0x453207[_0xe823('0x28')]]={'$like':'%'+_0x31ee5f[_0xe823('0x30')]['filter']+'%'};return _0x216f70;}})});}_0x182e67=_[_0xe823('0x3f')]({},_0x182e67,_0x31ee5f[_0xe823('0x41')]);var _0x337055={'where':_0x182e67['where']};return db[_0xe823('0x2b')][_0xe823('0x1e')](_0x337055)[_0xe823('0x23')](function(_0xa35792){_0x35f38d[_0xe823('0x1e')]=_0xa35792;if(_0x31ee5f[_0xe823('0x30')][_0xe823('0x42')]){_0x182e67[_0xe823('0x43')]=[{'all':!![]}];}return db[_0xe823('0x2b')][_0xe823('0x44')](_0x182e67);})[_0xe823('0x23')](function(_0x379d74){_0x35f38d[_0xe823('0x45')]=_0x379d74;return _0x35f38d;})['then'](respondWithFilteredResult(_0x9f863d,_0x182e67))['catch'](handleError(_0x9f863d,null));};exports[_0xe823('0x46')]=function(_0x137185,_0x411741){var _0x285b3a={'raw':![],'where':{'id':_0x137185[_0xe823('0x47')]['id']}},_0x2f8a7e={};_0x2f8a7e[_0xe823('0x34')]=_[_0xe823('0x31')](db[_0xe823('0x2b')][_0xe823('0x2c')]);_0x2f8a7e['query']=_['keys'](_0x137185['query']);_0x2f8a7e['filters']=_[_0xe823('0x33')](_0x2f8a7e['model'],_0x2f8a7e[_0xe823('0x30')]);_0x285b3a[_0xe823('0x36')]=_[_0xe823('0x33')](_0x2f8a7e[_0xe823('0x34')],qs[_0xe823('0x35')](_0x137185[_0xe823('0x30')][_0xe823('0x35')]));_0x285b3a['attributes']=_0x285b3a[_0xe823('0x36')]['length']?_0x285b3a[_0xe823('0x36')]:_0x2f8a7e['model'];if(_0x137185[_0xe823('0x30')][_0xe823('0x42')]){_0x285b3a['include']=[{'all':!![]}];}_0x285b3a=_['merge']({},_0x285b3a,_0x137185['options']);return db['UserProfileSection'][_0xe823('0x48')](_0x285b3a)[_0xe823('0x23')](handleEntityNotFound(_0x411741,null))[_0xe823('0x23')](respondWithResult(_0x411741,null))[_0xe823('0x49')](handleError(_0x411741,null));};exports[_0xe823('0x4a')]=function(_0xa3d0f,_0xb6b1af){return db['UserProfileSection'][_0xe823('0x4a')](_0xa3d0f[_0xe823('0x4b')],{})['then'](respondWithResult(_0xb6b1af,0xc9))['catch'](handleError(_0xb6b1af,null));};exports[_0xe823('0x22')]=function(_0x4db7a1,_0x5e82f5){if(_0x4db7a1[_0xe823('0x4b')]['id']){delete _0x4db7a1['body']['id'];}return db[_0xe823('0x2b')][_0xe823('0x48')]({'where':{'id':_0x4db7a1[_0xe823('0x47')]['id']}})[_0xe823('0x23')](handleEntityNotFound(_0x5e82f5,null))[_0xe823('0x23')](saveUpdates(_0x4db7a1[_0xe823('0x4b')],null))[_0xe823('0x23')](respondWithResult(_0x5e82f5,null))[_0xe823('0x49')](handleError(_0x5e82f5,null));};exports[_0xe823('0x24')]=function(_0x36c1de,_0x2d5e76){return db[_0xe823('0x2b')]['find']({'where':{'id':_0x36c1de['params']['id']}})[_0xe823('0x23')](handleEntityNotFound(_0x2d5e76,null))['then'](removeEntity(_0x2d5e76,null))[_0xe823('0x49')](handleError(_0x2d5e76,null));};exports[_0xe823('0x4c')]=function(_0x26a73e,_0x51bcd1){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x51bcd1,null))[_0xe823('0x49')](handleError(_0x51bcd1,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c4dde23..8239cd1 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 _0xd23a=['exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./userProfileSection.attributes'];(function(_0x364407,_0x3729ac){var _0x27273c=function(_0x3bb114){while(--_0x3bb114){_0x364407['push'](_0x364407['shift']());}};_0x27273c(++_0x3729ac);}(_0xd23a,0x106));var _0xad23=function(_0x4828e5,_0x2667ff){_0x4828e5=_0x4828e5-0x0;var _0x52698e=_0xd23a[_0x4828e5];return _0x52698e;};'use strict';var _=require(_0xad23('0x0'));var util=require(_0xad23('0x1'));var logger=require(_0xad23('0x2'))(_0xad23('0x3'));var moment=require(_0xad23('0x4'));var BPromise=require('bluebird');var rp=require(_0xad23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad23('0x6'));var config=require('../../config/environment');var attributes=require(_0xad23('0x7'));module[_0xad23('0x8')]=function(_0x3139d2,_0x20405d){return _0x3139d2[_0xad23('0x9')](_0xad23('0xa'),attributes,{'tableName':_0xad23('0xb'),'paranoid':![],'indexes':[{'name':_0xad23('0xc'),'fields':[_0xad23('0xd'),_0xad23('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf792=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','UserProfileSection','compositeIndex','userProfileId','lodash'];(function(_0x6e3120,_0xf0dec3){var _0x35810d=function(_0x541efb){while(--_0x541efb){_0x6e3120['push'](_0x6e3120['shift']());}};_0x35810d(++_0xf0dec3);}(_0xf792,0x185));var _0x2f79=function(_0x482e74,_0x213914){_0x482e74=_0x482e74-0x0;var _0x435a0e=_0xf792[_0x482e74];return _0x435a0e;};'use strict';var _=require(_0x2f79('0x0'));var util=require('util');var logger=require(_0x2f79('0x1'))('api');var moment=require(_0x2f79('0x2'));var BPromise=require(_0x2f79('0x3'));var rp=require(_0x2f79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f79('0x5'));var attributes=require(_0x2f79('0x6'));module['exports']=function(_0x15f510,_0x27a89f){return _0x15f510['define'](_0x2f79('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x2f79('0x8'),'fields':['sectionId',_0x2f79('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 9d0f6d9..02286f0 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 _0x6f47=['request\x20sent','debug','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6f47,0xc7));var _0x76f4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6f47[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){return client[_0x76f4('0x9')](_0xfc2405,_0x497f99)[_0x76f4('0xa')](function(_0x101f55){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x2176a7,_0x76f4('0xb'));logger[_0x76f4('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2176a7,'request\x20sent',JSON[_0x76f4('0xd')](_0x101f55));if(_0x101f55[_0x76f4('0xe')]){if(_0x101f55[_0x76f4('0xe')][_0x76f4('0xf')]===0x1f4){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55[_0x76f4('0xe')][_0x76f4('0x11')]);return _0x25656d(_0x101f55[_0x76f4('0xe')]['message']);}logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55['error']['message']);return _0x1a3172(_0x101f55['error'][_0x76f4('0x11')]);}else{logger[_0x76f4('0x12')](_0x76f4('0x10'),_0x2176a7,_0x76f4('0xb'));_0x1a3172(_0x101f55[_0x76f4('0x13')][_0x76f4('0x11')]);}})[_0x76f4('0x14')](function(_0x981a87){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x981a87);_0x25656d(_0x981a87);});});} \ No newline at end of file +var _0x9362=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','request\x20sent','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','info','result','catch'];(function(_0x43111f,_0x32a1a2){var _0xfd01d9=function(_0x28f38c){while(--_0x28f38c){_0x43111f['push'](_0x43111f['shift']());}};_0xfd01d9(++_0x32a1a2);}(_0x9362,0x111));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2936('0x0'));var util=require(_0x2936('0x1'));var moment=require(_0x2936('0x2'));var BPromise=require('bluebird');var rs=require(_0x2936('0x3'));var fs=require('fs');var Redis=require(_0x2936('0x4'));var db=require(_0x2936('0x5'))['db'];var utils=require(_0x2936('0x6'));var logger=require(_0x2936('0x7'))('rpc');var config=require(_0x2936('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2936('0x9')][_0x2936('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1d50,_0x42154a,_0x2e89e7){return new BPromise(function(_0x83c45f,_0x21dc79){return client['request'](_0x4e1d50,_0x2e89e7)[_0x2936('0xb')](function(_0x4cea48){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x42154a,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x42154a,_0x2936('0xc'),JSON[_0x2936('0xd')](_0x4cea48));if(_0x4cea48[_0x2936('0xe')]){if(_0x4cea48['error'][_0x2936('0xf')]===0x1f4){logger[_0x2936('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x42154a,_0x4cea48['error'][_0x2936('0x10')]);return _0x21dc79(_0x4cea48['error'][_0x2936('0x10')]);}logger[_0x2936('0xe')](_0x2936('0x11'),_0x42154a,_0x4cea48['error'][_0x2936('0x10')]);return _0x83c45f(_0x4cea48[_0x2936('0xe')][_0x2936('0x10')]);}else{logger[_0x2936('0x12')](_0x2936('0x11'),_0x42154a,_0x2936('0xc'));_0x83c45f(_0x4cea48[_0x2936('0x13')][_0x2936('0x10')]);}})[_0x2936('0x14')](function(_0x348520){logger[_0x2936('0xe')](_0x2936('0x11'),_0x42154a,_0x348520);_0x21dc79(_0x348520);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 07bce10..3bb03cc 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3d07f2,_0x19854d){var _0x26052a=function(_0x213834){while(--_0x213834){_0x3d07f2['push'](_0x3d07f2['shift']());}};_0x26052a(++_0x19854d);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c6f37,_0x53bc84){var _0x4ae388=function(_0x32eb6a){while(--_0x32eb6a){_0x5c6f37['push'](_0x5c6f37['shift']());}};_0x4ae388(++_0x53bc84);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b6b0e09..9006424 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 _0xd053=['exports','sequelize'];(function(_0x3c3e8b,_0x4267f4){var _0x142a3d=function(_0x504d7c){while(--_0x504d7c){_0x3c3e8b['push'](_0x3c3e8b['shift']());}};_0x142a3d(++_0x4267f4);}(_0xd053,0xe7));var _0x3d05=function(_0x1c9cfb,_0x4efc3b){_0x1c9cfb=_0x1c9cfb-0x0;var _0x32436a=_0xd053[_0x1c9cfb];return _0x32436a;};'use strict';var Sequelize=require(_0x3d05('0x0'));module[_0x3d05('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index d7c7fdb..25f3188 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 _0x1893=['rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x274311,_0x2005ac){var _0x39df7e=function(_0x22fbb9){while(--_0x22fbb9){_0x274311['push'](_0x274311['shift']());}};_0x39df7e(++_0x2005ac);}(_0x1893,0xa2));var _0x3189=function(_0x20e40d,_0x2a9f0f){_0x20e40d=_0x20e40d-0x0;var _0x558350=_0x1893[_0x20e40d];return _0x558350;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3024=['user_has_sms_queues','lodash','util','api','moment','path','../../config/environment','./userSmsQueue.attributes','UserSmsQueue'];(function(_0x5913b4,_0x240b15){var _0x595d5b=function(_0x39e986){while(--_0x39e986){_0x5913b4['push'](_0x5913b4['shift']());}};_0x595d5b(++_0x240b15);}(_0x3024,0x64));var _0x4302=function(_0x119f18,_0x426c72){_0x119f18=_0x119f18-0x0;var _0x5c8c7a=_0x3024[_0x119f18];return _0x5c8c7a;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var logger=require('../../config/logger')(_0x4302('0x2'));var moment=require(_0x4302('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4302('0x4'));var rimraf=require('rimraf');var config=require(_0x4302('0x5'));var attributes=require(_0x4302('0x6'));module['exports']=function(_0x13d051,_0x5f20){return _0x13d051['define'](_0x4302('0x7'),attributes,{'tableName':_0x4302('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 57056e0..bfb4397 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 _0x3186=['code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x14e1b0,_0x52baa0){var _0x476338=function(_0x2c6f12){while(--_0x2c6f12){_0x14e1b0['push'](_0x14e1b0['shift']());}};_0x476338(++_0x52baa0);}(_0x3186,0x100));var _0x6318=function(_0x1b80cd,_0x2974e4){_0x1b80cd=_0x1b80cd-0x0;var _0x3ce5fd=_0x3186[_0x1b80cd];return _0x3ce5fd;};'use strict';var _=require('lodash');var util=require(_0x6318('0x0'));var moment=require(_0x6318('0x1'));var BPromise=require(_0x6318('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6318('0x3'));var db=require(_0x6318('0x4'))['db'];var utils=require(_0x6318('0x5'));var logger=require(_0x6318('0x6'))(_0x6318('0x7'));var config=require(_0x6318('0x8'));var jayson=require(_0x6318('0x9'));var client=jayson[_0x6318('0xa')][_0x6318('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42ae46,_0x1b1299,_0x456f33){return new BPromise(function(_0x39795b,_0x51fffb){return client[_0x6318('0xc')](_0x42ae46,_0x456f33)[_0x6318('0xd')](function(_0x1ae36d){logger[_0x6318('0xe')](_0x6318('0xf'),_0x1b1299,'request\x20sent');logger['debug'](_0x6318('0x10'),_0x1b1299,_0x6318('0x11'),JSON[_0x6318('0x12')](_0x1ae36d));if(_0x1ae36d[_0x6318('0x13')]){if(_0x1ae36d[_0x6318('0x13')][_0x6318('0x14')]===0x1f4){logger[_0x6318('0x13')](_0x6318('0xf'),_0x1b1299,_0x1ae36d[_0x6318('0x13')][_0x6318('0x15')]);return _0x51fffb(_0x1ae36d[_0x6318('0x13')][_0x6318('0x15')]);}logger[_0x6318('0x13')](_0x6318('0xf'),_0x1b1299,_0x1ae36d[_0x6318('0x13')][_0x6318('0x15')]);return _0x39795b(_0x1ae36d[_0x6318('0x13')][_0x6318('0x15')]);}else{logger[_0x6318('0xe')](_0x6318('0xf'),_0x1b1299,_0x6318('0x11'));_0x39795b(_0x1ae36d[_0x6318('0x16')][_0x6318('0x15')]);}})['catch'](function(_0xa77533){logger[_0x6318('0x13')](_0x6318('0xf'),_0x1b1299,_0xa77533);_0x51fffb(_0xa77533);});});} \ No newline at end of file +var _0xe199=['client','http','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe199,0xe9));var _0x9e19=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0xe199[_0x3c504b];return _0x2e5354;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9e19('0x0'));var BPromise=require(_0x9e19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e19('0x2'));var db=require(_0x9e19('0x3'))['db'];var utils=require(_0x9e19('0x4'));var logger=require(_0x9e19('0x5'))('rpc');var config=require(_0x9e19('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9e19('0x7')][_0x9e19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52e0af,_0x36b09f,_0x30f774){return new BPromise(function(_0x53435,_0x22194f){return client[_0x9e19('0x9')](_0x52e0af,_0x30f774)['then'](function(_0x2e0cb7){logger['info'](_0x9e19('0xa'),_0x36b09f,_0x9e19('0xb'));logger[_0x9e19('0xc')](_0x9e19('0xd'),_0x36b09f,_0x9e19('0xb'),JSON['stringify'](_0x2e0cb7));if(_0x2e0cb7['error']){if(_0x2e0cb7['error'][_0x9e19('0xe')]===0x1f4){logger[_0x9e19('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x36b09f,_0x2e0cb7[_0x9e19('0xf')][_0x9e19('0x10')]);return _0x22194f(_0x2e0cb7[_0x9e19('0xf')][_0x9e19('0x10')]);}logger[_0x9e19('0xf')](_0x9e19('0xa'),_0x36b09f,_0x2e0cb7['error']['message']);return _0x53435(_0x2e0cb7[_0x9e19('0xf')]['message']);}else{logger[_0x9e19('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x36b09f,'request\x20sent');_0x53435(_0x2e0cb7[_0x9e19('0x12')]['message']);}})[_0x9e19('0x13')](function(_0x3b1901){logger[_0x9e19('0xf')](_0x9e19('0xa'),_0x36b09f,_0x3b1901);_0x22194f(_0x3b1901);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3c99164..a79121a 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 _0x0944=['INTEGER','sequelize','exports'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x0944,0x70));var _0x4094=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x0944[_0x53afe9];return _0x396396;};'use strict';var Sequelize=require(_0x4094('0x0'));module[_0x4094('0x1')]={'UserId':{'type':Sequelize[_0x4094('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x34dc=['exports','INTEGER'];(function(_0x1d1b07,_0x30ee8c){var _0x56e08f=function(_0x2d46ff){while(--_0x2d46ff){_0x1d1b07['push'](_0x1d1b07['shift']());}};_0x56e08f(++_0x30ee8c);}(_0x34dc,0x19c));var _0xc34d=function(_0x49196f,_0x330ce2){_0x49196f=_0x49196f-0x0;var _0xdb7246=_0x34dc[_0x49196f];return _0xdb7246;};'use strict';var Sequelize=require('sequelize');module[_0xc34d('0x0')]={'UserId':{'type':Sequelize[_0xc34d('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 0c980e9..cf995e4 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(_0x1643a7,_0xd0ada6){var _0x4196cf=function(_0x3ccdb1){while(--_0x3ccdb1){_0x1643a7['push'](_0x1643a7['shift']());}};_0x4196cf(++_0xd0ada6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x569d2a,_0x5a787f){var _0x393524=function(_0x3e931a){while(--_0x3e931a){_0x569d2a['push'](_0x569d2a['shift']());}};_0x393524(++_0x5a787f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 c8dc3ce..1939871 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(_0x339c55,_0x4b2e92){var _0x3f2228=function(_0x2e9ba1){while(--_0x2e9ba1){_0x339c55['push'](_0x339c55['shift']());}};_0x3f2228(++_0x4b2e92);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xcb91[_0x13137e];return _0x346261;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5914c0,_0x4394fa){var _0x938860=function(_0x24777a){while(--_0x24777a){_0x5914c0['push'](_0x5914c0['shift']());}};_0x938860(++_0x4394fa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xcb91[_0x402c8f];return _0x11e809;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 023f203..eb59ab6 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8e0=['exports'];(function(_0x3a1522,_0x51684f){var _0x2c7785=function(_0xa99654){while(--_0xa99654){_0x3a1522['push'](_0x3a1522['shift']());}};_0x2c7785(++_0x51684f);}(_0xf8e0,0x103));var _0x0f8e=function(_0x1c3c59,_0x5f251a){_0x1c3c59=_0x1c3c59-0x0;var _0x1100b7=_0xf8e0[_0x1c3c59];return _0x1100b7;};'use strict';var Sequelize=require('sequelize');module[_0x0f8e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x462f=['exports'];(function(_0x564242,_0x4159f7){var _0x2906fb=function(_0xed2acc){while(--_0xed2acc){_0x564242['push'](_0x564242['shift']());}};_0x2906fb(++_0x4159f7);}(_0x462f,0x1c5));var _0xf462=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x462f[_0x1ac6e5];return _0x5877dc;};'use strict';var Sequelize=require('sequelize');module[_0xf462('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 7ad946b..d0d8d80 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 _0x96ed=['request-promise','path','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4f99d7,_0xccdad){var _0xa15f5b=function(_0x552ed5){while(--_0x552ed5){_0x4f99d7['push'](_0x4f99d7['shift']());}};_0xa15f5b(++_0xccdad);}(_0x96ed,0x1db));var _0xd96e=function(_0x41a7da,_0xe4c8ed){_0x41a7da=_0x41a7da-0x0;var _0x313230=_0x96ed[_0x41a7da];return _0x313230;};'use strict';var _=require(_0xd96e('0x0'));var util=require(_0xd96e('0x1'));var logger=require(_0xd96e('0x2'))('api');var moment=require(_0xd96e('0x3'));var BPromise=require(_0xd96e('0x4'));var rp=require(_0xd96e('0x5'));var fs=require('fs');var path=require(_0xd96e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd96e('0x7'));module[_0xd96e('0x8')]=function(_0x14ba3f,_0x793e68){return _0x14ba3f['define']('UserVoiceQueue',attributes,{'tableName':_0xd96e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x734c=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x8d695e,_0x394999){var _0x3d156e=function(_0x38cf6f){while(--_0x38cf6f){_0x8d695e['push'](_0x8d695e['shift']());}};_0x3d156e(++_0x394999);}(_0x734c,0x6c));var _0xc734=function(_0x8003ab,_0x2b09b0){_0x8003ab=_0x8003ab-0x0;var _0x4b7c8b=_0x734c[_0x8003ab];return _0x4b7c8b;};'use strict';var _=require(_0xc734('0x0'));var util=require(_0xc734('0x1'));var logger=require(_0xc734('0x2'))(_0xc734('0x3'));var moment=require(_0xc734('0x4'));var BPromise=require('bluebird');var rp=require(_0xc734('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc734('0x6'));var config=require(_0xc734('0x7'));var attributes=require(_0xc734('0x8'));module[_0xc734('0x9')]=function(_0x130ce1,_0x9b3a56){return _0x130ce1[_0xc734('0xa')](_0xc734('0xb'),attributes,{'tableName':'user_has_voice_queues','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 a4970e8..cac1c65 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 _0x59c1=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x275107,_0x2e203e){var _0x1cf9d8=function(_0x42f464){while(--_0x42f464){_0x275107['push'](_0x275107['shift']());}};_0x1cf9d8(++_0x2e203e);}(_0x59c1,0x1ec));var _0x159c=function(_0x20a55d,_0x35e042){_0x20a55d=_0x20a55d-0x0;var _0x1265e0=_0x59c1[_0x20a55d];return _0x1265e0;};'use strict';var _=require(_0x159c('0x0'));var util=require('util');var moment=require(_0x159c('0x1'));var BPromise=require(_0x159c('0x2'));var rs=require(_0x159c('0x3'));var fs=require('fs');var Redis=require(_0x159c('0x4'));var db=require(_0x159c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x159c('0x6'))(_0x159c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x159c('0x8')][_0x159c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a25fe,_0x55df1b,_0x26bffc){return new BPromise(function(_0x5da51f,_0x1d7fad){return client[_0x159c('0xa')](_0x5a25fe,_0x26bffc)[_0x159c('0xb')](function(_0x5873bf){logger[_0x159c('0xc')](_0x159c('0xd'),_0x55df1b,_0x159c('0xe'));logger[_0x159c('0xf')](_0x159c('0x10'),_0x55df1b,_0x159c('0xe'),JSON[_0x159c('0x11')](_0x5873bf));if(_0x5873bf[_0x159c('0x12')]){if(_0x5873bf[_0x159c('0x12')][_0x159c('0x13')]===0x1f4){logger[_0x159c('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x55df1b,_0x5873bf[_0x159c('0x12')][_0x159c('0x14')]);return _0x1d7fad(_0x5873bf[_0x159c('0x12')][_0x159c('0x14')]);}logger['error'](_0x159c('0xd'),_0x55df1b,_0x5873bf[_0x159c('0x12')][_0x159c('0x14')]);return _0x5da51f(_0x5873bf[_0x159c('0x12')]['message']);}else{logger[_0x159c('0xc')](_0x159c('0xd'),_0x55df1b,_0x159c('0xe'));_0x5da51f(_0x5873bf[_0x159c('0x15')]['message']);}})[_0x159c('0x16')](function(_0x180fa4){logger[_0x159c('0x12')](_0x159c('0xd'),_0x55df1b,_0x180fa4);_0x1d7fad(_0x180fa4);});});} \ No newline at end of file +var _0x73cc=['catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserVoiceQueue,\x20%s,\x20%s','info','result'];(function(_0x5dad24,_0x5e0a80){var _0x721689=function(_0x183d81){while(--_0x183d81){_0x5dad24['push'](_0x5dad24['shift']());}};_0x721689(++_0x5e0a80);}(_0x73cc,0x1cf));var _0xc73c=function(_0x54e723,_0x13c6bf){_0x54e723=_0x54e723-0x0;var _0x220461=_0x73cc[_0x54e723];return _0x220461;};'use strict';var _=require('lodash');var util=require(_0xc73c('0x0'));var moment=require(_0xc73c('0x1'));var BPromise=require(_0xc73c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc73c('0x3'))['db'];var utils=require(_0xc73c('0x4'));var logger=require(_0xc73c('0x5'))(_0xc73c('0x6'));var config=require(_0xc73c('0x7'));var jayson=require(_0xc73c('0x8'));var client=jayson[_0xc73c('0x9')][_0xc73c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51009d,_0x1410ca,_0x4bc761){return new BPromise(function(_0x3e3987,_0x2d89d8){return client['request'](_0x51009d,_0x4bc761)[_0xc73c('0xb')](function(_0x5ea63c){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x1410ca,'request\x20sent');logger[_0xc73c('0xc')](_0xc73c('0xd'),_0x1410ca,_0xc73c('0xe'),JSON['stringify'](_0x5ea63c));if(_0x5ea63c['error']){if(_0x5ea63c[_0xc73c('0xf')][_0xc73c('0x10')]===0x1f4){logger[_0xc73c('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x1410ca,_0x5ea63c['error']['message']);return _0x2d89d8(_0x5ea63c[_0xc73c('0xf')][_0xc73c('0x11')]);}logger[_0xc73c('0xf')](_0xc73c('0x12'),_0x1410ca,_0x5ea63c[_0xc73c('0xf')][_0xc73c('0x11')]);return _0x3e3987(_0x5ea63c[_0xc73c('0xf')][_0xc73c('0x11')]);}else{logger[_0xc73c('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x1410ca,'request\x20sent');_0x3e3987(_0x5ea63c[_0xc73c('0x14')]['message']);}})[_0xc73c('0x15')](function(_0x292608){logger[_0xc73c('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x1410ca,_0x292608);_0x2d89d8(_0x292608);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4a15f0c..3630ff5 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(_0x37ffc6,_0x251b7f){var _0x47faac=function(_0x2c8090){while(--_0x2c8090){_0x37ffc6['push'](_0x37ffc6['shift']());}};_0x47faac(++_0x251b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe41644,_0xf7753d){var _0x1b741c=function(_0x69c22a){while(--_0x69c22a){_0xe41644['push'](_0xe41644['shift']());}};_0x1b741c(++_0xf7753d);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 06d9682..4db1761 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 _0x1a2a=['exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x78994f,_0x17638c){var _0x19dc18=function(_0x5345ae){while(--_0x5345ae){_0x78994f['push'](_0x78994f['shift']());}};_0x19dc18(++_0x17638c);}(_0x1a2a,0x83));var _0xa1a2=function(_0x26e2e8,_0x105b22){_0x26e2e8=_0x26e2e8-0x0;var _0x238da5=_0x1a2a[_0x26e2e8];return _0x238da5;};'use strict';var Sequelize=require(_0xa1a2('0x0'));module[_0xa1a2('0x1')]={'uniqueid':{'type':Sequelize[_0xa1a2('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xa1a2('0x3')],'allowNull':![],'comment':_0xa1a2('0x4')},'UserId':{'type':Sequelize[_0xa1a2('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa1a2('0x3')],'allowNull':![],'unique':_0xa1a2('0x5'),'comment':_0xa1a2('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa1a2('0x3')],'allowNull':![],'unique':_0xa1a2('0x5'),'comment':_0xa1a2('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa1a2('0x4')}}; \ No newline at end of file +var _0xe821=['INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x1f640e,_0x4c3269){var _0xd9c556=function(_0x5b0673){while(--_0x5b0673){_0x1f640e['push'](_0x1f640e['shift']());}};_0xd9c556(++_0x4c3269);}(_0xe821,0x140));var _0x1e82=function(_0x5804f9,_0x47e787){_0x5804f9=_0x5804f9-0x0;var _0x2245d5=_0xe821[_0x5804f9];return _0x2245d5;};'use strict';var Sequelize=require(_0x1e82('0x0'));module[_0x1e82('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1e82('0x2')},'membername':{'type':Sequelize[_0x1e82('0x3')],'allowNull':![],'comment':_0x1e82('0x2')},'UserId':{'type':Sequelize[_0x1e82('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1e82('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x1e82('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1e82('0x5'),'comment':_0x1e82('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1e82('0x2')},'paused':{'type':Sequelize[_0x1e82('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6a38991..e1e2e74 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 _0xee4d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x505e41,_0x28d6ae){var _0x4c594b=function(_0x5a7e07){while(--_0x5a7e07){_0x505e41['push'](_0x505e41['shift']());}};_0x4c594b(++_0x28d6ae);}(_0xee4d,0x133));var _0xdee4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xee4d[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require(_0xdee4('0x0'));var UserVoiceQueueRt=require(_0xdee4('0x1'))['db'][_0xdee4('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xdee4('0x3')](0x0);var events={'afterCreate':_0xdee4('0x4'),'afterUpdate':'update','afterDestroy':_0xdee4('0x5')};function emitEvent(_0x14b8a0){return function(_0x206e75,_0x1f8206,_0x215750){UserVoiceQueueRtEvents[_0xdee4('0x6')](_0x14b8a0+':'+_0x206e75['id'],_0x206e75);UserVoiceQueueRtEvents[_0xdee4('0x6')](_0x14b8a0,_0x206e75);_0x215750(null);};}for(var e in events){if(events[_0xdee4('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xdee4('0x8')](e,emitEvent(event));}}module[_0xdee4('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8f81=['hook','exports','events','UserVoiceQueueRt','setMaxListeners','update','remove','emit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8f81,0x1b2));var _0x18f8=function(_0x227fef,_0x165aa9){_0x227fef=_0x227fef-0x0;var _0x70f829=_0x8f81[_0x227fef];return _0x70f829;};'use strict';var EventEmitter=require(_0x18f8('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x18f8('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x18f8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x18f8('0x3'),'afterDestroy':_0x18f8('0x4')};function emitEvent(_0x44dd0a){return function(_0x2535cb,_0x3f82bf,_0x506870){UserVoiceQueueRtEvents[_0x18f8('0x5')](_0x44dd0a+':'+_0x2535cb['id'],_0x2535cb);UserVoiceQueueRtEvents['emit'](_0x44dd0a,_0x2535cb);_0x506870(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x18f8('0x6')](e,emitEvent(event));}}module[_0x18f8('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index eb2c195..4df1235 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 _0x1319=['rimraf','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','moment','bluebird','request-promise','path'];(function(_0x4095a7,_0x2f89f5){var _0x29f428=function(_0x3ae4e8){while(--_0x3ae4e8){_0x4095a7['push'](_0x4095a7['shift']());}};_0x29f428(++_0x2f89f5);}(_0x1319,0x1d0));var _0x9131=function(_0x4ae461,_0x32f69f){_0x4ae461=_0x4ae461-0x0;var _0x5c86c3=_0x1319[_0x4ae461];return _0x5c86c3;};'use strict';var _=require(_0x9131('0x0'));var util=require(_0x9131('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9131('0x2'));var BPromise=require(_0x9131('0x3'));var rp=require(_0x9131('0x4'));var fs=require('fs');var path=require(_0x9131('0x5'));var rimraf=require(_0x9131('0x6'));var config=require('../../config/environment');var attributes=require(_0x9131('0x7'));module['exports']=function(_0xd9aba,_0x5057d2){return _0xd9aba['define'](_0x9131('0x8'),attributes,{'tableName':_0x9131('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eb0=['../../config/environment','./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x55b440,_0x4c5944){var _0x1a5c34=function(_0x226f81){while(--_0x226f81){_0x55b440['push'](_0x55b440['shift']());}};_0x1a5c34(++_0x4c5944);}(_0x7eb0,0x1d8));var _0x07eb=function(_0x12f729,_0x414035){_0x12f729=_0x12f729-0x0;var _0x4c472e=_0x7eb0[_0x12f729];return _0x4c472e;};'use strict';var _=require(_0x07eb('0x0'));var util=require(_0x07eb('0x1'));var logger=require('../../config/logger')(_0x07eb('0x2'));var moment=require(_0x07eb('0x3'));var BPromise=require(_0x07eb('0x4'));var rp=require(_0x07eb('0x5'));var fs=require('fs');var path=require(_0x07eb('0x6'));var rimraf=require(_0x07eb('0x7'));var config=require(_0x07eb('0x8'));var attributes=require(_0x07eb('0x9'));module['exports']=function(_0x576db3,_0x3b981e){return _0x576db3[_0x07eb('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x07eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 733a64c..1ab74db 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 _0xc098=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','literal','outboundQueuePauses','util','moment'];(function(_0x146b70,_0x2c1c8b){var _0x321045=function(_0x4388bb){while(--_0x4388bb){_0x146b70['push'](_0x146b70['shift']());}};_0x321045(++_0x2c1c8b);}(_0xc098,0x139));var _0x8c09=function(_0x4747a6,_0x1c4b72){_0x4747a6=_0x4747a6-0x0;var _0x9f2351=_0xc098[_0x4747a6];return _0x9f2351;};'use strict';var _=require('lodash');var util=require(_0x8c09('0x0'));var moment=require(_0x8c09('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c09('0x2'));var fs=require('fs');var Redis=require(_0x8c09('0x3'));var db=require(_0x8c09('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c09('0x5'))(_0x8c09('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c09('0x7'));var client=jayson[_0x8c09('0x8')][_0x8c09('0x9')]({'port':0x232a});config[_0x8c09('0xa')]=_[_0x8c09('0xb')](config[_0x8c09('0xa')],{'host':_0x8c09('0xc'),'port':0x18eb});var socket=require(_0x8c09('0xd'))(new Redis(config[_0x8c09('0xa')]));require('./userVoiceQueueRt.socket')[_0x8c09('0xe')](socket);function respondWithRpcPromise(_0xd9c46,_0x591991,_0x14c454){return new BPromise(function(_0x29b850,_0x25d279){return client[_0x8c09('0xf')](_0xd9c46,_0x14c454)[_0x8c09('0x10')](function(_0x5ae09c){logger[_0x8c09('0x11')](_0x8c09('0x12'),_0x591991,_0x8c09('0x13'));logger[_0x8c09('0x14')](_0x8c09('0x15'),_0x591991,'request\x20sent',JSON[_0x8c09('0x16')](_0x5ae09c));if(_0x5ae09c['error']){if(_0x5ae09c[_0x8c09('0x17')][_0x8c09('0x18')]===0x1f4){logger[_0x8c09('0x17')](_0x8c09('0x12'),_0x591991,_0x5ae09c['error'][_0x8c09('0x19')]);return _0x25d279(_0x5ae09c['error'][_0x8c09('0x19')]);}logger[_0x8c09('0x17')](_0x8c09('0x12'),_0x591991,_0x5ae09c[_0x8c09('0x17')]['message']);return _0x29b850(_0x5ae09c[_0x8c09('0x17')]['message']);}else{logger[_0x8c09('0x11')](_0x8c09('0x12'),_0x591991,_0x8c09('0x13'));_0x29b850(_0x5ae09c['result']['message']);}})['catch'](function(_0x5369c0){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x591991,_0x5369c0);_0x25d279(_0x5369c0);});});}exports[_0x8c09('0x1a')]=function(_0x32b67a){var _0x10b804=this;return new Promise(function(_0x100f7a,_0x259989){return db[_0x8c09('0x1b')][_0x8c09('0x1c')]({'raw':_0x32b67a[_0x8c09('0x1d')]?_0x32b67a['options']['raw']===undefined?!![]:![]:!![],'where':_0x32b67a[_0x8c09('0x1d')]?_0x32b67a[_0x8c09('0x1d')][_0x8c09('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8c09('0x1f'),db[_0x8c09('0x20')]['fn']('IF',db[_0x8c09('0x20')][_0x8c09('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0x8c09('0x22')]]})[_0x8c09('0x10')](function(_0x43af0d){logger[_0x8c09('0x11')](_0x8c09('0x1a'),_0x32b67a);logger['debug'](_0x8c09('0x1a'),_0x32b67a,JSON[_0x8c09('0x16')](_0x43af0d));_0x100f7a(_0x43af0d);})['catch'](function(_0x40027e){logger['error'](_0x8c09('0x1a'),_0x40027e[_0x8c09('0x19')],_0x32b67a);_0x259989(_0x10b804[_0x8c09('0x17')](0x1f4,_0x40027e[_0x8c09('0x19')]));});});}; \ No newline at end of file +var _0x4913=['where','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','options','raw'];(function(_0x2f5ff7,_0x5de820){var _0x299d73=function(_0x23b5a8){while(--_0x23b5a8){_0x2f5ff7['push'](_0x2f5ff7['shift']());}};_0x299d73(++_0x5de820);}(_0x4913,0xfb));var _0x3491=function(_0x31d040,_0x9293fa){_0x31d040=_0x31d040-0x0;var _0x814d6e=_0x4913[_0x31d040];return _0x814d6e;};'use strict';var _=require(_0x3491('0x0'));var util=require(_0x3491('0x1'));var moment=require(_0x3491('0x2'));var BPromise=require(_0x3491('0x3'));var rs=require(_0x3491('0x4'));var fs=require('fs');var Redis=require(_0x3491('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3491('0x6'));var logger=require(_0x3491('0x7'))(_0x3491('0x8'));var config=require('../../config/environment');var jayson=require(_0x3491('0x9'));var client=jayson['client'][_0x3491('0xa')]({'port':0x232a});config[_0x3491('0xb')]=_[_0x3491('0xc')](config[_0x3491('0xb')],{'host':_0x3491('0xd'),'port':0x18eb});var socket=require(_0x3491('0xe'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x3491('0xf')](socket);function respondWithRpcPromise(_0x2a4324,_0x16108c,_0x4d8794){return new BPromise(function(_0x26866e,_0x1b65b5){return client[_0x3491('0x10')](_0x2a4324,_0x4d8794)[_0x3491('0x11')](function(_0x4b1b30){logger[_0x3491('0x12')](_0x3491('0x13'),_0x16108c,_0x3491('0x14'));logger[_0x3491('0x15')](_0x3491('0x16'),_0x16108c,_0x3491('0x14'),JSON[_0x3491('0x17')](_0x4b1b30));if(_0x4b1b30[_0x3491('0x18')]){if(_0x4b1b30[_0x3491('0x18')]['code']===0x1f4){logger['error'](_0x3491('0x13'),_0x16108c,_0x4b1b30['error'][_0x3491('0x19')]);return _0x1b65b5(_0x4b1b30['error'][_0x3491('0x19')]);}logger[_0x3491('0x18')](_0x3491('0x13'),_0x16108c,_0x4b1b30[_0x3491('0x18')]['message']);return _0x26866e(_0x4b1b30['error'][_0x3491('0x19')]);}else{logger[_0x3491('0x12')](_0x3491('0x13'),_0x16108c,_0x3491('0x14'));_0x26866e(_0x4b1b30[_0x3491('0x1a')][_0x3491('0x19')]);}})['catch'](function(_0x298c98){logger[_0x3491('0x18')](_0x3491('0x13'),_0x16108c,_0x298c98);_0x1b65b5(_0x298c98);});});}exports['GetVoiceQueueRtPauses']=function(_0xcd4334){var _0x2f9935=this;return new Promise(function(_0x24dec4,_0x5efd73){return db['UserVoiceQueueRt']['findAll']({'raw':_0xcd4334[_0x3491('0x1b')]?_0xcd4334['options'][_0x3491('0x1c')]===undefined?!![]:![]:!![],'where':_0xcd4334[_0x3491('0x1b')]?_0xcd4334['options'][_0x3491('0x1d')]||null:null,'attributes':[[db[_0x3491('0x1e')]['fn'](_0x3491('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x3491('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x3491('0x21')]]})[_0x3491('0x11')](function(_0x40dc4a){logger[_0x3491('0x12')](_0x3491('0x22'),_0xcd4334);logger[_0x3491('0x15')](_0x3491('0x22'),_0xcd4334,JSON[_0x3491('0x17')](_0x40dc4a));_0x24dec4(_0x40dc4a);})['catch'](function(_0x3a9cd5){logger['error'](_0x3491('0x22'),_0x3a9cd5[_0x3491('0x19')],_0xcd4334);_0x5efd73(_0x2f9935[_0x3491('0x18')](0x1f4,_0x3a9cd5[_0x3491('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index bccf89e..ba4cfed 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 _0xe4d9=['emit','removeListener','register','./userVoiceQueueRt.events','save','remove'];(function(_0x3f4d13,_0x534113){var _0x48e589=function(_0x3062b5){while(--_0x3062b5){_0x3f4d13['push'](_0x3f4d13['shift']());}};_0x48e589(++_0x534113);}(_0xe4d9,0x141));var _0x9e4d=function(_0x2afce1,_0x433289){_0x2afce1=_0x2afce1-0x0;var _0x146b41=_0xe4d9[_0x2afce1];return _0x146b41;};'use strict';var UserVoiceQueueRtEvents=require(_0x9e4d('0x0'));var events=[_0x9e4d('0x1'),_0x9e4d('0x2'),'update'];function createListener(_0x42b34c,_0x5856ea){return function(_0x5d50b0){_0x5856ea[_0x9e4d('0x3')](_0x42b34c,_0x5d50b0);};}function removeListener(_0x228328,_0x581985){return function(){UserVoiceQueueRtEvents[_0x9e4d('0x4')](_0x228328,_0x581985);};}exports[_0x9e4d('0x5')]=function(_0x5a4881){for(var _0x493fb5=0x0,_0x74b14=events['length'];_0x493fb5<_0x74b14;_0x493fb5++){var _0x5af2a0=events[_0x493fb5];var _0x36ec30=createListener('userVoiceQueueRt:'+_0x5af2a0,_0x5a4881);UserVoiceQueueRtEvents['on'](_0x5af2a0,_0x36ec30);}}; \ No newline at end of file +var _0xa280=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa280,0xc4));var _0x0a28=function(_0x4dd373,_0x122f3a){_0x4dd373=_0x4dd373-0x0;var _0x468744=_0xa280[_0x4dd373];return _0x468744;};'use strict';var UserVoiceQueueRtEvents=require(_0x0a28('0x0'));var events=[_0x0a28('0x1'),'remove',_0x0a28('0x2')];function createListener(_0x42078f,_0x2d62ae){return function(_0x1e6fa9){_0x2d62ae[_0x0a28('0x3')](_0x42078f,_0x1e6fa9);};}function removeListener(_0x3054f1,_0x39026f){return function(){UserVoiceQueueRtEvents[_0x0a28('0x4')](_0x3054f1,_0x39026f);};}exports[_0x0a28('0x5')]=function(_0x3b8362){for(var _0x297fe1=0x0,_0x4705e4=events[_0x0a28('0x6')];_0x297fe1<_0x4705e4;_0x297fe1++){var _0x1d6c13=events[_0x297fe1];var _0x1d627c=createListener(_0x0a28('0x7')+_0x1d6c13,_0x3b8362);UserVoiceQueueRtEvents['on'](_0x1d6c13,_0x1d627c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0ca7542..030e17e 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x42aee4,_0xf63714){var _0x19007c=function(_0x388258){while(--_0x388258){_0x42aee4['push'](_0x42aee4['shift']());}};_0x19007c(++_0xf63714);}(_0xe706,0xa3));var _0x6e70=function(_0x26dcd8,_0x461d6b){_0x26dcd8=_0x26dcd8-0x0;var _0x1654e9=_0xe706[_0x26dcd8];return _0x1654e9;};'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(_0xb1f54f,_0x271d38){var _0x15cee4=function(_0x33f2a3){while(--_0x33f2a3){_0xb1f54f['push'](_0xb1f54f['shift']());}};_0x15cee4(++_0x271d38);}(_0x70e0,0x17b));var _0x070e=function(_0x3997bb,_0x324ce5){_0x3997bb=_0x3997bb-0x0;var _0x166392=_0x70e0[_0x3997bb];return _0x166392;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 03be1af..274e86f 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 _0x1a7a=['INTEGER','exports'];(function(_0x24783a,_0x75041){var _0x227a77=function(_0x2b736d){while(--_0x2b736d){_0x24783a['push'](_0x24783a['shift']());}};_0x227a77(++_0x75041);}(_0x1a7a,0x1e5));var _0xa1a7=function(_0x141352,_0x5aa338){_0x141352=_0x141352-0x0;var _0x3d8110=_0x1a7a[_0x141352];return _0x3d8110;};'use strict';var Sequelize=require('sequelize');module[_0xa1a7('0x0')]={'penalty':{'type':Sequelize[_0xa1a7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4ce=['INTEGER'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd4ce,0xb3));var _0xed4c=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xd4ce[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xed4c('0x0')],'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 6ef4488..beccf3f 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 _0xcca2=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','define'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0xcca2,0xa2));var _0x2cca=function(_0x24787c,_0x2c604a){_0x24787c=_0x24787c-0x0;var _0x4a0141=_0xcca2[_0x24787c];return _0x4a0141;};'use strict';var _=require(_0x2cca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2cca('0x1'));var moment=require(_0x2cca('0x2'));var BPromise=require('bluebird');var rp=require(_0x2cca('0x3'));var fs=require('fs');var path=require(_0x2cca('0x4'));var rimraf=require('rimraf');var config=require(_0x2cca('0x5'));var attributes=require(_0x2cca('0x6'));module['exports']=function(_0x12b20c,_0x46669b){return _0x12b20c[_0x2cca('0x7')](_0x2cca('0x8'),attributes,{'tableName':_0x2cca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0464=['api','moment','path','rimraf','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x0464,0xef));var _0x4046=function(_0x1af5a8,_0x1b1723){_0x1af5a8=_0x1af5a8-0x0;var _0xba9f46=_0x0464[_0x1af5a8];return _0xba9f46;};'use strict';var _=require(_0x4046('0x0'));var util=require(_0x4046('0x1'));var logger=require(_0x4046('0x2'))(_0x4046('0x3'));var moment=require(_0x4046('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4046('0x5'));var rimraf=require(_0x4046('0x6'));var config=require('../../config/environment');var attributes=require(_0x4046('0x7'));module['exports']=function(_0x4f1f1c,_0x1a660e){return _0x4f1f1c[_0x4046('0x8')](_0x4046('0x9'),attributes,{'tableName':_0x4046('0xa'),'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 2a3ea94..eb4089b 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 _0x6751=['message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x6751,0x18e));var _0x1675=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x6751[_0x179c4a];return _0x5d1879;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1675('0x0'));var BPromise=require(_0x1675('0x1'));var rs=require(_0x1675('0x2'));var fs=require('fs');var Redis=require(_0x1675('0x3'));var db=require(_0x1675('0x4'))['db'];var utils=require(_0x1675('0x5'));var logger=require(_0x1675('0x6'))('rpc');var config=require(_0x1675('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1675('0x8')][_0x1675('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c741,_0x147f1a,_0x235228){return new BPromise(function(_0x3a6a40,_0x334589){return client[_0x1675('0xa')](_0x20c741,_0x235228)[_0x1675('0xb')](function(_0x36f586){logger[_0x1675('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x147f1a,_0x1675('0xd'));logger[_0x1675('0xe')](_0x1675('0xf'),_0x147f1a,'request\x20sent',JSON[_0x1675('0x10')](_0x36f586));if(_0x36f586['error']){if(_0x36f586[_0x1675('0x11')][_0x1675('0x12')]===0x1f4){logger[_0x1675('0x11')](_0x1675('0x13'),_0x147f1a,_0x36f586[_0x1675('0x11')][_0x1675('0x14')]);return _0x334589(_0x36f586[_0x1675('0x11')][_0x1675('0x14')]);}logger[_0x1675('0x11')](_0x1675('0x13'),_0x147f1a,_0x36f586[_0x1675('0x11')]['message']);return _0x3a6a40(_0x36f586[_0x1675('0x11')][_0x1675('0x14')]);}else{logger[_0x1675('0xc')](_0x1675('0x13'),_0x147f1a,'request\x20sent');_0x3a6a40(_0x36f586['result'][_0x1675('0x14')]);}})[_0x1675('0x15')](function(_0x1ce925){logger['error'](_0x1675('0x13'),_0x147f1a,_0x1ce925);_0x334589(_0x1ce925);});});} \ No newline at end of file +var _0xa0cc=['http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x36cc69,_0x281b82){var _0x25f50b=function(_0x12d15e){while(--_0x12d15e){_0x36cc69['push'](_0x36cc69['shift']());}};_0x25f50b(++_0x281b82);}(_0xa0cc,0x1ee));var _0xca0c=function(_0xf5791b,_0x17ac7c){_0xf5791b=_0xf5791b-0x0;var _0x26d912=_0xa0cc[_0xf5791b];return _0x26d912;};'use strict';var _=require(_0xca0c('0x0'));var util=require(_0xca0c('0x1'));var moment=require('moment');var BPromise=require(_0xca0c('0x2'));var rs=require(_0xca0c('0x3'));var fs=require('fs');var Redis=require(_0xca0c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xca0c('0x5'));var logger=require('../../config/logger')(_0xca0c('0x6'));var config=require(_0xca0c('0x7'));var jayson=require(_0xca0c('0x8'));var client=jayson[_0xca0c('0x9')][_0xca0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43bb60,_0x33be50,_0x2d56d1){return new BPromise(function(_0x514380,_0x1b0bbb){return client[_0xca0c('0xb')](_0x43bb60,_0x2d56d1)[_0xca0c('0xc')](function(_0x760d73){logger['info'](_0xca0c('0xd'),_0x33be50,_0xca0c('0xe'));logger[_0xca0c('0xf')](_0xca0c('0x10'),_0x33be50,'request\x20sent',JSON['stringify'](_0x760d73));if(_0x760d73[_0xca0c('0x11')]){if(_0x760d73[_0xca0c('0x11')][_0xca0c('0x12')]===0x1f4){logger['error'](_0xca0c('0xd'),_0x33be50,_0x760d73[_0xca0c('0x11')]['message']);return _0x1b0bbb(_0x760d73[_0xca0c('0x11')]['message']);}logger[_0xca0c('0x11')](_0xca0c('0xd'),_0x33be50,_0x760d73['error']['message']);return _0x514380(_0x760d73[_0xca0c('0x11')]['message']);}else{logger['info'](_0xca0c('0xd'),_0x33be50,_0xca0c('0xe'));_0x514380(_0x760d73[_0xca0c('0x13')]['message']);}})[_0xca0c('0x14')](function(_0x224a49){logger[_0xca0c('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x33be50,_0x224a49);_0x1b0bbb(_0x224a49);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 13f2d09..b65e8b6 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 _0x5a8c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','multer','util'];(function(_0x561467,_0x4e72f3){var _0x3ea7eb=function(_0x17e100){while(--_0x17e100){_0x561467['push'](_0x561467['shift']());}};_0x3ea7eb(++_0x4e72f3);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x4f0054,_0x6dc732){_0x4f0054=_0x4f0054-0x0;var _0x507888=_0x5a8c[_0x4f0054];return _0x507888;};'use strict';var multer=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var path=require('path');var timeout=require(_0xc5a8('0x2'));var express=require(_0xc5a8('0x3'));var router=express[_0xc5a8('0x4')]();var fs_extra=require(_0xc5a8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var controller=require('./variable.controller');router[_0xc5a8('0x8')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xa')]);router[_0xc5a8('0x8')](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xc')]);router[_0xc5a8('0xd')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xe')]);router[_0xc5a8('0xf')]('/:id',auth[_0xc5a8('0x9')](),controller['update']);router[_0xc5a8('0x10')](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3c7b=['connect-timeout','express','../../config/environment','./variable.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x4f1b3b,_0x3ad55e){var _0x25c330=function(_0x59a8c5){while(--_0x59a8c5){_0x4f1b3b['push'](_0x4f1b3b['shift']());}};_0x25c330(++_0x3ad55e);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x1cc7af,_0x2da219){_0x1cc7af=_0x1cc7af-0x0;var _0x201581=_0x3c7b[_0x1cc7af];return _0x201581;};'use strict';var multer=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var path=require(_0xb3c7('0x2'));var timeout=require(_0xb3c7('0x3'));var express=require(_0xb3c7('0x4'));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(_0xb3c7('0x5'));var controller=require(_0xb3c7('0x6'));router['get']('/',auth[_0xb3c7('0x7')](),controller['index']);router[_0xb3c7('0x8')](_0xb3c7('0x9'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xa')]);router[_0xb3c7('0xb')]('/',auth['isAuthenticated'](),controller[_0xb3c7('0xc')]);router['put'](_0xb3c7('0x9'),auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xd')]);router[_0xb3c7('0xe')]('/:id',auth[_0xb3c7('0x7')](),controller[_0xb3c7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 2d6ba2d..853b79c 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 _0xdb9a=['name','exports','STRING'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xdb9a,0x106));var _0xadb9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb9a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xadb9('0x0')]={'name':{'type':Sequelize[_0xadb9('0x1')],'unique':_0xadb9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xadb9('0x1')]}}; \ No newline at end of file +var _0x842d=['STRING','sequelize','exports'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0x842d,0x12d));var _0xd842=function(_0x41886e,_0x2f9b3e){_0x41886e=_0x41886e-0x0;var _0x10e7f4=_0x842d[_0x41886e];return _0x10e7f4;};'use strict';var Sequelize=require(_0xd842('0x0'));module[_0xd842('0x1')]={'name':{'type':Sequelize[_0xd842('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 028dfd6..9d0c236 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 _0x3e3d=['crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','stack','name','send','index','Variable','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','length','order','sort','where','filters','merge','type','filter','options','includeAll','include','rows','catch','show','fields','create','user','Variables','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x2fa2dd,_0x169c4a){var _0xde3c2=function(_0x343542){while(--_0x343542){_0x2fa2dd['push'](_0x2fa2dd['shift']());}};_0xde3c2(++_0x169c4a);}(_0x3e3d,0x131));var _0xd3e3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3e3d[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3e3('0x0'));var zipdir=require(_0xd3e3('0x1'));var jsonpatch=require(_0xd3e3('0x2'));var rp=require(_0xd3e3('0x3'));var moment=require('moment');var BPromise=require(_0xd3e3('0x4'));var Mustache=require(_0xd3e3('0x5'));var util=require(_0xd3e3('0x6'));var path=require('path');var sox=require(_0xd3e3('0x7'));var csv=require(_0xd3e3('0x8'));var ejs=require(_0xd3e3('0x9'));var fs=require('fs');var fs_extra=require(_0xd3e3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd3e3('0xb'));var jsforce=require(_0xd3e3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd3e3('0xd'));var Redis=require(_0xd3e3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd3e3('0xf'));var as=require(_0xd3e3('0x10'));var hardwareService=require(_0xd3e3('0x11'));var logger=require(_0xd3e3('0x12'))(_0xd3e3('0x13'));var utils=require(_0xd3e3('0x14'));var config=require(_0xd3e3('0x15'));var licenseUtil=require(_0xd3e3('0x16'));var db=require(_0xd3e3('0x17'))['db'];function respondWithStatusCode(_0x249d07,_0x20562a){_0x20562a=_0x20562a||0xcc;return function(_0x55e463){if(_0x55e463){return _0x249d07[_0xd3e3('0x18')](_0x20562a);}return _0x249d07[_0xd3e3('0x19')](_0x20562a)[_0xd3e3('0x1a')]();};}function respondWithResult(_0x3484d9,_0x5c38ba){_0x5c38ba=_0x5c38ba||0xc8;return function(_0x2adc56){if(_0x2adc56){return _0x3484d9[_0xd3e3('0x19')](_0x5c38ba)[_0xd3e3('0x1b')](_0x2adc56);}};}function respondWithFilteredResult(_0x9d090e,_0xe76baf){return function(_0x58191e){if(_0x58191e){var _0x29406b=typeof _0xe76baf['offset']===_0xd3e3('0x1c')&&typeof _0xe76baf[_0xd3e3('0x1d')]===_0xd3e3('0x1c');var _0x26046e=_0x58191e[_0xd3e3('0x1e')];var _0x2bd340=_0x29406b?0x0:_0xe76baf[_0xd3e3('0x1f')];var _0x2baaaf=_0x29406b?_0x58191e['count']:_0xe76baf[_0xd3e3('0x1f')]+_0xe76baf[_0xd3e3('0x1d')];var _0x3c1e47;if(_0x2baaaf>=_0x26046e){_0x2baaaf=_0x26046e;_0x3c1e47=0xc8;}else{_0x3c1e47=0xce;}_0x9d090e[_0xd3e3('0x19')](_0x3c1e47);return _0x9d090e[_0xd3e3('0x20')](_0xd3e3('0x21'),_0x2bd340+'-'+_0x2baaaf+'/'+_0x26046e)[_0xd3e3('0x1b')](_0x58191e);}return null;};}function patchUpdates(_0x490bbe){return function(_0x101353){try{jsonpatch[_0xd3e3('0x22')](_0x101353,_0x490bbe,!![]);}catch(_0x28d6e3){return BPromise[_0xd3e3('0x23')](_0x28d6e3);}return _0x101353['save']();};}function saveUpdates(_0x500aef,_0x34348d){return function(_0x100479){if(_0x100479){return _0x100479['update'](_0x500aef)['then'](function(_0x5969c2){return _0x5969c2;});}return null;};}function removeEntity(_0x1c0a49,_0x29550e){return function(_0x29bd3a){if(_0x29bd3a){return _0x29bd3a['destroy']()[_0xd3e3('0x24')](function(){var _0x3d1b66=_0x29bd3a[_0xd3e3('0x25')]({'plain':!![]});var _0x1679a8='Variables';return db[_0xd3e3('0x26')][_0xd3e3('0x27')]({'where':{'type':_0x1679a8,'resourceId':_0x3d1b66['id']}})['then'](function(){return _0x29bd3a;});})[_0xd3e3('0x24')](function(){_0x1c0a49['status'](0xcc)[_0xd3e3('0x1a')]();});}};}function handleEntityNotFound(_0x392c97,_0x3f0954){return function(_0xdb3913){if(!_0xdb3913){_0x392c97[_0xd3e3('0x18')](0x194);}return _0xdb3913;};}function handleError(_0x228f7b,_0x39de1f){_0x39de1f=_0x39de1f||0x1f4;return function(_0x5b23e6){logger[_0xd3e3('0x28')](_0x5b23e6[_0xd3e3('0x29')]);if(_0x5b23e6[_0xd3e3('0x2a')]){delete _0x5b23e6[_0xd3e3('0x2a')];}_0x228f7b[_0xd3e3('0x19')](_0x39de1f)[_0xd3e3('0x2b')](_0x5b23e6);};}exports[_0xd3e3('0x2c')]=function(_0x2d4cf3,_0x228e26){var _0x37b938={},_0x50ab02={},_0x389400={'count':0x0,'rows':[]};var _0x54eb88=_['map'](db[_0xd3e3('0x2d')][_0xd3e3('0x2e')],function(_0x5dcddf){return{'name':_0x5dcddf[_0xd3e3('0x2f')],'type':_0x5dcddf['type']['key']};});_0x50ab02[_0xd3e3('0x30')]=_[_0xd3e3('0x31')](_0x54eb88,_0xd3e3('0x2a'));_0x50ab02[_0xd3e3('0x32')]=_[_0xd3e3('0x33')](_0x2d4cf3[_0xd3e3('0x32')]);_0x50ab02['filters']=_[_0xd3e3('0x34')](_0x50ab02[_0xd3e3('0x30')],_0x50ab02['query']);_0x37b938[_0xd3e3('0x35')]=_[_0xd3e3('0x34')](_0x50ab02[_0xd3e3('0x30')],qs['fields'](_0x2d4cf3[_0xd3e3('0x32')]['fields']));_0x37b938[_0xd3e3('0x35')]=_0x37b938['attributes'][_0xd3e3('0x36')]?_0x37b938[_0xd3e3('0x35')]:_0x50ab02[_0xd3e3('0x30')];if(!_0x2d4cf3[_0xd3e3('0x32')]['hasOwnProperty']('nolimit')){_0x37b938[_0xd3e3('0x1d')]=qs[_0xd3e3('0x1d')](_0x2d4cf3[_0xd3e3('0x32')][_0xd3e3('0x1d')]);_0x37b938[_0xd3e3('0x1f')]=qs[_0xd3e3('0x1f')](_0x2d4cf3['query'][_0xd3e3('0x1f')]);}_0x37b938[_0xd3e3('0x37')]=qs[_0xd3e3('0x38')](_0x2d4cf3[_0xd3e3('0x32')][_0xd3e3('0x38')]);_0x37b938[_0xd3e3('0x39')]=qs[_0xd3e3('0x3a')](_['pick'](_0x2d4cf3[_0xd3e3('0x32')],_0x50ab02[_0xd3e3('0x3a')]),_0x54eb88);if(_0x2d4cf3[_0xd3e3('0x32')]['filter']){_0x37b938[_0xd3e3('0x39')]=_[_0xd3e3('0x3b')](_0x37b938[_0xd3e3('0x39')],{'$or':_[_0xd3e3('0x31')](_0x54eb88,function(_0x18dc23){if(_0x18dc23[_0xd3e3('0x3c')]!=='VIRTUAL'){var _0x222fc8={};_0x222fc8[_0x18dc23[_0xd3e3('0x2a')]]={'$like':'%'+_0x2d4cf3[_0xd3e3('0x32')][_0xd3e3('0x3d')]+'%'};return _0x222fc8;}})});}_0x37b938=_[_0xd3e3('0x3b')]({},_0x37b938,_0x2d4cf3[_0xd3e3('0x3e')]);var _0x518613={'where':_0x37b938[_0xd3e3('0x39')]};return db[_0xd3e3('0x2d')][_0xd3e3('0x1e')](_0x518613)[_0xd3e3('0x24')](function(_0x3991fb){_0x389400[_0xd3e3('0x1e')]=_0x3991fb;if(_0x2d4cf3[_0xd3e3('0x32')][_0xd3e3('0x3f')]){_0x37b938[_0xd3e3('0x40')]=[{'all':!![]}];}return db[_0xd3e3('0x2d')]['findAll'](_0x37b938);})[_0xd3e3('0x24')](function(_0x21b3a5){_0x389400[_0xd3e3('0x41')]=_0x21b3a5;return _0x389400;})['then'](respondWithFilteredResult(_0x228e26,_0x37b938))[_0xd3e3('0x42')](handleError(_0x228e26,null));};exports[_0xd3e3('0x43')]=function(_0x17cf76,_0x220d3a){var _0x4cada5={'raw':!![],'where':{'id':_0x17cf76['params']['id']}},_0xfd06d5={};_0xfd06d5[_0xd3e3('0x30')]=_[_0xd3e3('0x33')](db['Variable'][_0xd3e3('0x2e')]);_0xfd06d5[_0xd3e3('0x32')]=_[_0xd3e3('0x33')](_0x17cf76[_0xd3e3('0x32')]);_0xfd06d5[_0xd3e3('0x3a')]=_[_0xd3e3('0x34')](_0xfd06d5[_0xd3e3('0x30')],_0xfd06d5[_0xd3e3('0x32')]);_0x4cada5[_0xd3e3('0x35')]=_[_0xd3e3('0x34')](_0xfd06d5[_0xd3e3('0x30')],qs['fields'](_0x17cf76[_0xd3e3('0x32')][_0xd3e3('0x44')]));_0x4cada5['attributes']=_0x4cada5[_0xd3e3('0x35')][_0xd3e3('0x36')]?_0x4cada5[_0xd3e3('0x35')]:_0xfd06d5[_0xd3e3('0x30')];if(_0x17cf76['query'][_0xd3e3('0x3f')]){_0x4cada5['include']=[{'all':!![]}];}_0x4cada5=_['merge']({},_0x4cada5,_0x17cf76['options']);return db[_0xd3e3('0x2d')]['find'](_0x4cada5)['then'](handleEntityNotFound(_0x220d3a,null))[_0xd3e3('0x24')](respondWithResult(_0x220d3a,null))[_0xd3e3('0x42')](handleError(_0x220d3a,null));};exports['create']=function(_0x24b5ad,_0xb64bd5){return db[_0xd3e3('0x2d')][_0xd3e3('0x45')](_0x24b5ad['body'],{})['then'](function(_0x37640a){var _0x9e03fa=_0x24b5ad[_0xd3e3('0x46')][_0xd3e3('0x25')]({'plain':!![]});if(!_0x9e03fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9e03fa['role']===_0xd3e3('0x46')){var _0x363331=_0x37640a[_0xd3e3('0x25')]({'plain':!![]});var _0x3f823f=_0xd3e3('0x47');return db[_0xd3e3('0x48')][_0xd3e3('0x49')]({'where':{'name':_0x3f823f,'userProfileId':_0x9e03fa[_0xd3e3('0x4a')]},'raw':!![]})[_0xd3e3('0x24')](function(_0x5f352f){if(_0x5f352f&&_0x5f352f[_0xd3e3('0x4b')]===0x0){return db[_0xd3e3('0x26')][_0xd3e3('0x45')]({'name':_0x363331[_0xd3e3('0x2a')],'resourceId':_0x363331['id'],'type':_0x5f352f[_0xd3e3('0x2a')],'sectionId':_0x5f352f['id']},{})[_0xd3e3('0x24')](function(){return _0x37640a;});}else{return _0x37640a;}})['catch'](function(_0x3936c7){logger[_0xd3e3('0x28')](_0xd3e3('0x4c'),_0x3936c7);throw _0x3936c7;});}return _0x37640a;})['then'](respondWithResult(_0xb64bd5,0xc9))['catch'](handleError(_0xb64bd5,null));};exports['update']=function(_0x459989,_0x2fbd54){if(_0x459989[_0xd3e3('0x4d')]['id']){delete _0x459989['body']['id'];}return db[_0xd3e3('0x2d')]['find']({'where':{'id':_0x459989[_0xd3e3('0x4e')]['id']}})[_0xd3e3('0x24')](handleEntityNotFound(_0x2fbd54,null))[_0xd3e3('0x24')](saveUpdates(_0x459989[_0xd3e3('0x4d')],null))[_0xd3e3('0x24')](respondWithResult(_0x2fbd54,null))[_0xd3e3('0x42')](handleError(_0x2fbd54,null));};exports[_0xd3e3('0x27')]=function(_0x5b3364,_0xb12732){return db[_0xd3e3('0x2d')][_0xd3e3('0x49')]({'where':{'id':_0x5b3364[_0xd3e3('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb12732,null))[_0xd3e3('0x24')](removeEntity(_0xb12732,null))[_0xd3e3('0x42')](handleError(_0xb12732,null));}; \ No newline at end of file +var _0xb78a=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','Variables','UserProfileResource','end','error','stack','name','send','index','map','Variable','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body'];(function(_0x5944e9,_0xf3da60){var _0x1098b8=function(_0x265f4){while(--_0x265f4){_0x5944e9['push'](_0x5944e9['shift']());}};_0x1098b8(++_0xf3da60);}(_0xb78a,0x1b0));var _0xab78=function(_0x5be98f,_0x291688){_0x5be98f=_0x5be98f-0x0;var _0x1f66b4=_0xb78a[_0x5be98f];return _0x1f66b4;};'use strict';var emlformat=require(_0xab78('0x0'));var rimraf=require(_0xab78('0x1'));var zipdir=require(_0xab78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab78('0x3'));var moment=require('moment');var BPromise=require(_0xab78('0x4'));var Mustache=require('mustache');var util=require(_0xab78('0x5'));var path=require(_0xab78('0x6'));var sox=require(_0xab78('0x7'));var csv=require(_0xab78('0x8'));var ejs=require(_0xab78('0x9'));var fs=require('fs');var fs_extra=require(_0xab78('0xa'));var _=require(_0xab78('0xb'));var squel=require(_0xab78('0xc'));var crypto=require(_0xab78('0xd'));var jsforce=require(_0xab78('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xab78('0x8'));var querystring=require(_0xab78('0xf'));var Papa=require(_0xab78('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab78('0x11'));var as=require(_0xab78('0x12'));var hardwareService=require(_0xab78('0x13'));var logger=require('../../config/logger')(_0xab78('0x14'));var utils=require(_0xab78('0x15'));var config=require(_0xab78('0x16'));var licenseUtil=require(_0xab78('0x17'));var db=require(_0xab78('0x18'))['db'];function respondWithStatusCode(_0x4412ff,_0x5b9a35){_0x5b9a35=_0x5b9a35||0xcc;return function(_0xd7ddda){if(_0xd7ddda){return _0x4412ff[_0xab78('0x19')](_0x5b9a35);}return _0x4412ff[_0xab78('0x1a')](_0x5b9a35)['end']();};}function respondWithResult(_0x3003df,_0x274151){_0x274151=_0x274151||0xc8;return function(_0x5987f5){if(_0x5987f5){return _0x3003df[_0xab78('0x1a')](_0x274151)[_0xab78('0x1b')](_0x5987f5);}};}function respondWithFilteredResult(_0x5783b1,_0x19967f){return function(_0x2baff2){if(_0x2baff2){var _0x471f14=typeof _0x19967f[_0xab78('0x1c')]==='undefined'&&typeof _0x19967f[_0xab78('0x1d')]==='undefined';var _0x21d108=_0x2baff2[_0xab78('0x1e')];var _0x41a4fc=_0x471f14?0x0:_0x19967f[_0xab78('0x1c')];var _0x1d1c1b=_0x471f14?_0x2baff2[_0xab78('0x1e')]:_0x19967f['offset']+_0x19967f['limit'];var _0x1c7214;if(_0x1d1c1b>=_0x21d108){_0x1d1c1b=_0x21d108;_0x1c7214=0xc8;}else{_0x1c7214=0xce;}_0x5783b1[_0xab78('0x1a')](_0x1c7214);return _0x5783b1[_0xab78('0x1f')](_0xab78('0x20'),_0x41a4fc+'-'+_0x1d1c1b+'/'+_0x21d108)['json'](_0x2baff2);}return null;};}function patchUpdates(_0x19a340){return function(_0x1c6f11){try{jsonpatch['apply'](_0x1c6f11,_0x19a340,!![]);}catch(_0x25aab0){return BPromise[_0xab78('0x21')](_0x25aab0);}return _0x1c6f11[_0xab78('0x22')]();};}function saveUpdates(_0x40cf7f,_0x1d5bd4){return function(_0x115249){if(_0x115249){return _0x115249[_0xab78('0x23')](_0x40cf7f)[_0xab78('0x24')](function(_0x379d86){return _0x379d86;});}return null;};}function removeEntity(_0xa9767e,_0x13d818){return function(_0x3deda3){if(_0x3deda3){return _0x3deda3[_0xab78('0x25')]()[_0xab78('0x24')](function(){var _0x595aa=_0x3deda3['get']({'plain':!![]});var _0x5639af=_0xab78('0x26');return db[_0xab78('0x27')][_0xab78('0x25')]({'where':{'type':_0x5639af,'resourceId':_0x595aa['id']}})[_0xab78('0x24')](function(){return _0x3deda3;});})['then'](function(){_0xa9767e[_0xab78('0x1a')](0xcc)[_0xab78('0x28')]();});}};}function handleEntityNotFound(_0x4ddcfa,_0x12b2ef){return function(_0x9ccf7a){if(!_0x9ccf7a){_0x4ddcfa[_0xab78('0x19')](0x194);}return _0x9ccf7a;};}function handleError(_0x5a21c8,_0x39ff24){_0x39ff24=_0x39ff24||0x1f4;return function(_0x18deb9){logger[_0xab78('0x29')](_0x18deb9[_0xab78('0x2a')]);if(_0x18deb9[_0xab78('0x2b')]){delete _0x18deb9[_0xab78('0x2b')];}_0x5a21c8['status'](_0x39ff24)[_0xab78('0x2c')](_0x18deb9);};}exports[_0xab78('0x2d')]=function(_0x15c273,_0x46a810){var _0x831cae={},_0x375d94={},_0x359105={'count':0x0,'rows':[]};var _0x192cb9=_[_0xab78('0x2e')](db[_0xab78('0x2f')]['rawAttributes'],function(_0xfde3e2){return{'name':_0xfde3e2['fieldName'],'type':_0xfde3e2['type'][_0xab78('0x30')]};});_0x375d94[_0xab78('0x31')]=_[_0xab78('0x2e')](_0x192cb9,'name');_0x375d94[_0xab78('0x32')]=_[_0xab78('0x33')](_0x15c273[_0xab78('0x32')]);_0x375d94['filters']=_[_0xab78('0x34')](_0x375d94['model'],_0x375d94['query']);_0x831cae['attributes']=_[_0xab78('0x34')](_0x375d94['model'],qs[_0xab78('0x35')](_0x15c273['query'][_0xab78('0x35')]));_0x831cae[_0xab78('0x36')]=_0x831cae[_0xab78('0x36')][_0xab78('0x37')]?_0x831cae[_0xab78('0x36')]:_0x375d94[_0xab78('0x31')];if(!_0x15c273['query'][_0xab78('0x38')](_0xab78('0x39'))){_0x831cae[_0xab78('0x1d')]=qs[_0xab78('0x1d')](_0x15c273[_0xab78('0x32')][_0xab78('0x1d')]);_0x831cae[_0xab78('0x1c')]=qs[_0xab78('0x1c')](_0x15c273['query'][_0xab78('0x1c')]);}_0x831cae[_0xab78('0x3a')]=qs[_0xab78('0x3b')](_0x15c273[_0xab78('0x32')][_0xab78('0x3b')]);_0x831cae[_0xab78('0x3c')]=qs[_0xab78('0x3d')](_[_0xab78('0x3e')](_0x15c273[_0xab78('0x32')],_0x375d94['filters']),_0x192cb9);if(_0x15c273['query']['filter']){_0x831cae[_0xab78('0x3c')]=_[_0xab78('0x3f')](_0x831cae[_0xab78('0x3c')],{'$or':_[_0xab78('0x2e')](_0x192cb9,function(_0x510fff){if(_0x510fff[_0xab78('0x40')]!==_0xab78('0x41')){var _0x96319a={};_0x96319a[_0x510fff[_0xab78('0x2b')]]={'$like':'%'+_0x15c273[_0xab78('0x32')][_0xab78('0x42')]+'%'};return _0x96319a;}})});}_0x831cae=_[_0xab78('0x3f')]({},_0x831cae,_0x15c273[_0xab78('0x43')]);var _0xa36d15={'where':_0x831cae[_0xab78('0x3c')]};return db[_0xab78('0x2f')][_0xab78('0x1e')](_0xa36d15)[_0xab78('0x24')](function(_0x4b7f6d){_0x359105[_0xab78('0x1e')]=_0x4b7f6d;if(_0x15c273['query'][_0xab78('0x44')]){_0x831cae[_0xab78('0x45')]=[{'all':!![]}];}return db[_0xab78('0x2f')][_0xab78('0x46')](_0x831cae);})[_0xab78('0x24')](function(_0x2c731f){_0x359105[_0xab78('0x47')]=_0x2c731f;return _0x359105;})[_0xab78('0x24')](respondWithFilteredResult(_0x46a810,_0x831cae))[_0xab78('0x48')](handleError(_0x46a810,null));};exports[_0xab78('0x49')]=function(_0x25a745,_0x2a0ae2){var _0x2a019c={'raw':!![],'where':{'id':_0x25a745[_0xab78('0x4a')]['id']}},_0x1f1229={};_0x1f1229[_0xab78('0x31')]=_[_0xab78('0x33')](db[_0xab78('0x2f')][_0xab78('0x4b')]);_0x1f1229['query']=_[_0xab78('0x33')](_0x25a745['query']);_0x1f1229['filters']=_[_0xab78('0x34')](_0x1f1229[_0xab78('0x31')],_0x1f1229['query']);_0x2a019c[_0xab78('0x36')]=_[_0xab78('0x34')](_0x1f1229[_0xab78('0x31')],qs[_0xab78('0x35')](_0x25a745[_0xab78('0x32')][_0xab78('0x35')]));_0x2a019c[_0xab78('0x36')]=_0x2a019c['attributes'][_0xab78('0x37')]?_0x2a019c[_0xab78('0x36')]:_0x1f1229['model'];if(_0x25a745[_0xab78('0x32')][_0xab78('0x44')]){_0x2a019c[_0xab78('0x45')]=[{'all':!![]}];}_0x2a019c=_[_0xab78('0x3f')]({},_0x2a019c,_0x25a745[_0xab78('0x43')]);return db[_0xab78('0x2f')]['find'](_0x2a019c)[_0xab78('0x24')](handleEntityNotFound(_0x2a0ae2,null))[_0xab78('0x24')](respondWithResult(_0x2a0ae2,null))['catch'](handleError(_0x2a0ae2,null));};exports[_0xab78('0x4c')]=function(_0x4db08f,_0x11203c){return db[_0xab78('0x2f')][_0xab78('0x4c')](_0x4db08f[_0xab78('0x4d')],{})['then'](function(_0x4c095b){var _0x2d8254=_0x4db08f[_0xab78('0x4e')][_0xab78('0x4f')]({'plain':!![]});if(!_0x2d8254)throw new Error(_0xab78('0x50'));if(_0x2d8254[_0xab78('0x51')]==='user'){var _0x413a3b=_0x4c095b['get']({'plain':!![]});var _0x49a079=_0xab78('0x26');return db['UserProfileSection'][_0xab78('0x52')]({'where':{'name':_0x49a079,'userProfileId':_0x2d8254['userProfileId']},'raw':!![]})[_0xab78('0x24')](function(_0x3b2f41){if(_0x3b2f41&&_0x3b2f41[_0xab78('0x53')]===0x0){return db[_0xab78('0x27')][_0xab78('0x4c')]({'name':_0x413a3b[_0xab78('0x2b')],'resourceId':_0x413a3b['id'],'type':_0x3b2f41['name'],'sectionId':_0x3b2f41['id']},{})[_0xab78('0x24')](function(){return _0x4c095b;});}else{return _0x4c095b;}})[_0xab78('0x48')](function(_0x50f325){logger[_0xab78('0x29')](_0xab78('0x54'),_0x50f325);throw _0x50f325;});}return _0x4c095b;})[_0xab78('0x24')](respondWithResult(_0x11203c,0xc9))[_0xab78('0x48')](handleError(_0x11203c,null));};exports[_0xab78('0x23')]=function(_0x562d39,_0x3d1574){if(_0x562d39[_0xab78('0x4d')]['id']){delete _0x562d39['body']['id'];}return db[_0xab78('0x2f')][_0xab78('0x52')]({'where':{'id':_0x562d39[_0xab78('0x4a')]['id']}})[_0xab78('0x24')](handleEntityNotFound(_0x3d1574,null))[_0xab78('0x24')](saveUpdates(_0x562d39[_0xab78('0x4d')],null))[_0xab78('0x24')](respondWithResult(_0x3d1574,null))[_0xab78('0x48')](handleError(_0x3d1574,null));};exports[_0xab78('0x25')]=function(_0x53c9a5,_0x211b25){return db['Variable'][_0xab78('0x52')]({'where':{'id':_0x53c9a5[_0xab78('0x4a')]['id']}})['then'](handleEntityNotFound(_0x211b25,null))['then'](removeEntity(_0x211b25,null))['catch'](handleError(_0x211b25,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0ae8310..d87dab5 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 _0xe0dd=['moment','bluebird','path','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util'];(function(_0x121350,_0x361f4d){var _0x2e21c7=function(_0x3b6d51){while(--_0x3b6d51){_0x121350['push'](_0x121350['shift']());}};_0x2e21c7(++_0x361f4d);}(_0xe0dd,0x15c));var _0xde0d=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe0dd[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde0d('0x2'));var BPromise=require(_0xde0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde0d('0x4'));var rimraf=require('rimraf');var config=require(_0xde0d('0x5'));var attributes=require(_0xde0d('0x6'));module[_0xde0d('0x7')]=function(_0x10f569,_0x2edab8){return _0x10f569['define'](_0xde0d('0x8'),attributes,{'tableName':_0xde0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a92=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash','util','../../config/logger','api'];(function(_0x2add1c,_0x50f7c7){var _0x304af0=function(_0x324103){while(--_0x324103){_0x2add1c['push'](_0x2add1c['shift']());}};_0x304af0(++_0x50f7c7);}(_0x0a92,0x10d));var _0x20a9=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x0a92[_0x43a1b8];return _0x324ecc;};'use strict';var _=require(_0x20a9('0x0'));var util=require(_0x20a9('0x1'));var logger=require(_0x20a9('0x2'))(_0x20a9('0x3'));var moment=require(_0x20a9('0x4'));var BPromise=require(_0x20a9('0x5'));var rp=require(_0x20a9('0x6'));var fs=require('fs');var path=require(_0x20a9('0x7'));var rimraf=require(_0x20a9('0x8'));var config=require(_0x20a9('0x9'));var attributes=require(_0x20a9('0xa'));module[_0x20a9('0xb')]=function(_0x536211,_0xbcb439){return _0x536211['define']('Variable',attributes,{'tableName':_0x20a9('0xc'),'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 c5306f1..7d15110 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(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xa41a,0x6b));var _0xaa41=function(_0x47f700,_0x330577){_0x47f700=_0x47f700-0x0;var _0x1df8f6=_0xa41a[_0x47f700];return _0x1df8f6;};'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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4c742f,_0x2bd40a){var _0x2913ae=function(_0x4e2759){while(--_0x4e2759){_0x4c742f['push'](_0x4c742f['shift']());}};_0x2913ae(++_0x2bd40a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x302fb1,_0x3c8804){_0x302fb1=_0x302fb1-0x0;var _0x1eea20=_0x8ef6[_0x302fb1];return _0x1eea20;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index fa3a7a8..a92eec3 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 _0x799d=['Router','../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','migrations','exports','express'];(function(_0x13827d,_0x5892f9){var _0x5409c5=function(_0x4bd325){while(--_0x4bd325){_0x13827d['push'](_0x13827d['shift']());}};_0x5409c5(++_0x5892f9);}(_0x799d,0x16f));var _0xd799=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x799d[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0xd799('0x0'));var router=express[_0xd799('0x1')]();var auth=require(_0xd799('0x2'));var controller=require(_0xd799('0x3'));router['get']('/',controller[_0xd799('0x4')]);router[_0xd799('0x5')]('/fetch',auth[_0xd799('0x6')](),auth[_0xd799('0x7')](),controller[_0xd799('0x8')]);router[_0xd799('0x5')](_0xd799('0x9'),auth[_0xd799('0x6')](),auth[_0xd799('0x7')](),controller[_0xd799('0xa')]);router[_0xd799('0x5')](_0xd799('0xb'),auth[_0xd799('0x6')](),auth[_0xd799('0x7')](),controller[_0xd799('0xc')]);router[_0xd799('0x5')]('/restart',auth[_0xd799('0x6')](),controller[_0xd799('0xd')]);router['get']('/migrations',controller[_0xd799('0xe')]);module[_0xd799('0xf')]=router; \ No newline at end of file +var _0x6cdf=['get','/fetch','canUpdate','fetch','/reset','reset','/pull','pull','isAuthenticated','/migrations','migrations','exports','express','Router'];(function(_0x5f40af,_0x45e3f0){var _0x5ee222=function(_0x4425de){while(--_0x4425de){_0x5f40af['push'](_0x5f40af['shift']());}};_0x5ee222(++_0x45e3f0);}(_0x6cdf,0x15c));var _0xf6cd=function(_0x3d01e4,_0x41546e){_0x3d01e4=_0x3d01e4-0x0;var _0x440197=_0x6cdf[_0x3d01e4];return _0x440197;};'use strict';var express=require(_0xf6cd('0x0'));var router=express[_0xf6cd('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router['get']('/',controller['index']);router[_0xf6cd('0x2')](_0xf6cd('0x3'),auth['isAuthenticated'](),auth[_0xf6cd('0x4')](),controller[_0xf6cd('0x5')]);router[_0xf6cd('0x2')](_0xf6cd('0x6'),auth['isAuthenticated'](),auth[_0xf6cd('0x4')](),controller[_0xf6cd('0x7')]);router[_0xf6cd('0x2')](_0xf6cd('0x8'),auth['isAuthenticated'](),auth[_0xf6cd('0x4')](),controller[_0xf6cd('0x9')]);router['get']('/restart',auth[_0xf6cd('0xa')](),controller['restart']);router[_0xf6cd('0x2')](_0xf6cd('0xb'),controller[_0xf6cd('0xc')]);module[_0xf6cd('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index bdeecc1..6057876 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 _0x431d=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','length','replace','exports','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','update','simple-git','root','index','query','latest','fetch','tags','2.0.0','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','status'];(function(_0x38bfad,_0x572e13){var _0x21fd3d=function(_0x44c978){while(--_0x44c978){_0x38bfad['push'](_0x38bfad['shift']());}};_0x21fd3d(++_0x572e13);}(_0x431d,0x89));var _0xd431=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x431d[_0x462999];return _0x4b1366;};'use strict';var Umzug=require(_0xd431('0x0'));var path=require(_0xd431('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xd431('0x2'))(module,_0xd431('0x3'));var compareVersions=require(_0xd431('0x4'));var exec=require(_0xd431('0x5'))[_0xd431('0x6')];var db=require(_0xd431('0x7'))['db'];var config=require(_0xd431('0x8'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xd431('0x9'));var git=require(_0xd431('0xa'))(config[_0xd431('0xb')]);exports[_0xd431('0xc')]=function(_0x26a0b2,_0x64f4d4){var _0x4f3d0f={'current':module['exports']['version'],'phonebar':0x2};if(_0x26a0b2[_0xd431('0xd')]&&_0x26a0b2[_0xd431('0xd')][_0xd431('0xe')]){return git[_0xd431('0xf')]()[_0xd431('0x10')](function(_0x1874ea,_0x14d48f){_0x4f3d0f[_0xd431('0xe')]=(_0x1874ea?module['exports'][_0xd431('0x3')]:_0x14d48f[_0xd431('0xe')])||_0xd431('0x11');return _0x64f4d4['status'](0xc8)[_0xd431('0x12')](_0x4f3d0f);});}else{return _0x64f4d4['status'](0xc8)[_0xd431('0x12')](_0x4f3d0f);}};exports[_0xd431('0xf')]=function(_0x2412d4,_0xdded10){return git['fetch']([_0xd431('0x13'),_0xd431('0x14')],function(_0xaeb4a6){if(_0xaeb4a6){logger[_0xd431('0x15')](_0xaeb4a6);return _0xdded10['status'](0x1f4)['json'](_0xaeb4a6);}logger[_0xd431('0x16')](_0xd431('0x17'));return _0xdded10['status'](0xc8)[_0xd431('0x12')]({'output':_0xd431('0x18')});});};exports[_0xd431('0x19')]=function(_0x473307,_0x21edc6){return git[_0xd431('0x19')](['--hard','FETCH_HEAD'],function(_0x58ac35){if(_0x58ac35){logger[_0xd431('0x15')](_0x58ac35);return _0x21edc6['status'](0x1f4)['json'](_0x58ac35);}logger[_0xd431('0x16')](_0xd431('0x1a'));return _0x21edc6[_0xd431('0x1b')](0xc8)[_0xd431('0x12')]({'output':_0xd431('0x1c')});});};exports[_0xd431('0x1d')]=function(_0x2be35e,_0x149ecf){exec(_0xd431('0x1e'),function(_0x55a35b,_0x14f44c,_0x3936e6){logger[_0xd431('0x16')](_0x14f44c);logger[_0xd431('0x16')](_0x3936e6);if(_0x55a35b){logger['error'](_0x55a35b);return _0x149ecf['status'](0x1f4)['json'](_0x55a35b);}return _0x149ecf['status'](0xc8)['json']({'output':_0x14f44c});});};exports[_0xd431('0x1f')]=function(_0x2ebb64,_0x351363){return pm2['restart'](_0xd431('0x20'))[_0xd431('0x21')](function(_0x34c4af){logger[_0xd431('0x16')]('pm2\x20restart\x20motion\x20%s',_0x34c4af);return _0x351363[_0xd431('0x1b')](0xc8)['json']({'output':_0xd431('0x22')});})['catch'](function(_0x23c762){logger[_0xd431('0x15')](_0x23c762);return _0x351363['status'](0x1f4)[_0xd431('0x12')](_0x23c762);});};exports[_0xd431('0x23')]=function(_0x2ab4c0,_0x56cd7b){var _0x3cbe9a=fs[_0xd431('0x24')](path[_0xd431('0x25')](config['root'],'server','migrations'));var _0x53c200=[];for(var _0x2781d2=0x0;_0x2781d2<_0x3cbe9a[_0xd431('0x26')];_0x2781d2++){var _0x55b96a=_0x3cbe9a[_0x2781d2][_0xd431('0x27')]('.js','');if(compareVersions(module[_0xd431('0x28')]['version'],_0x55b96a)===-0x1){_0x53c200[_0xd431('0x29')](_0x55b96a);}}if(_0x53c200[_0xd431('0x26')]){var _0x136cea=_0x53c200[_0xd431('0x2a')](compareVersions);var _0x2d7597=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xd431('0x2b')],'modelName':_0xd431('0x2b'),'columnName':_0xd431('0x3')},'migrations':{'params':[db[_0xd431('0x2c')][_0xd431('0x2d')](),db[_0xd431('0x2c')][_0xd431('0x2e')],function(){throw new Error(_0xd431('0x2f'));}],'path':path[_0xd431('0x25')](config['root'],_0xd431('0x30'),'migrations'),'pattern':/\.js$/}});_0x2d7597['up']({'migrations':_['map'](_0x136cea,function(_0x3e29b7){return _0x3e29b7+'.js';})})[_0xd431('0x21')](function(){return _0x56cd7b['status'](0xc8)[_0xd431('0x12')]({'output':_0xd431('0x31')+module[_0xd431('0x28')][_0xd431('0x3')]+_0xd431('0x32')+_[_0xd431('0x33')](_0x136cea),'migrations':_['join'](_0x136cea)});})[_0xd431('0x34')](function(_0x11e27d){if(_0x11e27d instanceof db[_0xd431('0x2c')][_0xd431('0x35')]){return _0x56cd7b[_0xd431('0x1b')](0xc8)[_0xd431('0x12')]({'output':_0xd431('0x36')});}else{return _0x56cd7b[_0xd431('0x1b')](0x1f4)['json'](_0x11e27d);}});}else{return _0x56cd7b[_0xd431('0x1b')](0xc8)[_0xd431('0x12')]({'output':_0xd431('0x36')});}}; \ No newline at end of file +var _0x0e41=['git\x20reset\x20--hard','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','push','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','index','exports','query','fetch','tags','latest','status','json','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD'];(function(_0x3f6a16,_0x23e485){var _0x1e8cc5=function(_0x57fd64){while(--_0x57fd64){_0x3f6a16['push'](_0x3f6a16['shift']());}};_0x1e8cc5(++_0x23e485);}(_0x0e41,0x115));var _0x10e4=function(_0x140d7f,_0x8e7e98){_0x140d7f=_0x140d7f-0x0;var _0x2a2acd=_0x0e41[_0x140d7f];return _0x2a2acd;};'use strict';var Umzug=require(_0x10e4('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x10e4('0x1'));var pkginfo=require('pkginfo')(module,_0x10e4('0x2'));var compareVersions=require(_0x10e4('0x3'));var exec=require(_0x10e4('0x4'))['exec'];var db=require(_0x10e4('0x5'))['db'];var config=require(_0x10e4('0x6'));var pm2=require(_0x10e4('0x7'));var logger=require('../../config/logger')(_0x10e4('0x8'));var git=require(_0x10e4('0x9'))(config['root']);exports[_0x10e4('0xa')]=function(_0xeafd9e,_0x2490fe){var _0x4d9fff={'current':module[_0x10e4('0xb')][_0x10e4('0x2')],'phonebar':0x2};if(_0xeafd9e[_0x10e4('0xc')]&&_0xeafd9e[_0x10e4('0xc')]['latest']){return git[_0x10e4('0xd')]()[_0x10e4('0xe')](function(_0x828688,_0x1afa45){_0x4d9fff[_0x10e4('0xf')]=(_0x828688?module[_0x10e4('0xb')][_0x10e4('0x2')]:_0x1afa45[_0x10e4('0xf')])||'2.0.0';return _0x2490fe[_0x10e4('0x10')](0xc8)['json'](_0x4d9fff);});}else{return _0x2490fe[_0x10e4('0x10')](0xc8)[_0x10e4('0x11')](_0x4d9fff);}};exports[_0x10e4('0xd')]=function(_0xf8f4b8,_0x31ea08){return git['fetch'](['origin','master'],function(_0x228d31){if(_0x228d31){logger[_0x10e4('0x12')](_0x228d31);return _0x31ea08['status'](0x1f4)[_0x10e4('0x11')](_0x228d31);}logger['info'](_0x10e4('0x13'));return _0x31ea08[_0x10e4('0x10')](0xc8)[_0x10e4('0x11')]({'output':_0x10e4('0x14')});});};exports[_0x10e4('0x15')]=function(_0x13ba1c,_0x22b200){return git[_0x10e4('0x15')](['--hard',_0x10e4('0x16')],function(_0xb0096b){if(_0xb0096b){logger[_0x10e4('0x12')](_0xb0096b);return _0x22b200[_0x10e4('0x10')](0x1f4)[_0x10e4('0x11')](_0xb0096b);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x22b200[_0x10e4('0x10')](0xc8)[_0x10e4('0x11')]({'output':_0x10e4('0x17')});});};exports['pull']=function(_0x1053f3,_0x477cf3){exec(_0x10e4('0x18'),function(_0x491d13,_0x437157,_0x539a9e){logger[_0x10e4('0x19')](_0x437157);logger['info'](_0x539a9e);if(_0x491d13){logger[_0x10e4('0x12')](_0x491d13);return _0x477cf3[_0x10e4('0x10')](0x1f4)[_0x10e4('0x11')](_0x491d13);}return _0x477cf3['status'](0xc8)['json']({'output':_0x437157});});};exports[_0x10e4('0x1a')]=function(_0x27d4e5,_0x323abe){return pm2[_0x10e4('0x1a')](_0x10e4('0x1b'))[_0x10e4('0x1c')](function(_0x1462d8){logger[_0x10e4('0x19')](_0x10e4('0x1d'),_0x1462d8);return _0x323abe['status'](0xc8)['json']({'output':_0x10e4('0x1e')});})[_0x10e4('0x1f')](function(_0x2a88fa){logger[_0x10e4('0x12')](_0x2a88fa);return _0x323abe[_0x10e4('0x10')](0x1f4)[_0x10e4('0x11')](_0x2a88fa);});};exports[_0x10e4('0x20')]=function(_0x23c60f,_0x51d1ad){var _0x42b9db=fs[_0x10e4('0x21')](path[_0x10e4('0x22')](config[_0x10e4('0x23')],_0x10e4('0x24'),_0x10e4('0x20')));var _0x9986c=[];for(var _0x2cf907=0x0;_0x2cf907<_0x42b9db[_0x10e4('0x25')];_0x2cf907++){var _0x3fb2f1=_0x42b9db[_0x2cf907]['replace']('.js','');if(compareVersions(module[_0x10e4('0xb')][_0x10e4('0x2')],_0x3fb2f1)===-0x1){_0x9986c[_0x10e4('0x26')](_0x3fb2f1);}}if(_0x9986c[_0x10e4('0x25')]){var _0x3c590b=_0x9986c[_0x10e4('0x27')](compareVersions);var _0x29a756=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x10e4('0x28')],'modelName':'Migration','columnName':_0x10e4('0x2')},'migrations':{'params':[db[_0x10e4('0x29')][_0x10e4('0x2a')](),db[_0x10e4('0x29')]['constructor'],function(){throw new Error(_0x10e4('0x2b'));}],'path':path[_0x10e4('0x22')](config[_0x10e4('0x23')],_0x10e4('0x24'),_0x10e4('0x20')),'pattern':/\.js$/}});_0x29a756['up']({'migrations':_[_0x10e4('0x2c')](_0x3c590b,function(_0x17cc1b){return _0x17cc1b+'.js';})})[_0x10e4('0x1c')](function(){return _0x51d1ad[_0x10e4('0x10')](0xc8)[_0x10e4('0x11')]({'output':_0x10e4('0x2d')+module[_0x10e4('0xb')][_0x10e4('0x2')]+_0x10e4('0x2e')+_[_0x10e4('0x2f')](_0x3c590b),'migrations':_[_0x10e4('0x22')](_0x3c590b)});})[_0x10e4('0x1f')](function(_0x5766e7){if(_0x5766e7 instanceof db[_0x10e4('0x29')][_0x10e4('0x30')]){return _0x51d1ad[_0x10e4('0x10')](0xc8)[_0x10e4('0x11')]({'output':_0x10e4('0x31')});}else{return _0x51d1ad['status'](0x1f4)[_0x10e4('0x11')](_0x5766e7);}});}else{return _0x51d1ad[_0x10e4('0x10')](0xc8)[_0x10e4('0x11')]({'output':_0x10e4('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b51f278..48753cc 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 _0x6e73=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer'];(function(_0x2be1ac,_0x145ca0){var _0x11fc41=function(_0x2e9570){while(--_0x2e9570){_0x2be1ac['push'](_0x2be1ac['shift']());}};_0x11fc41(++_0x145ca0);}(_0x6e73,0x110));var _0x36e7=function(_0x222be0,_0x5a5a02){_0x222be0=_0x222be0-0x0;var _0x38c8f5=_0x6e73[_0x222be0];return _0x38c8f5;};'use strict';var multer=require(_0x36e7('0x0'));var util=require(_0x36e7('0x1'));var path=require(_0x36e7('0x2'));var timeout=require(_0x36e7('0x3'));var express=require(_0x36e7('0x4'));var router=express[_0x36e7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x36e7('0x6'));var interaction=require(_0x36e7('0x7'));var config=require(_0x36e7('0x8'));var controller=require(_0x36e7('0x9'));router[_0x36e7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x36e7('0xa')](_0x36e7('0xb'),auth[_0x36e7('0xc')](),controller[_0x36e7('0xd')]);router[_0x36e7('0xa')](_0x36e7('0xe'),auth[_0x36e7('0xc')](),controller[_0x36e7('0xf')]);router[_0x36e7('0x10')]('/',auth[_0x36e7('0xc')](),controller[_0x36e7('0x11')]);router[_0x36e7('0x12')](_0x36e7('0xe'),auth[_0x36e7('0xc')](),controller[_0x36e7('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x36e7('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf432=['get','isAuthenticated','/describe','describe','show','post','put','/:id','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x262255,_0x20657c){var _0xb620c=function(_0x3f0b74){while(--_0x3f0b74){_0x262255['push'](_0x262255['shift']());}};_0xb620c(++_0x20657c);}(_0xf432,0xc7));var _0x2f43=function(_0x438988,_0x2a86cf){_0x438988=_0x438988-0x0;var _0x1ce59f=_0xf432[_0x438988];return _0x1ce59f;};'use strict';var multer=require('multer');var util=require(_0x2f43('0x0'));var path=require(_0x2f43('0x1'));var timeout=require(_0x2f43('0x2'));var express=require(_0x2f43('0x3'));var router=express[_0x2f43('0x4')]();var fs_extra=require(_0x2f43('0x5'));var auth=require(_0x2f43('0x6'));var interaction=require(_0x2f43('0x7'));var config=require(_0x2f43('0x8'));var controller=require(_0x2f43('0x9'));router[_0x2f43('0xa')]('/',auth[_0x2f43('0xb')](),controller['index']);router[_0x2f43('0xa')](_0x2f43('0xc'),auth['isAuthenticated'](),controller[_0x2f43('0xd')]);router[_0x2f43('0xa')]('/:id',auth[_0x2f43('0xb')](),controller[_0x2f43('0xe')]);router[_0x2f43('0xf')]('/',auth[_0x2f43('0xb')](),controller['create']);router[_0x2f43('0x10')](_0x2f43('0x11'),auth[_0x2f43('0xb')](),controller[_0x2f43('0x12')]);router['delete']('/:id',auth[_0x2f43('0xb')](),controller['destroy']);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 c11e2b7..cef7aa3 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 _0x4849=['BOOLEAN','INTEGER','sequelize','exports','STRING','DATE'];(function(_0x150c5f,_0x227a7b){var _0x411a5d=function(_0x52e22b){while(--_0x52e22b){_0x150c5f['push'](_0x150c5f['shift']());}};_0x411a5d(++_0x227a7b);}(_0x4849,0xf8));var _0x9484=function(_0x3aaa08,_0x9e46ad){_0x3aaa08=_0x3aaa08-0x0;var _0x5ad07e=_0x4849[_0x3aaa08];return _0x5ad07e;};'use strict';var Sequelize=require(_0x9484('0x0'));module[_0x9484('0x1')]={'type':{'type':Sequelize[_0x9484('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9484('0x2')]},'queue':{'type':Sequelize[_0x9484('0x2')]},'interface':{'type':Sequelize[_0x9484('0x2')]},'membername':{'type':Sequelize[_0x9484('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9484('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9484('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x9484('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x9484('0x3')]},'agentdumpAt':{'type':Sequelize[_0x9484('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9484('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9484('0x5')]},'agentacw':{'type':Sequelize[_0x9484('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9484('0x5')]},'reason':{'type':Sequelize[_0x9484('0x2')]},'lastevent':{'type':Sequelize[_0x9484('0x2')]},'channel':{'type':Sequelize[_0x9484('0x2')]},'channelstate':{'type':Sequelize[_0x9484('0x5')]},'channelstatedesc':{'type':Sequelize[_0x9484('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9484('0x2')]},'connectedlinename':{'type':Sequelize[_0x9484('0x2')]},'language':{'type':Sequelize[_0x9484('0x2')]},'accountcode':{'type':Sequelize[_0x9484('0x2')]},'context':{'type':Sequelize[_0x9484('0x2')]},'exten':{'type':Sequelize[_0x9484('0x2')]},'priority':{'type':Sequelize[_0x9484('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9484('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9484('0x2')]},'destcalleridname':{'type':Sequelize[_0x9484('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9484('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9484('0x2')]},'destlanguage':{'type':Sequelize[_0x9484('0x2')]},'destaccountcode':{'type':Sequelize[_0x9484('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9484('0x2')]},'destpriority':{'type':Sequelize[_0x9484('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x9484('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9484('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9484('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9484('0x2')]},'agententerreason':{'type':Sequelize[_0x9484('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeb3b=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x304107,_0xa47eaf){var _0x43d4af=function(_0x1d88b8){while(--_0x1d88b8){_0x304107['push'](_0x304107['shift']());}};_0x43d4af(++_0xa47eaf);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x4b0830,_0x2e3b0a){_0x4b0830=_0x4b0830-0x0;var _0x1f53a7=_0xeb3b[_0x4b0830];return _0x1f53a7;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'type':{'type':Sequelize[_0xbeb3('0x2')]},'uniqueid':{'type':Sequelize[_0xbeb3('0x2')]},'calleridnum':{'type':Sequelize[_0xbeb3('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbeb3('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xbeb3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xbeb3('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xbeb3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbeb3('0x3')]},'holdtime':{'type':Sequelize[_0xbeb3('0x4')]},'agentcomplete':{'type':Sequelize[_0xbeb3('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbeb3('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbeb3('0x4')]},'agentacw':{'type':Sequelize[_0xbeb3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbeb3('0x4')]},'reason':{'type':Sequelize[_0xbeb3('0x2')]},'lastevent':{'type':Sequelize[_0xbeb3('0x2')]},'channel':{'type':Sequelize[_0xbeb3('0x2')]},'channelstate':{'type':Sequelize[_0xbeb3('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbeb3('0x2')]},'connectedlinename':{'type':Sequelize[_0xbeb3('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbeb3('0x2')]},'context':{'type':Sequelize[_0xbeb3('0x2')]},'exten':{'type':Sequelize[_0xbeb3('0x2')]},'priority':{'type':Sequelize[_0xbeb3('0x2')]},'destchannel':{'type':Sequelize[_0xbeb3('0x2')]},'destchannelstate':{'type':Sequelize[_0xbeb3('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xbeb3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbeb3('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xbeb3('0x2')]},'destcontext':{'type':Sequelize[_0xbeb3('0x2')]},'destexten':{'type':Sequelize[_0xbeb3('0x2')]},'destpriority':{'type':Sequelize[_0xbeb3('0x2')]},'destuniqueid':{'type':Sequelize[_0xbeb3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xbeb3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbeb3('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xbeb3('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 29d3e87..49920c4 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 b813d3c..2c1ed83 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 _0x00b3=['../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','api','moment','path','rimraf'];(function(_0x162ad5,_0xdea113){var _0x130b76=function(_0x10178b){while(--_0x10178b){_0x162ad5['push'](_0x162ad5['shift']());}};_0x130b76(++_0xdea113);}(_0x00b3,0x97));var _0x300b=function(_0x2dfe30,_0x2b0b5d){_0x2dfe30=_0x2dfe30-0x0;var _0x1f1fda=_0x00b3[_0x2dfe30];return _0x1f1fda;};'use strict';var _=require(_0x300b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x300b('0x3'));var rimraf=require(_0x300b('0x4'));var config=require(_0x300b('0x5'));var attributes=require('./voiceAgentReport.attributes');module[_0x300b('0x6')]=function(_0xbceeb8,_0x34a5cd){return _0xbceeb8[_0x300b('0x7')](_0x300b('0x8'),attributes,{'tableName':_0x300b('0x9'),'paranoid':![],'indexes':[{'fields':[_0x300b('0xa'),_0x300b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa19=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x14bbf3,_0xca820f){var _0x1b280c=function(_0x2a5314){while(--_0x2a5314){_0x14bbf3['push'](_0x14bbf3['shift']());}};_0x1b280c(++_0xca820f);}(_0xaa19,0x79));var _0x9aa1=function(_0x3a454b,_0x41d9ca){_0x3a454b=_0x3a454b-0x0;var _0x349cec=_0xaa19[_0x3a454b];return _0x349cec;};'use strict';var _=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var logger=require(_0x9aa1('0x2'))(_0x9aa1('0x3'));var moment=require('moment');var BPromise=require(_0x9aa1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aa1('0x5'));var rimraf=require('rimraf');var config=require(_0x9aa1('0x6'));var attributes=require(_0x9aa1('0x7'));module[_0x9aa1('0x8')]=function(_0x52124b,_0x1e59f8){return _0x52124b[_0x9aa1('0x9')](_0x9aa1('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9aa1('0xb'),'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 34b6e52..eb0598d 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 _0x19fd=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','catch','UpdateVoiceAgentReport','update'];(function(_0xf7e157,_0x32ee10){var _0x2c0a95=function(_0x526ae9){while(--_0x526ae9){_0xf7e157['push'](_0xf7e157['shift']());}};_0x2c0a95(++_0x32ee10);}(_0x19fd,0x1a2));var _0xd19f=function(_0x172df1,_0x4dc77d){_0x172df1=_0x172df1-0x0;var _0x1f3151=_0x19fd[_0x172df1];return _0x1f3151;};'use strict';var _=require(_0xd19f('0x0'));var util=require(_0xd19f('0x1'));var moment=require(_0xd19f('0x2'));var BPromise=require(_0xd19f('0x3'));var rs=require(_0xd19f('0x4'));var fs=require('fs');var Redis=require(_0xd19f('0x5'));var db=require(_0xd19f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd19f('0x7'))(_0xd19f('0x8'));var config=require('../../config/environment');var jayson=require(_0xd19f('0x9'));var client=jayson['client'][_0xd19f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fa0e0,_0x45b3ea,_0x3a81e7){return new BPromise(function(_0x377ef4,_0x7046c6){return client[_0xd19f('0xb')](_0x3fa0e0,_0x3a81e7)['then'](function(_0x4becc5){logger[_0xd19f('0xc')](_0xd19f('0xd'),_0x45b3ea,'request\x20sent');logger[_0xd19f('0xe')](_0xd19f('0xf'),_0x45b3ea,'request\x20sent',JSON[_0xd19f('0x10')](_0x4becc5));if(_0x4becc5['error']){if(_0x4becc5[_0xd19f('0x11')]['code']===0x1f4){logger[_0xd19f('0x11')](_0xd19f('0xd'),_0x45b3ea,_0x4becc5[_0xd19f('0x11')][_0xd19f('0x12')]);return _0x7046c6(_0x4becc5[_0xd19f('0x11')]['message']);}logger[_0xd19f('0x11')](_0xd19f('0xd'),_0x45b3ea,_0x4becc5['error']['message']);return _0x377ef4(_0x4becc5['error']['message']);}else{logger[_0xd19f('0xc')](_0xd19f('0xd'),_0x45b3ea,_0xd19f('0x13'));_0x377ef4(_0x4becc5['result'][_0xd19f('0x12')]);}})['catch'](function(_0x18083d){logger[_0xd19f('0x11')](_0xd19f('0xd'),_0x45b3ea,_0x18083d);_0x7046c6(_0x18083d);});});}exports[_0xd19f('0x14')]=function(_0x20bea0){var _0x164050=this;return new Promise(function(_0xc91622,_0x45d5bd){return db[_0xd19f('0x15')][_0xd19f('0x16')](_0x20bea0[_0xd19f('0x17')],{'raw':_0x20bea0[_0xd19f('0x18')]?_0x20bea0[_0xd19f('0x18')][_0xd19f('0x19')]===undefined?!![]:![]:!![]})[_0xd19f('0x1a')](function(_0xaae9a){logger['info']('CreateVoiceAgentReport',_0x20bea0);logger[_0xd19f('0xe')](_0xd19f('0x14'),_0x20bea0,JSON[_0xd19f('0x10')](_0xaae9a));_0xc91622(_0xaae9a);})[_0xd19f('0x1b')](function(_0x58d588){logger[_0xd19f('0x11')](_0xd19f('0x14'),_0x58d588['message'],_0x20bea0);_0x45d5bd(_0x164050['error'](0x1f4,_0x58d588[_0xd19f('0x12')]));});});};exports[_0xd19f('0x1c')]=function(_0x541230){var _0x2994e5=this;return new Promise(function(_0xfbb6e4,_0x31b305){return db[_0xd19f('0x15')][_0xd19f('0x1d')](_0x541230[_0xd19f('0x17')],{'raw':_0x541230[_0xd19f('0x18')]?_0x541230['options'][_0xd19f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x541230[_0xd19f('0x18')]?_0x541230[_0xd19f('0x18')]['where']||null:null,'attributes':_0x541230[_0xd19f('0x18')]?_0x541230['options'][_0xd19f('0x1e')]||null:null,'limit':_0x541230['options']?_0x541230[_0xd19f('0x18')][_0xd19f('0x1f')]||null:null})[_0xd19f('0x1a')](function(_0xbb2716){logger['info'](_0xd19f('0x1c'),_0x541230);logger['debug'](_0xd19f('0x1c'),_0x541230,JSON[_0xd19f('0x10')](_0xbb2716));_0xfbb6e4(_0xbb2716);})[_0xd19f('0x1b')](function(_0x43ec19){logger['error'](_0xd19f('0x1c'),_0x43ec19[_0xd19f('0x12')],_0x541230);_0x31b305(_0x2994e5['error'](0x1f4,_0x43ec19[_0xd19f('0x12')]));});});}; \ No newline at end of file +var _0x06de=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','catch','UpdateVoiceAgentReport','update','options','raw','where','attributes','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then'];(function(_0x2baed8,_0xe2cb87){var _0x10507a=function(_0xaf5d63){while(--_0xaf5d63){_0x2baed8['push'](_0x2baed8['shift']());}};_0x10507a(++_0xe2cb87);}(_0x06de,0x10d));var _0xe06d=function(_0x51821c,_0x2e39c5){_0x51821c=_0x51821c-0x0;var _0x20bde8=_0x06de[_0x51821c];return _0x20bde8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe06d('0x0'));var BPromise=require(_0xe06d('0x1'));var rs=require(_0xe06d('0x2'));var fs=require('fs');var Redis=require(_0xe06d('0x3'));var db=require(_0xe06d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe06d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe06d('0x6'));var client=jayson[_0xe06d('0x7')][_0xe06d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d7a18,_0x707cb2,_0x452ca0){return new BPromise(function(_0x53827e,_0x289aa9){return client['request'](_0x4d7a18,_0x452ca0)[_0xe06d('0x9')](function(_0x4a8d00){logger[_0xe06d('0xa')](_0xe06d('0xb'),_0x707cb2,_0xe06d('0xc'));logger['debug'](_0xe06d('0xd'),_0x707cb2,_0xe06d('0xc'),JSON[_0xe06d('0xe')](_0x4a8d00));if(_0x4a8d00[_0xe06d('0xf')]){if(_0x4a8d00['error'][_0xe06d('0x10')]===0x1f4){logger[_0xe06d('0xf')](_0xe06d('0xb'),_0x707cb2,_0x4a8d00[_0xe06d('0xf')][_0xe06d('0x11')]);return _0x289aa9(_0x4a8d00['error'][_0xe06d('0x11')]);}logger[_0xe06d('0xf')](_0xe06d('0xb'),_0x707cb2,_0x4a8d00[_0xe06d('0xf')]['message']);return _0x53827e(_0x4a8d00['error'][_0xe06d('0x11')]);}else{logger[_0xe06d('0xa')](_0xe06d('0xb'),_0x707cb2,_0xe06d('0xc'));_0x53827e(_0x4a8d00[_0xe06d('0x12')][_0xe06d('0x11')]);}})['catch'](function(_0x2afa83){logger[_0xe06d('0xf')](_0xe06d('0xb'),_0x707cb2,_0x2afa83);_0x289aa9(_0x2afa83);});});}exports[_0xe06d('0x13')]=function(_0x2aed21){var _0x3ccfe3=this;return new Promise(function(_0x59d968,_0x18112a){return db[_0xe06d('0x14')][_0xe06d('0x15')](_0x2aed21[_0xe06d('0x16')],{'raw':_0x2aed21['options']?_0x2aed21['options']['raw']===undefined?!![]:![]:!![]})[_0xe06d('0x9')](function(_0x29ba5b){logger[_0xe06d('0xa')](_0xe06d('0x13'),_0x2aed21);logger['debug']('CreateVoiceAgentReport',_0x2aed21,JSON['stringify'](_0x29ba5b));_0x59d968(_0x29ba5b);})[_0xe06d('0x17')](function(_0x1c5824){logger['error']('CreateVoiceAgentReport',_0x1c5824['message'],_0x2aed21);_0x18112a(_0x3ccfe3[_0xe06d('0xf')](0x1f4,_0x1c5824['message']));});});};exports[_0xe06d('0x18')]=function(_0x14750b){var _0x1ead26=this;return new Promise(function(_0x4be64f,_0xfd13ec){return db['VoiceAgentReport'][_0xe06d('0x19')](_0x14750b[_0xe06d('0x16')],{'raw':_0x14750b[_0xe06d('0x1a')]?_0x14750b['options'][_0xe06d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14750b[_0xe06d('0x1a')]?_0x14750b['options'][_0xe06d('0x1c')]||null:null,'attributes':_0x14750b[_0xe06d('0x1a')]?_0x14750b[_0xe06d('0x1a')][_0xe06d('0x1d')]||null:null,'limit':_0x14750b[_0xe06d('0x1a')]?_0x14750b[_0xe06d('0x1a')]['limit']||null:null})[_0xe06d('0x9')](function(_0x1c10b7){logger['info'](_0xe06d('0x18'),_0x14750b);logger[_0xe06d('0x1e')]('UpdateVoiceAgentReport',_0x14750b,JSON['stringify'](_0x1c10b7));_0x4be64f(_0x1c10b7);})[_0xe06d('0x17')](function(_0x18de32){logger[_0xe06d('0xf')](_0xe06d('0x18'),_0x18de32[_0xe06d('0x11')],_0x14750b);_0xfd13ec(_0x1ead26[_0xe06d('0xf')](0x1f4,_0x18de32[_0xe06d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3615e72..9e62612 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 _0x5fc3=['/:id','show','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe'];(function(_0x27e615,_0x5d66a3){var _0x5dce06=function(_0x1bde88){while(--_0x1bde88){_0x27e615['push'](_0x27e615['shift']());}};_0x5dce06(++_0x5d66a3);}(_0x5fc3,0xa8));var _0x35fc=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0x5fc3[_0xdefbc3];return _0x367798;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb4c7=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x56bd3c,_0x39e2b8){var _0x36dda2=function(_0x4f457e){while(--_0x4f457e){_0x56bd3c['push'](_0x56bd3c['shift']());}};_0x36dda2(++_0x39e2b8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x101a00,_0x43e44b){_0x101a00=_0x101a00-0x0;var _0x554068=_0xb4c7[_0x101a00];return _0x554068;};'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']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0x10')]('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router['delete']('/:id',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x14')]);module[_0x7b4c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b44d405..b709df6 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 _0xb574=['ENUM','inbound','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x5d9449,_0x5382b7){var _0x583cf7=function(_0x30464f){while(--_0x30464f){_0x5d9449['push'](_0x5d9449['shift']());}};_0x583cf7(++_0x5382b7);}(_0xb574,0x106));var _0x4b57=function(_0x1f3cb0,_0x16ddb1){_0x1f3cb0=_0x1f3cb0-0x0;var _0x5d22f4=_0xb574[_0x1f3cb0];return _0x5d22f4;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4b57('0x2')](_0x4b57('0x3'),'internal',_0x4b57('0x4'),_0x4b57('0x5'),_0x4b57('0x6'),_0x4b57('0x7'))},'tag':{'type':Sequelize[_0x4b57('0x8')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x4b57('0x8')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4b57('0x8')]},'lastdata':{'type':Sequelize[_0x4b57('0x9')]},'starttime':{'type':Sequelize[_0x4b57('0xa')]},'systemanswertime':{'type':Sequelize[_0x4b57('0xa')]},'answertime':{'type':Sequelize[_0x4b57('0xa')]},'endtime':{'type':Sequelize[_0x4b57('0xa')]},'duration':{'type':Sequelize[_0x4b57('0xb')]},'billableseconds':{'type':Sequelize[_0x4b57('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4b57('0x8')]},'amaflags':{'type':Sequelize[_0x4b57('0x8')]},'userfield':{'type':Sequelize[_0x4b57('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x4b57('0x8')]},'note':{'type':Sequelize[_0x4b57('0x8')]},'prefix':{'type':Sequelize[_0x4b57('0x8')]},'routeid':{'type':Sequelize[_0x4b57('0xb')]},'sipcallid':{'type':Sequelize[_0x4b57('0x8')]}}; \ No newline at end of file +var _0x6888=['sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','TEXT','DATE','INTEGER'];(function(_0x55188f,_0x4d1290){var _0x4beb7e=function(_0x4b7163){while(--_0x4b7163){_0x55188f['push'](_0x55188f['shift']());}};_0x4beb7e(++_0x4d1290);}(_0x6888,0xd2));var _0x8688=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6888[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x8688('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8688('0x1')]},'type':{'type':Sequelize[_0x8688('0x2')](_0x8688('0x3'),_0x8688('0x4'),_0x8688('0x5'),_0x8688('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x8688('0x1')]},'accountcode':{'type':Sequelize[_0x8688('0x1')]},'source':{'type':Sequelize[_0x8688('0x1')]},'destination':{'type':Sequelize[_0x8688('0x1')]},'destinationcontext':{'type':Sequelize[_0x8688('0x1')]},'callerid':{'type':Sequelize[_0x8688('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x8688('0x1')]},'lastapplication':{'type':Sequelize[_0x8688('0x1')]},'lastdata':{'type':Sequelize[_0x8688('0x7')]},'starttime':{'type':Sequelize[_0x8688('0x8')]},'systemanswertime':{'type':Sequelize[_0x8688('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x8688('0x9')]},'billableseconds':{'type':Sequelize[_0x8688('0x9')]},'mohtime':{'type':Sequelize[_0x8688('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8688('0x1')]},'amaflags':{'type':Sequelize[_0x8688('0x1')]},'userfield':{'type':Sequelize[_0x8688('0x1')]},'userDisposition':{'type':Sequelize[_0x8688('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x8688('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x8688('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x8688('0x1')]},'routeid':{'type':Sequelize[_0x8688('0x9')]},'sipcallid':{'type':Sequelize[_0x8688('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 68fcee5..f439863 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x12f1b7,_0x3294e5){var _0x1a01ce=function(_0x1da7c2){while(--_0x1da7c2){_0x12f1b7['push'](_0x12f1b7['shift']());}};_0x1a01ce(++_0x3294e5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x0b0e[_0x34df4a];return _0x145c69;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','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','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0xadb5,0xad));var _0x5adb=function(_0x509e26,_0x24fed5){_0x509e26=_0x509e26-0x0;var _0x4346c7=_0xadb5[_0x509e26];return _0x4346c7;};'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['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 7bb681f..209acaa 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 _0xfc97=['report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','VoiceCallReport'];(function(_0x39a387,_0x496459){var _0x4d9420=function(_0x2b9cda){while(--_0x2b9cda){_0x39a387['push'](_0x39a387['shift']());}};_0x4d9420(++_0x496459);}(_0xfc97,0x15d));var _0x7fc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc97[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7fc9('0x0'));var util=require(_0x7fc9('0x1'));var logger=require(_0x7fc9('0x2'))(_0x7fc9('0x3'));var moment=require(_0x7fc9('0x4'));var BPromise=require(_0x7fc9('0x5'));var rp=require(_0x7fc9('0x6'));var fs=require('fs');var path=require(_0x7fc9('0x7'));var rimraf=require(_0x7fc9('0x8'));var config=require(_0x7fc9('0x9'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x127c00,_0x431624){return _0x127c00['define'](_0x7fc9('0xa'),attributes,{'tableName':_0x7fc9('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x05ef=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x05ef,0xea));var _0xf05e=function(_0x4aa7e2,_0x1373af){_0x4aa7e2=_0x4aa7e2-0x0;var _0x1effa9=_0x05ef[_0x4aa7e2];return _0x1effa9;};'use strict';var _=require(_0xf05e('0x0'));var util=require('util');var logger=require(_0xf05e('0x1'))(_0xf05e('0x2'));var moment=require('moment');var BPromise=require(_0xf05e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf05e('0x4'));var rimraf=require(_0xf05e('0x5'));var config=require(_0xf05e('0x6'));var attributes=require(_0xf05e('0x7'));module[_0xf05e('0x8')]=function(_0x28b0aa,_0x3b9ab3){return _0x28b0aa[_0xf05e('0x9')](_0xf05e('0xa'),attributes,{'tableName':_0xf05e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf05e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 83f6929..6f5f519 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 _0xbb36=['http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceCallReport','findAll','options','where','attributes','limit','include','map','model','debug','CreateVoiceCallReport','VoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5f3100,_0x3989ad){var _0x560c7e=function(_0x7ed656){while(--_0x7ed656){_0x5f3100['push'](_0x5f3100['shift']());}};_0x560c7e(++_0x3989ad);}(_0xbb36,0x186));var _0x6bb3=function(_0x37a886,_0x132ed9){_0x37a886=_0x37a886-0x0;var _0x305523=_0xbb36[_0x37a886];return _0x305523;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6bb3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bb3('0x1'));var db=require(_0x6bb3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bb3('0x3'))('rpc');var config=require(_0x6bb3('0x4'));var jayson=require(_0x6bb3('0x5'));var client=jayson['client'][_0x6bb3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x417278,_0x16198b,_0x5f2b03){return new BPromise(function(_0x3ccc9e,_0x12ecce){return client['request'](_0x417278,_0x5f2b03)[_0x6bb3('0x7')](function(_0x55740e){logger[_0x6bb3('0x8')](_0x6bb3('0x9'),_0x16198b,_0x6bb3('0xa'));logger['debug'](_0x6bb3('0xb'),_0x16198b,_0x6bb3('0xa'),JSON[_0x6bb3('0xc')](_0x55740e));if(_0x55740e[_0x6bb3('0xd')]){if(_0x55740e[_0x6bb3('0xd')]['code']===0x1f4){logger[_0x6bb3('0xd')](_0x6bb3('0x9'),_0x16198b,_0x55740e['error']['message']);return _0x12ecce(_0x55740e['error'][_0x6bb3('0xe')]);}logger[_0x6bb3('0xd')](_0x6bb3('0x9'),_0x16198b,_0x55740e[_0x6bb3('0xd')][_0x6bb3('0xe')]);return _0x3ccc9e(_0x55740e[_0x6bb3('0xd')]['message']);}else{logger[_0x6bb3('0x8')](_0x6bb3('0x9'),_0x16198b,_0x6bb3('0xa'));_0x3ccc9e(_0x55740e['result']['message']);}})[_0x6bb3('0xf')](function(_0x763621){logger[_0x6bb3('0xd')](_0x6bb3('0x9'),_0x16198b,_0x763621);_0x12ecce(_0x763621);});});}exports[_0x6bb3('0x10')]=function(_0x177047){var _0x2e41e4=this;return new Promise(function(_0x469bba,_0x55d3ee){return db['VoiceCallReport'][_0x6bb3('0x11')]({'raw':_0x177047[_0x6bb3('0x12')]?_0x177047[_0x6bb3('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x177047[_0x6bb3('0x12')]?_0x177047[_0x6bb3('0x12')][_0x6bb3('0x13')]||null:null,'attributes':_0x177047[_0x6bb3('0x12')]?_0x177047['options'][_0x6bb3('0x14')]||null:null,'limit':_0x177047[_0x6bb3('0x12')]?_0x177047[_0x6bb3('0x12')][_0x6bb3('0x15')]||null:null,'include':_0x177047['options']?_0x177047[_0x6bb3('0x12')][_0x6bb3('0x16')]?_[_0x6bb3('0x17')](_0x177047[_0x6bb3('0x12')][_0x6bb3('0x16')],function(_0x536692){return{'model':db[_0x536692[_0x6bb3('0x18')]],'as':_0x536692['as'],'attributes':_0x536692[_0x6bb3('0x14')],'include':_0x536692[_0x6bb3('0x16')]?_[_0x6bb3('0x17')](_0x536692[_0x6bb3('0x16')],function(_0x1d25c7){return{'model':db[_0x1d25c7[_0x6bb3('0x18')]],'as':_0x1d25c7['as'],'attributes':_0x1d25c7[_0x6bb3('0x14')],'include':_0x1d25c7[_0x6bb3('0x16')]?_[_0x6bb3('0x17')](_0x1d25c7['include'],function(_0x5a9530){return{'model':db[_0x5a9530[_0x6bb3('0x18')]],'as':_0x5a9530['as'],'attributes':_0x5a9530['attributes']};}):[]};}):[]};}):[]:[]})[_0x6bb3('0x7')](function(_0x5a2a1e){logger['info']('GetVoiceCallReport',_0x177047);logger[_0x6bb3('0x19')]('GetVoiceCallReport',_0x177047,JSON[_0x6bb3('0xc')](_0x5a2a1e));_0x469bba(_0x5a2a1e);})[_0x6bb3('0xf')](function(_0x3a21fa){logger['error'](_0x6bb3('0x10'),_0x3a21fa[_0x6bb3('0xe')],_0x177047);_0x55d3ee(_0x2e41e4[_0x6bb3('0xd')](0x1f4,_0x3a21fa[_0x6bb3('0xe')]));});});};exports[_0x6bb3('0x1a')]=function(_0xb78ce0){var _0x2e21b8=this;return new Promise(function(_0x15dacb,_0x719590){return db[_0x6bb3('0x1b')][_0x6bb3('0x1c')](_0xb78ce0[_0x6bb3('0x1d')],{'raw':_0xb78ce0[_0x6bb3('0x12')]?_0xb78ce0['options'][_0x6bb3('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2c6a23){logger[_0x6bb3('0x8')](_0x6bb3('0x1a'),_0xb78ce0);logger['debug'](_0x6bb3('0x1a'),_0xb78ce0,JSON[_0x6bb3('0xc')](_0x2c6a23));_0x15dacb(_0x2c6a23);})[_0x6bb3('0xf')](function(_0xceced5){logger[_0x6bb3('0xd')]('CreateVoiceCallReport',_0xceced5[_0x6bb3('0xe')],_0xb78ce0);_0x719590(_0x2e21b8[_0x6bb3('0xd')](0x1f4,_0xceced5[_0x6bb3('0xe')]));});});};exports[_0x6bb3('0x1f')]=function(_0x17a54d){var _0x119656=this;return new Promise(function(_0x2ff776,_0x5e07d9){return db['VoiceCallReport'][_0x6bb3('0x20')](_0x17a54d[_0x6bb3('0x1d')],{'raw':_0x17a54d[_0x6bb3('0x12')]?_0x17a54d[_0x6bb3('0x12')][_0x6bb3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17a54d[_0x6bb3('0x12')]?_0x17a54d[_0x6bb3('0x12')]['where']||null:null,'attributes':_0x17a54d[_0x6bb3('0x12')]?_0x17a54d['options'][_0x6bb3('0x14')]||null:null,'limit':_0x17a54d[_0x6bb3('0x12')]?_0x17a54d[_0x6bb3('0x12')]['limit']||null:null})[_0x6bb3('0x7')](function(_0x11f826){logger[_0x6bb3('0x8')]('UpdateVoiceCallReport',_0x17a54d);logger['debug'](_0x6bb3('0x1f'),_0x17a54d,JSON[_0x6bb3('0xc')](_0x11f826));_0x2ff776(_0x11f826);})[_0x6bb3('0xf')](function(_0x8121c4){logger[_0x6bb3('0xd')](_0x6bb3('0x1f'),_0x8121c4[_0x6bb3('0xe')],_0x17a54d);_0x5e07d9(_0x119656[_0x6bb3('0xd')](0x1f4,_0x8121c4[_0x6bb3('0xe')]));});});}; \ No newline at end of file +var _0xd909=['body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport'];(function(_0x6d5fb,_0x3cc9b6){var _0x3f69a6=function(_0x362103){while(--_0x362103){_0x6d5fb['push'](_0x6d5fb['shift']());}};_0x3f69a6(++_0x3cc9b6);}(_0xd909,0x13b));var _0x9d90=function(_0x4f9edc,_0x3e496d){_0x4f9edc=_0x4f9edc-0x0;var _0x5c7b3b=_0xd909[_0x4f9edc];return _0x5c7b3b;};'use strict';var _=require(_0x9d90('0x0'));var util=require(_0x9d90('0x1'));var moment=require(_0x9d90('0x2'));var BPromise=require(_0x9d90('0x3'));var rs=require(_0x9d90('0x4'));var fs=require('fs');var Redis=require(_0x9d90('0x5'));var db=require(_0x9d90('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d90('0x7'))('rpc');var config=require(_0x9d90('0x8'));var jayson=require(_0x9d90('0x9'));var client=jayson[_0x9d90('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf4bc26,_0x9a602e,_0x7ed18b){return new BPromise(function(_0x15549b,_0x1b4a2e){return client[_0x9d90('0xb')](_0xf4bc26,_0x7ed18b)[_0x9d90('0xc')](function(_0xe11090){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x9a602e,'request\x20sent');logger[_0x9d90('0xd')](_0x9d90('0xe'),_0x9a602e,_0x9d90('0xf'),JSON[_0x9d90('0x10')](_0xe11090));if(_0xe11090[_0x9d90('0x11')]){if(_0xe11090[_0x9d90('0x11')][_0x9d90('0x12')]===0x1f4){logger[_0x9d90('0x11')](_0x9d90('0x13'),_0x9a602e,_0xe11090[_0x9d90('0x11')][_0x9d90('0x14')]);return _0x1b4a2e(_0xe11090[_0x9d90('0x11')][_0x9d90('0x14')]);}logger[_0x9d90('0x11')](_0x9d90('0x13'),_0x9a602e,_0xe11090[_0x9d90('0x11')][_0x9d90('0x14')]);return _0x15549b(_0xe11090[_0x9d90('0x11')][_0x9d90('0x14')]);}else{logger[_0x9d90('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x9a602e,_0x9d90('0xf'));_0x15549b(_0xe11090[_0x9d90('0x16')][_0x9d90('0x14')]);}})[_0x9d90('0x17')](function(_0x56862a){logger[_0x9d90('0x11')](_0x9d90('0x13'),_0x9a602e,_0x56862a);_0x1b4a2e(_0x56862a);});});}exports['GetVoiceCallReport']=function(_0x29e39d){var _0x46f51b=this;return new Promise(function(_0x4a631c,_0x4698c1){return db[_0x9d90('0x18')][_0x9d90('0x19')]({'raw':_0x29e39d[_0x9d90('0x1a')]?_0x29e39d[_0x9d90('0x1a')][_0x9d90('0x1b')]===undefined?!![]:![]:!![],'where':_0x29e39d['options']?_0x29e39d[_0x9d90('0x1a')][_0x9d90('0x1c')]||null:null,'attributes':_0x29e39d[_0x9d90('0x1a')]?_0x29e39d[_0x9d90('0x1a')][_0x9d90('0x1d')]||null:null,'limit':_0x29e39d[_0x9d90('0x1a')]?_0x29e39d[_0x9d90('0x1a')][_0x9d90('0x1e')]||null:null,'include':_0x29e39d[_0x9d90('0x1a')]?_0x29e39d['options'][_0x9d90('0x1f')]?_[_0x9d90('0x20')](_0x29e39d[_0x9d90('0x1a')]['include'],function(_0x3748e2){return{'model':db[_0x3748e2[_0x9d90('0x21')]],'as':_0x3748e2['as'],'attributes':_0x3748e2[_0x9d90('0x1d')],'include':_0x3748e2[_0x9d90('0x1f')]?_[_0x9d90('0x20')](_0x3748e2[_0x9d90('0x1f')],function(_0x5b2b33){return{'model':db[_0x5b2b33[_0x9d90('0x21')]],'as':_0x5b2b33['as'],'attributes':_0x5b2b33[_0x9d90('0x1d')],'include':_0x5b2b33[_0x9d90('0x1f')]?_[_0x9d90('0x20')](_0x5b2b33[_0x9d90('0x1f')],function(_0xb4e46d){return{'model':db[_0xb4e46d[_0x9d90('0x21')]],'as':_0xb4e46d['as'],'attributes':_0xb4e46d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d90('0xc')](function(_0x4f6123){logger[_0x9d90('0x15')]('GetVoiceCallReport',_0x29e39d);logger[_0x9d90('0xd')](_0x9d90('0x22'),_0x29e39d,JSON['stringify'](_0x4f6123));_0x4a631c(_0x4f6123);})[_0x9d90('0x17')](function(_0x3e7861){logger['error'](_0x9d90('0x22'),_0x3e7861['message'],_0x29e39d);_0x4698c1(_0x46f51b['error'](0x1f4,_0x3e7861[_0x9d90('0x14')]));});});};exports[_0x9d90('0x23')]=function(_0x473179){var _0x332b84=this;return new Promise(function(_0x1b8b6f,_0x288e87){return db[_0x9d90('0x18')]['create'](_0x473179[_0x9d90('0x24')],{'raw':_0x473179[_0x9d90('0x1a')]?_0x473179[_0x9d90('0x1a')][_0x9d90('0x1b')]===undefined?!![]:![]:!![]})[_0x9d90('0xc')](function(_0x1123da){logger['info'](_0x9d90('0x23'),_0x473179);logger[_0x9d90('0xd')](_0x9d90('0x23'),_0x473179,JSON[_0x9d90('0x10')](_0x1123da));_0x1b8b6f(_0x1123da);})[_0x9d90('0x17')](function(_0xd14e5c){logger[_0x9d90('0x11')](_0x9d90('0x23'),_0xd14e5c['message'],_0x473179);_0x288e87(_0x332b84['error'](0x1f4,_0xd14e5c[_0x9d90('0x14')]));});});};exports[_0x9d90('0x25')]=function(_0xa3cec9){var _0x4c9a0f=this;return new Promise(function(_0x651384,_0x42ef90){return db[_0x9d90('0x18')][_0x9d90('0x26')](_0xa3cec9['body'],{'raw':_0xa3cec9[_0x9d90('0x1a')]?_0xa3cec9[_0x9d90('0x1a')][_0x9d90('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa3cec9['options']?_0xa3cec9[_0x9d90('0x1a')][_0x9d90('0x1c')]||null:null,'attributes':_0xa3cec9['options']?_0xa3cec9['options']['attributes']||null:null,'limit':_0xa3cec9[_0x9d90('0x1a')]?_0xa3cec9['options'][_0x9d90('0x1e')]||null:null})[_0x9d90('0xc')](function(_0x150545){logger[_0x9d90('0x15')]('UpdateVoiceCallReport',_0xa3cec9);logger[_0x9d90('0xd')](_0x9d90('0x25'),_0xa3cec9,JSON[_0x9d90('0x10')](_0x150545));_0x651384(_0x150545);})[_0x9d90('0x17')](function(_0x429a8f){logger['error'](_0x9d90('0x25'),_0x429a8f[_0x9d90('0x14')],_0xa3cec9);_0x42ef90(_0x4c9a0f[_0x9d90('0x11')](0x1f4,_0x429a8f[_0x9d90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b8e762f..a0bd4fb 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 _0xb1a0=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','create'];(function(_0x2ff805,_0x5e563b){var _0x17aa05=function(_0x3e8823){while(--_0x3e8823){_0x2ff805['push'](_0x2ff805['shift']());}};_0x17aa05(++_0x5e563b);}(_0xb1a0,0x114));var _0x0b1a=function(_0x43f5e4,_0x597d0a){_0x43f5e4=_0x43f5e4-0x0;var _0x20a1ff=_0xb1a0[_0x43f5e4];return _0x20a1ff;};'use strict';var multer=require(_0x0b1a('0x0'));var util=require(_0x0b1a('0x1'));var path=require(_0x0b1a('0x2'));var timeout=require(_0x0b1a('0x3'));var express=require(_0x0b1a('0x4'));var router=express[_0x0b1a('0x5')]();var fs_extra=require(_0x0b1a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0b1a('0x7'));router[_0x0b1a('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b1a('0x9')]);router[_0x0b1a('0x8')](_0x0b1a('0xa'),auth[_0x0b1a('0xb')](),controller['show']);router['post']('/',auth[_0x0b1a('0xb')](),controller[_0x0b1a('0xc')]);router[_0x0b1a('0xd')](_0x0b1a('0xa'),auth[_0x0b1a('0xb')](),controller[_0x0b1a('0xe')]);router[_0x0b1a('0xf')](_0x0b1a('0xa'),auth['isAuthenticated'](),controller[_0x0b1a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf269=['util','path','express','Router','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy'];(function(_0xad5c51,_0x6c7293){var _0x140053=function(_0x44b43b){while(--_0x44b43b){_0xad5c51['push'](_0xad5c51['shift']());}};_0x140053(++_0x6c7293);}(_0xf269,0xd2));var _0x9f26=function(_0x1616b0,_0xa83df5){_0x1616b0=_0x1616b0-0x0;var _0xb47161=_0xf269[_0x1616b0];return _0xb47161;};'use strict';var multer=require('multer');var util=require(_0x9f26('0x0'));var path=require(_0x9f26('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f26('0x2'));var router=express[_0x9f26('0x3')]();var fs_extra=require(_0x9f26('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f26('0x5'));var config=require('../../config/environment');var controller=require(_0x9f26('0x6'));router[_0x9f26('0x7')]('/',auth[_0x9f26('0x8')](),controller[_0x9f26('0x9')]);router[_0x9f26('0x7')](_0x9f26('0xa'),auth[_0x9f26('0x8')](),controller[_0x9f26('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9f26('0xc')](_0x9f26('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x9f26('0xd')](_0x9f26('0xa'),auth[_0x9f26('0x8')](),controller[_0x9f26('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index fe7190b..2ea5b4c 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 _0x3281=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x304be0,_0x16f092){var _0x4fcdab=function(_0x4bc1d4){while(--_0x4bc1d4){_0x304be0['push'](_0x304be0['shift']());}};_0x4fcdab(++_0x16f092);}(_0x3281,0x1d7));var _0x1328=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x3281[_0x28d18d];return _0x470640;};'use strict';var Sequelize=require(_0x1328('0x0'));module[_0x1328('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1328('0x2')],'unique':_0x1328('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x1328('0x2')],'set':function(_0xf59614){this[_0x1328('0x4')](_0x1328('0x5'),_0xf59614?_0xf59614['join'](''):[]);},'get':function(){return this[_0x1328('0x6')](_0x1328('0x5'))?this['getDataValue'](_0x1328('0x5'))[_0x1328('0x7')](''):[];}},'auth':{'type':Sequelize[_0x1328('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x1328('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1328('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x836f=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x250f93,_0x4d6d01){var _0x55d6f3=function(_0x273605){while(--_0x273605){_0x250f93['push'](_0x250f93['shift']());}};_0x55d6f3(++_0x4d6d01);}(_0x836f,0xe3));var _0xf836=function(_0x10dbb0,_0x5b2b80){_0x10dbb0=_0x10dbb0-0x0;var _0x5cc7d3=_0x836f[_0x10dbb0];return _0x5cc7d3;};'use strict';var Sequelize=require(_0xf836('0x0'));module[_0xf836('0x1')]={'name':{'type':Sequelize[_0xf836('0x2')]},'prefix':{'type':Sequelize[_0xf836('0x2')],'unique':_0xf836('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf836('0x2')],'set':function(_0x5e7489){this[_0xf836('0x4')](_0xf836('0x5'),_0x5e7489?_0x5e7489[_0xf836('0x6')](''):[]);},'get':function(){return this[_0xf836('0x7')](_0xf836('0x5'))?this['getDataValue'](_0xf836('0x5'))[_0xf836('0x8')](''):[];}},'auth':{'type':Sequelize[_0xf836('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf836('0x2')]},'description':{'type':Sequelize[_0xf836('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 51a935a..1311a6b 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 _0xe189=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','destroy','error','name','send','VoiceChanSpy','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x3508b3,_0x4ced77){var _0x2df65b=function(_0x2eb385){while(--_0x2eb385){_0x3508b3['push'](_0x3508b3['shift']());}};_0x2df65b(++_0x4ced77);}(_0xe189,0x194));var _0x9e18=function(_0x55d663,_0x1b4791){_0x55d663=_0x55d663-0x0;var _0x1d2f64=_0xe189[_0x55d663];return _0x1d2f64;};'use strict';var emlformat=require(_0x9e18('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9e18('0x1'));var rp=require(_0x9e18('0x2'));var moment=require(_0x9e18('0x3'));var BPromise=require(_0x9e18('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e18('0x5'));var sox=require(_0x9e18('0x6'));var csv=require(_0x9e18('0x7'));var ejs=require(_0x9e18('0x8'));var fs=require('fs');var fs_extra=require(_0x9e18('0x9'));var _=require('lodash');var squel=require(_0x9e18('0xa'));var crypto=require(_0x9e18('0xb'));var jsforce=require(_0x9e18('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9e18('0x7'));var querystring=require(_0x9e18('0xd'));var Papa=require(_0x9e18('0xe'));var Redis=require('ioredis');var authService=require(_0x9e18('0xf'));var qs=require(_0x9e18('0x10'));var as=require(_0x9e18('0x11'));var hardwareService=require(_0x9e18('0x12'));var logger=require(_0x9e18('0x13'))(_0x9e18('0x14'));var utils=require(_0x9e18('0x15'));var config=require(_0x9e18('0x16'));var licenseUtil=require(_0x9e18('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3617b0,_0x502513){_0x502513=_0x502513||0xcc;return function(_0x39a077){if(_0x39a077){return _0x3617b0[_0x9e18('0x18')](_0x502513);}return _0x3617b0['status'](_0x502513)[_0x9e18('0x19')]();};}function respondWithResult(_0x30516d,_0x35c4e1){_0x35c4e1=_0x35c4e1||0xc8;return function(_0x97e41a){if(_0x97e41a){return _0x30516d['status'](_0x35c4e1)[_0x9e18('0x1a')](_0x97e41a);}};}function respondWithFilteredResult(_0x58c360,_0x57bcd9){return function(_0xb10405){if(_0xb10405){var _0x4e7bcb=typeof _0x57bcd9[_0x9e18('0x1b')]===_0x9e18('0x1c')&&typeof _0x57bcd9[_0x9e18('0x1d')]===_0x9e18('0x1c');var _0x576e6e=_0xb10405['count'];var _0x15cf20=_0x4e7bcb?0x0:_0x57bcd9[_0x9e18('0x1b')];var _0x57cd1f=_0x4e7bcb?_0xb10405[_0x9e18('0x1e')]:_0x57bcd9['offset']+_0x57bcd9[_0x9e18('0x1d')];var _0x538b16;if(_0x57cd1f>=_0x576e6e){_0x57cd1f=_0x576e6e;_0x538b16=0xc8;}else{_0x538b16=0xce;}_0x58c360[_0x9e18('0x1f')](_0x538b16);return _0x58c360[_0x9e18('0x20')](_0x9e18('0x21'),_0x15cf20+'-'+_0x57cd1f+'/'+_0x576e6e)[_0x9e18('0x1a')](_0xb10405);}return null;};}function patchUpdates(_0x1fb910){return function(_0x3fb6ba){try{jsonpatch[_0x9e18('0x22')](_0x3fb6ba,_0x1fb910,!![]);}catch(_0xfeff85){return BPromise[_0x9e18('0x23')](_0xfeff85);}return _0x3fb6ba['save']();};}function saveUpdates(_0x3a24ad,_0x24cc43){return function(_0x37738e){if(_0x37738e){return _0x37738e['update'](_0x3a24ad)[_0x9e18('0x24')](function(_0x4aec75){return _0x4aec75;});}return null;};}function removeEntity(_0x4b591,_0x50131d){return function(_0x2f5a26){if(_0x2f5a26){return _0x2f5a26['destroy']()[_0x9e18('0x24')](function(){var _0x1bd289=_0x2f5a26['get']({'plain':!![]});var _0x12f90d='ChanSpies';return db['UserProfileResource'][_0x9e18('0x25')]({'where':{'type':_0x12f90d,'resourceId':_0x1bd289['id']}})['then'](function(){return _0x2f5a26;});})[_0x9e18('0x24')](function(){_0x4b591['status'](0xcc)[_0x9e18('0x19')]();});}};}function handleEntityNotFound(_0x413dce,_0x2cee0f){return function(_0xd115f3){if(!_0xd115f3){_0x413dce[_0x9e18('0x18')](0x194);}return _0xd115f3;};}function handleError(_0x13d3c2,_0x10c119){_0x10c119=_0x10c119||0x1f4;return function(_0x3917fb){logger[_0x9e18('0x26')](_0x3917fb['stack']);if(_0x3917fb[_0x9e18('0x27')]){delete _0x3917fb[_0x9e18('0x27')];}_0x13d3c2[_0x9e18('0x1f')](_0x10c119)[_0x9e18('0x28')](_0x3917fb);};}exports['index']=function(_0x56cb83,_0x410655){var _0x1bb217={},_0x3f6510={},_0x3d4da3={'count':0x0,'rows':[]};var _0x1e4208=_['map'](db[_0x9e18('0x29')][_0x9e18('0x2a')],function(_0x12f451){return{'name':_0x12f451[_0x9e18('0x2b')],'type':_0x12f451[_0x9e18('0x2c')][_0x9e18('0x2d')]};});_0x3f6510['model']=_[_0x9e18('0x2e')](_0x1e4208,_0x9e18('0x27'));_0x3f6510[_0x9e18('0x2f')]=_[_0x9e18('0x30')](_0x56cb83[_0x9e18('0x2f')]);_0x3f6510['filters']=_['intersection'](_0x3f6510[_0x9e18('0x31')],_0x3f6510[_0x9e18('0x2f')]);_0x1bb217[_0x9e18('0x32')]=_[_0x9e18('0x33')](_0x3f6510['model'],qs[_0x9e18('0x34')](_0x56cb83[_0x9e18('0x2f')][_0x9e18('0x34')]));_0x1bb217['attributes']=_0x1bb217[_0x9e18('0x32')]['length']?_0x1bb217[_0x9e18('0x32')]:_0x3f6510['model'];if(!_0x56cb83[_0x9e18('0x2f')][_0x9e18('0x35')](_0x9e18('0x36'))){_0x1bb217[_0x9e18('0x1d')]=qs[_0x9e18('0x1d')](_0x56cb83[_0x9e18('0x2f')][_0x9e18('0x1d')]);_0x1bb217[_0x9e18('0x1b')]=qs[_0x9e18('0x1b')](_0x56cb83[_0x9e18('0x2f')][_0x9e18('0x1b')]);}_0x1bb217['order']=qs[_0x9e18('0x37')](_0x56cb83[_0x9e18('0x2f')][_0x9e18('0x37')]);_0x1bb217[_0x9e18('0x38')]=qs[_0x9e18('0x39')](_[_0x9e18('0x3a')](_0x56cb83[_0x9e18('0x2f')],_0x3f6510[_0x9e18('0x39')]),_0x1e4208);if(_0x56cb83[_0x9e18('0x2f')][_0x9e18('0x3b')]){_0x1bb217[_0x9e18('0x38')]=_[_0x9e18('0x3c')](_0x1bb217[_0x9e18('0x38')],{'$or':_[_0x9e18('0x2e')](_0x1e4208,function(_0x479f64){if(_0x479f64[_0x9e18('0x2c')]!==_0x9e18('0x3d')){var _0x3dc07c={};_0x3dc07c[_0x479f64['name']]={'$like':'%'+_0x56cb83[_0x9e18('0x2f')][_0x9e18('0x3b')]+'%'};return _0x3dc07c;}})});}_0x1bb217=_[_0x9e18('0x3c')]({},_0x1bb217,_0x56cb83[_0x9e18('0x3e')]);var _0x33d301={'where':_0x1bb217[_0x9e18('0x38')]};return db[_0x9e18('0x29')][_0x9e18('0x1e')](_0x33d301)[_0x9e18('0x24')](function(_0x1eadc5){_0x3d4da3['count']=_0x1eadc5;if(_0x56cb83['query']['includeAll']){_0x1bb217[_0x9e18('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x1bb217);})[_0x9e18('0x24')](function(_0xb11dc0){_0x3d4da3[_0x9e18('0x40')]=_0xb11dc0;return _0x3d4da3;})['then'](respondWithFilteredResult(_0x410655,_0x1bb217))[_0x9e18('0x41')](handleError(_0x410655,null));};exports[_0x9e18('0x42')]=function(_0x27c441,_0x3338f4){var _0x2be3b1={'raw':![],'where':{'id':_0x27c441[_0x9e18('0x43')]['id']}},_0x47a2e7={};_0x47a2e7[_0x9e18('0x31')]=_[_0x9e18('0x30')](db[_0x9e18('0x29')]['rawAttributes']);_0x47a2e7[_0x9e18('0x2f')]=_[_0x9e18('0x30')](_0x27c441[_0x9e18('0x2f')]);_0x47a2e7[_0x9e18('0x39')]=_[_0x9e18('0x33')](_0x47a2e7['model'],_0x47a2e7[_0x9e18('0x2f')]);_0x2be3b1[_0x9e18('0x32')]=_[_0x9e18('0x33')](_0x47a2e7[_0x9e18('0x31')],qs[_0x9e18('0x34')](_0x27c441['query']['fields']));_0x2be3b1['attributes']=_0x2be3b1['attributes'][_0x9e18('0x44')]?_0x2be3b1[_0x9e18('0x32')]:_0x47a2e7[_0x9e18('0x31')];if(_0x27c441[_0x9e18('0x2f')][_0x9e18('0x45')]){_0x2be3b1['include']=[{'all':!![]}];}_0x2be3b1=_[_0x9e18('0x3c')]({},_0x2be3b1,_0x27c441[_0x9e18('0x3e')]);return db[_0x9e18('0x29')][_0x9e18('0x46')](_0x2be3b1)['then'](handleEntityNotFound(_0x3338f4,null))['then'](respondWithResult(_0x3338f4,null))[_0x9e18('0x41')](handleError(_0x3338f4,null));};exports[_0x9e18('0x47')]=function(_0x1887ca,_0x28a370){return db[_0x9e18('0x29')][_0x9e18('0x47')](_0x1887ca['body'],{})[_0x9e18('0x24')](function(_0x49a2c1){var _0x21b82b=_0x1887ca[_0x9e18('0x48')][_0x9e18('0x49')]({'plain':!![]});if(!_0x21b82b)throw new Error(_0x9e18('0x4a'));if(_0x21b82b[_0x9e18('0x4b')]===_0x9e18('0x48')){var _0x2ae645=_0x49a2c1[_0x9e18('0x49')]({'plain':!![]});var _0x352ca5=_0x9e18('0x4c');return db[_0x9e18('0x4d')][_0x9e18('0x46')]({'where':{'name':_0x352ca5,'userProfileId':_0x21b82b[_0x9e18('0x4e')]},'raw':!![]})[_0x9e18('0x24')](function(_0x25eb32){if(_0x25eb32&&_0x25eb32['autoAssociation']===0x0){return db[_0x9e18('0x4f')][_0x9e18('0x47')]({'name':_0x2ae645[_0x9e18('0x27')],'resourceId':_0x2ae645['id'],'type':_0x25eb32[_0x9e18('0x27')],'sectionId':_0x25eb32['id']},{})[_0x9e18('0x24')](function(){return _0x49a2c1;});}else{return _0x49a2c1;}})['catch'](function(_0x2630aa){logger[_0x9e18('0x26')](_0x9e18('0x50'),_0x2630aa);throw _0x2630aa;});}return _0x49a2c1;})[_0x9e18('0x24')](respondWithResult(_0x28a370,0xc9))[_0x9e18('0x41')](handleError(_0x28a370,null));};exports[_0x9e18('0x51')]=function(_0x1db24e,_0x454088){if(_0x1db24e[_0x9e18('0x52')]['id']){delete _0x1db24e[_0x9e18('0x52')]['id'];}return db[_0x9e18('0x29')][_0x9e18('0x46')]({'where':{'id':_0x1db24e[_0x9e18('0x43')]['id']}})[_0x9e18('0x24')](handleEntityNotFound(_0x454088,null))[_0x9e18('0x24')](saveUpdates(_0x1db24e[_0x9e18('0x52')],null))[_0x9e18('0x24')](respondWithResult(_0x454088,null))[_0x9e18('0x41')](handleError(_0x454088,null));};exports[_0x9e18('0x25')]=function(_0x1c1f3f,_0x473602){return db[_0x9e18('0x29')][_0x9e18('0x46')]({'where':{'id':_0x1c1f3f[_0x9e18('0x43')]['id']}})[_0x9e18('0x24')](handleEntityNotFound(_0x473602,null))[_0x9e18('0x24')](removeEntity(_0x473602,null))[_0x9e18('0x41')](handleError(_0x473602,null));}; \ No newline at end of file +var _0x3b75=['send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name'];(function(_0x580ad7,_0x1daf48){var _0x16e34f=function(_0x16a24f){while(--_0x16a24f){_0x580ad7['push'](_0x580ad7['shift']());}};_0x16e34f(++_0x1daf48);}(_0x3b75,0xdc));var _0x53b7=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x3b75[_0x23c73d];return _0x36ba47;};'use strict';var emlformat=require(_0x53b7('0x0'));var rimraf=require(_0x53b7('0x1'));var zipdir=require(_0x53b7('0x2'));var jsonpatch=require(_0x53b7('0x3'));var rp=require(_0x53b7('0x4'));var moment=require('moment');var BPromise=require(_0x53b7('0x5'));var Mustache=require('mustache');var util=require(_0x53b7('0x6'));var path=require('path');var sox=require(_0x53b7('0x7'));var csv=require(_0x53b7('0x8'));var ejs=require(_0x53b7('0x9'));var fs=require('fs');var fs_extra=require(_0x53b7('0xa'));var _=require(_0x53b7('0xb'));var squel=require('squel');var crypto=require(_0x53b7('0xc'));var jsforce=require(_0x53b7('0xd'));var deskjs=require(_0x53b7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x53b7('0xf'));var Papa=require('papaparse');var Redis=require(_0x53b7('0x10'));var authService=require(_0x53b7('0x11'));var qs=require(_0x53b7('0x12'));var as=require(_0x53b7('0x13'));var hardwareService=require(_0x53b7('0x14'));var logger=require('../../config/logger')(_0x53b7('0x15'));var utils=require(_0x53b7('0x16'));var config=require(_0x53b7('0x17'));var licenseUtil=require(_0x53b7('0x18'));var db=require(_0x53b7('0x19'))['db'];function respondWithStatusCode(_0x284ab3,_0x10f7c1){_0x10f7c1=_0x10f7c1||0xcc;return function(_0x2171b7){if(_0x2171b7){return _0x284ab3[_0x53b7('0x1a')](_0x10f7c1);}return _0x284ab3['status'](_0x10f7c1)[_0x53b7('0x1b')]();};}function respondWithResult(_0x2b38b1,_0x4aaa3d){_0x4aaa3d=_0x4aaa3d||0xc8;return function(_0x55ca23){if(_0x55ca23){return _0x2b38b1['status'](_0x4aaa3d)[_0x53b7('0x1c')](_0x55ca23);}};}function respondWithFilteredResult(_0x277a1c,_0x40882c){return function(_0x47981a){if(_0x47981a){var _0x38fa59=typeof _0x40882c[_0x53b7('0x1d')]===_0x53b7('0x1e')&&typeof _0x40882c[_0x53b7('0x1f')]===_0x53b7('0x1e');var _0x34b69d=_0x47981a['count'];var _0x4eaf6a=_0x38fa59?0x0:_0x40882c[_0x53b7('0x1d')];var _0x45b608=_0x38fa59?_0x47981a[_0x53b7('0x20')]:_0x40882c[_0x53b7('0x1d')]+_0x40882c[_0x53b7('0x1f')];var _0x2ef4f6;if(_0x45b608>=_0x34b69d){_0x45b608=_0x34b69d;_0x2ef4f6=0xc8;}else{_0x2ef4f6=0xce;}_0x277a1c[_0x53b7('0x21')](_0x2ef4f6);return _0x277a1c[_0x53b7('0x22')](_0x53b7('0x23'),_0x4eaf6a+'-'+_0x45b608+'/'+_0x34b69d)['json'](_0x47981a);}return null;};}function patchUpdates(_0x3b8187){return function(_0x2002f9){try{jsonpatch[_0x53b7('0x24')](_0x2002f9,_0x3b8187,!![]);}catch(_0x2ce998){return BPromise[_0x53b7('0x25')](_0x2ce998);}return _0x2002f9[_0x53b7('0x26')]();};}function saveUpdates(_0x332004,_0x237dc9){return function(_0x1132eb){if(_0x1132eb){return _0x1132eb[_0x53b7('0x27')](_0x332004)[_0x53b7('0x28')](function(_0x69318b){return _0x69318b;});}return null;};}function removeEntity(_0x4d58a3,_0x41706f){return function(_0x54dc05){if(_0x54dc05){return _0x54dc05[_0x53b7('0x29')]()[_0x53b7('0x28')](function(){var _0x51ff47=_0x54dc05['get']({'plain':!![]});var _0x9f699d=_0x53b7('0x2a');return db[_0x53b7('0x2b')][_0x53b7('0x29')]({'where':{'type':_0x9f699d,'resourceId':_0x51ff47['id']}})['then'](function(){return _0x54dc05;});})[_0x53b7('0x28')](function(){_0x4d58a3[_0x53b7('0x21')](0xcc)[_0x53b7('0x1b')]();});}};}function handleEntityNotFound(_0xf6f286,_0xc85d3d){return function(_0x39d382){if(!_0x39d382){_0xf6f286['sendStatus'](0x194);}return _0x39d382;};}function handleError(_0x13ff22,_0x3c27ab){_0x3c27ab=_0x3c27ab||0x1f4;return function(_0x319bd3){logger[_0x53b7('0x2c')](_0x319bd3[_0x53b7('0x2d')]);if(_0x319bd3[_0x53b7('0x2e')]){delete _0x319bd3[_0x53b7('0x2e')];}_0x13ff22[_0x53b7('0x21')](_0x3c27ab)[_0x53b7('0x2f')](_0x319bd3);};}exports[_0x53b7('0x30')]=function(_0x1a6490,_0x20e7bd){var _0x176a89={},_0x42ed6f={},_0x52ced7={'count':0x0,'rows':[]};var _0x24a532=_[_0x53b7('0x31')](db['VoiceChanSpy'][_0x53b7('0x32')],function(_0x2bced5){return{'name':_0x2bced5[_0x53b7('0x33')],'type':_0x2bced5[_0x53b7('0x34')][_0x53b7('0x35')]};});_0x42ed6f['model']=_[_0x53b7('0x31')](_0x24a532,_0x53b7('0x2e'));_0x42ed6f[_0x53b7('0x36')]=_[_0x53b7('0x37')](_0x1a6490[_0x53b7('0x36')]);_0x42ed6f['filters']=_[_0x53b7('0x38')](_0x42ed6f[_0x53b7('0x39')],_0x42ed6f[_0x53b7('0x36')]);_0x176a89[_0x53b7('0x3a')]=_[_0x53b7('0x38')](_0x42ed6f[_0x53b7('0x39')],qs['fields'](_0x1a6490[_0x53b7('0x36')][_0x53b7('0x3b')]));_0x176a89['attributes']=_0x176a89[_0x53b7('0x3a')][_0x53b7('0x3c')]?_0x176a89['attributes']:_0x42ed6f[_0x53b7('0x39')];if(!_0x1a6490[_0x53b7('0x36')]['hasOwnProperty'](_0x53b7('0x3d'))){_0x176a89[_0x53b7('0x1f')]=qs[_0x53b7('0x1f')](_0x1a6490[_0x53b7('0x36')][_0x53b7('0x1f')]);_0x176a89[_0x53b7('0x1d')]=qs[_0x53b7('0x1d')](_0x1a6490[_0x53b7('0x36')][_0x53b7('0x1d')]);}_0x176a89[_0x53b7('0x3e')]=qs[_0x53b7('0x3f')](_0x1a6490[_0x53b7('0x36')][_0x53b7('0x3f')]);_0x176a89['where']=qs['filters'](_[_0x53b7('0x40')](_0x1a6490[_0x53b7('0x36')],_0x42ed6f[_0x53b7('0x41')]),_0x24a532);if(_0x1a6490['query']['filter']){_0x176a89[_0x53b7('0x42')]=_[_0x53b7('0x43')](_0x176a89['where'],{'$or':_[_0x53b7('0x31')](_0x24a532,function(_0x40fd4f){if(_0x40fd4f[_0x53b7('0x34')]!==_0x53b7('0x44')){var _0x8b447b={};_0x8b447b[_0x40fd4f[_0x53b7('0x2e')]]={'$like':'%'+_0x1a6490[_0x53b7('0x36')][_0x53b7('0x45')]+'%'};return _0x8b447b;}})});}_0x176a89=_[_0x53b7('0x43')]({},_0x176a89,_0x1a6490[_0x53b7('0x46')]);var _0x300d85={'where':_0x176a89['where']};return db[_0x53b7('0x47')][_0x53b7('0x20')](_0x300d85)[_0x53b7('0x28')](function(_0x3468c5){_0x52ced7[_0x53b7('0x20')]=_0x3468c5;if(_0x1a6490[_0x53b7('0x36')][_0x53b7('0x48')]){_0x176a89[_0x53b7('0x49')]=[{'all':!![]}];}return db[_0x53b7('0x47')][_0x53b7('0x4a')](_0x176a89);})[_0x53b7('0x28')](function(_0x43e920){_0x52ced7[_0x53b7('0x4b')]=_0x43e920;return _0x52ced7;})[_0x53b7('0x28')](respondWithFilteredResult(_0x20e7bd,_0x176a89))[_0x53b7('0x4c')](handleError(_0x20e7bd,null));};exports[_0x53b7('0x4d')]=function(_0x463514,_0x32c48d){var _0x4000de={'raw':![],'where':{'id':_0x463514[_0x53b7('0x4e')]['id']}},_0x1030fa={};_0x1030fa['model']=_[_0x53b7('0x37')](db[_0x53b7('0x47')]['rawAttributes']);_0x1030fa[_0x53b7('0x36')]=_[_0x53b7('0x37')](_0x463514['query']);_0x1030fa[_0x53b7('0x41')]=_[_0x53b7('0x38')](_0x1030fa[_0x53b7('0x39')],_0x1030fa[_0x53b7('0x36')]);_0x4000de[_0x53b7('0x3a')]=_['intersection'](_0x1030fa[_0x53b7('0x39')],qs[_0x53b7('0x3b')](_0x463514[_0x53b7('0x36')][_0x53b7('0x3b')]));_0x4000de['attributes']=_0x4000de['attributes'][_0x53b7('0x3c')]?_0x4000de['attributes']:_0x1030fa[_0x53b7('0x39')];if(_0x463514['query'][_0x53b7('0x48')]){_0x4000de[_0x53b7('0x49')]=[{'all':!![]}];}_0x4000de=_[_0x53b7('0x43')]({},_0x4000de,_0x463514[_0x53b7('0x46')]);return db[_0x53b7('0x47')][_0x53b7('0x4f')](_0x4000de)['then'](handleEntityNotFound(_0x32c48d,null))[_0x53b7('0x28')](respondWithResult(_0x32c48d,null))['catch'](handleError(_0x32c48d,null));};exports[_0x53b7('0x50')]=function(_0x45e078,_0x5d4353){return db[_0x53b7('0x47')][_0x53b7('0x50')](_0x45e078[_0x53b7('0x51')],{})['then'](function(_0x3c8562){var _0x464051=_0x45e078[_0x53b7('0x52')][_0x53b7('0x53')]({'plain':!![]});if(!_0x464051)throw new Error(_0x53b7('0x54'));if(_0x464051[_0x53b7('0x55')]===_0x53b7('0x52')){var _0xd4587e=_0x3c8562[_0x53b7('0x53')]({'plain':!![]});var _0x2bfe3e=_0x53b7('0x2a');return db['UserProfileSection'][_0x53b7('0x4f')]({'where':{'name':_0x2bfe3e,'userProfileId':_0x464051[_0x53b7('0x56')]},'raw':!![]})[_0x53b7('0x28')](function(_0x50bb87){if(_0x50bb87&&_0x50bb87[_0x53b7('0x57')]===0x0){return db['UserProfileResource'][_0x53b7('0x50')]({'name':_0xd4587e['name'],'resourceId':_0xd4587e['id'],'type':_0x50bb87['name'],'sectionId':_0x50bb87['id']},{})[_0x53b7('0x28')](function(){return _0x3c8562;});}else{return _0x3c8562;}})[_0x53b7('0x4c')](function(_0x34bb06){logger[_0x53b7('0x2c')](_0x53b7('0x58'),_0x34bb06);throw _0x34bb06;});}return _0x3c8562;})[_0x53b7('0x28')](respondWithResult(_0x5d4353,0xc9))[_0x53b7('0x4c')](handleError(_0x5d4353,null));};exports[_0x53b7('0x27')]=function(_0x4a3bc8,_0x3d2485){if(_0x4a3bc8[_0x53b7('0x51')]['id']){delete _0x4a3bc8[_0x53b7('0x51')]['id'];}return db[_0x53b7('0x47')][_0x53b7('0x4f')]({'where':{'id':_0x4a3bc8['params']['id']}})[_0x53b7('0x28')](handleEntityNotFound(_0x3d2485,null))[_0x53b7('0x28')](saveUpdates(_0x4a3bc8['body'],null))[_0x53b7('0x28')](respondWithResult(_0x3d2485,null))[_0x53b7('0x4c')](handleError(_0x3d2485,null));};exports['destroy']=function(_0x5b6141,_0x355c98){return db[_0x53b7('0x47')][_0x53b7('0x4f')]({'where':{'id':_0x5b6141[_0x53b7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x355c98,null))[_0x53b7('0x28')](removeEntity(_0x355c98,null))[_0x53b7('0x4c')](handleError(_0x355c98,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 7c47bec..e8e58a7 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 _0x41e6=['User','findAll','agent','exports','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','CDR(type)=%s','record','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','options','StopMixMonitor','length','concat','internal','name'];(function(_0x17001d,_0x514bb5){var _0x6092d0=function(_0x4f1df1){while(--_0x4f1df1){_0x17001d['push'](_0x17001d['shift']());}};_0x6092d0(++_0x514bb5);}(_0x41e6,0x17e));var _0x641e=function(_0x13d5bc,_0x3fce3c){_0x13d5bc=_0x13d5bc-0x0;var _0x4b8a40=_0x41e6[_0x13d5bc];return _0x4b8a40;};'use strict';var _=require(_0x641e('0x0'));var util=require(_0x641e('0x1'));var BPromise=require(_0x641e('0x2'));var attributes=require(_0x641e('0x3'));var getUserApplications=function(_0x120e2f,_0x3934ae,_0x517bf8){var _0x87710=0x1;var _0x25f1a6=[];var _0x47fc44={'context':_0x3934ae[_0x641e('0x4')]||_0x641e('0x5'),'exten':util[_0x641e('0x6')](_0x641e('0x7'),_0x120e2f[_0x641e('0x8')],_0x517bf8),'type':'system','isApp':![],'ChanSpyId':_0x120e2f['id'],'UserId':_0x3934ae['id']};_0x25f1a6[_0x641e('0x9')](_['merge']({'app':'Set','appdata':util[_0x641e('0x6')](_0x641e('0xa'),'chanspy'),'priority':_0x87710++},_0x47fc44));if(_0x120e2f[_0x641e('0xb')]){_0x25f1a6['push'](_[_0x641e('0xc')]({'app':'MixMonitor','appdata':util[_0x641e('0x6')](_0x641e('0xd'),_0x120e2f[_0x641e('0xe')]),'priority':_0x87710++},_0x47fc44));}if(_0x120e2f[_0x641e('0xf')]){_0x25f1a6['push'](_[_0x641e('0xc')]({'app':_0x641e('0x10'),'appdata':_0x120e2f[_0x641e('0x11')],'priority':_0x87710++},_0x47fc44));}_0x25f1a6['push'](_['merge']({'app':_0x641e('0x12'),'appdata':util[_0x641e('0x6')]('SIP/%s,%s',_0x3934ae['name'],_0x120e2f[_0x641e('0x13')]?_0x120e2f[_0x641e('0x13')]['join'](''):''),'priority':_0x87710++},_0x47fc44));if(_0x120e2f[_0x641e('0xb')]){_0x25f1a6[_0x641e('0x9')](_[_0x641e('0xc')]({'app':_0x641e('0x14'),'priority':_0x87710++},_0x47fc44));}return _0x25f1a6;};var getChanSpyApplications=function(_0x3d61b3,_0x376e4b){var _0x4eff9f=[];for(var _0x4201f4=0x0,_0x5934ba=0x1;_0x4201f4<_0x376e4b[_0x641e('0x15')];_0x4201f4++,_0x5934ba=0x1){_0x4eff9f=_0x4eff9f[_0x641e('0x16')](getUserApplications(_0x3d61b3,_0x376e4b[_0x4201f4],_0x376e4b[_0x4201f4][_0x641e('0x17')]));if(_0x376e4b[_0x4201f4][_0x641e('0x17')]!=_0x376e4b[_0x4201f4][_0x641e('0x18')]){_0x4eff9f=_0x4eff9f['concat'](getUserApplications(_0x3d61b3,_0x376e4b[_0x4201f4],_0x376e4b[_0x4201f4][_0x641e('0x18')]));}}return _0x4eff9f;};var getChanSpyPromise=function(_0x2bef5e,_0x565e6c){return new BPromise(function(_0x1e0cbb,_0x177191){return _0x2bef5e[_0x641e('0x19')][_0x641e('0x1a')]({'attributes':['id',_0x641e('0x18'),_0x641e('0x17')],'where':{'role':_0x641e('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1f7102){if(_0x1f7102){return _0x1e0cbb(getChanSpyApplications(_0x565e6c,_0x1f7102));}return _0x1e0cbb([]);})['catch'](function(_0x1cf1cb){_0x177191(_0x1cf1cb);});});};module[_0x641e('0x1c')]=function(_0x2646ab,_0x2128f7){var _0x5aada7=_0x2646ab[_0x641e('0x1d')];return _0x2646ab['define'](_0x641e('0x1e'),attributes,{'tableName':_0x641e('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd5bcfc,_0x4ef591,_0x1881e8){return getChanSpyPromise(_0x5aada7,_0xd5bcfc)[_0x641e('0x20')](function(_0x3d209f){if(_0x3d209f&&_0x3d209f[_0x641e('0x15')]){return _0x5aada7[_0x641e('0x21')][_0x641e('0x22')](_0x3d209f);}})[_0x641e('0x20')](function(){_0x1881e8();})[_0x641e('0x23')](function(_0x5d97fe){_0x1881e8(_0x5d97fe);});},'afterUpdate':function(_0x5c4472,_0xced44f,_0x5e31c8){return _0x5aada7[_0x641e('0x21')]['destroy']({'where':{'ChanSpyId':_0x5c4472['id']}})[_0x641e('0x20')](function(){return getChanSpyPromise(_0x5aada7,_0x5c4472);})[_0x641e('0x20')](function(_0x1f4d5b){if(_0x1f4d5b&&_0x1f4d5b[_0x641e('0x15')]){return _0x5aada7[_0x641e('0x21')]['bulkCreate'](_0x1f4d5b);}})[_0x641e('0x20')](function(){_0x5e31c8();})[_0x641e('0x23')](function(_0x25be84){_0x5e31c8(_0x25be84);});},'afterDestroy':function(_0x368bc6,_0x2ee826,_0x7ae171){return _0x5aada7[_0x641e('0x21')][_0x641e('0x24')]({'where':{'ChanSpyId':_0x368bc6['id']}})[_0x641e('0x20')](function(){_0x7ae171();})[_0x641e('0x23')](function(_0x17993e){_0x7ae171(_0x17993e);});}}});}; \ No newline at end of file +var _0x6fc6=['format','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','ChanSpy','SIP/%s,%s','options','join','length','concat','internal','name','User','findAll','agent','catch','exports','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','util','bluebird','context','prefix','system','push','Set'];(function(_0x290554,_0x1870d1){var _0x2481d5=function(_0x43c31a){while(--_0x43c31a){_0x290554['push'](_0x290554['shift']());}};_0x2481d5(++_0x1870d1);}(_0x6fc6,0x17a));var _0x66fc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6fc6[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x66fc('0x0'));var BPromise=require(_0x66fc('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5eead2,_0x473e30,_0x38c477){var _0x4f9c7e=0x1;var _0x82b629=[];var _0x1ef8d6={'context':_0x473e30[_0x66fc('0x2')]||'from-sip','exten':util['format']('%s%s',_0x5eead2[_0x66fc('0x3')],_0x38c477),'type':_0x66fc('0x4'),'isApp':![],'ChanSpyId':_0x5eead2['id'],'UserId':_0x473e30['id']};_0x82b629[_0x66fc('0x5')](_['merge']({'app':_0x66fc('0x6'),'appdata':util[_0x66fc('0x7')]('CDR(type)=%s',_0x66fc('0x8')),'priority':_0x4f9c7e++},_0x1ef8d6));if(_0x5eead2[_0x66fc('0x9')]){_0x82b629[_0x66fc('0x5')](_[_0x66fc('0xa')]({'app':_0x66fc('0xb'),'appdata':util[_0x66fc('0x7')](_0x66fc('0xc'),_0x5eead2[_0x66fc('0xd')]),'priority':_0x4f9c7e++},_0x1ef8d6));}if(_0x5eead2[_0x66fc('0xe')]){_0x82b629['push'](_[_0x66fc('0xa')]({'app':'Authenticate','appdata':_0x5eead2['password'],'priority':_0x4f9c7e++},_0x1ef8d6));}_0x82b629[_0x66fc('0x5')](_[_0x66fc('0xa')]({'app':_0x66fc('0xf'),'appdata':util[_0x66fc('0x7')](_0x66fc('0x10'),_0x473e30['name'],_0x5eead2[_0x66fc('0x11')]?_0x5eead2[_0x66fc('0x11')][_0x66fc('0x12')](''):''),'priority':_0x4f9c7e++},_0x1ef8d6));if(_0x5eead2['record']){_0x82b629[_0x66fc('0x5')](_[_0x66fc('0xa')]({'app':'StopMixMonitor','priority':_0x4f9c7e++},_0x1ef8d6));}return _0x82b629;};var getChanSpyApplications=function(_0x53bfe0,_0x53296d){var _0x12d4af=[];for(var _0x30556d=0x0,_0x502a8e=0x1;_0x30556d<_0x53296d[_0x66fc('0x13')];_0x30556d++,_0x502a8e=0x1){_0x12d4af=_0x12d4af[_0x66fc('0x14')](getUserApplications(_0x53bfe0,_0x53296d[_0x30556d],_0x53296d[_0x30556d]['internal']));if(_0x53296d[_0x30556d][_0x66fc('0x15')]!=_0x53296d[_0x30556d][_0x66fc('0x16')]){_0x12d4af=_0x12d4af['concat'](getUserApplications(_0x53bfe0,_0x53296d[_0x30556d],_0x53296d[_0x30556d][_0x66fc('0x16')]));}}return _0x12d4af;};var getChanSpyPromise=function(_0x25922e,_0x440760){return new BPromise(function(_0x27fbbd,_0x441d7b){return _0x25922e[_0x66fc('0x17')][_0x66fc('0x18')]({'attributes':['id',_0x66fc('0x16'),_0x66fc('0x15')],'where':{'role':_0x66fc('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x56fbe0){if(_0x56fbe0){return _0x27fbbd(getChanSpyApplications(_0x440760,_0x56fbe0));}return _0x27fbbd([]);})[_0x66fc('0x1a')](function(_0x10ddb0){_0x441d7b(_0x10ddb0);});});};module[_0x66fc('0x1b')]=function(_0x548fc6,_0x268927){var _0x49cbc5=_0x548fc6[_0x66fc('0x1c')];return _0x548fc6['define'](_0x66fc('0x1d'),attributes,{'tableName':_0x66fc('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2beb43,_0x25ec6c,_0x257ea5){return getChanSpyPromise(_0x49cbc5,_0x2beb43)[_0x66fc('0x1f')](function(_0x3fbb0b){if(_0x3fbb0b&&_0x3fbb0b['length']){return _0x49cbc5[_0x66fc('0x20')][_0x66fc('0x21')](_0x3fbb0b);}})[_0x66fc('0x1f')](function(){_0x257ea5();})['catch'](function(_0x4396bc){_0x257ea5(_0x4396bc);});},'afterUpdate':function(_0x1d1ddc,_0x42b7f2,_0x13c7ab){return _0x49cbc5['VoiceExtension'][_0x66fc('0x22')]({'where':{'ChanSpyId':_0x1d1ddc['id']}})['then'](function(){return getChanSpyPromise(_0x49cbc5,_0x1d1ddc);})[_0x66fc('0x1f')](function(_0x1c668c){if(_0x1c668c&&_0x1c668c[_0x66fc('0x13')]){return _0x49cbc5[_0x66fc('0x20')][_0x66fc('0x21')](_0x1c668c);}})[_0x66fc('0x1f')](function(){_0x13c7ab();})[_0x66fc('0x1a')](function(_0x4af36b){_0x13c7ab(_0x4af36b);});},'afterDestroy':function(_0x308327,_0x9788be,_0x53e2d7){return _0x49cbc5[_0x66fc('0x20')]['destroy']({'where':{'ChanSpyId':_0x308327['id']}})['then'](function(){_0x53e2d7();})[_0x66fc('0x1a')](function(_0xdb034d){_0x53e2d7(_0xdb034d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2db9b62..4affedc 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 _0x2750=['jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x10e64a,_0x5919c3){var _0x4b5aac=function(_0x2a1a1d){while(--_0x2a1a1d){_0x10e64a['push'](_0x10e64a['shift']());}};_0x4b5aac(++_0x5919c3);}(_0x2750,0x13b));var _0x0275=function(_0x489530,_0x3b9b58){_0x489530=_0x489530-0x0;var _0x4d85ff=_0x2750[_0x489530];return _0x4d85ff;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file +var _0x131e=['info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceChanSpy,\x20%s,\x20%s','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x131e,0x1ec));var _0xe131=function(_0x13c1a3,_0x57e03f){_0x13c1a3=_0x13c1a3-0x0;var _0x4fef7a=_0x131e[_0x13c1a3];return _0x4fef7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1002a6,_0x48a90e,_0x5c4eb5){return new BPromise(function(_0x562617,_0x4bf386){return client[_0xe131('0xa')](_0x1002a6,_0x5c4eb5)[_0xe131('0xb')](function(_0x530ecb){logger[_0xe131('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,_0xe131('0xd'));logger[_0xe131('0xe')](_0xe131('0xf'),_0x48a90e,_0xe131('0xd'),JSON[_0xe131('0x10')](_0x530ecb));if(_0x530ecb[_0xe131('0x11')]){if(_0x530ecb[_0xe131('0x11')]['code']===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,_0x530ecb['error'][_0xe131('0x12')]);return _0x4bf386(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}logger[_0xe131('0x11')](_0xe131('0x13'),_0x48a90e,_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);return _0x562617(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,'request\x20sent');_0x562617(_0x530ecb['result']['message']);}})[_0xe131('0x14')](function(_0x32091b){logger[_0xe131('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,_0x32091b);_0x4bf386(_0x32091b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index bcce557..2d58a75 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 _0x0044=['./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3442b3,_0x1e5c3f){var _0x3c60d2=function(_0x2dfcce){while(--_0x2dfcce){_0x3442b3['push'](_0x3442b3['shift']());}};_0x3c60d2(++_0x1e5c3f);}(_0x0044,0x147));var _0x4004=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x0044[_0x22b8a3];return _0x199a0c;};'use strict';var multer=require(_0x4004('0x0'));var util=require('util');var path=require(_0x4004('0x1'));var timeout=require(_0x4004('0x2'));var express=require(_0x4004('0x3'));var router=express[_0x4004('0x4')]();var fs_extra=require(_0x4004('0x5'));var auth=require(_0x4004('0x6'));var interaction=require(_0x4004('0x7'));var config=require(_0x4004('0x8'));var controller=require(_0x4004('0x9'));router[_0x4004('0xa')]('/',auth[_0x4004('0xb')](),controller[_0x4004('0xc')]);router[_0x4004('0xa')](_0x4004('0xd'),auth[_0x4004('0xb')](),controller[_0x4004('0xe')]);router[_0x4004('0xf')]('/',auth['isAuthenticated'](),controller[_0x4004('0x10')]);router[_0x4004('0x11')]('/:id',auth[_0x4004('0xb')](),controller[_0x4004('0x12')]);router['delete']('/:id',auth[_0x4004('0xb')](),controller[_0x4004('0x13')]);module[_0x4004('0x14')]=router; \ No newline at end of file +var _0x7998=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x6c00f6,_0x556bde){var _0x13f556=function(_0x28ec19){while(--_0x28ec19){_0x6c00f6['push'](_0x6c00f6['shift']());}};_0x13f556(++_0x556bde);}(_0x7998,0xb9));var _0x8799=function(_0x101617,_0x4faafa){_0x101617=_0x101617-0x0;var _0x1f5be9=_0x7998[_0x101617];return _0x1f5be9;};'use strict';var multer=require(_0x8799('0x0'));var util=require(_0x8799('0x1'));var path=require(_0x8799('0x2'));var timeout=require(_0x8799('0x3'));var express=require(_0x8799('0x4'));var router=express[_0x8799('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8799('0x6'));var interaction=require(_0x8799('0x7'));var config=require(_0x8799('0x8'));var controller=require(_0x8799('0x9'));router[_0x8799('0xa')]('/',auth[_0x8799('0xb')](),controller['index']);router[_0x8799('0xa')](_0x8799('0xc'),auth['isAuthenticated'](),controller[_0x8799('0xd')]);router[_0x8799('0xe')]('/',auth['isAuthenticated'](),controller[_0x8799('0xf')]);router['put']('/:id',auth[_0x8799('0xb')](),controller['update']);router[_0x8799('0x10')](_0x8799('0xc'),auth['isAuthenticated'](),controller[_0x8799('0x11')]);module[_0x8799('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 9a5621b..e73f00d 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 _0x5447=['name','BOOLEAN','exports'];(function(_0x37153e,_0x15c383){var _0x3d2981=function(_0x2226fe){while(--_0x2226fe){_0x37153e['push'](_0x37153e['shift']());}};_0x3d2981(++_0x15c383);}(_0x5447,0x14f));var _0x7544=function(_0x53d745,_0x194ae5){_0x53d745=_0x53d745-0x0;var _0x12a576=_0x5447[_0x53d745];return _0x12a576;};'use strict';var Sequelize=require('sequelize');module[_0x7544('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7544('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7544('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa207=['name','STRING','BOOLEAN','sequelize'];(function(_0x303877,_0x432a0e){var _0x197c25=function(_0x12c0cd){while(--_0x12c0cd){_0x303877['push'](_0x303877['shift']());}};_0x197c25(++_0x432a0e);}(_0xa207,0x143));var _0x7a20=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa207[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x7a20('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7a20('0x1')},'description':{'type':Sequelize[_0x7a20('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7a20('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f449775..e337c56 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 _0xab52=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','render','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','zip-dir','fast-json-patch','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5b19ae,_0x2fef9e){var _0x367f6a=function(_0x1bcbf1){while(--_0x1bcbf1){_0x5b19ae['push'](_0x5b19ae['shift']());}};_0x367f6a(++_0x2fef9e);}(_0xab52,0xb4));var _0x2ab5=function(_0x108f68,_0x2b948e){_0x108f68=_0x108f68-0x0;var _0x1be297=_0xab52[_0x108f68];return _0x1be297;};'use strict';var emlformat=require(_0x2ab5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ab5('0x1'));var jsonpatch=require(_0x2ab5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2ab5('0x3'));var sox=require(_0x2ab5('0x4'));var csv=require(_0x2ab5('0x5'));var ejs=require(_0x2ab5('0x6'));var fs=require('fs');var fs_extra=require(_0x2ab5('0x7'));var _=require(_0x2ab5('0x8'));var squel=require(_0x2ab5('0x9'));var crypto=require(_0x2ab5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2ab5('0xb'));var toCsv=require(_0x2ab5('0x5'));var querystring=require('querystring');var Papa=require(_0x2ab5('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2ab5('0xd'));var as=require(_0x2ab5('0xe'));var hardwareService=require(_0x2ab5('0xf'));var logger=require(_0x2ab5('0x10'))(_0x2ab5('0x11'));var utils=require(_0x2ab5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2ab5('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2ab5('0x14'));var client=jayson[_0x2ab5('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1154,_0x2d6281,_0x477f68,_0x32d086){return new BPromise(function(_0xceaee5,_0x2fbfc2){var _0x52480f=_0x32d086||client;return _0x52480f[_0x2ab5('0x16')](_0x4a1154,_0x477f68)[_0x2ab5('0x17')](function(_0x4fcfa7){logger[_0x2ab5('0x18')](_0x2ab5('0x19'),_0x2d6281,_0x2ab5('0x1a'));logger[_0x2ab5('0x1b')](_0x2ab5('0x1c'),_0x2d6281,_0x2ab5('0x1a'),JSON[_0x2ab5('0x1d')](_0x4fcfa7));if(_0x4fcfa7[_0x2ab5('0x1e')]){if(_0x4fcfa7['error'][_0x2ab5('0x1f')]===0x1f4){logger[_0x2ab5('0x1e')](_0x2ab5('0x19'),_0x2d6281,_0x4fcfa7['error'][_0x2ab5('0x20')]);return _0x2fbfc2(_0x4fcfa7[_0x2ab5('0x1e')][_0x2ab5('0x20')]);}logger[_0x2ab5('0x1e')](_0x2ab5('0x19'),_0x2d6281,_0x4fcfa7[_0x2ab5('0x1e')][_0x2ab5('0x20')]);return _0xceaee5(_0x4fcfa7['error']['message']);}else{logger['info'](_0x2ab5('0x19'),_0x2d6281,_0x2ab5('0x1a'));_0xceaee5(_0x4fcfa7[_0x2ab5('0x21')][_0x2ab5('0x20')]);}})['catch'](function(_0x10803a){logger['error'](_0x2ab5('0x19'),_0x2d6281,_0x10803a);_0x2fbfc2(_0x10803a);});});}function respondWithStatusCode(_0x305150,_0x30d5ce){_0x30d5ce=_0x30d5ce||0xcc;return function(_0x44b091){if(_0x44b091){return _0x305150[_0x2ab5('0x22')](_0x30d5ce);}return _0x305150[_0x2ab5('0x23')](_0x30d5ce)[_0x2ab5('0x24')]();};}function respondWithResult(_0x113101,_0x1ba4b9){_0x1ba4b9=_0x1ba4b9||0xc8;return function(_0x346a92){if(_0x346a92){return _0x113101[_0x2ab5('0x23')](_0x1ba4b9)['json'](_0x346a92);}};}function respondWithFilteredResult(_0x38966c,_0x2293e2){return function(_0x3b7394){if(_0x3b7394){var _0x352ca6=typeof _0x2293e2[_0x2ab5('0x25')]==='undefined'&&typeof _0x2293e2[_0x2ab5('0x26')]===_0x2ab5('0x27');var _0x291b37=_0x3b7394[_0x2ab5('0x28')];var _0x279dd5=_0x352ca6?0x0:_0x2293e2[_0x2ab5('0x25')];var _0x3792b4=_0x352ca6?_0x3b7394['count']:_0x2293e2['offset']+_0x2293e2[_0x2ab5('0x26')];var _0x35f2c1;if(_0x3792b4>=_0x291b37){_0x3792b4=_0x291b37;_0x35f2c1=0xc8;}else{_0x35f2c1=0xce;}_0x38966c[_0x2ab5('0x23')](_0x35f2c1);return _0x38966c[_0x2ab5('0x29')](_0x2ab5('0x2a'),_0x279dd5+'-'+_0x3792b4+'/'+_0x291b37)[_0x2ab5('0x2b')](_0x3b7394);}return null;};}function patchUpdates(_0x55a381){return function(_0x56c63b){try{jsonpatch[_0x2ab5('0x2c')](_0x56c63b,_0x55a381,!![]);}catch(_0x1f4a16){return BPromise[_0x2ab5('0x2d')](_0x1f4a16);}return _0x56c63b[_0x2ab5('0x2e')]();};}function saveUpdates(_0x3e87f7,_0x5a8de3){return function(_0x30c4e1){if(_0x30c4e1){return _0x30c4e1['update'](_0x3e87f7)[_0x2ab5('0x17')](function(_0x403495){return _0x403495;});}return null;};}function removeEntity(_0x4bca10,_0x3db804){return function(_0x3a0929){if(_0x3a0929){return _0x3a0929[_0x2ab5('0x2f')]()['then'](function(){var _0x247e00=_0x3a0929[_0x2ab5('0x30')]({'plain':!![]});var _0x25bf1b=_0x2ab5('0x31');return db[_0x2ab5('0x32')][_0x2ab5('0x2f')]({'where':{'type':_0x25bf1b,'resourceId':_0x247e00['id']}})[_0x2ab5('0x17')](function(){return _0x3a0929;});})['then'](function(){_0x4bca10[_0x2ab5('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9eff,_0x49d20f){return function(_0x319e34){if(!_0x319e34){_0x3e9eff[_0x2ab5('0x22')](0x194);}return _0x319e34;};}function handleError(_0x12a263,_0x55e9ab){_0x55e9ab=_0x55e9ab||0x1f4;return function(_0x2310af){logger[_0x2ab5('0x1e')](_0x2310af[_0x2ab5('0x33')]);if(_0x2310af['name']){delete _0x2310af[_0x2ab5('0x34')];}_0x12a263['status'](_0x55e9ab)[_0x2ab5('0x35')](_0x2310af);};}exports[_0x2ab5('0x36')]=function(_0x460d71,_0x4967e5){var _0x582063={},_0x5a5237={},_0x3f0579={'count':0x0,'rows':[]};var _0x14556b=_[_0x2ab5('0x37')](db[_0x2ab5('0x38')][_0x2ab5('0x39')],function(_0x3a8e44){return{'name':_0x3a8e44[_0x2ab5('0x3a')],'type':_0x3a8e44[_0x2ab5('0x3b')][_0x2ab5('0x3c')]};});_0x5a5237[_0x2ab5('0x3d')]=_[_0x2ab5('0x37')](_0x14556b,_0x2ab5('0x34'));_0x5a5237['query']=_['keys'](_0x460d71[_0x2ab5('0x3e')]);_0x5a5237['filters']=_[_0x2ab5('0x3f')](_0x5a5237[_0x2ab5('0x3d')],_0x5a5237[_0x2ab5('0x3e')]);_0x582063['attributes']=_['intersection'](_0x5a5237['model'],qs['fields'](_0x460d71[_0x2ab5('0x3e')][_0x2ab5('0x40')]));_0x582063[_0x2ab5('0x41')]=_0x582063['attributes'][_0x2ab5('0x42')]?_0x582063[_0x2ab5('0x41')]:_0x5a5237[_0x2ab5('0x3d')];if(!_0x460d71[_0x2ab5('0x3e')]['hasOwnProperty'](_0x2ab5('0x43'))){_0x582063['limit']=qs[_0x2ab5('0x26')](_0x460d71[_0x2ab5('0x3e')][_0x2ab5('0x26')]);_0x582063['offset']=qs[_0x2ab5('0x25')](_0x460d71[_0x2ab5('0x3e')]['offset']);}_0x582063[_0x2ab5('0x44')]=qs[_0x2ab5('0x45')](_0x460d71[_0x2ab5('0x3e')][_0x2ab5('0x45')]);_0x582063[_0x2ab5('0x46')]=qs[_0x2ab5('0x47')](_[_0x2ab5('0x48')](_0x460d71['query'],_0x5a5237['filters']),_0x14556b);if(_0x460d71[_0x2ab5('0x3e')][_0x2ab5('0x49')]){_0x582063[_0x2ab5('0x46')]=_[_0x2ab5('0x4a')](_0x582063[_0x2ab5('0x46')],{'$or':_['map'](_0x14556b,function(_0x553aa6){if(_0x553aa6[_0x2ab5('0x3b')]!==_0x2ab5('0x4b')){var _0x5c2403={};_0x5c2403[_0x553aa6[_0x2ab5('0x34')]]={'$like':'%'+_0x460d71[_0x2ab5('0x3e')][_0x2ab5('0x49')]+'%'};return _0x5c2403;}})});}_0x582063=_['merge']({},_0x582063,_0x460d71['options']);var _0xcbf823={'where':_0x582063[_0x2ab5('0x46')]};return db[_0x2ab5('0x38')]['count'](_0xcbf823)[_0x2ab5('0x17')](function(_0x2b6fbd){_0x3f0579[_0x2ab5('0x28')]=_0x2b6fbd;if(_0x460d71[_0x2ab5('0x3e')][_0x2ab5('0x4c')]){_0x582063[_0x2ab5('0x4d')]=[{'all':!![]}];}return db[_0x2ab5('0x38')][_0x2ab5('0x4e')](_0x582063);})['then'](function(_0x4d9e0f){_0x3f0579['rows']=_0x4d9e0f;return _0x3f0579;})['then'](respondWithFilteredResult(_0x4967e5,_0x582063))[_0x2ab5('0x4f')](handleError(_0x4967e5,null));};exports[_0x2ab5('0x50')]=function(_0x430885,_0x37ad01){var _0x39c43b={'raw':![],'where':{'id':_0x430885[_0x2ab5('0x51')]['id']}},_0x2e2f8b={};_0x2e2f8b[_0x2ab5('0x3d')]=_['keys'](db[_0x2ab5('0x38')][_0x2ab5('0x39')]);_0x2e2f8b[_0x2ab5('0x3e')]=_[_0x2ab5('0x52')](_0x430885[_0x2ab5('0x3e')]);_0x2e2f8b[_0x2ab5('0x47')]=_[_0x2ab5('0x3f')](_0x2e2f8b[_0x2ab5('0x3d')],_0x2e2f8b[_0x2ab5('0x3e')]);_0x39c43b[_0x2ab5('0x41')]=_[_0x2ab5('0x3f')](_0x2e2f8b[_0x2ab5('0x3d')],qs['fields'](_0x430885['query'][_0x2ab5('0x40')]));_0x39c43b[_0x2ab5('0x41')]=_0x39c43b[_0x2ab5('0x41')]['length']?_0x39c43b[_0x2ab5('0x41')]:_0x2e2f8b[_0x2ab5('0x3d')];if(_0x430885[_0x2ab5('0x3e')]['includeAll']){_0x39c43b[_0x2ab5('0x4d')]=[{'all':!![]}];}_0x39c43b=_['merge']({},_0x39c43b,_0x430885[_0x2ab5('0x53')]);return db[_0x2ab5('0x38')]['find'](_0x39c43b)[_0x2ab5('0x17')](handleEntityNotFound(_0x37ad01,null))[_0x2ab5('0x17')](respondWithResult(_0x37ad01,null))[_0x2ab5('0x4f')](handleError(_0x37ad01,null));};exports[_0x2ab5('0x54')]=function(_0x3f9fcc,_0x3cdecb,_0x5cf7f4){var _0x3790ba;return db[_0x2ab5('0x38')][_0x2ab5('0x54')](_0x3f9fcc[_0x2ab5('0x55')],{'raw':!![]})['then'](function(_0x31383c){_0x3790ba=_0x31383c;return db[_0x2ab5('0x38')][_0x2ab5('0x4e')]({'raw':!![]});})[_0x2ab5('0x17')](function(_0xe7838e){var _0x462edc=fs[_0x2ab5('0x56')](path[_0x2ab5('0x57')](config[_0x2ab5('0x58')],_0x2ab5('0x59')),_0x2ab5('0x5a'));var _0x12d4dd=ejs['render'](_0x462edc,{'contexts':_0xe7838e||[]});fs[_0x2ab5('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x12d4dd);})[_0x2ab5('0x17')](function(){return respondWithRpcPromise(_0x2ab5('0x5c'),_0x2ab5('0x54'),{'module':_0x2ab5('0x5d')});})[_0x2ab5('0x17')](function(){var _0x2b3896=_0x3f9fcc[_0x2ab5('0x5e')][_0x2ab5('0x30')]({'plain':!![]});if(!_0x2b3896)throw new Error(_0x2ab5('0x5f'));if(_0x2b3896['role']===_0x2ab5('0x5e')){var _0x575771=_0x3790ba['get']({'plain':!![]});return db[_0x2ab5('0x60')]['find']({'where':{'name':'Contexts','userProfileId':_0x2b3896[_0x2ab5('0x61')]},'raw':!![]})[_0x2ab5('0x17')](function(_0x2b8ff3){if(_0x2b8ff3&&_0x2b8ff3[_0x2ab5('0x62')]===0x0){return db[_0x2ab5('0x32')]['create']({'name':_0x575771[_0x2ab5('0x34')],'resourceId':_0x575771['id'],'type':_0x2b8ff3[_0x2ab5('0x34')],'sectionId':_0x2b8ff3['id']},{})['then'](function(){return _0x3790ba;});}else{return _0x3790ba;}})[_0x2ab5('0x4f')](function(_0x41f297){logger[_0x2ab5('0x1e')](_0x2ab5('0x63'),_0x41f297);throw _0x41f297;});}return _0x3790ba;})[_0x2ab5('0x17')](respondWithResult(_0x3cdecb,0xc9))[_0x2ab5('0x4f')](handleError(_0x3cdecb,null));};exports[_0x2ab5('0x64')]=function(_0x1e6a79,_0x5cdf66,_0x3359b1){var _0x12ada1;return db['VoiceContext'][_0x2ab5('0x65')]({'where':{'id':_0x1e6a79[_0x2ab5('0x51')]['id']}})[_0x2ab5('0x17')](handleEntityNotFound(_0x5cdf66,null))['then'](saveUpdates(_0x1e6a79[_0x2ab5('0x55')],null))[_0x2ab5('0x17')](function(_0x2bb3d9){if(_0x2bb3d9){_0x12ada1=_0x2bb3d9;return db['VoiceContext'][_0x2ab5('0x4e')]({'raw':!![]});}})[_0x2ab5('0x17')](function(_0x1fb685){var _0x30a153=fs[_0x2ab5('0x56')](path[_0x2ab5('0x57')](config[_0x2ab5('0x58')],_0x2ab5('0x59')),'utf8');var _0x40c602=ejs['render'](_0x30a153,{'contexts':_0x1fb685||[]});fs[_0x2ab5('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x40c602);})['then'](function(){return respondWithRpcPromise(_0x2ab5('0x5c'),_0x2ab5('0x64'),{'module':_0x2ab5('0x5d')});})[_0x2ab5('0x17')](function(){return _0x12ada1;})[_0x2ab5('0x17')](respondWithResult(_0x5cdf66,null))['catch'](handleError(_0x5cdf66,null));};exports['destroy']=function(_0x191718,_0x417663,_0x26e97b){var _0x2848c2;return db['VoiceContext'][_0x2ab5('0x65')]({'where':{'id':_0x191718[_0x2ab5('0x51')]['id']}})[_0x2ab5('0x17')](handleEntityNotFound(_0x417663,null))['then'](removeEntity(_0x417663,null))[_0x2ab5('0x17')](function(){return db[_0x2ab5('0x38')][_0x2ab5('0x4e')]({'raw':!![]});})[_0x2ab5('0x17')](function(_0x98b2d){var _0xbc9281=fs['readFileSync'](path[_0x2ab5('0x57')](config['root'],'server/files/templates/context.ejs'),_0x2ab5('0x5a'));var _0x4c87ed=ejs[_0x2ab5('0x66')](_0xbc9281,{'contexts':_0x98b2d});fs[_0x2ab5('0x5b')](_0x2ab5('0x67'),_0x4c87ed);return respondWithRpcPromise(_0x2ab5('0x5c'),'destroy',{'module':_0x2ab5('0x5d')});})[_0x2ab5('0x4f')](handleError(_0x417663,null));}; \ No newline at end of file +var _0x8388=['status','end','offset','limit','undefined','count','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','rows','fields','find','catch','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus'];(function(_0x4895e4,_0x4c7621){var _0xf9f49f=function(_0x3ad5c5){while(--_0x3ad5c5){_0x4895e4['push'](_0x4895e4['shift']());}};_0xf9f49f(++_0x4c7621);}(_0x8388,0x1cf));var _0x8838=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0x8388[_0x59dccc];return _0xc97bcb;};'use strict';var emlformat=require(_0x8838('0x0'));var rimraf=require(_0x8838('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8838('0x2'));var rp=require(_0x8838('0x3'));var moment=require(_0x8838('0x4'));var BPromise=require(_0x8838('0x5'));var Mustache=require(_0x8838('0x6'));var util=require(_0x8838('0x7'));var path=require(_0x8838('0x8'));var sox=require('sox');var csv=require(_0x8838('0x9'));var ejs=require(_0x8838('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8838('0xb'));var squel=require(_0x8838('0xc'));var crypto=require(_0x8838('0xd'));var jsforce=require(_0x8838('0xe'));var deskjs=require(_0x8838('0xf'));var toCsv=require(_0x8838('0x9'));var querystring=require(_0x8838('0x10'));var Papa=require('papaparse');var Redis=require(_0x8838('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8838('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8838('0x13'));var logger=require(_0x8838('0x14'))(_0x8838('0x15'));var utils=require(_0x8838('0x16'));var config=require(_0x8838('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x8838('0x18'));var client=jayson[_0x8838('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x142b96,_0x5c3a86,_0x3aec94,_0x57369a){return new BPromise(function(_0x365795,_0x835deb){var _0x53e777=_0x57369a||client;return _0x53e777['request'](_0x142b96,_0x3aec94)[_0x8838('0x1a')](function(_0x390605){logger[_0x8838('0x1b')](_0x8838('0x1c'),_0x5c3a86,'request\x20sent');logger[_0x8838('0x1d')](_0x8838('0x1e'),_0x5c3a86,_0x8838('0x1f'),JSON['stringify'](_0x390605));if(_0x390605[_0x8838('0x20')]){if(_0x390605[_0x8838('0x20')][_0x8838('0x21')]===0x1f4){logger[_0x8838('0x20')](_0x8838('0x1c'),_0x5c3a86,_0x390605[_0x8838('0x20')][_0x8838('0x22')]);return _0x835deb(_0x390605[_0x8838('0x20')]['message']);}logger[_0x8838('0x20')](_0x8838('0x1c'),_0x5c3a86,_0x390605['error'][_0x8838('0x22')]);return _0x365795(_0x390605[_0x8838('0x20')][_0x8838('0x22')]);}else{logger[_0x8838('0x1b')](_0x8838('0x1c'),_0x5c3a86,'request\x20sent');_0x365795(_0x390605[_0x8838('0x23')]['message']);}})['catch'](function(_0x11e15f){logger[_0x8838('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5c3a86,_0x11e15f);_0x835deb(_0x11e15f);});});}function respondWithStatusCode(_0x3da5c8,_0x3720e7){_0x3720e7=_0x3720e7||0xcc;return function(_0x4026de){if(_0x4026de){return _0x3da5c8[_0x8838('0x24')](_0x3720e7);}return _0x3da5c8[_0x8838('0x25')](_0x3720e7)[_0x8838('0x26')]();};}function respondWithResult(_0x32f048,_0x3df88a){_0x3df88a=_0x3df88a||0xc8;return function(_0x458984){if(_0x458984){return _0x32f048[_0x8838('0x25')](_0x3df88a)['json'](_0x458984);}};}function respondWithFilteredResult(_0x251d31,_0xfdd726){return function(_0x39c483){if(_0x39c483){var _0x1671bf=typeof _0xfdd726[_0x8838('0x27')]==='undefined'&&typeof _0xfdd726[_0x8838('0x28')]===_0x8838('0x29');var _0x355985=_0x39c483[_0x8838('0x2a')];var _0x7eb5da=_0x1671bf?0x0:_0xfdd726[_0x8838('0x27')];var _0x4544cc=_0x1671bf?_0x39c483[_0x8838('0x2a')]:_0xfdd726[_0x8838('0x27')]+_0xfdd726[_0x8838('0x28')];var _0xf75488;if(_0x4544cc>=_0x355985){_0x4544cc=_0x355985;_0xf75488=0xc8;}else{_0xf75488=0xce;}_0x251d31[_0x8838('0x25')](_0xf75488);return _0x251d31['set'](_0x8838('0x2b'),_0x7eb5da+'-'+_0x4544cc+'/'+_0x355985)['json'](_0x39c483);}return null;};}function patchUpdates(_0x5e587e){return function(_0x3f1c99){try{jsonpatch[_0x8838('0x2c')](_0x3f1c99,_0x5e587e,!![]);}catch(_0x5bfb9f){return BPromise[_0x8838('0x2d')](_0x5bfb9f);}return _0x3f1c99[_0x8838('0x2e')]();};}function saveUpdates(_0x47a622,_0x57a500){return function(_0x125709){if(_0x125709){return _0x125709[_0x8838('0x2f')](_0x47a622)[_0x8838('0x1a')](function(_0x46a20f){return _0x46a20f;});}return null;};}function removeEntity(_0x49d880,_0x5e4f44){return function(_0x268a21){if(_0x268a21){return _0x268a21['destroy']()['then'](function(){var _0x464866=_0x268a21[_0x8838('0x30')]({'plain':!![]});var _0xadbb49='Contexts';return db[_0x8838('0x31')][_0x8838('0x32')]({'where':{'type':_0xadbb49,'resourceId':_0x464866['id']}})['then'](function(){return _0x268a21;});})[_0x8838('0x1a')](function(){_0x49d880[_0x8838('0x25')](0xcc)[_0x8838('0x26')]();});}};}function handleEntityNotFound(_0x171022,_0x38fe51){return function(_0x4fc925){if(!_0x4fc925){_0x171022['sendStatus'](0x194);}return _0x4fc925;};}function handleError(_0x326d18,_0xbcb73f){_0xbcb73f=_0xbcb73f||0x1f4;return function(_0x1b80f1){logger[_0x8838('0x20')](_0x1b80f1[_0x8838('0x33')]);if(_0x1b80f1[_0x8838('0x34')]){delete _0x1b80f1[_0x8838('0x34')];}_0x326d18[_0x8838('0x25')](_0xbcb73f)[_0x8838('0x35')](_0x1b80f1);};}exports[_0x8838('0x36')]=function(_0x3b6523,_0xfc9dd7){var _0x485fe0={},_0x206bc8={},_0x145d0b={'count':0x0,'rows':[]};var _0x3dd0b1=_['map'](db['VoiceContext'][_0x8838('0x37')],function(_0x18f901){return{'name':_0x18f901[_0x8838('0x38')],'type':_0x18f901['type'][_0x8838('0x39')]};});_0x206bc8[_0x8838('0x3a')]=_[_0x8838('0x3b')](_0x3dd0b1,_0x8838('0x34'));_0x206bc8[_0x8838('0x3c')]=_['keys'](_0x3b6523[_0x8838('0x3c')]);_0x206bc8[_0x8838('0x3d')]=_[_0x8838('0x3e')](_0x206bc8[_0x8838('0x3a')],_0x206bc8[_0x8838('0x3c')]);_0x485fe0[_0x8838('0x3f')]=_['intersection'](_0x206bc8[_0x8838('0x3a')],qs['fields'](_0x3b6523['query']['fields']));_0x485fe0['attributes']=_0x485fe0[_0x8838('0x3f')]['length']?_0x485fe0[_0x8838('0x3f')]:_0x206bc8['model'];if(!_0x3b6523[_0x8838('0x3c')][_0x8838('0x40')](_0x8838('0x41'))){_0x485fe0[_0x8838('0x28')]=qs[_0x8838('0x28')](_0x3b6523['query']['limit']);_0x485fe0[_0x8838('0x27')]=qs['offset'](_0x3b6523[_0x8838('0x3c')][_0x8838('0x27')]);}_0x485fe0[_0x8838('0x42')]=qs['sort'](_0x3b6523['query'][_0x8838('0x43')]);_0x485fe0[_0x8838('0x44')]=qs[_0x8838('0x3d')](_[_0x8838('0x45')](_0x3b6523[_0x8838('0x3c')],_0x206bc8[_0x8838('0x3d')]),_0x3dd0b1);if(_0x3b6523['query'][_0x8838('0x46')]){_0x485fe0[_0x8838('0x44')]=_[_0x8838('0x47')](_0x485fe0[_0x8838('0x44')],{'$or':_['map'](_0x3dd0b1,function(_0x4360a4){if(_0x4360a4['type']!==_0x8838('0x48')){var _0x205577={};_0x205577[_0x4360a4['name']]={'$like':'%'+_0x3b6523[_0x8838('0x3c')][_0x8838('0x46')]+'%'};return _0x205577;}})});}_0x485fe0=_[_0x8838('0x47')]({},_0x485fe0,_0x3b6523[_0x8838('0x49')]);var _0x4901f3={'where':_0x485fe0['where']};return db[_0x8838('0x4a')][_0x8838('0x2a')](_0x4901f3)['then'](function(_0x5d4a98){_0x145d0b['count']=_0x5d4a98;if(_0x3b6523[_0x8838('0x3c')][_0x8838('0x4b')]){_0x485fe0[_0x8838('0x4c')]=[{'all':!![]}];}return db[_0x8838('0x4a')]['findAll'](_0x485fe0);})[_0x8838('0x1a')](function(_0x5afbf5){_0x145d0b[_0x8838('0x4d')]=_0x5afbf5;return _0x145d0b;})[_0x8838('0x1a')](respondWithFilteredResult(_0xfc9dd7,_0x485fe0))['catch'](handleError(_0xfc9dd7,null));};exports['show']=function(_0x51b930,_0x293295){var _0x13cc2a={'raw':![],'where':{'id':_0x51b930['params']['id']}},_0x1cd1fd={};_0x1cd1fd[_0x8838('0x3a')]=_['keys'](db['VoiceContext']['rawAttributes']);_0x1cd1fd['query']=_['keys'](_0x51b930['query']);_0x1cd1fd[_0x8838('0x3d')]=_[_0x8838('0x3e')](_0x1cd1fd[_0x8838('0x3a')],_0x1cd1fd['query']);_0x13cc2a[_0x8838('0x3f')]=_[_0x8838('0x3e')](_0x1cd1fd['model'],qs['fields'](_0x51b930[_0x8838('0x3c')][_0x8838('0x4e')]));_0x13cc2a[_0x8838('0x3f')]=_0x13cc2a[_0x8838('0x3f')]['length']?_0x13cc2a[_0x8838('0x3f')]:_0x1cd1fd[_0x8838('0x3a')];if(_0x51b930[_0x8838('0x3c')]['includeAll']){_0x13cc2a['include']=[{'all':!![]}];}_0x13cc2a=_[_0x8838('0x47')]({},_0x13cc2a,_0x51b930[_0x8838('0x49')]);return db[_0x8838('0x4a')][_0x8838('0x4f')](_0x13cc2a)[_0x8838('0x1a')](handleEntityNotFound(_0x293295,null))['then'](respondWithResult(_0x293295,null))[_0x8838('0x50')](handleError(_0x293295,null));};exports[_0x8838('0x51')]=function(_0x3a5cd8,_0x3e6226,_0x4f89b9){var _0x383857;return db[_0x8838('0x4a')][_0x8838('0x51')](_0x3a5cd8['body'],{'raw':!![]})[_0x8838('0x1a')](function(_0x533456){_0x383857=_0x533456;return db[_0x8838('0x4a')][_0x8838('0x52')]({'raw':!![]});})['then'](function(_0x4f7807){var _0x7086a2=fs[_0x8838('0x53')](path[_0x8838('0x54')](config[_0x8838('0x55')],_0x8838('0x56')),_0x8838('0x57'));var _0x1ff3da=ejs[_0x8838('0x58')](_0x7086a2,{'contexts':_0x4f7807||[]});fs[_0x8838('0x59')](_0x8838('0x5a'),_0x1ff3da);})['then'](function(){return respondWithRpcPromise('Reload',_0x8838('0x51'),{'module':_0x8838('0x5b')});})[_0x8838('0x1a')](function(){var _0x448f14=_0x3a5cd8['user'][_0x8838('0x30')]({'plain':!![]});if(!_0x448f14)throw new Error(_0x8838('0x5c'));if(_0x448f14[_0x8838('0x5d')]==='user'){var _0x2956f4=_0x383857[_0x8838('0x30')]({'plain':!![]});return db[_0x8838('0x5e')][_0x8838('0x4f')]({'where':{'name':_0x8838('0x5f'),'userProfileId':_0x448f14[_0x8838('0x60')]},'raw':!![]})[_0x8838('0x1a')](function(_0x3f44da){if(_0x3f44da&&_0x3f44da[_0x8838('0x61')]===0x0){return db[_0x8838('0x31')][_0x8838('0x51')]({'name':_0x2956f4[_0x8838('0x34')],'resourceId':_0x2956f4['id'],'type':_0x3f44da[_0x8838('0x34')],'sectionId':_0x3f44da['id']},{})[_0x8838('0x1a')](function(){return _0x383857;});}else{return _0x383857;}})[_0x8838('0x50')](function(_0x27e1d1){logger[_0x8838('0x20')](_0x8838('0x62'),_0x27e1d1);throw _0x27e1d1;});}return _0x383857;})[_0x8838('0x1a')](respondWithResult(_0x3e6226,0xc9))[_0x8838('0x50')](handleError(_0x3e6226,null));};exports[_0x8838('0x2f')]=function(_0x4828d5,_0x46dcf9,_0x17b959){var _0x3e1087;return db[_0x8838('0x4a')][_0x8838('0x4f')]({'where':{'id':_0x4828d5['params']['id']}})[_0x8838('0x1a')](handleEntityNotFound(_0x46dcf9,null))[_0x8838('0x1a')](saveUpdates(_0x4828d5['body'],null))[_0x8838('0x1a')](function(_0x421792){if(_0x421792){_0x3e1087=_0x421792;return db[_0x8838('0x4a')]['findAll']({'raw':!![]});}})[_0x8838('0x1a')](function(_0x573ff8){var _0x5dcbb4=fs[_0x8838('0x53')](path[_0x8838('0x54')](config['root'],_0x8838('0x56')),_0x8838('0x57'));var _0x71a215=ejs[_0x8838('0x58')](_0x5dcbb4,{'contexts':_0x573ff8||[]});fs[_0x8838('0x59')](_0x8838('0x5a'),_0x71a215);})[_0x8838('0x1a')](function(){return respondWithRpcPromise(_0x8838('0x63'),_0x8838('0x2f'),{'module':_0x8838('0x5b')});})[_0x8838('0x1a')](function(){return _0x3e1087;})[_0x8838('0x1a')](respondWithResult(_0x46dcf9,null))[_0x8838('0x50')](handleError(_0x46dcf9,null));};exports[_0x8838('0x32')]=function(_0x515ee0,_0x1c317b,_0x25b2aa){var _0x4ab467;return db[_0x8838('0x4a')][_0x8838('0x4f')]({'where':{'id':_0x515ee0['params']['id']}})[_0x8838('0x1a')](handleEntityNotFound(_0x1c317b,null))[_0x8838('0x1a')](removeEntity(_0x1c317b,null))[_0x8838('0x1a')](function(){return db[_0x8838('0x4a')]['findAll']({'raw':!![]});})[_0x8838('0x1a')](function(_0x57bbdf){var _0x41af07=fs[_0x8838('0x53')](path[_0x8838('0x54')](config[_0x8838('0x55')],_0x8838('0x56')),_0x8838('0x57'));var _0x1de116=ejs[_0x8838('0x58')](_0x41af07,{'contexts':_0x57bbdf});fs[_0x8838('0x59')](_0x8838('0x5a'),_0x1de116);return respondWithRpcPromise(_0x8838('0x63'),_0x8838('0x32'),{'module':_0x8838('0x5b')});})[_0x8838('0x50')](handleError(_0x1c317b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0ad550e..ae2d936 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 _0x608f=['voice_contexts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x608f,0x115));var _0xf608=function(_0xda8c5f,_0xf4ddf7){_0xda8c5f=_0xda8c5f-0x0;var _0x2ac761=_0x608f[_0xda8c5f];return _0x2ac761;};'use strict';var _=require('lodash');var util=require(_0xf608('0x0'));var logger=require(_0xf608('0x1'))(_0xf608('0x2'));var moment=require('moment');var BPromise=require(_0xf608('0x3'));var rp=require(_0xf608('0x4'));var fs=require('fs');var path=require(_0xf608('0x5'));var rimraf=require(_0xf608('0x6'));var config=require(_0xf608('0x7'));var attributes=require(_0xf608('0x8'));module[_0xf608('0x9')]=function(_0x3a6962,_0x1ab821){return _0x3a6962['define'](_0xf608('0xa'),attributes,{'tableName':_0xf608('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c14=['voice_contexts','lodash','util','../../config/logger','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0x362284,_0x2b2eb0){var _0x1a15c0=function(_0x2c882b){while(--_0x2c882b){_0x362284['push'](_0x362284['shift']());}};_0x1a15c0(++_0x2b2eb0);}(_0x0c14,0xc7));var _0x40c1=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x0c14[_0x166d93];return _0xba708;};'use strict';var _=require(_0x40c1('0x0'));var util=require(_0x40c1('0x1'));var logger=require(_0x40c1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x40c1('0x3'));var fs=require('fs');var path=require(_0x40c1('0x4'));var rimraf=require(_0x40c1('0x5'));var config=require('../../config/environment');var attributes=require(_0x40c1('0x6'));module[_0x40c1('0x7')]=function(_0x1225d1,_0x12e3b5){return _0x1225d1[_0x40c1('0x8')](_0x40c1('0x9'),attributes,{'tableName':_0x40c1('0xa'),'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 195f1ff..9936df5 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 _0xbc23=['error','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x2606d9,_0x49939b){var _0x293d4b=function(_0x35e3c1){while(--_0x35e3c1){_0x2606d9['push'](_0x2606d9['shift']());}};_0x293d4b(++_0x49939b);}(_0xbc23,0x1bd));var _0x3bc2=function(_0x273305,_0x57815f){_0x273305=_0x273305-0x0;var _0x12cf22=_0xbc23[_0x273305];return _0x12cf22;};'use strict';var _=require(_0x3bc2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3bc2('0x1'));var rs=require(_0x3bc2('0x2'));var fs=require('fs');var Redis=require(_0x3bc2('0x3'));var db=require(_0x3bc2('0x4'))['db'];var utils=require(_0x3bc2('0x5'));var logger=require(_0x3bc2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3bc2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5addfc,_0x12e582,_0x3d80ae){return new BPromise(function(_0x96349e,_0x115135){return client[_0x3bc2('0x8')](_0x5addfc,_0x3d80ae)[_0x3bc2('0x9')](function(_0x319b5d){logger['info'](_0x3bc2('0xa'),_0x12e582,'request\x20sent');logger[_0x3bc2('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x12e582,_0x3bc2('0xc'),JSON[_0x3bc2('0xd')](_0x319b5d));if(_0x319b5d[_0x3bc2('0xe')]){if(_0x319b5d[_0x3bc2('0xe')]['code']===0x1f4){logger[_0x3bc2('0xe')](_0x3bc2('0xa'),_0x12e582,_0x319b5d[_0x3bc2('0xe')][_0x3bc2('0xf')]);return _0x115135(_0x319b5d['error'][_0x3bc2('0xf')]);}logger['error'](_0x3bc2('0xa'),_0x12e582,_0x319b5d[_0x3bc2('0xe')]['message']);return _0x96349e(_0x319b5d[_0x3bc2('0xe')][_0x3bc2('0xf')]);}else{logger[_0x3bc2('0x10')]('VoiceContext,\x20%s,\x20%s',_0x12e582,_0x3bc2('0xc'));_0x96349e(_0x319b5d['result'][_0x3bc2('0xf')]);}})['catch'](function(_0x12b3c6){logger[_0x3bc2('0xe')](_0x3bc2('0xa'),_0x12e582,_0x12b3c6);_0x115135(_0x12b3c6);});});} \ No newline at end of file +var _0x67da=['error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x67da,0x192));var _0xa67d=function(_0x6ad91b,_0x4e0a0e){_0x6ad91b=_0x6ad91b-0x0;var _0x2e376b=_0x67da[_0x6ad91b];return _0x2e376b;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var moment=require(_0xa67d('0x1'));var BPromise=require(_0xa67d('0x2'));var rs=require(_0xa67d('0x3'));var fs=require('fs');var Redis=require(_0xa67d('0x4'));var db=require(_0xa67d('0x5'))['db'];var utils=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa67d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2734,_0x31d56a,_0x2346f4){return new BPromise(function(_0x10f89a,_0x2c37c2){return client[_0xa67d('0xb')](_0x4d2734,_0x2346f4)[_0xa67d('0xc')](function(_0x330a9f){logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));logger['debug'](_0xa67d('0x10'),_0x31d56a,_0xa67d('0xf'),JSON[_0xa67d('0x11')](_0x330a9f));if(_0x330a9f[_0xa67d('0x12')]){if(_0x330a9f['error'][_0xa67d('0x13')]===0x1f4){logger[_0xa67d('0x12')]('VoiceContext,\x20%s,\x20%s',_0x31d56a,_0x330a9f['error'][_0xa67d('0x14')]);return _0x2c37c2(_0x330a9f['error'][_0xa67d('0x14')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x31d56a,_0x330a9f[_0xa67d('0x12')][_0xa67d('0x14')]);return _0x10f89a(_0x330a9f['error'][_0xa67d('0x14')]);}else{logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));_0x10f89a(_0x330a9f['result']['message']);}})['catch'](function(_0x4fa50f){logger[_0xa67d('0x12')]('VoiceContext,\x20%s,\x20%s',_0x31d56a,_0x4fa50f);_0x2c37c2(_0x4fa50f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a93e9e2..73815a1 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 _0x11ab=['/:id','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x34f5de,_0x5dac6e){var _0x5849dc=function(_0x3b78eb){while(--_0x3b78eb){_0x34f5de['push'](_0x34f5de['shift']());}};_0x5849dc(++_0x5dac6e);}(_0x11ab,0xf5));var _0xb11a=function(_0x2dcc85,_0x2cda97){_0x2dcc85=_0x2dcc85-0x0;var _0x2d200c=_0x11ab[_0x2dcc85];return _0x2d200c;};'use strict';var multer=require(_0xb11a('0x0'));var util=require(_0xb11a('0x1'));var path=require(_0xb11a('0x2'));var timeout=require(_0xb11a('0x3'));var express=require(_0xb11a('0x4'));var router=express[_0xb11a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb11a('0x6'));var interaction=require(_0xb11a('0x7'));var config=require(_0xb11a('0x8'));var controller=require(_0xb11a('0x9'));router[_0xb11a('0xa')]('/',auth[_0xb11a('0xb')](),controller[_0xb11a('0xc')]);router[_0xb11a('0xa')](_0xb11a('0xd'),auth[_0xb11a('0xb')](),controller[_0xb11a('0xe')]);router[_0xb11a('0xa')](_0xb11a('0xf'),auth[_0xb11a('0xb')](),controller['show']);router['post']('/',auth[_0xb11a('0xb')](),controller[_0xb11a('0x10')]);router['put'](_0xb11a('0xf'),auth[_0xb11a('0xb')](),controller[_0xb11a('0x11')]);router[_0xb11a('0x12')]('/:id',auth[_0xb11a('0xb')](),controller[_0xb11a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x282d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','post','create','/:id','delete','destroy','exports'];(function(_0x193e66,_0x113ec6){var _0x57878b=function(_0x2fb186){while(--_0x2fb186){_0x193e66['push'](_0x193e66['shift']());}};_0x57878b(++_0x113ec6);}(_0x282d,0x132));var _0xd282=function(_0xd57cca,_0x2bd8ff){_0xd57cca=_0xd57cca-0x0;var _0x37b8aa=_0x282d[_0xd57cca];return _0x37b8aa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd282('0x0'));var express=require(_0xd282('0x1'));var router=express[_0xd282('0x2')]();var fs_extra=require(_0xd282('0x3'));var auth=require(_0xd282('0x4'));var interaction=require(_0xd282('0x5'));var config=require(_0xd282('0x6'));var controller=require(_0xd282('0x7'));router[_0xd282('0x8')]('/',auth[_0xd282('0x9')](),controller[_0xd282('0xa')]);router[_0xd282('0x8')](_0xd282('0xb'),auth[_0xd282('0x9')](),controller['describe']);router['get']('/:id',auth[_0xd282('0x9')](),controller['show']);router[_0xd282('0xc')]('/',auth[_0xd282('0x9')](),controller[_0xd282('0xd')]);router['put'](_0xd282('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd282('0xf')](_0xd282('0xe'),auth[_0xd282('0x9')](),controller[_0xd282('0x10')]);module[_0xd282('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b28a5cf..7522e2a 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 _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5cbc8b,_0x3232ed){_0x5cbc8b=_0x5cbc8b-0x0;var _0x401b03=_0x8ef6[_0x5cbc8b];return _0x401b03;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x62a56f,_0x4cedeb){var _0x156be0=function(_0x1bd40f){while(--_0x1bd40f){_0x62a56f['push'](_0x62a56f['shift']());}};_0x156be0(++_0x4cedeb);}(_0x84ab,0x12f));var _0xb84a=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x84ab[_0x28f32c];return _0x355402;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a300c3b..a2d3684 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 _0xfc07=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','name','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch'];(function(_0xe6b2de,_0x533e76){var _0x13e47b=function(_0x3122f9){while(--_0x3122f9){_0xe6b2de['push'](_0xe6b2de['shift']());}};_0x13e47b(++_0x533e76);}(_0xfc07,0x165));var _0x7fc0=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xfc07[_0x59bcb1];return _0x4a737f;};'use strict';var emlformat=require(_0x7fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fc0('0x1'));var jsonpatch=require(_0x7fc0('0x2'));var rp=require('request-promise');var moment=require(_0x7fc0('0x3'));var BPromise=require(_0x7fc0('0x4'));var Mustache=require(_0x7fc0('0x5'));var util=require(_0x7fc0('0x6'));var path=require(_0x7fc0('0x7'));var sox=require(_0x7fc0('0x8'));var csv=require('to-csv');var ejs=require(_0x7fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x7fc0('0xa'));var _=require('lodash');var squel=require(_0x7fc0('0xb'));var crypto=require(_0x7fc0('0xc'));var jsforce=require(_0x7fc0('0xd'));var deskjs=require(_0x7fc0('0xe'));var toCsv=require(_0x7fc0('0xf'));var querystring=require(_0x7fc0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fc0('0x11'));var qs=require(_0x7fc0('0x12'));var as=require(_0x7fc0('0x13'));var hardwareService=require(_0x7fc0('0x14'));var logger=require(_0x7fc0('0x15'))('api');var utils=require(_0x7fc0('0x16'));var config=require(_0x7fc0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fc0('0x18'))['db'];function respondWithStatusCode(_0x1a6a64,_0x1d00b1){_0x1d00b1=_0x1d00b1||0xcc;return function(_0x26cec1){if(_0x26cec1){return _0x1a6a64['sendStatus'](_0x1d00b1);}return _0x1a6a64[_0x7fc0('0x19')](_0x1d00b1)[_0x7fc0('0x1a')]();};}function respondWithResult(_0x144400,_0x3cc707){_0x3cc707=_0x3cc707||0xc8;return function(_0x1eb3fe){if(_0x1eb3fe){return _0x144400[_0x7fc0('0x19')](_0x3cc707)[_0x7fc0('0x1b')](_0x1eb3fe);}};}function respondWithFilteredResult(_0x305570,_0x1c2cf0){return function(_0x2ad6c2){if(_0x2ad6c2){var _0x513a61=typeof _0x1c2cf0[_0x7fc0('0x1c')]==='undefined'&&typeof _0x1c2cf0['limit']===_0x7fc0('0x1d');var _0x333a00=_0x2ad6c2['count'];var _0x399228=_0x513a61?0x0:_0x1c2cf0['offset'];var _0x3c983a=_0x513a61?_0x2ad6c2[_0x7fc0('0x1e')]:_0x1c2cf0['offset']+_0x1c2cf0[_0x7fc0('0x1f')];var _0x22e460;if(_0x3c983a>=_0x333a00){_0x3c983a=_0x333a00;_0x22e460=0xc8;}else{_0x22e460=0xce;}_0x305570['status'](_0x22e460);return _0x305570['set']('Content-Range',_0x399228+'-'+_0x3c983a+'/'+_0x333a00)[_0x7fc0('0x1b')](_0x2ad6c2);}return null;};}function patchUpdates(_0x8b3792){return function(_0x46bf55){try{jsonpatch[_0x7fc0('0x20')](_0x46bf55,_0x8b3792,!![]);}catch(_0x21fd75){return BPromise[_0x7fc0('0x21')](_0x21fd75);}return _0x46bf55[_0x7fc0('0x22')]();};}function saveUpdates(_0x5227d3,_0x545d97){return function(_0x569a9a){if(_0x569a9a){return _0x569a9a[_0x7fc0('0x23')](_0x5227d3)[_0x7fc0('0x24')](function(_0x2f339f){return _0x2f339f;});}return null;};}function removeEntity(_0x4c0a92,_0x3bb670){return function(_0x456f55){if(_0x456f55){return _0x456f55['destroy']()[_0x7fc0('0x24')](function(){_0x4c0a92[_0x7fc0('0x19')](0xcc)[_0x7fc0('0x1a')]();});}};}function handleEntityNotFound(_0x2a418f,_0x59fbfd){return function(_0x57dbc2){if(!_0x57dbc2){_0x2a418f['sendStatus'](0x194);}return _0x57dbc2;};}function handleError(_0x242bef,_0x56d268){_0x56d268=_0x56d268||0x1f4;return function(_0x2cce2c){logger['error'](_0x2cce2c['stack']);if(_0x2cce2c[_0x7fc0('0x25')]){delete _0x2cce2c['name'];}_0x242bef[_0x7fc0('0x19')](_0x56d268)['send'](_0x2cce2c);};}exports[_0x7fc0('0x26')]=function(_0x5bbe35,_0x59048a){var _0x4ee1b2={},_0x114cb1={},_0x109d33={'count':0x0,'rows':[]};var _0x3b637c=_[_0x7fc0('0x27')](db[_0x7fc0('0x28')][_0x7fc0('0x29')],function(_0x3a8437){return{'name':_0x3a8437['fieldName'],'type':_0x3a8437[_0x7fc0('0x2a')][_0x7fc0('0x2b')]};});_0x114cb1[_0x7fc0('0x2c')]=_[_0x7fc0('0x27')](_0x3b637c,'name');_0x114cb1[_0x7fc0('0x2d')]=_[_0x7fc0('0x2e')](_0x5bbe35[_0x7fc0('0x2d')]);_0x114cb1[_0x7fc0('0x2f')]=_[_0x7fc0('0x30')](_0x114cb1[_0x7fc0('0x2c')],_0x114cb1[_0x7fc0('0x2d')]);_0x4ee1b2['attributes']=_['intersection'](_0x114cb1[_0x7fc0('0x2c')],qs[_0x7fc0('0x31')](_0x5bbe35[_0x7fc0('0x2d')][_0x7fc0('0x31')]));_0x4ee1b2['attributes']=_0x4ee1b2[_0x7fc0('0x32')][_0x7fc0('0x33')]?_0x4ee1b2['attributes']:_0x114cb1['model'];if(!_0x5bbe35['query'][_0x7fc0('0x34')](_0x7fc0('0x35'))){_0x4ee1b2[_0x7fc0('0x1f')]=qs[_0x7fc0('0x1f')](_0x5bbe35[_0x7fc0('0x2d')][_0x7fc0('0x1f')]);_0x4ee1b2[_0x7fc0('0x1c')]=qs[_0x7fc0('0x1c')](_0x5bbe35[_0x7fc0('0x2d')][_0x7fc0('0x1c')]);}_0x4ee1b2['order']=qs[_0x7fc0('0x36')](_0x5bbe35['query']['sort']);_0x4ee1b2['where']=qs[_0x7fc0('0x2f')](_[_0x7fc0('0x37')](_0x5bbe35[_0x7fc0('0x2d')],_0x114cb1[_0x7fc0('0x2f')]),_0x3b637c);if(_0x5bbe35['query'][_0x7fc0('0x38')]){_0x4ee1b2[_0x7fc0('0x39')]=_[_0x7fc0('0x3a')](_0x4ee1b2['where'],{'$or':_[_0x7fc0('0x27')](_0x3b637c,function(_0x222e6a){if(_0x222e6a[_0x7fc0('0x2a')]!=='VIRTUAL'){var _0x567897={};_0x567897[_0x222e6a['name']]={'$like':'%'+_0x5bbe35[_0x7fc0('0x2d')][_0x7fc0('0x38')]+'%'};return _0x567897;}})});}_0x4ee1b2=_[_0x7fc0('0x3a')]({},_0x4ee1b2,_0x5bbe35[_0x7fc0('0x3b')]);var _0x554c90={'where':_0x4ee1b2[_0x7fc0('0x39')]};return db[_0x7fc0('0x28')][_0x7fc0('0x1e')](_0x554c90)['then'](function(_0x3c2b7c){_0x109d33[_0x7fc0('0x1e')]=_0x3c2b7c;if(_0x5bbe35[_0x7fc0('0x2d')]['includeAll']){_0x4ee1b2['include']=[{'all':!![]}];}return db[_0x7fc0('0x28')][_0x7fc0('0x3c')](_0x4ee1b2);})[_0x7fc0('0x24')](function(_0x1dfc34){_0x109d33[_0x7fc0('0x3d')]=_0x1dfc34;return _0x109d33;})[_0x7fc0('0x24')](respondWithFilteredResult(_0x59048a,_0x4ee1b2))[_0x7fc0('0x3e')](handleError(_0x59048a,null));};exports[_0x7fc0('0x3f')]=function(_0x169490,_0x4e4eb6){var _0x16573d={'raw':!![],'where':{'id':_0x169490[_0x7fc0('0x40')]['id']}},_0x2f335f={};_0x2f335f['model']=_[_0x7fc0('0x2e')](db[_0x7fc0('0x28')][_0x7fc0('0x29')]);_0x2f335f[_0x7fc0('0x2d')]=_[_0x7fc0('0x2e')](_0x169490[_0x7fc0('0x2d')]);_0x2f335f[_0x7fc0('0x2f')]=_[_0x7fc0('0x30')](_0x2f335f['model'],_0x2f335f[_0x7fc0('0x2d')]);_0x16573d[_0x7fc0('0x32')]=_[_0x7fc0('0x30')](_0x2f335f['model'],qs['fields'](_0x169490['query'][_0x7fc0('0x31')]));_0x16573d[_0x7fc0('0x32')]=_0x16573d[_0x7fc0('0x32')]['length']?_0x16573d[_0x7fc0('0x32')]:_0x2f335f[_0x7fc0('0x2c')];if(_0x169490[_0x7fc0('0x2d')][_0x7fc0('0x41')]){_0x16573d[_0x7fc0('0x42')]=[{'all':!![]}];}_0x16573d=_['merge']({},_0x16573d,_0x169490[_0x7fc0('0x3b')]);return db[_0x7fc0('0x28')][_0x7fc0('0x43')](_0x16573d)[_0x7fc0('0x24')](handleEntityNotFound(_0x4e4eb6,null))[_0x7fc0('0x24')](respondWithResult(_0x4e4eb6,null))[_0x7fc0('0x3e')](handleError(_0x4e4eb6,null));};exports[_0x7fc0('0x44')]=function(_0x7d76e9,_0xcffd2c){return db[_0x7fc0('0x28')][_0x7fc0('0x44')](_0x7d76e9[_0x7fc0('0x45')],{})[_0x7fc0('0x24')](respondWithResult(_0xcffd2c,0xc9))[_0x7fc0('0x3e')](handleError(_0xcffd2c,null));};exports[_0x7fc0('0x23')]=function(_0x484596,_0x4f7a7c){if(_0x484596[_0x7fc0('0x45')]['id']){delete _0x484596[_0x7fc0('0x45')]['id'];}return db['VoiceDialReport'][_0x7fc0('0x43')]({'where':{'id':_0x484596[_0x7fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x4f7a7c,null))[_0x7fc0('0x24')](saveUpdates(_0x484596[_0x7fc0('0x45')],null))['then'](respondWithResult(_0x4f7a7c,null))[_0x7fc0('0x3e')](handleError(_0x4f7a7c,null));};exports[_0x7fc0('0x46')]=function(_0x519573,_0x514c4f){return db[_0x7fc0('0x28')][_0x7fc0('0x43')]({'where':{'id':_0x519573[_0x7fc0('0x40')]['id']}})[_0x7fc0('0x24')](handleEntityNotFound(_0x514c4f,null))[_0x7fc0('0x24')](removeEntity(_0x514c4f,null))[_0x7fc0('0x3e')](handleError(_0x514c4f,null));};exports[_0x7fc0('0x47')]=function(_0x5ea288,_0x5b935d){return db[_0x7fc0('0x28')][_0x7fc0('0x47')]()['then'](respondWithResult(_0x5b935d,null))[_0x7fc0('0x3e')](handleError(_0x5b935d,null));}; \ No newline at end of file +var _0x61e6=['includeAll','include','findAll','rows','show','params','fields','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x61e6,0x1db));var _0x661e=function(_0x40eb9d,_0x35c680){_0x40eb9d=_0x40eb9d-0x0;var _0x36cc42=_0x61e6[_0x40eb9d];return _0x36cc42;};'use strict';var emlformat=require(_0x661e('0x0'));var rimraf=require(_0x661e('0x1'));var zipdir=require(_0x661e('0x2'));var jsonpatch=require(_0x661e('0x3'));var rp=require(_0x661e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x661e('0x5'));var util=require(_0x661e('0x6'));var path=require('path');var sox=require(_0x661e('0x7'));var csv=require('to-csv');var ejs=require(_0x661e('0x8'));var fs=require('fs');var fs_extra=require(_0x661e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x661e('0xa'));var jsforce=require(_0x661e('0xb'));var deskjs=require(_0x661e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x661e('0xd'));var Papa=require(_0x661e('0xe'));var Redis=require(_0x661e('0xf'));var authService=require(_0x661e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x661e('0x11'));var hardwareService=require(_0x661e('0x12'));var logger=require(_0x661e('0x13'))('api');var utils=require(_0x661e('0x14'));var config=require(_0x661e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c1ec7,_0x572710){_0x572710=_0x572710||0xcc;return function(_0x3373d6){if(_0x3373d6){return _0x1c1ec7[_0x661e('0x16')](_0x572710);}return _0x1c1ec7['status'](_0x572710)[_0x661e('0x17')]();};}function respondWithResult(_0x4a16bf,_0x5064b3){_0x5064b3=_0x5064b3||0xc8;return function(_0xca9c84){if(_0xca9c84){return _0x4a16bf[_0x661e('0x18')](_0x5064b3)[_0x661e('0x19')](_0xca9c84);}};}function respondWithFilteredResult(_0x5b62cf,_0x5b89b8){return function(_0x24d3de){if(_0x24d3de){var _0x140f08=typeof _0x5b89b8[_0x661e('0x1a')]==='undefined'&&typeof _0x5b89b8[_0x661e('0x1b')]==='undefined';var _0x2a398c=_0x24d3de['count'];var _0x65c81=_0x140f08?0x0:_0x5b89b8[_0x661e('0x1a')];var _0x3d91fe=_0x140f08?_0x24d3de['count']:_0x5b89b8[_0x661e('0x1a')]+_0x5b89b8[_0x661e('0x1b')];var _0x358f94;if(_0x3d91fe>=_0x2a398c){_0x3d91fe=_0x2a398c;_0x358f94=0xc8;}else{_0x358f94=0xce;}_0x5b62cf['status'](_0x358f94);return _0x5b62cf[_0x661e('0x1c')](_0x661e('0x1d'),_0x65c81+'-'+_0x3d91fe+'/'+_0x2a398c)[_0x661e('0x19')](_0x24d3de);}return null;};}function patchUpdates(_0x2ff7d3){return function(_0x15c2c9){try{jsonpatch[_0x661e('0x1e')](_0x15c2c9,_0x2ff7d3,!![]);}catch(_0x3e6dce){return BPromise[_0x661e('0x1f')](_0x3e6dce);}return _0x15c2c9[_0x661e('0x20')]();};}function saveUpdates(_0x40667d,_0x405afb){return function(_0x9159ad){if(_0x9159ad){return _0x9159ad[_0x661e('0x21')](_0x40667d)[_0x661e('0x22')](function(_0x1140cf){return _0x1140cf;});}return null;};}function removeEntity(_0x2faba2,_0x18fb2f){return function(_0x30a501){if(_0x30a501){return _0x30a501['destroy']()[_0x661e('0x22')](function(){_0x2faba2['status'](0xcc)[_0x661e('0x17')]();});}};}function handleEntityNotFound(_0x531ec3,_0x93265b){return function(_0x264c7b){if(!_0x264c7b){_0x531ec3[_0x661e('0x16')](0x194);}return _0x264c7b;};}function handleError(_0x459ecd,_0x418bfe){_0x418bfe=_0x418bfe||0x1f4;return function(_0x32e108){logger[_0x661e('0x23')](_0x32e108[_0x661e('0x24')]);if(_0x32e108['name']){delete _0x32e108[_0x661e('0x25')];}_0x459ecd[_0x661e('0x18')](_0x418bfe)[_0x661e('0x26')](_0x32e108);};}exports[_0x661e('0x27')]=function(_0x7a07e2,_0x346646){var _0x31b06d={},_0x1092b7={},_0x45acf2={'count':0x0,'rows':[]};var _0xf8c3b9=_[_0x661e('0x28')](db[_0x661e('0x29')][_0x661e('0x2a')],function(_0xa3ec04){return{'name':_0xa3ec04[_0x661e('0x2b')],'type':_0xa3ec04[_0x661e('0x2c')][_0x661e('0x2d')]};});_0x1092b7['model']=_[_0x661e('0x28')](_0xf8c3b9,'name');_0x1092b7[_0x661e('0x2e')]=_[_0x661e('0x2f')](_0x7a07e2[_0x661e('0x2e')]);_0x1092b7[_0x661e('0x30')]=_[_0x661e('0x31')](_0x1092b7[_0x661e('0x32')],_0x1092b7[_0x661e('0x2e')]);_0x31b06d[_0x661e('0x33')]=_[_0x661e('0x31')](_0x1092b7[_0x661e('0x32')],qs['fields'](_0x7a07e2[_0x661e('0x2e')]['fields']));_0x31b06d['attributes']=_0x31b06d[_0x661e('0x33')][_0x661e('0x34')]?_0x31b06d['attributes']:_0x1092b7[_0x661e('0x32')];if(!_0x7a07e2['query'][_0x661e('0x35')](_0x661e('0x36'))){_0x31b06d[_0x661e('0x1b')]=qs['limit'](_0x7a07e2[_0x661e('0x2e')][_0x661e('0x1b')]);_0x31b06d[_0x661e('0x1a')]=qs['offset'](_0x7a07e2[_0x661e('0x2e')][_0x661e('0x1a')]);}_0x31b06d[_0x661e('0x37')]=qs[_0x661e('0x38')](_0x7a07e2[_0x661e('0x2e')][_0x661e('0x38')]);_0x31b06d[_0x661e('0x39')]=qs[_0x661e('0x30')](_[_0x661e('0x3a')](_0x7a07e2[_0x661e('0x2e')],_0x1092b7[_0x661e('0x30')]),_0xf8c3b9);if(_0x7a07e2['query'][_0x661e('0x3b')]){_0x31b06d[_0x661e('0x39')]=_[_0x661e('0x3c')](_0x31b06d[_0x661e('0x39')],{'$or':_[_0x661e('0x28')](_0xf8c3b9,function(_0x555e20){if(_0x555e20[_0x661e('0x2c')]!==_0x661e('0x3d')){var _0x58d4db={};_0x58d4db[_0x555e20[_0x661e('0x25')]]={'$like':'%'+_0x7a07e2[_0x661e('0x2e')][_0x661e('0x3b')]+'%'};return _0x58d4db;}})});}_0x31b06d=_[_0x661e('0x3c')]({},_0x31b06d,_0x7a07e2[_0x661e('0x3e')]);var _0x5255f0={'where':_0x31b06d[_0x661e('0x39')]};return db[_0x661e('0x29')][_0x661e('0x3f')](_0x5255f0)[_0x661e('0x22')](function(_0x4ec4d7){_0x45acf2['count']=_0x4ec4d7;if(_0x7a07e2[_0x661e('0x2e')][_0x661e('0x40')]){_0x31b06d[_0x661e('0x41')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x661e('0x42')](_0x31b06d);})[_0x661e('0x22')](function(_0x49f60f){_0x45acf2[_0x661e('0x43')]=_0x49f60f;return _0x45acf2;})[_0x661e('0x22')](respondWithFilteredResult(_0x346646,_0x31b06d))['catch'](handleError(_0x346646,null));};exports[_0x661e('0x44')]=function(_0xa3cb46,_0x4faef9){var _0x393812={'raw':!![],'where':{'id':_0xa3cb46[_0x661e('0x45')]['id']}},_0xbd5e8b={};_0xbd5e8b[_0x661e('0x32')]=_['keys'](db[_0x661e('0x29')]['rawAttributes']);_0xbd5e8b[_0x661e('0x2e')]=_[_0x661e('0x2f')](_0xa3cb46[_0x661e('0x2e')]);_0xbd5e8b['filters']=_[_0x661e('0x31')](_0xbd5e8b[_0x661e('0x32')],_0xbd5e8b[_0x661e('0x2e')]);_0x393812[_0x661e('0x33')]=_[_0x661e('0x31')](_0xbd5e8b[_0x661e('0x32')],qs['fields'](_0xa3cb46[_0x661e('0x2e')][_0x661e('0x46')]));_0x393812[_0x661e('0x33')]=_0x393812[_0x661e('0x33')][_0x661e('0x34')]?_0x393812['attributes']:_0xbd5e8b['model'];if(_0xa3cb46[_0x661e('0x2e')][_0x661e('0x40')]){_0x393812[_0x661e('0x41')]=[{'all':!![]}];}_0x393812=_[_0x661e('0x3c')]({},_0x393812,_0xa3cb46[_0x661e('0x3e')]);return db[_0x661e('0x29')][_0x661e('0x47')](_0x393812)['then'](handleEntityNotFound(_0x4faef9,null))['then'](respondWithResult(_0x4faef9,null))['catch'](handleError(_0x4faef9,null));};exports[_0x661e('0x48')]=function(_0x28eb35,_0x50af21){return db[_0x661e('0x29')][_0x661e('0x48')](_0x28eb35[_0x661e('0x49')],{})[_0x661e('0x22')](respondWithResult(_0x50af21,0xc9))['catch'](handleError(_0x50af21,null));};exports['update']=function(_0x5c295e,_0xd65526){if(_0x5c295e[_0x661e('0x49')]['id']){delete _0x5c295e[_0x661e('0x49')]['id'];}return db[_0x661e('0x29')][_0x661e('0x47')]({'where':{'id':_0x5c295e[_0x661e('0x45')]['id']}})['then'](handleEntityNotFound(_0xd65526,null))[_0x661e('0x22')](saveUpdates(_0x5c295e[_0x661e('0x49')],null))[_0x661e('0x22')](respondWithResult(_0xd65526,null))[_0x661e('0x4a')](handleError(_0xd65526,null));};exports[_0x661e('0x4b')]=function(_0x5ea923,_0x468482){return db['VoiceDialReport'][_0x661e('0x47')]({'where':{'id':_0x5ea923['params']['id']}})['then'](handleEntityNotFound(_0x468482,null))[_0x661e('0x22')](removeEntity(_0x468482,null))[_0x661e('0x4a')](handleError(_0x468482,null));};exports[_0x661e('0x4c')]=function(_0x5de297,_0x566d4f){return db[_0x661e('0x29')]['describe']()[_0x661e('0x22')](respondWithResult(_0x566d4f,null))['catch'](handleError(_0x566d4f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f8b4630..e911a1e 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 _0x86d7=['VoiceDialReport','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x435274,_0x17e5fc){var _0x482c77=function(_0x10370b){while(--_0x10370b){_0x435274['push'](_0x435274['shift']());}};_0x482c77(++_0x17e5fc);}(_0x86d7,0x152));var _0x786d=function(_0x2a9d7a,_0xe17c0e){_0x2a9d7a=_0x2a9d7a-0x0;var _0x3dc845=_0x86d7[_0x2a9d7a];return _0x3dc845;};'use strict';var _=require('lodash');var util=require(_0x786d('0x0'));var logger=require(_0x786d('0x1'))('api');var moment=require(_0x786d('0x2'));var BPromise=require(_0x786d('0x3'));var rp=require(_0x786d('0x4'));var fs=require('fs');var path=require(_0x786d('0x5'));var rimraf=require(_0x786d('0x6'));var config=require(_0x786d('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x786d('0x8')]=function(_0x2846ca,_0x50b726){return _0x2846ca[_0x786d('0x9')](_0x786d('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x786d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7564=['define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports'];(function(_0x15bb5e,_0x14d5ec){var _0xe31e45=function(_0x38ba66){while(--_0x38ba66){_0x15bb5e['push'](_0x15bb5e['shift']());}};_0xe31e45(++_0x14d5ec);}(_0x7564,0x1e4));var _0x4756=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7564[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4756('0x0'));var util=require(_0x4756('0x1'));var logger=require(_0x4756('0x2'))(_0x4756('0x3'));var moment=require('moment');var BPromise=require(_0x4756('0x4'));var rp=require(_0x4756('0x5'));var fs=require('fs');var path=require(_0x4756('0x6'));var rimraf=require(_0x4756('0x7'));var config=require('../../config/environment');var attributes=require(_0x4756('0x8'));module[_0x4756('0x9')]=function(_0x4b753d,_0x2bea80){return _0x4b753d[_0x4756('0xa')](_0x4756('0xb'),attributes,{'tableName':_0x4756('0xc'),'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 986d84b..cac499c 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 _0xfce7=['randomstring','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','UpdateVoiceDialReport','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x41dd6b,_0x5ae4ba){var _0x156c5a=function(_0x130aea){while(--_0x130aea){_0x41dd6b['push'](_0x41dd6b['shift']());}};_0x156c5a(++_0x5ae4ba);}(_0xfce7,0x74));var _0x7fce=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0xfce7[_0x2353fe];return _0x4d43f6;};'use strict';var _=require(_0x7fce('0x0'));var util=require(_0x7fce('0x1'));var moment=require(_0x7fce('0x2'));var BPromise=require(_0x7fce('0x3'));var rs=require(_0x7fce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7fce('0x5'))('rpc');var config=require(_0x7fce('0x6'));var jayson=require(_0x7fce('0x7'));var client=jayson['client'][_0x7fce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9ca6fb,_0x3fba07,_0x3970a4){return new BPromise(function(_0x18538d,_0x29be98){return client['request'](_0x9ca6fb,_0x3970a4)[_0x7fce('0x9')](function(_0x1a8813){logger[_0x7fce('0xa')](_0x7fce('0xb'),_0x3fba07,_0x7fce('0xc'));logger['debug'](_0x7fce('0xd'),_0x3fba07,_0x7fce('0xc'),JSON[_0x7fce('0xe')](_0x1a8813));if(_0x1a8813[_0x7fce('0xf')]){if(_0x1a8813[_0x7fce('0xf')]['code']===0x1f4){logger[_0x7fce('0xf')](_0x7fce('0xb'),_0x3fba07,_0x1a8813[_0x7fce('0xf')]['message']);return _0x29be98(_0x1a8813['error'][_0x7fce('0x10')]);}logger[_0x7fce('0xf')](_0x7fce('0xb'),_0x3fba07,_0x1a8813['error'][_0x7fce('0x10')]);return _0x18538d(_0x1a8813[_0x7fce('0xf')][_0x7fce('0x10')]);}else{logger[_0x7fce('0xa')](_0x7fce('0xb'),_0x3fba07,'request\x20sent');_0x18538d(_0x1a8813[_0x7fce('0x11')][_0x7fce('0x10')]);}})[_0x7fce('0x12')](function(_0x4d17c7){logger['error'](_0x7fce('0xb'),_0x3fba07,_0x4d17c7);_0x29be98(_0x4d17c7);});});}exports[_0x7fce('0x13')]=function(_0x448a4c){var _0x51dfbe=this;return new Promise(function(_0x31538f,_0x28593a){return db[_0x7fce('0x14')][_0x7fce('0x15')](_0x448a4c[_0x7fce('0x16')],{'raw':_0x448a4c[_0x7fce('0x17')]?_0x448a4c[_0x7fce('0x17')][_0x7fce('0x18')]===undefined?!![]:![]:!![]})[_0x7fce('0x9')](function(_0x3af62a){logger['info'](_0x7fce('0x13'),_0x448a4c);logger[_0x7fce('0x19')](_0x7fce('0x13'),_0x448a4c,JSON[_0x7fce('0xe')](_0x3af62a));_0x31538f(_0x3af62a);})[_0x7fce('0x12')](function(_0x3b9335){logger[_0x7fce('0xf')](_0x7fce('0x13'),_0x3b9335[_0x7fce('0x10')],_0x448a4c);_0x28593a(_0x51dfbe[_0x7fce('0xf')](0x1f4,_0x3b9335['message']));});});};exports[_0x7fce('0x1a')]=function(_0x2e6a80){var _0x26087d=this;return new Promise(function(_0xf60152,_0xa2cb53){return db[_0x7fce('0x14')]['update'](_0x2e6a80[_0x7fce('0x16')],{'raw':_0x2e6a80[_0x7fce('0x17')]?_0x2e6a80[_0x7fce('0x17')][_0x7fce('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6a80[_0x7fce('0x17')]?_0x2e6a80[_0x7fce('0x17')][_0x7fce('0x1b')]||null:null,'attributes':_0x2e6a80[_0x7fce('0x17')]?_0x2e6a80[_0x7fce('0x17')][_0x7fce('0x1c')]||null:null,'limit':_0x2e6a80[_0x7fce('0x17')]?_0x2e6a80[_0x7fce('0x17')][_0x7fce('0x1d')]||null:null})['then'](function(_0x57dc76){logger[_0x7fce('0xa')]('UpdateVoiceDialReport',_0x2e6a80);logger[_0x7fce('0x19')](_0x7fce('0x1a'),_0x2e6a80,JSON[_0x7fce('0xe')](_0x57dc76));_0xf60152(_0x57dc76);})[_0x7fce('0x12')](function(_0x4cb560){logger[_0x7fce('0xf')](_0x7fce('0x1a'),_0x4cb560[_0x7fce('0x10')],_0x2e6a80);_0xa2cb53(_0x26087d[_0x7fce('0xf')](0x1f4,_0x4cb560[_0x7fce('0x10')]));});});}; \ No newline at end of file +var _0xc8c1=['error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4a7b29,_0x3ce3bb){var _0x3f9548=function(_0x123b66){while(--_0x123b66){_0x4a7b29['push'](_0x4a7b29['shift']());}};_0x3f9548(++_0x3ce3bb);}(_0xc8c1,0x6d));var _0x1c8c=function(_0x3de6f7,_0x4ad6a4){_0x3de6f7=_0x3de6f7-0x0;var _0x5d6aae=_0xc8c1[_0x3de6f7];return _0x5d6aae;};'use strict';var _=require(_0x1c8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1c8c('0x1'));var rs=require(_0x1c8c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c8c('0x3'))['db'];var utils=require(_0x1c8c('0x4'));var logger=require(_0x1c8c('0x5'))(_0x1c8c('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c8c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc540fa,_0x5e904f,_0x4f2286){return new BPromise(function(_0x5337f6,_0x2672e9){return client[_0x1c8c('0x8')](_0xc540fa,_0x4f2286)[_0x1c8c('0x9')](function(_0x58fc84){logger[_0x1c8c('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x5e904f,'request\x20sent');logger[_0x1c8c('0xb')](_0x1c8c('0xc'),_0x5e904f,_0x1c8c('0xd'),JSON[_0x1c8c('0xe')](_0x58fc84));if(_0x58fc84[_0x1c8c('0xf')]){if(_0x58fc84[_0x1c8c('0xf')][_0x1c8c('0x10')]===0x1f4){logger['error'](_0x1c8c('0x11'),_0x5e904f,_0x58fc84[_0x1c8c('0xf')]['message']);return _0x2672e9(_0x58fc84[_0x1c8c('0xf')][_0x1c8c('0x12')]);}logger[_0x1c8c('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x5e904f,_0x58fc84[_0x1c8c('0xf')][_0x1c8c('0x12')]);return _0x5337f6(_0x58fc84[_0x1c8c('0xf')]['message']);}else{logger['info'](_0x1c8c('0x11'),_0x5e904f,_0x1c8c('0xd'));_0x5337f6(_0x58fc84[_0x1c8c('0x13')][_0x1c8c('0x12')]);}})[_0x1c8c('0x14')](function(_0x838c60){logger[_0x1c8c('0xf')](_0x1c8c('0x11'),_0x5e904f,_0x838c60);_0x2672e9(_0x838c60);});});}exports['CreateVoiceDialReport']=function(_0x426b28){var _0x2686a3=this;return new Promise(function(_0x286d72,_0xf204d3){return db[_0x1c8c('0x15')]['create'](_0x426b28[_0x1c8c('0x16')],{'raw':_0x426b28['options']?_0x426b28[_0x1c8c('0x17')][_0x1c8c('0x18')]===undefined?!![]:![]:!![]})[_0x1c8c('0x9')](function(_0xe68184){logger['info'](_0x1c8c('0x19'),_0x426b28);logger[_0x1c8c('0xb')](_0x1c8c('0x19'),_0x426b28,JSON[_0x1c8c('0xe')](_0xe68184));_0x286d72(_0xe68184);})['catch'](function(_0xc615e3){logger[_0x1c8c('0xf')](_0x1c8c('0x19'),_0xc615e3[_0x1c8c('0x12')],_0x426b28);_0xf204d3(_0x2686a3[_0x1c8c('0xf')](0x1f4,_0xc615e3[_0x1c8c('0x12')]));});});};exports[_0x1c8c('0x1a')]=function(_0x17186f){var _0x41f903=this;return new Promise(function(_0x491e0a,_0x35602e){return db[_0x1c8c('0x15')][_0x1c8c('0x1b')](_0x17186f[_0x1c8c('0x16')],{'raw':_0x17186f[_0x1c8c('0x17')]?_0x17186f[_0x1c8c('0x17')][_0x1c8c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17186f[_0x1c8c('0x17')]?_0x17186f[_0x1c8c('0x17')][_0x1c8c('0x1c')]||null:null,'attributes':_0x17186f[_0x1c8c('0x17')]?_0x17186f[_0x1c8c('0x17')][_0x1c8c('0x1d')]||null:null,'limit':_0x17186f[_0x1c8c('0x17')]?_0x17186f['options'][_0x1c8c('0x1e')]||null:null})[_0x1c8c('0x9')](function(_0x380ec4){logger[_0x1c8c('0xa')](_0x1c8c('0x1a'),_0x17186f);logger[_0x1c8c('0xb')](_0x1c8c('0x1a'),_0x17186f,JSON[_0x1c8c('0xe')](_0x380ec4));_0x491e0a(_0x380ec4);})[_0x1c8c('0x14')](function(_0x80bbf4){logger[_0x1c8c('0xf')]('UpdateVoiceDialReport',_0x80bbf4[_0x1c8c('0x12')],_0x17186f);_0x35602e(_0x41f903[_0x1c8c('0xf')](0x1f4,_0x80bbf4[_0x1c8c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 70efb65..b0429ef 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 _0xfb16=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','delete','destroy','exports','multer','util','path'];(function(_0x320a85,_0x34b2b8){var _0x1dbd84=function(_0x304bff){while(--_0x304bff){_0x320a85['push'](_0x320a85['shift']());}};_0x1dbd84(++_0x34b2b8);}(_0xfb16,0x89));var _0x6fb1=function(_0x1f81c8,_0x54ba3b){_0x1f81c8=_0x1f81c8-0x0;var _0x9a802b=_0xfb16[_0x1f81c8];return _0x9a802b;};'use strict';var multer=require(_0x6fb1('0x0'));var util=require(_0x6fb1('0x1'));var path=require(_0x6fb1('0x2'));var timeout=require(_0x6fb1('0x3'));var express=require(_0x6fb1('0x4'));var router=express[_0x6fb1('0x5')]();var fs_extra=require(_0x6fb1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6fb1('0x7'));var config=require('../../config/environment');var controller=require(_0x6fb1('0x8'));router[_0x6fb1('0x9')]('/',auth[_0x6fb1('0xa')](),controller[_0x6fb1('0xb')]);router[_0x6fb1('0x9')](_0x6fb1('0xc'),auth['isAuthenticated'](),controller[_0x6fb1('0xd')]);router[_0x6fb1('0xe')]('/',auth['isAuthenticated'](),controller[_0x6fb1('0xf')]);router[_0x6fb1('0xe')](_0x6fb1('0x10'),auth['isAuthenticated'](),controller['addApplications']);router['put'](_0x6fb1('0xc'),auth[_0x6fb1('0xa')](),controller['update']);router[_0x6fb1('0x11')](_0x6fb1('0xc'),auth[_0x6fb1('0xa')](),controller[_0x6fb1('0x12')]);module[_0x6fb1('0x13')]=router; \ No newline at end of file +var _0xa9b9=['./voiceExtension.controller','isAuthenticated','index','get','show','create','post','addApplications','put','update','/:id','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x367ae9,_0x1269f2){var _0x1da9ac=function(_0x284383){while(--_0x284383){_0x367ae9['push'](_0x367ae9['shift']());}};_0x1da9ac(++_0x1269f2);}(_0xa9b9,0x1b0));var _0x9a9b=function(_0x4924ae,_0x1dd735){_0x4924ae=_0x4924ae-0x0;var _0x2238e4=_0xa9b9[_0x4924ae];return _0x2238e4;};'use strict';var multer=require('multer');var util=require(_0x9a9b('0x0'));var path=require('path');var timeout=require(_0x9a9b('0x1'));var express=require(_0x9a9b('0x2'));var router=express[_0x9a9b('0x3')]();var fs_extra=require(_0x9a9b('0x4'));var auth=require(_0x9a9b('0x5'));var interaction=require(_0x9a9b('0x6'));var config=require(_0x9a9b('0x7'));var controller=require(_0x9a9b('0x8'));router['get']('/',auth[_0x9a9b('0x9')](),controller[_0x9a9b('0xa')]);router[_0x9a9b('0xb')]('/:id',auth[_0x9a9b('0x9')](),controller[_0x9a9b('0xc')]);router['post']('/',auth[_0x9a9b('0x9')](),controller[_0x9a9b('0xd')]);router[_0x9a9b('0xe')]('/:id/applications',auth[_0x9a9b('0x9')](),controller[_0x9a9b('0xf')]);router[_0x9a9b('0x10')]('/:id',auth[_0x9a9b('0x9')](),controller[_0x9a9b('0x11')]);router['delete'](_0x9a9b('0x12'),auth[_0x9a9b('0x9')](),controller['destroy']);module[_0x9a9b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 09dc54c..09ea73b 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 _0xb822=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound'];(function(_0x47fbdc,_0x55f2f1){var _0x1d9c58=function(_0x4db159){while(--_0x4db159){_0x47fbdc['push'](_0x47fbdc['shift']());}};_0x1d9c58(++_0x55f2f1);}(_0xb822,0xd1));var _0x2b82=function(_0x2f269d,_0x810602){_0x2f269d=_0x2f269d-0x0;var _0x414a7c=_0xb822[_0x2f269d];return _0x414a7c;};'use strict';var Sequelize=require(_0x2b82('0x0'));module[_0x2b82('0x1')]={'context':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![],'unique':_0x2b82('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b82('0x3')},'priority':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x2b82('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x2b82('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x2b82('0x4')](_0x2b82('0x5'),_0x2b82('0x6'),_0x2b82('0x7'),_0x2b82('0x8'),_0x2b82('0x9'),_0x2b82('0xa'),_0x2b82('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x2b82('0x2')]},'interval':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![],'defaultValue':_0x2b82('0xc')},'IntervalId':{'type':Sequelize[_0x2b82('0xd')]},'isApp':{'type':Sequelize[_0x2b82('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2b82('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x2b82('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x2b82('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2b82('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x2b82('0xf')},'answer':{'type':Sequelize[_0x2b82('0xe')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x36a505){return this[_0x2b82('0x10')](_0x2b82('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x6850=['BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any','INTEGER'];(function(_0x1cd3a7,_0x1389ae){var _0x567396=function(_0x3cab10){while(--_0x3cab10){_0x1cd3a7['push'](_0x1cd3a7['shift']());}};_0x567396(++_0x1389ae);}(_0x6850,0xa7));var _0x0685=function(_0x3e5187,_0x383efd){_0x3e5187=_0x3e5187-0x0;var _0x1705a3=_0x6850[_0x3e5187];return _0x1705a3;};'use strict';var Sequelize=require(_0x0685('0x0'));module[_0x0685('0x1')]={'context':{'type':Sequelize[_0x0685('0x2')],'allowNull':![],'unique':_0x0685('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0685('0x2')],'allowNull':![],'unique':_0x0685('0x3')},'priority':{'type':Sequelize[_0x0685('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x0685('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0685('0x2')],'allowNull':![],'defaultValue':_0x0685('0x4')},'appdata':{'type':Sequelize[_0x0685('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0685('0x5')](_0x0685('0x6'),'outbound',_0x0685('0x7'),_0x0685('0x8'),_0x0685('0x9'),_0x0685('0xa'),_0x0685('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0685('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x0685('0xc')]},'isApp':{'type':Sequelize[_0x0685('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x0685('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0685('0xe')},'answer':{'type':Sequelize[_0x0685('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0685('0xf')],'get':function(_0x818ecf){return this[_0x0685('0x10')](_0x0685('0x11'));}},'alias':{'type':Sequelize[_0x0685('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index d7eebde..a4e03e6 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 _0x6ac2=['catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','isApp','createRouting','priority','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','count','offset','limit','set','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','UserProfileResource','end','sendStatus','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','include','findAll','show','params','includeAll','find'];(function(_0x35c300,_0x284351){var _0x59e44b=function(_0x327e5c){while(--_0x327e5c){_0x35c300['push'](_0x35c300['shift']());}};_0x59e44b(++_0x284351);}(_0x6ac2,0xcc));var _0x26ac=function(_0x42e927,_0x5775c8){_0x42e927=_0x42e927-0x0;var _0x493bb6=_0x6ac2[_0x42e927];return _0x493bb6;};'use strict';var _=require(_0x26ac('0x0'));var Redis=require('ioredis');var qs=require(_0x26ac('0x1'));var logger=require(_0x26ac('0x2'))('api');var config=require(_0x26ac('0x3'));var db=require(_0x26ac('0x4'))['db'];config[_0x26ac('0x5')]=_[_0x26ac('0x6')](config[_0x26ac('0x5')],{'host':_0x26ac('0x7'),'port':0x18eb});var socket=require(_0x26ac('0x8'))(new Redis(config[_0x26ac('0x5')]));require(_0x26ac('0x9'))[_0x26ac('0xa')](socket);function respondWithStatusCode(_0x24629e,_0x341d45){_0x341d45=_0x341d45||0xcc;return function(_0x11cbc9){if(_0x11cbc9){return _0x24629e['sendStatus'](_0x341d45);}return _0x24629e[_0x26ac('0xb')](_0x341d45)['end']();};}function respondWithResult(_0x31600b,_0xc3ad47){_0xc3ad47=_0xc3ad47||0xc8;return function(_0x33727c){if(_0x33727c){return _0x31600b[_0x26ac('0xb')](_0xc3ad47)['json'](_0x33727c);}};}function respondWithFilteredResult(_0x3767c6,_0x133304){return function(_0x18e70e){if(_0x18e70e){var _0x96661e=typeof _0x133304['offset']==='undefined'&&typeof _0x133304['limit']==='undefined';var _0x49d89e=_0x18e70e[_0x26ac('0xc')];var _0x35f1c5=_0x96661e?0x0:_0x133304[_0x26ac('0xd')];var _0x3d29f3=_0x96661e?_0x18e70e[_0x26ac('0xc')]:_0x133304[_0x26ac('0xd')]+_0x133304[_0x26ac('0xe')];var _0x2d29ae;if(_0x3d29f3>=_0x49d89e){_0x3d29f3=_0x49d89e;_0x2d29ae=0xc8;}else{_0x2d29ae=0xce;}_0x3767c6[_0x26ac('0xb')](_0x2d29ae);return _0x3767c6[_0x26ac('0xf')]('Content-Range',_0x35f1c5+'-'+_0x3d29f3+'/'+_0x49d89e)['json'](_0x18e70e);}return null;};}function removeEntity(_0x2d515c){return function(_0x1d1ea6){if(_0x1d1ea6){return _0x1d1ea6[_0x26ac('0x10')]()[_0x26ac('0x11')](function(){var _0x8aaa1c=_0x1d1ea6[_0x26ac('0x12')]({'plain':!![]});var _0x53eb02=[{'name':_0x26ac('0x13'),'value':'inbound','ignore':![]},{'name':_0x26ac('0x14'),'value':_0x26ac('0x15'),'ignore':![]},{'name':_0x26ac('0x16'),'value':_0x26ac('0x17'),'ignore':![]}];var _0x29335f=_(_0x53eb02)[_0x26ac('0x18')]('ignore')[_0x26ac('0x19')]('value')[_0x26ac('0x1a')]();if(_[_0x26ac('0x1b')](_0x29335f,_0x8aaa1c[_0x26ac('0x1c')])){return;}var _0x29c559=_['find'](_0x53eb02,[_0x26ac('0x1a'),_0x8aaa1c['type']])['name'];return db[_0x26ac('0x1d')]['destroy']({'where':{'type':_0x29c559,'resourceId':_0x8aaa1c['id']}})[_0x26ac('0x11')](function(){return _0x1d1ea6;});})['then'](function(){_0x2d515c[_0x26ac('0xb')](0xcc)[_0x26ac('0x1e')]();});}};}function handleEntityNotFound(_0x15fd6a){return function(_0x2252b4){if(!_0x2252b4){_0x15fd6a[_0x26ac('0x1f')](0x194);}return _0x2252b4;};}function handleError(_0x5de665,_0x4d1de1){_0x4d1de1=_0x4d1de1||0x1f4;return function(_0x2a6c4a){logger[_0x26ac('0x20')](_0x2a6c4a[_0x26ac('0x21')]);if(_0x2a6c4a[_0x26ac('0x22')]){delete _0x2a6c4a[_0x26ac('0x22')];}_0x5de665[_0x26ac('0xb')](_0x4d1de1)[_0x26ac('0x23')](_0x2a6c4a);};}exports[_0x26ac('0x24')]=function(_0x53050,_0x47db96){var _0x407670={},_0x56f8c6={},_0x269fdd={'count':0x0,'rows':[]};var _0x114346=_['map'](db[_0x26ac('0x25')][_0x26ac('0x26')],function(_0x1f0696){return{'name':_0x1f0696[_0x26ac('0x27')],'type':_0x1f0696[_0x26ac('0x1c')][_0x26ac('0x28')]};});_0x56f8c6['model']=_[_0x26ac('0x19')](_0x114346,_0x26ac('0x22'));_0x56f8c6[_0x26ac('0x29')]=_[_0x26ac('0x2a')](_0x53050[_0x26ac('0x29')]);_0x56f8c6['filters']=_[_0x26ac('0x2b')](_0x56f8c6[_0x26ac('0x2c')],_0x56f8c6[_0x26ac('0x29')]);_0x407670[_0x26ac('0x2d')]=_[_0x26ac('0x2b')](_0x56f8c6['model'],qs[_0x26ac('0x2e')](_0x53050[_0x26ac('0x29')][_0x26ac('0x2e')]));_0x407670[_0x26ac('0x2d')]=_0x407670[_0x26ac('0x2d')][_0x26ac('0x2f')]?_0x407670['attributes']:_0x56f8c6['model'];if(!_0x53050[_0x26ac('0x29')][_0x26ac('0x30')](_0x26ac('0x31'))){_0x407670['limit']=qs[_0x26ac('0xe')](_0x53050[_0x26ac('0x29')][_0x26ac('0xe')]);_0x407670[_0x26ac('0xd')]=qs[_0x26ac('0xd')](_0x53050[_0x26ac('0x29')]['offset']);}_0x407670[_0x26ac('0x32')]=qs['sort'](_0x53050[_0x26ac('0x29')][_0x26ac('0x33')]);_0x407670[_0x26ac('0x34')]=qs[_0x26ac('0x35')](_[_0x26ac('0x36')](_0x53050[_0x26ac('0x29')],_0x56f8c6[_0x26ac('0x35')]),_0x114346);if(_0x53050[_0x26ac('0x29')][_0x26ac('0x18')]){_0x407670[_0x26ac('0x34')]=_['merge'](_0x407670[_0x26ac('0x34')],{'$or':_[_0x26ac('0x19')](_0x114346,function(_0x280707){if(_0x280707[_0x26ac('0x1c')]!==_0x26ac('0x37')){var _0x1e9e9c={};_0x1e9e9c[_0x280707[_0x26ac('0x22')]]={'$like':'%'+_0x53050[_0x26ac('0x29')][_0x26ac('0x18')]+'%'};return _0x1e9e9c;}})});}_0x407670=_[_0x26ac('0x38')]({},_0x407670,_0x53050['options']);var _0xb54cec={'where':_0x407670[_0x26ac('0x34')]};return db['VoiceExtension'][_0x26ac('0xc')](_0xb54cec)['then'](function(_0x439dbd){_0x269fdd[_0x26ac('0xc')]=_0x439dbd;if(_0x53050[_0x26ac('0x29')]['includeAll']){_0x407670[_0x26ac('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x26ac('0x3a')](_0x407670);})['then'](function(_0x31cb67){_0x269fdd['rows']=_0x31cb67;return _0x269fdd;})[_0x26ac('0x11')](respondWithFilteredResult(_0x47db96,_0x407670))['catch'](handleError(_0x47db96,null));};exports[_0x26ac('0x3b')]=function(_0x3eed7b,_0xc62b10){var _0x2e7af9={'raw':![],'where':{'id':_0x3eed7b[_0x26ac('0x3c')]['id']}},_0x4cd438={};_0x4cd438[_0x26ac('0x2c')]=_[_0x26ac('0x2a')](db[_0x26ac('0x25')][_0x26ac('0x26')]);_0x4cd438[_0x26ac('0x29')]=_[_0x26ac('0x2a')](_0x3eed7b['query']);_0x4cd438[_0x26ac('0x35')]=_['intersection'](_0x4cd438[_0x26ac('0x2c')],_0x4cd438[_0x26ac('0x29')]);_0x2e7af9['attributes']=_[_0x26ac('0x2b')](_0x4cd438[_0x26ac('0x2c')],qs[_0x26ac('0x2e')](_0x3eed7b[_0x26ac('0x29')][_0x26ac('0x2e')]));_0x2e7af9[_0x26ac('0x2d')]=_0x2e7af9[_0x26ac('0x2d')][_0x26ac('0x2f')]?_0x2e7af9[_0x26ac('0x2d')]:_0x4cd438[_0x26ac('0x2c')];if(_0x3eed7b[_0x26ac('0x29')][_0x26ac('0x3d')]){_0x2e7af9['include']=[{'all':!![]}];}_0x2e7af9=_[_0x26ac('0x38')]({},_0x2e7af9,_0x3eed7b['options']);return db[_0x26ac('0x25')][_0x26ac('0x3e')](_0x2e7af9)[_0x26ac('0x11')](handleEntityNotFound(_0xc62b10,null))[_0x26ac('0x11')](respondWithResult(_0xc62b10,null))[_0x26ac('0x3f')](handleError(_0xc62b10,null));};exports['destroy']=function(_0x49e321,_0x1c95e9){return db[_0x26ac('0x25')][_0x26ac('0x3e')]({'where':{'id':_0x49e321['params']['id']}})[_0x26ac('0x11')](handleEntityNotFound(_0x1c95e9,null))[_0x26ac('0x11')](removeEntity(_0x1c95e9,null))['catch'](handleError(_0x1c95e9,null));};exports[_0x26ac('0x40')]=function(_0x241659,_0xb3b8db){if(_0x241659[_0x26ac('0x41')]['type']==='outbound'&&!_[_0x26ac('0x42')](_0x241659[_0x26ac('0x41')][_0x26ac('0x43')],'_')){_0x241659[_0x26ac('0x41')][_0x26ac('0x43')]='_'[_0x26ac('0x44')](_0x241659[_0x26ac('0x41')][_0x26ac('0x43')]);}return db[_0x26ac('0x25')]['create'](_0x241659[_0x26ac('0x41')],{'raw':![]})[_0x26ac('0x11')](function(_0x39eb63){var _0x3e473a=_0x241659[_0x26ac('0x45')][_0x26ac('0x12')]({'plain':!![]});if(!_0x3e473a)throw new Error(_0x26ac('0x46'));if(_0x3e473a[_0x26ac('0x47')]===_0x26ac('0x45')){var _0xaeed7f=_0x39eb63[_0x26ac('0x12')]({'plain':!![]});var _0x3e5458=[{'name':_0x26ac('0x13'),'value':_0x26ac('0x48')},{'name':_0x26ac('0x14'),'value':_0x26ac('0x15')},{'name':'InternalRoutes','value':'internal'}];var _0x1f7968=_[_0x26ac('0x3e')](_0x3e5458,['value',_0xaeed7f[_0x26ac('0x1c')]])[_0x26ac('0x22')];return db['UserProfileSection'][_0x26ac('0x3e')]({'where':{'name':_0x1f7968,'userProfileId':_0x3e473a[_0x26ac('0x49')]},'raw':!![]})[_0x26ac('0x11')](function(_0x14d379){if(_0x14d379&&_0x14d379[_0x26ac('0x4a')]===0x0){return db[_0x26ac('0x1d')]['create']({'name':_0xaeed7f[_0x26ac('0x22')],'resourceId':_0xaeed7f['id'],'type':_0x14d379['name'],'sectionId':_0x14d379['id']},{})['then'](function(){return _0x39eb63;});}else{return _0x39eb63;}})['catch'](function(_0x469043){logger[_0x26ac('0x20')](_0x26ac('0x4b'),_0x469043);throw _0x469043;});}return _0x39eb63;})[_0x26ac('0x11')](respondWithResult(_0xb3b8db,0xc9))[_0x26ac('0x3f')](handleError(_0xb3b8db,null));};exports[_0x26ac('0x4c')]=function(_0x6bcd33,_0x443b9f){if(_0x6bcd33[_0x26ac('0x41')]['id']){delete _0x6bcd33[_0x26ac('0x41')]['id'];}return db['VoiceExtension'][_0x26ac('0x3e')]({'where':{'id':_0x6bcd33['params']['id']}})[_0x26ac('0x11')](handleEntityNotFound(_0x443b9f,null))[_0x26ac('0x11')](function(_0x130f51){if(_0x130f51){return db[_0x26ac('0x25')][_0x26ac('0x4c')](_[_0x26ac('0x36')](_0x6bcd33[_0x26ac('0x41')],[_0x26ac('0x43'),_0x26ac('0x4d'),'description','recordingFormat',_0x26ac('0x4e'),_0x26ac('0x4f'),_0x26ac('0x50')]),{'where':{'context':_0x130f51['context'],'exten':_0x130f51['exten']},'individualHooks':!![]})[_0x26ac('0x11')](function(_0x3468c7){return _0x3468c7;});}return null;})[_0x26ac('0x11')](respondWithStatusCode(_0x443b9f,null))[_0x26ac('0x3f')](handleError(_0x443b9f,null));};exports[_0x26ac('0x51')]=function(_0x3de75f,_0x30198f){var _0xa916bf=_0x3de75f[_0x26ac('0x3c')]['id'];var _0x14f4e4=_0x3de75f[_0x26ac('0x41')];var _0x4a8e79=0xc8;var _0x30c5f2=null;return db[_0x26ac('0x52')][_0x26ac('0x53')]({'isolationLevel':db['sequelize'][_0x26ac('0x54')][_0x26ac('0x55')]['READ_COMMITTED']},function(_0x18764a){return db[_0x26ac('0x25')]['findOne']({'where':{'id':_0xa916bf},'transaction':_0x18764a})[_0x26ac('0x11')](function(_0x5d92b4){if(_0x5d92b4){return db[_0x26ac('0x25')]['destroy']({'where':{'VoiceExtensionId':_0xa916bf},'transaction':_0x18764a})[_0x26ac('0x11')](function(){var _0x4c582a=_[_0x26ac('0x19')](_0x14f4e4,function(_0xf11bb2){_0xf11bb2['VoiceExtensionId']=_0xa916bf;_0xf11bb2[_0x26ac('0x56')]=!![];return _0xf11bb2;});return _0x5d92b4[_0x26ac('0x57')](_0x4c582a);})[_0x26ac('0x11')](function(_0x420544){return db[_0x26ac('0x25')]['bulkCreate'](_0x420544,{'transaction':_0x18764a});});}else{_0x4a8e79=0x194;_0x30c5f2=[];}});})[_0x26ac('0x11')](function(){if(_0x4a8e79!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xa916bf},'order':_0x26ac('0x58')})[_0x26ac('0x11')](function(_0x2ab36f){_0x30c5f2=_0x2ab36f;});}})['catch'](function(_0x30fc01){_0x4a8e79=0x1f4;logger[_0x26ac('0x20')](_0x30fc01[_0x26ac('0x21')]);if(_0x30fc01[_0x26ac('0x22')]){delete _0x30fc01[_0x26ac('0x22')];}_0x30c5f2=_0x30fc01;})['finally'](function(){if(_0x30c5f2===null){_0x30198f[_0x26ac('0x1f')](_0x4a8e79);}else{if(_0x4a8e79===0x1f4){_0x30198f[_0x26ac('0xb')](_0x4a8e79)[_0x26ac('0x23')](_0x30c5f2);}else{_0x30198f[_0x26ac('0xb')](_0x4a8e79)['json'](_0x30c5f2);}}});}; \ No newline at end of file +var _0x341a=['end','json','offset','undefined','limit','count','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','value','includes','type','name','sendStatus','error','stack','send','index','map','VoiceExtension','rawAttributes','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','alias','context','sequelize','Transaction','ISOLATION_LEVELS','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status'];(function(_0x367174,_0x52fc07){var _0x589341=function(_0x300bff){while(--_0x300bff){_0x367174['push'](_0x367174['shift']());}};_0x589341(++_0x52fc07);}(_0x341a,0xf9));var _0xa341=function(_0x111bb4,_0x34eef2){_0x111bb4=_0x111bb4-0x0;var _0xa0c8e1=_0x341a[_0x111bb4];return _0xa0c8e1;};'use strict';var _=require(_0xa341('0x0'));var Redis=require(_0xa341('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa341('0x2'))('api');var config=require(_0xa341('0x3'));var db=require(_0xa341('0x4'))['db'];config[_0xa341('0x5')]=_[_0xa341('0x6')](config[_0xa341('0x5')],{'host':_0xa341('0x7'),'port':0x18eb});var socket=require(_0xa341('0x8'))(new Redis(config['redis']));require(_0xa341('0x9'))[_0xa341('0xa')](socket);function respondWithStatusCode(_0xf17208,_0x5b56bc){_0x5b56bc=_0x5b56bc||0xcc;return function(_0xd127e9){if(_0xd127e9){return _0xf17208['sendStatus'](_0x5b56bc);}return _0xf17208[_0xa341('0xb')](_0x5b56bc)[_0xa341('0xc')]();};}function respondWithResult(_0x589690,_0x49dee5){_0x49dee5=_0x49dee5||0xc8;return function(_0x2dde85){if(_0x2dde85){return _0x589690[_0xa341('0xb')](_0x49dee5)[_0xa341('0xd')](_0x2dde85);}};}function respondWithFilteredResult(_0x245776,_0xe4eb14){return function(_0x484543){if(_0x484543){var _0x58323e=typeof _0xe4eb14[_0xa341('0xe')]===_0xa341('0xf')&&typeof _0xe4eb14[_0xa341('0x10')]===_0xa341('0xf');var _0x19a516=_0x484543[_0xa341('0x11')];var _0x16b22c=_0x58323e?0x0:_0xe4eb14[_0xa341('0xe')];var _0x4c66a1=_0x58323e?_0x484543[_0xa341('0x11')]:_0xe4eb14[_0xa341('0xe')]+_0xe4eb14['limit'];var _0x4facc3;if(_0x4c66a1>=_0x19a516){_0x4c66a1=_0x19a516;_0x4facc3=0xc8;}else{_0x4facc3=0xce;}_0x245776[_0xa341('0xb')](_0x4facc3);return _0x245776['set'](_0xa341('0x12'),_0x16b22c+'-'+_0x4c66a1+'/'+_0x19a516)[_0xa341('0xd')](_0x484543);}return null;};}function removeEntity(_0x38f021){return function(_0x2d2e4e){if(_0x2d2e4e){return _0x2d2e4e[_0xa341('0x13')]()[_0xa341('0x14')](function(){var _0x580f31=_0x2d2e4e['get']({'plain':!![]});var _0x23d69c=[{'name':_0xa341('0x15'),'value':_0xa341('0x16'),'ignore':![]},{'name':_0xa341('0x17'),'value':_0xa341('0x18'),'ignore':![]},{'name':'InternalRoutes','value':_0xa341('0x19'),'ignore':![]}];var _0x1b14f1=_(_0x23d69c)[_0xa341('0x1a')]('ignore')['map'](_0xa341('0x1b'))['value']();if(_[_0xa341('0x1c')](_0x1b14f1,_0x580f31[_0xa341('0x1d')])){return;}var _0x2932c8=_['find'](_0x23d69c,[_0xa341('0x1b'),_0x580f31[_0xa341('0x1d')]])[_0xa341('0x1e')];return db['UserProfileResource'][_0xa341('0x13')]({'where':{'type':_0x2932c8,'resourceId':_0x580f31['id']}})[_0xa341('0x14')](function(){return _0x2d2e4e;});})[_0xa341('0x14')](function(){_0x38f021['status'](0xcc)[_0xa341('0xc')]();});}};}function handleEntityNotFound(_0x217e99){return function(_0x504316){if(!_0x504316){_0x217e99[_0xa341('0x1f')](0x194);}return _0x504316;};}function handleError(_0x583c75,_0x58f975){_0x58f975=_0x58f975||0x1f4;return function(_0x1119e1){logger[_0xa341('0x20')](_0x1119e1[_0xa341('0x21')]);if(_0x1119e1[_0xa341('0x1e')]){delete _0x1119e1[_0xa341('0x1e')];}_0x583c75[_0xa341('0xb')](_0x58f975)[_0xa341('0x22')](_0x1119e1);};}exports[_0xa341('0x23')]=function(_0x41ad08,_0x2e7b16){var _0x5030a0={},_0x156f76={},_0x4238c5={'count':0x0,'rows':[]};var _0x88bbf1=_[_0xa341('0x24')](db[_0xa341('0x25')][_0xa341('0x26')],function(_0x2cef2f){return{'name':_0x2cef2f['fieldName'],'type':_0x2cef2f[_0xa341('0x1d')][_0xa341('0x27')]};});_0x156f76[_0xa341('0x28')]=_[_0xa341('0x24')](_0x88bbf1,_0xa341('0x1e'));_0x156f76['query']=_['keys'](_0x41ad08['query']);_0x156f76[_0xa341('0x29')]=_[_0xa341('0x2a')](_0x156f76[_0xa341('0x28')],_0x156f76[_0xa341('0x2b')]);_0x5030a0[_0xa341('0x2c')]=_[_0xa341('0x2a')](_0x156f76[_0xa341('0x28')],qs[_0xa341('0x2d')](_0x41ad08[_0xa341('0x2b')][_0xa341('0x2d')]));_0x5030a0['attributes']=_0x5030a0[_0xa341('0x2c')][_0xa341('0x2e')]?_0x5030a0['attributes']:_0x156f76[_0xa341('0x28')];if(!_0x41ad08[_0xa341('0x2b')][_0xa341('0x2f')](_0xa341('0x30'))){_0x5030a0['limit']=qs[_0xa341('0x10')](_0x41ad08[_0xa341('0x2b')]['limit']);_0x5030a0[_0xa341('0xe')]=qs[_0xa341('0xe')](_0x41ad08['query'][_0xa341('0xe')]);}_0x5030a0[_0xa341('0x31')]=qs['sort'](_0x41ad08[_0xa341('0x2b')][_0xa341('0x32')]);_0x5030a0[_0xa341('0x33')]=qs['filters'](_['pick'](_0x41ad08[_0xa341('0x2b')],_0x156f76[_0xa341('0x29')]),_0x88bbf1);if(_0x41ad08[_0xa341('0x2b')][_0xa341('0x1a')]){_0x5030a0[_0xa341('0x33')]=_[_0xa341('0x34')](_0x5030a0[_0xa341('0x33')],{'$or':_['map'](_0x88bbf1,function(_0x146c98){if(_0x146c98[_0xa341('0x1d')]!=='VIRTUAL'){var _0x9313b7={};_0x9313b7[_0x146c98['name']]={'$like':'%'+_0x41ad08[_0xa341('0x2b')][_0xa341('0x1a')]+'%'};return _0x9313b7;}})});}_0x5030a0=_[_0xa341('0x34')]({},_0x5030a0,_0x41ad08[_0xa341('0x35')]);var _0x3fb35a={'where':_0x5030a0['where']};return db[_0xa341('0x25')]['count'](_0x3fb35a)['then'](function(_0x3c46e5){_0x4238c5[_0xa341('0x11')]=_0x3c46e5;if(_0x41ad08['query'][_0xa341('0x36')]){_0x5030a0[_0xa341('0x37')]=[{'all':!![]}];}return db[_0xa341('0x25')][_0xa341('0x38')](_0x5030a0);})[_0xa341('0x14')](function(_0x1f38ff){_0x4238c5[_0xa341('0x39')]=_0x1f38ff;return _0x4238c5;})[_0xa341('0x14')](respondWithFilteredResult(_0x2e7b16,_0x5030a0))['catch'](handleError(_0x2e7b16,null));};exports['show']=function(_0x5d936f,_0x56bc51){var _0x1e1ced={'raw':![],'where':{'id':_0x5d936f[_0xa341('0x3a')]['id']}},_0xb40561={};_0xb40561['model']=_[_0xa341('0x3b')](db[_0xa341('0x25')][_0xa341('0x26')]);_0xb40561[_0xa341('0x2b')]=_[_0xa341('0x3b')](_0x5d936f[_0xa341('0x2b')]);_0xb40561['filters']=_[_0xa341('0x2a')](_0xb40561['model'],_0xb40561[_0xa341('0x2b')]);_0x1e1ced['attributes']=_['intersection'](_0xb40561[_0xa341('0x28')],qs[_0xa341('0x2d')](_0x5d936f['query'][_0xa341('0x2d')]));_0x1e1ced['attributes']=_0x1e1ced[_0xa341('0x2c')]['length']?_0x1e1ced['attributes']:_0xb40561[_0xa341('0x28')];if(_0x5d936f[_0xa341('0x2b')][_0xa341('0x36')]){_0x1e1ced[_0xa341('0x37')]=[{'all':!![]}];}_0x1e1ced=_[_0xa341('0x34')]({},_0x1e1ced,_0x5d936f['options']);return db[_0xa341('0x25')]['find'](_0x1e1ced)['then'](handleEntityNotFound(_0x56bc51,null))[_0xa341('0x14')](respondWithResult(_0x56bc51,null))['catch'](handleError(_0x56bc51,null));};exports[_0xa341('0x13')]=function(_0x1f7f92,_0x24ea88){return db[_0xa341('0x25')][_0xa341('0x3c')]({'where':{'id':_0x1f7f92['params']['id']}})['then'](handleEntityNotFound(_0x24ea88,null))['then'](removeEntity(_0x24ea88,null))[_0xa341('0x3d')](handleError(_0x24ea88,null));};exports[_0xa341('0x3e')]=function(_0xd68610,_0x565812){if(_0xd68610[_0xa341('0x3f')][_0xa341('0x1d')]===_0xa341('0x18')&&!_[_0xa341('0x40')](_0xd68610[_0xa341('0x3f')][_0xa341('0x41')],'_')){_0xd68610[_0xa341('0x3f')]['exten']='_'[_0xa341('0x42')](_0xd68610[_0xa341('0x3f')]['exten']);}return db[_0xa341('0x25')][_0xa341('0x3e')](_0xd68610[_0xa341('0x3f')],{'raw':![]})[_0xa341('0x14')](function(_0x3b3169){var _0x2e59dc=_0xd68610[_0xa341('0x43')][_0xa341('0x44')]({'plain':!![]});if(!_0x2e59dc)throw new Error(_0xa341('0x45'));if(_0x2e59dc[_0xa341('0x46')]==='user'){var _0x4ecfd2=_0x3b3169[_0xa341('0x44')]({'plain':!![]});var _0x126f83=[{'name':_0xa341('0x15'),'value':_0xa341('0x16')},{'name':_0xa341('0x17'),'value':'outbound'},{'name':_0xa341('0x47'),'value':_0xa341('0x19')}];var _0x4f2e3d=_[_0xa341('0x3c')](_0x126f83,['value',_0x4ecfd2[_0xa341('0x1d')]])[_0xa341('0x1e')];return db['UserProfileSection']['find']({'where':{'name':_0x4f2e3d,'userProfileId':_0x2e59dc[_0xa341('0x48')]},'raw':!![]})[_0xa341('0x14')](function(_0x51af7d){if(_0x51af7d&&_0x51af7d['autoAssociation']===0x0){return db[_0xa341('0x49')][_0xa341('0x3e')]({'name':_0x4ecfd2[_0xa341('0x1e')],'resourceId':_0x4ecfd2['id'],'type':_0x51af7d[_0xa341('0x1e')],'sectionId':_0x51af7d['id']},{})[_0xa341('0x14')](function(){return _0x3b3169;});}else{return _0x3b3169;}})[_0xa341('0x3d')](function(_0xabd01b){logger[_0xa341('0x20')](_0xa341('0x4a'),_0xabd01b);throw _0xabd01b;});}return _0x3b3169;})[_0xa341('0x14')](respondWithResult(_0x565812,0xc9))[_0xa341('0x3d')](handleError(_0x565812,null));};exports[_0xa341('0x4b')]=function(_0x17e59e,_0x48b0d8){if(_0x17e59e[_0xa341('0x3f')]['id']){delete _0x17e59e['body']['id'];}return db[_0xa341('0x25')][_0xa341('0x3c')]({'where':{'id':_0x17e59e[_0xa341('0x3a')]['id']}})['then'](handleEntityNotFound(_0x48b0d8,null))[_0xa341('0x14')](function(_0x420a10){if(_0x420a10){return db[_0xa341('0x25')]['update'](_['pick'](_0x17e59e[_0xa341('0x3f')],[_0xa341('0x41'),'context','description',_0xa341('0x4c'),_0xa341('0x4d'),'mandatoryDisposition',_0xa341('0x4e')]),{'where':{'context':_0x420a10[_0xa341('0x4f')],'exten':_0x420a10['exten']},'individualHooks':!![]})[_0xa341('0x14')](function(_0x15ecff){return _0x15ecff;});}return null;})[_0xa341('0x14')](respondWithStatusCode(_0x48b0d8,null))['catch'](handleError(_0x48b0d8,null));};exports['addApplications']=function(_0x1a0442,_0x16c13e){var _0xa0ec35=_0x1a0442[_0xa341('0x3a')]['id'];var _0x27689b=_0x1a0442[_0xa341('0x3f')];var _0x1dfc86=0xc8;var _0x340693=null;return db[_0xa341('0x50')]['transaction']({'isolationLevel':db['sequelize'][_0xa341('0x51')][_0xa341('0x52')]['READ_COMMITTED']},function(_0x5c3ebb){return db[_0xa341('0x25')]['findOne']({'where':{'id':_0xa0ec35},'transaction':_0x5c3ebb})[_0xa341('0x14')](function(_0x3bde78){if(_0x3bde78){return db[_0xa341('0x25')][_0xa341('0x13')]({'where':{'VoiceExtensionId':_0xa0ec35},'transaction':_0x5c3ebb})[_0xa341('0x14')](function(){var _0x2d69ac=_[_0xa341('0x24')](_0x27689b,function(_0x52ba4e){_0x52ba4e['VoiceExtensionId']=_0xa0ec35;_0x52ba4e['isApp']=!![];return _0x52ba4e;});return _0x3bde78[_0xa341('0x53')](_0x2d69ac);})[_0xa341('0x14')](function(_0x52f8f7){return db['VoiceExtension'][_0xa341('0x54')](_0x52f8f7,{'transaction':_0x5c3ebb});});}else{_0x1dfc86=0x194;_0x340693=[];}});})['then'](function(){if(_0x1dfc86!==0x194){return db[_0xa341('0x25')][_0xa341('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0xa0ec35},'order':_0xa341('0x56')})[_0xa341('0x14')](function(_0x5754b4){_0x340693=_0x5754b4;});}})[_0xa341('0x3d')](function(_0x290f30){_0x1dfc86=0x1f4;logger['error'](_0x290f30[_0xa341('0x21')]);if(_0x290f30[_0xa341('0x1e')]){delete _0x290f30[_0xa341('0x1e')];}_0x340693=_0x290f30;})['finally'](function(){if(_0x340693===null){_0x16c13e['sendStatus'](_0x1dfc86);}else{if(_0x1dfc86===0x1f4){_0x16c13e[_0xa341('0xb')](_0x1dfc86)[_0xa341('0x22')](_0x340693);}else{_0x16c13e[_0xa341('0xb')](_0x1dfc86)['json'](_0x340693);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 91f2f8a..6f7c435 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 _0xc41a=['update','remove','emit','hasOwnProperty','exports','events','save'];(function(_0x585d67,_0x30d9a3){var _0x420fb8=function(_0x4a41db){while(--_0x4a41db){_0x585d67['push'](_0x585d67['shift']());}};_0x420fb8(++_0x30d9a3);}(_0xc41a,0x124));var _0xac41=function(_0x2e38ff,_0x4dd63c){_0x2e38ff=_0x2e38ff-0x0;var _0xffcd0d=_0xc41a[_0x2e38ff];return _0xffcd0d;};'use strict';var EventEmitter=require(_0xac41('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac41('0x1'),'afterUpdate':_0xac41('0x2'),'afterDestroy':_0xac41('0x3')};function emitEvent(_0x2f0ac8){return function(_0xaa0ab,_0x2e976b,_0x3d59fb){VoiceExtensionEvents['emit'](_0x2f0ac8+':'+_0xaa0ab['id'],_0xaa0ab);VoiceExtensionEvents[_0xac41('0x4')](_0x2f0ac8,_0xaa0ab);_0x3d59fb(null);};}for(var e in events){if(events[_0xac41('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xac41('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x013b=['../../mysqldb','VoiceExtension','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0xf12de5,_0x24c5ea){var _0xba69a2=function(_0x4d2c86){while(--_0x4d2c86){_0xf12de5['push'](_0xf12de5['shift']());}};_0xba69a2(++_0x24c5ea);}(_0x013b,0xb6));var _0xb013=function(_0x4fa1b0,_0x3cafac){_0x4fa1b0=_0x4fa1b0-0x0;var _0x3c2e33=_0x013b[_0x4fa1b0];return _0x3c2e33;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xb013('0x0'))['db'][_0xb013('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb013('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb013('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e72f2){return function(_0x20f14f,_0x336459,_0x49c5b2){VoiceExtensionEvents[_0xb013('0x4')](_0x5e72f2+':'+_0x20f14f['id'],_0x20f14f);VoiceExtensionEvents[_0xb013('0x4')](_0x5e72f2,_0x20f14f);_0x49c5b2(null);};}for(var e in events){if(events[_0xb013('0x5')](e)){var event=events[e];VoiceExtension[_0xb013('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a61c05e..77015a4 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 _0x21ec=['CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','split','length','name','param','phone','prefix','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','catch','define','voice_extensions','get','concat','Hangup','exports','Set','type','context','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound'];(function(_0x57c615,_0x404393){var _0x18f4e6=function(_0x2b181f){while(--_0x2b181f){_0x57c615['push'](_0x57c615['shift']());}};_0x18f4e6(++_0x404393);}(_0x21ec,0xf1));var _0xc21e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x21ec[_0xf71120];return _0xbe2fd3;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0xc21e('0x0')]=function(_0x1fc5e1){var _0x5d80b5=_0x1fc5e1['models'];function _0xd07969(_0x3ab156){var _0x4da759=0x2;var _0x2496b2=[{'type':_0x3ab156['type'],'app':_0xc21e('0x1'),'appdata':'CDR(type)='+_0x3ab156[_0xc21e('0x2')],'context':_0x3ab156[_0xc21e('0x3')],'exten':_0x3ab156['exten'],'priority':_0x4da759++,'VoiceExtensionId':_0x3ab156['id']},{'type':_0x3ab156['type'],'app':_0x3ab156['alias']?'Set':_0xc21e('0x4'),'appdata':_0x3ab156[_0xc21e('0x5')]?_0xc21e('0x6')+_0x3ab156['alias']:_0xc21e('0x7'),'context':_0x3ab156[_0xc21e('0x3')],'exten':_0x3ab156[_0xc21e('0x8')],'priority':_0x4da759++,'VoiceExtensionId':_0x3ab156['id']}];if(_0x3ab156[_0xc21e('0x2')]===_0xc21e('0x9')){_0x2496b2[_0xc21e('0xa')]({'type':_0xc21e('0x9'),'app':'Set','appdata':_0xc21e('0xb')+_0x3ab156['id'],'context':_0x3ab156[_0xc21e('0x3')],'exten':_0x3ab156[_0xc21e('0x8')],'priority':_0x4da759++,'VoiceExtensionId':_0x3ab156['id']});}_0x2496b2['push']({'type':_0x3ab156[_0xc21e('0x2')],'app':'Set','appdata':_0xc21e('0xc'),'context':_0x3ab156[_0xc21e('0x3')],'exten':_0x3ab156[_0xc21e('0x8')],'priority':_0x4da759++,'VoiceExtensionId':_0x3ab156['id']},{'type':_0x3ab156[_0xc21e('0x2')],'app':'Set','appdata':_0xc21e('0xd'),'context':_0x3ab156[_0xc21e('0x3')],'exten':_0x3ab156[_0xc21e('0x8')],'priority':_0x4da759++,'VoiceExtensionId':_0x3ab156['id']},{'type':_0x3ab156[_0xc21e('0x2')],'app':_0xc21e('0x1'),'appdata':_0xc21e('0xe'),'context':_0x3ab156['context'],'exten':_0x3ab156[_0xc21e('0x8')],'priority':_0x4da759++,'VoiceExtensionId':_0x3ab156['id']});return _0x2496b2;}function _0x56de56(_0x433eee){var _0x26688e=0x2;var _0x333462=[{'type':_0xc21e('0xf'),'app':_0xc21e('0x1'),'appdata':_0xc21e('0x10'),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':_0x433eee[_0xc21e('0x5')]?_0xc21e('0x1'):_0xc21e('0x4'),'appdata':_0x433eee['alias']?_0xc21e('0x6')+_0x433eee['alias']:_0xc21e('0x7'),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':'outbound','app':_0xc21e('0x1'),'appdata':_0xc21e('0x11')+(_0x433eee[_0xc21e('0x12')]?_0xc21e('0x13')+_0x433eee[_0xc21e('0x12')]+'}':_0xc21e('0x14')),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee['exten'],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':_0xc21e('0x1'),'appdata':_0xc21e('0xb')+_0x433eee['id'],'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':_0xc21e('0x15'),'appdata':_0xc21e('0x16')+(_0x26688e+0x2)+_0xc21e('0x17')+(_0x26688e+0x1)+')','context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':'Set','appdata':_0x433eee[_0xc21e('0x12')]?_0xc21e('0x18')+_0x433eee[_0xc21e('0x12')]+'}':_0xc21e('0x19'),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':'Set','appdata':_0xc21e('0xc'),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee['exten'],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':_0xc21e('0x1'),'appdata':_0xc21e('0xd'),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':_0xc21e('0x1'),'appdata':_0xc21e('0xe'),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':_0xc21e('0xf'),'app':_0xc21e('0x1'),'appdata':_0xc21e('0x1a')+_0x433eee['id'],'context':_0x433eee['context'],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']}];if(_0x433eee[_0xc21e('0x1b')](_0xc21e('0x1c'))&&_0x433eee[_0xc21e('0x1c')]!=='none'){_0x333462[_0xc21e('0xa')]({'type':_0xc21e('0xf'),'app':_0xc21e('0x1'),'appdata':_0xc21e('0x1d'),'context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee['exten'],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']},{'type':'outbound','app':'Set','appdata':_0xc21e('0x1e')+_0x433eee['recordingFormat']||'wav','context':_0x433eee[_0xc21e('0x3')],'exten':_0x433eee[_0xc21e('0x8')],'priority':_0x26688e++,'VoiceExtensionId':_0x433eee['id']});}return _0x333462;}function _0x1022c2(_0x3d6554,_0x1911f4){var _0x430a8b=[{'name':_0xc21e('0x1f'),'param':0x0},{'name':_0xc21e('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0xc21e('0x21'),'param':0x3}];var _0x43af2a={};var _0x55688f=_0x1911f4[_0xc21e('0x22')](',');var _0x593d08=[];for(var _0x4e7b96=0x0;_0x4e7b96<_0x430a8b[_0xc21e('0x23')];_0x4e7b96++){switch(_0x430a8b[_0x4e7b96][_0xc21e('0x24')]){case _0xc21e('0x1f'):_0x43af2a[_0xc21e('0x1f')]=_0x55688f[_0x430a8b[_0x4e7b96][_0xc21e('0x25')]][_0xc21e('0x22')]('/')[0x1];_0x43af2a[_0xc21e('0x26')]=_0x55688f[_0x430a8b[_0x4e7b96]['param']][_0xc21e('0x22')]('/')[0x2];_0x43af2a[_0xc21e('0x27')]=_0x43af2a[_0xc21e('0x26')]?_0x43af2a['phone'][_0xc21e('0x22')]('$')[0x0]:undefined;_0x43af2a[_0xc21e('0x26')]=_0x3d6554[_0xc21e('0x12')]?(_0x43af2a[_0xc21e('0x27')]||'')+_0xc21e('0x13')+_0x3d6554['cutdigits']+'}':(_0x43af2a[_0xc21e('0x27')]||'')+_0xc21e('0x14');_0x593d08[_0x430a8b[_0x4e7b96][_0xc21e('0x25')]]=[_0xc21e('0x28'),_0x43af2a[_0xc21e('0x1f')],_0x43af2a[_0xc21e('0x26')]][_0xc21e('0x29')]('/');break;case'options':_0x43af2a[_0xc21e('0x2a')]=_0x55688f[_0x430a8b[_0x4e7b96][_0xc21e('0x25')]];if(_0x3d6554['recordingFormat']!==_0xc21e('0x2b')){if(_0x43af2a['options'][_0xc21e('0x2c')](_0xc21e('0x2d'))<0x0){_0x43af2a[_0xc21e('0x2a')]+=_0xc21e('0x2d');}}else{_0x43af2a[_0xc21e('0x2a')]=_0x43af2a[_0xc21e('0x2a')][_0xc21e('0x2e')](_0xc21e('0x2d'),'');}_0x593d08[_0x430a8b[_0x4e7b96][_0xc21e('0x25')]]=_0x43af2a[_0xc21e('0x2a')];break;default:_0x593d08[_0x430a8b[_0x4e7b96]['param']]=_0x55688f[_0x430a8b[_0x4e7b96][_0xc21e('0x25')]];}}return _0x593d08[_0xc21e('0x29')](',');}function _0x45cfc1(_0x842794,_0x1f54e4,_0x136987){return new Promise(function(_0xf92609,_0x157ebb){var _0xd53d31=[];if(_[_0xc21e('0x2f')](_0x1f54e4))return _0xf92609(_0xd53d31);_0x5d80b5['Interval'][_0xc21e('0x30')]({'attributes':['id',_0xc21e('0x31'),_0xc21e('0x32')],'raw':!![]})[_0xc21e('0x33')](function(_0x12ff98){for(var _0x20dc27=0x0,_0x97bae=0x0;_0x20dc27<_0x1f54e4['length'];_0x20dc27++,_0x97bae=0x0){var _0x4bc190=_0x1f54e4[_0x20dc27];var _0x31187f=[];var _0x2a2146=[];delete _0x4bc190['id'];if(_0x4bc190[_0xc21e('0x31')]!==_0xc21e('0x34')){_0x4bc190[_0xc21e('0x35')]=[_0x4bc190[_0xc21e('0x31')]];}else{_0x4bc190['intervals']=_0x4bc190['IntervalId']?_[_0xc21e('0x36')](_[_0xc21e('0x37')](_0x12ff98,{'IntervalId':_0x4bc190[_0xc21e('0x32')]}),_0xc21e('0x31')):[];}_0x4bc190['context']=_0x842794[_0xc21e('0x3')];_0x4bc190[_0xc21e('0x8')]=_0x842794['exten'];if(_0x4bc190['type'])_0x4bc190['type']=_0x4bc190['type'][_0xc21e('0x38')]();if(_0x842794[_0xc21e('0x2')]===_0xc21e('0xf')){if(_0x4bc190['hasOwnProperty'](_0xc21e('0x39'))&&_0x4bc190[_0xc21e('0x39')]&&_0x4bc190[_0xc21e('0x39')]!=='--'){_0x31187f['push']({'type':_0x4bc190[_0xc21e('0x2')][_0xc21e('0x38')](),'app':'Set','appdata':_0xc21e('0x3a')+_0x4bc190[_0xc21e('0x39')],'context':_0x842794[_0xc21e('0x3')],'exten':_0x842794[_0xc21e('0x8')],'priority':_0x4bc190[_0xc21e('0x35')][_0xc21e('0x23')]+_0x136987+_0x97bae++,'VoiceExtensionId':_0x842794['id']});}_0x31187f[_0xc21e('0xa')]({'type':_0x4bc190[_0xc21e('0x2')][_0xc21e('0x38')](),'app':_0xc21e('0x15'),'appdata':_0xc21e('0x3b')+(_0x4bc190[_0xc21e('0x3c')]?_0xc21e('0x3d')+_0x4bc190['callerID']+')':_0xc21e('0x3e')),'context':_0x842794['context'],'exten':_0x842794[_0xc21e('0x8')],'priority':_0x4bc190[_0xc21e('0x35')][_0xc21e('0x23')]+_0x136987+_0x97bae++,'VoiceExtensionId':_0x842794['id']});}else{if(_0x4bc190['hasOwnProperty']('answer')){if([_0xc21e('0x3f'),_0xc21e('0x40')][_0xc21e('0x41')](_0x4bc190[_0xc21e('0x42')][_0xc21e('0x38')]())&&_0x4bc190[_0xc21e('0x43')]!==_0xc21e('0x44')){if(_0x4bc190[_0xc21e('0x45')]){_0x31187f[_0xc21e('0xa')]({'type':_0x4bc190['type'][_0xc21e('0x38')](),'app':_0xc21e('0x15'),'appdata':_0xc21e('0x46'),'context':_0x842794[_0xc21e('0x3')],'exten':_0x842794['exten'],'priority':_0x4bc190['intervals'][_0xc21e('0x23')]+_0x136987+_0x97bae++,'VoiceExtensionId':_0x842794['id']});_0x31187f[_0xc21e('0xa')]({'type':_0x4bc190['type']['toLowerCase'](),'app':_0xc21e('0x1'),'appdata':_0xc21e('0x47'),'context':_0x842794['context'],'exten':_0x842794[_0xc21e('0x8')],'priority':_0x4bc190['intervals'][_0xc21e('0x23')]+_0x136987+_0x97bae++,'VoiceExtensionId':_0x842794['id']});}else{_0x31187f[_0xc21e('0xa')]({'type':_0x4bc190[_0xc21e('0x2')]['toLowerCase'](),'app':_0xc21e('0x15'),'appdata':_0xc21e('0x48'),'context':_0x842794[_0xc21e('0x3')],'exten':_0x842794[_0xc21e('0x8')],'priority':_0x4bc190[_0xc21e('0x35')][_0xc21e('0x23')]+_0x136987+_0x97bae++,'VoiceExtensionId':_0x842794['id']});_0x31187f[_0xc21e('0xa')]({'type':_0x4bc190['type'][_0xc21e('0x38')](),'app':'Set','appdata':_0xc21e('0x49'),'context':_0x842794[_0xc21e('0x3')],'exten':_0x842794['exten'],'priority':_0x4bc190['intervals']['length']+_0x136987+_0x97bae++,'VoiceExtensionId':_0x842794['id']});}}}}for(var _0x1d8481=0x0;_0x1d8481<_0x4bc190[_0xc21e('0x35')][_0xc21e('0x23')];_0x1d8481++){var _0x4917ea=_0x136987+_0x4bc190['intervals'][_0xc21e('0x23')];var _0x113c1e=_0x1d8481===_0x4bc190['intervals']['length']-0x1?_0x136987+_0x31187f[_0xc21e('0x23')]+_0x2a2146[_0xc21e('0x23')]+0x2:_0x136987+_0x1d8481+0x1;_0x31187f[_0xc21e('0x4a')](_0x1d8481,0x0,{'type':_0x842794['type'],'app':_0xc21e('0x4b'),'appdata':_0x4bc190[_0xc21e('0x35')][_0x1d8481]+'?'+_0x842794[_0xc21e('0x3')]+',${EXTEN},'+_0x4917ea+':'+_0x842794[_0xc21e('0x3')]+_0xc21e('0x4c')+_0x113c1e,'exten':_0x842794[_0xc21e('0x8')],'context':_0x842794[_0xc21e('0x3')],'priority':_0x136987+_0x1d8481,'VoiceExtensionId':_0x842794['id']});}if(_0x4bc190[_0xc21e('0x43')]==='outboundDial')_0x4bc190[_0xc21e('0x4d')]=_0x1022c2(_0x842794,_0x4bc190[_0xc21e('0x4d')]);_0x4bc190[_0xc21e('0x4e')]=_0x31187f['length']?_[_0xc21e('0x4f')](_0x31187f)['priority']+0x1:_0x136987;_0xd53d31=_['concat'](_0xd53d31,_0x31187f,[_0x4bc190],_0x2a2146);_0x136987=_['last'](_0xd53d31)['priority']+0x1;}return _0xf92609(_0xd53d31);})[_0xc21e('0x50')](function(_0x216650){_0x157ebb(_0x216650);});});}return _0x1fc5e1[_0xc21e('0x51')]('VoiceExtension',attributes,{'tableName':_0xc21e('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xdaafb2){var _0x2a80ae=this[_0xc21e('0x53')]({'plain':!![]});var _0x3a0dff=_0x2a80ae[_0xc21e('0x2')]===_0xc21e('0xf')?_0x56de56(_0x2a80ae):_0xd07969(_0x2a80ae);return _0x45cfc1(_0x2a80ae,_0xdaafb2,_['last'](_0x3a0dff)[_0xc21e('0x4e')]+0x1)['then'](function(_0x35ebfe){var _0x38f44d=_[_0xc21e('0x54')](_0x3a0dff,_0x35ebfe);_0x38f44d[_0xc21e('0xa')]({'type':_0x2a80ae[_0xc21e('0x2')],'app':_0xc21e('0x55'),'exten':_0x2a80ae[_0xc21e('0x8')],'context':_0x2a80ae[_0xc21e('0x3')],'priority':_[_0xc21e('0x4f')](_0x38f44d)[_0xc21e('0x4e')]+0x1,'VoiceExtensionId':_0x2a80ae['id']});return _0x38f44d;});}}});}; \ No newline at end of file +var _0x1d86=['param','prefix','phone','${EXTEN:','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','priority','last','concat','define','VoiceExtension','voice_extensions','get','Hangup','models','type','CDR(type)=','exten','Set','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','context','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name'];(function(_0x46dd7f,_0x14f710){var _0x52d2f2=function(_0x56a86a){while(--_0x56a86a){_0x46dd7f['push'](_0x46dd7f['shift']());}};_0x52d2f2(++_0x14f710);}(_0x1d86,0x7e));var _0x61d8=function(_0x2abe88,_0x4c425d){_0x2abe88=_0x2abe88-0x0;var _0x3f3e30=_0x1d86[_0x2abe88];return _0x3f3e30;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0xd36f05){var _0x4b9035=_0xd36f05[_0x61d8('0x0')];function _0x28ff14(_0x5d92a3){var _0x3d4615=0x2;var _0x1d170a=[{'type':_0x5d92a3[_0x61d8('0x1')],'app':'Set','appdata':_0x61d8('0x2')+_0x5d92a3['type'],'context':_0x5d92a3['context'],'exten':_0x5d92a3[_0x61d8('0x3')],'priority':_0x3d4615++,'VoiceExtensionId':_0x5d92a3['id']},{'type':_0x5d92a3[_0x61d8('0x1')],'app':_0x5d92a3['alias']?_0x61d8('0x4'):_0x61d8('0x5'),'appdata':_0x5d92a3[_0x61d8('0x6')]?_0x61d8('0x7')+_0x5d92a3[_0x61d8('0x6')]:_0x61d8('0x8'),'context':_0x5d92a3[_0x61d8('0x9')],'exten':_0x5d92a3[_0x61d8('0x3')],'priority':_0x3d4615++,'VoiceExtensionId':_0x5d92a3['id']}];if(_0x5d92a3[_0x61d8('0x1')]==='inbound'){_0x1d170a[_0x61d8('0xa')]({'type':_0x61d8('0xb'),'app':_0x61d8('0x4'),'appdata':_0x61d8('0xc')+_0x5d92a3['id'],'context':_0x5d92a3[_0x61d8('0x9')],'exten':_0x5d92a3[_0x61d8('0x3')],'priority':_0x3d4615++,'VoiceExtensionId':_0x5d92a3['id']});}_0x1d170a[_0x61d8('0xa')]({'type':_0x5d92a3[_0x61d8('0x1')],'app':_0x61d8('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5d92a3[_0x61d8('0x9')],'exten':_0x5d92a3[_0x61d8('0x3')],'priority':_0x3d4615++,'VoiceExtensionId':_0x5d92a3['id']},{'type':_0x5d92a3[_0x61d8('0x1')],'app':_0x61d8('0x4'),'appdata':_0x61d8('0xd'),'context':_0x5d92a3[_0x61d8('0x9')],'exten':_0x5d92a3[_0x61d8('0x3')],'priority':_0x3d4615++,'VoiceExtensionId':_0x5d92a3['id']},{'type':_0x5d92a3['type'],'app':_0x61d8('0x4'),'appdata':_0x61d8('0xe'),'context':_0x5d92a3[_0x61d8('0x9')],'exten':_0x5d92a3['exten'],'priority':_0x3d4615++,'VoiceExtensionId':_0x5d92a3['id']});return _0x1d170a;}function _0x204615(_0x2dee09){var _0x2dd240=0x2;var _0x2dd900=[{'type':_0x61d8('0xf'),'app':_0x61d8('0x4'),'appdata':_0x61d8('0x10'),'context':_0x2dee09['context'],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':_0x61d8('0xf'),'app':_0x2dee09[_0x61d8('0x6')]?_0x61d8('0x4'):_0x61d8('0x5'),'appdata':_0x2dee09[_0x61d8('0x6')]?'CDR(routeAlias)='+_0x2dee09[_0x61d8('0x6')]:_0x61d8('0x8'),'context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':_0x61d8('0xf'),'app':'Set','appdata':_0x61d8('0x11')+(_0x2dee09[_0x61d8('0x12')]?'${EXTEN:'+_0x2dee09[_0x61d8('0x12')]+'}':_0x61d8('0x13')),'context':_0x2dee09['context'],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':'outbound','app':_0x61d8('0x4'),'appdata':_0x61d8('0xc')+_0x2dee09['id'],'context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09['exten'],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':_0x61d8('0xf'),'app':_0x61d8('0x14'),'appdata':_0x61d8('0x15')+(_0x2dd240+0x2)+_0x61d8('0x16')+(_0x2dd240+0x1)+')','context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':_0x61d8('0xf'),'app':_0x61d8('0x4'),'appdata':_0x2dee09[_0x61d8('0x12')]?_0x61d8('0x17')+_0x2dee09[_0x61d8('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':_0x61d8('0xf'),'app':_0x61d8('0x4'),'appdata':_0x61d8('0x18'),'context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':_0x61d8('0xf'),'app':_0x61d8('0x4'),'appdata':_0x61d8('0xd'),'context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':_0x61d8('0xf'),'app':_0x61d8('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09['exten'],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':'outbound','app':_0x61d8('0x4'),'appdata':_0x61d8('0x19')+_0x2dee09['id'],'context':_0x2dee09[_0x61d8('0x9')],'exten':_0x2dee09['exten'],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']}];if(_0x2dee09[_0x61d8('0x1a')](_0x61d8('0x1b'))&&_0x2dee09['recordingFormat']!==_0x61d8('0x1c')){_0x2dd900[_0x61d8('0xa')]({'type':'outbound','app':_0x61d8('0x4'),'appdata':_0x61d8('0x1d'),'context':_0x2dee09['context'],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']},{'type':'outbound','app':_0x61d8('0x4'),'appdata':_0x61d8('0x1e')+_0x2dee09[_0x61d8('0x1b')]||_0x61d8('0x1f'),'context':_0x2dee09['context'],'exten':_0x2dee09[_0x61d8('0x3')],'priority':_0x2dd240++,'VoiceExtensionId':_0x2dee09['id']});}return _0x2dd900;}function _0x5a5bcb(_0xb039ce,_0x39c0ca){var _0x2df386=[{'name':_0x61d8('0x20'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x61d8('0x21'),'param':0x2},{'name':_0x61d8('0x22'),'param':0x3}];var _0x45d9eb={};var _0x109c6c=_0x39c0ca[_0x61d8('0x23')](',');var _0x5481fd=[];for(var _0x3b5d8a=0x0;_0x3b5d8a<_0x2df386[_0x61d8('0x24')];_0x3b5d8a++){switch(_0x2df386[_0x3b5d8a][_0x61d8('0x25')]){case _0x61d8('0x20'):_0x45d9eb[_0x61d8('0x20')]=_0x109c6c[_0x2df386[_0x3b5d8a][_0x61d8('0x26')]][_0x61d8('0x23')]('/')[0x1];_0x45d9eb['phone']=_0x109c6c[_0x2df386[_0x3b5d8a][_0x61d8('0x26')]][_0x61d8('0x23')]('/')[0x2];_0x45d9eb[_0x61d8('0x27')]=_0x45d9eb[_0x61d8('0x28')]?_0x45d9eb[_0x61d8('0x28')][_0x61d8('0x23')]('$')[0x0]:undefined;_0x45d9eb['phone']=_0xb039ce[_0x61d8('0x12')]?(_0x45d9eb[_0x61d8('0x27')]||'')+_0x61d8('0x29')+_0xb039ce[_0x61d8('0x12')]+'}':(_0x45d9eb[_0x61d8('0x27')]||'')+'${EXTEN}';_0x5481fd[_0x2df386[_0x3b5d8a][_0x61d8('0x26')]]=[_0x61d8('0x2a'),_0x45d9eb['trunk'],_0x45d9eb[_0x61d8('0x28')]]['join']('/');break;case _0x61d8('0x21'):_0x45d9eb[_0x61d8('0x21')]=_0x109c6c[_0x2df386[_0x3b5d8a][_0x61d8('0x26')]];if(_0xb039ce[_0x61d8('0x1b')]!=='none'){if(_0x45d9eb[_0x61d8('0x21')][_0x61d8('0x2b')](_0x61d8('0x2c'))<0x0){_0x45d9eb[_0x61d8('0x21')]+=_0x61d8('0x2c');}}else{_0x45d9eb[_0x61d8('0x21')]=_0x45d9eb[_0x61d8('0x21')][_0x61d8('0x2d')](_0x61d8('0x2c'),'');}_0x5481fd[_0x2df386[_0x3b5d8a][_0x61d8('0x26')]]=_0x45d9eb[_0x61d8('0x21')];break;default:_0x5481fd[_0x2df386[_0x3b5d8a][_0x61d8('0x26')]]=_0x109c6c[_0x2df386[_0x3b5d8a][_0x61d8('0x26')]];}}return _0x5481fd[_0x61d8('0x2e')](',');}function _0x2fbd9a(_0x457939,_0x4abdb7,_0x45da5f){return new Promise(function(_0x1b2085,_0x51f1b2){var _0x9c06aa=[];if(_[_0x61d8('0x2f')](_0x4abdb7))return _0x1b2085(_0x9c06aa);_0x4b9035[_0x61d8('0x30')][_0x61d8('0x31')]({'attributes':['id','interval',_0x61d8('0x32')],'raw':!![]})[_0x61d8('0x33')](function(_0x532736){for(var _0x2ae657=0x0,_0x49e4ed=0x0;_0x2ae657<_0x4abdb7['length'];_0x2ae657++,_0x49e4ed=0x0){var _0x96ed67=_0x4abdb7[_0x2ae657];var _0xbe6c59=[];var _0x4d4c23=[];delete _0x96ed67['id'];if(_0x96ed67[_0x61d8('0x34')]!==_0x61d8('0x35')){_0x96ed67[_0x61d8('0x36')]=[_0x96ed67[_0x61d8('0x34')]];}else{_0x96ed67[_0x61d8('0x36')]=_0x96ed67[_0x61d8('0x32')]?_[_0x61d8('0x37')](_['filter'](_0x532736,{'IntervalId':_0x96ed67[_0x61d8('0x32')]}),_0x61d8('0x34')):[];}_0x96ed67['context']=_0x457939[_0x61d8('0x9')];_0x96ed67['exten']=_0x457939[_0x61d8('0x3')];if(_0x96ed67[_0x61d8('0x1')])_0x96ed67[_0x61d8('0x1')]=_0x96ed67['type'][_0x61d8('0x38')]();if(_0x457939[_0x61d8('0x1')]===_0x61d8('0xf')){if(_0x96ed67[_0x61d8('0x1a')](_0x61d8('0x39'))&&_0x96ed67[_0x61d8('0x39')]&&_0x96ed67['tag']!=='--'){_0xbe6c59[_0x61d8('0xa')]({'type':_0x96ed67[_0x61d8('0x1')]['toLowerCase'](),'app':_0x61d8('0x4'),'appdata':_0x61d8('0x3a')+_0x96ed67['tag'],'context':_0x457939[_0x61d8('0x9')],'exten':_0x457939[_0x61d8('0x3')],'priority':_0x96ed67[_0x61d8('0x36')]['length']+_0x45da5f+_0x49e4ed++,'VoiceExtensionId':_0x457939['id']});}_0xbe6c59[_0x61d8('0xa')]({'type':_0x96ed67[_0x61d8('0x1')][_0x61d8('0x38')](),'app':_0x61d8('0x14'),'appdata':_0x61d8('0x3b')+(_0x96ed67['callerID']?_0x61d8('0x3c')+_0x96ed67['callerID']+')':_0x61d8('0x3d')),'context':_0x457939[_0x61d8('0x9')],'exten':_0x457939[_0x61d8('0x3')],'priority':_0x96ed67['intervals']['length']+_0x45da5f+_0x49e4ed++,'VoiceExtensionId':_0x457939['id']});}else{if(_0x96ed67[_0x61d8('0x1a')](_0x61d8('0x3e'))){if(['queue',_0x61d8('0x3f')][_0x61d8('0x40')](_0x96ed67[_0x61d8('0x41')]['toLowerCase']())&&_0x96ed67['appType']!==_0x61d8('0x42')){if(_0x96ed67[_0x61d8('0x3e')]){_0xbe6c59[_0x61d8('0xa')]({'type':_0x96ed67[_0x61d8('0x1')]['toLowerCase'](),'app':'ExecIf','appdata':_0x61d8('0x43'),'context':_0x457939['context'],'exten':_0x457939[_0x61d8('0x3')],'priority':_0x96ed67['intervals']['length']+_0x45da5f+_0x49e4ed++,'VoiceExtensionId':_0x457939['id']});_0xbe6c59[_0x61d8('0xa')]({'type':_0x96ed67[_0x61d8('0x1')][_0x61d8('0x38')](),'app':_0x61d8('0x4'),'appdata':_0x61d8('0x44'),'context':_0x457939[_0x61d8('0x9')],'exten':_0x457939[_0x61d8('0x3')],'priority':_0x96ed67[_0x61d8('0x36')]['length']+_0x45da5f+_0x49e4ed++,'VoiceExtensionId':_0x457939['id']});}else{_0xbe6c59[_0x61d8('0xa')]({'type':_0x96ed67[_0x61d8('0x1')]['toLowerCase'](),'app':_0x61d8('0x14'),'appdata':_0x61d8('0x45'),'context':_0x457939[_0x61d8('0x9')],'exten':_0x457939[_0x61d8('0x3')],'priority':_0x96ed67[_0x61d8('0x36')][_0x61d8('0x24')]+_0x45da5f+_0x49e4ed++,'VoiceExtensionId':_0x457939['id']});_0xbe6c59[_0x61d8('0xa')]({'type':_0x96ed67[_0x61d8('0x1')]['toLowerCase'](),'app':_0x61d8('0x4'),'appdata':_0x61d8('0x46'),'context':_0x457939[_0x61d8('0x9')],'exten':_0x457939[_0x61d8('0x3')],'priority':_0x96ed67[_0x61d8('0x36')][_0x61d8('0x24')]+_0x45da5f+_0x49e4ed++,'VoiceExtensionId':_0x457939['id']});}}}}for(var _0x4ee56c=0x0;_0x4ee56c<_0x96ed67['intervals'][_0x61d8('0x24')];_0x4ee56c++){var _0x49296b=_0x45da5f+_0x96ed67['intervals'][_0x61d8('0x24')];var _0xbf1327=_0x4ee56c===_0x96ed67[_0x61d8('0x36')][_0x61d8('0x24')]-0x1?_0x45da5f+_0xbe6c59['length']+_0x4d4c23[_0x61d8('0x24')]+0x2:_0x45da5f+_0x4ee56c+0x1;_0xbe6c59[_0x61d8('0x47')](_0x4ee56c,0x0,{'type':_0x457939['type'],'app':'GotoIfTime','appdata':_0x96ed67['intervals'][_0x4ee56c]+'?'+_0x457939[_0x61d8('0x9')]+_0x61d8('0x48')+_0x49296b+':'+_0x457939[_0x61d8('0x9')]+_0x61d8('0x48')+_0xbf1327,'exten':_0x457939[_0x61d8('0x3')],'context':_0x457939['context'],'priority':_0x45da5f+_0x4ee56c,'VoiceExtensionId':_0x457939['id']});}if(_0x96ed67[_0x61d8('0x49')]==='outboundDial')_0x96ed67['appdata']=_0x5a5bcb(_0x457939,_0x96ed67['appdata']);_0x96ed67[_0x61d8('0x4a')]=_0xbe6c59[_0x61d8('0x24')]?_[_0x61d8('0x4b')](_0xbe6c59)['priority']+0x1:_0x45da5f;_0x9c06aa=_[_0x61d8('0x4c')](_0x9c06aa,_0xbe6c59,[_0x96ed67],_0x4d4c23);_0x45da5f=_[_0x61d8('0x4b')](_0x9c06aa)['priority']+0x1;}return _0x1b2085(_0x9c06aa);})['catch'](function(_0x3fad5c){_0x51f1b2(_0x3fad5c);});});}return _0xd36f05[_0x61d8('0x4d')](_0x61d8('0x4e'),attributes,{'tableName':_0x61d8('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x411023){var _0x46cb16=this[_0x61d8('0x50')]({'plain':!![]});var _0x147b33=_0x46cb16[_0x61d8('0x1')]===_0x61d8('0xf')?_0x204615(_0x46cb16):_0x28ff14(_0x46cb16);return _0x2fbd9a(_0x46cb16,_0x411023,_[_0x61d8('0x4b')](_0x147b33)[_0x61d8('0x4a')]+0x1)[_0x61d8('0x33')](function(_0x46c748){var _0x2d6bb6=_[_0x61d8('0x4c')](_0x147b33,_0x46c748);_0x2d6bb6[_0x61d8('0xa')]({'type':_0x46cb16[_0x61d8('0x1')],'app':_0x61d8('0x51'),'exten':_0x46cb16[_0x61d8('0x3')],'context':_0x46cb16[_0x61d8('0x9')],'priority':_[_0x61d8('0x4b')](_0x2d6bb6)['priority']+0x1,'VoiceExtensionId':_0x46cb16['id']});return _0x2d6bb6;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 433eaec..46bd629 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 _0xa13d=['raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x381542,_0x39322c){var _0x179617=function(_0x372701){while(--_0x372701){_0x381542['push'](_0x381542['shift']());}};_0x179617(++_0x39322c);}(_0xa13d,0x154));var _0xda13=function(_0x38a873,_0x586be9){_0x38a873=_0x38a873-0x0;var _0x52de2c=_0xa13d[_0x38a873];return _0x52de2c;};'use strict';var _=require(_0xda13('0x0'));var util=require('util');var moment=require(_0xda13('0x1'));var BPromise=require(_0xda13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda13('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda13('0x4'));var logger=require(_0xda13('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda13('0x6'));var client=jayson[_0xda13('0x7')]['http']({'port':0x232a});config[_0xda13('0x8')]=_[_0xda13('0x9')](config[_0xda13('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xda13('0xa'))(new Redis(config[_0xda13('0x8')]));require(_0xda13('0xb'))[_0xda13('0xc')](socket);function respondWithRpcPromise(_0x1256f8,_0x29d821,_0xf307b6){return new BPromise(function(_0x202008,_0x139876){return client[_0xda13('0xd')](_0x1256f8,_0xf307b6)[_0xda13('0xe')](function(_0x3af482){logger[_0xda13('0xf')](_0xda13('0x10'),_0x29d821,_0xda13('0x11'));logger[_0xda13('0x12')](_0xda13('0x13'),_0x29d821,'request\x20sent',JSON[_0xda13('0x14')](_0x3af482));if(_0x3af482['error']){if(_0x3af482[_0xda13('0x15')][_0xda13('0x16')]===0x1f4){logger['error'](_0xda13('0x10'),_0x29d821,_0x3af482[_0xda13('0x15')][_0xda13('0x17')]);return _0x139876(_0x3af482[_0xda13('0x15')]['message']);}logger[_0xda13('0x15')](_0xda13('0x10'),_0x29d821,_0x3af482['error'][_0xda13('0x17')]);return _0x202008(_0x3af482['error'][_0xda13('0x17')]);}else{logger[_0xda13('0xf')](_0xda13('0x10'),_0x29d821,_0xda13('0x11'));_0x202008(_0x3af482[_0xda13('0x18')][_0xda13('0x17')]);}})[_0xda13('0x19')](function(_0x2790c8){logger['error'](_0xda13('0x10'),_0x29d821,_0x2790c8);_0x139876(_0x2790c8);});});}exports[_0xda13('0x1a')]=function(_0x19c00d){var _0x49cad2=this;return new Promise(function(_0x3ead85,_0x7a9700){return db[_0xda13('0x1b')][_0xda13('0x1c')]({'raw':_0x19c00d['options']?_0x19c00d[_0xda13('0x1d')][_0xda13('0x1e')]===undefined?!![]:![]:!![],'where':_0x19c00d[_0xda13('0x1d')]?_0x19c00d['options'][_0xda13('0x1f')]||null:null,'attributes':_0x19c00d[_0xda13('0x1d')]?_0x19c00d[_0xda13('0x1d')][_0xda13('0x20')]||null:null,'limit':_0x19c00d[_0xda13('0x1d')]?_0x19c00d[_0xda13('0x1d')][_0xda13('0x21')]||null:null,'include':_0x19c00d[_0xda13('0x1d')]?_0x19c00d['options'][_0xda13('0x22')]?_[_0xda13('0x23')](_0x19c00d[_0xda13('0x1d')][_0xda13('0x22')],function(_0x41cd49){return{'model':db[_0x41cd49['model']],'as':_0x41cd49['as'],'attributes':_0x41cd49['attributes'],'include':_0x41cd49[_0xda13('0x22')]?_['map'](_0x41cd49[_0xda13('0x22')],function(_0x386708){return{'model':db[_0x386708[_0xda13('0x24')]],'as':_0x386708['as'],'attributes':_0x386708[_0xda13('0x20')],'include':_0x386708[_0xda13('0x22')]?_[_0xda13('0x23')](_0x386708[_0xda13('0x22')],function(_0x206e00){return{'model':db[_0x206e00[_0xda13('0x24')]],'as':_0x206e00['as'],'attributes':_0x206e00['attributes']};}):[]};}):[]};}):[]:[]})[_0xda13('0xe')](function(_0x54c2f1){logger[_0xda13('0xf')](_0xda13('0x1a'),_0x19c00d);logger[_0xda13('0x12')](_0xda13('0x1a'),_0x19c00d,JSON['stringify'](_0x54c2f1));_0x3ead85(_0x54c2f1);})[_0xda13('0x19')](function(_0x383178){logger[_0xda13('0x15')](_0xda13('0x1a'),_0x383178[_0xda13('0x17')],_0x19c00d);_0x7a9700(_0x49cad2[_0xda13('0x15')](0x1f4,_0x383178[_0xda13('0x17')]));});});}; \ No newline at end of file +var _0xbff5=['defaults','localhost','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xbff5,0x1bc));var _0x5bff=function(_0x555aae,_0x4a2b4d){_0x555aae=_0x555aae-0x0;var _0xe8b700=_0xbff5[_0x555aae];return _0xe8b700;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});config[_0x5bff('0xb')]=_[_0x5bff('0xc')](config[_0x5bff('0xb')],{'host':_0x5bff('0xd'),'port':0x18eb});var socket=require(_0x5bff('0xe'))(new Redis(config[_0x5bff('0xb')]));require('./voiceExtension.socket')[_0x5bff('0xf')](socket);function respondWithRpcPromise(_0x5e7d10,_0x1d8197,_0x40b806){return new BPromise(function(_0x4fc146,_0x3e72e9){return client['request'](_0x5e7d10,_0x40b806)[_0x5bff('0x10')](function(_0x4ff164){logger[_0x5bff('0x11')](_0x5bff('0x12'),_0x1d8197,'request\x20sent');logger[_0x5bff('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1d8197,_0x5bff('0x14'),JSON[_0x5bff('0x15')](_0x4ff164));if(_0x4ff164['error']){if(_0x4ff164[_0x5bff('0x16')][_0x5bff('0x17')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x1d8197,_0x4ff164[_0x5bff('0x16')][_0x5bff('0x18')]);return _0x3e72e9(_0x4ff164[_0x5bff('0x16')]['message']);}logger[_0x5bff('0x16')](_0x5bff('0x12'),_0x1d8197,_0x4ff164[_0x5bff('0x16')]['message']);return _0x4fc146(_0x4ff164[_0x5bff('0x16')][_0x5bff('0x18')]);}else{logger[_0x5bff('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x1d8197,_0x5bff('0x14'));_0x4fc146(_0x4ff164[_0x5bff('0x19')][_0x5bff('0x18')]);}})[_0x5bff('0x1a')](function(_0x5216dc){logger[_0x5bff('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x1d8197,_0x5216dc);_0x3e72e9(_0x5216dc);});});}exports[_0x5bff('0x1b')]=function(_0x4d0111){var _0x1fc4cf=this;return new Promise(function(_0x13d5d0,_0x2a83ce){return db[_0x5bff('0x1c')][_0x5bff('0x1d')]({'raw':_0x4d0111[_0x5bff('0x1e')]?_0x4d0111[_0x5bff('0x1e')][_0x5bff('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d0111[_0x5bff('0x1e')]?_0x4d0111['options'][_0x5bff('0x20')]||null:null,'attributes':_0x4d0111[_0x5bff('0x1e')]?_0x4d0111[_0x5bff('0x1e')][_0x5bff('0x21')]||null:null,'limit':_0x4d0111[_0x5bff('0x1e')]?_0x4d0111[_0x5bff('0x1e')][_0x5bff('0x22')]||null:null,'include':_0x4d0111[_0x5bff('0x1e')]?_0x4d0111['options']['include']?_[_0x5bff('0x23')](_0x4d0111['options'][_0x5bff('0x24')],function(_0xcc091d){return{'model':db[_0xcc091d[_0x5bff('0x25')]],'as':_0xcc091d['as'],'attributes':_0xcc091d[_0x5bff('0x21')],'include':_0xcc091d[_0x5bff('0x24')]?_[_0x5bff('0x23')](_0xcc091d[_0x5bff('0x24')],function(_0xedba9d){return{'model':db[_0xedba9d['model']],'as':_0xedba9d['as'],'attributes':_0xedba9d['attributes'],'include':_0xedba9d[_0x5bff('0x24')]?_[_0x5bff('0x23')](_0xedba9d['include'],function(_0x36a7d2){return{'model':db[_0x36a7d2['model']],'as':_0x36a7d2['as'],'attributes':_0x36a7d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bff('0x10')](function(_0x5cf207){logger[_0x5bff('0x11')](_0x5bff('0x1b'),_0x4d0111);logger[_0x5bff('0x13')](_0x5bff('0x1b'),_0x4d0111,JSON['stringify'](_0x5cf207));_0x13d5d0(_0x5cf207);})[_0x5bff('0x1a')](function(_0x4ee6f1){logger[_0x5bff('0x16')]('GetVoiceExtension',_0x4ee6f1[_0x5bff('0x18')],_0x4d0111);_0x2a83ce(_0x1fc4cf[_0x5bff('0x16')](0x1f4,_0x4ee6f1[_0x5bff('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f17b3cd..5f5fd18 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x4b85f0,_0x56749a){var _0x717954=function(_0x50b246){while(--_0x50b246){_0x4b85f0['push'](_0x4b85f0['shift']());}};_0x717954(++_0x56749a);}(_0x326f,0xd1));var _0xf326=function(_0x22a49b,_0x4cdf4a){_0x22a49b=_0x22a49b-0x0;var _0x4c1ed6=_0x326f[_0x22a49b];return _0x4c1ed6;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x16d366,_0x514dc6){var _0x59a0d6=function(_0x131530){while(--_0x131530){_0x16d366['push'](_0x16d366['shift']());}};_0x59a0d6(++_0x514dc6);}(_0x7a54,0x106));var _0x47a5=function(_0xb6b4cc,_0x4855db){_0xb6b4cc=_0xb6b4cc-0x0;var _0xaf4a79=_0x7a54[_0xb6b4cc];return _0xaf4a79;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 117614c..17e1f71 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 _0x323f=['show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id'];(function(_0x1cea33,_0x18f123){var _0x19ca2d=function(_0x3bba46){while(--_0x3bba46){_0x1cea33['push'](_0x1cea33['shift']());}};_0x19ca2d(++_0x18f123);}(_0x323f,0x1ee));var _0xf323=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x323f[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x13')](_0xf323('0xb'),auth['isAuthenticated'](),controller[_0xf323('0x14')]);module[_0xf323('0x15')]=router; \ No newline at end of file +var _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','/:id','show','getMessages','post','create','delete','destroy','exports','multer','express'];(function(_0x1b0960,_0xd8d402){var _0x139227=function(_0x372952){while(--_0x372952){_0x1b0960['push'](_0x1b0960['shift']());}};_0x139227(++_0xd8d402);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x532a2c,_0xba730e){_0x532a2c=_0x532a2c-0x0;var _0x125d20=_0x0a6b[_0x532a2c];return _0x125d20;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xc')]);router['put'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 68219ee..62c3142 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 _0x460f=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','email','string','trim','central','ENUM'];(function(_0xa14c6f,_0x128ea8){var _0x3cb7e0=function(_0x38a17a){while(--_0x38a17a){_0xa14c6f['push'](_0xa14c6f['shift']());}};_0x3cb7e0(++_0x128ea8);}(_0x460f,0x1ba));var _0xf460=function(_0x6ff57c,_0x79c65f){_0x6ff57c=_0x6ff57c-0x0;var _0xa7b52d=_0x460f[_0x6ff57c];return _0xa7b52d;};'use strict';var Sequelize=require(_0xf460('0x0'));module[_0xf460('0x1')]={'customer_id':{'type':Sequelize[_0xf460('0x2')]},'context':{'type':Sequelize[_0xf460('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf460('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf460('0x2')],'validate':{'isEmail':!![]},'set':function(_0x535f69){this['setDataValue'](_0xf460('0x3'),typeof _0x535f69===_0xf460('0x4')&&_0x535f69[_0xf460('0x5')]()?_0x535f69[_0xf460('0x5')]():null);}},'pager':{'type':Sequelize[_0xf460('0x2')]},'tz':{'type':Sequelize[_0xf460('0x2')],'defaultValue':_0xf460('0x6')},'attach':{'type':Sequelize[_0xf460('0x7')](_0xf460('0x8'),'no'),'defaultValue':_0xf460('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf460('0x7')]('yes','no'),'defaultValue':_0xf460('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xf460('0x2')]},'review':{'type':Sequelize[_0xf460('0x7')](_0xf460('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf460('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf460('0x7')](_0xf460('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf460('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf460('0x7')](_0xf460('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf460('0x7')](_0xf460('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf460('0x7')](_0xf460('0x8'),'no'),'defaultValue':_0xf460('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf460('0x7')](_0xf460('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xf460('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf460('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xf460('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xf460('0x2')]},'maxsecs':{'type':Sequelize[_0xf460('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf460('0xb')],'get':function(){return this[_0xf460('0xc')]('fullname')+_0xf460('0xd')+this[_0xf460('0xc')](_0xf460('0xe'));}}}; \ No newline at end of file +var _0x7b07=['trim','central','ENUM','yes','TINYINT(4)','INTEGER','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x9c1f48,_0x25da55){var _0x52ecd4=function(_0x47aef6){while(--_0x47aef6){_0x9c1f48['push'](_0x9c1f48['shift']());}};_0x52ecd4(++_0x25da55);}(_0x7b07,0x110));var _0x77b0=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7b07[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x77b0('0x0'));module[_0x77b0('0x1')]={'customer_id':{'type':Sequelize[_0x77b0('0x2')]},'context':{'type':Sequelize[_0x77b0('0x2')],'defaultValue':_0x77b0('0x3'),'unique':_0x77b0('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x77b0('0x4')},'password':{'type':Sequelize[_0x77b0('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x533e19){this[_0x77b0('0x5')](_0x77b0('0x6'),typeof _0x533e19===_0x77b0('0x7')&&_0x533e19[_0x77b0('0x8')]()?_0x533e19[_0x77b0('0x8')]():null);}},'pager':{'type':Sequelize[_0x77b0('0x2')]},'tz':{'type':Sequelize[_0x77b0('0x2')],'defaultValue':_0x77b0('0x9')},'attach':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':_0x77b0('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':_0x77b0('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x77b0('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x77b0('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x77b0('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x77b0('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x77b0('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x77b0('0xa')](_0x77b0('0xb'),'no'),'defaultValue':_0x77b0('0xb'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x77b0('0x2')]},'emailbody':{'type':Sequelize[_0x77b0('0x2')]},'maxsecs':{'type':Sequelize[_0x77b0('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x77b0('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0f43051..045575b 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 _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_0x3f25c6,_0x41afbb){var _0x1a9c04=function(_0x2fe945){while(--_0x2fe945){_0x3f25c6['push'](_0x3f25c6['shift']());}};_0x1a9c04(++_0x41afbb);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x194322,_0x383def){_0x194322=_0x194322-0x0;var _0x2e45c3=_0x6f7a[_0x194322];return _0x2e45c3;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['VoiceMail'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['VoiceMail'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['VoiceMail'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));};exports[_0xa6f7('0x51')]=function(_0x139192,_0x4496f1,_0x5908e3){return db['VoiceMail'][_0xa6f7('0x52')]({'where':{'id':_0x139192[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4496f1,null))[_0xa6f7('0x25')](function(_0x301327){var _0x269249;var _0x1fcb72={},_0x5efd49={};_0x5efd49[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db[_0xa6f7('0x53')][_0xa6f7('0x2d')]);_0x5efd49[_0xa6f7('0x32')]=_[_0xa6f7('0x47')](_0x139192[_0xa6f7('0x32')]);_0x5efd49[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x5efd49[_0xa6f7('0x30')],_0x5efd49[_0xa6f7('0x32')]);_0x1fcb72['attributes']=_[_0xa6f7('0x33')](_0x5efd49['model'],qs[_0xa6f7('0x35')](_0x139192['query'][_0xa6f7('0x35')]));_0x1fcb72[_0xa6f7('0x34')]=_0x1fcb72['attributes'][_0xa6f7('0x36')]?_0x1fcb72[_0xa6f7('0x34')]:_0x5efd49[_0xa6f7('0x30')];if(!_0x139192['query'][_0xa6f7('0x37')]('nolimit')){_0x1fcb72[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x139192['query'][_0xa6f7('0x1d')]);_0x1fcb72['offset']=qs[_0xa6f7('0x1e')](_0x139192['query'][_0xa6f7('0x1e')]);}_0x1fcb72[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x139192[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x1fcb72[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x139192[_0xa6f7('0x32')],_0x5efd49[_0xa6f7('0x3b')]));if(_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'$or':_[_0xa6f7('0x31')](_0x1fcb72[_0xa6f7('0x34')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]+'%'};return _0x3a464e;})});}_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'mailboxuser':_0x301327[_0xa6f7('0x54')]});_0x1fcb72=_['merge']({},_0x1fcb72,_0x139192[_0xa6f7('0x40')]);return db[_0xa6f7('0x53')][_0xa6f7('0x55')](_0x1fcb72)[_0xa6f7('0x25')](respondWithFilteredResult(_0x4496f1,_0x1fcb72));})[_0xa6f7('0x45')](handleError(_0x4496f1,null));}; \ No newline at end of file +var _0x0972=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','Voicemails','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','length','options'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x0972,0x64));var _0x2097=function(_0x33fba3,_0x47e008){_0x33fba3=_0x33fba3-0x0;var _0x273124=_0x0972[_0x33fba3];return _0x273124;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];function respondWithStatusCode(_0x3b2f94,_0x170005){_0x170005=_0x170005||0xcc;return function(_0x16871b){if(_0x16871b){return _0x3b2f94[_0x2097('0x1a')](_0x170005);}return _0x3b2f94[_0x2097('0x1b')](_0x170005)[_0x2097('0x1c')]();};}function respondWithResult(_0x1c9ef9,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xc8;return function(_0x354387){if(_0x354387){return _0x1c9ef9['status'](_0x2c3e41)[_0x2097('0x1d')](_0x354387);}};}function respondWithFilteredResult(_0x35c062,_0x4d31bc){return function(_0x4eec05){if(_0x4eec05){var _0x4fc8c5=typeof _0x4d31bc[_0x2097('0x1e')]==='undefined'&&typeof _0x4d31bc[_0x2097('0x1f')]===_0x2097('0x20');var _0x43fec9=_0x4eec05[_0x2097('0x21')];var _0x44c584=_0x4fc8c5?0x0:_0x4d31bc['offset'];var _0x324652=_0x4fc8c5?_0x4eec05[_0x2097('0x21')]:_0x4d31bc[_0x2097('0x1e')]+_0x4d31bc[_0x2097('0x1f')];var _0x1d3804;if(_0x324652>=_0x43fec9){_0x324652=_0x43fec9;_0x1d3804=0xc8;}else{_0x1d3804=0xce;}_0x35c062[_0x2097('0x1b')](_0x1d3804);return _0x35c062[_0x2097('0x22')](_0x2097('0x23'),_0x44c584+'-'+_0x324652+'/'+_0x43fec9)['json'](_0x4eec05);}return null;};}function patchUpdates(_0x4d957e){return function(_0xf65dc6){try{jsonpatch['apply'](_0xf65dc6,_0x4d957e,!![]);}catch(_0x227c00){return BPromise[_0x2097('0x24')](_0x227c00);}return _0xf65dc6['save']();};}function saveUpdates(_0x442db7,_0x5b0582){return function(_0x2e17c8){if(_0x2e17c8){return _0x2e17c8[_0x2097('0x25')](_0x442db7)[_0x2097('0x26')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x36b15e,_0x35047b){return function(_0x56390a){if(_0x56390a){return _0x56390a[_0x2097('0x27')]()['then'](function(){var _0x3f9279=_0x56390a[_0x2097('0x28')]({'plain':!![]});var _0x345875=_0x2097('0x29');return db['UserProfileResource'][_0x2097('0x27')]({'where':{'type':_0x345875,'resourceId':_0x3f9279['id']}})[_0x2097('0x26')](function(){return _0x56390a;});})['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b879,_0x48ae06){return function(_0xbc0339){if(!_0xbc0339){_0x29b879[_0x2097('0x1a')](0x194);}return _0xbc0339;};}function handleError(_0x407a2a,_0x7eefb4){_0x7eefb4=_0x7eefb4||0x1f4;return function(_0x410afa){logger[_0x2097('0x2a')](_0x410afa[_0x2097('0x2b')]);if(_0x410afa['name']){delete _0x410afa[_0x2097('0x2c')];}_0x407a2a[_0x2097('0x1b')](_0x7eefb4)['send'](_0x410afa);};}exports[_0x2097('0x2d')]=function(_0x41487d,_0x59fb84){var _0x4d0916={},_0x312c77={},_0x11b051={'count':0x0,'rows':[]};var _0x1649c8=_[_0x2097('0x2e')](db[_0x2097('0x2f')][_0x2097('0x30')],function(_0x56c538){return{'name':_0x56c538[_0x2097('0x31')],'type':_0x56c538['type'][_0x2097('0x32')]};});_0x312c77[_0x2097('0x33')]=_[_0x2097('0x2e')](_0x1649c8,_0x2097('0x2c'));_0x312c77[_0x2097('0x34')]=_[_0x2097('0x35')](_0x41487d[_0x2097('0x34')]);_0x312c77[_0x2097('0x36')]=_[_0x2097('0x37')](_0x312c77['model'],_0x312c77[_0x2097('0x34')]);_0x4d0916[_0x2097('0x38')]=_[_0x2097('0x37')](_0x312c77['model'],qs[_0x2097('0x39')](_0x41487d[_0x2097('0x34')][_0x2097('0x39')]));_0x4d0916[_0x2097('0x38')]=_0x4d0916['attributes']['length']?_0x4d0916['attributes']:_0x312c77[_0x2097('0x33')];if(!_0x41487d[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x4d0916[_0x2097('0x1f')]=qs[_0x2097('0x1f')](_0x41487d['query'][_0x2097('0x1f')]);_0x4d0916[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x41487d[_0x2097('0x34')][_0x2097('0x1e')]);}_0x4d0916[_0x2097('0x3c')]=qs['sort'](_0x41487d[_0x2097('0x34')][_0x2097('0x3d')]);_0x4d0916[_0x2097('0x3e')]=qs['filters'](_['pick'](_0x41487d[_0x2097('0x34')],_0x312c77[_0x2097('0x36')]),_0x1649c8);if(_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]){_0x4d0916[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x4d0916[_0x2097('0x3e')],{'$or':_[_0x2097('0x2e')](_0x1649c8,function(_0x23c4a5){if(_0x23c4a5[_0x2097('0x41')]!==_0x2097('0x42')){var _0x1ef92a={};_0x1ef92a[_0x23c4a5['name']]={'$like':'%'+_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1ef92a;}})});}_0x4d0916=_[_0x2097('0x40')]({},_0x4d0916,_0x41487d['options']);var _0x1394df={'where':_0x4d0916[_0x2097('0x3e')]};return db[_0x2097('0x2f')][_0x2097('0x21')](_0x1394df)[_0x2097('0x26')](function(_0xd4d89e){_0x11b051[_0x2097('0x21')]=_0xd4d89e;if(_0x41487d[_0x2097('0x34')]['includeAll']){_0x4d0916[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2f')][_0x2097('0x44')](_0x4d0916);})[_0x2097('0x26')](function(_0x12e0e2){_0x11b051[_0x2097('0x45')]=_0x12e0e2;return _0x11b051;})[_0x2097('0x26')](respondWithFilteredResult(_0x59fb84,_0x4d0916))[_0x2097('0x46')](handleError(_0x59fb84,null));};exports['show']=function(_0x3fc3fe,_0x5869d8){var _0x3e0739={'raw':!![],'where':{'id':_0x3fc3fe[_0x2097('0x47')]['id']}},_0x298e49={};_0x298e49[_0x2097('0x33')]=_[_0x2097('0x35')](db['VoiceMail'][_0x2097('0x30')]);_0x298e49[_0x2097('0x34')]=_[_0x2097('0x35')](_0x3fc3fe[_0x2097('0x34')]);_0x298e49[_0x2097('0x36')]=_['intersection'](_0x298e49[_0x2097('0x33')],_0x298e49[_0x2097('0x34')]);_0x3e0739[_0x2097('0x38')]=_[_0x2097('0x37')](_0x298e49[_0x2097('0x33')],qs[_0x2097('0x39')](_0x3fc3fe[_0x2097('0x34')][_0x2097('0x39')]));_0x3e0739['attributes']=_0x3e0739[_0x2097('0x38')][_0x2097('0x48')]?_0x3e0739[_0x2097('0x38')]:_0x298e49[_0x2097('0x33')];if(_0x3fc3fe['query']['includeAll']){_0x3e0739['include']=[{'all':!![]}];}_0x3e0739=_[_0x2097('0x40')]({},_0x3e0739,_0x3fc3fe[_0x2097('0x49')]);return db['VoiceMail'][_0x2097('0x4a')](_0x3e0739)[_0x2097('0x26')](handleEntityNotFound(_0x5869d8,null))['then'](respondWithResult(_0x5869d8,null))['catch'](handleError(_0x5869d8,null));};exports[_0x2097('0x4b')]=function(_0x21829d,_0x1b4de6){return db['VoiceMail'][_0x2097('0x4b')](_0x21829d[_0x2097('0x4c')],{})['then'](function(_0x86a05a){var _0x2682a9=_0x21829d[_0x2097('0x4d')][_0x2097('0x28')]({'plain':!![]});if(!_0x2682a9)throw new Error(_0x2097('0x4e'));if(_0x2682a9['role']==='user'){var _0x140b41=_0x86a05a[_0x2097('0x28')]({'plain':!![]});var _0x329632='Voicemails';return db['UserProfileSection'][_0x2097('0x4a')]({'where':{'name':_0x329632,'userProfileId':_0x2682a9[_0x2097('0x4f')]},'raw':!![]})['then'](function(_0x41cd90){if(_0x41cd90&&_0x41cd90[_0x2097('0x50')]===0x0){return db[_0x2097('0x51')][_0x2097('0x4b')]({'name':_0x140b41[_0x2097('0x2c')],'resourceId':_0x140b41['id'],'type':_0x41cd90['name'],'sectionId':_0x41cd90['id']},{})[_0x2097('0x26')](function(){return _0x86a05a;});}else{return _0x86a05a;}})[_0x2097('0x46')](function(_0x190859){logger['error'](_0x2097('0x52'),_0x190859);throw _0x190859;});}return _0x86a05a;})[_0x2097('0x26')](respondWithResult(_0x1b4de6,0xc9))['catch'](handleError(_0x1b4de6,null));};exports[_0x2097('0x25')]=function(_0x4d6ed6,_0x30b4cd){if(_0x4d6ed6['body']['id']){delete _0x4d6ed6['body']['id'];}return db['VoiceMail'][_0x2097('0x4a')]({'where':{'id':_0x4d6ed6['params']['id']}})['then'](handleEntityNotFound(_0x30b4cd,null))[_0x2097('0x26')](saveUpdates(_0x4d6ed6['body'],null))[_0x2097('0x26')](respondWithResult(_0x30b4cd,null))[_0x2097('0x46')](handleError(_0x30b4cd,null));};exports['destroy']=function(_0x3e799f,_0x3e2e45){return db[_0x2097('0x2f')][_0x2097('0x4a')]({'where':{'id':_0x3e799f[_0x2097('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e2e45,null))[_0x2097('0x26')](removeEntity(_0x3e2e45,null))['catch'](handleError(_0x3e2e45,null));};exports[_0x2097('0x53')]=function(_0x140e43,_0x24f166,_0x55e3cd){return db[_0x2097('0x2f')][_0x2097('0x54')]({'where':{'id':_0x140e43[_0x2097('0x47')]['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x24f166,null))[_0x2097('0x26')](function(_0x56cfbf){var _0x5b9fa2;var _0x265eac={},_0x275578={};_0x275578['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x275578[_0x2097('0x34')]=_['keys'](_0x140e43[_0x2097('0x34')]);_0x275578[_0x2097('0x36')]=_['intersection'](_0x275578[_0x2097('0x33')],_0x275578[_0x2097('0x34')]);_0x265eac[_0x2097('0x38')]=_[_0x2097('0x37')](_0x275578[_0x2097('0x33')],qs[_0x2097('0x39')](_0x140e43[_0x2097('0x34')][_0x2097('0x39')]));_0x265eac[_0x2097('0x38')]=_0x265eac['attributes'][_0x2097('0x48')]?_0x265eac[_0x2097('0x38')]:_0x275578[_0x2097('0x33')];if(!_0x140e43[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x265eac['limit']=qs[_0x2097('0x1f')](_0x140e43[_0x2097('0x34')][_0x2097('0x1f')]);_0x265eac[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x140e43['query'][_0x2097('0x1e')]);}_0x265eac[_0x2097('0x3c')]=qs['sort'](_0x140e43['query']['sort']);_0x265eac[_0x2097('0x3e')]=qs[_0x2097('0x36')](_[_0x2097('0x55')](_0x140e43[_0x2097('0x34')],_0x275578[_0x2097('0x36')]));if(_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]){_0x265eac[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x265eac['where'],{'$or':_['map'](_0x265eac[_0x2097('0x38')],function(_0x34d832){var _0x1eeb30={};_0x1eeb30[_0x34d832]={'$like':'%'+_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1eeb30;})});}_0x265eac[_0x2097('0x3e')]=_['merge'](_0x265eac[_0x2097('0x3e')],{'mailboxuser':_0x56cfbf[_0x2097('0x56')]});_0x265eac=_[_0x2097('0x40')]({},_0x265eac,_0x140e43[_0x2097('0x49')]);return db['VoiceMailMessage']['findAndCountAll'](_0x265eac)[_0x2097('0x26')](respondWithFilteredResult(_0x24f166,_0x265eac));})[_0x2097('0x46')](handleError(_0x24f166,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9480e7f..26f46c3 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 _0x042c=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x042c,0x1e8));var _0xc042=function(_0x3c0d18,_0x22d674){_0x3c0d18=_0x3c0d18-0x0;var _0xadee69=_0x042c[_0x3c0d18];return _0xadee69;};'use strict';var _=require('lodash');var util=require(_0xc042('0x0'));var logger=require(_0xc042('0x1'))(_0xc042('0x2'));var moment=require(_0xc042('0x3'));var BPromise=require(_0xc042('0x4'));var rp=require(_0xc042('0x5'));var fs=require('fs');var path=require(_0xc042('0x6'));var rimraf=require(_0xc042('0x7'));var config=require(_0xc042('0x8'));var attributes=require(_0xc042('0x9'));module[_0xc042('0xa')]=function(_0x3ee415,_0x23448a){return _0x3ee415[_0xc042('0xb')](_0xc042('0xc'),attributes,{'tableName':_0xc042('0xd'),'paranoid':![],'indexes':[{'name':_0xc042('0xe'),'fields':[_0xc042('0xf'),_0xc042('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc006=['../../config/environment','exports','voice_voicemail','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1293fa,_0x446d6b){var _0x1dd054=function(_0x1b2d93){while(--_0x1b2d93){_0x1293fa['push'](_0x1293fa['shift']());}};_0x1dd054(++_0x446d6b);}(_0xc006,0x79));var _0x6c00=function(_0x50ebc0,_0x143df8){_0x50ebc0=_0x50ebc0-0x0;var _0x173b25=_0xc006[_0x50ebc0];return _0x173b25;};'use strict';var _=require(_0x6c00('0x0'));var util=require(_0x6c00('0x1'));var logger=require(_0x6c00('0x2'))(_0x6c00('0x3'));var moment=require(_0x6c00('0x4'));var BPromise=require(_0x6c00('0x5'));var rp=require(_0x6c00('0x6'));var fs=require('fs');var path=require(_0x6c00('0x7'));var rimraf=require(_0x6c00('0x8'));var config=require(_0x6c00('0x9'));var attributes=require('./voiceMail.attributes');module[_0x6c00('0xa')]=function(_0x26da50,_0xba692c){return _0x26da50['define']('VoiceMail',attributes,{'tableName':_0x6c00('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x6c00('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index afba719..07ccc24 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 _0xe1fb=['request','then','info','debug','request\x20sent','stringify','error','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x54b5bd,_0x133fe1){var _0xcba844=function(_0x4023dc){while(--_0x4023dc){_0x54b5bd['push'](_0x54b5bd['shift']());}};_0xcba844(++_0x133fe1);}(_0xe1fb,0x95));var _0xbe1f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe1fb[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xbe1f('0x0'));var util=require(_0xbe1f('0x1'));var moment=require(_0xbe1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe1f('0x3'));var fs=require('fs');var Redis=require(_0xbe1f('0x4'));var db=require(_0xbe1f('0x5'))['db'];var utils=require(_0xbe1f('0x6'));var logger=require(_0xbe1f('0x7'))(_0xbe1f('0x8'));var config=require(_0xbe1f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe1f('0xa')][_0xbe1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb08b46,_0x4a4e82,_0x33e34a){return new BPromise(function(_0x598a89,_0x7f359c){return client[_0xbe1f('0xc')](_0xb08b46,_0x33e34a)[_0xbe1f('0xd')](function(_0x22b242){logger[_0xbe1f('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4a4e82,'request\x20sent');logger[_0xbe1f('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4a4e82,_0xbe1f('0x10'),JSON[_0xbe1f('0x11')](_0x22b242));if(_0x22b242[_0xbe1f('0x12')]){if(_0x22b242['error']['code']===0x1f4){logger[_0xbe1f('0x12')]('VoiceMail,\x20%s,\x20%s',_0x4a4e82,_0x22b242['error']['message']);return _0x7f359c(_0x22b242[_0xbe1f('0x12')][_0xbe1f('0x13')]);}logger[_0xbe1f('0x12')](_0xbe1f('0x14'),_0x4a4e82,_0x22b242['error']['message']);return _0x598a89(_0x22b242[_0xbe1f('0x12')][_0xbe1f('0x13')]);}else{logger['info'](_0xbe1f('0x14'),_0x4a4e82,_0xbe1f('0x10'));_0x598a89(_0x22b242[_0xbe1f('0x15')][_0xbe1f('0x13')]);}})[_0xbe1f('0x16')](function(_0x1bc7cf){logger[_0xbe1f('0x12')](_0xbe1f('0x14'),_0x4a4e82,_0x1bc7cf);_0x7f359c(_0x1bc7cf);});});} \ No newline at end of file +var _0x7b71=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x5cacd3,_0x292f47){var _0x3a40ba=function(_0x3df483){while(--_0x3df483){_0x5cacd3['push'](_0x5cacd3['shift']());}};_0x3a40ba(++_0x292f47);}(_0x7b71,0x1ec));var _0x17b7=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0x7b71[_0x254d9f];return _0x1eedb9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x17b7('0x0'));var BPromise=require(_0x17b7('0x1'));var rs=require(_0x17b7('0x2'));var fs=require('fs');var Redis=require(_0x17b7('0x3'));var db=require(_0x17b7('0x4'))['db'];var utils=require(_0x17b7('0x5'));var logger=require(_0x17b7('0x6'))('rpc');var config=require(_0x17b7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x17b7('0x8')][_0x17b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6e0088,_0x3eb44b,_0x4c28ef){return new BPromise(function(_0x11e641,_0x4e0064){return client[_0x17b7('0xa')](_0x6e0088,_0x4c28ef)[_0x17b7('0xb')](function(_0x43323d){logger['info'](_0x17b7('0xc'),_0x3eb44b,_0x17b7('0xd'));logger[_0x17b7('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3eb44b,_0x17b7('0xd'),JSON[_0x17b7('0xf')](_0x43323d));if(_0x43323d['error']){if(_0x43323d['error'][_0x17b7('0x10')]===0x1f4){logger[_0x17b7('0x11')](_0x17b7('0xc'),_0x3eb44b,_0x43323d[_0x17b7('0x11')][_0x17b7('0x12')]);return _0x4e0064(_0x43323d[_0x17b7('0x11')][_0x17b7('0x12')]);}logger[_0x17b7('0x11')]('VoiceMail,\x20%s,\x20%s',_0x3eb44b,_0x43323d[_0x17b7('0x11')][_0x17b7('0x12')]);return _0x11e641(_0x43323d[_0x17b7('0x11')][_0x17b7('0x12')]);}else{logger['info'](_0x17b7('0xc'),_0x3eb44b,_0x17b7('0xd'));_0x11e641(_0x43323d[_0x17b7('0x13')][_0x17b7('0x12')]);}})[_0x17b7('0x14')](function(_0x56c90c){logger['error'](_0x17b7('0xc'),_0x3eb44b,_0x56c90c);_0x4e0064(_0x56c90c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 72843ba..d788658 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 _0xde2c=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0xde2c,0xa0));var _0xcde2=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0xde2c[_0x256e32];return _0x464070;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require('connect-timeout');var express=require(_0xcde2('0x3'));var router=express[_0xcde2('0x4')]();var fs_extra=require(_0xcde2('0x5'));var auth=require(_0xcde2('0x6'));var interaction=require(_0xcde2('0x7'));var config=require(_0xcde2('0x8'));var controller=require('./voiceMailMessage.controller');router[_0xcde2('0x9')]('/',auth['isAuthenticated'](),controller[_0xcde2('0xa')]);router[_0xcde2('0x9')](_0xcde2('0xb'),auth[_0xcde2('0xc')](),controller[_0xcde2('0xd')]);router[_0xcde2('0x9')](_0xcde2('0xe'),auth[_0xcde2('0xc')](),controller[_0xcde2('0xf')]);router[_0xcde2('0x10')]('/',auth[_0xcde2('0xc')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')](_0xcde2('0xb'),auth[_0xcde2('0xc')](),controller[_0xcde2('0x13')]);router['delete'](_0xcde2('0xb'),auth[_0xcde2('0xc')](),controller[_0xcde2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4050=['show','download','post','create','put','/:id','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x12c6fe,_0x14215c){var _0x4b8491=function(_0x456abe){while(--_0x456abe){_0x12c6fe['push'](_0x12c6fe['shift']());}};_0x4b8491(++_0x14215c);}(_0x4050,0xd6));var _0x0405=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x4050[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x0405('0x0'));var util=require(_0x0405('0x1'));var path=require(_0x0405('0x2'));var timeout=require('connect-timeout');var express=require(_0x0405('0x3'));var router=express[_0x0405('0x4')]();var fs_extra=require(_0x0405('0x5'));var auth=require(_0x0405('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x0405('0x7')]('/',auth[_0x0405('0x8')](),controller[_0x0405('0x9')]);router[_0x0405('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0405('0xa')]);router[_0x0405('0x7')]('/:id/download',auth[_0x0405('0x8')](),controller[_0x0405('0xb')]);router[_0x0405('0xc')]('/',auth[_0x0405('0x8')](),controller[_0x0405('0xd')]);router[_0x0405('0xe')](_0x0405('0xf'),auth[_0x0405('0x8')](),controller['update']);router['delete']('/:id',auth[_0x0405('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 267b208..7f74ab6 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 _0x3202=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','STRING','long'];(function(_0x100332,_0x300bc1){var _0x240e9c=function(_0x122fcc){while(--_0x122fcc){_0x100332['push'](_0x100332['shift']());}};_0x240e9c(++_0x300bc1);}(_0x3202,0x1c4));var _0x2320=function(_0x519a3c,_0x46474a){_0x519a3c=_0x519a3c-0x0;var _0x103c8e=_0x3202[_0x519a3c];return _0x103c8e;};'use strict';var Sequelize=require(_0x2320('0x0'));module['exports']={'name':{'type':Sequelize[_0x2320('0x1')],'get':function(_0x1b26ee){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2320('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x2320('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x2320('0x2')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x2320('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x2320('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x2320('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0x2320('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x2320('0x2')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x2320('0x4')](_0x2320('0x5'))}}; \ No newline at end of file +var _0xa28b=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','BLOB'];(function(_0x1a309d,_0x201f52){var _0x1f7f0f=function(_0x425840){while(--_0x425840){_0x1a309d['push'](_0x1a309d['shift']());}};_0x1f7f0f(++_0x201f52);}(_0xa28b,0x176));var _0xba28=function(_0x43289c,_0x506805){_0x43289c=_0x43289c-0x0;var _0x29663=_0xa28b[_0x43289c];return _0x29663;};'use strict';var Sequelize=require(_0xba28('0x0'));module[_0xba28('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e4a88){return this[_0xba28('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xba28('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xba28('0x5')](_0xba28('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xba28('0x4')],'defaultValue':''},'stamp':{'type':_0xba28('0x7'),'defaultValue':Sequelize[_0xba28('0x8')](_0xba28('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e019404..0967381 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 _0x62f2=['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','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','find','catch','create','body','params','download','recording','msg_id','ValidationError','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x352661,_0x268083){var _0xf30541=function(_0x53aa97){while(--_0x53aa97){_0x352661['push'](_0x352661['shift']());}};_0xf30541(++_0x268083);}(_0x62f2,0xeb));var _0x262f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x62f2[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x262f('0x0'));var rimraf=require(_0x262f('0x1'));var zipdir=require(_0x262f('0x2'));var jsonpatch=require(_0x262f('0x3'));var rp=require('request-promise');var moment=require(_0x262f('0x4'));var BPromise=require(_0x262f('0x5'));var Mustache=require('mustache');var util=require(_0x262f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x262f('0x7'));var ejs=require(_0x262f('0x8'));var fs=require('fs');var fs_extra=require(_0x262f('0x9'));var _=require(_0x262f('0xa'));var squel=require(_0x262f('0xb'));var crypto=require(_0x262f('0xc'));var jsforce=require(_0x262f('0xd'));var deskjs=require(_0x262f('0xe'));var toCsv=require(_0x262f('0x7'));var querystring=require('querystring');var Papa=require(_0x262f('0xf'));var Redis=require(_0x262f('0x10'));var authService=require(_0x262f('0x11'));var qs=require(_0x262f('0x12'));var as=require(_0x262f('0x13'));var hardwareService=require(_0x262f('0x14'));var logger=require(_0x262f('0x15'))('api');var utils=require(_0x262f('0x16'));var config=require(_0x262f('0x17'));var licenseUtil=require(_0x262f('0x18'));var db=require(_0x262f('0x19'))['db'];function respondWithStatusCode(_0x5d0442,_0x201e24){_0x201e24=_0x201e24||0xcc;return function(_0x519519){if(_0x519519){return _0x5d0442[_0x262f('0x1a')](_0x201e24);}return _0x5d0442[_0x262f('0x1b')](_0x201e24)[_0x262f('0x1c')]();};}function respondWithResult(_0x28a1a7,_0x278a92){_0x278a92=_0x278a92||0xc8;return function(_0x44a795){if(_0x44a795){return _0x28a1a7[_0x262f('0x1b')](_0x278a92)[_0x262f('0x1d')](_0x44a795);}};}function respondWithFilteredResult(_0x375854,_0xabd8f4){return function(_0x2e0737){if(_0x2e0737){var _0x5ccb21=typeof _0xabd8f4[_0x262f('0x1e')]===_0x262f('0x1f')&&typeof _0xabd8f4[_0x262f('0x20')]==='undefined';var _0x401181=_0x2e0737['count'];var _0x45afeb=_0x5ccb21?0x0:_0xabd8f4[_0x262f('0x1e')];var _0x168366=_0x5ccb21?_0x2e0737[_0x262f('0x21')]:_0xabd8f4[_0x262f('0x1e')]+_0xabd8f4[_0x262f('0x20')];var _0x389f66;if(_0x168366>=_0x401181){_0x168366=_0x401181;_0x389f66=0xc8;}else{_0x389f66=0xce;}_0x375854[_0x262f('0x1b')](_0x389f66);return _0x375854[_0x262f('0x22')]('Content-Range',_0x45afeb+'-'+_0x168366+'/'+_0x401181)['json'](_0x2e0737);}return null;};}function patchUpdates(_0x5bd56a){return function(_0x3f54b0){try{jsonpatch[_0x262f('0x23')](_0x3f54b0,_0x5bd56a,!![]);}catch(_0x5234d8){return BPromise[_0x262f('0x24')](_0x5234d8);}return _0x3f54b0[_0x262f('0x25')]();};}function saveUpdates(_0x4f0bf4,_0x2df492){return function(_0x2d8d20){if(_0x2d8d20){return _0x2d8d20[_0x262f('0x26')](_0x4f0bf4)[_0x262f('0x27')](function(_0x2c6434){return _0x2c6434;});}return null;};}function removeEntity(_0x318f66,_0x1a93bf){return function(_0x1c73d7){if(_0x1c73d7){return _0x1c73d7[_0x262f('0x28')]()['then'](function(){_0x318f66[_0x262f('0x1b')](0xcc)[_0x262f('0x1c')]();});}};}function handleEntityNotFound(_0x67ecd0,_0x27f49a){return function(_0xdf3573){if(!_0xdf3573){_0x67ecd0[_0x262f('0x1a')](0x194);}return _0xdf3573;};}function handleError(_0x2e78ed,_0x3386ad){_0x3386ad=_0x3386ad||0x1f4;return function(_0x57afa1){logger[_0x262f('0x29')](_0x57afa1['stack']);if(_0x57afa1[_0x262f('0x2a')]){delete _0x57afa1['name'];}_0x2e78ed['status'](_0x3386ad)[_0x262f('0x2b')](_0x57afa1);};}exports[_0x262f('0x2c')]=function(_0xe753f0,_0x3d4718){var _0x4d606d={},_0x541a5a={},_0x2fe84b={'count':0x0,'rows':[]};var _0x5a1688=_[_0x262f('0x2d')](db[_0x262f('0x2e')][_0x262f('0x2f')],function(_0x171c9d){return{'name':_0x171c9d[_0x262f('0x30')],'type':_0x171c9d[_0x262f('0x31')]['key']};});_0x541a5a[_0x262f('0x32')]=_[_0x262f('0x33')](_[_0x262f('0x2d')](_0x5a1688,'name'),[_0x262f('0x2a')]);_0x541a5a[_0x262f('0x34')]=_[_0x262f('0x35')](_0xe753f0[_0x262f('0x34')]);_0x541a5a[_0x262f('0x36')]=_['intersection'](_0x541a5a['model'],_0x541a5a[_0x262f('0x34')]);_0x4d606d[_0x262f('0x37')]=_[_0x262f('0x38')](_0x541a5a['model'],qs[_0x262f('0x39')](_0xe753f0[_0x262f('0x34')]['fields']));_0x4d606d[_0x262f('0x37')]=_0x4d606d[_0x262f('0x37')][_0x262f('0x3a')]?_0x4d606d['attributes']:_0x541a5a[_0x262f('0x32')];if(!_0xe753f0[_0x262f('0x34')][_0x262f('0x3b')](_0x262f('0x3c'))){_0x4d606d[_0x262f('0x20')]=qs[_0x262f('0x20')](_0xe753f0['query'][_0x262f('0x20')]);_0x4d606d[_0x262f('0x1e')]=qs['offset'](_0xe753f0[_0x262f('0x34')][_0x262f('0x1e')]);}_0x4d606d[_0x262f('0x3d')]=qs[_0x262f('0x3e')](_0xe753f0[_0x262f('0x34')][_0x262f('0x3e')]);_0x4d606d['where']=qs['filters'](_['pick'](_0xe753f0[_0x262f('0x34')],_0x541a5a[_0x262f('0x36')]),_0x5a1688);if(_0xe753f0['query'][_0x262f('0x3f')]){_0x4d606d[_0x262f('0x40')]=_[_0x262f('0x41')](_0x4d606d[_0x262f('0x40')],{'$or':_[_0x262f('0x2d')](_0x5a1688,function(_0x55ba9a){if(_0x55ba9a[_0x262f('0x31')]!==_0x262f('0x42')){var _0x24c932={};_0x24c932[_0x55ba9a[_0x262f('0x2a')]]={'$like':'%'+_0xe753f0[_0x262f('0x34')][_0x262f('0x3f')]+'%'};return _0x24c932;}})});}_0x4d606d=_[_0x262f('0x41')]({},_0x4d606d,_0xe753f0['options']);var _0x5a7eec={'where':_0x4d606d[_0x262f('0x40')]};return db['VoiceMailMessage'][_0x262f('0x21')](_0x5a7eec)[_0x262f('0x27')](function(_0x564349){_0x2fe84b[_0x262f('0x21')]=_0x564349;if(_0xe753f0['query'][_0x262f('0x43')]){_0x4d606d[_0x262f('0x44')]=[{'all':!![]}];}return db[_0x262f('0x2e')][_0x262f('0x45')](_0x4d606d);})[_0x262f('0x27')](function(_0x1abe78){_0x2fe84b['rows']=_0x1abe78;return _0x2fe84b;})['then'](respondWithFilteredResult(_0x3d4718,_0x4d606d))['catch'](handleError(_0x3d4718,null));};exports[_0x262f('0x46')]=function(_0x3f2b92,_0x564d59){var _0x30943d={'raw':!![],'where':{'id':_0x3f2b92['params']['id']}},_0x758633={};_0x758633['model']=_['keys'](db['VoiceMailMessage'][_0x262f('0x2f')]);_0x758633[_0x262f('0x34')]=_['keys'](_0x3f2b92[_0x262f('0x34')]);_0x758633[_0x262f('0x36')]=_[_0x262f('0x38')](_0x758633['model'],_0x758633[_0x262f('0x34')]);_0x30943d[_0x262f('0x37')]=_['intersection'](_0x758633[_0x262f('0x32')],qs[_0x262f('0x39')](_0x3f2b92[_0x262f('0x34')][_0x262f('0x39')]));_0x30943d[_0x262f('0x37')]=_0x30943d['attributes'][_0x262f('0x3a')]?_0x30943d[_0x262f('0x37')]:_0x758633[_0x262f('0x32')];if(_0x3f2b92[_0x262f('0x34')][_0x262f('0x43')]){_0x30943d[_0x262f('0x44')]=[{'all':!![]}];}_0x30943d=_[_0x262f('0x41')]({},_0x30943d,_0x3f2b92['options']);return db['VoiceMailMessage'][_0x262f('0x47')](_0x30943d)[_0x262f('0x27')](handleEntityNotFound(_0x564d59,null))[_0x262f('0x27')](respondWithResult(_0x564d59,null))[_0x262f('0x48')](handleError(_0x564d59,null));};exports['create']=function(_0x3465fe,_0xfc274d){return db[_0x262f('0x2e')][_0x262f('0x49')](_0x3465fe[_0x262f('0x4a')],{})[_0x262f('0x27')](respondWithResult(_0xfc274d,0xc9))[_0x262f('0x48')](handleError(_0xfc274d,null));};exports['update']=function(_0x1d5044,_0x499b06){if(_0x1d5044[_0x262f('0x4a')]['id']){delete _0x1d5044[_0x262f('0x4a')]['id'];}return db['VoiceMailMessage'][_0x262f('0x47')]({'where':{'id':_0x1d5044[_0x262f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x499b06,null))[_0x262f('0x27')](saveUpdates(_0x1d5044['body'],null))['then'](respondWithResult(_0x499b06,null))['catch'](handleError(_0x499b06,null));};exports[_0x262f('0x28')]=function(_0x110808,_0xdf43b1){return db[_0x262f('0x2e')][_0x262f('0x47')]({'where':{'id':_0x110808[_0x262f('0x4b')]['id']}})[_0x262f('0x27')](handleEntityNotFound(_0xdf43b1,null))['then'](removeEntity(_0xdf43b1,null))[_0x262f('0x48')](handleError(_0xdf43b1,null));};exports[_0x262f('0x4c')]=function(_0x310ea6,_0x20c14a,_0x5d8834){return db[_0x262f('0x2e')][_0x262f('0x47')]({'where':{'id':_0x310ea6[_0x262f('0x4b')]['id']},'attributes':['id',_0x262f('0x4d'),_0x262f('0x4e')]})[_0x262f('0x27')](handleEntityNotFound(_0x20c14a,null))[_0x262f('0x27')](function(_0x17b4f8){if(_0x17b4f8){if(!_0x17b4f8[_0x262f('0x4d')]){throw new db['Sequelize'][(_0x262f('0x4f'))]('VoiceMailMessage\x20not\x20found');}var _0x6e4cdd={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x17b4f8[_0x262f('0x4e')]){_0x6e4cdd[_0x262f('0x50')]=_0x262f('0x51')+_0x17b4f8[_0x262f('0x4e')]+_0x262f('0x52');}_0x20c14a['set'](_0x6e4cdd);return _0x20c14a[_0x262f('0x2b')](new Buffer(_0x17b4f8[_0x262f('0x4d')]));}})['catch'](handleError(_0x20c14a,null));}; \ No newline at end of file +var _0x946a=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','update','then','sendStatus','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','map','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','recording','msg_id','Sequelize','ValidationError','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','zip-dir','moment'];(function(_0x4bf30f,_0x53fe8f){var _0x5bd38e=function(_0xc15c69){while(--_0xc15c69){_0x4bf30f['push'](_0x4bf30f['shift']());}};_0x5bd38e(++_0x53fe8f);}(_0x946a,0x1d1));var _0xa946=function(_0x1dbd4d,_0x36d53b){_0x1dbd4d=_0x1dbd4d-0x0;var _0x50f793=_0x946a[_0x1dbd4d];return _0x50f793;};'use strict';var emlformat=require(_0xa946('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa946('0x2'));var BPromise=require(_0xa946('0x3'));var Mustache=require(_0xa946('0x4'));var util=require(_0xa946('0x5'));var path=require('path');var sox=require(_0xa946('0x6'));var csv=require(_0xa946('0x7'));var ejs=require(_0xa946('0x8'));var fs=require('fs');var fs_extra=require(_0xa946('0x9'));var _=require(_0xa946('0xa'));var squel=require(_0xa946('0xb'));var crypto=require(_0xa946('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa946('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa946('0xe'));var Redis=require(_0xa946('0xf'));var authService=require(_0xa946('0x10'));var qs=require(_0xa946('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa946('0x12'));var utils=require('../../config/utils');var config=require(_0xa946('0x13'));var licenseUtil=require(_0xa946('0x14'));var db=require(_0xa946('0x15'))['db'];function respondWithStatusCode(_0xe02b33,_0x29a9f7){_0x29a9f7=_0x29a9f7||0xcc;return function(_0x34d749){if(_0x34d749){return _0xe02b33['sendStatus'](_0x29a9f7);}return _0xe02b33[_0xa946('0x16')](_0x29a9f7)[_0xa946('0x17')]();};}function respondWithResult(_0x9cf790,_0x4ad348){_0x4ad348=_0x4ad348||0xc8;return function(_0x551873){if(_0x551873){return _0x9cf790[_0xa946('0x16')](_0x4ad348)[_0xa946('0x18')](_0x551873);}};}function respondWithFilteredResult(_0x5f3c62,_0xba7a1e){return function(_0x5478e7){if(_0x5478e7){var _0x36818d=typeof _0xba7a1e['offset']===_0xa946('0x19')&&typeof _0xba7a1e['limit']===_0xa946('0x19');var _0x428565=_0x5478e7[_0xa946('0x1a')];var _0xb7f512=_0x36818d?0x0:_0xba7a1e[_0xa946('0x1b')];var _0xf0694=_0x36818d?_0x5478e7['count']:_0xba7a1e[_0xa946('0x1b')]+_0xba7a1e[_0xa946('0x1c')];var _0x836444;if(_0xf0694>=_0x428565){_0xf0694=_0x428565;_0x836444=0xc8;}else{_0x836444=0xce;}_0x5f3c62[_0xa946('0x16')](_0x836444);return _0x5f3c62[_0xa946('0x1d')]('Content-Range',_0xb7f512+'-'+_0xf0694+'/'+_0x428565)[_0xa946('0x18')](_0x5478e7);}return null;};}function patchUpdates(_0x5b8292){return function(_0x5e6cf2){try{jsonpatch[_0xa946('0x1e')](_0x5e6cf2,_0x5b8292,!![]);}catch(_0x34f978){return BPromise['reject'](_0x34f978);}return _0x5e6cf2['save']();};}function saveUpdates(_0x20a634,_0x4fce16){return function(_0x37adfd){if(_0x37adfd){return _0x37adfd[_0xa946('0x1f')](_0x20a634)[_0xa946('0x20')](function(_0x392ffb){return _0x392ffb;});}return null;};}function removeEntity(_0x164f8f,_0x33920f){return function(_0x7592f3){if(_0x7592f3){return _0x7592f3['destroy']()[_0xa946('0x20')](function(){_0x164f8f[_0xa946('0x16')](0xcc)[_0xa946('0x17')]();});}};}function handleEntityNotFound(_0x2a17d1,_0x190693){return function(_0x4f9123){if(!_0x4f9123){_0x2a17d1[_0xa946('0x21')](0x194);}return _0x4f9123;};}function handleError(_0x215220,_0x2a7caa){_0x2a7caa=_0x2a7caa||0x1f4;return function(_0x48eb8c){logger[_0xa946('0x22')](_0x48eb8c[_0xa946('0x23')]);if(_0x48eb8c[_0xa946('0x24')]){delete _0x48eb8c[_0xa946('0x24')];}_0x215220[_0xa946('0x16')](_0x2a7caa)[_0xa946('0x25')](_0x48eb8c);};}exports[_0xa946('0x26')]=function(_0x34e143,_0x14b0f9){var _0x3d48f4={},_0x296ea6={},_0x2c0df0={'count':0x0,'rows':[]};var _0x1948cb=_['map'](db[_0xa946('0x27')][_0xa946('0x28')],function(_0x5ec44e){return{'name':_0x5ec44e[_0xa946('0x29')],'type':_0x5ec44e[_0xa946('0x2a')]['key']};});_0x296ea6[_0xa946('0x2b')]=_[_0xa946('0x2c')](_[_0xa946('0x2d')](_0x1948cb,_0xa946('0x24')),[_0xa946('0x24')]);_0x296ea6['query']=_[_0xa946('0x2e')](_0x34e143[_0xa946('0x2f')]);_0x296ea6[_0xa946('0x30')]=_[_0xa946('0x31')](_0x296ea6[_0xa946('0x2b')],_0x296ea6['query']);_0x3d48f4['attributes']=_['intersection'](_0x296ea6['model'],qs[_0xa946('0x32')](_0x34e143[_0xa946('0x2f')]['fields']));_0x3d48f4[_0xa946('0x33')]=_0x3d48f4['attributes'][_0xa946('0x34')]?_0x3d48f4[_0xa946('0x33')]:_0x296ea6[_0xa946('0x2b')];if(!_0x34e143['query']['hasOwnProperty']('nolimit')){_0x3d48f4['limit']=qs[_0xa946('0x1c')](_0x34e143[_0xa946('0x2f')][_0xa946('0x1c')]);_0x3d48f4[_0xa946('0x1b')]=qs[_0xa946('0x1b')](_0x34e143[_0xa946('0x2f')]['offset']);}_0x3d48f4[_0xa946('0x35')]=qs[_0xa946('0x36')](_0x34e143[_0xa946('0x2f')][_0xa946('0x36')]);_0x3d48f4[_0xa946('0x37')]=qs[_0xa946('0x30')](_[_0xa946('0x38')](_0x34e143[_0xa946('0x2f')],_0x296ea6['filters']),_0x1948cb);if(_0x34e143[_0xa946('0x2f')][_0xa946('0x39')]){_0x3d48f4[_0xa946('0x37')]=_['merge'](_0x3d48f4[_0xa946('0x37')],{'$or':_[_0xa946('0x2d')](_0x1948cb,function(_0x10c750){if(_0x10c750[_0xa946('0x2a')]!==_0xa946('0x3a')){var _0x580269={};_0x580269[_0x10c750[_0xa946('0x24')]]={'$like':'%'+_0x34e143[_0xa946('0x2f')][_0xa946('0x39')]+'%'};return _0x580269;}})});}_0x3d48f4=_[_0xa946('0x3b')]({},_0x3d48f4,_0x34e143[_0xa946('0x3c')]);var _0x1823c2={'where':_0x3d48f4[_0xa946('0x37')]};return db[_0xa946('0x27')][_0xa946('0x1a')](_0x1823c2)[_0xa946('0x20')](function(_0x19f935){_0x2c0df0[_0xa946('0x1a')]=_0x19f935;if(_0x34e143[_0xa946('0x2f')][_0xa946('0x3d')]){_0x3d48f4['include']=[{'all':!![]}];}return db[_0xa946('0x27')][_0xa946('0x3e')](_0x3d48f4);})['then'](function(_0x30ed01){_0x2c0df0[_0xa946('0x3f')]=_0x30ed01;return _0x2c0df0;})[_0xa946('0x20')](respondWithFilteredResult(_0x14b0f9,_0x3d48f4))['catch'](handleError(_0x14b0f9,null));};exports[_0xa946('0x40')]=function(_0x3ebdf1,_0x56fac8){var _0x287416={'raw':!![],'where':{'id':_0x3ebdf1['params']['id']}},_0x2cab7b={};_0x2cab7b[_0xa946('0x2b')]=_[_0xa946('0x2e')](db[_0xa946('0x27')][_0xa946('0x28')]);_0x2cab7b[_0xa946('0x2f')]=_[_0xa946('0x2e')](_0x3ebdf1['query']);_0x2cab7b[_0xa946('0x30')]=_[_0xa946('0x31')](_0x2cab7b['model'],_0x2cab7b['query']);_0x287416[_0xa946('0x33')]=_[_0xa946('0x31')](_0x2cab7b[_0xa946('0x2b')],qs[_0xa946('0x32')](_0x3ebdf1[_0xa946('0x2f')][_0xa946('0x32')]));_0x287416['attributes']=_0x287416[_0xa946('0x33')][_0xa946('0x34')]?_0x287416[_0xa946('0x33')]:_0x2cab7b[_0xa946('0x2b')];if(_0x3ebdf1[_0xa946('0x2f')]['includeAll']){_0x287416[_0xa946('0x41')]=[{'all':!![]}];}_0x287416=_[_0xa946('0x3b')]({},_0x287416,_0x3ebdf1[_0xa946('0x3c')]);return db[_0xa946('0x27')][_0xa946('0x42')](_0x287416)[_0xa946('0x20')](handleEntityNotFound(_0x56fac8,null))['then'](respondWithResult(_0x56fac8,null))[_0xa946('0x43')](handleError(_0x56fac8,null));};exports[_0xa946('0x44')]=function(_0x400971,_0x187b47){return db[_0xa946('0x27')][_0xa946('0x44')](_0x400971[_0xa946('0x45')],{})['then'](respondWithResult(_0x187b47,0xc9))[_0xa946('0x43')](handleError(_0x187b47,null));};exports[_0xa946('0x1f')]=function(_0x387139,_0x2d62f3){if(_0x387139[_0xa946('0x45')]['id']){delete _0x387139[_0xa946('0x45')]['id'];}return db['VoiceMailMessage'][_0xa946('0x42')]({'where':{'id':_0x387139[_0xa946('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d62f3,null))[_0xa946('0x20')](saveUpdates(_0x387139[_0xa946('0x45')],null))[_0xa946('0x20')](respondWithResult(_0x2d62f3,null))[_0xa946('0x43')](handleError(_0x2d62f3,null));};exports['destroy']=function(_0x3d0aad,_0x677c40){return db[_0xa946('0x27')]['find']({'where':{'id':_0x3d0aad['params']['id']}})['then'](handleEntityNotFound(_0x677c40,null))[_0xa946('0x20')](removeEntity(_0x677c40,null))['catch'](handleError(_0x677c40,null));};exports['download']=function(_0x344918,_0xd64c92,_0x3f2413){return db[_0xa946('0x27')][_0xa946('0x42')]({'where':{'id':_0x344918[_0xa946('0x46')]['id']},'attributes':['id',_0xa946('0x47'),_0xa946('0x48')]})['then'](handleEntityNotFound(_0xd64c92,null))['then'](function(_0x5b9cca){if(_0x5b9cca){if(!_0x5b9cca[_0xa946('0x47')]){throw new db[(_0xa946('0x49'))][(_0xa946('0x4a'))]('VoiceMailMessage\x20not\x20found');}var _0x10129a={'Content-Type':'audio/wav','Content-Disposition':_0xa946('0x4b')};if(_0x5b9cca[_0xa946('0x48')]){_0x10129a[_0xa946('0x4c')]=_0xa946('0x4d')+_0x5b9cca[_0xa946('0x48')]+'.wav\x22';}_0xd64c92['set'](_0x10129a);return _0xd64c92[_0xa946('0x25')](new Buffer(_0x5b9cca[_0xa946('0x47')]));}})[_0xa946('0x43')](handleError(_0xd64c92,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c43a834..3bcadee 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 _0x0081=['define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0081,0x19c));var _0x1008=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0081[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x1008('0x0'));var logger=require(_0x1008('0x1'))(_0x1008('0x2'));var moment=require('moment');var BPromise=require(_0x1008('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1008('0x4'));var config=require(_0x1008('0x5'));var attributes=require(_0x1008('0x6'));module[_0x1008('0x7')]=function(_0x15110d,_0x398ab2){return _0x15110d[_0x1008('0x8')](_0x1008('0x9'),attributes,{'tableName':_0x1008('0xa'),'paranoid':![],'indexes':[{'name':_0x1008('0xb'),'fields':[_0x1008('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2d36=['dir','lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x3c7f1d,_0x44b37b){var _0xd7ab0c=function(_0x1dd6b2){while(--_0x1dd6b2){_0x3c7f1d['push'](_0x3c7f1d['shift']());}};_0xd7ab0c(++_0x44b37b);}(_0x2d36,0xb7));var _0x62d3=function(_0x308873,_0x27d277){_0x308873=_0x308873-0x0;var _0x3d64c6=_0x2d36[_0x308873];return _0x3d64c6;};'use strict';var _=require(_0x62d3('0x0'));var util=require(_0x62d3('0x1'));var logger=require(_0x62d3('0x2'))(_0x62d3('0x3'));var moment=require('moment');var BPromise=require(_0x62d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62d3('0x5'));var rimraf=require(_0x62d3('0x6'));var config=require('../../config/environment');var attributes=require(_0x62d3('0x7'));module[_0x62d3('0x8')]=function(_0x26186f,_0x5c7f24){return _0x26186f[_0x62d3('0x9')](_0x62d3('0xa'),attributes,{'tableName':_0x62d3('0xb'),'paranoid':![],'indexes':[{'name':_0x62d3('0xc'),'fields':[_0x62d3('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 510773d..a12ec0e 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 _0xf8ec=['client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0xb12aa0,_0x5f2dd5){var _0xd1ce36=function(_0x20df23){while(--_0x20df23){_0xb12aa0['push'](_0xb12aa0['shift']());}};_0xd1ce36(++_0x5f2dd5);}(_0xf8ec,0xb6));var _0xcf8e=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xf8ec[_0x264545];return _0x114d10;};'use strict';var _=require('lodash');var util=require(_0xcf8e('0x0'));var moment=require(_0xcf8e('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf8e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf8e('0x3'))['db'];var utils=require(_0xcf8e('0x4'));var logger=require('../../config/logger')(_0xcf8e('0x5'));var config=require('../../config/environment');var jayson=require(_0xcf8e('0x6'));var client=jayson[_0xcf8e('0x7')][_0xcf8e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x500f2f,_0x27feb5,_0x4e906f){return new BPromise(function(_0x3904e2,_0x37de9a){return client['request'](_0x500f2f,_0x4e906f)[_0xcf8e('0x9')](function(_0x152465){logger[_0xcf8e('0xa')](_0xcf8e('0xb'),_0x27feb5,'request\x20sent');logger[_0xcf8e('0xc')](_0xcf8e('0xd'),_0x27feb5,'request\x20sent',JSON[_0xcf8e('0xe')](_0x152465));if(_0x152465[_0xcf8e('0xf')]){if(_0x152465['error'][_0xcf8e('0x10')]===0x1f4){logger[_0xcf8e('0xf')](_0xcf8e('0xb'),_0x27feb5,_0x152465['error']['message']);return _0x37de9a(_0x152465[_0xcf8e('0xf')]['message']);}logger['error'](_0xcf8e('0xb'),_0x27feb5,_0x152465['error'][_0xcf8e('0x11')]);return _0x3904e2(_0x152465[_0xcf8e('0xf')][_0xcf8e('0x11')]);}else{logger[_0xcf8e('0xa')](_0xcf8e('0xb'),_0x27feb5,_0xcf8e('0x12'));_0x3904e2(_0x152465[_0xcf8e('0x13')][_0xcf8e('0x11')]);}})[_0xcf8e('0x14')](function(_0x204413){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x27feb5,_0x204413);_0x37de9a(_0x204413);});});} \ No newline at end of file +var _0x94bd=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x94bd,0x1a0));var _0xd94b=function(_0x82335b,_0x323175){_0x82335b=_0x82335b-0x0;var _0x530cff=_0x94bd[_0x82335b];return _0x530cff;};'use strict';var _=require('lodash');var util=require(_0xd94b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd94b('0x1'));var fs=require('fs');var Redis=require(_0xd94b('0x2'));var db=require(_0xd94b('0x3'))['db'];var utils=require(_0xd94b('0x4'));var logger=require(_0xd94b('0x5'))(_0xd94b('0x6'));var config=require(_0xd94b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd94b('0x8')][_0xd94b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xecf431,_0x501b6d,_0x4e26b9){return new BPromise(function(_0x5ed55e,_0x180042){return client['request'](_0xecf431,_0x4e26b9)[_0xd94b('0xa')](function(_0x1cab6b){logger[_0xd94b('0xb')](_0xd94b('0xc'),_0x501b6d,'request\x20sent');logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x501b6d,_0xd94b('0xd'),JSON[_0xd94b('0xe')](_0x1cab6b));if(_0x1cab6b[_0xd94b('0xf')]){if(_0x1cab6b[_0xd94b('0xf')][_0xd94b('0x10')]===0x1f4){logger[_0xd94b('0xf')](_0xd94b('0xc'),_0x501b6d,_0x1cab6b['error']['message']);return _0x180042(_0x1cab6b[_0xd94b('0xf')][_0xd94b('0x11')]);}logger[_0xd94b('0xf')](_0xd94b('0xc'),_0x501b6d,_0x1cab6b['error']['message']);return _0x5ed55e(_0x1cab6b['error']['message']);}else{logger[_0xd94b('0xb')](_0xd94b('0xc'),_0x501b6d,'request\x20sent');_0x5ed55e(_0x1cab6b[_0xd94b('0x12')][_0xd94b('0x11')]);}})[_0xd94b('0x13')](function(_0x540df2){logger[_0xd94b('0xf')](_0xd94b('0xc'),_0x501b6d,_0x540df2);_0x180042(_0x540df2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 95e49f5..43296a2 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 _0xe62e=['isAuthenticated','show','/:id/sounds','getSounds','create','addSound','put','delete','destroy','removeSound','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id'];(function(_0x4ca3b4,_0x2450bc){var _0x51ea64=function(_0x1bdfd4){while(--_0x1bdfd4){_0x4ca3b4['push'](_0x4ca3b4['shift']());}};_0x51ea64(++_0x2450bc);}(_0xe62e,0x83));var _0xee62=function(_0x4ecc6b,_0x498935){_0x4ecc6b=_0x4ecc6b-0x0;var _0x179239=_0xe62e[_0x4ecc6b];return _0x179239;};'use strict';var multer=require('multer');var util=require(_0xee62('0x0'));var path=require(_0xee62('0x1'));var timeout=require(_0xee62('0x2'));var express=require(_0xee62('0x3'));var router=express['Router']();var fs_extra=require(_0xee62('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xee62('0x5'));var config=require('../../config/environment');var controller=require(_0xee62('0x6'));router[_0xee62('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee62('0x7')](_0xee62('0x8'),auth[_0xee62('0x9')](),controller[_0xee62('0xa')]);router[_0xee62('0x7')](_0xee62('0xb'),auth[_0xee62('0x9')](),controller[_0xee62('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xee62('0xd')]);router['post'](_0xee62('0xb'),auth['isAuthenticated'](),controller[_0xee62('0xe')]);router[_0xee62('0xf')](_0xee62('0x8'),auth[_0xee62('0x9')](),controller['update']);router[_0xee62('0x10')](_0xee62('0x8'),auth[_0xee62('0x9')](),controller[_0xee62('0x11')]);router[_0xee62('0x10')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xee62('0x12')]);module[_0xee62('0x13')]=router; \ No newline at end of file +var _0x270e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','delete','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout','express'];(function(_0x41aa4d,_0x51e45f){var _0x3fb7d6=function(_0x3833ec){while(--_0x3833ec){_0x41aa4d['push'](_0x41aa4d['shift']());}};_0x3fb7d6(++_0x51e45f);}(_0x270e,0xe3));var _0xe270=function(_0x326ad4,_0x1744ac){_0x326ad4=_0x326ad4-0x0;var _0x58df34=_0x270e[_0x326ad4];return _0x58df34;};'use strict';var multer=require(_0xe270('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe270('0x1'));var express=require(_0xe270('0x2'));var router=express['Router']();var fs_extra=require(_0xe270('0x3'));var auth=require(_0xe270('0x4'));var interaction=require(_0xe270('0x5'));var config=require(_0xe270('0x6'));var controller=require(_0xe270('0x7'));router[_0xe270('0x8')]('/',auth[_0xe270('0x9')](),controller[_0xe270('0xa')]);router['get'](_0xe270('0xb'),auth[_0xe270('0x9')](),controller[_0xe270('0xc')]);router[_0xe270('0x8')](_0xe270('0xd'),auth[_0xe270('0x9')](),controller[_0xe270('0xe')]);router[_0xe270('0xf')]('/',auth[_0xe270('0x9')](),controller[_0xe270('0x10')]);router[_0xe270('0xf')](_0xe270('0xd'),auth[_0xe270('0x9')](),controller[_0xe270('0x11')]);router[_0xe270('0x12')](_0xe270('0xb'),auth[_0xe270('0x9')](),controller['update']);router[_0xe270('0x13')](_0xe270('0xb'),auth[_0xe270('0x9')](),controller['destroy']);router[_0xe270('0x13')](_0xe270('0x14'),auth[_0xe270('0x9')](),controller[_0xe270('0x15')]);module[_0xe270('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index cab2c69..e484429 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 _0xd9b5=['quietmp3nb','mp3','STRING','alpha','TIMESTAMP','sequelize','exports','name','custom','files','mp3nb'];(function(_0x67df80,_0x1f5b81){var _0x5e3d73=function(_0x5b9827){while(--_0x5b9827){_0x67df80['push'](_0x67df80['shift']());}};_0x5e3d73(++_0x1f5b81);}(_0xd9b5,0xcb));var _0x5d9b=function(_0x1a17a3,_0xa2ab44){_0x1a17a3=_0x1a17a3-0x0;var _0x32264f=_0xd9b5[_0x1a17a3];return _0x32264f;};'use strict';var Sequelize=require(_0x5d9b('0x0'));module[_0x5d9b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5d9b('0x2')},'mode':{'type':Sequelize['ENUM'](_0x5d9b('0x3'),_0x5d9b('0x4'),_0x5d9b('0x5'),_0x5d9b('0x6'),'quietmp3',_0x5d9b('0x7')),'allowNull':!![],'defaultValue':_0x5d9b('0x4')},'directory':{'type':Sequelize[_0x5d9b('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x5d9b('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5d9b('0x8')],'allowNull':!![],'defaultValue':_0x5d9b('0x9')},'format':{'type':Sequelize[_0x5d9b('0x8')],'allowNull':!![]},'stamp':{'type':_0x5d9b('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfbd8=['files','quietmp3nb','alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xfbd8,0x144));var _0x8fbd=function(_0x21c662,_0x4cc5d0){_0x21c662=_0x21c662-0x0;var _0x3aaade=_0xfbd8[_0x21c662];return _0x3aaade;};'use strict';var Sequelize=require(_0x8fbd('0x0'));module[_0x8fbd('0x1')]={'name':{'type':Sequelize[_0x8fbd('0x2')],'allowNull':![],'unique':_0x8fbd('0x3')},'mode':{'type':Sequelize[_0x8fbd('0x4')](_0x8fbd('0x5'),_0x8fbd('0x6'),'mp3nb',_0x8fbd('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x8fbd('0x6')},'directory':{'type':Sequelize[_0x8fbd('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8fbd('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8fbd('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8fbd('0x8')},'format':{'type':Sequelize[_0x8fbd('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x8fbd('0x9')],'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 9fe1294..d8038b8 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 _0x3a3a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','Sound','findOne','save_name','createdAt','root','server/files/sounds/converted','%s.%s','basename','extname','converted_format','format','symlinkSync','Sequelize','ValidationError','removeSound','id2','getSounds','eml-format','rimraf'];(function(_0x52f195,_0xbba422){var _0x50b809=function(_0x5111c7){while(--_0x5111c7){_0x52f195['push'](_0x52f195['shift']());}};_0x50b809(++_0xbba422);}(_0x3a3a,0x73));var _0xa3a3=function(_0x157ff8,_0x4f7e8b){_0x157ff8=_0x157ff8-0x0;var _0x99a208=_0x3a3a[_0x157ff8];return _0x99a208;};'use strict';var emlformat=require(_0xa3a3('0x0'));var rimraf=require(_0xa3a3('0x1'));var zipdir=require(_0xa3a3('0x2'));var jsonpatch=require(_0xa3a3('0x3'));var rp=require(_0xa3a3('0x4'));var moment=require(_0xa3a3('0x5'));var BPromise=require(_0xa3a3('0x6'));var Mustache=require(_0xa3a3('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa3a3('0x8'));var ejs=require(_0xa3a3('0x9'));var fs=require('fs');var fs_extra=require(_0xa3a3('0xa'));var _=require(_0xa3a3('0xb'));var squel=require(_0xa3a3('0xc'));var crypto=require(_0xa3a3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa3a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa3a3('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3a3('0x10'));var authService=require(_0xa3a3('0x11'));var qs=require(_0xa3a3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3a3('0x13'));var logger=require(_0xa3a3('0x14'))(_0xa3a3('0x15'));var utils=require(_0xa3a3('0x16'));var config=require(_0xa3a3('0x17'));var licenseUtil=require(_0xa3a3('0x18'));var db=require(_0xa3a3('0x19'))['db'];function respondWithStatusCode(_0x3f0313,_0x5d29b6){_0x5d29b6=_0x5d29b6||0xcc;return function(_0x5d9b98){if(_0x5d9b98){return _0x3f0313['sendStatus'](_0x5d29b6);}return _0x3f0313['status'](_0x5d29b6)[_0xa3a3('0x1a')]();};}function respondWithResult(_0x5f83f0,_0x5242f6){_0x5242f6=_0x5242f6||0xc8;return function(_0x3c001b){if(_0x3c001b){return _0x5f83f0[_0xa3a3('0x1b')](_0x5242f6)[_0xa3a3('0x1c')](_0x3c001b);}};}function respondWithFilteredResult(_0x164780,_0x1e7e98){return function(_0x3a43c1){if(_0x3a43c1){var _0x76ab17=typeof _0x1e7e98['offset']===_0xa3a3('0x1d')&&typeof _0x1e7e98[_0xa3a3('0x1e')]==='undefined';var _0x1669a6=_0x3a43c1[_0xa3a3('0x1f')];var _0x2abd0b=_0x76ab17?0x0:_0x1e7e98[_0xa3a3('0x20')];var _0x57f86d=_0x76ab17?_0x3a43c1[_0xa3a3('0x1f')]:_0x1e7e98['offset']+_0x1e7e98[_0xa3a3('0x1e')];var _0x42b44f;if(_0x57f86d>=_0x1669a6){_0x57f86d=_0x1669a6;_0x42b44f=0xc8;}else{_0x42b44f=0xce;}_0x164780[_0xa3a3('0x1b')](_0x42b44f);return _0x164780['set'](_0xa3a3('0x21'),_0x2abd0b+'-'+_0x57f86d+'/'+_0x1669a6)['json'](_0x3a43c1);}return null;};}function patchUpdates(_0x153f3c){return function(_0xbff8a4){try{jsonpatch['apply'](_0xbff8a4,_0x153f3c,!![]);}catch(_0x357590){return BPromise[_0xa3a3('0x22')](_0x357590);}return _0xbff8a4[_0xa3a3('0x23')]();};}function saveUpdates(_0x720899,_0x321c13){return function(_0x51417e){if(_0x51417e){return _0x51417e[_0xa3a3('0x24')](_0x720899)[_0xa3a3('0x25')](function(_0x3d171f){return _0x3d171f;});}return null;};}function removeEntity(_0x4cb3ea,_0x1faa06){return function(_0xaeaa03){if(_0xaeaa03){return _0xaeaa03[_0xa3a3('0x26')]()[_0xa3a3('0x25')](function(){var _0x4166da=_0xaeaa03[_0xa3a3('0x27')]({'plain':!![]});var _0x6ecea3='MusicOnHolds';return db['UserProfileResource'][_0xa3a3('0x26')]({'where':{'type':_0x6ecea3,'resourceId':_0x4166da['id']}})[_0xa3a3('0x25')](function(){return _0xaeaa03;});})[_0xa3a3('0x25')](function(){_0x4cb3ea[_0xa3a3('0x1b')](0xcc)[_0xa3a3('0x1a')]();});}};}function handleEntityNotFound(_0x5a52ab,_0x51766e){return function(_0x56d9fc){if(!_0x56d9fc){_0x5a52ab[_0xa3a3('0x28')](0x194);}return _0x56d9fc;};}function handleError(_0x446da6,_0x32ee3e){_0x32ee3e=_0x32ee3e||0x1f4;return function(_0x178daa){logger[_0xa3a3('0x29')](_0x178daa[_0xa3a3('0x2a')]);if(_0x178daa[_0xa3a3('0x2b')]){delete _0x178daa[_0xa3a3('0x2b')];}_0x446da6[_0xa3a3('0x1b')](_0x32ee3e)[_0xa3a3('0x2c')](_0x178daa);};}exports[_0xa3a3('0x2d')]=function(_0x32eec9,_0x4e0afe){var _0x28019e={},_0x4acb7e={},_0x29adda={'count':0x0,'rows':[]};var _0x50db65=_[_0xa3a3('0x2e')](db[_0xa3a3('0x2f')][_0xa3a3('0x30')],function(_0xa67906){return{'name':_0xa67906[_0xa3a3('0x31')],'type':_0xa67906['type']['key']};});_0x4acb7e[_0xa3a3('0x32')]=_['map'](_0x50db65,'name');_0x4acb7e['query']=_[_0xa3a3('0x33')](_0x32eec9['query']);_0x4acb7e[_0xa3a3('0x34')]=_['intersection'](_0x4acb7e[_0xa3a3('0x32')],_0x4acb7e[_0xa3a3('0x35')]);_0x28019e[_0xa3a3('0x36')]=_[_0xa3a3('0x37')](_0x4acb7e[_0xa3a3('0x32')],qs['fields'](_0x32eec9[_0xa3a3('0x35')][_0xa3a3('0x38')]));_0x28019e[_0xa3a3('0x36')]=_0x28019e['attributes'][_0xa3a3('0x39')]?_0x28019e[_0xa3a3('0x36')]:_0x4acb7e[_0xa3a3('0x32')];if(!_0x32eec9[_0xa3a3('0x35')][_0xa3a3('0x3a')](_0xa3a3('0x3b'))){_0x28019e[_0xa3a3('0x1e')]=qs[_0xa3a3('0x1e')](_0x32eec9[_0xa3a3('0x35')]['limit']);_0x28019e[_0xa3a3('0x20')]=qs[_0xa3a3('0x20')](_0x32eec9['query'][_0xa3a3('0x20')]);}_0x28019e[_0xa3a3('0x3c')]=qs[_0xa3a3('0x3d')](_0x32eec9['query']['sort']);delete _0x32eec9[_0xa3a3('0x35')][_0xa3a3('0x3d')];_0x28019e[_0xa3a3('0x3e')]=qs[_0xa3a3('0x34')](_[_0xa3a3('0x3f')](_0x32eec9[_0xa3a3('0x35')],_0x4acb7e[_0xa3a3('0x34')]),_0x50db65);if(_0x32eec9[_0xa3a3('0x35')][_0xa3a3('0x40')]){_0x28019e[_0xa3a3('0x3e')]=_[_0xa3a3('0x41')](_0x28019e[_0xa3a3('0x3e')],{'$or':_['map'](_0x50db65,function(_0x30a7c0){if(_0x30a7c0['type']!==_0xa3a3('0x42')){var _0x50f91e={};_0x50f91e[_0x30a7c0[_0xa3a3('0x2b')]]={'$like':'%'+_0x32eec9[_0xa3a3('0x35')][_0xa3a3('0x40')]+'%'};return _0x50f91e;}})});}_0x28019e=_['merge']({},_0x28019e,_0x32eec9[_0xa3a3('0x43')]);var _0xcbb958={'where':_0x28019e['where']};return db['VoiceMusicOnHold'][_0xa3a3('0x1f')](_0xcbb958)[_0xa3a3('0x25')](function(_0x4c460d){_0x29adda[_0xa3a3('0x1f')]=_0x4c460d;if(_0x32eec9['query'][_0xa3a3('0x44')]){_0x28019e[_0xa3a3('0x45')]=[{'all':!![]}];}return db[_0xa3a3('0x2f')][_0xa3a3('0x46')](_0x28019e);})[_0xa3a3('0x25')](function(_0x316c9b){_0x29adda[_0xa3a3('0x47')]=_0x316c9b;return _0x29adda;})[_0xa3a3('0x25')](respondWithFilteredResult(_0x4e0afe,_0x28019e))[_0xa3a3('0x48')](handleError(_0x4e0afe,null));};exports[_0xa3a3('0x49')]=function(_0x295e99,_0x37fb2c){var _0x16cdb7={'raw':![],'where':{'id':_0x295e99['params']['id']}},_0x1cb5f8={};_0x1cb5f8[_0xa3a3('0x32')]=_[_0xa3a3('0x33')](db[_0xa3a3('0x2f')]['rawAttributes']);_0x1cb5f8[_0xa3a3('0x35')]=_[_0xa3a3('0x33')](_0x295e99[_0xa3a3('0x35')]);_0x1cb5f8[_0xa3a3('0x34')]=_[_0xa3a3('0x37')](_0x1cb5f8[_0xa3a3('0x32')],_0x1cb5f8[_0xa3a3('0x35')]);_0x16cdb7[_0xa3a3('0x36')]=_['intersection'](_0x1cb5f8[_0xa3a3('0x32')],qs[_0xa3a3('0x38')](_0x295e99[_0xa3a3('0x35')][_0xa3a3('0x38')]));_0x16cdb7[_0xa3a3('0x36')]=_0x16cdb7['attributes'][_0xa3a3('0x39')]?_0x16cdb7[_0xa3a3('0x36')]:_0x1cb5f8['model'];if(_0x295e99['query'][_0xa3a3('0x44')]){_0x16cdb7[_0xa3a3('0x45')]=[{'all':!![]}];}_0x16cdb7=_['merge']({},_0x16cdb7,_0x295e99['options']);return db[_0xa3a3('0x2f')][_0xa3a3('0x4a')](_0x16cdb7)[_0xa3a3('0x25')](handleEntityNotFound(_0x37fb2c,null))[_0xa3a3('0x25')](respondWithResult(_0x37fb2c,null))[_0xa3a3('0x48')](handleError(_0x37fb2c,null));};exports[_0xa3a3('0x24')]=function(_0x337095,_0x12e7d0){if(_0x337095[_0xa3a3('0x4b')]['id']){delete _0x337095[_0xa3a3('0x4b')]['id'];}return db[_0xa3a3('0x2f')][_0xa3a3('0x4a')]({'where':{'id':_0x337095[_0xa3a3('0x4c')]['id']}})[_0xa3a3('0x25')](handleEntityNotFound(_0x12e7d0,null))[_0xa3a3('0x25')](saveUpdates(_0x337095[_0xa3a3('0x4b')],null))[_0xa3a3('0x25')](respondWithResult(_0x12e7d0,null))[_0xa3a3('0x48')](handleError(_0x12e7d0,null));};exports[_0xa3a3('0x4d')]=function(_0xd57eb4,_0x1269e3,_0x41a176){return db[_0xa3a3('0x4e')][_0xa3a3('0x4f')](function(_0x44007a){if(_0xd57eb4['body'][_0xa3a3('0x50')]===_0xa3a3('0x51')){_0xd57eb4[_0xa3a3('0x4b')][_0xa3a3('0x52')]=path[_0xa3a3('0x53')](config['root'],_0xa3a3('0x54'),_0xd57eb4[_0xa3a3('0x4b')]['name']);}return db[_0xa3a3('0x2f')]['create'](_0xd57eb4['body'],{'transaction':_0x44007a})[_0xa3a3('0x25')](function(_0x17ca0f){if(_0xd57eb4[_0xa3a3('0x4b')][_0xa3a3('0x50')]===_0xa3a3('0x51')){fs[_0xa3a3('0x55')](_0x17ca0f[_0xa3a3('0x52')],parseInt(_0xa3a3('0x56'),0x8));}var _0x112cb6=_0xd57eb4[_0xa3a3('0x57')][_0xa3a3('0x27')]({'plain':!![]});if(!_0x112cb6)throw new Error(_0xa3a3('0x58'));if(_0x112cb6['role']===_0xa3a3('0x57')){var _0x452b25=_0x17ca0f[_0xa3a3('0x27')]({'plain':!![]});return db[_0xa3a3('0x59')][_0xa3a3('0x4a')]({'where':{'name':_0xa3a3('0x5a'),'userProfileId':_0x112cb6[_0xa3a3('0x5b')]},'raw':!![]})[_0xa3a3('0x25')](function(_0x59c089){if(_0x59c089&&_0x59c089[_0xa3a3('0x5c')]===0x0){return db[_0xa3a3('0x5d')]['create']({'name':_0x452b25['name'],'resourceId':_0x452b25['id'],'type':_0x59c089[_0xa3a3('0x2b')],'sectionId':_0x59c089['id']},{})[_0xa3a3('0x25')](function(){return _0x17ca0f;});}else{return _0x17ca0f;}})[_0xa3a3('0x48')](function(_0x1962e6){logger[_0xa3a3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1962e6);});}return _0x17ca0f;});})[_0xa3a3('0x25')](respondWithResult(_0x1269e3,0xc9))[_0xa3a3('0x48')](handleError(_0x1269e3,null));};exports[_0xa3a3('0x26')]=function(_0x607d7a,_0x5ab1c9,_0x340fde){var _0x5db315;return db[_0xa3a3('0x2f')][_0xa3a3('0x4a')]({'where':{'id':_0x607d7a[_0xa3a3('0x4c')]['id']}})[_0xa3a3('0x25')](function(_0x2ac75b){if(_0x2ac75b){return db[_0xa3a3('0x4e')]['transaction'](function(_0x3e2dfd){return _0x2ac75b[_0xa3a3('0x26')]({'transaction':_0x3e2dfd,'raw':!![]})[_0xa3a3('0x25')](function(_0x2deca5){if(_0x2deca5[_0xa3a3('0x52')]){fs[_0xa3a3('0x5e')](_0x2deca5[_0xa3a3('0x52')])[_0xa3a3('0x5f')](function(_0x8efc44){fs[_0xa3a3('0x60')](path['join'](_0x2deca5['directory'],_0x8efc44));});fs[_0xa3a3('0x61')](_0x2deca5[_0xa3a3('0x52')]);}return _0x2deca5;});})[_0xa3a3('0x48')](function(_0x3b0eef){throw new db['Sequelize']['ValidationError'](_0x3b0eef[_0xa3a3('0x62')]);});}})[_0xa3a3('0x25')](handleEntityNotFound(_0x5ab1c9,null))[_0xa3a3('0x25')](removeEntity(_0x5ab1c9,null))[_0xa3a3('0x48')](handleError(_0x5ab1c9,null));};exports[_0xa3a3('0x63')]=function(_0x42d09e,_0x35c28f,_0x598689){return db[_0xa3a3('0x4e')]['transaction'](function(_0x52dcec){var _0x4ffc28;return db[_0xa3a3('0x2f')][_0xa3a3('0x4a')]({'where':{'id':_0x42d09e[_0xa3a3('0x4c')]['id']}})[_0xa3a3('0x25')](function(_0x36a2ce){if(_0x36a2ce){_0x4ffc28=_0x36a2ce;return _0x36a2ce[_0xa3a3('0x63')](_0x42d09e['body']['id'],{'transaction':_0x52dcec});}})[_0xa3a3('0x25')](function(_0x284984){if(_0x284984){return db[_0xa3a3('0x64')][_0xa3a3('0x65')]({'where':{'id':_0x42d09e[_0xa3a3('0x4b')]['id']},'attributes':['id','name',_0xa3a3('0x66'),'converted_format',_0xa3a3('0x67')],'raw':!![]});}})[_0xa3a3('0x25')](function(_0x468dcf){if(_0x468dcf){var _0x456e7f=path[_0xa3a3('0x53')](config[_0xa3a3('0x68')],_0xa3a3('0x69'),util['format'](_0xa3a3('0x6a'),path[_0xa3a3('0x6b')](_0x468dcf['save_name'],path[_0xa3a3('0x6c')](_0x468dcf[_0xa3a3('0x66')])),_0x468dcf[_0xa3a3('0x6d')]));var _0x2cea53=path[_0xa3a3('0x53')](config[_0xa3a3('0x68')],_0xa3a3('0x54'),_0x4ffc28['name'],util[_0xa3a3('0x6e')]('%s.%s',_0x468dcf[_0xa3a3('0x2b')],_0x468dcf[_0xa3a3('0x6d')]));fs[_0xa3a3('0x6f')](_0x456e7f,_0x2cea53);return _0x468dcf;}})[_0xa3a3('0x48')](function(_0x491929){throw new db[(_0xa3a3('0x70'))][(_0xa3a3('0x71'))](_0x491929['message']);});})[_0xa3a3('0x25')](handleEntityNotFound(_0x35c28f,null))[_0xa3a3('0x25')](respondWithResult(_0x35c28f,0xc9))[_0xa3a3('0x48')](handleError(_0x35c28f,null));};exports[_0xa3a3('0x72')]=function(_0x3e72aa,_0x4a7939,_0xff9830){return db['sequelize'][_0xa3a3('0x4f')](function(_0x52d1f2){var _0x3f362d;return db[_0xa3a3('0x2f')][_0xa3a3('0x65')]({'where':{'id':_0x3e72aa['params']['id']}})[_0xa3a3('0x25')](handleEntityNotFound(_0x4a7939,null))['then'](function(_0x25ac02){if(_0x25ac02){_0x3f362d=_0x25ac02;return _0x25ac02[_0xa3a3('0x72')](_0x3e72aa[_0xa3a3('0x4c')][_0xa3a3('0x73')]);}})[_0xa3a3('0x25')](function(_0x54f4bf){if(_0x54f4bf){return db[_0xa3a3('0x64')][_0xa3a3('0x65')]({'where':{'id':_0x3e72aa[_0xa3a3('0x4c')][_0xa3a3('0x73')]},'attributes':['id',_0xa3a3('0x2b'),_0xa3a3('0x66'),_0xa3a3('0x6d'),_0xa3a3('0x67')],'raw':!![]});}})[_0xa3a3('0x25')](function(_0x13c3bb){if(_0x13c3bb){fs[_0xa3a3('0x60')](path[_0xa3a3('0x53')](_0x3f362d['directory'],util[_0xa3a3('0x6e')](_0xa3a3('0x6a'),_0x13c3bb[_0xa3a3('0x2b')],_0x13c3bb[_0xa3a3('0x6d')])));return _0x13c3bb;}})[_0xa3a3('0x48')](function(_0x574456){throw new db[(_0xa3a3('0x70'))][(_0xa3a3('0x71'))](_0x574456[_0xa3a3('0x62')]);});})['then'](handleEntityNotFound(_0x4a7939,null))[_0xa3a3('0x25')](respondWithStatusCode(_0x4a7939,0xcc))['catch'](handleError(_0x4a7939,null));};exports[_0xa3a3('0x74')]=function(_0x1fb7ad,_0x45a4e1,_0x164b95){var _0x2357a5={};var _0x326fa7={};var _0x3c6f9a;var _0x57905f;return db[_0xa3a3('0x2f')][_0xa3a3('0x65')]({'where':{'id':_0x1fb7ad['params']['id']}})[_0xa3a3('0x25')](handleEntityNotFound(_0x45a4e1,null))[_0xa3a3('0x25')](function(_0x37e2b0){if(_0x37e2b0){_0x3c6f9a=_0x37e2b0;_0x326fa7['model']=_[_0xa3a3('0x33')](db[_0xa3a3('0x64')][_0xa3a3('0x30')]);_0x326fa7[_0xa3a3('0x35')]=_['keys'](_0x1fb7ad['query']);_0x326fa7[_0xa3a3('0x34')]=_[_0xa3a3('0x37')](_0x326fa7['model'],_0x326fa7[_0xa3a3('0x35')]);_0x2357a5[_0xa3a3('0x36')]=_['intersection'](_0x326fa7[_0xa3a3('0x32')],qs[_0xa3a3('0x38')](_0x1fb7ad[_0xa3a3('0x35')][_0xa3a3('0x38')]));_0x2357a5[_0xa3a3('0x36')]=_0x2357a5[_0xa3a3('0x36')][_0xa3a3('0x39')]?_0x2357a5[_0xa3a3('0x36')]:_0x326fa7[_0xa3a3('0x32')];_0x2357a5['order']=qs['sort'](_0x1fb7ad[_0xa3a3('0x35')][_0xa3a3('0x3d')]);_0x2357a5[_0xa3a3('0x3e')]=qs[_0xa3a3('0x34')](_['pick'](_0x1fb7ad[_0xa3a3('0x35')],_0x326fa7[_0xa3a3('0x34')]));if(_0x1fb7ad[_0xa3a3('0x35')]['filter']){_0x2357a5[_0xa3a3('0x3e')]=_[_0xa3a3('0x41')](_0x2357a5[_0xa3a3('0x3e')],{'$or':_['map'](_0x2357a5[_0xa3a3('0x36')],function(_0x234e5c){var _0x54d15d={};_0x54d15d[_0x234e5c]={'$like':'%'+_0x1fb7ad['query'][_0xa3a3('0x40')]+'%'};return _0x54d15d;})});}_0x2357a5=_[_0xa3a3('0x41')]({},_0x2357a5,_0x1fb7ad[_0xa3a3('0x43')]);return _0x3c6f9a[_0xa3a3('0x74')](_0x2357a5);}})[_0xa3a3('0x25')](function(_0x53f399){if(_0x53f399){_0x57905f=_0x53f399[_0xa3a3('0x39')];if(!_0x1fb7ad[_0xa3a3('0x35')]['hasOwnProperty']('nolimit')){_0x2357a5[_0xa3a3('0x1e')]=qs[_0xa3a3('0x1e')](_0x1fb7ad['query'][_0xa3a3('0x1e')]);_0x2357a5['offset']=qs['offset'](_0x1fb7ad['query'][_0xa3a3('0x20')]);}return _0x3c6f9a[_0xa3a3('0x74')](_0x2357a5);}})['then'](function(_0x2c577a){if(_0x2c577a){return _0x2c577a?{'count':_0x57905f,'rows':_0x2c577a}:null;}})[_0xa3a3('0x25')](respondWithResult(_0x45a4e1,null))[_0xa3a3('0x48')](handleError(_0x45a4e1,null));}; \ No newline at end of file +var _0x6aac=['end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','VoiceMusicOnHold','findAll','rows','catch','show','length','include','body','find','params','sequelize','mode','files','join','root','server/files/moh','create','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','directory','readdirSync','forEach','unlinkSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','%s.%s','symlinkSync','removeSound','id2','Sequelize','getSounds','order','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2353e7,_0x5c7d68){var _0x42c104=function(_0x51f9f1){while(--_0x51f9f1){_0x2353e7['push'](_0x2353e7['shift']());}};_0x42c104(++_0x5c7d68);}(_0x6aac,0x13a));var _0xc6aa=function(_0x208c70,_0x4d70c0){_0x208c70=_0x208c70-0x0;var _0x263485=_0x6aac[_0x208c70];return _0x263485;};'use strict';var emlformat=require(_0xc6aa('0x0'));var rimraf=require(_0xc6aa('0x1'));var zipdir=require(_0xc6aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc6aa('0x3'));var BPromise=require(_0xc6aa('0x4'));var Mustache=require(_0xc6aa('0x5'));var util=require(_0xc6aa('0x6'));var path=require(_0xc6aa('0x7'));var sox=require(_0xc6aa('0x8'));var csv=require(_0xc6aa('0x9'));var ejs=require(_0xc6aa('0xa'));var fs=require('fs');var fs_extra=require(_0xc6aa('0xb'));var _=require('lodash');var squel=require(_0xc6aa('0xc'));var crypto=require('crypto');var jsforce=require(_0xc6aa('0xd'));var deskjs=require(_0xc6aa('0xe'));var toCsv=require(_0xc6aa('0x9'));var querystring=require(_0xc6aa('0xf'));var Papa=require(_0xc6aa('0x10'));var Redis=require(_0xc6aa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc6aa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6aa('0x13'));var logger=require(_0xc6aa('0x14'))(_0xc6aa('0x15'));var utils=require(_0xc6aa('0x16'));var config=require(_0xc6aa('0x17'));var licenseUtil=require(_0xc6aa('0x18'));var db=require(_0xc6aa('0x19'))['db'];function respondWithStatusCode(_0x31b4ea,_0x275e3a){_0x275e3a=_0x275e3a||0xcc;return function(_0x2eb7dd){if(_0x2eb7dd){return _0x31b4ea[_0xc6aa('0x1a')](_0x275e3a);}return _0x31b4ea[_0xc6aa('0x1b')](_0x275e3a)[_0xc6aa('0x1c')]();};}function respondWithResult(_0x4c898c,_0xf2b572){_0xf2b572=_0xf2b572||0xc8;return function(_0x8d8429){if(_0x8d8429){return _0x4c898c[_0xc6aa('0x1b')](_0xf2b572)[_0xc6aa('0x1d')](_0x8d8429);}};}function respondWithFilteredResult(_0x561f4b,_0xbc1cf2){return function(_0x1b3f5c){if(_0x1b3f5c){var _0x217e04=typeof _0xbc1cf2[_0xc6aa('0x1e')]==='undefined'&&typeof _0xbc1cf2[_0xc6aa('0x1f')]===_0xc6aa('0x20');var _0x2847dc=_0x1b3f5c[_0xc6aa('0x21')];var _0x574870=_0x217e04?0x0:_0xbc1cf2[_0xc6aa('0x1e')];var _0x57b4fd=_0x217e04?_0x1b3f5c['count']:_0xbc1cf2[_0xc6aa('0x1e')]+_0xbc1cf2[_0xc6aa('0x1f')];var _0x4a9620;if(_0x57b4fd>=_0x2847dc){_0x57b4fd=_0x2847dc;_0x4a9620=0xc8;}else{_0x4a9620=0xce;}_0x561f4b[_0xc6aa('0x1b')](_0x4a9620);return _0x561f4b['set'](_0xc6aa('0x22'),_0x574870+'-'+_0x57b4fd+'/'+_0x2847dc)[_0xc6aa('0x1d')](_0x1b3f5c);}return null;};}function patchUpdates(_0xd11d48){return function(_0x53b6d1){try{jsonpatch['apply'](_0x53b6d1,_0xd11d48,!![]);}catch(_0x4d9161){return BPromise[_0xc6aa('0x23')](_0x4d9161);}return _0x53b6d1[_0xc6aa('0x24')]();};}function saveUpdates(_0x13412c,_0x51fdcd){return function(_0x30f4dc){if(_0x30f4dc){return _0x30f4dc[_0xc6aa('0x25')](_0x13412c)[_0xc6aa('0x26')](function(_0x95c6fb){return _0x95c6fb;});}return null;};}function removeEntity(_0x221178,_0x468ad4){return function(_0x56fff2){if(_0x56fff2){return _0x56fff2['destroy']()[_0xc6aa('0x26')](function(){var _0x27e1a1=_0x56fff2[_0xc6aa('0x27')]({'plain':!![]});var _0x19967e=_0xc6aa('0x28');return db[_0xc6aa('0x29')][_0xc6aa('0x2a')]({'where':{'type':_0x19967e,'resourceId':_0x27e1a1['id']}})[_0xc6aa('0x26')](function(){return _0x56fff2;});})[_0xc6aa('0x26')](function(){_0x221178[_0xc6aa('0x1b')](0xcc)[_0xc6aa('0x1c')]();});}};}function handleEntityNotFound(_0x3d640e,_0x368edf){return function(_0x1b09e4){if(!_0x1b09e4){_0x3d640e['sendStatus'](0x194);}return _0x1b09e4;};}function handleError(_0x57dd9f,_0x2ac71a){_0x2ac71a=_0x2ac71a||0x1f4;return function(_0x20d276){logger[_0xc6aa('0x2b')](_0x20d276[_0xc6aa('0x2c')]);if(_0x20d276[_0xc6aa('0x2d')]){delete _0x20d276['name'];}_0x57dd9f[_0xc6aa('0x1b')](_0x2ac71a)['send'](_0x20d276);};}exports[_0xc6aa('0x2e')]=function(_0x3fd0b4,_0x22b756){var _0x6f9322={},_0x3516e0={},_0x582c6b={'count':0x0,'rows':[]};var _0x451f89=_[_0xc6aa('0x2f')](db['VoiceMusicOnHold'][_0xc6aa('0x30')],function(_0x1ed1c5){return{'name':_0x1ed1c5[_0xc6aa('0x31')],'type':_0x1ed1c5['type'][_0xc6aa('0x32')]};});_0x3516e0['model']=_[_0xc6aa('0x2f')](_0x451f89,_0xc6aa('0x2d'));_0x3516e0[_0xc6aa('0x33')]=_[_0xc6aa('0x34')](_0x3fd0b4[_0xc6aa('0x33')]);_0x3516e0[_0xc6aa('0x35')]=_[_0xc6aa('0x36')](_0x3516e0[_0xc6aa('0x37')],_0x3516e0[_0xc6aa('0x33')]);_0x6f9322[_0xc6aa('0x38')]=_[_0xc6aa('0x36')](_0x3516e0[_0xc6aa('0x37')],qs[_0xc6aa('0x39')](_0x3fd0b4[_0xc6aa('0x33')][_0xc6aa('0x39')]));_0x6f9322[_0xc6aa('0x38')]=_0x6f9322[_0xc6aa('0x38')]['length']?_0x6f9322[_0xc6aa('0x38')]:_0x3516e0[_0xc6aa('0x37')];if(!_0x3fd0b4[_0xc6aa('0x33')][_0xc6aa('0x3a')](_0xc6aa('0x3b'))){_0x6f9322['limit']=qs[_0xc6aa('0x1f')](_0x3fd0b4[_0xc6aa('0x33')]['limit']);_0x6f9322['offset']=qs[_0xc6aa('0x1e')](_0x3fd0b4['query'][_0xc6aa('0x1e')]);}_0x6f9322['order']=qs[_0xc6aa('0x3c')](_0x3fd0b4['query']['sort']);delete _0x3fd0b4['query'][_0xc6aa('0x3c')];_0x6f9322['where']=qs[_0xc6aa('0x35')](_[_0xc6aa('0x3d')](_0x3fd0b4[_0xc6aa('0x33')],_0x3516e0[_0xc6aa('0x35')]),_0x451f89);if(_0x3fd0b4[_0xc6aa('0x33')][_0xc6aa('0x3e')]){_0x6f9322[_0xc6aa('0x3f')]=_[_0xc6aa('0x40')](_0x6f9322[_0xc6aa('0x3f')],{'$or':_[_0xc6aa('0x2f')](_0x451f89,function(_0x460d8d){if(_0x460d8d['type']!==_0xc6aa('0x41')){var _0x37b566={};_0x37b566[_0x460d8d[_0xc6aa('0x2d')]]={'$like':'%'+_0x3fd0b4[_0xc6aa('0x33')]['filter']+'%'};return _0x37b566;}})});}_0x6f9322=_[_0xc6aa('0x40')]({},_0x6f9322,_0x3fd0b4[_0xc6aa('0x42')]);var _0x2edd8f={'where':_0x6f9322['where']};return db['VoiceMusicOnHold']['count'](_0x2edd8f)[_0xc6aa('0x26')](function(_0x2985de){_0x582c6b[_0xc6aa('0x21')]=_0x2985de;if(_0x3fd0b4['query'][_0xc6aa('0x43')]){_0x6f9322['include']=[{'all':!![]}];}return db[_0xc6aa('0x44')][_0xc6aa('0x45')](_0x6f9322);})[_0xc6aa('0x26')](function(_0xf93153){_0x582c6b[_0xc6aa('0x46')]=_0xf93153;return _0x582c6b;})[_0xc6aa('0x26')](respondWithFilteredResult(_0x22b756,_0x6f9322))[_0xc6aa('0x47')](handleError(_0x22b756,null));};exports[_0xc6aa('0x48')]=function(_0x1808e7,_0x2bf534){var _0x2219c1={'raw':![],'where':{'id':_0x1808e7['params']['id']}},_0x28df2f={};_0x28df2f['model']=_[_0xc6aa('0x34')](db[_0xc6aa('0x44')][_0xc6aa('0x30')]);_0x28df2f[_0xc6aa('0x33')]=_['keys'](_0x1808e7[_0xc6aa('0x33')]);_0x28df2f[_0xc6aa('0x35')]=_[_0xc6aa('0x36')](_0x28df2f[_0xc6aa('0x37')],_0x28df2f[_0xc6aa('0x33')]);_0x2219c1[_0xc6aa('0x38')]=_[_0xc6aa('0x36')](_0x28df2f[_0xc6aa('0x37')],qs[_0xc6aa('0x39')](_0x1808e7['query'][_0xc6aa('0x39')]));_0x2219c1[_0xc6aa('0x38')]=_0x2219c1['attributes'][_0xc6aa('0x49')]?_0x2219c1[_0xc6aa('0x38')]:_0x28df2f[_0xc6aa('0x37')];if(_0x1808e7[_0xc6aa('0x33')]['includeAll']){_0x2219c1[_0xc6aa('0x4a')]=[{'all':!![]}];}_0x2219c1=_['merge']({},_0x2219c1,_0x1808e7[_0xc6aa('0x42')]);return db[_0xc6aa('0x44')]['find'](_0x2219c1)[_0xc6aa('0x26')](handleEntityNotFound(_0x2bf534,null))[_0xc6aa('0x26')](respondWithResult(_0x2bf534,null))[_0xc6aa('0x47')](handleError(_0x2bf534,null));};exports['update']=function(_0x2a3e7e,_0x321e6c){if(_0x2a3e7e[_0xc6aa('0x4b')]['id']){delete _0x2a3e7e[_0xc6aa('0x4b')]['id'];}return db[_0xc6aa('0x44')][_0xc6aa('0x4c')]({'where':{'id':_0x2a3e7e[_0xc6aa('0x4d')]['id']}})[_0xc6aa('0x26')](handleEntityNotFound(_0x321e6c,null))[_0xc6aa('0x26')](saveUpdates(_0x2a3e7e[_0xc6aa('0x4b')],null))[_0xc6aa('0x26')](respondWithResult(_0x321e6c,null))[_0xc6aa('0x47')](handleError(_0x321e6c,null));};exports['create']=function(_0x5355ff,_0x411833,_0x4609df){return db[_0xc6aa('0x4e')]['transaction'](function(_0x5db768){if(_0x5355ff['body'][_0xc6aa('0x4f')]===_0xc6aa('0x50')){_0x5355ff[_0xc6aa('0x4b')]['directory']=path[_0xc6aa('0x51')](config[_0xc6aa('0x52')],_0xc6aa('0x53'),_0x5355ff[_0xc6aa('0x4b')][_0xc6aa('0x2d')]);}return db[_0xc6aa('0x44')][_0xc6aa('0x54')](_0x5355ff[_0xc6aa('0x4b')],{'transaction':_0x5db768})[_0xc6aa('0x26')](function(_0x5d68ed){if(_0x5355ff['body'][_0xc6aa('0x4f')]==='files'){fs['mkdirSync'](_0x5d68ed['directory'],parseInt(_0xc6aa('0x55'),0x8));}var _0x366e56=_0x5355ff[_0xc6aa('0x56')][_0xc6aa('0x27')]({'plain':!![]});if(!_0x366e56)throw new Error(_0xc6aa('0x57'));if(_0x366e56[_0xc6aa('0x58')]===_0xc6aa('0x56')){var _0x39eea0=_0x5d68ed['get']({'plain':!![]});return db['UserProfileSection'][_0xc6aa('0x4c')]({'where':{'name':_0xc6aa('0x28'),'userProfileId':_0x366e56[_0xc6aa('0x59')]},'raw':!![]})[_0xc6aa('0x26')](function(_0x2ad3d2){if(_0x2ad3d2&&_0x2ad3d2[_0xc6aa('0x5a')]===0x0){return db[_0xc6aa('0x29')][_0xc6aa('0x54')]({'name':_0x39eea0['name'],'resourceId':_0x39eea0['id'],'type':_0x2ad3d2['name'],'sectionId':_0x2ad3d2['id']},{})[_0xc6aa('0x26')](function(){return _0x5d68ed;});}else{return _0x5d68ed;}})[_0xc6aa('0x47')](function(_0x143696){logger[_0xc6aa('0x2b')](_0xc6aa('0x5b'),_0x143696);});}return _0x5d68ed;});})[_0xc6aa('0x26')](respondWithResult(_0x411833,0xc9))[_0xc6aa('0x47')](handleError(_0x411833,null));};exports[_0xc6aa('0x2a')]=function(_0x4b796a,_0x42a62a,_0xf6bbda){var _0x386941;return db[_0xc6aa('0x44')][_0xc6aa('0x4c')]({'where':{'id':_0x4b796a[_0xc6aa('0x4d')]['id']}})[_0xc6aa('0x26')](function(_0x109f6f){if(_0x109f6f){return db[_0xc6aa('0x4e')][_0xc6aa('0x5c')](function(_0x4832b4){return _0x109f6f[_0xc6aa('0x2a')]({'transaction':_0x4832b4,'raw':!![]})['then'](function(_0x53b2f5){if(_0x53b2f5[_0xc6aa('0x5d')]){fs[_0xc6aa('0x5e')](_0x53b2f5[_0xc6aa('0x5d')])[_0xc6aa('0x5f')](function(_0x3aa877){fs[_0xc6aa('0x60')](path[_0xc6aa('0x51')](_0x53b2f5[_0xc6aa('0x5d')],_0x3aa877));});fs['rmdirSync'](_0x53b2f5[_0xc6aa('0x5d')]);}return _0x53b2f5;});})[_0xc6aa('0x47')](function(_0x4b11df){throw new db['Sequelize'][(_0xc6aa('0x61'))](_0x4b11df['message']);});}})[_0xc6aa('0x26')](handleEntityNotFound(_0x42a62a,null))[_0xc6aa('0x26')](removeEntity(_0x42a62a,null))[_0xc6aa('0x47')](handleError(_0x42a62a,null));};exports[_0xc6aa('0x62')]=function(_0x4fd5df,_0x33746a,_0x21b984){return db[_0xc6aa('0x4e')][_0xc6aa('0x5c')](function(_0x2e9d0f){var _0x48306d;return db[_0xc6aa('0x44')]['find']({'where':{'id':_0x4fd5df[_0xc6aa('0x4d')]['id']}})[_0xc6aa('0x26')](function(_0x2400b9){if(_0x2400b9){_0x48306d=_0x2400b9;return _0x2400b9[_0xc6aa('0x62')](_0x4fd5df[_0xc6aa('0x4b')]['id'],{'transaction':_0x2e9d0f});}})[_0xc6aa('0x26')](function(_0xd9c238){if(_0xd9c238){return db[_0xc6aa('0x63')][_0xc6aa('0x64')]({'where':{'id':_0x4fd5df[_0xc6aa('0x4b')]['id']},'attributes':['id',_0xc6aa('0x2d'),_0xc6aa('0x65'),_0xc6aa('0x66'),_0xc6aa('0x67')],'raw':!![]});}})[_0xc6aa('0x26')](function(_0x3a9ff9){if(_0x3a9ff9){var _0x574b7a=path['join'](config[_0xc6aa('0x52')],_0xc6aa('0x68'),util[_0xc6aa('0x69')]('%s.%s',path[_0xc6aa('0x6a')](_0x3a9ff9['save_name'],path['extname'](_0x3a9ff9[_0xc6aa('0x65')])),_0x3a9ff9[_0xc6aa('0x66')]));var _0xd5848a=path[_0xc6aa('0x51')](config[_0xc6aa('0x52')],_0xc6aa('0x53'),_0x48306d[_0xc6aa('0x2d')],util['format'](_0xc6aa('0x6b'),_0x3a9ff9[_0xc6aa('0x2d')],_0x3a9ff9[_0xc6aa('0x66')]));fs[_0xc6aa('0x6c')](_0x574b7a,_0xd5848a);return _0x3a9ff9;}})['catch'](function(_0x21abdf){throw new db['Sequelize'][(_0xc6aa('0x61'))](_0x21abdf['message']);});})[_0xc6aa('0x26')](handleEntityNotFound(_0x33746a,null))[_0xc6aa('0x26')](respondWithResult(_0x33746a,0xc9))['catch'](handleError(_0x33746a,null));};exports[_0xc6aa('0x6d')]=function(_0x4e3b56,_0x27ef06,_0x42a10a){return db[_0xc6aa('0x4e')]['transaction'](function(_0x6d7c28){var _0x163037;return db['VoiceMusicOnHold'][_0xc6aa('0x64')]({'where':{'id':_0x4e3b56[_0xc6aa('0x4d')]['id']}})[_0xc6aa('0x26')](handleEntityNotFound(_0x27ef06,null))[_0xc6aa('0x26')](function(_0x7d224a){if(_0x7d224a){_0x163037=_0x7d224a;return _0x7d224a['removeSound'](_0x4e3b56[_0xc6aa('0x4d')][_0xc6aa('0x6e')]);}})[_0xc6aa('0x26')](function(_0x4b91da){if(_0x4b91da){return db[_0xc6aa('0x63')][_0xc6aa('0x64')]({'where':{'id':_0x4e3b56[_0xc6aa('0x4d')][_0xc6aa('0x6e')]},'attributes':['id',_0xc6aa('0x2d'),_0xc6aa('0x65'),'converted_format','createdAt'],'raw':!![]});}})[_0xc6aa('0x26')](function(_0x52b35d){if(_0x52b35d){fs[_0xc6aa('0x60')](path['join'](_0x163037[_0xc6aa('0x5d')],util['format']('%s.%s',_0x52b35d['name'],_0x52b35d['converted_format'])));return _0x52b35d;}})[_0xc6aa('0x47')](function(_0x4eb7e6){throw new db[(_0xc6aa('0x6f'))][(_0xc6aa('0x61'))](_0x4eb7e6['message']);});})['then'](handleEntityNotFound(_0x27ef06,null))[_0xc6aa('0x26')](respondWithStatusCode(_0x27ef06,0xcc))[_0xc6aa('0x47')](handleError(_0x27ef06,null));};exports[_0xc6aa('0x70')]=function(_0x2f769b,_0x433b1d,_0x5594f7){var _0x4255eb={};var _0xb2d647={};var _0x5dd357;var _0x497aac;return db[_0xc6aa('0x44')]['findOne']({'where':{'id':_0x2f769b[_0xc6aa('0x4d')]['id']}})[_0xc6aa('0x26')](handleEntityNotFound(_0x433b1d,null))[_0xc6aa('0x26')](function(_0x349f66){if(_0x349f66){_0x5dd357=_0x349f66;_0xb2d647[_0xc6aa('0x37')]=_[_0xc6aa('0x34')](db[_0xc6aa('0x63')]['rawAttributes']);_0xb2d647[_0xc6aa('0x33')]=_[_0xc6aa('0x34')](_0x2f769b['query']);_0xb2d647[_0xc6aa('0x35')]=_[_0xc6aa('0x36')](_0xb2d647['model'],_0xb2d647[_0xc6aa('0x33')]);_0x4255eb[_0xc6aa('0x38')]=_['intersection'](_0xb2d647[_0xc6aa('0x37')],qs['fields'](_0x2f769b[_0xc6aa('0x33')][_0xc6aa('0x39')]));_0x4255eb[_0xc6aa('0x38')]=_0x4255eb[_0xc6aa('0x38')][_0xc6aa('0x49')]?_0x4255eb['attributes']:_0xb2d647[_0xc6aa('0x37')];_0x4255eb[_0xc6aa('0x71')]=qs[_0xc6aa('0x3c')](_0x2f769b[_0xc6aa('0x33')][_0xc6aa('0x3c')]);_0x4255eb[_0xc6aa('0x3f')]=qs['filters'](_[_0xc6aa('0x3d')](_0x2f769b[_0xc6aa('0x33')],_0xb2d647[_0xc6aa('0x35')]));if(_0x2f769b[_0xc6aa('0x33')][_0xc6aa('0x3e')]){_0x4255eb[_0xc6aa('0x3f')]=_[_0xc6aa('0x40')](_0x4255eb[_0xc6aa('0x3f')],{'$or':_['map'](_0x4255eb[_0xc6aa('0x38')],function(_0xca8170){var _0x5ce1ce={};_0x5ce1ce[_0xca8170]={'$like':'%'+_0x2f769b[_0xc6aa('0x33')][_0xc6aa('0x3e')]+'%'};return _0x5ce1ce;})});}_0x4255eb=_['merge']({},_0x4255eb,_0x2f769b['options']);return _0x5dd357[_0xc6aa('0x70')](_0x4255eb);}})[_0xc6aa('0x26')](function(_0x58b2c4){if(_0x58b2c4){_0x497aac=_0x58b2c4['length'];if(!_0x2f769b[_0xc6aa('0x33')]['hasOwnProperty'](_0xc6aa('0x3b'))){_0x4255eb['limit']=qs[_0xc6aa('0x1f')](_0x2f769b['query'][_0xc6aa('0x1f')]);_0x4255eb[_0xc6aa('0x1e')]=qs['offset'](_0x2f769b['query']['offset']);}return _0x5dd357['getSounds'](_0x4255eb);}})['then'](function(_0x59ecba){if(_0x59ecba){return _0x59ecba?{'count':_0x497aac,'rows':_0x59ecba}:null;}})[_0xc6aa('0x26')](respondWithResult(_0x433b1d,null))[_0xc6aa('0x47')](handleError(_0x433b1d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d3915b3..ea21f16 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 _0xb131=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x193e63,_0x23a981){var _0x57c012=function(_0x38631f){while(--_0x38631f){_0x193e63['push'](_0x193e63['shift']());}};_0x57c012(++_0x23a981);}(_0xb131,0xba));var _0x1b13=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xb131[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x1b13('0x0'));var logger=require(_0x1b13('0x1'))('api');var moment=require(_0x1b13('0x2'));var BPromise=require(_0x1b13('0x3'));var rp=require(_0x1b13('0x4'));var fs=require('fs');var path=require(_0x1b13('0x5'));var rimraf=require(_0x1b13('0x6'));var config=require(_0x1b13('0x7'));var attributes=require(_0x1b13('0x8'));module['exports']=function(_0x2c8b7e,_0x5c1879){return _0x2c8b7e[_0x1b13('0x9')](_0x1b13('0xa'),attributes,{'tableName':_0x1b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b2e=['define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes','exports'];(function(_0x3bab89,_0x7f123c){var _0x253dd4=function(_0x12ac4a){while(--_0x12ac4a){_0x3bab89['push'](_0x3bab89['shift']());}};_0x253dd4(++_0x7f123c);}(_0x9b2e,0x13b));var _0xe9b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9b2e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xe9b2('0x0'));var logger=require(_0xe9b2('0x1'))(_0xe9b2('0x2'));var moment=require(_0xe9b2('0x3'));var BPromise=require(_0xe9b2('0x4'));var rp=require(_0xe9b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9b2('0x6'));var config=require('../../config/environment');var attributes=require(_0xe9b2('0x7'));module[_0xe9b2('0x8')]=function(_0x18b81f,_0x236b9f){return _0x18b81f[_0xe9b2('0x9')](_0xe9b2('0xa'),attributes,{'tableName':_0xe9b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 749fa27..0ebbfe3 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x114b62,_0x5dae4b){var _0x478b58=function(_0xcf5e1a){while(--_0xcf5e1a){_0x114b62['push'](_0x114b62['shift']());}};_0x478b58(++_0x5dae4b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ 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(_0x1292df,_0x1b8763){var _0x9cb474=function(_0x49dbb6){while(--_0x49dbb6){_0x1292df['push'](_0x1292df['shift']());}};_0x9cb474(++_0x1b8763);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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 a5344ec..3a398a4 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 _0x4397=['show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','index','get','isAuthenticated','describe','/:id'];(function(_0x4664ab,_0x26903c){var _0x17045f=function(_0x56dfc6){while(--_0x56dfc6){_0x4664ab['push'](_0x4664ab['shift']());}};_0x17045f(++_0x26903c);}(_0x4397,0xe4));var _0x7439=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x4397[_0x2053ea];return _0x2232c4;};'use strict';var multer=require(_0x7439('0x0'));var util=require(_0x7439('0x1'));var path=require(_0x7439('0x2'));var timeout=require(_0x7439('0x3'));var express=require(_0x7439('0x4'));var router=express['Router']();var fs_extra=require(_0x7439('0x5'));var auth=require(_0x7439('0x6'));var interaction=require(_0x7439('0x7'));var config=require(_0x7439('0x8'));var controller=require(_0x7439('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7439('0xa')]);router[_0x7439('0xb')]('/describe',auth[_0x7439('0xc')](),controller[_0x7439('0xd')]);router[_0x7439('0xb')](_0x7439('0xe'),auth['isAuthenticated'](),controller[_0x7439('0xf')]);router[_0x7439('0xb')](_0x7439('0x10'),auth[_0x7439('0xc')](),controller[_0x7439('0x11')]);router['get'](_0x7439('0x12'),auth[_0x7439('0xc')](),controller[_0x7439('0x13')]);router[_0x7439('0x14')]('/',auth[_0x7439('0xc')](),controller['create']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x7439('0x15')]);router[_0x7439('0x14')]('/:id/teams',auth[_0x7439('0xc')](),controller[_0x7439('0x16')]);router[_0x7439('0x17')](_0x7439('0xe'),auth[_0x7439('0xc')](),controller['update']);router['delete'](_0x7439('0xe'),auth[_0x7439('0xc')](),controller['destroy']);router['delete'](_0x7439('0x10'),auth[_0x7439('0xc')](),controller[_0x7439('0x18')]);router['delete'](_0x7439('0x12'),auth[_0x7439('0xc')](),controller[_0x7439('0x19')]);module[_0x7439('0x1a')]=router; \ No newline at end of file +var _0x1629=['/:id/teams','getTeams','post','create','addAgents','addTeams','put','/:id','update','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/users'];(function(_0x324b3f,_0x2776a3){var _0x1c5581=function(_0x10fd92){while(--_0x10fd92){_0x324b3f['push'](_0x324b3f['shift']());}};_0x1c5581(++_0x2776a3);}(_0x1629,0x1d8));var _0x9162=function(_0x2b161c,_0x4e6c13){_0x2b161c=_0x2b161c-0x0;var _0xf4b8f5=_0x1629[_0x2b161c];return _0xf4b8f5;};'use strict';var multer=require(_0x9162('0x0'));var util=require(_0x9162('0x1'));var path=require(_0x9162('0x2'));var timeout=require(_0x9162('0x3'));var express=require('express');var router=express[_0x9162('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9162('0x5'));var config=require(_0x9162('0x6'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x9162('0x7')](),controller[_0x9162('0x8')]);router[_0x9162('0x9')](_0x9162('0xa'),auth[_0x9162('0x7')](),controller[_0x9162('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9162('0xc')]);router[_0x9162('0x9')](_0x9162('0xd'),auth[_0x9162('0x7')](),controller['getAgents']);router[_0x9162('0x9')](_0x9162('0xe'),auth['isAuthenticated'](),controller[_0x9162('0xf')]);router[_0x9162('0x10')]('/',auth['isAuthenticated'](),controller[_0x9162('0x11')]);router[_0x9162('0x10')](_0x9162('0xd'),auth[_0x9162('0x7')](),controller[_0x9162('0x12')]);router[_0x9162('0x10')](_0x9162('0xe'),auth[_0x9162('0x7')](),controller[_0x9162('0x13')]);router[_0x9162('0x14')](_0x9162('0x15'),auth['isAuthenticated'](),controller[_0x9162('0x16')]);router[_0x9162('0x17')]('/:id',auth[_0x9162('0x7')](),controller[_0x9162('0x18')]);router[_0x9162('0x17')](_0x9162('0xd'),auth[_0x9162('0x7')](),controller[_0x9162('0x19')]);router[_0x9162('0x17')](_0x9162('0xe'),auth[_0x9162('0x7')](),controller[_0x9162('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 659657f..1c92db3 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 _0xeb3d=['exports','STRING','VIRTUAL','getDataValue','name','INTEGER','sequelize'];(function(_0x2cdad5,_0x542ca7){var _0x461944=function(_0xdf77bf){while(--_0xdf77bf){_0x2cdad5['push'](_0x2cdad5['shift']());}};_0x461944(++_0x542ca7);}(_0xeb3d,0xf4));var _0xdeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdeb3('0x0'));module[_0xdeb3('0x1')]={'name':{'type':Sequelize[_0xdeb3('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xdeb3('0x3')],'get':function(_0x584dbd){return'system-'+this[_0xdeb3('0x4')](_0xdeb3('0x5'))+'-';}},'description':{'type':Sequelize[_0xdeb3('0x2')]},'callerIdAll':{'type':Sequelize[_0xdeb3('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xdeb3('0x6')]}}; \ No newline at end of file +var _0xda2c=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','getDataValue'];(function(_0x51fe1a,_0x5f5dd3){var _0x4fc4b2=function(_0x32b37e){while(--_0x32b37e){_0x51fe1a['push'](_0x51fe1a['shift']());}};_0x4fc4b2(++_0x5f5dd3);}(_0xda2c,0xb7));var _0xcda2=function(_0x54d59d,_0x17f2c0){_0x54d59d=_0x54d59d-0x0;var _0x14251b=_0xda2c[_0x54d59d];return _0x14251b;};'use strict';var Sequelize=require(_0xcda2('0x0'));module[_0xcda2('0x1')]={'name':{'type':Sequelize[_0xcda2('0x2')],'allowNull':![],'unique':_0xcda2('0x3')},'prefix':{'type':Sequelize[_0xcda2('0x4')],'get':function(_0x2ec25b){return'system-'+this[_0xcda2('0x5')](_0xcda2('0x3'))+'-';}},'description':{'type':Sequelize[_0xcda2('0x2')]},'callerIdAll':{'type':Sequelize[_0xcda2('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xcda2('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 2874fa2..e2a977a 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 _0xb10b=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge','options','catch','show','params','fields','includeAll','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','transaction','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','order','getTeams','Team','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cdb2d,_0x8f1f76){_0x1cdb2d=_0x1cdb2d-0x0;var _0x4dafe3=_0xb10b[_0x1cdb2d];return _0x4dafe3;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config['redis']));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);function respondWithStatusCode(_0x45b9d6,_0x17fd46){_0x17fd46=_0x17fd46||0xcc;return function(_0x3df17b){if(_0x3df17b){return _0x45b9d6[_0xbb10('0x1e')](_0x17fd46);}return _0x45b9d6[_0xbb10('0x1f')](_0x17fd46)[_0xbb10('0x20')]();};}function respondWithResult(_0x3e26f4,_0x2b184e){_0x2b184e=_0x2b184e||0xc8;return function(_0x4a2bfc){if(_0x4a2bfc){return _0x3e26f4[_0xbb10('0x1f')](_0x2b184e)[_0xbb10('0x21')](_0x4a2bfc);}};}function respondWithFilteredResult(_0x133ac2,_0x42db98){return function(_0x378da8){if(_0x378da8){var _0x1682a4=typeof _0x42db98[_0xbb10('0x22')]===_0xbb10('0x23')&&typeof _0x42db98[_0xbb10('0x24')]===_0xbb10('0x23');var _0x48b6e9=_0x378da8[_0xbb10('0x25')];var _0x19f48d=_0x1682a4?0x0:_0x42db98[_0xbb10('0x22')];var _0x109908=_0x1682a4?_0x378da8[_0xbb10('0x25')]:_0x42db98[_0xbb10('0x22')]+_0x42db98['limit'];var _0x12f888;if(_0x109908>=_0x48b6e9){_0x109908=_0x48b6e9;_0x12f888=0xc8;}else{_0x12f888=0xce;}_0x133ac2[_0xbb10('0x1f')](_0x12f888);return _0x133ac2['set']('Content-Range',_0x19f48d+'-'+_0x109908+'/'+_0x48b6e9)[_0xbb10('0x21')](_0x378da8);}return null;};}function patchUpdates(_0x311abe){return function(_0x2e911d){try{jsonpatch[_0xbb10('0x26')](_0x2e911d,_0x311abe,!![]);}catch(_0x445761){return BPromise[_0xbb10('0x27')](_0x445761);}return _0x2e911d[_0xbb10('0x28')]();};}function saveUpdates(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){return _0x395404[_0xbb10('0x29')](_0x436104)[_0xbb10('0x2a')](function(_0x537898){return _0x537898;});}return null;};}function removeEntity(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(_0xc93a04){return _0xc93a04[_0xbb10('0x2b')]()[_0xbb10('0x2a')](function(){var _0x4e25ff=_0xc93a04[_0xbb10('0x2c')]({'plain':!![]});var _0x24d586=_0xbb10('0x2d');return db[_0xbb10('0x2e')][_0xbb10('0x2b')]({'where':{'type':_0x24d586,'resourceId':_0x4e25ff['id']}})[_0xbb10('0x2a')](function(){return _0xc93a04;});})[_0xbb10('0x2a')](function(){_0x4fedac['status'](0xcc)[_0xbb10('0x20')]();});}};}function handleEntityNotFound(_0x21ac54,_0xfc3595){return function(_0x2e0249){if(!_0x2e0249){_0x21ac54[_0xbb10('0x1e')](0x194);}return _0x2e0249;};}function handleError(_0x2ff4c1,_0x5d5c80){_0x5d5c80=_0x5d5c80||0x1f4;return function(_0x221624){logger['error'](_0x221624[_0xbb10('0x2f')]);if(_0x221624['name']){delete _0x221624[_0xbb10('0x30')];}_0x2ff4c1[_0xbb10('0x1f')](_0x5d5c80)[_0xbb10('0x31')](_0x221624);};}exports['index']=function(_0x518d47,_0x4c3744){var _0x34f65e={},_0x4f590d={},_0x359ad4={'count':0x0,'rows':[]};var _0x37dde7=_[_0xbb10('0x32')](db[_0xbb10('0x33')][_0xbb10('0x34')],function(_0x138bc6){return{'name':_0x138bc6[_0xbb10('0x35')],'type':_0x138bc6['type'][_0xbb10('0x36')]};});_0x4f590d[_0xbb10('0x37')]=_[_0xbb10('0x32')](_0x37dde7,_0xbb10('0x30'));_0x4f590d[_0xbb10('0x38')]=_[_0xbb10('0x39')](_0x518d47[_0xbb10('0x38')]);_0x4f590d[_0xbb10('0x3a')]=_[_0xbb10('0x3b')](_0x4f590d['model'],_0x4f590d[_0xbb10('0x38')]);_0x34f65e[_0xbb10('0x3c')]=_[_0xbb10('0x3b')](_0x4f590d[_0xbb10('0x37')],qs['fields'](_0x518d47[_0xbb10('0x38')]['fields']));_0x34f65e['attributes']=_0x34f65e[_0xbb10('0x3c')][_0xbb10('0x3d')]?_0x34f65e[_0xbb10('0x3c')]:_0x4f590d[_0xbb10('0x37')];if(!_0x518d47[_0xbb10('0x38')][_0xbb10('0x3e')]('nolimit')){_0x34f65e[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x518d47['query']['limit']);_0x34f65e['offset']=qs[_0xbb10('0x22')](_0x518d47[_0xbb10('0x38')][_0xbb10('0x22')]);}_0x34f65e['order']=qs[_0xbb10('0x3f')](_0x518d47[_0xbb10('0x38')][_0xbb10('0x3f')]);_0x34f65e['where']=qs[_0xbb10('0x3a')](_[_0xbb10('0x40')](_0x518d47[_0xbb10('0x38')],_0x4f590d[_0xbb10('0x3a')]),_0x37dde7);if(_0x518d47['query'][_0xbb10('0x41')]){_0x34f65e[_0xbb10('0x42')]=_['merge'](_0x34f65e[_0xbb10('0x42')],{'$or':_[_0xbb10('0x32')](_0x37dde7,function(_0x44d6ae){if(_0x44d6ae[_0xbb10('0x43')]!==_0xbb10('0x44')){var _0x185a52={};_0x185a52[_0x44d6ae['name']]={'$like':'%'+_0x518d47[_0xbb10('0x38')][_0xbb10('0x41')]+'%'};return _0x185a52;}})});}_0x34f65e=_[_0xbb10('0x45')]({},_0x34f65e,_0x518d47[_0xbb10('0x46')]);var _0x4943d9={'where':_0x34f65e[_0xbb10('0x42')]};return db[_0xbb10('0x33')][_0xbb10('0x25')](_0x4943d9)[_0xbb10('0x2a')](function(_0x5e2cfa){_0x359ad4[_0xbb10('0x25')]=_0x5e2cfa;if(_0x518d47[_0xbb10('0x38')]['includeAll']){_0x34f65e['include']=[{'all':!![]}];}return db[_0xbb10('0x33')]['findAll'](_0x34f65e);})[_0xbb10('0x2a')](function(_0x180933){_0x359ad4['rows']=_0x180933;return _0x359ad4;})[_0xbb10('0x2a')](respondWithFilteredResult(_0x4c3744,_0x34f65e))[_0xbb10('0x47')](handleError(_0x4c3744,null));};exports[_0xbb10('0x48')]=function(_0x5cf4f8,_0x2dd02b){var _0xebd70c={'raw':![],'where':{'id':_0x5cf4f8[_0xbb10('0x49')]['id']}},_0x3b9fdf={};_0x3b9fdf[_0xbb10('0x37')]=_[_0xbb10('0x39')](db[_0xbb10('0x33')][_0xbb10('0x34')]);_0x3b9fdf[_0xbb10('0x38')]=_[_0xbb10('0x39')](_0x5cf4f8[_0xbb10('0x38')]);_0x3b9fdf[_0xbb10('0x3a')]=_['intersection'](_0x3b9fdf[_0xbb10('0x37')],_0x3b9fdf[_0xbb10('0x38')]);_0xebd70c['attributes']=_[_0xbb10('0x3b')](_0x3b9fdf[_0xbb10('0x37')],qs[_0xbb10('0x4a')](_0x5cf4f8[_0xbb10('0x38')][_0xbb10('0x4a')]));_0xebd70c[_0xbb10('0x3c')]=_0xebd70c[_0xbb10('0x3c')]['length']?_0xebd70c['attributes']:_0x3b9fdf[_0xbb10('0x37')];if(_0x5cf4f8[_0xbb10('0x38')][_0xbb10('0x4b')]){_0xebd70c['include']=[{'all':!![]}];}_0xebd70c=_['merge']({},_0xebd70c,_0x5cf4f8[_0xbb10('0x46')]);return db[_0xbb10('0x33')][_0xbb10('0x4c')](_0xebd70c)[_0xbb10('0x2a')](handleEntityNotFound(_0x2dd02b,null))[_0xbb10('0x2a')](respondWithResult(_0x2dd02b,null))[_0xbb10('0x47')](handleError(_0x2dd02b,null));};exports[_0xbb10('0x2b')]=function(_0x460788,_0x2626d8){return db[_0xbb10('0x33')]['find']({'where':{'id':_0x460788['params']['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0x2626d8,null))[_0xbb10('0x2a')](removeEntity(_0x2626d8,null))[_0xbb10('0x47')](handleError(_0x2626d8,null));};exports[_0xbb10('0x4d')]=function(_0x36aa7d,_0x440f9e){return db[_0xbb10('0x33')][_0xbb10('0x4d')]()[_0xbb10('0x2a')](respondWithResult(_0x440f9e,null))[_0xbb10('0x47')](handleError(_0x440f9e,null));};exports[_0xbb10('0x4e')]=function(_0x20e18a,_0x61e689){var _0x2e6fd9;return db[_0xbb10('0x4f')]['transaction'](function(_0x124052){return db['VoicePrefix'][_0xbb10('0x4e')](_0x20e18a[_0xbb10('0x50')],{'transaction':_0x124052})[_0xbb10('0x2a')](function(_0x3f27ce){_0x2e6fd9=_0x3f27ce[_0xbb10('0x2c')]({'plain':!![]});return db[_0xbb10('0x51')][_0xbb10('0x4c')]({'where':{'id':_0x2e6fd9[_0xbb10('0x52')]},'raw':!![]})[_0xbb10('0x2a')](function(_0x3d71e){return createVoicePrefixExtensions(_0x2e6fd9,_0x3d71e,_0x124052);});});})[_0xbb10('0x2a')](function(){var _0x1c2dce=_0x20e18a[_0xbb10('0x53')][_0xbb10('0x2c')]({'plain':!![]});if(!_0x1c2dce)throw new Error(_0xbb10('0x54'));if(_0x1c2dce['role']===_0xbb10('0x53')){var _0x466eb7=_0x2e6fd9;return db[_0xbb10('0x55')][_0xbb10('0x4c')]({'where':{'name':_0xbb10('0x2d'),'userProfileId':_0x1c2dce[_0xbb10('0x56')]},'raw':!![]})['then'](function(_0x120bda){if(_0x120bda&&_0x120bda[_0xbb10('0x57')]===0x0){return db[_0xbb10('0x2e')][_0xbb10('0x4e')]({'name':_0x466eb7[_0xbb10('0x30')],'resourceId':_0x466eb7['id'],'type':_0x120bda[_0xbb10('0x30')],'sectionId':_0x120bda['id']},{})[_0xbb10('0x2a')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})[_0xbb10('0x47')](function(_0x205e01){logger[_0xbb10('0x58')](_0xbb10('0x59'),_0x205e01);throw _0x205e01;});}return _0x2e6fd9;})[_0xbb10('0x2a')](respondWithResult(_0x61e689,null))[_0xbb10('0x47')](handleError(_0x61e689,null));};function Extension(_0x4e7fac,_0x4ea1a6,_0x16272d,_0x3e6338){this[_0xbb10('0x5a')]=_0xbb10('0x5b');this['exten']=_0x4e7fac;this['app']=_0x16272d;this[_0xbb10('0x43')]=_0xbb10('0x5c');this[_0xbb10('0x5d')]=_0xbb10('0x5e');this[_0xbb10('0x5f')]=_0x4ea1a6;this[_0xbb10('0x60')]=_0x3e6338;}function createVoicePrefixExtensions(_0x45c0dc,_0x4a5fb9,_0x117e84){return new BPromise(function(_0x216cff,_0x4917a5){var _0x5e03cb=new Extension(formatPrefixName(_0x45c0dc['prefix']),0x1,_0xbb10('0x61'),_0xbb10('0x62'));_0x5e03cb[_0xbb10('0x63')]=_0x45c0dc['id'];return db['VoiceExtension']['create'](_0x5e03cb,{'transaction':_0x117e84})['then'](function(_0x3ebc5f){var _0x249b33=_0x3ebc5f[_0xbb10('0x2c')]({'plain':!![]});var _0x4e9fbd=_[_0xbb10('0x32')](addVoicePrefixExtensions(_0x45c0dc,_0x4a5fb9),function(_0x13131c){_0x13131c['VoiceExtensionId']=_0x249b33['id'];_0x13131c['VoicePrefixId']=_0x45c0dc['id'];return _0x13131c;});return db[_0xbb10('0x51')][_0xbb10('0x64')](_0x4e9fbd,{'transaction':_0x117e84})[_0xbb10('0x2a')](function(_0x237246){if(!_0x237246){return _0x4917a5('Extensions\x20creation\x20failed');}else{return _0x216cff(_0x237246);}})[_0xbb10('0x47')](function(_0xec48ac){return _0x4917a5(_0xec48ac);});});;});};function addVoicePrefixExtensions(_0xa7179d,_0x5202d7){var _0x402a01=[];var _0x2f05bc=formatPrefixName(_0xa7179d[_0xbb10('0x65')]);_0x402a01['push'](new Extension(_0x2f05bc,0x2,_0xbb10('0x66'),_0xbb10('0x67')+_0xa7179d[_0xbb10('0x30')]));if(_0xa7179d[_0xbb10('0x68')]){_0x402a01['push'](new Extension(_0x2f05bc,0x3,_0xbb10('0x66'),_0xbb10('0x69')+_0xa7179d[_0xbb10('0x68')]));}else{_0x402a01[_0xbb10('0x6a')](new Extension(_0x2f05bc,0x3,'NoOp',_0xbb10('0x6b')));}_0x402a01[_0xbb10('0x6a')](new Extension(_0x2f05bc,0x4,_0xbb10('0x6c'),_0x5202d7[_0xbb10('0x5a')]+','+_0xbb10('0x6d')+(0x8+_0xa7179d[_0xbb10('0x30')][_0xbb10('0x3d')])+'}'+','+0x1));return _0x402a01;}function formatPrefixName(_0x4a30c5){var _0x4a13d7='_';for(var _0x5acd5e=0x0;_0x5acd5e<_0x4a30c5[_0xbb10('0x3d')];_0x5acd5e++){if(_0x4a30c5[_0xbb10('0x6e')](_0x5acd5e)=='-'){_0x4a13d7+=_0x4a30c5[_0xbb10('0x6e')](_0x5acd5e);}else{_0x4a13d7+='['+_0x4a30c5['charAt'](_0x5acd5e)+']';}}_0x4a13d7+='.';return _0x4a13d7;}exports['update']=function(_0x46f462,_0x1b11c0,_0xd9e743){var _0x3a9677=_0x46f462[_0xbb10('0x50')];_0x3a9677[_0xbb10('0x65')]='system-'+_0x3a9677[_0xbb10('0x30')]+'-';return db[_0xbb10('0x4f')][_0xbb10('0x6f')](function(_0x14f16b){return db[_0xbb10('0x33')]['update'](_0x3a9677,{'where':{'id':_0x3a9677['id']},'transaction':_0x14f16b})['then'](function(){return db['VoiceExtension'][_0xbb10('0x2b')]({'where':{'VoicePrefixId':_0x3a9677['id']},'transaction':_0x14f16b})[_0xbb10('0x2a')](function(){return db[_0xbb10('0x51')][_0xbb10('0x4c')]({'where':{'id':_0x3a9677[_0xbb10('0x52')]},'raw':!![]})[_0xbb10('0x2a')](function(_0x5d942d){return createVoicePrefixExtensions(_0x3a9677,_0x5d942d,_0x14f16b);});});});})[_0xbb10('0x2a')](function(){return db['VoicePrefix']['findById'](_0x3a9677['id']);})['then'](respondWithResult(_0x1b11c0,null))[_0xbb10('0x47')](handleError(_0x1b11c0,null));};exports[_0xbb10('0x70')]=function(_0x23b1d5,_0x108f99,_0x5ce94f){return db[_0xbb10('0x33')]['find']({'where':{'id':_0x23b1d5['params']['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0x108f99,null))[_0xbb10('0x2a')](function(_0x29529c){if(_0x29529c){return _0x29529c[_0xbb10('0x70')](_0x23b1d5[_0xbb10('0x50')]['ids'],_[_0xbb10('0x71')](_0x23b1d5[_0xbb10('0x50')],[_0xbb10('0x72'),'id'])||{})[_0xbb10('0x73')](function(_0x43cdb7){for(var _0x27f42f=0x0;_0x27f42f<_0x23b1d5[_0xbb10('0x50')]['ids'][_0xbb10('0x3d')];_0x27f42f+=0x1){socket[_0xbb10('0x74')](_0xbb10('0x75'),{'UserId':Number(_0x23b1d5[_0xbb10('0x50')][_0xbb10('0x72')][_0x27f42f]),'VoicePrefixId':Number(_0x23b1d5[_0xbb10('0x49')]['id'])});}return _0x43cdb7;});}})[_0xbb10('0x2a')](respondWithResult(_0x108f99,null))[_0xbb10('0x47')](handleError(_0x108f99,null));};exports['removeAgents']=function(_0x428146,_0x218690,_0x145baf){return db['VoicePrefix']['find']({'where':{'id':_0x428146['params']['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0x218690,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){return _0x4e3d6a[_0xbb10('0x76')](_0x428146[_0xbb10('0x38')][_0xbb10('0x72')])[_0xbb10('0x2a')](function(){if(_[_0xbb10('0x77')](_0x428146[_0xbb10('0x38')][_0xbb10('0x72')])){for(var _0x417304=0x0;_0x417304<_0x428146[_0xbb10('0x38')]['ids'][_0xbb10('0x3d')];_0x417304+=0x1){socket[_0xbb10('0x74')](_0xbb10('0x78'),{'UserId':Number(_0x428146[_0xbb10('0x38')]['ids'][_0x417304]),'VoicePrefixId':Number(_0x428146['params']['id'])});}}else{socket[_0xbb10('0x74')](_0xbb10('0x78'),{'UserId':Number(_0x428146[_0xbb10('0x38')][_0xbb10('0x72')]),'VoicePrefixId':Number(_0x428146['params']['id'])});}});}})[_0xbb10('0x2a')](respondWithStatusCode(_0x218690,null))[_0xbb10('0x47')](handleError(_0x218690,null));};exports[_0xbb10('0x79')]=function(_0xf7b3e1,_0x35c1e8,_0x517185){var _0x5f0691={};var _0x372636={};var _0x53c698;var _0x22c030;return db['VoicePrefix'][_0xbb10('0x7a')]({'where':{'id':_0xf7b3e1[_0xbb10('0x49')]['id']}})['then'](handleEntityNotFound(_0x35c1e8,null))['then'](function(_0x2f667f){if(_0x2f667f){_0x53c698=_0x2f667f;_0x372636[_0xbb10('0x37')]=_[_0xbb10('0x39')](db['User'][_0xbb10('0x34')]);_0x372636[_0xbb10('0x38')]=_[_0xbb10('0x39')](_0xf7b3e1[_0xbb10('0x38')]);_0x372636[_0xbb10('0x3a')]=_[_0xbb10('0x3b')](_0x372636[_0xbb10('0x37')],_0x372636[_0xbb10('0x38')]);_0x5f0691[_0xbb10('0x3c')]=_['intersection'](_0x372636[_0xbb10('0x37')],qs[_0xbb10('0x4a')](_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x4a')]));_0x5f0691[_0xbb10('0x3c')]=_0x5f0691[_0xbb10('0x3c')][_0xbb10('0x3d')]?_0x5f0691[_0xbb10('0x3c')]:_0x372636[_0xbb10('0x37')];_0x5f0691[_0xbb10('0x7b')]=qs[_0xbb10('0x3f')](_0xf7b3e1[_0xbb10('0x38')]['sort']);_0x5f0691['where']=qs[_0xbb10('0x3a')](_[_0xbb10('0x40')](_0xf7b3e1[_0xbb10('0x38')],_0x372636[_0xbb10('0x3a')]));if(_0xf7b3e1[_0xbb10('0x38')]['filter']){_0x5f0691[_0xbb10('0x42')]=_[_0xbb10('0x45')](_0x5f0691[_0xbb10('0x42')],{'$or':_[_0xbb10('0x32')](_0x5f0691[_0xbb10('0x3c')],function(_0x379d49){var _0x546db5={};_0x546db5[_0x379d49]={'$like':'%'+_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x41')]+'%'};return _0x546db5;})});}_0x5f0691=_['merge']({},_0x5f0691,_0xf7b3e1[_0xbb10('0x46')]);return _0x53c698['getAgents'](_0x5f0691);}})[_0xbb10('0x2a')](function(_0x28bd76){if(_0x28bd76){_0x22c030=_0x28bd76[_0xbb10('0x3d')];if(!_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x3e')]('nolimit')){_0x5f0691[_0xbb10('0x24')]=qs['limit'](_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x24')]);_0x5f0691['offset']=qs['offset'](_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x22')]);}return _0x53c698[_0xbb10('0x79')](_0x5f0691);}})[_0xbb10('0x2a')](function(_0x18d18d){if(_0x18d18d){return _0x18d18d?{'count':_0x22c030,'rows':_0x18d18d}:null;}})[_0xbb10('0x2a')](respondWithResult(_0x35c1e8,null))[_0xbb10('0x47')](handleError(_0x35c1e8,null));};exports[_0xbb10('0x7c')]=function(_0x252ab8,_0xbccd46,_0x2bf9dd){var _0x4c0b83={};var _0x2b9a50={};var _0x3eeceb;var _0x1b0a6c;return db[_0xbb10('0x33')][_0xbb10('0x7a')]({'where':{'id':_0x252ab8[_0xbb10('0x49')]['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0xbccd46,null))[_0xbb10('0x2a')](function(_0x3e6fe2){if(_0x3e6fe2){_0x3eeceb=_0x3e6fe2;_0x2b9a50[_0xbb10('0x37')]=_[_0xbb10('0x39')](db[_0xbb10('0x7d')]['rawAttributes']);_0x2b9a50[_0xbb10('0x38')]=_['keys'](_0x252ab8[_0xbb10('0x38')]);_0x2b9a50[_0xbb10('0x3a')]=_[_0xbb10('0x3b')](_0x2b9a50[_0xbb10('0x37')],_0x2b9a50[_0xbb10('0x38')]);_0x4c0b83['attributes']=_[_0xbb10('0x3b')](_0x2b9a50[_0xbb10('0x37')],qs[_0xbb10('0x4a')](_0x252ab8[_0xbb10('0x38')][_0xbb10('0x4a')]));_0x4c0b83[_0xbb10('0x3c')]=_0x4c0b83['attributes']['length']?_0x4c0b83[_0xbb10('0x3c')]:_0x2b9a50[_0xbb10('0x37')];_0x4c0b83[_0xbb10('0x7b')]=qs['sort'](_0x252ab8[_0xbb10('0x38')][_0xbb10('0x3f')]);_0x4c0b83['where']=qs[_0xbb10('0x3a')](_[_0xbb10('0x40')](_0x252ab8['query'],_0x2b9a50[_0xbb10('0x3a')]));if(_0x252ab8['query'][_0xbb10('0x41')]){_0x4c0b83[_0xbb10('0x42')]=_['merge'](_0x4c0b83[_0xbb10('0x42')],{'$or':_[_0xbb10('0x32')](_0x4c0b83['attributes'],function(_0x5dae56){var _0xea6bf2={};_0xea6bf2[_0x5dae56]={'$like':'%'+_0x252ab8[_0xbb10('0x38')][_0xbb10('0x41')]+'%'};return _0xea6bf2;})});}_0x4c0b83=_[_0xbb10('0x45')]({},_0x4c0b83,_0x252ab8[_0xbb10('0x46')]);return _0x3eeceb['getTeams'](_0x4c0b83);}})[_0xbb10('0x2a')](function(_0x9f2e0f){if(_0x9f2e0f){_0x1b0a6c=_0x9f2e0f[_0xbb10('0x3d')];if(!_0x252ab8['query'][_0xbb10('0x3e')](_0xbb10('0x7e'))){_0x4c0b83[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x252ab8[_0xbb10('0x38')][_0xbb10('0x24')]);_0x4c0b83[_0xbb10('0x22')]=qs[_0xbb10('0x22')](_0x252ab8[_0xbb10('0x38')]['offset']);}return _0x3eeceb['getTeams'](_0x4c0b83);}})[_0xbb10('0x2a')](function(_0xe7238b){if(_0xe7238b){return _0xe7238b?{'count':_0x1b0a6c,'rows':_0xe7238b}:null;}})[_0xbb10('0x2a')](respondWithResult(_0xbccd46,null))[_0xbb10('0x47')](handleError(_0xbccd46,null));};exports[_0xbb10('0x7f')]=function(_0x363b81,_0x1cccec,_0x1674f7){var _0x3ede66=_0x363b81[_0xbb10('0x50')][_0xbb10('0x72')];var _0x167734;return db[_0xbb10('0x7d')]['findAll']({'where':{'id':_0x3ede66},'attributes':['id'],'include':[{'model':db[_0xbb10('0x80')],'as':_0xbb10('0x81'),'attributes':['id',_0xbb10('0x30'),_0xbb10('0x82'),_0xbb10('0x83'),_0xbb10('0x84')],'raw':!![]}]})[_0xbb10('0x2a')](function(_0x1421e2){if(_0x1421e2){_0x167734=_0x1421e2;var _0x3c6c45=_[_0xbb10('0x85')](_0x1421e2,function(_0x2a1c53){var _0x57f4a3=_0x2a1c53[_0xbb10('0x2c')]({'plain':!![]});return _0x57f4a3['Agents'];});return db[_0xbb10('0x33')][_0xbb10('0x4c')]({'where':{'id':_0x363b81[_0xbb10('0x49')]['id']}})[_0xbb10('0x2a')](function(_0x2b6e27){return db[_0xbb10('0x4f')]['transaction'](function(_0x2d8a25){return _0x2b6e27['addTeams'](_0x3ede66,{'transaction':_0x2d8a25})[_0xbb10('0x2a')](function(){return BPromise[_0xbb10('0x86')](_0x167734,function(_0xda122){return db[_0xbb10('0x87')][_0xbb10('0x88')]({'TeamId':_0xda122['id'],'VoicePrefixId':_0x363b81[_0xbb10('0x49')]['id']},{'transaction':_0x2d8a25});});})[_0xbb10('0x2a')](function(){return BPromise[_0xbb10('0x86')](_0x3c6c45,function(_0x25c5b2){return db[_0xbb10('0x89')][_0xbb10('0x8a')]({'where':{'UserId':_0x25c5b2['id'],'VoicePrefixId':_0x363b81[_0xbb10('0x49')]['id']},'transaction':_0x2d8a25});});})['then'](function(){_0x3c6c45[_0xbb10('0x8b')](function(_0x516520){socket[_0xbb10('0x74')](_0xbb10('0x75'),{'UserId':_0x516520['id'],'VoicePrefixId':_0x2b6e27['id']});});});});});}})[_0xbb10('0x2a')](respondWithStatusCode(_0x1cccec,null))[_0xbb10('0x47')](handleError(_0x1cccec,null));};exports[_0xbb10('0x8c')]=function(_0x40271f,_0x185ec9,_0x5e9888){return db[_0xbb10('0x7d')]['findAll']({'where':{'id':_0x40271f['query'][_0xbb10('0x72')]},'attributes':['id'],'include':[{'model':db[_0xbb10('0x80')],'as':_0xbb10('0x81'),'attributes':['id'],'raw':!![]}]})[_0xbb10('0x2a')](handleEntityNotFound(_0x185ec9,null))[_0xbb10('0x2a')](function(_0x16b8c1){var _0x5d1077=_[_0xbb10('0x32')](_0x16b8c1,'id');var _0x2c25ab=[];var _0x39aa9e=[];var _0xb1b7c8=squel[_0xbb10('0x8d')]();_0xb1b7c8[_0xbb10('0x8e')]('tq.TeamId')[_0xbb10('0x8f')](_0xbb10('0x90'),'tq')[_0xbb10('0x91')](_0xbb10('0x92'),'ut',_0xbb10('0x93'))[_0xbb10('0x42')](_0xbb10('0x94'),_0x40271f['params']['id']);for(var _0x33a43e=0x0;_0x33a43e<_0x16b8c1['length'];_0x33a43e+=0x1){let _0x3afbcf=_0x16b8c1[_0x33a43e];for(var _0x4a6660=0x0;_0x4a6660<_0x3afbcf['Agents'][_0xbb10('0x3d')];_0x4a6660+=0x1){let _0x225064=_0x3afbcf[_0xbb10('0x81')][_0x4a6660];var _0x3b7552=_0xb1b7c8[_0xbb10('0x95')]();_0x3b7552['where'](_0xbb10('0x96'),_0x225064['id']);_0x39aa9e['push'](db['sequelize']['query'](_0x3b7552[_0xbb10('0x97')](),{'type':db[_0xbb10('0x4f')][_0xbb10('0x98')][_0xbb10('0x99')]})[_0xbb10('0x2a')](function(_0x5abedf){if(_0x5abedf[_0xbb10('0x3d')]===0x1){return _0x225064['id'];}else{var _0x42a2d7=_[_0xbb10('0x9a')](_[_0xbb10('0x32')](_0x5abedf,_0xbb10('0x9b')),function(_0x37ff15){return _[_0xbb10('0x9c')](_0x5d1077,_0x37ff15);});if(_0x42a2d7){return _0x225064['id'];}}}));}}return BPromise['all'](_0x39aa9e)['then'](function(_0x584a62){_0x2c25ab=_(_0x2c25ab)[_0xbb10('0x9d')](_0x584a62)[_0xbb10('0x9e')]()[_0xbb10('0x9f')]();return db[_0xbb10('0x33')][_0xbb10('0x4c')]({'where':{'id':_0x40271f[_0xbb10('0x49')]['id']}})[_0xbb10('0x2a')](function(_0x423628){return db[_0xbb10('0x4f')][_0xbb10('0x6f')](function(_0x4cc8d4){return _0x423628['removeTeams'](_0x40271f['query'][_0xbb10('0x72')],{'transaction':_0x4cc8d4})[_0xbb10('0x2a')](function(){if(!_[_0xbb10('0xa0')](_0x2c25ab)){return _0x423628['removeAgents'](_0x2c25ab,{'transaction':_0x4cc8d4});}})[_0xbb10('0x2a')](function(){_0x2c25ab[_0xbb10('0x8b')](function(_0x2c638d){socket[_0xbb10('0x74')](_0xbb10('0x78'),{'UserId':_0x2c638d,'VoicePrefixId':_0x423628['id']});});});});});});})[_0xbb10('0x2a')](respondWithStatusCode(_0x185ec9,null))['catch'](handleError(_0x185ec9,null));}; \ No newline at end of file +var _0x4888=['send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','compact','value','isEmpty','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','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name'];(function(_0x233c11,_0x1083e4){var _0x381729=function(_0x43b75b){while(--_0x43b75b){_0x233c11['push'](_0x233c11['shift']());}};_0x381729(++_0x1083e4);}(_0x4888,0x198));var _0x8488=function(_0x1f98e4,_0x48bb7d){_0x1f98e4=_0x1f98e4-0x0;var _0x2838e1=_0x4888[_0x1f98e4];return _0x2838e1;};'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'];config[_0x8488('0x17')]=_[_0x8488('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8488('0x19'))(new Redis(config['redis']));require(_0x8488('0x1a'))['register'](socket);function respondWithStatusCode(_0x5161a3,_0x24d0a0){_0x24d0a0=_0x24d0a0||0xcc;return function(_0x3635da){if(_0x3635da){return _0x5161a3[_0x8488('0x1b')](_0x24d0a0);}return _0x5161a3[_0x8488('0x1c')](_0x24d0a0)[_0x8488('0x1d')]();};}function respondWithResult(_0x8d3b3d,_0x165139){_0x165139=_0x165139||0xc8;return function(_0x4e44af){if(_0x4e44af){return _0x8d3b3d[_0x8488('0x1c')](_0x165139)[_0x8488('0x1e')](_0x4e44af);}};}function respondWithFilteredResult(_0x3edfe4,_0x37361d){return function(_0x60ae2f){if(_0x60ae2f){var _0x39775f=typeof _0x37361d[_0x8488('0x1f')]===_0x8488('0x20')&&typeof _0x37361d[_0x8488('0x21')]===_0x8488('0x20');var _0x10bfd6=_0x60ae2f[_0x8488('0x22')];var _0x3dd93e=_0x39775f?0x0:_0x37361d['offset'];var _0x4a1b45=_0x39775f?_0x60ae2f[_0x8488('0x22')]:_0x37361d[_0x8488('0x1f')]+_0x37361d[_0x8488('0x21')];var _0x3c9fc2;if(_0x4a1b45>=_0x10bfd6){_0x4a1b45=_0x10bfd6;_0x3c9fc2=0xc8;}else{_0x3c9fc2=0xce;}_0x3edfe4[_0x8488('0x1c')](_0x3c9fc2);return _0x3edfe4[_0x8488('0x23')](_0x8488('0x24'),_0x3dd93e+'-'+_0x4a1b45+'/'+_0x10bfd6)[_0x8488('0x1e')](_0x60ae2f);}return null;};}function patchUpdates(_0x39dd43){return function(_0x5123d0){try{jsonpatch[_0x8488('0x25')](_0x5123d0,_0x39dd43,!![]);}catch(_0x4e07e1){return BPromise[_0x8488('0x26')](_0x4e07e1);}return _0x5123d0[_0x8488('0x27')]();};}function saveUpdates(_0x290b33,_0x54ecda){return function(_0x577234){if(_0x577234){return _0x577234['update'](_0x290b33)['then'](function(_0x472624){return _0x472624;});}return null;};}function removeEntity(_0x51fe30,_0x58057a){return function(_0x26bdbb){if(_0x26bdbb){return _0x26bdbb[_0x8488('0x28')]()[_0x8488('0x29')](function(){var _0x6ebee0=_0x26bdbb[_0x8488('0x2a')]({'plain':!![]});var _0x503b83=_0x8488('0x2b');return db[_0x8488('0x2c')][_0x8488('0x28')]({'where':{'type':_0x503b83,'resourceId':_0x6ebee0['id']}})[_0x8488('0x29')](function(){return _0x26bdbb;});})[_0x8488('0x29')](function(){_0x51fe30[_0x8488('0x1c')](0xcc)[_0x8488('0x1d')]();});}};}function handleEntityNotFound(_0x296b6c,_0x368f9c){return function(_0x1d9317){if(!_0x1d9317){_0x296b6c[_0x8488('0x1b')](0x194);}return _0x1d9317;};}function handleError(_0x58d0cc,_0x57ce3c){_0x57ce3c=_0x57ce3c||0x1f4;return function(_0x4e3fe2){logger[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);if(_0x4e3fe2[_0x8488('0x2f')]){delete _0x4e3fe2[_0x8488('0x2f')];}_0x58d0cc[_0x8488('0x1c')](_0x57ce3c)[_0x8488('0x30')](_0x4e3fe2);};}exports['index']=function(_0x2292e0,_0x14f378){var _0x208753={},_0x3649f7={},_0x18eb27={'count':0x0,'rows':[]};var _0x501981=_[_0x8488('0x31')](db[_0x8488('0x32')]['rawAttributes'],function(_0x1b0637){return{'name':_0x1b0637[_0x8488('0x33')],'type':_0x1b0637[_0x8488('0x34')][_0x8488('0x35')]};});_0x3649f7[_0x8488('0x36')]=_['map'](_0x501981,_0x8488('0x2f'));_0x3649f7[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2292e0['query']);_0x3649f7[_0x8488('0x39')]=_['intersection'](_0x3649f7[_0x8488('0x36')],_0x3649f7[_0x8488('0x37')]);_0x208753[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x3649f7['model'],qs[_0x8488('0x3c')](_0x2292e0[_0x8488('0x37')][_0x8488('0x3c')]));_0x208753['attributes']=_0x208753[_0x8488('0x3a')][_0x8488('0x3d')]?_0x208753[_0x8488('0x3a')]:_0x3649f7[_0x8488('0x36')];if(!_0x2292e0[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x208753[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2292e0[_0x8488('0x37')][_0x8488('0x21')]);_0x208753['offset']=qs['offset'](_0x2292e0[_0x8488('0x37')][_0x8488('0x1f')]);}_0x208753[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2292e0[_0x8488('0x37')][_0x8488('0x41')]);_0x208753[_0x8488('0x42')]=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x2292e0['query'],_0x3649f7[_0x8488('0x39')]),_0x501981);if(_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]){_0x208753['where']=_[_0x8488('0x45')](_0x208753[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x501981,function(_0x28bc84){if(_0x28bc84[_0x8488('0x34')]!==_0x8488('0x46')){var _0x1aac4b={};_0x1aac4b[_0x28bc84['name']]={'$like':'%'+_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x1aac4b;}})});}_0x208753=_[_0x8488('0x45')]({},_0x208753,_0x2292e0['options']);var _0x3649ae={'where':_0x208753['where']};return db[_0x8488('0x32')][_0x8488('0x22')](_0x3649ae)['then'](function(_0x22a3f3){_0x18eb27[_0x8488('0x22')]=_0x22a3f3;if(_0x2292e0[_0x8488('0x37')][_0x8488('0x47')]){_0x208753[_0x8488('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8488('0x49')](_0x208753);})['then'](function(_0x3440ae){_0x18eb27[_0x8488('0x4a')]=_0x3440ae;return _0x18eb27;})[_0x8488('0x29')](respondWithFilteredResult(_0x14f378,_0x208753))[_0x8488('0x4b')](handleError(_0x14f378,null));};exports[_0x8488('0x4c')]=function(_0x3dd1cb,_0x1ae9af){var _0x192617={'raw':![],'where':{'id':_0x3dd1cb[_0x8488('0x4d')]['id']}},_0xfe2e8f={};_0xfe2e8f[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x32')][_0x8488('0x4e')]);_0xfe2e8f[_0x8488('0x37')]=_[_0x8488('0x38')](_0x3dd1cb[_0x8488('0x37')]);_0xfe2e8f['filters']=_[_0x8488('0x3b')](_0xfe2e8f[_0x8488('0x36')],_0xfe2e8f[_0x8488('0x37')]);_0x192617[_0x8488('0x3a')]=_['intersection'](_0xfe2e8f[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x3dd1cb[_0x8488('0x37')][_0x8488('0x3c')]));_0x192617['attributes']=_0x192617[_0x8488('0x3a')][_0x8488('0x3d')]?_0x192617[_0x8488('0x3a')]:_0xfe2e8f[_0x8488('0x36')];if(_0x3dd1cb[_0x8488('0x37')][_0x8488('0x47')]){_0x192617[_0x8488('0x48')]=[{'all':!![]}];}_0x192617=_[_0x8488('0x45')]({},_0x192617,_0x3dd1cb[_0x8488('0x4f')]);return db[_0x8488('0x32')][_0x8488('0x50')](_0x192617)[_0x8488('0x29')](handleEntityNotFound(_0x1ae9af,null))[_0x8488('0x29')](respondWithResult(_0x1ae9af,null))['catch'](handleError(_0x1ae9af,null));};exports['destroy']=function(_0x8267e1,_0x1a66ff){return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x8267e1[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x1a66ff,null))[_0x8488('0x29')](removeEntity(_0x1a66ff,null))[_0x8488('0x4b')](handleError(_0x1a66ff,null));};exports[_0x8488('0x51')]=function(_0x481975,_0x474a0b){return db[_0x8488('0x32')]['describe']()[_0x8488('0x29')](respondWithResult(_0x474a0b,null))[_0x8488('0x4b')](handleError(_0x474a0b,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){var _0x198328;return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x5c55bf){return db[_0x8488('0x32')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x55')],{'transaction':_0x5c55bf})[_0x8488('0x29')](function(_0x48caa1){_0x198328=_0x48caa1[_0x8488('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x198328[_0x8488('0x56')]},'raw':!![]})['then'](function(_0x3453c7){return createVoicePrefixExtensions(_0x198328,_0x3453c7,_0x5c55bf);});});})[_0x8488('0x29')](function(){var _0x417afa=_0x1ff9c5[_0x8488('0x57')][_0x8488('0x2a')]({'plain':!![]});if(!_0x417afa)throw new Error(_0x8488('0x58'));if(_0x417afa['role']===_0x8488('0x57')){var _0x693741=_0x198328;return db[_0x8488('0x59')][_0x8488('0x50')]({'where':{'name':_0x8488('0x2b'),'userProfileId':_0x417afa['userProfileId']},'raw':!![]})[_0x8488('0x29')](function(_0x5a04d7){if(_0x5a04d7&&_0x5a04d7[_0x8488('0x5a')]===0x0){return db[_0x8488('0x2c')]['create']({'name':_0x693741[_0x8488('0x2f')],'resourceId':_0x693741['id'],'type':_0x5a04d7[_0x8488('0x2f')],'sectionId':_0x5a04d7['id']},{})[_0x8488('0x29')](function(){return _0x198328;});}else{return _0x198328;}})[_0x8488('0x4b')](function(_0x4041e5){logger[_0x8488('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4041e5);throw _0x4041e5;});}return _0x198328;})[_0x8488('0x29')](respondWithResult(_0x4f80fb,null))['catch'](handleError(_0x4f80fb,null));};function Extension(_0x31dcc6,_0x3fa6e2,_0x3c06a4,_0x3fa288){this[_0x8488('0x5b')]=_0x8488('0x5c');this['exten']=_0x31dcc6;this[_0x8488('0x5d')]=_0x3c06a4;this['type']=_0x8488('0x5e');this[_0x8488('0x5f')]=_0x8488('0x60');this[_0x8488('0x61')]=_0x3fa6e2;this[_0x8488('0x62')]=_0x3fa288;}function createVoicePrefixExtensions(_0x24ba2d,_0x4facfb,_0x5755af){return new BPromise(function(_0x5c8310,_0x28ddb0){var _0x1988cf=new Extension(formatPrefixName(_0x24ba2d[_0x8488('0x63')]),0x1,_0x8488('0x64'),_0x8488('0x65'));_0x1988cf[_0x8488('0x66')]=_0x24ba2d['id'];return db[_0x8488('0x67')][_0x8488('0x52')](_0x1988cf,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0xa90a65){var _0x57fdbb=_0xa90a65[_0x8488('0x2a')]({'plain':!![]});var _0x174c57=_[_0x8488('0x31')](addVoicePrefixExtensions(_0x24ba2d,_0x4facfb),function(_0x4ba14e){_0x4ba14e['VoiceExtensionId']=_0x57fdbb['id'];_0x4ba14e[_0x8488('0x66')]=_0x24ba2d['id'];return _0x4ba14e;});return db[_0x8488('0x67')][_0x8488('0x68')](_0x174c57,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0x52bc90){if(!_0x52bc90){return _0x28ddb0('Extensions\x20creation\x20failed');}else{return _0x5c8310(_0x52bc90);}})[_0x8488('0x4b')](function(_0x26e0cc){return _0x28ddb0(_0x26e0cc);});});;});};function addVoicePrefixExtensions(_0x50897,_0x4856fc){var _0x3c3e89=[];var _0x401f4d=formatPrefixName(_0x50897[_0x8488('0x63')]);_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x2,_0x8488('0x6a'),'CDR(prefix)='+_0x50897[_0x8488('0x2f')]));if(_0x50897[_0x8488('0x6b')]){_0x3c3e89['push'](new Extension(_0x401f4d,0x3,_0x8488('0x6a'),_0x8488('0x6c')+_0x50897['callerIdAll']));}else{_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x3,_0x8488('0x64'),_0x8488('0x6d')));}_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x4,_0x8488('0x6e'),_0x4856fc[_0x8488('0x5b')]+','+_0x8488('0x6f')+(0x8+_0x50897['name'][_0x8488('0x3d')])+'}'+','+0x1));return _0x3c3e89;}function formatPrefixName(_0x3b7aa8){var _0x480666='_';for(var _0x49ef10=0x0;_0x49ef10<_0x3b7aa8[_0x8488('0x3d')];_0x49ef10++){if(_0x3b7aa8[_0x8488('0x70')](_0x49ef10)=='-'){_0x480666+=_0x3b7aa8[_0x8488('0x70')](_0x49ef10);}else{_0x480666+='['+_0x3b7aa8['charAt'](_0x49ef10)+']';}}_0x480666+='.';return _0x480666;}exports[_0x8488('0x71')]=function(_0x852e08,_0x56b35a,_0x42b5c5){var _0x59da4a=_0x852e08[_0x8488('0x55')];_0x59da4a[_0x8488('0x63')]=_0x8488('0x72')+_0x59da4a['name']+'-';return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x57955d){return db['VoicePrefix'][_0x8488('0x71')](_0x59da4a,{'where':{'id':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x28')]({'where':{'VoicePrefixId':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x50')]({'where':{'id':_0x59da4a[_0x8488('0x56')]},'raw':!![]})[_0x8488('0x29')](function(_0x1ff111){return createVoicePrefixExtensions(_0x59da4a,_0x1ff111,_0x57955d);});});});})['then'](function(){return db[_0x8488('0x32')]['findById'](_0x59da4a['id']);})[_0x8488('0x29')](respondWithResult(_0x56b35a,null))[_0x8488('0x4b')](handleError(_0x56b35a,null));};exports[_0x8488('0x73')]=function(_0x3349e3,_0x54283a,_0x1b96c5){return db[_0x8488('0x32')]['find']({'where':{'id':_0x3349e3[_0x8488('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54283a,null))[_0x8488('0x29')](function(_0x15b919){if(_0x15b919){return _0x15b919[_0x8488('0x73')](_0x3349e3[_0x8488('0x55')][_0x8488('0x74')],_[_0x8488('0x75')](_0x3349e3[_0x8488('0x55')],[_0x8488('0x74'),'id'])||{})['spread'](function(_0x1ce726){for(var _0x53d87e=0x0;_0x53d87e<_0x3349e3['body'][_0x8488('0x74')][_0x8488('0x3d')];_0x53d87e+=0x1){socket[_0x8488('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x3349e3['body'][_0x8488('0x74')][_0x53d87e]),'VoicePrefixId':Number(_0x3349e3[_0x8488('0x4d')]['id'])});}return _0x1ce726;});}})['then'](respondWithResult(_0x54283a,null))[_0x8488('0x4b')](handleError(_0x54283a,null));};exports[_0x8488('0x77')]=function(_0x924138,_0x173d35,_0x2a3acf){return db[_0x8488('0x32')]['find']({'where':{'id':_0x924138[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x173d35,null))[_0x8488('0x29')](function(_0x4a2fd9){if(_0x4a2fd9){return _0x4a2fd9[_0x8488('0x77')](_0x924138[_0x8488('0x37')][_0x8488('0x74')])['then'](function(){if(_[_0x8488('0x78')](_0x924138[_0x8488('0x37')]['ids'])){for(var _0x48860c=0x0;_0x48860c<_0x924138[_0x8488('0x37')][_0x8488('0x74')]['length'];_0x48860c+=0x1){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':Number(_0x924138['query']['ids'][_0x48860c]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}}else{socket['emit'](_0x8488('0x79'),{'UserId':Number(_0x924138[_0x8488('0x37')][_0x8488('0x74')]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173d35,null))[_0x8488('0x4b')](handleError(_0x173d35,null));};exports['getAgents']=function(_0x2b2989,_0x4d0d20,_0x2f137a){var _0x1a3a2d={};var _0x267401={};var _0x1e635a;var _0x31ab35;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x2b2989[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x4d0d20,null))[_0x8488('0x29')](function(_0xce1d1a){if(_0xce1d1a){_0x1e635a=_0xce1d1a;_0x267401[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x7b')]['rawAttributes']);_0x267401[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2b2989['query']);_0x267401[_0x8488('0x39')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],_0x267401[_0x8488('0x37')]);_0x1a3a2d[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x2b2989[_0x8488('0x37')][_0x8488('0x3c')]));_0x1a3a2d[_0x8488('0x3a')]=_0x1a3a2d['attributes'][_0x8488('0x3d')]?_0x1a3a2d[_0x8488('0x3a')]:_0x267401['model'];_0x1a3a2d[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2b2989[_0x8488('0x37')][_0x8488('0x41')]);_0x1a3a2d[_0x8488('0x42')]=qs['filters'](_['pick'](_0x2b2989[_0x8488('0x37')],_0x267401[_0x8488('0x39')]));if(_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]){_0x1a3a2d[_0x8488('0x42')]=_[_0x8488('0x45')](_0x1a3a2d[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x1a3a2d[_0x8488('0x3a')],function(_0x167437){var _0x3152d0={};_0x3152d0[_0x167437]={'$like':'%'+_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x3152d0;})});}_0x1a3a2d=_[_0x8488('0x45')]({},_0x1a3a2d,_0x2b2989[_0x8488('0x4f')]);return _0x1e635a['getAgents'](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x5d5234){if(_0x5d5234){_0x31ab35=_0x5d5234['length'];if(!_0x2b2989[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x1a3a2d[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2b2989[_0x8488('0x37')][_0x8488('0x21')]);_0x1a3a2d[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x2b2989[_0x8488('0x37')]['offset']);}return _0x1e635a[_0x8488('0x7c')](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x179637){if(_0x179637){return _0x179637?{'count':_0x31ab35,'rows':_0x179637}:null;}})[_0x8488('0x29')](respondWithResult(_0x4d0d20,null))[_0x8488('0x4b')](handleError(_0x4d0d20,null));};exports[_0x8488('0x7d')]=function(_0x47f7c5,_0x2d7a33,_0x5b0d69){var _0x36f6e4={};var _0x3936b6={};var _0x4be018;var _0x57a4e7;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x47f7c5[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x2d7a33,null))[_0x8488('0x29')](function(_0x5718a7){if(_0x5718a7){_0x4be018=_0x5718a7;_0x3936b6[_0x8488('0x36')]=_[_0x8488('0x38')](db['Team']['rawAttributes']);_0x3936b6[_0x8488('0x37')]=_[_0x8488('0x38')](_0x47f7c5[_0x8488('0x37')]);_0x3936b6['filters']=_['intersection'](_0x3936b6[_0x8488('0x36')],_0x3936b6[_0x8488('0x37')]);_0x36f6e4[_0x8488('0x3a')]=_['intersection'](_0x3936b6[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x3c')]));_0x36f6e4[_0x8488('0x3a')]=_0x36f6e4[_0x8488('0x3a')][_0x8488('0x3d')]?_0x36f6e4[_0x8488('0x3a')]:_0x3936b6[_0x8488('0x36')];_0x36f6e4[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x41')]);_0x36f6e4['where']=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x47f7c5[_0x8488('0x37')],_0x3936b6['filters']));if(_0x47f7c5[_0x8488('0x37')]['filter']){_0x36f6e4[_0x8488('0x42')]=_['merge'](_0x36f6e4['where'],{'$or':_[_0x8488('0x31')](_0x36f6e4['attributes'],function(_0x42f36b){var _0x186e19={};_0x186e19[_0x42f36b]={'$like':'%'+_0x47f7c5[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x186e19;})});}_0x36f6e4=_['merge']({},_0x36f6e4,_0x47f7c5[_0x8488('0x4f')]);return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})[_0x8488('0x29')](function(_0x37ca73){if(_0x37ca73){_0x57a4e7=_0x37ca73['length'];if(!_0x47f7c5[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x36f6e4[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x47f7c5['query']['limit']);_0x36f6e4[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x1f')]);}return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})['then'](function(_0x4806f8){if(_0x4806f8){return _0x4806f8?{'count':_0x57a4e7,'rows':_0x4806f8}:null;}})['then'](respondWithResult(_0x2d7a33,null))[_0x8488('0x4b')](handleError(_0x2d7a33,null));};exports[_0x8488('0x7e')]=function(_0x2bab71,_0x5dacab,_0x30aab3){var _0x6c2e31=_0x2bab71['body'][_0x8488('0x74')];var _0x20cdc8;return db[_0x8488('0x7f')][_0x8488('0x49')]({'where':{'id':_0x6c2e31},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id',_0x8488('0x2f'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83')],'raw':!![]}]})[_0x8488('0x29')](function(_0x13add2){if(_0x13add2){_0x20cdc8=_0x13add2;var _0xa0c692=_['flatMap'](_0x13add2,function(_0x8fc636){var _0x17c6e1=_0x8fc636['get']({'plain':!![]});return _0x17c6e1['Agents'];});return db['VoicePrefix'][_0x8488('0x50')]({'where':{'id':_0x2bab71[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](function(_0x4ba801){return db[_0x8488('0x53')]['transaction'](function(_0x447535){return _0x4ba801[_0x8488('0x7e')](_0x6c2e31,{'transaction':_0x447535})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0x20cdc8,function(_0x1e45ac){return db['TeamVoicePrefix'][_0x8488('0x85')]({'TeamId':_0x1e45ac['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},{'transaction':_0x447535});});})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0xa0c692,function(_0x584f02){return db['UserVoicePrefix'][_0x8488('0x86')]({'where':{'UserId':_0x584f02['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},'transaction':_0x447535});});})[_0x8488('0x29')](function(){_0xa0c692[_0x8488('0x87')](function(_0x2f8191){socket[_0x8488('0x76')](_0x8488('0x88'),{'UserId':_0x2f8191['id'],'VoicePrefixId':_0x4ba801['id']});});});});});}})[_0x8488('0x29')](respondWithStatusCode(_0x5dacab,null))[_0x8488('0x4b')](handleError(_0x5dacab,null));};exports[_0x8488('0x89')]=function(_0x1f5a8b,_0x1e7617,_0x315136){return db[_0x8488('0x7f')]['findAll']({'where':{'id':_0x1f5a8b['query'][_0x8488('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x29')](handleEntityNotFound(_0x1e7617,null))[_0x8488('0x29')](function(_0x22f2de){var _0x280c77=_[_0x8488('0x31')](_0x22f2de,'id');var _0x2a822b=[];var _0x4d611a=[];var _0x46195e=squel[_0x8488('0x8a')]();_0x46195e[_0x8488('0x8b')]('tq.TeamId')[_0x8488('0x8c')](_0x8488('0x8d'),'tq')[_0x8488('0x8e')](_0x8488('0x8f'),'ut',_0x8488('0x90'))[_0x8488('0x42')](_0x8488('0x91'),_0x1f5a8b[_0x8488('0x4d')]['id']);for(var _0x4a7be5=0x0;_0x4a7be5<_0x22f2de['length'];_0x4a7be5+=0x1){let _0x548a7a=_0x22f2de[_0x4a7be5];for(var _0x215d7e=0x0;_0x215d7e<_0x548a7a[_0x8488('0x80')][_0x8488('0x3d')];_0x215d7e+=0x1){let _0x1865f5=_0x548a7a[_0x8488('0x80')][_0x215d7e];var _0x2966ec=_0x46195e['clone']();_0x2966ec[_0x8488('0x42')]('ut.UserId\x20=\x20?',_0x1865f5['id']);_0x4d611a[_0x8488('0x69')](db[_0x8488('0x53')][_0x8488('0x37')](_0x2966ec[_0x8488('0x92')](),{'type':db[_0x8488('0x53')]['QueryTypes'][_0x8488('0x93')]})[_0x8488('0x29')](function(_0x300294){if(_0x300294[_0x8488('0x3d')]===0x1){return _0x1865f5['id'];}else{var _0x14e4a9=_[_0x8488('0x94')](_[_0x8488('0x31')](_0x300294,'TeamId'),function(_0x36600b){return _['includes'](_0x280c77,_0x36600b);});if(_0x14e4a9){return _0x1865f5['id'];}}}));}}return BPromise['all'](_0x4d611a)[_0x8488('0x29')](function(_0x323343){_0x2a822b=_(_0x2a822b)['union'](_0x323343)[_0x8488('0x95')]()[_0x8488('0x96')]();return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x1f5a8b[_0x8488('0x4d')]['id']}})['then'](function(_0x541b76){return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x3e2f85){return _0x541b76[_0x8488('0x89')](_0x1f5a8b[_0x8488('0x37')]['ids'],{'transaction':_0x3e2f85})['then'](function(){if(!_[_0x8488('0x97')](_0x2a822b)){return _0x541b76[_0x8488('0x77')](_0x2a822b,{'transaction':_0x3e2f85});}})[_0x8488('0x29')](function(){_0x2a822b[_0x8488('0x87')](function(_0x258985){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':_0x258985,'VoicePrefixId':_0x541b76['id']});});});});});});})[_0x8488('0x29')](respondWithStatusCode(_0x1e7617,null))[_0x8488('0x4b')](handleError(_0x1e7617,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f54eea3..8454beb 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 _0x32e4=['save','update','remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x134071,_0x25a272){var _0x35de7c=function(_0x61ca53){while(--_0x61ca53){_0x134071['push'](_0x134071['shift']());}};_0x35de7c(++_0x25a272);}(_0x32e4,0x132));var _0x432e=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x32e4[_0x1b91c7];return _0xbbe014;};'use strict';var EventEmitter=require(_0x432e('0x0'));var VoicePrefix=require(_0x432e('0x1'))['db'][_0x432e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x432e('0x3')](0x0);var events={'afterCreate':_0x432e('0x4'),'afterUpdate':_0x432e('0x5'),'afterDestroy':_0x432e('0x6')};function emitEvent(_0x30283c){return function(_0x166657,_0x43ecf3,_0x58b875){VoicePrefixEvents[_0x432e('0x7')](_0x30283c+':'+_0x166657['id'],_0x166657);VoicePrefixEvents[_0x432e('0x7')](_0x30283c,_0x166657);_0x58b875(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x432e('0x8')](e,emitEvent(event));}}module[_0x432e('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x526f=['emit','hasOwnProperty','events','../../mysqldb','VoicePrefix','setMaxListeners','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x526f,0xf7));var _0xf526=function(_0x40ae96,_0x590c63){_0x40ae96=_0x40ae96-0x0;var _0x222a2a=_0x526f[_0x40ae96];return _0x222a2a;};'use strict';var EventEmitter=require(_0xf526('0x0'));var VoicePrefix=require(_0xf526('0x1'))['db'][_0xf526('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf526('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf526('0x4')};function emitEvent(_0x128166){return function(_0x3afa50,_0x23b7e7,_0x4d12c9){VoicePrefixEvents[_0xf526('0x5')](_0x128166+':'+_0x3afa50['id'],_0x3afa50);VoicePrefixEvents[_0xf526('0x5')](_0x128166,_0x3afa50);_0x4d12c9(null);};}for(var e in events){if(events[_0xf526('0x6')](e)){var event=events[e];VoicePrefix['hook'](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 4ec458c..3585ad8 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 _0xc8eb=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x50c527,_0x2d4458){var _0x2c7c15=function(_0x29a373){while(--_0x29a373){_0x50c527['push'](_0x50c527['shift']());}};_0x2c7c15(++_0x2d4458);}(_0xc8eb,0x11d));var _0xbc8e=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xc8eb[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xbc8e('0x0'));var util=require(_0xbc8e('0x1'));var logger=require(_0xbc8e('0x2'))(_0xbc8e('0x3'));var moment=require('moment');var BPromise=require(_0xbc8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc8e('0x5'));var config=require(_0xbc8e('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xbc8e('0x7')]=function(_0x10e814,_0x30dd16){return _0x10e814[_0xbc8e('0x8')](_0xbc8e('0x9'),attributes,{'tableName':_0xbc8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8718=['path','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x357ba6,_0x511d7d){var _0x35bec7=function(_0xcba40a){while(--_0xcba40a){_0x357ba6['push'](_0x357ba6['shift']());}};_0x35bec7(++_0x511d7d);}(_0x8718,0xa4));var _0x8871=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x8718[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0x8871('0x0'));var util=require(_0x8871('0x1'));var logger=require(_0x8871('0x2'))(_0x8871('0x3'));var moment=require(_0x8871('0x4'));var BPromise=require('bluebird');var rp=require(_0x8871('0x5'));var fs=require('fs');var path=require(_0x8871('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x8871('0x7')]=function(_0x3c1c3e,_0x438cec){return _0x3c1c3e[_0x8871('0x8')]('VoicePrefix',attributes,{'tableName':_0x8871('0x9'),'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 cf8fb66..9cff16d 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 _0x4d49=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0xc74312,_0x3d8ef0){var _0x3a9838=function(_0x49cfac){while(--_0x49cfac){_0xc74312['push'](_0xc74312['shift']());}};_0x3a9838(++_0x3d8ef0);}(_0x4d49,0x141));var _0x94d4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d49[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var moment=require('moment');var BPromise=require(_0x94d4('0x1'));var rs=require(_0x94d4('0x2'));var fs=require('fs');var Redis=require(_0x94d4('0x3'));var db=require(_0x94d4('0x4'))['db'];var utils=require(_0x94d4('0x5'));var logger=require(_0x94d4('0x6'))(_0x94d4('0x7'));var config=require(_0x94d4('0x8'));var jayson=require(_0x94d4('0x9'));var client=jayson['client'][_0x94d4('0xa')]({'port':0x232a});config[_0x94d4('0xb')]=_[_0x94d4('0xc')](config[_0x94d4('0xb')],{'host':_0x94d4('0xd'),'port':0x18eb});var socket=require(_0x94d4('0xe'))(new Redis(config['redis']));require(_0x94d4('0xf'))[_0x94d4('0x10')](socket);function respondWithRpcPromise(_0x562265,_0x23ef86,_0x283f63){return new BPromise(function(_0xd7820d,_0x2720dd){return client['request'](_0x562265,_0x283f63)[_0x94d4('0x11')](function(_0xe7f878){logger[_0x94d4('0x12')](_0x94d4('0x13'),_0x23ef86,_0x94d4('0x14'));logger[_0x94d4('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x23ef86,'request\x20sent',JSON['stringify'](_0xe7f878));if(_0xe7f878[_0x94d4('0x16')]){if(_0xe7f878[_0x94d4('0x16')]['code']===0x1f4){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0x2720dd(_0xe7f878['error'][_0x94d4('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0xd7820d(_0xe7f878[_0x94d4('0x16')][_0x94d4('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,'request\x20sent');_0xd7820d(_0xe7f878[_0x94d4('0x18')][_0x94d4('0x17')]);}})[_0x94d4('0x19')](function(_0x47b760){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0x47b760);_0x2720dd(_0x47b760);});});} \ No newline at end of file +var _0x195f=['redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x44c8cb,_0x2e28c7){var _0x3bf406=function(_0x2dbe74){while(--_0x2dbe74){_0x44c8cb['push'](_0x44c8cb['shift']());}};_0x3bf406(++_0x2e28c7);}(_0x195f,0x113));var _0xf195=function(_0x210b46,_0x52a05f){_0x210b46=_0x210b46-0x0;var _0x203df2=_0x195f[_0x210b46];return _0x203df2;};'use strict';var _=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var moment=require('moment');var BPromise=require(_0xf195('0x2'));var rs=require(_0xf195('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf195('0x5'))(_0xf195('0x6'));var config=require(_0xf195('0x7'));var jayson=require(_0xf195('0x8'));var client=jayson[_0xf195('0x9')][_0xf195('0xa')]({'port':0x232a});config[_0xf195('0xb')]=_['defaults'](config['redis'],{'host':_0xf195('0xc'),'port':0x18eb});var socket=require(_0xf195('0xd'))(new Redis(config[_0xf195('0xb')]));require(_0xf195('0xe'))[_0xf195('0xf')](socket);function respondWithRpcPromise(_0x2edce1,_0x426577,_0x4bce90){return new BPromise(function(_0x172dba,_0x384680){return client[_0xf195('0x10')](_0x2edce1,_0x4bce90)['then'](function(_0x3c9305){logger[_0xf195('0x11')](_0xf195('0x12'),_0x426577,_0xf195('0x13'));logger['debug'](_0xf195('0x14'),_0x426577,_0xf195('0x13'),JSON['stringify'](_0x3c9305));if(_0x3c9305[_0xf195('0x15')]){if(_0x3c9305['error'][_0xf195('0x16')]===0x1f4){logger[_0xf195('0x15')](_0xf195('0x12'),_0x426577,_0x3c9305[_0xf195('0x15')][_0xf195('0x17')]);return _0x384680(_0x3c9305[_0xf195('0x15')][_0xf195('0x17')]);}logger[_0xf195('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x426577,_0x3c9305['error'][_0xf195('0x17')]);return _0x172dba(_0x3c9305[_0xf195('0x15')][_0xf195('0x17')]);}else{logger[_0xf195('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x426577,_0xf195('0x13'));_0x172dba(_0x3c9305[_0xf195('0x18')]['message']);}})[_0xf195('0x19')](function(_0x2c6bfd){logger['error'](_0xf195('0x12'),_0x426577,_0x2c6bfd);_0x384680(_0x2c6bfd);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3f08f16..4d1027c 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 _0x4157=['removeListener','register','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x43f744,_0x1f9ab5){var _0x3bd95d=function(_0x5a8731){while(--_0x5a8731){_0x43f744['push'](_0x43f744['shift']());}};_0x3bd95d(++_0x1f9ab5);}(_0x4157,0xf3));var _0x7415=function(_0x352eeb,_0x1ab19d){_0x352eeb=_0x352eeb-0x0;var _0x1e7695=_0x4157[_0x352eeb];return _0x1e7695;};'use strict';var VoicePrefixEvents=require(_0x7415('0x0'));var events=[_0x7415('0x1'),_0x7415('0x2'),_0x7415('0x3')];function createListener(_0x4509ca,_0x4c49e7){return function(_0x3efb60){_0x4c49e7[_0x7415('0x4')](_0x4509ca,_0x3efb60);};}function removeListener(_0x311038,_0x341b12){return function(){VoicePrefixEvents[_0x7415('0x5')](_0x311038,_0x341b12);};}exports[_0x7415('0x6')]=function(_0x23038f){for(var _0x2f43eb=0x0,_0x3c7980=events['length'];_0x2f43eb<_0x3c7980;_0x2f43eb++){var _0x26fe93=events[_0x2f43eb];var _0x588c5a=createListener(_0x7415('0x7')+_0x26fe93,_0x23038f);VoicePrefixEvents['on'](_0x26fe93,_0x588c5a);}}; \ No newline at end of file +var _0xd139=['save','emit','removeListener','length','./voicePrefix.events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd139,0x14e));var _0x9d13=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xd139[_0x16629d];return _0x56ccee;};'use strict';var VoicePrefixEvents=require(_0x9d13('0x0'));var events=[_0x9d13('0x1'),'remove','update'];function createListener(_0x21fb63,_0x477215){return function(_0x3d392a){_0x477215[_0x9d13('0x2')](_0x21fb63,_0x3d392a);};}function removeListener(_0x1d39f0,_0xdeacf6){return function(){VoicePrefixEvents[_0x9d13('0x3')](_0x1d39f0,_0xdeacf6);};}exports['register']=function(_0x4c8e60){for(var _0x2918eb=0x0,_0x50294b=events[_0x9d13('0x4')];_0x2918eb<_0x50294b;_0x2918eb++){var _0x4b3db0=events[_0x2918eb];var _0x434ef6=createListener('voicePrefix:'+_0x4b3db0,_0x4c8e60);VoicePrefixEvents['on'](_0x4b3db0,_0x434ef6);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 980241d..4be5871 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(_0x3e4843,_0x41f17a){var _0x2d3edb=function(_0x2a91ab){while(--_0x2a91ab){_0x3e4843['push'](_0x3e4843['shift']());}};_0x2d3edb(++_0x41f17a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x18fcde,_0x20f1c1){var _0x29bfb7=function(_0x4710f1){while(--_0x4710f1){_0x18fcde['push'](_0x18fcde['shift']());}};_0x29bfb7(++_0x20f1c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 2fdf02f..b885b8d 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 _0xa560=['#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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','name','ENUM','inbound','STRING','ringall','leastrecent','fewestcalls','random','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#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','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x58311b,_0x114351){var _0x51c129=function(_0x1929e8){while(--_0x1929e8){_0x58311b['push'](_0x58311b['shift']());}};_0x51c129(++_0x114351);}(_0xa560,0xfa));var _0x0a56=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa560[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x0a56('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a56('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0a56('0x2')]('inbound','outbound'),'allowNull':![],'defaultValue':_0x0a56('0x3')},'musiconhold':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a56('0x2')]('rr',_0x0a56('0x5'),_0x0a56('0x6'),_0x0a56('0x7'),_0x0a56('0x8'),'rrmemory','linear',_0x0a56('0x9'),_0x0a56('0xa')),'allowNull':![],'defaultValue':_0x0a56('0x5'),'set':function(_0x309188){this[_0x0a56('0xb')](_0x0a56('0xc'),_0x309188?_0x309188:_0x0a56('0xd'));},'get':function(){var _0x48796c=this[_0x0a56('0xe')](_0x0a56('0xf'));var _0x22fd48=this['getDataValue'](_0x0a56('0x10'));var _0xe25e7f=this[_0x0a56('0xe')](_0x0a56('0xc'));if(_0x48796c===_0x0a56('0x3')){return _0xe25e7f;}if(_0x22fd48===_0x0a56('0x11')&&_0xe25e7f==='rrmemory'||_0x22fd48==='booked'&&_0xe25e7f===_0x0a56('0x12')){return _0xe25e7f;}if(_0x22fd48===_0x0a56('0x13')||_0x22fd48===_0x0a56('0x14')||_0x22fd48===_0x0a56('0x15')){return _0xe25e7f;}return null;}},'servicelevel':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0a56('0x16')](0xb)},'timeout':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a56('0x4')]},'weight':{'type':Sequelize[_0x0a56('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x0a56('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a56('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a56('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a56('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a56('0x17'),'no'),'defaultValue':_0x0a56('0x17')},'announce_holdtime':{'type':Sequelize[_0x0a56('0x2')]('yes','no',_0x0a56('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x0a56('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a56('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a56('0x4')]},'queue_youarenext':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a56('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a56('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x0a56('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0x0a56('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x0a56('0x19')],'set':function(_0x4ff817){this[_0x0a56('0xb')](_0x0a56('0x1a'),_0x4ff817?_0x4ff817[_0x0a56('0x1b')](','):[]);},'get':function(){return this[_0x0a56('0xe')](_0x0a56('0x1a'))?this[_0x0a56('0xe')]('periodic_announce')[_0x0a56('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':_0x0a56('0x17'),'set':function(_0x471c72){this[_0x0a56('0xb')](_0x0a56('0x1d'),_0x471c72?_0x471c72[_0x0a56('0x1b')](','):undefined);},'get':function(){return this[_0x0a56('0xe')]('joinempty')?this['getDataValue']('joinempty')[_0x0a56('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':'no','set':function(_0x3a3e9e){this['setDataValue'](_0x0a56('0x1e'),_0x3a3e9e?_0x3a3e9e[_0x0a56('0x1b')](','):undefined);},'get':function(){return this[_0x0a56('0xe')](_0x0a56('0x1e'))?this['getDataValue'](_0x0a56('0x1e'))[_0x0a56('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a56('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a56('0x4')]},'description':{'type':Sequelize[_0x0a56('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x1827bf){this[_0x0a56('0xb')](_0x0a56('0x1f'),_0x1827bf);if(_0x1827bf){if(this[_0x0a56('0xe')]('wrapuptime')<0x2){this[_0x0a56('0xb')](_0x0a56('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0a56('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a56('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x22'),'progressive',_0x0a56('0x15'),_0x0a56('0x14'),_0x0a56('0x11')),'defaultValue':_0x0a56('0x13'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x0a56('0x16')](0x4)[_0x0a56('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a56('0x24')},'dialLimitQueue':{'type':Sequelize[_0x0a56('0x16')](0x4)[_0x0a56('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a56('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a56('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a56('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a56('0x2')](_0x0a56('0x27'),_0x0a56('0x28')),'defaultValue':_0x0a56('0x28'),'comment':_0x0a56('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a56('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0a56('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a56('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':_0x0a56('0x2d'),'comment':_0x0a56('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x2f')},'dialQueueProject':{'type':Sequelize[_0x0a56('0x4')],'comment':_0x0a56('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0a56('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a56('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a56('0x16')](0x5)[_0x0a56('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'comment':_0x0a56('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a56('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':_0x0a56('0x36')},'dialPrefix':{'type':Sequelize[_0x0a56('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a56('0x37'),'never',_0x0a56('0x38')),'defaultValue':_0x0a56('0x37')},'dialAMDActive':{'type':Sequelize[_0x0a56('0x21')],'defaultValue':0x0,'comment':_0x0a56('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x0a56('0x16')](0x9)[_0x0a56('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0a56('0x16')](0x9)[_0x0a56('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a56('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0a56('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a56('0x16')](0x9)[_0x0a56('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a56('0x3b')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0a56('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a56('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a56('0x16')](0x9)[_0x0a56('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0a56('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a56('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0a56('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0a56('0x16')](0x5)[_0x0a56('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a56('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a56('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a56('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a56('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x0a56('0x21')],'defaultValue':0x0,'comment':_0x0a56('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0a56('0x2')]('DESC',_0x0a56('0x42')),'defaultValue':_0x0a56('0x43')},'dialQueueProject2':{'type':Sequelize[_0x0a56('0x4')],'comment':_0x0a56('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a56('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a56('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a56('0x44')},'dialCutDigit':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a56('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0a56('0x16')](0x5)[_0x0a56('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a56('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a56('0x16')](0x5)[_0x0a56('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a56('0x16')](0x5)[_0x0a56('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a56('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a56('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a56('0x16')](0x3)[_0x0a56('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a56('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a56('0x16')](0x5)[_0x0a56('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a56('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a56('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0a56('0x21')],'defaultValue':![],'comment':_0x0a56('0x4e'),'set':function(_0x524a9c){if(!_0x524a9c)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x0a56('0xb')](_0x0a56('0x4f'),_0x524a9c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0a56('0x16')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0a56('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0a56('0x21')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf0a6=['#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','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','setDataValue','strategy','getDataValue','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','predictive','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).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','Active/Disactive\x20AMD'];(function(_0x54f570,_0x1fa85e){var _0x4c85f4=function(_0x49bc2f){while(--_0x49bc2f){_0x54f570['push'](_0x54f570['shift']());}};_0x4c85f4(++_0x1fa85e);}(_0xf0a6,0x157));var _0x6f0a=function(_0x7f816c,_0x25f12e){_0x7f816c=_0x7f816c-0x0;var _0x9106ca=_0xf0a6[_0x7f816c];return _0x9106ca;};'use strict';var Sequelize=require('sequelize');module[_0x6f0a('0x0')]={'name':{'type':Sequelize[_0x6f0a('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6f0a('0x2')](_0x6f0a('0x3'),_0x6f0a('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x6f0a('0x5')},'announce':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6f0a('0x2')]('rr',_0x6f0a('0x6'),_0x6f0a('0x7'),_0x6f0a('0x8'),_0x6f0a('0x9'),_0x6f0a('0xa'),'linear',_0x6f0a('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x6f0a('0x6'),'set':function(_0x144d29){this[_0x6f0a('0xc')](_0x6f0a('0xd'),_0x144d29?_0x144d29:'rrmemory');},'get':function(){var _0x1144c9=this[_0x6f0a('0xe')]('type');var _0x735a3d=this[_0x6f0a('0xe')](_0x6f0a('0xf'));var _0x598463=this[_0x6f0a('0xe')](_0x6f0a('0xd'));if(_0x1144c9===_0x6f0a('0x3')){return _0x598463;}if(_0x735a3d===_0x6f0a('0x10')&&_0x598463==='rrmemory'||_0x735a3d===_0x6f0a('0x10')&&_0x598463===_0x6f0a('0x11')){return _0x598463;}if(_0x735a3d===_0x6f0a('0x12')||_0x735a3d==='predictive'||_0x735a3d===_0x6f0a('0x13')){return _0x598463;}return null;}},'servicelevel':{'type':Sequelize[_0x6f0a('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x6f0a('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x6f0a('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x6f0a('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x6f0a('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6f0a('0x2')](_0x6f0a('0x15'),'no'),'defaultValue':_0x6f0a('0x15')},'autopause':{'type':Sequelize[_0x6f0a('0x2')]('yes','no',_0x6f0a('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6f0a('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x6f0a('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x6f0a('0x2')](_0x6f0a('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x6f0a('0x2')](_0x6f0a('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6f0a('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6f0a('0x2')](_0x6f0a('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6f0a('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6f0a('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6f0a('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x6f0a('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x6f0a('0x15'),'no'),'defaultValue':_0x6f0a('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x6f0a('0x15'),'no',_0x6f0a('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x6f0a('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x6f0a('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6f0a('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x6f0a('0x1')]},'queue_youarenext':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6f0a('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6f0a('0x1')]},'queue_quantity1':{'type':Sequelize[_0x6f0a('0x1')]},'queue_quantity2':{'type':Sequelize[_0x6f0a('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x6f0a('0x1')]},'periodic_announce':{'type':Sequelize[_0x6f0a('0x18')],'set':function(_0xa2fe3c){this[_0x6f0a('0xc')](_0x6f0a('0x19'),_0xa2fe3c?_0xa2fe3c[_0x6f0a('0x1a')](','):[]);},'get':function(){return this[_0x6f0a('0xe')](_0x6f0a('0x19'))?this[_0x6f0a('0xe')]('periodic_announce')[_0x6f0a('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':'yes','set':function(_0x152888){this[_0x6f0a('0xc')]('joinempty',_0x152888?_0x152888[_0x6f0a('0x1a')](','):undefined);},'get':function(){return this[_0x6f0a('0xe')](_0x6f0a('0x1c'))?this[_0x6f0a('0xe')](_0x6f0a('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':'no','set':function(_0x3c07c8){this['setDataValue'](_0x6f0a('0x1d'),_0x3c07c8?_0x3c07c8['join'](','):undefined);},'get':function(){return this[_0x6f0a('0xe')](_0x6f0a('0x1d'))?this['getDataValue'](_0x6f0a('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x6f0a('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x6f0a('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6f0a('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6f0a('0x2')](_0x6f0a('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6f0a('0x1')]},'description':{'type':Sequelize[_0x6f0a('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3042f){this[_0x6f0a('0xc')](_0x6f0a('0x1e'),_0x3042f);if(_0x3042f){if(this['getDataValue'](_0x6f0a('0x1f'))<0x2){this[_0x6f0a('0xc')](_0x6f0a('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6f0a('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6f0a('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x6f0a('0x2')](_0x6f0a('0x21'),_0x6f0a('0x12'),'power',_0x6f0a('0x22'),'booked'),'defaultValue':_0x6f0a('0x12'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x6f0a('0x14')](0x4)[_0x6f0a('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6f0a('0x24')},'dialLimitQueue':{'type':Sequelize[_0x6f0a('0x14')](0x4)[_0x6f0a('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6f0a('0x25')},'dialPowerLevel':{'type':Sequelize[_0x6f0a('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6f0a('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x6f0a('0x2')]('agentBusyFactor',_0x6f0a('0x28')),'defaultValue':_0x6f0a('0x28'),'comment':_0x6f0a('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6f0a('0x26')](0x2)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6f0a('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x6f0a('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6f0a('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6f0a('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6f0a('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x6f0a('0x14')](0x3)[_0x6f0a('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x6f0a('0x2d'),'comment':_0x6f0a('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x6f0a('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x2f')},'dialQueueProject':{'type':Sequelize[_0x6f0a('0x1')],'comment':_0x6f0a('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f0a('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x6f0a('0x14')](0x3)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6f0a('0x14')](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f0a('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6f0a('0x14')](0x3)[_0x6f0a('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f0a('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6f0a('0x14')](0x3)[_0x6f0a('0x23')],'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['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x6f0a('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x6f0a('0x35'),_0x6f0a('0x36'),_0x6f0a('0x37')),'defaultValue':_0x6f0a('0x35')},'dialAMDActive':{'type':Sequelize[_0x6f0a('0x20')],'defaultValue':0x0,'comment':_0x6f0a('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x6f0a('0x14')](0x9)[_0x6f0a('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6f0a('0x14')](0x9)[_0x6f0a('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6f0a('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6f0a('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6f0a('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x6f0a('0x14')](0x9)[_0x6f0a('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6f0a('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6f0a('0x14')](0x9)[_0x6f0a('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6f0a('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6f0a('0x14')](0x9)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6f0a('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6f0a('0x14')](0x5)[_0x6f0a('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6f0a('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6f0a('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6f0a('0x3f')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6f0a('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x6f0a('0x20')],'defaultValue':0x0,'comment':_0x6f0a('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6f0a('0x2')]('DESC',_0x6f0a('0x42')),'defaultValue':_0x6f0a('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x6f0a('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6f0a('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6f0a('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6f0a('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6f0a('0x44')},'dialCutDigit':{'type':Sequelize[_0x6f0a('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6f0a('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6f0a('0x14')](0x3)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6f0a('0x14')](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f0a('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x6f0a('0x14')](0x3)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6f0a('0x14')](0x3)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6f0a('0x14')](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x6f0a('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6f0a('0x14')](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f0a('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6f0a('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f0a('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6f0a('0x14')](0x5)[_0x6f0a('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f0a('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6f0a('0x14')],'allowNull':!![],'comment':_0x6f0a('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x6f0a('0x20')],'defaultValue':![],'comment':_0x6f0a('0x4f'),'set':function(_0x232e19){if(!_0x232e19)this[_0x6f0a('0xc')]('mandatoryDispositionPauseId',null);this[_0x6f0a('0xc')]('mandatoryDisposition',_0x232e19);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x6f0a('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x6f0a('0x20')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 01fb61d..f1dd048 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 _0xb8fe=['model','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','length','create','body','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','forEach','penalty','transaction','each','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','ids','isEmpty','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','upsert','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','cm_contacts','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','find','UserProfileResource','end','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x5059f0,_0x159c31){var _0x34af51=function(_0x33a366){while(--_0x33a366){_0x5059f0['push'](_0x5059f0['shift']());}};_0x34af51(++_0x159c31);}(_0xb8fe,0x1f2));var _0xeb8f=function(_0x454dc9,_0x1fc1ab){_0x454dc9=_0x454dc9-0x0;var _0x2f1dc0=_0xb8fe[_0x454dc9];return _0x2f1dc0;};'use strict';var emlformat=require(_0xeb8f('0x0'));var rimraf=require(_0xeb8f('0x1'));var zipdir=require(_0xeb8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb8f('0x3'));var moment=require(_0xeb8f('0x4'));var BPromise=require(_0xeb8f('0x5'));var Mustache=require(_0xeb8f('0x6'));var util=require(_0xeb8f('0x7'));var path=require(_0xeb8f('0x8'));var sox=require('sox');var csv=require(_0xeb8f('0x9'));var ejs=require(_0xeb8f('0xa'));var fs=require('fs');var fs_extra=require(_0xeb8f('0xb'));var _=require(_0xeb8f('0xc'));var squel=require(_0xeb8f('0xd'));var crypto=require(_0xeb8f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeb8f('0xf'));var toCsv=require(_0xeb8f('0x9'));var querystring=require(_0xeb8f('0x10'));var Papa=require(_0xeb8f('0x11'));var Redis=require(_0xeb8f('0x12'));var authService=require(_0xeb8f('0x13'));var qs=require(_0xeb8f('0x14'));var as=require(_0xeb8f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb8f('0x16'))(_0xeb8f('0x17'));var utils=require(_0xeb8f('0x18'));var config=require(_0xeb8f('0x19'));var licenseUtil=require(_0xeb8f('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xeb8f('0x1b')](config[_0xeb8f('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0xeb8f('0x1d')](socket);function respondWithStatusCode(_0x3f27a3,_0x2766be){_0x2766be=_0x2766be||0xcc;return function(_0x3d280c){if(_0x3d280c){return _0x3f27a3[_0xeb8f('0x1e')](_0x2766be);}return _0x3f27a3[_0xeb8f('0x1f')](_0x2766be)['end']();};}function respondWithResult(_0xc76f3e,_0x30b78b){_0x30b78b=_0x30b78b||0xc8;return function(_0xeb65f4){if(_0xeb65f4){return _0xc76f3e['status'](_0x30b78b)[_0xeb8f('0x20')](_0xeb65f4);}};}function respondWithFilteredResult(_0x55c723,_0x11c0d5){return function(_0x3f67b0){if(_0x3f67b0){var _0xc0d6e6=typeof _0x11c0d5[_0xeb8f('0x21')]==='undefined'&&typeof _0x11c0d5[_0xeb8f('0x22')]==='undefined';var _0x4bc172=_0x3f67b0[_0xeb8f('0x23')];var _0x4f7488=_0xc0d6e6?0x0:_0x11c0d5[_0xeb8f('0x21')];var _0x2c4850=_0xc0d6e6?_0x3f67b0[_0xeb8f('0x23')]:_0x11c0d5[_0xeb8f('0x21')]+_0x11c0d5[_0xeb8f('0x22')];var _0x31f63c;if(_0x2c4850>=_0x4bc172){_0x2c4850=_0x4bc172;_0x31f63c=0xc8;}else{_0x31f63c=0xce;}_0x55c723[_0xeb8f('0x1f')](_0x31f63c);return _0x55c723[_0xeb8f('0x24')](_0xeb8f('0x25'),_0x4f7488+'-'+_0x2c4850+'/'+_0x4bc172)[_0xeb8f('0x20')](_0x3f67b0);}return null;};}function patchUpdates(_0x1447fa){return function(_0xd1179a){try{jsonpatch[_0xeb8f('0x26')](_0xd1179a,_0x1447fa,!![]);}catch(_0x30b043){return BPromise[_0xeb8f('0x27')](_0x30b043);}return _0xd1179a[_0xeb8f('0x28')]();};}function saveUpdates(_0x1e3ea5,_0x4c99ce){return function(_0x34713a){if(_0x34713a){return _0x34713a[_0xeb8f('0x29')](_0x1e3ea5)[_0xeb8f('0x2a')](function(_0x479604){return _0x479604;});}return null;};}function removeEntity(_0x194cea,_0x27e14f){return function(_0x35dea2){if(_0x35dea2){return _0x35dea2[_0xeb8f('0x2b')]()[_0xeb8f('0x2a')](function(){var _0x1df577=_0x35dea2[_0xeb8f('0x2c')]({'plain':!![]});var _0x36bbc4=[{'name':_0xeb8f('0x2d'),'value':_0xeb8f('0x2e'),'ignore':![]},{'name':_0xeb8f('0x2f'),'value':'outbound','ignore':![]}];var _0x3cf548=_(_0x36bbc4)[_0xeb8f('0x30')]('ignore')[_0xeb8f('0x31')](_0xeb8f('0x32'))[_0xeb8f('0x32')]();if(_[_0xeb8f('0x33')](_0x3cf548,_0x1df577['type'])){return;}var _0x47d78e=_[_0xeb8f('0x34')](_0x36bbc4,[_0xeb8f('0x32'),_0x1df577['type']])['name'];return db[_0xeb8f('0x35')][_0xeb8f('0x2b')]({'where':{'type':_0x47d78e,'resourceId':_0x1df577['id']}})[_0xeb8f('0x2a')](function(){return _0x35dea2;});})['then'](function(){_0x194cea[_0xeb8f('0x1f')](0xcc)[_0xeb8f('0x36')]();});}};}function handleEntityNotFound(_0x1cd55e,_0x45ebee){return function(_0x4f1deb){if(!_0x4f1deb){_0x1cd55e['sendStatus'](0x194);}return _0x4f1deb;};}function handleError(_0x49f97d,_0x4e7dc7){_0x4e7dc7=_0x4e7dc7||0x1f4;return function(_0x95de64){logger[_0xeb8f('0x37')](_0x95de64[_0xeb8f('0x38')]);if(_0x95de64[_0xeb8f('0x39')]){delete _0x95de64[_0xeb8f('0x39')];}_0x49f97d['status'](_0x4e7dc7)[_0xeb8f('0x3a')](_0x95de64);};}exports[_0xeb8f('0x3b')]=function(_0x4f0067,_0x39f20b){var _0x6d6fcd={},_0x2377e7={},_0x354f06={'count':0x0,'rows':[]};var _0x333544=_[_0xeb8f('0x31')](db[_0xeb8f('0x3c')][_0xeb8f('0x3d')],function(_0x3da36d){return{'name':_0x3da36d[_0xeb8f('0x3e')],'type':_0x3da36d[_0xeb8f('0x3f')][_0xeb8f('0x40')]};});_0x2377e7['model']=_[_0xeb8f('0x31')](_0x333544,_0xeb8f('0x39'));_0x2377e7[_0xeb8f('0x41')]=_[_0xeb8f('0x42')](_0x4f0067[_0xeb8f('0x41')]);_0x2377e7[_0xeb8f('0x43')]=_[_0xeb8f('0x44')](_0x2377e7[_0xeb8f('0x45')],_0x2377e7[_0xeb8f('0x41')]);_0x6d6fcd[_0xeb8f('0x46')]=_[_0xeb8f('0x44')](_0x2377e7[_0xeb8f('0x45')],qs['fields'](_0x4f0067[_0xeb8f('0x41')]['fields']));_0x6d6fcd['attributes']=_0x6d6fcd[_0xeb8f('0x46')]['length']?_0x6d6fcd[_0xeb8f('0x46')]:_0x2377e7[_0xeb8f('0x45')];if(!_0x4f0067[_0xeb8f('0x41')][_0xeb8f('0x47')]('nolimit')){_0x6d6fcd[_0xeb8f('0x22')]=qs[_0xeb8f('0x22')](_0x4f0067['query']['limit']);_0x6d6fcd[_0xeb8f('0x21')]=qs[_0xeb8f('0x21')](_0x4f0067[_0xeb8f('0x41')]['offset']);}_0x6d6fcd[_0xeb8f('0x48')]=qs['sort'](_0x4f0067[_0xeb8f('0x41')][_0xeb8f('0x49')]);_0x6d6fcd[_0xeb8f('0x4a')]=qs['filters'](_['pick'](_0x4f0067[_0xeb8f('0x41')],_0x2377e7[_0xeb8f('0x43')]),_0x333544);if(_0x4f0067[_0xeb8f('0x41')][_0xeb8f('0x30')]){_0x6d6fcd[_0xeb8f('0x4a')]=_[_0xeb8f('0x4b')](_0x6d6fcd['where'],{'$or':_[_0xeb8f('0x31')](_0x333544,function(_0x574e4d){if(_0x574e4d[_0xeb8f('0x3f')]!==_0xeb8f('0x4c')){var _0x20d091={};_0x20d091[_0x574e4d[_0xeb8f('0x39')]]={'$like':'%'+_0x4f0067[_0xeb8f('0x41')][_0xeb8f('0x30')]+'%'};return _0x20d091;}})});}_0x6d6fcd=_['merge']({},_0x6d6fcd,_0x4f0067[_0xeb8f('0x4d')]);var _0x593815={'where':_0x6d6fcd[_0xeb8f('0x4a')]};return db['VoiceQueue'][_0xeb8f('0x23')](_0x593815)[_0xeb8f('0x2a')](function(_0x56f4cf){_0x354f06[_0xeb8f('0x23')]=_0x56f4cf;if(_0x4f0067[_0xeb8f('0x41')][_0xeb8f('0x4e')]){_0x6d6fcd[_0xeb8f('0x4f')]=[{'all':!![]}];}return db[_0xeb8f('0x3c')][_0xeb8f('0x50')](_0x6d6fcd);})[_0xeb8f('0x2a')](function(_0x4c4a6a){_0x354f06[_0xeb8f('0x51')]=_0x4c4a6a;return _0x354f06;})[_0xeb8f('0x2a')](respondWithFilteredResult(_0x39f20b,_0x6d6fcd))[_0xeb8f('0x52')](handleError(_0x39f20b,null));};exports[_0xeb8f('0x53')]=function(_0x255156,_0x500f5e){var _0x2ac9a0={'raw':![],'where':{'id':_0x255156['params']['id']}},_0x7f8d01={};_0x7f8d01[_0xeb8f('0x45')]=_[_0xeb8f('0x42')](db[_0xeb8f('0x3c')][_0xeb8f('0x3d')]);_0x7f8d01[_0xeb8f('0x41')]=_[_0xeb8f('0x42')](_0x255156[_0xeb8f('0x41')]);_0x7f8d01[_0xeb8f('0x43')]=_['intersection'](_0x7f8d01[_0xeb8f('0x45')],_0x7f8d01['query']);_0x2ac9a0['attributes']=_[_0xeb8f('0x44')](_0x7f8d01[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0x255156['query'][_0xeb8f('0x54')]));_0x2ac9a0[_0xeb8f('0x46')]=_0x2ac9a0['attributes'][_0xeb8f('0x55')]?_0x2ac9a0[_0xeb8f('0x46')]:_0x7f8d01[_0xeb8f('0x45')];if(_0x255156['query']['includeAll']){_0x2ac9a0['include']=[{'all':!![]}];}_0x2ac9a0=_['merge']({},_0x2ac9a0,_0x255156['options']);return db[_0xeb8f('0x3c')]['find'](_0x2ac9a0)['then'](handleEntityNotFound(_0x500f5e,null))[_0xeb8f('0x2a')](respondWithResult(_0x500f5e,null))[_0xeb8f('0x52')](handleError(_0x500f5e,null));};exports[_0xeb8f('0x56')]=function(_0x3c0ca4,_0x22368b){return db['VoiceQueue'][_0xeb8f('0x56')](_0x3c0ca4[_0xeb8f('0x57')],{})[_0xeb8f('0x2a')](function(_0x5af4a0){var _0x5f1a04=_0x3c0ca4[_0xeb8f('0x58')][_0xeb8f('0x2c')]({'plain':!![]});if(!_0x5f1a04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f1a04[_0xeb8f('0x59')]===_0xeb8f('0x58')){var _0x1b1b61=_0x5af4a0[_0xeb8f('0x2c')]({'plain':!![]});var _0x216eba=[{'name':'VoiceQueues','value':_0xeb8f('0x2e')},{'name':'QueueCampaigns','value':_0xeb8f('0x5a')}];var _0x1b0cf2=_[_0xeb8f('0x34')](_0x216eba,['value',_0x1b1b61[_0xeb8f('0x3f')]])['name'];return db[_0xeb8f('0x5b')][_0xeb8f('0x34')]({'where':{'name':_0x1b0cf2,'userProfileId':_0x5f1a04[_0xeb8f('0x5c')]},'raw':!![]})[_0xeb8f('0x2a')](function(_0x36249d){if(_0x36249d&&_0x36249d['autoAssociation']===0x0){return db['UserProfileResource'][_0xeb8f('0x56')]({'name':_0x1b1b61[_0xeb8f('0x39')],'resourceId':_0x1b1b61['id'],'type':_0x36249d['name'],'sectionId':_0x36249d['id']},{})[_0xeb8f('0x2a')](function(){return _0x5af4a0;});}else{return _0x5af4a0;}})['catch'](function(_0x37612a){logger[_0xeb8f('0x37')](_0xeb8f('0x5d'),_0x37612a);throw _0x37612a;});}return _0x5af4a0;})['then'](respondWithResult(_0x22368b,0xc9))[_0xeb8f('0x52')](handleError(_0x22368b,null));};exports['clone']=function(_0x344681,_0x552528){var _0x424668={'where':{'id':_0x344681[_0xeb8f('0x5e')]['id']}},_0x45b018={};_0x45b018[_0xeb8f('0x45')]=_['keys'](db['VoiceQueue'][_0xeb8f('0x3d')]);_0x424668['attributes']=_['intersection'](_0x45b018[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0x344681['query']['fields']));_0x424668[_0xeb8f('0x46')]=_0x424668['attributes']['length']?_0x424668['attributes']:_0x45b018[_0xeb8f('0x45')];if(_0x344681[_0xeb8f('0x41')][_0xeb8f('0x4e')]){_0x424668['include']=[{'all':!![]}];}_0x424668=_[_0xeb8f('0x4b')]({},_0x424668,_0x344681[_0xeb8f('0x4d')]);return db[_0xeb8f('0x3c')][_0xeb8f('0x34')](_0x424668)[_0xeb8f('0x2a')](handleEntityNotFound(_0x552528,null))[_0xeb8f('0x2a')](function(_0x51e395){if(_0x51e395){var _0x59e03c=_0x51e395[_0xeb8f('0x2c')]({'plain':!![]});_0x59e03c=qs[_0xeb8f('0x5f')](_0x59e03c,['id',_0xeb8f('0x60'),'updatedAt']);_0x344681[_0xeb8f('0x57')]=_['omit'](_0x344681[_0xeb8f('0x57')],['id','createdAt',_0xeb8f('0x61')]);return db[_0xeb8f('0x3c')]['create'](_[_0xeb8f('0x4b')](_0x59e03c,_0x344681[_0xeb8f('0x57')]),{'include':_0x344681['query'][_0xeb8f('0x4e')]?[{'all':!![]}]:undefined})[_0xeb8f('0x2a')](function(_0x446d8e){var _0x12b593=_0x344681[_0xeb8f('0x58')][_0xeb8f('0x2c')]({'plain':!![]});if(!_0x12b593)throw new Error(_0xeb8f('0x62'));if(_0x12b593[_0xeb8f('0x59')]===_0xeb8f('0x58')){var _0x2f0bd4=_0x446d8e[_0xeb8f('0x2c')]({'plain':!![]});var _0x467c2e=[{'name':_0xeb8f('0x2d'),'value':_0xeb8f('0x2e')},{'name':_0xeb8f('0x2f'),'value':_0xeb8f('0x5a')}];var _0xd0610e=_[_0xeb8f('0x34')](_0x467c2e,[_0xeb8f('0x32'),_0x2f0bd4['type']])[_0xeb8f('0x39')];return db[_0xeb8f('0x5b')][_0xeb8f('0x34')]({'where':{'name':_0xd0610e,'userProfileId':_0x12b593[_0xeb8f('0x5c')]},'raw':!![]})[_0xeb8f('0x2a')](function(_0x24bb4c){if(_0x24bb4c&&_0x24bb4c[_0xeb8f('0x63')]===0x0){return db['UserProfileResource'][_0xeb8f('0x56')]({'name':_0x2f0bd4[_0xeb8f('0x39')],'resourceId':_0x2f0bd4['id'],'type':_0x24bb4c['name'],'sectionId':_0x24bb4c['id']},{})['then'](function(){return _0x446d8e;});}else{return _0x446d8e;}})[_0xeb8f('0x52')](function(_0x393670){logger[_0xeb8f('0x37')](_0xeb8f('0x5d'),_0x393670);throw _0x393670;});}return _0x446d8e;});}})[_0xeb8f('0x2a')](respondWithResult(_0x552528,0xc9))[_0xeb8f('0x52')](handleError(_0x552528,null));};exports[_0xeb8f('0x29')]=function(_0x4e81bf,_0x42ab08){if(_0x4e81bf[_0xeb8f('0x57')]['id']){delete _0x4e81bf[_0xeb8f('0x57')]['id'];}return db[_0xeb8f('0x3c')][_0xeb8f('0x34')]({'where':{'id':_0x4e81bf[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x42ab08,null))[_0xeb8f('0x2a')](saveUpdates(_0x4e81bf['body'],null))[_0xeb8f('0x2a')](respondWithResult(_0x42ab08,null))[_0xeb8f('0x52')](handleError(_0x42ab08,null));};exports[_0xeb8f('0x2b')]=function(_0x54211f,_0x260811){return db[_0xeb8f('0x3c')]['find']({'where':{'id':_0x54211f[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x260811,null))[_0xeb8f('0x2a')](removeEntity(_0x260811,null))[_0xeb8f('0x52')](handleError(_0x260811,null));};exports[_0xeb8f('0x64')]=function(_0x163b26,_0x4d20f1,_0xe3adf2){var _0x57670e={'raw':![],'where':{}};var _0x47932c={};var _0x4f1730={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xeb8f('0x65')]({'where':{'id':_0x163b26['params']['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x4d20f1,null))[_0xeb8f('0x2a')](function(_0x2dfe83){if(_0x2dfe83){_0x47932c[_0xeb8f('0x45')]=_[_0xeb8f('0x42')](db[_0xeb8f('0x66')][_0xeb8f('0x3d')]);_0x47932c[_0xeb8f('0x41')]=_['keys'](_0x163b26[_0xeb8f('0x41')]);_0x47932c[_0xeb8f('0x43')]=_[_0xeb8f('0x44')](_0x47932c['model'],_0x47932c[_0xeb8f('0x41')]);_0x57670e[_0xeb8f('0x46')]=_['intersection'](_0x47932c['model'],qs['fields'](_0x163b26[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0x57670e['attributes']=_0x57670e[_0xeb8f('0x46')]['length']?_0x57670e['attributes']:_0x47932c[_0xeb8f('0x45')];if(!_0x163b26['query']['hasOwnProperty'](_0xeb8f('0x67'))){_0x57670e[_0xeb8f('0x22')]=qs[_0xeb8f('0x22')](_0x163b26['query'][_0xeb8f('0x22')]);_0x57670e[_0xeb8f('0x21')]=qs['offset'](_0x163b26['query']['offset']);}_0x57670e[_0xeb8f('0x48')]=qs[_0xeb8f('0x49')](_0x163b26[_0xeb8f('0x41')]['sort']);_0x57670e[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_[_0xeb8f('0x68')](_0x163b26[_0xeb8f('0x41')],_0x47932c[_0xeb8f('0x43')]));_0x57670e[_0xeb8f('0x4a')][_0xeb8f('0x69')]=_0x2dfe83['id'];if(_0x163b26[_0xeb8f('0x41')][_0xeb8f('0x30')]){_0x57670e['where']=_[_0xeb8f('0x4b')](_0x57670e[_0xeb8f('0x4a')],{'$or':_['map'](_0x57670e[_0xeb8f('0x46')],function(_0x26fb7e){var _0x3731fe={};_0x3731fe[_0x26fb7e]={'$like':'%'+_0x163b26['query']['filter']+'%'};return _0x3731fe;})});}_0x57670e=_[_0xeb8f('0x4b')]({},_0x57670e,_0x163b26[_0xeb8f('0x4d')]);return db[_0xeb8f('0x66')][_0xeb8f('0x23')]({'where':_0x57670e[_0xeb8f('0x4a')]})['then'](function(_0x553cc7){_0x4f1730['count']=_0x553cc7;if(_0x163b26[_0xeb8f('0x41')][_0xeb8f('0x4e')]){_0x57670e[_0xeb8f('0x4f')]=[{'all':!![]}];}return db['CmHopper'][_0xeb8f('0x50')](_0x57670e);})[_0xeb8f('0x2a')](function(_0x4d60c2){_0x4f1730[_0xeb8f('0x51')]=_0x4d60c2;return _0x4f1730;});}})[_0xeb8f('0x2a')](respondWithFilteredResult(_0x4d20f1,_0x57670e))[_0xeb8f('0x52')](handleError(_0x4d20f1,null));};exports[_0xeb8f('0x6a')]=function(_0x1c3852,_0x231879,_0x10f0c8){var _0x157d9f={'raw':!![],'where':{}};var _0x48492d={};var _0x57cb4c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xeb8f('0x65')]({'where':{'id':_0x1c3852[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x231879,null))[_0xeb8f('0x2a')](function(_0x55f01a){if(_0x55f01a){_0x48492d[_0xeb8f('0x45')]=_[_0xeb8f('0x42')](db[_0xeb8f('0x6b')][_0xeb8f('0x3d')]);_0x48492d['query']=_['keys'](_0x1c3852['query']);_0x48492d[_0xeb8f('0x43')]=_[_0xeb8f('0x44')](_0x48492d['model'],_0x48492d[_0xeb8f('0x41')]);_0x157d9f['attributes']=_['intersection'](_0x48492d[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0x1c3852[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0x157d9f[_0xeb8f('0x46')]=_0x157d9f[_0xeb8f('0x46')]['length']?_0x157d9f[_0xeb8f('0x46')]:_0x48492d['model'];if(!_0x1c3852[_0xeb8f('0x41')][_0xeb8f('0x47')](_0xeb8f('0x67'))){_0x157d9f[_0xeb8f('0x22')]=qs['limit'](_0x1c3852[_0xeb8f('0x41')][_0xeb8f('0x22')]);_0x157d9f[_0xeb8f('0x21')]=qs[_0xeb8f('0x21')](_0x1c3852['query'][_0xeb8f('0x21')]);}_0x157d9f['order']=qs[_0xeb8f('0x49')](_0x1c3852['query'][_0xeb8f('0x49')]);_0x157d9f[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_[_0xeb8f('0x68')](_0x1c3852['query'],_0x48492d[_0xeb8f('0x43')]));_0x157d9f[_0xeb8f('0x4a')][_0xeb8f('0x69')]=_0x55f01a['id'];if(_0x1c3852[_0xeb8f('0x41')][_0xeb8f('0x30')]){_0x157d9f[_0xeb8f('0x4a')]=_[_0xeb8f('0x4b')](_0x157d9f[_0xeb8f('0x4a')],{'$or':_[_0xeb8f('0x31')](_0x157d9f[_0xeb8f('0x46')],function(_0x4deab2){var _0x5acb27={};_0x5acb27[_0x4deab2]={'$like':'%'+_0x1c3852[_0xeb8f('0x41')]['filter']+'%'};return _0x5acb27;})});}_0x157d9f=_[_0xeb8f('0x4b')]({},_0x157d9f,_0x1c3852[_0xeb8f('0x4d')]);return db[_0xeb8f('0x6b')]['count']({'where':_0x157d9f[_0xeb8f('0x4a')]})[_0xeb8f('0x2a')](function(_0x456b32){_0x57cb4c[_0xeb8f('0x23')]=_0x456b32;if(_0x1c3852[_0xeb8f('0x41')]['includeAll']){_0x157d9f[_0xeb8f('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x157d9f);})['then'](function(_0x59f4bf){_0x57cb4c[_0xeb8f('0x51')]=_0x59f4bf;return _0x57cb4c;});}})[_0xeb8f('0x2a')](respondWithFilteredResult(_0x231879,_0x157d9f))['catch'](handleError(_0x231879,null));};exports['getHopperFinals']=function(_0xbe5976,_0x11c37c,_0x1edb9c){var _0x54930a={'raw':!![],'where':{}};var _0x5d2134={};var _0x273ca2={'count':0x0,'rows':[]};return db[_0xeb8f('0x3c')][_0xeb8f('0x65')]({'where':{'id':_0xbe5976[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x11c37c,null))[_0xeb8f('0x2a')](function(_0x5446f5){if(_0x5446f5){_0x5d2134[_0xeb8f('0x45')]=_['keys'](db[_0xeb8f('0x6c')][_0xeb8f('0x3d')]);_0x5d2134[_0xeb8f('0x41')]=_[_0xeb8f('0x42')](_0xbe5976[_0xeb8f('0x41')]);_0x5d2134['filters']=_[_0xeb8f('0x44')](_0x5d2134['model'],_0x5d2134[_0xeb8f('0x41')]);_0x54930a[_0xeb8f('0x46')]=_['intersection'](_0x5d2134[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0xbe5976[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0x54930a[_0xeb8f('0x46')]=_0x54930a[_0xeb8f('0x46')]['length']?_0x54930a[_0xeb8f('0x46')]:_0x5d2134['model'];if(!_0xbe5976[_0xeb8f('0x41')]['hasOwnProperty'](_0xeb8f('0x67'))){_0x54930a[_0xeb8f('0x22')]=qs[_0xeb8f('0x22')](_0xbe5976[_0xeb8f('0x41')][_0xeb8f('0x22')]);_0x54930a[_0xeb8f('0x21')]=qs[_0xeb8f('0x21')](_0xbe5976[_0xeb8f('0x41')][_0xeb8f('0x21')]);}_0x54930a[_0xeb8f('0x48')]=qs[_0xeb8f('0x49')](_0xbe5976[_0xeb8f('0x41')][_0xeb8f('0x49')]);_0x54930a[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_[_0xeb8f('0x68')](_0xbe5976[_0xeb8f('0x41')],_0x5d2134['filters']));_0x54930a[_0xeb8f('0x4a')][_0xeb8f('0x69')]=_0x5446f5['id'];if(_0xbe5976[_0xeb8f('0x41')][_0xeb8f('0x30')]){_0x54930a[_0xeb8f('0x4a')]=_[_0xeb8f('0x4b')](_0x54930a[_0xeb8f('0x4a')],{'$or':_[_0xeb8f('0x31')](_0x54930a['attributes'],function(_0x9fe496){var _0x1a2190={};_0x1a2190[_0x9fe496]={'$like':'%'+_0xbe5976[_0xeb8f('0x41')]['filter']+'%'};return _0x1a2190;})});}_0x54930a=_[_0xeb8f('0x4b')]({},_0x54930a,_0xbe5976[_0xeb8f('0x4d')]);return db[_0xeb8f('0x6c')][_0xeb8f('0x23')]({'where':_0x54930a['where']})[_0xeb8f('0x2a')](function(_0x2076fb){_0x273ca2['count']=_0x2076fb;if(_0xbe5976[_0xeb8f('0x41')][_0xeb8f('0x4e')]){_0x54930a[_0xeb8f('0x4f')]=[{'all':!![]}];}return db[_0xeb8f('0x6c')][_0xeb8f('0x50')](_0x54930a);})['then'](function(_0x1738e9){_0x273ca2[_0xeb8f('0x51')]=_0x1738e9;return _0x273ca2;});}})[_0xeb8f('0x2a')](respondWithFilteredResult(_0x11c37c,_0x54930a))['catch'](handleError(_0x11c37c,null));};exports[_0xeb8f('0x6d')]=function(_0x5ca5de,_0x2ea07d,_0x3ffc61){var _0x3ef30a={'raw':!![],'where':{}};var _0x40cce4={};var _0x15e46a={'count':0x0,'rows':[]};return db[_0xeb8f('0x3c')][_0xeb8f('0x65')]({'where':{'id':_0x5ca5de[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x2ea07d,null))['then'](function(_0x3d7adb){if(_0x3d7adb){_0x40cce4[_0xeb8f('0x45')]=_[_0xeb8f('0x42')](db[_0xeb8f('0x6e')][_0xeb8f('0x3d')]);_0x40cce4[_0xeb8f('0x41')]=_['keys'](_0x5ca5de['query']);_0x40cce4[_0xeb8f('0x43')]=_[_0xeb8f('0x44')](_0x40cce4['model'],_0x40cce4[_0xeb8f('0x41')]);_0x3ef30a[_0xeb8f('0x46')]=_[_0xeb8f('0x44')](_0x40cce4[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0x5ca5de[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0x3ef30a[_0xeb8f('0x46')]=_0x3ef30a[_0xeb8f('0x46')][_0xeb8f('0x55')]?_0x3ef30a['attributes']:_0x40cce4[_0xeb8f('0x45')];if(!_0x5ca5de[_0xeb8f('0x41')][_0xeb8f('0x47')](_0xeb8f('0x67'))){_0x3ef30a[_0xeb8f('0x22')]=qs[_0xeb8f('0x22')](_0x5ca5de['query']['limit']);_0x3ef30a[_0xeb8f('0x21')]=qs[_0xeb8f('0x21')](_0x5ca5de[_0xeb8f('0x41')]['offset']);}_0x3ef30a[_0xeb8f('0x48')]=qs[_0xeb8f('0x49')](_0x5ca5de[_0xeb8f('0x41')][_0xeb8f('0x49')]);_0x3ef30a[_0xeb8f('0x4a')]=qs['filters'](_[_0xeb8f('0x68')](_0x5ca5de[_0xeb8f('0x41')],_0x40cce4[_0xeb8f('0x43')]));_0x3ef30a[_0xeb8f('0x4a')][_0xeb8f('0x69')]=_0x3d7adb['id'];if(_0x5ca5de[_0xeb8f('0x41')]['filter']){_0x3ef30a[_0xeb8f('0x4a')]=_[_0xeb8f('0x4b')](_0x3ef30a['where'],{'$or':_['map'](_0x3ef30a[_0xeb8f('0x46')],function(_0x232a6f){var _0xf3444a={};_0xf3444a[_0x232a6f]={'$like':'%'+_0x5ca5de[_0xeb8f('0x41')][_0xeb8f('0x30')]+'%'};return _0xf3444a;})});}_0x3ef30a=_[_0xeb8f('0x4b')]({},_0x3ef30a,_0x5ca5de[_0xeb8f('0x4d')]);return db[_0xeb8f('0x6e')]['count']({'where':_0x3ef30a['where']})[_0xeb8f('0x2a')](function(_0x88a9b2){_0x15e46a['count']=_0x88a9b2;if(_0x5ca5de[_0xeb8f('0x41')][_0xeb8f('0x4e')]){_0x3ef30a[_0xeb8f('0x4f')]=[{'all':!![]}];}return db[_0xeb8f('0x6e')]['findAll'](_0x3ef30a);})[_0xeb8f('0x2a')](function(_0xef9f3){_0x15e46a[_0xeb8f('0x51')]=_0xef9f3;return _0x15e46a;});}})[_0xeb8f('0x2a')](respondWithFilteredResult(_0x2ea07d,_0x3ef30a))[_0xeb8f('0x52')](handleError(_0x2ea07d,null));};exports[_0xeb8f('0x6f')]=function(_0x5279d9,_0x2dd675,_0x164156){var _0x4e9c0c={};var _0x916c75={};var _0x4ecad0;var _0x42af4e;return db[_0xeb8f('0x3c')][_0xeb8f('0x65')]({'where':{'id':_0x5279d9['params']['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x2dd675,null))['then'](function(_0x3e4dd1){if(_0x3e4dd1){_0x4ecad0=_0x3e4dd1;_0x916c75[_0xeb8f('0x45')]=_['keys'](db['Team'][_0xeb8f('0x3d')]);_0x916c75[_0xeb8f('0x41')]=_[_0xeb8f('0x42')](_0x5279d9[_0xeb8f('0x41')]);_0x916c75[_0xeb8f('0x43')]=_[_0xeb8f('0x44')](_0x916c75[_0xeb8f('0x45')],_0x916c75['query']);_0x4e9c0c[_0xeb8f('0x46')]=_[_0xeb8f('0x44')](_0x916c75[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0x5279d9[_0xeb8f('0x41')]['fields']));_0x4e9c0c[_0xeb8f('0x46')]=_0x4e9c0c['attributes'][_0xeb8f('0x55')]?_0x4e9c0c[_0xeb8f('0x46')]:_0x916c75['model'];_0x4e9c0c[_0xeb8f('0x48')]=qs[_0xeb8f('0x49')](_0x5279d9[_0xeb8f('0x41')][_0xeb8f('0x49')]);_0x4e9c0c[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_['pick'](_0x5279d9[_0xeb8f('0x41')],_0x916c75[_0xeb8f('0x43')]));if(_0x5279d9[_0xeb8f('0x41')][_0xeb8f('0x30')]){_0x4e9c0c[_0xeb8f('0x4a')]=_[_0xeb8f('0x4b')](_0x4e9c0c[_0xeb8f('0x4a')],{'$or':_[_0xeb8f('0x31')](_0x4e9c0c['attributes'],function(_0x593560){var _0x224de6={};_0x224de6[_0x593560]={'$like':'%'+_0x5279d9['query']['filter']+'%'};return _0x224de6;})});}_0x4e9c0c=_[_0xeb8f('0x4b')]({},_0x4e9c0c,_0x5279d9[_0xeb8f('0x4d')]);return _0x4ecad0[_0xeb8f('0x6f')](_0x4e9c0c);}})[_0xeb8f('0x2a')](function(_0x5af649){if(_0x5af649){_0x42af4e=_0x5af649[_0xeb8f('0x55')];if(!_0x5279d9[_0xeb8f('0x41')][_0xeb8f('0x47')](_0xeb8f('0x67'))){_0x4e9c0c['limit']=qs['limit'](_0x5279d9[_0xeb8f('0x41')][_0xeb8f('0x22')]);_0x4e9c0c['offset']=qs[_0xeb8f('0x21')](_0x5279d9['query'][_0xeb8f('0x21')]);}return _0x4ecad0['getTeams'](_0x4e9c0c);}})[_0xeb8f('0x2a')](function(_0xc8e4c6){if(_0xc8e4c6){return _0xc8e4c6?{'count':_0x42af4e,'rows':_0xc8e4c6}:null;}})['then'](respondWithResult(_0x2dd675,null))[_0xeb8f('0x52')](handleError(_0x2dd675,null));};exports[_0xeb8f('0x70')]=function(_0x4f52d4,_0x528f74,_0x58dcc8){var _0x164e34=_0x4f52d4[_0xeb8f('0x57')][_0xeb8f('0x71')];var _0x43c894=_['map'](_0x164e34,'id');return db[_0xeb8f('0x72')][_0xeb8f('0x50')]({'where':{'id':_0x43c894},'attributes':['id'],'include':[{'model':db[_0xeb8f('0x73')],'as':_0xeb8f('0x74'),'attributes':['id',_0xeb8f('0x39'),_0xeb8f('0x75'),_0xeb8f('0x76'),_0xeb8f('0x77')],'raw':!![]}]})[_0xeb8f('0x2a')](function(_0x4ae8d4){if(_0x4ae8d4){var _0x5e3873=_['flatMap'](_0x4ae8d4,function(_0x2673bc){var _0x499f2b=_0x2673bc[_0xeb8f('0x2c')]({'plain':!![]});_0x499f2b[_0xeb8f('0x74')][_0xeb8f('0x78')](function(_0x23698b){_0x23698b[_0xeb8f('0x79')]=_[_0xeb8f('0x34')](_0x164e34,{'id':_0x499f2b['id']})[_0xeb8f('0x79')];});return _0x499f2b[_0xeb8f('0x74')];});return db[_0xeb8f('0x3c')][_0xeb8f('0x34')]({'where':{'id':_0x4f52d4[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](function(_0x3a2d84){return db['sequelize'][_0xeb8f('0x7a')](function(_0x254665){return _0x3a2d84[_0xeb8f('0x70')](_0x43c894,{'transaction':_0x254665})[_0xeb8f('0x2a')](function(){return BPromise[_0xeb8f('0x7b')](_0x164e34,function(_0x347372){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x347372['id'],'VoiceQueueId':_0x4f52d4['params']['id'],'penalty':_0x347372[_0xeb8f('0x79')]},{'transaction':_0x254665});});})['then'](function(){return BPromise[_0xeb8f('0x7b')](_0x5e3873,function(_0x33441f){return db[_0xeb8f('0x7c')][_0xeb8f('0x7d')]({'where':{'UserId':_0x33441f['id'],'VoiceQueueId':_0x4f52d4[_0xeb8f('0x5e')]['id']},'defaults':{'penalty':_0x33441f[_0xeb8f('0x79')]},'transaction':_0x254665});});})['then'](function(){return BPromise['each'](_[_0xeb8f('0x30')](_0x5e3873,{'online':!![]}),function(_0x476ebb){return db['UserVoiceQueueRt']['upsert']({'membername':_0x476ebb[_0xeb8f('0x39')],'UserId':_0x476ebb['id'],'queue_name':_0x3a2d84[_0xeb8f('0x39')],'VoiceQueueId':_0x3a2d84['id'],'interface':_[_0xeb8f('0x7e')](_0x476ebb['interface'])?util[_0xeb8f('0x7f')](_0xeb8f('0x80'),_0x476ebb[_0xeb8f('0x39')]):_0x476ebb[_0xeb8f('0x77')],'paused':_0x476ebb[_0xeb8f('0x76')]||![],'penalty':_0x476ebb[_0xeb8f('0x79')]},{'transaction':_0x254665});});})['then'](function(){_0x5e3873['forEach'](function(_0x51a5c0){socket[_0xeb8f('0x81')](_0xeb8f('0x82'),{'UserId':_0x51a5c0['id'],'VoiceQueueId':_0x3a2d84['id']});});});});});}})[_0xeb8f('0x2a')](respondWithStatusCode(_0x528f74,null))[_0xeb8f('0x52')](handleError(_0x528f74,null));};exports[_0xeb8f('0x83')]=function(_0x1f741c,_0x4adc4e,_0x10ad5a){return db['Team']['findAll']({'where':{'id':_0x1f741c[_0xeb8f('0x41')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb8f('0x74'),'attributes':['id'],'raw':!![]}]})[_0xeb8f('0x2a')](handleEntityNotFound(_0x4adc4e,null))[_0xeb8f('0x2a')](function(_0x400b7d){var _0x44e811=_[_0xeb8f('0x31')](_0x400b7d,'id');var _0x2ae383=[];var _0x3ad90e=[];var _0x1659ae=squel[_0xeb8f('0x84')]();_0x1659ae[_0xeb8f('0x85')]('tq.TeamId')[_0xeb8f('0x86')](_0xeb8f('0x87'),'tq')[_0xeb8f('0x88')](_0xeb8f('0x89'),'ut',_0xeb8f('0x8a'))['where'](_0xeb8f('0x8b'),_0x1f741c[_0xeb8f('0x5e')]['id']);for(var _0x351d34=0x0;_0x351d34<_0x400b7d['length'];_0x351d34+=0x1){let _0x27f64c=_0x400b7d[_0x351d34];for(var _0x3081a6=0x0;_0x3081a6<_0x27f64c['Agents'][_0xeb8f('0x55')];_0x3081a6+=0x1){let _0x174dfb=_0x27f64c['Agents'][_0x3081a6];var _0x4055e2=_0x1659ae[_0xeb8f('0x8c')]();_0x4055e2[_0xeb8f('0x4a')](_0xeb8f('0x8d'),_0x174dfb['id']);_0x3ad90e[_0xeb8f('0x8e')](db[_0xeb8f('0x8f')][_0xeb8f('0x41')](_0x4055e2['toString'](),{'type':db['sequelize'][_0xeb8f('0x90')][_0xeb8f('0x91')]})[_0xeb8f('0x2a')](function(_0x9aaf67){if(_0x9aaf67[_0xeb8f('0x55')]===0x1){return _0x174dfb['id'];}else{var _0x370980=_[_0xeb8f('0x92')](_[_0xeb8f('0x31')](_0x9aaf67,_0xeb8f('0x93')),function(_0xd77a1c){return _[_0xeb8f('0x33')](_0x44e811,_0xd77a1c);});if(_0x370980){return _0x174dfb['id'];}}}));}}return BPromise[_0xeb8f('0x94')](_0x3ad90e)[_0xeb8f('0x2a')](function(_0x47f69c){_0x2ae383=_(_0x2ae383)[_0xeb8f('0x95')](_0x47f69c)[_0xeb8f('0x96')]()[_0xeb8f('0x32')]();return db[_0xeb8f('0x3c')][_0xeb8f('0x34')]({'where':{'id':_0x1f741c[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](function(_0x36026d){return db[_0xeb8f('0x8f')]['transaction'](function(_0x348606){return _0x36026d[_0xeb8f('0x83')](_0x1f741c[_0xeb8f('0x41')][_0xeb8f('0x97')],{'transaction':_0x348606})[_0xeb8f('0x2a')](function(){if(!_[_0xeb8f('0x98')](_0x2ae383)){return _0x36026d['removeAgents'](_0x2ae383,{'transaction':_0x348606})[_0xeb8f('0x2a')](function(){return db[_0xeb8f('0x99')][_0xeb8f('0x2b')]({'where':{'VoiceQueueId':_0x1f741c[_0xeb8f('0x5e')]['id'],'UserId':_0x2ae383},'transaction':_0x348606});});}})['then'](function(){_0x2ae383[_0xeb8f('0x78')](function(_0x52072f){socket[_0xeb8f('0x81')](_0xeb8f('0x9a'),{'UserId':_0x52072f,'VoiceQueueId':_0x36026d['id']});});});});});});})[_0xeb8f('0x2a')](respondWithStatusCode(_0x4adc4e,null))[_0xeb8f('0x52')](handleError(_0x4adc4e,null));};exports[_0xeb8f('0x9b')]=function(_0x4ecbff,_0xdac19f,_0xec4c85){var _0x531445,_0x11c1b1;return db[_0xeb8f('0x3c')]['find']({'where':{'id':_0x4ecbff[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0xdac19f,null))['then'](function(_0xbb82a4){if(_0xbb82a4){_0x11c1b1=_0xbb82a4;return _0xbb82a4[_0xeb8f('0x9b')](_0x4ecbff[_0xeb8f('0x57')]['ids'],_[_0xeb8f('0x5f')](_0x4ecbff[_0xeb8f('0x57')],[_0xeb8f('0x97'),'id'])||{})[_0xeb8f('0x9c')](function(_0x5078ce){for(var _0x5875ae=0x0;_0x5875ae<_0x4ecbff[_0xeb8f('0x57')][_0xeb8f('0x97')][_0xeb8f('0x55')];_0x5875ae+=0x1){socket[_0xeb8f('0x81')](_0xeb8f('0x82'),{'UserId':Number(_0x4ecbff[_0xeb8f('0x57')][_0xeb8f('0x97')][_0x5875ae]),'VoiceQueueId':Number(_0x4ecbff[_0xeb8f('0x5e')]['id'])});}return _0x5078ce;});}})[_0xeb8f('0x2a')](function(_0x11395f){_0x531445=_0x11395f||[];if(_0x11c1b1){return db[_0xeb8f('0x73')][_0xeb8f('0x50')]({'where':{'id':_0x4ecbff[_0xeb8f('0x57')][_0xeb8f('0x97')]},'attributes':['id',_0xeb8f('0x39'),_0xeb8f('0x75'),_0xeb8f('0x76'),_0xeb8f('0x77')],'raw':!![]});}})['then'](function(_0x27288c){if(!_[_0xeb8f('0x98')](_0x27288c)){var _0x5cee87=[];for(var _0xe190a2=0x0;_0xe190a2<_0x27288c[_0xeb8f('0x55')];_0xe190a2++){if(_0x27288c[_0xe190a2][_0xeb8f('0x75')]){_0x5cee87['push'](db[_0xeb8f('0x99')][_0xeb8f('0x9d')]({'membername':_0x27288c[_0xe190a2][_0xeb8f('0x39')],'UserId':_0x27288c[_0xe190a2]['id'],'queue_name':_0x11c1b1['name'],'VoiceQueueId':_0x11c1b1['id'],'interface':_[_0xeb8f('0x7e')](_0x27288c[_0xe190a2][_0xeb8f('0x77')])?util['format'](_0xeb8f('0x80'),_0x27288c[_0xe190a2][_0xeb8f('0x39')]):_0x27288c[_0xe190a2][_0xeb8f('0x77')],'paused':_0x27288c[_0xe190a2]['voicePause']||![],'penalty':_0x4ecbff[_0xeb8f('0x57')][_0xeb8f('0x79')]||0x0}));}}return BPromise['all'](_0x5cee87);}})[_0xeb8f('0x2a')](function(){return _0x531445;})[_0xeb8f('0x2a')](respondWithResult(_0xdac19f,null))[_0xeb8f('0x52')](handleError(_0xdac19f,null));};exports[_0xeb8f('0x9e')]=function(_0x3611da,_0x2cdecb,_0x1d3a92){return db[_0xeb8f('0x3c')]['find']({'where':{'id':_0x3611da[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x2cdecb,null))[_0xeb8f('0x2a')](function(_0x8b1694){if(_0x8b1694){return _0x8b1694[_0xeb8f('0x9e')](_0x3611da[_0xeb8f('0x41')][_0xeb8f('0x97')])[_0xeb8f('0x2a')](function(){if(_[_0xeb8f('0x9f')](_0x3611da[_0xeb8f('0x41')][_0xeb8f('0x97')])){for(var _0x2751c6=0x0;_0x2751c6<_0x3611da[_0xeb8f('0x41')]['ids']['length'];_0x2751c6+=0x1){socket[_0xeb8f('0x81')](_0xeb8f('0x9a'),{'UserId':Number(_0x3611da[_0xeb8f('0x41')]['ids'][_0x2751c6]),'VoiceQueueId':Number(_0x3611da[_0xeb8f('0x5e')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x3611da[_0xeb8f('0x41')][_0xeb8f('0x97')]),'VoiceQueueId':Number(_0x3611da[_0xeb8f('0x5e')]['id'])});}});}})[_0xeb8f('0x2a')](function(_0x33fc56){return db[_0xeb8f('0x99')]['destroy']({'where':{'VoiceQueueId':_0x3611da[_0xeb8f('0x5e')]['id'],'UserId':_0x3611da[_0xeb8f('0x41')][_0xeb8f('0x97')]}})[_0xeb8f('0x2a')](function(){return _0x33fc56;});})[_0xeb8f('0x2a')](respondWithStatusCode(_0x2cdecb,null))[_0xeb8f('0x52')](handleError(_0x2cdecb,null));};exports[_0xeb8f('0xa0')]=function(_0x3cbbd4,_0x53bc9d,_0x363ee3){var _0x4bea2e={};var _0x113dd7={};var _0x469a7a;var _0xc7f718;return db[_0xeb8f('0x3c')][_0xeb8f('0x65')]({'where':{'id':_0x3cbbd4['params']['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x53bc9d,null))[_0xeb8f('0x2a')](function(_0x1ef2bd){if(_0x1ef2bd){_0x469a7a=_0x1ef2bd;_0x113dd7[_0xeb8f('0x45')]=_['keys'](db[_0xeb8f('0x73')][_0xeb8f('0x3d')]);_0x113dd7[_0xeb8f('0x41')]=_[_0xeb8f('0x42')](_0x3cbbd4[_0xeb8f('0x41')]);_0x113dd7[_0xeb8f('0x43')]=_['intersection'](_0x113dd7[_0xeb8f('0x45')],_0x113dd7[_0xeb8f('0x41')]);_0x4bea2e[_0xeb8f('0x46')]=_[_0xeb8f('0x44')](_0x113dd7[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0x3cbbd4[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0x4bea2e[_0xeb8f('0x46')]=_0x4bea2e[_0xeb8f('0x46')]['length']?_0x4bea2e[_0xeb8f('0x46')]:_0x113dd7[_0xeb8f('0x45')];_0x4bea2e[_0xeb8f('0x48')]=qs['sort'](_0x3cbbd4['query']['sort']);_0x4bea2e[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_[_0xeb8f('0x68')](_0x3cbbd4[_0xeb8f('0x41')],_0x113dd7[_0xeb8f('0x43')]));if(_0x3cbbd4[_0xeb8f('0x41')]['filter']){_0x4bea2e[_0xeb8f('0x4a')]=_['merge'](_0x4bea2e[_0xeb8f('0x4a')],{'$or':_[_0xeb8f('0x31')](_0x4bea2e[_0xeb8f('0x46')],function(_0x2fb478){var _0x4042d3={};_0x4042d3[_0x2fb478]={'$like':'%'+_0x3cbbd4[_0xeb8f('0x41')][_0xeb8f('0x30')]+'%'};return _0x4042d3;})});}_0x4bea2e=_[_0xeb8f('0x4b')]({},_0x4bea2e,_0x3cbbd4[_0xeb8f('0x4d')]);return _0x469a7a[_0xeb8f('0xa0')](_0x4bea2e);}})[_0xeb8f('0x2a')](function(_0x2fde06){if(_0x2fde06){_0xc7f718=_0x2fde06[_0xeb8f('0x55')];if(!_0x3cbbd4['query'][_0xeb8f('0x47')](_0xeb8f('0x67'))){_0x4bea2e[_0xeb8f('0x22')]=qs[_0xeb8f('0x22')](_0x3cbbd4['query']['limit']);_0x4bea2e['offset']=qs[_0xeb8f('0x21')](_0x3cbbd4[_0xeb8f('0x41')]['offset']);}return _0x469a7a[_0xeb8f('0xa0')](_0x4bea2e);}})['then'](function(_0x379ab3){if(_0x379ab3){return _0x379ab3?{'count':_0xc7f718,'rows':_0x379ab3}:null;}})[_0xeb8f('0x2a')](respondWithResult(_0x53bc9d,null))[_0xeb8f('0x52')](handleError(_0x53bc9d,null));};exports[_0xeb8f('0xa1')]=function(_0x5a510f,_0x2d49a2,_0x168a13){var _0x4d7d8a={};var _0x20497a={};var _0x1bb3c1;var _0x2e6bbf;return db['VoiceQueue'][_0xeb8f('0x65')]({'where':{'id':_0x5a510f['params']['id']}})['then'](handleEntityNotFound(_0x2d49a2,null))[_0xeb8f('0x2a')](function(_0x247bae){if(_0x247bae){_0x1bb3c1=_0x247bae;_0x20497a[_0xeb8f('0x45')]=_['keys'](db['UserVoiceQueueRt'][_0xeb8f('0x3d')]);_0x20497a[_0xeb8f('0x41')]=_['keys'](_0x5a510f[_0xeb8f('0x41')]);_0x20497a[_0xeb8f('0x43')]=_[_0xeb8f('0x44')](_0x20497a[_0xeb8f('0x45')],_0x20497a[_0xeb8f('0x41')]);_0x4d7d8a[_0xeb8f('0x46')]=_[_0xeb8f('0x44')](_0x20497a[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0x5a510f[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0x4d7d8a[_0xeb8f('0x46')]=_0x4d7d8a[_0xeb8f('0x46')][_0xeb8f('0x55')]?_0x4d7d8a[_0xeb8f('0x46')]:_0x20497a[_0xeb8f('0x45')];_0x4d7d8a[_0xeb8f('0x48')]=qs[_0xeb8f('0x49')](_0x5a510f[_0xeb8f('0x41')][_0xeb8f('0x49')]);_0x4d7d8a[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_[_0xeb8f('0x68')](_0x5a510f[_0xeb8f('0x41')],_0x20497a[_0xeb8f('0x43')]));if(_0x5a510f[_0xeb8f('0x41')]['filter']){_0x4d7d8a[_0xeb8f('0x4a')]=_[_0xeb8f('0x4b')](_0x4d7d8a[_0xeb8f('0x4a')],{'$or':_['map'](_0x4d7d8a[_0xeb8f('0x46')],function(_0x38c0ff){var _0x27dc26={};_0x27dc26[_0x38c0ff]={'$like':'%'+_0x5a510f['query'][_0xeb8f('0x30')]+'%'};return _0x27dc26;})});}_0x4d7d8a=_['merge']({},_0x4d7d8a,_0x5a510f[_0xeb8f('0x4d')]);return _0x1bb3c1[_0xeb8f('0xa1')](_0x4d7d8a);}})[_0xeb8f('0x2a')](function(_0x5f85ba){if(_0x5f85ba){_0x2e6bbf=_0x5f85ba['length'];if(!_0x5a510f[_0xeb8f('0x41')][_0xeb8f('0x47')](_0xeb8f('0x67'))){_0x4d7d8a[_0xeb8f('0x22')]=qs[_0xeb8f('0x22')](_0x5a510f[_0xeb8f('0x41')]['limit']);_0x4d7d8a[_0xeb8f('0x21')]=qs[_0xeb8f('0x21')](_0x5a510f[_0xeb8f('0x41')][_0xeb8f('0x21')]);}return _0x1bb3c1[_0xeb8f('0xa1')](_0x4d7d8a);}})['then'](function(_0x558faa){return _0x558faa?{'count':_0x2e6bbf,'rows':_0x558faa}:null;})[_0xeb8f('0x2a')](respondWithResult(_0x2d49a2,null))['catch'](handleError(_0x2d49a2,null));};exports[_0xeb8f('0xa2')]=function(_0xc330af,_0x480d33,_0x198bb5){var _0xe1160a={};var _0x581c90={};var _0x453a9f;var _0x3e68b2;return db[_0xeb8f('0x3c')][_0xeb8f('0x65')]({'where':{'id':_0xc330af[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x480d33,null))[_0xeb8f('0x2a')](function(_0x3059ac){if(_0x3059ac){_0x453a9f=_0x3059ac;_0x581c90[_0xeb8f('0x45')]=_['keys'](db['CmList']['rawAttributes']);_0x581c90['query']=_[_0xeb8f('0x42')](_0xc330af[_0xeb8f('0x41')]);_0x581c90['filters']=_[_0xeb8f('0x44')](_0x581c90[_0xeb8f('0x45')],_0x581c90['query']);_0xe1160a[_0xeb8f('0x46')]=_[_0xeb8f('0x44')](_0x581c90['model'],qs[_0xeb8f('0x54')](_0xc330af[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0xe1160a[_0xeb8f('0x46')]=_0xe1160a[_0xeb8f('0x46')][_0xeb8f('0x55')]?_0xe1160a['attributes']:_0x581c90[_0xeb8f('0x45')];_0xe1160a['order']=qs[_0xeb8f('0x49')](_0xc330af[_0xeb8f('0x41')]['sort']);_0xe1160a[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_[_0xeb8f('0x68')](_0xc330af[_0xeb8f('0x41')],_0x581c90[_0xeb8f('0x43')]));if(_0xc330af[_0xeb8f('0x41')][_0xeb8f('0x30')]){_0xe1160a['where']=_[_0xeb8f('0x4b')](_0xe1160a['where'],{'$or':_[_0xeb8f('0x31')](_0xe1160a[_0xeb8f('0x46')],function(_0x2bf5bf){var _0x5d7eb4={};_0x5d7eb4[_0x2bf5bf]={'$like':'%'+_0xc330af[_0xeb8f('0x41')][_0xeb8f('0x30')]+'%'};return _0x5d7eb4;})});}_0xe1160a=_[_0xeb8f('0x4b')]({},_0xe1160a,_0xc330af['options']);return _0x453a9f[_0xeb8f('0xa2')](_0xe1160a);}})[_0xeb8f('0x2a')](function(_0xff8f95){if(_0xff8f95){_0x3e68b2=_0xff8f95[_0xeb8f('0x55')];if(!_0xc330af['query'][_0xeb8f('0x47')](_0xeb8f('0x67'))){_0xe1160a['limit']=qs[_0xeb8f('0x22')](_0xc330af['query'][_0xeb8f('0x22')]);_0xe1160a[_0xeb8f('0x21')]=qs[_0xeb8f('0x21')](_0xc330af[_0xeb8f('0x41')][_0xeb8f('0x21')]);}return _0x453a9f[_0xeb8f('0xa2')](_0xe1160a);}})['then'](function(_0x50e1ec){if(_0x50e1ec){return _0x50e1ec?{'count':_0x3e68b2,'rows':_0x50e1ec}:null;}})[_0xeb8f('0x2a')](respondWithResult(_0x480d33,null))[_0xeb8f('0x52')](handleError(_0x480d33,null));};exports[_0xeb8f('0xa3')]=function(_0x27c695,_0x1daed4,_0x538285){var _0x457c14,_0x36afea;return db[_0xeb8f('0x3c')][_0xeb8f('0x34')]({'where':{'id':_0x27c695[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x1daed4,null))['then'](function(_0x472ad0){if(_0x472ad0){_0x36afea=_0x472ad0;return _0x472ad0[_0xeb8f('0xa3')](_0x27c695[_0xeb8f('0x57')][_0xeb8f('0x97')],_[_0xeb8f('0x5f')](_0x27c695[_0xeb8f('0x57')],['ids','id'])||{});}return null;})[_0xeb8f('0x9c')](function(_0x35aa71){var _0xf50680;_0x457c14=_0x35aa71||[];var _0x2c2731=[];if(_0x35aa71){for(var _0x3e33d4=0x0;_0x3e33d4<_0x35aa71['length'];_0x3e33d4+=0x1){var _0x148347=_0x35aa71[_0x3e33d4][_0xeb8f('0x2c')]({'plain':!![]});_0x36afea[_0xeb8f('0xa4')]=_0x27c695[_0xeb8f('0x57')][_0xeb8f('0xa4')]?_0x27c695[_0xeb8f('0x57')]['dialCheckDuplicateType']:_0x36afea[_0xeb8f('0xa4')];switch(_0x36afea[_0xeb8f('0xa4')]){case'always':_0xf50680=squel[_0xeb8f('0xa5')]()[_0xeb8f('0xa6')]('cm_hopper')[_0xeb8f('0xa7')]([_0xeb8f('0xa8'),_0xeb8f('0xa9'),_0xeb8f('0xaa'),_0xeb8f('0xab'),_0xeb8f('0x69'),_0xeb8f('0x60'),_0xeb8f('0x61')],squel['select']()[_0xeb8f('0x85')]('phone',_0xeb8f('0xa8'))['field'](_0xeb8f('0xac'),_0xeb8f('0xa9'))['field']('id',_0xeb8f('0xaa'))['field'](_0x148347[_0xeb8f('0xad')][_0xeb8f('0xae')](),_0xeb8f('0xab'))[_0xeb8f('0x85')](_0x27c695['params']['id'][_0xeb8f('0xae')](),_0xeb8f('0x69'))[_0xeb8f('0x85')](_0xeb8f('0xac'),_0xeb8f('0x60'))[_0xeb8f('0x85')](_0xeb8f('0xac'),_0xeb8f('0x61'))[_0xeb8f('0x86')]('cm_contacts')[_0xeb8f('0x4a')](_0xeb8f('0xaf'))['where'](_0xeb8f('0xb0'),_0x148347['CmListId']['toString']())[_0xeb8f('0x4a')](_0xeb8f('0xb1'))[_0xeb8f('0x4a')](_0xeb8f('0xb2'),squel[_0xeb8f('0x84')]()[_0xeb8f('0x85')](_0xeb8f('0xb3'))[_0xeb8f('0x86')](_0xeb8f('0xb4'))[_0xeb8f('0x4a')](_0xeb8f('0x8b'),_0x27c695['params']['id']['toString']()))[_0xeb8f('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xeb8f('0x85')]('COALESCE(phone,\x27\x27)')['from'](_0xeb8f('0xb5'))[_0xeb8f('0x4a')](_0xeb8f('0x8b'),_0x27c695['params']['id'][_0xeb8f('0xae')]())))[_0xeb8f('0xae')]();break;case _0xeb8f('0xb6'):_0xf50680=squel[_0xeb8f('0xa5')]()[_0xeb8f('0xa6')](_0xeb8f('0xb5'))[_0xeb8f('0xa7')]([_0xeb8f('0xa8'),'scheduledAt',_0xeb8f('0xaa'),_0xeb8f('0xab'),_0xeb8f('0x69'),'createdAt',_0xeb8f('0x61')],squel['select']()['field'](_0xeb8f('0xa8'),_0xeb8f('0xa8'))[_0xeb8f('0x85')]('NOW()','scheduledAt')[_0xeb8f('0x85')]('id','ContactId')['field'](_0x148347['CmListId']['toString'](),_0xeb8f('0xab'))[_0xeb8f('0x85')](_0x27c695[_0xeb8f('0x5e')]['id'][_0xeb8f('0xae')](),_0xeb8f('0x69'))[_0xeb8f('0x85')]('NOW()',_0xeb8f('0x60'))['field'](_0xeb8f('0xac'),'updatedAt')[_0xeb8f('0x86')](_0xeb8f('0xb7'))[_0xeb8f('0x4a')](_0xeb8f('0xaf'))[_0xeb8f('0x4a')]('ListId\x20=\x20?',_0x148347['CmListId'][_0xeb8f('0xae')]())[_0xeb8f('0x4a')](_0xeb8f('0xb1'))[_0xeb8f('0x4a')](_0xeb8f('0xb2'),squel[_0xeb8f('0x84')]()[_0xeb8f('0x85')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xeb8f('0x4a')]('VoiceQueueId\x20=\x20?',_0x27c695[_0xeb8f('0x5e')]['id'][_0xeb8f('0xae')]())))[_0xeb8f('0xae')]();break;default:_0xf50680=squel[_0xeb8f('0xa5')]()[_0xeb8f('0xa6')](_0xeb8f('0xb5'))[_0xeb8f('0xa7')]([_0xeb8f('0xa8'),_0xeb8f('0xa9'),'ContactId',_0xeb8f('0xab'),_0xeb8f('0x69'),_0xeb8f('0x60'),_0xeb8f('0x61')],squel[_0xeb8f('0x84')]()[_0xeb8f('0x85')](_0xeb8f('0xa8'),_0xeb8f('0xa8'))[_0xeb8f('0x85')](_0xeb8f('0xac'),_0xeb8f('0xa9'))[_0xeb8f('0x85')]('id',_0xeb8f('0xaa'))[_0xeb8f('0x85')](_0x148347[_0xeb8f('0xad')][_0xeb8f('0xae')](),_0xeb8f('0xab'))[_0xeb8f('0x85')](_0x27c695['params']['id']['toString'](),'VoiceQueueId')[_0xeb8f('0x85')](_0xeb8f('0xac'),'createdAt')['field']('NOW()','updatedAt')[_0xeb8f('0x86')](_0xeb8f('0xb7'))[_0xeb8f('0x4a')](_0xeb8f('0xaf'))[_0xeb8f('0x4a')](_0xeb8f('0xb0'),_0x148347[_0xeb8f('0xad')][_0xeb8f('0xae')]())[_0xeb8f('0x4a')](_0xeb8f('0xb1')))[_0xeb8f('0xae')]();}_0x2c2731[_0xeb8f('0x8e')](db[_0xeb8f('0x8f')][_0xeb8f('0x41')](_0xf50680));}return BPromise[_0xeb8f('0x94')](_0x2c2731);}})[_0xeb8f('0x2a')](function(){return _0x457c14;})[_0xeb8f('0x2a')](respondWithResult(_0x1daed4,null))[_0xeb8f('0x52')](handleError(_0x1daed4,null));};exports[_0xeb8f('0xb8')]=function(_0x5e32e6,_0x5cca37,_0x5aa7f1){return db[_0xeb8f('0x3c')][_0xeb8f('0x34')]({'where':{'id':_0x5e32e6[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x5cca37,null))['then'](function(_0x3bafb9){if(_0x3bafb9){return _0x3bafb9[_0xeb8f('0xb8')](_0x5e32e6[_0xeb8f('0x41')][_0xeb8f('0x97')]);}})[_0xeb8f('0x2a')](function(_0x203a51){if(_0x203a51){return db[_0xeb8f('0x66')]['destroy']({'where':{'ListId':_0x5e32e6[_0xeb8f('0x41')][_0xeb8f('0x97')],'VoiceQueueId':_0x5e32e6['params']['id']}})['then'](function(){return _0x203a51;});}})['then'](respondWithStatusCode(_0x5cca37,null))[_0xeb8f('0x52')](handleError(_0x5cca37,null));};exports[_0xeb8f('0xb9')]=function(_0xdcbc7b,_0x1913a7,_0x474166){var _0x1a25e8={};var _0x125524={};var _0x3127bd;var _0x5a26db;return db[_0xeb8f('0x3c')]['findOne']({'where':{'id':_0xdcbc7b[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x1913a7,null))['then'](function(_0x5bfddf){if(_0x5bfddf){_0x3127bd=_0x5bfddf;_0x125524[_0xeb8f('0x45')]=_[_0xeb8f('0x42')](db[_0xeb8f('0xba')][_0xeb8f('0x3d')]);_0x125524[_0xeb8f('0x41')]=_['keys'](_0xdcbc7b[_0xeb8f('0x41')]);_0x125524[_0xeb8f('0x43')]=_[_0xeb8f('0x44')](_0x125524[_0xeb8f('0x45')],_0x125524['query']);_0x1a25e8[_0xeb8f('0x46')]=_[_0xeb8f('0x44')](_0x125524[_0xeb8f('0x45')],qs[_0xeb8f('0x54')](_0xdcbc7b[_0xeb8f('0x41')][_0xeb8f('0x54')]));_0x1a25e8[_0xeb8f('0x46')]=_0x1a25e8['attributes'][_0xeb8f('0x55')]?_0x1a25e8[_0xeb8f('0x46')]:_0x125524['model'];_0x1a25e8[_0xeb8f('0x48')]=qs[_0xeb8f('0x49')](_0xdcbc7b[_0xeb8f('0x41')][_0xeb8f('0x49')]);_0x1a25e8[_0xeb8f('0x4a')]=qs[_0xeb8f('0x43')](_[_0xeb8f('0x68')](_0xdcbc7b[_0xeb8f('0x41')],_0x125524[_0xeb8f('0x43')]));if(_0xdcbc7b['query'][_0xeb8f('0x30')]){_0x1a25e8[_0xeb8f('0x4a')]=_[_0xeb8f('0x4b')](_0x1a25e8[_0xeb8f('0x4a')],{'$or':_[_0xeb8f('0x31')](_0x1a25e8['attributes'],function(_0x287396){var _0x324e6f={};_0x324e6f[_0x287396]={'$like':'%'+_0xdcbc7b[_0xeb8f('0x41')][_0xeb8f('0x30')]+'%'};return _0x324e6f;})});}_0x1a25e8=_[_0xeb8f('0x4b')]({},_0x1a25e8,_0xdcbc7b['options']);return _0x3127bd[_0xeb8f('0xb9')](_0x1a25e8);}})['then'](function(_0x276a31){if(_0x276a31){_0x5a26db=_0x276a31[_0xeb8f('0x55')];if(!_0xdcbc7b[_0xeb8f('0x41')][_0xeb8f('0x47')](_0xeb8f('0x67'))){_0x1a25e8[_0xeb8f('0x22')]=qs[_0xeb8f('0x22')](_0xdcbc7b[_0xeb8f('0x41')][_0xeb8f('0x22')]);_0x1a25e8['offset']=qs[_0xeb8f('0x21')](_0xdcbc7b[_0xeb8f('0x41')]['offset']);}return _0x3127bd[_0xeb8f('0xb9')](_0x1a25e8);}})[_0xeb8f('0x2a')](function(_0x19985b){if(_0x19985b){return _0x19985b?{'count':_0x5a26db,'rows':_0x19985b}:null;}})[_0xeb8f('0x2a')](respondWithResult(_0x1913a7,null))[_0xeb8f('0x52')](handleError(_0x1913a7,null));};exports[_0xeb8f('0xbb')]=function(_0x1ed25f,_0x401619,_0x28d345){var _0x464188,_0x23b652;return db[_0xeb8f('0x3c')][_0xeb8f('0x34')]({'where':{'id':_0x1ed25f[_0xeb8f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x401619,null))['then'](function(_0x3df5dc){if(_0x3df5dc){_0x23b652=_0x3df5dc;return _0x3df5dc['addBlackLists'](_0x1ed25f[_0xeb8f('0x57')][_0xeb8f('0x97')],_[_0xeb8f('0x5f')](_0x1ed25f['body'],['ids','id'])||{});}return null;})[_0xeb8f('0x9c')](function(_0x18b654){var _0x1fbb79;_0x464188=_0x18b654||[];var _0x35e660=[];if(_0x18b654){for(var _0x583047=0x0;_0x583047<_0x18b654[_0xeb8f('0x55')];_0x583047+=0x1){var _0xd98ba6=_0x18b654[_0x583047]['get']({'plain':!![]});_0x1fbb79=squel[_0xeb8f('0xa5')]()[_0xeb8f('0xa6')](_0xeb8f('0xbc'))[_0xeb8f('0xa7')]([_0xeb8f('0xa8'),_0xeb8f('0xaa'),_0xeb8f('0xab'),_0xeb8f('0x69'),_0xeb8f('0x60'),_0xeb8f('0x61')],squel[_0xeb8f('0x84')]()[_0xeb8f('0x85')]('phone',_0xeb8f('0xa8'))[_0xeb8f('0x85')]('id','ContactId')[_0xeb8f('0x85')](_0xd98ba6[_0xeb8f('0xad')][_0xeb8f('0xae')](),_0xeb8f('0xab'))['field'](_0x1ed25f['params']['id']['toString'](),_0xeb8f('0x69'))['field'](_0xeb8f('0xac'),_0xeb8f('0x60'))[_0xeb8f('0x85')]('NOW()',_0xeb8f('0x61'))['from'](_0xeb8f('0xb7'))[_0xeb8f('0x4a')](_0xeb8f('0xaf'))[_0xeb8f('0x4a')](_0xeb8f('0xb0'),_0xd98ba6[_0xeb8f('0xad')][_0xeb8f('0xae')]())['where'](_0xeb8f('0xb1')))[_0xeb8f('0xae')]();_0x35e660[_0xeb8f('0x8e')](db[_0xeb8f('0x8f')][_0xeb8f('0x41')](_0x1fbb79));}return BPromise['all'](_0x35e660);}})[_0xeb8f('0x2a')](function(){return _0x464188;})[_0xeb8f('0x2a')](respondWithResult(_0x401619,null))[_0xeb8f('0x52')](handleError(_0x401619,null));};exports['removeBlackLists']=function(_0x59258b,_0x3a06cb,_0x5ca5af){return db[_0xeb8f('0x3c')][_0xeb8f('0x34')]({'where':{'id':_0x59258b[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](handleEntityNotFound(_0x3a06cb,null))[_0xeb8f('0x2a')](function(_0xfcfbad){if(_0xfcfbad){return _0xfcfbad['removeBlackLists'](_0x59258b[_0xeb8f('0x41')][_0xeb8f('0x97')]);}})['then'](function(_0x3796f7){if(_0x3796f7){return db[_0xeb8f('0x6e')][_0xeb8f('0x2b')]({'where':{'ListId':_0x59258b[_0xeb8f('0x41')]['ids'],'VoiceQueueId':_0x59258b[_0xeb8f('0x5e')]['id']}})[_0xeb8f('0x2a')](function(){return _0x3796f7;});}})[_0xeb8f('0x2a')](respondWithStatusCode(_0x3a06cb,null))[_0xeb8f('0x52')](handleError(_0x3a06cb,null));}; \ No newline at end of file +var _0xb6f4=['updatedAt','userProfileId','getHoppers','findOne','VoiceQueueId','CmHopper','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','isNil','format','userVoiceQueue:save','removeTeams','ids','select','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','spread','emit','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','NOW()','field','CmListId','ListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','QueueCampaigns','outbound','ignore','value','type','name','UserProfileResource','sendStatus','stack','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','VoiceQueue','include','findAll','rows','catch','params','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit'];(function(_0x1cea76,_0x11c8ad){var _0x1b359b=function(_0x4e849d){while(--_0x4e849d){_0x1cea76['push'](_0x1cea76['shift']());}};_0x1b359b(++_0x11c8ad);}(_0xb6f4,0x1be));var _0x4b6f=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xb6f4[_0x4191bc];return _0x1ffd4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b6f('0x0'));var zipdir=require(_0x4b6f('0x1'));var jsonpatch=require(_0x4b6f('0x2'));var rp=require(_0x4b6f('0x3'));var moment=require('moment');var BPromise=require(_0x4b6f('0x4'));var Mustache=require(_0x4b6f('0x5'));var util=require(_0x4b6f('0x6'));var path=require(_0x4b6f('0x7'));var sox=require('sox');var csv=require(_0x4b6f('0x8'));var ejs=require(_0x4b6f('0x9'));var fs=require('fs');var fs_extra=require(_0x4b6f('0xa'));var _=require('lodash');var squel=require(_0x4b6f('0xb'));var crypto=require(_0x4b6f('0xc'));var jsforce=require(_0x4b6f('0xd'));var deskjs=require(_0x4b6f('0xe'));var toCsv=require(_0x4b6f('0x8'));var querystring=require(_0x4b6f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b6f('0x10'));var as=require(_0x4b6f('0x11'));var hardwareService=require(_0x4b6f('0x12'));var logger=require(_0x4b6f('0x13'))(_0x4b6f('0x14'));var utils=require(_0x4b6f('0x15'));var config=require(_0x4b6f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b6f('0x17'))['db'];config[_0x4b6f('0x18')]=_['defaults'](config[_0x4b6f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b6f('0x19'))(new Redis(config[_0x4b6f('0x18')]));require(_0x4b6f('0x1a'))[_0x4b6f('0x1b')](socket);function respondWithStatusCode(_0x330621,_0x34c15d){_0x34c15d=_0x34c15d||0xcc;return function(_0x435557){if(_0x435557){return _0x330621['sendStatus'](_0x34c15d);}return _0x330621[_0x4b6f('0x1c')](_0x34c15d)[_0x4b6f('0x1d')]();};}function respondWithResult(_0x115b72,_0x4b0412){_0x4b0412=_0x4b0412||0xc8;return function(_0x5ddfbb){if(_0x5ddfbb){return _0x115b72[_0x4b6f('0x1c')](_0x4b0412)[_0x4b6f('0x1e')](_0x5ddfbb);}};}function respondWithFilteredResult(_0x3419f0,_0x3aa394){return function(_0x5cbc56){if(_0x5cbc56){var _0x56361d=typeof _0x3aa394[_0x4b6f('0x1f')]===_0x4b6f('0x20')&&typeof _0x3aa394[_0x4b6f('0x21')]===_0x4b6f('0x20');var _0x279116=_0x5cbc56[_0x4b6f('0x22')];var _0x24ae34=_0x56361d?0x0:_0x3aa394[_0x4b6f('0x1f')];var _0x574246=_0x56361d?_0x5cbc56[_0x4b6f('0x22')]:_0x3aa394[_0x4b6f('0x1f')]+_0x3aa394[_0x4b6f('0x21')];var _0x4e5413;if(_0x574246>=_0x279116){_0x574246=_0x279116;_0x4e5413=0xc8;}else{_0x4e5413=0xce;}_0x3419f0[_0x4b6f('0x1c')](_0x4e5413);return _0x3419f0[_0x4b6f('0x23')](_0x4b6f('0x24'),_0x24ae34+'-'+_0x574246+'/'+_0x279116)[_0x4b6f('0x1e')](_0x5cbc56);}return null;};}function patchUpdates(_0x4e7dbf){return function(_0x152dff){try{jsonpatch[_0x4b6f('0x25')](_0x152dff,_0x4e7dbf,!![]);}catch(_0xddc0ef){return BPromise[_0x4b6f('0x26')](_0xddc0ef);}return _0x152dff[_0x4b6f('0x27')]();};}function saveUpdates(_0x56c804,_0x2f7d9c){return function(_0x2fe955){if(_0x2fe955){return _0x2fe955[_0x4b6f('0x28')](_0x56c804)[_0x4b6f('0x29')](function(_0x715ea4){return _0x715ea4;});}return null;};}function removeEntity(_0x50bb95,_0x2b3399){return function(_0x48a01e){if(_0x48a01e){return _0x48a01e[_0x4b6f('0x2a')]()['then'](function(){var _0x13fe5e=_0x48a01e['get']({'plain':!![]});var _0x349cc3=[{'name':_0x4b6f('0x2b'),'value':'inbound','ignore':![]},{'name':_0x4b6f('0x2c'),'value':_0x4b6f('0x2d'),'ignore':![]}];var _0x125bfb=_(_0x349cc3)['filter'](_0x4b6f('0x2e'))['map'](_0x4b6f('0x2f'))[_0x4b6f('0x2f')]();if(_['includes'](_0x125bfb,_0x13fe5e[_0x4b6f('0x30')])){return;}var _0x37eea9=_['find'](_0x349cc3,[_0x4b6f('0x2f'),_0x13fe5e[_0x4b6f('0x30')]])[_0x4b6f('0x31')];return db[_0x4b6f('0x32')][_0x4b6f('0x2a')]({'where':{'type':_0x37eea9,'resourceId':_0x13fe5e['id']}})[_0x4b6f('0x29')](function(){return _0x48a01e;});})[_0x4b6f('0x29')](function(){_0x50bb95[_0x4b6f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f1b5,_0x598ccc){return function(_0x4af1ca){if(!_0x4af1ca){_0x43f1b5[_0x4b6f('0x33')](0x194);}return _0x4af1ca;};}function handleError(_0xae49fa,_0x5e98f6){_0x5e98f6=_0x5e98f6||0x1f4;return function(_0x500b0e){logger['error'](_0x500b0e[_0x4b6f('0x34')]);if(_0x500b0e['name']){delete _0x500b0e[_0x4b6f('0x31')];}_0xae49fa[_0x4b6f('0x1c')](_0x5e98f6)[_0x4b6f('0x35')](_0x500b0e);};}exports[_0x4b6f('0x36')]=function(_0x26e38d,_0x263e97){var _0x590117={},_0x3285c7={},_0x59694c={'count':0x0,'rows':[]};var _0x2a99cf=_[_0x4b6f('0x37')](db['VoiceQueue'][_0x4b6f('0x38')],function(_0x4df022){return{'name':_0x4df022[_0x4b6f('0x39')],'type':_0x4df022[_0x4b6f('0x30')][_0x4b6f('0x3a')]};});_0x3285c7[_0x4b6f('0x3b')]=_[_0x4b6f('0x37')](_0x2a99cf,_0x4b6f('0x31'));_0x3285c7['query']=_[_0x4b6f('0x3c')](_0x26e38d[_0x4b6f('0x3d')]);_0x3285c7[_0x4b6f('0x3e')]=_[_0x4b6f('0x3f')](_0x3285c7[_0x4b6f('0x3b')],_0x3285c7[_0x4b6f('0x3d')]);_0x590117[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x3285c7[_0x4b6f('0x3b')],qs['fields'](_0x26e38d['query'][_0x4b6f('0x41')]));_0x590117['attributes']=_0x590117[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x590117['attributes']:_0x3285c7['model'];if(!_0x26e38d['query'][_0x4b6f('0x43')](_0x4b6f('0x44'))){_0x590117['limit']=qs['limit'](_0x26e38d[_0x4b6f('0x3d')][_0x4b6f('0x21')]);_0x590117[_0x4b6f('0x1f')]=qs[_0x4b6f('0x1f')](_0x26e38d[_0x4b6f('0x3d')]['offset']);}_0x590117[_0x4b6f('0x45')]=qs['sort'](_0x26e38d['query'][_0x4b6f('0x46')]);_0x590117['where']=qs[_0x4b6f('0x3e')](_[_0x4b6f('0x47')](_0x26e38d[_0x4b6f('0x3d')],_0x3285c7[_0x4b6f('0x3e')]),_0x2a99cf);if(_0x26e38d[_0x4b6f('0x3d')][_0x4b6f('0x48')]){_0x590117[_0x4b6f('0x49')]=_['merge'](_0x590117[_0x4b6f('0x49')],{'$or':_['map'](_0x2a99cf,function(_0xb2585c){if(_0xb2585c[_0x4b6f('0x30')]!==_0x4b6f('0x4a')){var _0x3e7339={};_0x3e7339[_0xb2585c['name']]={'$like':'%'+_0x26e38d[_0x4b6f('0x3d')][_0x4b6f('0x48')]+'%'};return _0x3e7339;}})});}_0x590117=_['merge']({},_0x590117,_0x26e38d[_0x4b6f('0x4b')]);var _0x2cf736={'where':_0x590117['where']};return db[_0x4b6f('0x4c')][_0x4b6f('0x22')](_0x2cf736)[_0x4b6f('0x29')](function(_0x50a66e){_0x59694c['count']=_0x50a66e;if(_0x26e38d[_0x4b6f('0x3d')]['includeAll']){_0x590117[_0x4b6f('0x4d')]=[{'all':!![]}];}return db[_0x4b6f('0x4c')][_0x4b6f('0x4e')](_0x590117);})[_0x4b6f('0x29')](function(_0x3eaecd){_0x59694c[_0x4b6f('0x4f')]=_0x3eaecd;return _0x59694c;})[_0x4b6f('0x29')](respondWithFilteredResult(_0x263e97,_0x590117))[_0x4b6f('0x50')](handleError(_0x263e97,null));};exports['show']=function(_0x5be221,_0x290924){var _0x29e057={'raw':![],'where':{'id':_0x5be221[_0x4b6f('0x51')]['id']}},_0x1c8352={};_0x1c8352['model']=_[_0x4b6f('0x3c')](db[_0x4b6f('0x4c')][_0x4b6f('0x38')]);_0x1c8352[_0x4b6f('0x3d')]=_[_0x4b6f('0x3c')](_0x5be221['query']);_0x1c8352[_0x4b6f('0x3e')]=_[_0x4b6f('0x3f')](_0x1c8352['model'],_0x1c8352[_0x4b6f('0x3d')]);_0x29e057['attributes']=_[_0x4b6f('0x3f')](_0x1c8352['model'],qs[_0x4b6f('0x41')](_0x5be221[_0x4b6f('0x3d')][_0x4b6f('0x41')]));_0x29e057[_0x4b6f('0x40')]=_0x29e057[_0x4b6f('0x40')]['length']?_0x29e057[_0x4b6f('0x40')]:_0x1c8352[_0x4b6f('0x3b')];if(_0x5be221[_0x4b6f('0x3d')][_0x4b6f('0x52')]){_0x29e057[_0x4b6f('0x4d')]=[{'all':!![]}];}_0x29e057=_[_0x4b6f('0x53')]({},_0x29e057,_0x5be221[_0x4b6f('0x4b')]);return db[_0x4b6f('0x4c')][_0x4b6f('0x54')](_0x29e057)[_0x4b6f('0x29')](handleEntityNotFound(_0x290924,null))[_0x4b6f('0x29')](respondWithResult(_0x290924,null))[_0x4b6f('0x50')](handleError(_0x290924,null));};exports[_0x4b6f('0x55')]=function(_0x20902e,_0x235562){return db[_0x4b6f('0x4c')][_0x4b6f('0x55')](_0x20902e[_0x4b6f('0x56')],{})[_0x4b6f('0x29')](function(_0x4f7589){var _0x10b80b=_0x20902e[_0x4b6f('0x57')][_0x4b6f('0x58')]({'plain':!![]});if(!_0x10b80b)throw new Error(_0x4b6f('0x59'));if(_0x10b80b[_0x4b6f('0x5a')]===_0x4b6f('0x57')){var _0x108c4f=_0x4f7589[_0x4b6f('0x58')]({'plain':!![]});var _0x4909f0=[{'name':_0x4b6f('0x2b'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x4b6f('0x2d')}];var _0x51816c=_[_0x4b6f('0x54')](_0x4909f0,['value',_0x108c4f[_0x4b6f('0x30')]])[_0x4b6f('0x31')];return db[_0x4b6f('0x5b')][_0x4b6f('0x54')]({'where':{'name':_0x51816c,'userProfileId':_0x10b80b['userProfileId']},'raw':!![]})[_0x4b6f('0x29')](function(_0x2f9255){if(_0x2f9255&&_0x2f9255[_0x4b6f('0x5c')]===0x0){return db['UserProfileResource'][_0x4b6f('0x55')]({'name':_0x108c4f[_0x4b6f('0x31')],'resourceId':_0x108c4f['id'],'type':_0x2f9255[_0x4b6f('0x31')],'sectionId':_0x2f9255['id']},{})[_0x4b6f('0x29')](function(){return _0x4f7589;});}else{return _0x4f7589;}})['catch'](function(_0x3713c3){logger[_0x4b6f('0x5d')](_0x4b6f('0x5e'),_0x3713c3);throw _0x3713c3;});}return _0x4f7589;})['then'](respondWithResult(_0x235562,0xc9))['catch'](handleError(_0x235562,null));};exports[_0x4b6f('0x5f')]=function(_0x58ea22,_0x4fd890){var _0x41c14b={'where':{'id':_0x58ea22[_0x4b6f('0x51')]['id']}},_0x3328b8={};_0x3328b8[_0x4b6f('0x3b')]=_['keys'](db[_0x4b6f('0x4c')]['rawAttributes']);_0x41c14b[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x3328b8[_0x4b6f('0x3b')],qs[_0x4b6f('0x41')](_0x58ea22['query']['fields']));_0x41c14b[_0x4b6f('0x40')]=_0x41c14b[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x41c14b[_0x4b6f('0x40')]:_0x3328b8[_0x4b6f('0x3b')];if(_0x58ea22[_0x4b6f('0x3d')][_0x4b6f('0x52')]){_0x41c14b[_0x4b6f('0x4d')]=[{'all':!![]}];}_0x41c14b=_['merge']({},_0x41c14b,_0x58ea22['options']);return db[_0x4b6f('0x4c')][_0x4b6f('0x54')](_0x41c14b)['then'](handleEntityNotFound(_0x4fd890,null))[_0x4b6f('0x29')](function(_0x4ba694){if(_0x4ba694){var _0x12e60e=_0x4ba694['get']({'plain':!![]});_0x12e60e=qs[_0x4b6f('0x60')](_0x12e60e,['id','createdAt','updatedAt']);_0x58ea22[_0x4b6f('0x56')]=_[_0x4b6f('0x60')](_0x58ea22[_0x4b6f('0x56')],['id','createdAt',_0x4b6f('0x61')]);return db['VoiceQueue']['create'](_[_0x4b6f('0x53')](_0x12e60e,_0x58ea22['body']),{'include':_0x58ea22['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2fb21c){var _0x534a0e=_0x58ea22['user']['get']({'plain':!![]});if(!_0x534a0e)throw new Error(_0x4b6f('0x59'));if(_0x534a0e[_0x4b6f('0x5a')]===_0x4b6f('0x57')){var _0x1c4c2c=_0x2fb21c[_0x4b6f('0x58')]({'plain':!![]});var _0x20a88f=[{'name':_0x4b6f('0x2b'),'value':'inbound'},{'name':_0x4b6f('0x2c'),'value':_0x4b6f('0x2d')}];var _0x5dd684=_[_0x4b6f('0x54')](_0x20a88f,[_0x4b6f('0x2f'),_0x1c4c2c[_0x4b6f('0x30')]])['name'];return db[_0x4b6f('0x5b')][_0x4b6f('0x54')]({'where':{'name':_0x5dd684,'userProfileId':_0x534a0e[_0x4b6f('0x62')]},'raw':!![]})['then'](function(_0x59d065){if(_0x59d065&&_0x59d065[_0x4b6f('0x5c')]===0x0){return db[_0x4b6f('0x32')][_0x4b6f('0x55')]({'name':_0x1c4c2c[_0x4b6f('0x31')],'resourceId':_0x1c4c2c['id'],'type':_0x59d065[_0x4b6f('0x31')],'sectionId':_0x59d065['id']},{})[_0x4b6f('0x29')](function(){return _0x2fb21c;});}else{return _0x2fb21c;}})['catch'](function(_0x58d053){logger[_0x4b6f('0x5d')](_0x4b6f('0x5e'),_0x58d053);throw _0x58d053;});}return _0x2fb21c;});}})[_0x4b6f('0x29')](respondWithResult(_0x4fd890,0xc9))[_0x4b6f('0x50')](handleError(_0x4fd890,null));};exports[_0x4b6f('0x28')]=function(_0x17ee87,_0x1d291b){if(_0x17ee87[_0x4b6f('0x56')]['id']){delete _0x17ee87[_0x4b6f('0x56')]['id'];}return db[_0x4b6f('0x4c')]['find']({'where':{'id':_0x17ee87[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x1d291b,null))[_0x4b6f('0x29')](saveUpdates(_0x17ee87[_0x4b6f('0x56')],null))['then'](respondWithResult(_0x1d291b,null))[_0x4b6f('0x50')](handleError(_0x1d291b,null));};exports[_0x4b6f('0x2a')]=function(_0x1cf593,_0x4a1d40){return db[_0x4b6f('0x4c')]['find']({'where':{'id':_0x1cf593[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x4a1d40,null))[_0x4b6f('0x29')](removeEntity(_0x4a1d40,null))['catch'](handleError(_0x4a1d40,null));};exports[_0x4b6f('0x63')]=function(_0x1f4c8c,_0x51116f,_0x277f85){var _0x3fe3bd={'raw':![],'where':{}};var _0x5643b4={};var _0x128b4f={'count':0x0,'rows':[]};return db[_0x4b6f('0x4c')][_0x4b6f('0x64')]({'where':{'id':_0x1f4c8c[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x51116f,null))[_0x4b6f('0x29')](function(_0x3bd315){if(_0x3bd315){_0x5643b4[_0x4b6f('0x3b')]=_[_0x4b6f('0x3c')](db['CmHopper'][_0x4b6f('0x38')]);_0x5643b4[_0x4b6f('0x3d')]=_['keys'](_0x1f4c8c[_0x4b6f('0x3d')]);_0x5643b4[_0x4b6f('0x3e')]=_[_0x4b6f('0x3f')](_0x5643b4[_0x4b6f('0x3b')],_0x5643b4['query']);_0x3fe3bd[_0x4b6f('0x40')]=_['intersection'](_0x5643b4[_0x4b6f('0x3b')],qs[_0x4b6f('0x41')](_0x1f4c8c['query'][_0x4b6f('0x41')]));_0x3fe3bd[_0x4b6f('0x40')]=_0x3fe3bd[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x3fe3bd[_0x4b6f('0x40')]:_0x5643b4[_0x4b6f('0x3b')];if(!_0x1f4c8c[_0x4b6f('0x3d')][_0x4b6f('0x43')](_0x4b6f('0x44'))){_0x3fe3bd[_0x4b6f('0x21')]=qs[_0x4b6f('0x21')](_0x1f4c8c[_0x4b6f('0x3d')]['limit']);_0x3fe3bd[_0x4b6f('0x1f')]=qs[_0x4b6f('0x1f')](_0x1f4c8c[_0x4b6f('0x3d')][_0x4b6f('0x1f')]);}_0x3fe3bd[_0x4b6f('0x45')]=qs[_0x4b6f('0x46')](_0x1f4c8c['query']['sort']);_0x3fe3bd[_0x4b6f('0x49')]=qs[_0x4b6f('0x3e')](_['pick'](_0x1f4c8c['query'],_0x5643b4[_0x4b6f('0x3e')]));_0x3fe3bd['where'][_0x4b6f('0x65')]=_0x3bd315['id'];if(_0x1f4c8c[_0x4b6f('0x3d')][_0x4b6f('0x48')]){_0x3fe3bd[_0x4b6f('0x49')]=_[_0x4b6f('0x53')](_0x3fe3bd[_0x4b6f('0x49')],{'$or':_[_0x4b6f('0x37')](_0x3fe3bd[_0x4b6f('0x40')],function(_0x55f674){var _0x178ad2={};_0x178ad2[_0x55f674]={'$like':'%'+_0x1f4c8c['query']['filter']+'%'};return _0x178ad2;})});}_0x3fe3bd=_[_0x4b6f('0x53')]({},_0x3fe3bd,_0x1f4c8c[_0x4b6f('0x4b')]);return db['CmHopper'][_0x4b6f('0x22')]({'where':_0x3fe3bd['where']})[_0x4b6f('0x29')](function(_0x3f7da1){_0x128b4f['count']=_0x3f7da1;if(_0x1f4c8c[_0x4b6f('0x3d')][_0x4b6f('0x52')]){_0x3fe3bd[_0x4b6f('0x4d')]=[{'all':!![]}];}return db[_0x4b6f('0x66')][_0x4b6f('0x4e')](_0x3fe3bd);})[_0x4b6f('0x29')](function(_0x41bbf9){_0x128b4f[_0x4b6f('0x4f')]=_0x41bbf9;return _0x128b4f;});}})['then'](respondWithFilteredResult(_0x51116f,_0x3fe3bd))[_0x4b6f('0x50')](handleError(_0x51116f,null));};exports['getHopperHistories']=function(_0x10593d,_0xf4a926,_0x5c7ab2){var _0x144a8c={'raw':!![],'where':{}};var _0x5f58f8={};var _0x16df1b={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x10593d[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0xf4a926,null))[_0x4b6f('0x29')](function(_0x1c1184){if(_0x1c1184){_0x5f58f8[_0x4b6f('0x3b')]=_['keys'](db[_0x4b6f('0x67')][_0x4b6f('0x38')]);_0x5f58f8['query']=_['keys'](_0x10593d[_0x4b6f('0x3d')]);_0x5f58f8[_0x4b6f('0x3e')]=_[_0x4b6f('0x3f')](_0x5f58f8['model'],_0x5f58f8['query']);_0x144a8c[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x5f58f8['model'],qs[_0x4b6f('0x41')](_0x10593d[_0x4b6f('0x3d')][_0x4b6f('0x41')]));_0x144a8c[_0x4b6f('0x40')]=_0x144a8c[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x144a8c['attributes']:_0x5f58f8[_0x4b6f('0x3b')];if(!_0x10593d[_0x4b6f('0x3d')][_0x4b6f('0x43')](_0x4b6f('0x44'))){_0x144a8c['limit']=qs[_0x4b6f('0x21')](_0x10593d[_0x4b6f('0x3d')]['limit']);_0x144a8c[_0x4b6f('0x1f')]=qs[_0x4b6f('0x1f')](_0x10593d[_0x4b6f('0x3d')][_0x4b6f('0x1f')]);}_0x144a8c[_0x4b6f('0x45')]=qs[_0x4b6f('0x46')](_0x10593d[_0x4b6f('0x3d')][_0x4b6f('0x46')]);_0x144a8c[_0x4b6f('0x49')]=qs[_0x4b6f('0x3e')](_[_0x4b6f('0x47')](_0x10593d[_0x4b6f('0x3d')],_0x5f58f8['filters']));_0x144a8c[_0x4b6f('0x49')][_0x4b6f('0x65')]=_0x1c1184['id'];if(_0x10593d[_0x4b6f('0x3d')][_0x4b6f('0x48')]){_0x144a8c['where']=_[_0x4b6f('0x53')](_0x144a8c[_0x4b6f('0x49')],{'$or':_[_0x4b6f('0x37')](_0x144a8c[_0x4b6f('0x40')],function(_0x4f1919){var _0x4badde={};_0x4badde[_0x4f1919]={'$like':'%'+_0x10593d['query'][_0x4b6f('0x48')]+'%'};return _0x4badde;})});}_0x144a8c=_['merge']({},_0x144a8c,_0x10593d['options']);return db[_0x4b6f('0x67')][_0x4b6f('0x22')]({'where':_0x144a8c[_0x4b6f('0x49')]})[_0x4b6f('0x29')](function(_0x4a6bf3){_0x16df1b[_0x4b6f('0x22')]=_0x4a6bf3;if(_0x10593d[_0x4b6f('0x3d')]['includeAll']){_0x144a8c['include']=[{'all':!![]}];}return db[_0x4b6f('0x67')][_0x4b6f('0x4e')](_0x144a8c);})['then'](function(_0x28892b){_0x16df1b['rows']=_0x28892b;return _0x16df1b;});}})[_0x4b6f('0x29')](respondWithFilteredResult(_0xf4a926,_0x144a8c))[_0x4b6f('0x50')](handleError(_0xf4a926,null));};exports[_0x4b6f('0x68')]=function(_0x5ee235,_0x485372,_0x2ad67e){var _0x592559={'raw':!![],'where':{}};var _0x53e981={};var _0xe2f47a={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5ee235[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x485372,null))[_0x4b6f('0x29')](function(_0x416ce3){if(_0x416ce3){_0x53e981[_0x4b6f('0x3b')]=_['keys'](db[_0x4b6f('0x69')][_0x4b6f('0x38')]);_0x53e981[_0x4b6f('0x3d')]=_[_0x4b6f('0x3c')](_0x5ee235[_0x4b6f('0x3d')]);_0x53e981[_0x4b6f('0x3e')]=_['intersection'](_0x53e981[_0x4b6f('0x3b')],_0x53e981[_0x4b6f('0x3d')]);_0x592559[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x53e981[_0x4b6f('0x3b')],qs[_0x4b6f('0x41')](_0x5ee235[_0x4b6f('0x3d')][_0x4b6f('0x41')]));_0x592559['attributes']=_0x592559[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x592559[_0x4b6f('0x40')]:_0x53e981[_0x4b6f('0x3b')];if(!_0x5ee235[_0x4b6f('0x3d')][_0x4b6f('0x43')](_0x4b6f('0x44'))){_0x592559[_0x4b6f('0x21')]=qs[_0x4b6f('0x21')](_0x5ee235[_0x4b6f('0x3d')][_0x4b6f('0x21')]);_0x592559[_0x4b6f('0x1f')]=qs['offset'](_0x5ee235['query'][_0x4b6f('0x1f')]);}_0x592559['order']=qs[_0x4b6f('0x46')](_0x5ee235[_0x4b6f('0x3d')]['sort']);_0x592559[_0x4b6f('0x49')]=qs[_0x4b6f('0x3e')](_['pick'](_0x5ee235[_0x4b6f('0x3d')],_0x53e981[_0x4b6f('0x3e')]));_0x592559[_0x4b6f('0x49')]['VoiceQueueId']=_0x416ce3['id'];if(_0x5ee235['query'][_0x4b6f('0x48')]){_0x592559[_0x4b6f('0x49')]=_[_0x4b6f('0x53')](_0x592559['where'],{'$or':_['map'](_0x592559[_0x4b6f('0x40')],function(_0x2f4402){var _0x89c32b={};_0x89c32b[_0x2f4402]={'$like':'%'+_0x5ee235[_0x4b6f('0x3d')]['filter']+'%'};return _0x89c32b;})});}_0x592559=_[_0x4b6f('0x53')]({},_0x592559,_0x5ee235[_0x4b6f('0x4b')]);return db[_0x4b6f('0x69')][_0x4b6f('0x22')]({'where':_0x592559['where']})['then'](function(_0x266613){_0xe2f47a[_0x4b6f('0x22')]=_0x266613;if(_0x5ee235[_0x4b6f('0x3d')][_0x4b6f('0x52')]){_0x592559[_0x4b6f('0x4d')]=[{'all':!![]}];}return db[_0x4b6f('0x69')][_0x4b6f('0x4e')](_0x592559);})[_0x4b6f('0x29')](function(_0x52274b){_0xe2f47a[_0x4b6f('0x4f')]=_0x52274b;return _0xe2f47a;});}})[_0x4b6f('0x29')](respondWithFilteredResult(_0x485372,_0x592559))[_0x4b6f('0x50')](handleError(_0x485372,null));};exports['getHopperBlacks']=function(_0x3cceb2,_0x146706,_0xda51f1){var _0x3bbc9e={'raw':!![],'where':{}};var _0x2fd7ef={};var _0x5736f1={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3cceb2[_0x4b6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x146706,null))[_0x4b6f('0x29')](function(_0x5a76b6){if(_0x5a76b6){_0x2fd7ef[_0x4b6f('0x3b')]=_[_0x4b6f('0x3c')](db[_0x4b6f('0x6a')][_0x4b6f('0x38')]);_0x2fd7ef['query']=_[_0x4b6f('0x3c')](_0x3cceb2[_0x4b6f('0x3d')]);_0x2fd7ef[_0x4b6f('0x3e')]=_[_0x4b6f('0x3f')](_0x2fd7ef[_0x4b6f('0x3b')],_0x2fd7ef[_0x4b6f('0x3d')]);_0x3bbc9e[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x2fd7ef[_0x4b6f('0x3b')],qs[_0x4b6f('0x41')](_0x3cceb2['query'][_0x4b6f('0x41')]));_0x3bbc9e['attributes']=_0x3bbc9e[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x3bbc9e[_0x4b6f('0x40')]:_0x2fd7ef[_0x4b6f('0x3b')];if(!_0x3cceb2[_0x4b6f('0x3d')][_0x4b6f('0x43')](_0x4b6f('0x44'))){_0x3bbc9e[_0x4b6f('0x21')]=qs['limit'](_0x3cceb2['query'][_0x4b6f('0x21')]);_0x3bbc9e['offset']=qs['offset'](_0x3cceb2[_0x4b6f('0x3d')]['offset']);}_0x3bbc9e[_0x4b6f('0x45')]=qs[_0x4b6f('0x46')](_0x3cceb2['query'][_0x4b6f('0x46')]);_0x3bbc9e[_0x4b6f('0x49')]=qs['filters'](_['pick'](_0x3cceb2[_0x4b6f('0x3d')],_0x2fd7ef[_0x4b6f('0x3e')]));_0x3bbc9e[_0x4b6f('0x49')][_0x4b6f('0x65')]=_0x5a76b6['id'];if(_0x3cceb2[_0x4b6f('0x3d')][_0x4b6f('0x48')]){_0x3bbc9e[_0x4b6f('0x49')]=_[_0x4b6f('0x53')](_0x3bbc9e[_0x4b6f('0x49')],{'$or':_[_0x4b6f('0x37')](_0x3bbc9e['attributes'],function(_0x39fd22){var _0xee5b75={};_0xee5b75[_0x39fd22]={'$like':'%'+_0x3cceb2[_0x4b6f('0x3d')][_0x4b6f('0x48')]+'%'};return _0xee5b75;})});}_0x3bbc9e=_[_0x4b6f('0x53')]({},_0x3bbc9e,_0x3cceb2[_0x4b6f('0x4b')]);return db['CmHopperBlack'][_0x4b6f('0x22')]({'where':_0x3bbc9e['where']})[_0x4b6f('0x29')](function(_0x308f58){_0x5736f1['count']=_0x308f58;if(_0x3cceb2['query'][_0x4b6f('0x52')]){_0x3bbc9e['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x4b6f('0x4e')](_0x3bbc9e);})[_0x4b6f('0x29')](function(_0x5b1d0b){_0x5736f1[_0x4b6f('0x4f')]=_0x5b1d0b;return _0x5736f1;});}})[_0x4b6f('0x29')](respondWithFilteredResult(_0x146706,_0x3bbc9e))[_0x4b6f('0x50')](handleError(_0x146706,null));};exports['getTeams']=function(_0x5f189a,_0x45ddb3,_0x30314d){var _0x4236ba={};var _0x36e1c3={};var _0xc8dc0b;var _0x13761d;return db['VoiceQueue'][_0x4b6f('0x64')]({'where':{'id':_0x5f189a['params']['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x45ddb3,null))[_0x4b6f('0x29')](function(_0x5b8043){if(_0x5b8043){_0xc8dc0b=_0x5b8043;_0x36e1c3['model']=_[_0x4b6f('0x3c')](db['Team'][_0x4b6f('0x38')]);_0x36e1c3['query']=_[_0x4b6f('0x3c')](_0x5f189a[_0x4b6f('0x3d')]);_0x36e1c3[_0x4b6f('0x3e')]=_['intersection'](_0x36e1c3[_0x4b6f('0x3b')],_0x36e1c3['query']);_0x4236ba[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x36e1c3[_0x4b6f('0x3b')],qs[_0x4b6f('0x41')](_0x5f189a[_0x4b6f('0x3d')][_0x4b6f('0x41')]));_0x4236ba['attributes']=_0x4236ba['attributes'][_0x4b6f('0x42')]?_0x4236ba[_0x4b6f('0x40')]:_0x36e1c3[_0x4b6f('0x3b')];_0x4236ba['order']=qs[_0x4b6f('0x46')](_0x5f189a[_0x4b6f('0x3d')][_0x4b6f('0x46')]);_0x4236ba[_0x4b6f('0x49')]=qs['filters'](_[_0x4b6f('0x47')](_0x5f189a[_0x4b6f('0x3d')],_0x36e1c3[_0x4b6f('0x3e')]));if(_0x5f189a[_0x4b6f('0x3d')][_0x4b6f('0x48')]){_0x4236ba['where']=_[_0x4b6f('0x53')](_0x4236ba[_0x4b6f('0x49')],{'$or':_[_0x4b6f('0x37')](_0x4236ba[_0x4b6f('0x40')],function(_0x291303){var _0x268126={};_0x268126[_0x291303]={'$like':'%'+_0x5f189a[_0x4b6f('0x3d')][_0x4b6f('0x48')]+'%'};return _0x268126;})});}_0x4236ba=_[_0x4b6f('0x53')]({},_0x4236ba,_0x5f189a[_0x4b6f('0x4b')]);return _0xc8dc0b[_0x4b6f('0x6b')](_0x4236ba);}})[_0x4b6f('0x29')](function(_0x30c91a){if(_0x30c91a){_0x13761d=_0x30c91a[_0x4b6f('0x42')];if(!_0x5f189a['query']['hasOwnProperty'](_0x4b6f('0x44'))){_0x4236ba[_0x4b6f('0x21')]=qs['limit'](_0x5f189a['query'][_0x4b6f('0x21')]);_0x4236ba[_0x4b6f('0x1f')]=qs[_0x4b6f('0x1f')](_0x5f189a[_0x4b6f('0x3d')][_0x4b6f('0x1f')]);}return _0xc8dc0b[_0x4b6f('0x6b')](_0x4236ba);}})[_0x4b6f('0x29')](function(_0x1d8d4a){if(_0x1d8d4a){return _0x1d8d4a?{'count':_0x13761d,'rows':_0x1d8d4a}:null;}})[_0x4b6f('0x29')](respondWithResult(_0x45ddb3,null))[_0x4b6f('0x50')](handleError(_0x45ddb3,null));};exports[_0x4b6f('0x6c')]=function(_0x4d5500,_0x49d528,_0x47227f){var _0x9792eb=_0x4d5500[_0x4b6f('0x56')]['teams'];var _0x471613=_[_0x4b6f('0x37')](_0x9792eb,'id');return db[_0x4b6f('0x6d')]['findAll']({'where':{'id':_0x471613},'attributes':['id'],'include':[{'model':db[_0x4b6f('0x6e')],'as':_0x4b6f('0x6f'),'attributes':['id',_0x4b6f('0x31'),_0x4b6f('0x70'),_0x4b6f('0x71'),_0x4b6f('0x72')],'raw':!![]}]})['then'](function(_0x29a362){if(_0x29a362){var _0x3d8ccd=_[_0x4b6f('0x73')](_0x29a362,function(_0x51f45b){var _0x371e39=_0x51f45b['get']({'plain':!![]});_0x371e39[_0x4b6f('0x6f')][_0x4b6f('0x74')](function(_0x316fd4){_0x316fd4[_0x4b6f('0x75')]=_[_0x4b6f('0x54')](_0x9792eb,{'id':_0x371e39['id']})[_0x4b6f('0x75')];});return _0x371e39[_0x4b6f('0x6f')];});return db['VoiceQueue']['find']({'where':{'id':_0x4d5500[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](function(_0x29068b){return db[_0x4b6f('0x76')][_0x4b6f('0x77')](function(_0x43161d){return _0x29068b[_0x4b6f('0x6c')](_0x471613,{'transaction':_0x43161d})[_0x4b6f('0x29')](function(){return BPromise[_0x4b6f('0x78')](_0x9792eb,function(_0x39d57a){return db[_0x4b6f('0x79')][_0x4b6f('0x7a')]({'TeamId':_0x39d57a['id'],'VoiceQueueId':_0x4d5500['params']['id'],'penalty':_0x39d57a[_0x4b6f('0x75')]},{'transaction':_0x43161d});});})[_0x4b6f('0x29')](function(){return BPromise[_0x4b6f('0x78')](_0x3d8ccd,function(_0x4e2527){return db[_0x4b6f('0x7b')]['findOrCreate']({'where':{'UserId':_0x4e2527['id'],'VoiceQueueId':_0x4d5500['params']['id']},'defaults':{'penalty':_0x4e2527[_0x4b6f('0x75')]},'transaction':_0x43161d});});})[_0x4b6f('0x29')](function(){return BPromise[_0x4b6f('0x78')](_[_0x4b6f('0x48')](_0x3d8ccd,{'online':!![]}),function(_0x177f02){return db['UserVoiceQueueRt'][_0x4b6f('0x7a')]({'membername':_0x177f02['name'],'UserId':_0x177f02['id'],'queue_name':_0x29068b[_0x4b6f('0x31')],'VoiceQueueId':_0x29068b['id'],'interface':_[_0x4b6f('0x7c')](_0x177f02[_0x4b6f('0x72')])?util[_0x4b6f('0x7d')]('SIP/%s',_0x177f02[_0x4b6f('0x31')]):_0x177f02['interface'],'paused':_0x177f02['voicePause']||![],'penalty':_0x177f02[_0x4b6f('0x75')]},{'transaction':_0x43161d});});})[_0x4b6f('0x29')](function(){_0x3d8ccd[_0x4b6f('0x74')](function(_0xd24542){socket['emit'](_0x4b6f('0x7e'),{'UserId':_0xd24542['id'],'VoiceQueueId':_0x29068b['id']});});});});});}})[_0x4b6f('0x29')](respondWithStatusCode(_0x49d528,null))[_0x4b6f('0x50')](handleError(_0x49d528,null));};exports[_0x4b6f('0x7f')]=function(_0x3798cd,_0x3c76be,_0x244838){return db[_0x4b6f('0x6d')][_0x4b6f('0x4e')]({'where':{'id':_0x3798cd['query'][_0x4b6f('0x80')]},'attributes':['id'],'include':[{'model':db[_0x4b6f('0x6e')],'as':_0x4b6f('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x4b6f('0x29')](handleEntityNotFound(_0x3c76be,null))[_0x4b6f('0x29')](function(_0xfa5917){var _0x1113f0=_[_0x4b6f('0x37')](_0xfa5917,'id');var _0x192086=[];var _0x4d1a8e=[];var _0x3e765f=squel[_0x4b6f('0x81')]();_0x3e765f['field']('tq.TeamId')[_0x4b6f('0x82')](_0x4b6f('0x83'),'tq')[_0x4b6f('0x84')]('user_has_teams','ut',_0x4b6f('0x85'))[_0x4b6f('0x49')](_0x4b6f('0x86'),_0x3798cd[_0x4b6f('0x51')]['id']);for(var _0x2ab3b1=0x0;_0x2ab3b1<_0xfa5917[_0x4b6f('0x42')];_0x2ab3b1+=0x1){let _0x24c4a5=_0xfa5917[_0x2ab3b1];for(var _0x5e888a=0x0;_0x5e888a<_0x24c4a5[_0x4b6f('0x6f')][_0x4b6f('0x42')];_0x5e888a+=0x1){let _0x3cc6ee=_0x24c4a5[_0x4b6f('0x6f')][_0x5e888a];var _0x56d395=_0x3e765f[_0x4b6f('0x5f')]();_0x56d395[_0x4b6f('0x49')](_0x4b6f('0x87'),_0x3cc6ee['id']);_0x4d1a8e[_0x4b6f('0x88')](db['sequelize'][_0x4b6f('0x3d')](_0x56d395[_0x4b6f('0x89')](),{'type':db[_0x4b6f('0x76')][_0x4b6f('0x8a')]['SELECT']})['then'](function(_0x385bfa){if(_0x385bfa[_0x4b6f('0x42')]===0x1){return _0x3cc6ee['id'];}else{var _0x56cb92=_[_0x4b6f('0x8b')](_[_0x4b6f('0x37')](_0x385bfa,'TeamId'),function(_0x50effd){return _[_0x4b6f('0x8c')](_0x1113f0,_0x50effd);});if(_0x56cb92){return _0x3cc6ee['id'];}}}));}}return BPromise[_0x4b6f('0x8d')](_0x4d1a8e)[_0x4b6f('0x29')](function(_0x46547a){_0x192086=_(_0x192086)[_0x4b6f('0x8e')](_0x46547a)['compact']()[_0x4b6f('0x2f')]();return db[_0x4b6f('0x4c')][_0x4b6f('0x54')]({'where':{'id':_0x3798cd['params']['id']}})[_0x4b6f('0x29')](function(_0x1023dc){return db[_0x4b6f('0x76')]['transaction'](function(_0x18bc3e){return _0x1023dc['removeTeams'](_0x3798cd[_0x4b6f('0x3d')]['ids'],{'transaction':_0x18bc3e})['then'](function(){if(!_[_0x4b6f('0x8f')](_0x192086)){return _0x1023dc[_0x4b6f('0x90')](_0x192086,{'transaction':_0x18bc3e})[_0x4b6f('0x29')](function(){return db[_0x4b6f('0x91')][_0x4b6f('0x2a')]({'where':{'VoiceQueueId':_0x3798cd[_0x4b6f('0x51')]['id'],'UserId':_0x192086},'transaction':_0x18bc3e});});}})['then'](function(){_0x192086[_0x4b6f('0x74')](function(_0x22b5c0){socket['emit']('userVoiceQueue:remove',{'UserId':_0x22b5c0,'VoiceQueueId':_0x1023dc['id']});});});});});});})['then'](respondWithStatusCode(_0x3c76be,null))[_0x4b6f('0x50')](handleError(_0x3c76be,null));};exports[_0x4b6f('0x92')]=function(_0x4a78d7,_0x46a442,_0x5f1a8e){var _0x5c9c40,_0x290388;return db['VoiceQueue']['find']({'where':{'id':_0x4a78d7[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x46a442,null))[_0x4b6f('0x29')](function(_0x5ac457){if(_0x5ac457){_0x290388=_0x5ac457;return _0x5ac457[_0x4b6f('0x92')](_0x4a78d7[_0x4b6f('0x56')]['ids'],_[_0x4b6f('0x60')](_0x4a78d7['body'],[_0x4b6f('0x80'),'id'])||{})[_0x4b6f('0x93')](function(_0x474038){for(var _0x3f8c8e=0x0;_0x3f8c8e<_0x4a78d7[_0x4b6f('0x56')][_0x4b6f('0x80')][_0x4b6f('0x42')];_0x3f8c8e+=0x1){socket[_0x4b6f('0x94')](_0x4b6f('0x7e'),{'UserId':Number(_0x4a78d7[_0x4b6f('0x56')][_0x4b6f('0x80')][_0x3f8c8e]),'VoiceQueueId':Number(_0x4a78d7['params']['id'])});}return _0x474038;});}})['then'](function(_0x2752f6){_0x5c9c40=_0x2752f6||[];if(_0x290388){return db[_0x4b6f('0x6e')][_0x4b6f('0x4e')]({'where':{'id':_0x4a78d7[_0x4b6f('0x56')][_0x4b6f('0x80')]},'attributes':['id',_0x4b6f('0x31'),_0x4b6f('0x70'),_0x4b6f('0x71'),'interface'],'raw':!![]});}})[_0x4b6f('0x29')](function(_0x3640a4){if(!_[_0x4b6f('0x8f')](_0x3640a4)){var _0x376f20=[];for(var _0x36af1a=0x0;_0x36af1a<_0x3640a4['length'];_0x36af1a++){if(_0x3640a4[_0x36af1a]['online']){_0x376f20[_0x4b6f('0x88')](db['UserVoiceQueueRt'][_0x4b6f('0x7a')]({'membername':_0x3640a4[_0x36af1a]['name'],'UserId':_0x3640a4[_0x36af1a]['id'],'queue_name':_0x290388[_0x4b6f('0x31')],'VoiceQueueId':_0x290388['id'],'interface':_[_0x4b6f('0x7c')](_0x3640a4[_0x36af1a][_0x4b6f('0x72')])?util[_0x4b6f('0x7d')]('SIP/%s',_0x3640a4[_0x36af1a][_0x4b6f('0x31')]):_0x3640a4[_0x36af1a][_0x4b6f('0x72')],'paused':_0x3640a4[_0x36af1a][_0x4b6f('0x71')]||![],'penalty':_0x4a78d7[_0x4b6f('0x56')]['penalty']||0x0}));}}return BPromise[_0x4b6f('0x8d')](_0x376f20);}})[_0x4b6f('0x29')](function(){return _0x5c9c40;})['then'](respondWithResult(_0x46a442,null))[_0x4b6f('0x50')](handleError(_0x46a442,null));};exports[_0x4b6f('0x90')]=function(_0x1469d4,_0x5954d1,_0x5cb29d){return db[_0x4b6f('0x4c')]['find']({'where':{'id':_0x1469d4[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x5954d1,null))[_0x4b6f('0x29')](function(_0x1d80bb){if(_0x1d80bb){return _0x1d80bb[_0x4b6f('0x90')](_0x1469d4[_0x4b6f('0x3d')][_0x4b6f('0x80')])[_0x4b6f('0x29')](function(){if(_[_0x4b6f('0x95')](_0x1469d4[_0x4b6f('0x3d')]['ids'])){for(var _0x27ea15=0x0;_0x27ea15<_0x1469d4['query'][_0x4b6f('0x80')][_0x4b6f('0x42')];_0x27ea15+=0x1){socket[_0x4b6f('0x94')](_0x4b6f('0x96'),{'UserId':Number(_0x1469d4[_0x4b6f('0x3d')][_0x4b6f('0x80')][_0x27ea15]),'VoiceQueueId':Number(_0x1469d4[_0x4b6f('0x51')]['id'])});}}else{socket[_0x4b6f('0x94')](_0x4b6f('0x96'),{'UserId':Number(_0x1469d4[_0x4b6f('0x3d')][_0x4b6f('0x80')]),'VoiceQueueId':Number(_0x1469d4[_0x4b6f('0x51')]['id'])});}});}})[_0x4b6f('0x29')](function(_0x59989e){return db[_0x4b6f('0x91')][_0x4b6f('0x2a')]({'where':{'VoiceQueueId':_0x1469d4[_0x4b6f('0x51')]['id'],'UserId':_0x1469d4['query'][_0x4b6f('0x80')]}})[_0x4b6f('0x29')](function(){return _0x59989e;});})[_0x4b6f('0x29')](respondWithStatusCode(_0x5954d1,null))[_0x4b6f('0x50')](handleError(_0x5954d1,null));};exports[_0x4b6f('0x97')]=function(_0x5f170f,_0x426251,_0x207c34){var _0x1a5b6c={};var _0x358662={};var _0x443152;var _0xec6471;return db['VoiceQueue']['findOne']({'where':{'id':_0x5f170f['params']['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x426251,null))[_0x4b6f('0x29')](function(_0x42cbdc){if(_0x42cbdc){_0x443152=_0x42cbdc;_0x358662[_0x4b6f('0x3b')]=_[_0x4b6f('0x3c')](db[_0x4b6f('0x6e')][_0x4b6f('0x38')]);_0x358662['query']=_[_0x4b6f('0x3c')](_0x5f170f[_0x4b6f('0x3d')]);_0x358662[_0x4b6f('0x3e')]=_[_0x4b6f('0x3f')](_0x358662[_0x4b6f('0x3b')],_0x358662[_0x4b6f('0x3d')]);_0x1a5b6c[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x358662['model'],qs[_0x4b6f('0x41')](_0x5f170f['query'][_0x4b6f('0x41')]));_0x1a5b6c[_0x4b6f('0x40')]=_0x1a5b6c[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x1a5b6c[_0x4b6f('0x40')]:_0x358662[_0x4b6f('0x3b')];_0x1a5b6c[_0x4b6f('0x45')]=qs['sort'](_0x5f170f[_0x4b6f('0x3d')][_0x4b6f('0x46')]);_0x1a5b6c['where']=qs[_0x4b6f('0x3e')](_[_0x4b6f('0x47')](_0x5f170f[_0x4b6f('0x3d')],_0x358662[_0x4b6f('0x3e')]));if(_0x5f170f['query'][_0x4b6f('0x48')]){_0x1a5b6c[_0x4b6f('0x49')]=_[_0x4b6f('0x53')](_0x1a5b6c[_0x4b6f('0x49')],{'$or':_[_0x4b6f('0x37')](_0x1a5b6c[_0x4b6f('0x40')],function(_0x4d046c){var _0x6a992f={};_0x6a992f[_0x4d046c]={'$like':'%'+_0x5f170f[_0x4b6f('0x3d')][_0x4b6f('0x48')]+'%'};return _0x6a992f;})});}_0x1a5b6c=_[_0x4b6f('0x53')]({},_0x1a5b6c,_0x5f170f['options']);return _0x443152[_0x4b6f('0x97')](_0x1a5b6c);}})['then'](function(_0x13e2ed){if(_0x13e2ed){_0xec6471=_0x13e2ed[_0x4b6f('0x42')];if(!_0x5f170f['query'][_0x4b6f('0x43')](_0x4b6f('0x44'))){_0x1a5b6c[_0x4b6f('0x21')]=qs[_0x4b6f('0x21')](_0x5f170f[_0x4b6f('0x3d')][_0x4b6f('0x21')]);_0x1a5b6c['offset']=qs[_0x4b6f('0x1f')](_0x5f170f['query'][_0x4b6f('0x1f')]);}return _0x443152[_0x4b6f('0x97')](_0x1a5b6c);}})[_0x4b6f('0x29')](function(_0x40677f){if(_0x40677f){return _0x40677f?{'count':_0xec6471,'rows':_0x40677f}:null;}})[_0x4b6f('0x29')](respondWithResult(_0x426251,null))['catch'](handleError(_0x426251,null));};exports['getMembers']=function(_0x34b6f5,_0x40edce,_0x10ac22){var _0x1991d6={};var _0x5c1f3c={};var _0x3918c4;var _0x4d2304;return db[_0x4b6f('0x4c')]['findOne']({'where':{'id':_0x34b6f5[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x40edce,null))[_0x4b6f('0x29')](function(_0x1bbd93){if(_0x1bbd93){_0x3918c4=_0x1bbd93;_0x5c1f3c[_0x4b6f('0x3b')]=_[_0x4b6f('0x3c')](db['UserVoiceQueueRt'][_0x4b6f('0x38')]);_0x5c1f3c[_0x4b6f('0x3d')]=_[_0x4b6f('0x3c')](_0x34b6f5[_0x4b6f('0x3d')]);_0x5c1f3c[_0x4b6f('0x3e')]=_['intersection'](_0x5c1f3c[_0x4b6f('0x3b')],_0x5c1f3c[_0x4b6f('0x3d')]);_0x1991d6[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x5c1f3c[_0x4b6f('0x3b')],qs['fields'](_0x34b6f5[_0x4b6f('0x3d')][_0x4b6f('0x41')]));_0x1991d6['attributes']=_0x1991d6['attributes'][_0x4b6f('0x42')]?_0x1991d6['attributes']:_0x5c1f3c['model'];_0x1991d6['order']=qs[_0x4b6f('0x46')](_0x34b6f5[_0x4b6f('0x3d')][_0x4b6f('0x46')]);_0x1991d6[_0x4b6f('0x49')]=qs[_0x4b6f('0x3e')](_[_0x4b6f('0x47')](_0x34b6f5[_0x4b6f('0x3d')],_0x5c1f3c[_0x4b6f('0x3e')]));if(_0x34b6f5[_0x4b6f('0x3d')]['filter']){_0x1991d6[_0x4b6f('0x49')]=_[_0x4b6f('0x53')](_0x1991d6['where'],{'$or':_[_0x4b6f('0x37')](_0x1991d6[_0x4b6f('0x40')],function(_0xe4f515){var _0x321a78={};_0x321a78[_0xe4f515]={'$like':'%'+_0x34b6f5['query']['filter']+'%'};return _0x321a78;})});}_0x1991d6=_[_0x4b6f('0x53')]({},_0x1991d6,_0x34b6f5[_0x4b6f('0x4b')]);return _0x3918c4[_0x4b6f('0x98')](_0x1991d6);}})['then'](function(_0x26f425){if(_0x26f425){_0x4d2304=_0x26f425[_0x4b6f('0x42')];if(!_0x34b6f5['query'][_0x4b6f('0x43')](_0x4b6f('0x44'))){_0x1991d6[_0x4b6f('0x21')]=qs[_0x4b6f('0x21')](_0x34b6f5[_0x4b6f('0x3d')][_0x4b6f('0x21')]);_0x1991d6[_0x4b6f('0x1f')]=qs[_0x4b6f('0x1f')](_0x34b6f5[_0x4b6f('0x3d')][_0x4b6f('0x1f')]);}return _0x3918c4[_0x4b6f('0x98')](_0x1991d6);}})['then'](function(_0x1ae084){return _0x1ae084?{'count':_0x4d2304,'rows':_0x1ae084}:null;})['then'](respondWithResult(_0x40edce,null))[_0x4b6f('0x50')](handleError(_0x40edce,null));};exports[_0x4b6f('0x99')]=function(_0x26c1a4,_0x63b5ea,_0x172928){var _0xd86dd7={};var _0x3fd1e4={};var _0x2260da;var _0x4a35a3;return db[_0x4b6f('0x4c')]['findOne']({'where':{'id':_0x26c1a4[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x63b5ea,null))['then'](function(_0x20ddd5){if(_0x20ddd5){_0x2260da=_0x20ddd5;_0x3fd1e4[_0x4b6f('0x3b')]=_[_0x4b6f('0x3c')](db['CmList'][_0x4b6f('0x38')]);_0x3fd1e4[_0x4b6f('0x3d')]=_[_0x4b6f('0x3c')](_0x26c1a4[_0x4b6f('0x3d')]);_0x3fd1e4[_0x4b6f('0x3e')]=_[_0x4b6f('0x3f')](_0x3fd1e4[_0x4b6f('0x3b')],_0x3fd1e4['query']);_0xd86dd7['attributes']=_['intersection'](_0x3fd1e4[_0x4b6f('0x3b')],qs[_0x4b6f('0x41')](_0x26c1a4[_0x4b6f('0x3d')]['fields']));_0xd86dd7[_0x4b6f('0x40')]=_0xd86dd7[_0x4b6f('0x40')]['length']?_0xd86dd7[_0x4b6f('0x40')]:_0x3fd1e4['model'];_0xd86dd7['order']=qs[_0x4b6f('0x46')](_0x26c1a4[_0x4b6f('0x3d')]['sort']);_0xd86dd7[_0x4b6f('0x49')]=qs[_0x4b6f('0x3e')](_['pick'](_0x26c1a4[_0x4b6f('0x3d')],_0x3fd1e4[_0x4b6f('0x3e')]));if(_0x26c1a4['query']['filter']){_0xd86dd7[_0x4b6f('0x49')]=_['merge'](_0xd86dd7[_0x4b6f('0x49')],{'$or':_[_0x4b6f('0x37')](_0xd86dd7[_0x4b6f('0x40')],function(_0x380b8f){var _0x369bd2={};_0x369bd2[_0x380b8f]={'$like':'%'+_0x26c1a4[_0x4b6f('0x3d')]['filter']+'%'};return _0x369bd2;})});}_0xd86dd7=_[_0x4b6f('0x53')]({},_0xd86dd7,_0x26c1a4['options']);return _0x2260da['getLists'](_0xd86dd7);}})[_0x4b6f('0x29')](function(_0x271bf5){if(_0x271bf5){_0x4a35a3=_0x271bf5[_0x4b6f('0x42')];if(!_0x26c1a4['query'][_0x4b6f('0x43')]('nolimit')){_0xd86dd7[_0x4b6f('0x21')]=qs['limit'](_0x26c1a4['query'][_0x4b6f('0x21')]);_0xd86dd7['offset']=qs['offset'](_0x26c1a4[_0x4b6f('0x3d')][_0x4b6f('0x1f')]);}return _0x2260da['getLists'](_0xd86dd7);}})[_0x4b6f('0x29')](function(_0x5afbc9){if(_0x5afbc9){return _0x5afbc9?{'count':_0x4a35a3,'rows':_0x5afbc9}:null;}})[_0x4b6f('0x29')](respondWithResult(_0x63b5ea,null))[_0x4b6f('0x50')](handleError(_0x63b5ea,null));};exports[_0x4b6f('0x9a')]=function(_0x5c46ef,_0x45699d,_0x1daa5e){var _0x1a30cd,_0x2e3817;return db[_0x4b6f('0x4c')]['find']({'where':{'id':_0x5c46ef[_0x4b6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x45699d,null))['then'](function(_0x275af9){if(_0x275af9){_0x2e3817=_0x275af9;return _0x275af9['addLists'](_0x5c46ef[_0x4b6f('0x56')][_0x4b6f('0x80')],_[_0x4b6f('0x60')](_0x5c46ef[_0x4b6f('0x56')],[_0x4b6f('0x80'),'id'])||{});}return null;})[_0x4b6f('0x93')](function(_0x47230a){var _0x6e6475;_0x1a30cd=_0x47230a||[];var _0xa15e66=[];if(_0x47230a){for(var _0x4453d1=0x0;_0x4453d1<_0x47230a[_0x4b6f('0x42')];_0x4453d1+=0x1){var _0x4076c7=_0x47230a[_0x4453d1][_0x4b6f('0x58')]({'plain':!![]});_0x2e3817[_0x4b6f('0x9b')]=_0x5c46ef[_0x4b6f('0x56')]['dialCheckDuplicateType']?_0x5c46ef[_0x4b6f('0x56')][_0x4b6f('0x9b')]:_0x2e3817['dialCheckDuplicateType'];switch(_0x2e3817[_0x4b6f('0x9b')]){case'always':_0x6e6475=squel[_0x4b6f('0x9c')]()[_0x4b6f('0x9d')](_0x4b6f('0x9e'))[_0x4b6f('0x9f')]([_0x4b6f('0xa0'),_0x4b6f('0xa1'),_0x4b6f('0xa2'),'ListId',_0x4b6f('0x65'),_0x4b6f('0xa3'),'updatedAt'],squel[_0x4b6f('0x81')]()['field'](_0x4b6f('0xa0'),_0x4b6f('0xa0'))['field'](_0x4b6f('0xa4'),_0x4b6f('0xa1'))[_0x4b6f('0xa5')]('id','ContactId')[_0x4b6f('0xa5')](_0x4076c7[_0x4b6f('0xa6')][_0x4b6f('0x89')](),_0x4b6f('0xa7'))[_0x4b6f('0xa5')](_0x5c46ef[_0x4b6f('0x51')]['id']['toString'](),_0x4b6f('0x65'))['field']('NOW()',_0x4b6f('0xa3'))[_0x4b6f('0xa5')](_0x4b6f('0xa4'),'updatedAt')[_0x4b6f('0x82')](_0x4b6f('0xa8'))[_0x4b6f('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0x4b6f('0xa9'),_0x4076c7[_0x4b6f('0xa6')][_0x4b6f('0x89')]())[_0x4b6f('0x49')](_0x4b6f('0xaa'))[_0x4b6f('0x49')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x4b6f('0xa5')](_0x4b6f('0xab'))[_0x4b6f('0x82')](_0x4b6f('0xac'))['where'](_0x4b6f('0x86'),_0x5c46ef[_0x4b6f('0x51')]['id'][_0x4b6f('0x89')]()))[_0x4b6f('0x49')](_0x4b6f('0xad'),squel[_0x4b6f('0x81')]()[_0x4b6f('0xa5')](_0x4b6f('0xae'))[_0x4b6f('0x82')](_0x4b6f('0x9e'))[_0x4b6f('0x49')](_0x4b6f('0x86'),_0x5c46ef[_0x4b6f('0x51')]['id'][_0x4b6f('0x89')]())))[_0x4b6f('0x89')]();break;case'onlyIfOpen':_0x6e6475=squel['insert']()[_0x4b6f('0x9d')](_0x4b6f('0x9e'))[_0x4b6f('0x9f')]([_0x4b6f('0xa0'),_0x4b6f('0xa1'),'ContactId',_0x4b6f('0xa7'),_0x4b6f('0x65'),_0x4b6f('0xa3'),_0x4b6f('0x61')],squel[_0x4b6f('0x81')]()['field'](_0x4b6f('0xa0'),_0x4b6f('0xa0'))[_0x4b6f('0xa5')](_0x4b6f('0xa4'),_0x4b6f('0xa1'))[_0x4b6f('0xa5')]('id',_0x4b6f('0xa2'))[_0x4b6f('0xa5')](_0x4076c7[_0x4b6f('0xa6')][_0x4b6f('0x89')](),_0x4b6f('0xa7'))['field'](_0x5c46ef[_0x4b6f('0x51')]['id'][_0x4b6f('0x89')](),'VoiceQueueId')['field'](_0x4b6f('0xa4'),_0x4b6f('0xa3'))['field'](_0x4b6f('0xa4'),_0x4b6f('0x61'))['from']('cm_contacts')[_0x4b6f('0x49')](_0x4b6f('0xaf'))['where'](_0x4b6f('0xa9'),_0x4076c7[_0x4b6f('0xa6')][_0x4b6f('0x89')]())[_0x4b6f('0x49')](_0x4b6f('0xaa'))[_0x4b6f('0x49')](_0x4b6f('0xad'),squel[_0x4b6f('0x81')]()['field']('COALESCE(phone,\x27\x27)')[_0x4b6f('0x82')](_0x4b6f('0x9e'))[_0x4b6f('0x49')]('VoiceQueueId\x20=\x20?',_0x5c46ef['params']['id'][_0x4b6f('0x89')]())))['toString']();break;default:_0x6e6475=squel[_0x4b6f('0x9c')]()['into'](_0x4b6f('0x9e'))[_0x4b6f('0x9f')]([_0x4b6f('0xa0'),_0x4b6f('0xa1'),'ContactId',_0x4b6f('0xa7'),_0x4b6f('0x65'),'createdAt',_0x4b6f('0x61')],squel[_0x4b6f('0x81')]()['field']('phone',_0x4b6f('0xa0'))[_0x4b6f('0xa5')](_0x4b6f('0xa4'),_0x4b6f('0xa1'))['field']('id',_0x4b6f('0xa2'))['field'](_0x4076c7[_0x4b6f('0xa6')]['toString'](),_0x4b6f('0xa7'))[_0x4b6f('0xa5')](_0x5c46ef[_0x4b6f('0x51')]['id'][_0x4b6f('0x89')](),_0x4b6f('0x65'))[_0x4b6f('0xa5')](_0x4b6f('0xa4'),'createdAt')[_0x4b6f('0xa5')]('NOW()',_0x4b6f('0x61'))[_0x4b6f('0x82')](_0x4b6f('0xa8'))[_0x4b6f('0x49')]('deletedAt\x20IS\x20NULL')[_0x4b6f('0x49')]('ListId\x20=\x20?',_0x4076c7[_0x4b6f('0xa6')]['toString']())[_0x4b6f('0x49')](_0x4b6f('0xaa')))[_0x4b6f('0x89')]();}_0xa15e66[_0x4b6f('0x88')](db[_0x4b6f('0x76')][_0x4b6f('0x3d')](_0x6e6475));}return BPromise['all'](_0xa15e66);}})['then'](function(){return _0x1a30cd;})[_0x4b6f('0x29')](respondWithResult(_0x45699d,null))[_0x4b6f('0x50')](handleError(_0x45699d,null));};exports['removeLists']=function(_0x4b2edd,_0x177a62,_0xcd58d1){return db[_0x4b6f('0x4c')][_0x4b6f('0x54')]({'where':{'id':_0x4b2edd['params']['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x177a62,null))[_0x4b6f('0x29')](function(_0x292ee0){if(_0x292ee0){return _0x292ee0[_0x4b6f('0xb0')](_0x4b2edd[_0x4b6f('0x3d')][_0x4b6f('0x80')]);}})['then'](function(_0x5c5648){if(_0x5c5648){return db['CmHopper'][_0x4b6f('0x2a')]({'where':{'ListId':_0x4b2edd[_0x4b6f('0x3d')][_0x4b6f('0x80')],'VoiceQueueId':_0x4b2edd['params']['id']}})[_0x4b6f('0x29')](function(){return _0x5c5648;});}})['then'](respondWithStatusCode(_0x177a62,null))[_0x4b6f('0x50')](handleError(_0x177a62,null));};exports[_0x4b6f('0xb1')]=function(_0x3989fb,_0x4d5659,_0x16da06){var _0x52c0cd={};var _0x47b688={};var _0x2810d8;var _0x1219e9;return db['VoiceQueue'][_0x4b6f('0x64')]({'where':{'id':_0x3989fb[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x4d5659,null))[_0x4b6f('0x29')](function(_0x1f915f){if(_0x1f915f){_0x2810d8=_0x1f915f;_0x47b688[_0x4b6f('0x3b')]=_[_0x4b6f('0x3c')](db[_0x4b6f('0xb2')]['rawAttributes']);_0x47b688[_0x4b6f('0x3d')]=_['keys'](_0x3989fb['query']);_0x47b688['filters']=_['intersection'](_0x47b688[_0x4b6f('0x3b')],_0x47b688[_0x4b6f('0x3d')]);_0x52c0cd[_0x4b6f('0x40')]=_[_0x4b6f('0x3f')](_0x47b688[_0x4b6f('0x3b')],qs[_0x4b6f('0x41')](_0x3989fb[_0x4b6f('0x3d')][_0x4b6f('0x41')]));_0x52c0cd[_0x4b6f('0x40')]=_0x52c0cd[_0x4b6f('0x40')][_0x4b6f('0x42')]?_0x52c0cd[_0x4b6f('0x40')]:_0x47b688['model'];_0x52c0cd[_0x4b6f('0x45')]=qs[_0x4b6f('0x46')](_0x3989fb[_0x4b6f('0x3d')][_0x4b6f('0x46')]);_0x52c0cd[_0x4b6f('0x49')]=qs[_0x4b6f('0x3e')](_[_0x4b6f('0x47')](_0x3989fb[_0x4b6f('0x3d')],_0x47b688[_0x4b6f('0x3e')]));if(_0x3989fb[_0x4b6f('0x3d')]['filter']){_0x52c0cd[_0x4b6f('0x49')]=_[_0x4b6f('0x53')](_0x52c0cd[_0x4b6f('0x49')],{'$or':_[_0x4b6f('0x37')](_0x52c0cd[_0x4b6f('0x40')],function(_0x1740e3){var _0x4a5796={};_0x4a5796[_0x1740e3]={'$like':'%'+_0x3989fb[_0x4b6f('0x3d')][_0x4b6f('0x48')]+'%'};return _0x4a5796;})});}_0x52c0cd=_[_0x4b6f('0x53')]({},_0x52c0cd,_0x3989fb['options']);return _0x2810d8['getBlackLists'](_0x52c0cd);}})['then'](function(_0x447fea){if(_0x447fea){_0x1219e9=_0x447fea[_0x4b6f('0x42')];if(!_0x3989fb['query']['hasOwnProperty'](_0x4b6f('0x44'))){_0x52c0cd['limit']=qs[_0x4b6f('0x21')](_0x3989fb[_0x4b6f('0x3d')]['limit']);_0x52c0cd[_0x4b6f('0x1f')]=qs['offset'](_0x3989fb[_0x4b6f('0x3d')][_0x4b6f('0x1f')]);}return _0x2810d8['getBlackLists'](_0x52c0cd);}})['then'](function(_0x3cf964){if(_0x3cf964){return _0x3cf964?{'count':_0x1219e9,'rows':_0x3cf964}:null;}})[_0x4b6f('0x29')](respondWithResult(_0x4d5659,null))[_0x4b6f('0x50')](handleError(_0x4d5659,null));};exports[_0x4b6f('0xb3')]=function(_0x58e019,_0x591f6f,_0x30ca55){var _0x10a756,_0x24c9dc;return db['VoiceQueue'][_0x4b6f('0x54')]({'where':{'id':_0x58e019['params']['id']}})[_0x4b6f('0x29')](handleEntityNotFound(_0x591f6f,null))[_0x4b6f('0x29')](function(_0x4256f1){if(_0x4256f1){_0x24c9dc=_0x4256f1;return _0x4256f1['addBlackLists'](_0x58e019[_0x4b6f('0x56')][_0x4b6f('0x80')],_['omit'](_0x58e019['body'],[_0x4b6f('0x80'),'id'])||{});}return null;})[_0x4b6f('0x93')](function(_0x44b925){var _0x1eb7d0;_0x10a756=_0x44b925||[];var _0x5a0e31=[];if(_0x44b925){for(var _0x35b98e=0x0;_0x35b98e<_0x44b925[_0x4b6f('0x42')];_0x35b98e+=0x1){var _0x57ec83=_0x44b925[_0x35b98e]['get']({'plain':!![]});_0x1eb7d0=squel[_0x4b6f('0x9c')]()[_0x4b6f('0x9d')]('cm_hopper_black')[_0x4b6f('0x9f')]([_0x4b6f('0xa0'),'ContactId',_0x4b6f('0xa7'),_0x4b6f('0x65'),_0x4b6f('0xa3'),_0x4b6f('0x61')],squel[_0x4b6f('0x81')]()['field'](_0x4b6f('0xa0'),'phone')['field']('id','ContactId')['field'](_0x57ec83[_0x4b6f('0xa6')][_0x4b6f('0x89')](),_0x4b6f('0xa7'))['field'](_0x58e019[_0x4b6f('0x51')]['id'][_0x4b6f('0x89')](),_0x4b6f('0x65'))['field'](_0x4b6f('0xa4'),'createdAt')[_0x4b6f('0xa5')](_0x4b6f('0xa4'),'updatedAt')[_0x4b6f('0x82')](_0x4b6f('0xa8'))['where'](_0x4b6f('0xaf'))[_0x4b6f('0x49')](_0x4b6f('0xa9'),_0x57ec83['CmListId']['toString']())[_0x4b6f('0x49')](_0x4b6f('0xaa')))['toString']();_0x5a0e31[_0x4b6f('0x88')](db[_0x4b6f('0x76')][_0x4b6f('0x3d')](_0x1eb7d0));}return BPromise['all'](_0x5a0e31);}})['then'](function(){return _0x10a756;})[_0x4b6f('0x29')](respondWithResult(_0x591f6f,null))['catch'](handleError(_0x591f6f,null));};exports[_0x4b6f('0xb4')]=function(_0x1ba9da,_0x279826,_0x382ad0){return db['VoiceQueue'][_0x4b6f('0x54')]({'where':{'id':_0x1ba9da[_0x4b6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x279826,null))['then'](function(_0x23355f){if(_0x23355f){return _0x23355f[_0x4b6f('0xb4')](_0x1ba9da[_0x4b6f('0x3d')][_0x4b6f('0x80')]);}})[_0x4b6f('0x29')](function(_0x540e25){if(_0x540e25){return db[_0x4b6f('0x6a')][_0x4b6f('0x2a')]({'where':{'ListId':_0x1ba9da[_0x4b6f('0x3d')]['ids'],'VoiceQueueId':_0x1ba9da[_0x4b6f('0x51')]['id']}})[_0x4b6f('0x29')](function(){return _0x540e25;});}})[_0x4b6f('0x29')](respondWithStatusCode(_0x279826,null))[_0x4b6f('0x50')](handleError(_0x279826,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ad42236..c28cb8c 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 _0xbe29=['events','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0xbb4325,_0x293598){var _0xf7423a=function(_0xbbd86f){while(--_0xbbd86f){_0xbb4325['push'](_0xbb4325['shift']());}};_0xf7423a(++_0x293598);}(_0xbe29,0xd8));var _0x9be2=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0xbe29[_0x1aba25];return _0x47d997;};'use strict';var EventEmitter=require(_0x9be2('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9be2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2867df){return function(_0x273636,_0x140839,_0x49f45c){VoiceQueueEvents[_0x9be2('0x2')](_0x2867df+':'+_0x273636['id'],_0x273636);VoiceQueueEvents[_0x9be2('0x2')](_0x2867df,_0x273636);_0x49f45c(null);};}for(var e in events){if(events[_0x9be2('0x3')](e)){var event=events[e];VoiceQueue[_0x9be2('0x4')](e,emitEvent(event));}}module[_0x9be2('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0x6512=['exports','VoiceQueue','save','update','emit','hasOwnProperty','hook'];(function(_0x13ed4c,_0x2cc896){var _0x37cf55=function(_0x442db3){while(--_0x442db3){_0x13ed4c['push'](_0x13ed4c['shift']());}};_0x37cf55(++_0x2cc896);}(_0x6512,0x19e));var _0x2651=function(_0x1c20ff,_0xa7b48f){_0x1c20ff=_0x1c20ff-0x0;var _0x340ace=_0x6512[_0x1c20ff];return _0x340ace;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x2651('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2651('0x1'),'afterUpdate':_0x2651('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1657e4){return function(_0x517856,_0x2f1882,_0x3fe813){VoiceQueueEvents[_0x2651('0x3')](_0x1657e4+':'+_0x517856['id'],_0x517856);VoiceQueueEvents[_0x2651('0x3')](_0x1657e4,_0x517856);_0x3fe813(null);};}for(var e in events){if(events[_0x2651('0x4')](e)){var event=events[e];VoiceQueue[_0x2651('0x5')](e,emitEvent(event));}}module[_0x2651('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 1fdcd68..a632715 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x5356ec,_0x56d4eb){var _0x47f783=function(_0xf300c9){while(--_0xf300c9){_0x5356ec['push'](_0x5356ec['shift']());}};_0x47f783(++_0x56d4eb);}(_0x34e8,0x12c));var _0x834e=function(_0x4a6eff,_0x9dbd61){_0x4a6eff=_0x4a6eff-0x0;var _0x48fea1=_0x34e8[_0x4a6eff];return _0x48fea1;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1d0fe1,_0x452dbb){var _0x228558=function(_0x356baf){while(--_0x356baf){_0x1d0fe1['push'](_0x1d0fe1['shift']());}};_0x228558(++_0x452dbb);}(_0x70e0,0x17b));var _0x070e=function(_0x1562d7,_0x5043ff){_0x1562d7=_0x1562d7-0x0;var _0x3ff344=_0x70e0[_0x1562d7];return _0x3ff344;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 00a8994..ca85eda 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 _0xb581=['register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowVoiceQueue','VoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x3c99ef,_0x50b107){var _0x17550c=function(_0x4ff16b){while(--_0x4ff16b){_0x3c99ef['push'](_0x3c99ef['shift']());}};_0x17550c(++_0x50b107);}(_0xb581,0x67));var _0x1b58=function(_0x3cf120,_0x5eb2eb){_0x3cf120=_0x3cf120-0x0;var _0x4b99d8=_0xb581[_0x3cf120];return _0x4b99d8;};'use strict';var _=require(_0x1b58('0x0'));var util=require(_0x1b58('0x1'));var moment=require('moment');var BPromise=require(_0x1b58('0x2'));var rs=require(_0x1b58('0x3'));var fs=require('fs');var Redis=require(_0x1b58('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b58('0x5'))('rpc');var config=require(_0x1b58('0x6'));var jayson=require(_0x1b58('0x7'));var client=jayson[_0x1b58('0x8')]['http']({'port':0x232a});config[_0x1b58('0x9')]=_[_0x1b58('0xa')](config[_0x1b58('0x9')],{'host':_0x1b58('0xb'),'port':0x18eb});var socket=require(_0x1b58('0xc'))(new Redis(config[_0x1b58('0x9')]));require(_0x1b58('0xd'))[_0x1b58('0xe')](socket);function respondWithRpcPromise(_0x133691,_0x1a4914,_0x2c0196){return new BPromise(function(_0x18d104,_0x3b6c23){return client[_0x1b58('0xf')](_0x133691,_0x2c0196)['then'](function(_0x2cd33e){logger[_0x1b58('0x10')](_0x1b58('0x11'),_0x1a4914,_0x1b58('0x12'));logger[_0x1b58('0x13')](_0x1b58('0x14'),_0x1a4914,_0x1b58('0x12'),JSON[_0x1b58('0x15')](_0x2cd33e));if(_0x2cd33e[_0x1b58('0x16')]){if(_0x2cd33e['error'][_0x1b58('0x17')]===0x1f4){logger[_0x1b58('0x16')](_0x1b58('0x11'),_0x1a4914,_0x2cd33e[_0x1b58('0x16')][_0x1b58('0x18')]);return _0x3b6c23(_0x2cd33e['error'][_0x1b58('0x18')]);}logger[_0x1b58('0x16')](_0x1b58('0x11'),_0x1a4914,_0x2cd33e[_0x1b58('0x16')][_0x1b58('0x18')]);return _0x18d104(_0x2cd33e[_0x1b58('0x16')][_0x1b58('0x18')]);}else{logger[_0x1b58('0x10')](_0x1b58('0x11'),_0x1a4914,'request\x20sent');_0x18d104(_0x2cd33e['result'][_0x1b58('0x18')]);}})[_0x1b58('0x19')](function(_0xb73e0e){logger[_0x1b58('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x1a4914,_0xb73e0e);_0x3b6c23(_0xb73e0e);});});}exports[_0x1b58('0x1a')]=function(_0x395ead){var _0x55716d=this;return new Promise(function(_0x259092,_0x2cb71f){return db['VoiceQueue'][_0x1b58('0x1b')]({'raw':_0x395ead[_0x1b58('0x1c')]?_0x395ead[_0x1b58('0x1c')][_0x1b58('0x1d')]===undefined?!![]:![]:!![],'where':_0x395ead[_0x1b58('0x1c')]?_0x395ead['options'][_0x1b58('0x1e')]||null:null,'attributes':_0x395ead[_0x1b58('0x1c')]?_0x395ead[_0x1b58('0x1c')][_0x1b58('0x1f')]||null:null,'limit':_0x395ead[_0x1b58('0x1c')]?_0x395ead['options'][_0x1b58('0x20')]||null:null,'include':_0x395ead['options']?_0x395ead[_0x1b58('0x1c')]['include']?_['map'](_0x395ead['options'][_0x1b58('0x21')],function(_0x1035b5){return{'model':db[_0x1035b5[_0x1b58('0x22')]],'as':_0x1035b5['as'],'attributes':_0x1035b5[_0x1b58('0x1f')],'include':_0x1035b5['include']?_[_0x1b58('0x23')](_0x1035b5['include'],function(_0x439b04){return{'model':db[_0x439b04[_0x1b58('0x22')]],'as':_0x439b04['as'],'attributes':_0x439b04['attributes'],'include':_0x439b04[_0x1b58('0x21')]?_['map'](_0x439b04[_0x1b58('0x21')],function(_0x150ccd){return{'model':db[_0x150ccd[_0x1b58('0x22')]],'as':_0x150ccd['as'],'attributes':_0x150ccd[_0x1b58('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1b58('0x24')](function(_0x2e25ab){logger[_0x1b58('0x10')](_0x1b58('0x1a'),_0x395ead);logger[_0x1b58('0x13')](_0x1b58('0x1a'),_0x395ead,JSON[_0x1b58('0x15')](_0x2e25ab));_0x259092(_0x2e25ab);})[_0x1b58('0x19')](function(_0x3fff92){logger[_0x1b58('0x16')]('GetVoiceQueue',_0x3fff92[_0x1b58('0x18')],_0x395ead);_0x2cb71f(_0x55716d[_0x1b58('0x16')](0x1f4,_0x3fff92[_0x1b58('0x18')]));});});};exports[_0x1b58('0x25')]=function(_0x26a048){var _0x138dd1=this;return new Promise(function(_0xc52381,_0x4a9be7){return db[_0x1b58('0x26')]['find']({'raw':_0x26a048['options']?_0x26a048[_0x1b58('0x1c')][_0x1b58('0x1d')]===undefined?!![]:![]:!![],'where':_0x26a048[_0x1b58('0x1c')]?_0x26a048['options']['where']||null:null,'attributes':_0x26a048[_0x1b58('0x1c')]?_0x26a048[_0x1b58('0x1c')][_0x1b58('0x1f')]||null:null,'include':_0x26a048[_0x1b58('0x1c')]?_0x26a048['options'][_0x1b58('0x21')]?_[_0x1b58('0x23')](_0x26a048[_0x1b58('0x1c')][_0x1b58('0x21')],function(_0x4824d7){return{'model':db[_0x4824d7[_0x1b58('0x22')]],'as':_0x4824d7['as'],'attributes':_0x4824d7[_0x1b58('0x1f')],'include':_0x4824d7[_0x1b58('0x21')]?_[_0x1b58('0x23')](_0x4824d7['include'],function(_0x224a81){return{'model':db[_0x224a81[_0x1b58('0x22')]],'as':_0x224a81['as'],'attributes':_0x224a81[_0x1b58('0x1f')],'include':_0x224a81['include']?_[_0x1b58('0x23')](_0x224a81['include'],function(_0x213c0d){return{'model':db[_0x213c0d[_0x1b58('0x22')]],'as':_0x213c0d['as'],'attributes':_0x213c0d['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b58('0x24')](function(_0x3db955){logger[_0x1b58('0x10')](_0x1b58('0x25'),_0x26a048);logger[_0x1b58('0x13')]('ShowVoiceQueue',_0x26a048,JSON[_0x1b58('0x15')](_0x3db955));_0xc52381(_0x3db955);})[_0x1b58('0x19')](function(_0x5f31f5){logger[_0x1b58('0x16')](_0x1b58('0x25'),_0x5f31f5['message'],_0x26a048);_0x4a9be7(_0x138dd1['error'](0x1f4,_0x5f31f5['message']));});});}; \ No newline at end of file +var _0x8617=['where','attributes','limit','include','map','model','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueue,\x20%s,\x20%s','result','GetVoiceQueue','VoiceQueue','findAll','options','raw'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x8617,0x16f));var _0x7861=function(_0x4b3378,_0x3584bd){_0x4b3378=_0x4b3378-0x0;var _0x27abe2=_0x8617[_0x4b3378];return _0x27abe2;};'use strict';var _=require(_0x7861('0x0'));var util=require(_0x7861('0x1'));var moment=require('moment');var BPromise=require(_0x7861('0x2'));var rs=require(_0x7861('0x3'));var fs=require('fs');var Redis=require(_0x7861('0x4'));var db=require(_0x7861('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7861('0x6'))(_0x7861('0x7'));var config=require('../../config/environment');var jayson=require(_0x7861('0x8'));var client=jayson[_0x7861('0x9')][_0x7861('0xa')]({'port':0x232a});config[_0x7861('0xb')]=_[_0x7861('0xc')](config[_0x7861('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7861('0xd'))(new Redis(config[_0x7861('0xb')]));require(_0x7861('0xe'))[_0x7861('0xf')](socket);function respondWithRpcPromise(_0x2de623,_0x22a9a7,_0x1c23b0){return new BPromise(function(_0x1578b2,_0x153bcc){return client[_0x7861('0x10')](_0x2de623,_0x1c23b0)[_0x7861('0x11')](function(_0xcbb8b3){logger[_0x7861('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x22a9a7,_0x7861('0x13'));logger[_0x7861('0x14')](_0x7861('0x15'),_0x22a9a7,_0x7861('0x13'),JSON[_0x7861('0x16')](_0xcbb8b3));if(_0xcbb8b3[_0x7861('0x17')]){if(_0xcbb8b3[_0x7861('0x17')][_0x7861('0x18')]===0x1f4){logger[_0x7861('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x22a9a7,_0xcbb8b3[_0x7861('0x17')][_0x7861('0x19')]);return _0x153bcc(_0xcbb8b3['error'][_0x7861('0x19')]);}logger[_0x7861('0x17')](_0x7861('0x1a'),_0x22a9a7,_0xcbb8b3[_0x7861('0x17')][_0x7861('0x19')]);return _0x1578b2(_0xcbb8b3[_0x7861('0x17')][_0x7861('0x19')]);}else{logger['info'](_0x7861('0x1a'),_0x22a9a7,_0x7861('0x13'));_0x1578b2(_0xcbb8b3[_0x7861('0x1b')][_0x7861('0x19')]);}})['catch'](function(_0x160a5e){logger[_0x7861('0x17')](_0x7861('0x1a'),_0x22a9a7,_0x160a5e);_0x153bcc(_0x160a5e);});});}exports[_0x7861('0x1c')]=function(_0x9435ce){var _0x295a69=this;return new Promise(function(_0x575a09,_0x27cf9c){return db[_0x7861('0x1d')][_0x7861('0x1e')]({'raw':_0x9435ce['options']?_0x9435ce[_0x7861('0x1f')][_0x7861('0x20')]===undefined?!![]:![]:!![],'where':_0x9435ce['options']?_0x9435ce[_0x7861('0x1f')][_0x7861('0x21')]||null:null,'attributes':_0x9435ce[_0x7861('0x1f')]?_0x9435ce[_0x7861('0x1f')][_0x7861('0x22')]||null:null,'limit':_0x9435ce[_0x7861('0x1f')]?_0x9435ce[_0x7861('0x1f')][_0x7861('0x23')]||null:null,'include':_0x9435ce[_0x7861('0x1f')]?_0x9435ce[_0x7861('0x1f')][_0x7861('0x24')]?_[_0x7861('0x25')](_0x9435ce[_0x7861('0x1f')][_0x7861('0x24')],function(_0x5536e8){return{'model':db[_0x5536e8[_0x7861('0x26')]],'as':_0x5536e8['as'],'attributes':_0x5536e8[_0x7861('0x22')],'include':_0x5536e8[_0x7861('0x24')]?_[_0x7861('0x25')](_0x5536e8[_0x7861('0x24')],function(_0x4bf2d8){return{'model':db[_0x4bf2d8[_0x7861('0x26')]],'as':_0x4bf2d8['as'],'attributes':_0x4bf2d8[_0x7861('0x22')],'include':_0x4bf2d8[_0x7861('0x24')]?_[_0x7861('0x25')](_0x4bf2d8[_0x7861('0x24')],function(_0x52196a){return{'model':db[_0x52196a['model']],'as':_0x52196a['as'],'attributes':_0x52196a[_0x7861('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3064ed){logger[_0x7861('0x12')]('GetVoiceQueue',_0x9435ce);logger['debug'](_0x7861('0x1c'),_0x9435ce,JSON[_0x7861('0x16')](_0x3064ed));_0x575a09(_0x3064ed);})['catch'](function(_0x3d2de9){logger[_0x7861('0x17')](_0x7861('0x1c'),_0x3d2de9[_0x7861('0x19')],_0x9435ce);_0x27cf9c(_0x295a69[_0x7861('0x17')](0x1f4,_0x3d2de9[_0x7861('0x19')]));});});};exports['ShowVoiceQueue']=function(_0xe6ba3a){var _0x392af3=this;return new Promise(function(_0x2f7c90,_0x15d9a3){return db[_0x7861('0x1d')]['find']({'raw':_0xe6ba3a['options']?_0xe6ba3a[_0x7861('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xe6ba3a[_0x7861('0x1f')]?_0xe6ba3a[_0x7861('0x1f')]['where']||null:null,'attributes':_0xe6ba3a[_0x7861('0x1f')]?_0xe6ba3a[_0x7861('0x1f')]['attributes']||null:null,'include':_0xe6ba3a[_0x7861('0x1f')]?_0xe6ba3a['options'][_0x7861('0x24')]?_[_0x7861('0x25')](_0xe6ba3a[_0x7861('0x1f')]['include'],function(_0x21a7aa){return{'model':db[_0x21a7aa[_0x7861('0x26')]],'as':_0x21a7aa['as'],'attributes':_0x21a7aa[_0x7861('0x22')],'include':_0x21a7aa['include']?_['map'](_0x21a7aa[_0x7861('0x24')],function(_0x2459d1){return{'model':db[_0x2459d1[_0x7861('0x26')]],'as':_0x2459d1['as'],'attributes':_0x2459d1['attributes'],'include':_0x2459d1[_0x7861('0x24')]?_[_0x7861('0x25')](_0x2459d1['include'],function(_0x177a31){return{'model':db[_0x177a31[_0x7861('0x26')]],'as':_0x177a31['as'],'attributes':_0x177a31[_0x7861('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5292e3){logger['info']('ShowVoiceQueue',_0xe6ba3a);logger[_0x7861('0x14')]('ShowVoiceQueue',_0xe6ba3a,JSON[_0x7861('0x16')](_0x5292e3));_0x2f7c90(_0x5292e3);})['catch'](function(_0x5a7272){logger[_0x7861('0x17')](_0x7861('0x27'),_0x5a7272[_0x7861('0x19')],_0xe6ba3a);_0x15d9a3(_0x392af3[_0x7861('0x17')](0x1f4,_0x5a7272[_0x7861('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9fcad3c..b0d6af7 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 _0x39c9=['emit','removeListener','register','length','save','remove'];(function(_0x1a41c4,_0x115c55){var _0x307f6e=function(_0x4ae582){while(--_0x4ae582){_0x1a41c4['push'](_0x1a41c4['shift']());}};_0x307f6e(++_0x115c55);}(_0x39c9,0x1cc));var _0x939c=function(_0x29210d,_0x45648b){_0x29210d=_0x29210d-0x0;var _0x4a66e6=_0x39c9[_0x29210d];return _0x4a66e6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x939c('0x0'),_0x939c('0x1'),'update'];function createListener(_0x383e3f,_0x1791a4){return function(_0x3710db){_0x1791a4[_0x939c('0x2')](_0x383e3f,_0x3710db);};}function removeListener(_0xbd6ba8,_0x3a2d7d){return function(){VoiceQueueEvents[_0x939c('0x3')](_0xbd6ba8,_0x3a2d7d);};}exports[_0x939c('0x4')]=function(_0x2d0413){for(var _0x2ccf00=0x0,_0x33254d=events[_0x939c('0x5')];_0x2ccf00<_0x33254d;_0x2ccf00++){var _0x28ff6f=events[_0x2ccf00];var _0x5007e4=createListener('voiceQueue:'+_0x28ff6f,_0x2d0413);VoiceQueueEvents['on'](_0x28ff6f,_0x5007e4);}}; \ No newline at end of file +var _0x813c=['length','voiceQueue:','save','remove','emit'];(function(_0x8ab44b,_0x317999){var _0x46be9c=function(_0x184b63){while(--_0x184b63){_0x8ab44b['push'](_0x8ab44b['shift']());}};_0x46be9c(++_0x317999);}(_0x813c,0x151));var _0xc813=function(_0x409cc5,_0x1979af){_0x409cc5=_0x409cc5-0x0;var _0x175a59=_0x813c[_0x409cc5];return _0x175a59;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xc813('0x0'),_0xc813('0x1'),'update'];function createListener(_0x57a93d,_0x412908){return function(_0x34b7ab){_0x412908[_0xc813('0x2')](_0x57a93d,_0x34b7ab);};}function removeListener(_0x341098,_0x3a9ced){return function(){VoiceQueueEvents['removeListener'](_0x341098,_0x3a9ced);};}exports['register']=function(_0x285c88){for(var _0x5bc2a4=0x0,_0x1721e1=events[_0xc813('0x3')];_0x5bc2a4<_0x1721e1;_0x5bc2a4++){var _0x1ae343=events[_0x5bc2a4];var _0x284e76=createListener(_0xc813('0x4')+_0x1ae343,_0x285c88);VoiceQueueEvents['on'](_0x1ae343,_0x284e76);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0a41923..849e96f 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 _0xfaf5=['./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0xfaf5,0x118));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5faf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5faf('0x1'));var express=require('express');var router=express[_0x5faf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5faf('0x3'));var interaction=require(_0x5faf('0x4'));var config=require(_0x5faf('0x5'));var controller=require(_0x5faf('0x6'));router[_0x5faf('0x7')]('/',auth[_0x5faf('0x8')](),controller[_0x5faf('0x9')]);router[_0x5faf('0x7')](_0x5faf('0xa'),auth[_0x5faf('0x8')](),controller[_0x5faf('0xb')]);router[_0x5faf('0x7')](_0x5faf('0xc'),auth['isAuthenticated'](),controller[_0x5faf('0xd')]);router['get'](_0x5faf('0xe'),auth[_0x5faf('0x8')](),controller[_0x5faf('0xf')]);router[_0x5faf('0x10')]('/',auth[_0x5faf('0x8')](),controller[_0x5faf('0x11')]);router[_0x5faf('0x12')](_0x5faf('0xe'),auth[_0x5faf('0x8')](),controller[_0x5faf('0x13')]);router['delete'](_0x5faf('0xe'),auth[_0x5faf('0x8')](),controller[_0x5faf('0x14')]);module[_0x5faf('0x15')]=router; \ No newline at end of file +var _0xebb2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x31c55e,_0x3bf5ab){var _0x3f233d=function(_0x2959d0){while(--_0x2959d0){_0x31c55e['push'](_0x31c55e['shift']());}};_0x3f233d(++_0x3bf5ab);}(_0xebb2,0x146));var _0x2ebb=function(_0x362ba4,_0x1ee0cb){_0x362ba4=_0x362ba4-0x0;var _0x12e3d7=_0xebb2[_0x362ba4];return _0x12e3d7;};'use strict';var multer=require(_0x2ebb('0x0'));var util=require(_0x2ebb('0x1'));var path=require(_0x2ebb('0x2'));var timeout=require(_0x2ebb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ebb('0x4'));var auth=require(_0x2ebb('0x5'));var interaction=require(_0x2ebb('0x6'));var config=require(_0x2ebb('0x7'));var controller=require(_0x2ebb('0x8'));router[_0x2ebb('0x9')]('/',auth[_0x2ebb('0xa')](),controller[_0x2ebb('0xb')]);router[_0x2ebb('0x9')](_0x2ebb('0xc'),auth[_0x2ebb('0xa')](),controller[_0x2ebb('0xd')]);router[_0x2ebb('0x9')](_0x2ebb('0xe'),auth[_0x2ebb('0xa')](),controller['getVoiceQueuesReport']);router['get'](_0x2ebb('0xf'),auth[_0x2ebb('0xa')](),controller[_0x2ebb('0x10')]);router[_0x2ebb('0x11')]('/',auth[_0x2ebb('0xa')](),controller['create']);router[_0x2ebb('0x12')](_0x2ebb('0xf'),auth['isAuthenticated'](),controller[_0x2ebb('0x13')]);router['delete']('/:id',auth[_0x2ebb('0xa')](),controller[_0x2ebb('0x14')]);module[_0x2ebb('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 012c7aa..f3f86a8 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 _0xf503=['queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf503,0x128));var _0x3f50=function(_0x380252,_0x3133e2){_0x380252=_0x380252-0x0;var _0x5d1330=_0xf503[_0x380252];return _0x5d1330;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3f50('0x0')]={'type':{'type':Sequelize[_0x3f50('0x1')]},'uniqueid':{'type':Sequelize[_0x3f50('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3f50('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3f50('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3f50('0x2')],'set':function(_0x1c4801){var _0x1ddc2b=moment(_0x1c4801);var _0x2a01ce=moment(this[_0x3f50('0x3')](_0x3f50('0x4')))['format'](_0x3f50('0x5'));var _0x1f22d9=_0x1ddc2b[_0x3f50('0x6')](_0x2a01ce,_0x3f50('0x7'));this[_0x3f50('0x8')](_0x3f50('0x9'),_0x1c4801);this[_0x3f50('0x8')](_0x3f50('0xa'),_0x1f22d9||null);}},'position':{'type':Sequelize[_0x3f50('0xb')]},'count':{'type':Sequelize[_0x3f50('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3f50('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3f50('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x3f50('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3f50('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3f50('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x3f50('0x1')],'comment':_0x3f50('0xd')},'originalposition':{'type':Sequelize[_0x3f50('0xb')]},'channel':{'type':Sequelize[_0x3f50('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3f50('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3f50('0x1')]},'context':{'type':Sequelize[_0x3f50('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3f50('0x1')]},'holdtime':{'type':Sequelize[_0x3f50('0xb')]},'mohtime':{'type':Sequelize[_0x3f50('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3f50('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3f50('0x1')]},'transfer':{'type':Sequelize[_0x3f50('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3f50('0x1')],'comment':_0x3f50('0xe')},'transferexten':{'type':Sequelize[_0x3f50('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3f50('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3f50('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x3f50('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf800=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt'];(function(_0x28741a,_0x16206c){var _0x126092=function(_0x473df1){while(--_0x473df1){_0x28741a['push'](_0x28741a['shift']());}};_0x126092(++_0x16206c);}(_0xf800,0xf3));var _0x0f80=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf800[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0f80('0x0'));var moment=require(_0x0f80('0x1'));module['exports']={'type':{'type':Sequelize[_0x0f80('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0f80('0x2')]},'calleridname':{'type':Sequelize[_0x0f80('0x2')]},'queue':{'type':Sequelize[_0x0f80('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0f80('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2345b0){var _0x5968ae=moment(_0x2345b0);var _0x289c40=moment(this['getDataValue']('queuecallerjoinAt'))[_0x0f80('0x4')](_0x0f80('0x5'));var _0x300020=_0x5968ae['diff'](_0x289c40,_0x0f80('0x6'));this[_0x0f80('0x7')](_0x0f80('0x8'),_0x2345b0);this[_0x0f80('0x7')](_0x0f80('0x9'),_0x300020||null);}},'position':{'type':Sequelize[_0x0f80('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x0f80('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0f80('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0f80('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0f80('0x2')],'comment':_0x0f80('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0f80('0x2')]},'accountcode':{'type':Sequelize[_0x0f80('0x2')]},'context':{'type':Sequelize[_0x0f80('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0f80('0x2')]},'holdtime':{'type':Sequelize[_0x0f80('0xa')]},'mohtime':{'type':Sequelize[_0x0f80('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0f80('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0f80('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0f80('0x2')],'comment':_0x0f80('0xd')},'transferexten':{'type':Sequelize[_0x0f80('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0f80('0x2')]},'disposition':{'type':Sequelize[_0x0f80('0x2')]},'secondDisposition':{'type':Sequelize[_0x0f80('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0f80('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0f80('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 21b7868..85d7d5a 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 _0xe59c=['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','register','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe59c,0x100));var _0xce59=function(_0x3cb7d7,_0x3d09bd){_0x3cb7d7=_0x3cb7d7-0x0;var _0x3edf8d=_0xe59c[_0x3cb7d7];return _0x3edf8d;};'use strict';var emlformat=require(_0xce59('0x0'));var rimraf=require(_0xce59('0x1'));var zipdir=require(_0xce59('0x2'));var jsonpatch=require(_0xce59('0x3'));var rp=require(_0xce59('0x4'));var moment=require('moment');var BPromise=require(_0xce59('0x5'));var Mustache=require('mustache');var util=require(_0xce59('0x6'));var path=require(_0xce59('0x7'));var sox=require(_0xce59('0x8'));var csv=require(_0xce59('0x9'));var ejs=require(_0xce59('0xa'));var fs=require('fs');var fs_extra=require(_0xce59('0xb'));var _=require(_0xce59('0xc'));var squel=require(_0xce59('0xd'));var crypto=require(_0xce59('0xe'));var jsforce=require(_0xce59('0xf'));var deskjs=require(_0xce59('0x10'));var toCsv=require(_0xce59('0x9'));var querystring=require(_0xce59('0x11'));var Papa=require(_0xce59('0x12'));var Redis=require(_0xce59('0x13'));var authService=require(_0xce59('0x14'));var qs=require(_0xce59('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce59('0x16'));var logger=require(_0xce59('0x17'))(_0xce59('0x18'));var utils=require(_0xce59('0x19'));var config=require(_0xce59('0x1a'));var licenseUtil=require(_0xce59('0x1b'));var db=require(_0xce59('0x1c'))['db'];config[_0xce59('0x1d')]=_[_0xce59('0x1e')](config[_0xce59('0x1d')],{'host':_0xce59('0x1f'),'port':0x18eb});var socket=require(_0xce59('0x20'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xce59('0x21')](socket);function respondWithStatusCode(_0x1ec573,_0x38639b){_0x38639b=_0x38639b||0xcc;return function(_0x5502d3){if(_0x5502d3){return _0x1ec573['sendStatus'](_0x38639b);}return _0x1ec573[_0xce59('0x22')](_0x38639b)[_0xce59('0x23')]();};}function respondWithResult(_0x2bef91,_0x5953be){_0x5953be=_0x5953be||0xc8;return function(_0x4f72c5){if(_0x4f72c5){return _0x2bef91[_0xce59('0x22')](_0x5953be)[_0xce59('0x24')](_0x4f72c5);}};}function respondWithFilteredResult(_0x16c5df,_0x1ae963){return function(_0x57ab51){if(_0x57ab51){var _0x43b847=typeof _0x1ae963['offset']===_0xce59('0x25')&&typeof _0x1ae963[_0xce59('0x26')]===_0xce59('0x25');var _0x3fd5aa=_0x57ab51['count'];var _0x276610=_0x43b847?0x0:_0x1ae963[_0xce59('0x27')];var _0xf11cd3=_0x43b847?_0x57ab51['count']:_0x1ae963[_0xce59('0x27')]+_0x1ae963['limit'];var _0x303d6a;if(_0xf11cd3>=_0x3fd5aa){_0xf11cd3=_0x3fd5aa;_0x303d6a=0xc8;}else{_0x303d6a=0xce;}_0x16c5df['status'](_0x303d6a);return _0x16c5df[_0xce59('0x28')](_0xce59('0x29'),_0x276610+'-'+_0xf11cd3+'/'+_0x3fd5aa)[_0xce59('0x24')](_0x57ab51);}return null;};}function patchUpdates(_0x682ceb){return function(_0x342755){try{jsonpatch[_0xce59('0x2a')](_0x342755,_0x682ceb,!![]);}catch(_0x28af9f){return BPromise[_0xce59('0x2b')](_0x28af9f);}return _0x342755[_0xce59('0x2c')]();};}function saveUpdates(_0x56270a,_0x5e3eb8){return function(_0x4aa1ee){if(_0x4aa1ee){return _0x4aa1ee[_0xce59('0x2d')](_0x56270a)['then'](function(_0x5f47a8){return _0x5f47a8;});}return null;};}function removeEntity(_0x134d0e,_0x4fcda6){return function(_0x6c7955){if(_0x6c7955){return _0x6c7955[_0xce59('0x2e')]()[_0xce59('0x2f')](function(){_0x134d0e[_0xce59('0x22')](0xcc)[_0xce59('0x23')]();});}};}function handleEntityNotFound(_0x1bff63,_0xabf881){return function(_0x52f2bc){if(!_0x52f2bc){_0x1bff63[_0xce59('0x30')](0x194);}return _0x52f2bc;};}function handleError(_0x4aee16,_0x11c65d){_0x11c65d=_0x11c65d||0x1f4;return function(_0x2050ec){logger['error'](_0x2050ec[_0xce59('0x31')]);if(_0x2050ec['name']){delete _0x2050ec[_0xce59('0x32')];}_0x4aee16[_0xce59('0x22')](_0x11c65d)[_0xce59('0x33')](_0x2050ec);};}exports[_0xce59('0x34')]=function(_0x44da04,_0x3b401b){var _0xc24fe4={},_0x4ff240={},_0x136caa={'count':0x0,'rows':[]};var _0x291b98=_[_0xce59('0x35')](db[_0xce59('0x36')][_0xce59('0x37')],function(_0x4d8d50){return{'name':_0x4d8d50[_0xce59('0x38')],'type':_0x4d8d50[_0xce59('0x39')][_0xce59('0x3a')]};});_0x4ff240[_0xce59('0x3b')]=_[_0xce59('0x35')](_0x291b98,_0xce59('0x32'));_0x4ff240[_0xce59('0x3c')]=_[_0xce59('0x3d')](_0x44da04[_0xce59('0x3c')]);_0x4ff240['filters']=_[_0xce59('0x3e')](_0x4ff240[_0xce59('0x3b')],_0x4ff240[_0xce59('0x3c')]);_0xc24fe4['attributes']=_['intersection'](_0x4ff240[_0xce59('0x3b')],qs[_0xce59('0x3f')](_0x44da04[_0xce59('0x3c')]['fields']));_0xc24fe4[_0xce59('0x40')]=_0xc24fe4['attributes']['length']?_0xc24fe4[_0xce59('0x40')]:_0x4ff240['model'];if(!_0x44da04['query']['hasOwnProperty'](_0xce59('0x41'))){_0xc24fe4['limit']=qs[_0xce59('0x26')](_0x44da04['query'][_0xce59('0x26')]);_0xc24fe4[_0xce59('0x27')]=qs['offset'](_0x44da04['query'][_0xce59('0x27')]);}_0xc24fe4[_0xce59('0x42')]=qs[_0xce59('0x43')](_0x44da04[_0xce59('0x3c')][_0xce59('0x43')]);_0xc24fe4[_0xce59('0x44')]=qs['filters'](_[_0xce59('0x45')](_0x44da04[_0xce59('0x3c')],_0x4ff240[_0xce59('0x46')]),_0x291b98);if(_0x44da04['query'][_0xce59('0x47')]){_0xc24fe4[_0xce59('0x44')]=_['merge'](_0xc24fe4[_0xce59('0x44')],{'$or':_['map'](_0x291b98,function(_0x1b130f){if(_0x1b130f[_0xce59('0x39')]!==_0xce59('0x48')){var _0x560284={};_0x560284[_0x1b130f[_0xce59('0x32')]]={'$like':'%'+_0x44da04['query'][_0xce59('0x47')]+'%'};return _0x560284;}})});}_0xc24fe4=_[_0xce59('0x49')]({},_0xc24fe4,_0x44da04[_0xce59('0x4a')]);var _0x21adb3={'where':_0xc24fe4[_0xce59('0x44')]};return db[_0xce59('0x36')][_0xce59('0x4b')](_0x21adb3)[_0xce59('0x2f')](function(_0x80f0a7){_0x136caa[_0xce59('0x4b')]=_0x80f0a7;if(_0x44da04[_0xce59('0x3c')][_0xce59('0x4c')]){_0xc24fe4[_0xce59('0x4d')]=[{'all':!![]}];}return db[_0xce59('0x36')][_0xce59('0x4e')](_0xc24fe4);})['then'](function(_0x4628b4){_0x136caa[_0xce59('0x4f')]=_0x4628b4;return _0x136caa;})[_0xce59('0x2f')](respondWithFilteredResult(_0x3b401b,_0xc24fe4))[_0xce59('0x50')](handleError(_0x3b401b,null));};exports[_0xce59('0x51')]=function(_0x2e164f,_0x2b9c8a){var _0x4be272={'raw':![],'where':{'id':_0x2e164f[_0xce59('0x52')]['id']}},_0x11b8cc={};_0x11b8cc[_0xce59('0x3b')]=_[_0xce59('0x3d')](db[_0xce59('0x36')][_0xce59('0x37')]);_0x11b8cc['query']=_[_0xce59('0x3d')](_0x2e164f[_0xce59('0x3c')]);_0x11b8cc['filters']=_[_0xce59('0x3e')](_0x11b8cc[_0xce59('0x3b')],_0x11b8cc[_0xce59('0x3c')]);_0x4be272[_0xce59('0x40')]=_['intersection'](_0x11b8cc['model'],qs[_0xce59('0x3f')](_0x2e164f[_0xce59('0x3c')][_0xce59('0x3f')]));_0x4be272[_0xce59('0x40')]=_0x4be272['attributes'][_0xce59('0x53')]?_0x4be272[_0xce59('0x40')]:_0x11b8cc[_0xce59('0x3b')];if(_0x2e164f['query'][_0xce59('0x4c')]){_0x4be272[_0xce59('0x4d')]=[{'all':!![]}];}_0x4be272=_[_0xce59('0x49')]({},_0x4be272,_0x2e164f[_0xce59('0x4a')]);return db[_0xce59('0x36')][_0xce59('0x54')](_0x4be272)['then'](handleEntityNotFound(_0x2b9c8a,null))['then'](respondWithResult(_0x2b9c8a,null))[_0xce59('0x50')](handleError(_0x2b9c8a,null));};exports[_0xce59('0x55')]=function(_0x2e30a4,_0x4439c7){return db['VoiceQueueReport'][_0xce59('0x55')](_0x2e30a4[_0xce59('0x56')],{})['then'](respondWithResult(_0x4439c7,0xc9))[_0xce59('0x50')](handleError(_0x4439c7,null));};exports[_0xce59('0x2d')]=function(_0x28333c,_0x30d0f2){if(_0x28333c[_0xce59('0x56')]['id']){delete _0x28333c[_0xce59('0x56')]['id'];}return db[_0xce59('0x36')][_0xce59('0x54')]({'where':{'id':_0x28333c['params']['id']}})['then'](handleEntityNotFound(_0x30d0f2,null))['then'](saveUpdates(_0x28333c[_0xce59('0x56')],null))[_0xce59('0x2f')](respondWithResult(_0x30d0f2,null))['catch'](handleError(_0x30d0f2,null));};exports[_0xce59('0x2e')]=function(_0x429922,_0x15d5bc){return db[_0xce59('0x36')][_0xce59('0x54')]({'where':{'id':_0x429922['params']['id']}})[_0xce59('0x2f')](handleEntityNotFound(_0x15d5bc,null))[_0xce59('0x2f')](removeEntity(_0x15d5bc,null))['catch'](handleError(_0x15d5bc,null));};exports['describe']=function(_0x2b4f84,_0x444d9e){return db[_0xce59('0x36')][_0xce59('0x57')]()['then'](respondWithResult(_0x444d9e,null))[_0xce59('0x50')](handleError(_0x444d9e,null));};exports['getVoiceQueuesReport']=function(_0x3273ca,_0x492086){var _0x1b2225={},_0x292517={},_0xd2a92f={'count':0x0,'rows':[]};_0x292517[_0xce59('0x3b')]=_['keys'](db[_0xce59('0x36')][_0xce59('0x37')]);_0x292517[_0xce59('0x3c')]=_['keys'](_0x3273ca['query']);_0x292517[_0xce59('0x46')]=_[_0xce59('0x3e')](_0x292517[_0xce59('0x3b')],_0x292517[_0xce59('0x3c')]);_0x1b2225['attributes']=_[_0xce59('0x3e')](_0x292517[_0xce59('0x3b')],qs[_0xce59('0x3f')](_0x3273ca[_0xce59('0x3c')]['fields']));_0x1b2225[_0xce59('0x40')]=_0x1b2225[_0xce59('0x40')][_0xce59('0x53')]?_0x1b2225[_0xce59('0x40')]:_0x292517[_0xce59('0x3b')];if(!_0x3273ca[_0xce59('0x3c')]['hasOwnProperty'](_0xce59('0x41'))){_0x1b2225['limit']=qs[_0xce59('0x26')](_0x3273ca['query'][_0xce59('0x26')]);_0x1b2225[_0xce59('0x27')]=qs[_0xce59('0x27')](_0x3273ca['query']['offset']);}_0x1b2225[_0xce59('0x42')]=qs[_0xce59('0x43')](_0x3273ca[_0xce59('0x3c')]['sort']);_0x1b2225[_0xce59('0x44')]=qs['filters'](_[_0xce59('0x45')](_0x3273ca[_0xce59('0x3c')],_0x292517[_0xce59('0x46')]));if(_0x3273ca[_0xce59('0x3c')][_0xce59('0x47')]){_0x1b2225[_0xce59('0x44')]=_[_0xce59('0x49')](_0x1b2225['where'],{'$or':_[_0xce59('0x35')](_0x1b2225['attributes'],function(_0x523999){var _0x4a6e68={};_0x4a6e68[_0x523999]={'$like':'%'+_0x3273ca[_0xce59('0x3c')][_0xce59('0x47')]+'%'};return _0x4a6e68;})});}_0x1b2225=_[_0xce59('0x49')]({},_0x1b2225,_0x3273ca['options']);var _0x368b14={'where':_0x1b2225[_0xce59('0x44')]};return db[_0xce59('0x36')]['count'](_0x368b14)['then'](function(_0x442540){_0xd2a92f[_0xce59('0x4b')]=_0x442540;if(_0x3273ca[_0xce59('0x3c')][_0xce59('0x4c')]){_0x1b2225['include']=[{'all':!![]}];}return db[_0xce59('0x36')][_0xce59('0x4e')](_0x1b2225);})['then'](function(_0x3526ca){_0xd2a92f['rows']=_0x3526ca;return _0xd2a92f;})[_0xce59('0x2f')](respondWithFilteredResult(_0x492086,_0x1b2225,_0xce59('0x58')))[_0xce59('0x50')](handleError(_0x492086,null,_0xce59('0x58')));}; \ No newline at end of file +var _0xbe5a=['VIRTUAL','options','then','include','findAll','catch','show','params','rawAttributes','fields','includeAll','find','create','body','describe','getVoiceQueuesReport','pick','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type'];(function(_0x23d8e8,_0x248029){var _0x13d3eb=function(_0x401cd8){while(--_0x401cd8){_0x23d8e8['push'](_0x23d8e8['shift']());}};_0x13d3eb(++_0x248029);}(_0xbe5a,0x117));var _0xabe5=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xbe5a[_0x100e36];return _0x1df0c9;};'use strict';var emlformat=require(_0xabe5('0x0'));var rimraf=require(_0xabe5('0x1'));var zipdir=require(_0xabe5('0x2'));var jsonpatch=require(_0xabe5('0x3'));var rp=require(_0xabe5('0x4'));var moment=require(_0xabe5('0x5'));var BPromise=require(_0xabe5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xabe5('0x7'));var ejs=require(_0xabe5('0x8'));var fs=require('fs');var fs_extra=require(_0xabe5('0x9'));var _=require(_0xabe5('0xa'));var squel=require(_0xabe5('0xb'));var crypto=require(_0xabe5('0xc'));var jsforce=require(_0xabe5('0xd'));var deskjs=require(_0xabe5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xabe5('0xf'));var Papa=require('papaparse');var Redis=require(_0xabe5('0x10'));var authService=require(_0xabe5('0x11'));var qs=require(_0xabe5('0x12'));var as=require(_0xabe5('0x13'));var hardwareService=require(_0xabe5('0x14'));var logger=require(_0xabe5('0x15'))(_0xabe5('0x16'));var utils=require(_0xabe5('0x17'));var config=require(_0xabe5('0x18'));var licenseUtil=require(_0xabe5('0x19'));var db=require(_0xabe5('0x1a'))['db'];config[_0xabe5('0x1b')]=_[_0xabe5('0x1c')](config[_0xabe5('0x1b')],{'host':_0xabe5('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xabe5('0x1e'))[_0xabe5('0x1f')](socket);function respondWithStatusCode(_0xc13227,_0x37db01){_0x37db01=_0x37db01||0xcc;return function(_0x4ca5fb){if(_0x4ca5fb){return _0xc13227['sendStatus'](_0x37db01);}return _0xc13227['status'](_0x37db01)[_0xabe5('0x20')]();};}function respondWithResult(_0x4c2a6d,_0x4c07b4){_0x4c07b4=_0x4c07b4||0xc8;return function(_0x4ede86){if(_0x4ede86){return _0x4c2a6d[_0xabe5('0x21')](_0x4c07b4)[_0xabe5('0x22')](_0x4ede86);}};}function respondWithFilteredResult(_0x1dbd57,_0x137a06){return function(_0x3b70e9){if(_0x3b70e9){var _0x42b549=typeof _0x137a06[_0xabe5('0x23')]===_0xabe5('0x24')&&typeof _0x137a06[_0xabe5('0x25')]===_0xabe5('0x24');var _0x584fc1=_0x3b70e9[_0xabe5('0x26')];var _0x1ff5a2=_0x42b549?0x0:_0x137a06[_0xabe5('0x23')];var _0x28620b=_0x42b549?_0x3b70e9['count']:_0x137a06[_0xabe5('0x23')]+_0x137a06[_0xabe5('0x25')];var _0xeb4902;if(_0x28620b>=_0x584fc1){_0x28620b=_0x584fc1;_0xeb4902=0xc8;}else{_0xeb4902=0xce;}_0x1dbd57[_0xabe5('0x21')](_0xeb4902);return _0x1dbd57[_0xabe5('0x27')](_0xabe5('0x28'),_0x1ff5a2+'-'+_0x28620b+'/'+_0x584fc1)['json'](_0x3b70e9);}return null;};}function patchUpdates(_0x15bfde){return function(_0x28ef1d){try{jsonpatch[_0xabe5('0x29')](_0x28ef1d,_0x15bfde,!![]);}catch(_0x5be21a){return BPromise[_0xabe5('0x2a')](_0x5be21a);}return _0x28ef1d[_0xabe5('0x2b')]();};}function saveUpdates(_0x37269d,_0x476844){return function(_0x3af7a5){if(_0x3af7a5){return _0x3af7a5[_0xabe5('0x2c')](_0x37269d)['then'](function(_0x2b334a){return _0x2b334a;});}return null;};}function removeEntity(_0x530377,_0x31f32f){return function(_0x46504e){if(_0x46504e){return _0x46504e[_0xabe5('0x2d')]()['then'](function(){_0x530377[_0xabe5('0x21')](0xcc)[_0xabe5('0x20')]();});}};}function handleEntityNotFound(_0x48b795,_0x192993){return function(_0x465efa){if(!_0x465efa){_0x48b795[_0xabe5('0x2e')](0x194);}return _0x465efa;};}function handleError(_0x155385,_0x41bd42){_0x41bd42=_0x41bd42||0x1f4;return function(_0x59a9a5){logger[_0xabe5('0x2f')](_0x59a9a5[_0xabe5('0x30')]);if(_0x59a9a5[_0xabe5('0x31')]){delete _0x59a9a5[_0xabe5('0x31')];}_0x155385[_0xabe5('0x21')](_0x41bd42)[_0xabe5('0x32')](_0x59a9a5);};}exports[_0xabe5('0x33')]=function(_0x3f1651,_0x351291){var _0x56c1be={},_0xcf5874={},_0x162373={'count':0x0,'rows':[]};var _0x3b50bd=_[_0xabe5('0x34')](db[_0xabe5('0x35')]['rawAttributes'],function(_0xadbd41){return{'name':_0xadbd41['fieldName'],'type':_0xadbd41['type']['key']};});_0xcf5874[_0xabe5('0x36')]=_[_0xabe5('0x34')](_0x3b50bd,_0xabe5('0x31'));_0xcf5874[_0xabe5('0x37')]=_[_0xabe5('0x38')](_0x3f1651[_0xabe5('0x37')]);_0xcf5874[_0xabe5('0x39')]=_[_0xabe5('0x3a')](_0xcf5874[_0xabe5('0x36')],_0xcf5874['query']);_0x56c1be[_0xabe5('0x3b')]=_[_0xabe5('0x3a')](_0xcf5874[_0xabe5('0x36')],qs['fields'](_0x3f1651[_0xabe5('0x37')]['fields']));_0x56c1be[_0xabe5('0x3b')]=_0x56c1be[_0xabe5('0x3b')][_0xabe5('0x3c')]?_0x56c1be[_0xabe5('0x3b')]:_0xcf5874[_0xabe5('0x36')];if(!_0x3f1651[_0xabe5('0x37')][_0xabe5('0x3d')](_0xabe5('0x3e'))){_0x56c1be[_0xabe5('0x25')]=qs[_0xabe5('0x25')](_0x3f1651[_0xabe5('0x37')]['limit']);_0x56c1be[_0xabe5('0x23')]=qs[_0xabe5('0x23')](_0x3f1651[_0xabe5('0x37')]['offset']);}_0x56c1be[_0xabe5('0x3f')]=qs['sort'](_0x3f1651['query'][_0xabe5('0x40')]);_0x56c1be[_0xabe5('0x41')]=qs[_0xabe5('0x39')](_['pick'](_0x3f1651[_0xabe5('0x37')],_0xcf5874['filters']),_0x3b50bd);if(_0x3f1651[_0xabe5('0x37')][_0xabe5('0x42')]){_0x56c1be[_0xabe5('0x41')]=_[_0xabe5('0x43')](_0x56c1be[_0xabe5('0x41')],{'$or':_['map'](_0x3b50bd,function(_0xd29c2b){if(_0xd29c2b[_0xabe5('0x44')]!==_0xabe5('0x45')){var _0x1847d8={};_0x1847d8[_0xd29c2b[_0xabe5('0x31')]]={'$like':'%'+_0x3f1651['query'][_0xabe5('0x42')]+'%'};return _0x1847d8;}})});}_0x56c1be=_['merge']({},_0x56c1be,_0x3f1651[_0xabe5('0x46')]);var _0x169bc0={'where':_0x56c1be[_0xabe5('0x41')]};return db[_0xabe5('0x35')]['count'](_0x169bc0)[_0xabe5('0x47')](function(_0x54d7ea){_0x162373[_0xabe5('0x26')]=_0x54d7ea;if(_0x3f1651[_0xabe5('0x37')]['includeAll']){_0x56c1be[_0xabe5('0x48')]=[{'all':!![]}];}return db[_0xabe5('0x35')][_0xabe5('0x49')](_0x56c1be);})[_0xabe5('0x47')](function(_0x3347b2){_0x162373['rows']=_0x3347b2;return _0x162373;})['then'](respondWithFilteredResult(_0x351291,_0x56c1be))[_0xabe5('0x4a')](handleError(_0x351291,null));};exports[_0xabe5('0x4b')]=function(_0x30f1c8,_0x4441fe){var _0x297bee={'raw':![],'where':{'id':_0x30f1c8[_0xabe5('0x4c')]['id']}},_0x145f0e={};_0x145f0e[_0xabe5('0x36')]=_['keys'](db['VoiceQueueReport'][_0xabe5('0x4d')]);_0x145f0e[_0xabe5('0x37')]=_[_0xabe5('0x38')](_0x30f1c8['query']);_0x145f0e[_0xabe5('0x39')]=_[_0xabe5('0x3a')](_0x145f0e[_0xabe5('0x36')],_0x145f0e[_0xabe5('0x37')]);_0x297bee[_0xabe5('0x3b')]=_[_0xabe5('0x3a')](_0x145f0e[_0xabe5('0x36')],qs[_0xabe5('0x4e')](_0x30f1c8[_0xabe5('0x37')]['fields']));_0x297bee['attributes']=_0x297bee['attributes']['length']?_0x297bee[_0xabe5('0x3b')]:_0x145f0e['model'];if(_0x30f1c8['query'][_0xabe5('0x4f')]){_0x297bee[_0xabe5('0x48')]=[{'all':!![]}];}_0x297bee=_[_0xabe5('0x43')]({},_0x297bee,_0x30f1c8['options']);return db[_0xabe5('0x35')][_0xabe5('0x50')](_0x297bee)['then'](handleEntityNotFound(_0x4441fe,null))[_0xabe5('0x47')](respondWithResult(_0x4441fe,null))[_0xabe5('0x4a')](handleError(_0x4441fe,null));};exports[_0xabe5('0x51')]=function(_0xb78c36,_0x1ec1ec){return db[_0xabe5('0x35')][_0xabe5('0x51')](_0xb78c36['body'],{})[_0xabe5('0x47')](respondWithResult(_0x1ec1ec,0xc9))[_0xabe5('0x4a')](handleError(_0x1ec1ec,null));};exports[_0xabe5('0x2c')]=function(_0x9de585,_0x20fcac){if(_0x9de585[_0xabe5('0x52')]['id']){delete _0x9de585[_0xabe5('0x52')]['id'];}return db[_0xabe5('0x35')]['find']({'where':{'id':_0x9de585['params']['id']}})[_0xabe5('0x47')](handleEntityNotFound(_0x20fcac,null))[_0xabe5('0x47')](saveUpdates(_0x9de585[_0xabe5('0x52')],null))[_0xabe5('0x47')](respondWithResult(_0x20fcac,null))['catch'](handleError(_0x20fcac,null));};exports['destroy']=function(_0x47f2ec,_0xad9ad4){return db[_0xabe5('0x35')][_0xabe5('0x50')]({'where':{'id':_0x47f2ec[_0xabe5('0x4c')]['id']}})[_0xabe5('0x47')](handleEntityNotFound(_0xad9ad4,null))[_0xabe5('0x47')](removeEntity(_0xad9ad4,null))[_0xabe5('0x4a')](handleError(_0xad9ad4,null));};exports['describe']=function(_0x2d2741,_0x526f71){return db[_0xabe5('0x35')][_0xabe5('0x53')]()['then'](respondWithResult(_0x526f71,null))['catch'](handleError(_0x526f71,null));};exports[_0xabe5('0x54')]=function(_0x5d56fa,_0x3359d8){var _0x15de33={},_0x53e9dc={},_0x4b56b8={'count':0x0,'rows':[]};_0x53e9dc[_0xabe5('0x36')]=_[_0xabe5('0x38')](db[_0xabe5('0x35')]['rawAttributes']);_0x53e9dc[_0xabe5('0x37')]=_[_0xabe5('0x38')](_0x5d56fa['query']);_0x53e9dc['filters']=_[_0xabe5('0x3a')](_0x53e9dc[_0xabe5('0x36')],_0x53e9dc[_0xabe5('0x37')]);_0x15de33['attributes']=_[_0xabe5('0x3a')](_0x53e9dc['model'],qs[_0xabe5('0x4e')](_0x5d56fa[_0xabe5('0x37')][_0xabe5('0x4e')]));_0x15de33[_0xabe5('0x3b')]=_0x15de33['attributes']['length']?_0x15de33['attributes']:_0x53e9dc['model'];if(!_0x5d56fa['query']['hasOwnProperty'](_0xabe5('0x3e'))){_0x15de33['limit']=qs[_0xabe5('0x25')](_0x5d56fa[_0xabe5('0x37')][_0xabe5('0x25')]);_0x15de33['offset']=qs[_0xabe5('0x23')](_0x5d56fa[_0xabe5('0x37')]['offset']);}_0x15de33[_0xabe5('0x3f')]=qs[_0xabe5('0x40')](_0x5d56fa[_0xabe5('0x37')][_0xabe5('0x40')]);_0x15de33[_0xabe5('0x41')]=qs[_0xabe5('0x39')](_[_0xabe5('0x55')](_0x5d56fa[_0xabe5('0x37')],_0x53e9dc[_0xabe5('0x39')]));if(_0x5d56fa[_0xabe5('0x37')][_0xabe5('0x42')]){_0x15de33[_0xabe5('0x41')]=_['merge'](_0x15de33[_0xabe5('0x41')],{'$or':_[_0xabe5('0x34')](_0x15de33[_0xabe5('0x3b')],function(_0x3d364f){var _0x48610e={};_0x48610e[_0x3d364f]={'$like':'%'+_0x5d56fa[_0xabe5('0x37')][_0xabe5('0x42')]+'%'};return _0x48610e;})});}_0x15de33=_[_0xabe5('0x43')]({},_0x15de33,_0x5d56fa[_0xabe5('0x46')]);var _0x5889c7={'where':_0x15de33['where']};return db[_0xabe5('0x35')][_0xabe5('0x26')](_0x5889c7)[_0xabe5('0x47')](function(_0x5273aa){_0x4b56b8[_0xabe5('0x26')]=_0x5273aa;if(_0x5d56fa[_0xabe5('0x37')][_0xabe5('0x4f')]){_0x15de33[_0xabe5('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xabe5('0x49')](_0x15de33);})[_0xabe5('0x47')](function(_0x35ca51){_0x4b56b8[_0xabe5('0x56')]=_0x35ca51;return _0x4b56b8;})[_0xabe5('0x47')](respondWithFilteredResult(_0x3359d8,_0x15de33,_0xabe5('0x54')))[_0xabe5('0x4a')](handleError(_0x3359d8,null,_0xabe5('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ce80ad5..301a240 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 _0x3e07=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x59df0c,_0x3b5ac2){var _0xfd26b4=function(_0x6cd80a){while(--_0x6cd80a){_0x59df0c['push'](_0x59df0c['shift']());}};_0xfd26b4(++_0x3b5ac2);}(_0x3e07,0x8f));var _0x73e0=function(_0xb0e73,_0x3a9ec6){_0xb0e73=_0xb0e73-0x0;var _0x5960d1=_0x3e07[_0xb0e73];return _0x5960d1;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x73e0('0x0'))['db'][_0x73e0('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x73e0('0x2')](0x0);var events={'afterCreate':_0x73e0('0x3'),'afterUpdate':_0x73e0('0x4'),'afterDestroy':_0x73e0('0x5')};function emitEvent(_0x99357){return function(_0x2e8026,_0x500054,_0x118994){VoiceQueueReportEvents['emit'](_0x99357+':'+_0x2e8026['id'],_0x2e8026);VoiceQueueReportEvents[_0x73e0('0x6')](_0x99357,_0x2e8026);_0x118994(null);};}for(var e in events){if(events[_0x73e0('0x7')](e)){var event=events[e];VoiceQueueReport[_0x73e0('0x8')](e,emitEvent(event));}}module[_0x73e0('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x5f11=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f11,0x148));var _0x15f1=function(_0x226dfb,_0x43453a){_0x226dfb=_0x226dfb-0x0;var _0x4dc0d6=_0x5f11[_0x226dfb];return _0x4dc0d6;};'use strict';var EventEmitter=require(_0x15f1('0x0'));var VoiceQueueReport=require(_0x15f1('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x15f1('0x2'),'afterUpdate':_0x15f1('0x3'),'afterDestroy':_0x15f1('0x4')};function emitEvent(_0x114e2b){return function(_0x200218,_0x7ea4ac,_0x37541b){VoiceQueueReportEvents[_0x15f1('0x5')](_0x114e2b+':'+_0x200218['id'],_0x200218);VoiceQueueReportEvents[_0x15f1('0x5')](_0x114e2b,_0x200218);_0x37541b(null);};}for(var e in events){if(events[_0x15f1('0x6')](e)){var event=events[e];VoiceQueueReport[_0x15f1('0x7')](e,emitEvent(event));}}module[_0x15f1('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c3c0385..bebb84f 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 _0x0d84=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','report_queue','uniqueid'];(function(_0x307577,_0x576136){var _0x44d34f=function(_0x12a075){while(--_0x12a075){_0x307577['push'](_0x307577['shift']());}};_0x44d34f(++_0x576136);}(_0x0d84,0x198));var _0x40d8=function(_0x32e11c,_0x1433aa){_0x32e11c=_0x32e11c-0x0;var _0x51f97b=_0x0d84[_0x32e11c];return _0x51f97b;};'use strict';var _=require(_0x40d8('0x0'));var util=require(_0x40d8('0x1'));var logger=require(_0x40d8('0x2'))(_0x40d8('0x3'));var moment=require(_0x40d8('0x4'));var BPromise=require(_0x40d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40d8('0x6'));var rimraf=require(_0x40d8('0x7'));var config=require(_0x40d8('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x40d8('0x9')]=function(_0xa7ed7b,_0x19717e){return _0xa7ed7b['define']('VoiceQueueReport',attributes,{'tableName':_0x40d8('0xa'),'paranoid':![],'indexes':[{'fields':[_0x40d8('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x29a8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','calleridnum'];(function(_0xd0e429,_0x35a0af){var _0x243b77=function(_0x192f53){while(--_0x192f53){_0xd0e429['push'](_0xd0e429['shift']());}};_0x243b77(++_0x35a0af);}(_0x29a8,0x96));var _0x829a=function(_0x764919,_0x588753){_0x764919=_0x764919-0x0;var _0x103b07=_0x29a8[_0x764919];return _0x103b07;};'use strict';var _=require(_0x829a('0x0'));var util=require(_0x829a('0x1'));var logger=require(_0x829a('0x2'))(_0x829a('0x3'));var moment=require(_0x829a('0x4'));var BPromise=require(_0x829a('0x5'));var rp=require(_0x829a('0x6'));var fs=require('fs');var path=require(_0x829a('0x7'));var rimraf=require(_0x829a('0x8'));var config=require(_0x829a('0x9'));var attributes=require(_0x829a('0xa'));module['exports']=function(_0x36759f,_0x3f756d){return _0x36759f[_0x829a('0xb')](_0x829a('0xc'),attributes,{'tableName':_0x829a('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x829a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e26e6c2..a4ddc1d 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 _0xc893=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','map','include','attributes','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','where','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0xc893,0xd2));var _0x3c89=function(_0x1f2497,_0x310292){_0x1f2497=_0x1f2497-0x0;var _0x4031a3=_0xc893[_0x1f2497];return _0x4031a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c89('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c89('0x1'));var fs=require('fs');var Redis=require(_0x3c89('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c89('0x3'));var logger=require('../../config/logger')(_0x3c89('0x4'));var config=require(_0x3c89('0x5'));var jayson=require(_0x3c89('0x6'));var client=jayson[_0x3c89('0x7')][_0x3c89('0x8')]({'port':0x232a});config[_0x3c89('0x9')]=_[_0x3c89('0xa')](config['redis'],{'host':_0x3c89('0xb'),'port':0x18eb});var socket=require(_0x3c89('0xc'))(new Redis(config[_0x3c89('0x9')]));require(_0x3c89('0xd'))[_0x3c89('0xe')](socket);function respondWithRpcPromise(_0x2aa92a,_0x1e8c51,_0x32cc4a){return new BPromise(function(_0xf4f54b,_0x2e5787){return client[_0x3c89('0xf')](_0x2aa92a,_0x32cc4a)[_0x3c89('0x10')](function(_0x14f32d){logger[_0x3c89('0x11')](_0x3c89('0x12'),_0x1e8c51,_0x3c89('0x13'));logger[_0x3c89('0x14')](_0x3c89('0x15'),_0x1e8c51,_0x3c89('0x13'),JSON[_0x3c89('0x16')](_0x14f32d));if(_0x14f32d[_0x3c89('0x17')]){if(_0x14f32d[_0x3c89('0x17')][_0x3c89('0x18')]===0x1f4){logger['error'](_0x3c89('0x12'),_0x1e8c51,_0x14f32d[_0x3c89('0x17')][_0x3c89('0x19')]);return _0x2e5787(_0x14f32d[_0x3c89('0x17')]['message']);}logger[_0x3c89('0x17')](_0x3c89('0x12'),_0x1e8c51,_0x14f32d['error'][_0x3c89('0x19')]);return _0xf4f54b(_0x14f32d[_0x3c89('0x17')][_0x3c89('0x19')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1e8c51,_0x3c89('0x13'));_0xf4f54b(_0x14f32d[_0x3c89('0x1a')][_0x3c89('0x19')]);}})[_0x3c89('0x1b')](function(_0x2bbe0a){logger[_0x3c89('0x17')](_0x3c89('0x12'),_0x1e8c51,_0x2bbe0a);_0x2e5787(_0x2bbe0a);});});}exports[_0x3c89('0x1c')]=function(_0x3e77ce){var _0xfb34a3=this;return new Promise(function(_0x38d30e,_0x5f0dc8){return db[_0x3c89('0x1d')][_0x3c89('0x1e')]({'raw':_0x3e77ce[_0x3c89('0x1f')]?_0x3e77ce[_0x3c89('0x1f')][_0x3c89('0x20')]===undefined?!![]:![]:!![],'where':_0x3e77ce[_0x3c89('0x1f')]?_0x3e77ce[_0x3c89('0x1f')]['where']||null:null,'attributes':_0x3e77ce[_0x3c89('0x1f')]?_0x3e77ce[_0x3c89('0x1f')]['attributes']||null:null,'limit':_0x3e77ce[_0x3c89('0x1f')]?_0x3e77ce['options'][_0x3c89('0x21')]||null:null,'include':_0x3e77ce[_0x3c89('0x1f')]?_0x3e77ce[_0x3c89('0x1f')]['include']?_[_0x3c89('0x22')](_0x3e77ce['options'][_0x3c89('0x23')],function(_0x50b87c){return{'model':db[_0x50b87c['model']],'as':_0x50b87c['as'],'attributes':_0x50b87c[_0x3c89('0x24')],'include':_0x50b87c[_0x3c89('0x23')]?_[_0x3c89('0x22')](_0x50b87c['include'],function(_0x30e934){return{'model':db[_0x30e934['model']],'as':_0x30e934['as'],'attributes':_0x30e934['attributes'],'include':_0x30e934[_0x3c89('0x23')]?_[_0x3c89('0x22')](_0x30e934['include'],function(_0x4a5ffd){return{'model':db[_0x4a5ffd['model']],'as':_0x4a5ffd['as'],'attributes':_0x4a5ffd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e57d9){logger[_0x3c89('0x11')](_0x3c89('0x1c'),_0x3e77ce);logger[_0x3c89('0x14')](_0x3c89('0x1c'),_0x3e77ce,JSON[_0x3c89('0x16')](_0x5e57d9));_0x38d30e(_0x5e57d9);})[_0x3c89('0x1b')](function(_0x4556a5){logger[_0x3c89('0x17')](_0x3c89('0x1c'),_0x4556a5[_0x3c89('0x19')],_0x3e77ce);_0x5f0dc8(_0xfb34a3[_0x3c89('0x17')](0x1f4,_0x4556a5[_0x3c89('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x1d38b9){var _0x611be0=this;return new Promise(function(_0x2fe8d2,_0x57b603){return db[_0x3c89('0x1d')][_0x3c89('0x25')](_0x1d38b9['body'],{'raw':_0x1d38b9[_0x3c89('0x1f')]?_0x1d38b9[_0x3c89('0x1f')][_0x3c89('0x20')]===undefined?!![]:![]:!![]})[_0x3c89('0x10')](function(_0x295425){logger[_0x3c89('0x11')](_0x3c89('0x26'),_0x1d38b9);logger[_0x3c89('0x14')](_0x3c89('0x26'),_0x1d38b9,JSON[_0x3c89('0x16')](_0x295425));_0x2fe8d2(_0x295425);})[_0x3c89('0x1b')](function(_0x19a27e){logger['error'](_0x3c89('0x26'),_0x19a27e[_0x3c89('0x19')],_0x1d38b9);_0x57b603(_0x611be0[_0x3c89('0x17')](0x1f4,_0x19a27e['message']));});});};exports[_0x3c89('0x27')]=function(_0x5d7cf4){var _0x1410e1=this;return new Promise(function(_0x506e3e,_0x114fee){return db['VoiceQueueReport'][_0x3c89('0x28')](_0x5d7cf4[_0x3c89('0x29')],{'raw':_0x5d7cf4[_0x3c89('0x1f')]?_0x5d7cf4[_0x3c89('0x1f')][_0x3c89('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7cf4[_0x3c89('0x1f')]?_0x5d7cf4[_0x3c89('0x1f')][_0x3c89('0x2a')]||null:null,'attributes':_0x5d7cf4[_0x3c89('0x1f')]?_0x5d7cf4[_0x3c89('0x1f')][_0x3c89('0x24')]||null:null,'limit':_0x5d7cf4['options']?_0x5d7cf4[_0x3c89('0x1f')][_0x3c89('0x21')]||null:null})['then'](function(_0x12422b){logger[_0x3c89('0x11')](_0x3c89('0x27'),_0x5d7cf4);logger[_0x3c89('0x14')]('UpdateVoiceQueueReport',_0x5d7cf4,JSON['stringify'](_0x12422b));_0x506e3e(_0x12422b);})[_0x3c89('0x1b')](function(_0x42adc0){logger[_0x3c89('0x17')](_0x3c89('0x27'),_0x42adc0[_0x3c89('0x19')],_0x5d7cf4);_0x114fee(_0x1410e1[_0x3c89('0x17')](0x1f4,_0x42adc0['message']));});});}; \ No newline at end of file +var _0xe24a=['options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','findAll'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0xe24a,0x1ac));var _0xae24=function(_0x156580,_0x55712b){_0x156580=_0x156580-0x0;var _0x329e9c=_0xe24a[_0x156580];return _0x329e9c;};'use strict';var _=require(_0xae24('0x0'));var util=require(_0xae24('0x1'));var moment=require(_0xae24('0x2'));var BPromise=require(_0xae24('0x3'));var rs=require(_0xae24('0x4'));var fs=require('fs');var Redis=require(_0xae24('0x5'));var db=require(_0xae24('0x6'))['db'];var utils=require(_0xae24('0x7'));var logger=require(_0xae24('0x8'))('rpc');var config=require(_0xae24('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xae24('0xa')][_0xae24('0xb')]({'port':0x232a});config[_0xae24('0xc')]=_[_0xae24('0xd')](config[_0xae24('0xc')],{'host':_0xae24('0xe'),'port':0x18eb});var socket=require(_0xae24('0xf'))(new Redis(config[_0xae24('0xc')]));require(_0xae24('0x10'))[_0xae24('0x11')](socket);function respondWithRpcPromise(_0x5d5cac,_0x2bced5,_0x45f104){return new BPromise(function(_0x41e6df,_0x1f9136){return client[_0xae24('0x12')](_0x5d5cac,_0x45f104)[_0xae24('0x13')](function(_0x89d08d){logger[_0xae24('0x14')](_0xae24('0x15'),_0x2bced5,_0xae24('0x16'));logger[_0xae24('0x17')](_0xae24('0x18'),_0x2bced5,'request\x20sent',JSON[_0xae24('0x19')](_0x89d08d));if(_0x89d08d[_0xae24('0x1a')]){if(_0x89d08d[_0xae24('0x1a')]['code']===0x1f4){logger[_0xae24('0x1a')](_0xae24('0x15'),_0x2bced5,_0x89d08d[_0xae24('0x1a')][_0xae24('0x1b')]);return _0x1f9136(_0x89d08d[_0xae24('0x1a')]['message']);}logger[_0xae24('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x2bced5,_0x89d08d[_0xae24('0x1a')]['message']);return _0x41e6df(_0x89d08d['error'][_0xae24('0x1b')]);}else{logger[_0xae24('0x14')](_0xae24('0x15'),_0x2bced5,_0xae24('0x16'));_0x41e6df(_0x89d08d[_0xae24('0x1c')][_0xae24('0x1b')]);}})[_0xae24('0x1d')](function(_0x2d7724){logger[_0xae24('0x1a')](_0xae24('0x15'),_0x2bced5,_0x2d7724);_0x1f9136(_0x2d7724);});});}exports[_0xae24('0x1e')]=function(_0x4735d2){var _0x1547e6=this;return new Promise(function(_0x2ee16c,_0x452359){return db['VoiceQueueReport'][_0xae24('0x1f')]({'raw':_0x4735d2[_0xae24('0x20')]?_0x4735d2['options'][_0xae24('0x21')]===undefined?!![]:![]:!![],'where':_0x4735d2[_0xae24('0x20')]?_0x4735d2[_0xae24('0x20')][_0xae24('0x22')]||null:null,'attributes':_0x4735d2[_0xae24('0x20')]?_0x4735d2[_0xae24('0x20')]['attributes']||null:null,'limit':_0x4735d2[_0xae24('0x20')]?_0x4735d2['options'][_0xae24('0x23')]||null:null,'include':_0x4735d2['options']?_0x4735d2[_0xae24('0x20')][_0xae24('0x24')]?_[_0xae24('0x25')](_0x4735d2['options'][_0xae24('0x24')],function(_0x2b8513){return{'model':db[_0x2b8513[_0xae24('0x26')]],'as':_0x2b8513['as'],'attributes':_0x2b8513[_0xae24('0x27')],'include':_0x2b8513[_0xae24('0x24')]?_[_0xae24('0x25')](_0x2b8513[_0xae24('0x24')],function(_0x3128cd){return{'model':db[_0x3128cd['model']],'as':_0x3128cd['as'],'attributes':_0x3128cd[_0xae24('0x27')],'include':_0x3128cd[_0xae24('0x24')]?_['map'](_0x3128cd[_0xae24('0x24')],function(_0x27f682){return{'model':db[_0x27f682['model']],'as':_0x27f682['as'],'attributes':_0x27f682[_0xae24('0x27')]};}):[]};}):[]};}):[]:[]})[_0xae24('0x13')](function(_0x1d2d4e){logger[_0xae24('0x14')](_0xae24('0x1e'),_0x4735d2);logger[_0xae24('0x17')](_0xae24('0x1e'),_0x4735d2,JSON[_0xae24('0x19')](_0x1d2d4e));_0x2ee16c(_0x1d2d4e);})[_0xae24('0x1d')](function(_0x5cfb7b){logger[_0xae24('0x1a')](_0xae24('0x1e'),_0x5cfb7b[_0xae24('0x1b')],_0x4735d2);_0x452359(_0x1547e6[_0xae24('0x1a')](0x1f4,_0x5cfb7b[_0xae24('0x1b')]));});});};exports[_0xae24('0x28')]=function(_0x50b888){var _0x4ceb12=this;return new Promise(function(_0x3dcec9,_0x5ca032){return db[_0xae24('0x29')][_0xae24('0x2a')](_0x50b888[_0xae24('0x2b')],{'raw':_0x50b888['options']?_0x50b888[_0xae24('0x20')][_0xae24('0x21')]===undefined?!![]:![]:!![]})[_0xae24('0x13')](function(_0x3ba914){logger[_0xae24('0x14')]('CreateVoiceQueueReport',_0x50b888);logger[_0xae24('0x17')](_0xae24('0x28'),_0x50b888,JSON[_0xae24('0x19')](_0x3ba914));_0x3dcec9(_0x3ba914);})[_0xae24('0x1d')](function(_0x2d5629){logger['error'](_0xae24('0x28'),_0x2d5629[_0xae24('0x1b')],_0x50b888);_0x5ca032(_0x4ceb12[_0xae24('0x1a')](0x1f4,_0x2d5629[_0xae24('0x1b')]));});});};exports[_0xae24('0x2c')]=function(_0x34aa61){var _0x5b14d1=this;return new Promise(function(_0xcb64a8,_0x42cd96){return db[_0xae24('0x29')][_0xae24('0x2d')](_0x34aa61[_0xae24('0x2b')],{'raw':_0x34aa61['options']?_0x34aa61[_0xae24('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34aa61[_0xae24('0x20')]?_0x34aa61[_0xae24('0x20')][_0xae24('0x22')]||null:null,'attributes':_0x34aa61['options']?_0x34aa61[_0xae24('0x20')]['attributes']||null:null,'limit':_0x34aa61['options']?_0x34aa61[_0xae24('0x20')]['limit']||null:null})[_0xae24('0x13')](function(_0x461a8b){logger[_0xae24('0x14')]('UpdateVoiceQueueReport',_0x34aa61);logger['debug'](_0xae24('0x2c'),_0x34aa61,JSON[_0xae24('0x19')](_0x461a8b));_0xcb64a8(_0x461a8b);})['catch'](function(_0x8e0514){logger[_0xae24('0x1a')](_0xae24('0x2c'),_0x8e0514[_0xae24('0x1b')],_0x34aa61);_0x42cd96(_0x5b14d1[_0xae24('0x1a')](0x1f4,_0x8e0514[_0xae24('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a45cc68..7918072 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 _0xcfeb=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','register'];(function(_0x1e3c0e,_0x4aa31f){var _0x1b7fb7=function(_0x3c31d7){while(--_0x3c31d7){_0x1e3c0e['push'](_0x1e3c0e['shift']());}};_0x1b7fb7(++_0x4aa31f);}(_0xcfeb,0x1b2));var _0xbcfe=function(_0x2f0d47,_0x3d48eb){_0x2f0d47=_0x2f0d47-0x0;var _0x5c52f3=_0xcfeb[_0x2f0d47];return _0x5c52f3;};'use strict';var VoiceQueueReportEvents=require(_0xbcfe('0x0'));var events=[_0xbcfe('0x1'),_0xbcfe('0x2'),_0xbcfe('0x3')];function createListener(_0x4e0dc9,_0x5e2e1c){return function(_0x264f6a){_0x5e2e1c[_0xbcfe('0x4')](_0x4e0dc9,_0x264f6a);};}function removeListener(_0x3c6522,_0x562b14){return function(){VoiceQueueReportEvents['removeListener'](_0x3c6522,_0x562b14);};}exports[_0xbcfe('0x5')]=function(_0x3de8ae){for(var _0x351b20=0x0,_0x24743b=events[_0xbcfe('0x6')];_0x351b20<_0x24743b;_0x351b20++){var _0x586e64=events[_0x351b20];var _0x43af4c=createListener(_0xbcfe('0x7')+_0x586e64,_0x3de8ae);VoiceQueueReportEvents['on'](_0x586e64,_0x43af4c);}}; \ No newline at end of file +var _0x2056=['update','emit','removeListener','length','voiceQueueReport:','remove'];(function(_0x15535b,_0x3274f1){var _0xb3b7b1=function(_0x54393f){while(--_0x54393f){_0x15535b['push'](_0x15535b['shift']());}};_0xb3b7b1(++_0x3274f1);}(_0x2056,0x107));var _0x6205=function(_0x4c6d19,_0x149f70){_0x4c6d19=_0x4c6d19-0x0;var _0x40b6c7=_0x2056[_0x4c6d19];return _0x40b6c7;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x6205('0x0'),_0x6205('0x1')];function createListener(_0x1d6202,_0x3580a1){return function(_0x2198ce){_0x3580a1[_0x6205('0x2')](_0x1d6202,_0x2198ce);};}function removeListener(_0x2f3052,_0x89210b){return function(){VoiceQueueReportEvents[_0x6205('0x3')](_0x2f3052,_0x89210b);};}exports['register']=function(_0x45afa8){for(var _0x2c555d=0x0,_0x27eb28=events[_0x6205('0x4')];_0x2c555d<_0x27eb28;_0x2c555d++){var _0x271ffb=events[_0x2c555d];var _0x556d20=createListener(_0x6205('0x5')+_0x271ffb,_0x45afa8);VoiceQueueReportEvents['on'](_0x271ffb,_0x556d20);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f298427..cfc046a 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 _0x02c5=['util','connect-timeout','fs-extra','./voiceQueuesLog.controller','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer'];(function(_0x231280,_0x1709d7){var _0xb1aa81=function(_0x3c85bf){while(--_0x3c85bf){_0x231280['push'](_0x231280['shift']());}};_0xb1aa81(++_0x1709d7);}(_0x02c5,0x178));var _0x502c=function(_0x104b47,_0x491eff){_0x104b47=_0x104b47-0x0;var _0x34a3f1=_0x02c5[_0x104b47];return _0x34a3f1;};'use strict';var multer=require(_0x502c('0x0'));var util=require(_0x502c('0x1'));var path=require('path');var timeout=require(_0x502c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x502c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x502c('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x502c('0x5'),auth[_0x502c('0x6')](),controller['show']);router[_0x502c('0x7')]('/',auth[_0x502c('0x6')](),controller[_0x502c('0x8')]);router[_0x502c('0x9')](_0x502c('0x5'),auth['isAuthenticated'](),controller[_0x502c('0xa')]);router[_0x502c('0xb')](_0x502c('0x5'),auth[_0x502c('0x6')](),controller[_0x502c('0xc')]);module['exports']=router; \ No newline at end of file +var _0xaf93=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0xaf93,0x151));var _0x3af9=function(_0x267e3f,_0x1718f1){_0x267e3f=_0x267e3f-0x0;var _0x3c239e=_0xaf93[_0x267e3f];return _0x3c239e;};'use strict';var multer=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3af9('0x2'));var router=express[_0x3af9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3af9('0x4'));var interaction=require(_0x3af9('0x5'));var config=require(_0x3af9('0x6'));var controller=require(_0x3af9('0x7'));router[_0x3af9('0x8')]('/',auth[_0x3af9('0x9')](),controller[_0x3af9('0xa')]);router['get'](_0x3af9('0xb'),auth['isAuthenticated'](),controller[_0x3af9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3af9('0xd')]);router['put']('/:id',auth[_0x3af9('0x9')](),controller[_0x3af9('0xe')]);router[_0x3af9('0xf')](_0x3af9('0xb'),auth['isAuthenticated'](),controller[_0x3af9('0x10')]);module[_0x3af9('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d246f1c..c7dcb48 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 _0x9e33=['moment','exports','STRING','format','sequelize'];(function(_0x3c3f44,_0x26d844){var _0x434e43=function(_0x15f208){while(--_0x15f208){_0x3c3f44['push'](_0x3c3f44['shift']());}};_0x434e43(++_0x26d844);}(_0x9e33,0x144));var _0x39e3=function(_0x45096e,_0x17e82d){_0x45096e=_0x45096e-0x0;var _0xba1fa3=_0x9e33[_0x45096e];return _0xba1fa3;};'use strict';var Sequelize=require(_0x39e3('0x0'));var moment=require(_0x39e3('0x1'));module[_0x39e3('0x2')]={'time':{'type':Sequelize[_0x39e3('0x3')]},'callid':{'type':Sequelize[_0x39e3('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x39e3('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x39e3('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x39e3('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x39e3('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x39e3('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x39e3('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x39e3('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x9d55=['sequelize','STRING','DATE'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9d55,0x1b9));var _0x59d5=function(_0x4cf9be,_0x1c23e3){_0x4cf9be=_0x4cf9be-0x0;var _0x58b3b4=_0x9d55[_0x4cf9be];return _0x58b3b4;};'use strict';var Sequelize=require(_0x59d5('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x59d5('0x1')]},'callid':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x59d5('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x59d5('0x2')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index ad7b6fb..647b354 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 _0x5a4a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis'];(function(_0x493269,_0x28b1c1){var _0x3048f2=function(_0x2cf6f4){while(--_0x2cf6f4){_0x493269['push'](_0x493269['shift']());}};_0x3048f2(++_0x28b1c1);}(_0x5a4a,0xd0));var _0xa5a4=function(_0x2696cf,_0x2bb42d){_0x2696cf=_0x2696cf-0x0;var _0x4d872d=_0x5a4a[_0x2696cf];return _0x4d872d;};'use strict';var emlformat=require(_0xa5a4('0x0'));var rimraf=require(_0xa5a4('0x1'));var zipdir=require(_0xa5a4('0x2'));var jsonpatch=require(_0xa5a4('0x3'));var rp=require('request-promise');var moment=require(_0xa5a4('0x4'));var BPromise=require(_0xa5a4('0x5'));var Mustache=require(_0xa5a4('0x6'));var util=require(_0xa5a4('0x7'));var path=require('path');var sox=require(_0xa5a4('0x8'));var csv=require('to-csv');var ejs=require(_0xa5a4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5a4('0xa'));var squel=require(_0xa5a4('0xb'));var crypto=require(_0xa5a4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5a4('0xd'));var querystring=require(_0xa5a4('0xe'));var Papa=require(_0xa5a4('0xf'));var Redis=require(_0xa5a4('0x10'));var authService=require(_0xa5a4('0x11'));var qs=require(_0xa5a4('0x12'));var as=require(_0xa5a4('0x13'));var hardwareService=require(_0xa5a4('0x14'));var logger=require(_0xa5a4('0x15'))(_0xa5a4('0x16'));var utils=require('../../config/utils');var config=require(_0xa5a4('0x17'));var licenseUtil=require(_0xa5a4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425239,_0x114002){_0x114002=_0x114002||0xcc;return function(_0x1e38cc){if(_0x1e38cc){return _0x425239[_0xa5a4('0x19')](_0x114002);}return _0x425239[_0xa5a4('0x1a')](_0x114002)[_0xa5a4('0x1b')]();};}function respondWithResult(_0x463f21,_0x472575){_0x472575=_0x472575||0xc8;return function(_0x29e26b){if(_0x29e26b){return _0x463f21[_0xa5a4('0x1a')](_0x472575)['json'](_0x29e26b);}};}function respondWithFilteredResult(_0x4d18d9,_0x400ab2){return function(_0x2b6e48){if(_0x2b6e48){var _0xa290ff=typeof _0x400ab2[_0xa5a4('0x1c')]==='undefined'&&typeof _0x400ab2[_0xa5a4('0x1d')]==='undefined';var _0x408df5=_0x2b6e48[_0xa5a4('0x1e')];var _0x2af738=_0xa290ff?0x0:_0x400ab2[_0xa5a4('0x1c')];var _0x30bc81=_0xa290ff?_0x2b6e48[_0xa5a4('0x1e')]:_0x400ab2[_0xa5a4('0x1c')]+_0x400ab2[_0xa5a4('0x1d')];var _0x5f437f;if(_0x30bc81>=_0x408df5){_0x30bc81=_0x408df5;_0x5f437f=0xc8;}else{_0x5f437f=0xce;}_0x4d18d9[_0xa5a4('0x1a')](_0x5f437f);return _0x4d18d9[_0xa5a4('0x1f')](_0xa5a4('0x20'),_0x2af738+'-'+_0x30bc81+'/'+_0x408df5)[_0xa5a4('0x21')](_0x2b6e48);}return null;};}function patchUpdates(_0x285e40){return function(_0x48de8d){try{jsonpatch[_0xa5a4('0x22')](_0x48de8d,_0x285e40,!![]);}catch(_0x4c6a2d){return BPromise[_0xa5a4('0x23')](_0x4c6a2d);}return _0x48de8d['save']();};}function saveUpdates(_0x3e0347,_0x4b8fbf){return function(_0x3f6788){if(_0x3f6788){return _0x3f6788[_0xa5a4('0x24')](_0x3e0347)[_0xa5a4('0x25')](function(_0x55ee13){return _0x55ee13;});}return null;};}function removeEntity(_0x3cea4c,_0x36ba02){return function(_0x263af4){if(_0x263af4){return _0x263af4[_0xa5a4('0x26')]()[_0xa5a4('0x25')](function(){_0x3cea4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3c0a,_0x34955b){return function(_0x46e8c6){if(!_0x46e8c6){_0x4a3c0a['sendStatus'](0x194);}return _0x46e8c6;};}function handleError(_0x3d0726,_0x18fb85){_0x18fb85=_0x18fb85||0x1f4;return function(_0x30adf3){logger['error'](_0x30adf3[_0xa5a4('0x27')]);if(_0x30adf3['name']){delete _0x30adf3[_0xa5a4('0x28')];}_0x3d0726['status'](_0x18fb85)['send'](_0x30adf3);};}exports[_0xa5a4('0x29')]=function(_0x58ed37,_0x4b8424){var _0x323eda={},_0x3c4eb0={},_0x43a942={'count':0x0,'rows':[]};var _0x1e8c8c=_['map'](db[_0xa5a4('0x2a')][_0xa5a4('0x2b')],function(_0x53d9cb){return{'name':_0x53d9cb[_0xa5a4('0x2c')],'type':_0x53d9cb[_0xa5a4('0x2d')][_0xa5a4('0x2e')]};});_0x3c4eb0[_0xa5a4('0x2f')]=_[_0xa5a4('0x30')](_0x1e8c8c,_0xa5a4('0x28'));_0x3c4eb0[_0xa5a4('0x31')]=_[_0xa5a4('0x32')](_0x58ed37[_0xa5a4('0x31')]);_0x3c4eb0[_0xa5a4('0x33')]=_['intersection'](_0x3c4eb0[_0xa5a4('0x2f')],_0x3c4eb0[_0xa5a4('0x31')]);_0x323eda[_0xa5a4('0x34')]=_['intersection'](_0x3c4eb0[_0xa5a4('0x2f')],qs[_0xa5a4('0x35')](_0x58ed37['query'][_0xa5a4('0x35')]));_0x323eda[_0xa5a4('0x34')]=_0x323eda[_0xa5a4('0x34')]['length']?_0x323eda[_0xa5a4('0x34')]:_0x3c4eb0[_0xa5a4('0x2f')];if(!_0x58ed37['query']['hasOwnProperty'](_0xa5a4('0x36'))){_0x323eda[_0xa5a4('0x1d')]=qs[_0xa5a4('0x1d')](_0x58ed37[_0xa5a4('0x31')][_0xa5a4('0x1d')]);_0x323eda[_0xa5a4('0x1c')]=qs[_0xa5a4('0x1c')](_0x58ed37[_0xa5a4('0x31')][_0xa5a4('0x1c')]);}_0x323eda[_0xa5a4('0x37')]=qs[_0xa5a4('0x38')](_0x58ed37['query'][_0xa5a4('0x38')]);_0x323eda['where']=qs['filters'](_[_0xa5a4('0x39')](_0x58ed37['query'],_0x3c4eb0[_0xa5a4('0x33')]),_0x1e8c8c);if(_0x58ed37['query'][_0xa5a4('0x3a')]){_0x323eda[_0xa5a4('0x3b')]=_[_0xa5a4('0x3c')](_0x323eda[_0xa5a4('0x3b')],{'$or':_[_0xa5a4('0x30')](_0x1e8c8c,function(_0x41e9c8){if(_0x41e9c8[_0xa5a4('0x2d')]!==_0xa5a4('0x3d')){var _0x1849a1={};_0x1849a1[_0x41e9c8[_0xa5a4('0x28')]]={'$like':'%'+_0x58ed37['query'][_0xa5a4('0x3a')]+'%'};return _0x1849a1;}})});}_0x323eda=_[_0xa5a4('0x3c')]({},_0x323eda,_0x58ed37[_0xa5a4('0x3e')]);var _0x4c7396={'where':_0x323eda[_0xa5a4('0x3b')]};return db[_0xa5a4('0x2a')][_0xa5a4('0x1e')](_0x4c7396)[_0xa5a4('0x25')](function(_0x30380c){_0x43a942[_0xa5a4('0x1e')]=_0x30380c;if(_0x58ed37[_0xa5a4('0x31')][_0xa5a4('0x3f')]){_0x323eda[_0xa5a4('0x40')]=[{'all':!![]}];}return db[_0xa5a4('0x2a')][_0xa5a4('0x41')](_0x323eda);})[_0xa5a4('0x25')](function(_0x376933){_0x43a942[_0xa5a4('0x42')]=_0x376933;return _0x43a942;})['then'](respondWithFilteredResult(_0x4b8424,_0x323eda))[_0xa5a4('0x43')](handleError(_0x4b8424,null));};exports[_0xa5a4('0x44')]=function(_0x59a5b0,_0x31b812){var _0x340f06={'raw':!![],'where':{'id':_0x59a5b0['params']['id']}},_0x3d7476={};_0x3d7476[_0xa5a4('0x2f')]=_[_0xa5a4('0x32')](db[_0xa5a4('0x2a')][_0xa5a4('0x2b')]);_0x3d7476[_0xa5a4('0x31')]=_[_0xa5a4('0x32')](_0x59a5b0[_0xa5a4('0x31')]);_0x3d7476[_0xa5a4('0x33')]=_[_0xa5a4('0x45')](_0x3d7476[_0xa5a4('0x2f')],_0x3d7476['query']);_0x340f06[_0xa5a4('0x34')]=_[_0xa5a4('0x45')](_0x3d7476[_0xa5a4('0x2f')],qs[_0xa5a4('0x35')](_0x59a5b0['query']['fields']));_0x340f06[_0xa5a4('0x34')]=_0x340f06[_0xa5a4('0x34')][_0xa5a4('0x46')]?_0x340f06[_0xa5a4('0x34')]:_0x3d7476[_0xa5a4('0x2f')];if(_0x59a5b0[_0xa5a4('0x31')]['includeAll']){_0x340f06[_0xa5a4('0x40')]=[{'all':!![]}];}_0x340f06=_[_0xa5a4('0x3c')]({},_0x340f06,_0x59a5b0['options']);return db[_0xa5a4('0x2a')][_0xa5a4('0x47')](_0x340f06)['then'](handleEntityNotFound(_0x31b812,null))[_0xa5a4('0x25')](respondWithResult(_0x31b812,null))[_0xa5a4('0x43')](handleError(_0x31b812,null));};exports['create']=function(_0xc20977,_0x56d2d7){return db['VoiceQueuesLog'][_0xa5a4('0x48')](_0xc20977[_0xa5a4('0x49')],{})[_0xa5a4('0x25')](respondWithResult(_0x56d2d7,0xc9))[_0xa5a4('0x43')](handleError(_0x56d2d7,null));};exports[_0xa5a4('0x24')]=function(_0xcc973e,_0x53c504){if(_0xcc973e[_0xa5a4('0x49')]['id']){delete _0xcc973e[_0xa5a4('0x49')]['id'];}return db[_0xa5a4('0x2a')][_0xa5a4('0x47')]({'where':{'id':_0xcc973e[_0xa5a4('0x4a')]['id']}})[_0xa5a4('0x25')](handleEntityNotFound(_0x53c504,null))[_0xa5a4('0x25')](saveUpdates(_0xcc973e[_0xa5a4('0x49')],null))[_0xa5a4('0x25')](respondWithResult(_0x53c504,null))[_0xa5a4('0x43')](handleError(_0x53c504,null));};exports[_0xa5a4('0x26')]=function(_0x519997,_0x3e1a8b){return db[_0xa5a4('0x2a')]['find']({'where':{'id':_0x519997['params']['id']}})['then'](handleEntityNotFound(_0x3e1a8b,null))[_0xa5a4('0x25')](removeEntity(_0x3e1a8b,null))[_0xa5a4('0x43')](handleError(_0x3e1a8b,null));}; \ No newline at end of file +var _0x541a=['order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','crypto','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','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2dcf33,_0x388203){var _0x2a3360=function(_0x557c32){while(--_0x557c32){_0x2dcf33['push'](_0x2dcf33['shift']());}};_0x2a3360(++_0x388203);}(_0x541a,0xf0));var _0xa541=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0x541a[_0x3ef4f1];return _0x69953c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa541('0x0'));var jsonpatch=require(_0xa541('0x1'));var rp=require(_0xa541('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa541('0x3'));var sox=require(_0xa541('0x4'));var csv=require('to-csv');var ejs=require(_0xa541('0x5'));var fs=require('fs');var fs_extra=require(_0xa541('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa541('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xa541('0x8'));var toCsv=require(_0xa541('0x9'));var querystring=require(_0xa541('0xa'));var Papa=require(_0xa541('0xb'));var Redis=require('ioredis');var authService=require(_0xa541('0xc'));var qs=require(_0xa541('0xd'));var as=require(_0xa541('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa541('0xf'))(_0xa541('0x10'));var utils=require(_0xa541('0x11'));var config=require(_0xa541('0x12'));var licenseUtil=require(_0xa541('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42b14c,_0x3b42e3){_0x3b42e3=_0x3b42e3||0xcc;return function(_0x119286){if(_0x119286){return _0x42b14c[_0xa541('0x14')](_0x3b42e3);}return _0x42b14c[_0xa541('0x15')](_0x3b42e3)[_0xa541('0x16')]();};}function respondWithResult(_0x193e09,_0x17344d){_0x17344d=_0x17344d||0xc8;return function(_0x1b308b){if(_0x1b308b){return _0x193e09[_0xa541('0x15')](_0x17344d)['json'](_0x1b308b);}};}function respondWithFilteredResult(_0x24f1b2,_0x25d462){return function(_0x456017){if(_0x456017){var _0x3c0df3=typeof _0x25d462[_0xa541('0x17')]==='undefined'&&typeof _0x25d462[_0xa541('0x18')]===_0xa541('0x19');var _0x5c033f=_0x456017[_0xa541('0x1a')];var _0x331734=_0x3c0df3?0x0:_0x25d462[_0xa541('0x17')];var _0x3900ca=_0x3c0df3?_0x456017['count']:_0x25d462[_0xa541('0x17')]+_0x25d462['limit'];var _0x1005ca;if(_0x3900ca>=_0x5c033f){_0x3900ca=_0x5c033f;_0x1005ca=0xc8;}else{_0x1005ca=0xce;}_0x24f1b2[_0xa541('0x15')](_0x1005ca);return _0x24f1b2[_0xa541('0x1b')](_0xa541('0x1c'),_0x331734+'-'+_0x3900ca+'/'+_0x5c033f)[_0xa541('0x1d')](_0x456017);}return null;};}function patchUpdates(_0x51f49a){return function(_0x1d7cea){try{jsonpatch[_0xa541('0x1e')](_0x1d7cea,_0x51f49a,!![]);}catch(_0x2d1910){return BPromise[_0xa541('0x1f')](_0x2d1910);}return _0x1d7cea[_0xa541('0x20')]();};}function saveUpdates(_0x1a8277,_0x148de6){return function(_0xfaa6eb){if(_0xfaa6eb){return _0xfaa6eb[_0xa541('0x21')](_0x1a8277)[_0xa541('0x22')](function(_0x4546bb){return _0x4546bb;});}return null;};}function removeEntity(_0x4ff3bb,_0x22d314){return function(_0x3caad8){if(_0x3caad8){return _0x3caad8[_0xa541('0x23')]()[_0xa541('0x22')](function(){_0x4ff3bb[_0xa541('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba701,_0x29e1c6){return function(_0x489a5e){if(!_0x489a5e){_0x4ba701[_0xa541('0x14')](0x194);}return _0x489a5e;};}function handleError(_0x57d284,_0x2c52f0){_0x2c52f0=_0x2c52f0||0x1f4;return function(_0x1ee61f){logger[_0xa541('0x24')](_0x1ee61f[_0xa541('0x25')]);if(_0x1ee61f[_0xa541('0x26')]){delete _0x1ee61f['name'];}_0x57d284['status'](_0x2c52f0)[_0xa541('0x27')](_0x1ee61f);};}exports[_0xa541('0x28')]=function(_0x3366d0,_0x3b5cdd){var _0xa6a0c={},_0x3fc4b4={},_0x189adc={'count':0x0,'rows':[]};var _0x1d9754=_[_0xa541('0x29')](db[_0xa541('0x2a')][_0xa541('0x2b')],function(_0x2cf84a){return{'name':_0x2cf84a[_0xa541('0x2c')],'type':_0x2cf84a[_0xa541('0x2d')][_0xa541('0x2e')]};});_0x3fc4b4['model']=_[_0xa541('0x29')](_0x1d9754,_0xa541('0x26'));_0x3fc4b4['query']=_['keys'](_0x3366d0[_0xa541('0x2f')]);_0x3fc4b4[_0xa541('0x30')]=_[_0xa541('0x31')](_0x3fc4b4[_0xa541('0x32')],_0x3fc4b4[_0xa541('0x2f')]);_0xa6a0c[_0xa541('0x33')]=_[_0xa541('0x31')](_0x3fc4b4[_0xa541('0x32')],qs[_0xa541('0x34')](_0x3366d0[_0xa541('0x2f')][_0xa541('0x34')]));_0xa6a0c[_0xa541('0x33')]=_0xa6a0c[_0xa541('0x33')][_0xa541('0x35')]?_0xa6a0c[_0xa541('0x33')]:_0x3fc4b4[_0xa541('0x32')];if(!_0x3366d0['query'][_0xa541('0x36')](_0xa541('0x37'))){_0xa6a0c['limit']=qs[_0xa541('0x18')](_0x3366d0[_0xa541('0x2f')]['limit']);_0xa6a0c[_0xa541('0x17')]=qs[_0xa541('0x17')](_0x3366d0[_0xa541('0x2f')]['offset']);}_0xa6a0c[_0xa541('0x38')]=qs[_0xa541('0x39')](_0x3366d0[_0xa541('0x2f')][_0xa541('0x39')]);_0xa6a0c[_0xa541('0x3a')]=qs[_0xa541('0x30')](_[_0xa541('0x3b')](_0x3366d0[_0xa541('0x2f')],_0x3fc4b4[_0xa541('0x30')]),_0x1d9754);if(_0x3366d0[_0xa541('0x2f')][_0xa541('0x3c')]){_0xa6a0c['where']=_[_0xa541('0x3d')](_0xa6a0c[_0xa541('0x3a')],{'$or':_[_0xa541('0x29')](_0x1d9754,function(_0x269228){if(_0x269228[_0xa541('0x2d')]!=='VIRTUAL'){var _0x2202e8={};_0x2202e8[_0x269228[_0xa541('0x26')]]={'$like':'%'+_0x3366d0[_0xa541('0x2f')][_0xa541('0x3c')]+'%'};return _0x2202e8;}})});}_0xa6a0c=_['merge']({},_0xa6a0c,_0x3366d0[_0xa541('0x3e')]);var _0x5c05b2={'where':_0xa6a0c[_0xa541('0x3a')]};return db['VoiceQueuesLog'][_0xa541('0x1a')](_0x5c05b2)[_0xa541('0x22')](function(_0x318f47){_0x189adc[_0xa541('0x1a')]=_0x318f47;if(_0x3366d0[_0xa541('0x2f')][_0xa541('0x3f')]){_0xa6a0c[_0xa541('0x40')]=[{'all':!![]}];}return db[_0xa541('0x2a')][_0xa541('0x41')](_0xa6a0c);})[_0xa541('0x22')](function(_0x54fa1f){_0x189adc[_0xa541('0x42')]=_0x54fa1f;return _0x189adc;})['then'](respondWithFilteredResult(_0x3b5cdd,_0xa6a0c))[_0xa541('0x43')](handleError(_0x3b5cdd,null));};exports[_0xa541('0x44')]=function(_0xa51b69,_0x56088f){var _0x129bb9={'raw':!![],'where':{'id':_0xa51b69[_0xa541('0x45')]['id']}},_0x355bee={};_0x355bee[_0xa541('0x32')]=_['keys'](db[_0xa541('0x2a')][_0xa541('0x2b')]);_0x355bee['query']=_[_0xa541('0x46')](_0xa51b69[_0xa541('0x2f')]);_0x355bee['filters']=_[_0xa541('0x31')](_0x355bee[_0xa541('0x32')],_0x355bee[_0xa541('0x2f')]);_0x129bb9['attributes']=_[_0xa541('0x31')](_0x355bee[_0xa541('0x32')],qs[_0xa541('0x34')](_0xa51b69[_0xa541('0x2f')][_0xa541('0x34')]));_0x129bb9['attributes']=_0x129bb9[_0xa541('0x33')][_0xa541('0x35')]?_0x129bb9[_0xa541('0x33')]:_0x355bee[_0xa541('0x32')];if(_0xa51b69[_0xa541('0x2f')][_0xa541('0x3f')]){_0x129bb9[_0xa541('0x40')]=[{'all':!![]}];}_0x129bb9=_[_0xa541('0x3d')]({},_0x129bb9,_0xa51b69['options']);return db[_0xa541('0x2a')][_0xa541('0x47')](_0x129bb9)[_0xa541('0x22')](handleEntityNotFound(_0x56088f,null))[_0xa541('0x22')](respondWithResult(_0x56088f,null))[_0xa541('0x43')](handleError(_0x56088f,null));};exports[_0xa541('0x48')]=function(_0x21afe4,_0x5dac25){return db['VoiceQueuesLog']['create'](_0x21afe4['body'],{})[_0xa541('0x22')](respondWithResult(_0x5dac25,0xc9))[_0xa541('0x43')](handleError(_0x5dac25,null));};exports[_0xa541('0x21')]=function(_0x5257f1,_0x435f92){if(_0x5257f1[_0xa541('0x49')]['id']){delete _0x5257f1[_0xa541('0x49')]['id'];}return db[_0xa541('0x2a')][_0xa541('0x47')]({'where':{'id':_0x5257f1[_0xa541('0x45')]['id']}})[_0xa541('0x22')](handleEntityNotFound(_0x435f92,null))[_0xa541('0x22')](saveUpdates(_0x5257f1[_0xa541('0x49')],null))[_0xa541('0x22')](respondWithResult(_0x435f92,null))[_0xa541('0x43')](handleError(_0x435f92,null));};exports[_0xa541('0x23')]=function(_0x3cf461,_0x208fe3){return db['VoiceQueuesLog'][_0xa541('0x47')]({'where':{'id':_0x3cf461[_0xa541('0x45')]['id']}})[_0xa541('0x22')](handleEntityNotFound(_0x208fe3,null))[_0xa541('0x22')](removeEntity(_0x208fe3,null))[_0xa541('0x43')](handleError(_0x208fe3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b096bd5..a26794e 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 _0xd420=['moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','lodash','util','api'];(function(_0x23e33d,_0x31c8c8){var _0x818fc=function(_0x19f33e){while(--_0x19f33e){_0x23e33d['push'](_0x23e33d['shift']());}};_0x818fc(++_0x31c8c8);}(_0xd420,0x1d9));var _0x0d42=function(_0x6f03f4,_0x235705){_0x6f03f4=_0x6f03f4-0x0;var _0x3679f6=_0xd420[_0x6f03f4];return _0x3679f6;};'use strict';var _=require(_0x0d42('0x0'));var util=require(_0x0d42('0x1'));var logger=require('../../config/logger')(_0x0d42('0x2'));var moment=require(_0x0d42('0x3'));var BPromise=require(_0x0d42('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d42('0x5'));var rimraf=require(_0x0d42('0x6'));var config=require(_0x0d42('0x7'));var attributes=require(_0x0d42('0x8'));module[_0x0d42('0x9')]=function(_0x31804f,_0x1b3425){return _0x31804f[_0x0d42('0xa')](_0x0d42('0xb'),attributes,{'tableName':_0x0d42('0xc'),'paranoid':![],'indexes':[{'name':_0x0d42('0xd'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x18f2=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x18f2,0x1e2));var _0x218f=function(_0x2468e6,_0x1d64c9){_0x2468e6=_0x2468e6-0x0;var _0x1e1a44=_0x18f2[_0x2468e6];return _0x1e1a44;};'use strict';var _=require('lodash');var util=require(_0x218f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x218f('0x1'));var BPromise=require(_0x218f('0x2'));var rp=require(_0x218f('0x3'));var fs=require('fs');var path=require(_0x218f('0x4'));var rimraf=require(_0x218f('0x5'));var config=require(_0x218f('0x6'));var attributes=require(_0x218f('0x7'));module[_0x218f('0x8')]=function(_0x1c6081,_0x3afdbf){return _0x1c6081[_0x218f('0x9')](_0x218f('0xa'),attributes,{'tableName':_0x218f('0xb'),'paranoid':![],'indexes':[{'name':_0x218f('0xc'),'fields':[_0x218f('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3e8a4c3..ff3566c 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 _0xd20f=['request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','client','http'];(function(_0x25df0b,_0xb959dd){var _0x375e6e=function(_0x30dadd){while(--_0x30dadd){_0x25df0b['push'](_0x25df0b['shift']());}};_0x375e6e(++_0xb959dd);}(_0xd20f,0xbf));var _0xfd20=function(_0x42500b,_0x56fa75){_0x42500b=_0x42500b-0x0;var _0x3ab73e=_0xd20f[_0x42500b];return _0x3ab73e;};'use strict';var _=require(_0xfd20('0x0'));var util=require(_0xfd20('0x1'));var moment=require('moment');var BPromise=require(_0xfd20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd20('0x3'))['db'];var utils=require(_0xfd20('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd20('0x5')][_0xfd20('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x16ee70,_0x15c501,_0x1758bc){return new BPromise(function(_0x6d511,_0x2841f9){return client[_0xfd20('0x7')](_0x16ee70,_0x1758bc)['then'](function(_0x5a838a){logger[_0xfd20('0x8')](_0xfd20('0x9'),_0x15c501,_0xfd20('0xa'));logger[_0xfd20('0xb')](_0xfd20('0xc'),_0x15c501,_0xfd20('0xa'),JSON['stringify'](_0x5a838a));if(_0x5a838a[_0xfd20('0xd')]){if(_0x5a838a[_0xfd20('0xd')][_0xfd20('0xe')]===0x1f4){logger[_0xfd20('0xd')](_0xfd20('0x9'),_0x15c501,_0x5a838a[_0xfd20('0xd')][_0xfd20('0xf')]);return _0x2841f9(_0x5a838a['error'][_0xfd20('0xf')]);}logger[_0xfd20('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x15c501,_0x5a838a['error'][_0xfd20('0xf')]);return _0x6d511(_0x5a838a['error']['message']);}else{logger[_0xfd20('0x8')]('VoiceQueuesLog,\x20%s,\x20%s',_0x15c501,_0xfd20('0xa'));_0x6d511(_0x5a838a[_0xfd20('0x10')]['message']);}})[_0xfd20('0x11')](function(_0x227786){logger[_0xfd20('0xd')](_0xfd20('0x9'),_0x15c501,_0x227786);_0x2841f9(_0x227786);});});} \ No newline at end of file +var _0xb00d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x468630,_0x580913){var _0x39032e=function(_0x61eada){while(--_0x61eada){_0x468630['push'](_0x468630['shift']());}};_0x39032e(++_0x580913);}(_0xb00d,0x19e));var _0xdb00=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0xb00d[_0x16bb0e];return _0x102b8b;};'use strict';var _=require(_0xdb00('0x0'));var util=require(_0xdb00('0x1'));var moment=require(_0xdb00('0x2'));var BPromise=require(_0xdb00('0x3'));var rs=require(_0xdb00('0x4'));var fs=require('fs');var Redis=require(_0xdb00('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb00('0x6'));var logger=require('../../config/logger')(_0xdb00('0x7'));var config=require(_0xdb00('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb00('0x9')][_0xdb00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcdc5f8,_0x4f4ad9,_0x5614fc){return new BPromise(function(_0x266427,_0x1e40f2){return client[_0xdb00('0xb')](_0xcdc5f8,_0x5614fc)[_0xdb00('0xc')](function(_0x21e0e4){logger['info'](_0xdb00('0xd'),_0x4f4ad9,_0xdb00('0xe'));logger[_0xdb00('0xf')](_0xdb00('0x10'),_0x4f4ad9,'request\x20sent',JSON[_0xdb00('0x11')](_0x21e0e4));if(_0x21e0e4[_0xdb00('0x12')]){if(_0x21e0e4['error'][_0xdb00('0x13')]===0x1f4){logger['error'](_0xdb00('0xd'),_0x4f4ad9,_0x21e0e4[_0xdb00('0x12')][_0xdb00('0x14')]);return _0x1e40f2(_0x21e0e4['error'][_0xdb00('0x14')]);}logger[_0xdb00('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4f4ad9,_0x21e0e4[_0xdb00('0x12')][_0xdb00('0x14')]);return _0x266427(_0x21e0e4['error'][_0xdb00('0x14')]);}else{logger[_0xdb00('0x15')](_0xdb00('0xd'),_0x4f4ad9,_0xdb00('0xe'));_0x266427(_0x21e0e4['result'][_0xdb00('0x14')]);}})[_0xdb00('0x16')](function(_0x2d98b7){logger[_0xdb00('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4f4ad9,_0x2d98b7);_0x1e40f2(_0x2d98b7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7bc1655..c003e85 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 _0x5820=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','/:id/transcribe','post','create','update','delete','exports','util','path','connect-timeout','Router'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5820,0x9d));var _0x0582=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5820[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0582('0x0'));var path=require(_0x0582('0x1'));var timeout=require(_0x0582('0x2'));var express=require('express');var router=express[_0x0582('0x3')]();var fs_extra=require(_0x0582('0x4'));var auth=require(_0x0582('0x5'));var interaction=require(_0x0582('0x6'));var config=require('../../config/environment');var controller=require(_0x0582('0x7'));router[_0x0582('0x8')]('/',auth[_0x0582('0x9')](),controller[_0x0582('0xa')]);router['get'](_0x0582('0xb'),auth[_0x0582('0x9')](),controller[_0x0582('0xc')]);router['get'](_0x0582('0xd'),auth[_0x0582('0x9')](),controller[_0x0582('0xe')]);router['get']('/:id/download',auth[_0x0582('0x9')](),controller[_0x0582('0xf')]);router['get'](_0x0582('0x10'),controller['downloads']);router['get'](_0x0582('0x11'),auth[_0x0582('0x9')](),controller['downloadTranscribe']);router[_0x0582('0x12')]('/',auth[_0x0582('0x9')](),controller[_0x0582('0x13')]);router['post'](_0x0582('0x11'),auth[_0x0582('0x9')](),controller['runTranscribe']);router['put'](_0x0582('0xd'),auth[_0x0582('0x9')](),controller[_0x0582('0x14')]);router[_0x0582('0x15')](_0x0582('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0582('0x16')]=router; \ No newline at end of file +var _0x4805=['isAuthenticated','index','/describe','describe','/:id','show','downloads','/:id/transcribe','downloadTranscribe','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x18841e,_0x64e61f){var _0x49db81=function(_0x814ab8){while(--_0x814ab8){_0x18841e['push'](_0x18841e['shift']());}};_0x49db81(++_0x64e61f);}(_0x4805,0x1ee));var _0x5480=function(_0x27b4de,_0x44f78a){_0x27b4de=_0x27b4de-0x0;var _0xbff25b=_0x4805[_0x27b4de];return _0xbff25b;};'use strict';var multer=require(_0x5480('0x0'));var util=require('util');var path=require(_0x5480('0x1'));var timeout=require(_0x5480('0x2'));var express=require(_0x5480('0x3'));var router=express[_0x5480('0x4')]();var fs_extra=require(_0x5480('0x5'));var auth=require(_0x5480('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5480('0x7'));var controller=require(_0x5480('0x8'));router[_0x5480('0x9')]('/',auth[_0x5480('0xa')](),controller[_0x5480('0xb')]);router['get'](_0x5480('0xc'),auth[_0x5480('0xa')](),controller[_0x5480('0xd')]);router[_0x5480('0x9')](_0x5480('0xe'),auth[_0x5480('0xa')](),controller[_0x5480('0xf')]);router[_0x5480('0x9')]('/:id/download',auth[_0x5480('0xa')](),controller['download']);router['get']('/:id/downloads',controller[_0x5480('0x10')]);router[_0x5480('0x9')](_0x5480('0x11'),auth['isAuthenticated'](),controller[_0x5480('0x12')]);router[_0x5480('0x13')]('/',auth[_0x5480('0xa')](),controller['create']);router['post'](_0x5480('0x11'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x5480('0x14')](_0x5480('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x5480('0x15')](_0x5480('0xe'),auth['isAuthenticated'](),controller[_0x5480('0x16')]);module[_0x5480('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d347823..03b72f3 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(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 7a29ca9..da3775a 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 _0xf836=['../../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','count','set','apply','reject','update','destroy','then','error','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','format','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','length','includeAll','include','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','col','token','push','$and','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','runTranscribe','ValidationError','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis'];(function(_0xc09d46,_0x23daca){var _0x25fb63=function(_0x2f04de){while(--_0x2f04de){_0xc09d46['push'](_0xc09d46['shift']());}};_0x25fb63(++_0x23daca);}(_0xf836,0x117));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f83('0x0'));var jsonpatch=require(_0x6f83('0x1'));var rp=require(_0x6f83('0x2'));var moment=require('moment');var BPromise=require(_0x6f83('0x3'));var Mustache=require(_0x6f83('0x4'));var util=require(_0x6f83('0x5'));var path=require(_0x6f83('0x6'));var sox=require(_0x6f83('0x7'));var csv=require(_0x6f83('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f83('0x9'));var _=require('lodash');var squel=require(_0x6f83('0xa'));var crypto=require('crypto');var jsforce=require(_0x6f83('0xb'));var deskjs=require(_0x6f83('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6f83('0xd'));var Papa=require(_0x6f83('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x6f83('0xf'));var Redis=require(_0x6f83('0x10'));var authService=require(_0x6f83('0x11'));var qs=require(_0x6f83('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f83('0x13'));var logger=require(_0x6f83('0x14'))('api');var utils=require(_0x6f83('0x15'));var config=require(_0x6f83('0x16'));var licenseUtil=require(_0x6f83('0x17'));var db=require(_0x6f83('0x18'))['db'];function respondWithStatusCode(_0xb324bc,_0xc0a4ff){_0xc0a4ff=_0xc0a4ff||0xcc;return function(_0x10b485){if(_0x10b485){return _0xb324bc[_0x6f83('0x19')](_0xc0a4ff);}return _0xb324bc['status'](_0xc0a4ff)[_0x6f83('0x1a')]();};}function respondWithResult(_0x23b42d,_0x27210a){_0x27210a=_0x27210a||0xc8;return function(_0x4e66c2){if(_0x4e66c2){return _0x23b42d[_0x6f83('0x1b')](_0x27210a)[_0x6f83('0x1c')](_0x4e66c2);}};}function respondWithFilteredResult(_0x1b77e8,_0x258a2b){return function(_0x5ca6a8){if(_0x5ca6a8){var _0x153d1a=typeof _0x258a2b[_0x6f83('0x1d')]==='undefined'&&typeof _0x258a2b[_0x6f83('0x1e')]==='undefined';var _0xf7901e=_0x5ca6a8[_0x6f83('0x1f')];var _0x3e9e5c=_0x153d1a?0x0:_0x258a2b['offset'];var _0x332115=_0x153d1a?_0x5ca6a8[_0x6f83('0x1f')]:_0x258a2b[_0x6f83('0x1d')]+_0x258a2b['limit'];var _0x35e4ab;if(_0x332115>=_0xf7901e){_0x332115=_0xf7901e;_0x35e4ab=0xc8;}else{_0x35e4ab=0xce;}_0x1b77e8['status'](_0x35e4ab);return _0x1b77e8[_0x6f83('0x20')]('Content-Range',_0x3e9e5c+'-'+_0x332115+'/'+_0xf7901e)['json'](_0x5ca6a8);}return null;};}function patchUpdates(_0x179680){return function(_0x47902d){try{jsonpatch[_0x6f83('0x21')](_0x47902d,_0x179680,!![]);}catch(_0x38396d){return BPromise[_0x6f83('0x22')](_0x38396d);}return _0x47902d['save']();};}function saveUpdates(_0x2a29b5,_0x2e0a81){return function(_0x26dab2){if(_0x26dab2){return _0x26dab2[_0x6f83('0x23')](_0x2a29b5)['then'](function(_0x219174){return _0x219174;});}return null;};}function removeEntity(_0x5a7b86,_0x109893){return function(_0x440846){if(_0x440846){return _0x440846[_0x6f83('0x24')]()[_0x6f83('0x25')](function(){_0x5a7b86['status'](0xcc)[_0x6f83('0x1a')]();});}};}function handleEntityNotFound(_0x4438a8,_0x2ca008){return function(_0x5ba4a7){if(!_0x5ba4a7){_0x4438a8[_0x6f83('0x19')](0x194);}return _0x5ba4a7;};}function handleError(_0x329a0b,_0xbc3404){_0xbc3404=_0xbc3404||0x1f4;return function(_0x185e3c){logger[_0x6f83('0x26')](_0x185e3c['stack']);if(_0x185e3c['name']){delete _0x185e3c[_0x6f83('0x27')];}_0x329a0b[_0x6f83('0x1b')](_0xbc3404)[_0x6f83('0x28')](_0x185e3c);};}exports[_0x6f83('0x29')]=function(_0x3c5efb,_0x2c701f){var _0x1ce15b={},_0x4ac222={},_0x446245={'count':0x0,'rows':[]};var _0x512590=_[_0x6f83('0x2a')](db[_0x6f83('0x2b')][_0x6f83('0x2c')],function(_0x29fd28){return{'name':_0x29fd28['fieldName'],'type':_0x29fd28[_0x6f83('0x2d')][_0x6f83('0x2e')]};});_0x4ac222[_0x6f83('0x2f')]=_['differenceBy'](_[_0x6f83('0x2a')](_0x512590,_0x6f83('0x27')),[_0x6f83('0x30')]);_0x4ac222[_0x6f83('0x31')]=_[_0x6f83('0x32')](_0x3c5efb[_0x6f83('0x31')]);_0x4ac222[_0x6f83('0x33')]=_['intersection'](_0x4ac222[_0x6f83('0x2f')],_0x4ac222[_0x6f83('0x31')]);_0x1ce15b['attributes']=_[_0x6f83('0x34')](_0x4ac222['model'],qs[_0x6f83('0x35')](_0x3c5efb[_0x6f83('0x31')]['fields']));_0x1ce15b[_0x6f83('0x36')]=_0x1ce15b['attributes']['length']?_0x1ce15b[_0x6f83('0x36')]:_0x4ac222[_0x6f83('0x2f')];if(!_0x3c5efb[_0x6f83('0x31')]['hasOwnProperty']('nolimit')){_0x1ce15b['limit']=qs[_0x6f83('0x1e')](_0x3c5efb[_0x6f83('0x31')][_0x6f83('0x1e')]);_0x1ce15b['offset']=qs[_0x6f83('0x1d')](_0x3c5efb[_0x6f83('0x31')][_0x6f83('0x1d')]);}_0x1ce15b[_0x6f83('0x37')]=qs[_0x6f83('0x38')](_0x3c5efb[_0x6f83('0x31')][_0x6f83('0x38')]);_0x1ce15b[_0x6f83('0x39')]=qs[_0x6f83('0x33')](_[_0x6f83('0x3a')](_0x3c5efb[_0x6f83('0x31')],_0x4ac222[_0x6f83('0x33')]),_0x512590);if(_0x3c5efb[_0x6f83('0x31')][_0x6f83('0x3b')]){_0x1ce15b[_0x6f83('0x39')]=_[_0x6f83('0x3c')](_0x1ce15b[_0x6f83('0x39')],{'$or':_[_0x6f83('0x2a')](_0x512590,function(_0x3b1033){if(_0x3b1033[_0x6f83('0x2d')]!==_0x6f83('0x3d')){var _0x50d6f8={};_0x50d6f8[_0x3b1033[_0x6f83('0x27')]]={'$like':'%'+_0x3c5efb[_0x6f83('0x31')]['filter']+'%'};return _0x50d6f8;}})});}_0x1ce15b=_[_0x6f83('0x3c')]({},_0x1ce15b,_0x3c5efb['options']);var _0x4faeb2={'where':_0x1ce15b[_0x6f83('0x39')]};return db[_0x6f83('0x2b')][_0x6f83('0x1f')](_0x4faeb2)[_0x6f83('0x25')](function(_0x55b795){_0x446245['count']=_0x55b795;if(_0x3c5efb['query']['includeAll']){_0x1ce15b['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x6f83('0x3e')](_0x1ce15b);})[_0x6f83('0x25')](function(_0x33e3cf){_0x446245[_0x6f83('0x3f')]=_0x33e3cf;return _0x446245;})['then'](respondWithFilteredResult(_0x2c701f,_0x1ce15b))[_0x6f83('0x40')](handleError(_0x2c701f,null));};exports[_0x6f83('0x41')]=function(_0x2fcc53,_0x1778a5){var _0x28117f={'raw':![],'where':{'id':_0x2fcc53[_0x6f83('0x42')]['id']}},_0x1d4d6a={};_0x1d4d6a[_0x6f83('0x2f')]=_[_0x6f83('0x32')](db[_0x6f83('0x2b')][_0x6f83('0x2c')]);_0x1d4d6a[_0x6f83('0x31')]=_[_0x6f83('0x32')](_0x2fcc53[_0x6f83('0x31')]);_0x1d4d6a[_0x6f83('0x33')]=_[_0x6f83('0x34')](_0x1d4d6a[_0x6f83('0x2f')],_0x1d4d6a['query']);_0x28117f[_0x6f83('0x36')]=_[_0x6f83('0x34')](_0x1d4d6a['model'],qs[_0x6f83('0x35')](_0x2fcc53[_0x6f83('0x31')]['fields']));_0x28117f[_0x6f83('0x36')]=_0x28117f['attributes'][_0x6f83('0x43')]?_0x28117f['attributes']:_0x1d4d6a[_0x6f83('0x2f')];if(_0x2fcc53[_0x6f83('0x31')][_0x6f83('0x44')]){_0x28117f[_0x6f83('0x45')]=[{'all':!![]}];}_0x28117f=_[_0x6f83('0x3c')]({},_0x28117f,_0x2fcc53[_0x6f83('0x46')]);return db[_0x6f83('0x2b')][_0x6f83('0x47')](_0x28117f)[_0x6f83('0x25')](handleEntityNotFound(_0x1778a5,null))['then'](respondWithResult(_0x1778a5,null))[_0x6f83('0x40')](handleError(_0x1778a5,null));};exports['create']=function(_0x1dbeef,_0xc280d7){return db[_0x6f83('0x2b')][_0x6f83('0x48')](_0x1dbeef[_0x6f83('0x49')],{})['then'](respondWithResult(_0xc280d7,0xc9))[_0x6f83('0x40')](handleError(_0xc280d7,null));};exports[_0x6f83('0x23')]=function(_0x104936,_0x34ff5c){if(_0x104936[_0x6f83('0x49')]['id']){delete _0x104936['body']['id'];}return db[_0x6f83('0x2b')][_0x6f83('0x47')]({'where':{'id':_0x104936[_0x6f83('0x42')]['id']}})[_0x6f83('0x25')](handleEntityNotFound(_0x34ff5c,null))[_0x6f83('0x25')](saveUpdates(_0x104936['body'],null))['then'](respondWithResult(_0x34ff5c,null))[_0x6f83('0x40')](handleError(_0x34ff5c,null));};exports['describe']=function(_0x508025,_0x2e9896){return db[_0x6f83('0x2b')][_0x6f83('0x4a')]()[_0x6f83('0x25')](respondWithResult(_0x2e9896,null))[_0x6f83('0x40')](handleError(_0x2e9896,null));};exports[_0x6f83('0x4b')]=function(_0x2e1e89,_0x14ab34,_0x8b4f50){var _0xb2b73f=require(_0x6f83('0x4c'));var _0x6d7325=![];var _0x42f2b9={};if(_0x2e1e89[_0x6f83('0x31')][_0x6f83('0x2d')]&&_0x2e1e89[_0x6f83('0x31')][_0x6f83('0x2d')]===_0x6f83('0x4d')){_0x42f2b9[_0x6f83('0x4d')]=_0x2e1e89[_0x6f83('0x42')]['id'];}else{_0x42f2b9['id']=_0x2e1e89['params']['id'];}return db[_0x6f83('0x2b')][_0x6f83('0x47')]({'where':_0x42f2b9,'attributes':['id',_0x6f83('0x4e')],'raw':!![]})[_0x6f83('0x25')](handleEntityNotFound(_0x14ab34,null))['then'](function(_0x2b2094){if(_0x2b2094){var _0x660a33=_0x2b2094[_0x6f83('0x4e')];var _0x1f1be6=util[_0x6f83('0x30')](_0x6f83('0x4f'),_0x660a33);if(fs['existsSync'](_0x1f1be6)){_0x6d7325=!![];return _0xb2b73f[_0x6f83('0x50')](_0x1f1be6,_0x660a33,config[_0x6f83('0x51')][_0x6f83('0x52')])['then'](function(){return _0x2b2094;});}return _0x2b2094;}})[_0x6f83('0x25')](function(_0xc2bc98){if(_0xc2bc98){var _0x2e3d8b=_0xc2bc98[_0x6f83('0x4e')];if(!fs['existsSync'](_0x2e3d8b)){throw new db[(_0x6f83('0x53'))]['ValidationError'](_0x6f83('0x54'));}if(_0xc2bc98[_0x6f83('0x55')]){return _0x14ab34[_0x6f83('0x4b')](_0x2e3d8b,_0xc2bc98[_0x6f83('0x55')]+path[_0x6f83('0x56')](_0x2e3d8b),function(){if(_0x6d7325){fs[_0x6f83('0x57')](_0x2e3d8b);}});}else{return _0x14ab34[_0x6f83('0x4b')](_0x2e3d8b,function(_0x42ea85){if(_0x6d7325){fs[_0x6f83('0x57')](_0x2e3d8b);}});}}})[_0x6f83('0x40')](function(_0x5a4102){if(_0x5a4102['message']==='VoiceRecording\x20not\x20found'){_0x14ab34[_0x6f83('0x1b')](0x194)[_0x6f83('0x28')](_0x6f83('0x58'));}else{return handleError(_0x14ab34,null);}});};exports['downloads']=function(_0x565817,_0x5c3903,_0x326bc1){var _0x2c985b=require(_0x6f83('0x4c'));var _0xc0b82=![];var _0x402ad9={'$and':[db['sequelize'][_0x6f83('0x39')](db[_0x6f83('0x59')]['fn']('MD5',db[_0x6f83('0x59')][_0x6f83('0x5a')](_0x6f83('0x4d'))),_0x565817[_0x6f83('0x31')][_0x6f83('0x5b')])]};if(_0x565817[_0x6f83('0x31')][_0x6f83('0x2d')]&&_0x565817[_0x6f83('0x31')]['type']===_0x6f83('0x4d')){_0x402ad9['$and'][_0x6f83('0x5c')]({'uniqueid':_0x565817['params']['id']});}else{_0x402ad9[_0x6f83('0x5d')][_0x6f83('0x5c')]({'id':_0x565817[_0x6f83('0x42')]['id']});}return db[_0x6f83('0x2b')][_0x6f83('0x47')]({'where':_0x402ad9,'attributes':['id',_0x6f83('0x4e')],'raw':!![]})[_0x6f83('0x25')](handleEntityNotFound(_0x5c3903,null))[_0x6f83('0x25')](function(_0x1c2d1e){if(_0x1c2d1e){var _0x40c0f2=util['format']('%s.cypher',_0x1c2d1e[_0x6f83('0x4e')]);if(fs['existsSync'](_0x40c0f2)){_0xc0b82=!![];return _0x2c985b[_0x6f83('0x50')](_0x40c0f2,_0x1c2d1e[_0x6f83('0x4e')],config[_0x6f83('0x51')][_0x6f83('0x52')])[_0x6f83('0x25')](function(){return _0x1c2d1e;});}return _0x1c2d1e;}})[_0x6f83('0x25')](function(_0x4f0b99){if(_0x4f0b99){if(!fs['existsSync'](_0x4f0b99['value'])){throw new db['Sequelize']['ValidationError'](_0x6f83('0x54'));}if(_0x4f0b99[_0x6f83('0x55')]){return _0x5c3903[_0x6f83('0x4b')](_0x4f0b99[_0x6f83('0x4e')],_0x4f0b99[_0x6f83('0x55')]+path['extname'](_0x4f0b99['value']),function(){if(_0xc0b82){fs[_0x6f83('0x57')](_0x4f0b99[_0x6f83('0x4e')]);}});}else{return _0x5c3903[_0x6f83('0x4b')](_0x4f0b99['value'],function(_0x506a09){if(_0xc0b82){fs[_0x6f83('0x57')](_0x4f0b99[_0x6f83('0x4e')]);}});}}})[_0x6f83('0x40')](handleError(_0x5c3903,null));};exports[_0x6f83('0x24')]=function(_0x32a0f7,_0x233bd0){return db[_0x6f83('0x2b')][_0x6f83('0x47')]({'where':{'id':_0x32a0f7['params']['id']}})['then'](function(_0x72d3c3){if(_['isNil'](_0x72d3c3)){throw new ReferenceError('Entity\x20not\x20found');}return _0x72d3c3;})[_0x6f83('0x25')](function(_0x3436a9){var _0x2d964f=_0x3436a9[_0x6f83('0x4e')];logger[_0x6f83('0x5e')](_0x6f83('0x5f'),_0x2d964f);if(!_[_0x6f83('0x60')](_0x3436a9['value'])&&fs[_0x6f83('0x61')](_0x2d964f)){logger[_0x6f83('0x5e')]('File:\x20\x22'+_0x2d964f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2d964f);}_0x2d964f=_0x2d964f+'.cypher';if(!_[_0x6f83('0x60')](_0x3436a9[_0x6f83('0x4e')])&&fs[_0x6f83('0x61')](_0x2d964f)){logger[_0x6f83('0x5e')](_0x6f83('0x62')+_0x2d964f+_0x6f83('0x63'));fs[_0x6f83('0x64')](_0x2d964f);}return _0x3436a9;})[_0x6f83('0x25')](function(_0x1b1539){if(!_0x1b1539)throw new InternalError();return _0x1b1539['destroy']();})['then'](function(){_0x233bd0[_0x6f83('0x1b')](0xcc)['end']();})[_0x6f83('0x40')](handleError(_0x233bd0,null));};function getBucketslist(_0x54fea3,_0x268a51,_0x5d0815){return new Promise(function(_0x3f9b45,_0x111fc2){var _0x38cc02=new AWS['S3']({'accessKeyId':_0x268a51,'secretAccessKey':_0x54fea3,'region':_0x5d0815});_0x38cc02[_0x6f83('0x65')]({},function(_0x12f542,_0x2fd89b){if(_0x12f542){return _0x111fc2(_0x12f542);}else{return _0x3f9b45(_0x2fd89b);}});});}function createBucket(_0xf98b4d,_0x34b450,_0x442aeb,_0x36fd29){return new Promise(function(_0x3e1cfa,_0x347e78){var _0x4d277b=new AWS['S3']({'accessKeyId':_0x34b450,'secretAccessKey':_0xf98b4d,'region':_0x442aeb});_0x4d277b['createBucket']({'Bucket':_0x36fd29},function(_0x3b35ee,_0x4ad240){if(_0x3b35ee){return _0x347e78(_0x3b35ee);}else{return _0x3e1cfa(_0x4ad240);}});});}function uploadFile(_0x11e442,_0x49aa47,_0x1a3bbb,_0x59ca33,_0x3311b4,_0x19d8b1){return new Promise(function(_0x3bab2d,_0x1cc31a){var _0x4452c5=new AWS['S3']({'accessKeyId':_0x49aa47,'secretAccessKey':_0x11e442,'region':_0x1a3bbb});_0x4452c5[_0x6f83('0x66')]({'Bucket':_0x59ca33,'Key':_0x3311b4,'Body':_0x19d8b1},function(_0xb29597,_0x320069){if(_0xb29597){return _0x1cc31a(_0xb29597);}else{return _0x3bab2d(_0x320069);}});});}function startTranscribe(_0x503173,_0x4a130c,_0x1cd5d1,_0x2164df,_0x5411bf,_0x2c1e41){return new Promise(function(_0x145c2a,_0x56bc68){var _0x4e607f=new AWS[(_0x6f83('0x67'))]({'accessKeyId':_0x4a130c,'secretAccessKey':_0x503173,'region':_0x1cd5d1});_0x4e607f[_0x6f83('0x68')]({'TranscriptionJobName':_0x2164df,'LanguageCode':_0x5411bf,'Media':{'MediaFileUri':_0x2c1e41}},function(_0x476984,_0x51039f){if(_0x476984){return _0x56bc68(_0x476984);}else{return _0x145c2a(_0x51039f);}});});}function transcribe(_0x295f66,_0x598fb3,_0x4b06f5,_0x23a755,_0x2e2c64,_0x458bb6,_0x1c2bce){return new Promise(function(_0x4aca0b,_0x1df584){var _0x1b6daf={};logger[_0x6f83('0x5e')](util[_0x6f83('0x30')](_0x6f83('0x69'),_0x295f66,_0x2e2c64));return uploadFile(_0x598fb3,_0x4b06f5,_0x23a755,_0x2e2c64,path['basename'](_0x458bb6),fs[_0x6f83('0x6a')](_0x458bb6))['then'](function(_0x2464e5){logger[_0x6f83('0x5e')](util[_0x6f83('0x30')](_0x6f83('0x6b'),_0x295f66,_0x2e2c64,_0x2464e5['Location']));_0x1b6daf['bucket']=_0x2464e5[_0x6f83('0x6c')];_0x1b6daf[_0x6f83('0x6d')]=_0x2464e5[_0x6f83('0x6e')];logger[_0x6f83('0x5e')](util[_0x6f83('0x30')](_0x6f83('0x6f'),_0x295f66));return startTranscribe(_0x598fb3,_0x4b06f5,_0x23a755,uuidv4(),_0x1c2bce,_0x2464e5[_0x6f83('0x6e')]);})[_0x6f83('0x25')](function(_0xc4884a){logger[_0x6f83('0x5e')](util[_0x6f83('0x30')](_0x6f83('0x70'),_0x295f66,_0xc4884a[_0x6f83('0x71')][_0x6f83('0x72')]));_0x1b6daf[_0x6f83('0x73')]=_0xc4884a[_0x6f83('0x71')]['TranscriptionJobName'];_0x1b6daf['transcribeStatus']=_0xc4884a[_0x6f83('0x71')]['TranscriptionJobStatus'];return _0x4aca0b(_0x1b6daf);})['catch'](function(_0x24971a){return _0x1df584(_0x24971a);});});}exports[_0x6f83('0x74')]=function(_0x1a79f9,_0x82fc74,_0x548d85){var _0x46a3f2;var _0x268613;var _0x54be89;var _0x202313=require(_0x6f83('0x4c'));return db['VoiceRecording']['findOne']({'where':{'id':_0x1a79f9[_0x6f83('0x42')]['id']}})[_0x6f83('0x25')](function(_0x112bfa){if(_0x112bfa){var _0x391f93=util[_0x6f83('0x30')](_0x6f83('0x4f'),_0x112bfa['value']);if(fs[_0x6f83('0x61')](_0x391f93)){cypher=!![];return _0x202313[_0x6f83('0x50')](_0x391f93,_0x112bfa[_0x6f83('0x4e')],config[_0x6f83('0x51')][_0x6f83('0x52')])['then'](function(){return _0x112bfa;});}return _0x112bfa;}})['then'](function(_0x5bec24){if(!_0x5bec24){throw new db[(_0x6f83('0x53'))][(_0x6f83('0x75'))](_0x6f83('0x76'));}_0x268613=_0x5bec24;return db[_0x6f83('0x77')][_0x6f83('0x78')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x82fc74,null))[_0x6f83('0x25')](function(_0x4cc626){if(_0x4cc626){_0x46a3f2=_0x4cc626;if(!_0x46a3f2['transcribe']||!_0x46a3f2[_0x6f83('0x79')]||!_0x46a3f2[_0x6f83('0x7a')]||!_0x46a3f2[_0x6f83('0x7b')]||!_0x46a3f2[_0x6f83('0x7c')]){throw new db[(_0x6f83('0x53'))][(_0x6f83('0x75'))](_0x6f83('0x7d'));}if(_0x1a79f9['body']['runSentiment']&&(!_0x46a3f2['sentiment']||!_0x46a3f2[_0x6f83('0x7e')]||!_0x46a3f2[_0x6f83('0x7f')]||!_0x46a3f2[_0x6f83('0x7b')]||!_0x46a3f2[_0x6f83('0x7c')])){throw new db[(_0x6f83('0x53'))][(_0x6f83('0x75'))](_0x6f83('0x80'));}return db[_0x6f83('0x81')][_0x6f83('0x78')]({'where':{'id':_0x46a3f2[_0x6f83('0x79')]}});}})[_0x6f83('0x25')](function(_0xd6e5e9){if(!_0xd6e5e9){throw new db['Sequelize'][(_0x6f83('0x75'))](_0x6f83('0x82'));}if(!_0xd6e5e9[_0x6f83('0x83')]||!_0xd6e5e9[_0x6f83('0x84')]){throw new db[(_0x6f83('0x53'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x54be89=_0xd6e5e9;return getBucketslist(_0x54be89[_0x6f83('0x83')],_0x54be89['data2'],_0x46a3f2[_0x6f83('0x7a')]);})[_0x6f83('0x25')](function(_0x40567f){if(_0x40567f&&_0x40567f['Buckets']){var _0x56ec41=_[_0x6f83('0x47')](_0x40567f[_0x6f83('0x85')],function(_0x46db38){return _0x46db38[_0x6f83('0x86')]===_0x46a3f2[_0x6f83('0x7c')];});if(!_0x56ec41){logger[_0x6f83('0x5e')](util[_0x6f83('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1a79f9[_0x6f83('0x42')]['id'],_0x46a3f2[_0x6f83('0x7c')]));return createBucket(_0x54be89[_0x6f83('0x83')],_0x54be89[_0x6f83('0x84')],_0x46a3f2[_0x6f83('0x7a')],_0x46a3f2[_0x6f83('0x7c')]);}logger[_0x6f83('0x5e')](util['format'](_0x6f83('0x87'),_0x1a79f9[_0x6f83('0x42')]['id'],_0x46a3f2['bucket']));return;}})[_0x6f83('0x25')](function(_0x3ae6f6){if(_0x268613[_0x6f83('0x88')]===_0x6f83('0x89')){return transcribe(_0x1a79f9[_0x6f83('0x42')]['id'],_0x54be89['data1'],_0x54be89[_0x6f83('0x84')],_0x46a3f2[_0x6f83('0x7a')],_0x46a3f2[_0x6f83('0x7c')],_0x268613[_0x6f83('0x4e')],_0x46a3f2[_0x6f83('0x7b')]);}else{logger['info'](util['format'](_0x6f83('0x8a'),_0x1a79f9[_0x6f83('0x42')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x6f83('0x25')](function(_0x4ef9fc){if(_0x4ef9fc){_0x4ef9fc[_0x6f83('0x8b')]=_0x1a79f9[_0x6f83('0x49')][_0x6f83('0x8c')];return _0x268613[_0x6f83('0x8d')](_0x4ef9fc);}})['then'](respondWithResult(_0x82fc74,null))[_0x6f83('0x40')](handleError(_0x82fc74,null));};function writeFile(_0x51baa6,_0x196b47){return new Promise(function(_0xc649e3,_0x2f6b71){fs[_0x6f83('0x8e')](_0x196b47,_0x51baa6,function(_0x593595,_0x33cc9f){if(_0x593595){return _0x2f6b71(_0x593595);}else{return _0xc649e3(_0x33cc9f);}});});}exports[_0x6f83('0x8f')]=function(_0x480a2c,_0x43e5f9,_0x43c40c){return db['VoiceRecording']['findOne']({'where':{'id':_0x480a2c[_0x6f83('0x42')]['id']}})[_0x6f83('0x25')](handleEntityNotFound(_0x43e5f9))[_0x6f83('0x25')](function(_0x2f840a){if(_0x2f840a&&_0x2f840a['fileText']){var _0x5ba6bc=_0x2f840a[_0x6f83('0x90')];var _0x492335=config[_0x6f83('0x91')]+'/server/files/transcribes/transcribe_'+_0x2f840a['id']+_0x6f83('0x92');if(fs[_0x6f83('0x61')](_0x492335)){return _0x492335;}return writeFile(_0x5ba6bc,_0x492335)[_0x6f83('0x25')](function(){return _0x492335;});}else{throw new db[(_0x6f83('0x53'))][(_0x6f83('0x75'))](_0x6f83('0x93'));}})[_0x6f83('0x25')](function(_0x4bf981){return _0x43e5f9[_0x6f83('0x4b')](_0x4bf981);})[_0x6f83('0x40')](handleError(_0x43e5f9));}; \ No newline at end of file +var _0xae86=['map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','length','create','body','describe','download','../../components/encryptor','uniqueid','params','find','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','token','push','extname','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','data1','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index'];(function(_0x2815d5,_0x3530be){var _0x2969bc=function(_0x2df572){while(--_0x2df572){_0x2815d5['push'](_0x2815d5['shift']());}};_0x2969bc(++_0x3530be);}(_0xae86,0xfc));var _0x6ae8=function(_0x5c18a6,_0x2932f7){_0x5c18a6=_0x5c18a6-0x0;var _0x4c1d6c=_0xae86[_0x5c18a6];return _0x4c1d6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ae8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ae8('0x1'));var rp=require(_0x6ae8('0x2'));var moment=require(_0x6ae8('0x3'));var BPromise=require(_0x6ae8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6ae8('0x5'));var sox=require(_0x6ae8('0x6'));var csv=require(_0x6ae8('0x7'));var ejs=require(_0x6ae8('0x8'));var fs=require('fs');var fs_extra=require(_0x6ae8('0x9'));var _=require(_0x6ae8('0xa'));var squel=require(_0x6ae8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ae8('0xc'));var toCsv=require(_0x6ae8('0x7'));var querystring=require('querystring');var Papa=require(_0x6ae8('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x6ae8('0xe'));var Redis=require('ioredis');var authService=require(_0x6ae8('0xf'));var qs=require(_0x6ae8('0x10'));var as=require(_0x6ae8('0x11'));var hardwareService=require(_0x6ae8('0x12'));var logger=require(_0x6ae8('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6ae8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29e0c3,_0x4ea5f4){_0x4ea5f4=_0x4ea5f4||0xcc;return function(_0x3f8162){if(_0x3f8162){return _0x29e0c3[_0x6ae8('0x15')](_0x4ea5f4);}return _0x29e0c3['status'](_0x4ea5f4)['end']();};}function respondWithResult(_0x2f7416,_0x2fc14d){_0x2fc14d=_0x2fc14d||0xc8;return function(_0xd7b26a){if(_0xd7b26a){return _0x2f7416[_0x6ae8('0x16')](_0x2fc14d)[_0x6ae8('0x17')](_0xd7b26a);}};}function respondWithFilteredResult(_0x4c36ea,_0x1ef8fa){return function(_0x267bcd){if(_0x267bcd){var _0x162db6=typeof _0x1ef8fa[_0x6ae8('0x18')]===_0x6ae8('0x19')&&typeof _0x1ef8fa[_0x6ae8('0x1a')]==='undefined';var _0xac8c74=_0x267bcd[_0x6ae8('0x1b')];var _0x3edc36=_0x162db6?0x0:_0x1ef8fa[_0x6ae8('0x18')];var _0x14ed14=_0x162db6?_0x267bcd[_0x6ae8('0x1b')]:_0x1ef8fa[_0x6ae8('0x18')]+_0x1ef8fa[_0x6ae8('0x1a')];var _0x2070e7;if(_0x14ed14>=_0xac8c74){_0x14ed14=_0xac8c74;_0x2070e7=0xc8;}else{_0x2070e7=0xce;}_0x4c36ea[_0x6ae8('0x16')](_0x2070e7);return _0x4c36ea[_0x6ae8('0x1c')](_0x6ae8('0x1d'),_0x3edc36+'-'+_0x14ed14+'/'+_0xac8c74)['json'](_0x267bcd);}return null;};}function patchUpdates(_0x6c95f6){return function(_0x55df3c){try{jsonpatch[_0x6ae8('0x1e')](_0x55df3c,_0x6c95f6,!![]);}catch(_0x19e5d4){return BPromise[_0x6ae8('0x1f')](_0x19e5d4);}return _0x55df3c['save']();};}function saveUpdates(_0x148531,_0x422d46){return function(_0x128f73){if(_0x128f73){return _0x128f73[_0x6ae8('0x20')](_0x148531)[_0x6ae8('0x21')](function(_0x2825cf){return _0x2825cf;});}return null;};}function removeEntity(_0x3139e0,_0x309784){return function(_0x9bdc70){if(_0x9bdc70){return _0x9bdc70[_0x6ae8('0x22')]()[_0x6ae8('0x21')](function(){_0x3139e0['status'](0xcc)[_0x6ae8('0x23')]();});}};}function handleEntityNotFound(_0x89a285,_0x1a4cb7){return function(_0x2539c9){if(!_0x2539c9){_0x89a285[_0x6ae8('0x15')](0x194);}return _0x2539c9;};}function handleError(_0x168f29,_0x1826cd){_0x1826cd=_0x1826cd||0x1f4;return function(_0x54ce16){logger[_0x6ae8('0x24')](_0x54ce16[_0x6ae8('0x25')]);if(_0x54ce16[_0x6ae8('0x26')]){delete _0x54ce16['name'];}_0x168f29[_0x6ae8('0x16')](_0x1826cd)['send'](_0x54ce16);};}exports[_0x6ae8('0x27')]=function(_0x36d3cc,_0x449035){var _0x43d95e={},_0x871091={},_0x2feb59={'count':0x0,'rows':[]};var _0x37fb00=_[_0x6ae8('0x28')](db[_0x6ae8('0x29')][_0x6ae8('0x2a')],function(_0x2bf424){return{'name':_0x2bf424[_0x6ae8('0x2b')],'type':_0x2bf424[_0x6ae8('0x2c')][_0x6ae8('0x2d')]};});_0x871091[_0x6ae8('0x2e')]=_[_0x6ae8('0x2f')](_[_0x6ae8('0x28')](_0x37fb00,_0x6ae8('0x26')),['format']);_0x871091['query']=_['keys'](_0x36d3cc['query']);_0x871091[_0x6ae8('0x30')]=_[_0x6ae8('0x31')](_0x871091[_0x6ae8('0x2e')],_0x871091[_0x6ae8('0x32')]);_0x43d95e[_0x6ae8('0x33')]=_[_0x6ae8('0x31')](_0x871091[_0x6ae8('0x2e')],qs['fields'](_0x36d3cc[_0x6ae8('0x32')][_0x6ae8('0x34')]));_0x43d95e[_0x6ae8('0x33')]=_0x43d95e[_0x6ae8('0x33')]['length']?_0x43d95e[_0x6ae8('0x33')]:_0x871091[_0x6ae8('0x2e')];if(!_0x36d3cc[_0x6ae8('0x32')][_0x6ae8('0x35')](_0x6ae8('0x36'))){_0x43d95e[_0x6ae8('0x1a')]=qs[_0x6ae8('0x1a')](_0x36d3cc[_0x6ae8('0x32')][_0x6ae8('0x1a')]);_0x43d95e['offset']=qs[_0x6ae8('0x18')](_0x36d3cc['query'][_0x6ae8('0x18')]);}_0x43d95e[_0x6ae8('0x37')]=qs[_0x6ae8('0x38')](_0x36d3cc[_0x6ae8('0x32')][_0x6ae8('0x38')]);_0x43d95e[_0x6ae8('0x39')]=qs['filters'](_[_0x6ae8('0x3a')](_0x36d3cc[_0x6ae8('0x32')],_0x871091[_0x6ae8('0x30')]),_0x37fb00);if(_0x36d3cc['query']['filter']){_0x43d95e[_0x6ae8('0x39')]=_['merge'](_0x43d95e['where'],{'$or':_['map'](_0x37fb00,function(_0x5048c8){if(_0x5048c8[_0x6ae8('0x2c')]!==_0x6ae8('0x3b')){var _0x14de71={};_0x14de71[_0x5048c8[_0x6ae8('0x26')]]={'$like':'%'+_0x36d3cc[_0x6ae8('0x32')][_0x6ae8('0x3c')]+'%'};return _0x14de71;}})});}_0x43d95e=_['merge']({},_0x43d95e,_0x36d3cc[_0x6ae8('0x3d')]);var _0x47a7e4={'where':_0x43d95e[_0x6ae8('0x39')]};return db[_0x6ae8('0x29')]['count'](_0x47a7e4)[_0x6ae8('0x21')](function(_0x1f8178){_0x2feb59[_0x6ae8('0x1b')]=_0x1f8178;if(_0x36d3cc['query']['includeAll']){_0x43d95e[_0x6ae8('0x3e')]=[{'all':!![]}];}return db[_0x6ae8('0x29')][_0x6ae8('0x3f')](_0x43d95e);})[_0x6ae8('0x21')](function(_0x148b8b){_0x2feb59[_0x6ae8('0x40')]=_0x148b8b;return _0x2feb59;})[_0x6ae8('0x21')](respondWithFilteredResult(_0x449035,_0x43d95e))[_0x6ae8('0x41')](handleError(_0x449035,null));};exports[_0x6ae8('0x42')]=function(_0x3b27d5,_0x30b168){var _0x59e374={'raw':![],'where':{'id':_0x3b27d5['params']['id']}},_0x48ceb8={};_0x48ceb8[_0x6ae8('0x2e')]=_[_0x6ae8('0x43')](db['VoiceRecording']['rawAttributes']);_0x48ceb8[_0x6ae8('0x32')]=_[_0x6ae8('0x43')](_0x3b27d5[_0x6ae8('0x32')]);_0x48ceb8['filters']=_[_0x6ae8('0x31')](_0x48ceb8[_0x6ae8('0x2e')],_0x48ceb8[_0x6ae8('0x32')]);_0x59e374[_0x6ae8('0x33')]=_['intersection'](_0x48ceb8[_0x6ae8('0x2e')],qs[_0x6ae8('0x34')](_0x3b27d5[_0x6ae8('0x32')]['fields']));_0x59e374[_0x6ae8('0x33')]=_0x59e374[_0x6ae8('0x33')][_0x6ae8('0x44')]?_0x59e374[_0x6ae8('0x33')]:_0x48ceb8[_0x6ae8('0x2e')];if(_0x3b27d5['query']['includeAll']){_0x59e374[_0x6ae8('0x3e')]=[{'all':!![]}];}_0x59e374=_['merge']({},_0x59e374,_0x3b27d5[_0x6ae8('0x3d')]);return db[_0x6ae8('0x29')]['find'](_0x59e374)[_0x6ae8('0x21')](handleEntityNotFound(_0x30b168,null))[_0x6ae8('0x21')](respondWithResult(_0x30b168,null))['catch'](handleError(_0x30b168,null));};exports[_0x6ae8('0x45')]=function(_0x4b6069,_0x11a724){return db[_0x6ae8('0x29')]['create'](_0x4b6069[_0x6ae8('0x46')],{})[_0x6ae8('0x21')](respondWithResult(_0x11a724,0xc9))[_0x6ae8('0x41')](handleError(_0x11a724,null));};exports[_0x6ae8('0x20')]=function(_0xf7eb42,_0x5493c2){if(_0xf7eb42[_0x6ae8('0x46')]['id']){delete _0xf7eb42[_0x6ae8('0x46')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0xf7eb42['params']['id']}})[_0x6ae8('0x21')](handleEntityNotFound(_0x5493c2,null))[_0x6ae8('0x21')](saveUpdates(_0xf7eb42[_0x6ae8('0x46')],null))['then'](respondWithResult(_0x5493c2,null))[_0x6ae8('0x41')](handleError(_0x5493c2,null));};exports[_0x6ae8('0x47')]=function(_0x35104e,_0x326e5e){return db[_0x6ae8('0x29')][_0x6ae8('0x47')]()['then'](respondWithResult(_0x326e5e,null))[_0x6ae8('0x41')](handleError(_0x326e5e,null));};exports[_0x6ae8('0x48')]=function(_0x4fb503,_0x4ca9b5,_0x3d0b1b){var _0xa39f32=require(_0x6ae8('0x49'));var _0x24944d=![];var _0x547ae4={};if(_0x4fb503['query']['type']&&_0x4fb503[_0x6ae8('0x32')][_0x6ae8('0x2c')]===_0x6ae8('0x4a')){_0x547ae4['uniqueid']=_0x4fb503[_0x6ae8('0x4b')]['id'];}else{_0x547ae4['id']=_0x4fb503[_0x6ae8('0x4b')]['id'];}return db[_0x6ae8('0x29')][_0x6ae8('0x4c')]({'where':_0x547ae4,'attributes':['id',_0x6ae8('0x4d')],'raw':!![]})[_0x6ae8('0x21')](handleEntityNotFound(_0x4ca9b5,null))[_0x6ae8('0x21')](function(_0x53d8a0){if(_0x53d8a0){var _0x213edc=_0x53d8a0[_0x6ae8('0x4d')];var _0x2c3448=util[_0x6ae8('0x4e')](_0x6ae8('0x4f'),_0x213edc);if(fs[_0x6ae8('0x50')](_0x2c3448)){_0x24944d=!![];return _0xa39f32[_0x6ae8('0x51')](_0x2c3448,_0x213edc,config[_0x6ae8('0x52')][_0x6ae8('0x53')])[_0x6ae8('0x21')](function(){return _0x53d8a0;});}return _0x53d8a0;}})[_0x6ae8('0x21')](function(_0x51f206){if(_0x51f206){var _0x300996=_0x51f206[_0x6ae8('0x4d')];if(!fs['existsSync'](_0x300996)){throw new db[(_0x6ae8('0x54'))][(_0x6ae8('0x55'))](_0x6ae8('0x56'));}if(_0x51f206[_0x6ae8('0x57')]){return _0x4ca9b5['download'](_0x300996,_0x51f206[_0x6ae8('0x57')]+path['extname'](_0x300996),function(){if(_0x24944d){fs['unlink'](_0x300996);}});}else{return _0x4ca9b5[_0x6ae8('0x48')](_0x300996,function(_0x18a048){if(_0x24944d){fs[_0x6ae8('0x58')](_0x300996);}});}}})[_0x6ae8('0x41')](function(_0x23ad6b){if(_0x23ad6b[_0x6ae8('0x59')]===_0x6ae8('0x56')){_0x4ca9b5[_0x6ae8('0x16')](0x194)[_0x6ae8('0x5a')](_0x6ae8('0x5b'));}else{return handleError(_0x4ca9b5,null);}});};exports[_0x6ae8('0x5c')]=function(_0x26899f,_0x5a24a1,_0x1e0d22){var _0x534ebb=require(_0x6ae8('0x49'));var _0x5509dd=![];var _0x59ed2c={'$and':[db['sequelize'][_0x6ae8('0x39')](db[_0x6ae8('0x5d')]['fn'](_0x6ae8('0x5e'),db[_0x6ae8('0x5d')][_0x6ae8('0x5f')]('uniqueid')),_0x26899f['query'][_0x6ae8('0x60')])]};if(_0x26899f[_0x6ae8('0x32')]['type']&&_0x26899f[_0x6ae8('0x32')][_0x6ae8('0x2c')]===_0x6ae8('0x4a')){_0x59ed2c['$and'][_0x6ae8('0x61')]({'uniqueid':_0x26899f[_0x6ae8('0x4b')]['id']});}else{_0x59ed2c['$and'][_0x6ae8('0x61')]({'id':_0x26899f['params']['id']});}return db[_0x6ae8('0x29')][_0x6ae8('0x4c')]({'where':_0x59ed2c,'attributes':['id',_0x6ae8('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x5a24a1,null))['then'](function(_0x515aeb){if(_0x515aeb){var _0x190a73=util['format'](_0x6ae8('0x4f'),_0x515aeb[_0x6ae8('0x4d')]);if(fs[_0x6ae8('0x50')](_0x190a73)){_0x5509dd=!![];return _0x534ebb[_0x6ae8('0x51')](_0x190a73,_0x515aeb[_0x6ae8('0x4d')],config['secrets']['recording'])['then'](function(){return _0x515aeb;});}return _0x515aeb;}})[_0x6ae8('0x21')](function(_0x5cc0c3){if(_0x5cc0c3){if(!fs[_0x6ae8('0x50')](_0x5cc0c3['value'])){throw new db[(_0x6ae8('0x54'))][(_0x6ae8('0x55'))](_0x6ae8('0x56'));}if(_0x5cc0c3[_0x6ae8('0x57')]){return _0x5a24a1[_0x6ae8('0x48')](_0x5cc0c3[_0x6ae8('0x4d')],_0x5cc0c3[_0x6ae8('0x57')]+path[_0x6ae8('0x62')](_0x5cc0c3[_0x6ae8('0x4d')]),function(){if(_0x5509dd){fs[_0x6ae8('0x58')](_0x5cc0c3[_0x6ae8('0x4d')]);}});}else{return _0x5a24a1['download'](_0x5cc0c3[_0x6ae8('0x4d')],function(_0x242451){if(_0x5509dd){fs['unlink'](_0x5cc0c3[_0x6ae8('0x4d')]);}});}}})[_0x6ae8('0x41')](handleError(_0x5a24a1,null));};exports[_0x6ae8('0x22')]=function(_0x558f5b,_0x15e3a8){return db[_0x6ae8('0x29')][_0x6ae8('0x4c')]({'where':{'id':_0x558f5b[_0x6ae8('0x4b')]['id']}})[_0x6ae8('0x21')](function(_0x4b2573){if(_[_0x6ae8('0x63')](_0x4b2573)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4b2573;})[_0x6ae8('0x21')](function(_0x1427ed){var _0x429332=_0x1427ed[_0x6ae8('0x4d')];logger[_0x6ae8('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x429332);if(!_[_0x6ae8('0x63')](_0x1427ed[_0x6ae8('0x4d')])&&fs[_0x6ae8('0x50')](_0x429332)){logger[_0x6ae8('0x64')](_0x6ae8('0x65')+_0x429332+_0x6ae8('0x66'));fs['unlinkSync'](_0x429332);}_0x429332=_0x429332+_0x6ae8('0x67');if(!_[_0x6ae8('0x63')](_0x1427ed[_0x6ae8('0x4d')])&&fs[_0x6ae8('0x50')](_0x429332)){logger['info'](_0x6ae8('0x65')+_0x429332+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x429332);}return _0x1427ed;})[_0x6ae8('0x21')](function(_0x39bd1f){if(!_0x39bd1f)throw new InternalError();return _0x39bd1f[_0x6ae8('0x22')]();})[_0x6ae8('0x21')](function(){_0x15e3a8[_0x6ae8('0x16')](0xcc)[_0x6ae8('0x23')]();})[_0x6ae8('0x41')](handleError(_0x15e3a8,null));};function getBucketslist(_0x5e98a3,_0x1a30f0,_0x4a5938){return new Promise(function(_0x385596,_0x512b90){var _0x11ca51=new AWS['S3']({'accessKeyId':_0x1a30f0,'secretAccessKey':_0x5e98a3,'region':_0x4a5938});_0x11ca51[_0x6ae8('0x68')]({},function(_0x569131,_0x367ac5){if(_0x569131){return _0x512b90(_0x569131);}else{return _0x385596(_0x367ac5);}});});}function createBucket(_0x12b4f8,_0x11cbcb,_0x46cbfe,_0x244cac){return new Promise(function(_0x57ff8c,_0x58e76e){var _0x57054d=new AWS['S3']({'accessKeyId':_0x11cbcb,'secretAccessKey':_0x12b4f8,'region':_0x46cbfe});_0x57054d['createBucket']({'Bucket':_0x244cac},function(_0x221270,_0x2ffd8e){if(_0x221270){return _0x58e76e(_0x221270);}else{return _0x57ff8c(_0x2ffd8e);}});});}function uploadFile(_0x1ca0fd,_0x3ddf48,_0xb2be5b,_0x5e1737,_0x44236c,_0x52a3ca){return new Promise(function(_0xb10227,_0x1f863c){var _0x5940bb=new AWS['S3']({'accessKeyId':_0x3ddf48,'secretAccessKey':_0x1ca0fd,'region':_0xb2be5b});_0x5940bb['upload']({'Bucket':_0x5e1737,'Key':_0x44236c,'Body':_0x52a3ca},function(_0x1caffc,_0x54c34c){if(_0x1caffc){return _0x1f863c(_0x1caffc);}else{return _0xb10227(_0x54c34c);}});});}function startTranscribe(_0x4de787,_0x360353,_0x656592,_0x4b7eab,_0x4e0c0f,_0x39a712){return new Promise(function(_0x1eb73a,_0x5cb1a0){var _0x436139=new AWS['TranscribeService']({'accessKeyId':_0x360353,'secretAccessKey':_0x4de787,'region':_0x656592});_0x436139['startTranscriptionJob']({'TranscriptionJobName':_0x4b7eab,'LanguageCode':_0x4e0c0f,'Media':{'MediaFileUri':_0x39a712}},function(_0x273c4a,_0x12a357){if(_0x273c4a){return _0x5cb1a0(_0x273c4a);}else{return _0x1eb73a(_0x12a357);}});});}function transcribe(_0x578922,_0x2c1f70,_0xe7032a,_0x2119de,_0x5b8d0c,_0x48c783,_0x39ecf9){return new Promise(function(_0x2123c6,_0x1a00aa){var _0x291e3a={};logger[_0x6ae8('0x64')](util[_0x6ae8('0x4e')](_0x6ae8('0x69'),_0x578922,_0x5b8d0c));return uploadFile(_0x2c1f70,_0xe7032a,_0x2119de,_0x5b8d0c,path[_0x6ae8('0x6a')](_0x48c783),fs[_0x6ae8('0x6b')](_0x48c783))[_0x6ae8('0x21')](function(_0x3f49b7){logger['info'](util[_0x6ae8('0x4e')](_0x6ae8('0x6c'),_0x578922,_0x5b8d0c,_0x3f49b7[_0x6ae8('0x6d')]));_0x291e3a[_0x6ae8('0x6e')]=_0x3f49b7[_0x6ae8('0x6f')];_0x291e3a[_0x6ae8('0x70')]=_0x3f49b7[_0x6ae8('0x6d')];logger[_0x6ae8('0x64')](util[_0x6ae8('0x4e')](_0x6ae8('0x71'),_0x578922));return startTranscribe(_0x2c1f70,_0xe7032a,_0x2119de,uuidv4(),_0x39ecf9,_0x3f49b7['Location']);})[_0x6ae8('0x21')](function(_0x14eebe){logger['info'](util[_0x6ae8('0x4e')](_0x6ae8('0x72'),_0x578922,_0x14eebe[_0x6ae8('0x73')][_0x6ae8('0x74')]));_0x291e3a['transcribeName']=_0x14eebe[_0x6ae8('0x73')][_0x6ae8('0x74')];_0x291e3a['transcribeStatus']=_0x14eebe[_0x6ae8('0x73')]['TranscriptionJobStatus'];return _0x2123c6(_0x291e3a);})[_0x6ae8('0x41')](function(_0x4820b9){return _0x1a00aa(_0x4820b9);});});}exports[_0x6ae8('0x75')]=function(_0x2bb72c,_0x1622ea,_0x582a0f){var _0x178f92;var _0x562b36;var _0x61b53d;var _0x53e0d3=require(_0x6ae8('0x49'));return db['VoiceRecording']['findOne']({'where':{'id':_0x2bb72c['params']['id']}})[_0x6ae8('0x21')](function(_0x528a48){if(_0x528a48){var _0x1f4695=util['format'](_0x6ae8('0x4f'),_0x528a48[_0x6ae8('0x4d')]);if(fs[_0x6ae8('0x50')](_0x1f4695)){cypher=!![];return _0x53e0d3[_0x6ae8('0x51')](_0x1f4695,_0x528a48['value'],config['secrets'][_0x6ae8('0x53')])[_0x6ae8('0x21')](function(){return _0x528a48;});}return _0x528a48;}})['then'](function(_0x15ef23){if(!_0x15ef23){throw new db[(_0x6ae8('0x54'))][(_0x6ae8('0x55'))](_0x6ae8('0x76'));}_0x562b36=_0x15ef23;return db['Setting'][_0x6ae8('0x77')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1622ea,null))[_0x6ae8('0x21')](function(_0x446256){if(_0x446256){_0x178f92=_0x446256;if(!_0x178f92[_0x6ae8('0x78')]||!_0x178f92['transcribeAccountId']||!_0x178f92['transcribeRegion']||!_0x178f92[_0x6ae8('0x79')]||!_0x178f92[_0x6ae8('0x6e')]){throw new db[(_0x6ae8('0x54'))]['ValidationError'](_0x6ae8('0x7a'));}if(_0x2bb72c[_0x6ae8('0x46')][_0x6ae8('0x7b')]&&(!_0x178f92[_0x6ae8('0x7c')]||!_0x178f92['sentimentAccountId']||!_0x178f92[_0x6ae8('0x7d')]||!_0x178f92[_0x6ae8('0x79')]||!_0x178f92[_0x6ae8('0x6e')])){throw new db[(_0x6ae8('0x54'))][(_0x6ae8('0x55'))](_0x6ae8('0x7e'));}return db[_0x6ae8('0x7f')][_0x6ae8('0x77')]({'where':{'id':_0x178f92[_0x6ae8('0x80')]}});}})[_0x6ae8('0x21')](function(_0x2fce61){if(!_0x2fce61){throw new db['Sequelize']['ValidationError'](_0x6ae8('0x81'));}if(!_0x2fce61['data1']||!_0x2fce61[_0x6ae8('0x82')]){throw new db[(_0x6ae8('0x54'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x61b53d=_0x2fce61;return getBucketslist(_0x61b53d['data1'],_0x61b53d[_0x6ae8('0x82')],_0x178f92['transcribeRegion']);})['then'](function(_0x279b4d){if(_0x279b4d&&_0x279b4d['Buckets']){var _0x1a7901=_['find'](_0x279b4d['Buckets'],function(_0x20a605){return _0x20a605[_0x6ae8('0x83')]===_0x178f92[_0x6ae8('0x6e')];});if(!_0x1a7901){logger['info'](util['format'](_0x6ae8('0x84'),_0x2bb72c[_0x6ae8('0x4b')]['id'],_0x178f92[_0x6ae8('0x6e')]));return createBucket(_0x61b53d['data1'],_0x61b53d[_0x6ae8('0x82')],_0x178f92['transcribeRegion'],_0x178f92['bucket']);}logger[_0x6ae8('0x64')](util[_0x6ae8('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2bb72c[_0x6ae8('0x4b')]['id'],_0x178f92[_0x6ae8('0x6e')]));return;}})[_0x6ae8('0x21')](function(_0x26a204){if(_0x562b36[_0x6ae8('0x85')]==='NEW'){return transcribe(_0x2bb72c['params']['id'],_0x61b53d[_0x6ae8('0x86')],_0x61b53d['data2'],_0x178f92[_0x6ae8('0x87')],_0x178f92[_0x6ae8('0x6e')],_0x562b36[_0x6ae8('0x4d')],_0x178f92[_0x6ae8('0x79')]);}else{logger['info'](util[_0x6ae8('0x4e')](_0x6ae8('0x88'),_0x2bb72c[_0x6ae8('0x4b')]['id']));return{'transcribeStatus':_0x6ae8('0x89')};}})[_0x6ae8('0x21')](function(_0x472dbf){if(_0x472dbf){_0x472dbf[_0x6ae8('0x8a')]=_0x2bb72c[_0x6ae8('0x46')]['runSentiment'];return _0x562b36[_0x6ae8('0x8b')](_0x472dbf);}})[_0x6ae8('0x21')](respondWithResult(_0x1622ea,null))[_0x6ae8('0x41')](handleError(_0x1622ea,null));};function writeFile(_0x27dbb3,_0x5ce6e8){return new Promise(function(_0x3630eb,_0x1e2e4b){fs[_0x6ae8('0x8c')](_0x5ce6e8,_0x27dbb3,function(_0x4e536c,_0x591590){if(_0x4e536c){return _0x1e2e4b(_0x4e536c);}else{return _0x3630eb(_0x591590);}});});}exports[_0x6ae8('0x8d')]=function(_0x57b9ee,_0x3e4295,_0x4916c8){return db['VoiceRecording']['findOne']({'where':{'id':_0x57b9ee[_0x6ae8('0x4b')]['id']}})[_0x6ae8('0x21')](handleEntityNotFound(_0x3e4295))[_0x6ae8('0x21')](function(_0x3d2c5a){if(_0x3d2c5a&&_0x3d2c5a[_0x6ae8('0x8e')]){var _0x4adee5=_0x3d2c5a['fileText'];var _0x1209bd=config[_0x6ae8('0x8f')]+_0x6ae8('0x90')+_0x3d2c5a['id']+'.txt';if(fs[_0x6ae8('0x50')](_0x1209bd)){return _0x1209bd;}return writeFile(_0x4adee5,_0x1209bd)[_0x6ae8('0x21')](function(){return _0x1209bd;});}else{throw new db[(_0x6ae8('0x54'))][(_0x6ae8('0x55'))](_0x6ae8('0x91'));}})[_0x6ae8('0x21')](function(_0x167baa){return _0x3e4295[_0x6ae8('0x48')](_0x167baa);})['catch'](handleError(_0x3e4295));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index af995de..007fdb3 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 _0x2c37=['uniqueid','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x2bc1c4,_0x3c4ded){var _0x3dc381=function(_0xdf1d89){while(--_0xdf1d89){_0x2bc1c4['push'](_0x2bc1c4['shift']());}};_0x3dc381(++_0x3c4ded);}(_0x2c37,0x135));var _0x72c3=function(_0x3c758e,_0x1346dd){_0x3c758e=_0x3c758e-0x0;var _0x3023eb=_0x2c37[_0x3c758e];return _0x3023eb;};'use strict';var _=require(_0x72c3('0x0'));var util=require('util');var logger=require(_0x72c3('0x1'))(_0x72c3('0x2'));var moment=require(_0x72c3('0x3'));var BPromise=require('bluebird');var rp=require(_0x72c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x72c3('0x5'));var attributes=require(_0x72c3('0x6'));module[_0x72c3('0x7')]=function(_0x1471f0,_0x2559c3){return _0x1471f0[_0x72c3('0x8')](_0x72c3('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x72c3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa962=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0xa962,0xd1));var _0x2a96=function(_0x59f756,_0x1b2b0c){_0x59f756=_0x59f756-0x0;var _0x57b176=_0xa962[_0x59f756];return _0x57b176;};'use strict';var _=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var logger=require(_0x2a96('0x2'))('api');var moment=require(_0x2a96('0x3'));var BPromise=require(_0x2a96('0x4'));var rp=require(_0x2a96('0x5'));var fs=require('fs');var path=require(_0x2a96('0x6'));var rimraf=require(_0x2a96('0x7'));var config=require('../../config/environment');var attributes=require(_0x2a96('0x8'));module['exports']=function(_0x13bcac,_0x91cdfb){return _0x13bcac[_0x2a96('0x9')](_0x2a96('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 258c64e..5379e1d 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 _0x7708=['code','message','UpdateVoiceRecording','VoiceRecording','update','body','options','where','limit','then','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1d20f0,_0x38810b){var _0x2b3ee6=function(_0x445a0d){while(--_0x445a0d){_0x1d20f0['push'](_0x1d20f0['shift']());}};_0x2b3ee6(++_0x38810b);}(_0x7708,0x188));var _0x8770=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0x7708[_0x4e0a03];return _0x2478fc;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var moment=require('moment');var BPromise=require(_0x8770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8770('0x3'))(_0x8770('0x4'));var config=require('../../config/environment');var jayson=require(_0x8770('0x5'));var client=jayson['client'][_0x8770('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x42d305,_0x2b0295,_0x20e293){return new BPromise(function(_0x212b12,_0x3e1113){return client[_0x8770('0x7')](_0x42d305,_0x20e293)['then'](function(_0x396322){logger[_0x8770('0x8')](_0x8770('0x9'),_0x2b0295,'request\x20sent');logger[_0x8770('0xa')](_0x8770('0xb'),_0x2b0295,_0x8770('0xc'),JSON[_0x8770('0xd')](_0x396322));if(_0x396322['error']){if(_0x396322[_0x8770('0xe')][_0x8770('0xf')]===0x1f4){logger[_0x8770('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x2b0295,_0x396322[_0x8770('0xe')][_0x8770('0x10')]);return _0x3e1113(_0x396322[_0x8770('0xe')][_0x8770('0x10')]);}logger[_0x8770('0xe')](_0x8770('0x9'),_0x2b0295,_0x396322[_0x8770('0xe')][_0x8770('0x10')]);return _0x212b12(_0x396322['error'][_0x8770('0x10')]);}else{logger[_0x8770('0x8')]('VoiceRecording,\x20%s,\x20%s',_0x2b0295,_0x8770('0xc'));_0x212b12(_0x396322['result'][_0x8770('0x10')]);}})['catch'](function(_0x5b4716){logger['error'](_0x8770('0x9'),_0x2b0295,_0x5b4716);_0x3e1113(_0x5b4716);});});}exports[_0x8770('0x11')]=function(_0x17b634){var _0xe0d611=this;return new Promise(function(_0x4b0691,_0x550be9){return db[_0x8770('0x12')][_0x8770('0x13')](_0x17b634[_0x8770('0x14')],{'raw':_0x17b634[_0x8770('0x15')]?_0x17b634[_0x8770('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b634[_0x8770('0x15')]?_0x17b634[_0x8770('0x15')][_0x8770('0x16')]||null:null,'attributes':_0x17b634[_0x8770('0x15')]?_0x17b634['options']['attributes']||null:null,'limit':_0x17b634[_0x8770('0x15')]?_0x17b634[_0x8770('0x15')][_0x8770('0x17')]||null:null})[_0x8770('0x18')](function(_0x2760b2){logger[_0x8770('0x8')]('UpdateVoiceRecording',_0x17b634);logger[_0x8770('0xa')](_0x8770('0x11'),_0x17b634,JSON[_0x8770('0xd')](_0x2760b2));_0x4b0691(_0x2760b2);})[_0x8770('0x19')](function(_0x51cdb5){logger[_0x8770('0xe')]('UpdateVoiceRecording',_0x51cdb5[_0x8770('0x10')],_0x17b634);_0x550be9(_0xe0d611[_0x8770('0xe')](0x1f4,_0x51cdb5[_0x8770('0x10')]));});});};exports[_0x8770('0x1a')]=function(_0x1538b2){var _0x2cd084=this;return new Promise(function(_0x293f53,_0x367564){var _0xb3f4aa=require(_0x8770('0x1b'));var _0x5f4973;return db[_0x8770('0x1c')][_0x8770('0x1d')]({'attributes':['id',_0x8770('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x8770('0x18')](function(_0x246128){_0x5f4973=_0x246128;return db[_0x8770('0x12')]['create'](_0x1538b2['body']);})[_0x8770('0x18')](function(_0x11de6e){if(_0x5f4973[_0x8770('0x1e')]&&fs[_0x8770('0x1f')](_0x11de6e[_0x8770('0x20')])){var _0x4bc072=util['format'](_0x8770('0x21'),_0x11de6e[_0x8770('0x20')]);return _0xb3f4aa[_0x8770('0x22')](_0x11de6e[_0x8770('0x20')],_0x4bc072,config['secrets'][_0x8770('0x23')])['then'](function(){fs['unlink'](_0x11de6e[_0x8770('0x20')]);logger['info'](_0x8770('0x24'));return _0x11de6e;});}return _0x11de6e;})[_0x8770('0x18')](function(_0x1f3af6){logger[_0x8770('0x8')](_0x8770('0x1a'),_0x1538b2);logger[_0x8770('0xa')](_0x8770('0x1a'),_0x1538b2,JSON[_0x8770('0xd')](_0x1f3af6));_0x293f53(_0x1f3af6);})[_0x8770('0x19')](function(_0x53197e){logger[_0x8770('0xe')](_0x8770('0x1a'),_0x53197e[_0x8770('0x10')],_0x1538b2);_0x367564(_0x2cd084['error'](0x1f4,_0x53197e['message']));});});}; \ No newline at end of file +var _0xf2e3=['VoiceRecording','update','body','options','where','attributes','limit','../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateVoiceRecording'];(function(_0x474100,_0x2e5647){var _0x13df1b=function(_0x2c21c7){while(--_0x2c21c7){_0x474100['push'](_0x474100['shift']());}};_0x13df1b(++_0x2e5647);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xf2e3[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0864,_0xdf499f,_0x12c6e7){return new BPromise(function(_0x11067d,_0x3636f6){return client[_0x3f2e('0xc')](_0x3c0864,_0x12c6e7)[_0x3f2e('0xd')](function(_0x29a6cc){logger[_0x3f2e('0xe')](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));logger[_0x3f2e('0x11')](_0x3f2e('0x12'),_0xdf499f,_0x3f2e('0x10'),JSON[_0x3f2e('0x13')](_0x29a6cc));if(_0x29a6cc[_0x3f2e('0x14')]){if(_0x29a6cc[_0x3f2e('0x14')]['code']===0x1f4){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x3636f6(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x11067d(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}else{logger['info'](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));_0x11067d(_0x29a6cc[_0x3f2e('0x16')][_0x3f2e('0x15')]);}})[_0x3f2e('0x17')](function(_0x2fef73){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x2fef73);_0x3636f6(_0x2fef73);});});}exports[_0x3f2e('0x18')]=function(_0xc00add){var _0x107876=this;return new Promise(function(_0x5b9989,_0x40e28f){return db[_0x3f2e('0x19')][_0x3f2e('0x1a')](_0xc00add[_0x3f2e('0x1b')],{'raw':_0xc00add[_0x3f2e('0x1c')]?_0xc00add['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc00add[_0x3f2e('0x1c')]?_0xc00add[_0x3f2e('0x1c')][_0x3f2e('0x1d')]||null:null,'attributes':_0xc00add[_0x3f2e('0x1c')]?_0xc00add[_0x3f2e('0x1c')][_0x3f2e('0x1e')]||null:null,'limit':_0xc00add['options']?_0xc00add['options'][_0x3f2e('0x1f')]||null:null})[_0x3f2e('0xd')](function(_0x5a66d6){logger['info'](_0x3f2e('0x18'),_0xc00add);logger['debug'](_0x3f2e('0x18'),_0xc00add,JSON[_0x3f2e('0x13')](_0x5a66d6));_0x5b9989(_0x5a66d6);})['catch'](function(_0x584169){logger['error'](_0x3f2e('0x18'),_0x584169[_0x3f2e('0x15')],_0xc00add);_0x40e28f(_0x107876['error'](0x1f4,_0x584169[_0x3f2e('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x1ad875){var _0x598541=this;return new Promise(function(_0x2806d0,_0x8247fa){var _0x12926e=require(_0x3f2e('0x20'));var _0x11bad1;return db['Setting'][_0x3f2e('0x21')]({'attributes':['id',_0x3f2e('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x528063){_0x11bad1=_0x528063;return db[_0x3f2e('0x19')][_0x3f2e('0x23')](_0x1ad875[_0x3f2e('0x1b')]);})[_0x3f2e('0xd')](function(_0x5452f5){if(_0x11bad1[_0x3f2e('0x22')]&&fs[_0x3f2e('0x24')](_0x5452f5[_0x3f2e('0x25')])){var _0x4d9b8c=util[_0x3f2e('0x26')](_0x3f2e('0x27'),_0x5452f5[_0x3f2e('0x25')]);return _0x12926e['encryptFile'](_0x5452f5[_0x3f2e('0x25')],_0x4d9b8c,config[_0x3f2e('0x28')][_0x3f2e('0x29')])[_0x3f2e('0xd')](function(){fs[_0x3f2e('0x2a')](_0x5452f5[_0x3f2e('0x25')]);logger['info'](_0x3f2e('0x2b'));return _0x5452f5;});}return _0x5452f5;})[_0x3f2e('0xd')](function(_0x3101c4){logger[_0x3f2e('0xe')](_0x3f2e('0x2c'),_0x1ad875);logger[_0x3f2e('0x11')](_0x3f2e('0x2c'),_0x1ad875,JSON['stringify'](_0x3101c4));_0x2806d0(_0x3101c4);})[_0x3f2e('0x17')](function(_0x1e4866){logger[_0x3f2e('0x14')](_0x3f2e('0x2c'),_0x1e4866['message'],_0x1ad875);_0x8247fa(_0x598541['error'](0x1f4,_0x1e4866[_0x3f2e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 216e379..eacd181 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 _0x198b=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','describe','show','post','create','put','delete','/:id','destroy'];(function(_0x527468,_0x316a22){var _0x219f6c=function(_0x147923){while(--_0x147923){_0x527468['push'](_0x527468['shift']());}};_0x219f6c(++_0x316a22);}(_0x198b,0x169));var _0xb198=function(_0x5c3a5d,_0x452f7b){_0x5c3a5d=_0x5c3a5d-0x0;var _0x5160f2=_0x198b[_0x5c3a5d];return _0x5160f2;};'use strict';var multer=require(_0xb198('0x0'));var util=require(_0xb198('0x1'));var path=require(_0xb198('0x2'));var timeout=require(_0xb198('0x3'));var express=require(_0xb198('0x4'));var router=express['Router']();var fs_extra=require(_0xb198('0x5'));var auth=require(_0xb198('0x6'));var interaction=require(_0xb198('0x7'));var config=require('../../config/environment');var controller=require(_0xb198('0x8'));router[_0xb198('0x9')]('/',auth[_0xb198('0xa')](),controller['index']);router['get']('/describe',auth[_0xb198('0xa')](),controller[_0xb198('0xb')]);router[_0xb198('0x9')]('/:id',auth[_0xb198('0xa')](),controller[_0xb198('0xc')]);router[_0xb198('0xd')]('/',auth[_0xb198('0xa')](),controller[_0xb198('0xe')]);router[_0xb198('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb198('0x10')](_0xb198('0x11'),auth['isAuthenticated'](),controller[_0xb198('0x12')]);module[_0xb198('0x13')]=router; \ No newline at end of file +var _0x9973=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','index','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete'];(function(_0x145f64,_0x3dbcad){var _0x3c5362=function(_0x186dc9){while(--_0x186dc9){_0x145f64['push'](_0x145f64['shift']());}};_0x3c5362(++_0x3dbcad);}(_0x9973,0xde));var _0x3997=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9973[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x3997('0x0'));var util=require('util');var path=require(_0x3997('0x1'));var timeout=require(_0x3997('0x2'));var express=require(_0x3997('0x3'));var router=express[_0x3997('0x4')]();var fs_extra=require(_0x3997('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3997('0x6'));var config=require(_0x3997('0x7'));var controller=require(_0x3997('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3997('0x9')]);router[_0x3997('0xa')](_0x3997('0xb'),auth[_0x3997('0xc')](),controller[_0x3997('0xd')]);router['get']('/:id',auth[_0x3997('0xc')](),controller['show']);router[_0x3997('0xe')]('/',auth[_0x3997('0xc')](),controller[_0x3997('0xf')]);router[_0x3997('0x10')](_0x3997('0x11'),auth[_0x3997('0xc')](),controller[_0x3997('0x12')]);router[_0x3997('0x13')](_0x3997('0x11'),auth['isAuthenticated'](),controller[_0x3997('0x14')]);module[_0x3997('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 24b0ea4..6a9c280 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 _0xbf4d=['Yes','sequelize','exports','ENUM','blind','attended','STRING'];(function(_0x3333a6,_0x2c1150){var _0x36f253=function(_0x277ca6){while(--_0x277ca6){_0x3333a6['push'](_0x3333a6['shift']());}};_0x36f253(++_0x2c1150);}(_0xbf4d,0x15f));var _0xdbf4=function(_0x1c43aa,_0xff2696){_0x1c43aa=_0x1c43aa-0x0;var _0x514c3c=_0xbf4d[_0x1c43aa];return _0x514c3c;};'use strict';var Sequelize=require(_0xdbf4('0x0'));var moment=require('moment');module[_0xdbf4('0x1')]={'type':{'type':Sequelize[_0xdbf4('0x2')](_0xdbf4('0x3'),_0xdbf4('0x4'))},'result':{'type':Sequelize[_0xdbf4('0x5')]},'transfererchannel':{'type':Sequelize[_0xdbf4('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xdbf4('0x5')]},'transferercalleridname':{'type':Sequelize[_0xdbf4('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdbf4('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xdbf4('0x5')]},'transferercontext':{'type':Sequelize[_0xdbf4('0x5')]},'transfererexten':{'type':Sequelize[_0xdbf4('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xdbf4('0x5')]},'transfereechannel':{'type':Sequelize[_0xdbf4('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xdbf4('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xdbf4('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xdbf4('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xdbf4('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xdbf4('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xdbf4('0x2')](_0xdbf4('0x6'),'No')},'context':{'type':Sequelize[_0xdbf4('0x5')]},'extension':{'type':Sequelize[_0xdbf4('0x5')]}}; \ No newline at end of file +var _0xab40=['sequelize','ENUM','blind','STRING'];(function(_0x294e4a,_0x6d05c8){var _0x5c7990=function(_0x1518de){while(--_0x1518de){_0x294e4a['push'](_0x294e4a['shift']());}};_0x5c7990(++_0x6d05c8);}(_0xab40,0x18c));var _0x0ab4=function(_0xff3d67,_0x51f1b4){_0xff3d67=_0xff3d67-0x0;var _0x1d6319=_0xab40[_0xff3d67];return _0x1d6319;};'use strict';var Sequelize=require(_0x0ab4('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x0ab4('0x1')](_0x0ab4('0x2'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0ab4('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x0ab4('0x3')]},'transferercalleridname':{'type':Sequelize[_0x0ab4('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0ab4('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x0ab4('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x0ab4('0x3')]},'transferercontext':{'type':Sequelize[_0x0ab4('0x3')]},'transfererexten':{'type':Sequelize[_0x0ab4('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x0ab4('0x3')]},'transfereechannel':{'type':Sequelize[_0x0ab4('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x0ab4('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x0ab4('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x0ab4('0x3')]},'transfereecontext':{'type':Sequelize[_0x0ab4('0x3')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x0ab4('0x1')]('Yes','No')},'context':{'type':Sequelize[_0x0ab4('0x3')]},'extension':{'type':Sequelize[_0x0ab4('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index da9d6bf..a46208c 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 _0xf5df=['model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','show','intersection','includeAll','create','body','find','params','catch','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','update','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type'];(function(_0x47d20d,_0xcd35d3){var _0x447008=function(_0x2f0178){while(--_0x2f0178){_0x47d20d['push'](_0x47d20d['shift']());}};_0x447008(++_0xcd35d3);}(_0xf5df,0x14a));var _0xff5d=function(_0x13eb0b,_0x347bd9){_0x13eb0b=_0x13eb0b-0x0;var _0x520077=_0xf5df[_0x13eb0b];return _0x520077;};'use strict';var emlformat=require(_0xff5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff5d('0x1'));var jsonpatch=require(_0xff5d('0x2'));var rp=require(_0xff5d('0x3'));var moment=require(_0xff5d('0x4'));var BPromise=require(_0xff5d('0x5'));var Mustache=require(_0xff5d('0x6'));var util=require('util');var path=require(_0xff5d('0x7'));var sox=require(_0xff5d('0x8'));var csv=require('to-csv');var ejs=require(_0xff5d('0x9'));var fs=require('fs');var fs_extra=require(_0xff5d('0xa'));var _=require(_0xff5d('0xb'));var squel=require(_0xff5d('0xc'));var crypto=require(_0xff5d('0xd'));var jsforce=require(_0xff5d('0xe'));var deskjs=require(_0xff5d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff5d('0x10'));var Redis=require(_0xff5d('0x11'));var authService=require(_0xff5d('0x12'));var qs=require(_0xff5d('0x13'));var as=require(_0xff5d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff5d('0x15'))(_0xff5d('0x16'));var utils=require('../../config/utils');var config=require(_0xff5d('0x17'));var licenseUtil=require(_0xff5d('0x18'));var db=require(_0xff5d('0x19'))['db'];function respondWithStatusCode(_0x52745f,_0x57f030){_0x57f030=_0x57f030||0xcc;return function(_0x160f16){if(_0x160f16){return _0x52745f['sendStatus'](_0x57f030);}return _0x52745f['status'](_0x57f030)['end']();};}function respondWithResult(_0xdf1595,_0x2d8b5d){_0x2d8b5d=_0x2d8b5d||0xc8;return function(_0x52aa40){if(_0x52aa40){return _0xdf1595[_0xff5d('0x1a')](_0x2d8b5d)[_0xff5d('0x1b')](_0x52aa40);}};}function respondWithFilteredResult(_0x5a2582,_0x3494c9){return function(_0x1a07dc){if(_0x1a07dc){var _0x206501=typeof _0x3494c9['offset']===_0xff5d('0x1c')&&typeof _0x3494c9[_0xff5d('0x1d')]==='undefined';var _0x565ef2=_0x1a07dc[_0xff5d('0x1e')];var _0x15f5fb=_0x206501?0x0:_0x3494c9['offset'];var _0x2f7a44=_0x206501?_0x1a07dc['count']:_0x3494c9[_0xff5d('0x1f')]+_0x3494c9['limit'];var _0x16d268;if(_0x2f7a44>=_0x565ef2){_0x2f7a44=_0x565ef2;_0x16d268=0xc8;}else{_0x16d268=0xce;}_0x5a2582[_0xff5d('0x1a')](_0x16d268);return _0x5a2582[_0xff5d('0x20')]('Content-Range',_0x15f5fb+'-'+_0x2f7a44+'/'+_0x565ef2)[_0xff5d('0x1b')](_0x1a07dc);}return null;};}function patchUpdates(_0x59c428){return function(_0x14dfb3){try{jsonpatch[_0xff5d('0x21')](_0x14dfb3,_0x59c428,!![]);}catch(_0x5df8f8){return BPromise[_0xff5d('0x22')](_0x5df8f8);}return _0x14dfb3['save']();};}function saveUpdates(_0xd85783,_0x1f00f8){return function(_0x86a779){if(_0x86a779){return _0x86a779[_0xff5d('0x23')](_0xd85783)['then'](function(_0x24dc99){return _0x24dc99;});}return null;};}function removeEntity(_0x2b0a05,_0x2549ad){return function(_0x1c2fe3){if(_0x1c2fe3){return _0x1c2fe3['destroy']()['then'](function(){_0x2b0a05['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x102e5d,_0x2b5711){return function(_0x38129f){if(!_0x38129f){_0x102e5d['sendStatus'](0x194);}return _0x38129f;};}function handleError(_0x1f5e7f,_0x78da36){_0x78da36=_0x78da36||0x1f4;return function(_0x5f36f9){logger[_0xff5d('0x24')](_0x5f36f9[_0xff5d('0x25')]);if(_0x5f36f9[_0xff5d('0x26')]){delete _0x5f36f9[_0xff5d('0x26')];}_0x1f5e7f[_0xff5d('0x1a')](_0x78da36)['send'](_0x5f36f9);};}exports[_0xff5d('0x27')]=function(_0x3e1ec1,_0x56f6a4){var _0xcb60ef={},_0x27f62f={},_0x3a5b95={'count':0x0,'rows':[]};var _0x37ceb0=_[_0xff5d('0x28')](db[_0xff5d('0x29')][_0xff5d('0x2a')],function(_0x2e1dfb){return{'name':_0x2e1dfb[_0xff5d('0x2b')],'type':_0x2e1dfb[_0xff5d('0x2c')]['key']};});_0x27f62f[_0xff5d('0x2d')]=_[_0xff5d('0x28')](_0x37ceb0,_0xff5d('0x26'));_0x27f62f[_0xff5d('0x2e')]=_[_0xff5d('0x2f')](_0x3e1ec1[_0xff5d('0x2e')]);_0x27f62f[_0xff5d('0x30')]=_['intersection'](_0x27f62f[_0xff5d('0x2d')],_0x27f62f['query']);_0xcb60ef['attributes']=_['intersection'](_0x27f62f['model'],qs['fields'](_0x3e1ec1[_0xff5d('0x2e')][_0xff5d('0x31')]));_0xcb60ef[_0xff5d('0x32')]=_0xcb60ef[_0xff5d('0x32')][_0xff5d('0x33')]?_0xcb60ef['attributes']:_0x27f62f[_0xff5d('0x2d')];if(!_0x3e1ec1['query'][_0xff5d('0x34')]('nolimit')){_0xcb60ef[_0xff5d('0x1d')]=qs[_0xff5d('0x1d')](_0x3e1ec1['query'][_0xff5d('0x1d')]);_0xcb60ef['offset']=qs[_0xff5d('0x1f')](_0x3e1ec1[_0xff5d('0x2e')][_0xff5d('0x1f')]);}_0xcb60ef[_0xff5d('0x35')]=qs[_0xff5d('0x36')](_0x3e1ec1[_0xff5d('0x2e')][_0xff5d('0x36')]);_0xcb60ef[_0xff5d('0x37')]=qs['filters'](_[_0xff5d('0x38')](_0x3e1ec1['query'],_0x27f62f[_0xff5d('0x30')]),_0x37ceb0);if(_0x3e1ec1[_0xff5d('0x2e')][_0xff5d('0x39')]){_0xcb60ef[_0xff5d('0x37')]=_[_0xff5d('0x3a')](_0xcb60ef[_0xff5d('0x37')],{'$or':_[_0xff5d('0x28')](_0x37ceb0,function(_0x288845){if(_0x288845[_0xff5d('0x2c')]!==_0xff5d('0x3b')){var _0x475961={};_0x475961[_0x288845[_0xff5d('0x26')]]={'$like':'%'+_0x3e1ec1[_0xff5d('0x2e')][_0xff5d('0x39')]+'%'};return _0x475961;}})});}_0xcb60ef=_[_0xff5d('0x3a')]({},_0xcb60ef,_0x3e1ec1[_0xff5d('0x3c')]);var _0x544f96={'where':_0xcb60ef[_0xff5d('0x37')]};return db['VoiceTransferReport'][_0xff5d('0x1e')](_0x544f96)[_0xff5d('0x3d')](function(_0x3a0b7c){_0x3a5b95[_0xff5d('0x1e')]=_0x3a0b7c;if(_0x3e1ec1[_0xff5d('0x2e')]['includeAll']){_0xcb60ef[_0xff5d('0x3e')]=[{'all':!![]}];}return db[_0xff5d('0x29')][_0xff5d('0x3f')](_0xcb60ef);})[_0xff5d('0x3d')](function(_0x17c153){_0x3a5b95[_0xff5d('0x40')]=_0x17c153;return _0x3a5b95;})[_0xff5d('0x3d')](respondWithFilteredResult(_0x56f6a4,_0xcb60ef))['catch'](handleError(_0x56f6a4,null));};exports[_0xff5d('0x41')]=function(_0x2bfe91,_0x28c4b4){var _0x32c263={'raw':!![],'where':{'id':_0x2bfe91['params']['id']}},_0x360ea2={};_0x360ea2[_0xff5d('0x2d')]=_[_0xff5d('0x2f')](db[_0xff5d('0x29')][_0xff5d('0x2a')]);_0x360ea2['query']=_['keys'](_0x2bfe91[_0xff5d('0x2e')]);_0x360ea2['filters']=_[_0xff5d('0x42')](_0x360ea2[_0xff5d('0x2d')],_0x360ea2[_0xff5d('0x2e')]);_0x32c263[_0xff5d('0x32')]=_[_0xff5d('0x42')](_0x360ea2[_0xff5d('0x2d')],qs[_0xff5d('0x31')](_0x2bfe91[_0xff5d('0x2e')][_0xff5d('0x31')]));_0x32c263['attributes']=_0x32c263[_0xff5d('0x32')][_0xff5d('0x33')]?_0x32c263[_0xff5d('0x32')]:_0x360ea2['model'];if(_0x2bfe91[_0xff5d('0x2e')][_0xff5d('0x43')]){_0x32c263[_0xff5d('0x3e')]=[{'all':!![]}];}_0x32c263=_['merge']({},_0x32c263,_0x2bfe91[_0xff5d('0x3c')]);return db[_0xff5d('0x29')]['find'](_0x32c263)['then'](handleEntityNotFound(_0x28c4b4,null))[_0xff5d('0x3d')](respondWithResult(_0x28c4b4,null))['catch'](handleError(_0x28c4b4,null));};exports[_0xff5d('0x44')]=function(_0x5a5bfc,_0x4db05b){return db[_0xff5d('0x29')][_0xff5d('0x44')](_0x5a5bfc[_0xff5d('0x45')],{})['then'](respondWithResult(_0x4db05b,0xc9))['catch'](handleError(_0x4db05b,null));};exports[_0xff5d('0x23')]=function(_0x4aa2c8,_0x28fae1){if(_0x4aa2c8[_0xff5d('0x45')]['id']){delete _0x4aa2c8[_0xff5d('0x45')]['id'];}return db[_0xff5d('0x29')][_0xff5d('0x46')]({'where':{'id':_0x4aa2c8[_0xff5d('0x47')]['id']}})[_0xff5d('0x3d')](handleEntityNotFound(_0x28fae1,null))[_0xff5d('0x3d')](saveUpdates(_0x4aa2c8[_0xff5d('0x45')],null))[_0xff5d('0x3d')](respondWithResult(_0x28fae1,null))[_0xff5d('0x48')](handleError(_0x28fae1,null));};exports[_0xff5d('0x49')]=function(_0x40167c,_0x2a2e39){return db['VoiceTransferReport'][_0xff5d('0x46')]({'where':{'id':_0x40167c[_0xff5d('0x47')]['id']}})[_0xff5d('0x3d')](handleEntityNotFound(_0x2a2e39,null))['then'](removeEntity(_0x2a2e39,null))['catch'](handleError(_0x2a2e39,null));};exports[_0xff5d('0x4a')]=function(_0x419839,_0x4b73e6){return db[_0xff5d('0x29')][_0xff5d('0x4a')]()[_0xff5d('0x3d')](respondWithResult(_0x4b73e6,null))[_0xff5d('0x48')](handleError(_0x4b73e6,null));}; \ No newline at end of file +var _0x8966=['../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','end','sendStatus','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x225641,_0x3f2ae2){var _0x26ba12=function(_0x28f860){while(--_0x28f860){_0x225641['push'](_0x225641['shift']());}};_0x26ba12(++_0x3f2ae2);}(_0x8966,0x173));var _0x6896=function(_0x9ec8a,_0x497dc4){_0x9ec8a=_0x9ec8a-0x0;var _0x191875=_0x8966[_0x9ec8a];return _0x191875;};'use strict';var emlformat=require(_0x6896('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6896('0x1'));var jsonpatch=require(_0x6896('0x2'));var rp=require(_0x6896('0x3'));var moment=require(_0x6896('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6896('0x5'));var util=require('util');var path=require(_0x6896('0x6'));var sox=require(_0x6896('0x7'));var csv=require('to-csv');var ejs=require(_0x6896('0x8'));var fs=require('fs');var fs_extra=require(_0x6896('0x9'));var _=require(_0x6896('0xa'));var squel=require(_0x6896('0xb'));var crypto=require(_0x6896('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6896('0xd'));var toCsv=require(_0x6896('0xe'));var querystring=require(_0x6896('0xf'));var Papa=require(_0x6896('0x10'));var Redis=require(_0x6896('0x11'));var authService=require(_0x6896('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6896('0x13'));var hardwareService=require(_0x6896('0x14'));var logger=require(_0x6896('0x15'))(_0x6896('0x16'));var utils=require(_0x6896('0x17'));var config=require(_0x6896('0x18'));var licenseUtil=require(_0x6896('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3cc2,_0x247469){_0x247469=_0x247469||0xcc;return function(_0xacdff4){if(_0xacdff4){return _0x5b3cc2['sendStatus'](_0x247469);}return _0x5b3cc2[_0x6896('0x1a')](_0x247469)['end']();};}function respondWithResult(_0x494e1d,_0x1d4c7b){_0x1d4c7b=_0x1d4c7b||0xc8;return function(_0x5d22a6){if(_0x5d22a6){return _0x494e1d['status'](_0x1d4c7b)['json'](_0x5d22a6);}};}function respondWithFilteredResult(_0x2fc955,_0x23cff9){return function(_0x5f5986){if(_0x5f5986){var _0x4ce42e=typeof _0x23cff9[_0x6896('0x1b')]===_0x6896('0x1c')&&typeof _0x23cff9[_0x6896('0x1d')]===_0x6896('0x1c');var _0x106931=_0x5f5986['count'];var _0x5a52c8=_0x4ce42e?0x0:_0x23cff9[_0x6896('0x1b')];var _0x2bb11e=_0x4ce42e?_0x5f5986[_0x6896('0x1e')]:_0x23cff9[_0x6896('0x1b')]+_0x23cff9[_0x6896('0x1d')];var _0xd170ae;if(_0x2bb11e>=_0x106931){_0x2bb11e=_0x106931;_0xd170ae=0xc8;}else{_0xd170ae=0xce;}_0x2fc955[_0x6896('0x1a')](_0xd170ae);return _0x2fc955[_0x6896('0x1f')](_0x6896('0x20'),_0x5a52c8+'-'+_0x2bb11e+'/'+_0x106931)[_0x6896('0x21')](_0x5f5986);}return null;};}function patchUpdates(_0x5cb1f5){return function(_0x513c1e){try{jsonpatch[_0x6896('0x22')](_0x513c1e,_0x5cb1f5,!![]);}catch(_0x44c3ef){return BPromise[_0x6896('0x23')](_0x44c3ef);}return _0x513c1e[_0x6896('0x24')]();};}function saveUpdates(_0x73950d,_0x5c8648){return function(_0x4cb713){if(_0x4cb713){return _0x4cb713[_0x6896('0x25')](_0x73950d)['then'](function(_0x2ba53f){return _0x2ba53f;});}return null;};}function removeEntity(_0x295ca8,_0x5f0087){return function(_0x4dca8b){if(_0x4dca8b){return _0x4dca8b[_0x6896('0x26')]()['then'](function(){_0x295ca8[_0x6896('0x1a')](0xcc)[_0x6896('0x27')]();});}};}function handleEntityNotFound(_0x405ce9,_0x297165){return function(_0x866b1d){if(!_0x866b1d){_0x405ce9[_0x6896('0x28')](0x194);}return _0x866b1d;};}function handleError(_0x366ecf,_0x2117bd){_0x2117bd=_0x2117bd||0x1f4;return function(_0x24ca11){logger[_0x6896('0x29')](_0x24ca11['stack']);if(_0x24ca11['name']){delete _0x24ca11[_0x6896('0x2a')];}_0x366ecf[_0x6896('0x1a')](_0x2117bd)[_0x6896('0x2b')](_0x24ca11);};}exports[_0x6896('0x2c')]=function(_0x5231aa,_0x5a05e0){var _0xcbc955={},_0x1398b5={},_0x2f2ac6={'count':0x0,'rows':[]};var _0xd6427c=_[_0x6896('0x2d')](db[_0x6896('0x2e')][_0x6896('0x2f')],function(_0x79472d){return{'name':_0x79472d[_0x6896('0x30')],'type':_0x79472d[_0x6896('0x31')][_0x6896('0x32')]};});_0x1398b5[_0x6896('0x33')]=_[_0x6896('0x2d')](_0xd6427c,'name');_0x1398b5[_0x6896('0x34')]=_['keys'](_0x5231aa[_0x6896('0x34')]);_0x1398b5[_0x6896('0x35')]=_[_0x6896('0x36')](_0x1398b5[_0x6896('0x33')],_0x1398b5[_0x6896('0x34')]);_0xcbc955[_0x6896('0x37')]=_[_0x6896('0x36')](_0x1398b5['model'],qs[_0x6896('0x38')](_0x5231aa[_0x6896('0x34')][_0x6896('0x38')]));_0xcbc955[_0x6896('0x37')]=_0xcbc955['attributes'][_0x6896('0x39')]?_0xcbc955['attributes']:_0x1398b5[_0x6896('0x33')];if(!_0x5231aa[_0x6896('0x34')][_0x6896('0x3a')](_0x6896('0x3b'))){_0xcbc955[_0x6896('0x1d')]=qs[_0x6896('0x1d')](_0x5231aa[_0x6896('0x34')][_0x6896('0x1d')]);_0xcbc955[_0x6896('0x1b')]=qs[_0x6896('0x1b')](_0x5231aa['query'][_0x6896('0x1b')]);}_0xcbc955[_0x6896('0x3c')]=qs[_0x6896('0x3d')](_0x5231aa[_0x6896('0x34')]['sort']);_0xcbc955['where']=qs[_0x6896('0x35')](_[_0x6896('0x3e')](_0x5231aa[_0x6896('0x34')],_0x1398b5['filters']),_0xd6427c);if(_0x5231aa['query']['filter']){_0xcbc955[_0x6896('0x3f')]=_[_0x6896('0x40')](_0xcbc955[_0x6896('0x3f')],{'$or':_[_0x6896('0x2d')](_0xd6427c,function(_0x33136b){if(_0x33136b[_0x6896('0x31')]!==_0x6896('0x41')){var _0x1296e3={};_0x1296e3[_0x33136b[_0x6896('0x2a')]]={'$like':'%'+_0x5231aa[_0x6896('0x34')]['filter']+'%'};return _0x1296e3;}})});}_0xcbc955=_[_0x6896('0x40')]({},_0xcbc955,_0x5231aa[_0x6896('0x42')]);var _0x5a8bcb={'where':_0xcbc955[_0x6896('0x3f')]};return db[_0x6896('0x2e')][_0x6896('0x1e')](_0x5a8bcb)[_0x6896('0x43')](function(_0x4566fe){_0x2f2ac6[_0x6896('0x1e')]=_0x4566fe;if(_0x5231aa[_0x6896('0x34')][_0x6896('0x44')]){_0xcbc955[_0x6896('0x45')]=[{'all':!![]}];}return db[_0x6896('0x2e')]['findAll'](_0xcbc955);})[_0x6896('0x43')](function(_0x2ab026){_0x2f2ac6[_0x6896('0x46')]=_0x2ab026;return _0x2f2ac6;})[_0x6896('0x43')](respondWithFilteredResult(_0x5a05e0,_0xcbc955))[_0x6896('0x47')](handleError(_0x5a05e0,null));};exports[_0x6896('0x48')]=function(_0x2c9c45,_0x151ca9){var _0x33b6fe={'raw':!![],'where':{'id':_0x2c9c45[_0x6896('0x49')]['id']}},_0xeef151={};_0xeef151['model']=_[_0x6896('0x4a')](db[_0x6896('0x2e')][_0x6896('0x2f')]);_0xeef151['query']=_['keys'](_0x2c9c45[_0x6896('0x34')]);_0xeef151[_0x6896('0x35')]=_['intersection'](_0xeef151['model'],_0xeef151['query']);_0x33b6fe[_0x6896('0x37')]=_[_0x6896('0x36')](_0xeef151[_0x6896('0x33')],qs[_0x6896('0x38')](_0x2c9c45[_0x6896('0x34')][_0x6896('0x38')]));_0x33b6fe[_0x6896('0x37')]=_0x33b6fe['attributes'][_0x6896('0x39')]?_0x33b6fe[_0x6896('0x37')]:_0xeef151['model'];if(_0x2c9c45['query'][_0x6896('0x44')]){_0x33b6fe[_0x6896('0x45')]=[{'all':!![]}];}_0x33b6fe=_[_0x6896('0x40')]({},_0x33b6fe,_0x2c9c45[_0x6896('0x42')]);return db[_0x6896('0x2e')][_0x6896('0x4b')](_0x33b6fe)[_0x6896('0x43')](handleEntityNotFound(_0x151ca9,null))[_0x6896('0x43')](respondWithResult(_0x151ca9,null))[_0x6896('0x47')](handleError(_0x151ca9,null));};exports[_0x6896('0x4c')]=function(_0x203d3e,_0x1bd386){return db['VoiceTransferReport']['create'](_0x203d3e[_0x6896('0x4d')],{})[_0x6896('0x43')](respondWithResult(_0x1bd386,0xc9))[_0x6896('0x47')](handleError(_0x1bd386,null));};exports[_0x6896('0x25')]=function(_0x50c102,_0x3eb67d){if(_0x50c102[_0x6896('0x4d')]['id']){delete _0x50c102[_0x6896('0x4d')]['id'];}return db[_0x6896('0x2e')][_0x6896('0x4b')]({'where':{'id':_0x50c102[_0x6896('0x49')]['id']}})[_0x6896('0x43')](handleEntityNotFound(_0x3eb67d,null))[_0x6896('0x43')](saveUpdates(_0x50c102[_0x6896('0x4d')],null))['then'](respondWithResult(_0x3eb67d,null))['catch'](handleError(_0x3eb67d,null));};exports[_0x6896('0x26')]=function(_0x1503ea,_0x22188e){return db['VoiceTransferReport'][_0x6896('0x4b')]({'where':{'id':_0x1503ea[_0x6896('0x49')]['id']}})[_0x6896('0x43')](handleEntityNotFound(_0x22188e,null))['then'](removeEntity(_0x22188e,null))[_0x6896('0x47')](handleError(_0x22188e,null));};exports[_0x6896('0x4e')]=function(_0x399a1e,_0x4254ff){return db[_0x6896('0x2e')][_0x6896('0x4e')]()[_0x6896('0x43')](respondWithResult(_0x4254ff,null))[_0x6896('0x47')](handleError(_0x4254ff,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 58ad68e..3420e1b 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 _0xa142=['exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x131630,_0x3ca3e8){var _0x55caa1=function(_0x40f732){while(--_0x40f732){_0x131630['push'](_0x131630['shift']());}};_0x55caa1(++_0x3ca3e8);}(_0xa142,0x130));var _0x2a14=function(_0x1dab75,_0x584b43){_0x1dab75=_0x1dab75-0x0;var _0x59df44=_0xa142[_0x1dab75];return _0x59df44;};'use strict';var _=require(_0x2a14('0x0'));var util=require(_0x2a14('0x1'));var logger=require(_0x2a14('0x2'))(_0x2a14('0x3'));var moment=require(_0x2a14('0x4'));var BPromise=require(_0x2a14('0x5'));var rp=require(_0x2a14('0x6'));var fs=require('fs');var path=require(_0x2a14('0x7'));var rimraf=require(_0x2a14('0x8'));var config=require(_0x2a14('0x9'));var attributes=require(_0x2a14('0xa'));module[_0x2a14('0xb')]=function(_0x9ac1aa,_0x1ccb33){return _0x9ac1aa[_0x2a14('0xc')](_0x2a14('0xd'),attributes,{'tableName':_0x2a14('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08f4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0x08f4,0x10c));var _0x408f=function(_0x129a80,_0x4427af){_0x129a80=_0x129a80-0x0;var _0x559111=_0x08f4[_0x129a80];return _0x559111;};'use strict';var _=require(_0x408f('0x0'));var util=require(_0x408f('0x1'));var logger=require(_0x408f('0x2'))(_0x408f('0x3'));var moment=require(_0x408f('0x4'));var BPromise=require(_0x408f('0x5'));var rp=require(_0x408f('0x6'));var fs=require('fs');var path=require(_0x408f('0x7'));var rimraf=require(_0x408f('0x8'));var config=require(_0x408f('0x9'));var attributes=require(_0x408f('0xa'));module[_0x408f('0xb')]=function(_0x51cf2b,_0x468b36){return _0x51cf2b[_0x408f('0xc')](_0x408f('0xd'),attributes,{'tableName':_0x408f('0xe'),'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 545a9f1..f5007f7 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 _0x9b39=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x9b39,0x165));var _0x99b3=function(_0x372590,_0x1ebb65){_0x372590=_0x372590-0x0;var _0x21abe6=_0x9b39[_0x372590];return _0x21abe6;};'use strict';var _=require(_0x99b3('0x0'));var util=require(_0x99b3('0x1'));var moment=require(_0x99b3('0x2'));var BPromise=require(_0x99b3('0x3'));var rs=require(_0x99b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99b3('0x5'));var logger=require(_0x99b3('0x6'))(_0x99b3('0x7'));var config=require(_0x99b3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x99b3('0x9')][_0x99b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeb754c,_0x4ee120,_0x257eeb){return new BPromise(function(_0x16566d,_0x117ccb){return client[_0x99b3('0xb')](_0xeb754c,_0x257eeb)[_0x99b3('0xc')](function(_0x57f1ca){logger[_0x99b3('0xd')](_0x99b3('0xe'),_0x4ee120,_0x99b3('0xf'));logger[_0x99b3('0x10')](_0x99b3('0x11'),_0x4ee120,'request\x20sent',JSON[_0x99b3('0x12')](_0x57f1ca));if(_0x57f1ca[_0x99b3('0x13')]){if(_0x57f1ca[_0x99b3('0x13')][_0x99b3('0x14')]===0x1f4){logger[_0x99b3('0x13')](_0x99b3('0xe'),_0x4ee120,_0x57f1ca[_0x99b3('0x13')][_0x99b3('0x15')]);return _0x117ccb(_0x57f1ca[_0x99b3('0x13')][_0x99b3('0x15')]);}logger[_0x99b3('0x13')](_0x99b3('0xe'),_0x4ee120,_0x57f1ca[_0x99b3('0x13')][_0x99b3('0x15')]);return _0x16566d(_0x57f1ca[_0x99b3('0x13')][_0x99b3('0x15')]);}else{logger[_0x99b3('0xd')](_0x99b3('0xe'),_0x4ee120,_0x99b3('0xf'));_0x16566d(_0x57f1ca[_0x99b3('0x16')][_0x99b3('0x15')]);}})[_0x99b3('0x17')](function(_0x5ce104){logger[_0x99b3('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4ee120,_0x5ce104);_0x117ccb(_0x5ce104);});});}exports[_0x99b3('0x18')]=function(_0x3c1ffb){var _0x55c3ea=this;return new Promise(function(_0x22b548,_0x224970){return db[_0x99b3('0x19')][_0x99b3('0x1a')](_0x3c1ffb[_0x99b3('0x1b')],{'raw':_0x3c1ffb[_0x99b3('0x1c')]?_0x3c1ffb[_0x99b3('0x1c')][_0x99b3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x356b39){logger[_0x99b3('0xd')]('CreateVoiceTransferReport',_0x3c1ffb);logger[_0x99b3('0x10')]('CreateVoiceTransferReport',_0x3c1ffb,JSON[_0x99b3('0x12')](_0x356b39));_0x22b548(_0x356b39);})[_0x99b3('0x17')](function(_0x2f7cfc){logger[_0x99b3('0x13')](_0x99b3('0x18'),_0x2f7cfc[_0x99b3('0x15')],_0x3c1ffb);_0x224970(_0x55c3ea[_0x99b3('0x13')](0x1f4,_0x2f7cfc['message']));});});}; \ No newline at end of file +var _0x2d06=['catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','info','stringify','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x343b56,_0x27ebbf){var _0x4bdc57=function(_0x46cccd){while(--_0x46cccd){_0x343b56['push'](_0x343b56['shift']());}};_0x4bdc57(++_0x27ebbf);}(_0x2d06,0x140));var _0x62d0=function(_0x4e9101,_0x209cdb){_0x4e9101=_0x4e9101-0x0;var _0x1daa69=_0x2d06[_0x4e9101];return _0x1daa69;};'use strict';var _=require(_0x62d0('0x0'));var util=require(_0x62d0('0x1'));var moment=require(_0x62d0('0x2'));var BPromise=require(_0x62d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x62d0('0x5'))(_0x62d0('0x6'));var config=require('../../config/environment');var jayson=require(_0x62d0('0x7'));var client=jayson[_0x62d0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d560b,_0x5360f0,_0x23f4ee){return new BPromise(function(_0x39bbb0,_0x479497){return client[_0x62d0('0x9')](_0x5d560b,_0x23f4ee)[_0x62d0('0xa')](function(_0x245a40){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5360f0,_0x62d0('0xb'));logger[_0x62d0('0xc')](_0x62d0('0xd'),_0x5360f0,_0x62d0('0xb'),JSON['stringify'](_0x245a40));if(_0x245a40[_0x62d0('0xe')]){if(_0x245a40[_0x62d0('0xe')][_0x62d0('0xf')]===0x1f4){logger[_0x62d0('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x5360f0,_0x245a40['error'][_0x62d0('0x10')]);return _0x479497(_0x245a40['error'][_0x62d0('0x10')]);}logger[_0x62d0('0xe')](_0x62d0('0x11'),_0x5360f0,_0x245a40[_0x62d0('0xe')]['message']);return _0x39bbb0(_0x245a40[_0x62d0('0xe')]['message']);}else{logger['info'](_0x62d0('0x11'),_0x5360f0,_0x62d0('0xb'));_0x39bbb0(_0x245a40['result'][_0x62d0('0x10')]);}})[_0x62d0('0x12')](function(_0x324282){logger[_0x62d0('0xe')](_0x62d0('0x11'),_0x5360f0,_0x324282);_0x479497(_0x324282);});});}exports[_0x62d0('0x13')]=function(_0x4fc149){var _0x51e9a8=this;return new Promise(function(_0x1539db,_0x300a19){return db[_0x62d0('0x14')]['create'](_0x4fc149[_0x62d0('0x15')],{'raw':_0x4fc149[_0x62d0('0x16')]?_0x4fc149[_0x62d0('0x16')][_0x62d0('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1ad7ea){logger[_0x62d0('0x18')]('CreateVoiceTransferReport',_0x4fc149);logger[_0x62d0('0xc')](_0x62d0('0x13'),_0x4fc149,JSON[_0x62d0('0x19')](_0x1ad7ea));_0x1539db(_0x1ad7ea);})[_0x62d0('0x12')](function(_0x4941ed){logger[_0x62d0('0xe')](_0x62d0('0x13'),_0x4941ed[_0x62d0('0x10')],_0x4fc149);_0x300a19(_0x51e9a8['error'](0x1f4,_0x4941ed[_0x62d0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a8cca0a..d474191 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 _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x4f4300,_0x344041){var _0x56f6f4=function(_0x9d9950){while(--_0x9d9950){_0x4f4300['push'](_0x4f4300['shift']());}};_0x56f6f4(++_0x344041);}(_0xe5b3,0x133));var _0x3e5b=function(_0x59a17f,_0x393c90){_0x59a17f=_0x59a17f-0x0;var _0x166e80=_0xe5b3[_0x59a17f];return _0x166e80;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 3d25fd0..48a9dc2 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 _0x98d3=['transfer\x20executed!','path','lodash','../../config/environment','bluebird','client','http','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','request','error','message','catch','User','findOne','agent','then','VoiceChannels','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','UserId','conference','webbar:conference','transfer\x20fired:','transferNumber'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x98d3,0x173));var _0x398d=function(_0x8a2e9d,_0xa7a01c){_0x8a2e9d=_0x8a2e9d-0x0;var _0xf64cdd=_0x98d3[_0x8a2e9d];return _0xf64cdd;};'use strict';var path=require(_0x398d('0x0'));var fs=require('fs');var _=require(_0x398d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x398d('0x2'));var util=require('util');var BPromise=require(_0x398d('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x398d('0x4')][_0x398d('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x398d('0x6'));config[_0x398d('0x7')]=_[_0x398d('0x8')](config['redis'],{'host':_0x398d('0x9'),'port':0x18eb});var io=require(_0x398d('0xa'))(new Redis(config[_0x398d('0x7')]));var Schema=require(_0x398d('0xb'));var originateValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0xe')]},'callerId':{'type':_0x398d('0xd')},'callbackUrl':{'type':_0x398d('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x10')]},'transferNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});function emit(_0x278004,_0x4099a5,_0x3ff03c){logger[_0x398d('0x12')](_0x278004,_0x4099a5,JSON['stringify'](_0x3ff03c));io['to'](_0x278004)[_0x398d('0x13')](_0x4099a5,_0x3ff03c);}function handleError(_0x54e717){return function(_0x673840){console[_0x398d('0x14')](_0x398d('0x15'),_0x673840,_0x673840 instanceof RangeError);logger['error'](_0x673840['stack']);if(_0x673840 instanceof RangeError){if(_0x673840['name']){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x194)[_0x398d('0x18')](_0x673840);}else{if(_0x673840[_0x398d('0x16')]){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x1f4)[_0x398d('0x18')](_0x673840);}};}function checkError(){return function(_0x552411){if(!_0x552411){throw new RangeError('NotFound');}return _0x552411;};}function respondWithRpcPromise(_0x5e667d,_0x16e580){return new BPromise(function(_0x3b275a,_0x1ea5f9){var _0x2affed=amiClient;return _0x2affed[_0x398d('0x19')](_0x5e667d,_0x16e580)['then'](function(_0x5c4c70){if(_0x5c4c70[_0x398d('0x1a')]){if(_0x5c4c70[_0x398d('0x1a')]['code']===0x1f4){return _0x1ea5f9(_0x5c4c70[_0x398d('0x1a')][_0x398d('0x1b')]);}return _0x3b275a(_0x5c4c70['error']['message']);}else{_0x3b275a(_0x5c4c70['result']);}})[_0x398d('0x1c')](function(_0x2cc4ef){_0x1ea5f9(_0x2cc4ef);});});}function getAgent(_0x24fa2c){return db[_0x398d('0x1d')][_0x398d('0x1e')]({'where':{'id':_0x24fa2c,'role':_0x398d('0x1f')}})[_0x398d('0x20')](checkError());}function getAgentCheckSession(_0x17318c,_0x4f4466){return new BPromise(function(_0x35bd19,_0x557dce){var _0x4aa568=respondWithRpcPromise(_0x398d('0x21'));var _0x27bc6e=getAgent(_0x17318c);Promise['all']([_0x4aa568,_0x27bc6e])[_0x398d('0x20')](function(_0x558249){var _0x3ae172=_0x558249[0x0];var _0x8abf30=_0x558249[0x1];var _0x582d16=_['filter'](_0x3ae172[_0x398d('0x22')],function(_0x2ca780){return _0x2ca780['UserId']==_0x8abf30['id']&&_0x2ca780[_0x398d('0x23')]==_0x4f4466;});if(_0x582d16[_0x398d('0x24')]==0x1){_0x35bd19(_0x8abf30);}else{_0x557dce(new RangeError(_0x398d('0x25')+_0x4f4466+_0x398d('0x26')));}});});}exports[_0x398d('0x27')]=function(_0x3bcc5e,_0x490bee){logger['info'](_0x398d('0x28'),_0x3bcc5e[_0x398d('0x29')]);var _0x45f1a3=originateValidation[_0x398d('0xb')](_0x3bcc5e[_0x398d('0x29')]);if(_0x45f1a3[_0x398d('0x24')]>0x0){return _0x490bee[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x45f1a3);}var _0x1827be=_0x3bcc5e['body'][_0x398d('0x2b')];var _0x3807f0=_0x3bcc5e[_0x398d('0x29')]['callNumber'];var _0x5be779=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2c')];var _0x3fb8ff=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2d')];return getAgent(_0x1827be)[_0x398d('0x20')](function(_0x324d76){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x324d76[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x324d76[_0x398d('0x16')]),_0x398d('0x31'),{'callNumber':_0x3807f0,'callerId':_0x5be779,'callbackUrl':_0x3fb8ff});return _0x490bee[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x32')});})[_0x398d('0x1c')](handleError(_0x490bee));};exports[_0x398d('0x33')]=function(_0x5ae43b,_0x244512){logger[_0x398d('0x12')](_0x398d('0x34'),_0x5ae43b[_0x398d('0x29')]);var _0x209c2b=hangupValidation[_0x398d('0xb')](_0x5ae43b[_0x398d('0x29')]);if(_0x209c2b['length']>0x0){return _0x244512[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x209c2b);}var _0x165d26=_0x5ae43b[_0x398d('0x29')][_0x398d('0x2b')];var _0x219651=_0x5ae43b[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x165d26)['then'](function(_0x208eb2){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x208eb2[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x208eb2[_0x398d('0x16')]),_0x398d('0x35'),{'sessionId':_0x219651});return _0x244512['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x36')});})[_0x398d('0x1c')](handleError(_0x244512));};exports[_0x398d('0x37')]=function(_0x217fc0,_0x30ac4d){logger[_0x398d('0x12')](_0x398d('0x38'),_0x217fc0[_0x398d('0x29')]);var _0x5d7d33=answerValidation[_0x398d('0xb')](_0x217fc0[_0x398d('0x29')]);if(_0x5d7d33[_0x398d('0x24')]>0x0){return _0x30ac4d[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x5d7d33);}var _0x227984=_0x217fc0['body'][_0x398d('0x2b')];var _0x1a6bdc=_0x217fc0['body'][_0x398d('0x23')];return getAgent(_0x227984)[_0x398d('0x20')](function(_0x2f419f){logger['info'](_0x398d('0x2e'),_0x2f419f[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x2f419f[_0x398d('0x16')]),'webbar:answer',{'sessionId':_0x1a6bdc});return _0x30ac4d[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x39')});})['catch'](handleError(_0x30ac4d));};exports[_0x398d('0x3a')]=function(_0x3f9fb2,_0x578a0f){logger[_0x398d('0x12')](_0x398d('0x3b'),_0x3f9fb2[_0x398d('0x29')]);var _0x1f67a9=holdValidation[_0x398d('0xb')](_0x3f9fb2[_0x398d('0x29')]);if(_0x1f67a9[_0x398d('0x24')]>0x0){return _0x578a0f[_0x398d('0x17')](0x190)['json'](_0x1f67a9);}var _0x34c0fc=_0x3f9fb2[_0x398d('0x29')]['userId'];var _0x5f4aef=_0x3f9fb2[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x34c0fc)[_0x398d('0x20')](function(_0x35d260){logger['info'](_0x398d('0x2e'),_0x35d260['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x35d260[_0x398d('0x16')]),'webbar:hold',{'sessionId':_0x5f4aef});return _0x578a0f['status'](0xc8)['json']({'error':![],'message':_0x398d('0x3c')});})[_0x398d('0x1c')](handleError(_0x578a0f));};exports[_0x398d('0x3d')]=function(_0x3fa030,_0x578784){logger['info'](_0x398d('0x3e'),_0x3fa030[_0x398d('0x29')]);var _0x1615ee=unholdValidation['validate'](_0x3fa030[_0x398d('0x29')]);if(_0x1615ee[_0x398d('0x24')]>0x0){return _0x578784[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x1615ee);}var _0x20c488=_0x3fa030[_0x398d('0x29')]['userId'];var _0x158828=_0x3fa030[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x20c488)[_0x398d('0x20')](function(_0x499f2e){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x499f2e[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x499f2e['name']),_0x398d('0x3f'),{'sessionId':_0x158828});return _0x578784['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x40')});})['catch'](handleError(_0x578784));};exports[_0x398d('0x41')]=function(_0x5109e7,_0x2eac8c){logger[_0x398d('0x12')](_0x398d('0x42'),_0x2eac8c[_0x398d('0x29')]);var _0x360e67=callsValidation[_0x398d('0xb')](_0x5109e7[_0x398d('0x29')]);if(_0x360e67[_0x398d('0x24')]>0x0){return _0x2eac8c[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x360e67);}var _0x179862=_0x5109e7[_0x398d('0x29')][_0x398d('0x2b')];var _0x783c74=respondWithRpcPromise(_0x398d('0x21'));var _0x3f3108=getAgent(_0x179862);return Promise[_0x398d('0x43')]([_0x783c74,_0x3f3108])[_0x398d('0x20')](function(_0x4717cf){var _0xb25709=_0x4717cf[0x0];var _0x7f4acb=_0x4717cf[0x1];var _0xcd2b9d=_['filter'](_0xb25709[_0x398d('0x22')],function(_0x26d6f8){return _0x26d6f8[_0x398d('0x44')]==_0x7f4acb['id'];});return _0x2eac8c[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'count':_0xcd2b9d[_0x398d('0x24')],'rows':_0xcd2b9d});})[_0x398d('0x1c')](handleError(_0x2eac8c));};exports[_0x398d('0x45')]=function(_0xe6cf33,_0x9c3971){logger[_0x398d('0x12')]('conference\x20fired:',_0xe6cf33[_0x398d('0x29')]);var _0x207fd6=conferenceValidation['validate'](_0xe6cf33[_0x398d('0x29')]);if(_0x207fd6['length']>0x0){return _0x9c3971['status'](0x190)['json'](_0x207fd6);}var _0x37646f=_0xe6cf33[_0x398d('0x29')]['userId'];return getAgent(_0x37646f)[_0x398d('0x20')](function(_0x278262){logger[_0x398d('0x12')]('entityFound:',_0x278262[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x278262['name']),_0x398d('0x46'));return _0x9c3971['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x398d('0x1c')](handleError(_0x9c3971));};exports['transfer']=function(_0x35c204,_0x1b5929){logger[_0x398d('0x12')](_0x398d('0x47'),_0x35c204[_0x398d('0x29')]);var _0x56e3f6=transferValidation[_0x398d('0xb')](_0x35c204[_0x398d('0x29')]);if(_0x56e3f6[_0x398d('0x24')]>0x0){return _0x1b5929[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x56e3f6);}var _0x12d76f=_0x35c204[_0x398d('0x29')]['userId'];var _0x227661=_0x35c204[_0x398d('0x29')][_0x398d('0x23')];var _0x5085f4=_0x35c204['body'][_0x398d('0x48')];return getAgent(_0x12d76f)[_0x398d('0x20')](function(_0x540121){logger['info'](_0x398d('0x2e'),_0x540121['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x540121[_0x398d('0x16')]),'webbar:transfer',{'sessionId':_0x227661,'transferNumber':_0x5085f4});return _0x1b5929['status'](0xc8)['json']({'error':![],'message':_0x398d('0x49')});})[_0x398d('0x1c')](handleError(_0x1b5929));}; \ No newline at end of file +var _0x765e=['NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','entityFound:','hold','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send'];(function(_0x392ab0,_0x5a7f70){var _0x495873=function(_0x4c5c34){while(--_0x4c5c34){_0x392ab0['push'](_0x392ab0['shift']());}};_0x495873(++_0x5a7f70);}(_0x765e,0x131));var _0xe765=function(_0x16a638,_0x4dc11c){_0x16a638=_0x16a638-0x0;var _0x38b590=_0x765e[_0x16a638];return _0x38b590;};'use strict';var path=require(_0xe765('0x0'));var fs=require('fs');var _=require(_0xe765('0x1'));var db=require(_0xe765('0x2'))['db'];var config=require(_0xe765('0x3'));var util=require(_0xe765('0x4'));var BPromise=require(_0xe765('0x5'));var jayson=require(_0xe765('0x6'));var amiClient=jayson[_0xe765('0x7')][_0xe765('0x8')]({'port':0x232a});var logger=require(_0xe765('0x9'))(_0xe765('0xa'));var Redis=require(_0xe765('0xb'));config[_0xe765('0xc')]=_[_0xe765('0xd')](config[_0xe765('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xe765('0xe'))(new Redis(config[_0xe765('0xc')]));var Schema=require(_0xe765('0xf'));var originateValidation=new Schema({'userId':{'type':_0xe765('0x10'),'required':[!![],_0xe765('0x11')]},'callNumber':{'type':_0xe765('0x12'),'required':[!![],_0xe765('0x13')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe765('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xe765('0x10'),'required':[!![],_0xe765('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe765('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe765('0x11')]},'sessionId':{'type':_0xe765('0x12'),'required':[!![],_0xe765('0x14')]},'transferNumber':{'type':_0xe765('0x12'),'required':[!![],_0xe765('0x15')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe765('0x11')]},'sessionId':{'type':_0xe765('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe765('0x10'),'required':[!![],_0xe765('0x11')]},'sessionId':{'type':_0xe765('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xe765('0x10'),'required':[!![],_0xe765('0x11')]}});function emit(_0x3c887b,_0x4856fe,_0xb240d6){logger[_0xe765('0x16')](_0x3c887b,_0x4856fe,JSON[_0xe765('0x17')](_0xb240d6));io['to'](_0x3c887b)[_0xe765('0x18')](_0x4856fe,_0xb240d6);}function handleError(_0x2fcb46){return function(_0xf93371){console[_0xe765('0x19')](_0xe765('0x1a'),_0xf93371,_0xf93371 instanceof RangeError);logger[_0xe765('0x1b')](_0xf93371['stack']);if(_0xf93371 instanceof RangeError){if(_0xf93371[_0xe765('0x1c')]){delete _0xf93371['name'];}_0x2fcb46[_0xe765('0x1d')](0x194)[_0xe765('0x1e')](_0xf93371);}else{if(_0xf93371['name']){delete _0xf93371[_0xe765('0x1c')];}_0x2fcb46['status'](0x1f4)[_0xe765('0x1e')](_0xf93371);}};}function checkError(){return function(_0x368b7e){if(!_0x368b7e){throw new RangeError(_0xe765('0x1f'));}return _0x368b7e;};}function respondWithRpcPromise(_0x50970b,_0x51813d){return new BPromise(function(_0x4b789b,_0x1c6de4){var _0x2a4427=amiClient;return _0x2a4427[_0xe765('0x20')](_0x50970b,_0x51813d)[_0xe765('0x21')](function(_0x54b59c){if(_0x54b59c['error']){if(_0x54b59c[_0xe765('0x1b')][_0xe765('0x22')]===0x1f4){return _0x1c6de4(_0x54b59c[_0xe765('0x1b')][_0xe765('0x23')]);}return _0x4b789b(_0x54b59c[_0xe765('0x1b')]['message']);}else{_0x4b789b(_0x54b59c[_0xe765('0x24')]);}})['catch'](function(_0x2b1f66){_0x1c6de4(_0x2b1f66);});});}function getAgent(_0xff097f){return db[_0xe765('0x25')][_0xe765('0x26')]({'where':{'id':_0xff097f,'role':_0xe765('0x27')}})[_0xe765('0x21')](checkError());}function getAgentCheckSession(_0x471d57,_0x530838){return new BPromise(function(_0x55086d,_0x52476f){var _0x4bc5c1=respondWithRpcPromise(_0xe765('0x28'));var _0x3f7493=getAgent(_0x471d57);Promise[_0xe765('0x29')]([_0x4bc5c1,_0x3f7493])[_0xe765('0x21')](function(_0x1a8c01){var _0x4fce2c=_0x1a8c01[0x0];var _0x43349b=_0x1a8c01[0x1];var _0x865ae8=_[_0xe765('0x2a')](_0x4fce2c['rows'],function(_0x5947c1){return _0x5947c1[_0xe765('0x2b')]==_0x43349b['id']&&_0x5947c1['sessionId']==_0x530838;});if(_0x865ae8[_0xe765('0x2c')]==0x1){_0x55086d(_0x43349b);}else{_0x52476f(new RangeError(_0xe765('0x2d')+_0x530838+_0xe765('0x2e')));}});});}exports[_0xe765('0x2f')]=function(_0x3b659a,_0x56127d){logger['info'](_0xe765('0x30'),_0x3b659a[_0xe765('0x31')]);var _0x2eee38=originateValidation[_0xe765('0xf')](_0x3b659a[_0xe765('0x31')]);if(_0x2eee38['length']>0x0){return _0x56127d['status'](0x190)[_0xe765('0x32')](_0x2eee38);}var _0x5bdd4b=_0x3b659a[_0xe765('0x31')][_0xe765('0x33')];var _0xd7ce30=_0x3b659a[_0xe765('0x31')][_0xe765('0x34')];var _0x45fd85=_0x3b659a[_0xe765('0x31')]['callerId'];var _0x494213=_0x3b659a['body'][_0xe765('0x35')];return getAgent(_0x5bdd4b)[_0xe765('0x21')](function(_0x120ca9){logger[_0xe765('0x16')]('entityFound:',_0x120ca9[_0xe765('0x1c')]);emit(util[_0xe765('0x36')](_0xe765('0x37'),_0x120ca9[_0xe765('0x1c')]),'webbar:originate',{'callNumber':_0xd7ce30,'callerId':_0x45fd85,'callbackUrl':_0x494213});return _0x56127d[_0xe765('0x1d')](0xc8)['json']({'error':![],'message':_0xe765('0x38')});})[_0xe765('0x39')](handleError(_0x56127d));};exports[_0xe765('0x3a')]=function(_0x1f58ef,_0x1be855){logger[_0xe765('0x16')](_0xe765('0x3b'),_0x1f58ef[_0xe765('0x31')]);var _0xc6618c=hangupValidation[_0xe765('0xf')](_0x1f58ef['body']);if(_0xc6618c[_0xe765('0x2c')]>0x0){return _0x1be855[_0xe765('0x1d')](0x190)[_0xe765('0x32')](_0xc6618c);}var _0x531cce=_0x1f58ef['body']['userId'];var _0x43bea6=_0x1f58ef['body'][_0xe765('0x3c')];return getAgent(_0x531cce)[_0xe765('0x21')](function(_0x3be7d7){logger[_0xe765('0x16')]('entityFound:',_0x3be7d7[_0xe765('0x1c')]);emit(util[_0xe765('0x36')](_0xe765('0x37'),_0x3be7d7[_0xe765('0x1c')]),_0xe765('0x3d'),{'sessionId':_0x43bea6});return _0x1be855[_0xe765('0x1d')](0xc8)[_0xe765('0x32')]({'error':![],'message':_0xe765('0x3e')});})[_0xe765('0x39')](handleError(_0x1be855));};exports[_0xe765('0x3f')]=function(_0x495e4e,_0x3d3a24){logger['info'](_0xe765('0x40'),_0x495e4e[_0xe765('0x31')]);var _0x4d2814=answerValidation[_0xe765('0xf')](_0x495e4e['body']);if(_0x4d2814['length']>0x0){return _0x3d3a24['status'](0x190)[_0xe765('0x32')](_0x4d2814);}var _0xb77b5e=_0x495e4e[_0xe765('0x31')]['userId'];var _0x2de9de=_0x495e4e[_0xe765('0x31')][_0xe765('0x3c')];return getAgent(_0xb77b5e)[_0xe765('0x21')](function(_0x2f664c){logger[_0xe765('0x16')](_0xe765('0x41'),_0x2f664c[_0xe765('0x1c')]);emit(util[_0xe765('0x36')]('user:%s',_0x2f664c[_0xe765('0x1c')]),'webbar:answer',{'sessionId':_0x2de9de});return _0x3d3a24['status'](0xc8)[_0xe765('0x32')]({'error':![],'message':'answer\x20executed!'});})[_0xe765('0x39')](handleError(_0x3d3a24));};exports[_0xe765('0x42')]=function(_0x1707aa,_0x48b8a5){logger[_0xe765('0x16')]('hold\x20fired:',_0x1707aa[_0xe765('0x31')]);var _0x14421d=holdValidation[_0xe765('0xf')](_0x1707aa['body']);if(_0x14421d[_0xe765('0x2c')]>0x0){return _0x48b8a5[_0xe765('0x1d')](0x190)[_0xe765('0x32')](_0x14421d);}var _0x2d360e=_0x1707aa['body']['userId'];var _0x5391c8=_0x1707aa[_0xe765('0x31')][_0xe765('0x3c')];return getAgent(_0x2d360e)[_0xe765('0x21')](function(_0x58310d){logger[_0xe765('0x16')]('entityFound:',_0x58310d[_0xe765('0x1c')]);emit(util[_0xe765('0x36')](_0xe765('0x37'),_0x58310d[_0xe765('0x1c')]),_0xe765('0x43'),{'sessionId':_0x5391c8});return _0x48b8a5[_0xe765('0x1d')](0xc8)['json']({'error':![],'message':_0xe765('0x44')});})[_0xe765('0x39')](handleError(_0x48b8a5));};exports[_0xe765('0x45')]=function(_0x1214a8,_0x14c3b5){logger[_0xe765('0x16')]('unhold\x20fired:',_0x1214a8['body']);var _0x99f318=unholdValidation[_0xe765('0xf')](_0x1214a8[_0xe765('0x31')]);if(_0x99f318['length']>0x0){return _0x14c3b5[_0xe765('0x1d')](0x190)[_0xe765('0x32')](_0x99f318);}var _0x2be110=_0x1214a8[_0xe765('0x31')][_0xe765('0x33')];var _0x1f75a2=_0x1214a8[_0xe765('0x31')][_0xe765('0x3c')];return getAgent(_0x2be110)['then'](function(_0x4ae23b){logger[_0xe765('0x16')]('entityFound:',_0x4ae23b[_0xe765('0x1c')]);emit(util[_0xe765('0x36')](_0xe765('0x37'),_0x4ae23b['name']),_0xe765('0x46'),{'sessionId':_0x1f75a2});return _0x14c3b5[_0xe765('0x1d')](0xc8)['json']({'error':![],'message':_0xe765('0x47')});})[_0xe765('0x39')](handleError(_0x14c3b5));};exports[_0xe765('0x48')]=function(_0x457667,_0xabbaa1){logger[_0xe765('0x16')](_0xe765('0x49'),_0xabbaa1[_0xe765('0x31')]);var _0x45be53=callsValidation[_0xe765('0xf')](_0x457667[_0xe765('0x31')]);if(_0x45be53[_0xe765('0x2c')]>0x0){return _0xabbaa1[_0xe765('0x1d')](0x190)['json'](_0x45be53);}var _0x11c08a=_0x457667[_0xe765('0x31')][_0xe765('0x33')];var _0x3563a2=respondWithRpcPromise(_0xe765('0x28'));var _0x3d5553=getAgent(_0x11c08a);return Promise[_0xe765('0x29')]([_0x3563a2,_0x3d5553])[_0xe765('0x21')](function(_0x60844c){var _0x557217=_0x60844c[0x0];var _0x138118=_0x60844c[0x1];var _0x478d32=_[_0xe765('0x2a')](_0x557217[_0xe765('0x4a')],function(_0x4dd273){return _0x4dd273[_0xe765('0x2b')]==_0x138118['id'];});return _0xabbaa1[_0xe765('0x1d')](0xc8)[_0xe765('0x32')]({'count':_0x478d32[_0xe765('0x2c')],'rows':_0x478d32});})[_0xe765('0x39')](handleError(_0xabbaa1));};exports[_0xe765('0x4b')]=function(_0x414ec2,_0x4a19d8){logger[_0xe765('0x16')](_0xe765('0x4c'),_0x414ec2['body']);var _0x413849=conferenceValidation[_0xe765('0xf')](_0x414ec2[_0xe765('0x31')]);if(_0x413849['length']>0x0){return _0x4a19d8[_0xe765('0x1d')](0x190)[_0xe765('0x32')](_0x413849);}var _0x118d34=_0x414ec2['body']['userId'];return getAgent(_0x118d34)['then'](function(_0x39342b){logger[_0xe765('0x16')]('entityFound:',_0x39342b['name']);emit(util[_0xe765('0x36')]('user:%s',_0x39342b[_0xe765('0x1c')]),_0xe765('0x4d'));return _0x4a19d8[_0xe765('0x1d')](0xc8)[_0xe765('0x32')]({'error':![],'message':_0xe765('0x4e')});})[_0xe765('0x39')](handleError(_0x4a19d8));};exports[_0xe765('0x4f')]=function(_0x335aa5,_0x23ee0a){logger[_0xe765('0x16')](_0xe765('0x50'),_0x335aa5['body']);var _0x7f2a02=transferValidation[_0xe765('0xf')](_0x335aa5[_0xe765('0x31')]);if(_0x7f2a02[_0xe765('0x2c')]>0x0){return _0x23ee0a['status'](0x190)[_0xe765('0x32')](_0x7f2a02);}var _0xe1a631=_0x335aa5[_0xe765('0x31')]['userId'];var _0x20ad2a=_0x335aa5[_0xe765('0x31')][_0xe765('0x3c')];var _0x129468=_0x335aa5[_0xe765('0x31')][_0xe765('0x51')];return getAgent(_0xe1a631)[_0xe765('0x21')](function(_0x1dfa27){logger[_0xe765('0x16')](_0xe765('0x41'),_0x1dfa27[_0xe765('0x1c')]);emit(util[_0xe765('0x36')]('user:%s',_0x1dfa27[_0xe765('0x1c')]),_0xe765('0x52'),{'sessionId':_0x20ad2a,'transferNumber':_0x129468});return _0x23ee0a['status'](0xc8)[_0xe765('0x32')]({'error':![],'message':_0xe765('0x53')});})[_0xe765('0x39')](handleError(_0x23ee0a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 93ee06f..4b4e46f 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 _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file +var _0x2542=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x425a15,_0xa1ec1c){var _0xaba818=function(_0x2d2a3a){while(--_0x2d2a3a){_0x425a15['push'](_0x425a15['shift']());}};_0xaba818(++_0xa1ec1c);}(_0x2542,0x169));var _0x2254=function(_0x2b9b80,_0x496889){_0x2b9b80=_0x2b9b80-0x0;var _0x2e391e=_0x2542[_0x2b9b80];return _0x2e391e;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x9')](_0x2254('0x10'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x9')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['getAnswers']);router['get'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x14')]);router[_0x2254('0x9')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['getApplications']);router[_0x2254('0x16')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x16')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller[_0x2254('0x17')]);router[_0x2254('0x16')](_0x2254('0x12'),auth['isAuthenticated'](),controller[_0x2254('0x18')]);router['post'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x19')]);router[_0x2254('0x16')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2254('0x1a')]);router[_0x2254('0x16')](_0x2254('0x1b'),auth[_0x2254('0xc')](),controller[_0x2254('0x1c')]);router[_0x2254('0x1d')]('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x1e')]);router[_0x2254('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2254('0x1f')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x20')]);module[_0x2254('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index c16a65c..9aa6bae 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 _0x2156=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2156,0x18b));var _0x6215=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2156[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x6215('0x0'));var rs=require('randomstring');module[_0x6215('0x1')]={'name':{'type':Sequelize[_0x6215('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x6215('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6215('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6215('0x2')],'defaultValue':function(){return rs[_0x6215('0x3')]();}},'phone':{'type':Sequelize[_0x6215('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6215('0x4'),_0x6215('0x5'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x6215('0x2')]},'authToken':{'type':Sequelize[_0x6215('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6215('0x6')],'defaultValue':function(){return _0x6215('0x7');}},'notificationSound':{'type':Sequelize[_0x6215('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6215('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6215('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6215('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6215('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6215('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6215('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f9069){if(!_0x3f9069){this[_0x6215('0xb')]('mandatoryDispositionPauseId',null);}this[_0x6215('0xb')](_0x6215('0xc'),_0x3f9069);}},'description':{'type':Sequelize[_0x6215('0x2')]}}; \ No newline at end of file +var _0xeac8=['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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x4a0972,_0x597766){var _0x2d1715=function(_0x1fadc2){while(--_0x1fadc2){_0x4a0972['push'](_0x4a0972['shift']());}};_0x2d1715(++_0x597766);}(_0xeac8,0x14a));var _0x8eac=function(_0x13893b,_0x516874){_0x13893b=_0x13893b-0x0;var _0x1380f3=_0xeac8[_0x13893b];return _0x1380f3;};'use strict';var Sequelize=require(_0x8eac('0x0'));var rs=require(_0x8eac('0x1'));module[_0x8eac('0x2')]={'name':{'type':Sequelize[_0x8eac('0x3')],'unique':_0x8eac('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x8eac('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8eac('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8eac('0x3')],'defaultValue':function(){return rs[_0x8eac('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8eac('0x6')]('twilio',_0x8eac('0x7'))},'accountSid':{'type':Sequelize[_0x8eac('0x3')]},'baseUrl':{'type':Sequelize[_0x8eac('0x3')]},'authToken':{'type':Sequelize[_0x8eac('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8eac('0x8')],'defaultValue':function(){return _0x8eac('0x9');}},'notificationSound':{'type':Sequelize[_0x8eac('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8eac('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8eac('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8eac('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8eac('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8eac('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8eac('0xa')],'defaultValue':![],'comment':_0x8eac('0xc'),'set':function(_0x4c39d8){if(!_0x4c39d8){this[_0x8eac('0xd')](_0x8eac('0xe'),null);}this['setDataValue'](_0x8eac('0xf'),_0x4c39d8);}},'description':{'type':Sequelize[_0x8eac('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6462e52..872b65b 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 _0x5122=['waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','limit','count','offset','set','Content-Range','save','update','destroy','get','WhatsappAccounts','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','Disposition','getDispositions','findOne','rawAttributes','WhatsappAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','options','removeAnswers','addAgents','spread','emit','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','send','getApplications','notify','Applications','account','statuses','state','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','whatsapp:','Body','MessageSid','sinch','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent'];(function(_0x1dd7eb,_0x5d552b){var _0x2f550a=function(_0x186183){while(--_0x186183){_0x1dd7eb['push'](_0x1dd7eb['shift']());}};_0x2f550a(++_0x5d552b);}(_0x5122,0x190));var _0x2512=function(_0x161f26,_0x5ca49d){_0x161f26=_0x161f26-0x0;var _0x2f231b=_0x5122[_0x161f26];return _0x2f231b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2512('0x0'));var zipdir=require(_0x2512('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2512('0x2'));var moment=require(_0x2512('0x3'));var BPromise=require(_0x2512('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2512('0x5'));var sox=require('sox');var csv=require(_0x2512('0x6'));var ejs=require(_0x2512('0x7'));var fs=require('fs');var fs_extra=require(_0x2512('0x8'));var _=require(_0x2512('0x9'));var squel=require(_0x2512('0xa'));var crypto=require('crypto');var jsforce=require(_0x2512('0xb'));var deskjs=require(_0x2512('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2512('0xd'));var Redis=require(_0x2512('0xe'));var authService=require(_0x2512('0xf'));var qs=require(_0x2512('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2512('0x11'));var logger=require(_0x2512('0x12'))('api');var utils=require(_0x2512('0x13'));var config=require(_0x2512('0x14'));var licenseUtil=require(_0x2512('0x15'));var db=require(_0x2512('0x16'))['db'];config['redis']=_[_0x2512('0x17')](config[_0x2512('0x18')],{'host':_0x2512('0x19'),'port':0x18eb});var socket=require(_0x2512('0x1a'))(new Redis(config[_0x2512('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x2512('0x1b'));var client=jayson['client'][_0x2512('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x3b2841,_0x93c72e,_0xabfb22,_0x152e4a){return new BPromise(function(_0xd56770,_0x147556){var _0x1e4962=_0x152e4a||client;return _0x1e4962['request'](_0x3b2841,_0xabfb22)[_0x2512('0x1d')](function(_0x35d97e){logger[_0x2512('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x93c72e,_0x2512('0x1f'));logger[_0x2512('0x20')](_0x2512('0x21'),_0x93c72e,'request\x20sent',JSON[_0x2512('0x22')](_0x35d97e));if(_0x35d97e['error']){if(_0x35d97e['error'][_0x2512('0x23')]===0x1f4){logger[_0x2512('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x93c72e,_0x35d97e[_0x2512('0x24')]['message']);return _0x147556(_0x35d97e['error'][_0x2512('0x25')]);}logger['error'](_0x2512('0x26'),_0x93c72e,_0x35d97e[_0x2512('0x24')]['message']);return _0xd56770(_0x35d97e[_0x2512('0x24')][_0x2512('0x25')]);}else{logger[_0x2512('0x1e')](_0x2512('0x26'),_0x93c72e,_0x2512('0x1f'));_0xd56770(_0x35d97e[_0x2512('0x27')][_0x2512('0x25')]);}})[_0x2512('0x28')](function(_0x2f2ea4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x93c72e,_0x2f2ea4);_0x147556(_0x2f2ea4);});});}function respondWithStatusCode(_0x3dda47,_0x4b7e31){_0x4b7e31=_0x4b7e31||0xcc;return function(_0x15499e){if(_0x15499e){return _0x3dda47[_0x2512('0x29')](_0x4b7e31);}return _0x3dda47[_0x2512('0x2a')](_0x4b7e31)[_0x2512('0x2b')]();};}function respondWithResult(_0x4762f9,_0x2988fe){_0x2988fe=_0x2988fe||0xc8;return function(_0x98aee7){if(_0x98aee7){return _0x4762f9[_0x2512('0x2a')](_0x2988fe)[_0x2512('0x2c')](_0x98aee7);}};}function respondWithFilteredResult(_0x4bb8d4,_0x462713){return function(_0x88094a){if(_0x88094a){var _0x1d22b6=typeof _0x462713['offset']==='undefined'&&typeof _0x462713[_0x2512('0x2d')]==='undefined';var _0x582665=_0x88094a[_0x2512('0x2e')];var _0x1a59f8=_0x1d22b6?0x0:_0x462713[_0x2512('0x2f')];var _0x4143b1=_0x1d22b6?_0x88094a[_0x2512('0x2e')]:_0x462713[_0x2512('0x2f')]+_0x462713[_0x2512('0x2d')];var _0x5dc984;if(_0x4143b1>=_0x582665){_0x4143b1=_0x582665;_0x5dc984=0xc8;}else{_0x5dc984=0xce;}_0x4bb8d4[_0x2512('0x2a')](_0x5dc984);return _0x4bb8d4[_0x2512('0x30')](_0x2512('0x31'),_0x1a59f8+'-'+_0x4143b1+'/'+_0x582665)['json'](_0x88094a);}return null;};}function patchUpdates(_0x345df9){return function(_0x1387bb){try{jsonpatch['apply'](_0x1387bb,_0x345df9,!![]);}catch(_0x3559ec){return BPromise['reject'](_0x3559ec);}return _0x1387bb[_0x2512('0x32')]();};}function saveUpdates(_0x34a0b2,_0x2a64e6){return function(_0x9f12f7){if(_0x9f12f7){return _0x9f12f7[_0x2512('0x33')](_0x34a0b2)[_0x2512('0x1d')](function(_0x54f7ab){return _0x54f7ab;});}return null;};}function removeEntity(_0x228e47,_0x32a93a){return function(_0x26fe34){if(_0x26fe34){return _0x26fe34[_0x2512('0x34')]()[_0x2512('0x1d')](function(){var _0x2c0251=_0x26fe34[_0x2512('0x35')]({'plain':!![]});var _0x19acfc=_0x2512('0x36');return db['UserProfileResource'][_0x2512('0x34')]({'where':{'type':_0x19acfc,'resourceId':_0x2c0251['id']}})[_0x2512('0x1d')](function(){return _0x26fe34;});})['then'](function(){_0x228e47[_0x2512('0x2a')](0xcc)[_0x2512('0x2b')]();});}};}function handleEntityNotFound(_0x131c39,_0x3f60d4){return function(_0x2d3eca){if(!_0x2d3eca){_0x131c39[_0x2512('0x29')](0x194);}return _0x2d3eca;};}function handleError(_0x1eb87f,_0x5aebfa){_0x5aebfa=_0x5aebfa||0x1f4;return function(_0x379d7f){logger[_0x2512('0x24')](_0x379d7f['stack']);if(_0x379d7f['name']){delete _0x379d7f[_0x2512('0x37')];}_0x1eb87f[_0x2512('0x2a')](_0x5aebfa)['send'](_0x379d7f);};}exports[_0x2512('0x38')]=function(_0x1bc759,_0x2f4196){var _0x164597={'include':[{'model':db[_0x2512('0x39')],'as':_0x2512('0x3a')}]},_0xe46226={},_0x445588={'count':0x0,'rows':[]};var _0x29a01e=_['map'](db[_0x2512('0x3b')]['rawAttributes'],function(_0x2a27db){return{'name':_0x2a27db['fieldName'],'type':_0x2a27db[_0x2512('0x3c')][_0x2512('0x3d')]};});_0xe46226[_0x2512('0x3e')]=_[_0x2512('0x3f')](_0x29a01e,_0x2512('0x37'));_0xe46226[_0x2512('0x40')]=_[_0x2512('0x41')](_0x1bc759[_0x2512('0x40')]);_0xe46226[_0x2512('0x42')]=_[_0x2512('0x43')](_0xe46226['model'],_0xe46226['query']);_0x164597[_0x2512('0x44')]=_[_0x2512('0x43')](_0xe46226['model'],qs[_0x2512('0x45')](_0x1bc759[_0x2512('0x40')][_0x2512('0x45')]));_0x164597[_0x2512('0x44')]=_0x164597[_0x2512('0x44')][_0x2512('0x46')]?_0x164597[_0x2512('0x44')]:_0xe46226[_0x2512('0x3e')];if(!_0x1bc759['query'][_0x2512('0x47')](_0x2512('0x48'))){_0x164597[_0x2512('0x2d')]=qs[_0x2512('0x2d')](_0x1bc759[_0x2512('0x40')]['limit']);_0x164597[_0x2512('0x2f')]=qs[_0x2512('0x2f')](_0x1bc759['query'][_0x2512('0x2f')]);}_0x164597[_0x2512('0x49')]=qs[_0x2512('0x4a')](_0x1bc759['query'][_0x2512('0x4a')]);_0x164597['where']=qs[_0x2512('0x42')](_[_0x2512('0x4b')](_0x1bc759[_0x2512('0x40')],_0xe46226[_0x2512('0x42')]),_0x29a01e);if(_0x1bc759[_0x2512('0x40')][_0x2512('0x4c')]){_0x164597['where']=_['merge'](_0x164597[_0x2512('0x4d')],{'$or':_[_0x2512('0x3f')](_0x29a01e,function(_0x2e0587){if(_0x2e0587[_0x2512('0x3c')]!=='VIRTUAL'){var _0x1ea87c={};_0x1ea87c[_0x2e0587[_0x2512('0x37')]]={'$like':'%'+_0x1bc759[_0x2512('0x40')][_0x2512('0x4c')]+'%'};return _0x1ea87c;}})});}_0x164597=_[_0x2512('0x4e')]({},_0x164597,_0x1bc759['options']);var _0x3c54be={'where':_0x164597['where']};return db['WhatsappAccount'][_0x2512('0x2e')](_0x3c54be)['then'](function(_0x37b0c1){_0x445588['count']=_0x37b0c1;if(_0x1bc759['query'][_0x2512('0x4f')]){_0x164597[_0x2512('0x50')]=[{'all':!![]}];}return db[_0x2512('0x3b')][_0x2512('0x51')](_0x164597);})[_0x2512('0x1d')](function(_0x44cad5){_0x445588[_0x2512('0x52')]=_0x44cad5;return _0x445588;})[_0x2512('0x1d')](respondWithFilteredResult(_0x2f4196,_0x164597))['catch'](handleError(_0x2f4196,null));};exports[_0x2512('0x53')]=function(_0x1602cf,_0x4c8209){var _0x5b7f42={'raw':![],'where':{'id':_0x1602cf['params']['id']},'include':[{'model':db[_0x2512('0x39')],'as':_0x2512('0x3a')}]},_0x503f29={};_0x503f29[_0x2512('0x3e')]=_[_0x2512('0x41')](db[_0x2512('0x3b')]['rawAttributes']);_0x503f29[_0x2512('0x40')]=_[_0x2512('0x41')](_0x1602cf[_0x2512('0x40')]);_0x503f29[_0x2512('0x42')]=_[_0x2512('0x43')](_0x503f29[_0x2512('0x3e')],_0x503f29[_0x2512('0x40')]);_0x5b7f42[_0x2512('0x44')]=_['intersection'](_0x503f29['model'],qs[_0x2512('0x45')](_0x1602cf[_0x2512('0x40')][_0x2512('0x45')]));_0x5b7f42[_0x2512('0x44')]=_0x5b7f42['attributes'][_0x2512('0x46')]?_0x5b7f42[_0x2512('0x44')]:_0x503f29[_0x2512('0x3e')];if(_0x1602cf[_0x2512('0x40')][_0x2512('0x4f')]){_0x5b7f42[_0x2512('0x50')]=[{'all':!![]}];}_0x5b7f42=_[_0x2512('0x4e')]({},_0x5b7f42,_0x1602cf['options']);return db['WhatsappAccount'][_0x2512('0x54')](_0x5b7f42)[_0x2512('0x1d')](handleEntityNotFound(_0x4c8209,null))[_0x2512('0x1d')](respondWithResult(_0x4c8209,null))[_0x2512('0x28')](handleError(_0x4c8209,null));};exports[_0x2512('0x55')]=function(_0x56fde9,_0x40f5dc){return db[_0x2512('0x3b')]['create'](_0x56fde9[_0x2512('0x56')],{})[_0x2512('0x1d')](function(_0x14534f){var _0x5ca5f8=_0x56fde9['user'][_0x2512('0x35')]({'plain':!![]});if(!_0x5ca5f8)throw new Error(_0x2512('0x57'));if(_0x5ca5f8['role']===_0x2512('0x58')){var _0x199d26=_0x14534f[_0x2512('0x35')]({'plain':!![]});var _0x4b9358=_0x2512('0x36');return db[_0x2512('0x59')][_0x2512('0x54')]({'where':{'name':_0x4b9358,'userProfileId':_0x5ca5f8[_0x2512('0x5a')]},'raw':!![]})[_0x2512('0x1d')](function(_0x1707ff){if(_0x1707ff&&_0x1707ff[_0x2512('0x5b')]===0x0){return db[_0x2512('0x5c')][_0x2512('0x55')]({'name':_0x199d26[_0x2512('0x37')],'resourceId':_0x199d26['id'],'type':_0x1707ff[_0x2512('0x37')],'sectionId':_0x1707ff['id']},{})[_0x2512('0x1d')](function(){return _0x14534f;});}else{return _0x14534f;}})[_0x2512('0x28')](function(_0x59b795){logger[_0x2512('0x24')](_0x2512('0x5d'),_0x59b795);throw _0x59b795;});}return _0x14534f;})[_0x2512('0x1d')](respondWithResult(_0x40f5dc,0xc9))[_0x2512('0x28')](handleError(_0x40f5dc,null));};exports[_0x2512('0x33')]=function(_0x34930c,_0x6ebb06){if(_0x34930c[_0x2512('0x56')]['id']){delete _0x34930c['body']['id'];}return db[_0x2512('0x3b')][_0x2512('0x54')]({'where':{'id':_0x34930c['params']['id']},'include':[{'model':db[_0x2512('0x39')],'as':'mandatoryDispositionPause'}]})[_0x2512('0x1d')](handleEntityNotFound(_0x6ebb06,null))[_0x2512('0x1d')](saveUpdates(_0x34930c['body'],null))[_0x2512('0x1d')](respondWithResult(_0x6ebb06,null))[_0x2512('0x28')](handleError(_0x6ebb06,null));};exports[_0x2512('0x34')]=function(_0x1abc98,_0x43bb0e){return db[_0x2512('0x3b')]['find']({'where':{'id':_0x1abc98['params']['id']}})['then'](handleEntityNotFound(_0x43bb0e,null))[_0x2512('0x1d')](removeEntity(_0x43bb0e,null))[_0x2512('0x28')](handleError(_0x43bb0e,null));};exports['describe']=function(_0x3720d6,_0x60c2f4){return db[_0x2512('0x3b')][_0x2512('0x5e')]()[_0x2512('0x1d')](respondWithResult(_0x60c2f4,null))[_0x2512('0x28')](handleError(_0x60c2f4,null));};exports[_0x2512('0x5f')]=function(_0x1934fe,_0x27411b,_0x28d8b0){if(_0x1934fe['body']['id']){delete _0x1934fe[_0x2512('0x56')]['id'];}return db[_0x2512('0x3b')][_0x2512('0x54')]({'where':{'id':_0x1934fe[_0x2512('0x60')]['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0x27411b,null))[_0x2512('0x1d')](function(_0x2da8c1){if(_0x2da8c1){_0x1934fe[_0x2512('0x56')]['WhatsappAccountId']=_0x2da8c1['id'];return db[_0x2512('0x61')][_0x2512('0x55')](_0x1934fe[_0x2512('0x56')]);}})[_0x2512('0x1d')](respondWithResult(_0x27411b,null))['catch'](handleError(_0x27411b,null));};exports[_0x2512('0x62')]=function(_0x23a5c1,_0xabb2e1,_0x4c282a){var _0x166707={'raw':![],'where':{}};var _0x5549a9={};var _0x25925b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2512('0x63')]({'where':{'id':_0x23a5c1[_0x2512('0x60')]['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0xabb2e1,null))[_0x2512('0x1d')](function(_0x45d640){if(_0x45d640){_0x5549a9['model']=_[_0x2512('0x41')](db[_0x2512('0x61')][_0x2512('0x64')]);_0x5549a9[_0x2512('0x40')]=_[_0x2512('0x41')](_0x23a5c1[_0x2512('0x40')]);_0x5549a9[_0x2512('0x42')]=_[_0x2512('0x43')](_0x5549a9[_0x2512('0x3e')],_0x5549a9[_0x2512('0x40')]);_0x166707[_0x2512('0x44')]=_['intersection'](_0x5549a9['model'],qs[_0x2512('0x45')](_0x23a5c1[_0x2512('0x40')][_0x2512('0x45')]));_0x166707[_0x2512('0x44')]=_0x166707[_0x2512('0x44')][_0x2512('0x46')]?_0x166707[_0x2512('0x44')]:_0x5549a9['model'];if(!_0x23a5c1[_0x2512('0x40')][_0x2512('0x47')]('nolimit')){_0x166707[_0x2512('0x2d')]=qs['limit'](_0x23a5c1[_0x2512('0x40')][_0x2512('0x2d')]);_0x166707[_0x2512('0x2f')]=qs[_0x2512('0x2f')](_0x23a5c1[_0x2512('0x40')]['offset']);}_0x166707[_0x2512('0x49')]=qs['sort'](_0x23a5c1['query']['sort']);_0x166707[_0x2512('0x4d')]=qs[_0x2512('0x42')](_[_0x2512('0x4b')](_0x23a5c1[_0x2512('0x40')],_0x5549a9[_0x2512('0x42')]));_0x166707['where'][_0x2512('0x65')]=_0x45d640['id'];if(_0x23a5c1[_0x2512('0x40')][_0x2512('0x4c')]){_0x166707['where']=_[_0x2512('0x4e')](_0x166707[_0x2512('0x4d')],{'$or':_['map'](_0x166707[_0x2512('0x44')],function(_0x2f7df4){var _0x11b3be={};_0x11b3be[_0x2f7df4]={'$like':'%'+_0x23a5c1[_0x2512('0x40')]['filter']+'%'};return _0x11b3be;})});}_0x166707=_[_0x2512('0x4e')]({},_0x166707,_0x23a5c1['options']);return db[_0x2512('0x61')][_0x2512('0x2e')]({'where':_0x166707['where']})[_0x2512('0x1d')](function(_0x2137e8){_0x25925b[_0x2512('0x2e')]=_0x2137e8;if(_0x23a5c1['query'][_0x2512('0x4f')]){_0x166707[_0x2512('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x166707);})['then'](function(_0x10866c){_0x25925b[_0x2512('0x52')]=_0x10866c;return _0x25925b;});}})[_0x2512('0x1d')](respondWithFilteredResult(_0xabb2e1,_0x166707))[_0x2512('0x28')](handleError(_0xabb2e1,null));};exports[_0x2512('0x66')]=function(_0x3c2a24,_0x320b4e,_0x4f4278){return db['WhatsappAccount']['find']({'where':{'id':_0x3c2a24[_0x2512('0x60')]['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0x320b4e,null))[_0x2512('0x1d')](function(_0x20e8e6){if(_0x20e8e6){return _0x20e8e6[_0x2512('0x66')](_0x3c2a24[_0x2512('0x40')][_0x2512('0x67')]);}})[_0x2512('0x1d')](respondWithStatusCode(_0x320b4e,null))[_0x2512('0x28')](handleError(_0x320b4e,null));};exports[_0x2512('0x68')]=function(_0x822a37,_0x34245c,_0x4b3018){if(_0x822a37[_0x2512('0x56')]['id']){delete _0x822a37[_0x2512('0x56')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x822a37[_0x2512('0x60')]['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0x34245c,null))[_0x2512('0x1d')](function(_0x179ced){if(_0x179ced){_0x822a37[_0x2512('0x56')][_0x2512('0x65')]=_0x179ced['id'];return db['CannedAnswer']['create'](_0x822a37[_0x2512('0x56')]);}})[_0x2512('0x1d')](respondWithResult(_0x34245c,null))[_0x2512('0x28')](handleError(_0x34245c,null));};exports[_0x2512('0x69')]=function(_0x52077d,_0x30a019,_0x4a586f){var _0x2e5480={'raw':![],'where':{}};var _0x4b8af3={};var _0x1bcd1e={'count':0x0,'rows':[]};return db[_0x2512('0x3b')]['findOne']({'where':{'id':_0x52077d[_0x2512('0x60')]['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0x30a019,null))['then'](function(_0x455176){if(_0x455176){_0x4b8af3[_0x2512('0x3e')]=_[_0x2512('0x41')](db[_0x2512('0x6a')][_0x2512('0x64')]);_0x4b8af3[_0x2512('0x40')]=_[_0x2512('0x41')](_0x52077d['query']);_0x4b8af3['filters']=_[_0x2512('0x43')](_0x4b8af3['model'],_0x4b8af3['query']);_0x2e5480['attributes']=_[_0x2512('0x43')](_0x4b8af3[_0x2512('0x3e')],qs[_0x2512('0x45')](_0x52077d[_0x2512('0x40')]['fields']));_0x2e5480[_0x2512('0x44')]=_0x2e5480[_0x2512('0x44')][_0x2512('0x46')]?_0x2e5480[_0x2512('0x44')]:_0x4b8af3[_0x2512('0x3e')];if(!_0x52077d['query']['hasOwnProperty'](_0x2512('0x48'))){_0x2e5480['limit']=qs[_0x2512('0x2d')](_0x52077d[_0x2512('0x40')][_0x2512('0x2d')]);_0x2e5480['offset']=qs[_0x2512('0x2f')](_0x52077d[_0x2512('0x40')][_0x2512('0x2f')]);}_0x2e5480[_0x2512('0x49')]=qs[_0x2512('0x4a')](_0x52077d[_0x2512('0x40')][_0x2512('0x4a')]);_0x2e5480['where']=qs[_0x2512('0x42')](_[_0x2512('0x4b')](_0x52077d[_0x2512('0x40')],_0x4b8af3[_0x2512('0x42')]));_0x2e5480[_0x2512('0x4d')]['WhatsappAccountId']=_0x455176['id'];if(_0x52077d[_0x2512('0x40')][_0x2512('0x4c')]){_0x2e5480[_0x2512('0x4d')]=_[_0x2512('0x4e')](_0x2e5480[_0x2512('0x4d')],{'$or':_[_0x2512('0x3f')](_0x2e5480[_0x2512('0x44')],function(_0x53a14a){var _0x109099={};_0x109099[_0x53a14a]={'$like':'%'+_0x52077d[_0x2512('0x40')][_0x2512('0x4c')]+'%'};return _0x109099;})});}_0x2e5480=_['merge']({},_0x2e5480,_0x52077d[_0x2512('0x6b')]);return db[_0x2512('0x6a')][_0x2512('0x2e')]({'where':_0x2e5480['where']})[_0x2512('0x1d')](function(_0x38bd3e){_0x1bcd1e[_0x2512('0x2e')]=_0x38bd3e;if(_0x52077d[_0x2512('0x40')][_0x2512('0x4f')]){_0x2e5480[_0x2512('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2512('0x51')](_0x2e5480);})[_0x2512('0x1d')](function(_0x3eb5cb){_0x1bcd1e['rows']=_0x3eb5cb;return _0x1bcd1e;});}})[_0x2512('0x1d')](respondWithFilteredResult(_0x30a019,_0x2e5480))['catch'](handleError(_0x30a019,null));};exports[_0x2512('0x6c')]=function(_0x2812df,_0xf659a3,_0x808c12){return db[_0x2512('0x3b')][_0x2512('0x54')]({'where':{'id':_0x2812df['params']['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0xf659a3,null))[_0x2512('0x1d')](function(_0x571f70){if(_0x571f70){return _0x571f70[_0x2512('0x6c')](_0x2812df[_0x2512('0x40')][_0x2512('0x67')]);}})['then'](respondWithStatusCode(_0xf659a3,null))[_0x2512('0x28')](handleError(_0xf659a3,null));};exports[_0x2512('0x6d')]=function(_0x431b26,_0x211b1d,_0x3b93ef){return db[_0x2512('0x3b')][_0x2512('0x54')]({'where':{'id':_0x431b26[_0x2512('0x60')]['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0x211b1d,null))[_0x2512('0x1d')](function(_0x42d72d){if(_0x42d72d){return _0x42d72d['addAgents'](_0x431b26[_0x2512('0x56')][_0x2512('0x67')],_['omit'](_0x431b26[_0x2512('0x56')],[_0x2512('0x67'),'id'])||{})[_0x2512('0x6e')](function(_0x133ef4){for(var _0x2ad890=0x0;_0x2ad890<_0x431b26[_0x2512('0x56')]['ids'][_0x2512('0x46')];_0x2ad890+=0x1){socket[_0x2512('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x431b26['body']['ids'][_0x2ad890]),'WhatsappAccountId':Number(_0x431b26[_0x2512('0x60')]['id'])});}return _0x133ef4;});}})[_0x2512('0x1d')](respondWithResult(_0x211b1d,null))[_0x2512('0x28')](handleError(_0x211b1d,null));};exports['removeAgents']=function(_0x324154,_0x399f72,_0x2b8b2b){return db[_0x2512('0x3b')][_0x2512('0x54')]({'where':{'id':_0x324154[_0x2512('0x60')]['id']}})['then'](handleEntityNotFound(_0x399f72,null))[_0x2512('0x1d')](function(_0x8b785b){if(_0x8b785b){return _0x8b785b['removeAgents'](_0x324154['query'][_0x2512('0x67')])[_0x2512('0x1d')](function(){if(_[_0x2512('0x70')](_0x324154[_0x2512('0x40')][_0x2512('0x67')])){for(var _0x1c541d=0x0;_0x1c541d<_0x324154['query'][_0x2512('0x67')][_0x2512('0x46')];_0x1c541d+=0x1){socket['emit'](_0x2512('0x71'),{'UserId':Number(_0x324154['query'][_0x2512('0x67')][_0x1c541d]),'WhatsappAccountId':Number(_0x324154[_0x2512('0x60')]['id'])});}}else{socket[_0x2512('0x6f')](_0x2512('0x71'),{'UserId':Number(_0x324154[_0x2512('0x40')][_0x2512('0x67')]),'WhatsappAccountId':Number(_0x324154['params']['id'])});}});}})[_0x2512('0x1d')](respondWithStatusCode(_0x399f72,null))['catch'](handleError(_0x399f72,null));};exports[_0x2512('0x72')]=function(_0x34daab,_0x4bc7e8,_0xf0d6f9){var _0x51a9b6={};var _0x4bb0ed={};var _0x16d8bb;var _0x2fb238;return db[_0x2512('0x3b')][_0x2512('0x63')]({'where':{'id':_0x34daab[_0x2512('0x60')]['id']}})[_0x2512('0x1d')](handleEntityNotFound(_0x4bc7e8,null))[_0x2512('0x1d')](function(_0x3492aa){if(_0x3492aa){_0x16d8bb=_0x3492aa;_0x4bb0ed[_0x2512('0x3e')]=_[_0x2512('0x41')](db[_0x2512('0x73')][_0x2512('0x64')]);_0x4bb0ed[_0x2512('0x40')]=_[_0x2512('0x41')](_0x34daab[_0x2512('0x40')]);_0x4bb0ed['filters']=_[_0x2512('0x43')](_0x4bb0ed['model'],_0x4bb0ed[_0x2512('0x40')]);_0x51a9b6[_0x2512('0x44')]=_['intersection'](_0x4bb0ed['model'],qs[_0x2512('0x45')](_0x34daab[_0x2512('0x40')][_0x2512('0x45')]));_0x51a9b6[_0x2512('0x44')]=_0x51a9b6[_0x2512('0x44')][_0x2512('0x46')]?_0x51a9b6['attributes']:_0x4bb0ed[_0x2512('0x3e')];_0x51a9b6['order']=qs[_0x2512('0x4a')](_0x34daab[_0x2512('0x40')][_0x2512('0x4a')]);_0x51a9b6[_0x2512('0x4d')]=qs[_0x2512('0x42')](_[_0x2512('0x4b')](_0x34daab[_0x2512('0x40')],_0x4bb0ed[_0x2512('0x42')]));if(_0x34daab['query'][_0x2512('0x4c')]){_0x51a9b6[_0x2512('0x4d')]=_[_0x2512('0x4e')](_0x51a9b6[_0x2512('0x4d')],{'$or':_[_0x2512('0x3f')](_0x51a9b6[_0x2512('0x44')],function(_0x60307f){var _0x2a9cc3={};_0x2a9cc3[_0x60307f]={'$like':'%'+_0x34daab['query'][_0x2512('0x4c')]+'%'};return _0x2a9cc3;})});}_0x51a9b6=_[_0x2512('0x4e')]({},_0x51a9b6,_0x34daab[_0x2512('0x6b')]);return _0x16d8bb[_0x2512('0x72')](_0x51a9b6);}})[_0x2512('0x1d')](function(_0x3385b8){if(_0x3385b8){_0x2fb238=_0x3385b8[_0x2512('0x46')];if(!_0x34daab[_0x2512('0x40')]['hasOwnProperty'](_0x2512('0x48'))){_0x51a9b6[_0x2512('0x2d')]=qs[_0x2512('0x2d')](_0x34daab[_0x2512('0x40')]['limit']);_0x51a9b6['offset']=qs[_0x2512('0x2f')](_0x34daab[_0x2512('0x40')]['offset']);}return _0x16d8bb[_0x2512('0x72')](_0x51a9b6);}})[_0x2512('0x1d')](function(_0x1971ed){if(_0x1971ed){return _0x1971ed?{'count':_0x2fb238,'rows':_0x1971ed}:null;}})[_0x2512('0x1d')](respondWithResult(_0x4bc7e8,null))[_0x2512('0x28')](handleError(_0x4bc7e8,null));};exports[_0x2512('0x74')]=function(_0x446540,_0x2e584c){var _0x2772a2=_0x446540[_0x2512('0x60')]['id'];var _0x159fe1=_0x446540[_0x2512('0x56')];var _0xfe2baa=0xc8;var _0x448409=null;return db[_0x2512('0x75')][_0x2512('0x76')]({'isolationLevel':db['sequelize'][_0x2512('0x77')][_0x2512('0x78')][_0x2512('0x79')]},function(_0x52ca3b){return db[_0x2512('0x3b')][_0x2512('0x63')]({'where':{'id':_0x2772a2},'transaction':_0x52ca3b})['then'](function(_0x11e82e){if(_0x11e82e){return db[_0x2512('0x7a')][_0x2512('0x34')]({'where':{'WhatsappAccountId':_0x2772a2},'transaction':_0x52ca3b})[_0x2512('0x1d')](function(){var _0x49e91b=_[_0x2512('0x3f')](_0x159fe1,function(_0x56b21d){_0x56b21d[_0x2512('0x65')]=_0x2772a2;return _0x56b21d;});return db['WhatsappApplication'][_0x2512('0x7b')](_0x49e91b,{'transaction':_0x52ca3b});});}else{_0xfe2baa=0x194;_0x448409=[];}});})[_0x2512('0x1d')](function(){if(_0xfe2baa!==0x194){return db[_0x2512('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2772a2},'order':_0x2512('0x7c')})[_0x2512('0x1d')](function(_0x29997a){_0x448409=_0x29997a;});}})[_0x2512('0x28')](function(_0x3bca4f){_0xfe2baa=0x1f4;logger['error'](_0x3bca4f['stack']);if(_0x3bca4f[_0x2512('0x37')]){delete _0x3bca4f[_0x2512('0x37')];}_0x448409=_0x3bca4f;})[_0x2512('0x7d')](function(){if(_0x448409===null){_0x2e584c[_0x2512('0x29')](_0xfe2baa);}else{if(_0xfe2baa===0x1f4){_0x2e584c[_0x2512('0x2a')](_0xfe2baa)[_0x2512('0x7e')](_0x448409);}else{_0x2e584c[_0x2512('0x2a')](_0xfe2baa)['json'](_0x448409);}}});};exports[_0x2512('0x7f')]=function(_0xaed9aa,_0x463096,_0xdf6362){var _0x2bf161={};var _0xdbf008={};var _0x20939d;var _0xfa35b0;return db[_0x2512('0x3b')][_0x2512('0x63')]({'where':{'id':_0xaed9aa[_0x2512('0x60')]['id']}})['then'](handleEntityNotFound(_0x463096,null))[_0x2512('0x1d')](function(_0x14b225){if(_0x14b225){_0x20939d=_0x14b225;_0xdbf008[_0x2512('0x3e')]=_[_0x2512('0x41')](db[_0x2512('0x7a')]['rawAttributes']);_0xdbf008[_0x2512('0x40')]=_[_0x2512('0x41')](_0xaed9aa[_0x2512('0x40')]);_0xdbf008[_0x2512('0x42')]=_[_0x2512('0x43')](_0xdbf008[_0x2512('0x3e')],_0xdbf008[_0x2512('0x40')]);_0x2bf161[_0x2512('0x44')]=_[_0x2512('0x43')](_0xdbf008[_0x2512('0x3e')],qs[_0x2512('0x45')](_0xaed9aa[_0x2512('0x40')][_0x2512('0x45')]));_0x2bf161[_0x2512('0x44')]=_0x2bf161['attributes'][_0x2512('0x46')]?_0x2bf161[_0x2512('0x44')]:_0xdbf008[_0x2512('0x3e')];_0x2bf161[_0x2512('0x49')]=qs[_0x2512('0x4a')](_0xaed9aa[_0x2512('0x40')][_0x2512('0x4a')]);_0x2bf161[_0x2512('0x4d')]=qs[_0x2512('0x42')](_[_0x2512('0x4b')](_0xaed9aa[_0x2512('0x40')],_0xdbf008[_0x2512('0x42')]));if(_0xaed9aa['query'][_0x2512('0x4c')]){_0x2bf161[_0x2512('0x4d')]=_[_0x2512('0x4e')](_0x2bf161[_0x2512('0x4d')],{'$or':_[_0x2512('0x3f')](_0x2bf161[_0x2512('0x44')],function(_0x65bd1b){var _0xccaee9={};_0xccaee9[_0x65bd1b]={'$like':'%'+_0xaed9aa['query'][_0x2512('0x4c')]+'%'};return _0xccaee9;})});}_0x2bf161=_[_0x2512('0x4e')]({},_0x2bf161,_0xaed9aa[_0x2512('0x6b')]);return _0x20939d[_0x2512('0x7f')](_0x2bf161);}})[_0x2512('0x1d')](function(_0x27c9fb){if(_0x27c9fb){_0xfa35b0=_0x27c9fb[_0x2512('0x46')];if(!_0xaed9aa[_0x2512('0x40')]['hasOwnProperty'](_0x2512('0x48'))){_0x2bf161[_0x2512('0x2d')]=qs[_0x2512('0x2d')](_0xaed9aa[_0x2512('0x40')][_0x2512('0x2d')]);_0x2bf161[_0x2512('0x2f')]=qs[_0x2512('0x2f')](_0xaed9aa[_0x2512('0x40')][_0x2512('0x2f')]);}return _0x20939d[_0x2512('0x7f')](_0x2bf161);}})[_0x2512('0x1d')](function(_0x480c3e){if(_0x480c3e){return _0x480c3e?{'count':_0xfa35b0,'rows':_0x480c3e}:null;}})['then'](respondWithResult(_0x463096,null))[_0x2512('0x28')](handleError(_0x463096,null));};exports[_0x2512('0x80')]=function(_0x17a676,_0x53e42f,_0x47bfab){var _0x5a891d={'channel':'whatsapp'};var _0x4681c5=[];var _0x5b9a1d=[];var _0x4e76f0={};return db[_0x2512('0x3b')]['find']({'where':{'id':_0x17a676[_0x2512('0x60')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x2512('0x81')}]})[_0x2512('0x1d')](handleEntityNotFound(_0x53e42f,null))[_0x2512('0x1d')](function(_0x2e659){_0x5a891d[_0x2512('0x82')]=_0x2e659;if(_0x5a891d[_0x2512('0x82')]&&_0x5a891d[_0x2512('0x82')][_0x2512('0x3c')]==='sinch'&&_0x17a676[_0x2512('0x56')][_0x2512('0x83')]){if(_0x17a676[_0x2512('0x56')][_0x2512('0x83')][_0x2512('0x46')]===0x0)return;if(_0x17a676[_0x2512('0x56')]['statuses'][0x0][_0x2512('0x84')]!=='read')return;return db[_0x2512('0x85')][_0x2512('0x33')]({'read':!![],'readAt':_0x17a676[_0x2512('0x56')][_0x2512('0x83')][0x0][_0x2512('0x86')]},{'where':{'messageId':_0x17a676['body'][_0x2512('0x83')][0x0][_0x2512('0x87')]},'individualHooks':!![]})[_0x2512('0x1d')](function(_0x8babf6){return _0x53e42f[_0x2512('0x2a')](0xc8)[_0x2512('0x2c')](_0x8babf6);});}_0x5a891d[_0x2512('0x88')]=_['orderBy'](_0x2e659['Applications'],[_0x2512('0x7c')],[_0x2512('0x89')]);if(_0x5a891d[_0x2512('0x82')]['Applications']){delete _0x5a891d[_0x2512('0x82')][_0x2512('0x81')];}return db[_0x2512('0x8a')]['describe']()['then'](function(_0x24b2f9){if(!_0x24b2f9){throw new db[(_0x2512('0x8b'))][(_0x2512('0x8c'))](_0x2512('0x8d'));}_0x4681c5=_['difference'](_[_0x2512('0x41')](_0x24b2f9),[_0x2512('0x8e'),_0x2512('0x8f')]);_0x5b9a1d=_[_0x2512('0x90')](_[_0x2512('0x41')](_0x24b2f9),[_0x2512('0x8e'),_0x2512('0x8f'),'CompanyId',_0x2512('0x91')]);_0x5a891d[_0x2512('0x56')]={'mapKey':_0x2512('0x92')};if(_0x5a891d[_0x2512('0x82')]&&_0x5a891d['account'][_0x2512('0x3c')]===_0x2512('0x93')){_0x5a891d['body'][_0x2512('0x94')]=_0x17a676[_0x2512('0x56')][_0x2512('0x95')]['replace'](_0x2512('0x96'),'');_0x5a891d[_0x2512('0x56')]['body']=_0x17a676[_0x2512('0x56')][_0x2512('0x97')];_0x5a891d['body']['messageId']=_0x17a676['body'][_0x2512('0x98')];}if(_0x5a891d['account']&&_0x5a891d[_0x2512('0x82')]['type']===_0x2512('0x99')){_0x5a891d[_0x2512('0x56')]['from']=_0x17a676[_0x2512('0x56')][_0x2512('0x9a')][0x0][_0x2512('0x94')];_0x5a891d['body'][_0x2512('0x56')]=_0x17a676[_0x2512('0x56')]['notifications'][0x0]['message'][_0x2512('0x56')];_0x5a891d[_0x2512('0x56')][_0x2512('0x9b')]=_0x17a676[_0x2512('0x56')][_0x2512('0x9a')][0x0][_0x2512('0x87')];}if(_0x5a891d[_0x2512('0x56')]['id']){delete _0x5a891d[_0x2512('0x56')]['id'];}if(_[_0x2512('0x9c')](_0x5a891d[_0x2512('0x56')][_0x2512('0x94')])){throw new db[(_0x2512('0x8b'))][(_0x2512('0x8c'))](_0x2512('0x9d'));}if(_[_0x2512('0x9c')](_0x5a891d[_0x2512('0x56')][_0x2512('0x56')])||_0x5a891d[_0x2512('0x56')][_0x2512('0x56')]===''){throw new db[(_0x2512('0x8b'))][(_0x2512('0x8c'))](_0x2512('0x9e'));}if(_['isNil'](_0x5a891d[_0x2512('0x56')]['mapKey'])){throw new db[(_0x2512('0x8b'))][(_0x2512('0x8c'))](_0x2512('0x9f')+_0x5b9a1d);}if(!_['includes'](_0x5b9a1d,_0x5a891d['body'][_0x2512('0xa0')])){throw new db['Sequelize']['ValidationError'](_0x2512('0xa1')+_0x5b9a1d);}_0x4e76f0[_0x5a891d['body'][_0x2512('0xa0')]]=_0x5a891d[_0x2512('0x56')]['from'];return db[_0x2512('0xa2')][_0x2512('0x54')]({'where':{'id':_0x5a891d[_0x2512('0x82')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x2512('0xa3'),'where':_0x4e76f0,'limit':0x1,'order':[[_0x2512('0x8f'),'DESC']]}]});})[_0x2512('0x1d')](handleEntityNotFound(_0x53e42f,null))[_0x2512('0x1d')](function(_0x1379cb){if(_0x1379cb){_0x5a891d[_0x2512('0xa4')]=_[_0x2512('0xa5')](_0x1379cb,[_0x2512('0xa3')]);if(_0x1379cb[_0x2512('0xa3')]['length']){return _0x1379cb[_0x2512('0xa3')][0x0];}var _0x24e512=_[_0x2512('0x17')](_0x5a891d[_0x2512('0x56')],{'firstName':_0x5a891d[_0x2512('0x56')][_0x2512('0x94')],'ListId':_0x1379cb['id']});_0x24e512[_0x5a891d[_0x2512('0x56')]['mapKey']]=_0x5a891d[_0x2512('0x56')][_0x2512('0x94')];return db[_0x2512('0x8a')][_0x2512('0x55')](_0x24e512,{'fields':_0x4681c5,'raw':!![]});}})[_0x2512('0x1d')](handleEntityNotFound(_0x53e42f,null))[_0x2512('0x1d')](function(_0x60cb00){if(_0x60cb00){_0x5a891d[_0x2512('0xa6')]=_0x60cb00;var _0x2bb8d5={'ContactId':_0x60cb00['id'],'phone':_0x5a891d['body'][_0x2512('0x94')],'WhatsappAccountId':_0x17a676[_0x2512('0x60')]['id']};var _0x269ff5={'ContactId':_0x60cb00['id'],'WhatsappAccountId':_0x17a676[_0x2512('0x60')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x269ff5})[_0x2512('0x1d')](function(_0x12f8d6){if(_0x12f8d6){return[_0x12f8d6,![]];}return db[_0x2512('0xa7')][_0x2512('0x55')](_0x2bb8d5)[_0x2512('0x1d')](function(_0x7718e0){return[_0x7718e0,!![]];});});}})[_0x2512('0x6e')](function(_0x4955c2,_0x40529d){_0x5a891d[_0x2512('0xa8')]=_0x4955c2[_0x2512('0x35')]({'plain':!![]});_0x5a891d['interaction'][_0x2512('0xa9')]=![];if(_0x40529d){if(_0x5a891d[_0x2512('0x82')][_0x2512('0xaa')]){_0x5a891d['applications'][_0x2512('0xab')]({'id':0x0,'priority':_0x5a891d[_0x2512('0x88')][_0x2512('0x46')]+0x1,'app':_0x2512('0xac'),'appdata':_0x2512('0xad'),'interval':_0x2512('0xae')});}_0x5a891d[_0x2512('0xa8')]['created']=!![];}return db[_0x2512('0x85')][_0x2512('0x55')]({'phone':_0x5a891d[_0x2512('0x56')]['from'],'messageId':_0x5a891d[_0x2512('0x56')][_0x2512('0x9b')],'body':_0x5a891d['body']['body'],'WhatsappAccountId':_0x17a676[_0x2512('0x60')]['id'],'WhatsappInteractionId':_0x4955c2['id'],'direction':'in','ContactId':_0x4955c2[_0x2512('0xaf')],'AttachmentId':_0x5a891d[_0x2512('0x56')]['AttachmentId']});})[_0x2512('0x1d')](function(_0x24b256){_0x5a891d[_0x2512('0x25')]=_0x24b256;if(_0x5a891d[_0x2512('0xa8')][_0x2512('0xb0')]){return db[_0x2512('0x73')][_0x2512('0x54')]({'attributes':['id',_0x2512('0x37')],'where':{'id':_0x5a891d[_0x2512('0xa8')][_0x2512('0xb0')]}})['then'](function(_0x3467ea){if(_0x3467ea){_0x5a891d['applications'][_0x2512('0xb1')]({'id':0x0,'priority':0x0,'app':_0x2512('0xb2'),'appdata':_0x3467ea[_0x2512('0x37')]+','+(_0x5a891d[_0x2512('0x82')][_0x2512('0xb3')]||0xa),'interval':_0x2512('0xae')});}return respondWithRpcPromise(_0x2512('0xb4'),_0x2512('0xb5'),_0x5a891d);});}return respondWithRpcPromise('Start','startRouting',_0x5a891d);})['then'](function(_0x4b0518){if(_0x4b0518){var _0x47e533=0xc8;var _0x104aad=_0x2512('0xb6');logger['info'](_0x2512('0x21'),_0x104aad,_0x47e533,'entity\x20found');logger[_0x2512('0x20')](_0x2512('0xb7'),_0x104aad,_0x47e533,_0x2512('0xb8'),JSON[_0x2512('0x22')](_0x4b0518));if(_0x5a891d['account'][_0x2512('0x3c')]===_0x2512('0x93')){return _0x53e42f['status'](_0x47e533)[_0x2512('0x30')]('Content-Type',_0x2512('0xb9'))['send'](_0x2512('0xba'));}else{return _0x53e42f['status'](_0x47e533)[_0x2512('0x2c')](_0x4b0518);}}});})['catch'](handleError(_0x53e42f,null));};exports[_0x2512('0x7e')]=function(_0x48c047,_0x52d1ce,_0x49da17){var _0x36aa2f,_0x416d50,_0x144986;if(_[_0x2512('0x9c')](_0x48c047[_0x2512('0x56')][_0x2512('0x56')])||_0x48c047[_0x2512('0x56')][_0x2512('0x56')]===''){throw new db[(_0x2512('0x8b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2512('0x9c')](_0x48c047['body']['to'])){throw new db[(_0x2512('0x8b'))][(_0x2512('0x8c'))](_0x2512('0xbb'));}_0x36aa2f=_0x48c047[_0x2512('0x56')]['to'];return db[_0x2512('0x3b')][_0x2512('0x54')]({'where':{'id':_0x48c047[_0x2512('0x60')]['id']},'include':[{'model':db[_0x2512('0xa2')],'as':'List','include':[{'model':db['CmContact'],'as':_0x2512('0xa3'),'where':{'mobile':_0x36aa2f},'limit':0x1,'order':[[_0x2512('0x8f'),_0x2512('0xbc')]]}]}]})['then'](handleEntityNotFound(_0x52d1ce,null))[_0x2512('0x1d')](function(_0x59b543){if(_0x59b543&&_0x59b543[_0x2512('0xbd')]){_0x416d50=_0x59b543[_0x2512('0x35')]({'plain':!![]});if(_0x416d50['List']&&_0x416d50['List'][_0x2512('0xa3')][_0x2512('0x46')]){return _0x416d50[_0x2512('0xbd')][_0x2512('0xa3')][0x0];}return db['CmContact'][_0x2512('0x55')](_[_0x2512('0x17')](_0x48c047['body'],{'firstName':_0x36aa2f,'mobile':_0x36aa2f,'phone':_0x36aa2f,'ListId':_0x416d50[_0x2512('0x91')]}));}})['then'](handleEntityNotFound(_0x52d1ce,null))[_0x2512('0x1d')](function(_0x567268){if(_0x567268){_0x144986=_0x567268;return db[_0x2512('0xa7')][_0x2512('0x54')]({'where':{'ContactId':_0x144986['id'],'closed':![],'WhatsappAccountId':_0x416d50['id']}})[_0x2512('0x1d')](function(_0x5a30cd){if(_0x5a30cd){return[_0x5a30cd,![]];}return db[_0x2512('0xa7')][_0x2512('0x55')]({'UserId':_0x48c047[_0x2512('0x58')]['id'],'ContactId':_0x144986['id'],'WhatsappAccountId':_0x416d50['id'],'phone':_0x36aa2f,'firstMsgDirection':_0x2512('0xbe'),'Messages':[_['merge'](_0x48c047[_0x2512('0x56')],{'read':![],'body':_0x48c047[_0x2512('0x56')]['body'],'phone':_0x36aa2f,'WhatsappAccountId':_0x416d50['id'],'UserId':_0x48c047[_0x2512('0x58')]['id'],'ContactId':_0x144986['id']})]},{'include':[{'model':db[_0x2512('0x85')],'as':_0x2512('0xbf')}]})[_0x2512('0x1d')](function(_0x37f0a6){return[_0x37f0a6,!![]];});});}})[_0x2512('0x6e')](function(_0x20152c,_0x2ac031){if(_0x2ac031){return _0x20152c;}return db[_0x2512('0x85')][_0x2512('0x55')](_['merge'](_0x48c047[_0x2512('0x56')],{'read':![],'body':_0x48c047[_0x2512('0x56')]['body'],'phone':_0x36aa2f,'WhatsappAccountId':_0x416d50['id'],'WhatsappInteractionId':_0x20152c['id'],'UserId':_0x48c047['user']['id'],'ContactId':_0x144986['id']}))['then'](function(_0xf81d49){_0x20152c[_0x2512('0xc0')][_0x2512('0xbf')]=[];_0x20152c[_0x2512('0xc0')][_0x2512('0xbf')][_0x2512('0xab')](_0xf81d49[_0x2512('0xc0')]);return _0x20152c;});})[_0x2512('0x1d')](respondWithResult(_0x52d1ce,null))['catch'](handleError(_0x52d1ce,null));}; \ No newline at end of file +var _0xf6d8=['addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','addApplications','sequelize','transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','mobile','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','from','message_id','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','updatedAt','list','contact','WhatsappInteraction','interaction','autoclose','close','*,*,*,*','created','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','text/xml','to\x20is\x20mandatory','List','DESC','out','Messages','spread','dataValues','push','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','info','debug','request\x20sent','stringify','code','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','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','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf6d8,0x114));var _0x8f6d=function(_0x447290,_0x267a38){_0x447290=_0x447290-0x0;var _0x5796ba=_0xf6d8[_0x447290];return _0x5796ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f6d('0x0'));var zipdir=require(_0x8f6d('0x1'));var jsonpatch=require(_0x8f6d('0x2'));var rp=require(_0x8f6d('0x3'));var moment=require(_0x8f6d('0x4'));var BPromise=require(_0x8f6d('0x5'));var Mustache=require(_0x8f6d('0x6'));var util=require('util');var path=require(_0x8f6d('0x7'));var sox=require(_0x8f6d('0x8'));var csv=require(_0x8f6d('0x9'));var ejs=require(_0x8f6d('0xa'));var fs=require('fs');var fs_extra=require(_0x8f6d('0xb'));var _=require(_0x8f6d('0xc'));var squel=require(_0x8f6d('0xd'));var crypto=require('crypto');var jsforce=require(_0x8f6d('0xe'));var deskjs=require(_0x8f6d('0xf'));var toCsv=require(_0x8f6d('0x9'));var querystring=require(_0x8f6d('0x10'));var Papa=require('papaparse');var Redis=require(_0x8f6d('0x11'));var authService=require(_0x8f6d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8f6d('0x13'));var hardwareService=require(_0x8f6d('0x14'));var logger=require(_0x8f6d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8f6d('0x16'));var licenseUtil=require(_0x8f6d('0x17'));var db=require(_0x8f6d('0x18'))['db'];config[_0x8f6d('0x19')]=_[_0x8f6d('0x1a')](config[_0x8f6d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8f6d('0x1b'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x8f6d('0x1c'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x59e342,_0x77c148,_0x45a8c9,_0x11b56c){return new BPromise(function(_0x5d5c9f,_0x3a7f8c){var _0x2d4cd6=_0x11b56c||client;return _0x2d4cd6['request'](_0x59e342,_0x45a8c9)['then'](function(_0x40a3f5){logger[_0x8f6d('0x1d')]('WhatsappAccount,\x20%s,\x20%s',_0x77c148,'request\x20sent');logger[_0x8f6d('0x1e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x77c148,_0x8f6d('0x1f'),JSON[_0x8f6d('0x20')](_0x40a3f5));if(_0x40a3f5['error']){if(_0x40a3f5['error'][_0x8f6d('0x21')]===0x1f4){logger[_0x8f6d('0x22')](_0x8f6d('0x23'),_0x77c148,_0x40a3f5['error'][_0x8f6d('0x24')]);return _0x3a7f8c(_0x40a3f5[_0x8f6d('0x22')][_0x8f6d('0x24')]);}logger[_0x8f6d('0x22')](_0x8f6d('0x23'),_0x77c148,_0x40a3f5[_0x8f6d('0x22')]['message']);return _0x5d5c9f(_0x40a3f5[_0x8f6d('0x22')][_0x8f6d('0x24')]);}else{logger['info'](_0x8f6d('0x23'),_0x77c148,_0x8f6d('0x1f'));_0x5d5c9f(_0x40a3f5[_0x8f6d('0x25')]['message']);}})[_0x8f6d('0x26')](function(_0x64326b){logger['error'](_0x8f6d('0x23'),_0x77c148,_0x64326b);_0x3a7f8c(_0x64326b);});});}function respondWithStatusCode(_0x475f27,_0x4e7275){_0x4e7275=_0x4e7275||0xcc;return function(_0x32be60){if(_0x32be60){return _0x475f27[_0x8f6d('0x27')](_0x4e7275);}return _0x475f27[_0x8f6d('0x28')](_0x4e7275)[_0x8f6d('0x29')]();};}function respondWithResult(_0xa0d952,_0x2d8b24){_0x2d8b24=_0x2d8b24||0xc8;return function(_0x4d4a0c){if(_0x4d4a0c){return _0xa0d952[_0x8f6d('0x28')](_0x2d8b24)['json'](_0x4d4a0c);}};}function respondWithFilteredResult(_0x450ee4,_0x187420){return function(_0x80ef88){if(_0x80ef88){var _0x66f089=typeof _0x187420['offset']===_0x8f6d('0x2a')&&typeof _0x187420[_0x8f6d('0x2b')]===_0x8f6d('0x2a');var _0xec6eea=_0x80ef88['count'];var _0x57e85c=_0x66f089?0x0:_0x187420[_0x8f6d('0x2c')];var _0x3ae802=_0x66f089?_0x80ef88[_0x8f6d('0x2d')]:_0x187420[_0x8f6d('0x2c')]+_0x187420[_0x8f6d('0x2b')];var _0x583fdc;if(_0x3ae802>=_0xec6eea){_0x3ae802=_0xec6eea;_0x583fdc=0xc8;}else{_0x583fdc=0xce;}_0x450ee4[_0x8f6d('0x28')](_0x583fdc);return _0x450ee4['set'](_0x8f6d('0x2e'),_0x57e85c+'-'+_0x3ae802+'/'+_0xec6eea)[_0x8f6d('0x2f')](_0x80ef88);}return null;};}function patchUpdates(_0x460ee5){return function(_0x3da271){try{jsonpatch[_0x8f6d('0x30')](_0x3da271,_0x460ee5,!![]);}catch(_0x29b240){return BPromise[_0x8f6d('0x31')](_0x29b240);}return _0x3da271[_0x8f6d('0x32')]();};}function saveUpdates(_0x2f173b,_0x4d0276){return function(_0x157d3b){if(_0x157d3b){return _0x157d3b[_0x8f6d('0x33')](_0x2f173b)[_0x8f6d('0x34')](function(_0x2f624f){return _0x2f624f;});}return null;};}function removeEntity(_0x4ac9ad,_0x527ac1){return function(_0x574e45){if(_0x574e45){return _0x574e45[_0x8f6d('0x35')]()[_0x8f6d('0x34')](function(){var _0x2bb4e4=_0x574e45[_0x8f6d('0x36')]({'plain':!![]});var _0x44a5fb=_0x8f6d('0x37');return db[_0x8f6d('0x38')][_0x8f6d('0x35')]({'where':{'type':_0x44a5fb,'resourceId':_0x2bb4e4['id']}})[_0x8f6d('0x34')](function(){return _0x574e45;});})[_0x8f6d('0x34')](function(){_0x4ac9ad[_0x8f6d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f29b6,_0x215d55){return function(_0x553c4f){if(!_0x553c4f){_0x2f29b6[_0x8f6d('0x27')](0x194);}return _0x553c4f;};}function handleError(_0x45416f,_0x1c535d){_0x1c535d=_0x1c535d||0x1f4;return function(_0x5e252a){logger[_0x8f6d('0x22')](_0x5e252a[_0x8f6d('0x39')]);if(_0x5e252a[_0x8f6d('0x3a')]){delete _0x5e252a['name'];}_0x45416f[_0x8f6d('0x28')](_0x1c535d)[_0x8f6d('0x3b')](_0x5e252a);};}exports[_0x8f6d('0x3c')]=function(_0x42a3e2,_0x189c6b){var _0x41632b={'include':[{'model':db[_0x8f6d('0x3d')],'as':_0x8f6d('0x3e')}]},_0x231042={},_0x15f593={'count':0x0,'rows':[]};var _0x595887=_[_0x8f6d('0x3f')](db['WhatsappAccount']['rawAttributes'],function(_0x2d1096){return{'name':_0x2d1096['fieldName'],'type':_0x2d1096[_0x8f6d('0x40')]['key']};});_0x231042[_0x8f6d('0x41')]=_[_0x8f6d('0x3f')](_0x595887,_0x8f6d('0x3a'));_0x231042[_0x8f6d('0x42')]=_[_0x8f6d('0x43')](_0x42a3e2[_0x8f6d('0x42')]);_0x231042[_0x8f6d('0x44')]=_[_0x8f6d('0x45')](_0x231042['model'],_0x231042[_0x8f6d('0x42')]);_0x41632b['attributes']=_[_0x8f6d('0x45')](_0x231042[_0x8f6d('0x41')],qs[_0x8f6d('0x46')](_0x42a3e2[_0x8f6d('0x42')][_0x8f6d('0x46')]));_0x41632b[_0x8f6d('0x47')]=_0x41632b[_0x8f6d('0x47')][_0x8f6d('0x48')]?_0x41632b[_0x8f6d('0x47')]:_0x231042[_0x8f6d('0x41')];if(!_0x42a3e2[_0x8f6d('0x42')][_0x8f6d('0x49')](_0x8f6d('0x4a'))){_0x41632b[_0x8f6d('0x2b')]=qs[_0x8f6d('0x2b')](_0x42a3e2[_0x8f6d('0x42')]['limit']);_0x41632b['offset']=qs[_0x8f6d('0x2c')](_0x42a3e2[_0x8f6d('0x42')][_0x8f6d('0x2c')]);}_0x41632b[_0x8f6d('0x4b')]=qs[_0x8f6d('0x4c')](_0x42a3e2[_0x8f6d('0x42')][_0x8f6d('0x4c')]);_0x41632b[_0x8f6d('0x4d')]=qs[_0x8f6d('0x44')](_[_0x8f6d('0x4e')](_0x42a3e2[_0x8f6d('0x42')],_0x231042[_0x8f6d('0x44')]),_0x595887);if(_0x42a3e2['query'][_0x8f6d('0x4f')]){_0x41632b[_0x8f6d('0x4d')]=_[_0x8f6d('0x50')](_0x41632b[_0x8f6d('0x4d')],{'$or':_['map'](_0x595887,function(_0x5d8a62){if(_0x5d8a62[_0x8f6d('0x40')]!==_0x8f6d('0x51')){var _0x58d11c={};_0x58d11c[_0x5d8a62['name']]={'$like':'%'+_0x42a3e2[_0x8f6d('0x42')][_0x8f6d('0x4f')]+'%'};return _0x58d11c;}})});}_0x41632b=_[_0x8f6d('0x50')]({},_0x41632b,_0x42a3e2[_0x8f6d('0x52')]);var _0x2a0fa4={'where':_0x41632b[_0x8f6d('0x4d')]};return db[_0x8f6d('0x53')]['count'](_0x2a0fa4)['then'](function(_0x450c79){_0x15f593[_0x8f6d('0x2d')]=_0x450c79;if(_0x42a3e2[_0x8f6d('0x42')][_0x8f6d('0x54')]){_0x41632b[_0x8f6d('0x55')]=[{'all':!![]}];}return db[_0x8f6d('0x53')][_0x8f6d('0x56')](_0x41632b);})['then'](function(_0x5a2635){_0x15f593[_0x8f6d('0x57')]=_0x5a2635;return _0x15f593;})[_0x8f6d('0x34')](respondWithFilteredResult(_0x189c6b,_0x41632b))[_0x8f6d('0x26')](handleError(_0x189c6b,null));};exports['show']=function(_0x23cfcf,_0x1105c2){var _0x2cf909={'raw':![],'where':{'id':_0x23cfcf[_0x8f6d('0x58')]['id']},'include':[{'model':db[_0x8f6d('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5b11c9={};_0x5b11c9['model']=_[_0x8f6d('0x43')](db['WhatsappAccount'][_0x8f6d('0x59')]);_0x5b11c9[_0x8f6d('0x42')]=_['keys'](_0x23cfcf[_0x8f6d('0x42')]);_0x5b11c9[_0x8f6d('0x44')]=_['intersection'](_0x5b11c9[_0x8f6d('0x41')],_0x5b11c9[_0x8f6d('0x42')]);_0x2cf909[_0x8f6d('0x47')]=_['intersection'](_0x5b11c9[_0x8f6d('0x41')],qs['fields'](_0x23cfcf[_0x8f6d('0x42')][_0x8f6d('0x46')]));_0x2cf909[_0x8f6d('0x47')]=_0x2cf909[_0x8f6d('0x47')][_0x8f6d('0x48')]?_0x2cf909['attributes']:_0x5b11c9[_0x8f6d('0x41')];if(_0x23cfcf[_0x8f6d('0x42')]['includeAll']){_0x2cf909[_0x8f6d('0x55')]=[{'all':!![]}];}_0x2cf909=_[_0x8f6d('0x50')]({},_0x2cf909,_0x23cfcf[_0x8f6d('0x52')]);return db[_0x8f6d('0x53')][_0x8f6d('0x5a')](_0x2cf909)[_0x8f6d('0x34')](handleEntityNotFound(_0x1105c2,null))[_0x8f6d('0x34')](respondWithResult(_0x1105c2,null))[_0x8f6d('0x26')](handleError(_0x1105c2,null));};exports[_0x8f6d('0x5b')]=function(_0x51fb7c,_0x4b7ece){return db['WhatsappAccount'][_0x8f6d('0x5b')](_0x51fb7c[_0x8f6d('0x5c')],{})[_0x8f6d('0x34')](function(_0x43976e){var _0x37487b=_0x51fb7c[_0x8f6d('0x5d')][_0x8f6d('0x36')]({'plain':!![]});if(!_0x37487b)throw new Error(_0x8f6d('0x5e'));if(_0x37487b[_0x8f6d('0x5f')]==='user'){var _0x485598=_0x43976e[_0x8f6d('0x36')]({'plain':!![]});var _0x27db76=_0x8f6d('0x37');return db[_0x8f6d('0x60')]['find']({'where':{'name':_0x27db76,'userProfileId':_0x37487b[_0x8f6d('0x61')]},'raw':!![]})['then'](function(_0x283e2c){if(_0x283e2c&&_0x283e2c[_0x8f6d('0x62')]===0x0){return db[_0x8f6d('0x38')][_0x8f6d('0x5b')]({'name':_0x485598[_0x8f6d('0x3a')],'resourceId':_0x485598['id'],'type':_0x283e2c[_0x8f6d('0x3a')],'sectionId':_0x283e2c['id']},{})[_0x8f6d('0x34')](function(){return _0x43976e;});}else{return _0x43976e;}})[_0x8f6d('0x26')](function(_0x2aae85){logger[_0x8f6d('0x22')](_0x8f6d('0x63'),_0x2aae85);throw _0x2aae85;});}return _0x43976e;})['then'](respondWithResult(_0x4b7ece,0xc9))['catch'](handleError(_0x4b7ece,null));};exports['update']=function(_0x51fa6e,_0x90d9f){if(_0x51fa6e[_0x8f6d('0x5c')]['id']){delete _0x51fa6e[_0x8f6d('0x5c')]['id'];}return db[_0x8f6d('0x53')]['find']({'where':{'id':_0x51fa6e[_0x8f6d('0x58')]['id']},'include':[{'model':db[_0x8f6d('0x3d')],'as':_0x8f6d('0x3e')}]})[_0x8f6d('0x34')](handleEntityNotFound(_0x90d9f,null))[_0x8f6d('0x34')](saveUpdates(_0x51fa6e[_0x8f6d('0x5c')],null))[_0x8f6d('0x34')](respondWithResult(_0x90d9f,null))[_0x8f6d('0x26')](handleError(_0x90d9f,null));};exports['destroy']=function(_0x4335c8,_0x254aea){return db[_0x8f6d('0x53')][_0x8f6d('0x5a')]({'where':{'id':_0x4335c8[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x254aea,null))[_0x8f6d('0x34')](removeEntity(_0x254aea,null))[_0x8f6d('0x26')](handleError(_0x254aea,null));};exports['describe']=function(_0x4d2325,_0x2b7e24){return db[_0x8f6d('0x53')]['describe']()[_0x8f6d('0x34')](respondWithResult(_0x2b7e24,null))[_0x8f6d('0x26')](handleError(_0x2b7e24,null));};exports['addDisposition']=function(_0x23572a,_0x8ad5bb,_0x57cbfb){if(_0x23572a[_0x8f6d('0x5c')]['id']){delete _0x23572a[_0x8f6d('0x5c')]['id'];}return db[_0x8f6d('0x53')][_0x8f6d('0x5a')]({'where':{'id':_0x23572a[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x8ad5bb,null))[_0x8f6d('0x34')](function(_0x5a47ff){if(_0x5a47ff){_0x23572a[_0x8f6d('0x5c')]['WhatsappAccountId']=_0x5a47ff['id'];return db[_0x8f6d('0x64')][_0x8f6d('0x5b')](_0x23572a[_0x8f6d('0x5c')]);}})[_0x8f6d('0x34')](respondWithResult(_0x8ad5bb,null))['catch'](handleError(_0x8ad5bb,null));};exports[_0x8f6d('0x65')]=function(_0x3148cc,_0x3a4738,_0x1dba7e){var _0x5929bd={'raw':![],'where':{}};var _0x3a16a1={};var _0x57410b={'count':0x0,'rows':[]};return db[_0x8f6d('0x53')][_0x8f6d('0x66')]({'where':{'id':_0x3148cc[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x3a4738,null))[_0x8f6d('0x34')](function(_0x328d51){if(_0x328d51){_0x3a16a1[_0x8f6d('0x41')]=_[_0x8f6d('0x43')](db[_0x8f6d('0x64')][_0x8f6d('0x59')]);_0x3a16a1[_0x8f6d('0x42')]=_[_0x8f6d('0x43')](_0x3148cc[_0x8f6d('0x42')]);_0x3a16a1[_0x8f6d('0x44')]=_['intersection'](_0x3a16a1['model'],_0x3a16a1['query']);_0x5929bd[_0x8f6d('0x47')]=_[_0x8f6d('0x45')](_0x3a16a1[_0x8f6d('0x41')],qs[_0x8f6d('0x46')](_0x3148cc[_0x8f6d('0x42')][_0x8f6d('0x46')]));_0x5929bd[_0x8f6d('0x47')]=_0x5929bd['attributes'][_0x8f6d('0x48')]?_0x5929bd[_0x8f6d('0x47')]:_0x3a16a1[_0x8f6d('0x41')];if(!_0x3148cc[_0x8f6d('0x42')]['hasOwnProperty'](_0x8f6d('0x4a'))){_0x5929bd[_0x8f6d('0x2b')]=qs[_0x8f6d('0x2b')](_0x3148cc['query'][_0x8f6d('0x2b')]);_0x5929bd['offset']=qs[_0x8f6d('0x2c')](_0x3148cc[_0x8f6d('0x42')]['offset']);}_0x5929bd[_0x8f6d('0x4b')]=qs['sort'](_0x3148cc[_0x8f6d('0x42')]['sort']);_0x5929bd['where']=qs[_0x8f6d('0x44')](_['pick'](_0x3148cc['query'],_0x3a16a1['filters']));_0x5929bd[_0x8f6d('0x4d')][_0x8f6d('0x67')]=_0x328d51['id'];if(_0x3148cc[_0x8f6d('0x42')][_0x8f6d('0x4f')]){_0x5929bd[_0x8f6d('0x4d')]=_[_0x8f6d('0x50')](_0x5929bd['where'],{'$or':_[_0x8f6d('0x3f')](_0x5929bd['attributes'],function(_0x29ce81){var _0x1cdbe9={};_0x1cdbe9[_0x29ce81]={'$like':'%'+_0x3148cc[_0x8f6d('0x42')][_0x8f6d('0x4f')]+'%'};return _0x1cdbe9;})});}_0x5929bd=_[_0x8f6d('0x50')]({},_0x5929bd,_0x3148cc['options']);return db['Disposition'][_0x8f6d('0x2d')]({'where':_0x5929bd[_0x8f6d('0x4d')]})[_0x8f6d('0x34')](function(_0xc76962){_0x57410b[_0x8f6d('0x2d')]=_0xc76962;if(_0x3148cc['query'][_0x8f6d('0x54')]){_0x5929bd[_0x8f6d('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x8f6d('0x56')](_0x5929bd);})[_0x8f6d('0x34')](function(_0x407f55){_0x57410b[_0x8f6d('0x57')]=_0x407f55;return _0x57410b;});}})[_0x8f6d('0x34')](respondWithFilteredResult(_0x3a4738,_0x5929bd))[_0x8f6d('0x26')](handleError(_0x3a4738,null));};exports[_0x8f6d('0x68')]=function(_0x1609f7,_0x2e54f2,_0x2c3f56){return db[_0x8f6d('0x53')]['find']({'where':{'id':_0x1609f7[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x2e54f2,null))['then'](function(_0x28357f){if(_0x28357f){return _0x28357f[_0x8f6d('0x68')](_0x1609f7[_0x8f6d('0x42')]['ids']);}})[_0x8f6d('0x34')](respondWithStatusCode(_0x2e54f2,null))[_0x8f6d('0x26')](handleError(_0x2e54f2,null));};exports[_0x8f6d('0x69')]=function(_0x53ff1c,_0x20e461,_0x5b3013){if(_0x53ff1c['body']['id']){delete _0x53ff1c[_0x8f6d('0x5c')]['id'];}return db[_0x8f6d('0x53')]['find']({'where':{'id':_0x53ff1c['params']['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x20e461,null))['then'](function(_0x330543){if(_0x330543){_0x53ff1c[_0x8f6d('0x5c')]['WhatsappAccountId']=_0x330543['id'];return db[_0x8f6d('0x6a')][_0x8f6d('0x5b')](_0x53ff1c['body']);}})['then'](respondWithResult(_0x20e461,null))[_0x8f6d('0x26')](handleError(_0x20e461,null));};exports[_0x8f6d('0x6b')]=function(_0x26cc84,_0x21563c,_0x41e775){var _0x5343fe={'raw':![],'where':{}};var _0x385408={};var _0x4a061d={'count':0x0,'rows':[]};return db[_0x8f6d('0x53')][_0x8f6d('0x66')]({'where':{'id':_0x26cc84[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x21563c,null))[_0x8f6d('0x34')](function(_0x1e952c){if(_0x1e952c){_0x385408[_0x8f6d('0x41')]=_[_0x8f6d('0x43')](db[_0x8f6d('0x6a')][_0x8f6d('0x59')]);_0x385408['query']=_[_0x8f6d('0x43')](_0x26cc84['query']);_0x385408['filters']=_[_0x8f6d('0x45')](_0x385408['model'],_0x385408['query']);_0x5343fe[_0x8f6d('0x47')]=_[_0x8f6d('0x45')](_0x385408['model'],qs[_0x8f6d('0x46')](_0x26cc84[_0x8f6d('0x42')]['fields']));_0x5343fe[_0x8f6d('0x47')]=_0x5343fe[_0x8f6d('0x47')][_0x8f6d('0x48')]?_0x5343fe[_0x8f6d('0x47')]:_0x385408[_0x8f6d('0x41')];if(!_0x26cc84['query'][_0x8f6d('0x49')](_0x8f6d('0x4a'))){_0x5343fe[_0x8f6d('0x2b')]=qs['limit'](_0x26cc84[_0x8f6d('0x42')][_0x8f6d('0x2b')]);_0x5343fe[_0x8f6d('0x2c')]=qs[_0x8f6d('0x2c')](_0x26cc84[_0x8f6d('0x42')][_0x8f6d('0x2c')]);}_0x5343fe[_0x8f6d('0x4b')]=qs['sort'](_0x26cc84[_0x8f6d('0x42')][_0x8f6d('0x4c')]);_0x5343fe[_0x8f6d('0x4d')]=qs[_0x8f6d('0x44')](_['pick'](_0x26cc84[_0x8f6d('0x42')],_0x385408[_0x8f6d('0x44')]));_0x5343fe['where'][_0x8f6d('0x67')]=_0x1e952c['id'];if(_0x26cc84['query']['filter']){_0x5343fe[_0x8f6d('0x4d')]=_[_0x8f6d('0x50')](_0x5343fe['where'],{'$or':_['map'](_0x5343fe[_0x8f6d('0x47')],function(_0x4d41a8){var _0x1f6d47={};_0x1f6d47[_0x4d41a8]={'$like':'%'+_0x26cc84['query']['filter']+'%'};return _0x1f6d47;})});}_0x5343fe=_[_0x8f6d('0x50')]({},_0x5343fe,_0x26cc84['options']);return db[_0x8f6d('0x6a')]['count']({'where':_0x5343fe[_0x8f6d('0x4d')]})['then'](function(_0x4d89cd){_0x4a061d[_0x8f6d('0x2d')]=_0x4d89cd;if(_0x26cc84['query'][_0x8f6d('0x54')]){_0x5343fe[_0x8f6d('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8f6d('0x56')](_0x5343fe);})[_0x8f6d('0x34')](function(_0x2d38d2){_0x4a061d[_0x8f6d('0x57')]=_0x2d38d2;return _0x4a061d;});}})['then'](respondWithFilteredResult(_0x21563c,_0x5343fe))['catch'](handleError(_0x21563c,null));};exports[_0x8f6d('0x6c')]=function(_0x112891,_0xbec5ed,_0x54295d){return db[_0x8f6d('0x53')]['find']({'where':{'id':_0x112891['params']['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0xbec5ed,null))[_0x8f6d('0x34')](function(_0x3ae8af){if(_0x3ae8af){return _0x3ae8af[_0x8f6d('0x6c')](_0x112891[_0x8f6d('0x42')][_0x8f6d('0x6d')]);}})[_0x8f6d('0x34')](respondWithStatusCode(_0xbec5ed,null))[_0x8f6d('0x26')](handleError(_0xbec5ed,null));};exports['addAgents']=function(_0x4b7ca6,_0x18fc30,_0x1b9599){return db[_0x8f6d('0x53')]['find']({'where':{'id':_0x4b7ca6[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x18fc30,null))[_0x8f6d('0x34')](function(_0x37fdbb){if(_0x37fdbb){return _0x37fdbb[_0x8f6d('0x6e')](_0x4b7ca6[_0x8f6d('0x5c')]['ids'],_[_0x8f6d('0x6f')](_0x4b7ca6[_0x8f6d('0x5c')],[_0x8f6d('0x6d'),'id'])||{})['spread'](function(_0x1c580b){for(var _0x391ca0=0x0;_0x391ca0<_0x4b7ca6[_0x8f6d('0x5c')][_0x8f6d('0x6d')]['length'];_0x391ca0+=0x1){socket[_0x8f6d('0x70')](_0x8f6d('0x71'),{'UserId':Number(_0x4b7ca6[_0x8f6d('0x5c')]['ids'][_0x391ca0]),'WhatsappAccountId':Number(_0x4b7ca6[_0x8f6d('0x58')]['id'])});}return _0x1c580b;});}})[_0x8f6d('0x34')](respondWithResult(_0x18fc30,null))[_0x8f6d('0x26')](handleError(_0x18fc30,null));};exports[_0x8f6d('0x72')]=function(_0x300e1b,_0x21ebab,_0x50f2a9){return db[_0x8f6d('0x53')]['find']({'where':{'id':_0x300e1b[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x21ebab,null))[_0x8f6d('0x34')](function(_0x56e437){if(_0x56e437){return _0x56e437['removeAgents'](_0x300e1b['query'][_0x8f6d('0x6d')])[_0x8f6d('0x34')](function(){if(_[_0x8f6d('0x73')](_0x300e1b[_0x8f6d('0x42')][_0x8f6d('0x6d')])){for(var _0x5a32eb=0x0;_0x5a32eb<_0x300e1b[_0x8f6d('0x42')][_0x8f6d('0x6d')]['length'];_0x5a32eb+=0x1){socket[_0x8f6d('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x300e1b['query'][_0x8f6d('0x6d')][_0x5a32eb]),'WhatsappAccountId':Number(_0x300e1b['params']['id'])});}}else{socket[_0x8f6d('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x300e1b[_0x8f6d('0x42')][_0x8f6d('0x6d')]),'WhatsappAccountId':Number(_0x300e1b[_0x8f6d('0x58')]['id'])});}});}})[_0x8f6d('0x34')](respondWithStatusCode(_0x21ebab,null))[_0x8f6d('0x26')](handleError(_0x21ebab,null));};exports['getAgents']=function(_0x41934e,_0x292d73,_0x56ddb0){var _0x1a9b49={};var _0x40237b={};var _0x26132f;var _0x20b179;return db['WhatsappAccount']['findOne']({'where':{'id':_0x41934e[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x292d73,null))['then'](function(_0x12806a){if(_0x12806a){_0x26132f=_0x12806a;_0x40237b['model']=_['keys'](db['User'][_0x8f6d('0x59')]);_0x40237b[_0x8f6d('0x42')]=_[_0x8f6d('0x43')](_0x41934e[_0x8f6d('0x42')]);_0x40237b[_0x8f6d('0x44')]=_[_0x8f6d('0x45')](_0x40237b[_0x8f6d('0x41')],_0x40237b[_0x8f6d('0x42')]);_0x1a9b49[_0x8f6d('0x47')]=_[_0x8f6d('0x45')](_0x40237b[_0x8f6d('0x41')],qs[_0x8f6d('0x46')](_0x41934e[_0x8f6d('0x42')]['fields']));_0x1a9b49[_0x8f6d('0x47')]=_0x1a9b49['attributes'][_0x8f6d('0x48')]?_0x1a9b49[_0x8f6d('0x47')]:_0x40237b['model'];_0x1a9b49['order']=qs['sort'](_0x41934e[_0x8f6d('0x42')][_0x8f6d('0x4c')]);_0x1a9b49[_0x8f6d('0x4d')]=qs[_0x8f6d('0x44')](_['pick'](_0x41934e['query'],_0x40237b[_0x8f6d('0x44')]));if(_0x41934e[_0x8f6d('0x42')][_0x8f6d('0x4f')]){_0x1a9b49['where']=_[_0x8f6d('0x50')](_0x1a9b49[_0x8f6d('0x4d')],{'$or':_['map'](_0x1a9b49['attributes'],function(_0x93472e){var _0x3cde7f={};_0x3cde7f[_0x93472e]={'$like':'%'+_0x41934e[_0x8f6d('0x42')][_0x8f6d('0x4f')]+'%'};return _0x3cde7f;})});}_0x1a9b49=_['merge']({},_0x1a9b49,_0x41934e[_0x8f6d('0x52')]);return _0x26132f['getAgents'](_0x1a9b49);}})[_0x8f6d('0x34')](function(_0x193f95){if(_0x193f95){_0x20b179=_0x193f95[_0x8f6d('0x48')];if(!_0x41934e[_0x8f6d('0x42')][_0x8f6d('0x49')]('nolimit')){_0x1a9b49[_0x8f6d('0x2b')]=qs[_0x8f6d('0x2b')](_0x41934e[_0x8f6d('0x42')][_0x8f6d('0x2b')]);_0x1a9b49[_0x8f6d('0x2c')]=qs[_0x8f6d('0x2c')](_0x41934e[_0x8f6d('0x42')]['offset']);}return _0x26132f[_0x8f6d('0x74')](_0x1a9b49);}})[_0x8f6d('0x34')](function(_0x361a23){if(_0x361a23){return _0x361a23?{'count':_0x20b179,'rows':_0x361a23}:null;}})[_0x8f6d('0x34')](respondWithResult(_0x292d73,null))[_0x8f6d('0x26')](handleError(_0x292d73,null));};exports[_0x8f6d('0x75')]=function(_0xbf6007,_0x32b4fe){var _0x125733=_0xbf6007['params']['id'];var _0x306183=_0xbf6007[_0x8f6d('0x5c')];var _0x1ee88e=0xc8;var _0x3ca315=null;return db[_0x8f6d('0x76')][_0x8f6d('0x77')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x8f6d('0x78')]},function(_0x33ca21){return db[_0x8f6d('0x53')][_0x8f6d('0x66')]({'where':{'id':_0x125733},'transaction':_0x33ca21})['then'](function(_0x14408c){if(_0x14408c){return db[_0x8f6d('0x79')][_0x8f6d('0x35')]({'where':{'WhatsappAccountId':_0x125733},'transaction':_0x33ca21})[_0x8f6d('0x34')](function(){var _0x2b9c67=_[_0x8f6d('0x3f')](_0x306183,function(_0x47cac7){_0x47cac7[_0x8f6d('0x67')]=_0x125733;return _0x47cac7;});return db[_0x8f6d('0x79')][_0x8f6d('0x7a')](_0x2b9c67,{'transaction':_0x33ca21});});}else{_0x1ee88e=0x194;_0x3ca315=[];}});})[_0x8f6d('0x34')](function(){if(_0x1ee88e!==0x194){return db['WhatsappApplication'][_0x8f6d('0x7b')]({'where':{'WhatsappAccountId':_0x125733},'order':_0x8f6d('0x7c')})['then'](function(_0xe22355){_0x3ca315=_0xe22355;});}})[_0x8f6d('0x26')](function(_0x586760){_0x1ee88e=0x1f4;logger[_0x8f6d('0x22')](_0x586760[_0x8f6d('0x39')]);if(_0x586760['name']){delete _0x586760[_0x8f6d('0x3a')];}_0x3ca315=_0x586760;})['finally'](function(){if(_0x3ca315===null){_0x32b4fe[_0x8f6d('0x27')](_0x1ee88e);}else{if(_0x1ee88e===0x1f4){_0x32b4fe[_0x8f6d('0x28')](_0x1ee88e)[_0x8f6d('0x3b')](_0x3ca315);}else{_0x32b4fe['status'](_0x1ee88e)[_0x8f6d('0x2f')](_0x3ca315);}}});};exports[_0x8f6d('0x7d')]=function(_0x435d18,_0x431a63,_0x252b22){var _0x606b44={};var _0x12a09a={};var _0x4076d7;var _0x424295;return db[_0x8f6d('0x53')]['findOne']({'where':{'id':_0x435d18[_0x8f6d('0x58')]['id']}})[_0x8f6d('0x34')](handleEntityNotFound(_0x431a63,null))['then'](function(_0x35e31f){if(_0x35e31f){_0x4076d7=_0x35e31f;_0x12a09a[_0x8f6d('0x41')]=_[_0x8f6d('0x43')](db['WhatsappApplication'][_0x8f6d('0x59')]);_0x12a09a['query']=_[_0x8f6d('0x43')](_0x435d18[_0x8f6d('0x42')]);_0x12a09a[_0x8f6d('0x44')]=_['intersection'](_0x12a09a['model'],_0x12a09a[_0x8f6d('0x42')]);_0x606b44[_0x8f6d('0x47')]=_[_0x8f6d('0x45')](_0x12a09a[_0x8f6d('0x41')],qs['fields'](_0x435d18[_0x8f6d('0x42')][_0x8f6d('0x46')]));_0x606b44[_0x8f6d('0x47')]=_0x606b44[_0x8f6d('0x47')][_0x8f6d('0x48')]?_0x606b44[_0x8f6d('0x47')]:_0x12a09a[_0x8f6d('0x41')];_0x606b44[_0x8f6d('0x4b')]=qs['sort'](_0x435d18[_0x8f6d('0x42')][_0x8f6d('0x4c')]);_0x606b44['where']=qs[_0x8f6d('0x44')](_[_0x8f6d('0x4e')](_0x435d18['query'],_0x12a09a[_0x8f6d('0x44')]));if(_0x435d18[_0x8f6d('0x42')][_0x8f6d('0x4f')]){_0x606b44['where']=_['merge'](_0x606b44[_0x8f6d('0x4d')],{'$or':_[_0x8f6d('0x3f')](_0x606b44[_0x8f6d('0x47')],function(_0x39fdca){var _0x1bd94b={};_0x1bd94b[_0x39fdca]={'$like':'%'+_0x435d18[_0x8f6d('0x42')]['filter']+'%'};return _0x1bd94b;})});}_0x606b44=_['merge']({},_0x606b44,_0x435d18[_0x8f6d('0x52')]);return _0x4076d7[_0x8f6d('0x7d')](_0x606b44);}})['then'](function(_0x256723){if(_0x256723){_0x424295=_0x256723[_0x8f6d('0x48')];if(!_0x435d18[_0x8f6d('0x42')][_0x8f6d('0x49')](_0x8f6d('0x4a'))){_0x606b44[_0x8f6d('0x2b')]=qs['limit'](_0x435d18[_0x8f6d('0x42')]['limit']);_0x606b44[_0x8f6d('0x2c')]=qs['offset'](_0x435d18[_0x8f6d('0x42')][_0x8f6d('0x2c')]);}return _0x4076d7[_0x8f6d('0x7d')](_0x606b44);}})[_0x8f6d('0x34')](function(_0x4af5df){if(_0x4af5df){return _0x4af5df?{'count':_0x424295,'rows':_0x4af5df}:null;}})[_0x8f6d('0x34')](respondWithResult(_0x431a63,null))[_0x8f6d('0x26')](handleError(_0x431a63,null));};exports[_0x8f6d('0x7e')]=function(_0x5a8f9f,_0x2bd29,_0x550c05){var _0xc9bc65={'channel':'whatsapp'};var _0x3f64c5=[];var _0x79a094=[];var _0x47626f={};return db['WhatsappAccount'][_0x8f6d('0x5a')]({'where':{'id':_0x5a8f9f['params']['id']},'include':[{'model':db[_0x8f6d('0x79')],'as':_0x8f6d('0x7f')}]})['then'](handleEntityNotFound(_0x2bd29,null))[_0x8f6d('0x34')](function(_0x49fb2f){_0xc9bc65[_0x8f6d('0x80')]=_0x49fb2f;if(_0xc9bc65[_0x8f6d('0x80')]&&_0xc9bc65['account'][_0x8f6d('0x40')]===_0x8f6d('0x81')&&_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x82')]){if(_0x5a8f9f['body'][_0x8f6d('0x82')][_0x8f6d('0x48')]===0x0)return;if(_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x82')][0x0][_0x8f6d('0x83')]!==_0x8f6d('0x84'))return;return db[_0x8f6d('0x85')][_0x8f6d('0x33')]({'read':!![],'readAt':_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x82')][0x0][_0x8f6d('0x86')]},{'where':{'messageId':_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x82')][0x0]['message_id']},'individualHooks':!![]})[_0x8f6d('0x34')](function(_0x40787a){return _0x2bd29['status'](0xc8)[_0x8f6d('0x2f')](_0x40787a);});}_0xc9bc65[_0x8f6d('0x87')]=_['orderBy'](_0x49fb2f[_0x8f6d('0x7f')],['priority'],['asc']);if(_0xc9bc65[_0x8f6d('0x80')]['Applications']){delete _0xc9bc65['account'][_0x8f6d('0x7f')];}return db['CmContact'][_0x8f6d('0x88')]()[_0x8f6d('0x34')](function(_0xe45fd1){if(!_0xe45fd1){throw new db['Sequelize'][(_0x8f6d('0x89'))](_0x8f6d('0x8a'));}_0x3f64c5=_[_0x8f6d('0x8b')](_['keys'](_0xe45fd1),[_0x8f6d('0x8c'),'updatedAt']);_0x79a094=_['difference'](_[_0x8f6d('0x43')](_0xe45fd1),[_0x8f6d('0x8c'),'updatedAt','CompanyId','ListId']);_0xc9bc65[_0x8f6d('0x5c')]={'mapKey':_0x8f6d('0x8d')};if(_0xc9bc65[_0x8f6d('0x80')]&&_0xc9bc65[_0x8f6d('0x80')][_0x8f6d('0x40')]===_0x8f6d('0x8e')){_0xc9bc65[_0x8f6d('0x5c')]['from']=_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x8f')][_0x8f6d('0x90')](_0x8f6d('0x91'),'');_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x5c')]=_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x92')];_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x93')]=_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x94')];}if(_0xc9bc65[_0x8f6d('0x80')]&&_0xc9bc65[_0x8f6d('0x80')][_0x8f6d('0x40')]===_0x8f6d('0x81')){_0xc9bc65['body']['from']=_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x95')][0x0][_0x8f6d('0x96')];_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x5c')]=_0x5a8f9f[_0x8f6d('0x5c')][_0x8f6d('0x95')][0x0]['message'][_0x8f6d('0x5c')];_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x93')]=_0x5a8f9f[_0x8f6d('0x5c')]['notifications'][0x0][_0x8f6d('0x97')];}if(_0xc9bc65[_0x8f6d('0x5c')]['id']){delete _0xc9bc65[_0x8f6d('0x5c')]['id'];}if(_[_0x8f6d('0x98')](_0xc9bc65['body'][_0x8f6d('0x96')])){throw new db[(_0x8f6d('0x99'))]['ValidationError'](_0x8f6d('0x9a'));}if(_[_0x8f6d('0x98')](_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x5c')])||_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x5c')]===''){throw new db[(_0x8f6d('0x99'))][(_0x8f6d('0x89'))](_0x8f6d('0x9b'));}if(_[_0x8f6d('0x98')](_0xc9bc65[_0x8f6d('0x5c')]['mapKey'])){throw new db[(_0x8f6d('0x99'))][(_0x8f6d('0x89'))](_0x8f6d('0x9c')+_0x79a094);}if(!_['includes'](_0x79a094,_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x9d')])){throw new db['Sequelize']['ValidationError'](_0x8f6d('0x9e')+_0x79a094);}_0x47626f[_0xc9bc65['body'][_0x8f6d('0x9d')]]=_0xc9bc65[_0x8f6d('0x5c')]['from'];return db[_0x8f6d('0x9f')][_0x8f6d('0x5a')]({'where':{'id':_0xc9bc65['account'][_0x8f6d('0xa0')]},'include':[{'model':db[_0x8f6d('0xa1')],'as':_0x8f6d('0xa2'),'where':_0x47626f,'limit':0x1,'order':[[_0x8f6d('0xa3'),'DESC']]}]});})[_0x8f6d('0x34')](handleEntityNotFound(_0x2bd29,null))['then'](function(_0x3311e7){if(_0x3311e7){_0xc9bc65[_0x8f6d('0xa4')]=_[_0x8f6d('0x6f')](_0x3311e7,[_0x8f6d('0xa2')]);if(_0x3311e7['Contacts'][_0x8f6d('0x48')]){return _0x3311e7[_0x8f6d('0xa2')][0x0];}var _0x2b0d85=_[_0x8f6d('0x1a')](_0xc9bc65[_0x8f6d('0x5c')],{'firstName':_0xc9bc65['body']['from'],'ListId':_0x3311e7['id']});_0x2b0d85[_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x9d')]]=_0xc9bc65[_0x8f6d('0x5c')]['from'];return db['CmContact'][_0x8f6d('0x5b')](_0x2b0d85,{'fields':_0x3f64c5,'raw':!![]});}})[_0x8f6d('0x34')](handleEntityNotFound(_0x2bd29,null))[_0x8f6d('0x34')](function(_0x3c07af){if(_0x3c07af){_0xc9bc65[_0x8f6d('0xa5')]=_0x3c07af;var _0x1ae3dc={'ContactId':_0x3c07af['id'],'phone':_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x96')],'WhatsappAccountId':_0x5a8f9f[_0x8f6d('0x58')]['id']};var _0xce2694={'ContactId':_0x3c07af['id'],'WhatsappAccountId':_0x5a8f9f[_0x8f6d('0x58')]['id'],'closed':![]};return db[_0x8f6d('0xa6')]['find']({'where':_0xce2694})['then'](function(_0x51b303){if(_0x51b303){return[_0x51b303,![]];}return db[_0x8f6d('0xa6')][_0x8f6d('0x5b')](_0x1ae3dc)[_0x8f6d('0x34')](function(_0x1d6365){return[_0x1d6365,!![]];});});}})['spread'](function(_0x158bb8,_0x21c26d){_0xc9bc65['interaction']=_0x158bb8[_0x8f6d('0x36')]({'plain':!![]});_0xc9bc65[_0x8f6d('0xa7')]['created']=![];if(_0x21c26d){if(_0xc9bc65[_0x8f6d('0x80')][_0x8f6d('0xa8')]){_0xc9bc65[_0x8f6d('0x87')]['push']({'id':0x0,'priority':_0xc9bc65[_0x8f6d('0x87')][_0x8f6d('0x48')]+0x1,'app':_0x8f6d('0xa9'),'appdata':'unmanaged','interval':_0x8f6d('0xaa')});}_0xc9bc65['interaction'][_0x8f6d('0xab')]=!![];}return db[_0x8f6d('0x85')][_0x8f6d('0x5b')]({'phone':_0xc9bc65[_0x8f6d('0x5c')]['from'],'messageId':_0xc9bc65['body'][_0x8f6d('0x93')],'body':_0xc9bc65[_0x8f6d('0x5c')][_0x8f6d('0x5c')],'WhatsappAccountId':_0x5a8f9f['params']['id'],'WhatsappInteractionId':_0x158bb8['id'],'direction':'in','ContactId':_0x158bb8['ContactId'],'AttachmentId':_0xc9bc65['body'][_0x8f6d('0xac')]});})['then'](function(_0x4385b7){_0xc9bc65[_0x8f6d('0x24')]=_0x4385b7;if(_0xc9bc65['interaction'][_0x8f6d('0xad')]){return db[_0x8f6d('0xae')][_0x8f6d('0x5a')]({'attributes':['id',_0x8f6d('0x3a')],'where':{'id':_0xc9bc65[_0x8f6d('0xa7')][_0x8f6d('0xad')]}})[_0x8f6d('0x34')](function(_0x18ee32){if(_0x18ee32){_0xc9bc65[_0x8f6d('0x87')][_0x8f6d('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x18ee32[_0x8f6d('0x3a')]+','+(_0xc9bc65[_0x8f6d('0x80')][_0x8f6d('0xb0')]||0xa),'interval':_0x8f6d('0xaa')});}return respondWithRpcPromise(_0x8f6d('0xb1'),_0x8f6d('0xb2'),_0xc9bc65);});}return respondWithRpcPromise(_0x8f6d('0xb1'),'startRouting',_0xc9bc65);})[_0x8f6d('0x34')](function(_0x91618e){if(_0x91618e){var _0x5a0867=0xc8;var _0x4311eb=_0x8f6d('0xb3');logger[_0x8f6d('0x1d')](_0x8f6d('0xb4'),_0x4311eb,_0x5a0867,_0x8f6d('0xb5'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4311eb,_0x5a0867,_0x8f6d('0xb5'),JSON['stringify'](_0x91618e));if(_0xc9bc65[_0x8f6d('0x80')]['type']===_0x8f6d('0x8e')){return _0x2bd29['status'](_0x5a0867)[_0x8f6d('0xb6')](_0x8f6d('0xb7'),_0x8f6d('0xb8'))[_0x8f6d('0x3b')]('\x0a');}else{return _0x2bd29['status'](_0x5a0867)[_0x8f6d('0x2f')](_0x91618e);}}});})[_0x8f6d('0x26')](handleError(_0x2bd29,null));};exports[_0x8f6d('0x3b')]=function(_0x377fb7,_0x5d9049,_0x485682){var _0x2b066e,_0x3c2ff9,_0x4c76b4;if(_['isNil'](_0x377fb7['body'][_0x8f6d('0x5c')])||_0x377fb7[_0x8f6d('0x5c')][_0x8f6d('0x5c')]===''){throw new db[(_0x8f6d('0x99'))][(_0x8f6d('0x89'))](_0x8f6d('0x9b'));}if(_[_0x8f6d('0x98')](_0x377fb7[_0x8f6d('0x5c')]['to'])){throw new db[(_0x8f6d('0x99'))][(_0x8f6d('0x89'))](_0x8f6d('0xb9'));}_0x2b066e=_0x377fb7[_0x8f6d('0x5c')]['to'];return db[_0x8f6d('0x53')][_0x8f6d('0x5a')]({'where':{'id':_0x377fb7[_0x8f6d('0x58')]['id']},'include':[{'model':db[_0x8f6d('0x9f')],'as':_0x8f6d('0xba'),'include':[{'model':db['CmContact'],'as':_0x8f6d('0xa2'),'where':{'mobile':_0x2b066e},'limit':0x1,'order':[[_0x8f6d('0xa3'),_0x8f6d('0xbb')]]}]}]})[_0x8f6d('0x34')](handleEntityNotFound(_0x5d9049,null))['then'](function(_0xb79772){if(_0xb79772&&_0xb79772[_0x8f6d('0xba')]){_0x3c2ff9=_0xb79772['get']({'plain':!![]});if(_0x3c2ff9[_0x8f6d('0xba')]&&_0x3c2ff9[_0x8f6d('0xba')][_0x8f6d('0xa2')]['length']){return _0x3c2ff9['List'][_0x8f6d('0xa2')][0x0];}return db['CmContact'][_0x8f6d('0x5b')](_[_0x8f6d('0x1a')](_0x377fb7['body'],{'firstName':_0x2b066e,'mobile':_0x2b066e,'phone':_0x2b066e,'ListId':_0x3c2ff9[_0x8f6d('0xa0')]}));}})[_0x8f6d('0x34')](handleEntityNotFound(_0x5d9049,null))[_0x8f6d('0x34')](function(_0x24ad78){if(_0x24ad78){_0x4c76b4=_0x24ad78;return db['WhatsappInteraction'][_0x8f6d('0x5a')]({'where':{'ContactId':_0x4c76b4['id'],'closed':![],'WhatsappAccountId':_0x3c2ff9['id']}})[_0x8f6d('0x34')](function(_0x4d0aa9){if(_0x4d0aa9){return[_0x4d0aa9,![]];}return db[_0x8f6d('0xa6')][_0x8f6d('0x5b')]({'UserId':_0x377fb7['user']['id'],'ContactId':_0x4c76b4['id'],'WhatsappAccountId':_0x3c2ff9['id'],'phone':_0x2b066e,'firstMsgDirection':_0x8f6d('0xbc'),'Messages':[_[_0x8f6d('0x50')](_0x377fb7[_0x8f6d('0x5c')],{'read':![],'body':_0x377fb7[_0x8f6d('0x5c')]['body'],'phone':_0x2b066e,'WhatsappAccountId':_0x3c2ff9['id'],'UserId':_0x377fb7[_0x8f6d('0x5d')]['id'],'ContactId':_0x4c76b4['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x8f6d('0xbd')}]})[_0x8f6d('0x34')](function(_0x3de851){return[_0x3de851,!![]];});});}})[_0x8f6d('0xbe')](function(_0x249042,_0x43206d){if(_0x43206d){return _0x249042;}return db[_0x8f6d('0x85')][_0x8f6d('0x5b')](_[_0x8f6d('0x50')](_0x377fb7[_0x8f6d('0x5c')],{'read':![],'body':_0x377fb7[_0x8f6d('0x5c')][_0x8f6d('0x5c')],'phone':_0x2b066e,'WhatsappAccountId':_0x3c2ff9['id'],'WhatsappInteractionId':_0x249042['id'],'UserId':_0x377fb7['user']['id'],'ContactId':_0x4c76b4['id']}))[_0x8f6d('0x34')](function(_0x23faa6){_0x249042[_0x8f6d('0xbf')][_0x8f6d('0xbd')]=[];_0x249042[_0x8f6d('0xbf')][_0x8f6d('0xbd')][_0x8f6d('0xc0')](_0x23faa6[_0x8f6d('0xbf')]);return _0x249042;});})[_0x8f6d('0x34')](respondWithResult(_0x5d9049,null))['catch'](handleError(_0x5d9049,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 55c6036..1a33403 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 _0xee7e=['events','../../mysqldb','WhatsappAccount','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x293467,_0x56fc55){var _0x4cf1a0=function(_0x1ef141){while(--_0x1ef141){_0x293467['push'](_0x293467['shift']());}};_0x4cf1a0(++_0x56fc55);}(_0xee7e,0x117));var _0xeee7=function(_0x10baec,_0x2fedb1){_0x10baec=_0x10baec-0x0;var _0x4812e7=_0xee7e[_0x10baec];return _0x4812e7;};'use strict';var EventEmitter=require(_0xeee7('0x0'));var WhatsappAccount=require(_0xeee7('0x1'))['db'][_0xeee7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xeee7('0x3'),'afterDestroy':_0xeee7('0x4')};function emitEvent(_0x26c0a4){return function(_0x5d4f41,_0x2fbcda,_0x52ffe0){WhatsappAccountEvents[_0xeee7('0x5')](_0x26c0a4+':'+_0x5d4f41['id'],_0x5d4f41);WhatsappAccountEvents[_0xeee7('0x5')](_0x26c0a4,_0x5d4f41);_0x52ffe0(null);};}for(var e in events){if(events[_0xeee7('0x6')](e)){var event=events[e];WhatsappAccount[_0xeee7('0x7')](e,emitEvent(event));}}module[_0xeee7('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x2ddf=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x2ddf,0x142));var _0xf2dd=function(_0x221400,_0x42f09e){_0x221400=_0x221400-0x0;var _0x19ad05=_0x2ddf[_0x221400];return _0x19ad05;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf2dd('0x0'))['db'][_0xf2dd('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf2dd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf2dd('0x3'),'afterDestroy':_0xf2dd('0x4')};function emitEvent(_0x27b469){return function(_0x96a40,_0x15e1e6,_0x1370b8){WhatsappAccountEvents[_0xf2dd('0x5')](_0x27b469+':'+_0x96a40['id'],_0x96a40);WhatsappAccountEvents[_0xf2dd('0x5')](_0x27b469,_0x96a40);_0x1370b8(null);};}for(var e in events){if(events[_0xf2dd('0x6')](e)){var event=events[e];WhatsappAccount[_0xf2dd('0x7')](e,emitEvent(event));}}module[_0xf2dd('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index bf78cdf..b5b717b 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 _0x788d=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','whatsapp_accounts','lodash'];(function(_0x1830c2,_0x2ca02c){var _0x54e07d=function(_0x54fea4){while(--_0x54fea4){_0x1830c2['push'](_0x1830c2['shift']());}};_0x54e07d(++_0x2ca02c);}(_0x788d,0x155));var _0xd788=function(_0xfe3a76,_0x5b58d4){_0xfe3a76=_0xfe3a76-0x0;var _0x1a07fb=_0x788d[_0xfe3a76];return _0x1a07fb;};'use strict';var _=require(_0xd788('0x0'));var util=require(_0xd788('0x1'));var logger=require(_0xd788('0x2'))('api');var moment=require(_0xd788('0x3'));var BPromise=require(_0xd788('0x4'));var rp=require(_0xd788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd788('0x6'));var config=require(_0xd788('0x7'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x3de794,_0x2a199e){return _0x3de794['define']('WhatsappAccount',attributes,{'tableName':_0xd788('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe66f=['whatsapp_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','WhatsappAccount'];(function(_0x59763e,_0x512f5a){var _0x41b817=function(_0x32e832){while(--_0x32e832){_0x59763e['push'](_0x59763e['shift']());}};_0x41b817(++_0x512f5a);}(_0xe66f,0x114));var _0xfe66=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xe66f[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xfe66('0x0'));var util=require(_0xfe66('0x1'));var logger=require(_0xfe66('0x2'))(_0xfe66('0x3'));var moment=require(_0xfe66('0x4'));var BPromise=require('bluebird');var rp=require(_0xfe66('0x5'));var fs=require('fs');var path=require(_0xfe66('0x6'));var rimraf=require(_0xfe66('0x7'));var config=require(_0xfe66('0x8'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x50b549,_0xa4c2c7){return _0x50b549['define'](_0xfe66('0x9'),attributes,{'tableName':_0xfe66('0xa'),'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 a51386b..4057fae 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 _0xbc2d=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','model','attributes','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0xbc2d,0x70));var _0xdbc2=function(_0x15c6b4,_0x3e704c){_0x15c6b4=_0x15c6b4-0x0;var _0x3419a8=_0xbc2d[_0x15c6b4];return _0x3419a8;};'use strict';var _=require(_0xdbc2('0x0'));var util=require(_0xdbc2('0x1'));var moment=require('moment');var BPromise=require(_0xdbc2('0x2'));var rs=require(_0xdbc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbc2('0x4'))['db'];var utils=require(_0xdbc2('0x5'));var logger=require(_0xdbc2('0x6'))('rpc');var config=require(_0xdbc2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdbc2('0x8')][_0xdbc2('0x9')]({'port':0x232a});config[_0xdbc2('0xa')]=_[_0xdbc2('0xb')](config[_0xdbc2('0xa')],{'host':_0xdbc2('0xc'),'port':0x18eb});var socket=require(_0xdbc2('0xd'))(new Redis(config[_0xdbc2('0xa')]));require(_0xdbc2('0xe'))[_0xdbc2('0xf')](socket);function respondWithRpcPromise(_0x19d23e,_0x4ae489,_0x5a3375){return new BPromise(function(_0x1ee540,_0x478e42){return client[_0xdbc2('0x10')](_0x19d23e,_0x5a3375)[_0xdbc2('0x11')](function(_0x5b18df){logger[_0xdbc2('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x4ae489,_0xdbc2('0x13'));logger[_0xdbc2('0x14')](_0xdbc2('0x15'),_0x4ae489,'request\x20sent',JSON[_0xdbc2('0x16')](_0x5b18df));if(_0x5b18df[_0xdbc2('0x17')]){if(_0x5b18df['error'][_0xdbc2('0x18')]===0x1f4){logger[_0xdbc2('0x17')](_0xdbc2('0x19'),_0x4ae489,_0x5b18df['error'][_0xdbc2('0x1a')]);return _0x478e42(_0x5b18df[_0xdbc2('0x17')]['message']);}logger[_0xdbc2('0x17')](_0xdbc2('0x19'),_0x4ae489,_0x5b18df[_0xdbc2('0x17')][_0xdbc2('0x1a')]);return _0x1ee540(_0x5b18df[_0xdbc2('0x17')]['message']);}else{logger[_0xdbc2('0x12')](_0xdbc2('0x19'),_0x4ae489,_0xdbc2('0x13'));_0x1ee540(_0x5b18df[_0xdbc2('0x1b')][_0xdbc2('0x1a')]);}})[_0xdbc2('0x1c')](function(_0x5b7039){logger[_0xdbc2('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x4ae489,_0x5b7039);_0x478e42(_0x5b7039);});});}exports[_0xdbc2('0x1d')]=function(_0x5b0225){var _0xcd4408=this;return new Promise(function(_0x284cd7,_0x46dd95){return db[_0xdbc2('0x1e')][_0xdbc2('0x1f')]({'raw':_0x5b0225[_0xdbc2('0x20')]?_0x5b0225[_0xdbc2('0x20')][_0xdbc2('0x21')]===undefined?!![]:![]:!![],'where':_0x5b0225['options']?_0x5b0225[_0xdbc2('0x20')][_0xdbc2('0x22')]||null:null,'attributes':_0x5b0225[_0xdbc2('0x20')]?_0x5b0225[_0xdbc2('0x20')]['attributes']||null:null,'include':_0x5b0225[_0xdbc2('0x20')]?_0x5b0225[_0xdbc2('0x20')][_0xdbc2('0x23')]?_[_0xdbc2('0x24')](_0x5b0225[_0xdbc2('0x20')][_0xdbc2('0x23')],function(_0x121bb0){return{'model':db[_0x121bb0['model']],'as':_0x121bb0['as'],'attributes':_0x121bb0['attributes'],'include':_0x121bb0[_0xdbc2('0x23')]?_[_0xdbc2('0x24')](_0x121bb0[_0xdbc2('0x23')],function(_0x1e9510){return{'model':db[_0x1e9510[_0xdbc2('0x25')]],'as':_0x1e9510['as'],'attributes':_0x1e9510[_0xdbc2('0x26')],'include':_0x1e9510[_0xdbc2('0x23')]?_[_0xdbc2('0x24')](_0x1e9510[_0xdbc2('0x23')],function(_0x4bcebb){return{'model':db[_0x4bcebb[_0xdbc2('0x25')]],'as':_0x4bcebb['as'],'attributes':_0x4bcebb[_0xdbc2('0x26')]};}):[]};}):[]};}):[]:[]})[_0xdbc2('0x11')](function(_0x1309a0){logger[_0xdbc2('0x12')]('ShowWhatsappAccount',_0x5b0225);logger['debug']('ShowWhatsappAccount',_0x5b0225,JSON['stringify'](_0x1309a0));_0x284cd7(_0x1309a0);})[_0xdbc2('0x1c')](function(_0x2b5413){logger[_0xdbc2('0x17')](_0xdbc2('0x1d'),_0x2b5413['message'],_0x5b0225);_0x46dd95(_0xcd4408[_0xdbc2('0x17')](0x1f4,_0x2b5413[_0xdbc2('0x1a')]));});});}; \ No newline at end of file +var _0x4b6b=['model','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map'];(function(_0x4ea110,_0x3d7a18){var _0x3a475d=function(_0x1f4af4){while(--_0x1f4af4){_0x4ea110['push'](_0x4ea110['shift']());}};_0x3a475d(++_0x3d7a18);}(_0x4b6b,0x75));var _0xb4b6=function(_0x2ea9d7,_0x1ba5b8){_0x2ea9d7=_0x2ea9d7-0x0;var _0x11b8e2=_0x4b6b[_0x2ea9d7];return _0x11b8e2;};'use strict';var _=require('lodash');var util=require(_0xb4b6('0x0'));var moment=require(_0xb4b6('0x1'));var BPromise=require(_0xb4b6('0x2'));var rs=require(_0xb4b6('0x3'));var fs=require('fs');var Redis=require(_0xb4b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4b6('0x5'));var logger=require(_0xb4b6('0x6'))(_0xb4b6('0x7'));var config=require(_0xb4b6('0x8'));var jayson=require(_0xb4b6('0x9'));var client=jayson[_0xb4b6('0xa')][_0xb4b6('0xb')]({'port':0x232a});config[_0xb4b6('0xc')]=_['defaults'](config['redis'],{'host':_0xb4b6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4b6('0xc')]));require(_0xb4b6('0xe'))['register'](socket);function respondWithRpcPromise(_0x1d69f5,_0x316903,_0x470baa){return new BPromise(function(_0x50b6e9,_0x23aa10){return client[_0xb4b6('0xf')](_0x1d69f5,_0x470baa)[_0xb4b6('0x10')](function(_0x51f2e5){logger[_0xb4b6('0x11')](_0xb4b6('0x12'),_0x316903,_0xb4b6('0x13'));logger['debug'](_0xb4b6('0x14'),_0x316903,_0xb4b6('0x13'),JSON['stringify'](_0x51f2e5));if(_0x51f2e5[_0xb4b6('0x15')]){if(_0x51f2e5[_0xb4b6('0x15')][_0xb4b6('0x16')]===0x1f4){logger[_0xb4b6('0x15')](_0xb4b6('0x12'),_0x316903,_0x51f2e5[_0xb4b6('0x15')][_0xb4b6('0x17')]);return _0x23aa10(_0x51f2e5['error'][_0xb4b6('0x17')]);}logger['error'](_0xb4b6('0x12'),_0x316903,_0x51f2e5['error'][_0xb4b6('0x17')]);return _0x50b6e9(_0x51f2e5[_0xb4b6('0x15')]['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x316903,_0xb4b6('0x13'));_0x50b6e9(_0x51f2e5[_0xb4b6('0x18')][_0xb4b6('0x17')]);}})[_0xb4b6('0x19')](function(_0x3fff9e){logger[_0xb4b6('0x15')](_0xb4b6('0x12'),_0x316903,_0x3fff9e);_0x23aa10(_0x3fff9e);});});}exports[_0xb4b6('0x1a')]=function(_0x33340b){var _0x28762a=this;return new Promise(function(_0x5dd079,_0x3237b8){return db[_0xb4b6('0x1b')][_0xb4b6('0x1c')]({'raw':_0x33340b[_0xb4b6('0x1d')]?_0x33340b['options'][_0xb4b6('0x1e')]===undefined?!![]:![]:!![],'where':_0x33340b[_0xb4b6('0x1d')]?_0x33340b[_0xb4b6('0x1d')][_0xb4b6('0x1f')]||null:null,'attributes':_0x33340b[_0xb4b6('0x1d')]?_0x33340b[_0xb4b6('0x1d')][_0xb4b6('0x20')]||null:null,'include':_0x33340b[_0xb4b6('0x1d')]?_0x33340b[_0xb4b6('0x1d')][_0xb4b6('0x21')]?_[_0xb4b6('0x22')](_0x33340b[_0xb4b6('0x1d')][_0xb4b6('0x21')],function(_0x4e8bb3){return{'model':db[_0x4e8bb3['model']],'as':_0x4e8bb3['as'],'attributes':_0x4e8bb3[_0xb4b6('0x20')],'include':_0x4e8bb3[_0xb4b6('0x21')]?_[_0xb4b6('0x22')](_0x4e8bb3[_0xb4b6('0x21')],function(_0x30a174){return{'model':db[_0x30a174[_0xb4b6('0x23')]],'as':_0x30a174['as'],'attributes':_0x30a174['attributes'],'include':_0x30a174[_0xb4b6('0x21')]?_['map'](_0x30a174[_0xb4b6('0x21')],function(_0x371ee1){return{'model':db[_0x371ee1[_0xb4b6('0x23')]],'as':_0x371ee1['as'],'attributes':_0x371ee1[_0xb4b6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb4b6('0x10')](function(_0x346bf2){logger['info']('ShowWhatsappAccount',_0x33340b);logger[_0xb4b6('0x24')](_0xb4b6('0x1a'),_0x33340b,JSON[_0xb4b6('0x25')](_0x346bf2));_0x5dd079(_0x346bf2);})[_0xb4b6('0x19')](function(_0x4c3103){logger[_0xb4b6('0x15')](_0xb4b6('0x1a'),_0x4c3103[_0xb4b6('0x17')],_0x33340b);_0x3237b8(_0x28762a[_0xb4b6('0x15')](0x1f4,_0x4c3103[_0xb4b6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index ccae759..cdf5bca 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 _0x5e5c=['whatsappAccount:','./whatsappAccount.events','remove','update','emit','removeListener','register'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x5e5c,0x120));var _0xc5e5=function(_0x4206c0,_0x2c516f){_0x4206c0=_0x4206c0-0x0;var _0x333f13=_0x5e5c[_0x4206c0];return _0x333f13;};'use strict';var WhatsappAccountEvents=require(_0xc5e5('0x0'));var events=['save',_0xc5e5('0x1'),_0xc5e5('0x2')];function createListener(_0x59aa07,_0x2dc1c7){return function(_0xf3a937){_0x2dc1c7[_0xc5e5('0x3')](_0x59aa07,_0xf3a937);};}function removeListener(_0xb28b7b,_0x43b147){return function(){WhatsappAccountEvents[_0xc5e5('0x4')](_0xb28b7b,_0x43b147);};}exports[_0xc5e5('0x5')]=function(_0x3665c0){for(var _0x5915b2=0x0,_0x4fa8f5=events['length'];_0x5915b2<_0x4fa8f5;_0x5915b2++){var _0x43b269=events[_0x5915b2];var _0x55354e=createListener(_0xc5e5('0x6')+_0x43b269,_0x3665c0);WhatsappAccountEvents['on'](_0x43b269,_0x55354e);}}; \ No newline at end of file +var _0x6ecb=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','update'];(function(_0x129707,_0x57db00){var _0x35c3a4=function(_0x3b8bdb){while(--_0x3b8bdb){_0x129707['push'](_0x129707['shift']());}};_0x35c3a4(++_0x57db00);}(_0x6ecb,0x10f));var _0xb6ec=function(_0x179ba4,_0x465ced){_0x179ba4=_0x179ba4-0x0;var _0x425bcd=_0x6ecb[_0x179ba4];return _0x425bcd;};'use strict';var WhatsappAccountEvents=require(_0xb6ec('0x0'));var events=['save','remove',_0xb6ec('0x1')];function createListener(_0x7874e3,_0x5a2239){return function(_0x27dd6e){_0x5a2239[_0xb6ec('0x2')](_0x7874e3,_0x27dd6e);};}function removeListener(_0x214a95,_0x109c01){return function(){WhatsappAccountEvents[_0xb6ec('0x3')](_0x214a95,_0x109c01);};}exports[_0xb6ec('0x4')]=function(_0x3683a7){for(var _0x38d234=0x0,_0x4e2d94=events[_0xb6ec('0x5')];_0x38d234<_0x4e2d94;_0x38d234++){var _0x34ca26=events[_0x38d234];var _0x4590ef=createListener(_0xb6ec('0x6')+_0x34ca26,_0x3683a7);WhatsappAccountEvents['on'](_0x34ca26,_0x4590ef);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1b2274b..6cce5b9 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 _0xf9d5=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x11df9b,_0x37337c){var _0x327ace=function(_0x5920ad){while(--_0x5920ad){_0x11df9b['push'](_0x11df9b['shift']());}};_0x327ace(++_0x37337c);}(_0xf9d5,0x98));var _0x5f9d=function(_0x87b5a7,_0x12ce28){_0x87b5a7=_0x87b5a7-0x0;var _0x475cc4=_0xf9d5[_0x87b5a7];return _0x475cc4;};'use strict';var multer=require(_0x5f9d('0x0'));var util=require(_0x5f9d('0x1'));var path=require('path');var timeout=require(_0x5f9d('0x2'));var express=require(_0x5f9d('0x3'));var router=express[_0x5f9d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5f9d('0x5'));var interaction=require(_0x5f9d('0x6'));var config=require(_0x5f9d('0x7'));var controller=require(_0x5f9d('0x8'));router[_0x5f9d('0x9')]('/',auth[_0x5f9d('0xa')](),controller[_0x5f9d('0xb')]);router[_0x5f9d('0x9')](_0x5f9d('0xc'),auth[_0x5f9d('0xa')](),controller[_0x5f9d('0xd')]);router[_0x5f9d('0xe')]('/',auth[_0x5f9d('0xa')](),controller[_0x5f9d('0xf')]);router[_0x5f9d('0x10')](_0x5f9d('0xc'),auth['isAuthenticated'](),controller[_0x5f9d('0x11')]);router[_0x5f9d('0x12')](_0x5f9d('0xc'),auth[_0x5f9d('0xa')](),controller[_0x5f9d('0x13')]);module[_0x5f9d('0x14')]=router; \ No newline at end of file +var _0xd06d=['multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','exports'];(function(_0x20b7c2,_0x3ba1d6){var _0x250e55=function(_0x5acf8b){while(--_0x5acf8b){_0x20b7c2['push'](_0x20b7c2['shift']());}};_0x250e55(++_0x3ba1d6);}(_0xd06d,0x77));var _0xdd06=function(_0x1efb4a,_0x46acc8){_0x1efb4a=_0x1efb4a-0x0;var _0x30c4b9=_0xd06d[_0x1efb4a];return _0x30c4b9;};'use strict';var multer=require(_0xdd06('0x0'));var util=require('util');var path=require(_0xdd06('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd06('0x2'));var router=express[_0xdd06('0x3')]();var fs_extra=require(_0xdd06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdd06('0x5'));var config=require(_0xdd06('0x6'));var controller=require(_0xdd06('0x7'));router[_0xdd06('0x8')]('/',auth[_0xdd06('0x9')](),controller[_0xdd06('0xa')]);router[_0xdd06('0x8')](_0xdd06('0xb'),auth[_0xdd06('0x9')](),controller[_0xdd06('0xc')]);router['post']('/',auth[_0xdd06('0x9')](),controller['create']);router[_0xdd06('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xdd06('0xe')]);router['delete']('/:id',auth[_0xdd06('0x9')](),controller[_0xdd06('0xf')]);module[_0xdd06('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ba932de..85b30b9 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 _0xa660=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x1499ab,_0x4e5d6c){var _0x3b3f69=function(_0x2aded3){while(--_0x2aded3){_0x1499ab['push'](_0x1499ab['shift']());}};_0x3b3f69(++_0x4e5d6c);}(_0xa660,0xa9));var _0x0a66=function(_0x3e7723,_0x4d1141){_0x3e7723=_0x3e7723-0x0;var _0x58685e=_0xa660[_0x3e7723];return _0x58685e;};'use strict';var Sequelize=require(_0x0a66('0x0'));module[_0x0a66('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0a66('0x2')],'allowNull':![],'defaultValue':_0x0a66('0x3')},'appdata':{'type':Sequelize[_0x0a66('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a66('0x2')],'defaultValue':_0x0a66('0x5')}}; \ No newline at end of file +var _0xf9a5=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x26c1e1,_0x239683){var _0x7e36a6=function(_0xb74b18){while(--_0xb74b18){_0x26c1e1['push'](_0x26c1e1['shift']());}};_0x7e36a6(++_0x239683);}(_0xf9a5,0x1a9));var _0x5f9a=function(_0x2cb2f5,_0x3c311b){_0x2cb2f5=_0x2cb2f5-0x0;var _0x5d9a17=_0xf9a5[_0x2cb2f5];return _0x5d9a17;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x5f9a('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x5f9a('0x1')],'allowNull':![],'defaultValue':_0x5f9a('0x2')},'appdata':{'type':Sequelize[_0x5f9a('0x3')]()},'description':{'type':Sequelize[_0x5f9a('0x1')]},'interval':{'type':Sequelize[_0x5f9a('0x1')],'defaultValue':_0x5f9a('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7d8e8b9..411f49c 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 _0xe3b3=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','length','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2422e9,_0x3968f7){var _0x487769=function(_0x273ef){while(--_0x273ef){_0x2422e9['push'](_0x2422e9['shift']());}};_0x487769(++_0x3968f7);}(_0xe3b3,0x1b3));var _0x3e3b=function(_0x24aa6b,_0x4c78d9){_0x24aa6b=_0x24aa6b-0x0;var _0x35d271=_0xe3b3[_0x24aa6b];return _0x35d271;};'use strict';var emlformat=require(_0x3e3b('0x0'));var rimraf=require(_0x3e3b('0x1'));var zipdir=require(_0x3e3b('0x2'));var jsonpatch=require(_0x3e3b('0x3'));var rp=require(_0x3e3b('0x4'));var moment=require(_0x3e3b('0x5'));var BPromise=require(_0x3e3b('0x6'));var Mustache=require(_0x3e3b('0x7'));var util=require(_0x3e3b('0x8'));var path=require(_0x3e3b('0x9'));var sox=require('sox');var csv=require(_0x3e3b('0xa'));var ejs=require(_0x3e3b('0xb'));var fs=require('fs');var fs_extra=require(_0x3e3b('0xc'));var _=require('lodash');var squel=require(_0x3e3b('0xd'));var crypto=require(_0x3e3b('0xe'));var jsforce=require(_0x3e3b('0xf'));var deskjs=require(_0x3e3b('0x10'));var toCsv=require(_0x3e3b('0xa'));var querystring=require(_0x3e3b('0x11'));var Papa=require(_0x3e3b('0x12'));var Redis=require(_0x3e3b('0x13'));var authService=require(_0x3e3b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3e3b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e3b('0x16'))(_0x3e3b('0x17'));var utils=require(_0x3e3b('0x18'));var config=require(_0x3e3b('0x19'));var licenseUtil=require(_0x3e3b('0x1a'));var db=require(_0x3e3b('0x1b'))['db'];function respondWithStatusCode(_0x1ae7a6,_0x471a74){_0x471a74=_0x471a74||0xcc;return function(_0x107dce){if(_0x107dce){return _0x1ae7a6[_0x3e3b('0x1c')](_0x471a74);}return _0x1ae7a6[_0x3e3b('0x1d')](_0x471a74)[_0x3e3b('0x1e')]();};}function respondWithResult(_0x19878a,_0x1cc39f){_0x1cc39f=_0x1cc39f||0xc8;return function(_0x43eb3a){if(_0x43eb3a){return _0x19878a[_0x3e3b('0x1d')](_0x1cc39f)[_0x3e3b('0x1f')](_0x43eb3a);}};}function respondWithFilteredResult(_0x4fffd3,_0x2a6d19){return function(_0x537e66){if(_0x537e66){var _0x45f5d5=typeof _0x2a6d19[_0x3e3b('0x20')]===_0x3e3b('0x21')&&typeof _0x2a6d19['limit']==='undefined';var _0x5f4e5d=_0x537e66[_0x3e3b('0x22')];var _0x3c9829=_0x45f5d5?0x0:_0x2a6d19[_0x3e3b('0x20')];var _0x35fc4e=_0x45f5d5?_0x537e66[_0x3e3b('0x22')]:_0x2a6d19[_0x3e3b('0x20')]+_0x2a6d19[_0x3e3b('0x23')];var _0x42d031;if(_0x35fc4e>=_0x5f4e5d){_0x35fc4e=_0x5f4e5d;_0x42d031=0xc8;}else{_0x42d031=0xce;}_0x4fffd3['status'](_0x42d031);return _0x4fffd3[_0x3e3b('0x24')]('Content-Range',_0x3c9829+'-'+_0x35fc4e+'/'+_0x5f4e5d)[_0x3e3b('0x1f')](_0x537e66);}return null;};}function patchUpdates(_0x1eb56f){return function(_0x1a096a){try{jsonpatch[_0x3e3b('0x25')](_0x1a096a,_0x1eb56f,!![]);}catch(_0x5a40fe){return BPromise[_0x3e3b('0x26')](_0x5a40fe);}return _0x1a096a[_0x3e3b('0x27')]();};}function saveUpdates(_0x567443,_0x1af87e){return function(_0xc1b47a){if(_0xc1b47a){return _0xc1b47a['update'](_0x567443)['then'](function(_0x5cba48){return _0x5cba48;});}return null;};}function removeEntity(_0x47660d,_0x1334df){return function(_0x15ec1c){if(_0x15ec1c){return _0x15ec1c[_0x3e3b('0x28')]()[_0x3e3b('0x29')](function(){_0x47660d[_0x3e3b('0x1d')](0xcc)[_0x3e3b('0x1e')]();});}};}function handleEntityNotFound(_0x2903aa,_0x1ab037){return function(_0x452be0){if(!_0x452be0){_0x2903aa[_0x3e3b('0x1c')](0x194);}return _0x452be0;};}function handleError(_0x29af34,_0x1ff8c0){_0x1ff8c0=_0x1ff8c0||0x1f4;return function(_0x7da1af){logger[_0x3e3b('0x2a')](_0x7da1af['stack']);if(_0x7da1af[_0x3e3b('0x2b')]){delete _0x7da1af[_0x3e3b('0x2b')];}_0x29af34[_0x3e3b('0x1d')](_0x1ff8c0)['send'](_0x7da1af);};}exports[_0x3e3b('0x2c')]=function(_0x59b061,_0x4588cd){var _0x4bb59f={},_0x5922bb={},_0xc15d5b={'count':0x0,'rows':[]};var _0x3262a4=_[_0x3e3b('0x2d')](db['WhatsappApplication'][_0x3e3b('0x2e')],function(_0x6ad43e){return{'name':_0x6ad43e['fieldName'],'type':_0x6ad43e[_0x3e3b('0x2f')][_0x3e3b('0x30')]};});_0x5922bb[_0x3e3b('0x31')]=_[_0x3e3b('0x2d')](_0x3262a4,'name');_0x5922bb[_0x3e3b('0x32')]=_[_0x3e3b('0x33')](_0x59b061[_0x3e3b('0x32')]);_0x5922bb[_0x3e3b('0x34')]=_[_0x3e3b('0x35')](_0x5922bb['model'],_0x5922bb[_0x3e3b('0x32')]);_0x4bb59f['attributes']=_[_0x3e3b('0x35')](_0x5922bb[_0x3e3b('0x31')],qs['fields'](_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x36')]));_0x4bb59f['attributes']=_0x4bb59f[_0x3e3b('0x37')]['length']?_0x4bb59f[_0x3e3b('0x37')]:_0x5922bb[_0x3e3b('0x31')];if(!_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x38')](_0x3e3b('0x39'))){_0x4bb59f[_0x3e3b('0x23')]=qs[_0x3e3b('0x23')](_0x59b061[_0x3e3b('0x32')]['limit']);_0x4bb59f[_0x3e3b('0x20')]=qs[_0x3e3b('0x20')](_0x59b061[_0x3e3b('0x32')]['offset']);}_0x4bb59f['order']=qs[_0x3e3b('0x3a')](_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x3a')]);_0x4bb59f[_0x3e3b('0x3b')]=qs[_0x3e3b('0x34')](_[_0x3e3b('0x3c')](_0x59b061[_0x3e3b('0x32')],_0x5922bb[_0x3e3b('0x34')]),_0x3262a4);if(_0x59b061[_0x3e3b('0x32')]['filter']){_0x4bb59f[_0x3e3b('0x3b')]=_['merge'](_0x4bb59f[_0x3e3b('0x3b')],{'$or':_[_0x3e3b('0x2d')](_0x3262a4,function(_0x120844){if(_0x120844[_0x3e3b('0x2f')]!=='VIRTUAL'){var _0x2a48cb={};_0x2a48cb[_0x120844[_0x3e3b('0x2b')]]={'$like':'%'+_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x3d')]+'%'};return _0x2a48cb;}})});}_0x4bb59f=_[_0x3e3b('0x3e')]({},_0x4bb59f,_0x59b061[_0x3e3b('0x3f')]);var _0x7a539e={'where':_0x4bb59f[_0x3e3b('0x3b')]};return db[_0x3e3b('0x40')]['count'](_0x7a539e)['then'](function(_0x460f33){_0xc15d5b[_0x3e3b('0x22')]=_0x460f33;if(_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x41')]){_0x4bb59f[_0x3e3b('0x42')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x3e3b('0x43')](_0x4bb59f);})[_0x3e3b('0x29')](function(_0x3e36e2){_0xc15d5b[_0x3e3b('0x44')]=_0x3e36e2;return _0xc15d5b;})[_0x3e3b('0x29')](respondWithFilteredResult(_0x4588cd,_0x4bb59f))[_0x3e3b('0x45')](handleError(_0x4588cd,null));};exports[_0x3e3b('0x46')]=function(_0x2ab6df,_0x1b032a){var _0xba3b07={'raw':!![],'where':{'id':_0x2ab6df[_0x3e3b('0x47')]['id']}},_0x3093f5={};_0x3093f5[_0x3e3b('0x31')]=_[_0x3e3b('0x33')](db[_0x3e3b('0x40')][_0x3e3b('0x2e')]);_0x3093f5[_0x3e3b('0x32')]=_['keys'](_0x2ab6df[_0x3e3b('0x32')]);_0x3093f5[_0x3e3b('0x34')]=_[_0x3e3b('0x35')](_0x3093f5[_0x3e3b('0x31')],_0x3093f5[_0x3e3b('0x32')]);_0xba3b07[_0x3e3b('0x37')]=_[_0x3e3b('0x35')](_0x3093f5['model'],qs[_0x3e3b('0x36')](_0x2ab6df['query'][_0x3e3b('0x36')]));_0xba3b07['attributes']=_0xba3b07[_0x3e3b('0x37')][_0x3e3b('0x48')]?_0xba3b07[_0x3e3b('0x37')]:_0x3093f5[_0x3e3b('0x31')];if(_0x2ab6df[_0x3e3b('0x32')][_0x3e3b('0x41')]){_0xba3b07['include']=[{'all':!![]}];}_0xba3b07=_[_0x3e3b('0x3e')]({},_0xba3b07,_0x2ab6df[_0x3e3b('0x3f')]);return db[_0x3e3b('0x40')]['find'](_0xba3b07)[_0x3e3b('0x29')](handleEntityNotFound(_0x1b032a,null))['then'](respondWithResult(_0x1b032a,null))[_0x3e3b('0x45')](handleError(_0x1b032a,null));};exports['create']=function(_0x429393,_0x81e619){return db[_0x3e3b('0x40')]['create'](_0x429393['body'],{})[_0x3e3b('0x29')](respondWithResult(_0x81e619,0xc9))[_0x3e3b('0x45')](handleError(_0x81e619,null));};exports[_0x3e3b('0x49')]=function(_0x333070,_0x947564){if(_0x333070[_0x3e3b('0x4a')]['id']){delete _0x333070[_0x3e3b('0x4a')]['id'];}return db[_0x3e3b('0x40')][_0x3e3b('0x4b')]({'where':{'id':_0x333070['params']['id']}})[_0x3e3b('0x29')](handleEntityNotFound(_0x947564,null))['then'](saveUpdates(_0x333070[_0x3e3b('0x4a')],null))[_0x3e3b('0x29')](respondWithResult(_0x947564,null))['catch'](handleError(_0x947564,null));};exports['destroy']=function(_0x5616fe,_0x40564d){return db[_0x3e3b('0x40')]['find']({'where':{'id':_0x5616fe[_0x3e3b('0x47')]['id']}})['then'](handleEntityNotFound(_0x40564d,null))[_0x3e3b('0x29')](removeEntity(_0x40564d,null))[_0x3e3b('0x45')](handleError(_0x40564d,null));}; \ No newline at end of file +var _0xb0ee=['create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','sendStatus','error','name','send','index','map','WhatsappApplication','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find'];(function(_0x290fe7,_0x5eaa0d){var _0x452d85=function(_0x7ad08b){while(--_0x7ad08b){_0x290fe7['push'](_0x290fe7['shift']());}};_0x452d85(++_0x5eaa0d);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xb0ee[_0x3070dc];return _0x431489;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb0e('0x0'));var zipdir=require(_0xeb0e('0x1'));var jsonpatch=require(_0xeb0e('0x2'));var rp=require(_0xeb0e('0x3'));var moment=require(_0xeb0e('0x4'));var BPromise=require(_0xeb0e('0x5'));var Mustache=require(_0xeb0e('0x6'));var util=require(_0xeb0e('0x7'));var path=require(_0xeb0e('0x8'));var sox=require(_0xeb0e('0x9'));var csv=require('to-csv');var ejs=require(_0xeb0e('0xa'));var fs=require('fs');var fs_extra=require(_0xeb0e('0xb'));var _=require(_0xeb0e('0xc'));var squel=require(_0xeb0e('0xd'));var crypto=require('crypto');var jsforce=require(_0xeb0e('0xe'));var deskjs=require(_0xeb0e('0xf'));var toCsv=require(_0xeb0e('0x10'));var querystring=require(_0xeb0e('0x11'));var Papa=require(_0xeb0e('0x12'));var Redis=require(_0xeb0e('0x13'));var authService=require(_0xeb0e('0x14'));var qs=require(_0xeb0e('0x15'));var as=require(_0xeb0e('0x16'));var hardwareService=require(_0xeb0e('0x17'));var logger=require(_0xeb0e('0x18'))(_0xeb0e('0x19'));var utils=require(_0xeb0e('0x1a'));var config=require(_0xeb0e('0x1b'));var licenseUtil=require(_0xeb0e('0x1c'));var db=require(_0xeb0e('0x1d'))['db'];function respondWithStatusCode(_0x66645d,_0xe9c47e){_0xe9c47e=_0xe9c47e||0xcc;return function(_0x534f2b){if(_0x534f2b){return _0x66645d['sendStatus'](_0xe9c47e);}return _0x66645d[_0xeb0e('0x1e')](_0xe9c47e)['end']();};}function respondWithResult(_0x54f816,_0xb50950){_0xb50950=_0xb50950||0xc8;return function(_0x105f77){if(_0x105f77){return _0x54f816[_0xeb0e('0x1e')](_0xb50950)[_0xeb0e('0x1f')](_0x105f77);}};}function respondWithFilteredResult(_0x4c4ebe,_0xc6e6c1){return function(_0x10c2b0){if(_0x10c2b0){var _0x5ca0c3=typeof _0xc6e6c1[_0xeb0e('0x20')]===_0xeb0e('0x21')&&typeof _0xc6e6c1[_0xeb0e('0x22')]===_0xeb0e('0x21');var _0x2d9e6a=_0x10c2b0[_0xeb0e('0x23')];var _0x2c78aa=_0x5ca0c3?0x0:_0xc6e6c1['offset'];var _0x1396a4=_0x5ca0c3?_0x10c2b0[_0xeb0e('0x23')]:_0xc6e6c1[_0xeb0e('0x20')]+_0xc6e6c1[_0xeb0e('0x22')];var _0x34929d;if(_0x1396a4>=_0x2d9e6a){_0x1396a4=_0x2d9e6a;_0x34929d=0xc8;}else{_0x34929d=0xce;}_0x4c4ebe[_0xeb0e('0x1e')](_0x34929d);return _0x4c4ebe[_0xeb0e('0x24')](_0xeb0e('0x25'),_0x2c78aa+'-'+_0x1396a4+'/'+_0x2d9e6a)['json'](_0x10c2b0);}return null;};}function patchUpdates(_0x2f0e1b){return function(_0x1359ed){try{jsonpatch['apply'](_0x1359ed,_0x2f0e1b,!![]);}catch(_0x5268c3){return BPromise[_0xeb0e('0x26')](_0x5268c3);}return _0x1359ed[_0xeb0e('0x27')]();};}function saveUpdates(_0x4a858c,_0xd6ad44){return function(_0x346fa8){if(_0x346fa8){return _0x346fa8['update'](_0x4a858c)[_0xeb0e('0x28')](function(_0x5db5e2){return _0x5db5e2;});}return null;};}function removeEntity(_0x52fd0f,_0x582a90){return function(_0x164691){if(_0x164691){return _0x164691['destroy']()[_0xeb0e('0x28')](function(){_0x52fd0f[_0xeb0e('0x1e')](0xcc)[_0xeb0e('0x29')]();});}};}function handleEntityNotFound(_0x1849d5,_0x71156c){return function(_0x12a73a){if(!_0x12a73a){_0x1849d5[_0xeb0e('0x2a')](0x194);}return _0x12a73a;};}function handleError(_0x5e4983,_0x5e69a8){_0x5e69a8=_0x5e69a8||0x1f4;return function(_0x27267d){logger[_0xeb0e('0x2b')](_0x27267d['stack']);if(_0x27267d[_0xeb0e('0x2c')]){delete _0x27267d[_0xeb0e('0x2c')];}_0x5e4983[_0xeb0e('0x1e')](_0x5e69a8)[_0xeb0e('0x2d')](_0x27267d);};}exports[_0xeb0e('0x2e')]=function(_0x78f52f,_0xfe0f73){var _0x334f51={},_0x4d23a3={},_0x967750={'count':0x0,'rows':[]};var _0x2ecde5=_[_0xeb0e('0x2f')](db[_0xeb0e('0x30')]['rawAttributes'],function(_0x4ca663){return{'name':_0x4ca663[_0xeb0e('0x31')],'type':_0x4ca663['type'][_0xeb0e('0x32')]};});_0x4d23a3[_0xeb0e('0x33')]=_[_0xeb0e('0x2f')](_0x2ecde5,_0xeb0e('0x2c'));_0x4d23a3[_0xeb0e('0x34')]=_[_0xeb0e('0x35')](_0x78f52f['query']);_0x4d23a3[_0xeb0e('0x36')]=_['intersection'](_0x4d23a3[_0xeb0e('0x33')],_0x4d23a3[_0xeb0e('0x34')]);_0x334f51['attributes']=_['intersection'](_0x4d23a3[_0xeb0e('0x33')],qs[_0xeb0e('0x37')](_0x78f52f[_0xeb0e('0x34')]['fields']));_0x334f51[_0xeb0e('0x38')]=_0x334f51[_0xeb0e('0x38')][_0xeb0e('0x39')]?_0x334f51[_0xeb0e('0x38')]:_0x4d23a3['model'];if(!_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x3a')](_0xeb0e('0x3b'))){_0x334f51[_0xeb0e('0x22')]=qs[_0xeb0e('0x22')](_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x22')]);_0x334f51[_0xeb0e('0x20')]=qs['offset'](_0x78f52f['query'][_0xeb0e('0x20')]);}_0x334f51['order']=qs[_0xeb0e('0x3c')](_0x78f52f[_0xeb0e('0x34')]['sort']);_0x334f51[_0xeb0e('0x3d')]=qs[_0xeb0e('0x36')](_['pick'](_0x78f52f['query'],_0x4d23a3[_0xeb0e('0x36')]),_0x2ecde5);if(_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x3e')]){_0x334f51[_0xeb0e('0x3d')]=_['merge'](_0x334f51[_0xeb0e('0x3d')],{'$or':_['map'](_0x2ecde5,function(_0x2691bf){if(_0x2691bf[_0xeb0e('0x3f')]!==_0xeb0e('0x40')){var _0x29fc4d={};_0x29fc4d[_0x2691bf[_0xeb0e('0x2c')]]={'$like':'%'+_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x3e')]+'%'};return _0x29fc4d;}})});}_0x334f51=_[_0xeb0e('0x41')]({},_0x334f51,_0x78f52f[_0xeb0e('0x42')]);var _0x1c5f18={'where':_0x334f51[_0xeb0e('0x3d')]};return db[_0xeb0e('0x30')][_0xeb0e('0x23')](_0x1c5f18)[_0xeb0e('0x28')](function(_0x1de195){_0x967750[_0xeb0e('0x23')]=_0x1de195;if(_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x43')]){_0x334f51[_0xeb0e('0x44')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xeb0e('0x45')](_0x334f51);})['then'](function(_0xf0256){_0x967750[_0xeb0e('0x46')]=_0xf0256;return _0x967750;})['then'](respondWithFilteredResult(_0xfe0f73,_0x334f51))[_0xeb0e('0x47')](handleError(_0xfe0f73,null));};exports['show']=function(_0x4183b4,_0x184ab3){var _0x30ec38={'raw':!![],'where':{'id':_0x4183b4[_0xeb0e('0x48')]['id']}},_0x5c37e0={};_0x5c37e0[_0xeb0e('0x33')]=_[_0xeb0e('0x35')](db[_0xeb0e('0x30')]['rawAttributes']);_0x5c37e0[_0xeb0e('0x34')]=_[_0xeb0e('0x35')](_0x4183b4[_0xeb0e('0x34')]);_0x5c37e0[_0xeb0e('0x36')]=_[_0xeb0e('0x49')](_0x5c37e0[_0xeb0e('0x33')],_0x5c37e0['query']);_0x30ec38[_0xeb0e('0x38')]=_[_0xeb0e('0x49')](_0x5c37e0[_0xeb0e('0x33')],qs[_0xeb0e('0x37')](_0x4183b4[_0xeb0e('0x34')][_0xeb0e('0x37')]));_0x30ec38[_0xeb0e('0x38')]=_0x30ec38['attributes']['length']?_0x30ec38[_0xeb0e('0x38')]:_0x5c37e0[_0xeb0e('0x33')];if(_0x4183b4[_0xeb0e('0x34')][_0xeb0e('0x43')]){_0x30ec38[_0xeb0e('0x44')]=[{'all':!![]}];}_0x30ec38=_[_0xeb0e('0x41')]({},_0x30ec38,_0x4183b4['options']);return db[_0xeb0e('0x30')][_0xeb0e('0x4a')](_0x30ec38)[_0xeb0e('0x28')](handleEntityNotFound(_0x184ab3,null))[_0xeb0e('0x28')](respondWithResult(_0x184ab3,null))[_0xeb0e('0x47')](handleError(_0x184ab3,null));};exports['create']=function(_0x455445,_0x852d66){return db[_0xeb0e('0x30')][_0xeb0e('0x4b')](_0x455445[_0xeb0e('0x4c')],{})[_0xeb0e('0x28')](respondWithResult(_0x852d66,0xc9))['catch'](handleError(_0x852d66,null));};exports[_0xeb0e('0x4d')]=function(_0x513320,_0x109ad5){if(_0x513320[_0xeb0e('0x4c')]['id']){delete _0x513320[_0xeb0e('0x4c')]['id'];}return db['WhatsappApplication'][_0xeb0e('0x4a')]({'where':{'id':_0x513320[_0xeb0e('0x48')]['id']}})['then'](handleEntityNotFound(_0x109ad5,null))[_0xeb0e('0x28')](saveUpdates(_0x513320['body'],null))['then'](respondWithResult(_0x109ad5,null))['catch'](handleError(_0x109ad5,null));};exports[_0xeb0e('0x4e')]=function(_0x2e7962,_0xb688c){return db[_0xeb0e('0x30')][_0xeb0e('0x4a')]({'where':{'id':_0x2e7962['params']['id']}})[_0xeb0e('0x28')](handleEntityNotFound(_0xb688c,null))['then'](removeEntity(_0xb688c,null))[_0xeb0e('0x47')](handleError(_0xb688c,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5347ee4..d291db0 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 _0xdab2=['WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x33ad58,_0x283986){var _0x43c1fe=function(_0x4d12fc){while(--_0x4d12fc){_0x33ad58['push'](_0x33ad58['shift']());}};_0x43c1fe(++_0x283986);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require('../../config/logger')(_0x2dab('0x2'));var moment=require(_0x2dab('0x3'));var BPromise=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var attributes=require(_0x2dab('0x8'));module[_0x2dab('0x9')]=function(_0x4562bb,_0x1421d5){return _0x4562bb[_0x2dab('0xa')](_0x2dab('0xb'),attributes,{'tableName':_0x2dab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2dab('0xd'),'collate':_0x2dab('0xe')});}; \ No newline at end of file +var _0xed95=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xed95,0xb9));var _0x5ed9=function(_0x21bf41,_0x24897c){_0x21bf41=_0x21bf41-0x0;var _0x52d642=_0xed95[_0x21bf41];return _0x52d642;};'use strict';var _=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var logger=require(_0x5ed9('0x2'))(_0x5ed9('0x3'));var moment=require(_0x5ed9('0x4'));var BPromise=require(_0x5ed9('0x5'));var rp=require(_0x5ed9('0x6'));var fs=require('fs');var path=require(_0x5ed9('0x7'));var rimraf=require(_0x5ed9('0x8'));var config=require(_0x5ed9('0x9'));var attributes=require(_0x5ed9('0xa'));module[_0x5ed9('0xb')]=function(_0x52a57d,_0x48efa8){return _0x52a57d[_0x5ed9('0xc')](_0x5ed9('0xd'),attributes,{'tableName':_0x5ed9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ed9('0xf'),'collate':_0x5ed9('0x10')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 50712f0..a549dcc 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 _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x138d72,_0x461845){var _0x14e386=function(_0x4986b3){while(--_0x4986b3){_0x138d72['push'](_0x138d72['shift']());}};_0x14e386(++_0x461845);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2eeae1,_0x68f176){_0x2eeae1=_0x2eeae1-0x0;var _0x486565=_0xa8a8[_0x2eeae1];return _0x486565;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x149be8,_0xed878e){var _0x46d63a=function(_0x247213){while(--_0x247213){_0x149be8['push'](_0x149be8['shift']());}};_0x46d63a(++_0xed878e);}(_0x55ca,0x126));var _0xa55c=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x55ca[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 55bc765..b5cb8ac 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 _0x71ab=['destroy','delete','removeTags','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy'];(function(_0x349edb,_0x2fc4b1){var _0x517f7e=function(_0x57397f){while(--_0x57397f){_0x349edb['push'](_0x349edb['shift']());}};_0x517f7e(++_0x2fc4b1);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')]('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0xa')]);router[_0xb71a('0x8')](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xc')]);router[_0xb71a('0x8')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xe')]);router[_0xb71a('0x8')]('/:id/messages',auth[_0xb71a('0x9')](),controller['getMessages']);router[_0xb71a('0x8')](_0xb71a('0xf'),auth[_0xb71a('0x9')](),controller['download']);router[_0xb71a('0x10')]('/',auth['isAuthenticated'](),controller[_0xb71a('0x11')]);router['post']('/:id/messages',auth[_0xb71a('0x9')](),controller[_0xb71a('0x12')]);router[_0xb71a('0x10')](_0xb71a('0x13'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xb71a('0x14')),controller[_0xb71a('0x15')]);router[_0xb71a('0x16')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),interaction[_0xb71a('0x17')](_0xb71a('0x18'),_0xb71a('0x19')),controller[_0xb71a('0x1a')]);router['delete'](_0xb71a('0xd'),auth[_0xb71a('0x9')](),interaction[_0xb71a('0x17')](_0xb71a('0x18'),_0xb71a('0x1b')),controller[_0xb71a('0x1c')]);router[_0xb71a('0x1d')](_0xb71a('0x13'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x1e')]);module[_0xb71a('0x1f')]=router; \ No newline at end of file +var _0x5fab=['/:id/messages','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create'];(function(_0x7c572c,_0x9c647f){var _0x518768=function(_0xba2043){while(--_0xba2043){_0x7c572c['push'](_0x7c572c['shift']());}};_0x518768(++_0x9c647f);}(_0x5fab,0x177));var _0xb5fa=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0x5fab[_0x57e18a];return _0x1181c7;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/messages',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')]('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);router['post'](_0xb5fa('0x15'),auth[_0xb5fa('0xb')](),controller['addMessage']);router[_0xb5fa('0x13')]('/:id/tags',auth[_0xb5fa('0xb')](),interaction[_0xb5fa('0x16')](_0xb5fa('0x17'),_0xb5fa('0x18')),controller[_0xb5fa('0x19')]);router['put']('/:id',auth[_0xb5fa('0xb')](),interaction[_0xb5fa('0x16')](_0xb5fa('0x17'),_0xb5fa('0x1a')),controller['update']);router['delete'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),interaction[_0xb5fa('0x16')](_0xb5fa('0x17'),_0xb5fa('0x1b')),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1d')](_0xb5fa('0x1e'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);module[_0xb5fa('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 281ea09..0336d37 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 _0x90b5=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x454bf9,_0x3e367e){var _0x5be2b3=function(_0x395c10){while(--_0x395c10){_0x454bf9['push'](_0x454bf9['shift']());}};_0x5be2b3(++_0x3e367e);}(_0x90b5,0x139));var _0x590b=function(_0x28f61e,_0x9cb8c4){_0x28f61e=_0x28f61e-0x0;var _0x4399b8=_0x90b5[_0x28f61e];return _0x4399b8;};'use strict';var Sequelize=require(_0x590b('0x0'));var moment=require('moment');module[_0x590b('0x1')]={'closed':{'type':Sequelize[_0x590b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x590b('0x3')]},'disposition':{'type':Sequelize[_0x590b('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x590b('0x4')]},'phone':{'type':Sequelize[_0x590b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x590b('0x5')]('in',_0x590b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x590b('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x590b('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x590b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf9d5=['out','ENUM','moment','exports','DATE','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf9d5,0x122));var _0x5f9d=function(_0x1c5937,_0x2bbd17){_0x1c5937=_0x1c5937-0x0;var _0x3e53eb=_0xf9d5[_0x1c5937];return _0x3e53eb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5f9d('0x0'));module[_0x5f9d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5f9d('0x2')]},'disposition':{'type':Sequelize[_0x5f9d('0x3')]},'secondDisposition':{'type':Sequelize[_0x5f9d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5f9d('0x3')]},'note':{'type':Sequelize[_0x5f9d('0x3')]},'phone':{'type':Sequelize[_0x5f9d('0x3')]},'read1stAt':{'type':Sequelize[_0x5f9d('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5f9d('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5f9d('0x5')]('in',_0x5f9d('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 624308a..3a9fcc1 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 _0x2b37=['addMessage','WhatsappMessage','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','ids','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','fullname','CmContact','Attachment','Messages','createdAt','WhatsappAccount','get','mkdirSync','Whatsapp','Account','Owner','N.A.','closed','disposition','basename','createReadStream','pipe','createWriteStream','direction','out','System','lastName','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','index','WhatsappInteraction','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','users','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','isEmpty','WhatsappAccountId','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','includeAll','include','catch','create','body','params','describe'];(function(_0x5b29d2,_0x4ea7a0){var _0x2810e9=function(_0x4c4ee2){while(--_0x4c4ee2){_0x5b29d2['push'](_0x5b29d2['shift']());}};_0x2810e9(++_0x4ea7a0);}(_0x2b37,0x12b));var _0x72b3=function(_0x394de2,_0x42e580){_0x394de2=_0x394de2-0x0;var _0x38f3b7=_0x2b37[_0x394de2];return _0x38f3b7;};'use strict';var emlformat=require(_0x72b3('0x0'));var rimraf=require(_0x72b3('0x1'));var zipdir=require(_0x72b3('0x2'));var jsonpatch=require(_0x72b3('0x3'));var rp=require(_0x72b3('0x4'));var moment=require(_0x72b3('0x5'));var BPromise=require(_0x72b3('0x6'));var Mustache=require(_0x72b3('0x7'));var util=require(_0x72b3('0x8'));var path=require(_0x72b3('0x9'));var sox=require('sox');var csv=require(_0x72b3('0xa'));var ejs=require(_0x72b3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72b3('0xc'));var squel=require(_0x72b3('0xd'));var crypto=require(_0x72b3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x72b3('0xf'));var toCsv=require(_0x72b3('0xa'));var querystring=require(_0x72b3('0x10'));var Papa=require('papaparse');var Redis=require(_0x72b3('0x11'));var authService=require(_0x72b3('0x12'));var qs=require(_0x72b3('0x13'));var as=require(_0x72b3('0x14'));var pdf=require(_0x72b3('0x15'));var hardwareService=require(_0x72b3('0x16'));var logger=require(_0x72b3('0x17'))('api');var utils=require(_0x72b3('0x18'));var config=require(_0x72b3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x72b3('0x1a'))['db'];config['redis']=_['defaults'](config[_0x72b3('0x1b')],{'host':_0x72b3('0x1c'),'port':0x18eb});var socket=require(_0x72b3('0x1d'))(new Redis(config[_0x72b3('0x1b')]));require(_0x72b3('0x1e'))[_0x72b3('0x1f')](socket);function respondWithStatusCode(_0x2e6893,_0x1b6a53){_0x1b6a53=_0x1b6a53||0xcc;return function(_0xced6a){if(_0xced6a){return _0x2e6893[_0x72b3('0x20')](_0x1b6a53);}return _0x2e6893[_0x72b3('0x21')](_0x1b6a53)['end']();};}function respondWithResult(_0xc466ac,_0x167c53){_0x167c53=_0x167c53||0xc8;return function(_0x2863e9){if(_0x2863e9){return _0xc466ac[_0x72b3('0x21')](_0x167c53)[_0x72b3('0x22')](_0x2863e9);}};}function respondWithFilteredResult(_0xd6133f,_0x1b6578){return function(_0x4e87d3){if(_0x4e87d3){var _0x9c95ab=typeof _0x1b6578[_0x72b3('0x23')]===_0x72b3('0x24')&&typeof _0x1b6578[_0x72b3('0x25')]===_0x72b3('0x24');var _0x29f004=_0x4e87d3['count'];var _0x3a914b=_0x9c95ab?0x0:_0x1b6578['offset'];var _0x9a086c=_0x9c95ab?_0x4e87d3[_0x72b3('0x26')]:_0x1b6578[_0x72b3('0x23')]+_0x1b6578[_0x72b3('0x25')];var _0x2aec47;if(_0x9a086c>=_0x29f004){_0x9a086c=_0x29f004;_0x2aec47=0xc8;}else{_0x2aec47=0xce;}_0xd6133f['status'](_0x2aec47);return _0xd6133f['set'](_0x72b3('0x27'),_0x3a914b+'-'+_0x9a086c+'/'+_0x29f004)[_0x72b3('0x22')](_0x4e87d3);}return null;};}function patchUpdates(_0x438443){return function(_0xba0d80){try{jsonpatch[_0x72b3('0x28')](_0xba0d80,_0x438443,!![]);}catch(_0x2e82a4){return BPromise[_0x72b3('0x29')](_0x2e82a4);}return _0xba0d80[_0x72b3('0x2a')]();};}function saveUpdates(_0x5007de,_0x59763b){return function(_0x3e92a0){if(_0x3e92a0){return _0x3e92a0[_0x72b3('0x2b')](_0x5007de)[_0x72b3('0x2c')](function(_0x46e584){return _0x46e584;});}return null;};}function removeEntity(_0x3df948,_0x5509ad){return function(_0x31553b){if(_0x31553b){return _0x31553b[_0x72b3('0x2d')]()['then'](function(){_0x3df948[_0x72b3('0x21')](0xcc)[_0x72b3('0x2e')]();});}};}function handleEntityNotFound(_0x44d3b2,_0x486c39){return function(_0x2a8198){if(!_0x2a8198){_0x44d3b2[_0x72b3('0x20')](0x194);}return _0x2a8198;};}function handleError(_0x209f10,_0x546dfd){_0x546dfd=_0x546dfd||0x1f4;return function(_0xfa238c){logger[_0x72b3('0x2f')](_0xfa238c[_0x72b3('0x30')]);if(_0xfa238c[_0x72b3('0x31')]){delete _0xfa238c[_0x72b3('0x31')];}_0x209f10[_0x72b3('0x21')](_0x546dfd)[_0x72b3('0x32')](_0xfa238c);};}function getInteractionUsers(_0xa3cd5,_0x41688d){return new BPromise(function(_0x59b5c3,_0x1602af){try{if(_0x41688d[_0xa3cd5['id']]){_0xa3cd5[_0x72b3('0x33')]=_[_0x72b3('0x34')](_0x41688d[_0xa3cd5['id']],function(_0x51d1fa){return{'id':_0x51d1fa['id'],'fullname':_0x51d1fa['fullname']};});}}catch(_0x2b2037){_0x1602af(_0x2b2037);}_0x59b5c3(_0xa3cd5);});}function getInteractionTags(_0x273739,_0x2cfaaf){return new BPromise(function(_0x5c743f,_0x5bfea0){try{if(_0x273739[_0x72b3('0x35')]){_0x273739[_0x72b3('0x36')]=[];_0x273739[_0x72b3('0x35')][_0x72b3('0x37')](',')[_0x72b3('0x38')](function(_0x8b44c2){_0x273739[_0x72b3('0x36')][_0x72b3('0x39')](_0x2cfaaf[_0x8b44c2]);});}delete _0x273739[_0x72b3('0x35')];}catch(_0x1bd8d4){_0x5bfea0(_0x1bd8d4);}_0x5c743f(_0x273739);});}function updateWhatsappInteraction(_0xde1fc1,_0x489afa,_0x107b99){return new BPromise(function(_0x408061,_0x4533d5){return getInteractionUsers(_0xde1fc1,_0x107b99)[_0x72b3('0x2c')](function(_0x21fa4e){return getInteractionTags(_0x21fa4e,_0x489afa);})[_0x72b3('0x2c')](function(_0x7a9d85){_0x408061(_0x7a9d85);})['catch'](function(_0x2e4874){_0x4533d5(_0x2e4874);});});}exports[_0x72b3('0x3a')]=function(_0x4b8a82,_0x40d4b0){var _0x57200c={},_0x3c5257={},_0x354c1e={'count':0x0,'rows':[]};var _0x27bf6c=_['map'](db[_0x72b3('0x3b')][_0x72b3('0x3c')],function(_0x436a5b){return{'name':_0x436a5b[_0x72b3('0x3d')],'type':_0x436a5b['type'][_0x72b3('0x3e')]};});_0x3c5257['model']=_[_0x72b3('0x34')](_0x27bf6c,_0x72b3('0x31'));_0x3c5257[_0x72b3('0x3f')]=_[_0x72b3('0x40')](_0x4b8a82[_0x72b3('0x3f')]);_0x3c5257['filters']=_[_0x72b3('0x41')](_0x3c5257['model'],_0x3c5257['query']);_0x57200c[_0x72b3('0x42')]=_[_0x72b3('0x41')](_0x3c5257[_0x72b3('0x43')],qs[_0x72b3('0x44')](_0x4b8a82[_0x72b3('0x3f')]['fields']));_0x57200c[_0x72b3('0x42')]=_0x57200c['attributes'][_0x72b3('0x45')]?_0x57200c['attributes']:_0x3c5257[_0x72b3('0x43')];if(!_0x4b8a82['query']['hasOwnProperty'](_0x72b3('0x46'))){_0x57200c[_0x72b3('0x25')]=qs[_0x72b3('0x25')](_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x25')]);_0x57200c[_0x72b3('0x23')]=qs[_0x72b3('0x23')](_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x23')]);}_0x57200c[_0x72b3('0x47')]=qs[_0x72b3('0x48')](_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x48')]);_0x57200c[_0x72b3('0x49')]=qs['filters'](_['pick'](_0x4b8a82[_0x72b3('0x3f')],_0x3c5257[_0x72b3('0x4a')]),_0x27bf6c);var _0x5e2a4c=[];var _0x3a4884=squel[_0x72b3('0x4b')]()[_0x72b3('0x4c')]('id')[_0x72b3('0x4c')](_0x72b3('0x31'))['field'](_0x72b3('0x4d'))[_0x72b3('0x4e')](_0x72b3('0x4f'));var _0x420054=squel[_0x72b3('0x4b')]()[_0x72b3('0x4c')](_0x72b3('0x50'))[_0x72b3('0x4c')](_0x72b3('0x51'))[_0x72b3('0x4c')]('ui.WhatsappInteractionId')['from'](_0x72b3('0x52'),'ui')['left_join'](_0x72b3('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x4ecda5=squel[_0x72b3('0x4b')]()[_0x72b3('0x4e')](_0x72b3('0x54'),'i')[_0x72b3('0x55')](_0x72b3('0x56'),'c',_0x72b3('0x57'))[_0x72b3('0x55')](_0x72b3('0x53'),'o',_0x72b3('0x58'))[_0x72b3('0x55')](_0x72b3('0x59'),'a',_0x72b3('0x5a'))[_0x72b3('0x55')](_0x72b3('0x5b'),'me',_0x72b3('0x5c'))[_0x72b3('0x55')](_0x72b3('0x5d'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x72b3('0x55')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x420c5e=squel[_0x72b3('0x5e')]();var _0x30a3e5=[];var _0x5c4726=squel['expr']();var _0x88677;if(_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x5f')]){_0x88677=as[_0x72b3('0x60')](_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x5f')]);var _0x196819=_0x88677[_0x72b3('0x61')];for(var _0x445eba=0x0;_0x445eba<_0x88677[_0x72b3('0x62')][_0x72b3('0x45')];_0x445eba++){var _0xfedea8=_0x88677['conditions'][_0x445eba];var _0x40dbd2='i';var _0x52c860=_[_0x72b3('0x63')](_0x27bf6c,[_0x72b3('0x31'),_0xfedea8[_0x72b3('0x4c')]]);if(!_0x52c860){switch(_0xfedea8[_0x72b3('0x4c')]){case'unreadMessages':if(_0xfedea8[_0x72b3('0x64')]==0x1){_0x4ecda5[_0x72b3('0x65')]('`'+_0xfedea8[_0x72b3('0x4c')]+_0x72b3('0x66'));}else{_0x4ecda5['having']('`'+_0xfedea8[_0x72b3('0x4c')]+_0x72b3('0x67'));}break;case _0x72b3('0x68'):if(_0xfedea8[_0x72b3('0x69')]===_0x72b3('0x6a')){if(_0xfedea8['value'][_0x72b3('0x37')]('\x20')[_0x72b3('0x45')]>0x1){_0x420c5e[_0x196819](_0x72b3('0x6b'),qs[_0x72b3('0x6c')](_0xfedea8['value']),null);}else{var _0xef72ca='%'+_0xfedea8['value']+'%';_0x420c5e[_0x196819](_0x72b3('0x6d'),_0xef72ca,_0xef72ca,_0xef72ca);}}else{_0x52c860=_[_0x72b3('0x63')](_0x27bf6c,[_0x72b3('0x31'),_0x72b3('0x6e')]);_0xfedea8[_0x72b3('0x4c')]=_0x72b3('0x6e');_0x3d77b1=as[_0x72b3('0x6f')](_0x40dbd2,_0x52c860[_0x72b3('0x70')],_0xfedea8);_0x420c5e[_0x196819](_0x3d77b1[_0x72b3('0x71')],_0x3d77b1['value'][_0x72b3('0x72')],_0x3d77b1[_0x72b3('0x64')]['end']);}break;case _0x72b3('0x73'):var _0xd812ee=_0xfedea8[_0x72b3('0x64')][_0x72b3('0x37')](',')[_0x72b3('0x34')](function(_0x593b6a){return Number(_0x593b6a);});_0xd812ee[_0x72b3('0x38')](function(_0x1ffc58){_0x5c4726['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ffc58+',%');});_0x30a3e5=_['union'](_0x30a3e5,_0xd812ee);break;case _0x72b3('0x74'):if(_0xfedea8[_0x72b3('0x69')]===_0x72b3('0x6a')){_0x420c5e[_0x196819](_0x72b3('0x75'),'%'+_0xfedea8[_0x72b3('0x64')]+'%',null);}else{_0x52c860=_[_0x72b3('0x63')](_0x27bf6c,[_0x72b3('0x31'),'UserId']);_0xfedea8[_0x72b3('0x4c')]=_0x72b3('0x76');_0x3d77b1=as[_0x72b3('0x6f')](_0x40dbd2,_0x52c860['type'],_0xfedea8);_0x420c5e[_0x196819](_0x3d77b1['text'],_0x3d77b1[_0x72b3('0x64')]['start'],_0x3d77b1[_0x72b3('0x64')][_0x72b3('0x2e')]);}break;case'body':_0x3d77b1=as[_0x72b3('0x6f')]('me',null,_0xfedea8);_0x420c5e[_0x196819](_0x3d77b1[_0x72b3('0x71')],_0x3d77b1[_0x72b3('0x64')]['start'],_0x3d77b1[_0x72b3('0x64')]['end']);break;}}else{var _0x3d77b1=as[_0x72b3('0x6f')](_0x40dbd2,_0x52c860[_0x72b3('0x70')],_0xfedea8);_0x420c5e[_0x196819](_0x3d77b1['text'],_0x3d77b1[_0x72b3('0x64')][_0x72b3('0x72')],_0x3d77b1['value']['end']);}}}else{var _0x566e64=_(_0x4b8a82[_0x72b3('0x3f')])[_0x72b3('0x40')]()[_0x72b3('0x34')](function(_0x3dc9c8){return _['some'](_0x27bf6c,[_0x72b3('0x31'),_0x3dc9c8])?_0x3dc9c8:undefined;})['compact']()[_0x72b3('0x64')]();if(!_[_0x72b3('0x77')](_0x566e64)){_0x566e64[_0x72b3('0x38')](function(_0x3597a6){if(_0x3597a6===_0x72b3('0x78')){_0x4ecda5[_0x72b3('0x49')]('i.WhatsappAccountId\x20IN\x20?',[][_0x72b3('0x79')](_0x4b8a82[_0x72b3('0x3f')][_0x3597a6]));}else if(_0x3597a6==='createdAt'){var _0x14d314=JSON[_0x72b3('0x7a')](_0x4b8a82[_0x72b3('0x3f')][_0x3597a6])[_0x72b3('0x7b')];var _0x598523=JSON[_0x72b3('0x7a')](_0x4b8a82[_0x72b3('0x3f')][_0x3597a6])[_0x72b3('0x7c')];_0x4ecda5[_0x72b3('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14d314,_0x598523);}else{if(_0x4b8a82['query'][_0x3597a6]===_0x72b3('0x7d')){_0x4ecda5[_0x72b3('0x49')]('i.'+_0x3597a6+_0x72b3('0x7e'));}else{_0x4ecda5[_0x72b3('0x49')]('i.'+_0x3597a6+_0x72b3('0x7f'),_0x4b8a82[_0x72b3('0x3f')][_0x3597a6]);}}});}if(_0x4b8a82['query'][_0x72b3('0x80')]){if(_0x4b8a82['query'][_0x72b3('0x80')]==0x1){_0x4ecda5['having']('`unreadMessages`\x20=\x200');}else{_0x4ecda5[_0x72b3('0x65')](_0x72b3('0x81'));}}if(_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x82')]){_0x30a3e5=_[_0x72b3('0x83')](_0x4b8a82[_0x72b3('0x3f')]['tag'])?_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x82')]:new Array(_0x4b8a82['query']['tag']);_0x30a3e5[_0x72b3('0x38')](function(_0x5b2b31){_0x5c4726['or'](_0x72b3('0x84'),'%,'+_0x5b2b31+',%');});}if(_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x85')]){var _0x3d7010=_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x85')][_0x72b3('0x86')]('\x5c','\x5c\x5c')[_0x72b3('0x86')](/'/g,'\x27\x27');if(qs[_0x72b3('0x87')](_0x3d7010)){_0x420c5e['or'](_0x72b3('0x88'),_0x3d7010+'%')['or'](_0x72b3('0x89'),_0x3d7010+'%');}else{_0x420c5e['or'](_0x72b3('0x8a'),qs[_0x72b3('0x6c')](_0x3d7010))['or'](_0x72b3('0x8b'),_0x3d7010+'%');}}}_0x4ecda5[_0x72b3('0x49')](_0x420c5e);_0x4ecda5[_0x72b3('0x8c')](_0x72b3('0x8d'));var _0x466eb7={'type':db[_0x72b3('0x8e')][_0x72b3('0x8f')][_0x72b3('0x90')],'raw':!![]};var _0x3b75bb=_0x4ecda5['clone']();_0x3b75bb[_0x72b3('0x4c')](_0x72b3('0x8d'));_0x3b75bb['field'](_0x72b3('0x91'),_0x72b3('0x92'));if(_0x57200c[_0x72b3('0x47')]){_0x57200c['order'][_0x72b3('0x38')](function(_0x27b3a2){var _0x1f72bb=_0x27b3a2[0x0]==='contactName'?_0x27b3a2[0x0]:'i.'+_0x27b3a2[0x0];_0x4ecda5['order'](_0x1f72bb,_0x27b3a2[0x1]===_0x72b3('0x93')?![]:!![]);});}if(!_[_0x72b3('0x77')](_0x30a3e5)){_0x4ecda5[_0x72b3('0x65')](_0x5c4726);_0x3b75bb['where'](_0x72b3('0x94'),_0x30a3e5);}BPromise['resolve']()[_0x72b3('0x2c')](function(){if(!_0x88677){if(_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x78')])return;_0x3b75bb[_0x72b3('0x49')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x4ecda5[_0x72b3('0x49')](_0x72b3('0x95'));return;}if(_0x4b8a82[_0x72b3('0x96')][_0x72b3('0x97')]!==_0x72b3('0x98'))return;return _0x4b8a82[_0x72b3('0x96')][_0x72b3('0x99')]({'attributes':['id'],'raw':!![]})[_0x72b3('0x2c')](function(_0x3d204c){if(_[_0x72b3('0x77')](_0x3d204c)){_0x3b75bb[_0x72b3('0x49')](_0x72b3('0x9a'));_0x4ecda5[_0x72b3('0x49')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x3b75bb['where'](_0x72b3('0x9b'),_[_0x72b3('0x34')](_0x3d204c,'id'));_0x4ecda5['where'](_0x72b3('0x9b'),_[_0x72b3('0x34')](_0x3d204c,'id'));}});})[_0x72b3('0x2c')](function(){if(_0x4b8a82[_0x72b3('0x96')][_0x72b3('0x97')]==='agent'&&!_0x88677&&!_0x4b8a82['query'][_0x72b3('0x78')])return[];return db[_0x72b3('0x9c')][_0x72b3('0x3f')](_0x3b75bb[_0x72b3('0x9d')](),_0x466eb7);})[_0x72b3('0x2c')](function(_0x274111){_0x354c1e[_0x72b3('0x26')]=_0x274111[_0x72b3('0x45')];if(_0x354c1e['count']===0x0)return[];return db[_0x72b3('0x9c')][_0x72b3('0x3f')](_0x3a4884['toString'](),_0x466eb7)[_0x72b3('0x2c')](function(_0x78e959){_0x5e2a4c=_[_0x72b3('0x9e')](_0x78e959,'id');_0x466eb7=_[_0x72b3('0x9f')](_0x466eb7,{'model':db[_0x72b3('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b8a82[_0x72b3('0x3f')][_0x72b3('0x44')]){_0x57200c[_0x72b3('0x42')][_0x72b3('0x38')](function(_0x12e288){_0x4ecda5[_0x72b3('0x4c')]('i.'+_0x12e288);});}else{_0x4ecda5[_0x72b3('0x4c')](_0x72b3('0x91'),_0x72b3('0x92'));_0x4ecda5[_0x72b3('0x4c')](_0x72b3('0xa0'),_0x72b3('0xa1'));_0x4ecda5[_0x72b3('0x4c')]('a.mandatoryDisposition',_0x72b3('0xa2'));_0x4ecda5['field']('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',_0x72b3('0xa3'));_0x4ecda5[_0x72b3('0x4c')](_0x72b3('0xa4'));_0x4ecda5[_0x72b3('0x4c')](_0x72b3('0xa5'),_0x72b3('0xa6'));_0x4ecda5[_0x72b3('0x4c')](_0x72b3('0xa7'),_0x72b3('0xa8'));_0x4ecda5[_0x72b3('0x4c')](_0x72b3('0xa9'),_0x72b3('0xaa'));_0x4ecda5[_0x72b3('0x4c')]('c.phone',_0x72b3('0xab'));_0x4ecda5['field'](_0x72b3('0xac'),'Contact.mobile');_0x4ecda5['field'](_0x72b3('0xad'),_0x72b3('0xae'));_0x4ecda5[_0x72b3('0x4c')](_0x72b3('0xaf'),_0x72b3('0xb0'));_0x4ecda5[_0x72b3('0x4c')]('o.internal','Owner.internal');_0x4ecda5['field'](_0x72b3('0xb1'),_0x72b3('0x35'));}if(_0x57200c['limit'])_0x4ecda5[_0x72b3('0x25')](_0x57200c[_0x72b3('0x25')]);if(_0x57200c[_0x72b3('0x23')])_0x4ecda5['offset'](_0x57200c[_0x72b3('0x23')]);return db['sequelize'][_0x72b3('0x3f')](_0x4ecda5[_0x72b3('0x9d')](),_0x466eb7);})[_0x72b3('0x2c')](function(_0x8be9f6){if(_0x8be9f6['length']>0x0)_0x420054[_0x72b3('0x49')](_0x72b3('0xb2'),_[_0x72b3('0x34')](_0x8be9f6,'id'));return db[_0x72b3('0x9c')][_0x72b3('0x3f')](_0x420054[_0x72b3('0x9d')](),_0x466eb7)[_0x72b3('0x2c')](function(_0x9da86c){var _0x590f91=_[_0x72b3('0xb3')](_0x9da86c,_0x72b3('0xb4'));var _0x670a26=[];_0x8be9f6[_0x72b3('0x38')](function(_0x595623){_0x670a26[_0x72b3('0x39')](updateWhatsappInteraction(_0x595623,_0x5e2a4c,_0x590f91));});return BPromise[_0x72b3('0xb5')](_0x670a26);});});})[_0x72b3('0x2c')](function(_0x495e84){_0x354c1e[_0x72b3('0xb6')]=_0x495e84;return _0x354c1e;})[_0x72b3('0x2c')](respondWithFilteredResult(_0x40d4b0,_0x57200c))['catch'](handleError(_0x40d4b0,null));};exports[_0x72b3('0xb7')]=function(_0x5c6cb9,_0x2d3b8b){var _0x4ed0ab={'raw':![],'where':{'id':_0x5c6cb9['params']['id']}},_0x364dd1={};_0x364dd1[_0x72b3('0x43')]=_[_0x72b3('0x40')](db[_0x72b3('0x3b')][_0x72b3('0x3c')]);_0x364dd1[_0x72b3('0x3f')]=_[_0x72b3('0x40')](_0x5c6cb9[_0x72b3('0x3f')]);_0x364dd1[_0x72b3('0x4a')]=_[_0x72b3('0x41')](_0x364dd1[_0x72b3('0x43')],_0x364dd1[_0x72b3('0x3f')]);_0x4ed0ab['attributes']=_[_0x72b3('0x41')](_0x364dd1[_0x72b3('0x43')],qs[_0x72b3('0x44')](_0x5c6cb9['query'][_0x72b3('0x44')]));_0x4ed0ab[_0x72b3('0x42')]=_0x4ed0ab['attributes'][_0x72b3('0x45')]?_0x4ed0ab[_0x72b3('0x42')]:_0x364dd1[_0x72b3('0x43')];if(_0x5c6cb9[_0x72b3('0x3f')][_0x72b3('0xb8')]){_0x4ed0ab[_0x72b3('0xb9')]=[{'all':!![]}];}_0x4ed0ab=_[_0x72b3('0x9f')]({},_0x4ed0ab,_0x5c6cb9['options']);return db[_0x72b3('0x3b')][_0x72b3('0x63')](_0x4ed0ab)['then'](handleEntityNotFound(_0x2d3b8b,null))[_0x72b3('0x2c')](respondWithResult(_0x2d3b8b,null))[_0x72b3('0xba')](handleError(_0x2d3b8b,null));};exports[_0x72b3('0xbb')]=function(_0x308c36,_0x1cc193){return db[_0x72b3('0x3b')][_0x72b3('0xbb')](_0x308c36[_0x72b3('0xbc')],{})['then'](respondWithResult(_0x1cc193,0xc9))[_0x72b3('0xba')](handleError(_0x1cc193,null));};exports[_0x72b3('0x2b')]=function(_0x113eb9,_0x6bdc6b){if(_0x113eb9[_0x72b3('0xbc')]['id']){delete _0x113eb9[_0x72b3('0xbc')]['id'];}return db['WhatsappInteraction'][_0x72b3('0x63')]({'where':{'id':_0x113eb9[_0x72b3('0xbd')]['id']}})[_0x72b3('0x2c')](handleEntityNotFound(_0x6bdc6b,null))[_0x72b3('0x2c')](saveUpdates(_0x113eb9[_0x72b3('0xbc')],null))[_0x72b3('0x2c')](respondWithResult(_0x6bdc6b,null))[_0x72b3('0xba')](handleError(_0x6bdc6b,null));};exports[_0x72b3('0x2d')]=function(_0x58885d,_0x3e5f7a){return db['WhatsappInteraction'][_0x72b3('0x63')]({'where':{'id':_0x58885d[_0x72b3('0xbd')]['id']}})[_0x72b3('0x2c')](handleEntityNotFound(_0x3e5f7a,null))[_0x72b3('0x2c')](removeEntity(_0x3e5f7a,null))['catch'](handleError(_0x3e5f7a,null));};exports[_0x72b3('0xbe')]=function(_0x1219c6,_0x2bb329){return db[_0x72b3('0x3b')][_0x72b3('0xbe')]()[_0x72b3('0x2c')](respondWithResult(_0x2bb329,null))['catch'](handleError(_0x2bb329,null));};exports[_0x72b3('0xbf')]=function(_0x299f1e,_0x59d47a,_0xa4ba96){return db[_0x72b3('0xc0')][_0x72b3('0x63')]({'where':{'id':_0x299f1e['params']['id']}})['then'](handleEntityNotFound(_0x59d47a,null))['then'](function(_0x3c1f4c){if(_0x3c1f4c){return _0x3c1f4c[_0x72b3('0xbf')](_0x299f1e['body']['ids'],_['omit'](_0x299f1e[_0x72b3('0xbc')],['ids','id'])||{});}})['then'](respondWithResult(_0x59d47a,null))[_0x72b3('0xba')](handleError(_0x59d47a,null));};exports[_0x72b3('0xc1')]=function(_0x26ce3b,_0xc701b4,_0xe4aacd){var _0x274198={'raw':![],'where':{}};var _0x2b3121={};var _0x5622e={'count':0x0,'rows':[]};return db[_0x72b3('0x3b')][_0x72b3('0xc2')]({'where':{'id':_0x26ce3b[_0x72b3('0xbd')]['id']}})[_0x72b3('0x2c')](handleEntityNotFound(_0xc701b4,null))[_0x72b3('0x2c')](function(_0x87e2c9){if(_0x87e2c9){_0x2b3121[_0x72b3('0x43')]=_[_0x72b3('0x40')](db[_0x72b3('0xc0')][_0x72b3('0x3c')]);_0x2b3121[_0x72b3('0x3f')]=_[_0x72b3('0x40')](_0x26ce3b[_0x72b3('0x3f')]);_0x2b3121[_0x72b3('0x4a')]=_['intersection'](_0x2b3121[_0x72b3('0x43')],_0x2b3121[_0x72b3('0x3f')]);_0x274198['attributes']=_[_0x72b3('0x41')](_0x2b3121[_0x72b3('0x43')],qs[_0x72b3('0x44')](_0x26ce3b[_0x72b3('0x3f')][_0x72b3('0x44')]));_0x274198[_0x72b3('0x42')]=_0x274198[_0x72b3('0x42')][_0x72b3('0x45')]?_0x274198[_0x72b3('0x42')]:_0x2b3121['model'];if(!_0x26ce3b[_0x72b3('0x3f')]['hasOwnProperty'](_0x72b3('0x46'))){_0x274198[_0x72b3('0x25')]=qs[_0x72b3('0x25')](_0x26ce3b[_0x72b3('0x3f')][_0x72b3('0x25')]);_0x274198[_0x72b3('0x23')]=qs['offset'](_0x26ce3b[_0x72b3('0x3f')][_0x72b3('0x23')]);}_0x274198[_0x72b3('0x47')]=qs['sort'](_0x26ce3b[_0x72b3('0x3f')][_0x72b3('0x48')]);_0x274198['where']=qs[_0x72b3('0x4a')](_[_0x72b3('0xc3')](_0x26ce3b[_0x72b3('0x3f')],_0x2b3121[_0x72b3('0x4a')]));_0x274198['where']['WhatsappInteractionId']=_0x87e2c9['id'];if(_0x26ce3b[_0x72b3('0x3f')][_0x72b3('0x85')]){_0x274198[_0x72b3('0x49')]=_[_0x72b3('0x9f')](_0x274198[_0x72b3('0x49')],{'$or':_[_0x72b3('0x34')](_0x274198[_0x72b3('0x42')],function(_0xdfba9b){var _0x2aa2a5={};_0x2aa2a5[_0xdfba9b]={'$like':'%'+_0x26ce3b[_0x72b3('0x3f')][_0x72b3('0x85')]+'%'};return _0x2aa2a5;})});}if(_0x26ce3b[_0x72b3('0x3f')]['$gte']){var _0x455e4=_0x26ce3b[_0x72b3('0x3f')][_0x72b3('0x7b')][_0x72b3('0x37')](',');var _0xe6c4d4={};_0xe6c4d4[_0x455e4[0x0]]={'$gte':moment(_0x455e4[0x1])[_0x72b3('0xc4')](_0x72b3('0xc5'))};_0x274198['where']=_[_0x72b3('0x9f')](_0x274198[_0x72b3('0x49')],_0xe6c4d4);}_0x274198=_['merge']({},_0x274198,_0x26ce3b['options']);return db['WhatsappMessage']['count']({'where':_0x274198[_0x72b3('0x49')]})[_0x72b3('0x2c')](function(_0x16729d){_0x5622e[_0x72b3('0x26')]=_0x16729d;if(_0x26ce3b[_0x72b3('0x3f')]['includeAll']){_0x274198['include']=[{'all':!![]}];}return db[_0x72b3('0xc0')][_0x72b3('0xc6')](_0x274198);})[_0x72b3('0x2c')](function(_0x294a81){_0x5622e[_0x72b3('0xb6')]=_0x294a81;return _0x5622e;});}})[_0x72b3('0x2c')](respondWithFilteredResult(_0xc701b4,_0x274198))[_0x72b3('0xba')](handleError(_0xc701b4,null));};exports[_0x72b3('0xc7')]=function(_0x1e997b,_0x231171,_0x560496){return db[_0x72b3('0x3b')]['find']({'where':{'id':_0x1e997b[_0x72b3('0xbd')]['id']}})[_0x72b3('0x2c')](handleEntityNotFound(_0x231171,null))[_0x72b3('0x2c')](function(_0x2ad321){if(_0x2ad321){return _0x2ad321['setTags'](_0x1e997b[_0x72b3('0xbc')][_0x72b3('0xc8')],_[_0x72b3('0xc9')](_0x1e997b[_0x72b3('0xbc')],[_0x72b3('0xc8'),'id'])||{})[_0x72b3('0xca')](function(){return db[_0x72b3('0x73')][_0x72b3('0xc6')]({'attributes':['id',_0x72b3('0x31'),_0x72b3('0x4d')],'where':{'id':_0x1e997b[_0x72b3('0xbc')][_0x72b3('0xc8')]}});})[_0x72b3('0x2c')](function(_0x165570){socket[_0x72b3('0xcb')](_0x72b3('0xcc'),{'id':Number(_0x1e997b[_0x72b3('0xbd')]['id']),'tags':_0x165570||[]});return{'id':Number(_0x1e997b[_0x72b3('0xbd')]['id']),'tags':_0x165570||[]};});}})[_0x72b3('0x2c')](respondWithResult(_0x231171,null))[_0x72b3('0xba')](handleError(_0x231171,null));};exports[_0x72b3('0xcd')]=function(_0x27b317,_0x17381b,_0x5e32f3){return db[_0x72b3('0x3b')][_0x72b3('0x63')]({'where':{'id':_0x27b317['params']['id']}})[_0x72b3('0x2c')](handleEntityNotFound(_0x17381b,null))['then'](function(_0x373637){if(_0x373637){return _0x373637[_0x72b3('0xcd')](_0x27b317[_0x72b3('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x17381b,null))[_0x72b3('0xba')](handleError(_0x17381b,null));};exports[_0x72b3('0xce')]=function(_0x56b8ef,_0xbb2015){var _0x137049=moment()['unix']()[_0x72b3('0x9d')]();var _0x476e8e=path[_0x72b3('0xcf')](config[_0x72b3('0xd0')],_0x72b3('0xd1'),_0x72b3('0xd2'),_0x72b3('0xd3'));var _0x905485=path['join'](config['root'],_0x72b3('0xd1'),_0x72b3('0xd2'),'attachments');var _0x4201c5=path[_0x72b3('0xcf')](_0x476e8e,_0x137049);var _0x2f43a7=util['format'](_0x72b3('0xd4'),_0x56b8ef[_0x72b3('0xbd')]['id'],_0x137049);var _0x2b305d=path[_0x72b3('0xcf')](_0x476e8e,_0x2f43a7);var _0x44fb79=[];_0x44fb79[_0x72b3('0x39')]({'model':db[_0x72b3('0x74')],'as':_0x72b3('0x74'),'attributes':['id',_0x72b3('0xd5')],'raw':!![]});_0x44fb79[_0x72b3('0x39')]({'model':db[_0x72b3('0xd6')],'as':_0x72b3('0x68'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x56b8ef[_0x72b3('0x3f')]['attachments']){_0x44fb79[_0x72b3('0x39')]({'model':db[_0x72b3('0xd7')],'as':_0x72b3('0xd7'),'raw':!![]});}var _0x19b68b=[{'model':db[_0x72b3('0xc0')],'as':_0x72b3('0xd8'),'attributes':['id',_0x72b3('0xbc'),_0x72b3('0xd9'),'direction','secret','read'],'include':_0x44fb79}];_0x19b68b['push']({'model':db[_0x72b3('0xda')],'as':'Account','attributes':['id',_0x72b3('0x31')]});_0x19b68b['push']({'model':db[_0x72b3('0x74')],'as':'Owner','attributes':['id',_0x72b3('0xd5')]});return db[_0x72b3('0x3b')]['find']({'where':{'id':_0x56b8ef['params']['id']},'include':_0x19b68b})['then'](handleEntityNotFound(_0xbb2015,null))['then'](function(_0x45eea7){if(_0x45eea7){var _0x26066d=_0x45eea7[_0x72b3('0xdb')]({'plain':!![]});fs[_0x72b3('0xdc')](_0x4201c5);var _0x22abd8={'channel':_0x72b3('0xdd'),'account':_0x26066d[_0x72b3('0xde')][_0x72b3('0x31')],'agent':_0x26066d[_0x72b3('0xdf')]?_0x26066d[_0x72b3('0xdf')][_0x72b3('0xd5')]:_0x72b3('0xe0'),'createdAt':moment(_0x26066d['createdAt'])[_0x72b3('0xc4')](_0x72b3('0xc5'))[_0x72b3('0x9d')](),'closedAt':_0x26066d[_0x72b3('0xe1')]?moment(_0x26066d['closedAt'])[_0x72b3('0xc4')](_0x72b3('0xc5'))[_0x72b3('0x9d')]():'','disposition':_0x26066d[_0x72b3('0xe2')],'messages':_(_0x26066d[_0x72b3('0xd8')])[_0x72b3('0x85')]({'secret':![]})[_0x72b3('0x34')](function(_0x31d990){if(_0x31d990[_0x72b3('0xd7')]){var _0x1f817c=path[_0x72b3('0xcf')](_0x905485,_0x31d990[_0x72b3('0xd7')][_0x72b3('0xe3')]);if(fs['existsSync'](_0x1f817c)){fs[_0x72b3('0xe4')](_0x1f817c)[_0x72b3('0xe5')](fs[_0x72b3('0xe6')](path[_0x72b3('0xcf')](_0x4201c5,_0x31d990[_0x72b3('0xd7')]['basename'])));}}return{'date':moment(_0x31d990[_0x72b3('0xd9')])[_0x72b3('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x72b3('0x9d')](),'sender':_0x31d990[_0x72b3('0xe7')]===_0x72b3('0xe8')?_0x31d990[_0x72b3('0x74')]?_0x31d990[_0x72b3('0x74')][_0x72b3('0xd5')]:_0x72b3('0xe9'):_0x31d990[_0x72b3('0x68')]['firstName']+(_0x31d990[_0x72b3('0x68')][_0x72b3('0xea')]?'\x20'+_0x31d990[_0x72b3('0x68')]['lastName']:''),'body':_0x31d990['Attachment']?_0x31d990[_0x72b3('0xd7')][_0x72b3('0xe3')]:_0x31d990[_0x72b3('0xbc')],'direction':_0x31d990[_0x72b3('0xe7')]==='out'?'A':'C','secret':_0x31d990[_0x72b3('0xeb')],'read':_0x31d990[_0x72b3('0x80')],'attachment':_0x31d990[_0x72b3('0xd7')]};})['value']()};return ejs[_0x72b3('0xec')](path['join'](config[_0x72b3('0xd0')],_0x72b3('0xd1'),_0x72b3('0xed'),_0x72b3('0xee')),{'interaction':_0x22abd8})[_0x72b3('0x2c')](function(_0x2d788a){var _0x313a2b=path['join'](_0x4201c5,_0x72b3('0xef')+_0x26066d['id']+'-'+_0x137049+_0x72b3('0xf0'));var _0x3f79a2={'path':_0x313a2b,'channel':_0x72b3('0xdd'),'interactionId':_0x26066d['id']};return pdf[_0x72b3('0xf1')](_0x2d788a,_0x3f79a2);})[_0x72b3('0x2c')](function(){return new BPromise(function(_0x2ee3cb,_0xe2a860){zipdir(_0x4201c5,{'saveTo':_0x2b305d},function(_0x572313,_0x2a53a6){if(_0x572313)return _0xe2a860(_0x572313);return _0x2ee3cb(_0x2a53a6);});})[_0x72b3('0x2c')](function(){return new BPromise(function(_0x58ed5f,_0x5efa08){rimraf(_0x4201c5,function(_0x1aa825){if(_0x1aa825)_0x5efa08(_0x1aa825);return _0x58ed5f();});});})[_0x72b3('0x2c')](function(){return _0xbb2015[_0x72b3('0xce')](_0x2b305d,_0x2f43a7,function(_0x98c2cc){if(_0x98c2cc){console[_0x72b3('0xf2')](_0x72b3('0xf3'),_0x98c2cc);}else{fs[_0x72b3('0xf4')](_0x2b305d);}});});});}else{return _0xbb2015['sendStatus'](0xc8);}})[_0x72b3('0xba')](handleError(_0xbb2015,null));}; \ No newline at end of file +var _0xac52=['addMessage','ids','omit','getMessages','findOne','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','options','addTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','push','CmContact','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','get','mkdirSync','Whatsapp','Account','Owner','N.A.','closed','closedAt','basename','existsSync','createReadStream','pipe','out','System','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','fullname','Tags','TagIds','forEach','index','WhatsappInteraction','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','params','includeAll','include','create','describe','WhatsappMessage'];(function(_0x3f7154,_0x1300ca){var _0x33527f=function(_0x3e954e){while(--_0x3e954e){_0x3f7154['push'](_0x3f7154['shift']());}};_0x33527f(++_0x1300ca);}(_0xac52,0x122));var _0x2ac5=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xac52[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ac5('0x0'));var zipdir=require(_0x2ac5('0x1'));var jsonpatch=require(_0x2ac5('0x2'));var rp=require(_0x2ac5('0x3'));var moment=require(_0x2ac5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2ac5('0x5'));var util=require(_0x2ac5('0x6'));var path=require('path');var sox=require(_0x2ac5('0x7'));var csv=require(_0x2ac5('0x8'));var ejs=require(_0x2ac5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ac5('0xa'));var crypto=require(_0x2ac5('0xb'));var jsforce=require(_0x2ac5('0xc'));var deskjs=require(_0x2ac5('0xd'));var toCsv=require(_0x2ac5('0x8'));var querystring=require(_0x2ac5('0xe'));var Papa=require(_0x2ac5('0xf'));var Redis=require(_0x2ac5('0x10'));var authService=require(_0x2ac5('0x11'));var qs=require(_0x2ac5('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x2ac5('0x13'));var hardwareService=require(_0x2ac5('0x14'));var logger=require(_0x2ac5('0x15'))(_0x2ac5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2ac5('0x17'))['db'];config[_0x2ac5('0x18')]=_[_0x2ac5('0x19')](config[_0x2ac5('0x18')],{'host':_0x2ac5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ac5('0x18')]));require('./whatsappInteraction.socket')[_0x2ac5('0x1b')](socket);function respondWithStatusCode(_0x297390,_0x39a07d){_0x39a07d=_0x39a07d||0xcc;return function(_0x597d55){if(_0x597d55){return _0x297390['sendStatus'](_0x39a07d);}return _0x297390[_0x2ac5('0x1c')](_0x39a07d)[_0x2ac5('0x1d')]();};}function respondWithResult(_0x415a8c,_0x2ec753){_0x2ec753=_0x2ec753||0xc8;return function(_0x1741ce){if(_0x1741ce){return _0x415a8c[_0x2ac5('0x1c')](_0x2ec753)[_0x2ac5('0x1e')](_0x1741ce);}};}function respondWithFilteredResult(_0x25e0eb,_0x101a68){return function(_0x1011ff){if(_0x1011ff){var _0x4ba2b5=typeof _0x101a68[_0x2ac5('0x1f')]===_0x2ac5('0x20')&&typeof _0x101a68[_0x2ac5('0x21')]==='undefined';var _0x15eede=_0x1011ff[_0x2ac5('0x22')];var _0x548016=_0x4ba2b5?0x0:_0x101a68[_0x2ac5('0x1f')];var _0x6ac8b2=_0x4ba2b5?_0x1011ff[_0x2ac5('0x22')]:_0x101a68[_0x2ac5('0x1f')]+_0x101a68[_0x2ac5('0x21')];var _0x2fc145;if(_0x6ac8b2>=_0x15eede){_0x6ac8b2=_0x15eede;_0x2fc145=0xc8;}else{_0x2fc145=0xce;}_0x25e0eb[_0x2ac5('0x1c')](_0x2fc145);return _0x25e0eb['set'](_0x2ac5('0x23'),_0x548016+'-'+_0x6ac8b2+'/'+_0x15eede)[_0x2ac5('0x1e')](_0x1011ff);}return null;};}function patchUpdates(_0x256f4c){return function(_0x586221){try{jsonpatch[_0x2ac5('0x24')](_0x586221,_0x256f4c,!![]);}catch(_0x2892bd){return BPromise[_0x2ac5('0x25')](_0x2892bd);}return _0x586221['save']();};}function saveUpdates(_0x2ef3e8,_0x3e46a7){return function(_0x12f17a){if(_0x12f17a){return _0x12f17a[_0x2ac5('0x26')](_0x2ef3e8)[_0x2ac5('0x27')](function(_0x2197a5){return _0x2197a5;});}return null;};}function removeEntity(_0x53791c,_0xb8c01){return function(_0x38eaf1){if(_0x38eaf1){return _0x38eaf1[_0x2ac5('0x28')]()[_0x2ac5('0x27')](function(){_0x53791c[_0x2ac5('0x1c')](0xcc)[_0x2ac5('0x1d')]();});}};}function handleEntityNotFound(_0x9ce264,_0x31780f){return function(_0x5d8a45){if(!_0x5d8a45){_0x9ce264[_0x2ac5('0x29')](0x194);}return _0x5d8a45;};}function handleError(_0xb82e1c,_0xdf1196){_0xdf1196=_0xdf1196||0x1f4;return function(_0x4067a0){logger[_0x2ac5('0x2a')](_0x4067a0[_0x2ac5('0x2b')]);if(_0x4067a0['name']){delete _0x4067a0[_0x2ac5('0x2c')];}_0xb82e1c[_0x2ac5('0x1c')](_0xdf1196)['send'](_0x4067a0);};}function getInteractionUsers(_0xe815ca,_0x31edd9){return new BPromise(function(_0x27c7c6,_0x547442){try{if(_0x31edd9[_0xe815ca['id']]){_0xe815ca['Users']=_[_0x2ac5('0x2d')](_0x31edd9[_0xe815ca['id']],function(_0x372de5){return{'id':_0x372de5['id'],'fullname':_0x372de5[_0x2ac5('0x2e')]};});}}catch(_0x1b18a5){_0x547442(_0x1b18a5);}_0x27c7c6(_0xe815ca);});}function getInteractionTags(_0x229530,_0x4d205a){return new BPromise(function(_0x3b85ad,_0x6b5848){try{if(_0x229530['TagIds']){_0x229530[_0x2ac5('0x2f')]=[];_0x229530[_0x2ac5('0x30')]['split'](',')[_0x2ac5('0x31')](function(_0x33f8e0){_0x229530[_0x2ac5('0x2f')]['push'](_0x4d205a[_0x33f8e0]);});}delete _0x229530[_0x2ac5('0x30')];}catch(_0x2c1dba){_0x6b5848(_0x2c1dba);}_0x3b85ad(_0x229530);});}function updateWhatsappInteraction(_0x28e7b7,_0x55492f,_0x5cf7cd){return new BPromise(function(_0x3ddd34,_0x48b9cb){return getInteractionUsers(_0x28e7b7,_0x5cf7cd)[_0x2ac5('0x27')](function(_0x4912eb){return getInteractionTags(_0x4912eb,_0x55492f);})[_0x2ac5('0x27')](function(_0x1301c7){_0x3ddd34(_0x1301c7);})['catch'](function(_0x5ea6a4){_0x48b9cb(_0x5ea6a4);});});}exports[_0x2ac5('0x32')]=function(_0x18d443,_0x46e078){var _0x20b3a8={},_0x36af87={},_0x269c86={'count':0x0,'rows':[]};var _0x118215=_[_0x2ac5('0x2d')](db[_0x2ac5('0x33')][_0x2ac5('0x34')],function(_0x44ae00){return{'name':_0x44ae00['fieldName'],'type':_0x44ae00['type'][_0x2ac5('0x35')]};});_0x36af87[_0x2ac5('0x36')]=_[_0x2ac5('0x2d')](_0x118215,_0x2ac5('0x2c'));_0x36af87[_0x2ac5('0x37')]=_[_0x2ac5('0x38')](_0x18d443[_0x2ac5('0x37')]);_0x36af87['filters']=_[_0x2ac5('0x39')](_0x36af87[_0x2ac5('0x36')],_0x36af87[_0x2ac5('0x37')]);_0x20b3a8[_0x2ac5('0x3a')]=_[_0x2ac5('0x39')](_0x36af87[_0x2ac5('0x36')],qs[_0x2ac5('0x3b')](_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x3b')]));_0x20b3a8[_0x2ac5('0x3a')]=_0x20b3a8[_0x2ac5('0x3a')][_0x2ac5('0x3c')]?_0x20b3a8['attributes']:_0x36af87[_0x2ac5('0x36')];if(!_0x18d443[_0x2ac5('0x37')]['hasOwnProperty'](_0x2ac5('0x3d'))){_0x20b3a8[_0x2ac5('0x21')]=qs['limit'](_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x21')]);_0x20b3a8[_0x2ac5('0x1f')]=qs[_0x2ac5('0x1f')](_0x18d443['query']['offset']);}_0x20b3a8['order']=qs[_0x2ac5('0x3e')](_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x3e')]);_0x20b3a8[_0x2ac5('0x3f')]=qs[_0x2ac5('0x40')](_[_0x2ac5('0x41')](_0x18d443[_0x2ac5('0x37')],_0x36af87['filters']),_0x118215);var _0x32b045=[];var _0x2ce067=squel[_0x2ac5('0x42')]()[_0x2ac5('0x43')]('id')[_0x2ac5('0x43')](_0x2ac5('0x2c'))[_0x2ac5('0x43')](_0x2ac5('0x44'))[_0x2ac5('0x45')]('tools_tags');var _0x4ce990=squel[_0x2ac5('0x42')]()[_0x2ac5('0x43')](_0x2ac5('0x46'))['field'](_0x2ac5('0x47'))[_0x2ac5('0x43')](_0x2ac5('0x48'))[_0x2ac5('0x45')](_0x2ac5('0x49'),'ui')['left_join'](_0x2ac5('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x4b3cdd=squel[_0x2ac5('0x42')]()[_0x2ac5('0x45')](_0x2ac5('0x4b'),'i')['left_join']('cm_contacts','c',_0x2ac5('0x4c'))[_0x2ac5('0x4d')](_0x2ac5('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x2ac5('0x4d')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x2ac5('0x4d')](_0x2ac5('0x4e'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x2ac5('0x4d')](_0x2ac5('0x4f'),'it',_0x2ac5('0x50'))[_0x2ac5('0x4d')](_0x2ac5('0x51'),'t','t.id\x20=\x20it.TagId');var _0x3fc696=squel[_0x2ac5('0x52')]();var _0x4b3412=[];var _0x5628e8=squel[_0x2ac5('0x52')]();var _0x54a336;if(_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x53')]){_0x54a336=as['parseSearch'](_0x18d443['query']['search']);var _0x4e5da7=_0x54a336[_0x2ac5('0x54')];for(var _0x338ee4=0x0;_0x338ee4<_0x54a336[_0x2ac5('0x55')]['length'];_0x338ee4++){var _0x408461=_0x54a336[_0x2ac5('0x55')][_0x338ee4];var _0x2e117e='i';var _0x4a5032=_[_0x2ac5('0x56')](_0x118215,[_0x2ac5('0x2c'),_0x408461[_0x2ac5('0x43')]]);if(!_0x4a5032){switch(_0x408461[_0x2ac5('0x43')]){case'unreadMessages':if(_0x408461[_0x2ac5('0x57')]==0x1){_0x4b3cdd['having']('`'+_0x408461['field']+_0x2ac5('0x58'));}else{_0x4b3cdd[_0x2ac5('0x59')]('`'+_0x408461['field']+_0x2ac5('0x5a'));}break;case _0x2ac5('0x5b'):if(_0x408461[_0x2ac5('0x5c')]===_0x2ac5('0x5d')){if(_0x408461[_0x2ac5('0x57')][_0x2ac5('0x5e')]('\x20')[_0x2ac5('0x3c')]>0x1){_0x3fc696[_0x4e5da7](_0x2ac5('0x5f'),qs[_0x2ac5('0x60')](_0x408461['value']),null);}else{var _0x4c0a55='%'+_0x408461['value']+'%';_0x3fc696[_0x4e5da7](_0x2ac5('0x61'),_0x4c0a55,_0x4c0a55,_0x4c0a55);}}else{_0x4a5032=_[_0x2ac5('0x56')](_0x118215,[_0x2ac5('0x2c'),'ContactId']);_0x408461[_0x2ac5('0x43')]='ContactId';_0x30c7e9=as[_0x2ac5('0x62')](_0x2e117e,_0x4a5032['type'],_0x408461);_0x3fc696[_0x4e5da7](_0x30c7e9[_0x2ac5('0x63')],_0x30c7e9['value'][_0x2ac5('0x64')],_0x30c7e9['value'][_0x2ac5('0x1d')]);}break;case _0x2ac5('0x65'):var _0x4b1f26=_0x408461[_0x2ac5('0x57')][_0x2ac5('0x5e')](',')[_0x2ac5('0x2d')](function(_0x5573bd){return Number(_0x5573bd);});_0x4b1f26[_0x2ac5('0x31')](function(_0x25da52){_0x5628e8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x25da52+',%');});_0x4b3412=_[_0x2ac5('0x66')](_0x4b3412,_0x4b1f26);break;case _0x2ac5('0x67'):if(_0x408461[_0x2ac5('0x5c')]==='$substring'){_0x3fc696[_0x4e5da7](_0x2ac5('0x68'),'%'+_0x408461[_0x2ac5('0x57')]+'%',null);}else{_0x4a5032=_['find'](_0x118215,[_0x2ac5('0x2c'),_0x2ac5('0x69')]);_0x408461[_0x2ac5('0x43')]=_0x2ac5('0x69');_0x30c7e9=as[_0x2ac5('0x62')](_0x2e117e,_0x4a5032[_0x2ac5('0x6a')],_0x408461);_0x3fc696[_0x4e5da7](_0x30c7e9[_0x2ac5('0x63')],_0x30c7e9[_0x2ac5('0x57')][_0x2ac5('0x64')],_0x30c7e9[_0x2ac5('0x57')][_0x2ac5('0x1d')]);}break;case _0x2ac5('0x6b'):_0x30c7e9=as['buildExpression']('me',null,_0x408461);_0x3fc696[_0x4e5da7](_0x30c7e9[_0x2ac5('0x63')],_0x30c7e9[_0x2ac5('0x57')][_0x2ac5('0x64')],_0x30c7e9[_0x2ac5('0x57')][_0x2ac5('0x1d')]);break;}}else{var _0x30c7e9=as['buildExpression'](_0x2e117e,_0x4a5032[_0x2ac5('0x6a')],_0x408461);_0x3fc696[_0x4e5da7](_0x30c7e9[_0x2ac5('0x63')],_0x30c7e9[_0x2ac5('0x57')]['start'],_0x30c7e9[_0x2ac5('0x57')][_0x2ac5('0x1d')]);}}}else{var _0x361a8b=_(_0x18d443[_0x2ac5('0x37')])[_0x2ac5('0x38')]()[_0x2ac5('0x2d')](function(_0x2c17d8){return _[_0x2ac5('0x6c')](_0x118215,[_0x2ac5('0x2c'),_0x2c17d8])?_0x2c17d8:undefined;})['compact']()['value']();if(!_[_0x2ac5('0x6d')](_0x361a8b)){_0x361a8b[_0x2ac5('0x31')](function(_0x189927){if(_0x189927===_0x2ac5('0x6e')){_0x4b3cdd[_0x2ac5('0x3f')](_0x2ac5('0x6f'),[][_0x2ac5('0x70')](_0x18d443[_0x2ac5('0x37')][_0x189927]));}else if(_0x189927===_0x2ac5('0x71')){var _0x2d1a57=JSON[_0x2ac5('0x72')](_0x18d443['query'][_0x189927])['$gte'];var _0x58f1f4=JSON[_0x2ac5('0x72')](_0x18d443[_0x2ac5('0x37')][_0x189927])['$lte'];_0x4b3cdd[_0x2ac5('0x3f')](_0x2ac5('0x73'),_0x2d1a57,_0x58f1f4);}else{if(_0x18d443['query'][_0x189927]==='null'){_0x4b3cdd[_0x2ac5('0x3f')]('i.'+_0x189927+_0x2ac5('0x74'));}else{_0x4b3cdd[_0x2ac5('0x3f')]('i.'+_0x189927+_0x2ac5('0x75'),_0x18d443[_0x2ac5('0x37')][_0x189927]);}}});}if(_0x18d443[_0x2ac5('0x37')]['read']){if(_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x76')]==0x1){_0x4b3cdd['having']('`unreadMessages`\x20=\x200');}else{_0x4b3cdd[_0x2ac5('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x77')]){_0x4b3412=_[_0x2ac5('0x78')](_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x77')])?_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x77')]:new Array(_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x77')]);_0x4b3412[_0x2ac5('0x31')](function(_0x40226e){_0x5628e8['or'](_0x2ac5('0x79'),'%,'+_0x40226e+',%');});}if(_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x7a')]){var _0x138ebe=_0x18d443[_0x2ac5('0x37')]['filter'][_0x2ac5('0x7b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x138ebe)){_0x3fc696['or'](_0x2ac5('0x7c'),_0x138ebe+'%')['or'](_0x2ac5('0x7d'),_0x138ebe+'%');}else{_0x3fc696['or'](_0x2ac5('0x7e'),qs[_0x2ac5('0x60')](_0x138ebe))['or'](_0x2ac5('0x7f'),_0x138ebe+'%');}}}_0x4b3cdd[_0x2ac5('0x3f')](_0x3fc696);_0x4b3cdd['group'](_0x2ac5('0x80'));var _0x59171d={'type':db['Sequelize']['QueryTypes'][_0x2ac5('0x81')],'raw':!![]};var _0x204eff=_0x4b3cdd[_0x2ac5('0x82')]();_0x204eff[_0x2ac5('0x43')](_0x2ac5('0x80'));_0x204eff[_0x2ac5('0x43')](_0x2ac5('0x83'),_0x2ac5('0x84'));if(_0x20b3a8[_0x2ac5('0x85')]){_0x20b3a8['order'][_0x2ac5('0x31')](function(_0x4e024a){var _0x415a06=_0x4e024a[0x0]===_0x2ac5('0x86')?_0x4e024a[0x0]:'i.'+_0x4e024a[0x0];_0x4b3cdd['order'](_0x415a06,_0x4e024a[0x1]===_0x2ac5('0x87')?![]:!![]);});}if(!_['isEmpty'](_0x4b3412)){_0x4b3cdd[_0x2ac5('0x59')](_0x5628e8);_0x204eff[_0x2ac5('0x3f')](_0x2ac5('0x88'),_0x4b3412);}BPromise[_0x2ac5('0x89')]()[_0x2ac5('0x27')](function(){if(!_0x54a336){if(_0x18d443[_0x2ac5('0x37')]['WhatsappAccountId'])return;_0x204eff['where'](_0x2ac5('0x8a'));_0x4b3cdd[_0x2ac5('0x3f')](_0x2ac5('0x8a'));return;}if(_0x18d443['user'][_0x2ac5('0x8b')]!==_0x2ac5('0x8c'))return;return _0x18d443['user'][_0x2ac5('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x48ec0f){if(_[_0x2ac5('0x6d')](_0x48ec0f)){_0x204eff['where'](_0x2ac5('0x8e'));_0x4b3cdd[_0x2ac5('0x3f')](_0x2ac5('0x8e'));}else{_0x204eff[_0x2ac5('0x3f')](_0x2ac5('0x6f'),_[_0x2ac5('0x2d')](_0x48ec0f,'id'));_0x4b3cdd[_0x2ac5('0x3f')](_0x2ac5('0x6f'),_[_0x2ac5('0x2d')](_0x48ec0f,'id'));}});})[_0x2ac5('0x27')](function(){if(_0x18d443['user'][_0x2ac5('0x8b')]===_0x2ac5('0x8c')&&!_0x54a336&&!_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x6e')])return[];return db[_0x2ac5('0x8f')][_0x2ac5('0x37')](_0x204eff['toString'](),_0x59171d);})[_0x2ac5('0x27')](function(_0x279d88){_0x269c86['count']=_0x279d88['length'];if(_0x269c86[_0x2ac5('0x22')]===0x0)return[];return db[_0x2ac5('0x8f')][_0x2ac5('0x37')](_0x2ce067['toString'](),_0x59171d)[_0x2ac5('0x27')](function(_0x17f391){_0x32b045=_[_0x2ac5('0x90')](_0x17f391,'id');_0x59171d=_[_0x2ac5('0x91')](_0x59171d,{'model':db[_0x2ac5('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18d443[_0x2ac5('0x37')][_0x2ac5('0x3b')]){_0x20b3a8[_0x2ac5('0x3a')][_0x2ac5('0x31')](function(_0x371cbb){_0x4b3cdd[_0x2ac5('0x43')]('i.'+_0x371cbb);});}else{_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x83'),_0x2ac5('0x84'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x92'),_0x2ac5('0x93'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x94'),_0x2ac5('0x95'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x96'),_0x2ac5('0x86'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x97'));_0x4b3cdd['field']('c.firstName','Contact.firstName');_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x98'),_0x2ac5('0x99'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x9a'),_0x2ac5('0x9b'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x9c'),_0x2ac5('0x9d'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0x9e'),_0x2ac5('0x9f'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0xa0'),_0x2ac5('0xa1'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0xa2'),_0x2ac5('0xa3'));_0x4b3cdd[_0x2ac5('0x43')]('o.internal',_0x2ac5('0xa4'));_0x4b3cdd[_0x2ac5('0x43')](_0x2ac5('0xa5'),'TagIds');}if(_0x20b3a8[_0x2ac5('0x21')])_0x4b3cdd[_0x2ac5('0x21')](_0x20b3a8[_0x2ac5('0x21')]);if(_0x20b3a8[_0x2ac5('0x1f')])_0x4b3cdd['offset'](_0x20b3a8[_0x2ac5('0x1f')]);return db[_0x2ac5('0x8f')]['query'](_0x4b3cdd[_0x2ac5('0xa6')](),_0x59171d);})['then'](function(_0xde36b2){if(_0xde36b2[_0x2ac5('0x3c')]>0x0)_0x4ce990[_0x2ac5('0x3f')](_0x2ac5('0xa7'),_[_0x2ac5('0x2d')](_0xde36b2,'id'));return db['sequelize']['query'](_0x4ce990['toString'](),_0x59171d)[_0x2ac5('0x27')](function(_0x228288){var _0x510de3=_[_0x2ac5('0xa8')](_0x228288,_0x2ac5('0xa9'));var _0x2b8371=[];_0xde36b2[_0x2ac5('0x31')](function(_0x380410){_0x2b8371['push'](updateWhatsappInteraction(_0x380410,_0x32b045,_0x510de3));});return BPromise[_0x2ac5('0xaa')](_0x2b8371);});});})[_0x2ac5('0x27')](function(_0x36b8ac){_0x269c86[_0x2ac5('0xab')]=_0x36b8ac;return _0x269c86;})['then'](respondWithFilteredResult(_0x46e078,_0x20b3a8))[_0x2ac5('0xac')](handleError(_0x46e078,null));};exports[_0x2ac5('0xad')]=function(_0x498ef0,_0x513ca9){var _0x4fa128={'raw':![],'where':{'id':_0x498ef0[_0x2ac5('0xae')]['id']}},_0x2e1592={};_0x2e1592[_0x2ac5('0x36')]=_['keys'](db[_0x2ac5('0x33')]['rawAttributes']);_0x2e1592[_0x2ac5('0x37')]=_['keys'](_0x498ef0['query']);_0x2e1592[_0x2ac5('0x40')]=_[_0x2ac5('0x39')](_0x2e1592[_0x2ac5('0x36')],_0x2e1592[_0x2ac5('0x37')]);_0x4fa128['attributes']=_[_0x2ac5('0x39')](_0x2e1592[_0x2ac5('0x36')],qs[_0x2ac5('0x3b')](_0x498ef0[_0x2ac5('0x37')][_0x2ac5('0x3b')]));_0x4fa128['attributes']=_0x4fa128[_0x2ac5('0x3a')][_0x2ac5('0x3c')]?_0x4fa128[_0x2ac5('0x3a')]:_0x2e1592[_0x2ac5('0x36')];if(_0x498ef0[_0x2ac5('0x37')][_0x2ac5('0xaf')]){_0x4fa128[_0x2ac5('0xb0')]=[{'all':!![]}];}_0x4fa128=_['merge']({},_0x4fa128,_0x498ef0['options']);return db['WhatsappInteraction'][_0x2ac5('0x56')](_0x4fa128)[_0x2ac5('0x27')](handleEntityNotFound(_0x513ca9,null))[_0x2ac5('0x27')](respondWithResult(_0x513ca9,null))[_0x2ac5('0xac')](handleError(_0x513ca9,null));};exports[_0x2ac5('0xb1')]=function(_0x3907cb,_0x54cc1d){return db[_0x2ac5('0x33')][_0x2ac5('0xb1')](_0x3907cb[_0x2ac5('0x6b')],{})[_0x2ac5('0x27')](respondWithResult(_0x54cc1d,0xc9))[_0x2ac5('0xac')](handleError(_0x54cc1d,null));};exports[_0x2ac5('0x26')]=function(_0x2075aa,_0x270a12){if(_0x2075aa[_0x2ac5('0x6b')]['id']){delete _0x2075aa['body']['id'];}return db['WhatsappInteraction'][_0x2ac5('0x56')]({'where':{'id':_0x2075aa[_0x2ac5('0xae')]['id']}})[_0x2ac5('0x27')](handleEntityNotFound(_0x270a12,null))[_0x2ac5('0x27')](saveUpdates(_0x2075aa['body'],null))[_0x2ac5('0x27')](respondWithResult(_0x270a12,null))['catch'](handleError(_0x270a12,null));};exports[_0x2ac5('0x28')]=function(_0x884deb,_0x277f36){return db['WhatsappInteraction']['find']({'where':{'id':_0x884deb['params']['id']}})[_0x2ac5('0x27')](handleEntityNotFound(_0x277f36,null))[_0x2ac5('0x27')](removeEntity(_0x277f36,null))[_0x2ac5('0xac')](handleError(_0x277f36,null));};exports['describe']=function(_0x487de7,_0x5a0b76){return db[_0x2ac5('0x33')][_0x2ac5('0xb2')]()[_0x2ac5('0x27')](respondWithResult(_0x5a0b76,null))[_0x2ac5('0xac')](handleError(_0x5a0b76,null));};exports['addMessage']=function(_0x1e9904,_0x1898bc,_0x5b5dd2){return db[_0x2ac5('0xb3')]['find']({'where':{'id':_0x1e9904[_0x2ac5('0xae')]['id']}})['then'](handleEntityNotFound(_0x1898bc,null))[_0x2ac5('0x27')](function(_0x29910e){if(_0x29910e){return _0x29910e[_0x2ac5('0xb4')](_0x1e9904[_0x2ac5('0x6b')][_0x2ac5('0xb5')],_[_0x2ac5('0xb6')](_0x1e9904['body'],[_0x2ac5('0xb5'),'id'])||{});}})[_0x2ac5('0x27')](respondWithResult(_0x1898bc,null))[_0x2ac5('0xac')](handleError(_0x1898bc,null));};exports[_0x2ac5('0xb7')]=function(_0x54157b,_0x4aa44b,_0x45b370){var _0xc65c98={'raw':![],'where':{}};var _0x150082={};var _0x274425={'count':0x0,'rows':[]};return db[_0x2ac5('0x33')][_0x2ac5('0xb8')]({'where':{'id':_0x54157b[_0x2ac5('0xae')]['id']}})['then'](handleEntityNotFound(_0x4aa44b,null))[_0x2ac5('0x27')](function(_0x2c6cd0){if(_0x2c6cd0){_0x150082['model']=_[_0x2ac5('0x38')](db[_0x2ac5('0xb3')]['rawAttributes']);_0x150082[_0x2ac5('0x37')]=_['keys'](_0x54157b['query']);_0x150082[_0x2ac5('0x40')]=_[_0x2ac5('0x39')](_0x150082[_0x2ac5('0x36')],_0x150082[_0x2ac5('0x37')]);_0xc65c98[_0x2ac5('0x3a')]=_[_0x2ac5('0x39')](_0x150082[_0x2ac5('0x36')],qs[_0x2ac5('0x3b')](_0x54157b['query'][_0x2ac5('0x3b')]));_0xc65c98[_0x2ac5('0x3a')]=_0xc65c98[_0x2ac5('0x3a')][_0x2ac5('0x3c')]?_0xc65c98['attributes']:_0x150082[_0x2ac5('0x36')];if(!_0x54157b[_0x2ac5('0x37')][_0x2ac5('0xb9')](_0x2ac5('0x3d'))){_0xc65c98[_0x2ac5('0x21')]=qs['limit'](_0x54157b[_0x2ac5('0x37')][_0x2ac5('0x21')]);_0xc65c98[_0x2ac5('0x1f')]=qs[_0x2ac5('0x1f')](_0x54157b[_0x2ac5('0x37')][_0x2ac5('0x1f')]);}_0xc65c98[_0x2ac5('0x85')]=qs['sort'](_0x54157b[_0x2ac5('0x37')][_0x2ac5('0x3e')]);_0xc65c98['where']=qs[_0x2ac5('0x40')](_[_0x2ac5('0x41')](_0x54157b[_0x2ac5('0x37')],_0x150082[_0x2ac5('0x40')]));_0xc65c98[_0x2ac5('0x3f')][_0x2ac5('0xa9')]=_0x2c6cd0['id'];if(_0x54157b[_0x2ac5('0x37')][_0x2ac5('0x7a')]){_0xc65c98[_0x2ac5('0x3f')]=_[_0x2ac5('0x91')](_0xc65c98['where'],{'$or':_[_0x2ac5('0x2d')](_0xc65c98[_0x2ac5('0x3a')],function(_0x5d19ca){var _0x3d7b93={};_0x3d7b93[_0x5d19ca]={'$like':'%'+_0x54157b[_0x2ac5('0x37')]['filter']+'%'};return _0x3d7b93;})});}if(_0x54157b[_0x2ac5('0x37')][_0x2ac5('0xba')]){var _0x565fc3=_0x54157b[_0x2ac5('0x37')][_0x2ac5('0xba')]['split'](',');var _0x3b358d={};_0x3b358d[_0x565fc3[0x0]]={'$gte':moment(_0x565fc3[0x1])['format'](_0x2ac5('0xbb'))};_0xc65c98['where']=_[_0x2ac5('0x91')](_0xc65c98[_0x2ac5('0x3f')],_0x3b358d);}_0xc65c98=_[_0x2ac5('0x91')]({},_0xc65c98,_0x54157b[_0x2ac5('0xbc')]);return db[_0x2ac5('0xb3')][_0x2ac5('0x22')]({'where':_0xc65c98['where']})[_0x2ac5('0x27')](function(_0x4c6fba){_0x274425['count']=_0x4c6fba;if(_0x54157b[_0x2ac5('0x37')][_0x2ac5('0xaf')]){_0xc65c98['include']=[{'all':!![]}];}return db[_0x2ac5('0xb3')]['findAll'](_0xc65c98);})[_0x2ac5('0x27')](function(_0x4f7539){_0x274425[_0x2ac5('0xab')]=_0x4f7539;return _0x274425;});}})[_0x2ac5('0x27')](respondWithFilteredResult(_0x4aa44b,_0xc65c98))['catch'](handleError(_0x4aa44b,null));};exports[_0x2ac5('0xbd')]=function(_0x1cbcf8,_0x2b5693,_0x4a3ecc){return db[_0x2ac5('0x33')][_0x2ac5('0x56')]({'where':{'id':_0x1cbcf8[_0x2ac5('0xae')]['id']}})[_0x2ac5('0x27')](handleEntityNotFound(_0x2b5693,null))[_0x2ac5('0x27')](function(_0x2d0f59){if(_0x2d0f59){return _0x2d0f59['setTags'](_0x1cbcf8[_0x2ac5('0x6b')][_0x2ac5('0xb5')],_[_0x2ac5('0xb6')](_0x1cbcf8[_0x2ac5('0x6b')],[_0x2ac5('0xb5'),'id'])||{})[_0x2ac5('0xbe')](function(){return db[_0x2ac5('0x65')][_0x2ac5('0xbf')]({'attributes':['id',_0x2ac5('0x2c'),_0x2ac5('0x44')],'where':{'id':_0x1cbcf8[_0x2ac5('0x6b')][_0x2ac5('0xb5')]}});})[_0x2ac5('0x27')](function(_0x372cc0){socket[_0x2ac5('0xc0')](_0x2ac5('0xc1'),{'id':Number(_0x1cbcf8['params']['id']),'tags':_0x372cc0||[]});return{'id':Number(_0x1cbcf8['params']['id']),'tags':_0x372cc0||[]};});}})[_0x2ac5('0x27')](respondWithResult(_0x2b5693,null))['catch'](handleError(_0x2b5693,null));};exports[_0x2ac5('0xc2')]=function(_0x27fd6f,_0x459e41,_0x26ef8c){return db[_0x2ac5('0x33')][_0x2ac5('0x56')]({'where':{'id':_0x27fd6f[_0x2ac5('0xae')]['id']}})[_0x2ac5('0x27')](handleEntityNotFound(_0x459e41,null))[_0x2ac5('0x27')](function(_0xce389a){if(_0xce389a){return _0xce389a[_0x2ac5('0xc2')](_0x27fd6f['query']['ids']);}})[_0x2ac5('0x27')](respondWithStatusCode(_0x459e41,null))[_0x2ac5('0xac')](handleError(_0x459e41,null));};exports[_0x2ac5('0xc3')]=function(_0x5c316b,_0x284f1b){var _0x3c7829=moment()[_0x2ac5('0xc4')]()[_0x2ac5('0xa6')]();var _0x58c3db=path[_0x2ac5('0xc5')](config[_0x2ac5('0xc6')],_0x2ac5('0xc7'),_0x2ac5('0xc8'),_0x2ac5('0xc9'));var _0x2d6609=path[_0x2ac5('0xc5')](config[_0x2ac5('0xc6')],_0x2ac5('0xc7'),'files',_0x2ac5('0xca'));var _0x386027=path[_0x2ac5('0xc5')](_0x58c3db,_0x3c7829);var _0x39f242=util[_0x2ac5('0xcb')]('transcript-%d-%s.zip',_0x5c316b['params']['id'],_0x3c7829);var _0x371a4f=path[_0x2ac5('0xc5')](_0x58c3db,_0x39f242);var _0x21459a=[];_0x21459a['push']({'model':db['User'],'as':_0x2ac5('0x67'),'attributes':['id',_0x2ac5('0x2e')],'raw':!![]});_0x21459a[_0x2ac5('0xcc')]({'model':db[_0x2ac5('0xcd')],'as':_0x2ac5('0x5b'),'attributes':['id',_0x2ac5('0xce'),_0x2ac5('0xcf')],'raw':!![]});if(_0x5c316b['query'][_0x2ac5('0xca')]){_0x21459a[_0x2ac5('0xcc')]({'model':db[_0x2ac5('0xd0')],'as':_0x2ac5('0xd0'),'raw':!![]});}var _0x45e361=[{'model':db[_0x2ac5('0xb3')],'as':_0x2ac5('0xd1'),'attributes':['id',_0x2ac5('0x6b'),_0x2ac5('0x71'),_0x2ac5('0xd2'),'secret',_0x2ac5('0x76')],'include':_0x21459a}];_0x45e361['push']({'model':db[_0x2ac5('0xd3')],'as':'Account','attributes':['id',_0x2ac5('0x2c')]});_0x45e361['push']({'model':db[_0x2ac5('0x67')],'as':'Owner','attributes':['id',_0x2ac5('0x2e')]});return db[_0x2ac5('0x33')][_0x2ac5('0x56')]({'where':{'id':_0x5c316b['params']['id']},'include':_0x45e361})['then'](handleEntityNotFound(_0x284f1b,null))['then'](function(_0xb53934){if(_0xb53934){var _0x52912f=_0xb53934[_0x2ac5('0xd4')]({'plain':!![]});fs[_0x2ac5('0xd5')](_0x386027);var _0x1d43da={'channel':_0x2ac5('0xd6'),'account':_0x52912f[_0x2ac5('0xd7')]['name'],'agent':_0x52912f[_0x2ac5('0xd8')]?_0x52912f['Owner'][_0x2ac5('0x2e')]:_0x2ac5('0xd9'),'createdAt':moment(_0x52912f[_0x2ac5('0x71')])[_0x2ac5('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2ac5('0xa6')](),'closedAt':_0x52912f[_0x2ac5('0xda')]?moment(_0x52912f[_0x2ac5('0xdb')])[_0x2ac5('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2ac5('0xa6')]():'','disposition':_0x52912f['disposition'],'messages':_(_0x52912f['Messages'])[_0x2ac5('0x7a')]({'secret':![]})[_0x2ac5('0x2d')](function(_0x4adfdb){if(_0x4adfdb[_0x2ac5('0xd0')]){var _0x41708c=path[_0x2ac5('0xc5')](_0x2d6609,_0x4adfdb[_0x2ac5('0xd0')][_0x2ac5('0xdc')]);if(fs[_0x2ac5('0xdd')](_0x41708c)){fs[_0x2ac5('0xde')](_0x41708c)[_0x2ac5('0xdf')](fs['createWriteStream'](path[_0x2ac5('0xc5')](_0x386027,_0x4adfdb[_0x2ac5('0xd0')][_0x2ac5('0xdc')])));}}return{'date':moment(_0x4adfdb['createdAt'])[_0x2ac5('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2ac5('0xa6')](),'sender':_0x4adfdb['direction']===_0x2ac5('0xe0')?_0x4adfdb[_0x2ac5('0x67')]?_0x4adfdb[_0x2ac5('0x67')][_0x2ac5('0x2e')]:_0x2ac5('0xe1'):_0x4adfdb['Contact'][_0x2ac5('0xce')]+(_0x4adfdb[_0x2ac5('0x5b')][_0x2ac5('0xcf')]?'\x20'+_0x4adfdb[_0x2ac5('0x5b')][_0x2ac5('0xcf')]:''),'body':_0x4adfdb['Attachment']?_0x4adfdb[_0x2ac5('0xd0')][_0x2ac5('0xdc')]:_0x4adfdb[_0x2ac5('0x6b')],'direction':_0x4adfdb[_0x2ac5('0xd2')]==='out'?'A':'C','secret':_0x4adfdb[_0x2ac5('0xe2')],'read':_0x4adfdb['read'],'attachment':_0x4adfdb[_0x2ac5('0xd0')]};})[_0x2ac5('0x57')]()};return ejs[_0x2ac5('0xe3')](path[_0x2ac5('0xc5')](config['root'],'server','views',_0x2ac5('0xe4')),{'interaction':_0x1d43da})[_0x2ac5('0x27')](function(_0x30a932){var _0x30ac2e=path[_0x2ac5('0xc5')](_0x386027,_0x2ac5('0xe5')+_0x52912f['id']+'-'+_0x3c7829+_0x2ac5('0xe6'));var _0x2e2d08={'path':_0x30ac2e,'channel':'Whatsapp','interactionId':_0x52912f['id']};return pdf[_0x2ac5('0xe7')](_0x30a932,_0x2e2d08);})[_0x2ac5('0x27')](function(){return new BPromise(function(_0x558c2b,_0x4d88d9){zipdir(_0x386027,{'saveTo':_0x371a4f},function(_0x4e2af1,_0x5ca0ff){if(_0x4e2af1)return _0x4d88d9(_0x4e2af1);return _0x558c2b(_0x5ca0ff);});})['then'](function(){return new BPromise(function(_0x26dca4,_0x2b0010){rimraf(_0x386027,function(_0x87a847){if(_0x87a847)_0x2b0010(_0x87a847);return _0x26dca4();});});})[_0x2ac5('0x27')](function(){return _0x284f1b['download'](_0x371a4f,_0x39f242,function(_0x331b7f){if(_0x331b7f){console[_0x2ac5('0xe8')](_0x2ac5('0xe9'),_0x331b7f);}else{fs[_0x2ac5('0xea')](_0x371a4f);}});});});}else{return _0x284f1b[_0x2ac5('0x29')](0xc8);}})['catch'](handleError(_0x284f1b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 82316ec..2641304 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 _0x1bd1=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','then','setDataValue','Users','map','findAll'];(function(_0x4b9c83,_0x3e6e05){var _0x2ee121=function(_0x5d7572){while(--_0x5d7572){_0x4b9c83['push'](_0x4b9c83['shift']());}};_0x2ee121(++_0x3e6e05);}(_0x1bd1,0x123));var _0x11bd=function(_0x47d949,_0x43e42e){_0x47d949=_0x47d949-0x0;var _0x23dbe6=_0x1bd1[_0x47d949];return _0x23dbe6;};'use strict';var EventEmitter=require(_0x11bd('0x0'));var WhatsappInteraction=require(_0x11bd('0x1'))['db'][_0x11bd('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x11bd('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f41c3){return function(_0x31869a,_0x336fd5,_0x612ff3){_0x31869a['getUsers']({'attributes':['id'],'raw':!![]})[_0x11bd('0x4')](function(_0x1f813c){_0x31869a[_0x11bd('0x5')](_0x11bd('0x6'),_0x1f813c[_0x11bd('0x7')](function(_0x4e514c){return{'id':_0x4e514c['id']};}));return WhatsappMessage[_0x11bd('0x8')]({'where':{'WhatsappInteractionId':_0x31869a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4b3471){_0x31869a[_0x11bd('0x5')](_0x11bd('0x9'),_0x4b3471[_0x11bd('0xa')]);WhatsappInteractionEvents[_0x11bd('0xb')](_0x1f41c3+':'+_0x31869a['id'],_0x31869a);WhatsappInteractionEvents[_0x11bd('0xb')](_0x1f41c3,_0x31869a);_0x612ff3(null);})[_0x11bd('0xc')](_0x612ff3(null));};}for(var e in events){if(events[_0x11bd('0xd')](e)){var event=events[e];WhatsappInteraction[_0x11bd('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x6427=['setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x447db4,_0x1ba7b2){var _0x2f7a9c=function(_0x566eb7){while(--_0x566eb7){_0x447db4['push'](_0x447db4['shift']());}};_0x2f7a9c(++_0x1ba7b2);}(_0x6427,0xbe));var _0x7642=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x6427[_0xdea41a];return _0x15d0d8;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x7642('0x0'))['db'][_0x7642('0x1')];var WhatsappMessage=require(_0x7642('0x0'))['db'][_0x7642('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7642('0x3')](0x0);var events={'afterCreate':_0x7642('0x4'),'afterUpdate':'update','afterDestroy':_0x7642('0x5')};function emitEvent(_0x33af1f){return function(_0x2e50e2,_0x279f07,_0x2e2fa7){_0x2e50e2[_0x7642('0x6')]({'attributes':['id'],'raw':!![]})[_0x7642('0x7')](function(_0x266b9b){_0x2e50e2[_0x7642('0x8')](_0x7642('0x9'),_0x266b9b['map'](function(_0x498c0d){return{'id':_0x498c0d['id']};}));return WhatsappMessage[_0x7642('0xa')]({'where':{'WhatsappInteractionId':_0x2e50e2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7642('0x7')](function(_0x1ef8d3){_0x2e50e2[_0x7642('0x8')](_0x7642('0xb'),_0x1ef8d3[_0x7642('0xc')]);WhatsappInteractionEvents[_0x7642('0xd')](_0x33af1f+':'+_0x2e50e2['id'],_0x2e50e2);WhatsappInteractionEvents[_0x7642('0xd')](_0x33af1f,_0x2e50e2);_0x2e2fa7(null);})[_0x7642('0xe')](_0x2e2fa7(null));};}for(var e in events){if(events[_0x7642('0xf')](e)){var event=events[e];WhatsappInteraction[_0x7642('0x10')](e,emitEvent(event));}}module[_0x7642('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0a097be..700fae0 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 _0xb503=['../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3db557,_0x3dbcd1){var _0x2c788d=function(_0x250179){while(--_0x250179){_0x3db557['push'](_0x3db557['shift']());}};_0x2c788d(++_0x3dbcd1);}(_0xb503,0x161));var _0x3b50=function(_0xeb795d,_0x194f88){_0xeb795d=_0xeb795d-0x0;var _0x37eadf=_0xb503[_0xeb795d];return _0x37eadf;};'use strict';var _=require(_0x3b50('0x0'));var util=require(_0x3b50('0x1'));var logger=require(_0x3b50('0x2'))(_0x3b50('0x3'));var moment=require(_0x3b50('0x4'));var BPromise=require(_0x3b50('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3b50('0x6'));var config=require(_0x3b50('0x7'));var attributes=require(_0x3b50('0x8'));module[_0x3b50('0x9')]=function(_0x13c98d,_0x158013){return _0x13c98d[_0x3b50('0xa')]('WhatsappInteraction',attributes,{'tableName':_0x3b50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c170c,_0x1e050a,_0x44ad61){if(_0x4c170c[_0x3b50('0xc')]('closed')){_0x4c170c['closedAt']=moment()[_0x3b50('0xd')](_0x3b50('0xe'));}_0x44ad61(null,_0x4c170c);}}});}; \ No newline at end of file +var _0x1564=['rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','closed','closedAt','format','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x35c2fc,_0xabea37){var _0x4727fd=function(_0x4eccfe){while(--_0x4eccfe){_0x35c2fc['push'](_0x35c2fc['shift']());}};_0x4727fd(++_0xabea37);}(_0x1564,0x125));var _0x4156=function(_0x3bc541,_0x52d4ec){_0x3bc541=_0x3bc541-0x0;var _0x1a873d=_0x1564[_0x3bc541];return _0x1a873d;};'use strict';var _=require(_0x4156('0x0'));var util=require(_0x4156('0x1'));var logger=require(_0x4156('0x2'))(_0x4156('0x3'));var moment=require('moment');var BPromise=require(_0x4156('0x4'));var rp=require(_0x4156('0x5'));var fs=require('fs');var path=require(_0x4156('0x6'));var rimraf=require(_0x4156('0x7'));var config=require(_0x4156('0x8'));var attributes=require(_0x4156('0x9'));module[_0x4156('0xa')]=function(_0x1cea57,_0x5d825b){return _0x1cea57['define']('WhatsappInteraction',attributes,{'tableName':_0x4156('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x492aec,_0x347f0e,_0x343aec){if(_0x492aec['changed'](_0x4156('0xc'))){_0x492aec[_0x4156('0xd')]=moment()[_0x4156('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x343aec(null,_0x492aec);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 39507aa..10eb454 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 _0x94d4=['where','attributes','limit','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','then','body','ids','omit','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','UpdateWhatsappInteraction','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94d4,0xac));var _0x494d=function(_0x2f7f78,_0x5368a4){_0x2f7f78=_0x2f7f78-0x0;var _0x58dd11=_0x94d4[_0x2f7f78];return _0x58dd11;};'use strict';var _=require('lodash');var util=require(_0x494d('0x0'));var moment=require(_0x494d('0x1'));var BPromise=require('bluebird');var rs=require(_0x494d('0x2'));var fs=require('fs');var Redis=require(_0x494d('0x3'));var db=require(_0x494d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x494d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x494d('0x6'));var client=jayson[_0x494d('0x7')][_0x494d('0x8')]({'port':0x232a});config[_0x494d('0x9')]=_[_0x494d('0xa')](config['redis'],{'host':_0x494d('0xb'),'port':0x18eb});var socket=require(_0x494d('0xc'))(new Redis(config[_0x494d('0x9')]));require('./whatsappInteraction.socket')[_0x494d('0xd')](socket);function respondWithRpcPromise(_0x34db42,_0x4233b6,_0x2c902b){return new BPromise(function(_0xc5deb7,_0x16b581){return client[_0x494d('0xe')](_0x34db42,_0x2c902b)['then'](function(_0x4751e4){logger[_0x494d('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x4233b6,_0x494d('0x10'));logger[_0x494d('0x11')](_0x494d('0x12'),_0x4233b6,'request\x20sent',JSON[_0x494d('0x13')](_0x4751e4));if(_0x4751e4['error']){if(_0x4751e4[_0x494d('0x14')][_0x494d('0x15')]===0x1f4){logger[_0x494d('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x4233b6,_0x4751e4[_0x494d('0x14')][_0x494d('0x16')]);return _0x16b581(_0x4751e4[_0x494d('0x14')]['message']);}logger[_0x494d('0x14')](_0x494d('0x17'),_0x4233b6,_0x4751e4[_0x494d('0x14')][_0x494d('0x16')]);return _0xc5deb7(_0x4751e4[_0x494d('0x14')][_0x494d('0x16')]);}else{logger[_0x494d('0xf')](_0x494d('0x17'),_0x4233b6,_0x494d('0x10'));_0xc5deb7(_0x4751e4[_0x494d('0x18')][_0x494d('0x16')]);}})['catch'](function(_0x397a04){logger[_0x494d('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x4233b6,_0x397a04);_0x16b581(_0x397a04);});});}exports[_0x494d('0x19')]=function(_0xa12154){var _0x337164=this;return new Promise(function(_0x2b1646,_0x2eeb61){return db['WhatsappInteraction']['update'](_0xa12154['body'],{'raw':_0xa12154[_0x494d('0x1a')]?_0xa12154['options'][_0x494d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa12154[_0x494d('0x1a')]?_0xa12154[_0x494d('0x1a')][_0x494d('0x1c')]||null:null,'attributes':_0xa12154[_0x494d('0x1a')]?_0xa12154[_0x494d('0x1a')][_0x494d('0x1d')]||null:null,'limit':_0xa12154[_0x494d('0x1a')]?_0xa12154[_0x494d('0x1a')][_0x494d('0x1e')]||null:null})['then'](function(_0x16e15b){logger['info']('UpdateWhatsappInteraction',_0xa12154);logger[_0x494d('0x11')](_0x494d('0x19'),_0xa12154,JSON[_0x494d('0x13')](_0x16e15b));_0x2b1646(_0x16e15b);})[_0x494d('0x1f')](function(_0x27609d){logger[_0x494d('0x14')](_0x494d('0x19'),_0x27609d[_0x494d('0x16')],_0xa12154);_0x2eeb61(_0x337164[_0x494d('0x14')](0x1f4,_0x27609d['message']));});});};exports[_0x494d('0x20')]=function(_0x3d0f2d){return new Promise(function(_0x12f15f,_0x32e728){return db[_0x494d('0x21')][_0x494d('0x22')]({'where':_0x3d0f2d[_0x494d('0x1a')]?_0x3d0f2d[_0x494d('0x1a')]['where']||null:null})[_0x494d('0x23')](function(_0x98b001){if(_0x98b001){return _0x98b001['addTags'](_0x3d0f2d[_0x494d('0x24')][_0x494d('0x25')],_[_0x494d('0x26')](_0x3d0f2d['body'],['ids','id'])||{});}})['spread'](function(_0x5786b1){logger[_0x494d('0xf')](_0x494d('0x27'),_0x3d0f2d);logger['debug'](_0x494d('0x27'),_0x3d0f2d,JSON[_0x494d('0x13')](_0x5786b1));_0x12f15f(_0x5786b1);})[_0x494d('0x1f')](function(_0x58dc58){logger[_0x494d('0x14')](_0x494d('0x27'),_0x58dc58[_0x494d('0x16')],_0x3d0f2d);_0x32e728(_this[_0x494d('0x14')](0x1f4,_0x58dc58[_0x494d('0x16')]));});});}; \ No newline at end of file +var _0xf737=['AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','limit','info'];(function(_0xecf650,_0x7c7241){var _0x386611=function(_0x3ccb6d){while(--_0x3ccb6d){_0xecf650['push'](_0xecf650['shift']());}};_0x386611(++_0x7c7241);}(_0xf737,0x81));var _0x7f73=function(_0x5307ed,_0x6357b){_0x5307ed=_0x5307ed-0x0;var _0x163bab=_0xf737[_0x5307ed];return _0x163bab;};'use strict';var _=require(_0x7f73('0x0'));var util=require(_0x7f73('0x1'));var moment=require('moment');var BPromise=require(_0x7f73('0x2'));var rs=require(_0x7f73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f73('0x4'))(_0x7f73('0x5'));var config=require(_0x7f73('0x6'));var jayson=require(_0x7f73('0x7'));var client=jayson[_0x7f73('0x8')][_0x7f73('0x9')]({'port':0x232a});config[_0x7f73('0xa')]=_[_0x7f73('0xb')](config[_0x7f73('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f73('0xc'))(new Redis(config['redis']));require(_0x7f73('0xd'))[_0x7f73('0xe')](socket);function respondWithRpcPromise(_0x15bd63,_0x1237a6,_0x11e6e5){return new BPromise(function(_0x502b10,_0x392904){return client[_0x7f73('0xf')](_0x15bd63,_0x11e6e5)[_0x7f73('0x10')](function(_0x241cf8){logger['info'](_0x7f73('0x11'),_0x1237a6,_0x7f73('0x12'));logger[_0x7f73('0x13')](_0x7f73('0x14'),_0x1237a6,'request\x20sent',JSON[_0x7f73('0x15')](_0x241cf8));if(_0x241cf8[_0x7f73('0x16')]){if(_0x241cf8['error'][_0x7f73('0x17')]===0x1f4){logger[_0x7f73('0x16')](_0x7f73('0x11'),_0x1237a6,_0x241cf8[_0x7f73('0x16')][_0x7f73('0x18')]);return _0x392904(_0x241cf8[_0x7f73('0x16')][_0x7f73('0x18')]);}logger[_0x7f73('0x16')](_0x7f73('0x11'),_0x1237a6,_0x241cf8[_0x7f73('0x16')][_0x7f73('0x18')]);return _0x502b10(_0x241cf8[_0x7f73('0x16')]['message']);}else{logger['info'](_0x7f73('0x11'),_0x1237a6,_0x7f73('0x12'));_0x502b10(_0x241cf8[_0x7f73('0x19')][_0x7f73('0x18')]);}})[_0x7f73('0x1a')](function(_0x2eaffa){logger[_0x7f73('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x1237a6,_0x2eaffa);_0x392904(_0x2eaffa);});});}exports[_0x7f73('0x1b')]=function(_0x2ee1ed){var _0x2b467e=this;return new Promise(function(_0x1ba727,_0xc45dd6){return db[_0x7f73('0x1c')][_0x7f73('0x1d')](_0x2ee1ed[_0x7f73('0x1e')],{'raw':_0x2ee1ed['options']?_0x2ee1ed[_0x7f73('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee1ed['options']?_0x2ee1ed[_0x7f73('0x1f')][_0x7f73('0x20')]||null:null,'attributes':_0x2ee1ed[_0x7f73('0x1f')]?_0x2ee1ed[_0x7f73('0x1f')]['attributes']||null:null,'limit':_0x2ee1ed[_0x7f73('0x1f')]?_0x2ee1ed['options'][_0x7f73('0x21')]||null:null})[_0x7f73('0x10')](function(_0x49b7e2){logger[_0x7f73('0x22')](_0x7f73('0x1b'),_0x2ee1ed);logger['debug'](_0x7f73('0x1b'),_0x2ee1ed,JSON['stringify'](_0x49b7e2));_0x1ba727(_0x49b7e2);})[_0x7f73('0x1a')](function(_0x4d90c3){logger[_0x7f73('0x16')](_0x7f73('0x1b'),_0x4d90c3['message'],_0x2ee1ed);_0xc45dd6(_0x2b467e[_0x7f73('0x16')](0x1f4,_0x4d90c3['message']));});});};exports[_0x7f73('0x23')]=function(_0x2e6ab8){return new Promise(function(_0xa55445,_0x459f5c){return db[_0x7f73('0x1c')]['find']({'where':_0x2e6ab8['options']?_0x2e6ab8[_0x7f73('0x1f')][_0x7f73('0x20')]||null:null})['then'](function(_0x3a5097){if(_0x3a5097){return _0x3a5097[_0x7f73('0x24')](_0x2e6ab8[_0x7f73('0x1e')][_0x7f73('0x25')],_[_0x7f73('0x26')](_0x2e6ab8[_0x7f73('0x1e')],['ids','id'])||{});}})[_0x7f73('0x27')](function(_0x3ab01b){logger['info'](_0x7f73('0x28'),_0x2e6ab8);logger['debug'](_0x7f73('0x28'),_0x2e6ab8,JSON[_0x7f73('0x15')](_0x3ab01b));_0xa55445(_0x3ab01b);})[_0x7f73('0x1a')](function(_0x11e112){logger[_0x7f73('0x16')]('AddTags',_0x11e112[_0x7f73('0x18')],_0x2e6ab8);_0x459f5c(_this[_0x7f73('0x16')](0x1f4,_0x11e112[_0x7f73('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1a897e0..820b259 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 _0x6b70=['emit','register','length','./whatsappInteraction.events','save','update'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x6b70,0x19b));var _0x06b7=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0x6b70[_0x415f7e];return _0x311ff4;};'use strict';var WhatsappInteractionEvents=require(_0x06b7('0x0'));var events=[_0x06b7('0x1'),'remove',_0x06b7('0x2')];function createListener(_0x3d7297,_0x36d8f1){return function(_0x5f13f1){_0x36d8f1[_0x06b7('0x3')](_0x3d7297,_0x5f13f1);};}function removeListener(_0x5c3477,_0x5dac7e){return function(){WhatsappInteractionEvents['removeListener'](_0x5c3477,_0x5dac7e);};}exports[_0x06b7('0x4')]=function(_0x1e6cc5){for(var _0xb746b2=0x0,_0x50d583=events[_0x06b7('0x5')];_0xb746b2<_0x50d583;_0xb746b2++){var _0x54550a=events[_0xb746b2];var _0x271c02=createListener('whatsappInteraction:'+_0x54550a,_0x1e6cc5);WhatsappInteractionEvents['on'](_0x54550a,_0x271c02);}}; \ No newline at end of file +var _0x6ced=['emit','removeListener','register','length','whatsappInteraction:','save','remove','update'];(function(_0x30d345,_0x537bb1){var _0x14ea01=function(_0x364a56){while(--_0x364a56){_0x30d345['push'](_0x30d345['shift']());}};_0x14ea01(++_0x537bb1);}(_0x6ced,0x75));var _0xd6ce=function(_0x307107,_0x33abcd){_0x307107=_0x307107-0x0;var _0x93a3dc=_0x6ced[_0x307107];return _0x93a3dc;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xd6ce('0x0'),_0xd6ce('0x1'),_0xd6ce('0x2')];function createListener(_0x234df5,_0x35ce4f){return function(_0x3754df){_0x35ce4f[_0xd6ce('0x3')](_0x234df5,_0x3754df);};}function removeListener(_0x5828f5,_0x2adf48){return function(){WhatsappInteractionEvents[_0xd6ce('0x4')](_0x5828f5,_0x2adf48);};}exports[_0xd6ce('0x5')]=function(_0x11bb3c){for(var _0xa82533=0x0,_0x445a5a=events[_0xd6ce('0x6')];_0xa82533<_0x445a5a;_0xa82533++){var _0x25e244=events[_0xa82533];var _0x53b3f3=createListener(_0xd6ce('0x7')+_0x25e244,_0x11bb3c);WhatsappInteractionEvents['on'](_0x25e244,_0x53b3f3);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5c5cbd3..3e7453f 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 _0x820b=['index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','put','update','/:id/accept','/:id/reject','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x480cca,_0x33709f){var _0x22bcdb=function(_0x15ab17){while(--_0x15ab17){_0x480cca['push'](_0x480cca['shift']());}};_0x22bcdb(++_0x33709f);}(_0x820b,0x13a));var _0xb820=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x820b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb820('0x0'));var util=require(_0xb820('0x1'));var path=require('path');var timeout=require(_0xb820('0x2'));var express=require(_0xb820('0x3'));var router=express[_0xb820('0x4')]();var fs_extra=require(_0xb820('0x5'));var auth=require(_0xb820('0x6'));var interaction=require(_0xb820('0x7'));var config=require(_0xb820('0x8'));var controller=require('./whatsappMessage.controller');router[_0xb820('0x9')]('/',auth[_0xb820('0xa')](),controller[_0xb820('0xb')]);router[_0xb820('0x9')](_0xb820('0xc'),auth[_0xb820('0xa')](),controller['describe']);router[_0xb820('0x9')](_0xb820('0xd'),auth[_0xb820('0xa')](),controller[_0xb820('0xe')]);router[_0xb820('0xf')]('/',auth[_0xb820('0xa')](),interaction[_0xb820('0x10')](_0xb820('0x11'),_0xb820('0x12')),controller['create']);router['post']('/:id/status',controller['status']);router[_0xb820('0x13')](_0xb820('0xd'),auth['isAuthenticated'](),controller[_0xb820('0x14')]);router['put'](_0xb820('0x15'),auth[_0xb820('0xa')](),controller['accept']);router[_0xb820('0x13')](_0xb820('0x16'),auth[_0xb820('0xa')](),controller['reject']);router[_0xb820('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xb820('0x18')]);module['exports']=router; \ No newline at end of file +var _0xaeb6=['/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','reject','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xaeb6,0x1a0));var _0x6aeb=function(_0x234adb,_0x5601a9){_0x234adb=_0x234adb-0x0;var _0x1fde34=_0xaeb6[_0x234adb];return _0x1fde34;};'use strict';var multer=require('multer');var util=require(_0x6aeb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6aeb('0x1'));var router=express[_0x6aeb('0x2')]();var fs_extra=require(_0x6aeb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6aeb('0x4'));var config=require(_0x6aeb('0x5'));var controller=require(_0x6aeb('0x6'));router['get']('/',auth[_0x6aeb('0x7')](),controller['index']);router[_0x6aeb('0x8')](_0x6aeb('0x9'),auth[_0x6aeb('0x7')](),controller[_0x6aeb('0xa')]);router[_0x6aeb('0x8')](_0x6aeb('0xb'),auth[_0x6aeb('0x7')](),controller['show']);router[_0x6aeb('0xc')]('/',auth[_0x6aeb('0x7')](),interaction[_0x6aeb('0xd')](_0x6aeb('0xe'),_0x6aeb('0xf')),controller[_0x6aeb('0x10')]);router['post'](_0x6aeb('0x11'),controller[_0x6aeb('0x12')]);router['put'](_0x6aeb('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6aeb('0x13')](_0x6aeb('0x14'),auth[_0x6aeb('0x7')](),controller[_0x6aeb('0x15')]);router[_0x6aeb('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x6aeb('0x16')]);router['delete'](_0x6aeb('0xb'),auth[_0x6aeb('0x7')](),controller[_0x6aeb('0x17')]);module[_0x6aeb('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f5386e8..b28467e 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 _0x46e8=['TEXT','medium','BOOLEAN','STRING','DATE','sequelize','exports'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x46e8,0x1c5));var _0x846e=function(_0x1250d5,_0x400588){_0x1250d5=_0x1250d5-0x0;var _0x5158bf=_0x46e8[_0x1250d5];return _0x5158bf;};'use strict';var Sequelize=require(_0x846e('0x0'));module[_0x846e('0x1')]={'body':{'type':Sequelize[_0x846e('0x2')](_0x846e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x846e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x846e('0x5')](0xbe)},'phone':{'type':Sequelize[_0x846e('0x5')]},'readAt':{'type':Sequelize[_0x846e('0x6')]},'secret':{'type':Sequelize[_0x846e('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x846e('0x5')]},'providerResponse':{'type':Sequelize[_0x846e('0x2')]}}; \ No newline at end of file +var _0xa1ca=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa1ca,0x99));var _0xaa1c=function(_0x57ede0,_0x2c5e8c){_0x57ede0=_0x57ede0-0x0;var _0x60056=_0xa1ca[_0x57ede0];return _0x60056;};'use strict';var Sequelize=require(_0xaa1c('0x0'));module[_0xaa1c('0x1')]={'body':{'type':Sequelize[_0xaa1c('0x2')](_0xaa1c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xaa1c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaa1c('0x5')),'defaultValue':_0xaa1c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa1c('0x6')](0xbe)},'phone':{'type':Sequelize[_0xaa1c('0x6')]},'readAt':{'type':Sequelize[_0xaa1c('0x7')]},'secret':{'type':Sequelize[_0xaa1c('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaa1c('0x6')]},'providerResponse':{'type':Sequelize[_0xaa1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 625bfc9..961f783 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 _0xd590=['localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','update','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','event','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','twilio','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','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','redis','defaults'];(function(_0x57bf40,_0x2535a0){var _0x22b346=function(_0x47589f){while(--_0x47589f){_0x57bf40['push'](_0x57bf40['shift']());}};_0x22b346(++_0x2535a0);}(_0xd590,0x77));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0d59('0x0'));var rimraf=require(_0x0d59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d59('0x2'));var rp=require(_0x0d59('0x3'));var moment=require(_0x0d59('0x4'));var BPromise=require(_0x0d59('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0d59('0x6'));var csv=require(_0x0d59('0x7'));var ejs=require(_0x0d59('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d59('0x9'));var squel=require(_0x0d59('0xa'));var crypto=require(_0x0d59('0xb'));var jsforce=require(_0x0d59('0xc'));var deskjs=require(_0x0d59('0xd'));var toCsv=require(_0x0d59('0x7'));var querystring=require(_0x0d59('0xe'));var Papa=require(_0x0d59('0xf'));var Redis=require(_0x0d59('0x10'));var authService=require(_0x0d59('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0d59('0x12'));var hardwareService=require(_0x0d59('0x13'));var logger=require(_0x0d59('0x14'))(_0x0d59('0x15'));var utils=require(_0x0d59('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0d59('0x17'));var db=require(_0x0d59('0x18'))['db'];config[_0x0d59('0x19')]=_[_0x0d59('0x1a')](config['redis'],{'host':_0x0d59('0x1b'),'port':0x18eb});var socket=require(_0x0d59('0x1c'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x0d59('0x1d')](socket);var jayson=require(_0x0d59('0x1e'));var client=jayson[_0x0d59('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x0d59('0x1f')][_0x0d59('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1b60b8,_0x478120,_0x87c5c0,_0x13bb93){return new BPromise(function(_0x21d8fc,_0x44ee24){var _0x1147a8=_0x13bb93||client;return _0x1147a8[_0x0d59('0x21')](_0x1b60b8,_0x87c5c0)[_0x0d59('0x22')](function(_0x535bca){logger['info'](_0x0d59('0x23'),_0x478120,_0x0d59('0x24'));logger['debug'](_0x0d59('0x25'),_0x478120,_0x0d59('0x24'),JSON[_0x0d59('0x26')](_0x535bca));if(_0x535bca['error']){if(_0x535bca['error'][_0x0d59('0x27')]===0x1f4){logger['error'](_0x0d59('0x23'),_0x478120,_0x535bca[_0x0d59('0x28')][_0x0d59('0x29')]);return _0x44ee24(_0x535bca['error']['message']);}logger[_0x0d59('0x28')](_0x0d59('0x23'),_0x478120,_0x535bca['error'][_0x0d59('0x29')]);return _0x21d8fc(_0x535bca[_0x0d59('0x28')][_0x0d59('0x29')]);}else{logger[_0x0d59('0x2a')](_0x0d59('0x23'),_0x478120,'request\x20sent');_0x21d8fc(_0x535bca['result'][_0x0d59('0x29')]);}})[_0x0d59('0x2b')](function(_0x1fa79f){logger[_0x0d59('0x28')](_0x0d59('0x23'),_0x478120,_0x1fa79f);_0x44ee24(_0x1fa79f);});});}function respondWithStatusCode(_0x5f0360,_0x3115f9){_0x3115f9=_0x3115f9||0xcc;return function(_0x273a92){if(_0x273a92){return _0x5f0360[_0x0d59('0x2c')](_0x3115f9);}return _0x5f0360['status'](_0x3115f9)[_0x0d59('0x2d')]();};}function respondWithResult(_0x32a25b,_0x421e10){_0x421e10=_0x421e10||0xc8;return function(_0x4cc014){if(_0x4cc014){return _0x32a25b[_0x0d59('0x2e')](_0x421e10)['json'](_0x4cc014);}};}function respondWithFilteredResult(_0x5306cb,_0x5ba867){return function(_0x537335){if(_0x537335){var _0x404b9f=typeof _0x5ba867[_0x0d59('0x2f')]===_0x0d59('0x30')&&typeof _0x5ba867[_0x0d59('0x31')]===_0x0d59('0x30');var _0x3624cc=_0x537335[_0x0d59('0x32')];var _0x4a96df=_0x404b9f?0x0:_0x5ba867[_0x0d59('0x2f')];var _0x1ec830=_0x404b9f?_0x537335[_0x0d59('0x32')]:_0x5ba867['offset']+_0x5ba867[_0x0d59('0x31')];var _0x420c91;if(_0x1ec830>=_0x3624cc){_0x1ec830=_0x3624cc;_0x420c91=0xc8;}else{_0x420c91=0xce;}_0x5306cb[_0x0d59('0x2e')](_0x420c91);return _0x5306cb[_0x0d59('0x33')]('Content-Range',_0x4a96df+'-'+_0x1ec830+'/'+_0x3624cc)['json'](_0x537335);}return null;};}function patchUpdates(_0x12cdca){return function(_0x583218){try{jsonpatch[_0x0d59('0x34')](_0x583218,_0x12cdca,!![]);}catch(_0x343134){return BPromise[_0x0d59('0x35')](_0x343134);}return _0x583218['save']();};}function saveUpdates(_0x19f023,_0x27a851){return function(_0x19d3ea){if(_0x19d3ea){return _0x19d3ea['update'](_0x19f023)[_0x0d59('0x22')](function(_0x14a910){return _0x14a910;});}return null;};}function removeEntity(_0x3fd351,_0x2800ef){return function(_0x210e83){if(_0x210e83){return _0x210e83['destroy']()[_0x0d59('0x22')](function(){_0x3fd351[_0x0d59('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145f43,_0x2a3328){return function(_0x2525a2){if(!_0x2525a2){_0x145f43[_0x0d59('0x2c')](0x194);}return _0x2525a2;};}function handleError(_0x17e3c4,_0x151770){_0x151770=_0x151770||0x1f4;return function(_0x57f698){logger[_0x0d59('0x28')](_0x57f698[_0x0d59('0x36')]);if(_0x57f698[_0x0d59('0x37')]){delete _0x57f698['name'];}_0x17e3c4[_0x0d59('0x2e')](_0x151770)[_0x0d59('0x38')](_0x57f698);};}exports[_0x0d59('0x39')]=function(_0x7c4c97,_0x57823f){var _0x396d1f={},_0x3772a3={},_0x30d646={'count':0x0,'rows':[]};var _0x3bde3b=_[_0x0d59('0x3a')](db[_0x0d59('0x3b')][_0x0d59('0x3c')],function(_0x28d4ae){return{'name':_0x28d4ae[_0x0d59('0x3d')],'type':_0x28d4ae[_0x0d59('0x3e')][_0x0d59('0x3f')]};});_0x3772a3[_0x0d59('0x40')]=_[_0x0d59('0x3a')](_0x3bde3b,_0x0d59('0x37'));_0x3772a3[_0x0d59('0x41')]=_[_0x0d59('0x42')](_0x7c4c97['query']);_0x3772a3[_0x0d59('0x43')]=_['intersection'](_0x3772a3[_0x0d59('0x40')],_0x3772a3[_0x0d59('0x41')]);_0x396d1f['attributes']=_[_0x0d59('0x44')](_0x3772a3[_0x0d59('0x40')],qs[_0x0d59('0x45')](_0x7c4c97[_0x0d59('0x41')]['fields']));_0x396d1f[_0x0d59('0x46')]=_0x396d1f['attributes'][_0x0d59('0x47')]?_0x396d1f[_0x0d59('0x46')]:_0x3772a3[_0x0d59('0x40')];if(!_0x7c4c97[_0x0d59('0x41')][_0x0d59('0x48')](_0x0d59('0x49'))){_0x396d1f['limit']=qs[_0x0d59('0x31')](_0x7c4c97[_0x0d59('0x41')][_0x0d59('0x31')]);_0x396d1f[_0x0d59('0x2f')]=qs[_0x0d59('0x2f')](_0x7c4c97[_0x0d59('0x41')][_0x0d59('0x2f')]);}_0x396d1f[_0x0d59('0x4a')]=qs[_0x0d59('0x4b')](_0x7c4c97[_0x0d59('0x41')][_0x0d59('0x4b')]);_0x396d1f[_0x0d59('0x4c')]=qs[_0x0d59('0x43')](_[_0x0d59('0x4d')](_0x7c4c97[_0x0d59('0x41')],_0x3772a3['filters']),_0x3bde3b);if(_0x7c4c97[_0x0d59('0x41')][_0x0d59('0x4e')]){_0x396d1f[_0x0d59('0x4c')]=_[_0x0d59('0x4f')](_0x396d1f[_0x0d59('0x4c')],{'$or':_[_0x0d59('0x3a')](_0x3bde3b,function(_0x39996b){if(_0x39996b[_0x0d59('0x3e')]!==_0x0d59('0x50')){var _0xc600a={};_0xc600a[_0x39996b[_0x0d59('0x37')]]={'$like':'%'+_0x7c4c97[_0x0d59('0x41')][_0x0d59('0x4e')]+'%'};return _0xc600a;}})});}_0x396d1f=_[_0x0d59('0x4f')]({},_0x396d1f,_0x7c4c97[_0x0d59('0x51')]);var _0x4d0c83={'where':_0x396d1f[_0x0d59('0x4c')]};return db[_0x0d59('0x3b')]['count'](_0x4d0c83)[_0x0d59('0x22')](function(_0x4a940f){_0x30d646[_0x0d59('0x32')]=_0x4a940f;if(_0x7c4c97[_0x0d59('0x41')][_0x0d59('0x52')]){_0x396d1f[_0x0d59('0x53')]=[{'all':!![]}];}return db[_0x0d59('0x3b')][_0x0d59('0x54')](_0x396d1f);})['then'](function(_0x168011){_0x30d646[_0x0d59('0x55')]=_0x168011;return _0x30d646;})[_0x0d59('0x22')](respondWithFilteredResult(_0x57823f,_0x396d1f))[_0x0d59('0x2b')](handleError(_0x57823f,null));};exports[_0x0d59('0x56')]=function(_0x39f51f,_0x434568){var _0x4b83a0={'raw':!![],'where':{'id':_0x39f51f[_0x0d59('0x57')]['id']}},_0x45a687={};_0x45a687[_0x0d59('0x40')]=_['keys'](db['WhatsappMessage'][_0x0d59('0x3c')]);_0x45a687[_0x0d59('0x41')]=_['keys'](_0x39f51f['query']);_0x45a687[_0x0d59('0x43')]=_['intersection'](_0x45a687[_0x0d59('0x40')],_0x45a687[_0x0d59('0x41')]);_0x4b83a0[_0x0d59('0x46')]=_[_0x0d59('0x44')](_0x45a687[_0x0d59('0x40')],qs[_0x0d59('0x45')](_0x39f51f[_0x0d59('0x41')][_0x0d59('0x45')]));_0x4b83a0[_0x0d59('0x46')]=_0x4b83a0['attributes']['length']?_0x4b83a0[_0x0d59('0x46')]:_0x45a687[_0x0d59('0x40')];if(_0x39f51f[_0x0d59('0x41')][_0x0d59('0x52')]){_0x4b83a0['include']=[{'all':!![]}];}_0x4b83a0=_[_0x0d59('0x4f')]({},_0x4b83a0,_0x39f51f[_0x0d59('0x51')]);return db[_0x0d59('0x3b')][_0x0d59('0x58')](_0x4b83a0)['then'](handleEntityNotFound(_0x434568,null))['then'](respondWithResult(_0x434568,null))[_0x0d59('0x2b')](handleError(_0x434568,null));};exports[_0x0d59('0x59')]=function(_0x259614,_0x53941d){return db[_0x0d59('0x3b')][_0x0d59('0x59')](_0x259614['body'],{})['then'](respondWithResult(_0x53941d,0xc9))['catch'](handleError(_0x53941d,null));};exports[_0x0d59('0x5a')]=function(_0x36cda7,_0xd2d2f4){if(_0x36cda7[_0x0d59('0x5b')]['id']){delete _0x36cda7[_0x0d59('0x5b')]['id'];}return db[_0x0d59('0x3b')]['find']({'where':{'id':_0x36cda7[_0x0d59('0x57')]['id']}})[_0x0d59('0x22')](handleEntityNotFound(_0xd2d2f4,null))['then'](saveUpdates(_0x36cda7[_0x0d59('0x5b')],null))[_0x0d59('0x22')](respondWithResult(_0xd2d2f4,null))[_0x0d59('0x2b')](handleError(_0xd2d2f4,null));};exports[_0x0d59('0x5c')]=function(_0x1d4bd5,_0x283834){return db[_0x0d59('0x3b')][_0x0d59('0x58')]({'where':{'id':_0x1d4bd5[_0x0d59('0x57')]['id']}})[_0x0d59('0x22')](handleEntityNotFound(_0x283834,null))['then'](removeEntity(_0x283834,null))[_0x0d59('0x2b')](handleError(_0x283834,null));};exports[_0x0d59('0x5d')]=function(_0x25e23a,_0x277455){return db[_0x0d59('0x3b')][_0x0d59('0x5d')]()['then'](respondWithResult(_0x277455,null))[_0x0d59('0x2b')](handleError(_0x277455,null));};var interaction_log=require(_0x0d59('0x14'))(_0x0d59('0x5e'));exports[_0x0d59('0x5f')]=function(_0x223011,_0x3b2cd5,_0x2ef21e){var _0x2ac3af={'agent':{},'channel':_0x0d59('0x60')};if(_0x223011[_0x0d59('0x5b')]['id']){delete _0x223011[_0x0d59('0x5b')]['id'];}_0x223011[_0x0d59('0x5b')][_0x0d59('0x61')]=!![];_0x223011[_0x0d59('0x5b')][_0x0d59('0x62')]=moment()[_0x0d59('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x223011[_0x0d59('0x5b')][_0x0d59('0x64')]=_0x223011[_0x0d59('0x5b')][_0x0d59('0x64')]||_0x223011[_0x0d59('0x65')]['id'];_0x2ac3af[_0x0d59('0x66')]['id']=_0x223011[_0x0d59('0x5b')][_0x0d59('0x64')];return db['WhatsappMessage'][_0x0d59('0x58')]({'where':{'id':_0x223011['params']['id'],'UserId':null}})[_0x0d59('0x22')](handleEntityNotFound(_0x3b2cd5,null))[_0x0d59('0x22')](saveUpdates(_0x223011[_0x0d59('0x5b')],null))['then'](function(_0x54ecaa){if(_0x54ecaa){_0x2ac3af[_0x0d59('0x29')]=_0x54ecaa[_0x0d59('0x67')]({'plain':!![]});return db[_0x0d59('0x68')][_0x0d59('0x58')]({'where':{'id':_0x54ecaa[_0x0d59('0x69')]}});}return null;})[_0x0d59('0x22')](handleEntityNotFound(_0x3b2cd5,null))[_0x0d59('0x22')](function(_0x118961){if(_0x118961){return _0x118961[_0x0d59('0x5a')]({'UserId':_0x223011[_0x0d59('0x5b')][_0x0d59('0x64')],'read1stAt':_[_0x0d59('0x6a')](_0x118961[_0x0d59('0x6b')])?moment()[_0x0d59('0x63')](_0x0d59('0x6c')):undefined});}return null;})[_0x0d59('0x22')](function(_0xa1a243){if(_0xa1a243){_0x2ac3af[_0x0d59('0x6d')]=_0xa1a243[_0x0d59('0x67')]({'plain':!![]});interaction_log[_0x0d59('0x2a')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x223011[_0x0d59('0x65')]['id'],_0x223011['user']['name'],_0x223011[_0x0d59('0x65')][_0x0d59('0x6e')],_0x2ac3af[_0x0d59('0x6d')]['id'],_0x223011[_0x0d59('0x5b')]?JSON[_0x0d59('0x26')](_0x223011['body']):_0x0d59('0x6f'));return respondWithRpcPromise(_0x0d59('0x70'),_0x0d59('0x71'),_0x2ac3af);}return null;})['then'](function(_0x59e485){var _0xc177e7=_0x0d59('0x72')+_0x59e485[_0x0d59('0x29')][_0x0d59('0x73')];return db['sequelize'][_0x0d59('0x41')](_0xc177e7,{'type':db[_0x0d59('0x74')]['QueryTypes'][_0x0d59('0x75')],'raw':!![]})[_0x0d59('0x22')](function(_0x537c2e){return _0x537c2e;});})[_0x0d59('0x22')](function(_0x27b39b){if(_0x27b39b){_0x2ac3af[_0x0d59('0x29')]['contact']=_0x27b39b[0x0];if(!_0x223011[_0x0d59('0x5b')]['UserId'])return;return db[_0x0d59('0x76')]['find']({'where':{'id':_0x223011['body'][_0x0d59('0x64')],'role':'agent'},'attributes':['id',_0x0d59('0x37'),_0x0d59('0x77'),_0x0d59('0x78'),_0x0d59('0x79')],'raw':!![]});}return null;})['then'](function(_0x550439){if(!_0x550439)return null;_0x2ac3af[_0x0d59('0x29')]['agent']=_0x550439;return _0x2ac3af;})['then'](function(_0x1a73d4){if(_0x1a73d4){if(_0x223011[_0x0d59('0x5b')][_0x0d59('0x7a')]){_0x2ac3af[_0x0d59('0x29')][_0x0d59('0x7b')]=util[_0x0d59('0x63')](_0x0d59('0x7c'),_0x223011['user'][_0x0d59('0x37')]);_0x2ac3af['message'][_0x0d59('0x7d')]=_0x2ac3af[_0x0d59('0x7d')];_0x2ac3af[_0x0d59('0x29')][_0x0d59('0x7e')]=_0x2ac3af[_0x0d59('0x7d')];_0x2ac3af[_0x0d59('0x29')]['event']=_0x0d59('0x5f');return respondWithRpcPromise(_0x0d59('0x7f'),'EventManager',{'event':_0x0d59('0x80'),'message':_0x2ac3af[_0x0d59('0x29')]},client9002)[_0x0d59('0x22')](function(){return _0x2ac3af;});}return _0x2ac3af;}return null;})[_0x0d59('0x22')](respondWithResult(_0x3b2cd5,null))[_0x0d59('0x2b')](handleError(_0x3b2cd5,null));};var interaction_log=require('../../config/logger')(_0x0d59('0x5e'));exports[_0x0d59('0x35')]=function(_0x58aea1,_0x1515c5,_0x51f4c0){var _0x20ea76={'agent':{},'channel':'whatsapp'};if(_0x58aea1[_0x0d59('0x5b')]['id']){delete _0x58aea1[_0x0d59('0x5b')]['id'];}_0x58aea1['body']['UserId']=_0x58aea1['body'][_0x0d59('0x64')]||_0x58aea1[_0x0d59('0x65')]['id'];_0x20ea76[_0x0d59('0x66')]['id']=_0x58aea1['body'][_0x0d59('0x64')];return db[_0x0d59('0x3b')][_0x0d59('0x58')]({'where':{'id':_0x58aea1[_0x0d59('0x57')]['id'],'UserId':null}})[_0x0d59('0x22')](handleEntityNotFound(_0x1515c5,null))[_0x0d59('0x22')](function(_0x26ce5f){if(_0x26ce5f){_0x20ea76['message']=_0x26ce5f['get']({'plain':!![]});return db['WhatsappInteraction'][_0x0d59('0x58')]({'where':{'id':_0x26ce5f['WhatsappInteractionId']}});}return null;})[_0x0d59('0x22')](handleEntityNotFound(_0x1515c5,null))[_0x0d59('0x22')](function(_0x14f513){if(_0x14f513){_0x20ea76[_0x0d59('0x6d')]=_0x14f513[_0x0d59('0x67')]({'plain':!![]});interaction_log[_0x0d59('0x2a')](_0x0d59('0x81'),_0x58aea1['user']['id'],_0x58aea1[_0x0d59('0x65')][_0x0d59('0x37')],_0x58aea1[_0x0d59('0x65')]['role'],_0x20ea76[_0x0d59('0x6d')]['id'],_0x58aea1[_0x0d59('0x5b')]?JSON['stringify'](_0x58aea1[_0x0d59('0x5b')]):_0x0d59('0x6f'));return respondWithRpcPromise(_0x0d59('0x82'),_0x0d59('0x83'),_0x20ea76);}return null;})[_0x0d59('0x22')](function(_0x5dc0de){var _0x40dcac=_0x0d59('0x72')+_0x5dc0de[_0x0d59('0x29')][_0x0d59('0x73')];return db[_0x0d59('0x84')][_0x0d59('0x41')](_0x40dcac,{'type':db[_0x0d59('0x74')][_0x0d59('0x85')][_0x0d59('0x75')],'raw':!![]})[_0x0d59('0x22')](function(_0x4f591d){return _0x4f591d;});})['then'](function(_0x34a478){if(_0x34a478){_0x20ea76['message'][_0x0d59('0x86')]=_0x34a478[0x0];if(!_0x58aea1[_0x0d59('0x5b')][_0x0d59('0x64')])return;return db[_0x0d59('0x76')]['find']({'where':{'id':_0x58aea1[_0x0d59('0x5b')]['UserId'],'role':_0x0d59('0x66')},'attributes':['id','name',_0x0d59('0x77'),_0x0d59('0x78'),_0x0d59('0x79')],'raw':!![]});}return null;})[_0x0d59('0x22')](function(_0x3279d8){if(!_0x3279d8)return null;_0x20ea76[_0x0d59('0x29')][_0x0d59('0x66')]=_0x3279d8;return _0x20ea76;})[_0x0d59('0x22')](function(_0x262d96){if(_0x262d96){_0x262d96['message'][_0x0d59('0x7b')]=util[_0x0d59('0x63')]('SIP/%s',_0x58aea1['user']['name']);_0x262d96[_0x0d59('0x29')][_0x0d59('0x7d')]=_0x20ea76[_0x0d59('0x7d')];_0x262d96[_0x0d59('0x29')][_0x0d59('0x7e')]=_0x20ea76[_0x0d59('0x7d')];_0x262d96[_0x0d59('0x29')][_0x0d59('0x87')]=_0x0d59('0x35');respondWithRpcPromise(_0x0d59('0x7f'),_0x0d59('0x7f'),{'event':_0x0d59('0x88'),'message':_0x262d96['message']},client9002);return _0x20ea76;}return null;})['then'](respondWithResult(_0x1515c5,null))[_0x0d59('0x2b')](handleError(_0x1515c5,null));};exports[_0x0d59('0x2e')]=function(_0x152995,_0x204da3,_0x43a8d3){if(_0x152995[_0x0d59('0x5b')]['id']){delete _0x152995[_0x0d59('0x5b')]['id'];}var _0x32b583;return db[_0x0d59('0x3b')][_0x0d59('0x58')]({'where':{'id':_0x152995[_0x0d59('0x57')]['id']}})[_0x0d59('0x22')](handleEntityNotFound(_0x204da3,null))['then'](function(_0x2110bb){if(_0x2110bb){_0x32b583=_0x2110bb;return db['WhatsappAccount'][_0x0d59('0x58')]({'where':{'id':_0x2110bb[_0x0d59('0x89')]}});}})[_0x0d59('0x22')](handleEntityNotFound(_0x204da3,null))[_0x0d59('0x22')](function(_0x5a42ba){if(_0x5a42ba){logger[_0x0d59('0x8a')](_0x0d59('0x8b'),_0x0d59('0x2e'),_0x0d59('0x8c'),_0x5a42ba[_0x0d59('0x3e')],util[_0x0d59('0x8d')](_0x152995[_0x0d59('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5a42ba['type']){case'twilio':if(_0x152995[_0x0d59('0x5b')][_0x0d59('0x8e')]&&_0x152995[_0x0d59('0x5b')]['MessageSid']===_0x32b583[_0x0d59('0x8f')]&&_0x152995['body'][_0x0d59('0x90')]&&_0x152995[_0x0d59('0x5b')][_0x0d59('0x90')]===_0x0d59('0x61')){return _0x32b583[_0x0d59('0x5a')]({'read':!![]});}else{logger[_0x0d59('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x0d59('0x2e'),_0x0d59('0x91'),util[_0x0d59('0x8d')](_0x152995[_0x0d59('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x32b583;}})[_0x0d59('0x22')](respondWithResult(_0x204da3,null))[_0x0d59('0x2b')](handleError(_0x204da3,null));}; \ No newline at end of file +var _0x877b=['[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','email','internal','interface','channel','EventManager','reject','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','SIP/%s','motionChannel','event','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','options','where','includeAll','rows','show','params','merge','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5adcad,_0x1c786e){var _0x34a8bc=function(_0x57cbae){while(--_0x57cbae){_0x5adcad['push'](_0x5adcad['shift']());}};_0x34a8bc(++_0x1c786e);}(_0x877b,0xa6));var _0xb877=function(_0x420aaf,_0x3652a6){_0x420aaf=_0x420aaf-0x0;var _0x1f1cde=_0x877b[_0x420aaf];return _0x1f1cde;};'use strict';var emlformat=require(_0xb877('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb877('0x1'));var jsonpatch=require(_0xb877('0x2'));var rp=require('request-promise');var moment=require(_0xb877('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb877('0x4'));var util=require(_0xb877('0x5'));var path=require(_0xb877('0x6'));var sox=require(_0xb877('0x7'));var csv=require(_0xb877('0x8'));var ejs=require(_0xb877('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb877('0xa'));var squel=require(_0xb877('0xb'));var crypto=require(_0xb877('0xc'));var jsforce=require(_0xb877('0xd'));var deskjs=require(_0xb877('0xe'));var toCsv=require(_0xb877('0x8'));var querystring=require('querystring');var Papa=require(_0xb877('0xf'));var Redis=require(_0xb877('0x10'));var authService=require(_0xb877('0x11'));var qs=require(_0xb877('0x12'));var as=require(_0xb877('0x13'));var hardwareService=require(_0xb877('0x14'));var logger=require(_0xb877('0x15'))(_0xb877('0x16'));var utils=require(_0xb877('0x17'));var config=require(_0xb877('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb877('0x19'))['db'];config['redis']=_[_0xb877('0x1a')](config[_0xb877('0x1b')],{'host':_0xb877('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb877('0x1b')]));require(_0xb877('0x1d'))[_0xb877('0x1e')](socket);var jayson=require(_0xb877('0x1f'));var client=jayson[_0xb877('0x20')][_0xb877('0x21')]({'port':0x232c});var client9002=jayson[_0xb877('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4443a7,_0x5e0bf3,_0x3e1574,_0x2d67ad){return new BPromise(function(_0x22a656,_0x36f9cd){var _0x1e1d7b=_0x2d67ad||client;return _0x1e1d7b[_0xb877('0x22')](_0x4443a7,_0x3e1574)[_0xb877('0x23')](function(_0x1eee74){logger[_0xb877('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x5e0bf3,_0xb877('0x25'));logger[_0xb877('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5e0bf3,_0xb877('0x25'),JSON[_0xb877('0x27')](_0x1eee74));if(_0x1eee74['error']){if(_0x1eee74[_0xb877('0x28')][_0xb877('0x29')]===0x1f4){logger[_0xb877('0x28')](_0xb877('0x2a'),_0x5e0bf3,_0x1eee74['error'][_0xb877('0x2b')]);return _0x36f9cd(_0x1eee74[_0xb877('0x28')][_0xb877('0x2b')]);}logger[_0xb877('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x5e0bf3,_0x1eee74[_0xb877('0x28')]['message']);return _0x22a656(_0x1eee74[_0xb877('0x28')][_0xb877('0x2b')]);}else{logger[_0xb877('0x24')](_0xb877('0x2a'),_0x5e0bf3,_0xb877('0x25'));_0x22a656(_0x1eee74[_0xb877('0x2c')][_0xb877('0x2b')]);}})[_0xb877('0x2d')](function(_0xade288){logger[_0xb877('0x28')](_0xb877('0x2a'),_0x5e0bf3,_0xade288);_0x36f9cd(_0xade288);});});}function respondWithStatusCode(_0x2269a9,_0x1a4b27){_0x1a4b27=_0x1a4b27||0xcc;return function(_0x51660e){if(_0x51660e){return _0x2269a9[_0xb877('0x2e')](_0x1a4b27);}return _0x2269a9[_0xb877('0x2f')](_0x1a4b27)[_0xb877('0x30')]();};}function respondWithResult(_0x5a2093,_0xc649bd){_0xc649bd=_0xc649bd||0xc8;return function(_0x284813){if(_0x284813){return _0x5a2093['status'](_0xc649bd)[_0xb877('0x31')](_0x284813);}};}function respondWithFilteredResult(_0x410065,_0x2ec541){return function(_0x3bf65c){if(_0x3bf65c){var _0x4f8f9f=typeof _0x2ec541[_0xb877('0x32')]===_0xb877('0x33')&&typeof _0x2ec541[_0xb877('0x34')]===_0xb877('0x33');var _0x457a47=_0x3bf65c[_0xb877('0x35')];var _0x4eb5f1=_0x4f8f9f?0x0:_0x2ec541['offset'];var _0x1d8183=_0x4f8f9f?_0x3bf65c[_0xb877('0x35')]:_0x2ec541[_0xb877('0x32')]+_0x2ec541['limit'];var _0x187b60;if(_0x1d8183>=_0x457a47){_0x1d8183=_0x457a47;_0x187b60=0xc8;}else{_0x187b60=0xce;}_0x410065['status'](_0x187b60);return _0x410065[_0xb877('0x36')]('Content-Range',_0x4eb5f1+'-'+_0x1d8183+'/'+_0x457a47)[_0xb877('0x31')](_0x3bf65c);}return null;};}function patchUpdates(_0x3b5481){return function(_0x4f82f1){try{jsonpatch[_0xb877('0x37')](_0x4f82f1,_0x3b5481,!![]);}catch(_0x42b0e6){return BPromise['reject'](_0x42b0e6);}return _0x4f82f1['save']();};}function saveUpdates(_0x107199,_0x4fae8a){return function(_0x329b09){if(_0x329b09){return _0x329b09[_0xb877('0x38')](_0x107199)[_0xb877('0x23')](function(_0x508639){return _0x508639;});}return null;};}function removeEntity(_0x11d3d3,_0x43145a){return function(_0x10864c){if(_0x10864c){return _0x10864c[_0xb877('0x39')]()['then'](function(){_0x11d3d3[_0xb877('0x2f')](0xcc)[_0xb877('0x30')]();});}};}function handleEntityNotFound(_0x264b12,_0x4058e3){return function(_0xd31364){if(!_0xd31364){_0x264b12[_0xb877('0x2e')](0x194);}return _0xd31364;};}function handleError(_0x1856f8,_0x59996f){_0x59996f=_0x59996f||0x1f4;return function(_0x3834af){logger['error'](_0x3834af[_0xb877('0x3a')]);if(_0x3834af[_0xb877('0x3b')]){delete _0x3834af['name'];}_0x1856f8[_0xb877('0x2f')](_0x59996f)[_0xb877('0x3c')](_0x3834af);};}exports[_0xb877('0x3d')]=function(_0x34baea,_0x394c5c){var _0x29624b={},_0x2b1012={},_0xd6dcf={'count':0x0,'rows':[]};var _0x4d5cbf=_[_0xb877('0x3e')](db[_0xb877('0x3f')][_0xb877('0x40')],function(_0x266741){return{'name':_0x266741['fieldName'],'type':_0x266741[_0xb877('0x41')][_0xb877('0x42')]};});_0x2b1012[_0xb877('0x43')]=_['map'](_0x4d5cbf,'name');_0x2b1012['query']=_[_0xb877('0x44')](_0x34baea[_0xb877('0x45')]);_0x2b1012[_0xb877('0x46')]=_[_0xb877('0x47')](_0x2b1012[_0xb877('0x43')],_0x2b1012['query']);_0x29624b[_0xb877('0x48')]=_[_0xb877('0x47')](_0x2b1012['model'],qs['fields'](_0x34baea['query'][_0xb877('0x49')]));_0x29624b[_0xb877('0x48')]=_0x29624b[_0xb877('0x48')][_0xb877('0x4a')]?_0x29624b['attributes']:_0x2b1012[_0xb877('0x43')];if(!_0x34baea['query']['hasOwnProperty'](_0xb877('0x4b'))){_0x29624b[_0xb877('0x34')]=qs['limit'](_0x34baea[_0xb877('0x45')][_0xb877('0x34')]);_0x29624b[_0xb877('0x32')]=qs[_0xb877('0x32')](_0x34baea[_0xb877('0x45')][_0xb877('0x32')]);}_0x29624b[_0xb877('0x4c')]=qs['sort'](_0x34baea['query'][_0xb877('0x4d')]);_0x29624b['where']=qs[_0xb877('0x46')](_[_0xb877('0x4e')](_0x34baea['query'],_0x2b1012[_0xb877('0x46')]),_0x4d5cbf);if(_0x34baea['query'][_0xb877('0x4f')]){_0x29624b['where']=_['merge'](_0x29624b['where'],{'$or':_[_0xb877('0x3e')](_0x4d5cbf,function(_0x386f19){if(_0x386f19[_0xb877('0x41')]!=='VIRTUAL'){var _0x493912={};_0x493912[_0x386f19[_0xb877('0x3b')]]={'$like':'%'+_0x34baea[_0xb877('0x45')][_0xb877('0x4f')]+'%'};return _0x493912;}})});}_0x29624b=_['merge']({},_0x29624b,_0x34baea[_0xb877('0x50')]);var _0x562431={'where':_0x29624b[_0xb877('0x51')]};return db[_0xb877('0x3f')][_0xb877('0x35')](_0x562431)[_0xb877('0x23')](function(_0x4110f0){_0xd6dcf[_0xb877('0x35')]=_0x4110f0;if(_0x34baea[_0xb877('0x45')][_0xb877('0x52')]){_0x29624b['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x29624b);})[_0xb877('0x23')](function(_0x3722d2){_0xd6dcf[_0xb877('0x53')]=_0x3722d2;return _0xd6dcf;})['then'](respondWithFilteredResult(_0x394c5c,_0x29624b))[_0xb877('0x2d')](handleError(_0x394c5c,null));};exports[_0xb877('0x54')]=function(_0x4473f7,_0x414b4b){var _0x3a9144={'raw':!![],'where':{'id':_0x4473f7[_0xb877('0x55')]['id']}},_0x4ba82b={};_0x4ba82b[_0xb877('0x43')]=_[_0xb877('0x44')](db['WhatsappMessage'][_0xb877('0x40')]);_0x4ba82b[_0xb877('0x45')]=_[_0xb877('0x44')](_0x4473f7['query']);_0x4ba82b[_0xb877('0x46')]=_[_0xb877('0x47')](_0x4ba82b['model'],_0x4ba82b[_0xb877('0x45')]);_0x3a9144[_0xb877('0x48')]=_[_0xb877('0x47')](_0x4ba82b[_0xb877('0x43')],qs[_0xb877('0x49')](_0x4473f7['query'][_0xb877('0x49')]));_0x3a9144[_0xb877('0x48')]=_0x3a9144[_0xb877('0x48')][_0xb877('0x4a')]?_0x3a9144[_0xb877('0x48')]:_0x4ba82b['model'];if(_0x4473f7[_0xb877('0x45')][_0xb877('0x52')]){_0x3a9144['include']=[{'all':!![]}];}_0x3a9144=_[_0xb877('0x56')]({},_0x3a9144,_0x4473f7[_0xb877('0x50')]);return db[_0xb877('0x3f')][_0xb877('0x57')](_0x3a9144)[_0xb877('0x23')](handleEntityNotFound(_0x414b4b,null))[_0xb877('0x23')](respondWithResult(_0x414b4b,null))[_0xb877('0x2d')](handleError(_0x414b4b,null));};exports[_0xb877('0x58')]=function(_0x628bdf,_0x307a74){return db['WhatsappMessage'][_0xb877('0x58')](_0x628bdf[_0xb877('0x59')],{})[_0xb877('0x23')](respondWithResult(_0x307a74,0xc9))['catch'](handleError(_0x307a74,null));};exports[_0xb877('0x38')]=function(_0x50fe59,_0x4e05f5){if(_0x50fe59[_0xb877('0x59')]['id']){delete _0x50fe59[_0xb877('0x59')]['id'];}return db[_0xb877('0x3f')][_0xb877('0x57')]({'where':{'id':_0x50fe59[_0xb877('0x55')]['id']}})[_0xb877('0x23')](handleEntityNotFound(_0x4e05f5,null))[_0xb877('0x23')](saveUpdates(_0x50fe59[_0xb877('0x59')],null))[_0xb877('0x23')](respondWithResult(_0x4e05f5,null))['catch'](handleError(_0x4e05f5,null));};exports[_0xb877('0x39')]=function(_0x22d16c,_0x4d29c5){return db[_0xb877('0x3f')][_0xb877('0x57')]({'where':{'id':_0x22d16c[_0xb877('0x55')]['id']}})[_0xb877('0x23')](handleEntityNotFound(_0x4d29c5,null))[_0xb877('0x23')](removeEntity(_0x4d29c5,null))[_0xb877('0x2d')](handleError(_0x4d29c5,null));};exports['describe']=function(_0x313798,_0x4c1584){return db[_0xb877('0x3f')][_0xb877('0x5a')]()[_0xb877('0x23')](respondWithResult(_0x4c1584,null))[_0xb877('0x2d')](handleError(_0x4c1584,null));};var interaction_log=require(_0xb877('0x15'))(_0xb877('0x5b'));exports[_0xb877('0x5c')]=function(_0x5d4a29,_0xc89458,_0x26877c){var _0x48da59={'agent':{},'channel':_0xb877('0x5d')};if(_0x5d4a29[_0xb877('0x59')]['id']){delete _0x5d4a29[_0xb877('0x59')]['id'];}_0x5d4a29[_0xb877('0x59')][_0xb877('0x5e')]=!![];_0x5d4a29[_0xb877('0x59')][_0xb877('0x5f')]=moment()[_0xb877('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d4a29['body']['UserId']=_0x5d4a29[_0xb877('0x59')][_0xb877('0x61')]||_0x5d4a29[_0xb877('0x62')]['id'];_0x48da59[_0xb877('0x63')]['id']=_0x5d4a29[_0xb877('0x59')][_0xb877('0x61')];return db['WhatsappMessage'][_0xb877('0x57')]({'where':{'id':_0x5d4a29[_0xb877('0x55')]['id'],'UserId':null}})[_0xb877('0x23')](handleEntityNotFound(_0xc89458,null))[_0xb877('0x23')](saveUpdates(_0x5d4a29[_0xb877('0x59')],null))[_0xb877('0x23')](function(_0x48eca8){if(_0x48eca8){_0x48da59[_0xb877('0x2b')]=_0x48eca8[_0xb877('0x64')]({'plain':!![]});return db[_0xb877('0x65')][_0xb877('0x57')]({'where':{'id':_0x48eca8[_0xb877('0x66')]}});}return null;})[_0xb877('0x23')](handleEntityNotFound(_0xc89458,null))[_0xb877('0x23')](function(_0x1316d3){if(_0x1316d3){return _0x1316d3[_0xb877('0x38')]({'UserId':_0x5d4a29[_0xb877('0x59')]['UserId'],'read1stAt':_[_0xb877('0x67')](_0x1316d3[_0xb877('0x68')])?moment()['format'](_0xb877('0x69')):undefined});}return null;})['then'](function(_0x3d28cd){if(_0x3d28cd){_0x48da59['interaction']=_0x3d28cd['get']({'plain':!![]});interaction_log[_0xb877('0x24')](_0xb877('0x6a'),_0x5d4a29['user']['id'],_0x5d4a29[_0xb877('0x62')][_0xb877('0x3b')],_0x5d4a29[_0xb877('0x62')][_0xb877('0x6b')],_0x48da59[_0xb877('0x6c')]['id'],_0x5d4a29[_0xb877('0x59')]?JSON[_0xb877('0x27')](_0x5d4a29[_0xb877('0x59')]):_0xb877('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xb877('0x6e'),_0x48da59);}return null;})[_0xb877('0x23')](function(_0x361923){var _0x2fcdcb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x361923[_0xb877('0x2b')][_0xb877('0x6f')];return db[_0xb877('0x70')][_0xb877('0x45')](_0x2fcdcb,{'type':db['Sequelize'][_0xb877('0x71')][_0xb877('0x72')],'raw':!![]})[_0xb877('0x23')](function(_0x972260){return _0x972260;});})[_0xb877('0x23')](function(_0x1eb023){if(_0x1eb023){_0x48da59[_0xb877('0x2b')]['contact']=_0x1eb023[0x0];if(!_0x5d4a29[_0xb877('0x59')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5d4a29[_0xb877('0x59')][_0xb877('0x61')],'role':'agent'},'attributes':['id',_0xb877('0x3b'),'fullname',_0xb877('0x73'),_0xb877('0x74')],'raw':!![]});}return null;})['then'](function(_0x4b589f){if(!_0x4b589f)return null;_0x48da59['message']['agent']=_0x4b589f;return _0x48da59;})[_0xb877('0x23')](function(_0x31e987){if(_0x31e987){if(_0x5d4a29[_0xb877('0x59')]['manual']){_0x48da59[_0xb877('0x2b')][_0xb877('0x75')]=util[_0xb877('0x60')]('SIP/%s',_0x5d4a29[_0xb877('0x62')][_0xb877('0x3b')]);_0x48da59['message'][_0xb877('0x76')]=_0x48da59[_0xb877('0x76')];_0x48da59[_0xb877('0x2b')]['motionChannel']=_0x48da59[_0xb877('0x76')];_0x48da59[_0xb877('0x2b')]['event']=_0xb877('0x5c');return respondWithRpcPromise('EventManager',_0xb877('0x77'),{'event':'acceptmessage','message':_0x48da59[_0xb877('0x2b')]},client9002)[_0xb877('0x23')](function(){return _0x48da59;});}return _0x48da59;}return null;})['then'](respondWithResult(_0xc89458,null))[_0xb877('0x2d')](handleError(_0xc89458,null));};var interaction_log=require(_0xb877('0x15'))(_0xb877('0x5b'));exports[_0xb877('0x78')]=function(_0x2e9d53,_0x43700b,_0x42c81f){var _0x12e50a={'agent':{},'channel':_0xb877('0x5d')};if(_0x2e9d53['body']['id']){delete _0x2e9d53['body']['id'];}_0x2e9d53[_0xb877('0x59')][_0xb877('0x61')]=_0x2e9d53[_0xb877('0x59')]['UserId']||_0x2e9d53[_0xb877('0x62')]['id'];_0x12e50a['agent']['id']=_0x2e9d53['body'][_0xb877('0x61')];return db[_0xb877('0x3f')]['find']({'where':{'id':_0x2e9d53[_0xb877('0x55')]['id'],'UserId':null}})[_0xb877('0x23')](handleEntityNotFound(_0x43700b,null))[_0xb877('0x23')](function(_0x1a8248){if(_0x1a8248){_0x12e50a[_0xb877('0x2b')]=_0x1a8248['get']({'plain':!![]});return db[_0xb877('0x65')][_0xb877('0x57')]({'where':{'id':_0x1a8248[_0xb877('0x66')]}});}return null;})[_0xb877('0x23')](handleEntityNotFound(_0x43700b,null))['then'](function(_0x19d97f){if(_0x19d97f){_0x12e50a[_0xb877('0x6c')]=_0x19d97f[_0xb877('0x64')]({'plain':!![]});interaction_log[_0xb877('0x24')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e9d53['user']['id'],_0x2e9d53[_0xb877('0x62')][_0xb877('0x3b')],_0x2e9d53[_0xb877('0x62')][_0xb877('0x6b')],_0x12e50a[_0xb877('0x6c')]['id'],_0x2e9d53[_0xb877('0x59')]?JSON['stringify'](_0x2e9d53['body']):_0xb877('0x6d'));return respondWithRpcPromise(_0xb877('0x79'),_0xb877('0x7a'),_0x12e50a);}return null;})[_0xb877('0x23')](function(_0x35d997){var _0x4f2bbd=_0xb877('0x7b')+_0x35d997[_0xb877('0x2b')][_0xb877('0x6f')];return db[_0xb877('0x70')][_0xb877('0x45')](_0x4f2bbd,{'type':db[_0xb877('0x7c')][_0xb877('0x71')][_0xb877('0x72')],'raw':!![]})['then'](function(_0x54f770){return _0x54f770;});})[_0xb877('0x23')](function(_0x3caf83){if(_0x3caf83){_0x12e50a[_0xb877('0x2b')]['contact']=_0x3caf83[0x0];if(!_0x2e9d53[_0xb877('0x59')][_0xb877('0x61')])return;return db[_0xb877('0x7d')][_0xb877('0x57')]({'where':{'id':_0x2e9d53['body']['UserId'],'role':_0xb877('0x63')},'attributes':['id',_0xb877('0x3b'),'fullname',_0xb877('0x73'),_0xb877('0x74')],'raw':!![]});}return null;})[_0xb877('0x23')](function(_0x289193){if(!_0x289193)return null;_0x12e50a[_0xb877('0x2b')][_0xb877('0x63')]=_0x289193;return _0x12e50a;})[_0xb877('0x23')](function(_0x390962){if(_0x390962){_0x390962[_0xb877('0x2b')][_0xb877('0x75')]=util[_0xb877('0x60')](_0xb877('0x7e'),_0x2e9d53[_0xb877('0x62')][_0xb877('0x3b')]);_0x390962[_0xb877('0x2b')][_0xb877('0x76')]=_0x12e50a[_0xb877('0x76')];_0x390962[_0xb877('0x2b')][_0xb877('0x7f')]=_0x12e50a[_0xb877('0x76')];_0x390962['message'][_0xb877('0x80')]='reject';respondWithRpcPromise(_0xb877('0x77'),_0xb877('0x77'),{'event':'rejectmessage','message':_0x390962[_0xb877('0x2b')]},client9002);return _0x12e50a;}return null;})[_0xb877('0x23')](respondWithResult(_0x43700b,null))['catch'](handleError(_0x43700b,null));};exports[_0xb877('0x2f')]=function(_0x4ae28f,_0x4a8bdf,_0xbca3d2){if(_0x4ae28f['body']['id']){delete _0x4ae28f[_0xb877('0x59')]['id'];}var _0x1c434f;return db[_0xb877('0x3f')][_0xb877('0x57')]({'where':{'id':_0x4ae28f[_0xb877('0x55')]['id']}})[_0xb877('0x23')](handleEntityNotFound(_0x4a8bdf,null))[_0xb877('0x23')](function(_0x212a67){if(_0x212a67){_0x1c434f=_0x212a67;return db['WhatsappAccount'][_0xb877('0x57')]({'where':{'id':_0x212a67[_0xb877('0x81')]}});}})['then'](handleEntityNotFound(_0x4a8bdf,null))['then'](function(_0x26ccb3){if(_0x26ccb3){logger[_0xb877('0x26')](_0xb877('0x82'),_0xb877('0x2f'),_0xb877('0x83'),_0x26ccb3[_0xb877('0x41')],util[_0xb877('0x84')](_0x4ae28f[_0xb877('0x59')],{'showHidden':![],'depth':null}));switch(_0x26ccb3[_0xb877('0x41')]){case _0xb877('0x85'):if(_0x4ae28f['body'][_0xb877('0x86')]&&_0x4ae28f[_0xb877('0x59')]['MessageSid']===_0x1c434f['messageId']&&_0x4ae28f[_0xb877('0x59')]['MessageStatus']&&_0x4ae28f[_0xb877('0x59')][_0xb877('0x87')]===_0xb877('0x5e')){return _0x1c434f[_0xb877('0x38')]({'read':!![]});}else{logger[_0xb877('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xb877('0x2f'),_0xb877('0x85'),util['inspect'](_0x4ae28f[_0xb877('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1c434f;}})['then'](respondWithResult(_0x4a8bdf,null))[_0xb877('0x2d')](handleError(_0x4a8bdf,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 859371d..857fabe 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 _0x0427=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','WhatsappMessage'];(function(_0x414744,_0x9b7ebc){var _0x1aba6c=function(_0x51c070){while(--_0x51c070){_0x414744['push'](_0x414744['shift']());}};_0x1aba6c(++_0x9b7ebc);}(_0x0427,0x137));var _0x7042=function(_0x1f136f,_0x5a0476){_0x1f136f=_0x1f136f-0x0;var _0x210b4f=_0x0427[_0x1f136f];return _0x210b4f;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x7042('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7042('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7042('0x2'),'afterDestroy':_0x7042('0x3')};function emitEvent(_0xae8bc2){return function(_0x1db1f3,_0xa72963,_0x343a69){WhatsappMessageEvents[_0x7042('0x4')](_0xae8bc2+':'+_0x1db1f3['id'],_0x1db1f3);WhatsappMessageEvents['emit'](_0xae8bc2,_0x1db1f3);_0x343a69(null);};}for(var e in events){if(events[_0x7042('0x5')](e)){var event=events[e];WhatsappMessage[_0x7042('0x6')](e,emitEvent(event));}}module[_0x7042('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8b29=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x123208,_0xbd71c7){var _0x1cef9e=function(_0x535e85){while(--_0x535e85){_0x123208['push'](_0x123208['shift']());}};_0x1cef9e(++_0xbd71c7);}(_0x8b29,0xbe));var _0x98b2=function(_0x20963a,_0x32a7ef){_0x20963a=_0x20963a-0x0;var _0x521eba=_0x8b29[_0x20963a];return _0x521eba;};'use strict';var EventEmitter=require(_0x98b2('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x98b2('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x98b2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x98b2('0x3')};function emitEvent(_0x20afa9){return function(_0x5bf7df,_0x209616,_0x5da9ce){WhatsappMessageEvents[_0x98b2('0x4')](_0x20afa9+':'+_0x5bf7df['id'],_0x5bf7df);WhatsappMessageEvents[_0x98b2('0x4')](_0x20afa9,_0x5bf7df);_0x5da9ce(null);};}for(var e in events){if(events[_0x98b2('0x5')](e)){var event=events[e];WhatsappMessage[_0x98b2('0x6')](e,emitEvent(event));}}module[_0x98b2('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 99d43cb..d2438d5 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 _0x0f61=['out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x264656,_0x4bef95){var _0x499969=function(_0x55049a){while(--_0x55049a){_0x264656['push'](_0x264656['shift']());}};_0x499969(++_0x4bef95);}(_0x0f61,0x1eb));var _0x10f6=function(_0x1f701a,_0xd8ed69){_0x1f701a=_0x1f701a-0x0;var _0x50ead0=_0x0f61[_0x1f701a];return _0x50ead0;};'use strict';var _=require(_0x10f6('0x0'));var util=require(_0x10f6('0x1'));var logger=require(_0x10f6('0x2'))('api');var moment=require(_0x10f6('0x3'));var BPromise=require(_0x10f6('0x4'));var rp=require(_0x10f6('0x5'));var fetch=require(_0x10f6('0x6'));var fs=require('fs');var path=require(_0x10f6('0x7'));var rimraf=require('rimraf');var config=require(_0x10f6('0x8'));var attributes=require(_0x10f6('0x9'));module[_0x10f6('0xa')]=function(_0x1f6535,_0x3efe71){return _0x1f6535[_0x10f6('0xb')](_0x10f6('0xc'),attributes,{'tableName':_0x10f6('0xd'),'paranoid':![],'indexes':[{'name':_0x10f6('0xe'),'fields':[_0x10f6('0xe')]},{'name':_0x10f6('0xf'),'fields':[_0x10f6('0x10')],'type':_0x10f6('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bba80,_0x4a1edf,_0x2ec0f5){var _0x52f276=_0x1f6535['models'];var _0x41ae96=_0x4bba80[_0x10f6('0x12')]({'plain':!![]});if(_0x41ae96[_0x10f6('0x13')][_0x10f6('0x14')]()==='in'||_0x41ae96[_0x10f6('0x13')][_0x10f6('0x14')]()===_0x10f6('0x15')&&!_0x41ae96[_0x10f6('0x16')]&&!_['isNil'](_0x41ae96[_0x10f6('0x17')])){_0x52f276[_0x10f6('0x18')][_0x10f6('0x19')]({'where':{'id':_0x41ae96[_0x10f6('0x1a')]}})[_0x10f6('0x1b')](function(_0x27f9d6){if(_0x27f9d6){_0x27f9d6[_0x10f6('0x1c')]({'lastMsgAt':_0x41ae96[_0x10f6('0x1d')],'lastMsgDirection':_0x41ae96[_0x10f6('0x13')]['toLowerCase']()});}})['catch'](function(_0x378f7c){console[_0x10f6('0x1e')](_0x378f7c);});}if(_0x41ae96[_0x10f6('0x13')]===_0x10f6('0x15')&&!_0x41ae96['secret']){var _0x3b20ad;_0x52f276[_0x10f6('0x1f')][_0x10f6('0x20')]({'where':{'id':_0x41ae96[_0x10f6('0x21')]},'raw':!![]})[_0x10f6('0x1b')](function(_0x5edc31){_0x3b20ad=_0x5edc31;if(_0x3b20ad&&_0x3b20ad[_0x10f6('0x22')]){switch(_0x3b20ad[_0x10f6('0x22')]){case _0x10f6('0x23'):var _0x1c35e6=require(_0x10f6('0x23'));if(_0x3b20ad[_0x10f6('0x24')]&&_0x3b20ad['authToken']&&_0x3b20ad[_0x10f6('0x25')]){var _0x371bb0=new _0x1c35e6(_0x3b20ad[_0x10f6('0x24')],_0x3b20ad[_0x10f6('0x26')]);_0x371bb0[_0x10f6('0x27')][_0x10f6('0x28')]({'body':_0x41ae96[_0x10f6('0x10')],'to':_0x10f6('0x29')+_0x41ae96['phone'],'from':'whatsapp:'+_0x3b20ad[_0x10f6('0x25')],'statusCallback':_0x3b20ad[_0x10f6('0x2a')]+_0x10f6('0x2b')+_0x41ae96['id']+_0x10f6('0x2c')+_0x3b20ad[_0x10f6('0x2d')]})[_0x10f6('0x1b')](function(_0x31568a){if(_0x31568a['sid']){return _0x4bba80[_0x10f6('0x1c')]({'messageId':_0x31568a[_0x10f6('0x2e')]});}})[_0x10f6('0x2f')](function(_0x2dd8d5){logger['error'](_0x10f6('0x30'),_0x10f6('0x31'),_0x10f6('0x23'),util['inspect'](_0x2dd8d5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x10f6('0x30'),'afterCreate',_0x10f6('0x23'),_0x10f6('0x32'));}break;case _0x10f6('0x33'):var _0x124f12=_0x3b20ad[_0x10f6('0x24')];var _0x4ba086=_0x3b20ad[_0x10f6('0x26')];var _0x1c13b5=_0x3b20ad[_0x10f6('0x34')]+_0x10f6('0x35')+_0x124f12+_0x10f6('0x36');var _0x2732d2={'to':[_0x41ae96[_0x10f6('0x25')]],'message':{'type':_0x10f6('0x37'),'text':_0x41ae96['body']}};var _0x10f0be={'method':_0x10f6('0x38'),'uri':_0x1c13b5,'headers':{'Authorization':_0x10f6('0x39')+_0x4ba086,'Content-Type':'application/json'},'body':_0x2732d2,'json':!![]};rp(_0x10f0be)['then'](function(_0x137bff){if(_0x137bff[_0x10f6('0x3a')][0x0][_0x10f6('0x3b')]){return _0x4bba80[_0x10f6('0x1c')]({'messageId':_0x137bff[_0x10f6('0x3a')][0x0][_0x10f6('0x3b')]});}})['catch'](function(_0x558c15){logger['err'](_0x10f6('0x3c'),_0x558c15);});break;}}})[_0x10f6('0x3d')](function(){_0x2ec0f5();});}else{_0x2ec0f5();}}},'charset':_0x10f6('0x3e'),'collate':_0x10f6('0x3f')});}; \ No newline at end of file +var _0x751d=['/api/whatsapp/messages/','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','exports','define','messageId','body','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','find','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote'];(function(_0x1f46e1,_0x118eb6){var _0x2276ae=function(_0x5a99b0){while(--_0x5a99b0){_0x1f46e1['push'](_0x1f46e1['shift']());}};_0x2276ae(++_0x118eb6);}(_0x751d,0xb3));var _0xd751=function(_0x92d580,_0x4928fb){_0x92d580=_0x92d580-0x0;var _0x4ee344=_0x751d[_0x92d580];return _0x4ee344;};'use strict';var _=require(_0xd751('0x0'));var util=require(_0xd751('0x1'));var logger=require(_0xd751('0x2'))(_0xd751('0x3'));var moment=require(_0xd751('0x4'));var BPromise=require(_0xd751('0x5'));var rp=require(_0xd751('0x6'));var fetch=require(_0xd751('0x7'));var fs=require('fs');var path=require(_0xd751('0x8'));var rimraf=require(_0xd751('0x9'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xd751('0xa')]=function(_0x589418,_0x417d36){return _0x589418[_0xd751('0xb')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd751('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xd751('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39072d,_0x4c51bc,_0x15c401){var _0x27d44=_0x589418[_0xd751('0xe')];var _0x2fa61c=_0x39072d[_0xd751('0xf')]({'plain':!![]});if(_0x2fa61c[_0xd751('0x10')][_0xd751('0x11')]()==='in'||_0x2fa61c[_0xd751('0x10')][_0xd751('0x11')]()===_0xd751('0x12')&&!_0x2fa61c[_0xd751('0x13')]&&!_[_0xd751('0x14')](_0x2fa61c['UserId'])){_0x27d44[_0xd751('0x15')][_0xd751('0x16')]({'where':{'id':_0x2fa61c[_0xd751('0x17')]}})[_0xd751('0x18')](function(_0x39b51f){if(_0x39b51f){_0x39b51f['update']({'lastMsgAt':_0x2fa61c[_0xd751('0x19')],'lastMsgDirection':_0x2fa61c[_0xd751('0x10')][_0xd751('0x11')]()});}})[_0xd751('0x1a')](function(_0x692af2){console[_0xd751('0x1b')](_0x692af2);});}if(_0x2fa61c[_0xd751('0x10')]===_0xd751('0x12')&&!_0x2fa61c[_0xd751('0x13')]){var _0x414cbb;_0x27d44['WhatsappAccount'][_0xd751('0x1c')]({'where':{'id':_0x2fa61c['WhatsappAccountId']},'raw':!![]})[_0xd751('0x18')](function(_0x59d7eb){_0x414cbb=_0x59d7eb;if(_0x414cbb&&_0x414cbb['type']){switch(_0x414cbb[_0xd751('0x1d')]){case _0xd751('0x1e'):var _0x42bf64=require(_0xd751('0x1e'));if(_0x414cbb[_0xd751('0x1f')]&&_0x414cbb[_0xd751('0x20')]&&_0x414cbb[_0xd751('0x21')]){var _0x42333d=new _0x42bf64(_0x414cbb['accountSid'],_0x414cbb[_0xd751('0x20')]);_0x42333d['messages'][_0xd751('0x22')]({'body':_0x2fa61c[_0xd751('0xd')],'to':_0xd751('0x23')+_0x2fa61c[_0xd751('0x21')],'from':_0xd751('0x23')+_0x414cbb[_0xd751('0x21')],'statusCallback':_0x414cbb[_0xd751('0x24')]+_0xd751('0x25')+_0x2fa61c['id']+'/status?token='+_0x414cbb['token']})[_0xd751('0x18')](function(_0x28cbcf){if(_0x28cbcf['sid']){return _0x39072d[_0xd751('0x26')]({'messageId':_0x28cbcf['sid']});}})[_0xd751('0x1a')](function(_0x14e0cf){logger[_0xd751('0x1b')](_0xd751('0x27'),'afterCreate',_0xd751('0x1e'),util[_0xd751('0x28')](_0x14e0cf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd751('0x27'),_0xd751('0x29'),_0xd751('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xd751('0x2a'):var _0x3a92b6=_0x414cbb[_0xd751('0x1f')];var _0x1eeae4=_0x414cbb[_0xd751('0x20')];var _0x35b511=_0x414cbb[_0xd751('0x2b')]+_0xd751('0x2c')+_0x3a92b6+'/messages/';var _0x219d66={'to':[_0x2fa61c[_0xd751('0x21')]],'message':{'type':_0xd751('0x2d'),'text':_0x2fa61c['body']}};var _0x5868e7={'method':_0xd751('0x2e'),'uri':_0x35b511,'headers':{'Authorization':'Bearer\x20'+_0x1eeae4,'Content-Type':_0xd751('0x2f')},'body':_0x219d66,'json':!![]};rp(_0x5868e7)[_0xd751('0x18')](function(_0x165ae3){if(_0x165ae3[_0xd751('0x30')][0x0][_0xd751('0x31')]){return _0x39072d[_0xd751('0x26')]({'messageId':_0x165ae3['statuses'][0x0][_0xd751('0x31')]});}})[_0xd751('0x1a')](function(_0x2f3829){logger[_0xd751('0x32')](_0xd751('0x33'),_0x2f3829);});break;}}})[_0xd751('0x34')](function(){_0x15c401();});}else{_0x15c401();}}},'charset':'utf8mb4','collate':_0xd751('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 9084a53..4968c53 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 _0x410a=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','CreateWhatsappMessage','debug','util'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x410a,0x19f));var _0xa410=function(_0x5ee0ad,_0x3cae65){_0x5ee0ad=_0x5ee0ad-0x0;var _0x22a6b7=_0x410a[_0x5ee0ad];return _0x22a6b7;};'use strict';var _=require('lodash');var util=require(_0xa410('0x0'));var moment=require(_0xa410('0x1'));var BPromise=require(_0xa410('0x2'));var rs=require(_0xa410('0x3'));var fs=require('fs');var Redis=require(_0xa410('0x4'));var db=require(_0xa410('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa410('0x6'));var config=require(_0xa410('0x7'));var jayson=require(_0xa410('0x8'));var client=jayson['client'][_0xa410('0x9')]({'port':0x232a});config[_0xa410('0xa')]=_['defaults'](config[_0xa410('0xa')],{'host':_0xa410('0xb'),'port':0x18eb});var socket=require(_0xa410('0xc'))(new Redis(config['redis']));require(_0xa410('0xd'))[_0xa410('0xe')](socket);function respondWithRpcPromise(_0x2ca9f6,_0x3637bb,_0x5f554b){return new BPromise(function(_0xde9f89,_0x37cf81){return client['request'](_0x2ca9f6,_0x5f554b)[_0xa410('0xf')](function(_0x35eec0){logger[_0xa410('0x10')](_0xa410('0x11'),_0x3637bb,'request\x20sent');logger['debug'](_0xa410('0x12'),_0x3637bb,_0xa410('0x13'),JSON[_0xa410('0x14')](_0x35eec0));if(_0x35eec0[_0xa410('0x15')]){if(_0x35eec0[_0xa410('0x15')][_0xa410('0x16')]===0x1f4){logger[_0xa410('0x15')](_0xa410('0x11'),_0x3637bb,_0x35eec0[_0xa410('0x15')]['message']);return _0x37cf81(_0x35eec0[_0xa410('0x15')]['message']);}logger[_0xa410('0x15')](_0xa410('0x11'),_0x3637bb,_0x35eec0['error'][_0xa410('0x17')]);return _0xde9f89(_0x35eec0[_0xa410('0x15')][_0xa410('0x17')]);}else{logger[_0xa410('0x10')](_0xa410('0x11'),_0x3637bb,_0xa410('0x13'));_0xde9f89(_0x35eec0[_0xa410('0x18')][_0xa410('0x17')]);}})[_0xa410('0x19')](function(_0x5620ed){logger[_0xa410('0x15')](_0xa410('0x11'),_0x3637bb,_0x5620ed);_0x37cf81(_0x5620ed);});});}exports['CreateWhatsappMessage']=function(_0x36cf7e){var _0x4cfab8=this;return new Promise(function(_0x151e89,_0x22dd0d){return db[_0xa410('0x1a')][_0xa410('0x1b')](_0x36cf7e[_0xa410('0x1c')],{'raw':_0x36cf7e[_0xa410('0x1d')]?_0x36cf7e[_0xa410('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xa410('0xf')](function(_0x499d00){logger[_0xa410('0x10')](_0xa410('0x1e'),_0x36cf7e);logger[_0xa410('0x1f')](_0xa410('0x1e'),_0x36cf7e,JSON[_0xa410('0x14')](_0x499d00));_0x151e89(_0x499d00);})[_0xa410('0x19')](function(_0x10cd77){logger[_0xa410('0x15')](_0xa410('0x1e'),_0x10cd77[_0xa410('0x17')],_0x36cf7e);_0x22dd0d(_0x4cfab8[_0xa410('0x15')](0x1f4,_0x10cd77[_0xa410('0x17')]));});});}; \ No newline at end of file +var _0x713b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3f581f,_0x4ea03c){var _0x1e0d19=function(_0x2b9d8a){while(--_0x2b9d8a){_0x3f581f['push'](_0x3f581f['shift']());}};_0x1e0d19(++_0x4ea03c);}(_0x713b,0x18f));var _0xb713=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0x713b[_0xcd5a3d];return _0xd43207;};'use strict';var _=require(_0xb713('0x0'));var util=require(_0xb713('0x1'));var moment=require('moment');var BPromise=require(_0xb713('0x2'));var rs=require(_0xb713('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb713('0x4'))['db'];var utils=require(_0xb713('0x5'));var logger=require(_0xb713('0x6'))(_0xb713('0x7'));var config=require(_0xb713('0x8'));var jayson=require(_0xb713('0x9'));var client=jayson[_0xb713('0xa')][_0xb713('0xb')]({'port':0x232a});config[_0xb713('0xc')]=_[_0xb713('0xd')](config['redis'],{'host':_0xb713('0xe'),'port':0x18eb});var socket=require(_0xb713('0xf'))(new Redis(config['redis']));require(_0xb713('0x10'))[_0xb713('0x11')](socket);function respondWithRpcPromise(_0x5c8fda,_0x3c4e25,_0x120b8e){return new BPromise(function(_0x51f0e7,_0x180f26){return client[_0xb713('0x12')](_0x5c8fda,_0x120b8e)[_0xb713('0x13')](function(_0x489484){logger[_0xb713('0x14')](_0xb713('0x15'),_0x3c4e25,_0xb713('0x16'));logger[_0xb713('0x17')](_0xb713('0x18'),_0x3c4e25,'request\x20sent',JSON[_0xb713('0x19')](_0x489484));if(_0x489484[_0xb713('0x1a')]){if(_0x489484[_0xb713('0x1a')]['code']===0x1f4){logger[_0xb713('0x1a')](_0xb713('0x15'),_0x3c4e25,_0x489484[_0xb713('0x1a')][_0xb713('0x1b')]);return _0x180f26(_0x489484['error']['message']);}logger[_0xb713('0x1a')]('WhatsappMessage,\x20%s,\x20%s',_0x3c4e25,_0x489484[_0xb713('0x1a')][_0xb713('0x1b')]);return _0x51f0e7(_0x489484[_0xb713('0x1a')][_0xb713('0x1b')]);}else{logger[_0xb713('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x3c4e25,_0xb713('0x16'));_0x51f0e7(_0x489484['result'][_0xb713('0x1b')]);}})[_0xb713('0x1c')](function(_0x50eb3e){logger[_0xb713('0x1a')](_0xb713('0x15'),_0x3c4e25,_0x50eb3e);_0x180f26(_0x50eb3e);});});}exports[_0xb713('0x1d')]=function(_0x3cc22d){var _0x124810=this;return new Promise(function(_0xcb5015,_0x200ce2){return db[_0xb713('0x1e')]['create'](_0x3cc22d[_0xb713('0x1f')],{'raw':_0x3cc22d[_0xb713('0x20')]?_0x3cc22d[_0xb713('0x20')][_0xb713('0x21')]===undefined?!![]:![]:!![]})[_0xb713('0x13')](function(_0x2e0a69){logger[_0xb713('0x14')](_0xb713('0x1d'),_0x3cc22d);logger[_0xb713('0x17')](_0xb713('0x1d'),_0x3cc22d,JSON[_0xb713('0x19')](_0x2e0a69));_0xcb5015(_0x2e0a69);})[_0xb713('0x1c')](function(_0x27a5a0){logger[_0xb713('0x1a')](_0xb713('0x1d'),_0x27a5a0['message'],_0x3cc22d);_0x200ce2(_0x124810[_0xb713('0x1a')](0x1f4,_0x27a5a0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 85d180b..f1416a9 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 _0x0e69=['save','remove','update','emit','removeListener','length','whatsappMessage:'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x0e69,0xb6));var _0x90e6=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x0e69[_0x174ef5];return _0x1cc379;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x90e6('0x0'),_0x90e6('0x1'),_0x90e6('0x2')];function createListener(_0x49a7e7,_0x556dc7){return function(_0x4a071a){_0x556dc7[_0x90e6('0x3')](_0x49a7e7,_0x4a071a);};}function removeListener(_0x4bce64,_0x56810b){return function(){WhatsappMessageEvents[_0x90e6('0x4')](_0x4bce64,_0x56810b);};}exports['register']=function(_0x57fe89){for(var _0x491501=0x0,_0x4ba5ec=events[_0x90e6('0x5')];_0x491501<_0x4ba5ec;_0x491501++){var _0x23db3d=events[_0x491501];var _0x7a3b64=createListener(_0x90e6('0x6')+_0x23db3d,_0x57fe89);WhatsappMessageEvents['on'](_0x23db3d,_0x7a3b64);}}; \ No newline at end of file +var _0xa26b=['save','remove','emit','removeListener','register','length','whatsappMessage:'];(function(_0x2046b6,_0x50c86b){var _0x104ce8=function(_0x3f92a5){while(--_0x3f92a5){_0x2046b6['push'](_0x2046b6['shift']());}};_0x104ce8(++_0x50c86b);}(_0xa26b,0x1c0));var _0xba26=function(_0x361098,_0x56950f){_0x361098=_0x361098-0x0;var _0x5f56f9=_0xa26b[_0x361098];return _0x5f56f9;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xba26('0x0'),_0xba26('0x1'),'update'];function createListener(_0x3aa76b,_0x2ae6c8){return function(_0x5c4786){_0x2ae6c8[_0xba26('0x2')](_0x3aa76b,_0x5c4786);};}function removeListener(_0x1964ec,_0x5eade1){return function(){WhatsappMessageEvents[_0xba26('0x3')](_0x1964ec,_0x5eade1);};}exports[_0xba26('0x4')]=function(_0x62cda7){for(var _0x5bd73a=0x0,_0x27ad06=events[_0xba26('0x5')];_0x5bd73a<_0x27ad06;_0x5bd73a++){var _0x5b092f=events[_0x5bd73a];var _0x10ecb3=createListener(_0xba26('0x6')+_0x5b092f,_0x62cda7);WhatsappMessageEvents['on'](_0x5b092f,_0x10ecb3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f55050f..ba9fe53 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 _0xc3c2=['/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3c2,0x64));var _0x2c3c=function(_0x3af734,_0x203e04){_0x3af734=_0x3af734-0x0;var _0x3dbc88=_0xc3c2[_0x3af734];return _0x3dbc88;};'use strict';var multer=require('multer');var util=require(_0x2c3c('0x0'));var path=require(_0x2c3c('0x1'));var timeout=require(_0x2c3c('0x2'));var express=require('express');var router=express[_0x2c3c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2c3c('0x4'));var interaction=require(_0x2c3c('0x5'));var config=require(_0x2c3c('0x6'));var controller=require(_0x2c3c('0x7'));router[_0x2c3c('0x8')]('/',auth[_0x2c3c('0x9')](),controller['index']);router[_0x2c3c('0x8')](_0x2c3c('0xa'),auth[_0x2c3c('0x9')](),controller[_0x2c3c('0xb')]);router[_0x2c3c('0x8')](_0x2c3c('0xc'),auth[_0x2c3c('0x9')](),controller[_0x2c3c('0xd')]);router[_0x2c3c('0x8')](_0x2c3c('0xe'),auth['isAuthenticated'](),controller[_0x2c3c('0xf')]);router[_0x2c3c('0x8')](_0x2c3c('0x10'),auth['isAuthenticated'](),controller[_0x2c3c('0x11')]);router[_0x2c3c('0x8')]('/:id/users',auth[_0x2c3c('0x9')](),controller[_0x2c3c('0x12')]);router[_0x2c3c('0x13')]('/',auth[_0x2c3c('0x9')](),controller[_0x2c3c('0x14')]);router[_0x2c3c('0x13')](_0x2c3c('0x10'),auth[_0x2c3c('0x9')](),controller['addTeams']);router[_0x2c3c('0x13')](_0x2c3c('0x15'),auth[_0x2c3c('0x9')](),controller[_0x2c3c('0x16')]);router[_0x2c3c('0x17')](_0x2c3c('0xc'),auth[_0x2c3c('0x9')](),controller[_0x2c3c('0x18')]);router[_0x2c3c('0x19')]('/:id',auth[_0x2c3c('0x9')](),controller[_0x2c3c('0x1a')]);router[_0x2c3c('0x19')](_0x2c3c('0x10'),auth[_0x2c3c('0x9')](),controller['removeTeams']);router[_0x2c3c('0x19')]('/:id/users',auth[_0x2c3c('0x9')](),controller[_0x2c3c('0x1b')]);module[_0x2c3c('0x1c')]=router; \ No newline at end of file +var _0x8d11=['put','update','destroy','delete','removeTeams','removeAgents','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8d11,0x1b6));var _0x18d1=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x8d11[_0x34bf97];return _0x292719;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x18d1('0x0'));var timeout=require('connect-timeout');var express=require(_0x18d1('0x1'));var router=express[_0x18d1('0x2')]();var fs_extra=require(_0x18d1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x18d1('0x4'));var config=require(_0x18d1('0x5'));var controller=require(_0x18d1('0x6'));router[_0x18d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x18d1('0x8')]);router[_0x18d1('0x7')]('/describe',auth[_0x18d1('0x9')](),controller[_0x18d1('0xa')]);router['get'](_0x18d1('0xb'),auth[_0x18d1('0x9')](),controller[_0x18d1('0xc')]);router[_0x18d1('0x7')](_0x18d1('0xd'),auth[_0x18d1('0x9')](),controller[_0x18d1('0xe')]);router[_0x18d1('0x7')](_0x18d1('0xf'),auth[_0x18d1('0x9')](),controller[_0x18d1('0x10')]);router[_0x18d1('0x7')]('/:id/users',auth[_0x18d1('0x9')](),controller['getAgents']);router[_0x18d1('0x11')]('/',auth[_0x18d1('0x9')](),controller[_0x18d1('0x12')]);router[_0x18d1('0x11')](_0x18d1('0xf'),auth['isAuthenticated'](),controller[_0x18d1('0x13')]);router[_0x18d1('0x11')](_0x18d1('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x18d1('0x15')](_0x18d1('0xb'),auth['isAuthenticated'](),controller[_0x18d1('0x16')]);router['delete']('/:id',auth[_0x18d1('0x9')](),controller[_0x18d1('0x17')]);router[_0x18d1('0x18')](_0x18d1('0xf'),auth[_0x18d1('0x9')](),controller[_0x18d1('0x19')]);router[_0x18d1('0x18')](_0x18d1('0x14'),auth[_0x18d1('0x9')](),controller[_0x18d1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 34a42c9..9464d5c 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 _0x3b59=['ENUM','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x3b59,0x9c));var _0x93b5=function(_0x75d604,_0x3942cf){_0x75d604=_0x75d604-0x0;var _0x318644=_0x3b59[_0x75d604];return _0x318644;};'use strict';var Sequelize=require(_0x93b5('0x0'));module[_0x93b5('0x1')]={'name':{'type':Sequelize[_0x93b5('0x2')],'unique':_0x93b5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x93b5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x93b5('0x5')]('rrmemory',_0x93b5('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x93b5('0x2')]}}; \ No newline at end of file +var _0x84e1=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x84e1,0x1dc));var _0x184e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x84e1[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x184e('0x0'));module[_0x184e('0x1')]={'name':{'type':Sequelize[_0x184e('0x2')],'unique':_0x184e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x184e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x184e('0x5')]('rrmemory',_0x184e('0x6'),_0x184e('0x7'))},'description':{'type':Sequelize[_0x184e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a82e172..b9da110 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 _0x7473=['index','map','WhatsappQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','show','params','catch','body','user','role','WhatsappQueues','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','WhatsappQueueId','findAll','UserId','whatsappPause','rows','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','sequelize','transaction','UserWhatsappQueue','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','union','compact','value','ids','isEmpty','emit','userWhatsappQueue:remove','addAgents','spread','removeAgents','getAgents','rawAttributes','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','get','UserProfileResource','destroy','end','stack','name','send'];(function(_0x4fe5d5,_0x1700b5){var _0x631ec1=function(_0x531b57){while(--_0x531b57){_0x4fe5d5['push'](_0x4fe5d5['shift']());}};_0x631ec1(++_0x1700b5);}(_0x7473,0x173));var _0x3747=function(_0x382b6d,_0x10ed8a){_0x382b6d=_0x382b6d-0x0;var _0x286179=_0x7473[_0x382b6d];return _0x286179;};'use strict';var emlformat=require(_0x3747('0x0'));var rimraf=require(_0x3747('0x1'));var zipdir=require(_0x3747('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3747('0x3'));var BPromise=require(_0x3747('0x4'));var Mustache=require(_0x3747('0x5'));var util=require('util');var path=require(_0x3747('0x6'));var sox=require(_0x3747('0x7'));var csv=require(_0x3747('0x8'));var ejs=require(_0x3747('0x9'));var fs=require('fs');var fs_extra=require(_0x3747('0xa'));var _=require(_0x3747('0xb'));var squel=require(_0x3747('0xc'));var crypto=require(_0x3747('0xd'));var jsforce=require(_0x3747('0xe'));var deskjs=require(_0x3747('0xf'));var toCsv=require(_0x3747('0x8'));var querystring=require(_0x3747('0x10'));var Papa=require(_0x3747('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3747('0x12'));var as=require(_0x3747('0x13'));var hardwareService=require(_0x3747('0x14'));var logger=require(_0x3747('0x15'))(_0x3747('0x16'));var utils=require(_0x3747('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3747('0x18'))['db'];config['redis']=_[_0x3747('0x19')](config[_0x3747('0x1a')],{'host':_0x3747('0x1b'),'port':0x18eb});var socket=require(_0x3747('0x1c'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x3747('0x1d')](socket);function respondWithStatusCode(_0x470f79,_0x18e3f9){_0x18e3f9=_0x18e3f9||0xcc;return function(_0x28f70d){if(_0x28f70d){return _0x470f79[_0x3747('0x1e')](_0x18e3f9);}return _0x470f79['status'](_0x18e3f9)['end']();};}function respondWithResult(_0x4753ef,_0x59b10d){_0x59b10d=_0x59b10d||0xc8;return function(_0x3f54a4){if(_0x3f54a4){return _0x4753ef[_0x3747('0x1f')](_0x59b10d)[_0x3747('0x20')](_0x3f54a4);}};}function respondWithFilteredResult(_0x41334e,_0x457fd7){return function(_0x890833){if(_0x890833){var _0x213119=typeof _0x457fd7[_0x3747('0x21')]==='undefined'&&typeof _0x457fd7[_0x3747('0x22')]===_0x3747('0x23');var _0x2d3840=_0x890833[_0x3747('0x24')];var _0x1f8e83=_0x213119?0x0:_0x457fd7[_0x3747('0x21')];var _0x87db16=_0x213119?_0x890833[_0x3747('0x24')]:_0x457fd7['offset']+_0x457fd7[_0x3747('0x22')];var _0x4c41ae;if(_0x87db16>=_0x2d3840){_0x87db16=_0x2d3840;_0x4c41ae=0xc8;}else{_0x4c41ae=0xce;}_0x41334e[_0x3747('0x1f')](_0x4c41ae);return _0x41334e[_0x3747('0x25')](_0x3747('0x26'),_0x1f8e83+'-'+_0x87db16+'/'+_0x2d3840)['json'](_0x890833);}return null;};}function patchUpdates(_0x1aa8d1){return function(_0x1d1456){try{jsonpatch['apply'](_0x1d1456,_0x1aa8d1,!![]);}catch(_0xba8d2a){return BPromise[_0x3747('0x27')](_0xba8d2a);}return _0x1d1456[_0x3747('0x28')]();};}function saveUpdates(_0x4d6996,_0x4c656d){return function(_0x2bedb4){if(_0x2bedb4){return _0x2bedb4['update'](_0x4d6996)[_0x3747('0x29')](function(_0x262729){return _0x262729;});}return null;};}function removeEntity(_0x35165e,_0x1f43e0){return function(_0x2fe170){if(_0x2fe170){return _0x2fe170['destroy']()[_0x3747('0x29')](function(){var _0x36663a=_0x2fe170[_0x3747('0x2a')]({'plain':!![]});var _0x540178='WhatsappQueues';return db[_0x3747('0x2b')][_0x3747('0x2c')]({'where':{'type':_0x540178,'resourceId':_0x36663a['id']}})[_0x3747('0x29')](function(){return _0x2fe170;});})['then'](function(){_0x35165e[_0x3747('0x1f')](0xcc)[_0x3747('0x2d')]();});}};}function handleEntityNotFound(_0x31c22d,_0x47a0e0){return function(_0x194bc7){if(!_0x194bc7){_0x31c22d[_0x3747('0x1e')](0x194);}return _0x194bc7;};}function handleError(_0x56bafc,_0x5ef80a){_0x5ef80a=_0x5ef80a||0x1f4;return function(_0x2e0e6f){logger['error'](_0x2e0e6f[_0x3747('0x2e')]);if(_0x2e0e6f[_0x3747('0x2f')]){delete _0x2e0e6f[_0x3747('0x2f')];}_0x56bafc[_0x3747('0x1f')](_0x5ef80a)[_0x3747('0x30')](_0x2e0e6f);};}exports[_0x3747('0x31')]=function(_0x216cdd,_0x433d2a){var _0xe00053={},_0x26a485={},_0x461eb5={'count':0x0,'rows':[]};var _0x4683a6=_[_0x3747('0x32')](db[_0x3747('0x33')]['rawAttributes'],function(_0x23798a){return{'name':_0x23798a[_0x3747('0x34')],'type':_0x23798a[_0x3747('0x35')][_0x3747('0x36')]};});_0x26a485[_0x3747('0x37')]=_[_0x3747('0x32')](_0x4683a6,_0x3747('0x2f'));_0x26a485[_0x3747('0x38')]=_[_0x3747('0x39')](_0x216cdd[_0x3747('0x38')]);_0x26a485[_0x3747('0x3a')]=_[_0x3747('0x3b')](_0x26a485['model'],_0x26a485[_0x3747('0x38')]);_0xe00053[_0x3747('0x3c')]=_[_0x3747('0x3b')](_0x26a485[_0x3747('0x37')],qs[_0x3747('0x3d')](_0x216cdd['query'][_0x3747('0x3d')]));_0xe00053[_0x3747('0x3c')]=_0xe00053[_0x3747('0x3c')][_0x3747('0x3e')]?_0xe00053[_0x3747('0x3c')]:_0x26a485[_0x3747('0x37')];if(!_0x216cdd[_0x3747('0x38')][_0x3747('0x3f')](_0x3747('0x40'))){_0xe00053[_0x3747('0x22')]=qs[_0x3747('0x22')](_0x216cdd[_0x3747('0x38')][_0x3747('0x22')]);_0xe00053['offset']=qs['offset'](_0x216cdd[_0x3747('0x38')][_0x3747('0x21')]);}_0xe00053[_0x3747('0x41')]=qs[_0x3747('0x42')](_0x216cdd[_0x3747('0x38')]['sort']);_0xe00053['where']=qs[_0x3747('0x3a')](_[_0x3747('0x43')](_0x216cdd[_0x3747('0x38')],_0x26a485[_0x3747('0x3a')]),_0x4683a6);if(_0x216cdd['query'][_0x3747('0x44')]){_0xe00053[_0x3747('0x45')]=_[_0x3747('0x46')](_0xe00053[_0x3747('0x45')],{'$or':_['map'](_0x4683a6,function(_0x1764f3){if(_0x1764f3[_0x3747('0x35')]!=='VIRTUAL'){var _0x42fdaa={};_0x42fdaa[_0x1764f3[_0x3747('0x2f')]]={'$like':'%'+_0x216cdd[_0x3747('0x38')][_0x3747('0x44')]+'%'};return _0x42fdaa;}})});}_0xe00053=_[_0x3747('0x46')]({},_0xe00053,_0x216cdd[_0x3747('0x47')]);var _0x5e7bf2={'where':_0xe00053[_0x3747('0x45')]};return db[_0x3747('0x33')][_0x3747('0x24')](_0x5e7bf2)[_0x3747('0x29')](function(_0x2e8092){_0x461eb5[_0x3747('0x24')]=_0x2e8092;if(_0x216cdd['query'][_0x3747('0x48')]){_0xe00053[_0x3747('0x49')]=[{'all':!![]}];}return db[_0x3747('0x33')]['findAll'](_0xe00053);})[_0x3747('0x29')](function(_0x2483e3){_0x461eb5['rows']=_0x2483e3;return _0x461eb5;})[_0x3747('0x29')](respondWithFilteredResult(_0x433d2a,_0xe00053))['catch'](handleError(_0x433d2a,null));};exports[_0x3747('0x4a')]=function(_0x53eb9e,_0x4439b8){var _0x2e359e={'raw':!![],'where':{'id':_0x53eb9e[_0x3747('0x4b')]['id']}},_0x3faf9b={};_0x3faf9b[_0x3747('0x37')]=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x3faf9b['query']=_[_0x3747('0x39')](_0x53eb9e['query']);_0x3faf9b[_0x3747('0x3a')]=_[_0x3747('0x3b')](_0x3faf9b[_0x3747('0x37')],_0x3faf9b[_0x3747('0x38')]);_0x2e359e[_0x3747('0x3c')]=_[_0x3747('0x3b')](_0x3faf9b[_0x3747('0x37')],qs['fields'](_0x53eb9e[_0x3747('0x38')]['fields']));_0x2e359e[_0x3747('0x3c')]=_0x2e359e[_0x3747('0x3c')]['length']?_0x2e359e['attributes']:_0x3faf9b[_0x3747('0x37')];if(_0x53eb9e['query'][_0x3747('0x48')]){_0x2e359e[_0x3747('0x49')]=[{'all':!![]}];}_0x2e359e=_[_0x3747('0x46')]({},_0x2e359e,_0x53eb9e[_0x3747('0x47')]);return db[_0x3747('0x33')]['find'](_0x2e359e)[_0x3747('0x29')](handleEntityNotFound(_0x4439b8,null))[_0x3747('0x29')](respondWithResult(_0x4439b8,null))[_0x3747('0x4c')](handleError(_0x4439b8,null));};exports['create']=function(_0x1a504a,_0x30cf02){return db[_0x3747('0x33')]['create'](_0x1a504a[_0x3747('0x4d')],{})['then'](function(_0x177437){var _0x2f9ef0=_0x1a504a[_0x3747('0x4e')][_0x3747('0x2a')]({'plain':!![]});if(!_0x2f9ef0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f9ef0[_0x3747('0x4f')]===_0x3747('0x4e')){var _0x104834=_0x177437[_0x3747('0x2a')]({'plain':!![]});var _0x241a25=_0x3747('0x50');return db['UserProfileSection'][_0x3747('0x51')]({'where':{'name':_0x241a25,'userProfileId':_0x2f9ef0[_0x3747('0x52')]},'raw':!![]})[_0x3747('0x29')](function(_0xf14449){if(_0xf14449&&_0xf14449[_0x3747('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x104834[_0x3747('0x2f')],'resourceId':_0x104834['id'],'type':_0xf14449[_0x3747('0x2f')],'sectionId':_0xf14449['id']},{})[_0x3747('0x29')](function(){return _0x177437;});}else{return _0x177437;}})[_0x3747('0x4c')](function(_0x39a5ec){logger[_0x3747('0x54')](_0x3747('0x55'),_0x39a5ec);throw _0x39a5ec;});}return _0x177437;})[_0x3747('0x29')](respondWithResult(_0x30cf02,0xc9))[_0x3747('0x4c')](handleError(_0x30cf02,null));};exports[_0x3747('0x56')]=function(_0x1430ef,_0x32ab94){if(_0x1430ef[_0x3747('0x4d')]['id']){delete _0x1430ef[_0x3747('0x4d')]['id'];}return db[_0x3747('0x33')][_0x3747('0x51')]({'where':{'id':_0x1430ef[_0x3747('0x4b')]['id']}})[_0x3747('0x29')](handleEntityNotFound(_0x32ab94,null))[_0x3747('0x29')](saveUpdates(_0x1430ef[_0x3747('0x4d')],null))[_0x3747('0x29')](respondWithResult(_0x32ab94,null))[_0x3747('0x4c')](handleError(_0x32ab94,null));};exports[_0x3747('0x2c')]=function(_0x3c9b6c,_0x42b047){return db[_0x3747('0x33')][_0x3747('0x51')]({'where':{'id':_0x3c9b6c[_0x3747('0x4b')]['id']}})[_0x3747('0x29')](handleEntityNotFound(_0x42b047,null))['then'](removeEntity(_0x42b047,null))[_0x3747('0x4c')](handleError(_0x42b047,null));};exports[_0x3747('0x57')]=function(_0x4cc9ac,_0x47cc0d){return db[_0x3747('0x33')][_0x3747('0x57')]()['then'](respondWithResult(_0x47cc0d,null))['catch'](handleError(_0x47cc0d,null));};exports[_0x3747('0x58')]=function(_0x44b4c0,_0x1ddd4b,_0x5518fb){var _0xaa8e8e={'raw':!![],'where':{}},_0x29e4d4={},_0x52e8d5;return db[_0x3747('0x33')][_0x3747('0x59')]({'where':{'id':_0x44b4c0['params']['id']}})[_0x3747('0x29')](handleEntityNotFound(_0x1ddd4b,null))[_0x3747('0x29')](function(_0x36958a){if(_0x36958a){_0x52e8d5=_0x36958a[_0x3747('0x2a')]({'plain':!![]});_0x29e4d4[_0x3747('0x37')]=_[_0x3747('0x39')](db['UserWhatsappQueue']['rawAttributes']);_0x29e4d4[_0x3747('0x38')]=_[_0x3747('0x39')](_0x44b4c0['query']);_0x29e4d4[_0x3747('0x3a')]=_[_0x3747('0x3b')](_0x29e4d4[_0x3747('0x37')],_0x29e4d4[_0x3747('0x38')]);_0xaa8e8e[_0x3747('0x3c')]=_['intersection'](_0x29e4d4[_0x3747('0x37')],qs[_0x3747('0x3d')](_0x44b4c0[_0x3747('0x38')][_0x3747('0x3d')]));_0xaa8e8e[_0x3747('0x3c')]=_0xaa8e8e['attributes'][_0x3747('0x3e')]?_0xaa8e8e[_0x3747('0x3c')]:_0x29e4d4[_0x3747('0x37')];if(!_0x44b4c0[_0x3747('0x38')]['hasOwnProperty'](_0x3747('0x40'))){_0xaa8e8e[_0x3747('0x22')]=qs[_0x3747('0x22')](_0x44b4c0[_0x3747('0x38')]['limit']);_0xaa8e8e[_0x3747('0x21')]=qs[_0x3747('0x21')](_0x44b4c0[_0x3747('0x38')][_0x3747('0x21')]);}_0xaa8e8e[_0x3747('0x41')]=qs['sort'](_0x44b4c0[_0x3747('0x38')][_0x3747('0x42')]);_0xaa8e8e['where']=qs[_0x3747('0x3a')](_[_0x3747('0x43')](_0x44b4c0['query'],_0x29e4d4[_0x3747('0x3a')]));_0xaa8e8e[_0x3747('0x45')][_0x3747('0x5a')]=_0x36958a['id'];if(_0x44b4c0[_0x3747('0x38')][_0x3747('0x44')]){_0xaa8e8e[_0x3747('0x45')]=_[_0x3747('0x46')](_0xaa8e8e[_0x3747('0x45')],{'$or':_['map'](_0xaa8e8e[_0x3747('0x3c')],function(_0x4dcd61){var _0x55f88f={};_0x55f88f[_0x4dcd61]={'$like':'%'+_0x44b4c0[_0x3747('0x38')][_0x3747('0x44')]+'%'};return _0x55f88f;})});}_0xaa8e8e=_['merge']({},_0xaa8e8e,_0x44b4c0[_0x3747('0x47')]);return db['UserWhatsappQueue'][_0x3747('0x5b')](_0xaa8e8e);}})[_0x3747('0x29')](function(_0x2d419b){if(_0x2d419b){return db['User']['findAndCountAll']({'where':{'id':_[_0x3747('0x32')](_0x2d419b,_0x3747('0x5c')),'role':'agent'},'attributes':['id',_0x3747('0x2f'),_0x3747('0x5d'),'updatedAt','createdAt']});}})[_0x3747('0x29')](function(_0x272f05){if(_0x272f05){return{'count':_0x272f05[_0x3747('0x24')],'rows':_['map'](_0x272f05[_0x3747('0x5e')],function(_0x4d734a){return{'membername':_0x4d734a['name'],'UserId':_0x4d734a['id'],'queue_name':_0x52e8d5[_0x3747('0x2f')],'WhatsappQueueId':_0x52e8d5['id'],'interface':util[_0x3747('0x5f')](_0x3747('0x60'),_0x3747('0x61'),_0x4d734a['name']),'penalty':0x0,'paused':_0x4d734a['whatsappPause'],'createdAt':_0x4d734a[_0x3747('0x62')],'updatedAt':_0x4d734a[_0x3747('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3747('0x29')](respondWithFilteredResult(_0x1ddd4b,_0xaa8e8e))[_0x3747('0x4c')](handleError(_0x1ddd4b,null));};exports[_0x3747('0x64')]=function(_0x2bd7e2,_0x564ed4,_0x32150b){var _0x1577fe={};var _0x46a024={};var _0x1156cd;var _0x573eab;return db[_0x3747('0x33')][_0x3747('0x59')]({'where':{'id':_0x2bd7e2['params']['id']}})[_0x3747('0x29')](handleEntityNotFound(_0x564ed4,null))[_0x3747('0x29')](function(_0x5e883){if(_0x5e883){_0x1156cd=_0x5e883;_0x46a024[_0x3747('0x37')]=_[_0x3747('0x39')](db[_0x3747('0x65')]['rawAttributes']);_0x46a024[_0x3747('0x38')]=_[_0x3747('0x39')](_0x2bd7e2['query']);_0x46a024[_0x3747('0x3a')]=_[_0x3747('0x3b')](_0x46a024['model'],_0x46a024['query']);_0x1577fe['attributes']=_[_0x3747('0x3b')](_0x46a024[_0x3747('0x37')],qs[_0x3747('0x3d')](_0x2bd7e2['query'][_0x3747('0x3d')]));_0x1577fe[_0x3747('0x3c')]=_0x1577fe[_0x3747('0x3c')]['length']?_0x1577fe['attributes']:_0x46a024[_0x3747('0x37')];_0x1577fe['order']=qs[_0x3747('0x42')](_0x2bd7e2[_0x3747('0x38')][_0x3747('0x42')]);_0x1577fe['where']=qs[_0x3747('0x3a')](_['pick'](_0x2bd7e2[_0x3747('0x38')],_0x46a024[_0x3747('0x3a')]));if(_0x2bd7e2[_0x3747('0x38')][_0x3747('0x44')]){_0x1577fe[_0x3747('0x45')]=_[_0x3747('0x46')](_0x1577fe[_0x3747('0x45')],{'$or':_['map'](_0x1577fe[_0x3747('0x3c')],function(_0x435384){var _0x57450a={};_0x57450a[_0x435384]={'$like':'%'+_0x2bd7e2[_0x3747('0x38')][_0x3747('0x44')]+'%'};return _0x57450a;})});}_0x1577fe=_['merge']({},_0x1577fe,_0x2bd7e2['options']);return _0x1156cd[_0x3747('0x64')](_0x1577fe);}})[_0x3747('0x29')](function(_0x3a1ebb){if(_0x3a1ebb){_0x573eab=_0x3a1ebb[_0x3747('0x3e')];if(!_0x2bd7e2['query'][_0x3747('0x3f')](_0x3747('0x40'))){_0x1577fe[_0x3747('0x22')]=qs['limit'](_0x2bd7e2['query'][_0x3747('0x22')]);_0x1577fe['offset']=qs['offset'](_0x2bd7e2[_0x3747('0x38')][_0x3747('0x21')]);}return _0x1156cd[_0x3747('0x64')](_0x1577fe);}})['then'](function(_0x80e635){if(_0x80e635){return _0x80e635?{'count':_0x573eab,'rows':_0x80e635}:null;}})[_0x3747('0x29')](respondWithResult(_0x564ed4,null))[_0x3747('0x4c')](handleError(_0x564ed4,null));};exports[_0x3747('0x66')]=function(_0x5c73bc,_0x3318f6,_0x29b9c4){var _0x314bec=_0x5c73bc[_0x3747('0x4d')]['ids'];return db[_0x3747('0x65')][_0x3747('0x5b')]({'where':{'id':_0x314bec},'attributes':['id'],'include':[{'model':db[_0x3747('0x67')],'as':_0x3747('0x68'),'attributes':['id','name',_0x3747('0x69'),'voicePause',_0x3747('0x6a')],'raw':!![]}]})[_0x3747('0x29')](function(_0x5cfeea){if(_0x5cfeea){var _0xb1b733=_[_0x3747('0x6b')](_0x5cfeea,function(_0x34b073){var _0x45663a=_0x34b073[_0x3747('0x2a')]({'plain':!![]});return _0x45663a['Agents'];});return db[_0x3747('0x33')][_0x3747('0x51')]({'where':{'id':_0x5c73bc[_0x3747('0x4b')]['id']}})[_0x3747('0x29')](function(_0x342aca){return db[_0x3747('0x6c')][_0x3747('0x6d')](function(_0x47fb02){return _0x342aca[_0x3747('0x66')](_0x314bec,{'transaction':_0x47fb02})[_0x3747('0x29')](function(){return BPromise['each'](_0xb1b733,function(_0x34295a){return db[_0x3747('0x6e')]['findOrCreate']({'where':{'UserId':_0x34295a['id'],'WhatsappQueueId':_0x5c73bc[_0x3747('0x4b')]['id']},'transaction':_0x47fb02});});})[_0x3747('0x29')](function(){_0xb1b733[_0x3747('0x6f')](function(_0x44e970){socket['emit'](_0x3747('0x70'),{'UserId':_0x44e970['id'],'WhatsappQueueId':_0x342aca['id']});});});});});}})[_0x3747('0x29')](respondWithStatusCode(_0x3318f6,null))[_0x3747('0x4c')](handleError(_0x3318f6,null));};exports[_0x3747('0x71')]=function(_0x4f8c9c,_0x585e44,_0x2cbb05){return db[_0x3747('0x65')][_0x3747('0x5b')]({'where':{'id':_0x4f8c9c[_0x3747('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3747('0x67')],'as':_0x3747('0x68'),'attributes':['id'],'raw':!![]}]})[_0x3747('0x29')](handleEntityNotFound(_0x585e44,null))[_0x3747('0x29')](function(_0x1fbe0f){var _0x17ac83=_[_0x3747('0x32')](_0x1fbe0f,'id');var _0x175538=[];var _0x4a8b4f=[];var _0x258083=squel[_0x3747('0x72')]();_0x258083['field'](_0x3747('0x73'))[_0x3747('0x74')](_0x3747('0x75'),'tq')[_0x3747('0x76')](_0x3747('0x77'),'ut',_0x3747('0x78'))[_0x3747('0x45')](_0x3747('0x79'),_0x4f8c9c[_0x3747('0x4b')]['id']);for(var _0x313fbd=0x0;_0x313fbd<_0x1fbe0f[_0x3747('0x3e')];_0x313fbd+=0x1){let _0x17485b=_0x1fbe0f[_0x313fbd];for(var _0x5a6ab6=0x0;_0x5a6ab6<_0x17485b[_0x3747('0x68')][_0x3747('0x3e')];_0x5a6ab6+=0x1){let _0x13edae=_0x17485b['Agents'][_0x5a6ab6];var _0x4c350c=_0x258083[_0x3747('0x7a')]();_0x4c350c[_0x3747('0x45')](_0x3747('0x7b'),_0x13edae['id']);_0x4a8b4f[_0x3747('0x7c')](db[_0x3747('0x6c')][_0x3747('0x38')](_0x4c350c['toString'](),{'type':db[_0x3747('0x6c')]['QueryTypes'][_0x3747('0x7d')]})[_0x3747('0x29')](function(_0x5e1221){if(_0x5e1221[_0x3747('0x3e')]===0x1){return _0x13edae['id'];}else{var _0x10aaee=_[_0x3747('0x7e')](_[_0x3747('0x32')](_0x5e1221,_0x3747('0x7f')),function(_0x4f73a5){return _['includes'](_0x17ac83,_0x4f73a5);});if(_0x10aaee){return _0x13edae['id'];}}}));}}return BPromise['all'](_0x4a8b4f)[_0x3747('0x29')](function(_0x3360c5){_0x175538=_(_0x175538)[_0x3747('0x80')](_0x3360c5)[_0x3747('0x81')]()[_0x3747('0x82')]();return db[_0x3747('0x33')][_0x3747('0x51')]({'where':{'id':_0x4f8c9c[_0x3747('0x4b')]['id']}})[_0x3747('0x29')](function(_0x3b1352){return db['sequelize'][_0x3747('0x6d')](function(_0x4c8784){return _0x3b1352[_0x3747('0x71')](_0x4f8c9c['query'][_0x3747('0x83')],{'transaction':_0x4c8784})[_0x3747('0x29')](function(){if(!_[_0x3747('0x84')](_0x175538)){return _0x3b1352['removeAgents'](_0x175538,{'transaction':_0x4c8784});}})[_0x3747('0x29')](function(){_0x175538['forEach'](function(_0x205300){socket[_0x3747('0x85')](_0x3747('0x86'),{'UserId':_0x205300,'WhatsappQueueId':_0x3b1352['id']});});});});});});})[_0x3747('0x29')](respondWithStatusCode(_0x585e44,null))[_0x3747('0x4c')](handleError(_0x585e44,null));};exports[_0x3747('0x87')]=function(_0x5a7701,_0x16aa9e,_0x1188b5){return db['WhatsappQueue']['find']({'where':{'id':_0x5a7701[_0x3747('0x4b')]['id']}})[_0x3747('0x29')](handleEntityNotFound(_0x16aa9e,null))['then'](function(_0x16f6c9){if(_0x16f6c9){return _0x16f6c9[_0x3747('0x87')](_0x5a7701[_0x3747('0x4d')]['ids'],_['omit'](_0x5a7701[_0x3747('0x4d')],[_0x3747('0x83'),'id'])||{})[_0x3747('0x88')](function(_0x102a69){for(var _0x12bdf5=0x0;_0x12bdf5<_0x5a7701['body']['ids']['length'];_0x12bdf5+=0x1){socket[_0x3747('0x85')](_0x3747('0x70'),{'UserId':Number(_0x5a7701['body']['ids'][_0x12bdf5]),'WhatsappQueueId':Number(_0x5a7701[_0x3747('0x4b')]['id'])});}return _0x102a69;});}})['then'](respondWithResult(_0x16aa9e,null))[_0x3747('0x4c')](handleError(_0x16aa9e,null));};exports[_0x3747('0x89')]=function(_0x1f3879,_0x4a600e,_0x3c76ee){return db['WhatsappQueue']['find']({'where':{'id':_0x1f3879[_0x3747('0x4b')]['id']}})[_0x3747('0x29')](handleEntityNotFound(_0x4a600e,null))['then'](function(_0x3ed53b){if(_0x3ed53b){return _0x3ed53b[_0x3747('0x89')](_0x1f3879[_0x3747('0x38')][_0x3747('0x83')])['then'](function(){if(_['isArray'](_0x1f3879[_0x3747('0x38')][_0x3747('0x83')])){for(var _0x26179c=0x0;_0x26179c<_0x1f3879['query'][_0x3747('0x83')]['length'];_0x26179c+=0x1){socket[_0x3747('0x85')](_0x3747('0x86'),{'UserId':Number(_0x1f3879[_0x3747('0x38')][_0x3747('0x83')][_0x26179c]),'WhatsappQueueId':Number(_0x1f3879[_0x3747('0x4b')]['id'])});}}else{socket['emit'](_0x3747('0x86'),{'UserId':Number(_0x1f3879[_0x3747('0x38')][_0x3747('0x83')]),'WhatsappQueueId':Number(_0x1f3879['params']['id'])});}});}})[_0x3747('0x29')](respondWithStatusCode(_0x4a600e,null))[_0x3747('0x4c')](handleError(_0x4a600e,null));};exports[_0x3747('0x8a')]=function(_0x37346f,_0x154804,_0x1518af){var _0xf76c9d={};var _0x353807={};var _0x3e3994;var _0xb83f53;return db[_0x3747('0x33')][_0x3747('0x59')]({'where':{'id':_0x37346f[_0x3747('0x4b')]['id']}})[_0x3747('0x29')](handleEntityNotFound(_0x154804,null))[_0x3747('0x29')](function(_0x1c3baa){if(_0x1c3baa){_0x3e3994=_0x1c3baa;_0x353807[_0x3747('0x37')]=_[_0x3747('0x39')](db[_0x3747('0x67')][_0x3747('0x8b')]);_0x353807[_0x3747('0x38')]=_[_0x3747('0x39')](_0x37346f[_0x3747('0x38')]);_0x353807[_0x3747('0x3a')]=_[_0x3747('0x3b')](_0x353807[_0x3747('0x37')],_0x353807['query']);_0xf76c9d[_0x3747('0x3c')]=_[_0x3747('0x3b')](_0x353807[_0x3747('0x37')],qs[_0x3747('0x3d')](_0x37346f[_0x3747('0x38')][_0x3747('0x3d')]));_0xf76c9d['attributes']=_0xf76c9d[_0x3747('0x3c')][_0x3747('0x3e')]?_0xf76c9d['attributes']:_0x353807['model'];_0xf76c9d[_0x3747('0x41')]=qs[_0x3747('0x42')](_0x37346f[_0x3747('0x38')][_0x3747('0x42')]);_0xf76c9d[_0x3747('0x45')]=qs[_0x3747('0x3a')](_[_0x3747('0x43')](_0x37346f[_0x3747('0x38')],_0x353807[_0x3747('0x3a')]));if(_0x37346f[_0x3747('0x38')][_0x3747('0x44')]){_0xf76c9d[_0x3747('0x45')]=_[_0x3747('0x46')](_0xf76c9d[_0x3747('0x45')],{'$or':_[_0x3747('0x32')](_0xf76c9d[_0x3747('0x3c')],function(_0x96d9d3){var _0x3d4140={};_0x3d4140[_0x96d9d3]={'$like':'%'+_0x37346f[_0x3747('0x38')]['filter']+'%'};return _0x3d4140;})});}_0xf76c9d=_[_0x3747('0x46')]({},_0xf76c9d,_0x37346f[_0x3747('0x47')]);return _0x3e3994[_0x3747('0x8a')](_0xf76c9d);}})['then'](function(_0x15e048){if(_0x15e048){_0xb83f53=_0x15e048[_0x3747('0x3e')];if(!_0x37346f['query'][_0x3747('0x3f')](_0x3747('0x40'))){_0xf76c9d[_0x3747('0x22')]=qs[_0x3747('0x22')](_0x37346f['query'][_0x3747('0x22')]);_0xf76c9d[_0x3747('0x21')]=qs[_0x3747('0x21')](_0x37346f['query'][_0x3747('0x21')]);}return _0x3e3994[_0x3747('0x8a')](_0xf76c9d);}})[_0x3747('0x29')](function(_0x359d17){if(_0x359d17){return _0x359d17?{'count':_0xb83f53,'rows':_0x359d17}:null;}})['then'](respondWithResult(_0x154804,null))[_0x3747('0x4c')](handleError(_0x154804,null));}; \ No newline at end of file +var _0xeb30=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','nolimit','WhatsappQueueId','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userWhatsappQueue:save','removeTeams','ids','select','field','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','compact','isEmpty','emit','addAgents','omit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','WhatsappQueue','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation'];(function(_0x151dc7,_0x1295d8){var _0x4d8be9=function(_0x37554f){while(--_0x37554f){_0x151dc7['push'](_0x151dc7['shift']());}};_0x4d8be9(++_0x1295d8);}(_0xeb30,0xc4));var _0x0eb3=function(_0x266352,_0x26c824){_0x266352=_0x266352-0x0;var _0x5c6497=_0xeb30[_0x266352];return _0x5c6497;};'use strict';var emlformat=require(_0x0eb3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0eb3('0x1'));var moment=require(_0x0eb3('0x2'));var BPromise=require(_0x0eb3('0x3'));var Mustache=require(_0x0eb3('0x4'));var util=require(_0x0eb3('0x5'));var path=require(_0x0eb3('0x6'));var sox=require('sox');var csv=require(_0x0eb3('0x7'));var ejs=require(_0x0eb3('0x8'));var fs=require('fs');var fs_extra=require(_0x0eb3('0x9'));var _=require('lodash');var squel=require(_0x0eb3('0xa'));var crypto=require('crypto');var jsforce=require(_0x0eb3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0eb3('0x7'));var querystring=require(_0x0eb3('0xc'));var Papa=require(_0x0eb3('0xd'));var Redis=require('ioredis');var authService=require(_0x0eb3('0xe'));var qs=require(_0x0eb3('0xf'));var as=require(_0x0eb3('0x10'));var hardwareService=require(_0x0eb3('0x11'));var logger=require('../../config/logger')(_0x0eb3('0x12'));var utils=require(_0x0eb3('0x13'));var config=require(_0x0eb3('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0eb3('0x15')]=_[_0x0eb3('0x16')](config[_0x0eb3('0x15')],{'host':_0x0eb3('0x17'),'port':0x18eb});var socket=require(_0x0eb3('0x18'))(new Redis(config[_0x0eb3('0x15')]));require(_0x0eb3('0x19'))[_0x0eb3('0x1a')](socket);function respondWithStatusCode(_0x41dfcf,_0x3fe4d6){_0x3fe4d6=_0x3fe4d6||0xcc;return function(_0x4b8c5c){if(_0x4b8c5c){return _0x41dfcf[_0x0eb3('0x1b')](_0x3fe4d6);}return _0x41dfcf[_0x0eb3('0x1c')](_0x3fe4d6)[_0x0eb3('0x1d')]();};}function respondWithResult(_0x1e53fd,_0x573021){_0x573021=_0x573021||0xc8;return function(_0x43f7c4){if(_0x43f7c4){return _0x1e53fd['status'](_0x573021)['json'](_0x43f7c4);}};}function respondWithFilteredResult(_0x306224,_0x2eec7f){return function(_0x209400){if(_0x209400){var _0x1ab7bb=typeof _0x2eec7f['offset']===_0x0eb3('0x1e')&&typeof _0x2eec7f[_0x0eb3('0x1f')]===_0x0eb3('0x1e');var _0x3c31fe=_0x209400[_0x0eb3('0x20')];var _0x245845=_0x1ab7bb?0x0:_0x2eec7f[_0x0eb3('0x21')];var _0x3f3008=_0x1ab7bb?_0x209400[_0x0eb3('0x20')]:_0x2eec7f[_0x0eb3('0x21')]+_0x2eec7f[_0x0eb3('0x1f')];var _0x12d84e;if(_0x3f3008>=_0x3c31fe){_0x3f3008=_0x3c31fe;_0x12d84e=0xc8;}else{_0x12d84e=0xce;}_0x306224[_0x0eb3('0x1c')](_0x12d84e);return _0x306224[_0x0eb3('0x22')](_0x0eb3('0x23'),_0x245845+'-'+_0x3f3008+'/'+_0x3c31fe)[_0x0eb3('0x24')](_0x209400);}return null;};}function patchUpdates(_0x1bfe4c){return function(_0x4bb797){try{jsonpatch[_0x0eb3('0x25')](_0x4bb797,_0x1bfe4c,!![]);}catch(_0x54d858){return BPromise[_0x0eb3('0x26')](_0x54d858);}return _0x4bb797[_0x0eb3('0x27')]();};}function saveUpdates(_0x5b33ec,_0x428aa0){return function(_0x440130){if(_0x440130){return _0x440130[_0x0eb3('0x28')](_0x5b33ec)[_0x0eb3('0x29')](function(_0x201753){return _0x201753;});}return null;};}function removeEntity(_0x3864f,_0x4b3750){return function(_0x54287a){if(_0x54287a){return _0x54287a[_0x0eb3('0x2a')]()['then'](function(){var _0x4b18df=_0x54287a[_0x0eb3('0x2b')]({'plain':!![]});var _0x3d1281='WhatsappQueues';return db[_0x0eb3('0x2c')][_0x0eb3('0x2a')]({'where':{'type':_0x3d1281,'resourceId':_0x4b18df['id']}})['then'](function(){return _0x54287a;});})['then'](function(){_0x3864f[_0x0eb3('0x1c')](0xcc)[_0x0eb3('0x1d')]();});}};}function handleEntityNotFound(_0x26b39e,_0x31e61f){return function(_0x94f2e1){if(!_0x94f2e1){_0x26b39e[_0x0eb3('0x1b')](0x194);}return _0x94f2e1;};}function handleError(_0x5e9c5f,_0x227355){_0x227355=_0x227355||0x1f4;return function(_0xa9e085){logger[_0x0eb3('0x2d')](_0xa9e085[_0x0eb3('0x2e')]);if(_0xa9e085[_0x0eb3('0x2f')]){delete _0xa9e085['name'];}_0x5e9c5f[_0x0eb3('0x1c')](_0x227355)[_0x0eb3('0x30')](_0xa9e085);};}exports[_0x0eb3('0x31')]=function(_0x11a905,_0xe95b04){var _0x396dda={},_0x2f0832={},_0x2c27b5={'count':0x0,'rows':[]};var _0x43a5a1=_[_0x0eb3('0x32')](db['WhatsappQueue'][_0x0eb3('0x33')],function(_0x4eb9af){return{'name':_0x4eb9af['fieldName'],'type':_0x4eb9af[_0x0eb3('0x34')][_0x0eb3('0x35')]};});_0x2f0832[_0x0eb3('0x36')]=_['map'](_0x43a5a1,_0x0eb3('0x2f'));_0x2f0832[_0x0eb3('0x37')]=_[_0x0eb3('0x38')](_0x11a905[_0x0eb3('0x37')]);_0x2f0832[_0x0eb3('0x39')]=_['intersection'](_0x2f0832[_0x0eb3('0x36')],_0x2f0832[_0x0eb3('0x37')]);_0x396dda['attributes']=_[_0x0eb3('0x3a')](_0x2f0832[_0x0eb3('0x36')],qs['fields'](_0x11a905[_0x0eb3('0x37')]['fields']));_0x396dda['attributes']=_0x396dda['attributes'][_0x0eb3('0x3b')]?_0x396dda[_0x0eb3('0x3c')]:_0x2f0832[_0x0eb3('0x36')];if(!_0x11a905['query'][_0x0eb3('0x3d')]('nolimit')){_0x396dda[_0x0eb3('0x1f')]=qs['limit'](_0x11a905['query']['limit']);_0x396dda['offset']=qs['offset'](_0x11a905['query'][_0x0eb3('0x21')]);}_0x396dda[_0x0eb3('0x3e')]=qs[_0x0eb3('0x3f')](_0x11a905['query']['sort']);_0x396dda['where']=qs[_0x0eb3('0x39')](_[_0x0eb3('0x40')](_0x11a905[_0x0eb3('0x37')],_0x2f0832['filters']),_0x43a5a1);if(_0x11a905['query'][_0x0eb3('0x41')]){_0x396dda['where']=_[_0x0eb3('0x42')](_0x396dda[_0x0eb3('0x43')],{'$or':_[_0x0eb3('0x32')](_0x43a5a1,function(_0x109fc4){if(_0x109fc4[_0x0eb3('0x34')]!==_0x0eb3('0x44')){var _0x2ecb1a={};_0x2ecb1a[_0x109fc4['name']]={'$like':'%'+_0x11a905[_0x0eb3('0x37')]['filter']+'%'};return _0x2ecb1a;}})});}_0x396dda=_[_0x0eb3('0x42')]({},_0x396dda,_0x11a905[_0x0eb3('0x45')]);var _0x45cfd0={'where':_0x396dda[_0x0eb3('0x43')]};return db['WhatsappQueue']['count'](_0x45cfd0)[_0x0eb3('0x29')](function(_0x289b50){_0x2c27b5[_0x0eb3('0x20')]=_0x289b50;if(_0x11a905[_0x0eb3('0x37')][_0x0eb3('0x46')]){_0x396dda[_0x0eb3('0x47')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x396dda);})[_0x0eb3('0x29')](function(_0x432991){_0x2c27b5[_0x0eb3('0x48')]=_0x432991;return _0x2c27b5;})[_0x0eb3('0x29')](respondWithFilteredResult(_0xe95b04,_0x396dda))['catch'](handleError(_0xe95b04,null));};exports[_0x0eb3('0x49')]=function(_0x4f51ef,_0x1ba97c){var _0x57dc1d={'raw':!![],'where':{'id':_0x4f51ef[_0x0eb3('0x4a')]['id']}},_0x3d2fc6={};_0x3d2fc6[_0x0eb3('0x36')]=_[_0x0eb3('0x38')](db[_0x0eb3('0x4b')][_0x0eb3('0x33')]);_0x3d2fc6['query']=_[_0x0eb3('0x38')](_0x4f51ef[_0x0eb3('0x37')]);_0x3d2fc6[_0x0eb3('0x39')]=_[_0x0eb3('0x3a')](_0x3d2fc6[_0x0eb3('0x36')],_0x3d2fc6[_0x0eb3('0x37')]);_0x57dc1d[_0x0eb3('0x3c')]=_[_0x0eb3('0x3a')](_0x3d2fc6[_0x0eb3('0x36')],qs[_0x0eb3('0x4c')](_0x4f51ef['query'][_0x0eb3('0x4c')]));_0x57dc1d[_0x0eb3('0x3c')]=_0x57dc1d[_0x0eb3('0x3c')]['length']?_0x57dc1d[_0x0eb3('0x3c')]:_0x3d2fc6[_0x0eb3('0x36')];if(_0x4f51ef[_0x0eb3('0x37')][_0x0eb3('0x46')]){_0x57dc1d['include']=[{'all':!![]}];}_0x57dc1d=_['merge']({},_0x57dc1d,_0x4f51ef[_0x0eb3('0x45')]);return db[_0x0eb3('0x4b')][_0x0eb3('0x4d')](_0x57dc1d)[_0x0eb3('0x29')](handleEntityNotFound(_0x1ba97c,null))['then'](respondWithResult(_0x1ba97c,null))[_0x0eb3('0x4e')](handleError(_0x1ba97c,null));};exports[_0x0eb3('0x4f')]=function(_0xd6949c,_0x25d16e){return db[_0x0eb3('0x4b')][_0x0eb3('0x4f')](_0xd6949c[_0x0eb3('0x50')],{})[_0x0eb3('0x29')](function(_0x3f9eaa){var _0x3f85dd=_0xd6949c[_0x0eb3('0x51')][_0x0eb3('0x2b')]({'plain':!![]});if(!_0x3f85dd)throw new Error(_0x0eb3('0x52'));if(_0x3f85dd[_0x0eb3('0x53')]===_0x0eb3('0x51')){var _0x54afe9=_0x3f9eaa[_0x0eb3('0x2b')]({'plain':!![]});var _0x44be6d=_0x0eb3('0x54');return db[_0x0eb3('0x55')][_0x0eb3('0x4d')]({'where':{'name':_0x44be6d,'userProfileId':_0x3f85dd[_0x0eb3('0x56')]},'raw':!![]})[_0x0eb3('0x29')](function(_0x54d50e){if(_0x54d50e&&_0x54d50e[_0x0eb3('0x57')]===0x0){return db['UserProfileResource'][_0x0eb3('0x4f')]({'name':_0x54afe9[_0x0eb3('0x2f')],'resourceId':_0x54afe9['id'],'type':_0x54d50e[_0x0eb3('0x2f')],'sectionId':_0x54d50e['id']},{})['then'](function(){return _0x3f9eaa;});}else{return _0x3f9eaa;}})[_0x0eb3('0x4e')](function(_0x1273a0){logger[_0x0eb3('0x2d')](_0x0eb3('0x58'),_0x1273a0);throw _0x1273a0;});}return _0x3f9eaa;})['then'](respondWithResult(_0x25d16e,0xc9))['catch'](handleError(_0x25d16e,null));};exports[_0x0eb3('0x28')]=function(_0x1def55,_0x3fe124){if(_0x1def55[_0x0eb3('0x50')]['id']){delete _0x1def55[_0x0eb3('0x50')]['id'];}return db[_0x0eb3('0x4b')][_0x0eb3('0x4d')]({'where':{'id':_0x1def55[_0x0eb3('0x4a')]['id']}})[_0x0eb3('0x29')](handleEntityNotFound(_0x3fe124,null))['then'](saveUpdates(_0x1def55[_0x0eb3('0x50')],null))[_0x0eb3('0x29')](respondWithResult(_0x3fe124,null))[_0x0eb3('0x4e')](handleError(_0x3fe124,null));};exports[_0x0eb3('0x2a')]=function(_0x482c9f,_0x536ad7){return db[_0x0eb3('0x4b')][_0x0eb3('0x4d')]({'where':{'id':_0x482c9f[_0x0eb3('0x4a')]['id']}})[_0x0eb3('0x29')](handleEntityNotFound(_0x536ad7,null))[_0x0eb3('0x29')](removeEntity(_0x536ad7,null))[_0x0eb3('0x4e')](handleError(_0x536ad7,null));};exports[_0x0eb3('0x59')]=function(_0x21009b,_0x48741c){return db[_0x0eb3('0x4b')][_0x0eb3('0x59')]()[_0x0eb3('0x29')](respondWithResult(_0x48741c,null))['catch'](handleError(_0x48741c,null));};exports['getMembers']=function(_0x44a7af,_0x415995,_0x5c3b71){var _0xf18165={'raw':!![],'where':{}},_0x21921d={},_0x12b7e9;return db['WhatsappQueue'][_0x0eb3('0x5a')]({'where':{'id':_0x44a7af[_0x0eb3('0x4a')]['id']}})[_0x0eb3('0x29')](handleEntityNotFound(_0x415995,null))[_0x0eb3('0x29')](function(_0x1e6c07){if(_0x1e6c07){_0x12b7e9=_0x1e6c07['get']({'plain':!![]});_0x21921d[_0x0eb3('0x36')]=_['keys'](db['UserWhatsappQueue'][_0x0eb3('0x33')]);_0x21921d['query']=_[_0x0eb3('0x38')](_0x44a7af[_0x0eb3('0x37')]);_0x21921d[_0x0eb3('0x39')]=_[_0x0eb3('0x3a')](_0x21921d['model'],_0x21921d[_0x0eb3('0x37')]);_0xf18165[_0x0eb3('0x3c')]=_[_0x0eb3('0x3a')](_0x21921d['model'],qs[_0x0eb3('0x4c')](_0x44a7af[_0x0eb3('0x37')][_0x0eb3('0x4c')]));_0xf18165['attributes']=_0xf18165[_0x0eb3('0x3c')]['length']?_0xf18165[_0x0eb3('0x3c')]:_0x21921d[_0x0eb3('0x36')];if(!_0x44a7af[_0x0eb3('0x37')][_0x0eb3('0x3d')](_0x0eb3('0x5b'))){_0xf18165[_0x0eb3('0x1f')]=qs[_0x0eb3('0x1f')](_0x44a7af[_0x0eb3('0x37')][_0x0eb3('0x1f')]);_0xf18165[_0x0eb3('0x21')]=qs[_0x0eb3('0x21')](_0x44a7af[_0x0eb3('0x37')][_0x0eb3('0x21')]);}_0xf18165[_0x0eb3('0x3e')]=qs[_0x0eb3('0x3f')](_0x44a7af[_0x0eb3('0x37')][_0x0eb3('0x3f')]);_0xf18165['where']=qs[_0x0eb3('0x39')](_[_0x0eb3('0x40')](_0x44a7af[_0x0eb3('0x37')],_0x21921d['filters']));_0xf18165[_0x0eb3('0x43')][_0x0eb3('0x5c')]=_0x1e6c07['id'];if(_0x44a7af['query'][_0x0eb3('0x41')]){_0xf18165[_0x0eb3('0x43')]=_['merge'](_0xf18165[_0x0eb3('0x43')],{'$or':_[_0x0eb3('0x32')](_0xf18165['attributes'],function(_0x14a5f4){var _0x19cdc9={};_0x19cdc9[_0x14a5f4]={'$like':'%'+_0x44a7af[_0x0eb3('0x37')][_0x0eb3('0x41')]+'%'};return _0x19cdc9;})});}_0xf18165=_[_0x0eb3('0x42')]({},_0xf18165,_0x44a7af[_0x0eb3('0x45')]);return db[_0x0eb3('0x5d')][_0x0eb3('0x5e')](_0xf18165);}})[_0x0eb3('0x29')](function(_0x143d07){if(_0x143d07){return db[_0x0eb3('0x5f')][_0x0eb3('0x60')]({'where':{'id':_['map'](_0x143d07,_0x0eb3('0x61')),'role':_0x0eb3('0x62')},'attributes':['id',_0x0eb3('0x2f'),'whatsappPause',_0x0eb3('0x63'),'createdAt']});}})[_0x0eb3('0x29')](function(_0x1cc5f0){if(_0x1cc5f0){return{'count':_0x1cc5f0[_0x0eb3('0x20')],'rows':_[_0x0eb3('0x32')](_0x1cc5f0[_0x0eb3('0x48')],function(_0x42bb5a){return{'membername':_0x42bb5a[_0x0eb3('0x2f')],'UserId':_0x42bb5a['id'],'queue_name':_0x12b7e9[_0x0eb3('0x2f')],'WhatsappQueueId':_0x12b7e9['id'],'interface':util[_0x0eb3('0x64')](_0x0eb3('0x65'),_0x0eb3('0x66'),_0x42bb5a['name']),'penalty':0x0,'paused':_0x42bb5a['whatsappPause'],'createdAt':_0x42bb5a[_0x0eb3('0x67')],'updatedAt':_0x42bb5a[_0x0eb3('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0eb3('0x29')](respondWithFilteredResult(_0x415995,_0xf18165))['catch'](handleError(_0x415995,null));};exports[_0x0eb3('0x68')]=function(_0x40e613,_0x5341a2,_0x26bed9){var _0x588fe4={};var _0x1d5686={};var _0x2eb16b;var _0x30b4ec;return db[_0x0eb3('0x4b')][_0x0eb3('0x5a')]({'where':{'id':_0x40e613['params']['id']}})[_0x0eb3('0x29')](handleEntityNotFound(_0x5341a2,null))[_0x0eb3('0x29')](function(_0x3e3b68){if(_0x3e3b68){_0x2eb16b=_0x3e3b68;_0x1d5686[_0x0eb3('0x36')]=_[_0x0eb3('0x38')](db[_0x0eb3('0x69')][_0x0eb3('0x33')]);_0x1d5686[_0x0eb3('0x37')]=_[_0x0eb3('0x38')](_0x40e613['query']);_0x1d5686['filters']=_['intersection'](_0x1d5686['model'],_0x1d5686[_0x0eb3('0x37')]);_0x588fe4[_0x0eb3('0x3c')]=_[_0x0eb3('0x3a')](_0x1d5686[_0x0eb3('0x36')],qs[_0x0eb3('0x4c')](_0x40e613[_0x0eb3('0x37')][_0x0eb3('0x4c')]));_0x588fe4['attributes']=_0x588fe4[_0x0eb3('0x3c')][_0x0eb3('0x3b')]?_0x588fe4[_0x0eb3('0x3c')]:_0x1d5686[_0x0eb3('0x36')];_0x588fe4[_0x0eb3('0x3e')]=qs[_0x0eb3('0x3f')](_0x40e613[_0x0eb3('0x37')][_0x0eb3('0x3f')]);_0x588fe4[_0x0eb3('0x43')]=qs[_0x0eb3('0x39')](_['pick'](_0x40e613['query'],_0x1d5686[_0x0eb3('0x39')]));if(_0x40e613[_0x0eb3('0x37')][_0x0eb3('0x41')]){_0x588fe4[_0x0eb3('0x43')]=_[_0x0eb3('0x42')](_0x588fe4['where'],{'$or':_['map'](_0x588fe4['attributes'],function(_0x3dbcc6){var _0x2c4982={};_0x2c4982[_0x3dbcc6]={'$like':'%'+_0x40e613[_0x0eb3('0x37')]['filter']+'%'};return _0x2c4982;})});}_0x588fe4=_[_0x0eb3('0x42')]({},_0x588fe4,_0x40e613[_0x0eb3('0x45')]);return _0x2eb16b[_0x0eb3('0x68')](_0x588fe4);}})[_0x0eb3('0x29')](function(_0x578771){if(_0x578771){_0x30b4ec=_0x578771['length'];if(!_0x40e613[_0x0eb3('0x37')][_0x0eb3('0x3d')](_0x0eb3('0x5b'))){_0x588fe4[_0x0eb3('0x1f')]=qs[_0x0eb3('0x1f')](_0x40e613[_0x0eb3('0x37')][_0x0eb3('0x1f')]);_0x588fe4[_0x0eb3('0x21')]=qs['offset'](_0x40e613['query'][_0x0eb3('0x21')]);}return _0x2eb16b[_0x0eb3('0x68')](_0x588fe4);}})[_0x0eb3('0x29')](function(_0x11b255){if(_0x11b255){return _0x11b255?{'count':_0x30b4ec,'rows':_0x11b255}:null;}})['then'](respondWithResult(_0x5341a2,null))[_0x0eb3('0x4e')](handleError(_0x5341a2,null));};exports[_0x0eb3('0x6a')]=function(_0x704abb,_0x134423,_0x3d1cac){var _0x4729de=_0x704abb[_0x0eb3('0x50')]['ids'];return db[_0x0eb3('0x69')][_0x0eb3('0x5e')]({'where':{'id':_0x4729de},'attributes':['id'],'include':[{'model':db[_0x0eb3('0x5f')],'as':_0x0eb3('0x6b'),'attributes':['id',_0x0eb3('0x2f'),'online',_0x0eb3('0x6c'),_0x0eb3('0x6d')],'raw':!![]}]})[_0x0eb3('0x29')](function(_0x503ad8){if(_0x503ad8){var _0x5184ec=_[_0x0eb3('0x6e')](_0x503ad8,function(_0x23aa53){var _0x7fcfd8=_0x23aa53[_0x0eb3('0x2b')]({'plain':!![]});return _0x7fcfd8[_0x0eb3('0x6b')];});return db[_0x0eb3('0x4b')][_0x0eb3('0x4d')]({'where':{'id':_0x704abb[_0x0eb3('0x4a')]['id']}})[_0x0eb3('0x29')](function(_0x2e7d9f){return db[_0x0eb3('0x6f')][_0x0eb3('0x70')](function(_0x2085ee){return _0x2e7d9f['addTeams'](_0x4729de,{'transaction':_0x2085ee})[_0x0eb3('0x29')](function(){return BPromise[_0x0eb3('0x71')](_0x5184ec,function(_0x4ce530){return db[_0x0eb3('0x5d')]['findOrCreate']({'where':{'UserId':_0x4ce530['id'],'WhatsappQueueId':_0x704abb[_0x0eb3('0x4a')]['id']},'transaction':_0x2085ee});});})[_0x0eb3('0x29')](function(){_0x5184ec[_0x0eb3('0x72')](function(_0x15a26b){socket['emit'](_0x0eb3('0x73'),{'UserId':_0x15a26b['id'],'WhatsappQueueId':_0x2e7d9f['id']});});});});});}})[_0x0eb3('0x29')](respondWithStatusCode(_0x134423,null))['catch'](handleError(_0x134423,null));};exports[_0x0eb3('0x74')]=function(_0x1a0285,_0x11d720,_0x426b97){return db[_0x0eb3('0x69')][_0x0eb3('0x5e')]({'where':{'id':_0x1a0285[_0x0eb3('0x37')][_0x0eb3('0x75')]},'attributes':['id'],'include':[{'model':db[_0x0eb3('0x5f')],'as':_0x0eb3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x0eb3('0x29')](handleEntityNotFound(_0x11d720,null))['then'](function(_0x5ae1be){var _0x514bab=_['map'](_0x5ae1be,'id');var _0x4994e7=[];var _0x3c5e27=[];var _0x524f76=squel[_0x0eb3('0x76')]();_0x524f76[_0x0eb3('0x77')]('tq.TeamId')[_0x0eb3('0x78')](_0x0eb3('0x79'),'tq')['join'](_0x0eb3('0x7a'),'ut',_0x0eb3('0x7b'))[_0x0eb3('0x43')](_0x0eb3('0x7c'),_0x1a0285[_0x0eb3('0x4a')]['id']);for(var _0x294e53=0x0;_0x294e53<_0x5ae1be[_0x0eb3('0x3b')];_0x294e53+=0x1){let _0x582223=_0x5ae1be[_0x294e53];for(var _0x50192c=0x0;_0x50192c<_0x582223[_0x0eb3('0x6b')][_0x0eb3('0x3b')];_0x50192c+=0x1){let _0x37ff38=_0x582223[_0x0eb3('0x6b')][_0x50192c];var _0x10cb27=_0x524f76[_0x0eb3('0x7d')]();_0x10cb27['where'](_0x0eb3('0x7e'),_0x37ff38['id']);_0x3c5e27[_0x0eb3('0x7f')](db[_0x0eb3('0x6f')]['query'](_0x10cb27['toString'](),{'type':db[_0x0eb3('0x6f')][_0x0eb3('0x80')][_0x0eb3('0x81')]})[_0x0eb3('0x29')](function(_0x305365){if(_0x305365[_0x0eb3('0x3b')]===0x1){return _0x37ff38['id'];}else{var _0x362c4b=_['every'](_['map'](_0x305365,_0x0eb3('0x82')),function(_0x591f20){return _[_0x0eb3('0x83')](_0x514bab,_0x591f20);});if(_0x362c4b){return _0x37ff38['id'];}}}));}}return BPromise[_0x0eb3('0x84')](_0x3c5e27)[_0x0eb3('0x29')](function(_0x1c52ce){_0x4994e7=_(_0x4994e7)['union'](_0x1c52ce)[_0x0eb3('0x85')]()['value']();return db[_0x0eb3('0x4b')][_0x0eb3('0x4d')]({'where':{'id':_0x1a0285[_0x0eb3('0x4a')]['id']}})[_0x0eb3('0x29')](function(_0x2fe4b7){return db[_0x0eb3('0x6f')]['transaction'](function(_0x2b63d4){return _0x2fe4b7['removeTeams'](_0x1a0285[_0x0eb3('0x37')][_0x0eb3('0x75')],{'transaction':_0x2b63d4})[_0x0eb3('0x29')](function(){if(!_[_0x0eb3('0x86')](_0x4994e7)){return _0x2fe4b7['removeAgents'](_0x4994e7,{'transaction':_0x2b63d4});}})[_0x0eb3('0x29')](function(){_0x4994e7[_0x0eb3('0x72')](function(_0x330ff4){socket[_0x0eb3('0x87')]('userWhatsappQueue:remove',{'UserId':_0x330ff4,'WhatsappQueueId':_0x2fe4b7['id']});});});});});});})['then'](respondWithStatusCode(_0x11d720,null))['catch'](handleError(_0x11d720,null));};exports[_0x0eb3('0x88')]=function(_0x24771f,_0x5387a0,_0x46eacc){return db['WhatsappQueue']['find']({'where':{'id':_0x24771f[_0x0eb3('0x4a')]['id']}})[_0x0eb3('0x29')](handleEntityNotFound(_0x5387a0,null))[_0x0eb3('0x29')](function(_0x4ee962){if(_0x4ee962){return _0x4ee962[_0x0eb3('0x88')](_0x24771f[_0x0eb3('0x50')][_0x0eb3('0x75')],_[_0x0eb3('0x89')](_0x24771f[_0x0eb3('0x50')],[_0x0eb3('0x75'),'id'])||{})['spread'](function(_0x40f7a9){for(var _0x11e306=0x0;_0x11e306<_0x24771f['body']['ids']['length'];_0x11e306+=0x1){socket['emit'](_0x0eb3('0x73'),{'UserId':Number(_0x24771f['body'][_0x0eb3('0x75')][_0x11e306]),'WhatsappQueueId':Number(_0x24771f['params']['id'])});}return _0x40f7a9;});}})['then'](respondWithResult(_0x5387a0,null))[_0x0eb3('0x4e')](handleError(_0x5387a0,null));};exports[_0x0eb3('0x8a')]=function(_0x5cf26b,_0x55c973,_0x568a6c){return db['WhatsappQueue'][_0x0eb3('0x4d')]({'where':{'id':_0x5cf26b['params']['id']}})[_0x0eb3('0x29')](handleEntityNotFound(_0x55c973,null))[_0x0eb3('0x29')](function(_0x55c53a){if(_0x55c53a){return _0x55c53a['removeAgents'](_0x5cf26b[_0x0eb3('0x37')][_0x0eb3('0x75')])['then'](function(){if(_[_0x0eb3('0x8b')](_0x5cf26b['query'][_0x0eb3('0x75')])){for(var _0x30fd4a=0x0;_0x30fd4a<_0x5cf26b[_0x0eb3('0x37')][_0x0eb3('0x75')]['length'];_0x30fd4a+=0x1){socket[_0x0eb3('0x87')](_0x0eb3('0x8c'),{'UserId':Number(_0x5cf26b[_0x0eb3('0x37')]['ids'][_0x30fd4a]),'WhatsappQueueId':Number(_0x5cf26b[_0x0eb3('0x4a')]['id'])});}}else{socket['emit'](_0x0eb3('0x8c'),{'UserId':Number(_0x5cf26b[_0x0eb3('0x37')][_0x0eb3('0x75')]),'WhatsappQueueId':Number(_0x5cf26b[_0x0eb3('0x4a')]['id'])});}});}})[_0x0eb3('0x29')](respondWithStatusCode(_0x55c973,null))[_0x0eb3('0x4e')](handleError(_0x55c973,null));};exports[_0x0eb3('0x8d')]=function(_0x1dd7e1,_0x5c26c4,_0x37dec4){var _0x823632={};var _0x27f6cc={};var _0x31dd4d;var _0x4e421d;return db[_0x0eb3('0x4b')]['findOne']({'where':{'id':_0x1dd7e1[_0x0eb3('0x4a')]['id']}})[_0x0eb3('0x29')](handleEntityNotFound(_0x5c26c4,null))[_0x0eb3('0x29')](function(_0x47d636){if(_0x47d636){_0x31dd4d=_0x47d636;_0x27f6cc['model']=_['keys'](db[_0x0eb3('0x5f')][_0x0eb3('0x33')]);_0x27f6cc['query']=_[_0x0eb3('0x38')](_0x1dd7e1[_0x0eb3('0x37')]);_0x27f6cc['filters']=_['intersection'](_0x27f6cc[_0x0eb3('0x36')],_0x27f6cc['query']);_0x823632[_0x0eb3('0x3c')]=_['intersection'](_0x27f6cc[_0x0eb3('0x36')],qs[_0x0eb3('0x4c')](_0x1dd7e1[_0x0eb3('0x37')][_0x0eb3('0x4c')]));_0x823632[_0x0eb3('0x3c')]=_0x823632[_0x0eb3('0x3c')][_0x0eb3('0x3b')]?_0x823632[_0x0eb3('0x3c')]:_0x27f6cc[_0x0eb3('0x36')];_0x823632[_0x0eb3('0x3e')]=qs[_0x0eb3('0x3f')](_0x1dd7e1[_0x0eb3('0x37')][_0x0eb3('0x3f')]);_0x823632['where']=qs['filters'](_[_0x0eb3('0x40')](_0x1dd7e1[_0x0eb3('0x37')],_0x27f6cc[_0x0eb3('0x39')]));if(_0x1dd7e1[_0x0eb3('0x37')][_0x0eb3('0x41')]){_0x823632['where']=_['merge'](_0x823632['where'],{'$or':_[_0x0eb3('0x32')](_0x823632[_0x0eb3('0x3c')],function(_0x3a79b9){var _0x2a049e={};_0x2a049e[_0x3a79b9]={'$like':'%'+_0x1dd7e1[_0x0eb3('0x37')][_0x0eb3('0x41')]+'%'};return _0x2a049e;})});}_0x823632=_['merge']({},_0x823632,_0x1dd7e1[_0x0eb3('0x45')]);return _0x31dd4d[_0x0eb3('0x8d')](_0x823632);}})['then'](function(_0xee4c54){if(_0xee4c54){_0x4e421d=_0xee4c54[_0x0eb3('0x3b')];if(!_0x1dd7e1[_0x0eb3('0x37')][_0x0eb3('0x3d')](_0x0eb3('0x5b'))){_0x823632['limit']=qs['limit'](_0x1dd7e1[_0x0eb3('0x37')][_0x0eb3('0x1f')]);_0x823632[_0x0eb3('0x21')]=qs[_0x0eb3('0x21')](_0x1dd7e1[_0x0eb3('0x37')][_0x0eb3('0x21')]);}return _0x31dd4d['getAgents'](_0x823632);}})[_0x0eb3('0x29')](function(_0x3b14bc){if(_0x3b14bc){return _0x3b14bc?{'count':_0x4e421d,'rows':_0x3b14bc}:null;}})[_0x0eb3('0x29')](respondWithResult(_0x5c26c4,null))[_0x0eb3('0x4e')](handleError(_0x5c26c4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b7015cb..ffb4806 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 _0xef3a=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef3a,0xc7));var _0xaef3=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0xef3a[_0x333fed];return _0x12cac2;};'use strict';var EventEmitter=require(_0xaef3('0x0'));var WhatsappQueue=require(_0xaef3('0x1'))['db'][_0xaef3('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xaef3('0x3')](0x0);var events={'afterCreate':_0xaef3('0x4'),'afterUpdate':_0xaef3('0x5'),'afterDestroy':_0xaef3('0x6')};function emitEvent(_0xf22ef3){return function(_0x580024,_0x13e0cd,_0x8f57d4){WhatsappQueueEvents[_0xaef3('0x7')](_0xf22ef3+':'+_0x580024['id'],_0x580024);WhatsappQueueEvents[_0xaef3('0x7')](_0xf22ef3,_0x580024);_0x8f57d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xaef3('0x8')](e,emitEvent(event));}}module[_0xaef3('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x74b1=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','update'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x74b1,0x1db));var _0x174b=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x74b1[_0x277107];return _0x1da046;};'use strict';var EventEmitter=require(_0x174b('0x0'));var WhatsappQueue=require(_0x174b('0x1'))['db'][_0x174b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x174b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x174b('0x4'),'afterDestroy':_0x174b('0x5')};function emitEvent(_0x1d9cdf){return function(_0x3fc3d2,_0x49ae71,_0x515fc2){WhatsappQueueEvents[_0x174b('0x6')](_0x1d9cdf+':'+_0x3fc3d2['id'],_0x3fc3d2);WhatsappQueueEvents[_0x174b('0x6')](_0x1d9cdf,_0x3fc3d2);_0x515fc2(null);};}for(var e in events){if(events[_0x174b('0x7')](e)){var event=events[e];WhatsappQueue[_0x174b('0x8')](e,emitEvent(event));}}module[_0x174b('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 347054c..213a90b 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 _0xd652=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0xd652,0xa7));var _0x2d65=function(_0x4324aa,_0x53b88a){_0x4324aa=_0x4324aa-0x0;var _0x4b7270=_0xd652[_0x4324aa];return _0x4b7270;};'use strict';var _=require(_0x2d65('0x0'));var util=require(_0x2d65('0x1'));var logger=require(_0x2d65('0x2'))(_0x2d65('0x3'));var moment=require(_0x2d65('0x4'));var BPromise=require(_0x2d65('0x5'));var rp=require(_0x2d65('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d65('0x7'));var config=require(_0x2d65('0x8'));var attributes=require(_0x2d65('0x9'));module[_0x2d65('0xa')]=function(_0x3d9bfd,_0x3d9839){return _0x3d9bfd[_0x2d65('0xb')]('WhatsappQueue',attributes,{'tableName':_0x2d65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5479=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x12825a,_0x573dd4){var _0x7e62ec=function(_0x335cfa){while(--_0x335cfa){_0x12825a['push'](_0x12825a['shift']());}};_0x7e62ec(++_0x573dd4);}(_0x5479,0x14c));var _0x9547=function(_0x4ac5d4,_0x35dbae){_0x4ac5d4=_0x4ac5d4-0x0;var _0x21bc8c=_0x5479[_0x4ac5d4];return _0x21bc8c;};'use strict';var _=require(_0x9547('0x0'));var util=require(_0x9547('0x1'));var logger=require(_0x9547('0x2'))(_0x9547('0x3'));var moment=require(_0x9547('0x4'));var BPromise=require(_0x9547('0x5'));var rp=require(_0x9547('0x6'));var fs=require('fs');var path=require(_0x9547('0x7'));var rimraf=require(_0x9547('0x8'));var config=require(_0x9547('0x9'));var attributes=require(_0x9547('0xa'));module[_0x9547('0xb')]=function(_0x20bc8a,_0x4e31d6){return _0x20bc8a[_0x9547('0xc')](_0x9547('0xd'),attributes,{'tableName':_0x9547('0xe'),'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 c5efca3..01e0c8d 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 _0x08a4=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./whatsappQueue.socket','register','request','then','info'];(function(_0x1b94db,_0x8ec48a){var _0x17da2b=function(_0x338f8b){while(--_0x338f8b){_0x1b94db['push'](_0x1b94db['shift']());}};_0x17da2b(++_0x8ec48a);}(_0x08a4,0xff));var _0x408a=function(_0x5dc12b,_0x3aab8e){_0x5dc12b=_0x5dc12b-0x0;var _0x16a7db=_0x08a4[_0x5dc12b];return _0x16a7db;};'use strict';var _=require(_0x408a('0x0'));var util=require(_0x408a('0x1'));var moment=require(_0x408a('0x2'));var BPromise=require('bluebird');var rs=require(_0x408a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x408a('0x4'))['db'];var utils=require(_0x408a('0x5'));var logger=require(_0x408a('0x6'))(_0x408a('0x7'));var config=require('../../config/environment');var jayson=require(_0x408a('0x8'));var client=jayson[_0x408a('0x9')][_0x408a('0xa')]({'port':0x232a});config['redis']=_[_0x408a('0xb')](config[_0x408a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x408a('0xd'))[_0x408a('0xe')](socket);function respondWithRpcPromise(_0x3d3f5f,_0x3185d7,_0x24b9d4){return new BPromise(function(_0xc5cc67,_0x5151c3){return client[_0x408a('0xf')](_0x3d3f5f,_0x24b9d4)[_0x408a('0x10')](function(_0x1246ee){logger[_0x408a('0x11')](_0x408a('0x12'),_0x3185d7,_0x408a('0x13'));logger[_0x408a('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3185d7,_0x408a('0x13'),JSON[_0x408a('0x15')](_0x1246ee));if(_0x1246ee['error']){if(_0x1246ee[_0x408a('0x16')][_0x408a('0x17')]===0x1f4){logger[_0x408a('0x16')](_0x408a('0x12'),_0x3185d7,_0x1246ee[_0x408a('0x16')][_0x408a('0x18')]);return _0x5151c3(_0x1246ee[_0x408a('0x16')]['message']);}logger['error'](_0x408a('0x12'),_0x3185d7,_0x1246ee['error'][_0x408a('0x18')]);return _0xc5cc67(_0x1246ee[_0x408a('0x16')][_0x408a('0x18')]);}else{logger[_0x408a('0x11')](_0x408a('0x12'),_0x3185d7,'request\x20sent');_0xc5cc67(_0x1246ee[_0x408a('0x19')][_0x408a('0x18')]);}})[_0x408a('0x1a')](function(_0x9690a2){logger[_0x408a('0x16')](_0x408a('0x12'),_0x3185d7,_0x9690a2);_0x5151c3(_0x9690a2);});});}exports[_0x408a('0x1b')]=function(_0x40e24d){var _0x425638=this;return new Promise(function(_0x3c50f6,_0x4f86ab){return db[_0x408a('0x1c')][_0x408a('0x1d')]({'raw':_0x40e24d[_0x408a('0x1e')]?_0x40e24d[_0x408a('0x1e')][_0x408a('0x1f')]===undefined?!![]:![]:!![],'where':_0x40e24d[_0x408a('0x1e')]?_0x40e24d[_0x408a('0x1e')][_0x408a('0x20')]||null:null,'attributes':_0x40e24d['options']?_0x40e24d[_0x408a('0x1e')][_0x408a('0x21')]||null:null,'limit':_0x40e24d[_0x408a('0x1e')]?_0x40e24d[_0x408a('0x1e')][_0x408a('0x22')]||null:null,'include':_0x40e24d[_0x408a('0x1e')]?_0x40e24d[_0x408a('0x1e')][_0x408a('0x23')]?_[_0x408a('0x24')](_0x40e24d['options']['include'],function(_0x510690){return{'model':db[_0x510690['model']],'as':_0x510690['as'],'attributes':_0x510690['attributes'],'include':_0x510690[_0x408a('0x23')]?_[_0x408a('0x24')](_0x510690[_0x408a('0x23')],function(_0x2d9be4){return{'model':db[_0x2d9be4[_0x408a('0x25')]],'as':_0x2d9be4['as'],'attributes':_0x2d9be4[_0x408a('0x21')],'include':_0x2d9be4[_0x408a('0x23')]?_[_0x408a('0x24')](_0x2d9be4[_0x408a('0x23')],function(_0x1fcc0d){return{'model':db[_0x1fcc0d[_0x408a('0x25')]],'as':_0x1fcc0d['as'],'attributes':_0x1fcc0d['attributes']};}):[]};}):[]};}):[]:[]})[_0x408a('0x10')](function(_0xa4d84a){logger[_0x408a('0x11')](_0x408a('0x1b'),_0x40e24d);logger[_0x408a('0x14')]('GetWhatsappQueue',_0x40e24d,JSON[_0x408a('0x15')](_0xa4d84a));_0x3c50f6(_0xa4d84a);})[_0x408a('0x1a')](function(_0x3c303f){logger['error'](_0x408a('0x1b'),_0x3c303f['message'],_0x40e24d);_0x4f86ab(_0x425638[_0x408a('0x16')](0x1f4,_0x3c303f[_0x408a('0x18')]));});});};exports[_0x408a('0x26')]=function(_0x279abc){var _0x17e89f=this;return new Promise(function(_0x49687b,_0x3f4cf8){return db['WhatsappQueue']['find']({'raw':_0x279abc[_0x408a('0x1e')]?_0x279abc['options'][_0x408a('0x1f')]===undefined?!![]:![]:!![],'where':_0x279abc[_0x408a('0x1e')]?_0x279abc['options'][_0x408a('0x20')]||null:null,'attributes':_0x279abc['options']?_0x279abc['options'][_0x408a('0x21')]||null:null,'include':_0x279abc['options']?_0x279abc[_0x408a('0x1e')][_0x408a('0x23')]?_[_0x408a('0x24')](_0x279abc[_0x408a('0x1e')][_0x408a('0x23')],function(_0xa7b65c){return{'model':db[_0xa7b65c[_0x408a('0x25')]],'as':_0xa7b65c['as'],'attributes':_0xa7b65c[_0x408a('0x21')],'include':_0xa7b65c[_0x408a('0x23')]?_[_0x408a('0x24')](_0xa7b65c['include'],function(_0x2424f6){return{'model':db[_0x2424f6['model']],'as':_0x2424f6['as'],'attributes':_0x2424f6['attributes'],'include':_0x2424f6[_0x408a('0x23')]?_[_0x408a('0x24')](_0x2424f6[_0x408a('0x23')],function(_0xfb890b){return{'model':db[_0xfb890b[_0x408a('0x25')]],'as':_0xfb890b['as'],'attributes':_0xfb890b[_0x408a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56606f){logger[_0x408a('0x11')](_0x408a('0x26'),_0x279abc);logger[_0x408a('0x14')](_0x408a('0x26'),_0x279abc,JSON[_0x408a('0x15')](_0x56606f));_0x49687b(_0x56606f);})['catch'](function(_0x20697d){logger['error'](_0x408a('0x26'),_0x20697d[_0x408a('0x18')],_0x279abc);_0x3f4cf8(_0x17e89f['error'](0x1f4,_0x20697d['message']));});});}; \ No newline at end of file +var _0x0fad=['then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','stringify','ShowWhatsappQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappQueue.socket','register','request'];(function(_0x5438b6,_0x446306){var _0x4680fa=function(_0x52b998){while(--_0x52b998){_0x5438b6['push'](_0x5438b6['shift']());}};_0x4680fa(++_0x446306);}(_0x0fad,0x65));var _0xd0fa=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x0fad[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0xd0fa('0x0'));var util=require('util');var moment=require(_0xd0fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0fa('0x2'));var fs=require('fs');var Redis=require(_0xd0fa('0x3'));var db=require(_0xd0fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0fa('0x5'))(_0xd0fa('0x6'));var config=require(_0xd0fa('0x7'));var jayson=require(_0xd0fa('0x8'));var client=jayson['client'][_0xd0fa('0x9')]({'port':0x232a});config['redis']=_[_0xd0fa('0xa')](config[_0xd0fa('0xb')],{'host':_0xd0fa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0fa('0xb')]));require(_0xd0fa('0xd'))[_0xd0fa('0xe')](socket);function respondWithRpcPromise(_0x2df02e,_0x216dba,_0x34fcae){return new BPromise(function(_0x328dea,_0x4a644a){return client[_0xd0fa('0xf')](_0x2df02e,_0x34fcae)[_0xd0fa('0x10')](function(_0x4ca1cf){logger[_0xd0fa('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x216dba,_0xd0fa('0x12'));logger[_0xd0fa('0x13')](_0xd0fa('0x14'),_0x216dba,'request\x20sent',JSON['stringify'](_0x4ca1cf));if(_0x4ca1cf[_0xd0fa('0x15')]){if(_0x4ca1cf['error']['code']===0x1f4){logger[_0xd0fa('0x15')](_0xd0fa('0x16'),_0x216dba,_0x4ca1cf[_0xd0fa('0x15')]['message']);return _0x4a644a(_0x4ca1cf['error']['message']);}logger['error'](_0xd0fa('0x16'),_0x216dba,_0x4ca1cf[_0xd0fa('0x15')][_0xd0fa('0x17')]);return _0x328dea(_0x4ca1cf[_0xd0fa('0x15')][_0xd0fa('0x17')]);}else{logger[_0xd0fa('0x11')](_0xd0fa('0x16'),_0x216dba,'request\x20sent');_0x328dea(_0x4ca1cf[_0xd0fa('0x18')][_0xd0fa('0x17')]);}})[_0xd0fa('0x19')](function(_0x538856){logger[_0xd0fa('0x15')](_0xd0fa('0x16'),_0x216dba,_0x538856);_0x4a644a(_0x538856);});});}exports[_0xd0fa('0x1a')]=function(_0x1defd0){var _0x5cf4cf=this;return new Promise(function(_0x570e66,_0x34be9c){return db[_0xd0fa('0x1b')][_0xd0fa('0x1c')]({'raw':_0x1defd0[_0xd0fa('0x1d')]?_0x1defd0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1defd0[_0xd0fa('0x1d')]?_0x1defd0['options'][_0xd0fa('0x1e')]||null:null,'attributes':_0x1defd0['options']?_0x1defd0[_0xd0fa('0x1d')][_0xd0fa('0x1f')]||null:null,'limit':_0x1defd0[_0xd0fa('0x1d')]?_0x1defd0['options'][_0xd0fa('0x20')]||null:null,'include':_0x1defd0[_0xd0fa('0x1d')]?_0x1defd0[_0xd0fa('0x1d')][_0xd0fa('0x21')]?_[_0xd0fa('0x22')](_0x1defd0[_0xd0fa('0x1d')]['include'],function(_0x37818e){return{'model':db[_0x37818e[_0xd0fa('0x23')]],'as':_0x37818e['as'],'attributes':_0x37818e[_0xd0fa('0x1f')],'include':_0x37818e[_0xd0fa('0x21')]?_['map'](_0x37818e[_0xd0fa('0x21')],function(_0x50f2fb){return{'model':db[_0x50f2fb[_0xd0fa('0x23')]],'as':_0x50f2fb['as'],'attributes':_0x50f2fb[_0xd0fa('0x1f')],'include':_0x50f2fb['include']?_[_0xd0fa('0x22')](_0x50f2fb[_0xd0fa('0x21')],function(_0xb45333){return{'model':db[_0xb45333['model']],'as':_0xb45333['as'],'attributes':_0xb45333[_0xd0fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd0fa('0x10')](function(_0x188b6f){logger['info'](_0xd0fa('0x1a'),_0x1defd0);logger[_0xd0fa('0x13')](_0xd0fa('0x1a'),_0x1defd0,JSON[_0xd0fa('0x24')](_0x188b6f));_0x570e66(_0x188b6f);})[_0xd0fa('0x19')](function(_0x36a558){logger[_0xd0fa('0x15')](_0xd0fa('0x1a'),_0x36a558[_0xd0fa('0x17')],_0x1defd0);_0x34be9c(_0x5cf4cf['error'](0x1f4,_0x36a558[_0xd0fa('0x17')]));});});};exports[_0xd0fa('0x25')]=function(_0x40b427){var _0x1ed571=this;return new Promise(function(_0x550780,_0x1cfa53){return db['WhatsappQueue'][_0xd0fa('0x26')]({'raw':_0x40b427[_0xd0fa('0x1d')]?_0x40b427[_0xd0fa('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x40b427[_0xd0fa('0x1d')]?_0x40b427[_0xd0fa('0x1d')][_0xd0fa('0x1e')]||null:null,'attributes':_0x40b427[_0xd0fa('0x1d')]?_0x40b427[_0xd0fa('0x1d')][_0xd0fa('0x1f')]||null:null,'include':_0x40b427[_0xd0fa('0x1d')]?_0x40b427[_0xd0fa('0x1d')][_0xd0fa('0x21')]?_[_0xd0fa('0x22')](_0x40b427['options'][_0xd0fa('0x21')],function(_0x4e9019){return{'model':db[_0x4e9019[_0xd0fa('0x23')]],'as':_0x4e9019['as'],'attributes':_0x4e9019[_0xd0fa('0x1f')],'include':_0x4e9019[_0xd0fa('0x21')]?_[_0xd0fa('0x22')](_0x4e9019['include'],function(_0x180cb4){return{'model':db[_0x180cb4['model']],'as':_0x180cb4['as'],'attributes':_0x180cb4[_0xd0fa('0x1f')],'include':_0x180cb4[_0xd0fa('0x21')]?_[_0xd0fa('0x22')](_0x180cb4[_0xd0fa('0x21')],function(_0x31a706){return{'model':db[_0x31a706[_0xd0fa('0x23')]],'as':_0x31a706['as'],'attributes':_0x31a706['attributes']};}):[]};}):[]};}):[]:[]})[_0xd0fa('0x10')](function(_0x4cd6a5){logger[_0xd0fa('0x11')]('ShowWhatsappQueue',_0x40b427);logger[_0xd0fa('0x13')](_0xd0fa('0x25'),_0x40b427,JSON[_0xd0fa('0x24')](_0x4cd6a5));_0x550780(_0x4cd6a5);})[_0xd0fa('0x19')](function(_0xd72e6f){logger[_0xd0fa('0x15')]('ShowWhatsappQueue',_0xd72e6f[_0xd0fa('0x17')],_0x40b427);_0x1cfa53(_0x1ed571['error'](0x1f4,_0xd72e6f[_0xd0fa('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8794caf..74f81a8 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 _0x7f3f=['save','remove','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x5d6aa,_0x21f6f7){var _0x188199=function(_0x303b86){while(--_0x303b86){_0x5d6aa['push'](_0x5d6aa['shift']());}};_0x188199(++_0x21f6f7);}(_0x7f3f,0x127));var _0xf7f3=function(_0x112147,_0x4e692e){_0x112147=_0x112147-0x0;var _0x3ba744=_0x7f3f[_0x112147];return _0x3ba744;};'use strict';var WhatsappQueueEvents=require(_0xf7f3('0x0'));var events=[_0xf7f3('0x1'),_0xf7f3('0x2'),'update'];function createListener(_0x31d5ba,_0x26b1b6){return function(_0x511e19){_0x26b1b6[_0xf7f3('0x3')](_0x31d5ba,_0x511e19);};}function removeListener(_0x4d42ec,_0x2940b2){return function(){WhatsappQueueEvents[_0xf7f3('0x4')](_0x4d42ec,_0x2940b2);};}exports[_0xf7f3('0x5')]=function(_0x4a851a){for(var _0x1d7804=0x0,_0x477f3a=events[_0xf7f3('0x6')];_0x1d7804<_0x477f3a;_0x1d7804++){var _0x216934=events[_0x1d7804];var _0x354fa9=createListener(_0xf7f3('0x7')+_0x216934,_0x4a851a);WhatsappQueueEvents['on'](_0x216934,_0x354fa9);}}; \ No newline at end of file +var _0x4fc7=['emit','whatsappQueue:','./whatsappQueue.events'];(function(_0x8c8dcf,_0xeccd30){var _0x3a1595=function(_0x58e599){while(--_0x58e599){_0x8c8dcf['push'](_0x8c8dcf['shift']());}};_0x3a1595(++_0xeccd30);}(_0x4fc7,0xe0));var _0x74fc=function(_0x23cce8,_0x117f91){_0x23cce8=_0x23cce8-0x0;var _0x37799b=_0x4fc7[_0x23cce8];return _0x37799b;};'use strict';var WhatsappQueueEvents=require(_0x74fc('0x0'));var events=['save','remove','update'];function createListener(_0x260ffb,_0x4fb122){return function(_0x43e010){_0x4fb122[_0x74fc('0x1')](_0x260ffb,_0x43e010);};}function removeListener(_0x949dd4,_0x538dfe){return function(){WhatsappQueueEvents['removeListener'](_0x949dd4,_0x538dfe);};}exports['register']=function(_0x43c403){for(var _0xac23ad=0x0,_0x13ef41=events['length'];_0xac23ad<_0x13ef41;_0xac23ad++){var _0x396d11=events[_0xac23ad];var _0x2e2c16=createListener(_0x74fc('0x2')+_0x396d11,_0x43c403);WhatsappQueueEvents['on'](_0x396d11,_0x2e2c16);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a4125fb..694da23 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 _0x4ea5=['exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete'];(function(_0x2770c3,_0x2a8c28){var _0x458f3d=function(_0x556e24){while(--_0x556e24){_0x2770c3['push'](_0x2770c3['shift']());}};_0x458f3d(++_0x2a8c28);}(_0x4ea5,0x121));var _0x54ea=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x4ea5[_0x5f1617];return _0x3af5da;};'use strict';var multer=require('multer');var util=require(_0x54ea('0x0'));var path=require(_0x54ea('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x54ea('0x2')]();var fs_extra=require(_0x54ea('0x3'));var auth=require(_0x54ea('0x4'));var interaction=require(_0x54ea('0x5'));var config=require('../../config/environment');var controller=require(_0x54ea('0x6'));router[_0x54ea('0x7')]('/',auth[_0x54ea('0x8')](),controller[_0x54ea('0x9')]);router[_0x54ea('0x7')](_0x54ea('0xa'),auth[_0x54ea('0x8')](),controller[_0x54ea('0xb')]);router['get'](_0x54ea('0xc'),auth[_0x54ea('0x8')](),controller[_0x54ea('0xd')]);router['post']('/',auth[_0x54ea('0x8')](),controller[_0x54ea('0xe')]);router[_0x54ea('0xf')](_0x54ea('0xc'),auth[_0x54ea('0x8')](),controller['update']);router[_0x54ea('0x10')](_0x54ea('0xc'),auth[_0x54ea('0x8')](),controller['destroy']);module[_0x54ea('0x11')]=router; \ No newline at end of file +var _0x7062=['isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x5ce77f,_0x18b6f1){var _0x3316bf=function(_0x5b9d81){while(--_0x5b9d81){_0x5ce77f['push'](_0x5ce77f['shift']());}};_0x3316bf(++_0x18b6f1);}(_0x7062,0x1a8));var _0x2706=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7062[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x2706('0x0'));var util=require('util');var path=require(_0x2706('0x1'));var timeout=require(_0x2706('0x2'));var express=require(_0x2706('0x3'));var router=express[_0x2706('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2706('0x5'));var controller=require(_0x2706('0x6'));router[_0x2706('0x7')]('/',auth[_0x2706('0x8')](),controller[_0x2706('0x9')]);router['get']('/describe',auth[_0x2706('0x8')](),controller[_0x2706('0xa')]);router[_0x2706('0x7')](_0x2706('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2706('0xc')]('/',auth[_0x2706('0x8')](),controller['create']);router[_0x2706('0xd')](_0x2706('0xb'),auth[_0x2706('0x8')](),controller[_0x2706('0xe')]);router[_0x2706('0xf')](_0x2706('0xb'),auth[_0x2706('0x8')](),controller[_0x2706('0x10')]);module[_0x2706('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c1b8209..a107054 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x417cad,_0x976fbe){var _0x2a97e8=function(_0x2705de){while(--_0x2705de){_0x417cad['push'](_0x417cad['shift']());}};_0x2a97e8(++_0x976fbe);}(_0x7a54,0x106));var _0x47a5=function(_0x5d9603,_0x26817c){_0x5d9603=_0x5d9603-0x0;var _0x200692=_0x7a54[_0x5d9603];return _0x200692;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3a9994,_0x3dce2f){var _0x16342a=function(_0x1227df){while(--_0x1227df){_0x3a9994['push'](_0x3a9994['shift']());}};_0x16342a(++_0x3dce2f);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 5d84eaf..5ea3d67 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 _0xe1e3=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','offset','limit','count','status','set','Content-Range','apply','reject','destroy','then','end','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueueReport','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','util'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x581b81,_0x2e100d){_0x581b81=_0x581b81-0x0;var _0x3ad8f0=_0xe1e3[_0x581b81];return _0x3ad8f0;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e47b9,_0x536129){_0x536129=_0x536129||0xcc;return function(_0x5c09a2){if(_0x5c09a2){return _0x4e47b9[_0x3e1e('0x14')](_0x536129);}return _0x4e47b9['status'](_0x536129)['end']();};}function respondWithResult(_0x3a9375,_0x8bd4cd){_0x8bd4cd=_0x8bd4cd||0xc8;return function(_0x78ee54){if(_0x78ee54){return _0x3a9375['status'](_0x8bd4cd)['json'](_0x78ee54);}};}function respondWithFilteredResult(_0x4131a1,_0x1b62e6){return function(_0x4dca60){if(_0x4dca60){var _0x26cb35=typeof _0x1b62e6[_0x3e1e('0x15')]==='undefined'&&typeof _0x1b62e6[_0x3e1e('0x16')]==='undefined';var _0x23228c=_0x4dca60[_0x3e1e('0x17')];var _0x1d786c=_0x26cb35?0x0:_0x1b62e6[_0x3e1e('0x15')];var _0x791ed8=_0x26cb35?_0x4dca60[_0x3e1e('0x17')]:_0x1b62e6['offset']+_0x1b62e6['limit'];var _0x4a9497;if(_0x791ed8>=_0x23228c){_0x791ed8=_0x23228c;_0x4a9497=0xc8;}else{_0x4a9497=0xce;}_0x4131a1[_0x3e1e('0x18')](_0x4a9497);return _0x4131a1[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x1d786c+'-'+_0x791ed8+'/'+_0x23228c)['json'](_0x4dca60);}return null;};}function patchUpdates(_0x1c5acd){return function(_0x530815){try{jsonpatch[_0x3e1e('0x1b')](_0x530815,_0x1c5acd,!![]);}catch(_0x33ec1d){return BPromise[_0x3e1e('0x1c')](_0x33ec1d);}return _0x530815['save']();};}function saveUpdates(_0x53e051,_0x96396){return function(_0xefa098){if(_0xefa098){return _0xefa098['update'](_0x53e051)['then'](function(_0x13d7ac){return _0x13d7ac;});}return null;};}function removeEntity(_0x1b5097,_0x488f9f){return function(_0x60e6bc){if(_0x60e6bc){return _0x60e6bc[_0x3e1e('0x1d')]()[_0x3e1e('0x1e')](function(){_0x1b5097[_0x3e1e('0x18')](0xcc)[_0x3e1e('0x1f')]();});}};}function handleEntityNotFound(_0x159212,_0x43d583){return function(_0x21c898){if(!_0x21c898){_0x159212['sendStatus'](0x194);}return _0x21c898;};}function handleError(_0x5d908e,_0x44e419){_0x44e419=_0x44e419||0x1f4;return function(_0x541ef1){logger['error'](_0x541ef1['stack']);if(_0x541ef1['name']){delete _0x541ef1[_0x3e1e('0x20')];}_0x5d908e[_0x3e1e('0x18')](_0x44e419)['send'](_0x541ef1);};}exports[_0x3e1e('0x21')]=function(_0x5ac814,_0xdfcd93){var _0x176bb4={},_0x53a6ff={},_0x43e029={'count':0x0,'rows':[]};var _0x210a84=_[_0x3e1e('0x22')](db['WhatsappQueueReport'][_0x3e1e('0x23')],function(_0x4ec149){return{'name':_0x4ec149['fieldName'],'type':_0x4ec149['type'][_0x3e1e('0x24')]};});_0x53a6ff['model']=_['map'](_0x210a84,_0x3e1e('0x20'));_0x53a6ff[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x5ac814[_0x3e1e('0x25')]);_0x53a6ff[_0x3e1e('0x27')]=_['intersection'](_0x53a6ff['model'],_0x53a6ff['query']);_0x176bb4['attributes']=_[_0x3e1e('0x28')](_0x53a6ff[_0x3e1e('0x29')],qs[_0x3e1e('0x2a')](_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x2a')]));_0x176bb4[_0x3e1e('0x2b')]=_0x176bb4[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x176bb4['attributes']:_0x53a6ff[_0x3e1e('0x29')];if(!_0x5ac814[_0x3e1e('0x25')]['hasOwnProperty'](_0x3e1e('0x2d'))){_0x176bb4[_0x3e1e('0x16')]=qs[_0x3e1e('0x16')](_0x5ac814[_0x3e1e('0x25')]['limit']);_0x176bb4['offset']=qs[_0x3e1e('0x15')](_0x5ac814[_0x3e1e('0x25')]['offset']);}_0x176bb4[_0x3e1e('0x2e')]=qs[_0x3e1e('0x2f')](_0x5ac814['query'][_0x3e1e('0x2f')]);_0x176bb4[_0x3e1e('0x30')]=qs[_0x3e1e('0x27')](_[_0x3e1e('0x31')](_0x5ac814[_0x3e1e('0x25')],_0x53a6ff['filters']),_0x210a84);if(_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x32')]){_0x176bb4[_0x3e1e('0x30')]=_[_0x3e1e('0x33')](_0x176bb4['where'],{'$or':_[_0x3e1e('0x22')](_0x210a84,function(_0xf973c9){if(_0xf973c9[_0x3e1e('0x34')]!==_0x3e1e('0x35')){var _0x2cc5c7={};_0x2cc5c7[_0xf973c9[_0x3e1e('0x20')]]={'$like':'%'+_0x5ac814[_0x3e1e('0x25')]['filter']+'%'};return _0x2cc5c7;}})});}_0x176bb4=_[_0x3e1e('0x33')]({},_0x176bb4,_0x5ac814['options']);var _0x53bdf5={'where':_0x176bb4[_0x3e1e('0x30')]};return db[_0x3e1e('0x36')][_0x3e1e('0x17')](_0x53bdf5)['then'](function(_0x3dbd2a){_0x43e029[_0x3e1e('0x17')]=_0x3dbd2a;if(_0x5ac814['query'][_0x3e1e('0x37')]){_0x176bb4[_0x3e1e('0x38')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x176bb4);})[_0x3e1e('0x1e')](function(_0x49e4cb){_0x43e029['rows']=_0x49e4cb;return _0x43e029;})[_0x3e1e('0x1e')](respondWithFilteredResult(_0xdfcd93,_0x176bb4))[_0x3e1e('0x39')](handleError(_0xdfcd93,null));};exports[_0x3e1e('0x3a')]=function(_0x202748,_0x377a06){var _0x55ea1d={'raw':!![],'where':{'id':_0x202748[_0x3e1e('0x3b')]['id']}},_0x5b32ad={};_0x5b32ad[_0x3e1e('0x29')]=_[_0x3e1e('0x26')](db['WhatsappQueueReport'][_0x3e1e('0x23')]);_0x5b32ad[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x202748['query']);_0x5b32ad[_0x3e1e('0x27')]=_['intersection'](_0x5b32ad['model'],_0x5b32ad[_0x3e1e('0x25')]);_0x55ea1d[_0x3e1e('0x2b')]=_[_0x3e1e('0x28')](_0x5b32ad[_0x3e1e('0x29')],qs['fields'](_0x202748['query']['fields']));_0x55ea1d['attributes']=_0x55ea1d[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x55ea1d['attributes']:_0x5b32ad['model'];if(_0x202748[_0x3e1e('0x25')][_0x3e1e('0x37')]){_0x55ea1d[_0x3e1e('0x38')]=[{'all':!![]}];}_0x55ea1d=_['merge']({},_0x55ea1d,_0x202748[_0x3e1e('0x3c')]);return db['WhatsappQueueReport'][_0x3e1e('0x3d')](_0x55ea1d)[_0x3e1e('0x1e')](handleEntityNotFound(_0x377a06,null))[_0x3e1e('0x1e')](respondWithResult(_0x377a06,null))[_0x3e1e('0x39')](handleError(_0x377a06,null));};exports[_0x3e1e('0x3e')]=function(_0x3de309,_0x53d32b){return db[_0x3e1e('0x36')][_0x3e1e('0x3e')](_0x3de309['body'],{})[_0x3e1e('0x1e')](respondWithResult(_0x53d32b,0xc9))[_0x3e1e('0x39')](handleError(_0x53d32b,null));};exports['update']=function(_0x1cc820,_0x347b3f){if(_0x1cc820[_0x3e1e('0x3f')]['id']){delete _0x1cc820[_0x3e1e('0x3f')]['id'];}return db['WhatsappQueueReport'][_0x3e1e('0x3d')]({'where':{'id':_0x1cc820[_0x3e1e('0x3b')]['id']}})[_0x3e1e('0x1e')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1e')](saveUpdates(_0x1cc820['body'],null))[_0x3e1e('0x1e')](respondWithResult(_0x347b3f,null))[_0x3e1e('0x39')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x1d')]=function(_0x25ddf7,_0xe2516c){return db[_0x3e1e('0x36')][_0x3e1e('0x3d')]({'where':{'id':_0x25ddf7[_0x3e1e('0x3b')]['id']}})['then'](handleEntityNotFound(_0xe2516c,null))[_0x3e1e('0x1e')](removeEntity(_0xe2516c,null))['catch'](handleError(_0xe2516c,null));};exports['describe']=function(_0x4c8583,_0x1c4269){return db[_0x3e1e('0x36')]['describe']()[_0x3e1e('0x1e')](respondWithResult(_0x1c4269,null))['catch'](handleError(_0x1c4269,null));}; \ No newline at end of file +var _0x7af2=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','keys','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0xbddfbf,_0x27b320){var _0x276844=function(_0x196646){while(--_0x196646){_0xbddfbf['push'](_0xbddfbf['shift']());}};_0x276844(++_0x27b320);}(_0x7af2,0x119));var _0x27af=function(_0x4a2c34,_0x31ae64){_0x4a2c34=_0x4a2c34-0x0;var _0x45fa24=_0x7af2[_0x4a2c34];return _0x45fa24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){_0x43dd9e['status'](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x4feaf1,_0x12625c){return function(_0x396326){if(!_0x396326){_0x4feaf1['sendStatus'](0x194);}return _0x396326;};}function handleError(_0x393190,_0x1d9341){_0x1d9341=_0x1d9341||0x1f4;return function(_0x463e36){logger[_0x27af('0x24')](_0x463e36[_0x27af('0x25')]);if(_0x463e36[_0x27af('0x26')]){delete _0x463e36[_0x27af('0x26')];}_0x393190['status'](_0x1d9341)[_0x27af('0x27')](_0x463e36);};}exports[_0x27af('0x28')]=function(_0xadd38e,_0xe009a){var _0x25d65a={},_0xa08dd9={},_0x42a5b7={'count':0x0,'rows':[]};var _0x2b26ac=_[_0x27af('0x29')](db[_0x27af('0x2a')][_0x27af('0x2b')],function(_0x4f4955){return{'name':_0x4f4955[_0x27af('0x2c')],'type':_0x4f4955[_0x27af('0x2d')][_0x27af('0x2e')]};});_0xa08dd9[_0x27af('0x2f')]=_[_0x27af('0x29')](_0x2b26ac,_0x27af('0x26'));_0xa08dd9['query']=_['keys'](_0xadd38e[_0x27af('0x30')]);_0xa08dd9[_0x27af('0x31')]=_['intersection'](_0xa08dd9[_0x27af('0x2f')],_0xa08dd9[_0x27af('0x30')]);_0x25d65a[_0x27af('0x32')]=_[_0x27af('0x33')](_0xa08dd9[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xadd38e[_0x27af('0x30')][_0x27af('0x34')]));_0x25d65a[_0x27af('0x32')]=_0x25d65a[_0x27af('0x32')][_0x27af('0x35')]?_0x25d65a['attributes']:_0xa08dd9['model'];if(!_0xadd38e[_0x27af('0x30')][_0x27af('0x36')]('nolimit')){_0x25d65a[_0x27af('0x1d')]=qs[_0x27af('0x1d')](_0xadd38e['query'][_0x27af('0x1d')]);_0x25d65a[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xadd38e[_0x27af('0x30')][_0x27af('0x1b')]);}_0x25d65a['order']=qs[_0x27af('0x37')](_0xadd38e[_0x27af('0x30')]['sort']);_0x25d65a['where']=qs[_0x27af('0x31')](_[_0x27af('0x38')](_0xadd38e[_0x27af('0x30')],_0xa08dd9[_0x27af('0x31')]),_0x2b26ac);if(_0xadd38e[_0x27af('0x30')][_0x27af('0x39')]){_0x25d65a['where']=_[_0x27af('0x3a')](_0x25d65a['where'],{'$or':_[_0x27af('0x29')](_0x2b26ac,function(_0x38a532){if(_0x38a532[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x1c6a4d={};_0x1c6a4d[_0x38a532['name']]={'$like':'%'+_0xadd38e[_0x27af('0x30')][_0x27af('0x39')]+'%'};return _0x1c6a4d;}})});}_0x25d65a=_[_0x27af('0x3a')]({},_0x25d65a,_0xadd38e[_0x27af('0x3c')]);var _0x10c1be={'where':_0x25d65a[_0x27af('0x3d')]};return db[_0x27af('0x2a')][_0x27af('0x1e')](_0x10c1be)[_0x27af('0x23')](function(_0x18f11b){_0x42a5b7[_0x27af('0x1e')]=_0x18f11b;if(_0xadd38e[_0x27af('0x30')][_0x27af('0x3e')]){_0x25d65a[_0x27af('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x27af('0x40')](_0x25d65a);})[_0x27af('0x23')](function(_0x44534b){_0x42a5b7[_0x27af('0x41')]=_0x44534b;return _0x42a5b7;})['then'](respondWithFilteredResult(_0xe009a,_0x25d65a))[_0x27af('0x42')](handleError(_0xe009a,null));};exports['show']=function(_0x516651,_0x2425dd){var _0x3c9c81={'raw':!![],'where':{'id':_0x516651[_0x27af('0x43')]['id']}},_0x279f99={};_0x279f99[_0x27af('0x2f')]=_[_0x27af('0x44')](db[_0x27af('0x2a')][_0x27af('0x2b')]);_0x279f99[_0x27af('0x30')]=_[_0x27af('0x44')](_0x516651[_0x27af('0x30')]);_0x279f99[_0x27af('0x31')]=_['intersection'](_0x279f99[_0x27af('0x2f')],_0x279f99[_0x27af('0x30')]);_0x3c9c81['attributes']=_['intersection'](_0x279f99[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x516651[_0x27af('0x30')][_0x27af('0x34')]));_0x3c9c81[_0x27af('0x32')]=_0x3c9c81['attributes'][_0x27af('0x35')]?_0x3c9c81['attributes']:_0x279f99[_0x27af('0x2f')];if(_0x516651[_0x27af('0x30')][_0x27af('0x3e')]){_0x3c9c81[_0x27af('0x3f')]=[{'all':!![]}];}_0x3c9c81=_[_0x27af('0x3a')]({},_0x3c9c81,_0x516651[_0x27af('0x3c')]);return db[_0x27af('0x2a')]['find'](_0x3c9c81)['then'](handleEntityNotFound(_0x2425dd,null))[_0x27af('0x23')](respondWithResult(_0x2425dd,null))['catch'](handleError(_0x2425dd,null));};exports[_0x27af('0x45')]=function(_0x1b43e2,_0x226025){return db[_0x27af('0x2a')][_0x27af('0x45')](_0x1b43e2[_0x27af('0x46')],{})[_0x27af('0x23')](respondWithResult(_0x226025,0xc9))['catch'](handleError(_0x226025,null));};exports[_0x27af('0x22')]=function(_0xc7e2a8,_0x20e180){if(_0xc7e2a8[_0x27af('0x46')]['id']){delete _0xc7e2a8[_0x27af('0x46')]['id'];}return db['WhatsappQueueReport'][_0x27af('0x47')]({'where':{'id':_0xc7e2a8[_0x27af('0x43')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x20e180,null))['then'](saveUpdates(_0xc7e2a8['body'],null))[_0x27af('0x23')](respondWithResult(_0x20e180,null))[_0x27af('0x42')](handleError(_0x20e180,null));};exports[_0x27af('0x48')]=function(_0x5be44f,_0x495794){return db[_0x27af('0x2a')]['find']({'where':{'id':_0x5be44f[_0x27af('0x43')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x495794,null))[_0x27af('0x23')](removeEntity(_0x495794,null))[_0x27af('0x42')](handleError(_0x495794,null));};exports[_0x27af('0x49')]=function(_0xb9e23,_0x123533){return db[_0x27af('0x2a')][_0x27af('0x49')]()[_0x27af('0x23')](respondWithResult(_0x123533,null))[_0x27af('0x42')](handleError(_0x123533,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ba7a4d3..d6f7a71 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 _0xbc7e=['moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x43eebe,_0x3f08ed){var _0x302c04=function(_0xc9c186){while(--_0xc9c186){_0x43eebe['push'](_0x43eebe['shift']());}};_0x302c04(++_0x3f08ed);}(_0xbc7e,0x1eb));var _0xebc7=function(_0x190b37,_0x386197){_0x190b37=_0x190b37-0x0;var _0x4e7eb7=_0xbc7e[_0x190b37];return _0x4e7eb7;};'use strict';var _=require(_0xebc7('0x0'));var util=require(_0xebc7('0x1'));var logger=require(_0xebc7('0x2'))(_0xebc7('0x3'));var moment=require(_0xebc7('0x4'));var BPromise=require(_0xebc7('0x5'));var rp=require(_0xebc7('0x6'));var fs=require('fs');var path=require(_0xebc7('0x7'));var rimraf=require(_0xebc7('0x8'));var config=require('../../config/environment');var attributes=require(_0xebc7('0x9'));module[_0xebc7('0xa')]=function(_0x3492e6,_0x3a444d){return _0x3492e6[_0xebc7('0xb')](_0xebc7('0xc'),attributes,{'tableName':_0xebc7('0xd'),'paranoid':![],'indexes':[{'name':_0xebc7('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa186=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','api','request-promise'];(function(_0x38952a,_0x428f8d){var _0x47056b=function(_0xedf449){while(--_0xedf449){_0x38952a['push'](_0x38952a['shift']());}};_0x47056b(++_0x428f8d);}(_0xa186,0x130));var _0x6a18=function(_0x1a82bb,_0x3af7a6){_0x1a82bb=_0x1a82bb-0x0;var _0x1d8060=_0xa186[_0x1a82bb];return _0x1d8060;};'use strict';var _=require(_0x6a18('0x0'));var util=require(_0x6a18('0x1'));var logger=require('../../config/logger')(_0x6a18('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a18('0x3'));var fs=require('fs');var path=require(_0x6a18('0x4'));var rimraf=require('rimraf');var config=require(_0x6a18('0x5'));var attributes=require(_0x6a18('0x6'));module[_0x6a18('0x7')]=function(_0x554be6,_0x91c8d4){return _0x554be6[_0x6a18('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x6a18('0x9'),'paranoid':![],'indexes':[{'name':_0x6a18('0xa'),'fields':[_0x6a18('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index dff89aa..b90a651 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 _0xedb0=['../../config/environment','client','then','info','request\x20sent','debug','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','stringify','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x121336,_0x3370ea){var _0x53ff9f=function(_0x4482fe){while(--_0x4482fe){_0x121336['push'](_0x121336['shift']());}};_0x53ff9f(++_0x3370ea);}(_0xedb0,0x74));var _0x0edb=function(_0x449f84,_0x51d637){_0x449f84=_0x449f84-0x0;var _0x454733=_0xedb0[_0x449f84];return _0x454733;};'use strict';var _=require(_0x0edb('0x0'));var util=require(_0x0edb('0x1'));var moment=require(_0x0edb('0x2'));var BPromise=require(_0x0edb('0x3'));var rs=require(_0x0edb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0edb('0x5'));var logger=require(_0x0edb('0x6'))(_0x0edb('0x7'));var config=require(_0x0edb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0edb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4625cb,_0x3b23c6,_0x336965){return new BPromise(function(_0x359ceb,_0x19dc6a){return client['request'](_0x4625cb,_0x336965)[_0x0edb('0xa')](function(_0x30071b){logger[_0x0edb('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3b23c6,_0x0edb('0xc'));logger[_0x0edb('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3b23c6,'request\x20sent',JSON['stringify'](_0x30071b));if(_0x30071b['error']){if(_0x30071b[_0x0edb('0xe')][_0x0edb('0xf')]===0x1f4){logger[_0x0edb('0xe')](_0x0edb('0x10'),_0x3b23c6,_0x30071b[_0x0edb('0xe')][_0x0edb('0x11')]);return _0x19dc6a(_0x30071b[_0x0edb('0xe')]['message']);}logger[_0x0edb('0xe')](_0x0edb('0x10'),_0x3b23c6,_0x30071b[_0x0edb('0xe')]['message']);return _0x359ceb(_0x30071b['error']['message']);}else{logger['info'](_0x0edb('0x10'),_0x3b23c6,'request\x20sent');_0x359ceb(_0x30071b['result'][_0x0edb('0x11')]);}})[_0x0edb('0x12')](function(_0x4d5570){logger['error'](_0x0edb('0x10'),_0x3b23c6,_0x4d5570);_0x19dc6a(_0x4d5570);});});}exports[_0x0edb('0x13')]=function(_0x1b0c2b){var _0xa7c997=this;return new Promise(function(_0x490bdf,_0x20af5c){return db[_0x0edb('0x14')][_0x0edb('0x15')](_0x1b0c2b[_0x0edb('0x16')],{'raw':_0x1b0c2b[_0x0edb('0x17')]?_0x1b0c2b[_0x0edb('0x17')][_0x0edb('0x18')]===undefined?!![]:![]:!![]})[_0x0edb('0xa')](function(_0x3046f8){logger[_0x0edb('0xb')]('CreateWhatsappQueueReport',_0x1b0c2b);logger[_0x0edb('0xd')](_0x0edb('0x13'),_0x1b0c2b,JSON[_0x0edb('0x19')](_0x3046f8));_0x490bdf(_0x3046f8);})['catch'](function(_0x3e94ef){logger[_0x0edb('0xe')](_0x0edb('0x13'),_0x3e94ef[_0x0edb('0x11')],_0x1b0c2b);_0x20af5c(_0xa7c997[_0x0edb('0xe')](0x1f4,_0x3e94ef[_0x0edb('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x35ba3a){var _0x4813b8=this;return new Promise(function(_0x10f5b5,_0xdb14ae){return db['WhatsappQueueReport'][_0x0edb('0x1a')](_0x35ba3a[_0x0edb('0x16')],{'raw':_0x35ba3a[_0x0edb('0x17')]?_0x35ba3a[_0x0edb('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35ba3a[_0x0edb('0x17')]?_0x35ba3a[_0x0edb('0x17')][_0x0edb('0x1b')]||null:null,'attributes':_0x35ba3a[_0x0edb('0x17')]?_0x35ba3a[_0x0edb('0x17')][_0x0edb('0x1c')]||null:null,'limit':_0x35ba3a[_0x0edb('0x17')]?_0x35ba3a[_0x0edb('0x17')][_0x0edb('0x1d')]||null:null})[_0x0edb('0xa')](function(_0x4fff64){logger[_0x0edb('0xb')](_0x0edb('0x1e'),_0x35ba3a);logger[_0x0edb('0xd')](_0x0edb('0x1e'),_0x35ba3a,JSON[_0x0edb('0x19')](_0x4fff64));_0x10f5b5(_0x4fff64);})[_0x0edb('0x12')](function(_0x23efe2){logger[_0x0edb('0xe')](_0x0edb('0x1e'),_0x23efe2['message'],_0x35ba3a);_0xdb14ae(_0x4813b8[_0x0edb('0xe')](0x1f4,_0x23efe2[_0x0edb('0x11')]));});});}; \ No newline at end of file +var _0xdb6e=['info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','debug','catch','update','raw','where','attributes','limit','UpdateWhatsappQueueReport','stringify','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2482e3,_0x32b15c){var _0x4098a6=function(_0x5757a5){while(--_0x5757a5){_0x2482e3['push'](_0x2482e3['shift']());}};_0x4098a6(++_0x32b15c);}(_0xdb6e,0x10c));var _0xedb6=function(_0x26c654,_0x22226c){_0x26c654=_0x26c654-0x0;var _0x7c4e7a=_0xdb6e[_0x26c654];return _0x7c4e7a;};'use strict';var _=require('lodash');var util=require(_0xedb6('0x0'));var moment=require(_0xedb6('0x1'));var BPromise=require('bluebird');var rs=require(_0xedb6('0x2'));var fs=require('fs');var Redis=require(_0xedb6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xedb6('0x4'));var logger=require('../../config/logger')(_0xedb6('0x5'));var config=require(_0xedb6('0x6'));var jayson=require(_0xedb6('0x7'));var client=jayson[_0xedb6('0x8')][_0xedb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x351df6,_0x3f6da8,_0x18b8a5){return new BPromise(function(_0x9665e4,_0x259377){return client['request'](_0x351df6,_0x18b8a5)[_0xedb6('0xa')](function(_0x4254af){logger[_0xedb6('0xb')](_0xedb6('0xc'),_0x3f6da8,'request\x20sent');logger['debug'](_0xedb6('0xd'),_0x3f6da8,_0xedb6('0xe'),JSON['stringify'](_0x4254af));if(_0x4254af['error']){if(_0x4254af[_0xedb6('0xf')][_0xedb6('0x10')]===0x1f4){logger['error'](_0xedb6('0xc'),_0x3f6da8,_0x4254af['error']['message']);return _0x259377(_0x4254af['error'][_0xedb6('0x11')]);}logger[_0xedb6('0xf')](_0xedb6('0xc'),_0x3f6da8,_0x4254af[_0xedb6('0xf')][_0xedb6('0x11')]);return _0x9665e4(_0x4254af['error'][_0xedb6('0x11')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x3f6da8,_0xedb6('0xe'));_0x9665e4(_0x4254af['result'][_0xedb6('0x11')]);}})['catch'](function(_0x10e56c){logger[_0xedb6('0xf')](_0xedb6('0xc'),_0x3f6da8,_0x10e56c);_0x259377(_0x10e56c);});});}exports[_0xedb6('0x12')]=function(_0x214434){var _0x396d77=this;return new Promise(function(_0x425ad8,_0x92b9d6){return db[_0xedb6('0x13')][_0xedb6('0x14')](_0x214434['body'],{'raw':_0x214434[_0xedb6('0x15')]?_0x214434['options']['raw']===undefined?!![]:![]:!![]})[_0xedb6('0xa')](function(_0x2ae700){logger[_0xedb6('0xb')](_0xedb6('0x12'),_0x214434);logger[_0xedb6('0x16')](_0xedb6('0x12'),_0x214434,JSON['stringify'](_0x2ae700));_0x425ad8(_0x2ae700);})[_0xedb6('0x17')](function(_0x29e85c){logger['error'](_0xedb6('0x12'),_0x29e85c[_0xedb6('0x11')],_0x214434);_0x92b9d6(_0x396d77[_0xedb6('0xf')](0x1f4,_0x29e85c[_0xedb6('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x3ea0a3){var _0x147b87=this;return new Promise(function(_0x50b8f4,_0x9d9dcd){return db[_0xedb6('0x13')][_0xedb6('0x18')](_0x3ea0a3['body'],{'raw':_0x3ea0a3['options']?_0x3ea0a3['options'][_0xedb6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ea0a3[_0xedb6('0x15')]?_0x3ea0a3[_0xedb6('0x15')][_0xedb6('0x1a')]||null:null,'attributes':_0x3ea0a3[_0xedb6('0x15')]?_0x3ea0a3['options'][_0xedb6('0x1b')]||null:null,'limit':_0x3ea0a3['options']?_0x3ea0a3['options'][_0xedb6('0x1c')]||null:null})[_0xedb6('0xa')](function(_0x58dd3d){logger[_0xedb6('0xb')](_0xedb6('0x1d'),_0x3ea0a3);logger[_0xedb6('0x16')](_0xedb6('0x1d'),_0x3ea0a3,JSON[_0xedb6('0x1e')](_0x58dd3d));_0x50b8f4(_0x58dd3d);})['catch'](function(_0x5b0c17){logger[_0xedb6('0xf')](_0xedb6('0x1d'),_0x5b0c17[_0xedb6('0x11')],_0x3ea0a3);_0x9d9dcd(_0x147b87[_0xedb6('0xf')](0x1f4,_0x5b0c17[_0xedb6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 08acf42..edbf5f6 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 _0xbdd3=['index','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x40f06e,_0x42a881){var _0x586113=function(_0x443a73){while(--_0x443a73){_0x40f06e['push'](_0x40f06e['shift']());}};_0x586113(++_0x42a881);}(_0xbdd3,0x88));var _0x3bdd=function(_0x44a35c,_0x27f713){_0x44a35c=_0x44a35c-0x0;var _0x317c74=_0xbdd3[_0x44a35c];return _0x317c74;};'use strict';var multer=require(_0x3bdd('0x0'));var util=require(_0x3bdd('0x1'));var path=require(_0x3bdd('0x2'));var timeout=require(_0x3bdd('0x3'));var express=require(_0x3bdd('0x4'));var router=express[_0x3bdd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3bdd('0x6'));var interaction=require(_0x3bdd('0x7'));var config=require('../../config/environment');var controller=require(_0x3bdd('0x8'));router[_0x3bdd('0x9')]('/',auth[_0x3bdd('0xa')](),controller[_0x3bdd('0xb')]);router[_0x3bdd('0x9')](_0x3bdd('0xc'),auth[_0x3bdd('0xa')](),controller[_0x3bdd('0xd')]);router[_0x3bdd('0x9')](_0x3bdd('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3bdd('0xf')]('/',auth[_0x3bdd('0xa')](),controller[_0x3bdd('0x10')]);router[_0x3bdd('0x11')]('/:id',auth[_0x3bdd('0xa')](),controller[_0x3bdd('0x12')]);router['delete'](_0x3bdd('0xe'),auth[_0x3bdd('0xa')](),controller[_0x3bdd('0x13')]);module[_0x3bdd('0x14')]=router; \ No newline at end of file +var _0xb14c=['/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x557b1e,_0x1b905c){var _0x3d3b72=function(_0x1f794a){while(--_0x1f794a){_0x557b1e['push'](_0x557b1e['shift']());}};_0x3d3b72(++_0x1b905c);}(_0xb14c,0x129));var _0xcb14=function(_0x33a5ec,_0x10c014){_0x33a5ec=_0x33a5ec-0x0;var _0x38f89c=_0xb14c[_0x33a5ec];return _0x38f89c;};'use strict';var multer=require(_0xcb14('0x0'));var util=require(_0xcb14('0x1'));var path=require(_0xcb14('0x2'));var timeout=require(_0xcb14('0x3'));var express=require('express');var router=express[_0xcb14('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcb14('0x5'));var config=require('../../config/environment');var controller=require(_0xcb14('0x6'));router[_0xcb14('0x7')]('/',auth[_0xcb14('0x8')](),controller['index']);router[_0xcb14('0x7')](_0xcb14('0x9'),auth[_0xcb14('0x8')](),controller[_0xcb14('0xa')]);router[_0xcb14('0x7')](_0xcb14('0xb'),auth[_0xcb14('0x8')](),controller['show']);router[_0xcb14('0xc')]('/',auth[_0xcb14('0x8')](),controller[_0xcb14('0xd')]);router[_0xcb14('0xe')](_0xcb14('0xb'),auth[_0xcb14('0x8')](),controller[_0xcb14('0xf')]);router[_0xcb14('0x10')](_0xcb14('0xb'),auth[_0xcb14('0x8')](),controller[_0xcb14('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index f0f6465..d16502a 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 _0x6d0c=['sequelize','exports','STRING','ENUM','account','agent','DATE'];(function(_0x2a9cc4,_0x3699d1){var _0x13bbb4=function(_0x41043f){while(--_0x41043f){_0x2a9cc4['push'](_0x2a9cc4['shift']());}};_0x13bbb4(++_0x3699d1);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x423e0e,_0x7b4490){_0x423e0e=_0x423e0e-0x0;var _0x5175ef=_0x6d0c[_0x423e0e];return _0x5175ef;};'use strict';var Sequelize=require(_0xc6d0('0x0'));module[_0xc6d0('0x1')]={'uniqueid':{'type':Sequelize[_0xc6d0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc6d0('0x3')](_0xc6d0('0x4'),_0xc6d0('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc6d0('0x6')]}}; \ No newline at end of file +var _0x5987=['queue','DATE','sequelize','exports','STRING','ENUM','agent'];(function(_0x36789b,_0x273122){var _0x5d5cc4=function(_0xaa7e2){while(--_0xaa7e2){_0x36789b['push'](_0x36789b['shift']());}};_0x5d5cc4(++_0x273122);}(_0x5987,0x128));var _0x7598=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5987[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7598('0x0'));module[_0x7598('0x1')]={'uniqueid':{'type':Sequelize[_0x7598('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7598('0x3')]('account',_0x7598('0x4'),_0x7598('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7598('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7b28138..bc8e861 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 _0x8bc3=['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','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','keys','intersection','length','options','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x18cc17,_0x36c743){var _0x54bd72=function(_0x2f19c0){while(--_0x2f19c0){_0x18cc17['push'](_0x18cc17['shift']());}};_0x54bd72(++_0x36c743);}(_0x8bc3,0x8a));var _0x38bc=function(_0x1f1731,_0x4b77eb){_0x1f1731=_0x1f1731-0x0;var _0x1f7625=_0x8bc3[_0x1f1731];return _0x1f7625;};'use strict';var emlformat=require(_0x38bc('0x0'));var rimraf=require(_0x38bc('0x1'));var zipdir=require(_0x38bc('0x2'));var jsonpatch=require(_0x38bc('0x3'));var rp=require(_0x38bc('0x4'));var moment=require(_0x38bc('0x5'));var BPromise=require(_0x38bc('0x6'));var Mustache=require(_0x38bc('0x7'));var util=require(_0x38bc('0x8'));var path=require(_0x38bc('0x9'));var sox=require('sox');var csv=require(_0x38bc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38bc('0xb'));var _=require(_0x38bc('0xc'));var squel=require(_0x38bc('0xd'));var crypto=require(_0x38bc('0xe'));var jsforce=require(_0x38bc('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x38bc('0x10'));var Papa=require(_0x38bc('0x11'));var Redis=require(_0x38bc('0x12'));var authService=require(_0x38bc('0x13'));var qs=require(_0x38bc('0x14'));var as=require(_0x38bc('0x15'));var hardwareService=require(_0x38bc('0x16'));var logger=require(_0x38bc('0x17'))('api');var utils=require(_0x38bc('0x18'));var config=require(_0x38bc('0x19'));var licenseUtil=require(_0x38bc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x269d4c,_0x3bc78e){_0x3bc78e=_0x3bc78e||0xcc;return function(_0x5cc22f){if(_0x5cc22f){return _0x269d4c[_0x38bc('0x1b')](_0x3bc78e);}return _0x269d4c[_0x38bc('0x1c')](_0x3bc78e)[_0x38bc('0x1d')]();};}function respondWithResult(_0xe52bc5,_0x380f90){_0x380f90=_0x380f90||0xc8;return function(_0x1c33aa){if(_0x1c33aa){return _0xe52bc5['status'](_0x380f90)[_0x38bc('0x1e')](_0x1c33aa);}};}function respondWithFilteredResult(_0x4034fd,_0x3d17ef){return function(_0x2e2d89){if(_0x2e2d89){var _0x168c00=typeof _0x3d17ef[_0x38bc('0x1f')]===_0x38bc('0x20')&&typeof _0x3d17ef[_0x38bc('0x21')]===_0x38bc('0x20');var _0x300ed4=_0x2e2d89[_0x38bc('0x22')];var _0x9a757e=_0x168c00?0x0:_0x3d17ef[_0x38bc('0x1f')];var _0x108c2b=_0x168c00?_0x2e2d89[_0x38bc('0x22')]:_0x3d17ef[_0x38bc('0x1f')]+_0x3d17ef[_0x38bc('0x21')];var _0x175e46;if(_0x108c2b>=_0x300ed4){_0x108c2b=_0x300ed4;_0x175e46=0xc8;}else{_0x175e46=0xce;}_0x4034fd[_0x38bc('0x1c')](_0x175e46);return _0x4034fd[_0x38bc('0x23')]('Content-Range',_0x9a757e+'-'+_0x108c2b+'/'+_0x300ed4)['json'](_0x2e2d89);}return null;};}function patchUpdates(_0x13c803){return function(_0x216170){try{jsonpatch[_0x38bc('0x24')](_0x216170,_0x13c803,!![]);}catch(_0xf9590d){return BPromise[_0x38bc('0x25')](_0xf9590d);}return _0x216170[_0x38bc('0x26')]();};}function saveUpdates(_0x2c7396,_0x5beb30){return function(_0xb96b19){if(_0xb96b19){return _0xb96b19[_0x38bc('0x27')](_0x2c7396)[_0x38bc('0x28')](function(_0x44f5f9){return _0x44f5f9;});}return null;};}function removeEntity(_0x2f7b41,_0x712f29){return function(_0x131590){if(_0x131590){return _0x131590[_0x38bc('0x29')]()[_0x38bc('0x28')](function(){_0x2f7b41[_0x38bc('0x1c')](0xcc)[_0x38bc('0x1d')]();});}};}function handleEntityNotFound(_0x48faa3,_0x239303){return function(_0x38a86d){if(!_0x38a86d){_0x48faa3[_0x38bc('0x1b')](0x194);}return _0x38a86d;};}function handleError(_0x12b725,_0x57dba7){_0x57dba7=_0x57dba7||0x1f4;return function(_0x13ab4e){logger[_0x38bc('0x2a')](_0x13ab4e[_0x38bc('0x2b')]);if(_0x13ab4e['name']){delete _0x13ab4e[_0x38bc('0x2c')];}_0x12b725[_0x38bc('0x1c')](_0x57dba7)[_0x38bc('0x2d')](_0x13ab4e);};}exports[_0x38bc('0x2e')]=function(_0x3ac280,_0x4b825e){var _0x514679={},_0x4969e3={},_0x98b53f={'count':0x0,'rows':[]};var _0xce45d=_[_0x38bc('0x2f')](db[_0x38bc('0x30')][_0x38bc('0x31')],function(_0x27a482){return{'name':_0x27a482[_0x38bc('0x32')],'type':_0x27a482[_0x38bc('0x33')]['key']};});_0x4969e3[_0x38bc('0x34')]=_['map'](_0xce45d,_0x38bc('0x2c'));_0x4969e3[_0x38bc('0x35')]=_['keys'](_0x3ac280[_0x38bc('0x35')]);_0x4969e3[_0x38bc('0x36')]=_['intersection'](_0x4969e3[_0x38bc('0x34')],_0x4969e3[_0x38bc('0x35')]);_0x514679[_0x38bc('0x37')]=_['intersection'](_0x4969e3[_0x38bc('0x34')],qs[_0x38bc('0x38')](_0x3ac280[_0x38bc('0x35')][_0x38bc('0x38')]));_0x514679[_0x38bc('0x37')]=_0x514679['attributes']['length']?_0x514679['attributes']:_0x4969e3[_0x38bc('0x34')];if(!_0x3ac280[_0x38bc('0x35')][_0x38bc('0x39')](_0x38bc('0x3a'))){_0x514679[_0x38bc('0x21')]=qs['limit'](_0x3ac280[_0x38bc('0x35')][_0x38bc('0x21')]);_0x514679[_0x38bc('0x1f')]=qs[_0x38bc('0x1f')](_0x3ac280[_0x38bc('0x35')][_0x38bc('0x1f')]);}_0x514679[_0x38bc('0x3b')]=qs[_0x38bc('0x3c')](_0x3ac280[_0x38bc('0x35')]['sort']);_0x514679[_0x38bc('0x3d')]=qs[_0x38bc('0x36')](_[_0x38bc('0x3e')](_0x3ac280['query'],_0x4969e3[_0x38bc('0x36')]),_0xce45d);if(_0x3ac280[_0x38bc('0x35')]['filter']){_0x514679[_0x38bc('0x3d')]=_[_0x38bc('0x3f')](_0x514679[_0x38bc('0x3d')],{'$or':_[_0x38bc('0x2f')](_0xce45d,function(_0x1d2ff3){if(_0x1d2ff3[_0x38bc('0x33')]!==_0x38bc('0x40')){var _0x1ddffa={};_0x1ddffa[_0x1d2ff3[_0x38bc('0x2c')]]={'$like':'%'+_0x3ac280[_0x38bc('0x35')]['filter']+'%'};return _0x1ddffa;}})});}_0x514679=_[_0x38bc('0x3f')]({},_0x514679,_0x3ac280['options']);var _0x3c0ed7={'where':_0x514679[_0x38bc('0x3d')]};return db['WhatsappTransferReport'][_0x38bc('0x22')](_0x3c0ed7)[_0x38bc('0x28')](function(_0xdda358){_0x98b53f[_0x38bc('0x22')]=_0xdda358;if(_0x3ac280[_0x38bc('0x35')][_0x38bc('0x41')]){_0x514679['include']=[{'all':!![]}];}return db[_0x38bc('0x30')][_0x38bc('0x42')](_0x514679);})[_0x38bc('0x28')](function(_0x136bda){_0x98b53f[_0x38bc('0x43')]=_0x136bda;return _0x98b53f;})[_0x38bc('0x28')](respondWithFilteredResult(_0x4b825e,_0x514679))['catch'](handleError(_0x4b825e,null));};exports['show']=function(_0x25b15c,_0xfe7c31){var _0x338d2c={'raw':!![],'where':{'id':_0x25b15c['params']['id']}},_0x21b542={};_0x21b542['model']=_['keys'](db[_0x38bc('0x30')][_0x38bc('0x31')]);_0x21b542[_0x38bc('0x35')]=_[_0x38bc('0x44')](_0x25b15c[_0x38bc('0x35')]);_0x21b542[_0x38bc('0x36')]=_[_0x38bc('0x45')](_0x21b542[_0x38bc('0x34')],_0x21b542['query']);_0x338d2c[_0x38bc('0x37')]=_[_0x38bc('0x45')](_0x21b542[_0x38bc('0x34')],qs['fields'](_0x25b15c[_0x38bc('0x35')][_0x38bc('0x38')]));_0x338d2c[_0x38bc('0x37')]=_0x338d2c[_0x38bc('0x37')][_0x38bc('0x46')]?_0x338d2c[_0x38bc('0x37')]:_0x21b542['model'];if(_0x25b15c['query'][_0x38bc('0x41')]){_0x338d2c['include']=[{'all':!![]}];}_0x338d2c=_[_0x38bc('0x3f')]({},_0x338d2c,_0x25b15c[_0x38bc('0x47')]);return db[_0x38bc('0x30')][_0x38bc('0x48')](_0x338d2c)[_0x38bc('0x28')](handleEntityNotFound(_0xfe7c31,null))['then'](respondWithResult(_0xfe7c31,null))['catch'](handleError(_0xfe7c31,null));};exports[_0x38bc('0x49')]=function(_0x4a3140,_0x341f82){return db[_0x38bc('0x30')][_0x38bc('0x49')](_0x4a3140[_0x38bc('0x4a')],{})[_0x38bc('0x28')](respondWithResult(_0x341f82,0xc9))[_0x38bc('0x4b')](handleError(_0x341f82,null));};exports[_0x38bc('0x27')]=function(_0x12a4dd,_0x322d94){if(_0x12a4dd['body']['id']){delete _0x12a4dd['body']['id'];}return db[_0x38bc('0x30')][_0x38bc('0x48')]({'where':{'id':_0x12a4dd[_0x38bc('0x4c')]['id']}})[_0x38bc('0x28')](handleEntityNotFound(_0x322d94,null))[_0x38bc('0x28')](saveUpdates(_0x12a4dd[_0x38bc('0x4a')],null))[_0x38bc('0x28')](respondWithResult(_0x322d94,null))[_0x38bc('0x4b')](handleError(_0x322d94,null));};exports[_0x38bc('0x29')]=function(_0x2d9abb,_0x2f8ea8){return db[_0x38bc('0x30')][_0x38bc('0x48')]({'where':{'id':_0x2d9abb['params']['id']}})['then'](handleEntityNotFound(_0x2f8ea8,null))[_0x38bc('0x28')](removeEntity(_0x2f8ea8,null))[_0x38bc('0x4b')](handleError(_0x2f8ea8,null));};exports[_0x38bc('0x4d')]=function(_0x18e210,_0x3f947a){return db[_0x38bc('0x30')][_0x38bc('0x4d')]()[_0x38bc('0x28')](respondWithResult(_0x3f947a,null))['catch'](handleError(_0x3f947a,null));}; \ No newline at end of file +var _0x1df7=['then','end','error','stack','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','rows','filters','options','find','create','body','params','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy'];(function(_0x3569a9,_0x3a4766){var _0x420727=function(_0x34f23a){while(--_0x34f23a){_0x3569a9['push'](_0x3569a9['shift']());}};_0x420727(++_0x3a4766);}(_0x1df7,0x6e));var _0x71df=function(_0x281756,_0x1acab3){_0x281756=_0x281756-0x0;var _0x141bd5=_0x1df7[_0x281756];return _0x141bd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71df('0x0'));var zipdir=require(_0x71df('0x1'));var jsonpatch=require(_0x71df('0x2'));var rp=require(_0x71df('0x3'));var moment=require(_0x71df('0x4'));var BPromise=require(_0x71df('0x5'));var Mustache=require(_0x71df('0x6'));var util=require(_0x71df('0x7'));var path=require(_0x71df('0x8'));var sox=require(_0x71df('0x9'));var csv=require(_0x71df('0xa'));var ejs=require(_0x71df('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71df('0xc'));var squel=require('squel');var crypto=require(_0x71df('0xd'));var jsforce=require(_0x71df('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x71df('0xa'));var querystring=require('querystring');var Papa=require(_0x71df('0xf'));var Redis=require(_0x71df('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x71df('0x11'));var as=require(_0x71df('0x12'));var hardwareService=require(_0x71df('0x13'));var logger=require('../../config/logger')(_0x71df('0x14'));var utils=require(_0x71df('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x71df('0x16'));var db=require(_0x71df('0x17'))['db'];function respondWithStatusCode(_0xca1e85,_0x5d5776){_0x5d5776=_0x5d5776||0xcc;return function(_0x50de5b){if(_0x50de5b){return _0xca1e85[_0x71df('0x18')](_0x5d5776);}return _0xca1e85[_0x71df('0x19')](_0x5d5776)['end']();};}function respondWithResult(_0x4621eb,_0x9f9282){_0x9f9282=_0x9f9282||0xc8;return function(_0x420bac){if(_0x420bac){return _0x4621eb[_0x71df('0x19')](_0x9f9282)[_0x71df('0x1a')](_0x420bac);}};}function respondWithFilteredResult(_0x5261a2,_0x198bb5){return function(_0x29c488){if(_0x29c488){var _0x20e521=typeof _0x198bb5[_0x71df('0x1b')]===_0x71df('0x1c')&&typeof _0x198bb5[_0x71df('0x1d')]==='undefined';var _0x305a97=_0x29c488[_0x71df('0x1e')];var _0x30acd2=_0x20e521?0x0:_0x198bb5[_0x71df('0x1b')];var _0x4813c8=_0x20e521?_0x29c488[_0x71df('0x1e')]:_0x198bb5[_0x71df('0x1b')]+_0x198bb5[_0x71df('0x1d')];var _0x234b72;if(_0x4813c8>=_0x305a97){_0x4813c8=_0x305a97;_0x234b72=0xc8;}else{_0x234b72=0xce;}_0x5261a2[_0x71df('0x19')](_0x234b72);return _0x5261a2['set'](_0x71df('0x1f'),_0x30acd2+'-'+_0x4813c8+'/'+_0x305a97)[_0x71df('0x1a')](_0x29c488);}return null;};}function patchUpdates(_0x3dc2e9){return function(_0x5936e6){try{jsonpatch[_0x71df('0x20')](_0x5936e6,_0x3dc2e9,!![]);}catch(_0x4911f4){return BPromise['reject'](_0x4911f4);}return _0x5936e6[_0x71df('0x21')]();};}function saveUpdates(_0x573738,_0x4a0684){return function(_0x416933){if(_0x416933){return _0x416933[_0x71df('0x22')](_0x573738)['then'](function(_0x2bfde4){return _0x2bfde4;});}return null;};}function removeEntity(_0x42bafb,_0x4f1041){return function(_0x9f23ea){if(_0x9f23ea){return _0x9f23ea[_0x71df('0x23')]()[_0x71df('0x24')](function(){_0x42bafb[_0x71df('0x19')](0xcc)[_0x71df('0x25')]();});}};}function handleEntityNotFound(_0x4e7b46,_0x2c8ca6){return function(_0x295a67){if(!_0x295a67){_0x4e7b46['sendStatus'](0x194);}return _0x295a67;};}function handleError(_0x2c0b8d,_0x5d1c52){_0x5d1c52=_0x5d1c52||0x1f4;return function(_0xcbf773){logger[_0x71df('0x26')](_0xcbf773[_0x71df('0x27')]);if(_0xcbf773['name']){delete _0xcbf773['name'];}_0x2c0b8d[_0x71df('0x19')](_0x5d1c52)['send'](_0xcbf773);};}exports[_0x71df('0x28')]=function(_0x266be8,_0x15fdb0){var _0x45c813={},_0x35a58c={},_0x48fb25={'count':0x0,'rows':[]};var _0x205623=_[_0x71df('0x29')](db[_0x71df('0x2a')][_0x71df('0x2b')],function(_0x583799){return{'name':_0x583799[_0x71df('0x2c')],'type':_0x583799['type'][_0x71df('0x2d')]};});_0x35a58c[_0x71df('0x2e')]=_[_0x71df('0x29')](_0x205623,_0x71df('0x2f'));_0x35a58c['query']=_[_0x71df('0x30')](_0x266be8[_0x71df('0x31')]);_0x35a58c['filters']=_[_0x71df('0x32')](_0x35a58c[_0x71df('0x2e')],_0x35a58c['query']);_0x45c813[_0x71df('0x33')]=_[_0x71df('0x32')](_0x35a58c[_0x71df('0x2e')],qs[_0x71df('0x34')](_0x266be8[_0x71df('0x31')][_0x71df('0x34')]));_0x45c813[_0x71df('0x33')]=_0x45c813[_0x71df('0x33')][_0x71df('0x35')]?_0x45c813['attributes']:_0x35a58c[_0x71df('0x2e')];if(!_0x266be8['query'][_0x71df('0x36')](_0x71df('0x37'))){_0x45c813['limit']=qs[_0x71df('0x1d')](_0x266be8[_0x71df('0x31')]['limit']);_0x45c813['offset']=qs[_0x71df('0x1b')](_0x266be8[_0x71df('0x31')][_0x71df('0x1b')]);}_0x45c813[_0x71df('0x38')]=qs['sort'](_0x266be8[_0x71df('0x31')][_0x71df('0x39')]);_0x45c813[_0x71df('0x3a')]=qs['filters'](_['pick'](_0x266be8['query'],_0x35a58c['filters']),_0x205623);if(_0x266be8['query'][_0x71df('0x3b')]){_0x45c813[_0x71df('0x3a')]=_[_0x71df('0x3c')](_0x45c813[_0x71df('0x3a')],{'$or':_['map'](_0x205623,function(_0x43c01c){if(_0x43c01c[_0x71df('0x3d')]!==_0x71df('0x3e')){var _0x4863a0={};_0x4863a0[_0x43c01c[_0x71df('0x2f')]]={'$like':'%'+_0x266be8[_0x71df('0x31')][_0x71df('0x3b')]+'%'};return _0x4863a0;}})});}_0x45c813=_[_0x71df('0x3c')]({},_0x45c813,_0x266be8['options']);var _0x399923={'where':_0x45c813['where']};return db[_0x71df('0x2a')]['count'](_0x399923)['then'](function(_0x3a0918){_0x48fb25[_0x71df('0x1e')]=_0x3a0918;if(_0x266be8['query'][_0x71df('0x3f')]){_0x45c813['include']=[{'all':!![]}];}return db[_0x71df('0x2a')]['findAll'](_0x45c813);})[_0x71df('0x24')](function(_0x1de0dd){_0x48fb25[_0x71df('0x40')]=_0x1de0dd;return _0x48fb25;})[_0x71df('0x24')](respondWithFilteredResult(_0x15fdb0,_0x45c813))['catch'](handleError(_0x15fdb0,null));};exports['show']=function(_0x14a6f9,_0x53e89e){var _0x1bf535={'raw':!![],'where':{'id':_0x14a6f9['params']['id']}},_0x12bce6={};_0x12bce6[_0x71df('0x2e')]=_[_0x71df('0x30')](db['WhatsappTransferReport'][_0x71df('0x2b')]);_0x12bce6['query']=_['keys'](_0x14a6f9[_0x71df('0x31')]);_0x12bce6[_0x71df('0x41')]=_[_0x71df('0x32')](_0x12bce6[_0x71df('0x2e')],_0x12bce6[_0x71df('0x31')]);_0x1bf535['attributes']=_[_0x71df('0x32')](_0x12bce6['model'],qs[_0x71df('0x34')](_0x14a6f9[_0x71df('0x31')][_0x71df('0x34')]));_0x1bf535[_0x71df('0x33')]=_0x1bf535[_0x71df('0x33')][_0x71df('0x35')]?_0x1bf535[_0x71df('0x33')]:_0x12bce6[_0x71df('0x2e')];if(_0x14a6f9[_0x71df('0x31')][_0x71df('0x3f')]){_0x1bf535['include']=[{'all':!![]}];}_0x1bf535=_[_0x71df('0x3c')]({},_0x1bf535,_0x14a6f9[_0x71df('0x42')]);return db[_0x71df('0x2a')][_0x71df('0x43')](_0x1bf535)[_0x71df('0x24')](handleEntityNotFound(_0x53e89e,null))['then'](respondWithResult(_0x53e89e,null))['catch'](handleError(_0x53e89e,null));};exports[_0x71df('0x44')]=function(_0x552c5f,_0x17df91){return db['WhatsappTransferReport'][_0x71df('0x44')](_0x552c5f[_0x71df('0x45')],{})[_0x71df('0x24')](respondWithResult(_0x17df91,0xc9))['catch'](handleError(_0x17df91,null));};exports[_0x71df('0x22')]=function(_0x10cd2f,_0x3e4778){if(_0x10cd2f['body']['id']){delete _0x10cd2f[_0x71df('0x45')]['id'];}return db['WhatsappTransferReport'][_0x71df('0x43')]({'where':{'id':_0x10cd2f[_0x71df('0x46')]['id']}})[_0x71df('0x24')](handleEntityNotFound(_0x3e4778,null))[_0x71df('0x24')](saveUpdates(_0x10cd2f['body'],null))['then'](respondWithResult(_0x3e4778,null))[_0x71df('0x47')](handleError(_0x3e4778,null));};exports['destroy']=function(_0x146543,_0x2596f6){return db[_0x71df('0x2a')][_0x71df('0x43')]({'where':{'id':_0x146543['params']['id']}})['then'](handleEntityNotFound(_0x2596f6,null))[_0x71df('0x24')](removeEntity(_0x2596f6,null))['catch'](handleError(_0x2596f6,null));};exports[_0x71df('0x48')]=function(_0xf9c72b,_0x204ce1){return db[_0x71df('0x2a')][_0x71df('0x48')]()[_0x71df('0x24')](respondWithResult(_0x204ce1,null))[_0x71df('0x47')](handleError(_0x204ce1,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 7517b9a..fb569f6 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 _0x674e=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x408bc1,_0x6c8048){var _0x454b6f=function(_0x9d4fc8){while(--_0x9d4fc8){_0x408bc1['push'](_0x408bc1['shift']());}};_0x454b6f(++_0x6c8048);}(_0x674e,0x13c));var _0xe674=function(_0x172b89,_0x39543d){_0x172b89=_0x172b89-0x0;var _0x30bc3f=_0x674e[_0x172b89];return _0x30bc3f;};'use strict';var _=require(_0xe674('0x0'));var util=require('util');var logger=require(_0xe674('0x1'))(_0xe674('0x2'));var moment=require(_0xe674('0x3'));var BPromise=require(_0xe674('0x4'));var rp=require(_0xe674('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe674('0x6'));var config=require(_0xe674('0x7'));var attributes=require(_0xe674('0x8'));module['exports']=function(_0x323077,_0x402bab){return _0x323077[_0xe674('0x9')](_0xe674('0xa'),attributes,{'tableName':_0xe674('0xb'),'paranoid':![],'indexes':[{'name':_0xe674('0xc'),'fields':[_0xe674('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f31=['uniqueid','lodash','../../config/logger','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x22d318,_0x22dc24){var _0x1c8e5c=function(_0x4ff565){while(--_0x4ff565){_0x22d318['push'](_0x22d318['shift']());}};_0x1c8e5c(++_0x22dc24);}(_0x6f31,0x1e1));var _0x16f3=function(_0x1468e8,_0x8e681e){_0x1468e8=_0x1468e8-0x0;var _0x27a50c=_0x6f31[_0x1468e8];return _0x27a50c;};'use strict';var _=require(_0x16f3('0x0'));var util=require('util');var logger=require(_0x16f3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16f3('0x2'));var fs=require('fs');var path=require(_0x16f3('0x3'));var rimraf=require('rimraf');var config=require(_0x16f3('0x4'));var attributes=require(_0x16f3('0x5'));module[_0x16f3('0x6')]=function(_0x34f431,_0x12e9b8){return _0x34f431['define'](_0x16f3('0x7'),attributes,{'tableName':_0x16f3('0x8'),'paranoid':![],'indexes':[{'name':_0x16f3('0x9'),'fields':[_0x16f3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 2589ff3..1089d1f 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 _0xa583=['message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1cac7d,_0x587638){var _0x468636=function(_0x455ba1){while(--_0x455ba1){_0x1cac7d['push'](_0x1cac7d['shift']());}};_0x468636(++_0x587638);}(_0xa583,0x158));var _0x3a58=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa583[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3a58('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a58('0x1'));var fs=require('fs');var Redis=require(_0x3a58('0x2'));var db=require(_0x3a58('0x3'))['db'];var utils=require(_0x3a58('0x4'));var logger=require(_0x3a58('0x5'))(_0x3a58('0x6'));var config=require(_0x3a58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3a58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cdf5a,_0x58a301,_0x1660a3){return new BPromise(function(_0x5a90d8,_0xb81d63){return client[_0x3a58('0x9')](_0x2cdf5a,_0x1660a3)['then'](function(_0x15469e){logger[_0x3a58('0xa')](_0x3a58('0xb'),_0x58a301,_0x3a58('0xc'));logger[_0x3a58('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x58a301,_0x3a58('0xc'),JSON[_0x3a58('0xe')](_0x15469e));if(_0x15469e['error']){if(_0x15469e[_0x3a58('0xf')][_0x3a58('0x10')]===0x1f4){logger['error'](_0x3a58('0xb'),_0x58a301,_0x15469e[_0x3a58('0xf')][_0x3a58('0x11')]);return _0xb81d63(_0x15469e[_0x3a58('0xf')][_0x3a58('0x11')]);}logger[_0x3a58('0xf')](_0x3a58('0xb'),_0x58a301,_0x15469e[_0x3a58('0xf')][_0x3a58('0x11')]);return _0x5a90d8(_0x15469e['error'][_0x3a58('0x11')]);}else{logger[_0x3a58('0xa')](_0x3a58('0xb'),_0x58a301,_0x3a58('0xc'));_0x5a90d8(_0x15469e[_0x3a58('0x12')][_0x3a58('0x11')]);}})['catch'](function(_0x16b84e){logger[_0x3a58('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x58a301,_0x16b84e);_0xb81d63(_0x16b84e);});});} \ No newline at end of file +var _0x57ac=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','rpc'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x57ac,0x12e));var _0xc57a=function(_0x3fa552,_0x5da82c){_0x3fa552=_0x3fa552-0x0;var _0x44a74a=_0x57ac[_0x3fa552];return _0x44a74a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc57a('0x0'));var BPromise=require(_0xc57a('0x1'));var rs=require(_0xc57a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc57a('0x3'));var config=require(_0xc57a('0x4'));var jayson=require(_0xc57a('0x5'));var client=jayson['client'][_0xc57a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f8b,_0x4088f9,_0x46765e){return new BPromise(function(_0x205e95,_0x2abc63){return client[_0xc57a('0x7')](_0x2b4f8b,_0x46765e)[_0xc57a('0x8')](function(_0x2eb62b){logger[_0xc57a('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4088f9,_0xc57a('0xa'));logger[_0xc57a('0xb')](_0xc57a('0xc'),_0x4088f9,_0xc57a('0xa'),JSON[_0xc57a('0xd')](_0x2eb62b));if(_0x2eb62b['error']){if(_0x2eb62b[_0xc57a('0xe')]['code']===0x1f4){logger['error'](_0xc57a('0xf'),_0x4088f9,_0x2eb62b[_0xc57a('0xe')]['message']);return _0x2abc63(_0x2eb62b[_0xc57a('0xe')]['message']);}logger[_0xc57a('0xe')](_0xc57a('0xf'),_0x4088f9,_0x2eb62b[_0xc57a('0xe')][_0xc57a('0x10')]);return _0x205e95(_0x2eb62b[_0xc57a('0xe')][_0xc57a('0x10')]);}else{logger[_0xc57a('0x9')](_0xc57a('0xf'),_0x4088f9,'request\x20sent');_0x205e95(_0x2eb62b['result'][_0xc57a('0x10')]);}})[_0xc57a('0x11')](function(_0x104f72){logger[_0xc57a('0xe')](_0xc57a('0xf'),_0x4088f9,_0x104f72);_0x2abc63(_0x104f72);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index def8cda..cbc49b6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x805e=['app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','listen','then','info','start','map','online','name','Offline\x20apps:','filter','status','join','None','seedDB','./config/seedDB','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc'];(function(_0xf4f828,_0xb7be07){var _0x570ad1=function(_0x21f5f2){while(--_0x21f5f2){_0xf4f828['push'](_0xf4f828['shift']());}};_0x570ad1(++_0xb7be07);}(_0x805e,0x1d9));var _0xe805=function(_0x35a393,_0x4e2072){_0x35a393=_0x35a393-0x0;var _0x22cea8=_0x805e[_0x35a393];return _0x22cea8;};'use strict';var _=require(_0xe805('0x0'));var mysqldb=require(_0xe805('0x1'));var rpc=require(_0xe805('0x2'));var config=require('./config/environment');var logger=require('./config/logger')(_0xe805('0x3'));var pm2=require(_0xe805('0x4'));var pm2Config=require(_0xe805('0x5'));var schedule=require('./config/schedule');var chat=require(_0xe805('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xe805('0x7'));function main(){return mysqldb['db'][_0xe805('0x8')][_0xe805('0x9')]()['then'](function(){return rpc[_0xe805('0xa')]();})[_0xe805('0xb')](function(_0x1bfa75){logger[_0xe805('0xc')](_0x1bfa75);return chat[_0xe805('0xd')]();})[_0xe805('0xb')](function(){return whatsapp[_0xe805('0xd')]();})[_0xe805('0xb')](function(){return schedule[_0xe805('0xd')]();})['then'](function(){return transcribe['start']();})[_0xe805('0xb')](function(_0xb0ac3b){logger[_0xe805('0xc')](_0xb0ac3b);return pm2[_0xe805('0xd')](pm2Config);})[_0xe805('0xb')](function(_0x37c749){logger[_0xe805('0xc')]('Online\x20apps:',_[_0xe805('0xe')](_['filter'](_0x37c749,{'status':_0xe805('0xf')}),_0xe805('0x10'))['join']());logger[_0xe805('0xc')](_0xe805('0x11'),_[_0xe805('0xe')](_[_0xe805('0x12')](_0x37c749,function(_0x1afa56){return _0x1afa56[_0xe805('0x13')]!==_0xe805('0xf');}),'name')[_0xe805('0x14')]()||_0xe805('0x15'));config[_0xe805('0x16')]&&require(_0xe805('0x17'))[_0xe805('0x18')]();require('./config/license')[_0xe805('0x18')]();})['catch'](function(_0x28a569){logger[_0xe805('0x19')](_0xe805('0x1a'),_0x28a569);process[_0xe805('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x6b01=['./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','info','start','then','Online\x20apps:','map','filter','join','Offline\x20apps:','status','None','./config/seedDB','default','catch','lodash'];(function(_0x60b4b5,_0x4b9f3c){var _0x5ce041=function(_0x3cb959){while(--_0x3cb959){_0x60b4b5['push'](_0x60b4b5['shift']());}};_0x5ce041(++_0x4b9f3c);}(_0x6b01,0x16b));var _0x16b0=function(_0x397de4,_0x38ac08){_0x397de4=_0x397de4-0x0;var _0x1ace8e=_0x6b01[_0x397de4];return _0x1ace8e;};'use strict';var _=require(_0x16b0('0x0'));var mysqldb=require(_0x16b0('0x1'));var rpc=require(_0x16b0('0x2'));var config=require(_0x16b0('0x3'));var logger=require(_0x16b0('0x4'))(_0x16b0('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x16b0('0x6'));var schedule=require(_0x16b0('0x7'));var chat=require(_0x16b0('0x8'));var whatsapp=require(_0x16b0('0x9'));var transcribe=require(_0x16b0('0xa'));function main(){return mysqldb['db'][_0x16b0('0xb')][_0x16b0('0xc')]()['then'](function(){return rpc['listen']();})['then'](function(_0x36a95f){logger[_0x16b0('0xd')](_0x36a95f);return chat['start']();})['then'](function(){return whatsapp[_0x16b0('0xe')]();})[_0x16b0('0xf')](function(){return schedule[_0x16b0('0xe')]();})['then'](function(){return transcribe[_0x16b0('0xe')]();})[_0x16b0('0xf')](function(_0xeca23c){logger[_0x16b0('0xd')](_0xeca23c);return pm2[_0x16b0('0xe')](pm2Config);})[_0x16b0('0xf')](function(_0x1e1710){logger[_0x16b0('0xd')](_0x16b0('0x10'),_[_0x16b0('0x11')](_[_0x16b0('0x12')](_0x1e1710,{'status':'online'}),'name')[_0x16b0('0x13')]());logger['info'](_0x16b0('0x14'),_['map'](_[_0x16b0('0x12')](_0x1e1710,function(_0x57953d){return _0x57953d[_0x16b0('0x15')]!=='online';}),'name')[_0x16b0('0x13')]()||_0x16b0('0x16'));config['seedDB']&&require(_0x16b0('0x17'))['default']();require('./config/license')[_0x16b0('0x18')]();})[_0x16b0('0x19')](function(_0x223d4b){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x223d4b);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ea43c25..48de16c 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 _0x5c99=['secrets','session','role','fullname','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','privacyEnabled','downloadVoiceRecordings','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','headers','startsWith','authorization','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isWebrtcLicence','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','decryptString','encryptString','promisify','secret','payload','options','verify','randomBytes','hex','now','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','bluebird','util','moment'];(function(_0x53a04d,_0x2a71d0){var _0x1937fb=function(_0x2b1141){while(--_0x2b1141){_0x53a04d['push'](_0x53a04d['shift']());}};_0x1937fb(++_0x2a71d0);}(_0x5c99,0x169));var _0x95c9=function(_0x3462ae,_0x225598){_0x3462ae=_0x3462ae-0x0;var _0x587dd6=_0x5c99[_0x3462ae];return _0x587dd6;};'use strict';var db=require(_0x95c9('0x0'))['db'];var config=require(_0x95c9('0x1'));var hardwareConf=require(_0x95c9('0x2'));var licenseUtil=require(_0x95c9('0x3'));var encryptor=require(_0x95c9('0x4'));var _=require(_0x95c9('0x5'));var jwt=require(_0x95c9('0x6'));var expressJwt=require(_0x95c9('0x7'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x95c9('0x8'));var util=require(_0x95c9('0x9'));var moment=require(_0x95c9('0xa'));var validateJwt=expressJwt({'secret':config[_0x95c9('0xb')][_0x95c9('0xc')]});var userAttributes=['id',_0x95c9('0xd'),_0x95c9('0xe'),'name',_0x95c9('0xf'),_0x95c9('0x10'),_0x95c9('0x11'),_0x95c9('0x12'),'md5secret',_0x95c9('0x13'),_0x95c9('0x14'),_0x95c9('0x15'),_0x95c9('0x16'),_0x95c9('0x17'),_0x95c9('0x18'),'pauseType',_0x95c9('0x19'),_0x95c9('0x1a'),_0x95c9('0x1b'),_0x95c9('0x1c'),_0x95c9('0x1d'),_0x95c9('0x1e'),_0x95c9('0x1f'),_0x95c9('0x20'),_0x95c9('0x21'),'phoneBarDnd',_0x95c9('0x22'),_0x95c9('0x23'),'phoneBarEnableSettings',_0x95c9('0x24'),_0x95c9('0x25'),'phoneBarRemoteControl',_0x95c9('0x26'),_0x95c9('0x27'),'interface','userProfileId',_0x95c9('0x28'),'settingsEnabled','wssPort',_0x95c9('0x29'),'downloadOmnichannelInteractions','downloadAttachments',_0x95c9('0x2a'),_0x95c9('0x2b')];exports[_0x95c9('0x2c')]=function(){return this['isAuthenticated'](!![])[_0x95c9('0x2d')](function(_0x24a656,_0x37c739,_0x3438ac){if(_0x24a656[_0x95c9('0x2e')]){_0x3438ac();}else{return db[_0x95c9('0x2f')][_0x95c9('0x30')]({'where':{'id':_0x24a656['params']['id']},'attributes':['id',_0x95c9('0x31'),_0x95c9('0x32')],'raw':!![]})[_0x95c9('0x33')](function(_0x37a0d9){if(_0x37a0d9&&_0x37a0d9['closed']){return _0x37c739['status'](_0x37a0d9['disposition']===_0x95c9('0x34')?0x195:0x193)[_0x95c9('0x35')]({'message':_0x37a0d9['disposition']===_0x95c9('0x34')?_0x95c9('0x36'):_0x95c9('0x37')});}else{_0x3438ac();}})['catch'](function(_0x38a2ee){_0x3438ac(_0x38a2ee);});}});};exports['isAuthenticated']=function isAuthenticated(_0x172e2f){return compose()[_0x95c9('0x2d')](function(_0x4415e7,_0x4efb41,_0x2fa835){var _0x86f03;if(_0x4415e7[_0x95c9('0x38')]['authorization']){if(_[_0x95c9('0x39')](_0x4415e7[_0x95c9('0x38')][_0x95c9('0x3a')],_0x95c9('0x3b'))){var _0x555563=basicAuth(_0x4415e7);db[_0x95c9('0x3c')][_0x95c9('0x3d')]({'where':{'name':_0x555563['name']}})[_0x95c9('0x33')](function(_0x5928d1){if(!_0x5928d1||!_0x5928d1[_0x95c9('0x3e')](_0x555563[_0x95c9('0x3f')])){return _0x4efb41[_0x95c9('0x40')](0x191)[_0x95c9('0x35')]({'message':_0x95c9('0x41')});}_0x4415e7['user']={'id':_0x5928d1['id']};_0x2fa835();})[_0x95c9('0x42')](function(_0x3e71e7){_0x2fa835(_0x3e71e7);});}else if(_[_0x95c9('0x39')](_0x4415e7[_0x95c9('0x38')][_0x95c9('0x3a')],_0x95c9('0x43'))){validateJwt(_0x4415e7,_0x4efb41,_0x2fa835);}else{if(_0x172e2f){_0x2fa835();}else{return _0x4efb41[_0x95c9('0x40')](0x193)[_0x95c9('0x35')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4415e7['query'][_0x95c9('0x44')]){try{var _0x20ef6c={'audience':hardwareConf[_0x95c9('0x45')](),'issuer':hardwareConf[_0x95c9('0x45')]()};verifyJwt(_0x4415e7[_0x95c9('0x46')][_0x95c9('0x44')],_0x20ef6c)[_0x95c9('0x33')](function(_0x408161){return db['User'][_0x95c9('0x3d')]({'where':{'id':_0x408161[_0x95c9('0x47')]}})[_0x95c9('0x33')](function(_0x589ccb){_0x86f03=_0x589ccb;return db[_0x95c9('0x48')][_0x95c9('0x30')]({'where':{'id':0x1},'attributes':[_0x95c9('0x49'),_0x95c9('0x4a')],'raw':!![]});})['then'](function(_0x1c1913){if(!_0x86f03||!_['isEqual'](_0x86f03[_0x95c9('0x4b')],_0x408161[_0x95c9('0x4c')])){return _0x4efb41[_0x95c9('0x40')](0x191)[_0x95c9('0x35')]({'message':_0x95c9('0x4d')});}if(_0x86f03[_0x95c9('0x4e')]){return _0x4efb41[_0x95c9('0x40')](0x191)['json']({'message':_0x95c9('0x4f')});}if(_0x86f03['blocked']){if(_0x1c1913[_0x95c9('0x4a')]>0x0){if(moment(_0x86f03['blockedAt'])[_0x95c9('0x50')](_0x1c1913['blockDuration'],'minutes')>moment()){return _0x4efb41['status'](0x191)['json']({'message':_0x95c9('0x4f')});}}else{return _0x4efb41[_0x95c9('0x40')](0x191)[_0x95c9('0x35')]({'message':_0x95c9('0x4f')});}}_0x4415e7[_0x95c9('0x2e')]={'id':_0x86f03['id']};_0x2fa835();});})[_0x95c9('0x42')](function(){return _0x4efb41[_0x95c9('0x40')](0x191)[_0x95c9('0x35')]({'message':_0x95c9('0x4f')});});}catch(_0x3f43e6){_0x2fa835(_0x3f43e6);}}else if(_0x172e2f){_0x2fa835();}else{return _0x4efb41[_0x95c9('0x40')](0x193)[_0x95c9('0x35')]({'message':'Unknown\x20authorization\x20format'});}})[_0x95c9('0x2d')](function(_0x4826ab,_0x1c1664,_0x5c4848){if(_0x4826ab[_0x95c9('0x2e')]){db[_0x95c9('0x3c')][_0x95c9('0x3d')]({'where':{'id':_0x4826ab[_0x95c9('0x2e')]['id']},'attributes':userAttributes})[_0x95c9('0x33')](function(_0x16062c){if(!_0x16062c){return _0x1c1664['status'](0x194)['json']({'message':_0x95c9('0x51')});}_0x4826ab['user']=_0x16062c;_0x5c4848();})[_0x95c9('0x42')](function(_0x1dea8a){_0x5c4848(_0x1dea8a);});}else if(_0x172e2f){_0x5c4848();}else{return _0x1c1664[_0x95c9('0x40')](0x194)['json']({'message':_0x95c9('0x52')});}});};exports[_0x95c9('0x53')]=function canUpdate(){return compose()['use'](function(_0x3f63ff,_0x1a8068,_0x3c972e){return licenseUtil[_0x95c9('0x54')]()['then'](function(_0x1d49d8){if(_0x1d49d8['update']){_0x3c972e();}else{return _0x1a8068[_0x95c9('0x40')](0x193)[_0x95c9('0x35')]({'message':'Forbidden'});}})[_0x95c9('0x42')](function(_0x469758){_0x3c972e(_0x469758);});});};exports[_0x95c9('0x55')]=function isWebrtcLicence(){return compose()[_0x95c9('0x2d')](function(_0xd6f004,_0x227968,_0x2a070f){return licenseUtil[_0x95c9('0x54')]()[_0x95c9('0x33')](function(_0x3d7531){if(_0x3d7531[_0x95c9('0x56')]){_0x2a070f();}else{return _0x227968['status'](0x193)['json']({'message':_0x95c9('0x57')});}})[_0x95c9('0x42')](function(_0x52598a){_0x2a070f(_0x52598a);});});};exports[_0x95c9('0x58')]=function(_0x5eb824,_0x51cf84,_0x30ec76){_0x5eb824[_0x95c9('0x58')]=!![];return _0x30ec76();};exports[_0x95c9('0x59')]=function signToken(_0x5c71c3){return signJwt(_0x5c71c3);};exports[_0x95c9('0x5a')]=function(_0x54ca4,_0x3dd0f8){if(!_0x54ca4[_0x95c9('0x2e')]){return _0x3dd0f8[_0x95c9('0x40')](0x194)[_0x95c9('0x35')]({'message':_0x95c9('0x5b')});}var _0x4b7583={'payload':{'id':_0x54ca4['user']['id'],'role':_0x54ca4['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4b7583)[_0x95c9('0x33')](function(_0x342a2d){_0x3dd0f8[_0x95c9('0x5c')](_0x95c9('0x5d'),_0x342a2d);_0x3dd0f8[_0x95c9('0x5e')](_0x95c9('0x5f'));})[_0x95c9('0x42')](function(_0x5cc811){return _0x3dd0f8[_0x95c9('0x40')](0x1f4)[_0x95c9('0x60')](_0x5cc811);});};exports[_0x95c9('0x61')]=function(_0x1fc1e2){if(_[_0x95c9('0x62')](_0x1fc1e2[_0x95c9('0x4b')])||_['isNil'](_0x1fc1e2[_0x95c9('0x63')])){return null;}else{return createJwt(_0x1fc1e2);}};exports[_0x95c9('0x64')]=function(_0x2ae135){_0x2ae135[_0x95c9('0x4b')]=generateNonce();_0x2ae135[_0x95c9('0x63')]=generateIssuedAt();return createJwt(_0x2ae135);};exports[_0x95c9('0x65')]=function(_0x3dc389,_0xffef9b){var _0x10b750=_0x3dc389['query'][_0x95c9('0x44')];if(_0x10b750){var _0x4406b3={'nonce':_0xffef9b['apiKeyNonce'],'iat':_0xffef9b[_0x95c9('0x63')],'audience':hardwareConf[_0x95c9('0x45')](),'issuer':hardwareConf[_0x95c9('0x45')]()};return verifyJwt(_0x10b750,_0x4406b3)[_0x95c9('0x33')](function(){return generateApiKey(_0xffef9b);});}else{throw{'message':_0x95c9('0x66')};}};exports[_0x95c9('0x67')]=function(_0x1c7461){var _0x9c5d16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x9c5d16['test'](_0x1c7461))throw new db[(_0x95c9('0x68'))][(_0x95c9('0x69'))](_0x95c9('0x6a'));return;};exports[_0x95c9('0x6b')]=function(_0x463692,_0x231f1a,_0x4846b4){var _0x5821e0=encryptor['decryptString'](_0x231f1a)[_0x95c9('0x6c')](',');for(var _0x10e7fc=0x0;_0x10e7fc<_0x4846b4;_0x10e7fc++){if(!_0x5821e0[_0x10e7fc])break;if(_0x463692[_0x95c9('0x6d')]()===_0x5821e0[_0x10e7fc][_0x95c9('0x6d')]()){var _0x50def2=util[_0x95c9('0x6e')](_0x95c9('0x6f'),_0x4846b4);if(_0x4846b4===0x1){_0x50def2=_0x95c9('0x70');}throw new db['Sequelize'][(_0x95c9('0x69'))](_0x50def2);}}return;};exports['updatePasswordsHistory']=function(_0x3e8359,_0x5f4a87){var _0x3067b0=_0x5f4a87?encryptor[_0x95c9('0x71')](_0x5f4a87)[_0x95c9('0x6c')](','):[];if(_0x3067b0['length']===0x5){_0x3067b0['splice'](-0x1,0x1);}_0x3067b0['unshift'](_0x3e8359);return encryptor[_0x95c9('0x72')](_0x3067b0['join'](','));};function signJwt(_0x1d05f2){var _0x5f4073=BPromise[_0x95c9('0x73')](jwt['sign'],{'context':jwt});var _0x3d893b=_0x1d05f2[_0x95c9('0x74')]||config['secrets']['session'];return new BPromise(function(_0x51f4f7,_0x21ad04){_0x5f4073(_0x1d05f2[_0x95c9('0x75')],_0x3d893b,_0x1d05f2[_0x95c9('0x76')])[_0x95c9('0x33')](function(_0x144f1f){_0x51f4f7(_0x144f1f);})[_0x95c9('0x42')](function(_0xfafee0){_0x21ad04(_0xfafee0);});});}function verifyJwt(_0x5d659b,_0x56a5d1,_0x17c90b){var _0x5657b6=BPromise['promisify'](jwt[_0x95c9('0x77')],{'context':jwt});var _0x236e27=_0x17c90b||config[_0x95c9('0xb')]['session'];return new BPromise(function(_0x3b767a,_0x354109){_0x5657b6(_0x5d659b,_0x236e27,_0x56a5d1)[_0x95c9('0x33')](function(_0x542264){_0x3b767a(_0x542264);})['catch'](function(_0x333784){_0x354109(_0x333784);});});}function generateNonce(){return crypto[_0x95c9('0x78')](0x10)['toString'](_0x95c9('0x79'));}function generateIssuedAt(){return Math['floor'](Date[_0x95c9('0x7a')]()/0x3e8)[_0x95c9('0x7b')]();}function createJwt(_0x6940fc){var _0x4f73e8={'payload':{'iat':_0x6940fc[_0x95c9('0x63')],'nonce':_0x6940fc['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x6940fc['id'][_0x95c9('0x7b')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x95c9('0x45')]()}};return signJwt(_0x4f73e8)[_0x95c9('0x33')](function(_0x4547be){return{'iat':_0x6940fc[_0x95c9('0x63')],'nonce':_0x6940fc[_0x95c9('0x4b')],'token':_0x4547be};});} \ No newline at end of file +var _0xbce8=['mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','pass','Wrong\x20credentials.','Bearer','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','options','randomBytes','toString','hex','floor','now','../../config/environment','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause'];(function(_0x3dad31,_0x38832c){var _0x50f81c=function(_0x3ccf54){while(--_0x3ccf54){_0x3dad31['push'](_0x3dad31['shift']());}};_0x50f81c(++_0x38832c);}(_0xbce8,0x1ec));var _0x8bce=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xbce8[_0x37e845];return _0x59e55b;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x8bce('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x8bce('0x1'));var _=require(_0x8bce('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x8bce('0x3'));var compose=require(_0x8bce('0x4'));var basicAuth=require(_0x8bce('0x5'));var crypto=require(_0x8bce('0x6'));var BPromise=require(_0x8bce('0x7'));var util=require(_0x8bce('0x8'));var moment=require(_0x8bce('0x9'));var validateJwt=expressJwt({'secret':config[_0x8bce('0xa')][_0x8bce('0xb')]});var userAttributes=['id',_0x8bce('0xc'),_0x8bce('0xd'),'name',_0x8bce('0xe'),_0x8bce('0xf'),_0x8bce('0x10'),_0x8bce('0x11'),_0x8bce('0x12'),_0x8bce('0x13'),'chatPause',_0x8bce('0x14'),_0x8bce('0x15'),_0x8bce('0x16'),_0x8bce('0x17'),_0x8bce('0x18'),_0x8bce('0x19'),_0x8bce('0x1a'),_0x8bce('0x1b'),_0x8bce('0x1c'),_0x8bce('0x1d'),_0x8bce('0x1e'),_0x8bce('0x1f'),_0x8bce('0x20'),_0x8bce('0x21'),_0x8bce('0x22'),_0x8bce('0x23'),_0x8bce('0x24'),_0x8bce('0x25'),_0x8bce('0x26'),_0x8bce('0x27'),'phoneBarRemoteControl',_0x8bce('0x28'),'hotdesk',_0x8bce('0x29'),_0x8bce('0x2a'),_0x8bce('0x2b'),'settingsEnabled',_0x8bce('0x2c'),_0x8bce('0x2d'),_0x8bce('0x2e'),'downloadAttachments',_0x8bce('0x2f'),_0x8bce('0x30')];exports[_0x8bce('0x31')]=function(){return this[_0x8bce('0x32')](!![])[_0x8bce('0x33')](function(_0x2773fa,_0x542968,_0x3de5f5){if(_0x2773fa[_0x8bce('0x34')]){_0x3de5f5();}else{return db[_0x8bce('0x35')]['findOne']({'where':{'id':_0x2773fa[_0x8bce('0x36')]['id']},'attributes':['id',_0x8bce('0x37'),_0x8bce('0x38')],'raw':!![]})[_0x8bce('0x39')](function(_0x984fb1){if(_0x984fb1&&_0x984fb1[_0x8bce('0x37')]){return _0x542968[_0x8bce('0x3a')](_0x984fb1[_0x8bce('0x38')]===_0x8bce('0x3b')?0x195:0x193)[_0x8bce('0x3c')]({'message':_0x984fb1['disposition']===_0x8bce('0x3b')?_0x8bce('0x3d'):_0x8bce('0x3e')});}else{_0x3de5f5();}})[_0x8bce('0x3f')](function(_0x385369){_0x3de5f5(_0x385369);});}});};exports[_0x8bce('0x32')]=function isAuthenticated(_0x4d9070){return compose()[_0x8bce('0x33')](function(_0x3fdefb,_0x218602,_0x4c378c){var _0x20452e;if(_0x3fdefb[_0x8bce('0x40')][_0x8bce('0x41')]){if(_[_0x8bce('0x42')](_0x3fdefb[_0x8bce('0x40')]['authorization'],_0x8bce('0x43'))){var _0x57a556=basicAuth(_0x3fdefb);db[_0x8bce('0x44')][_0x8bce('0x45')]({'where':{'name':_0x57a556['name']}})[_0x8bce('0x39')](function(_0x93c52d){if(!_0x93c52d||!_0x93c52d['authenticate'](_0x57a556[_0x8bce('0x46')])){return _0x218602[_0x8bce('0x3a')](0x191)[_0x8bce('0x3c')]({'message':_0x8bce('0x47')});}_0x3fdefb[_0x8bce('0x34')]={'id':_0x93c52d['id']};_0x4c378c();})['catch'](function(_0x593420){_0x4c378c(_0x593420);});}else if(_[_0x8bce('0x42')](_0x3fdefb['headers'][_0x8bce('0x41')],_0x8bce('0x48'))){validateJwt(_0x3fdefb,_0x218602,_0x4c378c);}else{if(_0x4d9070){_0x4c378c();}else{return _0x218602[_0x8bce('0x3a')](0x193)[_0x8bce('0x3c')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3fdefb[_0x8bce('0x49')][_0x8bce('0x4a')]){try{var _0x516a13={'audience':hardwareConf[_0x8bce('0x4b')](),'issuer':hardwareConf[_0x8bce('0x4b')]()};verifyJwt(_0x3fdefb[_0x8bce('0x49')][_0x8bce('0x4a')],_0x516a13)['then'](function(_0x2f20e3){return db[_0x8bce('0x44')][_0x8bce('0x45')]({'where':{'id':_0x2f20e3[_0x8bce('0x4c')]}})[_0x8bce('0x39')](function(_0x3cf653){_0x20452e=_0x3cf653;return db[_0x8bce('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0x8bce('0x4e'),_0x8bce('0x4f')],'raw':!![]});})[_0x8bce('0x39')](function(_0x4af7a6){if(!_0x20452e||!_[_0x8bce('0x50')](_0x20452e[_0x8bce('0x51')],_0x2f20e3['nonce'])){return _0x218602[_0x8bce('0x3a')](0x191)['json']({'message':_0x8bce('0x52')});}if(_0x20452e[_0x8bce('0x53')]){return _0x218602['status'](0x191)[_0x8bce('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x20452e['blocked']){if(_0x4af7a6[_0x8bce('0x4f')]>0x0){if(moment(_0x20452e['blockedAt'])[_0x8bce('0x54')](_0x4af7a6['blockDuration'],_0x8bce('0x55'))>moment()){return _0x218602[_0x8bce('0x3a')](0x191)[_0x8bce('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x218602['status'](0x191)[_0x8bce('0x3c')]({'message':_0x8bce('0x56')});}}_0x3fdefb[_0x8bce('0x34')]={'id':_0x20452e['id']};_0x4c378c();});})[_0x8bce('0x3f')](function(){return _0x218602[_0x8bce('0x3a')](0x191)[_0x8bce('0x3c')]({'message':_0x8bce('0x56')});});}catch(_0x1bfd2e){_0x4c378c(_0x1bfd2e);}}else if(_0x4d9070){_0x4c378c();}else{return _0x218602[_0x8bce('0x3a')](0x193)[_0x8bce('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x42e05f,_0x5279a6,_0x27da19){if(_0x42e05f['user']){db[_0x8bce('0x44')][_0x8bce('0x45')]({'where':{'id':_0x42e05f[_0x8bce('0x34')]['id']},'attributes':userAttributes})[_0x8bce('0x39')](function(_0x4dc8a7){if(!_0x4dc8a7){return _0x5279a6['status'](0x194)[_0x8bce('0x3c')]({'message':_0x8bce('0x57')});}_0x42e05f[_0x8bce('0x34')]=_0x4dc8a7;_0x27da19();})[_0x8bce('0x3f')](function(_0x5eb6ca){_0x27da19(_0x5eb6ca);});}else if(_0x4d9070){_0x27da19();}else{return _0x5279a6['status'](0x194)[_0x8bce('0x3c')]({'message':_0x8bce('0x58')});}});};exports[_0x8bce('0x59')]=function canUpdate(){return compose()[_0x8bce('0x33')](function(_0x3396ff,_0x2eace7,_0x548d75){return licenseUtil[_0x8bce('0x5a')]()['then'](function(_0x783019){if(_0x783019[_0x8bce('0x5b')]){_0x548d75();}else{return _0x2eace7[_0x8bce('0x3a')](0x193)[_0x8bce('0x3c')]({'message':_0x8bce('0x5c')});}})[_0x8bce('0x3f')](function(_0x58d930){_0x548d75(_0x58d930);});});};exports[_0x8bce('0x5d')]=function isWebrtcLicence(){return compose()['use'](function(_0x369119,_0xc68a37,_0x2c75a1){return licenseUtil[_0x8bce('0x5a')]()['then'](function(_0x4119e1){if(_0x4119e1['webrtc']){_0x2c75a1();}else{return _0xc68a37[_0x8bce('0x3a')](0x193)[_0x8bce('0x3c')]({'message':_0x8bce('0x5c')});}})[_0x8bce('0x3f')](function(_0x29faad){_0x2c75a1(_0x29faad);});});};exports[_0x8bce('0x5e')]=function(_0x27426a,_0x132548,_0x5dec90){_0x27426a['isMiddleware']=!![];return _0x5dec90();};exports['signToken']=function signToken(_0x3c1e2d){return signJwt(_0x3c1e2d);};exports['setTokenCookie']=function(_0x240d9b,_0x18c280){if(!_0x240d9b[_0x8bce('0x34')]){return _0x18c280[_0x8bce('0x3a')](0x194)[_0x8bce('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3663a2={'payload':{'id':_0x240d9b[_0x8bce('0x34')]['id'],'role':_0x240d9b[_0x8bce('0x34')][_0x8bce('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3663a2)[_0x8bce('0x39')](function(_0x10eed8){_0x18c280['cookie'](_0x8bce('0x5f'),_0x10eed8);_0x18c280[_0x8bce('0x60')](_0x8bce('0x61'));})[_0x8bce('0x3f')](function(_0x429c9d){return _0x18c280[_0x8bce('0x3a')](0x1f4)['send'](_0x429c9d);});};exports[_0x8bce('0x62')]=function(_0x3e9ff6){if(_['isNil'](_0x3e9ff6[_0x8bce('0x51')])||_[_0x8bce('0x63')](_0x3e9ff6['apiKeyIat'])){return null;}else{return createJwt(_0x3e9ff6);}};exports[_0x8bce('0x64')]=function(_0x351f95){_0x351f95[_0x8bce('0x51')]=generateNonce();_0x351f95[_0x8bce('0x65')]=generateIssuedAt();return createJwt(_0x351f95);};exports['regenerateApiKey']=function(_0x286087,_0x1843ee){var _0x232e30=_0x286087[_0x8bce('0x49')][_0x8bce('0x4a')];if(_0x232e30){var _0x4a36de={'nonce':_0x1843ee['apiKeyNonce'],'iat':_0x1843ee[_0x8bce('0x65')],'audience':hardwareConf[_0x8bce('0x4b')](),'issuer':hardwareConf[_0x8bce('0x4b')]()};return verifyJwt(_0x232e30,_0x4a36de)[_0x8bce('0x39')](function(){return generateApiKey(_0x1843ee);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x8bce('0x66')]=function(_0x590e32){var _0x4e386d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4e386d[_0x8bce('0x67')](_0x590e32))throw new db[(_0x8bce('0x68'))][(_0x8bce('0x69'))](_0x8bce('0x6a'));return;};exports[_0x8bce('0x6b')]=function(_0x193979,_0x104603,_0x25bfdb){var _0x35a783=encryptor[_0x8bce('0x6c')](_0x104603)[_0x8bce('0x6d')](',');for(var _0x13f4be=0x0;_0x13f4be<_0x25bfdb;_0x13f4be++){if(!_0x35a783[_0x13f4be])break;if(_0x193979[_0x8bce('0x6e')]()===_0x35a783[_0x13f4be][_0x8bce('0x6e')]()){var _0x3539a4=util[_0x8bce('0x6f')](_0x8bce('0x70'),_0x25bfdb);if(_0x25bfdb===0x1){_0x3539a4=_0x8bce('0x71');}throw new db['Sequelize']['ValidationError'](_0x3539a4);}}return;};exports[_0x8bce('0x72')]=function(_0x18f087,_0x242074){var _0x471835=_0x242074?encryptor[_0x8bce('0x6c')](_0x242074)['split'](','):[];if(_0x471835[_0x8bce('0x73')]===0x5){_0x471835[_0x8bce('0x74')](-0x1,0x1);}_0x471835[_0x8bce('0x75')](_0x18f087);return encryptor[_0x8bce('0x76')](_0x471835[_0x8bce('0x77')](','));};function signJwt(_0x304836){var _0x4f25d3=BPromise[_0x8bce('0x78')](jwt[_0x8bce('0x79')],{'context':jwt});var _0x35498f=_0x304836['secret']||config[_0x8bce('0xa')]['session'];return new BPromise(function(_0x2c2085,_0x1eba73){_0x4f25d3(_0x304836['payload'],_0x35498f,_0x304836[_0x8bce('0x7a')])[_0x8bce('0x39')](function(_0x42d4fd){_0x2c2085(_0x42d4fd);})['catch'](function(_0x291bbe){_0x1eba73(_0x291bbe);});});}function verifyJwt(_0x63bf8f,_0x3ba1c5,_0x4c560e){var _0x11a994=BPromise[_0x8bce('0x78')](jwt['verify'],{'context':jwt});var _0x70e455=_0x4c560e||config[_0x8bce('0xa')][_0x8bce('0xb')];return new BPromise(function(_0x21884f,_0x4eefd6){_0x11a994(_0x63bf8f,_0x70e455,_0x3ba1c5)[_0x8bce('0x39')](function(_0x5a8a11){_0x21884f(_0x5a8a11);})['catch'](function(_0x305fe3){_0x4eefd6(_0x305fe3);});});}function generateNonce(){return crypto[_0x8bce('0x7b')](0x10)[_0x8bce('0x7c')](_0x8bce('0x7d'));}function generateIssuedAt(){return Math[_0x8bce('0x7e')](Date[_0x8bce('0x7f')]()/0x3e8)[_0x8bce('0x7c')]();}function createJwt(_0x99a1){var _0x4586eb={'payload':{'iat':_0x99a1[_0x8bce('0x65')],'nonce':_0x99a1[_0x8bce('0x51')]},'options':{'algorithm':'HS512','subject':_0x99a1['id']['toString'](),'issuer':hardwareConf[_0x8bce('0x4b')](),'audience':hardwareConf[_0x8bce('0x4b')]()}};return signJwt(_0x4586eb)['then'](function(_0x426341){return{'iat':_0x99a1[_0x8bce('0x65')],'nonce':_0x99a1['apiKeyNonce'],'token':_0x426341};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ddb2137..ca0bf60 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 _0x2752=['encryptFile','createReadStream','createWriteStream','createCipher','update','write','final','binary','unlink','end','close','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','../../config/environment','../../config/logger','app','secrets','aes192','encrypt','algorithm','join','error','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x2c34cf,_0x43aacc){var _0x44969e=function(_0x59cb35){while(--_0x59cb35){_0x2c34cf['push'](_0x2c34cf['shift']());}};_0x44969e(++_0x43aacc);}(_0x2752,0x6e));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x2275('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x2275('0x1'));var logger=require(_0x2275('0x2'))(_0x2275('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2275('0x4')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x2275('0x5')};if(config['encrypt']&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x2275('0x6')][_0x2275('0x7')]);if(isSupported){fileOptions[_0x2275('0x7')]=config[_0x2275('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2275('0x8')](',\x20');logger[_0x2275('0x9')](config[_0x2275('0x6')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x12974f){return AES_SUPPORTED_RX['test'](_0x12974f);}function getSupportedCiphers(){return crypto[_0x2275('0xa')]()[_0x2275('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x5e41b0){return getSupportedCiphers()[_0x2275('0xc')](_0x5e41b0)>-0x1;}function combineOptions(_0x2d3f86){var _0xed7a20={};for(var _0x455664 in fileOptions){if(fileOptions[_0x2275('0xd')](_0x455664)){_0xed7a20[_0x455664]=fileOptions[_0x455664];}}if(_0x2d3f86){for(var _0x543c77 in _0x2d3f86){if(_0x2d3f86[_0x2275('0xd')](_0x543c77)){_0xed7a20[_0x543c77]=_0x2d3f86[_0x543c77];}}}return _0xed7a20;}exports[_0x2275('0xe')]=function(_0xe73acc,_0x4f3547,_0x46a8cf,_0x2cf4b9){return new BPromise(function(_0x4201fd,_0x4fcd08){_0x2cf4b9=combineOptions(_0x2cf4b9);var _0x5cf7e5=new Buffer(_0x46a8cf);var _0x1b42ab=fs[_0x2275('0xf')](_0xe73acc);var _0x4344af=fs[_0x2275('0x10')](_0x4f3547);var _0x3ae5f4=crypto[_0x2275('0x11')](_0x2cf4b9[_0x2275('0x7')],_0x5cf7e5);_0x1b42ab['on']('data',function(_0x650d9c){var _0x52734a=new Buffer(_0x3ae5f4[_0x2275('0x12')](_0x650d9c),'binary');_0x4344af[_0x2275('0x13')](_0x52734a);});_0x1b42ab['on']('end',function(){try{var _0x1e891e=new Buffer(_0x3ae5f4[_0x2275('0x14')](_0x2275('0x15')),_0x2275('0x15'));_0x4344af[_0x2275('0x13')](_0x1e891e);_0x4344af['end']();_0x4344af['on']('close',function(){return _0x4201fd(_0x4f3547);});}catch(_0x27bdfc){fs[_0x2275('0x16')](_0x4f3547);return _0x4fcd08(_0x27bdfc);}});});};exports['decryptFile']=function(_0x14fb23,_0x1c1d33,_0x4121ef,_0x11fb6b){return new BPromise(function(_0x4be9cd,_0x40d640){_0x11fb6b=combineOptions(_0x11fb6b);var _0x207c6c=new Buffer(_0x4121ef);var _0xe4ef13=fs['createReadStream'](_0x14fb23);var _0x3adac1=fs['createWriteStream'](_0x1c1d33);var _0x5694dd=crypto['createDecipher'](_0x11fb6b[_0x2275('0x7')],_0x207c6c);_0xe4ef13['on']('data',function(_0x297a77){var _0x153c10=new Buffer(_0x5694dd[_0x2275('0x12')](_0x297a77),_0x2275('0x15'));_0x3adac1[_0x2275('0x13')](_0x153c10);});_0xe4ef13['on']('end',function(){try{var _0x438596=new Buffer(_0x5694dd[_0x2275('0x14')](_0x2275('0x15')),_0x2275('0x15'));_0x3adac1['write'](_0x438596);_0x3adac1[_0x2275('0x17')]();_0x3adac1['on'](_0x2275('0x18'),function(){return _0x4be9cd(_0x1c1d33);});}catch(_0x11e779){fs['unlink'](_0x1c1d33);return _0x40d640(_0x11e779);}});});};exports[_0x2275('0x19')]=function(_0x3a24c5,_0x3d9014,_0x159837){var _0x590a6e=_0x159837||stringOptions['algorithm'];var _0x37c78c=_0x3d9014||stringOptions[_0x2275('0x1a')];var _0x306a19=crypto[_0x2275('0x11')](_0x590a6e,_0x37c78c);var _0x56ebb7=_0x306a19[_0x2275('0x12')](_0x3a24c5,_0x2275('0x1b'),_0x2275('0x1c'));_0x56ebb7+=_0x306a19[_0x2275('0x14')](_0x2275('0x1c'));return _0x56ebb7;};exports[_0x2275('0x1d')]=function(_0x32101b,_0x4d0927,_0x42b533){var _0x246f2c=_0x42b533||stringOptions[_0x2275('0x7')];var _0xb31ad3=_0x4d0927||stringOptions['secret'];var _0xa097b6=crypto[_0x2275('0x1e')](_0x246f2c,_0xb31ad3);var _0x816593=_0xa097b6[_0x2275('0x12')](_0x32101b,_0x2275('0x1c'),_0x2275('0x1b'));_0x816593+=_0xa097b6[_0x2275('0x14')]('utf8');return _0x816593;}; \ No newline at end of file +var _0xd77b=['secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','update','binary','write','end','final','unlink','createReadStream','createWriteStream','createDecipher','data','close','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','app'];(function(_0x4abe24,_0x4009b2){var _0x4f08a7=function(_0x11ad84){while(--_0x11ad84){_0x4abe24['push'](_0x4abe24['shift']());}};_0x4f08a7(++_0x4009b2);}(_0xd77b,0x1a0));var _0xbd77=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xd77b[_0x4a747d];return _0x3a5b5c;};'use strict';var crypto=require(_0xbd77('0x0'));var fs=require('fs');var BPromise=require(_0xbd77('0x1'));var _=require('lodash');var config=require(_0xbd77('0x2'));var logger=require('../../config/logger')(_0xbd77('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbd77('0x4')][_0xbd77('0x5')],'algorithm':_0xbd77('0x6')};const fileOptions={'algorithm':_0xbd77('0x7')};if(config['encrypt']&&config[_0xbd77('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xbd77('0x8')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0xbd77('0x8')][_0xbd77('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbd77('0xa')](',\x20');logger[_0xbd77('0xb')](config[_0xbd77('0x8')][_0xbd77('0x9')],_0xbd77('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x3da5ca){return AES_SUPPORTED_RX['test'](_0x3da5ca);}function getSupportedCiphers(){return crypto[_0xbd77('0xd')]()[_0xbd77('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x48e99c){return getSupportedCiphers()[_0xbd77('0xf')](_0x48e99c)>-0x1;}function combineOptions(_0x175c4d){var _0x4a65cb={};for(var _0x5de78d in fileOptions){if(fileOptions[_0xbd77('0x10')](_0x5de78d)){_0x4a65cb[_0x5de78d]=fileOptions[_0x5de78d];}}if(_0x175c4d){for(var _0x310b9b in _0x175c4d){if(_0x175c4d[_0xbd77('0x10')](_0x310b9b)){_0x4a65cb[_0x310b9b]=_0x175c4d[_0x310b9b];}}}return _0x4a65cb;}exports[_0xbd77('0x11')]=function(_0x353497,_0x4bc410,_0x3bcd1b,_0x52f3d6){return new BPromise(function(_0x4ab1ea,_0x51fefe){_0x52f3d6=combineOptions(_0x52f3d6);var _0x327d45=new Buffer(_0x3bcd1b);var _0x1a4898=fs['createReadStream'](_0x353497);var _0x32d1d7=fs['createWriteStream'](_0x4bc410);var _0x44efef=crypto[_0xbd77('0x12')](_0x52f3d6[_0xbd77('0x9')],_0x327d45);_0x1a4898['on']('data',function(_0x38d975){var _0x4e688c=new Buffer(_0x44efef[_0xbd77('0x13')](_0x38d975),_0xbd77('0x14'));_0x32d1d7[_0xbd77('0x15')](_0x4e688c);});_0x1a4898['on'](_0xbd77('0x16'),function(){try{var _0x1adcf9=new Buffer(_0x44efef[_0xbd77('0x17')]('binary'),_0xbd77('0x14'));_0x32d1d7[_0xbd77('0x15')](_0x1adcf9);_0x32d1d7[_0xbd77('0x16')]();_0x32d1d7['on']('close',function(){return _0x4ab1ea(_0x4bc410);});}catch(_0x5140f6){fs[_0xbd77('0x18')](_0x4bc410);return _0x51fefe(_0x5140f6);}});});};exports['decryptFile']=function(_0x7d257c,_0x1ac842,_0x492711,_0x47f910){return new BPromise(function(_0x59706a,_0x2f67bf){_0x47f910=combineOptions(_0x47f910);var _0x398f43=new Buffer(_0x492711);var _0x313ba9=fs[_0xbd77('0x19')](_0x7d257c);var _0x2c02bb=fs[_0xbd77('0x1a')](_0x1ac842);var _0x4c9e6e=crypto[_0xbd77('0x1b')](_0x47f910['algorithm'],_0x398f43);_0x313ba9['on'](_0xbd77('0x1c'),function(_0x396242){var _0x42a3ba=new Buffer(_0x4c9e6e[_0xbd77('0x13')](_0x396242),_0xbd77('0x14'));_0x2c02bb['write'](_0x42a3ba);});_0x313ba9['on']('end',function(){try{var _0x20a098=new Buffer(_0x4c9e6e['final'](_0xbd77('0x14')),_0xbd77('0x14'));_0x2c02bb['write'](_0x20a098);_0x2c02bb['end']();_0x2c02bb['on'](_0xbd77('0x1d'),function(){return _0x59706a(_0x1ac842);});}catch(_0x5dc262){fs[_0xbd77('0x18')](_0x1ac842);return _0x2f67bf(_0x5dc262);}});});};exports[_0xbd77('0x1e')]=function(_0x557c50,_0x27a05f,_0x4f8312){var _0x35cef7=_0x4f8312||stringOptions[_0xbd77('0x9')];var _0x10ab67=_0x27a05f||stringOptions[_0xbd77('0x1f')];var _0x351cfe=crypto['createCipher'](_0x35cef7,_0x10ab67);var _0x3628a7=_0x351cfe[_0xbd77('0x13')](_0x557c50,_0xbd77('0x20'),_0xbd77('0x21'));_0x3628a7+=_0x351cfe['final'](_0xbd77('0x21'));return _0x3628a7;};exports[_0xbd77('0x22')]=function(_0x50d535,_0x184ba1,_0x45652e){var _0x41b33d=_0x45652e||stringOptions[_0xbd77('0x9')];var _0x30f72d=_0x184ba1||stringOptions[_0xbd77('0x1f')];var _0x1ece97=crypto[_0xbd77('0x1b')](_0x41b33d,_0x30f72d);var _0x1f1ae9=_0x1ece97[_0xbd77('0x13')](_0x50d535,'base64','utf8');_0x1f1ae9+=_0x1ece97['final'](_0xbd77('0x20'));return _0x1f1ae9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5229af2..85585c3 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 _0x0742=['SELECT','dirname','basename','.csv','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3ebfa0,_0x4b3209){var _0x28908f=function(_0x4d9002){while(--_0x4d9002){_0x3ebfa0['push'](_0x3ebfa0['shift']());}};_0x28908f(++_0x4b3209);}(_0x0742,0x190));var _0x2074=function(_0x581f8e,_0x5617cb){_0x581f8e=_0x581f8e-0x0;var _0x18aec=_0x0742[_0x581f8e];return _0x18aec;};'use strict';var util=require(_0x2074('0x0'));var path=require(_0x2074('0x1'));var _=require('lodash');var csv=require(_0x2074('0x2'));var fs=require('fs');var BPromise=require(_0x2074('0x3'));var zipdir=require(_0x2074('0x4'));var rimraf=require(_0x2074('0x5'));var db=require(_0x2074('0x6'))['db'];var dbH=require(_0x2074('0x6'))[_0x2074('0x7')];var logger=require('../../config/logger')(_0x2074('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x2074('0x9')][0x2]);var QUERY=process[_0x2074('0x9')][0x3];var PATH=process[_0x2074('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x230a6c,_0x2e5197){var _0x1ded0f={'status':_0x230a6c};var _0x56180e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e5197){_0x1ded0f['savename']=_0x2e5197;}return db[_0x2074('0xa')]['update'](_0x1ded0f,_0x56180e);}function main(){var _0x3f41e2=0x1388;var _0x23a31d;logger[_0x2074('0xb')](util['format'](_0x2074('0xc'),EXTRACTED_REPORT_ID,_0x2074('0xd')));return db[_0x2074('0xe')][_0x2074('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2074('0x10'),'splitSizeCsv']})[_0x2074('0x11')](function(_0x3eb249){if(_0x3eb249){_0x23a31d=_0x3eb249;_0x3f41e2=_0x23a31d[_0x2074('0x12')]||0x1388;}})[_0x2074('0x11')](function(){return dbH[_0x2074('0x13')][_0x2074('0x14')](util['format'](_0x2074('0x15'),QUERY),{'type':dbH[_0x2074('0x13')][_0x2074('0x16')]['SELECT']});})[_0x2074('0x11')](function(_0x1e31e1){if(!_0x1e31e1[0x0][_0x2074('0x17')]){return analyticExtractedReport(_0x2074('0x18'));}var _0x1becdd=[];var _0x45b908=0x0;if(_0x23a31d[_0x2074('0x10')]){if(_0x1e31e1&&_0x1e31e1[_0x2074('0x19')]){var _0x2c788d=_[_0x2074('0x1a')](_0x1e31e1[0x0][_0x2074('0x17')]/_0x3f41e2);var _0x19d3ca=Number[_0x2074('0x1b')](_0x1e31e1[0x0][_0x2074('0x17')]/_0x3f41e2)?_0x1e31e1[0x0][_0x2074('0x17')]%_0x3f41e2:0x0;_0x2c788d[_0x2074('0x1c')](function(_0x163c44){if(_0x163c44>0x0){_0x45b908+=_0x3f41e2;}_0x1becdd[_0x2074('0x1d')](dbH[_0x2074('0x13')]['query'](util[_0x2074('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f41e2,_0x45b908),{'type':dbH[_0x2074('0x13')]['QueryTypes']['SELECT']}));});if(_0x19d3ca>0x0){_0x45b908+=_0x3f41e2;_0x1becdd[_0x2074('0x1d')](dbH['sequelize'][_0x2074('0x14')](util['format'](_0x2074('0x1f'),QUERY,_0x19d3ca,_0x45b908),{'type':dbH[_0x2074('0x13')][_0x2074('0x16')][_0x2074('0x20')]}));}}}else{_0x1becdd['push'](dbH['sequelize'][_0x2074('0x14')](QUERY,{'type':dbH[_0x2074('0x13')][_0x2074('0x16')][_0x2074('0x20')]}));}var _0x10e369=path[_0x2074('0x21')](PATH);var _0x3a8c69=path[_0x2074('0x22')](PATH,_0x2074('0x23'));var _0x342393=_0x23a31d[_0x2074('0x10')]&&_0x1becdd[_0x2074('0x19')]>0x1;var _0x3d9931=[];if(!fs['existsSync'](path[_0x2074('0x24')](_0x10e369,_0x3a8c69))&&_0x342393){fs[_0x2074('0x25')](path[_0x2074('0x24')](_0x10e369,_0x3a8c69));}return BPromise[_0x2074('0x26')](_0x1becdd,function(_0x435011){_0x3d9931[_0x2074('0x1d')](_0x435011);})[_0x2074('0x11')](function(){for(var _0x1ea100=0x0;_0x1ea100<_0x3d9931['length'];_0x1ea100+=0x1){var _0x2d3222;var _0x357338=_0x3d9931[_0x1ea100];if(_0x342393){_0x2d3222=path[_0x2074('0x24')](_0x10e369,_0x3a8c69,util[_0x2074('0x1e')]('%s%d.%s',_0x3a8c69,_0x1ea100,_0x2074('0x27')));}else{_0x2d3222=path[_0x2074('0x24')](_0x10e369,util[_0x2074('0x1e')](_0x2074('0x28'),_0x3a8c69,_0x2074('0x27')));}fs[_0x2074('0x29')](_0x2d3222,csv(_0x357338));}})[_0x2074('0x11')](function(){if(_0x342393){return new Promise(function(_0x2cb920){zipdir(path[_0x2074('0x24')](_0x10e369,_0x3a8c69),{'saveTo':path[_0x2074('0x24')](_0x10e369,util[_0x2074('0x1e')](_0x2074('0x28'),_0x3a8c69,'zip'))},function(_0x196d62,_0x489572){rimraf(path[_0x2074('0x24')](_0x10e369,_0x3a8c69),function(){});_0x2cb920(_0x2074('0x2a'));});});}})[_0x2074('0x11')](function(){logger['info'](util[_0x2074('0x1e')](_0x2074('0x2b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x342393?util[_0x2074('0x1e')]('%s.%s',_0x3a8c69,_0x342393?'zip':_0x2074('0x27')):null);});})[_0x2074('0x2c')](function(_0x57ab43){logger[_0x2074('0xb')](util[_0x2074('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2074('0xd')),util[_0x2074('0x2d')](_0x57ab43,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2074('0x2e'));})['finally'](function(){process[_0x2074('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x02a8=['mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','to-csv','rimraf','../../mysqldb','dbH','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','length','join'];(function(_0x4d423c,_0x1b4864){var _0x383c6a=function(_0x68fdbe){while(--_0x68fdbe){_0x4d423c['push'](_0x4d423c['shift']());}};_0x383c6a(++_0x1b4864);}(_0x02a8,0x123));var _0x802a=function(_0x2933e3,_0x45df79){_0x2933e3=_0x2933e3-0x0;var _0x413caa=_0x02a8[_0x2933e3];return _0x413caa;};'use strict';var util=require('util');var path=require(_0x802a('0x0'));var _=require(_0x802a('0x1'));var csv=require(_0x802a('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x802a('0x3'));var db=require(_0x802a('0x4'))['db'];var dbH=require(_0x802a('0x4'))[_0x802a('0x5')];var logger=require('../../config/logger')(_0x802a('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x802a('0x7')][0x2]);var QUERY=process[_0x802a('0x7')][0x3];var PATH=process[_0x802a('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x181d46,_0x37453f){var _0x3e992b={'status':_0x181d46};var _0x1a3fa6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x37453f){_0x3e992b['savename']=_0x37453f;}return db['AnalyticExtractedReport'][_0x802a('0x8')](_0x3e992b,_0x1a3fa6);}function main(){var _0x11d234=0x1388;var _0x2b255e;logger[_0x802a('0x9')](util[_0x802a('0xa')](_0x802a('0xb'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x802a('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x802a('0xd')]})[_0x802a('0xe')](function(_0x1e3ff8){if(_0x1e3ff8){_0x2b255e=_0x1e3ff8;_0x11d234=_0x2b255e[_0x802a('0xd')]||0x1388;}})['then'](function(){return dbH[_0x802a('0xf')][_0x802a('0x10')](util[_0x802a('0xa')](_0x802a('0x11'),QUERY),{'type':dbH['sequelize'][_0x802a('0x12')][_0x802a('0x13')]});})[_0x802a('0xe')](function(_0xc7da6a){if(!_0xc7da6a[0x0][_0x802a('0x14')]){return analyticExtractedReport(_0x802a('0x15'));}var _0x3e9be6=[];var _0x1bcd64=0x0;if(_0x2b255e[_0x802a('0x16')]){if(_0xc7da6a&&_0xc7da6a['length']){var _0x1bbfdd=_[_0x802a('0x17')](_0xc7da6a[0x0][_0x802a('0x14')]/_0x11d234);var _0x19dc75=Number[_0x802a('0x18')](_0xc7da6a[0x0][_0x802a('0x14')]/_0x11d234)?_0xc7da6a[0x0][_0x802a('0x14')]%_0x11d234:0x0;_0x1bbfdd['forEach'](function(_0x57c25b){if(_0x57c25b>0x0){_0x1bcd64+=_0x11d234;}_0x3e9be6[_0x802a('0x19')](dbH['sequelize'][_0x802a('0x10')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x11d234,_0x1bcd64),{'type':dbH[_0x802a('0xf')][_0x802a('0x12')][_0x802a('0x13')]}));});if(_0x19dc75>0x0){_0x1bcd64+=_0x11d234;_0x3e9be6['push'](dbH[_0x802a('0xf')][_0x802a('0x10')](util[_0x802a('0xa')](_0x802a('0x1a'),QUERY,_0x19dc75,_0x1bcd64),{'type':dbH['sequelize']['QueryTypes'][_0x802a('0x13')]}));}}}else{_0x3e9be6['push'](dbH[_0x802a('0xf')][_0x802a('0x10')](QUERY,{'type':dbH[_0x802a('0xf')][_0x802a('0x12')][_0x802a('0x13')]}));}var _0x2799a4=path[_0x802a('0x1b')](PATH);var _0x5b2ad3=path['basename'](PATH,_0x802a('0x1c'));var _0x41d710=_0x2b255e[_0x802a('0x16')]&&_0x3e9be6[_0x802a('0x1d')]>0x1;var _0x15b107=[];if(!fs['existsSync'](path[_0x802a('0x1e')](_0x2799a4,_0x5b2ad3))&&_0x41d710){fs[_0x802a('0x1f')](path[_0x802a('0x1e')](_0x2799a4,_0x5b2ad3));}return BPromise[_0x802a('0x20')](_0x3e9be6,function(_0x400858){_0x15b107[_0x802a('0x19')](_0x400858);})[_0x802a('0xe')](function(){for(var _0x177278=0x0;_0x177278<_0x15b107[_0x802a('0x1d')];_0x177278+=0x1){var _0xbaf8a9;var _0x5d94e6=_0x15b107[_0x177278];if(_0x41d710){_0xbaf8a9=path[_0x802a('0x1e')](_0x2799a4,_0x5b2ad3,util[_0x802a('0xa')](_0x802a('0x21'),_0x5b2ad3,_0x177278,_0x802a('0x22')));}else{_0xbaf8a9=path[_0x802a('0x1e')](_0x2799a4,util[_0x802a('0xa')](_0x802a('0x23'),_0x5b2ad3,'csv'));}fs[_0x802a('0x24')](_0xbaf8a9,csv(_0x5d94e6));}})['then'](function(){if(_0x41d710){return new Promise(function(_0x4b6c3b){zipdir(path[_0x802a('0x1e')](_0x2799a4,_0x5b2ad3),{'saveTo':path[_0x802a('0x1e')](_0x2799a4,util[_0x802a('0xa')](_0x802a('0x23'),_0x5b2ad3,'zip'))},function(_0x3bd9b7,_0xac5c5c){rimraf(path['join'](_0x2799a4,_0x5b2ad3),function(){});_0x4b6c3b(_0x802a('0x25'));});});}})[_0x802a('0xe')](function(){logger[_0x802a('0x9')](util[_0x802a('0xa')](_0x802a('0x26'),EXTRACTED_REPORT_ID,_0x802a('0x27')));return analyticExtractedReport('Completed',_0x41d710?util[_0x802a('0xa')](_0x802a('0x23'),_0x5b2ad3,_0x41d710?_0x802a('0x28'):_0x802a('0x22')):null);});})[_0x802a('0x29')](function(_0x6af914){logger[_0x802a('0x9')](util[_0x802a('0xa')](_0x802a('0x2a'),EXTRACTED_REPORT_ID,_0x802a('0x27')),util[_0x802a('0x2b')](_0x6af914,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x802a('0x2c')](function(){process[_0x802a('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6905ae7..9e6fe00 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 _0x1451=['Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','length','auto','body','push','concat','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','center'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x1451,0xbd));var _0x1145=function(_0x576422,_0x1ff4d2){_0x576422=_0x576422-0x0;var _0x33f6f5=_0x1451[_0x576422];return _0x33f6f5;};'use strict';var _=require(_0x1145('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x1145('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x1145('0x2'));var zipdir=require(_0x1145('0x3'));var rimraf=require(_0x1145('0x4'));var JSDOM=require(_0x1145('0x5'))[_0x1145('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x1145('0x7'));var db=require(_0x1145('0x8'))['db'];var dbH=require(_0x1145('0x8'))['dbH'];var logger=require(_0x1145('0x9'))(_0x1145('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x1145('0xb')][0x2]);var QUERY=process[_0x1145('0xb')][0x3];var PATH=process[_0x1145('0xb')][0x4];var NAME=process[_0x1145('0xb')][0x5];var FORMAT=_0x1145('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4e8139,_0x3b6d6a){var _0x1e843c={'status':_0x4e8139};var _0x45761a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b6d6a){_0x1e843c[_0x1145('0xd')]=_0x3b6d6a;}return db[_0x1145('0xe')][_0x1145('0xf')](_0x1e843c,_0x45761a);}function getHeaders(_0x1533ea){return _['map'](_0x1533ea,function(_0x3c8348){return{'text':_0x3c8348,'style':_0x1145('0x10')};});}function getRows(_0x5e76fe,_0x859af5){return _[_0x1145('0x11')](_0x859af5,function(_0x23af5f){return _(_0x23af5f)[_0x1145('0x12')](_0x5e76fe)[_0x1145('0x11')](function(_0x346eb6){return _0x346eb6?_[_0x1145('0x13')](_0x346eb6):'';})[_0x1145('0x14')]();});}function createTable(_0x5a7d51,_0x380fdc){var _0x5ae6d3={'widths':_['fill'](Array(_0x5a7d51[_0x1145('0x15')]),0x91),'heights':function(_0x290371){return _0x290371===0x0?_0x1145('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xe2820b=getHeaders(_0x5a7d51);_0x5ae6d3[_0x1145('0x17')][_0x1145('0x18')](_0xe2820b);var _0x1e9b63=getRows(_0x5a7d51,_0x380fdc);_0x5ae6d3['body']=_0x5ae6d3[_0x1145('0x17')][_0x1145('0x19')](_0x1e9b63);return _0x5ae6d3;}function createTables(_0xf01742){var _0x4c964f=[];var _0x1f3aab=_['chunk'](Object['keys'](_0xf01742[0x0]),0x5);_0x1f3aab[_0x1145('0x1a')](function(_0x426317){_0x4c964f[_0x1145('0x18')](createTable(_0x426317,_0xf01742));});return _0x4c964f;}function getPDFDocDefinition(_0x314836){var _0x17b53b=util['format'](_0x1145('0x1b'),NAME,EXTRACTED_REPORT[_0x1145('0x1c')],moment(EXTRACTED_REPORT[_0x1145('0x1d')])[_0x1145('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x1145('0x1f')])[_0x1145('0x1e')](FORMAT));var _0x4c23cf=[];for(var _0x209b2c=0x0;_0x209b2c<_0x314836[_0x1145('0x15')];_0x209b2c++){var _0x567474=[];if(_0x209b2c===0x0){_0x567474[_0x1145('0x18')]({'text':_0x17b53b,'style':_0x1145('0x20')});}var _0x48a795={'table':_0x314836[_0x209b2c]};if(_0x209b2c>0x0){_0x48a795['pageBreak']=_0x1145('0x21');_0x48a795[_0x1145('0x22')]=[0x0,0x46,0x0,0x0];}_0x567474[_0x1145('0x18')](_0x48a795);_0x4c23cf[_0x1145('0x18')](_0x567474);}return{'pageSize':'A4','pageOrientation':_0x1145('0x23'),'content':_0x4c23cf,'footer':function(_0x4050be,_0x34ca1f){return{'text':_0x4050be['toString']()+_0x1145('0x24')+_0x34ca1f,'style':_0x1145('0x25')};},'defaultStyle':{'font':_0x1145('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1145('0x27')},'footer':{'alignment':_0x1145('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xbc9065){var _0x22785f=0x1388;var _0x207a19;if(!_0xbc9065[0x0][_0x1145('0x29')]){return analyticExtractedReport(_0x1145('0x2a'));}return db[_0x1145('0x2b')][_0x1145('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1145('0x2d')]})[_0x1145('0x2e')](function(_0x3ef258){if(_0x3ef258){_0x207a19=_0x3ef258;_0x22785f=_0x207a19[_0x1145('0x2d')]||0x3e8;}})[_0x1145('0x2e')](function(){var _0x33e8b6=[];var _0x429219=0x0;if(_0x207a19[_0x1145('0x2f')]){if(_0xbc9065&&_0xbc9065[_0x1145('0x15')]){var _0x486947=_[_0x1145('0x30')](_0xbc9065[0x0]['num']/_0x22785f);var _0x16e962=Number['isInteger'](_0xbc9065[0x0][_0x1145('0x29')]/_0x22785f)?_0xbc9065[0x0]['num']%_0x22785f:0x0;_0x486947[_0x1145('0x1a')](function(_0x3f2976){if(_0x3f2976>0x0){_0x429219+=_0x22785f;}_0x33e8b6[_0x1145('0x18')](dbH[_0x1145('0x31')]['query'](util[_0x1145('0x1e')](_0x1145('0x32'),QUERY,_0x22785f,_0x429219),{'type':dbH[_0x1145('0x31')][_0x1145('0x33')][_0x1145('0x34')]}));});if(_0x16e962>0x0){_0x429219+=_0x22785f;_0x33e8b6[_0x1145('0x18')](dbH['sequelize'][_0x1145('0x35')](util[_0x1145('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x16e962,_0x429219),{'type':dbH[_0x1145('0x31')][_0x1145('0x33')][_0x1145('0x34')]}));}}}else{_0x33e8b6[_0x1145('0x18')](dbH['sequelize'][_0x1145('0x35')](QUERY,{'type':dbH['sequelize'][_0x1145('0x33')][_0x1145('0x34')]}));}var _0x4ef9ca=path[_0x1145('0x36')](PATH);var _0x207cd2=path[_0x1145('0x37')](PATH,_0x1145('0x38'));var _0x34e579=_0x207a19['split']&&_0x33e8b6[_0x1145('0x15')]>0x1;var _0x2e392f=[];if(!fs[_0x1145('0x39')](path['join'](_0x4ef9ca,_0x207cd2))&&_0x34e579){fs[_0x1145('0x3a')](path[_0x1145('0x3b')](_0x4ef9ca,_0x207cd2));}return BPromise[_0x1145('0x3c')](_0x33e8b6,function(_0x40062f){_0x2e392f[_0x1145('0x18')](_0x40062f);})['then'](function(){var _0x121c7c=[];for(var _0x469e1d=0x0;_0x469e1d<_0x2e392f[_0x1145('0x15')];_0x469e1d+=0x1){var _0x5b93ce=_0x2e392f[_0x469e1d];var _0x1627b7=createTables(_[_0x1145('0x3d')](_0x5b93ce));var _0x3628a6;var _0x1d74db=getPDFDocDefinition(_0x1627b7);var _0x5e44c4=getPDFPrinter();var _0x59ca02=_0x5e44c4[_0x1145('0x3e')](_0x1d74db);if(_0x34e579){_0x3628a6=path[_0x1145('0x3b')](_0x4ef9ca,_0x207cd2,util[_0x1145('0x1e')]('%s%d.%s',_0x207cd2,_0x469e1d,_0x1145('0x3f')));}else{_0x3628a6=path['join'](_0x4ef9ca,util[_0x1145('0x1e')]('%s.%s',_0x207cd2,_0x1145('0x3f')));}_0x121c7c[_0x1145('0x18')](writePDFDocument(_0x59ca02,_0x3628a6));}return Promise[_0x1145('0x40')](_0x121c7c);})[_0x1145('0x2e')](function(){if(_0x34e579){return new Promise(function(_0x410018){zipdir(path['join'](_0x4ef9ca,_0x207cd2),{'saveTo':path[_0x1145('0x3b')](_0x4ef9ca,util[_0x1145('0x1e')](_0x1145('0x41'),_0x207cd2,_0x1145('0x42')))},function(){rimraf(path[_0x1145('0x3b')](_0x4ef9ca,_0x207cd2),function(){});_0x410018(_0x1145('0x43'));});});}})[_0x1145('0x2e')](function(){if(!_0x34e579)return;rimraf(path[_0x1145('0x3b')](_0x4ef9ca,_0x207cd2),function(){});})[_0x1145('0x2e')](function(){logger[_0x1145('0x44')](util[_0x1145('0x1e')](_0x1145('0x45'),EXTRACTED_REPORT_ID,_0x1145('0x46')));return analyticExtractedReport(_0x1145('0x47'),_0x34e579?util[_0x1145('0x1e')](_0x1145('0x41'),_0x207cd2,_0x34e579?_0x1145('0x42'):_0x1145('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1145('0x44')](util[_0x1145('0x1e')](_0x1145('0x48'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x1145('0xe')][_0x1145('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1145('0x2e')](function(_0x5c4320){EXTRACTED_REPORT=_0x5c4320;return dbH[_0x1145('0x31')][_0x1145('0x35')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x1145('0x34')]});})[_0x1145('0x2e')](extractReport)[_0x1145('0x4a')](function(_0x3cab60){logger[_0x1145('0x44')](util[_0x1145('0x1e')](_0x1145('0x4b'),EXTRACTED_REPORT_ID,_0x1145('0x46')),util[_0x1145('0x4c')](_0x3cab60,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1145('0x4d')](function(){process[_0x1145('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xe119c2=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x1145('0x4f'),'italics':__dirname+_0x1145('0x50'),'bolditalics':__dirname+_0x1145('0x51')}});return _0xe119c2;}function getPDFDocDefinitionFromHTML(_0x3fb3ee,_0x128644){var _0x577c6c=util['format']('%s\x20#%d',_0x128644[_0x1145('0x52')],_0x128644['interactionId']);var _0x30fec9=moment()[_0x1145('0x1e')]('YYYY-MM-DD')[_0x1145('0x13')]();var _0x49c82b=htmlToPdfmake(_0x3fb3ee,{'window':window,'tableAutoSize':!![]});return{'content':[_0x49c82b],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1145('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1145('0x54'),'style':'header'}];},'footer':function(_0x3526c3,_0x104528){return[{'text':util[_0x1145('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x577c6c,_0x3526c3,_0x104528,_0x30fec9),'style':_0x1145('0x25')}];}};}function writePDFDocument(_0x1291b4,_0x19013b){return new Promise(function(_0x5c24fd,_0x30a46f){var _0x3d652d=_0x1291b4[_0x1145('0x55')](fs[_0x1145('0x56')](_0x19013b));_0x3d652d['on']('finish',function(){_0x5c24fd(_0x1145('0x57'));});_0x3d652d['on'](_0x1145('0x58'),function(_0x25cb13){_0x30a46f(_0x25cb13);});_0x1291b4[_0x1145('0x59')]();});}exports[_0x1145('0x5a')]=function(_0x56a7f6,_0x3a5a32){var _0x2103b8=getPDFPrinter();var _0x539e0f=getPDFDocDefinitionFromHTML(_0x56a7f6,_0x3a5a32);var _0x2f5d81=_0x2103b8['createPdfKitDocument'](_0x539e0f);return writePDFDocument(_0x2f5d81,_0x3a5a32['path'])['catch'](function(_0x579133){throw _0x579133;});}; \ No newline at end of file +var _0x30b3=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','lodash','util','path','moment','html-to-pdfmake','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','update','map','pick','fill','auto','push','body','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','pageBreak','before','landscape','toString','footer','Arial','right','num','Setting','find','split','then','splitSizePdf','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','length','join','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne'];(function(_0x441d2e,_0x520da5){var _0x5317b2=function(_0x28b8e9){while(--_0x28b8e9){_0x441d2e['push'](_0x441d2e['shift']());}};_0x5317b2(++_0x520da5);}(_0x30b3,0x6c));var _0x330b=function(_0x40001a,_0x57f2ae){_0x40001a=_0x40001a-0x0;var _0x4cec45=_0x30b3[_0x40001a];return _0x4cec45;};'use strict';var _=require(_0x330b('0x0'));var fs=require('fs');var util=require(_0x330b('0x1'));var path=require(_0x330b('0x2'));var moment=require(_0x330b('0x3'));var htmlToPdfmake=require(_0x330b('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x330b('0x5'))[_0x330b('0x6')];var window=new JSDOM('')[_0x330b('0x7')];var BPromise=require('bluebird');var db=require(_0x330b('0x8'))['db'];var dbH=require('../../mysqldb')[_0x330b('0x9')];var logger=require(_0x330b('0xa'))(_0x330b('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x330b('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x330b('0xc')][0x4];var NAME=process[_0x330b('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x84e8f,_0x3da64f){var _0x1a58dc={'status':_0x84e8f};var _0x3e455b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3da64f){_0x1a58dc['savename']=_0x3da64f;}return db['AnalyticExtractedReport'][_0x330b('0xd')](_0x1a58dc,_0x3e455b);}function getHeaders(_0x103689){return _[_0x330b('0xe')](_0x103689,function(_0x415c72){return{'text':_0x415c72,'style':'tableHeader'};});}function getRows(_0x5ae958,_0x3e779a){return _[_0x330b('0xe')](_0x3e779a,function(_0x456814){return _(_0x456814)[_0x330b('0xf')](_0x5ae958)[_0x330b('0xe')](function(_0x3f357b){return _0x3f357b?_['toString'](_0x3f357b):'';})['value']();});}function createTable(_0x4aec90,_0x51a32e){var _0x4fce61={'widths':_[_0x330b('0x10')](Array(_0x4aec90['length']),0x91),'heights':function(_0x5f326f){return _0x5f326f===0x0?_0x330b('0x11'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x563407=getHeaders(_0x4aec90);_0x4fce61['body'][_0x330b('0x12')](_0x563407);var _0xce707f=getRows(_0x4aec90,_0x51a32e);_0x4fce61[_0x330b('0x13')]=_0x4fce61['body'][_0x330b('0x14')](_0xce707f);return _0x4fce61;}function createTables(_0x2fb6ea){var _0x372104=[];var _0x3e21c6=_[_0x330b('0x15')](Object[_0x330b('0x16')](_0x2fb6ea[0x0]),0x5);_0x3e21c6['forEach'](function(_0x3260a0){_0x372104[_0x330b('0x12')](createTable(_0x3260a0,_0x2fb6ea));});return _0x372104;}function getPDFDocDefinition(_0x296bd4){var _0xbbe1ed=util[_0x330b('0x17')](_0x330b('0x18'),NAME,EXTRACTED_REPORT[_0x330b('0x19')],moment(EXTRACTED_REPORT[_0x330b('0x1a')])[_0x330b('0x17')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x330b('0x17')](FORMAT));var _0x1c0fcb=[];for(var _0x8406d7=0x0;_0x8406d7<_0x296bd4['length'];_0x8406d7++){var _0x3129c8=[];if(_0x8406d7===0x0){_0x3129c8[_0x330b('0x12')]({'text':_0xbbe1ed,'style':'header'});}var _0x3309e9={'table':_0x296bd4[_0x8406d7]};if(_0x8406d7>0x0){_0x3309e9[_0x330b('0x1b')]=_0x330b('0x1c');_0x3309e9['margin']=[0x0,0x46,0x0,0x0];}_0x3129c8[_0x330b('0x12')](_0x3309e9);_0x1c0fcb[_0x330b('0x12')](_0x3129c8);}return{'pageSize':'A4','pageOrientation':_0x330b('0x1d'),'content':_0x1c0fcb,'footer':function(_0x3c5a9c,_0x114853){return{'text':_0x3c5a9c[_0x330b('0x1e')]()+'\x20/\x20'+_0x114853,'style':_0x330b('0x1f')};},'defaultStyle':{'font':_0x330b('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x330b('0x21'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x31760b){var _0x1373f6=0x1388;var _0x4e97cd;if(!_0x31760b[0x0][_0x330b('0x22')]){return analyticExtractedReport('Empty');}return db[_0x330b('0x23')][_0x330b('0x24')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x330b('0x25'),'splitSizePdf']})[_0x330b('0x26')](function(_0x5d6dea){if(_0x5d6dea){_0x4e97cd=_0x5d6dea;_0x1373f6=_0x4e97cd[_0x330b('0x27')]||0x3e8;}})[_0x330b('0x26')](function(){var _0x109cc5=[];var _0x4d51d2=0x0;if(_0x4e97cd[_0x330b('0x25')]){if(_0x31760b&&_0x31760b['length']){var _0x4f5345=_[_0x330b('0x28')](_0x31760b[0x0][_0x330b('0x22')]/_0x1373f6);var _0x14816b=Number[_0x330b('0x29')](_0x31760b[0x0][_0x330b('0x22')]/_0x1373f6)?_0x31760b[0x0][_0x330b('0x22')]%_0x1373f6:0x0;_0x4f5345[_0x330b('0x2a')](function(_0x1fb955){if(_0x1fb955>0x0){_0x4d51d2+=_0x1373f6;}_0x109cc5[_0x330b('0x12')](dbH['sequelize'][_0x330b('0x2b')](util[_0x330b('0x17')](_0x330b('0x2c'),QUERY,_0x1373f6,_0x4d51d2),{'type':dbH[_0x330b('0x2d')][_0x330b('0x2e')][_0x330b('0x2f')]}));});if(_0x14816b>0x0){_0x4d51d2+=_0x1373f6;_0x109cc5[_0x330b('0x12')](dbH[_0x330b('0x2d')][_0x330b('0x2b')](util[_0x330b('0x17')](_0x330b('0x2c'),QUERY,_0x14816b,_0x4d51d2),{'type':dbH[_0x330b('0x2d')]['QueryTypes'][_0x330b('0x2f')]}));}}}else{_0x109cc5['push'](dbH[_0x330b('0x2d')][_0x330b('0x2b')](QUERY,{'type':dbH[_0x330b('0x2d')][_0x330b('0x2e')][_0x330b('0x2f')]}));}var _0x29a5e1=path[_0x330b('0x30')](PATH);var _0x1ab2c7=path[_0x330b('0x31')](PATH,_0x330b('0x32'));var _0x4e65db=_0x4e97cd[_0x330b('0x25')]&&_0x109cc5[_0x330b('0x33')]>0x1;var _0x1ae3f6=[];if(!fs['existsSync'](path[_0x330b('0x34')](_0x29a5e1,_0x1ab2c7))&&_0x4e65db){fs['mkdirSync'](path[_0x330b('0x34')](_0x29a5e1,_0x1ab2c7));}return BPromise[_0x330b('0x35')](_0x109cc5,function(_0x3a175f){_0x1ae3f6['push'](_0x3a175f);})['then'](function(){var _0x4d76bb=[];for(var _0x2cebf1=0x0;_0x2cebf1<_0x1ae3f6[_0x330b('0x33')];_0x2cebf1+=0x1){var _0x9f1a32=_0x1ae3f6[_0x2cebf1];var _0x240151=createTables(_[_0x330b('0x36')](_0x9f1a32));var _0x4c052e;var _0x4180c3=getPDFDocDefinition(_0x240151);var _0x56549a=getPDFPrinter();var _0x46c251=_0x56549a[_0x330b('0x37')](_0x4180c3);if(_0x4e65db){_0x4c052e=path[_0x330b('0x34')](_0x29a5e1,_0x1ab2c7,util[_0x330b('0x17')]('%s%d.%s',_0x1ab2c7,_0x2cebf1,_0x330b('0x38')));}else{_0x4c052e=path[_0x330b('0x34')](_0x29a5e1,util[_0x330b('0x17')](_0x330b('0x39'),_0x1ab2c7,_0x330b('0x38')));}_0x4d76bb[_0x330b('0x12')](writePDFDocument(_0x46c251,_0x4c052e));}return Promise[_0x330b('0x3a')](_0x4d76bb);})[_0x330b('0x26')](function(){if(_0x4e65db){return new Promise(function(_0x1c8446){zipdir(path[_0x330b('0x34')](_0x29a5e1,_0x1ab2c7),{'saveTo':path['join'](_0x29a5e1,util[_0x330b('0x17')](_0x330b('0x39'),_0x1ab2c7,_0x330b('0x3b')))},function(){rimraf(path['join'](_0x29a5e1,_0x1ab2c7),function(){});_0x1c8446(_0x330b('0x3c'));});});}})[_0x330b('0x26')](function(){if(!_0x4e65db)return;rimraf(path[_0x330b('0x34')](_0x29a5e1,_0x1ab2c7),function(){});})[_0x330b('0x26')](function(){logger['info'](util[_0x330b('0x17')](_0x330b('0x3d'),EXTRACTED_REPORT_ID,_0x330b('0x3e')));return analyticExtractedReport(_0x330b('0x3f'),_0x4e65db?util['format'](_0x330b('0x39'),_0x1ab2c7,_0x4e65db?_0x330b('0x3b'):_0x330b('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x330b('0x40')](util['format'](_0x330b('0x41'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x330b('0x42')][_0x330b('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x330b('0x26')](function(_0xd46318){EXTRACTED_REPORT=_0xd46318;return dbH[_0x330b('0x2d')]['query'](util[_0x330b('0x17')](_0x330b('0x44'),QUERY),{'type':dbH[_0x330b('0x2d')][_0x330b('0x2e')][_0x330b('0x2f')]});})[_0x330b('0x26')](extractReport)[_0x330b('0x45')](function(_0x3e7555){logger[_0x330b('0x40')](util[_0x330b('0x17')](_0x330b('0x46'),EXTRACTED_REPORT_ID,_0x330b('0x3e')),util[_0x330b('0x47')](_0x3e7555,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x330b('0x48'));})[_0x330b('0x49')](function(){process[_0x330b('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x48eb70=new PdfPrinter({'Arial':{'normal':__dirname+_0x330b('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x330b('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x48eb70;}function getPDFDocDefinitionFromHTML(_0x5c689d,_0x2e365e){var _0x3ea3cb=util[_0x330b('0x17')](_0x330b('0x4d'),_0x2e365e[_0x330b('0x4e')],_0x2e365e['interactionId']);var _0x3efc8f=moment()[_0x330b('0x17')](_0x330b('0x4f'))[_0x330b('0x1e')]();var _0xf7baff=htmlToPdfmake(_0x5c689d,{'window':window,'tableAutoSize':!![]});return{'content':[_0xf7baff],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x330b('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x330b('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x330b('0x50')}},'header':function(){return[{'text':_0x330b('0x51'),'style':'header'}];},'footer':function(_0x4b9ac5,_0x9b65c){return[{'text':util['format'](_0x330b('0x52'),_0x3ea3cb,_0x4b9ac5,_0x9b65c,_0x3efc8f),'style':_0x330b('0x1f')}];}};}function writePDFDocument(_0x34b7c0,_0x48a3ce){return new Promise(function(_0x330e5e,_0x5eb9ee){var _0x485459=_0x34b7c0[_0x330b('0x53')](fs[_0x330b('0x54')](_0x48a3ce));_0x485459['on']('finish',function(){_0x330e5e(_0x330b('0x55'));});_0x485459['on'](_0x330b('0x56'),function(_0x427227){_0x5eb9ee(_0x427227);});_0x34b7c0[_0x330b('0x57')]();});}exports['createPdfFromHTML']=function(_0x51c084,_0x27f688){var _0x51782c=getPDFPrinter();var _0x260114=getPDFDocDefinitionFromHTML(_0x51c084,_0x27f688);var _0x4c4a3c=_0x51782c[_0x330b('0x37')](_0x260114);return writePDFDocument(_0x4c4a3c,_0x27f688[_0x330b('0x2')])[_0x330b('0x45')](function(_0x180170){throw _0x180170;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 74bd0f7..a94c074 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 _0x1c7c=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','sequelize','query'];(function(_0x35b5a7,_0x70d6bb){var _0x137521=function(_0x39843d){while(--_0x39843d){_0x35b5a7['push'](_0x35b5a7['shift']());}};_0x137521(++_0x70d6bb);}(_0x1c7c,0x164));var _0xc1c7=function(_0x48da2c,_0x14ee9e){_0x48da2c=_0x48da2c-0x0;var _0x5b2c37=_0x1c7c[_0x48da2c];return _0x5b2c37;};'use strict';var util=require(_0xc1c7('0x0'));var path=require(_0xc1c7('0x1'));var _=require(_0xc1c7('0x2'));var fs=require('fs');var json2xls=require(_0xc1c7('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xc1c7('0x4'));var rimraf=require('rimraf');var db=require(_0xc1c7('0x5'))['db'];var dbH=require(_0xc1c7('0x5'))[_0xc1c7('0x6')];var logger=require(_0xc1c7('0x7'))(_0xc1c7('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xc1c7('0x9')][0x2]);var QUERY=process[_0xc1c7('0x9')][0x3];var PATH=process[_0xc1c7('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xce5bcd,_0x3b3e9c){var _0x434a35={'status':_0xce5bcd};var _0x11c7ef={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b3e9c){_0x434a35[_0xc1c7('0xa')]=_0x3b3e9c;}return db[_0xc1c7('0xb')][_0xc1c7('0xc')](_0x434a35,_0x11c7ef);}function main(){var _0x301abf=0x1388;var _0x25a669;logger['info'](util[_0xc1c7('0xd')](_0xc1c7('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xc1c7('0xf')][_0xc1c7('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc1c7('0x11'),'splitSizeXlsx']})[_0xc1c7('0x12')](function(_0x44bf88){if(_0x44bf88){_0x25a669=_0x44bf88;_0x301abf=_0x25a669[_0xc1c7('0x13')]||0x1388;}})[_0xc1c7('0x12')](function(){return dbH[_0xc1c7('0x14')][_0xc1c7('0x15')](util[_0xc1c7('0xd')](_0xc1c7('0x16'),QUERY),{'type':dbH[_0xc1c7('0x14')][_0xc1c7('0x17')][_0xc1c7('0x18')]});})[_0xc1c7('0x12')](function(_0x49576d){if(!_0x49576d[0x0][_0xc1c7('0x19')]){return analyticExtractedReport(_0xc1c7('0x1a'));}var _0x21911c=[];var _0x555b59=0x0;if(_0x25a669[_0xc1c7('0x11')]){if(_0x49576d&&_0x49576d[_0xc1c7('0x1b')]){var _0x1446f3=_[_0xc1c7('0x1c')](_0x49576d[0x0][_0xc1c7('0x19')]/_0x301abf);var _0xb42702=Number[_0xc1c7('0x1d')](_0x49576d[0x0][_0xc1c7('0x19')]/_0x301abf)?_0x49576d[0x0]['num']%_0x301abf:0x0;_0x1446f3[_0xc1c7('0x1e')](function(_0x17fd22){if(_0x17fd22>0x0){_0x555b59+=_0x301abf;}_0x21911c[_0xc1c7('0x1f')](dbH[_0xc1c7('0x14')]['query'](util[_0xc1c7('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x301abf,_0x555b59),{'type':dbH[_0xc1c7('0x14')][_0xc1c7('0x17')]['SELECT']}));});if(_0xb42702>0x0){_0x555b59+=_0x301abf;_0x21911c['push'](dbH[_0xc1c7('0x14')][_0xc1c7('0x15')](util[_0xc1c7('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xb42702,_0x555b59),{'type':dbH[_0xc1c7('0x14')][_0xc1c7('0x17')][_0xc1c7('0x18')]}));}}}else{_0x21911c[_0xc1c7('0x1f')](dbH[_0xc1c7('0x14')][_0xc1c7('0x15')](QUERY,{'type':dbH[_0xc1c7('0x14')][_0xc1c7('0x17')][_0xc1c7('0x18')]}));}var _0x1540c1=path[_0xc1c7('0x20')](PATH);var _0x363fbc=path[_0xc1c7('0x21')](PATH,_0xc1c7('0x22'));var _0xf1c405=_0x25a669[_0xc1c7('0x11')]&&_0x21911c['length']>0x1;var _0xf0ab9c=[];if(!fs[_0xc1c7('0x23')](path['join'](_0x1540c1,_0x363fbc))&&_0xf1c405){fs['mkdirSync'](path[_0xc1c7('0x24')](_0x1540c1,_0x363fbc));}return BPromise['each'](_0x21911c,function(_0x544fbb){_0xf0ab9c[_0xc1c7('0x1f')](_0x544fbb);})[_0xc1c7('0x12')](function(){for(var _0x46d045=0x0;_0x46d045<_0xf0ab9c[_0xc1c7('0x1b')];_0x46d045+=0x1){var _0x461360;var _0x4adb81=_0xf0ab9c[_0x46d045];if(_0xf1c405){_0x461360=path['join'](_0x1540c1,_0x363fbc,util[_0xc1c7('0xd')](_0xc1c7('0x25'),_0x363fbc,_0x46d045,_0xc1c7('0x26')));}else{_0x461360=path[_0xc1c7('0x24')](_0x1540c1,util[_0xc1c7('0xd')]('%s.%s',_0x363fbc,'xlsx'));}fs[_0xc1c7('0x27')](_0x461360,json2xls(_0x4adb81),_0xc1c7('0x28'));}})['then'](function(){if(_0xf1c405){return new Promise(function(_0x41b154){zipdir(path[_0xc1c7('0x24')](_0x1540c1,_0x363fbc),{'saveTo':path[_0xc1c7('0x24')](_0x1540c1,util[_0xc1c7('0xd')](_0xc1c7('0x29'),_0x363fbc,_0xc1c7('0x2a')))},function(_0x37533c,_0x598239){rimraf(path[_0xc1c7('0x24')](_0x1540c1,_0x363fbc),function(){});_0x41b154(_0xc1c7('0x2b'));});});}})[_0xc1c7('0x12')](function(){logger[_0xc1c7('0x2c')](util[_0xc1c7('0xd')](_0xc1c7('0x2d'),EXTRACTED_REPORT_ID,_0xc1c7('0x2e')));return analyticExtractedReport(_0xc1c7('0x2f'),_0xf1c405?util[_0xc1c7('0xd')]('%s.%s',_0x363fbc,_0xf1c405?'zip':_0xc1c7('0x26')):null);});})[_0xc1c7('0x30')](function(_0x263900){logger[_0xc1c7('0x2c')](util[_0xc1c7('0xd')](_0xc1c7('0x31'),EXTRACTED_REPORT_ID,_0xc1c7('0x2e')),util[_0xc1c7('0x32')](_0x263900,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc1c7('0x33'));})[_0xc1c7('0x34')](function(){process[_0xc1c7('0x35')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xcdd6=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0xcdd6,0x1be));var _0x6cdd=function(_0x281b99,_0x2b18c7){_0x281b99=_0x281b99-0x0;var _0xf1d8de=_0xcdd6[_0x281b99];return _0xf1d8de;};'use strict';var util=require('util');var path=require(_0x6cdd('0x0'));var _=require(_0x6cdd('0x1'));var fs=require('fs');var json2xls=require(_0x6cdd('0x2'));var BPromise=require(_0x6cdd('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x6cdd('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6cdd('0x5'))[_0x6cdd('0x6')];var logger=require(_0x6cdd('0x7'))(_0x6cdd('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6cdd('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6cdd('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x51872d,_0xdb19fc){var _0xf5be23={'status':_0x51872d};var _0x3cd758={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xdb19fc){_0xf5be23[_0x6cdd('0xa')]=_0xdb19fc;}return db[_0x6cdd('0xb')][_0x6cdd('0xc')](_0xf5be23,_0x3cd758);}function main(){var _0x599d32=0x1388;var _0x5f0e48;logger[_0x6cdd('0xd')](util[_0x6cdd('0xe')](_0x6cdd('0xf'),EXTRACTED_REPORT_ID,_0x6cdd('0x10')));return db[_0x6cdd('0x11')][_0x6cdd('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6cdd('0x13'),_0x6cdd('0x14')]})['then'](function(_0x5a68e1){if(_0x5a68e1){_0x5f0e48=_0x5a68e1;_0x599d32=_0x5f0e48[_0x6cdd('0x14')]||0x1388;}})[_0x6cdd('0x15')](function(){return dbH['sequelize'][_0x6cdd('0x16')](util[_0x6cdd('0xe')](_0x6cdd('0x17'),QUERY),{'type':dbH[_0x6cdd('0x18')][_0x6cdd('0x19')][_0x6cdd('0x1a')]});})[_0x6cdd('0x15')](function(_0x10ab7c){if(!_0x10ab7c[0x0][_0x6cdd('0x1b')]){return analyticExtractedReport(_0x6cdd('0x1c'));}var _0x494280=[];var _0x33bb11=0x0;if(_0x5f0e48['split']){if(_0x10ab7c&&_0x10ab7c['length']){var _0x3524a7=_[_0x6cdd('0x1d')](_0x10ab7c[0x0][_0x6cdd('0x1b')]/_0x599d32);var _0x10843f=Number['isInteger'](_0x10ab7c[0x0][_0x6cdd('0x1b')]/_0x599d32)?_0x10ab7c[0x0][_0x6cdd('0x1b')]%_0x599d32:0x0;_0x3524a7[_0x6cdd('0x1e')](function(_0x3c6781){if(_0x3c6781>0x0){_0x33bb11+=_0x599d32;}_0x494280['push'](dbH[_0x6cdd('0x18')][_0x6cdd('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x599d32,_0x33bb11),{'type':dbH[_0x6cdd('0x18')][_0x6cdd('0x19')][_0x6cdd('0x1a')]}));});if(_0x10843f>0x0){_0x33bb11+=_0x599d32;_0x494280[_0x6cdd('0x1f')](dbH[_0x6cdd('0x18')][_0x6cdd('0x16')](util[_0x6cdd('0xe')](_0x6cdd('0x20'),QUERY,_0x10843f,_0x33bb11),{'type':dbH[_0x6cdd('0x18')][_0x6cdd('0x19')][_0x6cdd('0x1a')]}));}}}else{_0x494280['push'](dbH[_0x6cdd('0x18')][_0x6cdd('0x16')](QUERY,{'type':dbH[_0x6cdd('0x18')][_0x6cdd('0x19')][_0x6cdd('0x1a')]}));}var _0xbe1d4b=path['dirname'](PATH);var _0x111294=path[_0x6cdd('0x21')](PATH,'.xlsx');var _0x1c298f=_0x5f0e48[_0x6cdd('0x13')]&&_0x494280[_0x6cdd('0x22')]>0x1;var _0x43e2b4=[];if(!fs[_0x6cdd('0x23')](path['join'](_0xbe1d4b,_0x111294))&&_0x1c298f){fs[_0x6cdd('0x24')](path[_0x6cdd('0x25')](_0xbe1d4b,_0x111294));}return BPromise[_0x6cdd('0x26')](_0x494280,function(_0x3f6826){_0x43e2b4[_0x6cdd('0x1f')](_0x3f6826);})[_0x6cdd('0x15')](function(){for(var _0x3bb04f=0x0;_0x3bb04f<_0x43e2b4[_0x6cdd('0x22')];_0x3bb04f+=0x1){var _0x5e4c78;var _0x5a68ec=_0x43e2b4[_0x3bb04f];if(_0x1c298f){_0x5e4c78=path['join'](_0xbe1d4b,_0x111294,util[_0x6cdd('0xe')](_0x6cdd('0x27'),_0x111294,_0x3bb04f,_0x6cdd('0x28')));}else{_0x5e4c78=path[_0x6cdd('0x25')](_0xbe1d4b,util['format'](_0x6cdd('0x29'),_0x111294,'xlsx'));}fs['writeFileSync'](_0x5e4c78,json2xls(_0x5a68ec),_0x6cdd('0x2a'));}})[_0x6cdd('0x15')](function(){if(_0x1c298f){return new Promise(function(_0x4edbbb){zipdir(path['join'](_0xbe1d4b,_0x111294),{'saveTo':path[_0x6cdd('0x25')](_0xbe1d4b,util[_0x6cdd('0xe')](_0x6cdd('0x29'),_0x111294,_0x6cdd('0x2b')))},function(_0x3536f8,_0xf36d32){rimraf(path[_0x6cdd('0x25')](_0xbe1d4b,_0x111294),function(){});_0x4edbbb('zip\x20finished');});});}})[_0x6cdd('0x15')](function(){logger[_0x6cdd('0xd')](util[_0x6cdd('0xe')](_0x6cdd('0x2c'),EXTRACTED_REPORT_ID,_0x6cdd('0x10')));return analyticExtractedReport(_0x6cdd('0x2d'),_0x1c298f?util['format'](_0x6cdd('0x29'),_0x111294,_0x1c298f?_0x6cdd('0x2b'):_0x6cdd('0x28')):null);});})[_0x6cdd('0x2e')](function(_0x514f8b){logger[_0x6cdd('0xd')](util[_0x6cdd('0xe')](_0x6cdd('0x2f'),EXTRACTED_REPORT_ID,_0x6cdd('0x10')),util[_0x6cdd('0x30')](_0x514f8b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x6cdd('0x31')](function(){process[_0x6cdd('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 09a7c2d..9884203 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 _0xb8c8=['format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','cutdigits','${EXTEN}','):Goto(','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','priority','extensions','find','push','Set'];(function(_0x2c4468,_0x28dd06){var _0x3ba825=function(_0x1a6f42){while(--_0x1a6f42){_0x2c4468['push'](_0x2c4468['shift']());}};_0x3ba825(++_0x28dd06);}(_0xb8c8,0x6f));var _0x8b8c=function(_0x5d5cbb,_0x195302){_0x5d5cbb=_0x5d5cbb-0x0;var _0x4eaf19=_0xb8c8[_0x5d5cbb];return _0x4eaf19;};'use strict';var _=require('lodash');var util=require(_0x8b8c('0x0'));function rewrite(_0x2a14ad,_0xd2cfb9){var _0x262d96=this;return _0x2a14ad[_0x8b8c('0x1')][_0x8b8c('0x2')][_0x8b8c('0x3')]({'raw':!![]})[_0x8b8c('0x4')](function(_0x1b11ea){_0x262d96[_0x8b8c('0x5')]=_0x1b11ea;return _0x2a14ad[_0x8b8c('0x1')][_0x8b8c('0x6')][_0x8b8c('0x3')]({'where':{'IntervalId':_0xd2cfb9[_0x8b8c('0x7')]},'raw':!![]});})[_0x8b8c('0x4')](function(_0x56608a){return _0x2a14ad[_0x8b8c('0x1')][_0x8b8c('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x8b8c('0x8')](_0x56608a,'exten'))}},'order':[{'raw':_0x8b8c('0x9')}],'raw':!![]});})[_0x8b8c('0x4')](function(_0x1f9242){var _0x5048a8=_['filter'](_0x1f9242,{'priority':'1'});var _0x33f12b=_[_0x8b8c('0xa')](_0x1f9242,{'isApp':0x1});var _0x424d87=_[_0x8b8c('0xb')](_0x33f12b,_0x8b8c('0xc'));var _0x4b94c7=[_0x8b8c('0xd'),'playback'];var _0x2f2b9a=[];var _0x33ce7e=[];for(var _0x21fa60 in _0x424d87){if(_0x424d87['hasOwnProperty'](_0x21fa60)){_0x262d96[_0x8b8c('0xe')]=0x2;_0x262d96[_0x8b8c('0xf')]=[];_0x262d96['extension']=_[_0x8b8c('0x10')](_0x5048a8,{'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')]});_0x262d96[_0x8b8c('0xf')][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0]['type'],'app':_0x8b8c('0x12'),'appdata':util[_0x8b8c('0x13')](_0x8b8c('0x14'),_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')]),'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96[_0x8b8c('0xe')]++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')]});if(_0x424d87[_0x21fa60][0x0]['type']===_0x8b8c('0x18')){_0x262d96[_0x8b8c('0xf')][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x8b8c('0x19')+_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')],'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96[_0x8b8c('0xe')]++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')]});}else if(_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')]===_0x8b8c('0x1a')){if(_0x262d96[_0x8b8c('0x1b')]){_0x262d96[_0x8b8c('0xf')]['push']({'type':_0x424d87[_0x21fa60][0x0]['type'],'app':_0x8b8c('0x12'),'appdata':'CDR(destination)='+(_0x262d96['extension'][_0x8b8c('0x1c')]?'${EXTEN:'+_0x262d96['extension']['cutdigits']+'}':_0x8b8c('0x1d')),'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0]['exten'],'priority':_0x262d96['priority']++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']});}_0x262d96['extensions'][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x8b8c('0x19')+_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')],'context':_0x424d87[_0x21fa60][0x0]['context'],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96[_0x8b8c('0xe')]++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')]});var _0x5da49b=_0x262d96[_0x8b8c('0xe')]++;_0x262d96[_0x8b8c('0xf')][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0]['type'],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5da49b+0x2)+_0x8b8c('0x1e')+(_0x5da49b+0x1)+')','context':_0x424d87[_0x21fa60][0x0]['context'],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x5da49b,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')]});if(_0x262d96[_0x8b8c('0x1b')]){_0x262d96['extensions']['push']({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x262d96[_0x8b8c('0x1b')][_0x8b8c('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x262d96[_0x8b8c('0x1b')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96['priority']++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')]});}_0x262d96[_0x8b8c('0xf')][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':'outboundrouteid='+_0x424d87[_0x21fa60][0x0]['VoiceExtensionId'],'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96[_0x8b8c('0xe')]++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']});if(_0x262d96[_0x8b8c('0x1b')]&&_0x262d96['extension'][_0x8b8c('0x1f')](_0x8b8c('0x20'))&&_0x262d96[_0x8b8c('0x1b')]['recordingFormat']!=='none'){_0x262d96['extensions'][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x8b8c('0x21'),'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0]['exten'],'priority':_0x262d96['priority']++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']});_0x262d96[_0x8b8c('0xf')]['push']({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x8b8c('0x22')+_0x262d96[_0x8b8c('0x1b')][_0x8b8c('0x20')]||'wav','context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96[_0x8b8c('0xe')]++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']});}}_0x262d96[_0x8b8c('0xf')][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96['priority']++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')]});_0x262d96[_0x8b8c('0xf')][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x8b8c('0x23'),'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96['priority']++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']});_0x262d96[_0x8b8c('0xf')][_0x8b8c('0x11')]({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x8b8c('0x24'),'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'exten':_0x424d87[_0x21fa60][0x0][_0x8b8c('0xc')],'priority':_0x262d96[_0x8b8c('0xe')]++,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x17')]});for(var _0x4cf46f=0x0,_0x4e0d62=0x0;_0x4cf46f<_0x424d87[_0x21fa60][_0x8b8c('0x25')];_0x4cf46f+=0x1,_0x4e0d62=0x0){var _0x459e8d=_0x424d87[_0x21fa60][_0x4cf46f];if(_0x459e8d['type']){_0x459e8d[_0x8b8c('0x15')]=_0x459e8d[_0x8b8c('0x15')][_0x8b8c('0x26')]();}var _0x35cc0f=[];var _0x1d3e68=[];delete _0x459e8d['id'];delete _0x459e8d[_0x8b8c('0x27')];delete _0x459e8d[_0x8b8c('0x28')];var _0xaf6901=_0x459e8d[_0x8b8c('0x29')]!==_0x8b8c('0x2a')?[_0x459e8d['interval']]:_0x459e8d['IntervalId']?_[_0x8b8c('0x8')](_[_0x8b8c('0xa')](_0x262d96[_0x8b8c('0x5')],{'IntervalId':_0x459e8d['IntervalId']}),_0x8b8c('0x29')):[];if(_0x459e8d[_0x8b8c('0x1f')](_0x8b8c('0x2b'))){if(_0x459e8d[_0x8b8c('0x2b')]&&_0x459e8d[_0x8b8c('0x2b')]!=='--'){_0x35cc0f[_0x8b8c('0x11')]({'type':_0x459e8d[_0x8b8c('0x15')],'app':'Set','appdata':_0x8b8c('0x2c')+_0x459e8d[_0x8b8c('0x2b')],'context':_0x459e8d['context'],'exten':_0x459e8d['exten'],'priority':_0xaf6901[_0x8b8c('0x25')]+_0x262d96[_0x8b8c('0xe')]+_0x4e0d62++,'VoiceExtensionId':_0x459e8d[_0x8b8c('0x17')]});}}if(_0x459e8d[_0x8b8c('0x15')]===_0x8b8c('0x1a')&&_0x459e8d[_0x8b8c('0x1f')](_0x8b8c('0x2d'))){if(_0x459e8d[_0x8b8c('0x2d')]){_0x35cc0f['push']({'type':_0x459e8d[_0x8b8c('0x15')],'app':'ExecIf','appdata':_0x8b8c('0x2e')+_0x459e8d[_0x8b8c('0x2d')]+')','context':_0x459e8d[_0x8b8c('0x16')],'exten':_0x459e8d[_0x8b8c('0xc')],'priority':_0xaf6901[_0x8b8c('0x25')]+_0x262d96[_0x8b8c('0xe')]+_0x4e0d62++,'VoiceExtensionId':_0x459e8d[_0x8b8c('0x17')]});}else{_0x35cc0f[_0x8b8c('0x11')]({'type':_0x459e8d[_0x8b8c('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x459e8d[_0x8b8c('0x16')],'exten':_0x459e8d[_0x8b8c('0xc')],'priority':_0xaf6901[_0x8b8c('0x25')]+_0x262d96[_0x8b8c('0xe')]+_0x4e0d62++,'VoiceExtensionId':_0x459e8d[_0x8b8c('0x17')]});}}if(_0x459e8d[_0x8b8c('0x1f')](_0x8b8c('0x2f'))){if(_0x4b94c7[_0x8b8c('0x30')](_0x459e8d['app']['toLowerCase']())>=0x0&&_0x459e8d[_0x8b8c('0x31')]!==_0x8b8c('0x32')){if(_0x459e8d[_0x8b8c('0x2f')]){_0x35cc0f[_0x8b8c('0x11')]({'type':_0x459e8d[_0x8b8c('0x15')],'app':_0x8b8c('0x33'),'appdata':_0x8b8c('0x34'),'context':_0x459e8d[_0x8b8c('0x16')],'exten':_0x459e8d[_0x8b8c('0xc')],'priority':_0xaf6901[_0x8b8c('0x25')]+_0x262d96['priority']+_0x4e0d62++,'VoiceExtensionId':_0x459e8d[_0x8b8c('0x17')]});_0x35cc0f['push']({'type':_0x459e8d[_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':_0x8b8c('0x35'),'context':_0x459e8d['context'],'exten':_0x459e8d[_0x8b8c('0xc')],'priority':_0xaf6901[_0x8b8c('0x25')]+_0x262d96[_0x8b8c('0xe')]+_0x4e0d62++,'VoiceExtensionId':_0x459e8d[_0x8b8c('0x17')]});}else{_0x35cc0f['push']({'type':_0x459e8d['type'],'app':_0x8b8c('0x33'),'appdata':_0x8b8c('0x36'),'context':_0x459e8d[_0x8b8c('0x16')],'exten':_0x459e8d['exten'],'priority':_0xaf6901['length']+_0x262d96[_0x8b8c('0xe')]+_0x4e0d62++,'VoiceExtensionId':_0x459e8d[_0x8b8c('0x17')]});_0x35cc0f['push']({'type':_0x459e8d[_0x8b8c('0x15')],'app':_0x8b8c('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x459e8d[_0x8b8c('0x16')],'exten':_0x459e8d[_0x8b8c('0xc')],'priority':_0xaf6901[_0x8b8c('0x25')]+_0x262d96[_0x8b8c('0xe')]+_0x4e0d62++,'VoiceExtensionId':_0x459e8d[_0x8b8c('0x17')]});}}}for(var _0x532ed4=0x0;_0x532ed4<_0xaf6901[_0x8b8c('0x25')];_0x532ed4+=0x1){var _0x2102ab=_0x262d96[_0x8b8c('0xe')]+_0xaf6901['length'];var _0x34ff55=_0x532ed4===_0xaf6901[_0x8b8c('0x25')]-0x1?_0x262d96['priority']+_0x35cc0f[_0x8b8c('0x25')]+_0x1d3e68[_0x8b8c('0x25')]+0x2:_0x262d96[_0x8b8c('0xe')]+_0x532ed4+0x1;_0x35cc0f[_0x8b8c('0x37')](_0x532ed4,0x0,{'type':_0x459e8d['type'],'app':'GotoIfTime','appdata':_0xaf6901[_0x532ed4]+'?'+_0x459e8d['context']+_0x8b8c('0x38')+_0x2102ab+':'+_0x459e8d[_0x8b8c('0x16')]+_0x8b8c('0x38')+_0x34ff55,'exten':_0x459e8d[_0x8b8c('0xc')],'context':_0x459e8d[_0x8b8c('0x16')],'priority':_0x262d96[_0x8b8c('0xe')]+_0x532ed4,'VoiceExtensionId':_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']});}_0x459e8d[_0x8b8c('0xe')]=_0x35cc0f['length']?_[_0x8b8c('0x39')](_0x35cc0f)['priority']+0x1:_0x262d96['priority'];_0x262d96['priority']=(_0x1d3e68['length']?_['last'](_0x1d3e68)[_0x8b8c('0xe')]:_0x459e8d[_0x8b8c('0xe')])+0x1;_0x262d96['extensions']=_[_0x8b8c('0x3a')](_0x262d96[_0x8b8c('0xf')],_0x35cc0f,[_0x459e8d],_0x1d3e68);}_0x262d96[_0x8b8c('0xf')]['push']({'type':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x15')],'app':_0x8b8c('0x3b'),'exten':_0x424d87[_0x21fa60][0x0]['exten'],'context':_0x424d87[_0x21fa60][0x0][_0x8b8c('0x16')],'priority':_0x262d96['priority'],'VoiceExtensionId':_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']});_0x2f2b9a[_0x8b8c('0x11')](_0x424d87[_0x21fa60][0x0]['VoiceExtensionId']);_0x33ce7e=_[_0x8b8c('0x3a')](_0x33ce7e,_0x262d96[_0x8b8c('0xf')]);}}return _0x2a14ad[_0x8b8c('0x3c')](function(_0x5a1ba2){return _0x2a14ad['models'][_0x8b8c('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x2f2b9a}},'transaction':_0x5a1ba2})[_0x8b8c('0x4')](function(_0x392ce4){return _0x2a14ad[_0x8b8c('0x1')][_0x8b8c('0x6')][_0x8b8c('0x3d')](_['sortBy'](_0x33ce7e,'priority'),{'transaction':_0x5a1ba2});});});})[_0x8b8c('0x3e')](function(_0x23787b){console[_0x8b8c('0x3f')](_0x23787b);});}exports[_0x8b8c('0x40')]=rewrite; \ No newline at end of file +var _0x2334=['findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','rewrite','util','Interval'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x2334,0x1ba));var _0x4233=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x2334[_0x582274];return _0x8f14d3;};'use strict';var _=require('lodash');var util=require(_0x4233('0x0'));function rewrite(_0x58781f,_0x5e45ed){var _0x457ea3=this;return _0x58781f['models'][_0x4233('0x1')][_0x4233('0x2')]({'raw':!![]})[_0x4233('0x3')](function(_0x5b21f1){_0x457ea3[_0x4233('0x4')]=_0x5b21f1;return _0x58781f[_0x4233('0x5')][_0x4233('0x6')][_0x4233('0x2')]({'where':{'IntervalId':_0x5e45ed[_0x4233('0x7')]},'raw':!![]});})[_0x4233('0x3')](function(_0x1d69fe){return _0x58781f[_0x4233('0x5')][_0x4233('0x6')][_0x4233('0x2')]({'where':{'exten':{'$in':_[_0x4233('0x8')](_[_0x4233('0x9')](_0x1d69fe,_0x4233('0xa')))}},'order':[{'raw':_0x4233('0xb')}],'raw':!![]});})['then'](function(_0x485791){var _0x578049=_[_0x4233('0xc')](_0x485791,{'priority':'1'});var _0x30cb1c=_[_0x4233('0xc')](_0x485791,{'isApp':0x1});var _0x5e1530=_['groupBy'](_0x30cb1c,_0x4233('0xa'));var _0x55814d=[_0x4233('0xd'),_0x4233('0xe')];var _0x9f3894=[];var _0x1c172e=[];for(var _0x19f9d9 in _0x5e1530){if(_0x5e1530[_0x4233('0xf')](_0x19f9d9)){_0x457ea3[_0x4233('0x10')]=0x2;_0x457ea3[_0x4233('0x11')]=[];_0x457ea3[_0x4233('0x12')]=_[_0x4233('0x13')](_0x578049,{'exten':_0x5e1530[_0x19f9d9][0x0]['exten']});_0x457ea3[_0x4233('0x11')][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0]['type'],'app':_0x4233('0x15'),'appdata':util[_0x4233('0x16')](_0x4233('0x17'),_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')]),'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});if(_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')]===_0x4233('0x1b')){_0x457ea3[_0x4233('0x11')][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0]['type'],'app':'Set','appdata':_0x4233('0x1c')+_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')],'context':_0x5e1530[_0x19f9d9][0x0]['context'],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});}else if(_0x5e1530[_0x19f9d9][0x0]['type']===_0x4233('0x1d')){if(_0x457ea3['extension']){_0x457ea3['extensions'][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0]['type'],'app':_0x4233('0x15'),'appdata':'CDR(destination)='+(_0x457ea3[_0x4233('0x12')][_0x4233('0x1e')]?'${EXTEN:'+_0x457ea3[_0x4233('0x12')][_0x4233('0x1e')]+'}':_0x4233('0x1f')),'context':_0x5e1530[_0x19f9d9][0x0]['context'],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0]['VoiceExtensionId']});}_0x457ea3['extensions'][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0]['type'],'app':'Set','appdata':_0x4233('0x1c')+_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')],'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0]['VoiceExtensionId']});var _0x1c1d04=_0x457ea3[_0x4233('0x10')]++;_0x457ea3[_0x4233('0x11')][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')],'app':'ExecIf','appdata':_0x4233('0x20')+(_0x1c1d04+0x2)+_0x4233('0x21')+(_0x1c1d04+0x1)+')','context':_0x5e1530[_0x19f9d9][0x0]['context'],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x1c1d04,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});if(_0x457ea3[_0x4233('0x12')]){_0x457ea3[_0x4233('0x11')]['push']({'type':_0x5e1530[_0x19f9d9][0x0]['type'],'app':'Set','appdata':_0x457ea3[_0x4233('0x12')][_0x4233('0x1e')]?_0x4233('0x22')+_0x457ea3[_0x4233('0x12')][_0x4233('0x1e')]+'}':_0x4233('0x23'),'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3['priority']++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});}_0x457ea3[_0x4233('0x11')][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')],'app':'Set','appdata':'outboundrouteid='+_0x5e1530[_0x19f9d9][0x0]['VoiceExtensionId'],'context':_0x5e1530[_0x19f9d9][0x0]['context'],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});if(_0x457ea3[_0x4233('0x12')]&&_0x457ea3[_0x4233('0x12')]['hasOwnProperty'](_0x4233('0x24'))&&_0x457ea3[_0x4233('0x12')][_0x4233('0x24')]!==_0x4233('0x25')){_0x457ea3['extensions']['push']({'type':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')],'app':'Set','appdata':_0x4233('0x26'),'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'exten':_0x5e1530[_0x19f9d9][0x0]['exten'],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});_0x457ea3['extensions'][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')],'app':'Set','appdata':_0x4233('0x27')+_0x457ea3[_0x4233('0x12')]['recordingFormat']||_0x4233('0x28'),'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});}}_0x457ea3[_0x4233('0x11')]['push']({'type':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')],'app':_0x4233('0x15'),'appdata':_0x4233('0x29'),'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'exten':_0x5e1530[_0x19f9d9][0x0]['exten'],'priority':_0x457ea3[_0x4233('0x10')]++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});_0x457ea3[_0x4233('0x11')][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')],'app':_0x4233('0x15'),'appdata':_0x4233('0x2a'),'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3['priority']++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0]['VoiceExtensionId']});_0x457ea3[_0x4233('0x11')][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0]['type'],'app':_0x4233('0x15'),'appdata':_0x4233('0x2b'),'context':_0x5e1530[_0x19f9d9][0x0]['context'],'exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'priority':_0x457ea3['priority']++,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});for(var _0x5a75a5=0x0,_0x25f96a=0x0;_0x5a75a5<_0x5e1530[_0x19f9d9][_0x4233('0x2c')];_0x5a75a5+=0x1,_0x25f96a=0x0){var _0x206d94=_0x5e1530[_0x19f9d9][_0x5a75a5];if(_0x206d94[_0x4233('0x18')]){_0x206d94['type']=_0x206d94['type'][_0x4233('0x2d')]();}var _0x357e13=[];var _0xdaf51e=[];delete _0x206d94['id'];delete _0x206d94[_0x4233('0x2e')];delete _0x206d94[_0x4233('0x2f')];var _0x19569d=_0x206d94['interval']!==_0x4233('0x30')?[_0x206d94[_0x4233('0x31')]]:_0x206d94[_0x4233('0x7')]?_['map'](_[_0x4233('0xc')](_0x457ea3[_0x4233('0x4')],{'IntervalId':_0x206d94['IntervalId']}),'interval'):[];if(_0x206d94[_0x4233('0xf')](_0x4233('0x32'))){if(_0x206d94['tag']&&_0x206d94[_0x4233('0x32')]!=='--'){_0x357e13[_0x4233('0x14')]({'type':_0x206d94[_0x4233('0x18')],'app':_0x4233('0x15'),'appdata':_0x4233('0x33')+_0x206d94[_0x4233('0x32')],'context':_0x206d94[_0x4233('0x19')],'exten':_0x206d94['exten'],'priority':_0x19569d['length']+_0x457ea3[_0x4233('0x10')]+_0x25f96a++,'VoiceExtensionId':_0x206d94['VoiceExtensionId']});}}if(_0x206d94['type']===_0x4233('0x1d')&&_0x206d94[_0x4233('0xf')]('callerID')){if(_0x206d94['callerID']){_0x357e13['push']({'type':_0x206d94[_0x4233('0x18')],'app':_0x4233('0x34'),'appdata':_0x4233('0x35')+_0x206d94[_0x4233('0x36')]+')','context':_0x206d94['context'],'exten':_0x206d94[_0x4233('0xa')],'priority':_0x19569d[_0x4233('0x2c')]+_0x457ea3[_0x4233('0x10')]+_0x25f96a++,'VoiceExtensionId':_0x206d94[_0x4233('0x1a')]});}else{_0x357e13[_0x4233('0x14')]({'type':_0x206d94[_0x4233('0x18')],'app':'ExecIf','appdata':_0x4233('0x37'),'context':_0x206d94[_0x4233('0x19')],'exten':_0x206d94[_0x4233('0xa')],'priority':_0x19569d[_0x4233('0x2c')]+_0x457ea3[_0x4233('0x10')]+_0x25f96a++,'VoiceExtensionId':_0x206d94[_0x4233('0x1a')]});}}if(_0x206d94[_0x4233('0xf')](_0x4233('0x38'))){if(_0x55814d[_0x4233('0x39')](_0x206d94[_0x4233('0x3a')][_0x4233('0x2d')]())>=0x0&&_0x206d94[_0x4233('0x3b')]!==_0x4233('0x3c')){if(_0x206d94[_0x4233('0x38')]){_0x357e13[_0x4233('0x14')]({'type':_0x206d94[_0x4233('0x18')],'app':'ExecIf','appdata':_0x4233('0x3d'),'context':_0x206d94[_0x4233('0x19')],'exten':_0x206d94[_0x4233('0xa')],'priority':_0x19569d['length']+_0x457ea3[_0x4233('0x10')]+_0x25f96a++,'VoiceExtensionId':_0x206d94[_0x4233('0x1a')]});_0x357e13['push']({'type':_0x206d94['type'],'app':_0x4233('0x15'),'appdata':_0x4233('0x3e'),'context':_0x206d94[_0x4233('0x19')],'exten':_0x206d94[_0x4233('0xa')],'priority':_0x19569d[_0x4233('0x2c')]+_0x457ea3[_0x4233('0x10')]+_0x25f96a++,'VoiceExtensionId':_0x206d94['VoiceExtensionId']});}else{_0x357e13[_0x4233('0x14')]({'type':_0x206d94[_0x4233('0x18')],'app':_0x4233('0x34'),'appdata':_0x4233('0x3f'),'context':_0x206d94[_0x4233('0x19')],'exten':_0x206d94[_0x4233('0xa')],'priority':_0x19569d[_0x4233('0x2c')]+_0x457ea3['priority']+_0x25f96a++,'VoiceExtensionId':_0x206d94['VoiceExtensionId']});_0x357e13[_0x4233('0x14')]({'type':_0x206d94[_0x4233('0x18')],'app':_0x4233('0x15'),'appdata':_0x4233('0x40'),'context':_0x206d94['context'],'exten':_0x206d94[_0x4233('0xa')],'priority':_0x19569d['length']+_0x457ea3[_0x4233('0x10')]+_0x25f96a++,'VoiceExtensionId':_0x206d94['VoiceExtensionId']});}}}for(var _0xb1acdc=0x0;_0xb1acdc<_0x19569d[_0x4233('0x2c')];_0xb1acdc+=0x1){var _0x4fcba4=_0x457ea3[_0x4233('0x10')]+_0x19569d[_0x4233('0x2c')];var _0x3c6dc0=_0xb1acdc===_0x19569d[_0x4233('0x2c')]-0x1?_0x457ea3[_0x4233('0x10')]+_0x357e13[_0x4233('0x2c')]+_0xdaf51e[_0x4233('0x2c')]+0x2:_0x457ea3[_0x4233('0x10')]+_0xb1acdc+0x1;_0x357e13['splice'](_0xb1acdc,0x0,{'type':_0x206d94[_0x4233('0x18')],'app':_0x4233('0x41'),'appdata':_0x19569d[_0xb1acdc]+'?'+_0x206d94[_0x4233('0x19')]+_0x4233('0x42')+_0x4fcba4+':'+_0x206d94[_0x4233('0x19')]+_0x4233('0x42')+_0x3c6dc0,'exten':_0x206d94[_0x4233('0xa')],'context':_0x206d94[_0x4233('0x19')],'priority':_0x457ea3['priority']+_0xb1acdc,'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});}_0x206d94[_0x4233('0x10')]=_0x357e13[_0x4233('0x2c')]?_['last'](_0x357e13)[_0x4233('0x10')]+0x1:_0x457ea3[_0x4233('0x10')];_0x457ea3[_0x4233('0x10')]=(_0xdaf51e['length']?_[_0x4233('0x43')](_0xdaf51e)[_0x4233('0x10')]:_0x206d94[_0x4233('0x10')])+0x1;_0x457ea3[_0x4233('0x11')]=_['concat'](_0x457ea3[_0x4233('0x11')],_0x357e13,[_0x206d94],_0xdaf51e);}_0x457ea3[_0x4233('0x11')][_0x4233('0x14')]({'type':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x18')],'app':'Hangup','exten':_0x5e1530[_0x19f9d9][0x0][_0x4233('0xa')],'context':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x19')],'priority':_0x457ea3[_0x4233('0x10')],'VoiceExtensionId':_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]});_0x9f3894[_0x4233('0x14')](_0x5e1530[_0x19f9d9][0x0][_0x4233('0x1a')]);_0x1c172e=_[_0x4233('0x44')](_0x1c172e,_0x457ea3[_0x4233('0x11')]);}}return _0x58781f[_0x4233('0x45')](function(_0x5c130d){return _0x58781f[_0x4233('0x5')][_0x4233('0x6')][_0x4233('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x9f3894}},'transaction':_0x5c130d})['then'](function(_0x72337a){return _0x58781f[_0x4233('0x5')][_0x4233('0x6')][_0x4233('0x47')](_[_0x4233('0x48')](_0x1c172e,_0x4233('0x10')),{'transaction':_0x5c130d});});});})['catch'](function(_0x26b464){console['error'](_0x26b464);});}exports[_0x4233('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ff6f75d..8cd8db7 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 _0xb4dd=['errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','insert','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','into','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','findAll','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','outbound','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xb4dd,0xc2));var _0xdb4d=function(_0x54c374,_0xc090f8){_0x54c374=_0x54c374-0x0;var _0x4f57fc=_0xb4dd[_0x54c374];return _0x4f57fc;};'use strict';var BPromise=require(_0xdb4d('0x0'));var util=require('util');var _=require(_0xdb4d('0x1'));var fs=require('fs');var squel=require(_0xdb4d('0x2'));var Papa=require('papaparse');var Redis=require(_0xdb4d('0x3'));var db=require(_0xdb4d('0x4'))['db'];var config=require(_0xdb4d('0x5'));var logger=require(_0xdb4d('0x6'))(_0xdb4d('0x7'));config[_0xdb4d('0x8')]=_[_0xdb4d('0x9')](config[_0xdb4d('0x8')],{'host':_0xdb4d('0xa'),'port':0x18eb});var socket=require(_0xdb4d('0xb'))(new Redis(config[_0xdb4d('0x8')]));require(_0xdb4d('0xc'))[_0xdb4d('0xd')](socket);try{if(!process[_0xdb4d('0xe')][0x2]||process[_0xdb4d('0xe')][0x2]===_0xdb4d('0xf')||process[_0xdb4d('0xe')][0x2]===_0xdb4d('0x10')){throw new Error(_0xdb4d('0x11'));}var FILEPATH=process[_0xdb4d('0xe')][0x2];if(!process[_0xdb4d('0xe')][0x3]||process[_0xdb4d('0xe')][0x3]===_0xdb4d('0xf')||process['argv'][0x3]===_0xdb4d('0x10')||!process[_0xdb4d('0xe')][0x4]||process[_0xdb4d('0xe')][0x4]==='undefined'||process['argv'][0x4]===_0xdb4d('0x10')){throw new Error(_0xdb4d('0x12'));}var FIELDS=_[_0xdb4d('0x13')](process['argv'][0x3][_0xdb4d('0x14')](','),process[_0xdb4d('0xe')][0x4][_0xdb4d('0x14')](','));if(!process['argv'][0x5]||process[_0xdb4d('0xe')][0x5]==='undefined'||process['argv'][0x5]===_0xdb4d('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xdb4d('0xe')][0x5];var COMPANYID=process[_0xdb4d('0xe')][0x6]&&process[_0xdb4d('0xe')][0x6]!==_0xdb4d('0xf')&&process[_0xdb4d('0xe')][0x6]!==_0xdb4d('0x10')?process[_0xdb4d('0xe')][0x6]:null;var DUPLICATES=process[_0xdb4d('0xe')][0x7]&&process[_0xdb4d('0xe')][0x7]!==_0xdb4d('0xf')&&process[_0xdb4d('0xe')][0x7]!==_0xdb4d('0x10')?process[_0xdb4d('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0xdb4d('0xe')][0x8]==='undefined'||process[_0xdb4d('0xe')][0x8]===_0xdb4d('0x10')){throw new Error(_0xdb4d('0x15'));}var SOCKET_TIMESTAMP=process[_0xdb4d('0xe')][0x8];}catch(_0x1ea612){logger[_0xdb4d('0x16')](_0x1ea612);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(_0x2749d4,_0x12120d,_0x2724f8,_0x33d800){var _0x490a29={'message':_0x12120d};_0x490a29[_0x2749d4]=!![];if(_0x2724f8){_0x490a29[_0xdb4d('0x17')]=_0x2724f8;}if(_0x33d800){_0x490a29[_0xdb4d('0x18')]=_0x33d800;}return _0x490a29;}function isEmail(_0x524c42){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))*$/[_0xdb4d('0x19')](_0x524c42);}function checkRow(_0x5e629b,_0x1abc85,_0x5cc036){return new BPromise(function(_0x7d152c,_0x11b293){if(_[_0xdb4d('0x1a')](_0x5e629b)){return _0x11b293(handleCheckRowError(_0xdb4d('0x16'),_0xdb4d('0x1b'),null,_0x5cc036));}if(_0x5e629b[_0xdb4d('0x1c')]&&_0x5e629b[_0xdb4d('0x1c')]['length']){var _0x5ebe94=_[_0xdb4d('0x1d')](_0x5e629b[_0xdb4d('0x1c')],_0xdb4d('0x1e'))[_0xdb4d('0x1f')](';');return _0x11b293(handleCheckRowError('error',_0x5ebe94,null,_0x5cc036));}var _0x5cc62d={};for(var _0x3f047b in FIELDS){if(FIELDS[_0xdb4d('0x20')](_0x3f047b)&&FIELDS[_0x3f047b]){_0x5cc62d[_0x3f047b]=_0x5e629b[_0xdb4d('0x21')][0x0][FIELDS[_0x3f047b]]||_0x5e629b[_0xdb4d('0x21')][0x0]['\ufeff'+FIELDS[_0x3f047b]];}}if(!_0x5cc62d[_0xdb4d('0x22')]){return _0x11b293(handleCheckRowError(_0xdb4d('0x16'),_0xdb4d('0x23'),null,_0x5cc036));}if(!_0x5cc62d[_0xdb4d('0x24')]){return _0x11b293(handleCheckRowError('error',_0xdb4d('0x25'),null,_0x5cc036));}if(_0x5cc62d['birthDate']){var _0x27ed33=moment(_0x5cc62d[_0xdb4d('0x26')],_0xdb4d('0x27'));if(!_0x27ed33['isValid']()){return _0x11b293(handleCheckRowError(_0xdb4d('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x5cc036));}}if(_0x5cc62d[_0xdb4d('0x28')]){if(!isEmail(_0x5cc62d['email'])){return _0x11b293(handleCheckRowError(_0xdb4d('0x16'),_0xdb4d('0x29'),null,_0x5cc036));}}_0x5cc62d[_0xdb4d('0x2a')]=LISTID;_0x5cc62d[_0xdb4d('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xdb4d('0x2c')]&&_0x1abc85){var _0xc90075={};for(var _0x29e8b4=0x0,_0x214452=DUPLICATES[_0xdb4d('0x2c')];_0x29e8b4<_0x214452;_0x29e8b4+=0x1){_0xc90075[DUPLICATES[_0x29e8b4]]=_0x5cc62d[DUPLICATES[_0x29e8b4]];}var _0x4b2db3=_['find'](_0x1abc85,_0xc90075);if(_0x4b2db3){return _0x11b293(handleCheckRowError(_0xdb4d('0x2d'),_0xdb4d('0x2e'),_0x4b2db3,_0x5cc036));}}return db[_0xdb4d('0x2f')][_0xdb4d('0x30')](_0x5cc62d,{'raw':!![],'hooks':![],'fields':_[_0xdb4d('0x31')](_0x5cc62d)})[_0xdb4d('0x32')](function(_0x53ed6d){if(DUPLICATES&&DUPLICATES[_0xdb4d('0x2c')]&&_0x1abc85){_0x1abc85[_0xdb4d('0x33')](_[_0xdb4d('0x34')](_0x5cc62d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x53ed6d['id'];return _0x7d152c();})[_0xdb4d('0x35')](function(_0x4dacdc){return _0x11b293(handleCheckRowError('error',_0xdb4d('0x36')+(_0x4dacdc[_0xdb4d('0x1e')]||JSON[_0xdb4d('0x37')](_0x4dacdc)),null,_0x5cc036));});});}function checkHopper(){function _0x57be11(){return function(_0x173c09){logger[_0xdb4d('0x16')](_0xdb4d('0x38'),'checkHopper',util['inspect'](_0x173c09,{'showHidden':![],'depth':null}));};}var _0x47f4d0=function(_0x538e57,_0x34d006){var _0x53c92d=squel[_0xdb4d('0x39')]()['into'](_0xdb4d('0x3a'))[_0xdb4d('0x3b')]([_0xdb4d('0x24'),_0xdb4d('0x3c'),_0xdb4d('0x3d'),_0xdb4d('0x2a'),_0x34d006,'createdAt',_0xdb4d('0x3e')],squel[_0xdb4d('0x3f')]()[_0xdb4d('0x40')](_0xdb4d('0x24'),_0xdb4d('0x24'))['field'](_0xdb4d('0x41'),_0xdb4d('0x3c'))['field']('id',_0xdb4d('0x3d'))[_0xdb4d('0x40')](LISTID[_0xdb4d('0x42')](),_0xdb4d('0x2a'))[_0xdb4d('0x40')](_0x538e57['id']['toString'](),_0x34d006)['field'](_0xdb4d('0x41'),_0xdb4d('0x43'))['field'](_0xdb4d('0x41'),'updatedAt')['from'](_0xdb4d('0x44'))['where'](_0xdb4d('0x45'))[_0xdb4d('0x46')](_0xdb4d('0x47'),LISTID[_0xdb4d('0x42')]())[_0xdb4d('0x46')](_0xdb4d('0x48'))[_0xdb4d('0x46')](_0xdb4d('0x49'),squel['select']()[_0xdb4d('0x40')](_0xdb4d('0x24'))[_0xdb4d('0x4a')](_0xdb4d('0x3a'))[_0xdb4d('0x46')](_0x34d006+_0xdb4d('0x4b'),_0x538e57['id'][_0xdb4d('0x42')]())))['toString']();return _0x53c92d;};var _0x2112e2=function(_0x44ec49,_0x3acad6){var _0x6f8099=squel[_0xdb4d('0x39')]()[_0xdb4d('0x4c')](_0xdb4d('0x3a'))[_0xdb4d('0x3b')](['phone',_0xdb4d('0x3c'),'ContactId','ListId',_0x3acad6,_0xdb4d('0x43'),_0xdb4d('0x3e')],squel['select']()['field'](_0xdb4d('0x24'),_0xdb4d('0x24'))[_0xdb4d('0x40')](_0xdb4d('0x41'),'scheduledAt')[_0xdb4d('0x40')]('id',_0xdb4d('0x3d'))[_0xdb4d('0x40')](LISTID[_0xdb4d('0x42')](),_0xdb4d('0x2a'))[_0xdb4d('0x40')](_0x44ec49['id']['toString'](),_0x3acad6)[_0xdb4d('0x40')](_0xdb4d('0x41'),_0xdb4d('0x43'))[_0xdb4d('0x40')](_0xdb4d('0x41'),_0xdb4d('0x3e'))['from']('cm_contacts')[_0xdb4d('0x46')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())[_0xdb4d('0x46')](_0xdb4d('0x4d'),squel[_0xdb4d('0x4e')](hopperContacts))[_0xdb4d('0x46')](_0xdb4d('0x48'))[_0xdb4d('0x46')](_0xdb4d('0x49'),squel['select']()[_0xdb4d('0x40')](_0xdb4d('0x4f'))[_0xdb4d('0x4a')](_0xdb4d('0x50'))['where'](_0x3acad6+_0xdb4d('0x4b'),_0x44ec49['id'][_0xdb4d('0x42')]()))[_0xdb4d('0x46')](_0xdb4d('0x49'),squel[_0xdb4d('0x3f')]()[_0xdb4d('0x40')](_0xdb4d('0x24'))[_0xdb4d('0x4a')](_0xdb4d('0x3a'))[_0xdb4d('0x46')](_0x3acad6+_0xdb4d('0x4b'),_0x44ec49['id'][_0xdb4d('0x42')]())))[_0xdb4d('0x42')]();return _0x6f8099;};function _0x4ddccf(_0x1b79ad,_0x2996f1){var _0x4b6585=squel['insert']()[_0xdb4d('0x4c')](_0xdb4d('0x3a'))[_0xdb4d('0x3b')]([_0xdb4d('0x24'),_0xdb4d('0x3c'),_0xdb4d('0x3d'),_0xdb4d('0x2a'),_0x2996f1,'createdAt',_0xdb4d('0x3e')],squel['select']()[_0xdb4d('0x40')](_0xdb4d('0x24'),_0xdb4d('0x24'))[_0xdb4d('0x40')](_0xdb4d('0x41'),_0xdb4d('0x3c'))[_0xdb4d('0x40')]('id',_0xdb4d('0x3d'))[_0xdb4d('0x40')](LISTID['toString'](),'ListId')[_0xdb4d('0x40')](_0x1b79ad['id'][_0xdb4d('0x42')](),_0x2996f1)['field'](_0xdb4d('0x41'),'createdAt')[_0xdb4d('0x40')]('NOW()',_0xdb4d('0x3e'))[_0xdb4d('0x4a')](_0xdb4d('0x44'))[_0xdb4d('0x46')](_0xdb4d('0x45'))[_0xdb4d('0x46')](_0xdb4d('0x47'),LISTID[_0xdb4d('0x42')]())['where'](_0xdb4d('0x4d'),squel[_0xdb4d('0x4e')](hopperContacts))[_0xdb4d('0x46')](_0xdb4d('0x48')))[_0xdb4d('0x42')]();return _0x4b6585;}function _0x270208(_0xa912fe,_0x3faeaa){var _0x56e6bf=squel[_0xdb4d('0x39')]()[_0xdb4d('0x4c')](_0xdb4d('0x51'))[_0xdb4d('0x3b')]([_0xdb4d('0x24'),_0xdb4d('0x3d'),_0xdb4d('0x2a'),_0x3faeaa,_0xdb4d('0x43'),_0xdb4d('0x3e')],squel[_0xdb4d('0x3f')]()[_0xdb4d('0x40')](_0xdb4d('0x24'),_0xdb4d('0x24'))[_0xdb4d('0x40')]('id',_0xdb4d('0x3d'))['field'](LISTID[_0xdb4d('0x42')](),_0xdb4d('0x2a'))[_0xdb4d('0x40')](_0xa912fe['id'][_0xdb4d('0x42')](),_0x3faeaa)[_0xdb4d('0x40')](_0xdb4d('0x41'),_0xdb4d('0x43'))['field'](_0xdb4d('0x41'),'updatedAt')['from'](_0xdb4d('0x44'))[_0xdb4d('0x46')](_0xdb4d('0x45'))[_0xdb4d('0x46')](_0xdb4d('0x47'),LISTID[_0xdb4d('0x42')]())['where'](_0xdb4d('0x4d'),squel['str'](hopperContacts))['where'](_0xdb4d('0x48')))[_0xdb4d('0x42')]();return _0x56e6bf;}return db['VoiceQueue'][_0xdb4d('0x52')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xdb4d('0x53')],'as':_0xdb4d('0x54'),'where':{'id':LISTID}}]})[_0xdb4d('0x32')](function(_0x3fc574){var _0x56c780=[];if(_0x3fc574){var _0x462ea7;for(var _0x32ad9a=0x0,_0x31b302;_0x32ad9a<_0x3fc574[_0xdb4d('0x2c')];_0x32ad9a+=0x1){_0x31b302=_0x3fc574[_0x32ad9a][_0xdb4d('0x55')]({'plain':!![]});switch(_0x31b302[_0xdb4d('0x56')]){case _0xdb4d('0x57'):_0x56c780[_0xdb4d('0x33')](db[_0xdb4d('0x58')]['query'](_0x2112e2(_0x31b302,_0xdb4d('0x59')))['then'](function(){})['catch'](_0x57be11()));break;case _0xdb4d('0x5a'):_0x56c780[_0xdb4d('0x33')](db[_0xdb4d('0x58')][_0xdb4d('0x5b')](_0x47f4d0(_0x31b302,'VoiceQueueId'))[_0xdb4d('0x32')](function(){})[_0xdb4d('0x35')](_0x57be11()));break;default:_0x56c780[_0xdb4d('0x33')](db[_0xdb4d('0x58')]['query'](_0x4ddccf(_0x31b302,_0xdb4d('0x59')))[_0xdb4d('0x32')](function(){})['catch'](_0x57be11()));}}}return _0x56c780;})[_0xdb4d('0x5c')]()[_0xdb4d('0x32')](function(){return db['VoiceQueue'][_0xdb4d('0x52')]({'where':{'type':_0xdb4d('0x5d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xdb4d('0x5e'),'where':{'id':LISTID}}]})[_0xdb4d('0x32')](function(_0x7f3c39){var _0x34bfe8=[];if(_0x7f3c39){var _0x5307e0;for(var _0x437425=0x0,_0x53a34b;_0x437425<_0x7f3c39[_0xdb4d('0x2c')];_0x437425+=0x1){_0x53a34b=_0x7f3c39[_0x437425]['get']({'plain':!![]});_0x34bfe8['push'](db['sequelize']['query'](_0x270208(_0x53a34b,_0xdb4d('0x59')))[_0xdb4d('0x32')](function(){})[_0xdb4d('0x35')](_0x57be11()));}}return _0x34bfe8;})[_0xdb4d('0x5c')]();})[_0xdb4d('0x32')](function(){return db[_0xdb4d('0x5f')][_0xdb4d('0x52')]({'attributes':['id',_0xdb4d('0x56')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xdb4d('0x32')](function(_0x49587a){var _0x33d64e=[];if(_0x49587a){for(var _0x53b88e=0x0,_0x4fd836;_0x53b88e<_0x49587a['length'];_0x53b88e+=0x1){_0x4fd836=_0x49587a[_0x53b88e][_0xdb4d('0x55')]({'plain':!![]});switch(_0x4fd836[_0xdb4d('0x56')]){case _0xdb4d('0x57'):_0x33d64e['push'](db[_0xdb4d('0x58')][_0xdb4d('0x5b')](_0x2112e2(_0x4fd836,'CampaignId'))['then'](function(){})[_0xdb4d('0x35')](_0x57be11()));break;case _0xdb4d('0x5a'):_0x33d64e[_0xdb4d('0x33')](db[_0xdb4d('0x58')][_0xdb4d('0x5b')](_0x47f4d0(_0x4fd836,_0xdb4d('0x60')))[_0xdb4d('0x32')](function(){})[_0xdb4d('0x35')](_0x57be11()));break;default:_0x33d64e[_0xdb4d('0x33')](db['sequelize'][_0xdb4d('0x5b')](_0x4ddccf(_0x4fd836,_0xdb4d('0x60')))[_0xdb4d('0x32')](function(){})[_0xdb4d('0x35')](_0x57be11()));}}}return _0x33d64e;})[_0xdb4d('0x5c')]();})[_0xdb4d('0x32')](function(){return db[_0xdb4d('0x5f')][_0xdb4d('0x52')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x3b86b8){var _0x6673d9=[];if(_0x3b86b8){for(var _0x507c50=0x0,_0x23184e;_0x507c50<_0x3b86b8['length'];_0x507c50+=0x1){_0x23184e=_0x3b86b8[_0x507c50]['get']({'plain':!![]});_0x6673d9[_0xdb4d('0x33')](db[_0xdb4d('0x58')][_0xdb4d('0x5b')](_0x270208(_0x23184e,_0xdb4d('0x60')))[_0xdb4d('0x32')](function(){})[_0xdb4d('0x35')](_0x57be11()));}}return _0x6673d9;})[_0xdb4d('0x5c')]();})[_0xdb4d('0x35')](function(_0x2bd819){logger['error'](_0xdb4d('0x61'),'generalCheckHopper',_0x2bd819[_0xdb4d('0x1e')]);});}var processPromises=function(_0x34519e){return BPromise[_0xdb4d('0x5c')](promises)[_0xdb4d('0x32')](function(_0x5dff53){})[_0xdb4d('0x35')](function(_0x781964){logger[_0xdb4d('0x16')](_0xdb4d('0x62'),JSON[_0xdb4d('0x37')](_0x781964));})[_0xdb4d('0x63')](function(){socket[_0xdb4d('0x64')](_0xdb4d('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x34519e){return _0x34519e['resume']();}});};var endCsv=function(){return BPromise[_0xdb4d('0x66')]()[_0xdb4d('0x32')](function(){if(hopperContacts){return checkHopper();}})[_0xdb4d('0x32')](function(){socket['emit'](_0xdb4d('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdb4d('0x67')](FILEPATH);}catch(_0x25044e){logger[_0xdb4d('0x16')](_0xdb4d('0x68'),JSON[_0xdb4d('0x37')](_0x25044e));}finally{process['exit'](0x0);}});};process['on'](_0xdb4d('0x69'),function(){logger[_0xdb4d('0x6a')](_0xdb4d('0x6b'));endCsv();});function main(){return BPromise[_0xdb4d('0x66')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdb4d('0x14')](',');return db[_0xdb4d('0x2f')][_0xdb4d('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xdb4d('0x32')](function(_0x4f8621){var _0x39ea44=fs[_0xdb4d('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x39ea44,{'header':!![],'skipEmptyLines':!![],'step':function(_0x25712c,_0x1eded8){total+=0x1;var _0x33cda3=total;promises[_0xdb4d('0x33')](checkRow(_0x25712c,_0x4f8621,_0x33cda3)[_0xdb4d('0x32')](function(){success+=0x1;})[_0xdb4d('0x35')](function(_0x2cd610){if(_0x2cd610[_0xdb4d('0x16')]){errors+=0x1;delete _0x2cd610[_0xdb4d('0x16')];}else if(_0x2cd610[_0xdb4d('0x2d')]){duplicates+=0x1;delete _0x2cd610[_0xdb4d('0x2d')];}rows['push'](_0x2cd610);}));if(total%0xc8===0x0){_0x1eded8['pause']();return processPromises(_0x1eded8);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0xdb4d('0x6d'));endCsv();});},'error':function(_0x4de95f,_0x20d8be){logger[_0xdb4d('0x6a')](_0xdb4d('0x6e'),JSON[_0xdb4d('0x37')](_0x4de95f));endCsv();}});})[_0xdb4d('0x35')](function(_0x110815){logger[_0xdb4d('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x110815));});}main(); \ No newline at end of file +var _0x33de=['redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','errors','map','message','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','CmContact','create','keys','push','pick','catch','stringify','cmContact','inspect','insert','fromQuery','ContactId','select','field','NOW()','toString','createdAt','updatedAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','into','scheduledAt','cm_hopper_black','VoiceQueue','outbound','CmList','Lists','then','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','BlackLists','Campaign','dialCheckDuplicateType','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','createReadStream','parse','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','../../../mysqldb','../../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x33de,0x1a5));var _0xe33d=function(_0xbba421,_0x81d172){_0xbba421=_0xbba421-0x0;var _0x420880=_0x33de[_0xbba421];return _0x420880;};'use strict';var BPromise=require(_0xe33d('0x0'));var util=require(_0xe33d('0x1'));var _=require(_0xe33d('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xe33d('0x3'));var Redis=require('ioredis');var db=require(_0xe33d('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xe33d('0x5'))(_0xe33d('0x6'));config[_0xe33d('0x7')]=_[_0xe33d('0x8')](config[_0xe33d('0x7')],{'host':_0xe33d('0x9'),'port':0x18eb});var socket=require(_0xe33d('0xa'))(new Redis(config[_0xe33d('0x7')]));require(_0xe33d('0xb'))[_0xe33d('0xc')](socket);try{if(!process[_0xe33d('0xd')][0x2]||process[_0xe33d('0xd')][0x2]===_0xe33d('0xe')||process[_0xe33d('0xd')][0x2]===_0xe33d('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xe33d('0xd')][0x3]||process[_0xe33d('0xd')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process[_0xe33d('0xd')][0x4]||process[_0xe33d('0xd')][0x4]==='undefined'||process[_0xe33d('0xd')][0x4]===_0xe33d('0xf')){throw new Error(_0xe33d('0x10'));}var FIELDS=_[_0xe33d('0x11')](process[_0xe33d('0xd')][0x3][_0xe33d('0x12')](','),process[_0xe33d('0xd')][0x4][_0xe33d('0x12')](','));if(!process['argv'][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]===_0xe33d('0xf')){throw new Error(_0xe33d('0x13'));}var LISTID=process[_0xe33d('0xd')][0x5];var COMPANYID=process[_0xe33d('0xd')][0x6]&&process[_0xe33d('0xd')][0x6]!==_0xe33d('0xe')&&process[_0xe33d('0xd')][0x6]!==_0xe33d('0xf')?process[_0xe33d('0xd')][0x6]:null;var DUPLICATES=process[_0xe33d('0xd')][0x7]&&process[_0xe33d('0xd')][0x7]!=='undefined'&&process[_0xe33d('0xd')][0x7]!=='null'?process[_0xe33d('0xd')][0x7]:null;if(!process[_0xe33d('0xd')][0x8]||process[_0xe33d('0xd')][0x8]===_0xe33d('0xe')||process[_0xe33d('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xe33d('0xd')][0x8];}catch(_0x2fdfae){logger[_0xe33d('0x14')](_0x2fdfae);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(_0x524985,_0x1ae520,_0x653ee3,_0xb277a6){var _0xcb6c={'message':_0x1ae520};_0xcb6c[_0x524985]=!![];if(_0x653ee3){_0xcb6c[_0xe33d('0x15')]=_0x653ee3;}if(_0xb277a6){_0xcb6c[_0xe33d('0x16')]=_0xb277a6;}return _0xcb6c;}function isEmail(_0x4531f9){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'](_0x4531f9);}function checkRow(_0x4181cd,_0xa37ab9,_0xba8f78){return new BPromise(function(_0x2914fb,_0x2887ba){if(_[_0xe33d('0x17')](_0x4181cd)){return _0x2887ba(handleCheckRowError(_0xe33d('0x14'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xba8f78));}if(_0x4181cd['errors']&&_0x4181cd[_0xe33d('0x18')]['length']){var _0x317e7c=_[_0xe33d('0x19')](_0x4181cd['errors'],_0xe33d('0x1a'))['join'](';');return _0x2887ba(handleCheckRowError(_0xe33d('0x14'),_0x317e7c,null,_0xba8f78));}var _0x1ad5cd={};for(var _0x56944b in FIELDS){if(FIELDS['hasOwnProperty'](_0x56944b)&&FIELDS[_0x56944b]){_0x1ad5cd[_0x56944b]=_0x4181cd[_0xe33d('0x1b')][0x0][FIELDS[_0x56944b]]||_0x4181cd[_0xe33d('0x1b')][0x0]['\ufeff'+FIELDS[_0x56944b]];}}if(!_0x1ad5cd['firstName']){return _0x2887ba(handleCheckRowError(_0xe33d('0x14'),_0xe33d('0x1c'),null,_0xba8f78));}if(!_0x1ad5cd[_0xe33d('0x1d')]){return _0x2887ba(handleCheckRowError('error',_0xe33d('0x1e'),null,_0xba8f78));}if(_0x1ad5cd[_0xe33d('0x1f')]){var _0x1b4f4f=moment(_0x1ad5cd[_0xe33d('0x1f')],_0xe33d('0x20'));if(!_0x1b4f4f[_0xe33d('0x21')]()){return _0x2887ba(handleCheckRowError(_0xe33d('0x14'),_0xe33d('0x22'),null,_0xba8f78));}}if(_0x1ad5cd[_0xe33d('0x23')]){if(!isEmail(_0x1ad5cd[_0xe33d('0x23')])){return _0x2887ba(handleCheckRowError(_0xe33d('0x14'),_0xe33d('0x24'),null,_0xba8f78));}}_0x1ad5cd[_0xe33d('0x25')]=LISTID;_0x1ad5cd[_0xe33d('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe33d('0x27')]&&_0xa37ab9){var _0x2e92b3={};for(var _0x21354e=0x0,_0x396b5b=DUPLICATES[_0xe33d('0x27')];_0x21354e<_0x396b5b;_0x21354e+=0x1){_0x2e92b3[DUPLICATES[_0x21354e]]=_0x1ad5cd[DUPLICATES[_0x21354e]];}var _0x5d5934=_[_0xe33d('0x28')](_0xa37ab9,_0x2e92b3);if(_0x5d5934){return _0x2887ba(handleCheckRowError(_0xe33d('0x29'),'Duplicate\x20Contact',_0x5d5934,_0xba8f78));}}return db[_0xe33d('0x2a')][_0xe33d('0x2b')](_0x1ad5cd,{'raw':!![],'hooks':![],'fields':_[_0xe33d('0x2c')](_0x1ad5cd)})['then'](function(_0x39097b){if(DUPLICATES&&DUPLICATES[_0xe33d('0x27')]&&_0xa37ab9){_0xa37ab9[_0xe33d('0x2d')](_[_0xe33d('0x2e')](_0x1ad5cd,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x39097b['id'];return _0x2914fb();})[_0xe33d('0x2f')](function(_0x40bc08){return _0x2887ba(handleCheckRowError(_0xe33d('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x40bc08['message']||JSON[_0xe33d('0x30')](_0x40bc08)),null,_0xba8f78));});});}function checkHopper(){function _0x424f2d(){return function(_0x39463e){logger['error'](_0xe33d('0x31'),'checkHopper',util[_0xe33d('0x32')](_0x39463e,{'showHidden':![],'depth':null}));};}var _0x6d40a1=function(_0x10b4bb,_0x5d8507){var _0x1e232f=squel[_0xe33d('0x33')]()['into']('cm_hopper')[_0xe33d('0x34')]([_0xe33d('0x1d'),'scheduledAt',_0xe33d('0x35'),_0xe33d('0x25'),_0x5d8507,'createdAt','updatedAt'],squel[_0xe33d('0x36')]()[_0xe33d('0x37')](_0xe33d('0x1d'),_0xe33d('0x1d'))['field'](_0xe33d('0x38'),'scheduledAt')[_0xe33d('0x37')]('id','ContactId')[_0xe33d('0x37')](LISTID[_0xe33d('0x39')](),'ListId')[_0xe33d('0x37')](_0x10b4bb['id'][_0xe33d('0x39')](),_0x5d8507)[_0xe33d('0x37')](_0xe33d('0x38'),_0xe33d('0x3a'))[_0xe33d('0x37')]('NOW()',_0xe33d('0x3b'))[_0xe33d('0x3c')]('cm_contacts')[_0xe33d('0x3d')](_0xe33d('0x3e'))[_0xe33d('0x3d')](_0xe33d('0x3f'),LISTID[_0xe33d('0x39')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe33d('0x3d')](_0xe33d('0x40'),squel[_0xe33d('0x36')]()[_0xe33d('0x37')](_0xe33d('0x1d'))['from']('cm_hopper')['where'](_0x5d8507+_0xe33d('0x41'),_0x10b4bb['id'][_0xe33d('0x39')]())))['toString']();return _0x1e232f;};var _0x4b8100=function(_0x5afb0a,_0x26966a){var _0x24bd60=squel['insert']()['into'](_0xe33d('0x42'))[_0xe33d('0x34')]([_0xe33d('0x1d'),'scheduledAt','ContactId','ListId',_0x26966a,_0xe33d('0x3a'),_0xe33d('0x3b')],squel[_0xe33d('0x36')]()[_0xe33d('0x37')]('phone','phone')['field'](_0xe33d('0x38'),'scheduledAt')[_0xe33d('0x37')]('id',_0xe33d('0x35'))[_0xe33d('0x37')](LISTID['toString'](),_0xe33d('0x25'))[_0xe33d('0x37')](_0x5afb0a['id'][_0xe33d('0x39')](),_0x26966a)['field']('NOW()','createdAt')['field'](_0xe33d('0x38'),_0xe33d('0x3b'))[_0xe33d('0x3c')](_0xe33d('0x43'))[_0xe33d('0x3d')](_0xe33d('0x3e'))[_0xe33d('0x3d')](_0xe33d('0x3f'),LISTID[_0xe33d('0x39')]())[_0xe33d('0x3d')](_0xe33d('0x44'),squel[_0xe33d('0x45')](hopperContacts))[_0xe33d('0x3d')](_0xe33d('0x46'))['where'](_0xe33d('0x40'),squel[_0xe33d('0x36')]()[_0xe33d('0x37')](_0xe33d('0x47'))[_0xe33d('0x3c')](_0xe33d('0x48'))[_0xe33d('0x3d')](_0x26966a+'\x20=\x20?',_0x5afb0a['id'][_0xe33d('0x39')]()))['where'](_0xe33d('0x40'),squel[_0xe33d('0x36')]()[_0xe33d('0x37')](_0xe33d('0x1d'))['from'](_0xe33d('0x42'))[_0xe33d('0x3d')](_0x26966a+_0xe33d('0x41'),_0x5afb0a['id'][_0xe33d('0x39')]())))['toString']();return _0x24bd60;};function _0x1e042d(_0x16e24b,_0xefdd57){var _0x1e54ec=squel[_0xe33d('0x33')]()[_0xe33d('0x49')]('cm_hopper')[_0xe33d('0x34')]([_0xe33d('0x1d'),_0xe33d('0x4a'),_0xe33d('0x35'),_0xe33d('0x25'),_0xefdd57,'createdAt',_0xe33d('0x3b')],squel['select']()[_0xe33d('0x37')]('phone',_0xe33d('0x1d'))['field']('NOW()',_0xe33d('0x4a'))[_0xe33d('0x37')]('id',_0xe33d('0x35'))[_0xe33d('0x37')](LISTID[_0xe33d('0x39')](),_0xe33d('0x25'))[_0xe33d('0x37')](_0x16e24b['id'][_0xe33d('0x39')](),_0xefdd57)[_0xe33d('0x37')]('NOW()','createdAt')[_0xe33d('0x37')]('NOW()',_0xe33d('0x3b'))[_0xe33d('0x3c')](_0xe33d('0x43'))['where'](_0xe33d('0x3e'))[_0xe33d('0x3d')](_0xe33d('0x3f'),LISTID[_0xe33d('0x39')]())[_0xe33d('0x3d')](_0xe33d('0x44'),squel['str'](hopperContacts))[_0xe33d('0x3d')](_0xe33d('0x46')))[_0xe33d('0x39')]();return _0x1e54ec;}function _0x4d4cc9(_0xae65c3,_0x31e644){var _0x7e6c62=squel[_0xe33d('0x33')]()['into'](_0xe33d('0x4b'))[_0xe33d('0x34')]([_0xe33d('0x1d'),_0xe33d('0x35'),_0xe33d('0x25'),_0x31e644,_0xe33d('0x3a'),'updatedAt'],squel[_0xe33d('0x36')]()['field'](_0xe33d('0x1d'),'phone')[_0xe33d('0x37')]('id',_0xe33d('0x35'))['field'](LISTID[_0xe33d('0x39')](),'ListId')[_0xe33d('0x37')](_0xae65c3['id'][_0xe33d('0x39')](),_0x31e644)[_0xe33d('0x37')](_0xe33d('0x38'),_0xe33d('0x3a'))[_0xe33d('0x37')](_0xe33d('0x38'),_0xe33d('0x3b'))['from']('cm_contacts')[_0xe33d('0x3d')](_0xe33d('0x3e'))['where'](_0xe33d('0x3f'),LISTID[_0xe33d('0x39')]())['where'](_0xe33d('0x44'),squel[_0xe33d('0x45')](hopperContacts))[_0xe33d('0x3d')](_0xe33d('0x46')))['toString']();return _0x7e6c62;}return db[_0xe33d('0x4c')]['findAll']({'where':{'type':_0xe33d('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe33d('0x4e')],'as':_0xe33d('0x4f'),'where':{'id':LISTID}}]})[_0xe33d('0x50')](function(_0x21e10d){var _0x19c010=[];if(_0x21e10d){var _0x9934fe;for(var _0x469988=0x0,_0x2cbd9c;_0x469988<_0x21e10d[_0xe33d('0x27')];_0x469988+=0x1){_0x2cbd9c=_0x21e10d[_0x469988][_0xe33d('0x51')]({'plain':!![]});switch(_0x2cbd9c['dialCheckDuplicateType']){case _0xe33d('0x52'):_0x19c010[_0xe33d('0x2d')](db[_0xe33d('0x53')][_0xe33d('0x54')](_0x4b8100(_0x2cbd9c,_0xe33d('0x55')))[_0xe33d('0x50')](function(){})[_0xe33d('0x2f')](_0x424f2d()));break;case _0xe33d('0x56'):_0x19c010[_0xe33d('0x2d')](db[_0xe33d('0x53')][_0xe33d('0x54')](_0x6d40a1(_0x2cbd9c,_0xe33d('0x55')))[_0xe33d('0x50')](function(){})[_0xe33d('0x2f')](_0x424f2d()));break;default:_0x19c010['push'](db[_0xe33d('0x53')][_0xe33d('0x54')](_0x1e042d(_0x2cbd9c,_0xe33d('0x55')))[_0xe33d('0x50')](function(){})[_0xe33d('0x2f')](_0x424f2d()));}}}return _0x19c010;})[_0xe33d('0x57')]()[_0xe33d('0x50')](function(){return db[_0xe33d('0x4c')][_0xe33d('0x58')]({'where':{'type':_0xe33d('0x4d')},'attributes':['id'],'include':[{'model':db[_0xe33d('0x4e')],'as':_0xe33d('0x59'),'where':{'id':LISTID}}]})[_0xe33d('0x50')](function(_0x36f10b){var _0x413b8e=[];if(_0x36f10b){var _0xea0391;for(var _0x312998=0x0,_0x3be7cb;_0x312998<_0x36f10b['length'];_0x312998+=0x1){_0x3be7cb=_0x36f10b[_0x312998][_0xe33d('0x51')]({'plain':!![]});_0x413b8e['push'](db[_0xe33d('0x53')][_0xe33d('0x54')](_0x4d4cc9(_0x3be7cb,_0xe33d('0x55')))['then'](function(){})[_0xe33d('0x2f')](_0x424f2d()));}}return _0x413b8e;})[_0xe33d('0x57')]();})[_0xe33d('0x50')](function(){return db[_0xe33d('0x5a')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe33d('0x4e')],'as':_0xe33d('0x4f'),'where':{'id':LISTID}}]})[_0xe33d('0x50')](function(_0x39e0e8){var _0x30d32d=[];if(_0x39e0e8){for(var _0x17fe64=0x0,_0x10c4a2;_0x17fe64<_0x39e0e8['length'];_0x17fe64+=0x1){_0x10c4a2=_0x39e0e8[_0x17fe64][_0xe33d('0x51')]({'plain':!![]});switch(_0x10c4a2[_0xe33d('0x5b')]){case'always':_0x30d32d[_0xe33d('0x2d')](db[_0xe33d('0x53')]['query'](_0x4b8100(_0x10c4a2,'CampaignId'))[_0xe33d('0x50')](function(){})[_0xe33d('0x2f')](_0x424f2d()));break;case _0xe33d('0x56'):_0x30d32d[_0xe33d('0x2d')](db[_0xe33d('0x53')][_0xe33d('0x54')](_0x6d40a1(_0x10c4a2,_0xe33d('0x5c')))[_0xe33d('0x50')](function(){})[_0xe33d('0x2f')](_0x424f2d()));break;default:_0x30d32d[_0xe33d('0x2d')](db[_0xe33d('0x53')][_0xe33d('0x54')](_0x1e042d(_0x10c4a2,_0xe33d('0x5c')))[_0xe33d('0x50')](function(){})[_0xe33d('0x2f')](_0x424f2d()));}}}return _0x30d32d;})['all']();})[_0xe33d('0x50')](function(){return db[_0xe33d('0x5a')][_0xe33d('0x58')]({'attributes':['id'],'include':[{'model':db[_0xe33d('0x4e')],'as':_0xe33d('0x59'),'where':{'id':LISTID}}]})[_0xe33d('0x50')](function(_0x285135){var _0x44c56b=[];if(_0x285135){for(var _0x374dae=0x0,_0x43602f;_0x374dae<_0x285135[_0xe33d('0x27')];_0x374dae+=0x1){_0x43602f=_0x285135[_0x374dae][_0xe33d('0x51')]({'plain':!![]});_0x44c56b[_0xe33d('0x2d')](db[_0xe33d('0x53')][_0xe33d('0x54')](_0x4d4cc9(_0x43602f,_0xe33d('0x5c')))[_0xe33d('0x50')](function(){})[_0xe33d('0x2f')](_0x424f2d()));}}return _0x44c56b;})[_0xe33d('0x57')]();})[_0xe33d('0x2f')](function(_0x1efb52){logger[_0xe33d('0x14')]('cmContact,\x20%s,\x20%s',_0xe33d('0x5d'),_0x1efb52[_0xe33d('0x1a')]);});}var processPromises=function(_0x410962){return BPromise[_0xe33d('0x57')](promises)[_0xe33d('0x50')](function(_0x434e34){})[_0xe33d('0x2f')](function(_0x278dec){logger[_0xe33d('0x14')](_0xe33d('0x5e'),JSON[_0xe33d('0x30')](_0x278dec));})[_0xe33d('0x5f')](function(){socket[_0xe33d('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x410962){return _0x410962[_0xe33d('0x61')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe33d('0x50')](function(){socket[_0xe33d('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe33d('0x62')](FILEPATH);}catch(_0x3766fd){logger[_0xe33d('0x14')](_0xe33d('0x63'),JSON[_0xe33d('0x30')](_0x3766fd));}finally{process[_0xe33d('0x64')](0x0);}});};process['on']('SIGINT',function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xe33d('0x50')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe33d('0x12')](',');return db[_0xe33d('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe33d('0x50')](function(_0x5dc2a1){var _0xffa8a=fs[_0xe33d('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe33d('0x66')](_0xffa8a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x218c3f,_0xdfa4c4){total+=0x1;var _0x1174a7=total;promises['push'](checkRow(_0x218c3f,_0x5dc2a1,_0x1174a7)[_0xe33d('0x50')](function(){success+=0x1;})[_0xe33d('0x2f')](function(_0x472466){if(_0x472466[_0xe33d('0x14')]){errors+=0x1;delete _0x472466[_0xe33d('0x14')];}else if(_0x472466[_0xe33d('0x29')]){duplicates+=0x1;delete _0x472466[_0xe33d('0x29')];}rows[_0xe33d('0x2d')](_0x472466);}));if(total%0xc8===0x0){_0xdfa4c4['pause']();return processPromises(_0xdfa4c4);}},'complete':function(){return processPromises()[_0xe33d('0x50')](function(){logger['info'](_0xe33d('0x67'));endCsv();});},'error':function(_0x2461fa,_0x58a3e5){logger[_0xe33d('0x68')](_0xe33d('0x69'),JSON[_0xe33d('0x30')](_0x2461fa));endCsv();}});})[_0xe33d('0x2f')](function(_0x2e913c){logger[_0xe33d('0x14')](_0xe33d('0x6a'),JSON[_0xe33d('0x30')](_0x2e913c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c1150cd..ae220ab 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 _0x3190=['voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','unlink','catch','complete','argv','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','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(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','ListId\x20=\x20?','toString','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','spread','main','stringify','send','start','binding','root','server/files/tmp','keys','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','scheduledat','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x3190,0x99));var _0x0319=function(_0x1c143e,_0x53f10c){_0x1c143e=_0x1c143e-0x0;var _0x5599de=_0x3190[_0x1c143e];return _0x5599de;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x0319('0x0'));var Papa=require(_0x0319('0x1'));var util=require('util');var BPromise=require(_0x0319('0x2'));var moment=require(_0x0319('0x3'));var squel=require(_0x0319('0x4'));var Redis=require(_0x0319('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x0319('0x6'));var logger=require(_0x0319('0x7'))('import');config[_0x0319('0x8')]=_[_0x0319('0x9')](config[_0x0319('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0319('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x0319('0xb'));function isEmail(_0x1fe92b){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))*$/[_0x0319('0xc')](_0x1fe92b);}function selectNotIn(_0x1d013d,_0x5cfba0,_0x6eec96,_0x10ffed,_0x5ab240){return squel[_0x0319('0xd')]()[_0x0319('0xe')](_0x0319('0xf'))[_0x0319('0x10')](_0x10ffed)[_0x0319('0x11')](_0x5cfba0,null,_0x5cfba0+_0x0319('0x12')+_0x10ffed+'.'+_0x6eec96)[_0x0319('0x13')](_0x10ffed+'.'+_0x6eec96+_0x0319('0x14')+_0x1d013d+'.'+_0x6eec96)[_0x0319('0x13')](_0x5cfba0+_0x0319('0x15')+_0x5ab240['join']()+')');}function insertCmHopper(_0x551edb,_0x45ef62,_0x1bc083,_0x7ea96c,_0x4a7268){var _0x1d4ca0=[_0x0319('0x16'),_0x0319('0x17'),_0x0319('0x18'),_0x0319('0x19'),_0x45ef62+'.'+_0x7ea96c,_0x0319('0x1a'),'cm_contacts.updatedAt',_0x0319('0x1b'),_0x0319('0x1c'),'\x22'+_0x4a7268+'\x22'];return squel[_0x0319('0x1d')]()[_0x0319('0x1e')]('cm_hopper')[_0x0319('0x1f')]([_0x0319('0xf'),'scheduledat',_0x0319('0x20'),_0x0319('0x21'),_0x7ea96c,_0x0319('0x22'),_0x0319('0x23'),_0x0319('0x24'),_0x0319('0x25'),_0x0319('0x26')],squel[_0x0319('0xd')]()[_0x0319('0x27')](_0x1d4ca0)['from'](_0x45ef62)[_0x0319('0x11')](_0x0319('0x28'),null,_0x0319('0x29')+_0x45ef62+_0x0319('0x2a'))['join'](_0x1bc083,null,_0x1bc083+_0x0319('0x12')+_0x45ef62+'.'+_0x7ea96c)[_0x0319('0x13')](_0x45ef62+_0x0319('0x2b'),_0x551edb)['where'](_0x0319('0x2c'),NOW)[_0x0319('0x13')](_0x0319('0x2d'),selectNotIn(_0x45ef62,_0x1bc083,_0x7ea96c,_0x0319('0x2e'),[_0x0319('0x2f'),_0x0319('0x30')]))[_0x0319('0x13')](_0x0319('0x2d'),selectNotIn(_0x45ef62,_0x1bc083,_0x7ea96c,_0x0319('0x2e'),[_0x0319('0x2f')])))['toString']();}function insertCmHopperBlack(_0x5342da,_0x2d57aa,_0x8bb188,_0x210db1){var _0x19e6cc=[_0x0319('0x16'),_0x0319('0x18'),_0x0319('0x19'),_0x2d57aa+'.'+_0x210db1,_0x0319('0x1a'),'cm_contacts.updatedAt'];return squel[_0x0319('0x1d')]()['into']('cm_hopper_black')['fromQuery']([_0x0319('0xf'),'ContactId',_0x0319('0x21'),_0x210db1,'createdAt',_0x0319('0x23')],squel[_0x0319('0xd')]()['fields'](_0x19e6cc)[_0x0319('0x10')](_0x2d57aa)[_0x0319('0x11')]('cm_contacts',null,_0x0319('0x29')+_0x2d57aa+'.CmListId')['join'](_0x8bb188,null,_0x8bb188+'.id\x20=\x20'+_0x2d57aa+'.'+_0x210db1)['where'](_0x2d57aa+_0x0319('0x2b'),_0x5342da)[_0x0319('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x0319('0x2d'),squel['select']()[_0x0319('0xe')](_0x0319('0xf'))[_0x0319('0x10')](_0x0319('0x31'))[_0x0319('0x13')](_0x0319('0x32'),_0x5342da)['where'](_0x210db1+'\x20=\x20?',_0x2d57aa+'.'+_0x210db1)))[_0x0319('0x33')]();}function insertCmContact(_0x1ede69,_0xf7ef4c,_0x55db12,_0x26926a){var _0x223491=_['concat'](_['keys'](_0x26926a),[_0x0319('0x21'),_0x0319('0x34'),_0x0319('0x22'),_0x0319('0x23')]);return squel[_0x0319('0x1d')]()[_0x0319('0x1e')](_0x0319('0x28'))[_0x0319('0x1f')](_0x223491,squel[_0x0319('0xd')]()['fields'](_0x223491)[_0x0319('0x10')](_0xf7ef4c)[_0x0319('0x13')]('('+_0x55db12['join'](',')+_0x0319('0x35'),squel[_0x0319('0xd')]()['fields'](_0x55db12)['from'](_0x0319('0x28'))[_0x0319('0x13')](_0x0319('0x32'),_0x1ede69)[_0x0319('0x13')](_0x0319('0x36')))[_0x0319('0x13')](_0x0319('0x37'),squel['select']()[_0x0319('0xe')](_0x0319('0x38'),'min_id')[_0x0319('0x10')](_0xf7ef4c)[_0x0319('0x39')](_0x55db12[_0x0319('0x11')](','))))[_0x0319('0x33')]();}function handleStop(){logger[_0x0319('0x3a')](_0x0319('0x3b'));stopped=!![];}function handleUncaughtException(_0x4dcf9f){logger[_0x0319('0x3c')](_0x4dcf9f['message']);process[_0x0319('0x3d')](0x1);}function handleError(_0x1c8e6b,_0x299f3e){stats[_0x0319('0x3e')][_0x0319('0x3f')]({'name':_0x299f3e[_0x0319('0x40')],'message':_0x299f3e[_0x0319('0x41')],'row':_0x1c8e6b});}function handleQuery(_0x252230){logger[_0x0319('0x3a')](_0x252230);return db[_0x0319('0x42')][_0x0319('0x43')](_0x252230)[_0x0319('0x44')](function(_0x548f01){results[_0x0319('0x3f')](_0x548f01);})['catch'](function(_0x1e023e){logger[_0x0319('0x3c')](_0x1e023e['message']);});}function main(_0x335fa5,_0xf7426b,_0x549977,_0x1ef060){logger[_0x0319('0x3a')](_0x0319('0x45'),_0x335fa5,JSON[_0x0319('0x46')](_0xf7426b));process[_0x0319('0x47')](_0x0319('0x48'));var _0x304aee=_0xf7426b[_0x0319('0x49')];var _0x21dbf3=_0xf7426b['socket_timestamp'];var _0xbf7825=path[_0x0319('0x11')](config[_0x0319('0x4a')],_0x0319('0x4b'),_0x21dbf3+'.csv');var _0x5a23bd=_[_0x0319('0x4c')](_0x304aee)[_0x0319('0x11')]();logger['info'](_0x0319('0x4d'),_0x5a23bd);fs[_0x0319('0x4e')](_0xbf7825,_0x5a23bd+'\x0a');Papa[_0x0319('0x4f')](fs[_0x0319('0x50')](_0x335fa5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x449461,_0x1d5647){try{for(var _0x4a6354=0x0,_0x3d6c55=[];_0x4a6354<_0x449461[_0x0319('0x51')][_0x0319('0x52')];_0x4a6354++){stats[_0x0319('0x53')]+=0x1;if(_0x449461[_0x0319('0x3e')][_0x4a6354]){handleError(_0x449461[_0x0319('0x51')][_0x4a6354],_0x449461[_0x0319('0x3e')][_0x4a6354]);}else{var _0x4ac9a9=[];for(var _0x45c856 in _0x304aee){if(_0x304aee[_0x0319('0x54')](_0x45c856)){if(_0x449461[_0x0319('0x51')][_0x4a6354][_0x304aee[_0x45c856]]){var _0x4d01f7=_['trim'](_0x449461[_0x0319('0x51')][_0x4a6354][_0x304aee[_0x45c856]]['replace'](/"/g,'\x27'));switch(_0x45c856){case _0x0319('0x55'):var _0x3e82ba=moment(_0x4d01f7,_0x0319('0xb'),!![]);if(_0x3e82ba[_0x0319('0x56')]()){_0x3d6c55[_0x0319('0x3f')]('\x22'+_0x4d01f7+'\x22');}else{_0x4ac9a9[_0x0319('0x3f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0319('0x24'):var _0x13760c=parseInt(_0x4d01f7);_0x4d01f7=_[_0x0319('0x57')](_0x13760c)||_0x13760c<0x0||_0x13760c>0x4?_0x1ef060?0x3:0x2:_0x13760c;_0x3d6c55[_0x0319('0x3f')]('\x22'+_0x4d01f7+'\x22');break;case _0x0319('0x25'):var _0x6fe10b=parseInt(_0x4d01f7);if(_[_0x0319('0x58')](_0x6fe10b)&&_[_0x0319('0x59')](_0x549977,_0x6fe10b)){_0x3d6c55[_0x0319('0x3f')]('\x22'+_0x6fe10b+'\x22');}else{_0x4ac9a9['push'](_0x0319('0x5a'));}break;case _0x0319('0x5b'):if(isEmail(_0x4d01f7)){_0x3d6c55['push']('\x22'+_0x4d01f7+'\x22');}else{_0x4ac9a9[_0x0319('0x3f')](_0x0319('0x5c'));}break;case'dateOfBirth':var _0x2af8eb=moment(_0x4d01f7,_0x0319('0x5d'),!![]);if(_0x2af8eb[_0x0319('0x56')]()){_0x3d6c55['push']('\x22'+_0x4d01f7+'\x22');}else{_0x4ac9a9[_0x0319('0x3f')](_0x0319('0x5e'));}break;default:_0x3d6c55[_0x0319('0x3f')]('\x22'+_0x4d01f7+'\x22');}}else{switch(_0x45c856){case _0x0319('0x5f'):case _0x0319('0xf'):_0x4ac9a9[_0x0319('0x3f')](_0x45c856+'\x20not\x20specified');break;default:_0x3d6c55[_0x0319('0x3f')]('\x22\x22');}}}}if(_0x4ac9a9['length']){handleError(_0x449461[_0x0319('0x51')][_0x4a6354],{'code':_0x0319('0x60'),'message':_0x4ac9a9[_0x0319('0x11')]()});}else{fs[_0x0319('0x61')](_0xbf7825,_0x3d6c55['join']()+'\x0a');}_0x3d6c55=[];}if(!(stats[_0x0319('0x53')]%0xc8)){socket[_0x0319('0x62')]('contact:import:'+_0x21dbf3,stats);stats['errors']=[];}}if(stopped){logger[_0x0319('0x3a')]('Abort\x20parser');_0x1d5647[_0x0319('0x63')]();}}catch(_0x275238){handleError(_0x449461['data'][_0x4a6354],{'code':_0x0319('0x64'),'message':_0x275238[_0x0319('0x41')]});logger[_0x0319('0x3c')](_0x0319('0x65'),_0x275238[_0x0319('0x41')]);}},'complete':function(){try{var _0x29263b=[];var _0xafa6e3=_0x0319('0x28');if(_0xf7426b[_0x0319('0x66')]&&_0xf7426b[_0x0319('0x66')][_0x0319('0x52')]){_0xafa6e3=_0x0319('0x67')+_0x21dbf3;_0x29263b['push'](_0x0319('0x68')+_0xafa6e3+_0x0319('0x69'));}var _0x39b77f=util[_0x0319('0x6a')]('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',_0xbf7825,_0xafa6e3,_0x5a23bd,_0xf7426b[_0x0319('0x21')],_0xf7426b['CompanyId']||null,NOW,NOW);if(_[_0x0319('0x6b')](_0x304aee[_0x0319('0x55')])){_0x39b77f+=_0x0319('0x6c');}_0x29263b[_0x0319('0x3f')](_0x39b77f);if(_0xf7426b['duplicates']&&_0xf7426b[_0x0319('0x66')][_0x0319('0x52')]){_0x29263b[_0x0319('0x3f')](insertCmContact(_0xf7426b[_0x0319('0x21')],_0xafa6e3,_0xf7426b[_0x0319('0x66')],_0x304aee));_0x29263b['push'](_0x0319('0x6d')+_0xafa6e3+';');}_0x29263b['push'](insertCmHopper(_0xf7426b[_0x0319('0x21')],'voice_queues_has_cm_lists','voice_queues',_0x0319('0x6e'),_0x1ef060));_0x29263b[_0x0319('0x3f')](insertCmHopperBlack(_0xf7426b['ListId'],_0x0319('0x6f'),_0x0319('0x70'),_0x0319('0x6e')));_0x29263b[_0x0319('0x3f')](insertCmHopper(_0xf7426b['ListId'],_0x0319('0x71'),_0x0319('0x72'),_0x0319('0x73'),_0x1ef060));_0x29263b[_0x0319('0x3f')](insertCmHopperBlack(_0xf7426b[_0x0319('0x21')],_0x0319('0x74'),'campaigns',_0x0319('0x73')));BPromise[_0x0319('0x75')](_0x29263b,handleQuery)[_0x0319('0x76')](function(_0x460faa){stats[_0x0319('0x77')]=!![];stats['affectedRows']=_0xf7426b[_0x0319('0x66')]&&_0xf7426b[_0x0319('0x66')]['length']?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket['emit']('contact:import:'+_0x21dbf3,stats);fs[_0x0319('0x78')](_0x335fa5);fs['unlink'](_0xbf7825);process[_0x0319('0x3d')](0x0);})[_0x0319('0x79')](function(_0x4222d0){logger[_0x0319('0x3c')](_0x4222d0[_0x0319('0x41')]);process['exit'](0x1);});}catch(_0x40f596){logger['error'](_0x0319('0x7a'),_0x40f596[_0x0319('0x41')]);process['exit'](0x1);}},'error':function(_0x506077,_0x20b750,_0x3781d4,_0x2c9f92){throw new Error(_0x2c9f92);}});}function validate(){if(process['argv']&&process['argv'][_0x0319('0x52')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x558f40=path[_0x0319('0x11')](config[_0x0319('0x4a')],'server/files/tmp',process[_0x0319('0x7b')][0x2]);if(!fs['existsSync'](_0x558f40)){throw new Error(_0x0319('0x7c'));}var _0x5620ef={};try{_0x5620ef=JSON[_0x0319('0x4f')](process[_0x0319('0x7b')][0x3]);if(!_0x5620ef[_0x0319('0x49')]){throw new Error(_0x0319('0x7d'));}if(!_0x5620ef['binding'][_0x0319('0xf')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x5620ef[_0x0319('0x49')][_0x0319('0x5f')]){throw new Error(_0x0319('0x7e'));}var _0xa8b261=0x0;if(_0x5620ef[_0x0319('0x49')][_0x0319('0x25')]){_0xa8b261=0x1;}if(!_0x5620ef[_0x0319('0x21')]){throw new Error(_0x0319('0x7f'));}}catch(_0x20bd73){throw new Error(_0x0319('0x80'));}var _0x301b37=[];try{_0x301b37=_[_0x0319('0x81')](JSON['parse'](process[_0x0319('0x7b')][0x4]),'id');}catch(_0x133a3c){logger['info']('No\x20agent\x20available');}main(_0x558f40,_0x5620ef,_0x301b37,_0xa8b261);}validate();process['on'](_0x0319('0x82'),handleStop);process['on'](_0x0319('0x83'),handleUncaughtException); \ No newline at end of file +var _0x5668=['isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','length','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues','campaigns_has_cm_lists','CampaignId','then','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','squel','../../../mysqldb','../../../config/environment','import','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_hopper_black','field','ListId\x20=\x20?','\x20=\x20?','keys','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','error','message','exit','errors','push','code','sequelize','query','spread','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace'];(function(_0x4c7864,_0x54a3f2){var _0x571867=function(_0x46c74c){while(--_0x46c74c){_0x4c7864['push'](_0x4c7864['shift']());}};_0x571867(++_0x54a3f2);}(_0x5668,0xa4));var _0x8566=function(_0x5d1a85,_0x4780d7){_0x5d1a85=_0x5d1a85-0x0;var _0x546eaf=_0x5668[_0x5d1a85];return _0x546eaf;};'use strict';var fs=require('fs');var path=require(_0x8566('0x0'));var _=require(_0x8566('0x1'));var Papa=require(_0x8566('0x2'));var util=require(_0x8566('0x3'));var BPromise=require(_0x8566('0x4'));var moment=require('moment');var squel=require(_0x8566('0x5'));var Redis=require('ioredis');var db=require(_0x8566('0x6'))['db'];var config=require(_0x8566('0x7'));var logger=require('../../../config/logger')(_0x8566('0x8'));config[_0x8566('0x9')]=_[_0x8566('0xa')](config[_0x8566('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8566('0xb'))(new Redis(config[_0x8566('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x8566('0xc'));function isEmail(_0x453598){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))*$/[_0x8566('0xd')](_0x453598);}function selectNotIn(_0x430e6a,_0x5c7726,_0x286373,_0x2bcb56,_0x3ed9dc){return squel[_0x8566('0xe')]()['field'](_0x8566('0xf'))[_0x8566('0x10')](_0x2bcb56)[_0x8566('0x11')](_0x5c7726,null,_0x5c7726+_0x8566('0x12')+_0x2bcb56+'.'+_0x286373)[_0x8566('0x13')](_0x2bcb56+'.'+_0x286373+'\x20=\x20'+_0x430e6a+'.'+_0x286373)['where'](_0x5c7726+'.dialCheckDuplicateType\x20IN\x20('+_0x3ed9dc[_0x8566('0x11')]()+')');}function insertCmHopper(_0x5b1241,_0xce32dd,_0x2b5f26,_0x224f12,_0x430de5){var _0x15409f=['cm_contacts.phone',_0x8566('0x14'),_0x8566('0x15'),'cm_contacts.ListId',_0xce32dd+'.'+_0x224f12,_0x8566('0x16'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x430de5+'\x22'];return squel[_0x8566('0x17')]()[_0x8566('0x18')](_0x8566('0x19'))['fromQuery']([_0x8566('0xf'),_0x8566('0x1a'),_0x8566('0x1b'),_0x8566('0x1c'),_0x224f12,_0x8566('0x1d'),_0x8566('0x1e'),_0x8566('0x1f'),_0x8566('0x20'),_0x8566('0x21')],squel[_0x8566('0xe')]()[_0x8566('0x22')](_0x15409f)[_0x8566('0x10')](_0xce32dd)[_0x8566('0x11')]('cm_contacts',null,_0x8566('0x23')+_0xce32dd+_0x8566('0x24'))['join'](_0x2b5f26,null,_0x2b5f26+_0x8566('0x12')+_0xce32dd+'.'+_0x224f12)['where'](_0xce32dd+_0x8566('0x25'),_0x5b1241)[_0x8566('0x13')](_0x8566('0x26'),NOW)[_0x8566('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xce32dd,_0x2b5f26,_0x224f12,_0x8566('0x19'),[_0x8566('0x27'),_0x8566('0x28')]))['where'](_0x8566('0x29'),selectNotIn(_0xce32dd,_0x2b5f26,_0x224f12,_0x8566('0x19'),[_0x8566('0x27')])))[_0x8566('0x2a')]();}function insertCmHopperBlack(_0x1ab7ec,_0x4d3bdd,_0x5e4968,_0x2006ae){var _0x5e9ac7=[_0x8566('0x2b'),_0x8566('0x15'),'cm_contacts.ListId',_0x4d3bdd+'.'+_0x2006ae,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x8566('0x17')]()[_0x8566('0x18')](_0x8566('0x2c'))['fromQuery']([_0x8566('0xf'),_0x8566('0x1b'),_0x8566('0x1c'),_0x2006ae,_0x8566('0x1d'),_0x8566('0x1e')],squel[_0x8566('0xe')]()['fields'](_0x5e9ac7)[_0x8566('0x10')](_0x4d3bdd)['join']('cm_contacts',null,_0x8566('0x23')+_0x4d3bdd+_0x8566('0x24'))['join'](_0x5e4968,null,_0x5e4968+_0x8566('0x12')+_0x4d3bdd+'.'+_0x2006ae)[_0x8566('0x13')](_0x4d3bdd+_0x8566('0x25'),_0x1ab7ec)[_0x8566('0x13')](_0x8566('0x26'),NOW)['where'](_0x8566('0x29'),squel[_0x8566('0xe')]()[_0x8566('0x2d')](_0x8566('0xf'))[_0x8566('0x10')](_0x8566('0x2c'))[_0x8566('0x13')](_0x8566('0x2e'),_0x1ab7ec)[_0x8566('0x13')](_0x2006ae+_0x8566('0x2f'),_0x4d3bdd+'.'+_0x2006ae)))[_0x8566('0x2a')]();}function insertCmContact(_0x4a4722,_0x3ab88d,_0x3536af,_0x28d309){var _0x12df1a=_['concat'](_[_0x8566('0x30')](_0x28d309),[_0x8566('0x1c'),'CompanyId',_0x8566('0x1d'),'updatedAt']);return squel[_0x8566('0x17')]()[_0x8566('0x18')](_0x8566('0x31'))['fromQuery'](_0x12df1a,squel[_0x8566('0xe')]()[_0x8566('0x22')](_0x12df1a)[_0x8566('0x10')](_0x3ab88d)[_0x8566('0x13')]('('+_0x3536af[_0x8566('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x8566('0xe')]()[_0x8566('0x22')](_0x3536af)[_0x8566('0x10')](_0x8566('0x31'))['where']('ListId\x20=\x20?',_0x4a4722)[_0x8566('0x13')](_0x8566('0x32')))[_0x8566('0x13')](_0x8566('0x33'),squel[_0x8566('0xe')]()[_0x8566('0x2d')](_0x8566('0x34'),'min_id')['from'](_0x3ab88d)[_0x8566('0x35')](_0x3536af[_0x8566('0x11')](','))))[_0x8566('0x2a')]();}function handleStop(){logger[_0x8566('0x36')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2d0501){logger[_0x8566('0x37')](_0x2d0501[_0x8566('0x38')]);process[_0x8566('0x39')](0x1);}function handleError(_0x4fa279,_0x161f96){stats[_0x8566('0x3a')][_0x8566('0x3b')]({'name':_0x161f96[_0x8566('0x3c')],'message':_0x161f96[_0x8566('0x38')],'row':_0x4fa279});}function handleQuery(_0x1e8e18){logger[_0x8566('0x36')](_0x1e8e18);return db[_0x8566('0x3d')][_0x8566('0x3e')](_0x1e8e18)[_0x8566('0x3f')](function(_0x2e1d77){results[_0x8566('0x3b')](_0x2e1d77);})[_0x8566('0x40')](function(_0x502a65){logger[_0x8566('0x37')](_0x502a65['message']);});}function main(_0x57c7aa,_0x1bb0dd,_0x4788c4,_0x279c77){logger[_0x8566('0x36')](_0x8566('0x41'),_0x57c7aa,JSON[_0x8566('0x42')](_0x1bb0dd));process[_0x8566('0x43')](_0x8566('0x44'));var _0x382c6b=_0x1bb0dd[_0x8566('0x45')];var _0x57c207=_0x1bb0dd[_0x8566('0x46')];var _0x22c8c0=path[_0x8566('0x11')](config[_0x8566('0x47')],_0x8566('0x48'),_0x57c207+'.csv');var _0x50a94a=_[_0x8566('0x30')](_0x382c6b)['join']();logger[_0x8566('0x36')](_0x8566('0x49'),_0x50a94a);fs[_0x8566('0x4a')](_0x22c8c0,_0x50a94a+'\x0a');Papa[_0x8566('0x4b')](fs[_0x8566('0x4c')](_0x57c7aa),{'header':!![],'skipEmptyLines':!![],'step':function(_0x15e2ff,_0x16bdc1){try{for(var _0x1f3be0=0x0,_0x2e9fc2=[];_0x1f3be0<_0x15e2ff[_0x8566('0x4d')]['length'];_0x1f3be0++){stats[_0x8566('0x4e')]+=0x1;if(_0x15e2ff['errors'][_0x1f3be0]){handleError(_0x15e2ff[_0x8566('0x4d')][_0x1f3be0],_0x15e2ff[_0x8566('0x3a')][_0x1f3be0]);}else{var _0x180cb3=[];for(var _0x18489e in _0x382c6b){if(_0x382c6b[_0x8566('0x4f')](_0x18489e)){if(_0x15e2ff[_0x8566('0x4d')][_0x1f3be0][_0x382c6b[_0x18489e]]){var _0x2b84da=_[_0x8566('0x50')](_0x15e2ff[_0x8566('0x4d')][_0x1f3be0][_0x382c6b[_0x18489e]][_0x8566('0x51')](/"/g,'\x27'));switch(_0x18489e){case _0x8566('0x1a'):var _0x33c719=moment(_0x2b84da,_0x8566('0xc'),!![]);if(_0x33c719[_0x8566('0x52')]()){_0x2e9fc2[_0x8566('0x3b')]('\x22'+_0x2b84da+'\x22');}else{_0x180cb3['push'](_0x8566('0x53'));}break;case _0x8566('0x1f'):var _0x3a6d2a=parseInt(_0x2b84da);_0x2b84da=_[_0x8566('0x54')](_0x3a6d2a)||_0x3a6d2a<0x0||_0x3a6d2a>0x4?_0x279c77?0x3:0x2:_0x3a6d2a;_0x2e9fc2[_0x8566('0x3b')]('\x22'+_0x2b84da+'\x22');break;case _0x8566('0x20'):var _0x41512b=parseInt(_0x2b84da);if(_[_0x8566('0x55')](_0x41512b)&&_[_0x8566('0x56')](_0x4788c4,_0x41512b)){_0x2e9fc2[_0x8566('0x3b')]('\x22'+_0x41512b+'\x22');}else{_0x180cb3['push']('agent\x20not\x20exists');}break;case _0x8566('0x57'):if(isEmail(_0x2b84da)){_0x2e9fc2['push']('\x22'+_0x2b84da+'\x22');}else{_0x180cb3[_0x8566('0x3b')](_0x8566('0x58'));}break;case _0x8566('0x59'):var _0x4e2bcb=moment(_0x2b84da,_0x8566('0x5a'),!![]);if(_0x4e2bcb['isValid']()){_0x2e9fc2[_0x8566('0x3b')]('\x22'+_0x2b84da+'\x22');}else{_0x180cb3[_0x8566('0x3b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2e9fc2[_0x8566('0x3b')]('\x22'+_0x2b84da+'\x22');}}else{switch(_0x18489e){case _0x8566('0x5b'):case _0x8566('0xf'):_0x180cb3['push'](_0x18489e+_0x8566('0x5c'));break;default:_0x2e9fc2[_0x8566('0x3b')]('\x22\x22');}}}}if(_0x180cb3[_0x8566('0x5d')]){handleError(_0x15e2ff['data'][_0x1f3be0],{'code':_0x8566('0x5e'),'message':_0x180cb3[_0x8566('0x11')]()});}else{fs['appendFileSync'](_0x22c8c0,_0x2e9fc2[_0x8566('0x11')]()+'\x0a');}_0x2e9fc2=[];}if(!(stats[_0x8566('0x4e')]%0xc8)){socket[_0x8566('0x5f')](_0x8566('0x60')+_0x57c207,stats);stats['errors']=[];}}if(stopped){logger[_0x8566('0x36')](_0x8566('0x61'));_0x16bdc1[_0x8566('0x62')]();}}catch(_0x17e5b5){handleError(_0x15e2ff['data'][_0x1f3be0],{'code':_0x8566('0x63'),'message':_0x17e5b5['message']});logger[_0x8566('0x37')](_0x8566('0x64'),_0x17e5b5[_0x8566('0x38')]);}},'complete':function(){try{var _0x5c55f2=[];var _0x356828='cm_contacts';if(_0x1bb0dd[_0x8566('0x65')]&&_0x1bb0dd[_0x8566('0x65')][_0x8566('0x5d')]){_0x356828='cm_contacts_'+_0x57c207;_0x5c55f2['push']('CREATE\x20TABLE\x20'+_0x356828+_0x8566('0x66'));}var _0xf4ecdc=util[_0x8566('0x67')](_0x8566('0x68'),_0x22c8c0,_0x356828,_0x50a94a,_0x1bb0dd[_0x8566('0x1c')],_0x1bb0dd[_0x8566('0x69')]||null,NOW,NOW);if(_[_0x8566('0x6a')](_0x382c6b[_0x8566('0x1a')])){_0xf4ecdc+=_0x8566('0x6b');}_0x5c55f2['push'](_0xf4ecdc);if(_0x1bb0dd['duplicates']&&_0x1bb0dd[_0x8566('0x65')][_0x8566('0x5d')]){_0x5c55f2[_0x8566('0x3b')](insertCmContact(_0x1bb0dd[_0x8566('0x1c')],_0x356828,_0x1bb0dd[_0x8566('0x65')],_0x382c6b));_0x5c55f2[_0x8566('0x3b')]('DROP\x20TABLE\x20'+_0x356828+';');}_0x5c55f2[_0x8566('0x3b')](insertCmHopper(_0x1bb0dd[_0x8566('0x1c')],'voice_queues_has_cm_lists',_0x8566('0x6c'),'VoiceQueueId',_0x279c77));_0x5c55f2[_0x8566('0x3b')](insertCmHopperBlack(_0x1bb0dd[_0x8566('0x1c')],'voice_queues_has_cm_blacklists',_0x8566('0x6c'),'VoiceQueueId'));_0x5c55f2[_0x8566('0x3b')](insertCmHopper(_0x1bb0dd[_0x8566('0x1c')],_0x8566('0x6d'),'campaigns','CampaignId',_0x279c77));_0x5c55f2[_0x8566('0x3b')](insertCmHopperBlack(_0x1bb0dd['ListId'],'campaigns_has_cm_blacklists','campaigns',_0x8566('0x6e')));BPromise['each'](_0x5c55f2,handleQuery)[_0x8566('0x6f')](function(_0x152ade){stats[_0x8566('0x70')]=!![];stats['affectedRows']=_0x1bb0dd[_0x8566('0x65')]&&_0x1bb0dd[_0x8566('0x65')][_0x8566('0x5d')]?results[0x2]['affectedRows']:results[0x0][_0x8566('0x71')];socket['emit'](_0x8566('0x60')+_0x57c207,stats);fs[_0x8566('0x72')](_0x57c7aa);fs[_0x8566('0x72')](_0x22c8c0);process[_0x8566('0x39')](0x0);})[_0x8566('0x40')](function(_0x1d25f2){logger[_0x8566('0x37')](_0x1d25f2['message']);process['exit'](0x1);});}catch(_0xe0aa70){logger[_0x8566('0x37')](_0x8566('0x73'),_0xe0aa70[_0x8566('0x38')]);process[_0x8566('0x39')](0x1);}},'error':function(_0x1f0652,_0x1c8291,_0x517ed5,_0x1a63d7){throw new Error(_0x1a63d7);}});}function validate(){if(process[_0x8566('0x74')]&&process[_0x8566('0x74')][_0x8566('0x5d')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x1e9c81=path[_0x8566('0x11')](config[_0x8566('0x47')],_0x8566('0x48'),process['argv'][0x2]);if(!fs[_0x8566('0x75')](_0x1e9c81)){throw new Error(_0x8566('0x76'));}var _0x5fd6c6={};try{_0x5fd6c6=JSON[_0x8566('0x4b')](process[_0x8566('0x74')][0x3]);if(!_0x5fd6c6['binding']){throw new Error(_0x8566('0x77'));}if(!_0x5fd6c6[_0x8566('0x45')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x5fd6c6['binding'][_0x8566('0x5b')]){throw new Error(_0x8566('0x78'));}var _0x1c8661=0x0;if(_0x5fd6c6[_0x8566('0x45')][_0x8566('0x20')]){_0x1c8661=0x1;}if(!_0x5fd6c6[_0x8566('0x1c')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x3401d7){throw new Error('body\x20id\x20mandatory');}var _0x374bd6=[];try{_0x374bd6=_[_0x8566('0x79')](JSON[_0x8566('0x4b')](process[_0x8566('0x74')][0x4]),'id');}catch(_0x578fcf){logger['info']('No\x20agent\x20available');}main(_0x1e9c81,_0x5fd6c6,_0x374bd6,_0x1c8661);}validate();process['on'](_0x8566('0x7a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 0fcaefd..f8d2af0 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6aa=['Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','voice','toLowerCase','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt'];(function(_0x34473f,_0x2b9c5c){var _0x25cf6f=function(_0x4214a2){while(--_0x4214a2){_0x34473f['push'](_0x34473f['shift']());}};_0x25cf6f(++_0x2b9c5c);}(_0xc6aa,0x142));var _0xac6a=function(_0x85077e,_0x36519e){_0x85077e=_0x85077e-0x0;var _0x1bc638=_0xc6aa[_0x85077e];return _0x1bc638;};'use strict';exports[_0xac6a('0x0')]=function(_0x43967d,_0x270f55){var _0x2c0475=[{'type':_0xac6a('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x43967d['toLowerCase']()){case _0xac6a('0x2'):switch(_0x270f55[_0xac6a('0x3')]()){case _0xac6a('0x4'):_0x2c0475[_0xac6a('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x2c0475[_0xac6a('0x5')]({'type':_0xac6a('0x6'),'content':'','variableName':_0xac6a('0x7')});break;case _0xac6a('0x8'):_0x2c0475[_0xac6a('0x5')]({'type':'string','content':_0xac6a('0x9'),'variableName':null});_0x2c0475[_0xac6a('0x5')]({'type':_0xac6a('0x6'),'content':'','variableName':_0xac6a('0xa')});break;}}return _0x2c0475;};exports[_0xac6a('0xb')]=function(_0x37a28f,_0x29a425){var _0x427ab3=[];switch(_0x37a28f['toLowerCase']()){case'voice':switch(_0x29a425[_0xac6a('0x3')]()){case _0xac6a('0x4'):_0x427ab3=[{'type':'string','content':_0xac6a('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0xe'),'keyType':_0xac6a('0x6'),'variableName':_0xac6a('0x7')},{'type':'keyValue','content':'','key':_0xac6a('0xf'),'keyType':_0xac6a('0x6'),'variableName':'calleridname'},{'type':_0xac6a('0xd'),'content':'','key':'Call\x20To','keyType':_0xac6a('0x6'),'variableName':_0xac6a('0x10')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x11'),'keyType':_0xac6a('0x6'),'variableName':_0xac6a('0x12')},{'type':'keyValue','content':'','key':_0xac6a('0x13'),'keyType':'variable','variableName':_0xac6a('0x14')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x15'),'keyType':'variable','variableName':_0xac6a('0x16')},{'type':_0xac6a('0x1'),'content':_0xac6a('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xac6a('0x6'),'variableName':'destcalleridname'},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x18'),'keyType':_0xac6a('0x6'),'variableName':_0xac6a('0xa')},{'type':_0xac6a('0x1'),'content':_0xac6a('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x1a'),'keyType':_0xac6a('0x6'),'variableName':_0xac6a('0x16')},{'type':_0xac6a('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0xac6a('0x6'),'variableName':_0xac6a('0x1b')},{'type':'keyValue','content':'','key':_0xac6a('0x1c'),'keyType':_0xac6a('0x6'),'variableName':_0xac6a('0x1d')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x1e'),'keyType':_0xac6a('0x6'),'variableName':_0xac6a('0x1f')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x20'),'keyType':'variable','variableName':_0xac6a('0x21')}];break;case'outbound':_0x427ab3=[{'type':_0xac6a('0x1'),'content':_0xac6a('0xc'),'variableName':null},{'type':_0xac6a('0xd'),'content':'','key':'Called\x20Number','keyType':_0xac6a('0x6'),'keyContent':'','variableName':_0xac6a('0xa')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x22'),'keyType':_0xac6a('0x6'),'keyContent':'','variableName':_0xac6a('0x23')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x13'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x15'),'keyType':'variable','keyContent':'','variableName':_0xac6a('0x24')},{'type':_0xac6a('0x1'),'content':_0xac6a('0x19')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x25'),'keyType':'variable','keyContent':'','variableName':_0xac6a('0x26')},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x27'),'keyType':_0xac6a('0x6'),'keyContent':'','variableName':_0xac6a('0x28')},{'type':'keyValue','content':'','key':_0xac6a('0x29'),'keyType':_0xac6a('0x6'),'keyContent':'','variableName':'duration'},{'type':_0xac6a('0xd'),'content':'','key':_0xac6a('0x2a'),'keyType':_0xac6a('0x6'),'keyContent':'','variableName':_0xac6a('0x2b')}];break;}}return _0x427ab3;}; \ No newline at end of file +var _0x4680=['keyValue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','answertime','Complete\x20Time','Duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','variable','queue','calleridnum','outbound','push','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','Caller\x20Name','calleridname'];(function(_0x47336a,_0x2f4876){var _0x57a814=function(_0xa1259a){while(--_0xa1259a){_0x47336a['push'](_0x47336a['shift']());}};_0x57a814(++_0x2f4876);}(_0x4680,0x1a9));var _0x0468=function(_0x75f834,_0x2e0223){_0x75f834=_0x75f834-0x0;var _0x31e3bd=_0x4680[_0x75f834];return _0x31e3bd;};'use strict';exports[_0x0468('0x0')]=function(_0x47010c,_0x3519e7){var _0x48262a=[{'type':_0x0468('0x1'),'content':_0x0468('0x2'),'variableName':null}];switch(_0x47010c['toLowerCase']()){case'voice':switch(_0x3519e7[_0x0468('0x3')]()){case _0x0468('0x4'):_0x48262a['push']({'type':_0x0468('0x5'),'content':'','variableName':_0x0468('0x6')});_0x48262a['push']({'type':_0x0468('0x5'),'content':'','variableName':_0x0468('0x7')});break;case _0x0468('0x8'):_0x48262a[_0x0468('0x9')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x48262a[_0x0468('0x9')]({'type':_0x0468('0x5'),'content':'','variableName':_0x0468('0xa')});break;}}return _0x48262a;};exports['getDescriptions']=function(_0x4164e2,_0x178770){var _0x1725dd=[];switch(_0x4164e2[_0x0468('0x3')]()){case'voice':switch(_0x178770[_0x0468('0x3')]()){case _0x0468('0x4'):_0x1725dd=[{'type':_0x0468('0x1'),'content':_0x0468('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0468('0xc'),'keyType':_0x0468('0x5'),'variableName':_0x0468('0x7')},{'type':'keyValue','content':'','key':_0x0468('0xd'),'keyType':'variable','variableName':_0x0468('0xe')},{'type':_0x0468('0xf'),'content':'','key':'Call\x20To','keyType':_0x0468('0x5'),'variableName':'destexten'},{'type':'keyValue','content':'','key':'Queue','keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':_0x0468('0x10')},{'type':'keyValue','content':'','key':_0x0468('0x11'),'keyType':_0x0468('0x5'),'variableName':_0x0468('0x12')},{'type':'string','content':_0x0468('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x14'),'keyType':_0x0468('0x5'),'variableName':_0x0468('0x15')},{'type':_0x0468('0xf'),'content':'','key':'Agent\x20Number','keyType':_0x0468('0x5'),'variableName':_0x0468('0xa')},{'type':_0x0468('0x1'),'content':_0x0468('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0468('0x17'),'keyType':_0x0468('0x5'),'variableName':_0x0468('0x12')},{'type':'keyValue','content':'','key':_0x0468('0x18'),'keyType':_0x0468('0x5'),'variableName':_0x0468('0x19')},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x1a'),'keyType':_0x0468('0x5'),'variableName':_0x0468('0x1b')},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x1c'),'keyType':_0x0468('0x5'),'variableName':_0x0468('0x1d')},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x1e'),'keyType':_0x0468('0x5'),'variableName':'talktime'}];break;case _0x0468('0x8'):_0x1725dd=[{'type':'string','content':_0x0468('0xb'),'variableName':null},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x0468('0xa')},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x20'),'keyType':_0x0468('0x5'),'keyContent':'','variableName':_0x0468('0x21')},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x22'),'keyType':_0x0468('0x5'),'keyContent':'','variableName':_0x0468('0x10')},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x11'),'keyType':_0x0468('0x5'),'keyContent':'','variableName':_0x0468('0x23')},{'type':_0x0468('0x1'),'content':_0x0468('0x16')},{'type':_0x0468('0xf'),'content':'','key':'Answer\x20Time','keyType':_0x0468('0x5'),'keyContent':'','variableName':_0x0468('0x24')},{'type':_0x0468('0xf'),'content':'','key':_0x0468('0x25'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x0468('0x26'),'keyType':_0x0468('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x0468('0xf'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0x0468('0x27')}];break;}}return _0x1725dd;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 191f7e4..4bbe3ff 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1f7=['fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','toUpperCase','name','stringify','null','findOne','update','then','info','catch','user','query','body','omit','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xb1f7,0x87));var _0x7b1f=function(_0x19fe9e,_0x5f25b0){_0x19fe9e=_0x19fe9e-0x0;var _0x5c7f9e=_0xb1f7[_0x19fe9e];return _0x5c7f9e;};'use strict';var _=require(_0x7b1f('0x0'));var db=require(_0x7b1f('0x1'))['db'];var loggers={'openchannel':require(_0x7b1f('0x2'))(_0x7b1f('0x3')),'mail':require(_0x7b1f('0x2'))(_0x7b1f('0x4')),'fax':require(_0x7b1f('0x2'))(_0x7b1f('0x5')),'sms':require('../../config/logger')(_0x7b1f('0x6')),'chat':require('../../config/logger')(_0x7b1f('0x7')),'whatsapp':require(_0x7b1f('0x2'))(_0x7b1f('0x8'))};function getInteractionId(_0x4625b0,_0x141e29,_0x1c4f6b){if(_0x4625b0&&_0x4625b0[_[_0x7b1f('0x9')](_0x1c4f6b)+_0x7b1f('0xa')]){return _0x4625b0[_[_0x7b1f('0x9')](_0x1c4f6b)+_0x7b1f('0xa')];}else if(_0x4625b0&&_0x4625b0['id']){return _0x4625b0['id'];}else if(_0x141e29&&_0x141e29['id']){return _0x141e29['id'];}else{return'unknown';}}function log(_0x4f6ca1,_0x2b2500,_0x57230c,_0x253673,_0x3ad1d2,_0x12d95b){loggers[_0x3ad1d2[_0x7b1f('0xb')]()][_0x4f6ca1]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12d95b[_0x7b1f('0xc')](),_0x2b2500?_0x2b2500['id']:null,_0x2b2500?_0x2b2500[_0x7b1f('0xd')]:null,_0x2b2500?_0x2b2500['role']:null,getInteractionId(_0x57230c,_0x253673,_0x3ad1d2),_0x57230c?JSON[_0x7b1f('0xe')](_0x57230c):_0x7b1f('0xf'));}function updateUser(_0x533d16,_0xa0525d,_0x29bd68,_0x423478,_0x1f1a77){db[_[_0x7b1f('0x9')](_0x423478)+'Interaction'][_0x7b1f('0x10')]({'where':{'id':getInteractionId(_0xa0525d,_0x29bd68,_0x423478)}})['then'](function(_0x4ba353){if(_0x4ba353){return _0x4ba353[_0x7b1f('0x11')]({'UserId':_0x533d16?_0x533d16['id']:null});}})[_0x7b1f('0x12')](function(_0x2752e6){if(_0x2752e6){log(_0x7b1f('0x13'),_0x533d16,_0xa0525d,_0x29bd68,_0x423478,_0x1f1a77);}})[_0x7b1f('0x14')](function(){log('error',_0x533d16,_0xa0525d,_0x29bd68,_0x423478,_0x1f1a77);});}exports['tracked']=function(_0x4a5209,_0x262f08){return function(_0x3135ad,_0x1f08e7,_0x13bc50){var _0x586643=_0x3135ad[_0x7b1f('0x15')];var _0x38062e={};var _0x323960=_0x3135ad[_0x7b1f('0x16')];if(_0x38062e){_0x38062e=_['clone'](_0x3135ad[_0x7b1f('0x17')]);_0x38062e=_[_0x7b1f('0x18')](_0x38062e,[_0x7b1f('0x17'),'html',_0x7b1f('0x19'),_0x7b1f('0x1a'),_0x7b1f('0x1b')]);}updateUser(_0x586643,_0x38062e,_0x323960,_0x4a5209,_0x262f08);_0x13bc50(null);};}; \ No newline at end of file +var _0x7c51=['mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','Interaction','findOne','update','then','info','catch','error','tracked','user','clone','body','omit'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x7c51,0xc5));var _0x17c5=function(_0x1594e6,_0x4d070a){_0x1594e6=_0x1594e6-0x0;var _0x5b0cf0=_0x7c51[_0x1594e6];return _0x5b0cf0;};'use strict';var _=require(_0x17c5('0x0'));var db=require(_0x17c5('0x1'))['db'];var loggers={'openchannel':require(_0x17c5('0x2'))(_0x17c5('0x3')),'mail':require(_0x17c5('0x2'))(_0x17c5('0x4')),'fax':require(_0x17c5('0x2'))(_0x17c5('0x5')),'sms':require(_0x17c5('0x2'))('sms-interactions'),'chat':require(_0x17c5('0x2'))(_0x17c5('0x6')),'whatsapp':require(_0x17c5('0x2'))('whatsapp-interactions')};function getInteractionId(_0x3b2233,_0x2914a3,_0x4909c5){if(_0x3b2233&&_0x3b2233[_[_0x17c5('0x7')](_0x4909c5)+_0x17c5('0x8')]){return _0x3b2233[_[_0x17c5('0x7')](_0x4909c5)+_0x17c5('0x8')];}else if(_0x3b2233&&_0x3b2233['id']){return _0x3b2233['id'];}else if(_0x2914a3&&_0x2914a3['id']){return _0x2914a3['id'];}else{return _0x17c5('0x9');}}function log(_0x2c9947,_0x4034b7,_0x46a58c,_0xe3fc12,_0x9e4ebd,_0x3080c0){loggers[_0x9e4ebd[_0x17c5('0xa')]()][_0x2c9947](_0x17c5('0xb'),_0x3080c0[_0x17c5('0xc')](),_0x4034b7?_0x4034b7['id']:null,_0x4034b7?_0x4034b7[_0x17c5('0xd')]:null,_0x4034b7?_0x4034b7[_0x17c5('0xe')]:null,getInteractionId(_0x46a58c,_0xe3fc12,_0x9e4ebd),_0x46a58c?JSON['stringify'](_0x46a58c):'null');}function updateUser(_0x4d62fd,_0x2861a1,_0x54bc19,_0x2ab8ca,_0x4efd06){db[_[_0x17c5('0x7')](_0x2ab8ca)+_0x17c5('0xf')][_0x17c5('0x10')]({'where':{'id':getInteractionId(_0x2861a1,_0x54bc19,_0x2ab8ca)}})['then'](function(_0x521b77){if(_0x521b77){return _0x521b77[_0x17c5('0x11')]({'UserId':_0x4d62fd?_0x4d62fd['id']:null});}})[_0x17c5('0x12')](function(_0x46ee59){if(_0x46ee59){log(_0x17c5('0x13'),_0x4d62fd,_0x2861a1,_0x54bc19,_0x2ab8ca,_0x4efd06);}})[_0x17c5('0x14')](function(){log(_0x17c5('0x15'),_0x4d62fd,_0x2861a1,_0x54bc19,_0x2ab8ca,_0x4efd06);});}exports[_0x17c5('0x16')]=function(_0x34fa17,_0x54bc12){return function(_0x4e3bfa,_0x4d72f4,_0x44fffe){var _0xaa16f8=_0x4e3bfa[_0x17c5('0x17')];var _0xe0c7f={};var _0x56c1b5=_0x4e3bfa['query'];if(_0xe0c7f){_0xe0c7f=_[_0x17c5('0x18')](_0x4e3bfa[_0x17c5('0x19')]);_0xe0c7f=_[_0x17c5('0x1a')](_0xe0c7f,['body','html','phone','fax',_0x17c5('0x1b')]);}updateUser(_0xaa16f8,_0xe0c7f,_0x56c1b5,_0x34fa17,_0x54bc12);_0x44fffe(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b37502f..b53cd90 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 _0x1f94=['status','json','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use','License','findOne','then'];(function(_0xebe25a,_0x227269){var _0x1c87bb=function(_0x4684d6){while(--_0x4684d6){_0xebe25a['push'](_0xebe25a['shift']());}};_0x1c87bb(++_0x227269);}(_0x1f94,0x7c));var _0x41f9=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0x1f94[_0x18d50f];return _0x8ce385;};'use strict';var crypto=require('crypto');var util=require(_0x41f9('0x0'));var compose=require(_0x41f9('0x1'));var db=require(_0x41f9('0x2'))['db'];var config=require(_0x41f9('0x3'));function getValueFromLicense(_0x59fb2f,_0x289259){if(_0x59fb2f&&_0x289259){if(_0x289259[_0x41f9('0x4')]&&_0x289259['license']){var _0x565717=_0x289259[_0x41f9('0x4')];var _0x165c7f=_0x289259[_0x41f9('0x5')];var _0x38c978=_0x565717[_0x41f9('0x6')]('-')[0x4];var _0x4896cd=_0x565717[_0x41f9('0x6')]('-')[0x0];var _0xd8a29b=crypto[_0x41f9('0x7')](_0x41f9('0x8'),util[_0x41f9('0x9')](_0x41f9('0xa'),_0x38c978,_0x565717,_0x4896cd));var _0x479011=_0xd8a29b[_0x41f9('0xb')](_0x165c7f,_0x41f9('0xc'),_0x41f9('0xd'));_0x479011+=_0xd8a29b['final'](_0x41f9('0xd'));var _0x5346e2=JSON[_0x41f9('0xe')](_0x479011);return _0x5346e2[_0x41f9('0xf')](_0x59fb2f)?_0x5346e2[_0x59fb2f]:null;}}return null;}function isLimit(_0x55f663,_0x22d262,_0x3ec602,_0x2a36d9){var _0x21c827=_0x22d262;return compose()[_0x41f9('0x10')](function(_0x3d988d,_0x2a5323,_0x4ef549){return db[_0x41f9('0x11')][_0x41f9('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x41f9('0x13')](function(_0x4e15f6){var _0x3b6885=getValueFromLicense(_0x55f663,_0x4e15f6);return _0x3b6885?_0x3b6885:_0x21c827;})['then'](function(_0x5de627){_0x21c827=_0x5de627;return _0x3ec602['count'](_0x2a36d9);})[_0x41f9('0x13')](function(_0x2a968a){if(_0x2a968a>=_0x21c827){return _0x2a5323[_0x41f9('0x14')](0x193)[_0x41f9('0x15')]({'message':util[_0x41f9('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x55f663)});}_0x4ef549();})['catch'](function(_0x170f3a){_0x4ef549(_0x170f3a);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x41f9('0x16')}]}});}exports[_0x41f9('0x17')]=isUserLimit; \ No newline at end of file +var _0xe8bf=['use','License','findOne','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','util','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8bf,0x113));var _0xfe8b=function(_0x58f5ff,_0x5551e8){_0x58f5ff=_0x58f5ff-0x0;var _0x1148b4=_0xe8bf[_0x58f5ff];return _0x1148b4;};'use strict';var crypto=require('crypto');var util=require(_0xfe8b('0x0'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xfe8b('0x1'));function getValueFromLicense(_0x305fc9,_0x20d4f6){if(_0x305fc9&&_0x20d4f6){if(_0x20d4f6[_0xfe8b('0x2')]&&_0x20d4f6[_0xfe8b('0x3')]){var _0x16f899=_0x20d4f6['data1'];var _0xc14694=_0x20d4f6[_0xfe8b('0x3')];var _0x333fbe=_0x16f899[_0xfe8b('0x4')]('-')[0x4];var _0x259d69=_0x16f899['split']('-')[0x0];var _0x2dff86=crypto['createDecipher'](_0xfe8b('0x5'),util[_0xfe8b('0x6')](_0xfe8b('0x7'),_0x333fbe,_0x16f899,_0x259d69));var _0x36e83d=_0x2dff86[_0xfe8b('0x8')](_0xc14694,'base64',_0xfe8b('0x9'));_0x36e83d+=_0x2dff86[_0xfe8b('0xa')](_0xfe8b('0x9'));var _0x2aca7f=JSON[_0xfe8b('0xb')](_0x36e83d);return _0x2aca7f[_0xfe8b('0xc')](_0x305fc9)?_0x2aca7f[_0x305fc9]:null;}}return null;}function isLimit(_0x1e3a39,_0xff3919,_0x216199,_0x1092be){var _0xe3a1b6=_0xff3919;return compose()[_0xfe8b('0xd')](function(_0x59c353,_0x1d9192,_0x479a94){return db[_0xfe8b('0xe')][_0xfe8b('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x544b81){var _0x52fb10=getValueFromLicense(_0x1e3a39,_0x544b81);return _0x52fb10?_0x52fb10:_0xe3a1b6;})['then'](function(_0x10d91a){_0xe3a1b6=_0x10d91a;return _0x216199[_0xfe8b('0x10')](_0x1092be);})['then'](function(_0x2f194f){if(_0x2f194f>=_0xe3a1b6){return _0x1d9192['status'](0x193)[_0xfe8b('0x11')]({'message':util[_0xfe8b('0x6')](_0xfe8b('0x12'),_0x1e3a39)});}_0x479a94();})['catch'](function(_0x5da782){_0x479a94(_0x5da782);});});}function isUserLimit(){return isLimit(_0xfe8b('0x13'),0x1,db[_0xfe8b('0x14')],{'where':{'$or':[{'role':_0xfe8b('0x15')},{'role':_0xfe8b('0x16')}]}});}exports[_0xfe8b('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 60116e9..9002ea2 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 _0x3887=['pop','utcOffset','format','hours','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','[$and]','split','forEach','shift','match','indexOf','map','push','DATE','operator','$between','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start'];(function(_0x8b762c,_0x3b1b15){var _0x3c1ab4=function(_0x9d863a){while(--_0x9d863a){_0x8b762c['push'](_0x8b762c['shift']());}};_0x3c1ab4(++_0x3b1b15);}(_0x3887,0xd6));var _0x7388=function(_0x43eb54,_0x35e944){_0x43eb54=_0x43eb54-0x0;var _0x3892ac=_0x3887[_0x43eb54];return _0x3892ac;};'use strict';var _=require(_0x7388('0x0'));var moment=require('moment');exports[_0x7388('0x1')]=function(_0x167abd){var _0x2f4392={'conditions':[]};_0x2f4392['sqlOperator']=_[_0x7388('0x2')](_0x167abd,_0x7388('0x3'))?'or':_0x7388('0x4');var _0x1947f6=_0x167abd[_0x7388('0x5')](_0x7388('0x6'),'')[_0x7388('0x5')](_0x7388('0x3'),'')[_0x7388('0x7')]('||');for(var _0x201b12=0x0;_0x201b12<_0x1947f6['length'];_0x201b12++){var _0x5884a4=_0x1947f6[_0x201b12]['split'](':=');var _0x4db410=_0x5884a4[0x0];var _0x47cf34=_0x5884a4['slice'](0x1);_0x47cf34[_0x7388('0x8')](function(_0x224121){var _0x64439a=_0x224121[_0x7388('0x7')]('[')[_0x7388('0x9')]();var _0x302cb4=_0x224121[_0x7388('0xa')](/\[(.*?)\]/g);_0x302cb4[_0x7388('0x8')](function(_0xe4bb8c){var _0x31ee61=_0xe4bb8c[_0x7388('0x7')]('[')['filter'](function(_0x2ed729){return _0x2ed729[_0x7388('0xb')](']')>-0x1;})[_0x7388('0xc')](function(_0x3602a8){return _0x3602a8[_0x7388('0x7')](']')[0x0];})[0x0];_0x2f4392['conditions'][_0x7388('0xd')]({'field':_0x4db410,'operator':_0x64439a,'value':_0x31ee61});});});}return _0x2f4392;};exports['buildExpression']=function(_0x54decc,_0x4e440e,_0x4ac030){var _0x44b10b={};if(_0x4e440e===_0x7388('0xe')){if(_0x4ac030[_0x7388('0xf')]==='$eq'){_0x4ac030['operator']=_0x7388('0x10');_0x4ac030[_0x7388('0x11')]+=','+_0x4ac030[_0x7388('0x11')];}else if(_[_0x7388('0x12')]([_0x7388('0x13'),_0x7388('0x14')],_0x4ac030['operator'])){_0x4ac030[_0x7388('0x11')]=moment(_0x4ac030[_0x7388('0x11')])[_0x7388('0x15')](0x1,_0x7388('0x16'))['format'](_0x7388('0x17'));}}if(_0x4ac030['castTo']){_0x4e440e=_0x4ac030[_0x7388('0x18')];_0x44b10b[_0x7388('0x19')]=_0x7388('0x1a')+_0x54decc+'.'+_0x4ac030[_0x7388('0x1b')]+_0x7388('0x1c')+_0x4ac030['castTo']+')\x20'+parseOperator(_0x4ac030['operator']);}else{_0x44b10b['text']=_0x54decc+'.'+_0x4ac030[_0x7388('0x1b')]+'\x20'+parseOperator(_0x4ac030[_0x7388('0xf')]);}if(_[_0x7388('0x12')]([_0x7388('0x1d'),_0x7388('0x1e')],_0x4ac030[_0x7388('0xf')]))_0x44b10b['text']='('+_0x44b10b[_0x7388('0x19')]+_0x7388('0x1f')+_0x54decc+'.'+_0x4ac030[_0x7388('0x1b')]+'\x20IS\x20NULL)';_0x44b10b[_0x7388('0x11')]=parseValue(_0x4e440e,_0x4ac030[_0x7388('0xf')],_0x4ac030[_0x7388('0x11')]);return _0x44b10b;};function parseOperator(_0x518a5b){var _0x256d76;switch(_0x518a5b){case _0x7388('0x20'):_0x256d76='IN\x20?';break;case _0x7388('0x1e'):_0x256d76=_0x7388('0x21');break;case'$eq':_0x256d76=_0x7388('0x22');break;case'$ne':_0x256d76='<>\x20?';break;case _0x7388('0x23'):case _0x7388('0x24'):case _0x7388('0x25'):_0x256d76=_0x7388('0x26');break;case _0x7388('0x27'):_0x256d76=_0x7388('0x28');break;case _0x7388('0x13'):_0x256d76='>\x20?';break;case _0x7388('0x14'):_0x256d76=_0x7388('0x29');break;case _0x7388('0x2a'):_0x256d76=_0x7388('0x2b');break;case'$between':_0x256d76=_0x7388('0x2c');break;}return _0x256d76;}function parseValue(_0x6a2759,_0x887bb3,_0x5e8430){var _0x419d05={'start':undefined,'end':undefined};switch(_0x887bb3){case'$in':case'$notIn':_0x419d05['start']=_0x5e8430[_0x7388('0x7')](',');break;case _0x7388('0x23'):_0x419d05['start']='%'+_0x5e8430+'%';break;case _0x7388('0x24'):_0x419d05['start']=_0x5e8430+'%';break;case _0x7388('0x25'):_0x419d05[_0x7388('0x2d')]='%'+_0x5e8430;break;case'$between':var _0x1f98bb=_0x5e8430[_0x7388('0x7')](',');var _0x5e8430=_0x1f98bb['shift']();var _0x4306d5=_0x1f98bb[_0x7388('0x2e')]();if(_0x6a2759===_0x7388('0xe')){_0x5e8430=moment(_0x5e8430)[_0x7388('0x2f')](0x0,!![])[_0x7388('0x30')]();_0x4306d5=moment(_0x4306d5)[_0x7388('0x2f')](0x0,!![])['add'](0x17,_0x7388('0x31'))[_0x7388('0x15')](0x3b,_0x7388('0x32'))[_0x7388('0x15')](0x3b,_0x7388('0x33'))[_0x7388('0x30')]();}_0x419d05={'start':_0x5e8430,'end':_0x4306d5};break;default:_0x419d05[_0x7388('0x2d')]=_0x5e8430;break;}return _0x419d05;} \ No newline at end of file +var _0x693f=['start','$endsWith','shift','utcOffset','add','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$in'];(function(_0x52ac28,_0x4b92b5){var _0x1dfa82=function(_0x1cd4ce){while(--_0x1cd4ce){_0x52ac28['push'](_0x52ac28['shift']());}};_0x1dfa82(++_0x4b92b5);}(_0x693f,0xf4));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xf693('0x0'));exports[_0xf693('0x1')]=function(_0x9ee1ee){var _0x35542c={'conditions':[]};_0x35542c[_0xf693('0x2')]=_[_0xf693('0x3')](_0x9ee1ee,_0xf693('0x4'))?'or':_0xf693('0x5');var _0x2164b5=_0x9ee1ee[_0xf693('0x6')](_0xf693('0x7'),'')['replace']('[$or]','')[_0xf693('0x8')]('||');for(var _0x5be26e=0x0;_0x5be26e<_0x2164b5['length'];_0x5be26e++){var _0x90879=_0x2164b5[_0x5be26e][_0xf693('0x8')](':=');var _0x577fa7=_0x90879[0x0];var _0x5df73b=_0x90879[_0xf693('0x9')](0x1);_0x5df73b['forEach'](function(_0x1682e9){var _0x2ffc94=_0x1682e9[_0xf693('0x8')]('[')['shift']();var _0x1e0c69=_0x1682e9['match'](/\[(.*?)\]/g);_0x1e0c69[_0xf693('0xa')](function(_0x2f9f78){var _0x3f7476=_0x2f9f78[_0xf693('0x8')]('[')[_0xf693('0xb')](function(_0xcb4731){return _0xcb4731[_0xf693('0xc')](']')>-0x1;})[_0xf693('0xd')](function(_0x4b5c4e){return _0x4b5c4e[_0xf693('0x8')](']')[0x0];})[0x0];_0x35542c[_0xf693('0xe')][_0xf693('0xf')]({'field':_0x577fa7,'operator':_0x2ffc94,'value':_0x3f7476});});});}return _0x35542c;};exports[_0xf693('0x10')]=function(_0x4724ff,_0x3779d3,_0x38adeb){var _0x28d1f5={};if(_0x3779d3===_0xf693('0x11')){if(_0x38adeb[_0xf693('0x12')]===_0xf693('0x13')){_0x38adeb['operator']='$between';_0x38adeb[_0xf693('0x14')]+=','+_0x38adeb['value'];}else if(_['includes']([_0xf693('0x15'),_0xf693('0x16')],_0x38adeb[_0xf693('0x12')])){_0x38adeb[_0xf693('0x14')]=moment(_0x38adeb['value'])['add'](0x1,_0xf693('0x17'))[_0xf693('0x18')](_0xf693('0x19'));}}if(_0x38adeb[_0xf693('0x1a')]){_0x3779d3=_0x38adeb[_0xf693('0x1a')];_0x28d1f5[_0xf693('0x1b')]=_0xf693('0x1c')+_0x4724ff+'.'+_0x38adeb[_0xf693('0x1d')]+_0xf693('0x1e')+_0x38adeb[_0xf693('0x1a')]+')\x20'+parseOperator(_0x38adeb[_0xf693('0x12')]);}else{_0x28d1f5['text']=_0x4724ff+'.'+_0x38adeb[_0xf693('0x1d')]+'\x20'+parseOperator(_0x38adeb[_0xf693('0x12')]);}if(_[_0xf693('0x1f')](['$ne',_0xf693('0x20')],_0x38adeb['operator']))_0x28d1f5['text']='('+_0x28d1f5['text']+_0xf693('0x21')+_0x4724ff+'.'+_0x38adeb['field']+_0xf693('0x22');_0x28d1f5[_0xf693('0x14')]=parseValue(_0x3779d3,_0x38adeb[_0xf693('0x12')],_0x38adeb[_0xf693('0x14')]);return _0x28d1f5;};function parseOperator(_0x1452ac){var _0x47c60f;switch(_0x1452ac){case'$in':_0x47c60f=_0xf693('0x23');break;case _0xf693('0x20'):_0x47c60f=_0xf693('0x24');break;case'$eq':_0x47c60f=_0xf693('0x25');break;case _0xf693('0x26'):_0x47c60f=_0xf693('0x27');break;case _0xf693('0x28'):case _0xf693('0x29'):case'$endsWith':_0x47c60f=_0xf693('0x2a');break;case'$lt':_0x47c60f=_0xf693('0x2b');break;case _0xf693('0x15'):_0x47c60f=_0xf693('0x2c');break;case _0xf693('0x16'):_0x47c60f=_0xf693('0x2d');break;case _0xf693('0x2e'):_0x47c60f=_0xf693('0x2f');break;case _0xf693('0x30'):_0x47c60f=_0xf693('0x31');break;}return _0x47c60f;}function parseValue(_0x158d15,_0x202632,_0x5d917f){var _0x143e16={'start':undefined,'end':undefined};switch(_0x202632){case _0xf693('0x32'):case _0xf693('0x20'):_0x143e16[_0xf693('0x33')]=_0x5d917f['split'](',');break;case _0xf693('0x28'):_0x143e16['start']='%'+_0x5d917f+'%';break;case _0xf693('0x29'):_0x143e16[_0xf693('0x33')]=_0x5d917f+'%';break;case _0xf693('0x34'):_0x143e16['start']='%'+_0x5d917f;break;case _0xf693('0x30'):var _0x3a2417=_0x5d917f[_0xf693('0x8')](',');var _0x5d917f=_0x3a2417[_0xf693('0x35')]();var _0x332a43=_0x3a2417['pop']();if(_0x158d15===_0xf693('0x11')){_0x5d917f=moment(_0x5d917f)['utcOffset'](0x0,!![])[_0xf693('0x18')]();_0x332a43=moment(_0x332a43)[_0xf693('0x36')](0x0,!![])[_0xf693('0x37')](0x17,_0xf693('0x38'))[_0xf693('0x37')](0x3b,_0xf693('0x39'))[_0xf693('0x37')](0x3b,_0xf693('0x3a'))[_0xf693('0x18')]();}_0x143e16={'start':_0x5d917f,'end':_0x332a43};break;default:_0x143e16[_0xf693('0x33')]=_0x5d917f;break;}return _0x143e16;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 19a654b..c509900 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 _0x2383=['$id','query','model','map','name','intersection','attributes','nolimit','limit','where','filter','object','value','VIRTUAL','lower','options','lodash','sequelize','parse','keys','fields','split','filters','isEmpty','type','$gte','format','YYYY-MM-DD','subtract','isArray','offset','sort','indexOf','priority','cast','unsigned','substr','DESC','col','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','includes','push','join','getOptions'];(function(_0x5919f5,_0x28bb4e){var _0x5a427b=function(_0x412ec6){while(--_0x412ec6){_0x5919f5['push'](_0x5919f5['shift']());}};_0x5a427b(++_0x28bb4e);}(_0x2383,0xb2));var _0x3238=function(_0x2268ca,_0x589f1e){_0x2268ca=_0x2268ca-0x0;var _0x1ae309=_0x2383[_0x2268ca];return _0x1ae309;};'use strict';var _=require(_0x3238('0x0'));var sequelize=require(_0x3238('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3a8bdf){var _0x22d5b3=['ne'];try{var _0x314bac=JSON[_0x3238('0x2')](_0x3a8bdf);var _0x3ea5b1=Object['keys'](_0x314bac)[0x0];return _0x22d5b3['includes'](_0x3ea5b1);}catch(_0x52ac30){return![];}}function getOperatorValue(_0xd9f6e0){var _0x4093e4=JSON['parse'](_0xd9f6e0);var _0x18f178=Object[_0x3238('0x3')](_0x4093e4)[0x0];var _0x9e3868=_0x4093e4[_0x18f178];return{['$'+_0x18f178]:_0x9e3868};}exports[_0x3238('0x4')]=function(_0x7be411){var _0x4ef91f=null;if(_0x7be411){_0x4ef91f=_0x7be411[_0x3238('0x5')](',');}return _0x4ef91f;};exports[_0x3238('0x6')]=function(_0x33aec1,_0x423651){var _0x200aeb={};if(!_[_0x3238('0x7')](_0x33aec1)){_['forOwn'](_0x33aec1,function(_0x189f2e,_0x6be5e7){try{if(_0x423651){var _0x4a12ff=_['find'](_0x423651,{'name':_0x6be5e7})||{};if(hasSequelizeOperator(_0x189f2e)){_0x200aeb[_0x6be5e7]=getOperatorValue(_0x189f2e);}else if(_0x4a12ff[_0x3238('0x8')]==='DATE'&&_['isPlainObject'](_0x189f2e)){var _0x132979=JSON['parse'](_0x189f2e);var _0x55a31f={'$gte':moment(moment(_0x132979[_0x3238('0x9')])[_0x3238('0xa')](_0x3238('0xb')))['utc']()['format'](),'$lte':moment(moment(_0x132979['$lte'])[_0x3238('0xa')](_0x3238('0xb')))['utc']()[_0x3238('0xc')](0x1,'s')[_0x3238('0xa')]()};_0x200aeb[_0x6be5e7]=_0x55a31f;}else if(_0x4a12ff['name']==='uniqueid'){_0x200aeb[_0x6be5e7]=_0x189f2e;}else{_0x200aeb[_0x6be5e7]=_[_0x3238('0xd')](_0x189f2e)?_0x189f2e:JSON[_0x3238('0x2')](_0x189f2e);}}else{_0x200aeb[_0x6be5e7]=_[_0x3238('0xd')](_0x189f2e)?_0x189f2e:JSON[_0x3238('0x2')](_0x189f2e);}}catch(_0x19cc01){_0x200aeb[_0x6be5e7]=_0x189f2e[_0x3238('0x5')](',');}});}return _0x200aeb;};exports['limit']=function(_0x43ac11){_0x43ac11=parseInt(_0x43ac11,0xa);if(!_0x43ac11||_0x43ac11<0x0){_0x43ac11=LIMIT_VALUE;}return _0x43ac11;};exports[_0x3238('0xe')]=function(_0xb0ef41){_0xb0ef41=parseInt(_0xb0ef41,0xa);if(!_0xb0ef41||_0xb0ef41<0x0){_0xb0ef41=0x0;}return _0xb0ef41;};exports[_0x3238('0xf')]=function(_0x4de1ba){var _0x238abb,_0x2d430a=null;if(_0x4de1ba){_0x238abb=_0x4de1ba[_0x3238('0x5')](',');_0x2d430a=_['map'](_0x238abb,function(_0x38503b){if(_0x38503b[_0x3238('0x10')]('-')===0x0){return[_0x38503b===_0x3238('0x11')?sequelize[_0x3238('0x12')](sequelize['col']('priority'),_0x3238('0x13')):_0x38503b[_0x3238('0x14')](0x1),_0x3238('0x15')];}else{return[_0x38503b===_0x3238('0x11')?sequelize[_0x3238('0x12')](sequelize[_0x3238('0x16')](_0x3238('0x11')),_0x3238('0x13')):_0x38503b,'ASC'];}});}return _0x2d430a;};exports[_0x3238('0x17')]=function(_0x3688b8,_0x5ddc26){if(_[_0x3238('0x7')](_0x3688b8)){return _0x3688b8;}if(_['isArray'](_0x3688b8)){for(var _0x43d8f6=0x0;_0x43d8f6<_0x3688b8[_0x3238('0x18')];_0x43d8f6+=0x1){_0x3688b8[_0x43d8f6]=this[_0x3238('0x17')](_0x3688b8[_0x43d8f6],_0x5ddc26);}return _0x3688b8;}if(!_[_0x3238('0x19')](_0x3688b8)){return _0x3688b8;}if(_[_0x3238('0x1a')](_0x5ddc26)){_0x5ddc26=[_0x5ddc26];}if(!_[_0x3238('0xd')](_0x5ddc26)){return _0x3688b8;}for(var _0x17ec9f=0x0;_0x17ec9f<_0x5ddc26['length'];_0x17ec9f+=0x1){_[_0x3238('0x1b')](_0x3688b8,_0x5ddc26[_0x17ec9f]);}for(var _0x3a20c1 in _0x3688b8){if(_0x3688b8[_0x3238('0x1c')](_0x3a20c1)){_0x3688b8[_0x3a20c1]=this['omit'](_0x3688b8[_0x3a20c1],_0x5ddc26);}}return _0x3688b8;};exports[_0x3238('0x1d')]=function(_0x1d9f58){return _0x1d9f58[_0x3238('0x1e')](RegExp(_0x3238('0x1f')))?!![]:![];};exports[_0x3238('0x20')]=function(_0x12e551){return _0x12e551[_0x3238('0x1e')](/^\S+@\S+$/)?!![]:![];};exports[_0x3238('0x21')]=function(_0x15962f){var _0xb41fe1=[];_0x15962f[_0x3238('0x5')](/[ ,]+/)['forEach'](function(_0x1f3f05){_0x1f3f05=_0x1f3f05['replace'](/([^:]")"+/g,'$1');_0x1f3f05='+'+_0x1f3f05+'*';if(_0x1f3f05[_0x3238('0x22')]('@'))_0x1f3f05='\x22'+_0x1f3f05+'\x22';_0xb41fe1[_0x3238('0x23')](_0x1f3f05);});return _0xb41fe1[_0x3238('0x24')]('\x20');};exports[_0x3238('0x25')]=function(_0x500e87,_0x4fb9d4,_0x103fff){var _0x399deb={},_0x1cd5f7={};if(_0x4fb9d4['query'][_0x3238('0x26')]){_0x4fb9d4[_0x3238('0x27')]['id']=_0x4fb9d4[_0x3238('0x27')][_0x3238('0x26')];delete _0x4fb9d4[_0x3238('0x27')][_0x3238('0x26')];}_0x399deb[_0x3238('0x28')]=_[_0x3238('0x29')](_0x500e87,_0x3238('0x2a'));_0x399deb[_0x3238('0x27')]=_[_0x3238('0x3')](_0x4fb9d4[_0x3238('0x27')]);_0x399deb['filters']=_[_0x3238('0x2b')](_0x399deb['model'],_0x399deb[_0x3238('0x27')]);_0x1cd5f7[_0x3238('0x2c')]=_[_0x3238('0x2b')](_0x399deb['model'],this[_0x3238('0x4')](_0x4fb9d4[_0x3238('0x27')]['fields']));_0x1cd5f7[_0x3238('0x2c')]=_0x1cd5f7[_0x3238('0x2c')][_0x3238('0x18')]?_0x1cd5f7['attributes']:_0x399deb[_0x3238('0x28')];if(!_0x4fb9d4[_0x3238('0x27')]['hasOwnProperty'](_0x3238('0x2d'))){_0x1cd5f7[_0x3238('0x2e')]=this['limit'](_0x4fb9d4[_0x3238('0x27')][_0x3238('0x2e')]);_0x1cd5f7[_0x3238('0xe')]=this[_0x3238('0xe')](_0x4fb9d4[_0x3238('0x27')]['offset']);}_0x1cd5f7['order']=this[_0x3238('0xf')](_0x4fb9d4[_0x3238('0x27')][_0x3238('0xf')]);_0x1cd5f7[_0x3238('0x2f')]=this['filters'](_['pick'](_0x4fb9d4[_0x3238('0x27')],_0x399deb[_0x3238('0x6')]),_0x500e87);if(_0x4fb9d4[_0x3238('0x27')][_0x3238('0x30')]){var _0x2b61e9=_0x500e87;var _0x4e7020=_0x4fb9d4['query'][_0x3238('0x30')];if(typeof _0x4e7020===_0x3238('0x31')){_0x2b61e9=_[_0x3238('0x30')](_0x500e87,function(_0x58800e){return _[_0x3238('0x22')](_0x4e7020['columns'],_0x58800e[_0x3238('0x2a')]);});_0x4e7020=_0x4e7020[_0x3238('0x32')];}_0x1cd5f7['where']=_['merge'](_0x1cd5f7[_0x3238('0x2f')],{'$or':_[_0x3238('0x29')](_0x2b61e9,function(_0x20c3d){if(_0x20c3d[_0x3238('0x8')]!==_0x3238('0x33')){if(_0x103fff){return sequelize[_0x3238('0x2f')](sequelize['fn'](_0x3238('0x34'),sequelize[_0x3238('0x16')](_0x20c3d[_0x3238('0x2a')])),{'$like':sequelize['fn']('lower','%'+_0x4fb9d4[_0x3238('0x27')][_0x3238('0x30')]+'%')});}else{var _0x11333c={};_0x11333c[_0x20c3d[_0x3238('0x2a')]]={'$like':'%'+_0x4fb9d4[_0x3238('0x27')]['filter']+'%'};return _0x11333c;}}})});}_0x1cd5f7=_['merge']({},_0x1cd5f7,_0x4fb9d4[_0x3238('0x35')]);return _0x1cd5f7;}; \ No newline at end of file +var _0x534b=['YYYY-MM-DD','$lte','subtract','name','isArray','limit','sort','map','indexOf','cast','priority','unsigned','substr','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','getOptions','query','$id','model','attributes','offset','order','where','pick','filter','columns','value','merge','VIRTUAL','col','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x534b,0x19a));var _0xb534=function(_0x196458,_0x435a41){_0x196458=_0x196458-0x0;var _0x152ba6=_0x534b[_0x196458];return _0x152ba6;};'use strict';var _=require(_0xb534('0x0'));var sequelize=require(_0xb534('0x1'));var moment=require(_0xb534('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1e279e){var _0x37123b=['ne'];try{var _0x18f0ba=JSON[_0xb534('0x3')](_0x1e279e);var _0x19224a=Object[_0xb534('0x4')](_0x18f0ba)[0x0];return _0x37123b[_0xb534('0x5')](_0x19224a);}catch(_0x56c1d2){return![];}}function getOperatorValue(_0x1cb72a){var _0x4588b9=JSON[_0xb534('0x3')](_0x1cb72a);var _0x5539b7=Object[_0xb534('0x4')](_0x4588b9)[0x0];var _0x4fc0e8=_0x4588b9[_0x5539b7];return{['$'+_0x5539b7]:_0x4fc0e8};}exports[_0xb534('0x6')]=function(_0x342934){var _0x3a3d52=null;if(_0x342934){_0x3a3d52=_0x342934[_0xb534('0x7')](',');}return _0x3a3d52;};exports[_0xb534('0x8')]=function(_0x9682f1,_0x415eac){var _0xe3c125={};if(!_[_0xb534('0x9')](_0x9682f1)){_[_0xb534('0xa')](_0x9682f1,function(_0x184743,_0x109495){try{if(_0x415eac){var _0x5714bd=_[_0xb534('0xb')](_0x415eac,{'name':_0x109495})||{};if(hasSequelizeOperator(_0x184743)){_0xe3c125[_0x109495]=getOperatorValue(_0x184743);}else if(_0x5714bd[_0xb534('0xc')]===_0xb534('0xd')&&_[_0xb534('0xe')](_0x184743)){var _0x49714c=JSON[_0xb534('0x3')](_0x184743);var _0x4fec1e={'$gte':moment(moment(_0x49714c[_0xb534('0xf')])[_0xb534('0x10')](_0xb534('0x11')))['utc']()[_0xb534('0x10')](),'$lte':moment(moment(_0x49714c[_0xb534('0x12')])['format']('YYYY-MM-DD'))['utc']()[_0xb534('0x13')](0x1,'s')['format']()};_0xe3c125[_0x109495]=_0x4fec1e;}else if(_0x5714bd[_0xb534('0x14')]==='uniqueid'){_0xe3c125[_0x109495]=_0x184743;}else{_0xe3c125[_0x109495]=_[_0xb534('0x15')](_0x184743)?_0x184743:JSON['parse'](_0x184743);}}else{_0xe3c125[_0x109495]=_[_0xb534('0x15')](_0x184743)?_0x184743:JSON[_0xb534('0x3')](_0x184743);}}catch(_0x42e6c0){_0xe3c125[_0x109495]=_0x184743[_0xb534('0x7')](',');}});}return _0xe3c125;};exports[_0xb534('0x16')]=function(_0x5f3ce3){_0x5f3ce3=parseInt(_0x5f3ce3,0xa);if(!_0x5f3ce3||_0x5f3ce3<0x0){_0x5f3ce3=LIMIT_VALUE;}return _0x5f3ce3;};exports['offset']=function(_0x2063f6){_0x2063f6=parseInt(_0x2063f6,0xa);if(!_0x2063f6||_0x2063f6<0x0){_0x2063f6=0x0;}return _0x2063f6;};exports[_0xb534('0x17')]=function(_0x55f937){var _0x13be36,_0x4c1f92=null;if(_0x55f937){_0x13be36=_0x55f937['split'](',');_0x4c1f92=_[_0xb534('0x18')](_0x13be36,function(_0x408a15){if(_0x408a15[_0xb534('0x19')]('-')===0x0){return[_0x408a15==='priority'?sequelize[_0xb534('0x1a')](sequelize['col'](_0xb534('0x1b')),_0xb534('0x1c')):_0x408a15[_0xb534('0x1d')](0x1),_0xb534('0x1e')];}else{return[_0x408a15===_0xb534('0x1b')?sequelize[_0xb534('0x1a')](sequelize['col'](_0xb534('0x1b')),_0xb534('0x1c')):_0x408a15,_0xb534('0x1f')];}});}return _0x4c1f92;};exports[_0xb534('0x20')]=function(_0x3400ac,_0x31ea28){if(_[_0xb534('0x9')](_0x3400ac)){return _0x3400ac;}if(_[_0xb534('0x15')](_0x3400ac)){for(var _0x3d6614=0x0;_0x3d6614<_0x3400ac[_0xb534('0x21')];_0x3d6614+=0x1){_0x3400ac[_0x3d6614]=this[_0xb534('0x20')](_0x3400ac[_0x3d6614],_0x31ea28);}return _0x3400ac;}if(!_[_0xb534('0x22')](_0x3400ac)){return _0x3400ac;}if(_[_0xb534('0x23')](_0x31ea28)){_0x31ea28=[_0x31ea28];}if(!_['isArray'](_0x31ea28)){return _0x3400ac;}for(var _0xb07741=0x0;_0xb07741<_0x31ea28['length'];_0xb07741+=0x1){_['unset'](_0x3400ac,_0x31ea28[_0xb07741]);}for(var _0x386c9c in _0x3400ac){if(_0x3400ac[_0xb534('0x24')](_0x386c9c)){_0x3400ac[_0x386c9c]=this[_0xb534('0x20')](_0x3400ac[_0x386c9c],_0x31ea28);}}return _0x3400ac;};exports[_0xb534('0x25')]=function(_0x5004f3){return _0x5004f3[_0xb534('0x26')](RegExp(_0xb534('0x27')))?!![]:![];};exports[_0xb534('0x28')]=function(_0x229f90){return _0x229f90['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xb534('0x29')]=function(_0x390a0a){var _0x5f5d34=[];_0x390a0a[_0xb534('0x7')](/[ ,]+/)[_0xb534('0x2a')](function(_0x5e482e){_0x5e482e=_0x5e482e['replace'](/([^:]")"+/g,'$1');_0x5e482e='+'+_0x5e482e+'*';if(_0x5e482e[_0xb534('0x5')]('@'))_0x5e482e='\x22'+_0x5e482e+'\x22';_0x5f5d34[_0xb534('0x2b')](_0x5e482e);});return _0x5f5d34[_0xb534('0x2c')]('\x20');};exports[_0xb534('0x2d')]=function(_0x2be91f,_0x53b5d3,_0x394140){var _0x475a8c={},_0x225daf={};if(_0x53b5d3[_0xb534('0x2e')]['$id']){_0x53b5d3[_0xb534('0x2e')]['id']=_0x53b5d3['query']['$id'];delete _0x53b5d3['query'][_0xb534('0x2f')];}_0x475a8c[_0xb534('0x30')]=_[_0xb534('0x18')](_0x2be91f,'name');_0x475a8c['query']=_[_0xb534('0x4')](_0x53b5d3['query']);_0x475a8c[_0xb534('0x8')]=_['intersection'](_0x475a8c[_0xb534('0x30')],_0x475a8c[_0xb534('0x2e')]);_0x225daf[_0xb534('0x31')]=_['intersection'](_0x475a8c[_0xb534('0x30')],this['fields'](_0x53b5d3[_0xb534('0x2e')][_0xb534('0x6')]));_0x225daf[_0xb534('0x31')]=_0x225daf[_0xb534('0x31')]['length']?_0x225daf[_0xb534('0x31')]:_0x475a8c[_0xb534('0x30')];if(!_0x53b5d3['query'][_0xb534('0x24')]('nolimit')){_0x225daf['limit']=this[_0xb534('0x16')](_0x53b5d3[_0xb534('0x2e')]['limit']);_0x225daf['offset']=this[_0xb534('0x32')](_0x53b5d3[_0xb534('0x2e')]['offset']);}_0x225daf[_0xb534('0x33')]=this[_0xb534('0x17')](_0x53b5d3[_0xb534('0x2e')][_0xb534('0x17')]);_0x225daf[_0xb534('0x34')]=this[_0xb534('0x8')](_[_0xb534('0x35')](_0x53b5d3['query'],_0x475a8c[_0xb534('0x8')]),_0x2be91f);if(_0x53b5d3[_0xb534('0x2e')][_0xb534('0x36')]){var _0x50a5d3=_0x2be91f;var _0x5f2fa6=_0x53b5d3[_0xb534('0x2e')][_0xb534('0x36')];if(typeof _0x5f2fa6==='object'){_0x50a5d3=_[_0xb534('0x36')](_0x2be91f,function(_0x3fcae9){return _['includes'](_0x5f2fa6[_0xb534('0x37')],_0x3fcae9[_0xb534('0x14')]);});_0x5f2fa6=_0x5f2fa6[_0xb534('0x38')];}_0x225daf['where']=_[_0xb534('0x39')](_0x225daf[_0xb534('0x34')],{'$or':_[_0xb534('0x18')](_0x50a5d3,function(_0x2b8442){if(_0x2b8442[_0xb534('0xc')]!==_0xb534('0x3a')){if(_0x394140){return sequelize[_0xb534('0x34')](sequelize['fn']('lower',sequelize[_0xb534('0x3b')](_0x2b8442[_0xb534('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x53b5d3[_0xb534('0x2e')][_0xb534('0x36')]+'%')});}else{var _0x47613c={};_0x47613c[_0x2b8442[_0xb534('0x14')]]={'$like':'%'+_0x53b5d3[_0xb534('0x2e')][_0xb534('0x36')]+'%'};return _0x47613c;}}})});}_0x225daf=_['merge']({},_0x225daf,_0x53b5d3[_0xb534('0x3c')]);return _0x225daf;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8d6dad3..bfad93e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb117=['public','client','use','set','json\x20replacer','split','static','views','/server/views','view\x20engine','html','50mb','json','express','body-parser','method-override','cookie-parser','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','appPath','join','root'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb117,0xfd));var _0x7b11=function(_0x479f6d,_0x1fbe2c){_0x479f6d=_0x479f6d-0x0;var _0x45eee3=_0xb117[_0x479f6d];return _0x45eee3;};'use strict';var express=require(_0x7b11('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x7b11('0x1'));var methodOverride=require(_0x7b11('0x2'));var cookieParser=require(_0x7b11('0x3'));var errorHandler=require('errorhandler');var path=require(_0x7b11('0x4'));var passport=require(_0x7b11('0x5'));var cors=require(_0x7b11('0x6'));var moment=require(_0x7b11('0x7'));var config=require(_0x7b11('0x8'));var db=require(_0x7b11('0x9'))['db'];exports[_0x7b11('0xa')]=function(_0x403612){var _0x19d3bc=_0x403612[_0x7b11('0xb')](_0x7b11('0xc'));if(_0x19d3bc===_0x7b11('0xd')){_0x403612['set'](_0x7b11('0xe'),path[_0x7b11('0xf')](config[_0x7b11('0x10')],_0x7b11('0x11')));}if(_0x19d3bc==='development'||_0x19d3bc==='test'){_0x403612['set'](_0x7b11('0xe'),path[_0x7b11('0xf')](config[_0x7b11('0x10')],_0x7b11('0x12')));_0x403612[_0x7b11('0x13')](errorHandler());}_0x403612[_0x7b11('0x14')](_0x7b11('0x15'),function(_0x17d071,_0x2ddd9d){if(this[_0x17d071]instanceof Date){_0x2ddd9d=this[_0x17d071]['toISOString']()[_0x7b11('0x16')]('.')[0x0]+'Z';}return _0x2ddd9d;});_0x403612[_0x7b11('0x13')](express[_0x7b11('0x17')](_0x403612[_0x7b11('0xb')](_0x7b11('0xe'))));_0x403612['set'](_0x7b11('0x18'),config['root']+_0x7b11('0x19'));_0x403612['engine']('html',require('ejs')['renderFile']);_0x403612['set'](_0x7b11('0x1a'),_0x7b11('0x1b'));_0x403612[_0x7b11('0x13')](bodyParser['urlencoded']({'limit':_0x7b11('0x1c'),'extended':!![]}));_0x403612[_0x7b11('0x13')](bodyParser[_0x7b11('0x1d')]({'limit':_0x7b11('0x1c')}));_0x403612[_0x7b11('0x13')](cors());_0x403612['use'](methodOverride());_0x403612[_0x7b11('0x13')](cookieParser());_0x403612[_0x7b11('0x13')](passport['initialize']());}; \ No newline at end of file +var _0x87f0=['json','initialize','serve-favicon','body-parser','method-override','errorhandler','path','passport','moment','./environment','../mysqldb','default','get','env','set','join','public','development','test','appPath','root','client','use','json\x20replacer','toISOString','split','static','ejs','view\x20engine','html','urlencoded','50mb'];(function(_0x59e73c,_0x599dc9){var _0xce736e=function(_0x59967f){while(--_0x59967f){_0x59e73c['push'](_0x59e73c['shift']());}};_0xce736e(++_0x599dc9);}(_0x87f0,0x1a2));var _0x087f=function(_0xab503b,_0x402bfa){_0xab503b=_0xab503b-0x0;var _0x1f0172=_0x87f0[_0xab503b];return _0x1f0172;};'use strict';var express=require('express');var favicon=require(_0x087f('0x0'));var bodyParser=require(_0x087f('0x1'));var methodOverride=require(_0x087f('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x087f('0x3'));var path=require(_0x087f('0x4'));var passport=require(_0x087f('0x5'));var cors=require('cors');var moment=require(_0x087f('0x6'));var config=require(_0x087f('0x7'));var db=require(_0x087f('0x8'))['db'];exports[_0x087f('0x9')]=function(_0x540bad){var _0x4141d0=_0x540bad[_0x087f('0xa')](_0x087f('0xb'));if(_0x4141d0==='production'){_0x540bad[_0x087f('0xc')]('appPath',path[_0x087f('0xd')](config['root'],_0x087f('0xe')));}if(_0x4141d0===_0x087f('0xf')||_0x4141d0===_0x087f('0x10')){_0x540bad[_0x087f('0xc')](_0x087f('0x11'),path[_0x087f('0xd')](config[_0x087f('0x12')],_0x087f('0x13')));_0x540bad[_0x087f('0x14')](errorHandler());}_0x540bad['set'](_0x087f('0x15'),function(_0x3480e4,_0x3e6823){if(this[_0x3480e4]instanceof Date){_0x3e6823=this[_0x3480e4][_0x087f('0x16')]()[_0x087f('0x17')]('.')[0x0]+'Z';}return _0x3e6823;});_0x540bad[_0x087f('0x14')](express[_0x087f('0x18')](_0x540bad[_0x087f('0xa')](_0x087f('0x11'))));_0x540bad[_0x087f('0xc')]('views',config['root']+'/server/views');_0x540bad['engine']('html',require(_0x087f('0x19'))['renderFile']);_0x540bad[_0x087f('0xc')](_0x087f('0x1a'),_0x087f('0x1b'));_0x540bad['use'](bodyParser[_0x087f('0x1c')]({'limit':_0x087f('0x1d'),'extended':!![]}));_0x540bad[_0x087f('0x14')](bodyParser[_0x087f('0x1e')]({'limit':_0x087f('0x1d')}));_0x540bad[_0x087f('0x14')](cors());_0x540bad[_0x087f('0x14')](methodOverride());_0x540bad['use'](cookieParser());_0x540bad[_0x087f('0x14')](passport[_0x087f('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c44c419..8ee1e45 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 _0x9ff8=['family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length'];(function(_0x10393c,_0x121f2f){var _0x474fac=function(_0x196615){while(--_0x196615){_0x10393c['push'](_0x10393c['shift']());}};_0x474fac(++_0x121f2f);}(_0x9ff8,0x1c0));var _0x89ff=function(_0x5f5b2a,_0x16bcad){_0x5f5b2a=_0x5f5b2a-0x0;var _0x1fe30c=_0x9ff8[_0x5f5b2a];return _0x1fe30c;};'use strict';var _=require(_0x89ff('0x0'));var os=require('os');var crypto=require(_0x89ff('0x1'));var machine=require(_0x89ff('0x2'));var exec=require(_0x89ff('0x3'))[_0x89ff('0x4')];var config=require('../environment');function getInterfaces(){var _0x2bdd7a=[];var _0x14f79b=os[_0x89ff('0x5')]();var _0x3defe5=_['orderBy'](_[_0x89ff('0x6')](_0x14f79b));for(var _0x333e3a=0x0;_0x333e3a<_0x3defe5[_0x89ff('0x7')];_0x333e3a++){var _0x53da8e=_0x14f79b[_0x3defe5[_0x333e3a]]['filter'](function(_0x23bd81){return _0x23bd81[_0x89ff('0x8')]===_0x89ff('0x9')&&_0x23bd81[_0x89ff('0xa')]===![];});_0x2bdd7a=_0x2bdd7a[_0x89ff('0xb')](_0x53da8e);}return _0x2bdd7a;}function getFirstInterface(){var _0x27fa81=_[_0x89ff('0xc')](getInterfaces());return{'macAddress':_0x27fa81&&_0x27fa81[_0x89ff('0xd')]?_0x27fa81[_0x89ff('0xd')]:_0x89ff('0xe'),'ipAddress':_0x27fa81&&_0x27fa81[_0x89ff('0xf')]?_0x27fa81[_0x89ff('0xf')]:'127.0.0.1'};}exports[_0x89ff('0x10')]=getFirstInterface;function getCPUhash(){var _0x3bfed1=_[_0x89ff('0x11')](os[_0x89ff('0x12')]()[_0x89ff('0x13')](function(_0x3a902c){return _0x3a902c[_0x89ff('0x14')];}))[_0x89ff('0x15')](':');return crypto['createHash'](_0x89ff('0x16'))[_0x89ff('0x17')](_0x3bfed1)[_0x89ff('0x18')](_0x89ff('0x19'));}exports[_0x89ff('0x1a')]=function(){var _0x4eaf66=os['platform']();var _0x188d3c=/[0-9a-f-]{36}/;if(config[_0x89ff('0x1b')]&&_0x188d3c[_0x89ff('0x1c')](config['licenseToken'])){return config['licenseToken'];}else if(_0x4eaf66===_0x89ff('0x1d')){return exec(_0x89ff('0x1e'),{'encoding':_0x89ff('0x1f')})[_0x89ff('0x20')]('\x0d\x0a','');}else{var _0x91ca0=getFirstInterface();var _0x1b4e94=getCPUhash();var _0x4f9875=_0x1b4e94+'|'+os[_0x89ff('0x21')]()+'|'+_0x91ca0[_0x89ff('0x22')]+'|'+_0x91ca0[_0x89ff('0x23')];var _0x5333e2=crypto[_0x89ff('0x24')](_0x89ff('0x16'))[_0x89ff('0x17')](_0x4f9875)[_0x89ff('0x18')]('hex');return _0x5333e2['substring'](0x0,0x8)+'-'+_0x5333e2[_0x89ff('0x25')](0x8,0xc)+'-'+_0x5333e2[_0x89ff('0x25')](0xc,0x10)+'-'+_0x5333e2[_0x89ff('0x25')](0x10,0x14)+'-'+_0x5333e2[_0x89ff('0x25')](0x14);}}; \ No newline at end of file +var _0x884d=['crypto','execSync','../environment','networkInterfaces','keys','length','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','digest','hex','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','md5','update','substring'];(function(_0x28c74a,_0x2bf678){var _0x44a4ba=function(_0x5ef84c){while(--_0x5ef84c){_0x28c74a['push'](_0x28c74a['shift']());}};_0x44a4ba(++_0x2bf678);}(_0x884d,0x14a));var _0xd884=function(_0x45b192,_0x4c10aa){_0x45b192=_0x45b192-0x0;var _0x237fcd=_0x884d[_0x45b192];return _0x237fcd;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xd884('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xd884('0x1')];var config=require(_0xd884('0x2'));function getInterfaces(){var _0x431289=[];var _0x2fae56=os[_0xd884('0x3')]();var _0x560624=_['orderBy'](_[_0xd884('0x4')](_0x2fae56));for(var _0x9bc653=0x0;_0x9bc653<_0x560624[_0xd884('0x5')];_0x9bc653++){var _0x5d177f=_0x2fae56[_0x560624[_0x9bc653]]['filter'](function(_0x2fc4ce){return _0x2fc4ce[_0xd884('0x6')]===_0xd884('0x7')&&_0x2fc4ce['internal']===![];});_0x431289=_0x431289[_0xd884('0x8')](_0x5d177f);}return _0x431289;}function getFirstInterface(){var _0x344de3=_[_0xd884('0x9')](getInterfaces());return{'macAddress':_0x344de3&&_0x344de3['mac']?_0x344de3[_0xd884('0xa')]:_0xd884('0xb'),'ipAddress':_0x344de3&&_0x344de3['address']?_0x344de3[_0xd884('0xc')]:_0xd884('0xd')};}exports[_0xd884('0xe')]=getFirstInterface;function getCPUhash(){var _0x43213=_[_0xd884('0xf')](os[_0xd884('0x10')]()[_0xd884('0x11')](function(_0x3e93f7){return _0x3e93f7[_0xd884('0x12')];}))[_0xd884('0x13')](':');return crypto[_0xd884('0x14')]('md5')['update'](_0x43213)[_0xd884('0x15')](_0xd884('0x16'));}exports['getUuid']=function(){var _0x418738=os[_0xd884('0x17')]();var _0x3df383=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3df383[_0xd884('0x18')](config[_0xd884('0x19')])){return config['licenseToken'];}else if(_0x418738===_0xd884('0x1a')){return exec(_0xd884('0x1b'),{'encoding':_0xd884('0x1c')})[_0xd884('0x1d')]('\x0d\x0a','');}else{var _0x592d62=getFirstInterface();var _0x162f9a=getCPUhash();var _0xd3eb8d=_0x162f9a+'|'+os['hostname']()+'|'+_0x592d62['macAddress']+'|'+_0x592d62['ipAddress'];var _0x402889=crypto[_0xd884('0x14')](_0xd884('0x1e'))[_0xd884('0x1f')](_0xd3eb8d)[_0xd884('0x15')]('hex');return _0x402889[_0xd884('0x20')](0x0,0x8)+'-'+_0x402889[_0xd884('0x20')](0x8,0xc)+'-'+_0x402889['substring'](0xc,0x10)+'-'+_0x402889[_0xd884('0x20')](0x10,0x14)+'-'+_0x402889[_0xd884('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index fea5fac..83e3163 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 _0x1f4b=['format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','version','../../mysqldb','./hardware','license','https://www.xcallymotion.com'];(function(_0x161b40,_0x35fb9c){var _0xe5ee05=function(_0x54b3b8){while(--_0x54b3b8){_0x161b40['push'](_0x161b40['shift']());}};_0xe5ee05(++_0x35fb9c);}(_0x1f4b,0x117));var _0xb1f4=function(_0x3b0e74,_0x295ca1){_0x3b0e74=_0x3b0e74-0x0;var _0x2ebdc1=_0x1f4b[_0x3b0e74];return _0x2ebdc1;};'use strict';var util=require(_0xb1f4('0x0'));var moment=require(_0xb1f4('0x1'));var rp=require('request-promise');var BPromise=require(_0xb1f4('0x2'));var pkginfo=require('pkginfo')(module,_0xb1f4('0x3'));var db=require(_0xb1f4('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb1f4('0x5'));var logger=require('../logger')(_0xb1f4('0x6'));var HOST=_0xb1f4('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1a0de7){return new BPromise(function(_0x482d2f,_0x36d3a9){var _0x4ff4f2=util[_0xb1f4('0x8')](_0xb1f4('0x9'),HOST,_0x1a0de7,module[_0xb1f4('0xa')][_0xb1f4('0x3')]);if(oldToken){_0x4ff4f2=util[_0xb1f4('0x8')](_0xb1f4('0xb'),HOST,_0x1a0de7,module[_0xb1f4('0xa')][_0xb1f4('0x3')],oldToken);}var _0x299e54={'uri':_0x4ff4f2,'method':_0xb1f4('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x299e54)[_0xb1f4('0xd')](function(_0x1125ed){_0x482d2f(_0x1125ed);})[_0xb1f4('0xe')](function(_0x434463){_0x36d3a9(_0x434463);});});}function manageLicense(_0x24c4e1,_0x58e273){var _0x36d800=_0x58e273[_0xb1f4('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x36d800[_0xb1f4('0x10')]!==_0x24c4e1&&!_0x36d800[_0xb1f4('0x11')]){oldToken=_0x36d800[_0xb1f4('0x10')];}httpRequest(_0x24c4e1)['then'](function(_0x158e94){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x158e94[_0xb1f4('0x12')]){isOldTokenSent=![];if(!_0x36d800[_0xb1f4('0x6')]&&_0x36d800[_0xb1f4('0x6')]!=_0x158e94[_0xb1f4('0x6')]||_0x36d800[_0xb1f4('0x6')]&&_0x36d800[_0xb1f4('0x11')]){logger[_0xb1f4('0x13')](_0xb1f4('0x14'));}if(_0x36d800[_0xb1f4('0x6')]&&!_0x36d800[_0xb1f4('0x11')]&&_0x36d800[_0xb1f4('0x6')]!=_0x158e94[_0xb1f4('0x6')]){logger[_0xb1f4('0x13')](_0xb1f4('0x15'));}if(_0x36d800[_0xb1f4('0x6')]&&!_0x36d800[_0xb1f4('0x11')]&&_0x36d800[_0xb1f4('0x6')]==_0x158e94[_0xb1f4('0x6')]){return _0x58e273;}return _0x58e273[_0xb1f4('0x16')]({'data1':_0x24c4e1,'data2':null,'license':_0x158e94['license']});}else{if(_0x158e94[_0xb1f4('0x6')]||_0x36d800[_0xb1f4('0x6')]){if(!_0x36d800[_0xb1f4('0x11')]){if(_0x36d800['data1']==_0x24c4e1){GRAY_PERIOD_REASON=_0xb1f4('0x17');logger[_0xb1f4('0x13')](_0xb1f4('0x18'));}else{GRAY_PERIOD_REASON=_0xb1f4('0x19');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x36d800['data1'],_0x24c4e1);}logger[_0xb1f4('0x13')](_0xb1f4('0x1a'),GRAY_PERIOD_REASON[_0xb1f4('0x1b')](),moment()[_0xb1f4('0x8')](_0xb1f4('0x1c')));return _0x58e273['update']({'data2':encryptor[_0xb1f4('0x1d')](moment()[_0xb1f4('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xb1f4('0x1e')](encryptor[_0xb1f4('0x1f')](_0x36d800['data2']),'days')>DAYS){logger['info'](_0xb1f4('0x20'),moment()[_0xb1f4('0x8')](_0xb1f4('0x1c')));isOldTokenSent=![];return _0x58e273[_0xb1f4('0x16')]({'data1':_0x24c4e1,'data2':null,'license':null});}}}else{if(_0x36d800[_0xb1f4('0x10')]!=_0x24c4e1){logger[_0xb1f4('0x13')](_0xb1f4('0x21'),_0x36d800['data1'],_0x24c4e1);return _0x58e273[_0xb1f4('0x16')]({'data1':_0x24c4e1,'data2':null,'license':null});}}}return _0x58e273;})[_0xb1f4('0xd')](function(_0x46ecce){_0x58e273=_0x46ecce;})[_0xb1f4('0xe')](function(_0x142083){logger['error'](_0x142083[_0xb1f4('0x22')]);})[_0xb1f4('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xb1f4('0x24')](),_0x58e273);},TIME);});}function defaultLicense(){var _0x3e9a12=hardware[_0xb1f4('0x24')]();if(_0x3e9a12){return db[_0xb1f4('0x25')][_0xb1f4('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3e9a12}})['spread'](function(_0x442a6b,_0x113bf4){logger[_0xb1f4('0x13')](_0xb1f4('0x27'),_0x3e9a12);manageLicense(_0x3e9a12,_0x442a6b);})[_0xb1f4('0xe')](function(_0xfd47c9){logger['error'](_0xfd47c9[_0xb1f4('0x22')]);});}}exports[_0xb1f4('0x28')]=defaultLicense; \ No newline at end of file +var _0x1370=['./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','request-promise','bluebird','pkginfo','version','../../mysqldb'];(function(_0x15d37f,_0x4b606b){var _0x733ae8=function(_0x86f1dc){while(--_0x86f1dc){_0x15d37f['push'](_0x15d37f['shift']());}};_0x733ae8(++_0x4b606b);}(_0x1370,0x194));var _0x0137=function(_0x1bfcfc,_0x140f5b){_0x1bfcfc=_0x1bfcfc-0x0;var _0x1041ff=_0x1370[_0x1bfcfc];return _0x1041ff;};'use strict';var util=require(_0x0137('0x0'));var moment=require('moment');var rp=require(_0x0137('0x1'));var BPromise=require(_0x0137('0x2'));var pkginfo=require(_0x0137('0x3'))(module,_0x0137('0x4'));var db=require(_0x0137('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x0137('0x6'));var logger=require(_0x0137('0x7'))(_0x0137('0x8'));var HOST=_0x0137('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1054d3){return new BPromise(function(_0x9b335a,_0x189314){var _0x12afb6=util['format'](_0x0137('0xa'),HOST,_0x1054d3,module[_0x0137('0xb')][_0x0137('0x4')]);if(oldToken){_0x12afb6=util[_0x0137('0xc')](_0x0137('0xd'),HOST,_0x1054d3,module[_0x0137('0xb')][_0x0137('0x4')],oldToken);}var _0x4beace={'uri':_0x12afb6,'method':_0x0137('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4beace)[_0x0137('0xf')](function(_0xdb8d3f){_0x9b335a(_0xdb8d3f);})[_0x0137('0x10')](function(_0xa1ece2){_0x189314(_0xa1ece2);});});}function manageLicense(_0x22cc12,_0x59c067){var _0x5aa0b7=_0x59c067[_0x0137('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x5aa0b7[_0x0137('0x12')]!==_0x22cc12&&!_0x5aa0b7[_0x0137('0x13')]){oldToken=_0x5aa0b7['data1'];}httpRequest(_0x22cc12)[_0x0137('0xf')](function(_0x588c71){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x588c71[_0x0137('0x14')]){isOldTokenSent=![];if(!_0x5aa0b7[_0x0137('0x8')]&&_0x5aa0b7['license']!=_0x588c71['license']||_0x5aa0b7[_0x0137('0x8')]&&_0x5aa0b7['data2']){logger[_0x0137('0x15')](_0x0137('0x16'));}if(_0x5aa0b7['license']&&!_0x5aa0b7[_0x0137('0x13')]&&_0x5aa0b7[_0x0137('0x8')]!=_0x588c71['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5aa0b7[_0x0137('0x8')]&&!_0x5aa0b7['data2']&&_0x5aa0b7['license']==_0x588c71[_0x0137('0x8')]){return _0x59c067;}return _0x59c067['update']({'data1':_0x22cc12,'data2':null,'license':_0x588c71[_0x0137('0x8')]});}else{if(_0x588c71[_0x0137('0x8')]||_0x5aa0b7[_0x0137('0x8')]){if(!_0x5aa0b7[_0x0137('0x13')]){if(_0x5aa0b7[_0x0137('0x12')]==_0x22cc12){GRAY_PERIOD_REASON='Disabled';logger[_0x0137('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x0137('0x17');logger[_0x0137('0x15')](_0x0137('0x18'),_0x5aa0b7[_0x0137('0x12')],_0x22cc12);}logger[_0x0137('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x0137('0x19')](),moment()[_0x0137('0xc')](_0x0137('0x1a')));return _0x59c067[_0x0137('0x1b')]({'data2':encryptor[_0x0137('0x1c')](moment()[_0x0137('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x0137('0x1d')](encryptor[_0x0137('0x1e')](_0x5aa0b7[_0x0137('0x13')]),_0x0137('0x1f'))>DAYS){logger[_0x0137('0x15')](_0x0137('0x20'),moment()[_0x0137('0xc')](_0x0137('0x1a')));isOldTokenSent=![];return _0x59c067[_0x0137('0x1b')]({'data1':_0x22cc12,'data2':null,'license':null});}}}else{if(_0x5aa0b7[_0x0137('0x12')]!=_0x22cc12){logger[_0x0137('0x15')](_0x0137('0x18'),_0x5aa0b7[_0x0137('0x12')],_0x22cc12);return _0x59c067[_0x0137('0x1b')]({'data1':_0x22cc12,'data2':null,'license':null});}}}return _0x59c067;})['then'](function(_0x281cd0){_0x59c067=_0x281cd0;})[_0x0137('0x10')](function(_0x282d99){logger[_0x0137('0x21')](_0x282d99['message']);})[_0x0137('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x59c067);},TIME);});}function defaultLicense(){var _0x56961d=hardware[_0x0137('0x23')]();if(_0x56961d){return db[_0x0137('0x24')][_0x0137('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x56961d}})[_0x0137('0x26')](function(_0x5a96e,_0x54b44c){logger[_0x0137('0x15')](_0x0137('0x27'),_0x56961d);manageLicense(_0x56961d,_0x5a96e);})[_0x0137('0x10')](function(_0x571e1a){logger[_0x0137('0x21')](_0x571e1a[_0x0137('0x28')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8f6e23f..dd2d613 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 _0xa449=['split','decryptString','format','%s:%s:%s','parse','demo','gray','add','machineUuid','changed','disabled','message','User','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','user','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2'];(function(_0x160e1e,_0x182139){var _0xb74fcf=function(_0x3933ad){while(--_0x3933ad){_0x160e1e['push'](_0x160e1e['shift']());}};_0xb74fcf(++_0x182139);}(_0xa449,0x1c1));var _0x9a44=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa449[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x9a44('0x0'));var _=require(_0x9a44('0x1'));var moment=require('moment');var BPromise=require(_0x9a44('0x2'));var hardware=require(_0x9a44('0x3'));var encryptor=require(_0x9a44('0x4'));var db=require(_0x9a44('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a44('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9a44('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9a44('0x8'),'machineUuid':hardware[_0x9a44('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x581787){return new BPromise(function(_0x514bb6,_0x4f3932){return db[_0x9a44('0xa')][_0x9a44('0xb')](_[_0x9a44('0xc')](_0x581787,{'raw':!![],'where':{'id':0x1}}))[_0x9a44('0xd')](function(_0x3eeeae){return checkLicense(_0x3eeeae,null);})['then'](function(_0x49d677){_0x514bb6(_0x49d677);return;})[_0x9a44('0xe')](function(_0x6b1e4b){_0x4f3932(_0x6b1e4b);});});}function checkLicense(_0x541886,_0x5b0349){if(!_0x541886){demoLicense[_0x9a44('0xf')]=_0x541886[_0x9a44('0x10')];return demoLicense;}try{var _0x8709b9=_0x5b0349||_0x541886[_0x9a44('0x11')];if(_[_0x9a44('0x12')](_0x8709b9)){throw new Error(_0x9a44('0x13'));}var _0x5226bb=_0x541886['data1'];var _0x3d27f1=_0x541886[_0x9a44('0x14')];var _0x34680f=_0x5226bb[_0x9a44('0x15')]('-')[0x4];var _0x5be08b=_0x5226bb[_0x9a44('0x15')]('-')[0x0];var _0x1f1041=encryptor[_0x9a44('0x16')](_0x8709b9,util[_0x9a44('0x17')](_0x9a44('0x18'),_0x34680f,_0x5226bb,_0x5be08b));var _0xe343d0=JSON[_0x9a44('0x19')](_0x1f1041);_0xe343d0[_0x9a44('0x1a')]=![];_0xe343d0['uuid']=_0x5226bb;_0xe343d0['machineUuid']=hardware[_0x9a44('0x9')]();if(_0x3d27f1){var _0x369888=encryptor['decryptString'](_0x3d27f1);_0xe343d0[_0x9a44('0x1b')]=_0x369888;_0xe343d0['deadline']=moment(_0x369888)[_0x9a44('0x1c')](0x7,'days')['format']();_0xe343d0['grayReason']=_0xe343d0[_0x9a44('0xf')]!=_0xe343d0[_0x9a44('0x1d')]?_0x9a44('0x1e'):_0x9a44('0x1f');}return _0xe343d0;}catch(_0xf0e957){breakingLicense[_0x9a44('0xf')]=_0x541886[_0x9a44('0x10')];breakingLicense[_0x9a44('0x20')]=_0xf0e957[_0x9a44('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x219311,_0x119cf4){getLicense()['then'](function(_0x4921fd){return db[_0x9a44('0x21')]['findAll']({'attributes':[_0x9a44('0x22'),[db[_0x9a44('0x23')]['fn'](_0x9a44('0x24'),db[_0x9a44('0x23')][_0x9a44('0x25')](_0x9a44('0x22'))),_0x9a44('0x26')]],'group':'role','where':{'role':{'$or':[_0x9a44('0x27'),'user',_0x9a44('0x28')]}},'raw':!![]})[_0x9a44('0xd')](function(_0x685237){var _0x1e1206={'user':_0x4921fd[_0x9a44('0x29')]||0x0,'telephone':_0x4921fd[_0x9a44('0x2a')]||0x0};_0x685237[_0x9a44('0x2b')](function(_0x1817b2){var _0x606c0a=_0x1817b2[_0x9a44('0x22')]===_0x9a44('0x27')?_0x9a44('0x2c'):_0x1817b2[_0x9a44('0x22')];_0x1e1206[_0x606c0a]-=_0x1817b2['count'];if(_0x1e1206[_0x606c0a]<0x0)_0x1e1206[_0x606c0a]=0x0;});_0x219311(_0x1e1206);return;});})['catch'](function(_0x15c7d8){_0x119cf4(_0x15c7d8);});});}function checkUserLimits(_0x466707){return new BPromise(function(_0x167695,_0x2525d6){getLimits()[_0x9a44('0xd')](function(_0x1f9433){var _0x1c40b4=_['pick'](_['countBy'](_0x466707,'role'),[_0x9a44('0x27'),'user',_0x9a44('0x28')]);var _0x52180e=(_0x1c40b4[_0x9a44('0x27')]||0x0)+(_0x1c40b4[_0x9a44('0x2c')]||0x0);var _0xac5452=_0x1c40b4[_0x9a44('0x28')]||0x0;if(_0x52180e>_0x1f9433['user'])return _0x2525d6('License\x20limit\x20reached\x20for\x20users');if(_0xac5452>_0x1f9433['telephone'])return _0x2525d6(_0x9a44('0x2d'));return _0x167695();})[_0x9a44('0xe')](function(_0x1095a9){_0x2525d6(_0x1095a9);});});}module[_0x9a44('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x2f5f=['add','days','format','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','telephones','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','parse','machineUuid','deadline'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x2f5f,0xd3));var _0xf2f5=function(_0x1f5d37,_0x234064){_0x1f5d37=_0x1f5d37-0x0;var _0x436b56=_0x2f5f[_0x1f5d37];return _0x436b56;};'use strict';var util=require(_0xf2f5('0x0'));var _=require(_0xf2f5('0x1'));var moment=require('moment');var BPromise=require(_0xf2f5('0x2'));var hardware=require(_0xf2f5('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf2f5('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf2f5('0x5'),'machineUuid':hardware[_0xf2f5('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf2f5('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf2f5('0x7'),'machineUuid':hardware[_0xf2f5('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x245c30){return new BPromise(function(_0x1f01c0,_0x2bcdce){return db[_0xf2f5('0x8')][_0xf2f5('0x9')](_[_0xf2f5('0xa')](_0x245c30,{'raw':!![],'where':{'id':0x1}}))[_0xf2f5('0xb')](function(_0x44ac00){return checkLicense(_0x44ac00,null);})['then'](function(_0x541c29){_0x1f01c0(_0x541c29);return;})[_0xf2f5('0xc')](function(_0x49bf8c){_0x2bcdce(_0x49bf8c);});});}function checkLicense(_0x46f730,_0x224b1f){if(!_0x46f730){demoLicense[_0xf2f5('0xd')]=_0x46f730[_0xf2f5('0xe')];return demoLicense;}try{var _0x3cb469=_0x224b1f||_0x46f730[_0xf2f5('0xf')];if(_[_0xf2f5('0x10')](_0x3cb469)){throw new Error(_0xf2f5('0x11'));}var _0x3ea977=_0x46f730['data1'];var _0x4dab8f=_0x46f730[_0xf2f5('0x12')];var _0x161dc5=_0x3ea977[_0xf2f5('0x13')]('-')[0x4];var _0x343aaf=_0x3ea977[_0xf2f5('0x13')]('-')[0x0];var _0x472982=encryptor[_0xf2f5('0x14')](_0x3cb469,util['format']('%s:%s:%s',_0x161dc5,_0x3ea977,_0x343aaf));var _0x269759=JSON[_0xf2f5('0x15')](_0x472982);_0x269759['demo']=![];_0x269759['uuid']=_0x3ea977;_0x269759[_0xf2f5('0x16')]=hardware['getUuid']();if(_0x4dab8f){var _0x1a9637=encryptor['decryptString'](_0x4dab8f);_0x269759['gray']=_0x1a9637;_0x269759[_0xf2f5('0x17')]=moment(_0x1a9637)[_0xf2f5('0x18')](0x7,_0xf2f5('0x19'))[_0xf2f5('0x1a')]();_0x269759[_0xf2f5('0x1b')]=_0x269759[_0xf2f5('0xd')]!=_0x269759['machineUuid']?'changed':_0xf2f5('0x1c');}return _0x269759;}catch(_0x2bf825){breakingLicense['uuid']=_0x46f730[_0xf2f5('0xe')];breakingLicense[_0xf2f5('0x1d')]=_0x2bf825[_0xf2f5('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5a309d,_0x264910){getLicense()[_0xf2f5('0xb')](function(_0x4ffbe4){return db[_0xf2f5('0x1e')][_0xf2f5('0x1f')]({'attributes':[_0xf2f5('0x20'),[db[_0xf2f5('0x21')]['fn'](_0xf2f5('0x22'),db[_0xf2f5('0x21')][_0xf2f5('0x23')](_0xf2f5('0x20'))),'count']],'group':_0xf2f5('0x20'),'where':{'role':{'$or':[_0xf2f5('0x24'),_0xf2f5('0x25'),_0xf2f5('0x26')]}},'raw':!![]})[_0xf2f5('0xb')](function(_0x41a1a6){var _0x434bff={'user':_0x4ffbe4[_0xf2f5('0x27')]||0x0,'telephone':_0x4ffbe4[_0xf2f5('0x28')]||0x0};_0x41a1a6['forEach'](function(_0x3af43b){var _0x5486aa=_0x3af43b[_0xf2f5('0x20')]==='admin'?_0xf2f5('0x25'):_0x3af43b[_0xf2f5('0x20')];_0x434bff[_0x5486aa]-=_0x3af43b[_0xf2f5('0x29')];if(_0x434bff[_0x5486aa]<0x0)_0x434bff[_0x5486aa]=0x0;});_0x5a309d(_0x434bff);return;});})[_0xf2f5('0xc')](function(_0x5b0b3a){_0x264910(_0x5b0b3a);});});}function checkUserLimits(_0x5b4b87){return new BPromise(function(_0x21118f,_0x46f721){getLimits()['then'](function(_0x4c196e){var _0x40bd45=_[_0xf2f5('0x2a')](_[_0xf2f5('0x2b')](_0x5b4b87,_0xf2f5('0x20')),[_0xf2f5('0x24'),_0xf2f5('0x25'),_0xf2f5('0x26')]);var _0x59ae07=(_0x40bd45[_0xf2f5('0x24')]||0x0)+(_0x40bd45[_0xf2f5('0x25')]||0x0);var _0xfaba0b=_0x40bd45[_0xf2f5('0x26')]||0x0;if(_0x59ae07>_0x4c196e[_0xf2f5('0x25')])return _0x46f721(_0xf2f5('0x2c'));if(_0xfaba0b>_0x4c196e['telephone'])return _0x46f721(_0xf2f5('0x2d'));return _0x21118f();})[_0xf2f5('0xc')](function(_0x524e5c){_0x46f721(_0x524e5c);});});}module[_0xf2f5('0x2e')]={'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 1c12f1a..e1704d7 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 _0xe1e3=['http://localhost:9000','app-id','exports'];(function(_0x2a5f37,_0x34adf4){var _0x37789a=function(_0x1a5aee){while(--_0x1a5aee){_0x2a5f37['push'](_0x2a5f37['shift']());}};_0x37789a(++_0x34adf4);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x2fd47c,_0x1b886c){_0x2fd47c=_0x2fd47c-0x0;var _0x3fc440=_0xe1e3[_0x2fd47c];return _0x3fc440;};'use strict';module[_0x3e1e('0x0')]={'DOMAIN':_0x3e1e('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x3e1e('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xd914=['http://localhost:9000','app-id','secret','exports'];(function(_0x5967c0,_0x452377){var _0x2ad249=function(_0x7eb26){while(--_0x7eb26){_0x5967c0['push'](_0x5967c0['shift']());}};_0x2ad249(++_0x452377);}(_0xd914,0x17f));var _0x4d91=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0xd914[_0x1f44e4];return _0x591989;};'use strict';module[_0x4d91('0x0')]={'DOMAIN':_0x4d91('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4d91('0x2'),'GOOGLE_SECRET':_0x4d91('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2dda25c..8dd4b29 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1d7=['message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','%s-%s','error','info','Console','env','winston','path','/var','log','xcally','format','%s-%s.log'];(function(_0x37bf03,_0x563509){var _0x33918c=function(_0xe29e24){while(--_0xe29e24){_0x37bf03['push'](_0x37bf03['shift']());}};_0x33918c(++_0x563509);}(_0xa1d7,0xad));var _0x7a1d=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0xa1d7[_0x318dda];return _0x3f97ca;};'use strict';var moment=require('moment');var winston=require(_0x7a1d('0x0'));var util=require('util');var path=require(_0x7a1d('0x1'));var debugLevel='INFO';function filename(_0x54c43e,_0x4dfec2){return path['join'](_0x7a1d('0x2'),_0x7a1d('0x3'),_0x7a1d('0x4'),util[_0x7a1d('0x5')](_0x7a1d('0x6'),_0x54c43e,_0x4dfec2));}function formatter(_0x483679,_0x517855){_0x517855[_0x7a1d('0x7')]=_0x517855['message'][_0x7a1d('0x8')](/@@{/g,_0x7a1d('0x9'))[_0x7a1d('0x8')](/}@@/g,_0x7a1d('0xa'))['replace'](/@{/g,'{{')[_0x7a1d('0x8')](/}@/g,'}}');return util[_0x7a1d('0x5')](_0x7a1d('0xb'),moment()[_0x7a1d('0x5')](_0x7a1d('0xc')),_0x517855['level']['toUpperCase'](),_0x483679,_0x517855['message']);}module['exports']=function(_0x329b97){return new winston[(_0x7a1d('0xd'))]({'transports':[new winston[(_0x7a1d('0xe'))]['File']({'name':util['format'](_0x7a1d('0xf'),_0x329b97,_0x7a1d('0x10')),'filename':filename(_0x329b97,'error'),'level':_0x7a1d('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x41976b){return formatter(_0x329b97,_0x41976b);}}),new winston[(_0x7a1d('0xe'))]['File']({'name':util[_0x7a1d('0x5')](_0x7a1d('0xf'),_0x329b97,_0x7a1d('0x11')),'filename':filename(_0x329b97,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x278d2d){return formatter(_0x329b97,_0x278d2d);}}),new winston[(_0x7a1d('0xe'))][(_0x7a1d('0x12'))]({'level':process[_0x7a1d('0x13')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x567c80){return formatter(_0x329b97,_0x567c80);}})]});}; \ No newline at end of file +var _0xeb60=['File','error','%s-%s','info','Console','env','debugLevel','moment','winston','path','INFO','join','/var','log','xcally','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xeb60,0x1c1));var _0x0eb6=function(_0x12dad5,_0x2a28be){_0x12dad5=_0x12dad5-0x0;var _0xe36e0d=_0xeb60[_0x12dad5];return _0xe36e0d;};'use strict';var moment=require(_0x0eb6('0x0'));var winston=require(_0x0eb6('0x1'));var util=require('util');var path=require(_0x0eb6('0x2'));var debugLevel=_0x0eb6('0x3');function filename(_0x4bd934,_0x5c1d5d){return path[_0x0eb6('0x4')](_0x0eb6('0x5'),_0x0eb6('0x6'),_0x0eb6('0x7'),util[_0x0eb6('0x8')]('%s-%s.log',_0x4bd934,_0x5c1d5d));}function formatter(_0x533ae2,_0x492ba0){_0x492ba0[_0x0eb6('0x9')]=_0x492ba0['message']['replace'](/@@{/g,_0x0eb6('0xa'))[_0x0eb6('0xb')](/}@@/g,_0x0eb6('0xc'))[_0x0eb6('0xb')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x0eb6('0x8')](_0x0eb6('0xd'),moment()[_0x0eb6('0x8')](_0x0eb6('0xe')),_0x492ba0[_0x0eb6('0xf')][_0x0eb6('0x10')](),_0x533ae2,_0x492ba0['message']);}module['exports']=function(_0x44f898){return new winston[(_0x0eb6('0x11'))]({'transports':[new winston[(_0x0eb6('0x12'))][(_0x0eb6('0x13'))]({'name':util['format']('%s-%s',_0x44f898,'error'),'filename':filename(_0x44f898,_0x0eb6('0x14')),'level':_0x0eb6('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1bd7c1){return formatter(_0x44f898,_0x1bd7c1);}}),new winston[(_0x0eb6('0x12'))][(_0x0eb6('0x13'))]({'name':util[_0x0eb6('0x8')](_0x0eb6('0x15'),_0x44f898,_0x0eb6('0x16')),'filename':filename(_0x44f898,_0x0eb6('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2415e3){return formatter(_0x44f898,_0x2415e3);}}),new winston[(_0x0eb6('0x12'))][(_0x0eb6('0x17'))]({'level':process[_0x0eb6('0x18')][_0x0eb6('0x19')]||debugLevel,'json':![],'formatter':function(_0x4eb880){return formatter(_0x44f898,_0x4eb880);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c13ed61..b304625 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 _0xe562=['join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x96e227,_0x43fd87){var _0x4c3b85=function(_0x5af4b7){while(--_0x5af4b7){_0x96e227['push'](_0x96e227['shift']());}};_0x4c3b85(++_0x43fd87);}(_0xe562,0xf5));var _0x2e56=function(_0x5b6904,_0x481822){_0x5b6904=_0x5b6904-0x0;var _0x1fd9e7=_0xe562[_0x5b6904];return _0x1fd9e7;};'use strict';var path=require(_0x2e56('0x0'));var os=require('os');var config={'apps':[{'name':_0x2e56('0x1'),'script':path[_0x2e56('0x2')](__dirname,_0x2e56('0x3'))},{'name':_0x2e56('0x4'),'script':path[_0x2e56('0x2')](__dirname,_0x2e56('0x5'))},{'name':_0x2e56('0x6'),'script':path[_0x2e56('0x2')](__dirname,_0x2e56('0x7'))},{'name':_0x2e56('0x8'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x2e56('0x9'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0x2e56('0xa'),'script':path[_0x2e56('0x2')](__dirname,_0x2e56('0xb'))}]};module[_0x2e56('0xc')]=config; \ No newline at end of file +var _0x7614=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x5bebbe,_0x3d5d2a){var _0x150a59=function(_0x56e21b){while(--_0x56e21b){_0x5bebbe['push'](_0x5bebbe['shift']());}};_0x150a59(++_0x3d5d2a);}(_0x7614,0xe1));var _0x4761=function(_0x2f3bc9,_0x12c525){_0x2f3bc9=_0x2f3bc9-0x0;var _0x1355a2=_0x7614[_0x2f3bc9];return _0x1355a2;};'use strict';var path=require(_0x4761('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x4761('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x4761('0x2'),'script':path[_0x4761('0x1')](__dirname,_0x4761('0x3'))},{'name':_0x4761('0x4'),'script':path[_0x4761('0x1')](__dirname,_0x4761('0x5'))},{'name':'email','script':path[_0x4761('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x4761('0x6'),'script':path[_0x4761('0x1')](__dirname,_0x4761('0x7'))},{'name':_0x4761('0x8'),'script':path[_0x4761('0x1')](__dirname,_0x4761('0x9'))}]};module[_0x4761('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c411299..8e83054 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 _0x9fb3=['delete','dump','pm2','bluebird','./config','connect','then','disconnect','stop','restart','list','describe'];(function(_0x5b32ea,_0x3e507b){var _0xeb3c94=function(_0xf6039d){while(--_0xf6039d){_0x5b32ea['push'](_0x5b32ea['shift']());}};_0xeb3c94(++_0x3e507b);}(_0x9fb3,0x9e));var _0x39fb=function(_0x3fcf48,_0x2895d9){_0x3fcf48=_0x3fcf48-0x0;var _0x236f62=_0x9fb3[_0x3fcf48];return _0x236f62;};'use strict';var pm2=require(_0x39fb('0x0'));var BPromise=require(_0x39fb('0x1'));var config=require(_0x39fb('0x2'));function connect(){return new BPromise(function(_0x2a219f,_0x14929e){return pm2[_0x39fb('0x3')](function(_0x5a4c9b){if(_0x5a4c9b){return _0x14929e(_0x5a4c9b);}return _0x2a219f('connected');});});};exports['start']=function(_0x42ecd6){return connect()[_0x39fb('0x4')](function(){return new BPromise(function(_0x100399,_0x32d762){return pm2['start'](_0x42ecd6,function(_0x56c813,_0x3a4ce4){if(_0x56c813){return _0x32d762(_0x56c813);}pm2[_0x39fb('0x5')]();return _0x100399(_0x3a4ce4);});});});};exports[_0x39fb('0x6')]=function(_0x1134fc){return connect()['then'](function(){return new BPromise(function(_0x1cf9c0,_0xc8c0f7){return pm2['stop'](_0x1134fc,function(_0x50120c,_0xd4806e){if(_0x50120c){return _0xc8c0f7(_0x50120c);}pm2[_0x39fb('0x5')]();return _0x1cf9c0(_0xd4806e);});});});};exports['restart']=function(_0x1f5aeb){return connect()[_0x39fb('0x4')](function(){return new BPromise(function(_0x3ce841,_0x1f53f6){return pm2[_0x39fb('0x7')](_0x1f5aeb,function(_0x16475a,_0x39fdd0){if(_0x16475a){return _0x1f53f6(_0x16475a);}pm2['disconnect']();return _0x3ce841(_0x39fdd0);});});});};exports[_0x39fb('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x141547,_0x8d86ba){return pm2[_0x39fb('0x8')](function(_0x4aae65,_0x555ec8){if(_0x4aae65){return _0x8d86ba(_0x4aae65);}pm2[_0x39fb('0x5')]();return _0x141547(_0x555ec8);});});});};exports[_0x39fb('0x9')]=function(_0x16ad23){return connect()[_0x39fb('0x4')](function(){return new BPromise(function(_0x243aae,_0x37aeee){return pm2[_0x39fb('0x9')](_0x16ad23,function(_0x50f819,_0x2d7c7a){if(_0x50f819){return _0x37aeee(_0x50f819);}pm2[_0x39fb('0x5')]();return _0x243aae(_0x2d7c7a);});});});};exports[_0x39fb('0xa')]=function(_0x57edef){return connect()['then'](function(){return new BPromise(function(_0x2ff3be,_0x1fe549){return pm2[_0x39fb('0xa')](_0x57edef,function(_0x512fe7,_0x40e3b5){if(_0x512fe7){return _0x1fe549(_0x512fe7);}pm2[_0x39fb('0x5')]();return _0x2ff3be(_0x40e3b5);});});});};exports['dump']=function(){return connect()[_0x39fb('0x4')](function(){return new BPromise(function(_0x455e3e,_0x43daeb){return pm2[_0x39fb('0xb')](function(_0x3d7c1b){if(_0x3d7c1b){return _0x43daeb(_0x3d7c1b);}return _0x455e3e('saved');});});});}; \ No newline at end of file +var _0x285e=['then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x285e,0xdc));var _0xe285=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x285e[_0x3ec1da];return _0x472358;};'use strict';var pm2=require(_0xe285('0x0'));var BPromise=require(_0xe285('0x1'));var config=require(_0xe285('0x2'));function connect(){return new BPromise(function(_0x2269e6,_0x1a6318){return pm2[_0xe285('0x3')](function(_0x2a4520){if(_0x2a4520){return _0x1a6318(_0x2a4520);}return _0x2269e6('connected');});});};exports['start']=function(_0x388096){return connect()[_0xe285('0x4')](function(){return new BPromise(function(_0x204774,_0x172153){return pm2[_0xe285('0x5')](_0x388096,function(_0x396ee4,_0x4abb92){if(_0x396ee4){return _0x172153(_0x396ee4);}pm2[_0xe285('0x6')]();return _0x204774(_0x4abb92);});});});};exports[_0xe285('0x7')]=function(_0x272d75){return connect()[_0xe285('0x4')](function(){return new BPromise(function(_0x1a96fa,_0x29cb18){return pm2[_0xe285('0x7')](_0x272d75,function(_0x3f64c9,_0x1c701a){if(_0x3f64c9){return _0x29cb18(_0x3f64c9);}pm2[_0xe285('0x6')]();return _0x1a96fa(_0x1c701a);});});});};exports[_0xe285('0x8')]=function(_0x5aa749){return connect()['then'](function(){return new BPromise(function(_0xec36e9,_0x25d0d1){return pm2[_0xe285('0x8')](_0x5aa749,function(_0x5f4858,_0x5d6cfb){if(_0x5f4858){return _0x25d0d1(_0x5f4858);}pm2['disconnect']();return _0xec36e9(_0x5d6cfb);});});});};exports['list']=function(){return connect()[_0xe285('0x4')](function(){return new BPromise(function(_0x353b60,_0x30509a){return pm2[_0xe285('0x9')](function(_0x359b89,_0x2da2e1){if(_0x359b89){return _0x30509a(_0x359b89);}pm2[_0xe285('0x6')]();return _0x353b60(_0x2da2e1);});});});};exports[_0xe285('0xa')]=function(_0x1f82ad){return connect()[_0xe285('0x4')](function(){return new BPromise(function(_0x55bdd0,_0x578baf){return pm2[_0xe285('0xa')](_0x1f82ad,function(_0x4c87aa,_0x1fadc2){if(_0x4c87aa){return _0x578baf(_0x4c87aa);}pm2['disconnect']();return _0x55bdd0(_0x1fadc2);});});});};exports['delete']=function(_0x476b67){return connect()[_0xe285('0x4')](function(){return new BPromise(function(_0x465491,_0x4e8464){return pm2[_0xe285('0xb')](_0x476b67,function(_0x2e00c0,_0x44eda3){if(_0x2e00c0){return _0x4e8464(_0x2e00c0);}pm2[_0xe285('0x6')]();return _0x465491(_0x44eda3);});});});};exports[_0xe285('0xc')]=function(){return connect()[_0xe285('0x4')](function(){return new BPromise(function(_0x23ee3b,_0x31cf3c){return pm2['dump'](function(_0x33d972){if(_0x33d972){return _0x31cf3c(_0x33d972);}return _0x23ee3b(_0xe285('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 9369318..916b226 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 _0x63fa=['moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','redis','Setting','find','chatTimeout','then','ChatInteraction','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x63fa,0xf4));var _0xa63f=function(_0x1c2084,_0x19a89e){_0x1c2084=_0x1c2084-0x0;var _0x2cc940=_0x63fa[_0x1c2084];return _0x2cc940;};'use strict';var _=require(_0xa63f('0x0'));var moment=require(_0xa63f('0x1'));var Redis=require(_0xa63f('0x2'));var util=require(_0xa63f('0x3'));var config=require(_0xa63f('0x4'));var db=require(_0xa63f('0x5'))['db'];var logger=require(_0xa63f('0x6'))(_0xa63f('0x7'));config['redis']=_[_0xa63f('0x8')](config['redis'],{'host':_0xa63f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa63f('0xa')]));function closeInteractions(){var _0x1460af=0x0;var _0x4e8984=[];return db[_0xa63f('0xb')][_0xa63f('0xc')]({'raw':!![],'attributes':['id',_0xa63f('0xd')],'where':{'id':0x1}})[_0xa63f('0xe')](function(_0x1b71e0){_0x1460af=_0x1b71e0[_0xa63f('0xd')];if(_0x1460af){return db[_0xa63f('0xf')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa63f('0x10')](_0x1b71e0[_0xa63f('0xd')],_0xa63f('0x11'))}}});}else{return[];}})[_0xa63f('0xe')](function(_0x19bbf0){if(_0x19bbf0&&_0x19bbf0[_0xa63f('0x12')]){_0x4e8984=_[_0xa63f('0x13')](_0x19bbf0||[],'id');logger[_0xa63f('0x14')](_0xa63f('0x15'),_0x4e8984[_0xa63f('0x16')]());return db[_0xa63f('0xf')][_0xa63f('0x17')]({'closeReason':_0xa63f('0x18'),'disposition':_0xa63f('0x19'),'closed':!![],'closedAt':moment()[_0xa63f('0x1a')](_0xa63f('0x1b'))},{'where':{'id':_0x4e8984}});}})[_0xa63f('0xe')](function(){if(_0x4e8984&&_0x4e8984[_0xa63f('0x12')]){logger[_0xa63f('0x14')](_0xa63f('0x1c'),_0x4e8984[_0xa63f('0x16')]());for(var _0x12c1c1=0x0;_0x12c1c1<_0x4e8984['length'];_0x12c1c1++){io[_0xa63f('0x1d')](_0xa63f('0x1e'),{'id':_0x4e8984[_0x12c1c1],'closed':!![]});}}})[_0xa63f('0x1f')](function(_0x451cb6){logger['error'](_0xa63f('0x20'),_0x451cb6?util[_0xa63f('0x21')](_0x451cb6,{'showHidden':![],'depth':null}):'');});}exports[_0xa63f('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xacb6=['[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','info'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xacb6,0xfc));var _0x6acb=function(_0x3fe5af,_0x46db34){_0x3fe5af=_0x3fe5af-0x0;var _0x3eb435=_0xacb6[_0x3fe5af];return _0x3eb435;};'use strict';var _=require(_0x6acb('0x0'));var moment=require(_0x6acb('0x1'));var Redis=require(_0x6acb('0x2'));var util=require(_0x6acb('0x3'));var config=require('../../config/environment');var db=require(_0x6acb('0x4'))['db'];var logger=require(_0x6acb('0x5'))(_0x6acb('0x6'));config[_0x6acb('0x7')]=_[_0x6acb('0x8')](config[_0x6acb('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6acb('0x7')]));function closeInteractions(){var _0x5515f0=0x0;var _0x5b2b38=[];return db[_0x6acb('0x9')][_0x6acb('0xa')]({'raw':!![],'attributes':['id',_0x6acb('0xb')],'where':{'id':0x1}})[_0x6acb('0xc')](function(_0x4a3170){_0x5515f0=_0x4a3170[_0x6acb('0xb')];if(_0x5515f0){return db['ChatInteraction'][_0x6acb('0xd')]({'raw':!![],'attributes':['id',_0x6acb('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6acb('0xf')](_0x4a3170[_0x6acb('0xb')],_0x6acb('0x10'))}}});}else{return[];}})['then'](function(_0x54bc27){if(_0x54bc27&&_0x54bc27[_0x6acb('0x11')]){_0x5b2b38=_[_0x6acb('0x12')](_0x54bc27||[],'id');logger[_0x6acb('0x13')](_0x6acb('0x14'),_0x5b2b38[_0x6acb('0x15')]());return db[_0x6acb('0x16')][_0x6acb('0x17')]({'closeReason':_0x6acb('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6acb('0x19')](_0x6acb('0x1a'))},{'where':{'id':_0x5b2b38}});}})['then'](function(){if(_0x5b2b38&&_0x5b2b38['length']){logger['info'](_0x6acb('0x1b'),_0x5b2b38[_0x6acb('0x15')]());for(var _0x5abb59=0x0;_0x5abb59<_0x5b2b38['length'];_0x5abb59++){io['emit'](_0x6acb('0x1c'),{'id':_0x5b2b38[_0x5abb59],'closed':!![]});}}})[_0x6acb('0x1d')](function(_0x321a50){logger[_0x6acb('0x1e')](_0x6acb('0x1f'),_0x321a50?util[_0x6acb('0x20')](_0x321a50,{'showHidden':![],'depth':null}):'');});}exports[_0x6acb('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index e8232c0..b724db1 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 _0x4d95=['message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','findAll','MailServerOut','keys','jobs','toString','difference','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','add\x20cron','update','stop\x20cron','run','start','util','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','basename','extname','existsSync','status','Sent'];(function(_0x59659d,_0xb17019){var _0x2adbb5=function(_0x22ea94){while(--_0x22ea94){_0x59659d['push'](_0x59659d['shift']());}};_0x2adbb5(++_0xb17019);}(_0x4d95,0x185));var _0x54d9=function(_0xb0aae4,_0x120e3a){_0xb0aae4=_0xb0aae4-0x0;var _0x55941d=_0x4d95[_0xb0aae4];return _0x55941d;};'use strict';var fs=require('fs');var util=require(_0x54d9('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x54d9('0x1'));var BPromise=require('bluebird');var logger=require(_0x54d9('0x2'))(_0x54d9('0x3'));var db=require(_0x54d9('0x4'))['db'];var analyticCustomReportController=require(_0x54d9('0x5'));var analyticDefaultReportController=require(_0x54d9('0x6'));var client=jayson[_0x54d9('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4881ad,_0x371148){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x4881ad[_0x54d9('0x8')]);var _0x39a3c4=!![];var _0x52421d={'tls':{'rejectUnauthorized':![]}};if(_0x4881ad[_0x54d9('0x9')]['Smtp'][_0x54d9('0xa')]){_0x52421d[_0x54d9('0xa')]=_0x4881ad[_0x54d9('0x9')][_0x54d9('0xb')][_0x54d9('0xa')];}else{_0x52421d[_0x54d9('0xc')]=_0x4881ad[_0x54d9('0x9')][_0x54d9('0xb')]['host'];_0x52421d[_0x54d9('0xd')]=_0x4881ad[_0x54d9('0x9')]['Smtp'][_0x54d9('0xd')];_0x52421d[_0x54d9('0xe')]=_0x4881ad[_0x54d9('0x9')]['Smtp'][_0x54d9('0xe')];}if(_0x4881ad['MailAccount']['Smtp'][_0x54d9('0xf')]){_0x52421d[_0x54d9('0x10')]={'user':_0x4881ad[_0x54d9('0x9')][_0x54d9('0xb')][_0x54d9('0x11')],'pass':_0x4881ad[_0x54d9('0x9')]['Smtp']['pass']};}var _0x5128dd={'account':_0x52421d,'message':{'from':util[_0x54d9('0x12')]('\x22%s\x22\x20<%s>',_0x4881ad[_0x54d9('0x9')][_0x54d9('0x13')],_0x4881ad[_0x54d9('0x9')][_0x54d9('0x8')]||_0x4881ad[_0x54d9('0x9')]['Smtp'][_0x54d9('0x11')]),'to':_0x4881ad[_0x54d9('0x8')],'cc':_0x4881ad['cc'],'bcc':_0x4881ad[_0x54d9('0x14')],'subject':util[_0x54d9('0x12')](_0x54d9('0x15'),_0x371148[_0x54d9('0x13')],_0x4881ad[_0x54d9('0x16')],_0x4881ad['subtractUnit'])}};var _0x195feb=path[_0x54d9('0x17')](__dirname,_0x54d9('0x18'));var _0x50b4c2=_0x371148[_0x54d9('0x19')];var _0x52f27e=util[_0x54d9('0x12')]('%s.%s',path[_0x54d9('0x1a')](_0x371148['savename'],path[_0x54d9('0x1b')](_0x371148[_0x54d9('0x19')])),'zip');var _0x2119a9=path[_0x54d9('0x17')](_0x195feb,_0x50b4c2);var _0x11f9ff=path[_0x54d9('0x17')](_0x195feb,_0x52f27e);if(fs[_0x54d9('0x1c')](_0x2119a9)){_0x371148[_0x54d9('0x1d')]=_0x54d9('0x1e');_0x5128dd[_0x54d9('0x1f')][_0x54d9('0x20')]=[{'filename':_0x50b4c2,'path':_0x2119a9}];_0x5128dd['message'][_0x54d9('0x21')]=util[_0x54d9('0x12')](_0x54d9('0x22'),JSON[_0x54d9('0x23')](_0x371148,null,0x2));}else if(fs[_0x54d9('0x1c')](_0x11f9ff)){_0x371148[_0x54d9('0x1d')]=_0x54d9('0x1e');_0x5128dd[_0x54d9('0x1f')][_0x54d9('0x20')]=[{'filename':_0x52f27e,'path':_0x11f9ff}];}else{_0x5128dd[_0x54d9('0x1f')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4881ad[_0x54d9('0x24')]){_0x39a3c4=![];logger[_0x54d9('0x25')](_0x54d9('0x26'));}}if(_0x39a3c4){return client['request'](_0x54d9('0x27'),_0x5128dd)['then'](function(_0x147751){if(_0x147751[_0x54d9('0x28')]){return logger[_0x54d9('0x28')](_0x54d9('0x29'),JSON[_0x54d9('0x23')](_0x147751));}return logger[_0x54d9('0x25')](_0x54d9('0x2a'));})[_0x54d9('0x2b')](function(_0x2a26b2){return logger[_0x54d9('0x28')](_0x54d9('0x29'),JSON[_0x54d9('0x23')](_0x2a26b2));});}};}function handleError(){return function(_0x2eab08){return logger[_0x54d9('0x28')](JSON[_0x54d9('0x23')](_0x2eab08));};}function handleResult(_0x16678c){return function(_0x311796){logger[_0x54d9('0x25')](_0x54d9('0x2c'),JSON[_0x54d9('0x23')](_0x311796));if(_0x16678c['MailAccount']&&_0x16678c[_0x54d9('0x9')][_0x54d9('0xb')]&&!_[_0x54d9('0x2d')](_0x16678c['email'])){setTimeout(handleSendEmail(_0x16678c,_0x311796),0x3c*0x3e8);}};}function handleJob(_0x443597){return function(){try{if(_[_0x54d9('0x2d')](_0x443597[_0x54d9('0x16')])){return logger[_0x54d9('0x25')](_0x54d9('0x2e'));}if(_[_0x54d9('0x2d')](_0x443597[_0x54d9('0x2f')])){return logger['info'](_0x54d9('0x30'));}var _0x3a7ae1={'startDate':moment()[_0x54d9('0x31')](_0x443597[_0x54d9('0x16')],_0x443597['subtractUnit'])['format'](_0x54d9('0x32')),'endDate':moment()[_0x54d9('0x12')](_0x54d9('0x32')),'type':_0x54d9('0x33'),'output':_0x443597[_0x54d9('0x34')],'name':_0x443597[_0x54d9('0x13')]};if(!_['isNil'](_0x443597[_0x54d9('0x35')])){logger['info'](_0x54d9('0x36'),_0x443597[_0x54d9('0x35')]);return analyticDefaultReportController[_0x54d9('0x37')]({'id':_0x443597[_0x54d9('0x35')]},_0x3a7ae1)[_0x54d9('0x38')](handleResult(_0x443597))['catch'](handleError());}if(!_[_0x54d9('0x2d')](_0x443597[_0x54d9('0x39')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x443597['CustomReportId']);return analyticCustomReportController[_0x54d9('0x37')]({'id':_0x443597[_0x54d9('0x39')]},_0x3a7ae1)[_0x54d9('0x38')](handleResult(_0x443597))[_0x54d9('0x2b')](handleError());}}catch(_0x37dcaf){logger[_0x54d9('0x28')](JSON[_0x54d9('0x23')](_0x37dcaf));}return logger[_0x54d9('0x25')](_0x54d9('0x3a'));};}function getJobs(_0x5ecb6d){var _0x4519f4={};if(_0x5ecb6d){_0x4519f4['id']=_0x5ecb6d;}return db['Schedule'][_0x54d9('0x3b')]({'where':_0x4519f4,'include':[{'model':db[_0x54d9('0x9')],'attributes':['id','name',_0x54d9('0x8')],'include':[{'model':db[_0x54d9('0x3c')],'as':_0x54d9('0xb')}]}]})[_0x54d9('0x38')](function(_0x29af9c){var _0x2e3406=_[_0x54d9('0x3d')](manager[_0x54d9('0x3e')]);var _0x3663f6=_['map'](_0x29af9c,function(_0x17dc05){return _0x17dc05['id'][_0x54d9('0x3f')]();});var _0x343648=_['keyBy'](_0x29af9c,function(_0x3e2207){return _0x3e2207['id'][_0x54d9('0x3f')]();});var _0x987535=_0x5ecb6d?_0x3663f6:_[_0x54d9('0x40')](_0x3663f6,_0x2e3406);var _0x25631b=_['intersection'](_0x3663f6,_0x2e3406);var _0x4b8585=_[_0x54d9('0x40')](_0x2e3406,_0x3663f6);var _0x10c24c;var _0x2f01ae;for(_0x10c24c=0x0;_0x10c24c<_0x4b8585[_0x54d9('0x41')]&&!_0x5ecb6d;_0x10c24c+=0x1){_0x2f01ae=_0x4b8585[_0x10c24c][_0x54d9('0x3f')]();if(manager[_0x54d9('0x42')](_0x2f01ae)){manager[_0x54d9('0x43')](_0x2f01ae);manager[_0x54d9('0x44')](_0x2f01ae);logger[_0x54d9('0x25')]('delete\x20cron',_0x2f01ae);}}logger[_0x54d9('0x25')](_0x54d9('0x45'),JSON[_0x54d9('0x23')](_0x987535));for(_0x10c24c=0x0;_0x10c24c<_0x987535[_0x54d9('0x41')];_0x10c24c+=0x1){_0x2f01ae=_0x987535[_0x10c24c]['toString']();logger[_0x54d9('0x25')](_0x54d9('0x46'),_0x2f01ae);if(_0x5ecb6d){logger['info'](_0x54d9('0x47'),_0x5ecb6d);logger[_0x54d9('0x25')](JSON[_0x54d9('0x23')](_0x343648[_0x2f01ae]));BPromise[_0x54d9('0x48')]()['then'](handleJob(_0x343648[_0x2f01ae]));logger[_0x54d9('0x25')]('run\x20job',_0x343648[_0x2f01ae]['name'],_0x343648[_0x2f01ae][_0x54d9('0x49')]);}else if(_0x343648[_0x2f01ae][_0x54d9('0x49')]&&_0x343648[_0x2f01ae][_0x54d9('0x4a')]&&moment()[_0x54d9('0x4b')](_0x343648[_0x2f01ae][_0x54d9('0x4c')],_0x343648[_0x2f01ae][_0x54d9('0x4d')])){manager[_0x54d9('0x4e')](_0x2f01ae,_0x343648[_0x2f01ae][_0x54d9('0x49')],handleJob(_0x343648[_0x2f01ae]));manager['start'](_0x2f01ae);logger['info'](_0x54d9('0x4f'),_0x343648[_0x2f01ae][_0x54d9('0x13')],_0x343648[_0x2f01ae][_0x54d9('0x49')]);}else if(manager[_0x54d9('0x42')](_0x2f01ae)){manager[_0x54d9('0x43')](_0x2f01ae);manager[_0x54d9('0x44')](_0x2f01ae);logger[_0x54d9('0x25')]('stop\x20cron',_0x343648[_0x2f01ae][_0x54d9('0x13')],_0x343648[_0x2f01ae][_0x54d9('0x49')]);}}for(_0x10c24c=0x0,_0x2f01ae;_0x10c24c<_0x25631b[_0x54d9('0x41')]&&!_0x5ecb6d;_0x10c24c+=0x1){_0x2f01ae=_0x25631b[_0x10c24c][_0x54d9('0x3f')]();if(manager[_0x54d9('0x42')](_0x2f01ae)){if(_0x343648[_0x2f01ae][_0x54d9('0x49')]&&_0x343648[_0x2f01ae]['active']&&moment()[_0x54d9('0x4b')](_0x343648[_0x2f01ae][_0x54d9('0x4c')],_0x343648[_0x2f01ae][_0x54d9('0x4d')])){manager[_0x54d9('0x50')](_0x2f01ae,_0x343648[_0x2f01ae][_0x54d9('0x49')],handleJob(_0x343648[_0x2f01ae]));logger['info']('update\x20cron',_0x343648[_0x2f01ae][_0x54d9('0x13')],_0x343648[_0x2f01ae]['cron']);}else{manager[_0x54d9('0x43')](_0x2f01ae);manager[_0x54d9('0x44')](_0x2f01ae);logger[_0x54d9('0x25')](_0x54d9('0x51'),_0x343648[_0x2f01ae][_0x54d9('0x13')],_0x343648[_0x2f01ae][_0x54d9('0x49')]);}}}})[_0x54d9('0x2b')](function(_0x2f91f9){logger[_0x54d9('0x28')](JSON[_0x54d9('0x23')](_0x2f91f9));});}exports[_0x54d9('0x52')]=function(_0x36cbd1){return getJobs(_0x36cbd1);};exports[_0x54d9('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x71ba=['no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','difference','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','exists','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','MailAccount','Smtp','service','host','port','secure','auth','user','format','\x22%s\x22\x20<%s>','name','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','stringify','email\x20sent','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','catch','CustomReportId'];(function(_0x324758,_0x61c88f){var _0x3a59ed=function(_0xcd6518){while(--_0xcd6518){_0x324758['push'](_0x324758['shift']());}};_0x3a59ed(++_0x61c88f);}(_0x71ba,0x110));var _0xa71b=function(_0x38b40e,_0x2236eb){_0x38b40e=_0x38b40e-0x0;var _0x5ee0ed=_0x71ba[_0x38b40e];return _0x5ee0ed;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xa71b('0x0'));var _=require(_0xa71b('0x1'));var moment=require(_0xa71b('0x2'));var CronJobManager=require(_0xa71b('0x3'));var jayson=require(_0xa71b('0x4'));var BPromise=require('bluebird');var logger=require(_0xa71b('0x5'))(_0xa71b('0x6'));var db=require(_0xa71b('0x7'))['db'];var analyticCustomReportController=require(_0xa71b('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xa71b('0x9')][_0xa71b('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa19a32,_0x4d7e40){return function(){logger[_0xa71b('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xa19a32[_0xa71b('0xc')]);var _0x3417f5=!![];var _0x11d6c5={'tls':{'rejectUnauthorized':![]}};if(_0xa19a32[_0xa71b('0xd')][_0xa71b('0xe')][_0xa71b('0xf')]){_0x11d6c5[_0xa71b('0xf')]=_0xa19a32[_0xa71b('0xd')][_0xa71b('0xe')][_0xa71b('0xf')];}else{_0x11d6c5[_0xa71b('0x10')]=_0xa19a32[_0xa71b('0xd')]['Smtp'][_0xa71b('0x10')];_0x11d6c5[_0xa71b('0x11')]=_0xa19a32[_0xa71b('0xd')][_0xa71b('0xe')][_0xa71b('0x11')];_0x11d6c5[_0xa71b('0x12')]=_0xa19a32[_0xa71b('0xd')][_0xa71b('0xe')][_0xa71b('0x12')];}if(_0xa19a32['MailAccount'][_0xa71b('0xe')]['authentication']){_0x11d6c5[_0xa71b('0x13')]={'user':_0xa19a32[_0xa71b('0xd')][_0xa71b('0xe')][_0xa71b('0x14')],'pass':_0xa19a32['MailAccount'][_0xa71b('0xe')]['pass']};}var _0x2da598={'account':_0x11d6c5,'message':{'from':util[_0xa71b('0x15')](_0xa71b('0x16'),_0xa19a32[_0xa71b('0xd')][_0xa71b('0x17')],_0xa19a32[_0xa71b('0xd')][_0xa71b('0xc')]||_0xa19a32[_0xa71b('0xd')]['Smtp'][_0xa71b('0x14')]),'to':_0xa19a32[_0xa71b('0xc')],'cc':_0xa19a32['cc'],'bcc':_0xa19a32['bcc'],'subject':util[_0xa71b('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x4d7e40['name'],_0xa19a32[_0xa71b('0x18')],_0xa19a32[_0xa71b('0x19')])}};var _0x16d911=path[_0xa71b('0x1a')](__dirname,_0xa71b('0x1b'));var _0x5b63c1=_0x4d7e40[_0xa71b('0x1c')];var _0x6fa36f=util[_0xa71b('0x15')]('%s.%s',path[_0xa71b('0x1d')](_0x4d7e40[_0xa71b('0x1c')],path[_0xa71b('0x1e')](_0x4d7e40[_0xa71b('0x1c')])),_0xa71b('0x1f'));var _0x226800=path[_0xa71b('0x1a')](_0x16d911,_0x5b63c1);var _0x33158d=path['join'](_0x16d911,_0x6fa36f);if(fs[_0xa71b('0x20')](_0x226800)){_0x4d7e40[_0xa71b('0x21')]=_0xa71b('0x22');_0x2da598[_0xa71b('0x23')][_0xa71b('0x24')]=[{'filename':_0x5b63c1,'path':_0x226800}];_0x2da598[_0xa71b('0x23')][_0xa71b('0x25')]=util[_0xa71b('0x15')](_0xa71b('0x26'),JSON['stringify'](_0x4d7e40,null,0x2));}else if(fs[_0xa71b('0x20')](_0x33158d)){_0x4d7e40['status']=_0xa71b('0x22');_0x2da598['message'][_0xa71b('0x24')]=[{'filename':_0x6fa36f,'path':_0x33158d}];}else{_0x2da598['message'][_0xa71b('0x25')]=_0xa71b('0x27');if(!_0xa19a32[_0xa71b('0x28')]){_0x3417f5=![];logger[_0xa71b('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3417f5){return client[_0xa71b('0x29')]('SendMail',_0x2da598)[_0xa71b('0x2a')](function(_0x45bcfe){if(_0x45bcfe['error']){return logger[_0xa71b('0x2b')](_0xa71b('0x2c'),JSON[_0xa71b('0x2d')](_0x45bcfe));}return logger[_0xa71b('0xb')](_0xa71b('0x2e'));})['catch'](function(_0x3e4f91){return logger[_0xa71b('0x2b')](_0xa71b('0x2c'),JSON[_0xa71b('0x2d')](_0x3e4f91));});}};}function handleError(){return function(_0x4811f9){return logger[_0xa71b('0x2b')](JSON[_0xa71b('0x2d')](_0x4811f9));};}function handleResult(_0x20c9c8){return function(_0x1a80a2){logger[_0xa71b('0xb')](_0xa71b('0x2f'),JSON['stringify'](_0x1a80a2));if(_0x20c9c8[_0xa71b('0xd')]&&_0x20c9c8[_0xa71b('0xd')][_0xa71b('0xe')]&&!_[_0xa71b('0x30')](_0x20c9c8[_0xa71b('0xc')])){setTimeout(handleSendEmail(_0x20c9c8,_0x1a80a2),0x3c*0x3e8);}};}function handleJob(_0x4e2b42){return function(){try{if(_[_0xa71b('0x30')](_0x4e2b42['subtractNumber'])){return logger[_0xa71b('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa71b('0x30')](_0x4e2b42['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x92b77c={'startDate':moment()[_0xa71b('0x31')](_0x4e2b42['subtractNumber'],_0x4e2b42['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xa71b('0x15')](_0xa71b('0x32')),'type':'scheduled','output':_0x4e2b42[_0xa71b('0x33')],'name':_0x4e2b42[_0xa71b('0x17')]};if(!_[_0xa71b('0x30')](_0x4e2b42[_0xa71b('0x34')])){logger[_0xa71b('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x4e2b42[_0xa71b('0x34')]);return analyticDefaultReportController[_0xa71b('0x35')]({'id':_0x4e2b42['DefaultReportId']},_0x92b77c)[_0xa71b('0x2a')](handleResult(_0x4e2b42))[_0xa71b('0x36')](handleError());}if(!_['isNil'](_0x4e2b42[_0xa71b('0x37')])){logger[_0xa71b('0xb')]('exec\x20custom\x20report\x20id:%s',_0x4e2b42[_0xa71b('0x37')]);return analyticCustomReportController[_0xa71b('0x35')]({'id':_0x4e2b42[_0xa71b('0x37')]},_0x92b77c)[_0xa71b('0x2a')](handleResult(_0x4e2b42))[_0xa71b('0x36')](handleError());}}catch(_0x17d5d5){logger['error'](JSON['stringify'](_0x17d5d5));}return logger[_0xa71b('0xb')](_0xa71b('0x38'));};}function getJobs(_0x352579){var _0x13ed27={};if(_0x352579){_0x13ed27['id']=_0x352579;}return db[_0xa71b('0x39')][_0xa71b('0x3a')]({'where':_0x13ed27,'include':[{'model':db[_0xa71b('0xd')],'attributes':['id',_0xa71b('0x17'),'email'],'include':[{'model':db[_0xa71b('0x3b')],'as':_0xa71b('0xe')}]}]})['then'](function(_0xe0ad62){var _0x5e983f=_[_0xa71b('0x3c')](manager['jobs']);var _0x532a1d=_[_0xa71b('0x3d')](_0xe0ad62,function(_0xc943ed){return _0xc943ed['id'][_0xa71b('0x3e')]();});var _0x567645=_['keyBy'](_0xe0ad62,function(_0x4781ea){return _0x4781ea['id'][_0xa71b('0x3e')]();});var _0xf786a4=_0x352579?_0x532a1d:_[_0xa71b('0x3f')](_0x532a1d,_0x5e983f);var _0x353141=_['intersection'](_0x532a1d,_0x5e983f);var _0x280e99=_[_0xa71b('0x3f')](_0x5e983f,_0x532a1d);var _0x121ffe;var _0x3ab194;for(_0x121ffe=0x0;_0x121ffe<_0x280e99[_0xa71b('0x40')]&&!_0x352579;_0x121ffe+=0x1){_0x3ab194=_0x280e99[_0x121ffe][_0xa71b('0x3e')]();if(manager['exists'](_0x3ab194)){manager[_0xa71b('0x41')](_0x3ab194);manager[_0xa71b('0x42')](_0x3ab194);logger['info'](_0xa71b('0x43'),_0x3ab194);}}logger['info'](_0xa71b('0x44'),JSON[_0xa71b('0x2d')](_0xf786a4));for(_0x121ffe=0x0;_0x121ffe<_0xf786a4[_0xa71b('0x40')];_0x121ffe+=0x1){_0x3ab194=_0xf786a4[_0x121ffe]['toString']();logger[_0xa71b('0xb')]('index',_0x3ab194);if(_0x352579){logger['info'](_0xa71b('0x45'),_0x352579);logger[_0xa71b('0xb')](JSON['stringify'](_0x567645[_0x3ab194]));BPromise[_0xa71b('0x46')]()['then'](handleJob(_0x567645[_0x3ab194]));logger['info'](_0xa71b('0x47'),_0x567645[_0x3ab194][_0xa71b('0x17')],_0x567645[_0x3ab194][_0xa71b('0x48')]);}else if(_0x567645[_0x3ab194]['cron']&&_0x567645[_0x3ab194][_0xa71b('0x49')]&&moment()[_0xa71b('0x4a')](_0x567645[_0x3ab194][_0xa71b('0x4b')],_0x567645[_0x3ab194][_0xa71b('0x4c')])){manager['add'](_0x3ab194,_0x567645[_0x3ab194][_0xa71b('0x48')],handleJob(_0x567645[_0x3ab194]));manager[_0xa71b('0x4d')](_0x3ab194);logger['info'](_0xa71b('0x4e'),_0x567645[_0x3ab194]['name'],_0x567645[_0x3ab194][_0xa71b('0x48')]);}else if(manager[_0xa71b('0x4f')](_0x3ab194)){manager[_0xa71b('0x41')](_0x3ab194);manager[_0xa71b('0x42')](_0x3ab194);logger[_0xa71b('0xb')](_0xa71b('0x50'),_0x567645[_0x3ab194][_0xa71b('0x17')],_0x567645[_0x3ab194]['cron']);}}for(_0x121ffe=0x0,_0x3ab194;_0x121ffe<_0x353141[_0xa71b('0x40')]&&!_0x352579;_0x121ffe+=0x1){_0x3ab194=_0x353141[_0x121ffe]['toString']();if(manager['exists'](_0x3ab194)){if(_0x567645[_0x3ab194][_0xa71b('0x48')]&&_0x567645[_0x3ab194][_0xa71b('0x49')]&&moment()[_0xa71b('0x4a')](_0x567645[_0x3ab194]['startAt'],_0x567645[_0x3ab194]['endAt'])){manager['update'](_0x3ab194,_0x567645[_0x3ab194][_0xa71b('0x48')],handleJob(_0x567645[_0x3ab194]));logger[_0xa71b('0xb')]('update\x20cron',_0x567645[_0x3ab194]['name'],_0x567645[_0x3ab194]['cron']);}else{manager['stop'](_0x3ab194);manager[_0xa71b('0x42')](_0x3ab194);logger[_0xa71b('0xb')](_0xa71b('0x50'),_0x567645[_0x3ab194][_0xa71b('0x17')],_0x567645[_0x3ab194]['cron']);}}}})[_0xa71b('0x36')](function(_0x17ea2e){logger[_0xa71b('0x2b')](JSON[_0xa71b('0x2d')](_0x17ea2e));});}exports[_0xa71b('0x51')]=function(_0x47c087){return getJobs(_0x47c087);};exports[_0xa71b('0x4d')]=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 370b601..0247d82 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 _0xb9a7=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Transcribe\x20not\x20configured','transcribeAccountId','push','all','catch','aws-sdk','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','[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','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','format','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0xb9a7,0x112));var _0x7b9a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb9a7[_0x209941];return _0x1e8729;};var _=require('lodash');var AWS=require(_0x7b9a('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x7b9a('0x1'))['db'];var logger=require('../../config/logger')(_0x7b9a('0x2'));function getTranscriptionJob(_0x40ef7d,_0x37b25b,_0x24cae3,_0x5cd5da){return new Promise(function(_0xf6dae2,_0x22764f){var _0x7019fd=new AWS[(_0x7b9a('0x3'))]({'accessKeyId':_0x37b25b,'secretAccessKey':_0x40ef7d,'region':_0x24cae3});_0x7019fd[_0x7b9a('0x4')]({'TranscriptionJobName':_0x5cd5da},function(_0x4d3f20,_0x43d8e2){if(_0x4d3f20){return _0x22764f(_0x4d3f20);}else{return _0xf6dae2(_0x43d8e2);}});});}function sentiment(_0x3e84f1,_0x56a199,_0x511e28,_0x47e220,_0x15bc5b){return new Promise(function(_0x31f3b7,_0x4cf090){var _0x32c85d=new AWS['Comprehend']({'accessKeyId':_0x56a199,'secretAccessKey':_0x3e84f1,'region':_0x511e28});_0x32c85d[_0x7b9a('0x5')]({'Text':_0x47e220,'LanguageCode':_0x15bc5b['substring'](0x0,0x2)},function(_0x3af176,_0x1584a2){if(_0x3af176){return _0x4cf090(_0x3af176);}else{return _0x31f3b7(_0x1584a2);}});});}function checkTranscribeJob(_0x291591,_0x5948ca,_0x32f616){var _0xec5949;return new BPromise(function(_0x5e3875,_0x67553c){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x7'),_0x291591['id'],_0x291591[_0x7b9a('0x8')]));return getTranscriptionJob(_0x32f616[_0x7b9a('0x9')],_0x32f616[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0xb')],_0x291591[_0x7b9a('0x8')])[_0x7b9a('0xc')](function(_0x35e602){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0xd'),_0x291591['id'],_0x291591['transcribeName'],_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')]));if(!_0x291591[_0x7b9a('0x10')]){switch(_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')]){case _0x7b9a('0x11'):var _0x27ad55={'transcribeStatus':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')],'fileUri':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0x12')][_0x7b9a('0x13')]};logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x14'),_0x291591['id']));return rp({'uri':_0x35e602['TranscriptionJob'][_0x7b9a('0x12')]['TranscriptFileUri'],'json':!![]})[_0x7b9a('0xc')](function(_0x331ae6){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x15'),_0x291591['id']));if(_0x331ae6&&_0x331ae6[_0x7b9a('0x16')]&&_0x331ae6['results'][_0x7b9a('0x17')]&&_0x331ae6[_0x7b9a('0x16')][_0x7b9a('0x17')][_0x7b9a('0x18')]){_0x27ad55[_0x7b9a('0x10')]='';for(var _0x5b2f52=0x0;_0x5b2f52<_0x331ae6[_0x7b9a('0x16')][_0x7b9a('0x17')]['length'];_0x5b2f52++){_0x27ad55[_0x7b9a('0x10')]+=_0x331ae6['results'][_0x7b9a('0x17')][_0x5b2f52][_0x7b9a('0x19')]+'';}}return _0x291591['update'](_0x27ad55);})['then'](function(){logger[_0x7b9a('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x291591['id']));if(!_0x291591[_0x7b9a('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x7b9a('0x1b'));}if(!_0x5948ca['sentiment']||!_0x5948ca[_0x7b9a('0x1c')]||!_0x5948ca[_0x7b9a('0x1d')]||!_0x5948ca['language']||!_0x5948ca[_0x7b9a('0x1e')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x27ad55[_0x7b9a('0x10')]){throw new Error(_0x7b9a('0x21'));}if(_0x5948ca[_0x7b9a('0x1c')]===_0x32f616['id']){return _0x32f616;}else{return db[_0x7b9a('0x22')][_0x7b9a('0x23')]({'where':{'id':_settings[_0x7b9a('0x1c')]}});}})['then'](function(_0x4aa495){if(!_0x4aa495){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x24'));}if(!_0x4aa495['data1']||!_0x4aa495[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xec5949=_0x4aa495;logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x291591['id']));return sentiment(_0xec5949[_0x7b9a('0x9')],_0xec5949[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0x1d')],_0x27ad55[_0x7b9a('0x10')],_0x5948ca[_0x7b9a('0x26')]);})['then'](function(_0x46bcd0){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')](_0x7b9a('0x27'),_0x291591['id']));return _0x291591[_0x7b9a('0x28')]({'sentiment':_0x46bcd0[_0x7b9a('0x29')],'sPositive':_0x46bcd0['SentimentScore']['Positive'],'sNegative':_0x46bcd0[_0x7b9a('0x2a')][_0x7b9a('0x2b')],'sMixed':_0x46bcd0['SentimentScore'][_0x7b9a('0x2c')],'sNeutral':_0x46bcd0[_0x7b9a('0x2a')][_0x7b9a('0x2d')]});})['then'](function(){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x291591['id']));_0x5e3875();});case'FAILED':return _0x291591[_0x7b9a('0x28')]({'transcribeStatus':_0x7b9a('0x2e'),'failureReason':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0x2f')]})[_0x7b9a('0xc')](function(){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')](_0x7b9a('0x30'),_0x291591['id']));_0x5e3875();});default:logger['info'](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x291591['id']));break;}}else{return BPromise[_0x7b9a('0x31')]()[_0x7b9a('0xc')](function(){if(!_0x291591[_0x7b9a('0x1a')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x1b'));}if(!_0x5948ca['sentiment']||!_0x5948ca[_0x7b9a('0x1c')]||!_0x5948ca[_0x7b9a('0x1d')]||!_0x5948ca[_0x7b9a('0x26')]||!_0x5948ca[_0x7b9a('0x1e')]){throw new db['Sequelize'][(_0x7b9a('0x20'))](_0x7b9a('0x32'));}if(!_0x291591[_0x7b9a('0x10')]){throw new Error(_0x7b9a('0x21'));}if(_0x5948ca['sentimentAccountId']===_0x32f616['id']){return _0x32f616;}else{return db[_0x7b9a('0x22')]['findOne']({'where':{'id':_settings[_0x7b9a('0x1c')]}});}})[_0x7b9a('0xc')](function(_0x432e44){if(!_0x432e44){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x24'));}if(!_0x432e44['data1']||!_0x432e44[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0xec5949=_0x432e44;logger['info'](util[_0x7b9a('0x25')](_0x7b9a('0x33'),_0x291591['id']));return sentiment(_0xec5949[_0x7b9a('0x9')],_0xec5949[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0x1d')],_0x291591[_0x7b9a('0x10')],_0x5948ca['language']);})['then'](function(_0x5c9eac){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x291591['id']));return _0x291591[_0x7b9a('0x28')]({'sentiment':_0x5c9eac[_0x7b9a('0x29')],'sPositive':_0x5c9eac[_0x7b9a('0x2a')]['Positive'],'sNegative':_0x5c9eac[_0x7b9a('0x2a')]['Negative'],'sMixed':_0x5c9eac[_0x7b9a('0x2a')][_0x7b9a('0x2c')],'sNeutral':_0x5c9eac[_0x7b9a('0x2a')][_0x7b9a('0x2d')],'transcribeStatus':_0x7b9a('0x11')});})['then'](function(){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x30'),_0x291591['id']));_0x5e3875();});}})['catch'](function(_0x4f1b2e){if(_0x4f1b2e){if(!_0x4f1b2e[_0x7b9a('0x34')]||_0x4f1b2e[_0x7b9a('0x34')]!==_0x7b9a('0x35')){logger[_0x7b9a('0x36')](util[_0x7b9a('0x25')](_0x7b9a('0x37'),_0x291591['id']),util[_0x7b9a('0x38')](_0x4f1b2e,{'showHidden':![],'depth':null}));}}_0x5e3875();});});}function checkTranscribe(){var _0x31506d;var _0x1d034b;var _0x5088c7;return db[_0x7b9a('0x39')][_0x7b9a('0x3a')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x5dd42d){if(!_0x5dd42d||!_0x5dd42d[_0x7b9a('0x18')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x3b'));}_0x31506d=_0x5dd42d;return db['Setting'][_0x7b9a('0x23')]({'where':{'id':0x1}});})[_0x7b9a('0xc')](function(_0x287dea){if(!_0x287dea){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Settings\x20not\x20available');}_0x1d034b=_0x287dea;if(!_0x1d034b[_0x7b9a('0x2')]||!_0x1d034b['transcribeAccountId']||!_0x1d034b[_0x7b9a('0xb')]||!_0x1d034b[_0x7b9a('0x26')]||!_0x1d034b[_0x7b9a('0x1e')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError'](_0x7b9a('0x3c'));}return db[_0x7b9a('0x22')][_0x7b9a('0x23')]({'where':{'id':_0x1d034b[_0x7b9a('0x3d')]}});})[_0x7b9a('0xc')](function(_0x3e2f1b){if(!_0x3e2f1b){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3e2f1b['data1']||!_0x3e2f1b[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5088c7=_0x3e2f1b;var _0x58527d=[];_0x31506d['forEach'](function(_0x7c800f){_0x58527d[_0x7b9a('0x3e')](checkTranscribeJob(_0x7c800f,_0x1d034b,_0x5088c7));});return BPromise[_0x7b9a('0x3f')](_0x58527d);})[_0x7b9a('0x40')](function(_0x34f552){if(_0x34f552){if(!_0x34f552[_0x7b9a('0x34')]||_0x34f552[_0x7b9a('0x34')]!==_0x7b9a('0x35')){logger['error'](util[_0x7b9a('0x38')](_0x34f552,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1678=['SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','push','all','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','COMPLETED','catch','name'];(function(_0x5f4e0e,_0x41f8cd){var _0x3c3355=function(_0x57b2fe){while(--_0x57b2fe){_0x5f4e0e['push'](_0x5f4e0e['shift']());}};_0x3c3355(++_0x41f8cd);}(_0x1678,0x17b));var _0x8167=function(_0x24194d,_0xd92baf){_0x24194d=_0x24194d-0x0;var _0x2c4f87=_0x1678[_0x24194d];return _0x2c4f87;};var _=require(_0x8167('0x0'));var AWS=require(_0x8167('0x1'));var rp=require(_0x8167('0x2'));var util=require(_0x8167('0x3'));var BPromise=require(_0x8167('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8167('0x5'));function getTranscriptionJob(_0x1f38f3,_0x39dea4,_0x2619f4,_0x39cedb){return new Promise(function(_0xa9fd75,_0x30f248){var _0x4ce075=new AWS[(_0x8167('0x6'))]({'accessKeyId':_0x39dea4,'secretAccessKey':_0x1f38f3,'region':_0x2619f4});_0x4ce075[_0x8167('0x7')]({'TranscriptionJobName':_0x39cedb},function(_0x1aab13,_0x58b220){if(_0x1aab13){return _0x30f248(_0x1aab13);}else{return _0xa9fd75(_0x58b220);}});});}function sentiment(_0x5a79cc,_0x210d5c,_0x381a87,_0x59d897,_0x1912ee){return new Promise(function(_0xad008c,_0x4523f4){var _0x16e2cc=new AWS[(_0x8167('0x8'))]({'accessKeyId':_0x210d5c,'secretAccessKey':_0x5a79cc,'region':_0x381a87});_0x16e2cc[_0x8167('0x9')]({'Text':_0x59d897,'LanguageCode':_0x1912ee[_0x8167('0xa')](0x0,0x2)},function(_0x5b829e,_0x564b01){if(_0x5b829e){return _0x4523f4(_0x5b829e);}else{return _0xad008c(_0x564b01);}});});}function checkTranscribeJob(_0x11bf1c,_0x4b5b3c,_0x3ef6d6){var _0x24f0a1;return new BPromise(function(_0x57753c,_0x3e7521){logger[_0x8167('0xb')](util['format'](_0x8167('0xc'),_0x11bf1c['id'],_0x11bf1c['transcribeName']));return getTranscriptionJob(_0x3ef6d6['data1'],_0x3ef6d6['data2'],_0x4b5b3c['transcribeRegion'],_0x11bf1c[_0x8167('0xd')])[_0x8167('0xe')](function(_0x2aab53){logger[_0x8167('0xb')](util[_0x8167('0xf')](_0x8167('0x10'),_0x11bf1c['id'],_0x11bf1c[_0x8167('0xd')],_0x2aab53[_0x8167('0x11')][_0x8167('0x12')]));if(!_0x11bf1c[_0x8167('0x13')]){switch(_0x2aab53['TranscriptionJob'][_0x8167('0x12')]){case'COMPLETED':var _0x2c6255={'transcribeStatus':_0x2aab53['TranscriptionJob'][_0x8167('0x12')],'fileUri':_0x2aab53[_0x8167('0x11')]['Transcript'][_0x8167('0x14')]};logger[_0x8167('0xb')](util[_0x8167('0xf')](_0x8167('0x15'),_0x11bf1c['id']));return rp({'uri':_0x2aab53[_0x8167('0x11')][_0x8167('0x16')][_0x8167('0x14')],'json':!![]})[_0x8167('0xe')](function(_0x5ee50c){logger[_0x8167('0xb')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x11bf1c['id']));if(_0x5ee50c&&_0x5ee50c[_0x8167('0x17')]&&_0x5ee50c['results']['transcripts']&&_0x5ee50c[_0x8167('0x17')][_0x8167('0x18')][_0x8167('0x19')]){_0x2c6255['fileText']='';for(var _0x3d466c=0x0;_0x3d466c<_0x5ee50c['results'][_0x8167('0x18')]['length'];_0x3d466c++){_0x2c6255[_0x8167('0x13')]+=_0x5ee50c[_0x8167('0x17')][_0x8167('0x18')][_0x3d466c]['transcript']+'';}}return _0x11bf1c[_0x8167('0x1a')](_0x2c6255);})[_0x8167('0xe')](function(){logger[_0x8167('0xb')](util[_0x8167('0xf')](_0x8167('0x1b'),_0x11bf1c['id']));if(!_0x11bf1c[_0x8167('0x1c')]){throw new db[(_0x8167('0x1d'))]['ValidationError'](_0x8167('0x1e'));}if(!_0x4b5b3c[_0x8167('0x1f')]||!_0x4b5b3c['sentimentAccountId']||!_0x4b5b3c[_0x8167('0x20')]||!_0x4b5b3c[_0x8167('0x21')]||!_0x4b5b3c[_0x8167('0x22')]){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))](_0x8167('0x24'));}if(!_0x2c6255[_0x8167('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x4b5b3c[_0x8167('0x25')]===_0x3ef6d6['id']){return _0x3ef6d6;}else{return db[_0x8167('0x26')]['findOne']({'where':{'id':_settings[_0x8167('0x25')]}});}})[_0x8167('0xe')](function(_0x286aa3){if(!_0x286aa3){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x286aa3[_0x8167('0x27')]||!_0x286aa3['data2']){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))](_0x8167('0x28'));}_0x24f0a1=_0x286aa3;logger[_0x8167('0xb')](util[_0x8167('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x11bf1c['id']));return sentiment(_0x24f0a1['data1'],_0x24f0a1['data2'],_0x4b5b3c['sentimentRegion'],_0x2c6255[_0x8167('0x13')],_0x4b5b3c[_0x8167('0x21')]);})[_0x8167('0xe')](function(_0x26b22d){logger[_0x8167('0xb')](util[_0x8167('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x11bf1c['id']));return _0x11bf1c[_0x8167('0x1a')]({'sentiment':_0x26b22d['Sentiment'],'sPositive':_0x26b22d[_0x8167('0x29')][_0x8167('0x2a')],'sNegative':_0x26b22d['SentimentScore']['Negative'],'sMixed':_0x26b22d[_0x8167('0x29')][_0x8167('0x2b')],'sNeutral':_0x26b22d[_0x8167('0x29')][_0x8167('0x2c')]});})[_0x8167('0xe')](function(){logger['info'](util['format'](_0x8167('0x1b'),_0x11bf1c['id']));_0x57753c();});case'FAILED':return _0x11bf1c[_0x8167('0x1a')]({'transcribeStatus':_0x8167('0x2d'),'failureReason':_0x2aab53['TranscriptionJob'][_0x8167('0x2e')]})[_0x8167('0xe')](function(){logger[_0x8167('0xb')](util[_0x8167('0xf')](_0x8167('0x1b'),_0x11bf1c['id']));_0x57753c();});default:logger[_0x8167('0xb')](util[_0x8167('0xf')](_0x8167('0x2f'),_0x11bf1c['id']));break;}}else{return BPromise[_0x8167('0x30')]()[_0x8167('0xe')](function(){if(!_0x11bf1c[_0x8167('0x1c')]){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))](_0x8167('0x1e'));}if(!_0x4b5b3c[_0x8167('0x1f')]||!_0x4b5b3c['sentimentAccountId']||!_0x4b5b3c[_0x8167('0x20')]||!_0x4b5b3c['language']||!_0x4b5b3c[_0x8167('0x22')]){throw new db['Sequelize'][(_0x8167('0x23'))](_0x8167('0x24'));}if(!_0x11bf1c['fileText']){throw new Error(_0x8167('0x31'));}if(_0x4b5b3c['sentimentAccountId']===_0x3ef6d6['id']){return _0x3ef6d6;}else{return db['CloudProvider'][_0x8167('0x32')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8167('0xe')](function(_0x578bfb){if(!_0x578bfb){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x578bfb[_0x8167('0x27')]||!_0x578bfb[_0x8167('0x33')]){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))](_0x8167('0x28'));}_0x24f0a1=_0x578bfb;logger[_0x8167('0xb')](util[_0x8167('0xf')](_0x8167('0x34'),_0x11bf1c['id']));return sentiment(_0x24f0a1[_0x8167('0x27')],_0x24f0a1[_0x8167('0x33')],_0x4b5b3c[_0x8167('0x20')],_0x11bf1c[_0x8167('0x13')],_0x4b5b3c[_0x8167('0x21')]);})[_0x8167('0xe')](function(_0x58bb0a){logger[_0x8167('0xb')](util[_0x8167('0xf')](_0x8167('0x35'),_0x11bf1c['id']));return _0x11bf1c['update']({'sentiment':_0x58bb0a[_0x8167('0x36')],'sPositive':_0x58bb0a[_0x8167('0x29')][_0x8167('0x2a')],'sNegative':_0x58bb0a[_0x8167('0x29')][_0x8167('0x37')],'sMixed':_0x58bb0a[_0x8167('0x29')][_0x8167('0x2b')],'sNeutral':_0x58bb0a[_0x8167('0x29')][_0x8167('0x2c')],'transcribeStatus':_0x8167('0x38')});})[_0x8167('0xe')](function(){logger[_0x8167('0xb')](util[_0x8167('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x11bf1c['id']));_0x57753c();});}})[_0x8167('0x39')](function(_0xa20746){if(_0xa20746){if(!_0xa20746[_0x8167('0x3a')]||_0xa20746[_0x8167('0x3a')]!==_0x8167('0x3b')){logger[_0x8167('0x3c')](util[_0x8167('0xf')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x11bf1c['id']),util[_0x8167('0x3d')](_0xa20746,{'showHidden':![],'depth':null}));}}_0x57753c();});});}function checkTranscribe(){var _0x4de036;var _0x386440;var _0x3a864a;return db[_0x8167('0x3e')][_0x8167('0x3f')]({'where':{'transcribeStatus':_0x8167('0x40')}})['then'](function(_0x374e43){if(!_0x374e43||!_0x374e43[_0x8167('0x19')]){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))](_0x8167('0x41'));}_0x4de036=_0x374e43;return db['Setting'][_0x8167('0x32')]({'where':{'id':0x1}});})[_0x8167('0xe')](function(_0x24e9c3){if(!_0x24e9c3){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))](_0x8167('0x42'));}_0x386440=_0x24e9c3;if(!_0x386440[_0x8167('0x5')]||!_0x386440[_0x8167('0x43')]||!_0x386440[_0x8167('0x44')]||!_0x386440[_0x8167('0x21')]||!_0x386440[_0x8167('0x22')]){throw new db['Sequelize'][(_0x8167('0x23'))](_0x8167('0x45'));}return db[_0x8167('0x26')][_0x8167('0x32')]({'where':{'id':_0x386440['transcribeAccountId']}});})[_0x8167('0xe')](function(_0x2230b9){if(!_0x2230b9){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))](_0x8167('0x46'));}if(!_0x2230b9[_0x8167('0x27')]||!_0x2230b9[_0x8167('0x33')]){throw new db[(_0x8167('0x1d'))][(_0x8167('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a864a=_0x2230b9;var _0x193727=[];_0x4de036['forEach'](function(_0x25f507){_0x193727[_0x8167('0x47')](checkTranscribeJob(_0x25f507,_0x386440,_0x3a864a));});return BPromise[_0x8167('0x48')](_0x193727);})[_0x8167('0x39')](function(_0x3a53e8){if(_0x3a53e8){if(!_0x3a53e8[_0x8167('0x3a')]||_0x3a53e8['name']!==_0x8167('0x3b')){logger['error'](util[_0x8167('0x3d')](_0x3a53e8,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index f4e0395..9559613 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 _0xdcb7=['[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','then','length','map','info'];(function(_0x5258af,_0x589ca3){var _0x349f65=function(_0xc56dec){while(--_0xc56dec){_0x5258af['push'](_0x5258af['shift']());}};_0x349f65(++_0x589ca3);}(_0xdcb7,0x8d));var _0x7dcb=function(_0x2504a6,_0x5438e0){_0x2504a6=_0x2504a6-0x0;var _0x3ce9a3=_0xdcb7[_0x2504a6];return _0x3ce9a3;};'use strict';var _=require(_0x7dcb('0x0'));var moment=require(_0x7dcb('0x1'));var Redis=require(_0x7dcb('0x2'));var util=require(_0x7dcb('0x3'));var config=require(_0x7dcb('0x4'));var db=require(_0x7dcb('0x5'))['db'];var logger=require(_0x7dcb('0x6'))(_0x7dcb('0x7'));config[_0x7dcb('0x8')]=_[_0x7dcb('0x9')](config['redis'],{'host':_0x7dcb('0xa'),'port':0x18eb});var io=require(_0x7dcb('0xb'))(new Redis(config[_0x7dcb('0x8')]));function closeInteractions(){var _0xb604e2=[];return db[_0x7dcb('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x7dcb('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7dcb('0xe')](0x18,'hours')}}})[_0x7dcb('0xf')](function(_0x4caff3){if(_0x4caff3&&_0x4caff3[_0x7dcb('0x10')]){_0xb604e2=_[_0x7dcb('0x11')](_0x4caff3||[],'id');logger[_0x7dcb('0x12')](_0x7dcb('0x13'),_0xb604e2[_0x7dcb('0x14')]());return db['WhatsappInteraction'][_0x7dcb('0x15')]({'closeReason':_0x7dcb('0x16'),'disposition':_0x7dcb('0x17'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xb604e2}});}})['then'](function(){if(_0xb604e2&&_0xb604e2['length']){logger['info'](_0x7dcb('0x18'),_0xb604e2[_0x7dcb('0x14')]());for(var _0x4d0408=0x0;_0x4d0408<_0xb604e2['length'];_0x4d0408++){io[_0x7dcb('0x19')](_0x7dcb('0x1a'),{'id':_0xb604e2[_0x4d0408],'closed':!![]});}}})[_0x7dcb('0x1b')](function(_0x1f0c47){logger[_0x7dcb('0x1c')](_0x7dcb('0x1d'),_0x1f0c47?util[_0x7dcb('0x1e')](_0x1f0c47,{'showHidden':![],'depth':null}):'');});}exports[_0x7dcb('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc50f=['YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','lodash','moment','ioredis','util','../../mysqldb','redis','defaults','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format'];(function(_0x50d772,_0x123373){var _0x3d2aba=function(_0x3c7de6){while(--_0x3c7de6){_0x50d772['push'](_0x50d772['shift']());}};_0x3d2aba(++_0x123373);}(_0xc50f,0x153));var _0xfc50=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc50f[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xfc50('0x0'));var moment=require(_0xfc50('0x1'));var Redis=require(_0xfc50('0x2'));var util=require(_0xfc50('0x3'));var config=require('../../config/environment');var db=require(_0xfc50('0x4'))['db'];var logger=require('../logger')('schedule');config[_0xfc50('0x5')]=_[_0xfc50('0x6')](config[_0xfc50('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfc50('0x5')]));function closeInteractions(){var _0xb39737=[];return db['WhatsappInteraction'][_0xfc50('0x7')]({'raw':!![],'attributes':['id',_0xfc50('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xfc50('0x9')](0x18,_0xfc50('0xa'))}}})[_0xfc50('0xb')](function(_0x447813){if(_0x447813&&_0x447813[_0xfc50('0xc')]){_0xb39737=_[_0xfc50('0xd')](_0x447813||[],'id');logger[_0xfc50('0xe')](_0xfc50('0xf'),_0xb39737[_0xfc50('0x10')]());return db['WhatsappInteraction'][_0xfc50('0x11')]({'closeReason':_0xfc50('0x12'),'disposition':_0xfc50('0x13'),'closed':!![],'closedAt':moment()[_0xfc50('0x14')](_0xfc50('0x15'))},{'where':{'id':_0xb39737}});}})[_0xfc50('0xb')](function(){if(_0xb39737&&_0xb39737['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xb39737[_0xfc50('0x10')]());for(var _0x4e4831=0x0;_0x4e4831<_0xb39737['length'];_0x4e4831++){io[_0xfc50('0x16')](_0xfc50('0x17'),{'id':_0xb39737[_0x4e4831],'closed':!![]});}}})['catch'](function(_0x2d94b3){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2d94b3?util['inspect'](_0x2d94b3,{'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 0907b60..a4b76b6 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74bb=['hopper1','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper'];(function(_0x3e77d8,_0x230547){var _0x3d602b=function(_0xa9190e){while(--_0xa9190e){_0x3e77d8['push'](_0x3e77d8['shift']());}};_0x3d602b(++_0x230547);}(_0x74bb,0xdb));var _0xb74b=function(_0x725448,_0xb186bc){_0x725448=_0x725448-0x0;var _0x391e6e=_0x74bb[_0x725448];return _0x391e6e;};'use strict';var util=require('util');var db=require(_0xb74b('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb74b('0x1')]({'id':i,'firstName':_0xb74b('0x2')+i,'lastName':_0xb74b('0x3')+i,'phone':0xf879fb460+i,'email':_0xb74b('0x4')+i+_0xb74b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb74b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb74b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb74b('0x6')](),'updatedAt':Date[_0xb74b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xb74b('0x2')+i,'lastName':_0xb74b('0x3')+i,'phone':0xf879fb460+i,'email':_0xb74b('0x4')+i+_0xb74b('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb74b('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb74b('0x6')](),'updatedAt':Date[_0xb74b('0x6')]()});}db[_0xb74b('0x7')][_0xb74b('0x8')]({'where':{}})[_0xb74b('0x9')](function(){return db[_0xb74b('0x7')][_0xb74b('0xa')](contacts);})[_0xb74b('0x9')](function(){console[_0xb74b('0xb')](_0xb74b('0xc'),_0xb74b('0xd'));return db[_0xb74b('0xe')]['destroy']({'where':{}});})[_0xb74b('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console['log'](_0xb74b('0xc'),_0xb74b('0xf'));return db['CmContact'][_0xb74b('0xa')](contacts2);})[_0xb74b('0x9')](function(){console[_0xb74b('0xb')](_0xb74b('0xc'),'contacts2');return db[_0xb74b('0xe')][_0xb74b('0xa')](hopper2);})[_0xb74b('0x9')](function(){console[_0xb74b('0xb')](_0xb74b('0xc'),_0xb74b('0x10'));})[_0xb74b('0x11')](function(_0x946256){console[_0xb74b('0xb')](_0x946256);}); \ No newline at end of file +var _0x6c14=['innocenzo.biondo','push','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','Innocenzo','Biondo'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6c14,0x95));var _0x46c1=function(_0x5db2f8,_0x1719c1){_0x5db2f8=_0x5db2f8-0x0;var _0x5db914=_0x6c14[_0x5db2f8];return _0x5db914;};'use strict';var util=require(_0x46c1('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x46c1('0x1')+i,'lastName':_0x46c1('0x2')+i,'phone':0xf879fb460+i,'email':_0x46c1('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x46c1('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x46c1('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x46c1('0x5')](),'updatedAt':Date[_0x46c1('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x46c1('0x4')]({'id':i,'firstName':_0x46c1('0x1')+i,'lastName':_0x46c1('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x46c1('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x46c1('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x46c1('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x46c1('0x5')]()});}db[_0x46c1('0x7')][_0x46c1('0x8')]({'where':{}})[_0x46c1('0x9')](function(){return db[_0x46c1('0x7')][_0x46c1('0xa')](contacts);})[_0x46c1('0x9')](function(){console[_0x46c1('0xb')](_0x46c1('0xc'),_0x46c1('0xd'));return db[_0x46c1('0xe')][_0x46c1('0x8')]({'where':{}});})[_0x46c1('0x9')](function(){return db[_0x46c1('0xe')]['bulkCreate'](hopper);})[_0x46c1('0x9')](function(){console[_0x46c1('0xb')](_0x46c1('0xc'),_0x46c1('0xf'));return db['CmContact'][_0x46c1('0xa')](contacts2);})[_0x46c1('0x9')](function(){console[_0x46c1('0xb')](_0x46c1('0xc'),_0x46c1('0x10'));return db[_0x46c1('0xe')][_0x46c1('0xa')](hopper2);})[_0x46c1('0x9')](function(){console[_0x46c1('0xb')](_0x46c1('0xc'),_0x46c1('0x11'));})[_0x46c1('0x12')](function(_0x6f042c){console[_0x46c1('0xb')](_0x6f042c);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index c1e9a55..060b18a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56e4=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss'];(function(_0x3593f0,_0x4750f4){var _0x38bba7=function(_0x3bc64c){while(--_0x3bc64c){_0x3593f0['push'](_0x3593f0['shift']());}};_0x38bba7(++_0x4750f4);}(_0x56e4,0x182));var _0x456e=function(_0x9e9044,_0x2d3c0f){_0x9e9044=_0x9e9044-0x0;var _0x1d4943=_0x56e4[_0x9e9044];return _0x1d4943;};'use strict';var util=require(_0x456e('0x0'));var db=require(_0x456e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x456e('0x2')]({'name':util[_0x456e('0x3')](_0x456e('0x4'),'agent',i),'fullname':util[_0x456e('0x3')](_0x456e('0x4'),_0x456e('0x5'),i),'email':util['format']('%s%s@xcally.com',_0x456e('0x5'),i),'role':_0x456e('0x5'),'password':_0x456e('0x6'),'internal':0xfa0+i,'type':_0x456e('0x7'),'transport':[_0x456e('0x8'),'ws',_0x456e('0x9')],'disallow':[_0x456e('0xa')],'allow':[_0x456e('0xb')],'defaultuser':util[_0x456e('0x3')](_0x456e('0x4'),'agent',i),'encryption':_0x456e('0xc'),'avpf':_0x456e('0xc'),'force_avp':'yes','icesupport':_0x456e('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x456e('0xd'),'dtlsprivatekey':_0x456e('0xe'),'dtlssetup':_0x456e('0xf'),'callerid':util[_0x456e('0x3')](_0x456e('0x10'),util['format']('%s%s',_0x456e('0x5'),i),0xfa0+i)});}db[_0x456e('0x11')]['bulkCreate'](users)[_0x456e('0x12')](function(){console[_0x456e('0x13')](_0x456e('0x14'));})[_0x456e('0x15')](function(_0x571cc7){console[_0x456e('0x13')](_0x571cc7);}); \ No newline at end of file +var _0x2204=['../mysqldb','format','agent','%s%s','%s%s@xcally.com','password','wss','all','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch'];(function(_0x48c368,_0x3a1b3a){var _0x4c72bc=function(_0x2be8bd){while(--_0x2be8bd){_0x48c368['push'](_0x48c368['shift']());}};_0x4c72bc(++_0x3a1b3a);}(_0x2204,0x143));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var db=require(_0x4220('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x4220('0x1')]('%s%s',_0x4220('0x2'),i),'fullname':util[_0x4220('0x1')](_0x4220('0x3'),_0x4220('0x2'),i),'email':util[_0x4220('0x1')](_0x4220('0x4'),_0x4220('0x2'),i),'role':_0x4220('0x2'),'password':_0x4220('0x5'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x4220('0x6')],'disallow':[_0x4220('0x7')],'allow':['ulaw'],'defaultuser':util['format'](_0x4220('0x3'),_0x4220('0x2'),i),'encryption':_0x4220('0x8'),'avpf':_0x4220('0x8'),'force_avp':_0x4220('0x8'),'icesupport':'yes','dtlsenable':_0x4220('0x8'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x4220('0x9'),'dtlssetup':_0x4220('0xa'),'callerid':util[_0x4220('0x1')](_0x4220('0xb'),util[_0x4220('0x1')](_0x4220('0x3'),_0x4220('0x2'),i),0xfa0+i)});}db[_0x4220('0xc')][_0x4220('0xd')](users)[_0x4220('0xe')](function(){console[_0x4220('0xf')]('add\x20user');})[_0x4220('0x10')](function(_0xdbdc68){console['log'](_0xdbdc68);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 31f3c97..88ef9ea 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50c1=['length','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','VoiceQueue','FaxQueues','SmsQueues','MailQueues','Trunks','Trunk','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','emit','leave','removeMailInteractions','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','address','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','bluebird','./environment','Agents','name','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','OpenchannelQueues','findAll','Telephones','UserProfileResource','resourceId','then','map','User','where','role','Campaign','format','%s:queue:%s'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x50c1,0x171));var _0x150c=function(_0x34e9a9,_0xf7edc2){_0x34e9a9=_0x34e9a9-0x0;var _0xfd7577=_0x50c1[_0x34e9a9];return _0xfd7577;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var BPromise=require(_0x150c('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x150c('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x150c('0x3'),'model':db['User'],'attributes':['id',_0x150c('0x4'),'role'],'raw':!![],'where':{'role':_0x150c('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x150c('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x150c('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x150c('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x150c('0x4'),_0x150c('0x7')],'where':{'type':_0x150c('0x8')}};function getAssociatedResources(_0x421818,_0x4a1335,_0x32ab1f){return db[_0x150c('0x9')][_0x150c('0xa')]({'where':{'name':_0x421818,'userProfileId':_0x4a1335},'raw':!![]})['then'](function(_0x50be63){if(_0x50be63){if(_0x50be63[_0x150c('0xb')]){switch(_0x421818){case _0x150c('0xc'):case _0x150c('0xd'):case'FaxQueues':case'SmsQueues':case'MailQueues':case _0x150c('0xe'):case'WhatsappQueues':return db[_0x32ab1f][_0x150c('0xf')](queryQueues);case _0x150c('0x10'):return db[_0x32ab1f]['findAll'](queryTelephones);case'Trunks':return db[_0x32ab1f]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x32ab1f][_0x150c('0xf')](queryCampaigns);}}else{return db[_0x150c('0x11')][_0x150c('0xf')]({'attributes':[_0x150c('0x12')],'where':{'sectionId':_0x50be63['id']},'raw':!![]})[_0x150c('0x13')](function(_0x56bd65){if(_0x56bd65){var _0x41c4e1={'where':{'id':_[_0x150c('0x14')](_0x56bd65,_0x150c('0x12'))},'raw':!![]};switch(_0x32ab1f){case _0x150c('0x15'):_0x41c4e1[_0x150c('0x16')][_0x150c('0x17')]='telephone';break;case _0x150c('0x18'):_0x41c4e1[_0x150c('0x16')][_0x150c('0x7')]=_0x150c('0x8');break;}return db[_0x32ab1f]['findAll'](_0x41c4e1);}else{return[];}});}}else{return[];}})['then'](function(_0x338836){return _0x338836;});}function joinOrLeaveQueues(_0x3c863c,_0x6467b1,_0x2526ec,_0x40f7c6){_0x3c863c[_0x6467b1](util[_0x150c('0x19')](_0x150c('0x1a'),_0x2526ec,_0x40f7c6[_0x150c('0x4')]));if(_0x40f7c6[_0x150c('0x3')]){for(var _0x32df61=0x0;_0x32df61<_0x40f7c6['Agents'][_0x150c('0x1b')];_0x32df61+=0x1){_0x3c863c[_0x6467b1](util['format'](_0x150c('0x1c'),_0x40f7c6[_0x150c('0x3')][_0x32df61]['name']));}}}function joinOrLeave(_0x3d66b3,_0x5f4dfb,_0x238f09){var _0x56ab6c;if(_0x3d66b3[_0x150c('0x1d')][_0x150c('0x1e')]['id']){db[_0x150c('0x15')]['find']({'attributes':['id',_0x150c('0x4'),_0x150c('0x17'),_0x150c('0x1f')],'where':{'id':_0x3d66b3[_0x150c('0x1d')][_0x150c('0x1e')]['id']},'include':[{'model':db[_0x150c('0x20')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x150c('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x150c('0x22')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x150c('0x23')],'as':_0x150c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x150c('0x25')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x150c('0x26')],'as':_0x150c('0x27'),'attributes':['id'],'raw':!![]}]})[_0x150c('0x13')](function(_0x565e31){if(_0x565e31){_0x56ab6c=_0x565e31;_0x3d66b3[_0x5f4dfb](util[_0x150c('0x19')]('user:%s',_0x565e31[_0x150c('0x4')]));var _0x289a44=[];switch(_0x565e31[_0x150c('0x17')]){case _0x150c('0x28'):_0x3d66b3[_0x5f4dfb](_0x150c('0x29'));_0x3d66b3[_0x5f4dfb](_0x150c('0x2a'));if(queryQueues['hasOwnProperty'](_0x150c('0x2b'))){delete queryQueues['include'];}_0x289a44[_0x150c('0x2c')](db['VoiceQueue'][_0x150c('0xf')](queryQueues));_0x289a44['push'](db[_0x150c('0x2d')][_0x150c('0xf')](queryQueues));_0x289a44[_0x150c('0x2c')](db[_0x150c('0x2e')][_0x150c('0xf')](queryQueues));_0x289a44[_0x150c('0x2c')](db[_0x150c('0x2f')][_0x150c('0xf')](queryQueues));_0x289a44[_0x150c('0x2c')](db[_0x150c('0x30')][_0x150c('0xf')](queryQueues));_0x289a44['push'](db[_0x150c('0x31')][_0x150c('0xf')](queryQueues));_0x289a44[_0x150c('0x2c')](db[_0x150c('0x32')]['findAll'](queryQueues));_0x289a44[_0x150c('0x2c')](db[_0x150c('0x15')][_0x150c('0xf')](queryTelephones));_0x289a44[_0x150c('0x2c')](db['Trunk'][_0x150c('0xf')](queryTrunks));_0x289a44['push'](db[_0x150c('0x18')][_0x150c('0xf')](queryCampaigns));_0x289a44[_0x150c('0x2c')](db['User'][_0x150c('0xf')](queryAgents));break;case _0x150c('0x33'):_0x3d66b3[_0x5f4dfb](_0x150c('0x29'));_0x3d66b3[_0x5f4dfb](_0x150c('0x2a'));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0xc'),_0x565e31[_0x150c('0x1f')],_0x150c('0x34')));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0xd'),_0x565e31[_0x150c('0x1f')],_0x150c('0x2d')));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0x35'),_0x565e31[_0x150c('0x1f')],_0x150c('0x2e')));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0x36'),_0x565e31[_0x150c('0x1f')],_0x150c('0x2f')));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0x37'),_0x565e31[_0x150c('0x1f')],'MailQueue'));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0xe'),_0x565e31[_0x150c('0x1f')],_0x150c('0x31')));_0x289a44['push'](getAssociatedResources('WhatsappQueues',_0x565e31[_0x150c('0x1f')],'WhatsappQueue'));_0x289a44['push'](getAssociatedResources(_0x150c('0x10'),_0x565e31['userProfileId'],_0x150c('0x15')));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0x38'),_0x565e31[_0x150c('0x1f')],_0x150c('0x39')));_0x289a44[_0x150c('0x2c')](getAssociatedResources(_0x150c('0x3a'),_0x565e31[_0x150c('0x1f')],'Campaign'));_0x289a44['push'](db[_0x150c('0x15')][_0x150c('0xf')](queryAgents));break;case'agent':_0x3d66b3[_0x5f4dfb](_0x150c('0x29'));_0x3d66b3[_0x5f4dfb]('voice:outbound');_0x289a44[_0x150c('0x2c')](_0x565e31[_0x150c('0x3b')]({'attributes':['id','name']}));_0x289a44[_0x150c('0x2c')](_0x565e31[_0x150c('0x3c')]({'attributes':['id',_0x150c('0x4')]}));_0x289a44[_0x150c('0x2c')](_0x565e31['getFaxQueues']({'attributes':['id',_0x150c('0x4')]}));_0x289a44['push'](_0x565e31[_0x150c('0x3d')]({'attributes':['id',_0x150c('0x4')]}));_0x289a44[_0x150c('0x2c')](_0x565e31[_0x150c('0x3e')]({'attributes':['id',_0x150c('0x4')]}));_0x289a44[_0x150c('0x2c')](_0x565e31[_0x150c('0x3f')]({'attributes':['id',_0x150c('0x4')]}));_0x289a44[_0x150c('0x2c')](_0x565e31[_0x150c('0x40')]({'attributes':['id',_0x150c('0x4')]}));break;}return BPromise[_0x150c('0x41')](_0x289a44);}})[_0x150c('0x13')](function(_0x46d9b8){if(_0x46d9b8&&_0x46d9b8[_0x150c('0x1b')]){for(var _0x2c6745=0x0;_0x2c6745<_0x46d9b8['length'];_0x2c6745+=0x1){for(var _0x398634=0x0;_0x398634<_0x46d9b8[_0x2c6745][_0x150c('0x1b')];_0x398634+=0x1){switch(_0x2c6745){case 0x0:joinOrLeaveQueues(_0x3d66b3,_0x5f4dfb,_0x150c('0x42'),_0x46d9b8[_0x2c6745][_0x398634]);break;case 0x1:joinOrLeaveQueues(_0x3d66b3,_0x5f4dfb,_0x150c('0x43'),_0x46d9b8[_0x2c6745][_0x398634]);break;case 0x2:joinOrLeaveQueues(_0x3d66b3,_0x5f4dfb,_0x150c('0x44'),_0x46d9b8[_0x2c6745][_0x398634]);break;case 0x3:joinOrLeaveQueues(_0x3d66b3,_0x5f4dfb,'sms',_0x46d9b8[_0x2c6745][_0x398634]);break;case 0x4:joinOrLeaveQueues(_0x3d66b3,_0x5f4dfb,'mail',_0x46d9b8[_0x2c6745][_0x398634]);break;case 0x5:joinOrLeaveQueues(_0x3d66b3,_0x5f4dfb,_0x150c('0x45'),_0x46d9b8[_0x2c6745][_0x398634]);break;case 0x6:joinOrLeaveQueues(_0x3d66b3,_0x5f4dfb,_0x150c('0x46'),_0x46d9b8[_0x2c6745][_0x398634]);break;case 0x7:if(_0x56ab6c[_0x150c('0x17')]!==_0x150c('0x5'))_0x3d66b3[_0x5f4dfb](util[_0x150c('0x19')](_0x150c('0x47'),_0x46d9b8[_0x2c6745][_0x398634][_0x150c('0x4')]));break;case 0x8:if(_0x56ab6c[_0x150c('0x17')]!==_0x150c('0x5'))_0x3d66b3[_0x5f4dfb](util['format'](_0x150c('0x48'),_0x46d9b8[_0x2c6745][_0x398634][_0x150c('0x4')]));break;case 0x9:if(_0x56ab6c['role']!==_0x150c('0x5'))_0x3d66b3[_0x5f4dfb](util[_0x150c('0x19')](_0x150c('0x49'),_0x46d9b8[_0x2c6745][_0x398634][_0x150c('0x7')],_0x46d9b8[_0x2c6745][_0x398634]['name']));break;case 0xa:_0x3d66b3[_0x5f4dfb](util[_0x150c('0x19')]('user:%s',_0x46d9b8[_0x2c6745][_0x398634][_0x150c('0x4')]));break;}}}}})[_0x150c('0x13')](function(){if(_0x5f4dfb==='leave'){var _0x20a9cb=_[_0x150c('0x14')](_0x56ab6c['ChatInteractions'],'id');return _0x56ab6c['removeChatInteractions'](_0x20a9cb)['then'](function(){for(var _0x54aabf=0x0;_0x54aabf<_0x20a9cb[_0x150c('0x1b')];_0x54aabf+=0x1){_0x238f09[_0x150c('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x20a9cb[_0x54aabf]),'UserId':Number(_0x56ab6c['id'])});}});}})[_0x150c('0x13')](function(){if(_0x5f4dfb===_0x150c('0x4b')){var _0x20a2f8=_[_0x150c('0x14')](_0x56ab6c['MailInteractions'],'id');return _0x56ab6c[_0x150c('0x4c')](_0x20a2f8)[_0x150c('0x13')](function(){for(var _0x17bd25=0x0;_0x17bd25<_0x20a2f8['length'];_0x17bd25+=0x1){_0x238f09[_0x150c('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x20a2f8[_0x17bd25]),'UserId':Number(_0x56ab6c['id'])});}});}})[_0x150c('0x13')](function(){if(_0x5f4dfb===_0x150c('0x4b')){var _0x153f92=_[_0x150c('0x14')](_0x56ab6c[_0x150c('0x4d')],'id');return _0x56ab6c['removeFaxInteractions'](_0x153f92)[_0x150c('0x13')](function(){for(var _0x3955a1=0x0;_0x3955a1<_0x153f92['length'];_0x3955a1+=0x1){_0x238f09[_0x150c('0x4a')](_0x150c('0x4e'),{'FaxInteractionId':Number(_0x153f92[_0x3955a1]),'UserId':Number(_0x56ab6c['id'])});}});}})['then'](function(){if(_0x5f4dfb==='leave'){var _0x2def2c=_[_0x150c('0x14')](_0x56ab6c[_0x150c('0x24')],'id');return _0x56ab6c[_0x150c('0x4f')](_0x2def2c)[_0x150c('0x13')](function(){for(var _0x5b9a4f=0x0;_0x5b9a4f<_0x2def2c[_0x150c('0x1b')];_0x5b9a4f+=0x1){_0x238f09[_0x150c('0x4a')](_0x150c('0x50'),{'SmsInteractionId':Number(_0x2def2c[_0x5b9a4f]),'UserId':Number(_0x56ab6c['id'])});}});}})[_0x150c('0x13')](function(){if(_0x5f4dfb===_0x150c('0x4b')){var _0x4670b2=_[_0x150c('0x14')](_0x56ab6c[_0x150c('0x51')],'id');return _0x56ab6c[_0x150c('0x52')](_0x4670b2)['then'](function(){for(var _0x11e6e5=0x0;_0x11e6e5<_0x4670b2['length'];_0x11e6e5+=0x1){_0x238f09[_0x150c('0x4a')](_0x150c('0x53'),{'OpenchannelInteractionId':Number(_0x4670b2[_0x11e6e5]),'UserId':Number(_0x56ab6c['id'])});}});}})[_0x150c('0x13')](function(){if(_0x5f4dfb===_0x150c('0x4b')){var _0x1b14ed=_['map'](_0x56ab6c['WhatsappInteractions'],'id');return _0x56ab6c[_0x150c('0x54')](_0x1b14ed)[_0x150c('0x13')](function(){for(var _0x48772d=0x0;_0x48772d<_0x1b14ed[_0x150c('0x1b')];_0x48772d+=0x1){_0x238f09[_0x150c('0x4a')](_0x150c('0x55'),{'WhatsappInteractionId':Number(_0x1b14ed[_0x48772d]),'UserId':Number(_0x56ab6c['id'])});}});}})[_0x150c('0x56')](function(_0x4e1beb){_0x3d66b3['log'](_0x4e1beb);});}}function onDisconnect(_0x36dc12,_0x9b6045){joinOrLeave(_0x36dc12,_0x150c('0x4b'),_0x9b6045);}function onConnect(_0x573588){joinOrLeave(_0x573588,_0x150c('0x57'));}exports[_0x150c('0x58')]=function(_0x236a0e){_0x236a0e['on'](_0x150c('0x59'),function(_0x12a1d7){_0x12a1d7['setMaxListeners'](0x0);_0x12a1d7[_0x150c('0x5a')]=_0x12a1d7[_0x150c('0x5b')][_0x150c('0x59')][_0x150c('0x5c')]+':'+_0x12a1d7[_0x150c('0x5b')]['connection']['remotePort'];_0x12a1d7[_0x150c('0x5d')]=new Date();_0x12a1d7['log']=function(_0x2c5964){console[_0x150c('0x5e')](_0x150c('0x5f')+_0x12a1d7[_0x150c('0x60')][_0x150c('0x4')]+'['+_0x12a1d7['address']+']',_0x2c5964);};_0x12a1d7['on'](_0x150c('0x61'),function(){onDisconnect(_0x12a1d7,_0x236a0e);_0x12a1d7['log'](_0x150c('0x62'));});onConnect(_0x12a1d7);_0x12a1d7[_0x150c('0x5e')]('CONNECTED');});}; \ No newline at end of file +var _0x28a6=['connection','setMaxListeners','request','remotePort','connectedAt','CONNECTED','util','./environment','Agents','name','agent','type','ivr','UserProfileSection','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','telephone','format','%s:queue:%s','handshake','User','find','userProfileId','ChatInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','WhatsappQueue','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','ChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28a6,0x166));var _0x628a=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0x28a6[_0x1f27df];return _0x286ee2;};'use strict';var _=require('lodash');var util=require(_0x628a('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x628a('0x1'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x628a('0x2'),'model':db['User'],'attributes':['id',_0x628a('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x628a('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x628a('0x3')],'where':{'role':_0x628a('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x628a('0x3'),_0x628a('0x5')],'where':{'type':_0x628a('0x6')}};function getAssociatedResources(_0x394801,_0x3c4c2f,_0x39c936){return db[_0x628a('0x7')][_0x628a('0x8')]({'where':{'name':_0x394801,'userProfileId':_0x3c4c2f},'raw':!![]})['then'](function(_0x1e1c61){if(_0x1e1c61){if(_0x1e1c61['autoAssociation']){switch(_0x394801){case _0x628a('0x9'):case _0x628a('0xa'):case _0x628a('0xb'):case _0x628a('0xc'):case _0x628a('0xd'):case _0x628a('0xe'):case _0x628a('0xf'):return db[_0x39c936][_0x628a('0x10')](queryQueues);case _0x628a('0x11'):return db[_0x39c936][_0x628a('0x10')](queryTelephones);case _0x628a('0x12'):return db[_0x39c936]['findAll'](queryTrunks);case _0x628a('0x13'):return db[_0x39c936][_0x628a('0x10')](queryCampaigns);}}else{return db[_0x628a('0x14')][_0x628a('0x10')]({'attributes':[_0x628a('0x15')],'where':{'sectionId':_0x1e1c61['id']},'raw':!![]})[_0x628a('0x16')](function(_0x224619){if(_0x224619){var _0x1d80d3={'where':{'id':_[_0x628a('0x17')](_0x224619,_0x628a('0x15'))},'raw':!![]};switch(_0x39c936){case'User':_0x1d80d3[_0x628a('0x18')][_0x628a('0x19')]=_0x628a('0x1a');break;case'Campaign':_0x1d80d3[_0x628a('0x18')][_0x628a('0x5')]='ivr';break;}return db[_0x39c936][_0x628a('0x10')](_0x1d80d3);}else{return[];}});}}else{return[];}})['then'](function(_0x156e4c){return _0x156e4c;});}function joinOrLeaveQueues(_0x1adbf4,_0x3fe7ba,_0x15cd1a,_0x327d9f){_0x1adbf4[_0x3fe7ba](util[_0x628a('0x1b')](_0x628a('0x1c'),_0x15cd1a,_0x327d9f['name']));if(_0x327d9f['Agents']){for(var _0x4e01f7=0x0;_0x4e01f7<_0x327d9f[_0x628a('0x2')]['length'];_0x4e01f7+=0x1){_0x1adbf4[_0x3fe7ba](util[_0x628a('0x1b')]('user:%s',_0x327d9f['Agents'][_0x4e01f7][_0x628a('0x3')]));}}}function joinOrLeave(_0xca420a,_0x1ace84,_0x4aee17){var _0xb01365;if(_0xca420a[_0x628a('0x1d')]['query']['id']){db[_0x628a('0x1e')][_0x628a('0x1f')]({'attributes':['id','name','role',_0x628a('0x20')],'where':{'id':_0xca420a[_0x628a('0x1d')]['query']['id']},'include':[{'model':db[_0x628a('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x628a('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x628a('0x23')],'as':_0x628a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x628a('0x25')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x628a('0x26'),'attributes':['id'],'raw':!![]}]})[_0x628a('0x16')](function(_0x3200af){if(_0x3200af){_0xb01365=_0x3200af;_0xca420a[_0x1ace84](util['format']('user:%s',_0x3200af[_0x628a('0x3')]));var _0x4cb7a8=[];switch(_0x3200af[_0x628a('0x19')]){case _0x628a('0x27'):_0xca420a[_0x1ace84](_0x628a('0x28'));_0xca420a[_0x1ace84](_0x628a('0x29'));if(queryQueues['hasOwnProperty'](_0x628a('0x2a'))){delete queryQueues[_0x628a('0x2a')];}_0x4cb7a8['push'](db[_0x628a('0x2b')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x2d')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x2e')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db['SmsQueue'][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x2f')]['findAll'](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x30')][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db['WhatsappQueue'][_0x628a('0x10')](queryQueues));_0x4cb7a8[_0x628a('0x2c')](db['User'][_0x628a('0x10')](queryTelephones));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x31')]['findAll'](queryTrunks));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x32')]['findAll'](queryCampaigns));_0x4cb7a8[_0x628a('0x2c')](db[_0x628a('0x1e')][_0x628a('0x10')](queryAgents));break;case _0x628a('0x33'):_0xca420a[_0x1ace84](_0x628a('0x28'));_0xca420a[_0x1ace84](_0x628a('0x29'));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x9'),_0x3200af['userProfileId'],_0x628a('0x2b')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xa'),_0x3200af['userProfileId'],_0x628a('0x2d')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources('FaxQueues',_0x3200af[_0x628a('0x20')],_0x628a('0x2e')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xc'),_0x3200af[_0x628a('0x20')],'SmsQueue'));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xd'),_0x3200af['userProfileId'],_0x628a('0x2f')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources('OpenchannelQueues',_0x3200af[_0x628a('0x20')],_0x628a('0x30')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0xf'),_0x3200af[_0x628a('0x20')],_0x628a('0x34')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x11'),_0x3200af[_0x628a('0x20')],'User'));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x12'),_0x3200af[_0x628a('0x20')],_0x628a('0x31')));_0x4cb7a8[_0x628a('0x2c')](getAssociatedResources(_0x628a('0x13'),_0x3200af[_0x628a('0x20')],'Campaign'));_0x4cb7a8[_0x628a('0x2c')](db['User'][_0x628a('0x10')](queryAgents));break;case _0x628a('0x4'):_0xca420a[_0x1ace84](_0x628a('0x28'));_0xca420a[_0x1ace84](_0x628a('0x29'));_0x4cb7a8[_0x628a('0x2c')](_0x3200af['getVoiceQueues']({'attributes':['id','name']}));_0x4cb7a8['push'](_0x3200af[_0x628a('0x35')]({'attributes':['id','name']}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af['getFaxQueues']({'attributes':['id','name']}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af[_0x628a('0x36')]({'attributes':['id',_0x628a('0x3')]}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af[_0x628a('0x37')]({'attributes':['id',_0x628a('0x3')]}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af['getOpenchannelQueues']({'attributes':['id','name']}));_0x4cb7a8[_0x628a('0x2c')](_0x3200af[_0x628a('0x38')]({'attributes':['id','name']}));break;}return BPromise[_0x628a('0x39')](_0x4cb7a8);}})[_0x628a('0x16')](function(_0x4c4361){if(_0x4c4361&&_0x4c4361[_0x628a('0x3a')]){for(var _0x3818e9=0x0;_0x3818e9<_0x4c4361[_0x628a('0x3a')];_0x3818e9+=0x1){for(var _0x486e39=0x0;_0x486e39<_0x4c4361[_0x3818e9]['length'];_0x486e39+=0x1){switch(_0x3818e9){case 0x0:joinOrLeaveQueues(_0xca420a,_0x1ace84,'voice',_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x1:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3b'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x2:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3c'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x3:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3d'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x4:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3e'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x5:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x3f'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x6:joinOrLeaveQueues(_0xca420a,_0x1ace84,_0x628a('0x40'),_0x4c4361[_0x3818e9][_0x486e39]);break;case 0x7:if(_0xb01365[_0x628a('0x19')]!==_0x628a('0x4'))_0xca420a[_0x1ace84](util[_0x628a('0x1b')](_0x628a('0x41'),_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;case 0x8:if(_0xb01365[_0x628a('0x19')]!==_0x628a('0x4'))_0xca420a[_0x1ace84](util['format']('trunk:%s',_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;case 0x9:if(_0xb01365[_0x628a('0x19')]!==_0x628a('0x4'))_0xca420a[_0x1ace84](util['format']('campaign:%s:%s',_0x4c4361[_0x3818e9][_0x486e39]['type'],_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;case 0xa:_0xca420a[_0x1ace84](util[_0x628a('0x1b')]('user:%s',_0x4c4361[_0x3818e9][_0x486e39][_0x628a('0x3')]));break;}}}}})['then'](function(){if(_0x1ace84==='leave'){var _0x44c2ab=_[_0x628a('0x17')](_0xb01365[_0x628a('0x42')],'id');return _0xb01365['removeChatInteractions'](_0x44c2ab)[_0x628a('0x16')](function(){for(var _0x1cec37=0x0;_0x1cec37<_0x44c2ab[_0x628a('0x3a')];_0x1cec37+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x44'),{'ChatInteractionId':Number(_0x44c2ab[_0x1cec37]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x1bdb94=_['map'](_0xb01365[_0x628a('0x22')],'id');return _0xb01365[_0x628a('0x46')](_0x1bdb94)[_0x628a('0x16')](function(){for(var _0x852af7=0x0;_0x852af7<_0x1bdb94[_0x628a('0x3a')];_0x852af7+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x47'),{'MailInteractionId':Number(_0x1bdb94[_0x852af7]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x2b4cca=_[_0x628a('0x17')](_0xb01365['FaxInteractions'],'id');return _0xb01365[_0x628a('0x48')](_0x2b4cca)[_0x628a('0x16')](function(){for(var _0x3a4130=0x0;_0x3a4130<_0x2b4cca[_0x628a('0x3a')];_0x3a4130+=0x1){_0x4aee17[_0x628a('0x43')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2b4cca[_0x3a4130]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x482b4b=_['map'](_0xb01365[_0x628a('0x24')],'id');return _0xb01365[_0x628a('0x49')](_0x482b4b)[_0x628a('0x16')](function(){for(var _0x218a52=0x0;_0x218a52<_0x482b4b[_0x628a('0x3a')];_0x218a52+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x4a'),{'SmsInteractionId':Number(_0x482b4b[_0x218a52]),'UserId':Number(_0xb01365['id'])});}});}})['then'](function(){if(_0x1ace84===_0x628a('0x45')){var _0x2ca0bc=_[_0x628a('0x17')](_0xb01365['OpenchannelInteractions'],'id');return _0xb01365[_0x628a('0x4b')](_0x2ca0bc)[_0x628a('0x16')](function(){for(var _0x1256d5=0x0;_0x1256d5<_0x2ca0bc['length'];_0x1256d5+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x4c'),{'OpenchannelInteractionId':Number(_0x2ca0bc[_0x1256d5]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x16')](function(){if(_0x1ace84===_0x628a('0x45')){var _0x44ff3f=_[_0x628a('0x17')](_0xb01365[_0x628a('0x26')],'id');return _0xb01365[_0x628a('0x4d')](_0x44ff3f)[_0x628a('0x16')](function(){for(var _0x2d0f9b=0x0;_0x2d0f9b<_0x44ff3f['length'];_0x2d0f9b+=0x1){_0x4aee17[_0x628a('0x43')](_0x628a('0x4e'),{'WhatsappInteractionId':Number(_0x44ff3f[_0x2d0f9b]),'UserId':Number(_0xb01365['id'])});}});}})[_0x628a('0x4f')](function(_0x5c8b39){_0xca420a[_0x628a('0x50')](_0x5c8b39);});}}function onDisconnect(_0xe904ec,_0x5a45a0){joinOrLeave(_0xe904ec,'leave',_0x5a45a0);}function onConnect(_0x133809){joinOrLeave(_0x133809,'join');}exports[_0x628a('0x51')]=function(_0x3e2739){_0x3e2739['on'](_0x628a('0x52'),function(_0x5c3bf0){_0x5c3bf0[_0x628a('0x53')](0x0);_0x5c3bf0['address']=_0x5c3bf0[_0x628a('0x54')][_0x628a('0x52')]['remoteAddress']+':'+_0x5c3bf0['request'][_0x628a('0x52')][_0x628a('0x55')];_0x5c3bf0[_0x628a('0x56')]=new Date();_0x5c3bf0[_0x628a('0x50')]=function(_0x70b5d2){console[_0x628a('0x50')]('SocketIO\x20'+_0x5c3bf0['nsp'][_0x628a('0x3')]+'['+_0x5c3bf0['address']+']',_0x70b5d2);};_0x5c3bf0['on']('disconnect',function(){onDisconnect(_0x5c3bf0,_0x3e2739);_0x5c3bf0[_0x628a('0x50')]('DISCONNECTED');});onConnect(_0x5c3bf0);_0x5c3bf0['log'](_0x628a('0x57'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8f88208..9af6489 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 _0x303d=['error','catch','channel','motionChannel','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','UserId','format','incomingmessage','outgoingmessage','AfterCreateMessage','get','event','opened','resolve','query','QueryTypes','SIP/%s','name','agent','AfterCreate','changed','closed','substatus','interface','AfterUpdate','find','fullname','internal','default','length','hasOwnProperty','model','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','http','ChatInteraction','afterCreate','Chat','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','WhatsappInteraction','newinteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','afterUpdate','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s'];(function(_0x15b3f8,_0x24dd7a){var _0x145d01=function(_0x43e969){while(--_0x43e969){_0x15b3f8['push'](_0x15b3f8['shift']());}};_0x145d01(++_0x24dd7a);}(_0x303d,0x1d9));var _0xd303=function(_0x16ec9d,_0x36ac5d){_0x16ec9d=_0x16ec9d-0x0;var _0x1e98b=_0x303d[_0x16ec9d];return _0x1e98b;};'use strict';var util=require(_0xd303('0x0'));var db=require(_0xd303('0x1'))['db'];var jayson=require(_0xd303('0x2'));var logger=require(_0xd303('0x3'))('triggers');var client=jayson['client'][_0xd303('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xd303('0x5'),'event':_0xd303('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd303('0x7'),'model':_0xd303('0x5'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd303('0x7'),'model':_0xd303('0x8'),'event':'afterCreate','condition':_0xd303('0x9'),'callback':afterCreateMessage},{'channel':'Sms','model':'SmsInteraction','event':_0xd303('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd303('0xa'),'model':_0xd303('0xb'),'event':'afterUpdate','condition':_0xd303('0xc'),'callback':afterUpdate},{'channel':_0xd303('0xa'),'model':_0xd303('0xd'),'event':_0xd303('0x6'),'condition':_0xd303('0x9'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xd303('0xe'),'event':_0xd303('0x6'),'condition':_0xd303('0xf'),'callback':afterCreate},{'channel':_0xd303('0x10'),'model':_0xd303('0xe'),'event':'afterUpdate','condition':_0xd303('0xc'),'callback':afterUpdate},{'channel':_0xd303('0x10'),'model':_0xd303('0x11'),'event':_0xd303('0x6'),'condition':_0xd303('0x9'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0xd303('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd303('0x12'),'model':_0xd303('0x13'),'event':_0xd303('0x14'),'condition':_0xd303('0xc'),'callback':afterUpdate},{'channel':_0xd303('0x12'),'model':_0xd303('0x15'),'event':_0xd303('0x6'),'condition':_0xd303('0x9'),'callback':afterCreateMessage},{'channel':_0xd303('0x16'),'model':'MailInteraction','event':_0xd303('0x6'),'condition':_0xd303('0xf'),'callback':afterCreate},{'channel':'Mail','model':_0xd303('0x17'),'event':_0xd303('0x14'),'condition':_0xd303('0xc'),'callback':afterUpdate},{'channel':_0xd303('0x16'),'model':'MailMessage','event':_0xd303('0x6'),'condition':_0xd303('0x9'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xd303('0x18'),'event':_0xd303('0x6'),'condition':_0xd303('0xf'),'callback':afterCreate},{'channel':'Openchannel','model':_0xd303('0x18'),'event':_0xd303('0x14'),'condition':_0xd303('0xc'),'callback':afterUpdate},{'channel':_0xd303('0x19'),'model':_0xd303('0x1a'),'event':_0xd303('0x6'),'condition':_0xd303('0x9'),'callback':afterCreateMessage}];function request(_0x5edb4e){return client['request'](_0xd303('0x1b'),_0x5edb4e)[_0xd303('0x1c')](function(_0x3e4375){logger[_0xd303('0x1d')](_0xd303('0x1e'),_0xd303('0x1b'),_0x3e4375);if(_0x3e4375[_0xd303('0x1f')]){if(_0x3e4375[_0xd303('0x1f')]['code']===0x1f4){logger['error'](_0xd303('0x1e'),'EventManager',_0x3e4375['error']);}}})[_0xd303('0x20')](function(_0x3befe8){logger['error'](_0xd303('0x1e'),_0xd303('0x1b'),_0x3befe8);});}function afterCreateMessage(_0x3ea5b2){return function(_0x53403b){_0x53403b=_0x53403b['get']({'plain':!![]});_0x53403b[_0xd303('0x21')]=_0x3ea5b2;_0x53403b[_0xd303('0x22')]=_0x3ea5b2;_0x53403b['event']=_0x53403b[_0xd303('0x23')];Promise['resolve']()[_0xd303('0x1c')](function(){if(typeof _0x53403b[_0xd303('0x24')]===_0xd303('0x25'))return null;var _0x323983=_0xd303('0x26')+_0x53403b['ContactId'];return db[_0xd303('0x27')]['query'](_0x323983,{'type':db[_0xd303('0x28')]['QueryTypes'][_0xd303('0x29')],'raw':!![]});})[_0xd303('0x1c')](function(_0xc7bb78){if(_0xc7bb78){_0x53403b[_0xd303('0x2a')]=_0xc7bb78[0x0];}if(typeof _0x53403b[_0xd303('0x2b')]==='undefined')return;return getAgent(_0x53403b['UserId']);})[_0xd303('0x1c')](function(_0x31fb49){if(_0x31fb49){_0x53403b['interface']=util[_0xd303('0x2c')]('SIP/%s',_0x31fb49['name']);_0x53403b['agent']=_0x31fb49;_0x53403b['channel']=_0x3ea5b2;return request({'event':_0xd303('0x2d'),'message':_0x53403b});}else{return request({'event':_0xd303('0x2e'),'message':_0x53403b});}})['catch'](function(_0x4e6852){logger['error']('Trigger,\x20%s',_0xd303('0x2f'),_0x4e6852);});};}function afterCreate(_0x609be3,_0x482543){return function(_0x21564c){_0x21564c=_0x21564c[_0xd303('0x30')]({'plain':!![]});_0x21564c[_0xd303('0x21')]=_0x609be3;_0x21564c[_0xd303('0x22')]=_0x609be3;_0x21564c[_0xd303('0x31')]=_0xd303('0x32');Promise[_0xd303('0x33')]()[_0xd303('0x1c')](function(){var _0xf1b9a0=_0xd303('0x26')+_0x21564c['ContactId'];return db[_0xd303('0x27')][_0xd303('0x34')](_0xf1b9a0,{'type':db[_0xd303('0x28')][_0xd303('0x35')][_0xd303('0x29')],'raw':!![]});})[_0xd303('0x1c')](function(_0x54bd6a){if(_0x54bd6a){_0x21564c[_0xd303('0x2a')]=_0x54bd6a[0x0];}if(typeof _0x21564c[_0xd303('0x2b')]==='undefined')return;return getAgent(_0x21564c[_0xd303('0x2b')]);})['then'](function(_0x42f228){if(_0x42f228){_0x21564c['interface']=util[_0xd303('0x2c')](_0xd303('0x36'),_0x42f228[_0xd303('0x37')]);_0x21564c[_0xd303('0x38')]=_0x42f228;}return request({'event':_0x482543,'message':_0x21564c});})[_0xd303('0x20')](function(_0x5eab8f){logger[_0xd303('0x1f')](_0xd303('0x1e'),_0xd303('0x39'),_0x5eab8f);});};}function afterUpdate(_0x4f6501){return function(_0xa3b406){var _0x5cfbfe=_0xa3b406[_0xd303('0x3a')](_0xd303('0x3b'))&&_0xa3b406['closed'];var _0x4fc23d=_0xa3b406[_0xd303('0x3a')]('substatus');if(_0x5cfbfe||_0x4fc23d){var _0x14cfb1=_0x5cfbfe?_0xd303('0xc'):_0xd303('0x3c');var _0xde5675=_0xa3b406[_0xd303('0x30')]({'plain':!![]});_0xde5675[_0xd303('0x21')]=_0x4f6501;_0xde5675[_0xd303('0x22')]=_0x4f6501;_0xde5675[_0xd303('0x31')]=_0x5cfbfe?_0xd303('0x3b'):_0xd303('0x3c');var _0x4aefcf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xde5675['ContactId'];return db[_0xd303('0x27')]['query'](_0x4aefcf,{'type':db[_0xd303('0x28')][_0xd303('0x35')][_0xd303('0x29')],'raw':!![]})['then'](function(_0x3a6c2c){if(_0x3a6c2c){_0xde5675['contact']=_0x3a6c2c[0x0];}if(typeof _0xde5675['UserId']===_0xd303('0x25'))return;return getAgent(_0xde5675[_0xd303('0x2b')]);})[_0xd303('0x1c')](function(_0x2e09a1){if(_0x2e09a1){_0xde5675[_0xd303('0x3d')]=util['format'](_0xd303('0x36'),_0x2e09a1['name']);_0xde5675[_0xd303('0x38')]=_0x2e09a1;}return request({'event':_0x14cfb1,'message':_0xde5675});})[_0xd303('0x20')](function(_0x13e2f4){logger['error'](_0xd303('0x1e'),_0xd303('0x3e'),_0x13e2f4);});}};}function getAgent(_0x2aaf7f){return db['User'][_0xd303('0x3f')]({'where':{'id':_0x2aaf7f},'attributes':['id','name',_0xd303('0x40'),'email',_0xd303('0x41')],'raw':!![]})[_0xd303('0x1c')](function(_0x549599){return _0x549599;});}exports[_0xd303('0x42')]=function(){for(var _0x291ef3=0x0;_0x291ef3=_0x3c36ce['agents']){throw Error(_0x76bb('0x16'));}_0x22c7bf(_0x349a5e);})[_0x76bb('0x17')](function(_0x12478d){_0x396d65(_0x12478d);});});}; \ No newline at end of file +var _0xf5e3=['clearBlockUser','isUndefined','blockedAt','role','agent','User','count','then','agents','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','toLowerCase','includes'];(function(_0x78699f,_0x9b5e13){var _0x26bfc7=function(_0x2fbc27){while(--_0x2fbc27){_0x78699f['push'](_0x78699f['shift']());}};_0x26bfc7(++_0x9b5e13);}(_0xf5e3,0x78));var _0x3f5e=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xf5e3[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x3f5e('0x0'));var BPromise=require(_0x3f5e('0x1'));var db=require(_0x3f5e('0x2'))['db'];var util=require(_0x3f5e('0x3'));var channels=[_0x3f5e('0x4'),_0x3f5e('0x5'),'chat',_0x3f5e('0x6'),_0x3f5e('0x7'),_0x3f5e('0x8'),_0x3f5e('0x9')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x30070d){_0x30070d=_0x30070d[_0x3f5e('0xa')]();return _[_0x3f5e('0xb')](channels,_0x30070d);};exports[_0x3f5e('0xc')]=function(_0xfdf0d2,_0x1d969d,_0x1e8e12,_0x2866d3){var _0x17821f={'loginAttempts':_0x1d969d,'blocked':_0x1e8e12};if(!_[_0x3f5e('0xd')](_0x2866d3)){_0x17821f[_0x3f5e('0xe')]=_0x2866d3;}return _0xfdf0d2['updateAttributes'](_0x17821f);};exports['getLicense']=function(_0x42272f){return new BPromise(function(_0x10903d,_0x2602eb){var _0x613e8c=0x0;if(_0x42272f[_0x3f5e('0xf')]!==_0x3f5e('0x10')){_0x10903d(_0x42272f);}db[_0x3f5e('0x11')][_0x3f5e('0x12')]({'where':{'role':_0x3f5e('0x10'),'online':!![],'id':{'$ne':_0x42272f['id']}}})['then'](function(_0xa5e3a5){_0x613e8c=_0xa5e3a5;return util['getLicense']();})[_0x3f5e('0x13')](function(_0x33b08f){if(_0x33b08f&&_0x33b08f['agents']&&_0x613e8c>=_0x33b08f[_0x3f5e('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x10903d(_0x42272f);})[_0x3f5e('0x15')](function(_0x59b323){_0x2602eb(_0x59b323);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9f60656..20379d1 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafec=['404','status','json','exports'];(function(_0x54abca,_0x105466){var _0x83d195=function(_0x58030e){while(--_0x58030e){_0x54abca['push'](_0x54abca['shift']());}};_0x83d195(++_0x105466);}(_0xafec,0x1b7));var _0xcafe=function(_0x525bf1,_0x39c247){_0x525bf1=_0x525bf1-0x0;var _0x1aff6b=_0xafec[_0x525bf1];return _0x1aff6b;};'use strict';module[_0xcafe('0x0')][0x194]=function pageNotFound(_0x29a500,_0x130700){var _0x58b061=_0xcafe('0x1');var _0x883576=0x194;var _0xb71d11={'status':_0x883576};_0x130700[_0xcafe('0x2')](_0xb71d11[_0xcafe('0x2')]);_0x130700['render'](_0x58b061,{},function(_0x4184cf,_0x1042c1){if(_0x4184cf){return _0x130700[_0xcafe('0x2')](_0xb71d11[_0xcafe('0x2')])[_0xcafe('0x3')](_0xb71d11);}_0x130700['send'](_0x1042c1);});}; \ No newline at end of file +var _0x7a77=['send','exports','status','render','json'];(function(_0x6cfbf7,_0x374cbb){var _0x407dd1=function(_0x283064){while(--_0x283064){_0x6cfbf7['push'](_0x6cfbf7['shift']());}};_0x407dd1(++_0x374cbb);}(_0x7a77,0x1c3));var _0x77a7=function(_0x106599,_0x49509f){_0x106599=_0x106599-0x0;var _0x2f4d64=_0x7a77[_0x106599];return _0x2f4d64;};'use strict';module[_0x77a7('0x0')][0x194]=function pageNotFound(_0x288414,_0x291cd5){var _0x27a2a2='404';var _0x135d54=0x194;var _0x3a50de={'status':_0x135d54};_0x291cd5[_0x77a7('0x1')](_0x3a50de['status']);_0x291cd5[_0x77a7('0x2')](_0x27a2a2,{},function(_0x45a5c0,_0x1114a5){if(_0x45a5c0){return _0x291cd5[_0x77a7('0x1')](_0x3a50de[_0x77a7('0x1')])[_0x77a7('0x3')](_0x3a50de);}_0x291cd5[_0x77a7('0x4')](_0x1114a5);});}; \ No newline at end of file diff --git a/server/migrations/2.5.38.js b/server/migrations/2.5.38.js new file mode 100644 index 0000000..22df2f1 --- /dev/null +++ b/server/migrations/2.5.38.js @@ -0,0 +1,165 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); + +var logger = require('../config/logger')('migration'); + +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info('Renamed column from %s to %s on %s', oldColumn, newColumn, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface, Sequelize) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function(queryInterface, Sequelize) { + // var migration = new Migration(queryInterface); + } +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f3c6eb4..aefe84f 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa75b=['../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','SenderId','UserProfile','belongsToMany','Groups','Contacts','Lists','user_has_teams','MailInteraction','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','Contact','ContactId','MailAccount','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','mandatoryDispositionPauseId','Teams','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ListId','Items','FaxAccountId','Exntensions','Agents','user_has_fax_accounts','FaxQueue','FaxInteractionId','fax_interaction_has_tags','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','ChatProactiveAction','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatMessage','ChatInteractionId','ChatGroupId','chat_group_has_users','CompanyId','JscriptySessionReport','Company','cm_user_has_contacts','cm_contact_has_tags','Condition','All','OneAll','AutomationAllId','Any','OneAny','Action','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','Mohs','chat_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','CustomReportId','Fields','DefaultReportId','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','SugarcrmAccount','Configurations','DescriptionId','VariableId','DeskAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','VtigerAccount','VtigerField','ServicenowConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','JscriptyQuestionReport','SquareProject','team_has_mail_queues','team_has_sms_queues','team_has_whatsapp_queues','CampaignId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','cm_user_has_lists','userProfileId','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','database','username','password','sequelizeHistory','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xa75b,0x170));var _0xba75=function(_0xe71d80,_0x406c7e){_0xe71d80=_0xe71d80-0x0;var _0x4b0833=_0xa75b[_0xe71d80];return _0x4b0833;};'use strict';var config=require(_0xba75('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xba75('0x1'));var timezone=jstz[_0xba75('0x2')]();config[_0xba75('0x3')]=_[_0xba75('0x4')](config[_0xba75('0x3')],{'database':_0xba75('0x5'),'username':_0xba75('0x6'),'password':_0xba75('0x7'),'options':{'host':_0xba75('0x8'),'port':0xcea,'dialect':_0xba75('0x9'),'dialectOptions':{'charset':_0xba75('0xa')},'logging':![],'timezone':timezone[_0xba75('0xb')](),'define':{'charset':_0xba75('0xc'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0xba75('0x4')](config['sequelizeHistory'],{'database':'motion2','username':_0xba75('0x6'),'password':'xC@LL1234','options':{'host':_0xba75('0x8'),'port':0xcea,'dialect':_0xba75('0x9'),'dialectOptions':{'charset':_0xba75('0xa')},'logging':![],'timezone':timezone[_0xba75('0xb')](),'define':{'charset':_0xba75('0xc'),'collate':_0xba75('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xba75('0x3')][_0xba75('0xe')],config[_0xba75('0x3')][_0xba75('0xf')],config[_0xba75('0x3')][_0xba75('0x10')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xba75('0x11')]['database'],config[_0xba75('0x11')][_0xba75('0xf')],config[_0xba75('0x11')][_0xba75('0x10')],config['sequelizeHistory'][_0xba75('0x12')])};db[_0xba75('0x13')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x15'));db['VoiceChanSpy']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x16'));db['VoiceContext']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x17'));db[_0xba75('0x18')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xba75('0x19')]=db[_0xba75('0x3')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xba75('0x1a')]=db[_0xba75('0x3')]['import']('../api/voiceQueue/voiceQueue.model');db[_0xba75('0x1b')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x1c'));db[_0xba75('0x1d')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x1e'));db[_0xba75('0x1f')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x20'));db['VoiceMailMessage']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x21'));db[_0xba75('0x22')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x23'));db[_0xba75('0x24')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xba75('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xba75('0x25')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x26'));db[_0xba75('0x27')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x28'));db[_0xba75('0x29')]=db[_0xba75('0x3')]['import']('../api/trunk/trunk.model');db[_0xba75('0x2a')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x2b'));db[_0xba75('0x2c')]=db[_0xba75('0x3')]['import'](_0xba75('0x2d'));db[_0xba75('0x2e')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x2f'));db[_0xba75('0x30')]=db[_0xba75('0x3')]['import'](_0xba75('0x31'));db[_0xba75('0x32')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x33'));db[_0xba75('0x34')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x35'));db[_0xba75('0x36')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x37'));db[_0xba75('0x38')]=db['sequelize']['import'](_0xba75('0x39'));db[_0xba75('0x3a')]=db[_0xba75('0x3')]['import'](_0xba75('0x3b'));db[_0xba75('0x3c')]=db['sequelize']['import'](_0xba75('0x3d'));db[_0xba75('0x3e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x3f'));db['MailAccount']=db['sequelize'][_0xba75('0x14')](_0xba75('0x40'));db[_0xba75('0x41')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x42'));db[_0xba75('0x43')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x44'));db['MailInteraction']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x45'));db[_0xba75('0x46')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x47'));db['MailApplication']=db[_0xba75('0x3')]['import'](_0xba75('0x48'));db['MailQueueReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x49'));db[_0xba75('0x4a')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x4b'));db[_0xba75('0x4c')]=db[_0xba75('0x3')]['import'](_0xba75('0x4d'));db[_0xba75('0x4e')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x4f'));db[_0xba75('0x50')]=db['sequelize']['import']('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xba75('0x3')]['import'](_0xba75('0x51'));db[_0xba75('0x52')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x53'));db['FaxQueue']=db['sequelize'][_0xba75('0x14')]('../api/faxQueue/faxQueue.model');db[_0xba75('0x54')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x55'));db[_0xba75('0x56')]=db[_0xba75('0x3')]['import'](_0xba75('0x57'));db[_0xba75('0x58')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x59'));db[_0xba75('0x5a')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0xba75('0x5b')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x5c'));db[_0xba75('0x5d')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x5e'));db[_0xba75('0x5f')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x60'));db[_0xba75('0x61')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x62'));db[_0xba75('0x63')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x64'));db['OpenchannelMessage']=db['sequelize'][_0xba75('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0xba75('0x3')]['import'](_0xba75('0x65'));db[_0xba75('0x66')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x67'));db['OpenchannelQueueReport']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xba75('0x68')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x69'));db[_0xba75('0x6a')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x6b'));db['ChatMessage']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x6c'));db[_0xba75('0x6d')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xba75('0x6e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x6f'));db[_0xba75('0x70')]=db[_0xba75('0x3')]['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0xba75('0x14')](_0xba75('0x71'));db[_0xba75('0x72')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x73'));db[_0xba75('0x74')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x75'));db[_0xba75('0x76')]=db[_0xba75('0x3')]['import'](_0xba75('0x77'));db[_0xba75('0x78')]=db['sequelize'][_0xba75('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xba75('0x79')]=db[_0xba75('0x3')]['import'](_0xba75('0x7a'));db[_0xba75('0x7b')]=db['sequelize']['import'](_0xba75('0x7c'));db['ReportAgentPreview']=db[_0xba75('0x3')]['import'](_0xba75('0x7d'));db[_0xba75('0x7e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x7f'));db['Action']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/action/action.model');db[_0xba75('0x80')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x81'));db[_0xba75('0x82')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x83'));db[_0xba75('0x84')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x85'));db['Condition']=db['sequelize'][_0xba75('0x14')](_0xba75('0x86'));db[_0xba75('0x87')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x88'));db[_0xba75('0x89')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x8a'));db[_0xba75('0x8b')]=db['sequelize'][_0xba75('0x14')]('../api/cdr/cdr.model');db[_0xba75('0x8c')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x8d'));db[_0xba75('0x8e')]=db[_0xba75('0x3')]['import'](_0xba75('0x8f'));db['Sound']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/sound/sound.model');db['Tag']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x90'));db[_0xba75('0x91')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/template/template.model');db[_0xba75('0x92')]=db[_0xba75('0x3')]['import'](_0xba75('0x93'));db[_0xba75('0x94')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x95'));db['Integration']=db[_0xba75('0x3')]['import'](_0xba75('0x96'));db[_0xba75('0x97')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x98'));db[_0xba75('0x99')]=db['sequelize']['import'](_0xba75('0x9a'));db['AnalyticDefaultReport']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xba75('0x9b')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0xba75('0x9c')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x9d'));db[_0xba75('0x9e')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x9f'));db[_0xba75('0xa0')]=db['sequelize']['import'](_0xba75('0xa1'));db[_0xba75('0xa2')]=db['sequelize'][_0xba75('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xba75('0xa3')]=db[_0xba75('0x3')]['import'](_0xba75('0xa4'));db['SugarcrmAccount']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xba75('0xa5')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xa6'));db[_0xba75('0xa7')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xa8'));db['DeskAccount']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db['sequelize'][_0xba75('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xba75('0xa9')]=db['sequelize'][_0xba75('0x14')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xba75('0x3')]['import'](_0xba75('0xaa'));db['ZohoConfiguration']=db['sequelize'][_0xba75('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xba75('0xab')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xac'));db[_0xba75('0xad')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xae'));db['ZendeskConfiguration']=db[_0xba75('0x3')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xba75('0xaf')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xb0'));db[_0xba75('0xb1')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xb2'));db[_0xba75('0xb3')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xb4'));db[_0xba75('0xb5')]=db['sequelize']['import'](_0xba75('0xb6'));db['VtigerAccount']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xb7'));db[_0xba75('0xb8')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0xba75('0x3')]['import'](_0xba75('0xb9'));db[_0xba75('0xba')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xbb'));db['ServicenowConfiguration']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xbc'));db[_0xba75('0xbd')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xbe'));db[_0xba75('0xbf')]=db[_0xba75('0x3')]['import'](_0xba75('0xc0'));db[_0xba75('0xc1')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xc2'));db[_0xba75('0xc3')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xba75('0xc4')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xc5'));db[_0xba75('0xc6')]=db[_0xba75('0x3')]['import'](_0xba75('0xc7'));db['FreshsalesField']=db[_0xba75('0x3')]['import'](_0xba75('0xc8'));db[_0xba75('0xc9')]=db[_0xba75('0x3')]['import']('../api/integration/integration.model');db['Network']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xca'));db[_0xba75('0xcb')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xcc'));db[_0xba75('0xcd')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xce'));db[_0xba75('0xcf')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd0'));db['JscriptyQuestionReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd1'));db['JscriptySessionReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd2'));db[_0xba75('0xd3')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xd4'));db['SquareReport']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xd5'));db[_0xba75('0xd6')]=db[_0xba75('0x3')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xba75('0xd7')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xd8'));db[_0xba75('0xd9')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xda'));db[_0xba75('0xdb')]=db[_0xba75('0x3')][_0xba75('0x14')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize'][_0xba75('0x14')]('../api/squareProject/squareProject.model');db[_0xba75('0xdc')]=db['sequelize'][_0xba75('0x14')]('../api/squareRecording/squareRecording.model');db[_0xba75('0xdd')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xde'));db[_0xba75('0xdf')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xe0'));db['License']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xe1'));db[_0xba75('0xe2')]=db[_0xba75('0x3')]['import'](_0xba75('0xe3'));db[_0xba75('0xe4')]=db[_0xba75('0x3')]['import'](_0xba75('0xe5'));db['Attachment']=db['sequelize'][_0xba75('0x14')](_0xba75('0xe6'));db[_0xba75('0xe7')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xe8'));db[_0xba75('0xe9')]=db['sequelize'][_0xba75('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0xba75('0xea')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xeb'));db[_0xba75('0xec')]=db[_0xba75('0x3')]['import'](_0xba75('0xed'));db[_0xba75('0xee')]=db[_0xba75('0x3')]['import'](_0xba75('0xef'));db[_0xba75('0xf0')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf1'));db[_0xba75('0xf2')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf3'));db[_0xba75('0xf4')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf5'));db['UserProfile']=db[_0xba75('0x3')][_0xba75('0x14')]('../api/userProfile/userProfile.model');db[_0xba75('0xf6')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xf7'));db['UserProfileResource']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0xf8'));db[_0xba75('0xf9')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xfa'));db['WhatsappAccount']=db['sequelize']['import'](_0xba75('0xfb'));db[_0xba75('0xfc')]=db['sequelize'][_0xba75('0x14')](_0xba75('0xfd'));db[_0xba75('0xfe')]=db[_0xba75('0x3')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xba75('0xff')]=db['sequelize'][_0xba75('0x14')](_0xba75('0x100'));db[_0xba75('0x101')]=db['sequelize'][_0xba75('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xba75('0x102')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x103'));db[_0xba75('0x104')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x105'));db[_0xba75('0x106')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x107'));db[_0xba75('0x108')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x109'));db[_0xba75('0x10a')]=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x10b'));db['UserVoicePrefix']=db[_0xba75('0x3')][_0xba75('0x14')](_0xba75('0x10c'));db[_0xba75('0x13')][_0xba75('0x10d')](db[_0xba75('0x1f')],{'as':'VoiceMail','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x1b')],{'as':'Recordings','foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x2c')],{'as':_0xba75('0x111'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x112'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x13')][_0xba75('0x110')](db['CmHopperFinal'],{'as':_0xba75('0x113'),'foreignKey':_0xba75('0x10f')});db['User'][_0xba75('0x110')](db['CmHopperHistory'],{'as':_0xba75('0x114'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db['ReportAgentPreview'],{'as':_0xba75('0x115'),'foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db['OpenchannelInteraction'],{'as':_0xba75('0x116'),'foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x5a')],{'as':_0xba75('0x117'),'foreignKey':'UserId'});db[_0xba75('0x13')][_0xba75('0x110')](db[_0xba75('0x118')],{'as':_0xba75('0x119'),'foreignKey':_0xba75('0x10f')});db['User'][_0xba75('0x110')](db['MailInteraction'],{'as':_0xba75('0x11a'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x13')][_0xba75('0x110')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xba75('0x13')]['hasMany'](db[_0xba75('0xf9')],{'as':_0xba75('0x11b'),'foreignKey':_0xba75('0x11c')});db[_0xba75('0x13')]['belongsTo'](db[_0xba75('0x11d')],{'as':_0xba75('0x11d'),'foreignKey':'userProfileId'});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x70')],{'as':_0xba75('0x11f'),'through':'chat_group_has_users'});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x74')],{'as':_0xba75('0x120'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db['CmList'],{'as':_0xba75('0x121'),'through':'cm_user_has_lists'});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':_0xba75('0x122')});db['User']['belongsToMany'](db[_0xba75('0x123')],{'as':'MailInteractions','through':_0xba75('0x124')});db['User'][_0xba75('0x11e')](db[_0xba75('0x6a')],{'as':_0xba75('0x125'),'through':_0xba75('0x126')});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x118')],{'as':_0xba75('0x119'),'through':_0xba75('0x127')});db['User'][_0xba75('0x11e')](db[_0xba75('0x5a')],{'as':_0xba75('0x117'),'through':_0xba75('0x128')});db['User'][_0xba75('0x11e')](db[_0xba75('0x63')],{'as':_0xba75('0x116'),'through':'user_has_openchannel_interactions'});db[_0xba75('0x13')][_0xba75('0x11e')](db['WhatsappInteraction'],{'as':_0xba75('0x129'),'through':_0xba75('0x12a')});db['User']['belongsToMany'](db[_0xba75('0x1a')],{'as':_0xba75('0x12b'),'through':'UserVoiceQueue','required':![]});db[_0xba75('0x13')][_0xba75('0x11e')](db['VoicePrefix'],{'as':_0xba75('0x12c'),'through':_0xba75('0x12d'),'required':![]});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x41')],{'as':_0xba75('0x12e'),'through':_0xba75('0x32'),'required':![]});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x6e')],{'as':_0xba75('0x12f'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0xba75('0x11e')](db['FaxQueue'],{'as':_0xba75('0x130'),'through':'UserFaxQueue','required':![]});db[_0xba75('0x13')][_0xba75('0x11e')](db[_0xba75('0x5d')],{'as':_0xba75('0x131'),'through':_0xba75('0x36'),'required':![]});db['User'][_0xba75('0x11e')](db[_0xba75('0x132')],{'as':_0xba75('0x133'),'through':_0xba75('0x38'),'required':![]});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x104')],{'as':_0xba75('0x134'),'through':_0xba75('0x3a'),'required':![]});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0xf2')],{'through':'cm_user_has_lists'});db['User'][_0xba75('0x11e')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xba75('0x135')});db[_0xba75('0x13')][_0xba75('0x11e')](db['FaxAccount'],{'as':_0xba75('0x136'),'through':'user_has_fax_accounts'});db[_0xba75('0x13')][_0xba75('0x11e')](db['MailAccount'],{'as':'MailAccounts','through':_0xba75('0x137')});db['User'][_0xba75('0x11e')](db[_0xba75('0x5f')],{'as':_0xba75('0x138'),'through':'user_has_openchannel_accounts'});db[_0xba75('0x13')]['belongsToMany'](db[_0xba75('0x56')],{'as':'SmsAccounts','through':_0xba75('0x139')});db['User'][_0xba75('0x11e')](db[_0xba75('0x13a')],{'as':_0xba75('0x13b'),'through':_0xba75('0x13c')});db[_0xba75('0x13')][_0xba75('0x11e')](db['SquareProject'],{'as':'SquareProjects','through':_0xba75('0x13d')});db[_0xba75('0x13e')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x13f'),'onDelete':'cascade','foreignKey':_0xba75('0x140')});db[_0xba75('0x141')][_0xba75('0x110')](db[_0xba75('0x18')],{'onDelete':'cascade'});db['VoiceExtension'][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x142'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x19')][_0xba75('0x11e')](db[_0xba75('0x143')],{'as':_0xba75('0x144'),'through':_0xba75('0x145')});db['VoiceQueue'][_0xba75('0x110')](db['UserVoiceQueueRt'],{'as':_0xba75('0x146'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db['CmHopper'],{'as':_0xba75('0x148'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')]['hasMany'](db[_0xba75('0x79')],{'as':_0xba75('0x113'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db[_0xba75('0x7b')],{'as':_0xba75('0x149'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db['ReportAgentPreview'],{'as':_0xba75('0x115'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x110')](db[_0xba75('0x78')],{'as':'HopperBlacks','foreignKey':_0xba75('0x147')});db['VoiceQueue'][_0xba75('0x110')](db['JscriptySessionReport'],{'as':_0xba75('0x14a'),'foreignKey':_0xba75('0x147')});db[_0xba75('0x1a')][_0xba75('0x14b')](db[_0xba75('0x29')],{'as':'Trunk','foreignKey':_0xba75('0x14c')});db[_0xba75('0x1a')][_0xba75('0x14b')](db['Trunk'],{'as':_0xba75('0x14d'),'foreignKey':_0xba75('0x14e')});db[_0xba75('0x1a')][_0xba75('0x14b')](db['Interval'],{'as':_0xba75('0x87'),'foreignKey':_0xba75('0x14f')});db['VoiceQueue'][_0xba75('0x14b')](db['Pause'],{'as':_0xba75('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xba75('0x1a')]['belongsToMany'](db[_0xba75('0xf2')],{'as':'Lists','through':_0xba75('0x151')});db[_0xba75('0x1a')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0xba75('0x1a')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'as':'Teams','through':_0xba75('0x108')});db[_0xba75('0x1a')]['belongsToMany'](db[_0xba75('0xf2')],{'as':'BlackLists','through':_0xba75('0x152')});db['VoiceRecording'][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x13'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x1d')][_0xba75('0x14b')](db['User'],{'as':_0xba75('0x13'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x1f')]['hasMany'](db[_0xba75('0x153')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x155'),'sourceKey':_0xba75('0x156')});db['VoiceMailMessage'][_0xba75('0x14b')](db[_0xba75('0x1f')],{'foreignKey':_0xba75('0x155'),'targetKey':_0xba75('0x156')});db[_0xba75('0x22')]['hasMany'](db['VoiceQueueReport'],{'as':_0xba75('0x157'),'foreignKey':'uniqueid','constraints':![]});db[_0xba75('0x22')][_0xba75('0x110')](db[_0xba75('0x158')],{'as':_0xba75('0x159'),'foreignKey':_0xba75('0x15a'),'constraints':![]});db[_0xba75('0x22')]['belongsTo'](db[_0xba75('0x13')],{'as':_0xba75('0x13'),'foreignKey':'UserId'});db[_0xba75('0x22')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x3c')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':_0xba75('0x15d'),'foreignKey':_0xba75('0x15e')});db[_0xba75('0x3e')]['belongsTo'](db[_0xba75('0x15d')],{'as':'MailAccount','foreignKey':_0xba75('0x15e')});db[_0xba75('0x15d')]['hasOne'](db[_0xba75('0x3c')],{'as':_0xba75('0x15f'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x15d')][_0xba75('0x10d')](db['MailServerOut'],{'as':_0xba75('0x160'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x15d')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':_0xba75('0x15e'),'onDelete':_0xba75('0x10e')});db['MailAccount'][_0xba75('0x110')](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x15e')});db[_0xba75('0x15d')]['hasMany'](db[_0xba75('0x46')],{'as':_0xba75('0x154'),'foreignKey':'MailAccountId'});db[_0xba75('0x15d')][_0xba75('0x110')](db['MailInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x15d')]['hasMany'](db[_0xba75('0x164')],{'as':'Applications'});db[_0xba75('0x15d')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':'ListId'});db['MailAccount'][_0xba75('0x14b')](db[_0xba75('0x91')],{'as':_0xba75('0x91'),'foreignKey':'TemplateId'});db[_0xba75('0x15d')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0xba75('0x166')});db[_0xba75('0x15d')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x137')});db['MailQueue']['belongsToMany'](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x32')});db[_0xba75('0x41')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_mail_queues','as':_0xba75('0x167')});db[_0xba75('0x123')]['hasMany'](db[_0xba75('0x46')],{'as':_0xba75('0x154'),'onDelete':'cascade','foreignKey':_0xba75('0x168')});db[_0xba75('0x123')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x15e')});db[_0xba75('0x123')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x123')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x123')]['belongsToMany'](db[_0xba75('0x16b')],{'through':_0xba75('0x16c'),'as':_0xba75('0x16d')});db['MailInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x16c'),'as':_0xba75('0x16e')});db[_0xba75('0x123')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':'user_has_mail_interactions','foreignKey':_0xba75('0x168')});db[_0xba75('0x46')][_0xba75('0x110')](db[_0xba75('0x170')],{'as':_0xba75('0x171'),'onDelete':'cascade'});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x13')});db[_0xba75('0x46')]['belongsTo'](db[_0xba75('0x74')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db[_0xba75('0x46')]['belongsTo'](db['MailInteraction'],{'as':_0xba75('0x172'),'foreignKey':_0xba75('0x168')});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':'ChatWebsite','foreignKey':_0xba75('0x173')});db[_0xba75('0x46')][_0xba75('0x14b')](db[_0xba75('0x6d')],{'as':_0xba75('0x6d'),'foreignKey':_0xba75('0x174')});db['MailApplication'][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x164')][_0xba75('0x14b')](db['MailQueue'],{'onDelete':_0xba75('0x175')});db['MailApplication']['belongsTo'](db[_0xba75('0x15d')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x164')]['belongsTo'](db['Interval'],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x164')][_0xba75('0x14b')](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x15d')],{});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db['MailQueueReport'][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x123')],{});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x46')],{});db['MailQueueReport']['belongsTo'](db[_0xba75('0x13')],{});db[_0xba75('0x177')][_0xba75('0x14b')](db[_0xba75('0x41')],{});db[_0xba75('0x4a')][_0xba75('0x110')](db[_0xba75('0x4c')],{'as':_0xba75('0x179'),'onDelete':'cascade'});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'FaxAccountId','onDelete':_0xba75('0x10e')});db['FaxAccount'][_0xba75('0x110')](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x17a')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x118')],{'as':_0xba75('0x163')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x50')],{'as':_0xba75('0x142')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':_0xba75('0x17b'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x4e')][_0xba75('0x110')](db[_0xba75('0x52')],{'as':_0xba75('0x154')});db[_0xba75('0x4e')][_0xba75('0x14b')](db['Trunk'],{'as':_0xba75('0x29')});db[_0xba75('0x4e')][_0xba75('0x14b')](db['CmList'],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x4e')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x4e')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x17d')});db[_0xba75('0x50')][_0xba75('0x14b')](db['User'],{'onDelete':'restrict'});db[_0xba75('0x50')][_0xba75('0x14b')](db[_0xba75('0x17e')],{'onDelete':_0xba75('0x175')});db['FaxApplication'][_0xba75('0x14b')](db[_0xba75('0x4e')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x50')][_0xba75('0x14b')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xba75('0x176')});db['FaxInteraction']['hasMany'](db['FaxMessage'],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x17f')});db[_0xba75('0x118')][_0xba75('0x14b')](db[_0xba75('0x4e')],{'as':_0xba75('0x169'),'foreignKey':'FaxAccountId'});db[_0xba75('0x118')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x118')]['belongsTo'](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db[_0xba75('0x118')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x180'),'as':_0xba75('0x16d')});db['FaxInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x180'),'as':_0xba75('0x16e')});db[_0xba75('0x118')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Users','through':_0xba75('0x127'),'foreignKey':_0xba75('0x17f')});db[_0xba75('0x52')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x13')});db[_0xba75('0x52')][_0xba75('0x14b')](db['FaxInteraction'],{'as':_0xba75('0x172'),'foreignKey':_0xba75('0x17f')});db['FaxMessage'][_0xba75('0x14b')](db[_0xba75('0x74')],{'onDelete':'cascade','as':'Contact'});db['FaxMessage']['belongsTo'](db[_0xba75('0x170')],{'as':_0xba75('0x170'),'foreignKey':'AttachmentId'});db[_0xba75('0x52')][_0xba75('0x14b')](db[_0xba75('0x4e')],{'as':'Account','foreignKey':_0xba75('0x17a')});db['FaxQueue']['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x34')});db['FaxQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_fax_queues','as':'Teams'});db[_0xba75('0x54')][_0xba75('0x14b')](db['FaxAccount'],{});db[_0xba75('0x54')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x54')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x54')][_0xba75('0x14b')](db[_0xba75('0x118')],{});db[_0xba75('0x54')]['belongsTo'](db[_0xba75('0x52')],{});db['FaxQueueReport'][_0xba75('0x14b')](db['User'],{});db[_0xba75('0x54')][_0xba75('0x14b')](db['FaxQueue'],{});db[_0xba75('0x56')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':_0xba75('0x181'),'onDelete':'cascade'});db['SmsAccount']['hasMany'](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x181')});db[_0xba75('0x56')][_0xba75('0x110')](db[_0xba75('0x5b')],{'as':_0xba75('0x154'),'foreignKey':_0xba75('0x181')});db[_0xba75('0x56')]['hasMany'](db['SmsInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x56')]['hasMany'](db[_0xba75('0x58')],{'as':_0xba75('0x142')});db['SmsAccount'][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x56')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0xba75('0x166')});db['SmsAccount']['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x139')});db[_0xba75('0x58')]['belongsTo'](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x58')][_0xba75('0x14b')](db[_0xba75('0x5d')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x58')][_0xba75('0x14b')](db[_0xba75('0x56')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x58')]['belongsTo'](db[_0xba75('0x87')],{'onDelete':_0xba75('0x175'),'foreignKey':'IntervalId'});db[_0xba75('0x58')][_0xba75('0x14b')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xba75('0x176')});db[_0xba75('0x5a')][_0xba75('0x110')](db[_0xba75('0x5b')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x182')});db[_0xba75('0x5a')][_0xba75('0x14b')](db['SmsAccount'],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x181')});db[_0xba75('0x5a')]['belongsTo'](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db['User'],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db['SmsInteraction'][_0xba75('0x11e')](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction']['belongsToMany'](db[_0xba75('0x16b')],{'through':_0xba75('0x183'),'as':'ThroughTags'});db[_0xba75('0x5a')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x128'),'foreignKey':_0xba75('0x182')});db[_0xba75('0x5b')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':'User'});db['SmsMessage'][_0xba75('0x14b')](db[_0xba75('0x74')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db[_0xba75('0x5b')][_0xba75('0x14b')](db[_0xba75('0x5a')],{'onDelete':'cascade','as':_0xba75('0x172'),'foreignKey':'SmsInteractionId'});db[_0xba75('0x5b')][_0xba75('0x14b')](db[_0xba75('0x56')],{'as':_0xba75('0x169'),'foreignKey':'SmsAccountId'});db[_0xba75('0x5d')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x36'),'foreignKey':_0xba75('0x184')});db['SmsQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xba75('0x5f')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'OpenchannelAccountId','onDelete':_0xba75('0x10e')});db[_0xba75('0x5f')][_0xba75('0x110')](db[_0xba75('0x82')],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x185')});db['OpenchannelAccount'][_0xba75('0x110')](db[_0xba75('0x63')],{'as':_0xba75('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xba75('0x5f')][_0xba75('0x110')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xba75('0x185')});db[_0xba75('0x5f')][_0xba75('0x110')](db[_0xba75('0x61')],{'as':_0xba75('0x142'),'foreignKey':_0xba75('0x185')});db[_0xba75('0x5f')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x5f')]['belongsTo'](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x5f')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':'user_has_openchannel_accounts'});db[_0xba75('0x61')]['belongsTo'](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0x61')][_0xba75('0x14b')](db['OpenchannelQueue'],{'onDelete':_0xba75('0x175'),'foreignKey':'OpenchannelQueueId'});db[_0xba75('0x61')][_0xba75('0x14b')](db[_0xba75('0x5f')],{'onDelete':'restrict','foreignKey':_0xba75('0x185')});db['OpenchannelApplication'][_0xba75('0x14b')](db[_0xba75('0x87')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xba75('0x61')][_0xba75('0x14b')](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db[_0xba75('0x63')][_0xba75('0x110')](db[_0xba75('0x186')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x187')});db['OpenchannelInteraction'][_0xba75('0x14b')](db[_0xba75('0x5f')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x185')});db[_0xba75('0x63')][_0xba75('0x14b')](db['CmContact'],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db['OpenchannelInteraction'][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':_0xba75('0x10f')});db['OpenchannelInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x188'),'as':'Tags'});db['OpenchannelInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x188'),'as':_0xba75('0x16e')});db[_0xba75('0x63')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x189'),'foreignKey':_0xba75('0x187')});db[_0xba75('0x186')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':'cascade','as':'User'});db[_0xba75('0x186')]['belongsTo'](db['CmContact'],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db['OpenchannelMessage'][_0xba75('0x14b')](db[_0xba75('0x63')],{'onDelete':_0xba75('0x10e'),'as':'Interaction','foreignKey':_0xba75('0x187')});db[_0xba75('0x186')][_0xba75('0x14b')](db['Attachment'],{'as':_0xba75('0x170'),'foreignKey':_0xba75('0x18a')});db['OpenchannelMessage'][_0xba75('0x14b')](db[_0xba75('0x5f')],{'as':'Account','foreignKey':_0xba75('0x185')});db['OpenchannelQueue'][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x38'),'foreignKey':_0xba75('0x18b')});db['OpenchannelQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':_0xba75('0x18c'),'as':_0xba75('0x167')});db['ChatWebsite'][_0xba75('0x110')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xba75('0x173'),'onDelete':'cascade'});db['ChatWebsite'][_0xba75('0x110')](db['CannedAnswer'],{'as':_0xba75('0x162'),'foreignKey':_0xba75('0x173')});db[_0xba75('0x66')][_0xba75('0x110')](db[_0xba75('0x18d')],{'as':'ProactiveActions'});db[_0xba75('0x66')][_0xba75('0x110')](db['ChatInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x66')][_0xba75('0x110')](db[_0xba75('0x68')],{'as':_0xba75('0x142')});db[_0xba75('0x66')]['hasMany'](db['ChatMessage'],{'as':_0xba75('0x154')});db[_0xba75('0x66')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x66')][_0xba75('0x14b')](db[_0xba75('0x87')],{'as':'Interval','foreignKey':_0xba75('0x14f')});db['ChatWebsite'][_0xba75('0x14b')](db[_0xba75('0x15d')],{'as':'MailAccount','foreignKey':_0xba75('0x15e')});db['ChatWebsite'][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x66')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x135')});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0x5f')],{});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x18e')][_0xba75('0x14b')](db['CmContact'],{'as':'Contact','foreignKey':_0xba75('0x15c')});db[_0xba75('0x18e')]['belongsTo'](db[_0xba75('0x63')],{});db[_0xba75('0x18e')]['belongsTo'](db[_0xba75('0x186')],{});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0x13')],{});db[_0xba75('0x18e')][_0xba75('0x14b')](db[_0xba75('0x132')],{});db[_0xba75('0x68')][_0xba75('0x14b')](db['User'],{'as':_0xba75('0x18f'),'foreignKey':_0xba75('0x10f'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xba75('0x6e')],{'as':_0xba75('0x190'),'foreignKey':_0xba75('0x191'),'onDelete':'restrict'});db['ChatApplication'][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':'Website','foreignKey':_0xba75('0x173'),'onDelete':'restrict'});db[_0xba75('0x68')]['belongsTo'](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db['ChatInteraction'][_0xba75('0x110')](db[_0xba75('0x192')],{'as':_0xba75('0x154'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x193')});db[_0xba75('0x6a')][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x173')});db[_0xba75('0x6a')][_0xba75('0x14b')](db['CmContact'],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x6a')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xba75('0x10f')});db['ChatInteraction'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xba75('0x6a')][_0xba75('0x11e')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xba75('0x16e')});db[_0xba75('0x6a')]['belongsToMany'](db[_0xba75('0x13')],{'as':'Users','through':_0xba75('0x126'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x13')});db[_0xba75('0x192')][_0xba75('0x14b')](db['CmContact'],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b'),'foreignKey':'ContactId'});db[_0xba75('0x192')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x172'),'foreignKey':_0xba75('0x193')});db['ChatMessage'][_0xba75('0x14b')](db[_0xba75('0x170')],{'as':_0xba75('0x170'),'foreignKey':_0xba75('0x18a')});db[_0xba75('0x192')][_0xba75('0x14b')](db[_0xba75('0x66')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x173')});db[_0xba75('0x6d')][_0xba75('0x110')](db[_0xba75('0x170')],{'as':'Attachments','foreignKey':_0xba75('0x174'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x6d')][_0xba75('0x14b')](db[_0xba75('0x74')],{'onDelete':'cascade','as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x6d')][_0xba75('0x14b')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xba75('0x173')});db[_0xba75('0x6e')]['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x30'),'hooks':!![]});db['ChatQueue'][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':'team_has_chat_queues','as':'Teams'});db[_0xba75('0x70')][_0xba75('0x110')](db[_0xba75('0xcd')],{'as':'Messages','foreignKey':_0xba75('0x194'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x70')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x146'),'through':_0xba75('0x195')});db[_0xba75('0x18d')]['belongsTo'](db[_0xba75('0x66')],{'as':'Website','foreignKey':_0xba75('0x173')});db['CmCompany'][_0xba75('0x110')](db[_0xba75('0x74')],{'as':_0xba75('0x120'),'foreignKey':_0xba75('0x196')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x76')],{'as':_0xba75('0x148'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')][_0xba75('0x110')](db[_0xba75('0x79')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xba75('0x74')][_0xba75('0x110')](db['CmHopperHistory'],{'as':_0xba75('0x149'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x115')],{'as':_0xba75('0x115'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x197')],{'as':_0xba75('0x14a'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0x74')][_0xba75('0x110')](db[_0xba75('0x63')],{'as':'OpenchannelInteractions','foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x6a')],{'as':_0xba75('0x125'),'foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db[_0xba75('0x74')]['hasMany'](db[_0xba75('0x5a')],{'as':_0xba75('0x117'),'foreignKey':'ContactId','onDelete':_0xba75('0x175')});db[_0xba75('0x74')][_0xba75('0x110')](db[_0xba75('0x118')],{'as':'FaxInteractions','foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db['CmContact'][_0xba75('0x110')](db['MailInteraction'],{'as':_0xba75('0x11a'),'foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x175')});db[_0xba75('0x74')][_0xba75('0x14b')](db[_0xba75('0x72')],{'as':_0xba75('0x198'),'foreignKey':_0xba75('0x196')});db[_0xba75('0x74')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':'ListId','onDelete':_0xba75('0x10e')});db[_0xba75('0x74')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x199')});db[_0xba75('0x74')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'as':'Tags','through':_0xba75('0x19a')});db[_0xba75('0x74')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x19a'),'as':_0xba75('0x16e')});db[_0xba75('0x76')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':'Contact','foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x76')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x76')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0xba75('0x10f')});db['CmHopper'][_0xba75('0x14b')](db[_0xba75('0x1a')],{'as':_0xba75('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0xba75('0x10e')});db['CmHopper'][_0xba75('0x14b')](db[_0xba75('0xe2')],{'as':_0xba75('0xe2'),'foreignKey':'CampaignId','onDelete':_0xba75('0x10e')});db[_0xba75('0x76')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x16a'),'foreignKey':'OwnerId'});db[_0xba75('0x78')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c'),'onDelete':_0xba75('0x10e')});db['CmHopperBlack'][_0xba75('0x14b')](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178'),'onDelete':'cascade'});db[_0xba75('0x78')][_0xba75('0x14b')](db[_0xba75('0x1a')],{'as':_0xba75('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0xba75('0x10e')});db[_0xba75('0x78')]['belongsTo'](db['Campaign'],{'as':_0xba75('0xe2'),'foreignKey':'CampaignId','onDelete':_0xba75('0x10e')});db['Automation'][_0xba75('0x110')](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x19c'),'singular':_0xba75('0x19d')},'foreignKey':_0xba75('0x19e'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x80')]['hasMany'](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x19f'),'singular':_0xba75('0x1a0')},'foreignKey':'AutomationAnyId','onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x80')]['hasMany'](db[_0xba75('0x1a1')],{'as':_0xba75('0x1a2'),'foreignKey':_0xba75('0x1a3'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x84')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'ParentId','onDelete':'cascade'});db['Interval'][_0xba75('0x110')](db[_0xba75('0x87')],{'as':'Intervals','foreignKey':_0xba75('0x14f'),'onDelete':_0xba75('0x10e'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xba75('0x18')],{'as':'Extensions','foreignKey':_0xba75('0x14f'),'onDelete':_0xba75('0x175')});db[_0xba75('0x87')][_0xba75('0x110')](db[_0xba75('0x164')],{'as':_0xba75('0x1a4'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x87')][_0xba75('0x110')](db[_0xba75('0x68')],{'as':_0xba75('0x1a5'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x87')][_0xba75('0x110')](db['FaxApplication'],{'as':_0xba75('0x1a6'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0x87')][_0xba75('0x110')](db[_0xba75('0x58')],{'as':'SmsApplications','foreignKey':_0xba75('0x14f')});db[_0xba75('0x8e')][_0xba75('0x14b')](db[_0xba75('0x15d')],{});db[_0xba75('0x8e')][_0xba75('0x14b')](db[_0xba75('0x1a7')],{'foreignKey':'DefaultReportId'});db[_0xba75('0x8e')]['belongsTo'](db[_0xba75('0x99')],{'foreignKey':'CustomReportId'});db[_0xba75('0x143')]['belongsToMany'](db[_0xba75('0x19')],{'as':_0xba75('0x1a8'),'through':_0xba75('0x145'),'onDelete':_0xba75('0x175')});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0x74')],{'through':_0xba75('0x19a')});db[_0xba75('0x16b')]['belongsToMany'](db['ChatInteraction'],{'through':_0xba75('0x1a9')});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0x123')],{'through':_0xba75('0x16c')});db['Tag'][_0xba75('0x11e')](db[_0xba75('0x5a')],{'through':_0xba75('0x183')});db['Tag']['belongsToMany'](db[_0xba75('0x118')],{'through':_0xba75('0x180')});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0x63')],{'through':'openchannel_interaction_has_tags'});db[_0xba75('0x16b')][_0xba75('0x11e')](db[_0xba75('0xfe')],{'through':_0xba75('0x1aa')});db['Trigger']['hasMany'](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x1ab'),'singular':_0xba75('0x1ac')},'foreignKey':_0xba75('0x1ad'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x92')][_0xba75('0x110')](db[_0xba75('0x19b')],{'as':{'plural':_0xba75('0x1ae'),'singular':'AnyCondition'},'foreignKey':_0xba75('0x1af'),'onDelete':_0xba75('0x10e'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xba75('0x10e'),'hooks':!![]});db[_0xba75('0x99')][_0xba75('0x110')](db[_0xba75('0x9c')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xba75('0x1b0'),'hooks':!![]});db[_0xba75('0x1a7')][_0xba75('0x110')](db[_0xba75('0x9c')],{'as':_0xba75('0x1b1'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b2')});db[_0xba75('0x1b3')][_0xba75('0x110')](db['AnalyticFieldReport'],{'as':_0xba75('0x1b1'),'onDelete':'cascade','foreignKey':_0xba75('0x1b4')});db[_0xba75('0x9c')]['belongsTo'](db[_0xba75('0x1b3')],{'foreignKey':_0xba75('0x1b4')});db[_0xba75('0xa0')][_0xba75('0x110')](db[_0xba75('0xa2')],{'as':'Configurations','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xa2')][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db['SalesforceConfiguration']['hasMany'](db[_0xba75('0xa3')],{'as':_0xba75('0x1b8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1b1'),'onDelete':'cascade','foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa2')]['belongsTo'](db[_0xba75('0xa0')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db['SalesforceField'][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xa3')][_0xba75('0x110')](db['SalesforceField'],{'as':_0xba75('0x1bb'),'foreignKey':'DescriptionId'});db[_0xba75('0xa3')][_0xba75('0x110')](db[_0xba75('0xa3')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa3')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':'VariableId'});db[_0xba75('0x1bd')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xa5')]['hasMany'](db[_0xba75('0xa7')],{'as':_0xba75('0x1b6'),'onDelete':'cascade','foreignKey':_0xba75('0x1b7')});db[_0xba75('0xa5')][_0xba75('0x110')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xa5')][_0xba75('0x110')](db[_0xba75('0xa7')],{'as':'Fields','onDelete':_0xba75('0x10e'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xba75('0x14b')](db[_0xba75('0x1bd')],{'as':'Account','foreignKey':_0xba75('0x1b5')});db[_0xba75('0xa7')]['hasMany'](db['SugarcrmField'],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db['SugarcrmField'][_0xba75('0x110')](db[_0xba75('0xa7')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xa7')][_0xba75('0x110')](db[_0xba75('0xa7')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa7')][_0xba75('0x14b')](db['Variable'],{'as':'Variable','foreignKey':_0xba75('0x1c0')});db[_0xba75('0x1c1')]['hasMany'](db[_0xba75('0x1c2')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':'AccountId'});db[_0xba75('0x1c2')]['hasMany'](db[_0xba75('0xa9')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0x1c2')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1b8'),'onDelete':'cascade','foreignKey':_0xba75('0x1bf')});db[_0xba75('0x1c2')]['hasMany'](db[_0xba75('0xa9')],{'as':'Fields','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b9')});db['DeskConfiguration'][_0xba75('0x14b')](db['DeskAccount'],{'as':_0xba75('0x169'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x1c3')});db[_0xba75('0xa9')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xa9')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xa9')][_0xba75('0x110')](db[_0xba75('0xa9')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xa9')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0xba75('0x1c4')]['hasMany'](db[_0xba75('0x1c5')],{'as':_0xba75('0x1be'),'onDelete':'cascade','foreignKey':_0xba75('0x1b5')});db[_0xba75('0x1c5')][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db['ZohoConfiguration']['hasMany'](db[_0xba75('0xab')],{'as':_0xba75('0x1b8'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1bf')});db['ZohoConfiguration'][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1b1'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1c5')]['belongsTo'](db[_0xba75('0x1c4')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xab')]['hasMany'](db[_0xba75('0xab')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xab')][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xab')][_0xba75('0x110')](db[_0xba75('0xab')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db['ZohoField'][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db[_0xba75('0xad')][_0xba75('0x110')](db[_0xba75('0x1c6')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':'AccountId'});db[_0xba75('0x1c6')][_0xba75('0x110')](db[_0xba75('0xaf')],{'as':_0xba75('0x1b6'),'foreignKey':'SubjectId'});db[_0xba75('0x1c6')][_0xba75('0x110')](db['ZendeskField'],{'as':_0xba75('0x1b8'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0x1c6')][_0xba75('0x110')](db['ZendeskField'],{'as':_0xba75('0x1b1'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1c6')][_0xba75('0x14b')](db[_0xba75('0xad')],{'as':'Account','foreignKey':_0xba75('0x1b5')});db[_0xba75('0x1c6')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':_0xba75('0x1c7')});db[_0xba75('0xaf')][_0xba75('0x110')](db[_0xba75('0xaf')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db['ZendeskField'][_0xba75('0x110')](db[_0xba75('0xaf')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xaf')]['hasMany'](db[_0xba75('0xaf')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db['ZendeskField'][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':'Variable','foreignKey':_0xba75('0x1c0')});db[_0xba75('0xb1')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xb3')]['hasMany'](db[_0xba75('0xb5')],{'as':_0xba75('0x1b6'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xb3')][_0xba75('0x110')](db['FreshdeskField'],{'as':_0xba75('0x1b8'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xb3')][_0xba75('0x110')](db[_0xba75('0xb5')],{'as':_0xba75('0x1b1'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xba75('0xb3')][_0xba75('0x14b')](db['FreshdeskAccount'],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xb3')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xba75('0xb5')]['hasMany'](db[_0xba75('0xb5')],{'as':'Subject','foreignKey':'SubjectId'});db['FreshdeskField'][_0xba75('0x110')](db[_0xba75('0xb5')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0xb5')][_0xba75('0x110')](db[_0xba75('0xb5')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db[_0xba75('0xb5')]['belongsTo'](db['Variable'],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db[_0xba75('0x1c8')][_0xba75('0x110')](db[_0xba75('0xb8')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xb8')][_0xba75('0x110')](db[_0xba75('0x1c9')],{'as':'Subjects','foreignKey':_0xba75('0x1b7')});db[_0xba75('0xb8')]['hasMany'](db[_0xba75('0x1c9')],{'as':_0xba75('0x1b8'),'foreignKey':_0xba75('0x1bf')});db['VtigerConfiguration']['hasMany'](db[_0xba75('0x1c9')],{'as':_0xba75('0x1b1'),'foreignKey':_0xba75('0x1b9')});db['VtigerConfiguration'][_0xba75('0x14b')](db['VtigerAccount'],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db['VtigerField']['hasMany'](db[_0xba75('0x1c9')],{'as':_0xba75('0x1ba'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db['VtigerField'][_0xba75('0x110')](db[_0xba75('0x1c9')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db[_0xba75('0x1c9')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db['ServicenowAccount'][_0xba75('0x110')](db[_0xba75('0x1ca')],{'as':'Configurations','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db['ServicenowConfiguration']['hasMany'](db[_0xba75('0xbd')],{'as':_0xba75('0x1b6'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0x1ca')][_0xba75('0x110')](db[_0xba75('0xbd')],{'as':_0xba75('0x1b8'),'foreignKey':_0xba75('0x1bf')});db['ServicenowConfiguration']['hasMany'](db[_0xba75('0xbd')],{'as':'Fields','foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1ca')][_0xba75('0x14b')](db[_0xba75('0xba')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db[_0xba75('0xbd')][_0xba75('0x110')](db[_0xba75('0xbd')],{'as':_0xba75('0x1ba'),'foreignKey':_0xba75('0x1b7')});db[_0xba75('0xbd')][_0xba75('0x110')](db['ServicenowField'],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db['ServicenowField'][_0xba75('0x110')](db[_0xba75('0xbd')],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0xbd')]['belongsTo'](db[_0xba75('0x94')],{'as':'Variable','foreignKey':_0xba75('0x1c0')});db['Dynamics365Account'][_0xba75('0x110')](db[_0xba75('0xc1')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':'AccountId'});db[_0xba75('0xc1')][_0xba75('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b7')});db['Dynamics365Configuration'][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':_0xba75('0x1b8'),'onDelete':'cascade','foreignKey':_0xba75('0x1bf')});db[_0xba75('0xc1')][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':'Fields','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b9')});db['Dynamics365Configuration'][_0xba75('0x14b')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xba75('0x1b5')});db['Dynamics365Field'][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':_0xba75('0x1ba'),'foreignKey':'SubjectId'});db[_0xba75('0xc3')]['hasMany'](db['Dynamics365Field'],{'as':_0xba75('0x1bb'),'foreignKey':'DescriptionId'});db[_0xba75('0xc3')][_0xba75('0x110')](db[_0xba75('0xc3')],{'as':_0xba75('0x1bc'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db[_0xba75('0xc4')][_0xba75('0x110')](db[_0xba75('0xc6')],{'as':_0xba75('0x1be'),'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1b5')});db['FreshsalesConfiguration'][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Subjects','foreignKey':_0xba75('0x1b7')});db[_0xba75('0xc6')][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Descriptions','foreignKey':_0xba75('0x1bf')});db[_0xba75('0xc6')][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Fields','foreignKey':_0xba75('0x1b9')});db[_0xba75('0xc6')][_0xba75('0x14b')](db[_0xba75('0xc4')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1b5')});db['FreshsalesField'][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':'Subject','foreignKey':_0xba75('0x1b7')});db['FreshsalesField'][_0xba75('0x110')](db[_0xba75('0x1cb')],{'as':_0xba75('0x1bb'),'foreignKey':_0xba75('0x1bf')});db[_0xba75('0x1cb')][_0xba75('0x110')](db['FreshsalesField'],{'as':_0xba75('0x1bc'),'foreignKey':_0xba75('0x1b9')});db[_0xba75('0x1cb')][_0xba75('0x14b')](db[_0xba75('0x94')],{'as':_0xba75('0x94'),'foreignKey':_0xba75('0x1c0')});db['ChatQueueReport'][_0xba75('0x14b')](db[_0xba75('0x66')],{});db[_0xba75('0xcb')]['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0xcb')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':'Contact','foreignKey':_0xba75('0x15c')});db[_0xba75('0xcb')]['belongsTo'](db[_0xba75('0x6a')],{});db[_0xba75('0xcb')][_0xba75('0x14b')](db[_0xba75('0x192')],{});db[_0xba75('0xcb')]['belongsTo'](db['User'],{});db[_0xba75('0xcb')][_0xba75('0x14b')](db[_0xba75('0x6e')],{});db['ChatInternalMessage'][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1cc')});db[_0xba75('0xcd')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1cd')});db[_0xba75('0x197')][_0xba75('0x110')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xba75('0x197')][_0xba75('0x110')](db[_0xba75('0xcf')],{'foreignKey':_0xba75('0x1ce'),'onDelete':'cascade'});db[_0xba75('0xd3')]['belongsTo'](db[_0xba75('0x56')],{});db[_0xba75('0xd3')][_0xba75('0x14b')](db['CmList'],{'as':_0xba75('0x165'),'foreignKey':'ListId'});db[_0xba75('0xd3')][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db[_0xba75('0xd3')][_0xba75('0x14b')](db[_0xba75('0x5a')],{});db[_0xba75('0xd3')][_0xba75('0x14b')](db['SmsMessage'],{});db[_0xba75('0xd3')][_0xba75('0x14b')](db[_0xba75('0x13')],{});db['SmsQueueReport']['belongsTo'](db[_0xba75('0x5d')],{});db[_0xba75('0xd7')][_0xba75('0x110')](db['JscriptySessionReport'],{'foreignKey':_0xba75('0x1cf')});db[_0xba75('0xd7')][_0xba75('0x110')](db[_0xba75('0x1d0')],{'foreignKey':_0xba75('0x1cf')});db[_0xba75('0xd7')][_0xba75('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0xba75('0x1cf')});db[_0xba75('0x1d1')]['belongsToMany'](db[_0xba75('0x13')],{'as':_0xba75('0x16f'),'through':_0xba75('0x13d')});db['Team'][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':_0xba75('0x122')});db[_0xba75('0xdf')]['belongsToMany'](db['VoiceQueue'],{'through':_0xba75('0x108'),'as':_0xba75('0x12b')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x41')],{'through':_0xba75('0x1d2'),'as':'MailQueues'});db[_0xba75('0xdf')][_0xba75('0x11e')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xba75('0x12f')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x17e')],{'through':'team_has_fax_queues','as':_0xba75('0x130')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x5d')],{'through':_0xba75('0x1d3'),'as':_0xba75('0x131')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x132')],{'through':_0xba75('0x18c'),'as':_0xba75('0x133')});db[_0xba75('0xdf')][_0xba75('0x11e')](db[_0xba75('0x104')],{'through':_0xba75('0x1d4'),'as':_0xba75('0x134')});db['Team']['belongsToMany'](db[_0xba75('0xf4')],{'through':_0xba75('0x10a'),'as':_0xba75('0x12c')});db[_0xba75('0xe2')][_0xba75('0x110')](db[_0xba75('0x76')],{'as':_0xba75('0x148'),'foreignKey':_0xba75('0x1d5')});db[_0xba75('0xe2')][_0xba75('0x110')](db[_0xba75('0x79')],{'as':'HopperFinals','foreignKey':_0xba75('0x1d5')});db[_0xba75('0xe2')][_0xba75('0x110')](db[_0xba75('0x7b')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xba75('0xe2')]['hasMany'](db[_0xba75('0x78')],{'as':'HopperBlacks','foreignKey':_0xba75('0x1d5')});db['Campaign']['belongsTo'](db[_0xba75('0x29')],{'as':_0xba75('0x29'),'foreignKey':_0xba75('0x14c')});db[_0xba75('0xe2')]['belongsTo'](db[_0xba75('0x29')],{'as':_0xba75('0x14d'),'foreignKey':'TrunkBackupId'});db[_0xba75('0xe2')][_0xba75('0x14b')](db[_0xba75('0x87')],{'as':_0xba75('0x87'),'foreignKey':_0xba75('0x14f')});db[_0xba75('0xe2')][_0xba75('0x14b')](db[_0xba75('0x1d1')],{'as':_0xba75('0x1d1'),'foreignKey':_0xba75('0x1d6')});db[_0xba75('0xe2')]['belongsToMany'](db[_0xba75('0xf2')],{'as':_0xba75('0x121'),'through':_0xba75('0x1d7')});db[_0xba75('0xe2')][_0xba75('0x11e')](db[_0xba75('0xf2')],{'as':'BlackLists','through':_0xba75('0x1d8')});db[_0xba75('0x170')]['belongsTo'](db[_0xba75('0x6d')],{'as':_0xba75('0x6d'),'foreignKey':_0xba75('0x174')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x46')],{});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x123')],{});db['MailTransferReport'][_0xba75('0x14b')](db[_0xba75('0x15d')],{'foreignKey':_0xba75('0x1d9'),'as':'FromAccount'});db[_0xba75('0xe9')][_0xba75('0x14b')](db['User'],{'foreignKey':_0xba75('0x1da'),'as':_0xba75('0x1db')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x41')],{'foreignKey':'ToMailQueueId','as':_0xba75('0x1de')});db[_0xba75('0xe9')][_0xba75('0x14b')](db[_0xba75('0x15d')],{'foreignKey':'ToMailAccountId','as':_0xba75('0x1df')});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x192')],{});db[_0xba75('0xea')]['belongsTo'](db[_0xba75('0x6a')],{});db['ChatTransferReport'][_0xba75('0x14b')](db[_0xba75('0x66')],{'foreignKey':_0xba75('0x1e0'),'as':'FromAccount'});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1da'),'as':'FromAgent'});db['ChatTransferReport'][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x6e')],{'foreignKey':'ToChatQueueId','as':_0xba75('0x1de')});db[_0xba75('0xea')][_0xba75('0x14b')](db[_0xba75('0x66')],{'foreignKey':_0xba75('0x1e1'),'as':'ToAccount'});db['FaxTransferReport'][_0xba75('0x14b')](db[_0xba75('0x52')],{});db[_0xba75('0xec')][_0xba75('0x14b')](db[_0xba75('0x118')],{});db[_0xba75('0xec')][_0xba75('0x14b')](db[_0xba75('0x4e')],{'foreignKey':_0xba75('0x1e2'),'as':_0xba75('0x1e3')});db[_0xba75('0xec')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':'FromUserId','as':_0xba75('0x1db')});db[_0xba75('0xec')][_0xba75('0x14b')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['FaxTransferReport'][_0xba75('0x14b')](db[_0xba75('0x17e')],{'foreignKey':_0xba75('0x1e4'),'as':_0xba75('0x1de')});db[_0xba75('0xec')][_0xba75('0x14b')](db['FaxAccount'],{'foreignKey':_0xba75('0x1e5'),'as':'ToAccount'});db[_0xba75('0xee')][_0xba75('0x14b')](db['OpenchannelMessage'],{});db[_0xba75('0xee')][_0xba75('0x14b')](db['OpenchannelInteraction'],{});db[_0xba75('0xee')]['belongsTo'](db[_0xba75('0x5f')],{'foreignKey':_0xba75('0x1e6'),'as':_0xba75('0x1e3')});db['OpenchannelTransferReport'][_0xba75('0x14b')](db['User'],{'foreignKey':_0xba75('0x1da'),'as':_0xba75('0x1db')});db[_0xba75('0xee')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db['OpenchannelTransferReport'][_0xba75('0x14b')](db[_0xba75('0x132')],{'foreignKey':_0xba75('0x1e7'),'as':_0xba75('0x1de')});db[_0xba75('0xee')][_0xba75('0x14b')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport'][_0xba75('0x14b')](db['SmsMessage'],{});db[_0xba75('0xf0')][_0xba75('0x14b')](db[_0xba75('0x5a')],{});db['SmsTransferReport'][_0xba75('0x14b')](db[_0xba75('0x56')],{'foreignKey':_0xba75('0x1e8'),'as':_0xba75('0x1e3')});db[_0xba75('0xf0')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1da'),'as':_0xba75('0x1db')});db[_0xba75('0xf0')][_0xba75('0x14b')](db['User'],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db[_0xba75('0xf0')][_0xba75('0x14b')](db['SmsQueue'],{'foreignKey':_0xba75('0x1e9'),'as':_0xba75('0x1de')});db[_0xba75('0xf0')][_0xba75('0x14b')](db[_0xba75('0x56')],{'foreignKey':'ToSmsAccountId','as':_0xba75('0x1df')});db[_0xba75('0xf2')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':_0xba75('0x161'),'foreignKey':'ListId','onDelete':_0xba75('0x10e')});db[_0xba75('0xf2')][_0xba75('0x110')](db['CmCustomField'],{'as':_0xba75('0x1ea'),'foreignKey':'ListId'});db['CmList'][_0xba75('0x110')](db[_0xba75('0x74')],{'as':'Contacts','onDelete':_0xba75('0x10e'),'foreignKey':'ListId'});db[_0xba75('0xf2')][_0xba75('0x110')](db[_0xba75('0x79')],{'as':_0xba75('0x113'),'foreignKey':'ListId'});db['CmList'][_0xba75('0x110')](db[_0xba75('0x7b')],{'as':'HopperHistory','foreignKey':_0xba75('0x178')});db[_0xba75('0xf2')][_0xba75('0x110')](db[_0xba75('0x115')],{'as':_0xba75('0x115'),'foreignKey':'ListId'});db[_0xba75('0xf2')]['belongsToMany'](db[_0xba75('0x1a')],{'as':_0xba75('0x1eb'),'through':_0xba75('0x151')});db[_0xba75('0xf2')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x1ec')});db[_0xba75('0xf4')][_0xba75('0x110')](db[_0xba75('0x18')],{'as':'Extensions','onDelete':_0xba75('0x10e')});db[_0xba75('0xf4')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Agents','through':'UserVoicePrefix'});db[_0xba75('0xf4')][_0xba75('0x11e')](db[_0xba75('0xdf')],{'through':_0xba75('0x10a'),'as':'Teams'});db[_0xba75('0x11d')]['hasMany'](db['User'],{'as':_0xba75('0x16f'),'foreignKey':_0xba75('0x1ed')});db[_0xba75('0x11d')][_0xba75('0x110')](db[_0xba75('0xf6')],{'as':_0xba75('0x1ee'),'foreignKey':_0xba75('0x1ed'),'onDelete':_0xba75('0x10e')});db[_0xba75('0xf6')][_0xba75('0x110')](db[_0xba75('0x1ef')],{'as':_0xba75('0x1f0'),'foreignKey':'sectionId','onDelete':_0xba75('0x10e')});db[_0xba75('0x13a')][_0xba75('0x110')](db[_0xba75('0x84')],{'as':'Dispositions','foreignKey':_0xba75('0x1f1'),'onDelete':_0xba75('0x10e')});db[_0xba75('0x13a')]['hasMany'](db[_0xba75('0x82')],{'as':'Answers','foreignKey':_0xba75('0x1f1')});db['WhatsappAccount'][_0xba75('0x110')](db[_0xba75('0xff')],{'as':_0xba75('0x154'),'foreignKey':_0xba75('0x1f1')});db[_0xba75('0x13a')][_0xba75('0x110')](db['WhatsappInteraction'],{'as':_0xba75('0x163')});db[_0xba75('0x13a')][_0xba75('0x110')](db['WhatsappApplication'],{'as':'Applications'});db[_0xba75('0x13a')]['belongsTo'](db['CmList'],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x13a')][_0xba75('0x14b')](db[_0xba75('0x89')],{'as':_0xba75('0x150'),'foreignKey':_0xba75('0x166')});db[_0xba75('0x13a')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':_0xba75('0x17c'),'through':_0xba75('0x13c')});db[_0xba75('0xfc')][_0xba75('0x14b')](db[_0xba75('0x13')],{'onDelete':_0xba75('0x175')});db[_0xba75('0xfc')][_0xba75('0x14b')](db['WhatsappQueue'],{'onDelete':_0xba75('0x175')});db['WhatsappApplication'][_0xba75('0x14b')](db[_0xba75('0x13a')],{'onDelete':_0xba75('0x175')});db[_0xba75('0xfc')][_0xba75('0x14b')](db['Interval'],{'onDelete':_0xba75('0x175'),'foreignKey':'IntervalId'});db[_0xba75('0xfc')][_0xba75('0x14b')](db[_0xba75('0x16b')],{'onDelete':_0xba75('0x175'),'foreignKey':_0xba75('0x176')});db['WhatsappInteraction'][_0xba75('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xba75('0x10e'),'foreignKey':_0xba75('0x1f2')});db[_0xba75('0xfe')][_0xba75('0x14b')](db[_0xba75('0x13a')],{'as':'Account','foreignKey':_0xba75('0x1f1')});db['WhatsappInteraction'][_0xba75('0x14b')](db[_0xba75('0x74')],{'as':_0xba75('0x15b'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0xba75('0x14b')](db['User'],{'as':'Owner','foreignKey':_0xba75('0x10f')});db[_0xba75('0xfe')][_0xba75('0x11e')](db[_0xba75('0x16b')],{'through':'whatsapp_interaction_has_tags','as':_0xba75('0x16d')});db[_0xba75('0xfe')][_0xba75('0x11e')](db['Tag'],{'through':_0xba75('0x1aa'),'as':_0xba75('0x16e')});db[_0xba75('0xfe')][_0xba75('0x11e')](db[_0xba75('0x13')],{'as':'Users','through':_0xba75('0x12a'),'foreignKey':_0xba75('0x1f2')});db[_0xba75('0xff')][_0xba75('0x14b')](db[_0xba75('0x13')],{'as':_0xba75('0x13')});db['WhatsappMessage']['belongsTo'](db[_0xba75('0x74')],{'onDelete':_0xba75('0x10e'),'as':_0xba75('0x15b')});db[_0xba75('0xff')][_0xba75('0x14b')](db[_0xba75('0xfe')],{'onDelete':'cascade','as':_0xba75('0x172'),'foreignKey':_0xba75('0x1f2')});db[_0xba75('0xff')][_0xba75('0x14b')](db[_0xba75('0x13a')],{'as':_0xba75('0x169'),'foreignKey':_0xba75('0x1f1')});db[_0xba75('0x101')][_0xba75('0x14b')](db[_0xba75('0x13a')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xba75('0xf2')],{'as':_0xba75('0x165'),'foreignKey':_0xba75('0x178')});db[_0xba75('0x101')][_0xba75('0x14b')](db['CmContact'],{'as':_0xba75('0x15b'),'foreignKey':_0xba75('0x15c')});db['WhatsappQueueReport'][_0xba75('0x14b')](db[_0xba75('0xfe')],{});db[_0xba75('0x101')][_0xba75('0x14b')](db[_0xba75('0x104')],{});db[_0xba75('0x101')]['belongsTo'](db[_0xba75('0xff')],{});db['WhatsappQueueReport'][_0xba75('0x14b')](db[_0xba75('0x13')],{});db[_0xba75('0x102')][_0xba75('0x14b')](db[_0xba75('0xff')],{});db[_0xba75('0x102')]['belongsTo'](db[_0xba75('0xfe')],{});db[_0xba75('0x102')][_0xba75('0x14b')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db['WhatsappTransferReport'][_0xba75('0x14b')](db['WhatsappAccount'],{'foreignKey':_0xba75('0x1f3'),'as':_0xba75('0x1df')});db[_0xba75('0x102')][_0xba75('0x14b')](db[_0xba75('0x104')],{'foreignKey':'ToQueueId','as':_0xba75('0x1de')});db['WhatsappTransferReport'][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xba75('0x102')][_0xba75('0x14b')](db[_0xba75('0x13')],{'foreignKey':_0xba75('0x1dc'),'as':_0xba75('0x1dd')});db['WhatsappQueue']['belongsToMany'](db[_0xba75('0x13')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xba75('0x104')][_0xba75('0x11e')](db['Team'],{'through':_0xba75('0x1d4'),'as':_0xba75('0x167')});module[_0xba75('0x1f4')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe605=['Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','Dashboard','Items','FaxAccountId','Exntensions','FaxQueue','FaxInteractionId','Contact','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','OpenchannelQueueReport','ChatApplication','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','Website','CompanyId','Hoppers','HopperHistories','JscriptySessions','MailInteractions','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','VariableId','SugarcrmField','Field','DeskField','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Configuration','ChatQueueReport','JscriptyAnswerReport','SmsQueueReport','ProjectId','SquareProject','user_has_teams','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','TrunkBackupId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromUserId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','utf8','database','password','options','sequelizeHistory','username','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','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','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../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','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','cascade','UserId','hasMany','VoiceRecording','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','OpenchannelInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_mail_accounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','VoiceChanSpy','SpiedAgents','Applications','moh_has_sounds','Members','CmHopper','VoiceQueueId','HopperBlacks','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','VoiceAgentReport','CmContact','MailServerOut','MailAccountId','hasOne','Imap','Dispositions','Answers'];(function(_0x4187fb,_0x3da1b2){var _0x2a5c14=function(_0x4de547){while(--_0x4de547){_0x4187fb['push'](_0x4187fb['shift']());}};_0x2a5c14(++_0x3da1b2);}(_0xe605,0x92));var _0x5e60=function(_0x105cea,_0x105197){_0x105cea=_0x105cea-0x0;var _0x43fb18=_0xe605[_0x105cea];return _0x43fb18;};'use strict';var config=require(_0x5e60('0x0'));var Sequelize=require(_0x5e60('0x1'));var _=require('lodash');var jstz=require(_0x5e60('0x2'));var timezone=jstz[_0x5e60('0x3')]();config[_0x5e60('0x1')]=_[_0x5e60('0x4')](config[_0x5e60('0x1')],{'database':_0x5e60('0x5'),'username':_0x5e60('0x6'),'password':_0x5e60('0x7'),'options':{'host':_0x5e60('0x8'),'port':0xcea,'dialect':_0x5e60('0x9'),'dialectOptions':{'charset':_0x5e60('0xa')},'logging':![],'timezone':timezone[_0x5e60('0xb')](),'define':{'charset':'utf8','collate':_0x5e60('0xc')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x5e60('0x5'),'username':_0x5e60('0x6'),'password':_0x5e60('0x7'),'options':{'host':_0x5e60('0x8'),'port':0xcea,'dialect':_0x5e60('0x9'),'dialectOptions':{'charset':_0x5e60('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x5e60('0xd'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5e60('0x1')][_0x5e60('0xe')],config[_0x5e60('0x1')]['username'],config[_0x5e60('0x1')][_0x5e60('0xf')],config[_0x5e60('0x1')][_0x5e60('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5e60('0x11')][_0x5e60('0xe')],config['sequelizeHistory'][_0x5e60('0x12')],config[_0x5e60('0x11')][_0x5e60('0xf')],config[_0x5e60('0x11')]['options'])};db[_0x5e60('0x13')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x15'));db['VoiceChanSpy']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x16'));db[_0x5e60('0x17')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x18'));db['VoiceExtension']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x19'));db[_0x5e60('0x1a')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x1b'));db[_0x5e60('0x1c')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x1d'));db['VoiceRecording']=db[_0x5e60('0x1')]['import'](_0x5e60('0x1e'));db[_0x5e60('0x1f')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x20'));db[_0x5e60('0x21')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x22'));db[_0x5e60('0x23')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x24'));db[_0x5e60('0x25')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x5e60('0x26')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x27'));db['VoiceAgentReport']=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x5e60('0x28')]=db[_0x5e60('0x1')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x29'));db[_0x5e60('0x2a')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x2b'));db[_0x5e60('0x2c')]=db['sequelize'][_0x5e60('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x2d'));db[_0x5e60('0x2e')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x2f'));db[_0x5e60('0x30')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x5e60('0x31')]=db['sequelize']['import'](_0x5e60('0x32'));db[_0x5e60('0x33')]=db['sequelize'][_0x5e60('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x5e60('0x34')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x35'));db[_0x5e60('0x36')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x37'));db['UserWhatsappQueue']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x38'));db[_0x5e60('0x39')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x3a'));db['MailServerOut']=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x3b'));db[_0x5e60('0x3c')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x3d'));db[_0x5e60('0x3e')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x3f'));db[_0x5e60('0x40')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x41'));db[_0x5e60('0x42')]=db['sequelize']['import']('../api/mailMessage/mailMessage.model');db[_0x5e60('0x43')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x44'));db['MailQueueReport']=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x45'));db[_0x5e60('0x46')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x47'));db[_0x5e60('0x48')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x49'));db[_0x5e60('0x4a')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x4b'));db[_0x5e60('0x4c')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x5e60('0x4d')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x4e'));db['FaxQueue']=db['sequelize']['import'](_0x5e60('0x4f'));db[_0x5e60('0x50')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x51'));db[_0x5e60('0x52')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x53'));db[_0x5e60('0x54')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x55'));db[_0x5e60('0x56')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x57'));db[_0x5e60('0x58')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x59'));db[_0x5e60('0x5a')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x5b'));db[_0x5e60('0x5c')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x5d'));db[_0x5e60('0x5e')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x5f'));db['OpenchannelInteraction']=db['sequelize'][_0x5e60('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x5e60('0x60')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x61'));db[_0x5e60('0x62')]=db[_0x5e60('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x5e60('0x63')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x64'));db['ChatApplication']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x65'));db[_0x5e60('0x66')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x5e60('0x67')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x68'));db[_0x5e60('0x69')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x6a'));db[_0x5e60('0x6b')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x6c'));db[_0x5e60('0x6d')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x6e'));db[_0x5e60('0x6f')]=db['sequelize'][_0x5e60('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x5e60('0x70')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x71'));db['CmContact']=db[_0x5e60('0x1')]['import'](_0x5e60('0x72'));db['CmHopper']=db[_0x5e60('0x1')]['import'](_0x5e60('0x73'));db[_0x5e60('0x74')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x75'));db[_0x5e60('0x76')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x77'));db[_0x5e60('0x78')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x79'));db[_0x5e60('0x7a')]=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x5e60('0x7b')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x7c'));db[_0x5e60('0x7d')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x7e'));db[_0x5e60('0x7f')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x80'));db[_0x5e60('0x81')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x82'));db[_0x5e60('0x83')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x84'));db[_0x5e60('0x85')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/condition/condition.model');db[_0x5e60('0x86')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/interval/interval.model');db[_0x5e60('0x87')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x88'));db[_0x5e60('0x89')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x8a'));db[_0x5e60('0x8b')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x8c'));db[_0x5e60('0x8d')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/schedule/schedule.model');db[_0x5e60('0x8e')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/sound/sound.model');db[_0x5e60('0x8f')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x90'));db[_0x5e60('0x91')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x92'));db[_0x5e60('0x93')]=db['sequelize']['import'](_0x5e60('0x94'));db[_0x5e60('0x95')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x96'));db[_0x5e60('0x97')]=db[_0x5e60('0x1')]['import'](_0x5e60('0x98'));db[_0x5e60('0x99')]=db[_0x5e60('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0x5e60('0x9a')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x9b'));db[_0x5e60('0x9c')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x5e60('0x9d')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x9e'));db[_0x5e60('0x9f')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xa0'));db[_0x5e60('0xa1')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xa2'));db['SalesforceAccount']=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x5e60('0xa3')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xa4'));db[_0x5e60('0xa5')]=db[_0x5e60('0x1')]['import'](_0x5e60('0xa6'));db[_0x5e60('0xa7')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xa8'));db[_0x5e60('0xa9')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xaa'));db['SugarcrmField']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xab'));db[_0x5e60('0xac')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xad'));db[_0x5e60('0xae')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xaf'));db[_0x5e60('0xb0')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xb1'));db[_0x5e60('0xb2')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x5e60('0xb3')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/intZohoField/intZohoField.model');db[_0x5e60('0xb4')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x5e60('0xb5')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xb6'));db[_0x5e60('0xb7')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xb8'));db[_0x5e60('0xb9')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xba'));db[_0x5e60('0xbb')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xbc'));db[_0x5e60('0xbd')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xbe'));db[_0x5e60('0xbf')]=db[_0x5e60('0x1')]['import'](_0x5e60('0xc0'));db[_0x5e60('0xc1')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xc2'));db[_0x5e60('0xc3')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xc4'));db[_0x5e60('0xc5')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xc6'));db[_0x5e60('0xc7')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xc8'));db[_0x5e60('0xc9')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x5e60('0xca')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xcb'));db[_0x5e60('0xcc')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xcd'));db[_0x5e60('0xce')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xcf'));db[_0x5e60('0xd0')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xd1'));db[_0x5e60('0xd2')]=db[_0x5e60('0x1')]['import'](_0x5e60('0xd3'));db[_0x5e60('0x97')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/integration/integration.model');db[_0x5e60('0xd4')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/network/network.model');db['ChatQueueReport']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xd5'));db[_0x5e60('0xd6')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xd7'));db['JscriptyAnswerReport']=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xd8'));db[_0x5e60('0xd9')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x5e60('0xda')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xdb'));db['SmsQueueReport']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xdc'));db[_0x5e60('0xdd')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/squareReport/squareReport.model');db[_0x5e60('0xde')]=db['sequelize'][_0x5e60('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x5e60('0xdf')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xe0'));db[_0x5e60('0xe1')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xe2'));db[_0x5e60('0xe3')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xe4'));db['SquareProject']=db[_0x5e60('0x1')]['import'](_0x5e60('0xe5'));db[_0x5e60('0xe6')]=db['sequelize']['import'](_0x5e60('0xe7'));db[_0x5e60('0xe8')]=db[_0x5e60('0x1')]['import'](_0x5e60('0xe9'));db[_0x5e60('0xea')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xeb'));db[_0x5e60('0xec')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xed'));db[_0x5e60('0xee')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xef'));db[_0x5e60('0xf0')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xf1'));db[_0x5e60('0xf2')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xf3'));db['Plugin']=db[_0x5e60('0x1')]['import']('../api/plugin/plugin.model');db[_0x5e60('0xf4')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xf5'));db[_0x5e60('0xf6')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xf7'));db[_0x5e60('0xf8')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x5e60('0xf9')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x5e60('0xfa')]=db['sequelize']['import'](_0x5e60('0xfb'));db[_0x5e60('0xfc')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0xfd'));db[_0x5e60('0xfe')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0xff'));db[_0x5e60('0x100')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/userProfile/userProfile.model');db[_0x5e60('0x101')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x5e60('0x102')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x103'));db[_0x5e60('0x104')]=db['sequelize'][_0x5e60('0x14')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x5e60('0x105')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x106'));db[_0x5e60('0x107')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x5e60('0x108')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x109'));db[_0x5e60('0x10a')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x5e60('0x10b')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x10c'));db[_0x5e60('0x10d')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x10e'));db[_0x5e60('0x10f')]=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x110'));db[_0x5e60('0x111')]=db[_0x5e60('0x1')][_0x5e60('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x5e60('0x1')][_0x5e60('0x14')](_0x5e60('0x112'));db[_0x5e60('0x113')]=db['sequelize'][_0x5e60('0x14')](_0x5e60('0x114'));db['User']['hasOne'](db[_0x5e60('0x21')],{'as':_0x5e60('0x21'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x13')][_0x5e60('0x117')](db[_0x5e60('0x118')],{'as':'Recordings','foreignKey':_0x5e60('0x116')});db['User'][_0x5e60('0x117')](db[_0x5e60('0x119')],{'as':_0x5e60('0x11a'),'foreignKey':'UserId'});db[_0x5e60('0x13')]['hasMany'](db[_0x5e60('0x11b')],{'as':_0x5e60('0x11c'),'onDelete':_0x5e60('0x115'),'hooks':!![]});db[_0x5e60('0x13')][_0x5e60('0x117')](db['CmHopperFinal'],{'as':_0x5e60('0x11d'),'foreignKey':'UserId'});db[_0x5e60('0x13')][_0x5e60('0x117')](db[_0x5e60('0x78')],{'as':'HopperHistory','foreignKey':_0x5e60('0x116')});db[_0x5e60('0x13')][_0x5e60('0x117')](db[_0x5e60('0x7a')],{'as':_0x5e60('0x7a'),'foreignKey':_0x5e60('0x116')});db['User'][_0x5e60('0x117')](db[_0x5e60('0x11e')],{'as':'OpenchannelInteractions','foreignKey':_0x5e60('0x116')});db['User']['hasMany'](db[_0x5e60('0x66')],{'as':_0x5e60('0x11f'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x13')][_0x5e60('0x117')](db[_0x5e60('0x56')],{'as':_0x5e60('0x120'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x13')][_0x5e60('0x117')](db[_0x5e60('0x4c')],{'as':_0x5e60('0x121'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x13')][_0x5e60('0x117')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x5e60('0x116')});db['User'][_0x5e60('0x117')](db[_0x5e60('0x107')],{'as':_0x5e60('0x122'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x13')][_0x5e60('0x117')](db['UserNotification'],{'as':_0x5e60('0x123'),'foreignKey':_0x5e60('0x124')});db[_0x5e60('0x13')][_0x5e60('0x125')](db[_0x5e60('0x100')],{'as':_0x5e60('0x100'),'foreignKey':'userProfileId'});db['User'][_0x5e60('0x126')](db[_0x5e60('0x6d')],{'as':'Groups','through':_0x5e60('0x127')});db[_0x5e60('0x13')][_0x5e60('0x126')](db['CmContact'],{'as':_0x5e60('0x128'),'through':_0x5e60('0x129')});db[_0x5e60('0x13')][_0x5e60('0x126')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x12a'),'through':_0x5e60('0x12b')});db[_0x5e60('0x13')][_0x5e60('0x126')](db[_0x5e60('0xea')],{'through':'user_has_teams'});db[_0x5e60('0x13')][_0x5e60('0x126')](db[_0x5e60('0x40')],{'as':'MailInteractions','through':_0x5e60('0x12c')});db[_0x5e60('0x13')]['belongsToMany'](db[_0x5e60('0x66')],{'as':_0x5e60('0x11f'),'through':_0x5e60('0x12d')});db[_0x5e60('0x13')][_0x5e60('0x126')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x5e60('0x12e')});db[_0x5e60('0x13')][_0x5e60('0x126')](db['SmsInteraction'],{'as':_0x5e60('0x120'),'through':_0x5e60('0x12f')});db[_0x5e60('0x13')]['belongsToMany'](db[_0x5e60('0x11e')],{'as':_0x5e60('0x130'),'through':_0x5e60('0x131')});db[_0x5e60('0x13')][_0x5e60('0x126')](db[_0x5e60('0x107')],{'as':_0x5e60('0x122'),'through':_0x5e60('0x132')});db[_0x5e60('0x13')]['belongsToMany'](db[_0x5e60('0x1c')],{'as':_0x5e60('0x133'),'through':_0x5e60('0x2e'),'required':![]});db['User'][_0x5e60('0x126')](db['VoicePrefix'],{'as':_0x5e60('0x134'),'through':_0x5e60('0x113'),'required':![]});db['User'][_0x5e60('0x126')](db[_0x5e60('0x3c')],{'as':_0x5e60('0x135'),'through':_0x5e60('0x31'),'required':![]});db['User'][_0x5e60('0x126')](db['ChatQueue'],{'as':_0x5e60('0x136'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x5e60('0x126')](db['FaxQueue'],{'as':_0x5e60('0x137'),'through':_0x5e60('0x33'),'required':![]});db['User'][_0x5e60('0x126')](db[_0x5e60('0x5a')],{'as':_0x5e60('0x138'),'through':_0x5e60('0x34'),'required':![]});db[_0x5e60('0x13')][_0x5e60('0x126')](db['OpenchannelQueue'],{'as':_0x5e60('0x139'),'through':_0x5e60('0x36'),'required':![]});db[_0x5e60('0x13')][_0x5e60('0x126')](db[_0x5e60('0x10d')],{'as':_0x5e60('0x13a'),'through':_0x5e60('0x13b'),'required':![]});db[_0x5e60('0x13')][_0x5e60('0x126')](db[_0x5e60('0xfc')],{'through':'cm_user_has_lists'});db['User'][_0x5e60('0x126')](db[_0x5e60('0x63')],{'as':_0x5e60('0x13c'),'through':_0x5e60('0x13d')});db[_0x5e60('0x13')][_0x5e60('0x126')](db['FaxAccount'],{'as':_0x5e60('0x13e'),'through':_0x5e60('0x13f')});db['User'][_0x5e60('0x126')](db[_0x5e60('0x140')],{'as':'MailAccounts','through':_0x5e60('0x141')});db[_0x5e60('0x13')][_0x5e60('0x126')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x5e60('0x13')]['belongsToMany'](db['SmsAccount'],{'as':'SmsAccounts','through':_0x5e60('0x142')});db['User'][_0x5e60('0x126')](db[_0x5e60('0x143')],{'as':_0x5e60('0x144'),'through':'user_has_whatsapp_accounts'});db[_0x5e60('0x13')][_0x5e60('0x126')](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x5e60('0x145')][_0x5e60('0x117')](db['VoiceExtension'],{'as':_0x5e60('0x146'),'onDelete':_0x5e60('0x115'),'foreignKey':'ChanSpyId'});db[_0x5e60('0x17')][_0x5e60('0x117')](db[_0x5e60('0x11b')],{'onDelete':_0x5e60('0x115')});db['VoiceExtension'][_0x5e60('0x117')](db['VoiceExtension'],{'as':_0x5e60('0x147'),'onDelete':_0x5e60('0x115')});db['VoiceMusicOnHold'][_0x5e60('0x126')](db[_0x5e60('0x8e')],{'as':'Sounds','through':_0x5e60('0x148')});db[_0x5e60('0x1c')][_0x5e60('0x117')](db[_0x5e60('0x119')],{'as':_0x5e60('0x149'),'foreignKey':'VoiceQueueId'});db[_0x5e60('0x1c')]['hasMany'](db[_0x5e60('0x14a')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x5e60('0x1c')][_0x5e60('0x117')](db['CmHopperFinal'],{'as':_0x5e60('0x11d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x5e60('0x78')],{'as':'HopperHistories','foreignKey':_0x5e60('0x14b')});db[_0x5e60('0x1c')][_0x5e60('0x117')](db[_0x5e60('0x7a')],{'as':_0x5e60('0x7a'),'foreignKey':_0x5e60('0x14b')});db[_0x5e60('0x1c')][_0x5e60('0x117')](db[_0x5e60('0x74')],{'as':_0x5e60('0x14c'),'foreignKey':'VoiceQueueId'});db[_0x5e60('0x1c')]['hasMany'](db[_0x5e60('0xda')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x5e60('0x1c')][_0x5e60('0x125')](db['Trunk'],{'as':_0x5e60('0x2a'),'foreignKey':_0x5e60('0x14d')});db[_0x5e60('0x1c')]['belongsTo'](db[_0x5e60('0x2a')],{'as':_0x5e60('0x14e'),'foreignKey':'TrunkBackupId'});db[_0x5e60('0x1c')][_0x5e60('0x125')](db[_0x5e60('0x86')],{'as':_0x5e60('0x86'),'foreignKey':_0x5e60('0x14f')});db[_0x5e60('0x1c')][_0x5e60('0x125')](db['Pause'],{'as':_0x5e60('0x150'),'foreignKey':_0x5e60('0x151')});db[_0x5e60('0x1c')][_0x5e60('0x126')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x12a'),'through':_0x5e60('0x152')});db[_0x5e60('0x1c')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x2e')});db['VoiceQueue'][_0x5e60('0x126')](db[_0x5e60('0xea')],{'as':'Teams','through':_0x5e60('0x111')});db[_0x5e60('0x1c')][_0x5e60('0x126')](db['CmList'],{'as':'BlackLists','through':_0x5e60('0x154')});db[_0x5e60('0x118')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'as':_0x5e60('0x13'),'foreignKey':'UserId'});db[_0x5e60('0x1f')]['belongsTo'](db[_0x5e60('0x13')],{'as':_0x5e60('0x13'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x21')][_0x5e60('0x117')](db['VoiceMailMessage'],{'as':_0x5e60('0x155'),'onDelete':'cascade','foreignKey':_0x5e60('0x156'),'sourceKey':_0x5e60('0x157')});db['VoiceMailMessage']['belongsTo'](db[_0x5e60('0x21')],{'foreignKey':_0x5e60('0x156'),'targetKey':'mailbox'});db[_0x5e60('0x25')][_0x5e60('0x117')](db[_0x5e60('0x28')],{'as':'QueueCalls','foreignKey':_0x5e60('0x158'),'constraints':![]});db[_0x5e60('0x25')][_0x5e60('0x117')](db[_0x5e60('0x159')],{'as':'AgentReports','foreignKey':_0x5e60('0x158'),'constraints':![]});db[_0x5e60('0x25')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'as':_0x5e60('0x13'),'foreignKey':_0x5e60('0x116')});db['VoiceCallReport'][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5e60('0x39')][_0x5e60('0x125')](db[_0x5e60('0x140')],{'as':_0x5e60('0x140'),'foreignKey':'MailAccountId'});db[_0x5e60('0x15b')][_0x5e60('0x125')](db[_0x5e60('0x140')],{'as':'MailAccount','foreignKey':_0x5e60('0x15c')});db[_0x5e60('0x140')][_0x5e60('0x15d')](db['MailServerIn'],{'as':_0x5e60('0x15e'),'onDelete':_0x5e60('0x115')});db['MailAccount']['hasOne'](db[_0x5e60('0x15b')],{'as':'Smtp','onDelete':_0x5e60('0x115')});db[_0x5e60('0x140')][_0x5e60('0x117')](db[_0x5e60('0x83')],{'as':_0x5e60('0x15f'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount'][_0x5e60('0x117')](db[_0x5e60('0x81')],{'as':_0x5e60('0x160'),'foreignKey':_0x5e60('0x15c')});db[_0x5e60('0x140')][_0x5e60('0x117')](db[_0x5e60('0x42')],{'as':_0x5e60('0x155'),'foreignKey':_0x5e60('0x15c')});db[_0x5e60('0x140')][_0x5e60('0x117')](db[_0x5e60('0x40')],{'as':_0x5e60('0x161')});db[_0x5e60('0x140')][_0x5e60('0x117')](db[_0x5e60('0x43')],{'as':'Applications'});db[_0x5e60('0x140')][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163')});db[_0x5e60('0x140')]['belongsTo'](db[_0x5e60('0x91')],{'as':'Template','foreignKey':_0x5e60('0x164')});db[_0x5e60('0x140')][_0x5e60('0x125')](db[_0x5e60('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x5e60('0x151')});db[_0x5e60('0x140')]['belongsToMany'](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x141')});db[_0x5e60('0x3c')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x31')});db[_0x5e60('0x3c')][_0x5e60('0x126')](db[_0x5e60('0xea')],{'through':_0x5e60('0x165'),'as':_0x5e60('0x166')});db[_0x5e60('0x40')][_0x5e60('0x117')](db[_0x5e60('0x42')],{'as':_0x5e60('0x155'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x167')});db[_0x5e60('0x40')]['belongsTo'](db[_0x5e60('0x140')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x15c')});db[_0x5e60('0x40')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':'Contact','foreignKey':_0x5e60('0x169')});db[_0x5e60('0x40')]['belongsTo'](db[_0x5e60('0x13')],{'as':_0x5e60('0x16a'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x40')]['belongsToMany'](db[_0x5e60('0x8f')],{'through':_0x5e60('0x16b'),'as':_0x5e60('0x16c')});db[_0x5e60('0x40')][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'through':'mail_interaction_has_tags','as':_0x5e60('0x16d')});db[_0x5e60('0x40')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x16e'),'through':_0x5e60('0x12c'),'foreignKey':_0x5e60('0x167')});db[_0x5e60('0x42')][_0x5e60('0x117')](db[_0x5e60('0xf2')],{'as':'Attachments','onDelete':'cascade'});db[_0x5e60('0x42')][_0x5e60('0x125')](db['User'],{'as':_0x5e60('0x13')});db[_0x5e60('0x42')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'onDelete':'cascade','as':'Contact'});db['MailMessage'][_0x5e60('0x125')](db[_0x5e60('0x40')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x5e60('0x42')][_0x5e60('0x125')](db[_0x5e60('0x140')],{'as':_0x5e60('0x168'),'foreignKey':'MailAccountId'});db[_0x5e60('0x42')][_0x5e60('0x125')](db[_0x5e60('0x63')],{'as':'ChatWebsite','foreignKey':_0x5e60('0x16f')});db[_0x5e60('0x42')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x5e60('0x69'),'foreignKey':_0x5e60('0x170')});db[_0x5e60('0x43')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'onDelete':_0x5e60('0x171')});db['MailApplication'][_0x5e60('0x125')](db[_0x5e60('0x3c')],{'onDelete':'restrict'});db[_0x5e60('0x43')][_0x5e60('0x125')](db['MailAccount'],{'onDelete':_0x5e60('0x171')});db['MailApplication'][_0x5e60('0x125')](db[_0x5e60('0x86')],{'onDelete':_0x5e60('0x171'),'foreignKey':'IntervalId'});db['MailApplication'][_0x5e60('0x125')](db[_0x5e60('0x8f')],{'onDelete':'restrict','foreignKey':_0x5e60('0x172')});db[_0x5e60('0x173')][_0x5e60('0x125')](db[_0x5e60('0x140')],{});db[_0x5e60('0x173')]['belongsTo'](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163')});db[_0x5e60('0x173')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':'Contact','foreignKey':_0x5e60('0x169')});db[_0x5e60('0x173')][_0x5e60('0x125')](db[_0x5e60('0x40')],{});db['MailQueueReport']['belongsTo'](db[_0x5e60('0x42')],{});db[_0x5e60('0x173')][_0x5e60('0x125')](db[_0x5e60('0x13')],{});db['MailQueueReport']['belongsTo'](db[_0x5e60('0x3c')],{});db[_0x5e60('0x174')][_0x5e60('0x117')](db['DashboardItem'],{'as':_0x5e60('0x175'),'onDelete':'cascade'});db[_0x5e60('0x48')][_0x5e60('0x117')](db[_0x5e60('0x83')],{'as':_0x5e60('0x15f'),'foreignKey':_0x5e60('0x176'),'onDelete':_0x5e60('0x115')});db[_0x5e60('0x48')][_0x5e60('0x117')](db[_0x5e60('0x81')],{'as':_0x5e60('0x160'),'foreignKey':_0x5e60('0x176')});db[_0x5e60('0x48')][_0x5e60('0x117')](db[_0x5e60('0x4c')],{'as':_0x5e60('0x161')});db[_0x5e60('0x48')][_0x5e60('0x117')](db[_0x5e60('0x4a')],{'as':'Applications'});db['FaxAccount'][_0x5e60('0x117')](db[_0x5e60('0x11b')],{'as':_0x5e60('0x177'),'onDelete':'cascade'});db[_0x5e60('0x48')][_0x5e60('0x117')](db[_0x5e60('0x4d')],{'as':_0x5e60('0x155')});db[_0x5e60('0x48')][_0x5e60('0x125')](db[_0x5e60('0x2a')],{'as':_0x5e60('0x2a')});db['FaxAccount'][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':'List','foreignKey':_0x5e60('0x163')});db[_0x5e60('0x48')]['belongsTo'](db[_0x5e60('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x5e60('0x151')});db[_0x5e60('0x48')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x13f')});db[_0x5e60('0x4a')][_0x5e60('0x125')](db['User'],{'onDelete':'restrict'});db[_0x5e60('0x4a')][_0x5e60('0x125')](db[_0x5e60('0x178')],{'onDelete':_0x5e60('0x171')});db[_0x5e60('0x4a')][_0x5e60('0x125')](db[_0x5e60('0x48')],{'onDelete':_0x5e60('0x171')});db[_0x5e60('0x4a')][_0x5e60('0x125')](db[_0x5e60('0x8f')],{'onDelete':_0x5e60('0x171'),'foreignKey':'TagId'});db['FaxInteraction'][_0x5e60('0x117')](db[_0x5e60('0x4d')],{'as':_0x5e60('0x155'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x179')});db['FaxInteraction'][_0x5e60('0x125')](db['FaxAccount'],{'as':'Account','foreignKey':_0x5e60('0x176')});db[_0x5e60('0x4c')][_0x5e60('0x125')](db['CmContact'],{'as':_0x5e60('0x17a'),'foreignKey':_0x5e60('0x169')});db[_0x5e60('0x4c')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'as':'Owner','foreignKey':_0x5e60('0x116')});db[_0x5e60('0x4c')][_0x5e60('0x126')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x5e60('0x16c')});db['FaxInteraction']['belongsToMany'](db[_0x5e60('0x8f')],{'through':'fax_interaction_has_tags','as':_0x5e60('0x16d')});db[_0x5e60('0x4c')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x16e'),'through':_0x5e60('0x12e'),'foreignKey':_0x5e60('0x179')});db['FaxMessage'][_0x5e60('0x125')](db[_0x5e60('0x13')],{'onDelete':'cascade','as':'User'});db[_0x5e60('0x4d')][_0x5e60('0x125')](db[_0x5e60('0x4c')],{'as':_0x5e60('0x17b'),'foreignKey':_0x5e60('0x179')});db['FaxMessage'][_0x5e60('0x125')](db['CmContact'],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17a')});db['FaxMessage'][_0x5e60('0x125')](db[_0x5e60('0xf2')],{'as':'Attachment','foreignKey':_0x5e60('0x17c')});db[_0x5e60('0x4d')][_0x5e60('0x125')](db[_0x5e60('0x48')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x176')});db['FaxQueue']['belongsToMany'](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x33')});db['FaxQueue']['belongsToMany'](db['Team'],{'through':_0x5e60('0x17d'),'as':_0x5e60('0x166')});db[_0x5e60('0x50')][_0x5e60('0x125')](db[_0x5e60('0x48')],{});db[_0x5e60('0x50')][_0x5e60('0x125')](db['CmList'],{'as':'List','foreignKey':_0x5e60('0x163')});db[_0x5e60('0x50')]['belongsTo'](db['CmContact'],{'as':_0x5e60('0x17a'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x5e60('0x125')](db[_0x5e60('0x4c')],{});db[_0x5e60('0x50')][_0x5e60('0x125')](db[_0x5e60('0x4d')],{});db[_0x5e60('0x50')][_0x5e60('0x125')](db['User'],{});db[_0x5e60('0x50')][_0x5e60('0x125')](db['FaxQueue'],{});db[_0x5e60('0x52')][_0x5e60('0x117')](db[_0x5e60('0x83')],{'as':_0x5e60('0x15f'),'foreignKey':_0x5e60('0x17e'),'onDelete':_0x5e60('0x115')});db['SmsAccount'][_0x5e60('0x117')](db[_0x5e60('0x81')],{'as':_0x5e60('0x160'),'foreignKey':_0x5e60('0x17e')});db[_0x5e60('0x52')][_0x5e60('0x117')](db[_0x5e60('0x58')],{'as':_0x5e60('0x155'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0x5e60('0x161')});db[_0x5e60('0x52')]['hasMany'](db[_0x5e60('0x54')],{'as':_0x5e60('0x147')});db[_0x5e60('0x52')][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':'List','foreignKey':_0x5e60('0x163')});db[_0x5e60('0x52')][_0x5e60('0x125')](db[_0x5e60('0x87')],{'as':_0x5e60('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount']['belongsToMany'](db[_0x5e60('0x13')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x5e60('0x54')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'onDelete':_0x5e60('0x171')});db[_0x5e60('0x54')][_0x5e60('0x125')](db[_0x5e60('0x5a')],{'onDelete':'restrict'});db['SmsApplication'][_0x5e60('0x125')](db[_0x5e60('0x52')],{'onDelete':_0x5e60('0x171')});db[_0x5e60('0x54')][_0x5e60('0x125')](db[_0x5e60('0x86')],{'onDelete':_0x5e60('0x171'),'foreignKey':'IntervalId'});db[_0x5e60('0x54')][_0x5e60('0x125')](db[_0x5e60('0x8f')],{'onDelete':_0x5e60('0x171'),'foreignKey':_0x5e60('0x172')});db[_0x5e60('0x56')]['hasMany'](db[_0x5e60('0x58')],{'as':_0x5e60('0x155'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x17f')});db[_0x5e60('0x56')][_0x5e60('0x125')](db[_0x5e60('0x52')],{'as':'Account','foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':_0x5e60('0x17a'),'foreignKey':_0x5e60('0x169')});db[_0x5e60('0x56')]['belongsTo'](db['User'],{'as':_0x5e60('0x16a'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x56')][_0x5e60('0x126')](db['Tag'],{'through':_0x5e60('0x180'),'as':_0x5e60('0x16c')});db[_0x5e60('0x56')][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'through':_0x5e60('0x180'),'as':'ThroughTags'});db[_0x5e60('0x56')]['belongsToMany'](db[_0x5e60('0x13')],{'as':_0x5e60('0x16e'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x5e60('0x58')]['belongsTo'](db[_0x5e60('0x13')],{'as':_0x5e60('0x13')});db['SmsMessage'][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17a')});db[_0x5e60('0x58')]['belongsTo'](db['SmsInteraction'],{'onDelete':'cascade','as':_0x5e60('0x17b'),'foreignKey':'SmsInteractionId'});db[_0x5e60('0x58')][_0x5e60('0x125')](db['SmsAccount'],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x17e')});db[_0x5e60('0x5a')][_0x5e60('0x126')](db['User'],{'as':'Agents','through':_0x5e60('0x34'),'foreignKey':'SmsQueueId'});db[_0x5e60('0x5a')][_0x5e60('0x126')](db[_0x5e60('0xea')],{'through':_0x5e60('0x181'),'as':_0x5e60('0x166')});db[_0x5e60('0x5c')][_0x5e60('0x117')](db[_0x5e60('0x83')],{'as':_0x5e60('0x15f'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db['OpenchannelAccount'][_0x5e60('0x117')](db[_0x5e60('0x81')],{'as':_0x5e60('0x160'),'foreignKey':_0x5e60('0x182')});db[_0x5e60('0x5c')][_0x5e60('0x117')](db['OpenchannelInteraction'],{'as':_0x5e60('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0x5e60('0x5c')][_0x5e60('0x117')](db[_0x5e60('0x60')],{'as':_0x5e60('0x155'),'foreignKey':_0x5e60('0x182')});db['OpenchannelAccount']['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163')});db[_0x5e60('0x5c')][_0x5e60('0x125')](db[_0x5e60('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x5e60('0x5c')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x5e60('0x125')](db['User'],{'onDelete':_0x5e60('0x171')});db['OpenchannelApplication'][_0x5e60('0x125')](db[_0x5e60('0x62')],{'onDelete':_0x5e60('0x171'),'foreignKey':'OpenchannelQueueId'});db[_0x5e60('0x5e')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x5e60('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x5e60('0x5e')][_0x5e60('0x125')](db[_0x5e60('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x5e60('0x5e')]['belongsTo'](db[_0x5e60('0x8f')],{'onDelete':_0x5e60('0x171'),'foreignKey':_0x5e60('0x172')});db[_0x5e60('0x11e')]['hasMany'](db['OpenchannelMessage'],{'as':_0x5e60('0x155'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x183')});db[_0x5e60('0x11e')][_0x5e60('0x125')](db[_0x5e60('0x5c')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x182')});db['OpenchannelInteraction'][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5e60('0x11e')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x5e60('0x11e')][_0x5e60('0x126')](db['Tag'],{'through':_0x5e60('0x184'),'as':_0x5e60('0x16c')});db['OpenchannelInteraction'][_0x5e60('0x126')](db['Tag'],{'through':_0x5e60('0x184'),'as':_0x5e60('0x16d')});db[_0x5e60('0x11e')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':'Users','through':_0x5e60('0x131'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x5e60('0x125')](db[_0x5e60('0x13')],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x13')});db[_0x5e60('0x60')]['belongsTo'](db[_0x5e60('0x15a')],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17a')});db[_0x5e60('0x60')][_0x5e60('0x125')](db[_0x5e60('0x11e')],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17b'),'foreignKey':_0x5e60('0x183')});db[_0x5e60('0x60')][_0x5e60('0x125')](db[_0x5e60('0xf2')],{'as':_0x5e60('0xf2'),'foreignKey':'AttachmentId'});db[_0x5e60('0x60')][_0x5e60('0x125')](db[_0x5e60('0x5c')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x182')});db['OpenchannelQueue'][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x5e60('0x62')]['belongsToMany'](db[_0x5e60('0xea')],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite'][_0x5e60('0x117')](db[_0x5e60('0x83')],{'as':_0x5e60('0x15f'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x5e60('0x63')][_0x5e60('0x117')](db[_0x5e60('0x81')],{'as':_0x5e60('0x160'),'foreignKey':_0x5e60('0x16f')});db[_0x5e60('0x63')][_0x5e60('0x117')](db[_0x5e60('0x6f')],{'as':_0x5e60('0x185')});db[_0x5e60('0x63')]['hasMany'](db[_0x5e60('0x66')],{'as':_0x5e60('0x161')});db[_0x5e60('0x63')][_0x5e60('0x117')](db['ChatApplication'],{'as':_0x5e60('0x147')});db[_0x5e60('0x63')]['hasMany'](db[_0x5e60('0x67')],{'as':_0x5e60('0x155')});db[_0x5e60('0x63')]['belongsTo'](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163')});db[_0x5e60('0x63')][_0x5e60('0x125')](db[_0x5e60('0x86')],{'as':_0x5e60('0x86'),'foreignKey':_0x5e60('0x14f')});db['ChatWebsite'][_0x5e60('0x125')](db[_0x5e60('0x140')],{'as':_0x5e60('0x140'),'foreignKey':_0x5e60('0x15c')});db[_0x5e60('0x63')][_0x5e60('0x125')](db[_0x5e60('0x87')],{'as':_0x5e60('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5e60('0x63')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':'Agents','through':_0x5e60('0x13d')});db[_0x5e60('0x186')]['belongsTo'](db['OpenchannelAccount'],{});db[_0x5e60('0x186')][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163')});db[_0x5e60('0x186')][_0x5e60('0x125')](db['CmContact'],{'as':_0x5e60('0x17a'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x5e60('0x125')](db[_0x5e60('0x11e')],{});db[_0x5e60('0x186')][_0x5e60('0x125')](db[_0x5e60('0x60')],{});db[_0x5e60('0x186')][_0x5e60('0x125')](db[_0x5e60('0x13')],{});db[_0x5e60('0x186')]['belongsTo'](db[_0x5e60('0x62')],{});db['ChatApplication']['belongsTo'](db['User'],{'as':'Agent','foreignKey':'UserId','onDelete':_0x5e60('0x171')});db[_0x5e60('0x187')][_0x5e60('0x125')](db[_0x5e60('0x6b')],{'as':_0x5e60('0x188'),'foreignKey':_0x5e60('0x189'),'onDelete':_0x5e60('0x171')});db[_0x5e60('0x187')][_0x5e60('0x125')](db[_0x5e60('0x63')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x5e60('0x171')});db[_0x5e60('0x187')][_0x5e60('0x125')](db[_0x5e60('0x8f')],{'onDelete':_0x5e60('0x171'),'foreignKey':'TagId'});db[_0x5e60('0x66')]['hasMany'](db['ChatMessage'],{'as':_0x5e60('0x155'),'onDelete':'cascade','foreignKey':_0x5e60('0x18a')});db[_0x5e60('0x66')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x5e60('0x66')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':_0x5e60('0x17a'),'foreignKey':'ContactId'});db[_0x5e60('0x66')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'as':_0x5e60('0x16a'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x66')][_0x5e60('0x126')](db['Tag'],{'through':_0x5e60('0x18b'),'as':_0x5e60('0x16c')});db[_0x5e60('0x66')]['belongsToMany'](db[_0x5e60('0x8f')],{'through':_0x5e60('0x18b'),'as':_0x5e60('0x16d')});db[_0x5e60('0x66')]['belongsToMany'](db[_0x5e60('0x13')],{'as':_0x5e60('0x16e'),'through':_0x5e60('0x12d'),'foreignKey':_0x5e60('0x18a')});db[_0x5e60('0x67')][_0x5e60('0x125')](db['User'],{'onDelete':'cascade','as':_0x5e60('0x13')});db[_0x5e60('0x67')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17a'),'foreignKey':_0x5e60('0x169')});db['ChatMessage'][_0x5e60('0x125')](db[_0x5e60('0x66')],{'onDelete':_0x5e60('0x115'),'as':'Interaction','foreignKey':_0x5e60('0x18a')});db[_0x5e60('0x67')]['belongsTo'](db['Attachment'],{'as':_0x5e60('0xf2'),'foreignKey':'AttachmentId'});db[_0x5e60('0x67')][_0x5e60('0x125')](db['ChatWebsite'],{'as':_0x5e60('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x5e60('0x69')][_0x5e60('0x117')](db[_0x5e60('0xf2')],{'as':_0x5e60('0x18c'),'foreignKey':_0x5e60('0x170'),'onDelete':_0x5e60('0x115'),'hooks':!![]});db[_0x5e60('0x69')]['belongsTo'](db[_0x5e60('0x15a')],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17a'),'foreignKey':_0x5e60('0x169')});db[_0x5e60('0x69')][_0x5e60('0x125')](db[_0x5e60('0x63')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x16f')});db[_0x5e60('0x6b')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x30'),'hooks':!![]});db[_0x5e60('0x6b')][_0x5e60('0x126')](db['Team'],{'through':_0x5e60('0x18d'),'as':_0x5e60('0x166')});db['ChatGroup'][_0x5e60('0x117')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x5e60('0x18e'),'onDelete':_0x5e60('0x115')});db[_0x5e60('0x6d')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':'Members','through':'chat_group_has_users'});db[_0x5e60('0x6f')][_0x5e60('0x125')](db[_0x5e60('0x63')],{'as':_0x5e60('0x18f'),'foreignKey':_0x5e60('0x16f')});db[_0x5e60('0x70')][_0x5e60('0x117')](db['CmContact'],{'as':'Contacts','foreignKey':_0x5e60('0x190')});db['CmContact'][_0x5e60('0x117')](db[_0x5e60('0x14a')],{'as':_0x5e60('0x191'),'foreignKey':_0x5e60('0x169')});db['CmContact'][_0x5e60('0x117')](db[_0x5e60('0x76')],{'as':_0x5e60('0x11d'),'foreignKey':_0x5e60('0x169')});db[_0x5e60('0x15a')]['hasMany'](db[_0x5e60('0x78')],{'as':_0x5e60('0x192'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x5e60('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x5e60('0x169')});db[_0x5e60('0x15a')][_0x5e60('0x117')](db['JscriptySessionReport'],{'as':_0x5e60('0x193'),'foreignKey':'ContactId'});db[_0x5e60('0x15a')]['hasMany'](db[_0x5e60('0x11e')],{'as':_0x5e60('0x130'),'foreignKey':_0x5e60('0x169'),'onDelete':_0x5e60('0x171')});db[_0x5e60('0x15a')][_0x5e60('0x117')](db[_0x5e60('0x66')],{'as':'ChatInteractions','foreignKey':_0x5e60('0x169'),'onDelete':_0x5e60('0x171')});db[_0x5e60('0x15a')]['hasMany'](db[_0x5e60('0x56')],{'as':_0x5e60('0x120'),'foreignKey':_0x5e60('0x169'),'onDelete':_0x5e60('0x171')});db[_0x5e60('0x15a')][_0x5e60('0x117')](db[_0x5e60('0x4c')],{'as':_0x5e60('0x121'),'foreignKey':'ContactId','onDelete':_0x5e60('0x171')});db['CmContact'][_0x5e60('0x117')](db[_0x5e60('0x40')],{'as':_0x5e60('0x194'),'foreignKey':'ContactId','onDelete':_0x5e60('0x171')});db['CmContact'][_0x5e60('0x125')](db[_0x5e60('0x70')],{'as':_0x5e60('0x195'),'foreignKey':_0x5e60('0x190')});db[_0x5e60('0x15a')][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163'),'onDelete':'cascade'});db['CmContact'][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':'Users','through':_0x5e60('0x129')});db[_0x5e60('0x15a')][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'as':_0x5e60('0x16c'),'through':_0x5e60('0x196')});db[_0x5e60('0x15a')][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'through':_0x5e60('0x196'),'as':_0x5e60('0x16d')});db['CmHopper'][_0x5e60('0x125')](db['CmContact'],{'as':_0x5e60('0x17a'),'foreignKey':'ContactId','onDelete':_0x5e60('0x115')});db['CmHopper'][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163'),'onDelete':'cascade'});db[_0x5e60('0x14a')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'as':_0x5e60('0x197'),'foreignKey':_0x5e60('0x116')});db['CmHopper'][_0x5e60('0x125')](db['VoiceQueue'],{'as':_0x5e60('0x188'),'foreignKey':_0x5e60('0x14b'),'onDelete':_0x5e60('0x115')});db[_0x5e60('0x14a')][_0x5e60('0x125')](db[_0x5e60('0xee')],{'as':_0x5e60('0xee'),'foreignKey':_0x5e60('0x198'),'onDelete':_0x5e60('0x115')});db[_0x5e60('0x14a')]['belongsTo'](db[_0x5e60('0x13')],{'as':'Owner','foreignKey':_0x5e60('0x199')});db[_0x5e60('0x74')][_0x5e60('0x125')](db['CmContact'],{'as':_0x5e60('0x17a'),'foreignKey':_0x5e60('0x169'),'onDelete':_0x5e60('0x115')});db['CmHopperBlack']['belongsTo'](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163'),'onDelete':'cascade'});db[_0x5e60('0x74')][_0x5e60('0x125')](db[_0x5e60('0x1c')],{'as':_0x5e60('0x188'),'foreignKey':_0x5e60('0x14b'),'onDelete':_0x5e60('0x115')});db[_0x5e60('0x74')][_0x5e60('0x125')](db[_0x5e60('0xee')],{'as':_0x5e60('0xee'),'foreignKey':_0x5e60('0x198'),'onDelete':_0x5e60('0x115')});db[_0x5e60('0x7f')][_0x5e60('0x117')](db[_0x5e60('0x85')],{'as':{'plural':_0x5e60('0x19a'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x5e60('0x7f')][_0x5e60('0x117')](db[_0x5e60('0x85')],{'as':{'plural':_0x5e60('0x19b'),'singular':_0x5e60('0x19c')},'foreignKey':_0x5e60('0x19d'),'onDelete':_0x5e60('0x115'),'hooks':!![]});db[_0x5e60('0x7f')][_0x5e60('0x117')](db['Action'],{'as':_0x5e60('0x19e'),'foreignKey':_0x5e60('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0x5e60('0x83')]['hasMany'](db[_0x5e60('0x83')],{'as':'Dispositions','foreignKey':_0x5e60('0x1a0'),'onDelete':_0x5e60('0x115')});db['Interval'][_0x5e60('0x117')](db[_0x5e60('0x86')],{'as':_0x5e60('0x1a1'),'foreignKey':_0x5e60('0x14f'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x5e60('0x86')][_0x5e60('0x117')](db[_0x5e60('0x11b')],{'as':_0x5e60('0x11c'),'foreignKey':'IntervalId','onDelete':_0x5e60('0x171')});db[_0x5e60('0x86')]['hasMany'](db['MailApplication'],{'as':_0x5e60('0x1a2'),'foreignKey':'IntervalId'});db[_0x5e60('0x86')][_0x5e60('0x117')](db['ChatApplication'],{'as':_0x5e60('0x1a3'),'foreignKey':_0x5e60('0x14f')});db[_0x5e60('0x86')][_0x5e60('0x117')](db[_0x5e60('0x4a')],{'as':_0x5e60('0x1a4'),'foreignKey':_0x5e60('0x14f')});db['Interval']['hasMany'](db[_0x5e60('0x54')],{'as':_0x5e60('0x1a5'),'foreignKey':_0x5e60('0x14f')});db[_0x5e60('0x8d')][_0x5e60('0x125')](db[_0x5e60('0x140')],{});db[_0x5e60('0x8d')][_0x5e60('0x125')](db[_0x5e60('0x1a6')],{'foreignKey':_0x5e60('0x1a7')});db['Schedule']['belongsTo'](db[_0x5e60('0x9a')],{'foreignKey':_0x5e60('0x1a8')});db[_0x5e60('0x8e')]['belongsToMany'](db[_0x5e60('0x1a')],{'as':_0x5e60('0x1a9'),'through':_0x5e60('0x148'),'onDelete':_0x5e60('0x171')});db[_0x5e60('0x8f')][_0x5e60('0x126')](db[_0x5e60('0x15a')],{'through':_0x5e60('0x196')});db[_0x5e60('0x8f')][_0x5e60('0x126')](db[_0x5e60('0x66')],{'through':_0x5e60('0x18b')});db[_0x5e60('0x8f')][_0x5e60('0x126')](db[_0x5e60('0x40')],{'through':_0x5e60('0x16b')});db[_0x5e60('0x8f')][_0x5e60('0x126')](db[_0x5e60('0x56')],{'through':_0x5e60('0x180')});db[_0x5e60('0x8f')][_0x5e60('0x126')](db[_0x5e60('0x4c')],{'through':_0x5e60('0x1aa')});db[_0x5e60('0x8f')][_0x5e60('0x126')](db[_0x5e60('0x11e')],{'through':_0x5e60('0x184')});db[_0x5e60('0x8f')][_0x5e60('0x126')](db[_0x5e60('0x107')],{'through':_0x5e60('0x1ab')});db['Trigger'][_0x5e60('0x117')](db[_0x5e60('0x85')],{'as':{'plural':_0x5e60('0x1ac'),'singular':_0x5e60('0x1ad')},'foreignKey':_0x5e60('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x5e60('0x93')]['hasMany'](db['Condition'],{'as':{'plural':_0x5e60('0x1af'),'singular':_0x5e60('0x1b0')},'foreignKey':_0x5e60('0x1b1'),'onDelete':'cascade','hooks':!![]});db[_0x5e60('0x93')][_0x5e60('0x117')](db[_0x5e60('0x7d')],{'as':_0x5e60('0x19e'),'foreignKey':_0x5e60('0x1b2'),'onDelete':_0x5e60('0x115'),'hooks':!![]});db[_0x5e60('0x9a')][_0x5e60('0x117')](db[_0x5e60('0x9f')],{'as':_0x5e60('0x1b3'),'onDelete':'cascade','foreignKey':_0x5e60('0x1a8'),'hooks':!![]});db[_0x5e60('0x1a6')][_0x5e60('0x117')](db[_0x5e60('0x9f')],{'as':_0x5e60('0x1b3'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1a7')});db[_0x5e60('0x9d')][_0x5e60('0x117')](db['AnalyticFieldReport'],{'as':_0x5e60('0x1b3'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b4')});db[_0x5e60('0x9f')]['belongsTo'](db[_0x5e60('0x9d')],{'foreignKey':_0x5e60('0x1b4')});db[_0x5e60('0x1b5')][_0x5e60('0x117')](db['SalesforceConfiguration'],{'as':_0x5e60('0x1b6'),'onDelete':'cascade','foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xa3')][_0x5e60('0x117')](db[_0x5e60('0xa5')],{'as':_0x5e60('0x1b8'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b9')});db['SalesforceConfiguration'][_0x5e60('0x117')](db[_0x5e60('0xa5')],{'as':_0x5e60('0x1ba'),'onDelete':_0x5e60('0x115'),'foreignKey':'DescriptionId'});db[_0x5e60('0xa3')][_0x5e60('0x117')](db['SalesforceField'],{'as':_0x5e60('0x1b3'),'onDelete':'cascade','foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xa3')][_0x5e60('0x125')](db[_0x5e60('0x1b5')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xa5')]['hasMany'](db['SalesforceField'],{'as':_0x5e60('0x1bc'),'foreignKey':'SubjectId'});db[_0x5e60('0xa5')][_0x5e60('0x117')](db[_0x5e60('0xa5')],{'as':_0x5e60('0x1bd'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xa5')]['hasMany'](db[_0x5e60('0xa5')],{'as':'Field','foreignKey':'FieldId'});db[_0x5e60('0xa5')]['belongsTo'](db[_0x5e60('0x95')],{'as':_0x5e60('0x95'),'foreignKey':_0x5e60('0x1bf')});db[_0x5e60('0xa7')][_0x5e60('0x117')](db['SugarcrmConfiguration'],{'as':_0x5e60('0x1b6'),'onDelete':'cascade','foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xa9')][_0x5e60('0x117')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x5e60('0x115'),'foreignKey':'SubjectId'});db[_0x5e60('0xa9')][_0x5e60('0x117')](db[_0x5e60('0x1c0')],{'as':_0x5e60('0x1ba'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xa9')]['hasMany'](db[_0x5e60('0x1c0')],{'as':_0x5e60('0x1b3'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xa9')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0x1c0')][_0x5e60('0x117')](db[_0x5e60('0x1c0')],{'as':'Subject','foreignKey':'SubjectId'});db['SugarcrmField'][_0x5e60('0x117')](db[_0x5e60('0x1c0')],{'as':_0x5e60('0x1bd'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x5e60('0x117')](db[_0x5e60('0x1c0')],{'as':_0x5e60('0x1c1'),'foreignKey':'FieldId'});db[_0x5e60('0x1c0')][_0x5e60('0x125')](db[_0x5e60('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x5e60('0xac')][_0x5e60('0x117')](db[_0x5e60('0xae')],{'as':_0x5e60('0x1b6'),'onDelete':'cascade','foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xae')][_0x5e60('0x117')](db['DeskField'],{'as':_0x5e60('0x1b8'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b9')});db['DeskConfiguration'][_0x5e60('0x117')](db[_0x5e60('0x1c2')],{'as':_0x5e60('0x1ba'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xae')][_0x5e60('0x117')](db['DeskField'],{'as':_0x5e60('0x1b3'),'onDelete':_0x5e60('0x115'),'foreignKey':'FieldId'});db[_0x5e60('0xae')][_0x5e60('0x125')](db[_0x5e60('0xac')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xae')][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'through':_0x5e60('0x1c3')});db[_0x5e60('0x1c2')][_0x5e60('0x117')](db[_0x5e60('0x1c2')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0x5e60('0x117')](db[_0x5e60('0x1c2')],{'as':_0x5e60('0x1bd'),'foreignKey':_0x5e60('0x1be')});db['DeskField'][_0x5e60('0x117')](db['DeskField'],{'as':_0x5e60('0x1c1'),'foreignKey':_0x5e60('0x1bb')});db['DeskField'][_0x5e60('0x125')](db[_0x5e60('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x5e60('0xb0')][_0x5e60('0x117')](db['ZohoConfiguration'],{'as':_0x5e60('0x1b6'),'onDelete':_0x5e60('0x115'),'foreignKey':'AccountId'});db[_0x5e60('0xb2')][_0x5e60('0x117')](db['ZohoField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xb2')][_0x5e60('0x117')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xb2')][_0x5e60('0x117')](db[_0x5e60('0xb3')],{'as':_0x5e60('0x1b3'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xb2')][_0x5e60('0x125')](db['ZohoAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x5e60('0xb3')]['hasMany'](db[_0x5e60('0xb3')],{'as':'Subject','foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xb3')][_0x5e60('0x117')](db[_0x5e60('0xb3')],{'as':'Description','foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xb3')]['hasMany'](db['ZohoField'],{'as':'Field','foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xb3')]['belongsTo'](db[_0x5e60('0x95')],{'as':_0x5e60('0x95'),'foreignKey':'VariableId'});db[_0x5e60('0xb4')][_0x5e60('0x117')](db['ZendeskConfiguration'],{'as':_0x5e60('0x1b6'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xb5')][_0x5e60('0x117')](db[_0x5e60('0xb7')],{'as':_0x5e60('0x1b8'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xb5')][_0x5e60('0x117')](db[_0x5e60('0xb7')],{'as':_0x5e60('0x1ba'),'foreignKey':_0x5e60('0x1be')});db['ZendeskConfiguration'][_0x5e60('0x117')](db[_0x5e60('0xb7')],{'as':_0x5e60('0x1b3'),'foreignKey':'FieldId'});db[_0x5e60('0xb5')][_0x5e60('0x125')](db[_0x5e60('0xb4')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db['ZendeskConfiguration'][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'through':_0x5e60('0x1c4')});db[_0x5e60('0xb7')][_0x5e60('0x117')](db[_0x5e60('0xb7')],{'as':'Subject','foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xb7')][_0x5e60('0x117')](db[_0x5e60('0xb7')],{'as':_0x5e60('0x1bd'),'foreignKey':'DescriptionId'});db[_0x5e60('0xb7')][_0x5e60('0x117')](db['ZendeskField'],{'as':_0x5e60('0x1c1'),'foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xb7')]['belongsTo'](db[_0x5e60('0x95')],{'as':'Variable','foreignKey':_0x5e60('0x1bf')});db[_0x5e60('0xb9')][_0x5e60('0x117')](db[_0x5e60('0xbb')],{'as':_0x5e60('0x1b6'),'onDelete':_0x5e60('0x115'),'foreignKey':'AccountId'});db[_0x5e60('0xbb')][_0x5e60('0x117')](db[_0x5e60('0xbd')],{'as':_0x5e60('0x1b8'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xbb')]['hasMany'](db[_0x5e60('0xbd')],{'as':_0x5e60('0x1ba'),'onDelete':_0x5e60('0x115'),'foreignKey':'DescriptionId'});db[_0x5e60('0xbb')][_0x5e60('0x117')](db[_0x5e60('0xbd')],{'as':'Fields','onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xbb')][_0x5e60('0x125')](db[_0x5e60('0xb9')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x5e60('0x8f')],{'through':_0x5e60('0x1c5')});db[_0x5e60('0xbd')][_0x5e60('0x117')](db[_0x5e60('0xbd')],{'as':_0x5e60('0x1bc'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xbd')][_0x5e60('0x117')](db['FreshdeskField'],{'as':_0x5e60('0x1bd'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xbd')]['hasMany'](db[_0x5e60('0xbd')],{'as':'Field','foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xbd')][_0x5e60('0x125')](db[_0x5e60('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x5e60('0xbf')][_0x5e60('0x117')](db[_0x5e60('0xc1')],{'as':_0x5e60('0x1b6'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xc1')][_0x5e60('0x117')](db[_0x5e60('0xc3')],{'as':_0x5e60('0x1b8'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xc1')]['hasMany'](db[_0x5e60('0xc3')],{'as':'Descriptions','foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xc1')][_0x5e60('0x117')](db[_0x5e60('0xc3')],{'as':'Fields','foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xc1')][_0x5e60('0x125')](db[_0x5e60('0xbf')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xc3')][_0x5e60('0x117')](db[_0x5e60('0xc3')],{'as':_0x5e60('0x1bc'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xc3')][_0x5e60('0x117')](db[_0x5e60('0xc3')],{'as':_0x5e60('0x1bd'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xc3')][_0x5e60('0x117')](db['VtigerField'],{'as':_0x5e60('0x1c1'),'foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xc3')][_0x5e60('0x125')](db['Variable'],{'as':_0x5e60('0x95'),'foreignKey':_0x5e60('0x1bf')});db[_0x5e60('0xc5')][_0x5e60('0x117')](db[_0x5e60('0xc7')],{'as':_0x5e60('0x1b6'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xc7')][_0x5e60('0x117')](db[_0x5e60('0xc9')],{'as':_0x5e60('0x1b8'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xc7')]['hasMany'](db[_0x5e60('0xc9')],{'as':_0x5e60('0x1ba'),'foreignKey':_0x5e60('0x1be')});db['ServicenowConfiguration'][_0x5e60('0x117')](db[_0x5e60('0xc9')],{'as':'Fields','foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xc7')]['belongsTo'](db[_0x5e60('0xc5')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db['ServicenowField'][_0x5e60('0x117')](db[_0x5e60('0xc9')],{'as':_0x5e60('0x1bc'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0xc9')]['hasMany'](db[_0x5e60('0xc9')],{'as':_0x5e60('0x1bd'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xc9')][_0x5e60('0x117')](db[_0x5e60('0xc9')],{'as':_0x5e60('0x1c1'),'foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xc9')][_0x5e60('0x125')](db['Variable'],{'as':'Variable','foreignKey':_0x5e60('0x1bf')});db[_0x5e60('0xca')][_0x5e60('0x117')](db['Dynamics365Configuration'],{'as':_0x5e60('0x1b6'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b7')});db['Dynamics365Configuration'][_0x5e60('0x117')](db['Dynamics365Field'],{'as':_0x5e60('0x1b8'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b9')});db[_0x5e60('0x1c6')][_0x5e60('0x117')](db[_0x5e60('0xcc')],{'as':_0x5e60('0x1ba'),'onDelete':'cascade','foreignKey':_0x5e60('0x1be')});db[_0x5e60('0x1c6')][_0x5e60('0x117')](db['Dynamics365Field'],{'as':_0x5e60('0x1b3'),'onDelete':_0x5e60('0x115'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x5e60('0x125')](db[_0x5e60('0xca')],{'as':_0x5e60('0x168'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x5e60('0x117')](db['Dynamics365Field'],{'as':_0x5e60('0x1bc'),'foreignKey':'SubjectId'});db[_0x5e60('0xcc')][_0x5e60('0x117')](db[_0x5e60('0xcc')],{'as':_0x5e60('0x1bd'),'foreignKey':'DescriptionId'});db[_0x5e60('0xcc')][_0x5e60('0x117')](db['Dynamics365Field'],{'as':_0x5e60('0x1c1'),'foreignKey':_0x5e60('0x1bb')});db[_0x5e60('0xcc')][_0x5e60('0x125')](db['Variable'],{'as':_0x5e60('0x95'),'foreignKey':_0x5e60('0x1bf')});db[_0x5e60('0xce')][_0x5e60('0x117')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1b7')});db[_0x5e60('0xd0')]['hasMany'](db[_0x5e60('0xd2')],{'as':_0x5e60('0x1b8'),'foreignKey':_0x5e60('0x1b9')});db['FreshsalesConfiguration'][_0x5e60('0x117')](db[_0x5e60('0xd2')],{'as':_0x5e60('0x1ba'),'foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xd0')][_0x5e60('0x117')](db['FreshsalesField'],{'as':_0x5e60('0x1b3'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x5e60('0x125')](db[_0x5e60('0xce')],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1b7')});db['FreshsalesField']['hasMany'](db[_0x5e60('0xd2')],{'as':_0x5e60('0x1bc'),'foreignKey':_0x5e60('0x1b9')});db['FreshsalesField'][_0x5e60('0x117')](db[_0x5e60('0xd2')],{'as':'Description','foreignKey':_0x5e60('0x1be')});db[_0x5e60('0xd2')][_0x5e60('0x117')](db[_0x5e60('0xd2')],{'as':_0x5e60('0x1c1'),'foreignKey':'FieldId'});db[_0x5e60('0xd2')][_0x5e60('0x125')](db[_0x5e60('0x95')],{'as':_0x5e60('0x95'),'foreignKey':_0x5e60('0x1bf')});db[_0x5e60('0x1c7')][_0x5e60('0x125')](db[_0x5e60('0x63')],{});db['ChatQueueReport'][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':'ListId'});db[_0x5e60('0x1c7')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':_0x5e60('0x17a'),'foreignKey':_0x5e60('0x169')});db[_0x5e60('0x1c7')]['belongsTo'](db[_0x5e60('0x66')],{});db[_0x5e60('0x1c7')]['belongsTo'](db[_0x5e60('0x67')],{});db['ChatQueueReport'][_0x5e60('0x125')](db[_0x5e60('0x13')],{});db['ChatQueueReport'][_0x5e60('0x125')](db[_0x5e60('0x6b')],{});db[_0x5e60('0xd6')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x5e60('0xd6')]['belongsTo'](db[_0x5e60('0x13')],{'onDelete':_0x5e60('0x115'),'foreignKey':'ToId'});db[_0x5e60('0xda')][_0x5e60('0x117')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x5e60('0x115')});db[_0x5e60('0xda')]['hasMany'](db[_0x5e60('0x1c8')],{'foreignKey':'SessionId','onDelete':_0x5e60('0x115')});db[_0x5e60('0x1c9')][_0x5e60('0x125')](db[_0x5e60('0x52')],{});db[_0x5e60('0x1c9')]['belongsTo'](db['CmList'],{'as':_0x5e60('0x162'),'foreignKey':_0x5e60('0x163')});db[_0x5e60('0x1c9')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':_0x5e60('0x17a'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0x5e60('0x125')](db[_0x5e60('0x56')],{});db[_0x5e60('0x1c9')][_0x5e60('0x125')](db[_0x5e60('0x58')],{});db[_0x5e60('0x1c9')][_0x5e60('0x125')](db[_0x5e60('0x13')],{});db[_0x5e60('0x1c9')]['belongsTo'](db[_0x5e60('0x5a')],{});db[_0x5e60('0xdf')][_0x5e60('0x117')](db[_0x5e60('0xda')],{'foreignKey':_0x5e60('0x1ca')});db[_0x5e60('0xdf')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x5e60('0x1ca')});db[_0x5e60('0xdf')]['hasMany'](db[_0x5e60('0x1c8')],{'foreignKey':_0x5e60('0x1ca')});db[_0x5e60('0x1cb')]['belongsToMany'](db[_0x5e60('0x13')],{'as':_0x5e60('0x16e'),'through':'user_has_square_projects'});db[_0x5e60('0xea')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x1cc')});db['Team'][_0x5e60('0x126')](db['VoiceQueue'],{'through':_0x5e60('0x111'),'as':'VoiceQueues'});db[_0x5e60('0xea')][_0x5e60('0x126')](db[_0x5e60('0x3c')],{'through':'team_has_mail_queues','as':_0x5e60('0x135')});db[_0x5e60('0xea')][_0x5e60('0x126')](db[_0x5e60('0x6b')],{'through':_0x5e60('0x18d'),'as':'ChatQueues'});db[_0x5e60('0xea')][_0x5e60('0x126')](db[_0x5e60('0x178')],{'through':_0x5e60('0x17d'),'as':_0x5e60('0x137')});db['Team']['belongsToMany'](db[_0x5e60('0x5a')],{'through':'team_has_sms_queues','as':_0x5e60('0x138')});db[_0x5e60('0xea')]['belongsToMany'](db[_0x5e60('0x62')],{'through':_0x5e60('0x1cd'),'as':'OpenchannelQueues'});db[_0x5e60('0xea')][_0x5e60('0x126')](db[_0x5e60('0x10d')],{'through':_0x5e60('0x1ce'),'as':_0x5e60('0x13a')});db[_0x5e60('0xea')]['belongsToMany'](db[_0x5e60('0xfe')],{'through':_0x5e60('0x1cf'),'as':_0x5e60('0x134')});db[_0x5e60('0xee')]['hasMany'](db[_0x5e60('0x14a')],{'as':_0x5e60('0x191'),'foreignKey':'CampaignId'});db[_0x5e60('0xee')][_0x5e60('0x117')](db[_0x5e60('0x76')],{'as':'HopperFinals','foreignKey':_0x5e60('0x198')});db[_0x5e60('0xee')][_0x5e60('0x117')](db[_0x5e60('0x78')],{'as':_0x5e60('0x192'),'foreignKey':_0x5e60('0x198')});db[_0x5e60('0xee')][_0x5e60('0x117')](db[_0x5e60('0x74')],{'as':_0x5e60('0x14c'),'foreignKey':_0x5e60('0x198')});db['Campaign'][_0x5e60('0x125')](db[_0x5e60('0x2a')],{'as':'Trunk','foreignKey':_0x5e60('0x14d')});db[_0x5e60('0xee')]['belongsTo'](db[_0x5e60('0x2a')],{'as':_0x5e60('0x14e'),'foreignKey':_0x5e60('0x1d0')});db[_0x5e60('0xee')][_0x5e60('0x125')](db[_0x5e60('0x86')],{'as':_0x5e60('0x86'),'foreignKey':_0x5e60('0x14f')});db[_0x5e60('0xee')][_0x5e60('0x125')](db[_0x5e60('0x1cb')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db['Campaign'][_0x5e60('0x126')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x12a'),'through':'campaigns_has_cm_lists'});db[_0x5e60('0xee')]['belongsToMany'](db['CmList'],{'as':_0x5e60('0x1d1'),'through':_0x5e60('0x1d2')});db[_0x5e60('0xf2')]['belongsTo'](db[_0x5e60('0x69')],{'as':_0x5e60('0x69'),'foreignKey':'ChatOfflineMessageId'});db[_0x5e60('0xf4')][_0x5e60('0x125')](db['MailMessage'],{});db[_0x5e60('0xf4')]['belongsTo'](db[_0x5e60('0x40')],{});db[_0x5e60('0xf4')][_0x5e60('0x125')](db[_0x5e60('0x140')],{'foreignKey':_0x5e60('0x1d3'),'as':_0x5e60('0x1d4')});db[_0x5e60('0xf4')][_0x5e60('0x125')](db['User'],{'foreignKey':'FromUserId','as':_0x5e60('0x1d5')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x5e60('0x1d6'),'as':_0x5e60('0x1d7')});db['MailTransferReport'][_0x5e60('0x125')](db[_0x5e60('0x3c')],{'foreignKey':_0x5e60('0x1d8'),'as':_0x5e60('0x1d9')});db[_0x5e60('0xf4')][_0x5e60('0x125')](db['MailAccount'],{'foreignKey':_0x5e60('0x1da'),'as':_0x5e60('0x1db')});db[_0x5e60('0xf6')][_0x5e60('0x125')](db[_0x5e60('0x67')],{});db[_0x5e60('0xf6')]['belongsTo'](db[_0x5e60('0x66')],{});db[_0x5e60('0xf6')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x5e60('0x1dc'),'as':_0x5e60('0x1d4')});db[_0x5e60('0xf6')]['belongsTo'](db[_0x5e60('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x5e60('0xf6')]['belongsTo'](db[_0x5e60('0x13')],{'foreignKey':_0x5e60('0x1d6'),'as':_0x5e60('0x1d7')});db[_0x5e60('0xf6')]['belongsTo'](db[_0x5e60('0x6b')],{'foreignKey':'ToChatQueueId','as':_0x5e60('0x1d9')});db[_0x5e60('0xf6')]['belongsTo'](db[_0x5e60('0x63')],{'foreignKey':_0x5e60('0x1dd'),'as':_0x5e60('0x1db')});db[_0x5e60('0xf8')][_0x5e60('0x125')](db['FaxMessage'],{});db['FaxTransferReport'][_0x5e60('0x125')](db[_0x5e60('0x4c')],{});db[_0x5e60('0xf8')]['belongsTo'](db[_0x5e60('0x48')],{'foreignKey':'FromFaxAccountId','as':_0x5e60('0x1d4')});db[_0x5e60('0xf8')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'foreignKey':_0x5e60('0x1de'),'as':_0x5e60('0x1d5')});db['FaxTransferReport'][_0x5e60('0x125')](db[_0x5e60('0x13')],{'foreignKey':_0x5e60('0x1d6'),'as':'ToAgent'});db['FaxTransferReport'][_0x5e60('0x125')](db[_0x5e60('0x178')],{'foreignKey':'ToFaxQueueId','as':_0x5e60('0x1d9')});db[_0x5e60('0xf8')][_0x5e60('0x125')](db['FaxAccount'],{'foreignKey':_0x5e60('0x1df'),'as':_0x5e60('0x1db')});db['OpenchannelTransferReport'][_0x5e60('0x125')](db[_0x5e60('0x60')],{});db[_0x5e60('0xf9')][_0x5e60('0x125')](db[_0x5e60('0x11e')],{});db[_0x5e60('0xf9')][_0x5e60('0x125')](db[_0x5e60('0x5c')],{'foreignKey':_0x5e60('0x1e0'),'as':'FromAccount'});db[_0x5e60('0xf9')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'foreignKey':'FromUserId','as':_0x5e60('0x1d5')});db[_0x5e60('0xf9')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'foreignKey':_0x5e60('0x1d6'),'as':_0x5e60('0x1d7')});db[_0x5e60('0xf9')][_0x5e60('0x125')](db['OpenchannelQueue'],{'foreignKey':_0x5e60('0x1e1'),'as':_0x5e60('0x1d9')});db[_0x5e60('0xf9')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x5e60('0x1db')});db[_0x5e60('0xfa')][_0x5e60('0x125')](db[_0x5e60('0x58')],{});db[_0x5e60('0xfa')]['belongsTo'](db['SmsInteraction'],{});db[_0x5e60('0xfa')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x5e60('0x1e2'),'as':_0x5e60('0x1d4')});db[_0x5e60('0xfa')][_0x5e60('0x125')](db['User'],{'foreignKey':_0x5e60('0x1de'),'as':_0x5e60('0x1d5')});db['SmsTransferReport']['belongsTo'](db[_0x5e60('0x13')],{'foreignKey':'ToUserId','as':_0x5e60('0x1d7')});db[_0x5e60('0xfa')][_0x5e60('0x125')](db['SmsQueue'],{'foreignKey':_0x5e60('0x1e3'),'as':_0x5e60('0x1d9')});db[_0x5e60('0xfa')]['belongsTo'](db[_0x5e60('0x52')],{'foreignKey':_0x5e60('0x1e4'),'as':_0x5e60('0x1db')});db[_0x5e60('0xfc')][_0x5e60('0x117')](db['Disposition'],{'as':_0x5e60('0x15f'),'foreignKey':_0x5e60('0x163'),'onDelete':_0x5e60('0x115')});db['CmList'][_0x5e60('0x117')](db['CmCustomField'],{'as':_0x5e60('0x1e5'),'foreignKey':'ListId'});db[_0x5e60('0xfc')]['hasMany'](db[_0x5e60('0x15a')],{'as':_0x5e60('0x128'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x163')});db['CmList'][_0x5e60('0x117')](db[_0x5e60('0x76')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0x5e60('0x117')](db['CmHopperHistory'],{'as':_0x5e60('0x1e6'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x5e60('0x7a')],{'as':_0x5e60('0x7a'),'foreignKey':_0x5e60('0x163')});db[_0x5e60('0xfc')][_0x5e60('0x126')](db[_0x5e60('0x1c')],{'as':_0x5e60('0x1e7'),'through':_0x5e60('0x152')});db['CmList'][_0x5e60('0x126')](db['User'],{'as':_0x5e60('0x153'),'through':_0x5e60('0x12b')});db[_0x5e60('0xfe')][_0x5e60('0x117')](db['VoiceExtension'],{'as':_0x5e60('0x11c'),'onDelete':'cascade'});db[_0x5e60('0xfe')]['belongsToMany'](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x113')});db[_0x5e60('0xfe')][_0x5e60('0x126')](db[_0x5e60('0xea')],{'through':_0x5e60('0x1cf'),'as':'Teams'});db['UserProfile']['hasMany'](db[_0x5e60('0x13')],{'as':_0x5e60('0x16e'),'foreignKey':_0x5e60('0x1e8')});db[_0x5e60('0x100')][_0x5e60('0x117')](db[_0x5e60('0x101')],{'as':_0x5e60('0x1e9'),'foreignKey':'userProfileId','onDelete':_0x5e60('0x115')});db['UserProfileSection'][_0x5e60('0x117')](db['UserProfileResource'],{'as':_0x5e60('0x1ea'),'foreignKey':_0x5e60('0x1eb'),'onDelete':_0x5e60('0x115')});db[_0x5e60('0x143')][_0x5e60('0x117')](db['Disposition'],{'as':_0x5e60('0x15f'),'foreignKey':_0x5e60('0x1ec'),'onDelete':'cascade'});db[_0x5e60('0x143')]['hasMany'](db[_0x5e60('0x81')],{'as':_0x5e60('0x160'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x5e60('0x117')](db[_0x5e60('0x108')],{'as':_0x5e60('0x155'),'foreignKey':_0x5e60('0x1ec')});db[_0x5e60('0x143')][_0x5e60('0x117')](db[_0x5e60('0x107')],{'as':'Interactions'});db[_0x5e60('0x143')][_0x5e60('0x117')](db[_0x5e60('0x105')],{'as':_0x5e60('0x147')});db[_0x5e60('0x143')]['belongsTo'](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':'ListId'});db[_0x5e60('0x143')][_0x5e60('0x125')](db[_0x5e60('0x87')],{'as':_0x5e60('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5e60('0x143')][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x1ed')});db['WhatsappApplication'][_0x5e60('0x125')](db['User'],{'onDelete':'restrict'});db[_0x5e60('0x105')][_0x5e60('0x125')](db['WhatsappQueue'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x5e60('0x125')](db[_0x5e60('0x143')],{'onDelete':_0x5e60('0x171')});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':_0x5e60('0x171'),'foreignKey':_0x5e60('0x14f')});db[_0x5e60('0x105')][_0x5e60('0x125')](db[_0x5e60('0x8f')],{'onDelete':_0x5e60('0x171'),'foreignKey':_0x5e60('0x172')});db[_0x5e60('0x107')][_0x5e60('0x117')](db['WhatsappMessage'],{'as':_0x5e60('0x155'),'onDelete':_0x5e60('0x115'),'foreignKey':_0x5e60('0x1ee')});db[_0x5e60('0x107')][_0x5e60('0x125')](db['WhatsappAccount'],{'as':_0x5e60('0x168'),'foreignKey':_0x5e60('0x1ec')});db[_0x5e60('0x107')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':'Contact','foreignKey':_0x5e60('0x169')});db[_0x5e60('0x107')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'as':_0x5e60('0x16a'),'foreignKey':_0x5e60('0x116')});db[_0x5e60('0x107')][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'through':_0x5e60('0x1ab'),'as':_0x5e60('0x16c')});db[_0x5e60('0x107')][_0x5e60('0x126')](db[_0x5e60('0x8f')],{'through':_0x5e60('0x1ab'),'as':_0x5e60('0x16d')});db['WhatsappInteraction'][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x16e'),'through':_0x5e60('0x132'),'foreignKey':'WhatsappInteractionId'});db[_0x5e60('0x108')]['belongsTo'](db['User'],{'as':_0x5e60('0x13')});db[_0x5e60('0x108')]['belongsTo'](db[_0x5e60('0x15a')],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17a')});db[_0x5e60('0x108')][_0x5e60('0x125')](db['WhatsappInteraction'],{'onDelete':_0x5e60('0x115'),'as':_0x5e60('0x17b'),'foreignKey':'WhatsappInteractionId'});db[_0x5e60('0x108')][_0x5e60('0x125')](db['WhatsappAccount'],{'as':_0x5e60('0x168'),'foreignKey':'WhatsappAccountId'});db[_0x5e60('0x10a')][_0x5e60('0x125')](db['WhatsappAccount'],{});db[_0x5e60('0x10a')][_0x5e60('0x125')](db[_0x5e60('0xfc')],{'as':_0x5e60('0x162'),'foreignKey':'ListId'});db[_0x5e60('0x10a')][_0x5e60('0x125')](db[_0x5e60('0x15a')],{'as':_0x5e60('0x17a'),'foreignKey':_0x5e60('0x169')});db['WhatsappQueueReport'][_0x5e60('0x125')](db[_0x5e60('0x107')],{});db[_0x5e60('0x10a')][_0x5e60('0x125')](db[_0x5e60('0x10d')],{});db[_0x5e60('0x10a')][_0x5e60('0x125')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x5e60('0x125')](db[_0x5e60('0x13')],{});db[_0x5e60('0x10b')]['belongsTo'](db[_0x5e60('0x108')],{});db[_0x5e60('0x10b')][_0x5e60('0x125')](db[_0x5e60('0x107')],{});db[_0x5e60('0x10b')][_0x5e60('0x125')](db[_0x5e60('0x143')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x5e60('0x10b')][_0x5e60('0x125')](db['WhatsappAccount'],{'foreignKey':_0x5e60('0x1ef'),'as':_0x5e60('0x1db')});db[_0x5e60('0x10b')][_0x5e60('0x125')](db[_0x5e60('0x10d')],{'foreignKey':_0x5e60('0x1f0'),'as':'ToQueue'});db['WhatsappTransferReport'][_0x5e60('0x125')](db['User'],{'foreignKey':_0x5e60('0x1de'),'as':_0x5e60('0x1d5')});db[_0x5e60('0x10b')][_0x5e60('0x125')](db[_0x5e60('0x13')],{'foreignKey':_0x5e60('0x1d6'),'as':_0x5e60('0x1d7')});db['WhatsappQueue'][_0x5e60('0x126')](db[_0x5e60('0x13')],{'as':_0x5e60('0x153'),'through':_0x5e60('0x13b'),'foreignKey':_0x5e60('0x1f1')});db[_0x5e60('0x10d')][_0x5e60('0x126')](db['Team'],{'through':_0x5e60('0x1ce'),'as':_0x5e60('0x166')});module[_0x5e60('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3d57392..97da8d8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3750=['/api/teams','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/version','./api/version','/api/pm2','./api/pm2','/apidoc','static','root','/www','/demo','join','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','securityToken','code','accessKey','tenantId','channelSecret','accessToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','accesskeyid','secretaccesskey','key','accountSid','dsn','secret','registry','isPlainObject','isArray','length','@@{','replace','}@@','includes','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','url','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','name','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailApplication','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/messages'];(function(_0x197ced,_0x261ea5){var _0x31e0c6=function(_0xe2ef0a){while(--_0xe2ef0a){_0x197ced['push'](_0x197ced['shift']());}};_0x31e0c6(++_0x261ea5);}(_0x3750,0x6c));var _0x0375=function(_0x395718,_0x20322d){_0x395718=_0x395718-0x0;var _0x3028b8=_0x3750[_0x395718];return _0x3028b8;};'use strict';var _=require('lodash');var path=require(_0x0375('0x0'));var express=require(_0x0375('0x1'));var ewinston=require(_0x0375('0x2'));var util=require(_0x0375('0x3'));var errors=require(_0x0375('0x4'));var config=require('./config/environment');var logger=require(_0x0375('0x5'))(_0x0375('0x6'));var authLogger=require(_0x0375('0x5'))(_0x0375('0x7'));var safeTemplate=require('./safe-template')['safeTemplate'];exports[_0x0375('0x8')]=function(_0x2c3545){_0x2c3545[_0x0375('0x9')](ewinston[_0x0375('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5a3145,_0x32b3ef){var _0xd08fc5='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x0375('0xb')](_0x5a3145[_0x0375('0xc')])){_0xd08fc5+=_0x0375('0xd');var _0x5bd30a=_0x5a3145[_0x0375('0xc')];maskSensitiveData(_0x5bd30a);}return safeTemplate(util[_0x0375('0xe')](_0xd08fc5,_0x5a3145[_0x0375('0xf')],_0x5a3145['headers'][_0x0375('0x10')]?_0x5a3145[_0x0375('0x11')]['x-forwarded-for']:_0x5a3145[_0x0375('0x12')][_0x0375('0x13')]||_0x5a3145['ip'],_0x5a3145[_0x0375('0x14')],_0x32b3ef['statusCode'],_0x32b3ef[_0x0375('0x15')],_0x5a3145[_0x0375('0x16')]?_0x5a3145[_0x0375('0x16')]['id']:null,_0x5a3145[_0x0375('0x16')]?_0x5a3145[_0x0375('0x16')]['name']:null,_0x5a3145[_0x0375('0x16')]?_0x5a3145[_0x0375('0x16')][_0x0375('0x17')]:null,_0x5bd30a?util[_0x0375('0x18')](_0x5bd30a,![],null):''));}}));_0x2c3545['use'](ewinston[_0x0375('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x12b7bc,_0x18a2c0){var _0x56b107=_0x0375('0x19');if(_0x12b7bc['body']&&_0x12b7bc['body']['device']&&_0x12b7bc[_0x0375('0xc')][_0x0375('0x1a')]){_0x56b107=_0x0375('0x1b');}return util['format'](_0x56b107,_0x12b7bc[_0x0375('0xf')],_0x12b7bc['headers'][_0x0375('0x10')]?_0x12b7bc[_0x0375('0x11')][_0x0375('0x10')]:_0x12b7bc[_0x0375('0x12')][_0x0375('0x13')]||_0x12b7bc['ip'],_0x12b7bc[_0x0375('0x14')],_0x18a2c0[_0x0375('0x1c')],_0x18a2c0['responseTime'],_0x12b7bc[_0x0375('0x16')]?_0x12b7bc[_0x0375('0x16')]['id']:null,_0x12b7bc[_0x0375('0x16')]?_0x12b7bc[_0x0375('0x16')][_0x0375('0x1d')]:null,_0x12b7bc[_0x0375('0x16')]?_0x12b7bc[_0x0375('0x16')][_0x0375('0x17')]:null,_0x12b7bc[_0x0375('0xc')]&&_0x12b7bc['body']['device']?_0x12b7bc['body'][_0x0375('0x1e')]:_0x0375('0x1f'),_0x12b7bc[_0x0375('0xc')]&&_0x12b7bc[_0x0375('0xc')][_0x0375('0x1a')]?_0x12b7bc['body'][_0x0375('0x1a')]:'',_0x12b7bc['body']&&_0x12b7bc[_0x0375('0xc')][_0x0375('0x20')]?_0x12b7bc[_0x0375('0xc')]['agent_name']:'');},'ignoreRoute':function(_0x3fd640){var _0x4769fe=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4769fe[_0x0375('0x21')](_0x3fd640[_0x0375('0x14')]);}}));_0x2c3545[_0x0375('0x9')](_0x0375('0x22'),require(_0x0375('0x23')));_0x2c3545['use'](_0x0375('0x24'),require(_0x0375('0x25')));_0x2c3545[_0x0375('0x9')]('/api/voice/contexts',require('./api/voiceContext'));_0x2c3545[_0x0375('0x9')](_0x0375('0x26'),require(_0x0375('0x27')));_0x2c3545[_0x0375('0x9')](_0x0375('0x28'),require(_0x0375('0x29')));_0x2c3545['use']('/api/voice/queues',require(_0x0375('0x2a')));_0x2c3545[_0x0375('0x9')](_0x0375('0x2b'),require(_0x0375('0x2c')));_0x2c3545[_0x0375('0x9')](_0x0375('0x2d'),require(_0x0375('0x2e')));_0x2c3545[_0x0375('0x9')](_0x0375('0x2f'),require(_0x0375('0x30')));_0x2c3545[_0x0375('0x9')](_0x0375('0x31'),require(_0x0375('0x32')));_0x2c3545[_0x0375('0x9')](_0x0375('0x33'),require('./api/voiceCallReport'));_0x2c3545[_0x0375('0x9')](_0x0375('0x34'),require(_0x0375('0x35')));_0x2c3545['use']('/api/voice/agents/reports',require(_0x0375('0x36')));_0x2c3545[_0x0375('0x9')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x2c3545[_0x0375('0x9')](_0x0375('0x37'),require(_0x0375('0x38')));_0x2c3545[_0x0375('0x9')]('/api/trunks',require(_0x0375('0x39')));_0x2c3545[_0x0375('0x9')](_0x0375('0x3a'),require('./api/voiceTransferReport'));_0x2c3545[_0x0375('0x9')](_0x0375('0x3b'),require(_0x0375('0x3c')));_0x2c3545[_0x0375('0x9')](_0x0375('0x3d'),require(_0x0375('0x3e')));_0x2c3545[_0x0375('0x9')]('/api/mail/queues',require(_0x0375('0x3f')));_0x2c3545['use'](_0x0375('0x40'),require(_0x0375('0x41')));_0x2c3545[_0x0375('0x9')](_0x0375('0x42'),require('./api/mailInteraction'));_0x2c3545[_0x0375('0x9')](_0x0375('0x43'),require('./api/mailMessage'));_0x2c3545[_0x0375('0x9')]('/api/mail/applications',require(_0x0375('0x44')));_0x2c3545[_0x0375('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x2c3545[_0x0375('0x9')](_0x0375('0x45'),require(_0x0375('0x46')));_0x2c3545[_0x0375('0x9')](_0x0375('0x47'),require(_0x0375('0x48')));_0x2c3545[_0x0375('0x9')](_0x0375('0x49'),require(_0x0375('0x4a')));_0x2c3545[_0x0375('0x9')](_0x0375('0x4b'),require(_0x0375('0x4c')));_0x2c3545[_0x0375('0x9')](_0x0375('0x4d'),require('./api/faxInteraction'));_0x2c3545[_0x0375('0x9')](_0x0375('0x4e'),require(_0x0375('0x4f')));_0x2c3545[_0x0375('0x9')](_0x0375('0x50'),require('./api/faxQueue'));_0x2c3545[_0x0375('0x9')](_0x0375('0x51'),require(_0x0375('0x52')));_0x2c3545[_0x0375('0x9')](_0x0375('0x53'),require(_0x0375('0x54')));_0x2c3545[_0x0375('0x9')](_0x0375('0x55'),require(_0x0375('0x56')));_0x2c3545['use']('/api/sms/interactions',require(_0x0375('0x57')));_0x2c3545[_0x0375('0x9')](_0x0375('0x58'),require('./api/smsMessage'));_0x2c3545[_0x0375('0x9')](_0x0375('0x59'),require(_0x0375('0x5a')));_0x2c3545[_0x0375('0x9')](_0x0375('0x5b'),require(_0x0375('0x5c')));_0x2c3545[_0x0375('0x9')](_0x0375('0x5d'),require(_0x0375('0x5e')));_0x2c3545['use'](_0x0375('0x5f'),require(_0x0375('0x60')));_0x2c3545[_0x0375('0x9')](_0x0375('0x61'),require(_0x0375('0x62')));_0x2c3545[_0x0375('0x9')](_0x0375('0x63'),require('./api/openchannelQueue'));_0x2c3545[_0x0375('0x9')]('/api/chat/websites',require(_0x0375('0x64')));_0x2c3545['use'](_0x0375('0x65'),require(_0x0375('0x66')));_0x2c3545[_0x0375('0x9')]('/api/chat/applications',require(_0x0375('0x67')));_0x2c3545['use'](_0x0375('0x68'),require(_0x0375('0x69')));_0x2c3545['use'](_0x0375('0x6a'),require(_0x0375('0x6b')));_0x2c3545[_0x0375('0x9')](_0x0375('0x6c'),require(_0x0375('0x6d')));_0x2c3545[_0x0375('0x9')](_0x0375('0x6e'),require(_0x0375('0x6f')));_0x2c3545[_0x0375('0x9')](_0x0375('0x70'),require(_0x0375('0x71')));_0x2c3545[_0x0375('0x9')](_0x0375('0x72'),require(_0x0375('0x73')));_0x2c3545[_0x0375('0x9')](_0x0375('0x74'),require('./api/cmCompany'));_0x2c3545[_0x0375('0x9')](_0x0375('0x75'),require(_0x0375('0x76')));_0x2c3545['use']('/api/cm/hopper',require(_0x0375('0x77')));_0x2c3545[_0x0375('0x9')](_0x0375('0x78'),require(_0x0375('0x79')));_0x2c3545['use'](_0x0375('0x7a'),require(_0x0375('0x7b')));_0x2c3545[_0x0375('0x9')](_0x0375('0x7c'),require(_0x0375('0x7d')));_0x2c3545[_0x0375('0x9')](_0x0375('0x7e'),require(_0x0375('0x7f')));_0x2c3545['use'](_0x0375('0x80'),require(_0x0375('0x81')));_0x2c3545[_0x0375('0x9')]('/api/automations',require(_0x0375('0x82')));_0x2c3545[_0x0375('0x9')](_0x0375('0x83'),require(_0x0375('0x84')));_0x2c3545[_0x0375('0x9')](_0x0375('0x85'),require(_0x0375('0x86')));_0x2c3545['use'](_0x0375('0x87'),require('./api/condition'));_0x2c3545[_0x0375('0x9')](_0x0375('0x88'),require(_0x0375('0x89')));_0x2c3545[_0x0375('0x9')](_0x0375('0x8a'),require(_0x0375('0x8b')));_0x2c3545[_0x0375('0x9')]('/api/cdr',require(_0x0375('0x8c')));_0x2c3545[_0x0375('0x9')]('/api/voiceQueuesLog',require(_0x0375('0x8d')));_0x2c3545[_0x0375('0x9')](_0x0375('0x8e'),require(_0x0375('0x8f')));_0x2c3545[_0x0375('0x9')]('/api/sounds',require('./api/sound'));_0x2c3545[_0x0375('0x9')]('/api/tags',require(_0x0375('0x90')));_0x2c3545[_0x0375('0x9')](_0x0375('0x91'),require(_0x0375('0x92')));_0x2c3545['use'](_0x0375('0x93'),require(_0x0375('0x94')));_0x2c3545[_0x0375('0x9')]('/api/variables',require(_0x0375('0x95')));_0x2c3545[_0x0375('0x9')](_0x0375('0x96'),require(_0x0375('0x97')));_0x2c3545[_0x0375('0x9')](_0x0375('0x98'),require('./api/integrationReport'));_0x2c3545[_0x0375('0x9')](_0x0375('0x99'),require(_0x0375('0x9a')));_0x2c3545[_0x0375('0x9')](_0x0375('0x9b'),require(_0x0375('0x9c')));_0x2c3545[_0x0375('0x9')](_0x0375('0x9d'),require('./api/analyticExtractedReport'));_0x2c3545['use'](_0x0375('0x9e'),require('./api/analyticMetric'));_0x2c3545[_0x0375('0x9')](_0x0375('0x9f'),require(_0x0375('0xa0')));_0x2c3545[_0x0375('0x9')]('/api/analytics/tree_reports',require(_0x0375('0xa1')));_0x2c3545['use']('/api/integrations/salesforce/accounts',require(_0x0375('0xa2')));_0x2c3545[_0x0375('0x9')](_0x0375('0xa3'),require(_0x0375('0xa4')));_0x2c3545[_0x0375('0x9')](_0x0375('0xa5'),require(_0x0375('0xa6')));_0x2c3545[_0x0375('0x9')](_0x0375('0xa7'),require('./api/intSugarcrmAccount'));_0x2c3545['use'](_0x0375('0xa8'),require('./api/intSugarcrmConfiguration'));_0x2c3545[_0x0375('0x9')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x2c3545[_0x0375('0x9')]('/api/integrations/desk/accounts',require(_0x0375('0xa9')));_0x2c3545['use'](_0x0375('0xaa'),require(_0x0375('0xab')));_0x2c3545[_0x0375('0x9')](_0x0375('0xac'),require(_0x0375('0xad')));_0x2c3545[_0x0375('0x9')](_0x0375('0xae'),require(_0x0375('0xaf')));_0x2c3545[_0x0375('0x9')](_0x0375('0xb0'),require('./api/intZohoConfiguration'));_0x2c3545[_0x0375('0x9')](_0x0375('0xb1'),require(_0x0375('0xb2')));_0x2c3545[_0x0375('0x9')](_0x0375('0xb3'),require('./api/intZendeskAccount'));_0x2c3545[_0x0375('0x9')](_0x0375('0xb4'),require('./api/intZendeskConfiguration'));_0x2c3545['use'](_0x0375('0xb5'),require(_0x0375('0xb6')));_0x2c3545['use']('/api/integrations/freshdesk/accounts',require(_0x0375('0xb7')));_0x2c3545[_0x0375('0x9')]('/api/integrations/freshdesk/configurations',require(_0x0375('0xb8')));_0x2c3545[_0x0375('0x9')](_0x0375('0xb9'),require('./api/intFreshdeskField'));_0x2c3545[_0x0375('0x9')](_0x0375('0xba'),require(_0x0375('0xbb')));_0x2c3545['use'](_0x0375('0xbc'),require('./api/intVtigerConfiguration'));_0x2c3545[_0x0375('0x9')](_0x0375('0xbd'),require(_0x0375('0xbe')));_0x2c3545[_0x0375('0x9')](_0x0375('0xbf'),require(_0x0375('0xc0')));_0x2c3545[_0x0375('0x9')](_0x0375('0xc1'),require('./api/intServicenowConfiguration'));_0x2c3545[_0x0375('0x9')](_0x0375('0xc2'),require(_0x0375('0xc3')));_0x2c3545[_0x0375('0x9')](_0x0375('0xc4'),require(_0x0375('0xc5')));_0x2c3545[_0x0375('0x9')](_0x0375('0xc6'),require(_0x0375('0xc7')));_0x2c3545['use'](_0x0375('0xc8'),require('./api/intDynamics365Field'));_0x2c3545[_0x0375('0x9')]('/api/integrations/freshsales/accounts',require(_0x0375('0xc9')));_0x2c3545['use'](_0x0375('0xca'),require(_0x0375('0xcb')));_0x2c3545[_0x0375('0x9')](_0x0375('0xcc'),require(_0x0375('0xcd')));_0x2c3545[_0x0375('0x9')]('/api/networks',require(_0x0375('0xce')));_0x2c3545[_0x0375('0x9')](_0x0375('0xcf'),require(_0x0375('0xd0')));_0x2c3545[_0x0375('0x9')](_0x0375('0xd1'),require('./api/chatInternalMessage'));_0x2c3545[_0x0375('0x9')](_0x0375('0xd2'),require(_0x0375('0xd3')));_0x2c3545[_0x0375('0x9')](_0x0375('0xd4'),require(_0x0375('0xd5')));_0x2c3545[_0x0375('0x9')](_0x0375('0xd6'),require(_0x0375('0xd7')));_0x2c3545[_0x0375('0x9')](_0x0375('0xd8'),require(_0x0375('0xd9')));_0x2c3545[_0x0375('0x9')](_0x0375('0xda'),require(_0x0375('0xdb')));_0x2c3545[_0x0375('0x9')](_0x0375('0xdc'),require(_0x0375('0xdd')));_0x2c3545[_0x0375('0x9')](_0x0375('0xde'),require('./api/jscriptyProject'));_0x2c3545['use'](_0x0375('0xdf'),require(_0x0375('0xe0')));_0x2c3545['use'](_0x0375('0xe1'),require(_0x0375('0xe2')));_0x2c3545[_0x0375('0x9')]('/api/square/projects',require('./api/squareProject'));_0x2c3545[_0x0375('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x2c3545[_0x0375('0x9')](_0x0375('0xe3'),require('./api/squareMessage'));_0x2c3545[_0x0375('0x9')](_0x0375('0xe4'),require('./api/team'));_0x2c3545['use'](_0x0375('0xe5'),require(_0x0375('0xe6')));_0x2c3545[_0x0375('0x9')](_0x0375('0xe7'),require('./api/campaign'));_0x2c3545[_0x0375('0x9')](_0x0375('0xe8'),require(_0x0375('0xe9')));_0x2c3545[_0x0375('0x9')]('/api/attachments',require(_0x0375('0xea')));_0x2c3545[_0x0375('0x9')](_0x0375('0xeb'),require(_0x0375('0xec')));_0x2c3545[_0x0375('0x9')]('/api/mail/reports/transfer',require(_0x0375('0xed')));_0x2c3545[_0x0375('0x9')](_0x0375('0xee'),require(_0x0375('0xef')));_0x2c3545[_0x0375('0x9')]('/api/fax/reports/transfer',require(_0x0375('0xf0')));_0x2c3545['use'](_0x0375('0xf1'),require(_0x0375('0xf2')));_0x2c3545[_0x0375('0x9')](_0x0375('0xf3'),require(_0x0375('0xf4')));_0x2c3545[_0x0375('0x9')](_0x0375('0xf5'),require(_0x0375('0xf6')));_0x2c3545[_0x0375('0x9')](_0x0375('0xf7'),require(_0x0375('0xf8')));_0x2c3545[_0x0375('0x9')](_0x0375('0xf9'),require(_0x0375('0xfa')));_0x2c3545[_0x0375('0x9')](_0x0375('0xfb'),require('./api/userProfileSection'));_0x2c3545[_0x0375('0x9')]('/api/userProfile/resources',require(_0x0375('0xfc')));_0x2c3545[_0x0375('0x9')](_0x0375('0xfd'),require(_0x0375('0xfe')));_0x2c3545[_0x0375('0x9')](_0x0375('0xff'),require(_0x0375('0x100')));_0x2c3545['use'](_0x0375('0x101'),require(_0x0375('0x102')));_0x2c3545['use'](_0x0375('0x103'),require(_0x0375('0x104')));_0x2c3545[_0x0375('0x9')](_0x0375('0x105'),require('./api/whatsappMessage'));_0x2c3545[_0x0375('0x9')](_0x0375('0x106'),require(_0x0375('0x107')));_0x2c3545['use'](_0x0375('0x108'),require(_0x0375('0x109')));_0x2c3545['use'](_0x0375('0x10a'),require(_0x0375('0x10b')));_0x2c3545[_0x0375('0x9')](_0x0375('0x10c'),require(_0x0375('0x10d')));_0x2c3545['use'](_0x0375('0x10e'),require(_0x0375('0x10f')));_0x2c3545[_0x0375('0x9')](_0x0375('0x110'),require(_0x0375('0x111')));_0x2c3545[_0x0375('0x9')](_0x0375('0x112'),require('./api/authGoogle'));_0x2c3545[_0x0375('0x9')](_0x0375('0x113'),require(_0x0375('0x114')));_0x2c3545['use']('/api/rpc',require('./api/rpc'));_0x2c3545[_0x0375('0x9')](_0x0375('0x115'),require(_0x0375('0x116')));_0x2c3545['use']('/api/system',require('./api/system'));_0x2c3545[_0x0375('0x9')](_0x0375('0x117'),require(_0x0375('0x118')));_0x2c3545[_0x0375('0x9')]('/api/webbar',require('./api/webbar'));_0x2c3545[_0x0375('0x9')](_0x0375('0x119'),express[_0x0375('0x11a')](path['join'](config[_0x0375('0x11b')],_0x0375('0x119'))));_0x2c3545['use'](_0x0375('0x11c'),express[_0x0375('0x11a')](path['join'](config[_0x0375('0x11b')],_0x0375('0x11c'))));_0x2c3545['use'](_0x0375('0x11d'),express['static'](path[_0x0375('0x11e')](config[_0x0375('0x11b')],'/demo')));_0x2c3545[_0x0375('0x9')](_0x0375('0x11f'),express[_0x0375('0x11a')](path[_0x0375('0x11e')](config[_0x0375('0x11b')],_0x0375('0x120'),_0x0375('0x121'))));_0x2c3545[_0x0375('0x9')](_0x0375('0x122'),express[_0x0375('0x11a')](path[_0x0375('0x11e')](config['root'],_0x0375('0x123'))));_0x2c3545[_0x0375('0x124')](_0x0375('0x125'))['get'](errors[0x194]);_0x2c3545[_0x0375('0x124')]('/*')['get'](function(_0x231e99,_0x3c32d3){_0x3c32d3[_0x0375('0x126')](path[_0x0375('0x127')](_0x2c3545[_0x0375('0x128')](_0x0375('0x129'))+_0x0375('0x12a')));});};var sensitiveFields=[_0x0375('0x12b'),'password',_0x0375('0x12c'),_0x0375('0x12d'),_0x0375('0x12e'),_0x0375('0x12f'),_0x0375('0x130'),_0x0375('0x131'),_0x0375('0x132'),_0x0375('0x133'),_0x0375('0x134'),'clientId','clientSecret',_0x0375('0x135'),_0x0375('0x136'),_0x0375('0x137'),_0x0375('0x138'),'token',_0x0375('0x139'),_0x0375('0x13a'),'accessTokenSecret','authToken',_0x0375('0x13b'),_0x0375('0x13c'),_0x0375('0x13d'),_0x0375('0x13e'),_0x0375('0x13f'),_0x0375('0x140'),_0x0375('0x141'),'clientEmail','privateKey',_0x0375('0x142'),_0x0375('0x143'),_0x0375('0x144'),_0x0375('0x16'),'pass',_0x0375('0x145'),'localstationid',_0x0375('0x146'),_0x0375('0x147'),_0x0375('0x148'),'oldPassword'];function maskSensitiveData(_0x33dec2){var _0xd4d9fd=/(?!^)[\s\S](?!$)/g;if(!_[_0x0375('0x149')](_0x33dec2))return;for(var _0x45fb44 in _0x33dec2){if(_[_0x0375('0x14a')](_0x33dec2[_0x45fb44])){for(var _0x4b6b54=0x0;_0x4b6b54<_0x33dec2[_0x45fb44][_0x0375('0x14b')];_0x4b6b54++){maskSensitiveData(_0x33dec2[_0x45fb44][_0x4b6b54]);}}else if(_[_0x0375('0x149')](_0x33dec2[_0x45fb44])){maskSensitiveData(_0x33dec2[_0x45fb44]);}else if(_['isString'](_0x33dec2[_0x45fb44])){_0x33dec2[_0x45fb44]=_0x33dec2[_0x45fb44]['replace'](/{{{/g,_0x0375('0x14c'))[_0x0375('0x14d')](/}}}/g,_0x0375('0x14e'))[_0x0375('0x14d')](/{{/g,'@{')[_0x0375('0x14d')](/}}/g,'}@');if(_[_0x0375('0x14f')](sensitiveFields,_0x45fb44)){_0x33dec2[_0x45fb44]=_0x33dec2[_0x45fb44][_0x0375('0x14d')](_0xd4d9fd,'*');}}}} \ No newline at end of file +var _0xc878=['/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','newPassword','apiKey','firstName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString','@@{','}@@','replace','includes','express','express-winston','util','./config/environment','api','./config/logger','auth','./safe-template','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','method','headers','x-forwarded-for','url','statusCode','responseTime','user','name','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','connection','remoteAddress','role','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts'];(function(_0x32faa6,_0x231c1f){var _0x1526dd=function(_0x53627b){while(--_0x53627b){_0x32faa6['push'](_0x32faa6['shift']());}};_0x1526dd(++_0x231c1f);}(_0xc878,0x10f));var _0x8c87=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0xc878[_0x172660];return _0x83204f;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0x8c87('0x0'));var ewinston=require(_0x8c87('0x1'));var util=require(_0x8c87('0x2'));var errors=require('./errors');var config=require(_0x8c87('0x3'));var logger=require('./config/logger')(_0x8c87('0x4'));var authLogger=require(_0x8c87('0x5'))(_0x8c87('0x6'));var safeTemplate=require(_0x8c87('0x7'))['safeTemplate'];exports[_0x8c87('0x8')]=function(_0x306936){_0x306936[_0x8c87('0x9')](ewinston[_0x8c87('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3896ed,_0x3ed783){var _0x4fc520=_0x8c87('0xb');if(!_[_0x8c87('0xc')](_0x3896ed['body'])){_0x4fc520+='\x20body=%s';var _0x41a4b0=_0x3896ed[_0x8c87('0xd')];maskSensitiveData(_0x41a4b0);}return safeTemplate(util['format'](_0x4fc520,_0x3896ed[_0x8c87('0xe')],_0x3896ed[_0x8c87('0xf')][_0x8c87('0x10')]?_0x3896ed[_0x8c87('0xf')][_0x8c87('0x10')]:_0x3896ed['connection']['remoteAddress']||_0x3896ed['ip'],_0x3896ed[_0x8c87('0x11')],_0x3ed783[_0x8c87('0x12')],_0x3ed783[_0x8c87('0x13')],_0x3896ed[_0x8c87('0x14')]?_0x3896ed[_0x8c87('0x14')]['id']:null,_0x3896ed[_0x8c87('0x14')]?_0x3896ed['user'][_0x8c87('0x15')]:null,_0x3896ed[_0x8c87('0x14')]?_0x3896ed[_0x8c87('0x14')]['role']:null,_0x41a4b0?util[_0x8c87('0x16')](_0x41a4b0,![],null):''));}}));_0x306936[_0x8c87('0x9')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x563bc1,_0x58283d){var _0x21d87f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x563bc1[_0x8c87('0xd')]&&_0x563bc1[_0x8c87('0xd')][_0x8c87('0x17')]&&_0x563bc1[_0x8c87('0xd')][_0x8c87('0x18')]){_0x21d87f=_0x8c87('0x19');}return util[_0x8c87('0x1a')](_0x21d87f,_0x563bc1['method'],_0x563bc1[_0x8c87('0xf')][_0x8c87('0x10')]?_0x563bc1['headers'][_0x8c87('0x10')]:_0x563bc1[_0x8c87('0x1b')][_0x8c87('0x1c')]||_0x563bc1['ip'],_0x563bc1[_0x8c87('0x11')],_0x58283d[_0x8c87('0x12')],_0x58283d['responseTime'],_0x563bc1[_0x8c87('0x14')]?_0x563bc1[_0x8c87('0x14')]['id']:null,_0x563bc1[_0x8c87('0x14')]?_0x563bc1[_0x8c87('0x14')][_0x8c87('0x15')]:null,_0x563bc1[_0x8c87('0x14')]?_0x563bc1[_0x8c87('0x14')][_0x8c87('0x1d')]:null,_0x563bc1[_0x8c87('0xd')]&&_0x563bc1[_0x8c87('0xd')][_0x8c87('0x17')]?_0x563bc1[_0x8c87('0xd')][_0x8c87('0x17')]:'other',_0x563bc1[_0x8c87('0xd')]&&_0x563bc1['body']['agent_id']?_0x563bc1['body'][_0x8c87('0x18')]:'',_0x563bc1['body']&&_0x563bc1[_0x8c87('0xd')][_0x8c87('0x1e')]?_0x563bc1[_0x8c87('0xd')]['agent_name']:'');},'ignoreRoute':function(_0x32d62f){var _0x3bf41b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf41b[_0x8c87('0x1f')](_0x32d62f[_0x8c87('0x11')]);}}));_0x306936[_0x8c87('0x9')](_0x8c87('0x20'),require('./api/user'));_0x306936[_0x8c87('0x9')](_0x8c87('0x21'),require(_0x8c87('0x22')));_0x306936[_0x8c87('0x9')]('/api/voice/contexts',require('./api/voiceContext'));_0x306936[_0x8c87('0x9')](_0x8c87('0x23'),require(_0x8c87('0x24')));_0x306936[_0x8c87('0x9')]('/api/voice/mohs',require(_0x8c87('0x25')));_0x306936[_0x8c87('0x9')](_0x8c87('0x26'),require(_0x8c87('0x27')));_0x306936[_0x8c87('0x9')](_0x8c87('0x28'),require('./api/voiceRecording'));_0x306936[_0x8c87('0x9')](_0x8c87('0x29'),require(_0x8c87('0x2a')));_0x306936['use'](_0x8c87('0x2b'),require(_0x8c87('0x2c')));_0x306936[_0x8c87('0x9')]('/api/voice/mails/messages',require(_0x8c87('0x2d')));_0x306936[_0x8c87('0x9')](_0x8c87('0x2e'),require('./api/voiceCallReport'));_0x306936[_0x8c87('0x9')]('/api/voice/dials/reports',require(_0x8c87('0x2f')));_0x306936[_0x8c87('0x9')](_0x8c87('0x30'),require(_0x8c87('0x31')));_0x306936[_0x8c87('0x9')]('/api/voice/queues/reports',require(_0x8c87('0x32')));_0x306936[_0x8c87('0x9')](_0x8c87('0x33'),require(_0x8c87('0x34')));_0x306936[_0x8c87('0x9')](_0x8c87('0x35'),require(_0x8c87('0x36')));_0x306936[_0x8c87('0x9')](_0x8c87('0x37'),require(_0x8c87('0x38')));_0x306936[_0x8c87('0x9')](_0x8c87('0x39'),require(_0x8c87('0x3a')));_0x306936[_0x8c87('0x9')](_0x8c87('0x3b'),require('./api/mailAccount'));_0x306936[_0x8c87('0x9')](_0x8c87('0x3c'),require(_0x8c87('0x3d')));_0x306936[_0x8c87('0x9')](_0x8c87('0x3e'),require('./api/mailSubstatus'));_0x306936[_0x8c87('0x9')](_0x8c87('0x3f'),require(_0x8c87('0x40')));_0x306936['use'](_0x8c87('0x41'),require('./api/mailMessage'));_0x306936[_0x8c87('0x9')](_0x8c87('0x42'),require(_0x8c87('0x43')));_0x306936[_0x8c87('0x9')](_0x8c87('0x44'),require('./api/mailQueueReport'));_0x306936[_0x8c87('0x9')](_0x8c87('0x45'),require(_0x8c87('0x46')));_0x306936[_0x8c87('0x9')](_0x8c87('0x47'),require('./api/dashboardItem'));_0x306936[_0x8c87('0x9')](_0x8c87('0x48'),require(_0x8c87('0x49')));_0x306936['use'](_0x8c87('0x4a'),require(_0x8c87('0x4b')));_0x306936[_0x8c87('0x9')](_0x8c87('0x4c'),require(_0x8c87('0x4d')));_0x306936[_0x8c87('0x9')](_0x8c87('0x4e'),require(_0x8c87('0x4f')));_0x306936[_0x8c87('0x9')](_0x8c87('0x50'),require(_0x8c87('0x51')));_0x306936['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x306936[_0x8c87('0x9')](_0x8c87('0x52'),require(_0x8c87('0x53')));_0x306936['use'](_0x8c87('0x54'),require(_0x8c87('0x55')));_0x306936[_0x8c87('0x9')]('/api/sms/interactions',require(_0x8c87('0x56')));_0x306936[_0x8c87('0x9')](_0x8c87('0x57'),require(_0x8c87('0x58')));_0x306936[_0x8c87('0x9')](_0x8c87('0x59'),require(_0x8c87('0x5a')));_0x306936[_0x8c87('0x9')](_0x8c87('0x5b'),require(_0x8c87('0x5c')));_0x306936[_0x8c87('0x9')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x306936[_0x8c87('0x9')](_0x8c87('0x5d'),require(_0x8c87('0x5e')));_0x306936[_0x8c87('0x9')](_0x8c87('0x5f'),require('./api/openchannelMessage'));_0x306936[_0x8c87('0x9')](_0x8c87('0x60'),require(_0x8c87('0x61')));_0x306936['use'](_0x8c87('0x62'),require(_0x8c87('0x63')));_0x306936['use']('/api/openchannel/reports/queue',require(_0x8c87('0x64')));_0x306936['use'](_0x8c87('0x65'),require(_0x8c87('0x66')));_0x306936[_0x8c87('0x9')]('/api/chat/interactions',require(_0x8c87('0x67')));_0x306936['use']('/api/chat/messages',require(_0x8c87('0x68')));_0x306936[_0x8c87('0x9')](_0x8c87('0x69'),require(_0x8c87('0x6a')));_0x306936['use'](_0x8c87('0x6b'),require(_0x8c87('0x6c')));_0x306936['use'](_0x8c87('0x6d'),require(_0x8c87('0x6e')));_0x306936['use'](_0x8c87('0x6f'),require('./api/chatProactiveAction'));_0x306936[_0x8c87('0x9')](_0x8c87('0x70'),require('./api/cmCompany'));_0x306936[_0x8c87('0x9')](_0x8c87('0x71'),require(_0x8c87('0x72')));_0x306936[_0x8c87('0x9')](_0x8c87('0x73'),require(_0x8c87('0x74')));_0x306936[_0x8c87('0x9')](_0x8c87('0x75'),require('./api/cmHopperBlack'));_0x306936[_0x8c87('0x9')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x306936[_0x8c87('0x9')](_0x8c87('0x76'),require(_0x8c87('0x77')));_0x306936[_0x8c87('0x9')]('/api/cm/custom_fields',require(_0x8c87('0x78')));_0x306936['use'](_0x8c87('0x79'),require(_0x8c87('0x7a')));_0x306936['use'](_0x8c87('0x7b'),require('./api/automation'));_0x306936['use'](_0x8c87('0x7c'),require(_0x8c87('0x7d')));_0x306936[_0x8c87('0x9')](_0x8c87('0x7e'),require(_0x8c87('0x7f')));_0x306936[_0x8c87('0x9')](_0x8c87('0x80'),require(_0x8c87('0x81')));_0x306936[_0x8c87('0x9')]('/api/intervals',require(_0x8c87('0x82')));_0x306936[_0x8c87('0x9')](_0x8c87('0x83'),require(_0x8c87('0x84')));_0x306936[_0x8c87('0x9')](_0x8c87('0x85'),require(_0x8c87('0x86')));_0x306936[_0x8c87('0x9')](_0x8c87('0x87'),require('./api/voiceQueuesLog'));_0x306936[_0x8c87('0x9')](_0x8c87('0x88'),require('./api/schedule'));_0x306936[_0x8c87('0x9')](_0x8c87('0x89'),require(_0x8c87('0x8a')));_0x306936[_0x8c87('0x9')](_0x8c87('0x8b'),require('./api/tag'));_0x306936[_0x8c87('0x9')](_0x8c87('0x8c'),require(_0x8c87('0x8d')));_0x306936[_0x8c87('0x9')]('/api/triggers',require(_0x8c87('0x8e')));_0x306936['use'](_0x8c87('0x8f'),require('./api/variable'));_0x306936[_0x8c87('0x9')]('/api/integrations',require('./api/integration'));_0x306936[_0x8c87('0x9')](_0x8c87('0x90'),require(_0x8c87('0x91')));_0x306936[_0x8c87('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x306936[_0x8c87('0x9')](_0x8c87('0x92'),require(_0x8c87('0x93')));_0x306936[_0x8c87('0x9')](_0x8c87('0x94'),require(_0x8c87('0x95')));_0x306936[_0x8c87('0x9')](_0x8c87('0x96'),require(_0x8c87('0x97')));_0x306936[_0x8c87('0x9')](_0x8c87('0x98'),require(_0x8c87('0x99')));_0x306936[_0x8c87('0x9')](_0x8c87('0x9a'),require('./api/analyticTreeReport'));_0x306936[_0x8c87('0x9')](_0x8c87('0x9b'),require(_0x8c87('0x9c')));_0x306936[_0x8c87('0x9')](_0x8c87('0x9d'),require(_0x8c87('0x9e')));_0x306936[_0x8c87('0x9')](_0x8c87('0x9f'),require(_0x8c87('0xa0')));_0x306936[_0x8c87('0x9')](_0x8c87('0xa1'),require(_0x8c87('0xa2')));_0x306936[_0x8c87('0x9')](_0x8c87('0xa3'),require(_0x8c87('0xa4')));_0x306936['use'](_0x8c87('0xa5'),require('./api/intSugarcrmField'));_0x306936[_0x8c87('0x9')](_0x8c87('0xa6'),require(_0x8c87('0xa7')));_0x306936['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x306936[_0x8c87('0x9')](_0x8c87('0xa8'),require('./api/intDeskField'));_0x306936[_0x8c87('0x9')](_0x8c87('0xa9'),require('./api/intZohoAccount'));_0x306936[_0x8c87('0x9')](_0x8c87('0xaa'),require('./api/intZohoConfiguration'));_0x306936[_0x8c87('0x9')]('/api/integrations/zoho/fields',require(_0x8c87('0xab')));_0x306936['use']('/api/integrations/zendesk/accounts',require(_0x8c87('0xac')));_0x306936[_0x8c87('0x9')](_0x8c87('0xad'),require(_0x8c87('0xae')));_0x306936[_0x8c87('0x9')](_0x8c87('0xaf'),require(_0x8c87('0xb0')));_0x306936[_0x8c87('0x9')](_0x8c87('0xb1'),require(_0x8c87('0xb2')));_0x306936[_0x8c87('0x9')](_0x8c87('0xb3'),require('./api/intFreshdeskConfiguration'));_0x306936[_0x8c87('0x9')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x306936['use'](_0x8c87('0xb4'),require('./api/intVtigerAccount'));_0x306936[_0x8c87('0x9')]('/api/integrations/vtiger/configurations',require(_0x8c87('0xb5')));_0x306936[_0x8c87('0x9')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x306936[_0x8c87('0x9')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x306936[_0x8c87('0x9')]('/api/integrations/servicenow/configurations',require(_0x8c87('0xb6')));_0x306936[_0x8c87('0x9')](_0x8c87('0xb7'),require(_0x8c87('0xb8')));_0x306936[_0x8c87('0x9')](_0x8c87('0xb9'),require(_0x8c87('0xba')));_0x306936['use'](_0x8c87('0xbb'),require('./api/intDynamics365Configuration'));_0x306936[_0x8c87('0x9')](_0x8c87('0xbc'),require(_0x8c87('0xbd')));_0x306936[_0x8c87('0x9')](_0x8c87('0xbe'),require('./api/intFreshsalesAccount'));_0x306936[_0x8c87('0x9')](_0x8c87('0xbf'),require(_0x8c87('0xc0')));_0x306936[_0x8c87('0x9')](_0x8c87('0xc1'),require('./api/intFreshsalesField'));_0x306936[_0x8c87('0x9')](_0x8c87('0xc2'),require('./api/network'));_0x306936[_0x8c87('0x9')](_0x8c87('0xc3'),require(_0x8c87('0xc4')));_0x306936[_0x8c87('0x9')](_0x8c87('0xc5'),require(_0x8c87('0xc6')));_0x306936[_0x8c87('0x9')](_0x8c87('0xc7'),require(_0x8c87('0xc8')));_0x306936[_0x8c87('0x9')](_0x8c87('0xc9'),require(_0x8c87('0xca')));_0x306936['use'](_0x8c87('0xcb'),require(_0x8c87('0xcc')));_0x306936[_0x8c87('0x9')](_0x8c87('0xcd'),require(_0x8c87('0xce')));_0x306936['use'](_0x8c87('0xcf'),require(_0x8c87('0xd0')));_0x306936[_0x8c87('0x9')](_0x8c87('0xd1'),require(_0x8c87('0xd2')));_0x306936[_0x8c87('0x9')](_0x8c87('0xd3'),require(_0x8c87('0xd4')));_0x306936[_0x8c87('0x9')](_0x8c87('0xd5'),require(_0x8c87('0xd6')));_0x306936[_0x8c87('0x9')](_0x8c87('0xd7'),require(_0x8c87('0xd8')));_0x306936[_0x8c87('0x9')]('/api/square/projects',require(_0x8c87('0xd9')));_0x306936[_0x8c87('0x9')](_0x8c87('0xda'),require(_0x8c87('0xdb')));_0x306936[_0x8c87('0x9')](_0x8c87('0xdc'),require(_0x8c87('0xdd')));_0x306936['use']('/api/teams',require(_0x8c87('0xde')));_0x306936['use']('/api/license',require(_0x8c87('0xdf')));_0x306936[_0x8c87('0x9')](_0x8c87('0xe0'),require('./api/campaign'));_0x306936[_0x8c87('0x9')](_0x8c87('0xe1'),require(_0x8c87('0xe2')));_0x306936[_0x8c87('0x9')]('/api/attachments',require(_0x8c87('0xe3')));_0x306936[_0x8c87('0x9')]('/api/plugins',require(_0x8c87('0xe4')));_0x306936[_0x8c87('0x9')](_0x8c87('0xe5'),require(_0x8c87('0xe6')));_0x306936[_0x8c87('0x9')]('/api/chat/reports/transfer',require(_0x8c87('0xe7')));_0x306936[_0x8c87('0x9')](_0x8c87('0xe8'),require(_0x8c87('0xe9')));_0x306936[_0x8c87('0x9')](_0x8c87('0xea'),require(_0x8c87('0xeb')));_0x306936[_0x8c87('0x9')](_0x8c87('0xec'),require(_0x8c87('0xed')));_0x306936[_0x8c87('0x9')]('/api/cm/lists',require(_0x8c87('0xee')));_0x306936[_0x8c87('0x9')](_0x8c87('0xef'),require(_0x8c87('0xf0')));_0x306936[_0x8c87('0x9')]('/api/userProfiles',require('./api/userProfile'));_0x306936[_0x8c87('0x9')](_0x8c87('0xf1'),require(_0x8c87('0xf2')));_0x306936[_0x8c87('0x9')](_0x8c87('0xf3'),require('./api/userProfileResource'));_0x306936[_0x8c87('0x9')](_0x8c87('0xf4'),require(_0x8c87('0xf5')));_0x306936['use'](_0x8c87('0xf6'),require(_0x8c87('0xf7')));_0x306936[_0x8c87('0x9')](_0x8c87('0xf8'),require('./api/whatsappApplication'));_0x306936['use'](_0x8c87('0xf9'),require(_0x8c87('0xfa')));_0x306936[_0x8c87('0x9')](_0x8c87('0xfb'),require(_0x8c87('0xfc')));_0x306936['use'](_0x8c87('0xfd'),require(_0x8c87('0xfe')));_0x306936['use']('/api/whatsapp/reports/transfer',require(_0x8c87('0xff')));_0x306936['use']('/api/whatsapp/queues',require(_0x8c87('0x100')));_0x306936[_0x8c87('0x9')](_0x8c87('0x101'),require(_0x8c87('0x102')));_0x306936['use'](_0x8c87('0x103'),require('./api/realtime'));_0x306936[_0x8c87('0x9')]('/api/auth/local',require(_0x8c87('0x104')));_0x306936[_0x8c87('0x9')](_0x8c87('0x105'),require(_0x8c87('0x106')));_0x306936['use'](_0x8c87('0x107'),require(_0x8c87('0x108')));_0x306936[_0x8c87('0x9')](_0x8c87('0x109'),require(_0x8c87('0x10a')));_0x306936[_0x8c87('0x9')](_0x8c87('0x10b'),require(_0x8c87('0x10c')));_0x306936[_0x8c87('0x9')](_0x8c87('0x10d'),require(_0x8c87('0x10e')));_0x306936['use'](_0x8c87('0x10f'),require(_0x8c87('0x110')));_0x306936['use'](_0x8c87('0x111'),require(_0x8c87('0x112')));_0x306936[_0x8c87('0x9')]('/apidoc',express[_0x8c87('0x113')](path[_0x8c87('0x114')](config[_0x8c87('0x115')],_0x8c87('0x116'))));_0x306936[_0x8c87('0x9')](_0x8c87('0x117'),express[_0x8c87('0x113')](path[_0x8c87('0x114')](config[_0x8c87('0x115')],_0x8c87('0x117'))));_0x306936[_0x8c87('0x9')](_0x8c87('0x118'),express[_0x8c87('0x113')](path[_0x8c87('0x114')](config[_0x8c87('0x115')],_0x8c87('0x118'))));_0x306936['use'](_0x8c87('0x119'),express[_0x8c87('0x113')](path[_0x8c87('0x114')](config[_0x8c87('0x115')],_0x8c87('0x11a'),_0x8c87('0x11b'))));_0x306936[_0x8c87('0x9')](_0x8c87('0x11c'),express[_0x8c87('0x113')](path[_0x8c87('0x114')](config['root'],_0x8c87('0x11d'))));_0x306936[_0x8c87('0x11e')](_0x8c87('0x11f'))[_0x8c87('0x120')](errors[0x194]);_0x306936[_0x8c87('0x11e')]('/*')[_0x8c87('0x120')](function(_0x1865f6,_0x21d741){_0x21d741['sendFile'](path[_0x8c87('0x121')](_0x306936[_0x8c87('0x120')](_0x8c87('0x122'))+_0x8c87('0x123')));});};var sensitiveFields=[_0x8c87('0x124'),'password',_0x8c87('0x125'),_0x8c87('0x126'),_0x8c87('0x127'),'lastName',_0x8c87('0x128'),_0x8c87('0x129'),_0x8c87('0x12a'),_0x8c87('0x12b'),'email',_0x8c87('0x12c'),_0x8c87('0x12d'),_0x8c87('0x12e'),_0x8c87('0x12f'),_0x8c87('0x130'),_0x8c87('0x131'),_0x8c87('0x132'),'channelSecret','accessToken',_0x8c87('0x133'),'authToken',_0x8c87('0x134'),_0x8c87('0x135'),_0x8c87('0x136'),_0x8c87('0x137'),'calleridnum','exten',_0x8c87('0x138'),_0x8c87('0x139'),_0x8c87('0x13a'),_0x8c87('0x13b'),_0x8c87('0x13c'),_0x8c87('0x13d'),'user','pass',_0x8c87('0x13e'),_0x8c87('0x13f'),_0x8c87('0x140'),_0x8c87('0x141'),_0x8c87('0x142'),'oldPassword'];function maskSensitiveData(_0x42b861){var _0x3d1f61=/(?!^)[\s\S](?!$)/g;if(!_[_0x8c87('0x143')](_0x42b861))return;for(var _0x40c249 in _0x42b861){if(_[_0x8c87('0x144')](_0x42b861[_0x40c249])){for(var _0x3e6c6a=0x0;_0x3e6c6a<_0x42b861[_0x40c249][_0x8c87('0x145')];_0x3e6c6a++){maskSensitiveData(_0x42b861[_0x40c249][_0x3e6c6a]);}}else if(_[_0x8c87('0x143')](_0x42b861[_0x40c249])){maskSensitiveData(_0x42b861[_0x40c249]);}else if(_[_0x8c87('0x146')](_0x42b861[_0x40c249])){_0x42b861[_0x40c249]=_0x42b861[_0x40c249]['replace'](/{{{/g,_0x8c87('0x147'))['replace'](/}}}/g,_0x8c87('0x148'))[_0x8c87('0x149')](/{{/g,'@{')[_0x8c87('0x149')](/}}/g,'}@');if(_[_0x8c87('0x14a')](sensitiveFields,_0x40c249)){_0x42b861[_0x40c249]=_0x42b861[_0x40c249][_0x8c87('0x149')](_0x3d1f61,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index eda9fe8..2dc2f21 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dbc=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/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','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1dbc,0x14d));var _0xc1db=function(_0x4a8c17,_0x494a23){_0x4a8c17=_0x4a8c17-0x0;var _0x584d5e=_0x1dbc[_0x4a8c17];return _0x584d5e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc1db('0x0'));var _=require(_0xc1db('0x1'));var config=require(_0xc1db('0x2'));exports[_0xc1db('0x3')]=function(){return new BPromise(function(_0x4ee68b,_0x2bfa4b){var _0x3b68ba={};_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x5')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/voiceExtension/voiceExtension.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/voiceQueue/voiceQueue.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/voiceRecording/voiceRecording.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x6')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x7')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x8')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x9')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0xa')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0xb')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0xc')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/mailAccount/mailAccount.rpc'));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0xd')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0xe')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0xf')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x10')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x11')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x12')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x13')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x14')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/faxMessage/faxMessage.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x15')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x16')));_0x3b68ba=_['merge'](_0x3b68ba,require('../api/smsAccount/smsAccount.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/smsInteraction/smsInteraction.rpc'));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x17')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x18')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x19')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x1a')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x1b')));_0x3b68ba=_['merge'](_0x3b68ba,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x1c')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x1d')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x1e')));_0x3b68ba=_['merge'](_0x3b68ba,require('../api/chatQueue/chatQueue.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x1f')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x20')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x21')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x22')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x23')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x24')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/interval/interval.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x25')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x26')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x27')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/trigger/trigger.rpc'));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x28')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x29')));_0x3b68ba=_['merge'](_0x3b68ba,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x2a')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x2b')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x2c')));_0x3b68ba=_['merge'](_0x3b68ba,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x2d')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x2e')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x2f')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x30')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x31')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x32')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x33')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x34')));_0x3b68ba=_['merge'](_0x3b68ba,require('../api/squareProject/squareProject.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x35')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x36')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x37')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x38')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x39')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x3a')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require(_0xc1db('0x3b')));_0x3b68ba=_['merge'](_0x3b68ba,require(_0xc1db('0x3c')));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3b68ba=_[_0xc1db('0x4')](_0x3b68ba,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2f8d92=jayson[_0xc1db('0x3d')](_0x3b68ba)[_0xc1db('0x3e')]();var _0x25d3c3=config[_0xc1db('0x3f')][_0xc1db('0x40')]||config[_0xc1db('0x40')]+0x1;var _0x49d1ec=config[_0xc1db('0x3f')]['ip']||'localhost';_0x2f8d92['on'](_0xc1db('0x41'),function(_0x6b9408){return _0x2bfa4b(_0x6b9408);});_0x2f8d92[_0xc1db('0x3')](_0x25d3c3,_0x49d1ec,function(){console[_0xc1db('0x42')](_0xc1db('0x43'),_0x49d1ec,_0x25d3c3);require(_0xc1db('0x44'))['default']();return _0x4ee68b(_0xc1db('0x45')+_0x49d1ec+':'+_0x25d3c3);});});}; \ No newline at end of file +var _0xcdd9=['../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.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/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/pause/pause.rpc','../api/sound/sound.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/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash'];(function(_0x3e0eb4,_0x5ec60a){var _0x5c2e15=function(_0x5d9ef9){while(--_0x5d9ef9){_0x3e0eb4['push'](_0x3e0eb4['shift']());}};_0x5c2e15(++_0x5ec60a);}(_0xcdd9,0x8e));var _0x9cdd=function(_0x44dc0c,_0x13abae){_0x44dc0c=_0x44dc0c-0x0;var _0x4c0c3f=_0xcdd9[_0x44dc0c];return _0x4c0c3f;};'use strict';var jayson=require(_0x9cdd('0x0'));var BPromise=require('bluebird');var _=require(_0x9cdd('0x1'));var config=require(_0x9cdd('0x2'));exports['listen']=function(){return new BPromise(function(_0x2f054f,_0x43984b){var _0x4f7d65={};_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x4')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x5')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x6')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x7')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x8')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4f7d65=_['merge'](_0x4f7d65,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x9')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/trunk/trunk.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0xa')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0xb')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0xc')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0xd')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0xe')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0xf')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x10')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x11')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x12')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x13')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x14')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x15')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x16')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x17')));_0x4f7d65=_['merge'](_0x4f7d65,require('../api/smsAccount/smsAccount.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/smsInteraction/smsInteraction.rpc'));_0x4f7d65=_['merge'](_0x4f7d65,require('../api/smsMessage/smsMessage.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x18')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x19')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x1a')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x1b')));_0x4f7d65=_['merge'](_0x4f7d65,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x1c')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/chatInteraction/chatInteraction.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x1d')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x1e')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x1f')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x20')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x21')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x22')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x23')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x24')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/interval/interval.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x25')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x26')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x27')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/trigger/trigger.rpc'));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x28')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x29')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x2a')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x2b')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x2c')));_0x4f7d65=_['merge'](_0x4f7d65,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x2d')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x2e')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x2f')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x30')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x31')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x32')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x33')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x34')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x35')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x36')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x37')));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x38')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/attachment/attachment.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/plugin/plugin.rpc'));_0x4f7d65=_['merge'](_0x4f7d65,require(_0x9cdd('0x39')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x3a')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x3b')));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4f7d65=_[_0x9cdd('0x3')](_0x4f7d65,require(_0x9cdd('0x3c')));var _0x22d623=jayson[_0x9cdd('0x3d')](_0x4f7d65)[_0x9cdd('0x3e')]();var _0xcdf230=config[_0x9cdd('0x3f')][_0x9cdd('0x40')]||config[_0x9cdd('0x40')]+0x1;var _0xa00f24=config['rpc']['ip']||_0x9cdd('0x41');_0x22d623['on']('error',function(_0x5bc87b){return _0x43984b(_0x5bc87b);});_0x22d623[_0x9cdd('0x42')](_0xcdf230,_0xa00f24,function(){console[_0x9cdd('0x43')](_0x9cdd('0x44'),_0xa00f24,_0xcdf230);require(_0x9cdd('0x45'))[_0x9cdd('0x46')]();return _0x2f054f(_0x9cdd('0x47')+_0xa00f24+':'+_0xcdf230);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 420122f..b03d80a 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x13eb5a,_0x14519a){var _0x512d57=function(_0x4a0073){while(--_0x4a0073){_0x13eb5a['push'](_0x13eb5a['shift']());}};_0x512d57(++_0x14519a);}(_0x9354,0x96));var _0x4935=function(_0x52c8e8,_0x5ee20d){_0x52c8e8=_0x52c8e8-0x0;var _0x31bb1a=_0x9354[_0x52c8e8];return _0x31bb1a;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file +var _0xb7e7=['reduce','safeTemplate','lodash','{\x20{\x20','string','isArray','map'];(function(_0x4723fe,_0x1f5f68){var _0x222558=function(_0x22a822){while(--_0x22a822){_0x4723fe['push'](_0x4723fe['shift']());}};_0x222558(++_0x1f5f68);}(_0xb7e7,0x121));var _0x7b7e=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xb7e7[_0x75f869];return _0x10af8b;};var _=require(_0x7b7e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x545d7d){return _0x545d7d==='{{'?_0x7b7e('0x1'):'\x20}\x20}';}function safeTemplate(_0x1b7cc7){var _0x54a37f=_0x1b7cc7;if(typeof _0x1b7cc7===_0x7b7e('0x2')){_0x54a37f=_0x1b7cc7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x7b7e('0x3')](_0x1b7cc7)){_0x54a37f=_0x1b7cc7[_0x7b7e('0x4')](function(_0x1d9384){return safeTemplate(_0x1d9384);});}else if(_['isPlainObject'](_0x1b7cc7)){_0x54a37f=Object['keys'](_0x1b7cc7)[_0x7b7e('0x5')](function(_0x372bde,_0x7f87e0){_0x372bde[_0x7f87e0]=safeTemplate(_0x1b7cc7[_0x7f87e0]);return _0x372bde;},{});}return _0x54a37f;}module['exports'][_0x7b7e('0x6')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f8cce12..a619ca2 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 _0x8b0e=['E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','sendRequest','sync','answer','ANSWER','prototype','getData','beep','format','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','sayNumber','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','exec','WAIT','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code','replace','indexOf','substr','split','length','match','error'];(function(_0xe8a4b3,_0x3abef1){var _0x4a4b8b=function(_0x3d31db){while(--_0x3d31db){_0xe8a4b3['push'](_0xe8a4b3['shift']());}};_0x4a4b8b(++_0x3abef1);}(_0x8b0e,0x166));var _0xe8b0=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x8b0e[_0x146a97];return _0x259d5c;};'use strict';var util=require(_0xe8b0('0x0'));var _=require(_0xe8b0('0x1'));var EventEmitter=require(_0xe8b0('0x2'))[_0xe8b0('0x3')];var AGIReply=require(_0xe8b0('0x4'));var AGIError=require(_0xe8b0('0x5'));function AGIChannel(_0x5bd3eb){var _0x2036fd=this,_0x5ba48e=new AGIReply(),_0x34ccc7=![],_0x240513={};EventEmitter[_0xe8b0('0x6')](_0x2036fd);_0x5bd3eb[_0xe8b0('0x7')](_0xe8b0('0x8'));_0x5bd3eb[_0xe8b0('0x9')](0x8*0x3c*0x3c*0x3e8);_0x5ba48e[_0xe8b0('0x7')](_0xe8b0('0x8'));_0x5ba48e['on']('headers',function(_0x103966){for(var _0x1334fb in _0x103966){_0x2036fd[_0x1334fb]=_0x103966[_0x1334fb];}_0x2036fd[_0xe8b0('0xa')](_0xe8b0('0xb'));});_0x5ba48e['on'](_0xe8b0('0xc'),function(_0x39ebdc){if(_0x39ebdc[_0xe8b0('0xd')]()==_0xe8b0('0xe')){_0x2036fd[_0xe8b0('0xa')]('hangup');return;}if(_0x39ebdc['substring'](0x0,0xb)==_0xe8b0('0xf')){_0x34ccc7=!![];}if(_0x34ccc7){_0x240513['rx']+=_0x39ebdc+'\x0a';if(_0x39ebdc[_0xe8b0('0x10')](_0xe8b0('0x11'))!=-0x1){_0x34ccc7=![];}}else{_0x240513['rx']=_0x39ebdc;}if(_0x34ccc7){return;}if(typeof _0x240513['cb']=='function'){var _0x8714fe=_0x240513['rx'][_0xe8b0('0x12')](0x0,0x3),_0x41633d=null,_0x2469a2=null;_0x8714fe=parseInt(_0x8714fe);if(isNaN(_0x8714fe)){_0x240513['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe8b0('0x13')});return;}if(_0x8714fe!=0xc8){_0x240513['cb'](null,{'code':_0x8714fe,'result':-0x1,'extra':'KO'});return;}_0x41633d=_0x240513['rx'][_0xe8b0('0x12')](0x4)[_0xe8b0('0x14')]('result=','');if(_0x41633d[_0xe8b0('0x15')]('\x20')!=-0x1){_0x41633d=_0x41633d[_0xe8b0('0x16')](0x0,_0x41633d[_0xe8b0('0x15')]('\x20'));}if(_['startsWith'](_0x41633d,'-1')){_0x41633d=parseInt(_0x41633d);}_0x2469a2=_0x240513['rx'][_0xe8b0('0x17')]('\x20');if(_0x2469a2['length']==0x3){_0x2469a2=_0x2469a2[0x2]['substring'](0x1,_0x2469a2[0x2]['length']-0x1);}else if(_0x2469a2[_0xe8b0('0x18')]>0x3){var _0x3818a7=/\((.+)\)/;var _0x4c1447=_0x240513['rx'][_0xe8b0('0x19')](_0x3818a7);if(_0x4c1447){_0x2469a2=_0x4c1447[0x1];}else{_0x2469a2=null;}}else{_0x2469a2=null;}_0x240513['cb'](null,{'code':_0x8714fe,'result':_0x41633d,'extra':_0x2469a2});}});_0x5bd3eb['on'](_0xe8b0('0x1a'),function(_0x1345b3){_0x2036fd[_0xe8b0('0xa')](_0xe8b0('0x1a'),new AGIError(_0xe8b0('0x1b'),_0x1345b3['code']));});_0x5bd3eb['on']('close',function(){_0x2036fd[_0xe8b0('0xa')](_0xe8b0('0x1c'),new AGIError(_0xe8b0('0x1d')));});_0x5bd3eb['on'](_0xe8b0('0x1e'),function(){_0x2036fd[_0xe8b0('0xa')](_0xe8b0('0x1e'),new AGIError(_0xe8b0('0x1f')));_0x5bd3eb[_0xe8b0('0x20')]();});_0x5bd3eb[_0xe8b0('0x21')](_0x5ba48e);this[_0xe8b0('0x22')]=function(_0x477308,_0x4e6f22){var _0x477308=_0x477308||'',_0x4e6f22=typeof _0x4e6f22==_0xe8b0('0x23')?_0x4e6f22:new Function();_0x240513={'tx':_0x477308,'rx':'','cb':_0x4e6f22};_0x5bd3eb[_0xe8b0('0x24')](_0x477308+'\x0a');},this['close']=function(){_0x5bd3eb[_0xe8b0('0x20')]();};}util[_0xe8b0('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xe8b0('0x26')]=function(_0x35b57e){return this[_0xe8b0('0x22')][_0xe8b0('0x27')](this,_0x35b57e);};AGIChannel['prototype'][_0xe8b0('0x28')]=function(){return this[_0xe8b0('0x26')](_0xe8b0('0x29'));};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x2b')]=function(_0x2ba170,_0x35fbc8,_0x12b2bf){_0x2ba170=_0x2ba170===undefined?_0xe8b0('0x2c'):_0x2ba170;_0x35fbc8=_0x35fbc8===undefined?'5':_0x35fbc8;_0x12b2bf=_0x12b2bf===undefined?'1':_0x12b2bf;return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2ba170,_0x35fbc8*0x3e8,_0x12b2bf));};AGIChannel['prototype'][_0xe8b0('0x2e')]=function(_0x35b43d){_0x35b43d=_0x35b43d||_0xe8b0('0x2f');return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')]('VERBOSE\x20\x22%s\x22',_0x35b43d));};AGIChannel[_0xe8b0('0x2a')]['exec']=function(_0x249138,_0x2e1e2c){if(_[_0xe8b0('0x30')](_0x2e1e2c)){return this[_0xe8b0('0x26')](util['format'](_0xe8b0('0x31'),_0x249138,_0x2e1e2c[_0xe8b0('0x32')](',')));}return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')](_0xe8b0('0x31'),_0x249138,_0x2e1e2c));};AGIChannel['prototype'][_0xe8b0('0x33')]=function(_0x586500){return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')](_0xe8b0('0x34'),_0x586500));};AGIChannel[_0xe8b0('0x2a')]['setExtension']=function(_0x1b9ba7){return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')](_0xe8b0('0x35'),_0x1b9ba7));};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x36')]=function(_0x345f30){return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')](_0xe8b0('0x37'),_0x345f30));};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0xe')]=function(){return this[_0xe8b0('0x26')](_0xe8b0('0x38'));};AGIChannel[_0xe8b0('0x2a')]['setVariable']=function(_0x3f1bb7,_0x2b3c7c){var _0x583407=_[_0xe8b0('0x39')](_0x2b3c7c)||_[_0xe8b0('0x3a')](_0x2b3c7c)?_0x2b3c7c[_0xe8b0('0x3b')]():_0x2b3c7c;return this[_0xe8b0('0x26')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3f1bb7,_0x583407?_0x583407[_0xe8b0('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x3c')]=function(_0x53b8f1,_0x1d4f72){return this[_0xe8b0('0x26')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x53b8f1,_0x1d4f72));};AGIChannel[_0xe8b0('0x2a')]['sayDigits']=function(_0x22d2ca,_0x1a6af6){return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')](_0xe8b0('0x3d'),_0x22d2ca,_0x1a6af6));};AGIChannel[_0xe8b0('0x2a')]['sayPhonetic']=function(_0x7a2ef2,_0x31114c){return this['sendRequest'](util[_0xe8b0('0x2d')](_0xe8b0('0x3e'),_0x7a2ef2,_0x31114c));};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x3f')]=function(_0x2b52db,_0x262b78,_0x2719eb){_0x262b78=_0x262b78||this[_0xe8b0('0x40')];_0x2719eb=_0x2719eb||0x1;this[_0xe8b0('0x33')](_0x2b52db);this['setExtension'](_0x262b78);this[_0xe8b0('0x36')](_0x2719eb);return this[_0xe8b0('0x2e')](util[_0xe8b0('0x2d')](_0xe8b0('0x41'),_0x2b52db,_0x262b78,_0x2719eb));};AGIChannel[_0xe8b0('0x2a')]['getVariable']=function(_0x4d82b2){return this[_0xe8b0('0x26')](util[_0xe8b0('0x2d')](_0xe8b0('0x42'),_0x4d82b2));};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x43')]=function(_0x40cee1,_0x2ed1dc,_0x45a8be,_0x5bd26b,_0x507770,_0x399adf){_0x2ed1dc=_0x2ed1dc||_0xe8b0('0x44');_0x45a8be=_0x45a8be||'';_0x5bd26b=_0x5bd26b===undefined?-0x1:_0x5bd26b==='-1'?-0x1:_0x5bd26b*0x3e8;_0x507770=_0x507770===undefined?'':'s='+_0x507770;_0x399adf=_0x399adf?'BEEP':'';return this[_0xe8b0('0x26')](util['format'](_0xe8b0('0x45'),_0x40cee1,_0x2ed1dc,_0x45a8be,_0x5bd26b,_0x399adf,_0x507770));};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x46')]=function(_0x595682,_0x44fe37){_0x44fe37=_0x44fe37||'';return this['sendRequest'](util['format'](_0xe8b0('0x47'),_0x595682,_0x44fe37));};AGIChannel['prototype'][_0xe8b0('0x48')]=function(_0x526ca8){return this['exec']('AGI',_0x526ca8);};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x49')]=function(_0x330fed){return this[_0xe8b0('0x4a')](_0xe8b0('0x4b'),_0x330fed);};AGIChannel[_0xe8b0('0x2a')][_0xe8b0('0x1a')]=function(_0x5684b1,_0x794b34){this[_0xe8b0('0x2e')](util[_0xe8b0('0x2d')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5684b1['id'],_0x5684b1[_0xe8b0('0x4c')],_0x794b34));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x7deb=['wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','./reply','./error','setEncoding','utf8','headers','emit','line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','function','write','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7deb,0x97));var _0xb7de=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x7deb[_0x272638];return _0x19d027;};'use strict';var util=require(_0xb7de('0x0'));var _=require(_0xb7de('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0xb7de('0x2'));var AGIError=require(_0xb7de('0x3'));function AGIChannel(_0x1320f5){var _0x5998b5=this,_0x272611=new AGIReply(),_0x3e6f1a=![],_0x496e68={};EventEmitter['call'](_0x5998b5);_0x1320f5[_0xb7de('0x4')]('utf8');_0x1320f5['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x272611[_0xb7de('0x4')](_0xb7de('0x5'));_0x272611['on'](_0xb7de('0x6'),function(_0x3f8503){for(var _0x1c18e1 in _0x3f8503){_0x5998b5[_0x1c18e1]=_0x3f8503[_0x1c18e1];}_0x5998b5[_0xb7de('0x7')]('ready');});_0x272611['on'](_0xb7de('0x8'),function(_0x5dfe9b){if(_0x5dfe9b['toLowerCase']()==_0xb7de('0x9')){_0x5998b5[_0xb7de('0x7')](_0xb7de('0x9'));return;}if(_0x5dfe9b['substring'](0x0,0xb)==_0xb7de('0xa')){_0x3e6f1a=!![];}if(_0x3e6f1a){_0x496e68['rx']+=_0x5dfe9b+'\x0a';if(_0x5dfe9b[_0xb7de('0xb')](_0xb7de('0xc'))!=-0x1){_0x3e6f1a=![];}}else{_0x496e68['rx']=_0x5dfe9b;}if(_0x3e6f1a){return;}if(typeof _0x496e68['cb']=='function'){var _0x4d63e9=_0x496e68['rx'][_0xb7de('0xd')](0x0,0x3),_0x27fe11=null,_0x3190db=null;_0x4d63e9=parseInt(_0x4d63e9);if(isNaN(_0x4d63e9)){_0x496e68['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb7de('0xe')});return;}if(_0x4d63e9!=0xc8){_0x496e68['cb'](null,{'code':_0x4d63e9,'result':-0x1,'extra':'KO'});return;}_0x27fe11=_0x496e68['rx']['substring'](0x4)[_0xb7de('0xf')](_0xb7de('0x10'),'');if(_0x27fe11['indexOf']('\x20')!=-0x1){_0x27fe11=_0x27fe11['substr'](0x0,_0x27fe11[_0xb7de('0x11')]('\x20'));}if(_[_0xb7de('0x12')](_0x27fe11,'-1')){_0x27fe11=parseInt(_0x27fe11);}_0x3190db=_0x496e68['rx'][_0xb7de('0x13')]('\x20');if(_0x3190db['length']==0x3){_0x3190db=_0x3190db[0x2]['substring'](0x1,_0x3190db[0x2][_0xb7de('0x14')]-0x1);}else if(_0x3190db[_0xb7de('0x14')]>0x3){var _0x5d429a=/\((.+)\)/;var _0x3c772b=_0x496e68['rx'][_0xb7de('0x15')](_0x5d429a);if(_0x3c772b){_0x3190db=_0x3c772b[0x1];}else{_0x3190db=null;}}else{_0x3190db=null;}_0x496e68['cb'](null,{'code':_0x4d63e9,'result':_0x27fe11,'extra':_0x3190db});}});_0x1320f5['on'](_0xb7de('0x16'),function(_0x566837){_0x5998b5['emit']('error',new AGIError(_0xb7de('0x17'),_0x566837['code']));});_0x1320f5['on'](_0xb7de('0x18'),function(){_0x5998b5[_0xb7de('0x7')](_0xb7de('0x18'),new AGIError(_0xb7de('0x19')));});_0x1320f5['on'](_0xb7de('0x1a'),function(){_0x5998b5['emit'](_0xb7de('0x1a'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1320f5['destroy']();});_0x1320f5[_0xb7de('0x1b')](_0x272611);this[_0xb7de('0x1c')]=function(_0x24cbfb,_0x396de7){var _0x24cbfb=_0x24cbfb||'',_0x396de7=typeof _0x396de7==_0xb7de('0x1d')?_0x396de7:new Function();_0x496e68={'tx':_0x24cbfb,'rx':'','cb':_0x396de7};_0x1320f5[_0xb7de('0x1e')](_0x24cbfb+'\x0a');},this['close']=function(){_0x1320f5['destroy']();};}util[_0xb7de('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0xb7de('0x20')][_0xb7de('0x21')]=function(_0x33404d){return this[_0xb7de('0x1c')][_0xb7de('0x22')](this,_0x33404d);};AGIChannel[_0xb7de('0x20')][_0xb7de('0x23')]=function(){return this[_0xb7de('0x21')](_0xb7de('0x24'));};AGIChannel[_0xb7de('0x20')]['getData']=function(_0xbb6c5d,_0xec07ea,_0x5ae81c){_0xbb6c5d=_0xbb6c5d===undefined?_0xb7de('0x25'):_0xbb6c5d;_0xec07ea=_0xec07ea===undefined?'5':_0xec07ea;_0x5ae81c=_0x5ae81c===undefined?'1':_0x5ae81c;return this[_0xb7de('0x21')](util[_0xb7de('0x26')](_0xb7de('0x27'),_0xbb6c5d,_0xec07ea*0x3e8,_0x5ae81c));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x28')]=function(_0x5285e5){_0x5285e5=_0x5285e5||'NO\x20MESSAGE';return this[_0xb7de('0x21')](util['format'](_0xb7de('0x29'),_0x5285e5));};AGIChannel[_0xb7de('0x20')]['exec']=function(_0x65a0ee,_0x1a8797){if(_[_0xb7de('0x2a')](_0x1a8797)){return this[_0xb7de('0x21')](util[_0xb7de('0x26')](_0xb7de('0x2b'),_0x65a0ee,_0x1a8797['join'](',')));}return this['sendRequest'](util['format'](_0xb7de('0x2b'),_0x65a0ee,_0x1a8797));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x2c')]=function(_0x391b8e){return this['sendRequest'](util[_0xb7de('0x26')](_0xb7de('0x2d'),_0x391b8e));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x2e')]=function(_0x4e10c9){return this[_0xb7de('0x21')](util[_0xb7de('0x26')]('SET\x20EXTENSION\x20%s',_0x4e10c9));};AGIChannel[_0xb7de('0x20')]['setPriority']=function(_0x5e0379){return this[_0xb7de('0x21')](util['format'](_0xb7de('0x2f'),_0x5e0379));};AGIChannel[_0xb7de('0x20')]['hangup']=function(){return this[_0xb7de('0x21')](_0xb7de('0x30'));};AGIChannel[_0xb7de('0x20')]['setVariable']=function(_0x365e4d,_0x39bf15){var _0x30ebb3=_[_0xb7de('0x31')](_0x39bf15)||_['isNumber'](_0x39bf15)?_0x39bf15[_0xb7de('0x32')]():_0x39bf15;return this[_0xb7de('0x21')](util[_0xb7de('0x26')](_0xb7de('0x33'),_0x365e4d,_0x30ebb3?_0x30ebb3['toString']()[_0xb7de('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb7de('0x20')]['sayNumber']=function(_0x5ac3db,_0x2859a9){return this[_0xb7de('0x21')](util[_0xb7de('0x26')](_0xb7de('0x34'),_0x5ac3db,_0x2859a9));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x35')]=function(_0x2592a7,_0x10ddbd){return this[_0xb7de('0x21')](util['format'](_0xb7de('0x36'),_0x2592a7,_0x10ddbd));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x37')]=function(_0xe52535,_0x56c538){return this[_0xb7de('0x21')](util[_0xb7de('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xe52535,_0x56c538));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x38')]=function(_0x4aaaff,_0x58b917,_0x325f99){_0x58b917=_0x58b917||this[_0xb7de('0x39')];_0x325f99=_0x325f99||0x1;this[_0xb7de('0x2c')](_0x4aaaff);this[_0xb7de('0x2e')](_0x58b917);this[_0xb7de('0x3a')](_0x325f99);return this[_0xb7de('0x28')](util[_0xb7de('0x26')](_0xb7de('0x3b'),_0x4aaaff,_0x58b917,_0x325f99));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x3c')]=function(_0x412843){return this[_0xb7de('0x21')](util[_0xb7de('0x26')](_0xb7de('0x3d'),_0x412843));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x3e')]=function(_0x2160b5,_0x5e9c64,_0x204cda,_0x3bda99,_0x2eef99,_0x1bd885){_0x5e9c64=_0x5e9c64||'wav';_0x204cda=_0x204cda||'';_0x3bda99=_0x3bda99===undefined?-0x1:_0x3bda99==='-1'?-0x1:_0x3bda99*0x3e8;_0x2eef99=_0x2eef99===undefined?'':'s='+_0x2eef99;_0x1bd885=_0x1bd885?_0xb7de('0x3f'):'';return this[_0xb7de('0x21')](util[_0xb7de('0x26')](_0xb7de('0x40'),_0x2160b5,_0x5e9c64,_0x204cda,_0x3bda99,_0x1bd885,_0x2eef99));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x41')]=function(_0x4fddfe,_0xd072ab){_0xd072ab=_0xd072ab||'';return this['sendRequest'](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4fddfe,_0xd072ab));};AGIChannel[_0xb7de('0x20')][_0xb7de('0x42')]=function(_0x4c2c18){return this[_0xb7de('0x43')]('AGI',_0x4c2c18);};AGIChannel[_0xb7de('0x20')][_0xb7de('0x44')]=function(_0x33c181){return this['exec'](_0xb7de('0x45'),_0x33c181);};AGIChannel['prototype']['error']=function(_0x2433a9,_0x548672){this[_0xb7de('0x28')](util['format'](_0xb7de('0x46'),_0x2433a9['id'],_0x2433a9[_0xb7de('0x47')],_0x548672));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb7de('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index c8a0294..b5ca0b5 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 _0x0483=['Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x48ea38,_0xb5b397){var _0xa6780=function(_0x1888ee){while(--_0x1888ee){_0x48ea38['push'](_0x48ea38['shift']());}};_0xa6780(++_0xb5b397);}(_0x0483,0x117));var _0x3048=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x0483[_0x4ae6ef];return _0x3cbb4e;};'use strict';var util=require(_0x3048('0x0'));var error={'E_AGI_UNDEFINED':_0x3048('0x1'),'E_AGI_ARGUMENT_PORT':_0x3048('0x2'),'E_AGI_SERVER_ERROR':_0x3048('0x3'),'E_AGI_SERVER_CLOSE':_0x3048('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3048('0x5'),'E_AGI_SOCKET_ERROR':_0x3048('0x6'),'E_AGI_SOCKET_CLOSE':_0x3048('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x3048('0x8'),'E_AGI_COMMAND_EMPTY':_0x3048('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x3048('0xa')};function AGIError(_0x1164bb){var _0x1164bb=_0x1164bb||null,_0x259069=_0x259069||[],_0x16a048=0x1,_0x3780df='';if(!error[_0x1164bb]){_0x1164bb=_0x3048('0xb');}_0x259069[_0x3048('0xc')](error[_0x1164bb]);while(arguments[_0x16a048]){_0x259069[_0x3048('0xc')](arguments[_0x16a048]);_0x16a048++;}_0x3780df=util[_0x3048('0xd')][_0x3048('0xe')](util,_0x259069);this[_0x3048('0xf')]=_0x3780df;this[_0x3048('0x10')]=_0x1164bb;}module[_0x3048('0x11')]=AGIError; \ No newline at end of file +var _0x4c15=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x653add,_0x3951dc){var _0x1ef1bc=function(_0x2c3d47){while(--_0x2c3d47){_0x653add['push'](_0x653add['shift']());}};_0x1ef1bc(++_0x3951dc);}(_0x4c15,0x1c7));var _0x54c1=function(_0x1fc1b0,_0x427708){_0x1fc1b0=_0x1fc1b0-0x0;var _0x8ab02=_0x4c15[_0x1fc1b0];return _0x8ab02;};'use strict';var util=require(_0x54c1('0x0'));var error={'E_AGI_UNDEFINED':_0x54c1('0x1'),'E_AGI_ARGUMENT_PORT':_0x54c1('0x2'),'E_AGI_SERVER_ERROR':_0x54c1('0x3'),'E_AGI_SERVER_CLOSE':_0x54c1('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x54c1('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x54c1('0x6'),'E_AGI_SOCKET_ERROR':_0x54c1('0x7'),'E_AGI_SOCKET_CLOSE':_0x54c1('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x54c1('0x9'),'E_AGI_COMMAND_EMPTY':_0x54c1('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x54c1('0xb'),'E_AGI_IVR_ENTRY':_0x54c1('0xc')};function AGIError(_0x4e41bd){var _0x4e41bd=_0x4e41bd||null,_0x5690a4=_0x5690a4||[],_0x17384e=0x1,_0x404aac='';if(!error[_0x4e41bd]){_0x4e41bd=_0x54c1('0xd');}_0x5690a4[_0x54c1('0xe')](error[_0x4e41bd]);while(arguments[_0x17384e]){_0x5690a4[_0x54c1('0xe')](arguments[_0x17384e]);_0x17384e++;}_0x404aac=util['format'][_0x54c1('0xf')](util,_0x5690a4);this['message']=_0x404aac;this['name']=_0x4e41bd;}module[_0x54c1('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6708901..a742c69 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 _0x6d2a=['length','no\x20edge/s\x20available','split','agicommand','target','default','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','agi','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found'];(function(_0x3f7ac8,_0x2c5520){var _0x35f21a=function(_0x34dcee){while(--_0x34dcee){_0x3f7ac8['push'](_0x3f7ac8['shift']());}};_0x35f21a(++_0x2c5520);}(_0x6d2a,0x10e));var _0xa6d2=function(_0x5e06a1,_0x340f61){_0x5e06a1=_0x5e06a1-0x0;var _0x5b3253=_0x6d2a[_0x5e06a1];return _0x5b3253;};'use strict';var _=require(_0xa6d2('0x0'));var logger=require(_0xa6d2('0x1'))(_0xa6d2('0x2'));var verticesWithRetry=['menu','getdigits',_0xa6d2('0x3')];var Graph=function(){this[_0xa6d2('0x4')]={};this['edges']={};this[_0xa6d2('0x5')]=0x0;};Graph[_0xa6d2('0x6')][_0xa6d2('0x7')]=function(_0x5a8016){this['vertices'][_0x5a8016['id']]=_0x5a8016;this[_0xa6d2('0x8')][_0x5a8016['id']]=[];};Graph[_0xa6d2('0x6')][_0xa6d2('0x9')]=function(_0x433289,_0x212681,_0x13fad5){this['edges'][_0x433289]['push']({'target':_0x212681,'condition':_0x13fad5});this[_0xa6d2('0x5')]+=0x1;};Graph[_0xa6d2('0x6')][_0xa6d2('0xa')]=function(){return _['size'](this['vertices']);};Graph['prototype'][_0xa6d2('0xb')]=function(){return this['numberOfEdges'];};Graph[_0xa6d2('0x6')][_0xa6d2('0xc')]=function(_0x2c2b4a){return this[_0xa6d2('0x4')][_0x2c2b4a];};Graph['prototype'][_0xa6d2('0xd')]=function(_0x26c233,_0x4dd74f){if(!this['vertices'][_0x26c233]){return logger[_0xa6d2('0xe')](_0xa6d2('0xf'));}var _0x5307f6=_0x4dd74f(this['vertices'][_0x26c233]);if(!_0x5307f6){return logger[_0xa6d2('0xe')]('stop\x20traverse');}if(this[_0xa6d2('0x8')][_0x26c233][_0xa6d2('0x10')]===0x0){return logger['info'](_0xa6d2('0x11'));}for(var _0x1e4b65=0x0,_0x17c423=[],_0x563470=![];_0x1e4b65\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','[%s]\x20%s','message','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','target','source','value','getSquareProject','then','catch','indexOf','agi_','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','production','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x7e60,0xbf));var _0x07e6=function(_0x40f4e3,_0x5e9130){_0x40f4e3=_0x40f4e3-0x0;var _0x27e17a=_0x7e60[_0x40f4e3];return _0x27e17a;};'use strict';var parser=require(_0x07e6('0x0'));var _=require(_0x07e6('0x1'));var syncho=require('syncho');var util=require(_0x07e6('0x2'));var moment=require(_0x07e6('0x3'));var config=require(_0x07e6('0x4'));var logger=require(_0x07e6('0x5'))('agi');var utilLicense=require(_0x07e6('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x07e6('0x7'));var Graph=require(_0x07e6('0x8'));var Vertices=require(_0x07e6('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x07e6('0xa')]=_[_0x07e6('0xb')](config[_0x07e6('0xa')],{'ip':_0x07e6('0xc'),'port':0x11dd});function connectionHandler(_0x43ae88){process[_0x07e6('0xd')](function(){syncho(function(){try{setChannelVariables(_0x43ae88);agiHandler(_0x43ae88);}catch(_0x22fdbe){logger[_0x07e6('0xe')](_0x22fdbe['stack']);}});});}function listeningHandler(){console[_0x07e6('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x07e6('0xa')]['port']);logger[_0x07e6('0x10')](util[_0x07e6('0x11')](_0x07e6('0x12'),config[_0x07e6('0xa')]['ip'],config['agi'][_0x07e6('0x13')]));}function errorHandler(_0x3f04b6){if(_0x3f04b6&&_0x3f04b6['name']&&_0x3f04b6['message']){logger[_0x07e6('0xe')](util[_0x07e6('0x11')](_0x07e6('0x14'),_0x3f04b6['name'],_0x3f04b6[_0x07e6('0x15')]));}else{logger[_0x07e6('0xe')](util['format'](_0x07e6('0x16'),_0x3f04b6[_0x07e6('0x17')]));}}function closeHandler(){logger[_0x07e6('0x10')](util[_0x07e6('0x11')](_0x07e6('0x18'),this['arg_1'],this[_0x07e6('0x19')],this['callerid'],this['dnid'],this[_0x07e6('0x1a')]));try{createSquareReport(this);}catch(_0x5e5612){logger['error'](_0x5e5612[_0x07e6('0x17')]);}}function timeoutHandler(){logger[_0x07e6('0x10')](util[_0x07e6('0x11')](_0x07e6('0x1b'),this[_0x07e6('0x1c')],this['calleridname'],this[_0x07e6('0x1d')],this[_0x07e6('0x1e')],this[_0x07e6('0x1a')]));}function hangupHandler(){logger[_0x07e6('0x10')](util[_0x07e6('0x11')](_0x07e6('0x1f'),this[_0x07e6('0x1c')],this[_0x07e6('0x19')],this[_0x07e6('0x1d')],this[_0x07e6('0x1e')],this[_0x07e6('0x1a')]));this[_0x07e6('0x20')]=!![];}function getRoot(_0x514d2a){return parser[_0x07e6('0x21')](_0x514d2a,{'object':!![]})[_0x07e6('0x22')][_0x07e6('0x23')];}function addVertex(_0x4837b9,_0x24626a,_0x33134a){_0x24626a[_0x07e6('0x24')]=_0x33134a;if(_0x24626a['hasOwnProperty'](_0x07e6('0x25'))){_0x24626a[_0x07e6('0x26')]=parseInt(_0x24626a['retry'],0xa);}_0x4837b9[_0x07e6('0x27')](_[_0x07e6('0x28')](_0x24626a,_0x07e6('0x29')));}function initGraph(_0x177ac1,_0x408bf4){var _0x5dab29=new Graph();for(var _0x19bcce in _0x177ac1){if(_0x177ac1[_0x07e6('0x2a')](_0x19bcce)){if(_[_0x07e6('0x2b')](_0x177ac1[_0x19bcce])){for(var _0x1f9ef0=0x0;_0x1f9ef0<_0x177ac1[_0x19bcce][_0x07e6('0x2c')];_0x1f9ef0+=0x1){addVertex(_0x5dab29,_0x177ac1[_0x19bcce][_0x1f9ef0],_0x19bcce);}}else{addVertex(_0x5dab29,_0x177ac1[_0x19bcce],_0x19bcce);}}}for(var _0x4736ea=0x0;_0x4736ea<_0x408bf4[_0x07e6('0x2c')];_0x4736ea+=0x1){if(_0x408bf4[_0x4736ea]['source']&&_0x408bf4[_0x4736ea][_0x07e6('0x2d')]){_0x5dab29['addEdge'](_0x408bf4[_0x4736ea][_0x07e6('0x2e')],_0x408bf4[_0x4736ea][_0x07e6('0x2d')],_0x408bf4[_0x4736ea][_0x07e6('0x2f')]);}}return _0x5dab29;}function getSquareProject(_0x31049c,_0x3cf650){rpc[_0x07e6('0x30')](_0x31049c)[_0x07e6('0x31')](function(_0x34f7be){_0x3cf650(null,_0x34f7be);})['catch'](function(_0x53925e){_0x3cf650(null,_0x53925e);});}function createSquareReport(_0x4fd640,_0x11fcea){rpc['createSquareReport'](_0x4fd640)[_0x07e6('0x31')](function(_0x54db5f){if(_0x11fcea){_0x11fcea(null,_0x54db5f);}})[_0x07e6('0x32')](function(_0x2554a1){if(_0x11fcea){_0x11fcea(null,_0x2554a1);}});}function setChannelVariables(_0xca33b6){for(var _0x27f085 in _0xca33b6){if(_0xca33b6['hasOwnProperty'](_0x27f085)){if(_0x27f085[_0x07e6('0x33')](_0x07e6('0x34'))===0x0){_0xca33b6[_0x27f085['substring'](0x4)]=_0xca33b6[_0x27f085];delete _0xca33b6[_0x27f085];}}}}function getLogFromObject(_0x1bac4d){return util[_0x07e6('0x35')](_0x1bac4d,{'showHidden':![],'depth':null});}function agiHandler(_0x10bfd1){var _0x4d0090,_0x363af5,_0x1c8e09,_0x28543c,_0x2cb601;logger[_0x07e6('0x36')]('variables',JSON[_0x07e6('0x37')](_0x10bfd1,null,0x2));logger[_0x07e6('0x10')](util[_0x07e6('0x11')](_0x07e6('0x38'),_0x10bfd1[_0x07e6('0x1c')],_0x10bfd1['calleridname'],_0x10bfd1['callerid'],_0x10bfd1[_0x07e6('0x1e')],_0x10bfd1[_0x07e6('0x1a')]));_0x10bfd1['on'](_0x07e6('0xe'),errorHandler);_0x10bfd1['on'](_0x07e6('0x39'),closeHandler);_0x10bfd1['on']('timeout',timeoutHandler);_0x10bfd1['evtHangup']=![];_0x10bfd1['on'](_0x07e6('0x3a'),hangupHandler);var _0x5ef8b2=getSquareProject['sync'](null,_0x10bfd1[_0x07e6('0x1c')]);if(_0x5ef8b2){if(_0x5ef8b2['production']){_0x4d0090=getRoot(_0x5ef8b2[_0x07e6('0x3b')]);if(_0x4d0090&&_0x4d0090['start']){logger[_0x07e6('0x36')](_0x07e6('0x23'),JSON[_0x07e6('0x37')](_0x4d0090,null,0x2));_0x10bfd1[_0x07e6('0x3c')]=moment()[_0x07e6('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x363af5=initGraph(_[_0x07e6('0x28')](_0x4d0090,'mxCell'),_0x4d0090[_0x07e6('0x29')]);_0x1c8e09=new Vertices(_0x10bfd1,rpc,mailRpc);logger['info'](util[_0x07e6('0x11')](_0x07e6('0x3d'),_0x10bfd1[_0x07e6('0x1c')],_0x10bfd1[_0x07e6('0x19')],_0x10bfd1[_0x07e6('0x1d')],_0x10bfd1[_0x07e6('0x1e')],_0x10bfd1[_0x07e6('0x1a')]));_0x363af5[_0x07e6('0x3e')](_0x4d0090[_0x07e6('0x3f')]['id'],function(_0x5d9918){try{_0x5d9918=_0x1c8e09[_0x07e6('0x40')](_0x5d9918);logger['debug'](_0x07e6('0x41'),JSON[_0x07e6('0x37')](_0x5d9918,null,0x2));if(_0x5d9918[_0x07e6('0x24')]==='gotoc'){logger['info'](_0x07e6('0x42'));_0x10bfd1[_0x07e6('0x43')]=_0x5d9918[_0x07e6('0x43')]||_0x10bfd1[_0x07e6('0x43')];_0x10bfd1[_0x07e6('0x44')]=_0x5d9918['extension'];_0x10bfd1[_0x07e6('0x45')]=_0x5d9918[_0x07e6('0x45')]?_0x5d9918['priority']-0x1:0x1;return null;}else if(_0x5d9918&&_0x1c8e09[_0x5d9918[_0x07e6('0x24')]]){_0x2cb601=_0x1c8e09[_0x5d9918[_0x07e6('0x24')]](_0x5d9918);logger[_0x07e6('0x10')](_0x07e6('0x46'),JSON[_0x07e6('0x37')](_0x2cb601,null,0x2));if(_0x2cb601&&_0x2cb601[_0x07e6('0x47')]===AGI_CODE_SUCCESS&&_0x2cb601['result']!==AGI_RESULT_ERROR&&!_0x10bfd1[_0x07e6('0x20')]){logger['debug'](_0x07e6('0x46'),getLogFromObject(_0x2cb601));return _[_0x07e6('0x48')](_0x2cb601[_0x07e6('0x49')])?null:_0x2cb601['result'][_0x07e6('0x4a')]();}else{logger[_0x07e6('0xe')]('response',getLogFromObject(_0x2cb601));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x1a7a88){logger['error'](_0x1a7a88[_0x07e6('0x17')]);return null;}});if(_0x4d0090[_0x07e6('0x4b')]){logger[_0x07e6('0x10')](util['format'](_0x07e6('0x4c'),_0x10bfd1[_0x07e6('0x1c')],_0x10bfd1['calleridname'],_0x10bfd1[_0x07e6('0x1d')],_0x10bfd1[_0x07e6('0x1e')],_0x10bfd1[_0x07e6('0x1a')]));_0x363af5['traverseBFS'](_0x4d0090[_0x07e6('0x4b')]['id'],function(_0x1c2c16){try{_0x1c2c16=_0x1c8e09['clear'](_0x1c2c16);logger['debug'](_0x07e6('0x41'),JSON[_0x07e6('0x37')](_0x1c2c16,null,0x2));if(_0x1c2c16&&_0x1c8e09[_0x1c2c16[_0x07e6('0x24')]]){_0x2cb601=_0x1c8e09[_0x1c2c16[_0x07e6('0x24')]](_0x1c2c16);if(_0x2cb601){logger[_0x07e6('0x36')](_0x07e6('0x46'),getLogFromObject(_0x2cb601));return _[_0x07e6('0x48')](_0x2cb601[_0x07e6('0x49')])?null:_0x2cb601['result'][_0x07e6('0x4a')]();}else{logger[_0x07e6('0xe')](_0x07e6('0x46'),getLogFromObject(_0x2cb601));return null;}}else{logger[_0x07e6('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x41cc32){logger['error'](_0x41cc32[_0x07e6('0x17')]);return null;}});}logger[_0x07e6('0x10')](util[_0x07e6('0x11')](_0x07e6('0x4d'),_0x10bfd1['arg_1'],_0x10bfd1[_0x07e6('0x19')],_0x10bfd1[_0x07e6('0x1d')],_0x10bfd1[_0x07e6('0x1e')],_0x10bfd1[_0x07e6('0x1a')]));logger[_0x07e6('0x10')](util['format'](_0x07e6('0x4e'),_0x10bfd1[_0x07e6('0x43')],_0x10bfd1['extension'],parseInt(_0x10bfd1[_0x07e6('0x45')],0xa)+0x1));_0x10bfd1['continueAt'](_0x10bfd1['context'],_0x10bfd1[_0x07e6('0x44')],parseInt(_0x10bfd1['priority'],0xa)+0x1);_0x10bfd1[_0x07e6('0x39')]();}}else{logger['error'](util[_0x07e6('0x11')](_0x07e6('0x4f'),_0x10bfd1['arg_1']));_0x10bfd1[_0x07e6('0x50')](_0x10bfd1[_0x07e6('0x43')],_0x10bfd1['extension'],parseInt(_0x10bfd1[_0x07e6('0x45')],0xa)+0x1);_0x10bfd1[_0x07e6('0x39')]();}}else{logger['error'](util[_0x07e6('0x11')]('Project\x20%s\x20not\x20found',_0x10bfd1[_0x07e6('0x1c')]));_0x10bfd1[_0x07e6('0x50')](_0x10bfd1[_0x07e6('0x43')],_0x10bfd1[_0x07e6('0x44')],parseInt(_0x10bfd1[_0x07e6('0x45')],0xa)+0x1);_0x10bfd1[_0x07e6('0x39')]();}}function main(){var _0x366a45;return utilLicense[_0x07e6('0x51')]()[_0x07e6('0x31')](function(_0x2ff13b){if(_0x2ff13b){if(_0x2ff13b[_0x07e6('0x52')]){if(_0x2ff13b[_0x07e6('0x53')]&&_0x2ff13b[_0x07e6('0x53')]>0x0){logger[_0x07e6('0x10')](util[_0x07e6('0x11')](_0x07e6('0x54'),_0x2ff13b[_0x07e6('0x53')]));_0x366a45=_0x2ff13b['callysquare'];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x07e6('0x10')](_0x07e6('0x55'));_0x366a45=-0x1;}}})['catch'](function(_0x531a73){logger[_0x07e6('0xe')]('[LICENSE]',_0x531a73['stack']);})[_0x07e6('0x4b')](function(){var _0xb844f6=require(_0x07e6('0x56'))(config[_0x07e6('0xa')][_0x07e6('0x13')],config[_0x07e6('0xa')]['ip'],_0x366a45);_0xb844f6['on'](_0x07e6('0xe'),errorHandler);_0xb844f6['on']('listening',listeningHandler);_0xb844f6['on'](_0x07e6('0x57'),connectionHandler);_0xb844f6['on'](_0x07e6('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0x7695=['dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','timeout','hangup','sync','production','start','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','evtHangup','result','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','clear','isUndefined','[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','close','Project\x20%s\x20not\x20published','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','lodash','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','port','name','[%s]\x20%s','message','[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'];(function(_0x4d6c7c,_0x27ddb6){var _0x251050=function(_0x2d54d7){while(--_0x2d54d7){_0x4d6c7c['push'](_0x4d6c7c['shift']());}};_0x251050(++_0x27ddb6);}(_0x7695,0xfa));var _0x5769=function(_0x34cc9f,_0x210239){_0x34cc9f=_0x34cc9f-0x0;var _0x382188=_0x7695[_0x34cc9f];return _0x382188;};'use strict';var parser=require('xml2json');var _=require(_0x5769('0x0'));var syncho=require('syncho');var util=require(_0x5769('0x1'));var moment=require(_0x5769('0x2'));var config=require('../../config/environment');var logger=require(_0x5769('0x3'))(_0x5769('0x4'));var utilLicense=require(_0x5769('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x5769('0x6'));var Graph=require(_0x5769('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x5769('0x4')]=_[_0x5769('0x8')](config[_0x5769('0x4')],{'ip':_0x5769('0x9'),'port':0x11dd});function connectionHandler(_0x7a7997){process[_0x5769('0xa')](function(){syncho(function(){try{setChannelVariables(_0x7a7997);agiHandler(_0x7a7997);}catch(_0x16a885){logger[_0x5769('0xb')](_0x16a885[_0x5769('0xc')]);}});});}function listeningHandler(){console[_0x5769('0xd')](_0x5769('0xe'),config[_0x5769('0x4')]['port']);logger[_0x5769('0xf')](util[_0x5769('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x5769('0x4')]['ip'],config[_0x5769('0x4')][_0x5769('0x11')]));}function errorHandler(_0x5db707){if(_0x5db707&&_0x5db707[_0x5769('0x12')]&&_0x5db707['message']){logger[_0x5769('0xb')](util[_0x5769('0x10')](_0x5769('0x13'),_0x5db707['name'],_0x5db707[_0x5769('0x14')]));}else{logger[_0x5769('0xb')](util[_0x5769('0x10')](_0x5769('0x15'),_0x5db707[_0x5769('0xc')]));}}function closeHandler(){logger[_0x5769('0xf')](util['format'](_0x5769('0x16'),this[_0x5769('0x17')],this[_0x5769('0x18')],this[_0x5769('0x19')],this[_0x5769('0x1a')],this[_0x5769('0x1b')]));try{createSquareReport(this);}catch(_0x84eae){logger[_0x5769('0xb')](_0x84eae[_0x5769('0xc')]);}}function timeoutHandler(){logger[_0x5769('0xf')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x5769('0x18')],this['callerid'],this[_0x5769('0x1a')],this[_0x5769('0x1b')]));}function hangupHandler(){logger['info'](util['format'](_0x5769('0x1c'),this['arg_1'],this[_0x5769('0x18')],this[_0x5769('0x19')],this[_0x5769('0x1a')],this[_0x5769('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x12d156){return parser[_0x5769('0x1d')](_0x12d156,{'object':!![]})[_0x5769('0x1e')][_0x5769('0x1f')];}function addVertex(_0x515433,_0x2f039d,_0x4c6467){_0x2f039d[_0x5769('0x20')]=_0x4c6467;if(_0x2f039d[_0x5769('0x21')](_0x5769('0x22'))){_0x2f039d[_0x5769('0x23')]=parseInt(_0x2f039d[_0x5769('0x22')],0xa);}_0x515433[_0x5769('0x24')](_[_0x5769('0x25')](_0x2f039d,'mxCell'));}function initGraph(_0x17df79,_0x412568){var _0x26d811=new Graph();for(var _0x129bbd in _0x17df79){if(_0x17df79[_0x5769('0x21')](_0x129bbd)){if(_[_0x5769('0x26')](_0x17df79[_0x129bbd])){for(var _0x776a8b=0x0;_0x776a8b<_0x17df79[_0x129bbd][_0x5769('0x27')];_0x776a8b+=0x1){addVertex(_0x26d811,_0x17df79[_0x129bbd][_0x776a8b],_0x129bbd);}}else{addVertex(_0x26d811,_0x17df79[_0x129bbd],_0x129bbd);}}}for(var _0x1e889d=0x0;_0x1e889d<_0x412568[_0x5769('0x27')];_0x1e889d+=0x1){if(_0x412568[_0x1e889d][_0x5769('0x28')]&&_0x412568[_0x1e889d][_0x5769('0x29')]){_0x26d811['addEdge'](_0x412568[_0x1e889d]['source'],_0x412568[_0x1e889d]['target'],_0x412568[_0x1e889d][_0x5769('0x2a')]);}}return _0x26d811;}function getSquareProject(_0x59e992,_0x1f981d){rpc[_0x5769('0x2b')](_0x59e992)[_0x5769('0x2c')](function(_0x47b47c){_0x1f981d(null,_0x47b47c);})[_0x5769('0x2d')](function(_0x356efe){_0x1f981d(null,_0x356efe);});}function createSquareReport(_0xba40c9,_0x4d4844){rpc[_0x5769('0x2e')](_0xba40c9)[_0x5769('0x2c')](function(_0x14e2de){if(_0x4d4844){_0x4d4844(null,_0x14e2de);}})[_0x5769('0x2d')](function(_0x9ce179){if(_0x4d4844){_0x4d4844(null,_0x9ce179);}});}function setChannelVariables(_0x1237aa){for(var _0x4e3fcb in _0x1237aa){if(_0x1237aa['hasOwnProperty'](_0x4e3fcb)){if(_0x4e3fcb[_0x5769('0x2f')](_0x5769('0x30'))===0x0){_0x1237aa[_0x4e3fcb[_0x5769('0x31')](0x4)]=_0x1237aa[_0x4e3fcb];delete _0x1237aa[_0x4e3fcb];}}}}function getLogFromObject(_0x21bb34){return util[_0x5769('0x32')](_0x21bb34,{'showHidden':![],'depth':null});}function agiHandler(_0x29d062){var _0x2166f7,_0x262f2f,_0x4ab7e5,_0x1f0b8f,_0x27ec38;logger[_0x5769('0x33')](_0x5769('0x34'),JSON[_0x5769('0x35')](_0x29d062,null,0x2));logger[_0x5769('0xf')](util[_0x5769('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x29d062[_0x5769('0x17')],_0x29d062[_0x5769('0x18')],_0x29d062['callerid'],_0x29d062[_0x5769('0x1a')],_0x29d062[_0x5769('0x1b')]));_0x29d062['on']('error',errorHandler);_0x29d062['on']('close',closeHandler);_0x29d062['on'](_0x5769('0x36'),timeoutHandler);_0x29d062['evtHangup']=![];_0x29d062['on'](_0x5769('0x37'),hangupHandler);var _0x5e4f72=getSquareProject[_0x5769('0x38')](null,_0x29d062[_0x5769('0x17')]);if(_0x5e4f72){if(_0x5e4f72[_0x5769('0x39')]){_0x2166f7=getRoot(_0x5e4f72[_0x5769('0x39')]);if(_0x2166f7&&_0x2166f7[_0x5769('0x3a')]){logger['debug'](_0x5769('0x1f'),JSON[_0x5769('0x35')](_0x2166f7,null,0x2));_0x29d062['joinAt']=moment()['format'](_0x5769('0x3b'));_0x262f2f=initGraph(_[_0x5769('0x25')](_0x2166f7,_0x5769('0x3c')),_0x2166f7[_0x5769('0x3c')]);_0x4ab7e5=new Vertices(_0x29d062,rpc,mailRpc);logger[_0x5769('0xf')](util[_0x5769('0x10')](_0x5769('0x3d'),_0x29d062['arg_1'],_0x29d062['calleridname'],_0x29d062['callerid'],_0x29d062[_0x5769('0x1a')],_0x29d062[_0x5769('0x1b')]));_0x262f2f[_0x5769('0x3e')](_0x2166f7[_0x5769('0x3a')]['id'],function(_0x445968){try{_0x445968=_0x4ab7e5['clear'](_0x445968);logger[_0x5769('0x33')](_0x5769('0x3f'),JSON['stringify'](_0x445968,null,0x2));if(_0x445968['agicommand']===_0x5769('0x40')){logger[_0x5769('0xf')](_0x5769('0x41'));_0x29d062[_0x5769('0x42')]=_0x445968['context']||_0x29d062[_0x5769('0x42')];_0x29d062[_0x5769('0x43')]=_0x445968[_0x5769('0x43')];_0x29d062['priority']=_0x445968[_0x5769('0x44')]?_0x445968[_0x5769('0x44')]-0x1:0x1;return null;}else if(_0x445968&&_0x4ab7e5[_0x445968[_0x5769('0x20')]]){_0x27ec38=_0x4ab7e5[_0x445968['agicommand']](_0x445968);logger[_0x5769('0xf')](_0x5769('0x45'),JSON[_0x5769('0x35')](_0x27ec38,null,0x2));if(_0x27ec38&&_0x27ec38['code']===AGI_CODE_SUCCESS&&_0x27ec38['result']!==AGI_RESULT_ERROR&&!_0x29d062[_0x5769('0x46')]){logger[_0x5769('0x33')](_0x5769('0x45'),getLogFromObject(_0x27ec38));return _['isUndefined'](_0x27ec38[_0x5769('0x47')])?null:_0x27ec38[_0x5769('0x47')][_0x5769('0x48')]();}else{logger[_0x5769('0xb')](_0x5769('0x45'),getLogFromObject(_0x27ec38));return null;}}else{logger[_0x5769('0xb')](_0x5769('0x49'));return null;}}catch(_0x18463a){logger[_0x5769('0xb')](_0x18463a[_0x5769('0xc')]);return null;}});if(_0x2166f7['finally']){logger[_0x5769('0xf')](util[_0x5769('0x10')](_0x5769('0x4a'),_0x29d062['arg_1'],_0x29d062[_0x5769('0x18')],_0x29d062[_0x5769('0x19')],_0x29d062[_0x5769('0x1a')],_0x29d062[_0x5769('0x1b')]));_0x262f2f['traverseBFS'](_0x2166f7[_0x5769('0x4b')]['id'],function(_0x362290){try{_0x362290=_0x4ab7e5[_0x5769('0x4c')](_0x362290);logger[_0x5769('0x33')]('vertex',JSON['stringify'](_0x362290,null,0x2));if(_0x362290&&_0x4ab7e5[_0x362290[_0x5769('0x20')]]){_0x27ec38=_0x4ab7e5[_0x362290['agicommand']](_0x362290);if(_0x27ec38){logger[_0x5769('0x33')]('response',getLogFromObject(_0x27ec38));return _[_0x5769('0x4d')](_0x27ec38[_0x5769('0x47')])?null:_0x27ec38[_0x5769('0x47')]['toString']();}else{logger[_0x5769('0xb')](_0x5769('0x45'),getLogFromObject(_0x27ec38));return null;}}else{logger[_0x5769('0xb')](_0x5769('0x49'));return null;}}catch(_0x5724b6){logger[_0x5769('0xb')](_0x5724b6['stack']);return null;}});}logger[_0x5769('0xf')](util[_0x5769('0x10')](_0x5769('0x4e'),_0x29d062['arg_1'],_0x29d062[_0x5769('0x18')],_0x29d062[_0x5769('0x19')],_0x29d062[_0x5769('0x1a')],_0x29d062[_0x5769('0x1b')]));logger[_0x5769('0xf')](util[_0x5769('0x10')](_0x5769('0x4f'),_0x29d062['context'],_0x29d062[_0x5769('0x43')],parseInt(_0x29d062[_0x5769('0x44')],0xa)+0x1));_0x29d062['continueAt'](_0x29d062[_0x5769('0x42')],_0x29d062[_0x5769('0x43')],parseInt(_0x29d062[_0x5769('0x44')],0xa)+0x1);_0x29d062[_0x5769('0x50')]();}}else{logger[_0x5769('0xb')](util[_0x5769('0x10')](_0x5769('0x51'),_0x29d062[_0x5769('0x17')]));_0x29d062['continueAt'](_0x29d062['context'],_0x29d062[_0x5769('0x43')],parseInt(_0x29d062[_0x5769('0x44')],0xa)+0x1);_0x29d062[_0x5769('0x50')]();}}else{logger[_0x5769('0xb')](util[_0x5769('0x10')]('Project\x20%s\x20not\x20found',_0x29d062[_0x5769('0x17')]));_0x29d062[_0x5769('0x52')](_0x29d062[_0x5769('0x42')],_0x29d062[_0x5769('0x43')],parseInt(_0x29d062[_0x5769('0x44')],0xa)+0x1);_0x29d062['close']();}}function main(){var _0x36c6f1;return utilLicense[_0x5769('0x53')]()[_0x5769('0x2c')](function(_0x51291d){if(_0x51291d){if(_0x51291d[_0x5769('0x54')]){if(_0x51291d['callysquare']&&_0x51291d[_0x5769('0x55')]>0x0){logger['info'](util[_0x5769('0x10')](_0x5769('0x56'),_0x51291d[_0x5769('0x55')]));_0x36c6f1=_0x51291d[_0x5769('0x55')];}else{logger[_0x5769('0xf')](_0x5769('0x57'));}}else{logger[_0x5769('0xf')](_0x5769('0x58'));_0x36c6f1=-0x1;}}})[_0x5769('0x2d')](function(_0x3557d3){logger[_0x5769('0xb')](_0x5769('0x59'),_0x3557d3[_0x5769('0xc')]);})[_0x5769('0x4b')](function(){var _0x1e175a=require('./server')(config[_0x5769('0x4')][_0x5769('0x11')],config['agi']['ip'],_0x36c6f1);_0x1e175a['on'](_0x5769('0xb'),errorHandler);_0x1e175a['on'](_0x5769('0x5a'),listeningHandler);_0x1e175a['on'](_0x5769('0x5b'),connectionHandler);_0x1e175a['on'](_0x5769('0x50'),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 555a008..355052a 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 _0x87a0=['jayson/promise','http','request','then','error','result','catch','SendMail'];(function(_0x42ffe5,_0x434a53){var _0x25add5=function(_0x46468b){while(--_0x46468b){_0x42ffe5['push'](_0x42ffe5['shift']());}};_0x25add5(++_0x434a53);}(_0x87a0,0x188));var _0x087a=function(_0x521469,_0x317b20){_0x521469=_0x521469-0x0;var _0x5c0204=_0x87a0[_0x521469];return _0x5c0204;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x087a('0x0'));var client=jayson['client'][_0x087a('0x1')]({'port':0x232b});function request(_0x3ea295,_0x1171d0){return new BPromise(function(_0x18293c,_0x29150f){return client[_0x087a('0x2')](_0x3ea295,_0x1171d0)[_0x087a('0x3')](function(_0x5777a1){if(_0x5777a1[_0x087a('0x4')]){return _0x29150f(_0x5777a1['error']['message']);}else{return _0x18293c(_0x5777a1[_0x087a('0x5')]);}})[_0x087a('0x6')](function(_0x36c495){return _0x29150f(_0x36c495);});});}exports['sendMailMessage']=function(_0x2c04d9,_0x57ecae){return request(_0x087a('0x7'),{'account':_0x2c04d9,'message':_0x57ecae});}; \ No newline at end of file +var _0x4046=['request','then','error','message','result','catch','bluebird','jayson/promise','client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4046,0x16e));var _0x6404=function(_0x4fcc41,_0x43cf6c){_0x4fcc41=_0x4fcc41-0x0;var _0x410ba1=_0x4046[_0x4fcc41];return _0x410ba1;};'use strict';var BPromise=require(_0x6404('0x0'));var jayson=require(_0x6404('0x1'));var client=jayson[_0x6404('0x2')]['http']({'port':0x232b});function request(_0x2987c6,_0x3a97f3){return new BPromise(function(_0x566c97,_0x234d96){return client[_0x6404('0x3')](_0x2987c6,_0x3a97f3)[_0x6404('0x4')](function(_0x32def8){if(_0x32def8['error']){return _0x234d96(_0x32def8[_0x6404('0x5')][_0x6404('0x6')]);}else{return _0x566c97(_0x32def8[_0x6404('0x7')]);}})[_0x6404('0x8')](function(_0x20e583){return _0x234d96(_0x20e583);});});}exports['sendMailMessage']=function(_0x194e1e,_0x42a034){return request('SendMail',{'account':_0x194e1e,'message':_0x42a034});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c5fc7cc..61e1150 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 _0xb251=['substring','length','split','trim','emit','exports','util','stream','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf'];(function(_0x3d71ba,_0x49a38b){var _0x5e0ed0=function(_0x4d0bfb){while(--_0x4d0bfb){_0x3d71ba['push'](_0x3d71ba['shift']());}};_0x5e0ed0(++_0x49a38b);}(_0xb251,0x15a));var _0x1b25=function(_0xe7a0f5,_0x1670f6){_0xe7a0f5=_0xe7a0f5-0x0;var _0x53df0a=_0xb251[_0xe7a0f5];return _0x53df0a;};'use strict';var util=require(_0x1b25('0x0'));var Transform=require(_0x1b25('0x1'))['Transform'];function AGIReply(_0x29bb68){Transform[_0x1b25('0x2')](this,_0x29bb68);this[_0x1b25('0x3')]='';this[_0x1b25('0x4')]=![];}util[_0x1b25('0x5')](AGIReply,Transform);AGIReply[_0x1b25('0x6')][_0x1b25('0x7')]=function(_0x22c521,_0x282f39,_0x363b8c){var _0x5bbbbf='\x0a',_0x8bce57=['\x0a\x0a',_0x1b25('0x8')],_0x59d4e6=-0x1,_0x9ac6d5=-0x1,_0x3b6b9b='',_0x16b1c3=0x0,_0x2f231c='',_0x4f66ea='';this[_0x1b25('0x3')]+=_0x22c521[_0x1b25('0x9')]();_0x2f231c=this[_0x1b25('0x3')];if(!this[_0x1b25('0x4')]){_0x16b1c3=0x0;while(_0x8bce57[_0x16b1c3]){while((_0x9ac6d5=_0x2f231c[_0x1b25('0xa')](_0x8bce57[_0x16b1c3]))!=-0x1){_0x3b6b9b=_0x8bce57[_0x16b1c3];_0x4f66ea=_0x2f231c['substring'](0x0,_0x9ac6d5);_0x2f231c=_0x2f231c[_0x1b25('0xb')](_0x9ac6d5+_0x3b6b9b[_0x1b25('0xc')]);var _0xfef716=_0x4f66ea[_0x1b25('0xd')](_0x5bbbbf),_0x8e4cac=0x0,_0x528e4c={},_0x3b8d71='',_0x4208f2='',_0x418f0f=-0x1;while(_0xfef716[_0x8e4cac]){_0x418f0f=_0xfef716[_0x8e4cac][_0x1b25('0xa')](':');if(_0x418f0f!=-0x1){_0x3b8d71=_0xfef716[_0x8e4cac]['slice'](0x0,_0x418f0f)[_0x1b25('0xe')]();_0x4208f2=_0xfef716[_0x8e4cac]['slice'](_0x418f0f+0x1)[_0x1b25('0xe')]();if(_0x3b8d71[_0x1b25('0xc')]>0x0){_0x528e4c[_0x3b8d71]=_0x4208f2;}}else{}_0x8e4cac++;}this[_0x1b25('0xf')]('headers',_0x528e4c);this[_0x1b25('0x4')]=!![];}_0x16b1c3++;}this[_0x1b25('0x3')]=_0x2f231c;}else{while((_0x59d4e6=_0x2f231c['indexOf'](_0x5bbbbf))!=-0x1){_0x4f66ea=_0x2f231c[_0x1b25('0xb')](0x0,_0x59d4e6);this[_0x1b25('0xf')]('line',_0x4f66ea);_0x2f231c=_0x2f231c[_0x1b25('0xb')](_0x59d4e6+_0x5bbbbf[_0x1b25('0xc')]);}this[_0x1b25('0x3')]=_0x2f231c;}_0x363b8c();};module[_0x1b25('0x10')]=AGIReply; \ No newline at end of file +var _0x122a=['trim','emit','headers','_inBody','line','exports','util','stream','Transform','call','inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer','indexOf','substring','length','slice'];(function(_0x3096f8,_0x13892f){var _0x30fb12=function(_0x287ef6){while(--_0x287ef6){_0x3096f8['push'](_0x3096f8['shift']());}};_0x30fb12(++_0x13892f);}(_0x122a,0xba));var _0xa122=function(_0x46468e,_0xfd8299){_0x46468e=_0x46468e-0x0;var _0x4d5dcb=_0x122a[_0x46468e];return _0x4d5dcb;};'use strict';var util=require(_0xa122('0x0'));var Transform=require(_0xa122('0x1'))[_0xa122('0x2')];function AGIReply(_0x237885){Transform[_0xa122('0x3')](this,_0x237885);this['_localBuffer']='';this['_inBody']=![];}util[_0xa122('0x4')](AGIReply,Transform);AGIReply['prototype'][_0xa122('0x5')]=function(_0xbd5f48,_0x3de7af,_0x3c8130){var _0x526272='\x0a',_0x576d57=['\x0a\x0a',_0xa122('0x6')],_0x5157f6=-0x1,_0x23e139=-0x1,_0x190f74='',_0x4d180f=0x0,_0x39cea5='',_0x22835b='';this[_0xa122('0x7')]+=_0xbd5f48['toString']();_0x39cea5=this['_localBuffer'];if(!this['_inBody']){_0x4d180f=0x0;while(_0x576d57[_0x4d180f]){while((_0x23e139=_0x39cea5[_0xa122('0x8')](_0x576d57[_0x4d180f]))!=-0x1){_0x190f74=_0x576d57[_0x4d180f];_0x22835b=_0x39cea5['substring'](0x0,_0x23e139);_0x39cea5=_0x39cea5[_0xa122('0x9')](_0x23e139+_0x190f74[_0xa122('0xa')]);var _0x4fcc46=_0x22835b['split'](_0x526272),_0xc2f4bb=0x0,_0x573766={},_0x55772a='',_0x18fd6b='',_0x3d0912=-0x1;while(_0x4fcc46[_0xc2f4bb]){_0x3d0912=_0x4fcc46[_0xc2f4bb][_0xa122('0x8')](':');if(_0x3d0912!=-0x1){_0x55772a=_0x4fcc46[_0xc2f4bb][_0xa122('0xb')](0x0,_0x3d0912)[_0xa122('0xc')]();_0x18fd6b=_0x4fcc46[_0xc2f4bb]['slice'](_0x3d0912+0x1)[_0xa122('0xc')]();if(_0x55772a[_0xa122('0xa')]>0x0){_0x573766[_0x55772a]=_0x18fd6b;}}else{}_0xc2f4bb++;}this[_0xa122('0xd')](_0xa122('0xe'),_0x573766);this[_0xa122('0xf')]=!![];}_0x4d180f++;}this[_0xa122('0x7')]=_0x39cea5;}else{while((_0x5157f6=_0x39cea5['indexOf'](_0x526272))!=-0x1){_0x22835b=_0x39cea5[_0xa122('0x9')](0x0,_0x5157f6);this[_0xa122('0xd')](_0xa122('0x10'),_0x22835b);_0x39cea5=_0x39cea5[_0xa122('0x9')](_0x5157f6+_0x526272[_0xa122('0xa')]);}this[_0xa122('0x7')]=_0x39cea5;}_0x3c8130();};module[_0xa122('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 5cbfe24..c1559d5 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 _0x01eb=['name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','client','http','error','message','result','catch','getSquareProject','production','getMailAccountById','MailServerOut','Smtp'];(function(_0x2736ee,_0x5114de){var _0x1b39e2=function(_0x1c883b){while(--_0x1c883b){_0x2736ee['push'](_0x2736ee['shift']());}};_0x1b39e2(++_0x5114de);}(_0x01eb,0x1ea));var _0xb01e=function(_0x2f2e0e,_0xbeb776){_0x2f2e0e=_0x2f2e0e-0x0;var _0x465367=_0x01eb[_0x2f2e0e];return _0x465367;};'use strict';var BPromise=require(_0xb01e('0x0'));var moment=require(_0xb01e('0x1'));var _=require(_0xb01e('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0xb01e('0x3')][_0xb01e('0x4')]({'port':0x2329});function request(_0x19b430,_0x7de52d){return new BPromise(function(_0x2dc736,_0x584ab7){return client['request'](_0x19b430,_0x7de52d)['then'](function(_0x1f133c){if(_0x1f133c['error']){return _0x584ab7(_0x1f133c[_0xb01e('0x5')][_0xb01e('0x6')]);}else{return _0x2dc736(_0x1f133c[_0xb01e('0x7')]);}})[_0xb01e('0x8')](function(_0xce7c6d){return _0x584ab7(_0xce7c6d);});});}exports[_0xb01e('0x9')]=function(_0x1cb154){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1cb154},'attributes':[_0xb01e('0xa')]}});};exports[_0xb01e('0xb')]=function(_0x1bbde9){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1bbde9},'include':[{'model':_0xb01e('0xc'),'as':_0xb01e('0xd')}],'attributes':['id',_0xb01e('0xe'),_0xb01e('0xf')]}});};exports[_0xb01e('0x10')]=function(_0x3385ef){return request(_0xb01e('0x11'),{'options':{'where':{'id':_0x3385ef},'attributes':['name']}});};exports[_0xb01e('0x12')]=function(_0x49a3f7){return request(_0xb01e('0x13'),{'options':{'where':{'id':_0x49a3f7},'attributes':[_0xb01e('0xe')]}});};exports[_0xb01e('0x14')]=function(_0x4815b6){return request('ShowVariable',{'options':{'where':{'id':_0x4815b6},'attributes':[_0xb01e('0xe')]}});};exports[_0xb01e('0x15')]=function(_0x296d5d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x296d5d},'attributes':[_0xb01e('0x16')]}});};exports[_0xb01e('0x17')]=function(_0x10b2e5){return request(_0xb01e('0x18'),{'options':{'where':{'id':_0x10b2e5},'attributes':['name']}});};exports[_0xb01e('0x19')]=function(_0xe6f48f){return request(_0xb01e('0x1a'),{'options':{'where':{'id':_0xe6f48f},'attributes':[_0xb01e('0xe')]}});};exports[_0xb01e('0x1b')]=function(_0x51d474){return request(_0xb01e('0x1c'),{'options':{'where':{'id':_0x51d474},'attributes':[_0xb01e('0x1d')]}});};exports['getIntervalById']=function(_0x387545){return request(_0xb01e('0x1e'),{'options':{'raw':![],'where':{'id':_0x387545},'include':[{'model':'Interval','as':_0xb01e('0x1f')}]}});};exports[_0xb01e('0x20')]=function(_0x1a3a24){return request(_0xb01e('0x21'),{'options':{'where':{'id':_0x1a3a24},'attributes':['id',_0xb01e('0xe')]}});};exports[_0xb01e('0x22')]=function(_0x5e7057){return request('CreateSmsMessage',{'body':_0x5e7057});};exports[_0xb01e('0x23')]=function(_0x2fe9e2){return request(_0xb01e('0x24'),{'body':_0x2fe9e2});};exports[_0xb01e('0x25')]=function(_0x65fcf8){return request('CreateSquareReport',{'body':_['merge'](_0x65fcf8,{'project_name':_0x65fcf8[_0xb01e('0x26')],'prev_project_name':_0x65fcf8[_0xb01e('0x27')]||'','is_subproject':_0x65fcf8[_0xb01e('0x27')]?!![]:![],'leaveAt':moment()[_0xb01e('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xb01e('0x29')]=function(_0x9008c7){return request('CreateSquareRecording',{'body':_0x9008c7});};exports[_0xb01e('0x2a')]=function(_0x446511){return request(_0xb01e('0x2b'),{'body':_0x446511});};exports[_0xb01e('0x2c')]=function(_0x464b14){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x464b14[_0xb01e('0x2d')],'ListId':_0x464b14[_0xb01e('0x2e')]}}})[_0xb01e('0x2f')](function(_0x372593){if(_0x372593){return _0x372593;}return request(_0xb01e('0x30'),{'body':_0x464b14});});};exports[_0xb01e('0x31')]=function(_0xeda54d){return request(_0xb01e('0x32'),{'options':{'where':{'id':_0xeda54d},'attributes':[_0xb01e('0xe')]}});};exports['agentLogin']=function(_0x5e5400,_0x4014db){return request('LoginUser',{'body':{'interface':_0x4014db},'options':{'where':_0x5e5400}});};exports[_0xb01e('0x33')]=function(_0x483621,_0x2d66a0,_0x4f98fd){return request(_0xb01e('0x34'),{'body':{'type':_0x2d66a0,'uniqueid':_0x4f98fd},'options':{'where':_0x483621}});};exports[_0xb01e('0x35')]=function(_0x57e22c){return request(_0xb01e('0x36'),{'body':{},'options':{'where':_0x57e22c}});};exports['agentLogout']=function(_0x47dc5f){return request(_0xb01e('0x37'),{'body':{},'options':{'where':_0x47dc5f}});}; \ No newline at end of file +var _0x987d=['error','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','name','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','lodash','util','request','then'];(function(_0xc4e6ca,_0x5d6893){var _0x580262=function(_0x464fef){while(--_0x464fef){_0xc4e6ca['push'](_0xc4e6ca['shift']());}};_0x580262(++_0x5d6893);}(_0x987d,0x1cb));var _0xd987=function(_0x568193,_0x2ba48b){_0x568193=_0x568193-0x0;var _0x240908=_0x987d[_0x568193];return _0x240908;};'use strict';var BPromise=require(_0xd987('0x0'));var moment=require('moment');var _=require(_0xd987('0x1'));var util=require(_0xd987('0x2'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x2329});function request(_0x3769b8,_0x237d31){return new BPromise(function(_0x3f1b47,_0x52efd9){return client[_0xd987('0x3')](_0x3769b8,_0x237d31)[_0xd987('0x4')](function(_0x2074fc){if(_0x2074fc['error']){return _0x52efd9(_0x2074fc[_0xd987('0x5')]['message']);}else{return _0x3f1b47(_0x2074fc[_0xd987('0x6')]);}})[_0xd987('0x7')](function(_0x530cec){return _0x52efd9(_0x530cec);});});}exports['getSquareProject']=function(_0x17debd){return request(_0xd987('0x8'),{'options':{'raw':![],'where':{'name':_0x17debd},'attributes':[_0xd987('0x9')]}});};exports[_0xd987('0xa')]=function(_0x121e98){return request(_0xd987('0xb'),{'options':{'raw':![],'where':{'id':_0x121e98},'include':[{'model':_0xd987('0xc'),'as':_0xd987('0xd')}],'attributes':['id','name',_0xd987('0xe')]}});};exports[_0xd987('0xf')]=function(_0x18f1cf){return request(_0xd987('0x8'),{'options':{'where':{'id':_0x18f1cf},'attributes':['name']}});};exports[_0xd987('0x10')]=function(_0x3f7e8e){return request(_0xd987('0x11'),{'options':{'where':{'id':_0x3f7e8e},'attributes':['name']}});};exports[_0xd987('0x12')]=function(_0x175853){return request(_0xd987('0x13'),{'options':{'where':{'id':_0x175853},'attributes':[_0xd987('0x14')]}});};exports[_0xd987('0x15')]=function(_0x30a3d7){return request(_0xd987('0x16'),{'options':{'where':{'id':_0x30a3d7},'attributes':[_0xd987('0x17')]}});};exports[_0xd987('0x18')]=function(_0x3e3853){return request(_0xd987('0x19'),{'options':{'where':{'id':_0x3e3853},'attributes':[_0xd987('0x14')]}});};exports[_0xd987('0x1a')]=function(_0x20a963){return request(_0xd987('0x1b'),{'options':{'where':{'id':_0x20a963},'attributes':[_0xd987('0x14')]}});};exports[_0xd987('0x1c')]=function(_0x3d316c){return request(_0xd987('0x1d'),{'options':{'where':{'id':_0x3d316c},'attributes':[_0xd987('0x1e')]}});};exports['getIntervalById']=function(_0x45e072){return request(_0xd987('0x1f'),{'options':{'raw':![],'where':{'id':_0x45e072},'include':[{'model':_0xd987('0x20'),'as':_0xd987('0x21')}]}});};exports[_0xd987('0x22')]=function(_0x1a4ab7){return request(_0xd987('0x23'),{'options':{'where':{'id':_0x1a4ab7},'attributes':['id',_0xd987('0x14')]}});};exports['createSmsMessage']=function(_0x140b21){return request(_0xd987('0x24'),{'body':_0x140b21});};exports[_0xd987('0x25')]=function(_0x1e2483){return request('CreateSquareDetailsReport',{'body':_0x1e2483});};exports['createSquareReport']=function(_0x20c6df){return request(_0xd987('0x26'),{'body':_[_0xd987('0x27')](_0x20c6df,{'project_name':_0x20c6df[_0xd987('0x28')],'prev_project_name':_0x20c6df[_0xd987('0x29')]||'','is_subproject':_0x20c6df[_0xd987('0x29')]?!![]:![],'leaveAt':moment()[_0xd987('0x2a')](_0xd987('0x2b'))})});};exports['createSquareRecording']=function(_0x3de60d){return request('CreateSquareRecording',{'body':_0x3de60d});};exports[_0xd987('0x2c')]=function(_0x4b105c){return request('CreateSquareMessage',{'body':_0x4b105c});};exports[_0xd987('0x2d')]=function(_0x393b89){return request(_0xd987('0x2e'),{'options':{'raw':![],'where':{'phone':_0x393b89[_0xd987('0x2f')],'ListId':_0x393b89[_0xd987('0x30')]}}})[_0xd987('0x4')](function(_0x401b7){if(_0x401b7){return _0x401b7;}return request(_0xd987('0x31'),{'body':_0x393b89});});};exports[_0xd987('0x32')]=function(_0x165a88){return request('ShowPause',{'options':{'where':{'id':_0x165a88},'attributes':[_0xd987('0x14')]}});};exports[_0xd987('0x33')]=function(_0xdd93e6,_0x31fd74){return request(_0xd987('0x34'),{'body':{'interface':_0x31fd74},'options':{'where':_0xdd93e6}});};exports[_0xd987('0x35')]=function(_0x2eac8e,_0x90c8d1,_0xc38ae0){return request(_0xd987('0x36'),{'body':{'type':_0x90c8d1,'uniqueid':_0xc38ae0},'options':{'where':_0x2eac8e}});};exports[_0xd987('0x37')]=function(_0x59034d){return request(_0xd987('0x38'),{'body':{},'options':{'where':_0x59034d}});};exports['agentLogout']=function(_0x2948e1){return request(_0xd987('0x39'),{'body':{},'options':{'where':_0x2948e1}});}; \ 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 6e0ac8d..120aa82 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 _0x2171=['exports','./lex'];(function(_0x4d66d4,_0x4733fc){var _0x32d018=function(_0x4118eb){while(--_0x4118eb){_0x4d66d4['push'](_0x4d66d4['shift']());}};_0x32d018(++_0x4733fc);}(_0x2171,0x143));var _0x1217=function(_0x12f08d,_0x5f13b3){_0x12f08d=_0x12f08d-0x0;var _0x3a49cd=_0x2171[_0x12f08d];return _0x3a49cd;};var polly=require('./polly');var lex=require(_0x1217('0x0'));module[_0x1217('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4cfd=['./polly','./lex'];(function(_0x57a1b4,_0x5d358b){var _0x2f3445=function(_0x972d68){while(--_0x972d68){_0x57a1b4['push'](_0x57a1b4['shift']());}};_0x2f3445(++_0x5d358b);}(_0x4cfd,0x170));var _0xd4cf=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x4cfd[_0x42bc91];return _0x3f5507;};var polly=require(_0xd4cf('0x0'));var lex=require(_0xd4cf('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1bcc606..f61978c 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 _0xee5b=['./lib/api'];(function(_0x72736,_0x3d666b){var _0x51c33d=function(_0x37473e){while(--_0x37473e){_0x72736['push'](_0x72736['shift']());}};_0x51c33d(++_0x3d666b);}(_0xee5b,0x1f4));var _0xbee5=function(_0x44656e,_0x55be69){_0x44656e=_0x44656e-0x0;var _0x3d1946=_0xee5b[_0x44656e];return _0x3d1946;};'use strict';var lex=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857){return lex(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857);}; \ No newline at end of file +var _0xf4eb=['./lib/api'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x82436,_0x8bd6ab){_0x82436=_0x82436-0x0;var _0xde7a31=_0xf4eb[_0x82436];return _0xde7a31;};'use strict';var lex=require(_0xbf4e('0x0'));module['exports']=function(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7){return lex(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7);}; \ 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 c2a1a1e..31269ac 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(_0x5e001b,_0x90aa75){var _0x13491c=function(_0x365817){while(--_0x365817){_0x5e001b['push'](_0x5e001b['shift']());}};_0x13491c(++_0x90aa75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x1391e0,_0x29fb0c){var _0x275e81=function(_0xd17a6){while(--_0xd17a6){_0x1391e0['push'](_0x1391e0['shift']());}};_0x275e81(++_0x29fb0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 5030d83..165e9ec 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 _0xdc2d=['exports','./lib/api'];(function(_0x20a590,_0x1e8a6d){var _0x2e1b41=function(_0x48359f){while(--_0x48359f){_0x20a590['push'](_0x20a590['shift']());}};_0x2e1b41(++_0x1e8a6d);}(_0xdc2d,0x1e9));var _0xddc2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdc2d[_0xa464c9];return _0x3d73c4;};'use strict';var polly=require(_0xddc2('0x0'));module[_0xddc2('0x1')]=function(_0x118376,_0x50e963,_0x8eb536,_0x38be6e,_0x2d532c,_0xaff26f,_0x22eff8){return polly(_0x118376,_0x50e963,_0x8eb536,_0x38be6e,_0x2d532c,_0xaff26f,_0x22eff8);}; \ No newline at end of file +var _0x9bb0=['./lib/api'];(function(_0x27a1a0,_0x410857){var _0x1321a0=function(_0x4d0991){while(--_0x4d0991){_0x27a1a0['push'](_0x27a1a0['shift']());}};_0x1321a0(++_0x410857);}(_0x9bb0,0x146));var _0x09bb=function(_0x5ddda9,_0x43e558){_0x5ddda9=_0x5ddda9-0x0;var _0x53a004=_0x9bb0[_0x5ddda9];return _0x53a004;};'use strict';var polly=require(_0x09bb('0x0'));module['exports']=function(_0x2a784c,_0x44469f,_0x36d632,_0x593c08,_0x1cde74,_0x527350,_0x2a91b7){return polly(_0x2a784c,_0x44469f,_0x36d632,_0x593c08,_0x1cde74,_0x527350,_0x2a91b7);}; \ 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 5578576..a8e5a4e 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 _0xff40=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','bluebird'];(function(_0x51ec34,_0x3f94dd){var _0x4fbb32=function(_0x201088){while(--_0x201088){_0x51ec34['push'](_0x51ec34['shift']());}};_0x4fbb32(++_0x3f94dd);}(_0xff40,0x1af));var _0x0ff4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xff40[_0x23e7c1];return _0x1add43;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x0ff4('0x0'));var rs=require(_0x0ff4('0x1'));var AWS=require(_0x0ff4('0x2'));function pollyResult(_0x541d80,_0x1739db,_0x5e84bf){return new BPromise(function(_0x1c64cb,_0x4c3f0f){_0x541d80[_0x0ff4('0x3')](_0x1739db,function(_0x448330,_0x5d619b){if(_0x448330){_0x4c3f0f(_0x448330);}else if(_0x5d619b){if(_0x5d619b[_0x0ff4('0x4')]instanceof Buffer){fs['writeFile'](_0x5e84bf,_0x5d619b[_0x0ff4('0x4')],function(_0x4e45b4){if(_0x4e45b4){_0x4c3f0f(_0x4e45b4);}else{_0x1c64cb();}});}else{_0x4c3f0f(new Error(_0x0ff4('0x5')));}}else{_0x4c3f0f(new Error(_0x0ff4('0x6')));}});});}module['exports']=function(_0x4e65bb,_0x248d84,_0x2209b7,_0x262532,_0x19d818,_0x1bff82,_0x2db7b2){var _0x3e3c33=new AWS[(_0x0ff4('0x7'))]({'accessKeyId':_0x4e65bb,'secretAccessKey':_0x248d84,'region':_0x2209b7});var _0xaacf4e={'Text':_0x19d818,'TextType':_0x1bff82||'text','OutputFormat':'mp3','VoiceId':_0x262532};return pollyResult(_0x3e3c33,_0xaacf4e,_0x2db7b2);}; \ No newline at end of file +var _0x2bf2=['writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','bluebird','randomstring','aws-sdk'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x2bf2,0x1da));var _0x22bf=function(_0x23c1d1,_0x2b8f2e){_0x23c1d1=_0x23c1d1-0x0;var _0xb71325=_0x2bf2[_0x23c1d1];return _0xb71325;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x22bf('0x0'));var rs=require(_0x22bf('0x1'));var AWS=require(_0x22bf('0x2'));function pollyResult(_0x4e7914,_0x4bd85b,_0x26e74f){return new BPromise(function(_0x22ef70,_0x2a2c71){_0x4e7914['synthesizeSpeech'](_0x4bd85b,function(_0x176abf,_0x4cbc52){if(_0x176abf){_0x2a2c71(_0x176abf);}else if(_0x4cbc52){if(_0x4cbc52['AudioStream']instanceof Buffer){fs[_0x22bf('0x3')](_0x26e74f,_0x4cbc52[_0x22bf('0x4')],function(_0x1f3a43){if(_0x1f3a43){_0x2a2c71(_0x1f3a43);}else{_0x22ef70();}});}else{_0x2a2c71(new Error(_0x22bf('0x5')));}}else{_0x2a2c71(new Error(_0x22bf('0x6')));}});});}module[_0x22bf('0x7')]=function(_0x1e3f80,_0x3eecf2,_0x254ca6,_0x11b5ba,_0x5157cb,_0x1b9fb0,_0x26b6eb){var _0x4716fd=new AWS[(_0x22bf('0x8'))]({'accessKeyId':_0x1e3f80,'secretAccessKey':_0x3eecf2,'region':_0x254ca6});var _0x55a5be={'Text':_0x5157cb,'TextType':_0x1b9fb0||'text','OutputFormat':'mp3','VoiceId':_0x11b5ba};return pollyResult(_0x4716fd,_0x55a5be,_0x26b6eb);}; \ 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 723fbae..966ff6a 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x2fb4ae,_0x3fd4e7,_0xb6ff52,_0x1aa655){return asr(_0x2fb4ae,_0x3fd4e7,_0xb6ff52);}; \ No newline at end of file +var _0xa995=['exports','./lib/api'];(function(_0x502544,_0x1b6845){var _0x4d9ecd=function(_0x339f9e){while(--_0x339f9e){_0x502544['push'](_0x502544['shift']());}};_0x4d9ecd(++_0x1b6845);}(_0xa995,0x1eb));var _0x5a99=function(_0x14ab3e,_0x5a1093){_0x14ab3e=_0x14ab3e-0x0;var _0x2d2159=_0xa995[_0x14ab3e];return _0x2d2159;};'use strict';var asr=require(_0x5a99('0x0'));module[_0x5a99('0x1')]=function(_0x2ab421,_0x48b98e,_0x1968d7,_0x3b64f4){return asr(_0x2ab421,_0x48b98e,_0x1968d7);}; \ 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 f53ddcd..8f1c66c 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 _0x0c02=['length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','bluebird','https://speech.googleapis.com','string'];(function(_0x1fa91a,_0x33ac8c){var _0x2e63eb=function(_0x14796d){while(--_0x14796d){_0x1fa91a['push'](_0x1fa91a['shift']());}};_0x2e63eb(++_0x33ac8c);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var url=require('url');var BPromise=require(_0x20c0('0x0'));var fs=require('fs');var host=_0x20c0('0x1');module['exports']=function(_0x1338cf,_0x5c8750,_0x454922){return new BPromise(function(_0x6d03d0,_0x38022e){var _0x2e9d65;if(typeof _0x1338cf!==_0x20c0('0x2')||_0x1338cf[_0x20c0('0x3')]===0x0){return _0x38022e(_0x20c0('0x4'));}if(typeof _0x5c8750!==_0x20c0('0x2')||_0x5c8750['length']===0x0){return _0x38022e('key\x20should\x20be\x20a\x20string');}if(typeof _0x454922!=='undefined'&&(typeof _0x454922!=='string'||_0x454922[_0x20c0('0x3')]===0x0)){return _0x38022e(_0x20c0('0x5'));}try{_0x2e9d65=fs[_0x20c0('0x6')](_0x1338cf)[_0x20c0('0x7')](_0x20c0('0x8'));}catch(_0xedd21d){return _0x38022e(_0xedd21d);}return _0x6d03d0({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x5c8750,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x454922},'audio':{'content':_0x2e9d65}},'json':!![]});});}; \ No newline at end of file +var _0x34e5=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','POST','LINEAR16','8000','bluebird','exports','string','length'];(function(_0x28ab25,_0x3a942a){var _0x2e4fc2=function(_0x5e23c6){while(--_0x5e23c6){_0x28ab25['push'](_0x28ab25['shift']());}};_0x2e4fc2(++_0x3a942a);}(_0x34e5,0x172));var _0x534e=function(_0x24a503,_0x4f0894){_0x24a503=_0x24a503-0x0;var _0x243b82=_0x34e5[_0x24a503];return _0x243b82;};'use strict';var url=require('url');var BPromise=require(_0x534e('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x534e('0x1')]=function(_0x467e3e,_0x425ae8,_0x246650){return new BPromise(function(_0x83eb2d,_0x50b790){var _0x11a158;if(typeof _0x467e3e!==_0x534e('0x2')||_0x467e3e[_0x534e('0x3')]===0x0){return _0x50b790(_0x534e('0x4'));}if(typeof _0x425ae8!==_0x534e('0x2')||_0x425ae8[_0x534e('0x3')]===0x0){return _0x50b790(_0x534e('0x5'));}if(typeof _0x246650!=='undefined'&&(typeof _0x246650!==_0x534e('0x2')||_0x246650[_0x534e('0x3')]===0x0)){return _0x50b790(_0x534e('0x6'));}try{_0x11a158=fs['readFileSync'](_0x467e3e)['toString'](_0x534e('0x7'));}catch(_0x4c495c){return _0x50b790(_0x4c495c);}return _0x83eb2d({'method':_0x534e('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x425ae8,'body':{'config':{'encoding':_0x534e('0x9'),'sampleRateHertz':_0x534e('0xa'),'languageCode':_0x246650},'audio':{'content':_0x11a158}},'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 35921d4..4d32dd2 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 _0xc94f=['exports'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0xc94f,0x1a0));var _0xfc94=function(_0x197f1e,_0x1f25ef){_0x197f1e=_0x197f1e-0x0;var _0x353b04=_0xc94f[_0x197f1e];return _0x353b04;};var asr=require('./asr');module[_0xfc94('0x0')]={'asr':asr}; \ No newline at end of file +var _0xa6d3=['./asr','exports'];(function(_0x2afa1d,_0x2d5e81){var _0x4d1f88=function(_0xc6a788){while(--_0xc6a788){_0x2afa1d['push'](_0x2afa1d['shift']());}};_0x4d1f88(++_0x2d5e81);}(_0xa6d3,0x1dc));var _0x3a6d=function(_0x2b1a24,_0x394d9e){_0x2b1a24=_0x2b1a24-0x0;var _0x5ca808=_0xa6d3[_0x2b1a24];return _0x5ca808;};var asr=require(_0x3a6d('0x0'));module[_0x3a6d('0x1')]={'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 ddde523..22cd8c4 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 _0x80a6=['queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','awsLex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','google-tts-api','url','parse','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','protocol','https:','data','end','error\x20convert','finish\x20to\x20convert','start','tmp','generate','writeFileSync','then','unlink','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','ssml','input','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x80a6,0x19b));var _0x680a=function(_0x70ec59,_0x1ce978){_0x70ec59=_0x70ec59-0x0;var _0x5a555f=_0x80a6[_0x70ec59];return _0x5a555f;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x680a('0x0'));var dialogflow=require(_0x680a('0x1'));var fs=require('fs');var http=require(_0x680a('0x2'));var https=require(_0x680a('0x3'));var md5=require(_0x680a('0x4'));var path=require(_0x680a('0x5'));var querystring=require(_0x680a('0x6'));var rp=require(_0x680a('0x7'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x680a('0x8'));var urlParse=require(_0x680a('0x9'))[_0x680a('0xa')];var util=require(_0x680a('0xb'));var aws=require('./aws');var google=require(_0x680a('0xc'));var sestek=require(_0x680a('0xd'));var tilde=require(_0x680a('0xe'));var logger=require('../../../config/logger')(_0x680a('0xf'));var ISPEECH_API=_0x680a('0x10');function downloadFile(_0x2b78dc,_0x1c343e){return new BPromise(function(_0x372300,_0x1ac126){var _0x1c7053=urlParse(_0x2b78dc);var _0x1186cc=_0x1c7053['protocol']==='https:'?https:http;var _0x9f31c4={'host':_0x1c7053[_0x680a('0x11')],'path':_0x1c7053[_0x680a('0x5')],'headers':{'user-agent':_0x680a('0x12')}};_0x1186cc[_0x680a('0x13')](_0x9f31c4,function(_0x5cee0c){if(_0x5cee0c[_0x680a('0x14')]!==0xc8){logger[_0x680a('0x15')](_0x680a('0x16')+_0x2b78dc+_0x680a('0x17')+_0x5cee0c[_0x680a('0x14')]+'\x20('+_0x5cee0c[_0x680a('0x18')]+')');_0x1ac126(new Error(_0x680a('0x16')+_0x2b78dc+_0x680a('0x17')+_0x5cee0c[_0x680a('0x14')]+'\x20('+_0x5cee0c[_0x680a('0x18')]+')'));return;}var _0x45c24e=fs[_0x680a('0x19')](_0x1c343e);_0x45c24e['on'](_0x680a('0x1a'),function(){logger[_0x680a('0x1b')](_0x680a('0x1c'));_0x45c24e[_0x680a('0x1d')](_0x372300);});_0x45c24e['on']('error',function(_0x1676ee){fs['unlink'](_0x1c343e);logger[_0x680a('0x15')](_0x680a('0x1e'),_0x1676ee);_0x1ac126(_0x1676ee);});_0x5cee0c['pipe'](_0x45c24e);})['on']('error',function(_0x1b3327){logger['error'](_0x1b3327);_0x1ac126(_0x1b3327);})['end']();});}function uploadFile(_0x24a956){return new BPromise(function(_0x150e13,_0x278526){var _0x412ee2=urlParse(_0x24a956);var _0x28651e=_0x412ee2[_0x680a('0x1f')]===_0x680a('0x20')?https:http;var _0xe0a48c={'host':_0x412ee2['host'],'path':_0x412ee2[_0x680a('0x5')],'headers':{'user-agent':_0x680a('0x12')}};_0x28651e['get'](_0xe0a48c,function(_0x1b43c7){if(_0x1b43c7[_0x680a('0x14')]!==0xc8){_0x278526(new Error(_0x680a('0x16')+_0x24a956+_0x680a('0x17')+_0x1b43c7[_0x680a('0x14')]+'\x20('+_0x1b43c7['statusMessage']+')'));return;}var _0x4b8ed7='';_0x1b43c7['on'](_0x680a('0x21'),function(_0x956f51){_0x4b8ed7+=_0x956f51;});_0x1b43c7['on'](_0x680a('0x22'),function(){_0x150e13(_0x4b8ed7);});})['on'](_0x680a('0x15'),function(_0x3654f2){_0x278526(_0x3654f2);})[_0x680a('0x22')]();});}function convertFile(_0x1561b6,_0x279d74){return new BPromise(function(_0x524145,_0x3190b0){var _0x19051a=sox['transcode'](_0x1561b6,_0x279d74,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x19051a['on'](_0x680a('0x15'),function(_0x59b744){logger[_0x680a('0x15')](_0x680a('0x23'),_0x59b744);_0x3190b0(_0x59b744);});_0x19051a['on'](_0x680a('0x22'),function(){logger[_0x680a('0x1b')](_0x680a('0x24'));_0x524145();});_0x19051a[_0x680a('0x25')]();});}function base64Decode(_0x3e6acf,_0x3fef4e){var _0x31f402=path['resolve'](__dirname,_0x680a('0x26'),rs[_0x680a('0x27')](0x4)+'.wav');fs[_0x680a('0x28')](_0x31f402,_0x3e6acf,'base64');return convertFile(_0x31f402,_0x3fef4e)[_0x680a('0x29')](function(){try{fs[_0x680a('0x2a')](_0x31f402);fs[_0x680a('0x2b')](_0x3fef4e,_0x680a('0x2c'));}catch(_0x14098b){logger['error'](_0x14098b);}return _0x3fef4e[_0x680a('0x2d')]('.')[0x0];});}function base64Encode(_0x499c53){var _0x2c99be=fs[_0x680a('0x2e')](_0x499c53);return new Buffer(_0x2c99be)[_0x680a('0x2f')](_0x680a('0x30'));}exports[_0x680a('0x31')]=function(_0x3e5a63,_0x3d8c61,_0x39b888,_0x66b76d,_0x40b10d,_0x5a26f4){var _0x26f782,_0x5dfbce;var _0x459f68='https://texttospeech.googleapis.com/v1/';var _0x478f0d='?key='+_0x3e5a63;var _0x385059={};if(_0x3d8c61===_0x680a('0x32')){_0x385059['input']={'ssml':_0x39b888};}else{_0x385059[_0x680a('0x33')]={'text':_0x39b888};};_0x385059['voice']={'languageCode':_0x66b76d,'ssmlGender':_0x40b10d};_0x385059[_0x680a('0x34')]={'audioEncoding':_0x680a('0x35'),'sampleRateHertz':0x1f40};var _0x2e1247={'url':_0x459f68+_0x680a('0x36')+_0x478f0d,'method':_0x680a('0x37'),'json':!![],'body':_0x385059};return rp(_0x2e1247)['then'](function(_0x4cb739){return new BPromise(function(_0x2437cd,_0x40dd63){_0x26f782=path[_0x680a('0x38')](__dirname,'tmp',rs[_0x680a('0x27')](0x4)+_0x680a('0x39'));var _0x18aa75=Buffer[_0x680a('0x3a')](_0x4cb739[_0x680a('0x3b')],_0x680a('0x30'));return fs[_0x680a('0x3c')](_0x26f782,_0x18aa75,function(_0x19b37d){_0x40dd63(_0x19b37d);},function(_0x12b1b7){fs['chmodSync'](_0x26f782,'777');_0x2437cd(_0x12b1b7);});});})[_0x680a('0x29')](function(_0x4aa003){_0x5dfbce=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x26f782,_0x5dfbce);})[_0x680a('0x29')](function(){try{fs[_0x680a('0x2a')](_0x26f782);fs[_0x680a('0x2b')](_0x5dfbce,_0x680a('0x2c'));}catch(_0x3fca9b){logger[_0x680a('0x15')](_0x3fca9b);}logger[_0x680a('0x1b')](_0x680a('0x3d'),_0x5dfbce[_0x680a('0x2d')]('.')[0x0]);return _0x5dfbce['split']('.')[0x0];});};exports[_0x680a('0x3e')]=function(_0x192922,_0x54cc98){var _0x18b1b8=_0x680a('0x3f');var _0x10bab4,_0x253f46;var _0x300a85;var _0x2d0c93={'encoding':_0x680a('0x40'),'method':_0x680a('0x37'),'timeout':0x2710,'url':_0x18b1b8,'headers':{'Content-Type':_0x680a('0x41')},'body':_0x680a('0x42')+encodeURIComponent(JSON[_0x680a('0x43')]([[[_0x680a('0x44'),JSON['stringify']([_0x192922,_0x54cc98||'en',![],_0x680a('0x45')]),null,_0x680a('0x46')]]]))};return rp(_0x2d0c93)['then'](function(_0x180ee3){try{_0x300a85=eval(_0x180ee3[_0x680a('0x47')](0x5))[0x0][0x2];}catch(_0x317d5d){throw new Error(_0x680a('0x48')+_0x180ee3[_0x680a('0x21')]);}if(!_0x300a85){if(_0x192922[_0x680a('0x49')]>0xc8){throw new Error(_0x680a('0x4a'));}else{throw new Error('lang\x20\x22'+_0x54cc98+'\x22\x20might\x20not\x20exist');}}try{_0x300a85=eval(_0x300a85)[0x0];}catch(_0x368151){throw new Error(_0x680a('0x48')+res[_0x680a('0x21')]);}const _0x1850a7=_0x300a85;_0x10bab4=path['resolve'](__dirname,'tmp',rs[_0x680a('0x27')](0x4)+_0x680a('0x39'));fs[_0x680a('0x28')](_0x10bab4,_0x300a85,{'encoding':_0x680a('0x30')});_0x253f46=path[_0x680a('0x38')](__dirname,'tmp',rs[_0x680a('0x27')](0x4)+_0x680a('0x4b'));return convertFile(_0x10bab4,_0x253f46);})[_0x680a('0x29')](function(){try{fs['unlink'](_0x10bab4);fs[_0x680a('0x2b')](_0x253f46,_0x680a('0x2c'));}catch(_0x14388c){logger['error'](_0x14388c);}logger[_0x680a('0x1b')](_0x680a('0x4c'),_0x253f46[_0x680a('0x2d')]('.')[0x0]);return _0x253f46[_0x680a('0x2d')]('.')[0x0];});};exports[_0x680a('0x4d')]=function(_0x3488d9,_0x49f386,_0x3ce922){return google[_0x680a('0x4e')](_0x3488d9,_0x49f386,_0x3ce922)['then'](function(_0x547745){logger[_0x680a('0x1b')](_0x547745[_0x680a('0x4f')]);return rp(_0x547745);})[_0x680a('0x29')](function(_0x487fae){var _0x2a9477='';var _0x51addb=0x0;try{fs[_0x680a('0x2a')](_0x3488d9);}catch(_0x113276){logger[_0x680a('0x15')](_0x113276);}if(_0x487fae&&_0x487fae['results']){_0x2a9477=_0x487fae[_0x680a('0x50')][_0x680a('0x51')](function(_0x5a77e2){return _0x5a77e2&&_0x5a77e2[_0x680a('0x52')][0x0]&&_0x5a77e2[_0x680a('0x52')][0x0][_0x680a('0x53')]?_0x5a77e2[_0x680a('0x52')][0x0]['transcript']:'';})[_0x680a('0x54')]('\x0a');_0x51addb=_0x487fae['results'][_0x680a('0x51')](function(_0x76f4c8){return _0x76f4c8&&_0x76f4c8[_0x680a('0x52')][0x0]&&_0x76f4c8['alternatives'][0x0][_0x680a('0x55')]?_0x76f4c8[_0x680a('0x52')][0x0][_0x680a('0x55')]:0x0;})[_0x680a('0x54')]('\x0a');}logger['info'](_0x680a('0x56'),_0x2a9477);logger['info'](_0x680a('0x57'),_0x51addb);return{'transcript':_0x2a9477,'confidence':_0x51addb};})[_0x680a('0x58')](function(_0x2133e9){logger[_0x680a('0x15')]('[%s]\x20%s:%s',_0x2133e9['statusCode'],_0x2133e9[_0x680a('0x59')],_0x2133e9['message']);});};exports[_0x680a('0x5a')]=function(_0x56b63f,_0x4b34c8,_0x1ecec6,_0x2597c0){var _0x41a770=apiai(_0x4b34c8,{'language':_0x2597c0||'en'});return _0x41a770[_0x680a('0x5b')](_0x1ecec6,{'sessionId':md5(_0x56b63f)})[_0x680a('0x29')](function(_0x55b44d){logger[_0x680a('0x1b')](JSON[_0x680a('0x43')](_0x55b44d));return{'source':_0x55b44d[_0x680a('0x5c')]['source'],'resolvedQuery':_0x55b44d['result'][_0x680a('0x5d')],'action':_0x55b44d[_0x680a('0x5c')][_0x680a('0x5e')],'actionIncomplete':_0x55b44d[_0x680a('0x5c')][_0x680a('0x5f')],'speech':_0x55b44d[_0x680a('0x5c')][_0x680a('0x60')]['speech'],'score':_0x55b44d[_0x680a('0x5c')]['score'],'statusCode':_0x55b44d['status']['code'],'endConversation':_0x55b44d[_0x680a('0x5c')][_0x680a('0x61')][_0x680a('0x62')]||![],'isFallbackIntent':_0x55b44d[_0x680a('0x5c')][_0x680a('0x61')][_0x680a('0x63')]};});};exports['googleDialogflowV2']=function(_0x3e8cf8,_0x544099,_0x5509c3,_0x467a57,_0x30c51a,_0x44a28e){var _0x1aa9a1=_0x467a57[_0x680a('0x64')](/\\n/g,'\x0a');var _0x160aec={'credentials':{'private_key':_0x1aa9a1,'client_email':_0x5509c3}};var _0x5d0fa3=new dialogflow[(_0x680a('0x65'))](_0x160aec);var _0x31e379=_0x5d0fa3[_0x680a('0x66')](_0x544099,md5(_0x3e8cf8));var _0x145f5f={'session':_0x31e379,'queryInput':{'text':{'text':_0x30c51a,'languageCode':_0x44a28e}}};return _0x5d0fa3[_0x680a('0x67')](_0x145f5f)[_0x680a('0x29')](function(_0x31f3f9){if(_0x31f3f9&&_0x31f3f9[_0x680a('0x49')]){logger[_0x680a('0x1b')](_0x680a('0x68'),JSON['stringify'](_0x31f3f9));var _0x557a25=_0x31f3f9[0x0];if(_0x557a25){var _0x52bea9={'action':_0x557a25['queryResult'][_0x680a('0x5e')],'allRequiredParamsPresent':_0x557a25[_0x680a('0x69')][_0x680a('0x6a')],'endConversation':_0x557a25['queryResult'][_0x680a('0x6b')]&&_0x557a25[_0x680a('0x69')][_0x680a('0x6b')][_0x680a('0x6c')]?_0x557a25[_0x680a('0x69')][_0x680a('0x6b')][_0x680a('0x6c')][_0x680a('0x6d')]['boolValue']:![],'fulfillmentText':_0x557a25['queryResult']['fulfillmentText'],'intentName':_0x557a25[_0x680a('0x69')]['intent'][_0x680a('0x59')],'intentDisplayName':_0x557a25[_0x680a('0x69')][_0x680a('0x6e')]['displayName'],'isFallbackIntent':_0x557a25[_0x680a('0x69')][_0x680a('0x6e')]['isFallback'],'languageCode':_0x557a25[_0x680a('0x69')]['languageCode'],'queryText':_0x557a25['queryResult'][_0x680a('0x6f')],'responseId':_0x557a25[_0x680a('0x70')],'score':_0x557a25[_0x680a('0x69')][_0x680a('0x71')],'speech':_0x557a25[_0x680a('0x69')]['fulfillmentText'],'providerResponse':JSON[_0x680a('0x43')](_0x31f3f9)};return _0x52bea9;}}});};exports['tildeASR']=function(_0x2d7372,_0x14c9bb,_0x517f26,_0x507b62){return tilde[_0x680a('0x4e')](_0x2d7372,_0x14c9bb,_0x517f26,_0x507b62)[_0x680a('0x29')](function(_0x1b6e9e){try{fs['unlink'](_0x2d7372);}catch(_0x14c525){logger[_0x680a('0x15')](_0x14c525);}logger[_0x680a('0x1b')]('Tilde\x20ASR\x20transcription',_0x1b6e9e['transcript']);logger[_0x680a('0x1b')](_0x680a('0x72'),_0x1b6e9e['confidence']);return _0x1b6e9e;});};exports[_0x680a('0x73')]=function(_0x303332,_0x461379,_0x59d870,_0x531822,_0x21b3fa,_0x3dbbd0){var _0x39c43a=path['resolve'](__dirname,_0x680a('0x26'),rs[_0x680a('0x27')](0x4)+'.mp3');var _0x3192b8;return aws['polly'](_0x303332,_0x461379,_0x59d870,_0x531822,_0x21b3fa,_0x3dbbd0,_0x39c43a)[_0x680a('0x29')](function(){_0x3192b8=path[_0x680a('0x38')](__dirname,'tmp',rs[_0x680a('0x27')](0x4)+_0x680a('0x4b'));return convertFile(_0x39c43a,_0x3192b8);})['then'](function(){try{fs[_0x680a('0x2a')](_0x39c43a);fs[_0x680a('0x2b')](_0x3192b8,_0x680a('0x2c'));}catch(_0xa92b7b){logger['error'](_0xa92b7b);}return _0x3192b8['split']('.')[0x0];});};exports[_0x680a('0x74')]=function(_0x1bd3a0,_0x56871e,_0xcd868e,_0x266b94,_0x453541,_0x28a50a){return aws['lex'](_0x1bd3a0,_0x56871e,_0xcd868e,_0x266b94,_0x453541,_0x28a50a)['then'](function(_0x243c73){logger[_0x680a('0x1b')](JSON[_0x680a('0x43')](_0x243c73));return _0x243c73;});};exports['ispeechTTS']=function(_0x456f82,_0x56d44c,_0x35ba2e,_0x209208){var _0x5884c6=util['format'](_0x680a('0x75'),ISPEECH_API,_0x456f82,encodeURIComponent(_0x56d44c),_0x35ba2e,_0x209208);var _0x9ac132=path['resolve'](__dirname,_0x680a('0x26'),rs[_0x680a('0x27')](0x4)+_0x680a('0x39'));var _0x55f01f;return downloadFile(_0x5884c6,_0x9ac132)[_0x680a('0x29')](function(){_0x55f01f=path[_0x680a('0x38')](__dirname,_0x680a('0x26'),rs[_0x680a('0x27')](0x4)+_0x680a('0x4b'));return convertFile(_0x9ac132,_0x55f01f);})['then'](function(){try{fs[_0x680a('0x2a')](_0x9ac132);fs['chmodSync'](_0x55f01f,_0x680a('0x2c'));}catch(_0x42187d){logger[_0x680a('0x15')](_0x42187d);}return _0x55f01f[_0x680a('0x2d')]('.')[0x0];});};exports[_0x680a('0x76')]=function(_0x473e62,_0x1daf2c,_0x48f526,_0x1d697a){var _0x4ba6f8=util[_0x680a('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1daf2c,_0x48f526,base64Encode(_0x473e62),_0x1d697a?util[_0x680a('0x77')](_0x680a('0x78'),encodeURIComponent(_0x1d697a)):_0x680a('0x79'));return uploadFile(_0x4ba6f8)['then'](function(_0x400c06){return querystring[_0x680a('0xa')](_0x400c06);});};exports['sestekNDA']=function(_0x174c5b,_0xed7ad4){return sestek[_0x680a('0x7a')](_0x174c5b,_0xed7ad4)[_0x680a('0x29')](function(_0x3eb762){logger[_0x680a('0x1b')](JSON[_0x680a('0x43')](_0x3eb762));var _0x42d073={'speech':_0x3eb762['text'],'action':_0x3eb762[_0x680a('0x7b')]?_0x3eb762[_0x680a('0x7b')][_0x680a('0x7c')]:undefined,'actiondata':_0x3eb762[_0x680a('0x7b')]?_0x3eb762['channelData'][_0x680a('0x7d')]:undefined};if(_0x3eb762[_0x680a('0x7b')]&&_0x3eb762[_0x680a('0x7b')][_0x680a('0x7e')]){return base64Decode(_0x3eb762[_0x680a('0x7b')]['AudioFromTts']['Data'],path['resolve'](__dirname,_0x680a('0x26'),rs['generate'](0x4)+'.wav'))['then'](function(_0x4d0085){_0x42d073[_0x680a('0x7f')]=_0x4d0085;return _0x42d073;});}return _0x42d073;});};exports[_0x680a('0x80')]=function(){return __dirname;}; \ No newline at end of file +var _0x36eb=['input','voice','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','777','generate','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','source','result','action','fulfillment','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','Data','audiofile','dirName','apiai-promise','bluebird','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','download\x20error','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','unlink','chmodSync','readFileSync','toString','https://texttospeech.googleapis.com/v1/'];(function(_0xa9b6ea,_0x160850){var _0x39b07a=function(_0x4022e3){while(--_0x4022e3){_0xa9b6ea['push'](_0xa9b6ea['shift']());}};_0x39b07a(++_0x160850);}(_0x36eb,0xe0));var _0xb36e=function(_0x5f7462,_0x22040a){_0x5f7462=_0x5f7462-0x0;var _0x1fc1cc=_0x36eb[_0x5f7462];return _0x1fc1cc;};'use strict';var apiai=require(_0xb36e('0x0'));var BPromise=require(_0xb36e('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xb36e('0x2'));var path=require(_0xb36e('0x3'));var querystring=require(_0xb36e('0x4'));var rp=require(_0xb36e('0x5'));var rs=require(_0xb36e('0x6'));var sox=require(_0xb36e('0x7'));var tts=require(_0xb36e('0x8'));var urlParse=require(_0xb36e('0x9'))[_0xb36e('0xa')];var util=require('util');var aws=require(_0xb36e('0xb'));var google=require(_0xb36e('0xc'));var sestek=require(_0xb36e('0xd'));var tilde=require('./tilde');var logger=require(_0xb36e('0xe'))(_0xb36e('0xf'));var ISPEECH_API=_0xb36e('0x10');function downloadFile(_0x86f375,_0x368b78){return new BPromise(function(_0x41aa0e,_0x38eded){var _0x390828=urlParse(_0x86f375);var _0x2dcf3f=_0x390828['protocol']==='https:'?https:http;var _0x3dc095={'host':_0x390828['host'],'path':_0x390828[_0xb36e('0x3')],'headers':{'user-agent':_0xb36e('0x11')}};_0x2dcf3f[_0xb36e('0x12')](_0x3dc095,function(_0xb4eeea){if(_0xb4eeea[_0xb36e('0x13')]!==0xc8){logger[_0xb36e('0x14')](_0xb36e('0x15')+_0x86f375+_0xb36e('0x16')+_0xb4eeea[_0xb36e('0x13')]+'\x20('+_0xb4eeea['statusMessage']+')');_0x38eded(new Error(_0xb36e('0x15')+_0x86f375+'\x20failed,\x20status\x20code\x20=\x20'+_0xb4eeea[_0xb36e('0x13')]+'\x20('+_0xb4eeea[_0xb36e('0x17')]+')'));return;}var _0x192002=fs[_0xb36e('0x18')](_0x368b78);_0x192002['on']('finish',function(){logger[_0xb36e('0x19')](_0xb36e('0x1a'));_0x192002[_0xb36e('0x1b')](_0x41aa0e);});_0x192002['on']('error',function(_0x4fbd3a){fs['unlink'](_0x368b78);logger[_0xb36e('0x14')](_0xb36e('0x1c'),_0x4fbd3a);_0x38eded(_0x4fbd3a);});_0xb4eeea['pipe'](_0x192002);})['on'](_0xb36e('0x14'),function(_0x16a8a9){logger[_0xb36e('0x14')](_0x16a8a9);_0x38eded(_0x16a8a9);})[_0xb36e('0x1d')]();});}function uploadFile(_0x5055a2){return new BPromise(function(_0x3d07c5,_0x3c2ba1){var _0x41ef3e=urlParse(_0x5055a2);var _0x20ed89=_0x41ef3e['protocol']==='https:'?https:http;var _0x578bf5={'host':_0x41ef3e['host'],'path':_0x41ef3e[_0xb36e('0x3')],'headers':{'user-agent':_0xb36e('0x11')}};_0x20ed89[_0xb36e('0x12')](_0x578bf5,function(_0x26376e){if(_0x26376e['statusCode']!==0xc8){_0x3c2ba1(new Error(_0xb36e('0x15')+_0x5055a2+_0xb36e('0x16')+_0x26376e['statusCode']+'\x20('+_0x26376e[_0xb36e('0x17')]+')'));return;}var _0xe3c22f='';_0x26376e['on']('data',function(_0x4f170b){_0xe3c22f+=_0x4f170b;});_0x26376e['on']('end',function(){_0x3d07c5(_0xe3c22f);});})['on'](_0xb36e('0x14'),function(_0x349856){_0x3c2ba1(_0x349856);})[_0xb36e('0x1d')]();});}function convertFile(_0xde184d,_0x24eafd){return new BPromise(function(_0x4206eb,_0x271866){var _0x596d64=sox[_0xb36e('0x1e')](_0xde184d,_0x24eafd,{'sampleRate':0x1f40,'format':_0xb36e('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x596d64['on'](_0xb36e('0x14'),function(_0x5b0e72){logger[_0xb36e('0x14')](_0xb36e('0x20'),_0x5b0e72);_0x271866(_0x5b0e72);});_0x596d64['on'](_0xb36e('0x1d'),function(){logger[_0xb36e('0x19')](_0xb36e('0x21'));_0x4206eb();});_0x596d64[_0xb36e('0x22')]();});}function base64Decode(_0x22aaa0,_0xc73b43){var _0x4b4cf3=path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs['generate'](0x4)+_0xb36e('0x25'));fs[_0xb36e('0x26')](_0x4b4cf3,_0x22aaa0,_0xb36e('0x27'));return convertFile(_0x4b4cf3,_0xc73b43)[_0xb36e('0x28')](function(){try{fs[_0xb36e('0x29')](_0x4b4cf3);fs[_0xb36e('0x2a')](_0xc73b43,'777');}catch(_0x3896c8){logger['error'](_0x3896c8);}return _0xc73b43['split']('.')[0x0];});}function base64Encode(_0x25d653){var _0x2e2d29=fs[_0xb36e('0x2b')](_0x25d653);return new Buffer(_0x2e2d29)[_0xb36e('0x2c')](_0xb36e('0x27'));}exports['googleCloudTTS']=function(_0x26ee31,_0x504e73,_0x43ad38,_0x1e30d3,_0x289598,_0x802cf7){var _0x3aa1ea,_0x5e812b;var _0x5a4869=_0xb36e('0x2d');var _0x3c77ee='?key='+_0x26ee31;var _0x12d23a={};if(_0x504e73==='ssml'){_0x12d23a[_0xb36e('0x2e')]={'ssml':_0x43ad38};}else{_0x12d23a[_0xb36e('0x2e')]={'text':_0x43ad38};};_0x12d23a[_0xb36e('0x2f')]={'languageCode':_0x1e30d3,'ssmlGender':_0x289598};_0x12d23a['audioConfig']={'audioEncoding':_0xb36e('0x30'),'sampleRateHertz':0x1f40};var _0x1ca11a={'url':_0x5a4869+_0xb36e('0x31')+_0x3c77ee,'method':_0xb36e('0x32'),'json':!![],'body':_0x12d23a};return rp(_0x1ca11a)[_0xb36e('0x28')](function(_0x465e37){return new BPromise(function(_0xa3f3b1,_0x3eb6ff){_0x3aa1ea=path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs['generate'](0x4)+_0xb36e('0x33'));var _0x122409=Buffer[_0xb36e('0x34')](_0x465e37[_0xb36e('0x35')],_0xb36e('0x27'));return fs[_0xb36e('0x36')](_0x3aa1ea,_0x122409,function(_0x110f67){_0x3eb6ff(_0x110f67);},function(_0x3293b7){fs[_0xb36e('0x2a')](_0x3aa1ea,_0xb36e('0x37'));_0xa3f3b1(_0x3293b7);});});})['then'](function(_0x555069){_0x5e812b=path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs[_0xb36e('0x38')](0x4)+'.wav');return convertFile(_0x3aa1ea,_0x5e812b);})[_0xb36e('0x28')](function(){try{fs[_0xb36e('0x29')](_0x3aa1ea);fs[_0xb36e('0x2a')](_0x5e812b,'777');}catch(_0x1e4666){logger[_0xb36e('0x14')](_0x1e4666);}logger[_0xb36e('0x19')](_0xb36e('0x39'),_0x5e812b[_0xb36e('0x3a')]('.')[0x0]);return _0x5e812b[_0xb36e('0x3a')]('.')[0x0];});};exports[_0xb36e('0x3b')]=function(_0x25740f,_0x4a1f2e){var _0x372491=_0xb36e('0x3c');var _0x47b924,_0xb6d935;var _0x4284cb;var _0x4d1b10={'encoding':_0xb36e('0x3d'),'method':_0xb36e('0x32'),'timeout':0x2710,'url':_0x372491,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xb36e('0x3e')]([[['jQ1olc',JSON[_0xb36e('0x3e')]([_0x25740f,_0x4a1f2e||'en',![],_0xb36e('0x3f')]),null,_0xb36e('0x40')]]]))};return rp(_0x4d1b10)[_0xb36e('0x28')](function(_0x535589){try{_0x4284cb=eval(_0x535589[_0xb36e('0x41')](0x5))[0x0][0x2];}catch(_0x138e02){throw new Error(_0xb36e('0x42')+_0x535589['data']);}if(!_0x4284cb){if(_0x25740f['length']>0xc8){throw new Error(_0xb36e('0x43'));}else{throw new Error('lang\x20\x22'+_0x4a1f2e+_0xb36e('0x44'));}}try{_0x4284cb=eval(_0x4284cb)[0x0];}catch(_0x1fb409){throw new Error(_0xb36e('0x42')+res['data']);}const _0x30b6db=_0x4284cb;_0x47b924=path[_0xb36e('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0xb36e('0x33'));fs['writeFileSync'](_0x47b924,_0x4284cb,{'encoding':'base64'});_0xb6d935=path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs[_0xb36e('0x38')](0x4)+_0xb36e('0x25'));return convertFile(_0x47b924,_0xb6d935);})[_0xb36e('0x28')](function(){try{fs['unlink'](_0x47b924);fs['chmodSync'](_0xb6d935,_0xb36e('0x37'));}catch(_0x2d39da){logger['error'](_0x2d39da);}logger[_0xb36e('0x19')](_0xb36e('0x45'),_0xb6d935[_0xb36e('0x3a')]('.')[0x0]);return _0xb6d935[_0xb36e('0x3a')]('.')[0x0];});};exports[_0xb36e('0x46')]=function(_0x219b64,_0x97edba,_0x2bb81d){return google['asr'](_0x219b64,_0x97edba,_0x2bb81d)[_0xb36e('0x28')](function(_0xde6472){logger[_0xb36e('0x19')](_0xde6472[_0xb36e('0x47')]);return rp(_0xde6472);})[_0xb36e('0x28')](function(_0x1d4127){var _0x2a7a61='';var _0x2163a1=0x0;try{fs[_0xb36e('0x29')](_0x219b64);}catch(_0x42fcd6){logger[_0xb36e('0x14')](_0x42fcd6);}if(_0x1d4127&&_0x1d4127[_0xb36e('0x48')]){_0x2a7a61=_0x1d4127[_0xb36e('0x48')][_0xb36e('0x49')](function(_0x7c1c7){return _0x7c1c7&&_0x7c1c7['alternatives'][0x0]&&_0x7c1c7[_0xb36e('0x4a')][0x0]['transcript']?_0x7c1c7['alternatives'][0x0][_0xb36e('0x4b')]:'';})[_0xb36e('0x4c')]('\x0a');_0x2163a1=_0x1d4127[_0xb36e('0x48')][_0xb36e('0x49')](function(_0xead2b5){return _0xead2b5&&_0xead2b5[_0xb36e('0x4a')][0x0]&&_0xead2b5[_0xb36e('0x4a')][0x0][_0xb36e('0x4d')]?_0xead2b5[_0xb36e('0x4a')][0x0]['confidence']:0x0;})[_0xb36e('0x4c')]('\x0a');}logger[_0xb36e('0x19')](_0xb36e('0x4e'),_0x2a7a61);logger[_0xb36e('0x19')](_0xb36e('0x4f'),_0x2163a1);return{'transcript':_0x2a7a61,'confidence':_0x2163a1};})[_0xb36e('0x50')](function(_0x29cd89){logger[_0xb36e('0x14')](_0xb36e('0x51'),_0x29cd89['statusCode'],_0x29cd89[_0xb36e('0x52')],_0x29cd89['message']);});};exports[_0xb36e('0x53')]=function(_0x7184ed,_0x3bd3f0,_0x5285c4,_0x1b789f){var _0x2f46ea=apiai(_0x3bd3f0,{'language':_0x1b789f||'en'});return _0x2f46ea[_0xb36e('0x54')](_0x5285c4,{'sessionId':md5(_0x7184ed)})[_0xb36e('0x28')](function(_0x42bd3e){logger['info'](JSON[_0xb36e('0x3e')](_0x42bd3e));return{'source':_0x42bd3e['result'][_0xb36e('0x55')],'resolvedQuery':_0x42bd3e[_0xb36e('0x56')]['resolvedQuery'],'action':_0x42bd3e[_0xb36e('0x56')][_0xb36e('0x57')],'actionIncomplete':_0x42bd3e[_0xb36e('0x56')]['actionIncomplete'],'speech':_0x42bd3e[_0xb36e('0x56')][_0xb36e('0x58')][_0xb36e('0x59')],'score':_0x42bd3e[_0xb36e('0x56')][_0xb36e('0x5a')],'statusCode':_0x42bd3e[_0xb36e('0x5b')][_0xb36e('0x5c')],'endConversation':_0x42bd3e[_0xb36e('0x56')][_0xb36e('0x5d')][_0xb36e('0x5e')]||![],'isFallbackIntent':_0x42bd3e[_0xb36e('0x56')][_0xb36e('0x5d')]['isFallbackIntent']};});};exports[_0xb36e('0x5f')]=function(_0x3a367a,_0x3f446a,_0x4f2214,_0x57a1b,_0x294284,_0x2c1243){var _0x28c38c=_0x57a1b[_0xb36e('0x60')](/\\n/g,'\x0a');var _0x5e2e20={'credentials':{'private_key':_0x28c38c,'client_email':_0x4f2214}};var _0x35600d=new dialogflow[(_0xb36e('0x61'))](_0x5e2e20);var _0x49df39=_0x35600d[_0xb36e('0x62')](_0x3f446a,md5(_0x3a367a));var _0x1c4c52={'session':_0x49df39,'queryInput':{'text':{'text':_0x294284,'languageCode':_0x2c1243}}};return _0x35600d[_0xb36e('0x63')](_0x1c4c52)[_0xb36e('0x28')](function(_0x58658b){if(_0x58658b&&_0x58658b[_0xb36e('0x64')]){logger[_0xb36e('0x19')](_0xb36e('0x65'),JSON['stringify'](_0x58658b));var _0xb5f590=_0x58658b[0x0];if(_0xb5f590){var _0x4b36c5={'action':_0xb5f590[_0xb36e('0x66')][_0xb36e('0x57')],'allRequiredParamsPresent':_0xb5f590[_0xb36e('0x66')]['allRequiredParamsPresent'],'endConversation':_0xb5f590[_0xb36e('0x66')][_0xb36e('0x67')]&&_0xb5f590[_0xb36e('0x66')][_0xb36e('0x67')]['fields']?_0xb5f590[_0xb36e('0x66')][_0xb36e('0x67')][_0xb36e('0x68')][_0xb36e('0x69')][_0xb36e('0x6a')]:![],'fulfillmentText':_0xb5f590[_0xb36e('0x66')][_0xb36e('0x6b')],'intentName':_0xb5f590[_0xb36e('0x66')][_0xb36e('0x6c')]['name'],'intentDisplayName':_0xb5f590['queryResult']['intent'][_0xb36e('0x6d')],'isFallbackIntent':_0xb5f590['queryResult'][_0xb36e('0x6c')][_0xb36e('0x6e')],'languageCode':_0xb5f590[_0xb36e('0x66')][_0xb36e('0x6f')],'queryText':_0xb5f590[_0xb36e('0x66')]['queryText'],'responseId':_0xb5f590[_0xb36e('0x70')],'score':_0xb5f590['queryResult'][_0xb36e('0x71')],'speech':_0xb5f590[_0xb36e('0x66')][_0xb36e('0x6b')],'providerResponse':JSON[_0xb36e('0x3e')](_0x58658b)};return _0x4b36c5;}}});};exports[_0xb36e('0x72')]=function(_0x3e9940,_0x27214c,_0x2f3d9f,_0x59d9dd){return tilde[_0xb36e('0x73')](_0x3e9940,_0x27214c,_0x2f3d9f,_0x59d9dd)['then'](function(_0x53bd5f){try{fs[_0xb36e('0x29')](_0x3e9940);}catch(_0x1d910c){logger[_0xb36e('0x14')](_0x1d910c);}logger[_0xb36e('0x19')](_0xb36e('0x74'),_0x53bd5f[_0xb36e('0x4b')]);logger['info'](_0xb36e('0x75'),_0x53bd5f[_0xb36e('0x4d')]);return _0x53bd5f;});};exports[_0xb36e('0x76')]=function(_0x3d3973,_0x275157,_0x10d049,_0x386b31,_0x1306ed,_0x498135){var _0x3b887a=path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs[_0xb36e('0x38')](0x4)+_0xb36e('0x33'));var _0x3f0854;return aws['polly'](_0x3d3973,_0x275157,_0x10d049,_0x386b31,_0x1306ed,_0x498135,_0x3b887a)[_0xb36e('0x28')](function(){_0x3f0854=path['resolve'](__dirname,'tmp',rs[_0xb36e('0x38')](0x4)+_0xb36e('0x25'));return convertFile(_0x3b887a,_0x3f0854);})[_0xb36e('0x28')](function(){try{fs['unlink'](_0x3b887a);fs['chmodSync'](_0x3f0854,_0xb36e('0x37'));}catch(_0x3ee3a1){logger[_0xb36e('0x14')](_0x3ee3a1);}return _0x3f0854['split']('.')[0x0];});};exports[_0xb36e('0x77')]=function(_0x302df0,_0x34101e,_0x3bd2e2,_0x258c3b,_0x2069d6,_0x165717){return aws[_0xb36e('0x78')](_0x302df0,_0x34101e,_0x3bd2e2,_0x258c3b,_0x2069d6,_0x165717)[_0xb36e('0x28')](function(_0x47a291){logger[_0xb36e('0x19')](JSON[_0xb36e('0x3e')](_0x47a291));return _0x47a291;});};exports[_0xb36e('0x79')]=function(_0x1fae49,_0x4487f0,_0x33fc85,_0x3a3769){var _0x222821=util[_0xb36e('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1fae49,encodeURIComponent(_0x4487f0),_0x33fc85,_0x3a3769);var _0x143d29=path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs['generate'](0x4)+_0xb36e('0x33'));var _0x5ba850;return downloadFile(_0x222821,_0x143d29)[_0xb36e('0x28')](function(){_0x5ba850=path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs[_0xb36e('0x38')](0x4)+_0xb36e('0x25'));return convertFile(_0x143d29,_0x5ba850);})[_0xb36e('0x28')](function(){try{fs['unlink'](_0x143d29);fs[_0xb36e('0x2a')](_0x5ba850,_0xb36e('0x37'));}catch(_0x4ab567){logger['error'](_0x4ab567);}return _0x5ba850[_0xb36e('0x3a')]('.')[0x0];});};exports['ispeechASR']=function(_0x5abf1d,_0x33336a,_0x2fc685,_0x35aa45){var _0x32302b=util['format'](_0xb36e('0x7b'),ISPEECH_API,_0x33336a,_0x2fc685,base64Encode(_0x5abf1d),_0x35aa45?util[_0xb36e('0x7a')](_0xb36e('0x7c'),encodeURIComponent(_0x35aa45)):_0xb36e('0x7d'));return uploadFile(_0x32302b)['then'](function(_0x49c038){return querystring[_0xb36e('0xa')](_0x49c038);});};exports[_0xb36e('0x7e')]=function(_0x41e5f9,_0x4bfa0d){return sestek[_0xb36e('0x7f')](_0x41e5f9,_0x4bfa0d)['then'](function(_0x44f95a){logger['info'](JSON[_0xb36e('0x3e')](_0x44f95a));var _0x1e1e6c={'speech':_0x44f95a[_0xb36e('0x80')],'action':_0x44f95a[_0xb36e('0x81')]?_0x44f95a[_0xb36e('0x81')][_0xb36e('0x82')]:undefined,'actiondata':_0x44f95a[_0xb36e('0x81')]?_0x44f95a[_0xb36e('0x81')][_0xb36e('0x83')]:undefined};if(_0x44f95a[_0xb36e('0x81')]&&_0x44f95a[_0xb36e('0x81')]['AudioFromTts']){return base64Decode(_0x44f95a[_0xb36e('0x81')]['AudioFromTts'][_0xb36e('0x84')],path[_0xb36e('0x23')](__dirname,_0xb36e('0x24'),rs[_0xb36e('0x38')](0x4)+_0xb36e('0x25')))[_0xb36e('0x28')](function(_0x5b6050){_0x1e1e6c[_0xb36e('0x85')]=_0x5b6050;return _0x1e1e6c;});}return _0x1e1e6c;});};exports[_0xb36e('0x86')]=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 b60e779..8f34e03 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a64=['exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x8a64,0x1ef));var _0x48a6=function(_0x102164,_0xc33476){_0x102164=_0x102164-0x0;var _0x489826=_0x8a64[_0x102164];return _0x489826;};var nda=require('./nda');module[_0x48a6('0x0')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 858f864..33f09f1 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 _0x2f68=['../../../../../config/logger','agi','exports','POST','resolve','/token','password','then','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','url'];(function(_0x19b4ce,_0x187040){var _0x180b52=function(_0x44c611){while(--_0x44c611){_0x19b4ce['push'](_0x19b4ce['shift']());}};_0x180b52(++_0x187040);}(_0x2f68,0x9a));var _0x82f6=function(_0x568d79,_0xb75151){_0x568d79=_0x568d79-0x0;var _0x2f091f=_0x2f68[_0x568d79];return _0x2f091f;};'use strict';var rp=require('request-promise');var url=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));module[_0x82f6('0x3')]=function(_0x4be334,_0x43dc65){var _0x488d61={'method':_0x82f6('0x4'),'uri':url[_0x82f6('0x5')](_0x43dc65['ndauth_url'],_0x82f6('0x6')),'form':{'grant_type':_0x82f6('0x7'),'username':_0x43dc65['username'],'password':_0x43dc65['password']},'json':!![]};return rp(_0x488d61)[_0x82f6('0x8')](function(_0x5660bf){var _0x5daa3c={'method':_0x82f6('0x4'),'uri':url[_0x82f6('0x5')](_0x43dc65[_0x82f6('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x43dc65[_0x82f6('0xa')]||_0x82f6('0xb'),'channelId':'Nda','conversation':{'id':_0x4be334[_0x82f6('0xc')]},'from':{'id':_0x4be334[_0x82f6('0xd')],'name':_0x4be334[_0x82f6('0xe')]},'recipient':{'id':_0x4be334[_0x82f6('0xf')],'name':_0x4be334[_0x82f6('0x10')]},'text':_0x43dc65[_0x82f6('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5660bf[_0x82f6('0x12')]},'json':!![]};if(_0x43dc65[_0x82f6('0x13')]){_0x5daa3c['body'][_0x82f6('0x14')][_0x82f6('0x15')]=_0x43dc65[_0x82f6('0x13')];}if(_0x43dc65[_0x82f6('0x16')]=='1'){_0x5daa3c[_0x82f6('0x17')][_0x82f6('0x14')][_0x82f6('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x82f6('0x19')};}if(_0x43dc65[_0x82f6('0x1a')]){_0x5daa3c['body'][_0x82f6('0x14')]['CustomAction']=_0x43dc65[_0x82f6('0x1a')];if(_0x43dc65[_0x82f6('0x1b')]){_0x5daa3c[_0x82f6('0x17')][_0x82f6('0x14')][_0x82f6('0x1c')]=_0x43dc65[_0x82f6('0x1b')];}}logger[_0x82f6('0x1d')](JSON[_0x82f6('0x1e')](_0x5daa3c));return rp(_0x5daa3c);});}; \ No newline at end of file +var _0x0e35=['exports','POST','resolve','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x0e35,0xc2));var _0x50e3=function(_0x1a3e32,_0x4fd484){_0x1a3e32=_0x1a3e32-0x0;var _0x5515ab=_0x0e35[_0x1a3e32];return _0x5515ab;};'use strict';var rp=require(_0x50e3('0x0'));var url=require(_0x50e3('0x1'));var logger=require(_0x50e3('0x2'))(_0x50e3('0x3'));module[_0x50e3('0x4')]=function(_0x1d3e38,_0x3925be){var _0x50a6c5={'method':_0x50e3('0x5'),'uri':url[_0x50e3('0x6')](_0x3925be['ndauth_url'],_0x50e3('0x7')),'form':{'grant_type':_0x50e3('0x8'),'username':_0x3925be['username'],'password':_0x3925be['password']},'json':!![]};return rp(_0x50a6c5)[_0x50e3('0x9')](function(_0x1ed6ec){var _0x57bb5f={'method':'POST','uri':url[_0x50e3('0x6')](_0x3925be[_0x50e3('0xa')],_0x50e3('0xb')),'body':{'type':_0x3925be[_0x50e3('0xc')]||_0x50e3('0xd'),'channelId':_0x50e3('0xe'),'conversation':{'id':_0x1d3e38[_0x50e3('0xf')]},'from':{'id':_0x1d3e38[_0x50e3('0x10')],'name':_0x1d3e38[_0x50e3('0x11')]},'recipient':{'id':_0x1d3e38[_0x50e3('0x12')],'name':_0x1d3e38[_0x50e3('0x13')]},'text':_0x3925be[_0x50e3('0x14')],'channelData':{}},'headers':{'Authorization':_0x50e3('0x15')+_0x1ed6ec['access_token']},'json':!![]};if(_0x3925be[_0x50e3('0x16')]){_0x57bb5f[_0x50e3('0x17')][_0x50e3('0x18')][_0x50e3('0x19')]=_0x3925be['project'];}if(_0x3925be[_0x50e3('0x1a')]=='1'){_0x57bb5f[_0x50e3('0x17')]['channelData'][_0x50e3('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x50e3('0x1c')};}if(_0x3925be[_0x50e3('0x1d')]){_0x57bb5f[_0x50e3('0x17')][_0x50e3('0x18')]['CustomAction']=_0x3925be[_0x50e3('0x1d')];if(_0x3925be['custom_action_data']){_0x57bb5f[_0x50e3('0x17')][_0x50e3('0x18')][_0x50e3('0x1e')]=_0x3925be['custom_action_data'];}}logger[_0x50e3('0x1f')](JSON[_0x50e3('0x20')](_0x57bb5f));return rp(_0x57bb5f);});}; \ 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 0df7e5b..c10a004 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 _0x4350=['./lib/api'];(function(_0x3eda2b,_0x57fb83){var _0x4839cc=function(_0x57e47d){while(--_0x57e47d){_0x3eda2b['push'](_0x3eda2b['shift']());}};_0x4839cc(++_0x57fb83);}(_0x4350,0xe0));var _0x0435=function(_0x14da74,_0x81b8cd){_0x14da74=_0x14da74-0x0;var _0x48578d=_0x4350[_0x14da74];return _0x48578d;};'use strict';var asr=require(_0x0435('0x0'));module['exports']=function(_0xa7d1bf,_0x3851cb,_0x541f11,_0x5e68f3){return asr(_0xa7d1bf,_0x3851cb,_0x541f11,_0x5e68f3);}; \ No newline at end of file +var _0x6887=['exports','./lib/api'];(function(_0x28ccfd,_0x37dc0a){var _0x159acf=function(_0x3706b3){while(--_0x3706b3){_0x28ccfd['push'](_0x28ccfd['shift']());}};_0x159acf(++_0x37dc0a);}(_0x6887,0x7b));var _0x7688=function(_0x707bd,_0xa35918){_0x707bd=_0x707bd-0x0;var _0x454003=_0x6887[_0x707bd];return _0x454003;};'use strict';var asr=require(_0x7688('0x0'));module[_0x7688('0x1')]=function(_0x518df9,_0x595e15,_0x4b1bf0,_0x23a98b){return asr(_0x518df9,_0x595e15,_0x4b1bf0,_0x23a98b);}; \ 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 94a872d..212a3af 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 _0x4902=['digest','stringify','createReadStream','data','send','close','EOS','error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update'];(function(_0x27d675,_0x4f1135){var _0x35b1d5=function(_0x3c625d){while(--_0x3c625d){_0x27d675['push'](_0x27d675['shift']());}};_0x35b1d5(++_0x4f1135);}(_0x4902,0xaf));var _0x2490=function(_0x5c5f44,_0x469cd8){_0x5c5f44=_0x5c5f44-0x0;var _0x38625d=_0x4902[_0x5c5f44];return _0x38625d;};'use strict';var BPromise=require('bluebird');var _=require(_0x2490('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x2490('0x1'));var logger=require(_0x2490('0x2'))('agi');module[_0x2490('0x3')]=function(_0x3d9e56,_0xffee06,_0x417c4b,_0x104006){return new BPromise(function(_0x31e5c3,_0x48b5bd){logger[_0x2490('0x4')](_0x2490('0x5'),_0x104006||_0x2490('0x6'));var _0x16ce9e=new WebSocket(_0x104006||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5d389b='';var _0x216787='0';var _0x143709='1';var _0x388058='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xa711b3(_0x39fe57){var _0x23f5ac=crypto[_0x2490('0x7')](_0x2490('0x8'));_0x23f5ac[_0x2490('0x9')](_0x39fe57);return _0x23f5ac[_0x2490('0xa')]('hex');}function _0x36c12c(){try{logger[_0x2490('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x57e581=moment()['unix']();var _0x34ed67=_0xa711b3(_0x57e581+_0xffee06+_0x417c4b);_0x16ce9e['send'](JSON[_0x2490('0xb')]({'appID':_0xffee06,'timestamp':_0x57e581,'appKey':_0x34ed67}));var _0x394859=fs[_0x2490('0xc')](_0x3d9e56);_0x394859['on'](_0x2490('0xd'),function(_0x59e539){_0x16ce9e[_0x2490('0xe')](_0x59e539);});_0x394859['on'](_0x2490('0xf'),function(){_0x16ce9e[_0x2490('0xe')](_0x2490('0x10'));});}catch(_0x1f6999){logger[_0x2490('0x11')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x1f6999));_0x16ce9e[_0x2490('0x12')]();}}function _0x9f44a1(_0x2bdbd2){try{if(_0x2bdbd2){var _0x44b127=JSON[_0x2490('0x13')](_0x2bdbd2);switch(_0x44b127[_0x2490('0x14')]){case 0x0:if(_0x44b127[_0x2490('0x15')]){if(_0x44b127['result']['final']){logger[_0x2490('0x4')](_0x2490('0x16'),JSON[_0x2490('0xb')](_0x44b127['result'][_0x2490('0x17')]));_0x5d389b=_0x44b127['result'][_0x2490('0x17')][0x0]['transcript'];_0x216787=_0x44b127[_0x2490('0x15')][_0x2490('0x17')][0x0][_0x2490('0x18')];_0x143709='0';_0x388058=_0x2490('0x19');_0x16ce9e[_0x2490('0x12')]();}}break;case 0x1:logger[_0x2490('0x4')](_0x2490('0x1a'));_0x143709='1';_0x388058=_0x2490('0x1a');break;case 0x2:logger[_0x2490('0x4')](_0x2490('0x1b'));_0x143709='2';_0x388058=_0x2490('0x1b');break;case 0x9:logger[_0x2490('0x4')](_0x2490('0x1c'));_0x143709='9';_0x388058=_0x2490('0x1c');break;case 0xa:logger[_0x2490('0x4')](_0x2490('0x1d'));_0x143709='10';_0x388058=_0x2490('0x1d');break;case 0xb:logger[_0x2490('0x4')](_0x2490('0x1e'));_0x143709='11';_0x388058=_0x2490('0x1e');}}}catch(_0x556164){logger[_0x2490('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x2490('0xb')](_0x556164));_0x16ce9e[_0x2490('0x12')]();}}function _0x3938e3(){logger[_0x2490('0x4')](_0x2490('0x1f'));_0x31e5c3({'transcript':_0x5d389b,'confidence':_0x216787,'status':_0x143709,'status_message':_0x388058});}function _0xa1250c(_0x2bfe32){logger[_0x2490('0x11')](_0x2490('0x20'));if(!_[_0x2490('0x21')](_0x2bfe32)){logger['error'](_[_0x2490('0x22')](_0x2bfe32)?JSON['stringify'](_0x2bfe32):_0x2bfe32);}}_0x16ce9e['on'](_0x2490('0x23'),_0x36c12c);_0x16ce9e['on'](_0x2490('0x24'),_0x9f44a1);_0x16ce9e['on'](_0x2490('0xf'),_0x3938e3);_0x16ce9e['on'](_0x2490('0x11'),_0xa1250c);});}; \ No newline at end of file +var _0xc7e0=['Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','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','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final'];(function(_0x48d7aa,_0x52349c){var _0x138fc6=function(_0x273dd9){while(--_0x273dd9){_0x48d7aa['push'](_0x48d7aa['shift']());}};_0x138fc6(++_0x52349c);}(_0xc7e0,0x10c));var _0x0c7e=function(_0x4d02f9,_0x794a55){_0x4d02f9=_0x4d02f9-0x0;var _0x42df45=_0xc7e0[_0x4d02f9];return _0x42df45;};'use strict';var BPromise=require(_0x0c7e('0x0'));var _=require(_0x0c7e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0c7e('0x2'));var crypto=require(_0x0c7e('0x3'));var logger=require(_0x0c7e('0x4'))(_0x0c7e('0x5'));module[_0x0c7e('0x6')]=function(_0x59fb4c,_0x5c3a24,_0x395fb9,_0x5870be){return new BPromise(function(_0xe299d6,_0x1083c8){logger[_0x0c7e('0x7')](_0x0c7e('0x8'),_0x5870be||_0x0c7e('0x9'));var _0x297d70=new WebSocket(_0x5870be||_0x0c7e('0x9'),{'perMessageDeflate':![]});var _0xdafd0b='';var _0x1b13be='0';var _0x4d0b0c='1';var _0x394bcc='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x4b1cdd(_0xa2ea4c){var _0xb3d14f=crypto[_0x0c7e('0xa')](_0x0c7e('0xb'));_0xb3d14f['update'](_0xa2ea4c);return _0xb3d14f[_0x0c7e('0xc')](_0x0c7e('0xd'));}function _0x536d82(){try{logger['info'](_0x0c7e('0xe'));var _0x3c6247=moment()[_0x0c7e('0xf')]();var _0x55786a=_0x4b1cdd(_0x3c6247+_0x5c3a24+_0x395fb9);_0x297d70[_0x0c7e('0x10')](JSON[_0x0c7e('0x11')]({'appID':_0x5c3a24,'timestamp':_0x3c6247,'appKey':_0x55786a}));var _0x358a76=fs['createReadStream'](_0x59fb4c);_0x358a76['on'](_0x0c7e('0x12'),function(_0xf73497){_0x297d70[_0x0c7e('0x10')](_0xf73497);});_0x358a76['on'](_0x0c7e('0x13'),function(){_0x297d70[_0x0c7e('0x10')]('EOS');});}catch(_0x56d924){logger[_0x0c7e('0x14')](_0x0c7e('0x15'),JSON[_0x0c7e('0x11')](_0x56d924));_0x297d70['terminate']();}}function _0x4bebdc(_0x280c3f){try{if(_0x280c3f){var _0x4167c6=JSON[_0x0c7e('0x16')](_0x280c3f);switch(_0x4167c6[_0x0c7e('0x17')]){case 0x0:if(_0x4167c6[_0x0c7e('0x18')]){if(_0x4167c6[_0x0c7e('0x18')][_0x0c7e('0x19')]){logger[_0x0c7e('0x7')](_0x0c7e('0x1a'),JSON[_0x0c7e('0x11')](_0x4167c6[_0x0c7e('0x18')][_0x0c7e('0x1b')]));_0xdafd0b=_0x4167c6['result']['hypotheses'][0x0]['transcript'];_0x1b13be=_0x4167c6['result'][_0x0c7e('0x1b')][0x0][_0x0c7e('0x1c')];_0x4d0b0c='0';_0x394bcc=_0x0c7e('0x1d');_0x297d70['terminate']();}}break;case 0x1:logger[_0x0c7e('0x7')](_0x0c7e('0x1e'));_0x4d0b0c='1';_0x394bcc=_0x0c7e('0x1e');break;case 0x2:logger['info'](_0x0c7e('0x1f'));_0x4d0b0c='2';_0x394bcc=_0x0c7e('0x1f');break;case 0x9:logger[_0x0c7e('0x7')](_0x0c7e('0x20'));_0x4d0b0c='9';_0x394bcc=_0x0c7e('0x20');break;case 0xa:logger[_0x0c7e('0x7')](_0x0c7e('0x21'));_0x4d0b0c='10';_0x394bcc=_0x0c7e('0x21');break;case 0xb:logger['info'](_0x0c7e('0x22'));_0x4d0b0c='11';_0x394bcc=_0x0c7e('0x22');}}}catch(_0x4193a9){logger[_0x0c7e('0x14')](_0x0c7e('0x23'),JSON[_0x0c7e('0x11')](_0x4193a9));_0x297d70[_0x0c7e('0x24')]();}}function _0x47dea7(){logger[_0x0c7e('0x7')](_0x0c7e('0x25'));_0xe299d6({'transcript':_0xdafd0b,'confidence':_0x1b13be,'status':_0x4d0b0c,'status_message':_0x394bcc});}function _0x33e474(_0x4dfd16){logger[_0x0c7e('0x14')](_0x0c7e('0x26'));if(!_[_0x0c7e('0x27')](_0x4dfd16)){logger[_0x0c7e('0x14')](_['isObject'](_0x4dfd16)?JSON[_0x0c7e('0x11')](_0x4dfd16):_0x4dfd16);}}_0x297d70['on'](_0x0c7e('0x28'),_0x536d82);_0x297d70['on'](_0x0c7e('0x29'),_0x4bebdc);_0x297d70['on'](_0x0c7e('0x13'),_0x47dea7);_0x297d70['on'](_0x0c7e('0x14'),_0x33e474);});}; \ 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 162963a..d7284c1 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 _0x4dc2=['exports','./asr'];(function(_0xf9a900,_0x4a7ec9){var _0x3cb257=function(_0x544dd0){while(--_0x544dd0){_0xf9a900['push'](_0xf9a900['shift']());}};_0x3cb257(++_0x4a7ec9);}(_0x4dc2,0x177));var _0x24dc=function(_0xb3867e,_0x5be77d){_0xb3867e=_0xb3867e-0x0;var _0x2504af=_0x4dc2[_0xb3867e];return _0x2504af;};var asr=require(_0x24dc('0x0'));module[_0x24dc('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb799=['exports'];(function(_0x5e9c04,_0x132903){var _0x4adf75=function(_0x24a921){while(--_0x24a921){_0x5e9c04['push'](_0x5e9c04['shift']());}};_0x4adf75(++_0x132903);}(_0xb799,0x1ef));var _0x9b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb799[_0x3dd15e];return _0x231fd0;};var asr=require('./asr');module[_0x9b79('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 24d1248..f67ba24 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 _0x9188=['destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x9188,0x1be));var _0x8918=function(_0x4c2264,_0x41056a){_0x4c2264=_0x4c2264-0x0;var _0x5027a2=_0x9188[_0x4c2264];return _0x5027a2;};'use strict';var util=require(_0x8918('0x0'));var net=require(_0x8918('0x1'));var EventEmitter=require(_0x8918('0x2'))[_0x8918('0x3')];var AGIError=require('./error');var AGIChannel=require('./channel');var AGIServer=function(_0x2706f7,_0x2fe455,_0x560a73){var _0x382409=this,_0x2706f7=_0x2706f7||0x11dd,_0x2fe455=_0x2fe455||_0x8918('0x4'),_0x211fe7=null,_0x1bcc42=0x0;EventEmitter[_0x8918('0x5')](_0x382409);function _0x19f29e(){if(!_0x2706f7){_0x382409[_0x8918('0x6')](_0x8918('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x211fe7=net[_0x8918('0x8')]();_0x211fe7[_0x8918('0x9')](_0x2706f7,_0x2fe455);_0x211fe7['on']('listening',function(){_0x382409[_0x8918('0x6')](_0x8918('0xa'));});_0x211fe7['on']('connection',function(_0x20d45b){_0x211fe7[_0x8918('0xb')](function(_0x4655f2,_0x17c9ca){if(_0x4655f2){_0x382409[_0x8918('0x6')]('error',new AGIError(_0x8918('0xc'),_0x4655f2));}else if(_0x560a73&&_0x560a73<0x0){_0x382409[_0x8918('0x6')](_0x8918('0x7'),new AGIError(_0x8918('0xd')));_0x20d45b['destroy']();}else if(_0x560a73&&_0x560a73>0x0&&_0x560a73<_0x17c9ca){_0x1bcc42+=0x1;_0x382409[_0x8918('0x6')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x1bcc42));_0x20d45b[_0x8918('0xe')]();}else{var _0xee33a7=new AGIChannel(_0x20d45b);_0xee33a7['on'](_0x8918('0xf'),function(){_0x382409[_0x8918('0x6')](_0x8918('0x10'),_0xee33a7);});}});});_0x211fe7['on']('error',function(_0x119d5b){_0x382409[_0x8918('0x6')](_0x8918('0x7'),new AGIError(_0x8918('0xc'),_0x119d5b[_0x8918('0x11')]));});_0x211fe7['on']('close',function(){_0x382409[_0x8918('0x6')](_0x8918('0x12'),new AGIError(_0x8918('0x13')));});}process[_0x8918('0x14')](function(){_0x19f29e();});};util[_0x8918('0x15')](AGIServer,EventEmitter);module[_0x8918('0x16')]=function(_0x57f9f9,_0x42ab3f,_0x3bda75){return new AGIServer(_0x57f9f9,_0x42ab3f,_0x3bda75);}; \ No newline at end of file +var _0x6bdb=['exports','util','EventEmitter','./error','./channel','127.0.0.1','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','emit','E_AGI_SERVER_ERROR','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits'];(function(_0x2952d9,_0x1f0176){var _0x41bb40=function(_0x5d2f63){while(--_0x5d2f63){_0x2952d9['push'](_0x2952d9['shift']());}};_0x41bb40(++_0x1f0176);}(_0x6bdb,0x1e4));var _0xb6bd=function(_0x1589bf,_0x4755c5){_0x1589bf=_0x1589bf-0x0;var _0x4d3052=_0x6bdb[_0x1589bf];return _0x4d3052;};'use strict';var util=require(_0xb6bd('0x0'));var net=require('net');var EventEmitter=require('events')[_0xb6bd('0x1')];var AGIError=require(_0xb6bd('0x2'));var AGIChannel=require(_0xb6bd('0x3'));var AGIServer=function(_0x3d4690,_0x3b6a72,_0x4189e2){var _0x3cf60d=this,_0x3d4690=_0x3d4690||0x11dd,_0x3b6a72=_0x3b6a72||_0xb6bd('0x4'),_0x2886de=null,_0x5d69c2=0x0;EventEmitter['call'](_0x3cf60d);function _0x37294e(){if(!_0x3d4690){_0x3cf60d['emit'](_0xb6bd('0x5'),new AGIError(_0xb6bd('0x6')));return![];}_0x2886de=net[_0xb6bd('0x7')]();_0x2886de[_0xb6bd('0x8')](_0x3d4690,_0x3b6a72);_0x2886de['on']('listening',function(){_0x3cf60d['emit'](_0xb6bd('0x9'));});_0x2886de['on'](_0xb6bd('0xa'),function(_0x16779e){_0x2886de['getConnections'](function(_0x379856,_0x401ad1){if(_0x379856){_0x3cf60d[_0xb6bd('0xb')](_0xb6bd('0x5'),new AGIError(_0xb6bd('0xc'),_0x379856));}else if(_0x4189e2&&_0x4189e2<0x0){_0x3cf60d[_0xb6bd('0xb')](_0xb6bd('0x5'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x16779e[_0xb6bd('0xd')]();}else if(_0x4189e2&&_0x4189e2>0x0&&_0x4189e2<_0x401ad1){_0x5d69c2+=0x1;_0x3cf60d[_0xb6bd('0xb')](_0xb6bd('0x5'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5d69c2));_0x16779e['destroy']();}else{var _0x236f01=new AGIChannel(_0x16779e);_0x236f01['on'](_0xb6bd('0xe'),function(){_0x3cf60d[_0xb6bd('0xb')]('connection',_0x236f01);});}});});_0x2886de['on']('error',function(_0x274ff9){_0x3cf60d['emit']('error',new AGIError(_0xb6bd('0xc'),_0x274ff9[_0xb6bd('0xf')]));});_0x2886de['on'](_0xb6bd('0x10'),function(){_0x3cf60d[_0xb6bd('0xb')](_0xb6bd('0x10'),new AGIError(_0xb6bd('0x11')));});}process[_0xb6bd('0x12')](function(){_0x37294e();});};util[_0xb6bd('0x13')](AGIServer,EventEmitter);module[_0xb6bd('0x14')]=function(_0x5818c7,_0x49ffb9,_0x32e732){return new AGIServer(_0x5818c7,_0x49ffb9,_0x32e732);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 68bd659..d6c2bc0 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 _0xced7=['no\x20query\x20configured','query','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','dialogflowV2_language','no\x20anguage\x20configured','providerResponse','dialogflowV2','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%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','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','getSound','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','service','secure','auth','pass','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\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','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','shelljs','odbc','moment','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','rpc','mailRpc','getVariable','then','catch','getVoiceQueueById','name','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','dnid','file','createSquareMessage','isEmpty','callback_','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','agentPause','agent','agentUnpause','isNil','agentLogout','internal','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','parse','computedVariables','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','getAndSetVariable','result','extra','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','isConfigured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','callback_priority','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0xced7,0xf2));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x7ced('0x0'));var util=require(_0x7ced('0x1'));var _=require(_0x7ced('0x2'));var sh=require(_0x7ced('0x3'));var odbc=require(_0x7ced('0x4'))();var rs=require('randomstring');var moment=require(_0x7ced('0x5'));var Mustache=require('mustache');var rp=require(_0x7ced('0x6'));var logger=require(_0x7ced('0x7'))('agi');var config=require('../../config/environment');var scripts=require(_0x7ced('0x8'));var FILES_PATH=_0x7ced('0x9');var recursiveMapAttributes=['rawHeaders',_0x7ced('0xa')];var verticesWithRetry=[_0x7ced('0xb'),'getdigits',_0x7ced('0xc')];var AGIVertices=function(_0x47f55f,_0x3ff352,_0x1092c2){this['channel']=_0x47f55f;this[_0x7ced('0xd')]=_0x3ff352;this[_0x7ced('0xe')]=_0x1092c2;};AGIVertices['prototype'][_0x7ced('0xf')]=function(_0x16f58b,_0x8307ec){this['rpc']['getVariableById'](_0x16f58b)[_0x7ced('0x10')](function(_0x22ce46){_0x8307ec(null,_0x22ce46?_0x22ce46['name']:![]);})[_0x7ced('0x11')](function(_0x5a88c8){_0x8307ec(_0x5a88c8);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x43932c,_0x4bb98b){this[_0x7ced('0xd')][_0x7ced('0x12')](_0x43932c)[_0x7ced('0x10')](function(_0x131ded){_0x4bb98b(null,_0x131ded?_0x131ded[_0x7ced('0x13')]:![]);})[_0x7ced('0x11')](function(_0x2e6ebe){_0x4bb98b(_0x2e6ebe);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x15')]=function(_0x308691,_0x314584){this[_0x7ced('0xd')][_0x7ced('0x16')](_0x308691)['then'](function(_0x3ee432){_0x314584(null,_0x3ee432?_0x3ee432[_0x7ced('0x13')]:![]);})[_0x7ced('0x11')](function(_0x47069c){_0x314584(_0x47069c);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x17')]=function(_0x589d5f,_0x4db332){this['rpc'][_0x7ced('0x18')](_0x589d5f)[_0x7ced('0x10')](function(_0x393165){_0x4db332(null,_0x393165?_0x393165[_0x7ced('0x19')]:![]);})[_0x7ced('0x11')](function(_0x5c11d0){_0x4db332(_0x5c11d0);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x1a')]=function(_0x270351,_0xfc328c){this[_0x7ced('0xd')][_0x7ced('0x1b')](_0x270351)[_0x7ced('0x10')](function(_0x13ffaf){_0xfc328c(null,_0x13ffaf?_0x13ffaf[_0x7ced('0x13')]:![]);})[_0x7ced('0x11')](function(_0x1b8b9e){_0xfc328c(_0x1b8b9e);});};AGIVertices['prototype']['getTrunk']=function(_0x17728d,_0x12c703){this[_0x7ced('0xd')][_0x7ced('0x1c')](_0x17728d)[_0x7ced('0x10')](function(_0x29cec7){_0x12c703(null,_0x29cec7?_0x29cec7[_0x7ced('0x13')]:![]);})[_0x7ced('0x11')](function(_0x5756ca){_0x12c703(_0x5756ca);});};AGIVertices[_0x7ced('0x14')]['getSound']=function(_0x4a5739,_0x5957d8){var _0x310c52=this;this['rpc'][_0x7ced('0x1d')](_0x4a5739)[_0x7ced('0x10')](function(_0x340a29){_0x5957d8(null,_0x340a29?_0x310c52['getSoundPath'](_0x340a29[_0x7ced('0x1e')]):![]);})[_0x7ced('0x11')](function(_0x29be29){_0x5957d8(_0x29be29);});};AGIVertices['prototype']['getMailAccount']=function(_0x4007f3,_0x18452b){this[_0x7ced('0xd')][_0x7ced('0x1f')](_0x4007f3)[_0x7ced('0x10')](function(_0x56cc6a){_0x18452b(null,_0x56cc6a?_0x56cc6a:![]);})[_0x7ced('0x11')](function(_0x1c51df){_0x18452b(_0x1c51df);});};AGIVertices[_0x7ced('0x14')]['sendMailMessage']=function(_0x421229,_0x5c0552,_0x181763){this[_0x7ced('0xe')][_0x7ced('0x20')](_0x421229,_0x5c0552)['then'](function(){_0x181763(null);})['catch'](function(_0xe7df79){_0x181763(_0xe7df79);});};AGIVertices['prototype'][_0x7ced('0x21')]=function(_0x33e355,_0x47ff63){this[_0x7ced('0xd')][_0x7ced('0x22')](_0x33e355)[_0x7ced('0x10')](function(_0x553f9b){if(_0x553f9b){if(_0x553f9b[_0x7ced('0x23')]){_0x47ff63(null,[_0x553f9b['interval']]);}else{_0x47ff63(null,_[_0x7ced('0x24')](_0x553f9b[_0x7ced('0x25')],_0x7ced('0x26')));}}else{_0x47ff63(null,![]);}})[_0x7ced('0x11')](function(_0x432d08){_0x47ff63(_0x432d08);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x27')]=function(_0x2df367){return util[_0x7ced('0x28')](_0x7ced('0x29'),FILES_PATH,_0x2df367);};AGIVertices[_0x7ced('0x14')][_0x7ced('0x2a')]=function(_0x4ddeb4,_0x54fc16,_0x5adf3c){odbc['open'](_0x4ddeb4,function(_0x17d862){if(_0x17d862){logger[_0x7ced('0x2b')](_0x7ced('0x2c'),_0x17d862);_0x5adf3c(_0x17d862);}else{logger['info'](_0x7ced('0x2d'));odbc['query'](_0x54fc16,function(_0x1ca8a2,_0x5ac4cf){if(_0x1ca8a2){logger[_0x7ced('0x2e')]('Error\x20executing\x20query\x20%s',_0x54fc16);_0x5adf3c(_0x1ca8a2);}else{logger['info'](_0x7ced('0x2f'),_0x54fc16);odbc[_0x7ced('0x30')](function(_0x26f5d5){if(_0x26f5d5){logger[_0x7ced('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x26f5d5);}_0x5adf3c(null,_0x5ac4cf);});}});}});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x31')]=function(_0x2d2359,_0xc5c43d){this[_0x7ced('0xd')][_0x7ced('0x32')](_0x2d2359)['then'](function(_0x3f141c){_0xc5c43d(null,_0x3f141c?_0x3f141c:![]);})[_0x7ced('0x11')](function(_0x4b5186){_0xc5c43d(_0x4b5186);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x33')]=function(_0x4a0536,_0x130e19){this[_0x7ced('0xd')][_0x7ced('0x33')](_0x4a0536)[_0x7ced('0x10')](function(_0x3626e7){_0x130e19(null,_0x3626e7);})[_0x7ced('0x11')](function(_0xf852da){_0x130e19(_0xf852da);});};AGIVertices[_0x7ced('0x14')]['createSquareDetailsReport']=function(_0x1a2f4c,_0x496eb7,_0x25ea79){this['rpc'][_0x7ced('0x34')]({'uniqueid':this[_0x7ced('0x35')][_0x7ced('0x36')],'node':_0x1a2f4c['label'],'application':_0x1a2f4c[_0x7ced('0x37')],'data':_0x496eb7||null,'project_name':this[_0x7ced('0x35')][_0x7ced('0x38')],'callerid':this[_0x7ced('0x35')]['callerid']})['then'](function(_0x3f5aa2){if(_0x25ea79){_0x25ea79(null,_0x3f5aa2);}})[_0x7ced('0x11')](function(_0x58826d){if(_0x25ea79){_0x25ea79(_0x58826d);}});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x39')]=function(_0x4bb814,_0x44076a,_0x19ddf5,_0x77785d){this[_0x7ced('0xd')][_0x7ced('0x39')]({'uniqueid':this['channel'][_0x7ced('0x36')],'callerid':this['channel'][_0x7ced('0x3a')],'calleridname':this[_0x7ced('0x35')][_0x7ced('0x3b')],'context':this[_0x7ced('0x35')]['context'],'extension':this[_0x7ced('0x35')][_0x7ced('0x3c')],'priority':this[_0x7ced('0x35')]['priority'],'accountcode':this[_0x7ced('0x35')]['accountcode'],'dnid':this[_0x7ced('0x35')][_0x7ced('0x3d')],'projectName':this[_0x7ced('0x35')][_0x7ced('0x38')],'saveName':_0x44076a,'filename':_0x4bb814[_0x7ced('0x3e')]||_0x44076a,'savePath':_0x19ddf5})[_0x7ced('0x10')](function(_0x385346){_0x77785d(null,_0x385346);})['catch'](function(_0x500bf4){_0x77785d(_0x500bf4);});};AGIVertices[_0x7ced('0x14')]['createSquareMessage']=function(_0x14a0f6,_0x46d96b,_0x227ee2,_0x23b543,_0x1de8fe){this['rpc'][_0x7ced('0x3f')]({'uniqueid':this[_0x7ced('0x35')][_0x7ced('0x36')],'body':_0x14a0f6,'direction':_0x46d96b,'providerName':_0x227ee2,'providerResponse':_0x23b543})[_0x7ced('0x10')](function(_0x3179ad){if(_0x1de8fe){_0x1de8fe(null,_0x3179ad);}})[_0x7ced('0x11')](function(_0x1d9a5c){if(_0x1de8fe){_0x1de8fe(_0x1d9a5c);}});};AGIVertices['prototype']['createCmContact']=function(_0x326fb5,_0x24149f){this[_0x7ced('0xd')]['createCmContact']({'firstName':_[_0x7ced('0x40')](_0x326fb5['name'])||_['isNil'](_0x326fb5[_0x7ced('0x13')])?_0x7ced('0x41')+Math[_0x7ced('0x42')]():_0x326fb5[_0x7ced('0x13')],'lastName':_['isEmpty'](_0x326fb5[_0x7ced('0x43')])||_['isNil'](_0x326fb5['lastName'])?null:_0x326fb5[_0x7ced('0x43')],'phone':_0x326fb5[_0x7ced('0x44')],'ListId':_0x326fb5['list_id'],'scheduledat':_0x326fb5['scheduledAt'],'callbackUniqueid':this[_0x7ced('0x35')]['uniqueid'],'tags':_0x7ced('0x45'),'description':_0x7ced('0x46')+_0x326fb5[_0x7ced('0x47')][_0x7ced('0x48')](),'priority':_0x326fb5['callback_priority']})['then'](function(_0x163b1b){_0x24149f(null,_0x163b1b);})[_0x7ced('0x11')](function(_0x1a1e2a){_0x24149f(_0x1a1e2a);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x49')]=function(_0x4a0d97,_0x327a1d){this[_0x7ced('0xd')]['getPauseById'](_0x4a0d97)[_0x7ced('0x10')](function(_0x45c726){_0x327a1d(null,_0x45c726?_0x45c726[_0x7ced('0x13')]:![]);})[_0x7ced('0x11')](function(_0x348c5b){_0x327a1d(_0x348c5b);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x4a')]=function(_0x590b5c,_0x90cb14,_0x1c02f4){var _0x5b5753={'role':_0x7ced('0x4b')};_0x5b5753[_0x590b5c]=this[_0x7ced('0x35')][_0x7ced('0x3a')];this[_0x7ced('0xd')][_0x7ced('0x4a')](_0x5b5753,_0x90cb14,this[_0x7ced('0x35')][_0x7ced('0x36')])[_0x7ced('0x10')](function(_0x523e89){_0x1c02f4(null,_['isNil'](_0x523e89)?![]:!![]);})[_0x7ced('0x11')](function(_0x4f566a){logger[_0x7ced('0x2b')](_0x4f566a);_0x1c02f4(null,![]);});};AGIVertices['prototype'][_0x7ced('0x4c')]=function(_0x5dc1e7,_0x86d0cd){var _0x4e026f={'role':'agent'};_0x4e026f[_0x5dc1e7]=this[_0x7ced('0x35')][_0x7ced('0x3a')];this[_0x7ced('0xd')][_0x7ced('0x4c')](_0x4e026f)[_0x7ced('0x10')](function(_0x59c7ef){_0x86d0cd(null,_[_0x7ced('0x4d')](_0x59c7ef)?![]:!![]);})[_0x7ced('0x11')](function(_0x39e7ef){logger[_0x7ced('0x2b')](_0x39e7ef);_0x86d0cd(null,![]);});};AGIVertices[_0x7ced('0x14')]['agentLogout']=function(_0x321927,_0xe11b53){var _0x53ac13={'role':'agent'};_0x53ac13[_0x321927]=this[_0x7ced('0x35')]['callerid'];this[_0x7ced('0xd')][_0x7ced('0x4e')](_0x53ac13)[_0x7ced('0x10')](function(_0x1d9675){_0xe11b53(null,_[_0x7ced('0x4d')](_0x1d9675)?![]:!![]);})['catch'](function(_0xdcda44){logger['error'](_0xdcda44);_0xe11b53(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x5430d0,_0x4adb80){var _0x122397={'role':_0x7ced('0x4b')};_0x122397[_0x5430d0]=this[_0x7ced('0x35')][_0x7ced('0x3a')];var _0x1a2a2c=_0x5430d0!=_0x7ced('0x4f')?util[_0x7ced('0x28')](_0x7ced('0x50'),_0x7ced('0x51'),this[_0x7ced('0x35')][_0x7ced('0x3a')]):undefined;this['rpc']['agentLogin'](_0x122397,_0x1a2a2c)[_0x7ced('0x10')](function(_0x51437b){_0x4adb80(null,_['isNil'](_0x51437b)?![]:!![]);})['catch'](function(_0x3f2fcc){logger[_0x7ced('0x2b')](_0x3f2fcc);_0x4adb80(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x3da73c,_0x5e0a2c){sh[_0x7ced('0x52')](_[_0x7ced('0x53')](_0x3da73c),function(_0x5ed1f3,_0x259341){var _0x379eec=_0x259341['replace'](/(\r\n|\n|\r)/gm,'');_0x5e0a2c(null,_0x379eec);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x54')]=function(_0x255414,_0x5ea6ca){scripts[_0x7ced('0x54')](_0x255414[_0x7ced('0x55')],_0x255414[_0x7ced('0x56')]||_0x7ced('0x57'),_0x255414['text'],_0x255414[_0x7ced('0x58')]||'en-US',_0x255414[_0x7ced('0x59')]||_0x7ced('0x5a'),_0x255414[_0x7ced('0x5b')]||'MP3')['then'](function(_0x1b71ca){_0x5ea6ca(null,_0x1b71ca);})[_0x7ced('0x11')](function(_0x5df799){_0x5ea6ca(_0x5df799);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x5c')]=function(_0x4bc581,_0x16645e){scripts[_0x7ced('0x5c')](_0x4bc581[_0x7ced('0x57')],_0x4bc581[_0x7ced('0x5d')]||'en',0x1)[_0x7ced('0x10')](function(_0x201d34){_0x16645e(null,_0x201d34);})[_0x7ced('0x11')](function(_0x53923e){_0x16645e(_0x53923e);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x5e')]=function(_0x10c9fb,_0x3f220a){var _0x4da326={'uri':_0x10c9fb[_0x7ced('0x5f')],'method':_0x10c9fb['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x10c9fb[_0x7ced('0x60')])===_0x7ced('0x61')&&parseInt(_0x10c9fb[_0x7ced('0x60')])>=0x1?parseInt(_0x10c9fb['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x7ced('0x62')]([_0x7ced('0x63'),_0x7ced('0x64')],_0x4da326[_0x7ced('0x65')][_0x7ced('0x66')]())){try{_0x4da326[_0x7ced('0x67')]=_0x10c9fb[_0x7ced('0xa')]?JSON['parse'](_0x10c9fb['rawBody']):{};}catch(_0x4ab4ef){logger['error'](_0x7ced('0x68'),_0x4ab4ef);}}try{_0x4da326['headers']=_0x10c9fb[_0x7ced('0x69')]?JSON[_0x7ced('0x6a')](_0x10c9fb[_0x7ced('0x69')]):{};}catch(_0xf01734){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0xf01734);}if(_0x10c9fb[_0x7ced('0x6b')]){try{var _0x4dc2c5=require(_0x10c9fb['computedVariables'])['sync'](this,_0x4da326);_0x4da326[_0x7ced('0x6c')]=Mustache['render'](_0x10c9fb[_0x7ced('0x5f')],_0x4dc2c5,{},['$$','$$']);if(_0x4da326['headers']){_0x4da326[_0x7ced('0x6d')]=JSON['parse'](Mustache[_0x7ced('0x6e')](JSON['stringify'](_0x4da326[_0x7ced('0x6d')]),_0x4dc2c5,{},['$$','$$']));}if(_0x4da326['body']){_0x4da326['body']=JSON[_0x7ced('0x6a')](Mustache[_0x7ced('0x6e')](JSON[_0x7ced('0x6f')](_0x4da326['body']),_0x4dc2c5,{},['$$','$$']));}}catch(_0x2f41ef){logger[_0x7ced('0x2b')](_0x7ced('0x70'),_0x2f41ef);}}rp(_0x4da326)[_0x7ced('0x10')](function(_0x785c7a){var _0x519f29={'statusCode':_0x785c7a['statusCode']||0xc8,'statusMessage':_0x785c7a[_0x7ced('0x71')]||'OK','headers':_0x785c7a[_0x7ced('0x6d')]||{},'body':_0x785c7a[_0x7ced('0x67')]||{}};_0x3f220a(null,_0x519f29);})[_0x7ced('0x11')](function(_0x331e55){var _0x29d39c={'statusCode':_0x331e55[_0x7ced('0x72')]||0x1f4,'statusMessage':_0x331e55[_0x7ced('0x73')]||_0x7ced('0x74'),'headers':_0x331e55[_0x7ced('0x75')][_0x7ced('0x6d')]||{},'body':_0x331e55[_0x7ced('0x75')][_0x7ced('0x67')]||{}};_0x3f220a(null,_0x29d39c);});};AGIVertices['prototype'][_0x7ced('0x76')]=function(_0x3fc866,_0x4a0197){scripts[_0x7ced('0x76')](this[_0x7ced('0x35')]['uniqueid'],_0x3fc866[_0x7ced('0x77')],_0x3fc866[_0x7ced('0x57')],_0x3fc866[_0x7ced('0x78')]||'en')['then'](function(_0x1c3a3f){_0x4a0197(null,_0x1c3a3f);})['catch'](function(_0x337223){_0x4a0197(_0x337223);});};AGIVertices['prototype'][_0x7ced('0x79')]=function(_0x499018,_0x1e2f97){scripts[_0x7ced('0x79')](this['channel'][_0x7ced('0x36')],_0x499018[_0x7ced('0x7a')],_0x499018[_0x7ced('0x7b')],_0x499018[_0x7ced('0x7c')],_0x499018[_0x7ced('0x57')],_0x499018['dialogflowV2_language']||'en')[_0x7ced('0x10')](function(_0x19289f){_0x1e2f97(null,_0x19289f);})[_0x7ced('0x11')](function(_0xaa8fee){_0x1e2f97(_0xaa8fee);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x7d')]=function(_0x3c9514,_0x370ccb){scripts[_0x7ced('0x7d')](this[_0x7ced('0x35')],_0x3c9514)[_0x7ced('0x10')](function(_0x21650){_0x370ccb(null,_0x21650);})['catch'](function(_0x422cdf){_0x370ccb(_0x422cdf);});};AGIVertices[_0x7ced('0x14')]['ispeechTTS']=function(_0x2854bb,_0x3d83f0){scripts[_0x7ced('0x7e')](_0x2854bb[_0x7ced('0x77')],_0x2854bb[_0x7ced('0x57')],_0x2854bb[_0x7ced('0x7f')]||'en-US',_0x2854bb[_0x7ced('0x80')])['then'](function(_0x1e11eb){_0x3d83f0(null,_0x1e11eb);})[_0x7ced('0x11')](function(_0x3462cc){_0x3d83f0(_0x3462cc);});};AGIVertices['prototype']['ispeechASR']=function(_0x54a2b9,_0x2af9aa,_0x1a63c9){scripts[_0x7ced('0x81')](_0x2af9aa,_0x54a2b9[_0x7ced('0x77')],_0x54a2b9[_0x7ced('0x82')]||_0x7ced('0x83'),this['isConfigured'](_0x54a2b9[_0x7ced('0x84')])?_0x54a2b9[_0x7ced('0x84')]:undefined)['then'](function(_0x5e63df){_0x1a63c9(null,_0x5e63df);})[_0x7ced('0x11')](function(_0x9aac75){_0x1a63c9(_0x9aac75);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x85')]=function(_0x10e7e0,_0x81a979){scripts[_0x7ced('0x85')](_0x10e7e0[_0x7ced('0x86')],_0x10e7e0[_0x7ced('0x87')],_0x10e7e0[_0x7ced('0x88')],_0x10e7e0[_0x7ced('0x89')]||'Amy',_0x10e7e0[_0x7ced('0x57')],_0x10e7e0[_0x7ced('0x8a')]||_0x7ced('0x57'))['then'](function(_0x221823){_0x81a979(null,_0x221823);})[_0x7ced('0x11')](function(_0x52afe0){_0x81a979(_0x52afe0);});};AGIVertices[_0x7ced('0x14')]['awsLex']=function(_0x3d8963,_0x258507){scripts[_0x7ced('0x8b')](this['channel'][_0x7ced('0x36')],_0x3d8963[_0x7ced('0x86')],_0x3d8963[_0x7ced('0x87')],_0x3d8963[_0x7ced('0x8c')],_0x3d8963[_0x7ced('0x57')],_0x3d8963[_0x7ced('0x8d')])[_0x7ced('0x10')](function(_0x1a91f0){_0x258507(null,_0x1a91f0);})[_0x7ced('0x11')](function(_0x43dc53){_0x258507(_0x43dc53);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x8e')]=function(_0x42acaa,_0x25392e,_0x11ba8c){scripts['googleASR'](_0x25392e,_0x42acaa[_0x7ced('0x77')],_0x42acaa[_0x7ced('0x8f')]||_0x7ced('0x83'))[_0x7ced('0x10')](function(_0x205701){_0x11ba8c(null,_0x205701);})[_0x7ced('0x11')](function(_0x10f44f){_0x11ba8c(_0x10f44f);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x90')]=function(_0x446a5f,_0x453bfd,_0x1b4726){scripts['tildeASR'](_0x453bfd,_0x446a5f[_0x7ced('0x91')],_0x446a5f['appsecret'],_0x446a5f[_0x7ced('0x6c')])[_0x7ced('0x10')](function(_0x347d68){_0x1b4726(null,_0x347d68);})['catch'](function(_0x4ca9ee){_0x1b4726(_0x4ca9ee);});};AGIVertices[_0x7ced('0x14')][_0x7ced('0x92')]=function(_0x4fe219){var _0x9ad02e=_[_0x7ced('0x62')](verticesWithRetry,_0x4fe219['agicommand'])?_0x4fe219:_[_0x7ced('0x93')](_0x4fe219);for(var _0x380177 in _0x9ad02e){if(_0x9ad02e[_0x7ced('0x94')](_0x380177)){if(_0x9ad02e[_0x380177]&&_[_0x7ced('0x95')](_0x9ad02e[_0x380177])){if(_[_0x7ced('0x62')](recursiveMapAttributes,_0x380177)){_0x9ad02e[_0x380177]=this[_0x7ced('0x96')](_0x9ad02e[_0x380177]);}else{_0x9ad02e[_0x380177]=this['replaceAllVariables'](_0x9ad02e[_0x380177]);}}}}return _0x9ad02e;};AGIVertices['prototype'][_0x7ced('0x97')]=function(_0x1bf16a){for(var _0x455990 in _0x1bf16a){if(_0x1bf16a['hasOwnProperty'](_0x455990)){if(_[_0x7ced('0x98')](_0x1bf16a[_0x455990])){this[_0x7ced('0x97')](_0x1bf16a[_0x455990]);}else if(_[_0x7ced('0x99')](_0x1bf16a[_0x455990])){for(var _0x3b7074=0x0;_0x3b7074<_0x1bf16a[_0x455990][_0x7ced('0x9a')];_0x3b7074++){this['recursiveNodeIndex'](_0x1bf16a[_0x455990][_0x3b7074]);}}else if(_[_0x7ced('0x95')](_0x1bf16a[_0x455990])){_0x1bf16a[_0x455990]=this['replaceAllVariables'](_0x1bf16a[_0x455990]);}}}};AGIVertices[_0x7ced('0x14')][_0x7ced('0x9b')]=function(_0x2648af,_0x397e57){for(var _0x22c956 in _0x2648af){if(_0x2648af[_0x7ced('0x94')](_0x22c956)){if(_['isPlainObject'](_0x2648af[_0x22c956])){if(!_['isEmpty'](_0x2648af[_0x22c956])){this[_0x7ced('0x9b')](_0x2648af[_0x22c956],util[_0x7ced('0x28')]('%s.%s',_0x397e57,_0x22c956));}}else if(_[_0x7ced('0x99')](_0x2648af[_0x22c956])){for(var _0x39f068=0x0;_0x39f068<_0x2648af[_0x22c956]['length'];_0x39f068++){this[_0x7ced('0x9b')](_0x2648af[_0x22c956][_0x39f068],util[_0x7ced('0x28')](_0x7ced('0x9c'),_0x397e57,_0x22c956+'['+_0x39f068+']'));}}else{if(!_[_0x7ced('0x4d')](_0x2648af[_0x22c956])){this[_0x7ced('0x35')][_0x7ced('0x9d')](util[_0x7ced('0x28')](_0x7ced('0x9c'),_0x397e57,_0x22c956),_0x2648af[_0x22c956]);}}}}};AGIVertices['prototype'][_0x7ced('0x96')]=function(_0x5a1ed8){try{var _0xc4c8c7=JSON[_0x7ced('0x6a')](_0x5a1ed8);this[_0x7ced('0x97')](_0xc4c8c7);return JSON[_0x7ced('0x6f')](_0xc4c8c7);}catch(_0x4fa22b){return this[_0x7ced('0x9e')](_0x5a1ed8);}};AGIVertices[_0x7ced('0x14')][_0x7ced('0x9e')]=function(_0x1a0351){var _0x106fb1=_0x1a0351[_0x7ced('0x9f')]('{');for(var _0x2f8f00=0x1;_0x2f8f00<_0x106fb1['length'];_0x2f8f00+=0x1){var _0x2502b6=_0x106fb1[_0x2f8f00][_0x7ced('0x9f')]('}');if(_0x2502b6['length']>0x1){_0x1a0351=_0x1a0351[_0x7ced('0xa0')]('{'+_0x2502b6[0x0]+'}',this['channel'][_0x7ced('0xf')](_0x2502b6[0x0])['extra']||_0x2502b6[0x0]);}}if(_0x106fb1['length']===0x1){return _0x1a0351[_0x7ced('0x48')]();}return this[_0x7ced('0x9e')](_0x1a0351);};AGIVertices[_0x7ced('0x14')][_0x7ced('0xa1')]=function(_0x11d336,_0x497225){var _0x45132b=this[_0x7ced('0x35')]['getVariable'](_0x11d336);if(_0x45132b[_0x7ced('0xa2')]===-0x1){return _0x45132b;}logger[_0x7ced('0x2e')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x497225,_0x45132b[_0x7ced('0xa3')]));return this[_0x7ced('0x35')][_0x7ced('0x9d')](_0x497225,_0x45132b['extra']);};AGIVertices['prototype']['isConfigured']=function(_0x170185){return _0x170185&&_0x170185!=='0'&&_0x170185!=='-1'&&_0x170185!=='';};AGIVertices[_0x7ced('0x14')][_0x7ced('0xa4')]=function(_0x581c33){this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x581c33,'-');_0x581c33['retry']=_0x581c33[_0x7ced('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7ced('0x14')][_0x7ced('0xa6')]=function(_0x4b7921){logger['info'](util[_0x7ced('0x28')](_0x7ced('0xa7'),_0x4b7921['label']));if(!this['isConfigured'](_0x4b7921['text'])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xa9'));}var _0xec2bd='\x22'+_0x4b7921[_0x7ced('0x57')]+'\x22';if(this[_0x7ced('0xaa')](_0x4b7921[_0x7ced('0x75')])){_0xec2bd+=','+_0x4b7921['options'];}var _0x9583c8=this[_0x7ced('0x35')][_0x7ced('0x52')]('MRCPSynth',_0xec2bd);if(_0x9583c8[_0x7ced('0xa2')]===-0x1){return _0x9583c8;}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xab'),_0xec2bd));};AGIVertices[_0x7ced('0x14')][_0x7ced('0xac')]=function(_0x2b5466){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0xad'),_0x2b5466[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x2b5466[_0x7ced('0xaf')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')]('no\x20grammar\x20configured');}var _0x11a83b=_0x2b5466['grammar'];if(this['isConfigured'](_0x2b5466[_0x7ced('0x75')])){_0x11a83b+=','+_0x2b5466['options'];}var _0x16eb21=this['channel'][_0x7ced('0x52')](_0x7ced('0xb0'),_0x11a83b);if(_0x16eb21[_0x7ced('0xa2')]===-0x1){return _0x16eb21;}var _0xce4af1=this[_0x7ced('0xa1')](_0x7ced('0xb1'),'MRCP_RECOG_CONFIDENCE');if(_0xce4af1[_0x7ced('0xa2')]===-0x1){return _0xce4af1;}var _0x132e45=this[_0x7ced('0xa1')](_0x7ced('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0x132e45[_0x7ced('0xa2')]===-0x1){return _0x132e45;}var _0x207d4f=this[_0x7ced('0xa1')](_0x7ced('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x207d4f[_0x7ced('0xa2')]===-0x1){return _0x207d4f;}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format'](_0x7ced('0xb4'),_0x11a83b));};AGIVertices[_0x7ced('0x14')][_0x7ced('0xb5')]=function(_0x355568){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0xb6'),_0x355568['label']));return this[_0x7ced('0x35')][_0x7ced('0xb5')]([_0x355568['command'],_0x355568[_0x7ced('0xb7')]]);};AGIVertices[_0x7ced('0x14')]['answer']=function(_0x108a6f){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0xb8'),_0x108a6f[_0x7ced('0xae')]));if(this[_0x7ced('0xaa')](_0x108a6f['timeout'])){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x108a6f[_0x7ced('0x60')]));var _0x41f5bb=this[_0x7ced('0x35')][_0x7ced('0xb9')](_0x108a6f[_0x7ced('0x60')]);if(_0x41f5bb['result']===-0x1){return _0x41f5bb;}}return this['channel'][_0x7ced('0xba')]();};AGIVertices[_0x7ced('0x14')]['callback']=function(_0x3c7d82){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0xbb'),_0x3c7d82[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x3c7d82[_0x7ced('0xbc')])){return this['channel'][_0x7ced('0x2b')](_0x3c7d82,_0x7ced('0xbd'));}_0x3c7d82[_0x7ced('0x47')]=moment();if(this[_0x7ced('0xaa')](_0x3c7d82['delay'])){_0x3c7d82[_0x7ced('0x47')]=moment()[_0x7ced('0xbe')](_0x3c7d82['delay'],'minutes');}if(!this[_0x7ced('0xaa')](_0x3c7d82[_0x7ced('0xbf')])){_0x3c7d82['callback_priority']=0x2;}this[_0x7ced('0xc0')][_0x7ced('0xa5')](this,_0x3c7d82);return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xc1'),_0x3c7d82[_0x7ced('0x44')],_0x3c7d82['list_id'],_0x3c7d82[_0x7ced('0x47')]));};AGIVertices[_0x7ced('0x14')][_0x7ced('0xc2')]=function(_0x3f5b91){logger['info'](util[_0x7ced('0x28')](_0x7ced('0xc3'),_0x3f5b91[_0x7ced('0xae')]));var _0xe7818=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x3f5b91[_0x7ced('0xc4')],_0x3f5b91['options']);if(_0xe7818[_0x7ced('0xa2')]===-0x1){return _0xe7818;}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xc5'),_0x3f5b91[_0x7ced('0xc4')],_0x3f5b91[_0x7ced('0x75')]));};AGIVertices['prototype'][_0x7ced('0xc6')]=function(_0x245c6f){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0xc7'),_0x245c6f[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x245c6f[_0x7ced('0x57')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xa9'));}var _0x3e1519='\x22'+_0x245c6f[_0x7ced('0x57')]+'\x22';if(this[_0x7ced('0xaa')](_0x245c6f[_0x7ced('0x75')])){_0x3e1519+=','+_0x245c6f[_0x7ced('0x75')];}var _0x4bdccb=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x7ced('0xc8'),_0x3e1519);if(_0x4bdccb[_0x7ced('0xa2')]===-0x1){return _0x4bdccb;}return this['channel'][_0x7ced('0xa8')](util['format'](_0x7ced('0xab'),_0x3e1519));};AGIVertices['prototype'][_0x7ced('0xc9')]=function(_0x389198){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x389198[_0x7ced('0xae')]));if(!this['isConfigured'](_0x389198[_0x7ced('0x57')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xa9'));}var _0x180e5d='\x22'+_0x389198[_0x7ced('0x57')]+'\x22';if(this[_0x7ced('0xaa')](_0x389198[_0x7ced('0x75')])){_0x180e5d+=','+_0x389198['options'];}var _0x190ef6=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x7ced('0xc8'),_0x180e5d);if(_0x190ef6[_0x7ced('0xa2')]===-0x1){return _0x190ef6;}return this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xab'),_0x180e5d));};AGIVertices[_0x7ced('0x14')][_0x7ced('0xca')]=function(_0x2e1591){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0xcb'),_0x2e1591[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x2e1591[_0x7ced('0xaf')])){return this['channel'][_0x7ced('0xa8')]('no\x20grammar\x20configured');}var _0x10a85a=_0x2e1591['grammar'];if(this['isConfigured'](_0x2e1591['options'])){_0x10a85a+=','+_0x2e1591['options'];}var _0x3b656c=this[_0x7ced('0x35')][_0x7ced('0x52')]('MRCPRecog',_0x10a85a);if(_0x3b656c['result']===-0x1){return _0x3b656c;}var _0x24ac6e=this[_0x7ced('0xa1')](_0x7ced('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x24ac6e[_0x7ced('0xa2')]===-0x1){return _0x24ac6e;}var _0x2e21a8=this[_0x7ced('0xa1')](_0x7ced('0xb2'),_0x7ced('0xcc'));if(_0x2e21a8[_0x7ced('0xa2')]===-0x1){return _0x2e21a8;}var _0x5370c0=this['getAndSetVariable']('RECOG_INSTANCE()',_0x7ced('0xcd'));if(_0x5370c0['result']===-0x1){return _0x5370c0;}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xb4'),_0x10a85a));};AGIVertices[_0x7ced('0x14')]['sestekasr']=function(_0x5178f3){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0xce'),_0x5178f3[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x5178f3[_0x7ced('0xaf')])){return this['channel']['noop'](_0x7ced('0xcf'));}var _0x1adfd4=_0x5178f3[_0x7ced('0xaf')];if(this[_0x7ced('0xaa')](_0x5178f3[_0x7ced('0x75')])){_0x1adfd4+=','+_0x5178f3[_0x7ced('0x75')];}var _0x2fbd75=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x7ced('0xb0'),_0x1adfd4);if(_0x2fbd75[_0x7ced('0xa2')]===-0x1){return _0x2fbd75;}var _0x104934=this[_0x7ced('0xa1')](_0x7ced('0xb1'),_0x7ced('0xd0'));if(_0x104934[_0x7ced('0xa2')]===-0x1){return _0x104934;}var _0x3c9791=this[_0x7ced('0xa1')](_0x7ced('0xb2'),'SESTEK_ASR_TRANSCRIPT');if(_0x3c9791[_0x7ced('0xa2')]===-0x1){return _0x3c9791;}var _0x1c4dd3=this[_0x7ced('0xa1')](_0x7ced('0xb3'),_0x7ced('0xd1'));if(_0x1c4dd3[_0x7ced('0xa2')]===-0x1){return _0x1c4dd3;}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xb4'),_0x1adfd4));};AGIVertices[_0x7ced('0x14')][_0x7ced('0xd2')]=function(_0x5487b3){logger['info'](util['format'](_0x7ced('0xd3'),_0x5487b3[_0x7ced('0xae')]));if(!this['isConfigured'](_0x5487b3['odbc_id'])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x5487b3,_0x7ced('0xd4'));}var _0x4c50b3=this[_0x7ced('0x17')]['sync'](this,_0x5487b3[_0x7ced('0xd5')]);if(!_0x4c50b3){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x5487b3,'no\x20odbc\x20database\x20found');}if(!this[_0x7ced('0xaa')](_0x5487b3['query'])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x5487b3,_0x7ced('0xd6'));}var _0x71c164=_0x5487b3[_0x7ced('0xd7')][_0x7ced('0xd8')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0x7ced('0xd9'),_0x71c164));var _0x33e5df=this['getQueryOdbc'][_0x7ced('0xa5')](this,_0x4c50b3,_0x71c164);this[_0x7ced('0x34')]['sync'](this,_0x5487b3,_0x71c164);if(!this[_0x7ced('0xaa')](_0x5487b3[_0x7ced('0xda')])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0xdb'));}var _0x138281=this['getVariable'][_0x7ced('0xa5')](this,_0x5487b3[_0x7ced('0xda')]);if(!_0x138281){return this['channel'][_0x7ced('0x2b')](_0x5487b3,_0x7ced('0xdc'));}var _0x13c9ed=this;_0x33e5df[_0x7ced('0xdd')](function(_0x241e59,_0x29dede){Object[_0x7ced('0xde')](_0x241e59)['forEach'](function(_0x197a16){_0x13c9ed[_0x7ced('0x35')][_0x7ced('0x9d')](util[_0x7ced('0x28')](_0x7ced('0xdf'),_0x138281,_0x29dede,_0x197a16),_0x241e59[_0x197a16]);});});this[_0x7ced('0x35')]['setVariable'](util[_0x7ced('0x28')](_0x7ced('0xe0'),_0x138281),_0x33e5df[_0x7ced('0x9a')]);return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xe1'),_0x138281));};AGIVertices[_0x7ced('0x14')][_0x7ced('0xe2')]=function(_0xc1b975){logger[_0x7ced('0xe3')](util[_0x7ced('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xc1b975[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0xc1b975['sip_id'])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0xc1b975,_0x7ced('0xe4'));}var _0x180b14=this[_0x7ced('0x1a')]['sync'](this,_0xc1b975['sip_id']);if(!_0x180b14){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0xc1b975,_0x7ced('0xe5'));}var _0x3471be=this[_0x7ced('0x35')][_0x7ced('0x52')]('DIAL',[util[_0x7ced('0x28')](_0x7ced('0xe6'),_0x180b14),_0xc1b975[_0x7ced('0x60')],_0xc1b975[_0x7ced('0xe7')],_0xc1b975[_0x7ced('0x5f')]]);if(_0x3471be[_0x7ced('0xa2')]===-0x1){return _0x3471be;}return this[_0x7ced('0x35')]['noop'](util['format'](_0x7ced('0xe8'),_0x7ced('0xe9')));};AGIVertices['prototype'][_0x7ced('0xea')]=function(_0x58bd05){logger['info'](util[_0x7ced('0x28')](_0x7ced('0xeb'),_0x58bd05['label']));if(!this['isConfigured'](_0x58bd05['key'])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xec'));}if(!this[_0x7ced('0xaa')](_0x58bd05[_0x7ced('0x57')])){return this['channel'][_0x7ced('0xa8')]('no\x20text\x20configured');}this['channel'][_0x7ced('0xed')]=!![];this[_0x7ced('0x34')](_0x58bd05);this['createSquareMessage'](_0x58bd05['text'],'in','','');this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('Trying\x20Dialogflow:\x20%s',_0x58bd05[_0x7ced('0x57')]));var _0x55e292=this[_0x7ced('0x76')][_0x7ced('0xa5')](this,_0x58bd05);if(_0x55e292){for(var _0x1fb18e in _0x55e292){if(_0x55e292[_0x7ced('0x94')](_0x1fb18e)){this[_0x7ced('0x35')][_0x7ced('0x9d')](util[_0x7ced('0x28')](_0x7ced('0xee'),_0x1fb18e[_0x7ced('0x66')]()),_0x55e292[_0x1fb18e]);}}this[_0x7ced('0x3f')](_0x55e292[_0x7ced('0xef')],_0x7ced('0xf0'),_0x7ced('0xea'),'');return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('Dialogflow\x20Result\x20%s',_0x55e292[_0x7ced('0xef')]));}return this['channel'][_0x7ced('0x2b')](_0x58bd05,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x3f4c68){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0xf1'),_0x3f4c68[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x3f4c68[_0x7ced('0x7a')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xf2'));}if(!this['isConfigured'](_0x3f4c68[_0x7ced('0x7b')])){return this[_0x7ced('0x35')]['noop']('no\x20client_email\x20configured');}if(!this[_0x7ced('0xaa')](_0x3f4c68['private_key'])){return this[_0x7ced('0x35')][_0x7ced('0xa8')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3f4c68[_0x7ced('0xf3')])){return this['channel'][_0x7ced('0xa8')](_0x7ced('0xf4'));}if(!this[_0x7ced('0xaa')](_0x3f4c68[_0x7ced('0x57')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xa9'));}this[_0x7ced('0x35')][_0x7ced('0xed')]=!![];this['createSquareDetailsReport'](_0x3f4c68);this[_0x7ced('0x3f')](_0x3f4c68[_0x7ced('0x57')],'in','','');this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x3f4c68['text']));var _0x293dd7=this[_0x7ced('0x79')][_0x7ced('0xa5')](this,_0x3f4c68);if(_0x293dd7){for(var _0x528de in _0x293dd7){if(_0x293dd7[_0x7ced('0x94')](_0x528de)){if(_0x528de!==_0x7ced('0xf5')){this[_0x7ced('0x35')][_0x7ced('0x9d')](util[_0x7ced('0x28')]('DIALOGFLOW_%s',_0x528de[_0x7ced('0x66')]()),_0x293dd7[_0x528de]);}}}this[_0x7ced('0x3f')](_0x293dd7[_0x7ced('0xef')],_0x7ced('0xf0'),_0x7ced('0xf6'),_0x293dd7[_0x7ced('0xf5')]);return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('DialogflowV2\x20Result\x20%s',_0x293dd7[_0x7ced('0xef')]));}return this['channel'][_0x7ced('0x2b')](_0x3f4c68,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x7ced('0x14')][_0x7ced('0xf7')]=function(_0x11cb99){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0xf8'),_0x11cb99['label']));if(!this[_0x7ced('0xaa')](_0x11cb99[_0x7ced('0xf9')])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0xfa'));}if(!this[_0x7ced('0xaa')](_0x11cb99[_0x7ced('0xfb')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xfc'));}if(!this['isConfigured'](_0x11cb99[_0x7ced('0xfd')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')]('no\x20password\x20configured');}if(!this[_0x7ced('0xaa')](_0x11cb99['ndassistant_url'])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xa9'));}this['channel'][_0x7ced('0xed')]=!![];this[_0x7ced('0x34')](_0x11cb99);this['createSquareMessage'](_0x11cb99[_0x7ced('0x57')],'in','','');this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xfe'),_0x11cb99[_0x7ced('0x57')]));var _0xb03dca=this[_0x7ced('0x7d')]['sync'](this,_0x11cb99);if(_0xb03dca){for(var _0x5b6ea0 in _0xb03dca){if(_0xb03dca[_0x7ced('0x94')](_0x5b6ea0)){this['channel'][_0x7ced('0x9d')](util[_0x7ced('0x28')]('SESTEK_NDA_%s',_0x5b6ea0['toUpperCase']()),_0xb03dca[_0x5b6ea0]);}}this[_0x7ced('0x3f')](_0xb03dca[_0x7ced('0xef')],_0x7ced('0xf0'),_0x7ced('0xf7'),'');if(_0xb03dca[_0x7ced('0xff')]){this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x100'),_0xb03dca[_0x7ced('0xff')]));var _0x4752f0=this[_0x7ced('0x35')][_0x7ced('0x101')](_0xb03dca[_0x7ced('0xff')]);try{fs[_0x7ced('0x102')](_0xb03dca['audiofile']+_0x7ced('0x103'));}catch(_0x51bbfc){logger[_0x7ced('0x2b')](_0x51bbfc);}return _0x4752f0;}else{return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('SestekNDA\x20Result\x20%s',_0xb03dca[_0x7ced('0xef')]));}}return this['channel'][_0x7ced('0x2b')](_0x11cb99,_0x7ced('0x104'));};AGIVertices['prototype'][_0x7ced('0x105')]=function(_0x4160ee){logger[_0x7ced('0x2e')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x4160ee[_0x7ced('0xae')]));return this[_0x7ced('0x35')]['noop'](_0x7ced('0x105'));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x106')]=function(_0x4c709d){logger['info'](util[_0x7ced('0x28')](_0x7ced('0x107'),_0x4c709d[_0x7ced('0xae')]));var _0x53c6ff='';if(_0x4c709d[_0x7ced('0x108')]){if(!this[_0x7ced('0xaa')](_0x4c709d[_0x7ced('0x108')])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x4c709d,'no\x20trunk\x20selected');}else{var _0x2ccebe=parseInt(_0x4c709d['trunk_id'],0xa);if(isNaN(_0x2ccebe)){_0x53c6ff=_0x4c709d[_0x7ced('0x108')];}else{_0x53c6ff=this[_0x7ced('0x109')][_0x7ced('0xa5')](this,_0x4c709d[_0x7ced('0x108')]);if(!_0x53c6ff){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x4c709d,_0x7ced('0x10a'));}}}}else if(_0x4c709d[_0x7ced('0x10b')]){_0x53c6ff=_0x4c709d[_0x7ced('0x10b')];}else{return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x4c709d,'no\x20trunk\x20selected');}var _0x3a17c7=this['channel'][_0x7ced('0x52')](_0x7ced('0xe9'),[util[_0x7ced('0x28')](_0x7ced('0x10c'),_0x53c6ff,_0x4c709d[_0x7ced('0x44')]),_0x4c709d[_0x7ced('0x60')],_0x4c709d['opts'],_0x4c709d['url']]);if(_0x3a17c7['result']===-0x1){return _0x3a17c7;}return this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0xe8'),_0x7ced('0xe9')));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x10d')]=function(_0x3150b9){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0x10e'),_0x3150b9[_0x7ced('0xae')]));return this[_0x7ced('0x35')]['noop'](_0x7ced('0x10d'));};AGIVertices['prototype'][_0x7ced('0x10f')]=function(_0x1e9ae1){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x110'),_0x1e9ae1['label']));if(_0x1e9ae1[_0x7ced('0x111')]===0x0){return this[_0x7ced('0xa4')](_0x1e9ae1);}_0x1e9ae1[_0x7ced('0x111')]-=0x1;if(!this[_0x7ced('0xaa')](_0x1e9ae1['file_id'])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x1e9ae1,_0x7ced('0x112'));}var _0x4ff3f1=this['getSound'][_0x7ced('0xa5')](this,_0x1e9ae1[_0x7ced('0x113')]);if(!_0x4ff3f1){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x1e9ae1,_0x7ced('0x114'));}if(!this[_0x7ced('0xaa')](_0x1e9ae1[_0x7ced('0xda')])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x7ced('0xdb'));}var _0x5f48a5=this[_0x7ced('0x35')][_0x7ced('0x115')](_0x4ff3f1,_0x1e9ae1['response'],_0x1e9ae1['maxdigit']);var _0x527438=_0x5f48a5[_0x7ced('0xa2')]?_0x5f48a5[_0x7ced('0xa2')][_0x7ced('0x48')]():'';logger[_0x7ced('0x2e')]('test',JSON[_0x7ced('0x6f')](_0x5f48a5));if(_0x5f48a5[_0x7ced('0xa2')]===-0x1){this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x1e9ae1,_0x527438);return _0x5f48a5;}else if(_0x5f48a5[_0x7ced('0xa3')]===_0x7ced('0x60')){_0x5f48a5[_0x7ced('0xa2')]=_0x527438['length']>=parseInt(_0x1e9ae1['mindigit'])?'x':'i';}else{_0x5f48a5[_0x7ced('0xa2')]=_0x527438[_0x7ced('0x9a')]>=parseInt(_0x1e9ae1[_0x7ced('0x116')])&&_0x527438['length']<=parseInt(_0x1e9ae1[_0x7ced('0x117')])?'x':'i';}var _0x4ad7ad=this[_0x7ced('0xf')][_0x7ced('0xa5')](this,_0x1e9ae1[_0x7ced('0xda')]);if(!_0x4ad7ad){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x1e9ae1,_0x7ced('0xdc'));}this[_0x7ced('0x35')][_0x7ced('0x9d')](_0x4ad7ad,_0x527438);if(this[_0x7ced('0xaa')](_0x1e9ae1[_0x7ced('0x118')])){var _0x8bac7f=parseInt(_0x1e9ae1[_0x7ced('0x118')],0xa);var _0x23f7af=rs[_0x7ced('0x119')]({'charset':'*','length':_0x8bac7f});var _0x1b0332=_0x527438[_0x7ced('0x9a')];if(_0x1b0332>0x0){if(_0x1b0332>_0x8bac7f){this['createSquareDetailsReport']['sync'](this,_0x1e9ae1,_0x1e9ae1['hiddendigitspos']===_0x7ced('0x11a')?_0x23f7af+_0x527438[_0x7ced('0x11b')](_0x8bac7f):_0x527438['substr'](0x0,_0x1b0332-_0x8bac7f)+_0x23f7af);}else{this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x1e9ae1,rs['generate']({'charset':'*','length':_0x1b0332}));}}else{this[_0x7ced('0x34')]['sync'](this,_0x1e9ae1,'');}}else{this[_0x7ced('0x34')]['sync'](this,_0x1e9ae1,_0x527438);}return _0x5f48a5;};AGIVertices[_0x7ced('0x14')]['getsecretdigits']=function(_0xe9b6e0){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x11c'),_0xe9b6e0['label']));return this[_0x7ced('0x10f')](_0xe9b6e0);};AGIVertices[_0x7ced('0x14')][_0x7ced('0x11d')]=function(_0x3133ad){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x11e'),_0x3133ad[_0x7ced('0xae')]));this['createSquareDetailsReport'][_0x7ced('0xa5')](this,_0x3133ad,_0x3133ad[_0x7ced('0x11f')]);return this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format'](_0x7ced('0x120'),_0x3133ad[_0x7ced('0x11f')]));};AGIVertices['prototype'][_0x7ced('0x121')]=function(_0x1b0978){logger['info'](util['format'](_0x7ced('0x122'),_0x1b0978[_0x7ced('0xae')]));if(!this['isConfigured'](_0x1b0978[_0x7ced('0x86')])||!this[_0x7ced('0xaa')](_0x1b0978['aws_secret_access_key'])){return this[_0x7ced('0x35')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x7ced('0xaa')](_0x1b0978['text'])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xa9'));}this[_0x7ced('0x35')]['noop'](util[_0x7ced('0x28')]('Trying\x20aws\x20Polly\x20%s',_0x1b0978[_0x7ced('0x57')]));var _0x41ca9e=this[_0x7ced('0x85')][_0x7ced('0xa5')](this,_0x1b0978);if(_0x41ca9e){this['channel']['noop'](util[_0x7ced('0x28')](_0x7ced('0x123'),_0x41ca9e));var _0x574591=this[_0x7ced('0x35')][_0x7ced('0x101')](_0x41ca9e);try{fs[_0x7ced('0x102')](_0x41ca9e+_0x7ced('0x103'));}catch(_0x5a48c9){logger[_0x7ced('0x2b')](_0x5a48c9);}return _0x574591;}return this[_0x7ced('0x35')]['error'](_0x1b0978,_0x7ced('0x124'));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x125')]=function(_0x560027){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x126'),_0x560027['label']));if(!this[_0x7ced('0xaa')](_0x560027[_0x7ced('0x86')])||!this['isConfigured'](_0x560027[_0x7ced('0x87')])){return this['channel'][_0x7ced('0xa8')](_0x7ced('0x127'));}if(!this['isConfigured'](_0x560027[_0x7ced('0x8d')])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0x128'));}if(!this['isConfigured'](_0x560027[_0x7ced('0x57')])){return this['channel'][_0x7ced('0xa8')](_0x7ced('0xa9'));}this[_0x7ced('0x35')][_0x7ced('0xed')]=!![];this[_0x7ced('0x34')](_0x560027);this[_0x7ced('0x3f')](_0x560027[_0x7ced('0x57')],'in','','');this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x129'),_0x560027[_0x7ced('0x57')]));var _0x1d85fd=this[_0x7ced('0x8b')][_0x7ced('0xa5')](this,_0x560027);if(_0x1d85fd){for(var _0x26df99 in _0x1d85fd){if(_0x1d85fd[_0x7ced('0x94')](_0x26df99)&&_[_0x7ced('0x95')](_0x1d85fd[_0x26df99])){this['channel']['setVariable'](util[_0x7ced('0x28')](_0x7ced('0x12a'),_0x26df99[_0x7ced('0x66')]()),_0x1d85fd[_0x26df99]);}}if(_['isNil'](_0x1d85fd['message'])){return this[_0x7ced('0x35')][_0x7ced('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x1d85fd[_0x7ced('0x73')],_0x7ced('0xf0'),_0x7ced('0x12b'),'');return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x12c'),_0x1d85fd[_0x7ced('0x73')]));}}return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x560027,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x7ced('0x14')][_0x7ced('0x12d')]=function(_0xa83b0f){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0x12e'),_0xa83b0f[_0x7ced('0xae')],_0xa83b0f[_0x7ced('0x60')]));if(!this[_0x7ced('0xaa')](_0xa83b0f[_0x7ced('0x77')])){return this['channel'][_0x7ced('0xa8')]('no\x20key\x20configured');}var _0x451ad8=_0x7ced('0x12f');var _0x5cbb45=util[_0x7ced('0x28')](_0x7ced('0x130'),FILES_PATH,rs[_0x7ced('0x119')](0x4));var _0x3a1594=util[_0x7ced('0x28')]('%s.%s',_0x5cbb45,_0x451ad8);var _0x131d7a=!![];if(_0xa83b0f[_0x7ced('0x131')]==='NOBEEP'){_0x131d7a=![];}var _0x2f5a41=this[_0x7ced('0x35')][_0x7ced('0x132')](_0x5cbb45,_0x451ad8,_0xa83b0f[_0x7ced('0x133')],_0xa83b0f[_0x7ced('0x60')],undefined,_0x131d7a);if(_0x2f5a41[_0x7ced('0xa2')]!==-0x1){this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')]('google\x20%s\x20file\x20created',_0x3a1594));var _0x26553d=this[_0x7ced('0x8e')]['sync'](this,_0xa83b0f,_0x3a1594);if(_0x26553d){for(var _0x19f249 in _0x26553d){if(_0x26553d[_0x7ced('0x94')](_0x19f249)){this[_0x7ced('0x35')]['setVariable'](util['format'](_0x7ced('0x134'),_0x19f249[_0x7ced('0x66')]()),_0x26553d[_0x19f249]);}}return this[_0x7ced('0x35')]['noop'](util[_0x7ced('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x7ced('0x6f')](_0x26553d)));}}return _0x2f5a41;};AGIVertices['prototype'][_0x7ced('0x135')]=function(_0x32bb67){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x32bb67['label']));if(!this[_0x7ced('0xaa')](_0x32bb67[_0x7ced('0x91')])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0x136'));}if(!this[_0x7ced('0xaa')](_0x32bb67[_0x7ced('0x137')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0x138'));}var _0x46aad2=_0x7ced('0x12f');var _0x50c8fa=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x47d368=util[_0x7ced('0x28')](_0x7ced('0x9c'),_0x50c8fa,_0x46aad2);var _0x419e70=!![];if(_0x32bb67[_0x7ced('0x131')]===_0x7ced('0x139')){_0x419e70=![];}var _0x2dbefa=this[_0x7ced('0x35')][_0x7ced('0x132')](_0x50c8fa,_0x46aad2,_0x32bb67[_0x7ced('0x133')],_0x32bb67[_0x7ced('0x60')],undefined,_0x419e70);if(_0x2dbefa['result']!==-0x1){this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x13a'),_0x47d368));var _0x3e5040=this['tildeASR']['sync'](this,_0x32bb67,_0x47d368);if(_0x3e5040){for(var _0x1adf4f in _0x3e5040){if(_0x3e5040[_0x7ced('0x94')](_0x1adf4f)){this[_0x7ced('0x35')][_0x7ced('0x9d')](util[_0x7ced('0x28')](_0x7ced('0x13b'),_0x1adf4f[_0x7ced('0x66')]()),_0x3e5040[_0x1adf4f]);}}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('TildeASR\x20Result\x20%s',JSON[_0x7ced('0x6f')](_0x3e5040)));}}return _0x2dbefa;};AGIVertices['prototype']['gotoc']=function(_0x2e05c6){logger['info'](util[_0x7ced('0x28')](_0x7ced('0x13c'),_0x2e05c6[_0x7ced('0xae')]));return this['channel'][_0x7ced('0x13d')](_0x2e05c6['context'],_0x2e05c6['extension'],_0x2e05c6[_0x7ced('0x13e')]);};AGIVertices[_0x7ced('0x14')][_0x7ced('0x13f')]=function(_0x333da9){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x140'),_0x333da9[_0x7ced('0xae')]));if(!this['isConfigured'](_0x333da9[_0x7ced('0x141')])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x333da9,'no\x20condition\x20configured');}try{var _0x5aeb79=eval(_0x333da9[_0x7ced('0x141')])?_0x7ced('0x142'):_0x7ced('0x143');this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x144'),_0x333da9[_0x7ced('0x141')],_0x5aeb79));return{'code':0xc8,'result':_0x5aeb79};}catch(_0x1e238c){return{'code':0xc8,'result':_0x7ced('0x143')};}};AGIVertices[_0x7ced('0x14')][_0x7ced('0x145')]=function(_0x29376f){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x146'),_0x29376f[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x29376f[_0x7ced('0x147')])){return this['channel'][_0x7ced('0x2b')](_0x29376f,'no\x20interval\x20configured');}var _0x1cee58=this['getIntervals']['sync'](this,_0x29376f[_0x7ced('0x147')]);if(!_0x1cee58){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x29376f,_0x7ced('0x148'));}for(var _0x1d0683=0x0;_0x1d0683<_0x1cee58['length'];_0x1d0683+=0x1){var _0x2d2374=this[_0x7ced('0x35')][_0x7ced('0xf')](util[_0x7ced('0x28')](_0x7ced('0x149'),_0x1cee58[_0x1d0683]));if(_0x2d2374[_0x7ced('0xa2')]===-0x1){return _0x2d2374;}logger['info'](util[_0x7ced('0x28')]('IFTIME\x20%s\x20%s',_0x1cee58[_0x1d0683],_0x2d2374[_0x7ced('0xa3')]));if(_0x2d2374[_0x7ced('0xa3')]===_0x7ced('0x142')){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x14a'),_0x1cee58[_0x1d0683],'true'));this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format']('IFTIME\x20%s\x20%s',_0x1cee58[_0x1d0683],_0x7ced('0x142')));return{'code':0xc8,'result':_0x7ced('0x142')};}else{logger['info'](util[_0x7ced('0x28')](_0x7ced('0x14a'),_0x1cee58[_0x1d0683],'false'));this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x14a'),_0x1cee58[_0x1d0683],_0x7ced('0x143')));}}return{'code':0xc8,'result':_0x7ced('0x143')};};AGIVertices[_0x7ced('0x14')][_0x7ced('0x14b')]=function(_0x21bd71){logger['info'](util[_0x7ced('0x28')](_0x7ced('0x14c'),_0x21bd71['label']));return this[_0x7ced('0x35')][_0x7ced('0x14b')]();};AGIVertices[_0x7ced('0x14')][_0x7ced('0x14d')]=function(_0x18ff2f){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x18ff2f[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x18ff2f[_0x7ced('0x77')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xec'));}var _0x5e6693='wav';var _0x3290e7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x7ced('0x119')](0x4));var _0x5e66c6=util['format'](_0x7ced('0x9c'),_0x3290e7,_0x5e6693);var _0x33f149=!![];if(_0x18ff2f['beep']===_0x7ced('0x139')){_0x33f149=![];}var _0xcb1237=this[_0x7ced('0x35')][_0x7ced('0x132')](_0x3290e7,_0x5e6693,_0x18ff2f['intKey'],_0x18ff2f['timeout'],undefined,_0x33f149);if(_0xcb1237[_0x7ced('0xa2')]!==-0x1){this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x14e'),_0x5e66c6));var _0x49b2fb=this[_0x7ced('0x81')][_0x7ced('0xa5')](this,_0x18ff2f,_0x5e66c6);if(_0x49b2fb){for(var _0xd53f0e in _0x49b2fb){if(_0x49b2fb[_0x7ced('0x94')](_0xd53f0e)){this[_0x7ced('0x35')]['setVariable'](util[_0x7ced('0x28')](_0x7ced('0x14f'),_0xd53f0e[_0x7ced('0x66')]()),_0x49b2fb[_0xd53f0e]);}}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x49b2fb)));}}return _0xcb1237;};AGIVertices[_0x7ced('0x14')][_0x7ced('0x150')]=function(_0xd829ad){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0x151'),_0xd829ad[_0x7ced('0xae')]));if(!this['isConfigured'](_0xd829ad['key'])){return this['channel'][_0x7ced('0xa8')](_0x7ced('0xec'));}if(!this['isConfigured'](_0xd829ad['text'])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0xa9'));}this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x152'),_0xd829ad['text']));var _0x4af8fe=this[_0x7ced('0x7e')][_0x7ced('0xa5')](this,_0xd829ad);if(_0x4af8fe){this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('ispeech\x20%s\x20file\x20created',_0x4af8fe));var _0x54b21e=this['channel'][_0x7ced('0x101')](_0x4af8fe,_0xd829ad['intKey']);try{fs[_0x7ced('0x102')](_0x4af8fe+_0x7ced('0x103'));}catch(_0x54e7f4){logger[_0x7ced('0x2b')](_0x54e7f4);}return _0x54b21e;}return this['channel'][_0x7ced('0x2b')](_0xd829ad,_0x7ced('0x153'));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x154')]=function(_0xf04f06){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xf04f06['label']));if(!this[_0x7ced('0xaa')](_0xf04f06[_0x7ced('0x155')])){return this['channel'][_0x7ced('0x2b')](_0xf04f06,_0x7ced('0x156'));}logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x157'),this[_0x7ced('0x35')][_0x7ced('0x3a')],_0xf04f06[_0x7ced('0x155')]));var _0x499ce0=this[_0x7ced('0x158')]['sync'](this,_0xf04f06[_0x7ced('0x155')]);if(_0x499ce0){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x159'),this[_0x7ced('0x35')]['callerid'],_0xf04f06[_0x7ced('0x155')]));this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x159'),this[_0x7ced('0x35')][_0x7ced('0x3a')],_0xf04f06['findBy']));return{'code':0xc8,'result':_0x7ced('0x15a')};}else{logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x15b'),this[_0x7ced('0x35')][_0x7ced('0x3a')],_0xf04f06[_0x7ced('0x155')]));this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7ced('0x35')]['callerid'],_0xf04f06[_0x7ced('0x155')]));return{'code':0xc8,'result':_0x7ced('0x15c')};}};AGIVertices[_0x7ced('0x14')]['logout']=function(_0x1fbe88){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1fbe88['label']));if(!this[_0x7ced('0xaa')](_0x1fbe88[_0x7ced('0x155')])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x1fbe88,'no\x20find\x20by\x20configured');}logger[_0x7ced('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x7ced('0x3a')],_0x1fbe88[_0x7ced('0x155')]));var _0x5cbfad=this['agentLogout'][_0x7ced('0xa5')](this,_0x1fbe88[_0x7ced('0x155')]);if(_0x5cbfad){logger['info'](util[_0x7ced('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1fbe88['findBy']));this['channel']['noop'](util[_0x7ced('0x28')](_0x7ced('0x159'),this['channel'][_0x7ced('0x3a')],_0x1fbe88[_0x7ced('0x155')]));return{'code':0xc8,'result':_0x7ced('0x15a')};}else{logger[_0x7ced('0x2e')](util['format'](_0x7ced('0x15b'),this['channel']['callerid'],_0x1fbe88[_0x7ced('0x155')]));this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format'](_0x7ced('0x15b'),this['channel'][_0x7ced('0x3a')],_0x1fbe88[_0x7ced('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7ced('0x14')][_0x7ced('0x15d')]=function(_0x28f814){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x28f814[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x28f814[_0x7ced('0x15e')])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x28f814,_0x7ced('0x15f'));}this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format'](_0x7ced('0x160'),_0x28f814[_0x7ced('0x15e')]));var _0x5d8103=eval(_0x28f814[_0x7ced('0x15e')]);if(!this[_0x7ced('0xaa')](_0x28f814[_0x7ced('0xda')])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0xdb'));}var _0x364450=this[_0x7ced('0xf')][_0x7ced('0xa5')](this,_0x28f814['variable_id']);if(!_0x364450){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x28f814,_0x7ced('0xdc'));}if(_[_0x7ced('0x99')](_0x5d8103)){var _0x41570c=this;_0x5d8103['forEach'](function(_0x3d6373,_0x3b4a96){_0x41570c['channel'][_0x7ced('0x9d')](util[_0x7ced('0x28')](_0x7ced('0x161'),_0x364450,_0x3b4a96),_0x3d6373);});return this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format'](_0x7ced('0x162'),_0x364450));}else{return this[_0x7ced('0x35')][_0x7ced('0x9d')](_0x364450,_0x5d8103);}};AGIVertices[_0x7ced('0x14')][_0x7ced('0xb')]=function(_0x51f478){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x51f478[_0x7ced('0xae')]));if(_0x51f478[_0x7ced('0x111')]===0x0){return this[_0x7ced('0xa4')](_0x51f478);}_0x51f478[_0x7ced('0x111')]-=0x1;if(!this[_0x7ced('0xaa')](_0x51f478[_0x7ced('0x113')])){return this['channel'][_0x7ced('0x2b')](_0x51f478,_0x7ced('0x112'));}var _0x1af983=this[_0x7ced('0x163')][_0x7ced('0xa5')](this,_0x51f478[_0x7ced('0x113')]);if(!_0x1af983){return this['channel'][_0x7ced('0x2b')](_0x51f478,_0x7ced('0x114'));}var _0x39df73=this[_0x7ced('0x35')][_0x7ced('0x115')](_0x1af983,_0x51f478[_0x7ced('0x164')],_0x51f478['digit']);var _0x506ac4=_0x39df73['result'];if(_0x39df73[_0x7ced('0xa2')]===-0x1){this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x51f478,'-1');return _0x39df73;}else if(_0x39df73[_0x7ced('0xa3')]===_0x7ced('0x60')){_0x39df73[_0x7ced('0xa2')]=_0x39df73[_0x7ced('0xa2')][_0x7ced('0x9a')]>0x0?_0x39df73[_0x7ced('0xa2')]:'t';}else if(_[_0x7ced('0x40')](_0x39df73[_0x7ced('0xa2')])){_0x39df73[_0x7ced('0xa2')]='#';_0x506ac4='#';}if(!this[_0x7ced('0xaa')](_0x51f478[_0x7ced('0xda')])){this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0xdb'));}else{var _0x26f875=this[_0x7ced('0xf')]['sync'](this,_0x51f478[_0x7ced('0xda')]);if(!_0x26f875){return this[_0x7ced('0x35')]['error'](_0x51f478,_0x7ced('0xdc'));}this[_0x7ced('0x35')][_0x7ced('0x9d')](_0x26f875,_0x506ac4);}this[_0x7ced('0x34')]['sync'](this,_0x51f478,_0x506ac4);return _0x39df73;};AGIVertices[_0x7ced('0x14')]['noop']=function(_0x14610b){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x165'),_0x14610b[_0x7ced('0xae')]));return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x14610b[_0x7ced('0x166')]||_0x14610b['label']);};AGIVertices[_0x7ced('0x14')][_0x7ced('0x167')]=function(_0xdec662){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xdec662[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0xdec662['findBy'])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0xdec662,_0x7ced('0x156'));}logger['info'](util[_0x7ced('0x28')](_0x7ced('0x157'),this[_0x7ced('0x35')][_0x7ced('0x3a')],_0xdec662[_0x7ced('0x155')]));var _0x15b4a2=this[_0x7ced('0x49')]['sync'](this,_0xdec662[_0x7ced('0x168')]);var _0x39a383=this[_0x7ced('0x4a')][_0x7ced('0xa5')](this,_0xdec662[_0x7ced('0x155')],_0x15b4a2);if(_0x39a383){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7ced('0x35')][_0x7ced('0x3a')],_0xdec662[_0x7ced('0x155')]));this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x159'),this['channel'][_0x7ced('0x3a')],_0xdec662[_0x7ced('0x155')]));return{'code':0xc8,'result':_0x7ced('0x15a')};}else{logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x15b'),this['channel'][_0x7ced('0x3a')],_0xdec662[_0x7ced('0x155')]));this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format'](_0x7ced('0x159'),this[_0x7ced('0x35')]['callerid'],_0xdec662['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7ced('0x14')]['playback']=function(_0x59ba7b){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x59ba7b[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x59ba7b[_0x7ced('0x113')])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x59ba7b,_0x7ced('0x112'));}var _0x47e02d=this['getSound'][_0x7ced('0xa5')](this,_0x59ba7b[_0x7ced('0x113')]);if(!_0x47e02d){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x59ba7b,'no\x20file\x20audio\x20found');}var _0x2e4204=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x7ced('0x169'),[_0x47e02d,_0x59ba7b['opts']]);if(_0x2e4204[_0x7ced('0xa2')]===-0x1){return _0x2e4204;}return this['channel'][_0x7ced('0xa8')](util['format'](_0x7ced('0xc5'),'PLAYBACK',_0x47e02d));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x16a')]=function(_0x93c385){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x16b'),_0x93c385[_0x7ced('0xae')]));if(!this['isConfigured'](_0x93c385[_0x7ced('0x16c')])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x93c385,_0x7ced('0x16d'));}var _0xc43cf8='';var _0xcb432=parseInt(_0x93c385[_0x7ced('0x16c')],0xa);if(isNaN(_0xcb432)){_0xc43cf8=_0x93c385[_0x7ced('0x16c')];}else{_0xc43cf8=this[_0x7ced('0x16e')][_0x7ced('0xa5')](this,_0x93c385[_0x7ced('0x16c')]);if(!_0xc43cf8){return this[_0x7ced('0x35')]['error'](_0x93c385,_0x7ced('0x16f'));}}var _0x54bebf='';if(this[_0x7ced('0xaa')](_0x93c385['file_id'])){var _0x4f6563=this['getSound'][_0x7ced('0xa5')](this,_0x93c385[_0x7ced('0x113')]);if(_0x4f6563){_0x54bebf=_0x4f6563;}}this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x93c385,_0xc43cf8);if(_0x93c385[_0x7ced('0xe7')][_0x7ced('0x170')]('x')<0x0){_0x93c385[_0x7ced('0xe7')]+='x';}if(_0x93c385['opts']['indexOf']('X')<0x0){_0x93c385[_0x7ced('0xe7')]+='X';}this[_0x7ced('0x35')][_0x7ced('0x9d')](_0x7ced('0x171'),_0xc43cf8?_0xc43cf8['toLowerCase']():'');var _0x358c3b=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x7ced('0x172'),[_0xc43cf8,_0x93c385[_0x7ced('0xe7')],_0x93c385[_0x7ced('0x5f')],_0x54bebf,_0x93c385[_0x7ced('0x60')],_0x93c385[_0x7ced('0xb5')],_0x93c385['macro'],_0x93c385[_0x7ced('0x173')],'',_0x93c385['position']]);if(_0x358c3b[_0x7ced('0xa2')]===-0x1){return _0x358c3b;}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('Executed\x20command\x20%s\x20%s',_0x7ced('0x172'),_0xc43cf8));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x174')]=function(_0x3f628a){logger[_0x7ced('0x2e')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3f628a[_0x7ced('0xae')]));var _0x24daa7=_0x3f628a[_0x7ced('0x175')]||_0x7ced('0x12f');var _0x4f151a=util[_0x7ced('0x28')](_0x7ced('0x176'),this[_0x7ced('0x35')][_0x7ced('0x36')],rs[_0x7ced('0x119')](0x5));var _0x1f2140=util['format'](_0x7ced('0x177'),FILES_PATH,_0x4f151a,_0x24daa7);var _0x5866cf=util['format'](_0x7ced('0x130'),FILES_PATH,_0x4f151a);this[_0x7ced('0x39')][_0x7ced('0xa5')](this,_0x3f628a,_0x4f151a,_0x1f2140);this[_0x7ced('0x35')]['setVariable'](_0x7ced('0x178'),_0x4f151a);logger[_0x7ced('0x2e')](_0x7ced('0x179'),_0x5866cf,_0x24daa7,_0x3f628a[_0x7ced('0x17a')],_0x3f628a[_0x7ced('0x60')]);return this['channel'][_0x7ced('0x132')](_0x5866cf,_0x24daa7,_0x3f628a[_0x7ced('0x17a')],_0x3f628a[_0x7ced('0x60')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x4aa70f){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4aa70f[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x4aa70f[_0x7ced('0x5f')])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0x17b'));}var _0x3e2cbd=this[_0x7ced('0x5e')][_0x7ced('0xa5')](this,_0x4aa70f);logger['info'](util['format'](_0x7ced('0x17c'),util[_0x7ced('0x17d')](_0x3e2cbd,{'showHidden':![],'depth':null})));if(!this[_0x7ced('0xaa')](_0x4aa70f[_0x7ced('0xda')])){return this['channel']['noop'](_0x7ced('0x17e'));}var _0x2112f3=this[_0x7ced('0xf')][_0x7ced('0xa5')](this,_0x4aa70f[_0x7ced('0xda')]);if(!_0x2112f3){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x4aa70f,_0x7ced('0xdc'));}this[_0x7ced('0x35')]['setVariable'](util[_0x7ced('0x28')](_0x7ced('0x17f'),_0x2112f3),_0x3e2cbd[_0x7ced('0x72')]?_0x3e2cbd[_0x7ced('0x72')]:'200');this[_0x7ced('0x35')][_0x7ced('0x9d')](util[_0x7ced('0x28')](_0x7ced('0x180'),_0x2112f3),_0x3e2cbd['statusMessage']?_0x3e2cbd['statusMessage']:'OK');if(_0x3e2cbd[_0x7ced('0x67')]){try{this['saveRestApiResult'](_0x3e2cbd['body'],_0x2112f3);}catch(_0x5556bc){logger[_0x7ced('0x2b')](util[_0x7ced('0x28')](_0x7ced('0x181'),_0x2112f3));}}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')]('variable\x20%s\x20set',_0x2112f3));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x182')]=function(_0x13511b){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x183'),_0x13511b[_0x7ced('0xae')]));return this[_0x7ced('0x35')][_0x7ced('0x184')](_0x13511b[_0x7ced('0x185')]['replace'](/\s+/g,''),_0x13511b[_0x7ced('0x17a')]);};AGIVertices[_0x7ced('0x14')]['saynumber']=function(_0x5ac8ef){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x186'),_0x5ac8ef[_0x7ced('0xae')]));return this[_0x7ced('0x35')]['sayNumber'](_0x5ac8ef[_0x7ced('0x61')][_0x7ced('0xd8')](/\s+/g,''),_0x5ac8ef['escape_digits']);};AGIVertices[_0x7ced('0x14')]['sayphonetic']=function(_0x41a8a8){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0x187'),_0x41a8a8[_0x7ced('0xae')]));return this[_0x7ced('0x35')][_0x7ced('0x188')](_0x41a8a8[_0x7ced('0x57')],_0x41a8a8[_0x7ced('0x17a')]);};AGIVertices[_0x7ced('0x14')]['sendMail']=function(_0x4cc12d){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0x189'),_0x4cc12d[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x4cc12d[_0x7ced('0x18a')])){return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0x18b'));}var _0x5c5bfb=this[_0x7ced('0x18c')][_0x7ced('0xa5')](this,_0x4cc12d['account_id']);if(!_0x5c5bfb||!_0x5c5bfb['Smtp']){return this[_0x7ced('0x35')]['error'](_0x4cc12d,_0x7ced('0x18d'));}var _0x36d958={'from':util['format'](_0x7ced('0x18e'),_0x5c5bfb[_0x7ced('0x13')],_0x5c5bfb[_0x7ced('0x18f')]||_0x5c5bfb[_0x7ced('0x190')][_0x7ced('0x191')]),'to':_0x4cc12d['to']||'','cc':_0x4cc12d['cc']||'','bcc':_0x4cc12d[_0x7ced('0x192')]||'','subject':_0x4cc12d['subject'],'html':_0x4cc12d[_0x7ced('0x57')],'text':_0x4cc12d[_0x7ced('0x57')]};var _0x45e6b1={'tls':{'rejectUnauthorized':![]}};if(_0x5c5bfb['Smtp'][_0x7ced('0x193')]){_0x45e6b1['service']=_0x5c5bfb[_0x7ced('0x190')][_0x7ced('0x193')];}else{_0x45e6b1['host']=_0x5c5bfb[_0x7ced('0x190')]['host'];_0x45e6b1['port']=_0x5c5bfb['Smtp']['port'];_0x45e6b1[_0x7ced('0x194')]=_0x5c5bfb[_0x7ced('0x190')][_0x7ced('0x194')];}if(_0x5c5bfb[_0x7ced('0x190')]['authentication']){_0x45e6b1[_0x7ced('0x195')]={'user':_0x5c5bfb[_0x7ced('0x190')][_0x7ced('0x191')],'pass':_0x5c5bfb[_0x7ced('0x190')][_0x7ced('0x196')]};}if(this[_0x7ced('0xaa')](_0x4cc12d[_0x7ced('0x197')])){}logger[_0x7ced('0xe3')]('sendMail\x20message',JSON['stringify'](_0x36d958));this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x4cc12d,_0x4cc12d[_0x7ced('0x18a')]);this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x5c5bfb[_0x7ced('0x13')]));this[_0x7ced('0x20')][_0x7ced('0xa5')](this,_0x45e6b1,_0x36d958);return this['channel'][_0x7ced('0xa8')](_0x7ced('0x198'));};AGIVertices['prototype'][_0x7ced('0x199')]=function(_0xae16d6){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x19a'),_0xae16d6[_0x7ced('0xae')]));return this[_0x7ced('0x35')][_0x7ced('0xa8')](_0x7ced('0x19b'));};AGIVertices['prototype'][_0x7ced('0x19c')]=function(_0x243e50){logger['info'](util[_0x7ced('0x28')](_0x7ced('0x19d'),_0x243e50[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x243e50[_0x7ced('0x19e')])){return this[_0x7ced('0x35')]['noop'](_0x7ced('0x19f'));}var _0x174c9d=this[_0x7ced('0x31')][_0x7ced('0xa5')](this,_0x243e50['sms_account_id']);if(!_0x174c9d){return this['channel'][_0x7ced('0x2b')](_0x243e50,'no\x20sms\x20account\x20found');}var _0x3cf604={'body':_0x243e50['sms_text'],'phone':_0x243e50['to']||'','SmsAccountId':_0x174c9d['id']};logger['debug']('sendSMS\x20message',JSON[_0x7ced('0x6f')](_0x3cf604));this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x243e50,_0x243e50[_0x7ced('0x19e')]);this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x1a0'),_0x174c9d[_0x7ced('0x13')]));this[_0x7ced('0x33')]['sync'](this,_0x3cf604);return this['channel'][_0x7ced('0xa8')](_0x7ced('0x1a1'));};AGIVertices['prototype'][_0x7ced('0x1a2')]=function(_0x26a766){logger[_0x7ced('0x2e')](util['format'](_0x7ced('0x1a3'),_0x26a766[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x26a766['variable_id'])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x26a766,_0x7ced('0x1a4'));}var _0x15c188=this['getVariable'][_0x7ced('0xa5')](this,_0x26a766[_0x7ced('0xda')]);if(!_0x15c188){return this['channel'][_0x7ced('0x2b')](_0x26a766,_0x7ced('0xdc'));}return this[_0x7ced('0x35')][_0x7ced('0x9d')](_0x15c188,_0x26a766['variable_value']);};AGIVertices[_0x7ced('0x14')][_0x7ced('0x1a5')]=function(_0x1ff9bb){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x1a6'),_0x1ff9bb['label']));this['channel'][_0x7ced('0xa8')]('START\x20CALLY\x20SQUARE');if(_0x1ff9bb[_0x7ced('0xba')]===_0x7ced('0x1a7')){this['channel'][_0x7ced('0xa8')](_0x7ced('0x1a8'));return this['channel'][_0x7ced('0xba')]();}return this[_0x7ced('0x35')]['noop'](_0x7ced('0x1a9'));};AGIVertices['prototype'][_0x7ced('0x1aa')]=function(_0x589415){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x1ab'),_0x589415[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x589415[_0x7ced('0x1ac')])){return this[_0x7ced('0x35')]['error'](_0x589415,_0x7ced('0x1ad'));}var _0x5dbc5b=this[_0x7ced('0x15')]['sync'](this,_0x589415['project_id']);if(!this[_0x7ced('0xaa')](_0x5dbc5b)){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x589415,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x589415['project_id']));}if(_0x5dbc5b===this[_0x7ced('0x35')][_0x7ced('0x38')]){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x589415,_0x7ced('0x1ae'));}this[_0x7ced('0x34')]['sync'](this,_0x589415,_0x5dbc5b);var _0x5855e8=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x7ced('0x1af'),util[_0x7ced('0x28')](_0x7ced('0x1b0'),config[_0x7ced('0xb5')][_0x7ced('0x1b1')]||'127.0.0.1',_0x5dbc5b,this[_0x7ced('0x35')]['arg_1']));if(_0x5855e8[_0x7ced('0xa2')]===-0x1){return _0x5855e8;}return this['channel']['noop'](util[_0x7ced('0x28')](_0x7ced('0xc5'),'AGI',_0x5dbc5b));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x1b2')]=function(_0x3e53e3){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x1b3'),_0x3e53e3[_0x7ced('0xae')]));var _0x28b87e=this[_0x7ced('0x1b4')][_0x7ced('0xa5')](this,_0x3e53e3[_0x7ced('0x1b5')]);this[_0x7ced('0x34')][_0x7ced('0xa5')](this,_0x3e53e3,_0x3e53e3[_0x7ced('0x1b5')]);if(this[_0x7ced('0xaa')](_0x3e53e3['variable_id'])){var _0x57f0c9=this[_0x7ced('0xf')][_0x7ced('0xa5')](this,_0x3e53e3[_0x7ced('0xda')]);if(_0x57f0c9){this[_0x7ced('0x35')][_0x7ced('0x9d')](_0x57f0c9,_0x28b87e);return this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x1b6'),_0x3e53e3['command'],_0x57f0c9));}}return this[_0x7ced('0x35')][_0x7ced('0xa8')](util['format'](_0x7ced('0x1b7'),_0x3e53e3[_0x7ced('0x1b5')]));};AGIVertices[_0x7ced('0x14')]['google_cloud_tts']=function(_0xb7a098){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x1b8'),_0xb7a098['label']));_0xb7a098[_0x7ced('0x57')]=_0xb7a098[_0x7ced('0x57')][_0x7ced('0xd8')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7ced('0xaa')](_0xb7a098[_0x7ced('0x55')])){return this['channel'][_0x7ced('0xa8')](_0x7ced('0x1b9'));}if(!this[_0x7ced('0xaa')](_0xb7a098['text'])){return this['channel'][_0x7ced('0xa8')](_0x7ced('0xa9'));}this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x1ba'),_0xb7a098['text']));var _0x2b380a=this[_0x7ced('0x54')][_0x7ced('0xa5')](this,_0xb7a098);if(_0x2b380a){this['channel'][_0x7ced('0xa8')](util[_0x7ced('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2b380a));var _0x47c98c=this[_0x7ced('0x35')][_0x7ced('0x101')](_0x2b380a);try{fs[_0x7ced('0x102')](_0x2b380a+'.wav');}catch(_0x9edc44){logger[_0x7ced('0x2b')](_0x9edc44);}return _0x47c98c;}return this['channel'][_0x7ced('0x2b')](_0xb7a098,_0x7ced('0x1bb'));};AGIVertices[_0x7ced('0x14')][_0x7ced('0x1bc')]=function(_0x21d10d){logger['info'](util[_0x7ced('0x28')](_0x7ced('0x1bd'),_0x21d10d[_0x7ced('0xae')]));_0x21d10d['text']=_0x21d10d['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7ced('0xaa')](_0x21d10d[_0x7ced('0x57')])){return this['channel'][_0x7ced('0xa8')](_0x7ced('0xa9'));}this['channel'][_0x7ced('0xa8')](util['format'](_0x7ced('0x1be'),_0x21d10d[_0x7ced('0x57')]));var _0x210c44=this['googleTTS'][_0x7ced('0xa5')](this,_0x21d10d);if(_0x210c44){this['channel'][_0x7ced('0xa8')](util['format'](_0x7ced('0x1bf'),_0x210c44));var _0x4c425e=this[_0x7ced('0x35')][_0x7ced('0x101')](_0x210c44);try{fs[_0x7ced('0x102')](_0x210c44+_0x7ced('0x103'));}catch(_0x585916){logger[_0x7ced('0x2b')](_0x585916);}return _0x4c425e;}return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x21d10d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7ced('0x14')][_0x7ced('0x1c0')]=function(_0x355db0){logger['info'](util[_0x7ced('0x28')](_0x7ced('0x1c1'),_0x355db0[_0x7ced('0xae')]));if(!this[_0x7ced('0xaa')](_0x355db0['findBy'])){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x355db0,_0x7ced('0x156'));}logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x157'),this[_0x7ced('0x35')][_0x7ced('0x3a')],_0x355db0[_0x7ced('0x155')]));var _0x545a21=this['agentUnpause'][_0x7ced('0xa5')](this,_0x355db0[_0x7ced('0x155')]);if(_0x545a21){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7ced('0x35')]['callerid'],_0x355db0['findBy']));this[_0x7ced('0x35')][_0x7ced('0xa8')](util[_0x7ced('0x28')](_0x7ced('0x159'),this['channel']['callerid'],_0x355db0[_0x7ced('0x155')]));return{'code':0xc8,'result':_0x7ced('0x15a')};}else{logger['info'](util[_0x7ced('0x28')](_0x7ced('0x15b'),this[_0x7ced('0x35')][_0x7ced('0x3a')],_0x355db0['findBy']));this[_0x7ced('0x35')]['noop'](util[_0x7ced('0x28')](_0x7ced('0x15b'),this[_0x7ced('0x35')][_0x7ced('0x3a')],_0x355db0[_0x7ced('0x155')]));return{'code':0xc8,'result':_0x7ced('0x15c')};}};AGIVertices[_0x7ced('0x14')]['voicemail']=function(_0x17f5eb){logger['info'](util[_0x7ced('0x28')](_0x7ced('0x1c2'),_0x17f5eb[_0x7ced('0xae')]));var _0x945e98=this[_0x7ced('0x35')][_0x7ced('0x52')](_0x7ced('0x1c3'),[_0x17f5eb[_0x7ced('0x1c4')],_0x17f5eb['options']]);if(_0x945e98['result']===-0x1){return _0x945e98;}return this['channel']['noop'](util[_0x7ced('0x28')](_0x7ced('0xc5'),_0x7ced('0x1c3'),_0x17f5eb[_0x7ced('0x1c4')]));};AGIVertices['prototype'][_0x7ced('0x1c5')]=function(_0x721abf){logger[_0x7ced('0x2e')](util[_0x7ced('0x28')](_0x7ced('0x1c6'),_0x721abf['label']));if(!this[_0x7ced('0xaa')](_0x721abf[_0x7ced('0xda')])){return this[_0x7ced('0x35')]['error'](_0x721abf,_0x7ced('0x1a4'));}var _0x510f64=this[_0x7ced('0xf')][_0x7ced('0xa5')](this,_0x721abf[_0x7ced('0xda')]);if(!_0x510f64){return this[_0x7ced('0x35')][_0x7ced('0x2b')](_0x721abf,'no\x20variable\x20found');}var _0x294ede=this[_0x7ced('0x35')][_0x7ced('0xf')](_0x510f64);return{'code':0xc8,'result':_0x294ede[_0x7ced('0xa3')]?_0x294ede[_0x7ced('0xa3')]:'-'};};String['prototype'][_0x7ced('0xa0')]=function(_0x40d175,_0x25c63a){return this['split'](_0x40d175)[_0x7ced('0x1c7')](_0x25c63a);};module['exports']=AGIVertices; \ No newline at end of file +var _0xb77b=['Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','sms_text','sendSMS\x20message','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','replaceAll','join','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','name','getVoiceQueue','then','getSquareProject','getSquareProjectById','catch','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','%s/sounds/converted/%s','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','close','error','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','headers','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','callback','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','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','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb77b,0x80));var _0xbb77=function(_0x28f897,_0x5be0d4){_0x28f897=_0x28f897-0x0;var _0x2e95e9=_0xb77b[_0x28f897];return _0x2e95e9;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0xbb77('0x0'));var sh=require(_0xbb77('0x1'));var odbc=require(_0xbb77('0x2'))();var rs=require(_0xbb77('0x3'));var moment=require(_0xbb77('0x4'));var Mustache=require('mustache');var rp=require(_0xbb77('0x5'));var logger=require(_0xbb77('0x6'))('agi');var config=require(_0xbb77('0x7'));var scripts=require(_0xbb77('0x8'));var FILES_PATH=_0xbb77('0x9');var recursiveMapAttributes=['rawHeaders',_0xbb77('0xa')];var verticesWithRetry=[_0xbb77('0xb'),_0xbb77('0xc'),_0xbb77('0xd')];var AGIVertices=function(_0x8ae557,_0x5a52fb,_0xb34db6){this[_0xbb77('0xe')]=_0x8ae557;this['rpc']=_0x5a52fb;this[_0xbb77('0xf')]=_0xb34db6;};AGIVertices[_0xbb77('0x10')][_0xbb77('0x11')]=function(_0x2b3f9b,_0x57e3fa){this[_0xbb77('0x12')]['getVariableById'](_0x2b3f9b)['then'](function(_0x2f9b18){_0x57e3fa(null,_0x2f9b18?_0x2f9b18[_0xbb77('0x13')]:![]);})['catch'](function(_0x109c4e){_0x57e3fa(_0x109c4e);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x14')]=function(_0x205426,_0x4dc0ef){this[_0xbb77('0x12')]['getVoiceQueueById'](_0x205426)[_0xbb77('0x15')](function(_0x3e1f58){_0x4dc0ef(null,_0x3e1f58?_0x3e1f58[_0xbb77('0x13')]:![]);})['catch'](function(_0x5b1ed6){_0x4dc0ef(_0x5b1ed6);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x16')]=function(_0x58ec35,_0x29c180){this[_0xbb77('0x12')][_0xbb77('0x17')](_0x58ec35)[_0xbb77('0x15')](function(_0x393ad3){_0x29c180(null,_0x393ad3?_0x393ad3[_0xbb77('0x13')]:![]);})[_0xbb77('0x18')](function(_0x4afae1){_0x29c180(_0x4afae1);});};AGIVertices[_0xbb77('0x10')]['getSquareOdbc']=function(_0x4d5439,_0x18c589){this[_0xbb77('0x12')][_0xbb77('0x19')](_0x4d5439)['then'](function(_0x4a7d12){_0x18c589(null,_0x4a7d12?_0x4a7d12[_0xbb77('0x1a')]:![]);})[_0xbb77('0x18')](function(_0x470ca9){_0x18c589(_0x470ca9);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1b')]=function(_0x299936,_0x74e124){this['rpc'][_0xbb77('0x1c')](_0x299936)[_0xbb77('0x15')](function(_0x3a6d67){_0x74e124(null,_0x3a6d67?_0x3a6d67['name']:![]);})['catch'](function(_0x4e3943){_0x74e124(_0x4e3943);});};AGIVertices[_0xbb77('0x10')]['getTrunk']=function(_0x242434,_0x38b9dc){this[_0xbb77('0x12')][_0xbb77('0x1d')](_0x242434)['then'](function(_0x981045){_0x38b9dc(null,_0x981045?_0x981045['name']:![]);})['catch'](function(_0x53e447){_0x38b9dc(_0x53e447);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1e')]=function(_0x18de8b,_0x32fa1e){var _0x33ff4a=this;this[_0xbb77('0x12')][_0xbb77('0x1f')](_0x18de8b)[_0xbb77('0x15')](function(_0x26707){_0x32fa1e(null,_0x26707?_0x33ff4a[_0xbb77('0x20')](_0x26707[_0xbb77('0x21')]):![]);})['catch'](function(_0x40f53f){_0x32fa1e(_0x40f53f);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x22')]=function(_0x3394ad,_0x3ef6fd){this[_0xbb77('0x12')][_0xbb77('0x23')](_0x3394ad)[_0xbb77('0x15')](function(_0x3c2893){_0x3ef6fd(null,_0x3c2893?_0x3c2893:![]);})[_0xbb77('0x18')](function(_0x69df86){_0x3ef6fd(_0x69df86);});};AGIVertices['prototype'][_0xbb77('0x24')]=function(_0x361d1c,_0x31e702,_0x20cabe){this[_0xbb77('0xf')][_0xbb77('0x24')](_0x361d1c,_0x31e702)['then'](function(){_0x20cabe(null);})['catch'](function(_0x1eafce){_0x20cabe(_0x1eafce);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x25')]=function(_0x1287e1,_0x429ad0){this[_0xbb77('0x12')][_0xbb77('0x26')](_0x1287e1)[_0xbb77('0x15')](function(_0x462358){if(_0x462358){if(_0x462358[_0xbb77('0x27')]){_0x429ad0(null,[_0x462358['interval']]);}else{_0x429ad0(null,_[_0xbb77('0x28')](_0x462358[_0xbb77('0x29')],_0xbb77('0x2a')));}}else{_0x429ad0(null,![]);}})['catch'](function(_0x3d4928){_0x429ad0(_0x3d4928);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x20')]=function(_0x11eaac){return util['format'](_0xbb77('0x2b'),FILES_PATH,_0x11eaac);};AGIVertices['prototype']['getQueryOdbc']=function(_0x2c2e85,_0x477f03,_0x3ed215){odbc['open'](_0x2c2e85,function(_0x763cbe){if(_0x763cbe){logger['error'](_0xbb77('0x2c'),_0x763cbe);_0x3ed215(_0x763cbe);}else{logger[_0xbb77('0x2d')](_0xbb77('0x2e'));odbc['query'](_0x477f03,function(_0x523f02,_0x1d082c){if(_0x523f02){logger[_0xbb77('0x2d')]('Error\x20executing\x20query\x20%s',_0x477f03);_0x3ed215(_0x523f02);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x477f03);odbc[_0xbb77('0x2f')](function(_0x297f06){if(_0x297f06){logger[_0xbb77('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x297f06);}_0x3ed215(null,_0x1d082c);});}});}});};AGIVertices[_0xbb77('0x10')]['getSmsAccount']=function(_0x42fc9c,_0x120af8){this['rpc'][_0xbb77('0x31')](_0x42fc9c)[_0xbb77('0x15')](function(_0x5ca60d){_0x120af8(null,_0x5ca60d?_0x5ca60d:![]);})[_0xbb77('0x18')](function(_0x1aeb87){_0x120af8(_0x1aeb87);});};AGIVertices[_0xbb77('0x10')]['createSmsMessage']=function(_0x2a1b3a,_0x25dd17){this[_0xbb77('0x12')][_0xbb77('0x32')](_0x2a1b3a)[_0xbb77('0x15')](function(_0x372074){_0x25dd17(null,_0x372074);})['catch'](function(_0x69644c){_0x25dd17(_0x69644c);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x33')]=function(_0x345501,_0x3ef581,_0x15be86){this[_0xbb77('0x12')][_0xbb77('0x33')]({'uniqueid':this[_0xbb77('0xe')][_0xbb77('0x34')],'node':_0x345501[_0xbb77('0x35')],'application':_0x345501[_0xbb77('0x36')],'data':_0x3ef581||null,'project_name':this[_0xbb77('0xe')][_0xbb77('0x37')],'callerid':this[_0xbb77('0xe')][_0xbb77('0x38')]})[_0xbb77('0x15')](function(_0x52e59c){if(_0x15be86){_0x15be86(null,_0x52e59c);}})['catch'](function(_0x23a712){if(_0x15be86){_0x15be86(_0x23a712);}});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x39')]=function(_0x4685c8,_0x14dc11,_0xccda68,_0x4c6468){this['rpc']['createSquareRecording']({'uniqueid':this[_0xbb77('0xe')][_0xbb77('0x34')],'callerid':this[_0xbb77('0xe')]['callerid'],'calleridname':this[_0xbb77('0xe')][_0xbb77('0x3a')],'context':this[_0xbb77('0xe')][_0xbb77('0x3b')],'extension':this[_0xbb77('0xe')][_0xbb77('0x3c')],'priority':this[_0xbb77('0xe')]['priority'],'accountcode':this[_0xbb77('0xe')][_0xbb77('0x3d')],'dnid':this['channel']['dnid'],'projectName':this[_0xbb77('0xe')]['arg_1'],'saveName':_0x14dc11,'filename':_0x4685c8[_0xbb77('0x3e')]||_0x14dc11,'savePath':_0xccda68})[_0xbb77('0x15')](function(_0x4161db){_0x4c6468(null,_0x4161db);})[_0xbb77('0x18')](function(_0xdf2aa8){_0x4c6468(_0xdf2aa8);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x3f')]=function(_0x139dc8,_0x3d85aa,_0x455299,_0x4a35e4,_0x218fd7){this['rpc'][_0xbb77('0x3f')]({'uniqueid':this['channel']['uniqueid'],'body':_0x139dc8,'direction':_0x3d85aa,'providerName':_0x455299,'providerResponse':_0x4a35e4})[_0xbb77('0x15')](function(_0x169f03){if(_0x218fd7){_0x218fd7(null,_0x169f03);}})[_0xbb77('0x18')](function(_0x35da05){if(_0x218fd7){_0x218fd7(_0x35da05);}});};AGIVertices['prototype'][_0xbb77('0x40')]=function(_0x3f649f,_0x341cca){this[_0xbb77('0x12')]['createCmContact']({'firstName':_[_0xbb77('0x41')](_0x3f649f['name'])||_[_0xbb77('0x42')](_0x3f649f[_0xbb77('0x13')])?_0xbb77('0x43')+Math['random']():_0x3f649f[_0xbb77('0x13')],'lastName':_[_0xbb77('0x41')](_0x3f649f[_0xbb77('0x44')])||_['isNil'](_0x3f649f['lastName'])?null:_0x3f649f['lastName'],'phone':_0x3f649f[_0xbb77('0x45')],'ListId':_0x3f649f[_0xbb77('0x46')],'scheduledat':_0x3f649f[_0xbb77('0x47')],'callbackUniqueid':this['channel'][_0xbb77('0x34')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x3f649f['scheduledAt'][_0xbb77('0x48')](),'priority':_0x3f649f[_0xbb77('0x49')]})[_0xbb77('0x15')](function(_0x4fae92){_0x341cca(null,_0x4fae92);})[_0xbb77('0x18')](function(_0x2be789){_0x341cca(_0x2be789);});};AGIVertices[_0xbb77('0x10')]['getPause']=function(_0x3f84aa,_0x28e810){this[_0xbb77('0x12')][_0xbb77('0x4a')](_0x3f84aa)[_0xbb77('0x15')](function(_0x123684){_0x28e810(null,_0x123684?_0x123684[_0xbb77('0x13')]:![]);})['catch'](function(_0x13921d){_0x28e810(_0x13921d);});};AGIVertices[_0xbb77('0x10')]['agentPause']=function(_0x2a2cb9,_0x4e7638,_0x18894c){var _0x573938={'role':_0xbb77('0x4b')};_0x573938[_0x2a2cb9]=this[_0xbb77('0xe')][_0xbb77('0x38')];this[_0xbb77('0x12')][_0xbb77('0x4c')](_0x573938,_0x4e7638,this['channel'][_0xbb77('0x34')])[_0xbb77('0x15')](function(_0x2f5c97){_0x18894c(null,_[_0xbb77('0x42')](_0x2f5c97)?![]:!![]);})[_0xbb77('0x18')](function(_0x280d14){logger['error'](_0x280d14);_0x18894c(null,![]);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x4d')]=function(_0xb750c2,_0x46a40d){var _0x4b62d2={'role':_0xbb77('0x4b')};_0x4b62d2[_0xb750c2]=this['channel'][_0xbb77('0x38')];this[_0xbb77('0x12')][_0xbb77('0x4d')](_0x4b62d2)['then'](function(_0x2d27d5){_0x46a40d(null,_[_0xbb77('0x42')](_0x2d27d5)?![]:!![]);})[_0xbb77('0x18')](function(_0xf565ba){logger[_0xbb77('0x30')](_0xf565ba);_0x46a40d(null,![]);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x4e')]=function(_0x2fd8b5,_0x3998d9){var _0x34fa8b={'role':_0xbb77('0x4b')};_0x34fa8b[_0x2fd8b5]=this[_0xbb77('0xe')][_0xbb77('0x38')];this[_0xbb77('0x12')][_0xbb77('0x4e')](_0x34fa8b)[_0xbb77('0x15')](function(_0x119a55){_0x3998d9(null,_['isNil'](_0x119a55)?![]:!![]);})[_0xbb77('0x18')](function(_0x2283d4){logger[_0xbb77('0x30')](_0x2283d4);_0x3998d9(null,![]);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x4f')]=function(_0x3b9f33,_0x44d532){var _0x5253a6={'role':_0xbb77('0x4b')};_0x5253a6[_0x3b9f33]=this['channel'][_0xbb77('0x38')];var _0x2f4ce6=_0x3b9f33!=_0xbb77('0x50')?util[_0xbb77('0x51')]('%s/%s@from-sip/n',_0xbb77('0x52'),this[_0xbb77('0xe')][_0xbb77('0x38')]):undefined;this[_0xbb77('0x12')][_0xbb77('0x4f')](_0x5253a6,_0x2f4ce6)[_0xbb77('0x15')](function(_0xd4f34){_0x44d532(null,_[_0xbb77('0x42')](_0xd4f34)?![]:!![]);})['catch'](function(_0x26ce78){logger[_0xbb77('0x30')](_0x26ce78);_0x44d532(null,![]);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x53')]=function(_0x334ae5,_0x2f61e0){sh[_0xbb77('0x54')](_[_0xbb77('0x55')](_0x334ae5),function(_0x3e238c,_0x34ea80){var _0x1e5566=_0x34ea80[_0xbb77('0x56')](/(\r\n|\n|\r)/gm,'');_0x2f61e0(null,_0x1e5566);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x57')]=function(_0x153ba3,_0x473028){scripts[_0xbb77('0x57')](_0x153ba3[_0xbb77('0x58')],_0x153ba3[_0xbb77('0x59')]||_0xbb77('0x5a'),_0x153ba3[_0xbb77('0x5a')],_0x153ba3[_0xbb77('0x5b')]||_0xbb77('0x5c'),_0x153ba3[_0xbb77('0x5d')]||_0xbb77('0x5e'),_0x153ba3[_0xbb77('0x5f')]||_0xbb77('0x60'))['then'](function(_0x18946d){_0x473028(null,_0x18946d);})['catch'](function(_0xeacbbc){_0x473028(_0xeacbbc);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x61')]=function(_0x2d0b77,_0x57308b){scripts[_0xbb77('0x61')](_0x2d0b77['text'],_0x2d0b77[_0xbb77('0x62')]||'en',0x1)[_0xbb77('0x15')](function(_0x522ff6){_0x57308b(null,_0x522ff6);})['catch'](function(_0x47c80a){_0x57308b(_0x47c80a);});};AGIVertices[_0xbb77('0x10')]['restAPI']=function(_0x4c380f,_0x50a67b){var _0x2a5734={'uri':_0x4c380f[_0xbb77('0x63')],'method':_0x4c380f[_0xbb77('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4c380f[_0xbb77('0x65')])===_0xbb77('0x66')&&parseInt(_0x4c380f[_0xbb77('0x65')])>=0x1?parseInt(_0x4c380f[_0xbb77('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xbb77('0x67')]([_0xbb77('0x68'),_0xbb77('0x69')],_0x2a5734['method'][_0xbb77('0x6a')]())){try{_0x2a5734[_0xbb77('0x6b')]=_0x4c380f[_0xbb77('0xa')]?JSON['parse'](_0x4c380f[_0xbb77('0xa')]):{};}catch(_0x3c7a94){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3c7a94);}}try{_0x2a5734[_0xbb77('0x6c')]=_0x4c380f['rawHeaders']?JSON[_0xbb77('0x6d')](_0x4c380f[_0xbb77('0x6e')]):{};}catch(_0x9d6bb){logger[_0xbb77('0x30')](_0xbb77('0x6f'),_0x9d6bb);}if(_0x4c380f[_0xbb77('0x70')]){try{var _0x492333=require(_0x4c380f[_0xbb77('0x70')])[_0xbb77('0x71')](this,_0x2a5734);_0x2a5734[_0xbb77('0x72')]=Mustache[_0xbb77('0x73')](_0x4c380f['url'],_0x492333,{},['$$','$$']);if(_0x2a5734[_0xbb77('0x6c')]){_0x2a5734[_0xbb77('0x6c')]=JSON[_0xbb77('0x6d')](Mustache[_0xbb77('0x73')](JSON[_0xbb77('0x74')](_0x2a5734[_0xbb77('0x6c')]),_0x492333,{},['$$','$$']));}if(_0x2a5734['body']){_0x2a5734[_0xbb77('0x6b')]=JSON['parse'](Mustache[_0xbb77('0x73')](JSON[_0xbb77('0x74')](_0x2a5734[_0xbb77('0x6b')]),_0x492333,{},['$$','$$']));}}catch(_0x37e4f2){logger['error'](_0xbb77('0x75'),_0x37e4f2);}}rp(_0x2a5734)[_0xbb77('0x15')](function(_0x45610c){var _0x2d9739={'statusCode':_0x45610c[_0xbb77('0x76')]||0xc8,'statusMessage':_0x45610c['statusMessage']||'OK','headers':_0x45610c[_0xbb77('0x6c')]||{},'body':_0x45610c[_0xbb77('0x6b')]||{}};_0x50a67b(null,_0x2d9739);})['catch'](function(_0x143fa8){var _0x93f778={'statusCode':_0x143fa8['statusCode']||0x1f4,'statusMessage':_0x143fa8[_0xbb77('0x77')]||_0xbb77('0x78'),'headers':_0x143fa8[_0xbb77('0x79')]['headers']||{},'body':_0x143fa8['options'][_0xbb77('0x6b')]||{}};_0x50a67b(null,_0x93f778);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x7a')]=function(_0x2d266b,_0x22c60){scripts[_0xbb77('0x7a')](this[_0xbb77('0xe')][_0xbb77('0x34')],_0x2d266b[_0xbb77('0x7b')],_0x2d266b['text'],_0x2d266b['dialogflow_language']||'en')[_0xbb77('0x15')](function(_0x14462c){_0x22c60(null,_0x14462c);})['catch'](function(_0x2a996f){_0x22c60(_0x2a996f);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x7c')]=function(_0x4b2614,_0x549131){scripts['googleDialogflowV2'](this[_0xbb77('0xe')]['uniqueid'],_0x4b2614[_0xbb77('0x7d')],_0x4b2614[_0xbb77('0x7e')],_0x4b2614[_0xbb77('0x7f')],_0x4b2614[_0xbb77('0x5a')],_0x4b2614[_0xbb77('0x80')]||'en')[_0xbb77('0x15')](function(_0x1398e9){_0x549131(null,_0x1398e9);})[_0xbb77('0x18')](function(_0x58f2ae){_0x549131(_0x58f2ae);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x81')]=function(_0x3d7e10,_0xfad522){scripts[_0xbb77('0x81')](this['channel'],_0x3d7e10)[_0xbb77('0x15')](function(_0x2b7732){_0xfad522(null,_0x2b7732);})['catch'](function(_0x1fe4f7){_0xfad522(_0x1fe4f7);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x82')]=function(_0x58a383,_0xc9b008){scripts[_0xbb77('0x82')](_0x58a383[_0xbb77('0x7b')],_0x58a383['text'],_0x58a383[_0xbb77('0x83')]||_0xbb77('0x5c'),_0x58a383[_0xbb77('0x84')])[_0xbb77('0x15')](function(_0x1b6b72){_0xc9b008(null,_0x1b6b72);})[_0xbb77('0x18')](function(_0x2c2ce6){_0xc9b008(_0x2c2ce6);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x85')]=function(_0x5383a2,_0x46ab1c,_0x55b544){scripts[_0xbb77('0x85')](_0x46ab1c,_0x5383a2[_0xbb77('0x7b')],_0x5383a2['ispeech_asr_language']||'en-US',this[_0xbb77('0x86')](_0x5383a2['model'])?_0x5383a2[_0xbb77('0x87')]:undefined)[_0xbb77('0x15')](function(_0x1725bf){_0x55b544(null,_0x1725bf);})[_0xbb77('0x18')](function(_0x3d1921){_0x55b544(_0x3d1921);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x88')]=function(_0x563ef,_0x5bc6a5){scripts['awsPolly'](_0x563ef[_0xbb77('0x89')],_0x563ef[_0xbb77('0x8a')],_0x563ef[_0xbb77('0x8b')],_0x563ef['aws_polly_voice']||_0xbb77('0x8c'),_0x563ef[_0xbb77('0x5a')],_0x563ef['aws_text_type']||_0xbb77('0x5a'))[_0xbb77('0x15')](function(_0x332bbd){_0x5bc6a5(null,_0x332bbd);})[_0xbb77('0x18')](function(_0x114276){_0x5bc6a5(_0x114276);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x8d')]=function(_0x388710,_0x340fe0){scripts['awsLex'](this['channel']['uniqueid'],_0x388710[_0xbb77('0x89')],_0x388710[_0xbb77('0x8a')],_0x388710[_0xbb77('0x8e')],_0x388710[_0xbb77('0x5a')],_0x388710['aws_bot_name'])['then'](function(_0x3f370d){_0x340fe0(null,_0x3f370d);})[_0xbb77('0x18')](function(_0x35e822){_0x340fe0(_0x35e822);});};AGIVertices[_0xbb77('0x10')][_0xbb77('0x8f')]=function(_0x587642,_0x5097b1,_0x2f1715){scripts['googleASR'](_0x5097b1,_0x587642[_0xbb77('0x7b')],_0x587642[_0xbb77('0x90')]||'en-US')['then'](function(_0x37f174){_0x2f1715(null,_0x37f174);})[_0xbb77('0x18')](function(_0x1620c2){_0x2f1715(_0x1620c2);});};AGIVertices[_0xbb77('0x10')]['tildeASR']=function(_0x583b87,_0x22dce3,_0x2059fd){scripts[_0xbb77('0x91')](_0x22dce3,_0x583b87[_0xbb77('0x92')],_0x583b87[_0xbb77('0x93')],_0x583b87[_0xbb77('0x72')])['then'](function(_0x3cc1a2){_0x2059fd(null,_0x3cc1a2);})[_0xbb77('0x18')](function(_0x395603){_0x2059fd(_0x395603);});};AGIVertices['prototype'][_0xbb77('0x94')]=function(_0xed44e0){var _0x34d1af=_[_0xbb77('0x67')](verticesWithRetry,_0xed44e0[_0xbb77('0x36')])?_0xed44e0:_[_0xbb77('0x95')](_0xed44e0);for(var _0x2a753c in _0x34d1af){if(_0x34d1af[_0xbb77('0x96')](_0x2a753c)){if(_0x34d1af[_0x2a753c]&&_[_0xbb77('0x97')](_0x34d1af[_0x2a753c])){if(_['includes'](recursiveMapAttributes,_0x2a753c)){_0x34d1af[_0x2a753c]=this[_0xbb77('0x98')](_0x34d1af[_0x2a753c]);}else{_0x34d1af[_0x2a753c]=this[_0xbb77('0x99')](_0x34d1af[_0x2a753c]);}}}}return _0x34d1af;};AGIVertices[_0xbb77('0x10')][_0xbb77('0x9a')]=function(_0x1d006a){for(var _0x3da8ff in _0x1d006a){if(_0x1d006a['hasOwnProperty'](_0x3da8ff)){if(_['isPlainObject'](_0x1d006a[_0x3da8ff])){this[_0xbb77('0x9a')](_0x1d006a[_0x3da8ff]);}else if(_[_0xbb77('0x9b')](_0x1d006a[_0x3da8ff])){for(var _0x36d3da=0x0;_0x36d3da<_0x1d006a[_0x3da8ff]['length'];_0x36d3da++){this['recursiveNodeIndex'](_0x1d006a[_0x3da8ff][_0x36d3da]);}}else if(_[_0xbb77('0x97')](_0x1d006a[_0x3da8ff])){_0x1d006a[_0x3da8ff]=this[_0xbb77('0x99')](_0x1d006a[_0x3da8ff]);}}}};AGIVertices['prototype'][_0xbb77('0x9c')]=function(_0x4d0dd9,_0x3f870c){for(var _0x38b580 in _0x4d0dd9){if(_0x4d0dd9['hasOwnProperty'](_0x38b580)){if(_['isPlainObject'](_0x4d0dd9[_0x38b580])){if(!_[_0xbb77('0x41')](_0x4d0dd9[_0x38b580])){this['saveRestApiResult'](_0x4d0dd9[_0x38b580],util[_0xbb77('0x51')](_0xbb77('0x9d'),_0x3f870c,_0x38b580));}}else if(_[_0xbb77('0x9b')](_0x4d0dd9[_0x38b580])){for(var _0x5d2ec8=0x0;_0x5d2ec8<_0x4d0dd9[_0x38b580][_0xbb77('0x9e')];_0x5d2ec8++){this[_0xbb77('0x9c')](_0x4d0dd9[_0x38b580][_0x5d2ec8],util[_0xbb77('0x51')](_0xbb77('0x9d'),_0x3f870c,_0x38b580+'['+_0x5d2ec8+']'));}}else{if(!_[_0xbb77('0x42')](_0x4d0dd9[_0x38b580])){this[_0xbb77('0xe')]['setVariable'](util[_0xbb77('0x51')](_0xbb77('0x9d'),_0x3f870c,_0x38b580),_0x4d0dd9[_0x38b580]);}}}}};AGIVertices[_0xbb77('0x10')]['replaceObjectAllVariables']=function(_0x500aed){try{var _0x35e3fb=JSON[_0xbb77('0x6d')](_0x500aed);this[_0xbb77('0x9a')](_0x35e3fb);return JSON[_0xbb77('0x74')](_0x35e3fb);}catch(_0x56392a){return this[_0xbb77('0x99')](_0x500aed);}};AGIVertices[_0xbb77('0x10')][_0xbb77('0x99')]=function(_0x332646){var _0x56d815=_0x332646[_0xbb77('0x9f')]('{');for(var _0x735104=0x1;_0x735104<_0x56d815['length'];_0x735104+=0x1){var _0x23b4e9=_0x56d815[_0x735104][_0xbb77('0x9f')]('}');if(_0x23b4e9[_0xbb77('0x9e')]>0x1){_0x332646=_0x332646['replaceAll']('{'+_0x23b4e9[0x0]+'}',this[_0xbb77('0xe')][_0xbb77('0x11')](_0x23b4e9[0x0])[_0xbb77('0xa0')]||_0x23b4e9[0x0]);}}if(_0x56d815[_0xbb77('0x9e')]===0x1){return _0x332646[_0xbb77('0x48')]();}return this[_0xbb77('0x99')](_0x332646);};AGIVertices[_0xbb77('0x10')][_0xbb77('0xa1')]=function(_0x172208,_0x149806){var _0x49646b=this[_0xbb77('0xe')]['getVariable'](_0x172208);if(_0x49646b[_0xbb77('0xa2')]===-0x1){return _0x49646b;}logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0xa3'),_0x149806,_0x49646b[_0xbb77('0xa0')]));return this[_0xbb77('0xe')][_0xbb77('0xa4')](_0x149806,_0x49646b[_0xbb77('0xa0')]);};AGIVertices['prototype']['isConfigured']=function(_0x32c011){return _0x32c011&&_0x32c011!=='0'&&_0x32c011!=='-1'&&_0x32c011!=='';};AGIVertices[_0xbb77('0x10')][_0xbb77('0xa5')]=function(_0x30d910){this['createSquareDetailsReport'][_0xbb77('0x71')](this,_0x30d910,'-');_0x30d910[_0xbb77('0xa6')]=_0x30d910['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbb77('0x10')][_0xbb77('0xa7')]=function(_0x349e9f){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0xa8'),_0x349e9f[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x349e9f[_0xbb77('0x5a')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0xaa'));}var _0x373cd4='\x22'+_0x349e9f['text']+'\x22';if(this[_0xbb77('0x86')](_0x349e9f[_0xbb77('0x79')])){_0x373cd4+=','+_0x349e9f[_0xbb77('0x79')];}var _0x2b888e=this[_0xbb77('0xe')][_0xbb77('0x54')](_0xbb77('0xab'),_0x373cd4);if(_0x2b888e[_0xbb77('0xa2')]===-0x1){return _0x2b888e;}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0xac'),_0x373cd4));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xad')]=function(_0x434db3){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0xae'),_0x434db3[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x434db3['grammar'])){return this['channel'][_0xbb77('0xa9')](_0xbb77('0xaf'));}var _0x3accc7=_0x434db3[_0xbb77('0xb0')];if(this[_0xbb77('0x86')](_0x434db3[_0xbb77('0x79')])){_0x3accc7+=','+_0x434db3[_0xbb77('0x79')];}var _0x1e1e45=this[_0xbb77('0xe')]['exec'](_0xbb77('0xb1'),_0x3accc7);if(_0x1e1e45[_0xbb77('0xa2')]===-0x1){return _0x1e1e45;}var _0x275d09=this[_0xbb77('0xa1')](_0xbb77('0xb2'),_0xbb77('0xb3'));if(_0x275d09['result']===-0x1){return _0x275d09;}var _0x17e876=this[_0xbb77('0xa1')](_0xbb77('0xb4'),_0xbb77('0xb5'));if(_0x17e876[_0xbb77('0xa2')]===-0x1){return _0x17e876;}var _0x106658=this['getAndSetVariable'](_0xbb77('0xb6'),_0xbb77('0xb7'));if(_0x106658[_0xbb77('0xa2')]===-0x1){return _0x106658;}return this['channel'][_0xbb77('0xa9')](util[_0xbb77('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3accc7));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xb8')]=function(_0xf0dc5e){logger['info'](util[_0xbb77('0x51')](_0xbb77('0xb9'),_0xf0dc5e[_0xbb77('0x35')]));return this[_0xbb77('0xe')]['agi']([_0xf0dc5e[_0xbb77('0xba')],_0xf0dc5e[_0xbb77('0xbb')]]);};AGIVertices[_0xbb77('0x10')][_0xbb77('0xbc')]=function(_0x71d061){logger[_0xbb77('0x2d')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x71d061[_0xbb77('0x35')]));if(this[_0xbb77('0x86')](_0x71d061[_0xbb77('0x65')])){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x71d061['timeout']));var _0x366530=this[_0xbb77('0xe')][_0xbb77('0xbd')](_0x71d061[_0xbb77('0x65')]);if(_0x366530[_0xbb77('0xa2')]===-0x1){return _0x366530;}}return this[_0xbb77('0xe')][_0xbb77('0xbc')]();};AGIVertices[_0xbb77('0x10')][_0xbb77('0xbe')]=function(_0x36681d){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x36681d[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x36681d['list_id'])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x36681d,'no\x20list\x20selected');}_0x36681d[_0xbb77('0x47')]=moment();if(this[_0xbb77('0x86')](_0x36681d[_0xbb77('0xbf')])){_0x36681d[_0xbb77('0x47')]=moment()[_0xbb77('0xc0')](_0x36681d[_0xbb77('0xbf')],_0xbb77('0xc1'));}if(!this['isConfigured'](_0x36681d['callback_priority'])){_0x36681d[_0xbb77('0x49')]=0x2;}this[_0xbb77('0x40')]['sync'](this,_0x36681d);return this['channel'][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0xc2'),_0x36681d[_0xbb77('0x45')],_0x36681d[_0xbb77('0x46')],_0x36681d['scheduledAt']));};AGIVertices['prototype'][_0xbb77('0xc3')]=function(_0x3ceb65){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x3ceb65['label']));var _0x2fb551=this[_0xbb77('0xe')][_0xbb77('0x54')](_0x3ceb65[_0xbb77('0xc4')],_0x3ceb65[_0xbb77('0x79')]);if(_0x2fb551[_0xbb77('0xa2')]===-0x1){return _0x2fb551;}return this['channel'][_0xbb77('0xa9')](util[_0xbb77('0x51')]('Executed\x20command\x20%s\x20%s',_0x3ceb65[_0xbb77('0xc4')],_0x3ceb65['options']));};AGIVertices[_0xbb77('0x10')]['lumenvoxtts']=function(_0x192cb8){logger['info'](util[_0xbb77('0x51')](_0xbb77('0xc5'),_0x192cb8[_0xbb77('0x35')]));if(!this['isConfigured'](_0x192cb8[_0xbb77('0x5a')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0xaa'));}var _0x39bdbf='\x22'+_0x192cb8[_0xbb77('0x5a')]+'\x22';if(this[_0xbb77('0x86')](_0x192cb8[_0xbb77('0x79')])){_0x39bdbf+=','+_0x192cb8[_0xbb77('0x79')];}var _0x281f97=this[_0xbb77('0xe')][_0xbb77('0x54')](_0xbb77('0xab'),_0x39bdbf);if(_0x281f97[_0xbb77('0xa2')]===-0x1){return _0x281f97;}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0xac'),_0x39bdbf));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xc6')]=function(_0x4c8663){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0xc7'),_0x4c8663[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x4c8663['text'])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20text\x20configured');}var _0x473e43='\x22'+_0x4c8663[_0xbb77('0x5a')]+'\x22';if(this[_0xbb77('0x86')](_0x4c8663[_0xbb77('0x79')])){_0x473e43+=','+_0x4c8663[_0xbb77('0x79')];}var _0x905638=this['channel'][_0xbb77('0x54')]('MRCPSynth',_0x473e43);if(_0x905638[_0xbb77('0xa2')]===-0x1){return _0x905638;}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0xac'),_0x473e43));};AGIVertices[_0xbb77('0x10')]['lumenvoxasr']=function(_0x4e3a06){logger['info'](util[_0xbb77('0x51')](_0xbb77('0xc8'),_0x4e3a06[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x4e3a06['grammar'])){return this['channel'][_0xbb77('0xa9')](_0xbb77('0xaf'));}var _0x79caf0=_0x4e3a06['grammar'];if(this[_0xbb77('0x86')](_0x4e3a06[_0xbb77('0x79')])){_0x79caf0+=','+_0x4e3a06[_0xbb77('0x79')];}var _0x46fa4e=this[_0xbb77('0xe')][_0xbb77('0x54')]('MRCPRecog',_0x79caf0);if(_0x46fa4e[_0xbb77('0xa2')]===-0x1){return _0x46fa4e;}var _0x3583e6=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xbb77('0xc9'));if(_0x3583e6[_0xbb77('0xa2')]===-0x1){return _0x3583e6;}var _0x5ae4fe=this[_0xbb77('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5ae4fe[_0xbb77('0xa2')]===-0x1){return _0x5ae4fe;}var _0x41250d=this[_0xbb77('0xa1')](_0xbb77('0xb6'),_0xbb77('0xca'));if(_0x41250d['result']===-0x1){return _0x41250d;}return this['channel'][_0xbb77('0xa9')](util[_0xbb77('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x79caf0));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xcb')]=function(_0x7f9a6a){logger['info'](util[_0xbb77('0x51')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x7f9a6a[_0xbb77('0x35')]));if(!this['isConfigured'](_0x7f9a6a[_0xbb77('0xb0')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0xaf'));}var _0x1f6714=_0x7f9a6a['grammar'];if(this[_0xbb77('0x86')](_0x7f9a6a[_0xbb77('0x79')])){_0x1f6714+=','+_0x7f9a6a['options'];}var _0x4f654a=this[_0xbb77('0xe')][_0xbb77('0x54')](_0xbb77('0xb1'),_0x1f6714);if(_0x4f654a[_0xbb77('0xa2')]===-0x1){return _0x4f654a;}var _0x880cd9=this[_0xbb77('0xa1')](_0xbb77('0xb2'),_0xbb77('0xcc'));if(_0x880cd9[_0xbb77('0xa2')]===-0x1){return _0x880cd9;}var _0x475a80=this[_0xbb77('0xa1')](_0xbb77('0xb4'),_0xbb77('0xcd'));if(_0x475a80['result']===-0x1){return _0x475a80;}var _0x1fa7a5=this[_0xbb77('0xa1')](_0xbb77('0xb6'),_0xbb77('0xce'));if(_0x1fa7a5[_0xbb77('0xa2')]===-0x1){return _0x1fa7a5;}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0xcf'),_0x1f6714));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xd0')]=function(_0x38304e){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0xd1'),_0x38304e[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x38304e[_0xbb77('0xd2')])){return this[_0xbb77('0xe')]['error'](_0x38304e,_0xbb77('0xd3'));}var _0x273d9b=this['getSquareOdbc']['sync'](this,_0x38304e[_0xbb77('0xd2')]);if(!_0x273d9b){return this[_0xbb77('0xe')]['error'](_0x38304e,'no\x20odbc\x20database\x20found');}if(!this[_0xbb77('0x86')](_0x38304e[_0xbb77('0xd4')])){return this[_0xbb77('0xe')]['error'](_0x38304e,_0xbb77('0xd5'));}var _0x56d280=_0x38304e[_0xbb77('0xd4')][_0xbb77('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0xd6'),_0x56d280));var _0x15a467=this[_0xbb77('0xd7')][_0xbb77('0x71')](this,_0x273d9b,_0x56d280);this[_0xbb77('0x33')][_0xbb77('0x71')](this,_0x38304e,_0x56d280);if(!this[_0xbb77('0x86')](_0x38304e[_0xbb77('0xd8')])){return this[_0xbb77('0xe')]['noop'](_0xbb77('0xd9'));}var _0x578553=this['getVariable'][_0xbb77('0x71')](this,_0x38304e[_0xbb77('0xd8')]);if(!_0x578553){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x38304e,_0xbb77('0xda'));}var _0x548d6d=this;_0x15a467[_0xbb77('0xdb')](function(_0x5aac5b,_0x2bb8c8){Object[_0xbb77('0xdc')](_0x5aac5b)[_0xbb77('0xdb')](function(_0x2d02fe){_0x548d6d[_0xbb77('0xe')][_0xbb77('0xa4')](util[_0xbb77('0x51')](_0xbb77('0xdd'),_0x578553,_0x2bb8c8,_0x2d02fe),_0x5aac5b[_0x2d02fe]);});});this[_0xbb77('0xe')]['setVariable'](util['format'](_0xbb77('0xde'),_0x578553),_0x15a467[_0xbb77('0x9e')]);return this['channel']['noop'](util['format'](_0xbb77('0xdf'),_0x578553));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xe0')]=function(_0x56e97d){logger[_0xbb77('0xe1')](util['format'](_0xbb77('0xe2'),_0x56e97d['label']));if(!this[_0xbb77('0x86')](_0x56e97d[_0xbb77('0xe3')])){return this[_0xbb77('0xe')]['error'](_0x56e97d,_0xbb77('0xe4'));}var _0x55b25c=this['getUser'][_0xbb77('0x71')](this,_0x56e97d['sip_id']);if(!_0x55b25c){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x56e97d,_0xbb77('0xe5'));}var _0x1eda30=this['channel']['exec'](_0xbb77('0xe6'),[util[_0xbb77('0x51')](_0xbb77('0xe7'),_0x55b25c),_0x56e97d[_0xbb77('0x65')],_0x56e97d[_0xbb77('0xe8')],_0x56e97d['url']]);if(_0x1eda30[_0xbb77('0xa2')]===-0x1){return _0x1eda30;}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0xe9'),'DIAL'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xea')]=function(_0x5a2f59){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5a2f59['label']));if(!this['isConfigured'](_0x5a2f59['key'])){return this[_0xbb77('0xe')]['noop'](_0xbb77('0xeb'));}if(!this[_0xbb77('0x86')](_0x5a2f59['text'])){return this['channel'][_0xbb77('0xa9')](_0xbb77('0xaa'));}this[_0xbb77('0xe')][_0xbb77('0xec')]=!![];this['createSquareDetailsReport'](_0x5a2f59);this[_0xbb77('0x3f')](_0x5a2f59[_0xbb77('0x5a')],'in','','');this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0xed'),_0x5a2f59[_0xbb77('0x5a')]));var _0x3d449c=this['googleDialogflow'][_0xbb77('0x71')](this,_0x5a2f59);if(_0x3d449c){for(var _0xb1876b in _0x3d449c){if(_0x3d449c[_0xbb77('0x96')](_0xb1876b)){this[_0xbb77('0xe')][_0xbb77('0xa4')](util[_0xbb77('0x51')]('DIALOGFLOW_%s',_0xb1876b[_0xbb77('0x6a')]()),_0x3d449c[_0xb1876b]);}}this['createSquareMessage'](_0x3d449c[_0xbb77('0xee')],'out',_0xbb77('0xea'),'');return this['channel']['noop'](util[_0xbb77('0x51')](_0xbb77('0xef'),_0x3d449c[_0xbb77('0xee')]));}return this['channel']['error'](_0x5a2f59,_0xbb77('0xf0'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xf1')]=function(_0x7f224f){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0xf2'),_0x7f224f[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x7f224f[_0xbb77('0x7d')])){return this['channel'][_0xbb77('0xa9')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x7f224f[_0xbb77('0x7e')])){return this[_0xbb77('0xe')]['noop']('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x7f224f[_0xbb77('0x7f')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0xf3'));}if(!this[_0xbb77('0x86')](_0x7f224f[_0xbb77('0x80')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x7f224f[_0xbb77('0x5a')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20text\x20configured');}this[_0xbb77('0xe')][_0xbb77('0xec')]=!![];this['createSquareDetailsReport'](_0x7f224f);this['createSquareMessage'](_0x7f224f[_0xbb77('0x5a')],'in','','');this['channel']['noop'](util[_0xbb77('0x51')](_0xbb77('0xf4'),_0x7f224f[_0xbb77('0x5a')]));var _0x2c0f8e=this[_0xbb77('0x7c')]['sync'](this,_0x7f224f);if(_0x2c0f8e){for(var _0x129ddf in _0x2c0f8e){if(_0x2c0f8e[_0xbb77('0x96')](_0x129ddf)){if(_0x129ddf!=='providerResponse'){this['channel']['setVariable'](util[_0xbb77('0x51')](_0xbb77('0xf5'),_0x129ddf[_0xbb77('0x6a')]()),_0x2c0f8e[_0x129ddf]);}}}this[_0xbb77('0x3f')](_0x2c0f8e[_0xbb77('0xee')],_0xbb77('0xf6'),_0xbb77('0xf1'),_0x2c0f8e[_0xbb77('0xf7')]);return this['channel'][_0xbb77('0xa9')](util['format'](_0xbb77('0xf8'),_0x2c0f8e[_0xbb77('0xee')]));}return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x7f224f,_0xbb77('0xf9'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xfa')]=function(_0x1746f2){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1746f2['label']));if(!this[_0xbb77('0x86')](_0x1746f2['ndauth_url'])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xbb77('0x86')](_0x1746f2['username'])){return this['channel']['noop'](_0xbb77('0xfb'));}if(!this[_0xbb77('0x86')](_0x1746f2[_0xbb77('0xfc')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0xfd'));}if(!this['isConfigured'](_0x1746f2['ndassistant_url'])){return this[_0xbb77('0xe')]['noop']('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xbb77('0x33')](_0x1746f2);this[_0xbb77('0x3f')](_0x1746f2['text'],'in','','');this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')]('Trying\x20SestekNDA:\x20%s',_0x1746f2['text']));var _0x48a065=this[_0xbb77('0x81')][_0xbb77('0x71')](this,_0x1746f2);if(_0x48a065){for(var _0x5d4910 in _0x48a065){if(_0x48a065[_0xbb77('0x96')](_0x5d4910)){this[_0xbb77('0xe')][_0xbb77('0xa4')](util[_0xbb77('0x51')](_0xbb77('0xfe'),_0x5d4910[_0xbb77('0x6a')]()),_0x48a065[_0x5d4910]);}}this[_0xbb77('0x3f')](_0x48a065[_0xbb77('0xee')],_0xbb77('0xf6'),'sesteknda','');if(_0x48a065[_0xbb77('0xff')]){this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x100'),_0x48a065[_0xbb77('0xff')]));var _0x15a862=this[_0xbb77('0xe')][_0xbb77('0x101')](_0x48a065['audiofile']);try{fs[_0xbb77('0x102')](_0x48a065['audiofile']+_0xbb77('0x103'));}catch(_0x25d144){logger[_0xbb77('0x30')](_0x25d144);}return _0x15a862;}else{return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x104'),_0x48a065['speech']));}}return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x1746f2,_0xbb77('0x105'));};AGIVertices[_0xbb77('0x10')]['end']=function(_0x2200fa){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Enter\x20in\x20END\x20(%s)\x20block',_0x2200fa[_0xbb77('0x35')]));return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0x106'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x107')]=function(_0x258849){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x108'),_0x258849[_0xbb77('0x35')]));var _0x575cb0='';if(_0x258849[_0xbb77('0x109')]){if(!this[_0xbb77('0x86')](_0x258849[_0xbb77('0x109')])){return this['channel'][_0xbb77('0x30')](_0x258849,_0xbb77('0x10a'));}else{var _0x17eb0c=parseInt(_0x258849[_0xbb77('0x109')],0xa);if(isNaN(_0x17eb0c)){_0x575cb0=_0x258849['trunk_id'];}else{_0x575cb0=this[_0xbb77('0x10b')][_0xbb77('0x71')](this,_0x258849[_0xbb77('0x109')]);if(!_0x575cb0){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x258849,_0xbb77('0x10c'));}}}}else if(_0x258849[_0xbb77('0x10d')]){_0x575cb0=_0x258849[_0xbb77('0x10d')];}else{return this[_0xbb77('0xe')]['error'](_0x258849,'no\x20trunk\x20selected');}var _0x42e989=this['channel'][_0xbb77('0x54')](_0xbb77('0xe6'),[util['format'](_0xbb77('0x10e'),_0x575cb0,_0x258849[_0xbb77('0x45')]),_0x258849[_0xbb77('0x65')],_0x258849[_0xbb77('0xe8')],_0x258849['url']]);if(_0x42e989[_0xbb77('0xa2')]===-0x1){return _0x42e989;}return this['channel'][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0xe9'),_0xbb77('0xe6')));};AGIVertices[_0xbb77('0x10')]['finally']=function(_0x32af58){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x10f'),_0x32af58[_0xbb77('0x35')]));return this['channel']['noop'](_0xbb77('0x110'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0xc')]=function(_0x165129){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x111'),_0x165129[_0xbb77('0x35')]));if(_0x165129[_0xbb77('0xa6')]===0x0){return this['maxRetry'](_0x165129);}_0x165129['retry']-=0x1;if(!this[_0xbb77('0x86')](_0x165129['file_id'])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x165129,'no\x20file\x20audio\x20selected');}var _0x32e072=this[_0xbb77('0x1e')][_0xbb77('0x71')](this,_0x165129[_0xbb77('0x112')]);if(!_0x32e072){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x165129,'no\x20file\x20audio\x20found');}if(!this[_0xbb77('0x86')](_0x165129[_0xbb77('0xd8')])){return this[_0xbb77('0xe')]['error'](_0xbb77('0xd9'));}var _0x198740=this[_0xbb77('0xe')][_0xbb77('0x113')](_0x32e072,_0x165129[_0xbb77('0x114')],_0x165129['maxdigit']);var _0x38fa86=_0x198740[_0xbb77('0xa2')]?_0x198740[_0xbb77('0xa2')][_0xbb77('0x48')]():'';logger[_0xbb77('0x2d')](_0xbb77('0x115'),JSON['stringify'](_0x198740));if(_0x198740[_0xbb77('0xa2')]===-0x1){this[_0xbb77('0x33')][_0xbb77('0x71')](this,_0x165129,_0x38fa86);return _0x198740;}else if(_0x198740[_0xbb77('0xa0')]===_0xbb77('0x65')){_0x198740[_0xbb77('0xa2')]=_0x38fa86[_0xbb77('0x9e')]>=parseInt(_0x165129[_0xbb77('0x116')])?'x':'i';}else{_0x198740[_0xbb77('0xa2')]=_0x38fa86[_0xbb77('0x9e')]>=parseInt(_0x165129[_0xbb77('0x116')])&&_0x38fa86['length']<=parseInt(_0x165129[_0xbb77('0x117')])?'x':'i';}var _0x10c80f=this[_0xbb77('0x11')]['sync'](this,_0x165129[_0xbb77('0xd8')]);if(!_0x10c80f){return this['channel'][_0xbb77('0x30')](_0x165129,_0xbb77('0xda'));}this[_0xbb77('0xe')][_0xbb77('0xa4')](_0x10c80f,_0x38fa86);if(this[_0xbb77('0x86')](_0x165129['hiddendigitsnum'])){var _0x2e292d=parseInt(_0x165129[_0xbb77('0x118')],0xa);var _0x4fbb63=rs[_0xbb77('0x119')]({'charset':'*','length':_0x2e292d});var _0x44e23c=_0x38fa86[_0xbb77('0x9e')];if(_0x44e23c>0x0){if(_0x44e23c>_0x2e292d){this[_0xbb77('0x33')][_0xbb77('0x71')](this,_0x165129,_0x165129[_0xbb77('0x11a')]==='first'?_0x4fbb63+_0x38fa86[_0xbb77('0x11b')](_0x2e292d):_0x38fa86['substr'](0x0,_0x44e23c-_0x2e292d)+_0x4fbb63);}else{this['createSquareDetailsReport']['sync'](this,_0x165129,rs[_0xbb77('0x119')]({'charset':'*','length':_0x44e23c}));}}else{this[_0xbb77('0x33')]['sync'](this,_0x165129,'');}}else{this['createSquareDetailsReport'][_0xbb77('0x71')](this,_0x165129,_0x38fa86);}return _0x198740;};AGIVertices[_0xbb77('0x10')][_0xbb77('0xd')]=function(_0x3a48e4){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x11c'),_0x3a48e4[_0xbb77('0x35')]));return this[_0xbb77('0xc')](_0x3a48e4);};AGIVertices[_0xbb77('0x10')][_0xbb77('0x11d')]=function(_0x27566c){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x11e'),_0x27566c[_0xbb77('0x35')]));this[_0xbb77('0x33')]['sync'](this,_0x27566c,_0x27566c[_0xbb77('0x11f')]);return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')]('GOAL\x20%s',_0x27566c[_0xbb77('0x11f')]));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x120')]=function(_0x433977){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x121'),_0x433977['label']));if(!this[_0xbb77('0x86')](_0x433977[_0xbb77('0x89')])||!this['isConfigured'](_0x433977[_0xbb77('0x8a')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0x122'));}if(!this['isConfigured'](_0x433977['text'])){return this[_0xbb77('0xe')]['noop'](_0xbb77('0xaa'));}this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')]('Trying\x20aws\x20Polly\x20%s',_0x433977[_0xbb77('0x5a')]));var _0x13fd65=this[_0xbb77('0x88')][_0xbb77('0x71')](this,_0x433977);if(_0x13fd65){this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x123'),_0x13fd65));var _0x31ad30=this[_0xbb77('0xe')][_0xbb77('0x101')](_0x13fd65);try{fs[_0xbb77('0x102')](_0x13fd65+_0xbb77('0x103'));}catch(_0x35617f){logger[_0xbb77('0x30')](_0x35617f);}return _0x31ad30;}return this[_0xbb77('0xe')]['error'](_0x433977,_0xbb77('0x124'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x125')]=function(_0x74e5e4){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x126'),_0x74e5e4[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x74e5e4['aws_access_key_id'])||!this[_0xbb77('0x86')](_0x74e5e4[_0xbb77('0x8a')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0x122'));}if(!this['isConfigured'](_0x74e5e4[_0xbb77('0x127')])){return this[_0xbb77('0xe')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0xbb77('0x86')](_0x74e5e4['text'])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20text\x20configured');}this[_0xbb77('0xe')][_0xbb77('0xec')]=!![];this[_0xbb77('0x33')](_0x74e5e4);this[_0xbb77('0x3f')](_0x74e5e4[_0xbb77('0x5a')],'in','','');this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0x128'),_0x74e5e4[_0xbb77('0x5a')]));var _0x4a94cb=this['awsLex'][_0xbb77('0x71')](this,_0x74e5e4);if(_0x4a94cb){for(var _0x568f65 in _0x4a94cb){if(_0x4a94cb[_0xbb77('0x96')](_0x568f65)&&_[_0xbb77('0x97')](_0x4a94cb[_0x568f65])){this['channel'][_0xbb77('0xa4')](util[_0xbb77('0x51')]('AWS_LEX_%s',_0x568f65['toUpperCase']()),_0x4a94cb[_0x568f65]);}}if(_[_0xbb77('0x42')](_0x4a94cb[_0xbb77('0x77')])){return this['channel'][_0xbb77('0xa9')](_0xbb77('0x129'));}else{this[_0xbb77('0x3f')](_0x4a94cb[_0xbb77('0x77')],_0xbb77('0xf6'),'amazonlex','');return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x12a'),_0x4a94cb['message']));}}return this[_0xbb77('0xe')]['error'](_0x74e5e4,_0xbb77('0x12b'));};AGIVertices[_0xbb77('0x10')]['googleasr']=function(_0x29984b){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x12c'),_0x29984b[_0xbb77('0x35')],_0x29984b[_0xbb77('0x65')]));if(!this['isConfigured'](_0x29984b[_0xbb77('0x7b')])){return this['channel'][_0xbb77('0xa9')]('no\x20key\x20configured');}var _0x3ca710=_0xbb77('0x12d');var _0x20069d=util[_0xbb77('0x51')](_0xbb77('0x12e'),FILES_PATH,rs[_0xbb77('0x119')](0x4));var _0x2191ab=util['format'](_0xbb77('0x9d'),_0x20069d,_0x3ca710);var _0x32e82d=!![];if(_0x29984b[_0xbb77('0x12f')]===_0xbb77('0x130')){_0x32e82d=![];}var _0x3da6e7=this['channel'][_0xbb77('0x131')](_0x20069d,_0x3ca710,_0x29984b['intKey'],_0x29984b[_0xbb77('0x65')],undefined,_0x32e82d);if(_0x3da6e7['result']!==-0x1){this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0x132'),_0x2191ab));var _0x4f7399=this[_0xbb77('0x8f')][_0xbb77('0x71')](this,_0x29984b,_0x2191ab);if(_0x4f7399){for(var _0x4a8ff9 in _0x4f7399){if(_0x4f7399['hasOwnProperty'](_0x4a8ff9)){this[_0xbb77('0xe')][_0xbb77('0xa4')](util[_0xbb77('0x51')](_0xbb77('0x133'),_0x4a8ff9[_0xbb77('0x6a')]()),_0x4f7399[_0x4a8ff9]);}}return this[_0xbb77('0xe')]['noop'](util['format'](_0xbb77('0x134'),JSON[_0xbb77('0x74')](_0x4f7399)));}}return _0x3da6e7;};AGIVertices['prototype'][_0xbb77('0x135')]=function(_0x4c6ca2){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x136'),_0x4c6ca2[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x4c6ca2['appid'])){return this[_0xbb77('0xe')]['noop'](_0xbb77('0x137'));}if(!this[_0xbb77('0x86')](_0x4c6ca2[_0xbb77('0x93')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0x138'));}var _0x4c7645=_0xbb77('0x12d');var _0x338e14=util[_0xbb77('0x51')](_0xbb77('0x12e'),FILES_PATH,rs[_0xbb77('0x119')](0x4));var _0x39e9dd=util[_0xbb77('0x51')](_0xbb77('0x9d'),_0x338e14,_0x4c7645);var _0x51140a=!![];if(_0x4c6ca2[_0xbb77('0x12f')]===_0xbb77('0x130')){_0x51140a=![];}var _0x57a171=this[_0xbb77('0xe')][_0xbb77('0x131')](_0x338e14,_0x4c7645,_0x4c6ca2[_0xbb77('0x139')],_0x4c6ca2[_0xbb77('0x65')],undefined,_0x51140a);if(_0x57a171[_0xbb77('0xa2')]!==-0x1){this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x13a'),_0x39e9dd));var _0x380759=this[_0xbb77('0x91')][_0xbb77('0x71')](this,_0x4c6ca2,_0x39e9dd);if(_0x380759){for(var _0x3bba28 in _0x380759){if(_0x380759[_0xbb77('0x96')](_0x3bba28)){this[_0xbb77('0xe')][_0xbb77('0xa4')](util['format'](_0xbb77('0x13b'),_0x3bba28[_0xbb77('0x6a')]()),_0x380759[_0x3bba28]);}}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0x13c'),JSON[_0xbb77('0x74')](_0x380759)));}}return _0x57a171;};AGIVertices[_0xbb77('0x10')][_0xbb77('0x13d')]=function(_0x55eb7e){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x13e'),_0x55eb7e[_0xbb77('0x35')]));return this[_0xbb77('0xe')][_0xbb77('0x13f')](_0x55eb7e['context'],_0x55eb7e[_0xbb77('0x3c')],_0x55eb7e[_0xbb77('0x140')]);};AGIVertices[_0xbb77('0x10')][_0xbb77('0x141')]=function(_0x1bc050){logger['info'](util[_0xbb77('0x51')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1bc050[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x1bc050['condition'])){return this[_0xbb77('0xe')]['error'](_0x1bc050,_0xbb77('0x142'));}try{var _0x20dba2=eval(_0x1bc050[_0xbb77('0x143')])?_0xbb77('0x144'):'false';this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x145'),_0x1bc050[_0xbb77('0x143')],_0x20dba2));return{'code':0xc8,'result':_0x20dba2};}catch(_0x5b7fec){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x20eba3){logger['info'](util[_0xbb77('0x51')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x20eba3[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x20eba3[_0xbb77('0x146')])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x20eba3,_0xbb77('0x147'));}var _0x552c0f=this['getIntervals'][_0xbb77('0x71')](this,_0x20eba3[_0xbb77('0x146')]);if(!_0x552c0f){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x20eba3,_0xbb77('0x148'));}for(var _0x22eddb=0x0;_0x22eddb<_0x552c0f['length'];_0x22eddb+=0x1){var _0x4c3709=this[_0xbb77('0xe')]['getVariable'](util[_0xbb77('0x51')](_0xbb77('0x149'),_0x552c0f[_0x22eddb]));if(_0x4c3709[_0xbb77('0xa2')]===-0x1){return _0x4c3709;}logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x14a'),_0x552c0f[_0x22eddb],_0x4c3709[_0xbb77('0xa0')]));if(_0x4c3709[_0xbb77('0xa0')]===_0xbb77('0x144')){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x14a'),_0x552c0f[_0x22eddb],_0xbb77('0x144')));this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x14a'),_0x552c0f[_0x22eddb],_0xbb77('0x144')));return{'code':0xc8,'result':'true'};}else{logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x14a'),_0x552c0f[_0x22eddb],_0xbb77('0x14b')));this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x14a'),_0x552c0f[_0x22eddb],'false'));}}return{'code':0xc8,'result':_0xbb77('0x14b')};};AGIVertices['prototype'][_0xbb77('0x14c')]=function(_0x52801c){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x14d'),_0x52801c[_0xbb77('0x35')]));return this['channel'][_0xbb77('0x14c')]();};AGIVertices[_0xbb77('0x10')][_0xbb77('0x14e')]=function(_0x206196){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x14f'),_0x206196['label']));if(!this[_0xbb77('0x86')](_0x206196[_0xbb77('0x7b')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20key\x20configured');}var _0x419a91=_0xbb77('0x12d');var _0x1f1462=util[_0xbb77('0x51')](_0xbb77('0x12e'),FILES_PATH,rs[_0xbb77('0x119')](0x4));var _0x3395e0=util['format']('%s.%s',_0x1f1462,_0x419a91);var _0x13c3e9=!![];if(_0x206196[_0xbb77('0x12f')]===_0xbb77('0x130')){_0x13c3e9=![];}var _0x70a784=this[_0xbb77('0xe')][_0xbb77('0x131')](_0x1f1462,_0x419a91,_0x206196['intKey'],_0x206196[_0xbb77('0x65')],undefined,_0x13c3e9);if(_0x70a784[_0xbb77('0xa2')]!==-0x1){this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')]('ispeech\x20%s\x20file\x20created',_0x3395e0));var _0x29ca8b=this[_0xbb77('0x85')][_0xbb77('0x71')](this,_0x206196,_0x3395e0);if(_0x29ca8b){for(var _0x480233 in _0x29ca8b){if(_0x29ca8b[_0xbb77('0x96')](_0x480233)){this['channel'][_0xbb77('0xa4')](util['format'](_0xbb77('0x150'),_0x480233[_0xbb77('0x6a')]()),_0x29ca8b[_0x480233]);}}return this['channel']['noop'](util[_0xbb77('0x51')](_0xbb77('0x151'),JSON[_0xbb77('0x74')](_0x29ca8b)));}}return _0x70a784;};AGIVertices[_0xbb77('0x10')][_0xbb77('0x152')]=function(_0x53bca0){logger[_0xbb77('0x2d')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x53bca0[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x53bca0[_0xbb77('0x7b')])){return this['channel']['noop'](_0xbb77('0xeb'));}if(!this[_0xbb77('0x86')](_0x53bca0[_0xbb77('0x5a')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0xaa'));}this['channel'][_0xbb77('0xa9')](util[_0xbb77('0x51')]('Trying\x20ispeech\x20TTS\x20%s',_0x53bca0[_0xbb77('0x5a')]));var _0x2c0d31=this[_0xbb77('0x82')][_0xbb77('0x71')](this,_0x53bca0);if(_0x2c0d31){this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x153'),_0x2c0d31));var _0x250727=this[_0xbb77('0xe')]['streamFile'](_0x2c0d31,_0x53bca0['intKey']);try{fs[_0xbb77('0x102')](_0x2c0d31+_0xbb77('0x103'));}catch(_0x216bc7){logger['error'](_0x216bc7);}return _0x250727;}return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x53bca0,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xbb77('0x154')]=function(_0x51fdeb){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x155'),_0x51fdeb[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x51fdeb[_0xbb77('0x156')])){return this['channel'][_0xbb77('0x30')](_0x51fdeb,_0xbb77('0x157'));}logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x158'),this['channel']['callerid'],_0x51fdeb['findBy']));var _0x148775=this['agentLogin']['sync'](this,_0x51fdeb[_0xbb77('0x156')]);if(_0x148775){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x159'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0x51fdeb['findBy']));this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbb77('0xe')][_0xbb77('0x38')],_0x51fdeb['findBy']));return{'code':0xc8,'result':_0xbb77('0x15a')};}else{logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x15b'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0x51fdeb[_0xbb77('0x156')]));this['channel'][_0xbb77('0xa9')](util['format'](_0xbb77('0x15b'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0x51fdeb[_0xbb77('0x156')]));return{'code':0xc8,'result':_0xbb77('0x15c')};}};AGIVertices[_0xbb77('0x10')][_0xbb77('0x15d')]=function(_0xabffe4){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x15e'),_0xabffe4[_0xbb77('0x35')]));if(!this['isConfigured'](_0xabffe4[_0xbb77('0x156')])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0xabffe4,_0xbb77('0x157'));}logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x158'),this['channel']['callerid'],_0xabffe4[_0xbb77('0x156')]));var _0x35e5cf=this['agentLogout'][_0xbb77('0x71')](this,_0xabffe4[_0xbb77('0x156')]);if(_0x35e5cf){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbb77('0xe')][_0xbb77('0x38')],_0xabffe4[_0xbb77('0x156')]));this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x159'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0xabffe4[_0xbb77('0x156')]));return{'code':0xc8,'result':_0xbb77('0x15a')};}else{logger['info'](util['format'](_0xbb77('0x15b'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0xabffe4[_0xbb77('0x156')]));this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x15b'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0xabffe4[_0xbb77('0x156')]));return{'code':0xc8,'result':_0xbb77('0x15c')};}};AGIVertices['prototype'][_0xbb77('0x15f')]=function(_0x408c94){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x160'),_0x408c94[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x408c94['operation'])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x408c94,_0xbb77('0x161'));}this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x162'),_0x408c94['operation']));var _0x2dd748=eval(_0x408c94[_0xbb77('0x163')]);if(!this[_0xbb77('0x86')](_0x408c94['variable_id'])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0xd9'));}var _0x3eed9d=this[_0xbb77('0x11')][_0xbb77('0x71')](this,_0x408c94[_0xbb77('0xd8')]);if(!_0x3eed9d){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x408c94,_0xbb77('0xda'));}if(_[_0xbb77('0x9b')](_0x2dd748)){var _0x1b7ba7=this;_0x2dd748[_0xbb77('0xdb')](function(_0x1509c9,_0xef2005){_0x1b7ba7[_0xbb77('0xe')][_0xbb77('0xa4')](util[_0xbb77('0x51')](_0xbb77('0x164'),_0x3eed9d,_0xef2005),_0x1509c9);});return this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format']('variable\x20%s[key]\x20set',_0x3eed9d));}else{return this[_0xbb77('0xe')][_0xbb77('0xa4')](_0x3eed9d,_0x2dd748);}};AGIVertices[_0xbb77('0x10')][_0xbb77('0xb')]=function(_0x4cd1eb){logger['info'](util[_0xbb77('0x51')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4cd1eb[_0xbb77('0x35')]));if(_0x4cd1eb[_0xbb77('0xa6')]===0x0){return this[_0xbb77('0xa5')](_0x4cd1eb);}_0x4cd1eb['retry']-=0x1;if(!this[_0xbb77('0x86')](_0x4cd1eb[_0xbb77('0x112')])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x4cd1eb,_0xbb77('0x165'));}var _0x14b6bf=this[_0xbb77('0x1e')]['sync'](this,_0x4cd1eb[_0xbb77('0x112')]);if(!_0x14b6bf){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x4cd1eb,_0xbb77('0x166'));}var _0x1a7404=this['channel'][_0xbb77('0x113')](_0x14b6bf,_0x4cd1eb[_0xbb77('0x114')],_0x4cd1eb['digit']);var _0x134cf8=_0x1a7404[_0xbb77('0xa2')];if(_0x1a7404[_0xbb77('0xa2')]===-0x1){this['createSquareDetailsReport'][_0xbb77('0x71')](this,_0x4cd1eb,'-1');return _0x1a7404;}else if(_0x1a7404[_0xbb77('0xa0')]==='timeout'){_0x1a7404[_0xbb77('0xa2')]=_0x1a7404[_0xbb77('0xa2')][_0xbb77('0x9e')]>0x0?_0x1a7404[_0xbb77('0xa2')]:'t';}else if(_[_0xbb77('0x41')](_0x1a7404[_0xbb77('0xa2')])){_0x1a7404[_0xbb77('0xa2')]='#';_0x134cf8='#';}if(!this[_0xbb77('0x86')](_0x4cd1eb[_0xbb77('0xd8')])){this[_0xbb77('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x32d3ca=this[_0xbb77('0x11')][_0xbb77('0x71')](this,_0x4cd1eb[_0xbb77('0xd8')]);if(!_0x32d3ca){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x4cd1eb,_0xbb77('0xda'));}this[_0xbb77('0xe')][_0xbb77('0xa4')](_0x32d3ca,_0x134cf8);}this['createSquareDetailsReport']['sync'](this,_0x4cd1eb,_0x134cf8);return _0x1a7404;};AGIVertices['prototype'][_0xbb77('0xa9')]=function(_0x5020d6){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x167'),_0x5020d6[_0xbb77('0x35')]));return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0x5020d6[_0xbb77('0x168')]||_0x5020d6[_0xbb77('0x35')]);};AGIVertices[_0xbb77('0x10')][_0xbb77('0x169')]=function(_0x4e31d9){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x16a'),_0x4e31d9[_0xbb77('0x35')]));if(!this['isConfigured'](_0x4e31d9[_0xbb77('0x156')])){return this[_0xbb77('0xe')]['error'](_0x4e31d9,_0xbb77('0x157'));}logger['info'](util['format'](_0xbb77('0x158'),this[_0xbb77('0xe')]['callerid'],_0x4e31d9[_0xbb77('0x156')]));var _0x5a1df0=this[_0xbb77('0x16b')]['sync'](this,_0x4e31d9['pause_id']);var _0x411b8b=this['agentPause'][_0xbb77('0x71')](this,_0x4e31d9[_0xbb77('0x156')],_0x5a1df0);if(_0x411b8b){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbb77('0xe')]['callerid'],_0x4e31d9[_0xbb77('0x156')]));this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x159'),this['channel']['callerid'],_0x4e31d9[_0xbb77('0x156')]));return{'code':0xc8,'result':_0xbb77('0x15a')};}else{logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x15b'),this['channel'][_0xbb77('0x38')],_0x4e31d9[_0xbb77('0x156')]));this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x159'),this['channel'][_0xbb77('0x38')],_0x4e31d9[_0xbb77('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xbb77('0x10')]['playback']=function(_0x189114){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x16c'),_0x189114[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x189114['file_id'])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x189114,_0xbb77('0x165'));}var _0x431967=this['getSound'][_0xbb77('0x71')](this,_0x189114[_0xbb77('0x112')]);if(!_0x431967){return this['channel'][_0xbb77('0x30')](_0x189114,'no\x20file\x20audio\x20found');}var _0x96eb96=this[_0xbb77('0xe')]['exec'](_0xbb77('0x16d'),[_0x431967,_0x189114[_0xbb77('0xe8')]]);if(_0x96eb96[_0xbb77('0xa2')]===-0x1){return _0x96eb96;}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x431967));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x16e')]=function(_0x50877e){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x16f'),_0x50877e[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x50877e[_0xbb77('0x170')])){return this['channel'][_0xbb77('0x30')](_0x50877e,_0xbb77('0x171'));}var _0x21b22b='';var _0x4fcdd3=parseInt(_0x50877e[_0xbb77('0x170')],0xa);if(isNaN(_0x4fcdd3)){_0x21b22b=_0x50877e['queue_id'];}else{_0x21b22b=this[_0xbb77('0x14')]['sync'](this,_0x50877e[_0xbb77('0x170')]);if(!_0x21b22b){return this['channel']['error'](_0x50877e,_0xbb77('0x172'));}}var _0x229edd='';if(this[_0xbb77('0x86')](_0x50877e[_0xbb77('0x112')])){var _0x3a28ad=this[_0xbb77('0x1e')][_0xbb77('0x71')](this,_0x50877e[_0xbb77('0x112')]);if(_0x3a28ad){_0x229edd=_0x3a28ad;}}this[_0xbb77('0x33')][_0xbb77('0x71')](this,_0x50877e,_0x21b22b);if(_0x50877e[_0xbb77('0xe8')][_0xbb77('0x173')]('x')<0x0){_0x50877e[_0xbb77('0xe8')]+='x';}if(_0x50877e[_0xbb77('0xe8')][_0xbb77('0x173')]('X')<0x0){_0x50877e[_0xbb77('0xe8')]+='X';}this[_0xbb77('0xe')][_0xbb77('0xa4')](_0xbb77('0x174'),_0x21b22b?_0x21b22b[_0xbb77('0x175')]():'');var _0x9fc422=this[_0xbb77('0xe')]['exec'](_0xbb77('0x176'),[_0x21b22b,_0x50877e['opts'],_0x50877e[_0xbb77('0x63')],_0x229edd,_0x50877e['timeout'],_0x50877e[_0xbb77('0xb8')],_0x50877e[_0xbb77('0x177')],_0x50877e[_0xbb77('0x178')],'',_0x50877e[_0xbb77('0x179')]]);if(_0x9fc422[_0xbb77('0xa2')]===-0x1){return _0x9fc422;}return this['channel']['noop'](util[_0xbb77('0x51')](_0xbb77('0x17a'),_0xbb77('0x176'),_0x21b22b));};AGIVertices['prototype'][_0xbb77('0x17b')]=function(_0x46e4f4){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x17c'),_0x46e4f4[_0xbb77('0x35')]));var _0x5eeadc=_0x46e4f4[_0xbb77('0x17d')]||_0xbb77('0x12d');var _0x57ad40=util[_0xbb77('0x51')](_0xbb77('0x17e'),this[_0xbb77('0xe')]['uniqueid'],rs[_0xbb77('0x119')](0x5));var _0x255e86=util[_0xbb77('0x51')](_0xbb77('0x17f'),FILES_PATH,_0x57ad40,_0x5eeadc);var _0x14bf3e=util['format'](_0xbb77('0x12e'),FILES_PATH,_0x57ad40);this[_0xbb77('0x39')]['sync'](this,_0x46e4f4,_0x57ad40,_0x255e86);this['channel'][_0xbb77('0xa4')](_0xbb77('0x180'),_0x57ad40);logger[_0xbb77('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x14bf3e,_0x5eeadc,_0x46e4f4[_0xbb77('0x181')],_0x46e4f4['timeout']);return this[_0xbb77('0xe')][_0xbb77('0x131')](_0x14bf3e,_0x5eeadc,_0x46e4f4[_0xbb77('0x181')],_0x46e4f4[_0xbb77('0x65')],undefined,!![]);};AGIVertices['prototype'][_0xbb77('0x182')]=function(_0x3f257b){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x183'),_0x3f257b[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x3f257b['url'])){return this['channel'][_0xbb77('0xa9')](_0xbb77('0x184'));}var _0x2b50b1=this[_0xbb77('0x185')][_0xbb77('0x71')](this,_0x3f257b);logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Response:',util['inspect'](_0x2b50b1,{'showHidden':![],'depth':null})));if(!this[_0xbb77('0x86')](_0x3f257b[_0xbb77('0xd8')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0x186'));}var _0x449b6d=this[_0xbb77('0x11')]['sync'](this,_0x3f257b[_0xbb77('0xd8')]);if(!_0x449b6d){return this['channel'][_0xbb77('0x30')](_0x3f257b,_0xbb77('0xda'));}this['channel']['setVariable'](util['format'](_0xbb77('0x187'),_0x449b6d),_0x2b50b1[_0xbb77('0x76')]?_0x2b50b1[_0xbb77('0x76')]:'200');this[_0xbb77('0xe')]['setVariable'](util[_0xbb77('0x51')](_0xbb77('0x188'),_0x449b6d),_0x2b50b1[_0xbb77('0x189')]?_0x2b50b1['statusMessage']:'OK');if(_0x2b50b1['body']){try{this[_0xbb77('0x9c')](_0x2b50b1[_0xbb77('0x6b')],_0x449b6d);}catch(_0x54ced3){logger[_0xbb77('0x30')](util[_0xbb77('0x51')](_0xbb77('0x18a'),_0x449b6d));}}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0xdf'),_0x449b6d));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x18b')]=function(_0x360e1a){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x18c'),_0x360e1a[_0xbb77('0x35')]));return this['channel'][_0xbb77('0x18d')](_0x360e1a[_0xbb77('0x18e')][_0xbb77('0x56')](/\s+/g,''),_0x360e1a[_0xbb77('0x181')]);};AGIVertices[_0xbb77('0x10')][_0xbb77('0x18f')]=function(_0x1266e2){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x190'),_0x1266e2[_0xbb77('0x35')]));return this['channel'][_0xbb77('0x191')](_0x1266e2[_0xbb77('0x66')][_0xbb77('0x56')](/\s+/g,''),_0x1266e2[_0xbb77('0x181')]);};AGIVertices[_0xbb77('0x10')][_0xbb77('0x192')]=function(_0x42222){logger['info'](util['format'](_0xbb77('0x193'),_0x42222['label']));return this[_0xbb77('0xe')][_0xbb77('0x194')](_0x42222[_0xbb77('0x5a')],_0x42222[_0xbb77('0x181')]);};AGIVertices[_0xbb77('0x10')]['sendMail']=function(_0x58f0ec){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x195'),_0x58f0ec[_0xbb77('0x35')]));if(!this['isConfigured'](_0x58f0ec[_0xbb77('0x196')])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20mail\x20account\x20configured');}var _0x2738ef=this[_0xbb77('0x22')][_0xbb77('0x71')](this,_0x58f0ec[_0xbb77('0x196')]);if(!_0x2738ef||!_0x2738ef[_0xbb77('0x197')]){return this[_0xbb77('0xe')]['error'](_0x58f0ec,_0xbb77('0x198'));}var _0xec5b7f={'from':util[_0xbb77('0x51')](_0xbb77('0x199'),_0x2738ef[_0xbb77('0x13')],_0x2738ef['email']||_0x2738ef[_0xbb77('0x197')][_0xbb77('0x19a')]),'to':_0x58f0ec['to']||'','cc':_0x58f0ec['cc']||'','bcc':_0x58f0ec[_0xbb77('0x19b')]||'','subject':_0x58f0ec[_0xbb77('0x19c')],'html':_0x58f0ec[_0xbb77('0x5a')],'text':_0x58f0ec['text']};var _0x5bed4a={'tls':{'rejectUnauthorized':![]}};if(_0x2738ef[_0xbb77('0x197')][_0xbb77('0x19d')]){_0x5bed4a[_0xbb77('0x19d')]=_0x2738ef[_0xbb77('0x197')][_0xbb77('0x19d')];}else{_0x5bed4a[_0xbb77('0x19e')]=_0x2738ef[_0xbb77('0x197')][_0xbb77('0x19e')];_0x5bed4a['port']=_0x2738ef[_0xbb77('0x197')][_0xbb77('0x19f')];_0x5bed4a[_0xbb77('0x1a0')]=_0x2738ef[_0xbb77('0x197')]['secure'];}if(_0x2738ef[_0xbb77('0x197')][_0xbb77('0x1a1')]){_0x5bed4a['auth']={'user':_0x2738ef[_0xbb77('0x197')][_0xbb77('0x19a')],'pass':_0x2738ef[_0xbb77('0x197')][_0xbb77('0x1a2')]};}if(this[_0xbb77('0x86')](_0x58f0ec['template_id'])){}logger[_0xbb77('0xe1')](_0xbb77('0x1a3'),JSON['stringify'](_0xec5b7f));this[_0xbb77('0x33')][_0xbb77('0x71')](this,_0x58f0ec,_0x58f0ec[_0xbb77('0x196')]);this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x1a4'),_0x2738ef[_0xbb77('0x13')]));this[_0xbb77('0x24')][_0xbb77('0x71')](this,_0x5bed4a,_0xec5b7f);return this['channel'][_0xbb77('0xa9')](_0xbb77('0x1a5'));};AGIVertices[_0xbb77('0x10')]['sendFax']=function(_0x344fe7){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x1a6'),_0x344fe7[_0xbb77('0x35')]));return this['channel'][_0xbb77('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1a7')]=function(_0x85e124){logger['info'](util[_0xbb77('0x51')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x85e124['label']));if(!this['isConfigured'](_0x85e124['sms_account_id'])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20sms\x20account\x20configured');}var _0x10af10=this['getSmsAccount'][_0xbb77('0x71')](this,_0x85e124[_0xbb77('0x1a8')]);if(!_0x10af10){return this[_0xbb77('0xe')]['error'](_0x85e124,'no\x20sms\x20account\x20found');}var _0x4fc7f0={'body':_0x85e124[_0xbb77('0x1a9')],'phone':_0x85e124['to']||'','SmsAccountId':_0x10af10['id']};logger['debug'](_0xbb77('0x1aa'),JSON[_0xbb77('0x74')](_0x4fc7f0));this[_0xbb77('0x33')][_0xbb77('0x71')](this,_0x85e124,_0x85e124[_0xbb77('0x1a8')]);this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x10af10[_0xbb77('0x13')]));this[_0xbb77('0x32')][_0xbb77('0x71')](this,_0x4fc7f0);return this[_0xbb77('0xe')][_0xbb77('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1ab')]=function(_0x1afbf6){logger['info'](util[_0xbb77('0x51')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1afbf6['label']));if(!this[_0xbb77('0x86')](_0x1afbf6[_0xbb77('0xd8')])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x1afbf6,_0xbb77('0x1ac'));}var _0x4e338c=this[_0xbb77('0x11')][_0xbb77('0x71')](this,_0x1afbf6[_0xbb77('0xd8')]);if(!_0x4e338c){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x1afbf6,_0xbb77('0xda'));}return this['channel'][_0xbb77('0xa4')](_0x4e338c,_0x1afbf6['variable_value']);};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1ad')]=function(_0x5a5eca){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x1ae'),_0x5a5eca['label']));this[_0xbb77('0xe')]['noop'](_0xbb77('0x1af'));if(_0x5a5eca[_0xbb77('0xbc')]===_0xbb77('0x1b0')){this[_0xbb77('0xe')][_0xbb77('0xa9')](_0xbb77('0x1b1'));return this['channel'][_0xbb77('0xbc')]();}return this['channel'][_0xbb77('0xa9')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xbb77('0x1b2')]=function(_0x3eda66){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x1b3'),_0x3eda66[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0x3eda66['project_id'])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x3eda66,'no\x20subproject\x20selected');}var _0x3e7c45=this['getSquareProject'][_0xbb77('0x71')](this,_0x3eda66[_0xbb77('0x1b4')]);if(!this[_0xbb77('0x86')](_0x3e7c45)){return this['channel']['error'](_0x3eda66,util[_0xbb77('0x51')](_0xbb77('0x1b5'),_0x3eda66['project_id']));}if(_0x3e7c45===this[_0xbb77('0xe')][_0xbb77('0x37')]){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x3eda66,_0xbb77('0x1b6'));}this[_0xbb77('0x33')]['sync'](this,_0x3eda66,_0x3e7c45);var _0x194896=this[_0xbb77('0xe')]['exec'](_0xbb77('0x1b7'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xbb77('0xb8')]['host']||_0xbb77('0x1b8'),_0x3e7c45,this[_0xbb77('0xe')][_0xbb77('0x37')]));if(_0x194896['result']===-0x1){return _0x194896;}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x17a'),_0xbb77('0x1b7'),_0x3e7c45));};AGIVertices[_0xbb77('0x10')]['system']=function(_0x17569e){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x1b9'),_0x17569e[_0xbb77('0x35')]));var _0x279c02=this[_0xbb77('0x53')][_0xbb77('0x71')](this,_0x17569e[_0xbb77('0xba')]);this[_0xbb77('0x33')][_0xbb77('0x71')](this,_0x17569e,_0x17569e[_0xbb77('0xba')]);if(this['isConfigured'](_0x17569e[_0xbb77('0xd8')])){var _0x324fc5=this[_0xbb77('0x11')][_0xbb77('0x71')](this,_0x17569e[_0xbb77('0xd8')]);if(_0x324fc5){this[_0xbb77('0xe')][_0xbb77('0xa4')](_0x324fc5,_0x279c02);return this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x17569e[_0xbb77('0xba')],_0x324fc5));}}return this[_0xbb77('0xe')][_0xbb77('0xa9')](util['format'](_0xbb77('0x1ba'),_0x17569e[_0xbb77('0xba')]));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1bb')]=function(_0x19cda4){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x19cda4['label']));_0x19cda4[_0xbb77('0x5a')]=_0x19cda4[_0xbb77('0x5a')][_0xbb77('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x19cda4[_0xbb77('0x58')])){return this[_0xbb77('0xe')]['noop'](_0xbb77('0x1bc'));}if(!this[_0xbb77('0x86')](_0x19cda4[_0xbb77('0x5a')])){return this['channel']['noop'](_0xbb77('0xaa'));}this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x1bd'),_0x19cda4[_0xbb77('0x5a')]));var _0x3a70c1=this['googleCloudTTS']['sync'](this,_0x19cda4);if(_0x3a70c1){this['channel'][_0xbb77('0xa9')](util['format'](_0xbb77('0x1be'),_0x3a70c1));var _0x9793a4=this[_0xbb77('0xe')][_0xbb77('0x101')](_0x3a70c1);try{fs[_0xbb77('0x102')](_0x3a70c1+_0xbb77('0x103'));}catch(_0x1f4563){logger[_0xbb77('0x30')](_0x1f4563);}return _0x9793a4;}return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x19cda4,_0xbb77('0x1bf'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1c0')]=function(_0x2655bd){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')](_0xbb77('0x1c1'),_0x2655bd['label']));_0x2655bd[_0xbb77('0x5a')]=_0x2655bd[_0xbb77('0x5a')][_0xbb77('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbb77('0x86')](_0x2655bd['text'])){return this[_0xbb77('0xe')][_0xbb77('0xa9')]('no\x20text\x20configured');}this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x1c2'),_0x2655bd['text']));var _0x52ea4d=this[_0xbb77('0x61')][_0xbb77('0x71')](this,_0x2655bd);if(_0x52ea4d){this[_0xbb77('0xe')][_0xbb77('0xa9')](util[_0xbb77('0x51')](_0xbb77('0x1c3'),_0x52ea4d));var _0x20658c=this[_0xbb77('0xe')][_0xbb77('0x101')](_0x52ea4d);try{fs[_0xbb77('0x102')](_0x52ea4d+_0xbb77('0x103'));}catch(_0x534e12){logger[_0xbb77('0x30')](_0x534e12);}return _0x20658c;}return this['channel']['error'](_0x2655bd,_0xbb77('0x1c4'));};AGIVertices[_0xbb77('0x10')][_0xbb77('0x1c5')]=function(_0xb79ffd){logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x1c6'),_0xb79ffd[_0xbb77('0x35')]));if(!this[_0xbb77('0x86')](_0xb79ffd[_0xbb77('0x156')])){return this['channel'][_0xbb77('0x30')](_0xb79ffd,_0xbb77('0x157'));}logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x158'),this[_0xbb77('0xe')]['callerid'],_0xb79ffd[_0xbb77('0x156')]));var _0x5f4376=this['agentUnpause'][_0xbb77('0x71')](this,_0xb79ffd[_0xbb77('0x156')]);if(_0x5f4376){logger['info'](util[_0xbb77('0x51')](_0xbb77('0x159'),this['channel']['callerid'],_0xb79ffd[_0xbb77('0x156')]));this['channel']['noop'](util['format'](_0xbb77('0x159'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0xb79ffd[_0xbb77('0x156')]));return{'code':0xc8,'result':_0xbb77('0x15a')};}else{logger[_0xbb77('0x2d')](util['format'](_0xbb77('0x15b'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0xb79ffd[_0xbb77('0x156')]));this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')](_0xbb77('0x15b'),this[_0xbb77('0xe')][_0xbb77('0x38')],_0xb79ffd['findBy']));return{'code':0xc8,'result':_0xbb77('0x15c')};}};AGIVertices['prototype'][_0xbb77('0x1c7')]=function(_0x4a7d29){logger[_0xbb77('0x2d')](util[_0xbb77('0x51')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4a7d29[_0xbb77('0x35')]));var _0x39f4b0=this['channel'][_0xbb77('0x54')]('VOICEMAIL',[_0x4a7d29[_0xbb77('0x1c8')],_0x4a7d29[_0xbb77('0x79')]]);if(_0x39f4b0[_0xbb77('0xa2')]===-0x1){return _0x39f4b0;}return this[_0xbb77('0xe')]['noop'](util[_0xbb77('0x51')]('Executed\x20command\x20%s\x20%s',_0xbb77('0x1c9'),_0x4a7d29['mailbox']));};AGIVertices['prototype'][_0xbb77('0x1ca')]=function(_0x1a3890){logger[_0xbb77('0x2d')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1a3890['label']));if(!this[_0xbb77('0x86')](_0x1a3890[_0xbb77('0xd8')])){return this[_0xbb77('0xe')][_0xbb77('0x30')](_0x1a3890,'no\x20variable\x20selected');}var _0x349b01=this[_0xbb77('0x11')][_0xbb77('0x71')](this,_0x1a3890[_0xbb77('0xd8')]);if(!_0x349b01){return this['channel'][_0xbb77('0x30')](_0x1a3890,_0xbb77('0xda'));}var _0x56ca2e=this[_0xbb77('0xe')][_0xbb77('0x11')](_0x349b01);return{'code':0xc8,'result':_0x56ca2e[_0xbb77('0xa0')]?_0x56ca2e[_0xbb77('0xa0')]:'-'};};String['prototype'][_0xbb77('0x1cb')]=function(_0x1d2122,_0x1a009b){return this['split'](_0x1d2122)[_0xbb77('0x1cc')](_0x1a009b);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 799778c..c637711 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 _0x0eb9=['lastPauseAt','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','stopAcw','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw'];(function(_0x34ad09,_0xba8f16){var _0x4c8431=function(_0x78b555){while(--_0x78b555){_0x34ad09['push'](_0x34ad09['shift']());}};_0x4c8431(++_0xba8f16);}(_0x0eb9,0x7e));var _0x90eb=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x0eb9[_0x149ca0];return _0x56b6b9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x90eb('0x0'));var ami=require(_0x90eb('0x1'));var logger=require(_0x90eb('0x2'))(_0x90eb('0x3'));var RpcUser=require(_0x90eb('0x4'));var RpcVoiceAgentReport=require(_0x90eb('0x5'));function Acw(_0x541435){this[_0x90eb('0x6')]=_0x541435[_0x90eb('0x6')];this[_0x90eb('0x7')]=_0x541435['agents'];this[_0x90eb('0x8')]=_0x541435[_0x90eb('0x8')];this['channels']={};ami['on'](_0x90eb('0x9'),this['syncAgentConnect'][_0x90eb('0xa')](this));ami['on'](_0x90eb('0xb'),this[_0x90eb('0xc')]['bind'](this));ami['on'](_0x90eb('0xd'),this[_0x90eb('0xe')][_0x90eb('0xa')](this));ami['on'](_0x90eb('0xf'),this[_0x90eb('0x10')][_0x90eb('0xa')](this));ami['on'](_0x90eb('0x11'),this[_0x90eb('0x12')][_0x90eb('0xa')](this));ami['on']('blindtransfer',this[_0x90eb('0x13')][_0x90eb('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x90eb('0x14')]['bind'](this));}function getDiff(_0x539c22){var _0x189b3c=moment()[_0x90eb('0x15')](0x0);var _0x1e5eb1=moment(_0x539c22)[_0x90eb('0x15')](0x0);return _0x189b3c[_0x90eb('0x16')](_0x1e5eb1,'seconds');}Acw[_0x90eb('0x17')][_0x90eb('0x18')]=function(_0x418c6b){try{var _0xa565c2=this;var _0xda5e=this[_0x90eb('0x19')][_0x418c6b][_0x90eb('0x1a')];var _0x5dac45=this[_0x90eb('0x19')][_0x418c6b][_0x90eb('0x1b')];var _0xd37f04=this['voiceQueues'][_0x5dac45];var _0x4ef8a9=![];var _0x5c1bf0='ACW';if(_0xd37f04[_0x90eb('0x1c')]){if(_0xd37f04[_0x90eb('0x1d')][_0x90eb('0x1e')]){_0x4ef8a9=!![];_0x5c1bf0=_0xd37f04[_0x90eb('0x1d')][_0x90eb('0x1e')];}}ami[_0x90eb('0x1f')]({'action':_0x90eb('0x20'),'interface':_0xda5e,'paused':!![],'reason':_0x5c1bf0})['then'](function(_0x4603a9){if(_0xa565c2[_0x90eb('0x7')][_0xda5e]){return RpcUser[_0x90eb('0x21')](_0xa565c2[_0x90eb('0x7')][_0xda5e]['id'])[_0x90eb('0x22')](function(_0x4b1c80){if(_0x4b1c80&&!_0x4b1c80[_0x90eb('0x23')]){logger['info'](_0x90eb('0x24'),_0x418c6b,_0xda5e,_0x5dac45);var _0x2b19b9=_0xa565c2[_0x90eb('0x19')][_0x418c6b][_0x90eb('0x25')]&&_0xa565c2[_0x90eb('0x19')][_0x418c6b][_0x90eb('0x26')]?_0xa565c2['channels'][_0x418c6b][_0x90eb('0x26')]:_0x418c6b;return RpcUser[_0x90eb('0x27')](_0xa565c2[_0x90eb('0x7')][_0xda5e],_0x5c1bf0,_0x2b19b9)['then'](function(_0x207e12){if(!_0x4ef8a9){_0xa565c2['timers'][_0xda5e]={};logger[_0x90eb('0x28')](_0x90eb('0x29'),_0x418c6b,_0xa565c2[_0x90eb('0x6')][_0x5dac45][_0x90eb('0x2a')],_0xda5e,_0x5dac45);_0xa565c2['timers'][_0xda5e][_0x90eb('0x2b')]=setTimeout(_0xa565c2['stopAcw']['bind'](_0xa565c2,_0xda5e),_0xa565c2['voiceQueues'][_0x5dac45][_0x90eb('0x2a')]*0x3e8);_0xa565c2[_0x90eb('0x8')][_0xda5e]['lastPauseAt']=moment()[_0x90eb('0x2c')](_0x90eb('0x2d'));_0xa565c2[_0x90eb('0x8')][_0xda5e][_0x90eb('0x2e')]=_0x418c6b;_0xa565c2[_0x90eb('0x8')][_0xda5e]['queue']=_0x5dac45;_0xa565c2['timers'][_0xda5e][_0x90eb('0x2f')]=function(){var _0x1046fe=getDiff(_0xa565c2[_0x90eb('0x8')][_0xda5e][_0x90eb('0x30')]);clearTimeout(_0xa565c2[_0x90eb('0x8')][_0xda5e]['timer']);_0xa565c2[_0x90eb('0x8')][_0xda5e][_0x90eb('0x2b')]=![];RpcVoiceAgentReport[_0x90eb('0x31')]({'acwtime':_0x1046fe},_0xa565c2[_0x90eb('0x8')][_0xda5e][_0x90eb('0x2e')],_0xda5e)[_0x90eb('0x22')](function(_0x1010a7){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x418c6b,_0x1046fe,_0x1010a7);})[_0x90eb('0x32')](function(_0x39f1b7){logger[_0x90eb('0x33')](_0x90eb('0x34'),_0x418c6b,_0x39f1b7);});delete _0xa565c2[_0x90eb('0x8')][_0xda5e];};}});}else{logger[_0x90eb('0x28')](_0x90eb('0x35'),_0x418c6b,_0xda5e,_0x5dac45);}});}})[_0x90eb('0x32')](function(_0x3f51c2){logger[_0x90eb('0x33')](_0x90eb('0x29'),_0x418c6b,_0xa565c2[_0x90eb('0x6')][_0x5dac45][_0x90eb('0x2a')],_0xda5e,_0x5dac45);})['finally'](function(){delete _0xa565c2[_0x90eb('0x19')][_0x418c6b];});}catch(_0x359ab4){logger[_0x90eb('0x33')](_0x90eb('0x36'),_0x359ab4['message']);}};Acw[_0x90eb('0x17')][_0x90eb('0x37')]=function(_0x2d823b){try{var _0x56209d=this;if(_0x56209d['timers'][_0x2d823b]){_0x56209d[_0x90eb('0x8')][_0x2d823b][_0x90eb('0x2b')]=![];var _0x153731=_0x56209d['timers'][_0x2d823b][_0x90eb('0x2e')];var _0x33d016=_0x56209d['timers'][_0x2d823b][_0x90eb('0x1b')];var _0x5208d9=_0x56209d[_0x90eb('0x6')][_0x33d016][_0x90eb('0x2a')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x153731,_0x2d823b);RpcUser[_0x90eb('0x38')](this[_0x90eb('0x7')][_0x2d823b]);RpcVoiceAgentReport['update']({'acwtime':_0x5208d9,'agentacw':!![]},_0x153731,_0x2d823b)[_0x90eb('0x22')](function(_0x218567){logger[_0x90eb('0x28')](_0x90eb('0x39'),_0x153731,_0x5208d9,_0x218567);})[_0x90eb('0x32')](function(_0x2911d3){logger[_0x90eb('0x33')](_0x90eb('0x34'),_0x153731,_0x2911d3);});}else{logger[_0x90eb('0x33')](_0x90eb('0x3a'),_0x2d823b);if(_0x56209d['timers']){logger[_0x90eb('0x28')](_0x90eb('0x3b'),JSON[_0x90eb('0x3c')](_0x56209d[_0x90eb('0x8')]));}}}catch(_0x44be77){logger[_0x90eb('0x33')](_0x90eb('0x3d'),_0x44be77[_0x90eb('0x3e')]);}};Acw[_0x90eb('0x17')]['syncAgentConnect']=function(_0x24bdb5){try{if(this[_0x90eb('0x6')][_0x24bdb5[_0x90eb('0x1b')]]&&(this[_0x90eb('0x6')][_0x24bdb5['queue']][_0x90eb('0x3')]||this['voiceQueues'][_0x24bdb5['queue']][_0x90eb('0x1c')])){if(this[_0x90eb('0x7')][_0x24bdb5[_0x90eb('0x1a')]]){this[_0x90eb('0x19')][_0x24bdb5[_0x90eb('0x2e')]]={'queue':_0x24bdb5['queue'],'interface':_0x24bdb5[_0x90eb('0x1a')],'destlinkedid':_0x24bdb5['destlinkedid']};}}}catch(_0x1ffb28){logger[_0x90eb('0x33')](_0x90eb('0x3f'),_0x1ffb28[_0x90eb('0x3e')]);}};Acw[_0x90eb('0x17')]['syncAgentConnectPreview']=function(_0x4db188){try{if(this[_0x90eb('0x6')][_0x4db188[_0x90eb('0x1b')]]&&(this[_0x90eb('0x6')][_0x4db188[_0x90eb('0x1b')]][_0x90eb('0x3')]||this[_0x90eb('0x6')][_0x4db188[_0x90eb('0x1b')]]['mandatoryDisposition'])){if(this['agents'][_0x4db188[_0x90eb('0x1a')]]){this['channels'][_0x4db188[_0x90eb('0x2e')]]={'queue':_0x4db188['queue'],'interface':_0x4db188[_0x90eb('0x1a')]};}}}catch(_0x1a55fd){logger['error'](_0x90eb('0x40'),_0x1a55fd[_0x90eb('0x3e')]);}};Acw[_0x90eb('0x17')][_0x90eb('0xc')]=function(_0x18fe83){try{if(this[_0x90eb('0x19')][_0x18fe83[_0x90eb('0x2e')]]&&_['isUndefined'](this[_0x90eb('0x19')][_0x18fe83['uniqueid']][_0x90eb('0x25')])){logger[_0x90eb('0x28')](_0x90eb('0x41'),_0x18fe83['uniqueid']);this[_0x90eb('0x18')](_0x18fe83[_0x90eb('0x2e')]);}else if(this[_0x90eb('0x19')][_0x18fe83['linkedid']]&&_[_0x90eb('0x42')](this[_0x90eb('0x19')][_0x18fe83['linkedid']]['attended'])){logger[_0x90eb('0x28')](_0x90eb('0x43'),_0x18fe83[_0x90eb('0x44')]);this[_0x90eb('0x18')](_0x18fe83[_0x90eb('0x44')]);}}catch(_0x21f88e){logger[_0x90eb('0x33')](_0x90eb('0x45'),_0x21f88e['message']);}};Acw['prototype']['syncHangup']=function(_0x22a21c){try{if(this['channels'][_0x22a21c[_0x90eb('0x2e')]]&&this['channels'][_0x22a21c[_0x90eb('0x2e')]]['attended']){logger[_0x90eb('0x28')](_0x90eb('0x46'),_0x22a21c[_0x90eb('0x2e')]);this[_0x90eb('0x18')](_0x22a21c[_0x90eb('0x2e')]);}else if(this[_0x90eb('0x19')][_0x22a21c['linkedid']]&&this[_0x90eb('0x19')][_0x22a21c[_0x90eb('0x44')]]['attended']){logger[_0x90eb('0x28')](_0x90eb('0x47'),_0x22a21c['linkedid']);this[_0x90eb('0x18')](_0x22a21c['linkedid']);}}catch(_0x13487c){logger['error'](_0x90eb('0x48'),_0x13487c['message']);}};Acw[_0x90eb('0x17')]['syncAttendedTransfer']=function(_0x196f44){try{if(!_[_0x90eb('0x49')](this[_0x90eb('0x19')][_0x196f44[_0x90eb('0x4a')]])){this[_0x90eb('0x18')](_0x196f44['transfereeuniqueid']);if(this[_0x90eb('0x19')][_0x196f44['secondtransfereruniqueid']]){this['channels'][_0x196f44[_0x90eb('0x4b')]][_0x90eb('0x25')]=!![];this['channels'][_0x196f44['transfertargetuniqueid']]=this[_0x90eb('0x19')][_0x196f44[_0x90eb('0x4b')]];delete this[_0x90eb('0x19')][_0x196f44['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x90eb('0x19')][_0x196f44[_0x90eb('0x4c')]])){this[_0x90eb('0x18')](_0x196f44[_0x90eb('0x4c')]);if(this['channels'][_0x196f44['origtransfereruniqueid']]){this[_0x90eb('0x19')][_0x196f44[_0x90eb('0x4d')]][_0x90eb('0x25')]=!![];this[_0x90eb('0x19')][_0x196f44['transfereeuniqueid']]=this[_0x90eb('0x19')][_0x196f44[_0x90eb('0x4d')]];delete this[_0x90eb('0x19')][_0x196f44[_0x90eb('0x4d')]];}}}catch(_0x5ad34c){logger[_0x90eb('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0x5ad34c['message']);}};Acw[_0x90eb('0x17')][_0x90eb('0x13')]=function(_0x1fcb22){try{if(this[_0x90eb('0x19')][_0x1fcb22['transfereruniqueid']]){logger['info'](_0x90eb('0x4e'),JSON[_0x90eb('0x3c')](_0x1fcb22[_0x90eb('0x4f')]));this['startAcw'](_0x1fcb22[_0x90eb('0x4f')]);}else if(this[_0x90eb('0x19')][_0x1fcb22[_0x90eb('0x50')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x90eb('0x3c')](_0x1fcb22['transfererlinkedid']));this[_0x90eb('0x18')](_0x1fcb22[_0x90eb('0x50')]);}}catch(_0x1b0e79){logger[_0x90eb('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x1b0e79[_0x90eb('0x3e')]);}};Acw[_0x90eb('0x17')][_0x90eb('0x10')]=function(_0x2b32b1){try{if(this[_0x90eb('0x6')][_0x2b32b1['queue']]&&this['voiceQueues'][_0x2b32b1['queue']][_0x90eb('0x51')]===_0x90eb('0x52')){if(this[_0x90eb('0x7')][_0x2b32b1[_0x90eb('0x1a')]]){logger['info'](_0x90eb('0x53'),_0x2b32b1[_0x90eb('0x2e')],_0x2b32b1[_0x90eb('0x1a')],_0x2b32b1[_0x90eb('0x1b')]);return RpcUser[_0x90eb('0x27')](this[_0x90eb('0x7')][_0x2b32b1[_0x90eb('0x1a')]],_0x90eb('0x54'),_0x2b32b1[_0x90eb('0x2e')]);}}}catch(_0xa81dc6){logger[_0x90eb('0x33')](_0x90eb('0x55'),_0xa81dc6['message']);}};module[_0x90eb('0x56')]=Acw; \ No newline at end of file +var _0x2c0b=['bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','prototype','interface','channels','queue','ACW','mandatoryDispositionPause','name','Action','getAgent','then','voicePause','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect'];(function(_0x2f344f,_0x6be7d1){var _0x55cebd=function(_0x51b168){while(--_0x51b168){_0x2f344f['push'](_0x2f344f['shift']());}};_0x55cebd(++_0x6be7d1);}(_0x2c0b,0x97));var _0xb2c0=function(_0x5cd8f5,_0x40d613){_0x5cd8f5=_0x5cd8f5-0x0;var _0x106283=_0x2c0b[_0x5cd8f5];return _0x106283;};'use strict';var util=require(_0xb2c0('0x0'));var _=require(_0xb2c0('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xb2c0('0x2'));var RpcUser=require(_0xb2c0('0x3'));var RpcVoiceAgentReport=require(_0xb2c0('0x4'));function Acw(_0xb2c1ab){this[_0xb2c0('0x5')]=_0xb2c1ab['voiceQueues'];this['agents']=_0xb2c1ab[_0xb2c0('0x6')];this[_0xb2c0('0x7')]=_0xb2c1ab[_0xb2c0('0x7')];this['channels']={};ami['on'](_0xb2c0('0x8'),this['syncAgentConnect'][_0xb2c0('0x9')](this));ami['on'](_0xb2c0('0xa'),this['syncHangupRequest'][_0xb2c0('0x9')](this));ami['on'](_0xb2c0('0xb'),this[_0xb2c0('0xc')]['bind'](this));ami['on'](_0xb2c0('0xd'),this[_0xb2c0('0xe')][_0xb2c0('0x9')](this));ami['on'](_0xb2c0('0xf'),this[_0xb2c0('0x10')][_0xb2c0('0x9')](this));ami['on'](_0xb2c0('0x11'),this[_0xb2c0('0x12')]['bind'](this));ami['on'](_0xb2c0('0x13'),this[_0xb2c0('0x14')][_0xb2c0('0x9')](this));}function getDiff(_0x23db58){var _0x553cd2=moment()['milliseconds'](0x0);var _0x23f05d=moment(_0x23db58)['milliseconds'](0x0);return _0x553cd2['diff'](_0x23f05d,'seconds');}Acw[_0xb2c0('0x15')]['startAcw']=function(_0x2124db){try{var _0x8c9cea=this;var _0x59550a=this['channels'][_0x2124db][_0xb2c0('0x16')];var _0x106ff3=this[_0xb2c0('0x17')][_0x2124db][_0xb2c0('0x18')];var _0xba1b26=this[_0xb2c0('0x5')][_0x106ff3];var _0x5b052b=![];var _0x2038b6=_0xb2c0('0x19');if(_0xba1b26['mandatoryDisposition']){if(_0xba1b26[_0xb2c0('0x1a')][_0xb2c0('0x1b')]){_0x5b052b=!![];_0x2038b6=_0xba1b26[_0xb2c0('0x1a')][_0xb2c0('0x1b')];}}ami[_0xb2c0('0x1c')]({'action':'QueuePause','interface':_0x59550a,'paused':!![],'reason':_0x2038b6})['then'](function(_0x43ed3e){if(_0x8c9cea[_0xb2c0('0x6')][_0x59550a]){return RpcUser[_0xb2c0('0x1d')](_0x8c9cea[_0xb2c0('0x6')][_0x59550a]['id'])[_0xb2c0('0x1e')](function(_0x124347){if(_0x124347&&!_0x124347[_0xb2c0('0x1f')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x2124db,_0x59550a,_0x106ff3);var _0x4d94a8=_0x8c9cea[_0xb2c0('0x17')][_0x2124db][_0xb2c0('0x20')]&&_0x8c9cea['channels'][_0x2124db]['destlinkedid']?_0x8c9cea[_0xb2c0('0x17')][_0x2124db][_0xb2c0('0x21')]:_0x2124db;return RpcUser['savePause'](_0x8c9cea['agents'][_0x59550a],_0x2038b6,_0x4d94a8)[_0xb2c0('0x1e')](function(_0x2f54a3){if(!_0x5b052b){_0x8c9cea[_0xb2c0('0x7')][_0x59550a]={};logger['info'](_0xb2c0('0x22'),_0x2124db,_0x8c9cea[_0xb2c0('0x5')][_0x106ff3][_0xb2c0('0x23')],_0x59550a,_0x106ff3);_0x8c9cea[_0xb2c0('0x7')][_0x59550a][_0xb2c0('0x24')]=setTimeout(_0x8c9cea['stopAcw'][_0xb2c0('0x9')](_0x8c9cea,_0x59550a),_0x8c9cea['voiceQueues'][_0x106ff3][_0xb2c0('0x23')]*0x3e8);_0x8c9cea[_0xb2c0('0x7')][_0x59550a][_0xb2c0('0x25')]=moment()['format'](_0xb2c0('0x26'));_0x8c9cea[_0xb2c0('0x7')][_0x59550a][_0xb2c0('0x27')]=_0x2124db;_0x8c9cea[_0xb2c0('0x7')][_0x59550a]['queue']=_0x106ff3;_0x8c9cea[_0xb2c0('0x7')][_0x59550a][_0xb2c0('0x28')]=function(){var _0x2eb08f=getDiff(_0x8c9cea[_0xb2c0('0x7')][_0x59550a][_0xb2c0('0x25')]);clearTimeout(_0x8c9cea['timers'][_0x59550a][_0xb2c0('0x24')]);_0x8c9cea[_0xb2c0('0x7')][_0x59550a][_0xb2c0('0x24')]=![];RpcVoiceAgentReport[_0xb2c0('0x29')]({'acwtime':_0x2eb08f},_0x8c9cea[_0xb2c0('0x7')][_0x59550a][_0xb2c0('0x27')],_0x59550a)[_0xb2c0('0x1e')](function(_0x5b10c3){logger[_0xb2c0('0x2a')](_0xb2c0('0x2b'),_0x2124db,_0x2eb08f,_0x5b10c3);})[_0xb2c0('0x2c')](function(_0x2d5a96){logger[_0xb2c0('0x2d')](_0xb2c0('0x2e'),_0x2124db,_0x2d5a96);});delete _0x8c9cea[_0xb2c0('0x7')][_0x59550a];};}});}else{logger[_0xb2c0('0x2a')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2124db,_0x59550a,_0x106ff3);}});}})[_0xb2c0('0x2c')](function(_0x1a80b0){logger[_0xb2c0('0x2d')](_0xb2c0('0x22'),_0x2124db,_0x8c9cea[_0xb2c0('0x5')][_0x106ff3][_0xb2c0('0x23')],_0x59550a,_0x106ff3);})[_0xb2c0('0x2f')](function(){delete _0x8c9cea[_0xb2c0('0x17')][_0x2124db];});}catch(_0x264e6d){logger[_0xb2c0('0x2d')]('[ACW][START]\x20%s',_0x264e6d[_0xb2c0('0x30')]);}};Acw[_0xb2c0('0x15')][_0xb2c0('0x31')]=function(_0x16a94f){try{var _0x21b0ef=this;if(_0x21b0ef[_0xb2c0('0x7')][_0x16a94f]){_0x21b0ef[_0xb2c0('0x7')][_0x16a94f][_0xb2c0('0x24')]=![];var _0x555e2c=_0x21b0ef[_0xb2c0('0x7')][_0x16a94f]['uniqueid'];var _0x1ee6ac=_0x21b0ef[_0xb2c0('0x7')][_0x16a94f][_0xb2c0('0x18')];var _0x58cd35=_0x21b0ef['voiceQueues'][_0x1ee6ac]['acwTimeout'];logger[_0xb2c0('0x2a')](_0xb2c0('0x32'),_0x555e2c,_0x16a94f);RpcUser[_0xb2c0('0x33')](this[_0xb2c0('0x6')][_0x16a94f]);RpcVoiceAgentReport[_0xb2c0('0x29')]({'acwtime':_0x58cd35,'agentacw':!![]},_0x555e2c,_0x16a94f)[_0xb2c0('0x1e')](function(_0x5de2f6){logger['info'](_0xb2c0('0x2b'),_0x555e2c,_0x58cd35,_0x5de2f6);})[_0xb2c0('0x2c')](function(_0x34cd8c){logger['error'](_0xb2c0('0x2e'),_0x555e2c,_0x34cd8c);});}else{logger['error'](_0xb2c0('0x34'),_0x16a94f);if(_0x21b0ef['timers']){logger['info'](_0xb2c0('0x35'),JSON['stringify'](_0x21b0ef['timers']));}}}catch(_0x3abb17){logger[_0xb2c0('0x2d')](_0xb2c0('0x36'),_0x3abb17[_0xb2c0('0x30')]);}};Acw[_0xb2c0('0x15')][_0xb2c0('0x37')]=function(_0x567b97){try{if(this[_0xb2c0('0x5')][_0x567b97[_0xb2c0('0x18')]]&&(this[_0xb2c0('0x5')][_0x567b97[_0xb2c0('0x18')]][_0xb2c0('0x2')]||this[_0xb2c0('0x5')][_0x567b97[_0xb2c0('0x18')]]['mandatoryDisposition'])){if(this[_0xb2c0('0x6')][_0x567b97[_0xb2c0('0x16')]]){this[_0xb2c0('0x17')][_0x567b97[_0xb2c0('0x27')]]={'queue':_0x567b97[_0xb2c0('0x18')],'interface':_0x567b97['interface'],'destlinkedid':_0x567b97[_0xb2c0('0x21')]};}}}catch(_0x397168){logger[_0xb2c0('0x2d')](_0xb2c0('0x38'),_0x397168[_0xb2c0('0x30')]);}};Acw[_0xb2c0('0x15')][_0xb2c0('0x14')]=function(_0x452003){try{if(this[_0xb2c0('0x5')][_0x452003[_0xb2c0('0x18')]]&&(this[_0xb2c0('0x5')][_0x452003[_0xb2c0('0x18')]][_0xb2c0('0x2')]||this[_0xb2c0('0x5')][_0x452003[_0xb2c0('0x18')]]['mandatoryDisposition'])){if(this['agents'][_0x452003['interface']]){this[_0xb2c0('0x17')][_0x452003[_0xb2c0('0x27')]]={'queue':_0x452003['queue'],'interface':_0x452003['interface']};}}}catch(_0x591724){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x591724[_0xb2c0('0x30')]);}};Acw['prototype'][_0xb2c0('0x39')]=function(_0x557e7b){try{if(this[_0xb2c0('0x17')][_0x557e7b['uniqueid']]&&_[_0xb2c0('0x3a')](this[_0xb2c0('0x17')][_0x557e7b['uniqueid']][_0xb2c0('0x20')])){logger[_0xb2c0('0x2a')](_0xb2c0('0x3b'),_0x557e7b[_0xb2c0('0x27')]);this[_0xb2c0('0x3c')](_0x557e7b[_0xb2c0('0x27')]);}else if(this[_0xb2c0('0x17')][_0x557e7b['linkedid']]&&_['isUndefined'](this[_0xb2c0('0x17')][_0x557e7b[_0xb2c0('0x3d')]][_0xb2c0('0x20')])){logger[_0xb2c0('0x2a')](_0xb2c0('0x3e'),_0x557e7b[_0xb2c0('0x3d')]);this['startAcw'](_0x557e7b['linkedid']);}}catch(_0x256334){logger[_0xb2c0('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0x256334[_0xb2c0('0x30')]);}};Acw[_0xb2c0('0x15')][_0xb2c0('0xc')]=function(_0x2d07ce){try{if(this['channels'][_0x2d07ce[_0xb2c0('0x27')]]&&this[_0xb2c0('0x17')][_0x2d07ce['uniqueid']][_0xb2c0('0x20')]){logger[_0xb2c0('0x2a')](_0xb2c0('0x3f'),_0x2d07ce[_0xb2c0('0x27')]);this[_0xb2c0('0x3c')](_0x2d07ce['uniqueid']);}else if(this[_0xb2c0('0x17')][_0x2d07ce[_0xb2c0('0x3d')]]&&this[_0xb2c0('0x17')][_0x2d07ce[_0xb2c0('0x3d')]][_0xb2c0('0x20')]){logger[_0xb2c0('0x2a')](_0xb2c0('0x40'),_0x2d07ce[_0xb2c0('0x3d')]);this[_0xb2c0('0x3c')](_0x2d07ce[_0xb2c0('0x3d')]);}}catch(_0x509cf4){logger[_0xb2c0('0x2d')]('[ACW][syncHangup]\x20%s',_0x509cf4['message']);}};Acw[_0xb2c0('0x15')][_0xb2c0('0x10')]=function(_0x4861b1){try{if(!_[_0xb2c0('0x41')](this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x42')]])){this[_0xb2c0('0x3c')](_0x4861b1[_0xb2c0('0x42')]);if(this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x43')]]){this['channels'][_0x4861b1[_0xb2c0('0x43')]][_0xb2c0('0x20')]=!![];this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x44')]]=this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x43')]];delete this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x43')]];}}else if(!_[_0xb2c0('0x41')](this['channels'][_0x4861b1[_0xb2c0('0x44')]])){this[_0xb2c0('0x3c')](_0x4861b1[_0xb2c0('0x44')]);if(this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x45')]]){this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x45')]][_0xb2c0('0x20')]=!![];this['channels'][_0x4861b1[_0xb2c0('0x42')]]=this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x45')]];delete this[_0xb2c0('0x17')][_0x4861b1[_0xb2c0('0x45')]];}}}catch(_0x47c35d){logger['error'](_0xb2c0('0x46'),_0x47c35d[_0xb2c0('0x30')]);}};Acw[_0xb2c0('0x15')][_0xb2c0('0x12')]=function(_0x1d9686){try{if(this[_0xb2c0('0x17')][_0x1d9686[_0xb2c0('0x47')]]){logger[_0xb2c0('0x2a')](_0xb2c0('0x48'),JSON['stringify'](_0x1d9686[_0xb2c0('0x47')]));this['startAcw'](_0x1d9686[_0xb2c0('0x47')]);}else if(this['channels'][_0x1d9686['transfererlinkedid']]){logger[_0xb2c0('0x2a')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb2c0('0x49')](_0x1d9686[_0xb2c0('0x4a')]));this[_0xb2c0('0x3c')](_0x1d9686['transfererlinkedid']);}}catch(_0x3cc6ca){logger[_0xb2c0('0x2d')](_0xb2c0('0x4b'),_0x3cc6ca[_0xb2c0('0x30')]);}};Acw[_0xb2c0('0x15')][_0xb2c0('0xe')]=function(_0x32a6d7){try{if(this[_0xb2c0('0x5')][_0x32a6d7['queue']]&&this[_0xb2c0('0x5')][_0x32a6d7[_0xb2c0('0x18')]][_0xb2c0('0x4c')]==='all'){if(this[_0xb2c0('0x6')][_0x32a6d7['interface']]){logger[_0xb2c0('0x2a')](_0xb2c0('0x4d'),_0x32a6d7[_0xb2c0('0x27')],_0x32a6d7[_0xb2c0('0x16')],_0x32a6d7['queue']);return RpcUser['savePause'](this[_0xb2c0('0x6')][_0x32a6d7[_0xb2c0('0x16')]],_0xb2c0('0x4e'),_0x32a6d7['uniqueid']);}}}catch(_0x50a544){logger[_0xb2c0('0x2d')](_0xb2c0('0x4f'),_0x50a544[_0xb2c0('0x30')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index af7d4ca..d52a1ac 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 _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x3f549c,_0x2c4674){var _0x53744d=function(_0xbba25e){while(--_0xbba25e){_0x3f549c['push'](_0x3f549c['shift']());}};_0x53744d(++_0x2c4674);}(_0xb10b,0x12a));var _0xbb10=function(_0x358fd3,_0x4a9c44){_0x358fd3=_0x358fd3-0x0;var _0x1ad0f3=_0xb10b[_0x358fd3];return _0x1ad0f3;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2032,0xd9));var _0x2203=function(_0x5491e1,_0x1e9e28){_0x5491e1=_0x5491e1-0x0;var _0xebda19=_0x2032[_0x5491e1];return _0xebda19;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index faad7d7..1223f74 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0xa6df52,_0x1b8584){var _0x5edd57=function(_0x543f11){while(--_0x543f11){_0xa6df52['push'](_0xa6df52['shift']());}};_0x5edd57(++_0x1b8584);}(_0x9bde,0xe1));var _0xe9bd=function(_0x173549,_0x4f0f4d){_0x173549=_0x173549-0x0;var _0x4ba77f=_0x9bde[_0x173549];return _0x4ba77f;};'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 +var _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x269421,_0x54ceb9){var _0x240c3f=function(_0x450ac6){while(--_0x450ac6){_0x269421['push'](_0x269421['shift']());}};_0x240c3f(++_0x54ceb9);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5a087d,_0x3ad1e5){_0x5a087d=_0x5a087d-0x0;var _0x1bf6ec=_0x9ffd[_0x5a087d];return _0x1bf6ec;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 0b899f3..becebf2 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe890=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout'];(function(_0x5f502a,_0x2dc524){var _0x418bb3=function(_0x5f393d){while(--_0x5f393d){_0x5f502a['push'](_0x5f502a['shift']());}};_0x418bb3(++_0x2dc524);}(_0xe890,0xbe));var _0x0e89=function(_0x48df6e,_0x2c8ba3){_0x48df6e=_0x48df6e-0x0;var _0x43f43a=_0xe890[_0x48df6e];return _0x43f43a;};'use strict';var util=require(_0x0e89('0x0'));var _=require('lodash');var moment=require(_0x0e89('0x1'));function checkNameSurname(_0x54fd5e,_0x50abf9,_0x51cc4a){var _0x2a3392='';if(!_[_0x0e89('0x2')](_0x50abf9)&&'string'===typeof _0x50abf9){_0x2a3392+=_0x50abf9;}if(!_[_0x0e89('0x2')](_0x51cc4a)&&_0x0e89('0x3')===typeof _0x51cc4a){_0x2a3392+='\x20'+_0x51cc4a;}if(_0x2a3392!==''){return _0x2a3392;}return _0x54fd5e;}function Action(_0x3e3c17,_0xdd33c7,_0x19ba6e){this[_0x0e89('0x4')]=_0x3e3c17;this[_0x0e89('0x5')]=_0x19ba6e||undefined;this[_0x0e89('0x6')]=checkNameSurname(_0xdd33c7[_0x0e89('0x7')][_0x0e89('0x8')],_0xdd33c7[_0x0e89('0x7')][_0x0e89('0x9')],_0xdd33c7[_0x0e89('0x7')]['lastName']);this[_0x0e89('0xa')]=_0xdd33c7[_0x0e89('0x7')][_0x0e89('0x8')];this[_0x0e89('0xb')]=_0x3e3c17[_0x0e89('0x6')];this[_0x0e89('0xc')]=_0xdd33c7[_0x0e89('0xc')]||![];this[_0x0e89('0xd')]=_0x3e3c17[_0x0e89('0xd')];this['dialQueueTimeout']=_0x3e3c17[_0x0e89('0xe')]||0x3;this['scheduledat']=_0xdd33c7[_0x0e89('0xf')];this[_0x0e89('0x10')]=_0xdd33c7[_0x0e89('0x10')];this[_0x0e89('0x11')]=_0xdd33c7[_0x0e89('0x11')];this[_0x0e89('0x12')]=_0xdd33c7[_0x0e89('0x12')];this[_0x0e89('0x13')]=_0xdd33c7['countnosuchnumberretry'];this[_0x0e89('0x14')]=_0xdd33c7[_0x0e89('0x14')];this[_0x0e89('0x15')]=_0xdd33c7[_0x0e89('0x15')];this[_0x0e89('0x16')]=_0xdd33c7[_0x0e89('0x16')];this[_0x0e89('0x17')]=_0xdd33c7[_0x0e89('0x17')];this[_0x0e89('0x18')]=_0xdd33c7[_0x0e89('0x18')];this[_0x0e89('0x19')]=_0xdd33c7[_0x0e89('0x19')];this[_0x0e89('0x1a')]=_0xdd33c7[_0x0e89('0x1a')];this['VoiceQueueId']=_0xdd33c7['VoiceQueueId'];this['CampaignId']=_0xdd33c7['CampaignId'];this['idHopper']=_0xdd33c7['id'];this[_0x0e89('0x1b')]=_0xdd33c7[_0x0e89('0x7')][_0x0e89('0x9')]||'';this[_0x0e89('0x1c')]=moment()[_0x0e89('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0e89('0x1e')]=_0xdd33c7['callback'];this[_0x0e89('0x1f')]=_0xdd33c7['callbackuniqueid'];this[_0x0e89('0x20')]=_0xdd33c7['callbackat'];this[_0x0e89('0x21')]=_0xdd33c7['recallme'];this[_0x0e89('0x22')]='';this[_0x0e89('0x23')]='';}Action['prototype'][_0x0e89('0x24')]=function(){return util[_0x0e89('0x1d')](_0x0e89('0x25'),this[_0x0e89('0x6')],this['voiceQueue'][_0x0e89('0x26')]>0x0?this[_0x0e89('0xa')][_0x0e89('0x27')](this[_0x0e89('0x4')]['dialCutDigit']):this['number']);};Action['prototype']['getQueue']=function(){return this[_0x0e89('0xb')];};module[_0x0e89('0x28')]=Action; \ No newline at end of file +var _0x5409=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','queue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','Contact','phone','number'];(function(_0x315ef2,_0x4ca8a3){var _0x23eec8=function(_0x269f4b){while(--_0x269f4b){_0x315ef2['push'](_0x315ef2['shift']());}};_0x23eec8(++_0x4ca8a3);}(_0x5409,0xf3));var _0x9540=function(_0x3f300e,_0x1a4cec){_0x3f300e=_0x3f300e-0x0;var _0x1f3114=_0x5409[_0x3f300e];return _0x1f3114;};'use strict';var util=require(_0x9540('0x0'));var _=require(_0x9540('0x1'));var moment=require('moment');function checkNameSurname(_0x9c0afd,_0x55e8b1,_0x58b817){var _0x3a76c4='';if(!_[_0x9540('0x2')](_0x55e8b1)&&_0x9540('0x3')===typeof _0x55e8b1){_0x3a76c4+=_0x55e8b1;}if(!_[_0x9540('0x2')](_0x58b817)&&_0x9540('0x3')===typeof _0x58b817){_0x3a76c4+='\x20'+_0x58b817;}if(_0x3a76c4!==''){return _0x3a76c4;}return _0x9c0afd;}function Action(_0x518e9e,_0x5a6b76,_0x381c91){this[_0x9540('0x4')]=_0x518e9e;this[_0x9540('0x5')]=_0x381c91||undefined;this['name']=checkNameSurname(_0x5a6b76[_0x9540('0x6')][_0x9540('0x7')],_0x5a6b76[_0x9540('0x6')]['firstName'],_0x5a6b76[_0x9540('0x6')]['lastName']);this[_0x9540('0x8')]=_0x5a6b76[_0x9540('0x6')][_0x9540('0x7')];this['queue']=_0x518e9e['name'];this[_0x9540('0x9')]=_0x5a6b76[_0x9540('0x9')]||![];this[_0x9540('0xa')]=_0x518e9e[_0x9540('0xa')];this[_0x9540('0xb')]=_0x518e9e[_0x9540('0xb')]||0x3;this[_0x9540('0xc')]=_0x5a6b76[_0x9540('0xc')];this[_0x9540('0xd')]=_0x5a6b76[_0x9540('0xd')];this[_0x9540('0xe')]=_0x5a6b76[_0x9540('0xe')];this['countnoanswerretry']=_0x5a6b76[_0x9540('0xf')];this[_0x9540('0x10')]=_0x5a6b76['countnosuchnumberretry'];this['countdropretry']=_0x5a6b76[_0x9540('0x11')];this[_0x9540('0x12')]=_0x5a6b76['countabandonedretry'];this['countmachineretry']=_0x5a6b76[_0x9540('0x13')];this[_0x9540('0x14')]=_0x5a6b76[_0x9540('0x14')];this[_0x9540('0x15')]=_0x5a6b76[_0x9540('0x15')];this['ListId']=_0x5a6b76['ListId'];this[_0x9540('0x16')]=_0x5a6b76[_0x9540('0x16')];this[_0x9540('0x17')]=_0x5a6b76[_0x9540('0x17')];this[_0x9540('0x18')]=_0x5a6b76[_0x9540('0x18')];this[_0x9540('0x19')]=_0x5a6b76['id'];this[_0x9540('0x1a')]=_0x5a6b76[_0x9540('0x6')]['firstName']||'';this[_0x9540('0x1b')]=moment()[_0x9540('0x1c')](_0x9540('0x1d'));this[_0x9540('0x1e')]=_0x5a6b76['callback'];this[_0x9540('0x1f')]=_0x5a6b76['callbackuniqueid'];this[_0x9540('0x20')]=_0x5a6b76[_0x9540('0x20')];this[_0x9540('0x21')]=_0x5a6b76['recallme'];this[_0x9540('0x22')]='';this['originatecalleridname']='';}Action[_0x9540('0x23')][_0x9540('0x24')]=function(){return util[_0x9540('0x1c')](_0x9540('0x25'),this['name'],this[_0x9540('0x4')][_0x9540('0x26')]>0x0?this['number'][_0x9540('0x27')](this[_0x9540('0x4')]['dialCutDigit']):this[_0x9540('0x8')]);};Action[_0x9540('0x23')]['getQueue']=function(){return this[_0x9540('0x28')];};module[_0x9540('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 5eb735b..bdd66ea 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb132=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','state','campaigntype','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb132,0x114));var _0x2b13=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0xb132[_0x2aefb6];return _0x202772;};'use strict';var util=require(_0x2b13('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x24324e,_0x1fae95){var _0x2903f2=moment(_0x24324e)['milliseconds'](0x0);var _0x20ccbe=moment(_0x1fae95)[_0x2b13('0x1')](0x0);return _0x2903f2['diff'](_0x20ccbe,'seconds');}function AgentComplete(_0x4ad29e,_0x21bc98){this[_0x2b13('0x2')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x4ad29e['scheduledat'];this['type']=_0x4ad29e['type'];this[_0x2b13('0x3')]=_0x4ad29e['type']==='outbound'?_0x2b13('0x4'):_0x4ad29e[_0x2b13('0x5')];this[_0x2b13('0x6')]=_0x4ad29e[_0x2b13('0x6')];this['countcongestionretry']=_0x4ad29e[_0x2b13('0x7')];this[_0x2b13('0x8')]=_0x4ad29e['countnoanswerretry'];this['countglobal']=_0x4ad29e[_0x2b13('0x6')]+_0x4ad29e[_0x2b13('0x7')]+_0x4ad29e[_0x2b13('0x8')]+_0x4ad29e[_0x2b13('0x9')]+_0x4ad29e[_0x2b13('0xa')]+_0x4ad29e[_0x2b13('0xb')]+_0x4ad29e['countmachineretry']+_0x4ad29e['countagentrejectretry'];this[_0x2b13('0x9')]=_0x4ad29e[_0x2b13('0x9')];this['countdropretry']=_0x4ad29e[_0x2b13('0xa')];this['countabandonedretry']=_0x4ad29e[_0x2b13('0xb')];this[_0x2b13('0xc')]=_0x4ad29e[_0x2b13('0xc')];this[_0x2b13('0xd')]=_0x4ad29e['countagentrejectretry'];this[_0x2b13('0xe')]=_0x21bc98['uniqueid'];this['calleridname']=_0x4ad29e[_0x2b13('0xf')];this[_0x2b13('0x10')]=_0x4ad29e['number'];this[_0x2b13('0x11')]=_0x4ad29e['starttime'];this[_0x2b13('0x12')]=_0x4ad29e[_0x2b13('0x12')];this[_0x2b13('0x13')]=_0x4ad29e[_0x2b13('0x13')];this[_0x2b13('0x14')]=moment()[_0x2b13('0x15')](_0x2b13('0x16'));this['ringtime']=getSeconds(_0x4ad29e[_0x2b13('0x12')],_0x4ad29e[_0x2b13('0x11')]);this[_0x2b13('0x17')]=getSeconds(_0x4ad29e['answertime'],_0x4ad29e[_0x2b13('0x12')]);this[_0x2b13('0x18')]=getSeconds(this[_0x2b13('0x14')],_0x4ad29e['answertime']);this['queue']=_0x21bc98['queue'];this[_0x2b13('0x19')]=_0x21bc98[_0x2b13('0x19')];this[_0x2b13('0x1a')]=_0x21bc98[_0x2b13('0x1a')];this['callback']=_0x4ad29e[_0x2b13('0x1b')];this[_0x2b13('0x1c')]=_0x4ad29e[_0x2b13('0x1c')];this[_0x2b13('0x1d')]=_0x4ad29e[_0x2b13('0x1d')];this[_0x2b13('0x1e')]=_0x4ad29e['recallme'];this[_0x2b13('0x1f')]=_0x4ad29e[_0x2b13('0x1f')];this[_0x2b13('0x20')]=_0x4ad29e[_0x2b13('0x20')];this[_0x2b13('0x21')]=_0x4ad29e['UserId'];this[_0x2b13('0x22')]=_0x4ad29e[_0x2b13('0x22')];this[_0x2b13('0x23')]=_0x4ad29e[_0x2b13('0x23')];this['originatecalleridnum']=_0x4ad29e[_0x2b13('0x24')]||'';this[_0x2b13('0x25')]=_0x4ad29e[_0x2b13('0x25')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x2a00=['endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','ringtime','holdtime','talktime'];(function(_0x3be28b,_0x30955f){var _0x3c6dec=function(_0x16eb0a){while(--_0x16eb0a){_0x3be28b['push'](_0x3be28b['shift']());}};_0x3c6dec(++_0x30955f);}(_0x2a00,0x1db));var _0x02a0=function(_0x327811,_0x3a1eaf){_0x327811=_0x327811-0x0;var _0x598800=_0x2a00[_0x327811];return _0x598800;};'use strict';var util=require(_0x02a0('0x0'));var _=require(_0x02a0('0x1'));var moment=require('moment');function getSeconds(_0x2db674,_0x5d09a0){var _0x32ae11=moment(_0x2db674)[_0x02a0('0x2')](0x0);var _0xbf95de=moment(_0x5d09a0)[_0x02a0('0x2')](0x0);return _0x32ae11[_0x02a0('0x3')](_0xbf95de,_0x02a0('0x4'));}function AgentComplete(_0x25dfd1,_0x3e19c5){this[_0x02a0('0x5')]=0x4;this[_0x02a0('0x6')]='Answer';this[_0x02a0('0x7')]=_0x25dfd1[_0x02a0('0x7')];this[_0x02a0('0x8')]=_0x25dfd1[_0x02a0('0x8')];this[_0x02a0('0x9')]=_0x25dfd1[_0x02a0('0x8')]==='outbound'?_0x02a0('0xa'):_0x25dfd1[_0x02a0('0x8')];this[_0x02a0('0xb')]=_0x25dfd1[_0x02a0('0xb')];this[_0x02a0('0xc')]=_0x25dfd1[_0x02a0('0xc')];this[_0x02a0('0xd')]=_0x25dfd1[_0x02a0('0xd')];this[_0x02a0('0xe')]=_0x25dfd1['countbusyretry']+_0x25dfd1['countcongestionretry']+_0x25dfd1['countnoanswerretry']+_0x25dfd1[_0x02a0('0xf')]+_0x25dfd1[_0x02a0('0x10')]+_0x25dfd1['countabandonedretry']+_0x25dfd1[_0x02a0('0x11')]+_0x25dfd1['countagentrejectretry'];this[_0x02a0('0xf')]=_0x25dfd1[_0x02a0('0xf')];this[_0x02a0('0x10')]=_0x25dfd1[_0x02a0('0x10')];this['countabandonedretry']=_0x25dfd1[_0x02a0('0x12')];this[_0x02a0('0x11')]=_0x25dfd1[_0x02a0('0x11')];this['countagentrejectretry']=_0x25dfd1[_0x02a0('0x13')];this['uniqueid']=_0x3e19c5[_0x02a0('0x14')];this[_0x02a0('0x15')]=_0x25dfd1[_0x02a0('0x16')];this[_0x02a0('0x17')]=_0x25dfd1[_0x02a0('0x18')];this[_0x02a0('0x19')]=_0x25dfd1[_0x02a0('0x19')];this[_0x02a0('0x1a')]=_0x25dfd1[_0x02a0('0x1a')];this['answertime']=_0x25dfd1[_0x02a0('0x1b')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x02a0('0x1c')]=getSeconds(_0x25dfd1[_0x02a0('0x1a')],_0x25dfd1[_0x02a0('0x19')]);this[_0x02a0('0x1d')]=getSeconds(_0x25dfd1[_0x02a0('0x1b')],_0x25dfd1[_0x02a0('0x1a')]);this[_0x02a0('0x1e')]=getSeconds(this[_0x02a0('0x1f')],_0x25dfd1['answertime']);this[_0x02a0('0xa')]=_0x3e19c5[_0x02a0('0xa')];this[_0x02a0('0x20')]=_0x3e19c5[_0x02a0('0x20')];this[_0x02a0('0x21')]=_0x3e19c5['reason'];this['callback']=_0x25dfd1[_0x02a0('0x22')];this[_0x02a0('0x23')]=_0x25dfd1[_0x02a0('0x23')];this[_0x02a0('0x24')]=_0x25dfd1['callbackat'];this[_0x02a0('0x25')]=_0x25dfd1[_0x02a0('0x25')];this['ContactId']=_0x25dfd1[_0x02a0('0x26')];this[_0x02a0('0x27')]=_0x25dfd1[_0x02a0('0x27')];this['UserId']=_0x25dfd1[_0x02a0('0x28')];this['VoiceQueueId']=_0x25dfd1[_0x02a0('0x29')];this[_0x02a0('0x2a')]=_0x25dfd1[_0x02a0('0x2a')];this[_0x02a0('0x2b')]=_0x25dfd1['originatecalleridnum']||'';this[_0x02a0('0x2c')]=_0x25dfd1[_0x02a0('0x2c')]||'';}module[_0x02a0('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 4d31765..3ab0635 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb99=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xcb99,0x8b));var _0x9cb9=function(_0xfdec06,_0x9fa2f4){_0xfdec06=_0xfdec06-0x0;var _0x58a539=_0xcb99[_0xfdec06];return _0x58a539;};'use strict';var util=require(_0x9cb9('0x0'));var _=require('lodash');var moment=require(_0x9cb9('0x1'));function getSeconds(_0x52af95,_0x480364){var _0x3a2f21=moment(_0x52af95)[_0x9cb9('0x2')](0x0);var _0x124c48=moment(_0x480364)['milliseconds'](0x0);return _0x3a2f21[_0x9cb9('0x3')](_0x124c48,_0x9cb9('0x4'));}function Final(_0x544d32){this[_0x9cb9('0x5')]=_0x544d32['uniqueid'];this[_0x9cb9('0x6')]=_0x544d32[_0x9cb9('0x6')];this[_0x9cb9('0x7')]=_0x544d32[_0x9cb9('0x7')];this[_0x9cb9('0x8')]=_0x544d32[_0x9cb9('0x7')]===_0x9cb9('0x9')?_0x9cb9('0xa'):_0x544d32['type'];this['countbusyretry']=_0x544d32[_0x9cb9('0xb')];this[_0x9cb9('0xc')]=_0x544d32[_0x9cb9('0xc')];this['countnoanswerretry']=_0x544d32[_0x9cb9('0xd')];this[_0x9cb9('0xe')]=_0x544d32['countbusyretry']+_0x544d32['countcongestionretry']+_0x544d32[_0x9cb9('0xd')]+_0x544d32[_0x9cb9('0xf')]+_0x544d32[_0x9cb9('0x10')]+_0x544d32[_0x9cb9('0x11')]+_0x544d32['countmachineretry']+_0x544d32[_0x9cb9('0x12')];this[_0x9cb9('0xf')]=_0x544d32[_0x9cb9('0xf')];this[_0x9cb9('0x10')]=_0x544d32[_0x9cb9('0x10')];this[_0x9cb9('0x11')]=_0x544d32[_0x9cb9('0x11')];this[_0x9cb9('0x13')]=_0x544d32[_0x9cb9('0x13')];this[_0x9cb9('0x12')]=_0x544d32[_0x9cb9('0x12')];this[_0x9cb9('0xa')]=_0x544d32[_0x9cb9('0xa')];this[_0x9cb9('0x14')]=_0x544d32[_0x9cb9('0x14')];this[_0x9cb9('0x15')]=_0x544d32[_0x9cb9('0x15')];this[_0x9cb9('0x16')]=_0x544d32['starttime'];this['responsetime']=_0x544d32[_0x9cb9('0x17')];this['endtime']=_0x544d32['responsetime'];this['ringtime']=_0x544d32[_0x9cb9('0x18')]||0x0;this['holdtime']=_0x544d32[_0x9cb9('0x19')]||0x0;this[_0x9cb9('0x1a')]=_0x544d32[_0x9cb9('0x1a')]||0x0;this[_0x9cb9('0x1b')]=_0x544d32[_0x9cb9('0x1b')];this[_0x9cb9('0x1c')]=_0x544d32[_0x9cb9('0x1c')];this[_0x9cb9('0x1d')]=_0x544d32[_0x9cb9('0x1d')];this[_0x9cb9('0x1e')]=_0x544d32[_0x9cb9('0x1e')];this[_0x9cb9('0x1f')]=_0x544d32[_0x9cb9('0x1f')];this[_0x9cb9('0x20')]=_0x544d32['ListId'];this['UserId']=_0x544d32[_0x9cb9('0x21')];this[_0x9cb9('0x22')]=_0x544d32[_0x9cb9('0x22')];this[_0x9cb9('0x23')]=_0x544d32[_0x9cb9('0x23')];this[_0x9cb9('0x24')]=_0x544d32[_0x9cb9('0x24')]||'';this[_0x9cb9('0x25')]=_0x544d32[_0x9cb9('0x25')]||'';}module['exports']=Final; \ No newline at end of file +var _0x02a7=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0x02a7,0x7a));var _0x702a=function(_0x187680,_0x1f7779){_0x187680=_0x187680-0x0;var _0x2b8794=_0x02a7[_0x187680];return _0x2b8794;};'use strict';var util=require('util');var _=require(_0x702a('0x0'));var moment=require('moment');function getSeconds(_0x4f12c4,_0x30b64d){var _0x30573e=moment(_0x4f12c4)[_0x702a('0x1')](0x0);var _0xd65b34=moment(_0x30b64d)[_0x702a('0x1')](0x0);return _0x30573e[_0x702a('0x2')](_0xd65b34,_0x702a('0x3'));}function Final(_0x4a1d02){this[_0x702a('0x4')]=_0x4a1d02['uniqueid'];this[_0x702a('0x5')]=_0x4a1d02[_0x702a('0x5')];this[_0x702a('0x6')]=_0x4a1d02[_0x702a('0x6')];this[_0x702a('0x7')]=_0x4a1d02[_0x702a('0x6')]===_0x702a('0x8')?'queue':_0x4a1d02[_0x702a('0x6')];this['countbusyretry']=_0x4a1d02['countbusyretry'];this[_0x702a('0x9')]=_0x4a1d02[_0x702a('0x9')];this[_0x702a('0xa')]=_0x4a1d02[_0x702a('0xa')];this['countglobal']=_0x4a1d02[_0x702a('0xb')]+_0x4a1d02[_0x702a('0x9')]+_0x4a1d02[_0x702a('0xa')]+_0x4a1d02[_0x702a('0xc')]+_0x4a1d02[_0x702a('0xd')]+_0x4a1d02[_0x702a('0xe')]+_0x4a1d02[_0x702a('0xf')]+_0x4a1d02['countagentrejectretry'];this['countnosuchnumberretry']=_0x4a1d02[_0x702a('0xc')];this['countdropretry']=_0x4a1d02['countdropretry'];this['countabandonedretry']=_0x4a1d02['countabandonedretry'];this['countmachineretry']=_0x4a1d02[_0x702a('0xf')];this[_0x702a('0x10')]=_0x4a1d02[_0x702a('0x10')];this['queue']=_0x4a1d02['queue'];this['calleridname']=_0x4a1d02[_0x702a('0x11')];this[_0x702a('0x12')]=_0x4a1d02[_0x702a('0x12')];this['starttime']=_0x4a1d02[_0x702a('0x13')];this['responsetime']=_0x4a1d02[_0x702a('0x14')];this[_0x702a('0x15')]=_0x4a1d02['responsetime'];this['ringtime']=_0x4a1d02[_0x702a('0x16')]||0x0;this[_0x702a('0x17')]=_0x4a1d02[_0x702a('0x17')]||0x0;this[_0x702a('0x18')]=_0x4a1d02[_0x702a('0x18')]||0x0;this[_0x702a('0x19')]=_0x4a1d02[_0x702a('0x19')];this[_0x702a('0x1a')]=_0x4a1d02[_0x702a('0x1a')];this[_0x702a('0x1b')]=_0x4a1d02['callbackat'];this[_0x702a('0x1c')]=_0x4a1d02[_0x702a('0x1c')];this[_0x702a('0x1d')]=_0x4a1d02[_0x702a('0x1d')];this[_0x702a('0x1e')]=_0x4a1d02[_0x702a('0x1e')];this[_0x702a('0x1f')]=_0x4a1d02[_0x702a('0x1f')];this[_0x702a('0x20')]=_0x4a1d02['VoiceQueueId'];this[_0x702a('0x21')]=_0x4a1d02[_0x702a('0x21')];this['originatecalleridnum']=_0x4a1d02[_0x702a('0x22')]||'';this[_0x702a('0x23')]=_0x4a1d02[_0x702a('0x23')]||'';}module[_0x702a('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b25bbb4..59539ff 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x099a=['countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','format','ringtime','holdtime','talktime','endtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x099a,0x10f));var _0xa099=function(_0xf8d80e,_0x442160){_0xf8d80e=_0xf8d80e-0x0;var _0x510240=_0x099a[_0xf8d80e];return _0x510240;};'use strict';var util=require(_0xa099('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x235018,_0x57c9af){var _0x987f64=moment(_0x235018)['milliseconds'](0x0);var _0x327cd9=moment(_0x57c9af)['milliseconds'](0x0);return _0x987f64['diff'](_0x327cd9,_0xa099('0x1'));}function Hangup(_0x34abcc,_0x37e28e){this[_0xa099('0x2')]=0x4;this[_0xa099('0x3')]=_0xa099('0x4');this[_0xa099('0x5')]=_0x34abcc[_0xa099('0x5')];this[_0xa099('0x6')]=_0x34abcc[_0xa099('0x6')];this[_0xa099('0x7')]=_0x34abcc['type']===_0xa099('0x8')?_0xa099('0x9'):_0x34abcc['type'];this[_0xa099('0xa')]=_0x34abcc[_0xa099('0xa')];this[_0xa099('0xb')]=_0x34abcc[_0xa099('0xb')];this[_0xa099('0xc')]=_0x34abcc[_0xa099('0xc')];this['countglobal']=_0x34abcc['countbusyretry']+_0x34abcc[_0xa099('0xb')]+_0x34abcc['countnoanswerretry']+_0x34abcc['countnosuchnumberretry']+_0x34abcc[_0xa099('0xd')]+_0x34abcc[_0xa099('0xe')]+_0x34abcc[_0xa099('0xf')]+_0x34abcc[_0xa099('0x10')];this[_0xa099('0x11')]=_0x34abcc['countnosuchnumberretry'];this['countdropretry']=_0x34abcc[_0xa099('0xd')];this[_0xa099('0xe')]=_0x34abcc[_0xa099('0xe')];this[_0xa099('0xf')]=_0x34abcc[_0xa099('0xf')];this['countagentrejectretry']=_0x34abcc[_0xa099('0x10')];this[_0xa099('0x12')]=_0x37e28e[_0xa099('0x12')];this['calleridname']=_0x34abcc['name'];this[_0xa099('0x13')]=_0x34abcc[_0xa099('0x14')];this['starttime']=_0x34abcc[_0xa099('0x15')];this[_0xa099('0x16')]=_0x34abcc['responsetime'];this['endtime']=moment()[_0xa099('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa099('0x18')]=getSeconds(_0x34abcc[_0xa099('0x16')],_0x34abcc[_0xa099('0x15')]);this[_0xa099('0x19')]=0x0;this[_0xa099('0x1a')]=getSeconds(this[_0xa099('0x1b')],_0x34abcc[_0xa099('0x16')]);this['queue']=_0x34abcc[_0xa099('0x9')];this[_0xa099('0x1c')]=_0xa099('0x1d');this['reason']=_0x37e28e[_0xa099('0x1e')];this[_0xa099('0x1f')]=_0x34abcc[_0xa099('0x1f')];this['callbackuniqueid']=_0x34abcc[_0xa099('0x20')];this[_0xa099('0x21')]=_0x34abcc[_0xa099('0x21')];this[_0xa099('0x22')]=_0x34abcc[_0xa099('0x22')];this['ContactId']=_0x34abcc[_0xa099('0x23')];this[_0xa099('0x24')]=_0x34abcc[_0xa099('0x24')];this[_0xa099('0x25')]=_0x34abcc[_0xa099('0x25')];this[_0xa099('0x26')]=_0x34abcc[_0xa099('0x26')];this[_0xa099('0x27')]=_0x34abcc[_0xa099('0x27')];}module[_0xa099('0x28')]=Hangup; \ No newline at end of file +var _0xddf0=['moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','membername','reason','cause-txt','callback','callbackat','recallme','ListId','UserId','CampaignId','lodash'];(function(_0x11ced7,_0x29a8b0){var _0x4bed14=function(_0x2b62d0){while(--_0x2b62d0){_0x11ced7['push'](_0x11ced7['shift']());}};_0x4bed14(++_0x29a8b0);}(_0xddf0,0x1c7));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x0ddf('0x0'));var moment=require(_0x0ddf('0x1'));function getSeconds(_0x1fa12a,_0x4b6eb6){var _0x18d641=moment(_0x1fa12a)['milliseconds'](0x0);var _0x51de3c=moment(_0x4b6eb6)[_0x0ddf('0x2')](0x0);return _0x18d641[_0x0ddf('0x3')](_0x51de3c,_0x0ddf('0x4'));}function Hangup(_0x39cb4a,_0x2e8501){this[_0x0ddf('0x5')]=0x4;this[_0x0ddf('0x6')]=_0x0ddf('0x7');this[_0x0ddf('0x8')]=_0x39cb4a['scheduledat'];this['type']=_0x39cb4a[_0x0ddf('0x9')];this[_0x0ddf('0xa')]=_0x39cb4a['type']===_0x0ddf('0xb')?_0x0ddf('0xc'):_0x39cb4a[_0x0ddf('0x9')];this[_0x0ddf('0xd')]=_0x39cb4a[_0x0ddf('0xd')];this[_0x0ddf('0xe')]=_0x39cb4a[_0x0ddf('0xe')];this[_0x0ddf('0xf')]=_0x39cb4a[_0x0ddf('0xf')];this['countglobal']=_0x39cb4a[_0x0ddf('0xd')]+_0x39cb4a['countcongestionretry']+_0x39cb4a[_0x0ddf('0xf')]+_0x39cb4a[_0x0ddf('0x10')]+_0x39cb4a[_0x0ddf('0x11')]+_0x39cb4a[_0x0ddf('0x12')]+_0x39cb4a['countmachineretry']+_0x39cb4a[_0x0ddf('0x13')];this[_0x0ddf('0x10')]=_0x39cb4a['countnosuchnumberretry'];this['countdropretry']=_0x39cb4a[_0x0ddf('0x11')];this[_0x0ddf('0x12')]=_0x39cb4a[_0x0ddf('0x12')];this[_0x0ddf('0x14')]=_0x39cb4a[_0x0ddf('0x14')];this[_0x0ddf('0x13')]=_0x39cb4a[_0x0ddf('0x13')];this[_0x0ddf('0x15')]=_0x2e8501['uniqueid'];this['calleridname']=_0x39cb4a[_0x0ddf('0x16')];this['calleridnum']=_0x39cb4a[_0x0ddf('0x17')];this[_0x0ddf('0x18')]=_0x39cb4a[_0x0ddf('0x18')];this[_0x0ddf('0x19')]=_0x39cb4a[_0x0ddf('0x19')];this[_0x0ddf('0x1a')]=moment()[_0x0ddf('0x1b')](_0x0ddf('0x1c'));this['ringtime']=getSeconds(_0x39cb4a[_0x0ddf('0x19')],_0x39cb4a[_0x0ddf('0x18')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0x0ddf('0x1a')],_0x39cb4a['responsetime']);this['queue']=_0x39cb4a[_0x0ddf('0xc')];this[_0x0ddf('0x1d')]='IVR';this[_0x0ddf('0x1e')]=_0x2e8501[_0x0ddf('0x1f')];this[_0x0ddf('0x20')]=_0x39cb4a[_0x0ddf('0x20')];this['callbackuniqueid']=_0x39cb4a['callbackuniqueid'];this[_0x0ddf('0x21')]=_0x39cb4a['callbackat'];this[_0x0ddf('0x22')]=_0x39cb4a[_0x0ddf('0x22')];this['ContactId']=_0x39cb4a['ContactId'];this[_0x0ddf('0x23')]=_0x39cb4a[_0x0ddf('0x23')];this[_0x0ddf('0x24')]=_0x39cb4a['UserId'];this['VoiceQueueId']=_0x39cb4a['VoiceQueueId'];this[_0x0ddf('0x25')]=_0x39cb4a[_0x0ddf('0x25')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 2300e75..3b56d57 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2864=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId','originatecalleridname','exports','util','lodash','diff','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0x233e7f,_0x44c948){var _0x746df4=function(_0x2fb247){while(--_0x2fb247){_0x233e7f['push'](_0x233e7f['shift']());}};_0x746df4(++_0x44c948);}(_0x2864,0x179));var _0x4286=function(_0x3c5bf1,_0x30bb33){_0x3c5bf1=_0x3c5bf1-0x0;var _0x2dc4d3=_0x2864[_0x3c5bf1];return _0x2dc4d3;};'use strict';var util=require(_0x4286('0x0'));var _=require(_0x4286('0x1'));var moment=require('moment');function getSeconds(_0x455b95,_0x4713de){var _0x2ed50e=moment(_0x455b95)['milliseconds'](0x0);var _0x439854=moment(_0x4713de)['milliseconds'](0x0);return _0x2ed50e[_0x4286('0x2')](_0x439854,_0x4286('0x3'));}function History(_0x1460fa){this[_0x4286('0x4')]=_0x1460fa[_0x4286('0x4')];this[_0x4286('0x5')]=_0x1460fa['scheduledat']||undefined;this['type']=_0x1460fa[_0x4286('0x6')];this[_0x4286('0x7')]=_0x1460fa[_0x4286('0x6')]===_0x4286('0x8')?_0x4286('0x9'):_0x1460fa[_0x4286('0x6')];this[_0x4286('0xa')]=_0x1460fa[_0x4286('0xa')];this[_0x4286('0xb')]=_0x1460fa['countcongestionretry'];this[_0x4286('0xc')]=_0x1460fa['countnoanswerretry'];this['countglobal']=_0x1460fa[_0x4286('0xa')]+_0x1460fa[_0x4286('0xb')]+_0x1460fa[_0x4286('0xc')]+_0x1460fa[_0x4286('0xd')]+_0x1460fa['countdropretry']+_0x1460fa[_0x4286('0xe')]+_0x1460fa[_0x4286('0xf')]+_0x1460fa['countagentrejectretry'];this[_0x4286('0xd')]=_0x1460fa['countnosuchnumberretry'];this['countdropretry']=_0x1460fa[_0x4286('0x10')];this[_0x4286('0xe')]=_0x1460fa[_0x4286('0xe')];this[_0x4286('0xf')]=_0x1460fa[_0x4286('0xf')];this[_0x4286('0x11')]=_0x1460fa['countagentrejectretry'];this[_0x4286('0x9')]=_0x1460fa[_0x4286('0x9')];this[_0x4286('0x12')]=_0x1460fa['name'];this[_0x4286('0x13')]=_0x1460fa[_0x4286('0x14')];this[_0x4286('0x15')]=_0x1460fa[_0x4286('0x15')];this[_0x4286('0x16')]=_0x1460fa[_0x4286('0x16')];this[_0x4286('0x17')]=_0x1460fa[_0x4286('0x16')];this[_0x4286('0x18')]=getSeconds(_0x1460fa['responsetime'],_0x1460fa[_0x4286('0x15')]);this[_0x4286('0x19')]=0x0;this[_0x4286('0x1a')]=0x0;this[_0x4286('0x1b')]=_0x1460fa[_0x4286('0x1b')];this[_0x4286('0x1c')]=_0x1460fa[_0x4286('0x1c')];this[_0x4286('0x1d')]=_0x1460fa[_0x4286('0x1d')];this['recallme']=_0x1460fa['recallme'];this[_0x4286('0x1e')]=_0x1460fa['ContactId'];this['ListId']=_0x1460fa['ListId'];this[_0x4286('0x1f')]=_0x1460fa[_0x4286('0x1f')];this[_0x4286('0x20')]=_0x1460fa[_0x4286('0x20')];this['CampaignId']=_0x1460fa['CampaignId'];this['originatecalleridnum']=_0x1460fa['originatecalleridnum']||'';this[_0x4286('0x21')]=_0x1460fa[_0x4286('0x21')]||'';}module[_0x4286('0x22')]=History; \ No newline at end of file +var _0x1c52=['number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','calleridname','calleridnum'];(function(_0x58a4b5,_0x182439){var _0x51821d=function(_0x47c3c5){while(--_0x47c3c5){_0x58a4b5['push'](_0x58a4b5['shift']());}};_0x51821d(++_0x182439);}(_0x1c52,0x1b3));var _0x21c5=function(_0x110bc7,_0x30ce6e){_0x110bc7=_0x110bc7-0x0;var _0x122892=_0x1c52[_0x110bc7];return _0x122892;};'use strict';var util=require(_0x21c5('0x0'));var _=require(_0x21c5('0x1'));var moment=require(_0x21c5('0x2'));function getSeconds(_0x2fa8f2,_0x22979a){var _0x5dac17=moment(_0x2fa8f2)[_0x21c5('0x3')](0x0);var _0x2de3fa=moment(_0x22979a)[_0x21c5('0x3')](0x0);return _0x5dac17['diff'](_0x2de3fa,_0x21c5('0x4'));}function History(_0x43600b){this['uniqueid']=_0x43600b[_0x21c5('0x5')];this['scheduledat']=_0x43600b[_0x21c5('0x6')]||undefined;this[_0x21c5('0x7')]=_0x43600b[_0x21c5('0x7')];this[_0x21c5('0x8')]=_0x43600b['type']===_0x21c5('0x9')?_0x21c5('0xa'):_0x43600b[_0x21c5('0x7')];this[_0x21c5('0xb')]=_0x43600b[_0x21c5('0xb')];this[_0x21c5('0xc')]=_0x43600b[_0x21c5('0xc')];this[_0x21c5('0xd')]=_0x43600b[_0x21c5('0xd')];this[_0x21c5('0xe')]=_0x43600b[_0x21c5('0xb')]+_0x43600b[_0x21c5('0xc')]+_0x43600b[_0x21c5('0xd')]+_0x43600b[_0x21c5('0xf')]+_0x43600b[_0x21c5('0x10')]+_0x43600b[_0x21c5('0x11')]+_0x43600b[_0x21c5('0x12')]+_0x43600b['countagentrejectretry'];this[_0x21c5('0xf')]=_0x43600b[_0x21c5('0xf')];this['countdropretry']=_0x43600b[_0x21c5('0x10')];this['countabandonedretry']=_0x43600b['countabandonedretry'];this['countmachineretry']=_0x43600b['countmachineretry'];this['countagentrejectretry']=_0x43600b['countagentrejectretry'];this['queue']=_0x43600b[_0x21c5('0xa')];this[_0x21c5('0x13')]=_0x43600b['name'];this[_0x21c5('0x14')]=_0x43600b[_0x21c5('0x15')];this['starttime']=_0x43600b[_0x21c5('0x16')];this[_0x21c5('0x17')]=_0x43600b['responsetime'];this[_0x21c5('0x18')]=_0x43600b['responsetime'];this[_0x21c5('0x19')]=getSeconds(_0x43600b[_0x21c5('0x17')],_0x43600b['starttime']);this[_0x21c5('0x1a')]=0x0;this[_0x21c5('0x1b')]=0x0;this['callback']=_0x43600b[_0x21c5('0x1c')];this['callbackuniqueid']=_0x43600b[_0x21c5('0x1d')];this['callbackat']=_0x43600b['callbackat'];this[_0x21c5('0x1e')]=_0x43600b['recallme'];this[_0x21c5('0x1f')]=_0x43600b['ContactId'];this[_0x21c5('0x20')]=_0x43600b[_0x21c5('0x20')];this[_0x21c5('0x21')]=_0x43600b['UserId'];this[_0x21c5('0x22')]=_0x43600b[_0x21c5('0x22')];this[_0x21c5('0x23')]=_0x43600b['CampaignId'];this[_0x21c5('0x24')]=_0x43600b[_0x21c5('0x24')]||'';this['originatecalleridname']=_0x43600b[_0x21c5('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index cbcfdcb..d94ad11 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 _0xfa37=['countdropretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countabandonedretry','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','dropreason','TIMEOUT','countglobal','dialDropMaxRetry','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','paused','locked','stateinterface','push','merge','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','run','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','interval','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','checkIfTime','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','substring','SIP/%s/%s%s','dialCutDigit','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','stateGlobal','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalDroppedCallsCallersExit','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','booked','../ami','defaults','redis','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','diff','seconds','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','stringify','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\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','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','milliseconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','state','statedesc','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','SIP/%s','reachable','unmonitored','createHistory','variable','amdstatus','xcally-motion-dialer','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','dialAMDActive','MACHINE','countmachineretry','countbusyretry','countnosuchnumberretry'];(function(_0x2ff8c3,_0x5d21f6){var _0x170bb1=function(_0x3f5de6){while(--_0x3f5de6){_0x2ff8c3['push'](_0x2ff8c3['shift']());}};_0x170bb1(++_0x5d21f6);}(_0xfa37,0x130));var _0x7fa3=function(_0x4a2e39,_0x2fbdbb){_0x4a2e39=_0x4a2e39-0x0;var _0x537623=_0xfa37[_0x4a2e39];return _0x537623;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x7fa3('0x0'));var uuid=require('uuid');var moment=require(_0x7fa3('0x1'));var rr=require('rr');var md5=require(_0x7fa3('0x2'));var Redis=require(_0x7fa3('0x3'));var ut=require(_0x7fa3('0x4'));var config=require(_0x7fa3('0x5'));var logger=require('../../../config/logger')(_0x7fa3('0x6'));var loggerBooked=require('../../../config/logger')(_0x7fa3('0x7'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x7fa3('0x8'));config['redis']=_[_0x7fa3('0x9')](config[_0x7fa3('0xa')],{'host':_0x7fa3('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7fa3('0xa')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x7fa3('0xc'));var cmHopperBlack=require(_0x7fa3('0xd'));var voiceQueueRt=require(_0x7fa3('0xe'));var Action=require('./action');var History=require(_0x7fa3('0xf'));var Final=require(_0x7fa3('0x10'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x7fa3('0x11'));var Hangup=require(_0x7fa3('0x12'));var ipAgi=process['env'][_0x7fa3('0x13')]||'127.0.0.1';var strategy={'rrmemory':_0x7fa3('0x14'),'roundrobin':_0x7fa3('0x15')};var Sequence=function(){};Sequence[_0x7fa3('0x16')][_0x7fa3('0x17')]=function(_0x30973c){this[_0x7fa3('0x18')]=this['tail']?this[_0x7fa3('0x18')][_0x7fa3('0x19')](_0x30973c):_0x30973c();};function Dialer(_0xab1e91,_0x234857){this[_0x7fa3('0x1a')]=new Sequence();this[_0x7fa3('0x1b')]=_0x234857;this[_0x7fa3('0x1c')]=_0xab1e91[_0x7fa3('0x1c')];this[_0x7fa3('0x1d')]=_0xab1e91[_0x7fa3('0x1d')];this['agents']=_0xab1e91[_0x7fa3('0x1e')];this[_0x7fa3('0x1f')]=_0xab1e91[_0x7fa3('0x1f')];this[_0x7fa3('0x20')]=config[_0x7fa3('0x20')]||0x2;this['channels']={};this[_0x7fa3('0x21')]={};this[_0x7fa3('0x22')]={};this[_0x7fa3('0x23')]={};this[_0x7fa3('0x24')]={};this[_0x7fa3('0x25')]={};this[_0x7fa3('0x26')]={};this[_0x7fa3('0x27')]={};this[_0x7fa3('0x28')]={};this[_0x7fa3('0x29')]={};ami['on']('agentconnect',this[_0x7fa3('0x2a')][_0x7fa3('0x2b')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x7fa3('0x2b')](this));ami['on'](_0x7fa3('0x2c'),this['syncOriginateResponse'][_0x7fa3('0x2b')](this));ami['on'](_0x7fa3('0x2d'),this[_0x7fa3('0x2e')][_0x7fa3('0x2b')](this));ami['on'](_0x7fa3('0x2f'),this[_0x7fa3('0x30')][_0x7fa3('0x2b')](this));ami['on'](_0x7fa3('0x31'),this[_0x7fa3('0x32')]['bind'](this));ami['on']('newexten',this[_0x7fa3('0x33')][_0x7fa3('0x2b')](this));ami['on'](_0x7fa3('0x34'),this[_0x7fa3('0x35')]['bind'](this));ami['on'](_0x7fa3('0x36'),this[_0x7fa3('0x37')][_0x7fa3('0x2b')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x7fa3('0x2b')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x972554){return _0x972554!==null&&!_[_0x7fa3('0x38')](_0x972554);}function checkIsLoggedIn(_0xddfd51,_0x5519cc){return function(){if(_0x5519cc<=0x0){_0xddfd51['message']=_0x7fa3('0x39');throw _0xddfd51[_0x7fa3('0x3a')]+_0x7fa3('0x3b');}};}function isActive(_0x1fb76f){return _0x1fb76f;}function checkIsActive(_0x554061,_0x364a9f){return function(){if(!isActive(_0x364a9f)){_0x554061[_0x7fa3('0x3c')]=_0x7fa3('0x3d');throw _0x554061[_0x7fa3('0x3a')]+'\x20NOT\x20Active';}};}function checkInterval(_0x58150e){return function(){if(!isNotNull(_0x58150e['Interval'])){_0x58150e[_0x7fa3('0x3c')]=_0x7fa3('0x3e');throw _0x58150e[_0x7fa3('0x3a')]+_0x7fa3('0x3f');}if(!isNotNull(_0x58150e[_0x7fa3('0x40')]['Intervals'])){_0x58150e[_0x7fa3('0x3c')]=_0x7fa3('0x3e');throw _0x58150e[_0x7fa3('0x3a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x58150e['Interval'][_0x7fa3('0x41')]))){_0x58150e['message']='INTERVAL_IS_NULL';throw _0x58150e[_0x7fa3('0x3a')]+_0x7fa3('0x3f');}};}function msgResponse(_0x1b8673,_0x3cd9b5,_0x42887a){return{'action':_0x1b8673,'response':_0x3cd9b5,'message':_0x42887a,'stack':_0x42887a};}function myreject(_0x41f5a6){return function(_0x304f45){return _0x41f5a6(msgResponse(_0x7fa3('0x42'),_0x7fa3('0x43'),JSON['stringify'](_0x304f45)));};}function getSeconds(_0x546d0a,_0x2ea749){var _0xf14aa0=moment(_0x546d0a)['milliseconds'](0x0);var _0x63d961=moment(_0x2ea749)['milliseconds'](0x0);return _0xf14aa0[_0x7fa3('0x44')](_0x63d961,_0x7fa3('0x45'));}function emit(_0x830829,_0x5fec6,_0x44c9d){io['to'](_0x830829)['emit'](_0x5fec6,_0x44c9d);}function emitVoiceQueueSummary(_0x1e116e){if(_0x1e116e[_0x7fa3('0x46')]===_0x7fa3('0x47')){var _0x321ebe={'id':_0x1e116e['id'],'name':_0x1e116e[_0x7fa3('0x3a')],'strategy':_0x1e116e['strategy'],'answered':_0x1e116e[_0x7fa3('0x48')],'available':_0x1e116e[_0x7fa3('0x49')],'loggedIn':_0x1e116e[_0x7fa3('0x4a')],'pTalking':_0x1e116e[_0x7fa3('0x4b')],'sumBillable':_0x1e116e[_0x7fa3('0x4c')],'sumDuration':_0x1e116e[_0x7fa3('0x4d')],'sumHoldTime':_0x1e116e[_0x7fa3('0x4e')]||0x0,'talking':_0x1e116e[_0x7fa3('0x4f')],'total':_0x1e116e['total'],'type':_0x1e116e[_0x7fa3('0x46')],'unmanaged':_0x1e116e[_0x7fa3('0x50')],'abandoned':_0x1e116e[_0x7fa3('0x51')],'waiting':_0x1e116e[_0x7fa3('0x52')],'loggedInDb':_0x1e116e[_0x7fa3('0x53')],'dialActive':_0x1e116e[_0x7fa3('0x54')],'dialMethod':_0x1e116e[_0x7fa3('0x55')],'dialOriginateCallerIdName':_0x1e116e[_0x7fa3('0x56')],'dialOriginateCallerIdNumber':_0x1e116e[_0x7fa3('0x57')],'dialOriginateTimeout':_0x1e116e['dialOriginateTimeout'],'dialPrefix':_0x1e116e[_0x7fa3('0x58')],'outboundAnswerAgiCallsDay':_0x1e116e[_0x7fa3('0x59')],'outboundAnswerCallsDay':_0x1e116e[_0x7fa3('0x5a')],'outboundBlacklistCallsDay':_0x1e116e[_0x7fa3('0x5b')],'outboundBusyCallsDay':_0x1e116e[_0x7fa3('0x5c')],'outboundCongestionCallsDay':_0x1e116e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1e116e['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1e116e[_0x7fa3('0x5d')],'outboundDropCallsDayTimeout':_0x1e116e[_0x7fa3('0x5e')],'outboundNoAnswerCallsDay':_0x1e116e[_0x7fa3('0x5f')],'outboundNoSuchCallsDay':_0x1e116e[_0x7fa3('0x60')],'outboundOriginateFailureCallsDay':_0x1e116e[_0x7fa3('0x61')],'outboundReCallsDay':_0x1e116e[_0x7fa3('0x62')],'outboundRejectCallsDay':_0x1e116e['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1e116e['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x1e116e[_0x7fa3('0x63')],'predictiveIntervalAvgHoldtime':_0x1e116e[_0x7fa3('0x64')],'predictiveIntervalAvgTalktime':_0x1e116e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1e116e['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1e116e['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1e116e[_0x7fa3('0x65')],'predictiveIntervalErlangCallsDroppedCalls':_0x1e116e[_0x7fa3('0x66')],'predictiveIntervalHitRate':_0x1e116e[_0x7fa3('0x67')],'predictiveIntervalMultiplicativeFactor':_0x1e116e[_0x7fa3('0x68')],'predictiveIntervalPauses':_0x1e116e[_0x7fa3('0x69')],'predictiveIntervalAvailable':_0x1e116e[_0x7fa3('0x6a')],'predictiveIntervalTotalCalls':_0x1e116e[_0x7fa3('0x6b')],'message':_0x1e116e[_0x7fa3('0x3c')],'originated':_0x1e116e[_0x7fa3('0x6c')],'erlangCalls':_0x1e116e[_0x7fa3('0x6d')],'erlangCallToSecond':_0x1e116e[_0x7fa3('0x6e')],'erlangAbandonmentRate':_0x1e116e[_0x7fa3('0x6f')],'erlangBusyFactor':_0x1e116e[_0x7fa3('0x70')],'startPredictive':_0x1e116e[_0x7fa3('0x25')],'startProgressive':_0x1e116e['startProgressive']};if(_0x1e116e[_0x7fa3('0x71')]){_0x321ebe[_0x7fa3('0x71')]={'id':_0x1e116e[_0x7fa3('0x71')]['id'],'name':_0x1e116e['Trunk']['name'],'active':_0x1e116e[_0x7fa3('0x71')]['active'],'callerid':_0x1e116e[_0x7fa3('0x71')][_0x7fa3('0x72')]};}if(_0x1e116e[_0x7fa3('0x40')]){_0x321ebe[_0x7fa3('0x40')]={'id':_0x1e116e['Interval']['id'],'name':_0x1e116e[_0x7fa3('0x40')][_0x7fa3('0x3a')]};}var _0x1d8078=md5(JSON[_0x7fa3('0x73')](_0x321ebe));if(_0x1e116e[_0x7fa3('0x2')]!==_0x1d8078){_0x1e116e[_0x7fa3('0x2')]=_0x1d8078;emit(util[_0x7fa3('0x74')](_0x7fa3('0x75'),_0x321ebe[_0x7fa3('0x3a')]),_0x7fa3('0x76'),_0x321ebe);}}}function emitCampaignSummary(_0x40b581){if(_0x40b581[_0x7fa3('0x46')]==='ivr'){emit(util[_0x7fa3('0x74')]('campaign:ivr:%s',_0x40b581['name']),'campaign:save',_0x40b581);}}function checkGetDataPredictive(_0x266102){if(isNotNull(_0x266102)&&!_[_0x7fa3('0x77')](_0x266102)){loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x79'));loggerPredictive['info'](_0x7fa3('0x7a'),_0x266102[_0x7fa3('0x6b')]);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x7b'),_0x266102[_0x7fa3('0x63')]);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x7c'),_0x266102['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x7fa3('0x78')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x266102['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x7d'),_0x266102['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x7fa3('0x78')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x266102[_0x7fa3('0x7e')]);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x7f'));if(_0x266102[_0x7fa3('0x6b')]>0x0){if(!_['isUndefined'](_0x266102[_0x7fa3('0x7e')])&&_0x266102[_0x7fa3('0x7e')]>0x0){return!![];}loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x80'));if(!_[_0x7fa3('0x38')](_0x266102[_0x7fa3('0x64')])&&_0x266102[_0x7fa3('0x64')]>0x0){return!![];}loggerPredictive['info'](_0x7fa3('0x81'));}else{loggerPredictive[_0x7fa3('0x78')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x82'));}return![];}function mergeDataErlangB(_0x3417b9){return function(_0x53f9da){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x83'),_0x53f9da[_0x7fa3('0x6d')]);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x84'),_0x53f9da['erlangCallToSecond']);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x85'),_0x53f9da['erlangAbandonmentRate']);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x86'),_0x53f9da[_0x7fa3('0x70')]);loggerPredictive['info'](_0x7fa3('0x85'),_0x53f9da[_0x7fa3('0x6f')]);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x7f'));_['merge'](_0x3417b9,_0x53f9da);};}function getDiff(_0x3794c6){var _0x1f2321=moment()[_0x7fa3('0x87')](0x0);var _0x5f35b2=moment(_0x3794c6)[_0x7fa3('0x87')](0x0);return _0x1f2321[_0x7fa3('0x44')](_0x5f35b2,_0x7fa3('0x45'));}function ifInterval(_0x23d14e,_0x12349b){if(_[_0x7fa3('0x38')](_0x12349b)){return![];}return getDiff(_0x12349b)<_0x23d14e*0x3c;}function freeVariablesPredictive(_0x505031){if(isNotNull(_0x505031)){if(!_[_0x7fa3('0x38')](_0x505031[_0x7fa3('0x26')])){_0x505031['startProgressive']=undefined;loggerPredictive[_0x7fa3('0x78')](_0x505031[_0x7fa3('0x3a')],_0x7fa3('0x88'));}if(!_['isUndefined'](_0x505031[_0x7fa3('0x25')])){_0x505031[_0x7fa3('0x25')]=undefined;loggerPredictive[_0x7fa3('0x78')](_0x505031[_0x7fa3('0x3a')],_0x7fa3('0x89'));}if(!_[_0x7fa3('0x38')](_0x505031[_0x7fa3('0x8a')])){clearInterval(_0x505031[_0x7fa3('0x8a')]);_0x505031['handlePredictive']=undefined;loggerPredictive[_0x7fa3('0x78')](_0x505031[_0x7fa3('0x3a')],_0x7fa3('0x8b'));}}}function erlangb(_0x3960ac,_0x2e0972){if(_0x2e0972===0x0){return 0x0;}var _0x2a195b=0x1;for(var _0x262e86=0x1;_0x262e86<=_0x2e0972;_0x262e86+=0x1){_0x2a195b=0x1+_0x2a195b*_0x262e86/_0x3960ac;}return 0x1/_0x2a195b;}function isVoiceQueueOutbound(_0x46dd8b){return _0x46dd8b==='outbound';}function isNotPreview(_0x553198){return _0x553198!==_0x7fa3('0x1b');}function isCampaignIvr(_0x9bf800){return _0x9bf800===_0x7fa3('0x8c');}function getCallerId(_0x399113,_0x4ca7c8,_0x54f1d9){if(!_['isUndefined'](_0x54f1d9)&&typeof _0x54f1d9===_0x7fa3('0x8d')&&!_[_0x7fa3('0x77')](_0x54f1d9)){if(!_['isUndefined'](_0x4ca7c8)&&typeof _0x4ca7c8===_0x7fa3('0x8d')&&!_[_0x7fa3('0x77')](_0x4ca7c8)){return util[_0x7fa3('0x74')]('\x22%s\x22\x20<%s>',_0x4ca7c8,_0x54f1d9);}return util[_0x7fa3('0x74')](_0x7fa3('0x8e'),_0x54f1d9,_0x54f1d9);}if(!_[_0x7fa3('0x38')](_0x399113)&&typeof _0x399113===_0x7fa3('0x8d')&&!_[_0x7fa3('0x77')](_0x399113)){return _0x399113;}return _0x7fa3('0x8f');}function loggerCatchQueueSummary(_0x1a913f,_0x3c070e){return function(_0xfdf080){freeVariablesPredictive(_0x3c070e);emitVoiceQueueSummary(_0x3c070e);emitCampaignSummary(_0x3c070e);loggerSyncQueueSummary[_0x7fa3('0x90')](_0x1a913f,util[_0x7fa3('0x91')](_0xfdf080,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1a410a,_0x5a9f82){return function(_0x347186){loggerPredictive[_0x7fa3('0x90')](_0x5a9f82[_0x7fa3('0x3a')],_0x1a410a);loggerPredictive['error'](_0x347186[_0x7fa3('0x92')]);freeVariablesPredictive(_0x5a9f82);};}function loggerCatch(_0x39f042){return function(_0x31345){logger[_0x7fa3('0x90')](_0x39f042,util[_0x7fa3('0x91')](_0x31345,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1c0546){return _0x1c0546&&!_[_0x7fa3('0x38')](_0x1c0546)&&_0x1c0546[_0x7fa3('0x93')]>0x0;}function decremetOriginate(_0x4ea5a1){if(!_[_0x7fa3('0x38')](_0x4ea5a1)&&_0x4ea5a1!==null){if(typeof _0x4ea5a1[_0x7fa3('0x6c')]!==_0x7fa3('0x94')){if(_0x4ea5a1[_0x7fa3('0x6c')]>0x0){_0x4ea5a1[_0x7fa3('0x6c')]-=0x1;}else{logger[_0x7fa3('0x90')](_0x7fa3('0x95'));}}}else{logger[_0x7fa3('0x90')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x479f67,_0x4ba5e4,_0x306b58){if(_0x4ba5e4>_0x306b58){for(var _0x3d01c4=0x0;_0x3d01c4<_0x4ba5e4-_0x306b58;_0x3d01c4+=0x1){decremetOriginate(_0x479f67);}}}function loggerGetContactDialer(_0x3752e8,_0x5dc8de,_0x6e16e5){return function(_0x5e852b){checkContactLowerLimitOriginate(_0x5dc8de,_0x6e16e5,0x0);logger[_0x7fa3('0x90')](_0x3752e8,util[_0x7fa3('0x91')](_0x5e852b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3b241b){return function(_0x35f045){if(isNotNull(_0x35f045)&&isNotNull(_0x35f045[0x0])){if(_0x35f045[0x0]['contactsRescheduled']>0x0){_0x3b241b[_0x7fa3('0x3c')]=_0x7fa3('0x96');logger[_0x7fa3('0x78')](_0x7fa3('0x97')+_0x3b241b['name'],_0x35f045[0x0][_0x7fa3('0x98')],'contacts');}else{_0x3b241b['message']=_0x7fa3('0x99');logger[_0x7fa3('0x78')]('[getContactDialer2][Empty]'+_0x3b241b[_0x7fa3('0x3a')]);}}};}function notSendMessagesQueue(_0x4c533e){if(_0x4c533e[_0x7fa3('0x9a')]){freeVariablesPredictive(_0x4c533e);if(_0x4c533e['originated']===0x0&&_0x4c533e[_0x7fa3('0x4f')]===0x0&&_0x4c533e['waiting']===0x0&&(_0x4c533e[_0x7fa3('0x4b')]||0x0)===0x0){_0x4c533e[_0x7fa3('0x9a')]=![];_0x4c533e[_0x7fa3('0x49')]=0x0;_0x4c533e['message']=_0x7fa3('0x3d');loggerSyncQueueSummary[_0x7fa3('0x90')](_0x7fa3('0x9b'),_0x4c533e['name'],_0x7fa3('0x9c'));}else{_0x4c533e[_0x7fa3('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x7fa3('0x90')](_0x7fa3('0x9b'),_0x4c533e['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x4c533e);}}function notSendMessagesCampaign(_0x54461d){if(_0x54461d['sendMessageOneNotActive']){if(_0x54461d['originated']===0x0){_0x54461d[_0x7fa3('0x9a')]=![];_0x54461d[_0x7fa3('0x3c')]=_0x7fa3('0x3d');loggerSyncQueueSummary[_0x7fa3('0x90')](_0x7fa3('0x9d'),_0x54461d['name'],_0x7fa3('0x9c'));}else{_0x54461d[_0x7fa3('0x3c')]=_0x7fa3('0x9e');loggerSyncQueueSummary[_0x7fa3('0x90')](_0x7fa3('0x9d'),_0x54461d[_0x7fa3('0x3a')],_0x7fa3('0x9f'));}emitCampaignSummary(_0x54461d);}}function createObjHistory(_0x3ec7f9,_0x381fcd,_0x192167,_0x3eb3c5,_0x1ec399){_0x3ec7f9['message']=_0x192167;var _0x388383=new Action(_0x3ec7f9,_0x381fcd);var _0x5db75d=new History(_0x388383);_0x5db75d[_0x7fa3('0xa0')]=_0x3eb3c5;_0x5db75d[_0x7fa3('0xa1')]=_0x1ec399;_0x5db75d['endtime']=_0x388383[_0x7fa3('0xa2')];return _0x5db75d;}Dialer[_0x7fa3('0x16')][_0x7fa3('0xa3')]=function(){var _0x31da1e=this;setInterval(function(){_0x31da1e[_0x7fa3('0xa4')](_0x31da1e[_0x7fa3('0x23')],_0x7fa3('0xa5'));_0x31da1e[_0x7fa3('0xa4')](_0x31da1e[_0x7fa3('0x21')],_0x7fa3('0xa6'));},0x32c8);};Dialer[_0x7fa3('0x16')][_0x7fa3('0xa4')]=function(_0x158532,_0x24c994){var _0x1b0373=this;for(var _0x4e2f66 in _0x158532){if(typeof _0x158532[_0x4e2f66]!==_0x7fa3('0x94')){this[_0x7fa3('0x1a')][_0x7fa3('0x17')](function(){if(!_[_0x7fa3('0xa7')](_0x158532[_0x4e2f66])){return ami[_0x7fa3('0xa8')]({'action':_0x7fa3('0xa9'),'channel':_0x158532[_0x4e2f66][_0x7fa3('0xaa')]})['catch'](function(_0x2f54fa){if(_0x2f54fa['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x158532[_0x4e2f66]&&_0x158532[_0x4e2f66]['type']!=='ivr'){_0x1b0373[_0x7fa3('0xab')](_0x1b0373['voiceQueues'][_0x158532[_0x4e2f66]['queue']]);logger[_0x7fa3('0x90')]('[Dialer][checkChannel]',_0x24c994,_0x4e2f66,_0x158532[_0x4e2f66][_0x7fa3('0xac')]);delete _0x158532[_0x4e2f66];}if(_0x158532[_0x4e2f66]&&_0x158532[_0x4e2f66][_0x7fa3('0x46')]===_0x7fa3('0x8c')){_0x1b0373[_0x7fa3('0xab')](_0x1b0373['campaigns'][_0x158532[_0x4e2f66]['queue']]);logger['error'](_0x7fa3('0xad'),_0x24c994,_0x4e2f66,_0x158532[_0x4e2f66]['queue']);delete _0x158532[_0x4e2f66];}},0x2328);}});}});}}};Dialer[_0x7fa3('0x16')][_0x7fa3('0xae')]=function(_0x2063f4){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopper[_0x7fa3('0xae')](_0x2063f4))[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xb2')));};Dialer['prototype'][_0x7fa3('0xb3')]=function(_0x28e19d){return BPromise['resolve']()[_0x7fa3('0xb0')](cmHopperBlack[_0x7fa3('0xb3')](_0x28e19d))['catch'](loggerCatch(_0x7fa3('0xb4')));};Dialer[_0x7fa3('0x16')][_0x7fa3('0xb5')]=function(_0x1c1194){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopperBlack[_0x7fa3('0xb5')](_0x1c1194))[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xb6')));};Dialer[_0x7fa3('0x16')][_0x7fa3('0xb7')]=function(_0x4836f2){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopperHistory[_0x7fa3('0xb8')](_0x4836f2))[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xb9')));};Dialer['prototype'][_0x7fa3('0xba')]=function(_0x1c21e0){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopper[_0x7fa3('0xba')](_0x1c21e0))[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xbb')));};Dialer[_0x7fa3('0x16')]['unlockContact']=function(_0x4de550,_0x49d454,_0x5274b7){return BPromise['resolve']()[_0x7fa3('0xb0')](cmHopper[_0x7fa3('0xbc')](_0x4de550,_0x49d454,_0x5274b7))[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xbd')));};Dialer[_0x7fa3('0x16')][_0x7fa3('0xbe')]=function(_0x59b93d,_0x16a9a9,_0x762e90,_0x2c9e62,_0x4f8b2d){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopper['getContactDialer'](_0x59b93d,_0x16a9a9,_0x762e90,_0x2c9e62))[_0x7fa3('0xb1')](function(_0x32a4d5){_0x4f8b2d[_0x7fa3('0xbf')]-=_0x762e90;_0x4f8b2d[_0x7fa3('0xbf')]=_0x4f8b2d['temp']>0x0?_0x4f8b2d[_0x7fa3('0xbf')]:0x0;loggerCatch(_0x7fa3('0xc0'))(_0x32a4d5);});};Dialer[_0x7fa3('0x16')][_0x7fa3('0xc1')]=function(_0x1b668a,_0x31c5c4,_0x152591,_0xbdd1f8){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopper[_0x7fa3('0xc1')](_0x1b668a,_0x31c5c4,_0x152591))[_0x7fa3('0xb1')](function(_0x52e139){_0xbdd1f8[_0x7fa3('0xbf')]-=_0x31c5c4;_0xbdd1f8[_0x7fa3('0xbf')]=_0xbdd1f8[_0x7fa3('0xbf')]>0x0?_0xbdd1f8[_0x7fa3('0xbf')]:0x0;loggerCatch(_0x7fa3('0xc2'))(_0x52e139);});};Dialer[_0x7fa3('0x16')][_0x7fa3('0xc3')]=function(_0x116b9d){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](voiceQueueRt[_0x7fa3('0xc3')](_0x116b9d))[_0x7fa3('0xb1')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7fa3('0x16')][_0x7fa3('0xc4')]=function(_0x1ac4d0){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopper[_0x7fa3('0xc4')](_0x1ac4d0))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x7fa3('0x16')]['createHistory']=function(_0x3cd7e5){return BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](cmHopperHistory['createHistory'](_0x3cd7e5))[_0x7fa3('0xb1')](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x7fa3('0xab')]=function(_0xd34eed){if(!_[_0x7fa3('0x38')](_0xd34eed)&&_0xd34eed!==null){if(typeof _0xd34eed[_0x7fa3('0x6c')]!==_0x7fa3('0x94')){if(_0xd34eed[_0x7fa3('0x6c')]>0x0){_0xd34eed[_0x7fa3('0x6c')]-=0x1;}else{logger[_0x7fa3('0x90')](_0x7fa3('0xc5'));}}}else{logger['error'](_0x7fa3('0xc6'));}};Dialer[_0x7fa3('0x16')][_0x7fa3('0xc7')]=function(_0x4f1285,_0xc85f78){var _0x17df66=this;return function(_0x5e4484){_0x17df66['updateOriginated'](_0xc85f78);logger[_0x7fa3('0x90')](_0x4f1285,util['inspect'](_0x5e4484,{'showHidden':![],'depth':null}));};};Dialer[_0x7fa3('0x16')][_0x7fa3('0xc8')]=function(_0x24f242,_0x4ef82e,_0x3c6625){var _0x483dc4={'state':0x19,'statedesc':'notFound'};this[_0x7fa3('0xab')](_0x4ef82e);this[_0x7fa3('0xc9')](_['merge'](_0x483dc4,_[_0x7fa3('0xca')](_0x3c6625,[_0x7fa3('0xcb'),_0x7fa3('0xcc'),_0x7fa3('0xcd'),_0x7fa3('0xce'),_0x7fa3('0xcf')])),_0x7fa3('0xd0'),_0x7fa3('0xd1'));logger['error'](_0x24f242);};Dialer[_0x7fa3('0x16')][_0x7fa3('0xd2')]=function(_0x109f7c){return _0x109f7c==='Success';};Dialer[_0x7fa3('0x16')][_0x7fa3('0xd3')]=function(_0x26e7ec){return!_['isUndefined'](_0x26e7ec)&&_0x26e7ec&&!_[_0x7fa3('0x38')](_0x26e7ec['name'])&&!_[_0x7fa3('0x38')](_0x26e7ec[_0x7fa3('0xd4')])&&_0x26e7ec[_0x7fa3('0xd4')]&&(this[_0x7fa3('0x1f')][util['format'](_0x7fa3('0xd5'),_0x26e7ec[_0x7fa3('0x3a')])][_0x7fa3('0xa9')]===_0x7fa3('0xd6')||this[_0x7fa3('0x1f')][util[_0x7fa3('0x74')]('SIP/%s',_0x26e7ec[_0x7fa3('0x3a')])][_0x7fa3('0xa9')]===_0x7fa3('0xd7'));};Dialer[_0x7fa3('0x16')][_0x7fa3('0xc9')]=function(_0x32d9f,_0x1389f6,_0x405c30){this[_0x7fa3('0xd8')](_0x32d9f)[_0x7fa3('0xb1')](loggerCatch(_0x1389f6));this['moveContactManagedDialer'](_0x32d9f)[_0x7fa3('0xb1')](loggerCatch(_0x405c30));};Dialer[_0x7fa3('0x16')][_0x7fa3('0x35')]=function(_0x14a509){var _0x35e15e=this[_0x7fa3('0x23')][_0x14a509['uniqueid']];var _0x4b315c;if(!_[_0x7fa3('0xa7')](_0x14a509)&&!_[_0x7fa3('0xa7')](_0x14a509[_0x7fa3('0xd9')])&&!_[_0x7fa3('0xa7')](_0x14a509[_0x7fa3('0xd9')][_0x7fa3('0xda')])&&_0x14a509['exten']===_0x7fa3('0xdb')&&_0x35e15e){if(_0x35e15e[_0x7fa3('0x46')]!==_0x7fa3('0x8c')&&this[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]]['dialAMDActive']&&_0x14a509[_0x7fa3('0xdc')]===_0x7fa3('0xdd')){delete this[_0x7fa3('0x23')][_0x14a509[_0x7fa3('0xde')]];this['updateOriginated'](this[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]]);this[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]][_0x7fa3('0x5a')]+=0x1;this[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]][_0x7fa3('0x59')]+=0x1;_0x4b315c=new Hangup(_0x35e15e,_0x14a509);_0x4b315c[_0x7fa3('0xa0')]=0x12;_0x4b315c[_0x7fa3('0xa1')]=_0x7fa3('0xdf');_0x4b315c[_0x7fa3('0xe0')]=_0x7fa3('0xe1');ami[_0x7fa3('0xe2')](_0x7fa3('0xe3'),ut[_0x7fa3('0xe4')](_0x4b315c,_0x7fa3('0xe5')));this['saveInDb'](_0x4b315c,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x35e15e['type']!==_0x7fa3('0x8c')&&this[_0x7fa3('0x1c')][_0x35e15e['queue']][_0x7fa3('0xe6')]&&_0x14a509[_0x7fa3('0xdc')]===_0x7fa3('0xe7')){var _0x5f1954=this;return new BPromise(function(_0x209f70,_0x3627d6){delete _0x5f1954[_0x7fa3('0x23')][_0x14a509[_0x7fa3('0xde')]];_0x5f1954[_0x7fa3('0xab')](_0x5f1954[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]]);_0x5f1954[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]][_0x7fa3('0x5a')]+=0x1;_0x5f1954[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4d3df8=_0x5f1954[_0x7fa3('0x1c')][_0x35e15e[_0x7fa3('0xac')]];var _0x9d6a36=new Hangup(_0x35e15e,_0x14a509);_0x9d6a36[_0x7fa3('0xa0')]=0x13;_0x9d6a36[_0x7fa3('0xa1')]='Machine';_0x9d6a36['membername']=_0x7fa3('0xe1');_0x9d6a36[_0x7fa3('0xe8')]+=0x1;_0x9d6a36['countglobal']+=0x1;_0x9d6a36['amd']=!![];ami[_0x7fa3('0xe2')](_0x7fa3('0xe3'),ut['buildObj'](_0x9d6a36,_0x7fa3('0xe5')));_0x5f1954[_0x7fa3('0xd8')](_0x9d6a36)[_0x7fa3('0xb1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x9d6a36[_0x7fa3('0xe9')]+_0x9d6a36['countcongestionretry']+_0x9d6a36['countnoanswerretry']+_0x9d6a36[_0x7fa3('0xea')]+_0x9d6a36[_0x7fa3('0xeb')]+_0x9d6a36['countabandonedretry']+_0x9d6a36['countmachineretry']+_0x9d6a36[_0x7fa3('0xec')]>=_0x4d3df8[_0x7fa3('0xed')]){_0x5f1954['stateGlobal'](_0x9d6a36,_0x209f70,_0x3627d6,'reason19\x20machine....');}else{if(_0x9d6a36[_0x7fa3('0xe8')]>=_0x4d3df8[_0x7fa3('0xee')]){_0x5f1954[_0x7fa3('0xef')](_0x9d6a36,_0x209f70,_0x3627d6,'reason\x2019\x20machine....');}else{_0x5f1954['rescheduleContact']({'active':![],'countmachineretry':_0x9d6a36[_0x7fa3('0xe8')],'scheduledat':moment()[_0x7fa3('0xf0')](_0x4d3df8['dialMachineRetryFrequency'],_0x7fa3('0xf1'))[_0x7fa3('0x74')](_0x7fa3('0xf2')),'ContactId':_0x9d6a36[_0x7fa3('0xcb')],'ListId':_0x9d6a36[_0x7fa3('0xcc')],'VoiceQueueId':_0x9d6a36[_0x7fa3('0xce')]||undefined,'CampaignId':_0x9d6a36[_0x7fa3('0xcf')]||undefined})[_0x7fa3('0xb1')](loggerCatch('[rescheduleContact][Machine]'));_0x209f70({'reschedule':0x1});}}});}if(_0x35e15e['type']==='ivr'&&this[_0x7fa3('0x1d')][_0x35e15e['queue']][_0x7fa3('0xe6')]&&_0x14a509[_0x7fa3('0xdc')]===_0x7fa3('0xdd')){delete this[_0x7fa3('0x23')][_0x14a509['uniqueid']];this[_0x7fa3('0xab')](this[_0x7fa3('0x1d')][_0x35e15e[_0x7fa3('0xac')]]);_0x4b315c=new Hangup(_0x35e15e,_0x14a509);_0x4b315c[_0x7fa3('0xa0')]=0x12;_0x4b315c[_0x7fa3('0xa1')]=_0x7fa3('0xdf');_0x4b315c[_0x7fa3('0xe0')]='AMD';ami[_0x7fa3('0xe2')](_0x7fa3('0xe3'),ut[_0x7fa3('0xe4')](_0x4b315c,_0x7fa3('0xe5')));this[_0x7fa3('0xc9')](_0x4b315c,_0x7fa3('0xf3'),_0x7fa3('0xf4'));}if(_0x35e15e[_0x7fa3('0x46')]===_0x7fa3('0x8c')&&this[_0x7fa3('0x1d')][_0x35e15e[_0x7fa3('0xac')]][_0x7fa3('0xe6')]&&_0x14a509[_0x7fa3('0xdc')]==='MACHINE'){var _0x5f1954=this;return new BPromise(function(_0xc053b5,_0x47d1e6){delete _0x5f1954['uniqueId'][_0x14a509[_0x7fa3('0xde')]];_0x5f1954[_0x7fa3('0xab')](_0x5f1954['campaigns'][_0x35e15e[_0x7fa3('0xac')]]);_0x5f1954[_0x7fa3('0x1d')][_0x35e15e['queue']][_0x7fa3('0x5a')]+=0x1;_0x5f1954[_0x7fa3('0x1d')][_0x35e15e['queue']][_0x7fa3('0x59')]+=0x1;var _0x38a9e4=_0x5f1954[_0x7fa3('0x1d')][_0x35e15e[_0x7fa3('0xac')]];var _0x30491c=new Hangup(_0x35e15e,_0x14a509);_0x30491c[_0x7fa3('0xa0')]=0x13;_0x30491c[_0x7fa3('0xa1')]=_0x7fa3('0xf5');_0x30491c[_0x7fa3('0xe0')]=_0x7fa3('0xe1');_0x30491c[_0x7fa3('0xe8')]+=0x1;_0x30491c['countglobal']+=0x1;_0x30491c[_0x7fa3('0xe5')]=!![];ami['emit'](_0x7fa3('0xe3'),ut[_0x7fa3('0xe4')](_0x30491c,_0x7fa3('0xe5')));_0x5f1954[_0x7fa3('0xd8')](_0x30491c)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xf6')));if(_0x30491c[_0x7fa3('0xe9')]+_0x30491c[_0x7fa3('0xf7')]+_0x30491c[_0x7fa3('0xf8')]+_0x30491c[_0x7fa3('0xea')]+_0x30491c[_0x7fa3('0xeb')]+_0x30491c[_0x7fa3('0xf9')]+_0x30491c[_0x7fa3('0xe8')]+_0x30491c[_0x7fa3('0xec')]>=_0x38a9e4[_0x7fa3('0xed')]){_0x5f1954['stateGlobal'](_0x30491c,_0xc053b5,_0x47d1e6,'reason19\x20machine....');}else{if(_0x30491c[_0x7fa3('0xe8')]>=_0x38a9e4[_0x7fa3('0xee')]){_0x5f1954[_0x7fa3('0xef')](_0x30491c,_0xc053b5,_0x47d1e6,_0x7fa3('0xfa'));}else{_0x5f1954[_0x7fa3('0xba')]({'active':![],'countmachineretry':_0x30491c[_0x7fa3('0xe8')],'scheduledat':moment()[_0x7fa3('0xf0')](_0x38a9e4[_0x7fa3('0xfb')],_0x7fa3('0xf1'))['format'](_0x7fa3('0xf2')),'ContactId':_0x30491c[_0x7fa3('0xcb')],'ListId':_0x30491c[_0x7fa3('0xcc')],'VoiceQueueId':_0x30491c[_0x7fa3('0xce')]||undefined,'CampaignId':_0x30491c['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xc053b5({'reschedule':0x1});}}});}}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x32')]=function(_0x186664){var _0xc7ab7e=this[_0x7fa3('0x23')][_0x186664[_0x7fa3('0xde')]];var _0x2b152e=this;var _0x45134f;if(_0xc7ab7e&&_0xc7ab7e['type']===_0x7fa3('0x8c')){delete this['uniqueId'][_0x186664[_0x7fa3('0xde')]];this[_0x7fa3('0xab')](this[_0x7fa3('0x1d')][_0xc7ab7e[_0x7fa3('0xac')]]);this[_0x7fa3('0x1d')][_0xc7ab7e[_0x7fa3('0xac')]]['ivrAnswerCallsDay']+=0x1;_0x45134f=new Hangup(_0xc7ab7e,_0x186664);this['createHistory'](_0x45134f)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xfc')));this['moveContactManagedDialer'](_0x45134f)[_0x7fa3('0xb1')](loggerCatch('[syncHangupIvr]'));}if(_0xc7ab7e&&_0xc7ab7e[_0x7fa3('0x46')]!==_0x7fa3('0x8c')&&isNotNull(this[_0x7fa3('0x1c')][_0xc7ab7e[_0x7fa3('0xac')]][_0x7fa3('0xfd')])){delete this['uniqueId'][_0x186664['uniqueid']];this[_0x7fa3('0xab')](this[_0x7fa3('0x1c')][_0xc7ab7e['queue']]);this[_0x7fa3('0x1c')][_0xc7ab7e[_0x7fa3('0xac')]]['outboundAnswerCallsDay']+=0x1;this[_0x7fa3('0x1c')][_0xc7ab7e[_0x7fa3('0xac')]][_0x7fa3('0x59')]+=0x1;_0x45134f=new Hangup(_0xc7ab7e,_0x186664);_0x45134f[_0x7fa3('0xa0')]=0x10;_0x45134f[_0x7fa3('0xa1')]=_0x7fa3('0xfe');_0x45134f[_0x7fa3('0xe0')]=_0x7fa3('0xff');this[_0x7fa3('0xd8')](_0x45134f)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xfc')));this['moveContactManagedDialer'](_0x45134f)[_0x7fa3('0xb1')](loggerCatch('[syncHangupIvr]'));}if(_0xc7ab7e&&_0xc7ab7e[_0x7fa3('0x46')]!==_0x7fa3('0x8c')&&!isNotNull(this[_0x7fa3('0x1c')][_0xc7ab7e[_0x7fa3('0xac')]]['dialQueueProject'])){delete this[_0x7fa3('0x23')][_0x186664[_0x7fa3('0xde')]];this[_0x7fa3('0xab')](this['voiceQueues'][_0xc7ab7e['queue']]);this[_0x7fa3('0x1c')][_0xc7ab7e[_0x7fa3('0xac')]]['outboundUnknownCallsDay']+=0x1;_0x45134f=new Hangup(_0xc7ab7e,_0x186664);_0x45134f[_0x7fa3('0xa0')]=0xc;_0x45134f['statedesc']=_0x186664['cause-txt'];_0x45134f[_0x7fa3('0xe0')]='Unknow';this[_0x7fa3('0xd8')](_0x45134f)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xfc')));this[_0x7fa3('0xc4')](_0x45134f)[_0x7fa3('0xb1')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x2e')]=function(_0x4d1f09){var _0x2f29cd=this['uniqueId'][_0x4d1f09[_0x7fa3('0xde')]];var _0x20d77d=this;if(this[_0x7fa3('0x1c')][_0x4d1f09[_0x7fa3('0xac')]]){if(_0x2f29cd&&_0x2f29cd[_0x7fa3('0x46')]!==_0x7fa3('0x8c')){delete this[_0x7fa3('0x23')][_0x4d1f09[_0x7fa3('0xde')]];this['voiceQueues'][_0x4d1f09[_0x7fa3('0xac')]][_0x7fa3('0x5a')]+=0x1;var _0x369d0a=new AgentComplete(_0x2f29cd,_0x4d1f09);if(_0x4d1f09[_0x7fa3('0x100')]==='agent'){_0x369d0a[_0x7fa3('0x101')]=this[_0x7fa3('0x1c')][_0x4d1f09[_0x7fa3('0xac')]][_0x7fa3('0x102')]&&this[_0x7fa3('0x1c')][_0x4d1f09[_0x7fa3('0xac')]][_0x7fa3('0x103')]?moment()[_0x7fa3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x7fa3('0xd8')](_0x369d0a)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x104')));this[_0x7fa3('0xc4')](_0x369d0a)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x105')));}}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x2a')]=function(_0x344661){if(this[_0x7fa3('0x1c')][_0x344661[_0x7fa3('0xac')]]){if(this[_0x7fa3('0x23')][_0x344661[_0x7fa3('0xde')]]&&this[_0x7fa3('0x23')][_0x344661[_0x7fa3('0xde')]][_0x7fa3('0x46')]!==_0x7fa3('0x8c')){this['updateOriginated'](this[_0x7fa3('0x1c')][_0x344661[_0x7fa3('0xac')]]);this[_0x7fa3('0x23')][_0x344661['uniqueid']][_0x7fa3('0x106')]=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));}}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x107')]=function(_0x58325d){this[_0x7fa3('0xd8')](_0x58325d)['catch'](loggerCatch(_0x7fa3('0x104')));this[_0x7fa3('0xc4')](_0x58325d)['catch'](loggerCatch(_0x7fa3('0x108')));};Dialer[_0x7fa3('0x16')]['syncQueueCallerAbandon']=function(_0x335729){var _0x16f800=this[_0x7fa3('0x23')][_0x335729['uniqueid']];var _0x5afd66=this;if(this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]]){if(_0x16f800&&_0x16f800[_0x7fa3('0x46')]!=='ivr'){delete this[_0x7fa3('0x23')][_0x335729['uniqueid']];this['updateOriginated'](this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]]);_0x16f800[_0x7fa3('0x109')]=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));var _0x4036b7=new QueueCallerAbandon(_0x16f800,_0x335729);if(getSeconds(_0x16f800[_0x7fa3('0x109')],_0x16f800[_0x7fa3('0x10a')])>=_0x16f800[_0x7fa3('0x10b')]){this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]][_0x7fa3('0x10c')]+=0x1;this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x335729['queue']][_0x7fa3('0x66')]+=0x1;_0x4036b7[_0x7fa3('0xa0')]=0xa;_0x4036b7[_0x7fa3('0xa1')]=_0x7fa3('0x10d');_0x4036b7[_0x7fa3('0x10e')]=_0x7fa3('0x10f');_0x4036b7[_0x7fa3('0x101')]=this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]][_0x7fa3('0x102')]?moment()[_0x7fa3('0x74')](_0x7fa3('0xf2')):undefined;_0x4036b7[_0x7fa3('0xeb')]+=0x1;_0x4036b7[_0x7fa3('0x110')]+=0x1;if(_0x4036b7[_0x7fa3('0xeb')]>=this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]][_0x7fa3('0x111')]){this[_0x7fa3('0x107')](_0x4036b7);}else{this[_0x7fa3('0xba')]({'active':![],'countdropretry':_0x4036b7[_0x7fa3('0xeb')],'scheduledat':moment()[_0x7fa3('0xf0')](this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]]['dialDropRetryFrequency'],_0x7fa3('0xf1'))[_0x7fa3('0x74')](_0x7fa3('0xf2')),'ContactId':_0x16f800[_0x7fa3('0xcb')],'ListId':_0x16f800[_0x7fa3('0xcc')],'VoiceQueueId':_0x16f800[_0x7fa3('0xce')]||undefined,'CampaignId':_0x16f800['CampaignId']||undefined})[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x112')));var _0x1c8980=new History(_0x4036b7);_0x1c8980[_0x7fa3('0xa0')]=0xa;_0x1c8980[_0x7fa3('0xa1')]=_0x7fa3('0x10d');_0x1c8980[_0x7fa3('0xa2')]=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));_0x1c8980[_0x7fa3('0x113')]=_0x1c8980[_0x7fa3('0xa2')];_0x1c8980['calleridname']=_0x4036b7[_0x7fa3('0x114')];_0x1c8980[_0x7fa3('0x115')]=_0x4036b7['calleridnum'];this[_0x7fa3('0xd8')](_0x1c8980)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x116')));}}else{this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]][_0x7fa3('0x5d')]+=0x1;_0x4036b7[_0x7fa3('0xa0')]=0xb;_0x4036b7[_0x7fa3('0xa1')]=_0x7fa3('0x117');_0x4036b7['dropreason']=_0x7fa3('0x118');_0x4036b7[_0x7fa3('0xf9')]+=0x1;_0x4036b7[_0x7fa3('0x110')]+=0x1;if(_0x4036b7['countabandonedretry']>=this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]][_0x7fa3('0x119')]){this[_0x7fa3('0x107')](_0x4036b7);}else{this[_0x7fa3('0xba')]({'active':![],'countabandonedretry':_0x4036b7[_0x7fa3('0xf9')],'scheduledat':moment()[_0x7fa3('0xf0')](this[_0x7fa3('0x1c')][_0x335729[_0x7fa3('0xac')]][_0x7fa3('0x11a')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16f800['ContactId'],'ListId':_0x16f800['ListId'],'VoiceQueueId':_0x16f800[_0x7fa3('0xce')]||undefined,'CampaignId':_0x16f800[_0x7fa3('0xcf')]||undefined})[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x11b')));var _0x1c8980=new History(_0x4036b7);_0x1c8980[_0x7fa3('0xa0')]=0xb;_0x1c8980['statedesc']=_0x7fa3('0x117');_0x1c8980['starttime']=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));_0x1c8980['endtime']=_0x1c8980['starttime'];_0x1c8980['calleridname']=_0x4036b7[_0x7fa3('0x114')];_0x1c8980[_0x7fa3('0x115')]=_0x4036b7['calleridnum'];this['createHistory'](_0x1c8980)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x11c')));}}}}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x33')]=function(_0xef2db9){if(this['actions'][_0xef2db9['uniqueid']]){this[_0x7fa3('0x21')][_0xef2db9['uniqueid']][_0x7fa3('0xaa')]=_0xef2db9[_0x7fa3('0xaa')];}if(this[_0x7fa3('0x23')][_0xef2db9['uniqueid']]){this[_0x7fa3('0x23')][_0xef2db9[_0x7fa3('0xde')]][_0x7fa3('0xaa')]=_0xef2db9[_0x7fa3('0xaa')];}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x37')]=function(_0x177d63){if(strategy[this[_0x7fa3('0x1c')][this[_0x7fa3('0x21')][_0x177d63[_0x7fa3('0x11d')]][_0x7fa3('0xac')]][_0x7fa3('0x11e')]]==='roundrobin'){if(this['actions'][_0x177d63['actionid']]&&_[_0x7fa3('0xa7')](this[_0x7fa3('0x21')][_0x177d63[_0x7fa3('0x11d')]]['locked'])&&_0x177d63['status']==='1'&&_0x177d63[_0x7fa3('0x11f')]==='0'){if(this['agents'][_0x177d63['stateinterface']]){if(!this[_0x7fa3('0x1e')][_0x177d63['stateinterface']][_0x7fa3('0x120')]){this[_0x7fa3('0x1e')][_0x177d63[_0x7fa3('0x121')]][_0x7fa3('0x120')]=!![];this[_0x7fa3('0x21')][_0x177d63[_0x7fa3('0x11d')]][_0x7fa3('0x120')]=!![];this[_0x7fa3('0x21')][_0x177d63[_0x7fa3('0x11d')]]['stateinterface']=_0x177d63[_0x7fa3('0x121')];}}}}else if((strategy[this[_0x7fa3('0x1c')][this[_0x7fa3('0x21')][_0x177d63[_0x7fa3('0x11d')]][_0x7fa3('0xac')]][_0x7fa3('0x11e')]]||_0x7fa3('0x14'))===_0x7fa3('0x14')){if(this['actions'][_0x177d63[_0x7fa3('0x11d')]]){if(this[_0x7fa3('0x1e')][_0x177d63[_0x7fa3('0x121')]]){this[_0x7fa3('0x21')][_0x177d63['actionid']][_0x7fa3('0x121')]=_0x177d63[_0x7fa3('0x121')];if(_[_0x7fa3('0xa7')](this['queueBooked'][this[_0x7fa3('0x21')][_0x177d63['actionid']]['queue']])){this[_0x7fa3('0x28')][this[_0x7fa3('0x21')][_0x177d63[_0x7fa3('0x11d')]][_0x7fa3('0xac')]]=[];}this[_0x7fa3('0x28')][this[_0x7fa3('0x21')][_0x177d63['actionid']]['queue']][_0x7fa3('0x122')](_[_0x7fa3('0x123')](_[_0x7fa3('0xca')](this[_0x7fa3('0x21')][_0x177d63['actionid']],[_0x7fa3('0x124'),_0x7fa3('0x121')]),{'status':_0x177d63[_0x7fa3('0xa9')],'paused':_0x177d63['paused']}));}}}};function unlockQueueStatus(_0x278301,_0x4cdd51){setTimeout(function(){if(_[_0x7fa3('0x38')](_0x278301[_0x7fa3('0x125')])){loggerBooked[_0x7fa3('0x90')](_0x7fa3('0x126'),_0x4cdd51);}_0x278301[_0x7fa3('0x125')]=!![];loggerBooked['info'](_0x7fa3('0x127'),_0x4cdd51,JSON['stringify'](_['pick'](_0x278301,['name',_0x7fa3('0x125')])));},0x1f3);}Dialer[_0x7fa3('0x16')]['syncQueueStatusComplete']=function(_0x331055){var _0x42a1c9=this;var _0x26629f=_0x42a1c9[_0x7fa3('0x1c')][_0x42a1c9[_0x7fa3('0x21')][_0x331055['actionid']][_0x7fa3('0xac')]];if(strategy[this[_0x7fa3('0x1c')][this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0xac')]][_0x7fa3('0x11e')]]===_0x7fa3('0x15')){if(this['actions'][_0x331055['actionid']]&&this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0x121')]){this[_0x7fa3('0x1b')]['run'](this[_0x7fa3('0x21')][_0x331055['actionid']]['idHopper'],this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0x121')])[_0x7fa3('0xb1')](function(_0x48526a){logger[_0x7fa3('0x90')](_0x7fa3('0x128'),util[_0x7fa3('0x91')](_0x48526a,{'showHidden':![],'depth':null}));})[_0x7fa3('0x19')](function(){_0x42a1c9[_0x7fa3('0xab')](_0x42a1c9['voiceQueues'][_0x42a1c9[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0xac')]]);_0x42a1c9[_0x7fa3('0x1e')][_0x42a1c9[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]]['stateinterface']]['locked']=![];delete _0x42a1c9[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]];unlockQueueStatus(_0x26629f);});}else{this['updateOriginated'](this[_0x7fa3('0x1c')][this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0xac')]]);this[_0x7fa3('0xba')]({'active':![],'ContactId':this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0xcb')],'ListId':this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0xcc')],'VoiceQueueId':this[_0x7fa3('0x21')][_0x331055['actionid']][_0x7fa3('0xce')]||undefined,'CampaignId':this[_0x7fa3('0x21')][_0x331055['actionid']][_0x7fa3('0xcf')]||undefined})['catch'](loggerCatch(_0x7fa3('0x129')));delete this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]];unlockQueueStatus(_0x26629f);}}else if((strategy[this[_0x7fa3('0x1c')][this[_0x7fa3('0x21')][_0x331055['actionid']]['queue']]['strategy']]||'rrmemory')===_0x7fa3('0x14')){var _0x33edfe;if(this[_0x7fa3('0x21')][_0x331055['actionid']]&&!_[_0x7fa3('0x77')](this[_0x7fa3('0x28')][this[_0x7fa3('0x21')][_0x331055['actionid']][_0x7fa3('0xac')]])){if(this[_0x7fa3('0x29')][_0x42a1c9[_0x7fa3('0x21')][_0x331055['actionid']][_0x7fa3('0xac')]]){this[_0x7fa3('0x29')][_0x42a1c9[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0xac')]]=this[_0x7fa3('0x29')][this['actions'][_0x331055[_0x7fa3('0x11d')]]['queue']]?this[_0x7fa3('0x29')][this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]][_0x7fa3('0xac')]]:this[_0x7fa3('0x28')][this[_0x7fa3('0x21')][_0x331055[_0x7fa3('0x11d')]]['queue']]?this['queueBooked'][this['actions'][_0x331055['actionid']][_0x7fa3('0xac')]]['_rr']||0x0:0x0;}this[_0x7fa3('0x28')][this['actions'][_0x331055[_0x7fa3('0x11d')]]['queue']][_0x7fa3('0x12a')]=this[_0x7fa3('0x29')][this['actions'][_0x331055['actionid']][_0x7fa3('0xac')]];for(var _0xdaff22=0x0;_0xdaff22=0x0;})[_0x7fa3('0xb1')](myreject(_0x2529b4)));}}else{_0x545e84[_0x7fa3('0x122')](ami[_0x7fa3('0xa8')]({'action':'command','command':util[_0x7fa3('0x74')](_0x7fa3('0x141'),_0x97fa21,!_['isUndefined'](config[_0x7fa3('0x13e')][_0x260dd8])?_0x260dd8:'')})[_0x7fa3('0xb0')](function(_0x51ae0e){return _0x51ae0e['content']['indexOf'](_0x7fa3('0x144'))>=0x0;})['catch'](myreject(_0x2529b4)));}BPromise[_0x7fa3('0x145')](_0x545e84)['then'](function(_0x1ef8f5){var _0x2a3d41=_[_0x7fa3('0x146')](_0x1ef8f5);if(_0x2a3d41){return _0x30a858(_0x2a3d41);}else{_0x51d7c4[_0x7fa3('0x3c')]=_0x1ed909?_0x7fa3('0x147'):_0x7fa3('0x148');return _0x2529b4(msgResponse(_0x7fa3('0x149'),'Failure','Global:\x20'+_0x1ed909+'\x20'+_0x270891+_0x7fa3('0x14a')+util['inspect'](_0x97fa21,{'showHidden':![],'depth':null})+_0x7fa3('0x14b')+_0x260dd8));}})[_0x7fa3('0xb1')](function(_0x346bf5){return _0x2529b4(msgResponse('ifTime',_0x7fa3('0x13a'),JSON['stringify'](_0x346bf5)));});});};Dialer['prototype']['checkDialMethod']=function(_0x2c5a93){var _0xd3874b=this;return function(){switch(_0x2c5a93[_0x7fa3('0x55')]){case _0x7fa3('0x14c'):freeVariablesPredictive(_0x2c5a93);_0xd3874b[_0x7fa3('0x14d')](_0x2c5a93,0x1);break;case'power':freeVariablesPredictive(_0x2c5a93);_0xd3874b[_0x7fa3('0x14d')](_0x2c5a93,_0x2c5a93[_0x7fa3('0x14e')]);break;case _0x7fa3('0x14f'):_0xd3874b['predictive'](_0x2c5a93);break;case'booked':freeVariablesPredictive(_0x2c5a93);_0xd3874b[_0x7fa3('0x14d')](_0x2c5a93,0x1);break;default:freeVariablesPredictive(_0x2c5a93);logger[_0x7fa3('0x90')](_0x7fa3('0x150'),_0x2c5a93[_0x7fa3('0x3a')],_0x7fa3('0x151'));}};};Dialer[_0x7fa3('0x16')][_0x7fa3('0x152')]=function(_0x55552d){var _0x170f24=this;return function(){_0x170f24['handleIvr'](_0x55552d);};};Dialer['prototype'][_0x7fa3('0x30')]=function(_0x20d537){var _0x16088e=this;if(isNotPreview(_0x20d537[_0x7fa3('0x55')])){if(isVoiceQueueOutbound(_0x20d537[_0x7fa3('0x46')])&&isActive(_0x20d537[_0x7fa3('0x54')])){_0x20d537['sendMessageOneNotActive']=!![];BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](checkIsLoggedIn(_0x20d537,_0x20d537['loggedIn']))[_0x7fa3('0xb0')](checkIsActive(_0x20d537,_0x20d537['dialActive']))['then'](checkInterval(_0x20d537))[_0x7fa3('0xb0')](_0x16088e[_0x7fa3('0x136')](_0x20d537))[_0x7fa3('0xb0')](_0x16088e[_0x7fa3('0x153')](_0x20d537[_0x7fa3('0x154')],_0x20d537['dialTimezone'],_0x20d537['name'],_0x20d537))[_0x7fa3('0xb0')](_0x16088e[_0x7fa3('0x155')](_0x20d537[_0x7fa3('0x40')],_0x20d537[_0x7fa3('0x156')],_0x20d537[_0x7fa3('0x3a')],_0x20d537))[_0x7fa3('0xb0')](_0x16088e[_0x7fa3('0x157')](_0x20d537))[_0x7fa3('0xb1')](loggerCatchQueueSummary(_0x7fa3('0x158'),_0x20d537));}else{notSendMessagesQueue(_0x20d537);}}else{freeVariablesPredictive(_0x20d537);}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x135')]=function(){var _0x36c264=this;var _0x2fdc25;for(var _0x4fca21 in this[_0x7fa3('0x1d')]){if(typeof this['campaigns'][_0x4fca21]!==_0x7fa3('0x94')){_0x2fdc25=this['campaigns'][_0x4fca21];if(isCampaignIvr(_0x2fdc25['type'])&&isActive(_0x2fdc25[_0x7fa3('0xd4')])){_0x2fdc25[_0x7fa3('0x9a')]=!![];BPromise[_0x7fa3('0xaf')]()[_0x7fa3('0xb0')](checkIsActive(_0x2fdc25,_0x2fdc25[_0x7fa3('0xd4')]))[_0x7fa3('0xb0')](checkInterval(_0x2fdc25))[_0x7fa3('0xb0')](_0x36c264[_0x7fa3('0x136')](_0x2fdc25))[_0x7fa3('0xb0')](_0x36c264[_0x7fa3('0x153')](_0x2fdc25[_0x7fa3('0x154')],_0x2fdc25[_0x7fa3('0x156')],_0x2fdc25[_0x7fa3('0x3a')],_0x2fdc25))[_0x7fa3('0xb0')](_0x36c264[_0x7fa3('0x155')](_0x2fdc25[_0x7fa3('0x40')],_0x2fdc25[_0x7fa3('0x156')],_0x2fdc25[_0x7fa3('0x3a')],_0x2fdc25))['then'](_0x36c264[_0x7fa3('0x152')](_0x2fdc25))[_0x7fa3('0xb1')](loggerCatchQueueSummary(_0x7fa3('0x159'),_0x2fdc25));}else{notSendMessagesCampaign(_0x2fdc25);}}}};function getCallerIdRandom(_0x1017ea,_0x135136){var _0x11c6a1;var _0x58a216;var _0x46c80a;if(_0x135136<=0x0){_0x135136=0x1;}_0x11c6a1=new RegExp(_0x7fa3('0x15a')+_0x135136+'}$');_0x58a216=Math[_0x7fa3('0x15b')](0xa,_0x135136-0x1);_0x46c80a=Math[_0x7fa3('0x15b')](0xa,_0x135136)-0x1;return util['format']('%s',_['replace'](_0x1017ea,_0x11c6a1,_[_0x7fa3('0x15c')](_0x58a216,_0x46c80a)));}function extractCalleridName(_0x33ba0c){var _0x83103c=_0x33ba0c[_0x7fa3('0x15d')](/"(.*?)"/);return _0x83103c?_0x83103c[0x1]:_0x33ba0c;}function extractCalleridNumber(_0x20503c){var _0x52b836=_0x20503c[_0x7fa3('0x15d')](/<(.*?)>/);return _0x52b836?_0x52b836[0x1]:_0x20503c;}Dialer['prototype'][_0x7fa3('0x15e')]=function(_0x2b9d7b,_0x161845){var _0x3488c9=this;var _0x524486=uuid['v4']();this[_0x7fa3('0x21')][_0x524486]=new Action(_0x2b9d7b,_0x161845,_0x524486);return new BPromise(function(_0x5a3138,_0x25688a){if(_[_0x7fa3('0x38')](_0x2b9d7b)&&typeof _0x2b9d7b!==_0x7fa3('0x15f')){return _0x25688a(msgResponse(_0x7fa3('0x160'),'Failure',_0x7fa3('0x161')));}if(_[_0x7fa3('0x38')](_0x161845[_0x7fa3('0x162')][_0x7fa3('0x163')])||_0x161845[_0x7fa3('0x162')][_0x7fa3('0x163')]===null){return _0x25688a(msgResponse('originate',_0x7fa3('0x13a'),_0x7fa3('0x164')));}var _0x230f33={'XMD-CALLERID':_0x3488c9[_0x7fa3('0x21')][_0x524486]['getCaller'](),'XMD-AGI':_0x2b9d7b['dialQueueProject']?util[_0x7fa3('0x74')](_0x7fa3('0x165'),ipAgi,_0x2b9d7b[_0x7fa3('0xfd')]):_0x7fa3('0x166'),'XMD-AGIAFTER':_0x2b9d7b['dialQueueProject2']?util[_0x7fa3('0x74')](_0x7fa3('0x165'),ipAgi,_0x2b9d7b[_0x7fa3('0x102')]):_0x7fa3('0x166'),'XMD-QUEUE':_0x2b9d7b['type']===_0x7fa3('0x47')?util['format'](_0x7fa3('0x167'),_0x2b9d7b[_0x7fa3('0x3a')],_0x2b9d7b[_0x7fa3('0x168')]||'',_0x2b9d7b[_0x7fa3('0x103')]?'c':'',_0x2b9d7b[_0x7fa3('0x10b')]||0x3):_0x7fa3('0x166'),'XMD-CONTACTID':_0x161845[_0x7fa3('0xcb')],'XMD-CDRTYPE':_0x7fa3('0x6'),'CALLERID(all)':_0x3488c9[_0x7fa3('0x21')][_0x524486][_0x7fa3('0x169')](),'XMD-AMD':_0x2b9d7b[_0x7fa3('0xe6')]?_0x7fa3('0x16a'):_0x7fa3('0x166'),'XMD-DESTINATION':_0x7fa3('0xdb')};if(_0x2b9d7b[_0x7fa3('0xe6')]){_0x230f33['XMD-AMDINITIALSILENCE']=_0x2b9d7b[_0x7fa3('0x16b')]||0x9c4;_0x230f33[_0x7fa3('0x16c')]=_0x2b9d7b[_0x7fa3('0x16d')]||0x5dc;_0x230f33['XMD-AMDAFTERGREETINGSILENCE']=_0x2b9d7b[_0x7fa3('0x16e')]||0x320;_0x230f33[_0x7fa3('0x16f')]=_0x2b9d7b[_0x7fa3('0x170')]||0x1388;_0x230f33[_0x7fa3('0x171')]=_0x2b9d7b[_0x7fa3('0x172')]||0x64;_0x230f33[_0x7fa3('0x173')]=_0x2b9d7b[_0x7fa3('0x174')]||0x32;_0x230f33[_0x7fa3('0x175')]=_0x2b9d7b[_0x7fa3('0x176')]||0x3;_0x230f33[_0x7fa3('0x177')]=_0x2b9d7b[_0x7fa3('0x178')]||0x100;_0x230f33['XMD-AMDMAXIMUMWORDLENGTH']=_0x2b9d7b['dialAMDMaximumWordLength']||0x1388;}if(_0x2b9d7b[_0x7fa3('0x46')]===_0x7fa3('0x47')){_0x230f33[_0x7fa3('0x179')]=_0x161845[_0x7fa3('0xce')];}else{_0x230f33['XMD-CAMPAIGNID']=_0x161845['CampaignId'];}for(var _0x589824 in _0x161845[_0x7fa3('0x162')]){if(typeof _0x161845[_0x7fa3('0x162')][_0x589824]!=='undefined'){if(isNotNull(_0x161845[_0x7fa3('0x162')][_0x589824])&&_0x589824!=='id'&&_0x589824!==_0x7fa3('0x17a')&&_0x589824!==_0x7fa3('0x17b')&&_0x589824!==_0x7fa3('0x17c')){_0x230f33[util[_0x7fa3('0x74')](_0x7fa3('0x17d'),'XMD-',_[_0x7fa3('0x17e')](_0x589824))]=_0x161845[_0x7fa3('0x162')][_0x589824];}}}var _0x3c1007=_0x3488c9[_0x7fa3('0xd3')](_0x2b9d7b[_0x7fa3('0x71')])?getCallerId(_0x2b9d7b[_0x7fa3('0x71')][_0x7fa3('0x72')],_0x2b9d7b[_0x7fa3('0x56')],_0x2b9d7b[_0x7fa3('0x17f')]>0x0?getCallerIdRandom(_0x2b9d7b['dialOriginateCallerIdNumber'],_0x2b9d7b[_0x7fa3('0x17f')]):_0x2b9d7b[_0x7fa3('0x57')]):getCallerId(_[_0x7fa3('0xa7')](_0x2b9d7b[_0x7fa3('0x137')])?_0x2b9d7b[_0x7fa3('0x71')][_0x7fa3('0x72')]:_0x2b9d7b['TrunkBackup'][_0x7fa3('0x72')],_0x2b9d7b[_0x7fa3('0x56')],_0x2b9d7b[_0x7fa3('0x17f')]>0x0?getCallerIdRandom(_0x2b9d7b[_0x7fa3('0x57')],_0x2b9d7b[_0x7fa3('0x17f')]):_0x2b9d7b['dialOriginateCallerIdNumber']);if(_0x3c1007){_0x230f33[_0x7fa3('0x180')]=_0x3488c9[_0x7fa3('0x21')][_0x524486][_0x7fa3('0x181')]=extractCalleridName(_0x3c1007);_0x230f33[_0x7fa3('0x182')]=_0x3488c9[_0x7fa3('0x21')][_0x524486][_0x7fa3('0x183')]=extractCalleridNumber(_0x3c1007);}return ami[_0x7fa3('0xa8')]({'actionid':_0x524486,'action':_0x7fa3('0x160'),'channel':_0x3488c9[_0x7fa3('0xd3')](_0x2b9d7b[_0x7fa3('0x71')])?util['format']('SIP/%s/%s%s',_0x2b9d7b[_0x7fa3('0x71')][_0x7fa3('0x3a')],isNotNull(_0x2b9d7b[_0x7fa3('0x58')])?_0x2b9d7b[_0x7fa3('0x58')][_0x7fa3('0x184')]()||'':'',_0x2b9d7b['dialCutDigit']>0x0?_0x161845[_0x7fa3('0x162')]['phone'][_0x7fa3('0x185')](_0x2b9d7b['dialCutDigit']):_0x161845['Contact'][_0x7fa3('0x163')]):util[_0x7fa3('0x74')](_0x7fa3('0x186'),_[_0x7fa3('0xa7')](_0x2b9d7b[_0x7fa3('0x137')])?_0x2b9d7b[_0x7fa3('0x71')][_0x7fa3('0x3a')]:_0x2b9d7b['TrunkBackup']['name'],isNotNull(_0x2b9d7b[_0x7fa3('0x58')])?_0x2b9d7b[_0x7fa3('0x58')]['trim']()||'':'',_0x2b9d7b[_0x7fa3('0x187')]>0x0?_0x161845['Contact'][_0x7fa3('0x163')]['substring'](_0x2b9d7b[_0x7fa3('0x187')]):_0x161845['Contact'][_0x7fa3('0x163')]),'callerid':_0x3c1007,'Exten':_0x7fa3('0xdb'),'Context':'from-sip','Priority':'1','variable':_0x230f33,'timeout':(_0x2b9d7b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x524486})[_0x7fa3('0xb0')](function(_0x4f6d35){return _0x5a3138(_0x4f6d35);})[_0x7fa3('0xb1')](function(_0x353b86){_0x2b9d7b['outboundOriginateFailureCallsDay']+=0x1;var _0x518ab4=new History(_0x3488c9[_0x7fa3('0x21')][_0x524486]);logger[_0x7fa3('0x90')](util[_0x7fa3('0x74')](_0x7fa3('0x188'),JSON[_0x7fa3('0x73')](_0x353b86)));_0x518ab4['state']=0xe;_0x518ab4[_0x7fa3('0xa1')]=_0x7fa3('0x189');_0x518ab4[_0x7fa3('0xa2')]=moment()['format'](_0x7fa3('0xf2'));_0x518ab4[_0x7fa3('0x113')]=_0x518ab4['starttime'];_0x3488c9[_0x7fa3('0xd8')](_0x518ab4)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x18a')));_0x3488c9[_0x7fa3('0xc4')](_0x518ab4)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x18a')))[_0x7fa3('0x19')](function(){delete _0x3488c9[_0x7fa3('0x21')][_0x524486];return _0x25688a(msgResponse(_0x7fa3('0x160'),_0x7fa3('0x43'),_0x7fa3('0x18b')));});});});};Dialer[_0x7fa3('0x16')]['syncOriginateResponse']=function(_0xdeff35){var _0x3b4465=this[_0x7fa3('0x21')][_0xdeff35[_0x7fa3('0x11d')]];if(_0x3b4465){delete this['actions'][_0xdeff35[_0x7fa3('0x11d')]];_0x3b4465[_0x7fa3('0x10a')]=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));var _0x4f740e=_0x3b4465[_0x7fa3('0x46')]===_0x7fa3('0x8c')?this[_0x7fa3('0x1d')][_0x3b4465[_0x7fa3('0xac')]]:this[_0x7fa3('0x1c')][_0x3b4465[_0x7fa3('0x18c')]()];if(!this[_0x7fa3('0xd2')](_0xdeff35[_0x7fa3('0x18d')])){this[_0x7fa3('0xab')](_0x4f740e);return this[_0x7fa3('0x18e')](_0x3b4465,_0x4f740e,_0xdeff35)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x18f')));}this[_0x7fa3('0x23')][_0xdeff35[_0x7fa3('0xde')]]=_0x3b4465;}};Dialer[_0x7fa3('0x16')]['checkRetriveMax']=function(_0x56bd75,_0x17d793,_0x41a8cb){var _0x4d2c53=new History(_0x17d793);if(_0x4d2c53['countbusyretry']+_0x4d2c53['countcongestionretry']+_0x4d2c53[_0x7fa3('0xf8')]+_0x4d2c53[_0x7fa3('0xea')]+_0x4d2c53[_0x7fa3('0xeb')]+_0x4d2c53[_0x7fa3('0xf9')]+_0x4d2c53[_0x7fa3('0xe8')]+_0x4d2c53[_0x7fa3('0xec')]>=_0x41a8cb['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x56bd75){case 0x3:if(_0x4d2c53[_0x7fa3('0xf8')]>=_0x41a8cb[_0x7fa3('0x190')]-0x1){return!![];}this[_0x7fa3('0xba')]({'active':![],'countnoanswerretry':_0x4d2c53[_0x7fa3('0xf8')]+=0x1,'scheduledat':moment()[_0x7fa3('0xf0')](_0x41a8cb[_0x7fa3('0x191')],'minutes')[_0x7fa3('0x74')](_0x7fa3('0xf2')),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53[_0x7fa3('0xcc')],'VoiceQueueId':_0x4d2c53[_0x7fa3('0xce')]||undefined,'CampaignId':_0x4d2c53['CampaignId']||undefined})[_0x7fa3('0xb1')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x4d2c53[_0x7fa3('0xe9')]>=_0x41a8cb[_0x7fa3('0x192')]-0x1){return!![];}this[_0x7fa3('0xba')]({'active':![],'countbusyretry':_0x4d2c53[_0x7fa3('0xe9')]+=0x1,'scheduledat':moment()[_0x7fa3('0xf0')](_0x41a8cb[_0x7fa3('0x193')],_0x7fa3('0xf1'))[_0x7fa3('0x74')](_0x7fa3('0xf2')),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53[_0x7fa3('0xcc')],'VoiceQueueId':_0x4d2c53[_0x7fa3('0xce')]||undefined,'CampaignId':_0x4d2c53[_0x7fa3('0xcf')]||undefined})[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x194')));break;case 0x8:if(_0x4d2c53[_0x7fa3('0xf7')]>=_0x41a8cb[_0x7fa3('0x195')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4d2c53[_0x7fa3('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x41a8cb[_0x7fa3('0x196')],_0x7fa3('0xf1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53[_0x7fa3('0xcc')],'VoiceQueueId':_0x4d2c53[_0x7fa3('0xce')]||undefined,'CampaignId':_0x4d2c53['CampaignId']||undefined})[_0x7fa3('0xb1')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4d2c53[_0x7fa3('0xea')]>=_0x41a8cb['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x7fa3('0xba')]({'active':![],'countnosuchnumberretry':_0x4d2c53['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x7fa3('0xf0')](_0x41a8cb[_0x7fa3('0x197')],_0x7fa3('0xf1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53[_0x7fa3('0xcc')],'VoiceQueueId':_0x4d2c53[_0x7fa3('0xce')]||undefined,'CampaignId':_0x4d2c53[_0x7fa3('0xcf')]||undefined})[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x198')));}break;case 0xa:if(_0x4d2c53[_0x7fa3('0xeb')]>=_0x41a8cb[_0x7fa3('0x111')]-0x1){return!![];}this[_0x7fa3('0xba')]({'active':![],'countdropretry':_0x4d2c53[_0x7fa3('0xeb')]+=0x1,'scheduledat':moment()[_0x7fa3('0xf0')](_0x41a8cb[_0x7fa3('0x199')],_0x7fa3('0xf1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53[_0x7fa3('0xcc')],'VoiceQueueId':_0x4d2c53[_0x7fa3('0xce')]||undefined,'CampaignId':_0x4d2c53[_0x7fa3('0xcf')]||undefined})['catch'](loggerCatch(_0x7fa3('0x112')));break;case 0xb:if(_0x4d2c53['countabandonedretry']>=_0x41a8cb['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x7fa3('0xba')]({'active':![],'countabandonedretry':_0x4d2c53[_0x7fa3('0xf9')]+=0x1,'scheduledat':moment()[_0x7fa3('0xf0')](_0x41a8cb['dialAbandonedRetryFrequency'],_0x7fa3('0xf1'))[_0x7fa3('0x74')](_0x7fa3('0xf2')),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53[_0x7fa3('0xcc')],'VoiceQueueId':_0x4d2c53[_0x7fa3('0xce')]||undefined,'CampaignId':_0x4d2c53[_0x7fa3('0xcf')]||undefined})[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x11b')));break;case 0x13:if(_0x4d2c53['countmachineretry']>=_0x41a8cb[_0x7fa3('0xee')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x4d2c53[_0x7fa3('0xe8')]+=0x1,'scheduledat':moment()[_0x7fa3('0xf0')](_0x41a8cb[_0x7fa3('0xfb')],_0x7fa3('0xf1'))[_0x7fa3('0x74')](_0x7fa3('0xf2')),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53['ListId'],'VoiceQueueId':_0x4d2c53[_0x7fa3('0xce')]||undefined,'CampaignId':_0x4d2c53[_0x7fa3('0xcf')]||undefined})[_0x7fa3('0xb1')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4d2c53['countagentrejectretry']>=_0x41a8cb[_0x7fa3('0x19a')]-0x1){return!![];}this[_0x7fa3('0xba')]({'active':![],'countagentrejectretry':_0x4d2c53[_0x7fa3('0xec')]+=0x1,'scheduledat':moment()[_0x7fa3('0xf0')](_0x41a8cb[_0x7fa3('0x19b')],_0x7fa3('0xf1'))[_0x7fa3('0x74')](_0x7fa3('0xf2')),'ContactId':_0x4d2c53[_0x7fa3('0xcb')],'ListId':_0x4d2c53['ListId'],'VoiceQueueId':_0x4d2c53['VoiceQueueId']||undefined,'CampaignId':_0x4d2c53['CampaignId']||undefined})[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x19c')));break;default:return!![];}};Dialer[_0x7fa3('0x16')]['callProgressDetecting']=function(_0xd6461b,_0x39e0f2,_0x2f6ab1){var _0x1c1351=this;var _0x326993=new History(_0xd6461b);return new BPromise(function(_0x358995,_0x46c701){if(_[_0x7fa3('0x38')](_0x39e0f2)&&typeof _0x39e0f2!=='object'){return _0x46c701(msgResponse(_0x7fa3('0x19d'),_0x7fa3('0x13a'),_0x7fa3('0x19e')));}if(_[_0x7fa3('0x38')](_0x2f6ab1)&&typeof _0x2f6ab1!=='object'){return _0x46c701(msgResponse('[callProgressDetecting]','Failure',_0x7fa3('0x19f')));}switch(_0x2f6ab1[_0x7fa3('0x100')]){case'0':_0x39e0f2[_0x7fa3('0x60')]+=0x1;_0x326993[_0x7fa3('0xa0')]=0x0;_0x326993[_0x7fa3('0xa1')]='NoSuchNumber';_0x326993[_0x7fa3('0xea')]+=0x1;_0x326993[_0x7fa3('0x110')]+=0x1;ami[_0x7fa3('0xe2')](_0x7fa3('0x1a0'),ut['buildObj'](_0xd6461b,_0x7fa3('0x1a1')));_0x1c1351['createHistory'](_0x326993)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xf6')));if(_0x1c1351[_0x7fa3('0x1a2')](0x0,_0xd6461b,_0x39e0f2)){if(_0x326993['countnosuchnumberretry']>=_0x39e0f2[_0x7fa3('0x1a3')]){_0x1c1351[_0x7fa3('0xef')](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1a4'));}else{_0x1c1351[_0x7fa3('0x1a5')](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1a4'));}}break;case'3':_0x39e0f2[_0x7fa3('0x5f')]+=0x1;_0x326993['state']=0x3;_0x326993[_0x7fa3('0xa1')]=_0x7fa3('0x1a6');_0x326993[_0x7fa3('0xf8')]+=0x1;_0x326993[_0x7fa3('0x110')]+=0x1;ami[_0x7fa3('0xe2')](_0x7fa3('0x1a7'),ut[_0x7fa3('0xe4')](_0xd6461b,_0x7fa3('0x1a8')));_0x1c1351[_0x7fa3('0xd8')](_0x326993)[_0x7fa3('0xb1')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1c1351['checkRetriveMax'](0x3,_0xd6461b,_0x39e0f2)){if(_0x326993['countnoanswerretry']>=_0x39e0f2['dialNoAnswerMaxRetry']){_0x1c1351[_0x7fa3('0xef')](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1a9'));}else{_0x1c1351['stateGlobal'](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1a9'));}}break;case'5':_0x39e0f2[_0x7fa3('0x5c')]+=0x1;_0x326993[_0x7fa3('0xa0')]=0x5;_0x326993[_0x7fa3('0xa1')]=_0x7fa3('0x1aa');_0x326993[_0x7fa3('0xe9')]+=0x1;_0x326993['countglobal']+=0x1;ami[_0x7fa3('0xe2')](_0x7fa3('0x1ab'),ut[_0x7fa3('0xe4')](_0xd6461b,_0x7fa3('0x1ac')));_0x1c1351[_0x7fa3('0xd8')](_0x326993)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x1ad')));if(_0x1c1351[_0x7fa3('0x1a2')](0x5,_0xd6461b,_0x39e0f2)){if(_0x326993[_0x7fa3('0xe9')]>=_0x39e0f2[_0x7fa3('0x192')]){_0x1c1351[_0x7fa3('0xef')](_0x326993,_0x358995,_0x46c701,'reason\x205\x20busy');}else{_0x1c1351[_0x7fa3('0x1a5')](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1ae'));}}break;case'8':_0x39e0f2['outboundCongestionCallsDay']+=0x1;_0x326993[_0x7fa3('0xa0')]=0x8;_0x326993['statedesc']=_0x7fa3('0x1af');_0x326993[_0x7fa3('0xf7')]+=0x1;_0x326993[_0x7fa3('0x110')]+=0x1;ami[_0x7fa3('0xe2')](_0x7fa3('0x1b0'),ut[_0x7fa3('0xe4')](_0xd6461b,_0x7fa3('0x1b1')));_0x1c1351[_0x7fa3('0xd8')](_0x326993)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x1b2')));if(_0x1c1351['checkRetriveMax'](0x8,_0xd6461b,_0x39e0f2)){if(_0x326993[_0x7fa3('0xf7')]>=_0x39e0f2[_0x7fa3('0x195')]){_0x1c1351[_0x7fa3('0xef')](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1b3'));}else{_0x1c1351[_0x7fa3('0x1a5')](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1b3'));}}break;case'11':_0x39e0f2[_0x7fa3('0x1b4')]+=0x1;_0x326993[_0x7fa3('0xa0')]=0xb;_0x326993[_0x7fa3('0xa1')]=_0x7fa3('0x117');_0x326993[_0x7fa3('0xf9')]+=0x1;_0x326993['countglobal']+=0x1;_0x1c1351['createHistory'](_0x326993)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1c1351['checkRetriveMax'](0xb,_0xd6461b,_0x39e0f2)){if(_0x326993[_0x7fa3('0xf9')]>=_0x39e0f2['dialAbandonedMaxRetry']){_0x1c1351[_0x7fa3('0xef')](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1b5'));}else{_0x1c1351[_0x7fa3('0x1a5')](_0x326993,_0x358995,_0x46c701,'reason\x2011\x20abandoned');}}break;case'20':_0x39e0f2[_0x7fa3('0x1b6')]+=0x1;_0x326993[_0x7fa3('0xa0')]=0x14;_0x326993[_0x7fa3('0xa1')]=_0x7fa3('0x1b7');_0x326993['countagentrejectretry']+=0x1;_0x326993[_0x7fa3('0x110')]+=0x1;ami[_0x7fa3('0xe2')](_0x7fa3('0x1b8'),ut['buildObj'](_0xd6461b,_0x7fa3('0x1b9')));_0x1c1351[_0x7fa3('0xd8')](_0x326993)['catch'](loggerCatch(_0x7fa3('0x1ba')));if(_0x1c1351['checkRetriveMax'](0x14,_0xd6461b,_0x39e0f2)){if(_0x326993[_0x7fa3('0xec')]>=_0x39e0f2[_0x7fa3('0x19a')]){_0x1c1351['createStateFinal'](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1bb'));}else{_0x1c1351['stateGlobal'](_0x326993,_0x358995,_0x46c701,_0x7fa3('0x1bb'));}}break;default:_0x39e0f2[_0x7fa3('0x1bc')]+=0x1;_0x326993[_0x7fa3('0xa0')]=0xc;_0x326993[_0x7fa3('0xa1')]=_0x2f6ab1[_0x7fa3('0x100')];_0x1c1351[_0x7fa3('0xd8')](_0x326993)[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x1bd')));if(_0x1c1351[_0x7fa3('0x1a2')](_0x2f6ab1[_0x7fa3('0x100')],_0xd6461b,_0x39e0f2)){if(_0x326993['countbusyretry']+_0x326993[_0x7fa3('0xf7')]+_0x326993[_0x7fa3('0xf8')]+_0x326993[_0x7fa3('0xea')]+_0x326993[_0x7fa3('0xeb')]+_0x326993[_0x7fa3('0xf9')]+_0x326993[_0x7fa3('0xe8')]+_0x326993['countagentrejectretry']>=_0x39e0f2[_0x7fa3('0xed')]){_0x1c1351[_0x7fa3('0x1a5')](_0x326993,_0x358995,_0x46c701,_0x2f6ab1['reason']);}else{_0x1c1351['createStateFinal'](_0x326993,_0x358995,_0x46c701,_0x2f6ab1[_0x7fa3('0x100')]);}}}});};Dialer[_0x7fa3('0x16')][_0x7fa3('0x1a5')]=function(_0x510889,_0x5a9485,_0x36f814,_0x4cf169){var _0x2736f0=new Final(_0x510889);_0x2736f0[_0x7fa3('0xa0')]=0xf;_0x2736f0[_0x7fa3('0xa1')]='Global';this[_0x7fa3('0xef')](_0x2736f0,_0x5a9485,_0x36f814,_0x4cf169);};Dialer[_0x7fa3('0x16')][_0x7fa3('0xef')]=function(_0x2c13c0,_0xcfd9af,_0x13cd96,_0x16ee18){this['moveContactManagedDialer'](_0x2c13c0)[_0x7fa3('0xb0')](function(){return _0xcfd9af(msgResponse(_0x7fa3('0x19d'),_0x7fa3('0x1be'),_0x16ee18));})[_0x7fa3('0xb1')](function(){return _0x13cd96(msgResponse(_0x7fa3('0x1bf'),'Failure',_0x7fa3('0x1c0')));});};Dialer[_0x7fa3('0x16')]['predictive']=function(_0x5b4edd){var _0x3cd30c=_0x5b4edd[_0x7fa3('0x1c1')]/0x64;var _0x309080=_0x5b4edd['outboundDropCallsDayTimeout']/(_0x5b4edd['outboundDropCallsDayTimeout']+_0x5b4edd[_0x7fa3('0x5a')]);var _0xeffb1c=Math[_0x7fa3('0x1c2')](_0x5b4edd[_0x7fa3('0x6a')]*(_0x5b4edd[_0x7fa3('0x1c3')]/0x64));var _0x55ef77=Math['round'](_0x5b4edd[_0x7fa3('0x6a')]*(_0x5b4edd['predictiveIntervalMinThreshold']/0x64));var _0x4e80fc=_0x5b4edd['available']+_0x5b4edd[_0x7fa3('0x4f')];var _0x4fc2f6=Math['floor'](_0x5b4edd[_0x7fa3('0x6d')]*_0x5b4edd['erlangAbandonmentRate']*_0x5b4edd[_0x7fa3('0x67')]*_0x5b4edd[_0x7fa3('0x68')]);if(_[_0x7fa3('0x38')](_0x5b4edd[_0x7fa3('0x26')])){if(!_[_0x7fa3('0x38')](_0x5b4edd['startPredictive'])){_0x5b4edd['startPredictive']=undefined;loggerPredictive[_0x7fa3('0x90')](_0x7fa3('0x1c4'),_0x7fa3('0x1c5'));}if(!_[_0x7fa3('0x38')](_0x5b4edd[_0x7fa3('0x8a')])){loggerPredictive[_0x7fa3('0x90')](_0x7fa3('0x1c4'),_0x7fa3('0x1c6'));clearInterval(_0x5b4edd['handlePredictive']);_0x5b4edd['handlePredictive']=undefined;}_0x5b4edd['startProgressive']=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));loggerPredictive[_0x7fa3('0x78')](_0x5b4edd[_0x7fa3('0x3a')],'collection\x20data\x20in\x20progressive\x20at',_0x5b4edd[_0x7fa3('0x26')]);this[_0x7fa3('0x14d')](_0x5b4edd,0x1);}else if(ifInterval(_0x5b4edd[_0x7fa3('0x1c7')],_0x5b4edd['startProgressive'])){this[_0x7fa3('0x14d')](_0x5b4edd,0x1);loggerPredictiveCalls['info'](_0x7fa3('0x1c8'),_0x5b4edd[_0x7fa3('0x26')],_0x5b4edd[_0x7fa3('0x3a')]);_0x5b4edd[_0x7fa3('0x6d')]=0x0;_0x5b4edd[_0x7fa3('0x66')]=0x0;}else if(_0x3cd30c<_0x309080&&_0x5b4edd[_0x7fa3('0x1c9')]===_0x7fa3('0x1ca')){freeVariablesPredictive(_0x5b4edd);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x1cb'),_0x7fa3('0x1cc'),_0x309080,'startProgressive',_0x5b4edd[_0x7fa3('0x3a')]);}else if(_0x4fc2f6<_0x5b4edd[_0x7fa3('0x66')]&&_0x5b4edd[_0x7fa3('0x1c9')]===_0x7fa3('0x1ca')){freeVariablesPredictive(_0x5b4edd);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x1cd'),_0x7fa3('0x1ce'),_0x4fc2f6,_0x7fa3('0x1cf'),_0x5b4edd[_0x7fa3('0x66')],'startProgressive',_0x5b4edd[_0x7fa3('0x3a')]);}else if(!ifInterval(_0x5b4edd[_0x7fa3('0x1c7')],_0x5b4edd['startProgressive'])&&_[_0x7fa3('0x38')](_0x5b4edd[_0x7fa3('0x25')])&&!_[_0x7fa3('0x38')](_0x5b4edd[_0x7fa3('0x26')])){_0x5b4edd['startPredictive']=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));loggerPredictive[_0x7fa3('0x78')](_0x5b4edd[_0x7fa3('0x3a')],_0x7fa3('0x1d0'),_0x5b4edd[_0x7fa3('0x25')]);this[_0x7fa3('0xb7')](_0x5b4edd[_0x7fa3('0x1c7')])[_0x7fa3('0xb0')](this[_0x7fa3('0x1d1')](_0x5b4edd))[_0x7fa3('0xb0')](mergeDataErlangB(_0x5b4edd))[_0x7fa3('0xb0')](this[_0x7fa3('0x1d2')](_0x5b4edd))[_0x7fa3('0xb1')](loggerCatchPredictive(_0x7fa3('0x1d3'),_0x5b4edd));}else if(!ifInterval(_0x5b4edd[_0x7fa3('0x1c7')],_0x5b4edd[_0x7fa3('0x25')])){_0x5b4edd['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5b4edd[_0x7fa3('0x25')]=moment()[_0x7fa3('0x74')](_0x7fa3('0xf2'));loggerPredictive[_0x7fa3('0x78')](_0x5b4edd[_0x7fa3('0x3a')],_0x7fa3('0x1d4'),_0x5b4edd['startPredictive']);clearInterval(_0x5b4edd['handlePredictive']);_0x5b4edd[_0x7fa3('0x8a')]=undefined;this[_0x7fa3('0xb7')](_0x5b4edd[_0x7fa3('0x1c7')])[_0x7fa3('0xb0')](this[_0x7fa3('0x1d1')](_0x5b4edd))[_0x7fa3('0xb0')](mergeDataErlangB(_0x5b4edd))['then'](this[_0x7fa3('0x1d2')](_0x5b4edd))[_0x7fa3('0xb1')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5b4edd));}else if(_0x5b4edd[_0x7fa3('0x6a')]&&_0x4e80fc<_0x5b4edd[_0x7fa3('0x6a')]-_0x55ef77){freeVariablesPredictive(_0x5b4edd);loggerPredictive[_0x7fa3('0x78')](_0x5b4edd[_0x7fa3('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4e80fc,_0x7fa3('0x1d5'),_0x5b4edd[_0x7fa3('0x6a')],'-',_0x55ef77,'=',_0x5b4edd['predictiveIntervalAvailable']-_0x55ef77,')');}else if(_0x5b4edd[_0x7fa3('0x6a')]&&_0x4e80fc>_0x5b4edd[_0x7fa3('0x6a')]+_0xeffb1c){freeVariablesPredictive(_0x5b4edd);loggerPredictive['info'](_0x5b4edd[_0x7fa3('0x3a')],_0x7fa3('0x1d6'),_0x4e80fc,_0x7fa3('0x1d7'),_0x5b4edd[_0x7fa3('0x6a')],'+',_0xeffb1c,'=',_0x5b4edd[_0x7fa3('0x6a')]+_0xeffb1c,')');}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x1d1')]=function(_0xfa2402){var _0x13be28=this;return function(_0x5e7972){return new BPromise(function(_0x545a4d,_0x3fe498){_['merge'](_0xfa2402,_0x5e7972[0x0]);if(checkGetDataPredictive(_0x5e7972[0x0])){var _0x4acef0=_0xfa2402[_0x7fa3('0x6a')]=_0xfa2402['talking']+_0xfa2402['available'];var _0x4609a2=_0xfa2402[_0x7fa3('0x1c7')]*0x3c;var _0x45d12b=_0x5e7972[0x0][_0x7fa3('0x7e')]+_0x5e7972[0x0][_0x7fa3('0x64')];var _0x107cb3=(_0x5e7972[0x0][_0x7fa3('0x63')]+_0x5e7972[0x0][_0x7fa3('0x10c')]+_0x5e7972[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5e7972[0x0][_0x7fa3('0x6b')];_0xfa2402[_0x7fa3('0x67')]=_0x107cb3>0x0?_0x107cb3:0x1;switch(_0xfa2402['dialPredictiveOptimization']){case _0x7fa3('0x1ca'):var _0x4bfdf3=_0xfa2402[_0x7fa3('0x1c1')]/0x64;return _0x13be28[_0x7fa3('0x1d8')](_0x4acef0,_0x4609a2,_0x45d12b,_0x107cb3,_0x4bfdf3)[_0x7fa3('0xb0')](function(_0x8d85cd){return _0x545a4d(_0x8d85cd);});case _0x7fa3('0x1d9'):var _0x5940b7=_0xfa2402[_0x7fa3('0x1c1')]/0x64;return _0x13be28[_0x7fa3('0x1da')](_0x4acef0,_0x4609a2,_0x45d12b,_0x107cb3,_0x5940b7)[_0x7fa3('0xb0')](function(_0x16014c){return _0x545a4d(_0x16014c);});default:return _0x3fe498(msgResponse('[getDataPredictive]','Failure',_0x7fa3('0x1db')));}}else{return _0x3fe498(msgResponse(_0x7fa3('0x1dc'),'Failure',_0x7fa3('0x1dd')));}});};};Dialer[_0x7fa3('0x16')][_0x7fa3('0x1de')]=function(_0x2242d){var _0x5ca127=this;return function(_0x35faf6){return new BPromise(function(_0x2603a2,_0x3fef48){_[_0x7fa3('0x123')](_0x2242d,_0x35faf6[0x0]);if(checkGetDataPredictive(_0x35faf6[0x0])){loggerPredictive['info'](JSON[_0x7fa3('0x73')](_0x35faf6[0x0]));if(_0x2242d[_0x7fa3('0x1c9')]===_0x7fa3('0x1ca')){return _0x5ca127[_0x7fa3('0xc3')](_0x2242d['id'])[_0x7fa3('0xb0')](function(_0x1db401){var _0xa36dfa=_0x2242d[_0x7fa3('0x4a')]-_0x1db401[0x0][_0x7fa3('0x1df')];var _0x401dc0=_0x2242d['dialPredictiveInterval']*0x3c;var _0xe34db1=_0x35faf6[0x0][_0x7fa3('0x7e')]+_0x35faf6[0x0][_0x7fa3('0x64')];var _0x2d445b=(_0x35faf6[0x0][_0x7fa3('0x63')]+_0x35faf6[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x35faf6[0x0][_0x7fa3('0x1e0')])/_0x35faf6[0x0]['predictiveIntervalTotalCalls'];var _0x11c5e0=_0x2242d['dialPredictiveOptimizationPercentage']/0x64;_0x2242d[_0x7fa3('0x69')]=_0x1db401[0x0]['outboundQueuePauses']||0x0;_0x2242d[_0x7fa3('0x67')]=_0x2d445b>0x0?_0x2d445b:0x1;return _0x5ca127[_0x7fa3('0x1d8')](_0xa36dfa,_0x401dc0,_0xe34db1,_0x2d445b,_0x11c5e0);})[_0x7fa3('0xb0')](function(_0x38a4fd){return _0x2603a2(_0x38a4fd);})[_0x7fa3('0xb1')](function(_0x326ffe){return _0x3fef48(msgResponse(_0x7fa3('0x1e1'),_0x7fa3('0x13a'),JSON[_0x7fa3('0x73')](_0x326ffe)));});}if(_0x2242d[_0x7fa3('0x1c9')]===_0x7fa3('0x1d9')){return _0x5ca127[_0x7fa3('0xc3')](_0x2242d['id'])[_0x7fa3('0xb0')](function(_0x3a2eba){var _0x4377db=_0x2242d[_0x7fa3('0x4a')]-_0x3a2eba[0x0][_0x7fa3('0x1df')];var _0x1cb525=_0x2242d[_0x7fa3('0x1c7')]*0x3c;var _0x145809=_0x35faf6[0x0][_0x7fa3('0x7e')]+_0x35faf6[0x0][_0x7fa3('0x64')];var _0x2f786c=(_0x35faf6[0x0][_0x7fa3('0x63')]+_0x35faf6[0x0][_0x7fa3('0x10c')]+_0x35faf6[0x0][_0x7fa3('0x1e0')])/_0x35faf6[0x0][_0x7fa3('0x6b')];var _0x666ffe=_0x2242d[_0x7fa3('0x1c1')]/0x64;_0x2242d[_0x7fa3('0x69')]=_0x3a2eba[0x0][_0x7fa3('0x1df')]||0x0;_0x2242d['predictiveIntervalHitRate']=_0x2f786c>0x0?_0x2f786c:0x1;return _0x5ca127[_0x7fa3('0x1da')](_0x4377db,_0x1cb525,_0x145809,_0x2f786c,_0x666ffe);})['then'](function(_0x56a7ce){return _0x2603a2(_0x56a7ce);})['catch'](function(_0x2adf7f){return _0x3fef48(msgResponse(_0x7fa3('0x1e1'),_0x7fa3('0x13a'),JSON[_0x7fa3('0x73')](_0x2adf7f)));});}}else{return _0x3fef48(msgResponse(_0x7fa3('0x1dc'),'Failure',_0x7fa3('0x1dd')));}});};};Dialer[_0x7fa3('0x16')][_0x7fa3('0x1d2')]=function(_0x148cfe){var _0x58a877=this;return function(){var _0x57194b=0x0;var _0x10c711=Math[_0x7fa3('0x1e2')](_0x148cfe['erlangCallToSecond']*0x3e8);if(_0x10c711>0x0){_0x10c711=_0x10c711<0x64?0x64:_0x10c711;loggerPredictive[_0x7fa3('0x78')](_0x148cfe[_0x7fa3('0x3a')],_0x7fa3('0x1e3'),_0x10c711,_0x7fa3('0x87'));_0x148cfe['handlePredictive']=setInterval(function(){_0x58a877[_0x7fa3('0x8a')](_0x148cfe);loggerPredictiveCalls[_0x7fa3('0x78')](_0x7fa3('0x1e4'),_0x57194b+=0x1);},_0x10c711);}else{loggerPredictive[_0x7fa3('0x78')](_0x148cfe[_0x7fa3('0x3a')],_0x7fa3('0x1e5'));}};};Dialer['prototype'][_0x7fa3('0x1e6')]=function(_0x3791b4,_0x3a4e08){var _0x277ddf=this;return function(_0x204e92){if(_[_0x7fa3('0x77')](_0x204e92)){if(_[_0x7fa3('0xa7')](_0x3a4e08['UserId'])||!_0x3a4e08[_0x7fa3('0x1e7')]){if(_0x3791b4[_0x7fa3('0x55')]===_0x7fa3('0x7')){_0x3791b4[_0x7fa3('0x125')]=_[_0x7fa3('0x38')](_0x3791b4[_0x7fa3('0x125')])?!![]:_0x3791b4[_0x7fa3('0x125')];var _0x569a3e=uuid['v4']();_0x277ddf[_0x7fa3('0x21')][_0x569a3e]=new Action(_0x3791b4,_0x3a4e08,_0x569a3e);loggerBooked[_0x7fa3('0x78')](_0x7fa3('0x1e8'),_0x569a3e,_0x7fa3('0x1e9'),JSON[_0x7fa3('0x73')](_0x3791b4[_0x7fa3('0x125')]),_0x7fa3('0x1ea'),_0x3791b4[_0x7fa3('0x3a')]);if(_0x3791b4[_0x7fa3('0x125')]){_0x3791b4[_0x7fa3('0x125')]=![];_0x277ddf[_0x7fa3('0x28')][_0x277ddf[_0x7fa3('0x21')][_0x569a3e][_0x7fa3('0xac')]]=[];ami['Action']({'actionid':_0x569a3e,'action':_0x7fa3('0x1eb'),'queue':_0x3791b4[_0x7fa3('0x3a')]})[_0x7fa3('0xb1')](function(){_0x277ddf[_0x7fa3('0xab')](_0x3791b4);_0x277ddf[_0x7fa3('0xba')]({'active':![],'ContactId':_0x277ddf['actions'][_0x569a3e]['ContactId'],'ListId':_0x277ddf[_0x7fa3('0x21')][_0x569a3e][_0x7fa3('0xcc')],'VoiceQueueId':_0x277ddf[_0x7fa3('0x21')][_0x569a3e][_0x7fa3('0xce')]||undefined,'CampaignId':_0x277ddf['actions'][_0x569a3e]['CampaignId']||undefined})[_0x7fa3('0xb1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x277ddf['actions'][_0x569a3e];});}else{loggerBooked['info'](_0x7fa3('0x1ec'),JSON[_0x7fa3('0x73')](_0x3791b4[_0x7fa3('0x125')]),_0x7fa3('0x1ea'),_0x3791b4[_0x7fa3('0x3a')]);_0x277ddf['updateOriginated'](_0x3791b4);_0x277ddf[_0x7fa3('0xba')]({'active':![],'ContactId':_0x277ddf[_0x7fa3('0x21')][_0x569a3e][_0x7fa3('0xcb')],'ListId':_0x277ddf[_0x7fa3('0x21')][_0x569a3e][_0x7fa3('0xcc')],'VoiceQueueId':_0x277ddf[_0x7fa3('0x21')][_0x569a3e]['VoiceQueueId']||undefined,'CampaignId':_0x277ddf[_0x7fa3('0x21')][_0x569a3e][_0x7fa3('0xcf')]||undefined})[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x1ed')));delete _0x277ddf[_0x7fa3('0x21')][_0x569a3e];}}else{return _0x277ddf[_0x7fa3('0x15e')](_0x3791b4,_0x3a4e08);}}else{if(getDiff(_0x3a4e08[_0x7fa3('0x1ee')])<_0x3791b4[_0x7fa3('0x1ef')]*0x3c){if(_0x3a4e08[_0x7fa3('0x1f0')]&&!_0x3a4e08[_0x7fa3('0x1f0')][_0x7fa3('0x1f1')]){_0x277ddf[_0x7fa3('0x1b')][_0x7fa3('0x12d')](_0x3a4e08['id'])[_0x7fa3('0x19')](function(){_0x277ddf[_0x7fa3('0xab')](_0x3791b4);});}else{_0x277ddf['unlockContact']({'active':![]},_0x3a4e08['id'],0x1)['finally'](function(){_0x277ddf[_0x7fa3('0xab')](_0x3791b4);});}}else{_0x3791b4['outboundReCallsDay']+=0x1;_0x277ddf[_0x7fa3('0xab')](_0x3791b4);if(_0x3791b4[_0x7fa3('0x1f2')]){_0x277ddf[_0x7fa3('0xba')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3a4e08[_0x7fa3('0xcb')],'ListId':_0x3a4e08['ListId'],'VoiceQueueId':_0x3a4e08[_0x7fa3('0xce')]||undefined,'CampaignId':_0x3a4e08['CampaignId']||undefined})['catch'](loggerCatch(_0x7fa3('0x1f3')));_0x277ddf[_0x7fa3('0xd8')](createObjHistory(_0x3791b4,_0x3a4e08,'RECALLINQUEUE',0x17,_0x7fa3('0x1f4')))[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0x1f5')));}else{_0x277ddf[_0x7fa3('0xc9')](createObjHistory(_0x3791b4,_0x3a4e08,_0x7fa3('0x1f6'),0x16,_0x7fa3('0x1f7')),_0x7fa3('0x1f8'),'[Originate][HistoryRecallClose]');}}}}else{_0x3791b4[_0x7fa3('0x5b')]+=0x1;_0x277ddf[_0x7fa3('0xc9')](createObjHistory(_0x3791b4,_0x3a4e08,_0x7fa3('0x1f9'),0xd,_0x7fa3('0x1fa')),_0x7fa3('0x1fb'),_0x7fa3('0x1fc'));throw _0x7fa3('0x1fd');}};};Dialer[_0x7fa3('0x16')][_0x7fa3('0x1fe')]=function(_0xa901ef){var _0x2d7d5f=this;var _0x5a4bd6=_0xa901ef[_0x7fa3('0x1ff')]-_0xa901ef[_0x7fa3('0x6c')]-_0xa901ef[_0x7fa3('0xbf')];emitCampaignSummary(_0xa901ef);if(_0x5a4bd6>0x0){if(_0x5a4bd6>this[_0x7fa3('0x20')]){_0x5a4bd6=this[_0x7fa3('0x20')];}_0xa901ef[_0x7fa3('0xbf')]+=_0x5a4bd6;this[_0x7fa3('0xc1')](_0xa901ef['id'],_0x5a4bd6,_0xa901ef[_0x7fa3('0x200')],_0xa901ef)[_0x7fa3('0xb0')](function(_0x5d2c37){_0xa901ef[_0x7fa3('0xbf')]-=_0x5a4bd6;_0xa901ef[_0x7fa3('0xbf')]=_0xa901ef[_0x7fa3('0xbf')]>0x0?_0xa901ef[_0x7fa3('0xbf')]:0x0;if(!checkContactEmpty(_0x5d2c37)){_0xa901ef[_0x7fa3('0x3c')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x7fa3('0x78')]('[getContactCampaign2][Empty]'+_0xa901ef['name']);}else{_0xa901ef[_0x7fa3('0x6c')]+=_0x5d2c37[_0x7fa3('0x93')];_0xa901ef[_0x7fa3('0x3c')]=_0x7fa3('0x201');for(var _0x14aceb=0x0;_0x14aceb<_0x5d2c37[_0x7fa3('0x93')];_0x14aceb+=0x1){_0xa901ef['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x5d2c37[_0x14aceb])||_[_0x7fa3('0xa7')](_0x5d2c37[_0x14aceb][_0x7fa3('0x162')])||_[_0x7fa3('0xa7')](_0x5d2c37[_0x14aceb][_0x7fa3('0x162')][_0x7fa3('0x163')])){_0x2d7d5f['emptyContact'](_0x7fa3('0x202'),_0xa901ef,_0x5d2c37[_0x14aceb]);}else{_0x2d7d5f[_0x7fa3('0xb5')](_[_0x7fa3('0xca')](_0x5d2c37[_0x14aceb],['CampaignId',_0x7fa3('0x203')]))[_0x7fa3('0xb0')](_0x2d7d5f[_0x7fa3('0x1e6')](_0xa901ef,_0x5d2c37[_0x14aceb]))[_0x7fa3('0xb1')](_0x2d7d5f[_0x7fa3('0xc7')](_0x7fa3('0x204'),_0xa901ef));}}}})[_0x7fa3('0xb1')](loggerGetContactDialer(_0x7fa3('0x205'),_0xa901ef,_0x5a4bd6));}};Dialer[_0x7fa3('0x16')]['handlePower']=function(_0x56ce9a,_0x445a1c){var _0x3c08de=this;var _0x1691a0=[];var _0x3ae614=_0x445a1c>=0x1?_0x445a1c:0x1;if(_0x56ce9a[_0x7fa3('0x55')]==='booked'){_0x3ae614=0x1;}var _0x5f3b59=Math['floor'](_0x56ce9a['available']*_0x3ae614)-_0x56ce9a[_0x7fa3('0x6c')]-_0x56ce9a[_0x7fa3('0xbf')];emitVoiceQueueSummary(_0x56ce9a);if(_0x56ce9a[_0x7fa3('0x206')]>0x0){var _0x1cff02=_0x56ce9a[_0x7fa3('0x206')]-_0x56ce9a[_0x7fa3('0x6c')]-_0x56ce9a[_0x7fa3('0x4f')]-_0x56ce9a[_0x7fa3('0xbf')]-_0x56ce9a[_0x7fa3('0x4b')];if(_0x5f3b59>_0x1cff02){_0x5f3b59=_0x1cff02;}}if(_0x5f3b59>0x0){if(_0x56ce9a[_0x7fa3('0x55')]===_0x7fa3('0x7')){_0x5f3b59=0x1;}if(_0x5f3b59>this[_0x7fa3('0x20')]){_0x5f3b59=this[_0x7fa3('0x20')];}_0x56ce9a[_0x7fa3('0xbf')]+=_0x5f3b59;for(var _0x851340 in this['agents']){if(typeof this[_0x7fa3('0x1e')][_0x851340]!==_0x7fa3('0x94')){if(this['agents'][_0x851340][_0x7fa3('0xa0')]===_0x7fa3('0x207')&&this['agents'][_0x851340][_0x7fa3('0xa9')]===_0x7fa3('0xd6')){_0x1691a0[_0x7fa3('0x122')](this[_0x7fa3('0x1e')][_0x851340]['id']);}}}this[_0x7fa3('0xbe')](_0x56ce9a['id'],_0x1691a0,_0x5f3b59,_0x56ce9a['dialOrderByScheduledAt'],_0x56ce9a)['then'](function(_0x59327c){_0x56ce9a[_0x7fa3('0xbf')]-=_0x5f3b59;_0x56ce9a['temp']=_0x56ce9a[_0x7fa3('0xbf')]>0x0?_0x56ce9a[_0x7fa3('0xbf')]:0x0;if(!checkContactEmpty(_0x59327c)){_0x3c08de[_0x7fa3('0xae')](_0x56ce9a)[_0x7fa3('0xb0')](sendMessageReschedule(_0x56ce9a))[_0x7fa3('0xb1')](loggerCatch(_0x7fa3('0xb2')));}else{_0x56ce9a[_0x7fa3('0x6c')]+=_0x59327c[_0x7fa3('0x93')];_0x56ce9a[_0x7fa3('0x3c')]=_0x56ce9a[_0x7fa3('0x55')]===_0x7fa3('0x7')?_0x7fa3('0x16a'):_0x7fa3('0x201');for(var _0x4e51f3=0x0;_0x4e51f3<_0x59327c[_0x7fa3('0x93')];_0x4e51f3+=0x1){if(_[_0x7fa3('0xa7')](_0x59327c[_0x4e51f3])||_[_0x7fa3('0xa7')](_0x59327c[_0x4e51f3]['Contact'])||_[_0x7fa3('0xa7')](_0x59327c[_0x4e51f3]['Contact'][_0x7fa3('0x163')])){_0x3c08de['emptyContact'](_0x7fa3('0x202'),_0x56ce9a,_0x59327c[_0x4e51f3]);}else{_0x3c08de['checkIsBlackList'](_[_0x7fa3('0xca')](_0x59327c[_0x4e51f3],[_0x7fa3('0xce'),_0x7fa3('0x203')]))[_0x7fa3('0xb0')](_0x3c08de[_0x7fa3('0x1e6')](_0x56ce9a,_0x59327c[_0x4e51f3]))[_0x7fa3('0xb1')](_0x3c08de[_0x7fa3('0xc7')](_0x7fa3('0x202'),_0x56ce9a));}}}})[_0x7fa3('0xb1')](loggerGetContactDialer(_0x7fa3('0x208'),_0x56ce9a,_0x5f3b59));}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x8a')]=function(_0x6efdaf){if(_0x6efdaf[_0x7fa3('0x206')]>0x0){var _0xd85d04=_0x6efdaf['dialLimitQueue']-_0x6efdaf[_0x7fa3('0x6c')]-_0x6efdaf[_0x7fa3('0x4f')];if(_0xd85d04>0x0){this[_0x7fa3('0x209')](_0x6efdaf);}else{loggerPredictiveCalls[_0x7fa3('0x78')](_0x7fa3('0x20a'));}}else{this['tryOriginatePredictive'](_0x6efdaf);}};Dialer[_0x7fa3('0x16')][_0x7fa3('0x209')]=function(_0x4768bd){var _0x5d7b69=this;var _0x36ab59=[];_0x4768bd[_0x7fa3('0x6c')]+=0x1;for(var _0x40401f in this[_0x7fa3('0x1e')]){if(typeof this[_0x7fa3('0x1e')][_0x40401f]!=='undefined'){if(this[_0x7fa3('0x1e')][_0x40401f][_0x7fa3('0xa0')]===_0x7fa3('0x207')&&this[_0x7fa3('0x1e')][_0x40401f][_0x7fa3('0xa9')]===_0x7fa3('0xd6')){_0x36ab59[_0x7fa3('0x122')](this[_0x7fa3('0x1e')][_0x40401f]['id']);}}}this[_0x7fa3('0xbe')](_0x4768bd['id'],_0x36ab59,0x1,_0x4768bd[_0x7fa3('0x200')],_0x4768bd)[_0x7fa3('0xb0')](function(_0x21c2df){if(!checkContactEmpty(_0x21c2df)){checkContactLowerLimitOriginate(_0x4768bd,0x1,0x0);_0x5d7b69['countReScheduled'](_0x4768bd)[_0x7fa3('0xb0')](sendMessageReschedule(_0x4768bd))['catch'](loggerCatch(_0x7fa3('0xb2')));}else{_0x4768bd[_0x7fa3('0x3c')]=_0x7fa3('0x201');if(_[_0x7fa3('0xa7')](_0x21c2df[0x0])||_[_0x7fa3('0xa7')](_0x21c2df[0x0]['Contact'])||_['isNil'](_0x21c2df[0x0][_0x7fa3('0x162')][_0x7fa3('0x163')])){_0x5d7b69[_0x7fa3('0xc8')](_0x7fa3('0x202'),_0x4768bd,_0x21c2df[0x0]);}else{_0x5d7b69[_0x7fa3('0xb3')](_[_0x7fa3('0xca')](_0x21c2df[0x0],[_0x7fa3('0xce'),_0x7fa3('0x203')]))[_0x7fa3('0xb0')](_0x5d7b69[_0x7fa3('0x1e6')](_0x4768bd,_0x21c2df[0x0]))[_0x7fa3('0xb1')](_0x5d7b69[_0x7fa3('0xc7')](_0x7fa3('0x20b'),_0x4768bd));}}})[_0x7fa3('0xb1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x4768bd,0x1));emitVoiceQueueSummary(_0x4768bd);};Dialer[_0x7fa3('0x16')]['abandonmentRate']=function(_0x349f28,_0xde28b9,_0x1017d7,_0x3895b7,_0x10c4ca,_0x503d14){loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x20c'));loggerPredictive['info'](_0x7fa3('0x20d'),_0x349f28);loggerPredictive[_0x7fa3('0x78')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xde28b9);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x20e'),_0x1017d7);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x20f'),_0x3895b7);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x210'),_0x10c4ca);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x7f'));return new BPromise(function(_0x47c782,_0x89d6be){if(_0x349f28<=0x0||isNaN(_0x349f28)){return _0x89d6be(msgResponse(_0x7fa3('0x211'),'Error',_0x7fa3('0x212')+_0x349f28));}if(_0x1017d7<=0x0||isNaN(_0x1017d7)){return _0x89d6be(msgResponse(_0x7fa3('0x211'),_0x7fa3('0x43'),_0x7fa3('0x213')+_0x1017d7));}if(_0x3895b7<=0x0||isNaN(_0x3895b7)){return _0x89d6be(msgResponse(_0x7fa3('0x211'),'Error',_0x7fa3('0x214')+_0x3895b7));}if(_0xde28b9<=0x0||isNaN(_0xde28b9)){return _0x89d6be(msgResponse(_0x7fa3('0x211'),_0x7fa3('0x43'),_0x7fa3('0x215')+_0xde28b9));}if(_0x10c4ca<=0x0||isNaN(_0x10c4ca)){return _0x89d6be(msgResponse(_0x7fa3('0x211'),_0x7fa3('0x43'),'Amax\x20=\x20'+_0x10c4ca));}_0x503d14=_0x503d14||0x0;var _0x2d7c04=0x1/_0x1017d7;var _0x5a786d=0x0;var _0x103d68=0x0;var _0x48862e=0x0;var _0xa143b1=0x0;for(var _0x41a89f=0x0;_0x48862e<_0x10c4ca;_0x41a89f+=0x1){_0x103d68=_0x41a89f/_0xde28b9;_0x5a786d=(_0x3895b7*_0x103d68+_0x503d14)/_0x2d7c04;_0x48862e=erlangb(_0x5a786d,_0x349f28);_0xa143b1=_0x5a786d/_0x349f28*(0x1-erlangb(_0x5a786d,_0x349f28));}return _0x47c782({'erlangCalls':_0x41a89f,'erlangCallToSecond':_0xde28b9/_0x41a89f,'erlangAbandonmentRate':_0x48862e,'erlangBusyFactor':_0xa143b1});});};Dialer[_0x7fa3('0x16')][_0x7fa3('0x1da')]=function(_0x4ba1b2,_0x169dfc,_0x1ce273,_0x37bfe1,_0x1e4627,_0x4ec0ee){loggerPredictive['info'](_0x7fa3('0x216'));loggerPredictive[_0x7fa3('0x78')]('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',_0x4ba1b2);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x217'),_0x169dfc);loggerPredictive['info'](_0x7fa3('0x20e'),_0x1ce273);loggerPredictive['info'](_0x7fa3('0x20f'),_0x37bfe1);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x218'),_0x1e4627);loggerPredictive[_0x7fa3('0x78')](_0x7fa3('0x7f'));return new BPromise(function(_0x3b44af,_0x831c8f){if(_0x4ba1b2<=0x0||isNaN(_0x4ba1b2)){return _0x831c8f(msgResponse(_0x7fa3('0x219'),_0x7fa3('0x43'),_0x7fa3('0x212')+_0x4ba1b2));}if(_0x1ce273<=0x0||isNaN(_0x1ce273)){return _0x831c8f(msgResponse(_0x7fa3('0x219'),_0x7fa3('0x43'),_0x7fa3('0x213')+_0x1ce273));}if(_0x37bfe1<=0x0||isNaN(_0x37bfe1)){return _0x831c8f(msgResponse(_0x7fa3('0x219'),'Error',_0x7fa3('0x214')+_0x37bfe1));}if(_0x169dfc<=0x0||isNaN(_0x169dfc)){return _0x831c8f(msgResponse(_0x7fa3('0x219'),_0x7fa3('0x43'),'interval\x20=\x20'+_0x169dfc));}if(_0x1e4627<=0x0||isNaN(_0x1e4627)){return _0x831c8f(msgResponse('[busyFactor]',_0x7fa3('0x43'),'Umin\x20=\x20'+_0x1e4627));}_0x4ec0ee=_0x4ec0ee||0x0;var _0x2bf2d8=0x1/_0x1ce273;var _0x5d1160=0x0;var _0x911395=0x0;var _0x16aaf7=0x0;var _0x10a3b9=0x0;for(var _0x3c1a55=0x0;_0x10a3b9<_0x1e4627;_0x3c1a55+=0x1){_0x911395=_0x3c1a55/_0x169dfc;_0x5d1160=(_0x37bfe1*_0x911395+_0x4ec0ee)/_0x2bf2d8;_0x16aaf7=erlangb(_0x5d1160,_0x4ba1b2);_0x10a3b9=_0x5d1160/_0x4ba1b2*(0x1-erlangb(_0x5d1160,_0x4ba1b2));}return _0x3b44af({'erlangCalls':_0x3c1a55,'erlangCallToSecond':_0x169dfc/_0x3c1a55,'erlangAbandonmentRate':_0x16aaf7,'erlangBusyFactor':_0x10a3b9});});};module[_0x7fa3('0x21a')]=Dialer; \ No newline at end of file +var _0xcb39=['dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','starttime','clearZombieChannels','[uniqueid]','undefined','sequence','isNil','channel','catch','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','[emptyContact][createHistory]','isSuccess','Success','SIP/%s','reachable','status','unmonitored','moveContactManagedDialer','uniqueid','variable','amdstatus','xcally-motion-dialer','value','HANGUP','HangupInAMD','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','state','Machine','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countnosuchnumberretry','dialGlobalMaxRetry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr]','AGI','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','responsetime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','Abandoned','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','roundrobin','locked','paused','stateinterface','actionid','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','timezones','content','indexOf','true','Action','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','predictive','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','Contact','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','phone','substring','dialCutDigit','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','available','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','agentBusyFactor','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','Contact.phone','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x47a6a7,_0x4f4c8f){var _0x37112d=function(_0x3e255b){while(--_0x3e255b){_0x47a6a7['push'](_0x47a6a7['shift']());}};_0x37112d(++_0x4f4c8f);}(_0xcb39,0x1bf));var _0x9cb3=function(_0x5795f5,_0xa4aa64){_0x5795f5=_0x5795f5-0x0;var _0x3c6736=_0xcb39[_0x5795f5];return _0x3c6736;};'use strict';var util=require(_0x9cb3('0x0'));var _=require(_0x9cb3('0x1'));var BPromise=require('bluebird');var uuid=require(_0x9cb3('0x2'));var moment=require(_0x9cb3('0x3'));var rr=require('rr');var md5=require(_0x9cb3('0x4'));var Redis=require(_0x9cb3('0x5'));var ut=require(_0x9cb3('0x6'));var config=require(_0x9cb3('0x7'));var logger=require(_0x9cb3('0x8'))(_0x9cb3('0x9'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x9cb3('0x8'))('predictive');var loggerPredictiveCalls=require(_0x9cb3('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x9cb3('0x8'))(_0x9cb3('0xa'));var ami=require(_0x9cb3('0xb'));config[_0x9cb3('0xc')]=_['defaults'](config[_0x9cb3('0xc')],{'host':_0x9cb3('0xd'),'port':0x18eb});var io=require(_0x9cb3('0xe'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x9cb3('0xf'));var cmHopperBlack=require(_0x9cb3('0x10'));var voiceQueueRt=require(_0x9cb3('0x11'));var Action=require(_0x9cb3('0x12'));var History=require(_0x9cb3('0x13'));var Final=require('./final');var AgentComplete=require(_0x9cb3('0x14'));var QueueCallerAbandon=require(_0x9cb3('0x15'));var Hangup=require(_0x9cb3('0x16'));var ipAgi=process[_0x9cb3('0x17')]['XCALLY_IP_AGI']||_0x9cb3('0x18');var strategy={'rrmemory':_0x9cb3('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x9cb3('0x1a')][_0x9cb3('0x1b')]=function(_0x10e9e6){this[_0x9cb3('0x1c')]=this[_0x9cb3('0x1c')]?this[_0x9cb3('0x1c')][_0x9cb3('0x1d')](_0x10e9e6):_0x10e9e6();};function Dialer(_0x19957f,_0x429cf3){this['sequence']=new Sequence();this[_0x9cb3('0x1e')]=_0x429cf3;this['voiceQueues']=_0x19957f[_0x9cb3('0x1f')];this[_0x9cb3('0x20')]=_0x19957f[_0x9cb3('0x20')];this[_0x9cb3('0x21')]=_0x19957f['agents'];this[_0x9cb3('0x22')]=_0x19957f[_0x9cb3('0x22')];this[_0x9cb3('0x23')]=config['maxNumberOriginate']||0x2;this[_0x9cb3('0x24')]={};this[_0x9cb3('0x25')]={};this['contactsId']={};this[_0x9cb3('0x26')]={};this[_0x9cb3('0x27')]={};this['startPredictive']={};this['startProgressive']={};this[_0x9cb3('0x28')]={};this[_0x9cb3('0x29')]={};this['queueBookedRR']={};ami['on'](_0x9cb3('0x2a'),this[_0x9cb3('0x2b')]['bind'](this));ami['on']('queuecallerabandon',this[_0x9cb3('0x2c')][_0x9cb3('0x2d')](this));ami['on'](_0x9cb3('0x2e'),this[_0x9cb3('0x2f')]['bind'](this));ami['on'](_0x9cb3('0x30'),this[_0x9cb3('0x31')][_0x9cb3('0x2d')](this));ami['on'](_0x9cb3('0x32'),this['syncQueueSummary'][_0x9cb3('0x2d')](this));ami['on'](_0x9cb3('0x33'),this[_0x9cb3('0x34')][_0x9cb3('0x2d')](this));ami['on']('newexten',this[_0x9cb3('0x35')]['bind'](this));ami['on'](_0x9cb3('0x36'),this[_0x9cb3('0x37')][_0x9cb3('0x2d')](this));ami['on'](_0x9cb3('0x38'),this[_0x9cb3('0x39')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x9cb3('0x3a')]['bind'](this));this['loopCampaigns']();this[_0x9cb3('0x3b')]();}function isNotNull(_0x4fc00e){return _0x4fc00e!==null&&!_[_0x9cb3('0x3c')](_0x4fc00e);}function checkIsLoggedIn(_0xe9883e,_0xb08f49){return function(){if(_0xb08f49<=0x0){_0xe9883e[_0x9cb3('0x3d')]=_0x9cb3('0x3e');throw _0xe9883e[_0x9cb3('0x3f')]+_0x9cb3('0x40');}};}function isActive(_0x6c6486){return _0x6c6486;}function checkIsActive(_0x38efdb,_0x5ec0c7){return function(){if(!isActive(_0x5ec0c7)){_0x38efdb[_0x9cb3('0x3d')]=_0x9cb3('0x41');throw _0x38efdb[_0x9cb3('0x3f')]+_0x9cb3('0x42');}};}function checkInterval(_0x399b72){return function(){if(!isNotNull(_0x399b72[_0x9cb3('0x43')])){_0x399b72[_0x9cb3('0x3d')]=_0x9cb3('0x44');throw _0x399b72[_0x9cb3('0x3f')]+_0x9cb3('0x45');}if(!isNotNull(_0x399b72[_0x9cb3('0x43')][_0x9cb3('0x46')])){_0x399b72[_0x9cb3('0x3d')]=_0x9cb3('0x44');throw _0x399b72['name']+_0x9cb3('0x45');}if(!isNotNull(_[_0x9cb3('0x47')](_0x399b72['Interval'][_0x9cb3('0x46')]))){_0x399b72[_0x9cb3('0x3d')]='INTERVAL_IS_NULL';throw _0x399b72['name']+_0x9cb3('0x45');}};}function msgResponse(_0x3fa36c,_0x16a042,_0x23d950){return{'action':_0x3fa36c,'response':_0x16a042,'message':_0x23d950,'stack':_0x23d950};}function myreject(_0x454a3b){return function(_0x5059a3){return _0x454a3b(msgResponse(_0x9cb3('0x48'),'Error',JSON[_0x9cb3('0x49')](_0x5059a3)));};}function getSeconds(_0x4ba521,_0x4a2083){var _0x29da19=moment(_0x4ba521)[_0x9cb3('0x4a')](0x0);var _0x3d61f3=moment(_0x4a2083)[_0x9cb3('0x4a')](0x0);return _0x29da19[_0x9cb3('0x4b')](_0x3d61f3,_0x9cb3('0x4c'));}function emit(_0x54bdc4,_0x537c2c,_0x96ec05){io['to'](_0x54bdc4)['emit'](_0x537c2c,_0x96ec05);}function emitVoiceQueueSummary(_0x1f872b){if(_0x1f872b[_0x9cb3('0x4d')]===_0x9cb3('0x4e')){var _0x748fa8={'id':_0x1f872b['id'],'name':_0x1f872b[_0x9cb3('0x3f')],'strategy':_0x1f872b[_0x9cb3('0x4f')],'answered':_0x1f872b[_0x9cb3('0x50')],'available':_0x1f872b['available'],'loggedIn':_0x1f872b['loggedIn'],'pTalking':_0x1f872b[_0x9cb3('0x51')],'sumBillable':_0x1f872b[_0x9cb3('0x52')],'sumDuration':_0x1f872b['sumDuration'],'sumHoldTime':_0x1f872b[_0x9cb3('0x53')]||0x0,'talking':_0x1f872b[_0x9cb3('0x54')],'total':_0x1f872b['total'],'type':_0x1f872b[_0x9cb3('0x4d')],'unmanaged':_0x1f872b['unmanaged'],'abandoned':_0x1f872b[_0x9cb3('0x55')],'waiting':_0x1f872b['waiting'],'loggedInDb':_0x1f872b[_0x9cb3('0x56')],'dialActive':_0x1f872b[_0x9cb3('0x57')],'dialMethod':_0x1f872b[_0x9cb3('0x58')],'dialOriginateCallerIdName':_0x1f872b[_0x9cb3('0x59')],'dialOriginateCallerIdNumber':_0x1f872b['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1f872b['dialOriginateTimeout'],'dialPrefix':_0x1f872b[_0x9cb3('0x5a')],'outboundAnswerAgiCallsDay':_0x1f872b[_0x9cb3('0x5b')],'outboundAnswerCallsDay':_0x1f872b[_0x9cb3('0x5c')],'outboundBlacklistCallsDay':_0x1f872b[_0x9cb3('0x5d')],'outboundBusyCallsDay':_0x1f872b[_0x9cb3('0x5e')],'outboundCongestionCallsDay':_0x1f872b[_0x9cb3('0x5f')],'outboundDropCallsDayACS':_0x1f872b[_0x9cb3('0x60')],'outboundDropCallsDayCallersExit':_0x1f872b[_0x9cb3('0x61')],'outboundDropCallsDayTimeout':_0x1f872b['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1f872b[_0x9cb3('0x62')],'outboundNoSuchCallsDay':_0x1f872b[_0x9cb3('0x63')],'outboundOriginateFailureCallsDay':_0x1f872b[_0x9cb3('0x64')],'outboundReCallsDay':_0x1f872b[_0x9cb3('0x65')],'outboundRejectCallsDay':_0x1f872b['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1f872b[_0x9cb3('0x66')],'predictiveIntervalAnsweredCalls':_0x1f872b[_0x9cb3('0x67')],'predictiveIntervalAvgHoldtime':_0x1f872b['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1f872b[_0x9cb3('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x1f872b[_0x9cb3('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x1f872b[_0x9cb3('0x6a')],'predictiveIntervalErlangCalls':_0x1f872b[_0x9cb3('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x1f872b[_0x9cb3('0x6c')],'predictiveIntervalHitRate':_0x1f872b[_0x9cb3('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x1f872b[_0x9cb3('0x6e')],'predictiveIntervalPauses':_0x1f872b['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1f872b[_0x9cb3('0x6f')],'predictiveIntervalTotalCalls':_0x1f872b[_0x9cb3('0x70')],'message':_0x1f872b['message'],'originated':_0x1f872b[_0x9cb3('0x71')],'erlangCalls':_0x1f872b[_0x9cb3('0x72')],'erlangCallToSecond':_0x1f872b[_0x9cb3('0x73')],'erlangAbandonmentRate':_0x1f872b[_0x9cb3('0x74')],'erlangBusyFactor':_0x1f872b[_0x9cb3('0x75')],'startPredictive':_0x1f872b[_0x9cb3('0x76')],'startProgressive':_0x1f872b['startProgressive']};if(_0x1f872b['Trunk']){_0x748fa8[_0x9cb3('0x77')]={'id':_0x1f872b[_0x9cb3('0x77')]['id'],'name':_0x1f872b[_0x9cb3('0x77')][_0x9cb3('0x3f')],'active':_0x1f872b[_0x9cb3('0x77')][_0x9cb3('0x78')],'callerid':_0x1f872b['Trunk'][_0x9cb3('0x79')]};}if(_0x1f872b['Interval']){_0x748fa8[_0x9cb3('0x43')]={'id':_0x1f872b['Interval']['id'],'name':_0x1f872b[_0x9cb3('0x43')][_0x9cb3('0x3f')]};}var _0x415cf8=md5(JSON[_0x9cb3('0x49')](_0x748fa8));if(_0x1f872b['md5']!==_0x415cf8){_0x1f872b['md5']=_0x415cf8;emit(util[_0x9cb3('0x7a')]('voice:queue:%s',_0x748fa8['name']),'voice_queue:save',_0x748fa8);}}}function emitCampaignSummary(_0x121d30){if(_0x121d30[_0x9cb3('0x4d')]===_0x9cb3('0x7b')){emit(util['format'](_0x9cb3('0x7c'),_0x121d30[_0x9cb3('0x3f')]),_0x9cb3('0x7d'),_0x121d30);}}function checkGetDataPredictive(_0x475706){if(isNotNull(_0x475706)&&!_[_0x9cb3('0x47')](_0x475706)){loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x7f'));loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x80'),_0x475706[_0x9cb3('0x70')]);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x81'),_0x475706[_0x9cb3('0x67')]);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x82'),_0x475706[_0x9cb3('0x6a')]);loggerPredictive[_0x9cb3('0x7e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x475706['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x9cb3('0x83'),_0x475706[_0x9cb3('0x84')]);loggerPredictive[_0x9cb3('0x7e')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x475706[_0x9cb3('0x68')]);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x85'));if(_0x475706[_0x9cb3('0x70')]>0x0){if(!_['isUndefined'](_0x475706[_0x9cb3('0x68')])&&_0x475706[_0x9cb3('0x68')]>0x0){return!![];}loggerPredictive[_0x9cb3('0x7e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x9cb3('0x3c')](_0x475706[_0x9cb3('0x84')])&&_0x475706[_0x9cb3('0x84')]>0x0){return!![];}loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x86'));}else{loggerPredictive[_0x9cb3('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x87'));}return![];}function mergeDataErlangB(_0x3f0133){return function(_0x4d51a1){loggerPredictive['info'](_0x9cb3('0x88'));loggerPredictive[_0x9cb3('0x7e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d51a1[_0x9cb3('0x72')]);loggerPredictive[_0x9cb3('0x7e')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d51a1[_0x9cb3('0x73')]);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x89'),_0x4d51a1[_0x9cb3('0x74')]);loggerPredictive[_0x9cb3('0x7e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d51a1[_0x9cb3('0x75')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d51a1['erlangAbandonmentRate']);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x85'));_[_0x9cb3('0x8a')](_0x3f0133,_0x4d51a1);};}function getDiff(_0x5aed61){var _0xff490c=moment()[_0x9cb3('0x4a')](0x0);var _0x35a9b7=moment(_0x5aed61)['milliseconds'](0x0);return _0xff490c['diff'](_0x35a9b7,_0x9cb3('0x4c'));}function ifInterval(_0x449b4e,_0x3bc94b){if(_[_0x9cb3('0x3c')](_0x3bc94b)){return![];}return getDiff(_0x3bc94b)<_0x449b4e*0x3c;}function freeVariablesPredictive(_0x15f738){if(isNotNull(_0x15f738)){if(!_[_0x9cb3('0x3c')](_0x15f738[_0x9cb3('0x8b')])){_0x15f738['startProgressive']=undefined;loggerPredictive[_0x9cb3('0x7e')](_0x15f738[_0x9cb3('0x3f')],_0x9cb3('0x8c'));}if(!_[_0x9cb3('0x3c')](_0x15f738[_0x9cb3('0x76')])){_0x15f738[_0x9cb3('0x76')]=undefined;loggerPredictive[_0x9cb3('0x7e')](_0x15f738['name'],_0x9cb3('0x8d'));}if(!_[_0x9cb3('0x3c')](_0x15f738[_0x9cb3('0x8e')])){clearInterval(_0x15f738['handlePredictive']);_0x15f738[_0x9cb3('0x8e')]=undefined;loggerPredictive[_0x9cb3('0x7e')](_0x15f738[_0x9cb3('0x3f')],_0x9cb3('0x8f'));}}}function erlangb(_0x161285,_0x4d3f6d){if(_0x4d3f6d===0x0){return 0x0;}var _0x26451f=0x1;for(var _0x341fbc=0x1;_0x341fbc<=_0x4d3f6d;_0x341fbc+=0x1){_0x26451f=0x1+_0x26451f*_0x341fbc/_0x161285;}return 0x1/_0x26451f;}function isVoiceQueueOutbound(_0x146919){return _0x146919===_0x9cb3('0x4e');}function isNotPreview(_0x508274){return _0x508274!==_0x9cb3('0x1e');}function isCampaignIvr(_0x72a8f9){return _0x72a8f9==='ivr';}function getCallerId(_0x1cc96e,_0x59e512,_0x251c76){if(!_['isUndefined'](_0x251c76)&&typeof _0x251c76==='string'&&!_[_0x9cb3('0x47')](_0x251c76)){if(!_['isUndefined'](_0x59e512)&&typeof _0x59e512===_0x9cb3('0x90')&&!_['isEmpty'](_0x59e512)){return util[_0x9cb3('0x7a')](_0x9cb3('0x91'),_0x59e512,_0x251c76);}return util[_0x9cb3('0x7a')](_0x9cb3('0x91'),_0x251c76,_0x251c76);}if(!_[_0x9cb3('0x3c')](_0x1cc96e)&&typeof _0x1cc96e==='string'&&!_[_0x9cb3('0x47')](_0x1cc96e)){return _0x1cc96e;}return _0x9cb3('0x92');}function loggerCatchQueueSummary(_0x1a597f,_0x16c307){return function(_0x82181){freeVariablesPredictive(_0x16c307);emitVoiceQueueSummary(_0x16c307);emitCampaignSummary(_0x16c307);loggerSyncQueueSummary[_0x9cb3('0x93')](_0x1a597f,util[_0x9cb3('0x94')](_0x82181,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2d408c,_0x41d1df){return function(_0xfb18fe){loggerPredictive[_0x9cb3('0x93')](_0x41d1df[_0x9cb3('0x3f')],_0x2d408c);loggerPredictive[_0x9cb3('0x93')](_0xfb18fe['stack']);freeVariablesPredictive(_0x41d1df);};}function loggerCatch(_0x26dfaf){return function(_0x1613a2){logger[_0x9cb3('0x93')](_0x26dfaf,util[_0x9cb3('0x94')](_0x1613a2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2d5a3c){return _0x2d5a3c&&!_[_0x9cb3('0x3c')](_0x2d5a3c)&&_0x2d5a3c[_0x9cb3('0x95')]>0x0;}function decremetOriginate(_0x1352d0){if(!_['isUndefined'](_0x1352d0)&&_0x1352d0!==null){if(typeof _0x1352d0['originated']!=='undefined'){if(_0x1352d0[_0x9cb3('0x71')]>0x0){_0x1352d0[_0x9cb3('0x71')]-=0x1;}else{logger['error'](_0x9cb3('0x96'));}}}else{logger['error'](_0x9cb3('0x97'));}}function checkContactLowerLimitOriginate(_0x33fe9b,_0x21d8e5,_0x7fea9b){if(_0x21d8e5>_0x7fea9b){for(var _0x3f5546=0x0;_0x3f5546<_0x21d8e5-_0x7fea9b;_0x3f5546+=0x1){decremetOriginate(_0x33fe9b);}}}function loggerGetContactDialer(_0x530e1b,_0x36a5a2,_0x7e9a5e){return function(_0x3050cb){checkContactLowerLimitOriginate(_0x36a5a2,_0x7e9a5e,0x0);logger[_0x9cb3('0x93')](_0x530e1b,util[_0x9cb3('0x94')](_0x3050cb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x47f436){return function(_0x1df3b0){if(isNotNull(_0x1df3b0)&&isNotNull(_0x1df3b0[0x0])){if(_0x1df3b0[0x0][_0x9cb3('0x98')]>0x0){_0x47f436['message']=_0x9cb3('0x99');logger[_0x9cb3('0x7e')]('[getContactDialer2][ReScheduled]'+_0x47f436[_0x9cb3('0x3f')],_0x1df3b0[0x0][_0x9cb3('0x98')],'contacts');}else{_0x47f436[_0x9cb3('0x3d')]=_0x9cb3('0x9a');logger[_0x9cb3('0x7e')]('[getContactDialer2][Empty]'+_0x47f436['name']);}}};}function notSendMessagesQueue(_0x5c575a){if(_0x5c575a[_0x9cb3('0x9b')]){freeVariablesPredictive(_0x5c575a);if(_0x5c575a[_0x9cb3('0x71')]===0x0&&_0x5c575a[_0x9cb3('0x54')]===0x0&&_0x5c575a[_0x9cb3('0x9c')]===0x0&&(_0x5c575a['pTalking']||0x0)===0x0){_0x5c575a[_0x9cb3('0x9b')]=![];_0x5c575a['available']=0x0;_0x5c575a[_0x9cb3('0x3d')]=_0x9cb3('0x41');loggerSyncQueueSummary[_0x9cb3('0x93')](_0x9cb3('0x9d'),_0x5c575a[_0x9cb3('0x3f')],_0x9cb3('0x9e'));}else{_0x5c575a[_0x9cb3('0x3d')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x9cb3('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5c575a[_0x9cb3('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x5c575a);}}function notSendMessagesCampaign(_0x3ca71c){if(_0x3ca71c[_0x9cb3('0x9b')]){if(_0x3ca71c['originated']===0x0){_0x3ca71c['sendMessageOneNotActive']=![];_0x3ca71c[_0x9cb3('0x3d')]=_0x9cb3('0x41');loggerSyncQueueSummary[_0x9cb3('0x93')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3ca71c[_0x9cb3('0x3f')],'is\x20not\x20active');}else{_0x3ca71c[_0x9cb3('0x3d')]=_0x9cb3('0x9f');loggerSyncQueueSummary[_0x9cb3('0x93')](_0x9cb3('0xa0'),_0x3ca71c[_0x9cb3('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x3ca71c);}}function createObjHistory(_0x263ae9,_0x323344,_0x5716c3,_0xa7b8e,_0x1b911e){_0x263ae9[_0x9cb3('0x3d')]=_0x5716c3;var _0x1c5b01=new Action(_0x263ae9,_0x323344);var _0x4aa34b=new History(_0x1c5b01);_0x4aa34b['state']=_0xa7b8e;_0x4aa34b[_0x9cb3('0xa1')]=_0x1b911e;_0x4aa34b['endtime']=_0x1c5b01[_0x9cb3('0xa2')];return _0x4aa34b;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x1b3778=this;setInterval(function(){_0x1b3778[_0x9cb3('0xa3')](_0x1b3778['uniqueId'],_0x9cb3('0xa4'));_0x1b3778[_0x9cb3('0xa3')](_0x1b3778[_0x9cb3('0x25')],'[actions]');},0x32c8);};Dialer['prototype'][_0x9cb3('0xa3')]=function(_0x9d6f84,_0x5a5648){var _0x2b0c71=this;for(var _0x47cbd7 in _0x9d6f84){if(typeof _0x9d6f84[_0x47cbd7]!==_0x9cb3('0xa5')){this[_0x9cb3('0xa6')][_0x9cb3('0x1b')](function(){if(!_[_0x9cb3('0xa7')](_0x9d6f84[_0x47cbd7])){return ami['Action']({'action':'status','channel':_0x9d6f84[_0x47cbd7][_0x9cb3('0xa8')]})[_0x9cb3('0xa9')](function(_0x2f9695){if(_0x2f9695[_0x9cb3('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x9d6f84[_0x47cbd7]&&_0x9d6f84[_0x47cbd7]['type']!==_0x9cb3('0x7b')){_0x2b0c71[_0x9cb3('0xaa')](_0x2b0c71[_0x9cb3('0x1f')][_0x9d6f84[_0x47cbd7]['queue']]);logger[_0x9cb3('0x93')](_0x9cb3('0xab'),_0x5a5648,_0x47cbd7,_0x9d6f84[_0x47cbd7][_0x9cb3('0xac')]);delete _0x9d6f84[_0x47cbd7];}if(_0x9d6f84[_0x47cbd7]&&_0x9d6f84[_0x47cbd7][_0x9cb3('0x4d')]===_0x9cb3('0x7b')){_0x2b0c71[_0x9cb3('0xaa')](_0x2b0c71['campaigns'][_0x9d6f84[_0x47cbd7][_0x9cb3('0xac')]]);logger[_0x9cb3('0x93')]('[Dialer][checkChannel][ivr]',_0x5a5648,_0x47cbd7,_0x9d6f84[_0x47cbd7]['queue']);delete _0x9d6f84[_0x47cbd7];}},0x2328);}});}});}}};Dialer['prototype'][_0x9cb3('0xad')]=function(_0x232ef8){return BPromise['resolve']()[_0x9cb3('0xae')](cmHopper['countReScheduled'](_0x232ef8))[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xaf')));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xb0')]=function(_0x52c62a){return BPromise[_0x9cb3('0xb1')]()['then'](cmHopperBlack[_0x9cb3('0xb0')](_0x52c62a))[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xb2')));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xb3')]=function(_0xa40402){return BPromise[_0x9cb3('0xb1')]()[_0x9cb3('0xae')](cmHopperBlack[_0x9cb3('0xb3')](_0xa40402))[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xb4')));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xb5')]=function(_0x4b6013){return BPromise[_0x9cb3('0xb1')]()['then'](cmHopperHistory[_0x9cb3('0xb6')](_0x4b6013))[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xb7')));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xb8')]=function(_0x42dbd6){return BPromise[_0x9cb3('0xb1')]()[_0x9cb3('0xae')](cmHopper[_0x9cb3('0xb8')](_0x42dbd6))[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xb9')));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xba')]=function(_0x22ee7a,_0x1c8c07,_0x9538f2){return BPromise[_0x9cb3('0xb1')]()['then'](cmHopper[_0x9cb3('0xba')](_0x22ee7a,_0x1c8c07,_0x9538f2))[_0x9cb3('0xa9')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xbb')]=function(_0x33355d,_0x355e9f,_0x23ed47,_0x8d2273,_0x3a3476){return BPromise[_0x9cb3('0xb1')]()[_0x9cb3('0xae')](cmHopper[_0x9cb3('0xbb')](_0x33355d,_0x355e9f,_0x23ed47,_0x8d2273))[_0x9cb3('0xa9')](function(_0x2b69a3){_0x3a3476[_0x9cb3('0xbc')]-=_0x23ed47;_0x3a3476[_0x9cb3('0xbc')]=_0x3a3476['temp']>0x0?_0x3a3476[_0x9cb3('0xbc')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x2b69a3);});};Dialer['prototype'][_0x9cb3('0xbd')]=function(_0x8da438,_0x2390c2,_0x4c115d,_0xf81e50){return BPromise[_0x9cb3('0xb1')]()[_0x9cb3('0xae')](cmHopper[_0x9cb3('0xbd')](_0x8da438,_0x2390c2,_0x4c115d))[_0x9cb3('0xa9')](function(_0x20dc52){_0xf81e50[_0x9cb3('0xbc')]-=_0x2390c2;_0xf81e50[_0x9cb3('0xbc')]=_0xf81e50[_0x9cb3('0xbc')]>0x0?_0xf81e50[_0x9cb3('0xbc')]:0x0;loggerCatch(_0x9cb3('0xbe'))(_0x20dc52);});};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xbf')]=function(_0x478fc9){return BPromise[_0x9cb3('0xb1')]()[_0x9cb3('0xae')](voiceQueueRt[_0x9cb3('0xbf')](_0x478fc9))['catch'](loggerCatch(_0x9cb3('0xc0')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x62db9c){return BPromise['resolve']()[_0x9cb3('0xae')](cmHopper['moveContactManagedDialer'](_0x62db9c))[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xc1')));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xc2')]=function(_0x1a5945){return BPromise[_0x9cb3('0xb1')]()['then'](cmHopperHistory['createHistory'](_0x1a5945))[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xc3')));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xaa')]=function(_0x147798){if(!_[_0x9cb3('0x3c')](_0x147798)&&_0x147798!==null){if(typeof _0x147798['originated']!==_0x9cb3('0xa5')){if(_0x147798['originated']>0x0){_0x147798[_0x9cb3('0x71')]-=0x1;}else{logger[_0x9cb3('0x93')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x9cb3('0x93')](_0x9cb3('0xc4'));}};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xc5')]=function(_0x110d69,_0x36a44f){var _0x498e57=this;return function(_0x318230){_0x498e57['updateOriginated'](_0x36a44f);logger[_0x9cb3('0x93')](_0x110d69,util[_0x9cb3('0x94')](_0x318230,{'showHidden':![],'depth':null}));};};Dialer[_0x9cb3('0x1a')]['emptyContact']=function(_0x2c794b,_0x139cbc,_0x4a30d3){var _0x25944b={'state':0x19,'statedesc':_0x9cb3('0xc6')};this[_0x9cb3('0xaa')](_0x139cbc);this[_0x9cb3('0xc7')](_[_0x9cb3('0x8a')](_0x25944b,_[_0x9cb3('0xc8')](_0x4a30d3,[_0x9cb3('0xc9'),_0x9cb3('0xca'),'UserId',_0x9cb3('0xcb'),'CampaignId'])),_0x9cb3('0xcc'),'[emptyContact]');logger[_0x9cb3('0x93')](_0x2c794b);};Dialer['prototype'][_0x9cb3('0xcd')]=function(_0x3e25c1){return _0x3e25c1===_0x9cb3('0xce');};Dialer[_0x9cb3('0x1a')]['isTrunkReachable']=function(_0x768244){return!_['isUndefined'](_0x768244)&&_0x768244&&!_[_0x9cb3('0x3c')](_0x768244[_0x9cb3('0x3f')])&&!_['isUndefined'](_0x768244[_0x9cb3('0x78')])&&_0x768244['active']&&(this[_0x9cb3('0x22')][util[_0x9cb3('0x7a')](_0x9cb3('0xcf'),_0x768244[_0x9cb3('0x3f')])]['status']===_0x9cb3('0xd0')||this[_0x9cb3('0x22')][util['format'](_0x9cb3('0xcf'),_0x768244[_0x9cb3('0x3f')])][_0x9cb3('0xd1')]===_0x9cb3('0xd2'));};Dialer['prototype'][_0x9cb3('0xc7')]=function(_0x517479,_0x22f0d7,_0x1a7517){this[_0x9cb3('0xc2')](_0x517479)[_0x9cb3('0xa9')](loggerCatch(_0x22f0d7));this[_0x9cb3('0xd3')](_0x517479)['catch'](loggerCatch(_0x1a7517));};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x37')]=function(_0x3399d3){var _0x31c5ad=this[_0x9cb3('0x26')][_0x3399d3[_0x9cb3('0xd4')]];var _0x379b56;if(!_[_0x9cb3('0xa7')](_0x3399d3)&&!_[_0x9cb3('0xa7')](_0x3399d3[_0x9cb3('0xd5')])&&!_[_0x9cb3('0xa7')](_0x3399d3[_0x9cb3('0xd5')][_0x9cb3('0xd6')])&&_0x3399d3['exten']===_0x9cb3('0xd7')&&_0x31c5ad){if(_0x31c5ad[_0x9cb3('0x4d')]!==_0x9cb3('0x7b')&&this['voiceQueues'][_0x31c5ad[_0x9cb3('0xac')]]['dialAMDActive']&&_0x3399d3[_0x9cb3('0xd8')]===_0x9cb3('0xd9')){delete this['uniqueId'][_0x3399d3[_0x9cb3('0xd4')]];this[_0x9cb3('0xaa')](this[_0x9cb3('0x1f')][_0x31c5ad[_0x9cb3('0xac')]]);this[_0x9cb3('0x1f')][_0x31c5ad[_0x9cb3('0xac')]][_0x9cb3('0x5c')]+=0x1;this[_0x9cb3('0x1f')][_0x31c5ad['queue']][_0x9cb3('0x5b')]+=0x1;_0x379b56=new Hangup(_0x31c5ad,_0x3399d3);_0x379b56['state']=0x12;_0x379b56[_0x9cb3('0xa1')]=_0x9cb3('0xda');_0x379b56['membername']=_0x9cb3('0xdb');ami[_0x9cb3('0xdc')](_0x9cb3('0xdd'),ut[_0x9cb3('0xde')](_0x379b56,_0x9cb3('0xdf')));this[_0x9cb3('0xc7')](_0x379b56,_0x9cb3('0xe0'),_0x9cb3('0xe1'));}if(_0x31c5ad['type']!==_0x9cb3('0x7b')&&this[_0x9cb3('0x1f')][_0x31c5ad[_0x9cb3('0xac')]][_0x9cb3('0xe2')]&&_0x3399d3[_0x9cb3('0xd8')]===_0x9cb3('0xe3')){var _0x98234b=this;return new BPromise(function(_0x4bbd4f,_0x2555d9){delete _0x98234b['uniqueId'][_0x3399d3[_0x9cb3('0xd4')]];_0x98234b[_0x9cb3('0xaa')](_0x98234b[_0x9cb3('0x1f')][_0x31c5ad[_0x9cb3('0xac')]]);_0x98234b[_0x9cb3('0x1f')][_0x31c5ad[_0x9cb3('0xac')]]['outboundAnswerCallsDay']+=0x1;_0x98234b['voiceQueues'][_0x31c5ad[_0x9cb3('0xac')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2780e6=_0x98234b[_0x9cb3('0x1f')][_0x31c5ad[_0x9cb3('0xac')]];var _0x1ecf9f=new Hangup(_0x31c5ad,_0x3399d3);_0x1ecf9f[_0x9cb3('0xe4')]=0x13;_0x1ecf9f['statedesc']=_0x9cb3('0xe5');_0x1ecf9f[_0x9cb3('0xe6')]='AMD';_0x1ecf9f[_0x9cb3('0xe7')]+=0x1;_0x1ecf9f[_0x9cb3('0xe8')]+=0x1;_0x1ecf9f[_0x9cb3('0xdf')]=!![];ami[_0x9cb3('0xdc')](_0x9cb3('0xdd'),ut[_0x9cb3('0xde')](_0x1ecf9f,_0x9cb3('0xdf')));_0x98234b[_0x9cb3('0xc2')](_0x1ecf9f)['catch'](loggerCatch(_0x9cb3('0xe9')));if(_0x1ecf9f[_0x9cb3('0xea')]+_0x1ecf9f[_0x9cb3('0xeb')]+_0x1ecf9f[_0x9cb3('0xec')]+_0x1ecf9f['countnosuchnumberretry']+_0x1ecf9f[_0x9cb3('0xed')]+_0x1ecf9f[_0x9cb3('0xee')]+_0x1ecf9f[_0x9cb3('0xe7')]+_0x1ecf9f[_0x9cb3('0xef')]>=_0x2780e6['dialGlobalMaxRetry']){_0x98234b[_0x9cb3('0xf0')](_0x1ecf9f,_0x4bbd4f,_0x2555d9,_0x9cb3('0xf1'));}else{if(_0x1ecf9f['countmachineretry']>=_0x2780e6[_0x9cb3('0xf2')]){_0x98234b['createStateFinal'](_0x1ecf9f,_0x4bbd4f,_0x2555d9,_0x9cb3('0xf3'));}else{_0x98234b[_0x9cb3('0xb8')]({'active':![],'countmachineretry':_0x1ecf9f['countmachineretry'],'scheduledat':moment()[_0x9cb3('0xf4')](_0x2780e6[_0x9cb3('0xf5')],_0x9cb3('0xf6'))[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1ecf9f['ContactId'],'ListId':_0x1ecf9f['ListId'],'VoiceQueueId':_0x1ecf9f[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x1ecf9f[_0x9cb3('0xf8')]||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xf9')));_0x4bbd4f({'reschedule':0x1});}}});}if(_0x31c5ad[_0x9cb3('0x4d')]===_0x9cb3('0x7b')&&this['campaigns'][_0x31c5ad['queue']]['dialAMDActive']&&_0x3399d3[_0x9cb3('0xd8')]===_0x9cb3('0xd9')){delete this[_0x9cb3('0x26')][_0x3399d3['uniqueid']];this['updateOriginated'](this[_0x9cb3('0x20')][_0x31c5ad[_0x9cb3('0xac')]]);_0x379b56=new Hangup(_0x31c5ad,_0x3399d3);_0x379b56[_0x9cb3('0xe4')]=0x12;_0x379b56[_0x9cb3('0xa1')]='HangupInAMD';_0x379b56[_0x9cb3('0xe6')]='AMD';ami[_0x9cb3('0xdc')](_0x9cb3('0xdd'),ut[_0x9cb3('0xde')](_0x379b56,_0x9cb3('0xdf')));this[_0x9cb3('0xc7')](_0x379b56,_0x9cb3('0xfa'),'[syncHangupInAMDIvr]');}if(_0x31c5ad['type']===_0x9cb3('0x7b')&&this[_0x9cb3('0x20')][_0x31c5ad['queue']][_0x9cb3('0xe2')]&&_0x3399d3[_0x9cb3('0xd8')]==='MACHINE'){var _0x98234b=this;return new BPromise(function(_0x4c3641,_0x4f56e6){delete _0x98234b[_0x9cb3('0x26')][_0x3399d3[_0x9cb3('0xd4')]];_0x98234b[_0x9cb3('0xaa')](_0x98234b[_0x9cb3('0x20')][_0x31c5ad[_0x9cb3('0xac')]]);_0x98234b[_0x9cb3('0x20')][_0x31c5ad[_0x9cb3('0xac')]][_0x9cb3('0x5c')]+=0x1;_0x98234b[_0x9cb3('0x20')][_0x31c5ad[_0x9cb3('0xac')]][_0x9cb3('0x5b')]+=0x1;var _0x46707f=_0x98234b['campaigns'][_0x31c5ad[_0x9cb3('0xac')]];var _0xad1633=new Hangup(_0x31c5ad,_0x3399d3);_0xad1633[_0x9cb3('0xe4')]=0x13;_0xad1633['statedesc']=_0x9cb3('0xe5');_0xad1633['membername']=_0x9cb3('0xdb');_0xad1633[_0x9cb3('0xe7')]+=0x1;_0xad1633[_0x9cb3('0xe8')]+=0x1;_0xad1633[_0x9cb3('0xdf')]=!![];ami[_0x9cb3('0xdc')](_0x9cb3('0xdd'),ut[_0x9cb3('0xde')](_0xad1633,_0x9cb3('0xdf')));_0x98234b['createHistory'](_0xad1633)['catch'](loggerCatch(_0x9cb3('0xe9')));if(_0xad1633[_0x9cb3('0xea')]+_0xad1633[_0x9cb3('0xeb')]+_0xad1633[_0x9cb3('0xec')]+_0xad1633[_0x9cb3('0xfb')]+_0xad1633[_0x9cb3('0xed')]+_0xad1633[_0x9cb3('0xee')]+_0xad1633[_0x9cb3('0xe7')]+_0xad1633[_0x9cb3('0xef')]>=_0x46707f[_0x9cb3('0xfc')]){_0x98234b[_0x9cb3('0xf0')](_0xad1633,_0x4c3641,_0x4f56e6,_0x9cb3('0xf1'));}else{if(_0xad1633[_0x9cb3('0xe7')]>=_0x46707f[_0x9cb3('0xf2')]){_0x98234b[_0x9cb3('0xfd')](_0xad1633,_0x4c3641,_0x4f56e6,_0x9cb3('0xf3'));}else{_0x98234b['rescheduleContact']({'active':![],'countmachineretry':_0xad1633[_0x9cb3('0xe7')],'scheduledat':moment()[_0x9cb3('0xf4')](_0x46707f[_0x9cb3('0xf5')],_0x9cb3('0xf6'))['format'](_0x9cb3('0xf7')),'ContactId':_0xad1633[_0x9cb3('0xc9')],'ListId':_0xad1633[_0x9cb3('0xca')],'VoiceQueueId':_0xad1633[_0x9cb3('0xcb')]||undefined,'CampaignId':_0xad1633[_0x9cb3('0xf8')]||undefined})[_0x9cb3('0xa9')](loggerCatch('[rescheduleContact][Machine]'));_0x4c3641({'reschedule':0x1});}}});}}};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x34')]=function(_0x9c562){var _0xc4f4fb=this[_0x9cb3('0x26')][_0x9c562[_0x9cb3('0xd4')]];var _0x5e3d94=this;var _0x331351;if(_0xc4f4fb&&_0xc4f4fb[_0x9cb3('0x4d')]===_0x9cb3('0x7b')){delete this[_0x9cb3('0x26')][_0x9c562[_0x9cb3('0xd4')]];this[_0x9cb3('0xaa')](this[_0x9cb3('0x20')][_0xc4f4fb[_0x9cb3('0xac')]]);this['campaigns'][_0xc4f4fb[_0x9cb3('0xac')]][_0x9cb3('0xfe')]+=0x1;_0x331351=new Hangup(_0xc4f4fb,_0x9c562);this[_0x9cb3('0xc2')](_0x331351)[_0x9cb3('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x331351)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xff')));}if(_0xc4f4fb&&_0xc4f4fb[_0x9cb3('0x4d')]!==_0x9cb3('0x7b')&&isNotNull(this['voiceQueues'][_0xc4f4fb['queue']]['dialQueueProject'])){delete this[_0x9cb3('0x26')][_0x9c562[_0x9cb3('0xd4')]];this['updateOriginated'](this[_0x9cb3('0x1f')][_0xc4f4fb[_0x9cb3('0xac')]]);this[_0x9cb3('0x1f')][_0xc4f4fb['queue']][_0x9cb3('0x5c')]+=0x1;this['voiceQueues'][_0xc4f4fb['queue']][_0x9cb3('0x5b')]+=0x1;_0x331351=new Hangup(_0xc4f4fb,_0x9c562);_0x331351['state']=0x10;_0x331351[_0x9cb3('0xa1')]='AnswerAGI';_0x331351['membername']=_0x9cb3('0x100');this[_0x9cb3('0xc2')](_0x331351)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x101')));this[_0x9cb3('0xd3')](_0x331351)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xff')));}if(_0xc4f4fb&&_0xc4f4fb[_0x9cb3('0x4d')]!==_0x9cb3('0x7b')&&!isNotNull(this['voiceQueues'][_0xc4f4fb[_0x9cb3('0xac')]][_0x9cb3('0x102')])){delete this[_0x9cb3('0x26')][_0x9c562[_0x9cb3('0xd4')]];this['updateOriginated'](this[_0x9cb3('0x1f')][_0xc4f4fb[_0x9cb3('0xac')]]);this['voiceQueues'][_0xc4f4fb[_0x9cb3('0xac')]]['outboundUnknownCallsDay']+=0x1;_0x331351=new Hangup(_0xc4f4fb,_0x9c562);_0x331351[_0x9cb3('0xe4')]=0xc;_0x331351[_0x9cb3('0xa1')]=_0x9c562[_0x9cb3('0x103')];_0x331351[_0x9cb3('0xe6')]=_0x9cb3('0x104');this[_0x9cb3('0xc2')](_0x331351)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x101')));this[_0x9cb3('0xd3')](_0x331351)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xff')));}};Dialer['prototype'][_0x9cb3('0x31')]=function(_0x5f5832){var _0x39278f=this['uniqueId'][_0x5f5832[_0x9cb3('0xd4')]];var _0xbf731b=this;if(this[_0x9cb3('0x1f')][_0x5f5832[_0x9cb3('0xac')]]){if(_0x39278f&&_0x39278f[_0x9cb3('0x4d')]!==_0x9cb3('0x7b')){delete this[_0x9cb3('0x26')][_0x5f5832[_0x9cb3('0xd4')]];this[_0x9cb3('0x1f')][_0x5f5832[_0x9cb3('0xac')]]['outboundAnswerCallsDay']+=0x1;var _0x2103c1=new AgentComplete(_0x39278f,_0x5f5832);if(_0x5f5832[_0x9cb3('0x105')]==='agent'){_0x2103c1[_0x9cb3('0x106')]=this[_0x9cb3('0x1f')][_0x5f5832[_0x9cb3('0xac')]][_0x9cb3('0x107')]&&this['voiceQueues'][_0x5f5832[_0x9cb3('0xac')]]['dialAgiAfterHangupAgent']?moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7')):undefined;}this['createHistory'](_0x2103c1)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x108')));this['moveContactManagedDialer'](_0x2103c1)[_0x9cb3('0xa9')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x9cb3('0x2b')]=function(_0x853bb){if(this['voiceQueues'][_0x853bb['queue']]){if(this['uniqueId'][_0x853bb[_0x9cb3('0xd4')]]&&this[_0x9cb3('0x26')][_0x853bb['uniqueid']][_0x9cb3('0x4d')]!=='ivr'){this['updateOriginated'](this['voiceQueues'][_0x853bb['queue']]);this[_0x9cb3('0x26')][_0x853bb[_0x9cb3('0xd4')]][_0x9cb3('0x109')]=moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7'));}}};Dialer['prototype'][_0x9cb3('0x10a')]=function(_0x4727f2){this['createHistory'](_0x4727f2)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x108')));this[_0x9cb3('0xd3')](_0x4727f2)[_0x9cb3('0xa9')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x9cb3('0x2c')]=function(_0x4df531){var _0x3ec4aa=this[_0x9cb3('0x26')][_0x4df531[_0x9cb3('0xd4')]];var _0x394808=this;if(this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]]){if(_0x3ec4aa&&_0x3ec4aa['type']!==_0x9cb3('0x7b')){delete this[_0x9cb3('0x26')][_0x4df531[_0x9cb3('0xd4')]];this[_0x9cb3('0xaa')](this['voiceQueues'][_0x4df531['queue']]);_0x3ec4aa[_0x9cb3('0x10b')]=moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7'));var _0x47b5c6=new QueueCallerAbandon(_0x3ec4aa,_0x4df531);if(getSeconds(_0x3ec4aa[_0x9cb3('0x10b')],_0x3ec4aa[_0x9cb3('0x10c')])>=_0x3ec4aa['dialQueueTimeout']){this['voiceQueues'][_0x4df531['queue']][_0x9cb3('0x6a')]+=0x1;this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]][_0x9cb3('0x10d')]+=0x1;this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]][_0x9cb3('0x6c')]+=0x1;_0x47b5c6[_0x9cb3('0xe4')]=0xa;_0x47b5c6[_0x9cb3('0xa1')]=_0x9cb3('0x10e');_0x47b5c6[_0x9cb3('0x10f')]=_0x9cb3('0x110');_0x47b5c6[_0x9cb3('0x106')]=this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]]['dialQueueProject2']?moment()[_0x9cb3('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x47b5c6[_0x9cb3('0xed')]+=0x1;_0x47b5c6[_0x9cb3('0xe8')]+=0x1;if(_0x47b5c6[_0x9cb3('0xed')]>=this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]]['dialDropMaxRetry']){this[_0x9cb3('0x10a')](_0x47b5c6);}else{this[_0x9cb3('0xb8')]({'active':![],'countdropretry':_0x47b5c6['countdropretry'],'scheduledat':moment()['add'](this['voiceQueues'][_0x4df531[_0x9cb3('0xac')]][_0x9cb3('0x111')],_0x9cb3('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ec4aa[_0x9cb3('0xc9')],'ListId':_0x3ec4aa[_0x9cb3('0xca')],'VoiceQueueId':_0x3ec4aa[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x3ec4aa[_0x9cb3('0xf8')]||undefined})['catch'](loggerCatch(_0x9cb3('0x112')));var _0x11278f=new History(_0x47b5c6);_0x11278f[_0x9cb3('0xe4')]=0xa;_0x11278f[_0x9cb3('0xa1')]=_0x9cb3('0x10e');_0x11278f[_0x9cb3('0xa2')]=moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7'));_0x11278f[_0x9cb3('0x113')]=_0x11278f[_0x9cb3('0xa2')];_0x11278f[_0x9cb3('0x114')]=_0x47b5c6[_0x9cb3('0x114')];_0x11278f[_0x9cb3('0x115')]=_0x47b5c6['calleridnum'];this[_0x9cb3('0xc2')](_0x11278f)[_0x9cb3('0xa9')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]][_0x9cb3('0x69')]+=0x1;this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]][_0x9cb3('0x61')]+=0x1;_0x47b5c6['state']=0xb;_0x47b5c6[_0x9cb3('0xa1')]=_0x9cb3('0x116');_0x47b5c6['dropreason']='CALLEREXIT';_0x47b5c6['countabandonedretry']+=0x1;_0x47b5c6[_0x9cb3('0xe8')]+=0x1;if(_0x47b5c6[_0x9cb3('0xee')]>=this[_0x9cb3('0x1f')][_0x4df531[_0x9cb3('0xac')]][_0x9cb3('0x117')]){this['queueCallerAbandonCreateState'](_0x47b5c6);}else{this[_0x9cb3('0xb8')]({'active':![],'countabandonedretry':_0x47b5c6[_0x9cb3('0xee')],'scheduledat':moment()[_0x9cb3('0xf4')](this['voiceQueues'][_0x4df531[_0x9cb3('0xac')]]['dialAbandonedRetryFrequency'],_0x9cb3('0xf6'))['format'](_0x9cb3('0xf7')),'ContactId':_0x3ec4aa[_0x9cb3('0xc9')],'ListId':_0x3ec4aa['ListId'],'VoiceQueueId':_0x3ec4aa[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x3ec4aa[_0x9cb3('0xf8')]||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x118')));var _0x11278f=new History(_0x47b5c6);_0x11278f[_0x9cb3('0xe4')]=0xb;_0x11278f['statedesc']=_0x9cb3('0x116');_0x11278f[_0x9cb3('0xa2')]=moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7'));_0x11278f[_0x9cb3('0x113')]=_0x11278f[_0x9cb3('0xa2')];_0x11278f[_0x9cb3('0x114')]=_0x47b5c6['calleridname'];_0x11278f[_0x9cb3('0x115')]=_0x47b5c6[_0x9cb3('0x115')];this['createHistory'](_0x11278f)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x119')));}}}}};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x35')]=function(_0x38c1ab){if(this[_0x9cb3('0x25')][_0x38c1ab[_0x9cb3('0xd4')]]){this[_0x9cb3('0x25')][_0x38c1ab[_0x9cb3('0xd4')]]['channel']=_0x38c1ab[_0x9cb3('0xa8')];}if(this[_0x9cb3('0x26')][_0x38c1ab['uniqueid']]){this['uniqueId'][_0x38c1ab[_0x9cb3('0xd4')]][_0x9cb3('0xa8')]=_0x38c1ab['channel'];}};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x39')]=function(_0x3da6a1){if(strategy[this['voiceQueues'][this[_0x9cb3('0x25')][_0x3da6a1['actionid']][_0x9cb3('0xac')]][_0x9cb3('0x4f')]]===_0x9cb3('0x11a')){if(this[_0x9cb3('0x25')][_0x3da6a1['actionid']]&&_[_0x9cb3('0xa7')](this['actions'][_0x3da6a1['actionid']][_0x9cb3('0x11b')])&&_0x3da6a1[_0x9cb3('0xd1')]==='1'&&_0x3da6a1[_0x9cb3('0x11c')]==='0'){if(this[_0x9cb3('0x21')][_0x3da6a1['stateinterface']]){if(!this[_0x9cb3('0x21')][_0x3da6a1[_0x9cb3('0x11d')]][_0x9cb3('0x11b')]){this['agents'][_0x3da6a1['stateinterface']][_0x9cb3('0x11b')]=!![];this['actions'][_0x3da6a1[_0x9cb3('0x11e')]][_0x9cb3('0x11b')]=!![];this['actions'][_0x3da6a1[_0x9cb3('0x11e')]][_0x9cb3('0x11d')]=_0x3da6a1[_0x9cb3('0x11d')];}}}}else if((strategy[this[_0x9cb3('0x1f')][this[_0x9cb3('0x25')][_0x3da6a1['actionid']][_0x9cb3('0xac')]][_0x9cb3('0x4f')]]||_0x9cb3('0x19'))===_0x9cb3('0x19')){if(this[_0x9cb3('0x25')][_0x3da6a1[_0x9cb3('0x11e')]]){if(this['agents'][_0x3da6a1['stateinterface']]){this[_0x9cb3('0x25')][_0x3da6a1['actionid']][_0x9cb3('0x11d')]=_0x3da6a1[_0x9cb3('0x11d')];if(_[_0x9cb3('0xa7')](this[_0x9cb3('0x29')][this['actions'][_0x3da6a1['actionid']][_0x9cb3('0xac')]])){this[_0x9cb3('0x29')][this[_0x9cb3('0x25')][_0x3da6a1['actionid']][_0x9cb3('0xac')]]=[];}this[_0x9cb3('0x29')][this[_0x9cb3('0x25')][_0x3da6a1[_0x9cb3('0x11e')]][_0x9cb3('0xac')]][_0x9cb3('0x11f')](_[_0x9cb3('0x8a')](_['pick'](this[_0x9cb3('0x25')][_0x3da6a1[_0x9cb3('0x11e')]],[_0x9cb3('0x120'),_0x9cb3('0x11d')]),{'status':_0x3da6a1[_0x9cb3('0xd1')],'paused':_0x3da6a1['paused']}));}}}};function unlockQueueStatus(_0x4b83aa,_0x539be1){setTimeout(function(){if(_[_0x9cb3('0x3c')](_0x4b83aa['queueStatusComplete'])){loggerBooked[_0x9cb3('0x93')](_0x9cb3('0x121'),_0x539be1);}_0x4b83aa[_0x9cb3('0x122')]=!![];loggerBooked[_0x9cb3('0x7e')](_0x9cb3('0x123'),_0x539be1,JSON[_0x9cb3('0x49')](_[_0x9cb3('0xc8')](_0x4b83aa,[_0x9cb3('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x9cb3('0x1a')][_0x9cb3('0x3a')]=function(_0x5c5cc9){var _0x1557da=this;var _0x5dc270=_0x1557da['voiceQueues'][_0x1557da[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]]['queue']];if(strategy[this[_0x9cb3('0x1f')][this['actions'][_0x5c5cc9['actionid']]['queue']][_0x9cb3('0x4f')]]==='roundrobin'){if(this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]]&&this['actions'][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0x11d')]){this[_0x9cb3('0x1e')][_0x9cb3('0x124')](this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]]['idHopper'],this['actions'][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0x11d')])[_0x9cb3('0xa9')](function(_0x1dbe84){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x1dbe84,{'showHidden':![],'depth':null}));})[_0x9cb3('0x1d')](function(){_0x1557da[_0x9cb3('0xaa')](_0x1557da['voiceQueues'][_0x1557da[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]]['queue']]);_0x1557da[_0x9cb3('0x21')][_0x1557da[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0x11d')]]['locked']=![];delete _0x1557da[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]];unlockQueueStatus(_0x5dc270);});}else{this[_0x9cb3('0xaa')](this[_0x9cb3('0x1f')][this[_0x9cb3('0x25')][_0x5c5cc9['actionid']][_0x9cb3('0xac')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xc9')],'ListId':this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]]['ListId'],'VoiceQueueId':this['actions'][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xcb')]||undefined,'CampaignId':this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]]['CampaignId']||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x125')));delete this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]];unlockQueueStatus(_0x5dc270);}}else if((strategy[this[_0x9cb3('0x1f')][this['actions'][_0x5c5cc9['actionid']][_0x9cb3('0xac')]][_0x9cb3('0x4f')]]||'rrmemory')===_0x9cb3('0x19')){var _0x11affc;if(this['actions'][_0x5c5cc9[_0x9cb3('0x11e')]]&&!_[_0x9cb3('0x47')](this[_0x9cb3('0x29')][this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xac')]])){if(this[_0x9cb3('0x126')][_0x1557da[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xac')]]){this[_0x9cb3('0x126')][_0x1557da[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xac')]]=this[_0x9cb3('0x126')][this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xac')]]?this[_0x9cb3('0x126')][this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xac')]]:this[_0x9cb3('0x29')][this[_0x9cb3('0x25')][_0x5c5cc9['actionid']][_0x9cb3('0xac')]]?this[_0x9cb3('0x29')][this['actions'][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xac')]]['_rr']||0x0:0x0;}this[_0x9cb3('0x29')][this[_0x9cb3('0x25')][_0x5c5cc9[_0x9cb3('0x11e')]][_0x9cb3('0xac')]][_0x9cb3('0x127')]=this[_0x9cb3('0x126')][this['actions'][_0x5c5cc9[_0x9cb3('0x11e')]]['queue']];for(var _0x3ede7a=0x0;_0x3ede7a=0x0;})[_0x9cb3('0xa9')](myreject(_0x38bcd4)));}}else{_0x33e194[_0x9cb3('0x11f')](ami[_0x9cb3('0x144')]({'action':'command','command':util['format'](_0x9cb3('0x13e'),_0x18e5a5,!_[_0x9cb3('0x3c')](config[_0x9cb3('0x140')][_0x206e8e])?_0x206e8e:'')})[_0x9cb3('0xae')](function(_0x25f820){return _0x25f820['content'][_0x9cb3('0x142')](_0x9cb3('0x143'))>=0x0;})[_0x9cb3('0xa9')](myreject(_0x38bcd4)));}BPromise['all'](_0x33e194)[_0x9cb3('0xae')](function(_0x17083c){var _0x36c660=_[_0x9cb3('0x145')](_0x17083c);if(_0x36c660){return _0x7bf0d3(_0x36c660);}else{_0x3225a6[_0x9cb3('0x3d')]=_0x5520cb?_0x9cb3('0x146'):'INTERVAL_IS_OVERTIME';return _0x38bcd4(msgResponse(_0x9cb3('0x147'),'Failure',_0x9cb3('0x148')+_0x5520cb+'\x20'+_0x34389f+_0x9cb3('0x149')+util[_0x9cb3('0x94')](_0x18e5a5,{'showHidden':![],'depth':null})+_0x9cb3('0x14a')+_0x206e8e));}})['catch'](function(_0x1c91a6){return _0x38bcd4(msgResponse(_0x9cb3('0x137'),_0x9cb3('0x138'),JSON[_0x9cb3('0x49')](_0x1c91a6)));});});};Dialer['prototype'][_0x9cb3('0x14b')]=function(_0xc0ced4){var _0x3a464e=this;return function(){switch(_0xc0ced4[_0x9cb3('0x58')]){case _0x9cb3('0x14c'):freeVariablesPredictive(_0xc0ced4);_0x3a464e[_0x9cb3('0x14d')](_0xc0ced4,0x1);break;case'power':freeVariablesPredictive(_0xc0ced4);_0x3a464e[_0x9cb3('0x14d')](_0xc0ced4,_0xc0ced4['dialPowerLevel']);break;case _0x9cb3('0x14e'):_0x3a464e[_0x9cb3('0x14e')](_0xc0ced4);break;case _0x9cb3('0x14f'):freeVariablesPredictive(_0xc0ced4);_0x3a464e[_0x9cb3('0x14d')](_0xc0ced4,0x1);break;default:freeVariablesPredictive(_0xc0ced4);logger[_0x9cb3('0x93')](_0x9cb3('0x150'),_0xc0ced4['name'],_0x9cb3('0x151'));}};};Dialer['prototype'][_0x9cb3('0x152')]=function(_0xfd13e7){var _0x16565c=this;return function(){_0x16565c[_0x9cb3('0x153')](_0xfd13e7);};};Dialer[_0x9cb3('0x1a')]['syncQueueSummary']=function(_0x5b8a45){var _0x56b580=this;if(isNotPreview(_0x5b8a45[_0x9cb3('0x58')])){if(isVoiceQueueOutbound(_0x5b8a45[_0x9cb3('0x4d')])&&isActive(_0x5b8a45['dialActive'])){_0x5b8a45[_0x9cb3('0x9b')]=!![];BPromise[_0x9cb3('0xb1')]()['then'](checkIsLoggedIn(_0x5b8a45,_0x5b8a45[_0x9cb3('0x154')]))[_0x9cb3('0xae')](checkIsActive(_0x5b8a45,_0x5b8a45[_0x9cb3('0x57')]))[_0x9cb3('0xae')](checkInterval(_0x5b8a45))[_0x9cb3('0xae')](_0x56b580[_0x9cb3('0x155')](_0x5b8a45))[_0x9cb3('0xae')](_0x56b580[_0x9cb3('0x136')](_0x5b8a45[_0x9cb3('0x156')],_0x5b8a45[_0x9cb3('0x157')],_0x5b8a45['name'],_0x5b8a45))[_0x9cb3('0xae')](_0x56b580[_0x9cb3('0x158')](_0x5b8a45[_0x9cb3('0x43')],_0x5b8a45['dialTimezone'],_0x5b8a45[_0x9cb3('0x3f')],_0x5b8a45))['then'](_0x56b580[_0x9cb3('0x14b')](_0x5b8a45))[_0x9cb3('0xa9')](loggerCatchQueueSummary(_0x9cb3('0x159'),_0x5b8a45));}else{notSendMessagesQueue(_0x5b8a45);}}else{freeVariablesPredictive(_0x5b8a45);}};Dialer[_0x9cb3('0x1a')]['syncCampaigns']=function(){var _0x441224=this;var _0x30d470;for(var _0x59fe35 in this[_0x9cb3('0x20')]){if(typeof this[_0x9cb3('0x20')][_0x59fe35]!=='undefined'){_0x30d470=this[_0x9cb3('0x20')][_0x59fe35];if(isCampaignIvr(_0x30d470[_0x9cb3('0x4d')])&&isActive(_0x30d470[_0x9cb3('0x78')])){_0x30d470[_0x9cb3('0x9b')]=!![];BPromise[_0x9cb3('0xb1')]()[_0x9cb3('0xae')](checkIsActive(_0x30d470,_0x30d470[_0x9cb3('0x78')]))['then'](checkInterval(_0x30d470))['then'](_0x441224['checkIsTrunkReachable'](_0x30d470))[_0x9cb3('0xae')](_0x441224['checkIfTime'](_0x30d470[_0x9cb3('0x156')],_0x30d470[_0x9cb3('0x157')],_0x30d470[_0x9cb3('0x3f')],_0x30d470))['then'](_0x441224['checkIfTimeIntervals'](_0x30d470[_0x9cb3('0x43')],_0x30d470[_0x9cb3('0x157')],_0x30d470[_0x9cb3('0x3f')],_0x30d470))['then'](_0x441224[_0x9cb3('0x152')](_0x30d470))[_0x9cb3('0xa9')](loggerCatchQueueSummary('[syncCampaigns]',_0x30d470));}else{notSendMessagesCampaign(_0x30d470);}}}};function getCallerIdRandom(_0x3048dc,_0x283347){var _0x22d7af;var _0x339084;var _0x576341;if(_0x283347<=0x0){_0x283347=0x1;}_0x22d7af=new RegExp(_0x9cb3('0x15a')+_0x283347+'}$');_0x339084=Math[_0x9cb3('0x15b')](0xa,_0x283347-0x1);_0x576341=Math['pow'](0xa,_0x283347)-0x1;return util['format']('%s',_[_0x9cb3('0x15c')](_0x3048dc,_0x22d7af,_[_0x9cb3('0x15d')](_0x339084,_0x576341)));}function extractCalleridName(_0x294be4){var _0x19fd32=_0x294be4[_0x9cb3('0x15e')](/"(.*?)"/);return _0x19fd32?_0x19fd32[0x1]:_0x294be4;}function extractCalleridNumber(_0x49fea7){var _0x3bc6a9=_0x49fea7[_0x9cb3('0x15e')](/<(.*?)>/);return _0x3bc6a9?_0x3bc6a9[0x1]:_0x49fea7;}Dialer[_0x9cb3('0x1a')][_0x9cb3('0x15f')]=function(_0x1f906e,_0x138755){var _0x38d5a3=this;var _0x4f53c2=uuid['v4']();this[_0x9cb3('0x25')][_0x4f53c2]=new Action(_0x1f906e,_0x138755,_0x4f53c2);return new BPromise(function(_0x30cf45,_0x428073){if(_[_0x9cb3('0x3c')](_0x1f906e)&&typeof _0x1f906e!==_0x9cb3('0x160')){return _0x428073(msgResponse(_0x9cb3('0x161'),_0x9cb3('0x138'),'voiceQueue\x20is\x20undefine'));}if(_[_0x9cb3('0x3c')](_0x138755[_0x9cb3('0x162')]['phone'])||_0x138755[_0x9cb3('0x162')]['phone']===null){return _0x428073(msgResponse(_0x9cb3('0x161'),_0x9cb3('0x138'),_0x9cb3('0x163')));}var _0x50660={'XMD-CALLERID':_0x38d5a3[_0x9cb3('0x25')][_0x4f53c2]['getCaller'](),'XMD-AGI':_0x1f906e[_0x9cb3('0x102')]?util[_0x9cb3('0x7a')](_0x9cb3('0x164'),ipAgi,_0x1f906e['dialQueueProject']):_0x9cb3('0x165'),'XMD-AGIAFTER':_0x1f906e[_0x9cb3('0x107')]?util['format'](_0x9cb3('0x164'),ipAgi,_0x1f906e[_0x9cb3('0x107')]):_0x9cb3('0x165'),'XMD-QUEUE':_0x1f906e['type']==='outbound'?util[_0x9cb3('0x7a')](_0x9cb3('0x166'),_0x1f906e[_0x9cb3('0x3f')],_0x1f906e[_0x9cb3('0x167')]||'',_0x1f906e['dialAgiAfterHangupAgent']?'c':'',_0x1f906e[_0x9cb3('0x168')]||0x3):_0x9cb3('0x165'),'XMD-CONTACTID':_0x138755[_0x9cb3('0xc9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x38d5a3[_0x9cb3('0x25')][_0x4f53c2][_0x9cb3('0x169')](),'XMD-AMD':_0x1f906e[_0x9cb3('0xe2')]?_0x9cb3('0x16a'):_0x9cb3('0x165'),'XMD-DESTINATION':_0x9cb3('0xd7')};if(_0x1f906e[_0x9cb3('0xe2')]){_0x50660[_0x9cb3('0x16b')]=_0x1f906e[_0x9cb3('0x16c')]||0x9c4;_0x50660[_0x9cb3('0x16d')]=_0x1f906e['dialAMDGreeting']||0x5dc;_0x50660[_0x9cb3('0x16e')]=_0x1f906e['dialAMDAfterGreetingSilence']||0x320;_0x50660['XMD-AMDTOTALANALYSISTIME']=_0x1f906e['dialAMDTotalAnalysisTime']||0x1388;_0x50660['XMD-AMDMINWORDLENGTH']=_0x1f906e[_0x9cb3('0x16f')]||0x64;_0x50660[_0x9cb3('0x170')]=_0x1f906e[_0x9cb3('0x171')]||0x32;_0x50660[_0x9cb3('0x172')]=_0x1f906e[_0x9cb3('0x173')]||0x3;_0x50660[_0x9cb3('0x174')]=_0x1f906e['dialAMDSilenceThreshold']||0x100;_0x50660[_0x9cb3('0x175')]=_0x1f906e[_0x9cb3('0x176')]||0x1388;}if(_0x1f906e[_0x9cb3('0x4d')]===_0x9cb3('0x4e')){_0x50660[_0x9cb3('0x177')]=_0x138755['VoiceQueueId'];}else{_0x50660[_0x9cb3('0x178')]=_0x138755[_0x9cb3('0xf8')];}for(var _0x21d319 in _0x138755['Contact']){if(typeof _0x138755[_0x9cb3('0x162')][_0x21d319]!==_0x9cb3('0xa5')){if(isNotNull(_0x138755[_0x9cb3('0x162')][_0x21d319])&&_0x21d319!=='id'&&_0x21d319!==_0x9cb3('0x179')&&_0x21d319!=='createdAt'&&_0x21d319!==_0x9cb3('0x17a')){_0x50660[util['format'](_0x9cb3('0x17b'),_0x9cb3('0x17c'),_['toUpper'](_0x21d319))]=_0x138755[_0x9cb3('0x162')][_0x21d319];}}}var _0x2cf847=_0x38d5a3[_0x9cb3('0x133')](_0x1f906e[_0x9cb3('0x77')])?getCallerId(_0x1f906e[_0x9cb3('0x77')][_0x9cb3('0x79')],_0x1f906e[_0x9cb3('0x59')],_0x1f906e['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1f906e[_0x9cb3('0x17d')],_0x1f906e['dialRandomLastDigitCallerIdNumber']):_0x1f906e[_0x9cb3('0x17d')]):getCallerId(_[_0x9cb3('0xa7')](_0x1f906e['TrunkBackup'])?_0x1f906e[_0x9cb3('0x77')][_0x9cb3('0x79')]:_0x1f906e['TrunkBackup'][_0x9cb3('0x79')],_0x1f906e[_0x9cb3('0x59')],_0x1f906e[_0x9cb3('0x17e')]>0x0?getCallerIdRandom(_0x1f906e[_0x9cb3('0x17d')],_0x1f906e[_0x9cb3('0x17e')]):_0x1f906e['dialOriginateCallerIdNumber']);if(_0x2cf847){_0x50660[_0x9cb3('0x17f')]=_0x38d5a3[_0x9cb3('0x25')][_0x4f53c2]['originatecalleridname']=extractCalleridName(_0x2cf847);_0x50660[_0x9cb3('0x180')]=_0x38d5a3[_0x9cb3('0x25')][_0x4f53c2][_0x9cb3('0x181')]=extractCalleridNumber(_0x2cf847);}return ami[_0x9cb3('0x144')]({'actionid':_0x4f53c2,'action':'originate','channel':_0x38d5a3[_0x9cb3('0x133')](_0x1f906e[_0x9cb3('0x77')])?util[_0x9cb3('0x7a')](_0x9cb3('0x182'),_0x1f906e[_0x9cb3('0x77')][_0x9cb3('0x3f')],isNotNull(_0x1f906e['dialPrefix'])?_0x1f906e[_0x9cb3('0x5a')][_0x9cb3('0x183')]()||'':'',_0x1f906e['dialCutDigit']>0x0?_0x138755[_0x9cb3('0x162')][_0x9cb3('0x184')][_0x9cb3('0x185')](_0x1f906e[_0x9cb3('0x186')]):_0x138755['Contact'][_0x9cb3('0x184')]):util[_0x9cb3('0x7a')]('SIP/%s/%s%s',_[_0x9cb3('0xa7')](_0x1f906e['TrunkBackup'])?_0x1f906e[_0x9cb3('0x77')][_0x9cb3('0x3f')]:_0x1f906e['TrunkBackup'][_0x9cb3('0x3f')],isNotNull(_0x1f906e[_0x9cb3('0x5a')])?_0x1f906e[_0x9cb3('0x5a')][_0x9cb3('0x183')]()||'':'',_0x1f906e[_0x9cb3('0x186')]>0x0?_0x138755[_0x9cb3('0x162')][_0x9cb3('0x184')]['substring'](_0x1f906e[_0x9cb3('0x186')]):_0x138755[_0x9cb3('0x162')]['phone']),'callerid':_0x2cf847,'Exten':_0x9cb3('0xd7'),'Context':_0x9cb3('0x187'),'Priority':'1','variable':_0x50660,'timeout':(_0x1f906e[_0x9cb3('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4f53c2})['then'](function(_0x4e08de){return _0x30cf45(_0x4e08de);})[_0x9cb3('0xa9')](function(_0x12ac30){_0x1f906e['outboundOriginateFailureCallsDay']+=0x1;var _0x44313e=new History(_0x38d5a3['actions'][_0x4f53c2]);logger[_0x9cb3('0x93')](util[_0x9cb3('0x7a')](_0x9cb3('0x189'),JSON[_0x9cb3('0x49')](_0x12ac30)));_0x44313e[_0x9cb3('0xe4')]=0xe;_0x44313e['statedesc']=_0x9cb3('0x18a');_0x44313e['starttime']=moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7'));_0x44313e[_0x9cb3('0x113')]=_0x44313e[_0x9cb3('0xa2')];_0x38d5a3[_0x9cb3('0xc2')](_0x44313e)[_0x9cb3('0xa9')](loggerCatch('[originate][error]'));_0x38d5a3[_0x9cb3('0xd3')](_0x44313e)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x18b')))[_0x9cb3('0x1d')](function(){delete _0x38d5a3['actions'][_0x4f53c2];return _0x428073(msgResponse(_0x9cb3('0x161'),_0x9cb3('0x18c'),_0x9cb3('0x18d')));});});});};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x2f')]=function(_0x36ac03){var _0xc79a4b=this[_0x9cb3('0x25')][_0x36ac03['actionid']];if(_0xc79a4b){delete this[_0x9cb3('0x25')][_0x36ac03[_0x9cb3('0x11e')]];_0xc79a4b[_0x9cb3('0x10c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2821d4=_0xc79a4b[_0x9cb3('0x4d')]===_0x9cb3('0x7b')?this[_0x9cb3('0x20')][_0xc79a4b[_0x9cb3('0xac')]]:this['voiceQueues'][_0xc79a4b[_0x9cb3('0x18e')]()];if(!this[_0x9cb3('0xcd')](_0x36ac03[_0x9cb3('0x18f')])){this['updateOriginated'](_0x2821d4);return this[_0x9cb3('0x190')](_0xc79a4b,_0x2821d4,_0x36ac03)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x191')));}this[_0x9cb3('0x26')][_0x36ac03[_0x9cb3('0xd4')]]=_0xc79a4b;}};Dialer['prototype'][_0x9cb3('0x192')]=function(_0x3b870a,_0x477f8a,_0xe6ced8){var _0x1de621=new History(_0x477f8a);if(_0x1de621['countbusyretry']+_0x1de621[_0x9cb3('0xeb')]+_0x1de621[_0x9cb3('0xec')]+_0x1de621[_0x9cb3('0xfb')]+_0x1de621[_0x9cb3('0xed')]+_0x1de621[_0x9cb3('0xee')]+_0x1de621[_0x9cb3('0xe7')]+_0x1de621[_0x9cb3('0xef')]>=_0xe6ced8[_0x9cb3('0xfc')]-0x1){return!![];}switch(_0x3b870a){case 0x3:if(_0x1de621[_0x9cb3('0xec')]>=_0xe6ced8[_0x9cb3('0x193')]-0x1){return!![];}this[_0x9cb3('0xb8')]({'active':![],'countnoanswerretry':_0x1de621[_0x9cb3('0xec')]+=0x1,'scheduledat':moment()['add'](_0xe6ced8[_0x9cb3('0x194')],_0x9cb3('0xf6'))[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1de621[_0x9cb3('0xc9')],'ListId':_0x1de621[_0x9cb3('0xca')],'VoiceQueueId':_0x1de621[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x1de621['CampaignId']||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x195')));break;case 0x5:if(_0x1de621[_0x9cb3('0xea')]>=_0xe6ced8[_0x9cb3('0x196')]-0x1){return!![];}this[_0x9cb3('0xb8')]({'active':![],'countbusyretry':_0x1de621[_0x9cb3('0xea')]+=0x1,'scheduledat':moment()[_0x9cb3('0xf4')](_0xe6ced8[_0x9cb3('0x197')],_0x9cb3('0xf6'))[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1de621[_0x9cb3('0xc9')],'ListId':_0x1de621['ListId'],'VoiceQueueId':_0x1de621[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x1de621[_0x9cb3('0xf8')]||undefined})[_0x9cb3('0xa9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1de621['countcongestionretry']>=_0xe6ced8[_0x9cb3('0x198')]-0x1){return!![];}this[_0x9cb3('0xb8')]({'active':![],'countcongestionretry':_0x1de621[_0x9cb3('0xeb')]+=0x1,'scheduledat':moment()[_0x9cb3('0xf4')](_0xe6ced8['dialCongestionRetryFrequency'],_0x9cb3('0xf6'))[_0x9cb3('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1de621[_0x9cb3('0xc9')],'ListId':_0x1de621[_0x9cb3('0xca')],'VoiceQueueId':_0x1de621[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x1de621[_0x9cb3('0xf8')]||undefined})[_0x9cb3('0xa9')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1de621[_0x9cb3('0xfb')]>=_0xe6ced8[_0x9cb3('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1de621[_0x9cb3('0xfb')]+=0x1,'scheduledat':moment()[_0x9cb3('0xf4')](_0xe6ced8[_0x9cb3('0x19a')],_0x9cb3('0xf6'))[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1de621[_0x9cb3('0xc9')],'ListId':_0x1de621[_0x9cb3('0xca')],'VoiceQueueId':_0x1de621[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x1de621['CampaignId']||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x19b')));}break;case 0xa:if(_0x1de621[_0x9cb3('0xed')]>=_0xe6ced8['dialDropMaxRetry']-0x1){return!![];}this[_0x9cb3('0xb8')]({'active':![],'countdropretry':_0x1de621['countdropretry']+=0x1,'scheduledat':moment()[_0x9cb3('0xf4')](_0xe6ced8[_0x9cb3('0x111')],_0x9cb3('0xf6'))[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1de621[_0x9cb3('0xc9')],'ListId':_0x1de621[_0x9cb3('0xca')],'VoiceQueueId':_0x1de621['VoiceQueueId']||undefined,'CampaignId':_0x1de621['CampaignId']||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x112')));break;case 0xb:if(_0x1de621[_0x9cb3('0xee')]>=_0xe6ced8[_0x9cb3('0x117')]-0x1){return!![];}this[_0x9cb3('0xb8')]({'active':![],'countabandonedretry':_0x1de621[_0x9cb3('0xee')]+=0x1,'scheduledat':moment()[_0x9cb3('0xf4')](_0xe6ced8[_0x9cb3('0x19c')],'minutes')[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1de621[_0x9cb3('0xc9')],'ListId':_0x1de621['ListId'],'VoiceQueueId':_0x1de621['VoiceQueueId']||undefined,'CampaignId':_0x1de621['CampaignId']||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x118')));break;case 0x13:if(_0x1de621[_0x9cb3('0xe7')]>=_0xe6ced8[_0x9cb3('0xf2')]-0x1){return!![];}this[_0x9cb3('0xb8')]({'active':![],'countmachineretry':_0x1de621[_0x9cb3('0xe7')]+=0x1,'scheduledat':moment()[_0x9cb3('0xf4')](_0xe6ced8[_0x9cb3('0xf5')],'minutes')[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1de621['ContactId'],'ListId':_0x1de621['ListId'],'VoiceQueueId':_0x1de621['VoiceQueueId']||undefined,'CampaignId':_0x1de621[_0x9cb3('0xf8')]||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xf9')));break;case 0x14:if(_0x1de621['countagentrejectretry']>=_0xe6ced8[_0x9cb3('0x19d')]-0x1){return!![];}this[_0x9cb3('0xb8')]({'active':![],'countagentrejectretry':_0x1de621[_0x9cb3('0xef')]+=0x1,'scheduledat':moment()[_0x9cb3('0xf4')](_0xe6ced8[_0x9cb3('0x19e')],_0x9cb3('0xf6'))[_0x9cb3('0x7a')](_0x9cb3('0xf7')),'ContactId':_0x1de621[_0x9cb3('0xc9')],'ListId':_0x1de621[_0x9cb3('0xca')],'VoiceQueueId':_0x1de621[_0x9cb3('0xcb')]||undefined,'CampaignId':_0x1de621[_0x9cb3('0xf8')]||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x19f')));break;default:return!![];}};Dialer['prototype'][_0x9cb3('0x190')]=function(_0x2d1ef5,_0x3c563e,_0x49c829){var _0x579aae=this;var _0x43eea1=new History(_0x2d1ef5);return new BPromise(function(_0x529974,_0xe71dba){if(_['isUndefined'](_0x3c563e)&&typeof _0x3c563e!==_0x9cb3('0x160')){return _0xe71dba(msgResponse(_0x9cb3('0x1a0'),'Failure',_0x9cb3('0x1a1')));}if(_['isUndefined'](_0x49c829)&&typeof _0x49c829!==_0x9cb3('0x160')){return _0xe71dba(msgResponse('[callProgressDetecting]',_0x9cb3('0x138'),_0x9cb3('0x1a2')));}switch(_0x49c829[_0x9cb3('0x105')]){case'0':_0x3c563e[_0x9cb3('0x63')]+=0x1;_0x43eea1[_0x9cb3('0xe4')]=0x0;_0x43eea1[_0x9cb3('0xa1')]='NoSuchNumber';_0x43eea1['countnosuchnumberretry']+=0x1;_0x43eea1[_0x9cb3('0xe8')]+=0x1;ami[_0x9cb3('0xdc')](_0x9cb3('0x1a3'),ut[_0x9cb3('0xde')](_0x2d1ef5,_0x9cb3('0x1a4')));_0x579aae[_0x9cb3('0xc2')](_0x43eea1)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0xe9')));if(_0x579aae[_0x9cb3('0x192')](0x0,_0x2d1ef5,_0x3c563e)){if(_0x43eea1[_0x9cb3('0xfb')]>=_0x3c563e[_0x9cb3('0x199')]){_0x579aae[_0x9cb3('0xfd')](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1a5'));}else{_0x579aae[_0x9cb3('0xf0')](_0x43eea1,_0x529974,_0xe71dba,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3c563e[_0x9cb3('0x62')]+=0x1;_0x43eea1['state']=0x3;_0x43eea1['statedesc']=_0x9cb3('0x1a6');_0x43eea1[_0x9cb3('0xec')]+=0x1;_0x43eea1['countglobal']+=0x1;ami[_0x9cb3('0xdc')](_0x9cb3('0x1a7'),ut[_0x9cb3('0xde')](_0x2d1ef5,_0x9cb3('0x1a8')));_0x579aae[_0x9cb3('0xc2')](_0x43eea1)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x1a9')));if(_0x579aae[_0x9cb3('0x192')](0x3,_0x2d1ef5,_0x3c563e)){if(_0x43eea1[_0x9cb3('0xec')]>=_0x3c563e['dialNoAnswerMaxRetry']){_0x579aae[_0x9cb3('0xfd')](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1aa'));}else{_0x579aae[_0x9cb3('0xf0')](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1aa'));}}break;case'5':_0x3c563e[_0x9cb3('0x5e')]+=0x1;_0x43eea1['state']=0x5;_0x43eea1[_0x9cb3('0xa1')]=_0x9cb3('0x1ab');_0x43eea1['countbusyretry']+=0x1;_0x43eea1['countglobal']+=0x1;ami[_0x9cb3('0xdc')](_0x9cb3('0x1ac'),ut[_0x9cb3('0xde')](_0x2d1ef5,_0x9cb3('0x1ad')));_0x579aae[_0x9cb3('0xc2')](_0x43eea1)['catch'](loggerCatch(_0x9cb3('0x1ae')));if(_0x579aae['checkRetriveMax'](0x5,_0x2d1ef5,_0x3c563e)){if(_0x43eea1[_0x9cb3('0xea')]>=_0x3c563e[_0x9cb3('0x196')]){_0x579aae[_0x9cb3('0xfd')](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1af'));}else{_0x579aae['stateGlobal'](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1af'));}}break;case'8':_0x3c563e[_0x9cb3('0x5f')]+=0x1;_0x43eea1['state']=0x8;_0x43eea1[_0x9cb3('0xa1')]=_0x9cb3('0x1b0');_0x43eea1['countcongestionretry']+=0x1;_0x43eea1['countglobal']+=0x1;ami[_0x9cb3('0xdc')]('custom:agentcongestion',ut[_0x9cb3('0xde')](_0x2d1ef5,'congestion'));_0x579aae['createHistory'](_0x43eea1)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x1b1')));if(_0x579aae[_0x9cb3('0x192')](0x8,_0x2d1ef5,_0x3c563e)){if(_0x43eea1[_0x9cb3('0xeb')]>=_0x3c563e[_0x9cb3('0x198')]){_0x579aae['createStateFinal'](_0x43eea1,_0x529974,_0xe71dba,'reason\x208\x20congestion');}else{_0x579aae['stateGlobal'](_0x43eea1,_0x529974,_0xe71dba,'reason\x208\x20congestion');}}break;case'11':_0x3c563e[_0x9cb3('0x1b2')]+=0x1;_0x43eea1[_0x9cb3('0xe4')]=0xb;_0x43eea1[_0x9cb3('0xa1')]=_0x9cb3('0x116');_0x43eea1[_0x9cb3('0xee')]+=0x1;_0x43eea1['countglobal']+=0x1;_0x579aae[_0x9cb3('0xc2')](_0x43eea1)['catch'](loggerCatch(_0x9cb3('0x119')));if(_0x579aae[_0x9cb3('0x192')](0xb,_0x2d1ef5,_0x3c563e)){if(_0x43eea1[_0x9cb3('0xee')]>=_0x3c563e[_0x9cb3('0x117')]){_0x579aae['createStateFinal'](_0x43eea1,_0x529974,_0xe71dba,'reason\x2011\x20abandoned');}else{_0x579aae[_0x9cb3('0xf0')](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1b3'));}}break;case'20':_0x3c563e[_0x9cb3('0x1b4')]+=0x1;_0x43eea1[_0x9cb3('0xe4')]=0x14;_0x43eea1[_0x9cb3('0xa1')]=_0x9cb3('0x1b5');_0x43eea1[_0x9cb3('0xef')]+=0x1;_0x43eea1[_0x9cb3('0xe8')]+=0x1;ami[_0x9cb3('0xdc')](_0x9cb3('0x1b6'),ut[_0x9cb3('0xde')](_0x2d1ef5,_0x9cb3('0x1b7')));_0x579aae[_0x9cb3('0xc2')](_0x43eea1)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x1b8')));if(_0x579aae['checkRetriveMax'](0x14,_0x2d1ef5,_0x3c563e)){if(_0x43eea1[_0x9cb3('0xef')]>=_0x3c563e['dialAgentRejectMaxRetry']){_0x579aae[_0x9cb3('0xfd')](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1b9'));}else{_0x579aae[_0x9cb3('0xf0')](_0x43eea1,_0x529974,_0xe71dba,_0x9cb3('0x1b9'));}}break;default:_0x3c563e[_0x9cb3('0x66')]+=0x1;_0x43eea1[_0x9cb3('0xe4')]=0xc;_0x43eea1['statedesc']=_0x49c829['reason'];_0x579aae[_0x9cb3('0xc2')](_0x43eea1)[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x1ba')));if(_0x579aae['checkRetriveMax'](_0x49c829['reason'],_0x2d1ef5,_0x3c563e)){if(_0x43eea1[_0x9cb3('0xea')]+_0x43eea1[_0x9cb3('0xeb')]+_0x43eea1['countnoanswerretry']+_0x43eea1[_0x9cb3('0xfb')]+_0x43eea1[_0x9cb3('0xed')]+_0x43eea1[_0x9cb3('0xee')]+_0x43eea1[_0x9cb3('0xe7')]+_0x43eea1[_0x9cb3('0xef')]>=_0x3c563e['dialGlobalMaxRetry']){_0x579aae[_0x9cb3('0xf0')](_0x43eea1,_0x529974,_0xe71dba,_0x49c829[_0x9cb3('0x105')]);}else{_0x579aae[_0x9cb3('0xfd')](_0x43eea1,_0x529974,_0xe71dba,_0x49c829['reason']);}}}});};Dialer[_0x9cb3('0x1a')]['stateGlobal']=function(_0x461c2d,_0x53e5b0,_0xa84d72,_0x3ed250){var _0x5360dc=new Final(_0x461c2d);_0x5360dc[_0x9cb3('0xe4')]=0xf;_0x5360dc['statedesc']=_0x9cb3('0x1bb');this['createStateFinal'](_0x5360dc,_0x53e5b0,_0xa84d72,_0x3ed250);};Dialer[_0x9cb3('0x1a')][_0x9cb3('0xfd')]=function(_0x1d19e5,_0x3191b5,_0x14698d,_0x5ebba3){this[_0x9cb3('0xd3')](_0x1d19e5)[_0x9cb3('0xae')](function(){return _0x3191b5(msgResponse(_0x9cb3('0x1a0'),_0x9cb3('0xce'),_0x5ebba3));})[_0x9cb3('0xa9')](function(){return _0x14698d(msgResponse(_0x9cb3('0x1bc'),_0x9cb3('0x138'),'contact\x20not\x20moved'));});};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x14e')]=function(_0xb28594){var _0x1ab18a=_0xb28594[_0x9cb3('0x1bd')]/0x64;var _0x3f0f74=_0xb28594[_0x9cb3('0x10d')]/(_0xb28594[_0x9cb3('0x10d')]+_0xb28594[_0x9cb3('0x5c')]);var _0x450dcd=Math[_0x9cb3('0x1be')](_0xb28594[_0x9cb3('0x6f')]*(_0xb28594[_0x9cb3('0x1bf')]/0x64));var _0x5d33f4=Math[_0x9cb3('0x1be')](_0xb28594[_0x9cb3('0x6f')]*(_0xb28594['predictiveIntervalMinThreshold']/0x64));var _0x4a707b=_0xb28594[_0x9cb3('0x1c0')]+_0xb28594[_0x9cb3('0x54')];var _0x36e4f8=Math['floor'](_0xb28594['erlangCalls']*_0xb28594['erlangAbandonmentRate']*_0xb28594['predictiveIntervalHitRate']*_0xb28594[_0x9cb3('0x6e')]);if(_[_0x9cb3('0x3c')](_0xb28594['startProgressive'])){if(!_[_0x9cb3('0x3c')](_0xb28594[_0x9cb3('0x76')])){_0xb28594[_0x9cb3('0x76')]=undefined;loggerPredictive['error'](_0x9cb3('0x1c1'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0xb28594[_0x9cb3('0x8e')])){loggerPredictive[_0x9cb3('0x93')](_0x9cb3('0x1c1'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xb28594[_0x9cb3('0x8e')]);_0xb28594[_0x9cb3('0x8e')]=undefined;}_0xb28594[_0x9cb3('0x8b')]=moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7'));loggerPredictive[_0x9cb3('0x7e')](_0xb28594['name'],_0x9cb3('0x1c2'),_0xb28594['startProgressive']);this[_0x9cb3('0x14d')](_0xb28594,0x1);}else if(ifInterval(_0xb28594[_0x9cb3('0x1c3')],_0xb28594['startProgressive'])){this[_0x9cb3('0x14d')](_0xb28594,0x1);loggerPredictiveCalls[_0x9cb3('0x7e')](_0x9cb3('0x1c4'),_0xb28594['startProgressive'],_0xb28594[_0x9cb3('0x3f')]);_0xb28594[_0x9cb3('0x72')]=0x0;_0xb28594['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1ab18a<_0x3f0f74&&_0xb28594[_0x9cb3('0x1c5')]===_0x9cb3('0x1c6')){freeVariablesPredictive(_0xb28594);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x1c7'),_0x9cb3('0x1c8'),_0x3f0f74,_0x9cb3('0x8b'),_0xb28594[_0x9cb3('0x3f')]);}else if(_0x36e4f8<_0xb28594[_0x9cb3('0x6c')]&&_0xb28594[_0x9cb3('0x1c5')]==='dropRate'){freeVariablesPredictive(_0xb28594);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x1c9'),_0x9cb3('0x1ca'),_0x36e4f8,_0x9cb3('0x1cb'),_0xb28594[_0x9cb3('0x6c')],_0x9cb3('0x8b'),_0xb28594[_0x9cb3('0x3f')]);}else if(!ifInterval(_0xb28594['dialPredictiveInterval'],_0xb28594[_0x9cb3('0x8b')])&&_[_0x9cb3('0x3c')](_0xb28594[_0x9cb3('0x76')])&&!_[_0x9cb3('0x3c')](_0xb28594[_0x9cb3('0x8b')])){_0xb28594[_0x9cb3('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x9cb3('0x7e')](_0xb28594['name'],_0x9cb3('0x1cc'),_0xb28594[_0x9cb3('0x76')]);this[_0x9cb3('0xb5')](_0xb28594['dialPredictiveInterval'])[_0x9cb3('0xae')](this['getDataPredictive'](_0xb28594))[_0x9cb3('0xae')](mergeDataErlangB(_0xb28594))[_0x9cb3('0xae')](this['startMethodPredictive'](_0xb28594))[_0x9cb3('0xa9')](loggerCatchPredictive(_0x9cb3('0x1cd'),_0xb28594));}else if(!ifInterval(_0xb28594[_0x9cb3('0x1c3')],_0xb28594[_0x9cb3('0x76')])){_0xb28594[_0x9cb3('0x6c')]=0x0;_0xb28594[_0x9cb3('0x76')]=moment()[_0x9cb3('0x7a')](_0x9cb3('0xf7'));loggerPredictive[_0x9cb3('0x7e')](_0xb28594[_0x9cb3('0x3f')],_0x9cb3('0x1ce'),_0xb28594[_0x9cb3('0x76')]);clearInterval(_0xb28594[_0x9cb3('0x8e')]);_0xb28594[_0x9cb3('0x8e')]=undefined;this['averageHandleTime'](_0xb28594[_0x9cb3('0x1c3')])[_0x9cb3('0xae')](this[_0x9cb3('0x1cf')](_0xb28594))[_0x9cb3('0xae')](mergeDataErlangB(_0xb28594))[_0x9cb3('0xae')](this[_0x9cb3('0x1d0')](_0xb28594))[_0x9cb3('0xa9')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xb28594));}else if(_0xb28594['predictiveIntervalAvailable']&&_0x4a707b<_0xb28594[_0x9cb3('0x6f')]-_0x5d33f4){freeVariablesPredictive(_0xb28594);loggerPredictive['info'](_0xb28594[_0x9cb3('0x3f')],_0x9cb3('0x1d1'),_0x4a707b,_0x9cb3('0x1d2'),_0xb28594[_0x9cb3('0x6f')],'-',_0x5d33f4,'=',_0xb28594[_0x9cb3('0x6f')]-_0x5d33f4,')');}else if(_0xb28594[_0x9cb3('0x6f')]&&_0x4a707b>_0xb28594[_0x9cb3('0x6f')]+_0x450dcd){freeVariablesPredictive(_0xb28594);loggerPredictive[_0x9cb3('0x7e')](_0xb28594[_0x9cb3('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4a707b,_0x9cb3('0x1d3'),_0xb28594[_0x9cb3('0x6f')],'+',_0x450dcd,'=',_0xb28594[_0x9cb3('0x6f')]+_0x450dcd,')');}};Dialer['prototype'][_0x9cb3('0x1cf')]=function(_0x1583c4){var _0x20c205=this;return function(_0x476a3b){return new BPromise(function(_0x1ea3f5,_0x4f902c){_[_0x9cb3('0x8a')](_0x1583c4,_0x476a3b[0x0]);if(checkGetDataPredictive(_0x476a3b[0x0])){var _0x25e0c7=_0x1583c4[_0x9cb3('0x6f')]=_0x1583c4[_0x9cb3('0x54')]+_0x1583c4[_0x9cb3('0x1c0')];var _0x5fabb7=_0x1583c4['dialPredictiveInterval']*0x3c;var _0x25176e=_0x476a3b[0x0]['predictiveIntervalAvgTalktime']+_0x476a3b[0x0][_0x9cb3('0x84')];var _0x2fafde=(_0x476a3b[0x0]['predictiveIntervalAnsweredCalls']+_0x476a3b[0x0][_0x9cb3('0x6a')]+_0x476a3b[0x0][_0x9cb3('0x69')])/_0x476a3b[0x0][_0x9cb3('0x70')];_0x1583c4[_0x9cb3('0x6d')]=_0x2fafde>0x0?_0x2fafde:0x1;switch(_0x1583c4[_0x9cb3('0x1c5')]){case'dropRate':var _0x24bc1b=_0x1583c4['dialPredictiveOptimizationPercentage']/0x64;return _0x20c205[_0x9cb3('0x1d4')](_0x25e0c7,_0x5fabb7,_0x25176e,_0x2fafde,_0x24bc1b)[_0x9cb3('0xae')](function(_0x5997a2){return _0x1ea3f5(_0x5997a2);});case'agentBusyFactor':var _0x2970fd=_0x1583c4[_0x9cb3('0x1bd')]/0x64;return _0x20c205[_0x9cb3('0x1d5')](_0x25e0c7,_0x5fabb7,_0x25176e,_0x2fafde,_0x2970fd)[_0x9cb3('0xae')](function(_0x339479){return _0x1ea3f5(_0x339479);});default:return _0x4f902c(msgResponse(_0x9cb3('0x1d6'),'Failure',_0x9cb3('0x1d7')));}}else{return _0x4f902c(msgResponse('[getDataPredictive]',_0x9cb3('0x138'),_0x9cb3('0x1d8')));}});};};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x1d9')]=function(_0x6451b7){var _0x2197e9=this;return function(_0x14a5ef){return new BPromise(function(_0x45f2bf,_0x58ab9c){_[_0x9cb3('0x8a')](_0x6451b7,_0x14a5ef[0x0]);if(checkGetDataPredictive(_0x14a5ef[0x0])){loggerPredictive[_0x9cb3('0x7e')](JSON[_0x9cb3('0x49')](_0x14a5ef[0x0]));if(_0x6451b7[_0x9cb3('0x1c5')]===_0x9cb3('0x1c6')){return _0x2197e9[_0x9cb3('0xbf')](_0x6451b7['id'])['then'](function(_0x528d89){var _0x4cf4fa=_0x6451b7[_0x9cb3('0x154')]-_0x528d89[0x0][_0x9cb3('0x1da')];var _0x50980a=_0x6451b7[_0x9cb3('0x1c3')]*0x3c;var _0x454a95=_0x14a5ef[0x0][_0x9cb3('0x68')]+_0x14a5ef[0x0][_0x9cb3('0x84')];var _0x1e6e1a=(_0x14a5ef[0x0][_0x9cb3('0x67')]+_0x14a5ef[0x0][_0x9cb3('0x6a')]+_0x14a5ef[0x0][_0x9cb3('0x69')])/_0x14a5ef[0x0][_0x9cb3('0x70')];var _0x4ab7ed=_0x6451b7['dialPredictiveOptimizationPercentage']/0x64;_0x6451b7[_0x9cb3('0x1db')]=_0x528d89[0x0][_0x9cb3('0x1da')]||0x0;_0x6451b7[_0x9cb3('0x6d')]=_0x1e6e1a>0x0?_0x1e6e1a:0x1;return _0x2197e9['abandonmentRate'](_0x4cf4fa,_0x50980a,_0x454a95,_0x1e6e1a,_0x4ab7ed);})[_0x9cb3('0xae')](function(_0xed6de0){return _0x45f2bf(_0xed6de0);})[_0x9cb3('0xa9')](function(_0x17c3aa){return _0x58ab9c(msgResponse('[CatchErlangB]',_0x9cb3('0x138'),JSON[_0x9cb3('0x49')](_0x17c3aa)));});}if(_0x6451b7[_0x9cb3('0x1c5')]===_0x9cb3('0x1dc')){return _0x2197e9[_0x9cb3('0xbf')](_0x6451b7['id'])[_0x9cb3('0xae')](function(_0x1573a7){var _0x2552b4=_0x6451b7[_0x9cb3('0x154')]-_0x1573a7[0x0][_0x9cb3('0x1da')];var _0x52d224=_0x6451b7[_0x9cb3('0x1c3')]*0x3c;var _0x5532d7=_0x14a5ef[0x0][_0x9cb3('0x68')]+_0x14a5ef[0x0][_0x9cb3('0x84')];var _0x1e9b65=(_0x14a5ef[0x0][_0x9cb3('0x67')]+_0x14a5ef[0x0][_0x9cb3('0x6a')]+_0x14a5ef[0x0][_0x9cb3('0x69')])/_0x14a5ef[0x0][_0x9cb3('0x70')];var _0xf0afb1=_0x6451b7[_0x9cb3('0x1bd')]/0x64;_0x6451b7[_0x9cb3('0x1db')]=_0x1573a7[0x0][_0x9cb3('0x1da')]||0x0;_0x6451b7['predictiveIntervalHitRate']=_0x1e9b65>0x0?_0x1e9b65:0x1;return _0x2197e9[_0x9cb3('0x1d5')](_0x2552b4,_0x52d224,_0x5532d7,_0x1e9b65,_0xf0afb1);})[_0x9cb3('0xae')](function(_0x445348){return _0x45f2bf(_0x445348);})[_0x9cb3('0xa9')](function(_0x34bb73){return _0x58ab9c(msgResponse(_0x9cb3('0x1dd'),_0x9cb3('0x138'),JSON[_0x9cb3('0x49')](_0x34bb73)));});}}else{return _0x58ab9c(msgResponse(_0x9cb3('0x1d6'),_0x9cb3('0x138'),_0x9cb3('0x1d8')));}});};};Dialer[_0x9cb3('0x1a')]['startMethodPredictive']=function(_0x4cbfef){var _0x62685b=this;return function(){var _0x1eb41d=0x0;var _0x17cfff=Math[_0x9cb3('0x1de')](_0x4cbfef[_0x9cb3('0x73')]*0x3e8);if(_0x17cfff>0x0){_0x17cfff=_0x17cfff<0x64?0x64:_0x17cfff;loggerPredictive[_0x9cb3('0x7e')](_0x4cbfef[_0x9cb3('0x3f')],_0x9cb3('0x1df'),_0x17cfff,_0x9cb3('0x4a'));_0x4cbfef['handlePredictive']=setInterval(function(){_0x62685b['handlePredictive'](_0x4cbfef);loggerPredictiveCalls[_0x9cb3('0x7e')](_0x9cb3('0x1e0'),_0x1eb41d+=0x1);},_0x17cfff);}else{loggerPredictive['info'](_0x4cbfef[_0x9cb3('0x3f')],_0x9cb3('0x1e1'));}};};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x1e2')]=function(_0x61e461,_0x51a2ba){var _0x1ee2b7=this;return function(_0x17b482){if(_[_0x9cb3('0x47')](_0x17b482)){if(_['isNil'](_0x51a2ba[_0x9cb3('0x1e3')])||!_0x51a2ba[_0x9cb3('0x1e4')]){if(_0x61e461[_0x9cb3('0x58')]==='booked'){_0x61e461[_0x9cb3('0x122')]=_[_0x9cb3('0x3c')](_0x61e461[_0x9cb3('0x122')])?!![]:_0x61e461[_0x9cb3('0x122')];var _0x3c34e9=uuid['v4']();_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9]=new Action(_0x61e461,_0x51a2ba,_0x3c34e9);loggerBooked[_0x9cb3('0x7e')]('[booked][checkContactBlack]',_0x3c34e9,_0x9cb3('0x1e5'),JSON[_0x9cb3('0x49')](_0x61e461[_0x9cb3('0x122')]),_0x9cb3('0x1e6'),_0x61e461[_0x9cb3('0x3f')]);if(_0x61e461[_0x9cb3('0x122')]){_0x61e461[_0x9cb3('0x122')]=![];_0x1ee2b7[_0x9cb3('0x29')][_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9]['queue']]=[];ami[_0x9cb3('0x144')]({'actionid':_0x3c34e9,'action':_0x9cb3('0x1e7'),'queue':_0x61e461['name']})[_0x9cb3('0xa9')](function(){_0x1ee2b7[_0x9cb3('0xaa')](_0x61e461);_0x1ee2b7[_0x9cb3('0xb8')]({'active':![],'ContactId':_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9][_0x9cb3('0xc9')],'ListId':_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9][_0x9cb3('0xca')],'VoiceQueueId':_0x1ee2b7['actions'][_0x3c34e9][_0x9cb3('0xcb')]||undefined,'CampaignId':_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9]['CampaignId']||undefined})[_0x9cb3('0xa9')](loggerCatch(_0x9cb3('0x1e8')));delete _0x1ee2b7['actions'][_0x3c34e9];});}else{loggerBooked[_0x9cb3('0x7e')](_0x9cb3('0x1e9'),JSON[_0x9cb3('0x49')](_0x61e461[_0x9cb3('0x122')]),_0x9cb3('0x1e6'),_0x61e461[_0x9cb3('0x3f')]);_0x1ee2b7[_0x9cb3('0xaa')](_0x61e461);_0x1ee2b7[_0x9cb3('0xb8')]({'active':![],'ContactId':_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9]['ContactId'],'ListId':_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9][_0x9cb3('0xca')],'VoiceQueueId':_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9]['VoiceQueueId']||undefined,'CampaignId':_0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9][_0x9cb3('0xf8')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1ee2b7[_0x9cb3('0x25')][_0x3c34e9];}}else{return _0x1ee2b7[_0x9cb3('0x15f')](_0x61e461,_0x51a2ba);}}else{if(getDiff(_0x51a2ba[_0x9cb3('0x1ea')])<_0x61e461[_0x9cb3('0x1eb')]*0x3c){if(_0x51a2ba[_0x9cb3('0x1ec')]&&!_0x51a2ba['Agent'][_0x9cb3('0x1ed')]){_0x1ee2b7['preview'][_0x9cb3('0x124')](_0x51a2ba['id'])[_0x9cb3('0x1d')](function(){_0x1ee2b7[_0x9cb3('0xaa')](_0x61e461);});}else{_0x1ee2b7[_0x9cb3('0xba')]({'active':![]},_0x51a2ba['id'],0x1)[_0x9cb3('0x1d')](function(){_0x1ee2b7[_0x9cb3('0xaa')](_0x61e461);});}}else{_0x61e461[_0x9cb3('0x65')]+=0x1;_0x1ee2b7[_0x9cb3('0xaa')](_0x61e461);if(_0x61e461[_0x9cb3('0x1ee')]){_0x1ee2b7[_0x9cb3('0xb8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x51a2ba['ContactId'],'ListId':_0x51a2ba[_0x9cb3('0xca')],'VoiceQueueId':_0x51a2ba['VoiceQueueId']||undefined,'CampaignId':_0x51a2ba[_0x9cb3('0xf8')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1ee2b7[_0x9cb3('0xc2')](createObjHistory(_0x61e461,_0x51a2ba,_0x9cb3('0x1ef'),0x17,_0x9cb3('0x1f0')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x1ee2b7[_0x9cb3('0xc7')](createObjHistory(_0x61e461,_0x51a2ba,_0x9cb3('0x1f1'),0x16,'RecallFailedTimeout'),_0x9cb3('0x1f2'),_0x9cb3('0x1f3'));}}}}else{_0x61e461[_0x9cb3('0x5d')]+=0x1;_0x1ee2b7['saveInDb'](createObjHistory(_0x61e461,_0x51a2ba,'BLACKLIST',0xd,_0x9cb3('0x1f4')),_0x9cb3('0x1f5'),_0x9cb3('0x1f6'));throw _0x9cb3('0x1f7');}};};Dialer[_0x9cb3('0x1a')]['handleIvr']=function(_0x4d2287){var _0xace077=this;var _0x1518d9=_0x4d2287[_0x9cb3('0x1f8')]-_0x4d2287['originated']-_0x4d2287[_0x9cb3('0xbc')];emitCampaignSummary(_0x4d2287);if(_0x1518d9>0x0){if(_0x1518d9>this[_0x9cb3('0x23')]){_0x1518d9=this[_0x9cb3('0x23')];}_0x4d2287[_0x9cb3('0xbc')]+=_0x1518d9;this[_0x9cb3('0xbd')](_0x4d2287['id'],_0x1518d9,_0x4d2287['dialOrderByScheduledAt'],_0x4d2287)['then'](function(_0x55468b){_0x4d2287['temp']-=_0x1518d9;_0x4d2287[_0x9cb3('0xbc')]=_0x4d2287['temp']>0x0?_0x4d2287[_0x9cb3('0xbc')]:0x0;if(!checkContactEmpty(_0x55468b)){_0x4d2287[_0x9cb3('0x3d')]=_0x9cb3('0x9a');logger[_0x9cb3('0x7e')](_0x9cb3('0x1f9')+_0x4d2287[_0x9cb3('0x3f')]);}else{_0x4d2287[_0x9cb3('0x71')]+=_0x55468b[_0x9cb3('0x95')];_0x4d2287[_0x9cb3('0x3d')]=_0x9cb3('0x1fa');for(var _0x9b1de0=0x0;_0x9b1de0<_0x55468b[_0x9cb3('0x95')];_0x9b1de0+=0x1){_0x4d2287[_0x9cb3('0x1fb')]+=0x1;if(_['isNil'](_0x55468b[_0x9b1de0])||_[_0x9cb3('0xa7')](_0x55468b[_0x9b1de0][_0x9cb3('0x162')])||_['isNil'](_0x55468b[_0x9b1de0][_0x9cb3('0x162')]['phone'])){_0xace077[_0x9cb3('0x1fc')](_0x9cb3('0x1fd'),_0x4d2287,_0x55468b[_0x9b1de0]);}else{_0xace077['checkIsBlackListIvr'](_['pick'](_0x55468b[_0x9b1de0],[_0x9cb3('0xf8'),'Contact.phone']))[_0x9cb3('0xae')](_0xace077[_0x9cb3('0x1e2')](_0x4d2287,_0x55468b[_0x9b1de0]))[_0x9cb3('0xa9')](_0xace077[_0x9cb3('0xc5')](_0x9cb3('0x1fe'),_0x4d2287));}}}})[_0x9cb3('0xa9')](loggerGetContactDialer(_0x9cb3('0x1ff'),_0x4d2287,_0x1518d9));}};Dialer['prototype'][_0x9cb3('0x14d')]=function(_0x116e9c,_0x20db20){var _0x20d4e2=this;var _0x50ade3=[];var _0x3745bf=_0x20db20>=0x1?_0x20db20:0x1;if(_0x116e9c[_0x9cb3('0x58')]==='booked'){_0x3745bf=0x1;}var _0x17de83=Math['floor'](_0x116e9c[_0x9cb3('0x1c0')]*_0x3745bf)-_0x116e9c[_0x9cb3('0x71')]-_0x116e9c[_0x9cb3('0xbc')];emitVoiceQueueSummary(_0x116e9c);if(_0x116e9c[_0x9cb3('0x200')]>0x0){var _0x7076e9=_0x116e9c[_0x9cb3('0x200')]-_0x116e9c[_0x9cb3('0x71')]-_0x116e9c['talking']-_0x116e9c[_0x9cb3('0xbc')]-_0x116e9c[_0x9cb3('0x51')];if(_0x17de83>_0x7076e9){_0x17de83=_0x7076e9;}}if(_0x17de83>0x0){if(_0x116e9c[_0x9cb3('0x58')]==='booked'){_0x17de83=0x1;}if(_0x17de83>this[_0x9cb3('0x23')]){_0x17de83=this[_0x9cb3('0x23')];}_0x116e9c[_0x9cb3('0xbc')]+=_0x17de83;for(var _0x4e1f1b in this[_0x9cb3('0x21')]){if(typeof this['agents'][_0x4e1f1b]!==_0x9cb3('0xa5')){if(this[_0x9cb3('0x21')][_0x4e1f1b]['state']===_0x9cb3('0x201')&&this[_0x9cb3('0x21')][_0x4e1f1b][_0x9cb3('0xd1')]===_0x9cb3('0xd0')){_0x50ade3['push'](this[_0x9cb3('0x21')][_0x4e1f1b]['id']);}}}this[_0x9cb3('0xbb')](_0x116e9c['id'],_0x50ade3,_0x17de83,_0x116e9c[_0x9cb3('0x202')],_0x116e9c)[_0x9cb3('0xae')](function(_0x4e06d1){_0x116e9c[_0x9cb3('0xbc')]-=_0x17de83;_0x116e9c[_0x9cb3('0xbc')]=_0x116e9c[_0x9cb3('0xbc')]>0x0?_0x116e9c[_0x9cb3('0xbc')]:0x0;if(!checkContactEmpty(_0x4e06d1)){_0x20d4e2[_0x9cb3('0xad')](_0x116e9c)['then'](sendMessageReschedule(_0x116e9c))['catch'](loggerCatch(_0x9cb3('0xaf')));}else{_0x116e9c[_0x9cb3('0x71')]+=_0x4e06d1[_0x9cb3('0x95')];_0x116e9c['message']=_0x116e9c[_0x9cb3('0x58')]==='booked'?_0x9cb3('0x16a'):_0x9cb3('0x1fa');for(var _0x40ca56=0x0;_0x40ca56<_0x4e06d1[_0x9cb3('0x95')];_0x40ca56+=0x1){if(_[_0x9cb3('0xa7')](_0x4e06d1[_0x40ca56])||_[_0x9cb3('0xa7')](_0x4e06d1[_0x40ca56][_0x9cb3('0x162')])||_[_0x9cb3('0xa7')](_0x4e06d1[_0x40ca56]['Contact']['phone'])){_0x20d4e2[_0x9cb3('0x1fc')](_0x9cb3('0x1fd'),_0x116e9c,_0x4e06d1[_0x40ca56]);}else{_0x20d4e2['checkIsBlackList'](_[_0x9cb3('0xc8')](_0x4e06d1[_0x40ca56],[_0x9cb3('0xcb'),'Contact.phone']))['then'](_0x20d4e2[_0x9cb3('0x1e2')](_0x116e9c,_0x4e06d1[_0x40ca56]))['catch'](_0x20d4e2['loggerHandler'](_0x9cb3('0x1fd'),_0x116e9c));}}}})[_0x9cb3('0xa9')](loggerGetContactDialer(_0x9cb3('0x203'),_0x116e9c,_0x17de83));}};Dialer['prototype']['handlePredictive']=function(_0x4d68ae){if(_0x4d68ae[_0x9cb3('0x200')]>0x0){var _0x5242b7=_0x4d68ae[_0x9cb3('0x200')]-_0x4d68ae[_0x9cb3('0x71')]-_0x4d68ae[_0x9cb3('0x54')];if(_0x5242b7>0x0){this[_0x9cb3('0x204')](_0x4d68ae);}else{loggerPredictiveCalls[_0x9cb3('0x7e')](_0x9cb3('0x205'));}}else{this[_0x9cb3('0x204')](_0x4d68ae);}};Dialer['prototype'][_0x9cb3('0x204')]=function(_0x1e22f1){var _0x7919ec=this;var _0x347465=[];_0x1e22f1[_0x9cb3('0x71')]+=0x1;for(var _0x5c55b7 in this[_0x9cb3('0x21')]){if(typeof this[_0x9cb3('0x21')][_0x5c55b7]!==_0x9cb3('0xa5')){if(this[_0x9cb3('0x21')][_0x5c55b7][_0x9cb3('0xe4')]===_0x9cb3('0x201')&&this[_0x9cb3('0x21')][_0x5c55b7][_0x9cb3('0xd1')]===_0x9cb3('0xd0')){_0x347465[_0x9cb3('0x11f')](this[_0x9cb3('0x21')][_0x5c55b7]['id']);}}}this['getContactDialer'](_0x1e22f1['id'],_0x347465,0x1,_0x1e22f1['dialOrderByScheduledAt'],_0x1e22f1)[_0x9cb3('0xae')](function(_0x284b9e){if(!checkContactEmpty(_0x284b9e)){checkContactLowerLimitOriginate(_0x1e22f1,0x1,0x0);_0x7919ec['countReScheduled'](_0x1e22f1)['then'](sendMessageReschedule(_0x1e22f1))[_0x9cb3('0xa9')](loggerCatch('[countReScheduled]\x20'));}else{_0x1e22f1['message']=_0x9cb3('0x1fa');if(_[_0x9cb3('0xa7')](_0x284b9e[0x0])||_[_0x9cb3('0xa7')](_0x284b9e[0x0][_0x9cb3('0x162')])||_[_0x9cb3('0xa7')](_0x284b9e[0x0][_0x9cb3('0x162')][_0x9cb3('0x184')])){_0x7919ec[_0x9cb3('0x1fc')](_0x9cb3('0x1fd'),_0x1e22f1,_0x284b9e[0x0]);}else{_0x7919ec[_0x9cb3('0xb0')](_[_0x9cb3('0xc8')](_0x284b9e[0x0],['VoiceQueueId',_0x9cb3('0x206')]))['then'](_0x7919ec['checkContactBlack'](_0x1e22f1,_0x284b9e[0x0]))[_0x9cb3('0xa9')](_0x7919ec[_0x9cb3('0xc5')]('[actionOriginatePredictive]\x20',_0x1e22f1));}}})[_0x9cb3('0xa9')](loggerGetContactDialer(_0x9cb3('0x207'),_0x1e22f1,0x1));emitVoiceQueueSummary(_0x1e22f1);};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x1d4')]=function(_0x4df107,_0xe0f3f,_0x18d3bd,_0x45e633,_0x40d1a9,_0x1b1e93){loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x208'));loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x209'),_0x4df107);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x20a'),_0xe0f3f);loggerPredictive['info'](_0x9cb3('0x20b'),_0x18d3bd);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x20c'),_0x45e633);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x20d'),_0x40d1a9);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x85'));return new BPromise(function(_0x216bf5,_0x311166){if(_0x4df107<=0x0||isNaN(_0x4df107)){return _0x311166(msgResponse(_0x9cb3('0x20e'),_0x9cb3('0x18c'),_0x9cb3('0x20f')+_0x4df107));}if(_0x18d3bd<=0x0||isNaN(_0x18d3bd)){return _0x311166(msgResponse(_0x9cb3('0x20e'),_0x9cb3('0x18c'),'Ts\x20=\x20'+_0x18d3bd));}if(_0x45e633<=0x0||isNaN(_0x45e633)){return _0x311166(msgResponse(_0x9cb3('0x20e'),_0x9cb3('0x18c'),_0x9cb3('0x210')+_0x45e633));}if(_0xe0f3f<=0x0||isNaN(_0xe0f3f)){return _0x311166(msgResponse('[abandonmentRate]',_0x9cb3('0x18c'),'interval\x20=\x20'+_0xe0f3f));}if(_0x40d1a9<=0x0||isNaN(_0x40d1a9)){return _0x311166(msgResponse('[abandonmentRate]','Error',_0x9cb3('0x211')+_0x40d1a9));}_0x1b1e93=_0x1b1e93||0x0;var _0x357f93=0x1/_0x18d3bd;var _0x56f5c7=0x0;var _0x598bba=0x0;var _0x108b6f=0x0;var _0x1f9e03=0x0;for(var _0x5abc9b=0x0;_0x108b6f<_0x40d1a9;_0x5abc9b+=0x1){_0x598bba=_0x5abc9b/_0xe0f3f;_0x56f5c7=(_0x45e633*_0x598bba+_0x1b1e93)/_0x357f93;_0x108b6f=erlangb(_0x56f5c7,_0x4df107);_0x1f9e03=_0x56f5c7/_0x4df107*(0x1-erlangb(_0x56f5c7,_0x4df107));}return _0x216bf5({'erlangCalls':_0x5abc9b,'erlangCallToSecond':_0xe0f3f/_0x5abc9b,'erlangAbandonmentRate':_0x108b6f,'erlangBusyFactor':_0x1f9e03});});};Dialer[_0x9cb3('0x1a')][_0x9cb3('0x1d5')]=function(_0x1bd325,_0x37d785,_0x20e6dc,_0x4f8a41,_0xd038e2,_0x2d5d09){loggerPredictive['info'](_0x9cb3('0x212'));loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x209'),_0x1bd325);loggerPredictive[_0x9cb3('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37d785);loggerPredictive['info'](_0x9cb3('0x20b'),_0x20e6dc);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x20c'),_0x4f8a41);loggerPredictive[_0x9cb3('0x7e')](_0x9cb3('0x213'),_0xd038e2);loggerPredictive[_0x9cb3('0x7e')]('---------------------------');return new BPromise(function(_0x1985a9,_0x57442f){if(_0x1bd325<=0x0||isNaN(_0x1bd325)){return _0x57442f(msgResponse(_0x9cb3('0x214'),_0x9cb3('0x18c'),_0x9cb3('0x20f')+_0x1bd325));}if(_0x20e6dc<=0x0||isNaN(_0x20e6dc)){return _0x57442f(msgResponse(_0x9cb3('0x214'),_0x9cb3('0x18c'),_0x9cb3('0x215')+_0x20e6dc));}if(_0x4f8a41<=0x0||isNaN(_0x4f8a41)){return _0x57442f(msgResponse(_0x9cb3('0x214'),_0x9cb3('0x18c'),_0x9cb3('0x210')+_0x4f8a41));}if(_0x37d785<=0x0||isNaN(_0x37d785)){return _0x57442f(msgResponse(_0x9cb3('0x214'),_0x9cb3('0x18c'),_0x9cb3('0x216')+_0x37d785));}if(_0xd038e2<=0x0||isNaN(_0xd038e2)){return _0x57442f(msgResponse(_0x9cb3('0x214'),'Error',_0x9cb3('0x217')+_0xd038e2));}_0x2d5d09=_0x2d5d09||0x0;var _0x2e6f45=0x1/_0x20e6dc;var _0x2e9d63=0x0;var _0x10eb8f=0x0;var _0x56156d=0x0;var _0x142c8a=0x0;for(var _0x5b39e7=0x0;_0x142c8a<_0xd038e2;_0x5b39e7+=0x1){_0x10eb8f=_0x5b39e7/_0x37d785;_0x2e9d63=(_0x4f8a41*_0x10eb8f+_0x2d5d09)/_0x2e6f45;_0x56156d=erlangb(_0x2e9d63,_0x1bd325);_0x142c8a=_0x2e9d63/_0x1bd325*(0x1-erlangb(_0x2e9d63,_0x1bd325));}return _0x1985a9({'erlangCalls':_0x5b39e7,'erlangCallToSecond':_0x37d785/_0x5b39e7,'erlangAbandonmentRate':_0x56156d,'erlangBusyFactor':_0x142c8a});});};module[_0x9cb3('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 66bdb6d..d132477 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c45=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x1c45,0x8c));var _0x51c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c45[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x51c4('0x0'));var _=require(_0x51c4('0x1'));var moment=require(_0x51c4('0x2'));function getSeconds(_0xf065ae,_0x483c8c){var _0x4cac0e=moment(_0xf065ae)['milliseconds'](0x0);var _0x286338=moment(_0x483c8c)[_0x51c4('0x3')](0x0);return _0x4cac0e[_0x51c4('0x4')](_0x286338,_0x51c4('0x5'));}function QueueCallerAbandon(_0x120b73,_0x14717b){this[_0x51c4('0x6')]=_0x120b73[_0x51c4('0x6')];this[_0x51c4('0x7')]=_0x120b73[_0x51c4('0x7')];this[_0x51c4('0x8')]=_0x120b73['type']===_0x51c4('0x9')?_0x51c4('0xa'):_0x120b73[_0x51c4('0x7')];this[_0x51c4('0xb')]=_0x120b73['countbusyretry'];this[_0x51c4('0xc')]=_0x120b73['countcongestionretry'];this[_0x51c4('0xd')]=_0x120b73['countnoanswerretry'];this[_0x51c4('0xe')]=_0x120b73['countbusyretry']+_0x120b73[_0x51c4('0xc')]+_0x120b73['countnoanswerretry']+_0x120b73['countnosuchnumberretry']+_0x120b73[_0x51c4('0xf')]+_0x120b73[_0x51c4('0x10')]+_0x120b73[_0x51c4('0x11')]+_0x120b73[_0x51c4('0x12')];this[_0x51c4('0x13')]=_0x120b73[_0x51c4('0x13')];this[_0x51c4('0xf')]=_0x120b73[_0x51c4('0xf')];this['countabandonedretry']=_0x120b73[_0x51c4('0x10')];this[_0x51c4('0x11')]=_0x120b73[_0x51c4('0x11')];this[_0x51c4('0x12')]=_0x120b73['countagentrejectretry'];this[_0x51c4('0x14')]=_0x14717b[_0x51c4('0x14')];this[_0x51c4('0x15')]=_0x120b73[_0x51c4('0x16')];this['calleridnum']=_0x120b73[_0x51c4('0x17')];this['starttime']=_0x120b73[_0x51c4('0x18')];this[_0x51c4('0x19')]=_0x120b73['responsetime'];this[_0x51c4('0x1a')]=_0x120b73['droptime'];this[_0x51c4('0x1b')]=this['droptime'];this['ringtime']=getSeconds(_0x120b73[_0x51c4('0x19')],_0x120b73[_0x51c4('0x18')]);this['holdtime']=getSeconds(this[_0x51c4('0x1a')],_0x120b73[_0x51c4('0x19')]);this[_0x51c4('0x1c')]=0x0;this['queue']=_0x14717b[_0x51c4('0xa')];this[_0x51c4('0x1d')]=_0x14717b[_0x51c4('0x1e')];this[_0x51c4('0x1f')]=_0x14717b[_0x51c4('0x1f')];this[_0x51c4('0x20')]=_0x120b73[_0x51c4('0x20')];this['callbackuniqueid']=_0x120b73[_0x51c4('0x21')];this[_0x51c4('0x22')]=_0x120b73[_0x51c4('0x22')];this[_0x51c4('0x23')]=_0x120b73[_0x51c4('0x23')];this[_0x51c4('0x24')]=_0x120b73[_0x51c4('0x24')];this[_0x51c4('0x25')]=_0x120b73[_0x51c4('0x25')];this[_0x51c4('0x26')]=_0x120b73[_0x51c4('0x26')];this[_0x51c4('0x27')]=_0x120b73[_0x51c4('0x27')];this['CampaignId']=_0x120b73['CampaignId'];this[_0x51c4('0x28')]=_0x120b73['originatecalleridnum']||'';this['originatecalleridname']=_0x120b73['originatecalleridname']||'';}module[_0x51c4('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x5bea=['starttime','responsetime','droptime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0x5bea,0x141));var _0xa5be=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5bea[_0x27af45];return _0x18df21;};'use strict';var util=require('util');var _=require(_0xa5be('0x0'));var moment=require(_0xa5be('0x1'));function getSeconds(_0x5d21b8,_0x234e4f){var _0x7041f9=moment(_0x5d21b8)[_0xa5be('0x2')](0x0);var _0x55ab12=moment(_0x234e4f)[_0xa5be('0x2')](0x0);return _0x7041f9[_0xa5be('0x3')](_0x55ab12,_0xa5be('0x4'));}function QueueCallerAbandon(_0x4dcc39,_0x3142bd){this[_0xa5be('0x5')]=_0x4dcc39[_0xa5be('0x5')];this['type']=_0x4dcc39['type'];this['campaigntype']=_0x4dcc39[_0xa5be('0x6')]===_0xa5be('0x7')?'queue':_0x4dcc39[_0xa5be('0x6')];this['countbusyretry']=_0x4dcc39[_0xa5be('0x8')];this['countcongestionretry']=_0x4dcc39[_0xa5be('0x9')];this['countnoanswerretry']=_0x4dcc39['countnoanswerretry'];this[_0xa5be('0xa')]=_0x4dcc39[_0xa5be('0x8')]+_0x4dcc39['countcongestionretry']+_0x4dcc39[_0xa5be('0xb')]+_0x4dcc39['countnosuchnumberretry']+_0x4dcc39[_0xa5be('0xc')]+_0x4dcc39[_0xa5be('0xd')]+_0x4dcc39[_0xa5be('0xe')]+_0x4dcc39[_0xa5be('0xf')];this[_0xa5be('0x10')]=_0x4dcc39['countnosuchnumberretry'];this[_0xa5be('0xc')]=_0x4dcc39[_0xa5be('0xc')];this['countabandonedretry']=_0x4dcc39['countabandonedretry'];this[_0xa5be('0xe')]=_0x4dcc39['countmachineretry'];this[_0xa5be('0xf')]=_0x4dcc39[_0xa5be('0xf')];this['uniqueid']=_0x3142bd[_0xa5be('0x11')];this[_0xa5be('0x12')]=_0x4dcc39['name'];this[_0xa5be('0x13')]=_0x4dcc39[_0xa5be('0x14')];this['starttime']=_0x4dcc39[_0xa5be('0x15')];this[_0xa5be('0x16')]=_0x4dcc39[_0xa5be('0x16')];this[_0xa5be('0x17')]=_0x4dcc39['droptime'];this['endtime']=this[_0xa5be('0x17')];this['ringtime']=getSeconds(_0x4dcc39[_0xa5be('0x16')],_0x4dcc39[_0xa5be('0x15')]);this['holdtime']=getSeconds(this[_0xa5be('0x17')],_0x4dcc39[_0xa5be('0x16')]);this[_0xa5be('0x18')]=0x0;this[_0xa5be('0x19')]=_0x3142bd['queue'];this['membername']=_0x3142bd[_0xa5be('0x1a')];this[_0xa5be('0x1b')]=_0x3142bd['reason'];this[_0xa5be('0x1c')]=_0x4dcc39[_0xa5be('0x1c')];this[_0xa5be('0x1d')]=_0x4dcc39[_0xa5be('0x1d')];this[_0xa5be('0x1e')]=_0x4dcc39[_0xa5be('0x1e')];this['recallme']=_0x4dcc39[_0xa5be('0x1f')];this[_0xa5be('0x20')]=_0x4dcc39['ContactId'];this['ListId']=_0x4dcc39['ListId'];this['UserId']=_0x4dcc39[_0xa5be('0x21')];this[_0xa5be('0x22')]=_0x4dcc39[_0xa5be('0x22')];this[_0xa5be('0x23')]=_0x4dcc39['CampaignId'];this[_0xa5be('0x24')]=_0x4dcc39[_0xa5be('0x24')]||'';this[_0xa5be('0x25')]=_0x4dcc39[_0xa5be('0x25')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8b59fc0..bb0080f 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(_0x2e07ee,_0x1523b5){var _0x2a967c=function(_0x3e5c02){while(--_0x3e5c02){_0x2e07ee['push'](_0x2e07ee['shift']());}};_0x2a967c(++_0x1523b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x5991c3,_0x24ee71){var _0x5ec968=function(_0x3ccd95){while(--_0x3ccd95){_0x5991c3['push'](_0x5991c3['shift']());}};_0x5ec968(++_0x24ee71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ba322f2..89bd2b1 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 _0xe1e3=['syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','syncVarSet','variable','value','syncNewState','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','notify','.pdf','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','syncNewchannel','bind','varset','receivefax','syncReceiveFax'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x3594ad,_0x17b40d){_0x3594ad=_0x3594ad-0x0;var _0x2e2715=_0xe1e3[_0x3594ad];return _0x2e2715;};'use strict';var util=require(_0x3e1e('0x0'));var _=require(_0x3e1e('0x1'));var BPromise=require('bluebird');var uuid=require(_0x3e1e('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x3e1e('0x3'));var gs=require('./util/gs');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var ami=require(_0x3e1e('0x6'));var rpcDb=require(_0x3e1e('0x7'));var Channel=require(_0x3e1e('0x8'));var ut=require(_0x3e1e('0x9'));var Action=require('./action');var faxAccount=require(_0x3e1e('0xa'));var attachment=require(_0x3e1e('0xb'));var faxMessage=require(_0x3e1e('0xc'));function Fax(_0xa67e35){this[_0x3e1e('0xd')]={};this[_0x3e1e('0xe')]=_0xa67e35['faxAccounts'];this['trunks']=_0xa67e35['trunks'];this[_0x3e1e('0xf')]={};ami['on']('newchannel',this[_0x3e1e('0x10')][_0x3e1e('0x11')](this));ami['on'](_0x3e1e('0x12'),this['syncVarSet'][_0x3e1e('0x11')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x3e1e('0x11')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x3e1e('0x11')](this));ami['on'](_0x3e1e('0x13'),this[_0x3e1e('0x14')]['bind'](this));ami['on']('hangup',this[_0x3e1e('0x15')][_0x3e1e('0x11')](this));ami['on']('originateresponse',this[_0x3e1e('0x16')][_0x3e1e('0x11')](this));}Fax['prototype'][_0x3e1e('0x10')]=function(_0x4d0feb){if(_0x4d0feb[_0x3e1e('0x17')]===_0x3e1e('0x18')){for(var _0x1d786c in this[_0x3e1e('0xe')]){if(this[_0x3e1e('0xe')][_0x3e1e('0x19')](_0x1d786c)){if(_0x4d0feb['exten']===this['faxAccounts'][_0x1d786c]['localstationid']){this[_0x3e1e('0xd')][_0x4d0feb[_0x3e1e('0x1a')]]={};this[_0x3e1e('0xd')][_0x4d0feb['uniqueid']][_0x3e1e('0x1b')]=_0x4d0feb['channel'];this[_0x3e1e('0xd')][_0x4d0feb[_0x3e1e('0x1a')]]['id']=this[_0x3e1e('0xe')][_0x1d786c]['id'];this['channels'][_0x4d0feb[_0x3e1e('0x1a')]][_0x3e1e('0x1c')]=this[_0x3e1e('0xe')][_0x1d786c]['name'];logger['info'](_0x4d0feb[_0x3e1e('0x1a')],_0x3e1e('0x1d'));}}}}if(this['actions'][_0x4d0feb[_0x3e1e('0x1a')]]){this[_0x3e1e('0xd')][_0x4d0feb[_0x3e1e('0x1a')]]={};this[_0x3e1e('0xd')][_0x4d0feb[_0x3e1e('0x1a')]][_0x3e1e('0x1b')]=_0x4d0feb[_0x3e1e('0x1b')];logger[_0x3e1e('0x1e')](_0x4d0feb['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x3e1e('0x1f')][_0x3e1e('0x20')]=function(_0x55db8f){if(this['channels'][_0x55db8f['uniqueid']]){for(var _0x1a33bb in _0x55db8f[_0x3e1e('0x21')]){if(_0x55db8f['variable'][_0x3e1e('0x19')](_0x1a33bb)){this['channels'][_0x55db8f[_0x3e1e('0x1a')]][_0x1a33bb]=_0x55db8f[_0x3e1e('0x22')];}}}};Fax['prototype'][_0x3e1e('0x23')]=function(_0x210a84){if(this[_0x3e1e('0xd')][_0x210a84['uniqueid']]){this[_0x3e1e('0xd')][_0x210a84['uniqueid']]['channelstate']=_0x210a84['channelstate'];this[_0x3e1e('0xd')][_0x210a84['uniqueid']]['channelstatedesc']=_0x210a84[_0x3e1e('0x24')];}};Fax[_0x3e1e('0x1f')][_0x3e1e('0x25')]=function(_0x233b18){if(this[_0x3e1e('0xd')][_0x233b18['uniqueid']]){for(var _0x5522ba in _0x233b18['variable']){if(_0x233b18['variable'][_0x3e1e('0x19')](_0x5522ba)){this[_0x3e1e('0xd')][_0x233b18[_0x3e1e('0x1a')]][_0x5522ba]=_0x233b18[_0x3e1e('0x22')];}}}};Fax[_0x3e1e('0x1f')][_0x3e1e('0x26')]=function(_0x135d83){if(this[_0x3e1e('0xd')][_0x135d83['uniqueid']]){this[_0x3e1e('0xd')][_0x135d83[_0x3e1e('0x1a')]]['operation']=_0x135d83[_0x3e1e('0x27')];this[_0x3e1e('0xd')][_0x135d83[_0x3e1e('0x1a')]][_0x3e1e('0x28')]=_0x135d83['status'];this['channels'][_0x135d83[_0x3e1e('0x1a')]][_0x3e1e('0x29')]=_0x135d83['localstationid'];this[_0x3e1e('0xd')][_0x135d83[_0x3e1e('0x1a')]]['filename']=_0x135d83[_0x3e1e('0x2a')];logger[_0x3e1e('0x1e')](_0x135d83[_0x3e1e('0x1a')],_0x3e1e('0x2b'));}};Fax[_0x3e1e('0x1f')]['syncReceiveFax']=function(_0x1da527){var _0x42556a=this;if(this[_0x3e1e('0xd')][_0x1da527[_0x3e1e('0x1a')]]){var _0x51d779=this[_0x3e1e('0xd')][_0x1da527[_0x3e1e('0x1a')]]['id'];this[_0x3e1e('0xd')][_0x1da527[_0x3e1e('0x1a')]][_0x3e1e('0x2c')]=_0x1da527[_0x3e1e('0x2c')];this[_0x3e1e('0xd')][_0x1da527['uniqueid']][_0x3e1e('0x2d')]=_0x1da527['pagestransferred'];this['channels'][_0x1da527[_0x3e1e('0x1a')]][_0x3e1e('0x29')]=_0x1da527[_0x3e1e('0x29')];this['channels'][_0x1da527[_0x3e1e('0x1a')]][_0x3e1e('0x2e')]=_0x1da527['resolution'];this[_0x3e1e('0xd')][_0x1da527[_0x3e1e('0x1a')]]['transferrate']=_0x1da527['transferrate'];this[_0x3e1e('0xd')][_0x1da527['uniqueid']]['filename']=_0x1da527[_0x3e1e('0x2a')];this[_0x3e1e('0xd')][_0x1da527[_0x3e1e('0x1a')]][_0x3e1e('0x2f')]=_0x1da527[_0x3e1e('0x2f')];if(this['channels'][_0x1da527['uniqueid']][_0x3e1e('0x2d')]>0x0){tiff2pdf(_0x1da527[_0x3e1e('0x2a')],_0x3e1e('0x30'),function(_0x52e227){logger[_0x3e1e('0x1e')](_0x1da527[_0x3e1e('0x1a')],_0x3e1e('0x31'),_0x52e227['message']);attachment[_0x3e1e('0x32')]({'name':path['parse'](_0x1da527['filename'])[_0x3e1e('0x1c')],'basename':path[_0x3e1e('0x33')](_0x1da527[_0x3e1e('0x2a')])[_0x3e1e('0x1c')]+'.pdf','type':'application/pdf'})['then'](function(_0x593996){faxAccount[_0x3e1e('0x34')](_0x51d779,{'from':_0x1da527[_0x3e1e('0x2f')],'mapKey':'fax','body':path['parse'](_0x1da527[_0x3e1e('0x2a')])[_0x3e1e('0x1c')]+_0x3e1e('0x35'),'AttachmentId':_0x593996['id']})['catch'](function(_0x30f1d0){logger['error'](_0x1da527[_0x3e1e('0x1a')],_0x3e1e('0x36'),JSON[_0x3e1e('0x37')](_0x30f1d0));});})[_0x3e1e('0x38')](function(_0x28338a){logger[_0x3e1e('0x39')](_0x1da527['uniqueid'],_0x3e1e('0x3a'),JSON[_0x3e1e('0x37')](_0x28338a));});});}logger['info'](_0x1da527[_0x3e1e('0x1a')],_0x3e1e('0x3a'));}};Fax['prototype'][_0x3e1e('0x16')]=function(_0x347b3f){if(this[_0x3e1e('0xf')][_0x347b3f[_0x3e1e('0x1a')]]){_['merge'](this[_0x3e1e('0xd')][_0x347b3f[_0x3e1e('0x1a')]],_[_0x3e1e('0x3b')](_0x347b3f,[_0x3e1e('0x3c'),'reason']));}};function updateStatus(_0xbeaf39){if(_0xbeaf39[_0x3e1e('0x3d')]){faxMessage[_0x3e1e('0x3e')](_0xbeaf39[_0x3e1e('0x3d')],{'failMessage':_0x3e1e('0x3f')})[_0x3e1e('0x40')](function(_0x2d1fe9){ut[_0x3e1e('0x41')]('[Fax][Message][Error][Updated]',_0x2d1fe9);})[_0x3e1e('0x38')](function(_0x48b5e7){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x48b5e7);});}else{ut[_0x3e1e('0x41')](_0x3e1e('0x42'));}}Fax['prototype'][_0x3e1e('0x43')]=function(_0x592733,_0x5b2416,_0x3eaf76){var _0x58d425=this;var _0x56f69f={};if(_0x5b2416){_0x56f69f={'read':_0x5b2416};}else{_0x56f69f={'failMessage':_0x3eaf76};}if(this['actions'][_0x592733][_0x3e1e('0x3d')]){faxMessage[_0x3e1e('0x3e')](this[_0x3e1e('0xf')][_0x592733][_0x3e1e('0x3d')],_0x56f69f)[_0x3e1e('0x40')](function(_0xe18f8a){ut[_0x3e1e('0x41')]('[Fax][Message][Updated]',_0xe18f8a);})[_0x3e1e('0x38')](function(_0x5f5587){ut[_0x3e1e('0x41')](_0x3e1e('0x44'),_0x5f5587);})[_0x3e1e('0x45')](function(){delete _0x58d425['channels'][_0x592733];delete _0x58d425['actions'][_0x592733];});}else{ut[_0x3e1e('0x41')](_0x3e1e('0x46'));delete this['channels'][_0x592733];delete this[_0x3e1e('0xf')][_0x592733];}};Fax['prototype']['syncHangup']=function(_0x284cc7){var _0x3451ed=this;if(this['channels'][_0x284cc7[_0x3e1e('0x1a')]]){if(this['actions'][_0x284cc7['uniqueid']]){this[_0x3e1e('0xd')][_0x284cc7['uniqueid']]['id']=this[_0x3e1e('0xf')][_0x284cc7['uniqueid']]['id'];this[_0x3e1e('0xd')][_0x284cc7['uniqueid']][_0x3e1e('0x1c')]=this[_0x3e1e('0xf')][_0x284cc7['uniqueid']]['name'];}logger['info'](_0x284cc7[_0x3e1e('0x1a')],this[_0x3e1e('0xf')][_0x284cc7[_0x3e1e('0x1a')]]?'\x20hangup\x20sendFile\x20':_0x3e1e('0x47'),JSON[_0x3e1e('0x37')](this[_0x3e1e('0xd')][_0x284cc7['uniqueid']]));if(this['actions'][_0x284cc7[_0x3e1e('0x1a')]]){if(this['channels'][_0x284cc7[_0x3e1e('0x1a')]][_0x3e1e('0x48')]>0x0&&this[_0x3e1e('0xd')][_0x284cc7['uniqueid']][_0x3e1e('0x49')]==='SUCCESS'){this[_0x3e1e('0x43')](_0x284cc7[_0x3e1e('0x1a')],!![]);}else{this['updateStatus'](_0x284cc7[_0x3e1e('0x1a')],![],this['channels'][_0x284cc7[_0x3e1e('0x1a')]]['faxstatusstring']?_0x3e1e('0x4a')+this['channels'][_0x284cc7[_0x3e1e('0x1a')]][_0x3e1e('0x4b')]:_0x3e1e('0x4c'));}}}};Fax['prototype'][_0x3e1e('0x4d')]=function(_0x1fbcfc){var _0x4e6957=this;return new BPromise(function(_0x238ce0,_0x583535){_0x4e6957['execOriginate'](_0x1fbcfc,_0x4e6957['faxAccounts'][_0x1fbcfc[_0x3e1e('0x4e')]])[_0x3e1e('0x40')](function(_0x384ee6){ut[_0x3e1e('0x41')](_0x3e1e('0x4f'),_0x384ee6);_0x238ce0(ut[_0x3e1e('0x50')](_0x3e1e('0x51')));})['catch'](function(_0x30830d){ut[_0x3e1e('0x41')](_0x3e1e('0x52'),_0x30830d);updateStatus(_0x1fbcfc);_0x583535(ut[_0x3e1e('0x50')](_0x3e1e('0x53')));});});};Fax[_0x3e1e('0x1f')][_0x3e1e('0x54')]=function(_0x4314d3){var _0x4c3d6b=this;return new BPromise(function(_0x580192,_0x3d26b2){var _0x27c3d2=_0x4c3d6b[_0x3e1e('0x55')](_0x4c3d6b[_0x3e1e('0xe')][_0x4314d3[_0x3e1e('0x4e')]][_0x3e1e('0x56')],_0x4314d3);if(_0x27c3d2[_0x3e1e('0x57')]){_0x580192(ut[_0x3e1e('0x50')](_0x3e1e('0x58')));}else{_0x3d26b2(ut[_0x3e1e('0x50')](_0x27c3d2[_0x3e1e('0x50')]));}});};function originate(_0x50ba57,_0x5e148e,_0x5581ee){return new BPromise(function(_0x20bc4d,_0x29ddc4){if(_0x5581ee){var _0x477e64=util[_0x3e1e('0x59')](_0x3e1e('0x5a'),path['parse'](_0x50ba57[_0x3e1e('0x5b')])[_0x3e1e('0x1c')],_0x50ba57[_0x3e1e('0x5b')]);gs[_0x3e1e('0x5c')](_0x477e64)[_0x3e1e('0x40')](function(){_0x50ba57['path']=util[_0x3e1e('0x59')](_0x3e1e('0x5d'),path[_0x3e1e('0x33')](_0x50ba57[_0x3e1e('0x5b')])[_0x3e1e('0x5e')],path[_0x3e1e('0x33')](_0x50ba57['path'])[_0x3e1e('0x1c')]);_0x5e148e[_0x3e1e('0x5f')]=_0x50ba57[_0x3e1e('0x5b')];ut[_0x3e1e('0x41')](_0x3e1e('0x60'),'');ami[_0x3e1e('0x61')](ut['variablesAction'](_0x50ba57,_0x5e148e))[_0x3e1e('0x40')](function(_0x468fd2){_0x20bc4d(_0x468fd2);})[_0x3e1e('0x38')](function(_0x109407){_0x29ddc4(_0x109407);});})[_0x3e1e('0x38')](function(_0x12e315){_0x29ddc4(_0x12e315);});}else{ami['Action'](ut[_0x3e1e('0x62')](_0x50ba57,_0x5e148e))['then'](function(_0x167544){_0x20bc4d(_0x167544);})[_0x3e1e('0x38')](function(_0x5c7565){_0x29ddc4(_0x5c7565);});}});}Fax[_0x3e1e('0x1f')][_0x3e1e('0x63')]=function(_0x98def8,_0x43f2b4){var _0x49b219=this;return new BPromise(function(_0x381b57,_0x4a7dcc){var _0x2d6bb0=uuid['v4']();var _0x7f1301=ut[_0x3e1e('0x64')](_0x98def8,_0x43f2b4);_0x49b219[_0x3e1e('0xf')][_0x2d6bb0]=new Action(_0x2d6bb0,_0x43f2b4,_0x98def8);var _0x2ef476=_0x49b219[_0x3e1e('0xf')][_0x2d6bb0];if(path['parse'](_0x98def8[_0x3e1e('0x5b')])[_0x3e1e('0x65')]===_0x3e1e('0x35')){originate(_0x2ef476,_0x7f1301,!![])[_0x3e1e('0x40')](function(_0x4b4fd4){_0x381b57(_0x4b4fd4);})[_0x3e1e('0x38')](function(_0x11eb0a){_0x4a7dcc(_0x11eb0a);});}else{originate(_0x2ef476,_0x7f1301,![])[_0x3e1e('0x40')](function(_0x405671){_0x381b57(_0x405671);})['catch'](function(_0x2211c6){_0x4a7dcc(_0x2211c6);});}});};Fax[_0x3e1e('0x1f')][_0x3e1e('0x66')]=function(_0x2161a4){return!_[_0x3e1e('0x67')](_0x2161a4)&&!_[_0x3e1e('0x67')](_0x2161a4['name'])&&!_['isNil'](_0x2161a4['active'])&&_0x2161a4[_0x3e1e('0x68')]&&!_['isNil'](this[_0x3e1e('0x69')][util['format'](_0x3e1e('0x6a'),_0x2161a4[_0x3e1e('0x1c')])])&&!_[_0x3e1e('0x67')](this[_0x3e1e('0x69')][util['format'](_0x3e1e('0x6a'),_0x2161a4['name'])][_0x3e1e('0x28')])&&(this['trunks'][util[_0x3e1e('0x59')](_0x3e1e('0x6a'),_0x2161a4['name'])][_0x3e1e('0x28')]===_0x3e1e('0x6b')||this[_0x3e1e('0x69')][util['format']('SIP/%s',_0x2161a4[_0x3e1e('0x1c')])][_0x3e1e('0x28')]===_0x3e1e('0x6c'));};Fax['prototype'][_0x3e1e('0x55')]=function(_0x51f83f,_0x57c99b){if(!this['isTrunkReachable'](_0x51f83f)){ut[_0x3e1e('0x41')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x3e1e('0x67')](_0x51f83f)?'':_0x51f83f[_0x3e1e('0x1c')]+_0x3e1e('0x6d'));return{'isValid':![],'message':_0x3e1e('0x6e')};}if(_[_0x3e1e('0x67')](_0x57c99b[_0x3e1e('0x5')])){ut[_0x3e1e('0x41')](_0x3e1e('0x6f'),JSON[_0x3e1e('0x37')](_0x57c99b));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x57c99b[_0x3e1e('0x5b')])){ut[_0x3e1e('0x41')](_0x3e1e('0x70'),JSON[_0x3e1e('0x37')](_0x57c99b));return{'isValid':![],'message':_0x3e1e('0x71')};}return{'isValid':!![],'message':_0x3e1e('0x72')};};module[_0x3e1e('0x73')]=Fax; \ No newline at end of file +var _0x1775=['../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','transferrate','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','calleridnum','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','pick','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var _=require(_0x5177('0x0'));var BPromise=require(_0x5177('0x1'));var uuid=require(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var path=require(_0x5177('0x4'));var tiff2pdf=require(_0x5177('0x5'));var gs=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var ami=require(_0x5177('0x9'));var rpcDb=require(_0x5177('0xa'));var Channel=require(_0x5177('0xb'));var ut=require(_0x5177('0xc'));var Action=require(_0x5177('0xd'));var faxAccount=require(_0x5177('0xe'));var attachment=require(_0x5177('0xf'));var faxMessage=require(_0x5177('0x10'));function Fax(_0x3ce288){this[_0x5177('0x11')]={};this[_0x5177('0x12')]=_0x3ce288[_0x5177('0x12')];this[_0x5177('0x13')]=_0x3ce288['trunks'];this['actions']={};ami['on'](_0x5177('0x14'),this[_0x5177('0x15')][_0x5177('0x16')](this));ami['on'](_0x5177('0x17'),this[_0x5177('0x18')]['bind'](this));ami['on'](_0x5177('0x19'),this[_0x5177('0x1a')][_0x5177('0x16')](this));ami['on'](_0x5177('0x1b'),this[_0x5177('0x1c')][_0x5177('0x16')](this));ami['on'](_0x5177('0x1d'),this[_0x5177('0x1e')][_0x5177('0x16')](this));ami['on'](_0x5177('0x1f'),this[_0x5177('0x20')][_0x5177('0x16')](this));ami['on'](_0x5177('0x21'),this[_0x5177('0x22')][_0x5177('0x16')](this));ami['on'](_0x5177('0x23'),this[_0x5177('0x24')][_0x5177('0x16')](this));}Fax[_0x5177('0x25')]['syncNewchannel']=function(_0x288e3f){if(_0x288e3f[_0x5177('0x26')]===_0x5177('0x27')){for(var _0x1b4102 in this['faxAccounts']){if(this[_0x5177('0x12')][_0x5177('0x28')](_0x1b4102)){if(_0x288e3f[_0x5177('0x29')]===this['faxAccounts'][_0x1b4102][_0x5177('0x2a')]){this['channels'][_0x288e3f[_0x5177('0x2b')]]={};this[_0x5177('0x11')][_0x288e3f[_0x5177('0x2b')]][_0x5177('0x2c')]=_0x288e3f[_0x5177('0x2c')];this[_0x5177('0x11')][_0x288e3f[_0x5177('0x2b')]]['id']=this[_0x5177('0x12')][_0x1b4102]['id'];this[_0x5177('0x11')][_0x288e3f[_0x5177('0x2b')]][_0x5177('0x2d')]=this[_0x5177('0x12')][_0x1b4102]['name'];logger[_0x5177('0x2e')](_0x288e3f['uniqueid'],_0x5177('0x2f'));}}}}if(this[_0x5177('0x30')][_0x288e3f[_0x5177('0x2b')]]){this[_0x5177('0x11')][_0x288e3f['uniqueid']]={};this[_0x5177('0x11')][_0x288e3f['uniqueid']]['channel']=_0x288e3f[_0x5177('0x2c')];logger[_0x5177('0x2e')](_0x288e3f['uniqueid'],_0x5177('0x2f'));}};Fax['prototype'][_0x5177('0x18')]=function(_0x1cbd29){if(this['channels'][_0x1cbd29[_0x5177('0x2b')]]){for(var _0x2554ec in _0x1cbd29[_0x5177('0x31')]){if(_0x1cbd29[_0x5177('0x31')][_0x5177('0x28')](_0x2554ec)){this[_0x5177('0x11')][_0x1cbd29['uniqueid']][_0x2554ec]=_0x1cbd29['value'];}}}};Fax[_0x5177('0x25')][_0x5177('0x1a')]=function(_0x7dae59){if(this[_0x5177('0x11')][_0x7dae59[_0x5177('0x2b')]]){this[_0x5177('0x11')][_0x7dae59[_0x5177('0x2b')]][_0x5177('0x32')]=_0x7dae59['channelstate'];this[_0x5177('0x11')][_0x7dae59[_0x5177('0x2b')]]['channelstatedesc']=_0x7dae59[_0x5177('0x33')];}};Fax['prototype'][_0x5177('0x1c')]=function(_0x1a2c46){if(this[_0x5177('0x11')][_0x1a2c46['uniqueid']]){for(var _0x4f70df in _0x1a2c46[_0x5177('0x31')]){if(_0x1a2c46[_0x5177('0x31')][_0x5177('0x28')](_0x4f70df)){this[_0x5177('0x11')][_0x1a2c46[_0x5177('0x2b')]][_0x4f70df]=_0x1a2c46[_0x5177('0x34')];}}}};Fax[_0x5177('0x25')][_0x5177('0x1e')]=function(_0x513095){if(this[_0x5177('0x11')][_0x513095[_0x5177('0x2b')]]){this['channels'][_0x513095[_0x5177('0x2b')]][_0x5177('0x35')]=_0x513095[_0x5177('0x35')];this[_0x5177('0x11')][_0x513095[_0x5177('0x2b')]][_0x5177('0x36')]=_0x513095['status'];this[_0x5177('0x11')][_0x513095[_0x5177('0x2b')]][_0x5177('0x2a')]=_0x513095[_0x5177('0x2a')];this[_0x5177('0x11')][_0x513095[_0x5177('0x2b')]][_0x5177('0x37')]=_0x513095['filename'];logger[_0x5177('0x2e')](_0x513095[_0x5177('0x2b')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x5177('0x20')]=function(_0x188cec){var _0x22365a=this;if(this[_0x5177('0x11')][_0x188cec[_0x5177('0x2b')]]){var _0x1ea3be=this[_0x5177('0x11')][_0x188cec[_0x5177('0x2b')]]['id'];this[_0x5177('0x11')][_0x188cec[_0x5177('0x2b')]][_0x5177('0x38')]=_0x188cec[_0x5177('0x38')];this[_0x5177('0x11')][_0x188cec['uniqueid']][_0x5177('0x39')]=_0x188cec[_0x5177('0x39')];this['channels'][_0x188cec[_0x5177('0x2b')]]['localstationid']=_0x188cec[_0x5177('0x2a')];this[_0x5177('0x11')][_0x188cec[_0x5177('0x2b')]]['resolution']=_0x188cec['resolution'];this[_0x5177('0x11')][_0x188cec[_0x5177('0x2b')]][_0x5177('0x3a')]=_0x188cec[_0x5177('0x3a')];this[_0x5177('0x11')][_0x188cec[_0x5177('0x2b')]][_0x5177('0x37')]=_0x188cec[_0x5177('0x37')];this['channels'][_0x188cec[_0x5177('0x2b')]]['calleridnum']=_0x188cec['calleridnum'];if(this[_0x5177('0x11')][_0x188cec[_0x5177('0x2b')]]['pagestransferred']>0x0){tiff2pdf(_0x188cec[_0x5177('0x37')],'/var/opt/motion2/server/files/attachments/',function(_0x4aae02){logger[_0x5177('0x2e')](_0x188cec[_0x5177('0x2b')],_0x5177('0x3b'),_0x4aae02[_0x5177('0x3c')]);attachment[_0x5177('0x3d')]({'name':path[_0x5177('0x3e')](_0x188cec[_0x5177('0x37')])['name'],'basename':path['parse'](_0x188cec[_0x5177('0x37')])['name']+_0x5177('0x3f'),'type':_0x5177('0x40')})[_0x5177('0x41')](function(_0x3ed103){faxAccount['notify'](_0x1ea3be,{'from':_0x188cec[_0x5177('0x42')],'mapKey':_0x5177('0x8'),'body':path[_0x5177('0x3e')](_0x188cec[_0x5177('0x37')])[_0x5177('0x2d')]+_0x5177('0x3f'),'AttachmentId':_0x3ed103['id']})[_0x5177('0x43')](function(_0xa24b4d){logger[_0x5177('0x44')](_0x188cec[_0x5177('0x2b')],_0x5177('0x45'),JSON['stringify'](_0xa24b4d));});})[_0x5177('0x43')](function(_0x481bda){logger['error'](_0x188cec['uniqueid'],_0x5177('0x46'),JSON[_0x5177('0x47')](_0x481bda));});});}logger['info'](_0x188cec[_0x5177('0x2b')],_0x5177('0x46'));}};Fax[_0x5177('0x25')]['syncOriginateResponse']=function(_0x1d4ae4){if(this['actions'][_0x1d4ae4['uniqueid']]){_['merge'](this[_0x5177('0x11')][_0x1d4ae4[_0x5177('0x2b')]],_[_0x5177('0x48')](_0x1d4ae4,['response','reason']));}};function updateStatus(_0x42b827){if(_0x42b827['AttachmentId']){faxMessage[_0x5177('0x49')](_0x42b827[_0x5177('0x4a')],{'failMessage':_0x5177('0x4b')})[_0x5177('0x41')](function(_0x84233c){ut[_0x5177('0x4c')](_0x5177('0x4d'),_0x84233c);})[_0x5177('0x43')](function(_0x26c878){ut[_0x5177('0x4c')](_0x5177('0x4e'),_0x26c878);});}else{ut[_0x5177('0x4c')](_0x5177('0x4f'));}}Fax['prototype']['updateStatus']=function(_0x29ff0f,_0x5d5016,_0x649c6f){var _0x49aba9=this;var _0x1414b5={};if(_0x5d5016){_0x1414b5={'read':_0x5d5016};}else{_0x1414b5={'failMessage':_0x649c6f};}if(this[_0x5177('0x30')][_0x29ff0f][_0x5177('0x4a')]){faxMessage['update'](this['actions'][_0x29ff0f][_0x5177('0x4a')],_0x1414b5)[_0x5177('0x41')](function(_0x2eb560){ut[_0x5177('0x4c')]('[Fax][Message][Updated]',_0x2eb560);})['catch'](function(_0x3f0e89){ut[_0x5177('0x4c')](_0x5177('0x50'),_0x3f0e89);})[_0x5177('0x51')](function(){delete _0x49aba9['channels'][_0x29ff0f];delete _0x49aba9[_0x5177('0x30')][_0x29ff0f];});}else{ut[_0x5177('0x4c')](_0x5177('0x52'));delete this['channels'][_0x29ff0f];delete this[_0x5177('0x30')][_0x29ff0f];}};Fax[_0x5177('0x25')][_0x5177('0x22')]=function(_0x49e3e3){var _0x975408=this;if(this['channels'][_0x49e3e3[_0x5177('0x2b')]]){if(this[_0x5177('0x30')][_0x49e3e3[_0x5177('0x2b')]]){this['channels'][_0x49e3e3[_0x5177('0x2b')]]['id']=this[_0x5177('0x30')][_0x49e3e3[_0x5177('0x2b')]]['id'];this[_0x5177('0x11')][_0x49e3e3[_0x5177('0x2b')]][_0x5177('0x2d')]=this[_0x5177('0x30')][_0x49e3e3[_0x5177('0x2b')]]['name'];}logger['info'](_0x49e3e3['uniqueid'],this[_0x5177('0x30')][_0x49e3e3[_0x5177('0x2b')]]?_0x5177('0x53'):_0x5177('0x54'),JSON[_0x5177('0x47')](this[_0x5177('0x11')][_0x49e3e3['uniqueid']]));if(this['actions'][_0x49e3e3[_0x5177('0x2b')]]){if(this[_0x5177('0x11')][_0x49e3e3[_0x5177('0x2b')]][_0x5177('0x55')]>0x0&&this[_0x5177('0x11')][_0x49e3e3[_0x5177('0x2b')]][_0x5177('0x1d')]===_0x5177('0x56')){this[_0x5177('0x57')](_0x49e3e3['uniqueid'],!![]);}else{this[_0x5177('0x57')](_0x49e3e3[_0x5177('0x2b')],![],this['channels'][_0x49e3e3[_0x5177('0x2b')]][_0x5177('0x58')]?'SENDING\x20FAILED:\x20'+this[_0x5177('0x11')][_0x49e3e3[_0x5177('0x2b')]][_0x5177('0x58')]:'SENDING\x20FAILED');}}}};Fax[_0x5177('0x25')][_0x5177('0x59')]=function(_0x5f5bd5){var _0x52a6c2=this;return new BPromise(function(_0x102c27,_0x4f76d7){_0x52a6c2[_0x5177('0x5a')](_0x5f5bd5,_0x52a6c2['faxAccounts'][_0x5f5bd5[_0x5177('0x5b')]])[_0x5177('0x41')](function(_0x5a8ada){ut[_0x5177('0x4c')](_0x5177('0x5c'),_0x5a8ada);_0x102c27(ut[_0x5177('0x3c')](_0x5177('0x5d')));})[_0x5177('0x43')](function(_0x2bf11b){ut[_0x5177('0x4c')]('[Fax][execOriginate][failure]',_0x2bf11b);updateStatus(_0x5f5bd5);_0x4f76d7(ut[_0x5177('0x3c')]('Fax\x20failed'));});});};Fax['prototype'][_0x5177('0x5e')]=function(_0x37ecd7){var _0x4eca5c=this;return new BPromise(function(_0x23e0e6,_0xa889bd){var _0x43abdd=_0x4eca5c[_0x5177('0x5f')](_0x4eca5c[_0x5177('0x12')][_0x37ecd7[_0x5177('0x5b')]][_0x5177('0x60')],_0x37ecd7);if(_0x43abdd[_0x5177('0x61')]){_0x23e0e6(ut['message']('Trunk\x20Reachable'));}else{_0xa889bd(ut[_0x5177('0x3c')](_0x43abdd[_0x5177('0x3c')]));}});};function originate(_0x260475,_0x2d24b3,_0x3de0b5){return new BPromise(function(_0x3dd58f,_0x4fc289){if(_0x3de0b5){var _0x3692b2=util[_0x5177('0x62')](_0x5177('0x63'),path[_0x5177('0x3e')](_0x260475['path'])[_0x5177('0x2d')],_0x260475[_0x5177('0x4')]);gs[_0x5177('0x64')](_0x3692b2)[_0x5177('0x41')](function(){_0x260475[_0x5177('0x4')]=util['format'](_0x5177('0x65'),path['parse'](_0x260475[_0x5177('0x4')])[_0x5177('0x66')],path['parse'](_0x260475[_0x5177('0x4')])[_0x5177('0x2d')]);_0x2d24b3[_0x5177('0x67')]=_0x260475[_0x5177('0x4')];ut['logger'](_0x5177('0x68'),'');ami[_0x5177('0x69')](ut[_0x5177('0x6a')](_0x260475,_0x2d24b3))[_0x5177('0x41')](function(_0x50485e){_0x3dd58f(_0x50485e);})[_0x5177('0x43')](function(_0x17456b){_0x4fc289(_0x17456b);});})[_0x5177('0x43')](function(_0x4c8a15){_0x4fc289(_0x4c8a15);});}else{ami['Action'](ut[_0x5177('0x6a')](_0x260475,_0x2d24b3))[_0x5177('0x41')](function(_0x3f42a5){_0x3dd58f(_0x3f42a5);})[_0x5177('0x43')](function(_0xb2aca2){_0x4fc289(_0xb2aca2);});}});}Fax[_0x5177('0x25')][_0x5177('0x5a')]=function(_0x17ad3b,_0x83d5af){var _0x515cc8=this;return new BPromise(function(_0x48388a,_0x597a84){var _0x290315=uuid['v4']();var _0x4a546e=ut[_0x5177('0x6b')](_0x17ad3b,_0x83d5af);_0x515cc8[_0x5177('0x30')][_0x290315]=new Action(_0x290315,_0x83d5af,_0x17ad3b);var _0x56c1aa=_0x515cc8[_0x5177('0x30')][_0x290315];if(path[_0x5177('0x3e')](_0x17ad3b['path'])[_0x5177('0x6c')]===_0x5177('0x3f')){originate(_0x56c1aa,_0x4a546e,!![])[_0x5177('0x41')](function(_0x4fce32){_0x48388a(_0x4fce32);})[_0x5177('0x43')](function(_0x484762){_0x597a84(_0x484762);});}else{originate(_0x56c1aa,_0x4a546e,![])[_0x5177('0x41')](function(_0x45b7ae){_0x48388a(_0x45b7ae);})['catch'](function(_0xe5a705){_0x597a84(_0xe5a705);});}});};Fax[_0x5177('0x25')]['isTrunkReachable']=function(_0x5f0141){return!_[_0x5177('0x6d')](_0x5f0141)&&!_['isNil'](_0x5f0141[_0x5177('0x2d')])&&!_[_0x5177('0x6d')](_0x5f0141['active'])&&_0x5f0141[_0x5177('0x6e')]&&!_[_0x5177('0x6d')](this[_0x5177('0x13')][util[_0x5177('0x62')](_0x5177('0x6f'),_0x5f0141[_0x5177('0x2d')])])&&!_[_0x5177('0x6d')](this[_0x5177('0x13')][util['format'](_0x5177('0x6f'),_0x5f0141['name'])][_0x5177('0x36')])&&(this[_0x5177('0x13')][util[_0x5177('0x62')](_0x5177('0x6f'),_0x5f0141['name'])][_0x5177('0x36')]===_0x5177('0x70')||this['trunks'][util[_0x5177('0x62')](_0x5177('0x6f'),_0x5f0141['name'])][_0x5177('0x36')]==='unmonitored');};Fax[_0x5177('0x25')]['checkTrunk']=function(_0x55fa0a,_0x5cd8a1){if(!this[_0x5177('0x71')](_0x55fa0a)){ut[_0x5177('0x4c')](_0x5177('0x72'),_['isNil'](_0x55fa0a)?'':_0x55fa0a[_0x5177('0x2d')]+_0x5177('0x73'));return{'isValid':![],'message':_0x5177('0x74')};}if(_[_0x5177('0x6d')](_0x5cd8a1[_0x5177('0x8')])){ut['logger'](_0x5177('0x75'),JSON[_0x5177('0x47')](_0x5cd8a1));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x5177('0x6d')](_0x5cd8a1['path'])){ut[_0x5177('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x5177('0x47')](_0x5cd8a1));return{'isValid':![],'message':_0x5177('0x76')};}return{'isValid':!![],'message':_0x5177('0x77')};};module[_0x5177('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 304ec51..b75024f 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 _0xa77c=['notify','catch','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0xf45809,_0xa0d76f){var _0x5b12c8=function(_0x3e445d){while(--_0x3e445d){_0xf45809['push'](_0xf45809['shift']());}};_0x5b12c8(++_0xa0d76f);}(_0xa77c,0xe3));var _0xca77=function(_0x1c6545,_0x4cc705){_0x1c6545=_0x1c6545-0x0;var _0x566b7f=_0xa77c[_0x1c6545];return _0x566b7f;};'use strict';var util=require('util');var BPromise=require(_0xca77('0x0'));var logger=require(_0xca77('0x1'))(_0xca77('0x2'));var _=require(_0xca77('0x3'));var faxAccount=require(_0xca77('0x4'));function loggerCatch(_0x29b310){return function(_0x21aa72){logger[_0xca77('0x5')](_0x29b310,util[_0xca77('0x6')](_0x21aa72,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3ee972,_0x218bdb){return BPromise['resolve']()['then'](faxAccount[_0xca77('0x7')](_0x3ee972,_0x218bdb))[_0xca77('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x744b=['inspect','notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x18dbc2,_0x1d6a07){var _0x16dabe=function(_0x267b35){while(--_0x267b35){_0x18dbc2['push'](_0x18dbc2['shift']());}};_0x16dabe(++_0x1d6a07);}(_0x744b,0x1d9));var _0xb744=function(_0x4a22dd,_0x5a8af8){_0x4a22dd=_0x4a22dd-0x0;var _0x38186a=_0x744b[_0x4a22dd];return _0x38186a;};'use strict';var util=require(_0xb744('0x0'));var BPromise=require(_0xb744('0x1'));var logger=require(_0xb744('0x2'))(_0xb744('0x3'));var _=require(_0xb744('0x4'));var faxAccount=require(_0xb744('0x5'));function loggerCatch(_0x32cdb4){return function(_0x4decca){logger[_0xb744('0x6')](_0x32cdb4,util[_0xb744('0x7')](_0x4decca,{'showHidden':![],'depth':null}));};}exports[_0xb744('0x8')]=function(_0x580086,_0x556990){return BPromise[_0xb744('0x9')]()[_0xb744('0xa')](faxAccount[_0xb744('0x8')](_0x580086,_0x556990))['catch'](loggerCatch(_0xb744('0xb')));}; \ 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 92c0260..67d42ff 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 _0x2c36=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0x2c36,0x1ae));var _0x62c3=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0x2c36[_0x1af0e5];return _0x3c444a;};'use strict';var util=require(_0x62c3('0x0'));var logger=require(_0x62c3('0x1'))('fax');var BPromise=require(_0x62c3('0x2'));var exec=require(_0x62c3('0x3'))[_0x62c3('0x4')];exports[_0x62c3('0x5')]=function(_0x5b112e){return new BPromise(function(_0x153b74,_0x2eff53){exec(_0x5b112e,function(_0x413fa9,_0x3f4f23,_0x4b5b29){logger[_0x62c3('0x6')]('Exec\x20gs',_0x3f4f23);if(_0x413fa9){logger[_0x62c3('0x6')](_0x62c3('0x7'),_0x62c3('0x8'),util['inspect'](_0x413fa9,{'showHidden':![],'depth':null}),_0x3f4f23,_0x4b5b29);_0x2eff53(_0x413fa9);}_0x153b74(_0x3f4f23);});});}; \ No newline at end of file +var _0xffee=['info','Exec\x20gs','util','../../../../config/logger','fax','bluebird','execute'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xffee,0x1f3));var _0xeffe=function(_0x4a5337,_0x40328e){_0x4a5337=_0x4a5337-0x0;var _0x7cc979=_0xffee[_0x4a5337];return _0x7cc979;};'use strict';var util=require(_0xeffe('0x0'));var logger=require(_0xeffe('0x1'))(_0xeffe('0x2'));var BPromise=require(_0xeffe('0x3'));var exec=require('child_process')['exec'];exports[_0xeffe('0x4')]=function(_0x541f89){return new BPromise(function(_0x47ce12,_0x71bc9a){exec(_0x541f89,function(_0x4faaa8,_0x50e544,_0x516f62){logger[_0xeffe('0x5')](_0xeffe('0x6'),_0x50e544);if(_0x4faaa8){logger[_0xeffe('0x5')](_0xeffe('0x6'),'\x20Error\x20:',util['inspect'](_0x4faaa8,{'showHidden':![],'depth':null}),_0x50e544,_0x516f62);_0x71bc9a(_0x4faaa8);}_0x47ce12(_0x50e544);});});}; \ 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 7a17cb5..8eb59ef 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 _0x2199=['util','../../../../config/logger','fax','message','logger','info','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x2199,0xfc));var _0x9219=function(_0x33d59b,_0x758e30){_0x33d59b=_0x33d59b-0x0;var _0x4d15bf=_0x2199[_0x33d59b];return _0x4d15bf;};'use strict';var util=require(_0x9219('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x9219('0x1'))(_0x9219('0x2'));exports[_0x9219('0x3')]=function(_0x4833eb){return{'message':_0x4833eb};};exports[_0x9219('0x4')]=function(_0x536439,_0x33922a){logger[_0x9219('0x5')](_0x536439,util['inspect'](_0x33922a,{'showHidden':![],'depth':null}));};exports[_0x9219('0x6')]=function(_0x582446,_0x43bb88){var _0x48252a={'XMF-ECM':_0x43bb88['ecm'],'XMF-HEADERINFO':_0x43bb88[_0x9219('0x7')],'XMF-MINRATE':_0x43bb88[_0x9219('0x8')],'XMF-MAXRATE':_0x43bb88[_0x9219('0x9')],'XMF-MODEM':util[_0x9219('0xa')](_0x9219('0xb'),_0x43bb88[_0x9219('0xc')]),'XMF-GATEWAY':_0x43bb88['gateway'],'XMF-FAXDETECT':_0x43bb88[_0x9219('0xd')],'XMF-T38TIMEOUT':_0x43bb88[_0x9219('0xe')],'XMF-LOCALSTATIONID':_0x43bb88[_0x9219('0xf')],'XMF-PATH':_0x582446[_0x9219('0x10')]};return _0x48252a;};exports[_0x9219('0x11')]=function(_0x48d0b5,_0x4e0c57){return{'actionid':_0x48d0b5[_0x9219('0x12')],'action':_0x9219('0x13'),'channel':_0x48d0b5['channel'],'Exten':_0x9219('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x9219('0xa')]('\x22%s\x22\x20<%s>',_0x48d0b5[_0x9219('0x7')]?_0x48d0b5[_0x9219('0x7')]:'',_0x48d0b5[_0x9219('0xf')]),'variable':_0x4e0c57,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x48d0b5[_0x9219('0x12')]};}; \ No newline at end of file +var _0xff0d=['ecm','headerinfo','maxrate','format','modem','gateway','t38timeout','localstationid','uniqueid','channel','xcally-motion-fax','from-sip','util','lodash','../../../../config/logger','message','logger','info','inspect','addVariables'];(function(_0x37e81c,_0x34822d){var _0x408048=function(_0x73ee28){while(--_0x73ee28){_0x37e81c['push'](_0x37e81c['shift']());}};_0x408048(++_0x34822d);}(_0xff0d,0xe8));var _0xdff0=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xff0d[_0x367e5b];return _0x4b909e;};'use strict';var util=require(_0xdff0('0x0'));var _=require(_0xdff0('0x1'));var moment=require('moment');var logger=require(_0xdff0('0x2'))('fax');exports[_0xdff0('0x3')]=function(_0x37d4e7){return{'message':_0x37d4e7};};exports[_0xdff0('0x4')]=function(_0x59024a,_0x3af526){logger[_0xdff0('0x5')](_0x59024a,util[_0xdff0('0x6')](_0x3af526,{'showHidden':![],'depth':null}));};exports[_0xdff0('0x7')]=function(_0x38dcc0,_0x4242d7){var _0x394541={'XMF-ECM':_0x4242d7[_0xdff0('0x8')],'XMF-HEADERINFO':_0x4242d7[_0xdff0('0x9')],'XMF-MINRATE':_0x4242d7['minrate'],'XMF-MAXRATE':_0x4242d7[_0xdff0('0xa')],'XMF-MODEM':util[_0xdff0('0xb')]('\x22%s\x22',_0x4242d7[_0xdff0('0xc')]),'XMF-GATEWAY':_0x4242d7[_0xdff0('0xd')],'XMF-FAXDETECT':_0x4242d7['faxdetect'],'XMF-T38TIMEOUT':_0x4242d7[_0xdff0('0xe')],'XMF-LOCALSTATIONID':_0x4242d7[_0xdff0('0xf')],'XMF-PATH':_0x38dcc0['path']};return _0x394541;};exports['variablesAction']=function(_0x41537c,_0x41a317){return{'actionid':_0x41537c[_0xdff0('0x10')],'action':'originate','channel':_0x41537c[_0xdff0('0x11')],'Exten':_0xdff0('0x12'),'Context':_0xdff0('0x13'),'Priority':'1','callerid':util[_0xdff0('0xb')]('\x22%s\x22\x20<%s>',_0x41537c[_0xdff0('0x9')]?_0x41537c[_0xdff0('0x9')]:'',_0x41537c[_0xdff0('0xf')]),'variable':_0x41a317,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x41537c[_0xdff0('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 63fca87..e393bf1 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 _0x848d=['./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','bluebird','util','moment','./realtime','./report','./acw'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x848d,0xc9));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd848('0x0'));var util=require(_0xd848('0x1'));var moment=require(_0xd848('0x2'));var server=require('./server');var Realtime=require(_0xd848('0x3'));var Report=require(_0xd848('0x4'));var Acw=require(_0xd848('0x5'));var Trigger=require(_0xd848('0x6'));var Dialer=require(_0xd848('0x7'));var Preview=require('./preview');var Fax=require(_0xd848('0x8'));var user=require(_0xd848('0x9'));var voiceQueue=require(_0xd848('0xa'));var voiceQueueReport=require(_0xd848('0xb'));var voiceCallReport=require(_0xd848('0xc'));var trunk=require(_0xd848('0xd'));var trigger=require(_0xd848('0xe'));var template=require(_0xd848('0xf'));var cmHopperHistory=require(_0xd848('0x10'));var campaign=require(_0xd848('0x11'));var voiceExtension=require(_0xd848('0x12'));var faxAccount=require(_0xd848('0x13'));var zendesk=require(_0xd848('0x14'));var salesforce=require(_0xd848('0x15'));var sugarcrm=require(_0xd848('0x16'));var freshdesk=require(_0xd848('0x17'));var desk=require(_0xd848('0x18'));var zoho=require(_0xd848('0x19'));var vtiger=require(_0xd848('0x1a'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xd848('0x1b'));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(_0xd848('0x1c'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd848('0x1d')](_0xd848('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd848('0x1d')](_0xd848('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xd848('0x1f')]()[_0xd848('0x20')](user[_0xd848('0x21')]())['then'](realtime[_0xd848('0x22')]())[_0xd848('0x20')](user['getTelephones']())[_0xd848('0x20')](realtime[_0xd848('0x23')]())['then'](trunk[_0xd848('0x24')]())[_0xd848('0x20')](realtime[_0xd848('0x25')]())[_0xd848('0x20')](voiceQueue['getVoiceQueues']())[_0xd848('0x20')](realtime[_0xd848('0x26')]())[_0xd848('0x20')](trigger['getTriggers']())[_0xd848('0x20')](realtime[_0xd848('0x27')]())[_0xd848('0x20')](template[_0xd848('0x28')]())['then'](realtime['initTemplates']())['then'](zendesk['getZendeskAccounts']())[_0xd848('0x20')](realtime[_0xd848('0x29')]())[_0xd848('0x20')](salesforce['getSalesforceAccounts']())[_0xd848('0x20')](realtime['initSalesforceAccounts']())[_0xd848('0x20')](sugarcrm['getSugarcrmAccounts']())[_0xd848('0x20')](realtime[_0xd848('0x2a')]())[_0xd848('0x20')](freshdesk[_0xd848('0x2b')]())[_0xd848('0x20')](realtime[_0xd848('0x2c')]())['then'](desk[_0xd848('0x2d')]())[_0xd848('0x20')](realtime['initDeskAccounts']())[_0xd848('0x20')](zoho[_0xd848('0x2e')]())['then'](realtime[_0xd848('0x2f')]())[_0xd848('0x20')](vtiger[_0xd848('0x30')]())[_0xd848('0x20')](realtime[_0xd848('0x31')]())['then'](freshsales[_0xd848('0x32')]())['then'](realtime[_0xd848('0x33')]())[_0xd848('0x20')](servicenow[_0xd848('0x34')]())[_0xd848('0x20')](realtime['initServicenowAccounts']())[_0xd848('0x20')](dynamics365[_0xd848('0x35')]())[_0xd848('0x20')](realtime['initDynamics365Accounts']())['then'](campaign[_0xd848('0x36')]())[_0xd848('0x20')](realtime['initCampaigns']())[_0xd848('0x20')](voiceExtension['getVoiceExtensions']())[_0xd848('0x20')](realtime[_0xd848('0x37')]())[_0xd848('0x20')](faxAccount['getFaxAccounts']())[_0xd848('0x20')](realtime[_0xd848('0x38')]())[_0xd848('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0xd848('0x1f')]()['then'](voiceQueueReport[_0xd848('0x39')]())['then'](realtime['initVoiceQueueReports']())[_0xd848('0x20')](cmHopperHistory[_0xd848('0x3a')]())['then'](realtime[_0xd848('0x3b')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xd848('0x20')](realtime[_0xd848('0x3c')]())['then'](voiceCallReport[_0xd848('0x3d')]())[_0xd848('0x20')](realtime[_0xd848('0x3e')]())[_0xd848('0x3f')](function(_0x3df56f){logger['error'](_0xd848('0x40'),util[_0xd848('0x41')](_0x3df56f,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd848('0x42')](realtime,preview,fax)['then'](function(_0x1ea6c2){return initRealtime();})[_0xd848('0x20')](function(){return initParams();})['then'](function(){report[_0xd848('0x43')]();setInterval(initRealtime,0x1388);})[_0xd848('0x3f')](function(_0x2e25f9){logger[_0xd848('0x44')]('[index.js][main]',util[_0xd848('0x41')](_0x2e25f9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x7537=['getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','bluebird','moment','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTrunks'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0x7537,0x66));var _0x7753=function(_0x116d2c,_0xe9e87b){_0x116d2c=_0x116d2c-0x0;var _0x32b474=_0x7537[_0x116d2c];return _0x32b474;};'use strict';var BPromise=require(_0x7753('0x0'));var util=require('util');var moment=require(_0x7753('0x1'));var server=require('./server');var Realtime=require(_0x7753('0x2'));var Report=require('./report');var Acw=require(_0x7753('0x3'));var Trigger=require(_0x7753('0x4'));var Dialer=require(_0x7753('0x5'));var Preview=require(_0x7753('0x6'));var Fax=require(_0x7753('0x7'));var user=require(_0x7753('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x7753('0x9'));var voiceCallReport=require(_0x7753('0xa'));var trunk=require(_0x7753('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x7753('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x7753('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7753('0xe'));var zendesk=require(_0x7753('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x7753('0x10'));var zoho=require(_0x7753('0x11'));var vtiger=require(_0x7753('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7753('0x13'));var dynamics365=require(_0x7753('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x7753('0x15'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7753('0x16')](_0x7753('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7753('0x16')](_0x7753('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7753('0x18')]()[_0x7753('0x19')](user[_0x7753('0x1a')]())[_0x7753('0x19')](realtime[_0x7753('0x1b')]())['then'](user[_0x7753('0x1c')]())[_0x7753('0x19')](realtime['initTelephones']())[_0x7753('0x19')](trunk['getTrunks']())[_0x7753('0x19')](realtime[_0x7753('0x1d')]())[_0x7753('0x19')](voiceQueue[_0x7753('0x1e')]())['then'](realtime['initVoiceQueues']())[_0x7753('0x19')](trigger[_0x7753('0x1f')]())[_0x7753('0x19')](realtime[_0x7753('0x20')]())[_0x7753('0x19')](template[_0x7753('0x21')]())[_0x7753('0x19')](realtime[_0x7753('0x22')]())[_0x7753('0x19')](zendesk[_0x7753('0x23')]())[_0x7753('0x19')](realtime['initZendeskAccounts']())[_0x7753('0x19')](salesforce[_0x7753('0x24')]())[_0x7753('0x19')](realtime[_0x7753('0x25')]())[_0x7753('0x19')](sugarcrm[_0x7753('0x26')]())[_0x7753('0x19')](realtime['initSugarcrmAccounts']())[_0x7753('0x19')](freshdesk[_0x7753('0x27')]())[_0x7753('0x19')](realtime[_0x7753('0x28')]())['then'](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())['then'](zoho[_0x7753('0x29')]())['then'](realtime['initZohoAccounts']())[_0x7753('0x19')](vtiger['getVtigerAccounts']())[_0x7753('0x19')](realtime[_0x7753('0x2a')]())[_0x7753('0x19')](freshsales[_0x7753('0x2b')]())[_0x7753('0x19')](realtime[_0x7753('0x2c')]())[_0x7753('0x19')](servicenow[_0x7753('0x2d')]())['then'](realtime[_0x7753('0x2e')]())[_0x7753('0x19')](dynamics365['getDynamics365Accounts']())[_0x7753('0x19')](realtime[_0x7753('0x2f')]())[_0x7753('0x19')](campaign[_0x7753('0x30')]())[_0x7753('0x19')](realtime[_0x7753('0x31')]())[_0x7753('0x19')](voiceExtension[_0x7753('0x32')]())[_0x7753('0x19')](realtime[_0x7753('0x33')]())[_0x7753('0x19')](faxAccount['getFaxAccounts']())[_0x7753('0x19')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x7753('0x18')]()[_0x7753('0x19')](voiceQueueReport[_0x7753('0x34')]())[_0x7753('0x19')](realtime[_0x7753('0x35')]())[_0x7753('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x7753('0x19')](realtime[_0x7753('0x36')]())[_0x7753('0x19')](cmHopperHistory[_0x7753('0x37')]())[_0x7753('0x19')](realtime[_0x7753('0x38')]())[_0x7753('0x19')](voiceCallReport[_0x7753('0x39')]())[_0x7753('0x19')](realtime[_0x7753('0x3a')]())[_0x7753('0x3b')](function(_0x5efb13){logger['error'](_0x7753('0x3c'),util[_0x7753('0x3d')](_0x5efb13,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7753('0x3e')](realtime,preview,fax)[_0x7753('0x19')](function(_0x382911){return initRealtime();})['then'](function(){return initParams();})[_0x7753('0x19')](function(){report[_0x7753('0x3f')]();setInterval(initRealtime,0x1388);})[_0x7753('0x3b')](function(_0x44707a){logger[_0x7753('0x40')](_0x7753('0x41'),util['inspect'](_0x44707a,{'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 c36d897..c1cb769 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x4a3ee3,_0x304512){var _0x56d16d=function(_0x280251){while(--_0x280251){_0x4a3ee3['push'](_0x4a3ee3['shift']());}};_0x56d16d(++_0x304512);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b140470..5f55c15 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 _0x014a=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x48a06f,_0x152e72){var _0x3e75e4=function(_0x8f522f){while(--_0x8f522f){_0x48a06f['push'](_0x48a06f['shift']());}};_0x3e75e4(++_0x152e72);}(_0x014a,0x178));var _0xa014=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x014a[_0x37bd26];return _0xe83dc4;};'use strict';function Campaign(_0x11af83){this['id']=_0x11af83['id']||0x0;this[_0xa014('0x0')]=_0x11af83['name']||'';this[_0xa014('0x1')]=_0x11af83[_0xa014('0x1')]||'campaign';this['originated']=0x0;this[_0xa014('0x2')]=0x0;this[_0xa014('0x3')]=0x0;this[_0xa014('0x4')]=0x0;this[_0xa014('0x5')]='';this[_0xa014('0x6')]=!![];this[_0xa014('0x7')]=_0x11af83[_0xa014('0x7')];this[_0xa014('0x8')]=_0x11af83['limitCalls'];this[_0xa014('0x9')]=_0x11af83[_0xa014('0x9')]||null;this[_0xa014('0xa')]=_0x11af83['dialGlobalInterval']?_0x11af83['dialGlobalInterval']:null;this[_0xa014('0xb')]=_0x11af83[_0xa014('0xb')];this['dialOriginateCallerIdNumber']=_0x11af83['dialOriginateCallerIdNumber'];this[_0xa014('0xc')]=_0x11af83[_0xa014('0xc')]||0x1e;this[_0xa014('0xd')]=_0x11af83['dialCongestionMaxRetry'];this[_0xa014('0xe')]=_0x11af83['dialCongestionRetryFrequency'];this[_0xa014('0xf')]=_0x11af83[_0xa014('0xf')];this[_0xa014('0x10')]=_0x11af83[_0xa014('0x10')];this[_0xa014('0x11')]=_0x11af83[_0xa014('0x11')];this[_0xa014('0x12')]=_0x11af83[_0xa014('0x12')];this[_0xa014('0x13')]=_0x11af83[_0xa014('0x13')];this['dialNoSuchNumberMaxRetry']=_0x11af83[_0xa014('0x14')]||0x3;this[_0xa014('0x15')]=_0x11af83['dialNoSuchNumberRetryFrequency']||0x96;this[_0xa014('0x16')]=_0x11af83[_0xa014('0x16')]||0x3;this[_0xa014('0x17')]=_0x11af83[_0xa014('0x17')]||0x96;this[_0xa014('0x18')]=_0x11af83[_0xa014('0x18')]||0x3;this[_0xa014('0x19')]=_0x11af83[_0xa014('0x19')]||0x96;this[_0xa014('0x1a')]=_0x11af83['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x11af83[_0xa014('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x11af83[_0xa014('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x11af83[_0xa014('0x1d')]||0x96;this[_0xa014('0x1e')]=_0x11af83[_0xa014('0x1e')]||_0xa014('0x1f');this[_0xa014('0x20')]=_0x11af83[_0xa014('0x20')]||undefined;this[_0xa014('0x21')]=_0x11af83[_0xa014('0x21')]||undefined;this['dialCutDigit']=_0x11af83['dialCutDigit']||undefined;this['TrunkBackup']=_0x11af83[_0xa014('0x22')]?_0x11af83[_0xa014('0x22')]:undefined;this[_0xa014('0x23')]=_0x11af83[_0xa014('0x23')]?_0x11af83[_0xa014('0x23')]:undefined;this[_0xa014('0x24')]=_0x11af83[_0xa014('0x24')]?_0x11af83[_0xa014('0x24')]:undefined;this[_0xa014('0x25')]=_0x11af83[_0xa014('0x25')]?_0x11af83[_0xa014('0x25')]:undefined;this[_0xa014('0x26')]=_0x11af83[_0xa014('0x25')]?_0x11af83[_0xa014('0x25')][_0xa014('0x0')]:undefined;this[_0xa014('0x27')]=_0x11af83[_0xa014('0x27')]||![];this[_0xa014('0x28')]=_0x11af83['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x11af83[_0xa014('0x29')];this[_0xa014('0x2a')]=_0x11af83[_0xa014('0x2a')];this[_0xa014('0x2b')]=_0x11af83[_0xa014('0x2b')];this[_0xa014('0x2c')]=_0x11af83[_0xa014('0x2c')];this['dialAMDBetweenWordsSilence']=_0x11af83[_0xa014('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x11af83[_0xa014('0x2e')];this[_0xa014('0x2f')]=_0x11af83[_0xa014('0x2f')];this['dialAMDMaximumWordLength']=_0x11af83[_0xa014('0x30')];}module[_0xa014('0x31')]=Campaign; \ No newline at end of file +var _0x2efb=['active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','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','dialAMDMaximumWordLength','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive'];(function(_0x1c5a6a,_0x69324f){var _0x4c4f99=function(_0x14b969){while(--_0x14b969){_0x1c5a6a['push'](_0x1c5a6a['shift']());}};_0x4c4f99(++_0x69324f);}(_0x2efb,0x91));var _0xb2ef=function(_0x304c40,_0x3c79e6){_0x304c40=_0x304c40-0x0;var _0x2201f3=_0x2efb[_0x304c40];return _0x2201f3;};'use strict';function Campaign(_0x375688){this['id']=_0x375688['id']||0x0;this[_0xb2ef('0x0')]=_0x375688[_0xb2ef('0x0')]||'';this[_0xb2ef('0x1')]=_0x375688[_0xb2ef('0x1')]||_0xb2ef('0x2');this['originated']=0x0;this[_0xb2ef('0x3')]=0x0;this[_0xb2ef('0x4')]=0x0;this[_0xb2ef('0x5')]=0x0;this[_0xb2ef('0x6')]='';this[_0xb2ef('0x7')]=!![];this[_0xb2ef('0x8')]=_0x375688[_0xb2ef('0x8')];this[_0xb2ef('0x9')]=_0x375688['limitCalls'];this[_0xb2ef('0xa')]=_0x375688[_0xb2ef('0xa')]||null;this[_0xb2ef('0xb')]=_0x375688[_0xb2ef('0xb')]?_0x375688[_0xb2ef('0xb')]:null;this['dialOriginateCallerIdName']=_0x375688[_0xb2ef('0xc')];this['dialOriginateCallerIdNumber']=_0x375688[_0xb2ef('0xd')];this[_0xb2ef('0xe')]=_0x375688['dialOriginateTimeout']||0x1e;this[_0xb2ef('0xf')]=_0x375688[_0xb2ef('0xf')];this['dialCongestionRetryFrequency']=_0x375688['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x375688[_0xb2ef('0x10')];this[_0xb2ef('0x11')]=_0x375688[_0xb2ef('0x11')];this[_0xb2ef('0x12')]=_0x375688[_0xb2ef('0x12')];this[_0xb2ef('0x13')]=_0x375688[_0xb2ef('0x13')];this[_0xb2ef('0x14')]=_0x375688[_0xb2ef('0x14')];this['dialNoSuchNumberMaxRetry']=_0x375688[_0xb2ef('0x15')]||0x3;this[_0xb2ef('0x16')]=_0x375688['dialNoSuchNumberRetryFrequency']||0x96;this[_0xb2ef('0x17')]=_0x375688[_0xb2ef('0x17')]||0x3;this[_0xb2ef('0x18')]=_0x375688[_0xb2ef('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x375688[_0xb2ef('0x19')]||0x3;this[_0xb2ef('0x1a')]=_0x375688[_0xb2ef('0x1a')]||0x96;this[_0xb2ef('0x1b')]=_0x375688[_0xb2ef('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x375688[_0xb2ef('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x375688[_0xb2ef('0x1d')]||0x3;this[_0xb2ef('0x1e')]=_0x375688['dialAgentRejectRetryFrequency']||0x96;this[_0xb2ef('0x1f')]=_0x375688[_0xb2ef('0x1f')]||_0xb2ef('0x20');this[_0xb2ef('0x21')]=_0x375688[_0xb2ef('0x21')]||undefined;this[_0xb2ef('0x22')]=_0x375688[_0xb2ef('0x22')]||undefined;this[_0xb2ef('0x23')]=_0x375688[_0xb2ef('0x23')]||undefined;this[_0xb2ef('0x24')]=_0x375688[_0xb2ef('0x24')]?_0x375688[_0xb2ef('0x24')]:undefined;this[_0xb2ef('0x25')]=_0x375688[_0xb2ef('0x25')]?_0x375688[_0xb2ef('0x25')]:undefined;this[_0xb2ef('0x26')]=_0x375688[_0xb2ef('0x26')]?_0x375688[_0xb2ef('0x26')]:undefined;this['SquareProject']=_0x375688[_0xb2ef('0x27')]?_0x375688[_0xb2ef('0x27')]:undefined;this[_0xb2ef('0x28')]=_0x375688[_0xb2ef('0x27')]?_0x375688[_0xb2ef('0x27')][_0xb2ef('0x0')]:undefined;this['dialAMDActive']=_0x375688[_0xb2ef('0x29')]||![];this[_0xb2ef('0x2a')]=_0x375688[_0xb2ef('0x2a')];this['dialAMDGreeting']=_0x375688[_0xb2ef('0x2b')];this[_0xb2ef('0x2c')]=_0x375688[_0xb2ef('0x2c')];this[_0xb2ef('0x2d')]=_0x375688[_0xb2ef('0x2d')];this[_0xb2ef('0x2e')]=_0x375688[_0xb2ef('0x2e')];this[_0xb2ef('0x2f')]=_0x375688[_0xb2ef('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x375688[_0xb2ef('0x30')];this[_0xb2ef('0x31')]=_0x375688[_0xb2ef('0x31')];this[_0xb2ef('0x32')]=_0x375688['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 23d3409..6961022 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 _0x87d0=['calleridname','connectedlinename','accountcode','exten','answered','answertime','endtime','abandoned','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','starttime','channel','destinationchannel'];(function(_0x4a44ca,_0x1c52e9){var _0x584107=function(_0xcf2b09){while(--_0xcf2b09){_0x4a44ca['push'](_0x4a44ca['shift']());}};_0x584107(++_0x1c52e9);}(_0x87d0,0xbd));var _0x087d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x87d0[_0x20a584];return _0x4b41a8;};'use strict';function Channel(){this[_0x087d('0x0')]=null;this[_0x087d('0x1')]='';this[_0x087d('0x2')]='';this['calleridnum']=0x0;this[_0x087d('0x3')]='';this['connectedlinenum']=undefined;this[_0x087d('0x4')]=undefined;this[_0x087d('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x087d('0x6')]=0x0;this[_0x087d('0x7')]=![];this[_0x087d('0x8')]=null;this[_0x087d('0x9')]=null;this['unmanaged']=![];this[_0x087d('0xa')]=![];this['lastapplication']='';this[_0x087d('0xb')]='';this['duration']=0x0;this[_0x087d('0xc')]=0x0;this[_0x087d('0xd')]=0x0;this[_0x087d('0xe')]=null;this[_0x087d('0xf')]=null;this[_0x087d('0x10')]=null;this[_0x087d('0x11')]=![];this[_0x087d('0x12')]=null;this[_0x087d('0x13')]=null;this[_0x087d('0x14')]=[];this[_0x087d('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x087d('0x16')]=undefined;this[_0x087d('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x4744=['queue','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename'];(function(_0x76435b,_0x852797){var _0x23ee15=function(_0x3390d7){while(--_0x3390d7){_0x76435b['push'](_0x76435b['shift']());}};_0x23ee15(++_0x852797);}(_0x4744,0x107));var _0x4474=function(_0x2a27a7,_0x2dc55c){_0x2a27a7=_0x2a27a7-0x0;var _0x52169c=_0x4744[_0x2a27a7];return _0x52169c;};'use strict';function Channel(){this[_0x4474('0x0')]=null;this[_0x4474('0x1')]='';this['destinationchannel']='';this[_0x4474('0x2')]=0x0;this[_0x4474('0x3')]='';this[_0x4474('0x4')]=undefined;this[_0x4474('0x5')]=undefined;this[_0x4474('0x6')]=0x0;this[_0x4474('0x7')]='';this[_0x4474('0x8')]=0x0;this[_0x4474('0x9')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x4474('0xa')]=null;this[_0x4474('0xb')]=null;this[_0x4474('0xc')]=![];this[_0x4474('0xd')]=![];this[_0x4474('0xe')]='';this[_0x4474('0xf')]='';this[_0x4474('0x10')]=0x0;this['billableseconds']=0x0;this[_0x4474('0x11')]=0x0;this[_0x4474('0x12')]=null;this[_0x4474('0x13')]=null;this[_0x4474('0x14')]=null;this[_0x4474('0x15')]=![];this[_0x4474('0x16')]=null;this[_0x4474('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x4474('0x18')]=0x0;}module[_0x4474('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 79374ca..942adc1 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 _0x0b6d=['type','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x2b1854,_0x4a09e4){var _0x2601d1=function(_0xb34425){while(--_0xb34425){_0x2b1854['push'](_0x2b1854['shift']());}};_0x2601d1(++_0x4a09e4);}(_0x0b6d,0xc3));var _0xd0b6=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x0b6d[_0x35da42];return _0x370035;};'use strict';function DeskAccount(_0x16c867){this['id']=_0x16c867['id']||0x0;this['name']=_0x16c867[_0xd0b6('0x0')]||'';this[_0xd0b6('0x1')]=_0x16c867[_0xd0b6('0x1')]||'';this[_0xd0b6('0x2')]=_0x16c867['remoteUri']||'';this[_0xd0b6('0x3')]=_0x16c867[_0xd0b6('0x3')]||'';this[_0xd0b6('0x4')]=_0x16c867['password']||'';this['consumerKey']=_0x16c867[_0xd0b6('0x5')]||'';this[_0xd0b6('0x6')]=_0x16c867[_0xd0b6('0x6')]||'';this['token']=_0x16c867[_0xd0b6('0x7')]||'';this[_0xd0b6('0x8')]=_0x16c867[_0xd0b6('0x8')]||'';this[_0xd0b6('0x9')]=_0x16c867[_0xd0b6('0x9')]||'';this['serverUrl']=_0x16c867['serverUrl']||'';this[_0xd0b6('0xa')]=_0x16c867[_0xd0b6('0xa')]||{};}module[_0xd0b6('0xb')]=DeskAccount; \ No newline at end of file +var _0x90d9=['consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x2e1d12,_0x48756b){var _0x3564c8=function(_0x474233){while(--_0x474233){_0x2e1d12['push'](_0x2e1d12['shift']());}};_0x3564c8(++_0x48756b);}(_0x90d9,0x1cf));var _0x990d=function(_0xe7fa69,_0x35e237){_0xe7fa69=_0xe7fa69-0x0;var _0x458b0d=_0x90d9[_0xe7fa69];return _0x458b0d;};'use strict';function DeskAccount(_0x4bf02b){this['id']=_0x4bf02b['id']||0x0;this[_0x990d('0x0')]=_0x4bf02b[_0x990d('0x0')]||'';this['username']=_0x4bf02b[_0x990d('0x1')]||'';this[_0x990d('0x2')]=_0x4bf02b[_0x990d('0x2')]||'';this['authType']=_0x4bf02b[_0x990d('0x3')]||'';this[_0x990d('0x4')]=_0x4bf02b[_0x990d('0x4')]||'';this[_0x990d('0x5')]=_0x4bf02b[_0x990d('0x5')]||'';this['consumerSecret']=_0x4bf02b['consumerSecret']||'';this[_0x990d('0x6')]=_0x4bf02b[_0x990d('0x6')]||'';this[_0x990d('0x7')]=_0x4bf02b[_0x990d('0x7')]||'';this[_0x990d('0x8')]=_0x4bf02b['type']||'';this[_0x990d('0x9')]=_0x4bf02b['serverUrl']||'';this[_0x990d('0xa')]=_0x4bf02b[_0x990d('0xa')]||{};}module[_0x990d('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 d18fd6c..57b250a 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 _0x087b=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x5a9d97,_0x2eb48c){var _0x35460c=function(_0xba534){while(--_0xba534){_0x5a9d97['push'](_0x5a9d97['shift']());}};_0x35460c(++_0x2eb48c);}(_0x087b,0x11a));var _0xb087=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x087b[_0x2aea9e];return _0x430b92;};'use strict';function Dynamics365Account(_0x534915){this['id']=_0x534915['id']||0x0;this[_0xb087('0x0')]=_0x534915['name']||'';this['username']=_0x534915[_0xb087('0x1')]||'';this['password']=_0x534915[_0xb087('0x2')]||'';this[_0xb087('0x3')]=_0x534915[_0xb087('0x3')]||'';this[_0xb087('0x4')]=_0x534915[_0xb087('0x4')]||'';this[_0xb087('0x5')]=_0x534915[_0xb087('0x5')]||'';this[_0xb087('0x6')]=_0x534915[_0xb087('0x6')]||{};this[_0xb087('0x7')]=_0x534915[_0xb087('0x7')]||'';this[_0xb087('0x8')]=_0x534915[_0xb087('0x8')]||{};}module[_0xb087('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x6324=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name','username'];(function(_0x1af3df,_0x7a5dc2){var _0x50eba3=function(_0x553a41){while(--_0x553a41){_0x1af3df['push'](_0x1af3df['shift']());}};_0x50eba3(++_0x7a5dc2);}(_0x6324,0x142));var _0x4632=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x6324[_0x92c450];return _0x2a9599;};'use strict';function Dynamics365Account(_0x3396c7){this['id']=_0x3396c7['id']||0x0;this[_0x4632('0x0')]=_0x3396c7[_0x4632('0x0')]||'';this[_0x4632('0x1')]=_0x3396c7['username']||'';this[_0x4632('0x2')]=_0x3396c7['password']||'';this[_0x4632('0x3')]=_0x3396c7['remoteUri']||'';this[_0x4632('0x4')]=_0x3396c7['tenantId']||'';this[_0x4632('0x5')]=_0x3396c7[_0x4632('0x5')]||'';this[_0x4632('0x6')]=_0x3396c7[_0x4632('0x6')]||{};this['serverUrl']=_0x3396c7[_0x4632('0x7')]||'';this[_0x4632('0x8')]=_0x3396c7[_0x4632('0x8')]||{};}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 87460c2..f06615a 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 _0x2c99=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0xe2cbd3,_0x678694){var _0x5155e3=function(_0x3418e1){while(--_0x3418e1){_0xe2cbd3['push'](_0xe2cbd3['shift']());}};_0x5155e3(++_0x678694);}(_0x2c99,0xd9));var _0x92c9=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x2c99[_0x2d2c16];return _0x53f2fb;};'use strict';function FaxAccount(_0x11ef01){this['id']=_0x11ef01['id']||0x0;this[_0x92c9('0x0')]=_0x11ef01['name']||'';this[_0x92c9('0x1')]=_0x11ef01['description'];this['ecm']=_0x11ef01[_0x92c9('0x2')];this[_0x92c9('0x3')]=_0x11ef01['headerinfo'];this[_0x92c9('0x4')]=_0x11ef01['localstationid'];this['minrate']=_0x11ef01[_0x92c9('0x5')]||0x960;this[_0x92c9('0x6')]=_0x11ef01['maxrate']||0x3840;this[_0x92c9('0x7')]=_0x11ef01['modem']||_0x92c9('0x8');this[_0x92c9('0x9')]=_0x11ef01[_0x92c9('0x9')]||'no';this[_0x92c9('0xa')]=_0x11ef01[_0x92c9('0xa')]||'no';this[_0x92c9('0xb')]=_0x11ef01[_0x92c9('0xb')]||0x1388;this[_0x92c9('0xc')]=_0x11ef01[_0x92c9('0xc')]||_0x92c9('0xd');this[_0x92c9('0xe')]=_0x11ef01[_0x92c9('0xe')]?_0x11ef01[_0x92c9('0xe')]:undefined;this[_0x92c9('0xf')]=_0x11ef01[_0x92c9('0xf')];this[_0x92c9('0x10')]=_0x11ef01[_0x92c9('0x10')];}module[_0x92c9('0x11')]=FaxAccount; \ No newline at end of file +var _0x0e95=['ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x0e95,0xb9));var _0x50e9=function(_0x3b29c1,_0x28b97d){_0x3b29c1=_0x3b29c1-0x0;var _0x55cf3c=_0x0e95[_0x3b29c1];return _0x55cf3c;};'use strict';function FaxAccount(_0x4612d5){this['id']=_0x4612d5['id']||0x0;this[_0x50e9('0x0')]=_0x4612d5[_0x50e9('0x0')]||'';this[_0x50e9('0x1')]=_0x4612d5[_0x50e9('0x1')];this[_0x50e9('0x2')]=_0x4612d5[_0x50e9('0x2')];this[_0x50e9('0x3')]=_0x4612d5[_0x50e9('0x3')];this[_0x50e9('0x4')]=_0x4612d5[_0x50e9('0x4')];this[_0x50e9('0x5')]=_0x4612d5[_0x50e9('0x5')]||0x960;this['maxrate']=_0x4612d5[_0x50e9('0x6')]||0x3840;this['modem']=_0x4612d5['modem']||_0x50e9('0x7');this[_0x50e9('0x8')]=_0x4612d5[_0x50e9('0x8')]||'no';this['faxdetect']=_0x4612d5[_0x50e9('0x9')]||'no';this[_0x50e9('0xa')]=_0x4612d5[_0x50e9('0xa')]||0x1388;this[_0x50e9('0xb')]=_0x4612d5[_0x50e9('0xb')]||_0x50e9('0xc');this['Trunk']=_0x4612d5[_0x50e9('0xd')]?_0x4612d5['Trunk']:undefined;this[_0x50e9('0xe')]=_0x4612d5[_0x50e9('0xe')];this[_0x50e9('0xf')]=_0x4612d5['key'];}module[_0x50e9('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c1bac63..f3379a2 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 _0x8815=['Configurations','name','username','apiKey','token'];(function(_0x195eb3,_0x59180c){var _0x36ea03=function(_0x5f583d){while(--_0x5f583d){_0x195eb3['push'](_0x195eb3['shift']());}};_0x36ea03(++_0x59180c);}(_0x8815,0xe7));var _0x5881=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x8815[_0x650e11];return _0x1a9b47;};'use strict';function FreshdeskAccount(_0x282e38){this['id']=_0x282e38['id']||0x0;this[_0x5881('0x0')]=_0x282e38[_0x5881('0x0')]||'';this[_0x5881('0x1')]=_0x282e38['username']||'';this[_0x5881('0x2')]=_0x282e38[_0x5881('0x3')]||'';this['remoteUri']=_0x282e38['remoteUri']||'';this['serverUrl']=_0x282e38['serverUrl']||'';this[_0x5881('0x4')]=_0x282e38['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xa24b=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0xa24b,0x1dd));var _0xba24=function(_0x3b6301,_0x2b6f3a){_0x3b6301=_0x3b6301-0x0;var _0xc1993e=_0xa24b[_0x3b6301];return _0xc1993e;};'use strict';function FreshdeskAccount(_0x5bc614){this['id']=_0x5bc614['id']||0x0;this[_0xba24('0x0')]=_0x5bc614[_0xba24('0x0')]||'';this[_0xba24('0x1')]=_0x5bc614[_0xba24('0x1')]||'';this[_0xba24('0x2')]=_0x5bc614[_0xba24('0x3')]||'';this[_0xba24('0x4')]=_0x5bc614[_0xba24('0x4')]||'';this[_0xba24('0x5')]=_0x5bc614['serverUrl']||'';this[_0xba24('0x6')]=_0x5bc614[_0xba24('0x6')]||{};}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 234feda..2e1aefa 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 _0x3ca4=['serverUrl','Configurations','exports','name','apiKey','token','remoteUri'];(function(_0x3cecda,_0x301ce){var _0x7f0084=function(_0x213441){while(--_0x213441){_0x3cecda['push'](_0x3cecda['shift']());}};_0x7f0084(++_0x301ce);}(_0x3ca4,0x17d));var _0x43ca=function(_0x38790e,_0x38f09d){_0x38790e=_0x38790e-0x0;var _0x21c2c0=_0x3ca4[_0x38790e];return _0x21c2c0;};'use strict';function FreshsalesAccount(_0x5e57e9){this['id']=_0x5e57e9['id']||0x0;this[_0x43ca('0x0')]=_0x5e57e9[_0x43ca('0x0')]||'';this['username']=_0x5e57e9['username']||'';this[_0x43ca('0x1')]=_0x5e57e9[_0x43ca('0x2')]||'';this[_0x43ca('0x3')]=_0x5e57e9[_0x43ca('0x3')]||'';this[_0x43ca('0x4')]=_0x5e57e9[_0x43ca('0x4')]||'';this[_0x43ca('0x5')]=_0x5e57e9['Configurations']||{};}module[_0x43ca('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x39d9=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x39d9,0x17f));var _0x939d=function(_0x335f70,_0x35650f){_0x335f70=_0x335f70-0x0;var _0x526ffb=_0x39d9[_0x335f70];return _0x526ffb;};'use strict';function FreshsalesAccount(_0x40fe82){this['id']=_0x40fe82['id']||0x0;this[_0x939d('0x0')]=_0x40fe82[_0x939d('0x0')]||'';this[_0x939d('0x1')]=_0x40fe82[_0x939d('0x1')]||'';this[_0x939d('0x2')]=_0x40fe82[_0x939d('0x3')]||'';this[_0x939d('0x4')]=_0x40fe82['remoteUri']||'';this[_0x939d('0x5')]=_0x40fe82[_0x939d('0x5')]||'';this[_0x939d('0x6')]=_0x40fe82['Configurations']||{};}module[_0x939d('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 63b057f..fc5a67e 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 _0x7274=['exports','type','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','holdtime','motionChannel','voice','mohtime','variables'];(function(_0x101994,_0x27c160){var _0x370588=function(_0x1d6038){while(--_0x1d6038){_0x101994['push'](_0x101994['shift']());}};_0x370588(++_0x27c160);}(_0x7274,0x109));var _0x4727=function(_0x4c2e57,_0x1018bd){_0x4c2e57=_0x4c2e57-0x0;var _0x69364f=_0x7274[_0x4c2e57];return _0x69364f;};'use strict';function QueueReport(){this[_0x4727('0x0')]='inbound';this[_0x4727('0x1')]='';this[_0x4727('0x2')]='';this['calleridname']='';this[_0x4727('0x3')]='';this[_0x4727('0x4')]=null;this[_0x4727('0x5')]=null;this[_0x4727('0x6')]=0x1;this['count']=0x1;this[_0x4727('0x7')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x4727('0x8')]=null;this[_0x4727('0x9')]=![];this[_0x4727('0xa')]=null;this[_0x4727('0xb')]=0x1;this[_0x4727('0xc')]='';this['connectedlinenum']='';this[_0x4727('0xd')]='';this['accountcode']='';this[_0x4727('0xe')]='';this[_0x4727('0xf')]='';this['priority']='';this[_0x4727('0x10')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x4727('0x11')]=_0x4727('0x12');this[_0x4727('0x13')]=0x0;this[_0x4727('0x14')]={};}module[_0x4727('0x15')]=QueueReport; \ No newline at end of file +var _0x7c38=['accountcode','context','priority','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel'];(function(_0x6debee,_0x2a11a9){var _0x25424c=function(_0x4e4b1d){while(--_0x4e4b1d){_0x6debee['push'](_0x6debee['shift']());}};_0x25424c(++_0x2a11a9);}(_0x7c38,0x14a));var _0x87c3=function(_0x4ba7bb,_0x389c36){_0x4ba7bb=_0x4ba7bb-0x0;var _0x35fa85=_0x7c38[_0x4ba7bb];return _0x35fa85;};'use strict';function QueueReport(){this[_0x87c3('0x0')]=_0x87c3('0x1');this[_0x87c3('0x2')]='';this['calleridnum']='';this[_0x87c3('0x3')]='';this[_0x87c3('0x4')]='';this[_0x87c3('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x87c3('0x6')]=0x1;this[_0x87c3('0x7')]=0x1;this[_0x87c3('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x87c3('0x9')]=![];this[_0x87c3('0xa')]=null;this[_0x87c3('0xb')]=![];this[_0x87c3('0xc')]=null;this[_0x87c3('0xd')]=0x1;this[_0x87c3('0xe')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x87c3('0xf')]='';this[_0x87c3('0x10')]='';this['exten']='';this[_0x87c3('0x11')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x87c3('0x12')]='';this[_0x87c3('0x13')]=_0x87c3('0x14');this[_0x87c3('0x15')]=0x0;this[_0x87c3('0x16')]={};}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 8b4dc77..82edf57 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 _0x1e50=['remoteUri','password','clientSecret','securityToken','type','integrationTab','Configurations','exports','name','username'];(function(_0x2f931f,_0x62ab0b){var _0x177c5d=function(_0x13dff1){while(--_0x13dff1){_0x2f931f['push'](_0x2f931f['shift']());}};_0x177c5d(++_0x62ab0b);}(_0x1e50,0x10c));var _0x01e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e50[_0x14add3];return _0x4a174f;};'use strict';function SalesforceAccount(_0x15fb8e){this['id']=_0x15fb8e['id']||0x0;this[_0x01e5('0x0')]=_0x15fb8e[_0x01e5('0x0')]||'';this[_0x01e5('0x1')]=_0x15fb8e[_0x01e5('0x1')]||'';this[_0x01e5('0x2')]=_0x15fb8e[_0x01e5('0x2')]||'';this['password']=_0x15fb8e[_0x01e5('0x3')]||'';this['clientId']=_0x15fb8e['clientId']||'';this[_0x01e5('0x4')]=_0x15fb8e[_0x01e5('0x4')]||'';this['securityToken']=_0x15fb8e[_0x01e5('0x5')]||'';this['type']=_0x15fb8e[_0x01e5('0x6')]||_0x01e5('0x7');this['serverUrl']=_0x15fb8e['serverUrl']||'';this[_0x01e5('0x8')]=_0x15fb8e['Configurations']||{};}module[_0x01e5('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x110e=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientSecret','securityToken'];(function(_0x9b1931,_0x1c08e9){var _0x33b9f0=function(_0xe7bc7){while(--_0xe7bc7){_0x9b1931['push'](_0x9b1931['shift']());}};_0x33b9f0(++_0x1c08e9);}(_0x110e,0x68));var _0xe110=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x110e[_0x46e363];return _0x3fb059;};'use strict';function SalesforceAccount(_0x356d1c){this['id']=_0x356d1c['id']||0x0;this[_0xe110('0x0')]=_0x356d1c['name']||'';this[_0xe110('0x1')]=_0x356d1c[_0xe110('0x1')]||'';this[_0xe110('0x2')]=_0x356d1c[_0xe110('0x2')]||'';this[_0xe110('0x3')]=_0x356d1c['password']||'';this['clientId']=_0x356d1c['clientId']||'';this['clientSecret']=_0x356d1c[_0xe110('0x4')]||'';this['securityToken']=_0x356d1c[_0xe110('0x5')]||'';this[_0xe110('0x6')]=_0x356d1c[_0xe110('0x6')]||_0xe110('0x7');this[_0xe110('0x8')]=_0x356d1c[_0xe110('0x8')]||'';this[_0xe110('0x9')]=_0x356d1c[_0xe110('0x9')]||{};}module[_0xe110('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 95f9188..c356a5f 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 _0x6722=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x2dbbf2,_0x34c336){var _0x2b40ce=function(_0x1566c4){while(--_0x1566c4){_0x2dbbf2['push'](_0x2dbbf2['shift']());}};_0x2b40ce(++_0x34c336);}(_0x6722,0x1c3));var _0x2672=function(_0x48ff56,_0x544a60){_0x48ff56=_0x48ff56-0x0;var _0x4617e0=_0x6722[_0x48ff56];return _0x4617e0;};'use strict';function ServicenowAccount(_0x2e006a){this['id']=_0x2e006a['id']||0x0;this['name']=_0x2e006a[_0x2672('0x0')]||'';this['username']=_0x2e006a[_0x2672('0x1')]||'';this[_0x2672('0x2')]=_0x2e006a['password']||'';this[_0x2672('0x3')]=_0x2e006a[_0x2672('0x3')]||'';this[_0x2672('0x4')]=_0x2e006a[_0x2672('0x4')]||'';this[_0x2672('0x5')]=_0x2e006a[_0x2672('0x5')]||{};}module[_0x2672('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xe05b=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x41ec89,_0x1e5d55){var _0x5be975=function(_0x2a0eaf){while(--_0x2a0eaf){_0x41ec89['push'](_0x41ec89['shift']());}};_0x5be975(++_0x1e5d55);}(_0xe05b,0x17a));var _0xbe05=function(_0x3ff2b5,_0x431663){_0x3ff2b5=_0x3ff2b5-0x0;var _0x2b219f=_0xe05b[_0x3ff2b5];return _0x2b219f;};'use strict';function ServicenowAccount(_0x38f661){this['id']=_0x38f661['id']||0x0;this[_0xbe05('0x0')]=_0x38f661[_0xbe05('0x0')]||'';this[_0xbe05('0x1')]=_0x38f661[_0xbe05('0x1')]||'';this[_0xbe05('0x2')]=_0x38f661[_0xbe05('0x2')]||'';this[_0xbe05('0x3')]=_0x38f661['remoteUri']||'';this[_0xbe05('0x4')]=_0x38f661[_0xbe05('0x4')]||'';this[_0xbe05('0x5')]=_0x38f661[_0xbe05('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1da42c1..07af443 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 _0x56e7=['password','remoteUri','serverUrl','exports','name','username'];(function(_0x32fed7,_0x349782){var _0x4a268c=function(_0x8ebead){while(--_0x8ebead){_0x32fed7['push'](_0x32fed7['shift']());}};_0x4a268c(++_0x349782);}(_0x56e7,0x88));var _0x756e=function(_0x359992,_0x521398){_0x359992=_0x359992-0x0;var _0x399cd9=_0x56e7[_0x359992];return _0x399cd9;};'use strict';function SugarcrmAccount(_0xf22a07){this['id']=_0xf22a07['id']||0x0;this[_0x756e('0x0')]=_0xf22a07[_0x756e('0x0')]||'';this[_0x756e('0x1')]=_0xf22a07[_0x756e('0x1')]||'';this[_0x756e('0x2')]=_0xf22a07[_0x756e('0x2')]||'';this[_0x756e('0x3')]=_0xf22a07[_0x756e('0x3')]||'';this[_0x756e('0x4')]=_0xf22a07[_0x756e('0x4')]||'';this['Configurations']=_0xf22a07['Configurations']||{};}module[_0x756e('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x6419=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x54827c,_0x1dc82b){var _0xc8982b=function(_0x1fc833){while(--_0x1fc833){_0x54827c['push'](_0x54827c['shift']());}};_0xc8982b(++_0x1dc82b);}(_0x6419,0xdc));var _0x9641=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6419[_0x321bb2];return _0x9c12ed;};'use strict';function SugarcrmAccount(_0x4aa158){this['id']=_0x4aa158['id']||0x0;this[_0x9641('0x0')]=_0x4aa158['name']||'';this[_0x9641('0x1')]=_0x4aa158['username']||'';this['password']=_0x4aa158[_0x9641('0x2')]||'';this[_0x9641('0x3')]=_0x4aa158[_0x9641('0x3')]||'';this['serverUrl']=_0x4aa158[_0x9641('0x4')]||'';this[_0x9641('0x5')]=_0x4aa158['Configurations']||{};}module[_0x9641('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3c48686..278a2fb 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 _0xe195=['accountcode','state','unknown','status','address','exports','name'];(function(_0x2b404e,_0x19e954){var _0x39036e=function(_0x506cee){while(--_0x506cee){_0x2b404e['push'](_0x2b404e['shift']());}};_0x39036e(++_0x19e954);}(_0xe195,0x1c6));var _0x5e19=function(_0xa52c9a,_0x3d64c2){_0xa52c9a=_0xa52c9a-0x0;var _0x392c89=_0xe195[_0xa52c9a];return _0x392c89;};'use strict';function Telephone(_0x2394e2){this['id']=_0x2394e2['id']||0x0;this['name']=_0x2394e2[_0x5e19('0x0')]||'';this[_0x5e19('0x1')]=_0x2394e2[_0x5e19('0x1')]||'';this[_0x5e19('0x2')]=_0x5e19('0x3');this['stateTime']=0x0;this[_0x5e19('0x4')]=_0x5e19('0x3');this[_0x5e19('0x5')]='';}module[_0x5e19('0x6')]=Telephone; \ No newline at end of file +var _0x122a=['name','accountcode','stateTime','unknown','address','exports'];(function(_0x5b1976,_0x2dc5ac){var _0x30495a=function(_0xfbed64){while(--_0xfbed64){_0x5b1976['push'](_0x5b1976['shift']());}};_0x30495a(++_0x2dc5ac);}(_0x122a,0xba));var _0xa122=function(_0x3d538a,_0x1267b1){_0x3d538a=_0x3d538a-0x0;var _0x504d9e=_0x122a[_0x3d538a];return _0x504d9e;};'use strict';function Telephone(_0x1759b7){this['id']=_0x1759b7['id']||0x0;this[_0xa122('0x0')]=_0x1759b7[_0xa122('0x0')]||'';this[_0xa122('0x1')]=_0x1759b7[_0xa122('0x1')]||'';this['state']='unknown';this[_0xa122('0x2')]=0x0;this['status']=_0xa122('0x3');this[_0xa122('0x4')]='';}module[_0xa122('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b91a7bc..e995d2a 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(_0x2a4a70,_0x5f2a67){var _0x5a75dc=function(_0x3b1514){while(--_0x3b1514){_0x2a4a70['push'](_0x2a4a70['shift']());}};_0x5a75dc(++_0x5f2a67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x8c190,_0x4b4c25){var _0x2f2cda=function(_0x52993a){while(--_0x52993a){_0x8c190['push'](_0x8c190['shift']());}};_0x2f2cda(++_0x4b4c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d3491c4..44a7e54 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x553b21,_0x4a86cc){var _0x5b595e=function(_0x1b11c2){while(--_0x1b11c2){_0x553b21['push'](_0x553b21['shift']());}};_0x5b595e(++_0x4a86cc);}(_0xb10b,0x12a));var _0xbb10=function(_0xaca348,_0x4d3993){_0xaca348=_0xaca348-0x0;var _0x560057=_0xb10b[_0xaca348];return _0x560057;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 182b9ec..8d6833a 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 _0xf144=['address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','host','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x57062a,_0x123026){var _0xa178da=function(_0x1702d6){while(--_0x1702d6){_0x57062a['push'](_0x57062a['shift']());}};_0xa178da(++_0x123026);}(_0xf144,0xa3));var _0x4f14=function(_0x1ee501,_0x16537c){_0x1ee501=_0x1ee501-0x0;var _0x11fdb0=_0xf144[_0x1ee501];return _0x11fdb0;};'use strict';function Trunk(_0x44e43f){this['id']=_0x44e43f['id']||0x0;this[_0x4f14('0x0')]=_0x44e43f['active']||![];this[_0x4f14('0x1')]=_0x44e43f[_0x4f14('0x1')]||'';this[_0x4f14('0x2')]='unknown';this[_0x4f14('0x3')]=0x0;this[_0x4f14('0x4')]=_0x4f14('0x5');this['registry']=_0x44e43f[_0x4f14('0x6')]&&_0x44e43f[_0x4f14('0x6')]['indexOf'](':')?_0x44e43f[_0x4f14('0x6')]['split'](':')[0x0]:'';this[_0x4f14('0x7')]='';this['port']='';this[_0x4f14('0x8')]='';this[_0x4f14('0x9')]='';this[_0x4f14('0xa')]='';this[_0x4f14('0xb')]=_0x4f14('0x5');this[_0x4f14('0xc')]='';this[_0x4f14('0xd')]='';this[_0x4f14('0xe')]=_0x44e43f['defaultuser']||'';}module[_0x4f14('0xf')]=Trunk; \ No newline at end of file +var _0x8364=['status','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','name','state','stateTime'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x8364,0xf9));var _0x4836=function(_0x3bb7df,_0x1b5d3a){_0x3bb7df=_0x3bb7df-0x0;var _0xb10d46=_0x8364[_0x3bb7df];return _0xb10d46;};'use strict';function Trunk(_0xf12f61){this['id']=_0xf12f61['id']||0x0;this['active']=_0xf12f61['active']||![];this[_0x4836('0x0')]=_0xf12f61[_0x4836('0x0')]||'';this[_0x4836('0x1')]='unknown';this[_0x4836('0x2')]=0x0;this[_0x4836('0x3')]=_0x4836('0x4');this[_0x4836('0x5')]=_0xf12f61[_0x4836('0x5')]&&_0xf12f61[_0x4836('0x5')][_0x4836('0x6')](':')?_0xf12f61[_0x4836('0x5')][_0x4836('0x7')](':')[0x0]:'';this[_0x4836('0x8')]='';this[_0x4836('0x9')]='';this[_0x4836('0xa')]='';this[_0x4836('0xb')]='';this[_0x4836('0xc')]='';this[_0x4836('0xd')]=_0x4836('0x4');this[_0x4836('0xe')]='';this[_0x4836('0xf')]='';this[_0x4836('0x10')]=_0xf12f61[_0x4836('0x10')]||'';}module[_0x4836('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b996e7f..dab39a6 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 _0xc736=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x54d52c,_0x55b8d9){var _0x28f99e=function(_0x4e9ef1){while(--_0x4e9ef1){_0x54d52c['push'](_0x54d52c['shift']());}};_0x28f99e(++_0x55b8d9);}(_0xc736,0x6e));var _0x6c73=function(_0x2575f4,_0x298782){_0x2575f4=_0x2575f4-0x0;var _0x141c11=_0xc736[_0x2575f4];return _0x141c11;};'use strict';function voiceExtension(_0x517e6a){this['id']=_0x517e6a['id']||0x0;this[_0x6c73('0x0')]=_0x517e6a[_0x6c73('0x0')]||'';this[_0x6c73('0x1')]=_0x517e6a['recordingFormat']||_0x6c73('0x2');this[_0x6c73('0x3')]=_0x517e6a[_0x6c73('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x1c24=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x1c24,0x157));var _0x41c2=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1c24[_0x40220a];return _0x3903cc;};'use strict';function voiceExtension(_0x778011){this['id']=_0x778011['id']||0x0;this[_0x41c2('0x0')]=_0x778011[_0x41c2('0x0')]||'';this[_0x41c2('0x1')]=_0x778011['recordingFormat']||'none';this['mandatoryDisposition']=_0x778011[_0x41c2('0x2')]||![];}module[_0x41c2('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e26c6fb..f477519 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 _0x3ddf=['progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialActive','dialMethod'];(function(_0x232715,_0x4bd63e){var _0x1e6090=function(_0x1baae7){while(--_0x1baae7){_0x232715['push'](_0x232715['shift']());}};_0x1e6090(++_0x4bd63e);}(_0x3ddf,0xce));var _0xf3dd=function(_0x1016d0,_0xe93f77){_0x1016d0=_0x1016d0-0x0;var _0x398fad=_0x3ddf[_0x1016d0];return _0x398fad;};'use strict';var statusDesc=[_0xf3dd('0x0'),_0xf3dd('0x1'),_0xf3dd('0x2'),_0xf3dd('0x3'),_0xf3dd('0x4'),_0xf3dd('0x5'),_0xf3dd('0x6'),_0xf3dd('0x7'),_0xf3dd('0x8')];var monitorFormat={'wav':_0xf3dd('0x9'),'wav49':_0xf3dd('0xa'),'gsm':_0xf3dd('0xb')};var strategy={'rrmemory':_0xf3dd('0xc'),'roundrobin':_0xf3dd('0xd')};function VoiceQueue(_0x4a202a){this['id']=_0x4a202a['id']||0x0;this[_0xf3dd('0xe')]=_0x4a202a[_0xf3dd('0xe')]||'';this['monitor_format']=_0x4a202a[_0xf3dd('0xf')]||'';this['type']=_0x4a202a[_0xf3dd('0x10')]||_0xf3dd('0x11');this[_0xf3dd('0x12')]=0x0;this[_0xf3dd('0x13')]=0x0;this[_0xf3dd('0x14')]=0x0;this[_0xf3dd('0x15')]=0x0;this[_0xf3dd('0x16')]=0x0;this['sumHoldTime']=0x0;this[_0xf3dd('0x17')]=0x0;this[_0xf3dd('0x18')]=0x0;this[_0xf3dd('0x19')]=0x0;this[_0xf3dd('0x1a')]=0x0;this[_0xf3dd('0x1b')]=0x0;this[_0xf3dd('0x1c')]=_0x4a202a[_0xf3dd('0x1c')]||![];this[_0xf3dd('0x1d')]=_0x4a202a['acwTimeout']||0xa;this['autopause']=_0x4a202a[_0xf3dd('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xf3dd('0x1f')]=0x0;this[_0xf3dd('0x20')]=0x0;this[_0xf3dd('0x21')]=_0x4a202a[_0xf3dd('0x21')]||null;this['dialGlobalInterval']=_0x4a202a['dialGlobalInterval']?_0x4a202a['dialGlobalInterval']:null;this[_0xf3dd('0x22')]=_0x4a202a[_0xf3dd('0x22')];this['dialMethod']=_0x4a202a[_0xf3dd('0x23')]||_0xf3dd('0x24');this[_0xf3dd('0x25')]=_0x4a202a[_0xf3dd('0x25')]||0x0;this['dialLimitQueue']=_0x4a202a['dialLimitQueue']||0x0;this[_0xf3dd('0x26')]=_0x4a202a[_0xf3dd('0x26')]||0x1;this['dialPredictiveOptimization']=_0x4a202a[_0xf3dd('0x27')]||_0xf3dd('0x28');this[_0xf3dd('0x29')]=_0x4a202a[_0xf3dd('0x29')]||0.03;this[_0xf3dd('0x2a')]=_0x4a202a[_0xf3dd('0x2a')]||0x258;this[_0xf3dd('0x2b')]=_0x4a202a[_0xf3dd('0x2b')]||_0xf3dd('0x2c');this[_0xf3dd('0x2d')]=_0x4a202a[_0xf3dd('0x2d')]||_0xf3dd('0x2c');this['dialOriginateTimeout']=_0x4a202a[_0xf3dd('0x2e')]||0x1e;this[_0xf3dd('0x2f')]=_0x4a202a[_0xf3dd('0x2f')]||'tTxX';this[_0xf3dd('0x30')]=_0x4a202a[_0xf3dd('0x30')]||0x3;this[_0xf3dd('0x31')]=_0x4a202a['dialQueueProject']||undefined;this[_0xf3dd('0x32')]=_0x4a202a[_0xf3dd('0x32')]||0x3;this[_0xf3dd('0x33')]=_0x4a202a[_0xf3dd('0x33')]||0x96;this[_0xf3dd('0x34')]=_0x4a202a['dialBusyMaxRetry']||0x3;this[_0xf3dd('0x35')]=_0x4a202a[_0xf3dd('0x35')]||0x96;this[_0xf3dd('0x36')]=_0x4a202a[_0xf3dd('0x36')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4a202a[_0xf3dd('0x37')]||0x96;this[_0xf3dd('0x38')]=_0x4a202a[_0xf3dd('0x38')]||0x3;this[_0xf3dd('0x39')]=_0x4a202a[_0xf3dd('0x39')]||0x96;this[_0xf3dd('0x3a')]=_0x4a202a[_0xf3dd('0x3a')]||0x3;this[_0xf3dd('0x3b')]=_0x4a202a[_0xf3dd('0x3b')]||0x96;this[_0xf3dd('0x3c')]=_0x4a202a['dialAbandonedMaxRetry']||0x3;this[_0xf3dd('0x3d')]=_0x4a202a[_0xf3dd('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x4a202a['dialMachineMaxRetry']||0x3;this[_0xf3dd('0x3e')]=_0x4a202a[_0xf3dd('0x3e')]||0x96;this['dialAgentRejectMaxRetry']=_0x4a202a[_0xf3dd('0x3f')]||0x3;this[_0xf3dd('0x40')]=_0x4a202a[_0xf3dd('0x40')]||0x96;this['dialGlobalMaxRetry']=_0x4a202a[_0xf3dd('0x41')]||0x4;this[_0xf3dd('0x42')]=_0x4a202a[_0xf3dd('0x42')]?_0x4a202a[_0xf3dd('0x42')]:undefined;this[_0xf3dd('0x43')]=_0x4a202a[_0xf3dd('0x43')]?_0x4a202a['TrunkBackup']:undefined;this[_0xf3dd('0x44')]=_0x4a202a[_0xf3dd('0x44')]||undefined;this[_0xf3dd('0x45')]=_0x4a202a[_0xf3dd('0x45')]?_0x4a202a['Interval']:undefined;this[_0xf3dd('0x46')]=_0x4a202a[_0xf3dd('0x46')]||_0xf3dd('0x47');this[_0xf3dd('0x48')]=_0x4a202a[_0xf3dd('0x48')]||undefined;this['dialCutDigit']=_0x4a202a['dialCutDigit']||undefined;this['strategy']=strategy[_0x4a202a[_0xf3dd('0x49')]]||_0xf3dd('0xc');this[_0xf3dd('0x4a')]=!![];this[_0xf3dd('0x4b')]=_0x4a202a[_0xf3dd('0x4b')]||![];this[_0xf3dd('0x4c')]=_0x4a202a[_0xf3dd('0x4c')];this[_0xf3dd('0x4d')]=_0x4a202a[_0xf3dd('0x4d')];this[_0xf3dd('0x4e')]=_0x4a202a[_0xf3dd('0x4e')];this[_0xf3dd('0x4f')]=_0x4a202a['dialAMDTotalAnalysisTime'];this[_0xf3dd('0x50')]=_0x4a202a[_0xf3dd('0x50')];this[_0xf3dd('0x51')]=_0x4a202a['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x4a202a['dialAMDMaximumNumberOfWords'];this[_0xf3dd('0x52')]=_0x4a202a['dialAMDSilenceThreshold'];this[_0xf3dd('0x53')]=_0x4a202a['dialAMDMaximumWordLength'];this[_0xf3dd('0x54')]=0x0;this['pTalking']=0x0;this[_0xf3dd('0x55')]=_0x4a202a['timeout'];this[_0xf3dd('0x56')]=0x0;this[_0xf3dd('0x57')]=0x0;this[_0xf3dd('0x58')]=0x0;this[_0xf3dd('0x59')]=0x0;this[_0xf3dd('0x5a')]=0x0;this[_0xf3dd('0x5b')]=0x0;this[_0xf3dd('0x5c')]=0x0;this[_0xf3dd('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xf3dd('0x5e')]=0x0;this[_0xf3dd('0x5f')]=0x0;this[_0xf3dd('0x60')]=0x0;this[_0xf3dd('0x61')]=undefined;this[_0xf3dd('0x62')]=undefined;this['handlePredictive']=undefined;this[_0xf3dd('0x63')]=1.05;this[_0xf3dd('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xf3dd('0x65')]=0x0;this[_0xf3dd('0x66')]=0x0;this[_0xf3dd('0x67')]=0x0;this[_0xf3dd('0x68')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xf3dd('0x69')]=0x0;this[_0xf3dd('0x6a')]=_0x4a202a['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x4a202a['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xf3dd('0x6b')]=0x0;this[_0xf3dd('0x6c')]=0x0;this[_0xf3dd('0x6d')]=0x1;this['erlangCalls']=0x0;this[_0xf3dd('0x6e')]=0x0;this[_0xf3dd('0x6f')]=0x0;this[_0xf3dd('0x70')]=0x0;this[_0xf3dd('0x71')]=_0x4a202a['dialRecallMeTimeout']||0x1e;this[_0xf3dd('0x72')]=_0x4a202a[_0xf3dd('0x72')]||![];this[_0xf3dd('0x73')]=!!_0x4a202a[_0xf3dd('0x73')]||![];this['dialQueueProject2']=_0x4a202a[_0xf3dd('0x74')]||undefined;this[_0xf3dd('0x75')]=_0x4a202a[_0xf3dd('0x75')]||![];this[_0xf3dd('0x76')]=_0x4a202a['dialAgiAfterHangupAgent']||![];this[_0xf3dd('0xf')]=monitorFormat[_0x4a202a[_0xf3dd('0xf')]]?monitorFormat[_0x4a202a[_0xf3dd('0xf')]]:undefined;this['mandatoryDisposition']=_0x4a202a[_0xf3dd('0x77')]||![];this[_0xf3dd('0x78')]=_0x4a202a[_0xf3dd('0x78')]?_0x4a202a[_0xf3dd('0x78')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xf503=['predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','onhold','wav','wav49','gsm','roundrobin','name','type','inbound','waiting','talking','total','answered','sumHoldTime','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','handlePredictive'];(function(_0x3ab23e,_0x40cd70){var _0x29761e=function(_0x5162c8){while(--_0x5162c8){_0x3ab23e['push'](_0x3ab23e['shift']());}};_0x29761e(++_0x40cd70);}(_0xf503,0x8e));var _0x3f50=function(_0x5162ac,_0x2eb0fc){_0x5162ac=_0x5162ac-0x0;var _0x2ac921=_0xf503[_0x5162ac];return _0x2ac921;};'use strict';var statusDesc=[_0x3f50('0x0'),_0x3f50('0x1'),_0x3f50('0x2'),'busy',_0x3f50('0x3'),_0x3f50('0x4'),_0x3f50('0x5'),'ringinuse',_0x3f50('0x6')];var monitorFormat={'wav':_0x3f50('0x7'),'wav49':_0x3f50('0x8'),'gsm':_0x3f50('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x3f50('0xa')};function VoiceQueue(_0x50cae3){this['id']=_0x50cae3['id']||0x0;this['name']=_0x50cae3[_0x3f50('0xb')]||'';this['monitor_format']=_0x50cae3['monitor_format']||'';this['type']=_0x50cae3[_0x3f50('0xc')]||_0x3f50('0xd');this[_0x3f50('0xe')]=0x0;this[_0x3f50('0xf')]=0x0;this[_0x3f50('0x10')]=0x0;this[_0x3f50('0x11')]=0x0;this['sumDuration']=0x0;this[_0x3f50('0x12')]=0x0;this['sumBillable']=0x0;this[_0x3f50('0x13')]=0x0;this[_0x3f50('0x14')]=0x0;this['loggedIn']=0x0;this[_0x3f50('0x15')]=0x0;this[_0x3f50('0x16')]=_0x50cae3['acw']||![];this[_0x3f50('0x17')]=_0x50cae3[_0x3f50('0x17')]||0xa;this[_0x3f50('0x18')]=_0x50cae3[_0x3f50('0x18')]||'no';this[_0x3f50('0x19')]=!![];this['message']='';this[_0x3f50('0x1a')]=0x0;this[_0x3f50('0x1b')]=0x0;this[_0x3f50('0x1c')]=_0x50cae3[_0x3f50('0x1c')]||null;this[_0x3f50('0x1d')]=_0x50cae3['dialGlobalInterval']?_0x50cae3['dialGlobalInterval']:null;this[_0x3f50('0x1e')]=_0x50cae3[_0x3f50('0x1e')];this[_0x3f50('0x1f')]=_0x50cae3[_0x3f50('0x1f')]||'progressive';this[_0x3f50('0x20')]=_0x50cae3['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x50cae3[_0x3f50('0x21')]||0x0;this['dialPowerLevel']=_0x50cae3[_0x3f50('0x22')]||0x1;this[_0x3f50('0x23')]=_0x50cae3[_0x3f50('0x23')]||_0x3f50('0x24');this[_0x3f50('0x25')]=_0x50cae3[_0x3f50('0x25')]||0.03;this[_0x3f50('0x26')]=_0x50cae3[_0x3f50('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x50cae3[_0x3f50('0x27')]||_0x3f50('0x28');this[_0x3f50('0x29')]=_0x50cae3[_0x3f50('0x29')]||_0x3f50('0x28');this[_0x3f50('0x2a')]=_0x50cae3['dialOriginateTimeout']||0x1e;this[_0x3f50('0x2b')]=_0x50cae3[_0x3f50('0x2b')]||_0x3f50('0x2c');this['dialQueueTimeout']=_0x50cae3[_0x3f50('0x2d')]||0x3;this[_0x3f50('0x2e')]=_0x50cae3['dialQueueProject']||undefined;this[_0x3f50('0x2f')]=_0x50cae3[_0x3f50('0x2f')]||0x3;this[_0x3f50('0x30')]=_0x50cae3['dialCongestionRetryFrequency']||0x96;this[_0x3f50('0x31')]=_0x50cae3[_0x3f50('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x50cae3[_0x3f50('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x50cae3['dialNoAnswerMaxRetry']||0x3;this[_0x3f50('0x33')]=_0x50cae3[_0x3f50('0x33')]||0x96;this[_0x3f50('0x34')]=_0x50cae3[_0x3f50('0x34')]||0x3;this[_0x3f50('0x35')]=_0x50cae3[_0x3f50('0x35')]||0x96;this[_0x3f50('0x36')]=_0x50cae3['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x50cae3[_0x3f50('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x50cae3[_0x3f50('0x38')]||0x3;this[_0x3f50('0x39')]=_0x50cae3[_0x3f50('0x39')]||0x96;this[_0x3f50('0x3a')]=_0x50cae3[_0x3f50('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x50cae3[_0x3f50('0x3b')]||0x96;this[_0x3f50('0x3c')]=_0x50cae3[_0x3f50('0x3c')]||0x3;this[_0x3f50('0x3d')]=_0x50cae3[_0x3f50('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x50cae3['dialGlobalMaxRetry']||0x4;this[_0x3f50('0x3e')]=_0x50cae3['Trunk']?_0x50cae3[_0x3f50('0x3e')]:undefined;this[_0x3f50('0x3f')]=_0x50cae3[_0x3f50('0x3f')]?_0x50cae3[_0x3f50('0x3f')]:undefined;this[_0x3f50('0x40')]=_0x50cae3[_0x3f50('0x40')]||undefined;this[_0x3f50('0x41')]=_0x50cae3[_0x3f50('0x41')]?_0x50cae3['Interval']:undefined;this[_0x3f50('0x42')]=_0x50cae3['dialOrderByScheduledAt']||_0x3f50('0x43');this[_0x3f50('0x44')]=_0x50cae3[_0x3f50('0x44')]||undefined;this[_0x3f50('0x45')]=_0x50cae3[_0x3f50('0x45')]||undefined;this[_0x3f50('0x46')]=strategy[_0x50cae3['strategy']]||_0x3f50('0x47');this[_0x3f50('0x48')]=!![];this[_0x3f50('0x49')]=_0x50cae3['dialAMDActive']||![];this[_0x3f50('0x4a')]=_0x50cae3[_0x3f50('0x4a')];this[_0x3f50('0x4b')]=_0x50cae3[_0x3f50('0x4b')];this['dialAMDAfterGreetingSilence']=_0x50cae3[_0x3f50('0x4c')];this['dialAMDTotalAnalysisTime']=_0x50cae3[_0x3f50('0x4d')];this[_0x3f50('0x4e')]=_0x50cae3[_0x3f50('0x4e')];this[_0x3f50('0x4f')]=_0x50cae3[_0x3f50('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x50cae3[_0x3f50('0x50')];this[_0x3f50('0x51')]=_0x50cae3[_0x3f50('0x51')];this['dialAMDMaximumWordLength']=_0x50cae3[_0x3f50('0x52')];this[_0x3f50('0x53')]=0x0;this['pTalking']=0x0;this[_0x3f50('0x54')]=_0x50cae3[_0x3f50('0x54')];this[_0x3f50('0x55')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x3f50('0x56')]=0x0;this[_0x3f50('0x57')]=0x0;this[_0x3f50('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x3f50('0x59')]=0x0;this[_0x3f50('0x5a')]=0x0;this[_0x3f50('0x5b')]=0x0;this[_0x3f50('0x5c')]=0x0;this[_0x3f50('0x5d')]=0x0;this[_0x3f50('0x5e')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x3f50('0x5f')]=undefined;this[_0x3f50('0x60')]=1.05;this[_0x3f50('0x61')]=0x0;this[_0x3f50('0x62')]=0x0;this[_0x3f50('0x63')]=0x0;this[_0x3f50('0x64')]=0x0;this[_0x3f50('0x65')]=0x0;this[_0x3f50('0x66')]=0x0;this[_0x3f50('0x67')]=0x0;this[_0x3f50('0x68')]=0x0;this['predictiveIntervalMaxThreshold']=_0x50cae3['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x50cae3['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x3f50('0x69')]=0x0;this[_0x3f50('0x6a')]=0x1;this[_0x3f50('0x6b')]=0x0;this['erlangCallToSecond']=0x0;this[_0x3f50('0x6c')]=0x0;this[_0x3f50('0x6d')]=0x0;this['dialRecallMeTimeout']=_0x50cae3['dialRecallMeTimeout']||0x1e;this[_0x3f50('0x6e')]=_0x50cae3['dialRecallInQueue']||![];this[_0x3f50('0x6f')]=!!_0x50cae3[_0x3f50('0x6f')]||![];this[_0x3f50('0x70')]=_0x50cae3['dialQueueProject2']||undefined;this[_0x3f50('0x71')]=_0x50cae3[_0x3f50('0x71')]||![];this['dialAgiAfterHangupAgent']=_0x50cae3[_0x3f50('0x72')]||![];this['monitor_format']=monitorFormat[_0x50cae3[_0x3f50('0x73')]]?monitorFormat[_0x50cae3[_0x3f50('0x73')]]:undefined;this[_0x3f50('0x74')]=_0x50cae3[_0x3f50('0x74')]||![];this['mandatoryDispositionPause']=_0x50cae3[_0x3f50('0x75')]?_0x50cae3['mandatoryDispositionPause']:undefined;}module[_0x3f50('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d40e7b7..c93d10a 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 _0xf1c4=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x5780bf,_0x346ec9){var _0x3e470e=function(_0x647b57){while(--_0x647b57){_0x5780bf['push'](_0x5780bf['shift']());}};_0x3e470e(++_0x346ec9);}(_0xf1c4,0xfc));var _0x4f1c=function(_0x4c33e0,_0x3ed337){_0x4c33e0=_0x4c33e0-0x0;var _0x51ff68=_0xf1c4[_0x4c33e0];return _0x51ff68;};'use strict';function VtigerAccount(_0x53cfb7){this['id']=_0x53cfb7['id']||0x0;this['name']=_0x53cfb7[_0x4f1c('0x0')]||'';this[_0x4f1c('0x1')]=_0x53cfb7[_0x4f1c('0x1')]||'';this['accessKey']=_0x53cfb7['accessKey']||'';this['remoteUri']=_0x53cfb7[_0x4f1c('0x2')]||'';this[_0x4f1c('0x3')]=_0x53cfb7['serverUrl']||'';this[_0x4f1c('0x4')]=_0x53cfb7[_0x4f1c('0x4')]||{};}module[_0x4f1c('0x5')]=VtigerAccount; \ No newline at end of file +var _0xaaa1=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x24e5ed,_0x2fc728){var _0x22249e=function(_0x305149){while(--_0x305149){_0x24e5ed['push'](_0x24e5ed['shift']());}};_0x22249e(++_0x2fc728);}(_0xaaa1,0x116));var _0x1aaa=function(_0x2bac9e,_0x450524){_0x2bac9e=_0x2bac9e-0x0;var _0x38eef6=_0xaaa1[_0x2bac9e];return _0x38eef6;};'use strict';function VtigerAccount(_0x46f738){this['id']=_0x46f738['id']||0x0;this[_0x1aaa('0x0')]=_0x46f738[_0x1aaa('0x0')]||'';this[_0x1aaa('0x1')]=_0x46f738[_0x1aaa('0x1')]||'';this[_0x1aaa('0x2')]=_0x46f738[_0x1aaa('0x2')]||'';this['remoteUri']=_0x46f738[_0x1aaa('0x3')]||'';this[_0x1aaa('0x4')]=_0x46f738[_0x1aaa('0x4')]||'';this[_0x1aaa('0x5')]=_0x46f738[_0x1aaa('0x5')]||{};}module[_0x1aaa('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 4bc3190..1b5add3 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 _0xa6f6=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x2208a5,_0x5269a9){var _0x387115=function(_0x491487){while(--_0x491487){_0x2208a5['push'](_0x2208a5['shift']());}};_0x387115(++_0x5269a9);}(_0xa6f6,0x12f));var _0x6a6f=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xa6f6[_0x5627e1];return _0x2f013f;};'use strict';function ZendeskAccount(_0x4ff88e){this['id']=_0x4ff88e['id']||0x0;this[_0x6a6f('0x0')]=_0x4ff88e['name']||'';this[_0x6a6f('0x1')]=_0x4ff88e[_0x6a6f('0x1')]||'';this[_0x6a6f('0x2')]=_0x4ff88e[_0x6a6f('0x2')]||'';this[_0x6a6f('0x3')]=_0x4ff88e[_0x6a6f('0x3')]||'';this[_0x6a6f('0x4')]=_0x4ff88e[_0x6a6f('0x4')]||'';this[_0x6a6f('0x5')]=_0x4ff88e['authType']||'';this[_0x6a6f('0x6')]=_0x4ff88e[_0x6a6f('0x6')]||_0x6a6f('0x7');this[_0x6a6f('0x8')]=_0x4ff88e[_0x6a6f('0x8')]||'';this['Configurations']=_0x4ff88e[_0x6a6f('0x9')]||{};}module[_0x6a6f('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x4629=['remoteUri','authType','type','Configurations','exports','name','username','password'];(function(_0x15d4bf,_0x4eaf33){var _0x4bbf00=function(_0x1119a3){while(--_0x1119a3){_0x15d4bf['push'](_0x15d4bf['shift']());}};_0x4bbf00(++_0x4eaf33);}(_0x4629,0x1dd));var _0x9462=function(_0x109a90,_0x489fcc){_0x109a90=_0x109a90-0x0;var _0x58dffc=_0x4629[_0x109a90];return _0x58dffc;};'use strict';function ZendeskAccount(_0x45367b){this['id']=_0x45367b['id']||0x0;this[_0x9462('0x0')]=_0x45367b['name']||'';this[_0x9462('0x1')]=_0x45367b['username']||'';this[_0x9462('0x2')]=_0x45367b['password']||'';this['token']=_0x45367b['token']||'';this[_0x9462('0x3')]=_0x45367b[_0x9462('0x3')]||'';this[_0x9462('0x4')]=_0x45367b[_0x9462('0x4')]||'';this[_0x9462('0x5')]=_0x45367b[_0x9462('0x5')]||'integrationTab';this['serverUrl']=_0x45367b['serverUrl']||'';this['Configurations']=_0x45367b[_0x9462('0x6')]||{};}module[_0x9462('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index edd9b90..00f32f8 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 _0xefb0=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','serverUrl'];(function(_0x30113d,_0x104acb){var _0x54d736=function(_0x42e856){while(--_0x42e856){_0x30113d['push'](_0x30113d['shift']());}};_0x54d736(++_0x104acb);}(_0xefb0,0x90));var _0x0efb=function(_0x42f243,_0x24f96d){_0x42f243=_0x42f243-0x0;var _0x357011=_0xefb0[_0x42f243];return _0x357011;};'use strict';function ZohoAccount(_0x4dc62c){this['id']=_0x4dc62c['id']||0x0;this['name']=_0x4dc62c[_0x0efb('0x0')]||'';this[_0x0efb('0x1')]=_0x4dc62c[_0x0efb('0x1')]||'';this[_0x0efb('0x2')]=_0x4dc62c[_0x0efb('0x2')]||'';this[_0x0efb('0x3')]=_0x4dc62c[_0x0efb('0x3')]||'';this[_0x0efb('0x4')]=_0x4dc62c[_0x0efb('0x4')]||'';this['clientSecret']=_0x4dc62c['clientSecret']||'';this[_0x0efb('0x5')]=_0x4dc62c['serverUrl']||'';this[_0x0efb('0x6')]=_0x4dc62c[_0x0efb('0x6')]||'';this[_0x0efb('0x7')]=_0x4dc62c[_0x0efb('0x7')]||'';this[_0x0efb('0x8')]=_0x4dc62c[_0x0efb('0x8')]||{};}module[_0x0efb('0x9')]=ZohoAccount; \ No newline at end of file +var _0x6a3e=['serverUrl','code','refreshToken','Configurations','exports','host','zone','clientSecret'];(function(_0x1236f6,_0xdda6c1){var _0x2529b6=function(_0x52556f){while(--_0x52556f){_0x1236f6['push'](_0x1236f6['shift']());}};_0x2529b6(++_0xdda6c1);}(_0x6a3e,0x1d5));var _0xe6a3=function(_0x1cffd5,_0xf5acf7){_0x1cffd5=_0x1cffd5-0x0;var _0x55d36b=_0x6a3e[_0x1cffd5];return _0x55d36b;};'use strict';function ZohoAccount(_0x28ffb5){this['id']=_0x28ffb5['id']||0x0;this['name']=_0x28ffb5['name']||'';this['description']=_0x28ffb5['description']||'';this['host']=_0x28ffb5[_0xe6a3('0x0')]||'';this[_0xe6a3('0x1')]=_0x28ffb5['zone']||'';this['clientId']=_0x28ffb5['clientId']||'';this[_0xe6a3('0x2')]=_0x28ffb5[_0xe6a3('0x2')]||'';this[_0xe6a3('0x3')]=_0x28ffb5[_0xe6a3('0x3')]||'';this[_0xe6a3('0x4')]=_0x28ffb5[_0xe6a3('0x4')]||'';this['refreshToken']=_0x28ffb5[_0xe6a3('0x5')]||'';this[_0xe6a3('0x6')]=_0x28ffb5[_0xe6a3('0x6')]||{};}module[_0xe6a3('0x7')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index a4bc4c1..dc688d0 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 _0x67b0=['campaigntype','Agent','membername','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridname','prototype','getCaller','exports','lodash','moment','isNil','string','idContact','queue','name','type'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x67b0,0x1b0));var _0x067b=function(_0x34e74b,_0x3f1ec8){_0x34e74b=_0x34e74b-0x0;var _0x400d2e=_0x67b0[_0x34e74b];return _0x400d2e;};'use strict';var util=require('util');var _=require(_0x067b('0x0'));var moment=require(_0x067b('0x1'));function checkNameSurname(_0xebf511,_0x258fde,_0x33b7db){var _0x2c259f='';if(!_[_0x067b('0x2')](_0x258fde)&&_0x067b('0x3')===typeof _0x258fde){_0x2c259f+=_0x258fde;}if(!_[_0x067b('0x2')](_0x33b7db)&&_0x067b('0x3')===typeof _0x33b7db){_0x2c259f+='\x20'+_0x33b7db;}if(_0x2c259f!==''){return _0x2c259f;}return _0xebf511;}function Action(_0x97cf0c,_0x2febfb,_0x12a415,_0xaacae8,_0x3d2095){this['uniqueid']=_0x12a415||undefined;this[_0x067b('0x4')]=_0x97cf0c['id'];this[_0x067b('0x5')]=_0x2febfb[_0x067b('0x6')];this[_0x067b('0x7')]=_0x2febfb[_0x067b('0x7')];this[_0x067b('0x8')]='queue';this['dialAnswer']=![];this['membername']=_[_0x067b('0x2')](_0x97cf0c[_0x067b('0x9')])?undefined:_0x97cf0c[_0x067b('0x9')][_0x067b('0x6')];this['channelAgent']=this[_0x067b('0xa')]?util[_0x067b('0xb')](_0x067b('0xc'),this[_0x067b('0xa')]):_0xaacae8||undefined;this[_0x067b('0xd')]=checkNameSurname(_0x97cf0c[_0x067b('0xe')]['phone'],_0x97cf0c[_0x067b('0xe')][_0x067b('0xf')],_0x97cf0c[_0x067b('0xe')][_0x067b('0x10')]);this[_0x067b('0x11')]=_0x97cf0c['active']||![];this[_0x067b('0x12')]=_0x97cf0c[_0x067b('0xe')]['phone'];this[_0x067b('0x13')]=_0x97cf0c[_0x067b('0x13')];this[_0x067b('0x14')]=_0x97cf0c[_0x067b('0x14')]||0x0;this[_0x067b('0x15')]=_0x97cf0c['countcongestionretry']||0x0;this[_0x067b('0x16')]=_0x97cf0c[_0x067b('0x16')]||0x0;this[_0x067b('0x17')]=(_0x97cf0c[_0x067b('0x14')]||0x0)+(_0x97cf0c[_0x067b('0x15')]||0x0)+(_0x97cf0c['countnoanswerretry']||0x0)+(_0x97cf0c[_0x067b('0x18')]||0x0)+(_0x97cf0c[_0x067b('0x19')]||0x0)+(_0x97cf0c[_0x067b('0x1a')]||0x0)+(_0x97cf0c[_0x067b('0x1b')]||0x0)+(_0x97cf0c[_0x067b('0x1c')]||0x0);this[_0x067b('0x18')]=_0x97cf0c['countnosuchnumberretry']||0x0;this['countdropretry']=_0x97cf0c[_0x067b('0x19')]||0x0;this['countabandonedretry']=_0x97cf0c[_0x067b('0x1a')]||0x0;this[_0x067b('0x1b')]=_0x97cf0c[_0x067b('0x1b')]||0x0;this[_0x067b('0x1c')]=_0x97cf0c[_0x067b('0x1c')]||0x0;this[_0x067b('0x1d')]=_0x97cf0c['callback'];this[_0x067b('0x1e')]=_0x97cf0c[_0x067b('0x1e')];this[_0x067b('0x1f')]=_0x97cf0c[_0x067b('0x1f')];this[_0x067b('0x20')]=_0x97cf0c[_0x067b('0x20')];this[_0x067b('0x21')]=_0x97cf0c[_0x067b('0x21')];this[_0x067b('0x22')]=_0x97cf0c[_0x067b('0x22')];this['UserId']=_[_0x067b('0x2')](_0x97cf0c[_0x067b('0x9')])?_0x97cf0c['UserId']:_0x97cf0c[_0x067b('0x9')]['id'];this[_0x067b('0x23')]=_0x97cf0c['VoiceQueueId'];this['originatecalleridnum']='';this[_0x067b('0x24')]='';}Action[_0x067b('0x25')][_0x067b('0x26')]=function(){return util[_0x067b('0xb')]('\x22%s\x22\x20<%s>',this[_0x067b('0xd')],this['number']);};module[_0x067b('0x27')]=Action; \ No newline at end of file +var _0xc9c0=['lodash','moment','isNil','uniqueid','idContact','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','firstName','Contact','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','number','util'];(function(_0x59002d,_0x3d688c){var _0x116ca1=function(_0x2dccc){while(--_0x2dccc){_0x59002d['push'](_0x59002d['shift']());}};_0x116ca1(++_0x3d688c);}(_0xc9c0,0x97));var _0x0c9c=function(_0x518740,_0x32bbe9){_0x518740=_0x518740-0x0;var _0x2f2f44=_0xc9c0[_0x518740];return _0x2f2f44;};'use strict';var util=require(_0x0c9c('0x0'));var _=require(_0x0c9c('0x1'));var moment=require(_0x0c9c('0x2'));function checkNameSurname(_0x449c75,_0x533352,_0x52187b){var _0x297b43='';if(!_[_0x0c9c('0x3')](_0x533352)&&'string'===typeof _0x533352){_0x297b43+=_0x533352;}if(!_[_0x0c9c('0x3')](_0x52187b)&&'string'===typeof _0x52187b){_0x297b43+='\x20'+_0x52187b;}if(_0x297b43!==''){return _0x297b43;}return _0x449c75;}function Action(_0x1ea5ad,_0x400430,_0x372710,_0x541a2b,_0xe51611){this[_0x0c9c('0x4')]=_0x372710||undefined;this[_0x0c9c('0x5')]=_0x1ea5ad['id'];this['queue']=_0x400430[_0x0c9c('0x6')];this['type']=_0x400430[_0x0c9c('0x7')];this[_0x0c9c('0x8')]='queue';this['dialAnswer']=![];this[_0x0c9c('0x9')]=_[_0x0c9c('0x3')](_0x1ea5ad[_0x0c9c('0xa')])?undefined:_0x1ea5ad['Agent'][_0x0c9c('0x6')];this['channelAgent']=this[_0x0c9c('0x9')]?util[_0x0c9c('0xb')](_0x0c9c('0xc'),this[_0x0c9c('0x9')]):_0x541a2b||undefined;this[_0x0c9c('0xd')]=checkNameSurname(_0x1ea5ad['Contact']['phone'],_0x1ea5ad['Contact'][_0x0c9c('0xe')],_0x1ea5ad[_0x0c9c('0xf')]['lastName']);this['active']=_0x1ea5ad[_0x0c9c('0x10')]||![];this[_0x0c9c('0x11')]=_0x1ea5ad[_0x0c9c('0xf')]['phone'];this['scheduledat']=_0x1ea5ad['scheduledat'];this[_0x0c9c('0x12')]=_0x1ea5ad['countbusyretry']||0x0;this[_0x0c9c('0x13')]=_0x1ea5ad[_0x0c9c('0x13')]||0x0;this['countnoanswerretry']=_0x1ea5ad[_0x0c9c('0x14')]||0x0;this[_0x0c9c('0x15')]=(_0x1ea5ad['countbusyretry']||0x0)+(_0x1ea5ad[_0x0c9c('0x13')]||0x0)+(_0x1ea5ad[_0x0c9c('0x14')]||0x0)+(_0x1ea5ad[_0x0c9c('0x16')]||0x0)+(_0x1ea5ad[_0x0c9c('0x17')]||0x0)+(_0x1ea5ad[_0x0c9c('0x18')]||0x0)+(_0x1ea5ad[_0x0c9c('0x19')]||0x0)+(_0x1ea5ad['countagentrejectretry']||0x0);this[_0x0c9c('0x16')]=_0x1ea5ad[_0x0c9c('0x16')]||0x0;this[_0x0c9c('0x17')]=_0x1ea5ad[_0x0c9c('0x17')]||0x0;this['countabandonedretry']=_0x1ea5ad[_0x0c9c('0x18')]||0x0;this[_0x0c9c('0x19')]=_0x1ea5ad[_0x0c9c('0x19')]||0x0;this[_0x0c9c('0x1a')]=_0x1ea5ad[_0x0c9c('0x1a')]||0x0;this['callback']=_0x1ea5ad[_0x0c9c('0x1b')];this['callbackuniqueid']=_0x1ea5ad['callbackuniqueid'];this[_0x0c9c('0x1c')]=_0x1ea5ad[_0x0c9c('0x1c')];this[_0x0c9c('0x1d')]=_0x1ea5ad['recallme'];this[_0x0c9c('0x1e')]=_0x1ea5ad[_0x0c9c('0x1e')];this['ListId']=_0x1ea5ad[_0x0c9c('0x1f')];this['UserId']=_[_0x0c9c('0x3')](_0x1ea5ad[_0x0c9c('0xa')])?_0x1ea5ad[_0x0c9c('0x20')]:_0x1ea5ad[_0x0c9c('0xa')]['id'];this[_0x0c9c('0x21')]=_0x1ea5ad['VoiceQueueId'];this[_0x0c9c('0x22')]='';this[_0x0c9c('0x23')]='';}Action['prototype']['getCaller']=function(){return util[_0x0c9c('0xb')](_0x0c9c('0x24'),this[_0x0c9c('0xd')],this[_0x0c9c('0x25')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0bdf6cf..ce2690d 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 _0xd67b=['dialend','newexten','syncNewExten','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','logger','message','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','clockClearZombieChannels','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','dialActive','NOT_ACTIVE','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','responsetime','uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','[callProgressDetectingCustomer][logBusy]','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','Contact\x20in\x20black\x20List','SIP/%s','reachable','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','trim','dialCutDigit','substring','SIP/%s/%s%s','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','idContact','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','md5','../../../config/environment','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest'];(function(_0x179812,_0x58be91){var _0x2e2b13=function(_0x575b0d){while(--_0x575b0d){_0x179812['push'](_0x179812['shift']());}};_0x2e2b13(++_0x58be91);}(_0xd67b,0x133));var _0xbd67=function(_0x2e8a91,_0x2393f4){_0x2e8a91=_0x2e8a91-0x0;var _0x36035b=_0xd67b[_0x2e8a91];return _0x36035b;};'use strict';var util=require('util');var _=require(_0xbd67('0x0'));var BPromise=require('bluebird');var uuid=require(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var md5=require(_0xbd67('0x3'));var Redis=require('ioredis');var config=require(_0xbd67('0x4'));var logger=require('../../../config/logger')(_0xbd67('0x5'));var loggerAction=require('../../../config/logger')(_0xbd67('0x6'));var ami=require(_0xbd67('0x7'));var rpcDb=require(_0xbd67('0x8'));var Action=require(_0xbd67('0x9'));var ut=require(_0xbd67('0xa'));config[_0xbd67('0xb')]=_[_0xbd67('0xc')](config[_0xbd67('0xb')],{'host':_0xbd67('0xd'),'port':0x18eb});var io=require(_0xbd67('0xe'))(new Redis(config[_0xbd67('0xb')]));var Sequence=function(){};Sequence[_0xbd67('0xf')][_0xbd67('0x10')]=function(_0x52b981){this['tail']=this[_0xbd67('0x11')]?this['tail'][_0xbd67('0x12')](_0x52b981):_0x52b981();};function Preview(_0xb6b4b5){this[_0xbd67('0x13')]=new Sequence();this[_0xbd67('0x14')]=_0xb6b4b5[_0xbd67('0x15')];this[_0xbd67('0x16')]=_0xb6b4b5[_0xbd67('0x16')];this[_0xbd67('0x17')]={};this[_0xbd67('0x18')]=_0xb6b4b5[_0xbd67('0x18')];this['clockClearZombieChannels']=0x0;ami['on'](_0xbd67('0x19'),this[_0xbd67('0x1a')][_0xbd67('0x1b')](this));ami['on'](_0xbd67('0x1c'),this[_0xbd67('0x1d')][_0xbd67('0x1b')](this));ami['on'](_0xbd67('0x1e'),this[_0xbd67('0x1f')][_0xbd67('0x1b')](this));ami['on'](_0xbd67('0x20'),this['syncDialEnd']['bind'](this));ami['on'](_0xbd67('0x21'),this[_0xbd67('0x22')][_0xbd67('0x1b')](this));ami['on']('varset',this[_0xbd67('0x23')][_0xbd67('0x1b')](this));ami['on'](_0xbd67('0x24'),this['syncAttendedTransfer'][_0xbd67('0x1b')](this));ami['on']('blindtransfer',this[_0xbd67('0x25')][_0xbd67('0x1b')](this));this[_0xbd67('0x26')](this['campaignsPreview']);}function emit(_0x3c4102,_0x40ec96,_0x37836c){io['to'](_0x3c4102)[_0xbd67('0x27')](_0x40ec96,_0x37836c);}function emitCampaignPreview(_0x419a6a){if(_0x419a6a[_0xbd67('0x28')]==='outbound'){var _0x3ee2f1={'id':_0x419a6a['id'],'name':_0x419a6a[_0xbd67('0x29')],'strategy':_0x419a6a[_0xbd67('0x2a')],'answered':_0x419a6a[_0xbd67('0x2b')],'available':_0x419a6a[_0xbd67('0x2c')],'loggedIn':_0x419a6a[_0xbd67('0x2d')],'pTalking':_0x419a6a[_0xbd67('0x2e')],'sumBillable':_0x419a6a[_0xbd67('0x2f')],'sumDuration':_0x419a6a[_0xbd67('0x30')],'sumHoldTime':_0x419a6a[_0xbd67('0x31')]||0x0,'talking':_0x419a6a[_0xbd67('0x32')],'total':_0x419a6a['total'],'type':_0x419a6a[_0xbd67('0x28')],'unmanaged':_0x419a6a['unmanaged'],'abandoned':_0x419a6a[_0xbd67('0x33')],'waiting':_0x419a6a[_0xbd67('0x34')],'loggedInDb':_0x419a6a[_0xbd67('0x35')],'dialActive':_0x419a6a['dialActive'],'dialMethod':_0x419a6a[_0xbd67('0x36')],'dialOriginateCallerIdName':_0x419a6a[_0xbd67('0x37')],'dialOriginateCallerIdNumber':_0x419a6a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x419a6a[_0xbd67('0x38')],'dialPrefix':_0x419a6a[_0xbd67('0x39')],'outboundAnswerAgiCallsDay':_0x419a6a[_0xbd67('0x3a')],'outboundAnswerCallsDay':_0x419a6a[_0xbd67('0x3b')],'outboundBlacklistCallsDay':_0x419a6a[_0xbd67('0x3c')],'outboundBusyCallsDay':_0x419a6a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x419a6a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x419a6a[_0xbd67('0x3d')],'outboundDropCallsDayCallersExit':_0x419a6a[_0xbd67('0x3e')],'outboundDropCallsDayTimeout':_0x419a6a[_0xbd67('0x3f')],'outboundNoAnswerCallsDay':_0x419a6a[_0xbd67('0x40')],'outboundNoSuchCallsDay':_0x419a6a[_0xbd67('0x41')],'outboundOriginateFailureCallsDay':_0x419a6a[_0xbd67('0x42')],'outboundReCallsDay':_0x419a6a[_0xbd67('0x43')],'outboundRejectCallsDay':_0x419a6a[_0xbd67('0x44')],'outboundUnknownCallsDay':_0x419a6a[_0xbd67('0x45')],'outboundAbandonedCallsDay':_0x419a6a[_0xbd67('0x46')],'predictiveIntervalAnsweredCalls':_0x419a6a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x419a6a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x419a6a[_0xbd67('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x419a6a[_0xbd67('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x419a6a[_0xbd67('0x49')],'predictiveIntervalErlangCalls':_0x419a6a['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x419a6a[_0xbd67('0x4a')],'predictiveIntervalHitRate':_0x419a6a[_0xbd67('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x419a6a[_0xbd67('0x4c')],'predictiveIntervalPauses':_0x419a6a[_0xbd67('0x4d')],'predictiveIntervalAvailable':_0x419a6a['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x419a6a['predictiveIntervalTotalCalls'],'message':_0x419a6a['message'],'originated':_0x419a6a[_0xbd67('0x4e')],'erlangCalls':_0x419a6a[_0xbd67('0x4f')],'erlangCallToSecond':_0x419a6a[_0xbd67('0x50')],'erlangAbandonmentRate':_0x419a6a['erlangAbandonmentRate'],'erlangBusyFactor':_0x419a6a['erlangBusyFactor'],'startPredictive':_0x419a6a[_0xbd67('0x51')],'startProgressive':_0x419a6a[_0xbd67('0x52')]};if(_0x419a6a[_0xbd67('0x53')]){_0x3ee2f1[_0xbd67('0x53')]={'id':_0x419a6a[_0xbd67('0x53')]['id'],'name':_0x419a6a[_0xbd67('0x53')]['name'],'active':_0x419a6a[_0xbd67('0x53')][_0xbd67('0x54')],'callerid':_0x419a6a[_0xbd67('0x53')]['callerid']};}if(_0x419a6a[_0xbd67('0x55')]){_0x3ee2f1['Interval']={'id':_0x419a6a[_0xbd67('0x55')]['id'],'name':_0x419a6a[_0xbd67('0x55')]['name']};}var _0x3b7775=md5(JSON[_0xbd67('0x56')](_0x3ee2f1));if(_0x419a6a[_0xbd67('0x3')]!==_0x3b7775){_0x419a6a[_0xbd67('0x3')]=_0x3b7775;emit(util[_0xbd67('0x57')](_0xbd67('0x58'),_0x3ee2f1['name']),_0xbd67('0x59'),_0x3ee2f1);}}}function emitVoiceQueueChannelRemove(_0x151848){logger[_0xbd67('0x5a')](_0xbd67('0x5b'),JSON[_0xbd67('0x56')](_0x151848));emit(util['format']('voice:queue:%s',_0x151848[_0xbd67('0x29')]),_0xbd67('0x5c'),_0x151848);io[_0xbd67('0x27')]('voice_queue_presence:remove',_0x151848);}function notSendMessagesQueue(_0x378cb3){if(_0x378cb3[_0xbd67('0x5d')]){if(_0x378cb3[_0xbd67('0x4e')]===0x0&&_0x378cb3[_0xbd67('0x2e')]===0x0){_0x378cb3['sendMessageOneNotActive']=![];_0x378cb3['available']=0x0;_0x378cb3['paused']=0x0;_0x378cb3['message']='NOT_ACTIVE';ut[_0xbd67('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x378cb3['name']+'\x20is\x20not\x20active');}else{_0x378cb3[_0xbd67('0x5f')]=_0xbd67('0x60');ut[_0xbd67('0x5e')](_0xbd67('0x61'),_0x378cb3['name']+_0xbd67('0x62'));}emitCampaignPreview(_0x378cb3);}}Preview[_0xbd67('0xf')][_0xbd67('0x26')]=function(){var _0x79684a=this;setInterval(function(){_0x79684a[_0xbd67('0x63')]();},0x7cf);};Preview[_0xbd67('0xf')][_0xbd67('0x63')]=function(){var _0x532c9b=this[_0xbd67('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x20fd56 in _0x532c9b){if(_0x532c9b[_0xbd67('0x64')](_0x20fd56)&&(_0x532c9b[_0x20fd56][_0xbd67('0x36')]===_0xbd67('0x5')||_0x532c9b[_0x20fd56][_0xbd67('0x36')]===_0xbd67('0x65'))&&_0x532c9b[_0x20fd56][_0xbd67('0x28')]===_0xbd67('0x66')){if(this['clockClearZombieChannels']>0x7){this[_0xbd67('0x67')]=0x0;this[_0xbd67('0x68')]();}}if(_0x532c9b['hasOwnProperty'](_0x20fd56)&&_0x532c9b[_0x20fd56][_0xbd67('0x36')]===_0xbd67('0x5')&&_0x532c9b[_0x20fd56][_0xbd67('0x28')]==='outbound'){if(_0x532c9b[_0x20fd56]['dialActive']){this[_0xbd67('0x69')](_0x532c9b[_0x20fd56]);if(_0x532c9b[_0x20fd56][_0xbd67('0x6a')])this[_0xbd67('0x6b')](_0x532c9b[_0x20fd56]);}else{notSendMessagesQueue(_0x532c9b[_0x20fd56]);}}}};Preview['prototype'][_0xbd67('0x6c')]=function(_0x345508){var _0x56ba76=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x56ba76[_0xbd67('0x17')][_0x345508])){loggerAction[_0xbd67('0x5a')](_0xbd67('0x6d'),_0x345508,_0xbd67('0x6e'),_0x56ba76[_0xbd67('0x17')][_0x345508]['queue'],_0xbd67('0x6f'),JSON[_0xbd67('0x56')](_0x56ba76['campaignsPreview'][_0x56ba76[_0xbd67('0x17')][_0x345508][_0xbd67('0x70')]][_0xbd67('0x4e')]),_0xbd67('0x71'),JSON[_0xbd67('0x56')](_0x56ba76['campaignsPreview'][_0x56ba76[_0xbd67('0x17')][_0x345508]['queue']][_0xbd67('0x2e')]),JSON[_0xbd67('0x56')](_0x56ba76['actions'][_0x345508][_0xbd67('0x72')]),JSON[_0xbd67('0x56')](_[_0xbd67('0x73')](_0x56ba76['actions'][_0x345508],[_0xbd67('0x74'),_0xbd67('0x75'),_0xbd67('0x76'),_0xbd67('0x77')])));return ami[_0xbd67('0x78')]({'action':_0xbd67('0x79'),'channel':_0x56ba76[_0xbd67('0x17')][_0x345508]['channel']})['catch'](function(_0x12943f){if(_0x12943f[_0xbd67('0x5f')]===_0xbd67('0x7a')){setTimeout(function(){if(_0x56ba76[_0xbd67('0x17')][_0x345508]){ut[_0xbd67('0x7b')](_0x56ba76['campaignsPreview'][_0x56ba76['actions'][_0x345508][_0xbd67('0x70')]],_0xbd67('0x7c'));if(_0x56ba76[_0xbd67('0x17')][_0x345508][_0xbd67('0x72')]===!![]){ut[_0xbd67('0x7d')](_0x56ba76[_0xbd67('0x14')][_0x56ba76[_0xbd67('0x17')][_0x345508][_0xbd67('0x70')]],_0xbd67('0x7c'));ut[_0xbd67('0x7e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x345508,_0x56ba76['actions'][_0x345508][_0xbd67('0x70')]);}ut['loggerError'](_0xbd67('0x7f')+_0x345508,_0x56ba76[_0xbd67('0x17')][_0x345508][_0xbd67('0x70')]);delete _0x56ba76[_0xbd67('0x17')][_0x345508];}},0x2328);}});}});};Preview['prototype'][_0xbd67('0x68')]=function(){var _0x154f67=this;loggerAction[_0xbd67('0x5a')]('[action]',_[_0xbd67('0x80')](this['actions']));for(var _0x166dfe in this[_0xbd67('0x17')]){if(_0x154f67['actions'][_0xbd67('0x64')](_0x166dfe)){_0x154f67[_0xbd67('0x6c')](_0x166dfe);}}};Preview[_0xbd67('0xf')][_0xbd67('0x6b')]=function(_0x17c259){var _0x2843ac=this;rpcDb[_0xbd67('0x81')](_0x17c259['id'],ut[_0xbd67('0x82')](this[_0xbd67('0x18')]))[_0xbd67('0x83')](function(_0x93a3cb){if(!_[_0xbd67('0x84')](_0x93a3cb)){for(var _0x2ee62e=0x0;_0x2ee62e<_0x93a3cb[_0xbd67('0x85')];_0x2ee62e+=0x1){if(ut[_0xbd67('0x86')](_0x93a3cb[_0x2ee62e][_0xbd67('0x87')])<_0x17c259[_0xbd67('0x88')]*0x3c){if(_0x93a3cb[_0x2ee62e]['Agent']&&!_0x93a3cb[_0x2ee62e]['Agent'][_0xbd67('0x89')]){_0x2843ac[_0xbd67('0x8a')](_0x93a3cb[_0x2ee62e]['id'])['then'](ut[_0xbd67('0x8b')](_0xbd67('0x8c')))[_0xbd67('0x8d')](ut['logger2'](_0xbd67('0x8c')));}else{rpcDb[_0xbd67('0x8e')](_0x93a3cb[_0x2ee62e]['id']);}}else{var _0xf3dec5=new Action(_0x93a3cb[_0x2ee62e],_0x17c259);_0xf3dec5[_0xbd67('0x8f')]=moment()[_0xbd67('0x57')](_0xbd67('0x90'));_0x17c259['outboundReCallsDay']+=0x1;ut[_0xbd67('0x91')](_0xf3dec5,0x17,'RecallInQueue');if(_0x17c259[_0xbd67('0x92')]){rpcDb[_0xbd67('0x93')](ut['createBody'](_0x93a3cb[_0x2ee62e]));rpcDb['createCustomerHistory'](_0xf3dec5,_0xbd67('0x94'));}else{ut[_0xbd67('0x91')](_0xf3dec5,0x16,_0xbd67('0x95'));rpcDb[_0xbd67('0x96')](_0xf3dec5,_0xbd67('0x97'));rpcDb['createCustomerFinal'](_0xf3dec5,_0xbd67('0x97'));}}}}})[_0xbd67('0x8d')](ut[_0xbd67('0x8b')](_0xbd67('0x98')));};Preview[_0xbd67('0xf')][_0xbd67('0x69')]=function(_0x39e9d2){_0x39e9d2[_0xbd67('0x5d')]=!![];if(ut[_0xbd67('0x99')](_0x39e9d2[_0xbd67('0x2d')])){_0x39e9d2[_0xbd67('0x5f')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xbd67('0x9a')](_0x39e9d2[_0xbd67('0x9b')])){_0x39e9d2['message']=_0xbd67('0x9c');}else if(!this[_0xbd67('0x9d')](_0x39e9d2[_0xbd67('0x53')])){if(!this['isTrunkReachable'](_0x39e9d2['TrunkBackup'])){_0x39e9d2[_0xbd67('0x5f')]='TRUNK_IS_NOT_REACHABLE';}else{_0x39e9d2[_0xbd67('0x5f')]=_0xbd67('0x9e');}}else{_0x39e9d2['message']=_0xbd67('0x9e');}emitCampaignPreview(_0x39e9d2);};Preview[_0xbd67('0xf')][_0xbd67('0x9f')]=function(_0x4604f4,_0x4e964d,_0x182666){var _0x204091=this;var _0x55c71f=this[_0xbd67('0x17')][_0x4e964d];var _0xe1a90c=this[_0xbd67('0x14')][_0x55c71f['queue']];var _0x1b3128;if(_0xe1a90c){switch(_0x182666){case'1':_0xe1a90c[_0xbd67('0x41')]+=0x1;_0x55c71f[_0xbd67('0xa0')]+=0x1;_0x55c71f[_0xbd67('0xa1')]=ut['totalGlobal'](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0x0,_0xbd67('0xa2'));ami[_0xbd67('0x27')]('custom:agentnosuchnumber',ut[_0xbd67('0xa3')](_0x55c71f,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x55c71f,_0xbd67('0xa4'));if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c[_0xbd67('0xa6')]){_0x1b3128=ut[_0xbd67('0xa7')](_0x55c71f,0xf,_0xbd67('0xa8'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xaa'));}else{if(_0x55c71f[_0xbd67('0xa0')]>=_0xe1a90c[_0xbd67('0xab')]){rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xaa'));}else{rpcDb[_0xbd67('0xac')](ut[_0xbd67('0xad')](_0x55c71f,_0xbd67('0xa0'),_0xe1a90c['dialNoSuchNumberRetryFrequency']),_0x55c71f[_0xbd67('0xae')],_0x55c71f['activeContact']);}}delete this['actions'][_0x4604f4[_0xbd67('0xaf')]];break;case _0xbd67('0xb0'):var _0x11487e=moment()[_0xbd67('0x57')](_0xbd67('0x90'));_0x55c71f[_0xbd67('0xb1')]=_0x11487e;_0x55c71f['answertime']=_0x11487e;_0x55c71f[_0xbd67('0x72')]=!![];_0xe1a90c['pTalking']+=0x1;logger['info']('[syncHangup][talking][increment]',_0x55c71f[_0xbd67('0xb2')],_0xbd67('0xb3'),_0xe1a90c[_0xbd67('0x29')],_0xbd67('0x71'),_0xe1a90c[_0xbd67('0x2e')]);ami[_0xbd67('0x27')]('custom:agentconnect',ut[_0xbd67('0xa3')](_0x55c71f,_0xbd67('0xb4'),this[_0xbd67('0x14')][_0x55c71f['queue']]));if(_0xe1a90c['acw']){ami[_0xbd67('0x27')](_0xbd67('0xb5'),ut[_0xbd67('0xb6')](_0x55c71f));}break;case'16':ami['emit'](_0xbd67('0xb7'),ut[_0xbd67('0xa3')](_0x55c71f,'complete',this[_0xbd67('0x14')][_0x55c71f[_0xbd67('0x70')]]));emitVoiceQueueChannelRemove(ut[_0xbd67('0xa3')](_0x55c71f,_0xbd67('0xb8')));_0xe1a90c[_0xbd67('0x3b')]+=0x1;_0xe1a90c[_0xbd67('0xb9')]+=0x1;_0xe1a90c[_0xbd67('0x2b')]+=0x1;ut[_0xbd67('0x7d')](_0xe1a90c,'[16]');_0x55c71f['countglobal']=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0x4,_0xbd67('0xba'));rpcDb[_0xbd67('0x96')](_0x55c71f,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xbb'));rpcDb[_0xbd67('0xbc')](_0x55c71f);_0xe1a90c['sumDuration']+=_0x55c71f['talktime'];_0xe1a90c[_0xbd67('0x2f')]+=_0x55c71f['talktime'];logger['info'](_0xbd67('0xbd'),_0x55c71f[_0xbd67('0xb2')],_0xbd67('0xb3'),_0xe1a90c[_0xbd67('0x29')],'pTalking:\x20',_0xe1a90c[_0xbd67('0x2e')]);delete this[_0xbd67('0x17')][_0x4604f4[_0xbd67('0xaf')]];break;case _0xbd67('0xbe'):_0xe1a90c[_0xbd67('0xbf')]+=0x1;_0x55c71f[_0xbd67('0xc0')]+=0x1;_0x55c71f[_0xbd67('0xa1')]=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0x5,_0xbd67('0xc1'));ami[_0xbd67('0x27')](_0xbd67('0xc2'),ut[_0xbd67('0xa3')](_0x55c71f,'busy'));rpcDb[_0xbd67('0x96')](_0x55c71f,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c[_0xbd67('0xa6')]){_0x1b3128=ut[_0xbd67('0xa7')](_0x55c71f,0xf,_0xbd67('0xa8'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xc3'));}else{if(_0x55c71f['countbusyretry']>=_0xe1a90c['dialBusyMaxRetry']){rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xc4'));}else{rpcDb[_0xbd67('0xac')](ut['scheduledAt'](_0x55c71f,_0xbd67('0xc0'),_0xe1a90c['dialBusyRetryFrequency']),_0x55c71f['unlockAgent'],_0x55c71f['activeContact']);}}break;case'NOANSWER':_0xe1a90c[_0xbd67('0x40')]+=0x1;_0x55c71f['countnoanswerretry']+=0x1;_0x55c71f['countglobal']=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0x3,_0xbd67('0xc5'));ami[_0xbd67('0x27')](_0xbd67('0xc6'),ut[_0xbd67('0xa3')](_0x55c71f,_0xbd67('0xc7')));rpcDb[_0xbd67('0x96')](_0x55c71f,_0xbd67('0xc8'));if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c['dialGlobalMaxRetry']){_0x1b3128=ut['cloneAction'](_0x55c71f,0xf,_0xbd67('0xa8'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xc9'));}else{if(_0x55c71f[_0xbd67('0xca')]>=_0xe1a90c['dialNoAnswerMaxRetry']){rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xc8'));}else{rpcDb[_0xbd67('0xac')](ut[_0xbd67('0xad')](_0x55c71f,'countnoanswerretry',_0xe1a90c[_0xbd67('0xcb')]),_0x55c71f[_0xbd67('0xae')],_0x55c71f[_0xbd67('0xcc')]);}}break;case _0xbd67('0xcd'):_0xe1a90c[_0xbd67('0xce')]+=0x1;_0x55c71f[_0xbd67('0xcf')]+=0x1;_0x55c71f[_0xbd67('0xa1')]=ut[_0xbd67('0xa5')](_0x55c71f);ut['logCustomer'](_0x55c71f,0x8,_0xbd67('0xd0'));ami['emit'](_0xbd67('0xd1'),ut[_0xbd67('0xa3')](_0x55c71f,_0xbd67('0xd2')));rpcDb[_0xbd67('0x96')](_0x55c71f,_0xbd67('0xd3'));if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c[_0xbd67('0xa6')]){_0x1b3128=ut[_0xbd67('0xa7')](_0x55c71f,0xf,_0xbd67('0xa8'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xd4'));}else{if(_0x55c71f['countcongestionretry']>=_0xe1a90c[_0xbd67('0xd5')]){rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xd3'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x55c71f,_0xbd67('0xcf'),_0xe1a90c[_0xbd67('0xd6')]),_0x55c71f[_0xbd67('0xae')],_0x55c71f[_0xbd67('0xcc')]);}}break;case _0xbd67('0xd7'):_0xe1a90c[_0xbd67('0x44')]+=0x1;_0x55c71f[_0xbd67('0xd8')]+=0x1;_0x55c71f[_0xbd67('0xa1')]=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0x14,_0xbd67('0xd9'));ami[_0xbd67('0x27')]('custom:agentreject',ut['buildObj'](_0x55c71f,_0xbd67('0xda')));rpcDb[_0xbd67('0x96')](_0x55c71f,_0xbd67('0xdb'));if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c[_0xbd67('0xa6')]){_0x1b3128=ut['cloneAction'](_0x55c71f,0x14,_0xbd67('0xd9'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xdc'));}else{if(_0x55c71f['countagentrejectretry']>=_0xe1a90c['dialAgentRejectMaxRetry']){rpcDb[_0xbd67('0xa9')](_0x55c71f,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xbd67('0xac')](ut[_0xbd67('0xad')](_0x55c71f,_0xbd67('0xd8'),_0xe1a90c[_0xbd67('0xdd')]),_0x55c71f['unlockAgent'],_0x55c71f['activeContact']);}}break;case _0xbd67('0xde'):_0xe1a90c[_0xbd67('0x46')]+=0x1;_0x55c71f[_0xbd67('0xdf')]+=0x1;_0x55c71f[_0xbd67('0xa1')]=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0xb,_0xbd67('0xe0'));rpcDb[_0xbd67('0x96')](_0x55c71f,_0xbd67('0xe1'));if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c[_0xbd67('0xa6')]){_0x1b3128=ut[_0xbd67('0xa7')](_0x55c71f,0xf,'Global');rpcDb[_0xbd67('0xa9')](_0x1b3128,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x55c71f[_0xbd67('0xe2')]>=_0xe1a90c[_0xbd67('0xe3')]){rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xe1'));}else{rpcDb[_0xbd67('0xac')](ut['scheduledAt'](_0x55c71f,_0xbd67('0xdf'),_0xe1a90c['dialAbandonedRetryFrequency']),_0x55c71f[_0xbd67('0xae')],_0x55c71f['activeContact']);}}break;case'18':_0xe1a90c['outboundUnknownCallsDay']+=0x1;_0x55c71f[_0xbd67('0xe4')]+=0x1;_0x55c71f[_0xbd67('0xa1')]=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0x12,_0x4604f4[_0xbd67('0xe5')]||_0x4604f4[_0xbd67('0xe6')]);ami[_0xbd67('0x27')](_0xbd67('0xe7'),ut[_0xbd67('0xa3')](_0x55c71f,_0xbd67('0xe8')));rpcDb[_0xbd67('0x96')](_0x55c71f,_0xbd67('0xe9'));if(ut['totalGlobal'](_0x55c71f)>=_0xe1a90c[_0xbd67('0xa6')]){_0x1b3128=ut[_0xbd67('0xa7')](_0x55c71f,0xf,_0xbd67('0xa8'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xe9'));}else{rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xe9'));}delete this[_0xbd67('0x17')][_0x4604f4[_0xbd67('0xaf')]];break;case'19':_0xe1a90c[_0xbd67('0x45')]+=0x1;_0x55c71f[_0xbd67('0xa1')]=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0x13,_0x4604f4['cause-txt']||_0x4604f4[_0xbd67('0xe6')]);ami['emit'](_0xbd67('0xe7'),ut['buildObj'](_0x55c71f,_0xbd67('0xe8')));rpcDb['createCustomerHistory'](_0x55c71f,_0xbd67('0xea'));if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c[_0xbd67('0xa6')]){_0x1b3128=ut[_0xbd67('0xa7')](_0x55c71f,0xf,_0xbd67('0xa8'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xea'));}else{rpcDb[_0xbd67('0xa9')](_0x55c71f,_0xbd67('0xea'));}delete this[_0xbd67('0x17')][_0x4604f4[_0xbd67('0xaf')]];break;default:if(_0x55c71f[_0xbd67('0x72')]){ut[_0xbd67('0x7d')](_0xe1a90c,_0xbd67('0xeb'));ut[_0xbd67('0x7e')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0xe1a90c[_0xbd67('0x29')],_0x4604f4);}_0xe1a90c['outboundUnknownCallsDay']+=0x1;_0x55c71f['countglobal']=ut[_0xbd67('0xa5')](_0x55c71f);ut[_0xbd67('0x91')](_0x55c71f,0xc,_0x4604f4[_0xbd67('0xe5')]||_0x4604f4[_0xbd67('0xe6')]);rpcDb[_0xbd67('0x96')](_0x55c71f,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xbd67('0xa5')](_0x55c71f)>=_0xe1a90c['dialGlobalMaxRetry']){_0x1b3128=ut[_0xbd67('0xa7')](_0x55c71f,0xf,_0xbd67('0xa8'));rpcDb[_0xbd67('0xa9')](_0x1b3128,_0xbd67('0xec'));}else{rpcDb[_0xbd67('0xa9')](_0x55c71f,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xbd67('0x17')][_0x4604f4[_0xbd67('0xaf')]];}if(!(_0x55c71f[_0xbd67('0x72')]&&_0x182666==='16')){ut[_0xbd67('0x7b')](_0xe1a90c,'[callProgressDetectingCustomer]');logger[_0xbd67('0x5a')](_0xbd67('0xed'),_0x55c71f['uniqueid'],_0xbd67('0xb3'),_0xe1a90c[_0xbd67('0x29')],_0xbd67('0x6f'),_0xe1a90c[_0xbd67('0x4e')]);}if(_0x182666!==_0xbd67('0xb0')){delete this[_0xbd67('0x17')][_0x4604f4['linkedid']];delete this['actions'][_0x4604f4['destlinkedid']];}}};Preview['prototype'][_0xbd67('0xee')]=function(_0x7b2087,_0x161552,_0x488de8){if(_['isUndefined'](_0x161552)&&'object'!==typeof _0x161552){return;}if(_[_0xbd67('0xef')](_0x488de8)&&_0xbd67('0xf0')!==typeof _0x488de8){return;}switch(_0x488de8[_0xbd67('0xf1')]){case'0':ut[_0xbd67('0xf2')](_0x7b2087,0x0,'NoSuchNumber');rpcDb[_0xbd67('0xf3')](_0x7b2087,_0xbd67('0xf4'));break;case'3':ut[_0xbd67('0xf2')](_0x7b2087,0x3,_0xbd67('0xc5'));rpcDb[_0xbd67('0xf3')](_0x7b2087,_0xbd67('0xf5'));break;case'5':ut['logAgent'](_0x7b2087,0x5,_0xbd67('0xc1'));rpcDb[_0xbd67('0xf3')](_0x7b2087,_0xbd67('0xf6'));break;case'8':ut[_0xbd67('0xf2')](_0x7b2087,0x8,_0xbd67('0xd0'));rpcDb[_0xbd67('0xf3')](_0x7b2087,_0xbd67('0xf7'));break;case'22':ut['logAgent'](_0x7b2087,0x16,_0xbd67('0xf8'));rpcDb[_0xbd67('0xf3')](_0x7b2087,_0xbd67('0xf9'));break;default:ut[_0xbd67('0xf2')](_0x7b2087,0xc,_0x488de8[_0xbd67('0xf1')]);rpcDb[_0xbd67('0xf3')](_0x7b2087,_0xbd67('0xf7'));}ut[_0xbd67('0x7b')](_0x161552,'[callProgressDetectingAgent]');logger[_0xbd67('0x5a')](_0xbd67('0xfa'),_0x7b2087['uniqueid'],_0xbd67('0xb3'),_0x161552[_0xbd67('0x29')],'originated:\x20',_0x161552[_0xbd67('0x4e')]);delete this[_0xbd67('0x17')][_0x7b2087['uniqueid']];};Preview[_0xbd67('0xf')][_0xbd67('0xfb')]=function(_0x254199,_0x10b02a,_0x3435c6,_0x42a7ee,_0x4df2e3){var _0x353a5f=this;return new BPromise(function(_0x5228b0,_0x5d4d7a){if(_[_0xbd67('0x84')](_0x10b02a)||_[_0xbd67('0x84')](_0x10b02a['Contact'])||_[_0xbd67('0x84')](_0x10b02a[_0xbd67('0xfc')][_0xbd67('0xfd')])||_[_0xbd67('0x84')](_0x10b02a[_0xbd67('0x76')])){_0x5d4d7a(ut[_0xbd67('0x5f')](_0xbd67('0xfe'),_0x42a7ee,_0x4df2e3));return;}var _0x4afce2=uuid['v4']();var _0x22729d=_0x353a5f['campaignsPreview'][_0x10b02a[_0xbd67('0x6e')]['name']];var _0x45f668=_0x3435c6?_0x353a5f[_0xbd67('0x18')][_0x3435c6]['id']:undefined;_0x353a5f[_0xbd67('0x17')][_0x4afce2]=new Action(_0x10b02a,_0x22729d,_0x4afce2,_0x3435c6,_0x45f668);var _0x507069=_0x353a5f[_0xbd67('0x17')][_0x4afce2];_0x507069[_0xbd67('0xae')]=_0x42a7ee;_0x507069[_0xbd67('0xcc')]=_0x4df2e3;_0x507069[_0xbd67('0xff')]=_0x3435c6;if(_[_0xbd67('0x100')](_0x254199)){_0x353a5f['execCall'](_0x507069,_0x22729d,_0x10b02a,_0x3435c6)[_0xbd67('0x83')](function(_0x1fbd07){logger[_0xbd67('0x5a')](_0xbd67('0x101'),_0xbd67('0x102')+_0x507069['queue']+_0xbd67('0x103')+_0x507069['idContact'],JSON['stringify'](_0x1fbd07));ami[_0xbd67('0x27')](_0xbd67('0x104'),ut[_0xbd67('0xa3')](_0x507069,_0xbd67('0x105'),_0x353a5f[_0xbd67('0x14')][_0x507069[_0xbd67('0x70')]]));_0x5228b0(ut[_0xbd67('0x5f')]('Calling'));})[_0xbd67('0x8d')](function(_0x512d00){ut[_0xbd67('0x5e')](_0xbd67('0x106'),_0x512d00);_0x5d4d7a(ut['message'](_0xbd67('0x107'),_0x42a7ee,_0x4df2e3));});}else{_0x22729d[_0xbd67('0x3c')]+=0x1;ut['logBlacklist'](_0x507069);rpcDb['createHistory'](_0x507069,'[Blacklist][error]');delete _0x353a5f['actions'][_0x4afce2];_0x5d4d7a(ut['message'](_0xbd67('0x108'),_0x42a7ee,_0x4df2e3));}});};Preview[_0xbd67('0xf')][_0xbd67('0x9d')]=function(_0x52baa5){return!_[_0xbd67('0x84')](_0x52baa5)&&!_[_0xbd67('0x84')](_0x52baa5[_0xbd67('0x29')])&&!_[_0xbd67('0x84')](_0x52baa5['active'])&&_0x52baa5[_0xbd67('0x54')]&&!_[_0xbd67('0x84')](this[_0xbd67('0x16')][util['format'](_0xbd67('0x109'),_0x52baa5[_0xbd67('0x29')])])&&!_[_0xbd67('0x84')](this[_0xbd67('0x16')][util[_0xbd67('0x57')]('SIP/%s',_0x52baa5['name'])][_0xbd67('0x79')])&&(this[_0xbd67('0x16')][util['format']('SIP/%s',_0x52baa5[_0xbd67('0x29')])][_0xbd67('0x79')]===_0xbd67('0x10a')||this[_0xbd67('0x16')][util[_0xbd67('0x57')](_0xbd67('0x109'),_0x52baa5[_0xbd67('0x29')])][_0xbd67('0x79')]==='unmonitored');};Preview[_0xbd67('0xf')][_0xbd67('0x8a')]=function(_0x96c7c7,_0x2e53ab){var _0x3daf82=this;return new BPromise(function(_0x25c651,_0x36ccc5){_0x3daf82['execRun'](_0x96c7c7,_0x2e53ab)[_0xbd67('0x83')](function(_0x2427b4){_0x25c651(_[_0xbd67('0x73')](_0x2427b4,[_0xbd67('0x5f')]));})['catch'](function(_0x583b27){if(_0x583b27[_0xbd67('0x10b')]){rpcDb[_0xbd67('0x10c')](_0x96c7c7);}if(_0x583b27[_0xbd67('0x54')]){rpcDb[_0xbd67('0x8e')](_0x96c7c7);}_0x36ccc5(_['pick'](_0x583b27,[_0xbd67('0x5f')]));});});};Preview['prototype'][_0xbd67('0x10d')]=function(_0x540b79,_0x39416a){var _0x417f56=this;return new BPromise(function(_0x467097,_0x16e253){var _0x4f81e3,_0x4b7384;rpcDb[_0xbd67('0x10e')](_0x540b79)[_0xbd67('0x83')](function(_0x3b306a){if(!_[_0xbd67('0x84')](_0x3b306a[0x0])){_0x4b7384=_0x3b306a[0x0][_0xbd67('0x10f')]?![]:!![];_0x4f81e3=_0x3b306a[0x0][_0xbd67('0x10f')]?!![]:![];_0x4f81e3=_0x39416a?!![]:_0x4f81e3;}var _0x117d30=_0x417f56[_0xbd67('0x110')](_0x3b306a);if(_0x117d30[_0xbd67('0x111')]){rpcDb[_0xbd67('0x112')](_['pick'](_0x3b306a[0x0],[_0xbd67('0x76'),_0xbd67('0x113')]))[_0xbd67('0x83')](function(_0x5489db){_0x417f56[_0xbd67('0xfb')](_0x5489db,_0x3b306a[0x0],_0x39416a,_0x4b7384,_0x4f81e3)[_0xbd67('0x83')](function(_0xc3820){_0x467097(_0xc3820);})[_0xbd67('0x8d')](function(_0x3b6778){_0x16e253(_0x3b6778);});})[_0xbd67('0x8d')](function(_0x34bf1d){ut['logger'](_0xbd67('0x114'),_0x34bf1d);_0x16e253(ut[_0xbd67('0x5f')](_0xbd67('0x115'),_0x4b7384,_0x4f81e3));});}else{_0x16e253(ut['message'](_0x117d30[_0xbd67('0x5f')],_0x4b7384,_0x4f81e3));}})[_0xbd67('0x8d')](function(_0x1d0817){ut[_0xbd67('0x5e')](_0xbd67('0x116'),_0x1d0817);_0x16e253(ut['message'](_0xbd67('0x115'),![],!![]));});});};Preview['prototype'][_0xbd67('0x110')]=function(_0x1c1cfe){if(_[_0xbd67('0x84')](_0x1c1cfe)||_[_0xbd67('0x100')](_0x1c1cfe)||!_['isNil'](_0x1c1cfe[0x0][_0xbd67('0x117')])&&_[_0xbd67('0x84')](_0x1c1cfe[0x0][_0xbd67('0x117')][_0xbd67('0x29')])){ut[_0xbd67('0x5e')](_0xbd67('0x118'),_0x1c1cfe);return{'isValid':![],'message':_0xbd67('0x119')};}var _0x2cf1e4=this[_0xbd67('0x14')][_0x1c1cfe[0x0]['Queue'][_0xbd67('0x29')]];_0x2cf1e4[_0xbd67('0x5f')]=_0xbd67('0x9e');if(_[_0xbd67('0x84')](_0x2cf1e4)){ut['logger'](_0xbd67('0x11a'),_0x2cf1e4);return{'isValid':![],'message':_0xbd67('0x11b')};}if(!this[_0xbd67('0x9d')](_0x2cf1e4[_0xbd67('0x53')])){ut['logger'](_0xbd67('0x11c'),_0xbd67('0x11d')+_0x2cf1e4[_0xbd67('0x29')]+_0xbd67('0x11e'));if(!this['isTrunkReachable'](_0x2cf1e4[_0xbd67('0x11f')])){ut[_0xbd67('0x5e')](_0xbd67('0x11c'),_0x2cf1e4[_0xbd67('0x29')]+_0xbd67('0x120'));return{'isValid':![],'message':_0xbd67('0x121')};}}if(!ut[_0xbd67('0x9a')](_0x2cf1e4[_0xbd67('0x9b')])){ut['logger'](_0xbd67('0x122'),_0x2cf1e4[_0xbd67('0x29')]+_0xbd67('0x123'));return{'isValid':![],'message':_0xbd67('0x11d')+_0x2cf1e4['name']+_0xbd67('0x123')};}return{'isValid':!![],'message':_0xbd67('0x124')};};Preview['prototype'][_0xbd67('0x125')]=function(_0x21c0ce,_0x39adb4,_0x2e7836,_0x90a25c){var _0x41bb22=this;return new BPromise(function(_0x566eb4,_0xa545b){var _0x3758ee=_0x21c0ce['uniqueid'];var _0x22edee=_0x41bb22[_0xbd67('0x9d')](_0x39adb4[_0xbd67('0x53')])?util[_0xbd67('0x57')]('SIP/%s/%s%s',_0x39adb4[_0xbd67('0x53')][_0xbd67('0x29')],_[_0xbd67('0x84')](_0x39adb4[_0xbd67('0x39')])?'':_0x39adb4[_0xbd67('0x39')][_0xbd67('0x126')]()||'',_0x39adb4[_0xbd67('0x127')]>0x0?_0x2e7836[_0xbd67('0xfc')][_0xbd67('0xfd')][_0xbd67('0x128')](_0x39adb4['dialCutDigit']):_0x2e7836[_0xbd67('0xfc')]['phone']):util[_0xbd67('0x57')](_0xbd67('0x129'),_[_0xbd67('0x84')](_0x39adb4[_0xbd67('0x11f')])?_0x39adb4[_0xbd67('0x53')][_0xbd67('0x29')]:_0x39adb4[_0xbd67('0x11f')][_0xbd67('0x29')],_['isNil'](_0x39adb4[_0xbd67('0x39')])?'':_0x39adb4[_0xbd67('0x39')]['trim']()||'',_0x39adb4[_0xbd67('0x127')]>0x0?_0x2e7836['Contact'][_0xbd67('0xfd')][_0xbd67('0x128')](_0x39adb4['dialCutDigit']):_0x2e7836['Contact'][_0xbd67('0xfd')]);var _0x5da307=_0x41bb22['isTrunkReachable'](_0x39adb4[_0xbd67('0x53')])?ut['getCallerId'](_0x39adb4['Trunk'][_0xbd67('0x12a')],_0x39adb4[_0xbd67('0x37')],_0x39adb4[_0xbd67('0x12b')]>0x0?ut[_0xbd67('0x12c')](_0x39adb4[_0xbd67('0x12d')],_0x39adb4[_0xbd67('0x12b')]):_0x39adb4[_0xbd67('0x12d')]):ut['getCallerId'](_[_0xbd67('0x84')](_0x39adb4[_0xbd67('0x11f')])?_0x39adb4['Trunk']['callerid']:_0x39adb4[_0xbd67('0x11f')][_0xbd67('0x12a')],_0x39adb4[_0xbd67('0x37')],_0x39adb4[_0xbd67('0x12b')]>0x0?ut['getCallerIdRandom'](_0x39adb4['dialOriginateCallerIdNumber'],_0x39adb4[_0xbd67('0x12b')]):_0x39adb4['dialOriginateCallerIdNumber']);if(_0x5da307){_0x21c0ce[_0xbd67('0x12e')]=ut[_0xbd67('0x12f')](_0x5da307);_0x21c0ce[_0xbd67('0x130')]=ut['extractCalleridNumber'](_0x5da307);}var _0x4b7be0=ut[_0xbd67('0x131')](_0x39adb4,_0x2e7836,_0x22edee,_0x5da307,_0x3758ee,_0x21c0ce);_[_0xbd67('0x132')](_0x21c0ce,ut['toLowerVariables'](_0x4b7be0));_0x21c0ce[_0xbd67('0x8f')]=moment()[_0xbd67('0x57')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xbd67('0x78')](ut[_0xbd67('0x133')](_0x21c0ce,_0x39adb4,_0x4b7be0,_0x21c0ce[_0xbd67('0xcc')],_0x90a25c))[_0xbd67('0x83')](function(_0x51047b){_0x39adb4[_0xbd67('0x4e')]+=0x1;logger['info'](_0xbd67('0x134'),_0x3758ee,'\x20Queue',_0x39adb4['name'],_0xbd67('0x6f'),_0x39adb4[_0xbd67('0x4e')]);_0x566eb4(_0x51047b);})[_0xbd67('0x8d')](function(_0x184fb2){ut['logAgent'](_0x21c0ce,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x21c0ce,_0xbd67('0x135'));_0xa545b(_0x184fb2);});});};Preview[_0xbd67('0xf')][_0xbd67('0x22')]=function(_0x290f6f){if(this[_0xbd67('0x17')][_0x290f6f[_0xbd67('0xaf')]]){this[_0xbd67('0x17')][_0x290f6f['linkedid']]['channel']=_0x290f6f['channel'];}};Preview[_0xbd67('0xf')]['syncOriginateResponse']=function(_0x59dcd4){var _0x2ddf55=this;var _0x51b04e=this[_0xbd67('0x17')][_0x59dcd4[_0xbd67('0x136')]];if(_0x51b04e){if(_0x51b04e[_0xbd67('0xff')]&&this['agents'][_0x51b04e[_0xbd67('0xff')]]){ut[_0xbd67('0x137')](_0x51b04e,this[_0xbd67('0x18')][_0x51b04e[_0xbd67('0xff')]][_0xbd67('0x29')],this['agents'][_0x51b04e[_0xbd67('0xff')]]['id']);}var _0x2bd260=_['clone'](_0x51b04e);_0x2bd260[_0xbd67('0xb1')]=moment()[_0xbd67('0x57')](_0xbd67('0x90'));var _0x14a2e0=_0x2ddf55[_0xbd67('0x14')][_0x51b04e[_0xbd67('0x70')]];if(ut[_0xbd67('0x138')](_0x59dcd4[_0xbd67('0x139')])){if(_0x51b04e['unlockAgent']){rpcDb['unlockContact'](_0x51b04e['idContact']);}if(_0x51b04e[_0xbd67('0xcc')]){rpcDb[_0xbd67('0x8e')](_0x51b04e[_0xbd67('0x13a')]);}ami[_0xbd67('0x27')]('custom:agentringnoanswer',ut[_0xbd67('0xa3')](_0x51b04e,_0xbd67('0x13b'),this[_0xbd67('0x14')][_0x51b04e[_0xbd67('0x70')]]));this[_0xbd67('0xee')](_0x2bd260,_0x14a2e0,_0x59dcd4);}else{_0x51b04e['starttime']=moment()[_0xbd67('0x57')](_0xbd67('0x90'));ut['logAgent'](_0x2bd260,0x4,_0xbd67('0xba'));rpcDb['createAgentHistory'](_0x2bd260,_0xbd67('0x13c'));}}};Preview[_0xbd67('0xf')]['syncHangup']=function(_0x14e960){var _0x493c94=this;var _0x351cbe=this[_0xbd67('0x17')][_0x14e960[_0xbd67('0xaf')]];var _0x2b3212;if(_0x351cbe){_0x2b3212=this[_0xbd67('0x14')][_0x351cbe[_0xbd67('0x70')]];logger[_0xbd67('0x5a')](_0xbd67('0x13d'),_0x14e960[_0xbd67('0xaf')],_0xbd67('0xb3'),_0x2b3212['name'],_0xbd67('0x71'),_0x2b3212[_0xbd67('0x2e')]);}if(this['actions'][_0x14e960['linkedid']]&&_0x14e960[_0xbd67('0xaf')]!==_0x14e960[_0xbd67('0xb2')]){if(_0x14e960['cause']==='16'&&this[_0xbd67('0x17')][_0x14e960[_0xbd67('0xaf')]]['dialAnswer']){this[_0xbd67('0x9f')](_0x14e960,_0x14e960['linkedid'],_0x14e960[_0xbd67('0x13e')]);}else if(this[_0xbd67('0x17')][_0x14e960[_0xbd67('0xaf')]][_0xbd67('0x72')]){logger['info'](_0xbd67('0x13f'),_0x14e960[_0xbd67('0xaf')],_0x14e960[_0xbd67('0x13e')],_0xbd67('0xb3'),_0x2b3212[_0xbd67('0x29')],_0xbd67('0x71'),_0x2b3212[_0xbd67('0x2e')]);this[_0xbd67('0x9f')](_0x14e960,_0x14e960['linkedid'],_0x14e960[_0xbd67('0x13e')]);}}else if(_0x351cbe&&_['isNil'](_0x351cbe[_0xbd67('0x140')])&&_0x2b3212[_0xbd67('0x141')]&&_0x14e960[_0xbd67('0xaf')]===_0x14e960[_0xbd67('0xb2')]&&_[_0xbd67('0x84')](_0x14e960[_0xbd67('0xf1')])&&_0x14e960[_0xbd67('0x13e')]==='16'&&_0x14e960[_0xbd67('0x142')]==='6'&&_[_0xbd67('0xef')](_0x351cbe[_0xbd67('0x143')])){if(_0x351cbe[_0xbd67('0xae')]){rpcDb[_0xbd67('0x10c')](_0x351cbe[_0xbd67('0x13a')]);}if(_0x351cbe[_0xbd67('0xcc')]){rpcDb['disableContact'](_0x351cbe['idContact']);}_0x14e960['reason']='22';this['callProgressDetectingAgent'](_0x351cbe,_0x2b3212,_0x14e960);}else if(_0x351cbe&&_0x351cbe[_0xbd67('0x143')]){if(_0x14e960[_0xbd67('0x13e')]==='16'&&this[_0xbd67('0x17')][_0x14e960[_0xbd67('0xaf')]]['dialAnswer']){logger[_0xbd67('0x5a')](_0xbd67('0x144'),_0x14e960[_0xbd67('0xaf')],_0x14e960[_0xbd67('0x13e')],'\x20Queue',_0x2b3212[_0xbd67('0x29')],'pTalking:\x20',_0x2b3212['pTalking']);this[_0xbd67('0x9f')](_0x14e960,_0x14e960[_0xbd67('0xaf')],_0x14e960[_0xbd67('0x13e')]);}else if(this[_0xbd67('0x17')][_0x14e960['linkedid']][_0xbd67('0x72')]){logger['info'](_0xbd67('0x13f'),_0x14e960[_0xbd67('0xaf')],_0x14e960[_0xbd67('0x13e')],_0xbd67('0xb3'),_0x2b3212[_0xbd67('0x29')],'pTalking:\x20',_0x2b3212[_0xbd67('0x2e')]);this[_0xbd67('0x9f')](_0x14e960,_0x14e960['linkedid'],_0x14e960['cause']);}}};Preview['prototype'][_0xbd67('0x145')]=function(_0x33c787){if(this[_0xbd67('0x17')][_0x33c787['destlinkedid']]&&_0x33c787[_0xbd67('0x146')]!==_0x33c787['destuniqueid']){this[_0xbd67('0x9f')](_0x33c787,_0x33c787['destlinkedid'],_0x33c787['dialstatus']);}};Preview[_0xbd67('0xf')]['syncHangupRequest']=function(_0x51fa0c){if(this['actions'][_0x51fa0c[_0xbd67('0xaf')]]&&_0x51fa0c[_0xbd67('0xaf')]!==_0x51fa0c[_0xbd67('0xb2')]&&!this['actions'][_0x51fa0c[_0xbd67('0xaf')]][_0xbd67('0x72')]){if(_0x51fa0c[_0xbd67('0x13e')]==='1'){this[_0xbd67('0x9f')](_0x51fa0c,_0x51fa0c['linkedid'],_0x51fa0c[_0xbd67('0x13e')]);}}};Preview['prototype'][_0xbd67('0x147')]=function(_0xf4ad5e,_0x1ddeab,_0x4913b7){if(this[_0xbd67('0x17')][_0xf4ad5e]){if(_[_0xbd67('0x84')](this[_0xbd67('0x17')][_0xf4ad5e][_0xbd67('0x148')])){this[_0xbd67('0x17')][_0xf4ad5e][_0xbd67('0x148')]={};}this[_0xbd67('0x17')][_0xf4ad5e][_0xbd67('0x148')][_0x1ddeab]=_0x4913b7;}};Preview['prototype']['syncVarSet']=function(_0xa693c5){try{if(!_[_0xbd67('0x84')](_0xa693c5)){if(ut[_0xbd67('0x149')](_[_0xbd67('0x14a')](_0xa693c5[_0xbd67('0x14b')])[0x0])){this[_0xbd67('0x147')](_0xa693c5[_0xbd67('0xb2')],_[_0xbd67('0x14a')](_0xa693c5[_0xbd67('0x14b')])[0x0],_0xa693c5[_0xbd67('0x14c')]);}}}catch(_0x5e97db){logger[_0xbd67('0x14d')](_0xbd67('0x14e'),util[_0xbd67('0x14f')](_0x5e97db,{'showHidden':![],'depth':null}));}};Preview[_0xbd67('0xf')]['syncAttendedTransfer']=function(_0x5932eb){if(_0x5932eb){if(this[_0xbd67('0x17')][_0x5932eb[_0xbd67('0x150')]]){this[_0xbd67('0x17')][_0x5932eb['transfertargetlinkedid']][_0xbd67('0x143')]=!![];}}};Preview[_0xbd67('0xf')][_0xbd67('0x25')]=function(_0x50c87c){if(_0x50c87c){if(this['actions'][_0x50c87c[_0xbd67('0x151')]]){this[_0xbd67('0x17')][_0x50c87c[_0xbd67('0x151')]][_0xbd67('0x143')]=!![];}}};module[_0xbd67('0x152')]=Preview; \ No newline at end of file +var _0xcd59=['./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','unlockAgent','activeContact','linkedid','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','pick','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami'];(function(_0x7fe492,_0x395b37){var _0x4e347a=function(_0x3ced2e){while(--_0x3ced2e){_0x7fe492['push'](_0x7fe492['shift']());}};_0x4e347a(++_0x395b37);}(_0xcd59,0x14b));var _0x9cd5=function(_0x3df41c,_0x2c4f5c){_0x3df41c=_0x3df41c-0x0;var _0x56cc7b=_0xcd59[_0x3df41c];return _0x56cc7b;};'use strict';var util=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var BPromise=require(_0x9cd5('0x2'));var uuid=require(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var md5=require(_0x9cd5('0x5'));var Redis=require('ioredis');var config=require(_0x9cd5('0x6'));var logger=require(_0x9cd5('0x7'))(_0x9cd5('0x8'));var loggerAction=require(_0x9cd5('0x7'))(_0x9cd5('0x9'));var ami=require(_0x9cd5('0xa'));var rpcDb=require(_0x9cd5('0xb'));var Action=require(_0x9cd5('0xc'));var ut=require(_0x9cd5('0xd'));config[_0x9cd5('0xe')]=_['defaults'](config[_0x9cd5('0xe')],{'host':_0x9cd5('0xf'),'port':0x18eb});var io=require(_0x9cd5('0x10'))(new Redis(config[_0x9cd5('0xe')]));var Sequence=function(){};Sequence[_0x9cd5('0x11')][_0x9cd5('0x12')]=function(_0x46bbca){this[_0x9cd5('0x13')]=this['tail']?this[_0x9cd5('0x13')][_0x9cd5('0x14')](_0x46bbca):_0x46bbca();};function Preview(_0x3fefe6){this[_0x9cd5('0x15')]=new Sequence();this['campaignsPreview']=_0x3fefe6['voiceQueues'];this[_0x9cd5('0x16')]=_0x3fefe6[_0x9cd5('0x16')];this[_0x9cd5('0x17')]={};this[_0x9cd5('0x18')]=_0x3fefe6[_0x9cd5('0x18')];this[_0x9cd5('0x19')]=0x0;ami['on']('originateresponse',this[_0x9cd5('0x1a')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x1c'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0x9cd5('0x1d')][_0x9cd5('0x1b')](this));ami['on']('dialend',this[_0x9cd5('0x1e')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x1f'),this['syncNewExten'][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x20'),this[_0x9cd5('0x21')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x22'),this[_0x9cd5('0x23')]['bind'](this));ami['on'](_0x9cd5('0x24'),this[_0x9cd5('0x25')][_0x9cd5('0x1b')](this));this[_0x9cd5('0x26')](this[_0x9cd5('0x27')]);}function emit(_0x4ed8b9,_0x16c4e9,_0x271444){io['to'](_0x4ed8b9)[_0x9cd5('0x28')](_0x16c4e9,_0x271444);}function emitCampaignPreview(_0x12e402){if(_0x12e402[_0x9cd5('0x29')]===_0x9cd5('0x2a')){var _0x1cf603={'id':_0x12e402['id'],'name':_0x12e402[_0x9cd5('0x2b')],'strategy':_0x12e402[_0x9cd5('0x2c')],'answered':_0x12e402['answered'],'available':_0x12e402[_0x9cd5('0x2d')],'loggedIn':_0x12e402[_0x9cd5('0x2e')],'pTalking':_0x12e402[_0x9cd5('0x2f')],'sumBillable':_0x12e402[_0x9cd5('0x30')],'sumDuration':_0x12e402['sumDuration'],'sumHoldTime':_0x12e402[_0x9cd5('0x31')]||0x0,'talking':_0x12e402[_0x9cd5('0x32')],'total':_0x12e402[_0x9cd5('0x33')],'type':_0x12e402[_0x9cd5('0x29')],'unmanaged':_0x12e402[_0x9cd5('0x34')],'abandoned':_0x12e402[_0x9cd5('0x35')],'waiting':_0x12e402[_0x9cd5('0x36')],'loggedInDb':_0x12e402['loggedInDb'],'dialActive':_0x12e402[_0x9cd5('0x37')],'dialMethod':_0x12e402[_0x9cd5('0x38')],'dialOriginateCallerIdName':_0x12e402[_0x9cd5('0x39')],'dialOriginateCallerIdNumber':_0x12e402['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x12e402['dialOriginateTimeout'],'dialPrefix':_0x12e402[_0x9cd5('0x3a')],'outboundAnswerAgiCallsDay':_0x12e402['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x12e402['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x12e402[_0x9cd5('0x3b')],'outboundBusyCallsDay':_0x12e402[_0x9cd5('0x3c')],'outboundCongestionCallsDay':_0x12e402[_0x9cd5('0x3d')],'outboundDropCallsDayACS':_0x12e402['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x12e402[_0x9cd5('0x3e')],'outboundDropCallsDayTimeout':_0x12e402[_0x9cd5('0x3f')],'outboundNoAnswerCallsDay':_0x12e402[_0x9cd5('0x40')],'outboundNoSuchCallsDay':_0x12e402[_0x9cd5('0x41')],'outboundOriginateFailureCallsDay':_0x12e402[_0x9cd5('0x42')],'outboundReCallsDay':_0x12e402[_0x9cd5('0x43')],'outboundRejectCallsDay':_0x12e402[_0x9cd5('0x44')],'outboundUnknownCallsDay':_0x12e402[_0x9cd5('0x45')],'outboundAbandonedCallsDay':_0x12e402[_0x9cd5('0x46')],'predictiveIntervalAnsweredCalls':_0x12e402[_0x9cd5('0x47')],'predictiveIntervalAvgHoldtime':_0x12e402[_0x9cd5('0x48')],'predictiveIntervalAvgTalktime':_0x12e402[_0x9cd5('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x12e402[_0x9cd5('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x12e402[_0x9cd5('0x4b')],'predictiveIntervalErlangCalls':_0x12e402['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x12e402[_0x9cd5('0x4c')],'predictiveIntervalHitRate':_0x12e402[_0x9cd5('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x12e402['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x12e402['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x12e402[_0x9cd5('0x4e')],'predictiveIntervalTotalCalls':_0x12e402[_0x9cd5('0x4f')],'message':_0x12e402['message'],'originated':_0x12e402[_0x9cd5('0x50')],'erlangCalls':_0x12e402['erlangCalls'],'erlangCallToSecond':_0x12e402['erlangCallToSecond'],'erlangAbandonmentRate':_0x12e402[_0x9cd5('0x51')],'erlangBusyFactor':_0x12e402[_0x9cd5('0x52')],'startPredictive':_0x12e402[_0x9cd5('0x53')],'startProgressive':_0x12e402[_0x9cd5('0x54')]};if(_0x12e402['Trunk']){_0x1cf603[_0x9cd5('0x55')]={'id':_0x12e402[_0x9cd5('0x55')]['id'],'name':_0x12e402[_0x9cd5('0x55')]['name'],'active':_0x12e402[_0x9cd5('0x55')][_0x9cd5('0x56')],'callerid':_0x12e402[_0x9cd5('0x55')][_0x9cd5('0x57')]};}if(_0x12e402[_0x9cd5('0x58')]){_0x1cf603[_0x9cd5('0x58')]={'id':_0x12e402[_0x9cd5('0x58')]['id'],'name':_0x12e402[_0x9cd5('0x58')][_0x9cd5('0x2b')]};}var _0x1ed01d=md5(JSON[_0x9cd5('0x59')](_0x1cf603));if(_0x12e402['md5']!==_0x1ed01d){_0x12e402[_0x9cd5('0x5')]=_0x1ed01d;emit(util['format']('voice:queue:%s',_0x1cf603[_0x9cd5('0x2b')]),_0x9cd5('0x5a'),_0x1cf603);}}}function emitVoiceQueueChannelRemove(_0x46b974){logger[_0x9cd5('0x5b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x9cd5('0x59')](_0x46b974));emit(util[_0x9cd5('0x5c')](_0x9cd5('0x5d'),_0x46b974[_0x9cd5('0x2b')]),'voice_queue_channel:remove',_0x46b974);io[_0x9cd5('0x28')](_0x9cd5('0x5e'),_0x46b974);}function notSendMessagesQueue(_0x1324a2){if(_0x1324a2[_0x9cd5('0x5f')]){if(_0x1324a2[_0x9cd5('0x50')]===0x0&&_0x1324a2[_0x9cd5('0x2f')]===0x0){_0x1324a2['sendMessageOneNotActive']=![];_0x1324a2[_0x9cd5('0x2d')]=0x0;_0x1324a2[_0x9cd5('0x60')]=0x0;_0x1324a2[_0x9cd5('0x61')]=_0x9cd5('0x62');ut[_0x9cd5('0x63')](_0x9cd5('0x64'),_0x1324a2[_0x9cd5('0x2b')]+_0x9cd5('0x65'));}else{_0x1324a2[_0x9cd5('0x61')]=_0x9cd5('0x66');ut[_0x9cd5('0x63')](_0x9cd5('0x64'),_0x1324a2[_0x9cd5('0x2b')]+_0x9cd5('0x67'));}emitCampaignPreview(_0x1324a2);}}Preview[_0x9cd5('0x11')][_0x9cd5('0x26')]=function(){var _0xd94baf=this;setInterval(function(){_0xd94baf[_0x9cd5('0x68')]();},0x7cf);};Preview['prototype'][_0x9cd5('0x68')]=function(){var _0x58ae2e=this[_0x9cd5('0x27')];this[_0x9cd5('0x19')]+=0x1;for(var _0xaa50a in _0x58ae2e){if(_0x58ae2e[_0x9cd5('0x69')](_0xaa50a)&&(_0x58ae2e[_0xaa50a][_0x9cd5('0x38')]==='preview'||_0x58ae2e[_0xaa50a][_0x9cd5('0x38')]===_0x9cd5('0x6a'))&&_0x58ae2e[_0xaa50a][_0x9cd5('0x29')]==='outbound'){if(this[_0x9cd5('0x19')]>0x7){this[_0x9cd5('0x19')]=0x0;this[_0x9cd5('0x6b')]();}}if(_0x58ae2e[_0x9cd5('0x69')](_0xaa50a)&&_0x58ae2e[_0xaa50a]['dialMethod']===_0x9cd5('0x8')&&_0x58ae2e[_0xaa50a][_0x9cd5('0x29')]===_0x9cd5('0x2a')){if(_0x58ae2e[_0xaa50a][_0x9cd5('0x37')]){this[_0x9cd5('0x6c')](_0x58ae2e[_0xaa50a]);if(_0x58ae2e[_0xaa50a][_0x9cd5('0x6d')])this[_0x9cd5('0x6e')](_0x58ae2e[_0xaa50a]);}else{notSendMessagesQueue(_0x58ae2e[_0xaa50a]);}}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x6f')]=function(_0x200d64){var _0x3962c2=this;this[_0x9cd5('0x15')][_0x9cd5('0x12')](function(){if(!_[_0x9cd5('0x70')](_0x3962c2[_0x9cd5('0x17')][_0x200d64])){loggerAction[_0x9cd5('0x5b')](_0x9cd5('0x71'),_0x200d64,_0x9cd5('0x72'),_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')],_0x9cd5('0x74'),JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')]][_0x9cd5('0x50')]),'pTalking:\x20',JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]][_0x9cd5('0x2f')]),JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x75')]),JSON['stringify'](_['pick'](_0x3962c2[_0x9cd5('0x17')][_0x200d64],[_0x9cd5('0x76'),_0x9cd5('0x77'),_0x9cd5('0x78'),'ListId'])));return ami[_0x9cd5('0x79')]({'action':'status','channel':_0x3962c2['actions'][_0x200d64][_0x9cd5('0x7a')]})[_0x9cd5('0x7b')](function(_0x34c5eb){if(_0x34c5eb['message']===_0x9cd5('0x7c')){setTimeout(function(){if(_0x3962c2[_0x9cd5('0x17')][_0x200d64]){ut[_0x9cd5('0x7d')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]],'[clearZombieChannel]');if(_0x3962c2['actions'][_0x200d64][_0x9cd5('0x75')]===!![]){ut[_0x9cd5('0x7e')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x200d64,_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')]);}ut[_0x9cd5('0x7f')](_0x9cd5('0x80')+_0x200d64,_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]);delete _0x3962c2[_0x9cd5('0x17')][_0x200d64];}},0x2328);}});}});};Preview[_0x9cd5('0x11')][_0x9cd5('0x6b')]=function(){var _0x1249a7=this;loggerAction[_0x9cd5('0x5b')](_0x9cd5('0x81'),_[_0x9cd5('0x82')](this[_0x9cd5('0x17')]));for(var _0x3a15af in this['actions']){if(_0x1249a7[_0x9cd5('0x17')][_0x9cd5('0x69')](_0x3a15af)){_0x1249a7['clearZombieChannel'](_0x3a15af);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x6e')]=function(_0xf73845){var _0x1c1812=this;rpcDb[_0x9cd5('0x83')](_0xf73845['id'],ut[_0x9cd5('0x84')](this[_0x9cd5('0x18')]))['then'](function(_0x538ffa){if(!_[_0x9cd5('0x70')](_0x538ffa)){for(var _0x472456=0x0;_0x472456<_0x538ffa[_0x9cd5('0x85')];_0x472456+=0x1){if(ut[_0x9cd5('0x86')](_0x538ffa[_0x472456][_0x9cd5('0x87')])<_0xf73845[_0x9cd5('0x88')]*0x3c){if(_0x538ffa[_0x472456][_0x9cd5('0x89')]&&!_0x538ffa[_0x472456][_0x9cd5('0x89')][_0x9cd5('0x8a')]){_0x1c1812[_0x9cd5('0x8b')](_0x538ffa[_0x472456]['id'])[_0x9cd5('0x8c')](ut[_0x9cd5('0x8d')](_0x9cd5('0x8e')))[_0x9cd5('0x7b')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x9cd5('0x8f')](_0x538ffa[_0x472456]['id']);}}else{var _0x94de58=new Action(_0x538ffa[_0x472456],_0xf73845);_0x94de58[_0x9cd5('0x90')]=moment()['format'](_0x9cd5('0x91'));_0xf73845['outboundReCallsDay']+=0x1;ut[_0x9cd5('0x92')](_0x94de58,0x17,_0x9cd5('0x93'));if(_0xf73845[_0x9cd5('0x94')]){rpcDb['rescheduleContactInQueue'](ut[_0x9cd5('0x95')](_0x538ffa[_0x472456]));rpcDb[_0x9cd5('0x96')](_0x94de58,_0x9cd5('0x97'));}else{ut[_0x9cd5('0x92')](_0x94de58,0x16,_0x9cd5('0x98'));rpcDb['createCustomerHistory'](_0x94de58,_0x9cd5('0x99'));rpcDb['createCustomerFinal'](_0x94de58,_0x9cd5('0x99'));}}}}})['catch'](ut[_0x9cd5('0x8d')](_0x9cd5('0x9a')));};Preview[_0x9cd5('0x11')][_0x9cd5('0x6c')]=function(_0x50c6fb){_0x50c6fb[_0x9cd5('0x5f')]=!![];if(ut[_0x9cd5('0x9b')](_0x50c6fb[_0x9cd5('0x2e')])){_0x50c6fb[_0x9cd5('0x61')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x9cd5('0x9c')](_0x50c6fb[_0x9cd5('0x37')])){_0x50c6fb['message']=_0x9cd5('0x62');}else if(!this[_0x9cd5('0x9d')](_0x50c6fb[_0x9cd5('0x55')])){if(!this[_0x9cd5('0x9d')](_0x50c6fb[_0x9cd5('0x9e')])){_0x50c6fb['message']=_0x9cd5('0x9f');}else{_0x50c6fb[_0x9cd5('0x61')]=_0x9cd5('0xa0');}}else{_0x50c6fb[_0x9cd5('0x61')]=_0x9cd5('0xa0');}emitCampaignPreview(_0x50c6fb);};Preview[_0x9cd5('0x11')][_0x9cd5('0xa1')]=function(_0x35120d,_0x1b037f,_0x5d0599){var _0x1b00d4=this;var _0x3b715e=this['actions'][_0x1b037f];var _0x4baea3=this[_0x9cd5('0x27')][_0x3b715e[_0x9cd5('0x73')]];var _0x594544;if(_0x4baea3){switch(_0x5d0599){case'1':_0x4baea3['outboundNoSuchCallsDay']+=0x1;_0x3b715e[_0x9cd5('0xa2')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x0,'NoSuchNumber');ami['emit'](_0x9cd5('0xa5'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xa7')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xa8'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xac'));}else{if(_0x3b715e['countnosuchnumberretry']>=_0x4baea3[_0x9cd5('0xad')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xac'));}else{rpcDb[_0x9cd5('0xaf')](ut['scheduledAt'](_0x3b715e,_0x9cd5('0xa2'),_0x4baea3['dialNoSuchNumberRetryFrequency']),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}delete this[_0x9cd5('0x17')][_0x35120d[_0x9cd5('0xb2')]];break;case'ANSWER':var _0x3c7cc4=moment()[_0x9cd5('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b715e[_0x9cd5('0xb3')]=_0x3c7cc4;_0x3b715e['answertime']=_0x3c7cc4;_0x3b715e[_0x9cd5('0x75')]=!![];_0x4baea3['pTalking']+=0x1;logger['info'](_0x9cd5('0xb4'),_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x4baea3[_0x9cd5('0x2f')]);ami['emit'](_0x9cd5('0xb8'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xb9'),this['campaignsPreview'][_0x3b715e['queue']]));if(_0x4baea3[_0x9cd5('0xba')]){ami[_0x9cd5('0x28')](_0x9cd5('0xbb'),ut[_0x9cd5('0xbc')](_0x3b715e));}break;case'16':ami[_0x9cd5('0x28')](_0x9cd5('0xbd'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xbe'),this[_0x9cd5('0x27')][_0x3b715e[_0x9cd5('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3b715e,_0x9cd5('0xbe')));_0x4baea3['outboundAnswerCallsDay']+=0x1;_0x4baea3[_0x9cd5('0x33')]+=0x1;_0x4baea3[_0x9cd5('0xbf')]+=0x1;ut[_0x9cd5('0x7e')](_0x4baea3,'[16]');_0x3b715e[_0x9cd5('0xa3')]=ut['totalGlobal'](_0x3b715e);ut['logCustomer'](_0x3b715e,0x4,_0x9cd5('0xc0'));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xc1'));rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xc2'));rpcDb[_0x9cd5('0xc3')](_0x3b715e);_0x4baea3['sumDuration']+=_0x3b715e[_0x9cd5('0xc4')];_0x4baea3[_0x9cd5('0x30')]+=_0x3b715e[_0x9cd5('0xc4')];logger[_0x9cd5('0x5b')]('[syncHangup][talking][decrement]',_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x4baea3[_0x9cd5('0x2f')]);delete this['actions'][_0x35120d[_0x9cd5('0xb2')]];break;case _0x9cd5('0xc5'):_0x4baea3[_0x9cd5('0x3c')]+=0x1;_0x3b715e[_0x9cd5('0xc6')]+=0x1;_0x3b715e['countglobal']=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x5,_0x9cd5('0xc7'));ami[_0x9cd5('0x28')](_0x9cd5('0xc8'),ut[_0x9cd5('0xa6')](_0x3b715e,'busy'));rpcDb[_0x9cd5('0x96')](_0x3b715e,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3b715e[_0x9cd5('0xc6')]>=_0x4baea3['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x3b715e,_0x9cd5('0xc9'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,'countbusyretry',_0x4baea3[_0x9cd5('0xcb')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xcc'):_0x4baea3[_0x9cd5('0x40')]+=0x1;_0x3b715e['countnoanswerretry']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x3,_0x9cd5('0xcd'));ami['emit'](_0x9cd5('0xce'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xcf')));rpcDb['createCustomerHistory'](_0x3b715e,_0x9cd5('0xd0'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xd1'));}else{if(_0x3b715e['countnoanswerretry']>=_0x4baea3[_0x9cd5('0xd2')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0x9cd5('0xca')](_0x3b715e,'countnoanswerretry',_0x4baea3[_0x9cd5('0xd3')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xd4'):_0x4baea3['outboundCongestionCallsDay']+=0x1;_0x3b715e['countcongestionretry']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x8,_0x9cd5('0xd5'));ami[_0x9cd5('0x28')]('custom:agentcongestion',ut['buildObj'](_0x3b715e,_0x9cd5('0xd6')));rpcDb['createCustomerHistory'](_0x3b715e,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,'Global');rpcDb[_0x9cd5('0xae')](_0x594544,_0x9cd5('0xd7'));}else{if(_0x3b715e[_0x9cd5('0xd8')]>=_0x4baea3[_0x9cd5('0xd9')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xda'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,_0x9cd5('0xd8'),_0x4baea3[_0x9cd5('0xcb')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xdb'):_0x4baea3[_0x9cd5('0x44')]+=0x1;_0x3b715e[_0x9cd5('0xdc')]+=0x1;_0x3b715e['countglobal']=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x14,'AgentReject');ami[_0x9cd5('0x28')](_0x9cd5('0xdd'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xde')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xdf'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xe0'));}else{if(_0x3b715e[_0x9cd5('0xdc')]>=_0x4baea3[_0x9cd5('0xe1')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xe0'));}else{rpcDb[_0x9cd5('0xaf')](ut['scheduledAt'](_0x3b715e,_0x9cd5('0xdc'),_0x4baea3[_0x9cd5('0xe2')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xe3'):_0x4baea3[_0x9cd5('0x46')]+=0x1;_0x3b715e[_0x9cd5('0xe4')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut['totalGlobal'](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0xb,_0x9cd5('0xe5'));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xe6'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3b715e[_0x9cd5('0xe7')]>=_0x4baea3[_0x9cd5('0xe8')]){rpcDb['createCustomerFinal'](_0x3b715e,_0x9cd5('0xe6'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,_0x9cd5('0xe4'),_0x4baea3[_0x9cd5('0xe9')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case'18':_0x4baea3[_0x9cd5('0x45')]+=0x1;_0x3b715e[_0x9cd5('0xea')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x12,_0x35120d['cause-txt']||_0x35120d['dialstatus']);ami[_0x9cd5('0x28')](_0x9cd5('0xeb'),ut['buildObj'](_0x3b715e,_0x9cd5('0xec')));rpcDb['createCustomerHistory'](_0x3b715e,_0x9cd5('0xed'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,_0x9cd5('0xed'));}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x9cd5('0x17')][_0x35120d['linkedid']];break;case'19':_0x4baea3[_0x9cd5('0x45')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut['logCustomer'](_0x3b715e,0x13,_0x35120d['cause-txt']||_0x35120d[_0x9cd5('0xee')]);ami[_0x9cd5('0x28')](_0x9cd5('0xeb'),ut['buildObj'](_0x3b715e,_0x9cd5('0xec')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xef'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,'Global');rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xef'));}delete this[_0x9cd5('0x17')][_0x35120d['linkedid']];break;default:if(_0x3b715e['dialAnswer']){ut[_0x9cd5('0x7e')](_0x4baea3,_0x9cd5('0xf0'));ut['loggerError'](_0x9cd5('0xf1')+_0x4baea3[_0x9cd5('0x2b')],_0x35120d);}_0x4baea3['outboundUnknownCallsDay']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0xc,_0x35120d[_0x9cd5('0xf2')]||_0x35120d['dialstatus']);rpcDb[_0x9cd5('0x96')](_0x3b715e,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x9cd5('0x17')][_0x35120d[_0x9cd5('0xb2')]];}if(!(_0x3b715e[_0x9cd5('0x75')]&&_0x5d0599==='16')){ut['updateOriginated'](_0x4baea3,_0x9cd5('0xf3'));logger[_0x9cd5('0x5b')]('[originated][decrement][callProgressDetectingCustomer]',_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],'originated:\x20',_0x4baea3['originated']);}if(_0x5d0599!==_0x9cd5('0xf4')){delete this['actions'][_0x35120d['linkedid']];delete this[_0x9cd5('0x17')][_0x35120d['destlinkedid']];}}};Preview[_0x9cd5('0x11')][_0x9cd5('0xf5')]=function(_0x5e8757,_0x58fc27,_0x4b2713){if(_[_0x9cd5('0xf6')](_0x58fc27)&&_0x9cd5('0xf7')!==typeof _0x58fc27){return;}if(_['isUndefined'](_0x4b2713)&&_0x9cd5('0xf7')!==typeof _0x4b2713){return;}switch(_0x4b2713[_0x9cd5('0xf8')]){case'0':ut[_0x9cd5('0xf9')](_0x5e8757,0x0,_0x9cd5('0xfa'));rpcDb[_0x9cd5('0xfb')](_0x5e8757,_0x9cd5('0xfc'));break;case'3':ut['logAgent'](_0x5e8757,0x3,'NoAnswer');rpcDb[_0x9cd5('0xfb')](_0x5e8757,_0x9cd5('0xfd'));break;case'5':ut['logAgent'](_0x5e8757,0x5,_0x9cd5('0xc7'));rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x9cd5('0xf9')](_0x5e8757,0x8,'Congestion');rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x5e8757,0x16,_0x9cd5('0xfe'));rpcDb['createAgentHistory'](_0x5e8757,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x5e8757,0xc,_0x4b2713['reason']);rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logCongestion]');}ut[_0x9cd5('0x7d')](_0x58fc27,_0x9cd5('0xff'));logger[_0x9cd5('0x5b')](_0x9cd5('0x100'),_0x5e8757['uniqueid'],_0x9cd5('0xb6'),_0x58fc27['name'],_0x9cd5('0x74'),_0x58fc27[_0x9cd5('0x50')]);delete this[_0x9cd5('0x17')][_0x5e8757[_0x9cd5('0xb5')]];};Preview['prototype'][_0x9cd5('0x101')]=function(_0x12db08,_0x352f5c,_0x1545c3,_0x1f35d5,_0x265077){var _0xd813e=this;return new BPromise(function(_0x4bbae2,_0x504ae9){if(_[_0x9cd5('0x70')](_0x352f5c)||_['isNil'](_0x352f5c[_0x9cd5('0x102')])||_[_0x9cd5('0x70')](_0x352f5c['Contact']['phone'])||_[_0x9cd5('0x70')](_0x352f5c['VoiceQueueId'])){_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x103'),_0x1f35d5,_0x265077));return;}var _0x54566d=uuid['v4']();var _0x373644=_0xd813e[_0x9cd5('0x27')][_0x352f5c[_0x9cd5('0x72')][_0x9cd5('0x2b')]];var _0xaba61a=_0x1545c3?_0xd813e[_0x9cd5('0x18')][_0x1545c3]['id']:undefined;_0xd813e[_0x9cd5('0x17')][_0x54566d]=new Action(_0x352f5c,_0x373644,_0x54566d,_0x1545c3,_0xaba61a);var _0x491ed8=_0xd813e[_0x9cd5('0x17')][_0x54566d];_0x491ed8[_0x9cd5('0xb0')]=_0x1f35d5;_0x491ed8['activeContact']=_0x265077;_0x491ed8[_0x9cd5('0x104')]=_0x1545c3;if(_[_0x9cd5('0x105')](_0x12db08)){_0xd813e[_0x9cd5('0x106')](_0x491ed8,_0x373644,_0x352f5c,_0x1545c3)[_0x9cd5('0x8c')](function(_0x36050e){logger[_0x9cd5('0x5b')](_0x9cd5('0x107'),_0x9cd5('0x108')+_0x491ed8[_0x9cd5('0x73')]+'\x20IdHopper:\x20'+_0x491ed8['idContact'],JSON[_0x9cd5('0x59')](_0x36050e));ami[_0x9cd5('0x28')](_0x9cd5('0x109'),ut[_0x9cd5('0xa6')](_0x491ed8,_0x9cd5('0x10a'),_0xd813e[_0x9cd5('0x27')][_0x491ed8[_0x9cd5('0x73')]]));_0x4bbae2(ut[_0x9cd5('0x61')]('Calling'));})[_0x9cd5('0x7b')](function(_0x23cab8){ut[_0x9cd5('0x63')](_0x9cd5('0x10b'),_0x23cab8);_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x10c'),_0x1f35d5,_0x265077));});}else{_0x373644[_0x9cd5('0x3b')]+=0x1;ut[_0x9cd5('0x10d')](_0x491ed8);rpcDb[_0x9cd5('0x10e')](_0x491ed8,_0x9cd5('0x10f'));delete _0xd813e[_0x9cd5('0x17')][_0x54566d];_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x110'),_0x1f35d5,_0x265077));}});};Preview[_0x9cd5('0x11')][_0x9cd5('0x9d')]=function(_0x56c8a7){return!_[_0x9cd5('0x70')](_0x56c8a7)&&!_[_0x9cd5('0x70')](_0x56c8a7[_0x9cd5('0x2b')])&&!_[_0x9cd5('0x70')](_0x56c8a7[_0x9cd5('0x56')])&&_0x56c8a7['active']&&!_['isNil'](this[_0x9cd5('0x16')][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7[_0x9cd5('0x2b')])])&&!_[_0x9cd5('0x70')](this[_0x9cd5('0x16')][util['format'](_0x9cd5('0x111'),_0x56c8a7['name'])][_0x9cd5('0x112')])&&(this[_0x9cd5('0x16')][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7['name'])][_0x9cd5('0x112')]===_0x9cd5('0x113')||this['trunks'][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7[_0x9cd5('0x2b')])]['status']===_0x9cd5('0x114'));};Preview[_0x9cd5('0x11')][_0x9cd5('0x8b')]=function(_0x502a08,_0x50f4b1){var _0x90a557=this;return new BPromise(function(_0x348da2,_0x4075e4){_0x90a557[_0x9cd5('0x115')](_0x502a08,_0x50f4b1)[_0x9cd5('0x8c')](function(_0x57dd6b){_0x348da2(_[_0x9cd5('0x116')](_0x57dd6b,['message']));})[_0x9cd5('0x7b')](function(_0x10b392){if(_0x10b392[_0x9cd5('0x117')]){rpcDb['unlockContact'](_0x502a08);}if(_0x10b392[_0x9cd5('0x56')]){rpcDb[_0x9cd5('0x8f')](_0x502a08);}_0x4075e4(_[_0x9cd5('0x116')](_0x10b392,[_0x9cd5('0x61')]));});});};Preview[_0x9cd5('0x11')][_0x9cd5('0x115')]=function(_0x15e4a9,_0x5e1dca){var _0x3a23b5=this;return new BPromise(function(_0x4a32c3,_0x19ecae){var _0x177bc7,_0x1f9289;rpcDb[_0x9cd5('0x118')](_0x15e4a9)[_0x9cd5('0x8c')](function(_0x2e0b58){if(!_['isNil'](_0x2e0b58[0x0])){_0x1f9289=_0x2e0b58[0x0][_0x9cd5('0x119')]?![]:!![];_0x177bc7=_0x2e0b58[0x0]['recallme']?!![]:![];_0x177bc7=_0x5e1dca?!![]:_0x177bc7;}var _0x93835a=_0x3a23b5[_0x9cd5('0x11a')](_0x2e0b58);if(_0x93835a[_0x9cd5('0x11b')]){rpcDb[_0x9cd5('0x11c')](_['pick'](_0x2e0b58[0x0],['VoiceQueueId',_0x9cd5('0x11d')]))[_0x9cd5('0x8c')](function(_0x2817a3){_0x3a23b5['checkInBlack'](_0x2817a3,_0x2e0b58[0x0],_0x5e1dca,_0x1f9289,_0x177bc7)[_0x9cd5('0x8c')](function(_0x1dc65b){_0x4a32c3(_0x1dc65b);})[_0x9cd5('0x7b')](function(_0x410378){_0x19ecae(_0x410378);});})[_0x9cd5('0x7b')](function(_0x170915){ut[_0x9cd5('0x63')](_0x9cd5('0x11e'),_0x170915);_0x19ecae(ut[_0x9cd5('0x61')]('Call\x20unsuccessful',_0x1f9289,_0x177bc7));});}else{_0x19ecae(ut[_0x9cd5('0x61')](_0x93835a[_0x9cd5('0x61')],_0x1f9289,_0x177bc7));}})[_0x9cd5('0x7b')](function(_0xa468ec){ut[_0x9cd5('0x63')](_0x9cd5('0x11f'),_0xa468ec);_0x19ecae(ut[_0x9cd5('0x61')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x9cd5('0x11')]['validateContact']=function(_0x4e2d6b){if(_['isNil'](_0x4e2d6b)||_[_0x9cd5('0x105')](_0x4e2d6b)||!_[_0x9cd5('0x70')](_0x4e2d6b[0x0]['Agent'])&&_[_0x9cd5('0x70')](_0x4e2d6b[0x0]['Agent'][_0x9cd5('0x2b')])){ut[_0x9cd5('0x63')](_0x9cd5('0x120'),_0x4e2d6b);return{'isValid':![],'message':_0x9cd5('0x121')};}var _0x389641=this[_0x9cd5('0x27')][_0x4e2d6b[0x0][_0x9cd5('0x72')][_0x9cd5('0x2b')]];_0x389641[_0x9cd5('0x61')]=_0x9cd5('0xa0');if(_['isNil'](_0x389641)){ut[_0x9cd5('0x63')]('[Preview][validateContact][Empty\x20Campaign]',_0x389641);return{'isValid':![],'message':_0x9cd5('0x122')};}if(!this['isTrunkReachable'](_0x389641[_0x9cd5('0x55')])){ut[_0x9cd5('0x63')](_0x9cd5('0x123'),'campaign\x20Name:\x20'+_0x389641[_0x9cd5('0x2b')]+_0x9cd5('0x124'));if(!this[_0x9cd5('0x9d')](_0x389641[_0x9cd5('0x9e')])){ut[_0x9cd5('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x389641[_0x9cd5('0x2b')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x9cd5('0x125')};}}if(!ut[_0x9cd5('0x9c')](_0x389641['dialActive'])){ut[_0x9cd5('0x63')](_0x9cd5('0x126'),_0x389641['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x389641[_0x9cd5('0x2b')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x9cd5('0x127')};};Preview[_0x9cd5('0x11')][_0x9cd5('0x106')]=function(_0x2a4db3,_0x57884b,_0x5a7668,_0x82bc74){var _0xbc0826=this;return new BPromise(function(_0x3515fc,_0x362e9f){var _0x39fbd1=_0x2a4db3[_0x9cd5('0xb5')];var _0x21fd2c=_0xbc0826['isTrunkReachable'](_0x57884b[_0x9cd5('0x55')])?util[_0x9cd5('0x5c')](_0x9cd5('0x128'),_0x57884b['Trunk']['name'],_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x3a')])?'':_0x57884b['dialPrefix'][_0x9cd5('0x129')]()||'',_0x57884b[_0x9cd5('0x12a')]>0x0?_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')]['substring'](_0x57884b[_0x9cd5('0x12a')]):_0x5a7668['Contact'][_0x9cd5('0x12b')]):util[_0x9cd5('0x5c')]('SIP/%s/%s%s',_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x9e')])?_0x57884b['Trunk'][_0x9cd5('0x2b')]:_0x57884b[_0x9cd5('0x9e')]['name'],_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x3a')])?'':_0x57884b[_0x9cd5('0x3a')][_0x9cd5('0x129')]()||'',_0x57884b[_0x9cd5('0x12a')]>0x0?_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')][_0x9cd5('0x12c')](_0x57884b[_0x9cd5('0x12a')]):_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')]);var _0x4c2f4c=_0xbc0826[_0x9cd5('0x9d')](_0x57884b[_0x9cd5('0x55')])?ut['getCallerId'](_0x57884b[_0x9cd5('0x55')]['callerid'],_0x57884b[_0x9cd5('0x39')],_0x57884b['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x9cd5('0x12d')](_0x57884b[_0x9cd5('0x12e')],_0x57884b[_0x9cd5('0x12f')]):_0x57884b[_0x9cd5('0x12e')]):ut[_0x9cd5('0x130')](_['isNil'](_0x57884b[_0x9cd5('0x9e')])?_0x57884b[_0x9cd5('0x55')][_0x9cd5('0x57')]:_0x57884b[_0x9cd5('0x9e')]['callerid'],_0x57884b[_0x9cd5('0x39')],_0x57884b[_0x9cd5('0x12f')]>0x0?ut[_0x9cd5('0x12d')](_0x57884b[_0x9cd5('0x12e')],_0x57884b[_0x9cd5('0x12f')]):_0x57884b[_0x9cd5('0x12e')]);if(_0x4c2f4c){_0x2a4db3[_0x9cd5('0x131')]=ut[_0x9cd5('0x132')](_0x4c2f4c);_0x2a4db3['originatecalleridnum']=ut[_0x9cd5('0x133')](_0x4c2f4c);}var _0x527732=ut['addVariables'](_0x57884b,_0x5a7668,_0x21fd2c,_0x4c2f4c,_0x39fbd1,_0x2a4db3);_[_0x9cd5('0x134')](_0x2a4db3,ut['toLowerVariables'](_0x527732));_0x2a4db3[_0x9cd5('0x90')]=moment()['format'](_0x9cd5('0x91'));ami[_0x9cd5('0x79')](ut[_0x9cd5('0x135')](_0x2a4db3,_0x57884b,_0x527732,_0x2a4db3[_0x9cd5('0xb1')],_0x82bc74))['then'](function(_0x409c70){_0x57884b['originated']+=0x1;logger[_0x9cd5('0x5b')](_0x9cd5('0x136'),_0x39fbd1,_0x9cd5('0xb6'),_0x57884b[_0x9cd5('0x2b')],_0x9cd5('0x74'),_0x57884b[_0x9cd5('0x50')]);_0x3515fc(_0x409c70);})[_0x9cd5('0x7b')](function(_0x28fb8a){ut[_0x9cd5('0xf9')](_0x2a4db3,0xe,_0x9cd5('0x137'));rpcDb['createAgentHistory'](_0x2a4db3,_0x9cd5('0x138'));_0x362e9f(_0x28fb8a);});});};Preview[_0x9cd5('0x11')][_0x9cd5('0x139')]=function(_0xd9794d){if(this['actions'][_0xd9794d[_0x9cd5('0xb2')]]){this[_0x9cd5('0x17')][_0xd9794d['linkedid']][_0x9cd5('0x7a')]=_0xd9794d[_0x9cd5('0x7a')];}};Preview[_0x9cd5('0x11')]['syncOriginateResponse']=function(_0x4c0a48){var _0x269225=this;var _0x52cf93=this[_0x9cd5('0x17')][_0x4c0a48[_0x9cd5('0x13a')]];if(_0x52cf93){if(_0x52cf93[_0x9cd5('0x104')]&&this[_0x9cd5('0x18')][_0x52cf93[_0x9cd5('0x104')]]){ut[_0x9cd5('0x13b')](_0x52cf93,this[_0x9cd5('0x18')][_0x52cf93['lookAgent']][_0x9cd5('0x2b')],this[_0x9cd5('0x18')][_0x52cf93[_0x9cd5('0x104')]]['id']);}var _0x593a89=_[_0x9cd5('0x13c')](_0x52cf93);_0x593a89['responsetime']=moment()[_0x9cd5('0x5c')](_0x9cd5('0x91'));var _0x8ddd85=_0x269225[_0x9cd5('0x27')][_0x52cf93['queue']];if(ut[_0x9cd5('0x13d')](_0x4c0a48[_0x9cd5('0x13e')])){if(_0x52cf93[_0x9cd5('0xb0')]){rpcDb[_0x9cd5('0x13f')](_0x52cf93[_0x9cd5('0x140')]);}if(_0x52cf93[_0x9cd5('0xb1')]){rpcDb[_0x9cd5('0x8f')](_0x52cf93[_0x9cd5('0x140')]);}ami[_0x9cd5('0x28')](_0x9cd5('0x141'),ut['buildObj'](_0x52cf93,_0x9cd5('0x142'),this[_0x9cd5('0x27')][_0x52cf93[_0x9cd5('0x73')]]));this['callProgressDetectingAgent'](_0x593a89,_0x8ddd85,_0x4c0a48);}else{_0x52cf93[_0x9cd5('0x90')]=moment()[_0x9cd5('0x5c')](_0x9cd5('0x91'));ut['logAgent'](_0x593a89,0x4,_0x9cd5('0xc0'));rpcDb['createAgentHistory'](_0x593a89,_0x9cd5('0x143'));}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x144')]=function(_0x2ce635){var _0x2bac68=this;var _0x1bf315=this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]];var _0x252b20;if(_0x1bf315){_0x252b20=this[_0x9cd5('0x27')][_0x1bf315[_0x9cd5('0x73')]];logger[_0x9cd5('0x5b')]('[syncHangup][talking]',_0x2ce635[_0x9cd5('0xb2')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x252b20['pTalking']);}if(this['actions'][_0x2ce635[_0x9cd5('0xb2')]]&&_0x2ce635[_0x9cd5('0xb2')]!==_0x2ce635[_0x9cd5('0xb5')]){if(_0x2ce635[_0x9cd5('0x145')]==='16'&&this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]][_0x9cd5('0x75')]){this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')]);}else if(this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]][_0x9cd5('0x75')]){logger[_0x9cd5('0x5b')](_0x9cd5('0x146'),_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],'pTalking:\x20',_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635[_0x9cd5('0xb2')],_0x2ce635['cause']);}}else if(_0x1bf315&&_[_0x9cd5('0x70')](_0x1bf315['statedesc'])&&_0x252b20[_0x9cd5('0x147')]&&_0x2ce635['linkedid']===_0x2ce635[_0x9cd5('0xb5')]&&_[_0x9cd5('0x70')](_0x2ce635['reason'])&&_0x2ce635['cause']==='16'&&_0x2ce635['channelstate']==='6'&&_[_0x9cd5('0xf6')](_0x1bf315[_0x9cd5('0x148')])){if(_0x1bf315['unlockAgent']){rpcDb[_0x9cd5('0x13f')](_0x1bf315[_0x9cd5('0x140')]);}if(_0x1bf315[_0x9cd5('0xb1')]){rpcDb[_0x9cd5('0x8f')](_0x1bf315[_0x9cd5('0x140')]);}_0x2ce635[_0x9cd5('0xf8')]='22';this['callProgressDetectingAgent'](_0x1bf315,_0x252b20,_0x2ce635);}else if(_0x1bf315&&_0x1bf315[_0x9cd5('0x148')]){if(_0x2ce635[_0x9cd5('0x145')]==='16'&&this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]]['dialAnswer']){logger[_0x9cd5('0x5b')](_0x9cd5('0x149'),_0x2ce635[_0x9cd5('0xb2')],_0x2ce635['cause'],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],'pTalking:\x20',_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635['linkedid'],_0x2ce635[_0x9cd5('0x145')]);}else if(this[_0x9cd5('0x17')][_0x2ce635['linkedid']]['dialAnswer']){logger[_0x9cd5('0x5b')]('[syncHangup][talking][cause]',_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635['linkedid'],_0x2ce635[_0x9cd5('0x145')]);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x1e')]=function(_0x5cc594){if(this[_0x9cd5('0x17')][_0x5cc594['destlinkedid']]&&_0x5cc594[_0x9cd5('0x14a')]!==_0x5cc594[_0x9cd5('0x14b')]){this[_0x9cd5('0xa1')](_0x5cc594,_0x5cc594[_0x9cd5('0x14a')],_0x5cc594[_0x9cd5('0xee')]);}};Preview['prototype'][_0x9cd5('0x1d')]=function(_0x5f2a06){if(this[_0x9cd5('0x17')][_0x5f2a06[_0x9cd5('0xb2')]]&&_0x5f2a06['linkedid']!==_0x5f2a06[_0x9cd5('0xb5')]&&!this['actions'][_0x5f2a06['linkedid']][_0x9cd5('0x75')]){if(_0x5f2a06[_0x9cd5('0x145')]==='1'){this[_0x9cd5('0xa1')](_0x5f2a06,_0x5f2a06[_0x9cd5('0xb2')],_0x5f2a06[_0x9cd5('0x145')]);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x14c')]=function(_0x53e1ef,_0xfe62d1,_0x2fd2d2){if(this['actions'][_0x53e1ef]){if(_[_0x9cd5('0x70')](this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')])){this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')]={};}this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')][_0xfe62d1]=_0x2fd2d2;}};Preview[_0x9cd5('0x11')]['syncVarSet']=function(_0x150c19){try{if(!_[_0x9cd5('0x70')](_0x150c19)){if(ut['filterKey'](_[_0x9cd5('0x14e')](_0x150c19[_0x9cd5('0x14f')])[0x0])){this[_0x9cd5('0x14c')](_0x150c19[_0x9cd5('0xb5')],_['keys'](_0x150c19[_0x9cd5('0x14f')])[0x0],_0x150c19[_0x9cd5('0x150')]);}}}catch(_0x127652){logger[_0x9cd5('0x151')](_0x9cd5('0x152'),util['inspect'](_0x127652,{'showHidden':![],'depth':null}));}};Preview[_0x9cd5('0x11')][_0x9cd5('0x23')]=function(_0x36b8b2){if(_0x36b8b2){if(this[_0x9cd5('0x17')][_0x36b8b2[_0x9cd5('0x153')]]){this[_0x9cd5('0x17')][_0x36b8b2[_0x9cd5('0x153')]][_0x9cd5('0x148')]=!![];}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x25')]=function(_0x56d272){if(_0x56d272){if(this[_0x9cd5('0x17')][_0x56d272[_0x9cd5('0x154')]]){this[_0x9cd5('0x17')][_0x56d272[_0x9cd5('0x154')]]['transfer']=!![];}}};module[_0x9cd5('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3f07c27..8a71aa1 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 _0x0ec1=['[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','context','from-sip','exten','xcally-motion-preview','assigned','COMPLETED','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active'];(function(_0x5d401b,_0x1520ae){var _0x434d2e=function(_0x40a07b){while(--_0x40a07b){_0x5d401b['push'](_0x5d401b['shift']());}};_0x434d2e(++_0x1520ae);}(_0x0ec1,0x1db));var _0x10ec=function(_0x47f8a5,_0x264c75){_0x47f8a5=_0x47f8a5-0x0;var _0x2312f1=_0x0ec1[_0x47f8a5];return _0x2312f1;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x10ec('0x0'));var _=require('lodash');var cmHopper=require(_0x10ec('0x1'));var cmHopperFinal=require(_0x10ec('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x10ec('0x3'));var voiceQueueRt=require(_0x10ec('0x4'));var agentReportPreview=require(_0x10ec('0x5'));var voiceQueueReport=require(_0x10ec('0x6'));function loggerCatch(_0x3d270e){return function(_0x117f05){logger[_0x10ec('0x7')](_0x3d270e,util[_0x10ec('0x8')](_0x117f05,{'showHidden':![],'depth':null}));};}function create(_0x5695ed){return BPromise['resolve']()[_0x10ec('0x9')](cmHopperHistory[_0x10ec('0xa')](_0x5695ed))[_0x10ec('0xb')](loggerCatch(_0x10ec('0xc')));}function createAgent(_0x1104eb){return BPromise['resolve']()[_0x10ec('0x9')](agentReportPreview[_0x10ec('0xa')](_0x1104eb))[_0x10ec('0xb')](loggerCatch(_0x10ec('0xc')));}function moveContact(_0x51ffe1){return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](cmHopper[_0x10ec('0xe')](_0x51ffe1,!![]))[_0x10ec('0xb')](loggerCatch(_0x10ec('0xf')));}exports[_0x10ec('0x10')]=function(_0x4ce6dd){return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](cmHopperBlack['checkIsBlackList'](_0x4ce6dd))[_0x10ec('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x10ec('0x11')]=function(_0x332861){return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](cmHopper[_0x10ec('0x11')](_0x332861))[_0x10ec('0xb')](loggerCatch(_0x10ec('0x12')));};exports[_0x10ec('0xa')]=function(_0x472a5c,_0x99e156){create(_0x472a5c)[_0x10ec('0xb')](loggerCatch(_0x99e156));moveContact(_0x472a5c)['catch'](loggerCatch(_0x99e156));};exports[_0x10ec('0x13')]=function(_0x505817,_0x128b2b){createAgent(_0x505817)[_0x10ec('0xb')](loggerCatch(_0x128b2b));};exports[_0x10ec('0x14')]=function(_0x336e39,_0x279f10){create(_0x336e39)[_0x10ec('0xb')](loggerCatch(_0x279f10));};exports[_0x10ec('0x15')]=function(_0x386f03,_0x5920e0){moveContact(_0x386f03)['catch'](loggerCatch(_0x5920e0));};exports[_0x10ec('0x16')]=function(_0x32168d,_0x120f22,_0x4976bb){if(_0x120f22){_0x32168d[_0x10ec('0x17')]=null;}if(_0x4976bb){_0x32168d[_0x10ec('0x18')]=![];}return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](cmHopper[_0x10ec('0x16')](_0x32168d))[_0x10ec('0xb')](loggerCatch(_0x10ec('0x19')));};exports[_0x10ec('0x1a')]=function(_0xd005e8){return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](cmHopper[_0x10ec('0x1a')](_0xd005e8))[_0x10ec('0xb')](loggerCatch(_0x10ec('0x1b')));};exports[_0x10ec('0x1c')]=function(_0x1f0d52){return BPromise['resolve']()['then'](cmHopper[_0x10ec('0x1c')]({'UserId':null},_0x1f0d52,0x1))[_0x10ec('0xb')](loggerCatch(_0x10ec('0x1d')));};exports[_0x10ec('0x1e')]=function(_0x42d5bc){return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](cmHopper[_0x10ec('0x1c')]({'active':![]},_0x42d5bc,0x1))[_0x10ec('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x10ec('0x1f')]=function(_0xc07351){var _0x397b52={};_0x397b52[_0x10ec('0x20')]=_0xc07351[_0x10ec('0x20')];_0x397b52[_0x10ec('0x21')]=_0xc07351[_0x10ec('0x21')];_0x397b52[_0x10ec('0x22')]=_0xc07351['calleridnum'];_0x397b52[_0x10ec('0x23')]=_0xc07351['calleridname'];_0x397b52[_0x10ec('0x24')]=_0xc07351[_0x10ec('0x24')];_0x397b52[_0x10ec('0x25')]=_0xc07351[_0x10ec('0x26')];_0x397b52['queuecallerleaveAt']=_0xc07351[_0x10ec('0x26')];_0x397b52[_0x10ec('0x27')]=0x1;_0x397b52[_0x10ec('0x28')]=_0xc07351['endtime'];_0x397b52['connectedlinename']=_0xc07351['membername'];_0x397b52[_0x10ec('0x29')]=_0x10ec('0x2a');_0x397b52[_0x10ec('0x2b')]=_0x10ec('0x2c');_0x397b52['holdtime']=0x0;_0x397b52[_0x10ec('0x2d')]=0x1;_0x397b52['lastAssignedTo']=_0xc07351['membername'];_0x397b52['queuecallerexitreason']=_0x10ec('0x2e');return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](voiceQueueReport['create'](_0x397b52))[_0x10ec('0xb')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x58a3f1,_0x2eb5a8){return BPromise['resolve']()[_0x10ec('0x9')](cmHopper['getContactRecallMe'](_0x58a3f1,_0x2eb5a8))[_0x10ec('0xb')](loggerCatch(_0x10ec('0x2f')));};exports[_0x10ec('0x30')]=function(_0x1258ab){return BPromise[_0x10ec('0xd')]()[_0x10ec('0x9')](cmHopper[_0x10ec('0x16')](_0x1258ab,!![],!![]))[_0x10ec('0xb')](loggerCatch(_0x10ec('0x31')));}; \ No newline at end of file +var _0x41a2=['moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','resolve','catch','[createHistory]\x20','then','createHistory'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x41a2,0x12c));var _0x241a=function(_0x148783,_0x1ac458){_0x148783=_0x148783-0x0;var _0x85329a=_0x41a2[_0x148783];return _0x85329a;};'use strict';var util=require(_0x241a('0x0'));var BPromise=require(_0x241a('0x1'));var logger=require(_0x241a('0x2'))('preview');var _=require(_0x241a('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x241a('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x241a('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x241a('0x6'));function loggerCatch(_0x34802e){return function(_0x468612){logger['error'](_0x34802e,util['inspect'](_0x468612,{'showHidden':![],'depth':null}));};}function create(_0x3c7b75){return BPromise[_0x241a('0x7')]()['then'](cmHopperHistory['createHistory'](_0x3c7b75))[_0x241a('0x8')](loggerCatch(_0x241a('0x9')));}function createAgent(_0x4c4b36){return BPromise[_0x241a('0x7')]()[_0x241a('0xa')](agentReportPreview[_0x241a('0xb')](_0x4c4b36))[_0x241a('0x8')](loggerCatch(_0x241a('0x9')));}function moveContact(_0x1377fa){return BPromise[_0x241a('0x7')]()['then'](cmHopper[_0x241a('0xc')](_0x1377fa,!![]))[_0x241a('0x8')](loggerCatch(_0x241a('0xd')));}exports[_0x241a('0xe')]=function(_0x13797b){return BPromise[_0x241a('0x7')]()[_0x241a('0xa')](cmHopperBlack[_0x241a('0xe')](_0x13797b))[_0x241a('0x8')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x241a('0xf')]=function(_0x370c97){return BPromise[_0x241a('0x7')]()[_0x241a('0xa')](cmHopper[_0x241a('0xf')](_0x370c97))[_0x241a('0x8')](loggerCatch('[getContactPreview]\x20'));};exports[_0x241a('0xb')]=function(_0xd152e7,_0x4f7bdb){create(_0xd152e7)[_0x241a('0x8')](loggerCatch(_0x4f7bdb));moveContact(_0xd152e7)[_0x241a('0x8')](loggerCatch(_0x4f7bdb));};exports[_0x241a('0x10')]=function(_0x207c9d,_0x31f890){createAgent(_0x207c9d)[_0x241a('0x8')](loggerCatch(_0x31f890));};exports[_0x241a('0x11')]=function(_0x46f063,_0x17dfca){create(_0x46f063)[_0x241a('0x8')](loggerCatch(_0x17dfca));};exports[_0x241a('0x12')]=function(_0x421e9a,_0x59f4ea){moveContact(_0x421e9a)[_0x241a('0x8')](loggerCatch(_0x59f4ea));};exports[_0x241a('0x13')]=function(_0x277c57,_0xf572b9,_0x2a7a13){if(_0xf572b9){_0x277c57[_0x241a('0x14')]=null;}if(_0x2a7a13){_0x277c57[_0x241a('0x15')]=![];}return BPromise[_0x241a('0x7')]()['then'](cmHopper['rescheduleContact'](_0x277c57))[_0x241a('0x8')](loggerCatch(_0x241a('0x16')));};exports[_0x241a('0x17')]=function(_0x361002){return BPromise['resolve']()['then'](cmHopper[_0x241a('0x17')](_0x361002))[_0x241a('0x8')](loggerCatch(_0x241a('0x18')));};exports['unlockContact']=function(_0x5aa33b){return BPromise[_0x241a('0x7')]()[_0x241a('0xa')](cmHopper[_0x241a('0x19')]({'UserId':null},_0x5aa33b,0x1))[_0x241a('0x8')](loggerCatch(_0x241a('0x1a')));};exports[_0x241a('0x1b')]=function(_0x52f357){return BPromise[_0x241a('0x7')]()['then'](cmHopper[_0x241a('0x19')]({'active':![]},_0x52f357,0x1))[_0x241a('0x8')](loggerCatch(_0x241a('0x1c')));};exports[_0x241a('0x1d')]=function(_0x254138){var _0x20a733={};_0x20a733['type']=_0x254138['type'];_0x20a733[_0x241a('0x1e')]=_0x254138[_0x241a('0x1e')];_0x20a733[_0x241a('0x1f')]=_0x254138[_0x241a('0x1f')];_0x20a733['calleridname']=_0x254138[_0x241a('0x20')];_0x20a733[_0x241a('0x21')]=_0x254138[_0x241a('0x21')];_0x20a733[_0x241a('0x22')]=_0x254138['answertime'];_0x20a733[_0x241a('0x23')]=_0x254138['answertime'];_0x20a733[_0x241a('0x24')]=0x1;_0x20a733['queuecallercompleteAt']=_0x254138[_0x241a('0x25')];_0x20a733[_0x241a('0x26')]=_0x254138[_0x241a('0x27')];_0x20a733[_0x241a('0x28')]=_0x241a('0x29');_0x20a733[_0x241a('0x2a')]=_0x241a('0x2b');_0x20a733['holdtime']=0x0;_0x20a733[_0x241a('0x2c')]=0x1;_0x20a733[_0x241a('0x2d')]=_0x254138[_0x241a('0x27')];_0x20a733[_0x241a('0x2e')]='COMPLETED';return BPromise[_0x241a('0x7')]()['then'](voiceQueueReport[_0x241a('0x2f')](_0x20a733))[_0x241a('0x8')](loggerCatch(_0x241a('0x30')));};exports['getContactRecallMe']=function(_0x2f265e,_0x29b906){return BPromise[_0x241a('0x7')]()[_0x241a('0xa')](cmHopper['getContactRecallMe'](_0x2f265e,_0x29b906))[_0x241a('0x8')](loggerCatch(_0x241a('0x31')));};exports[_0x241a('0x32')]=function(_0x50fd62){return BPromise[_0x241a('0x7')]()[_0x241a('0xa')](cmHopper[_0x241a('0x13')](_0x50fd62,!![],!![]))[_0x241a('0x8')](loggerCatch(_0x241a('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 8bf9fdc..5ee7e7f 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 _0xc205=['buildObj','lastevent','interface','channelAgent','voice','mandatoryDisposition','queue','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','campaigntype','dialAnswer','active','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','endtime','logAgent','responsetime','ringtime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','Global','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn'];(function(_0xda6d0f,_0x35e271){var _0x244540=function(_0x30f643){while(--_0x30f643){_0xda6d0f['push'](_0xda6d0f['shift']());}};_0x244540(++_0x35e271);}(_0xc205,0x1d0));var _0x5c20=function(_0x54ae77,_0x10a04e){_0x54ae77=_0x54ae77-0x0;var _0x5d63b3=_0xc205[_0x54ae77];return _0x5d63b3;};'use strict';var util=require(_0x5c20('0x0'));var _=require(_0x5c20('0x1'));var moment=require(_0x5c20('0x2'));var logger=require(_0x5c20('0x3'))(_0x5c20('0x4'));var ipAgi=process[_0x5c20('0x5')]['XCALLY_IP_AGI']||_0x5c20('0x6');function getSeconds(_0x30c522,_0x46e31d){var _0x25b091=moment(_0x30c522)[_0x5c20('0x7')](0x0);var _0x945f79=moment(_0x46e31d)[_0x5c20('0x7')](0x0);return _0x25b091['diff'](_0x945f79,_0x5c20('0x8'));}exports[_0x5c20('0x9')]=function(_0x4d54ff){return function(_0x5ea877){logger[_0x5c20('0xa')](_0x4d54ff,util[_0x5c20('0xb')](_0x5ea877,{'showHidden':![],'depth':null}));};};exports[_0x5c20('0xc')]=function(_0x33808e,_0x16b1c0){logger[_0x5c20('0xd')](_0x33808e,util[_0x5c20('0xb')](_0x16b1c0,{'showHidden':![],'depth':null}));};exports[_0x5c20('0xe')]=function(_0xb2284f,_0x5e94af){logger[_0x5c20('0xa')](_0xb2284f,util['inspect'](_0x5e94af,{'showHidden':![],'depth':null}));};exports[_0x5c20('0xf')]=function(_0xad9e1b){return function(_0x288cfa){logger[_0x5c20('0xd')](_0xad9e1b,util['inspect'](_0x288cfa,{'showHidden':![],'depth':null}));};};exports[_0x5c20('0x10')]=function(_0x2c2498,_0xe58d34,_0x5e07f4){return{'message':_0x2c2498,'unlock':_0xe58d34,'active':_0x5e07f4};};exports[_0x5c20('0x11')]=function(_0x26d546,_0x3d3fdf,_0x28089d){if(!_[_0x5c20('0x12')](_0x28089d)&&_0x5c20('0x13')===typeof _0x28089d&&!_['isEmpty'](_0x28089d)){if(!_[_0x5c20('0x12')](_0x3d3fdf)&&_0x5c20('0x13')===typeof _0x3d3fdf&&!_[_0x5c20('0x14')](_0x3d3fdf)){return util['format'](_0x5c20('0x15'),_0x3d3fdf,_0x28089d);}return util[_0x5c20('0x16')](_0x5c20('0x15'),_0x28089d,_0x28089d);}if(!_[_0x5c20('0x12')](_0x26d546)&&_0x5c20('0x13')===typeof _0x26d546&&!_[_0x5c20('0x14')](_0x26d546)){return _0x26d546;}return _0x5c20('0x17');};exports['isActive']=function(_0x46e20f){if(_[_0x5c20('0x18')](_0x46e20f)){return![];}return _0x46e20f;};exports[_0x5c20('0x19')]=function(_0x46196,_0x49a5f8,_0x1142c8,_0x3b560b,_0x3a53e9,_0x5a1470){var _0x55b8df={'XMD-QUEUE':_0x49a5f8[_0x5c20('0x1a')]?_0x49a5f8[_0x5c20('0x1a')][_0x5c20('0x1b')]:'','XMD-CALLERID':_0x3b560b,'XMD-CALLERID-PREVIEW':_0x5a1470?util[_0x5c20('0x16')](_0x5c20('0x15'),_0x5a1470[_0x5c20('0x1c')],_0x5a1470[_0x5c20('0x1d')]):_0x3b560b,'XMD-DIALID':_0x3a53e9,'XMD-CONTACTID':_0x49a5f8[_0x5c20('0x1e')],'XMD-CDRTYPE':_0x5c20('0x1f'),'CALLERID(all)':_0x3b560b,'XMD-VOICEQUEUEID':_0x49a5f8['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1142c8,'XMD-DIALTIMEOUT':_0x46196['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x5c20('0x16')](_0x5c20('0x20'),_0x46196['dialQueueProject2']?'g':'',_[_0x5c20('0x14')](_0x46196[_0x5c20('0x21')])?'':_0x5c20('0x22')),'XMD-DIALURL':_0x46196[_0x5c20('0x23')]||'','XMD-AGI':_0x46196['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x46196[_0x5c20('0x24')]):_0x5c20('0x25'),'XMD-AGIAFTER':_0x46196[_0x5c20('0x26')]?util[_0x5c20('0x16')](_0x5c20('0x27'),ipAgi,_0x46196[_0x5c20('0x26')]):_0x5c20('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x5a1470?_0x5a1470[_0x5c20('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x5a1470?_0x5a1470[_0x5c20('0x29')]:'','XMD-DESTINATION':_0x5c20('0x2a'),'SIPADDHEADER':_0x5c20('0x2b')};if(!_[_0x5c20('0x14')](_0x46196[_0x5c20('0x21')])){_0x55b8df[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x46196[_0x5c20('0x21')];_0x55b8df[util[_0x5c20('0x16')]('%s',_0x5c20('0x2c'))]=_0x3a53e9;}if(_0x49a5f8&&_0x49a5f8[_0x5c20('0x2d')]){for(var _0x57d2c6 in _0x49a5f8[_0x5c20('0x2d')]){if(_0x49a5f8['Contact'][_0x5c20('0x2e')](_0x57d2c6)){if(!_[_0x5c20('0x18')](_0x49a5f8[_0x5c20('0x2d')][_0x57d2c6])&&_0x57d2c6!=='id'&&_0x57d2c6!=='tags'&&_0x57d2c6!=='createdAt'&&_0x57d2c6!==_0x5c20('0x2f')){_0x55b8df[util[_0x5c20('0x16')]('%s%s',_0x5c20('0x30'),_[_0x5c20('0x31')](_0x57d2c6))]=_0x49a5f8[_0x5c20('0x2d')][_0x57d2c6];}}}}return _0x55b8df;};exports[_0x5c20('0x32')]=function(_0x1e6b9b){var _0x2eb860={};for(var _0x34e0e8 in _0x1e6b9b){if(_0x1e6b9b[_0x5c20('0x2e')](_0x34e0e8)){_0x2eb860[util[_0x5c20('0x16')]('%s',_['toLower'](_0x34e0e8))]=_0x1e6b9b[_0x34e0e8];}}return{'variables':_0x2eb860};};exports[_0x5c20('0x33')]=function(_0x4dff9b,_0x1abc59){if(!_[_0x5c20('0x18')](_0x4dff9b)){if(_0x4dff9b[_0x5c20('0x2e')](_0x5c20('0x34'))){if(_0x4dff9b['originated']>0x0){_0x4dff9b[_0x5c20('0x34')]-=0x1;}else{logger[_0x5c20('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1abc59);}}}else{logger[_0x5c20('0xa')](_0x5c20('0x35'),_0x1abc59);}};exports[_0x5c20('0x36')]=function(_0x2689cf){var _0x214d6d=moment()[_0x5c20('0x16')](_0x5c20('0x37'));_0x2689cf[_0x5c20('0x38')]=0xd;_0x2689cf[_0x5c20('0x39')]=_0x5c20('0x3a');_0x2689cf['starttime']=_0x214d6d;_0x2689cf['responsetime']=_0x214d6d;_0x2689cf[_0x5c20('0x3b')]=_0x214d6d;};exports[_0x5c20('0x3c')]=function(_0x7eb06c,_0x1cfd1d,_0x7622ec){var _0x54b37c=moment()[_0x5c20('0x16')](_0x5c20('0x37'));_0x7eb06c['state']=_0x1cfd1d;_0x7eb06c[_0x5c20('0x39')]=_0x7622ec;_0x7eb06c[_0x5c20('0x3d')]=_0x54b37c;_0x7eb06c[_0x5c20('0x3e')]=getSeconds(_0x7eb06c[_0x5c20('0x3d')],_0x7eb06c['starttime']);};exports['logLookAgent']=function(_0x2e8db3,_0x902c2d,_0x370c4a){_0x2e8db3[_0x5c20('0x3f')]=_0x902c2d;_0x2e8db3[_0x5c20('0x40')]=_0x370c4a;};exports[_0x5c20('0x41')]=function(_0x1fb1e8,_0x53eae3,_0x1fe346){var _0x4b76d3=moment()['format'](_0x5c20('0x37'));_0x1fb1e8['state']=_0x53eae3;_0x1fb1e8[_0x5c20('0x39')]=_0x1fe346;_0x1fb1e8[_0x5c20('0x3d')]=_0x1fb1e8['responsetime']?_0x1fb1e8[_0x5c20('0x3d')]:_0x4b76d3;_0x1fb1e8['endtime']=_0x1fb1e8[_0x5c20('0x3b')]?_0x1fb1e8[_0x5c20('0x3b')]:_0x4b76d3;_0x1fb1e8[_0x5c20('0x3e')]=getSeconds(_0x1fb1e8['responsetime']||0x0,_0x1fb1e8['starttime']||0x0);_0x1fb1e8[_0x5c20('0x42')]=_0x1fb1e8[_0x5c20('0x43')]?getSeconds(_0x1fb1e8[_0x5c20('0x3b')],_0x1fb1e8[_0x5c20('0x43')]):0x0;};exports[_0x5c20('0x44')]=function(_0xb890ca){return _0xb890ca===_0x5c20('0x45');};exports[_0x5c20('0x46')]=function(_0x44f1cb,_0x22d538,_0x51baf0,_0x400108,_0x541df1){var _0x583f59=_0x400108?_0x5c20('0x47'):_0x44f1cb[_0x5c20('0x1c')];_0x583f59=_0x541df1?_0x5c20('0x48'):_0x583f59;return{'actionid':_0x44f1cb[_0x5c20('0x49')],'action':_0x5c20('0x4a'),'channel':_0x44f1cb['channelAgent'],'callerid':util[_0x5c20('0x16')]('\x22%s\x22\x20<%s>',_0x583f59,_0x44f1cb[_0x5c20('0x1d')]),'Exten':_0x5c20('0x2a'),'Context':_0x5c20('0x4b'),'Priority':'1','variable':_0x51baf0,'timeout':(_0x22d538[_0x5c20('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x44f1cb[_0x5c20('0x49')]};};exports[_0x5c20('0x4d')]=function(_0x62510b){return _0x62510b[_0x5c20('0x4e')]+_0x62510b[_0x5c20('0x4f')]+_0x62510b[_0x5c20('0x50')]+_0x62510b['countagentrejectretry']+_0x62510b['countnosuchnumberretry'];};exports['cloneAction']=function(_0x5a6a8f){var _0x5b9ca1=_['clone'](_0x5a6a8f);_0x5b9ca1['state']=0xf;_0x5b9ca1[_0x5c20('0x39')]=_0x5c20('0x51');return _0x5b9ca1;};exports[_0x5c20('0x52')]=function(_0x29104e,_0x3f03b8,_0x51a508){var _0x1bac90={};_0x1bac90[_0x3f03b8]=_0x29104e[_0x3f03b8];_0x1bac90['active']=![];_0x1bac90[_0x5c20('0x53')]=moment()[_0x5c20('0x54')](_0x51a508,_0x5c20('0x55'))[_0x5c20('0x16')](_0x5c20('0x37'));_0x1bac90[_0x5c20('0x1e')]=_0x29104e['ContactId'];_0x1bac90[_0x5c20('0x56')]=_0x29104e[_0x5c20('0x56')];_0x1bac90[_0x5c20('0x57')]=_0x29104e[_0x5c20('0x57')]||undefined;return _0x1bac90;};exports[_0x5c20('0x58')]=function(_0x24895a,_0x1d03e4){if(!_[_0x5c20('0x18')](_0x24895a)){if(_0x24895a[_0x5c20('0x59')]>0x0){_0x24895a[_0x5c20('0x59')]-=0x1;}else{logger['error'](_0x1d03e4,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x5c20('0xa')](_0x1d03e4,_0x5c20('0x5a'));}};exports[_0x5c20('0x5b')]=function(_0x16c84c){if(_0x16c84c<=0x0){return!![];}return![];};exports[_0x5c20('0x5c')]=function(_0x20e0ed,_0x1bd06,_0xdc06e){_0x20e0ed[_0x5c20('0x5d')]=_0x1bd06;_0x20e0ed[_0x5c20('0x1b')]=_0x20e0ed['queue'];_0x20e0ed[_0x5c20('0x5e')]=_0x20e0ed[_0x5c20('0x5f')];_0x20e0ed['motionChannel']=_0x5c20('0x60');if(_0xdc06e){_0x20e0ed[_0x5c20('0x61')]=_0xdc06e[_0x5c20('0x61')];}return _0x20e0ed;};exports['buildAcw']=function(_0x4f7fa7){var _0x2dbad4={};_0x2dbad4[_0x5c20('0x62')]=_0x4f7fa7[_0x5c20('0x62')];_0x2dbad4[_0x5c20('0x5e')]=_0x4f7fa7['channelAgent'];_0x2dbad4[_0x5c20('0x49')]=_0x4f7fa7[_0x5c20('0x49')];return _0x2dbad4;};exports[_0x5c20('0x63')]=function(_0x312933){var _0x6f5a59=[];for(var _0x3bc015 in _0x312933){if(_0x312933[_0x5c20('0x2e')](_0x3bc015)){if(!_[_0x5c20('0x18')](_0x312933[_0x3bc015])&&_0x312933[_0x3bc015]['state']===_0x5c20('0x64')&&_0x312933[_0x3bc015][_0x5c20('0x65')]===_0x5c20('0x66')){_0x6f5a59[_0x5c20('0x67')](_0x312933[_0x3bc015]['id']);}}}return _0x6f5a59;};exports[_0x5c20('0x68')]=function(_0x26489b){var _0x23a4eb=moment()['milliseconds'](0x0);var _0x599ba6=moment(_0x26489b)[_0x5c20('0x7')](0x0);return _0x23a4eb['diff'](_0x599ba6,'seconds');};exports[_0x5c20('0x69')]=function(_0x12defd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x12defd[_0x5c20('0x1e')],'ListId':_0x12defd['ListId'],'VoiceQueueId':_0x12defd[_0x5c20('0x57')]||undefined,'CampaignId':_0x12defd[_0x5c20('0x6a')]||undefined};};exports['filterKey']=function(_0x61f95c){if(_0x61f95c===_0x5c20('0x49')||_0x61f95c===_0x5c20('0x6b')||_0x61f95c===_0x5c20('0x62')||_0x61f95c==='type'||_0x61f95c===_0x5c20('0x6c')||_0x61f95c===_0x5c20('0x6d')||_0x61f95c===_0x5c20('0x3f')||_0x61f95c==='channelAgent'||_0x61f95c===_0x5c20('0x1c')||_0x61f95c===_0x5c20('0x6e')||_0x61f95c===_0x5c20('0x1d')||_0x61f95c===_0x5c20('0x53')||_0x61f95c==='countbusyretry'||_0x61f95c==='countcongestionretry'||_0x61f95c==='countnoanswerretry'||_0x61f95c==='countglobal'||_0x61f95c===_0x5c20('0x6f')||_0x61f95c===_0x5c20('0x70')||_0x61f95c==='callbackat'||_0x61f95c===_0x5c20('0x71')||_0x61f95c===_0x5c20('0x1e')||_0x61f95c==='ListId'||_0x61f95c===_0x5c20('0x40')||_0x61f95c===_0x5c20('0x57')||_0x61f95c===_0x5c20('0x72')||_0x61f95c===_0x5c20('0x73')||_0x61f95c===_0x5c20('0x74')||_0x61f95c===_0x5c20('0x75')||_0x61f95c==='xmd-listid'||_0x61f95c==='xmd-dialurl'||_0x61f95c===_0x5c20('0x76')||_0x61f95c==='xmd-dialoptions'||_0x61f95c==='xmd-dialid'||_0x61f95c==='xmd-dialchannel'||_0x61f95c===_0x5c20('0x77')||_0x61f95c===_0x5c20('0x78')||_0x61f95c===_0x5c20('0x79')||_0x61f95c===_0x5c20('0x7a')||_0x61f95c===_0x5c20('0x7b')||_0x61f95c===_0x5c20('0x7c')||_0x61f95c===_0x5c20('0x7d')||_0x61f95c===_0x5c20('0x7e')||_0x61f95c===_0x5c20('0x7f')||_0x61f95c===_0x5c20('0x80')||_0x61f95c==='rtpaudioqoslossbridged'||_0x61f95c==='rtpaudioqosrtt'||_0x61f95c===_0x5c20('0x81')||_0x61f95c==='rtpaudioqos'||_0x61f95c==='rtpaudioqosbridged'||_0x61f95c===_0x5c20('0x7e')||_0x61f95c==='rtpaudioqosjitterbridged'||_0x61f95c===_0x5c20('0x80')||_0x61f95c===_0x5c20('0x82')||_0x61f95c==='rtpaudioqosrtt'||_0x61f95c===_0x5c20('0x81')||_0x61f95c==='bridgepeer'||_0x61f95c===_0x5c20('0x83')||_0x61f95c===_0x5c20('0x38')||_0x61f95c===_0x5c20('0x39')){return![];}return!![];};exports[_0x5c20('0x84')]=function(_0x25e988,_0x4a16e7){var _0x28f4d3,_0x517ba2,_0x2702e0;if(_0x4a16e7<=0x0){_0x4a16e7=0x1;}_0x28f4d3=new RegExp(_0x5c20('0x85')+_0x4a16e7+'}$');_0x517ba2=Math[_0x5c20('0x86')](0xa,_0x4a16e7-0x1);_0x2702e0=Math[_0x5c20('0x86')](0xa,_0x4a16e7)-0x1;return util[_0x5c20('0x16')]('%s',_[_0x5c20('0x87')](_0x25e988,_0x28f4d3,_[_0x5c20('0x88')](_0x517ba2,_0x2702e0)));};exports['extractCalleridName']=function(_0x33a5da){var _0x104a4d=_0x33a5da['match'](/"(.*?)"/);return _0x104a4d?_0x104a4d[0x1]:_0x33a5da;};exports[_0x5c20('0x89')]=function(_0xc5139){var _0x3ff282=_0xc5139[_0x5c20('0x8a')](/<(.*?)>/);return _0x3ff282?_0x3ff282[0x1]:_0xc5139;}; \ No newline at end of file +var _0x1898=['logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','createdAt','updatedAt','%s%s','toUpper','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','endtime','logAgent','state','ringtime','responsetime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','RECALL','BOOKED','originate','channelAgent','timeout','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildAcw','queue','agentReadyId','not_inuse','status','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','util','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect'];(function(_0xd64224,_0x428340){var _0x539405=function(_0x43d08c){while(--_0x43d08c){_0xd64224['push'](_0xd64224['shift']());}};_0x539405(++_0x428340);}(_0x1898,0x11a));var _0x8189=function(_0x75deb3,_0x4aab9f){_0x75deb3=_0x75deb3-0x0;var _0x522c7b=_0x1898[_0x75deb3];return _0x522c7b;};'use strict';var util=require(_0x8189('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x8189('0x1'))(_0x8189('0x2'));var ipAgi=process[_0x8189('0x3')]['XCALLY_IP_AGI']||_0x8189('0x4');function getSeconds(_0x4a87df,_0x4cd8c1){var _0x573e75=moment(_0x4a87df)[_0x8189('0x5')](0x0);var _0x4b2f1b=moment(_0x4cd8c1)[_0x8189('0x5')](0x0);return _0x573e75['diff'](_0x4b2f1b,_0x8189('0x6'));}exports[_0x8189('0x7')]=function(_0x28fc6d){return function(_0x330bfb){logger[_0x8189('0x8')](_0x28fc6d,util[_0x8189('0x9')](_0x330bfb,{'showHidden':![],'depth':null}));};};exports[_0x8189('0xa')]=function(_0x2157db,_0x4957fc){logger[_0x8189('0xb')](_0x2157db,util['inspect'](_0x4957fc,{'showHidden':![],'depth':null}));};exports[_0x8189('0xc')]=function(_0x5fbd7f,_0x5ea1bd){logger[_0x8189('0x8')](_0x5fbd7f,util['inspect'](_0x5ea1bd,{'showHidden':![],'depth':null}));};exports[_0x8189('0xd')]=function(_0x261b81){return function(_0x155dca){logger[_0x8189('0xb')](_0x261b81,util[_0x8189('0x9')](_0x155dca,{'showHidden':![],'depth':null}));};};exports[_0x8189('0xe')]=function(_0x3ac81e,_0x58460,_0x436dd5){return{'message':_0x3ac81e,'unlock':_0x58460,'active':_0x436dd5};};exports[_0x8189('0xf')]=function(_0xfc934,_0x25955c,_0x37d239){if(!_[_0x8189('0x10')](_0x37d239)&&_0x8189('0x11')===typeof _0x37d239&&!_[_0x8189('0x12')](_0x37d239)){if(!_[_0x8189('0x10')](_0x25955c)&&_0x8189('0x11')===typeof _0x25955c&&!_[_0x8189('0x12')](_0x25955c)){return util[_0x8189('0x13')](_0x8189('0x14'),_0x25955c,_0x37d239);}return util[_0x8189('0x13')]('\x22%s\x22\x20<%s>',_0x37d239,_0x37d239);}if(!_['isUndefined'](_0xfc934)&&_0x8189('0x11')===typeof _0xfc934&&!_[_0x8189('0x12')](_0xfc934)){return _0xfc934;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x5061b2){if(_[_0x8189('0x15')](_0x5061b2)){return![];}return _0x5061b2;};exports[_0x8189('0x16')]=function(_0x1f067e,_0xa7f2da,_0x448f9b,_0x287016,_0x1c3598,_0x300624){var _0x3a0658={'XMD-QUEUE':_0xa7f2da[_0x8189('0x17')]?_0xa7f2da[_0x8189('0x17')][_0x8189('0x18')]:'','XMD-CALLERID':_0x287016,'XMD-CALLERID-PREVIEW':_0x300624?util[_0x8189('0x13')](_0x8189('0x14'),_0x300624[_0x8189('0x19')],_0x300624[_0x8189('0x1a')]):_0x287016,'XMD-DIALID':_0x1c3598,'XMD-CONTACTID':_0xa7f2da[_0x8189('0x1b')],'XMD-CDRTYPE':_0x8189('0x1c'),'CALLERID(all)':_0x287016,'XMD-VOICEQUEUEID':_0xa7f2da[_0x8189('0x1d')],'XMD-DIALCHANNEL':_0x448f9b,'XMD-DIALTIMEOUT':_0x1f067e[_0x8189('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x1f067e[_0x8189('0x1f')]?'g':'',_[_0x8189('0x12')](_0x1f067e['monitor_format'])?'':_0x8189('0x20')),'XMD-DIALURL':_0x1f067e[_0x8189('0x21')]||'','XMD-AGI':_0x1f067e['dialQueueProject']?util[_0x8189('0x13')](_0x8189('0x22'),ipAgi,_0x1f067e[_0x8189('0x23')]):_0x8189('0x24'),'XMD-AGIAFTER':_0x1f067e[_0x8189('0x1f')]?util[_0x8189('0x13')](_0x8189('0x22'),ipAgi,_0x1f067e[_0x8189('0x1f')]):_0x8189('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x300624?_0x300624[_0x8189('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x300624?_0x300624[_0x8189('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x8189('0x27')};if(!_['isEmpty'](_0x1f067e[_0x8189('0x28')])){_0x3a0658[util['format']('%s',_0x8189('0x29'))]=_0x1f067e[_0x8189('0x28')];_0x3a0658[util[_0x8189('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1c3598;}if(_0xa7f2da&&_0xa7f2da[_0x8189('0x2a')]){for(var _0x1409ca in _0xa7f2da[_0x8189('0x2a')]){if(_0xa7f2da[_0x8189('0x2a')]['hasOwnProperty'](_0x1409ca)){if(!_[_0x8189('0x15')](_0xa7f2da['Contact'][_0x1409ca])&&_0x1409ca!=='id'&&_0x1409ca!==_0x8189('0x2b')&&_0x1409ca!==_0x8189('0x2c')&&_0x1409ca!==_0x8189('0x2d')){_0x3a0658[util[_0x8189('0x13')](_0x8189('0x2e'),'XMD-',_[_0x8189('0x2f')](_0x1409ca))]=_0xa7f2da[_0x8189('0x2a')][_0x1409ca];}}}}return _0x3a0658;};exports['toLowerVariables']=function(_0x36e7a2){var _0x3b934a={};for(var _0x5592d0 in _0x36e7a2){if(_0x36e7a2[_0x8189('0x30')](_0x5592d0)){_0x3b934a[util[_0x8189('0x13')]('%s',_[_0x8189('0x31')](_0x5592d0))]=_0x36e7a2[_0x5592d0];}}return{'variables':_0x3b934a};};exports['updateOriginated']=function(_0x3d38b0,_0x22de7e){if(!_[_0x8189('0x15')](_0x3d38b0)){if(_0x3d38b0['hasOwnProperty'](_0x8189('0x32'))){if(_0x3d38b0[_0x8189('0x32')]>0x0){_0x3d38b0['originated']-=0x1;}else{logger['error'](_0x8189('0x33'),_0x22de7e);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x22de7e);}};exports[_0x8189('0x34')]=function(_0xc5491a){var _0x1023b5=moment()[_0x8189('0x13')](_0x8189('0x35'));_0xc5491a['state']=0xd;_0xc5491a[_0x8189('0x36')]=_0x8189('0x37');_0xc5491a[_0x8189('0x38')]=_0x1023b5;_0xc5491a['responsetime']=_0x1023b5;_0xc5491a[_0x8189('0x39')]=_0x1023b5;};exports[_0x8189('0x3a')]=function(_0x1334e9,_0x111a7c,_0x258128){var _0x52983d=moment()[_0x8189('0x13')](_0x8189('0x35'));_0x1334e9[_0x8189('0x3b')]=_0x111a7c;_0x1334e9['statedesc']=_0x258128;_0x1334e9['responsetime']=_0x52983d;_0x1334e9[_0x8189('0x3c')]=getSeconds(_0x1334e9[_0x8189('0x3d')],_0x1334e9[_0x8189('0x38')]);};exports[_0x8189('0x3e')]=function(_0x2947a7,_0x31c777,_0x4e098f){_0x2947a7[_0x8189('0x3f')]=_0x31c777;_0x2947a7[_0x8189('0x40')]=_0x4e098f;};exports['logCustomer']=function(_0x1ab439,_0x79138f,_0x46ad57){var _0x29481e=moment()[_0x8189('0x13')](_0x8189('0x35'));_0x1ab439[_0x8189('0x3b')]=_0x79138f;_0x1ab439[_0x8189('0x36')]=_0x46ad57;_0x1ab439['responsetime']=_0x1ab439[_0x8189('0x3d')]?_0x1ab439[_0x8189('0x3d')]:_0x29481e;_0x1ab439[_0x8189('0x39')]=_0x1ab439[_0x8189('0x39')]?_0x1ab439[_0x8189('0x39')]:_0x29481e;_0x1ab439[_0x8189('0x3c')]=getSeconds(_0x1ab439['responsetime']||0x0,_0x1ab439[_0x8189('0x38')]||0x0);_0x1ab439[_0x8189('0x41')]=_0x1ab439[_0x8189('0x42')]?getSeconds(_0x1ab439[_0x8189('0x39')],_0x1ab439[_0x8189('0x42')]):0x0;};exports[_0x8189('0x43')]=function(_0x67cb59){return _0x67cb59===_0x8189('0x44');};exports['variablesAction']=function(_0x403aef,_0x4e8fc1,_0x512298,_0x102bb6,_0x111777){var _0x4d4a2b=_0x102bb6?_0x8189('0x45'):_0x403aef[_0x8189('0x19')];_0x4d4a2b=_0x111777?_0x8189('0x46'):_0x4d4a2b;return{'actionid':_0x403aef['uniqueid'],'action':_0x8189('0x47'),'channel':_0x403aef[_0x8189('0x48')],'callerid':util['format'](_0x8189('0x14'),_0x4d4a2b,_0x403aef[_0x8189('0x1a')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x512298,'timeout':(_0x4e8fc1[_0x8189('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x403aef[_0x8189('0x4a')]};};exports[_0x8189('0x4b')]=function(_0x1b83c2){return _0x1b83c2[_0x8189('0x4c')]+_0x1b83c2['countcongestionretry']+_0x1b83c2[_0x8189('0x4d')]+_0x1b83c2['countagentrejectretry']+_0x1b83c2[_0x8189('0x4e')];};exports[_0x8189('0x4f')]=function(_0x30ae45){var _0x44ea93=_[_0x8189('0x50')](_0x30ae45);_0x44ea93[_0x8189('0x3b')]=0xf;_0x44ea93[_0x8189('0x36')]=_0x8189('0x51');return _0x44ea93;};exports[_0x8189('0x52')]=function(_0x73bff8,_0x173df6,_0x41c2eb){var _0x4c7a8c={};_0x4c7a8c[_0x173df6]=_0x73bff8[_0x173df6];_0x4c7a8c['active']=![];_0x4c7a8c[_0x8189('0x53')]=moment()[_0x8189('0x54')](_0x41c2eb,_0x8189('0x55'))['format'](_0x8189('0x35'));_0x4c7a8c[_0x8189('0x1b')]=_0x73bff8[_0x8189('0x1b')];_0x4c7a8c[_0x8189('0x56')]=_0x73bff8['ListId'];_0x4c7a8c[_0x8189('0x1d')]=_0x73bff8[_0x8189('0x1d')]||undefined;return _0x4c7a8c;};exports[_0x8189('0x57')]=function(_0x3c98c9,_0x8b86ac){if(!_[_0x8189('0x15')](_0x3c98c9)){if(_0x3c98c9[_0x8189('0x58')]>0x0){_0x3c98c9['pTalking']-=0x1;}else{logger[_0x8189('0x8')](_0x8b86ac,_0x8189('0x59'));}}else{logger[_0x8189('0x8')](_0x8b86ac,_0x8189('0x5a'));}};exports['IsNotLoggedIn']=function(_0x3ff95a){if(_0x3ff95a<=0x0){return!![];}return![];};exports[_0x8189('0x5b')]=function(_0x2e6b46,_0x8fe9d2,_0x57bd03){_0x2e6b46[_0x8189('0x5c')]=_0x8fe9d2;_0x2e6b46[_0x8189('0x18')]=_0x2e6b46['queue'];_0x2e6b46[_0x8189('0x5d')]=_0x2e6b46[_0x8189('0x48')];_0x2e6b46[_0x8189('0x5e')]=_0x8189('0x5f');if(_0x57bd03){_0x2e6b46[_0x8189('0x60')]=_0x57bd03[_0x8189('0x60')];}return _0x2e6b46;};exports[_0x8189('0x61')]=function(_0x423287){var _0x289229={};_0x289229[_0x8189('0x62')]=_0x423287['queue'];_0x289229[_0x8189('0x5d')]=_0x423287[_0x8189('0x48')];_0x289229[_0x8189('0x4a')]=_0x423287[_0x8189('0x4a')];return _0x289229;};exports[_0x8189('0x63')]=function(_0x20c085){var _0x2712a8=[];for(var _0x319a62 in _0x20c085){if(_0x20c085['hasOwnProperty'](_0x319a62)){if(!_[_0x8189('0x15')](_0x20c085[_0x319a62])&&_0x20c085[_0x319a62]['state']===_0x8189('0x64')&&_0x20c085[_0x319a62][_0x8189('0x65')]==='reachable'){_0x2712a8[_0x8189('0x66')](_0x20c085[_0x319a62]['id']);}}}return _0x2712a8;};exports[_0x8189('0x67')]=function(_0x210c8c){var _0x4ee3ac=moment()[_0x8189('0x5')](0x0);var _0x163cfd=moment(_0x210c8c)[_0x8189('0x5')](0x0);return _0x4ee3ac[_0x8189('0x68')](_0x163cfd,'seconds');};exports[_0x8189('0x69')]=function(_0x3ddf32){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ddf32['ContactId'],'ListId':_0x3ddf32[_0x8189('0x56')],'VoiceQueueId':_0x3ddf32[_0x8189('0x1d')]||undefined,'CampaignId':_0x3ddf32[_0x8189('0x6a')]||undefined};};exports[_0x8189('0x6b')]=function(_0x37b559){if(_0x37b559==='uniqueid'||_0x37b559===_0x8189('0x6c')||_0x37b559===_0x8189('0x62')||_0x37b559===_0x8189('0x6d')||_0x37b559===_0x8189('0x6e')||_0x37b559===_0x8189('0x6f')||_0x37b559===_0x8189('0x3f')||_0x37b559==='channelAgent'||_0x37b559===_0x8189('0x19')||_0x37b559===_0x8189('0x70')||_0x37b559==='calleridnum'||_0x37b559==='scheduledat'||_0x37b559===_0x8189('0x4c')||_0x37b559===_0x8189('0x71')||_0x37b559==='countnoanswerretry'||_0x37b559===_0x8189('0x72')||_0x37b559===_0x8189('0x73')||_0x37b559===_0x8189('0x74')||_0x37b559===_0x8189('0x75')||_0x37b559===_0x8189('0x76')||_0x37b559===_0x8189('0x1b')||_0x37b559==='ListId'||_0x37b559===_0x8189('0x40')||_0x37b559===_0x8189('0x1d')||_0x37b559===_0x8189('0x77')||_0x37b559===_0x8189('0x78')||_0x37b559===_0x8189('0x79')||_0x37b559===_0x8189('0x7a')||_0x37b559==='xmd-listid'||_0x37b559==='xmd-dialurl'||_0x37b559===_0x8189('0x7b')||_0x37b559===_0x8189('0x7c')||_0x37b559===_0x8189('0x7d')||_0x37b559==='xmd-dialchannel'||_0x37b559===_0x8189('0x7e')||_0x37b559===_0x8189('0x7f')||_0x37b559===_0x8189('0x80')||_0x37b559===_0x8189('0x81')||_0x37b559===_0x8189('0x82')||_0x37b559===_0x8189('0x83')||_0x37b559===_0x8189('0x84')||_0x37b559===_0x8189('0x85')||_0x37b559==='rtpaudioqosjitterbridged'||_0x37b559===_0x8189('0x86')||_0x37b559===_0x8189('0x87')||_0x37b559==='rtpaudioqosrtt'||_0x37b559==='rtpaudioqosrttbridged'||_0x37b559===_0x8189('0x83')||_0x37b559===_0x8189('0x84')||_0x37b559==='rtpaudioqosjitter'||_0x37b559===_0x8189('0x88')||_0x37b559==='rtpaudioqosloss'||_0x37b559===_0x8189('0x87')||_0x37b559===_0x8189('0x89')||_0x37b559===_0x8189('0x8a')||_0x37b559===_0x8189('0x8b')||_0x37b559===_0x8189('0x8c')||_0x37b559===_0x8189('0x3b')||_0x37b559===_0x8189('0x36')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x56ba74,_0x5166d8){var _0x191526,_0x3a56b3,_0x3909ed;if(_0x5166d8<=0x0){_0x5166d8=0x1;}_0x191526=new RegExp(_0x8189('0x8d')+_0x5166d8+'}$');_0x3a56b3=Math[_0x8189('0x8e')](0xa,_0x5166d8-0x1);_0x3909ed=Math['pow'](0xa,_0x5166d8)-0x1;return util[_0x8189('0x13')]('%s',_[_0x8189('0x8f')](_0x56ba74,_0x191526,_['random'](_0x3a56b3,_0x3909ed)));};exports[_0x8189('0x90')]=function(_0x5e1124){var _0x3c4408=_0x5e1124[_0x8189('0x91')](/"(.*?)"/);return _0x3c4408?_0x3c4408[0x1]:_0x5e1124;};exports['extractCalleridNumber']=function(_0x1b21d3){var _0x1f53c3=_0x1b21d3[_0x8189('0x91')](/<(.*?)>/);return _0x1f53c3?_0x1f53c3[0x1]:_0x1b21d3;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 84caf45..3bdfcf4 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 _0xc8cb=['voicequeuechannelredirect','boolean','queueremove','string','queuepause','voicequeuechannel','voicequeuechannelhangup'];(function(_0x35848b,_0x4cba8e){var _0x19cf18=function(_0x3fc3d8){while(--_0x3fc3d8){_0x35848b['push'](_0x35848b['shift']());}};_0x19cf18(++_0x4cba8e);}(_0xc8cb,0xb7));var _0xbc8c=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xc8cb[_0x836465];return _0x2150ea;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xbc8c('0x0'),'required':![]}};exports[_0xbc8c('0x1')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbc8c('0x2'),'required':!![]}};exports[_0xbc8c('0x3')]={'interface':{'type':_0xbc8c('0x2'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xbc8c('0x2'),'required':![]}};exports['reload']={'module':{'type':_0xbc8c('0x2'),'required':![]}};exports[_0xbc8c('0x4')]={'uniqueid':{'type':_0xbc8c('0x2'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xbc8c('0x2'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xbc8c('0x2')},'mixmonitorid':{'type':_0xbc8c('0x2')}};exports[_0xbc8c('0x5')]={'uniqueid':{'type':_0xbc8c('0x2'),'required':!![]}};exports[_0xbc8c('0x6')]={'uniqueid':{'type':_0xbc8c('0x2'),'required':!![]},'exten':{'type':_0xbc8c('0x2'),'required':!![]},'context':{'type':_0xbc8c('0x2')}}; \ No newline at end of file +var _0xb555=['reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x541c3b,_0x1019c6){var _0x2ab34b=function(_0x42b30e){while(--_0x42b30e){_0x541c3b['push'](_0x541c3b['shift']());}};_0x2ab34b(++_0x1019c6);}(_0xb555,0xf4));var _0x5b55=function(_0x3f682c,_0x5173d5){_0x3f682c=_0x3f682c-0x0;var _0x3976e8=_0xb555[_0x3f682c];return _0x3976e8;};'use strict';exports[_0x5b55('0x0')]={'queue':{'type':_0x5b55('0x1'),'required':!![]},'interface':{'type':_0x5b55('0x1'),'required':!![]},'membername':{'type':_0x5b55('0x1'),'required':!![]},'penalty':{'type':_0x5b55('0x2'),'required':![]},'paused':{'type':_0x5b55('0x3'),'required':![]}};exports[_0x5b55('0x4')]={'queue':{'type':_0x5b55('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x5b55('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x5b55('0x1'),'required':![]}};exports[_0x5b55('0x6')]={'module':{'type':_0x5b55('0x1'),'required':![]}};exports[_0x5b55('0x7')]={'uniqueid':{'type':_0x5b55('0x1'),'required':!![]}};exports[_0x5b55('0x8')]={'uniqueid':{'type':_0x5b55('0x1'),'required':!![]},'filename':{'type':_0x5b55('0x1')},'format':{'type':_0x5b55('0x1')},'mixmonitorid':{'type':_0x5b55('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x5b55('0x9')]={'uniqueid':{'type':_0x5b55('0x1'),'required':!![]},'exten':{'type':_0x5b55('0x1'),'required':!![]},'context':{'type':_0x5b55('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ec15016..214802f 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 _0x7ed4=['salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','mapKeys','format','name','hasOwnProperty','isNil','interface','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','initAgents','length','SIP/%s','mergeFromDatabase','initTelephones','initTrunks','isUndefined','initVoiceQueues','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','total','initVoiceCallReports','outbound','ANSWERED','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts'];(function(_0x286bd8,_0x1f9988){var _0x8e2843=function(_0x2729b0){while(--_0x2729b0){_0x286bd8['push'](_0x286bd8['shift']());}};_0x8e2843(++_0x1f9988);}(_0x7ed4,0x129));var _0x47ed=function(_0x2bc09e,_0x1ae747){_0x2bc09e=_0x2bc09e-0x0;var _0x3f7c75=_0x7ed4[_0x2bc09e];return _0x3f7c75;};'use strict';var BPromise=require(_0x47ed('0x0'));var util=require(_0x47ed('0x1'));var _=require(_0x47ed('0x2'));var moment=require(_0x47ed('0x3'));var Agent=require(_0x47ed('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0x47ed('0x5'));var VoiceQueue=require(_0x47ed('0x6'));var Trigger=require(_0x47ed('0x7'));var Template=require('../model/template');var Campaign=require(_0x47ed('0x8'));var VoiceExtension=require(_0x47ed('0x9'));var ZendeskAccount=require(_0x47ed('0xa'));var SalesforceAccount=require(_0x47ed('0xb'));var FreshdeskAccount=require(_0x47ed('0xc'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x47ed('0xd'));var ServicenowAccount=require(_0x47ed('0xe'));var Dynamics365Account=require(_0x47ed('0xf'));var FreshsalesAccount=require(_0x47ed('0x10'));var FaxAccount=require(_0x47ed('0x11'));var Realtime=function(){this[_0x47ed('0x12')]={};this[_0x47ed('0x13')]={};this[_0x47ed('0x14')]={};this[_0x47ed('0x15')]={};this[_0x47ed('0x16')]={};this['campaigns']={};this[_0x47ed('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x47ed('0x18')]={};this[_0x47ed('0x19')]={};this['queueChannels']={};this[_0x47ed('0x1a')]={};this[_0x47ed('0x1b')]={};this[_0x47ed('0x1c')]={};this[_0x47ed('0x1d')]={};this[_0x47ed('0x1e')]={};this['sugarcrmAccounts']={};this[_0x47ed('0x1f')]={};this[_0x47ed('0x20')]={};this[_0x47ed('0x21')]={};this[_0x47ed('0x22')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0x47ed('0x23')]={};this['faxAccounts']={};};function freeIsNotKey(_0x41168c,_0x44ee56,_0x25ba93){var _0x4f7bd2=_['mapKeys'](_0x41168c,function(_0x49b6f0,_0xba17e5){return _0x49b6f0[_0x25ba93];});for(var _0x3a6a59 in _0x44ee56){if(_0x44ee56['hasOwnProperty'](_0x3a6a59)){if(!_0x4f7bd2[_0x3a6a59]){delete _0x44ee56[_0x3a6a59];}}}}function freeIsNotKeySip(_0x1b6389,_0x45b9ef){var _0x46fb63=_[_0x47ed('0x24')](_0x1b6389,function(_0x3b99d3,_0x319037){return util[_0x47ed('0x25')]('SIP/%s',_0x3b99d3[_0x47ed('0x26')]);});for(var _0x22372c in _0x45b9ef){if(_0x45b9ef[_0x47ed('0x27')](_0x22372c)){if(!_0x46fb63[_0x22372c]){delete _0x45b9ef[_0x22372c];}}}}function freeIsNotKeyAgent(_0x7f15a4,_0x5d64de){var _0xba246a=_[_0x47ed('0x24')](_0x7f15a4,function(_0x270579,_0x2a0d12){var _0x424e29=_[_0x47ed('0x28')](_0x270579[_0x47ed('0x29')])?util['format']('SIP/%s',_0x270579[_0x47ed('0x26')]):_0x270579[_0x47ed('0x29')];return _0x424e29;});for(var _0x482a7a in _0x5d64de){if(_0x5d64de[_0x47ed('0x27')](_0x482a7a)){if(!_0xba246a[_0x482a7a]){delete _0x5d64de[_0x482a7a];}}}}function clearVoiceCallReports(_0x348733){_0x348733['total']=0x0;_0x348733[_0x47ed('0x2a')]=0x0;_0x348733[_0x47ed('0x2b')]=0x0;_0x348733[_0x47ed('0x2c')]=0x0;_0x348733[_0x47ed('0x2d')]=0x0;}function clearCampaigns(_0x3a9efb){if(!_[_0x47ed('0x2e')](_0x3a9efb)){for(var _0x9b927 in _0x3a9efb){if(_0x3a9efb[_0x47ed('0x27')](_0x9b927)){_0x3a9efb[_0x9b927][_0x47ed('0x2f')]=0x0;_0x3a9efb[_0x9b927][_0x47ed('0x30')]=0x0;}}}}function clearVoiceQueues(_0x28c3b0){if(!_[_0x47ed('0x2e')](_0x28c3b0)){for(var _0x5b4c9b in _0x28c3b0){if(_0x28c3b0[_0x47ed('0x27')](_0x5b4c9b)){_0x28c3b0[_0x5b4c9b]['total']=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x2a')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x31')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x32')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x2b')]=0x0;_0x28c3b0[_0x5b4c9b]['sumDuration']=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x2d')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x33')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x34')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x35')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x36')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x37')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x38')]=0x0;_0x28c3b0[_0x5b4c9b]['outboundDropCallsDayTimeout']=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x39')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x3a')]=0x0;_0x28c3b0[_0x5b4c9b]['outboundOriginateFailureCallsDay']=0x0;_0x28c3b0[_0x5b4c9b]['outboundRejectCallsDay']=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x3b')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x33')]=0x0;_0x28c3b0[_0x5b4c9b][_0x47ed('0x3c')]=0x0;_0x28c3b0[_0x5b4c9b]['queueStatusComplete']=!![];}}}}Realtime[_0x47ed('0x3d')]['mergeFromDatabase']=function(_0x2bf777,_0x10faf8){for(var _0x403325 in _0x10faf8){if(_0x2bf777[_0x47ed('0x27')](_0x403325)){_0x2bf777[_0x403325]=_0x10faf8[_0x403325];}}};Realtime[_0x47ed('0x3d')][_0x47ed('0x3e')]=function(){var _0x869113=this;return function(_0x16c51a){if(_0x16c51a){freeIsNotKeyAgent(_0x16c51a,_0x869113['agents']);for(var _0x1b955d=0x0,_0x3db01f={},_0x421b9c={};_0x1b955d<_0x16c51a[_0x47ed('0x3f')];_0x1b955d+=0x1){_0x3db01f=_0x16c51a[_0x1b955d];var _0xd8bcdb=_['isNil'](_0x3db01f[_0x47ed('0x29')])?util[_0x47ed('0x25')](_0x47ed('0x40'),_0x3db01f[_0x47ed('0x26')]):_0x3db01f[_0x47ed('0x29')];if(_['isUndefined'](_0x869113[_0x47ed('0x12')][_0xd8bcdb])){_0x869113[_0x47ed('0x12')][_0xd8bcdb]=new Agent(_0x3db01f);}else{_0x869113[_0x47ed('0x41')](_0x869113[_0x47ed('0x12')][_0xd8bcdb],_0x3db01f);}}}return _0x869113[_0x47ed('0x12')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x42')]=function(){var _0xe3c2f5=this;return function(_0x580910){if(_0x580910){freeIsNotKeySip(_0x580910,_0xe3c2f5[_0x47ed('0x13')]);for(var _0x25641e=0x0,_0x19949f={},_0x2569e9={};_0x25641e<_0x580910[_0x47ed('0x3f')];_0x25641e+=0x1){_0x19949f=_0x580910[_0x25641e];if(_['isUndefined'](_0xe3c2f5['telephones'][util[_0x47ed('0x25')]('SIP/%s',_0x19949f['name'])])){_0xe3c2f5[_0x47ed('0x13')][util[_0x47ed('0x25')](_0x47ed('0x40'),_0x19949f['name'])]=new Telephone(_0x19949f);}else{_0xe3c2f5[_0x47ed('0x41')](_0xe3c2f5[_0x47ed('0x13')][util[_0x47ed('0x25')](_0x47ed('0x40'),_0x19949f['name'])],_0x19949f);}}}return _0xe3c2f5[_0x47ed('0x13')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x43')]=function(){var _0x379fa4=this;return function(_0x20cce7){if(_0x20cce7){freeIsNotKeySip(_0x20cce7,_0x379fa4[_0x47ed('0x14')]);for(var _0x47cd34=0x0,_0xdfb7ef={},_0x89f473={};_0x47cd34<_0x20cce7[_0x47ed('0x3f')];_0x47cd34+=0x1){_0xdfb7ef=_0x20cce7[_0x47cd34];if(_[_0x47ed('0x44')](_0x379fa4['trunks'][util[_0x47ed('0x25')](_0x47ed('0x40'),_0xdfb7ef[_0x47ed('0x26')])])){_0x379fa4[_0x47ed('0x14')][util['format']('SIP/%s',_0xdfb7ef[_0x47ed('0x26')])]=new Trunk(_0xdfb7ef);}else{_0x379fa4[_0x47ed('0x41')](_0x379fa4[_0x47ed('0x14')][util['format']('SIP/%s',_0xdfb7ef[_0x47ed('0x26')])],_0xdfb7ef);}}}return _0x379fa4['trunks'];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x45')]=function(){var _0x34658=this;return function(_0x14eb0d){if(_0x14eb0d){freeIsNotKey(_0x14eb0d,_0x34658[_0x47ed('0x15')],_0x47ed('0x26'));for(var _0x29f290=0x0,_0x5e178c={},_0xe1234a={};_0x29f290<_0x14eb0d['length'];_0x29f290+=0x1){_0x5e178c=_0x14eb0d[_0x29f290];if(_[_0x47ed('0x44')](_0x34658[_0x47ed('0x15')][_0x5e178c[_0x47ed('0x26')]])){_0x34658[_0x47ed('0x15')][_0x5e178c[_0x47ed('0x26')]]=new VoiceQueue(_0x5e178c);}else{_0x34658[_0x47ed('0x41')](_0x34658[_0x47ed('0x15')][_0x5e178c[_0x47ed('0x26')]],_0x5e178c);}}}return _0x34658['voiceQueues'];};};Realtime[_0x47ed('0x3d')]['initTriggers']=function(){var _0x503de0=this;return function(_0xc3bb7a){if(_0xc3bb7a){freeIsNotKey(_0xc3bb7a,_0x503de0[_0x47ed('0x16')],'id');for(var _0x4361f6=0x0,_0x535b4f={},_0x5f09db={};_0x4361f6<_0xc3bb7a['length'];_0x4361f6+=0x1){_0x535b4f=_0xc3bb7a[_0x4361f6];if(_[_0x47ed('0x44')](_0x503de0[_0x47ed('0x16')][_0x535b4f['id']])){_0x503de0[_0x47ed('0x16')][_0x535b4f['id']]=new Trigger(_0x535b4f);}else{_0x503de0[_0x47ed('0x41')](_0x503de0[_0x47ed('0x16')][_0x535b4f['id']],_0x535b4f);}}}return _0x503de0['triggers'];};};Realtime[_0x47ed('0x3d')]['initTemplates']=function(){var _0x53a8d3=this;return function(_0x1a0c0b){if(_0x1a0c0b){freeIsNotKey(_0x1a0c0b,_0x53a8d3['templates'],'id');for(var _0x544163=0x0,_0x29463f={},_0x10728c={};_0x544163<_0x1a0c0b[_0x47ed('0x3f')];_0x544163+=0x1){_0x29463f=_0x1a0c0b[_0x544163];if(_[_0x47ed('0x44')](_0x53a8d3[_0x47ed('0x17')][_0x29463f['id']])){_0x53a8d3['templates'][_0x29463f['id']]=new Template(_0x29463f);}else{_0x53a8d3[_0x47ed('0x41')](_0x53a8d3[_0x47ed('0x17')][_0x29463f['id']],_0x29463f);}}}return _0x53a8d3[_0x47ed('0x17')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x46')]=function(){var _0x501e4b=this;return function(_0x2ad3c5){if(_0x2ad3c5){freeIsNotKey(_0x2ad3c5,_0x501e4b[_0x47ed('0x1d')],'id');for(var _0xb1619=0x0,_0x11663f={},_0x37f60c={};_0xb1619<_0x2ad3c5[_0x47ed('0x3f')];_0xb1619+=0x1){_0x11663f=_0x2ad3c5[_0xb1619];if(_[_0x47ed('0x44')](_0x501e4b[_0x47ed('0x1d')][_0x11663f['id']])){_0x501e4b[_0x47ed('0x1d')][_0x11663f['id']]=new ZendeskAccount(_0x11663f);}else{_0x501e4b[_0x47ed('0x41')](_0x501e4b[_0x47ed('0x1d')][_0x11663f['id']],_0x11663f);}}}return _0x501e4b[_0x47ed('0x1d')];};};Realtime['prototype'][_0x47ed('0x47')]=function(){var _0x49e28f=this;return function(_0x595421){if(_0x595421){freeIsNotKey(_0x595421,_0x49e28f[_0x47ed('0x1e')],'id');for(var _0x30598b=0x0,_0x4a53c1={},_0x5af277={};_0x30598b<_0x595421[_0x47ed('0x3f')];_0x30598b+=0x1){_0x4a53c1=_0x595421[_0x30598b];if(_['isUndefined'](_0x49e28f[_0x47ed('0x1e')][_0x4a53c1['id']])){_0x49e28f[_0x47ed('0x1e')][_0x4a53c1['id']]=new SalesforceAccount(_0x4a53c1);}else{_0x49e28f[_0x47ed('0x41')](_0x49e28f[_0x47ed('0x1e')][_0x4a53c1['id']],_0x4a53c1);}}}return _0x49e28f[_0x47ed('0x1e')];};};Realtime['prototype'][_0x47ed('0x48')]=function(){var _0x4a5193=this;return function(_0x4b56b0){if(_0x4b56b0){freeIsNotKey(_0x4b56b0,_0x4a5193[_0x47ed('0x1f')],'id');for(var _0x45afda=0x0,_0x77348f={},_0x202db6={};_0x45afda<_0x4b56b0['length'];_0x45afda+=0x1){_0x77348f=_0x4b56b0[_0x45afda];if(_[_0x47ed('0x44')](_0x4a5193[_0x47ed('0x1f')][_0x77348f['id']])){_0x4a5193['freshdeskAccounts'][_0x77348f['id']]=new FreshdeskAccount(_0x77348f);}else{_0x4a5193[_0x47ed('0x41')](_0x4a5193[_0x47ed('0x1f')][_0x77348f['id']],_0x77348f);}}}return _0x4a5193[_0x47ed('0x1f')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x31cf6a=this;return function(_0x3ecc5a){if(_0x3ecc5a){freeIsNotKey(_0x3ecc5a,_0x31cf6a[_0x47ed('0x20')],'id');for(var _0x232d8b=0x0,_0x3a1839={},_0x57e279={};_0x232d8b<_0x3ecc5a[_0x47ed('0x3f')];_0x232d8b+=0x1){_0x3a1839=_0x3ecc5a[_0x232d8b];if(_[_0x47ed('0x44')](_0x31cf6a['zohoAccounts'][_0x3a1839['id']])){_0x31cf6a[_0x47ed('0x20')][_0x3a1839['id']]=new ZohoAccount(_0x3a1839);}else{_0x31cf6a['mergeFromDatabase'](_0x31cf6a[_0x47ed('0x20')][_0x3a1839['id']],_0x3a1839);}}}return _0x31cf6a[_0x47ed('0x20')];};};Realtime[_0x47ed('0x3d')]['initDeskAccounts']=function(){var _0x51c8f3=this;return function(_0x25ab2b){if(_0x25ab2b){freeIsNotKey(_0x25ab2b,_0x51c8f3['deskAccounts'],'id');for(var _0x3c2d36=0x0,_0x3e3999={},_0x172918={};_0x3c2d36<_0x25ab2b[_0x47ed('0x3f')];_0x3c2d36+=0x1){_0x3e3999=_0x25ab2b[_0x3c2d36];if(_[_0x47ed('0x44')](_0x51c8f3[_0x47ed('0x21')][_0x3e3999['id']])){_0x51c8f3[_0x47ed('0x21')][_0x3e3999['id']]=new DeskAccount(_0x3e3999);}else{_0x51c8f3['mergeFromDatabase'](_0x51c8f3['deskAccounts'][_0x3e3999['id']],_0x3e3999);}}}return _0x51c8f3[_0x47ed('0x21')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x49')]=function(){var _0x469b7a=this;return function(_0x1ae7b1){if(_0x1ae7b1){freeIsNotKey(_0x1ae7b1,_0x469b7a['sugarcrmAccounts'],'id');for(var _0x922c40=0x0,_0x580d92={},_0x4f2333={};_0x922c40<_0x1ae7b1[_0x47ed('0x3f')];_0x922c40+=0x1){_0x580d92=_0x1ae7b1[_0x922c40];if(_[_0x47ed('0x44')](_0x469b7a['sugarcrmAccounts'][_0x580d92['id']])){_0x469b7a[_0x47ed('0x4a')][_0x580d92['id']]=new SugarcrmAccount(_0x580d92);}else{_0x469b7a[_0x47ed('0x41')](_0x469b7a[_0x47ed('0x4a')][_0x580d92['id']],_0x580d92);}}}return _0x469b7a[_0x47ed('0x4a')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x4b')]=function(){var _0x28f2fa=this;return function(_0x1cbe2f){if(_0x1cbe2f){freeIsNotKey(_0x1cbe2f,_0x28f2fa[_0x47ed('0x22')],'id');for(var _0x438df9=0x0,_0x31bccb={},_0x2960b6={};_0x438df9<_0x1cbe2f[_0x47ed('0x3f')];_0x438df9+=0x1){_0x31bccb=_0x1cbe2f[_0x438df9];if(_['isUndefined'](_0x28f2fa[_0x47ed('0x22')][_0x31bccb['id']])){_0x28f2fa['vtigerAccounts'][_0x31bccb['id']]=new VtigerAccount(_0x31bccb);}else{_0x28f2fa[_0x47ed('0x41')](_0x28f2fa[_0x47ed('0x22')][_0x31bccb['id']],_0x31bccb);}}}return _0x28f2fa['vtigerAccounts'];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x4c')]=function(){var _0x34762d=this;return function(_0x19b73f){if(_0x19b73f){freeIsNotKey(_0x19b73f,_0x34762d[_0x47ed('0x4d')],'id');for(var _0x293b76=0x0,_0x3026be={},_0x235f02={};_0x293b76<_0x19b73f[_0x47ed('0x3f')];_0x293b76+=0x1){_0x3026be=_0x19b73f[_0x293b76];if(_[_0x47ed('0x44')](_0x34762d[_0x47ed('0x4d')][_0x3026be['id']])){_0x34762d[_0x47ed('0x4d')][_0x3026be['id']]=new ServicenowAccount(_0x3026be);}else{_0x34762d[_0x47ed('0x41')](_0x34762d[_0x47ed('0x4d')][_0x3026be['id']],_0x3026be);}}}return _0x34762d[_0x47ed('0x4d')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x4e')]=function(){var _0x2cf698=this;return function(_0x49ae30){if(_0x49ae30){freeIsNotKey(_0x49ae30,_0x2cf698[_0x47ed('0x4f')],'id');for(var _0x6ce234=0x0,_0x1c310a={},_0x5f0393={};_0x6ce234<_0x49ae30[_0x47ed('0x3f')];_0x6ce234+=0x1){_0x1c310a=_0x49ae30[_0x6ce234];if(_[_0x47ed('0x44')](_0x2cf698[_0x47ed('0x4f')][_0x1c310a['id']])){_0x2cf698[_0x47ed('0x4f')][_0x1c310a['id']]=new Dynamics365Account(_0x1c310a);}else{_0x2cf698[_0x47ed('0x41')](_0x2cf698['dynamics365Accounts'][_0x1c310a['id']],_0x1c310a);}}}return _0x2cf698[_0x47ed('0x4f')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x50')]=function(){var _0x381303=this;return function(_0x2105b9){if(_0x2105b9){freeIsNotKey(_0x2105b9,_0x381303[_0x47ed('0x23')],'id');for(var _0x202c6b=0x0,_0x32b99a={},_0x25e4a1={};_0x202c6b<_0x2105b9[_0x47ed('0x3f')];_0x202c6b+=0x1){_0x32b99a=_0x2105b9[_0x202c6b];if(_[_0x47ed('0x44')](_0x381303[_0x47ed('0x23')][_0x32b99a['id']])){_0x381303[_0x47ed('0x23')][_0x32b99a['id']]=new FreshsalesAccount(_0x32b99a);}else{_0x381303[_0x47ed('0x41')](_0x381303[_0x47ed('0x23')][_0x32b99a['id']],_0x32b99a);}}}return _0x381303['freshsalesAccounts'];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x51')]=function(){var _0x2111bb=this;return function(_0x302a0c){for(var _0x510dad=0x0;_0x510dad<_0x302a0c[_0x47ed('0x3f')];_0x510dad+=0x1){_[_0x47ed('0x52')](_0x2111bb[_0x47ed('0x15')][_0x302a0c[_0x510dad][_0x47ed('0x26')]],_0x302a0c[_0x510dad]);}return _0x2111bb[_0x47ed('0x15')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x53')]=function(){var _0x1cb072=this;return function(_0x5ef270){clearVoiceQueues(_0x1cb072[_0x47ed('0x15')]);if(_0x5ef270){_0x5ef270=_[_0x47ed('0x54')](_0x5ef270,_0x47ed('0x55'));for(var _0x3916f8 in _0x5ef270){if(_0x5ef270[_0x47ed('0x27')](_0x3916f8)){var _0x15cabd={};for(var _0x5100f0=0x0;_0x5100f0<_0x5ef270[_0x3916f8]['length'];_0x5100f0+=0x1){var _0xcd2184=_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x56')];if(_0x1cb072[_0x47ed('0x15')][_0xcd2184]){if(_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x57')]){_0x1cb072[_0x47ed('0x15')][_0xcd2184][_0x47ed('0x31')]+=0x1;}if(_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x58')]){_0x1cb072['voiceQueues'][_0xcd2184][_0x47ed('0x32')]+=0x1;}_0x1cb072[_0x47ed('0x15')][_0xcd2184][_0x47ed('0x2b')]+=moment(_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x59')])[_0x47ed('0x5a')](moment(_0x5ef270[_0x3916f8][_0x5100f0]['queuecallerjoinAt']),_0x47ed('0x5b'))||0x0;if(_0x5100f0===_0x5ef270[_0x3916f8][_0x47ed('0x3f')]-0x1){_0x1cb072[_0x47ed('0x15')][_0xcd2184]['sumDuration']+=moment(_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x5c')]||_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x5d')]||_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x5e')])[_0x47ed('0x5a')](moment(_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x5f')]),_0x47ed('0x5b'))||0x0;_0x1cb072[_0x47ed('0x15')][_0xcd2184][_0x47ed('0x60')]+=0x1;if(_0x5ef270[_0x3916f8][_0x5100f0]['queuecallercomplete']){_0x1cb072[_0x47ed('0x15')][_0xcd2184][_0x47ed('0x2a')]+=0x1;_0x1cb072[_0x47ed('0x15')][_0xcd2184][_0x47ed('0x2d')]+=moment(_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x5c')])[_0x47ed('0x5a')](moment(_0x5ef270[_0x3916f8][_0x5100f0][_0x47ed('0x59')]),_0x47ed('0x5b'))||0x0;}}else{_0x1cb072[_0x47ed('0x15')][_0xcd2184]['sumDuration']+=_0x1cb072[_0x47ed('0x15')][_0xcd2184][_0x47ed('0x2b')]||0x0;}}}}}}return _0x1cb072['voiceQueues'];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x61')]=function(){var _0x2fc10f=this;return function(_0xffa997){clearVoiceCallReports(_0x2fc10f[_0x47ed('0x62')]);if(_0xffa997){for(var _0x422d80=0x0;_0x422d80<_0xffa997[_0x47ed('0x3f')];_0x422d80+=0x1){_0x2fc10f[_0x47ed('0x62')][_0x47ed('0x60')]+=0x1;_0x2fc10f[_0x47ed('0x62')][_0x47ed('0x2c')]+=_0xffa997[_0x422d80]['duration'];if(_0xffa997[_0x422d80]['disposition']===_0x47ed('0x63')){_0x2fc10f[_0x47ed('0x62')][_0x47ed('0x2a')]+=0x1;_0x2fc10f[_0x47ed('0x62')]['sumHoldTime']+=_0xffa997[_0x422d80][_0x47ed('0x64')]-_0xffa997[_0x422d80][_0x47ed('0x65')]||0x0;_0x2fc10f[_0x47ed('0x62')][_0x47ed('0x2d')]+=_0xffa997[_0x422d80]['billableseconds'];}}}return _0x2fc10f['outbound'];};};Realtime[_0x47ed('0x3d')]['initCampaigns']=function(){var _0x1cdba8=this;return function(_0x55098a){if(_0x55098a){freeIsNotKey(_0x55098a,_0x1cdba8[_0x47ed('0x66')],'name');for(var _0x271aef=0x0,_0x52adfc={};_0x271aef<_0x55098a[_0x47ed('0x3f')];_0x271aef+=0x1){_0x52adfc=_0x55098a[_0x271aef];if(_['isUndefined'](_0x1cdba8[_0x47ed('0x66')][_0x52adfc[_0x47ed('0x26')]])){_0x1cdba8[_0x47ed('0x66')][_0x52adfc[_0x47ed('0x26')]]=new Campaign(_0x52adfc);}else{_0x1cdba8[_0x47ed('0x41')](_0x1cdba8[_0x47ed('0x66')][_0x52adfc[_0x47ed('0x26')]],_0x52adfc);_0x1cdba8[_0x47ed('0x66')][_0x52adfc[_0x47ed('0x26')]][_0x47ed('0x67')]=_0x52adfc[_0x47ed('0x68')]?_0x52adfc['SquareProject'][_0x47ed('0x26')]:undefined;}}}return _0x1cdba8[_0x47ed('0x66')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x69')]=function(){var _0x25ae02=this;return function(_0x24833a){if(_0x24833a){freeIsNotKey(_0x24833a,_0x25ae02[_0x47ed('0x18')],'id');for(var _0x190b83=0x0,_0x30bac6={};_0x190b83<_0x24833a[_0x47ed('0x3f')];_0x190b83+=0x1){_0x30bac6=_0x24833a[_0x190b83];if(_['isUndefined'](_0x25ae02[_0x47ed('0x18')][_0x30bac6['id']])){_0x25ae02[_0x47ed('0x18')][_0x30bac6['id']]=new VoiceExtension(_0x30bac6);}else{_0x25ae02[_0x47ed('0x41')](_0x25ae02[_0x47ed('0x18')][_0x30bac6['id']],_0x30bac6);}}}return _0x25ae02['voiceExtensions'];};};Realtime[_0x47ed('0x3d')]['initCampaignHopperHistory']=function(){var _0x3ceba1=this;return function(_0x4f443c){clearCampaigns(_0x3ceba1[_0x47ed('0x66')]);for(var _0x230fcc=0x0;_0x230fcc<_0x4f443c['length'];_0x230fcc+=0x1){_['merge'](_0x3ceba1['campaigns'][_0x4f443c[_0x230fcc][_0x47ed('0x26')]],_0x4f443c[_0x230fcc]);}return _0x3ceba1[_0x47ed('0x66')];};};Realtime[_0x47ed('0x3d')][_0x47ed('0x6a')]=function(){var _0x3dacec=this;return function(_0x47dd4d){if(_0x47dd4d){freeIsNotKey(_0x47dd4d,_0x3dacec[_0x47ed('0x6b')],'id');for(var _0x48a92e=0x0,_0x51435a={},_0x101ab8={};_0x48a92e<_0x47dd4d[_0x47ed('0x3f')];_0x48a92e+=0x1){_0x51435a=_0x47dd4d[_0x48a92e];if(_[_0x47ed('0x44')](_0x3dacec[_0x47ed('0x6b')][_0x51435a['id']])){_0x3dacec[_0x47ed('0x6b')][_0x51435a['id']]=new FaxAccount(_0x51435a);}else{_0x3dacec['mergeFromDatabase'](_0x3dacec['faxAccounts'][_0x51435a['id']],_0x51435a);}}}return _0x3dacec['faxAccounts'];};};module[_0x47ed('0x6c')]=Realtime; \ No newline at end of file +var _0x98a6=['initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queuecallerexit','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trigger','../model/campaign','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','interface','name','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isNil','SIP/%s','isUndefined','initTelephones','mergeFromDatabase','initVoiceQueues','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts'];(function(_0x2a839b,_0x1e4d55){var _0x46208a=function(_0x4fb8cd){while(--_0x4fb8cd){_0x2a839b['push'](_0x2a839b['shift']());}};_0x46208a(++_0x1e4d55);}(_0x98a6,0xf0));var _0x698a=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x98a6[_0x2df507];return _0x1f7167;};'use strict';var BPromise=require(_0x698a('0x0'));var util=require(_0x698a('0x1'));var _=require(_0x698a('0x2'));var moment=require('moment');var Agent=require(_0x698a('0x3'));var Telephone=require(_0x698a('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x698a('0x5'));var Template=require('../model/template');var Campaign=require(_0x698a('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x698a('0x7'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x698a('0x8'));var ZohoAccount=require(_0x698a('0x9'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x698a('0xa'));var ServicenowAccount=require(_0x698a('0xb'));var Dynamics365Account=require(_0x698a('0xc'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x698a('0xd')]={};this[_0x698a('0xe')]={};this[_0x698a('0xf')]={};this[_0x698a('0x10')]={};this[_0x698a('0x11')]={};this['campaigns']={};this[_0x698a('0x12')]={};this[_0x698a('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x698a('0x14')]={};this[_0x698a('0x15')]={};this[_0x698a('0x16')]={};this[_0x698a('0x17')]={};this['timers']={};this[_0x698a('0x18')]={};this[_0x698a('0x19')]={};this[_0x698a('0x1a')]={};this[_0x698a('0x1b')]={};this[_0x698a('0x1c')]={};this[_0x698a('0x1d')]={};this[_0x698a('0x1e')]={};this[_0x698a('0x1f')]={};this[_0x698a('0x20')]={};this['dynamics365Accounts']={};this[_0x698a('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x1395e7,_0x47a37f,_0xaa60a){var _0x126870=_['mapKeys'](_0x1395e7,function(_0x1979fe,_0x4c16fc){return _0x1979fe[_0xaa60a];});for(var _0x2c471b in _0x47a37f){if(_0x47a37f[_0x698a('0x22')](_0x2c471b)){if(!_0x126870[_0x2c471b]){delete _0x47a37f[_0x2c471b];}}}}function freeIsNotKeySip(_0x28a14f,_0x3ff4aa){var _0x3bfea1=_[_0x698a('0x23')](_0x28a14f,function(_0x1bce3f,_0x21c203){return util[_0x698a('0x24')]('SIP/%s',_0x1bce3f['name']);});for(var _0x208a60 in _0x3ff4aa){if(_0x3ff4aa[_0x698a('0x22')](_0x208a60)){if(!_0x3bfea1[_0x208a60]){delete _0x3ff4aa[_0x208a60];}}}}function freeIsNotKeyAgent(_0xa559b4,_0x522e12){var _0x10c881=_[_0x698a('0x23')](_0xa559b4,function(_0x137fc6,_0xeb494d){var _0x33cdc4=_['isNil'](_0x137fc6[_0x698a('0x25')])?util[_0x698a('0x24')]('SIP/%s',_0x137fc6[_0x698a('0x26')]):_0x137fc6[_0x698a('0x25')];return _0x33cdc4;});for(var _0x4e1faf in _0x522e12){if(_0x522e12[_0x698a('0x22')](_0x4e1faf)){if(!_0x10c881[_0x4e1faf]){delete _0x522e12[_0x4e1faf];}}}}function clearVoiceCallReports(_0x4e7b7d){_0x4e7b7d['total']=0x0;_0x4e7b7d[_0x698a('0x27')]=0x0;_0x4e7b7d['sumHoldTime']=0x0;_0x4e7b7d[_0x698a('0x28')]=0x0;_0x4e7b7d[_0x698a('0x29')]=0x0;}function clearCampaigns(_0x5043a7){if(!_[_0x698a('0x2a')](_0x5043a7)){for(var _0xfb6dc2 in _0x5043a7){if(_0x5043a7[_0x698a('0x22')](_0xfb6dc2)){_0x5043a7[_0xfb6dc2][_0x698a('0x2b')]=0x0;_0x5043a7[_0xfb6dc2][_0x698a('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x174a45){if(!_['isEmpty'](_0x174a45)){for(var _0x1896f1 in _0x174a45){if(_0x174a45[_0x698a('0x22')](_0x1896f1)){_0x174a45[_0x1896f1][_0x698a('0x2d')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x27')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x2e')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x2f')]=0x0;_0x174a45[_0x1896f1]['sumHoldTime']=0x0;_0x174a45[_0x1896f1][_0x698a('0x28')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x29')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x30')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x31')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x32')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x33')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x34')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x35')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x36')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x37')]=0x0;_0x174a45[_0x1896f1]['outboundBlacklistCallsDay']=0x0;_0x174a45[_0x1896f1][_0x698a('0x38')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x39')]=0x0;_0x174a45[_0x1896f1]['outboundReCallsDay']=0x0;_0x174a45[_0x1896f1][_0x698a('0x30')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x3a')]=0x0;_0x174a45[_0x1896f1][_0x698a('0x3b')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x13a648,_0x36c851){for(var _0x1eb474 in _0x36c851){if(_0x13a648['hasOwnProperty'](_0x1eb474)){_0x13a648[_0x1eb474]=_0x36c851[_0x1eb474];}}};Realtime[_0x698a('0x3c')][_0x698a('0x3d')]=function(){var _0x139f87=this;return function(_0x4a7626){if(_0x4a7626){freeIsNotKeyAgent(_0x4a7626,_0x139f87[_0x698a('0xd')]);for(var _0x16bf57=0x0,_0x33140c={},_0x495b4e={};_0x16bf57<_0x4a7626[_0x698a('0x3e')];_0x16bf57+=0x1){_0x33140c=_0x4a7626[_0x16bf57];var _0x547dc9=_[_0x698a('0x3f')](_0x33140c[_0x698a('0x25')])?util[_0x698a('0x24')](_0x698a('0x40'),_0x33140c[_0x698a('0x26')]):_0x33140c['interface'];if(_[_0x698a('0x41')](_0x139f87[_0x698a('0xd')][_0x547dc9])){_0x139f87['agents'][_0x547dc9]=new Agent(_0x33140c);}else{_0x139f87['mergeFromDatabase'](_0x139f87['agents'][_0x547dc9],_0x33140c);}}}return _0x139f87[_0x698a('0xd')];};};Realtime[_0x698a('0x3c')][_0x698a('0x42')]=function(){var _0x5dbd65=this;return function(_0x150d65){if(_0x150d65){freeIsNotKeySip(_0x150d65,_0x5dbd65['telephones']);for(var _0x44dd0c=0x0,_0x57fa03={},_0x891d3b={};_0x44dd0c<_0x150d65[_0x698a('0x3e')];_0x44dd0c+=0x1){_0x57fa03=_0x150d65[_0x44dd0c];if(_[_0x698a('0x41')](_0x5dbd65[_0x698a('0xe')][util[_0x698a('0x24')]('SIP/%s',_0x57fa03[_0x698a('0x26')])])){_0x5dbd65[_0x698a('0xe')][util[_0x698a('0x24')](_0x698a('0x40'),_0x57fa03['name'])]=new Telephone(_0x57fa03);}else{_0x5dbd65[_0x698a('0x43')](_0x5dbd65[_0x698a('0xe')][util[_0x698a('0x24')](_0x698a('0x40'),_0x57fa03['name'])],_0x57fa03);}}}return _0x5dbd65[_0x698a('0xe')];};};Realtime[_0x698a('0x3c')]['initTrunks']=function(){var _0x3ecaa5=this;return function(_0x464f4b){if(_0x464f4b){freeIsNotKeySip(_0x464f4b,_0x3ecaa5[_0x698a('0xf')]);for(var _0x4bdcb4=0x0,_0x5b6c0f={},_0x18c767={};_0x4bdcb4<_0x464f4b['length'];_0x4bdcb4+=0x1){_0x5b6c0f=_0x464f4b[_0x4bdcb4];if(_[_0x698a('0x41')](_0x3ecaa5['trunks'][util[_0x698a('0x24')](_0x698a('0x40'),_0x5b6c0f['name'])])){_0x3ecaa5[_0x698a('0xf')][util[_0x698a('0x24')](_0x698a('0x40'),_0x5b6c0f[_0x698a('0x26')])]=new Trunk(_0x5b6c0f);}else{_0x3ecaa5[_0x698a('0x43')](_0x3ecaa5[_0x698a('0xf')][util[_0x698a('0x24')](_0x698a('0x40'),_0x5b6c0f['name'])],_0x5b6c0f);}}}return _0x3ecaa5[_0x698a('0xf')];};};Realtime[_0x698a('0x3c')][_0x698a('0x44')]=function(){var _0x2ac134=this;return function(_0x2b169f){if(_0x2b169f){freeIsNotKey(_0x2b169f,_0x2ac134['voiceQueues'],_0x698a('0x26'));for(var _0x3fc439=0x0,_0x5d1e43={},_0x407a3f={};_0x3fc439<_0x2b169f[_0x698a('0x3e')];_0x3fc439+=0x1){_0x5d1e43=_0x2b169f[_0x3fc439];if(_[_0x698a('0x41')](_0x2ac134[_0x698a('0x10')][_0x5d1e43[_0x698a('0x26')]])){_0x2ac134['voiceQueues'][_0x5d1e43['name']]=new VoiceQueue(_0x5d1e43);}else{_0x2ac134[_0x698a('0x43')](_0x2ac134[_0x698a('0x10')][_0x5d1e43[_0x698a('0x26')]],_0x5d1e43);}}}return _0x2ac134['voiceQueues'];};};Realtime[_0x698a('0x3c')]['initTriggers']=function(){var _0x5086f2=this;return function(_0x1af54d){if(_0x1af54d){freeIsNotKey(_0x1af54d,_0x5086f2[_0x698a('0x11')],'id');for(var _0x137dbe=0x0,_0x4bd1c0={},_0x38a2e4={};_0x137dbe<_0x1af54d[_0x698a('0x3e')];_0x137dbe+=0x1){_0x4bd1c0=_0x1af54d[_0x137dbe];if(_['isUndefined'](_0x5086f2[_0x698a('0x11')][_0x4bd1c0['id']])){_0x5086f2[_0x698a('0x11')][_0x4bd1c0['id']]=new Trigger(_0x4bd1c0);}else{_0x5086f2[_0x698a('0x43')](_0x5086f2[_0x698a('0x11')][_0x4bd1c0['id']],_0x4bd1c0);}}}return _0x5086f2[_0x698a('0x11')];};};Realtime[_0x698a('0x3c')]['initTemplates']=function(){var _0x1aae67=this;return function(_0x3d7ca3){if(_0x3d7ca3){freeIsNotKey(_0x3d7ca3,_0x1aae67[_0x698a('0x12')],'id');for(var _0x5a0a45=0x0,_0x37c116={},_0x5f3ebf={};_0x5a0a45<_0x3d7ca3[_0x698a('0x3e')];_0x5a0a45+=0x1){_0x37c116=_0x3d7ca3[_0x5a0a45];if(_[_0x698a('0x41')](_0x1aae67['templates'][_0x37c116['id']])){_0x1aae67['templates'][_0x37c116['id']]=new Template(_0x37c116);}else{_0x1aae67['mergeFromDatabase'](_0x1aae67[_0x698a('0x12')][_0x37c116['id']],_0x37c116);}}}return _0x1aae67[_0x698a('0x12')];};};Realtime['prototype'][_0x698a('0x45')]=function(){var _0x222527=this;return function(_0x1d5f8d){if(_0x1d5f8d){freeIsNotKey(_0x1d5f8d,_0x222527['zendeskAccounts'],'id');for(var _0x458a71=0x0,_0x191cbb={},_0x452151={};_0x458a71<_0x1d5f8d[_0x698a('0x3e')];_0x458a71+=0x1){_0x191cbb=_0x1d5f8d[_0x458a71];if(_[_0x698a('0x41')](_0x222527[_0x698a('0x19')][_0x191cbb['id']])){_0x222527[_0x698a('0x19')][_0x191cbb['id']]=new ZendeskAccount(_0x191cbb);}else{_0x222527['mergeFromDatabase'](_0x222527[_0x698a('0x19')][_0x191cbb['id']],_0x191cbb);}}}return _0x222527[_0x698a('0x19')];};};Realtime[_0x698a('0x3c')][_0x698a('0x46')]=function(){var _0x5f5181=this;return function(_0xb07000){if(_0xb07000){freeIsNotKey(_0xb07000,_0x5f5181[_0x698a('0x1a')],'id');for(var _0x5d6160=0x0,_0x42d6c7={},_0x287351={};_0x5d6160<_0xb07000['length'];_0x5d6160+=0x1){_0x42d6c7=_0xb07000[_0x5d6160];if(_['isUndefined'](_0x5f5181[_0x698a('0x1a')][_0x42d6c7['id']])){_0x5f5181[_0x698a('0x1a')][_0x42d6c7['id']]=new SalesforceAccount(_0x42d6c7);}else{_0x5f5181[_0x698a('0x43')](_0x5f5181[_0x698a('0x1a')][_0x42d6c7['id']],_0x42d6c7);}}}return _0x5f5181[_0x698a('0x1a')];};};Realtime[_0x698a('0x3c')][_0x698a('0x47')]=function(){var _0x5d3f5d=this;return function(_0x161c71){if(_0x161c71){freeIsNotKey(_0x161c71,_0x5d3f5d['freshdeskAccounts'],'id');for(var _0x5be56a=0x0,_0x1a322b={},_0x474ae2={};_0x5be56a<_0x161c71[_0x698a('0x3e')];_0x5be56a+=0x1){_0x1a322b=_0x161c71[_0x5be56a];if(_[_0x698a('0x41')](_0x5d3f5d[_0x698a('0x1c')][_0x1a322b['id']])){_0x5d3f5d[_0x698a('0x1c')][_0x1a322b['id']]=new FreshdeskAccount(_0x1a322b);}else{_0x5d3f5d[_0x698a('0x43')](_0x5d3f5d[_0x698a('0x1c')][_0x1a322b['id']],_0x1a322b);}}}return _0x5d3f5d[_0x698a('0x1c')];};};Realtime[_0x698a('0x3c')]['initZohoAccounts']=function(){var _0x3b1076=this;return function(_0x566c00){if(_0x566c00){freeIsNotKey(_0x566c00,_0x3b1076[_0x698a('0x1d')],'id');for(var _0x33b0c2=0x0,_0x152a25={},_0x5e0fdc={};_0x33b0c2<_0x566c00[_0x698a('0x3e')];_0x33b0c2+=0x1){_0x152a25=_0x566c00[_0x33b0c2];if(_[_0x698a('0x41')](_0x3b1076['zohoAccounts'][_0x152a25['id']])){_0x3b1076[_0x698a('0x1d')][_0x152a25['id']]=new ZohoAccount(_0x152a25);}else{_0x3b1076[_0x698a('0x43')](_0x3b1076[_0x698a('0x1d')][_0x152a25['id']],_0x152a25);}}}return _0x3b1076[_0x698a('0x1d')];};};Realtime['prototype'][_0x698a('0x48')]=function(){var _0x610daf=this;return function(_0x5c0f7b){if(_0x5c0f7b){freeIsNotKey(_0x5c0f7b,_0x610daf[_0x698a('0x1e')],'id');for(var _0x4be900=0x0,_0x475d0e={},_0x45c5f9={};_0x4be900<_0x5c0f7b['length'];_0x4be900+=0x1){_0x475d0e=_0x5c0f7b[_0x4be900];if(_[_0x698a('0x41')](_0x610daf[_0x698a('0x1e')][_0x475d0e['id']])){_0x610daf[_0x698a('0x1e')][_0x475d0e['id']]=new DeskAccount(_0x475d0e);}else{_0x610daf['mergeFromDatabase'](_0x610daf[_0x698a('0x1e')][_0x475d0e['id']],_0x475d0e);}}}return _0x610daf[_0x698a('0x1e')];};};Realtime[_0x698a('0x3c')]['initSugarcrmAccounts']=function(){var _0x3d04d2=this;return function(_0x561ba8){if(_0x561ba8){freeIsNotKey(_0x561ba8,_0x3d04d2[_0x698a('0x1b')],'id');for(var _0x1bceca=0x0,_0x56516b={},_0x4fec17={};_0x1bceca<_0x561ba8['length'];_0x1bceca+=0x1){_0x56516b=_0x561ba8[_0x1bceca];if(_[_0x698a('0x41')](_0x3d04d2[_0x698a('0x1b')][_0x56516b['id']])){_0x3d04d2[_0x698a('0x1b')][_0x56516b['id']]=new SugarcrmAccount(_0x56516b);}else{_0x3d04d2['mergeFromDatabase'](_0x3d04d2[_0x698a('0x1b')][_0x56516b['id']],_0x56516b);}}}return _0x3d04d2['sugarcrmAccounts'];};};Realtime[_0x698a('0x3c')][_0x698a('0x49')]=function(){var _0x2ee0fb=this;return function(_0x40edcd){if(_0x40edcd){freeIsNotKey(_0x40edcd,_0x2ee0fb[_0x698a('0x1f')],'id');for(var _0x5c93a2=0x0,_0x36b1ed={},_0x276ab3={};_0x5c93a2<_0x40edcd[_0x698a('0x3e')];_0x5c93a2+=0x1){_0x36b1ed=_0x40edcd[_0x5c93a2];if(_[_0x698a('0x41')](_0x2ee0fb['vtigerAccounts'][_0x36b1ed['id']])){_0x2ee0fb[_0x698a('0x1f')][_0x36b1ed['id']]=new VtigerAccount(_0x36b1ed);}else{_0x2ee0fb[_0x698a('0x43')](_0x2ee0fb[_0x698a('0x1f')][_0x36b1ed['id']],_0x36b1ed);}}}return _0x2ee0fb['vtigerAccounts'];};};Realtime[_0x698a('0x3c')][_0x698a('0x4a')]=function(){var _0x27edfe=this;return function(_0x57731b){if(_0x57731b){freeIsNotKey(_0x57731b,_0x27edfe[_0x698a('0x20')],'id');for(var _0x779702=0x0,_0x89ee2e={},_0x3781a5={};_0x779702<_0x57731b[_0x698a('0x3e')];_0x779702+=0x1){_0x89ee2e=_0x57731b[_0x779702];if(_['isUndefined'](_0x27edfe[_0x698a('0x20')][_0x89ee2e['id']])){_0x27edfe['servicenowAccounts'][_0x89ee2e['id']]=new ServicenowAccount(_0x89ee2e);}else{_0x27edfe[_0x698a('0x43')](_0x27edfe[_0x698a('0x20')][_0x89ee2e['id']],_0x89ee2e);}}}return _0x27edfe[_0x698a('0x20')];};};Realtime['prototype'][_0x698a('0x4b')]=function(){var _0x269a6f=this;return function(_0x2cc5d0){if(_0x2cc5d0){freeIsNotKey(_0x2cc5d0,_0x269a6f[_0x698a('0x4c')],'id');for(var _0xd9b390=0x0,_0x164fc7={},_0x1758bf={};_0xd9b390<_0x2cc5d0[_0x698a('0x3e')];_0xd9b390+=0x1){_0x164fc7=_0x2cc5d0[_0xd9b390];if(_[_0x698a('0x41')](_0x269a6f[_0x698a('0x4c')][_0x164fc7['id']])){_0x269a6f[_0x698a('0x4c')][_0x164fc7['id']]=new Dynamics365Account(_0x164fc7);}else{_0x269a6f['mergeFromDatabase'](_0x269a6f[_0x698a('0x4c')][_0x164fc7['id']],_0x164fc7);}}}return _0x269a6f['dynamics365Accounts'];};};Realtime[_0x698a('0x3c')][_0x698a('0x4d')]=function(){var _0x51f7b2=this;return function(_0x55bb7f){if(_0x55bb7f){freeIsNotKey(_0x55bb7f,_0x51f7b2[_0x698a('0x21')],'id');for(var _0x4c5264=0x0,_0x45a532={},_0x23f39a={};_0x4c5264<_0x55bb7f[_0x698a('0x3e')];_0x4c5264+=0x1){_0x45a532=_0x55bb7f[_0x4c5264];if(_[_0x698a('0x41')](_0x51f7b2[_0x698a('0x21')][_0x45a532['id']])){_0x51f7b2[_0x698a('0x21')][_0x45a532['id']]=new FreshsalesAccount(_0x45a532);}else{_0x51f7b2[_0x698a('0x43')](_0x51f7b2[_0x698a('0x21')][_0x45a532['id']],_0x45a532);}}}return _0x51f7b2[_0x698a('0x21')];};};Realtime[_0x698a('0x3c')][_0x698a('0x4e')]=function(){var _0x2c9fa7=this;return function(_0x38110d){for(var _0x2ea8b0=0x0;_0x2ea8b0<_0x38110d['length'];_0x2ea8b0+=0x1){_[_0x698a('0x4f')](_0x2c9fa7[_0x698a('0x10')][_0x38110d[_0x2ea8b0]['name']],_0x38110d[_0x2ea8b0]);}return _0x2c9fa7[_0x698a('0x10')];};};Realtime['prototype'][_0x698a('0x50')]=function(){var _0x4da449=this;return function(_0x4baac2){clearVoiceQueues(_0x4da449[_0x698a('0x10')]);if(_0x4baac2){_0x4baac2=_[_0x698a('0x51')](_0x4baac2,'uniqueid');for(var _0x1363b9 in _0x4baac2){if(_0x4baac2[_0x698a('0x22')](_0x1363b9)){var _0x1ebbc9={};for(var _0x4f5c76=0x0;_0x4f5c76<_0x4baac2[_0x1363b9][_0x698a('0x3e')];_0x4f5c76+=0x1){var _0x3c7391=_0x4baac2[_0x1363b9][_0x4f5c76]['queue'];if(_0x4da449[_0x698a('0x10')][_0x3c7391]){if(_0x4baac2[_0x1363b9][_0x4f5c76][_0x698a('0x52')]){_0x4da449['voiceQueues'][_0x3c7391][_0x698a('0x2e')]+=0x1;}if(_0x4baac2[_0x1363b9][_0x4f5c76]['queuecallerabandon']){_0x4da449[_0x698a('0x10')][_0x3c7391][_0x698a('0x2f')]+=0x1;}_0x4da449[_0x698a('0x10')][_0x3c7391][_0x698a('0x53')]+=moment(_0x4baac2[_0x1363b9][_0x4f5c76][_0x698a('0x54')])[_0x698a('0x55')](moment(_0x4baac2[_0x1363b9][_0x4f5c76][_0x698a('0x56')]),_0x698a('0x57'))||0x0;if(_0x4f5c76===_0x4baac2[_0x1363b9][_0x698a('0x3e')]-0x1){_0x4da449[_0x698a('0x10')][_0x3c7391][_0x698a('0x28')]+=moment(_0x4baac2[_0x1363b9][_0x4f5c76]['queuecallercompleteAt']||_0x4baac2[_0x1363b9][_0x4f5c76]['queuecallerabandonAt']||_0x4baac2[_0x1363b9][_0x4f5c76][_0x698a('0x58')])['diff'](moment(_0x4baac2[_0x1363b9][_0x4f5c76][_0x698a('0x56')]),_0x698a('0x57'))||0x0;_0x4da449[_0x698a('0x10')][_0x3c7391]['total']+=0x1;if(_0x4baac2[_0x1363b9][_0x4f5c76][_0x698a('0x59')]){_0x4da449[_0x698a('0x10')][_0x3c7391][_0x698a('0x27')]+=0x1;_0x4da449[_0x698a('0x10')][_0x3c7391][_0x698a('0x29')]+=moment(_0x4baac2[_0x1363b9][_0x4f5c76][_0x698a('0x5a')])[_0x698a('0x55')](moment(_0x4baac2[_0x1363b9][_0x4f5c76]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x4da449['voiceQueues'][_0x3c7391][_0x698a('0x28')]+=_0x4da449[_0x698a('0x10')][_0x3c7391]['sumHoldTime']||0x0;}}}}}}return _0x4da449[_0x698a('0x10')];};};Realtime[_0x698a('0x3c')][_0x698a('0x5b')]=function(){var _0x21041b=this;return function(_0x5e1f0c){clearVoiceCallReports(_0x21041b[_0x698a('0x13')]);if(_0x5e1f0c){for(var _0x2deaaf=0x0;_0x2deaaf<_0x5e1f0c['length'];_0x2deaaf+=0x1){_0x21041b['outbound'][_0x698a('0x2d')]+=0x1;_0x21041b[_0x698a('0x13')][_0x698a('0x28')]+=_0x5e1f0c[_0x2deaaf][_0x698a('0x5c')];if(_0x5e1f0c[_0x2deaaf][_0x698a('0x5d')]===_0x698a('0x5e')){_0x21041b[_0x698a('0x13')][_0x698a('0x27')]+=0x1;_0x21041b['outbound'][_0x698a('0x53')]+=_0x5e1f0c[_0x2deaaf][_0x698a('0x5c')]-_0x5e1f0c[_0x2deaaf][_0x698a('0x5f')]||0x0;_0x21041b[_0x698a('0x13')]['sumBillable']+=_0x5e1f0c[_0x2deaaf][_0x698a('0x5f')];}}}return _0x21041b[_0x698a('0x13')];};};Realtime[_0x698a('0x3c')][_0x698a('0x60')]=function(){var _0xf10f01=this;return function(_0x111a38){if(_0x111a38){freeIsNotKey(_0x111a38,_0xf10f01[_0x698a('0x61')],_0x698a('0x26'));for(var _0x477917=0x0,_0x2f35ec={};_0x477917<_0x111a38[_0x698a('0x3e')];_0x477917+=0x1){_0x2f35ec=_0x111a38[_0x477917];if(_[_0x698a('0x41')](_0xf10f01[_0x698a('0x61')][_0x2f35ec[_0x698a('0x26')]])){_0xf10f01['campaigns'][_0x2f35ec[_0x698a('0x26')]]=new Campaign(_0x2f35ec);}else{_0xf10f01[_0x698a('0x43')](_0xf10f01[_0x698a('0x61')][_0x2f35ec[_0x698a('0x26')]],_0x2f35ec);_0xf10f01['campaigns'][_0x2f35ec[_0x698a('0x26')]][_0x698a('0x62')]=_0x2f35ec[_0x698a('0x63')]?_0x2f35ec[_0x698a('0x63')][_0x698a('0x26')]:undefined;}}}return _0xf10f01['campaigns'];};};Realtime[_0x698a('0x3c')]['initVoiceExtensions']=function(){var _0x43a2a7=this;return function(_0x14f6ea){if(_0x14f6ea){freeIsNotKey(_0x14f6ea,_0x43a2a7['voiceExtensions'],'id');for(var _0x261aca=0x0,_0x1c2cfc={};_0x261aca<_0x14f6ea['length'];_0x261aca+=0x1){_0x1c2cfc=_0x14f6ea[_0x261aca];if(_[_0x698a('0x41')](_0x43a2a7[_0x698a('0x14')][_0x1c2cfc['id']])){_0x43a2a7['voiceExtensions'][_0x1c2cfc['id']]=new VoiceExtension(_0x1c2cfc);}else{_0x43a2a7[_0x698a('0x43')](_0x43a2a7[_0x698a('0x14')][_0x1c2cfc['id']],_0x1c2cfc);}}}return _0x43a2a7['voiceExtensions'];};};Realtime[_0x698a('0x3c')][_0x698a('0x64')]=function(){var _0x463125=this;return function(_0x161197){clearCampaigns(_0x463125[_0x698a('0x61')]);for(var _0x2f3ec8=0x0;_0x2f3ec8<_0x161197[_0x698a('0x3e')];_0x2f3ec8+=0x1){_['merge'](_0x463125['campaigns'][_0x161197[_0x2f3ec8][_0x698a('0x26')]],_0x161197[_0x2f3ec8]);}return _0x463125[_0x698a('0x61')];};};Realtime[_0x698a('0x3c')][_0x698a('0x65')]=function(){var _0x4ac422=this;return function(_0x25d3ca){if(_0x25d3ca){freeIsNotKey(_0x25d3ca,_0x4ac422[_0x698a('0x66')],'id');for(var _0x2f12b6=0x0,_0x5d18b2={},_0x54eb97={};_0x2f12b6<_0x25d3ca[_0x698a('0x3e')];_0x2f12b6+=0x1){_0x5d18b2=_0x25d3ca[_0x2f12b6];if(_[_0x698a('0x41')](_0x4ac422['faxAccounts'][_0x5d18b2['id']])){_0x4ac422['faxAccounts'][_0x5d18b2['id']]=new FaxAccount(_0x5d18b2);}else{_0x4ac422[_0x698a('0x43')](_0x4ac422[_0x698a('0x66')][_0x5d18b2['id']],_0x5d18b2);}}}return _0x4ac422[_0x698a('0x66')];};};module[_0x698a('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0a327c5..2b8c16b 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 _0x264d=['disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getCallType','channel','split','getAgentByInternal','outbound','internal','destination','exten','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitors','length','monitorFilename','filename','connectedlinename','xcally-motion-dialer','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','exports','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr'];(function(_0x6e55b1,_0xb89056){var _0x27d69d=function(_0x3a7e80){while(--_0x3a7e80){_0x6e55b1['push'](_0x6e55b1['shift']());}};_0x27d69d(++_0xb89056);}(_0x264d,0x1cb));var _0xd264=function(_0x21875e,_0x10d26f){_0x21875e=_0x21875e-0x0;var _0xcd1780=_0x264d[_0x21875e];return _0xcd1780;};'use strict';var _=require('lodash');var moment=require(_0xd264('0x0'));var util=require(_0xd264('0x1'));var config=require(_0xd264('0x2'));var ami=require(_0xd264('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xd264('0x4'));var RpcVoiceDialReport=require(_0xd264('0x5'));var RpcMemberReport=require(_0xd264('0x6'));var RpcVoiceQueueReport=require(_0xd264('0x7'));var RpcVoiceRecording=require(_0xd264('0x8'));var RpcVoiceTransferReport=require(_0xd264('0x9'));var VoiceQueueReport=require(_0xd264('0xa'));var VoiceCallReport=require(_0xd264('0xb'));var VoiceAgentReport=require(_0xd264('0xc'));var VoiceDialReport=require(_0xd264('0xd'));var UserReport=require(_0xd264('0xe'));function Report(_0x38d784){this[_0xd264('0xf')]=_0x38d784;this[_0xd264('0x10')]=_0x38d784[_0xd264('0x10')];this[_0xd264('0x11')]=_0x38d784[_0xd264('0x11')];}Report[_0xd264('0x12')][_0xd264('0x13')]=function(_0x3000ad){var _0x39f30b=new VoiceQueueReport(this[_0xd264('0xf')]);var _0x1ae442=new VoiceAgentReport(this[_0xd264('0xf')]);var _0x16009e=new VoiceDialReport(this[_0xd264('0xf')]);var _0x3ac9b9=new VoiceCallReport(this[_0xd264('0xf')]);var _0x3ea591=new UserReport(this[_0xd264('0xf')]);if(config[_0xd264('0x14')]&&config[_0xd264('0x14')][_0xd264('0x15')]){ami['on'](_0xd264('0x16'),this[_0xd264('0x17')][_0xd264('0x18')](this));ami['on'](_0xd264('0x19'),this[_0xd264('0x1a')][_0xd264('0x18')](this));ami['on'](_0xd264('0x1b'),this[_0xd264('0x1c')][_0xd264('0x18')](this));ami['on']('custom:voiceDialReport',this[_0xd264('0x1d')]['bind'](this));ami['on'](_0xd264('0x1e'),this[_0xd264('0x1f')][_0xd264('0x18')](this));ami['on'](_0xd264('0x20'),this[_0xd264('0x21')][_0xd264('0x18')](this));}};Report[_0xd264('0x12')][_0xd264('0x22')]=function(_0x2ac834){var _0x56f3cf;_0x56f3cf=_[_0xd264('0x23')](this['agents'],function(_0x4b5f63){return _0x4b5f63[_0xd264('0x24')]==_0x2ac834||_0x4b5f63[_0xd264('0x25')]==_0x2ac834;});if(_[_0xd264('0x26')](_0x56f3cf)){var _0x58fc87=_['find'](this[_0xd264('0x11')],function(_0x4f91c5){return _0x4f91c5[_0xd264('0x24')]==_0x2ac834||_0x4f91c5['name']==_0x2ac834;});if(_0x58fc87){_0x56f3cf=_[_0xd264('0x23')](this['agents'],function(_0x1b3031){return _0x1b3031['interface']==util[_0xd264('0x27')](_0xd264('0x28'),_0x58fc87[_0xd264('0x25')]);});}}return _0x56f3cf;};Report[_0xd264('0x12')][_0xd264('0x17')]=function(_0x42a5a0){for(var _0x3f284d=0x0;_0x3f284d<_0x42a5a0['length'];_0x3f284d+=0x1){var _0x552a88=this[_0xd264('0x22')](_0x42a5a0[_0x3f284d][_0xd264('0x29')]);if(_0x552a88){_0x42a5a0[_0x3f284d][_0xd264('0x24')]=_0x552a88[_0xd264('0x24')];_0x42a5a0[_0x3f284d][_0xd264('0x2a')]=!![];_0x42a5a0[_0x3f284d][_0xd264('0x2b')]=_0x552a88[_0xd264('0x25')];_0x42a5a0[_0x3f284d][_0xd264('0x2c')]=_['isNil'](_0x552a88['interface'])?util['format']('SIP/%s',_0x552a88[_0xd264('0x25')]):_0x552a88[_0xd264('0x2c')];if(_0x42a5a0[_0x3f284d][_0xd264('0x2d')]){_0x42a5a0[_0x3f284d][_0xd264('0x2e')]=moment()[_0xd264('0x27')](_0xd264('0x2f'));}if(_0x42a5a0[_0x3f284d][_0xd264('0x30')]){_0x42a5a0[_0x3f284d][_0xd264('0x31')]=moment()[_0xd264('0x27')](_0xd264('0x2f'));}RpcMemberReport[_0xd264('0x17')](_0x42a5a0[_0x3f284d]);}RpcVoiceQueueReport[_0xd264('0x32')](_0x42a5a0[_0x3f284d]);}};function extractCalleridNumber(_0x5ab07f){var _0x5151aa=_0x5ab07f[_0xd264('0x33')](/<(.*?)>/);return _0x5151aa?_0x5151aa[0x1]:_0x5ab07f;}Report[_0xd264('0x12')]['getAgentByInternal']=function(_0x3f945e){for(var _0x1b15d9=0x0;_0x1b15d9','transfers','linkedid','transfereelinkedid','uniqueid','UserId','getAgentByInternal','membername','monitor','monitors','exten','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','phone','substring','lastIndexOf','moment','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0x890b,0x199));var _0xb890=function(_0x2c8a17,_0x1841c4){_0x2c8a17=_0x2c8a17-0x0;var _0x126c37=_0x890b[_0x2c8a17];return _0x126c37;};'use strict';var _=require('lodash');var moment=require(_0xb890('0x0'));var util=require(_0xb890('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xb890('0x2'));var RpcVoiceCallReport=require(_0xb890('0x3'));var RpcVoiceDialReport=require(_0xb890('0x4'));var RpcMemberReport=require(_0xb890('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xb890('0x6'));var RpcVoiceTransferReport=require(_0xb890('0x7'));var VoiceQueueReport=require(_0xb890('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xb890('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xb890('0xa'));function Report(_0x23a0a6){this[_0xb890('0xb')]=_0x23a0a6;this[_0xb890('0xc')]=_0x23a0a6[_0xb890('0xc')];this[_0xb890('0xd')]=_0x23a0a6[_0xb890('0xd')];}Report[_0xb890('0xe')][_0xb890('0xf')]=function(_0x34d3c3){var _0x28330c=new VoiceQueueReport(this[_0xb890('0xb')]);var _0x27ac7d=new VoiceAgentReport(this['realtime']);var _0x4abc42=new VoiceDialReport(this[_0xb890('0xb')]);var _0x8cf3b=new VoiceCallReport(this[_0xb890('0xb')]);var _0x2b2eeb=new UserReport(this[_0xb890('0xb')]);if(config['xdr']&&config[_0xb890('0x10')]['disabled']){ami['on'](_0xb890('0x11'),this[_0xb890('0x12')][_0xb890('0x13')](this));ami['on']('custom:voiceCallReport',this[_0xb890('0x14')][_0xb890('0x13')](this));ami['on']('custom:voiceAgentReport',this[_0xb890('0x15')][_0xb890('0x13')](this));ami['on']('custom:voiceDialReport',this[_0xb890('0x16')][_0xb890('0x13')](this));ami['on'](_0xb890('0x17'),this[_0xb890('0x18')][_0xb890('0x13')](this));ami['on'](_0xb890('0x19'),this[_0xb890('0x1a')]['bind'](this));}};Report['prototype'][_0xb890('0x1b')]=function(_0x527e25){var _0x3456c3;_0x3456c3=_[_0xb890('0x1c')](this[_0xb890('0xc')],function(_0x542676){return _0x542676[_0xb890('0x1d')]==_0x527e25||_0x542676[_0xb890('0x1e')]==_0x527e25;});if(_[_0xb890('0x1f')](_0x3456c3)){var _0x353305=_[_0xb890('0x1c')](this[_0xb890('0xd')],function(_0x441b82){return _0x441b82[_0xb890('0x1d')]==_0x527e25||_0x441b82[_0xb890('0x1e')]==_0x527e25;});if(_0x353305){_0x3456c3=_[_0xb890('0x1c')](this[_0xb890('0xc')],function(_0x4d92a3){return _0x4d92a3[_0xb890('0x20')]==util[_0xb890('0x21')](_0xb890('0x22'),_0x353305[_0xb890('0x1e')]);});}}return _0x3456c3;};Report[_0xb890('0xe')][_0xb890('0x12')]=function(_0x4ef76e){for(var _0x5bfcec=0x0;_0x5bfcec<_0x4ef76e[_0xb890('0x23')];_0x5bfcec+=0x1){var _0x1b06a4=this[_0xb890('0x1b')](_0x4ef76e[_0x5bfcec][_0xb890('0x24')]);if(_0x1b06a4){_0x4ef76e[_0x5bfcec][_0xb890('0x1d')]=_0x1b06a4[_0xb890('0x1d')];_0x4ef76e[_0x5bfcec][_0xb890('0x25')]=!![];_0x4ef76e[_0x5bfcec][_0xb890('0x26')]=_0x1b06a4['name'];_0x4ef76e[_0x5bfcec][_0xb890('0x20')]=_[_0xb890('0x1f')](_0x1b06a4[_0xb890('0x20')])?util[_0xb890('0x21')](_0xb890('0x22'),_0x1b06a4[_0xb890('0x1e')]):_0x1b06a4[_0xb890('0x20')];if(_0x4ef76e[_0x5bfcec][_0xb890('0x27')]){_0x4ef76e[_0x5bfcec][_0xb890('0x28')]=moment()[_0xb890('0x21')](_0xb890('0x29'));}if(_0x4ef76e[_0x5bfcec][_0xb890('0x2a')]){_0x4ef76e[_0x5bfcec]['queuecallerexitAt']=moment()[_0xb890('0x21')](_0xb890('0x29'));}RpcMemberReport['voiceQueueReport'](_0x4ef76e[_0x5bfcec]);}RpcVoiceQueueReport[_0xb890('0x2b')](_0x4ef76e[_0x5bfcec]);}};function extractCalleridNumber(_0x32a70b){var _0x55cdc2=_0x32a70b[_0xb890('0x2c')](/<(.*?)>/);return _0x55cdc2?_0x55cdc2[0x1]:_0x32a70b;}Report[_0xb890('0xe')]['getAgentByInternal']=function(_0x18a651){for(var _0xfcdda2=0x0;_0xfcdda20x0?_0x1ffc1c:0x0;this['voiceQueues'][_0x56dd33[_0xf071('0x6d')]][_0xf071('0x31')]=this['voiceQueues'][_0x56dd33[_0xf071('0x6d')]]['talking']>_[_0xf071('0x73')](_0x56dd33[_0xf071('0x74')])?_['toNumber'](_0x56dd33[_0xf071('0x74')]):this[_0xf071('0x11')][_0x56dd33[_0xf071('0x6d')]][_0xf071('0x31')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x56dd33[_0xf071('0x6d')]],_0xf071('0x14'));}logger[_0xf071('0x49')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xf071('0x40')](this[_0xf071('0x11')][_0x56dd33[_0xf071('0x6d')]],{'showHidden':![],'depth':null}));ami[_0xf071('0x48')](_0xf071('0x76'),this[_0xf071('0x11')][_0x56dd33[_0xf071('0x6d')]]);}}}catch(_0x29055d){logger['error'](_0xf071('0x6b'),util['inspect'](_0x29055d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf071('0x77')]=function(_0x34bcfb){logger[_0xf071('0x49')](_0xf071('0x78'),util[_0xf071('0x40')](_0x34bcfb,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xf071('0xc')][_0xf071('0x19')]=function(_0x35936a){try{if(this[_0xf071('0x6c')](_0x35936a)){logger[_0xf071('0x49')](_0xf071('0x79'),_0x35936a[_0xf071('0x50')],util[_0xf071('0x40')](_0x35936a,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xf071('0x41')][_0x35936a[_0xf071('0x50')]]))this['queueReports'][_0x35936a['uniqueid']]=[];if(_['isUndefined'](this[_0xf071('0x10')][_0x35936a[_0xf071('0x50')]]))this[_0xf071('0x10')][_0x35936a[_0xf071('0x50')]]={};var _0x23c94a=new QueueReport();_0x23c94a[_0xf071('0x4d')]=_0x35936a[_0xf071('0x6d')];_0x23c94a[_0xf071('0x55')]=this[_0xf071('0x11')][_0x23c94a[_0xf071('0x4d')]]&&this[_0xf071('0x11')][_0x23c94a[_0xf071('0x4d')]][_0xf071('0x55')]?this[_0xf071('0x11')][_0x23c94a[_0xf071('0x4d')]][_0xf071('0x55')]||_0xf071('0x56'):_0xf071('0x56');_0x23c94a['queue']=_0x35936a[_0xf071('0x6d')];_0x23c94a['queuecallerjoinAt']=moment()[_0xf071('0x4c')](_0xf071('0x7a'));_0x23c94a['position']=_0x35936a[_0xf071('0x7b')];_0x23c94a[_0xf071('0x7c')]=_0x35936a['count'];_0x23c94a[_0xf071('0x50')]=_0x35936a[_0xf071('0x50')];_0x23c94a[_0xf071('0x7d')]=this[_0xf071('0x10')][_0x35936a[_0xf071('0x50')]][_0xf071('0x7d')];logger[_0xf071('0x6f')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x23c94a[_0xf071('0x4d')],_0x23c94a[_0xf071('0x55')]);_['merge'](_0x23c94a,_[_0xf071('0x7e')](_0x35936a,_[_0xf071('0x7f')](_0x23c94a)));this[_0xf071('0x41')][_0x35936a[_0xf071('0x50')]][_0xf071('0x80')](_0x23c94a);this['channels'][_0x35936a[_0xf071('0x50')]]=_0x23c94a;this[_0xf071('0x81')](_0x23c94a,_0xf071('0x18'));}}catch(_0x1db2e5){logger['error'](_0xf071('0x79'),_0x35936a[_0xf071('0x50')],util[_0xf071('0x40')](_0x1db2e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf071('0xc')][_0xf071('0x1a')]=function(_0x57d87c){try{if(this[_0xf071('0x6c')](_0x57d87c)){logger['debug'](_0xf071('0x82'),_0x57d87c['uniqueid'],util[_0xf071('0x40')](_0x57d87c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x57d87c[_0xf071('0x50')]]){var _0x4e2282=_[_0xf071('0x83')](this[_0xf071('0x41')][_0x57d87c['uniqueid']]);_0x4e2282[_0xf071('0x84')]=![];_0x4e2282[_0xf071('0x85')]=null;_0x4e2282[_0xf071('0x86')]=_0x57d87c['holdtime'];_0x4e2282['originalposition']=_0x57d87c[_0xf071('0x87')];_0x4e2282[_0xf071('0x88')]=!![];_0x4e2282['queuecallerabandonAt']=moment()[_0xf071('0x4c')](_0xf071('0x7a'));_0x4e2282['queuecallerexitreason']=_0xf071('0x89');_0x4e2282['lastAssignedTo']=null;logger[_0xf071('0x6f')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4e2282[_0xf071('0x4d')],_0x4e2282['type']);this[_0xf071('0x10')][_0x57d87c[_0xf071('0x50')]]=_0x4e2282;this[_0xf071('0x46')](_0x4e2282,_0xf071('0x88'));}}}catch(_0x44730a){logger[_0xf071('0x3e')](_0xf071('0x82'),_0x57d87c[_0xf071('0x50')],util[_0xf071('0x40')](_0x44730a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf071('0x1c')]=function(_0x3647b7){try{if(this[_0xf071('0x6c')](_0x3647b7)){logger[_0xf071('0x49')](_0xf071('0x8a'),_0x3647b7[_0xf071('0x50')],util[_0xf071('0x40')](_0x3647b7,{'showHidden':![],'depth':null}));if(this[_0xf071('0x41')][_0x3647b7[_0xf071('0x50')]]){var _0x274ddf=_[_0xf071('0x83')](this['queueReports'][_0x3647b7[_0xf071('0x50')]]);_0x274ddf['queuecallerleaveAt']=moment()[_0xf071('0x4c')](_0xf071('0x7a'));_0x274ddf['connectedlinenum']=_0x3647b7['connectedlinenum'];_0x274ddf[_0xf071('0x8b')]=_0x3647b7['connectedlinename'];logger[_0xf071('0x6f')](_0xf071('0x8c'),_0x274ddf[_0xf071('0x4d')],_0x274ddf['type'],_0x3647b7[_0xf071('0x8d')],_0x3647b7[_0xf071('0x8b')]);this[_0xf071('0x10')][_0x3647b7[_0xf071('0x50')]]=_0x274ddf;this['emitVoiceQueueChannelSave'](_0x274ddf,_0xf071('0x1b'));}}}catch(_0x3ab706){logger[_0xf071('0x3e')](_0xf071('0x8a'),_0x3647b7['uniqueid'],util[_0xf071('0x40')](_0x3ab706,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf071('0xc')][_0xf071('0x1f')]=function(_0x4f0709){try{if(this[_0xf071('0x6c')](_0x4f0709)){logger['debug'](_0xf071('0x8e'),_0x4f0709[_0xf071('0x50')],util[_0xf071('0x40')](_0x4f0709,{'showHidden':![],'depth':null}));if(this[_0xf071('0x41')][_0x4f0709['uniqueid']]){var _0x59fd51=_[_0xf071('0x83')](this[_0xf071('0x41')][_0x4f0709[_0xf071('0x50')]]);_0x59fd51[_0xf071('0x84')]=!![];_0x59fd51[_0xf071('0x8f')]=_0xf071('0x90');logger[_0xf071('0x6f')](_0xf071('0x91'),_0x59fd51[_0xf071('0x4d')],_0x59fd51[_0xf071('0x55')]);}}}catch(_0x2f0cdc){logger[_0xf071('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x4f0709['uniqueid'],util[_0xf071('0x40')](_0x2f0cdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf071('0x92')]=function(_0x4783a5){try{if(this[_0xf071('0x6c')](_0x4783a5)){logger[_0xf071('0x49')](_0xf071('0x93'),_0x4783a5[_0xf071('0x50')],util['inspect'](_0x4783a5,{'showHidden':![],'depth':null}));if(this[_0xf071('0x41')][_0x4783a5['uniqueid']]){var _0x3770d6=_[_0xf071('0x83')](this[_0xf071('0x41')][_0x4783a5[_0xf071('0x50')]]);_0x3770d6['queuecallerabandon']=![];_0x3770d6[_0xf071('0x94')]=null;_0x3770d6[_0xf071('0x95')]=!![];_0x3770d6[_0xf071('0x96')]=_0x4783a5[_0xf071('0x97')];_0x3770d6[_0xf071('0x86')]=_0x4783a5['holdtime'];_0x3770d6[_0xf071('0x84')]=!![];_0x3770d6['queuecallerexit']=![];_0x3770d6[_0xf071('0x98')]=null;if(!_0x3770d6['transfer']){if(_0x4783a5[_0xf071('0x99')]==_0xf071('0x9a')){_0x3770d6[_0xf071('0x8f')]='COMPLETED';logger[_0xf071('0x6f')](_0xf071('0x9b'),_0x3770d6[_0xf071('0x4d')],_0x3770d6[_0xf071('0x55')]);}else{if(_[_0xf071('0x9c')](_0x4783a5['channel'][_0xf071('0x9d')](),_0xf071('0x9e'))){if(this[_0xf071('0x41')][_0x4783a5[_0xf071('0x9f')]]){var _0x39d09a=_[_0xf071('0x83')](this['queueReports'][_0x4783a5[_0xf071('0x9f')]]);_0x39d09a[_0xf071('0x84')]=![];_0x39d09a[_0xf071('0xa0')]=!![];_0x39d09a[_0xf071('0x98')]=moment(_0x3770d6[_0xf071('0xa1')])[_0xf071('0xa2')](_0x4783a5[_0xf071('0x86')],_0xf071('0xa3'))[_0xf071('0x4c')](_0xf071('0x7a'));_0x39d09a['queuecallerexitreason']=_0xf071('0xa4');_0x39d09a[_0xf071('0x9a')]=!![];_0x39d09a[_0xf071('0xa5')]=_0xf071('0xa6');_0x39d09a[_0xf071('0xa7')]=_0x4783a5[_0xf071('0xa8')];_0x39d09a['transferuniqueid']=_0x4783a5[_0xf071('0x50')];logger[_0xf071('0x6f')](_0xf071('0xa9'),_0x39d09a[_0xf071('0x4d')],_0x39d09a[_0xf071('0x55')]);var _0x3a8804=this[_0xf071('0x41')][_0x4783a5[_0xf071('0x9f')]];this['queueReports'][_0x4783a5[_0xf071('0x9f')]]=this['queueReports'][_0x4783a5[_0xf071('0x50')]];this[_0xf071('0x41')][_0x4783a5[_0xf071('0x50')]]=_0x3a8804;}}else{_0x3770d6[_0xf071('0x8f')]=_0xf071('0xaa')+_0x4783a5[_0xf071('0x99')][_0xf071('0xab')]();logger[_0xf071('0x6f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3770d6[_0xf071('0x4d')],_0x3770d6[_0xf071('0x55')],_0x3770d6[_0xf071('0x8f')]);}}}this[_0xf071('0x10')][_0x4783a5[_0xf071('0x50')]]=_0x3770d6;this[_0xf071('0x46')](_0x3770d6,'agentcomplete');}}}catch(_0xf0b866){logger[_0xf071('0x3e')]('[%s][voiceQueueReport][agentcomplete]',_0x4783a5[_0xf071('0x50')],util['inspect'](_0xf0b866,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf071('0xc')][_0xf071('0xac')]=function(_0x51369a){try{if(this[_0xf071('0x6c')](_0x51369a)){logger[_0xf071('0x49')](_0xf071('0xad'),_0x51369a[_0xf071('0x50')],util['inspect'](_0x51369a,{'showHidden':![],'depth':null}));this[_0xf071('0xae')](_0x51369a[_0xf071('0x50')],_['keys'](_0x51369a[_0xf071('0xaf')])[0x0],_0x51369a[_0xf071('0xb0')]);if(this[_0xf071('0x41')][_0x51369a[_0xf071('0x50')]]){var _0x26874c=_[_0xf071('0x83')](this['queueReports'][_0x51369a[_0xf071('0x50')]]);if(_0x26874c){if(this[_0xf071('0x6c')](_0x51369a[_0xf071('0xaf')])&&this['isNotNull'](_0x51369a['variable'][_0xf071('0xb1')])){switch(_0x51369a['value']){case _0xf071('0xb2'):_0x26874c[_0xf071('0xa0')]=![];_0x26874c[_0xf071('0x98')]=null;break;case _0xf071('0xb3'):_0x26874c[_0xf071('0xb4')]=_0xf071('0xb5');_0x26874c['queuecallerexit']=!![];_0x26874c['queuecallerexitAt']=moment()[_0xf071('0x4c')](_0xf071('0x7a'));_0x26874c['queuecallerleaveAt']=moment()[_0xf071('0x4c')](_0xf071('0x7a'));logger['debug'](_0xf071('0xb6'),_0x51369a[_0xf071('0x50')],util['inspect'](_0x26874c,{'showHidden':![],'depth':null}));ami[_0xf071('0x48')](_0xf071('0xb7'),_0x26874c);break;default:_0x26874c[_0xf071('0xa0')]=!![];_0x26874c['queuecallerexitAt']=moment()[_0xf071('0x4c')](_0xf071('0x7a'));_0x26874c['queuecallerleaveAt']=moment()['format'](_0xf071('0x7a'));}_0x26874c['queuecallerabandon']=![];_0x26874c[_0xf071('0x94')]=null;_0x26874c[_0xf071('0x8f')]=_0x51369a[_0xf071('0xb0')];this['channels'][_0x51369a['uniqueid']]=_0x26874c;this[_0xf071('0x46')](_0x26874c,_0xf071('0x20'));}else if(this[_0xf071('0x6c')](_0x51369a['variable'])&&this[_0xf071('0x6c')](_0x51369a[_0xf071('0xaf')]['queueposition'])){if(!_0x26874c[_0xf071('0x88')]){_0x26874c[_0xf071('0xa0')]=!![];_0x26874c['queuecallerexitAt']=moment()[_0xf071('0x4c')](_0xf071('0x7a'));_0x26874c[_0xf071('0x8f')]=_0xf071('0xb8');_0x26874c[_0xf071('0xb9')]=moment()['format'](_0xf071('0x7a'));this[_0xf071('0x10')][_0x51369a[_0xf071('0x50')]]=_0x26874c;}}logger['info'](_0xf071('0xba'),_0x51369a[_0xf071('0x50')],_0x26874c[_0xf071('0x4d')],_0x26874c['type'],_[_0xf071('0x7f')](_0x51369a[_0xf071('0xaf')])[0x0],_0x51369a['value']);_0x26874c[_0xf071('0x42')]=this['variables'][_0x51369a[_0xf071('0x50')]];}}}}catch(_0x10073f){logger[_0xf071('0x3e')](_0xf071('0xad'),_0x51369a[_0xf071('0x50')],util['inspect'](_0x10073f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf071('0xc')][_0xf071('0xae')]=function(_0x377d9b,_0x467638,_0x18e4cc){var _0x1c9be0=[_0xf071('0xbb'),_0xf071('0xbc'),'rtpaudioqosjitter',_0xf071('0xbd'),_0xf071('0xbe'),_0xf071('0xbf'),_0xf071('0xc0'),_0xf071('0xc1'),_0xf071('0xc2'),_0xf071('0xc3'),_0xf071('0xc4'),'bridgepvtcallid',_0xf071('0xc5'),_0xf071('0xc6'),_0xf071('0xc7'),'memberlastcall',_0xf071('0x97'),_0xf071('0xc8'),_0xf071('0xc9')];if(!_[_0xf071('0x39')](_0x467638)&&!_[_0xf071('0xca')](_0x1c9be0,_0x467638)){if(_['isUndefined'](this['variables'][_0x377d9b])){this[_0xf071('0x42')][_0x377d9b]={};}this[_0xf071('0x42')][_0x377d9b][_0x467638]=_0x18e4cc;}};VoiceQueueReport[_0xf071('0xc')][_0xf071('0x22')]=function(_0x1f3349){try{if(this[_0xf071('0x6c')](_0x1f3349)){logger[_0xf071('0x49')](_0xf071('0xcb'),_0x1f3349[_0xf071('0x50')],util[_0xf071('0x40')](_0x1f3349,{'showHidden':![],'depth':null}));if(this[_0xf071('0x41')][_0x1f3349[_0xf071('0x50')]]){for(var _0x3dd106=0x0,_0x7456ba={};_0x3dd1060x0?_0x2b34d2:0x0;this[_0xb10f('0x14')][_0x2f94c3[_0xb10f('0x68')]]['talking']=this[_0xb10f('0x14')][_0x2f94c3['queue']]['talking']>_[_0xb10f('0x6d')](_0x2f94c3[_0xb10f('0x70')])?_[_0xb10f('0x6d')](_0x2f94c3[_0xb10f('0x70')]):this['voiceQueues'][_0x2f94c3['queue']][_0xb10f('0x2f')];this[_0xb10f('0x53')](this[_0xb10f('0x14')][_0x2f94c3[_0xb10f('0x68')]],_0xb10f('0x71'));}logger[_0xb10f('0x47')](_0xb10f('0x72'),util[_0xb10f('0x3d')](this['voiceQueues'][_0x2f94c3[_0xb10f('0x68')]],{'showHidden':![],'depth':null}));ami[_0xb10f('0x45')](_0xb10f('0x73'),this[_0xb10f('0x14')][_0x2f94c3['queue']]);}}}catch(_0x87b44c){logger[_0xb10f('0x3e')](_0xb10f('0x66'),util['inspect'](_0x87b44c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb10f('0x74')]=function(_0x2f8729){logger[_0xb10f('0x47')](_0xb10f('0x75'),util['inspect'](_0x2f8729,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0xb10f('0x76')]=function(_0x40318e){try{if(this[_0xb10f('0x67')](_0x40318e)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x40318e[_0xb10f('0x4f')],util['inspect'](_0x40318e,{'showHidden':![],'depth':null}));if(_[_0xb10f('0x63')](this[_0xb10f('0x10')][_0x40318e[_0xb10f('0x4f')]]))this[_0xb10f('0x10')][_0x40318e['uniqueid']]=[];if(_[_0xb10f('0x63')](this['channels'][_0x40318e[_0xb10f('0x4f')]]))this[_0xb10f('0x12')][_0x40318e[_0xb10f('0x4f')]]={};var _0xec0d12=new QueueReport();_0xec0d12[_0xb10f('0x50')]=_0x40318e['queue'];_0xec0d12[_0xb10f('0x54')]=this[_0xb10f('0x14')][_0xec0d12[_0xb10f('0x50')]]&&this[_0xb10f('0x14')][_0xec0d12['name']][_0xb10f('0x54')]?this['voiceQueues'][_0xec0d12[_0xb10f('0x50')]][_0xb10f('0x54')]||_0xb10f('0x55'):'inbound';_0xec0d12[_0xb10f('0x68')]=_0x40318e['queue'];_0xec0d12[_0xb10f('0x77')]=moment()['format'](_0xb10f('0x78'));_0xec0d12[_0xb10f('0x79')]=_0x40318e['position'];_0xec0d12['count']=_0x40318e[_0xb10f('0x7a')];_0xec0d12[_0xb10f('0x4f')]=_0x40318e['uniqueid'];_0xec0d12[_0xb10f('0x7b')]=this[_0xb10f('0x12')][_0x40318e['uniqueid']]['routealias'];logger[_0xb10f('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0xec0d12[_0xb10f('0x50')],_0xec0d12[_0xb10f('0x54')]);_[_0xb10f('0x7c')](_0xec0d12,_[_0xb10f('0x7d')](_0x40318e,_['keys'](_0xec0d12)));this[_0xb10f('0x10')][_0x40318e[_0xb10f('0x4f')]]['push'](_0xec0d12);this[_0xb10f('0x12')][_0x40318e[_0xb10f('0x4f')]]=_0xec0d12;this[_0xb10f('0x46')](_0xec0d12,'queuecallerjoin');}}catch(_0x279acd){logger[_0xb10f('0x3e')](_0xb10f('0x7e'),_0x40318e[_0xb10f('0x4f')],util[_0xb10f('0x3d')](_0x279acd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb10f('0x34')][_0xb10f('0x1b')]=function(_0x38ccc8){try{if(this[_0xb10f('0x67')](_0x38ccc8)){logger[_0xb10f('0x47')](_0xb10f('0x7f'),_0x38ccc8[_0xb10f('0x4f')],util[_0xb10f('0x3d')](_0x38ccc8,{'showHidden':![],'depth':null}));if(this[_0xb10f('0x10')][_0x38ccc8[_0xb10f('0x4f')]]){var _0x40f349=_[_0xb10f('0x80')](this[_0xb10f('0x10')][_0x38ccc8['uniqueid']]);_0x40f349['queuecallercomplete']=![];_0x40f349[_0xb10f('0x81')]=null;_0x40f349['holdtime']=_0x38ccc8[_0xb10f('0x82')];_0x40f349['originalposition']=_0x38ccc8[_0xb10f('0x83')];_0x40f349[_0xb10f('0x84')]=!![];_0x40f349[_0xb10f('0x85')]=moment()[_0xb10f('0x49')](_0xb10f('0x78'));_0x40f349[_0xb10f('0x86')]=_0xb10f('0x87');_0x40f349['lastAssignedTo']=null;logger['info'](_0xb10f('0x88'),_0x40f349[_0xb10f('0x50')],_0x40f349['type']);this[_0xb10f('0x12')][_0x38ccc8['uniqueid']]=_0x40f349;this[_0xb10f('0x43')](_0x40f349,'queuecallerabandon');}}}catch(_0x136ef7){logger[_0xb10f('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x38ccc8[_0xb10f('0x4f')],util[_0xb10f('0x3d')](_0x136ef7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb10f('0x34')]['syncQueueCallerLeave']=function(_0x3b1362){try{if(this[_0xb10f('0x67')](_0x3b1362)){logger['debug'](_0xb10f('0x89'),_0x3b1362[_0xb10f('0x4f')],util[_0xb10f('0x3d')](_0x3b1362,{'showHidden':![],'depth':null}));if(this[_0xb10f('0x10')][_0x3b1362['uniqueid']]){var _0x2b12ce=_['last'](this[_0xb10f('0x10')][_0x3b1362[_0xb10f('0x4f')]]);_0x2b12ce[_0xb10f('0x8a')]=moment()[_0xb10f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b12ce[_0xb10f('0x8b')]=_0x3b1362[_0xb10f('0x8b')];_0x2b12ce['connectedlinename']=_0x3b1362['connectedlinename'];logger[_0xb10f('0x6a')](_0xb10f('0x8c'),_0x2b12ce[_0xb10f('0x50')],_0x2b12ce[_0xb10f('0x54')],_0x3b1362[_0xb10f('0x8b')],_0x3b1362[_0xb10f('0x8d')]);this[_0xb10f('0x12')][_0x3b1362[_0xb10f('0x4f')]]=_0x2b12ce;this[_0xb10f('0x46')](_0x2b12ce,_0xb10f('0x1c'));}}}catch(_0x532fbd){logger[_0xb10f('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x3b1362[_0xb10f('0x4f')],util[_0xb10f('0x3d')](_0x532fbd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb10f('0x34')][_0xb10f('0x20')]=function(_0x4ea91c){try{if(this['isNotNull'](_0x4ea91c)){logger[_0xb10f('0x47')]('[%s][voiceQueueReport][agentconnect]',_0x4ea91c[_0xb10f('0x4f')],util[_0xb10f('0x3d')](_0x4ea91c,{'showHidden':![],'depth':null}));if(this[_0xb10f('0x10')][_0x4ea91c[_0xb10f('0x4f')]]){var _0x5a2cb6=_[_0xb10f('0x80')](this[_0xb10f('0x10')][_0x4ea91c[_0xb10f('0x4f')]]);_0x5a2cb6[_0xb10f('0x8e')]=!![];_0x5a2cb6[_0xb10f('0x86')]=_0xb10f('0x8f');logger[_0xb10f('0x6a')](_0xb10f('0x90'),_0x5a2cb6['name'],_0x5a2cb6[_0xb10f('0x54')]);}}}catch(_0x160fb9){logger[_0xb10f('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x4ea91c[_0xb10f('0x4f')],util[_0xb10f('0x3d')](_0x160fb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb10f('0x34')][_0xb10f('0x91')]=function(_0x2be9ae){try{if(this[_0xb10f('0x67')](_0x2be9ae)){logger[_0xb10f('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x2be9ae['uniqueid'],util[_0xb10f('0x3d')](_0x2be9ae,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2be9ae[_0xb10f('0x4f')]]){var _0x373cae=_[_0xb10f('0x80')](this[_0xb10f('0x10')][_0x2be9ae[_0xb10f('0x4f')]]);_0x373cae[_0xb10f('0x84')]=![];_0x373cae[_0xb10f('0x85')]=null;_0x373cae['assigned']=!![];_0x373cae[_0xb10f('0x92')]=_0x2be9ae[_0xb10f('0x93')];_0x373cae[_0xb10f('0x82')]=_0x2be9ae[_0xb10f('0x82')];_0x373cae['queuecallercomplete']=!![];_0x373cae[_0xb10f('0x94')]=![];_0x373cae[_0xb10f('0x95')]=null;if(!_0x373cae['transfer']){if(_0x2be9ae['reason']==_0xb10f('0x96')){_0x373cae[_0xb10f('0x86')]=_0xb10f('0x97');logger[_0xb10f('0x6a')](_0xb10f('0x98'),_0x373cae[_0xb10f('0x50')],_0x373cae['type']);}else{if(_['startsWith'](_0x2be9ae['channel']['toLowerCase'](),_0xb10f('0x99'))){if(this[_0xb10f('0x10')][_0x2be9ae[_0xb10f('0x9a')]]){var _0x3f954c=_[_0xb10f('0x80')](this[_0xb10f('0x10')][_0x2be9ae['linkedid']]);_0x3f954c['queuecallercomplete']=![];_0x3f954c[_0xb10f('0x94')]=!![];_0x3f954c[_0xb10f('0x95')]=moment(_0x373cae[_0xb10f('0x77')])[_0xb10f('0x9b')](_0x2be9ae[_0xb10f('0x82')],'seconds')[_0xb10f('0x49')](_0xb10f('0x78'));_0x3f954c['queuecallerexitreason']=_0xb10f('0x9c');_0x3f954c['transfer']=!![];_0x3f954c[_0xb10f('0x9d')]=_0xb10f('0x9e');_0x3f954c[_0xb10f('0x9f')]=_0x2be9ae['destexten'];_0x3f954c[_0xb10f('0xa0')]=_0x2be9ae[_0xb10f('0x4f')];logger[_0xb10f('0x6a')](_0xb10f('0xa1'),_0x3f954c[_0xb10f('0x50')],_0x3f954c[_0xb10f('0x54')]);var _0x1de913=this[_0xb10f('0x10')][_0x2be9ae[_0xb10f('0x9a')]];this['queueReports'][_0x2be9ae[_0xb10f('0x9a')]]=this[_0xb10f('0x10')][_0x2be9ae[_0xb10f('0x4f')]];this['queueReports'][_0x2be9ae['uniqueid']]=_0x1de913;}}else{_0x373cae[_0xb10f('0x86')]='COMPLETEDBY'+_0x2be9ae[_0xb10f('0xa2')][_0xb10f('0xa3')]();logger[_0xb10f('0x6a')](_0xb10f('0xa4'),_0x373cae[_0xb10f('0x50')],_0x373cae[_0xb10f('0x54')],_0x373cae[_0xb10f('0x86')]);}}}this[_0xb10f('0x12')][_0x2be9ae[_0xb10f('0x4f')]]=_0x373cae;this[_0xb10f('0x43')](_0x373cae,_0xb10f('0x1e'));}}}catch(_0x522c16){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x2be9ae[_0xb10f('0x4f')],util['inspect'](_0x522c16,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb10f('0x34')][_0xb10f('0x22')]=function(_0x2d16d3){try{if(this[_0xb10f('0x67')](_0x2d16d3)){logger[_0xb10f('0x47')]('[%s][voiceQueueReport][varset]',_0x2d16d3[_0xb10f('0x4f')],util['inspect'](_0x2d16d3,{'showHidden':![],'depth':null}));this['addVariable'](_0x2d16d3[_0xb10f('0x4f')],_['keys'](_0x2d16d3[_0xb10f('0xa5')])[0x0],_0x2d16d3[_0xb10f('0xa6')]);if(this['queueReports'][_0x2d16d3[_0xb10f('0x4f')]]){var _0x3bdeaf=_[_0xb10f('0x80')](this[_0xb10f('0x10')][_0x2d16d3[_0xb10f('0x4f')]]);if(_0x3bdeaf){if(this[_0xb10f('0x67')](_0x2d16d3[_0xb10f('0xa5')])&&this[_0xb10f('0x67')](_0x2d16d3[_0xb10f('0xa5')][_0xb10f('0xa7')])){switch(_0x2d16d3[_0xb10f('0xa6')]){case'CONTINUE':_0x3bdeaf[_0xb10f('0x94')]=![];_0x3bdeaf['queuecallerexitAt']=null;break;case _0xb10f('0xa8'):_0x3bdeaf['lastevent']=_0xb10f('0xa9');_0x3bdeaf['queuecallerexit']=!![];_0x3bdeaf[_0xb10f('0x95')]=moment()[_0xb10f('0x49')](_0xb10f('0x78'));_0x3bdeaf['queuecallerleaveAt']=moment()[_0xb10f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xb10f('0x47')](_0xb10f('0xaa'),_0x2d16d3['uniqueid'],util[_0xb10f('0x3d')](_0x3bdeaf,{'showHidden':![],'depth':null}));ami['emit'](_0xb10f('0xab'),_0x3bdeaf);break;default:_0x3bdeaf[_0xb10f('0x94')]=!![];_0x3bdeaf[_0xb10f('0x95')]=moment()['format'](_0xb10f('0x78'));_0x3bdeaf[_0xb10f('0x8a')]=moment()[_0xb10f('0x49')](_0xb10f('0x78'));}_0x3bdeaf['queuecallerabandon']=![];_0x3bdeaf['queuecallerabandonAt']=null;_0x3bdeaf[_0xb10f('0x86')]=_0x2d16d3[_0xb10f('0xa6')];this[_0xb10f('0x12')][_0x2d16d3['uniqueid']]=_0x3bdeaf;this[_0xb10f('0x43')](_0x3bdeaf,_0xb10f('0x21'));}else if(this[_0xb10f('0x67')](_0x2d16d3[_0xb10f('0xa5')])&&this['isNotNull'](_0x2d16d3[_0xb10f('0xa5')]['queueposition'])){if(!_0x3bdeaf['queuecallerabandon']){_0x3bdeaf[_0xb10f('0x94')]=!![];_0x3bdeaf[_0xb10f('0x95')]=moment()[_0xb10f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bdeaf['queuecallerexitreason']=_0xb10f('0xac');_0x3bdeaf[_0xb10f('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb10f('0x12')][_0x2d16d3[_0xb10f('0x4f')]]=_0x3bdeaf;}}logger[_0xb10f('0x6a')](_0xb10f('0xad'),_0x2d16d3[_0xb10f('0x4f')],_0x3bdeaf[_0xb10f('0x50')],_0x3bdeaf[_0xb10f('0x54')],_['keys'](_0x2d16d3['variable'])[0x0],_0x2d16d3[_0xb10f('0xa6')]);_0x3bdeaf[_0xb10f('0x3f')]=this[_0xb10f('0x3f')][_0x2d16d3['uniqueid']];}}}}catch(_0x29e352){logger[_0xb10f('0x3e')]('[%s][voiceQueueReport][varset]',_0x2d16d3[_0xb10f('0x4f')],util['inspect'](_0x29e352,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb10f('0x34')][_0xb10f('0xae')]=function(_0x154670,_0x73056d,_0x1f09e1){var _0xa737f6=[_0xb10f('0xaf'),_0xb10f('0xb0'),'rtpaudioqosjitter',_0xb10f('0xb1'),'rtpaudioqosloss',_0xb10f('0xb2'),_0xb10f('0xb3'),'rtpaudioqosrttbridged',_0xb10f('0xb4'),_0xb10f('0xb5'),_0xb10f('0xb6'),'bridgepvtcallid',_0xb10f('0xb7'),_0xb10f('0xb8'),_0xb10f('0xb9'),'memberlastcall','membername',_0xb10f('0xba'),_0xb10f('0xbb')];if(!_[_0xb10f('0xbc')](_0x73056d)&&!_[_0xb10f('0xbd')](_0xa737f6,_0x73056d)){if(_[_0xb10f('0x63')](this[_0xb10f('0x3f')][_0x154670])){this[_0xb10f('0x3f')][_0x154670]={};}this[_0xb10f('0x3f')][_0x154670][_0x73056d]=_0x1f09e1;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x27dbdc){try{if(this[_0xb10f('0x67')](_0x27dbdc)){logger[_0xb10f('0x47')](_0xb10f('0xbe'),_0x27dbdc[_0xb10f('0x4f')],util['inspect'](_0x27dbdc,{'showHidden':![],'depth':null}));if(this[_0xb10f('0x10')][_0x27dbdc[_0xb10f('0x4f')]]){for(var _0x219180=0x0,_0x16ef78={};_0x219180=0x0?moment(_0x53c07c['endtime'])[_0x5d3a('0xf')](_0x53c07c[_0x5d3a('0x16')],_0x5d3a('0x10')):null,'data1':'outbound','data2':_0x53c07c[_0x5d3a('0x18')],'data3':_0x53c07c[_0x5d3a('0x11')],'data4':_0x53c07c['dialstring']||null,'role':_0x5d3a('0x19'),'internal':_0x53c07c['accountcode']?_['toNumber'](_0x53c07c[_0x5d3a('0x18')]):undefined,'uniqueid':_0x53c07c[_0x5d3a('0x13')]},'log':_0x5d3a('0x7')});}; \ No newline at end of file +var _0x7f4b=['queuecallerexitAt','voice','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','agent','accountcode','toNumber','uniqueid','CreateMemberReport','starttime','endtime','outbound','exten','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt'];(function(_0x1ccb5d,_0x341da9){var _0x1fe071=function(_0x12433e){while(--_0x12433e){_0x1ccb5d['push'](_0x1ccb5d['shift']());}};_0x1fe071(++_0x341da9);}(_0x7f4b,0xee));var _0xb7f4=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0x7f4b[_0x1e03e4];return _0x4a887e;};'use strict';var moment=require(_0xb7f4('0x0'));var _=require(_0xb7f4('0x1'));var util=require(_0xb7f4('0x2'));var client=require('../client');exports[_0xb7f4('0x3')]=function(_0x2d4b2d){var _0x3c14f8=_0x2d4b2d[_0xb7f4('0x4')]||_0x2d4b2d[_0xb7f4('0x5')];return client['Request']('CreateMemberReport',{'body':{'channel':_0xb7f4('0x6'),'membername':_0x2d4b2d[_0xb7f4('0x7')],'interface':_['isNil'](_0x2d4b2d[_0xb7f4('0x8')])?util[_0xb7f4('0x9')](_0xb7f4('0xa'),_0x2d4b2d['lastAssignedTo']):_0x2d4b2d['interface'],'type':_0xb7f4('0xb'),'enterAt':_0x2d4b2d[_0xb7f4('0xc')],'exitAt':_0x3c14f8,'duration':moment(_0x3c14f8)[_0xb7f4('0xd')](_0x2d4b2d[_0xb7f4('0xc')],_0xb7f4('0xe')),'data1':_0xb7f4('0xf'),'data2':_0x2d4b2d[_0xb7f4('0x10')],'data3':_0x2d4b2d['exten'],'data4':null,'data5':_0x2d4b2d['queue'],'role':_0xb7f4('0x11'),'internal':_0x2d4b2d[_0xb7f4('0x12')]?_[_0xb7f4('0x13')](_0x2d4b2d[_0xb7f4('0x12')]):undefined,'uniqueid':_0x2d4b2d[_0xb7f4('0x14')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x3fc448){return client['Request'](_0xb7f4('0x15'),{'body':{'channel':'voice','membername':_0x3fc448['membername'],'interface':_0x3fc448[_0xb7f4('0x8')],'type':'TALKING','enterAt':_0x3fc448[_0xb7f4('0x16')],'exitAt':_0x3fc448[_0xb7f4('0x17')],'duration':moment(_0x3fc448['endtime'])[_0xb7f4('0xd')](_0x3fc448[_0xb7f4('0x16')],_0xb7f4('0xe'))>=0x0?moment(_0x3fc448['endtime'])[_0xb7f4('0xd')](_0x3fc448['starttime'],_0xb7f4('0xe')):null,'data1':_0xb7f4('0x18'),'data2':_0x3fc448[_0xb7f4('0x12')],'data3':_0x3fc448[_0xb7f4('0x19')],'data4':_0x3fc448[_0xb7f4('0x1a')]||null,'role':_0xb7f4('0x11'),'internal':_0x3fc448[_0xb7f4('0x12')]?_[_0xb7f4('0x13')](_0x3fc448[_0xb7f4('0x12')]):undefined,'uniqueid':_0x3fc448[_0xb7f4('0x14')]},'log':_0xb7f4('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index d7fc5ac..1b3ea71 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 _0xe852=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request'];(function(_0x2681bf,_0x3296d0){var _0x439af0=function(_0x48828b){while(--_0x48828b){_0x2681bf['push'](_0x2681bf['shift']());}};_0x439af0(++_0x3296d0);}(_0xe852,0x7f));var _0x2e85=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe852[_0xb0f7c3];return _0x28ea68;};'use strict';var client=require(_0x2e85('0x0'));exports[_0x2e85('0x1')]=function(){return client[_0x2e85('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2e85('0x3')]},'log':_0x2e85('0x4')});}; \ No newline at end of file +var _0x95c5=['getSettings','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x5334c0,_0x5e4f5a){var _0x34afeb=function(_0x289df3){while(--_0x289df3){_0x5334c0['push'](_0x5334c0['shift']());}};_0x34afeb(++_0x5e4f5a);}(_0x95c5,0x153));var _0x595c=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x95c5[_0x2d8d69];return _0x39ae22;};'use strict';var client=require(_0x595c('0x0'));exports[_0x595c('0x1')]=function(){return client['Request'](_0x595c('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x595c('0x3')]},'log':_0x595c('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index e5fda3e..7e8e134 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 _0x9124=['name','../client','getTemplates','Request','GetTemplate'];(function(_0x5249be,_0x251784){var _0x19ba8e=function(_0x253547){while(--_0x253547){_0x5249be['push'](_0x5249be['shift']());}};_0x19ba8e(++_0x251784);}(_0x9124,0x83));var _0x4912=function(_0x7cde0,_0x39d63d){_0x7cde0=_0x7cde0-0x0;var _0x107188=_0x9124[_0x7cde0];return _0x107188;};'use strict';var client=require(_0x4912('0x0'));exports[_0x4912('0x1')]=function(_0x514d7f){return function(_0x2cfec0){return client[_0x4912('0x2')](_0x4912('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4912('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x76e0=['name','html','Request'];(function(_0x56e84b,_0x2e0f17){var _0x5c8c2e=function(_0x43fd67){while(--_0x43fd67){_0x56e84b['push'](_0x56e84b['shift']());}};_0x5c8c2e(++_0x2e0f17);}(_0x76e0,0x6e));var _0x076e=function(_0x86f7c5,_0x58572b){_0x86f7c5=_0x86f7c5-0x0;var _0x408d31=_0x76e0[_0x86f7c5];return _0x408d31;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4da032){return function(_0x5d1fb0){return client[_0x076e('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x076e('0x1'),_0x076e('0x2')]},'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 2798cf0..1f1bbfb 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 _0x295e=['data5','getTriggers','Request','GetTrigger','channel','status','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data4'];(function(_0x3acef9,_0x65d155){var _0x4bb694=function(_0x3fe5c2){while(--_0x3fe5c2){_0x3acef9['push'](_0x3acef9['shift']());}};_0x4bb694(++_0x65d155);}(_0x295e,0xcd));var _0xe295=function(_0x2333b4,_0x3b1fe1){_0x2333b4=_0x2333b4-0x0;var _0x4b3a0c=_0x295e[_0x2333b4];return _0x4b3a0c;};'use strict';var client=require('../client');exports[_0xe295('0x0')]=function(_0x4c57a4){return function(_0x263353){return client[_0xe295('0x1')](_0xe295('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe295('0x3'),_0xe295('0x4')],'include':[{'model':'Condition','as':_0xe295('0x5'),'attributes':['id',_0xe295('0x6'),_0xe295('0x7'),_0xe295('0x8')]},{'model':'Condition','as':_0xe295('0x9'),'attributes':['id',_0xe295('0x6'),_0xe295('0x7'),'value']},{'model':_0xe295('0xa'),'as':_0xe295('0xb'),'attributes':['id',_0xe295('0xc'),_0xe295('0xd'),_0xe295('0xe'),'data3',_0xe295('0xf'),_0xe295('0x10'),'data6','data7']}]},'log':_0xe295('0x2')});};}; \ No newline at end of file +var _0xe79a=['value','Condition','AnyConditions','operator','Action','Actions','data1','data2','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','AllConditions','field'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe79a,0xf0));var _0xae79=function(_0x4665b8,_0x234a28){_0x4665b8=_0x4665b8-0x0;var _0x54ba4c=_0xe79a[_0x4665b8];return _0x54ba4c;};'use strict';var client=require(_0xae79('0x0'));exports[_0xae79('0x1')]=function(_0x1364e2){return function(_0x11fadd){return client['Request'](_0xae79('0x2'),{'options':{'raw':![],'attributes':['id',_0xae79('0x3'),_0xae79('0x4'),'status'],'include':[{'model':'Condition','as':_0xae79('0x5'),'attributes':['id',_0xae79('0x6'),'operator',_0xae79('0x7')]},{'model':_0xae79('0x8'),'as':_0xae79('0x9'),'attributes':['id',_0xae79('0x6'),_0xae79('0xa'),_0xae79('0x7')]},{'model':_0xae79('0xb'),'as':_0xae79('0xc'),'attributes':['id','action',_0xae79('0xd'),_0xae79('0xe'),'data3',_0xae79('0xf'),_0xae79('0x10'),_0xae79('0x11'),_0xae79('0x12')]}]},'log':_0xae79('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 746019a..c9457a5 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 _0x097c=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x1e8116,_0x17db3a){var _0x474bea=function(_0x52323e){while(--_0x52323e){_0x1e8116['push'](_0x1e8116['shift']());}};_0x474bea(++_0x17db3a);}(_0x097c,0x1d5));var _0xc097=function(_0x3f6ec0,_0x58eef5){_0x3f6ec0=_0x3f6ec0-0x0;var _0x17edd7=_0x097c[_0x3f6ec0];return _0x17edd7;};'use strict';var client=require(_0xc097('0x0'));exports[_0xc097('0x1')]=function(_0x334a7c){return function(_0x4b26f6){return client[_0xc097('0x2')](_0xc097('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc097('0x4'),_0xc097('0x5'),'defaultuser']},'log':_0xc097('0x3')});};}; \ No newline at end of file +var _0x3eca=['GetTrunk','name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x2be1ab,_0x2fe1fc){var _0x4c616d=function(_0x16dfc8){while(--_0x16dfc8){_0x2be1ab['push'](_0x2be1ab['shift']());}};_0x4c616d(++_0x2fe1fc);}(_0x3eca,0x17e));var _0xa3ec=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x3eca[_0x466af7];return _0x348c96;};'use strict';var client=require(_0xa3ec('0x0'));exports[_0xa3ec('0x1')]=function(_0x4bba15){return function(_0x36992b){return client[_0xa3ec('0x2')](_0xa3ec('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa3ec('0x4'),_0xa3ec('0x5'),_0xa3ec('0x6')]},'log':_0xa3ec('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cd2683b..745af74 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x276b27,_0xfa9c97){var _0x5414dc=function(_0x2f9308){while(--_0x2f9308){_0x276b27['push'](_0x276b27['shift']());}};_0x5414dc(++_0xfa9c97);}(_0x70e0,0x17b));var _0x070e=function(_0x3bc20c,_0x39b383){_0x3bc20c=_0x3bc20c-0x0;var _0x1547d7=_0x70e0[_0x3bc20c];return _0x1547d7;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x3a6a1d,_0x16dbf3){var _0x569e48=function(_0x27aad7){while(--_0x27aad7){_0x3a6a1d['push'](_0x3a6a1d['shift']());}};_0x569e48(++_0x16dbf3);}(_0x70e0,0x17b));var _0x070e=function(_0x3dc7a7,_0x3e0055){_0x3dc7a7=_0x3dc7a7-0x0;var _0x28c51c=_0x70e0[_0x3dc7a7];return _0x28c51c;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 2e9f35f..0bf49d0 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 _0xc8bc=['UpdateVoiceAgentReport','create','CreateVoiceAgentReport','update','Request'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0xc8bc,0x17d));var _0xcc8b=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xc8bc[_0x32b993];return _0x482780;};'use strict';var client=require('../client');exports[_0xcc8b('0x0')]=function(_0x5f4731){return client['Request'](_0xcc8b('0x1'),{'body':_0x5f4731,'log':_0xcc8b('0x1')});};exports[_0xcc8b('0x2')]=function(_0x2e39e8,_0x234504,_0x2d41c2){return client[_0xcc8b('0x3')]('UpdateVoiceAgentReport',{'body':_0x2e39e8,'options':{'where':{'uniqueid':_0x234504,'interface':_0x2d41c2,'agentcomplete':!![]}},'log':_0xcc8b('0x4')});}; \ No newline at end of file +var _0xda1d=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0xc7ed29,_0x515330){var _0xf8da19=function(_0x1bd99c){while(--_0x1bd99c){_0xc7ed29['push'](_0xc7ed29['shift']());}};_0xf8da19(++_0x515330);}(_0xda1d,0x139));var _0xdda1=function(_0x1927d7,_0x4a9be6){_0x1927d7=_0x1927d7-0x0;var _0x2a73f5=_0xda1d[_0x1927d7];return _0x2a73f5;};'use strict';var client=require(_0xdda1('0x0'));exports[_0xdda1('0x1')]=function(_0x12b373){return client['Request'](_0xdda1('0x2'),{'body':_0x12b373,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x41e46e,_0x2c196c,_0x131f99){return client['Request'](_0xdda1('0x3'),{'body':_0x41e46e,'options':{'where':{'uniqueid':_0x2c196c,'interface':_0x131f99,'agentcomplete':!![]}},'log':_0xdda1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index ed1d0fb..ca72b39 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 _0x943d=['CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x5d2c1f,_0x39d33a){var _0x4f0c92=function(_0x409285){while(--_0x409285){_0x5d2c1f['push'](_0x5d2c1f['shift']());}};_0x4f0c92(++_0x39d33a);}(_0x943d,0xed));var _0xd943=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x943d[_0x256b72];return _0x2183e3;};'use strict';var moment=require(_0xd943('0x0'));var util=require(_0xd943('0x1'));var _=require(_0xd943('0x2'));var client=require(_0xd943('0x3'));exports[_0xd943('0x4')]=function(_0x5409c2){return client['Request'](_0xd943('0x5'),{'body':_[_0xd943('0x6')](_0x5409c2,{'source':_0x5409c2[_0xd943('0x7')],'destinationcontext':_0x5409c2[_0xd943('0x8')],'callerid':_0x5409c2['callerid'],'amaflags':_0xd943('0x9')}),'log':_0xd943('0x5')});};exports[_0xd943('0xa')]=function(){return function(){return client[_0xd943('0xb')](_0xd943('0xc'),{'options':{'where':{'type':[_0xd943('0xd')],'createdAt':{'$between':[moment()[_0xd943('0xe')](_0xd943('0xf'))[_0xd943('0x10')](_0xd943('0x11')),moment()['endOf'](_0xd943('0xf'))[_0xd943('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xd943('0x12'),'disposition',_0xd943('0x13'),_0xd943('0x14')]},'log':_0xd943('0x15')});};}; \ No newline at end of file +var _0xc283=['getVoiceCallReports','Request','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','util','lodash','create','merge','callerid','DOCUMENTATION','CreateVoiceCallReport'];(function(_0x36cd6f,_0x4b14b9){var _0x5502cd=function(_0x507d9f){while(--_0x507d9f){_0x36cd6f['push'](_0x36cd6f['shift']());}};_0x5502cd(++_0x4b14b9);}(_0xc283,0xc5));var _0x3c28=function(_0x2b0937,_0x381053){_0x2b0937=_0x2b0937-0x0;var _0x5e3586=_0xc283[_0x2b0937];return _0x5e3586;};'use strict';var moment=require('moment');var util=require(_0x3c28('0x0'));var _=require(_0x3c28('0x1'));var client=require('../client');exports[_0x3c28('0x2')]=function(_0x385c0e){return client['Request']('CreateVoiceCallReport',{'body':_[_0x3c28('0x3')](_0x385c0e,{'source':_0x385c0e['calleridnum'],'destinationcontext':_0x385c0e['context'],'callerid':_0x385c0e[_0x3c28('0x4')],'amaflags':_0x3c28('0x5')}),'log':_0x3c28('0x6')});};exports[_0x3c28('0x7')]=function(){return function(){return client[_0x3c28('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x3c28('0x9'))[_0x3c28('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3c28('0xb')](_0x3c28('0x9'))[_0x3c28('0xa')](_0x3c28('0xc'))]}},'attributes':[_0x3c28('0xd'),_0x3c28('0xe'),_0x3c28('0xf'),_0x3c28('0x10')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e157717..e852178 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 _0x2bff=['create','Request','CreateVoiceDialReport'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x2bff,0x153));var _0xf2bf=function(_0x527b89,_0x189f06){_0x527b89=_0x527b89-0x0;var _0x1bf092=_0x2bff[_0x527b89];return _0x1bf092;};'use strict';var client=require('../client');exports[_0xf2bf('0x0')]=function(_0x155bd4){return client[_0xf2bf('0x1')](_0xf2bf('0x2'),{'body':_0x155bd4,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xf6cb=['create','Request','CreateVoiceDialReport'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xf6cb,0x19b));var _0xbf6c=function(_0x2bb38d,_0xc6a194){_0x2bb38d=_0x2bb38d-0x0;var _0x36472e=_0xf6cb[_0x2bb38d];return _0x36472e;};'use strict';var client=require('../client');exports[_0xbf6c('0x0')]=function(_0x2f448d){return client[_0xbf6c('0x1')](_0xbf6c('0x2'),{'body':_0x2f448d,'log':_0xbf6c('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c7ed545..ad72671 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 _0x3715=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x5a5f1d,_0x3359d8){var _0x597cf4=function(_0x5456d2){while(--_0x5456d2){_0x5a5f1d['push'](_0x5a5f1d['shift']());}};_0x597cf4(++_0x3359d8);}(_0x3715,0xc3));var _0x5371=function(_0x157718,_0x3bf585){_0x157718=_0x157718-0x0;var _0x5a8fd7=_0x3715[_0x157718];return _0x5a8fd7;};'use strict';var client=require(_0x5371('0x0'));exports[_0x5371('0x1')]=function(){return function(){return client[_0x5371('0x2')](_0x5371('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5371('0x4'),_0x5371('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x5371('0x1')});};}; \ No newline at end of file +var _0x9434=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x2e2b37,_0x279d8e){var _0xf6682a=function(_0x392280){while(--_0x392280){_0x2e2b37['push'](_0x2e2b37['shift']());}};_0xf6682a(++_0x279d8e);}(_0x9434,0x168));var _0x4943=function(_0x30b5b6,_0x2371fe){_0x30b5b6=_0x30b5b6-0x0;var _0x120952=_0x9434[_0x30b5b6];return _0x120952;};'use strict';var client=require(_0x4943('0x0'));exports[_0x4943('0x1')]=function(){return function(){return client[_0x4943('0x2')](_0x4943('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4943('0x4'),_0x4943('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2536067..c158384 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 _0xbe2c=['../client','getVoiceQueues','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals'];(function(_0x4adbba,_0x9b2fcf){var _0x5e75d5=function(_0x28a23c){while(--_0x28a23c){_0x4adbba['push'](_0x4adbba['shift']());}};_0x5e75d5(++_0x9b2fcf);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x9d81e7,_0x8d790b){_0x9d81e7=_0x9d81e7-0x0;var _0xbb1f25=_0xbe2c[_0x9d81e7];return _0xbb1f25;};'use strict';var client=require(_0xcbe2('0x0'));exports[_0xcbe2('0x1')]=function(){return function(){return client['Request'](_0xcbe2('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xcbe2('0x3'),_0xcbe2('0x4'),_0xcbe2('0x5'),_0xcbe2('0x6'),_0xcbe2('0x7'),'dialActive',_0xcbe2('0x8'),_0xcbe2('0x9'),'dialLimitQueue',_0xcbe2('0xa'),_0xcbe2('0xb'),_0xcbe2('0xc'),_0xcbe2('0xd'),_0xcbe2('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xcbe2('0xf'),_0xcbe2('0x10'),_0xcbe2('0x11'),_0xcbe2('0x12'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0xcbe2('0x13'),_0xcbe2('0x14'),_0xcbe2('0x15'),_0xcbe2('0x16'),_0xcbe2('0x17'),_0xcbe2('0x18'),'dialPrefix',_0xcbe2('0x19'),_0xcbe2('0x1a'),'dialAMDInitialSilence',_0xcbe2('0x1b'),'dialAMDAfterGreetingSilence',_0xcbe2('0x1c'),'dialAMDMinWordLength',_0xcbe2('0x1d'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xcbe2('0x1e'),'timeout',_0xcbe2('0x1f'),_0xcbe2('0x20'),_0xcbe2('0x21'),_0xcbe2('0x22'),_0xcbe2('0x23'),_0xcbe2('0x24'),_0xcbe2('0x6'),'strategy',_0xcbe2('0x25'),'dialCutDigit',_0xcbe2('0x26'),_0xcbe2('0x27'),_0xcbe2('0x28'),_0xcbe2('0x29'),'dialAbandonedMaxRetry',_0xcbe2('0x2a'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xcbe2('0x2b'),_0xcbe2('0x2c'),_0xcbe2('0x2d'),'dialPredictiveIntervalMaxThreshold',_0xcbe2('0x2e'),_0xcbe2('0x2f')],'include':[{'model':_0xcbe2('0x30'),'as':'Trunk','attributes':['id',_0xcbe2('0x31'),_0xcbe2('0x32'),_0xcbe2('0x33')]},{'model':_0xcbe2('0x34'),'as':_0xcbe2('0x35'),'attributes':['id',_0xcbe2('0x31')]},{'model':_0xcbe2('0x30'),'as':_0xcbe2('0x36'),'attributes':['id','name',_0xcbe2('0x32'),_0xcbe2('0x33')]},{'model':'Interval','as':_0xcbe2('0x37'),'attributes':['id',_0xcbe2('0x31')],'include':[{'model':_0xcbe2('0x37'),'as':_0xcbe2('0x38'),'attributes':['id',_0xcbe2('0x31'),'interval']}]}]},'log':_0xcbe2('0x1')});};}; \ No newline at end of file +var _0xdc03=['dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','Pause','mandatoryDispositionPause','Interval','Intervals','getVoiceQueues','../client','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage'];(function(_0x111e90,_0x246d1b){var _0x36ac16=function(_0x23c183){while(--_0x23c183){_0x111e90['push'](_0x111e90['shift']());}};_0x36ac16(++_0x246d1b);}(_0xdc03,0x65));var _0x3dc0=function(_0x515b56,_0x495e9f){_0x515b56=_0x515b56-0x0;var _0x20c18b=_0xdc03[_0x515b56];return _0x20c18b;};'use strict';var client=require(_0x3dc0('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x3dc0('0x1')](_0x3dc0('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3dc0('0x3'),_0x3dc0('0x4'),_0x3dc0('0x5'),_0x3dc0('0x6'),_0x3dc0('0x7'),_0x3dc0('0x8'),'dialMethod',_0x3dc0('0x9'),_0x3dc0('0xa'),_0x3dc0('0xb'),'dialPredictiveOptimization',_0x3dc0('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x3dc0('0xd'),_0x3dc0('0xe'),_0x3dc0('0xf'),_0x3dc0('0x10'),_0x3dc0('0x11'),_0x3dc0('0x12'),_0x3dc0('0x13'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x3dc0('0x14'),_0x3dc0('0x15'),_0x3dc0('0x16'),'dialGlobalInterval','dialPrefix',_0x3dc0('0x17'),'dialAMDActive',_0x3dc0('0x18'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x3dc0('0x19'),_0x3dc0('0x1a'),_0x3dc0('0x1b'),_0x3dc0('0x1c'),_0x3dc0('0x1d'),_0x3dc0('0x1e'),_0x3dc0('0x1f'),_0x3dc0('0x20'),'dialRecallInQueue',_0x3dc0('0x21'),_0x3dc0('0x22'),'dialAgiAfterHangupClient',_0x3dc0('0x23'),_0x3dc0('0x6'),_0x3dc0('0x24'),'dialRandomLastDigitCallerIdNumber',_0x3dc0('0x25'),_0x3dc0('0x26'),_0x3dc0('0x27'),'dialDropMaxRetry',_0x3dc0('0x28'),_0x3dc0('0x29'),_0x3dc0('0x2a'),_0x3dc0('0x2b'),_0x3dc0('0x2c'),_0x3dc0('0x2d'),_0x3dc0('0x2e'),_0x3dc0('0x2f'),_0x3dc0('0x30'),_0x3dc0('0x31'),'dialPreviewAutoRecallMe'],'include':[{'model':_0x3dc0('0x32'),'as':_0x3dc0('0x32'),'attributes':['id',_0x3dc0('0x33'),'callerid','active']},{'model':_0x3dc0('0x34'),'as':_0x3dc0('0x35'),'attributes':['id',_0x3dc0('0x33')]},{'model':_0x3dc0('0x32'),'as':'TrunkBackup','attributes':['id',_0x3dc0('0x33'),'callerid','active']},{'model':_0x3dc0('0x36'),'as':_0x3dc0('0x36'),'attributes':['id',_0x3dc0('0x33')],'include':[{'model':_0x3dc0('0x36'),'as':_0x3dc0('0x37'),'attributes':['id','name','interval']}]}]},'log':_0x3dc0('0x38')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1d1b611..1c17396 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(_0x28b76b,_0x1f16e3){var _0x271046=function(_0x4680e5){while(--_0x4680e5){_0x28b76b['push'](_0x28b76b['shift']());}};_0x271046(++_0x1f16e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x1e2f02,_0x2cb25a){var _0x41d120=function(_0x2f7640){while(--_0x2f7640){_0x1e2f02['push'](_0x1e2f02['shift']());}};_0x41d120(++_0x2cb25a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index ba13dd3..9f33b29 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 _0x9059=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x9059,0x1e4));var _0x9905=function(_0x5f5c08,_0x277610){_0x5f5c08=_0x5f5c08-0x0;var _0x104f76=_0x9059[_0x5f5c08];return _0x104f76;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x56fcb2){return function(){return client[_0x9905('0x0')](_0x9905('0x1'),{'options':{'where':{'VoiceQueueId':_0x56fcb2,'paused':!![]},'raw':!![]},'log':_0x9905('0x2')});};}; \ No newline at end of file +var _0x39ec=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x3ade08,_0x1c8d1c){var _0x2fd2f8=function(_0x52d6ea){while(--_0x52d6ea){_0x3ade08['push'](_0x3ade08['shift']());}};_0x2fd2f8(++_0x1c8d1c);}(_0x39ec,0x12d));var _0xc39e=function(_0x27dd89,_0x4143c8){_0x27dd89=_0x27dd89-0x0;var _0xe67f18=_0x39ec[_0x27dd89];return _0xe67f18;};'use strict';var client=require(_0xc39e('0x0'));exports[_0xc39e('0x1')]=function(_0x2b057b){return function(){return client[_0xc39e('0x2')](_0xc39e('0x3'),{'options':{'where':{'VoiceQueueId':_0x2b057b,'paused':!![]},'raw':!![]},'log':_0xc39e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fd3d32b..0b23b4a 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(_0x55e953,_0x4cd84e){var _0x1047cc=function(_0x1a4cf5){while(--_0x1a4cf5){_0x55e953['push'](_0x55e953['shift']());}};_0x1047cc(++_0x4cd84e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x106e24,_0x561db0){var _0x24ed9a=function(_0x9365e0){while(--_0x9365e0){_0x106e24['push'](_0x106e24['shift']());}};_0x24ed9a(++_0x561db0);}(_0x7a54,0x106));var _0x47a5=function(_0x173a9f,_0xcfe29c){_0x173a9f=_0x173a9f-0x0;var _0x2ac67b=_0x7a54[_0x173a9f];return _0x2ac67b;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 26cea77..95dff3a 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 _0x4d5c=['attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransferercontext','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind'];(function(_0x4f8698,_0x1315c9){var _0x20bbf0=function(_0x393b77){while(--_0x393b77){_0x4f8698['push'](_0x4f8698['shift']());}};_0x20bbf0(++_0x1315c9);}(_0x4d5c,0x183));var _0xc4d5=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x4d5c[_0x5c3c0b];return _0x52ecd2;};'use strict';var client=require(_0xc4d5('0x0'));exports[_0xc4d5('0x1')]={};exports['blindTransfer']=function(_0x502c9e){return client[_0xc4d5('0x2')](_0xc4d5('0x3'),{'body':{'result':_0x502c9e[_0xc4d5('0x4')],'transfererchannel':_0x502c9e['transfererchannel'],'transferercalleridnum':_0x502c9e[_0xc4d5('0x5')],'transferercalleridname':_0x502c9e[_0xc4d5('0x6')],'transfererconnectedlinenum':_0x502c9e[_0xc4d5('0x7')],'transfererconnectedlinename':_0x502c9e[_0xc4d5('0x8')],'transfereraccountcode':_0x502c9e[_0xc4d5('0x9')],'transferercontext':_0x502c9e['transferercontext'],'transfererexten':_0x502c9e[_0xc4d5('0xa')],'transfererlinkedid':_0x502c9e[_0xc4d5('0xb')],'transfereechannel':_0x502c9e[_0xc4d5('0xc')],'transfereecalleridnum':_0x502c9e['transfereecalleridnum'],'transfereecalleridname':_0x502c9e[_0xc4d5('0xd')],'transfereeconnectedlinenum':_0x502c9e[_0xc4d5('0xe')],'transfereeconnectedlinename':_0x502c9e[_0xc4d5('0xf')],'transfereeaccountcode':_0x502c9e[_0xc4d5('0x10')],'transfereecontext':_0x502c9e[_0xc4d5('0x11')],'transfereeexten':_0x502c9e[_0xc4d5('0x12')],'transfereelinkedid':_0x502c9e[_0xc4d5('0x13')],'isexternal':_0x502c9e['isexternal'],'context':_0x502c9e[_0xc4d5('0x14')],'extension':_0x502c9e[_0xc4d5('0x15')],'type':_0xc4d5('0x16')},'log':_0xc4d5('0x3')});};exports[_0xc4d5('0x17')]=function(_0x1db152){return client[_0xc4d5('0x2')](_0xc4d5('0x3'),{'body':{'result':_0x1db152[_0xc4d5('0x4')],'transfererchannel':_0x1db152[_0xc4d5('0x18')],'transferercalleridnum':_0x1db152[_0xc4d5('0x19')],'transferercalleridname':_0x1db152['origtransferercalleridname'],'transfererconnectedlinenum':_0x1db152[_0xc4d5('0x1a')],'transfererconnectedlinename':_0x1db152[_0xc4d5('0x1b')],'transfereraccountcode':_0x1db152[_0xc4d5('0x1c')],'transferercontext':_0x1db152['secondtransferercontext'],'transfererexten':_0x1db152[_0xc4d5('0x1d')],'transfererlinkedid':_0x1db152['origtransfererlinkedid'],'transfereechannel':_0x1db152[_0xc4d5('0x1e')],'transfereecalleridnum':_0x1db152[_0xc4d5('0x1f')],'transfereecalleridname':_0x1db152[_0xc4d5('0x20')],'transfereeconnectedlinenum':_0x1db152[_0xc4d5('0x21')],'transfereeconnectedlinename':_0x1db152[_0xc4d5('0x22')],'transfereeaccountcode':_0x1db152[_0xc4d5('0x23')],'transfereecontext':_0x1db152[_0xc4d5('0x24')],'transfereeexten':_0x1db152[_0xc4d5('0x25')],'transfereelinkedid':_0x1db152['transfertargetlinkedid'],'isexternal':_0x1db152[_0xc4d5('0x26')],'context':_0x1db152[_0xc4d5('0x27')],'extension':_0x1db152['origtransfererexten'],'type':_0xc4d5('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xf7b3=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridname'];(function(_0x9030df,_0x29c6e3){var _0x2e10bf=function(_0x47777a){while(--_0x47777a){_0x9030df['push'](_0x9030df['shift']());}};_0x2e10bf(++_0x29c6e3);}(_0xf7b3,0x10b));var _0x3f7b=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0xf7b3[_0x4704dc];return _0x254d81;};'use strict';var client=require(_0x3f7b('0x0'));exports[_0x3f7b('0x1')]={};exports[_0x3f7b('0x2')]=function(_0x156831){return client[_0x3f7b('0x3')](_0x3f7b('0x4'),{'body':{'result':_0x156831['result'],'transfererchannel':_0x156831[_0x3f7b('0x5')],'transferercalleridnum':_0x156831[_0x3f7b('0x6')],'transferercalleridname':_0x156831[_0x3f7b('0x7')],'transfererconnectedlinenum':_0x156831['transfererconnectedlinenum'],'transfererconnectedlinename':_0x156831[_0x3f7b('0x8')],'transfereraccountcode':_0x156831['transfereraccountcode'],'transferercontext':_0x156831[_0x3f7b('0x9')],'transfererexten':_0x156831[_0x3f7b('0xa')],'transfererlinkedid':_0x156831['transfererlinkedid'],'transfereechannel':_0x156831[_0x3f7b('0xb')],'transfereecalleridnum':_0x156831['transfereecalleridnum'],'transfereecalleridname':_0x156831[_0x3f7b('0xc')],'transfereeconnectedlinenum':_0x156831[_0x3f7b('0xd')],'transfereeconnectedlinename':_0x156831[_0x3f7b('0xe')],'transfereeaccountcode':_0x156831['transfereeaccountcode'],'transfereecontext':_0x156831['transfereecontext'],'transfereeexten':_0x156831[_0x3f7b('0xf')],'transfereelinkedid':_0x156831['transfereelinkedid'],'isexternal':_0x156831[_0x3f7b('0x10')],'context':_0x156831[_0x3f7b('0x11')],'extension':_0x156831[_0x3f7b('0x12')],'type':_0x3f7b('0x13')},'log':_0x3f7b('0x4')});};exports['attendedTransfer']=function(_0x2baadd){return client[_0x3f7b('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x2baadd['result'],'transfererchannel':_0x2baadd[_0x3f7b('0x14')],'transferercalleridnum':_0x2baadd[_0x3f7b('0x15')],'transferercalleridname':_0x2baadd[_0x3f7b('0x16')],'transfererconnectedlinenum':_0x2baadd[_0x3f7b('0x17')],'transfererconnectedlinename':_0x2baadd[_0x3f7b('0x18')],'transfereraccountcode':_0x2baadd['origtransfereraccountcode'],'transferercontext':_0x2baadd[_0x3f7b('0x19')],'transfererexten':_0x2baadd['secondtransfererexten'],'transfererlinkedid':_0x2baadd[_0x3f7b('0x1a')],'transfereechannel':_0x2baadd[_0x3f7b('0x1b')],'transfereecalleridnum':_0x2baadd['transfertargetcalleridnum'],'transfereecalleridname':_0x2baadd[_0x3f7b('0x1c')],'transfereeconnectedlinenum':_0x2baadd[_0x3f7b('0x1d')],'transfereeconnectedlinename':_0x2baadd[_0x3f7b('0x1e')],'transfereeaccountcode':_0x2baadd['transfertargetaccountcode'],'transfereecontext':_0x2baadd['transfertargetcontext'],'transfereeexten':_0x2baadd[_0x3f7b('0x1f')],'transfereelinkedid':_0x2baadd[_0x3f7b('0x20')],'isexternal':_0x2baadd[_0x3f7b('0x10')],'context':_0x2baadd[_0x3f7b('0x21')],'extension':_0x2baadd[_0x3f7b('0x22')],'type':'attended'},'log':_0x3f7b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index abc1e6a..1cfc08a 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 _0xc1c6=['module','action','Action','then','message','command','Command','content','catch','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','undefined','channels','validate','uniqueid','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','toLowerCase','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../properties','../ami','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick'];(function(_0x40aa31,_0x175b59){var _0x393c74=function(_0x119817){while(--_0x119817){_0x40aa31['push'](_0x40aa31['shift']());}};_0x393c74(++_0x175b59);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1c0461,_0x4d5a06){_0x1c0461=_0x1c0461-0x0;var _0x3a5631=_0xc1c6[_0x1c0461];return _0x3a5631;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var jayson=require(_0x6c1c('0x2'));var schema=require('validate');var BPromise=require(_0x6c1c('0x3'));var moment=require('moment');var config=require(_0x6c1c('0x4'));var properties=require(_0x6c1c('0x5'));var ami=require(_0x6c1c('0x6'));exports['listen']=function(_0x56ed6f,_0x32af84,_0x524a6b){return new BPromise(function(_0x50c1bb,_0x582bec){var _0xe510ca={'QueuePause':function(_0x2eb1ba){return new Promise(function(_0x38369d,_0x2cec58){var _0x4b66ec=util[_0x6c1c('0x7')](_0x6c1c('0x8'),'SIP',_0x2eb1ba[_0x6c1c('0x9')]);if(_0x56ed6f[_0x6c1c('0xa')]&&_0x56ed6f[_0x6c1c('0xa')][_0x4b66ec]&&_0x56ed6f[_0x6c1c('0xa')][_0x4b66ec]['timer']){_0x56ed6f[_0x6c1c('0xa')][_0x4b66ec][_0x6c1c('0xb')]();}if(_0x56ed6f[_0x6c1c('0xc')][_0x4b66ec]){_0x56ed6f['agents'][_0x4b66ec][_0x6c1c('0xd')]({'statePause':_0x2eb1ba[_0x6c1c('0xe')]?!![]:![]});}_0x38369d({'code':0xc8,'message':_0x6c1c('0xf')});});},'Reload':function(_0x49304f){var _0x2e82e9=this;return new Promise(function(_0x5e64b7,_0x357370){if(ami[_0x6c1c('0x10')]()==![]){return _0x357370(_0x2e82e9[_0x6c1c('0x11')](0x1f4,[config[_0x6c1c('0x12')]['ip'],config[_0x6c1c('0x12')][_0x6c1c('0x13')],_0x6c1c('0x14')][_0x6c1c('0x15')]('\x20')));}_0x49304f=_[_0x6c1c('0x16')](_0x49304f,_['keys'](properties[_0x6c1c('0x17')]));_0x49304f[_0x6c1c('0x18')]='Reload';return ami[_0x6c1c('0x19')](_0x49304f)[_0x6c1c('0x1a')](function(_0x494ffc){_0x5e64b7({'code':0xc8,'message':_0x494ffc[_0x6c1c('0x1b')]});})['catch'](function(_0x338dc2){_0x357370(_0x2e82e9[_0x6c1c('0x11')](0x1f5,_0x338dc2['message']));});});},'Command':function(_0xa667eb){var _0x59ab38=this;return new Promise(function(_0x2db60e,_0x3527bf){if(ami[_0x6c1c('0x10')]()==![]){return _0x3527bf(_0x59ab38[_0x6c1c('0x11')](0x1f4,[config[_0x6c1c('0x12')]['ip'],config[_0x6c1c('0x12')][_0x6c1c('0x13')],_0x6c1c('0x14')][_0x6c1c('0x15')]('\x20')));}_0xa667eb=_[_0x6c1c('0x16')](_0xa667eb,_0x6c1c('0x1c'));_0xa667eb[_0x6c1c('0x18')]=_0x6c1c('0x1d');return ami[_0x6c1c('0x19')](_0xa667eb)[_0x6c1c('0x1a')](function(_0x19c269){_0x2db60e({'code':0xc8,'message':_0x19c269[_0x6c1c('0x1e')]});})[_0x6c1c('0x1f')](function(_0x3a3f13){_0x3527bf(_0x59ab38[_0x6c1c('0x11')](0x1f5,_0x3a3f13[_0x6c1c('0x1b')]));});});},'VoiceQueues':function(_0x3f517e){return new Promise(function(_0x2ef382,_0x7ff10d){var _0x18452d=[];for(var _0x80bc05 in _0x56ed6f[_0x6c1c('0x20')]){if(_0x56ed6f[_0x6c1c('0x20')][_0x6c1c('0x21')](_0x80bc05)){var _0x5f4568=_0x56ed6f[_0x6c1c('0x20')][_0x80bc05];var _0x4d73aa={'id':_0x5f4568['id'],'name':_0x5f4568[_0x6c1c('0x9')],'strategy':_0x5f4568['strategy'],'answered':_0x5f4568[_0x6c1c('0x22')],'available':_0x5f4568['available'],'loggedIn':_0x5f4568[_0x6c1c('0x23')],'pTalking':_0x5f4568[_0x6c1c('0x24')],'sumBillable':_0x5f4568['sumBillable'],'sumDuration':_0x5f4568[_0x6c1c('0x25')],'sumHoldTime':_0x5f4568[_0x6c1c('0x26')]||0x0,'talking':_0x5f4568['talking'],'total':_0x5f4568[_0x6c1c('0x27')],'type':_0x5f4568[_0x6c1c('0x28')],'unmanaged':_0x5f4568[_0x6c1c('0x29')],'abandoned':_0x5f4568[_0x6c1c('0x2a')],'waiting':_0x5f4568['waiting'],'loggedInDb':_0x5f4568['loggedInDb']};if(_0x5f4568[_0x6c1c('0x28')]===_0x6c1c('0x2b')){_0x4d73aa[_0x6c1c('0x2c')]=_0x5f4568[_0x6c1c('0x2c')];_0x4d73aa[_0x6c1c('0x2d')]=_0x5f4568[_0x6c1c('0x2d')];_0x4d73aa['dialOriginateCallerIdName']=_0x5f4568[_0x6c1c('0x2e')];_0x4d73aa[_0x6c1c('0x2f')]=_0x5f4568['dialOriginateCallerIdNumber'];_0x4d73aa[_0x6c1c('0x30')]=_0x5f4568[_0x6c1c('0x30')];_0x4d73aa[_0x6c1c('0x31')]=_0x5f4568[_0x6c1c('0x31')];_0x4d73aa['temp']=_0x5f4568[_0x6c1c('0x32')];_0x4d73aa[_0x6c1c('0x33')]=_0x5f4568[_0x6c1c('0x33')];_0x4d73aa['outboundAnswerCallsDay']=_0x5f4568[_0x6c1c('0x34')];_0x4d73aa['outboundBlacklistCallsDay']=_0x5f4568[_0x6c1c('0x35')];_0x4d73aa['outboundBusyCallsDay']=_0x5f4568[_0x6c1c('0x36')];_0x4d73aa[_0x6c1c('0x37')]=_0x5f4568[_0x6c1c('0x37')];_0x4d73aa['outboundDropCallsDayACS']=_0x5f4568['outboundDropCallsDayACS'];_0x4d73aa[_0x6c1c('0x38')]=_0x5f4568[_0x6c1c('0x38')];_0x4d73aa[_0x6c1c('0x39')]=_0x5f4568['outboundDropCallsDayTimeout'];_0x4d73aa[_0x6c1c('0x3a')]=_0x5f4568['outboundNoAnswerCallsDay'];_0x4d73aa['outboundNoSuchCallsDay']=_0x5f4568[_0x6c1c('0x3b')];_0x4d73aa[_0x6c1c('0x3c')]=_0x5f4568[_0x6c1c('0x3c')];_0x4d73aa[_0x6c1c('0x3d')]=_0x5f4568['outboundReCallsDay'];_0x4d73aa[_0x6c1c('0x3e')]=_0x5f4568[_0x6c1c('0x3e')];_0x4d73aa[_0x6c1c('0x3f')]=_0x5f4568[_0x6c1c('0x3f')];_0x4d73aa[_0x6c1c('0x40')]=_0x5f4568[_0x6c1c('0x40')];_0x4d73aa[_0x6c1c('0x41')]=_0x5f4568[_0x6c1c('0x41')];_0x4d73aa[_0x6c1c('0x42')]=_0x5f4568[_0x6c1c('0x42')];_0x4d73aa['predictiveIntervalDroppedCallsCallersExit']=_0x5f4568[_0x6c1c('0x43')];_0x4d73aa[_0x6c1c('0x44')]=_0x5f4568[_0x6c1c('0x44')];_0x4d73aa[_0x6c1c('0x45')]=_0x5f4568[_0x6c1c('0x45')];_0x4d73aa['predictiveIntervalErlangCallsDroppedCalls']=_0x5f4568['predictiveIntervalErlangCallsDroppedCalls'];_0x4d73aa['predictiveIntervalHitRate']=_0x5f4568[_0x6c1c('0x46')];_0x4d73aa['predictiveIntervalMultiplicativeFactor']=_0x5f4568['predictiveIntervalMultiplicativeFactor'];_0x4d73aa[_0x6c1c('0x47')]=_0x5f4568[_0x6c1c('0x47')];_0x4d73aa['predictiveIntervalAvailable']=_0x5f4568[_0x6c1c('0x48')];_0x4d73aa[_0x6c1c('0x49')]=_0x5f4568[_0x6c1c('0x49')];_0x4d73aa['message']=_0x5f4568[_0x6c1c('0x1b')];_0x4d73aa[_0x6c1c('0x4a')]=_0x5f4568['originated'];_0x4d73aa[_0x6c1c('0x4b')]=_0x5f4568['erlangCalls'];_0x4d73aa[_0x6c1c('0x4c')]=_0x5f4568[_0x6c1c('0x4c')];_0x4d73aa[_0x6c1c('0x4d')]=_0x5f4568[_0x6c1c('0x4d')];_0x4d73aa[_0x6c1c('0x4e')]=_0x5f4568['erlangBusyFactor'];_0x4d73aa[_0x6c1c('0x4f')]=_0x5f4568[_0x6c1c('0x4f')];_0x4d73aa[_0x6c1c('0x50')]=_0x5f4568['startProgressive'];}if(_0x5f4568[_0x6c1c('0x51')]){_0x4d73aa[_0x6c1c('0x51')]={'id':_0x5f4568[_0x6c1c('0x51')]['id'],'name':_0x5f4568[_0x6c1c('0x51')][_0x6c1c('0x9')],'active':_0x5f4568['Trunk'][_0x6c1c('0x52')],'callerid':_0x5f4568['Trunk']['callerid']};}if(_0x5f4568['Interval']){_0x4d73aa[_0x6c1c('0x53')]={'id':_0x5f4568[_0x6c1c('0x53')]['id'],'name':_0x5f4568[_0x6c1c('0x53')][_0x6c1c('0x9')]};}_0x18452d[_0x6c1c('0x54')](_0x4d73aa);}}_0x2ef382({'count':_0x18452d[_0x6c1c('0x55')],'rows':_0x18452d});});},'UpdateVoiceQueue':function(_0x260363){return new Promise(function(_0x167f3b,_0x5ed2d7){var _0x1aae67=_[_0x6c1c('0x56')](_0x56ed6f['voiceQueues'],{'id':parseInt(_0x260363['id'])});var _0x2b4706=_['omit'](_0x260363,['id']);if(_0x1aae67){for(var _0x39e741 in _0x2b4706){if(typeof _0x2b4706[_0x39e741]!==_0x6c1c('0x57')&&typeof _0x1aae67[_0x39e741]!==_0x6c1c('0x57')){_0x1aae67[_0x39e741]=_0x2b4706[_0x39e741];}}_0x167f3b(_0x1aae67);}else{_0x5ed2d7();}});},'VoiceChannels':function(_0x1dd47a){return new Promise(function(_0x261c89,_0x5ea4af){var _0x1fe6e8=_['values'](_0x56ed6f[_0x6c1c('0x58')]);_0x261c89({'count':_0x1fe6e8[_0x6c1c('0x55')],'rows':_0x1fe6e8});});},'VoiceChannelMixMonitor':function(_0x2f6ce0){var _0xa06377=this;return new Promise(function(_0x8d614,_0x26cf7f){if(ami['isConnected']()==![]){return _0x26cf7f(_0xa06377[_0x6c1c('0x11')](0x1f4,[config[_0x6c1c('0x12')]['ip'],config['asterisk'][_0x6c1c('0x13')],_0x6c1c('0x14')][_0x6c1c('0x15')]('\x20')));}var _0x22be7c=schema(properties['voicechannel'])[_0x6c1c('0x59')](_0x2f6ce0);if(_0x22be7c[_0x6c1c('0x55')]>0x0){return _0x26cf7f(_0xa06377[_0x6c1c('0x11')](0x1f4,_['map'](_0x22be7c,'message')['join'](',\x20')));}var _0x5714a6=_['find'](_0x56ed6f[_0x6c1c('0x58')],{'uniqueid':_0x2f6ce0[_0x6c1c('0x5a')]});if(_0x5714a6&&_0x5714a6['channel']){var _0x3ab1af=util[_0x6c1c('0x7')](_0x6c1c('0x5b'),_0x2f6ce0['filename']||_0x2f6ce0['uniqueid'],_0x2f6ce0[_0x6c1c('0x7')]||_0x6c1c('0x5c'));return ami['Action']({'action':_0x6c1c('0x5d'),'channel':_0x5714a6[_0x6c1c('0x5e')],'file':_0x3ab1af,'options':_0x6c1c('0x5f')})[_0x6c1c('0x1a')](function(_0x1f4e95){var _0xc30dde=_['find'](_0x5714a6[_0x6c1c('0x60')],{'filename':_0x6c1c('0x61')+_0x3ab1af['toLowerCase']()});if(_['isNil'](_0xc30dde)){_0x5714a6[_0x6c1c('0x60')][_0x6c1c('0x54')]({'filename':_0x6c1c('0x61')+_0x3ab1af['toLowerCase'](),'createdAt':moment()[_0x6c1c('0x7')](_0x6c1c('0x62')),'mixmonitorid':_0x1f4e95[_0x6c1c('0x63')],'status':_0x6c1c('0x64')});}else{_0xc30dde['mixmonitorid']=_0x1f4e95['mixmonitorid'];_0xc30dde[_0x6c1c('0x65')]=_0x6c1c('0x64');}_0x8d614({'code':0xc8,'message':[_0x2f6ce0[_0x6c1c('0x5a')],'MixMonitor\x20Success',_0x1f4e95['mixmonitorid']][_0x6c1c('0x15')]('\x20'),'mixmonitorid':_0x1f4e95[_0x6c1c('0x63')]});})['catch'](function(_0x2a334b){_0x26cf7f(_0xa06377[_0x6c1c('0x11')](0x1f5,[_0x2f6ce0[_0x6c1c('0x5a')],_0x2a334b[_0x6c1c('0x1b')][_0x6c1c('0x66')]()][_0x6c1c('0x15')]('\x20')));});}else{return _0x26cf7f(_0xa06377['error'](0x1f5,_0x6c1c('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x5a2692){var _0x103fe1=this;return new Promise(function(_0x1930ea,_0x117240){if(ami[_0x6c1c('0x10')]()==![]){return _0x117240(_0x103fe1['error'](0x1f4,[config['asterisk']['ip'],config[_0x6c1c('0x12')][_0x6c1c('0x13')],_0x6c1c('0x14')]['join']('\x20')));}var _0x3273e0=schema(properties[_0x6c1c('0x68')])[_0x6c1c('0x59')](_0x5a2692);if(_0x3273e0[_0x6c1c('0x55')]>0x0){return _0x117240(_0x103fe1[_0x6c1c('0x11')](0x1f4,_[_0x6c1c('0x69')](_0x3273e0,_0x6c1c('0x1b'))['join'](',\x20')));}var _0x268fec=_['find'](_0x56ed6f[_0x6c1c('0x58')],{'uniqueid':_0x5a2692[_0x6c1c('0x5a')]});if(_0x268fec){return BPromise[_0x6c1c('0x6a')]()[_0x6c1c('0x1a')](function(){if(_0x268fec['channel']){return ami[_0x6c1c('0x19')]({'action':_0x6c1c('0x6b'),'channel':_0x268fec[_0x6c1c('0x5e')],'mixmonitorid':_0x5a2692[_0x6c1c('0x63')]})[_0x6c1c('0x1f')](function(_0x475c3b){});}})[_0x6c1c('0x1a')](function(){if(_0x268fec[_0x6c1c('0x6c')]){return ami[_0x6c1c('0x19')]({'action':_0x6c1c('0x6b'),'channel':_0x268fec[_0x6c1c('0x6c')],'mixmonitorid':_0x5a2692['mixmonitorid']})[_0x6c1c('0x1f')](function(_0x6b05c7){});}})[_0x6c1c('0x1a')](function(_0x321997){var _0x441648=_['find'](_0x268fec[_0x6c1c('0x60')],{'mixmonitorid':_0x5a2692[_0x6c1c('0x63')]});if(_0x441648){_0x441648['status']=_0x6c1c('0x6d');}})[_0x6c1c('0x1a')](function(){var _0x1b59bf=util['format'](_0x6c1c('0x5b'),_0x5a2692[_0x6c1c('0x6e')]||_0x5a2692[_0x6c1c('0x5a')],_0x5a2692[_0x6c1c('0x7')]||_0x6c1c('0x5c'));var _0x374b22=_['find'](_0x268fec['monitors'],{'filename':_0x6c1c('0x61')+_0x1b59bf[_0x6c1c('0x66')]()});if(_0x374b22){_0x374b22['status']='stop';}})['then'](function(){_0x1930ea({'code':0xc8,'message':[_0x5a2692[_0x6c1c('0x5a')],_0x6c1c('0x6f')][_0x6c1c('0x15')]('\x20')});})[_0x6c1c('0x1f')](function(_0x585d6d){_0x117240(_0x103fe1[_0x6c1c('0x11')](0x1f5,[_0x5a2692['uniqueid'],_0x585d6d['message']['toLowerCase']()][_0x6c1c('0x15')]('\x20')));});}else{return _0x117240(_0x103fe1[_0x6c1c('0x11')](0x1f5,_0x6c1c('0x67')));}});},'VoiceQueuesChannels':function(_0x42ae1b){return new Promise(function(_0x10bfb4,_0x376074){var _0x4e8b8a=_[_0x6c1c('0x70')](_0x56ed6f[_0x6c1c('0x71')]);_0x10bfb4({'count':_0x4e8b8a[_0x6c1c('0x55')],'rows':_0x4e8b8a});});},'VoiceQueuesChannel':function(_0x5a919a){var _0x585a42=this;return new Promise(function(_0x4ea97d,_0x14a20f){var _0x1b955f=schema(properties['voicequeuechannel'])[_0x6c1c('0x59')](_0x5a919a);if(_0x1b955f['length']>0x0){return _0x14a20f(_0x585a42[_0x6c1c('0x11')](0x1f4,_[_0x6c1c('0x69')](_0x1b955f,_0x6c1c('0x1b'))[_0x6c1c('0x15')](',\x20')));}var _0x4b1cac=_[_0x6c1c('0x56')](_0x56ed6f[_0x6c1c('0x71')],{'uniqueid':_0x5a919a['uniqueid']});if(_0x4b1cac){_0x4ea97d(_0x4b1cac);}else{return _0x14a20f(_0x585a42['error'](0x1f5,_0x6c1c('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x2204a6){var _0x10f39d=this;return new Promise(function(_0x52b1a6,_0x13f292){if(ami[_0x6c1c('0x10')]()==![]){return _0x13f292(_0x10f39d['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x6c1c('0x14')]['join']('\x20')));}var _0xea59ea=schema(properties[_0x6c1c('0x72')])[_0x6c1c('0x59')](_0x2204a6);if(_0xea59ea['length']>0x0){return _0x13f292(_0x10f39d[_0x6c1c('0x11')](0x1f4,_[_0x6c1c('0x69')](_0xea59ea,_0x6c1c('0x1b'))[_0x6c1c('0x15')](',\x20')));}var _0x13c1de=_['find'](_0x56ed6f[_0x6c1c('0x71')],{'uniqueid':_0x2204a6['uniqueid']});if(_0x13c1de&&_0x13c1de[_0x6c1c('0x5e')]){return ami[_0x6c1c('0x19')]({'action':_0x6c1c('0x73'),'channel':_0x13c1de[_0x6c1c('0x5e')]})[_0x6c1c('0x1a')](function(_0x302948){_0x52b1a6({'code':0xc8,'message':[_0x2204a6[_0x6c1c('0x5a')],_0x302948[_0x6c1c('0x1b')]['toLowerCase']()][_0x6c1c('0x15')]('\x20')});})['catch'](function(_0x47b53d){_0x13f292(_0x10f39d[_0x6c1c('0x11')](0x1f5,[_0x2204a6[_0x6c1c('0x5a')],_0x47b53d[_0x6c1c('0x1b')][_0x6c1c('0x66')]()]['join']('\x20')));});}else{return _0x13f292(_0x10f39d[_0x6c1c('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2c0dd1){var _0x48ff6e=this;return new Promise(function(_0xad1f6,_0x23332d){if(ami[_0x6c1c('0x10')]()==![]){return _0x23332d(_0x48ff6e['error'](0x1f4,[config[_0x6c1c('0x12')]['ip'],config[_0x6c1c('0x12')][_0x6c1c('0x13')],'ami\x20disconnected'][_0x6c1c('0x15')]('\x20')));}var _0x2f9a4d=schema(properties[_0x6c1c('0x74')])[_0x6c1c('0x59')](_0x2c0dd1);if(_0x2f9a4d['length']>0x0){return _0x23332d(_0x48ff6e[_0x6c1c('0x11')](0x1f4,_[_0x6c1c('0x69')](_0x2f9a4d,_0x6c1c('0x1b'))[_0x6c1c('0x15')](',\x20')));}var _0x3f87db=_['find'](_0x56ed6f[_0x6c1c('0x71')],{'uniqueid':_0x2c0dd1[_0x6c1c('0x5a')]});if(_0x3f87db&&_0x3f87db[_0x6c1c('0x5e')]){return ami[_0x6c1c('0x19')]({'action':'Redirect','channel':_0x3f87db[_0x6c1c('0x5e')],'exten':_0x2c0dd1[_0x6c1c('0x75')],'context':_0x2c0dd1[_0x6c1c('0x76')]||_0x3f87db['context'],'priority':0x1})[_0x6c1c('0x1a')](function(_0x2684e9){_0xad1f6({'code':0xc8,'message':[_0x2c0dd1['uniqueid'],_0x2684e9[_0x6c1c('0x1b')]['toLowerCase']()][_0x6c1c('0x15')]('\x20')});})[_0x6c1c('0x1f')](function(_0x246682){_0x23332d(_0x48ff6e[_0x6c1c('0x11')](0x1f5,[_0x2c0dd1['uniqueid'],_0x246682[_0x6c1c('0x1b')][_0x6c1c('0x66')]()][_0x6c1c('0x15')]('\x20')));});}else{return _0x23332d(_0x48ff6e['error'](0x1f5,_0x6c1c('0x67')));}});},'Agents':function(_0x1cf3a5){return new Promise(function(_0x4361e5,_0x2ae7b5){var _0x5b01d2=_[_0x6c1c('0x70')](_0x56ed6f[_0x6c1c('0xc')]);_0x4361e5({'count':_0x5b01d2[_0x6c1c('0x55')],'rows':_0x5b01d2});});},'Telephones':function(_0x4c0c6d){return new Promise(function(_0x1aa7e0,_0x5baaa9){var _0x29c5c8=_[_0x6c1c('0x70')](_0x56ed6f[_0x6c1c('0x77')]);_0x1aa7e0({'count':_0x29c5c8[_0x6c1c('0x55')],'rows':_0x29c5c8});});},'Trunks':function(_0x29da07){return new Promise(function(_0x1ff557,_0x389e22){var _0x2b0866=_['values'](_0x56ed6f[_0x6c1c('0x78')]);_0x1ff557({'count':_0x2b0866['length'],'rows':_0x2b0866});});},'OutboundChannels':function(_0x398a61){return new Promise(function(_0x214630,_0x11220a){var _0x10138=_['values'](_0x56ed6f[_0x6c1c('0x79')]);_0x214630({'count':_0x10138[_0x6c1c('0x55')],'rows':_0x10138});});},'Outbound':function(_0x27a8cc){return new Promise(function(_0x5e77e8,_0xf58113){_0x5e77e8(_0x56ed6f[_0x6c1c('0x2b')]);});},'Campaigns':function(_0x4f9477){return new Promise(function(_0x5e4036,_0x197faa){var _0x1456e1=_[_0x6c1c('0x70')](_0x56ed6f[_0x6c1c('0x7a')]);_0x5e4036({'count':_0x1456e1[_0x6c1c('0x55')],'rows':_0x1456e1});});},'VoiceQueuesPreview':function(_0x12ce5a){var _0x250e21=this;return new Promise(function(_0x3b017d,_0x1f311f){_0x32af84[_0x6c1c('0x7b')](_0x12ce5a['id'])[_0x6c1c('0x1a')](function(_0x3f9697){_0x3b017d({'code':0xc8,'message':_0x3f9697['message']});})[_0x6c1c('0x1f')](function(_0x3a5014){_0x1f311f(_0x250e21[_0x6c1c('0x11')](0x1f4,_0x3a5014[_0x6c1c('0x1b')]));});});},'EventManager':function(_0x40415d){var _0x2af9f3=this;return new Promise(function(_0x469a73,_0x5ca667){if(!_0x40415d[_0x6c1c('0x7c')]){return _0x5ca667(_0x2af9f3['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x6c1c('0x7d')](_0x6c1c('0x7e')+_0x40415d[_0x6c1c('0x7c')],_0x40415d[_0x6c1c('0x1b')]);_0x469a73({'code':0xc8,'message':_0x40415d});});},'FaxAccounts':function(_0x3f09e6){return new Promise(function(_0x21b63d,_0x25198a){var _0x2a2797=_[_0x6c1c('0x70')](_0x56ed6f[_0x6c1c('0x7f')]);_0x21b63d({'count':_0x2a2797['length'],'rows':_0x2a2797});});},'SendFax':function(_0x3e40b6){var _0x654041=this;return new Promise(function(_0x1a0da8,_0x3efe9c){_0x524a6b[_0x6c1c('0x80')](_0x3e40b6)[_0x6c1c('0x1a')](function(_0x24ffc3){_0x1a0da8({'code':0xc8,'message':_0x24ffc3[_0x6c1c('0x1b')]});})['catch'](function(_0x463e76){_0x3efe9c(_0x654041[_0x6c1c('0x11')](0x1f4,_0x463e76[_0x6c1c('0x1b')]));});});},'CheckAfterSend':function(_0x700aee){var _0x385629=this;return new Promise(function(_0x42a812,_0x152fef){_0x524a6b[_0x6c1c('0x81')](_0x700aee)[_0x6c1c('0x1a')](function(_0x3d92c2){_0x42a812({'code':0xc8,'message':_0x3d92c2[_0x6c1c('0x1b')]});})[_0x6c1c('0x1f')](function(_0x2700b5){_0x152fef(_0x385629[_0x6c1c('0x11')](0x1f4,_0x2700b5['message']));});});}};var _0x58a474=jayson[_0x6c1c('0x82')](_0xe510ca)['http']();_0x58a474['on'](_0x6c1c('0x11'),function(_0x20a29f){return _0x582bec(_0x20a29f);});_0x58a474[_0x6c1c('0x83')](0x232a,_0x6c1c('0x84'),function(){console[_0x6c1c('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x50c1bb(_0x6c1c('0x86')+0x232a);});});}; \ No newline at end of file +var _0x11e5=['../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','module','Reload','Action','then','message','ami\x20disconnected','command','action','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','channel','%s.%s','uniqueid','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','status','filename','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','agents','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../../../config/environment'];(function(_0x442ee6,_0x491070){var _0x1ef8a4=function(_0x5300ac){while(--_0x5300ac){_0x442ee6['push'](_0x442ee6['shift']());}};_0x1ef8a4(++_0x491070);}(_0x11e5,0x8b));var _0x511e=function(_0x39eb78,_0x56da9f){_0x39eb78=_0x39eb78-0x0;var _0x45ba21=_0x11e5[_0x39eb78];return _0x45ba21;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var jayson=require(_0x511e('0x1'));var schema=require(_0x511e('0x2'));var BPromise=require('bluebird');var moment=require(_0x511e('0x3'));var config=require(_0x511e('0x4'));var properties=require(_0x511e('0x5'));var ami=require('../ami');exports[_0x511e('0x6')]=function(_0x4fbd4f,_0x5923a7,_0x342539){return new BPromise(function(_0x323f8c,_0x466dec){var _0x57cac3={'QueuePause':function(_0x47cf56){return new Promise(function(_0x3ebc4b,_0xf0ba86){var _0x25deeb=util[_0x511e('0x7')](_0x511e('0x8'),_0x511e('0x9'),_0x47cf56[_0x511e('0xa')]);if(_0x4fbd4f[_0x511e('0xb')]&&_0x4fbd4f[_0x511e('0xb')][_0x25deeb]&&_0x4fbd4f[_0x511e('0xb')][_0x25deeb][_0x511e('0xc')]){_0x4fbd4f['timers'][_0x25deeb][_0x511e('0xd')]();}if(_0x4fbd4f['agents'][_0x25deeb]){_0x4fbd4f['agents'][_0x25deeb][_0x511e('0xe')]({'statePause':_0x47cf56[_0x511e('0xf')]?!![]:![]});}_0x3ebc4b({'code':0xc8,'message':_0x511e('0x10')});});},'Reload':function(_0x258e2f){var _0x464576=this;return new Promise(function(_0x7dc1bc,_0x4e72fd){if(ami[_0x511e('0x11')]()==![]){return _0x4e72fd(_0x464576[_0x511e('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x511e('0x13')][_0x511e('0x14')],'ami\x20disconnected'][_0x511e('0x15')]('\x20')));}_0x258e2f=_[_0x511e('0x16')](_0x258e2f,_[_0x511e('0x17')](properties[_0x511e('0x18')]));_0x258e2f['action']=_0x511e('0x19');return ami[_0x511e('0x1a')](_0x258e2f)[_0x511e('0x1b')](function(_0x577616){_0x7dc1bc({'code':0xc8,'message':_0x577616[_0x511e('0x1c')]});})['catch'](function(_0x34e6cd){_0x4e72fd(_0x464576['error'](0x1f5,_0x34e6cd['message']));});});},'Command':function(_0x37ae92){var _0x5c4fb9=this;return new Promise(function(_0x33bef5,_0x325278){if(ami[_0x511e('0x11')]()==![]){return _0x325278(_0x5c4fb9[_0x511e('0x12')](0x1f4,[config[_0x511e('0x13')]['ip'],config[_0x511e('0x13')][_0x511e('0x14')],_0x511e('0x1d')]['join']('\x20')));}_0x37ae92=_[_0x511e('0x16')](_0x37ae92,_0x511e('0x1e'));_0x37ae92[_0x511e('0x1f')]=_0x511e('0x20');return ami[_0x511e('0x1a')](_0x37ae92)[_0x511e('0x1b')](function(_0x886b6){_0x33bef5({'code':0xc8,'message':_0x886b6[_0x511e('0x21')]});})[_0x511e('0x22')](function(_0x26618d){_0x325278(_0x5c4fb9['error'](0x1f5,_0x26618d['message']));});});},'VoiceQueues':function(_0x3e1711){return new Promise(function(_0x4d94a1,_0x1ff5c4){var _0x53017d=[];for(var _0x3fbd19 in _0x4fbd4f[_0x511e('0x23')]){if(_0x4fbd4f[_0x511e('0x23')][_0x511e('0x24')](_0x3fbd19)){var _0x1bb7f9=_0x4fbd4f[_0x511e('0x23')][_0x3fbd19];var _0x3c057c={'id':_0x1bb7f9['id'],'name':_0x1bb7f9[_0x511e('0xa')],'strategy':_0x1bb7f9[_0x511e('0x25')],'answered':_0x1bb7f9[_0x511e('0x26')],'available':_0x1bb7f9['available'],'loggedIn':_0x1bb7f9[_0x511e('0x27')],'pTalking':_0x1bb7f9[_0x511e('0x28')],'sumBillable':_0x1bb7f9[_0x511e('0x29')],'sumDuration':_0x1bb7f9[_0x511e('0x2a')],'sumHoldTime':_0x1bb7f9[_0x511e('0x2b')]||0x0,'talking':_0x1bb7f9['talking'],'total':_0x1bb7f9[_0x511e('0x2c')],'type':_0x1bb7f9['type'],'unmanaged':_0x1bb7f9['unmanaged'],'abandoned':_0x1bb7f9[_0x511e('0x2d')],'waiting':_0x1bb7f9[_0x511e('0x2e')],'loggedInDb':_0x1bb7f9[_0x511e('0x2f')]};if(_0x1bb7f9[_0x511e('0x30')]===_0x511e('0x31')){_0x3c057c['dialActive']=_0x1bb7f9[_0x511e('0x32')];_0x3c057c[_0x511e('0x33')]=_0x1bb7f9[_0x511e('0x33')];_0x3c057c[_0x511e('0x34')]=_0x1bb7f9[_0x511e('0x34')];_0x3c057c['dialOriginateCallerIdNumber']=_0x1bb7f9[_0x511e('0x35')];_0x3c057c[_0x511e('0x36')]=_0x1bb7f9[_0x511e('0x36')];_0x3c057c[_0x511e('0x37')]=_0x1bb7f9[_0x511e('0x37')];_0x3c057c[_0x511e('0x38')]=_0x1bb7f9[_0x511e('0x38')];_0x3c057c[_0x511e('0x39')]=_0x1bb7f9['outboundAnswerAgiCallsDay'];_0x3c057c[_0x511e('0x3a')]=_0x1bb7f9[_0x511e('0x3a')];_0x3c057c[_0x511e('0x3b')]=_0x1bb7f9[_0x511e('0x3b')];_0x3c057c['outboundBusyCallsDay']=_0x1bb7f9['outboundBusyCallsDay'];_0x3c057c[_0x511e('0x3c')]=_0x1bb7f9['outboundCongestionCallsDay'];_0x3c057c['outboundDropCallsDayACS']=_0x1bb7f9[_0x511e('0x3d')];_0x3c057c[_0x511e('0x3e')]=_0x1bb7f9[_0x511e('0x3e')];_0x3c057c[_0x511e('0x3f')]=_0x1bb7f9[_0x511e('0x3f')];_0x3c057c['outboundNoAnswerCallsDay']=_0x1bb7f9[_0x511e('0x40')];_0x3c057c[_0x511e('0x41')]=_0x1bb7f9[_0x511e('0x41')];_0x3c057c['outboundOriginateFailureCallsDay']=_0x1bb7f9[_0x511e('0x42')];_0x3c057c[_0x511e('0x43')]=_0x1bb7f9[_0x511e('0x43')];_0x3c057c['outboundRejectCallsDay']=_0x1bb7f9[_0x511e('0x44')];_0x3c057c[_0x511e('0x45')]=_0x1bb7f9['outboundUnknownCallsDay'];_0x3c057c[_0x511e('0x46')]=_0x1bb7f9[_0x511e('0x46')];_0x3c057c[_0x511e('0x47')]=_0x1bb7f9[_0x511e('0x47')];_0x3c057c[_0x511e('0x48')]=_0x1bb7f9[_0x511e('0x48')];_0x3c057c[_0x511e('0x49')]=_0x1bb7f9[_0x511e('0x49')];_0x3c057c[_0x511e('0x4a')]=_0x1bb7f9[_0x511e('0x4a')];_0x3c057c[_0x511e('0x4b')]=_0x1bb7f9['predictiveIntervalErlangCalls'];_0x3c057c[_0x511e('0x4c')]=_0x1bb7f9['predictiveIntervalErlangCallsDroppedCalls'];_0x3c057c['predictiveIntervalHitRate']=_0x1bb7f9[_0x511e('0x4d')];_0x3c057c['predictiveIntervalMultiplicativeFactor']=_0x1bb7f9['predictiveIntervalMultiplicativeFactor'];_0x3c057c[_0x511e('0x4e')]=_0x1bb7f9[_0x511e('0x4e')];_0x3c057c[_0x511e('0x4f')]=_0x1bb7f9[_0x511e('0x4f')];_0x3c057c[_0x511e('0x50')]=_0x1bb7f9[_0x511e('0x50')];_0x3c057c[_0x511e('0x1c')]=_0x1bb7f9[_0x511e('0x1c')];_0x3c057c[_0x511e('0x51')]=_0x1bb7f9[_0x511e('0x51')];_0x3c057c[_0x511e('0x52')]=_0x1bb7f9[_0x511e('0x52')];_0x3c057c[_0x511e('0x53')]=_0x1bb7f9[_0x511e('0x53')];_0x3c057c['erlangAbandonmentRate']=_0x1bb7f9['erlangAbandonmentRate'];_0x3c057c[_0x511e('0x54')]=_0x1bb7f9[_0x511e('0x54')];_0x3c057c[_0x511e('0x55')]=_0x1bb7f9[_0x511e('0x55')];_0x3c057c[_0x511e('0x56')]=_0x1bb7f9['startProgressive'];}if(_0x1bb7f9[_0x511e('0x57')]){_0x3c057c[_0x511e('0x57')]={'id':_0x1bb7f9[_0x511e('0x57')]['id'],'name':_0x1bb7f9['Trunk']['name'],'active':_0x1bb7f9['Trunk'][_0x511e('0x58')],'callerid':_0x1bb7f9[_0x511e('0x57')][_0x511e('0x59')]};}if(_0x1bb7f9['Interval']){_0x3c057c['Interval']={'id':_0x1bb7f9['Interval']['id'],'name':_0x1bb7f9[_0x511e('0x5a')][_0x511e('0xa')]};}_0x53017d[_0x511e('0x5b')](_0x3c057c);}}_0x4d94a1({'count':_0x53017d[_0x511e('0x5c')],'rows':_0x53017d});});},'UpdateVoiceQueue':function(_0x40e017){return new Promise(function(_0x393e36,_0x1d494f){var _0x1faf19=_[_0x511e('0x5d')](_0x4fbd4f[_0x511e('0x23')],{'id':parseInt(_0x40e017['id'])});var _0x1a2e4=_[_0x511e('0x5e')](_0x40e017,['id']);if(_0x1faf19){for(var _0x19a6c8 in _0x1a2e4){if(typeof _0x1a2e4[_0x19a6c8]!==_0x511e('0x5f')&&typeof _0x1faf19[_0x19a6c8]!==_0x511e('0x5f')){_0x1faf19[_0x19a6c8]=_0x1a2e4[_0x19a6c8];}}_0x393e36(_0x1faf19);}else{_0x1d494f();}});},'VoiceChannels':function(_0x17568d){return new Promise(function(_0x15e6e8,_0x30769b){var _0x3a8395=_[_0x511e('0x60')](_0x4fbd4f[_0x511e('0x61')]);_0x15e6e8({'count':_0x3a8395[_0x511e('0x5c')],'rows':_0x3a8395});});},'VoiceChannelMixMonitor':function(_0x204783){var _0x1cb4ba=this;return new Promise(function(_0x37bfdb,_0x4096c0){if(ami[_0x511e('0x11')]()==![]){return _0x4096c0(_0x1cb4ba[_0x511e('0x12')](0x1f4,[config[_0x511e('0x13')]['ip'],config[_0x511e('0x13')][_0x511e('0x14')],'ami\x20disconnected'][_0x511e('0x15')]('\x20')));}var _0x56bfd4=schema(properties[_0x511e('0x62')])[_0x511e('0x2')](_0x204783);if(_0x56bfd4[_0x511e('0x5c')]>0x0){return _0x4096c0(_0x1cb4ba['error'](0x1f4,_[_0x511e('0x63')](_0x56bfd4,_0x511e('0x1c'))[_0x511e('0x15')](',\x20')));}var _0x5cc04d=_[_0x511e('0x5d')](_0x4fbd4f[_0x511e('0x61')],{'uniqueid':_0x204783['uniqueid']});if(_0x5cc04d&&_0x5cc04d[_0x511e('0x64')]){var _0x4609dc=util[_0x511e('0x7')](_0x511e('0x65'),_0x204783['filename']||_0x204783[_0x511e('0x66')],_0x204783['format']||_0x511e('0x67'));return ami[_0x511e('0x1a')]({'action':_0x511e('0x68'),'channel':_0x5cc04d['channel'],'file':_0x4609dc,'options':_0x511e('0x69')})['then'](function(_0x4705e3){var _0x586449=_[_0x511e('0x5d')](_0x5cc04d[_0x511e('0x6a')],{'filename':_0x511e('0x6b')+_0x4609dc['toLowerCase']()});if(_[_0x511e('0x6c')](_0x586449)){_0x5cc04d[_0x511e('0x6a')][_0x511e('0x5b')]({'filename':_0x511e('0x6b')+_0x4609dc[_0x511e('0x6d')](),'createdAt':moment()[_0x511e('0x7')](_0x511e('0x6e')),'mixmonitorid':_0x4705e3[_0x511e('0x6f')],'status':'rec'});}else{_0x586449[_0x511e('0x6f')]=_0x4705e3[_0x511e('0x6f')];_0x586449['status']=_0x511e('0x70');}_0x37bfdb({'code':0xc8,'message':[_0x204783[_0x511e('0x66')],_0x511e('0x71'),_0x4705e3[_0x511e('0x6f')]][_0x511e('0x15')]('\x20'),'mixmonitorid':_0x4705e3[_0x511e('0x6f')]});})['catch'](function(_0x31777b){_0x4096c0(_0x1cb4ba[_0x511e('0x12')](0x1f5,[_0x204783['uniqueid'],_0x31777b[_0x511e('0x1c')]['toLowerCase']()][_0x511e('0x15')]('\x20')));});}else{return _0x4096c0(_0x1cb4ba[_0x511e('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x58f1e4){var _0x586931=this;return new Promise(function(_0x5a1511,_0x37c145){if(ami['isConnected']()==![]){return _0x37c145(_0x586931['error'](0x1f4,[config[_0x511e('0x13')]['ip'],config[_0x511e('0x13')]['username'],_0x511e('0x1d')]['join']('\x20')));}var _0x3a3744=schema(properties['voicechannel'])['validate'](_0x58f1e4);if(_0x3a3744['length']>0x0){return _0x37c145(_0x586931[_0x511e('0x12')](0x1f4,_[_0x511e('0x63')](_0x3a3744,'message')['join'](',\x20')));}var _0x51940a=_['find'](_0x4fbd4f[_0x511e('0x61')],{'uniqueid':_0x58f1e4['uniqueid']});if(_0x51940a){return BPromise[_0x511e('0x72')]()['then'](function(){if(_0x51940a[_0x511e('0x64')]){return ami[_0x511e('0x1a')]({'action':_0x511e('0x73'),'channel':_0x51940a[_0x511e('0x64')],'mixmonitorid':_0x58f1e4['mixmonitorid']})[_0x511e('0x22')](function(_0xc154b2){});}})[_0x511e('0x1b')](function(){if(_0x51940a[_0x511e('0x74')]){return ami[_0x511e('0x1a')]({'action':'StopMixMonitor','channel':_0x51940a['destinationchannel'],'mixmonitorid':_0x58f1e4[_0x511e('0x6f')]})[_0x511e('0x22')](function(_0x42cb48){});}})[_0x511e('0x1b')](function(_0x3d0a10){var _0x329aee=_[_0x511e('0x5d')](_0x51940a[_0x511e('0x6a')],{'mixmonitorid':_0x58f1e4[_0x511e('0x6f')]});if(_0x329aee){_0x329aee[_0x511e('0x75')]='stop';}})['then'](function(){var _0x55fcc9=util[_0x511e('0x7')]('%s.%s',_0x58f1e4[_0x511e('0x76')]||_0x58f1e4['uniqueid'],_0x58f1e4[_0x511e('0x7')]||'wav');var _0x434269=_[_0x511e('0x5d')](_0x51940a[_0x511e('0x6a')],{'filename':_0x511e('0x6b')+_0x55fcc9[_0x511e('0x6d')]()});if(_0x434269){_0x434269['status']=_0x511e('0x77');}})['then'](function(){_0x5a1511({'code':0xc8,'message':[_0x58f1e4[_0x511e('0x66')],_0x511e('0x78')][_0x511e('0x15')]('\x20')});})['catch'](function(_0x76b6b0){_0x37c145(_0x586931[_0x511e('0x12')](0x1f5,[_0x58f1e4[_0x511e('0x66')],_0x76b6b0[_0x511e('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x37c145(_0x586931[_0x511e('0x12')](0x1f5,_0x511e('0x79')));}});},'VoiceQueuesChannels':function(_0x5b1ba8){return new Promise(function(_0x2545d2,_0x5cb3ea){var _0x45693d=_[_0x511e('0x60')](_0x4fbd4f['queueChannels']);_0x2545d2({'count':_0x45693d['length'],'rows':_0x45693d});});},'VoiceQueuesChannel':function(_0x317766){var _0x2b9aee=this;return new Promise(function(_0x2061d8,_0x5c2817){var _0xb7e7e4=schema(properties[_0x511e('0x7a')])[_0x511e('0x2')](_0x317766);if(_0xb7e7e4[_0x511e('0x5c')]>0x0){return _0x5c2817(_0x2b9aee[_0x511e('0x12')](0x1f4,_[_0x511e('0x63')](_0xb7e7e4,_0x511e('0x1c'))['join'](',\x20')));}var _0x23833a=_[_0x511e('0x5d')](_0x4fbd4f['queueChannels'],{'uniqueid':_0x317766['uniqueid']});if(_0x23833a){_0x2061d8(_0x23833a);}else{return _0x5c2817(_0x2b9aee[_0x511e('0x12')](0x1f5,_0x511e('0x79')));}});},'VoiceQueuesChannelHangup':function(_0x55c45d){var _0x36d05f=this;return new Promise(function(_0x5e65a2,_0x21cb81){if(ami['isConnected']()==![]){return _0x21cb81(_0x36d05f['error'](0x1f4,[config[_0x511e('0x13')]['ip'],config[_0x511e('0x13')][_0x511e('0x14')],_0x511e('0x1d')][_0x511e('0x15')]('\x20')));}var _0x4f16f5=schema(properties['voicequeuechannelhangup'])[_0x511e('0x2')](_0x55c45d);if(_0x4f16f5[_0x511e('0x5c')]>0x0){return _0x21cb81(_0x36d05f[_0x511e('0x12')](0x1f4,_['map'](_0x4f16f5,_0x511e('0x1c'))[_0x511e('0x15')](',\x20')));}var _0x493188=_['find'](_0x4fbd4f[_0x511e('0x7b')],{'uniqueid':_0x55c45d[_0x511e('0x66')]});if(_0x493188&&_0x493188[_0x511e('0x64')]){return ami[_0x511e('0x1a')]({'action':_0x511e('0x7c'),'channel':_0x493188[_0x511e('0x64')]})['then'](function(_0x33fd85){_0x5e65a2({'code':0xc8,'message':[_0x55c45d[_0x511e('0x66')],_0x33fd85['message']['toLowerCase']()][_0x511e('0x15')]('\x20')});})['catch'](function(_0x3341a0){_0x21cb81(_0x36d05f['error'](0x1f5,[_0x55c45d['uniqueid'],_0x3341a0[_0x511e('0x1c')][_0x511e('0x6d')]()][_0x511e('0x15')]('\x20')));});}else{return _0x21cb81(_0x36d05f[_0x511e('0x12')](0x1f5,_0x511e('0x79')));}});},'VoiceQueuesChannelRedirect':function(_0x1876d2){var _0x143277=this;return new Promise(function(_0x431d94,_0x325df2){if(ami[_0x511e('0x11')]()==![]){return _0x325df2(_0x143277[_0x511e('0x12')](0x1f4,[config[_0x511e('0x13')]['ip'],config[_0x511e('0x13')][_0x511e('0x14')],_0x511e('0x1d')][_0x511e('0x15')]('\x20')));}var _0x4a07b7=schema(properties[_0x511e('0x7d')])[_0x511e('0x2')](_0x1876d2);if(_0x4a07b7[_0x511e('0x5c')]>0x0){return _0x325df2(_0x143277[_0x511e('0x12')](0x1f4,_[_0x511e('0x63')](_0x4a07b7,_0x511e('0x1c'))[_0x511e('0x15')](',\x20')));}var _0x3e2e1d=_[_0x511e('0x5d')](_0x4fbd4f[_0x511e('0x7b')],{'uniqueid':_0x1876d2[_0x511e('0x66')]});if(_0x3e2e1d&&_0x3e2e1d['channel']){return ami[_0x511e('0x1a')]({'action':_0x511e('0x7e'),'channel':_0x3e2e1d[_0x511e('0x64')],'exten':_0x1876d2[_0x511e('0x7f')],'context':_0x1876d2['context']||_0x3e2e1d[_0x511e('0x80')],'priority':0x1})[_0x511e('0x1b')](function(_0x3a4db6){_0x431d94({'code':0xc8,'message':[_0x1876d2[_0x511e('0x66')],_0x3a4db6[_0x511e('0x1c')][_0x511e('0x6d')]()][_0x511e('0x15')]('\x20')});})[_0x511e('0x22')](function(_0x25e8cb){_0x325df2(_0x143277[_0x511e('0x12')](0x1f5,[_0x1876d2['uniqueid'],_0x25e8cb[_0x511e('0x1c')][_0x511e('0x6d')]()][_0x511e('0x15')]('\x20')));});}else{return _0x325df2(_0x143277[_0x511e('0x12')](0x1f5,_0x511e('0x79')));}});},'Agents':function(_0x3d807a){return new Promise(function(_0x436e65,_0x47c07d){var _0x4a43bf=_[_0x511e('0x60')](_0x4fbd4f[_0x511e('0x81')]);_0x436e65({'count':_0x4a43bf[_0x511e('0x5c')],'rows':_0x4a43bf});});},'Telephones':function(_0x32fd22){return new Promise(function(_0x11d601,_0x4316de){var _0x122d49=_[_0x511e('0x60')](_0x4fbd4f[_0x511e('0x82')]);_0x11d601({'count':_0x122d49[_0x511e('0x5c')],'rows':_0x122d49});});},'Trunks':function(_0x55e8cc){return new Promise(function(_0x15a553,_0x255aac){var _0x19671c=_[_0x511e('0x60')](_0x4fbd4f[_0x511e('0x83')]);_0x15a553({'count':_0x19671c['length'],'rows':_0x19671c});});},'OutboundChannels':function(_0x561a26){return new Promise(function(_0x1d408d,_0x26a9f0){var _0x588f24=_[_0x511e('0x60')](_0x4fbd4f['outboundChannels']);_0x1d408d({'count':_0x588f24[_0x511e('0x5c')],'rows':_0x588f24});});},'Outbound':function(_0x2ff676){return new Promise(function(_0x5c9f54,_0x68d14e){_0x5c9f54(_0x4fbd4f['outbound']);});},'Campaigns':function(_0xd74673){return new Promise(function(_0x2455da,_0x19a7ba){var _0x473867=_[_0x511e('0x60')](_0x4fbd4f[_0x511e('0x84')]);_0x2455da({'count':_0x473867[_0x511e('0x5c')],'rows':_0x473867});});},'VoiceQueuesPreview':function(_0x27004c){var _0x3289a9=this;return new Promise(function(_0x12e381,_0x37bb80){_0x5923a7[_0x511e('0x85')](_0x27004c['id'])[_0x511e('0x1b')](function(_0x28907e){_0x12e381({'code':0xc8,'message':_0x28907e[_0x511e('0x1c')]});})[_0x511e('0x22')](function(_0x45d846){_0x37bb80(_0x3289a9[_0x511e('0x12')](0x1f4,_0x45d846['message']));});});},'EventManager':function(_0x26065a){var _0x4377b4=this;return new Promise(function(_0x1e08dc,_0x4727b0){if(!_0x26065a[_0x511e('0x86')]){return _0x4727b0(_0x4377b4['error'](0x1f4,_0x511e('0x87')));}ami[_0x511e('0x88')](_0x511e('0x89')+_0x26065a['event'],_0x26065a[_0x511e('0x1c')]);_0x1e08dc({'code':0xc8,'message':_0x26065a});});},'FaxAccounts':function(_0x470f1e){return new Promise(function(_0x176941,_0x334374){var _0x513c38=_['values'](_0x4fbd4f['faxAccounts']);_0x176941({'count':_0x513c38[_0x511e('0x5c')],'rows':_0x513c38});});},'SendFax':function(_0x148871){var _0x48a735=this;return new Promise(function(_0x137568,_0x49e3c7){_0x342539[_0x511e('0x8a')](_0x148871)['then'](function(_0x19abb4){_0x137568({'code':0xc8,'message':_0x19abb4[_0x511e('0x1c')]});})['catch'](function(_0x222547){_0x49e3c7(_0x48a735[_0x511e('0x12')](0x1f4,_0x222547[_0x511e('0x1c')]));});});},'CheckAfterSend':function(_0x40d891){var _0x3debb7=this;return new Promise(function(_0x500557,_0x4a8843){_0x342539['checkAfterSend'](_0x40d891)['then'](function(_0x4adf6b){_0x500557({'code':0xc8,'message':_0x4adf6b[_0x511e('0x1c')]});})[_0x511e('0x22')](function(_0x43301c){_0x4a8843(_0x3debb7['error'](0x1f4,_0x43301c[_0x511e('0x1c')]));});});}};var _0x1eb2ce=jayson[_0x511e('0x8b')](_0x57cac3)[_0x511e('0x8c')]();_0x1eb2ce['on'](_0x511e('0x12'),function(_0x31cdb3){return _0x466dec(_0x31cdb3);});_0x1eb2ce[_0x511e('0x6')](0x232a,'127.0.0.1',function(){console[_0x511e('0x8d')](_0x511e('0x8e'),0x232a);return _0x323f8c(_0x511e('0x8f')+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 3b1e996..229afab 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 _0x22fb=['destcalleridnum','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','toLowerCase','merge','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map'];(function(_0x21cc63,_0x2fcc6c){var _0x437d98=function(_0x58fd3b){while(--_0x58fd3b){_0x21cc63['push'](_0x21cc63['shift']());}};_0x437d98(++_0x2fcc6c);}(_0x22fb,0x192));var _0xb22f=function(_0x186883,_0x5e21d0){_0x186883=_0x186883-0x0;var _0x2bd97b=_0x22fb[_0x186883];return _0x2bd97b;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xb22f('0x0'));var util=require('util');var config=require(_0xb22f('0x1'));var logger=require(_0xb22f('0x2'))(_0xb22f('0x3'));var cmContactRpc=require(_0xb22f('0x4'));config[_0xb22f('0x5')]=_['defaults'](config[_0xb22f('0x5')],{'host':_0xb22f('0x6'),'port':0x18eb});var io=require(_0xb22f('0x7'))(new Redis(config[_0xb22f('0x5')]));function emit(_0x412a95,_0x367d4b,_0x47f61a,_0x34433b,_0x22c509){logger[_0xb22f('0x8')](_0xb22f('0x9'),_0x412a95,_0x367d4b['id'],_0x47f61a,_0x34433b,JSON[_0xb22f('0xa')](_0x22c509));io['to'](_0x47f61a)[_0xb22f('0xb')](_0x34433b,_0x22c509);}exports[_0xb22f('0xc')]=function(_0x2ca6dd,_0x26cf79,_0x2676f3,_0x3473d4){var _0x593330,_0x4b9e56;var _0x5b2399={};var _0x1caf67=Number(_0x2676f3['data1']);var _0x4bb02a=_0x2676f3['data2']?Boolean(Number(_0x2676f3[_0xb22f('0xd')])):![];var _0x40fcf8;var _0x4ae6bb=![];if(!_[_0xb22f('0xe')](_0x2676f3[_0xb22f('0xf')])){if(_0x2676f3[_0xb22f('0xf')]=='1')_0x4ae6bb=!![];}if(!_0x4ae6bb){if(_0x3473d4['xmd-contactid']){_0x5b2399['id']=_0x3473d4[_0xb22f('0x10')];}}if(!_0x5b2399['id']){_0x5b2399['ListId']=_0x1caf67;_0x40fcf8=_0x2676f3[_0xb22f('0x11')]&&_0x2676f3['data3']!=='0'?_0x2676f3[_0xb22f('0x11')][_0xb22f('0x12')](','):[_0xb22f('0x13')];_0x5b2399[_0xb22f('0x14')]=_[_0xb22f('0x15')](_0x40fcf8,function(_0x538da0){var _0x1530f7={};_0x1530f7[_0x538da0]=_0x3473d4['routeId']?_0x3473d4[_0xb22f('0x16')]:_0x3473d4[_0xb22f('0x17')];return _0x1530f7;});}var _0x2aaec4=['id',_0xb22f('0x18'),_0xb22f('0x19'),_0xb22f('0x13'),'mobile',_0xb22f('0x1a'),'ListId',_0xb22f('0x1b'),_0xb22f('0x1c'),_0xb22f('0x1d')];var _0x2239b8=_[_0xb22f('0x1e')](_0x2aaec4,_0x40fcf8);BPromise['resolve']()['then'](cmContactRpc[_0xb22f('0x1f')]({'attributes':_0x2239b8,'where':_0x5b2399}))[_0xb22f('0x20')](function(_0xf34e0d){_0x4b9e56=_0xf34e0d;if(!_[_0xb22f('0x21')](_0x4b9e56)){if(_0x4b9e56[_0xb22f('0x22')]===0x1){_0x593330=_0x4b9e56[0x0];logger[_0xb22f('0x8')](_0xb22f('0x23'),_0x3473d4[_0xb22f('0x24')],_0x26cf79['id'],_0x593330['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3473d4[_0xb22f('0x24')],_0x26cf79['id'],_[_0xb22f('0x15')](_0x4b9e56,'id')['join'](','));}return;}else{logger[_0xb22f('0x8')](_0xb22f('0x25'),_0x3473d4['uniqueid'],_0x26cf79['id']);var _0x4687f2={'ListId':_0x1caf67};var _0x2918be=_0x2676f3['data4']&&_0x2676f3[_0xb22f('0x26')]!=='0'?_0x2676f3[_0xb22f('0x26')]:_0xb22f('0x13');if(_0x4bb02a){logger[_0xb22f('0x8')](_0xb22f('0x27'),_0x3473d4[_0xb22f('0x24')],_0x26cf79['id']);_0x4687f2[_0x2918be]=_[_0xb22f('0xe')](_0x3473d4[_0xb22f('0x28')])?_0x3473d4['calleridnum']:_0x3473d4['destcalleridnum'];if(_['isNil'](_0x3473d4[_0xb22f('0x28')])){_0x4687f2['firstName']=_0x3473d4[_0xb22f('0x29')]&&_0x3473d4[_0xb22f('0x29')]!==_0xb22f('0x2a')?_0x3473d4[_0xb22f('0x29')]:_0xb22f('0x2b');}else{_0x4687f2['firstName']=_0x3473d4['destcalleridname']&&_0x3473d4[_0xb22f('0x2c')]!==_0xb22f('0x2a')?_0x3473d4[_0xb22f('0x2c')]:_0xb22f('0x2b');}return BPromise['resolve']()[_0xb22f('0x20')](cmContactRpc[_0xb22f('0x2d')](_0x4687f2))['then'](function(_0x344c30){_0x593330=_0x344c30;_0x4b9e56[_0xb22f('0x2e')](_0x344c30);if(_0x593330){logger[_0xb22f('0x8')](_0xb22f('0x2f'),_0x3473d4[_0xb22f('0x24')],_0x26cf79['id'],_0x593330['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x3473d4[_0xb22f('0x24')],_0x26cf79['id']);_0x4687f2[_0x2918be]=_[_0xb22f('0xe')](_0x3473d4[_0xb22f('0x28')])?_0x3473d4[_0xb22f('0x17')]:_0x3473d4[_0xb22f('0x16')];if(_[_0xb22f('0xe')](_0x3473d4[_0xb22f('0x28')])){_0x4687f2[_0xb22f('0x18')]=_0x3473d4[_0xb22f('0x29')]&&_0x3473d4['calleridname']!==_0xb22f('0x2a')?_0x3473d4['calleridname']:'Unknown';}else{_0x4687f2[_0xb22f('0x18')]=_0x3473d4[_0xb22f('0x2c')]&&_0x3473d4[_0xb22f('0x2c')]!==_0xb22f('0x2a')?_0x3473d4[_0xb22f('0x2c')]:_0xb22f('0x2b');}_0x593330=_0x4687f2;_0x4b9e56[_0xb22f('0x2e')](_0x4687f2);return;}}})[_0xb22f('0x20')](function(){if(_0x2ca6dd){emit(_0x3473d4[_0xb22f('0x24')],_0x26cf79,util[_0xb22f('0x30')](_0xb22f('0x31'),_0x2ca6dd[_0xb22f('0x32')]),util[_0xb22f('0x30')]('trigger:%s',_0x2676f3['action'][_0xb22f('0x33')]()),{'evt':_[_0xb22f('0x34')](_0x3473d4,{'autoCreate':_0x4bb02a}),'contact':_0x593330===undefined?{}:_0x593330,'contacts':_0x4b9e56[_0xb22f('0x22')]===0x0?undefined:_0x4b9e56});}});}; \ No newline at end of file +var _0x81bd=['Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','union','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','','calleridname'];(function(_0xb27327,_0x3a689b){var _0x1a2c2a=function(_0x589746){while(--_0x589746){_0xb27327['push'](_0xb27327['shift']());}};_0x1a2c2a(++_0x3a689b);}(_0x81bd,0x7c));var _0xd81b=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0x81bd[_0x39e15b];return _0x4e5766;};'use strict';var _=require(_0xd81b('0x0'));var BPromise=require(_0xd81b('0x1'));var Redis=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var config=require(_0xd81b('0x4'));var logger=require(_0xd81b('0x5'))(_0xd81b('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xd81b('0x7')]=_[_0xd81b('0x8')](config[_0xd81b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd81b('0x9'))(new Redis(config[_0xd81b('0x7')]));function emit(_0x1f3f2c,_0x562084,_0x5e14e8,_0xa4cf97,_0x5468d5){logger[_0xd81b('0xa')](_0xd81b('0xb'),_0x1f3f2c,_0x562084['id'],_0x5e14e8,_0xa4cf97,JSON[_0xd81b('0xc')](_0x5468d5));io['to'](_0x5e14e8)[_0xd81b('0xd')](_0xa4cf97,_0x5468d5);}exports[_0xd81b('0xe')]=function(_0x1ff60f,_0x4391be,_0x17e09f,_0x2090e1){var _0x23c789,_0x215b92;var _0x3914f7={};var _0x1afb8f=Number(_0x17e09f['data1']);var _0x21dfff=_0x17e09f['data2']?Boolean(Number(_0x17e09f[_0xd81b('0xf')])):![];var _0xe75568;var _0x5f0b6b=![];if(!_[_0xd81b('0x10')](_0x17e09f['data5'])){if(_0x17e09f[_0xd81b('0x11')]=='1')_0x5f0b6b=!![];}if(!_0x5f0b6b){if(_0x2090e1[_0xd81b('0x12')]){_0x3914f7['id']=_0x2090e1[_0xd81b('0x12')];}}if(!_0x3914f7['id']){_0x3914f7[_0xd81b('0x13')]=_0x1afb8f;_0xe75568=_0x17e09f[_0xd81b('0x14')]&&_0x17e09f['data3']!=='0'?_0x17e09f[_0xd81b('0x14')][_0xd81b('0x15')](','):['phone'];_0x3914f7[_0xd81b('0x16')]=_[_0xd81b('0x17')](_0xe75568,function(_0x4657cf){var _0x15e860={};_0x15e860[_0x4657cf]=_0x2090e1[_0xd81b('0x18')]?_0x2090e1[_0xd81b('0x19')]:_0x2090e1[_0xd81b('0x1a')];return _0x15e860;});}var _0x3d4d34=['id',_0xd81b('0x1b'),_0xd81b('0x1c'),_0xd81b('0x1d'),_0xd81b('0x1e'),_0xd81b('0x1f'),_0xd81b('0x13'),_0xd81b('0x20'),_0xd81b('0x21'),'updatedAt'];var _0x4d566e=_[_0xd81b('0x22')](_0x3d4d34,_0xe75568);BPromise[_0xd81b('0x23')]()[_0xd81b('0x24')](cmContactRpc['getContacts']({'attributes':_0x4d566e,'where':_0x3914f7}))[_0xd81b('0x24')](function(_0x6571a6){_0x215b92=_0x6571a6;if(!_['isEmpty'](_0x215b92)){if(_0x215b92[_0xd81b('0x25')]===0x1){_0x23c789=_0x215b92[0x0];logger[_0xd81b('0xa')](_0xd81b('0x26'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_0x23c789['id']);}else{logger[_0xd81b('0xa')](_0xd81b('0x28'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_[_0xd81b('0x17')](_0x215b92,'id')[_0xd81b('0x29')](','));}return;}else{logger[_0xd81b('0xa')](_0xd81b('0x2a'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);var _0x596389={'ListId':_0x1afb8f};var _0x28768f=_0x17e09f[_0xd81b('0x2b')]&&_0x17e09f[_0xd81b('0x2b')]!=='0'?_0x17e09f[_0xd81b('0x2b')]:_0xd81b('0x1d');if(_0x21dfff){logger[_0xd81b('0xa')](_0xd81b('0x2c'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);_0x596389[_0x28768f]=_[_0xd81b('0x10')](_0x2090e1['routeId'])?_0x2090e1[_0xd81b('0x1a')]:_0x2090e1['destcalleridnum'];if(_['isNil'](_0x2090e1[_0xd81b('0x18')])){_0x596389[_0xd81b('0x1b')]=_0x2090e1['calleridname']&&_0x2090e1['calleridname']!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x2e')]:_0xd81b('0x2f');}else{_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x30')]&&_0x2090e1[_0xd81b('0x30')]!==''?_0x2090e1[_0xd81b('0x30')]:_0xd81b('0x2f');}return BPromise['resolve']()['then'](cmContactRpc[_0xd81b('0x31')](_0x596389))[_0xd81b('0x24')](function(_0x50472a){_0x23c789=_0x50472a;_0x215b92['push'](_0x50472a);if(_0x23c789){logger['info'](_0xd81b('0x32'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_0x23c789['id']);}return;});}else{logger[_0xd81b('0xa')](_0xd81b('0x33'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);_0x596389[_0x28768f]=_[_0xd81b('0x10')](_0x2090e1[_0xd81b('0x18')])?_0x2090e1['calleridnum']:_0x2090e1[_0xd81b('0x19')];if(_['isNil'](_0x2090e1[_0xd81b('0x18')])){_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x2e')]&&_0x2090e1[_0xd81b('0x2e')]!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x2e')]:_0xd81b('0x2f');}else{_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x30')]&&_0x2090e1[_0xd81b('0x30')]!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x30')]:_0xd81b('0x2f');}_0x23c789=_0x596389;_0x215b92['push'](_0x596389);return;}}})['then'](function(){if(_0x1ff60f){emit(_0x2090e1[_0xd81b('0x27')],_0x4391be,util[_0xd81b('0x34')](_0xd81b('0x35'),_0x1ff60f['name']),util[_0xd81b('0x34')](_0xd81b('0x36'),_0x17e09f['action'][_0xd81b('0x37')]()),{'evt':_[_0xd81b('0x38')](_0x2090e1,{'autoCreate':_0x21dfff}),'contact':_0x23c789===undefined?{}:_0x23c789,'contacts':_0x215b92['length']===0x0?undefined:_0x215b92});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0927791..76e92c3 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 _0x84c6=['voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','status','checkTrigger','merge','variables','Actions','length','interface','action','contactmanager','data1','popup','TemplateId','html','data2','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winapp','winApplication','winArguments','name','trigger:%s:%s','toLowerCase','jscripty','format','user:%s','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','lastevent','mailSubstatus','null','substatus','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','triggers','agents'];(function(_0x447e28,_0x2ee1bd){var _0x2de911=function(_0x49aa94){while(--_0x49aa94){_0x447e28['push'](_0x447e28['shift']());}};_0x2de911(++_0x2ee1bd);}(_0x84c6,0x6d));var _0x684c=function(_0x49b38e,_0xbc8749){_0x49b38e=_0x49b38e-0x0;var _0x506a39=_0x84c6[_0x49b38e];return _0x506a39;};'use strict';var util=require(_0x684c('0x0'));var _=require(_0x684c('0x1'));var url=require(_0x684c('0x2'));var Mustache=require(_0x684c('0x3'));var Redis=require(_0x684c('0x4'));var urlforward=require(_0x684c('0x5'));var integration=require(_0x684c('0x6'));var cmContact=require(_0x684c('0x7'));var script=require(_0x684c('0x8'));var config=require(_0x684c('0x9'));var logger=require('../../../config/logger')(_0x684c('0xa'));var ami=require('../ami');config[_0x684c('0xb')]=_[_0x684c('0xc')](config[_0x684c('0xb')],{'host':_0x684c('0xd'),'port':0x18eb});var io=require(_0x684c('0xe'))(new Redis(config[_0x684c('0xb')]));var operators={'equals':function(_0x5e7e7b,_0x1926a0){return _0x5e7e7b==_0x1926a0;},'not_equals':function(_0x47d508,_0x369808){return _0x47d508!=_0x369808;}};var barAndWebActions=['popup',_0x684c('0x2'),'winapp'];function Trigger(_0x2ad027){this[_0x684c('0xf')]=_0x2ad027['triggers'];this[_0x684c('0x10')]=_0x2ad027[_0x684c('0x10')];this[_0x684c('0x11')]=_0x2ad027[_0x684c('0x11')];this[_0x684c('0x12')]=_0x2ad027[_0x684c('0x12')];this[_0x684c('0x13')]=_0x2ad027[_0x684c('0x13')];this[_0x684c('0x14')]=_0x2ad027['zendeskAccounts'];this['freshdeskAccounts']=_0x2ad027[_0x684c('0x15')];this[_0x684c('0x16')]=_0x2ad027[_0x684c('0x16')];this[_0x684c('0x17')]=_0x2ad027[_0x684c('0x17')];this['zohoAccounts']=_0x2ad027[_0x684c('0x18')];this[_0x684c('0x19')]=_0x2ad027[_0x684c('0x19')];this[_0x684c('0x1a')]=_0x2ad027['vtigerAccounts'];this[_0x684c('0x1b')]=_0x2ad027[_0x684c('0x1b')];this[_0x684c('0x1c')]=_0x2ad027['dynamics365Accounts'];this[_0x684c('0x1d')]=_0x2ad027['freshsalesAccounts'];this[_0x684c('0x1e')]={'zendesk':this[_0x684c('0x14')],'salesforce':this[_0x684c('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x684c('0x18')],'desk':this[_0x684c('0x19')],'vtiger':this[_0x684c('0x1a')],'dynamics365':this[_0x684c('0x1c')],'freshsales':this[_0x684c('0x1d')],'servicenow':this[_0x684c('0x1b')]};ami['on'](_0x684c('0x1f'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on']('custom:agentconnect',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent']['bind'](this));ami['on'](_0x684c('0x22'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x23'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x24'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x25'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x26'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0x684c('0x21')](this));ami['on'](_0x684c('0x27'),this[_0x684c('0x20')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x28'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x29'),this[_0x684c('0x2a')][_0x684c('0x21')](this));ami['on']('custom:dialconnect',this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0x684c('0x2a')]['bind'](this));ami['on']('custom:newinteraction',this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x2b'),this['syncCustomEvent'][_0x684c('0x21')](this));ami['on'](_0x684c('0x2c'),this[_0x684c('0x20')]['bind'](this));ami['on']('custom:incomingmessage',this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x2d'),this['syncCustomEvent'][_0x684c('0x21')](this));ami['on'](_0x684c('0x2e'),this[_0x684c('0x20')][_0x684c('0x21')](this));ami['on'](_0x684c('0x2f'),this[_0x684c('0x20')][_0x684c('0x21')](this));}Trigger[_0x684c('0x30')][_0x684c('0x31')]=function(_0xf4822c,_0x48a7c7,_0x37a80f){logger[_0x684c('0x32')](_0xf4822c,_0x48a7c7,JSON[_0x684c('0x33')](_0x37a80f));io['to'](_0xf4822c)[_0x684c('0x31')](_0x48a7c7,_0x37a80f);};Trigger['prototype'][_0x684c('0x20')]=function(_0x58bbb2){var _0x541167=_[_0x684c('0x34')](_0x58bbb2);if(typeof _0x541167[_0x684c('0x35')]===_0x684c('0x36')){_0x541167['motionChannel']=_0x684c('0x37');}this[_0x684c('0x38')](_0x541167);};Trigger[_0x684c('0x30')][_0x684c('0x2a')]=function(_0x51391b){if(this[_0x684c('0x10')][_0x51391b['interface']]){this[_0x684c('0x20')](_0x51391b);}};Trigger[_0x684c('0x30')][_0x684c('0x38')]=function(_0x48306f){var _0x3e8cf5;for(var _0x17202e in this[_0x684c('0xf')]){if(this[_0x684c('0xf')]['hasOwnProperty'](_0x17202e)){if(this[_0x684c('0xf')][_0x17202e][_0x684c('0x39')]){_0x3e8cf5=this[_0x684c('0x3a')](this[_0x684c('0xf')][_0x17202e],_0x48306f);if(_0x3e8cf5){_[_0x684c('0x3b')](_0x48306f,_0x48306f[_0x684c('0x3c')]);for(var _0x46095c=0x0,_0x253781,_0x4ca21b,_0x20178a;_0x46095c0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x2699fa,_0x5432db){var _0x43e734=function(_0x4f1938){while(--_0x4f1938){_0x2699fa['push'](_0x2699fa['shift']());}};_0x43e734(++_0x5432db);}(_0x7217,0x19e));var _0x7721=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7217[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ 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 72090b5..2dbac8e 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 _0xc7eb=['systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','value','contactid','info',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','Fields','phonecall','assign','/contacts(','queue','callDirection','format','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','email','userEmail','length','internalemailaddress','toUpperCase',']\x20Agent\x20found\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7eb,0xa4));var _0xbc7e=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xc7eb[_0x1a0ef3];return _0x2b86da;};'use strict';var _=require(_0xbc7e('0x0'));var BPromise=require(_0xbc7e('0x1'));var rp=require(_0xbc7e('0x2'));var util=require(_0xbc7e('0x3'));var intUtil=require(_0xbc7e('0x4'));var md5=require(_0xbc7e('0x5'));var Redis=require(_0xbc7e('0x6'));var logger=require('../../../../config/logger')(_0xbc7e('0x7'));var config=require(_0xbc7e('0x8'));config[_0xbc7e('0x9')]=_[_0xbc7e('0xa')](config[_0xbc7e('0x9')],{'host':_0xbc7e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbc7e('0x9')]));function getAuthToken(_0x3e4474,_0x2787d0,_0x224f98){var _0x324efd={'method':_0xbc7e('0xc'),'uri':_0x2787d0,'form':{'client_id':_0x3e4474[_0xbc7e('0xd')],'resource':_0x3e4474[_0xbc7e('0xe')],'username':_0x3e4474[_0xbc7e('0xf')],'password':_0x3e4474[_0xbc7e('0x10')],'grant_type':'password','client_secret':_0x3e4474[_0xbc7e('0x11')]},'json':!![]};return rp(_0x324efd)[_0xbc7e('0x12')](function(_0x1660ec){return _0x1660ec[_0xbc7e('0x13')];})[_0xbc7e('0x14')](function(_0x2b7030){logger[_0xbc7e('0x15')]('['+[_0x224f98['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x2b7030[_0xbc7e('0x16')];});}function getUser(_0x5f4ac0,_0x481236,_0x1a09cd,_0x45e359,_0x179035,_0x72e759){return new BPromise(function(_0x12993d,_0x54a45c){return getAuthToken(_0x481236,_0x45e359,_0x72e759)['then'](function(_0x173875){var _0x2d12f6={'method':_0xbc7e('0x17'),'uri':_0x179035+_0xbc7e('0x18'),'headers':{'Authorization':_0xbc7e('0x19')+_0x173875,'OData-Version':_0xbc7e('0x1a')},'json':!![]};return rp(_0x2d12f6);})[_0xbc7e('0x12')](function(_0x37c7c5){var _0x25c4fb=_0x37c7c5['value'];var _0x534813=![];var _0x5941c7=null;if(!_[_0xbc7e('0x1b')](_0x1a09cd)){if(intUtil['validateEmail'](_0x1a09cd[_0xbc7e('0x1c')])){_0x5f4ac0[_0xbc7e('0x1d')]=_0x1a09cd['email'];for(_0x5941c7=0x0;_0x5941c7<_0x25c4fb[_0xbc7e('0x1e')];_0x5941c7++){if(_0x25c4fb[_0x5941c7][_0xbc7e('0x1f')]===_0x1a09cd[_0xbc7e('0x1c')]&&!_0x25c4fb[_0x5941c7]['isdisabled']){_0x534813=!![];logger['info']('['+[_0x72e759[_0xbc7e('0x20')]()]+_0xbc7e('0x21')+_0x25c4fb[_0x5941c7][_0xbc7e('0x22')]+'!');_0x5f4ac0[_0xbc7e('0x23')]=_0x25c4fb[_0x5941c7]['systemuserid'];}}}}if(!_0x534813){logger['info']('['+[_0x72e759[_0xbc7e('0x20')]()]+_0xbc7e('0x24'));_0x5f4ac0[_0xbc7e('0x1d')]=_0x481236[_0xbc7e('0xf')];for(_0x5941c7=0x0;_0x5941c7<_0x25c4fb[_0xbc7e('0x1e')];_0x5941c7++){if(_0x25c4fb[_0x5941c7]['internalemailaddress']===_0x481236['username']){_0x5f4ac0[_0xbc7e('0x23')]=_0x25c4fb[_0x5941c7][_0xbc7e('0x22')];}}}_0x12993d(_0x5f4ac0);})[_0xbc7e('0x14')](function(_0x3fb880){_0x54a45c(_0x3fb880[_0xbc7e('0x16')]);});});}function createEndUser(_0x10aa04,_0x2f1ac2,_0x1f15b3,_0x47d84a,_0x3ce2bc,_0xc1bd75){return new BPromise(function(_0x57741b,_0x359f5c){return getAuthToken(_0x2f1ac2,_0x1f15b3,_0xc1bd75)['then'](function(_0x256022){var _0x29d211=_0xc1bd75[_0xbc7e('0x25')]()===_0xbc7e('0x26')?_0x3ce2bc[_0xbc7e('0x27')]:_0x3ce2bc['calleridnum'];var _0x5f5d2b={'method':_0xbc7e('0xc'),'uri':_0x47d84a+_0xbc7e('0x28'),'body':{'telephone1':_0x29d211,'fullname':_0x29d211,'firstname':_0x29d211,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbc7e('0x29')+_0x10aa04['userId']+')'},'headers':{'Authorization':_0xbc7e('0x19')+_0x256022,'OData-Version':_0xbc7e('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5f5d2b);})[_0xbc7e('0x12')](function(_0x85eeb1){var _0x2cab8f=_0x85eeb1['headers'][_0xbc7e('0x2a')];var _0x5df38e=_0x2cab8f[_0xbc7e('0x2b')](_0x2cab8f[_0xbc7e('0x2c')]('(')+0x1,_0x2cab8f[_0xbc7e('0x2c')](')'));_0x10aa04[_0xbc7e('0x2d')]=_0x5df38e;_0x57741b(_0x10aa04);})[_0xbc7e('0x14')](function(_0x55df91){_0x359f5c(_0x55df91['message']);});});}function getEndUser(_0x354631,_0x45aa75,_0xca47a8,_0x487354,_0x10a6a,_0x5c9536){return new BPromise(function(_0x57e1fc,_0x11e96c){var _0x577cb3=_0x5c9536['toLowerCase']()===_0xbc7e('0x26')?_0x10a6a[_0xbc7e('0x27')]:_0x10a6a[_0xbc7e('0x2e')];return getAuthToken(_0x45aa75,_0xca47a8,_0x5c9536)[_0xbc7e('0x12')](function(_0x459cb4){var _0x1beddb={'method':_0xbc7e('0x17'),'uri':_0x487354+_0xbc7e('0x2f')+_0x577cb3['replace']('+',_0xbc7e('0x30'))+'\x27','headers':{'Authorization':_0xbc7e('0x19')+_0x459cb4,'If-None-Match':null,'OData-Version':_0xbc7e('0x1a')},'json':!![]};return rp(_0x1beddb);})[_0xbc7e('0x12')](function(_0x2a2dad){var _0xd7349c=null;if(_0x2a2dad){var _0xfe7bfa=_0x2a2dad[_0xbc7e('0x31')];var _0x1cdf72=![];for(_0xd7349c=0x0;_0xd7349c<_0xfe7bfa[_0xbc7e('0x1e')];_0xd7349c++){if(_0xfe7bfa[_0xd7349c]['telephone1']===_0x577cb3){_0x1cdf72=!![];_0x354631['enduserId']=_0xfe7bfa[_0xd7349c][_0xbc7e('0x32')];}}if(_0x1cdf72){_0x57e1fc(_0x354631);}else{return createEndUser(_0x354631,_0x45aa75,_0xca47a8,_0x487354,_0x10a6a,_0x5c9536)['then'](function(_0x369fd){logger[_0xbc7e('0x33')]('['+[_0x5c9536['toUpperCase']()]+_0xbc7e('0x34'),_0x369fd[_0xbc7e('0x2d')]);_0x57e1fc(_0x369fd);});}}else{return createEndUser(_0x354631,_0x45aa75,_0xca47a8,_0x487354,_0x10a6a,_0x5c9536)[_0xbc7e('0x12')](function(_0x49d070){logger[_0xbc7e('0x33')]('['+[_0x5c9536[_0xbc7e('0x20')]()]+_0xbc7e('0x35'),_0x49d070[_0xbc7e('0x2d')]);_0x57e1fc(_0x49d070);});}});});}function getCustomFields(_0x3b693f,_0x4673b3,_0x26f931){var _0x41577d={};if(_0x3b693f[_0xbc7e('0x1e')]>0x0){_[_0xbc7e('0x36')](_0x3b693f,function(_0x1ba317){if(_[_0xbc7e('0x37')]([_0xbc7e('0x38'),_0xbc7e('0x39')],_0x1ba317[_0xbc7e('0x3a')])&&_0x1ba317[_0xbc7e('0x3b')]&&!_0x1ba317[_0xbc7e('0x3c')]){var _0x5e384a=_0x1ba317[_0xbc7e('0x3d')]['toLowerCase']();var _0x4fb91e=_0x5e384a[_0xbc7e('0x2b')](0x0,_0x5e384a[_0xbc7e('0x3e')]('_'));var _0x55a87a=_0x5e384a[_0xbc7e('0x2b')](_0x5e384a[_0xbc7e('0x3e')]('_')+0x1);if(_0x4fb91e===_0x26f931){_0x41577d[_0x55a87a]=_0x1ba317[_0xbc7e('0x3f')];}}});}return _0x41577d;}function getTicket(_0x3e3178,_0x89e3f1,_0x50b037,_0x3f62a2,_0x22b0be,_0x2f5604,_0x306d54){return new BPromise(function(_0x3f8651,_0x51bdad){var _0xf7348f;return getAuthToken(_0x89e3f1,_0x50b037,_0x306d54)['then'](function(_0x561cbe){if(_0x2f5604[_0xbc7e('0x40')]===_0xbc7e('0x41')){_0xf7348f={'method':'POST','uri':_0x3f62a2+_0xbc7e('0x42'),'body':Object['assign']({},{'title':intUtil[_0xbc7e('0x43')](_0x2f5604[_0xbc7e('0x44')],_0x22b0be,'\x20'),'description':intUtil[_0xbc7e('0x43')](_0x2f5604[_0xbc7e('0x45')],_0x22b0be,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x3e3178[_0xbc7e('0x2d')]+')','ownerid@odata.bind':_0xbc7e('0x29')+_0x3e3178[_0xbc7e('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x2f5604[_0xbc7e('0x46')],_0x22b0be,_0x2f5604[_0xbc7e('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x561cbe,'OData-Version':_0xbc7e('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f5604[_0xbc7e('0x40')]===_0xbc7e('0x47')){_0xf7348f={'method':'POST','uri':_0x3f62a2+'phonecalls','body':Object[_0xbc7e('0x48')]({},{'subject':intUtil[_0xbc7e('0x43')](_0x2f5604[_0xbc7e('0x44')],_0x22b0be,'\x20'),'phonenumber':String(_0x22b0be[_0xbc7e('0x2e')]),'description':intUtil['getString'](_0x2f5604[_0xbc7e('0x45')],_0x22b0be,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbc7e('0x49')+_0x3e3178[_0xbc7e('0x2d')]+')','ownerid@odata.bind':_0xbc7e('0x29')+_0x3e3178[_0xbc7e('0x23')]+')','directioncode':_0x3e3178['callDirection']===_0xbc7e('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3e3178[_0xbc7e('0x23')]+')','participationtypemask':_0x3e3178[_0xbc7e('0x4b')]===_0xbc7e('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xbc7e('0x49')+_0x3e3178['enduserId']+')','participationtypemask':_0x3e3178[_0xbc7e('0x4b')]===_0xbc7e('0x4a')?0x1:0x2}]},getCustomFields(_0x2f5604['Fields'],_0x22b0be,_0x2f5604[_0xbc7e('0x40')])),'headers':{'Authorization':_0xbc7e('0x19')+_0x561cbe,'OData-Version':_0xbc7e('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xf7348f);})['then'](function(_0x3d0be2){var _0x51bc12=_0x3d0be2['headers'][_0xbc7e('0x2a')];var _0x184c5f=_0x51bc12[_0xbc7e('0x2b')](_0x51bc12[_0xbc7e('0x2c')]('(')+0x1,_0x51bc12[_0xbc7e('0x2c')](')'));_0x3e3178['ticketId']=_0x184c5f;_0x3f8651(_0x3e3178);})[_0xbc7e('0x14')](function(_0x3189d5){_0x51bdad(_0x3189d5['message']);});});}function emit(_0x22c601,_0x2038cd,_0x1b4845,_0x41669d){var _0x26d067={'uri':util[_0xbc7e('0x4c')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x22c601,_0x1b4845,_0x41669d)};io['to'](util[_0xbc7e('0x4c')]('user:%s',_0x2038cd))['emit'](_0xbc7e('0x4d'),_0x26d067);}exports['cs']=function(_0x5e533a,_0x347175,_0x51c9b4,_0x43fc29,_0x6b5ade,_0x35d7b9,_0x19ee16,_0x4e900e){var _0x178e94={};_0x35d7b9[_0xbc7e('0xe')]=intUtil['stripTrailingSlash'](_0x35d7b9['remoteUri']);_0x35d7b9['serverUrl']=intUtil[_0xbc7e('0x4e')](_0x35d7b9['serverUrl']);_0x178e94[_0xbc7e('0x4b')]=_0x4e900e==='queue'||_0x4e900e===_0xbc7e('0x4f')?'queue':'outbound';var _0x246427=util[_0xbc7e('0x4c')](_0xbc7e('0x50'),_0x35d7b9[_0xbc7e('0xe')]);var _0x43c5e8=util[_0xbc7e('0x4c')](_0xbc7e('0x51'),_0x35d7b9[_0xbc7e('0x52')]);var _0x4a1518=util[_0xbc7e('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7b9[_0xbc7e('0x53')],_0x347175[_0xbc7e('0x54')],md5(_0x347175[_0xbc7e('0x54')]));if(_0x6b5ade&&_0x6b5ade[_0xbc7e('0x55')]){logger['info'](_0xbc7e('0x56'),_0xbc7e('0x57'));_0x347175['recordingURL']=_0x4a1518;}else if(_0x19ee16&&_0x19ee16['recordingFormat']&&_0x19ee16[_0xbc7e('0x58')]!==_0xbc7e('0x59')){logger[_0xbc7e('0x33')](_0xbc7e('0x5a'),_0xbc7e('0x57'));_0x347175[_0xbc7e('0x5b')]=_0x4a1518;}else{_0x347175['recordingURL']='';}return getUser(_0x178e94,_0x35d7b9,_0x43fc29,_0x43c5e8,_0x246427,_0x4e900e)[_0xbc7e('0x12')](function(_0x147aca){logger['info']('['+_0x4e900e['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x147aca[_0xbc7e('0x23')]);logger['info']('['+_0x4e900e[_0xbc7e('0x20')]()+_0xbc7e('0x5c'),_0x147aca[_0xbc7e('0x1d')]);return getEndUser(_0x147aca,_0x35d7b9,_0x43c5e8,_0x246427,_0x347175,_0x4e900e);})['then'](function(_0x2118ea){logger[_0xbc7e('0x33')]('['+_0x4e900e[_0xbc7e('0x20')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2118ea[_0xbc7e('0x2d')]);logger['info']('['+_0x4e900e[_0xbc7e('0x20')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x347175['calleridnum']);return getTicket(_0x2118ea,_0x35d7b9,_0x43c5e8,_0x246427,_0x347175,_0x51c9b4,_0x4e900e);})[_0xbc7e('0x12')](function(_0x2f1f43){logger['info'](util[_0xbc7e('0x4c')]('['+_0x4e900e['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x51c9b4[_0xbc7e('0x40')],_0x2f1f43['ticketId']));logger[_0xbc7e('0x33')](util['format']('['+_0x4e900e['toUpperCase']()+_0xbc7e('0x5d'),_0x4e900e));if(_0x4e900e!=='unmanaged'){logger[_0xbc7e('0x33')]('['+_0x4e900e[_0xbc7e('0x20')]()+']',_0xbc7e('0x5e'));emit(_0x35d7b9['remoteUri'],_0x43fc29[_0xbc7e('0x5f')],_0x51c9b4[_0xbc7e('0x40')],_0x2f1f43[_0xbc7e('0x60')]);}})[_0xbc7e('0x14')](function(_0x4d6e2f){logger[_0xbc7e('0x15')]('['+_0x4e900e['toUpperCase']()+_0xbc7e('0x61'),util[_0xbc7e('0x62')](_0x4d6e2f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe1b7=[']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','telephone1','contactid',']\x20Enduser\x20Created!','forEach','includes','string','type','nameField','customField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','queue','callDirection','ticketId','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','username','password','clientSecret','then','catch','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase','userId'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xe1b7,0x1bb));var _0x7e1b=function(_0x4da7ca,_0x41433d){_0x4da7ca=_0x4da7ca-0x0;var _0x427306=_0xe1b7[_0x4da7ca];return _0x427306;};'use strict';var _=require(_0x7e1b('0x0'));var BPromise=require('bluebird');var rp=require(_0x7e1b('0x1'));var util=require(_0x7e1b('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x7e1b('0x3'));var logger=require(_0x7e1b('0x4'))(_0x7e1b('0x5'));var config=require(_0x7e1b('0x6'));config[_0x7e1b('0x7')]=_[_0x7e1b('0x8')](config[_0x7e1b('0x7')],{'host':_0x7e1b('0x9'),'port':0x18eb});var io=require(_0x7e1b('0xa'))(new Redis(config[_0x7e1b('0x7')]));function getAuthToken(_0x217eca,_0x3e5c53,_0x5a47aa){var _0x1a173e={'method':_0x7e1b('0xb'),'uri':_0x3e5c53,'form':{'client_id':_0x217eca['clientId'],'resource':_0x217eca[_0x7e1b('0xc')],'username':_0x217eca[_0x7e1b('0xd')],'password':_0x217eca[_0x7e1b('0xe')],'grant_type':'password','client_secret':_0x217eca[_0x7e1b('0xf')]},'json':!![]};return rp(_0x1a173e)[_0x7e1b('0x10')](function(_0x735311){return _0x735311['access_token'];})[_0x7e1b('0x11')](function(_0x24608d){logger['error']('['+[_0x5a47aa['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x24608d[_0x7e1b('0x12')];});}function getUser(_0x33259e,_0x22291f,_0x2dfa68,_0x2c6a59,_0xb021de,_0x5e4a08){return new BPromise(function(_0x1ee1dd,_0x4290ae){return getAuthToken(_0x22291f,_0x2c6a59,_0x5e4a08)['then'](function(_0x2376fe){var _0x5568a5={'method':_0x7e1b('0x13'),'uri':_0xb021de+_0x7e1b('0x14'),'headers':{'Authorization':'Bearer\x20'+_0x2376fe,'OData-Version':_0x7e1b('0x15')},'json':!![]};return rp(_0x5568a5);})[_0x7e1b('0x10')](function(_0x594976){var _0x4d17e4=_0x594976['value'];var _0x1fb132=![];var _0x274153=null;if(!_[_0x7e1b('0x16')](_0x2dfa68)){if(intUtil[_0x7e1b('0x17')](_0x2dfa68[_0x7e1b('0x18')])){_0x33259e[_0x7e1b('0x19')]=_0x2dfa68['email'];for(_0x274153=0x0;_0x274153<_0x4d17e4[_0x7e1b('0x1a')];_0x274153++){if(_0x4d17e4[_0x274153][_0x7e1b('0x1b')]===_0x2dfa68[_0x7e1b('0x18')]&&!_0x4d17e4[_0x274153][_0x7e1b('0x1c')]){_0x1fb132=!![];logger[_0x7e1b('0x1d')]('['+[_0x5e4a08[_0x7e1b('0x1e')]()]+']\x20Agent\x20found\x20'+_0x4d17e4[_0x274153]['systemuserid']+'!');_0x33259e[_0x7e1b('0x1f')]=_0x4d17e4[_0x274153]['systemuserid'];}}}}if(!_0x1fb132){logger[_0x7e1b('0x1d')]('['+[_0x5e4a08[_0x7e1b('0x1e')]()]+_0x7e1b('0x20'));_0x33259e['userEmail']=_0x22291f[_0x7e1b('0xd')];for(_0x274153=0x0;_0x274153<_0x4d17e4[_0x7e1b('0x1a')];_0x274153++){if(_0x4d17e4[_0x274153][_0x7e1b('0x1b')]===_0x22291f[_0x7e1b('0xd')]){_0x33259e[_0x7e1b('0x1f')]=_0x4d17e4[_0x274153][_0x7e1b('0x21')];}}}_0x1ee1dd(_0x33259e);})[_0x7e1b('0x11')](function(_0x47901d){_0x4290ae(_0x47901d[_0x7e1b('0x12')]);});});}function createEndUser(_0x6bd621,_0x50613f,_0x12cc87,_0x5111b3,_0xad3331,_0x555fdf){return new BPromise(function(_0x2dcb5f,_0x25146e){return getAuthToken(_0x50613f,_0x12cc87,_0x555fdf)[_0x7e1b('0x10')](function(_0x503c87){var _0x193b16=_0x555fdf[_0x7e1b('0x22')]()===_0x7e1b('0x23')?_0xad3331[_0x7e1b('0x24')]:_0xad3331[_0x7e1b('0x25')];var _0x3cc850={'method':_0x7e1b('0xb'),'uri':_0x5111b3+'contacts','body':{'telephone1':_0x193b16,'fullname':_0x193b16,'firstname':_0x193b16,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7e1b('0x26')+_0x6bd621[_0x7e1b('0x1f')]+')'},'headers':{'Authorization':_0x7e1b('0x27')+_0x503c87,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3cc850);})['then'](function(_0x4acede){var _0x5b7f01=_0x4acede[_0x7e1b('0x28')][_0x7e1b('0x29')];var _0x2ed203=_0x5b7f01[_0x7e1b('0x2a')](_0x5b7f01[_0x7e1b('0x2b')]('(')+0x1,_0x5b7f01[_0x7e1b('0x2b')](')'));_0x6bd621[_0x7e1b('0x2c')]=_0x2ed203;_0x2dcb5f(_0x6bd621);})[_0x7e1b('0x11')](function(_0x2cb322){_0x25146e(_0x2cb322['message']);});});}function getEndUser(_0x418629,_0xdec996,_0x4d4327,_0x196909,_0x26a766,_0x2f2281){return new BPromise(function(_0x5de73c,_0x333b62){var _0x3c2e94=_0x2f2281['toLowerCase']()===_0x7e1b('0x23')?_0x26a766[_0x7e1b('0x24')]:_0x26a766[_0x7e1b('0x25')];return getAuthToken(_0xdec996,_0x4d4327,_0x2f2281)[_0x7e1b('0x10')](function(_0x209378){var _0x329f49={'method':_0x7e1b('0x13'),'uri':_0x196909+_0x7e1b('0x2d')+_0x3c2e94[_0x7e1b('0x2e')]('+',_0x7e1b('0x2f'))+'\x27','headers':{'Authorization':_0x7e1b('0x27')+_0x209378,'If-None-Match':null,'OData-Version':_0x7e1b('0x15')},'json':!![]};return rp(_0x329f49);})[_0x7e1b('0x10')](function(_0x32120a){var _0x5bbaeb=null;if(_0x32120a){var _0x460e91=_0x32120a[_0x7e1b('0x30')];var _0x4160fa=![];for(_0x5bbaeb=0x0;_0x5bbaeb<_0x460e91['length'];_0x5bbaeb++){if(_0x460e91[_0x5bbaeb][_0x7e1b('0x31')]===_0x3c2e94){_0x4160fa=!![];_0x418629[_0x7e1b('0x2c')]=_0x460e91[_0x5bbaeb][_0x7e1b('0x32')];}}if(_0x4160fa){_0x5de73c(_0x418629);}else{return createEndUser(_0x418629,_0xdec996,_0x4d4327,_0x196909,_0x26a766,_0x2f2281)[_0x7e1b('0x10')](function(_0x2f9a3d){logger[_0x7e1b('0x1d')]('['+[_0x2f2281[_0x7e1b('0x1e')]()]+']\x20Enduser\x20created!',_0x2f9a3d[_0x7e1b('0x2c')]);_0x5de73c(_0x2f9a3d);});}}else{return createEndUser(_0x418629,_0xdec996,_0x4d4327,_0x196909,_0x26a766,_0x2f2281)['then'](function(_0x206a7b){logger[_0x7e1b('0x1d')]('['+[_0x2f2281[_0x7e1b('0x1e')]()]+_0x7e1b('0x33'),_0x206a7b[_0x7e1b('0x2c')]);_0x5de73c(_0x206a7b);});}});});}function getCustomFields(_0x404a1d,_0x5dcfa8,_0x4abf70){var _0x2096b8={};if(_0x404a1d[_0x7e1b('0x1a')]>0x0){_[_0x7e1b('0x34')](_0x404a1d,function(_0x38d1a4){if(_[_0x7e1b('0x35')]([_0x7e1b('0x36'),'picklist'],_0x38d1a4[_0x7e1b('0x37')])&&_0x38d1a4[_0x7e1b('0x38')]&&!_0x38d1a4[_0x7e1b('0x39')]){var _0x3f5919=_0x38d1a4['idField'][_0x7e1b('0x22')]();var _0x44d38f=_0x3f5919[_0x7e1b('0x2a')](0x0,_0x3f5919[_0x7e1b('0x3a')]('_'));var _0x178fa9=_0x3f5919['substring'](_0x3f5919[_0x7e1b('0x3a')]('_')+0x1);if(_0x44d38f===_0x4abf70){_0x2096b8[_0x178fa9]=_0x38d1a4[_0x7e1b('0x3b')];}}});}return _0x2096b8;}function getTicket(_0x3f76e0,_0x18c9e7,_0xa50c49,_0x5b0c14,_0x39ee21,_0x2fc0ee,_0x3224a0){return new BPromise(function(_0x5d5018,_0x317cd5){var _0x308ebd;return getAuthToken(_0x18c9e7,_0xa50c49,_0x3224a0)[_0x7e1b('0x10')](function(_0x481785){if(_0x2fc0ee['ticketType']===_0x7e1b('0x3c')){_0x308ebd={'method':_0x7e1b('0xb'),'uri':_0x5b0c14+_0x7e1b('0x3d'),'body':Object[_0x7e1b('0x3e')]({},{'title':intUtil[_0x7e1b('0x3f')](_0x2fc0ee[_0x7e1b('0x40')],_0x39ee21,'\x20'),'description':intUtil['getString'](_0x2fc0ee[_0x7e1b('0x41')],_0x39ee21,'\x0a'),'customerid_contact@odata.bind':_0x7e1b('0x42')+_0x3f76e0[_0x7e1b('0x2c')]+')','ownerid@odata.bind':_0x7e1b('0x26')+_0x3f76e0[_0x7e1b('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x2fc0ee[_0x7e1b('0x43')],_0x39ee21,_0x2fc0ee[_0x7e1b('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x481785,'OData-Version':_0x7e1b('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2fc0ee[_0x7e1b('0x44')]===_0x7e1b('0x45')){_0x308ebd={'method':_0x7e1b('0xb'),'uri':_0x5b0c14+_0x7e1b('0x46'),'body':Object[_0x7e1b('0x3e')]({},{'subject':intUtil[_0x7e1b('0x3f')](_0x2fc0ee['Subjects'],_0x39ee21,'\x20'),'phonenumber':String(_0x39ee21[_0x7e1b('0x25')]),'description':intUtil[_0x7e1b('0x3f')](_0x2fc0ee[_0x7e1b('0x41')],_0x39ee21,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x3f76e0[_0x7e1b('0x2c')]+')','ownerid@odata.bind':_0x7e1b('0x26')+_0x3f76e0[_0x7e1b('0x1f')]+')','directioncode':_0x3f76e0['callDirection']===_0x7e1b('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x7e1b('0x26')+_0x3f76e0[_0x7e1b('0x1f')]+')','participationtypemask':_0x3f76e0['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x7e1b('0x42')+_0x3f76e0['enduserId']+')','participationtypemask':_0x3f76e0[_0x7e1b('0x48')]===_0x7e1b('0x47')?0x1:0x2}]},getCustomFields(_0x2fc0ee[_0x7e1b('0x43')],_0x39ee21,_0x2fc0ee[_0x7e1b('0x44')])),'headers':{'Authorization':_0x7e1b('0x27')+_0x481785,'OData-Version':_0x7e1b('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x308ebd);})['then'](function(_0xd954f7){var _0x22e924=_0xd954f7['headers']['odata-entityid'];var _0x4cf019=_0x22e924[_0x7e1b('0x2a')](_0x22e924['lastIndexOf']('(')+0x1,_0x22e924['lastIndexOf'](')'));_0x3f76e0[_0x7e1b('0x49')]=_0x4cf019;_0x5d5018(_0x3f76e0);})[_0x7e1b('0x11')](function(_0x35b4aa){_0x317cd5(_0x35b4aa['message']);});});}function emit(_0xaf51e2,_0x68a0ac,_0x1a5c67,_0x12e45a){var _0x13d8d2={'uri':util[_0x7e1b('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xaf51e2,_0x1a5c67,_0x12e45a)};io['to'](util['format'](_0x7e1b('0x4b'),_0x68a0ac))[_0x7e1b('0x4c')]('trigger:browser:url',_0x13d8d2);}exports['cs']=function(_0xd21af7,_0x4b6fb5,_0x582c0,_0x25159c,_0x48c0f7,_0x172017,_0x42a40b,_0x53d305){var _0x179951={};_0x172017[_0x7e1b('0xc')]=intUtil['stripTrailingSlash'](_0x172017[_0x7e1b('0xc')]);_0x172017['serverUrl']=intUtil[_0x7e1b('0x4d')](_0x172017[_0x7e1b('0x4e')]);_0x179951[_0x7e1b('0x48')]=_0x53d305===_0x7e1b('0x47')||_0x53d305===_0x7e1b('0x4f')?_0x7e1b('0x47'):'outbound';var _0x896813=util[_0x7e1b('0x4a')]('%s/api/data/v9.0/',_0x172017['remoteUri']);var _0x56ba3e=util[_0x7e1b('0x4a')]('https://login.microsoftonline.com/%s/oauth2/token',_0x172017['tenantId']);var _0x476bc4=util[_0x7e1b('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x172017['serverUrl'],_0x4b6fb5[_0x7e1b('0x50')],md5(_0x4b6fb5[_0x7e1b('0x50')]));if(_0x48c0f7&&_0x48c0f7['monitor_format']){logger[_0x7e1b('0x1d')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4b6fb5[_0x7e1b('0x51')]=_0x476bc4;}else if(_0x42a40b&&_0x42a40b[_0x7e1b('0x52')]&&_0x42a40b[_0x7e1b('0x52')]!==_0x7e1b('0x53')){logger[_0x7e1b('0x1d')](_0x7e1b('0x54'),_0x7e1b('0x55'));_0x4b6fb5[_0x7e1b('0x51')]=_0x476bc4;}else{_0x4b6fb5[_0x7e1b('0x51')]='';}return getUser(_0x179951,_0x172017,_0x25159c,_0x56ba3e,_0x896813,_0x53d305)['then'](function(_0x610749){logger[_0x7e1b('0x1d')]('['+_0x53d305['toUpperCase']()+_0x7e1b('0x56'),_0x610749[_0x7e1b('0x1f')]);logger['info']('['+_0x53d305[_0x7e1b('0x1e')]()+_0x7e1b('0x57'),_0x610749[_0x7e1b('0x19')]);return getEndUser(_0x610749,_0x172017,_0x56ba3e,_0x896813,_0x4b6fb5,_0x53d305);})['then'](function(_0x2892ec){logger[_0x7e1b('0x1d')]('['+_0x53d305[_0x7e1b('0x1e')]()+_0x7e1b('0x58'),_0x2892ec[_0x7e1b('0x2c')]);logger[_0x7e1b('0x1d')]('['+_0x53d305[_0x7e1b('0x1e')]()+_0x7e1b('0x59'),_0x4b6fb5[_0x7e1b('0x25')]);return getTicket(_0x2892ec,_0x172017,_0x56ba3e,_0x896813,_0x4b6fb5,_0x582c0,_0x53d305);})[_0x7e1b('0x10')](function(_0x46ae05){logger[_0x7e1b('0x1d')](util[_0x7e1b('0x4a')]('['+_0x53d305[_0x7e1b('0x1e')]()+_0x7e1b('0x5a'),_0x582c0[_0x7e1b('0x44')],_0x46ae05['ticketId']));logger['info'](util[_0x7e1b('0x4a')]('['+_0x53d305[_0x7e1b('0x1e')]()+_0x7e1b('0x5b'),_0x53d305));if(_0x53d305!==_0x7e1b('0x4f')){logger['info']('['+_0x53d305[_0x7e1b('0x1e')]()+']',_0x7e1b('0x5c'));emit(_0x172017[_0x7e1b('0xc')],_0x25159c[_0x7e1b('0x5d')],_0x582c0[_0x7e1b('0x44')],_0x46ae05[_0x7e1b('0x49')]);}})[_0x7e1b('0x11')](function(_0x29393b){logger['error']('['+_0x53d305[_0x7e1b('0x1e')]()+_0x7e1b('0x5e'),util['inspect'](_0x29393b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 245344a..f55fbf1 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 _0x5f9e=['email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','customField','push','idField','content','variable','variableName','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','[OUTBOUND]','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find'];(function(_0x4d3f73,_0x4e224a){var _0x5e5c02=function(_0x111d68){while(--_0x111d68){_0x4d3f73['push'](_0x4d3f73['shift']());}};_0x5e5c02(++_0x4e224a);}(_0x5f9e,0x151));var _0xe5f9=function(_0x3d5db9,_0x2dbe0a){_0x3d5db9=_0x3d5db9-0x0;var _0x3c114c=_0x5f9e[_0x3d5db9];return _0x3c114c;};'use strict';var _=require(_0xe5f9('0x0'));var rp=require(_0xe5f9('0x1'));var md5=require(_0xe5f9('0x2'));var util=require(_0xe5f9('0x3'));var Redis=require(_0xe5f9('0x4'));var intUtil=require(_0xe5f9('0x5'));var config=require(_0xe5f9('0x6'));var logger=require(_0xe5f9('0x7'))('freshdesk');config['redis']=_[_0xe5f9('0x8')](config[_0xe5f9('0x9')],{'host':_0xe5f9('0xa'),'port':0x18eb});var io=require(_0xe5f9('0xb'))(new Redis(config[_0xe5f9('0x9')]));var headers={'Content-Type':_0xe5f9('0xc'),'Accept':_0xe5f9('0xc')};function emit(_0x1aee3f,_0x20c636,_0x3e10f9){io['to'](_0x1aee3f)[_0xe5f9('0xd')](_0x20c636,_0x3e10f9);}function getTicket(_0x2fd329,_0x3f6931,_0x19fd93,_0x583ed3,_0xe3fdae){logger[_0xe5f9('0xe')](_0xe5f9('0xf'));var _0xc3e8ad=_[_0xe5f9('0x10')]({'responder_id':_0x3f6931['id'],'requester_id':_0x19fd93['id'],'name':util[_0xe5f9('0x11')](_0xe5f9('0x12'),_0xe3fdae[_0xe5f9('0x13')]),'phone':_0xe3fdae[_0xe5f9('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe5f9('0x15')](_0x583ed3[_0xe5f9('0x16')],_0xe3fdae,'\x20'),'description':intUtil[_0xe5f9('0x15')](_0x583ed3['Descriptions'],_0xe3fdae,_0xe5f9('0x17')),'tags':getTags(_0x583ed3[_0xe5f9('0x18')],_0xe5f9('0x19'))},getCustomFields(_0x583ed3[_0xe5f9('0x1a')],_0xe3fdae));_0xc3e8ad[_0xe5f9('0x1b')]=_['mapValues'](_[_0xe5f9('0x1c')](_0xc3e8ad[_0xe5f9('0x1b')],'id'),_0xe5f9('0x1d'));return request({'uri':util['format'](_0xe5f9('0x1e'),_0x2fd329[_0xe5f9('0x1f')]),'method':_0xe5f9('0x20'),'body':_0xc3e8ad})[_0xe5f9('0x21')](function(_0x5cd195){logger[_0xe5f9('0xe')](_0xe5f9('0x22'));return _0x5cd195;});}function getUser(_0x367f06,_0x2d5cab){if(intUtil[_0xe5f9('0x23')](_0x2d5cab)){return request({'uri':util[_0xe5f9('0x11')](_0xe5f9('0x24'),_0x367f06[_0xe5f9('0x1f')]),'qs':{'email':_0x2d5cab}})[_0xe5f9('0x21')](function(_0x5984ef){if(_0x5984ef['length']){logger['info'](_0xe5f9('0x25'));return _[_0xe5f9('0x26')](_0x5984ef,function(_0x517c24){return _0x517c24['contact'][_0xe5f9('0x27')]===_0x2d5cab;});}else{logger['info'](_0xe5f9('0x28'));return request({'uri':util[_0xe5f9('0x11')](_0xe5f9('0x29'),_0x367f06[_0xe5f9('0x1f')])})[_0xe5f9('0x21')](function(_0x20700f){logger[_0xe5f9('0xe')](_0xe5f9('0x2a'));return _0x20700f;});}});}else{logger['info'](_0xe5f9('0x2b'));return request({'uri':util['format'](_0xe5f9('0x29'),_0x367f06[_0xe5f9('0x1f')])})['then'](function(_0x27a1b0){logger[_0xe5f9('0xe')](_0xe5f9('0x2a'));return _0x27a1b0;});}}function getEndUser(_0x32eae7,_0x4127dc,_0xac1a00){logger['info'](_0xe5f9('0x2c'),_0xac1a00);return request({'uri':util[_0xe5f9('0x11')](_0xe5f9('0x2d'),_0x32eae7['remoteUri']),'qs':{'phone':_0xac1a00}})[_0xe5f9('0x21')](function(_0x378050){if(_0x378050[_0xe5f9('0x2e')]){logger[_0xe5f9('0xe')](_0xe5f9('0x2f'));return _[_0xe5f9('0x26')](_0x378050,{'phone':_0xac1a00});}else{logger[_0xe5f9('0xe')](_0xe5f9('0x30'));return request({'uri':util[_0xe5f9('0x11')]('%s/api/v2/contacts',_0x32eae7[_0xe5f9('0x1f')]),'method':'POST','body':{'name':_0x4127dc,'phone':_0xac1a00}})['then'](function(_0x588dff){logger[_0xe5f9('0xe')](_0xe5f9('0x31'));return _0x588dff;});}});}function getAuth(_0x4c3441){return util[_0xe5f9('0x11')]('Basic\x20%s',new Buffer(_0x4c3441['apiKey']+':X')[_0xe5f9('0x32')]('base64'));}function request(_0x5d4acf){logger[_0xe5f9('0x33')](_0xe5f9('0x34'),JSON[_0xe5f9('0x35')](_0x5d4acf));return rp(_[_0xe5f9('0x8')](_0x5d4acf,{'method':_0xe5f9('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4da485,_0x51b43e){var _0x77a6e0=[];if(_0x4da485&&_0x4da485[_0xe5f9('0x2e')]>0x0){_0x77a6e0=_[_0xe5f9('0x37')](_0x4da485,_0x51b43e);}return _0x77a6e0;}function getCustomFields(_0x202fe3,_0x2443b7){var _0x8f2d=[];var _0x1f33e6={'custom_fields':[]};if(_0x202fe3['length']>0x0){_[_0xe5f9('0x38')](_0x202fe3,function(_0x29f72e){if(_[_0xe5f9('0x39')]([_0xe5f9('0x3a'),'picklist'],_0x29f72e[_0xe5f9('0x3b')])&&_0x29f72e['nameField']&&!_0x29f72e[_0xe5f9('0x3c')]){_0x1f33e6[_0x29f72e['nameField']['toLowerCase']()]=_0x29f72e['content'][_0xe5f9('0x32')]();}else if(_[_0xe5f9('0x39')](['string','picklist'],_0x29f72e[_0xe5f9('0x3b')])&&_0x29f72e['idField']&&_0x29f72e['customField']){_0x1f33e6[_0xe5f9('0x1b')][_0xe5f9('0x3d')]({'id':_0x29f72e[_0xe5f9('0x3e')],'value':_0x29f72e[_0xe5f9('0x3f')][_0xe5f9('0x32')]()});}else if(_0x29f72e[_0xe5f9('0x3b')]===_0xe5f9('0x40')&&_0x29f72e[_0xe5f9('0x41')]&&_0x29f72e[_0xe5f9('0x3e')]&&_0x29f72e['customField']){_0x2443b7[_0x29f72e[_0xe5f9('0x41')]]&&_0x1f33e6[_0xe5f9('0x1b')][_0xe5f9('0x3d')]({'id':_0x29f72e[_0xe5f9('0x3e')],'value':_0x2443b7[_0x29f72e[_0xe5f9('0x41')]][_0xe5f9('0x32')]()});}else if(_0x29f72e['type']==='customVariable'&&_0x29f72e['Variable']&&_0x29f72e['Variable'][_0xe5f9('0x19')]&&_0x29f72e[_0xe5f9('0x3e')]&&_0x29f72e[_0xe5f9('0x3c')]){_0x2443b7[_0x29f72e['Variable'][_0xe5f9('0x19')][_0xe5f9('0x42')]()]&&_0x1f33e6['custom_fields']['push']({'id':_0x29f72e['idField'],'value':_0x2443b7[_0x29f72e['Variable']['name'][_0xe5f9('0x42')]()][_0xe5f9('0x32')]()});}});}return _0x1f33e6;}exports[_0xe5f9('0x43')]=function(_0x577cda,_0x2872be,_0x1fe4dd,_0x5758c2,_0x451f6e,_0x57d593){var _0x47f095,_0x685864;_0x57d593['remoteUri']=intUtil[_0xe5f9('0x44')](_0x57d593[_0xe5f9('0x1f')]);_0x57d593[_0xe5f9('0x45')]=intUtil['stripTrailingSlash'](_0x57d593[_0xe5f9('0x45')]);if(_0x451f6e&&_0x451f6e[_0xe5f9('0x46')]){logger[_0xe5f9('0xe')](_0xe5f9('0x47'),'Recording\x20is\x20enabled!');_0x2872be[_0xe5f9('0x48')]=util[_0xe5f9('0x11')](_0xe5f9('0x49'),_0x57d593[_0xe5f9('0x45')],_0x2872be[_0xe5f9('0x4a')],md5(_0x2872be[_0xe5f9('0x4a')]));}else{_0x2872be[_0xe5f9('0x48')]='';}headers[_0xe5f9('0x4b')]=getAuth(_0x57d593);return getUser(_0x57d593,_0x5758c2[_0xe5f9('0x27')])['then'](function(_0x173a35){_0x47f095=_0x173a35;logger[_0xe5f9('0xe')](_0xe5f9('0x4c'),_0x47f095['id']);return getEndUser(_0x57d593,_0x2872be[_0xe5f9('0x13')],_0x2872be[_0xe5f9('0x14')]);})[_0xe5f9('0x21')](function(_0x453d30){_0x685864=_0x453d30;logger[_0xe5f9('0xe')](_0xe5f9('0x4d'),_0x685864['id']);return getTicket(_0x57d593,_0x47f095,_0x685864,_0x1fe4dd,_0x2872be);})[_0xe5f9('0x21')](function(_0x4a9763){if(_0x4a9763&&_0x4a9763['id']){logger[_0xe5f9('0xe')](_0xe5f9('0x22'));logger[_0xe5f9('0xe')](_0xe5f9('0x4e'),_0x4a9763['id']);logger[_0xe5f9('0xe')]('[QUEUE]',_0xe5f9('0x4f'));emit(util[_0xe5f9('0x11')](_0xe5f9('0x50'),_0x5758c2[_0xe5f9('0x19')]),_0xe5f9('0x51'),{'uri':util[_0xe5f9('0x11')]('%s/helpdesk/tickets/%d',_0x57d593[_0xe5f9('0x1f')],_0x4a9763['id'])});}})[_0xe5f9('0x52')](function(_0x352d26){logger[_0xe5f9('0x53')](_0xe5f9('0x47'),JSON[_0xe5f9('0x35')](_0x352d26));});};exports[_0xe5f9('0x54')]=function(_0x32dc65,_0x3990c3,_0x41231a,_0x431da8,_0x3638d6,_0xf9a1e4,_0x3a8092){var _0x2ff01b,_0x42510e;_0xf9a1e4['remoteUri']=intUtil[_0xe5f9('0x44')](_0xf9a1e4['remoteUri']);_0xf9a1e4['serverUrl']=intUtil[_0xe5f9('0x44')](_0xf9a1e4[_0xe5f9('0x45')]);if(_0x3a8092&&_0x3a8092[_0xe5f9('0x55')]&&_0x3a8092[_0xe5f9('0x55')]!==_0xe5f9('0x56')){logger['info']('[OUTBOUND]',_0xe5f9('0x57'));_0x3990c3[_0xe5f9('0x48')]=util[_0xe5f9('0x11')](_0xe5f9('0x49'),_0xf9a1e4[_0xe5f9('0x45')],_0x3990c3['uniqueid'],md5(_0x3990c3['uniqueid']));}headers[_0xe5f9('0x4b')]=getAuth(_0xf9a1e4);return getUser(_0xf9a1e4,_0x431da8[_0xe5f9('0x27')])[_0xe5f9('0x21')](function(_0x1c57e1){_0x2ff01b=_0x1c57e1;logger[_0xe5f9('0xe')]('The\x20User\x20ID\x20is:',_0x2ff01b['id']);return getEndUser(_0xf9a1e4,_0x3990c3[_0xe5f9('0x58')],_0x3990c3[_0xe5f9('0x59')]);})[_0xe5f9('0x21')](function(_0x303439){_0x42510e=_0x303439;logger['info'](_0xe5f9('0x4d'),_0x42510e['id']);return getTicket(_0xf9a1e4,_0x2ff01b,_0x42510e,_0x41231a,_0x3990c3);})[_0xe5f9('0x21')](function(_0x16904b){if(_0x16904b&&_0x16904b['id']){logger['info']('Ticket\x20created!');logger[_0xe5f9('0xe')](_0xe5f9('0x4e'),_0x16904b['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe5f9('0x50'),_0x431da8[_0xe5f9('0x19')]),_0xe5f9('0x51'),{'uri':util['format'](_0xe5f9('0x5a'),_0xf9a1e4['remoteUri'],_0x16904b['id'])});}})['catch'](function(_0x3cd09d){logger['error'](_0xe5f9('0x5b'),JSON['stringify'](_0x3cd09d));});};exports['unmanaged']=function(_0x4054dc,_0x22436b,_0xca61a2,_0x266633,_0x24fe2,_0x44e1a9){var _0x5e91cf,_0x200bcd;_0x44e1a9['remoteUri']=intUtil[_0xe5f9('0x44')](_0x44e1a9[_0xe5f9('0x1f')]);_0x44e1a9[_0xe5f9('0x45')]=intUtil[_0xe5f9('0x44')](_0x44e1a9[_0xe5f9('0x45')]);if(_0x24fe2&&_0x24fe2[_0xe5f9('0x46')]){logger[_0xe5f9('0xe')]('['+_0x22436b[_0xe5f9('0x5c')][_0xe5f9('0x5d')]()+']',_0xe5f9('0x57'));_0x22436b['recordingURL']=util[_0xe5f9('0x11')](_0xe5f9('0x49'),_0x44e1a9['serverUrl'],_0x22436b[_0xe5f9('0x4a')],md5(_0x22436b[_0xe5f9('0x4a')]));}else{_0x22436b[_0xe5f9('0x48')]='';}headers[_0xe5f9('0x4b')]=getAuth(_0x44e1a9);return getUser(_0x44e1a9,'')[_0xe5f9('0x21')](function(_0x3ccff0){_0x5e91cf=_0x3ccff0;logger[_0xe5f9('0xe')]('The\x20User\x20ID\x20is:',_0x5e91cf['id']);return getEndUser(_0x44e1a9,_0x22436b[_0xe5f9('0x13')],_0x22436b['calleridnum']);})[_0xe5f9('0x21')](function(_0x3202e7){_0x200bcd=_0x3202e7;logger[_0xe5f9('0xe')](_0xe5f9('0x4d'),_0x200bcd['id']);return getTicket(_0x44e1a9,_0x5e91cf,_0x200bcd,_0xca61a2,_0x22436b);})[_0xe5f9('0x21')](function(_0x5d6cc5){if(_0x5d6cc5){logger[_0xe5f9('0xe')](_0xe5f9('0x22'));logger[_0xe5f9('0xe')](_0xe5f9('0x4e'),_0x5d6cc5['id']);}})['catch'](function(_0x3f2465){logger['error']('['+_0x22436b[_0xe5f9('0x5c')][_0xe5f9('0x5d')]()+']',JSON['stringify'](_0x3f2465));});}; \ No newline at end of file +var _0xdb0d=['variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','stringify','unmanaged','lastevent','toUpperCase','error','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridname','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','[HTTP]','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','push','idField'];(function(_0x3ef8a9,_0x59a7c2){var _0x424f63=function(_0x7c1873){while(--_0x7c1873){_0x3ef8a9['push'](_0x3ef8a9['shift']());}};_0x424f63(++_0x59a7c2);}(_0xdb0d,0x199));var _0xddb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb0d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xddb0('0x0'));var rp=require(_0xddb0('0x1'));var md5=require(_0xddb0('0x2'));var util=require('util');var Redis=require(_0xddb0('0x3'));var intUtil=require(_0xddb0('0x4'));var config=require(_0xddb0('0x5'));var logger=require('../../../../config/logger')(_0xddb0('0x6'));config['redis']=_[_0xddb0('0x7')](config[_0xddb0('0x8')],{'host':_0xddb0('0x9'),'port':0x18eb});var io=require(_0xddb0('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xddb0('0xb')};function emit(_0x2c91e5,_0x4d2fb4,_0x18f30d){io['to'](_0x2c91e5)['emit'](_0x4d2fb4,_0x18f30d);}function getTicket(_0x3e87c1,_0x362d2f,_0x265343,_0x3cc2a8,_0xd0a06a){logger[_0xddb0('0xc')](_0xddb0('0xd'));var _0x418feb=_[_0xddb0('0xe')]({'responder_id':_0x362d2f['id'],'requester_id':_0x265343['id'],'name':util[_0xddb0('0xf')]('Caller\x20-\x20%s',_0xd0a06a[_0xddb0('0x10')]),'phone':_0xd0a06a['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3cc2a8[_0xddb0('0x11')],_0xd0a06a,'\x20'),'description':intUtil[_0xddb0('0x12')](_0x3cc2a8[_0xddb0('0x13')],_0xd0a06a,_0xddb0('0x14')),'tags':getTags(_0x3cc2a8[_0xddb0('0x15')],_0xddb0('0x16'))},getCustomFields(_0x3cc2a8[_0xddb0('0x17')],_0xd0a06a));_0x418feb[_0xddb0('0x18')]=_[_0xddb0('0x19')](_[_0xddb0('0x1a')](_0x418feb[_0xddb0('0x18')],'id'),'value');return request({'uri':util[_0xddb0('0xf')](_0xddb0('0x1b'),_0x3e87c1[_0xddb0('0x1c')]),'method':_0xddb0('0x1d'),'body':_0x418feb})[_0xddb0('0x1e')](function(_0x1f7e0f){logger['info'](_0xddb0('0x1f'));return _0x1f7e0f;});}function getUser(_0x29ecfd,_0x400b6d){if(intUtil[_0xddb0('0x20')](_0x400b6d)){return request({'uri':util[_0xddb0('0xf')](_0xddb0('0x21'),_0x29ecfd[_0xddb0('0x1c')]),'qs':{'email':_0x400b6d}})[_0xddb0('0x1e')](function(_0x19d9dc){if(_0x19d9dc[_0xddb0('0x22')]){logger[_0xddb0('0xc')](_0xddb0('0x23'));return _[_0xddb0('0x24')](_0x19d9dc,function(_0xf3024e){return _0xf3024e[_0xddb0('0x25')][_0xddb0('0x26')]===_0x400b6d;});}else{logger[_0xddb0('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xddb0('0xf')](_0xddb0('0x27'),_0x29ecfd[_0xddb0('0x1c')])})['then'](function(_0x390075){logger[_0xddb0('0xc')](_0xddb0('0x28'));return _0x390075;});}});}else{logger[_0xddb0('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xddb0('0xf')](_0xddb0('0x27'),_0x29ecfd[_0xddb0('0x1c')])})[_0xddb0('0x1e')](function(_0x1ca3a7){logger[_0xddb0('0xc')]('Admin\x20account\x20selected.');return _0x1ca3a7;});}}function getEndUser(_0x33f5eb,_0x595c73,_0x1efa51){logger[_0xddb0('0xc')](_0xddb0('0x29'),_0x1efa51);return request({'uri':util[_0xddb0('0xf')]('%s/api/v2/contacts',_0x33f5eb[_0xddb0('0x1c')]),'qs':{'phone':_0x1efa51}})[_0xddb0('0x1e')](function(_0x20e413){if(_0x20e413[_0xddb0('0x22')]){logger[_0xddb0('0xc')](_0xddb0('0x2a'));return _[_0xddb0('0x24')](_0x20e413,{'phone':_0x1efa51});}else{logger[_0xddb0('0xc')](_0xddb0('0x2b'));return request({'uri':util[_0xddb0('0xf')](_0xddb0('0x2c'),_0x33f5eb[_0xddb0('0x1c')]),'method':_0xddb0('0x1d'),'body':{'name':_0x595c73,'phone':_0x1efa51}})[_0xddb0('0x1e')](function(_0x25b7ef){logger[_0xddb0('0xc')]('Enduser\x20created.');return _0x25b7ef;});}});}function getAuth(_0x4872ee){return util[_0xddb0('0xf')](_0xddb0('0x2d'),new Buffer(_0x4872ee[_0xddb0('0x2e')]+':X')[_0xddb0('0x2f')]('base64'));}function request(_0x269de3){logger['debug'](_0xddb0('0x30'),JSON['stringify'](_0x269de3));return rp(_[_0xddb0('0x7')](_0x269de3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1afe16,_0x4e3e8e){var _0x4614c3=[];if(_0x1afe16&&_0x1afe16[_0xddb0('0x22')]>0x0){_0x4614c3=_[_0xddb0('0x31')](_0x1afe16,_0x4e3e8e);}return _0x4614c3;}function getCustomFields(_0x488762,_0x55a818){var _0x980e1d=[];var _0x528651={'custom_fields':[]};if(_0x488762[_0xddb0('0x22')]>0x0){_[_0xddb0('0x32')](_0x488762,function(_0x30f4c9){if(_[_0xddb0('0x33')]([_0xddb0('0x34'),'picklist'],_0x30f4c9[_0xddb0('0x35')])&&_0x30f4c9[_0xddb0('0x36')]&&!_0x30f4c9[_0xddb0('0x37')]){_0x528651[_0x30f4c9[_0xddb0('0x36')][_0xddb0('0x38')]()]=_0x30f4c9[_0xddb0('0x39')]['toString']();}else if(_['includes']([_0xddb0('0x34'),_0xddb0('0x3a')],_0x30f4c9[_0xddb0('0x35')])&&_0x30f4c9['idField']&&_0x30f4c9[_0xddb0('0x37')]){_0x528651[_0xddb0('0x18')][_0xddb0('0x3b')]({'id':_0x30f4c9[_0xddb0('0x3c')],'value':_0x30f4c9[_0xddb0('0x39')]['toString']()});}else if(_0x30f4c9[_0xddb0('0x35')]===_0xddb0('0x3d')&&_0x30f4c9[_0xddb0('0x3e')]&&_0x30f4c9[_0xddb0('0x3c')]&&_0x30f4c9[_0xddb0('0x37')]){_0x55a818[_0x30f4c9[_0xddb0('0x3e')]]&&_0x528651['custom_fields']['push']({'id':_0x30f4c9[_0xddb0('0x3c')],'value':_0x55a818[_0x30f4c9[_0xddb0('0x3e')]][_0xddb0('0x2f')]()});}else if(_0x30f4c9[_0xddb0('0x35')]===_0xddb0('0x3f')&&_0x30f4c9[_0xddb0('0x40')]&&_0x30f4c9[_0xddb0('0x40')][_0xddb0('0x16')]&&_0x30f4c9[_0xddb0('0x3c')]&&_0x30f4c9[_0xddb0('0x37')]){_0x55a818[_0x30f4c9[_0xddb0('0x40')][_0xddb0('0x16')][_0xddb0('0x38')]()]&&_0x528651['custom_fields'][_0xddb0('0x3b')]({'id':_0x30f4c9[_0xddb0('0x3c')],'value':_0x55a818[_0x30f4c9['Variable']['name'][_0xddb0('0x38')]()][_0xddb0('0x2f')]()});}});}return _0x528651;}exports[_0xddb0('0x41')]=function(_0x139cd6,_0x31c187,_0x1d898b,_0x20cfab,_0x49ff7a,_0x3416b2){var _0x469197,_0x31d62a;_0x3416b2[_0xddb0('0x1c')]=intUtil[_0xddb0('0x42')](_0x3416b2[_0xddb0('0x1c')]);_0x3416b2['serverUrl']=intUtil[_0xddb0('0x42')](_0x3416b2[_0xddb0('0x43')]);if(_0x49ff7a&&_0x49ff7a[_0xddb0('0x44')]){logger[_0xddb0('0xc')]('[QUEUE]',_0xddb0('0x45'));_0x31c187[_0xddb0('0x46')]=util[_0xddb0('0xf')](_0xddb0('0x47'),_0x3416b2[_0xddb0('0x43')],_0x31c187[_0xddb0('0x48')],md5(_0x31c187[_0xddb0('0x48')]));}else{_0x31c187[_0xddb0('0x46')]='';}headers[_0xddb0('0x49')]=getAuth(_0x3416b2);return getUser(_0x3416b2,_0x20cfab[_0xddb0('0x26')])[_0xddb0('0x1e')](function(_0x3a8544){_0x469197=_0x3a8544;logger[_0xddb0('0xc')]('The\x20User\x20ID\x20is:',_0x469197['id']);return getEndUser(_0x3416b2,_0x31c187['calleridname'],_0x31c187[_0xddb0('0x4a')]);})[_0xddb0('0x1e')](function(_0x2094cf){_0x31d62a=_0x2094cf;logger[_0xddb0('0xc')](_0xddb0('0x4b'),_0x31d62a['id']);return getTicket(_0x3416b2,_0x469197,_0x31d62a,_0x1d898b,_0x31c187);})[_0xddb0('0x1e')](function(_0x3433cb){if(_0x3433cb&&_0x3433cb['id']){logger[_0xddb0('0xc')](_0xddb0('0x1f'));logger[_0xddb0('0xc')](_0xddb0('0x4c'),_0x3433cb['id']);logger[_0xddb0('0xc')](_0xddb0('0x4d'),_0xddb0('0x4e'));emit(util[_0xddb0('0xf')](_0xddb0('0x4f'),_0x20cfab['name']),_0xddb0('0x50'),{'uri':util[_0xddb0('0xf')](_0xddb0('0x51'),_0x3416b2[_0xddb0('0x1c')],_0x3433cb['id'])});}})[_0xddb0('0x52')](function(_0x49d06a){logger['error'](_0xddb0('0x4d'),JSON['stringify'](_0x49d06a));});};exports[_0xddb0('0x53')]=function(_0xde4fb0,_0x251e83,_0x6947ad,_0x5746ba,_0x42fbe8,_0xc55363,_0x4300be){var _0x264736,_0x40171a;_0xc55363[_0xddb0('0x1c')]=intUtil[_0xddb0('0x42')](_0xc55363[_0xddb0('0x1c')]);_0xc55363[_0xddb0('0x43')]=intUtil['stripTrailingSlash'](_0xc55363[_0xddb0('0x43')]);if(_0x4300be&&_0x4300be[_0xddb0('0x54')]&&_0x4300be[_0xddb0('0x54')]!==_0xddb0('0x55')){logger[_0xddb0('0xc')]('[OUTBOUND]',_0xddb0('0x45'));_0x251e83[_0xddb0('0x46')]=util[_0xddb0('0xf')](_0xddb0('0x47'),_0xc55363[_0xddb0('0x43')],_0x251e83[_0xddb0('0x48')],md5(_0x251e83[_0xddb0('0x48')]));}headers[_0xddb0('0x49')]=getAuth(_0xc55363);return getUser(_0xc55363,_0x5746ba['email'])[_0xddb0('0x1e')](function(_0x2a9aba){_0x264736=_0x2a9aba;logger['info'](_0xddb0('0x56'),_0x264736['id']);return getEndUser(_0xc55363,_0x251e83['destcalleridname'],_0x251e83[_0xddb0('0x57')]);})[_0xddb0('0x1e')](function(_0x193966){_0x40171a=_0x193966;logger[_0xddb0('0xc')](_0xddb0('0x4b'),_0x40171a['id']);return getTicket(_0xc55363,_0x264736,_0x40171a,_0x6947ad,_0x251e83);})['then'](function(_0x50daa2){if(_0x50daa2&&_0x50daa2['id']){logger[_0xddb0('0xc')](_0xddb0('0x1f'));logger[_0xddb0('0xc')](_0xddb0('0x4c'),_0x50daa2['id']);logger[_0xddb0('0xc')](_0xddb0('0x58'),_0xddb0('0x4e'));emit(util[_0xddb0('0xf')]('user:%s',_0x5746ba[_0xddb0('0x16')]),'trigger:browser:url',{'uri':util[_0xddb0('0xf')](_0xddb0('0x51'),_0xc55363[_0xddb0('0x1c')],_0x50daa2['id'])});}})[_0xddb0('0x52')](function(_0x2203e1){logger['error'](_0xddb0('0x58'),JSON[_0xddb0('0x59')](_0x2203e1));});};exports[_0xddb0('0x5a')]=function(_0x22fe7b,_0x14ebe3,_0xa93299,_0x2abdd4,_0x3d4e47,_0x51f3f4){var _0x288462,_0x4a2922;_0x51f3f4[_0xddb0('0x1c')]=intUtil[_0xddb0('0x42')](_0x51f3f4[_0xddb0('0x1c')]);_0x51f3f4[_0xddb0('0x43')]=intUtil[_0xddb0('0x42')](_0x51f3f4['serverUrl']);if(_0x3d4e47&&_0x3d4e47[_0xddb0('0x44')]){logger[_0xddb0('0xc')]('['+_0x14ebe3[_0xddb0('0x5b')][_0xddb0('0x5c')]()+']',_0xddb0('0x45'));_0x14ebe3[_0xddb0('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x51f3f4[_0xddb0('0x43')],_0x14ebe3[_0xddb0('0x48')],md5(_0x14ebe3[_0xddb0('0x48')]));}else{_0x14ebe3['recordingURL']='';}headers['Authorization']=getAuth(_0x51f3f4);return getUser(_0x51f3f4,'')['then'](function(_0x160315){_0x288462=_0x160315;logger[_0xddb0('0xc')]('The\x20User\x20ID\x20is:',_0x288462['id']);return getEndUser(_0x51f3f4,_0x14ebe3[_0xddb0('0x10')],_0x14ebe3[_0xddb0('0x4a')]);})[_0xddb0('0x1e')](function(_0x180c84){_0x4a2922=_0x180c84;logger[_0xddb0('0xc')](_0xddb0('0x4b'),_0x4a2922['id']);return getTicket(_0x51f3f4,_0x288462,_0x4a2922,_0xa93299,_0x14ebe3);})[_0xddb0('0x1e')](function(_0xa42e1b){if(_0xa42e1b){logger[_0xddb0('0xc')](_0xddb0('0x1f'));logger['info'](_0xddb0('0x4c'),_0xa42e1b['id']);}})['catch'](function(_0x48df37){logger[_0xddb0('0x5d')]('['+_0x14ebe3[_0xddb0('0x5b')]['toUpperCase']()+']',JSON[_0xddb0('0x59')](_0x48df37));});}; \ 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 f519966..8225b7b 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 _0x6201=['adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','userId','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6201,0x9d));var _0x1620=function(_0x6bc93a,_0x1c227f){_0x6bc93a=_0x6bc93a-0x0;var _0x364762=_0x6201[_0x6bc93a];return _0x364762;};'use strict';var _=require('lodash');var rp=require(_0x1620('0x0'));var md5=require(_0x1620('0x1'));var util=require(_0x1620('0x2'));var moment=require(_0x1620('0x3'));var Promise=require(_0x1620('0x4'));var Redis=require(_0x1620('0x5'));var intUtil=require('./util');var config=require(_0x1620('0x6'));var logger=require(_0x1620('0x7'))(_0x1620('0x8'));config[_0x1620('0x9')]=_[_0x1620('0xa')](config[_0x1620('0x9')],{'host':_0x1620('0xb'),'port':0x18eb});var io=require(_0x1620('0xc'))(new Redis(config[_0x1620('0x9')]));function getAdminId(_0x2f46ba,_0x35486,_0x4ed3cf,_0x4020f6){return new Promise(function(_0x2d925c,_0x355228){var _0x3d7894=![];var _0x454348={'method':'GET','uri':_0x4020f6+_0x1620('0xd'),'json':!![]};_0x454348[_0x1620('0xe')]=_0x4ed3cf;logger[_0x1620('0xf')](_0x1620('0x10'));return rp(_0x454348)['then'](function(_0x3de340){if(_0x3de340){var _0xf2a866=_0x3de340[_0x1620('0x11')];var _0x5b2530=null;for(_0x5b2530=0x0;_0x5b2530<_0xf2a866[_0x1620('0x12')];_0x5b2530++){if(_0xf2a866[_0x5b2530]['email']===_0x2f46ba[_0x1620('0x13')]){_0x2f46ba[_0x1620('0x14')]=_0xf2a866[_0x5b2530]['id'];_0x3d7894=!![];}}if(_0x3d7894){logger['info'](_0x1620('0x15'),_0x2f46ba[_0x1620('0x14')]);_0x2d925c(_0x2f46ba);}else{_0x355228({'statusCode':0x194,'message':_0x1620('0x16')});}}else{_0x355228({'statusCode':0x194,'message':_0x1620('0x16')});}})[_0x1620('0x17')](function(_0x356d66){logger[_0x1620('0x18')]('['+[_0x35486[_0x1620('0x19')]()]+']',_0x356d66[_0x1620('0x1a')]);_0x355228(_0x356d66);});});}function getUser(_0x3ee261,_0x298094,_0x31ed5b){return function(_0x395954){return new Promise(function(_0x45b73e,_0x2a8945){var _0x223f09={'method':_0x1620('0x1b'),'uri':_0x31ed5b+_0x1620('0xd'),'json':!![]};_0x223f09[_0x1620('0xe')]=_0x298094;logger[_0x1620('0xf')](_0x1620('0x1c'));return rp(_0x223f09)[_0x1620('0x1d')](function(_0x5a6d95){if(_0x5a6d95){var _0x405def=_0x5a6d95[_0x1620('0x11')];var _0x41a342=![];var _0x5efd6d=null;if(_0x395954[_0x1620('0x1e')]!==null){logger['info'](_0x1620('0x1f'),_0x395954['agentEmail']);_0x395954[_0x1620('0x20')]=_0x395954[_0x1620('0x1e')];for(_0x5efd6d=0x0;_0x5efd6d<_0x405def[_0x1620('0x12')];_0x5efd6d++){if(_0x405def[_0x5efd6d][_0x1620('0x21')]===_0x395954[_0x1620('0x1e')]){_0x41a342=!![];_0x395954['userId']=_0x405def[_0x5efd6d]['id'];logger[_0x1620('0xf')](_0x1620('0x22'),_0x395954[_0x1620('0x23')]);}}}if(!_0x41a342){logger[_0x1620('0xf')]('Admin\x20selected');_0x395954[_0x1620('0x20')]=_0x395954[_0x1620('0x13')];_0x395954[_0x1620('0x23')]=_0x395954[_0x1620('0x14')];_0x41a342=!![];}if(_0x41a342){_0x45b73e(_0x395954);}else{_0x2a8945({'statusCode':0x194,'message':_0x1620('0x16')});}}else{_0x2a8945({'statusCode':0x194,'message':_0x1620('0x16')});}})[_0x1620('0x17')](function(_0x4797c3){logger[_0x1620('0x18')]('['+[_0x3ee261[_0x1620('0x19')]()]+']',_0x4797c3[_0x1620('0x1a')]);_0x2a8945(_0x4797c3);});});};}function searchContact(_0x3a3d2c,_0x1d8ab0,_0x1adb64,_0x2b736a){return new Promise(function(_0x49984c,_0x633272){var _0x408355={'method':'GET','headers':_0x1d8ab0,'uri':_0x3a3d2c+_0x1620('0x24')+_0x2b736a+'&f='+_0x1adb64+_0x1620('0x25'),'json':!![]};rp(_0x408355)[_0x1620('0x1d')](function(_0x1189fc){var _0x9c7603=_[_0x1620('0x26')](_0x1189fc[_0x1620('0x27')][_0x1620('0x27')],[_0x1adb64,_0x2b736a]);_0x49984c(_0x9c7603);})['catch'](function(_0x4ca4d5){_0x633272(_0x4ca4d5);});});}function getEndUser(_0x59e4b1,_0x845e5,_0x1e005b){return function(_0x329335){return new Promise(function(_0x4eec55,_0x2f746a){logger[_0x1620('0xf')](util[_0x1620('0x28')](_0x1620('0x29'),_0x329335[_0x1620('0x2a')]));searchContact(_0x1e005b,_0x845e5,_0x1620('0x2b'),_0x329335[_0x1620('0x2a')])[_0x1620('0x1d')](function(_0x5ddf52){if(_0x5ddf52){_0x329335[_0x1620('0x2c')]=_0x5ddf52['id'];logger[_0x1620('0xf')](_0x1620('0x2d'),_0x329335['endUserId']);return _0x4eec55(_0x329335);}searchContact(_0x1e005b,_0x845e5,_0x1620('0x2e'),_0x329335['contactNumber'])[_0x1620('0x1d')](function(_0x18a1f6){if(_0x18a1f6){_0x329335[_0x1620('0x2c')]=_0x18a1f6['id'];logger[_0x1620('0xf')](_0x1620('0x2f'),_0x329335[_0x1620('0x2c')]);return _0x4eec55(_0x329335);}createEndUser(_0x329335,_0x59e4b1,_0x845e5,_0x1e005b)[_0x1620('0x1d')](function(_0x3d8e87){logger[_0x1620('0xf')]('Contact\x20created:',_0x3d8e87['endUserId']);return _0x4eec55(_0x3d8e87);});});})[_0x1620('0x17')](function(_0x5383a0){_0x2f746a(_0x5383a0);});});};}function createEndUser(_0x1afc0c,_0x25f27b,_0x3b60e7,_0xd8aa89){return new Promise(function(_0x271a59,_0x4a3a76){var _0x242f99=moment();var _0x51f378={'method':_0x1620('0x30'),'uri':_0xd8aa89+_0x1620('0x31'),'body':{'contact':{'last_name':_0x1afc0c[_0x1620('0x2a')],'work_number':_0x1afc0c[_0x1620('0x2a')],'mobile_number':_0x1afc0c[_0x1620('0x2a')],'owner_id':_0x1afc0c[_0x1620('0x23')],'created_at':_0x242f99['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x51f378[_0x1620('0xe')]=_0x3b60e7;logger['info'](_0x1620('0x32'));return rp(_0x51f378)[_0x1620('0x1d')](function(_0x36edb0){_0x1afc0c[_0x1620('0x2c')]=_0x36edb0['contact']['id'];_0x271a59(_0x1afc0c);})['catch'](function(_0x36cbb7){logger['error']('['+[_0x25f27b[_0x1620('0x19')]()]+']',_0x36cbb7['message']);_0x4a3a76(_0x36cbb7[_0x1620('0x1a')]);});});}function getTicket(_0x1c4a5e,_0xb17495,_0x597af6,_0x4f7777,_0x1f7fe8){return function(_0x15858f){logger[_0x1620('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x28019a,_0x1e8924){var _0x4b1fb3=moment();var _0x150ccd={'method':_0x1620('0x30'),'uri':_0x597af6+_0x1620('0x33'),'body':{'title':intUtil[_0x1620('0x34')](_0x4f7777[_0x1620('0x35')],_0x1f7fe8,'\x20'),'description':intUtil['getString'](_0x4f7777[_0x1620('0x36')],_0x1f7fe8,'\x0a'),'owner_id':_0x15858f['userId'],'creater_id':_0x15858f[_0x1620('0x14')],'targetable_id':_0x15858f[_0x1620('0x2c')],'targetable_type':_0x1620('0x37'),'created_at':_0x4b1fb3[_0x1620('0x28')](_0x1620('0x38')),'due_date':_0x4b1fb3[_0x1620('0x39')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x150ccd[_0x1620('0xe')]=_0xb17495;return rp(_0x150ccd)[_0x1620('0x1d')](function(_0x594e99){_0x15858f[_0x1620('0x3a')]=_0x594e99['task']['id'];logger[_0x1620('0xf')](_0x1620('0x3b'),_0x15858f['ticketId']);_0x28019a(_0x15858f);})[_0x1620('0x17')](function(_0x10b6e6){logger['error']('['+[_0x1c4a5e[_0x1620('0x19')]()]+']',_0x10b6e6[_0x1620('0x1a')]);_0x1e8924(_0x10b6e6[_0x1620('0x1a')]);});});};}function emit(_0x5289b6,_0x4d2a72,_0x43d3ca){var _0x15d114={'uri':_0x5289b6+_0x1620('0x3c')+_0x43d3ca};io['to'](util[_0x1620('0x28')](_0x1620('0x3d'),_0x4d2a72))[_0x1620('0x3e')](_0x1620('0x3f'),_0x15d114);}exports['cs']=function(_0x4c5698,_0x5969fc,_0x46b532,_0x11a3f4,_0x121e8c,_0x2121f9,_0x5e1c73,_0x19164a){var _0x228bea={};var _0x1d6466={'Authorization':_0x1620('0x40')+_0x2121f9['apiKey']};_0x2121f9['remoteUri']=intUtil[_0x1620('0x41')](_0x2121f9[_0x1620('0x42')]);_0x2121f9[_0x1620('0x43')]=intUtil['stripTrailingSlash'](_0x2121f9[_0x1620('0x43')]);var _0xaf9dc=_0x2121f9[_0x1620('0x42')];_0x228bea['adminEmail']=_0x2121f9[_0x1620('0x44')];_0x228bea[_0x1620('0x2a')]=_0x19164a[_0x1620('0x45')]()===_0x1620('0x46')?_0x5969fc[_0x1620('0x47')]:_0x5969fc[_0x1620('0x48')];_0x228bea['callDirection']=_0x19164a===_0x1620('0x49')||_0x19164a===_0x1620('0x4a')?_0x1620('0x49'):_0x1620('0x46');if(_0x11a3f4){_0x228bea[_0x1620('0x1e')]=_0x11a3f4[_0x1620('0x21')];}var _0x462316=util[_0x1620('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2121f9[_0x1620('0x43')],_0x5969fc[_0x1620('0x4b')],md5(_0x5969fc['uniqueid']));if(_0x121e8c&&_0x121e8c[_0x1620('0x4c')]){logger['info'](_0x1620('0x4d'),_0x1620('0x4e'));_0x5969fc[_0x1620('0x4f')]=_0x462316;}else if(_0x5e1c73&&_0x5e1c73['recordingFormat']&&_0x5e1c73[_0x1620('0x50')]!==_0x1620('0x51')){logger[_0x1620('0xf')](_0x1620('0x52'),_0x1620('0x4e'));_0x5969fc[_0x1620('0x4f')]=_0x462316;}else{_0x5969fc[_0x1620('0x4f')]='';}return getAdminId(_0x228bea,_0x19164a,_0x1d6466,_0xaf9dc)[_0x1620('0x1d')](getUser(_0x19164a,_0x1d6466,_0xaf9dc))[_0x1620('0x1d')](getEndUser(_0x19164a,_0x1d6466,_0xaf9dc))[_0x1620('0x1d')](getTicket(_0x19164a,_0x1d6466,_0xaf9dc,_0x46b532,_0x5969fc))[_0x1620('0x1d')](function(_0x3fdd9b){logger[_0x1620('0xf')](util[_0x1620('0x28')](_0x1620('0x53'),_0x3fdd9b[_0x1620('0x3a')]));if(_0x19164a!==_0x1620('0x4a')){logger[_0x1620('0xf')]('['+[_0x19164a[_0x1620('0x19')]()]+']',_0x1620('0x54'));emit(_0xaf9dc,_0x11a3f4[_0x1620('0x55')],_0x3fdd9b[_0x1620('0x2c')]);}})[_0x1620('0x17')](function(_0x47b7ff){logger[_0x1620('0x18')]('['+[_0x19164a['toUpperCase']()]+_0x1620('0x56'),util[_0x1620('0x57')](_0x47b7ff,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0740=['contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','name',']\x20Error\x20running\x20Freshsales\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','Admin\x20selected','userId','/api/lookup?q=','&f=','find','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x1f35fb,_0x33900e){var _0x1474cd=function(_0x12ff35){while(--_0x12ff35){_0x1f35fb['push'](_0x1f35fb['shift']());}};_0x1474cd(++_0x33900e);}(_0x0740,0x1b5));var _0x0074=function(_0x41c84e,_0x1de720){_0x41c84e=_0x41c84e-0x0;var _0x5a6339=_0x0740[_0x41c84e];return _0x5a6339;};'use strict';var _=require('lodash');var rp=require(_0x0074('0x0'));var md5=require(_0x0074('0x1'));var util=require(_0x0074('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x0074('0x3'));var intUtil=require('./util');var config=require(_0x0074('0x4'));var logger=require(_0x0074('0x5'))(_0x0074('0x6'));config[_0x0074('0x7')]=_[_0x0074('0x8')](config['redis'],{'host':_0x0074('0x9'),'port':0x18eb});var io=require(_0x0074('0xa'))(new Redis(config[_0x0074('0x7')]));function getAdminId(_0x34d835,_0x306533,_0x4c1f17,_0xd8d233){return new Promise(function(_0xa1b267,_0x2a8570){var _0x1be8f2=![];var _0x412b6f={'method':_0x0074('0xb'),'uri':_0xd8d233+'/api/selector/owners','json':!![]};_0x412b6f[_0x0074('0xc')]=_0x4c1f17;logger['info'](_0x0074('0xd'));return rp(_0x412b6f)[_0x0074('0xe')](function(_0x4883fe){if(_0x4883fe){var _0x1b8279=_0x4883fe[_0x0074('0xf')];var _0x6ccb4d=null;for(_0x6ccb4d=0x0;_0x6ccb4d<_0x1b8279[_0x0074('0x10')];_0x6ccb4d++){if(_0x1b8279[_0x6ccb4d][_0x0074('0x11')]===_0x34d835[_0x0074('0x12')]){_0x34d835[_0x0074('0x13')]=_0x1b8279[_0x6ccb4d]['id'];_0x1be8f2=!![];}}if(_0x1be8f2){logger[_0x0074('0x14')]('Admin\x20found:',_0x34d835[_0x0074('0x13')]);_0xa1b267(_0x34d835);}else{_0x2a8570({'statusCode':0x194,'message':_0x0074('0x15')});}}else{_0x2a8570({'statusCode':0x194,'message':_0x0074('0x15')});}})[_0x0074('0x16')](function(_0x1c2f00){logger[_0x0074('0x17')]('['+[_0x306533[_0x0074('0x18')]()]+']',_0x1c2f00[_0x0074('0x19')]);_0x2a8570(_0x1c2f00);});});}function getUser(_0x5267fd,_0x37c181,_0xfbb223){return function(_0x15b5e8){return new Promise(function(_0x5a18a0,_0x2a1de3){var _0x31f722={'method':'GET','uri':_0xfbb223+_0x0074('0x1a'),'json':!![]};_0x31f722[_0x0074('0xc')]=_0x37c181;logger[_0x0074('0x14')](_0x0074('0x1b'));return rp(_0x31f722)[_0x0074('0xe')](function(_0x2b782b){if(_0x2b782b){var _0x8b5672=_0x2b782b[_0x0074('0xf')];var _0x480323=![];var _0x545abe=null;if(_0x15b5e8[_0x0074('0x1c')]!==null){logger['info'](_0x0074('0x1d'),_0x15b5e8[_0x0074('0x1c')]);_0x15b5e8[_0x0074('0x1e')]=_0x15b5e8[_0x0074('0x1c')];for(_0x545abe=0x0;_0x545abe<_0x8b5672[_0x0074('0x10')];_0x545abe++){if(_0x8b5672[_0x545abe]['email']===_0x15b5e8[_0x0074('0x1c')]){_0x480323=!![];_0x15b5e8['userId']=_0x8b5672[_0x545abe]['id'];logger[_0x0074('0x14')]('User\x20found:',_0x15b5e8['userId']);}}}if(!_0x480323){logger[_0x0074('0x14')](_0x0074('0x1f'));_0x15b5e8[_0x0074('0x1e')]=_0x15b5e8[_0x0074('0x12')];_0x15b5e8[_0x0074('0x20')]=_0x15b5e8['adminId'];_0x480323=!![];}if(_0x480323){_0x5a18a0(_0x15b5e8);}else{_0x2a1de3({'statusCode':0x194,'message':_0x0074('0x15')});}}else{_0x2a1de3({'statusCode':0x194,'message':_0x0074('0x15')});}})[_0x0074('0x16')](function(_0x282a59){logger[_0x0074('0x17')]('['+[_0x5267fd[_0x0074('0x18')]()]+']',_0x282a59[_0x0074('0x19')]);_0x2a1de3(_0x282a59);});});};}function searchContact(_0x4f8a08,_0x1620be,_0xdff9a7,_0x49f74d){return new Promise(function(_0x4a633c,_0x541d5b){var _0x22b718={'method':_0x0074('0xb'),'headers':_0x1620be,'uri':_0x4f8a08+_0x0074('0x21')+_0x49f74d+_0x0074('0x22')+_0xdff9a7+'&entities=contact','json':!![]};rp(_0x22b718)[_0x0074('0xe')](function(_0x1ec97a){var _0x1c8779=_[_0x0074('0x23')](_0x1ec97a['contacts']['contacts'],[_0xdff9a7,_0x49f74d]);_0x4a633c(_0x1c8779);})[_0x0074('0x16')](function(_0x24d946){_0x541d5b(_0x24d946);});});}function getEndUser(_0x46bd34,_0x2a4efc,_0x35762e){return function(_0x1fe92b){return new Promise(function(_0x5e142c,_0x4bae3f){logger['info'](util[_0x0074('0x24')](_0x0074('0x25'),_0x1fe92b[_0x0074('0x26')]));searchContact(_0x35762e,_0x2a4efc,_0x0074('0x27'),_0x1fe92b[_0x0074('0x26')])[_0x0074('0xe')](function(_0x2356ac){if(_0x2356ac){_0x1fe92b[_0x0074('0x28')]=_0x2356ac['id'];logger[_0x0074('0x14')](_0x0074('0x29'),_0x1fe92b[_0x0074('0x28')]);return _0x5e142c(_0x1fe92b);}searchContact(_0x35762e,_0x2a4efc,_0x0074('0x2a'),_0x1fe92b[_0x0074('0x26')])['then'](function(_0x14d1aa){if(_0x14d1aa){_0x1fe92b[_0x0074('0x28')]=_0x14d1aa['id'];logger['info'](_0x0074('0x2b'),_0x1fe92b['endUserId']);return _0x5e142c(_0x1fe92b);}createEndUser(_0x1fe92b,_0x46bd34,_0x2a4efc,_0x35762e)['then'](function(_0x5a59b8){logger[_0x0074('0x14')](_0x0074('0x2c'),_0x5a59b8[_0x0074('0x28')]);return _0x5e142c(_0x5a59b8);});});})[_0x0074('0x16')](function(_0x335b79){_0x4bae3f(_0x335b79);});});};}function createEndUser(_0x58cd97,_0x2cd1a1,_0x2087c3,_0xace8d4){return new Promise(function(_0x213f2f,_0x18e00d){var _0x557e18=moment();var _0x100ceb={'method':_0x0074('0x2d'),'uri':_0xace8d4+_0x0074('0x2e'),'body':{'contact':{'last_name':_0x58cd97['contactNumber'],'work_number':_0x58cd97[_0x0074('0x26')],'mobile_number':_0x58cd97[_0x0074('0x26')],'owner_id':_0x58cd97['userId'],'created_at':_0x557e18[_0x0074('0x24')](_0x0074('0x2f'))}},'json':!![]};_0x100ceb[_0x0074('0xc')]=_0x2087c3;logger['info'](_0x0074('0x30'));return rp(_0x100ceb)[_0x0074('0xe')](function(_0x3bd2ea){_0x58cd97[_0x0074('0x28')]=_0x3bd2ea[_0x0074('0x31')]['id'];_0x213f2f(_0x58cd97);})['catch'](function(_0x2423f8){logger[_0x0074('0x17')]('['+[_0x2cd1a1[_0x0074('0x18')]()]+']',_0x2423f8[_0x0074('0x19')]);_0x18e00d(_0x2423f8[_0x0074('0x19')]);});});}function getTicket(_0x465889,_0xb87038,_0xe5020b,_0x598de8,_0x4f25ca){return function(_0xa5a17d){logger[_0x0074('0x14')](_0x0074('0x32'));return new Promise(function(_0x597a35,_0x4c8f95){var _0x393a9a=moment();var _0x3aea02={'method':_0x0074('0x2d'),'uri':_0xe5020b+_0x0074('0x33'),'body':{'title':intUtil[_0x0074('0x34')](_0x598de8[_0x0074('0x35')],_0x4f25ca,'\x20'),'description':intUtil[_0x0074('0x34')](_0x598de8[_0x0074('0x36')],_0x4f25ca,'\x0a'),'owner_id':_0xa5a17d[_0x0074('0x20')],'creater_id':_0xa5a17d[_0x0074('0x13')],'targetable_id':_0xa5a17d[_0x0074('0x28')],'targetable_type':_0x0074('0x37'),'created_at':_0x393a9a[_0x0074('0x24')](_0x0074('0x2f')),'due_date':_0x393a9a['add'](0x1e,'m')[_0x0074('0x24')](_0x0074('0x2f'))},'json':!![]};_0x3aea02['headers']=_0xb87038;return rp(_0x3aea02)[_0x0074('0xe')](function(_0x45d03a){_0xa5a17d[_0x0074('0x38')]=_0x45d03a[_0x0074('0x39')]['id'];logger[_0x0074('0x14')](_0x0074('0x3a'),_0xa5a17d['ticketId']);_0x597a35(_0xa5a17d);})[_0x0074('0x16')](function(_0x2e412b){logger['error']('['+[_0x465889[_0x0074('0x18')]()]+']',_0x2e412b[_0x0074('0x19')]);_0x4c8f95(_0x2e412b['message']);});});};}function emit(_0x4ebc1f,_0x3c93cf,_0xb219c){var _0x567a27={'uri':_0x4ebc1f+'/contacts/'+_0xb219c};io['to'](util[_0x0074('0x24')]('user:%s',_0x3c93cf))['emit'](_0x0074('0x3b'),_0x567a27);}exports['cs']=function(_0xda2bb2,_0x1a94f0,_0x51eea2,_0x1a98fe,_0x14d201,_0x1d8fec,_0x2c3bf8,_0x1ec09f){var _0x2c8dd7={};var _0xba5993={'Authorization':_0x0074('0x3c')+_0x1d8fec[_0x0074('0x3d')]};_0x1d8fec[_0x0074('0x3e')]=intUtil[_0x0074('0x3f')](_0x1d8fec[_0x0074('0x3e')]);_0x1d8fec[_0x0074('0x40')]=intUtil[_0x0074('0x3f')](_0x1d8fec[_0x0074('0x40')]);var _0x162e18=_0x1d8fec[_0x0074('0x3e')];_0x2c8dd7[_0x0074('0x12')]=_0x1d8fec[_0x0074('0x41')];_0x2c8dd7[_0x0074('0x26')]=_0x1ec09f[_0x0074('0x42')]()===_0x0074('0x43')?_0x1a94f0[_0x0074('0x44')]:_0x1a94f0['calleridnum'];_0x2c8dd7[_0x0074('0x45')]=_0x1ec09f===_0x0074('0x46')||_0x1ec09f===_0x0074('0x47')?_0x0074('0x46'):_0x0074('0x43');if(_0x1a98fe){_0x2c8dd7[_0x0074('0x1c')]=_0x1a98fe[_0x0074('0x11')];}var _0xd7b2d4=util[_0x0074('0x24')](_0x0074('0x48'),_0x1d8fec[_0x0074('0x40')],_0x1a94f0[_0x0074('0x49')],md5(_0x1a94f0[_0x0074('0x49')]));if(_0x14d201&&_0x14d201['monitor_format']){logger[_0x0074('0x14')](_0x0074('0x4a'),_0x0074('0x4b'));_0x1a94f0['recordingURL']=_0xd7b2d4;}else if(_0x2c3bf8&&_0x2c3bf8[_0x0074('0x4c')]&&_0x2c3bf8['recordingFormat']!=='none'){logger['info'](_0x0074('0x4d'),_0x0074('0x4b'));_0x1a94f0[_0x0074('0x4e')]=_0xd7b2d4;}else{_0x1a94f0[_0x0074('0x4e')]='';}return getAdminId(_0x2c8dd7,_0x1ec09f,_0xba5993,_0x162e18)[_0x0074('0xe')](getUser(_0x1ec09f,_0xba5993,_0x162e18))[_0x0074('0xe')](getEndUser(_0x1ec09f,_0xba5993,_0x162e18))[_0x0074('0xe')](getTicket(_0x1ec09f,_0xba5993,_0x162e18,_0x51eea2,_0x1a94f0))[_0x0074('0xe')](function(_0x1f1e95){logger[_0x0074('0x14')](util[_0x0074('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1f1e95[_0x0074('0x38')]));if(_0x1ec09f!==_0x0074('0x47')){logger[_0x0074('0x14')]('['+[_0x1ec09f[_0x0074('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x162e18,_0x1a98fe[_0x0074('0x4f')],_0x1f1e95[_0x0074('0x28')]);}})[_0x0074('0x16')](function(_0x593550){logger['error']('['+[_0x1ec09f['toUpperCase']()]+_0x0074('0x50'),util['inspect'](_0x593550,{'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 3355340..9111774 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 _0xf2a6=['zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','dynamics365','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xf2a6,0x116));var _0x6f2a=function(_0x185221,_0x1f77ae){_0x185221=_0x185221-0x0;var _0x36cdd3=_0xf2a6[_0x185221];return _0x36cdd3;};'use strict';var _=require(_0x6f2a('0x0'));var util=require(_0x6f2a('0x1'));var zendesk=require(_0x6f2a('0x2'));var salesforce=require(_0x6f2a('0x3'));var sugarcrm=require(_0x6f2a('0x4'));var freshdesk=require(_0x6f2a('0x5'));var zoho=require(_0x6f2a('0x6'));var desk=require(_0x6f2a('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0x6f2a('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0x6f2a('0x9'));var integrations=[_0x6f2a('0xa'),_0x6f2a('0xb'),_0x6f2a('0xc'),_0x6f2a('0xd'),'zoho',_0x6f2a('0xe'),_0x6f2a('0xf'),'dynamics365',_0x6f2a('0x10'),_0x6f2a('0x11')];exports[_0x6f2a('0x12')]=function(_0x132ddb,_0x47959b,_0x1a1428,_0x596315,_0x2ff22e,_0x5af7bd){if(_0x1a1428){if(_[_0x6f2a('0x13')](integrations,_0x132ddb[_0x6f2a('0x14')][_0x6f2a('0x15')]())){try{var _0x1d9af8=null;var _0x19e6b5='';var _0x4e6e33=_0x1a1428[_0x132ddb[_0x6f2a('0x14')]['toLowerCase']()];if(_0x4e6e33){var _0x4b5012=_0x4e6e33[_0x132ddb['data2']];if(_0x4b5012){var _0x59f3e7=_['find'](_0x4b5012['Configurations'],{'id':parseInt(_0x132ddb['data3'],0xa)});if(_0x59f3e7){if(_0x596315){if(_0x2ff22e&&_0x47959b[_0x6f2a('0x16')]){_0x19e6b5=_0x6f2a('0x16');}else if(_0x47959b[_0x6f2a('0x17')]){_0x19e6b5=_0x6f2a('0x18');}else{console[_0x6f2a('0x19')](_0x6f2a('0x1a'),_0x47959b);}}else{_0x19e6b5=_0x6f2a('0x1b');}switch(_0x132ddb[_0x6f2a('0x14')][_0x6f2a('0x15')]()){case _0x6f2a('0xa'):zendesk[_0x19e6b5](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd);break;case'salesforce':salesforce[_0x19e6b5](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd);break;case _0x6f2a('0xc'):sugarcrm[_0x19e6b5](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd);break;case'freshdesk':freshdesk[_0x19e6b5](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd);break;case'zoho':zoho[_0x19e6b5](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd);break;case _0x6f2a('0xe'):desk[_0x19e6b5](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd);break;case _0x6f2a('0xf'):vtiger[_0x19e6b5](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd);break;case _0x6f2a('0x10'):freshsales['cs'](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd,_0x19e6b5);break;case _0x6f2a('0x11'):servicenow['cs'](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd,_0x19e6b5);break;case _0x6f2a('0x1c'):dynamics365['cs'](_0x132ddb,_0x47959b,_0x59f3e7,_0x596315,_0x2ff22e,_0x4b5012,_0x5af7bd,_0x19e6b5);break;default:console[_0x6f2a('0x19')]('unknown\x20integration');}}else{_0x1d9af8=require('../../../../config/logger')(_0x132ddb[_0x6f2a('0x14')][_0x6f2a('0x15')]());_0x1d9af8[_0x6f2a('0x1d')](_0x6f2a('0x1e'),util[_0x6f2a('0x1f')](_0x6f2a('0x20'),_0x132ddb[_0x6f2a('0x14')]['toLowerCase'](),_0x132ddb[_0x6f2a('0x21')]));}}else{_0x1d9af8=require('../../../../config/logger')(_0x132ddb['data1'][_0x6f2a('0x15')]());_0x1d9af8['error']('[EXEC]',util[_0x6f2a('0x1f')](_0x6f2a('0x22'),_0x132ddb[_0x6f2a('0x14')][_0x6f2a('0x15')](),_0x132ddb[_0x6f2a('0x23')]));}}else{}}catch(_0x124e04){console[_0x6f2a('0x1d')](_0x124e04);}}}}; \ No newline at end of file +var _0x3c03=['Configurations','data3','queue','routeId','log','unmanaged','zoho','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3c03,0x16d));var _0x33c0=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x3c03[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x33c0('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x33c0('0x1'));var freshdesk=require(_0x33c0('0x2'));var zoho=require(_0x33c0('0x3'));var desk=require(_0x33c0('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x33c0('0x5'));var dynamics365=require(_0x33c0('0x6'));var freshsales=require(_0x33c0('0x7'));var integrations=[_0x33c0('0x8'),_0x33c0('0x9'),_0x33c0('0xa'),_0x33c0('0xb'),'zoho',_0x33c0('0xc'),_0x33c0('0xd'),'dynamics365',_0x33c0('0xe'),_0x33c0('0xf')];exports['exec']=function(_0x2bb7f6,_0xb2741f,_0x43362b,_0x142af7,_0x5033aa,_0x4aeb32){if(_0x43362b){if(_[_0x33c0('0x10')](integrations,_0x2bb7f6[_0x33c0('0x11')]['toLowerCase']())){try{var _0x5ab672=null;var _0x5063bb='';var _0x381ada=_0x43362b[_0x2bb7f6[_0x33c0('0x11')][_0x33c0('0x12')]()];if(_0x381ada){var _0x43187e=_0x381ada[_0x2bb7f6[_0x33c0('0x13')]];if(_0x43187e){var _0x3e632e=_['find'](_0x43187e[_0x33c0('0x14')],{'id':parseInt(_0x2bb7f6[_0x33c0('0x15')],0xa)});if(_0x3e632e){if(_0x142af7){if(_0x5033aa&&_0xb2741f[_0x33c0('0x16')]){_0x5063bb='queue';}else if(_0xb2741f[_0x33c0('0x17')]){_0x5063bb='outbound';}else{console[_0x33c0('0x18')]('EVENT\x20UNKNOWN',_0xb2741f);}}else{_0x5063bb=_0x33c0('0x19');}switch(_0x2bb7f6[_0x33c0('0x11')][_0x33c0('0x12')]()){case _0x33c0('0x8'):zendesk[_0x5063bb](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32);break;case _0x33c0('0x9'):salesforce[_0x5063bb](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32);break;case _0x33c0('0xa'):sugarcrm[_0x5063bb](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32);break;case'freshdesk':freshdesk[_0x5063bb](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32);break;case _0x33c0('0x1a'):zoho[_0x5063bb](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32);break;case _0x33c0('0xc'):desk[_0x5063bb](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32);break;case _0x33c0('0xd'):vtiger[_0x5063bb](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32);break;case _0x33c0('0xe'):freshsales['cs'](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32,_0x5063bb);break;case _0x33c0('0xf'):servicenow['cs'](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32,_0x5063bb);break;case _0x33c0('0x1b'):dynamics365['cs'](_0x2bb7f6,_0xb2741f,_0x3e632e,_0x142af7,_0x5033aa,_0x43187e,_0x4aeb32,_0x5063bb);break;default:console['log'](_0x33c0('0x1c'));}}else{_0x5ab672=require(_0x33c0('0x1d'))(_0x2bb7f6[_0x33c0('0x11')][_0x33c0('0x12')]());_0x5ab672['error'](_0x33c0('0x1e'),util[_0x33c0('0x1f')](_0x33c0('0x20'),_0x2bb7f6[_0x33c0('0x11')][_0x33c0('0x12')](),_0x2bb7f6[_0x33c0('0x15')]));}}else{_0x5ab672=require(_0x33c0('0x1d'))(_0x2bb7f6[_0x33c0('0x11')][_0x33c0('0x12')]());_0x5ab672[_0x33c0('0x21')](_0x33c0('0x1e'),util[_0x33c0('0x1f')](_0x33c0('0x22'),_0x2bb7f6[_0x33c0('0x11')]['toLowerCase'](),_0x2bb7f6[_0x33c0('0x13')]));}}else{}}catch(_0x2b1af2){console[_0x33c0('0x21')](_0x2b1af2);}}}}; \ 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 66c839d..4585870 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 _0x80db=['salesforce','localhost','socket.io-emitter','redis','getString','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','WhatId','ticketType','ContactId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','account','first','Phone','toLowerCase','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','upperFirst','forEach','includes','string','picklist','idField','toString','type','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','error','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/logger'];(function(_0x19c1ca,_0x881113){var _0x5960af=function(_0x3e568f){while(--_0x3e568f){_0x19c1ca['push'](_0x19c1ca['shift']());}};_0x5960af(++_0x881113);}(_0x80db,0x75));var _0xb80d=function(_0x5bb23e,_0x5895cf){_0x5bb23e=_0x5bb23e-0x0;var _0x318776=_0x80db[_0x5bb23e];return _0x318776;};'use strict';var _=require(_0xb80d('0x0'));var rp=require(_0xb80d('0x1'));var moment=require(_0xb80d('0x2'));var BPromise=require(_0xb80d('0x3'));var md5=require(_0xb80d('0x4'));var jsforce=require(_0xb80d('0x5'));var util=require(_0xb80d('0x6'));var Redis=require('ioredis');var intUtil=require(_0xb80d('0x7'));var config=require('../../../../config/environment');var logger=require(_0xb80d('0x8'))(_0xb80d('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xb80d('0xa'),'port':0x18eb});var io=require(_0xb80d('0xb'))(new Redis(config[_0xb80d('0xc')]));function emit(_0x4ae6ea,_0x5a83ee,_0xb64031){io['to'](_0x4ae6ea)['emit'](_0x5a83ee,_0xb64031);}function getTicket(_0x2f1c3a,_0x2c09fd,_0x52b25c,_0x39f801,_0x4baac3,_0x7b4c8e,_0x41b5ff,_0x5c963c){var _0x443d68=Object['assign']({},{'OwnerId':_0x2c09fd['id'],'Subject':intUtil['getString'](_0x39f801['Subjects'],_0x4baac3,'\x20'),'Description':intUtil[_0xb80d('0xd')](_0x39f801['Descriptions'],_0x4baac3,'\x0a')},getCustomFields(_0x7b4c8e,_0x4baac3));if(_0x52b25c){if(_0x39f801['ticketType']===_0xb80d('0xe')){_0x443d68[_0xb80d('0xf')]=moment['utc']();_0x443d68[_0xb80d('0x10')]=![];_0x443d68[_0xb80d('0x11')]=![];if(_0x52b25c[_0xb80d('0x12')]===_0xb80d('0x13')||_0x52b25c['endUserType']==='lead'){_0x443d68[_0xb80d('0x14')]=_0x52b25c['id'];}else if(_0x52b25c['endUserType']==='account'){_0x443d68[_0xb80d('0x15')]=_0x52b25c['id'];}}else if(_0x39f801[_0xb80d('0x16')]==='Case'){if(_0x52b25c[_0xb80d('0x12')]===_0xb80d('0x13')){_0x443d68[_0xb80d('0x17')]=_0x52b25c['id'];}else if(_0x52b25c[_0xb80d('0x12')]==='account'){_0x443d68['AccountId']=_0x52b25c['id'];}else if(_0x52b25c['endUserType']===_0xb80d('0x18')&&_0x39f801[_0xb80d('0x19')]){_0x443d68[_0x39f801[_0xb80d('0x19')]]=_0x52b25c['id'];}else{logger['info'](_0xb80d('0x1a'));}}}return _0x41b5ff[_0xb80d('0x1b')](_0x39f801['ticketType'])[_0xb80d('0x1c')](_0x443d68);}function getUser(_0x52aa0a,_0x3310bb,_0x29634d){if(!_[_0xb80d('0x1d')](_0x3310bb)&&intUtil[_0xb80d('0x1e')](_0x3310bb)){var _0x52245b={'Email':_0x3310bb};var _0x57a44c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x29634d[_0xb80d('0x1b')](_0xb80d('0x1f'))[_0xb80d('0x20')](_0x52245b,_0x57a44c)[_0xb80d('0x21')]()['then'](function(_0x50c44d){if(_0x50c44d[_0xb80d('0x22')]){var _0xf66e10=_['find'](_0x50c44d,function(_0x21ff96){return _0x21ff96[_0xb80d('0x23')]===_0x3310bb;});if(_0xf66e10){logger['info'](_0xb80d('0x24'),_0x3310bb);return BPromise[_0xb80d('0x25')]({'id':_0xf66e10['Id'],'name':_0xf66e10[_0xb80d('0x26')]});}}else{logger[_0xb80d('0x27')](_0xb80d('0x28'),_0x3310bb);return _0x29634d['identity']()[_0xb80d('0x29')](function(_0x1cd281){return BPromise[_0xb80d('0x25')]({'id':_0x1cd281[_0xb80d('0x2a')],'name':_0x1cd281[_0xb80d('0x2b')]});});}});}else{logger[_0xb80d('0x27')](_0xb80d('0x28'),_0x3310bb);return _0x29634d[_0xb80d('0x2c')]()[_0xb80d('0x29')](function(_0x3813d4){return BPromise[_0xb80d('0x25')]({'id':_0x3813d4[_0xb80d('0x2a')],'name':_0x3813d4[_0xb80d('0x2b')]});});}}function getEndUser(_0x39b208,_0x5d180c,_0x65c64a,_0xdbb6e,_0x43fc64){var _0x2ad153={'$or':{'Phone':_0xdbb6e}};var _0x5188c3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb80d('0x25')]()[_0xb80d('0x29')](function(){logger[_0xb80d('0x27')](_0xb80d('0x2d'),_0xdbb6e,_0x5d180c[_0xb80d('0x2e')]);switch(_0x5d180c[_0xb80d('0x2e')]){case _0xb80d('0x2f'):var _0x5907d9=_[_0xb80d('0x30')](_0x2ad153);if(_0x5d180c[_0xb80d('0x31')]){var _0x290817={};_0x290817[_0x5d180c['additionalSearchContact']]=_0xdbb6e;_[_0xb80d('0x32')](_0x5907d9[_0xb80d('0x33')],_0x290817);}return _0x43fc64['sobject'](_0xb80d('0x34'))[_0xb80d('0x20')](_0x5907d9,_0x5188c3)[_0xb80d('0x21')]()[_0xb80d('0x29')](function(_0x2f647b){if(_0x2f647b&&_0x2f647b[_0xb80d('0x22')]){return _0x2f647b;}else{var _0x42fcc3=_[_0xb80d('0x30')](_0x2ad153);if(_0x5d180c['additionalSearchLead']){var _0x1533bd={};_0x1533bd[_0x5d180c[_0xb80d('0x35')]]=_0xdbb6e;_['merge'](_0x42fcc3[_0xb80d('0x33')],_0x1533bd);}return _0x43fc64['sobject'](_0xb80d('0x36'))['find'](_0x42fcc3,_0x5188c3);}});case _0xb80d('0x37'):var _0xced27c=_['cloneDeep'](_0x2ad153);if(_0x5d180c[_0xb80d('0x38')]){var _0x290817={};_0x290817[_0x5d180c[_0xb80d('0x38')]]=_0xdbb6e;_[_0xb80d('0x32')](_0xced27c[_0xb80d('0x33')],_0x290817);}return _0x43fc64[_0xb80d('0x1b')](_0xb80d('0x39'))[_0xb80d('0x20')](_0xced27c,_0x5188c3)[_0xb80d('0x21')]()[_0xb80d('0x29')](function(_0x525e99){if(_0x525e99&&_0x525e99[_0xb80d('0x22')]){return _0x525e99;}else{var _0x2fb23d=_[_0xb80d('0x30')](_0x2ad153);if(_0x5d180c[_0xb80d('0x31')]){var _0x2622af={};_0x2622af[_0x5d180c['additionalSearchContact']]=_0xdbb6e;_['merge'](_0x2fb23d[_0xb80d('0x33')],_0x2622af);}return _0x43fc64[_0xb80d('0x1b')]('Contact')[_0xb80d('0x20')](_0x2fb23d,_0x5188c3)[_0xb80d('0x29')](function(_0x53186b){if(_0x53186b&&_0x53186b[_0xb80d('0x22')]){return _0x53186b;}else{var _0x431d92=_[_0xb80d('0x30')](_0x2ad153);if(_0x5d180c[_0xb80d('0x35')]){var _0x141ed2={};_0x141ed2[_0x5d180c[_0xb80d('0x35')]]=_0xdbb6e;_[_0xb80d('0x32')](_0x431d92[_0xb80d('0x33')],_0x141ed2);}return _0x43fc64[_0xb80d('0x1b')]('Lead')[_0xb80d('0x20')](_0x431d92,_0x5188c3);}});}});case _0xb80d('0x13'):var _0x5907d9=_[_0xb80d('0x30')](_0x2ad153);if(_0x5d180c[_0xb80d('0x31')]){var _0x290817={};_0x290817[_0x5d180c[_0xb80d('0x31')]]=_0xdbb6e;_['merge'](_0x5907d9[_0xb80d('0x33')],_0x290817);}return _0x43fc64[_0xb80d('0x1b')](_0xb80d('0x34'))[_0xb80d('0x20')](_0x5907d9,_0x5188c3)[_0xb80d('0x21')]();case _0xb80d('0x18'):var _0x382472=_[_0xb80d('0x30')](_0x2ad153);if(_0x5d180c[_0xb80d('0x35')]){var _0x290817={};_0x290817[_0x5d180c[_0xb80d('0x35')]]=_0xdbb6e;_[_0xb80d('0x32')](_0x382472['$or'],_0x290817);}return _0x43fc64['sobject'](_0xb80d('0x36'))[_0xb80d('0x20')](_0x382472,_0x5188c3);case _0xb80d('0x3a'):var _0xced27c=_[_0xb80d('0x30')](_0x2ad153);if(_0x5d180c[_0xb80d('0x38')]){var _0x290817={};_0x290817[_0x5d180c[_0xb80d('0x38')]]=_0xdbb6e;_['merge'](_0xced27c['$or'],_0x290817);}return _0x43fc64[_0xb80d('0x1b')](_0xb80d('0x39'))[_0xb80d('0x20')](_0xced27c,_0x5188c3);default:return null;}})[_0xb80d('0x29')](function(_0x5eb3b0){if(_0x5eb3b0&&_0x5eb3b0[_0xb80d('0x22')]){var _0x5f26c3=_[_0xb80d('0x3b')](_0x5eb3b0);if(_0x5f26c3){return BPromise[_0xb80d('0x25')]({'id':_0x5f26c3['Id'],'name':_0x5f26c3[_0xb80d('0x26')],'phone':_0x5f26c3[_0xb80d('0x3c')],'endUserType':_0x5f26c3['attributes']['type'][_0xb80d('0x3d')]()});}}})[_0xb80d('0x29')](function(_0x58ab6a){if(_0x58ab6a){logger[_0xb80d('0x27')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x58ab6a[_0xb80d('0x12')],_0xdbb6e);return BPromise[_0xb80d('0x25')](_0x58ab6a);}else{logger['info'](_0xb80d('0x3e'),_0xdbb6e);var _0x483c09={'Phone':_0xdbb6e};if(_0x5d180c[_0xb80d('0x3f')]){if(_0x5d180c[_0xb80d('0x3f')]===_0xb80d('0x13')){logger['info'](_0xb80d('0x40'),_0xdbb6e,_0x5d180c[_0xb80d('0x3f')]);_0x483c09[_0xb80d('0x41')]=_0x65c64a!==_0xb80d('0x42')?_0x65c64a:util[_0xb80d('0x43')](_0xb80d('0x44'),_0xdbb6e);}else if(_0x5d180c[_0xb80d('0x3f')]==='lead'){logger[_0xb80d('0x27')](_0xb80d('0x40'),_0xdbb6e,_0x5d180c[_0xb80d('0x3f')]);_0x483c09[_0xb80d('0x41')]=_0x65c64a!==_0xb80d('0x42')?_0x65c64a:util[_0xb80d('0x43')](_0xb80d('0x44'),_0xdbb6e);_0x483c09[_0xb80d('0x45')]='No\x20Company';}else if(_0x5d180c[_0xb80d('0x3f')]===_0xb80d('0x3a')){logger[_0xb80d('0x27')](_0xb80d('0x40'),_0xdbb6e,_0x5d180c[_0xb80d('0x3f')]);_0x483c09[_0xb80d('0x26')]=_0x65c64a!==''?_0x65c64a:util[_0xb80d('0x43')]('Caller\x20-\x20%s',_0xdbb6e);}else{return null;}}return _0x43fc64[_0xb80d('0x1b')](_[_0xb80d('0x46')](_0x5d180c[_0xb80d('0x3f')]))['create'](_0x483c09)[_0xb80d('0x29')](function(_0x2b2a9e){return BPromise[_0xb80d('0x25')]({'id':_0x2b2a9e['id'],'endUserType':_0x5d180c['moduleCreate']});});}});}function getCustomFields(_0x408cde,_0x440fa6){var _0x336fa6={};if(_0x408cde['length']>0x0){_[_0xb80d('0x47')](_0x408cde,function(_0x124397){if(_[_0xb80d('0x48')]([_0xb80d('0x49'),_0xb80d('0x4a')],_0x124397['type'])&&_0x124397[_0xb80d('0x4b')]){_0x336fa6[_0x124397[_0xb80d('0x4b')]]=_0x124397['content'][_0xb80d('0x4c')]();}else if(_0x124397[_0xb80d('0x4d')]==='variable'&&_0x124397[_0xb80d('0x4e')]&&_0x124397[_0xb80d('0x4b')]){_0x440fa6[_0x124397[_0xb80d('0x4e')]]&&(_0x336fa6[_0x124397[_0xb80d('0x4b')]]=_0x440fa6[_0x124397[_0xb80d('0x4e')]][_0xb80d('0x4c')]());}else if(_0x124397[_0xb80d('0x4d')]===_0xb80d('0x4f')&&_0x124397[_0xb80d('0x50')]&&_0x124397['Variable'][_0xb80d('0x51')]&&_0x124397[_0xb80d('0x4b')]){_0x440fa6[_0x124397[_0xb80d('0x50')]['name'][_0xb80d('0x3d')]()]&&(_0x336fa6[_0x124397[_0xb80d('0x4b')]]=_0x440fa6[_0x124397[_0xb80d('0x50')][_0xb80d('0x51')][_0xb80d('0x3d')]()][_0xb80d('0x4c')]());}});}return _0x336fa6;}function getConnection(_0xa0553e){var _0xfa81fc=_0xa0553e['password'][_0xb80d('0x52')](_0xa0553e[_0xb80d('0x53')]);var _0x5d6ba0=new jsforce[(_0xb80d('0x54'))]({'oauth2':{'loginUrl':_0xa0553e[_0xb80d('0x55')]||_0xb80d('0x56'),'clientId':_0xa0553e['clientId'],'clientSecret':_0xa0553e[_0xb80d('0x57')]}});return _0x5d6ba0[_0xb80d('0x58')](_0xa0553e[_0xb80d('0x59')],_0xfa81fc)[_0xb80d('0x29')](function(){logger[_0xb80d('0x27')](_0xb80d('0x5a'));return _0x5d6ba0;});}exports[_0xb80d('0x5b')]=function(_0x4c83e1,_0x3d2a69,_0x5a0aca,_0xa0f5c3,_0x5f5c8d,_0x5b76b5){var _0x2fe2bb,_0x56091d,_0x25604e,_0x182d19;_0x5b76b5[_0xb80d('0x5c')]=intUtil[_0xb80d('0x5d')](_0x5b76b5['serverUrl']);_0x5b76b5['remoteUri']=intUtil[_0xb80d('0x5d')](_0x5b76b5[_0xb80d('0x55')]);if(_0x5f5c8d&&_0x5f5c8d[_0xb80d('0x5e')]){logger[_0xb80d('0x27')](_0xb80d('0x5f'),_0xb80d('0x60'));_0x3d2a69[_0xb80d('0x61')]=util[_0xb80d('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b76b5[_0xb80d('0x5c')],_0x3d2a69[_0xb80d('0x62')],md5(_0x3d2a69[_0xb80d('0x62')]));}else{_0x3d2a69[_0xb80d('0x61')]='';}return getConnection(_0x5b76b5)[_0xb80d('0x29')](function(_0x457686){_0x182d19=_0x457686;return getUser(_0x5b76b5,_0xa0f5c3['email'],_0x182d19);})['then'](function(_0x30e67c){_0x2fe2bb=_0x30e67c;return getEndUser(_0x5b76b5,_0x5a0aca,_0x3d2a69[_0xb80d('0x63')],_0x3d2a69['calleridnum'],_0x182d19);})['then'](function(_0x52008d){_0x56091d=_0x52008d;return getTicket(_0x5b76b5,_0x2fe2bb,_0x56091d,_0x5a0aca,_0x3d2a69,_0x5a0aca[_0xb80d('0x64')],_0x182d19,_0xb80d('0x5b'));})[_0xb80d('0x29')](function(_0x40b51b){_0x25604e=_0x40b51b;logger[_0xb80d('0x27')](_0xb80d('0x65'),_0x25604e['id']);logger[_0xb80d('0x27')](_0xb80d('0x66'),_0x25604e['id'],_0xa0f5c3[_0xb80d('0x51')],_0x5b76b5[_0xb80d('0x4d')]);switch(_0x5b76b5[_0xb80d('0x4d')]){case _0xb80d('0x67'):emit(util[_0xb80d('0x43')]('user:%s',_0xa0f5c3['name']),_0xb80d('0x68'),{'recordId':_0x25604e['id']});break;case _0xb80d('0x69'):emit(util[_0xb80d('0x43')](_0xb80d('0x6a'),_0xa0f5c3[_0xb80d('0x51')]),_0xb80d('0x6b'),{'uri':util['format'](_0xb80d('0x6c'),_0x182d19['instanceUrl'],_0x25604e['id'])});break;default:logger[_0xb80d('0x6d')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xb80d('0x6e')](function(_0x38002e){logger['error'](_0xb80d('0x5f'),_0x38002e);});};exports[_0xb80d('0x6f')]=function(_0x1985b3,_0x1eee53,_0x2028d9,_0xc45b80,_0x4edd60,_0xabde2,_0x1f8075){var _0x326321,_0x521f74,_0x3efd9b,_0x5e3c73;_0xabde2['serverUrl']=intUtil[_0xb80d('0x5d')](_0xabde2[_0xb80d('0x5c')]);_0xabde2[_0xb80d('0x55')]=intUtil[_0xb80d('0x5d')](_0xabde2[_0xb80d('0x55')]);if(_0x1f8075&&_0x1f8075[_0xb80d('0x70')]&&_0x1f8075['recordingFormat']!==_0xb80d('0x71')){logger[_0xb80d('0x27')](_0xb80d('0x72'),_0xb80d('0x60'));_0x1eee53[_0xb80d('0x61')]=util[_0xb80d('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xabde2[_0xb80d('0x5c')],_0x1eee53[_0xb80d('0x62')],md5(_0x1eee53[_0xb80d('0x62')]));}return getConnection(_0xabde2)[_0xb80d('0x29')](function(_0x5f1bf0){_0x5e3c73=_0x5f1bf0;return getUser(_0xabde2,_0xc45b80[_0xb80d('0x73')],_0x5e3c73);})[_0xb80d('0x29')](function(_0x4e99af){_0x326321=_0x4e99af;return getEndUser(_0xabde2,_0x2028d9,_0x1eee53[_0xb80d('0x74')],_0x1eee53[_0xb80d('0x75')],_0x5e3c73);})[_0xb80d('0x29')](function(_0x5c7fbb){_0x521f74=_0x5c7fbb;return getTicket(_0xabde2,_0x326321,_0x521f74,_0x2028d9,_0x1eee53,_0x2028d9['Fields'],_0x5e3c73,_0xb80d('0x6f'));})[_0xb80d('0x29')](function(_0x35e243){_0x3efd9b=_0x35e243;logger[_0xb80d('0x27')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3efd9b['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3efd9b['id'],_0xc45b80[_0xb80d('0x51')],_0xabde2[_0xb80d('0x4d')]);switch(_0xabde2[_0xb80d('0x4d')]){case _0xb80d('0x67'):emit(util[_0xb80d('0x43')](_0xb80d('0x6a'),_0xc45b80['name']),_0xb80d('0x68'),{'recordId':_0x3efd9b['id']});break;case _0xb80d('0x69'):emit(util['format'](_0xb80d('0x6a'),_0xc45b80[_0xb80d('0x51')]),_0xb80d('0x6b'),{'uri':util['format']('%s/%s/e',_0x5e3c73[_0xb80d('0x76')],_0x3efd9b['id'])});break;default:logger[_0xb80d('0x6d')](_0xb80d('0x72'),_0xb80d('0x77'));}})[_0xb80d('0x6e')](function(_0x358ba6){logger['error'](_0xb80d('0x72'),_0x358ba6);});};exports[_0xb80d('0x78')]=function(_0x278a04,_0x55a067,_0x3d4228,_0x16ad2a,_0x57b523,_0x944332){var _0x5e0f7,_0xc4fcfe,_0x70de85,_0x3d2b80;_0x944332['serverUrl']=intUtil['stripTrailingSlash'](_0x944332[_0xb80d('0x5c')]);_0x944332[_0xb80d('0x55')]=intUtil[_0xb80d('0x5d')](_0x944332[_0xb80d('0x55')]);if(_0x57b523&&_0x57b523[_0xb80d('0x5e')]){logger[_0xb80d('0x27')]('['+_0x55a067['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x55a067['recordingURL']=util[_0xb80d('0x43')](_0xb80d('0x79'),_0x944332[_0xb80d('0x5c')],_0x55a067[_0xb80d('0x62')],md5(_0x55a067[_0xb80d('0x62')]));}else{_0x55a067[_0xb80d('0x61')]='';}return getConnection(_0x944332)[_0xb80d('0x29')](function(_0x160446){_0x3d2b80=_0x160446;if(!_[_0xb80d('0x1d')](_0x16ad2a)){return getUser(_0x944332,_0x16ad2a['name'],_0x3d2b80);}else{return getUser(_0x944332,null,_0x3d2b80);}})[_0xb80d('0x29')](function(_0x3a443e){_0x5e0f7=_0x3a443e;return getEndUser(_0x944332,_0x3d4228,_0x55a067[_0xb80d('0x63')],_0x55a067[_0xb80d('0x7a')],_0x3d2b80);})['then'](function(_0x119282){_0xc4fcfe=_0x119282;return getTicket(_0x944332,_0x5e0f7,_0xc4fcfe,_0x3d4228,_0x55a067,_0x3d4228['Fields'],_0x3d2b80);})[_0xb80d('0x29')](function(_0x421c68){_0x70de85=_0x421c68;logger[_0xb80d('0x27')]('['+_0x55a067[_0xb80d('0x7b')][_0xb80d('0x7c')]()+']\x20Ticket\x20%s\x20created.',_0x70de85['id']);logger[_0xb80d('0x27')]('['+_0x55a067[_0xb80d('0x7b')]['toUpperCase']()+_0xb80d('0x7d'),_0x944332[_0xb80d('0x4d')]);})[_0xb80d('0x6e')](function(_0x50a143){logger[_0xb80d('0x6d')]('['+_0x55a067[_0xb80d('0x7b')][_0xb80d('0x7c')]()+']',_0x50a143);});}; \ No newline at end of file +var _0x0cf9=['Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','LastName','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','socket.io-emitter','emit','getString','Subjects','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','WhoId','account','contact','ContactId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','execute','length','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','additionalSearchAccount','first'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cf9,0x141));var _0x90cf=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0x0cf9[_0x1c289a];return _0x28d68e;};'use strict';var _=require(_0x90cf('0x0'));var rp=require(_0x90cf('0x1'));var moment=require(_0x90cf('0x2'));var BPromise=require(_0x90cf('0x3'));var md5=require(_0x90cf('0x4'));var jsforce=require(_0x90cf('0x5'));var util=require(_0x90cf('0x6'));var Redis=require('ioredis');var intUtil=require(_0x90cf('0x7'));var config=require(_0x90cf('0x8'));var logger=require(_0x90cf('0x9'))(_0x90cf('0xa'));config['redis']=_[_0x90cf('0xb')](config[_0x90cf('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x90cf('0xd'))(new Redis(config[_0x90cf('0xc')]));function emit(_0x1fdf43,_0x4af62d,_0x598973){io['to'](_0x1fdf43)[_0x90cf('0xe')](_0x4af62d,_0x598973);}function getTicket(_0xc602e6,_0x5a2efc,_0x1478bf,_0xfff5fd,_0x82a39a,_0x275b8d,_0x48d9c8,_0x429249){var _0x9e05a6=Object['assign']({},{'OwnerId':_0x5a2efc['id'],'Subject':intUtil[_0x90cf('0xf')](_0xfff5fd[_0x90cf('0x10')],_0x82a39a,'\x20'),'Description':intUtil[_0x90cf('0xf')](_0xfff5fd['Descriptions'],_0x82a39a,'\x0a')},getCustomFields(_0x275b8d,_0x82a39a));if(_0x1478bf){if(_0xfff5fd[_0x90cf('0x11')]===_0x90cf('0x12')){_0x9e05a6[_0x90cf('0x13')]=moment[_0x90cf('0x14')]();_0x9e05a6['IsReminderSet']=![];_0x9e05a6[_0x90cf('0x15')]=![];if(_0x1478bf[_0x90cf('0x16')]==='contact'||_0x1478bf['endUserType']===_0x90cf('0x17')){_0x9e05a6[_0x90cf('0x18')]=_0x1478bf['id'];}else if(_0x1478bf[_0x90cf('0x16')]===_0x90cf('0x19')){_0x9e05a6['WhatId']=_0x1478bf['id'];}}else if(_0xfff5fd[_0x90cf('0x11')]==='Case'){if(_0x1478bf['endUserType']===_0x90cf('0x1a')){_0x9e05a6[_0x90cf('0x1b')]=_0x1478bf['id'];}else if(_0x1478bf[_0x90cf('0x16')]===_0x90cf('0x19')){_0x9e05a6['AccountId']=_0x1478bf['id'];}else if(_0x1478bf[_0x90cf('0x16')]===_0x90cf('0x17')&&_0xfff5fd[_0x90cf('0x1c')]){_0x9e05a6[_0xfff5fd[_0x90cf('0x1c')]]=_0x1478bf['id'];}else{logger['info'](_0x90cf('0x1d'));}}}return _0x48d9c8['sobject'](_0xfff5fd[_0x90cf('0x11')])[_0x90cf('0x1e')](_0x9e05a6);}function getUser(_0x2a1e5b,_0x3291ed,_0x2410ae){if(!_[_0x90cf('0x1f')](_0x3291ed)&&intUtil[_0x90cf('0x20')](_0x3291ed)){var _0x5c9194={'Email':_0x3291ed};var _0x81f2ae={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2410ae[_0x90cf('0x21')](_0x90cf('0x22'))[_0x90cf('0x23')](_0x5c9194,_0x81f2ae)[_0x90cf('0x24')]()['then'](function(_0x511eb3){if(_0x511eb3[_0x90cf('0x25')]){var _0x5c34e4=_[_0x90cf('0x23')](_0x511eb3,function(_0x26c9e9){return _0x26c9e9['Email']===_0x3291ed;});if(_0x5c34e4){logger[_0x90cf('0x26')]('Agent\x20%s\x20found.',_0x3291ed);return BPromise[_0x90cf('0x27')]({'id':_0x5c34e4['Id'],'name':_0x5c34e4[_0x90cf('0x28')]});}}else{logger[_0x90cf('0x26')](_0x90cf('0x29'),_0x3291ed);return _0x2410ae[_0x90cf('0x2a')]()[_0x90cf('0x2b')](function(_0x362f0c){return BPromise[_0x90cf('0x27')]({'id':_0x362f0c[_0x90cf('0x2c')],'name':_0x362f0c[_0x90cf('0x2d')]});});}});}else{logger['info'](_0x90cf('0x29'),_0x3291ed);return _0x2410ae[_0x90cf('0x2a')]()[_0x90cf('0x2b')](function(_0x53c782){return BPromise[_0x90cf('0x27')]({'id':_0x53c782[_0x90cf('0x2c')],'name':_0x53c782['display_name']});});}}function getEndUser(_0x10e47d,_0xe7d99,_0x2894a0,_0x319050,_0x155662){var _0x1e256e={'$or':{'Phone':_0x319050}};var _0x2b7be2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x90cf('0x27')]()[_0x90cf('0x2b')](function(){logger[_0x90cf('0x26')](_0x90cf('0x2e'),_0x319050,_0xe7d99[_0x90cf('0x2f')]);switch(_0xe7d99[_0x90cf('0x2f')]){case'contact_lead':var _0x10df5b=_['cloneDeep'](_0x1e256e);if(_0xe7d99[_0x90cf('0x30')]){var _0x37befb={};_0x37befb[_0xe7d99['additionalSearchContact']]=_0x319050;_['merge'](_0x10df5b[_0x90cf('0x31')],_0x37befb);}return _0x155662[_0x90cf('0x21')](_0x90cf('0x32'))[_0x90cf('0x23')](_0x10df5b,_0x2b7be2)[_0x90cf('0x24')]()['then'](function(_0x5c83ed){if(_0x5c83ed&&_0x5c83ed[_0x90cf('0x25')]){return _0x5c83ed;}else{var _0x3aeda3=_[_0x90cf('0x33')](_0x1e256e);if(_0xe7d99[_0x90cf('0x34')]){var _0x4f89d2={};_0x4f89d2[_0xe7d99[_0x90cf('0x34')]]=_0x319050;_[_0x90cf('0x35')](_0x3aeda3[_0x90cf('0x31')],_0x4f89d2);}return _0x155662[_0x90cf('0x21')](_0x90cf('0x36'))[_0x90cf('0x23')](_0x3aeda3,_0x2b7be2);}});case'account_contact_lead':var _0x569df7=_[_0x90cf('0x33')](_0x1e256e);if(_0xe7d99[_0x90cf('0x37')]){var _0x37befb={};_0x37befb[_0xe7d99['additionalSearchAccount']]=_0x319050;_['merge'](_0x569df7[_0x90cf('0x31')],_0x37befb);}return _0x155662[_0x90cf('0x21')]('Account')[_0x90cf('0x23')](_0x569df7,_0x2b7be2)[_0x90cf('0x24')]()[_0x90cf('0x2b')](function(_0x519173){if(_0x519173&&_0x519173[_0x90cf('0x25')]){return _0x519173;}else{var _0x2f3609=_['cloneDeep'](_0x1e256e);if(_0xe7d99[_0x90cf('0x30')]){var _0x23c90b={};_0x23c90b[_0xe7d99[_0x90cf('0x30')]]=_0x319050;_[_0x90cf('0x35')](_0x2f3609[_0x90cf('0x31')],_0x23c90b);}return _0x155662['sobject'](_0x90cf('0x32'))[_0x90cf('0x23')](_0x2f3609,_0x2b7be2)[_0x90cf('0x2b')](function(_0x1a8b23){if(_0x1a8b23&&_0x1a8b23['length']){return _0x1a8b23;}else{var _0x408ba=_['cloneDeep'](_0x1e256e);if(_0xe7d99[_0x90cf('0x34')]){var _0x514f58={};_0x514f58[_0xe7d99['additionalSearchLead']]=_0x319050;_[_0x90cf('0x35')](_0x408ba['$or'],_0x514f58);}return _0x155662['sobject']('Lead')[_0x90cf('0x23')](_0x408ba,_0x2b7be2);}});}});case _0x90cf('0x1a'):var _0x10df5b=_[_0x90cf('0x33')](_0x1e256e);if(_0xe7d99[_0x90cf('0x30')]){var _0x37befb={};_0x37befb[_0xe7d99['additionalSearchContact']]=_0x319050;_[_0x90cf('0x35')](_0x10df5b[_0x90cf('0x31')],_0x37befb);}return _0x155662[_0x90cf('0x21')](_0x90cf('0x32'))[_0x90cf('0x23')](_0x10df5b,_0x2b7be2)[_0x90cf('0x24')]();case _0x90cf('0x17'):var _0x36e631=_[_0x90cf('0x33')](_0x1e256e);if(_0xe7d99[_0x90cf('0x34')]){var _0x37befb={};_0x37befb[_0xe7d99[_0x90cf('0x34')]]=_0x319050;_[_0x90cf('0x35')](_0x36e631[_0x90cf('0x31')],_0x37befb);}return _0x155662['sobject']('Lead')[_0x90cf('0x23')](_0x36e631,_0x2b7be2);case'account':var _0x569df7=_[_0x90cf('0x33')](_0x1e256e);if(_0xe7d99[_0x90cf('0x37')]){var _0x37befb={};_0x37befb[_0xe7d99['additionalSearchAccount']]=_0x319050;_[_0x90cf('0x35')](_0x569df7[_0x90cf('0x31')],_0x37befb);}return _0x155662['sobject']('Account')[_0x90cf('0x23')](_0x569df7,_0x2b7be2);default:return null;}})['then'](function(_0x56ecd9){if(_0x56ecd9&&_0x56ecd9['length']){var _0x311fe9=_[_0x90cf('0x38')](_0x56ecd9);if(_0x311fe9){return BPromise[_0x90cf('0x27')]({'id':_0x311fe9['Id'],'name':_0x311fe9[_0x90cf('0x28')],'phone':_0x311fe9[_0x90cf('0x39')],'endUserType':_0x311fe9[_0x90cf('0x3a')][_0x90cf('0x3b')][_0x90cf('0x3c')]()});}}})[_0x90cf('0x2b')](function(_0x26509c){if(_0x26509c){logger[_0x90cf('0x26')](_0x90cf('0x3d'),_0x26509c['endUserType'],_0x319050);return BPromise[_0x90cf('0x27')](_0x26509c);}else{logger[_0x90cf('0x26')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x319050);var _0xe93c2={'Phone':_0x319050};if(_0xe7d99['moduleCreate']){if(_0xe7d99[_0x90cf('0x3e')]===_0x90cf('0x1a')){logger['info'](_0x90cf('0x3f'),_0x319050,_0xe7d99[_0x90cf('0x3e')]);_0xe93c2['LastName']=_0x2894a0!==_0x90cf('0x40')?_0x2894a0:util[_0x90cf('0x41')]('Caller\x20-\x20%s',_0x319050);}else if(_0xe7d99[_0x90cf('0x3e')]===_0x90cf('0x17')){logger[_0x90cf('0x26')](_0x90cf('0x3f'),_0x319050,_0xe7d99['moduleCreate']);_0xe93c2[_0x90cf('0x42')]=_0x2894a0!==_0x90cf('0x40')?_0x2894a0:util['format'](_0x90cf('0x43'),_0x319050);_0xe93c2[_0x90cf('0x44')]=_0x90cf('0x45');}else if(_0xe7d99[_0x90cf('0x3e')]===_0x90cf('0x19')){logger['info'](_0x90cf('0x3f'),_0x319050,_0xe7d99[_0x90cf('0x3e')]);_0xe93c2[_0x90cf('0x28')]=_0x2894a0!==_0x90cf('0x40')?_0x2894a0:util[_0x90cf('0x41')](_0x90cf('0x43'),_0x319050);}else{return null;}}return _0x155662['sobject'](_[_0x90cf('0x46')](_0xe7d99[_0x90cf('0x3e')]))['create'](_0xe93c2)[_0x90cf('0x2b')](function(_0x144d56){return BPromise['resolve']({'id':_0x144d56['id'],'endUserType':_0xe7d99[_0x90cf('0x3e')]});});}});}function getCustomFields(_0x510a37,_0x567b6e){var _0x244b5e={};if(_0x510a37['length']>0x0){_[_0x90cf('0x47')](_0x510a37,function(_0x3a667d){if(_['includes']([_0x90cf('0x48'),'picklist'],_0x3a667d[_0x90cf('0x3b')])&&_0x3a667d[_0x90cf('0x49')]){_0x244b5e[_0x3a667d[_0x90cf('0x49')]]=_0x3a667d[_0x90cf('0x4a')][_0x90cf('0x4b')]();}else if(_0x3a667d[_0x90cf('0x3b')]===_0x90cf('0x4c')&&_0x3a667d['variableName']&&_0x3a667d[_0x90cf('0x49')]){_0x567b6e[_0x3a667d[_0x90cf('0x4d')]]&&(_0x244b5e[_0x3a667d[_0x90cf('0x49')]]=_0x567b6e[_0x3a667d[_0x90cf('0x4d')]][_0x90cf('0x4b')]());}else if(_0x3a667d[_0x90cf('0x3b')]===_0x90cf('0x4e')&&_0x3a667d[_0x90cf('0x4f')]&&_0x3a667d[_0x90cf('0x4f')][_0x90cf('0x50')]&&_0x3a667d[_0x90cf('0x49')]){_0x567b6e[_0x3a667d['Variable']['name'][_0x90cf('0x3c')]()]&&(_0x244b5e[_0x3a667d[_0x90cf('0x49')]]=_0x567b6e[_0x3a667d[_0x90cf('0x4f')][_0x90cf('0x50')][_0x90cf('0x3c')]()][_0x90cf('0x4b')]());}});}return _0x244b5e;}function getConnection(_0x3ad4f2){var _0x55c717=_0x3ad4f2[_0x90cf('0x51')][_0x90cf('0x52')](_0x3ad4f2[_0x90cf('0x53')]);var _0x9cdce0=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3ad4f2[_0x90cf('0x54')]||_0x90cf('0x55'),'clientId':_0x3ad4f2[_0x90cf('0x56')],'clientSecret':_0x3ad4f2[_0x90cf('0x57')]}});return _0x9cdce0[_0x90cf('0x58')](_0x3ad4f2[_0x90cf('0x59')],_0x55c717)[_0x90cf('0x2b')](function(){logger[_0x90cf('0x26')](_0x90cf('0x5a'));return _0x9cdce0;});}exports[_0x90cf('0x5b')]=function(_0xa0410d,_0x2578b3,_0x53abb5,_0xa5f63,_0x2b5fb9,_0x1066d1){var _0x4c91ac,_0x13cbc1,_0x5602a4,_0x31694b;_0x1066d1[_0x90cf('0x5c')]=intUtil[_0x90cf('0x5d')](_0x1066d1['serverUrl']);_0x1066d1['remoteUri']=intUtil[_0x90cf('0x5d')](_0x1066d1[_0x90cf('0x54')]);if(_0x2b5fb9&&_0x2b5fb9[_0x90cf('0x5e')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2578b3['recordingURL']=util[_0x90cf('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1066d1[_0x90cf('0x5c')],_0x2578b3[_0x90cf('0x5f')],md5(_0x2578b3[_0x90cf('0x5f')]));}else{_0x2578b3[_0x90cf('0x60')]='';}return getConnection(_0x1066d1)['then'](function(_0x236bc8){_0x31694b=_0x236bc8;return getUser(_0x1066d1,_0xa5f63[_0x90cf('0x61')],_0x31694b);})[_0x90cf('0x2b')](function(_0x33f319){_0x4c91ac=_0x33f319;return getEndUser(_0x1066d1,_0x53abb5,_0x2578b3[_0x90cf('0x62')],_0x2578b3[_0x90cf('0x63')],_0x31694b);})['then'](function(_0x46cea4){_0x13cbc1=_0x46cea4;return getTicket(_0x1066d1,_0x4c91ac,_0x13cbc1,_0x53abb5,_0x2578b3,_0x53abb5[_0x90cf('0x64')],_0x31694b,_0x90cf('0x5b'));})[_0x90cf('0x2b')](function(_0x2534fa){_0x5602a4=_0x2534fa;logger['info'](_0x90cf('0x65'),_0x5602a4['id']);logger['info'](_0x90cf('0x66'),_0x5602a4['id'],_0xa5f63[_0x90cf('0x50')],_0x1066d1[_0x90cf('0x3b')]);switch(_0x1066d1[_0x90cf('0x3b')]){case _0x90cf('0x67'):emit(util['format'](_0x90cf('0x68'),_0xa5f63[_0x90cf('0x50')]),'trigger:salesforce:display',{'recordId':_0x5602a4['id']});break;case'newTab':emit(util[_0x90cf('0x41')](_0x90cf('0x68'),_0xa5f63['name']),_0x90cf('0x69'),{'uri':util[_0x90cf('0x41')](_0x90cf('0x6a'),_0x31694b['instanceUrl'],_0x5602a4['id'])});break;default:logger[_0x90cf('0x6b')](_0x90cf('0x6c'));}})[_0x90cf('0x6d')](function(_0x17a710){logger[_0x90cf('0x6b')](_0x90cf('0x6e'),_0x17a710);});};exports[_0x90cf('0x6f')]=function(_0x2aac02,_0x20e9d1,_0x3f4308,_0x7cda1d,_0xe67b99,_0x3a463a,_0x257335){var _0x4bca0f,_0x4a4098,_0x59d28f,_0x2fbeab;_0x3a463a['serverUrl']=intUtil[_0x90cf('0x5d')](_0x3a463a['serverUrl']);_0x3a463a[_0x90cf('0x54')]=intUtil[_0x90cf('0x5d')](_0x3a463a[_0x90cf('0x54')]);if(_0x257335&&_0x257335[_0x90cf('0x70')]&&_0x257335['recordingFormat']!==_0x90cf('0x71')){logger['info'](_0x90cf('0x72'),_0x90cf('0x73'));_0x20e9d1[_0x90cf('0x60')]=util[_0x90cf('0x41')](_0x90cf('0x74'),_0x3a463a[_0x90cf('0x5c')],_0x20e9d1[_0x90cf('0x5f')],md5(_0x20e9d1[_0x90cf('0x5f')]));}return getConnection(_0x3a463a)['then'](function(_0x39972b){_0x2fbeab=_0x39972b;return getUser(_0x3a463a,_0x7cda1d[_0x90cf('0x61')],_0x2fbeab);})[_0x90cf('0x2b')](function(_0x15eb23){_0x4bca0f=_0x15eb23;return getEndUser(_0x3a463a,_0x3f4308,_0x20e9d1['destcalleridname'],_0x20e9d1[_0x90cf('0x75')],_0x2fbeab);})[_0x90cf('0x2b')](function(_0x17253b){_0x4a4098=_0x17253b;return getTicket(_0x3a463a,_0x4bca0f,_0x4a4098,_0x3f4308,_0x20e9d1,_0x3f4308[_0x90cf('0x64')],_0x2fbeab,_0x90cf('0x6f'));})[_0x90cf('0x2b')](function(_0x218697){_0x59d28f=_0x218697;logger['info'](_0x90cf('0x76'),_0x59d28f['id']);logger[_0x90cf('0x26')](_0x90cf('0x77'),_0x59d28f['id'],_0x7cda1d[_0x90cf('0x50')],_0x3a463a[_0x90cf('0x3b')]);switch(_0x3a463a[_0x90cf('0x3b')]){case _0x90cf('0x67'):emit(util['format'](_0x90cf('0x68'),_0x7cda1d['name']),'trigger:salesforce:display',{'recordId':_0x59d28f['id']});break;case _0x90cf('0x78'):emit(util[_0x90cf('0x41')](_0x90cf('0x68'),_0x7cda1d[_0x90cf('0x50')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x2fbeab['instanceUrl'],_0x59d28f['id'])});break;default:logger[_0x90cf('0x6b')](_0x90cf('0x72'),_0x90cf('0x79'));}})['catch'](function(_0x4ca45c){logger[_0x90cf('0x6b')](_0x90cf('0x72'),_0x4ca45c);});};exports['unmanaged']=function(_0x1609e7,_0x1fcea6,_0x5dd92d,_0x2a5150,_0x15b9a2,_0x8e960c){var _0x47750a,_0x5d9a3d,_0x3ba54c,_0x2fa930;_0x8e960c['serverUrl']=intUtil['stripTrailingSlash'](_0x8e960c[_0x90cf('0x5c')]);_0x8e960c[_0x90cf('0x54')]=intUtil['stripTrailingSlash'](_0x8e960c[_0x90cf('0x54')]);if(_0x15b9a2&&_0x15b9a2[_0x90cf('0x5e')]){logger[_0x90cf('0x26')]('['+_0x1fcea6[_0x90cf('0x7a')][_0x90cf('0x7b')]()+']','Recording\x20is\x20enabled!');_0x1fcea6[_0x90cf('0x60')]=util[_0x90cf('0x41')](_0x90cf('0x74'),_0x8e960c['serverUrl'],_0x1fcea6[_0x90cf('0x5f')],md5(_0x1fcea6[_0x90cf('0x5f')]));}else{_0x1fcea6['recordingURL']='';}return getConnection(_0x8e960c)['then'](function(_0x3d7cd8){_0x2fa930=_0x3d7cd8;if(!_['isNil'](_0x2a5150)){return getUser(_0x8e960c,_0x2a5150[_0x90cf('0x50')],_0x2fa930);}else{return getUser(_0x8e960c,null,_0x2fa930);}})[_0x90cf('0x2b')](function(_0x249690){_0x47750a=_0x249690;return getEndUser(_0x8e960c,_0x5dd92d,_0x1fcea6[_0x90cf('0x62')],_0x1fcea6[_0x90cf('0x63')],_0x2fa930);})[_0x90cf('0x2b')](function(_0xbf71db){_0x5d9a3d=_0xbf71db;return getTicket(_0x8e960c,_0x47750a,_0x5d9a3d,_0x5dd92d,_0x1fcea6,_0x5dd92d[_0x90cf('0x64')],_0x2fa930);})['then'](function(_0x44f4d4){_0x3ba54c=_0x44f4d4;logger[_0x90cf('0x26')]('['+_0x1fcea6['lastevent'][_0x90cf('0x7b')]()+_0x90cf('0x7c'),_0x3ba54c['id']);logger[_0x90cf('0x26')]('['+_0x1fcea6[_0x90cf('0x7a')][_0x90cf('0x7b')]()+_0x90cf('0x7d'),_0x8e960c[_0x90cf('0x3b')]);})[_0x90cf('0x6d')](function(_0xde4249){logger[_0x90cf('0x6b')]('['+_0x1fcea6['lastevent'][_0x90cf('0x7b')]()+']',_0xde4249);});}; \ 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 a004618..50e2c15 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 _0x68a0=['forEach','includes','string','picklist','type','nameField','customField','content','idField','toString','variable','variableName','toLowerCase','customVariable','name','Variable','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','request-promise','util','md5','./util','../../../../config/environment','servicenow','defaults','redis','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','active','true','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm'];(function(_0x2c5036,_0x3b3da9){var _0x4f48b3=function(_0x9a6f5f){while(--_0x9a6f5f){_0x2c5036['push'](_0x2c5036['shift']());}};_0x4f48b3(++_0x3b3da9);}(_0x68a0,0xa6));var _0x068a=function(_0x1d2e5e,_0x145ae6){_0x1d2e5e=_0x1d2e5e-0x0;var _0x4a1d68=_0x68a0[_0x1d2e5e];return _0x4a1d68;};'use strict';var _=require('lodash');var Promise=require(_0x068a('0x0'));var rp=require(_0x068a('0x1'));var util=require(_0x068a('0x2'));var md5=require(_0x068a('0x3'));var Redis=require('ioredis');var intUtil=require(_0x068a('0x4'));var config=require(_0x068a('0x5'));var logger=require('../../../../config/logger')(_0x068a('0x6'));config['redis']=_[_0x068a('0x7')](config[_0x068a('0x8')],{'host':_0x068a('0x9'),'port':0x18eb});var io=require(_0x068a('0xa'))(new Redis(config[_0x068a('0x8')]));function getAdminUser(_0x44702b,_0x5cbac1,_0x56b8b8,_0x4f7ef0,_0x194d99,_0x2cfb5a){return new Promise(function(_0x59f6e6,_0x105320){var _0x381a0c={'method':_0x068a('0xb'),'uri':_0x4f7ef0+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x194d99+'&'+_0x2cfb5a,'auth':_0x5cbac1,'json':!![]};return rp(_0x381a0c)[_0x068a('0xc')](function(_0x3b104e){if(_0x3b104e[_0x068a('0xd')][_0x068a('0xe')]>0x0){_0x56b8b8[_0x068a('0xf')]=_0x3b104e['result'][0x0][_0x068a('0x10')];}logger[_0x068a('0x11')]('['+[_0x44702b[_0x068a('0x12')]()]+_0x068a('0x13'),_0x56b8b8);_0x59f6e6(_0x56b8b8);})[_0x068a('0x14')](function(_0x2e3e2d){logger[_0x068a('0x15')]('['+[_0x44702b[_0x068a('0x12')]()]+']',_0x2e3e2d[_0x068a('0x16')]);_0x105320(_0x2e3e2d[_0x068a('0x16')]);});});}function getUser(_0x39239f,_0x1270a8,_0x3d0348,_0x2495a6,_0x1d9f8d){return function(_0x54bed8){logger[_0x068a('0x11')]('['+[_0x39239f['toUpperCase']()]+_0x068a('0x17'),_0x54bed8);return new Promise(function(_0x41a842,_0x1238d2){if(intUtil['validateEmail'](_0x54bed8[_0x068a('0x18')])){var _0x149afe={'method':_0x068a('0xb'),'uri':_0x3d0348+_0x068a('0x19')+_0x54bed8['userEmail']+'&'+_0x2495a6+'&'+_0x1d9f8d,'auth':_0x1270a8,'json':!![]};logger['info']('['+[_0x39239f[_0x068a('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x149afe);return rp(_0x149afe)[_0x068a('0xc')](function(_0x12fa78){logger[_0x068a('0x11')]('['+[_0x39239f[_0x068a('0x12')]()]+'],\x20getUser\x20entity',_0x12fa78);if(_0x12fa78['result'][_0x068a('0xe')]>0x0&&String(_0x12fa78['result'][0x0][_0x068a('0x1a')])===_0x068a('0x1b')){_0x54bed8['userId']=_0x12fa78['result'][0x0]['sys_id'];}else{_0x54bed8['userId']=_0x54bed8['adminId'];_0x54bed8[_0x068a('0x18')]=_0x54bed8[_0x068a('0x1c')];}logger[_0x068a('0x11')]('['+[_0x39239f[_0x068a('0x12')]()]+_0x068a('0x1d'),_0x54bed8);_0x41a842(_0x54bed8);})[_0x068a('0x14')](function(_0x457e27){logger[_0x068a('0x15')]('['+[_0x39239f[_0x068a('0x12')]()]+']',_0x457e27[_0x068a('0x16')]);_0x1238d2(_0x457e27['message']);});}else{logger[_0x068a('0x11')]('['+[_0x39239f[_0x068a('0x12')]()]+_0x068a('0x1e'));_0x54bed8['userId']=_0x54bed8[_0x068a('0xf')];_0x54bed8[_0x068a('0x18')]=_0x54bed8[_0x068a('0x1c')];_0x41a842(_0x54bed8);}});};}function createEndUser(_0x2ca23e,_0x24834d,_0x564b15,_0x1fb4b0,_0x1623cc){logger[_0x068a('0x11')]('['+[_0x2ca23e['toUpperCase']()]+_0x068a('0x1f'),_0x564b15);return new Promise(function(_0x547e01,_0x562998){var _0xd1c984={'method':_0x068a('0x20'),'uri':_0x1fb4b0+_0x068a('0x21')+_0x1623cc,'body':{'user_name':_0x564b15[_0x068a('0x22')],'roles':_0x068a('0x23'),'first_name':_0x564b15['endUserNumber'],'active':_0x068a('0x1b'),'date_format':_0x068a('0x24'),'phone':_0x564b15[_0x068a('0x22')]},'auth':_0x24834d,'json':!![]};return rp(_0xd1c984)[_0x068a('0xc')](function(_0x47e87f){logger[_0x068a('0x11')]('['+[_0x2ca23e[_0x068a('0x12')]()]+_0x068a('0x25'),_0x47e87f[_0x068a('0xd')]);_0x564b15[_0x068a('0x26')]=_0x47e87f[_0x068a('0xd')][_0x068a('0x10')];_0x547e01(_0x564b15);})[_0x068a('0x14')](function(_0x201416){logger[_0x068a('0x15')]('['+[_0x2ca23e[_0x068a('0x12')]()]+']',_0x201416[_0x068a('0x16')]);_0x562998(_0x201416[_0x068a('0x16')]);});});}function getEndUser(_0xfcfd8a,_0x3f3b75,_0x15f6b0,_0x8059f5,_0xd1c1fd){return function(_0x11db45){logger['info']('['+[_0xfcfd8a[_0x068a('0x12')]()]+_0x068a('0x27'),_0x11db45);return new Promise(function(_0x250c94,_0x3a7ac3){var _0xde7cd5={'method':'GET','uri':_0x15f6b0+_0x068a('0x28')+_0x11db45[_0x068a('0x22')]+'&'+_0x8059f5+'&'+_0xd1c1fd,'auth':_0x3f3b75,'json':!![]};return rp(_0xde7cd5)['then'](function(_0x90c6ad){if(_0x90c6ad['result'][_0x068a('0xe')]>0x0){_0x11db45[_0x068a('0x26')]=_0x90c6ad['result'][0x0][_0x068a('0x10')];logger[_0x068a('0x11')]('['+[_0xfcfd8a[_0x068a('0x12')]()]+_0x068a('0x29'),_0x11db45);_0x250c94(_0x11db45);}else{return createEndUser(_0xfcfd8a,_0x3f3b75,_0x11db45,_0x15f6b0,_0x8059f5)[_0x068a('0xc')](function(_0x2a2d8f){logger[_0x068a('0x11')]('['+[_0xfcfd8a[_0x068a('0x12')]()]+'],\x20createEndUser\x20crm',_0x2a2d8f);_0x250c94(_0x2a2d8f);});}})[_0x068a('0x14')](function(_0x336321){logger[_0x068a('0x15')]('['+[_0xfcfd8a[_0x068a('0x12')]()]+']',_0x336321[_0x068a('0x16')]);_0x3a7ac3(_0x336321[_0x068a('0x16')]);});});};}function getCustomFields(_0x54e496,_0x56524d){var _0x173a66={};if(_0x54e496[_0x068a('0xe')]>0x0){_[_0x068a('0x2a')](_0x54e496,function(_0xc05d19){if(_[_0x068a('0x2b')]([_0x068a('0x2c'),_0x068a('0x2d')],_0xc05d19[_0x068a('0x2e')])&&_0xc05d19[_0x068a('0x2f')]&&!_0xc05d19[_0x068a('0x30')]){_0x173a66[_0xc05d19[_0x068a('0x2f')]['toLowerCase']()]=_0xc05d19[_0x068a('0x31')]['toString']();}else if(_[_0x068a('0x2b')]([_0x068a('0x2c'),_0x068a('0x2d')],_0xc05d19[_0x068a('0x2e')])&&_0xc05d19[_0x068a('0x32')]&&_0xc05d19['customField']){_0x173a66[_0xc05d19[_0x068a('0x32')]['toLowerCase']()]=_0xc05d19[_0x068a('0x31')][_0x068a('0x33')]();}else if(_0xc05d19['type']===_0x068a('0x34')&&_0xc05d19[_0x068a('0x35')]&&_0xc05d19[_0x068a('0x32')]&&_0xc05d19[_0x068a('0x30')]){_0x173a66[_0xc05d19[_0x068a('0x32')][_0x068a('0x36')]()]=_0x56524d[_0xc05d19[_0x068a('0x35')]][_0x068a('0x33')]();}else if(_0xc05d19['type']===_0x068a('0x37')&&_0xc05d19['Variable']&&_0xc05d19['Variable'][_0x068a('0x38')]&&_0xc05d19['idField']&&_0xc05d19['customField']){_0x173a66[_0xc05d19['idField']['toLowerCase']()]=_0x56524d[_0xc05d19[_0x068a('0x39')][_0x068a('0x38')][_0x068a('0x36')]()]['toString']();}});}return _0x173a66;}function getTicket(_0x491e4f,_0x5d4d37,_0x2d6679,_0x3fc782,_0xec0cbc,_0x4ec487){return function(_0x48b4b7){logger['info']('['+[_0x491e4f[_0x068a('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x48b4b7);return new Promise(function(_0x13f462,_0x2f1e0d){var _0x5b40b0=_0x491e4f[_0x068a('0x36')]()===_0x068a('0x3a')?_0x48b4b7['userId']:_0x48b4b7[_0x068a('0x26')];var _0x19f9d7={'method':'POST','uri':_0x2d6679+_0x068a('0x3b')+'?'+_0x4ec487,'body':Object[_0x068a('0x3c')]({},{'active':'true','caller_id':_0x5b40b0,'assigned_to':_0x48b4b7['userId'],'short_description':intUtil[_0x068a('0x3d')](_0x3fc782[_0x068a('0x3e')],_0xec0cbc,'\x20'),'description':intUtil[_0x068a('0x3d')](_0x3fc782[_0x068a('0x3f')],_0xec0cbc,'\x0a')},getCustomFields(_0x3fc782['Fields'],_0xec0cbc)),'auth':_0x5d4d37,'json':!![]};return rp(_0x19f9d7)[_0x068a('0xc')](function(_0x470d51){logger[_0x068a('0x11')]('['+[_0x491e4f[_0x068a('0x12')]()]+_0x068a('0x40'),_0x470d51[_0x068a('0xd')]);_0x48b4b7[_0x068a('0x41')]=_0x470d51[_0x068a('0xd')]['sys_id'];_0x48b4b7[_0x068a('0x42')]=_0x470d51[_0x068a('0xd')][_0x068a('0x43')];logger[_0x068a('0x11')]('['+[_0x491e4f['toUpperCase']()]+_0x068a('0x44'),_0x48b4b7);_0x13f462(_0x48b4b7);})[_0x068a('0x14')](function(_0x56ab5e){logger['error']('['+[_0x491e4f['toUpperCase']()]+']',_0x56ab5e['message']);_0x2f1e0d(_0x56ab5e[_0x068a('0x16')]);});});};}function createRemoteTag(_0x510491,_0x4c8fab,_0x227309,_0x326bc4){return new Promise(function(_0x509cd3,_0x2eacea){var _0x5102ec={'method':_0x068a('0x20'),'uri':_0x227309+'label'+'?'+_0x326bc4,'body':{'short_description':_0x510491,'global':!![],'active':!![],'name':_0x510491},'auth':_0x4c8fab,'json':!![]};return rp(_0x5102ec)[_0x068a('0xc')](function(_0x445053){var _0x51cb90=_0x445053[_0x068a('0xd')][_0x068a('0x10')];_0x509cd3(_0x51cb90);});});}function getRemoteTag(_0x5a0d2e,_0x461489,_0x3e1050,_0x19e130,_0x4717ae){return new Promise(function(_0x3b0af8,_0x8dbd2c){var _0x3357b5={'method':_0x068a('0xb'),'uri':_0x3e1050+_0x068a('0x45')+_0x068a('0x46')+_0x5a0d2e+'&'+_0x19e130,'auth':_0x461489,'json':!![]};return rp(_0x3357b5)[_0x068a('0xc')](function(_0x2fcd84){if(_0x2fcd84[_0x068a('0xd')]['length']>0x0){var _0x192226=_0x2fcd84['result'][0x0][_0x068a('0x10')];_0x3b0af8(_0x192226);}else{return createRemoteTag(_0x5a0d2e,_0x461489,_0x3e1050,_0x19e130)['then'](function(_0x5a42b7){_0x3b0af8(_0x5a42b7);});}});});}function assignTagToIncident(_0x4ef945,_0x3e43bc,_0x1d1ea0,_0x29715e,_0x3d673e){return new Promise(function(_0x19f514,_0x5b6786){var _0x3b012a={'method':'POST','uri':_0x1d1ea0+_0x068a('0x47')+'?'+_0x3d673e,'body':{'label':_0x4ef945,'table':_0x068a('0x3b'),'id_type':'Incident','table_key':_0x29715e[_0x068a('0x41')],'title':_0x068a('0x48')+_0x29715e[_0x068a('0x42')],'id_display':_0x29715e[_0x068a('0x42')]},'auth':_0x3e43bc,'json':!![]};return rp(_0x3b012a)[_0x068a('0xc')](function(_0x4f0cf0){_0x19f514();})[_0x068a('0x14')](function(){_0x19f514();});});}function manageTags(_0x454c1f,_0x15e93e,_0x36b56a,_0x2d25d4,_0x42b6a2,_0xfa43cd,_0x376b2f){return new Promise(function(_0x15ef64,_0x14a36e){var _0x16a851=[];_0x15e93e[_0x068a('0x2a')](function(_0x4e5e45){_0x16a851[_0x068a('0x49')](getRemoteTag(_0x4e5e45,_0x36b56a,_0x2d25d4,_0xfa43cd,_0x376b2f));});return Promise['all'](_0x16a851)[_0x068a('0xc')](function(_0x3af8a7){if(_0x3af8a7[_0x068a('0xe')]){logger[_0x068a('0x11')]('['+[_0x454c1f['toUpperCase']()]+_0x068a('0x4a'),_0x3af8a7);var _0x1b3716=[];_0x3af8a7[_0x068a('0x2a')](function(_0x53db04){_0x1b3716[_0x068a('0x49')](assignTagToIncident(_0x53db04,_0x36b56a,_0x2d25d4,_0x42b6a2,_0xfa43cd));});return Promise[_0x068a('0x4b')](_0x1b3716)[_0x068a('0xc')](function(){_0x15ef64();})[_0x068a('0x14')](function(){_0x15ef64();});}else{_0x15ef64();}});});}function getTags(_0x357239,_0x28519a,_0x55d933,_0x3f501f,_0x1a72ce,_0x13ac80){return function(_0x570d2e){return new Promise(function(_0x57c101,_0x45b2e4){var _0x1e0f22=[];var _0x3af6df=_0x3f501f['Tags'];if(_0x3af6df&&_0x3af6df[_0x068a('0xe')]>0x0){_0x1e0f22=_[_0x068a('0x4c')](_0x3af6df,_0x068a('0x38'));}if(_0x1e0f22[_0x068a('0xe')]>0x0){return manageTags(_0x357239,_0x1e0f22,_0x28519a,_0x55d933,_0x570d2e,_0x1a72ce,_0x13ac80)[_0x068a('0xc')](function(){_0x57c101(_0x570d2e);});}else{_0x57c101(_0x570d2e);}});};}function emit(_0x2c356b,_0x57f6c7,_0x10ae14){var _0x278732='%26sysparm_record_target%3Dincident'+_0x068a('0x4d')+_0x068a('0x4e')+_0x068a('0x4f');var _0x272a7f={'uri':_0x2c356b+_0x068a('0x50')+_0x10ae14+_0x278732};io['to'](util[_0x068a('0x51')]('user:%s',_0x57f6c7))[_0x068a('0x52')](_0x068a('0x53'),_0x272a7f);}exports['cs']=function(_0x3ea91a,_0x725313,_0x25fb8e,_0x3a2981,_0x28a5ce,_0x158f7c,_0x578edc,_0x1b237e){var _0x3ccd6d={};var _0x1a3c46={'user':_0x158f7c['username'],'pass':_0x158f7c[_0x068a('0x54')]};var _0x185332=_0x068a('0x55');var _0x1d445f='sysparm_display_value=true';_0x158f7c[_0x068a('0x56')]=intUtil['stripTrailingSlash'](_0x158f7c['remoteUri']);_0x158f7c['serverUrl']=intUtil[_0x068a('0x57')](_0x158f7c[_0x068a('0x58')]);var _0x47a77d=util[_0x068a('0x51')](_0x068a('0x59'),_0x158f7c['remoteUri']);_0x3ccd6d[_0x068a('0x18')]=!_['isNil'](_0x3a2981)?_0x3a2981['email']:null;_0x3ccd6d[_0x068a('0x1c')]=_0x158f7c['email'];_0x3ccd6d['endUserNumber']=_0x1b237e[_0x068a('0x36')]()===_0x068a('0x3a')?_0x725313['destcalleridnum']:_0x725313[_0x068a('0x5a')];_0x3ccd6d['callDirection']=_0x1b237e==='queue'||_0x1b237e==='unmanaged'?_0x068a('0x5b'):'outbound';var _0x4c8b2e=util['format'](_0x068a('0x5c'),_0x158f7c[_0x068a('0x58')],_0x725313[_0x068a('0x5d')],md5(_0x725313[_0x068a('0x5d')]));if(_0x28a5ce&&_0x28a5ce[_0x068a('0x5e')]){logger[_0x068a('0x11')](_0x068a('0x5f'),_0x068a('0x60'));_0x725313[_0x068a('0x61')]=_0x4c8b2e;}else if(_0x578edc&&_0x578edc[_0x068a('0x62')]&&_0x578edc['recordingFormat']!==_0x068a('0x63')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x725313[_0x068a('0x61')]=_0x4c8b2e;}else{_0x725313[_0x068a('0x61')]='';}return getAdminUser(_0x1b237e,_0x1a3c46,_0x3ccd6d,_0x47a77d,_0x1d445f,_0x185332)['then'](getUser(_0x1b237e,_0x1a3c46,_0x47a77d,_0x1d445f,_0x185332))[_0x068a('0xc')](getEndUser(_0x1b237e,_0x1a3c46,_0x47a77d,_0x1d445f,_0x185332))[_0x068a('0xc')](getTicket(_0x1b237e,_0x1a3c46,_0x47a77d,_0x25fb8e,_0x725313,_0x1d445f))['then'](function(_0xa3ccc9){logger[_0x068a('0x11')](util[_0x068a('0x51')](_0x068a('0x64'),_0xa3ccc9[_0x068a('0x41')]));logger[_0x068a('0x11')](util['format'](_0x068a('0x65'),_0x1b237e));if(_0x1b237e!==_0x068a('0x66')){logger[_0x068a('0x11')]('['+[_0x1b237e[_0x068a('0x12')]()]+']',_0x068a('0x67'));emit(_0x158f7c[_0x068a('0x56')],_0x3a2981[_0x068a('0x38')],_0xa3ccc9[_0x068a('0x41')]);}})['catch'](function(_0x26a628){logger['error']('['+[_0x1b237e[_0x068a('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x26a628,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x90d1=['getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','md5','./util','../../../../config/logger','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','sys_user?','user','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','forEach','string','picklist','type','customField','nameField','content','toString','includes','toLowerCase','variableName','idField','customVariable','Variable','name','outbound','POST'];(function(_0x56a641,_0x4c0596){var _0x329947=function(_0x551652){while(--_0x551652){_0x56a641['push'](_0x56a641['shift']());}};_0x329947(++_0x4c0596);}(_0x90d1,0x1cf));var _0x190d=function(_0x525513,_0x44220c){_0x525513=_0x525513-0x0;var _0x17f77f=_0x90d1[_0x525513];return _0x17f77f;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require('request-promise');var util=require('util');var md5=require(_0x190d('0x0'));var Redis=require('ioredis');var intUtil=require(_0x190d('0x1'));var config=require('../../../../config/environment');var logger=require(_0x190d('0x2'))('servicenow');config[_0x190d('0x3')]=_['defaults'](config[_0x190d('0x3')],{'host':_0x190d('0x4'),'port':0x18eb});var io=require(_0x190d('0x5'))(new Redis(config[_0x190d('0x3')]));function getAdminUser(_0x4a4439,_0x19bbe4,_0x42209f,_0x4d1032,_0x53625b,_0x1472ce){return new Promise(function(_0x1addf6,_0xfca261){var _0x3762b9={'method':'GET','uri':_0x4d1032+_0x190d('0x6')+'&'+_0x53625b+'&'+_0x1472ce,'auth':_0x19bbe4,'json':!![]};return rp(_0x3762b9)[_0x190d('0x7')](function(_0x309c92){if(_0x309c92['result'][_0x190d('0x8')]>0x0){_0x42209f[_0x190d('0x9')]=_0x309c92[_0x190d('0xa')][0x0][_0x190d('0xb')];}logger['info']('['+[_0x4a4439['toUpperCase']()]+_0x190d('0xc'),_0x42209f);_0x1addf6(_0x42209f);})[_0x190d('0xd')](function(_0x56e2e0){logger[_0x190d('0xe')]('['+[_0x4a4439[_0x190d('0xf')]()]+']',_0x56e2e0[_0x190d('0x10')]);_0xfca261(_0x56e2e0['message']);});});}function getUser(_0x5601c0,_0xfac45a,_0x4275ed,_0x4f986,_0x1e30ca){return function(_0x41e597){logger[_0x190d('0x11')]('['+[_0x5601c0[_0x190d('0xf')]()]+_0x190d('0x12'),_0x41e597);return new Promise(function(_0x5af0c1,_0x41c696){if(intUtil[_0x190d('0x13')](_0x41e597[_0x190d('0x14')])){var _0x3feafe={'method':_0x190d('0x15'),'uri':_0x4275ed+_0x190d('0x16')+_0x41e597['userEmail']+'&'+_0x4f986+'&'+_0x1e30ca,'auth':_0xfac45a,'json':!![]};logger['info']('['+[_0x5601c0[_0x190d('0xf')]()]+'],\x20getUser\x20rp\x20obj',_0x3feafe);return rp(_0x3feafe)[_0x190d('0x7')](function(_0x769b15){logger['info']('['+[_0x5601c0[_0x190d('0xf')]()]+_0x190d('0x17'),_0x769b15);if(_0x769b15[_0x190d('0xa')]['length']>0x0&&String(_0x769b15[_0x190d('0xa')][0x0][_0x190d('0x18')])===_0x190d('0x19')){_0x41e597[_0x190d('0x1a')]=_0x769b15[_0x190d('0xa')][0x0][_0x190d('0xb')];}else{_0x41e597[_0x190d('0x1a')]=_0x41e597['adminId'];_0x41e597[_0x190d('0x14')]=_0x41e597[_0x190d('0x1b')];}logger[_0x190d('0x11')]('['+[_0x5601c0[_0x190d('0xf')]()]+'],\x20getUser\x20crm',_0x41e597);_0x5af0c1(_0x41e597);})['catch'](function(_0xe66c1){logger['error']('['+[_0x5601c0[_0x190d('0xf')]()]+']',_0xe66c1[_0x190d('0x10')]);_0x41c696(_0xe66c1[_0x190d('0x10')]);});}else{logger[_0x190d('0x11')]('['+[_0x5601c0['toUpperCase']()]+_0x190d('0x1c'));_0x41e597['userId']=_0x41e597[_0x190d('0x9')];_0x41e597[_0x190d('0x14')]=_0x41e597[_0x190d('0x1b')];_0x5af0c1(_0x41e597);}});};}function createEndUser(_0x5cb893,_0x767086,_0x389248,_0x42b995,_0x29e7e8){logger[_0x190d('0x11')]('['+[_0x5cb893[_0x190d('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x389248);return new Promise(function(_0x426351,_0x11cae2){var _0x2405d2={'method':'POST','uri':_0x42b995+_0x190d('0x1d')+_0x29e7e8,'body':{'user_name':_0x389248['endUserNumber'],'roles':_0x190d('0x1e'),'first_name':_0x389248[_0x190d('0x1f')],'active':_0x190d('0x19'),'date_format':'System','phone':_0x389248[_0x190d('0x1f')]},'auth':_0x767086,'json':!![]};return rp(_0x2405d2)[_0x190d('0x7')](function(_0x199b6b){logger[_0x190d('0x11')]('['+[_0x5cb893[_0x190d('0xf')]()]+_0x190d('0x20'),_0x199b6b[_0x190d('0xa')]);_0x389248[_0x190d('0x21')]=_0x199b6b['result'][_0x190d('0xb')];_0x426351(_0x389248);})[_0x190d('0xd')](function(_0x3cc49e){logger[_0x190d('0xe')]('['+[_0x5cb893[_0x190d('0xf')]()]+']',_0x3cc49e[_0x190d('0x10')]);_0x11cae2(_0x3cc49e[_0x190d('0x10')]);});});}function getEndUser(_0x20a8b6,_0x3bfb9b,_0x843b94,_0x48d7c5,_0x12d709){return function(_0x2f75fc){logger[_0x190d('0x11')]('['+[_0x20a8b6['toUpperCase']()]+_0x190d('0x22'),_0x2f75fc);return new Promise(function(_0x2e6a32,_0x200725){var _0x325868={'method':_0x190d('0x15'),'uri':_0x843b94+'sys_user?sysparm_query=phone%3D'+_0x2f75fc[_0x190d('0x1f')]+'&'+_0x48d7c5+'&'+_0x12d709,'auth':_0x3bfb9b,'json':!![]};return rp(_0x325868)[_0x190d('0x7')](function(_0x5cde2d){if(_0x5cde2d[_0x190d('0xa')][_0x190d('0x8')]>0x0){_0x2f75fc[_0x190d('0x21')]=_0x5cde2d[_0x190d('0xa')][0x0]['sys_id'];logger[_0x190d('0x11')]('['+[_0x20a8b6[_0x190d('0xf')]()]+'],\x20getEndUser\x20crm',_0x2f75fc);_0x2e6a32(_0x2f75fc);}else{return createEndUser(_0x20a8b6,_0x3bfb9b,_0x2f75fc,_0x843b94,_0x48d7c5)[_0x190d('0x7')](function(_0x4ea624){logger[_0x190d('0x11')]('['+[_0x20a8b6[_0x190d('0xf')]()]+'],\x20createEndUser\x20crm',_0x4ea624);_0x2e6a32(_0x4ea624);});}})[_0x190d('0xd')](function(_0x5a4154){logger[_0x190d('0xe')]('['+[_0x20a8b6[_0x190d('0xf')]()]+']',_0x5a4154[_0x190d('0x10')]);_0x200725(_0x5a4154[_0x190d('0x10')]);});});};}function getCustomFields(_0x5757ed,_0x2bb516){var _0x453ed3={};if(_0x5757ed['length']>0x0){_[_0x190d('0x23')](_0x5757ed,function(_0x2b149f){if(_['includes']([_0x190d('0x24'),_0x190d('0x25')],_0x2b149f[_0x190d('0x26')])&&_0x2b149f['nameField']&&!_0x2b149f[_0x190d('0x27')]){_0x453ed3[_0x2b149f[_0x190d('0x28')]['toLowerCase']()]=_0x2b149f[_0x190d('0x29')][_0x190d('0x2a')]();}else if(_[_0x190d('0x2b')]([_0x190d('0x24'),'picklist'],_0x2b149f['type'])&&_0x2b149f['idField']&&_0x2b149f[_0x190d('0x27')]){_0x453ed3[_0x2b149f['idField'][_0x190d('0x2c')]()]=_0x2b149f[_0x190d('0x29')]['toString']();}else if(_0x2b149f[_0x190d('0x26')]==='variable'&&_0x2b149f[_0x190d('0x2d')]&&_0x2b149f[_0x190d('0x2e')]&&_0x2b149f['customField']){_0x453ed3[_0x2b149f[_0x190d('0x2e')][_0x190d('0x2c')]()]=_0x2bb516[_0x2b149f[_0x190d('0x2d')]][_0x190d('0x2a')]();}else if(_0x2b149f[_0x190d('0x26')]===_0x190d('0x2f')&&_0x2b149f[_0x190d('0x30')]&&_0x2b149f[_0x190d('0x30')][_0x190d('0x31')]&&_0x2b149f['idField']&&_0x2b149f['customField']){_0x453ed3[_0x2b149f[_0x190d('0x2e')][_0x190d('0x2c')]()]=_0x2bb516[_0x2b149f['Variable'][_0x190d('0x31')][_0x190d('0x2c')]()]['toString']();}});}return _0x453ed3;}function getTicket(_0x16e78e,_0x4a1db4,_0x3c3226,_0x2c330b,_0x4407f3,_0x16a058){return function(_0x4eb77f){logger[_0x190d('0x11')]('['+[_0x16e78e[_0x190d('0xf')]()]+']\x20getTicket\x20input\x20crm',_0x4eb77f);return new Promise(function(_0x40a092,_0x514d70){var _0x509f33=_0x16e78e[_0x190d('0x2c')]()===_0x190d('0x32')?_0x4eb77f[_0x190d('0x1a')]:_0x4eb77f['endUserId'];var _0x16ae26={'method':_0x190d('0x33'),'uri':_0x3c3226+'incident'+'?'+_0x16a058,'body':Object['assign']({},{'active':'true','caller_id':_0x509f33,'assigned_to':_0x4eb77f[_0x190d('0x1a')],'short_description':intUtil[_0x190d('0x34')](_0x2c330b[_0x190d('0x35')],_0x4407f3,'\x20'),'description':intUtil[_0x190d('0x34')](_0x2c330b[_0x190d('0x36')],_0x4407f3,'\x0a')},getCustomFields(_0x2c330b[_0x190d('0x37')],_0x4407f3)),'auth':_0x4a1db4,'json':!![]};return rp(_0x16ae26)[_0x190d('0x7')](function(_0x4e9813){logger['info']('['+[_0x16e78e['toUpperCase']()]+_0x190d('0x38'),_0x4e9813[_0x190d('0xa')]);_0x4eb77f[_0x190d('0x39')]=_0x4e9813[_0x190d('0xa')][_0x190d('0xb')];_0x4eb77f[_0x190d('0x3a')]=_0x4e9813['result'][_0x190d('0x3b')];logger[_0x190d('0x11')]('['+[_0x16e78e['toUpperCase']()]+_0x190d('0x3c'),_0x4eb77f);_0x40a092(_0x4eb77f);})[_0x190d('0xd')](function(_0x3abfb1){logger[_0x190d('0xe')]('['+[_0x16e78e['toUpperCase']()]+']',_0x3abfb1[_0x190d('0x10')]);_0x514d70(_0x3abfb1[_0x190d('0x10')]);});});};}function createRemoteTag(_0x4d0db4,_0x57105e,_0x4c7ae6,_0x3fbb99){return new Promise(function(_0xff4a7a,_0x2dfacf){var _0x2f672f={'method':'POST','uri':_0x4c7ae6+_0x190d('0x3d')+'?'+_0x3fbb99,'body':{'short_description':_0x4d0db4,'global':!![],'active':!![],'name':_0x4d0db4},'auth':_0x57105e,'json':!![]};return rp(_0x2f672f)['then'](function(_0x602349){var _0x1b31ac=_0x602349[_0x190d('0xa')][_0x190d('0xb')];_0xff4a7a(_0x1b31ac);});});}function getRemoteTag(_0x41a659,_0xe42cf0,_0x44e550,_0x175943,_0x49f73f){return new Promise(function(_0x5c2401,_0x1f3832){var _0x1fade6={'method':_0x190d('0x15'),'uri':_0x44e550+_0x190d('0x3d')+_0x190d('0x3e')+_0x41a659+'&'+_0x175943,'auth':_0xe42cf0,'json':!![]};return rp(_0x1fade6)[_0x190d('0x7')](function(_0x20d4a0){if(_0x20d4a0[_0x190d('0xa')][_0x190d('0x8')]>0x0){var _0x597c88=_0x20d4a0['result'][0x0][_0x190d('0xb')];_0x5c2401(_0x597c88);}else{return createRemoteTag(_0x41a659,_0xe42cf0,_0x44e550,_0x175943)[_0x190d('0x7')](function(_0x353ccc){_0x5c2401(_0x353ccc);});}});});}function assignTagToIncident(_0x2e2d60,_0x1ce4eb,_0x43b4c0,_0x58bf77,_0x4ad16e){return new Promise(function(_0x225d1c,_0x26ddf8){var _0x4613ae={'method':_0x190d('0x33'),'uri':_0x43b4c0+_0x190d('0x3f')+'?'+_0x4ad16e,'body':{'label':_0x2e2d60,'table':_0x190d('0x40'),'id_type':'Incident','table_key':_0x58bf77[_0x190d('0x39')],'title':'Incident\x20-\x20'+_0x58bf77[_0x190d('0x3a')],'id_display':_0x58bf77[_0x190d('0x3a')]},'auth':_0x1ce4eb,'json':!![]};return rp(_0x4613ae)[_0x190d('0x7')](function(_0xaaf95e){_0x225d1c();})[_0x190d('0xd')](function(){_0x225d1c();});});}function manageTags(_0x5cbbe0,_0x2710d7,_0x48e8e7,_0x7d8ca1,_0x225728,_0x19926b,_0x51c594){return new Promise(function(_0x3bc282,_0x3580c2){var _0x169fbe=[];_0x2710d7['forEach'](function(_0x3c9926){_0x169fbe[_0x190d('0x41')](getRemoteTag(_0x3c9926,_0x48e8e7,_0x7d8ca1,_0x19926b,_0x51c594));});return Promise[_0x190d('0x42')](_0x169fbe)[_0x190d('0x7')](function(_0x95e42a){if(_0x95e42a['length']){logger[_0x190d('0x11')]('['+[_0x5cbbe0['toUpperCase']()]+_0x190d('0x43'),_0x95e42a);var _0x59d5d2=[];_0x95e42a[_0x190d('0x23')](function(_0x38d7e4){_0x59d5d2[_0x190d('0x41')](assignTagToIncident(_0x38d7e4,_0x48e8e7,_0x7d8ca1,_0x225728,_0x19926b));});return Promise[_0x190d('0x42')](_0x59d5d2)[_0x190d('0x7')](function(){_0x3bc282();})[_0x190d('0xd')](function(){_0x3bc282();});}else{_0x3bc282();}});});}function getTags(_0xe2595d,_0x49e07d,_0x32d653,_0x2ccbf0,_0x4d2bcb,_0x59c838){return function(_0x4dc271){return new Promise(function(_0x50eff3,_0x234908){var _0x1b24d1=[];var _0x41a43f=_0x2ccbf0['Tags'];if(_0x41a43f&&_0x41a43f['length']>0x0){_0x1b24d1=_[_0x190d('0x44')](_0x41a43f,'name');}if(_0x1b24d1['length']>0x0){return manageTags(_0xe2595d,_0x1b24d1,_0x49e07d,_0x32d653,_0x4dc271,_0x4d2bcb,_0x59c838)[_0x190d('0x7')](function(){_0x50eff3(_0x4dc271);});}else{_0x50eff3(_0x4dc271);}});};}function emit(_0x193937,_0x54701d,_0x2eb150){var _0x3d7103=_0x190d('0x45')+_0x190d('0x46')+_0x190d('0x47')+_0x190d('0x48');var _0x204aae={'uri':_0x193937+_0x190d('0x49')+_0x2eb150+_0x3d7103};io['to'](util['format'](_0x190d('0x4a'),_0x54701d))[_0x190d('0x4b')](_0x190d('0x4c'),_0x204aae);}exports['cs']=function(_0x5247fe,_0x1dca43,_0x4788a8,_0xe0b1de,_0x162789,_0x4ebec7,_0x3d9011,_0x15fce8){var _0x1ac312={};var _0x58b1be={'user':_0x4ebec7[_0x190d('0x4d')],'pass':_0x4ebec7[_0x190d('0x4e')]};var _0x55d240=_0x190d('0x4f');var _0x2a3a4e=_0x190d('0x50');_0x4ebec7[_0x190d('0x51')]=intUtil[_0x190d('0x52')](_0x4ebec7[_0x190d('0x51')]);_0x4ebec7[_0x190d('0x53')]=intUtil[_0x190d('0x52')](_0x4ebec7[_0x190d('0x53')]);var _0x5034ae=util[_0x190d('0x54')](_0x190d('0x55'),_0x4ebec7['remoteUri']);_0x1ac312[_0x190d('0x14')]=!_[_0x190d('0x56')](_0xe0b1de)?_0xe0b1de[_0x190d('0x57')]:null;_0x1ac312[_0x190d('0x1b')]=_0x4ebec7['email'];_0x1ac312['endUserNumber']=_0x15fce8[_0x190d('0x2c')]()===_0x190d('0x32')?_0x1dca43[_0x190d('0x58')]:_0x1dca43[_0x190d('0x59')];_0x1ac312['callDirection']=_0x15fce8===_0x190d('0x5a')||_0x15fce8===_0x190d('0x5b')?_0x190d('0x5a'):_0x190d('0x32');var _0x13cdb9=util[_0x190d('0x54')](_0x190d('0x5c'),_0x4ebec7['serverUrl'],_0x1dca43['uniqueid'],md5(_0x1dca43[_0x190d('0x5d')]));if(_0x162789&&_0x162789[_0x190d('0x5e')]){logger[_0x190d('0x11')](_0x190d('0x5f'),_0x190d('0x60'));_0x1dca43[_0x190d('0x61')]=_0x13cdb9;}else if(_0x3d9011&&_0x3d9011['recordingFormat']&&_0x3d9011[_0x190d('0x62')]!=='none'){logger[_0x190d('0x11')](_0x190d('0x63'),'Recording\x20is\x20enabled!');_0x1dca43[_0x190d('0x61')]=_0x13cdb9;}else{_0x1dca43[_0x190d('0x61')]='';}return getAdminUser(_0x15fce8,_0x58b1be,_0x1ac312,_0x5034ae,_0x2a3a4e,_0x55d240)[_0x190d('0x7')](getUser(_0x15fce8,_0x58b1be,_0x5034ae,_0x2a3a4e,_0x55d240))['then'](getEndUser(_0x15fce8,_0x58b1be,_0x5034ae,_0x2a3a4e,_0x55d240))[_0x190d('0x7')](getTicket(_0x15fce8,_0x58b1be,_0x5034ae,_0x4788a8,_0x1dca43,_0x2a3a4e))[_0x190d('0x7')](function(_0x41f92b){logger[_0x190d('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x41f92b[_0x190d('0x39')]));logger[_0x190d('0x11')](util['format']('call\x20direction:\x20%s',_0x15fce8));if(_0x15fce8!==_0x190d('0x5b')){logger[_0x190d('0x11')]('['+[_0x15fce8[_0x190d('0xf')]()]+']',_0x190d('0x64'));emit(_0x4ebec7[_0x190d('0x51')],_0xe0b1de[_0x190d('0x31')],_0x41f92b[_0x190d('0x39')]);}})[_0x190d('0xd')](function(_0x4fa052){logger[_0x190d('0xe')]('['+[_0x15fce8[_0x190d('0xf')]()]+_0x190d('0x65'),util[_0x190d('0x66')](_0x4fa052,{'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 7cbc1dd..6d06122 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 _0xf94b=['customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','serverUrl','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Fields','user:%s','unmanaged','lastevent','toUpperCase','calleridname','Ticket\x20created!','lodash','bluebird','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','socket.io-emitter','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','Descriptions','date_start','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','toString','base64','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','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!','first_name','','Enduser\x20created.','debug','merge','map','type','customField','nameField','toLowerCase','content','string','custom_fields'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf94b,0xa2));var _0xbf94=function(_0x35ce54,_0x271f26){_0x35ce54=_0x35ce54-0x0;var _0x2e7145=_0xf94b[_0x35ce54];return _0x2e7145;};'use strict';var _=require(_0xbf94('0x0'));var rp=require('request-promise');var BPromise=require(_0xbf94('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xbf94('0x2'));var config=require(_0xbf94('0x3'));var logger=require(_0xbf94('0x4'))(_0xbf94('0x5'));config['redis']=_[_0xbf94('0x6')](config[_0xbf94('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xbf94('0x8'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x54a01a,_0x453846,_0x2ee4e2){io['to'](_0x54a01a)['emit'](_0x453846,_0x2ee4e2);}function getTicket(_0x3798fb,_0x22664f,_0xa52e63,_0x441aae,_0x1fa70,_0x5bb5bf,_0x218059,_0x14023b){logger['info'](_0xbf94('0x9'));var _0x494005=new Date();var _0x2bc367=[{'name':'name','value':intUtil[_0xbf94('0xa')](_0x441aae['Subjects'],_0x1fa70,'\x20')},{'name':_0xbf94('0xb'),'value':_0x22664f['id']},{'name':_0xbf94('0xc'),'value':_0x22664f['id']},{'name':_0xbf94('0xd'),'value':intUtil[_0xbf94('0xa')](_0x441aae[_0xbf94('0xe')],_0x1fa70,'\x0a')},{'name':_0xbf94('0xf'),'value':_0x494005['toISOString']()['slice'](0x0,0x13)[_0xbf94('0x10')]('T','\x20')},{'name':_0xbf94('0x11'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xbf94('0x12'),'value':_0xa52e63['id']},{'name':_0xbf94('0x13'),'value':_0xbf94('0x14')},{'name':_0xbf94('0x15'),'value':_0xa52e63[_0xbf94('0x16')]},{'name':_0xbf94('0x17'),'value':_0x14023b}];if(_0x5bb5bf[_0xbf94('0x18')]){_[_0xbf94('0x19')](_0x5bb5bf,function(_0x6ab840){if(_0x1fa70[_0x6ab840[_0xbf94('0x1a')]]){_0x2bc367[_0xbf94('0x1b')]({'name':_0x6ab840[_0xbf94('0x1c')],'value':_0x1fa70[_0x6ab840[_0xbf94('0x1a')]]});}});}return request({'form':{'method':_0xbf94('0x1d'),'input_type':_0xbf94('0x1e'),'response_type':_0xbf94('0x1e'),'rest_data':JSON[_0xbf94('0x1f')]({'session':_0x218059['id'],'module_name':'Calls','name_value_list':_0x2bc367})}});}function getAuth(_0x158a45){return util[_0xbf94('0x20')](_0xbf94('0x21'),new Buffer(_0x158a45['apiKey']+':X')[_0xbf94('0x22')](_0xbf94('0x23')));}function getServerInfo(_0x46b2c2){return request({'form':{'method':'get_server_info','input_type':_0xbf94('0x1e'),'response_type':_0xbf94('0x1e'),'rest_data':JSON[_0xbf94('0x1f')]({'session':_0x46b2c2['id']})}});}function getUser(_0x3a8cfc,_0x464d62,_0x5283fd){if(!_[_0xbf94('0x24')](_0x464d62)){logger[_0xbf94('0x25')](_0xbf94('0x26'),_0x464d62);return request({'form':{'method':_0xbf94('0x27'),'input_type':_0xbf94('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbf94('0x1f')]({'session':_0x5283fd['id'],'module_name':_0xbf94('0x28'),'query':util['format'](_0xbf94('0x29'),_0x464d62),'order_by':'','offset':'0','select_fields':['id',_0xbf94('0x16'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf94('0x2a')](function(_0x4362a5){if(_0x4362a5['entry_list'][_0xbf94('0x18')]){var _0x4328cd=_['find'](_0x4362a5[_0xbf94('0x2b')],function(_0x52154e){return _0x52154e[_0xbf94('0x2c')][_0xbf94('0x2d')]['value']===_0x464d62;});if(_0x4328cd){logger['info'](_0xbf94('0x2e'));return BPromise[_0xbf94('0x2f')]({'id':_0x4328cd[_0xbf94('0x2c')]['id']['value'],'name':_0x4328cd['name_value_list'][_0xbf94('0x16')][_0xbf94('0x30')]});}}logger[_0xbf94('0x25')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbf94('0x2f')]({'id':_0x5283fd[_0xbf94('0x2c')][_0xbf94('0x31')][_0xbf94('0x30')],'name':_0x5283fd[_0xbf94('0x2c')][_0xbf94('0x2d')]['value']});});}else{logger[_0xbf94('0x25')](_0xbf94('0x32'));return BPromise[_0xbf94('0x2f')]({'id':_0x5283fd[_0xbf94('0x2c')]['user_id']['value'],'name':_0x5283fd[_0xbf94('0x2c')][_0xbf94('0x2d')][_0xbf94('0x30')]});}}function getEndUser(_0xd2de69,_0x4cb199,_0x293718,_0xeb3378){logger[_0xbf94('0x25')](_0xbf94('0x33'),_0x293718);return request({'form':{'method':_0xbf94('0x27'),'input_type':_0xbf94('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbf94('0x1f')]({'session':_0xeb3378['id'],'module_name':'Contacts','query':util[_0xbf94('0x20')](_0xbf94('0x34'),_0x293718),'order_by':'','offset':'0','select_fields':['id',_0xbf94('0x16'),_0xbf94('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf94('0x2a')](function(_0x1d5e5c){if(_0x1d5e5c['entry_list'][_0xbf94('0x18')]){var _0x4b0cd9=_[_0xbf94('0x36')](_0x1d5e5c[_0xbf94('0x2b')],function(_0x47f59e){return _0x47f59e[_0xbf94('0x2c')][_0xbf94('0x35')]['value']===_0x293718;});if(_0x4b0cd9){logger[_0xbf94('0x25')](_0xbf94('0x37'));return BPromise[_0xbf94('0x2f')]({'id':_0x4b0cd9[_0xbf94('0x2c')]['id'][_0xbf94('0x30')],'name':_0x4b0cd9[_0xbf94('0x2c')]['name'][_0xbf94('0x30')],'phone':_0x4b0cd9['name_value_list']['phone_home']['value']});}}else{logger['info'](_0xbf94('0x38'));return request({'form':{'method':'set_entry','input_type':_0xbf94('0x1e'),'response_type':_0xbf94('0x1e'),'rest_data':JSON[_0xbf94('0x1f')]({'session':_0xeb3378['id'],'module_name':_0xbf94('0x14'),'name_value_list':[{'name':_0xbf94('0x39'),'value':_0x4cb199!==_0xbf94('0x3a')?_0x4cb199:util['format']('Caller\x20-\x20%s',_0x293718)},{'name':_0xbf94('0x35'),'value':_0x293718}]})}})[_0xbf94('0x2a')](function(_0x2cb0c5){logger[_0xbf94('0x25')](_0xbf94('0x3b'));return BPromise['resolve']({'id':_0x2cb0c5['id'],'name':_0x2cb0c5[_0xbf94('0x2b')]['first_name'][_0xbf94('0x30')],'phone':_0x2cb0c5[_0xbf94('0x2b')][_0xbf94('0x35')][_0xbf94('0x30')]});});}});}function request(_0x9bf97c){logger[_0xbf94('0x3c')]('[HTTP]',JSON[_0xbf94('0x1f')](_0x9bf97c));return rp(_[_0xbf94('0x3d')](def,_0x9bf97c));}function getTags(_0x2c208e,_0x1aae3d){var _0x5e1685=[];if(_0x2c208e&&_0x2c208e[_0xbf94('0x18')]>0x0){_0x5e1685=_[_0xbf94('0x3e')](_0x2c208e,_0x1aae3d);}return _0x5e1685;}function getCustomFields(_0x331970,_0x4cbfe6){var _0x54069d=[];var _0x58fd1d={'custom_fields':[]};if(_0x331970[_0xbf94('0x18')]>0x0){_['forEach'](_0x331970,function(_0x9633a0){if(_0x9633a0[_0xbf94('0x3f')]==='string'&&_0x9633a0['nameField']&&!_0x9633a0[_0xbf94('0x40')]){_0x58fd1d[_0x9633a0[_0xbf94('0x41')][_0xbf94('0x42')]()]=_0x9633a0[_0xbf94('0x43')][_0xbf94('0x22')]();}else if(_0x9633a0[_0xbf94('0x3f')]===_0xbf94('0x44')&&_0x9633a0[_0xbf94('0x1c')]&&_0x9633a0['customField']){_0x58fd1d['custom_fields'][_0xbf94('0x1b')]({'id':_0x9633a0[_0xbf94('0x1c')],'value':_0x9633a0[_0xbf94('0x43')][_0xbf94('0x22')]()});}else if(_0x9633a0[_0xbf94('0x3f')]==='variable'&&_0x9633a0[_0xbf94('0x1a')]&&_0x9633a0['idField']&&_0x9633a0[_0xbf94('0x40')]){_0x4cbfe6[_0x9633a0['variableName']]&&_0x58fd1d[_0xbf94('0x45')][_0xbf94('0x1b')]({'id':_0x9633a0['idField'],'value':_0x4cbfe6[_0x9633a0[_0xbf94('0x1a')]][_0xbf94('0x22')]()});}else if(_0x9633a0[_0xbf94('0x3f')]===_0xbf94('0x46')&&_0x9633a0[_0xbf94('0x47')]&&_0x9633a0[_0xbf94('0x47')][_0xbf94('0x16')]&&_0x9633a0[_0xbf94('0x1c')]&&_0x9633a0[_0xbf94('0x40')]){_0x4cbfe6[_0x9633a0[_0xbf94('0x47')][_0xbf94('0x16')]['toLowerCase']()]&&_0x58fd1d[_0xbf94('0x45')]['push']({'id':_0x9633a0[_0xbf94('0x1c')],'value':_0x4cbfe6[_0x9633a0[_0xbf94('0x47')]['name'][_0xbf94('0x42')]()][_0xbf94('0x22')]()});}});}return _0x58fd1d;}function getConnection(_0x2c4b12){return request({'method':_0xbf94('0x48'),'form':{'method':_0xbf94('0x49'),'input_type':_0xbf94('0x1e'),'response_type':_0xbf94('0x1e'),'rest_data':JSON[_0xbf94('0x1f')]({'user_auth':{'user_name':_0x2c4b12[_0xbf94('0x4a')],'password':_0x2c4b12[_0xbf94('0x4b')],'encryption':_0xbf94('0x4c')},'application':_0xbf94('0x4d')})}})['then'](function(_0x180478){var _0x3e5972=_0x180478;if(_0x3e5972['id']){def['sessionID']=_0x3e5972['id'];return BPromise['resolve'](_0x3e5972);}else{throw new Error(util[_0xbf94('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x2c4b12['id']));}});}function setRelationship(_0x308816,_0x4d274f,_0x36964b,_0x196b7b){return request({'form':{'method':_0xbf94('0x4e'),'input_type':_0xbf94('0x1e'),'response_type':_0xbf94('0x1e'),'rest_data':JSON['stringify']({'session':_0x308816['id'],'module_name':_0xbf94('0x4f'),'module_id':_0x36964b['id'],'link_field_name':_0x196b7b,'related_ids':[_0x4d274f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbf94('0x50')]=function(_0x2c1114,_0x3234d3,_0x5bda14,_0x1fd72e,_0xb2f213,_0x1db739){var _0x17bca1,_0xbb70ab,_0x64fb46,_0x5e9d38;_0x1db739[_0xbf94('0x51')]=intUtil[_0xbf94('0x52')](_0x1db739[_0xbf94('0x51')]);_0x1db739['serverUrl']=intUtil[_0xbf94('0x52')](_0x1db739['serverUrl']);def[_0xbf94('0x53')]=util[_0xbf94('0x20')](_0xbf94('0x54'),_0x1db739[_0xbf94('0x51')]);if(_0xb2f213&&_0xb2f213[_0xbf94('0x55')]){logger[_0xbf94('0x25')](_0xbf94('0x56'),'Recording\x20is\x20enabled!');_0x3234d3[_0xbf94('0x57')]=util['format'](_0xbf94('0x58'),_0x1db739['serverUrl'],_0x3234d3[_0xbf94('0x59')],md5(_0x3234d3[_0xbf94('0x59')]));}else{_0x3234d3[_0xbf94('0x57')]='';}return getConnection(_0x1db739)[_0xbf94('0x2a')](function(_0x5c0d8c){_0x5e9d38=_0x5c0d8c;return getUser(_0x1db739,_0x1fd72e['name'],_0x5e9d38);})[_0xbf94('0x2a')](function(_0x1e2706){_0x17bca1=_0x1e2706;logger[_0xbf94('0x25')](_0xbf94('0x5a'),_0x17bca1['id']);return getEndUser(_0x1db739,_0x3234d3['calleridname'],_0x3234d3['calleridnum'],_0x5e9d38);})[_0xbf94('0x2a')](function(_0x3e189e){_0xbb70ab=_0x3e189e;logger[_0xbf94('0x25')](_0xbf94('0x5b'),_0xbb70ab['id']);return getTicket(_0x1db739,_0x17bca1,_0xbb70ab,_0x5bda14,_0x3234d3,_0x5bda14['Fields'],_0x5e9d38,_0xbf94('0x5c'));})[_0xbf94('0x2a')](function(_0x305bbe){_0x64fb46=_0x305bbe;logger[_0xbf94('0x25')]('Ticket\x20created!');logger[_0xbf94('0x25')](_0xbf94('0x5d'),_0x64fb46['id']);return setRelationship(_0x5e9d38,_0x17bca1,_0x64fb46,_0xbf94('0x5e'));})[_0xbf94('0x2a')](function(){return setRelationship(_0x5e9d38,_0xbb70ab,_0x64fb46,_0xbf94('0x5f'));})[_0xbf94('0x2a')](function(){return getServerInfo(_0x5e9d38);})[_0xbf94('0x2a')](function(_0x55e5de){var _0x44f3f7=parseInt(_0x55e5de[_0xbf94('0x60')][_0xbf94('0x61')](0x0));var _0x33d304=util['format'](_0xbf94('0x62'),_0x1db739[_0xbf94('0x51')],_0x64fb46['id']);if(_0x44f3f7>0x6){_0x33d304=util[_0xbf94('0x20')](_0xbf94('0x63'),_0x1db739[_0xbf94('0x51')],_0x64fb46['id']);}logger[_0xbf94('0x25')](_0xbf94('0x56'),_0xbf94('0x64'));emit(util['format']('user:%s',_0x1fd72e[_0xbf94('0x16')]),_0xbf94('0x65'),{'uri':_0x33d304});})[_0xbf94('0x66')](function(_0x233cd5){logger[_0xbf94('0x67')](_0xbf94('0x56'),JSON['stringify'](_0x233cd5));});};exports[_0xbf94('0x68')]=function(_0x21272b,_0x5f46de,_0x170cf8,_0x3bfaa6,_0x1eb09f,_0x4ef559,_0xf8b0f7){var _0x39ec91,_0x6d9a2d,_0x3b1247,_0x8c5c1e;_0x4ef559['remoteUri']=intUtil['stripTrailingSlash'](_0x4ef559[_0xbf94('0x51')]);_0x4ef559[_0xbf94('0x69')]=intUtil[_0xbf94('0x52')](_0x4ef559[_0xbf94('0x69')]);def[_0xbf94('0x53')]=util[_0xbf94('0x20')](_0xbf94('0x54'),_0x4ef559[_0xbf94('0x51')]);if(_0xf8b0f7&&_0xf8b0f7[_0xbf94('0x6a')]&&_0xf8b0f7[_0xbf94('0x6a')]!=='none'){logger[_0xbf94('0x25')](_0xbf94('0x6b'),_0xbf94('0x6c'));_0x5f46de['recordingURL']=util['format'](_0xbf94('0x58'),_0x4ef559['serverUrl'],_0x5f46de[_0xbf94('0x59')],md5(_0x5f46de[_0xbf94('0x59')]));}return getConnection(_0x4ef559)[_0xbf94('0x2a')](function(_0x1538ea){_0x8c5c1e=_0x1538ea;return getUser(_0x4ef559,_0x3bfaa6['name'],_0x8c5c1e);})[_0xbf94('0x2a')](function(_0x2328d3){_0x39ec91=_0x2328d3;logger['info']('The\x20User\x20ID\x20is:',_0x39ec91['id']);return getEndUser(_0x4ef559,_0x5f46de['destcalleridname'],_0x5f46de['destcalleridnum'],_0x8c5c1e);})[_0xbf94('0x2a')](function(_0x231fe2){_0x6d9a2d=_0x231fe2;logger[_0xbf94('0x25')](_0xbf94('0x5b'),_0x6d9a2d['id']);return getTicket(_0x4ef559,_0x39ec91,_0x6d9a2d,_0x170cf8,_0x5f46de,_0x170cf8[_0xbf94('0x6d')],_0x8c5c1e,'Outbound');})[_0xbf94('0x2a')](function(_0x4624f2){_0x3b1247=_0x4624f2;logger[_0xbf94('0x25')]('Ticket\x20created!');logger[_0xbf94('0x25')](_0xbf94('0x5d'),_0x3b1247['id']);return setRelationship(_0x8c5c1e,_0x39ec91,_0x3b1247,_0xbf94('0x5e'));})[_0xbf94('0x2a')](function(){return setRelationship(_0x8c5c1e,_0x6d9a2d,_0x3b1247,_0xbf94('0x5f'));})[_0xbf94('0x2a')](function(){return getServerInfo(_0x8c5c1e);})[_0xbf94('0x2a')](function(_0x30e153){var _0x2d5192=parseInt(_0x30e153[_0xbf94('0x60')][_0xbf94('0x61')](0x0));var _0x4758cc=util[_0xbf94('0x20')](_0xbf94('0x62'),_0x4ef559[_0xbf94('0x51')],_0x3b1247['id']);if(_0x2d5192>0x6){_0x4758cc=util[_0xbf94('0x20')](_0xbf94('0x63'),_0x4ef559[_0xbf94('0x51')],_0x3b1247['id']);}logger[_0xbf94('0x25')](_0xbf94('0x6b'),_0xbf94('0x64'));emit(util[_0xbf94('0x20')](_0xbf94('0x6e'),_0x3bfaa6[_0xbf94('0x16')]),_0xbf94('0x65'),{'uri':_0x4758cc});})[_0xbf94('0x66')](function(_0x3d76ee){logger['error'](_0xbf94('0x6b'),JSON[_0xbf94('0x1f')](_0x3d76ee));});};exports[_0xbf94('0x6f')]=function(_0x443c90,_0x24b40d,_0x4ad319,_0x310288,_0x89b76c,_0x2463af){var _0x22cf82,_0x2fc0e9,_0x4c00fb,_0x3af3d6;_0x2463af[_0xbf94('0x51')]=intUtil['stripTrailingSlash'](_0x2463af[_0xbf94('0x51')]);_0x2463af['serverUrl']=intUtil['stripTrailingSlash'](_0x2463af['serverUrl']);def[_0xbf94('0x53')]=util['format'](_0xbf94('0x54'),_0x2463af['remoteUri']);if(_0x89b76c&&_0x89b76c['monitor_format']){logger[_0xbf94('0x25')]('['+_0x24b40d[_0xbf94('0x70')][_0xbf94('0x71')]()+']',_0xbf94('0x6c'));_0x24b40d['recordingURL']=util['format'](_0xbf94('0x58'),_0x2463af[_0xbf94('0x69')],_0x24b40d['uniqueid'],md5(_0x24b40d[_0xbf94('0x59')]));}else{_0x24b40d['recordingURL']='';}return getConnection(_0x2463af)[_0xbf94('0x2a')](function(_0xdc93f3){_0x3af3d6=_0xdc93f3;if(!_[_0xbf94('0x24')](_0x310288)){return getUser(_0x2463af,_0x310288[_0xbf94('0x16')],_0x3af3d6);}else{return getUser(_0x2463af,null,_0x3af3d6);}})[_0xbf94('0x2a')](function(_0x3fbbd9){_0x22cf82=_0x3fbbd9;logger[_0xbf94('0x25')]('The\x20User\x20ID\x20is:',_0x22cf82['id']);return getEndUser(_0x2463af,_0x24b40d[_0xbf94('0x72')],_0x24b40d['calleridnum'],_0x3af3d6);})[_0xbf94('0x2a')](function(_0x413b0c){_0x2fc0e9=_0x413b0c;logger['info'](_0xbf94('0x5b'),_0x2fc0e9['id']);return getTicket(_0x2463af,_0x22cf82,_0x2fc0e9,_0x4ad319,_0x24b40d,_0x4ad319[_0xbf94('0x6d')],_0x3af3d6,'Inbound');})[_0xbf94('0x2a')](function(_0x2da3cb){_0x4c00fb=_0x2da3cb;logger[_0xbf94('0x25')](_0xbf94('0x73'));logger[_0xbf94('0x25')]('The\x20Ticket\x20ID\x20is:',_0x4c00fb['id']);return setRelationship(_0x3af3d6,_0x22cf82,_0x4c00fb,_0xbf94('0x5e'));})['then'](function(){return setRelationship(_0x3af3d6,_0x2fc0e9,_0x4c00fb,_0xbf94('0x5f'));})['then'](function(){return getServerInfo(_0x3af3d6);})[_0xbf94('0x66')](function(_0x3862bf){logger['error']('['+_0x24b40d['lastevent'][_0xbf94('0x71')]()+']',JSON['stringify'](_0x3862bf));});}; \ No newline at end of file +var _0x4ec0=['uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','catch','unmanaged','toUpperCase','calleridnum','Inbound','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','map','type','string','nameField','toLowerCase','content','customField','custom_fields','variable','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl'];(function(_0x48e032,_0x1fa4d7){var _0x3fdf5d=function(_0x52c14b){while(--_0x52c14b){_0x48e032['push'](_0x48e032['shift']());}};_0x3fdf5d(++_0x1fa4d7);}(_0x4ec0,0x186));var _0x04ec=function(_0x5d269e,_0x1292d2){_0x5d269e=_0x5d269e-0x0;var _0x303190=_0x4ec0[_0x5d269e];return _0x303190;};'use strict';var _=require(_0x04ec('0x0'));var rp=require(_0x04ec('0x1'));var BPromise=require(_0x04ec('0x2'));var md5=require(_0x04ec('0x3'));var util=require(_0x04ec('0x4'));var Redis=require(_0x04ec('0x5'));var intUtil=require('./util');var config=require(_0x04ec('0x6'));var logger=require(_0x04ec('0x7'))(_0x04ec('0x8'));config[_0x04ec('0x9')]=_[_0x04ec('0xa')](config[_0x04ec('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x04ec('0x9')]));var def={'method':_0x04ec('0xb'),'json':!![]};function emit(_0x4beab2,_0xcb6a98,_0x2b013a){io['to'](_0x4beab2)[_0x04ec('0xc')](_0xcb6a98,_0x2b013a);}function getTicket(_0x56bf5a,_0x46fff5,_0x5d570b,_0x2a1b3a,_0x2b6c6d,_0x4900d8,_0x3f21e5,_0x3de35f){logger[_0x04ec('0xd')](_0x04ec('0xe'));var _0x22f163=new Date();var _0x463cd3=[{'name':_0x04ec('0xf'),'value':intUtil['getString'](_0x2a1b3a[_0x04ec('0x10')],_0x2b6c6d,'\x20')},{'name':_0x04ec('0x11'),'value':_0x46fff5['id']},{'name':'created_by','value':_0x46fff5['id']},{'name':'description','value':intUtil[_0x04ec('0x12')](_0x2a1b3a[_0x04ec('0x13')],_0x2b6c6d,'\x0a')},{'name':_0x04ec('0x14'),'value':_0x22f163[_0x04ec('0x15')]()[_0x04ec('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0x04ec('0x17'),'value':'0'},{'name':_0x04ec('0x18'),'value':'15'},{'name':'parent_id','value':_0x5d570b['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x04ec('0x19'),'value':_0x5d570b['name']},{'name':_0x04ec('0x1a'),'value':_0x3de35f}];if(_0x4900d8[_0x04ec('0x1b')]){_[_0x04ec('0x1c')](_0x4900d8,function(_0x521659){if(_0x2b6c6d[_0x521659[_0x04ec('0x1d')]]){_0x463cd3[_0x04ec('0x1e')]({'name':_0x521659[_0x04ec('0x1f')],'value':_0x2b6c6d[_0x521659[_0x04ec('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x04ec('0x20'),'response_type':_0x04ec('0x20'),'rest_data':JSON[_0x04ec('0x21')]({'session':_0x3f21e5['id'],'module_name':'Calls','name_value_list':_0x463cd3})}});}function getAuth(_0x24e694){return util[_0x04ec('0x22')](_0x04ec('0x23'),new Buffer(_0x24e694['apiKey']+':X')[_0x04ec('0x24')]('base64'));}function getServerInfo(_0x9eaa9b){return request({'form':{'method':_0x04ec('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x04ec('0x21')]({'session':_0x9eaa9b['id']})}});}function getUser(_0x74c007,_0x5b3eec,_0x3a613d){if(!_[_0x04ec('0x26')](_0x5b3eec)){logger['info'](_0x04ec('0x27'),_0x5b3eec);return request({'form':{'method':_0x04ec('0x28'),'input_type':_0x04ec('0x20'),'response_type':_0x04ec('0x20'),'rest_data':JSON[_0x04ec('0x21')]({'session':_0x3a613d['id'],'module_name':'Employees','query':util[_0x04ec('0x22')](_0x04ec('0x29'),_0x5b3eec),'order_by':'','offset':'0','select_fields':['id','name',_0x04ec('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x04ec('0x2b')](function(_0x2fa77c){if(_0x2fa77c[_0x04ec('0x2c')]['length']){var _0x156db=_[_0x04ec('0x2d')](_0x2fa77c[_0x04ec('0x2c')],function(_0x5b100f){return _0x5b100f[_0x04ec('0x2e')][_0x04ec('0x2a')][_0x04ec('0x2f')]===_0x5b3eec;});if(_0x156db){logger[_0x04ec('0xd')](_0x04ec('0x30'));return BPromise[_0x04ec('0x31')]({'id':_0x156db[_0x04ec('0x2e')]['id'][_0x04ec('0x2f')],'name':_0x156db['name_value_list'][_0x04ec('0xf')][_0x04ec('0x2f')]});}}logger[_0x04ec('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x04ec('0x31')]({'id':_0x3a613d[_0x04ec('0x2e')][_0x04ec('0x32')][_0x04ec('0x2f')],'name':_0x3a613d['name_value_list'][_0x04ec('0x2a')]['value']});});}else{logger[_0x04ec('0xd')](_0x04ec('0x33'));return BPromise[_0x04ec('0x31')]({'id':_0x3a613d['name_value_list']['user_id']['value'],'name':_0x3a613d['name_value_list']['user_name']['value']});}}function getEndUser(_0x57a642,_0x6097f6,_0x5d5d92,_0x17b95d){logger['info'](_0x04ec('0x34'),_0x5d5d92);return request({'form':{'method':_0x04ec('0x28'),'input_type':_0x04ec('0x20'),'response_type':_0x04ec('0x20'),'rest_data':JSON[_0x04ec('0x21')]({'session':_0x17b95d['id'],'module_name':_0x04ec('0x35'),'query':util[_0x04ec('0x22')](_0x04ec('0x36'),_0x5d5d92),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5d9afc){if(_0x5d9afc[_0x04ec('0x2c')][_0x04ec('0x1b')]){var _0x2d0980=_['find'](_0x5d9afc[_0x04ec('0x2c')],function(_0xd9c205){return _0xd9c205[_0x04ec('0x2e')][_0x04ec('0x37')][_0x04ec('0x2f')]===_0x5d5d92;});if(_0x2d0980){logger[_0x04ec('0xd')](_0x04ec('0x38'));return BPromise[_0x04ec('0x31')]({'id':_0x2d0980['name_value_list']['id']['value'],'name':_0x2d0980[_0x04ec('0x2e')][_0x04ec('0xf')][_0x04ec('0x2f')],'phone':_0x2d0980[_0x04ec('0x2e')][_0x04ec('0x37')][_0x04ec('0x2f')]});}}else{logger['info'](_0x04ec('0x39'));return request({'form':{'method':_0x04ec('0x3a'),'input_type':_0x04ec('0x20'),'response_type':_0x04ec('0x20'),'rest_data':JSON[_0x04ec('0x21')]({'session':_0x17b95d['id'],'module_name':_0x04ec('0x35'),'name_value_list':[{'name':_0x04ec('0x3b'),'value':_0x6097f6!==_0x04ec('0x3c')?_0x6097f6:util['format'](_0x04ec('0x3d'),_0x5d5d92)},{'name':_0x04ec('0x37'),'value':_0x5d5d92}]})}})[_0x04ec('0x2b')](function(_0x42b5fe){logger[_0x04ec('0xd')](_0x04ec('0x3e'));return BPromise[_0x04ec('0x31')]({'id':_0x42b5fe['id'],'name':_0x42b5fe['entry_list']['first_name'][_0x04ec('0x2f')],'phone':_0x42b5fe[_0x04ec('0x2c')][_0x04ec('0x37')][_0x04ec('0x2f')]});});}});}function request(_0x197918){logger[_0x04ec('0x3f')]('[HTTP]',JSON[_0x04ec('0x21')](_0x197918));return rp(_['merge'](def,_0x197918));}function getTags(_0x4858d0,_0x247af8){var _0x19b8f8=[];if(_0x4858d0&&_0x4858d0[_0x04ec('0x1b')]>0x0){_0x19b8f8=_[_0x04ec('0x40')](_0x4858d0,_0x247af8);}return _0x19b8f8;}function getCustomFields(_0x576d06,_0x5bedea){var _0x568e32=[];var _0x2f6923={'custom_fields':[]};if(_0x576d06[_0x04ec('0x1b')]>0x0){_[_0x04ec('0x1c')](_0x576d06,function(_0x2f16f7){if(_0x2f16f7[_0x04ec('0x41')]===_0x04ec('0x42')&&_0x2f16f7[_0x04ec('0x43')]&&!_0x2f16f7['customField']){_0x2f6923[_0x2f16f7[_0x04ec('0x43')][_0x04ec('0x44')]()]=_0x2f16f7[_0x04ec('0x45')][_0x04ec('0x24')]();}else if(_0x2f16f7['type']===_0x04ec('0x42')&&_0x2f16f7['idField']&&_0x2f16f7[_0x04ec('0x46')]){_0x2f6923[_0x04ec('0x47')][_0x04ec('0x1e')]({'id':_0x2f16f7[_0x04ec('0x1f')],'value':_0x2f16f7[_0x04ec('0x45')]['toString']()});}else if(_0x2f16f7['type']===_0x04ec('0x48')&&_0x2f16f7[_0x04ec('0x1d')]&&_0x2f16f7[_0x04ec('0x1f')]&&_0x2f16f7[_0x04ec('0x46')]){_0x5bedea[_0x2f16f7[_0x04ec('0x1d')]]&&_0x2f6923[_0x04ec('0x47')][_0x04ec('0x1e')]({'id':_0x2f16f7[_0x04ec('0x1f')],'value':_0x5bedea[_0x2f16f7['variableName']][_0x04ec('0x24')]()});}else if(_0x2f16f7[_0x04ec('0x41')]===_0x04ec('0x49')&&_0x2f16f7['Variable']&&_0x2f16f7[_0x04ec('0x4a')][_0x04ec('0xf')]&&_0x2f16f7[_0x04ec('0x1f')]&&_0x2f16f7[_0x04ec('0x46')]){_0x5bedea[_0x2f16f7[_0x04ec('0x4a')]['name']['toLowerCase']()]&&_0x2f6923[_0x04ec('0x47')][_0x04ec('0x1e')]({'id':_0x2f16f7[_0x04ec('0x1f')],'value':_0x5bedea[_0x2f16f7[_0x04ec('0x4a')][_0x04ec('0xf')][_0x04ec('0x44')]()][_0x04ec('0x24')]()});}});}return _0x2f6923;}function getConnection(_0xcd6a35){return request({'method':_0x04ec('0xb'),'form':{'method':'login','input_type':_0x04ec('0x20'),'response_type':_0x04ec('0x20'),'rest_data':JSON[_0x04ec('0x21')]({'user_auth':{'user_name':_0xcd6a35['username'],'password':_0xcd6a35[_0x04ec('0x4b')],'encryption':_0x04ec('0x4c')},'application':_0x04ec('0x4d')})}})[_0x04ec('0x2b')](function(_0x22d7ad){var _0x403396=_0x22d7ad;if(_0x403396['id']){def[_0x04ec('0x4e')]=_0x403396['id'];return BPromise[_0x04ec('0x31')](_0x403396);}else{throw new Error(util[_0x04ec('0x22')](_0x04ec('0x4f'),_0xcd6a35['id']));}});}function setRelationship(_0x363fbe,_0x8b7c36,_0xbbc2ba,_0x129cc8){return request({'form':{'method':_0x04ec('0x50'),'input_type':'JSON','response_type':_0x04ec('0x20'),'rest_data':JSON[_0x04ec('0x21')]({'session':_0x363fbe['id'],'module_name':_0x04ec('0x51'),'module_id':_0xbbc2ba['id'],'link_field_name':_0x129cc8,'related_ids':[_0x8b7c36['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x04ec('0x52')]=function(_0x5c8fcb,_0x3a7da2,_0x1f87b2,_0x199315,_0xf7d74c,_0x3419fe){var _0x466670,_0x4db7fd,_0x2cc537,_0x11eae9;_0x3419fe['remoteUri']=intUtil[_0x04ec('0x53')](_0x3419fe[_0x04ec('0x54')]);_0x3419fe[_0x04ec('0x55')]=intUtil[_0x04ec('0x53')](_0x3419fe[_0x04ec('0x55')]);def[_0x04ec('0x56')]=util[_0x04ec('0x22')]('%s/service/v4_1/rest.php',_0x3419fe[_0x04ec('0x54')]);if(_0xf7d74c&&_0xf7d74c[_0x04ec('0x57')]){logger[_0x04ec('0xd')](_0x04ec('0x58'),_0x04ec('0x59'));_0x3a7da2['recordingURL']=util[_0x04ec('0x22')](_0x04ec('0x5a'),_0x3419fe[_0x04ec('0x55')],_0x3a7da2[_0x04ec('0x5b')],md5(_0x3a7da2[_0x04ec('0x5b')]));}else{_0x3a7da2[_0x04ec('0x5c')]='';}return getConnection(_0x3419fe)[_0x04ec('0x2b')](function(_0x55aeb2){_0x11eae9=_0x55aeb2;return getUser(_0x3419fe,_0x199315[_0x04ec('0xf')],_0x11eae9);})[_0x04ec('0x2b')](function(_0x57c6cc){_0x466670=_0x57c6cc;logger['info'](_0x04ec('0x5d'),_0x466670['id']);return getEndUser(_0x3419fe,_0x3a7da2[_0x04ec('0x5e')],_0x3a7da2['calleridnum'],_0x11eae9);})['then'](function(_0x3279e0){_0x4db7fd=_0x3279e0;logger[_0x04ec('0xd')](_0x04ec('0x5f'),_0x4db7fd['id']);return getTicket(_0x3419fe,_0x466670,_0x4db7fd,_0x1f87b2,_0x3a7da2,_0x1f87b2['Fields'],_0x11eae9,'Inbound');})[_0x04ec('0x2b')](function(_0x10a05e){_0x2cc537=_0x10a05e;logger['info'](_0x04ec('0x60'));logger[_0x04ec('0xd')](_0x04ec('0x61'),_0x2cc537['id']);return setRelationship(_0x11eae9,_0x466670,_0x2cc537,_0x04ec('0x62'));})[_0x04ec('0x2b')](function(){return setRelationship(_0x11eae9,_0x4db7fd,_0x2cc537,_0x04ec('0x63'));})[_0x04ec('0x2b')](function(){return getServerInfo(_0x11eae9);})[_0x04ec('0x2b')](function(_0x5e066c){var _0x32d140=parseInt(_0x5e066c[_0x04ec('0x64')][_0x04ec('0x65')](0x0));var _0x497f18=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3419fe[_0x04ec('0x54')],_0x2cc537['id']);if(_0x32d140>0x6){_0x497f18=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3419fe[_0x04ec('0x54')],_0x2cc537['id']);}logger[_0x04ec('0xd')]('[QUEUE]',_0x04ec('0x66'));emit(util[_0x04ec('0x22')](_0x04ec('0x67'),_0x199315['name']),_0x04ec('0x68'),{'uri':_0x497f18});})['catch'](function(_0x11fdb9){logger[_0x04ec('0x69')](_0x04ec('0x58'),JSON[_0x04ec('0x21')](_0x11fdb9));});};exports[_0x04ec('0x6a')]=function(_0x5b13b1,_0x43bafb,_0x14881b,_0x556530,_0x514ca9,_0x15b9f2,_0x4aa144){var _0x32fc7,_0x12b830,_0x11b9fa,_0x281ec9;_0x15b9f2['remoteUri']=intUtil[_0x04ec('0x53')](_0x15b9f2[_0x04ec('0x54')]);_0x15b9f2[_0x04ec('0x55')]=intUtil[_0x04ec('0x53')](_0x15b9f2['serverUrl']);def['uri']=util['format'](_0x04ec('0x6b'),_0x15b9f2[_0x04ec('0x54')]);if(_0x4aa144&&_0x4aa144['recordingFormat']&&_0x4aa144[_0x04ec('0x6c')]!=='none'){logger['info'](_0x04ec('0x6d'),'Recording\x20is\x20enabled!');_0x43bafb[_0x04ec('0x5c')]=util[_0x04ec('0x22')](_0x04ec('0x5a'),_0x15b9f2[_0x04ec('0x55')],_0x43bafb['uniqueid'],md5(_0x43bafb[_0x04ec('0x5b')]));}return getConnection(_0x15b9f2)['then'](function(_0x4f6918){_0x281ec9=_0x4f6918;return getUser(_0x15b9f2,_0x556530[_0x04ec('0xf')],_0x281ec9);})[_0x04ec('0x2b')](function(_0xbf128d){_0x32fc7=_0xbf128d;logger[_0x04ec('0xd')](_0x04ec('0x5d'),_0x32fc7['id']);return getEndUser(_0x15b9f2,_0x43bafb[_0x04ec('0x6e')],_0x43bafb[_0x04ec('0x6f')],_0x281ec9);})[_0x04ec('0x2b')](function(_0x3abca8){_0x12b830=_0x3abca8;logger[_0x04ec('0xd')](_0x04ec('0x5f'),_0x12b830['id']);return getTicket(_0x15b9f2,_0x32fc7,_0x12b830,_0x14881b,_0x43bafb,_0x14881b['Fields'],_0x281ec9,_0x04ec('0x70'));})[_0x04ec('0x2b')](function(_0x50bd07){_0x11b9fa=_0x50bd07;logger[_0x04ec('0xd')](_0x04ec('0x60'));logger['info'](_0x04ec('0x61'),_0x11b9fa['id']);return setRelationship(_0x281ec9,_0x32fc7,_0x11b9fa,'users');})[_0x04ec('0x2b')](function(){return setRelationship(_0x281ec9,_0x12b830,_0x11b9fa,_0x04ec('0x63'));})[_0x04ec('0x2b')](function(){return getServerInfo(_0x281ec9);})[_0x04ec('0x2b')](function(_0x37eaa6){var _0x2d1be5=parseInt(_0x37eaa6[_0x04ec('0x64')][_0x04ec('0x65')](0x0));var _0x32160b=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x15b9f2[_0x04ec('0x54')],_0x11b9fa['id']);if(_0x2d1be5>0x6){_0x32160b=util[_0x04ec('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x15b9f2['remoteUri'],_0x11b9fa['id']);}logger['info'](_0x04ec('0x6d'),_0x04ec('0x66'));emit(util[_0x04ec('0x22')]('user:%s',_0x556530[_0x04ec('0xf')]),_0x04ec('0x68'),{'uri':_0x32160b});})[_0x04ec('0x71')](function(_0xf0accf){logger[_0x04ec('0x69')](_0x04ec('0x6d'),JSON[_0x04ec('0x21')](_0xf0accf));});};exports[_0x04ec('0x72')]=function(_0x1962f4,_0x447dd2,_0x44ed8e,_0x5524e5,_0x19d085,_0x3b957b){var _0x37536d,_0x3c6def,_0x531dc2,_0x15a01a;_0x3b957b[_0x04ec('0x54')]=intUtil[_0x04ec('0x53')](_0x3b957b[_0x04ec('0x54')]);_0x3b957b[_0x04ec('0x55')]=intUtil[_0x04ec('0x53')](_0x3b957b[_0x04ec('0x55')]);def[_0x04ec('0x56')]=util[_0x04ec('0x22')](_0x04ec('0x6b'),_0x3b957b[_0x04ec('0x54')]);if(_0x19d085&&_0x19d085[_0x04ec('0x57')]){logger[_0x04ec('0xd')]('['+_0x447dd2['lastevent'][_0x04ec('0x73')]()+']','Recording\x20is\x20enabled!');_0x447dd2[_0x04ec('0x5c')]=util['format'](_0x04ec('0x5a'),_0x3b957b[_0x04ec('0x55')],_0x447dd2['uniqueid'],md5(_0x447dd2[_0x04ec('0x5b')]));}else{_0x447dd2[_0x04ec('0x5c')]='';}return getConnection(_0x3b957b)[_0x04ec('0x2b')](function(_0x1089fd){_0x15a01a=_0x1089fd;if(!_[_0x04ec('0x26')](_0x5524e5)){return getUser(_0x3b957b,_0x5524e5[_0x04ec('0xf')],_0x15a01a);}else{return getUser(_0x3b957b,null,_0x15a01a);}})['then'](function(_0x21d17d){_0x37536d=_0x21d17d;logger['info'](_0x04ec('0x5d'),_0x37536d['id']);return getEndUser(_0x3b957b,_0x447dd2[_0x04ec('0x5e')],_0x447dd2[_0x04ec('0x74')],_0x15a01a);})[_0x04ec('0x2b')](function(_0x348f13){_0x3c6def=_0x348f13;logger[_0x04ec('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3c6def['id']);return getTicket(_0x3b957b,_0x37536d,_0x3c6def,_0x44ed8e,_0x447dd2,_0x44ed8e['Fields'],_0x15a01a,_0x04ec('0x75'));})['then'](function(_0x229940){_0x531dc2=_0x229940;logger['info'](_0x04ec('0x60'));logger['info'](_0x04ec('0x61'),_0x531dc2['id']);return setRelationship(_0x15a01a,_0x37536d,_0x531dc2,_0x04ec('0x62'));})['then'](function(){return setRelationship(_0x15a01a,_0x3c6def,_0x531dc2,_0x04ec('0x63'));})[_0x04ec('0x2b')](function(){return getServerInfo(_0x15a01a);})[_0x04ec('0x71')](function(_0x21c3eb){logger[_0x04ec('0x69')]('['+_0x447dd2[_0x04ec('0x76')][_0x04ec('0x73')]()+']',JSON['stringify'](_0x21c3eb));});}; \ 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 cbf8aae..5bd63bf 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 _0xb8ef=['test','lodash','getString','length','sortBy','string','push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','customVariable','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil'];(function(_0x38552c,_0x8aadcc){var _0x25b2aa=function(_0x425951){while(--_0x425951){_0x38552c['push'](_0x38552c['shift']());}};_0x25b2aa(++_0x8aadcc);}(_0xb8ef,0x1a5));var _0xfb8e=function(_0x3a3822,_0x1e4fd1){_0x3a3822=_0x3a3822-0x0;var _0x2f9aca=_0xb8ef[_0x3a3822];return _0x2f9aca;};'use strict';var _=require(_0xfb8e('0x0'));var util=require('util');exports[_0xfb8e('0x1')]=function(_0x2740c0,_0x16f7de,_0xaaeb9e){var _0x383a64=[];if(_0x2740c0[_0xfb8e('0x2')]>0x0){var _0x254740=_[_0xfb8e('0x3')](_0x2740c0,['id']);for(var _0x1d413a=0x0;_0x1d413a<_0x254740[_0xfb8e('0x2')];_0x1d413a++){var _0x176eac=_0x254740[_0x1d413a];if(_0x176eac['type']===_0xfb8e('0x4')){_0x383a64[_0xfb8e('0x5')](_0x176eac[_0xfb8e('0x6')]);}else if(_0x176eac[_0xfb8e('0x7')]===_0xfb8e('0x8')&&_0x176eac['variableName']){_0x16f7de[_0x176eac[_0xfb8e('0x9')]]&&_0x383a64[_0xfb8e('0x5')](_0x16f7de[_0x176eac[_0xfb8e('0x9')]][_0xfb8e('0xa')]());}else if(_0x176eac[_0xfb8e('0x7')]==='customVariable'&&_0x176eac[_0xfb8e('0xb')]&&_0x176eac['Variable']['name']){_0x16f7de[_0x176eac[_0xfb8e('0xb')][_0xfb8e('0xc')][_0xfb8e('0xd')]()]&&_0x383a64[_0xfb8e('0x5')](_0x16f7de[_0x176eac['Variable']['name'][_0xfb8e('0xd')]()][_0xfb8e('0xa')]());}else if(_0x176eac[_0xfb8e('0x7')]===_0xfb8e('0xe')){if(_0x176eac[_0xfb8e('0xf')]===_0xfb8e('0x4')&&_0x176eac[_0xfb8e('0x10')]){_0x383a64['push'](util[_0xfb8e('0x11')]('%s:\x20%s',_0x176eac[_0xfb8e('0x10')],_0x176eac['keyContent']));}else if(_0x176eac['keyType']===_0xfb8e('0x8')&&_0x176eac[_0xfb8e('0x9')]&&_0x176eac[_0xfb8e('0x10')]){_0x16f7de[_0x176eac['variableName']]&&_0x383a64[_0xfb8e('0x5')](util[_0xfb8e('0x11')]('%s:\x20%s',_0x176eac['key'],_0x16f7de[_0x176eac[_0xfb8e('0x9')]]));}else if(_0x176eac[_0xfb8e('0xf')]===_0xfb8e('0x12')&&_0x176eac['Variable']&&_0x176eac[_0xfb8e('0xb')][_0xfb8e('0xc')]&&_0x176eac[_0xfb8e('0x10')]){_0x16f7de[_0x176eac[_0xfb8e('0xb')][_0xfb8e('0xc')]['toLowerCase']()]&&_0x383a64['push'](util[_0xfb8e('0x11')](_0xfb8e('0x13'),_0x176eac[_0xfb8e('0x10')],_0x16f7de[_0x176eac['Variable']['name'][_0xfb8e('0xd')]()]));}}}}return _0x383a64[_0xfb8e('0x14')](_0xaaeb9e);};exports[_0xfb8e('0x15')]=function(_0x6f9833){var _0x12cae7=_0x6f9833[_0xfb8e('0x16')](-0x1);if(_0x12cae7==='/'){_0x6f9833=_0x6f9833[_0xfb8e('0x17')](0x0,_0x6f9833[_0xfb8e('0x18')](_0x12cae7));}return _0x6f9833;};exports[_0xfb8e('0x19')]=function(_0x247731){if(!_[_0xfb8e('0x1a')](_0x247731)&&_0x247731!==''){var _0x5d28e9=/^(([^<>()\[\]\\.,;:\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 _0x5d28e9[_0xfb8e('0x1b')](String(_0x247731)[_0xfb8e('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x166f=['slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString','Variable','toLowerCase','name','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','customVariable','stripTrailingSlash'];(function(_0x386247,_0x5dcfa9){var _0x3abf65=function(_0x29d423){while(--_0x29d423){_0x386247['push'](_0x386247['shift']());}};_0x3abf65(++_0x5dcfa9);}(_0x166f,0x162));var _0xf166=function(_0x7d9ab4,_0x1114a1){_0x7d9ab4=_0x7d9ab4-0x0;var _0x12572c=_0x166f[_0x7d9ab4];return _0x12572c;};'use strict';var _=require(_0xf166('0x0'));var util=require(_0xf166('0x1'));exports[_0xf166('0x2')]=function(_0x42b529,_0x5cd4e0,_0x4f5cff){var _0x554065=[];if(_0x42b529[_0xf166('0x3')]>0x0){var _0xb9290=_[_0xf166('0x4')](_0x42b529,['id']);for(var _0xc77552=0x0;_0xc77552<_0xb9290[_0xf166('0x3')];_0xc77552++){var _0x41ce11=_0xb9290[_0xc77552];if(_0x41ce11[_0xf166('0x5')]===_0xf166('0x6')){_0x554065[_0xf166('0x7')](_0x41ce11[_0xf166('0x8')]);}else if(_0x41ce11[_0xf166('0x5')]==='variable'&&_0x41ce11[_0xf166('0x9')]){_0x5cd4e0[_0x41ce11['variableName']]&&_0x554065['push'](_0x5cd4e0[_0x41ce11[_0xf166('0x9')]][_0xf166('0xa')]());}else if(_0x41ce11[_0xf166('0x5')]==='customVariable'&&_0x41ce11['Variable']&&_0x41ce11[_0xf166('0xb')]['name']){_0x5cd4e0[_0x41ce11[_0xf166('0xb')]['name'][_0xf166('0xc')]()]&&_0x554065['push'](_0x5cd4e0[_0x41ce11[_0xf166('0xb')][_0xf166('0xd')][_0xf166('0xc')]()]['toString']());}else if(_0x41ce11[_0xf166('0x5')]===_0xf166('0xe')){if(_0x41ce11[_0xf166('0xf')]===_0xf166('0x6')&&_0x41ce11[_0xf166('0x10')]){_0x554065['push'](util[_0xf166('0x11')](_0xf166('0x12'),_0x41ce11[_0xf166('0x10')],_0x41ce11[_0xf166('0x13')]));}else if(_0x41ce11['keyType']===_0xf166('0x14')&&_0x41ce11['variableName']&&_0x41ce11[_0xf166('0x10')]){_0x5cd4e0[_0x41ce11[_0xf166('0x9')]]&&_0x554065[_0xf166('0x7')](util['format'](_0xf166('0x12'),_0x41ce11[_0xf166('0x10')],_0x5cd4e0[_0x41ce11['variableName']]));}else if(_0x41ce11[_0xf166('0xf')]===_0xf166('0x15')&&_0x41ce11[_0xf166('0xb')]&&_0x41ce11[_0xf166('0xb')][_0xf166('0xd')]&&_0x41ce11['key']){_0x5cd4e0[_0x41ce11[_0xf166('0xb')]['name'][_0xf166('0xc')]()]&&_0x554065['push'](util[_0xf166('0x11')]('%s:\x20%s',_0x41ce11['key'],_0x5cd4e0[_0x41ce11[_0xf166('0xb')][_0xf166('0xd')][_0xf166('0xc')]()]));}}}}return _0x554065['join'](_0x4f5cff);};exports[_0xf166('0x16')]=function(_0x25dc91){var _0xd6c8d8=_0x25dc91[_0xf166('0x17')](-0x1);if(_0xd6c8d8==='/'){_0x25dc91=_0x25dc91[_0xf166('0x18')](0x0,_0x25dc91[_0xf166('0x19')](_0xd6c8d8));}return _0x25dc91;};exports[_0xf166('0x1a')]=function(_0x1a77cb){if(!_[_0xf166('0x1b')](_0x1a77cb)&&_0x1a77cb!==''){var _0x52659f=/^(([^<>()\[\]\\.,;:\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 _0x52659f[_0xf166('0x1c')](String(_0x1a77cb)[_0xf166('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 43ccb23..ff098a1 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0xe9b999,_0x4bdbc7){var _0x83800=function(_0x282b78){while(--_0x282b78){_0xe9b999['push'](_0xe9b999['shift']());}};_0x83800(++_0x4bdbc7);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index f8f59f6..967b7a4 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 _0x97f7=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','replace','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','socket.io-emitter','redis','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','base64','[HTTP]','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','push','toString','variable','variableName','customVariable','Variable','toLowerCase','queue'];(function(_0x1656d4,_0x5c0706){var _0x116a28=function(_0x71c2d6){while(--_0x71c2d6){_0x1656d4['push'](_0x1656d4['shift']());}};_0x116a28(++_0x5c0706);}(_0x97f7,0x98));var _0x797f=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x97f7[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x797f('0x0'));var rp=require(_0x797f('0x1'));var md5=require(_0x797f('0x2'));var util=require(_0x797f('0x3'));var Redis=require(_0x797f('0x4'));var intUtil=require(_0x797f('0x5'));var config=require(_0x797f('0x6'));var logger=require(_0x797f('0x7'))('zendesk');config['redis']=_[_0x797f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x797f('0x9'))(new Redis(config[_0x797f('0xa')]));function emit(_0x1da408,_0x1460bc,_0x19ee87){io['to'](_0x1da408)['emit'](_0x1460bc,_0x19ee87);}var headers={'Content-Type':_0x797f('0xb'),'Accept':_0x797f('0xb')};function getTicket(_0x407b26,_0x3e4e73,_0x18fe43,_0x4b96ff,_0x4fe4e9){logger[_0x797f('0xc')](_0x797f('0xd'));return request({'uri':util['format'](_0x797f('0xe'),_0x407b26[_0x797f('0xf')]),'method':'POST','body':{'ticket':_[_0x797f('0x10')]({'requester_id':_0x18fe43['id'],'submitter_id':_0x3e4e73?_0x3e4e73['id']:undefined,'assignee_id':_0x3e4e73?_0x3e4e73['id']:undefined,'tags':getTags(_0x4b96ff['Tags'],_0x797f('0x11')),'subject':intUtil[_0x797f('0x12')](_0x4b96ff[_0x797f('0x13')],_0x4fe4e9,'\x20'),'description':intUtil[_0x797f('0x12')](_0x4b96ff[_0x797f('0x14')],_0x4fe4e9,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4b96ff[_0x797f('0x14')],_0x4fe4e9,'\x0a')}},getCustomFields(_0x4b96ff['Fields'],_0x4fe4e9))}})['then'](function(_0x3209fc){logger[_0x797f('0xc')](_0x797f('0x15'));return _0x3209fc[_0x797f('0x16')];});}function getUser(_0x4c200e,_0x43a971){if(intUtil[_0x797f('0x17')](_0x43a971)){logger[_0x797f('0xc')](_0x797f('0x18'),_0x43a971);return request({'uri':util['format']('%s/search.json',_0x4c200e['remoteUri']),'qs':{'query':util[_0x797f('0x19')]('type:user\x20role:agent\x20email:%s',_0x43a971)}})['then'](function(_0x3cf137){if(_0x3cf137[_0x797f('0x1a')]){logger[_0x797f('0xc')](_0x797f('0x1b'));return _[_0x797f('0x1c')](_0x3cf137[_0x797f('0x1d')],{'email':_0x43a971,'role':_0x797f('0x1e')});}else{logger[_0x797f('0xc')](_0x797f('0x1f'));return request({'uri':util[_0x797f('0x19')](_0x797f('0x20'),_0x4c200e['remoteUri'])})[_0x797f('0x21')](function(_0x5b4877){logger['info'](_0x797f('0x22'));return _0x5b4877[_0x797f('0x23')];});}});}else{logger[_0x797f('0xc')](_0x797f('0x1f'));return request({'uri':util['format'](_0x797f('0x20'),_0x4c200e[_0x797f('0xf')])})[_0x797f('0x21')](function(_0x1c8236){logger[_0x797f('0xc')](_0x797f('0x22'));return _0x1c8236[_0x797f('0x23')];});}}function getEndUser(_0x328536,_0x120861,_0x52e929){logger['info'](_0x797f('0x24'),_0x52e929);return request({'uri':util[_0x797f('0x19')](_0x797f('0x25'),_0x328536['remoteUri']),'qs':{'query':util[_0x797f('0x19')](_0x797f('0x26'),_0x52e929)}})[_0x797f('0x21')](function(_0x5d12a2){var _0xdddf;if(_0x5d12a2[_0x797f('0x1d')][_0x797f('0x27')]){_0x5d12a2['results']=_['filter'](_0x5d12a2[_0x797f('0x1d')],{'suspended':![],'role':_0x797f('0x28')});if(_0x5d12a2[_0x797f('0x1d')]['length']){_0xdddf=_['first'](_0x5d12a2['results']);}}if(_0xdddf){logger['info']('Enduser\x20found!');return _0xdddf;}else{logger['info'](_0x797f('0x29'));return request({'uri':util[_0x797f('0x19')](_0x797f('0x2a'),_0x328536['remoteUri']),'method':_0x797f('0x2b'),'body':{'user':{'role':_0x797f('0x28'),'name':util[_0x797f('0x19')](_0x797f('0x2c'),_0x120861||_0x52e929),'phone':_0x52e929}}})[_0x797f('0x21')](function(_0x106405){logger[_0x797f('0xc')](_0x797f('0x2d'));return _0x106405['user'];});}});}function getAuth(_0x3e4211){var _0x31cc6c;if(_0x3e4211['authType']===_0x797f('0x2e')){_0x31cc6c=util[_0x797f('0x19')](_0x797f('0x2f'),_0x3e4211[_0x797f('0x30')],_0x3e4211[_0x797f('0x2e')]);}else if(_0x3e4211[_0x797f('0x31')]===_0x797f('0x32')){_0x31cc6c=util['format'](_0x797f('0x33'),_0x3e4211[_0x797f('0x30')],_0x3e4211[_0x797f('0x32')]);}return util['format'](_0x797f('0x34'),new Buffer(_0x31cc6c)['toString'](_0x797f('0x35')));}function request(_0x58e5e3){logger['debug'](_0x797f('0x36'),JSON['stringify'](_0x58e5e3));return rp(_[_0x797f('0x8')](_0x58e5e3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5ce34f,_0x258789){var _0x3d08dd=[];if(_0x5ce34f&&_0x5ce34f[_0x797f('0x27')]>0x0){_0x3d08dd=_[_0x797f('0x37')](_0x5ce34f,_0x258789);}return _0x3d08dd;}function getCustomFields(_0x4a9f06,_0x3ad652){var _0x28bdef=[];var _0x2e0737={'custom_fields':[]};if(_0x4a9f06[_0x797f('0x27')]>0x0){_[_0x797f('0x38')](_0x4a9f06,function(_0x553354){if(_[_0x797f('0x39')]([_0x797f('0x3a'),_0x797f('0x3b')],_0x553354[_0x797f('0x3c')])&&_0x553354[_0x797f('0x3d')]&&!_0x553354[_0x797f('0x3e')]){_0x2e0737[_0x553354[_0x797f('0x3d')]['toLowerCase']()]=_0x553354[_0x797f('0x3f')]['toString']();}else if(_[_0x797f('0x39')](['string',_0x797f('0x3b')],_0x553354[_0x797f('0x3c')])&&_0x553354[_0x797f('0x40')]&&_0x553354[_0x797f('0x3e')]){_0x2e0737[_0x797f('0x41')][_0x797f('0x42')]({'id':_0x553354['idField'],'value':_0x553354['content'][_0x797f('0x43')]()});}else if(_0x553354[_0x797f('0x3c')]===_0x797f('0x44')&&_0x553354[_0x797f('0x45')]&&_0x553354['idField']&&_0x553354['customField']){_0x3ad652[_0x553354['variableName']]&&_0x2e0737[_0x797f('0x41')][_0x797f('0x42')]({'id':_0x553354[_0x797f('0x40')],'value':_0x3ad652[_0x553354[_0x797f('0x45')]][_0x797f('0x43')]()});}else if(_0x553354['type']===_0x797f('0x46')&&_0x553354['Variable']&&_0x553354[_0x797f('0x47')][_0x797f('0x11')]&&_0x553354[_0x797f('0x40')]&&_0x553354[_0x797f('0x3e')]){_0x3ad652[_0x553354[_0x797f('0x47')]['name'][_0x797f('0x48')]()]&&_0x2e0737[_0x797f('0x41')]['push']({'id':_0x553354[_0x797f('0x40')],'value':_0x3ad652[_0x553354[_0x797f('0x47')][_0x797f('0x11')][_0x797f('0x48')]()][_0x797f('0x43')]()});}});}return _0x2e0737;}exports[_0x797f('0x49')]=function(_0x5e5f9a,_0x55e87c,_0x4d9448,_0x26943d,_0x46cb2c,_0x1b1930){var _0x466cc2,_0x501366;_0x1b1930[_0x797f('0xf')]=intUtil[_0x797f('0x4a')](_0x1b1930[_0x797f('0xf')]);_0x1b1930[_0x797f('0x4b')]=intUtil[_0x797f('0x4a')](_0x1b1930['serverUrl']);if(_0x46cb2c&&_0x46cb2c[_0x797f('0x4c')]){logger[_0x797f('0xc')](_0x797f('0x4d'),_0x797f('0x4e'));_0x55e87c[_0x797f('0x4f')]=util[_0x797f('0x19')](_0x797f('0x50'),_0x1b1930[_0x797f('0x4b')],_0x55e87c[_0x797f('0x51')],md5(_0x55e87c[_0x797f('0x51')]));}else{_0x55e87c[_0x797f('0x4f')]='';}headers[_0x797f('0x52')]=getAuth(_0x1b1930);return getUser(_0x1b1930,_0x26943d[_0x797f('0x53')])[_0x797f('0x21')](function(_0x4f6e5f){_0x466cc2=_0x4f6e5f;logger[_0x797f('0xc')](_0x797f('0x54'),_0x466cc2['id']);return getEndUser(_0x1b1930,_0x55e87c[_0x797f('0x55')],_0x55e87c[_0x797f('0x56')]);})[_0x797f('0x21')](function(_0x190053){_0x501366=_0x190053;logger[_0x797f('0xc')](_0x797f('0x57'),_0x501366['id']);return getTicket(_0x1b1930,_0x466cc2,_0x501366,_0x4d9448,_0x55e87c);})[_0x797f('0x21')](function(_0x18b8e8){if(_0x18b8e8){logger[_0x797f('0xc')](_0x797f('0x58'),_0x18b8e8['id']);switch(_0x1b1930[_0x797f('0x3c')]){case _0x797f('0x59'):logger[_0x797f('0xc')](_0x797f('0x4d'),_0x797f('0x5a'));return request({'uri':util[_0x797f('0x19')](_0x797f('0x5b'),_0x1b1930['remoteUri'],_0x466cc2['id'],_0x18b8e8['id']),'method':_0x797f('0x2b')});case _0x797f('0x5c'):logger[_0x797f('0xc')](_0x797f('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x797f('0x19')]('user:%s',_0x26943d[_0x797f('0x11')]),_0x797f('0x5d'),{'uri':util[_0x797f('0x19')]('%s/agent/tickets/%s',_0x1b1930[_0x797f('0xf')][_0x797f('0x5e')]('/api/v2',''),_0x18b8e8['id'])});break;default:logger[_0x797f('0x5f')](_0x797f('0x4d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x797f('0x60')](function(_0x5ab7b7){logger['error'](_0x797f('0x61'),util['inspect'](_0x5ab7b7,{'showHidden':!![],'depth':null}));});};exports[_0x797f('0x62')]=function(_0x35b1e8,_0x142445,_0x25edef,_0x406f70,_0x3d79e0,_0x1474d3,_0x46faa4){var _0x3e4942,_0x30083b;_0x1474d3['remoteUri']=intUtil[_0x797f('0x4a')](_0x1474d3['remoteUri']);_0x1474d3[_0x797f('0x4b')]=intUtil[_0x797f('0x4a')](_0x1474d3[_0x797f('0x4b')]);if(_0x46faa4&&_0x46faa4['recordingFormat']&&_0x46faa4[_0x797f('0x63')]!==_0x797f('0x64')){logger['info'](_0x797f('0x65'),_0x797f('0x4e'));_0x142445[_0x797f('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1474d3[_0x797f('0x4b')],_0x142445[_0x797f('0x51')],md5(_0x142445[_0x797f('0x51')]));}headers[_0x797f('0x52')]=getAuth(_0x1474d3);return getUser(_0x1474d3,_0x406f70[_0x797f('0x53')])[_0x797f('0x21')](function(_0x43904f){_0x3e4942=_0x43904f;logger[_0x797f('0xc')](_0x797f('0x54'),_0x3e4942['id']);return getEndUser(_0x1474d3,_0x142445[_0x797f('0x66')],_0x142445[_0x797f('0x67')]);})['then'](function(_0x477c67){_0x30083b=_0x477c67;logger['info']('The\x20Enduser\x20ID\x20is:',_0x30083b['id']);return getTicket(_0x1474d3,_0x3e4942,_0x30083b,_0x25edef,_0x142445);})[_0x797f('0x21')](function(_0x35e8c8){if(_0x35e8c8){logger[_0x797f('0xc')]('The\x20Ticket\x20ID\x20is:',_0x35e8c8['id']);switch(_0x1474d3[_0x797f('0x3c')]){case _0x797f('0x59'):logger[_0x797f('0xc')](_0x797f('0x65'),_0x797f('0x5a'));return request({'uri':util[_0x797f('0x19')](_0x797f('0x5b'),_0x1474d3[_0x797f('0xf')],_0x3e4942['id'],_0x35e8c8['id']),'method':_0x797f('0x2b')});case _0x797f('0x5c'):logger['info']('[OUTBOUND]',_0x797f('0x68'));emit(util[_0x797f('0x19')](_0x797f('0x69'),_0x406f70[_0x797f('0x11')]),_0x797f('0x5d'),{'uri':util['format'](_0x797f('0x6a'),_0x1474d3[_0x797f('0xf')][_0x797f('0x5e')]('/api/v2',''),_0x35e8c8['id'])});break;default:logger[_0x797f('0x5f')](_0x797f('0x65'),_0x797f('0x6b'));}}})[_0x797f('0x60')](function(_0x30de6f){logger[_0x797f('0x5f')](_0x797f('0x6c'),util[_0x797f('0x6d')](_0x30de6f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x49a491,_0x33a639,_0x5d8d71,_0x472c15,_0x3494c4,_0x17bcb6){var _0x1b3fe9,_0x26cea7;_0x17bcb6[_0x797f('0xf')]=intUtil[_0x797f('0x4a')](_0x17bcb6[_0x797f('0xf')]);_0x17bcb6[_0x797f('0x4b')]=intUtil[_0x797f('0x4a')](_0x17bcb6['serverUrl']);if(_0x3494c4&&_0x3494c4[_0x797f('0x4c')]){logger[_0x797f('0xc')]('['+_0x33a639[_0x797f('0x6e')][_0x797f('0x6f')]()+']',_0x797f('0x4e'));_0x33a639[_0x797f('0x4f')]=util[_0x797f('0x19')](_0x797f('0x50'),_0x17bcb6[_0x797f('0x4b')],_0x33a639[_0x797f('0x51')],md5(_0x33a639['uniqueid']));}else{_0x33a639[_0x797f('0x4f')]='';}headers['Authorization']=getAuth(_0x17bcb6);return getUser(_0x17bcb6)[_0x797f('0x21')](function(_0x222c00){_0x1b3fe9=_0x222c00;logger['info'](_0x797f('0x54'),_0x1b3fe9['id']);return getEndUser(_0x17bcb6,_0x33a639[_0x797f('0x55')],_0x33a639[_0x797f('0x56')]);})[_0x797f('0x21')](function(_0x239123){_0x26cea7=_0x239123;logger[_0x797f('0xc')](_0x797f('0x57'),_0x26cea7['id']);return getTicket(_0x17bcb6,_0x1b3fe9,_0x26cea7,_0x5d8d71,_0x33a639);})[_0x797f('0x21')](function(_0x49fd1e){if(_0x49fd1e){logger[_0x797f('0xc')](_0x797f('0x58'),_0x49fd1e['id']);}})[_0x797f('0x60')](function(_0x5c1fb7){logger[_0x797f('0x5f')]('['+_0x33a639[_0x797f('0x6e')][_0x797f('0x6f')]()+']'+_0x797f('0x70'),util[_0x797f('0x6d')](_0x5c1fb7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc995=['format','%s/tickets.json','remoteUri','merge','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','token','toString','base64','[HTTP]','stringify','defaults','map','length','forEach','includes','string','picklist','nameField','customField','content','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','newTab','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','./util','redis','localhost','application/json','info','Creating\x20new\x20ticket...'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xc995,0xca));var _0x5c99=function(_0x4a2bb0,_0x3def75){_0x4a2bb0=_0x4a2bb0-0x0;var _0x54e404=_0xc995[_0x4a2bb0];return _0x54e404;};'use strict';var _=require(_0x5c99('0x0'));var rp=require('request-promise');var md5=require(_0x5c99('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x5c99('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zendesk');config[_0x5c99('0x3')]=_['defaults'](config[_0x5c99('0x3')],{'host':_0x5c99('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x369abb,_0x44a763,_0x3fa558){io['to'](_0x369abb)['emit'](_0x44a763,_0x3fa558);}var headers={'Content-Type':'application/json','Accept':_0x5c99('0x5')};function getTicket(_0x42c1cd,_0x2ee0bb,_0x5f3b91,_0x2cd373,_0x2a3b68){logger[_0x5c99('0x6')](_0x5c99('0x7'));return request({'uri':util[_0x5c99('0x8')](_0x5c99('0x9'),_0x42c1cd[_0x5c99('0xa')]),'method':'POST','body':{'ticket':_[_0x5c99('0xb')]({'requester_id':_0x5f3b91['id'],'submitter_id':_0x2ee0bb?_0x2ee0bb['id']:undefined,'assignee_id':_0x2ee0bb?_0x2ee0bb['id']:undefined,'tags':getTags(_0x2cd373['Tags'],'name'),'subject':intUtil[_0x5c99('0xc')](_0x2cd373[_0x5c99('0xd')],_0x2a3b68,'\x20'),'description':intUtil[_0x5c99('0xc')](_0x2cd373[_0x5c99('0xe')],_0x2a3b68,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5c99('0xc')](_0x2cd373[_0x5c99('0xe')],_0x2a3b68,'\x0a')}},getCustomFields(_0x2cd373['Fields'],_0x2a3b68))}})[_0x5c99('0xf')](function(_0x44777e){logger[_0x5c99('0x6')](_0x5c99('0x10'));return _0x44777e[_0x5c99('0x11')];});}function getUser(_0x4677ae,_0x9ce834){if(intUtil[_0x5c99('0x12')](_0x9ce834)){logger[_0x5c99('0x6')](_0x5c99('0x13'),_0x9ce834);return request({'uri':util['format'](_0x5c99('0x14'),_0x4677ae[_0x5c99('0xa')]),'qs':{'query':util[_0x5c99('0x8')](_0x5c99('0x15'),_0x9ce834)}})[_0x5c99('0xf')](function(_0x37e21e){if(_0x37e21e[_0x5c99('0x16')]){logger[_0x5c99('0x6')]('Agent\x20found!');return _[_0x5c99('0x17')](_0x37e21e[_0x5c99('0x18')],{'email':_0x9ce834,'role':_0x5c99('0x19')});}else{logger[_0x5c99('0x6')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5c99('0x8')]('%s/users/me.json',_0x4677ae[_0x5c99('0xa')])})['then'](function(_0x49bad0){logger[_0x5c99('0x6')](_0x5c99('0x1a'));return _0x49bad0[_0x5c99('0x1b')];});}});}else{logger[_0x5c99('0x6')](_0x5c99('0x1c'));return request({'uri':util[_0x5c99('0x8')](_0x5c99('0x1d'),_0x4677ae['remoteUri'])})[_0x5c99('0xf')](function(_0x341952){logger[_0x5c99('0x6')](_0x5c99('0x1a'));return _0x341952[_0x5c99('0x1b')];});}}function getEndUser(_0x1ec689,_0x138e10,_0x1b91bd){logger[_0x5c99('0x6')](_0x5c99('0x1e'),_0x1b91bd);return request({'uri':util[_0x5c99('0x8')](_0x5c99('0x14'),_0x1ec689[_0x5c99('0xa')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x1b91bd)}})[_0x5c99('0xf')](function(_0x1dcf36){var _0x2e6603;if(_0x1dcf36[_0x5c99('0x18')]['length']){_0x1dcf36[_0x5c99('0x18')]=_[_0x5c99('0x1f')](_0x1dcf36['results'],{'suspended':![],'role':_0x5c99('0x20')});if(_0x1dcf36[_0x5c99('0x18')]['length']){_0x2e6603=_['first'](_0x1dcf36[_0x5c99('0x18')]);}}if(_0x2e6603){logger['info'](_0x5c99('0x21'));return _0x2e6603;}else{logger['info'](_0x5c99('0x22'));return request({'uri':util[_0x5c99('0x8')](_0x5c99('0x23'),_0x1ec689[_0x5c99('0xa')]),'method':'POST','body':{'user':{'role':_0x5c99('0x20'),'name':util['format'](_0x5c99('0x24'),_0x138e10||_0x1b91bd),'phone':_0x1b91bd}}})['then'](function(_0x5b64dc){logger[_0x5c99('0x6')]('Enduser\x20created.');return _0x5b64dc[_0x5c99('0x1b')];});}});}function getAuth(_0x4f558e){var _0x5502c1;if(_0x4f558e[_0x5c99('0x25')]===_0x5c99('0x26')){_0x5502c1=util[_0x5c99('0x8')](_0x5c99('0x27'),_0x4f558e[_0x5c99('0x28')],_0x4f558e['password']);}else if(_0x4f558e[_0x5c99('0x25')]==='token'){_0x5502c1=util[_0x5c99('0x8')](_0x5c99('0x29'),_0x4f558e[_0x5c99('0x28')],_0x4f558e[_0x5c99('0x2a')]);}return util[_0x5c99('0x8')]('Basic\x20%s',new Buffer(_0x5502c1)[_0x5c99('0x2b')](_0x5c99('0x2c')));}function request(_0x4bf199){logger['debug'](_0x5c99('0x2d'),JSON[_0x5c99('0x2e')](_0x4bf199));return rp(_[_0x5c99('0x2f')](_0x4bf199,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x8759fd,_0x590c72){var _0x595454=[];if(_0x8759fd&&_0x8759fd['length']>0x0){_0x595454=_[_0x5c99('0x30')](_0x8759fd,_0x590c72);}return _0x595454;}function getCustomFields(_0xefadad,_0x316fe8){var _0x112fdc=[];var _0x4466ee={'custom_fields':[]};if(_0xefadad[_0x5c99('0x31')]>0x0){_[_0x5c99('0x32')](_0xefadad,function(_0x48ceaa){if(_[_0x5c99('0x33')]([_0x5c99('0x34'),_0x5c99('0x35')],_0x48ceaa['type'])&&_0x48ceaa[_0x5c99('0x36')]&&!_0x48ceaa[_0x5c99('0x37')]){_0x4466ee[_0x48ceaa[_0x5c99('0x36')]['toLowerCase']()]=_0x48ceaa[_0x5c99('0x38')][_0x5c99('0x2b')]();}else if(_[_0x5c99('0x33')]([_0x5c99('0x34'),_0x5c99('0x35')],_0x48ceaa[_0x5c99('0x39')])&&_0x48ceaa[_0x5c99('0x3a')]&&_0x48ceaa[_0x5c99('0x37')]){_0x4466ee[_0x5c99('0x3b')][_0x5c99('0x3c')]({'id':_0x48ceaa[_0x5c99('0x3a')],'value':_0x48ceaa[_0x5c99('0x38')][_0x5c99('0x2b')]()});}else if(_0x48ceaa['type']===_0x5c99('0x3d')&&_0x48ceaa[_0x5c99('0x3e')]&&_0x48ceaa[_0x5c99('0x3a')]&&_0x48ceaa['customField']){_0x316fe8[_0x48ceaa[_0x5c99('0x3e')]]&&_0x4466ee[_0x5c99('0x3b')][_0x5c99('0x3c')]({'id':_0x48ceaa[_0x5c99('0x3a')],'value':_0x316fe8[_0x48ceaa[_0x5c99('0x3e')]][_0x5c99('0x2b')]()});}else if(_0x48ceaa['type']===_0x5c99('0x3f')&&_0x48ceaa[_0x5c99('0x40')]&&_0x48ceaa[_0x5c99('0x40')][_0x5c99('0x41')]&&_0x48ceaa['idField']&&_0x48ceaa[_0x5c99('0x37')]){_0x316fe8[_0x48ceaa[_0x5c99('0x40')][_0x5c99('0x41')][_0x5c99('0x42')]()]&&_0x4466ee[_0x5c99('0x3b')][_0x5c99('0x3c')]({'id':_0x48ceaa[_0x5c99('0x3a')],'value':_0x316fe8[_0x48ceaa['Variable'][_0x5c99('0x41')][_0x5c99('0x42')]()]['toString']()});}});}return _0x4466ee;}exports[_0x5c99('0x43')]=function(_0x3b6022,_0x4704ab,_0x10cb61,_0x591245,_0xe001e4,_0x5ccc53){var _0x2534b7,_0x2ac435;_0x5ccc53['remoteUri']=intUtil[_0x5c99('0x44')](_0x5ccc53[_0x5c99('0xa')]);_0x5ccc53[_0x5c99('0x45')]=intUtil[_0x5c99('0x44')](_0x5ccc53[_0x5c99('0x45')]);if(_0xe001e4&&_0xe001e4[_0x5c99('0x46')]){logger[_0x5c99('0x6')](_0x5c99('0x47'),_0x5c99('0x48'));_0x4704ab[_0x5c99('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ccc53['serverUrl'],_0x4704ab[_0x5c99('0x4a')],md5(_0x4704ab[_0x5c99('0x4a')]));}else{_0x4704ab[_0x5c99('0x49')]='';}headers[_0x5c99('0x4b')]=getAuth(_0x5ccc53);return getUser(_0x5ccc53,_0x591245[_0x5c99('0x4c')])[_0x5c99('0xf')](function(_0x5128b5){_0x2534b7=_0x5128b5;logger[_0x5c99('0x6')](_0x5c99('0x4d'),_0x2534b7['id']);return getEndUser(_0x5ccc53,_0x4704ab[_0x5c99('0x4e')],_0x4704ab['calleridnum']);})[_0x5c99('0xf')](function(_0xf9d22f){_0x2ac435=_0xf9d22f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2ac435['id']);return getTicket(_0x5ccc53,_0x2534b7,_0x2ac435,_0x10cb61,_0x4704ab);})[_0x5c99('0xf')](function(_0x5e6a05){if(_0x5e6a05){logger['info'](_0x5c99('0x4f'),_0x5e6a05['id']);switch(_0x5ccc53['type']){case _0x5c99('0x50'):logger[_0x5c99('0x6')](_0x5c99('0x47'),_0x5c99('0x51'));return request({'uri':util[_0x5c99('0x8')](_0x5c99('0x52'),_0x5ccc53[_0x5c99('0xa')],_0x2534b7['id'],_0x5e6a05['id']),'method':'POST'});case'newTab':logger[_0x5c99('0x6')]('[QUEUE]',_0x5c99('0x53'));emit(util[_0x5c99('0x8')](_0x5c99('0x54'),_0x591245[_0x5c99('0x41')]),_0x5c99('0x55'),{'uri':util[_0x5c99('0x8')](_0x5c99('0x56'),_0x5ccc53[_0x5c99('0xa')][_0x5c99('0x57')](_0x5c99('0x58'),''),_0x5e6a05['id'])});break;default:logger[_0x5c99('0x59')](_0x5c99('0x47'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5c99('0x5a')](function(_0x342577){logger[_0x5c99('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5c99('0x5b')](_0x342577,{'showHidden':!![],'depth':null}));});};exports[_0x5c99('0x5c')]=function(_0x10f610,_0x5a6eea,_0x18d4fb,_0x1c16f0,_0x21ec7e,_0x531910,_0x1038c8){var _0x2a687c,_0xe5bd8e;_0x531910[_0x5c99('0xa')]=intUtil[_0x5c99('0x44')](_0x531910[_0x5c99('0xa')]);_0x531910[_0x5c99('0x45')]=intUtil[_0x5c99('0x44')](_0x531910[_0x5c99('0x45')]);if(_0x1038c8&&_0x1038c8[_0x5c99('0x5d')]&&_0x1038c8[_0x5c99('0x5d')]!==_0x5c99('0x5e')){logger['info'](_0x5c99('0x5f'),_0x5c99('0x48'));_0x5a6eea['recordingURL']=util[_0x5c99('0x8')](_0x5c99('0x60'),_0x531910['serverUrl'],_0x5a6eea[_0x5c99('0x4a')],md5(_0x5a6eea[_0x5c99('0x4a')]));}headers[_0x5c99('0x4b')]=getAuth(_0x531910);return getUser(_0x531910,_0x1c16f0[_0x5c99('0x4c')])[_0x5c99('0xf')](function(_0x3baec6){_0x2a687c=_0x3baec6;logger[_0x5c99('0x6')](_0x5c99('0x4d'),_0x2a687c['id']);return getEndUser(_0x531910,_0x5a6eea['destcalleridname'],_0x5a6eea[_0x5c99('0x61')]);})[_0x5c99('0xf')](function(_0x7e11bc){_0xe5bd8e=_0x7e11bc;logger[_0x5c99('0x6')](_0x5c99('0x62'),_0xe5bd8e['id']);return getTicket(_0x531910,_0x2a687c,_0xe5bd8e,_0x18d4fb,_0x5a6eea);})[_0x5c99('0xf')](function(_0x1e67ef){if(_0x1e67ef){logger[_0x5c99('0x6')]('The\x20Ticket\x20ID\x20is:',_0x1e67ef['id']);switch(_0x531910['type']){case _0x5c99('0x50'):logger[_0x5c99('0x6')](_0x5c99('0x5f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x5c99('0x52'),_0x531910[_0x5c99('0xa')],_0x2a687c['id'],_0x1e67ef['id']),'method':'POST'});case _0x5c99('0x63'):logger[_0x5c99('0x6')](_0x5c99('0x5f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5c99('0x54'),_0x1c16f0[_0x5c99('0x41')]),_0x5c99('0x55'),{'uri':util[_0x5c99('0x8')](_0x5c99('0x56'),_0x531910[_0x5c99('0xa')][_0x5c99('0x57')](_0x5c99('0x58'),''),_0x1e67ef['id'])});break;default:logger['error']('[OUTBOUND]',_0x5c99('0x64'));}}})[_0x5c99('0x5a')](function(_0x5e6146){logger[_0x5c99('0x59')](_0x5c99('0x65'),util[_0x5c99('0x5b')](_0x5e6146,{'showHidden':!![],'depth':null}));});};exports[_0x5c99('0x66')]=function(_0x4d9890,_0x460fec,_0x34360f,_0x4b3904,_0x21ebb6,_0x2fabb1){var _0x153df2,_0x13931f;_0x2fabb1['remoteUri']=intUtil[_0x5c99('0x44')](_0x2fabb1[_0x5c99('0xa')]);_0x2fabb1[_0x5c99('0x45')]=intUtil[_0x5c99('0x44')](_0x2fabb1[_0x5c99('0x45')]);if(_0x21ebb6&&_0x21ebb6['monitor_format']){logger['info']('['+_0x460fec['lastevent'][_0x5c99('0x67')]()+']','Recording\x20is\x20enabled!');_0x460fec[_0x5c99('0x49')]=util[_0x5c99('0x8')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2fabb1[_0x5c99('0x45')],_0x460fec[_0x5c99('0x4a')],md5(_0x460fec['uniqueid']));}else{_0x460fec['recordingURL']='';}headers[_0x5c99('0x4b')]=getAuth(_0x2fabb1);return getUser(_0x2fabb1)[_0x5c99('0xf')](function(_0x365d5b){_0x153df2=_0x365d5b;logger['info'](_0x5c99('0x4d'),_0x153df2['id']);return getEndUser(_0x2fabb1,_0x460fec['calleridname'],_0x460fec['calleridnum']);})[_0x5c99('0xf')](function(_0x5e81da){_0x13931f=_0x5e81da;logger['info'](_0x5c99('0x62'),_0x13931f['id']);return getTicket(_0x2fabb1,_0x153df2,_0x13931f,_0x34360f,_0x460fec);})[_0x5c99('0xf')](function(_0x232218){if(_0x232218){logger[_0x5c99('0x6')](_0x5c99('0x4f'),_0x232218['id']);}})[_0x5c99('0x5a')](function(_0x3d48da){logger[_0x5c99('0x59')]('['+_0x460fec['lastevent'][_0x5c99('0x67')]()+']'+_0x5c99('0x68'),util['inspect'](_0x3d48da,{'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 ba0b0cb..8f1922a 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 _0x4b49=['enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','talktime','utc','format','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','email','calleridname','calleridnum','[QUEUE]','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','../../../../config/environment','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','findIndex','Agent\x20found!','users','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data'];(function(_0x2551dd,_0x5ba066){var _0x905704=function(_0x1c7c11){while(--_0x1c7c11){_0x2551dd['push'](_0x2551dd['shift']());}};_0x905704(++_0x5ba066);}(_0x4b49,0xef));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x94b4('0x0'));var rp=require(_0x94b4('0x1'));var md5=require(_0x94b4('0x2'));var util=require('util');var intUtil=require(_0x94b4('0x3'));var moment=require(_0x94b4('0x4'));var Redis=require(_0x94b4('0x5'));var BPromise=require('bluebird');var config=require(_0x94b4('0x6'));var logger=require('../../../../config/logger')(_0x94b4('0x7'));config['redis']=_['defaults'](config[_0x94b4('0x8')],{'host':_0x94b4('0x9'),'port':0x18eb});var io=require(_0x94b4('0xa'))(new Redis(config[_0x94b4('0x8')]));function emit(_0x1ff3e2,_0x1ce3ba,_0x7705ce){io['to'](_0x1ff3e2)[_0x94b4('0xb')](_0x1ce3ba,_0x7705ce);}function request(_0x5a7af0){logger[_0x94b4('0xc')](_0x94b4('0xd'),JSON[_0x94b4('0xe')](_0x5a7af0));return rp(_0x5a7af0);}function getCustomFields(_0x47aec0,_0x169e10){var _0x39afbe={};if(_0x47aec0[_0x94b4('0xf')]>0x0){_[_0x94b4('0x10')](_0x47aec0,function(_0x3a2023){if(_[_0x94b4('0x11')](['string',_0x94b4('0x12')],_0x3a2023[_0x94b4('0x13')])&&_0x3a2023[_0x94b4('0x14')]){_0x39afbe[_0x3a2023[_0x94b4('0x14')]]=_0x3a2023[_0x94b4('0x15')][_0x94b4('0x16')]();}else if(_0x3a2023[_0x94b4('0x13')]==='variable'&&_0x3a2023['variableName']&&_0x3a2023['idField']&&_0x169e10[_0x3a2023['variableName']]){_0x39afbe[_0x3a2023[_0x94b4('0x14')]]=_0x169e10[_0x3a2023['variableName']][_0x94b4('0x16')]();}else if(_0x3a2023['type']==='customVariable'&&_0x3a2023[_0x94b4('0x17')]&&_0x3a2023[_0x94b4('0x17')]['name']&&_0x3a2023[_0x94b4('0x14')]&&_0x169e10[_0x3a2023[_0x94b4('0x17')][_0x94b4('0x18')][_0x94b4('0x19')]()]){_0x39afbe[_0x3a2023[_0x94b4('0x14')]]=_0x169e10[_0x3a2023[_0x94b4('0x17')][_0x94b4('0x18')][_0x94b4('0x19')]()][_0x94b4('0x16')]();}});}return _0x39afbe;}function getName(_0x4ac981){if(_0x4ac981[_0x94b4('0x1a')]('\x20')>0x0){var _0x5bd6bd=_0x4ac981[_0x94b4('0x1b')](/ (.+)/);if(_0x5bd6bd[0x1]){return _0x5bd6bd;}}return[_0x4ac981,_0x4ac981];}var accountsTokens={};function getAccessToken(_0x531363){return new Promise(function(_0x31bb35,_0x29076a){if(!_[_0x94b4('0x1c')](accountsTokens[_0x531363['id']])&&!_[_0x94b4('0x1c')](accountsTokens[_0x531363['id']]['access_token'])){if(moment()[_0x94b4('0x1d')](accountsTokens[_0x531363['id']][_0x94b4('0x1e')])){_0x31bb35(accountsTokens[_0x531363['id']][_0x94b4('0x1f')]);}}var _0x29ae3e;switch(_0x531363['zone']){case'US':_0x29ae3e='https://accounts.zoho.com';break;case'AU':_0x29ae3e=_0x94b4('0x20');break;case'EU':_0x29ae3e=_0x94b4('0x21');break;case'IN':_0x29ae3e=_0x94b4('0x22');break;case'CN':_0x29ae3e=_0x94b4('0x23');break;default:_0x29ae3e='https://accounts.zoho.eu';break;}var _0x878462={'method':_0x94b4('0x24'),'uri':_0x29ae3e+_0x94b4('0x25'),'qs':{'refresh_token':_0x531363['refreshToken'],'client_id':_0x531363[_0x94b4('0x26')],'client_secret':_0x531363['clientSecret'],'grant_type':_0x94b4('0x27')},'json':!![]};return rp(_0x878462)[_0x94b4('0x28')](function(_0x4bc14d){accountsTokens[_0x531363['id']]={'access_token':_0x4bc14d[_0x94b4('0x1f')],'expires_in':moment()[_0x94b4('0x29')](_0x4bc14d[_0x94b4('0x1e')],_0x94b4('0x2a'))};_0x31bb35(_0x4bc14d[_0x94b4('0x1f')]);})[_0x94b4('0x2b')](function(_0x151b83){logger[_0x94b4('0x2c')](_0x94b4('0x2d'),_0x151b83[_0x94b4('0x2e')]);_0x29076a(_0x151b83);});});}function getUser(_0x18ee29,_0x247a54,_0x324dce,_0x1a4c61){logger[_0x94b4('0x2f')](_0x94b4('0x30'));return request({'method':_0x94b4('0x31'),'uri':util['format'](_0x94b4('0x32'),_0x247a54),'qs':{'type':_0x94b4('0x33')},'headers':{'Authorization':_0x94b4('0x34')+_0x18ee29},'json':!![]})['then'](function(_0x7f0257){if(_0x7f0257['users']){var _0x399208=-0x1;if(_['isArrayLikeObject'](_0x7f0257['users'])){if(!_['isNil'](_0x1a4c61)){_0x399208=_[_0x94b4('0x35')](_0x7f0257['users'],function(_0xf21fe0){return _0xf21fe0['email']===_0x1a4c61;});}if(_0x399208>=0x0){logger[_0x94b4('0x2f')](_0x94b4('0x36'));}else{logger[_0x94b4('0x2f')]('Using\x20the\x20admin\x20account!');_0x399208=_[_0x94b4('0x35')](_0x7f0257[_0x94b4('0x37')],function(_0x19be52){return _0x19be52['profile'][_0x94b4('0x18')]==='Administrator';});}return _0x7f0257['users'][_0x399208];}else{if(_0x7f0257['user'][_0x94b4('0x38')][_0x94b4('0x18')]===_0x94b4('0x39')){logger[_0x94b4('0x2f')](_0x94b4('0x3a'));user=_0x7f0257[_0x94b4('0x3b')];return user;}else{logger[_0x94b4('0x2c')](_0x94b4('0x3c'),JSON[_0x94b4('0xe')](_0x7f0257));throw new Error(_0x94b4('0x3d')+JSON[_0x94b4('0xe')](_0x7f0257));}}}else{logger[_0x94b4('0x2c')](_0x94b4('0x3c'),JSON['stringify'](_0x7f0257));throw new Error(_0x94b4('0x3d')+JSON[_0x94b4('0xe')](_0x7f0257));}})[_0x94b4('0x2b')](function(_0x4608a5){console[_0x94b4('0x2c')](_0x4608a5);});}function getZohoUser(_0x1ce318,_0x2f01d9){return new BPromise(function(_0x4f8c05,_0x3089f6){request(_0x1ce318)['then'](function(_0x55ec42){var _0x50b4eb=null;if(_0x55ec42){_0x50b4eb=_0x55ec42[_0x94b4('0x3e')][0x0];_0x50b4eb[_0x94b4('0x3f')]=_0x2f01d9;}_0x4f8c05(_0x50b4eb);})[_0x94b4('0x2b')](function(_0x591c68){_0x3089f6(_0x591c68);});});}function createEndUser(_0x38ae70,_0x560a41,_0x3d9338,_0x388da2,_0x18cb17,_0x3cf43f){var _0x3d9338=getName(_0x3d9338);return request({'method':_0x94b4('0x24'),'uri':_0x94b4('0x40')+_0x560a41+_0x94b4('0x41')+_[_0x94b4('0x42')](_0x3cf43f[_0x94b4('0x43')])+'s','body':{'data':[{'Last_Name':_0x3d9338[0x1],'First_Name':_0x3d9338[0x0],'Phone':_0x388da2,'Owner':{'name':!_[_0x94b4('0x1c')](_0x18cb17['role'][_0x94b4('0x18')])?_0x18cb17[_0x94b4('0x44')][_0x94b4('0x18')]:!_[_0x94b4('0x1c')](_0x18cb17[_0x94b4('0x45')])?_0x18cb17[_0x94b4('0x45')]+'\x20'+_0x18cb17[_0x94b4('0x46')]:_0x18cb17[_0x94b4('0x46')],'id':_0x18cb17['id']}}]},'headers':{'Authorization':_0x94b4('0x34')+_0x38ae70},'json':!![]})[_0x94b4('0x28')](function(_0x5e59bc){if(_0x5e59bc&&_0x5e59bc[_0x94b4('0x3e')][0x0]['code']===_0x94b4('0x47')){var _0x3c86dc=_0x5e59bc[_0x94b4('0x3e')][0x0][_0x94b4('0x48')];_0x3c86dc[_0x94b4('0x3f')]=_[_0x94b4('0x42')](_0x3cf43f[_0x94b4('0x43')])+'s';return _0x3c86dc;}logger[_0x94b4('0x2c')](_0x94b4('0x3c'),JSON['stringify'](data));throw new Error(_0x94b4('0x49')+JSON[_0x94b4('0xe')](data));})[_0x94b4('0x2b')](function(_0xe6748e){console[_0x94b4('0x4a')]('CREATE\x20ERROR',_0xe6748e);});}function getEndUser(_0x4ba094,_0x27dec4,_0x5b1aca,_0x22af01,_0x229f45,_0x437327,_0x3b1c96){var _0x3e75b2={'method':_0x94b4('0x31'),'uri':'','headers':{'Authorization':_0x94b4('0x34')+_0x4ba094},'json':!![]};switch(_0x3b1c96[_0x94b4('0x4b')]){case _0x94b4('0x4c'):_0x3e75b2[_0x94b4('0x4d')]=_0x94b4('0x40')+_0x27dec4+_0x94b4('0x4e')+_0x229f45+'))';return getZohoUser(_0x3e75b2,_0x94b4('0x4f'))['then'](function(_0x2ccdf1){if(_0x2ccdf1)return _0x2ccdf1;_0x3e75b2[_0x94b4('0x4d')]=_0x94b4('0x40')+_0x27dec4+_0x94b4('0x50')+_0x229f45+'))';return getZohoUser(_0x3e75b2,'Leads')['then'](function(_0x518eca){if(_0x518eca)return _0x518eca;if(_0x3b1c96['moduleCreate']!=_0x94b4('0x51')){return createEndUser(_0x4ba094,_0x27dec4,_0x22af01,_0x229f45,_0x437327,_0x3b1c96);}else{return{};}});});break;case _0x94b4('0x52'):_0x3e75b2['uri']=_0x94b4('0x40')+_0x27dec4+_0x94b4('0x4e')+_0x229f45+'))';return getZohoUser(_0x3e75b2,_0x94b4('0x4f'))[_0x94b4('0x28')](function(_0x327e15){if(_0x327e15)return _0x327e15;if(_0x3b1c96[_0x94b4('0x43')]!=_0x94b4('0x51')){return createEndUser(_0x4ba094,_0x27dec4,_0x22af01,_0x229f45,_0x437327,_0x3b1c96);}else{return{};}});break;case _0x94b4('0x53'):_0x3e75b2[_0x94b4('0x4d')]='https://www.zohoapis.'+_0x27dec4+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x229f45+'))';return getZohoUser(_0x3e75b2,'Leads')[_0x94b4('0x28')](function(_0x1084a8){if(_0x1084a8)return _0x1084a8;if(_0x3b1c96[_0x94b4('0x43')]!=_0x94b4('0x51')){return createEndUser(_0x4ba094,_0x27dec4,_0x22af01,_0x229f45,_0x437327,_0x3b1c96);}else{return{};}});break;}}function getCall(_0x787d21,_0x4f5def,_0x3e65f7,_0x375fa9,_0x53adeb,_0x5c6eba,_0x567ca7,_0x37255d){logger[_0x94b4('0x2f')](_0x94b4('0x54'));var _0x498483={};_0x498483[_0x94b4('0x55')]={'name':!_[_0x94b4('0x1c')](_0x375fa9['role'][_0x94b4('0x18')])&&!_['isNil'](_0x375fa9['profile'][_0x94b4('0x18')])&&_0x375fa9[_0x94b4('0x38')][_0x94b4('0x18')]===_0x94b4('0x56')?_0x375fa9[_0x94b4('0x44')][_0x94b4('0x18')]:!_['isNil'](_0x375fa9[_0x94b4('0x45')])?_0x375fa9[_0x94b4('0x45')]+'\x20'+_0x375fa9['last_name']:_0x375fa9[_0x94b4('0x46')],'id':_0x375fa9['id']};_0x498483[_0x94b4('0x57')]=intUtil[_0x94b4('0x58')](_0x5c6eba['Subjects'],_0x567ca7,'\x20');_0x498483['Description']=intUtil[_0x94b4('0x58')](_0x5c6eba[_0x94b4('0x59')],_0x567ca7,'\x0a');if(_0x53adeb['enduserType']===_0x94b4('0x4f')){_0x498483[_0x94b4('0x5a')]={'name':!_['isNil'](_0x53adeb[_0x94b4('0x5b')])?_0x53adeb[_0x94b4('0x5b')]:!_[_0x94b4('0x1c')](_0x53adeb['First_Name'])?_0x53adeb[_0x94b4('0x5c')]+'\x20'+_0x53adeb['Last_Name']:_0x53adeb['Last_Name'],'id':_0x53adeb['id']};}if(_0x53adeb[_0x94b4('0x3f')]==='Leads'){_0x498483['What_Id']={'name':!_[_0x94b4('0x1c')](_0x53adeb[_0x94b4('0x5b')])?_0x53adeb['Full_Name']:!_[_0x94b4('0x1c')](_0x53adeb[_0x94b4('0x5c')])?_0x53adeb[_0x94b4('0x5c')]+'\x20'+_0x53adeb[_0x94b4('0x5d')]:_0x53adeb[_0x94b4('0x5d')],'id':_0x53adeb['id']};_0x498483['$se_module']=_['startCase'](_0x53adeb['enduserType']);}if(_0x567ca7[_0x94b4('0x5e')]){_0x498483['Call_Duration']=moment[_0x94b4('0x5f')](parseInt(_0x567ca7['talktime'])*0x3e8)[_0x94b4('0x60')]('mm:ss');}else if(_0x567ca7[_0x94b4('0x61')]&&_0x567ca7[_0x94b4('0x62')]){_0x498483[_0x94b4('0x63')]=moment['utc'](moment(_0x567ca7[_0x94b4('0x62')],_0x94b4('0x64'))[_0x94b4('0x65')](moment(_0x567ca7['starttime'],_0x94b4('0x64'))))[_0x94b4('0x60')](_0x94b4('0x66'));}switch(_0x567ca7[_0x94b4('0x67')]){case _0x94b4('0x68'):_0x498483[_0x94b4('0x69')]=_0x94b4('0x6a');break;case'complete':case _0x94b4('0x6b'):_0x498483[_0x94b4('0x69')]=_0x94b4('0x6c');break;case _0x94b4('0x6d'):_0x498483[_0x94b4('0x69')]=_0x94b4('0x6e');break;case _0x94b4('0x6f'):_0x498483['Call_Result']=_0x94b4('0x70');break;case _0x94b4('0x71'):_0x498483[_0x94b4('0x69')]=_0x94b4('0x72');default:}_0x498483['Call_Start_Time']=(_0x37255d===_0x94b4('0x73')?moment(_0x567ca7['starttime'])[_0x94b4('0x60')](_0x94b4('0x64')):moment(_0x567ca7['agentcalledAt'])[_0x94b4('0x60')](_0x94b4('0x64')))||moment()[_0x94b4('0x60')](_0x94b4('0x64'));_0x498483['Call_Type']=_0x37255d||_0x94b4('0x74');_0x498483=_[_0x94b4('0x75')](_0x498483,getCustomFields(_0x5c6eba[_0x94b4('0x76')],_0x567ca7));return request({'method':_0x94b4('0x24'),'uri':'https://www.zohoapis.'+_0x4f5def+_0x94b4('0x77'),'headers':{'Authorization':_0x94b4('0x34')+_0x787d21},'body':{'data':[_0x498483]},'json':!![]})[_0x94b4('0x28')](function(_0x5b4aa5){if(_0x5b4aa5&&_0x5b4aa5[_0x94b4('0x3e')][0x0]['code']===_0x94b4('0x47')){logger[_0x94b4('0x2f')](_0x94b4('0x78'));return{'id':_0x5b4aa5[_0x94b4('0x3e')][0x0][_0x94b4('0x48')]['id']};}})[_0x94b4('0x2b')](function(_0x45f7b5){logger[_0x94b4('0x2f')]('err',_0x45f7b5['stack']);console[_0x94b4('0x4a')](_0x94b4('0x79'),_0x45f7b5);});}exports['queue']=function(_0x47ce00,_0x442479,_0x62ce1,_0x35da0c,_0x99fc85,_0x516d80){var _0x2b735d,_0x8c1cc9,_0x2f3098;_0x516d80[_0x94b4('0x7a')]=intUtil[_0x94b4('0x7b')](_0x516d80[_0x94b4('0x7a')]);_0x516d80[_0x94b4('0x7c')]=intUtil[_0x94b4('0x7b')](_0x516d80[_0x94b4('0x7c')]);if(_0x99fc85&&_0x99fc85['monitor_format']){logger[_0x94b4('0x2f')]('[QUEUE]',_0x94b4('0x7d'));_0x442479[_0x94b4('0x7e')]=_0x516d80['serverUrl']+_0x94b4('0x7f')+_0x442479['uniqueid']+_0x94b4('0x80')+md5(_0x442479[_0x94b4('0x81')]);}else{_0x442479[_0x94b4('0x7e')]='';}var _0x100b2d=_0x516d80[_0x94b4('0x7a')]===_0x94b4('0x82')?'eu':_0x94b4('0x83');return getAccessToken(_0x516d80)[_0x94b4('0x28')](function(_0x4b967a){_0x2f3098=_0x4b967a;return getUser(_0x2f3098,_0x100b2d,_0x516d80,_0x35da0c[_0x94b4('0x84')]);})[_0x94b4('0x28')](function(_0x466d6f){_0x2b735d=_0x466d6f;logger[_0x94b4('0x2f')]('The\x20User\x20ID\x20is:',_0x2b735d['id']);return getEndUser(_0x2f3098,_0x100b2d,_0x516d80,_0x442479[_0x94b4('0x85')],_0x442479[_0x94b4('0x86')],_0x2b735d,_0x62ce1);})['then'](function(_0x5a14ce){_0x8c1cc9=_0x5a14ce;return getCall(_0x2f3098,_0x100b2d,_0x516d80,_0x2b735d,_0x8c1cc9,_0x62ce1,_0x442479,_0x94b4('0x74'));})[_0x94b4('0x28')](function(_0x49dc2d){if(_0x49dc2d){logger[_0x94b4('0x2f')]('The\x20Call\x20ID\x20is:',_0x49dc2d['id']);logger[_0x94b4('0x2f')](_0x94b4('0x87'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x94b4('0x88'),_0x35da0c['name']),_0x94b4('0x89'),{'uri':_0x94b4('0x8a')+_0x516d80[_0x94b4('0x7a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x49dc2d['id']});}})[_0x94b4('0x2b')](function(_0x5e2425){logger[_0x94b4('0x2c')](_0x94b4('0x87'),JSON['stringify'](_0x5e2425));});};exports[_0x94b4('0x73')]=function(_0x204d05,_0x39c8d1,_0x39592e,_0x3d381c,_0x5ac917,_0x3e38df,_0xdcfabd){var _0x54ff23,_0x461c88,_0x4b4948;_0x3e38df['host']=intUtil[_0x94b4('0x7b')](_0x3e38df[_0x94b4('0x7a')]);_0x3e38df['serverUrl']=intUtil[_0x94b4('0x7b')](_0x3e38df[_0x94b4('0x7c')]);if(_0xdcfabd&&_0xdcfabd[_0x94b4('0x8b')]&&_0xdcfabd[_0x94b4('0x8b')]!==_0x94b4('0x8c')){logger[_0x94b4('0x2f')](_0x94b4('0x8d'),'Recording\x20is\x20enabled!');_0x39c8d1['recordingURL']=_0x3e38df[_0x94b4('0x7c')]+_0x94b4('0x7f')+_0x39c8d1[_0x94b4('0x81')]+_0x94b4('0x80')+md5(_0x39c8d1[_0x94b4('0x81')]);}var _0x13a69b=_0x3e38df['host']===_0x94b4('0x82')?'eu':_0x94b4('0x83');return getAccessToken(_0x3e38df)[_0x94b4('0x28')](function(_0x254bf0){_0x4b4948=_0x254bf0;return getUser(_0x4b4948,_0x13a69b,_0x3e38df,_0x3d381c[_0x94b4('0x84')]);})[_0x94b4('0x28')](function(_0x4843f8){_0x54ff23=_0x4843f8;logger[_0x94b4('0x2f')](_0x94b4('0x8e'),_0x54ff23['id']);return getEndUser(_0x4b4948,_0x13a69b,_0x3e38df,_0x39c8d1[_0x94b4('0x8f')],_0x39c8d1['destcalleridnum'],_0x54ff23,_0x39592e);})[_0x94b4('0x28')](function(_0x5938cd){_0x461c88=_0x5938cd;return getCall(_0x4b4948,_0x13a69b,_0x3e38df,_0x54ff23,_0x461c88,_0x39592e,_0x39c8d1,_0x94b4('0x90'));})[_0x94b4('0x28')](function(_0x45b4f6){if(_0x45b4f6){logger[_0x94b4('0x2f')](_0x94b4('0x91'),_0x45b4f6['id']);logger[_0x94b4('0x2f')](_0x94b4('0x8d'),_0x94b4('0x92'));emit(util[_0x94b4('0x60')]('user:%s',_0x3d381c[_0x94b4('0x18')]),_0x94b4('0x89'),{'uri':'https://crm.'+_0x3e38df[_0x94b4('0x7a')]+_0x94b4('0x93')+_0x45b4f6['id']});}})['catch'](function(_0x48294c){logger[_0x94b4('0x2c')]('[OUTBOUND]',JSON[_0x94b4('0xe')](_0x48294c));});};exports[_0x94b4('0x94')]=function(_0x42f05f,_0x323334,_0xdd782a,_0x460127,_0x3a47b2,_0xe2c473){var _0x9e3d15,_0x54916c,_0x28422b;_0xe2c473[_0x94b4('0x7a')]=intUtil[_0x94b4('0x7b')](_0xe2c473['host']);_0xe2c473[_0x94b4('0x7c')]=intUtil[_0x94b4('0x7b')](_0xe2c473['serverUrl']);if(_0x3a47b2&&_0x3a47b2[_0x94b4('0x95')]){logger[_0x94b4('0x2f')]('['+_0x323334[_0x94b4('0x67')][_0x94b4('0x96')]()+']','Recording\x20is\x20enabled!');_0x323334[_0x94b4('0x7e')]=_0xe2c473[_0x94b4('0x7c')]+_0x94b4('0x7f')+_0x323334['uniqueid']+_0x94b4('0x80')+md5(_0x323334[_0x94b4('0x81')]);}else{_0x323334[_0x94b4('0x7e')]='';}var _0x1a5734=_0xe2c473['host']===_0x94b4('0x82')?'eu':'com';return getAccessToken(_0xe2c473)[_0x94b4('0x28')](function(_0x3e698b){_0x28422b=_0x3e698b;return getUser(_0x28422b,_0x1a5734,_0xe2c473);})[_0x94b4('0x28')](function(_0x2bff56){_0x9e3d15=_0x2bff56;logger['info'](_0x94b4('0x8e'),_0x9e3d15['id']);return getEndUser(_0x28422b,_0x1a5734,_0xe2c473,_0x323334['calleridname'],_0x323334[_0x94b4('0x86')],_0x9e3d15,_0xdd782a);})[_0x94b4('0x28')](function(_0x46fcdb){_0x54916c=_0x46fcdb;return getCall(_0x28422b,_0x1a5734,_0xe2c473,_0x9e3d15,_0x54916c,_0xdd782a,_0x323334,_0x94b4('0x74'));})[_0x94b4('0x28')](function(_0x37e64c){if(_0x37e64c){logger[_0x94b4('0x2f')]('The\x20Call\x20ID\x20is:',_0x37e64c['id']);}})[_0x94b4('0x2b')](function(_0x5c6017){logger[_0x94b4('0x2c')]('['+_0x323334[_0x94b4('0x67')][_0x94b4('0x96')]()+']',JSON[_0x94b4('0xe')](_0x5c6017));});}; \ No newline at end of file +var _0x301c=['toString','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','then','seconds','error','info','Search\x20user','GET','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','data','enduserType','catch','/crm/v2/','startCase','role','first_name','last_name','code','details','moduleCreate','log','CREATE\x20ERROR','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','administrator','Subject','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','format','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','stack','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','com','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','https://crm.','unmanaged','lastevent','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','debug','stringify','length','forEach','includes','string','type','idField','content'];(function(_0x2e61cc,_0x452a1c){var _0x2213f1=function(_0x2ce8a4){while(--_0x2ce8a4){_0x2e61cc['push'](_0x2e61cc['shift']());}};_0x2213f1(++_0x452a1c);}(_0x301c,0x83));var _0xc301=function(_0x41f5a6,_0xb35c51){_0x41f5a6=_0x41f5a6-0x0;var _0x241efd=_0x301c[_0x41f5a6];return _0x241efd;};'use strict';var _=require(_0xc301('0x0'));var rp=require(_0xc301('0x1'));var md5=require(_0xc301('0x2'));var util=require(_0xc301('0x3'));var intUtil=require(_0xc301('0x4'));var moment=require(_0xc301('0x5'));var Redis=require(_0xc301('0x6'));var BPromise=require(_0xc301('0x7'));var config=require(_0xc301('0x8'));var logger=require(_0xc301('0x9'))('zoho');config['redis']=_['defaults'](config[_0xc301('0xa')],{'host':_0xc301('0xb'),'port':0x18eb});var io=require(_0xc301('0xc'))(new Redis(config['redis']));function emit(_0x2d06d0,_0x1d4df4,_0x562a30){io['to'](_0x2d06d0)['emit'](_0x1d4df4,_0x562a30);}function request(_0x600abc){logger[_0xc301('0xd')]('[HTTP]',JSON[_0xc301('0xe')](_0x600abc));return rp(_0x600abc);}function getCustomFields(_0x529e85,_0x39c0b4){var _0x46a671={};if(_0x529e85[_0xc301('0xf')]>0x0){_[_0xc301('0x10')](_0x529e85,function(_0x16570e){if(_[_0xc301('0x11')]([_0xc301('0x12'),'picklist'],_0x16570e[_0xc301('0x13')])&&_0x16570e[_0xc301('0x14')]){_0x46a671[_0x16570e[_0xc301('0x14')]]=_0x16570e[_0xc301('0x15')][_0xc301('0x16')]();}else if(_0x16570e[_0xc301('0x13')]==='variable'&&_0x16570e[_0xc301('0x17')]&&_0x16570e[_0xc301('0x14')]&&_0x39c0b4[_0x16570e[_0xc301('0x17')]]){_0x46a671[_0x16570e[_0xc301('0x14')]]=_0x39c0b4[_0x16570e[_0xc301('0x17')]][_0xc301('0x16')]();}else if(_0x16570e[_0xc301('0x13')]==='customVariable'&&_0x16570e[_0xc301('0x18')]&&_0x16570e[_0xc301('0x18')][_0xc301('0x19')]&&_0x16570e['idField']&&_0x39c0b4[_0x16570e[_0xc301('0x18')][_0xc301('0x19')][_0xc301('0x1a')]()]){_0x46a671[_0x16570e[_0xc301('0x14')]]=_0x39c0b4[_0x16570e[_0xc301('0x18')][_0xc301('0x19')]['toLowerCase']()][_0xc301('0x16')]();}});}return _0x46a671;}function getName(_0x2d79c3){if(_0x2d79c3[_0xc301('0x1b')]('\x20')>0x0){var _0x17115e=_0x2d79c3[_0xc301('0x1c')](/ (.+)/);if(_0x17115e[0x1]){return _0x17115e;}}return[_0x2d79c3,_0x2d79c3];}var accountsTokens={};function getAccessToken(_0x45e247){return new Promise(function(_0x352b6e,_0x15505b){if(!_[_0xc301('0x1d')](accountsTokens[_0x45e247['id']])&&!_[_0xc301('0x1d')](accountsTokens[_0x45e247['id']][_0xc301('0x1e')])){if(moment()[_0xc301('0x1f')](accountsTokens[_0x45e247['id']][_0xc301('0x20')])){_0x352b6e(accountsTokens[_0x45e247['id']][_0xc301('0x1e')]);}}var _0x12cb14;switch(_0x45e247[_0xc301('0x21')]){case'US':_0x12cb14='https://accounts.zoho.com';break;case'AU':_0x12cb14='https://accounts.zoho.com.au';break;case'EU':_0x12cb14='https://accounts.zoho.eu';break;case'IN':_0x12cb14=_0xc301('0x22');break;case'CN':_0x12cb14=_0xc301('0x23');break;default:_0x12cb14=_0xc301('0x24');break;}var _0xb7eaba={'method':_0xc301('0x25'),'uri':_0x12cb14+_0xc301('0x26'),'qs':{'refresh_token':_0x45e247['refreshToken'],'client_id':_0x45e247[_0xc301('0x27')],'client_secret':_0x45e247[_0xc301('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xb7eaba)[_0xc301('0x29')](function(_0x128afc){accountsTokens[_0x45e247['id']]={'access_token':_0x128afc[_0xc301('0x1e')],'expires_in':moment()['add'](_0x128afc['expires_in'],_0xc301('0x2a'))};_0x352b6e(_0x128afc[_0xc301('0x1e')]);})['catch'](function(_0x43d995){logger[_0xc301('0x2b')]('Failing\x20creating\x20the\x20access_token',_0x43d995['stack']);_0x15505b(_0x43d995);});});}function getUser(_0x1111ff,_0x5b0782,_0x1f032e,_0x105a45){logger[_0xc301('0x2c')](_0xc301('0x2d'));return request({'method':_0xc301('0x2e'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x5b0782),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xc301('0x2f')+_0x1111ff},'json':!![]})['then'](function(_0x257328){if(_0x257328[_0xc301('0x30')]){var _0x10dc1e=-0x1;if(_[_0xc301('0x31')](_0x257328[_0xc301('0x30')])){if(!_[_0xc301('0x1d')](_0x105a45)){_0x10dc1e=_[_0xc301('0x32')](_0x257328[_0xc301('0x30')],function(_0x3e5117){return _0x3e5117[_0xc301('0x33')]===_0x105a45;});}if(_0x10dc1e>=0x0){logger[_0xc301('0x2c')]('Agent\x20found!');}else{logger['info'](_0xc301('0x34'));_0x10dc1e=_[_0xc301('0x32')](_0x257328['users'],function(_0x256b74){return _0x256b74[_0xc301('0x35')][_0xc301('0x19')]===_0xc301('0x36');});}return _0x257328['users'][_0x10dc1e];}else{if(_0x257328[_0xc301('0x37')][_0xc301('0x35')][_0xc301('0x19')]===_0xc301('0x36')){logger['info'](_0xc301('0x34'));user=_0x257328[_0xc301('0x37')];return user;}else{logger[_0xc301('0x2b')](_0xc301('0x38'),JSON[_0xc301('0xe')](_0x257328));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x257328));}}}else{logger[_0xc301('0x2b')](_0xc301('0x38'),JSON[_0xc301('0xe')](_0x257328));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xc301('0xe')](_0x257328));}})['catch'](function(_0x4b5c69){console[_0xc301('0x2b')](_0x4b5c69);});}function getZohoUser(_0x1903e8,_0x5c613d){return new BPromise(function(_0x216ba1,_0x1100f4){request(_0x1903e8)[_0xc301('0x29')](function(_0x56ce3f){var _0x42d975=null;if(_0x56ce3f){_0x42d975=_0x56ce3f[_0xc301('0x39')][0x0];_0x42d975[_0xc301('0x3a')]=_0x5c613d;}_0x216ba1(_0x42d975);})[_0xc301('0x3b')](function(_0x249f36){_0x1100f4(_0x249f36);});});}function createEndUser(_0x407a90,_0x19f64a,_0x4a6c2a,_0x4b6f4a,_0x2c3f98,_0x445593){var _0x4a6c2a=getName(_0x4a6c2a);return request({'method':_0xc301('0x25'),'uri':'https://www.zohoapis.'+_0x19f64a+_0xc301('0x3c')+_[_0xc301('0x3d')](_0x445593['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4a6c2a[0x1],'First_Name':_0x4a6c2a[0x0],'Phone':_0x4b6f4a,'Owner':{'name':!_[_0xc301('0x1d')](_0x2c3f98[_0xc301('0x3e')][_0xc301('0x19')])?_0x2c3f98[_0xc301('0x3e')][_0xc301('0x19')]:!_[_0xc301('0x1d')](_0x2c3f98[_0xc301('0x3f')])?_0x2c3f98['first_name']+'\x20'+_0x2c3f98['last_name']:_0x2c3f98[_0xc301('0x40')],'id':_0x2c3f98['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x407a90},'json':!![]})['then'](function(_0x9c9166){if(_0x9c9166&&_0x9c9166[_0xc301('0x39')][0x0][_0xc301('0x41')]==='SUCCESS'){var _0x354f9f=_0x9c9166[_0xc301('0x39')][0x0][_0xc301('0x42')];_0x354f9f[_0xc301('0x3a')]=_[_0xc301('0x3d')](_0x445593[_0xc301('0x43')])+'s';return _0x354f9f;}logger[_0xc301('0x2b')](_0xc301('0x38'),JSON[_0xc301('0xe')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xc301('0x3b')](function(_0x29d20f){console[_0xc301('0x44')](_0xc301('0x45'),_0x29d20f);});}function getEndUser(_0x511ccc,_0x37b967,_0x15ff14,_0x427ef8,_0x5aaea3,_0x67bd96,_0x131adb){var _0x5f412d={'method':_0xc301('0x2e'),'uri':'','headers':{'Authorization':_0xc301('0x2f')+_0x511ccc},'json':!![]};switch(_0x131adb[_0xc301('0x46')]){case _0xc301('0x47'):_0x5f412d['uri']=_0xc301('0x48')+_0x37b967+_0xc301('0x49')+_0x5aaea3+'))';return getZohoUser(_0x5f412d,_0xc301('0x4a'))[_0xc301('0x29')](function(_0x2ecb64){if(_0x2ecb64)return _0x2ecb64;_0x5f412d[_0xc301('0x4b')]=_0xc301('0x48')+_0x37b967+_0xc301('0x4c')+_0x5aaea3+'))';return getZohoUser(_0x5f412d,'Leads')[_0xc301('0x29')](function(_0x1bf272){if(_0x1bf272)return _0x1bf272;if(_0x131adb['moduleCreate']!=_0xc301('0x4d')){return createEndUser(_0x511ccc,_0x37b967,_0x427ef8,_0x5aaea3,_0x67bd96,_0x131adb);}else{return{};}});});break;case _0xc301('0x4e'):_0x5f412d[_0xc301('0x4b')]=_0xc301('0x48')+_0x37b967+_0xc301('0x49')+_0x5aaea3+'))';return getZohoUser(_0x5f412d,_0xc301('0x4a'))[_0xc301('0x29')](function(_0x553c7b){if(_0x553c7b)return _0x553c7b;if(_0x131adb['moduleCreate']!=_0xc301('0x4d')){return createEndUser(_0x511ccc,_0x37b967,_0x427ef8,_0x5aaea3,_0x67bd96,_0x131adb);}else{return{};}});break;case _0xc301('0x4f'):_0x5f412d['uri']=_0xc301('0x48')+_0x37b967+_0xc301('0x4c')+_0x5aaea3+'))';return getZohoUser(_0x5f412d,_0xc301('0x50'))[_0xc301('0x29')](function(_0x2d5243){if(_0x2d5243)return _0x2d5243;if(_0x131adb[_0xc301('0x43')]!=_0xc301('0x4d')){return createEndUser(_0x511ccc,_0x37b967,_0x427ef8,_0x5aaea3,_0x67bd96,_0x131adb);}else{return{};}});break;}}function getCall(_0xf5c2d9,_0x34828d,_0x51f043,_0x54544f,_0x264cd6,_0xa136fd,_0x41c0f4,_0x9be2de){logger['info'](_0xc301('0x51'));var _0x174ac6={};_0x174ac6['Owner']={'name':!_['isNil'](_0x54544f[_0xc301('0x3e')][_0xc301('0x19')])&&!_['isNil'](_0x54544f[_0xc301('0x35')]['name'])&&_0x54544f['profile'][_0xc301('0x19')]===_0xc301('0x52')?_0x54544f[_0xc301('0x3e')][_0xc301('0x19')]:!_[_0xc301('0x1d')](_0x54544f[_0xc301('0x3f')])?_0x54544f[_0xc301('0x3f')]+'\x20'+_0x54544f[_0xc301('0x40')]:_0x54544f[_0xc301('0x40')],'id':_0x54544f['id']};_0x174ac6[_0xc301('0x53')]=intUtil['getString'](_0xa136fd['Subjects'],_0x41c0f4,'\x20');_0x174ac6[_0xc301('0x54')]=intUtil[_0xc301('0x55')](_0xa136fd[_0xc301('0x56')],_0x41c0f4,'\x0a');if(_0x264cd6[_0xc301('0x3a')]===_0xc301('0x4a')){_0x174ac6[_0xc301('0x57')]={'name':!_[_0xc301('0x1d')](_0x264cd6[_0xc301('0x58')])?_0x264cd6[_0xc301('0x58')]:!_['isNil'](_0x264cd6[_0xc301('0x59')])?_0x264cd6['First_Name']+'\x20'+_0x264cd6[_0xc301('0x5a')]:_0x264cd6[_0xc301('0x5a')],'id':_0x264cd6['id']};}if(_0x264cd6[_0xc301('0x3a')]===_0xc301('0x50')){_0x174ac6[_0xc301('0x5b')]={'name':!_['isNil'](_0x264cd6[_0xc301('0x58')])?_0x264cd6[_0xc301('0x58')]:!_['isNil'](_0x264cd6[_0xc301('0x59')])?_0x264cd6[_0xc301('0x59')]+'\x20'+_0x264cd6[_0xc301('0x5a')]:_0x264cd6[_0xc301('0x5a')],'id':_0x264cd6['id']};_0x174ac6[_0xc301('0x5c')]=_[_0xc301('0x3d')](_0x264cd6[_0xc301('0x3a')]);}if(_0x41c0f4[_0xc301('0x5d')]){_0x174ac6[_0xc301('0x5e')]=moment['utc'](parseInt(_0x41c0f4[_0xc301('0x5d')])*0x3e8)[_0xc301('0x5f')](_0xc301('0x60'));}else if(_0x41c0f4[_0xc301('0x61')]&&_0x41c0f4[_0xc301('0x62')]){_0x174ac6[_0xc301('0x5e')]=moment[_0xc301('0x63')](moment(_0x41c0f4[_0xc301('0x62')],_0xc301('0x64'))[_0xc301('0x65')](moment(_0x41c0f4[_0xc301('0x66')],_0xc301('0x64'))))[_0xc301('0x5f')]('mm:ss');}switch(_0x41c0f4['lastevent']){case _0xc301('0x67'):_0x174ac6[_0xc301('0x68')]=_0xc301('0x69');break;case _0xc301('0x6a'):case'connect':_0x174ac6[_0xc301('0x68')]=_0xc301('0x6b');break;case _0xc301('0x6c'):_0x174ac6['Call_Result']=_0xc301('0x6d');break;case _0xc301('0x6e'):_0x174ac6[_0xc301('0x68')]=_0xc301('0x6f');break;case _0xc301('0x70'):_0x174ac6['Call_Result']=_0xc301('0x71');default:}_0x174ac6[_0xc301('0x72')]=(_0x9be2de===_0xc301('0x73')?moment(_0x41c0f4[_0xc301('0x66')])['format'](_0xc301('0x64')):moment(_0x41c0f4[_0xc301('0x74')])[_0xc301('0x5f')](_0xc301('0x64')))||moment()[_0xc301('0x5f')](_0xc301('0x64'));_0x174ac6[_0xc301('0x75')]=_0x9be2de||_0xc301('0x76');_0x174ac6=_[_0xc301('0x77')](_0x174ac6,getCustomFields(_0xa136fd[_0xc301('0x78')],_0x41c0f4));return request({'method':_0xc301('0x25'),'uri':_0xc301('0x48')+_0x34828d+_0xc301('0x79'),'headers':{'Authorization':_0xc301('0x2f')+_0xf5c2d9},'body':{'data':[_0x174ac6]},'json':!![]})[_0xc301('0x29')](function(_0x8ebe9b){if(_0x8ebe9b&&_0x8ebe9b['data'][0x0][_0xc301('0x41')]===_0xc301('0x7a')){logger[_0xc301('0x2c')](_0xc301('0x7b'));return{'id':_0x8ebe9b[_0xc301('0x39')][0x0][_0xc301('0x42')]['id']};}})[_0xc301('0x3b')](function(_0x41b78a){logger[_0xc301('0x2c')]('err',_0x41b78a[_0xc301('0x7c')]);console[_0xc301('0x44')]('err',_0x41b78a);});}exports[_0xc301('0x7d')]=function(_0x21a573,_0x3fe35c,_0x21c35e,_0xfc0a32,_0x456497,_0x487018){var _0xd4ee7,_0x2380be,_0x5a041a;_0x487018[_0xc301('0x7e')]=intUtil[_0xc301('0x7f')](_0x487018[_0xc301('0x7e')]);_0x487018[_0xc301('0x80')]=intUtil[_0xc301('0x7f')](_0x487018[_0xc301('0x80')]);if(_0x456497&&_0x456497['monitor_format']){logger[_0xc301('0x2c')](_0xc301('0x81'),_0xc301('0x82'));_0x3fe35c['recordingURL']=_0x487018[_0xc301('0x80')]+_0xc301('0x83')+_0x3fe35c[_0xc301('0x84')]+_0xc301('0x85')+md5(_0x3fe35c['uniqueid']);}else{_0x3fe35c[_0xc301('0x86')]='';}var _0x4519e4=_0x487018['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x487018)['then'](function(_0x37a48c){_0x5a041a=_0x37a48c;return getUser(_0x5a041a,_0x4519e4,_0x487018,_0xfc0a32[_0xc301('0x33')]);})[_0xc301('0x29')](function(_0x539deb){_0xd4ee7=_0x539deb;logger['info'](_0xc301('0x87'),_0xd4ee7['id']);return getEndUser(_0x5a041a,_0x4519e4,_0x487018,_0x3fe35c[_0xc301('0x88')],_0x3fe35c[_0xc301('0x89')],_0xd4ee7,_0x21c35e);})[_0xc301('0x29')](function(_0x43dedb){_0x2380be=_0x43dedb;return getCall(_0x5a041a,_0x4519e4,_0x487018,_0xd4ee7,_0x2380be,_0x21c35e,_0x3fe35c,_0xc301('0x76'));})[_0xc301('0x29')](function(_0xeb0e23){if(_0xeb0e23){logger[_0xc301('0x2c')](_0xc301('0x8a'),_0xeb0e23['id']);logger[_0xc301('0x2c')](_0xc301('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc301('0x5f')](_0xc301('0x8b'),_0xfc0a32[_0xc301('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x487018[_0xc301('0x7e')]+_0xc301('0x8c')+_0xeb0e23['id']});}})[_0xc301('0x3b')](function(_0x11ede3){logger['error'](_0xc301('0x81'),JSON[_0xc301('0xe')](_0x11ede3));});};exports['outbound']=function(_0x2cae61,_0x490ccf,_0x56c868,_0x3d96ce,_0x19ee90,_0x40a971,_0x172e32){var _0x4d9d06,_0x4c29fe,_0x5e0492;_0x40a971['host']=intUtil['stripTrailingSlash'](_0x40a971[_0xc301('0x7e')]);_0x40a971[_0xc301('0x80')]=intUtil['stripTrailingSlash'](_0x40a971[_0xc301('0x80')]);if(_0x172e32&&_0x172e32[_0xc301('0x8d')]&&_0x172e32[_0xc301('0x8d')]!==_0xc301('0x8e')){logger[_0xc301('0x2c')](_0xc301('0x8f'),_0xc301('0x82'));_0x490ccf[_0xc301('0x86')]=_0x40a971['serverUrl']+_0xc301('0x83')+_0x490ccf['uniqueid']+_0xc301('0x85')+md5(_0x490ccf[_0xc301('0x84')]);}var _0x17506b=_0x40a971[_0xc301('0x7e')]===_0xc301('0x90')?'eu':_0xc301('0x91');return getAccessToken(_0x40a971)['then'](function(_0x5c14a5){_0x5e0492=_0x5c14a5;return getUser(_0x5e0492,_0x17506b,_0x40a971,_0x3d96ce[_0xc301('0x33')]);})[_0xc301('0x29')](function(_0x3b2fc0){_0x4d9d06=_0x3b2fc0;logger['info'](_0xc301('0x87'),_0x4d9d06['id']);return getEndUser(_0x5e0492,_0x17506b,_0x40a971,_0x490ccf[_0xc301('0x92')],_0x490ccf[_0xc301('0x93')],_0x4d9d06,_0x56c868);})[_0xc301('0x29')](function(_0x5b2595){_0x4c29fe=_0x5b2595;return getCall(_0x5e0492,_0x17506b,_0x40a971,_0x4d9d06,_0x4c29fe,_0x56c868,_0x490ccf,_0xc301('0x94'));})[_0xc301('0x29')](function(_0xfb0921){if(_0xfb0921){logger['info'](_0xc301('0x8a'),_0xfb0921['id']);logger[_0xc301('0x2c')](_0xc301('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc301('0x5f')](_0xc301('0x8b'),_0x3d96ce['name']),_0xc301('0x95'),{'uri':_0xc301('0x96')+_0x40a971['host']+_0xc301('0x8c')+_0xfb0921['id']});}})['catch'](function(_0x4e4762){logger[_0xc301('0x2b')]('[OUTBOUND]',JSON[_0xc301('0xe')](_0x4e4762));});};exports[_0xc301('0x97')]=function(_0x501c1b,_0xac8508,_0x451c6a,_0x1652da,_0x36df82,_0x37b24f){var _0x2e0aab,_0x3334a2,_0x335fb4;_0x37b24f[_0xc301('0x7e')]=intUtil[_0xc301('0x7f')](_0x37b24f[_0xc301('0x7e')]);_0x37b24f[_0xc301('0x80')]=intUtil[_0xc301('0x7f')](_0x37b24f[_0xc301('0x80')]);if(_0x36df82&&_0x36df82['monitor_format']){logger['info']('['+_0xac8508['lastevent']['toUpperCase']()+']',_0xc301('0x82'));_0xac8508[_0xc301('0x86')]=_0x37b24f[_0xc301('0x80')]+_0xc301('0x83')+_0xac8508[_0xc301('0x84')]+_0xc301('0x85')+md5(_0xac8508[_0xc301('0x84')]);}else{_0xac8508[_0xc301('0x86')]='';}var _0x4e03fa=_0x37b24f[_0xc301('0x7e')]===_0xc301('0x90')?'eu':_0xc301('0x91');return getAccessToken(_0x37b24f)[_0xc301('0x29')](function(_0x24ce43){_0x335fb4=_0x24ce43;return getUser(_0x335fb4,_0x4e03fa,_0x37b24f);})[_0xc301('0x29')](function(_0x4195e3){_0x2e0aab=_0x4195e3;logger[_0xc301('0x2c')](_0xc301('0x87'),_0x2e0aab['id']);return getEndUser(_0x335fb4,_0x4e03fa,_0x37b24f,_0xac8508[_0xc301('0x88')],_0xac8508['calleridnum'],_0x2e0aab,_0x451c6a);})[_0xc301('0x29')](function(_0x2c1ba0){_0x3334a2=_0x2c1ba0;return getCall(_0x335fb4,_0x4e03fa,_0x37b24f,_0x2e0aab,_0x3334a2,_0x451c6a,_0xac8508,_0xc301('0x76'));})[_0xc301('0x29')](function(_0x264c40){if(_0x264c40){logger[_0xc301('0x2c')](_0xc301('0x8a'),_0x264c40['id']);}})[_0xc301('0x3b')](function(_0x5a1fe7){logger[_0xc301('0x2b')]('['+_0xac8508[_0xc301('0x98')]['toUpperCase']()+']',JSON[_0xc301('0xe')](_0x5a1fe7));});}; \ 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 4e9608d..deb2b8b 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 _0xcf09=['util','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf09,0x12c));var _0x9cf0=function(_0x1e610d,_0x515c0f){_0x1e610d=_0x1e610d-0x0;var _0x8d41b8=_0xcf09[_0x1e610d];return _0x8d41b8;};'use strict';var util=require(_0x9cf0('0x0'));var sh=require(_0x9cf0('0x1'));var Mustache=require(_0x9cf0('0x2'));var logger=require(_0x9cf0('0x3'))(_0x9cf0('0x4'));exports['exec']=function(_0x50e77b,_0x515e2a){var _0x56c782=_0x50e77b[_0x9cf0('0x5')]?_0x50e77b[_0x9cf0('0x5')]:_0x9cf0('0x6');var _0x6ec5af=_0x50e77b[_0x9cf0('0x7')]?Mustache[_0x9cf0('0x8')](_0x50e77b['data3'],_0x515e2a):_0x515e2a;sh[_0x9cf0('0x9')](_0x6ec5af,function(_0x414ff3,_0x1faf13,_0x2ceacb){if(_0x414ff3!==0x0){logger[_0x9cf0('0xa')](util[_0x9cf0('0xb')](_0x9cf0('0xc'),_0x56c782,_0x6ec5af,_0x414ff3,_0x2ceacb));}else{logger[_0x9cf0('0xd')](util[_0x9cf0('0xb')](_0x9cf0('0xe'),_0x56c782,_0x6ec5af,_0x1faf13));}});}; \ No newline at end of file +var _0x6f8a=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','../../../../config/logger','trigger','exec','Script','data3','render','format'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6f8a,0x110));var _0xa6f8=function(_0x6ca254,_0x41ffcf){_0x6ca254=_0x6ca254-0x0;var _0x39ea65=_0x6f8a[_0x6ca254];return _0x39ea65;};'use strict';var util=require(_0xa6f8('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0xa6f8('0x1'))(_0xa6f8('0x2'));exports[_0xa6f8('0x3')]=function(_0x39972c,_0x24f455){var _0x230e7e=_0x39972c['data2']?_0x39972c['data2']:_0xa6f8('0x4');var _0x311c99=_0x39972c[_0xa6f8('0x5')]?Mustache[_0xa6f8('0x6')](_0x39972c[_0xa6f8('0x5')],_0x24f455):_0x24f455;sh[_0xa6f8('0x3')](_0x311c99,function(_0x599c3f,_0x320f69,_0x1b8857){if(_0x599c3f!==0x0){logger['error'](util[_0xa6f8('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x230e7e,_0x311c99,_0x599c3f,_0x1b8857));}else{logger[_0xa6f8('0x8')](util[_0xa6f8('0x7')](_0xa6f8('0x9'),_0x230e7e,_0x311c99,_0x320f69));}});}; \ 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 69d9d20..cb7f256 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 _0x5f1f=['stringify',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','mustache','trigger','data1','toUpperCase','data2','number','data5','headers','data6','parse','render','stack','DELETE','PUT','data7','error','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f1f,0xe2));var _0xf5f1=function(_0x13c12b,_0x4baa0d){_0x13c12b=_0x13c12b-0x0;var _0x4fcf37=_0x5f1f[_0x13c12b];return _0x4fcf37;};'use strict';var rp=require(_0xf5f1('0x0'));var util=require(_0xf5f1('0x1'));var _=require(_0xf5f1('0x2'));var Mustache=require(_0xf5f1('0x3'));var logger=require('../../../../config/logger')(_0xf5f1('0x4'));exports['exec']=function(_0xb5d1e6,_0xe8a695){var _0x100c10,_0xd79dcd;var _0x10e82a={'method':_0xb5d1e6[_0xf5f1('0x5')][_0xf5f1('0x6')](),'uri':Mustache['render'](_0xb5d1e6[_0xf5f1('0x7')],_0xe8a695),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xb5d1e6['data5'])===_0xf5f1('0x8')&&parseInt(_0xb5d1e6[_0xf5f1('0x9')])>=0x1&&parseInt(_0xb5d1e6[_0xf5f1('0x9')])<=0xa?parseInt(_0xb5d1e6[_0xf5f1('0x9')])*0x3e8:0x5*0x3e8};try{_0x10e82a[_0xf5f1('0xa')]=_0xb5d1e6[_0xf5f1('0xb')]?JSON[_0xf5f1('0xc')](Mustache[_0xf5f1('0xd')](_0xb5d1e6[_0xf5f1('0xb')],_0xe8a695)):{};}catch(_0x249679){logger['error'](_0x249679[_0xf5f1('0xe')]);}switch(_0xb5d1e6[_0xf5f1('0x5')][_0xf5f1('0x6')]()){case'GET':case _0xf5f1('0xf'):_0x100c10=null;_0x10e82a['qs']=_0xe8a695;break;case'POST':case _0xf5f1('0x10'):if(_0xb5d1e6[_0xf5f1('0x11')]){try{_0x100c10=JSON['parse'](Mustache['render'](_0xb5d1e6['data7'],_0xe8a695));_0x10e82a['body']=_0x100c10;}catch(_0x1a3c1d){logger['error'](_0x1a3c1d[_0xf5f1('0xe')]);logger[_0xf5f1('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x100c10=_0xe8a695;_0x10e82a[_0xf5f1('0x13')]=_0x100c10;}break;}logger[_0xf5f1('0x14')](util['format'](_0xf5f1('0x15'),_0xb5d1e6[_0xf5f1('0x5')],_0xb5d1e6['data2'],JSON[_0xf5f1('0x16')](_0x10e82a)));rp(_0x10e82a)['then'](function(_0x3fa066){_0x100c10=!_['isNil'](_0x100c10)?_0xf5f1('0x17')+_0x100c10:'';_0xd79dcd=typeof _0x3fa066[_0xf5f1('0x13')]===_0xf5f1('0x18')?JSON[_0xf5f1('0x16')](_0x3fa066[_0xf5f1('0x13')]):_0x3fa066[_0xf5f1('0x13')];logger[_0xf5f1('0x14')](util[_0xf5f1('0x19')](_0xf5f1('0x1a'),_0xb5d1e6[_0xf5f1('0x5')],_0xb5d1e6[_0xf5f1('0x7')],_0x3fa066[_0xf5f1('0x1b')],_0xd79dcd));})[_0xf5f1('0x1c')](function(_0x5cf1b1){logger[_0xf5f1('0x12')](util[_0xf5f1('0x19')](_0xf5f1('0x1d'),_0xb5d1e6[_0xf5f1('0x5')],_0xb5d1e6[_0xf5f1('0x7')],_0x5cf1b1[_0xf5f1('0x1b')],_0x5cf1b1[_0xf5f1('0x1e')],_0x5cf1b1['message']));});}; \ No newline at end of file +var _0x29b5=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','info','format','catch','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','data2','data5','number','headers','data6','render','error','stack','GET','DELETE','POST','data7'];(function(_0x2ab4c5,_0x278fff){var _0x2442ff=function(_0x405765){while(--_0x405765){_0x2ab4c5['push'](_0x2ab4c5['shift']());}};_0x2442ff(++_0x278fff);}(_0x29b5,0xfc));var _0x529b=function(_0x413264,_0x7c2908){_0x413264=_0x413264-0x0;var _0x1d44a0=_0x29b5[_0x413264];return _0x1d44a0;};'use strict';var rp=require(_0x529b('0x0'));var util=require(_0x529b('0x1'));var _=require(_0x529b('0x2'));var Mustache=require(_0x529b('0x3'));var logger=require(_0x529b('0x4'))(_0x529b('0x5'));exports[_0x529b('0x6')]=function(_0x5bdefe,_0xa4b6b){var _0x191305,_0x23736d;var _0x40e790={'method':_0x5bdefe[_0x529b('0x7')]['toUpperCase'](),'uri':Mustache['render'](_0x5bdefe[_0x529b('0x8')],_0xa4b6b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5bdefe[_0x529b('0x9')])===_0x529b('0xa')&&parseInt(_0x5bdefe[_0x529b('0x9')])>=0x1&&parseInt(_0x5bdefe[_0x529b('0x9')])<=0xa?parseInt(_0x5bdefe['data5'])*0x3e8:0x5*0x3e8};try{_0x40e790[_0x529b('0xb')]=_0x5bdefe[_0x529b('0xc')]?JSON['parse'](Mustache[_0x529b('0xd')](_0x5bdefe[_0x529b('0xc')],_0xa4b6b)):{};}catch(_0x17e713){logger[_0x529b('0xe')](_0x17e713[_0x529b('0xf')]);}switch(_0x5bdefe['data1']['toUpperCase']()){case _0x529b('0x10'):case _0x529b('0x11'):_0x191305=null;_0x40e790['qs']=_0xa4b6b;break;case _0x529b('0x12'):case'PUT':if(_0x5bdefe[_0x529b('0x13')]){try{_0x191305=JSON['parse'](Mustache[_0x529b('0xd')](_0x5bdefe[_0x529b('0x13')],_0xa4b6b));_0x40e790['body']=_0x191305;}catch(_0xe2bdc1){logger['error'](_0xe2bdc1['stack']);logger['error'](_0x529b('0x14'));}}else{_0x191305=_0xa4b6b;_0x40e790[_0x529b('0x15')]=_0x191305;}break;}logger['info'](util['format'](_0x529b('0x16'),_0x5bdefe['data1'],_0x5bdefe['data2'],JSON[_0x529b('0x17')](_0x40e790)));rp(_0x40e790)[_0x529b('0x18')](function(_0x4d2cca){_0x191305=!_[_0x529b('0x19')](_0x191305)?_0x529b('0x1a')+_0x191305:'';_0x23736d=typeof _0x4d2cca[_0x529b('0x15')]===_0x529b('0x1b')?JSON[_0x529b('0x17')](_0x4d2cca[_0x529b('0x15')]):_0x4d2cca['body'];logger[_0x529b('0x1c')](util[_0x529b('0x1d')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x5bdefe[_0x529b('0x7')],_0x5bdefe['data2'],_0x4d2cca['statusCode'],_0x23736d));})[_0x529b('0x1e')](function(_0x1ce7f6){logger['error'](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5bdefe['data1'],_0x5bdefe[_0x529b('0x8')],_0x1ce7f6[_0x529b('0x1f')],_0x1ce7f6[_0x529b('0x20')],_0x1ce7f6[_0x529b('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9b2942a..aef1b76 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 _0xeb59=['result','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','then','debug','rpc','error','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xeb59,0x136));var _0x9eb5=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0xeb59[_0x4169d8];return _0x32084a;};'use strict';var jayson=require(_0x9eb5('0x0'));var BPromise=require(_0x9eb5('0x1'));var logger=require(_0x9eb5('0x2'))(_0x9eb5('0x3'));var client=jayson[_0x9eb5('0x4')]['http']({'port':0x2329});client[_0x9eb5('0x5')]=function(_0xaabcbf,_0x25b49d){return new BPromise(function(_0x809cfc,_0x29cfb6){return client[_0x9eb5('0x6')](_0xaabcbf,_0x25b49d)[_0x9eb5('0x7')](function(_0x575ed7){logger[_0x9eb5('0x8')](_0x9eb5('0x9'),_0x9eb5('0x3'),_0xaabcbf,_0x25b49d,_0x575ed7);if(_0x575ed7[_0x9eb5('0xa')]){logger[_0x9eb5('0xa')]('rpc',_0x9eb5('0x3'),_0xaabcbf,_0x575ed7[_0x9eb5('0xa')][_0x9eb5('0xb')],_0x25b49d);return _0x29cfb6(_0x575ed7['error']['message']);}else{return _0x809cfc(_0x575ed7[_0x9eb5('0xc')]);}})['catch'](function(_0x5e9195){logger[_0x9eb5('0xa')](_0x9eb5('0x9'),'routing',_0xaabcbf,_0x5e9195,_0x25b49d);return _0x29cfb6(_0x5e9195);});});};module[_0x9eb5('0xd')]=client; \ No newline at end of file +var _0x8b50=['routing','error','rpc','message','result','catch','exports','jayson/promise','../../config/logger','http','Request','request','then','debug'];(function(_0x44af8d,_0x16c3c8){var _0x5c00a5=function(_0xda1e12){while(--_0xda1e12){_0x44af8d['push'](_0x44af8d['shift']());}};_0x5c00a5(++_0x16c3c8);}(_0x8b50,0x103));var _0x08b5=function(_0x4ecae0,_0x9ab74a){_0x4ecae0=_0x4ecae0-0x0;var _0x4daa62=_0x8b50[_0x4ecae0];return _0x4daa62;};'use strict';var jayson=require(_0x08b5('0x0'));var BPromise=require('bluebird');var logger=require(_0x08b5('0x1'))('routing');var client=jayson['client'][_0x08b5('0x2')]({'port':0x2329});client[_0x08b5('0x3')]=function(_0x4e2ab4,_0x5bffd3){return new BPromise(function(_0x134039,_0x3e8fcc){return client[_0x08b5('0x4')](_0x4e2ab4,_0x5bffd3)[_0x08b5('0x5')](function(_0x2d7f4a){logger[_0x08b5('0x6')]('rpc',_0x08b5('0x7'),_0x4e2ab4,_0x5bffd3,_0x2d7f4a);if(_0x2d7f4a[_0x08b5('0x8')]){logger[_0x08b5('0x8')](_0x08b5('0x9'),'routing',_0x4e2ab4,_0x2d7f4a[_0x08b5('0x8')][_0x08b5('0xa')],_0x5bffd3);return _0x3e8fcc(_0x2d7f4a[_0x08b5('0x8')][_0x08b5('0xa')]);}else{return _0x134039(_0x2d7f4a[_0x08b5('0xb')]);}})[_0x08b5('0xc')](function(_0x9ca481){logger[_0x08b5('0x8')](_0x08b5('0x9'),_0x08b5('0x7'),_0x4e2ab4,_0x9ca481,_0x5bffd3);return _0x3e8fcc(_0x9ca481);});});};module[_0x08b5('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 3f346ac..0945b57 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 _0x743e=['then','listen','getSettings','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve'];(function(_0x5b8424,_0x1ef569){var _0x23f6ca=function(_0x278c8b){while(--_0x278c8b){_0x5b8424['push'](_0x5b8424['shift']());}};_0x23f6ca(++_0x1ef569);}(_0x743e,0x1c1));var _0xe743=function(_0x1badba,_0x595664){_0x1badba=_0x1badba-0x0;var _0x18f5a3=_0x743e[_0x1badba];return _0x18f5a3;};'use strict';var BPromise=require(_0xe743('0x0'));var server=require(_0xe743('0x1'));var Realtime=require(_0xe743('0x2'));var EmailChannel=require(_0xe743('0x3'));var mailAccount=require(_0xe743('0x4'));var setting=require(_0xe743('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xe743('0x6')]()[_0xe743('0x7')](mailAccount['getMailAccounts']())[_0xe743('0x7')](realtime['initMailAccounts']())[_0xe743('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xe743('0x8')](realtime,email)[_0xe743('0x7')](function(){return initRealtime();})[_0xe743('0x7')](function(){return setting[_0xe743('0x9')]();})['then'](function(_0x3bd909){return setInterval(initRealtime,_0x3bd909[_0xe743('0xa')]*0x3e8);})['catch'](function(_0x379b89){console[_0xe743('0xb')](_0x379b89);});}main(); \ No newline at end of file +var _0xa688=['./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x46ba68,_0x201ad1){var _0x52f03a=function(_0x2d8842){while(--_0x2d8842){_0x46ba68['push'](_0x46ba68['shift']());}};_0x52f03a(++_0x201ad1);}(_0xa688,0x1f4));var _0x8a68=function(_0x494c6f,_0x54dbe7){_0x494c6f=_0x494c6f-0x0;var _0x4c9c08=_0xa688[_0x494c6f];return _0x4c9c08;};'use strict';var BPromise=require('bluebird');var server=require(_0x8a68('0x0'));var Realtime=require(_0x8a68('0x1'));var EmailChannel=require(_0x8a68('0x2'));var mailAccount=require(_0x8a68('0x3'));var setting=require(_0x8a68('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x8a68('0x5')]()[_0x8a68('0x6')](mailAccount[_0x8a68('0x7')]())['then'](realtime[_0x8a68('0x8')]())[_0x8a68('0x6')](function(){email['refresh'](realtime[_0x8a68('0x9')]);return realtime;});}function main(){return server[_0x8a68('0xa')](realtime,email)[_0x8a68('0x6')](function(){return initRealtime();})[_0x8a68('0x6')](function(){return setting[_0x8a68('0xb')]();})['then'](function(_0x529d5e){return setInterval(initRealtime,_0x529d5e[_0x8a68('0xc')]*0x3e8);})[_0x8a68('0xd')](function(_0x3f47a7){console['log'](_0x3f47a7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 818e486..d916130 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 _0x5b38=['redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','active','Imap','status','messageStatus','total','isNil','prototype','refresh','hasOwnProperty','box','bind','end','handleImapEnd','error','handleImapError','handleImapBox','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','verify','exports','moment','bluebird','md5','ioredis','email','defaults'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5b38,0x64));var _0x85b3=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x5b38[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require('lodash');var moment=require(_0x85b3('0x0'));var BPromise=require(_0x85b3('0x1'));var md5=require(_0x85b3('0x2'));var Redis=require(_0x85b3('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x85b3('0x4'));config['redis']=_[_0x85b3('0x5')](config[_0x85b3('0x6')],{'host':_0x85b3('0x7'),'port':0x18eb});var io=require(_0x85b3('0x8'))(new Redis(config[_0x85b3('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x85b3('0x9'));var mailAccount=require(_0x85b3('0xa'));var md5Accounts={};function EmailChannel(_0x56f500){logger['info'](_0x85b3('0xb'));this[_0x85b3('0xc')]=_0x56f500[_0x85b3('0xc')];this[_0x85b3('0xd')]={};this[_0x85b3('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x85b3('0xf')]=function(_0x2405a4){var _0x13a03b=this['mailAccounts'][_0x2405a4];var _0x4747eb={'id':_0x13a03b['id'],'name':_0x13a03b[_0x85b3('0x10')],'key':_0x13a03b['key'],'active':_0x13a03b[_0x85b3('0x11')],'Imap':{'status':_0x13a03b[_0x85b3('0x12')][_0x85b3('0x13')],'messageStatus':_0x13a03b['Imap'][_0x85b3('0x14')],'total':_0x13a03b['Imap'][_0x85b3('0x15')]}};if(_[_0x85b3('0x16')](md5Accounts[_0x2405a4])){md5Accounts[_0x2405a4]={};}var _0xdfe6=md5(JSON['stringify'](_0x4747eb));if(md5Accounts[_0x2405a4][_0x85b3('0x2')]!==_0xdfe6){md5Accounts[_0x2405a4][_0x85b3('0x2')]=_0xdfe6;io['emit']('mailAccount:update',_0x4747eb);}};EmailChannel[_0x85b3('0x17')][_0x85b3('0x18')]=function(_0x3c2a1d){for(var _0x10e7e2 in _0x3c2a1d){if(_0x3c2a1d[_0x85b3('0x19')](_0x10e7e2)){if(_0x3c2a1d[_0x10e7e2]['Imap']&&_0x3c2a1d[_0x10e7e2][_0x85b3('0x11')]){var _0x694a1b=_0x3c2a1d[_0x10e7e2][_0x85b3('0x12')];if(!this['imapAccounts']['hasOwnProperty'](_0x694a1b['id'])){this[_0x85b3('0xd')][_0x694a1b['id']]=new EmailImap(_0x694a1b,_0x3c2a1d[_0x10e7e2][_0x85b3('0x4')]);this[_0x85b3('0xd')][_0x694a1b['id']]['on'](_0x85b3('0x1a'),this['handleImapBox']['bind'](this,_0x10e7e2));this[_0x85b3('0xd')][_0x694a1b['id']]['on'](_0x85b3('0x4'),this['handleImapEmail'][_0x85b3('0x1b')](this,_0x10e7e2));this['imapAccounts'][_0x694a1b['id']]['on'](_0x85b3('0x1c'),this[_0x85b3('0x1d')]['bind'](this,_0x10e7e2));this[_0x85b3('0xd')][_0x694a1b['id']]['on'](_0x85b3('0x1e'),this[_0x85b3('0x1f')][_0x85b3('0x1b')](this,_0x10e7e2));}}else{if(_['isNil'](this[_0x85b3('0xc')][_0x10e7e2][_0x85b3('0x12')])){this[_0x85b3('0xc')][_0x10e7e2][_0x85b3('0x12')]={};}this[_0x85b3('0xc')][_0x10e7e2][_0x85b3('0x12')][_0x85b3('0x13')]='disabled';this[_0x85b3('0xc')][_0x10e7e2][_0x85b3('0x12')][_0x85b3('0x14')]='';this['emit'](_0x10e7e2);}}}};EmailChannel[_0x85b3('0x17')][_0x85b3('0x20')]=function(_0x508e95,_0x382edc){if(this['mailAccounts'][_0x508e95]){this[_0x85b3('0xc')][_0x508e95][_0x85b3('0x12')][_0x85b3('0x13')]=_0x85b3('0x21');this['mailAccounts'][_0x508e95]['Imap']['messageStatus']=_0x382edc[_0x85b3('0x10')];if(_0x382edc[_0x85b3('0x22')]){this['mailAccounts'][_0x508e95][_0x85b3('0x12')]['total']=_0x382edc[_0x85b3('0x22')][_0x85b3('0x15')];}return this['emit'](_0x508e95);}};EmailChannel[_0x85b3('0x17')][_0x85b3('0x23')]=function(_0x14387,_0x2756c4){logger[_0x85b3('0x24')](_0x85b3('0x25'),_0x2756c4[_0x85b3('0x26')],_0x2756c4[_0x85b3('0x27')],_0x2756c4[_0x85b3('0x28')],_0x14387);if(this[_0x85b3('0xc')][_0x14387]){return mailAccount[_0x85b3('0x29')](_0x14387,_0x2756c4)[_0x85b3('0x2a')](function(_0x144969){if(_0x144969){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x85b3('0x2b')](function(_0x1412bc){logger[_0x85b3('0x1e')](_0x85b3('0x2c'),JSON['stringify'](_0x1412bc));});}};EmailChannel[_0x85b3('0x17')]['handleImapEnd']=function(_0x4dec01){if(this[_0x85b3('0xc')][_0x4dec01]&&this[_0x85b3('0xc')][_0x4dec01][_0x85b3('0x12')]){if(this['imapAccounts'][this['mailAccounts'][_0x4dec01][_0x85b3('0x12')]['id']]){delete this[_0x85b3('0xd')][this[_0x85b3('0xc')][_0x4dec01][_0x85b3('0x12')]['id']];}this[_0x85b3('0xc')][_0x4dec01][_0x85b3('0x12')][_0x85b3('0x2d')]=moment();this[_0x85b3('0xf')](_0x4dec01);}};EmailChannel[_0x85b3('0x17')][_0x85b3('0x1f')]=function(_0x3deae9,_0x48e03e){if(this[_0x85b3('0xc')][_0x3deae9]){this[_0x85b3('0xc')][_0x3deae9][_0x85b3('0x12')][_0x85b3('0x13')]=_0x85b3('0x1e');this[_0x85b3('0xc')][_0x3deae9]['Imap']['messageStatus']=_0x48e03e;return this[_0x85b3('0xf')](_0x3deae9);}};EmailChannel[_0x85b3('0x17')][_0x85b3('0x2e')]=function(_0x23fddd,_0x32d0de){return this[_0x85b3('0xe')][_0x85b3('0x2f')](_0x23fddd,_0x32d0de);};EmailChannel['prototype'][_0x85b3('0x30')]=function(_0x25a21f){var _0x5db8e2=this;if(this[_0x85b3('0xc')][_0x25a21f['id']]){if(_['isNil'](this[_0x85b3('0xc')][_0x25a21f['id']][_0x85b3('0x31')])){this[_0x85b3('0xc')][_0x25a21f['id']][_0x85b3('0x31')]={};}this[_0x85b3('0xc')][_0x25a21f['id']]['Smtp'][_0x85b3('0x2d')]=moment();return new BPromise(function(_0x2c3fe8,_0x25a403){return _0x5db8e2['smtp']['verify'](_0x25a21f)['then'](function(_0x1d81a9){_0x5db8e2['mailAccounts'][_0x25a21f['id']][_0x85b3('0x31')][_0x85b3('0x13')]=_0x85b3('0x32');_0x5db8e2[_0x85b3('0xc')][_0x25a21f['id']][_0x85b3('0x31')]['messageStatus']='';_0x5db8e2[_0x85b3('0xf')](_0x25a21f['id']);_0x2c3fe8(_0x1d81a9);})[_0x85b3('0x2b')](function(_0x4e8dae){_0x5db8e2[_0x85b3('0xc')][_0x25a21f['id']][_0x85b3('0x31')][_0x85b3('0x13')]=_0x85b3('0x1e');_0x5db8e2['mailAccounts'][_0x25a21f['id']][_0x85b3('0x31')][_0x85b3('0x14')]=_0x4e8dae;_0x5db8e2['emit'](_0x25a21f['id']);_0x25a403(_0x4e8dae);});});}return this[_0x85b3('0xe')][_0x85b3('0x33')](_0x25a21f);};module[_0x85b3('0x34')]=EmailChannel; \ No newline at end of file +var _0xc013=['stringify','refresh','hasOwnProperty','imapAccounts','email','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','isNil','disabled','handleImapBox','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','verified','bluebird','md5','../../../config/environment','../../../config/logger','redis','localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','Imap','status','messageStatus'];(function(_0xe6b569,_0x49036d){var _0x3bff09=function(_0x2161be){while(--_0x2161be){_0xe6b569['push'](_0xe6b569['shift']());}};_0x3bff09(++_0x49036d);}(_0xc013,0x81));var _0x3c01=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xc013[_0xa3c06b];return _0x33aa1d;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x3c01('0x0'));var md5=require(_0x3c01('0x1'));var Redis=require('ioredis');var config=require(_0x3c01('0x2'));var logger=require(_0x3c01('0x3'))('email');config[_0x3c01('0x4')]=_['defaults'](config['redis'],{'host':_0x3c01('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3c01('0x4')]));var EmailImap=require(_0x3c01('0x6'));var EmailSmtp=require(_0x3c01('0x7'));var mailAccount=require(_0x3c01('0x8'));var md5Accounts={};function EmailChannel(_0x1f4f60){logger['info'](_0x3c01('0x9'));this[_0x3c01('0xa')]=_0x1f4f60[_0x3c01('0xa')];this['imapAccounts']={};this[_0x3c01('0xb')]=new EmailSmtp();}EmailChannel[_0x3c01('0xc')][_0x3c01('0xd')]=function(_0xeedd41){var _0x1946b3=this[_0x3c01('0xa')][_0xeedd41];var _0x11620c={'id':_0x1946b3['id'],'name':_0x1946b3[_0x3c01('0xe')],'key':_0x1946b3['key'],'active':_0x1946b3['active'],'Imap':{'status':_0x1946b3[_0x3c01('0xf')][_0x3c01('0x10')],'messageStatus':_0x1946b3[_0x3c01('0xf')][_0x3c01('0x11')],'total':_0x1946b3[_0x3c01('0xf')]['total']}};if(_['isNil'](md5Accounts[_0xeedd41])){md5Accounts[_0xeedd41]={};}var _0x4b81f6=md5(JSON[_0x3c01('0x12')](_0x11620c));if(md5Accounts[_0xeedd41][_0x3c01('0x1')]!==_0x4b81f6){md5Accounts[_0xeedd41][_0x3c01('0x1')]=_0x4b81f6;io['emit']('mailAccount:update',_0x11620c);}};EmailChannel[_0x3c01('0xc')][_0x3c01('0x13')]=function(_0x12b538){for(var _0x2381d8 in _0x12b538){if(_0x12b538[_0x3c01('0x14')](_0x2381d8)){if(_0x12b538[_0x2381d8][_0x3c01('0xf')]&&_0x12b538[_0x2381d8]['active']){var _0x213a6f=_0x12b538[_0x2381d8][_0x3c01('0xf')];if(!this['imapAccounts']['hasOwnProperty'](_0x213a6f['id'])){this[_0x3c01('0x15')][_0x213a6f['id']]=new EmailImap(_0x213a6f,_0x12b538[_0x2381d8][_0x3c01('0x16')]);this[_0x3c01('0x15')][_0x213a6f['id']]['on']('box',this['handleImapBox']['bind'](this,_0x2381d8));this['imapAccounts'][_0x213a6f['id']]['on'](_0x3c01('0x16'),this[_0x3c01('0x17')]['bind'](this,_0x2381d8));this[_0x3c01('0x15')][_0x213a6f['id']]['on'](_0x3c01('0x18'),this[_0x3c01('0x19')][_0x3c01('0x1a')](this,_0x2381d8));this[_0x3c01('0x15')][_0x213a6f['id']]['on'](_0x3c01('0x1b'),this[_0x3c01('0x1c')][_0x3c01('0x1a')](this,_0x2381d8));}}else{if(_[_0x3c01('0x1d')](this['mailAccounts'][_0x2381d8]['Imap'])){this[_0x3c01('0xa')][_0x2381d8][_0x3c01('0xf')]={};}this[_0x3c01('0xa')][_0x2381d8][_0x3c01('0xf')][_0x3c01('0x10')]=_0x3c01('0x1e');this[_0x3c01('0xa')][_0x2381d8]['Imap'][_0x3c01('0x11')]='';this[_0x3c01('0xd')](_0x2381d8);}}}};EmailChannel[_0x3c01('0xc')][_0x3c01('0x1f')]=function(_0x1d4b3b,_0x3b7801){if(this[_0x3c01('0xa')][_0x1d4b3b]){this[_0x3c01('0xa')][_0x1d4b3b]['Imap'][_0x3c01('0x10')]=_0x3c01('0x20');this[_0x3c01('0xa')][_0x1d4b3b][_0x3c01('0xf')][_0x3c01('0x11')]=_0x3b7801[_0x3c01('0xe')];if(_0x3b7801[_0x3c01('0x21')]){this['mailAccounts'][_0x1d4b3b][_0x3c01('0xf')]['total']=_0x3b7801[_0x3c01('0x21')]['total'];}return this[_0x3c01('0xd')](_0x1d4b3b);}};EmailChannel[_0x3c01('0xc')]['handleImapEmail']=function(_0x14a680,_0x2223ac){logger[_0x3c01('0x22')](_0x3c01('0x23'),_0x2223ac[_0x3c01('0x24')],_0x2223ac[_0x3c01('0x25')],_0x2223ac[_0x3c01('0x26')],_0x14a680);if(this[_0x3c01('0xa')][_0x14a680]){return mailAccount[_0x3c01('0x27')](_0x14a680,_0x2223ac)[_0x3c01('0x28')](function(_0x381012){if(_0x381012){logger[_0x3c01('0x22')]('Mail\x20accepted\x20from\x20routing');}})[_0x3c01('0x29')](function(_0x4004fd){logger[_0x3c01('0x1b')](_0x3c01('0x2a'),JSON[_0x3c01('0x12')](_0x4004fd));});}};EmailChannel['prototype'][_0x3c01('0x19')]=function(_0x37e0d3){if(this[_0x3c01('0xa')][_0x37e0d3]&&this[_0x3c01('0xa')][_0x37e0d3][_0x3c01('0xf')]){if(this[_0x3c01('0x15')][this[_0x3c01('0xa')][_0x37e0d3][_0x3c01('0xf')]['id']]){delete this['imapAccounts'][this[_0x3c01('0xa')][_0x37e0d3]['Imap']['id']];}this[_0x3c01('0xa')][_0x37e0d3][_0x3c01('0xf')][_0x3c01('0x2b')]=moment();this[_0x3c01('0xd')](_0x37e0d3);}};EmailChannel[_0x3c01('0xc')]['handleImapError']=function(_0x2ad83a,_0xd17aef){if(this['mailAccounts'][_0x2ad83a]){this[_0x3c01('0xa')][_0x2ad83a]['Imap'][_0x3c01('0x10')]=_0x3c01('0x1b');this[_0x3c01('0xa')][_0x2ad83a]['Imap'][_0x3c01('0x11')]=_0xd17aef;return this[_0x3c01('0xd')](_0x2ad83a);}};EmailChannel[_0x3c01('0xc')]['sendMail']=function(_0x37bcac,_0x3c91bf){return this[_0x3c01('0xb')][_0x3c01('0x2c')](_0x37bcac,_0x3c91bf);};EmailChannel['prototype'][_0x3c01('0x2d')]=function(_0x381adf){var _0x75bc2d=this;if(this[_0x3c01('0xa')][_0x381adf['id']]){if(_[_0x3c01('0x1d')](this[_0x3c01('0xa')][_0x381adf['id']][_0x3c01('0x2e')])){this[_0x3c01('0xa')][_0x381adf['id']]['Smtp']={};}this[_0x3c01('0xa')][_0x381adf['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x29681a,_0x3d5e4e){return _0x75bc2d[_0x3c01('0xb')][_0x3c01('0x2f')](_0x381adf)[_0x3c01('0x28')](function(_0x3b234c){_0x75bc2d[_0x3c01('0xa')][_0x381adf['id']]['Smtp'][_0x3c01('0x10')]=_0x3c01('0x30');_0x75bc2d[_0x3c01('0xa')][_0x381adf['id']]['Smtp'][_0x3c01('0x11')]='';_0x75bc2d[_0x3c01('0xd')](_0x381adf['id']);_0x29681a(_0x3b234c);})[_0x3c01('0x29')](function(_0x2fb1d6){_0x75bc2d[_0x3c01('0xa')][_0x381adf['id']][_0x3c01('0x2e')][_0x3c01('0x10')]=_0x3c01('0x1b');_0x75bc2d[_0x3c01('0xa')][_0x381adf['id']][_0x3c01('0x2e')][_0x3c01('0x11')]=_0x2fb1d6;_0x75bc2d[_0x3c01('0xd')](_0x381adf['id']);_0x3d5e4e(_0x2fb1d6);});});}return this['smtp']['verify'](_0x381adf);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 113c8b5..e6d462b 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 _0xd967=['imap','lodash','randomstring','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','bind','end','handleEnd','connect','inherits','connTimeout','authTimeout','password','host','port','tls','autotls','required','user','service','anonymous@xcally.com','prototype','handleReady','openBox','handleOpenBox','handleError','readUnseen','handleCloseBox','search','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','error','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','closeBox','stringify','textCode','upperFirst','path'];(function(_0x1c58db,_0x57d72b){var _0x57bca3=function(_0x1c513b){while(--_0x1c513b){_0x1c58db['push'](_0x1c58db['shift']());}};_0x57bca3(++_0x57d72b);}(_0xd967,0x75));var _0x7d96=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xd967[_0x2077c2];return _0x312f9f;};'use strict';var fs=require('fs');var path=require(_0x7d96('0x0'));var util=require('util');var Imap=require(_0x7d96('0x1'));var _=require(_0x7d96('0x2'));var rs=require(_0x7d96('0x3'));var simpleParser=require(_0x7d96('0x4'))[_0x7d96('0x5')];var Iconv=require(_0x7d96('0x6'))['Iconv'];var EventEmitter=require(_0x7d96('0x7'))[_0x7d96('0x8')];var utils=require(_0x7d96('0x9'));var logger=require(_0x7d96('0xa'))(_0x7d96('0xb'));function EmailImap(_0x4466c4,_0x27b0bf){this[_0x7d96('0xc')]=_0x7d96('0xd');this[_0x7d96('0xe')]=this[_0x7d96('0xf')](_0x4466c4,_0x27b0bf);this[_0x7d96('0x1')]=new Imap(this[_0x7d96('0xe')]);this[_0x7d96('0x1')][_0x7d96('0x10')](_0x7d96('0x11'),this['handleReady'][_0x7d96('0x12')](this));this['imap'][_0x7d96('0x10')](_0x7d96('0x13'),this[_0x7d96('0x14')][_0x7d96('0x12')](this));this[_0x7d96('0x1')]['on']('error',this['handleError'][_0x7d96('0x12')](this));this[_0x7d96('0x1')][_0x7d96('0x15')]();}util[_0x7d96('0x16')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7d96('0xf')]=function(_0x2b5e22,_0x2b2530){var _0x51b5a7={'connTimeout':_0x2b5e22[_0x7d96('0x17')]?_0x2b5e22[_0x7d96('0x17')]*0x3e8:0x2710,'authTimeout':_0x2b5e22[_0x7d96('0x18')]?_0x2b5e22['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x2b5e22['service'])){if(_0x2b5e22['authentication']){_0x51b5a7['user']=_0x2b5e22['user'];_0x51b5a7[_0x7d96('0x19')]=_0x2b5e22['password'];}_0x51b5a7['host']=_0x2b5e22[_0x7d96('0x1a')];_0x51b5a7['port']=_0x2b5e22[_0x7d96('0x1b')]||0x3e1;if(_0x2b5e22['tls']){_0x51b5a7['tls']=!![];}else{_0x51b5a7[_0x7d96('0x1c')]=![];_0x51b5a7[_0x7d96('0x1d')]=_0x7d96('0x1e');}}else{_0x51b5a7[_0x7d96('0x1f')]=_0x2b5e22[_0x7d96('0x1f')];_0x51b5a7['password']=_0x2b5e22['password'];_0x51b5a7[_0x7d96('0x1a')]=utils['getHost'](_0x2b5e22[_0x7d96('0x20')]);_0x51b5a7[_0x7d96('0x1b')]=0x3e1;_0x51b5a7['tls']=!![];}_0x51b5a7[_0x7d96('0xb')]=_0x2b2530||_0x2b5e22[_0x7d96('0x1f')]||_0x7d96('0x21');return _0x51b5a7;};EmailImap[_0x7d96('0x22')][_0x7d96('0x23')]=function(){this[_0x7d96('0x1')][_0x7d96('0x24')](this[_0x7d96('0xc')],![],this[_0x7d96('0x25')]['bind'](this));};EmailImap['prototype'][_0x7d96('0x25')]=function(_0x58392,_0x268d5f){if(_0x58392){this[_0x7d96('0x26')](_0x58392,!![]);}else{this['emit']('box',_0x268d5f);this[_0x7d96('0x27')]();}};EmailImap['prototype'][_0x7d96('0x28')]=function(_0x3269a0){if(_0x3269a0){this[_0x7d96('0x26')](_0x3269a0,!![]);}else{this['imap'][_0x7d96('0x13')]();}};EmailImap[_0x7d96('0x22')][_0x7d96('0x27')]=function(){this[_0x7d96('0x1')][_0x7d96('0x29')](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x7f48e6,_0x48edfe){if(_0x7f48e6){this[_0x7d96('0x26')](_0x7f48e6,!![]);}else{if(_0x48edfe['length']){try{var _0x446a01=this[_0x7d96('0x1')][_0x7d96('0x2a')](_0x48edfe,{'bodies':'','markSeen':!![]});_0x446a01['on'](_0x7d96('0x2b'),this[_0x7d96('0x2c')][_0x7d96('0x12')](this));_0x446a01[_0x7d96('0x10')]('error',this[_0x7d96('0x2d')][_0x7d96('0x12')](this));_0x446a01[_0x7d96('0x10')]('end',this[_0x7d96('0x2e')][_0x7d96('0x12')](this));}catch(_0x281485){logger[_0x7d96('0x2f')](_0x281485);}}else{this[_0x7d96('0x1')]['closeBox'](!![],this[_0x7d96('0x28')][_0x7d96('0x12')](this));}}};EmailImap[_0x7d96('0x22')]['handleFetchMessage']=function(_0x2cf087,_0x361972){_0x2cf087['on'](_0x7d96('0x30'),this[_0x7d96('0x31')][_0x7d96('0x12')](this));_0x2cf087[_0x7d96('0x10')](_0x7d96('0x32'),this[_0x7d96('0x33')][_0x7d96('0x12')](this));_0x2cf087[_0x7d96('0x10')](_0x7d96('0x13'),this[_0x7d96('0x34')][_0x7d96('0x12')](this));};EmailImap['prototype'][_0x7d96('0x31')]=function(_0x12470e,_0x59a246){simpleParser(_0x12470e,{'Iconv':Iconv},this[_0x7d96('0x35')][_0x7d96('0x12')](this));};EmailImap[_0x7d96('0x22')]['handleMessageAttributes']=function(_0x4af40e){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x22517d,_0x2514ad){if(_0x22517d){logger[_0x7d96('0x2f')](_0x22517d);}else{var _0x31d1a5=this;utils['parser'](this[_0x7d96('0xe')],_0x2514ad,function(_0x206ed5){_0x31d1a5[_0x7d96('0x36')](_0x7d96('0xb'),_0x206ed5);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x7d96('0x1')]['closeBox'](!![],this[_0x7d96('0x28')][_0x7d96('0x12')](this));};EmailImap['prototype'][_0x7d96('0x2d')]=function(_0x3563e3){this[_0x7d96('0x26')](_0x3563e3);this[_0x7d96('0x1')][_0x7d96('0x37')](!![],this[_0x7d96('0x28')][_0x7d96('0x12')](this));};EmailImap[_0x7d96('0x22')][_0x7d96('0x14')]=function(){this[_0x7d96('0x36')]('end');};EmailImap[_0x7d96('0x22')]['handleError']=function(_0x546e4a,_0x3d1395){logger[_0x7d96('0x2f')](_0x7d96('0x26'),this[_0x7d96('0xe')]['email'],JSON[_0x7d96('0x38')](_0x546e4a));var _0x2ad393='';if(_0x546e4a){if(_0x546e4a[_0x7d96('0x39')]){_0x2ad393=_0x546e4a[_0x7d96('0x39')];}else{for(var _0x51cd68 in _0x546e4a){if(_0x546e4a['hasOwnProperty'](_0x51cd68)){_0x2ad393+=_[_0x7d96('0x3a')](_0x51cd68)+':\x20'+_0x546e4a[_0x51cd68]+'\x0a';}}}}if(_0x3d1395){this[_0x7d96('0x1')]['end']();}else{this[_0x7d96('0x36')](_0x7d96('0x2f'),_0x2ad393);this[_0x7d96('0x36')](_0x7d96('0x13'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x2feb=['parser','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','account','getAccount','ready','bind','once','error','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','getHost','anonymous@xcally.com','handleReady','openBox','mailbox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser'];(function(_0x2c93e2,_0x4fb5e2){var _0x57264e=function(_0x386895){while(--_0x386895){_0x2c93e2['push'](_0x2c93e2['shift']());}};_0x57264e(++_0x4fb5e2);}(_0x2feb,0x1c0));var _0xb2fe=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x2feb[_0x32f6b9];return _0x267d52;};'use strict';var fs=require('fs');var path=require(_0xb2fe('0x0'));var util=require(_0xb2fe('0x1'));var Imap=require(_0xb2fe('0x2'));var _=require(_0xb2fe('0x3'));var rs=require(_0xb2fe('0x4'));var simpleParser=require(_0xb2fe('0x5'))[_0xb2fe('0x6')];var Iconv=require(_0xb2fe('0x7'))[_0xb2fe('0x8')];var EventEmitter=require(_0xb2fe('0x9'))[_0xb2fe('0xa')];var utils=require(_0xb2fe('0xb'));var logger=require(_0xb2fe('0xc'))(_0xb2fe('0xd'));function EmailImap(_0x469bbc,_0x53d73f){this['mailbox']='INBOX';this[_0xb2fe('0xe')]=this[_0xb2fe('0xf')](_0x469bbc,_0x53d73f);this['imap']=new Imap(this[_0xb2fe('0xe')]);this[_0xb2fe('0x2')]['once'](_0xb2fe('0x10'),this['handleReady'][_0xb2fe('0x11')](this));this['imap'][_0xb2fe('0x12')]('end',this['handleEnd'][_0xb2fe('0x11')](this));this['imap']['on'](_0xb2fe('0x13'),this['handleError']['bind'](this));this[_0xb2fe('0x2')]['connect']();}util[_0xb2fe('0x14')](EmailImap,EventEmitter);EmailImap[_0xb2fe('0x15')][_0xb2fe('0xf')]=function(_0x390b85,_0x8f545b){var _0x4827fd={'connTimeout':_0x390b85[_0xb2fe('0x16')]?_0x390b85['connTimeout']*0x3e8:0x2710,'authTimeout':_0x390b85[_0xb2fe('0x17')]?_0x390b85['authTimeout']*0x3e8:0x1388};if(_[_0xb2fe('0x18')](_0x390b85[_0xb2fe('0x19')])){if(_0x390b85[_0xb2fe('0x1a')]){_0x4827fd[_0xb2fe('0x1b')]=_0x390b85['user'];_0x4827fd[_0xb2fe('0x1c')]=_0x390b85[_0xb2fe('0x1c')];}_0x4827fd[_0xb2fe('0x1d')]=_0x390b85[_0xb2fe('0x1d')];_0x4827fd[_0xb2fe('0x1e')]=_0x390b85[_0xb2fe('0x1e')]||0x3e1;if(_0x390b85['tls']){_0x4827fd[_0xb2fe('0x1f')]=!![];}else{_0x4827fd[_0xb2fe('0x1f')]=![];_0x4827fd['autotls']='required';}}else{_0x4827fd[_0xb2fe('0x1b')]=_0x390b85['user'];_0x4827fd[_0xb2fe('0x1c')]=_0x390b85['password'];_0x4827fd['host']=utils[_0xb2fe('0x20')](_0x390b85[_0xb2fe('0x19')]);_0x4827fd[_0xb2fe('0x1e')]=0x3e1;_0x4827fd[_0xb2fe('0x1f')]=!![];}_0x4827fd[_0xb2fe('0xd')]=_0x8f545b||_0x390b85[_0xb2fe('0x1b')]||_0xb2fe('0x21');return _0x4827fd;};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x22')]=function(){this[_0xb2fe('0x2')][_0xb2fe('0x23')](this[_0xb2fe('0x24')],![],this[_0xb2fe('0x25')][_0xb2fe('0x11')](this));};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x25')]=function(_0x96a6db,_0x4bd66c){if(_0x96a6db){this[_0xb2fe('0x26')](_0x96a6db,!![]);}else{this[_0xb2fe('0x27')]('box',_0x4bd66c);this[_0xb2fe('0x28')]();}};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x29')]=function(_0x8b4a54){if(_0x8b4a54){this[_0xb2fe('0x26')](_0x8b4a54,!![]);}else{this[_0xb2fe('0x2')][_0xb2fe('0x2a')]();}};EmailImap['prototype'][_0xb2fe('0x28')]=function(){this['imap'][_0xb2fe('0x2b')]([_0xb2fe('0x2c')],this[_0xb2fe('0x2d')][_0xb2fe('0x11')](this));};EmailImap['prototype'][_0xb2fe('0x2d')]=function(_0xcd4258,_0x46e48e){if(_0xcd4258){this[_0xb2fe('0x26')](_0xcd4258,!![]);}else{if(_0x46e48e['length']){try{var _0x1af4b7=this[_0xb2fe('0x2')][_0xb2fe('0x2e')](_0x46e48e,{'bodies':'','markSeen':!![]});_0x1af4b7['on']('message',this[_0xb2fe('0x2f')][_0xb2fe('0x11')](this));_0x1af4b7[_0xb2fe('0x12')](_0xb2fe('0x13'),this[_0xb2fe('0x30')][_0xb2fe('0x11')](this));_0x1af4b7[_0xb2fe('0x12')](_0xb2fe('0x2a'),this[_0xb2fe('0x31')][_0xb2fe('0x11')](this));}catch(_0x39f8a5){logger['error'](_0x39f8a5);}}else{this[_0xb2fe('0x2')][_0xb2fe('0x32')](!![],this['handleCloseBox'][_0xb2fe('0x11')](this));}}};EmailImap['prototype'][_0xb2fe('0x2f')]=function(_0x22ddf1,_0x16a14d){_0x22ddf1['on']('body',this[_0xb2fe('0x33')][_0xb2fe('0x11')](this));_0x22ddf1[_0xb2fe('0x12')](_0xb2fe('0x34'),this[_0xb2fe('0x35')]['bind'](this));_0x22ddf1[_0xb2fe('0x12')](_0xb2fe('0x2a'),this[_0xb2fe('0x36')][_0xb2fe('0x11')](this));};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x33')]=function(_0x1f1cdd,_0x1e9600){simpleParser(_0x1f1cdd,{'Iconv':Iconv},this['handleSimpleParser'][_0xb2fe('0x11')](this));};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x35')]=function(_0x58040a){};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x36')]=function(){};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x37')]=function(_0x4519a2,_0x4e7b4c){if(_0x4519a2){logger[_0xb2fe('0x13')](_0x4519a2);}else{var _0x30b695=this;utils[_0xb2fe('0x38')](this[_0xb2fe('0xe')],_0x4e7b4c,function(_0x5387db){_0x30b695['emit']('email',_0x5387db);});}};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x31')]=function(){this[_0xb2fe('0x2')]['closeBox'](!![],this[_0xb2fe('0x29')][_0xb2fe('0x11')](this));};EmailImap[_0xb2fe('0x15')][_0xb2fe('0x30')]=function(_0x423590){this[_0xb2fe('0x26')](_0x423590);this[_0xb2fe('0x2')][_0xb2fe('0x32')](!![],this[_0xb2fe('0x29')][_0xb2fe('0x11')](this));};EmailImap['prototype'][_0xb2fe('0x39')]=function(){this[_0xb2fe('0x27')]('end');};EmailImap[_0xb2fe('0x15')]['handleError']=function(_0x260f46,_0x3f4fed){logger[_0xb2fe('0x13')](_0xb2fe('0x26'),this['account'][_0xb2fe('0xd')],JSON[_0xb2fe('0x3a')](_0x260f46));var _0x2a07f8='';if(_0x260f46){if(_0x260f46[_0xb2fe('0x3b')]){_0x2a07f8=_0x260f46['textCode'];}else{for(var _0x482d03 in _0x260f46){if(_0x260f46[_0xb2fe('0x3c')](_0x482d03)){_0x2a07f8+=_[_0xb2fe('0x3d')](_0x482d03)+':\x20'+_0x260f46[_0x482d03]+'\x0a';}}}}if(_0x3f4fed){this[_0xb2fe('0x2')][_0xb2fe('0x2a')]();}else{this[_0xb2fe('0x27')](_0xb2fe('0x13'),_0x2a07f8);this[_0xb2fe('0x27')]('end');}};module[_0xb2fe('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b567072..8c9315c 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 _0xd655=['bluebird','nodemailer-plugin-inline-base64','use','compile','sendMail','toString','prototype','verify'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0xd655,0x120));var _0x5d65=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xd655[_0x1ebce2];return _0x4a330c;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x5d65('0x0'));var inlineBase64=require(_0x5d65('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0xe343fb,_0x4d56a2){return new BPromise(function(_0x11f80c,_0x37770d){var _0x313724=nodemailer['createTransport'](_0xe343fb);_0x313724[_0x5d65('0x2')](_0x5d65('0x3'),inlineBase64());_0x313724[_0x5d65('0x4')](_0x4d56a2,function(_0x56a807,_0xaf5bbf){if(_0x56a807){_0x37770d(_0x56a807[_0x5d65('0x5')]());}else{_0x11f80c(_0xaf5bbf);}});});};EmailSmtp[_0x5d65('0x6')][_0x5d65('0x7')]=function(_0x2a1d10){return new BPromise(function(_0x31604a,_0x136b0f){var _0x4f8f88=nodemailer['createTransport'](_0x2a1d10);_0x4f8f88['verify'](function(_0x4e5f60,_0x35a54c){if(_0x4e5f60){_0x136b0f(_0x4e5f60[_0x5d65('0x5')]());}else{if(_0x35a54c){_0x31604a(_0x35a54c);}else{_0x136b0f('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x75aa=['exports','bluebird','send','createTransport','use','toString','prototype','verify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75aa,0x121));var _0xa75a=function(_0xaf47ff,_0x226c6f){_0xaf47ff=_0xaf47ff-0x0;var _0x32454e=_0x75aa[_0xaf47ff];return _0x32454e;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xa75a('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xa75a('0x1')]=function(_0x2bd805,_0xa06361){return new BPromise(function(_0x499b39,_0x1c993f){var _0x595179=nodemailer[_0xa75a('0x2')](_0x2bd805);_0x595179[_0xa75a('0x3')]('compile',inlineBase64());_0x595179['sendMail'](_0xa06361,function(_0x206192,_0x6730b1){if(_0x206192){_0x1c993f(_0x206192[_0xa75a('0x4')]());}else{_0x499b39(_0x6730b1);}});});};EmailSmtp[_0xa75a('0x5')][_0xa75a('0x6')]=function(_0x3a6cc5){return new BPromise(function(_0x5dfc93,_0x1a2b8f){var _0x5ea1bc=nodemailer['createTransport'](_0x3a6cc5);_0x5ea1bc[_0xa75a('0x6')](function(_0x4adf97,_0x4b3a63){if(_0x4adf97){_0x1a2b8f(_0x4adf97['toString']());}else{if(_0x4b3a63){_0x5dfc93(_0x4b3a63);}else{_0x1a2b8f('Not\x20verifired');}}});});};module[_0xa75a('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 7604317..4ed0a8c 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 _0x2542=['attachment','format','%s-%s','now','server/files/attachments/','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','test','html','attachments','forEach','push','filename','_SRC','replace','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x575d58[_0x2254('0x12')](0x0,-0x1)[_0x2254('0x13')]('\x20'):_0x263459[_0x2254('0xd')];}return _0x2254('0x14');}function getLastName(_0x592a4f){var _0x439238=_[_0x2254('0x7')](_0x592a4f['value']);if(_0x439238&&_0x439238[_0x2254('0xd')]){var _0x1e582d=_0x439238[_0x2254('0xd')][_0x2254('0x10')](/\s+/);return _0x1e582d[_0x2254('0x11')]>0x1?_0x1e582d[_0x2254('0x15')]():'';}return'';}function getMails(_0x50f137,_0x18baf4){var _0x57247a='';for(var _0x327d6d=0x0;_0x327d6d<_0x18baf4[_0x2254('0xc')][_0x2254('0x11')];_0x327d6d+=0x1){if(_0x18baf4[_0x2254('0xc')][_0x327d6d][_0x2254('0x8')]!==_0x50f137){if(!_[_0x2254('0x16')](_0x57247a)){_0x57247a+=',';}_0x57247a+=_0x18baf4['value'][_0x327d6d]['name']||_0x18baf4['value'][_0x327d6d][_0x2254('0x8')]||'';_0x57247a+='\x20<';_0x57247a+=_0x18baf4[_0x2254('0xc')][_0x327d6d][_0x2254('0x8')]?_0x18baf4[_0x2254('0xc')][_0x327d6d][_0x2254('0x8')]:_0x2254('0x9')+random['generate'](0x6)+_0x2254('0xb');_0x57247a+='>';}}return _0x57247a;}function parseEmail(_0x16148d,_0x906cde,_0x576369){if(_0x906cde['html']){var _0x5bd982=/)<[^<]*)*<\/script>/gi;while(_0x5bd982[_0x2254('0x17')](_0x906cde[_0x2254('0x18')])){_0x906cde[_0x2254('0x18')]=_0x906cde['html']['replace'](_0x5bd982,'');}if(_0x906cde['html']['includes']('{_0x4f797d[_0x2254('0x1b')](_0x2f3037[_0x2254('0x1c')]);});var _0x1349c9=/]+>/g;var _0x51b578=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4a8274=_0x906cde[_0x2254('0x18')]['replace'](_0x51b578,_0x2254('0x1d'));var _0x141dc5=_0x4a8274[_0x2254('0x1e')](_0x1349c9,_0x2254('0x1f'));for(let _0x19043b=0x0;_0x19043b<_0x4f797d['length'];_0x19043b++){var _0x1a8a0d=_0x141dc5[_0x2254('0x1e')](_0x2254('0x1f'),_0x2254('0x20')+_0x4f797d[_0x19043b]+_0x2254('0x21'));_0x141dc5=_0x1a8a0d;}_0x906cde[_0x2254('0x18')]=_0x141dc5;}_0x576369[_0x2254('0x22')]=_0x906cde[_0x2254('0x18')];}else{_0x576369[_0x2254('0x22')]=_0x906cde[_0x2254('0x23')];}if(_0x576369[_0x2254('0x22')]){_0x576369[_0x2254('0x22')]=_0x576369[_0x2254('0x22')][_0x2254('0x1e')](/0x0){var _0x19b580=[_0x2254('0x34'),_0x2254('0x35'),_0x2254('0x36')];for(var _0x3171ca=0x0;_0x3171ca<_0x906cde[_0x2254('0x33')]['length'];_0x3171ca++){var _0x3025ee=_[_0x2254('0xf')](_0x19b580,_0x906cde[_0x2254('0x33')][_0x3171ca][_0x2254('0x37')]);if(_0x3025ee>=0x0){_0x576369[_0x2254('0x38')]=!![];}}}return _0x576369;}exports['parser']=function(_0x22bb98,_0x1dec43,_0x5720a5){var _0x135ed8={'from':getAddress(_0x1dec43[_0x2254('0x39')]),'firstName':getFirstName(_0x1dec43['from']),'lastName':getLastName(_0x1dec43[_0x2254('0x39')]),'mapKey':'email','message':{'from':getMails(_0x22bb98[_0x2254('0x5')],_0x1dec43[_0x2254('0x39')]),'to':_0x22bb98[_0x2254('0x5')],'cc':'','subject':_0x1dec43[_0x2254('0x3a')]||'','messageId':_0x1dec43[_0x2254('0x3b')],'inReplyTo':_0x1dec43[_0x2254('0x3c')],'sentAt':moment(_0x1dec43[_0x2254('0x3d')])[_0x2254('0x2d')](_0x2254('0x3e')),'attach':![],'attachments':[]}};if(!_0x1dec43[_0x2254('0x18')]&&!_0x1dec43[_0x2254('0x23')]){var _0x2349cf=_[_0x2254('0x3f')](_0x1dec43['attachments'],{'contentType':_0x2254('0x40')});if(_0x2349cf[_0x2254('0x11')]){logger[_0x2254('0x41')](util['format'](_0x2254('0x42'),_0x1dec43[_0x2254('0x3b')]));tnef[_0x2254('0x43')](_[_0x2254('0x44')](_0x2349cf)[_0x2254('0x32')],function(_0x470241,_0x1f69bb){if(_0x1f69bb){_0x1dec43[_0x2254('0x18')]=_0x1f69bb[_0x2254('0x45')]||'

Empty\x20message

';if(_0x1f69bb[_0x2254('0x46')]){for(var _0x405eb2=0x0;_0x405eb2<_0x1f69bb[_0x2254('0x46')][_0x2254('0x11')];_0x405eb2++){var _0xbbc059=_0x1f69bb[_0x2254('0x46')][_0x405eb2];_0x135ed8[_0x2254('0x25')][_0x2254('0x19')][_0x2254('0x1b')]({'filename':_0xbbc059[_0x2254('0x47')],'content':Buffer['from'](_0xbbc059[_0x2254('0x48')])});}}}_0x5720a5(parseEmail(_0x22bb98,_0x1dec43,_0x135ed8));});}else{_0x1dec43[_0x2254('0x18')]='

Empty\x20message

';_0x5720a5(parseEmail(_0x22bb98,_0x1dec43,_0x135ed8));}}else{_0x5720a5(parseEmail(_0x22bb98,_0x1dec43,_0x135ed8));}};exports[_0x2254('0x49')]=function(_0x143bd2){switch(_0x143bd2){case _0x2254('0x4a'):return _0x2254('0x4b');case'yahoo':return _0x2254('0x4c');case _0x2254('0x4d'):return'imap-mail.outlook.com';case _0x2254('0x4e'):return _0x2254('0x4f');}return _0x2254('0x50');}; \ No newline at end of file +var _0x349f=['application/ms-tnef','info','first','BodyHTML','

Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','slice','join','Anonymous','split','pop','test','html','replace','attachments','forEach','push','filename','_SRC','_IMG','body','0x1?_0x497611[_0xf349('0x12')](0x0,-0x1)[_0xf349('0x13')]('\x20'):_0x22281a[_0xf349('0xe')];}return _0xf349('0x14');}function getLastName(_0x4e89ee){var _0x39ce84=_[_0xf349('0x8')](_0x4e89ee['value']);if(_0x39ce84&&_0x39ce84[_0xf349('0xe')]){var _0x3de88f=_0x39ce84['name'][_0xf349('0x15')](/\s+/);return _0x3de88f['length']>0x1?_0x3de88f[_0xf349('0x16')]():'';}return'';}function getMails(_0x3bc4e4,_0x26b561){var _0x1e2dcd='';for(var _0x14c06d=0x0;_0x14c06d<_0x26b561[_0xf349('0x9')][_0xf349('0x11')];_0x14c06d+=0x1){if(_0x26b561['value'][_0x14c06d][_0xf349('0xa')]!==_0x3bc4e4){if(!_['isEmpty'](_0x1e2dcd)){_0x1e2dcd+=',';}_0x1e2dcd+=_0x26b561[_0xf349('0x9')][_0x14c06d][_0xf349('0xe')]||_0x26b561[_0xf349('0x9')][_0x14c06d][_0xf349('0xa')]||'';_0x1e2dcd+='\x20<';_0x1e2dcd+=_0x26b561[_0xf349('0x9')][_0x14c06d][_0xf349('0xa')]?_0x26b561[_0xf349('0x9')][_0x14c06d][_0xf349('0xa')]:'anonymous'+random[_0xf349('0xc')](0x6)+'@xcally.com';_0x1e2dcd+='>';}}return _0x1e2dcd;}function parseEmail(_0x2942b5,_0x2b00f4,_0x2dccbc){if(_0x2b00f4['html']){var _0x311fc2=/)<[^<]*)*<\/script>/gi;while(_0x311fc2[_0xf349('0x17')](_0x2b00f4[_0xf349('0x18')])){_0x2b00f4['html']=_0x2b00f4[_0xf349('0x18')][_0xf349('0x19')](_0x311fc2,'');}if(_0x2b00f4['html']['includes']('{_0x100d5d[_0xf349('0x1c')](_0x49e221[_0xf349('0x1d')]);});var _0x11dc06=/]+>/g;var _0x428396=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x142d95=_0x2b00f4[_0xf349('0x18')][_0xf349('0x19')](_0x428396,_0xf349('0x1e'));var _0x439d32=_0x142d95[_0xf349('0x19')](_0x11dc06,_0xf349('0x1f'));for(let _0x345302=0x0;_0x345302<_0x100d5d[_0xf349('0x11')];_0x345302++){var _0x217939=_0x439d32['replace']('_IMG','\x20[Attachment:\x20'+_0x100d5d[_0x345302]+'\x20]');_0x439d32=_0x217939;}_0x2b00f4[_0xf349('0x18')]=_0x439d32;}_0x2dccbc['body']=_0x2b00f4[_0xf349('0x18')];}else{_0x2dccbc['body']=_0x2b00f4['textAsHtml'];}if(_0x2dccbc['body']){_0x2dccbc['body']=_0x2dccbc[_0xf349('0x20')][_0xf349('0x19')](/0x0){var _0x4d6880=['Auto-Submitted:\x20auto-replied',_0xf349('0x32'),'Precedence:\x20auto_reply'];for(var _0x368853=0x0;_0x368853<_0x2b00f4['headerLines'][_0xf349('0x11')];_0x368853++){var _0x31723e=_['indexOf'](_0x4d6880,_0x2b00f4[_0xf349('0x31')][_0x368853][_0xf349('0x33')]);if(_0x31723e>=0x0){_0x2dccbc[_0xf349('0x34')]=!![];}}}return _0x2dccbc;}exports['parser']=function(_0x336dcb,_0x478069,_0x235852){var _0x567e9c={'from':getAddress(_0x478069[_0xf349('0x35')]),'firstName':getFirstName(_0x478069[_0xf349('0x35')]),'lastName':getLastName(_0x478069[_0xf349('0x35')]),'mapKey':_0xf349('0x6'),'message':{'from':getMails(_0x336dcb[_0xf349('0x6')],_0x478069[_0xf349('0x35')]),'to':_0x336dcb['email'],'cc':'','subject':_0x478069[_0xf349('0x36')]||'','messageId':_0x478069[_0xf349('0x37')],'inReplyTo':_0x478069['inReplyTo'],'sentAt':moment(_0x478069[_0xf349('0x38')])[_0xf349('0x2b')](_0xf349('0x39')),'attach':![],'attachments':[]}};if(!_0x478069[_0xf349('0x18')]&&!_0x478069[_0xf349('0x3a')]){var _0x51fed8=_[_0xf349('0x3b')](_0x478069[_0xf349('0x1a')],{'contentType':_0xf349('0x3c')});if(_0x51fed8[_0xf349('0x11')]){logger[_0xf349('0x3d')](util[_0xf349('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x478069['messageId']));tnef['parseBuffer'](_[_0xf349('0x3e')](_0x51fed8)[_0xf349('0x2f')],function(_0x423657,_0x3417a6){if(_0x3417a6){_0x478069[_0xf349('0x18')]=_0x3417a6[_0xf349('0x3f')]||_0xf349('0x40');if(_0x3417a6[_0xf349('0x41')]){for(var _0x29b1b2=0x0;_0x29b1b2<_0x3417a6[_0xf349('0x41')]['length'];_0x29b1b2++){var _0x4b3088=_0x3417a6[_0xf349('0x41')][_0x29b1b2];_0x567e9c['message'][_0xf349('0x1a')][_0xf349('0x1c')]({'filename':_0x4b3088[_0xf349('0x42')],'content':Buffer[_0xf349('0x35')](_0x4b3088['Data'])});}}}_0x235852(parseEmail(_0x336dcb,_0x478069,_0x567e9c));});}else{_0x478069[_0xf349('0x18')]=_0xf349('0x40');_0x235852(parseEmail(_0x336dcb,_0x478069,_0x567e9c));}}else{_0x235852(parseEmail(_0x336dcb,_0x478069,_0x567e9c));}};exports[_0xf349('0x43')]=function(_0x14b420){switch(_0x14b420){case _0xf349('0x44'):return _0xf349('0x45');case _0xf349('0x46'):return _0xf349('0x47');case'hotmail':return _0xf349('0x48');case _0xf349('0x49'):return _0xf349('0x4a');}return _0xf349('0x4b');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index da637d7..f361e50 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 _0xc70e=['key','SERV','active','Imap','Smtp','lodash','name','Service'];(function(_0x3df870,_0x32e29f){var _0x53e934=function(_0x5a636d){while(--_0x5a636d){_0x3df870['push'](_0x3df870['shift']());}};_0x53e934(++_0x32e29f);}(_0xc70e,0x135));var _0xec70=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xc70e[_0x454165];return _0x56db53;};'use strict';var _=require(_0xec70('0x0'));function MailAccount(_0x1fbe72){this['id']=_0x1fbe72['id']||0x0;this[_0xec70('0x1')]=_0x1fbe72[_0xec70('0x1')]||_0xec70('0x2');this[_0xec70('0x3')]=_0x1fbe72[_0xec70('0x3')]||_0xec70('0x4');this[_0xec70('0x5')]=_0x1fbe72[_0xec70('0x5')]||![];this[_0xec70('0x6')]=_0x1fbe72[_0xec70('0x6')]||[];this[_0xec70('0x7')]=_0x1fbe72[_0xec70('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x605f=['Imap','Smtp','exports','lodash','name','Service','active'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x605f,0x1d1));var _0xf605=function(_0x3c8f5a,_0x577e65){_0x3c8f5a=_0x3c8f5a-0x0;var _0x1e6469=_0x605f[_0x3c8f5a];return _0x1e6469;};'use strict';var _=require(_0xf605('0x0'));function MailAccount(_0x5b0a4e){this['id']=_0x5b0a4e['id']||0x0;this['name']=_0x5b0a4e[_0xf605('0x1')]||_0xf605('0x2');this['key']=_0x5b0a4e['key']||'SERV';this[_0xf605('0x3')]=_0x5b0a4e[_0xf605('0x3')]||![];this[_0xf605('0x4')]=_0x5b0a4e[_0xf605('0x4')]||[];this[_0xf605('0x5')]=_0x5b0a4e[_0xf605('0x5')]||[];}module[_0xf605('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7bf80fb..05d818a 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 _0x761e=['lodash','../model/mailAccount','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined','merge','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x761e,0x1d9));var _0xe761=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x761e[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xe761('0x0'));var MailAccount=require(_0xe761('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3cfdad,_0x167202,_0x5ea891){var _0x1c0aee=_['mapKeys'](_0x3cfdad,function(_0x327e26,_0x17faae){return _0x327e26[_0x5ea891];});for(var _0x19c6b9 in _0x167202){if(_0x167202[_0xe761('0x2')](_0x19c6b9)){if(!_0x1c0aee[_0x19c6b9]){delete _0x167202[_0x19c6b9];}}}}Realtime[_0xe761('0x3')][_0xe761('0x4')]=function(_0x1489d4,_0x250cfc){for(var _0x179980 in _0x250cfc){if(_0x1489d4[_0xe761('0x2')](_0x179980)){_0x1489d4[_0x179980]=_0x250cfc[_0x179980];}}};Realtime[_0xe761('0x3')][_0xe761('0x5')]=function(){var _0xa6650c=this;return function(_0x1099ee){if(_0x1099ee){freeIsNotKey(_0x1099ee,_0xa6650c[_0xe761('0x6')],'id');for(var _0x5d037b=0x0,_0x5ecf4a={},_0x598871={};_0x5d037b<_0x1099ee[_0xe761('0x7')];_0x5d037b+=0x1){_0x5ecf4a=_0x1099ee[_0x5d037b];if(_[_0xe761('0x8')](_0xa6650c[_0xe761('0x6')][_0x5ecf4a['id']])){_0xa6650c[_0xe761('0x6')][_0x5ecf4a['id']]=new MailAccount(_0x5ecf4a);}else{_[_0xe761('0x9')](_0xa6650c['mailAccounts'][_0x5ecf4a['id']],_0x5ecf4a);}}}return _0xa6650c[_0xe761('0x6')];};};module[_0xe761('0xa')]=Realtime; \ No newline at end of file +var _0x2293=['hasOwnProperty','initMailAccounts','isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys','mergeFromDatabase'];(function(_0x14e39e,_0x5a1005){var _0x2b1deb=function(_0x30a9e1){while(--_0x30a9e1){_0x14e39e['push'](_0x14e39e['shift']());}};_0x2b1deb(++_0x5a1005);}(_0x2293,0x13c));var _0x3229=function(_0x35e17f,_0x190507){_0x35e17f=_0x35e17f-0x0;var _0x333882=_0x2293[_0x35e17f];return _0x333882;};'use strict';var _=require(_0x3229('0x0'));var MailAccount=require(_0x3229('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x38f32c,_0x85dbd5,_0x5d227a){var _0x2c520c=_[_0x3229('0x2')](_0x38f32c,function(_0x9477d4,_0x2b8e97){return _0x9477d4[_0x5d227a];});for(var _0x134822 in _0x85dbd5){if(_0x85dbd5['hasOwnProperty'](_0x134822)){if(!_0x2c520c[_0x134822]){delete _0x85dbd5[_0x134822];}}}}Realtime['prototype'][_0x3229('0x3')]=function(_0x5b406b,_0x202b0b){for(var _0x4653ca in _0x202b0b){if(_0x5b406b[_0x3229('0x4')](_0x4653ca)){_0x5b406b[_0x4653ca]=_0x202b0b[_0x4653ca];}}};Realtime['prototype'][_0x3229('0x5')]=function(){var _0x54e131=this;return function(_0x3ff70d){if(_0x3ff70d){freeIsNotKey(_0x3ff70d,_0x54e131['mailAccounts'],'id');for(var _0x495259=0x0,_0x13192e={},_0x54a792={};_0x495259<_0x3ff70d['length'];_0x495259+=0x1){_0x13192e=_0x3ff70d[_0x495259];if(_[_0x3229('0x6')](_0x54e131[_0x3229('0x7')][_0x13192e['id']])){_0x54e131[_0x3229('0x7')][_0x13192e['id']]=new MailAccount(_0x13192e);}else{_[_0x3229('0x8')](_0x54e131[_0x3229('0x7')][_0x13192e['id']],_0x13192e);}}}return _0x54e131[_0x3229('0x7')];};};module[_0x3229('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8714eb3..06eb0ae 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 _0x4ccb=['../client','getMailAccounts','Request','name','service','active','key','ListId','MailServerIn','Imap','MailServerOut','getMailAccount','notify','NotifyMailAccount'];(function(_0x56cb2e,_0x175521){var _0x4b1001=function(_0x1a9e19){while(--_0x1a9e19){_0x56cb2e['push'](_0x56cb2e['shift']());}};_0x4b1001(++_0x175521);}(_0x4ccb,0x196));var _0xb4cc=function(_0x378820,_0x2a537f){_0x378820=_0x378820-0x0;var _0xa6a65c=_0x4ccb[_0x378820];return _0xa6a65c;};'use strict';var client=require(_0xb4cc('0x0'));exports[_0xb4cc('0x1')]=function(){return function(){return client[_0xb4cc('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xb4cc('0x3'),_0xb4cc('0x4'),'email',_0xb4cc('0x5'),_0xb4cc('0x6'),_0xb4cc('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xb4cc('0x8'),'as':_0xb4cc('0x9')},{'model':_0xb4cc('0xa'),'as':'Smtp'}]},'log':_0xb4cc('0xb')});};};exports[_0xb4cc('0xc')]=function(_0x2129ef,_0x5327a4){return client[_0xb4cc('0x2')](_0xb4cc('0xd'),{'account':{'id':_0x2129ef},'body':_0x5327a4,'log':_0xb4cc('0xd')});}; \ No newline at end of file +var _0x2b67=['Request','GetMailAccount','service','key','ListId','TemplateId','MailServerIn','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client'];(function(_0x3aee1f,_0x3df072){var _0x337916=function(_0x2a9920){while(--_0x2a9920){_0x3aee1f['push'](_0x3aee1f['shift']());}};_0x337916(++_0x3df072);}(_0x2b67,0x67));var _0x72b6=function(_0x3b0f36,_0x557223){_0x3b0f36=_0x3b0f36-0x0;var _0x37fd12=_0x2b67[_0x3b0f36];return _0x37fd12;};'use strict';var client=require(_0x72b6('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x72b6('0x1')](_0x72b6('0x2'),{'options':{'attributes':['id','name',_0x72b6('0x3'),'email','active',_0x72b6('0x4'),_0x72b6('0x5'),_0x72b6('0x6')],'raw':![],'include':[{'model':_0x72b6('0x7'),'as':'Imap'},{'model':_0x72b6('0x8'),'as':_0x72b6('0x9')}]},'log':_0x72b6('0xa')});};};exports[_0x72b6('0xb')]=function(_0x5396d4,_0x12958b){return client[_0x72b6('0x1')](_0x72b6('0xc'),{'account':{'id':_0x5396d4},'body':_0x12958b,'log':_0x72b6('0xc')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index b885915..bee7bdd 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 _0x65dc=['getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x5e9588,_0x3204ed){var _0x1a0cfe=function(_0x1ff737){while(--_0x1ff737){_0x5e9588['push'](_0x5e9588['shift']());}};_0x1a0cfe(++_0x3204ed);}(_0x65dc,0x88));var _0xc65d=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0x65dc[_0xb1b616];return _0x1259b0;};'use strict';var client=require('../client');exports[_0xc65d('0x0')]=function(){return client[_0xc65d('0x1')](_0xc65d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc65d('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x7a99=['loginMailFrequency','GetSettings','../client','Request'];(function(_0x3ebd40,_0x322f2c){var _0x154a65=function(_0x2d8c7a){while(--_0x2d8c7a){_0x3ebd40['push'](_0x3ebd40['shift']());}};_0x154a65(++_0x322f2c);}(_0x7a99,0x1c2));var _0x97a9=function(_0x22d3dc,_0x139364){_0x22d3dc=_0x22d3dc-0x0;var _0x27c1d2=_0x7a99[_0x22d3dc];return _0x27c1d2;};'use strict';var client=require(_0x97a9('0x0'));exports['getSettings']=function(){return client[_0x97a9('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x97a9('0x2')]},'log':_0x97a9('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 2ddce88..2713dea 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(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 aed4285..ceffaf6 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 _0xfc24=['default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','ioredis','../../config/environment','listen','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers'];(function(_0x3fba6b,_0x1c30b2){var _0x2b5ffd=function(_0x515bd3){while(--_0x515bd3){_0x3fba6b['push'](_0x3fba6b['shift']());}};_0x2b5ffd(++_0x1c30b2);}(_0xfc24,0x12e));var _0x4fc2=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xfc24[_0x38537f];return _0x141e23;};'use strict';var _=require(_0x4fc2('0x0'));var http=require('http');var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x4fc2('0x1'));var config=require(_0x4fc2('0x2'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x4fc2('0x3')](server,config[_0x4fc2('0x4')])){var socketio=require(_0x4fc2('0x5'))(server,{'transports':[_0x4fc2('0x6'),_0x4fc2('0x7')]});config[_0x4fc2('0x8')]=_['defaults'](config[_0x4fc2('0x8')],{'host':_0x4fc2('0x9'),'port':0x18eb});socketio[_0x4fc2('0xa')](require(_0x4fc2('0xb'))({'pubClient':new Redis(config[_0x4fc2('0x8')]),'subClient':new Redis(config[_0x4fc2('0x8')])}));require(_0x4fc2('0xc'))[_0x4fc2('0xd')]();require(_0x4fc2('0xe'))[_0x4fc2('0xd')](socketio);require(_0x4fc2('0xf'))[_0x4fc2('0xd')](app);require('../../routes')[_0x4fc2('0xd')](app);}else{server[_0x4fc2('0x10')](_0x4fc2('0x11'),function(){console[_0x4fc2('0x12')](_0x4fc2('0x13'),config[_0x4fc2('0x4')]);});}exports=module[_0x4fc2('0x14')]=app; \ No newline at end of file +var _0x57c5=['adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults'];(function(_0x3f6bef,_0x661754){var _0x1f87eb=function(_0x4b4f77){while(--_0x4b4f77){_0x3f6bef['push'](_0x3f6bef['shift']());}};_0x1f87eb(++_0x661754);}(_0x57c5,0x17a));var _0x557c=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x57c5[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x557c('0x0'));var http=require(_0x557c('0x1'));var express=require('express');var sticky=require(_0x557c('0x2'));var Redis=require(_0x557c('0x3'));var config=require(_0x557c('0x4'));var app=express();var server=http[_0x557c('0x5')](app);server[_0x557c('0x6')]=0xdbba0;if(sticky[_0x557c('0x7')](server,config[_0x557c('0x8')])){var socketio=require(_0x557c('0x9'))(server,{'transports':['websocket',_0x557c('0xa')]});config[_0x557c('0xb')]=_[_0x557c('0xc')](config[_0x557c('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x557c('0xd')](require(_0x557c('0xe'))({'pubClient':new Redis(config[_0x557c('0xb')]),'subClient':new Redis(config[_0x557c('0xb')])}));require(_0x557c('0xf'))[_0x557c('0x10')]();require(_0x557c('0x11'))[_0x557c('0x10')](socketio);require('../../config/express')[_0x557c('0x10')](app);require(_0x557c('0x12'))[_0x557c('0x10')](app);}else{server[_0x557c('0x13')]('listening',function(){console[_0x557c('0x14')](_0x557c('0x15'),config[_0x557c('0x8')]);});}exports=module[_0x557c('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d0c1727..cc2ab9b 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 _0x2724=['request','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x2724,0x94));var _0x4272=function(_0x37fa29,_0x3291d8){_0x37fa29=_0x37fa29-0x0;var _0x39349b=_0x2724[_0x37fa29];return _0x39349b;};'use strict';var jayson=require(_0x4272('0x0'));var BPromise=require(_0x4272('0x1'));var logger=require(_0x4272('0x2'))(_0x4272('0x3'));var client=jayson[_0x4272('0x4')]['http']({'port':0x2329});client[_0x4272('0x5')]=function(_0x5efbb8,_0x42e8f1){return new BPromise(function(_0x5649c7,_0x35c574){return client[_0x4272('0x6')](_0x5efbb8,_0x42e8f1)['then'](function(_0x7ff776){logger[_0x4272('0x7')](_0x4272('0x8'),_0x4272('0x3'),_0x5efbb8,_0x42e8f1,_0x7ff776);if(_0x7ff776[_0x4272('0x9')]){logger[_0x4272('0x9')](_0x4272('0x8'),'routing',_0x5efbb8,_0x7ff776['error'][_0x4272('0xa')],_0x42e8f1);return _0x35c574(_0x7ff776[_0x4272('0x9')][_0x4272('0xa')]);}else{return _0x5649c7(_0x7ff776[_0x4272('0xb')]);}})[_0x4272('0xc')](function(_0x5bb4cc){logger['error'](_0x4272('0x8'),_0x4272('0x3'),_0x5efbb8,_0x5bb4cc,_0x42e8f1);return _0x35c574(_0x5bb4cc);});});};module[_0x4272('0xd')]=client; \ No newline at end of file +var _0x82a2=['message','result','catch','exports','bluebird','../../config/logger','routing','http','request','then','debug','rpc'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0x82a2,0x1e4));var _0x282a=function(_0x5732c8,_0x4100ff){_0x5732c8=_0x5732c8-0x0;var _0x3b0733=_0x82a2[_0x5732c8];return _0x3b0733;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x282a('0x0'));var logger=require(_0x282a('0x1'))(_0x282a('0x2'));var client=jayson['client'][_0x282a('0x3')]({'port':0x2329});client['Request']=function(_0x1da648,_0x48ff14){return new BPromise(function(_0x45b995,_0x2cb2ec){return client[_0x282a('0x4')](_0x1da648,_0x48ff14)[_0x282a('0x5')](function(_0x3c0c9f){logger[_0x282a('0x6')]('rpc',_0x282a('0x2'),_0x1da648,_0x48ff14,_0x3c0c9f);if(_0x3c0c9f['error']){logger['error'](_0x282a('0x7'),_0x282a('0x2'),_0x1da648,_0x3c0c9f['error'][_0x282a('0x8')],_0x48ff14);return _0x2cb2ec(_0x3c0c9f['error']['message']);}else{return _0x45b995(_0x3c0c9f[_0x282a('0x9')]);}})[_0x282a('0xa')](function(_0x3ab1a9){logger['error']('rpc',_0x282a('0x2'),_0x1da648,_0x3ab1a9,_0x48ff14);return _0x2cb2ec(_0x3ab1a9);});});};module[_0x282a('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9dadd34..bc60726 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 _0x505b=['listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x505b,0x13b));var _0xb505=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x505b[_0x2be8c2];return _0x97f531;};'use strict';var BPromise=require(_0xb505('0x0'));var server=require('./server');var Realtime=require(_0xb505('0x1'));var user=require(_0xb505('0x2'));var interval=require(_0xb505('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xb505('0x4'));var mailQueue=require(_0xb505('0x5'));var faxQueue=require(_0xb505('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xb505('0x7')]()[_0xb505('0x8')](user[_0xb505('0x9')]())['then'](realtime['initAgents']())[_0xb505('0x8')](interval['getIntervals']())['then'](realtime[_0xb505('0xa')]())[_0xb505('0x8')](openchannelQueue[_0xb505('0xb')]())['then'](realtime[_0xb505('0xc')]())['then'](chatQueue[_0xb505('0xd')]())[_0xb505('0x8')](realtime[_0xb505('0xe')]())[_0xb505('0x8')](smsQueue[_0xb505('0xf')]())[_0xb505('0x8')](realtime[_0xb505('0x10')]())[_0xb505('0x8')](mailQueue[_0xb505('0x11')]())['then'](realtime[_0xb505('0x12')]())[_0xb505('0x8')](faxQueue[_0xb505('0x13')]())['then'](realtime[_0xb505('0x14')]())['then'](whatsappQueue[_0xb505('0x15')]())[_0xb505('0x8')](realtime[_0xb505('0x16')]())[_0xb505('0x8')](function(){return realtime;});}function main(){return server[_0xb505('0x17')](realtime)['then'](function(_0x64959){return initRealtime();})[_0xb505('0x8')](function(_0x132439){return setInterval(initRealtime,0x1388);})[_0xb505('0x18')](function(_0x1c212c){console[_0xb505('0x19')](_0x1c212c);});}main(); \ No newline at end of file +var _0x2df4=['resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','listen','log','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x2df4,0x1ed));var _0x42df=function(_0x441fae,_0x3ab2ee){_0x441fae=_0x441fae-0x0;var _0x189025=_0x2df4[_0x441fae];return _0x189025;};'use strict';var BPromise=require(_0x42df('0x0'));var server=require(_0x42df('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x42df('0x2'));var openchannelQueue=require(_0x42df('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x42df('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x42df('0x5'));var whatsappQueue=require(_0x42df('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x42df('0x7')]()[_0x42df('0x8')](user[_0x42df('0x9')]())['then'](realtime['initAgents']())[_0x42df('0x8')](interval[_0x42df('0xa')]())[_0x42df('0x8')](realtime[_0x42df('0xb')]())[_0x42df('0x8')](openchannelQueue[_0x42df('0xc')]())['then'](realtime['initOpenchannelQueues']())[_0x42df('0x8')](chatQueue['getChatQueues']())[_0x42df('0x8')](realtime['initChatQueues']())[_0x42df('0x8')](smsQueue[_0x42df('0xd')]())[_0x42df('0x8')](realtime[_0x42df('0xe')]())['then'](mailQueue[_0x42df('0xf')]())[_0x42df('0x8')](realtime[_0x42df('0x10')]())[_0x42df('0x8')](faxQueue[_0x42df('0x11')]())[_0x42df('0x8')](realtime['initFaxQueues']())[_0x42df('0x8')](whatsappQueue['getWhatsappQueues']())[_0x42df('0x8')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x42df('0x12')](realtime)['then'](function(_0x42a183){return initRealtime();})['then'](function(_0x4921d8){return setInterval(initRealtime,0x1388);})['catch'](function(_0x32e1f6){console[_0x42df('0x13')](_0x32e1f6);});}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 52c3379..e9259fe 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 _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(_0x4791c6,_0x293adf){var _0x52b5d3=function(_0x172af3){while(--_0x172af3){_0x4791c6['push'](_0x4791c6['shift']());}};_0x52b5d3(++_0x293adf);}(_0x326f,0xd1));var _0xf326=function(_0x558be0,_0x32cf35){_0x558be0=_0x558be0-0x0;var _0x4ef627=_0x326f[_0x558be0];return _0x4ef627;};'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 +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x45334b,_0x16bc05){var _0x20317b=function(_0x5e97e2){while(--_0x5e97e2){_0x45334b['push'](_0x45334b['shift']());}};_0x20317b(++_0x16bc05);}(_0x2ef3,0xba));var _0x32ef=function(_0x485ce9,_0x1e20bd){_0x485ce9=_0x485ce9-0x0;var _0x2409de=_0x2ef3[_0x485ce9];return _0x2409de;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 8055982..4f0df73 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 _0x0cac=['http','request','then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client'];(function(_0x34763c,_0x5b5e08){var _0x4ecd0b=function(_0x186658){while(--_0x186658){_0x34763c['push'](_0x34763c['shift']());}};_0x4ecd0b(++_0x5b5e08);}(_0x0cac,0x1cc));var _0xc0ca=function(_0xf62f27,_0x249f1d){_0xf62f27=_0xf62f27-0x0;var _0x4f7985=_0x0cac[_0xf62f27];return _0x4f7985;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc0ca('0x0'));var client=jayson[_0xc0ca('0x1')][_0xc0ca('0x2')]({'port':0x232b});function request(_0x2fde5c,_0x20e86b){return new BPromise(function(_0x116ee2,_0x442cb6){return client[_0xc0ca('0x3')](_0x2fde5c,_0x20e86b)[_0xc0ca('0x4')](function(_0x3830b3){if(_0x3830b3[_0xc0ca('0x5')]){return _0x442cb6(_0x3830b3[_0xc0ca('0x5')][_0xc0ca('0x6')]);}else{return _0x116ee2(_0x3830b3[_0xc0ca('0x7')]);}})[_0xc0ca('0x8')](function(_0x22d791){return _0x442cb6(_0x22d791);});});}exports[_0xc0ca('0x9')]=function(_0x5bc4fb,_0x4095b0){return request(_0xc0ca('0xa'),{'account':_0x5bc4fb,'message':_0x4095b0});}; \ No newline at end of file +var _0x0ff6=['message','catch','SendMail','bluebird','jayson/promise','client','http','then','error'];(function(_0x4ee907,_0x1a01cd){var _0x54c113=function(_0x1d8182){while(--_0x1d8182){_0x4ee907['push'](_0x4ee907['shift']());}};_0x54c113(++_0x1a01cd);}(_0x0ff6,0xff));var _0x60ff=function(_0x10fc0b,_0x488fe1){_0x10fc0b=_0x10fc0b-0x0;var _0x118bdd=_0x0ff6[_0x10fc0b];return _0x118bdd;};'use strict';var BPromise=require(_0x60ff('0x0'));var jayson=require(_0x60ff('0x1'));var client=jayson[_0x60ff('0x2')][_0x60ff('0x3')]({'port':0x232b});function request(_0x34bf1f,_0xec05ee){return new BPromise(function(_0x4798b1,_0x35ae28){return client['request'](_0x34bf1f,_0xec05ee)[_0x60ff('0x4')](function(_0x2e069d){if(_0x2e069d[_0x60ff('0x5')]){return _0x35ae28(_0x2e069d[_0x60ff('0x5')][_0x60ff('0x6')]);}else{return _0x4798b1(_0x2e069d['result']);}})[_0x60ff('0x7')](function(_0x3e0c25){return _0x35ae28(_0x3e0c25);});});}exports['sendMailMessage']=function(_0x194fff,_0x10f100){return request(_0x60ff('0x8'),{'account':_0x194fff,'message':_0x10f100});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3ea8cbc..e08f1d4 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 _0xabc1=['working','idle','chat','openchannel','fax','sms','length','getChannelStatus','Status','StatusTime','format','mailStatus','mailStatusTime','smsCurrentCapacity','openchannelStatus','busyQueue','stringify','emit','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity'];(function(_0x150456,_0x47580a){var _0x4cfd5a=function(_0x392579){while(--_0x392579){_0x150456['push'](_0x150456['shift']());}};_0x4cfd5a(++_0x47580a);}(_0xabc1,0x13e));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1abc('0x0'));var moment=require(_0x1abc('0x1'));var md5=require(_0x1abc('0x2'));var Redis=require(_0x1abc('0x3'));var config=require(_0x1abc('0x4'));config[_0x1abc('0x5')]=_[_0x1abc('0x6')](config[_0x1abc('0x5')],{'host':_0x1abc('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1abc('0x5')]));function Agent(_0x3cd8a6){this['id']=_0x3cd8a6['id']||0x0;this['name']=_0x3cd8a6[_0x1abc('0x8')]||'';this[_0x1abc('0x9')]=_0x3cd8a6['online']||!![];this[_0x1abc('0xa')]=_0x3cd8a6[_0x1abc('0xa')]||![];this[_0x1abc('0xb')]=_0x3cd8a6[_0x1abc('0xb')]||![];this[_0x1abc('0xc')]=_0x3cd8a6[_0x1abc('0xc')]||![];this['faxPause']=_0x3cd8a6[_0x1abc('0xd')]||![];this['smsPause']=_0x3cd8a6[_0x1abc('0xe')]||![];this[_0x1abc('0xf')]=_0x3cd8a6[_0x1abc('0xf')]||![];this[_0x1abc('0x10')]=_0x1abc('0x11');this[_0x1abc('0x12')]=0x0;this[_0x1abc('0x13')]=_0x3cd8a6[_0x1abc('0x13')]||0x0;this[_0x1abc('0x14')]=0x0;this['mailStatus']=_0x1abc('0x11');this['mailStatusTime']=0x0;this[_0x1abc('0x15')]=_0x3cd8a6['mailCapacity']||0x0;this[_0x1abc('0x16')]=0x0;this[_0x1abc('0x17')]=_0x1abc('0x11');this[_0x1abc('0x18')]=0x0;this['faxCapacity']=_0x3cd8a6[_0x1abc('0x19')]||0x0;this[_0x1abc('0x1a')]=0x0;this[_0x1abc('0x1b')]=_0x1abc('0x11');this[_0x1abc('0x1c')]=0x0;this[_0x1abc('0x1d')]=_0x3cd8a6[_0x1abc('0x1d')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x1abc('0x11');this[_0x1abc('0x1e')]=0x0;this[_0x1abc('0x1f')]=_0x3cd8a6[_0x1abc('0x1f')]||0x0;this[_0x1abc('0x20')]=0x0;this['openchannelStatus']=_0x1abc('0x11');this[_0x1abc('0x21')]=0x0;this[_0x1abc('0x22')]=_0x3cd8a6[_0x1abc('0x22')]||0x0;this[_0x1abc('0x23')]=0x0;this[_0x1abc('0x24')]=![];this['busyQueue']=undefined;this[_0x1abc('0x2')]='';this[_0x1abc('0x25')]();}Agent[_0x1abc('0x26')]['getChannelStatus']=function(_0x42c6f5){if(this[_0x42c6f5+_0x1abc('0x27')]>0x0){if(this[_0x42c6f5+'Capacity']>0x0&&this[_0x42c6f5+'CurrentCapacity']>=this[_0x42c6f5+_0x1abc('0x28')]){return _0x1abc('0x29');}else{return _0x1abc('0x2a');}}else{return _0x1abc('0x2b');}};Agent[_0x1abc('0x26')][_0x1abc('0x25')]=function(){var _0x235d07=['mail',_0x1abc('0x2c'),_0x1abc('0x2d'),_0x1abc('0x2e'),_0x1abc('0x2f'),'whatsapp'];for(var _0x323d83=0x0;_0x323d83<_0x235d07[_0x1abc('0x30')];_0x323d83+=0x1){var _0x5a5c94=this[_0x1abc('0x31')](_0x235d07[_0x323d83]);if(this[_0x235d07[_0x323d83]+_0x1abc('0x32')]!==_0x5a5c94){this[_0x235d07[_0x323d83]+_0x1abc('0x33')]=_['toNumber'](moment()[_0x1abc('0x34')]('x'));}this[_0x235d07[_0x323d83]+_0x1abc('0x32')]=_0x5a5c94;}var _0x179585={'id':this['id'],'name':this[_0x1abc('0x8')],'online':this[_0x1abc('0x9')],'voicePause':this[_0x1abc('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x1abc('0xc')],'smsPause':this[_0x1abc('0xe')],'faxPause':this[_0x1abc('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x1abc('0x10')],'chatStatusTime':this[_0x1abc('0x12')],'chatCapacity':this[_0x1abc('0x13')],'chatCurrentCapacity':this[_0x1abc('0x14')],'mailStatus':this[_0x1abc('0x35')],'mailStatusTime':this[_0x1abc('0x36')],'mailCapacity':this[_0x1abc('0x15')],'mailCurrentCapacity':this[_0x1abc('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x1abc('0x18')],'faxCapacity':this[_0x1abc('0x19')],'faxCurrentCapacity':this[_0x1abc('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x1abc('0x37')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x1abc('0x1f')],'whatsappCurrentCapacity':this[_0x1abc('0x20')],'openchannelStatus':this[_0x1abc('0x38')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x1abc('0x23')],'busy':this['busy'],'busyQueue':this[_0x1abc('0x39')]};var _0x514e9f=md5(JSON[_0x1abc('0x3a')](_0x179585));if(this[_0x1abc('0x2')]!==_0x514e9f){this[_0x1abc('0x2')]=_0x514e9f;io[_0x1abc('0x3b')]('user:save',_0x179585);}};module['exports']=Agent; \ No newline at end of file +var _0xb033=['smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','sms','length','getChannelStatus','Status','StatusTime','format','chatStatus','chatStatusTime','chatCurrentCapacity','faxStatus','faxCurrentCapacity','smsStatus','whatsappCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity'];(function(_0x1cc134,_0x251b30){var _0x55ce25=function(_0x2a7e0f){while(--_0x2a7e0f){_0x1cc134['push'](_0x1cc134['shift']());}};_0x55ce25(++_0x251b30);}(_0xb033,0x9f));var _0x3b03=function(_0x3a915c,_0x5d1b4e){_0x3a915c=_0x3a915c-0x0;var _0x18d97f=_0xb033[_0x3a915c];return _0x18d97f;};'use strict';var _=require(_0x3b03('0x0'));var moment=require(_0x3b03('0x1'));var md5=require(_0x3b03('0x2'));var Redis=require(_0x3b03('0x3'));var config=require(_0x3b03('0x4'));config[_0x3b03('0x5')]=_[_0x3b03('0x6')](config[_0x3b03('0x5')],{'host':_0x3b03('0x7'),'port':0x18eb});var io=require(_0x3b03('0x8'))(new Redis(config[_0x3b03('0x5')]));function Agent(_0x1de960){this['id']=_0x1de960['id']||0x0;this[_0x3b03('0x9')]=_0x1de960['name']||'';this[_0x3b03('0xa')]=_0x1de960[_0x3b03('0xa')]||!![];this['voicePause']=_0x1de960[_0x3b03('0xb')]||![];this['chatPause']=_0x1de960[_0x3b03('0xc')]||![];this[_0x3b03('0xd')]=_0x1de960[_0x3b03('0xd')]||![];this[_0x3b03('0xe')]=_0x1de960[_0x3b03('0xe')]||![];this['smsPause']=_0x1de960[_0x3b03('0xf')]||![];this[_0x3b03('0x10')]=_0x1de960['openchannelPause']||![];this['chatStatus']=_0x3b03('0x11');this['chatStatusTime']=0x0;this[_0x3b03('0x12')]=_0x1de960[_0x3b03('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x3b03('0x13')]=_0x3b03('0x11');this[_0x3b03('0x14')]=0x0;this[_0x3b03('0x15')]=_0x1de960['mailCapacity']||0x0;this[_0x3b03('0x16')]=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0x3b03('0x17')]=_0x1de960[_0x3b03('0x17')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']='unknown';this[_0x3b03('0x18')]=0x0;this['smsCapacity']=_0x1de960[_0x3b03('0x19')]||0x0;this[_0x3b03('0x1a')]=0x0;this[_0x3b03('0x1b')]=_0x3b03('0x11');this[_0x3b03('0x1c')]=0x0;this[_0x3b03('0x1d')]=_0x1de960[_0x3b03('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x3b03('0x1e')]=_0x3b03('0x11');this[_0x3b03('0x1f')]=0x0;this[_0x3b03('0x20')]=_0x1de960[_0x3b03('0x20')]||0x0;this[_0x3b03('0x21')]=0x0;this[_0x3b03('0x22')]=![];this[_0x3b03('0x23')]=undefined;this[_0x3b03('0x2')]='';this[_0x3b03('0x24')]();}Agent['prototype']['getChannelStatus']=function(_0x38c14f){if(this[_0x38c14f+_0x3b03('0x25')]>0x0){if(this[_0x38c14f+_0x3b03('0x26')]>0x0&&this[_0x38c14f+'CurrentCapacity']>=this[_0x38c14f+'Capacity']){return _0x3b03('0x27');}else{return _0x3b03('0x28');}}else{return _0x3b03('0x29');}};Agent[_0x3b03('0x2a')][_0x3b03('0x24')]=function(){var _0x71fd39=[_0x3b03('0x2b'),'chat','openchannel','fax',_0x3b03('0x2c'),'whatsapp'];for(var _0x52b184=0x0;_0x52b184<_0x71fd39[_0x3b03('0x2d')];_0x52b184+=0x1){var _0x53a159=this[_0x3b03('0x2e')](_0x71fd39[_0x52b184]);if(this[_0x71fd39[_0x52b184]+_0x3b03('0x2f')]!==_0x53a159){this[_0x71fd39[_0x52b184]+_0x3b03('0x30')]=_['toNumber'](moment()[_0x3b03('0x31')]('x'));}this[_0x71fd39[_0x52b184]+_0x3b03('0x2f')]=_0x53a159;}var _0x3e0ead={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x3b03('0xb')],'chatPause':this[_0x3b03('0xc')],'mailPause':this[_0x3b03('0xd')],'smsPause':this[_0x3b03('0xf')],'faxPause':this[_0x3b03('0xe')],'openchannelPause':this[_0x3b03('0x10')],'chatStatus':this[_0x3b03('0x32')],'chatStatusTime':this[_0x3b03('0x33')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x3b03('0x34')],'mailStatus':this[_0x3b03('0x13')],'mailStatusTime':this[_0x3b03('0x14')],'mailCapacity':this[_0x3b03('0x15')],'mailCurrentCapacity':this[_0x3b03('0x16')],'faxStatus':this[_0x3b03('0x35')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x3b03('0x17')],'faxCurrentCapacity':this[_0x3b03('0x36')],'smsStatus':this[_0x3b03('0x37')],'smsStatusTime':this[_0x3b03('0x18')],'smsCapacity':this[_0x3b03('0x19')],'smsCurrentCapacity':this[_0x3b03('0x1a')],'whatsappStatus':this[_0x3b03('0x1b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x3b03('0x38')],'openchannelStatus':this[_0x3b03('0x1e')],'openchannelStatusTime':this[_0x3b03('0x1f')],'openchannelCapacity':this[_0x3b03('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x3b03('0x23')]};var _0x4627f6=md5(JSON[_0x3b03('0x39')](_0x3e0ead));if(this[_0x3b03('0x2')]!==_0x4627f6){this['md5']=_0x4627f6;io[_0x3b03('0x3a')](_0x3b03('0x3b'),_0x3e0ead);}};module[_0x3b03('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 39b2f62..1f95962 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 _0xce66=['util','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports'];(function(_0x5e4380,_0x28404f){var _0x5f3e4f=function(_0x5ca95f){while(--_0x5ca95f){_0x5e4380['push'](_0x5e4380['shift']());}};_0x5f3e4f(++_0x28404f);}(_0xce66,0x1d4));var _0x6ce6=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0xce66[_0x3d8d0a];return _0x5b9df5;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6ce6('0x0'));var Redis=require('ioredis');var config=require(_0x6ce6('0x1'));config['redis']=_['defaults'](config[_0x6ce6('0x2')],{'host':_0x6ce6('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6ce6('0x2')]));function ChatQueue(_0x4eafe2){this['id']=_0x4eafe2['id']||0x0;this[_0x6ce6('0x4')]=_0x4eafe2['name']||'';this[_0x6ce6('0x5')]=_0x4eafe2['timeout']||0xa;this[_0x6ce6('0x6')]=_0x4eafe2['strategy']||'beepall';this['Agents']=_0x4eafe2[_0x6ce6('0x7')];this[_0x6ce6('0x8')]={};this['waiting']=0x0;this[_0x6ce6('0x9')]='';this[_0x6ce6('0xa')]();this[_0x6ce6('0xb')]();}ChatQueue['prototype'][_0x6ce6('0xa')]=function(){var _0x3e1558=this[_0x6ce6('0x8')][_0x6ce6('0xc')];this[_0x6ce6('0x8')]=_[_0x6ce6('0xd')](this[_0x6ce6('0x7')],'id');this[_0x6ce6('0x8')]['_rr']=_0x3e1558;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x6ce6('0xe')]=0x0;this[_0x6ce6('0xf')]=0x0;for(var _0x3f8cd2=0x0;_0x3f8cd2=0x0?this[_0x6ce6('0x12')]:0x0;var _0x1321a2={'id':this['id'],'available':this[_0x6ce6('0x12')],'loggedIn':this['loggedIn'],'name':this[_0x6ce6('0x4')],'paused':this[_0x6ce6('0xf')],'waiting':this[_0x6ce6('0x13')]};var _0x3b8818=md5(JSON[_0x6ce6('0x14')](_0x1321a2));if(this['md5']!==_0x3b8818){this['md5']=_0x3b8818;io['to'](util[_0x6ce6('0x15')](_0x6ce6('0x16'),_0x1321a2[_0x6ce6('0x4')]))[_0x6ce6('0x17')](_0x6ce6('0x18'),_0x1321a2);}};module[_0x6ce6('0x19')]=ChatQueue; \ No newline at end of file +var _0x2b46=['socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x291edb,_0x1aba82){var _0x4d41d0=function(_0x3cb01e){while(--_0x3cb01e){_0x291edb['push'](_0x291edb['shift']());}};_0x4d41d0(++_0x1aba82);}(_0x2b46,0x11d));var _0x62b4=function(_0x22c574,_0x11da72){_0x22c574=_0x22c574-0x0;var _0xfbe305=_0x2b46[_0x22c574];return _0xfbe305;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x62b4('0x0'));var config=require(_0x62b4('0x1'));config[_0x62b4('0x2')]=_[_0x62b4('0x3')](config[_0x62b4('0x2')],{'host':_0x62b4('0x4'),'port':0x18eb});var io=require(_0x62b4('0x5'))(new Redis(config['redis']));function ChatQueue(_0x2b46ae){this['id']=_0x2b46ae['id']||0x0;this['name']=_0x2b46ae[_0x62b4('0x6')]||'';this['timeout']=_0x2b46ae['timeout']||0xa;this[_0x62b4('0x7')]=_0x2b46ae['strategy']||_0x62b4('0x8');this[_0x62b4('0x9')]=_0x2b46ae[_0x62b4('0x9')];this[_0x62b4('0xa')]={};this['waiting']=0x0;this[_0x62b4('0xb')]='';this[_0x62b4('0xc')]();this[_0x62b4('0xd')]();}ChatQueue[_0x62b4('0xe')][_0x62b4('0xc')]=function(){var _0x323ae0=this[_0x62b4('0xa')][_0x62b4('0xf')];this[_0x62b4('0xa')]=_[_0x62b4('0x10')](this[_0x62b4('0x9')],'id');this[_0x62b4('0xa')][_0x62b4('0xf')]=_0x323ae0;};ChatQueue[_0x62b4('0xe')][_0x62b4('0xd')]=function(){this[_0x62b4('0x11')]=0x0;this[_0x62b4('0x12')]=0x0;for(var _0xa16b56=0x0;_0xa16b56=0x0?this[_0x62b4('0x15')]:0x0;var _0x2c18e9={'id':this['id'],'available':this[_0x62b4('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x62b4('0x16')]};var _0x30d8a8=md5(JSON[_0x62b4('0x17')](_0x2c18e9));if(this[_0x62b4('0xb')]!==_0x30d8a8){this['md5']=_0x30d8a8;io['to'](util[_0x62b4('0x18')](_0x62b4('0x19'),_0x2c18e9[_0x62b4('0x6')]))[_0x62b4('0x1a')](_0x62b4('0x1b'),_0x2c18e9);}};module[_0x62b4('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 9659262..56bb95b 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 _0x47fd=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax_queue:save','lodash'];(function(_0x4086bd,_0x19bee6){var _0xc504fd=function(_0x2746fc){while(--_0x2746fc){_0x4086bd['push'](_0x4086bd['shift']());}};_0xc504fd(++_0x19bee6);}(_0x47fd,0x1b2));var _0xd47f=function(_0x3b95ac,_0x58738b){_0x3b95ac=_0x3b95ac-0x0;var _0x4a777b=_0x47fd[_0x3b95ac];return _0x4a777b;};'use strict';var _=require(_0xd47f('0x0'));var md5=require('md5');var util=require(_0xd47f('0x1'));var Redis=require(_0xd47f('0x2'));var config=require(_0xd47f('0x3'));config[_0xd47f('0x4')]=_[_0xd47f('0x5')](config[_0xd47f('0x4')],{'host':_0xd47f('0x6'),'port':0x18eb});var io=require(_0xd47f('0x7'))(new Redis(config[_0xd47f('0x4')]));function FaxQueue(_0x158982){this['id']=_0x158982['id']||0x0;this['name']=_0x158982[_0xd47f('0x8')]||'';this[_0xd47f('0x9')]=_0x158982['timeout']||0xa;this['strategy']=_0x158982[_0xd47f('0xa')]||_0xd47f('0xb');this[_0xd47f('0xc')]=_0x158982[_0xd47f('0xc')];this[_0xd47f('0xd')]={};this[_0xd47f('0xe')]=0x0;this[_0xd47f('0xf')]='';this[_0xd47f('0x10')]();this[_0xd47f('0x11')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x500b59=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xd47f('0x12')](this[_0xd47f('0xc')],'id');this[_0xd47f('0xd')][_0xd47f('0x13')]=_0x500b59;};FaxQueue['prototype'][_0xd47f('0x11')]=function(){this[_0xd47f('0x14')]=0x0;this[_0xd47f('0x15')]=0x0;for(var _0x4fcbd5=0x0;_0x4fcbd5=0x0?this[_0xd47f('0x19')]:0x0;var _0x1fddc4={'id':this['id'],'available':this[_0xd47f('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xd47f('0x8')],'paused':this[_0xd47f('0x15')],'waiting':this[_0xd47f('0xe')]};var _0x526004=md5(JSON[_0xd47f('0x1a')](_0x1fddc4));if(this[_0xd47f('0xf')]!==_0x526004){this[_0xd47f('0xf')]=_0x526004;io['to'](util[_0xd47f('0x1b')]('fax:queue:%s',_0x1fddc4[_0xd47f('0x8')]))['emit'](_0xd47f('0x1c'),_0x1fddc4);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xb633=['emit','fax_queue:save','md5','ioredis','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','faxPause','available','name','waiting','format','fax:queue:%s'];(function(_0x2744a3,_0x14a7fb){var _0x1b3aa6=function(_0x88bcaa){while(--_0x88bcaa){_0x2744a3['push'](_0x2744a3['shift']());}};_0x1b3aa6(++_0x14a7fb);}(_0xb633,0xaa));var _0x3b63=function(_0x120d51,_0x3fbb18){_0x120d51=_0x120d51-0x0;var _0x26126e=_0xb633[_0x120d51];return _0x26126e;};'use strict';var _=require('lodash');var md5=require(_0x3b63('0x0'));var util=require('util');var Redis=require(_0x3b63('0x1'));var config=require('../../../config/environment');config['redis']=_[_0x3b63('0x2')](config[_0x3b63('0x3')],{'host':_0x3b63('0x4'),'port':0x18eb});var io=require(_0x3b63('0x5'))(new Redis(config[_0x3b63('0x3')]));function FaxQueue(_0x383972){this['id']=_0x383972['id']||0x0;this['name']=_0x383972['name']||'';this[_0x3b63('0x6')]=_0x383972[_0x3b63('0x6')]||0xa;this[_0x3b63('0x7')]=_0x383972[_0x3b63('0x7')]||_0x3b63('0x8');this[_0x3b63('0x9')]=_0x383972[_0x3b63('0x9')];this[_0x3b63('0xa')]={};this['waiting']=0x0;this[_0x3b63('0x0')]='';this[_0x3b63('0xb')]();this['updateRealtime']();}FaxQueue['prototype'][_0x3b63('0xb')]=function(){var _0x56b73d=this[_0x3b63('0xa')][_0x3b63('0xc')];this[_0x3b63('0xa')]=_[_0x3b63('0xd')](this[_0x3b63('0x9')],'id');this[_0x3b63('0xa')][_0x3b63('0xc')]=_0x56b73d;};FaxQueue[_0x3b63('0xe')][_0x3b63('0xf')]=function(){this[_0x3b63('0x10')]=0x0;this[_0x3b63('0x11')]=0x0;for(var _0x5ee060=0x0;_0x5ee060=0x0?this['available']:0x0;var _0x198050={'id':this['id'],'available':this[_0x3b63('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x3b63('0x16')],'paused':this[_0x3b63('0x11')],'waiting':this[_0x3b63('0x17')]};var _0x3f0866=md5(JSON['stringify'](_0x198050));if(this['md5']!==_0x3f0866){this[_0x3b63('0x0')]=_0x3f0866;io['to'](util[_0x3b63('0x18')](_0x3b63('0x19'),_0x198050[_0x3b63('0x16')]))[_0x3b63('0x1a')](_0x3b63('0x1b'),_0x198050);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 4512c2b..71d5ffa 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 _0x0982=['Intervals','exports','name'];(function(_0x3f46f3,_0x40156d){var _0x1d344b=function(_0xe74cad){while(--_0xe74cad){_0x3f46f3['push'](_0x3f46f3['shift']());}};_0x1d344b(++_0x40156d);}(_0x0982,0x1e5));var _0x2098=function(_0x3d8df4,_0x431d59){_0x3d8df4=_0x3d8df4-0x0;var _0x11d034=_0x0982[_0x3d8df4];return _0x11d034;};'use strict';function Interval(_0x35bdee){this['id']=_0x35bdee['id']||0x0;this[_0x2098('0x0')]=_0x35bdee[_0x2098('0x0')]||'';this[_0x2098('0x1')]=_0x35bdee['Intervals']||{};}module[_0x2098('0x2')]=Interval; \ No newline at end of file +var _0xff46=['Intervals','name'];(function(_0x47355b,_0x5cfb5f){var _0x587508=function(_0x5790a1){while(--_0x5790a1){_0x47355b['push'](_0x47355b['shift']());}};_0x587508(++_0x5cfb5f);}(_0xff46,0xe7));var _0x6ff4=function(_0x15b58b,_0x270745){_0x15b58b=_0x15b58b-0x0;var _0x3563e9=_0xff46[_0x15b58b];return _0x3563e9;};'use strict';function Interval(_0xe2e985){this['id']=_0xe2e985['id']||0x0;this['name']=_0xe2e985[_0x6ff4('0x0')]||'';this[_0x6ff4('0x1')]=_0xe2e985['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 5724a52..88f3ffc 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 _0xee6d=['paused','available','loggedIn','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','length','online','mailPause'];(function(_0xba44ea,_0x59fe7d){var _0x565459=function(_0x582f93){while(--_0x582f93){_0xba44ea['push'](_0xba44ea['shift']());}};_0x565459(++_0x59fe7d);}(_0xee6d,0x19b));var _0xdee6=function(_0x55b7b0,_0x2df366){_0x55b7b0=_0x55b7b0-0x0;var _0x231f56=_0xee6d[_0x55b7b0];return _0x231f56;};'use strict';var _=require(_0xdee6('0x0'));var md5=require(_0xdee6('0x1'));var util=require(_0xdee6('0x2'));var Redis=require(_0xdee6('0x3'));var config=require(_0xdee6('0x4'));config[_0xdee6('0x5')]=_['defaults'](config[_0xdee6('0x5')],{'host':_0xdee6('0x6'),'port':0x18eb});var io=require(_0xdee6('0x7'))(new Redis(config['redis']));function MailQueue(_0x5e08d2){this['id']=_0x5e08d2['id']||0x0;this['name']=_0x5e08d2[_0xdee6('0x8')]||'';this[_0xdee6('0x9')]=_0x5e08d2[_0xdee6('0x9')]||0xa;this[_0xdee6('0xa')]=_0x5e08d2['strategy']||_0xdee6('0xb');this['Agents']=_0x5e08d2['Agents'];this[_0xdee6('0xc')]={};this[_0xdee6('0xd')]=0x0;this[_0xdee6('0x1')]='';this[_0xdee6('0xe')]();this[_0xdee6('0xf')]();}MailQueue[_0xdee6('0x10')][_0xdee6('0xe')]=function(){var _0xe527dc=this['mapAgentsId']['_rr'];this[_0xdee6('0xc')]=_[_0xdee6('0x11')](this[_0xdee6('0x12')],'id');this[_0xdee6('0xc')][_0xdee6('0x13')]=_0xe527dc;};MailQueue[_0xdee6('0x10')][_0xdee6('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2851e0=0x0;_0x2851e0=0x0?this[_0xdee6('0x18')]:0x0;var _0x257cad={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdee6('0x19')],'name':this['name'],'paused':this[_0xdee6('0x17')],'waiting':this[_0xdee6('0xd')]};var _0x52a912=md5(JSON[_0xdee6('0x1a')](_0x257cad));if(this[_0xdee6('0x1')]!==_0x52a912){this[_0xdee6('0x1')]=_0x52a912;io['to'](util['format'](_0xdee6('0x1b'),_0x257cad[_0xdee6('0x8')]))[_0xdee6('0x1c')](_0xdee6('0x1d'),_0x257cad);}};module[_0xdee6('0x1e')]=MailQueue; \ No newline at end of file +var _0x7e2d=['available','stringify','mail:queue:%s','emit','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online'];(function(_0x3f994e,_0x6f0bb8){var _0x40dbcf=function(_0x1a7b09){while(--_0x1a7b09){_0x3f994e['push'](_0x3f994e['shift']());}};_0x40dbcf(++_0x6f0bb8);}(_0x7e2d,0xd0));var _0xd7e2=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x7e2d[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xd7e2('0x0'));var md5=require('md5');var util=require(_0xd7e2('0x1'));var Redis=require(_0xd7e2('0x2'));var config=require('../../../config/environment');config[_0xd7e2('0x3')]=_[_0xd7e2('0x4')](config[_0xd7e2('0x3')],{'host':_0xd7e2('0x5'),'port':0x18eb});var io=require(_0xd7e2('0x6'))(new Redis(config[_0xd7e2('0x3')]));function MailQueue(_0xe1c5af){this['id']=_0xe1c5af['id']||0x0;this[_0xd7e2('0x7')]=_0xe1c5af[_0xd7e2('0x7')]||'';this['timeout']=_0xe1c5af[_0xd7e2('0x8')]||0xa;this[_0xd7e2('0x9')]=_0xe1c5af[_0xd7e2('0x9')]||_0xd7e2('0xa');this['Agents']=_0xe1c5af[_0xd7e2('0xb')];this[_0xd7e2('0xc')]={};this[_0xd7e2('0xd')]=0x0;this[_0xd7e2('0xe')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xd7e2('0xf')][_0xd7e2('0x10')]=function(){var _0x4a3aa2=this[_0xd7e2('0xc')][_0xd7e2('0x11')];this[_0xd7e2('0xc')]=_[_0xd7e2('0x12')](this[_0xd7e2('0xb')],'id');this[_0xd7e2('0xc')][_0xd7e2('0x11')]=_0x4a3aa2;};MailQueue[_0xd7e2('0xf')][_0xd7e2('0x13')]=function(){this[_0xd7e2('0x14')]=0x0;this[_0xd7e2('0x15')]=0x0;for(var _0x5a7819=0x0;_0x5a7819=0x0?this[_0xd7e2('0x18')]:0x0;var _0x197dac={'id':this['id'],'available':this[_0xd7e2('0x18')],'loggedIn':this[_0xd7e2('0x14')],'name':this[_0xd7e2('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x180d7b=md5(JSON[_0xd7e2('0x19')](_0x197dac));if(this['md5']!==_0x180d7b){this[_0xd7e2('0xe')]=_0x180d7b;io['to'](util['format'](_0xd7e2('0x1a'),_0x197dac[_0xd7e2('0x7')]))[_0xd7e2('0x1b')]('mail_queue:save',_0x197dac);}};module[_0xd7e2('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b631a5b..213a578 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x2ef3,0xba));var _0x32ef=function(_0x1dcc79,_0x52a44b){_0x1dcc79=_0x1dcc79-0x0;var _0x1203fa=_0x2ef3[_0x1dcc79];return _0x1203fa;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x10ed05,_0x6a2997){var _0x489ad4=function(_0x597b4f){while(--_0x597b4f){_0x10ed05['push'](_0x10ed05['shift']());}};_0x489ad4(++_0x6a2997);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0x5fc3[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ac0d7e9..929b246 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 _0x26c2=['format','emit','sms_queue:save','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','smsPause','available','waiting','stringify'];(function(_0x58aac9,_0x311f52){var _0x5dbda6=function(_0x2bc13d){while(--_0x2bc13d){_0x58aac9['push'](_0x58aac9['shift']());}};_0x5dbda6(++_0x311f52);}(_0x26c2,0x130));var _0x226c=function(_0xb3b3c9,_0x1d748a){_0xb3b3c9=_0xb3b3c9-0x0;var _0x20a81a=_0x26c2[_0xb3b3c9];return _0x20a81a;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x226c('0x0'));var config=require(_0x226c('0x1'));config[_0x226c('0x2')]=_[_0x226c('0x3')](config['redis'],{'host':_0x226c('0x4'),'port':0x18eb});var io=require(_0x226c('0x5'))(new Redis(config['redis']));function SmsQueue(_0x1719ed){this['id']=_0x1719ed['id']||0x0;this[_0x226c('0x6')]=_0x1719ed[_0x226c('0x6')]||'';this[_0x226c('0x7')]=_0x1719ed[_0x226c('0x7')]||0xa;this['strategy']=_0x1719ed[_0x226c('0x8')]||_0x226c('0x9');this[_0x226c('0xa')]=_0x1719ed[_0x226c('0xa')];this[_0x226c('0xb')]={};this['waiting']=0x0;this[_0x226c('0xc')]='';this[_0x226c('0xd')]();this['updateRealtime']();}SmsQueue['prototype'][_0x226c('0xd')]=function(){var _0x1a5961=this[_0x226c('0xb')][_0x226c('0xe')];this[_0x226c('0xb')]=_[_0x226c('0xf')](this[_0x226c('0xa')],'id');this['mapAgentsId']['_rr']=_0x1a5961;};SmsQueue[_0x226c('0x10')][_0x226c('0x11')]=function(){this[_0x226c('0x12')]=0x0;this[_0x226c('0x13')]=0x0;for(var _0x4eb557=0x0;_0x4eb557=0x0?this['available']:0x0;var _0x36fa74={'id':this['id'],'available':this[_0x226c('0x17')],'loggedIn':this[_0x226c('0x12')],'name':this[_0x226c('0x6')],'paused':this['paused'],'waiting':this[_0x226c('0x18')]};var _0xb6417f=md5(JSON[_0x226c('0x19')](_0x36fa74));if(this[_0x226c('0xc')]!==_0xb6417f){this[_0x226c('0xc')]=_0xb6417f;io['to'](util[_0x226c('0x1a')]('sms:queue:%s',_0x36fa74[_0x226c('0x6')]))[_0x226c('0x1b')](_0x226c('0x1c'),_0x36fa74);}};module[_0x226c('0x1d')]=SmsQueue; \ No newline at end of file +var _0xe43c=['available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','prototype','_rr','map','Agents','updateRealtime','loggedIn','length','smsPause','paused'];(function(_0x29b43d,_0x5c70c3){var _0x4c2587=function(_0x3e0a7e){while(--_0x3e0a7e){_0x29b43d['push'](_0x29b43d['shift']());}};_0x4c2587(++_0x5c70c3);}(_0xe43c,0x180));var _0xce43=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe43c[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xce43('0x0'));var md5=require(_0xce43('0x1'));var util=require(_0xce43('0x2'));var Redis=require(_0xce43('0x3'));var config=require(_0xce43('0x4'));config[_0xce43('0x5')]=_['defaults'](config[_0xce43('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xce43('0x6'))(new Redis(config[_0xce43('0x5')]));function SmsQueue(_0xcec0ef){this['id']=_0xcec0ef['id']||0x0;this[_0xce43('0x7')]=_0xcec0ef['name']||'';this[_0xce43('0x8')]=_0xcec0ef['timeout']||0xa;this[_0xce43('0x9')]=_0xcec0ef['strategy']||_0xce43('0xa');this['Agents']=_0xcec0ef['Agents'];this[_0xce43('0xb')]={};this[_0xce43('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xce43('0xd')]['updateRouting']=function(){var _0x2f1926=this['mapAgentsId'][_0xce43('0xe')];this['mapAgentsId']=_[_0xce43('0xf')](this[_0xce43('0x10')],'id');this[_0xce43('0xb')][_0xce43('0xe')]=_0x2f1926;};SmsQueue[_0xce43('0xd')][_0xce43('0x11')]=function(){this[_0xce43('0x12')]=0x0;this['paused']=0x0;for(var _0x3034c7=0x0;_0x3034c7=0x0?this[_0xce43('0x16')]:0x0;var _0xbc38f0={'id':this['id'],'available':this[_0xce43('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xce43('0x7')],'paused':this[_0xce43('0x15')],'waiting':this[_0xce43('0xc')]};var _0x2506de=md5(JSON[_0xce43('0x17')](_0xbc38f0));if(this[_0xce43('0x1')]!==_0x2506de){this['md5']=_0x2506de;io['to'](util[_0xce43('0x18')](_0xce43('0x19'),_0xbc38f0['name']))[_0xce43('0x1a')](_0xce43('0x1b'),_0xbc38f0);}};module[_0xce43('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 8ca4bdc..d93eeb0 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 _0x5539=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','online','available','loggedIn','whatsapp:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x2e48c9,_0x4fd904){var _0x392a1c=function(_0x5dce14){while(--_0x5dce14){_0x2e48c9['push'](_0x2e48c9['shift']());}};_0x392a1c(++_0x4fd904);}(_0x5539,0x7e));var _0x9553=function(_0x5ea463,_0x1dd262){_0x5ea463=_0x5ea463-0x0;var _0xc476f7=_0x5539[_0x5ea463];return _0xc476f7;};'use strict';var _=require(_0x9553('0x0'));var md5=require(_0x9553('0x1'));var util=require(_0x9553('0x2'));var Redis=require(_0x9553('0x3'));var config=require(_0x9553('0x4'));config[_0x9553('0x5')]=_[_0x9553('0x6')](config[_0x9553('0x5')],{'host':_0x9553('0x7'),'port':0x18eb});var io=require(_0x9553('0x8'))(new Redis(config[_0x9553('0x5')]));function WhatsappQueue(_0x4acc0c){this['id']=_0x4acc0c['id']||0x0;this[_0x9553('0x9')]=_0x4acc0c[_0x9553('0x9')]||'';this['timeout']=_0x4acc0c[_0x9553('0xa')]||0xa;this[_0x9553('0xb')]=_0x4acc0c['strategy']||_0x9553('0xc');this[_0x9553('0xd')]=_0x4acc0c[_0x9553('0xd')];this[_0x9553('0xe')]={};this[_0x9553('0xf')]=0x0;this[_0x9553('0x1')]='';this[_0x9553('0x10')]();this[_0x9553('0x11')]();}WhatsappQueue[_0x9553('0x12')][_0x9553('0x10')]=function(){var _0x5ecc11=this[_0x9553('0xe')][_0x9553('0x13')];this['mapAgentsId']=_[_0x9553('0x14')](this[_0x9553('0xd')],'id');this[_0x9553('0xe')][_0x9553('0x13')]=_0x5ecc11;};WhatsappQueue[_0x9553('0x12')][_0x9553('0x11')]=function(){this['loggedIn']=0x0;this[_0x9553('0x15')]=0x0;for(var _0x5dee08=0x0;_0x5dee08=0x0?this[_0x9553('0x17')]:0x0;var _0x572de7={'id':this['id'],'available':this[_0x9553('0x17')],'loggedIn':this[_0x9553('0x18')],'name':this[_0x9553('0x9')],'paused':this[_0x9553('0x15')],'waiting':this[_0x9553('0xf')]};var _0x2bd83c=md5(JSON['stringify'](_0x572de7));if(this[_0x9553('0x1')]!==_0x2bd83c){this[_0x9553('0x1')]=_0x2bd83c;io['to'](util['format'](_0x9553('0x19'),_0x572de7['name']))['emit']('whatsapp_queue:save',_0x572de7);}};module[_0x9553('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x1d04=['strategy','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','length','online','whatsappPause','available','loggedIn','paused','stringify','format','whatsapp:queue:%s','emit','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x45c136,_0x4856d9){var _0x37e518=function(_0x206a0e){while(--_0x206a0e){_0x45c136['push'](_0x45c136['shift']());}};_0x37e518(++_0x4856d9);}(_0x1d04,0x1e4));var _0x41d0=function(_0x5d4e95,_0x578112){_0x5d4e95=_0x5d4e95-0x0;var _0x475873=_0x1d04[_0x5d4e95];return _0x475873;};'use strict';var _=require(_0x41d0('0x0'));var md5=require('md5');var util=require(_0x41d0('0x1'));var Redis=require(_0x41d0('0x2'));var config=require(_0x41d0('0x3'));config[_0x41d0('0x4')]=_['defaults'](config['redis'],{'host':_0x41d0('0x5'),'port':0x18eb});var io=require(_0x41d0('0x6'))(new Redis(config[_0x41d0('0x4')]));function WhatsappQueue(_0x3fac13){this['id']=_0x3fac13['id']||0x0;this[_0x41d0('0x7')]=_0x3fac13[_0x41d0('0x7')]||'';this[_0x41d0('0x8')]=_0x3fac13['timeout']||0xa;this[_0x41d0('0x9')]=_0x3fac13['strategy']||'beepall';this['Agents']=_0x3fac13[_0x41d0('0xa')];this[_0x41d0('0xb')]={};this[_0x41d0('0xc')]=0x0;this[_0x41d0('0xd')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x41d0('0xe')][_0x41d0('0xf')]=function(){var _0xf6b1c0=this[_0x41d0('0xb')][_0x41d0('0x10')];this['mapAgentsId']=_[_0x41d0('0x11')](this['Agents'],'id');this[_0x41d0('0xb')][_0x41d0('0x10')]=_0xf6b1c0;};WhatsappQueue[_0x41d0('0xe')][_0x41d0('0x12')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x418e3c=0x0;_0x418e3c=0x0?this[_0x41d0('0x16')]:0x0;var _0x23c743={'id':this['id'],'available':this[_0x41d0('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x41d0('0x18')],'waiting':this[_0x41d0('0xc')]};var _0x578dd0=md5(JSON[_0x41d0('0x19')](_0x23c743));if(this[_0x41d0('0xd')]!==_0x578dd0){this[_0x41d0('0xd')]=_0x578dd0;io['to'](util[_0x41d0('0x1a')](_0x41d0('0x1b'),_0x23c743[_0x41d0('0x7')]))[_0x41d0('0x1c')]('whatsapp_queue:save',_0x23c743);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 6b957a5..8ca8c9e 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x348c12,_0x21b811){var _0x5f70d9=function(_0x289a8b){while(--_0x289a8b){_0x348c12['push'](_0x348c12['shift']());}};_0x5f70d9(++_0x21b811);}(_0xb10b,0x12a));var _0xbb10=function(_0x323021,_0x30f030){_0x323021=_0x323021-0x0;var _0x52cb3e=_0xb10b[_0x323021];return _0x52cb3e;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 3918209..8b897c3 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 _0x2d90=['updateChatInteraction','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x2d90,0x1be));var _0x02d9=function(_0x3375af,_0x80eaf6){_0x3375af=_0x3375af-0x0;var _0x1c8e8e=_0x2d90[_0x3375af];return _0x1c8e8e;};'use strict';var client=require(_0x02d9('0x0'));exports[_0x02d9('0x1')]=function(_0x212a8f,_0x51d7fd){return client[_0x02d9('0x2')](_0x02d9('0x3'),{'body':_0x51d7fd,'options':{'where':{'id':_0x212a8f}},'log':_0x02d9('0x4')});};exports['addTags']=function(_0x72fc4a,_0x1cd5f3){return client['Request'](_0x02d9('0x5'),{'body':_0x1cd5f3,'options':{'where':{'id':_0x72fc4a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x675e=['addTagsToChatInteraction','../client','Request','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0xd98c11,_0x499d6e){var _0x4ed636=function(_0x38b7ef){while(--_0x38b7ef){_0xd98c11['push'](_0xd98c11['shift']());}};_0x4ed636(++_0x499d6e);}(_0x675e,0xbb));var _0xe675=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x675e[_0x467488];return _0x56107f;};'use strict';var client=require(_0xe675('0x0'));exports['update']=function(_0x2b2fd2,_0x4f4ca7){return client[_0xe675('0x1')]('UpdateChatInteraction',{'body':_0x4f4ca7,'options':{'where':{'id':_0x2b2fd2}},'log':_0xe675('0x2')});};exports[_0xe675('0x3')]=function(_0x2825e6,_0xbbfb1b){return client[_0xe675('0x1')](_0xe675('0x4'),{'body':_0xbbfb1b,'options':{'where':{'id':_0x2825e6}},'log':_0xe675('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 8649483..4b5ec31 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 _0x5293=['create','Request','CreateChatMessage'];(function(_0x59ad86,_0x5da65c){var _0x1541fb=function(_0x51ff53){while(--_0x51ff53){_0x59ad86['push'](_0x59ad86['shift']());}};_0x1541fb(++_0x5da65c);}(_0x5293,0x18f));var _0x3529=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x5293[_0x146a97];return _0x259d5c;};'use strict';var client=require('../client');exports[_0x3529('0x0')]=function(_0x57ce7f){return client[_0x3529('0x1')](_0x3529('0x2'),{'body':_0x57ce7f,'log':'createChatMessage'});}; \ No newline at end of file +var _0x97fa=['Request','createChatMessage','../client','create'];(function(_0x1dcfc4,_0x3d2cab){var _0x4d2f91=function(_0x2a0e5d){while(--_0x2a0e5d){_0x1dcfc4['push'](_0x1dcfc4['shift']());}};_0x4d2f91(++_0x3d2cab);}(_0x97fa,0x1b2));var _0xa97f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97fa[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa97f('0x0'));exports[_0xa97f('0x1')]=function(_0x17eb69){return client[_0xa97f('0x2')]('CreateChatMessage',{'body':_0x17eb69,'log':_0xa97f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 92f67f3..4c39a8c 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 _0x5e17=['chatPause','getChatQueues','../client','strategy','User','Agents','name','online'];(function(_0x3c9bcc,_0x3dc02a){var _0x16be46=function(_0xb6ef44){while(--_0xb6ef44){_0x3c9bcc['push'](_0x3c9bcc['shift']());}};_0x16be46(++_0x3dc02a);}(_0x5e17,0x17a));var _0x75e1=function(_0x3a1e58,_0x7bb384){_0x3a1e58=_0x3a1e58-0x0;var _0xbfedc3=_0x5e17[_0x3a1e58];return _0xbfedc3;};'use strict';var client=require(_0x75e1('0x0'));exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x75e1('0x1')],'include':[{'model':_0x75e1('0x2'),'as':_0x75e1('0x3'),'attributes':['id',_0x75e1('0x4'),_0x75e1('0x5'),_0x75e1('0x6')]}]},'log':_0x75e1('0x7')});};}; \ No newline at end of file +var _0x89fe=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents','name','online'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x89fe,0x83));var _0xe89f=function(_0x3e68a8,_0x3cb2b0){_0x3e68a8=_0x3e68a8-0x0;var _0x57c0a6=_0x89fe[_0x3e68a8];return _0x57c0a6;};'use strict';var client=require(_0xe89f('0x0'));exports[_0xe89f('0x1')]=function(){return function(){return client[_0xe89f('0x2')](_0xe89f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe89f('0x4'),_0xe89f('0x5')],'include':[{'model':'User','as':_0xe89f('0x6'),'attributes':['id',_0xe89f('0x7'),_0xe89f('0x8'),_0xe89f('0x9')]}]},'log':_0xe89f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e3e2aa8..37b140e 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 _0x710e=['update','UpdateChatQueueReport','../client','Request','CreateChatQueueReport'];(function(_0x244ec4,_0x5a3168){var _0x29a72c=function(_0x2031ca){while(--_0x2031ca){_0x244ec4['push'](_0x244ec4['shift']());}};_0x29a72c(++_0x5a3168);}(_0x710e,0xb6));var _0xe710=function(_0x434a25,_0x574375){_0x434a25=_0x434a25-0x0;var _0x4cbbad=_0x710e[_0x434a25];return _0x4cbbad;};'use strict';var client=require(_0xe710('0x0'));exports['create']=function(_0x57c30b){return client[_0xe710('0x1')](_0xe710('0x2'),{'body':_0x57c30b,'log':_0xe710('0x2')});};exports[_0xe710('0x3')]=function(_0x2f9eab,_0x4c22aa){return client[_0xe710('0x1')](_0xe710('0x4'),{'body':_0x4c22aa,'options':{'where':{'uniqueid':_0x2f9eab},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x0884=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4088('0x0'));exports[_0x4088('0x1')]=function(_0x1eb3d7){return client[_0x4088('0x2')](_0x4088('0x3'),{'body':_0x1eb3d7,'log':_0x4088('0x3')});};exports[_0x4088('0x4')]=function(_0x556d34,_0x3c15b9){return client[_0x4088('0x2')](_0x4088('0x5'),{'body':_0x3c15b9,'options':{'where':{'uniqueid':_0x556d34},'order':[['id',_0x4088('0x6')]],'limit':0x1},'log':_0x4088('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ea72b4c..c0684eb 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1c27eb,_0x34c900){var _0xc4ce2a=function(_0xa38fd7){while(--_0xa38fd7){_0x1c27eb['push'](_0x1c27eb['shift']());}};_0xc4ce2a(++_0x34c900);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x7a54,0x106));var _0x47a5=function(_0x536203,_0x5a74d1){_0x536203=_0x536203-0x0;var _0x46f947=_0x7a54[_0x536203];return _0x46f947;};'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 eba2bbc..e3aa627 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 _0xe430=['Request','CreateFaxMessage','create'];(function(_0x112782,_0x5dfa7b){var _0x4781fd=function(_0x396032){while(--_0x396032){_0x112782['push'](_0x112782['shift']());}};_0x4781fd(++_0x5dfa7b);}(_0xe430,0xe9));var _0x0e43=function(_0xfd3673,_0xa8ada8){_0xfd3673=_0xfd3673-0x0;var _0x44ef0b=_0xe430[_0xfd3673];return _0x44ef0b;};'use strict';var client=require('../client');exports[_0x0e43('0x0')]=function(_0x4544fc){return client[_0x0e43('0x1')](_0x0e43('0x2'),{'body':_0x4544fc,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x8ed6=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x55e605,_0x162ddb){var _0x20c0cc=function(_0x5737cb){while(--_0x5737cb){_0x55e605['push'](_0x55e605['shift']());}};_0x20c0cc(++_0x162ddb);}(_0x8ed6,0x116));var _0x68ed=function(_0xd91c52,_0x3290e5){_0xd91c52=_0xd91c52-0x0;var _0x403c24=_0x8ed6[_0xd91c52];return _0x403c24;};'use strict';var client=require('../client');exports[_0x68ed('0x0')]=function(_0x485314){return client[_0x68ed('0x1')](_0x68ed('0x2'),{'body':_0x485314,'log':_0x68ed('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1710bef..2602170 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 _0xd015=['../client','getFaxQueues','name','timeout','strategy','online'];(function(_0x77f2fb,_0x206a39){var _0x4c9280=function(_0x27ceb5){while(--_0x27ceb5){_0x77f2fb['push'](_0x77f2fb['shift']());}};_0x4c9280(++_0x206a39);}(_0xd015,0x168));var _0x5d01=function(_0x41886e,_0x2f9b3e){_0x41886e=_0x41886e-0x0;var _0x10e7f4=_0xd015[_0x41886e];return _0x10e7f4;};'use strict';var client=require(_0x5d01('0x0'));exports[_0x5d01('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x5d01('0x2'),_0x5d01('0x3'),_0x5d01('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x5d01('0x2'),_0x5d01('0x5'),'faxPause']}]},'log':_0x5d01('0x1')});};}; \ No newline at end of file +var _0x3ce4=['online','getFaxQueues','Request','GetFaxQueue','timeout','User','Agents','name'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3ce4,0xe9));var _0x43ce=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x3ce4[_0x1203f];return _0x365f0a;};'use strict';var client=require('../client');exports[_0x43ce('0x0')]=function(){return function(){return client[_0x43ce('0x1')](_0x43ce('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x43ce('0x3'),'strategy'],'include':[{'model':_0x43ce('0x4'),'as':_0x43ce('0x5'),'attributes':['id',_0x43ce('0x6'),_0x43ce('0x7'),'faxPause']}]},'log':_0x43ce('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2025dde..16904ae 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 _0xf97f=['Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update'];(function(_0x36eae2,_0x58ca77){var _0x380ddc=function(_0xf0484f){while(--_0xf0484f){_0x36eae2['push'](_0x36eae2['shift']());}};_0x380ddc(++_0x58ca77);}(_0xf97f,0xc7));var _0xff97=function(_0x259065,_0x4e2415){_0x259065=_0x259065-0x0;var _0x8e84f2=_0xf97f[_0x259065];return _0x8e84f2;};'use strict';var client=require(_0xff97('0x0'));exports[_0xff97('0x1')]=function(_0x4b20c8){return client['Request']('CreateFaxQueueReport',{'body':_0x4b20c8,'log':_0xff97('0x2')});};exports[_0xff97('0x3')]=function(_0x4e3865,_0x3439cd){return client[_0xff97('0x4')](_0xff97('0x5'),{'body':_0x3439cd,'options':{'where':{'uniqueid':_0x4e3865},'order':[['id',_0xff97('0x6')]],'limit':0x1},'log':_0xff97('0x5')});}; \ No newline at end of file +var _0x5057=['UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update','Request'];(function(_0x376b88,_0x5706e6){var _0x43ce83=function(_0x18ea7b){while(--_0x18ea7b){_0x376b88['push'](_0x376b88['shift']());}};_0x43ce83(++_0x5706e6);}(_0x5057,0x151));var _0x7505=function(_0x3acd48,_0x216d4f){_0x3acd48=_0x3acd48-0x0;var _0x2e4bbf=_0x5057[_0x3acd48];return _0x2e4bbf;};'use strict';var client=require(_0x7505('0x0'));exports[_0x7505('0x1')]=function(_0x1c287c){return client['Request'](_0x7505('0x2'),{'body':_0x1c287c,'log':_0x7505('0x2')});};exports[_0x7505('0x3')]=function(_0x2a1972,_0x4c1825){return client[_0x7505('0x4')](_0x7505('0x5'),{'body':_0x4c1825,'options':{'where':{'uniqueid':_0x2a1972},'order':[['id','DESC']],'limit':0x1},'log':_0x7505('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 80d31d6..008e8c1 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 _0xad2c=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x39cb7b,_0x27e1dd){var _0xd28b85=function(_0x2a9237){while(--_0x2a9237){_0x39cb7b['push'](_0x39cb7b['shift']());}};_0xd28b85(++_0x27e1dd);}(_0xad2c,0x148));var _0xcad2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xad2c[_0x160c73];return _0xd9302;};'use strict';var client=require(_0xcad2('0x0'));exports[_0xcad2('0x1')]=function(){return function(){return client[_0xcad2('0x2')](_0xcad2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcad2('0x4')],'include':[{'model':_0xcad2('0x5'),'as':_0xcad2('0x6'),'attributes':['id',_0xcad2('0x4'),_0xcad2('0x7')]}]},'log':_0xcad2('0x1')});};}; \ No newline at end of file +var _0x5e8c=['interval','getIntervals','Request','GetInterval','name','Intervals'];(function(_0x2c8d5b,_0x10ddec){var _0x273ad0=function(_0x3ee373){while(--_0x3ee373){_0x2c8d5b['push'](_0x2c8d5b['shift']());}};_0x273ad0(++_0x10ddec);}(_0x5e8c,0xfd));var _0xc5e8=function(_0x4d34b5,_0x10e2db){_0x4d34b5=_0x4d34b5-0x0;var _0x5046f0=_0x5e8c[_0x4d34b5];return _0x5046f0;};'use strict';var client=require('../client');exports[_0xc5e8('0x0')]=function(){return function(){return client[_0xc5e8('0x1')](_0xc5e8('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc5e8('0x3')],'include':[{'model':'Interval','as':_0xc5e8('0x4'),'attributes':['id',_0xc5e8('0x3'),_0xc5e8('0x5')]}]},'log':_0xc5e8('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e911dc5..5136e49 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 _0xe2cf=['addTags','Request','AddTagsToMailInteraction','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x59af24,_0x201f0e){_0x59af24=_0x59af24-0x0;var _0x5d79d4=_0xe2cf[_0x59af24];return _0x5d79d4;};'use strict';var client=require('../client');exports[_0xfe2c('0x0')]=function(_0x546786,_0x11c3a4){return client['Request'](_0xfe2c('0x1'),{'body':_0x11c3a4,'options':{'where':{'id':_0x546786}},'log':_0xfe2c('0x2')});};exports[_0xfe2c('0x3')]=function(_0x11b6b8,_0x494978){return client[_0xfe2c('0x4')](_0xfe2c('0x5'),{'body':_0x494978,'options':{'where':{'id':_0x11b6b8}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x2a07=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2a07,0x74));var _0x72a0=function(_0xa339a9,_0x342371){_0xa339a9=_0xa339a9-0x0;var _0x125a36=_0x2a07[_0xa339a9];return _0x125a36;};'use strict';var client=require(_0x72a0('0x0'));exports[_0x72a0('0x1')]=function(_0x3ed8a9,_0x437db4){return client[_0x72a0('0x2')]('UpdateMailInteraction',{'body':_0x437db4,'options':{'where':{'id':_0x3ed8a9}},'log':_0x72a0('0x3')});};exports[_0x72a0('0x4')]=function(_0x135982,_0x45b155){return client[_0x72a0('0x2')](_0x72a0('0x5'),{'body':_0x45b155,'options':{'where':{'id':_0x135982}},'log':_0x72a0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 834dea5..3ae659d 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 _0x1b09=['Request','CreateMailMessage','createMailMessage','create'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x1b09,0x6b));var _0x91b0=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x1b09[_0x2d9e27];return _0xd35381;};'use strict';var client=require('../client');exports[_0x91b0('0x0')]=function(_0x1d3582){return client[_0x91b0('0x1')](_0x91b0('0x2'),{'body':_0x1d3582,'log':_0x91b0('0x3')});}; \ No newline at end of file +var _0x6aaa=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6aaa,0x98));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa6aa('0x0'));exports[_0xa6aa('0x1')]=function(_0x31c3a2){return client['Request'](_0xa6aa('0x2'),{'body':_0x31c3a2,'log':_0xa6aa('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7f7c240..9c8845e 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 _0x04d2=['Request','GetMailQueue','name','strategy','User','Agents','mailPause','../client','getMailQueues'];(function(_0x4a034d,_0x54d537){var _0x36353e=function(_0x3cc6e8){while(--_0x3cc6e8){_0x4a034d['push'](_0x4a034d['shift']());}};_0x36353e(++_0x54d537);}(_0x04d2,0x1e4));var _0x204d=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0x04d2[_0x5d8631];return _0x34c15e;};'use strict';var client=require(_0x204d('0x0'));exports[_0x204d('0x1')]=function(){return function(){return client[_0x204d('0x2')](_0x204d('0x3'),{'options':{'raw':![],'attributes':['id',_0x204d('0x4'),'timeout',_0x204d('0x5')],'include':[{'model':_0x204d('0x6'),'as':_0x204d('0x7'),'attributes':['id',_0x204d('0x4'),'online',_0x204d('0x8')]}]},'log':_0x204d('0x1')});};}; \ No newline at end of file +var _0xd9a4=['strategy','User','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0xb22e43,_0x21d093){var _0x232da3=function(_0x5bed00){while(--_0x5bed00){_0xb22e43['push'](_0xb22e43['shift']());}};_0x232da3(++_0x21d093);}(_0xd9a4,0x82));var _0x4d9a=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xd9a4[_0xd0b415];return _0x2bdf2c;};'use strict';var client=require(_0x4d9a('0x0'));exports[_0x4d9a('0x1')]=function(){return function(){return client[_0x4d9a('0x2')](_0x4d9a('0x3'),{'options':{'raw':![],'attributes':['id',_0x4d9a('0x4'),'timeout',_0x4d9a('0x5')],'include':[{'model':_0x4d9a('0x6'),'as':'Agents','attributes':['id',_0x4d9a('0x4'),_0x4d9a('0x7'),_0x4d9a('0x8')]}]},'log':_0x4d9a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 30aacbe..b723ca3 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 _0x7861=['UpdateMailQueueReport','../client','Request','CreateMailQueueReport','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7861,0x119));var _0x1786=function(_0x4777f9,_0x1cd64){_0x4777f9=_0x4777f9-0x0;var _0x1d8c94=_0x7861[_0x4777f9];return _0x1d8c94;};'use strict';var client=require(_0x1786('0x0'));exports['create']=function(_0x54626c){return client[_0x1786('0x1')](_0x1786('0x2'),{'body':_0x54626c,'log':'CreateMailQueueReport'});};exports[_0x1786('0x3')]=function(_0x5c3f56,_0x25680c){return client[_0x1786('0x1')](_0x1786('0x4'),{'body':_0x25680c,'options':{'where':{'uniqueid':_0x5c3f56},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xf219=['Request','DESC','UpdateMailQueueReport','create'];(function(_0x4e09bd,_0x2ef692){var _0x16d7fb=function(_0x14d1db){while(--_0x14d1db){_0x4e09bd['push'](_0x4e09bd['shift']());}};_0x16d7fb(++_0x2ef692);}(_0xf219,0x1ef));var _0x9f21=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0xf219[_0x2cc569];return _0x1bfc2e;};'use strict';var client=require('../client');exports[_0x9f21('0x0')]=function(_0x48504d){return client['Request']('CreateMailQueueReport',{'body':_0x48504d,'log':'CreateMailQueueReport'});};exports['update']=function(_0x1d1fff,_0x2f4cb6){return client[_0x9f21('0x1')]('UpdateMailQueueReport',{'body':_0x2f4cb6,'options':{'where':{'uniqueid':_0x1d1fff},'order':[['id',_0x9f21('0x2')]],'limit':0x1},'log':_0x9f21('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 4e8e5b2..5cf677c 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 _0xdd4f=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x482a85,_0x667d3e){var _0x1377a1=function(_0x1cc53a){while(--_0x1cc53a){_0x482a85['push'](_0x482a85['shift']());}};_0x1377a1(++_0x667d3e);}(_0xdd4f,0x13e));var _0xfdd4=function(_0x1b24c8,_0x4f1cbc){_0x1b24c8=_0x1b24c8-0x0;var _0x2077bf=_0xdd4f[_0x1b24c8];return _0x2077bf;};'use strict';var client=require('../client');exports[_0xfdd4('0x0')]=function(_0x160ebc,_0x198fd8){return client[_0xfdd4('0x1')](_0xfdd4('0x2'),{'body':_0x198fd8,'options':{'where':{'id':_0x160ebc}},'log':_0xfdd4('0x3')});};exports[_0xfdd4('0x4')]=function(_0x78b56c,_0x5d6fc8){return client['Request'](_0xfdd4('0x5'),{'body':_0x5d6fc8,'options':{'where':{'id':_0x78b56c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xc1c3=['UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x4ec027,_0x2b001c){var _0x5447e4=function(_0x29f0cf){while(--_0x29f0cf){_0x4ec027['push'](_0x4ec027['shift']());}};_0x5447e4(++_0x2b001c);}(_0xc1c3,0xc7));var _0x3c1c=function(_0x3ea7a5,_0x59e8e8){_0x3ea7a5=_0x3ea7a5-0x0;var _0x165fe5=_0xc1c3[_0x3ea7a5];return _0x165fe5;};'use strict';var client=require('../client');exports[_0x3c1c('0x0')]=function(_0x4115da,_0x2b8992){return client['Request'](_0x3c1c('0x1'),{'body':_0x2b8992,'options':{'where':{'id':_0x4115da}},'log':'updateOpenchannelInteraction'});};exports[_0x3c1c('0x2')]=function(_0x1e3445,_0x26e3a2){return client['Request'](_0x3c1c('0x3'),{'body':_0x26e3a2,'options':{'where':{'id':_0x1e3445}},'log':_0x3c1c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2f38d00..1b752d5 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 _0x4d08=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x329b62,_0x45f020){var _0x4c66c2=function(_0xf7eb79){while(--_0xf7eb79){_0x329b62['push'](_0x329b62['shift']());}};_0x4c66c2(++_0x45f020);}(_0x4d08,0x1ba));var _0x84d0=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x4d08[_0x437d7f];return _0x31058c;};'use strict';var client=require(_0x84d0('0x0'));exports[_0x84d0('0x1')]=function(_0x439f29){return client[_0x84d0('0x2')](_0x84d0('0x3'),{'body':_0x439f29,'log':_0x84d0('0x4')});}; \ No newline at end of file +var _0x60aa=['CreateOpenchannelMessage','createOpenchannelMessage','../client','Request'];(function(_0x40b63a,_0x3e29ba){var _0x375fe0=function(_0x39f21f){while(--_0x39f21f){_0x40b63a['push'](_0x40b63a['shift']());}};_0x375fe0(++_0x3e29ba);}(_0x60aa,0x186));var _0xa60a=function(_0x32506f,_0x373192){_0x32506f=_0x32506f-0x0;var _0x1e6b33=_0x60aa[_0x32506f];return _0x1e6b33;};'use strict';var client=require(_0xa60a('0x0'));exports['create']=function(_0x3d5b2b){return client[_0xa60a('0x1')](_0xa60a('0x2'),{'body':_0x3d5b2b,'log':_0xa60a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 86680e6..1df62ba 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 _0xda8b=['Request','GetOpenchannelQueue','name','User','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x2c105c,_0x13c814){var _0x5d82e5=function(_0x249feb){while(--_0x249feb){_0x2c105c['push'](_0x2c105c['shift']());}};_0x5d82e5(++_0x13c814);}(_0xda8b,0x10e));var _0xbda8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xda8b[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xbda8('0x0'));exports[_0xbda8('0x1')]=function(){return function(){return client[_0xbda8('0x2')](_0xbda8('0x3'),{'options':{'raw':![],'attributes':['id',_0xbda8('0x4'),'timeout','strategy'],'include':[{'model':_0xbda8('0x5'),'as':'Agents','attributes':['id',_0xbda8('0x4'),_0xbda8('0x6'),_0xbda8('0x7')]}]},'log':_0xbda8('0x1')});};}; \ No newline at end of file +var _0x5b5f=['Request','GetOpenchannelQueue','name','strategy','User','online','getOpenchannelQueues'];(function(_0x176430,_0x4e6d28){var _0x55fc14=function(_0x1c2949){while(--_0x1c2949){_0x176430['push'](_0x176430['shift']());}};_0x55fc14(++_0x4e6d28);}(_0x5b5f,0xd9));var _0xf5b5=function(_0x469d7b,_0x8bd123){_0x469d7b=_0x469d7b-0x0;var _0x4eb5d0=_0x5b5f[_0x469d7b];return _0x4eb5d0;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xf5b5('0x0')](_0xf5b5('0x1'),{'options':{'raw':![],'attributes':['id',_0xf5b5('0x2'),'timeout',_0xf5b5('0x3')],'include':[{'model':_0xf5b5('0x4'),'as':'Agents','attributes':['id',_0xf5b5('0x2'),_0xf5b5('0x5'),'openchannelPause']}]},'log':_0xf5b5('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index fc15c2a..a190461 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 _0x1564=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x2f0c63,_0x3f1df4){var _0x373496=function(_0xa3c79){while(--_0xa3c79){_0x2f0c63['push'](_0x2f0c63['shift']());}};_0x373496(++_0x3f1df4);}(_0x1564,0x125));var _0x4156=function(_0x21ce03,_0x1baada){_0x21ce03=_0x21ce03-0x0;var _0x184974=_0x1564[_0x21ce03];return _0x184974;};'use strict';var client=require(_0x4156('0x0'));exports[_0x4156('0x1')]=function(_0x37aa79){return client[_0x4156('0x2')]('CreateOpenchannelQueueReport',{'body':_0x37aa79,'log':_0x4156('0x3')});};exports[_0x4156('0x4')]=function(_0x30dffe,_0x252f7f){return client[_0x4156('0x2')](_0x4156('0x5'),{'body':_0x252f7f,'options':{'where':{'uniqueid':_0x30dffe},'order':[['id',_0x4156('0x6')]],'limit':0x1},'log':_0x4156('0x5')});}; \ No newline at end of file +var _0x234b=['Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x514da6,_0x3b61d9){var _0x3a47e7=function(_0x14f081){while(--_0x14f081){_0x514da6['push'](_0x514da6['shift']());}};_0x3a47e7(++_0x3b61d9);}(_0x234b,0x8a));var _0xb234=function(_0x4600dd,_0x1b9cd7){_0x4600dd=_0x4600dd-0x0;var _0x19f7c1=_0x234b[_0x4600dd];return _0x19f7c1;};'use strict';var client=require(_0xb234('0x0'));exports[_0xb234('0x1')]=function(_0x196d5e){return client[_0xb234('0x2')]('CreateOpenchannelQueueReport',{'body':_0x196d5e,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x3dce6e,_0x585eb2){return client[_0xb234('0x2')](_0xb234('0x3'),{'body':_0x585eb2,'options':{'where':{'uniqueid':_0x3dce6e},'order':[['id',_0xb234('0x4')]],'limit':0x1},'log':_0xb234('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 4802038..f984bcf 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 _0x6183=['updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','UpdateSmsInteraction'];(function(_0x592dea,_0x410e09){var _0xaf3266=function(_0x5a5619){while(--_0x5a5619){_0x592dea['push'](_0x592dea['shift']());}};_0xaf3266(++_0x410e09);}(_0x6183,0x19b));var _0x3618=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x6183[_0x1daaa9];return _0x1dd221;};'use strict';var client=require('../client');exports[_0x3618('0x0')]=function(_0x3a9324,_0x340e83){return client['Request'](_0x3618('0x1'),{'body':_0x340e83,'options':{'where':{'id':_0x3a9324}},'log':_0x3618('0x2')});};exports[_0x3618('0x3')]=function(_0x2d62a7,_0x21af62){return client[_0x3618('0x4')](_0x3618('0x5'),{'body':_0x21af62,'options':{'where':{'id':_0x2d62a7}},'log':_0x3618('0x6')});}; \ No newline at end of file +var _0xac21=['Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x77a260,_0x407209){var _0x30e22a=function(_0xb6c00a){while(--_0xb6c00a){_0x77a260['push'](_0x77a260['shift']());}};_0x30e22a(++_0x407209);}(_0xac21,0x1af));var _0x1ac2=function(_0x217adc,_0x52ee97){_0x217adc=_0x217adc-0x0;var _0x352792=_0xac21[_0x217adc];return _0x352792;};'use strict';var client=require('../client');exports[_0x1ac2('0x0')]=function(_0x3bfe28,_0x4e937a){return client[_0x1ac2('0x1')]('UpdateSmsInteraction',{'body':_0x4e937a,'options':{'where':{'id':_0x3bfe28}},'log':_0x1ac2('0x2')});};exports[_0x1ac2('0x3')]=function(_0x5b81be,_0x454461){return client['Request'](_0x1ac2('0x4'),{'body':_0x454461,'options':{'where':{'id':_0x5b81be}},'log':_0x1ac2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 735d433..35679e0 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 _0xdf25=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x29716d,_0x5504eb){var _0x3fce17=function(_0x4effd1){while(--_0x4effd1){_0x29716d['push'](_0x29716d['shift']());}};_0x3fce17(++_0x5504eb);}(_0xdf25,0x1c4));var _0x5df2=function(_0x1162e2,_0x49c3ec){_0x1162e2=_0x1162e2-0x0;var _0x4e6fa1=_0xdf25[_0x1162e2];return _0x4e6fa1;};'use strict';var client=require(_0x5df2('0x0'));exports[_0x5df2('0x1')]=function(_0x2d24d6){return client['Request'](_0x5df2('0x2'),{'body':_0x2d24d6,'log':_0x5df2('0x3')});}; \ No newline at end of file +var _0x1d8f=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x672e7b,_0x2005bf){var _0x59c523=function(_0x4450d5){while(--_0x4450d5){_0x672e7b['push'](_0x672e7b['shift']());}};_0x59c523(++_0x2005bf);}(_0x1d8f,0x9c));var _0xf1d8=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x1d8f[_0x6cf19c];return _0xce14f3;};'use strict';var client=require(_0xf1d8('0x0'));exports[_0xf1d8('0x1')]=function(_0x56ae27){return client[_0xf1d8('0x2')](_0xf1d8('0x3'),{'body':_0x56ae27,'log':_0xf1d8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 79c05ae..7bc2812 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x5caf52,_0x38e088){var _0x2c8f1f=function(_0x4d66cb){while(--_0x4d66cb){_0x5caf52['push'](_0x5caf52['shift']());}};_0x2c8f1f(++_0x38e088);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x3f7a99,_0x245dd7){var _0x2852fc=function(_0x3747c6){while(--_0x3747c6){_0x3f7a99['push'](_0x3f7a99['shift']());}};_0x2852fc(++_0x245dd7);}(_0xe706,0xa3));var _0x6e70=function(_0x2635ac,_0x5c6108){_0x2635ac=_0x2635ac-0x0;var _0x693d1e=_0xe706[_0x2635ac];return _0x693d1e;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 4c7918b..344afe5 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x4639f0,_0xfabbe6){var _0x418c03=function(_0x2dd3ac){while(--_0x2dd3ac){_0x4639f0['push'](_0x4639f0['shift']());}};_0x418c03(++_0xfabbe6);}(_0x34e8,0x12c));var _0x834e=function(_0x40612f,_0x8f0fa7){_0x40612f=_0x40612f-0x0;var _0x41aaca=_0x34e8[_0x40612f];return _0x41aaca;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5b710b,_0x103f64){var _0x40ccbe=function(_0x1b46d6){while(--_0x1b46d6){_0x5b710b['push'](_0x5b710b['shift']());}};_0x40ccbe(++_0x103f64);}(_0x008c,0x188));var _0xc008=function(_0x460f81,_0x553431){_0x460f81=_0x460f81-0x0;var _0x423f0d=_0x008c[_0x460f81];return _0x423f0d;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 08f1cb2..d4e7f4c 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(_0xf7a636,_0x571230){var _0x5c90dc=function(_0x419daf){while(--_0x419daf){_0xf7a636['push'](_0xf7a636['shift']());}};_0x5c90dc(++_0x571230);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0xb99927,_0x193d6a){var _0x23b8e4=function(_0x21b3ee){while(--_0x21b3ee){_0xb99927['push'](_0xb99927['shift']());}};_0x23b8e4(++_0x193d6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 e60a5b3..d86ecb2 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 _0x8ca9=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x297ff6,_0x13199f){var _0x29bf5d=function(_0x3bb7b8){while(--_0x3bb7b8){_0x297ff6['push'](_0x297ff6['shift']());}};_0x29bf5d(++_0x13199f);}(_0x8ca9,0x9c));var _0x98ca=function(_0x534c22,_0xdbeed6){_0x534c22=_0x534c22-0x0;var _0x4db706=_0x8ca9[_0x534c22];return _0x4db706;};'use strict';var client=require(_0x98ca('0x0'));exports[_0x98ca('0x1')]=function(_0x3acd03,_0x466360){return client[_0x98ca('0x2')](_0x98ca('0x3'),{'body':_0x466360,'options':{'where':{'id':_0x3acd03}},'log':_0x98ca('0x4')});};exports['addTags']=function(_0x4c230f,_0x142793){return client['Request'](_0x98ca('0x5'),{'body':_0x142793,'options':{'where':{'id':_0x4c230f}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xcf98=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xcf98,0x8d));var _0x8cf9=function(_0x2bc388,_0x409de1){_0x2bc388=_0x2bc388-0x0;var _0x42eb8e=_0xcf98[_0x2bc388];return _0x42eb8e;};'use strict';var client=require('../client');exports[_0x8cf9('0x0')]=function(_0x2565de,_0x299e1d){return client[_0x8cf9('0x1')](_0x8cf9('0x2'),{'body':_0x299e1d,'options':{'where':{'id':_0x2565de}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x2ebf57,_0x28ae77){return client[_0x8cf9('0x1')](_0x8cf9('0x3'),{'body':_0x28ae77,'options':{'where':{'id':_0x2ebf57}},'log':_0x8cf9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2529915..3af69d9 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 _0xac68=['create','Request','../client'];(function(_0x12fc80,_0x820742){var _0x51fb13=function(_0x456720){while(--_0x456720){_0x12fc80['push'](_0x12fc80['shift']());}};_0x51fb13(++_0x820742);}(_0xac68,0x71));var _0x8ac6=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xac68[_0x1ccbcc];return _0x1e873f;};'use strict';var client=require(_0x8ac6('0x0'));exports[_0x8ac6('0x1')]=function(_0xa3218c){return client[_0x8ac6('0x2')]('CreateWhatsappMessage',{'body':_0xa3218c,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x90e8=['createWhatsappMessage','../client','Request'];(function(_0x3a5541,_0x34dc2e){var _0x549d59=function(_0x246401){while(--_0x246401){_0x3a5541['push'](_0x3a5541['shift']());}};_0x549d59(++_0x34dc2e);}(_0x90e8,0x124));var _0x890e=function(_0x11388d,_0x2581b9){_0x11388d=_0x11388d-0x0;var _0x24d92e=_0x90e8[_0x11388d];return _0x24d92e;};'use strict';var client=require(_0x890e('0x0'));exports['create']=function(_0x4a9995){return client[_0x890e('0x1')]('CreateWhatsappMessage',{'body':_0x4a9995,'log':_0x890e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 48ff8ff..7dfc394 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 _0xd45b=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','Agents'];(function(_0xccf727,_0x4d3f25){var _0x4702b4=function(_0xfc8677){while(--_0xfc8677){_0xccf727['push'](_0xccf727['shift']());}};_0x4702b4(++_0x4d3f25);}(_0xd45b,0x185));var _0xbd45=function(_0x40e207,_0x51686d){_0x40e207=_0x40e207-0x0;var _0x53de18=_0xd45b[_0x40e207];return _0x53de18;};'use strict';var client=require(_0xbd45('0x0'));exports[_0xbd45('0x1')]=function(){return function(){return client[_0xbd45('0x2')](_0xbd45('0x3'),{'options':{'raw':![],'attributes':['id',_0xbd45('0x4'),'timeout',_0xbd45('0x5')],'include':[{'model':'User','as':_0xbd45('0x6'),'attributes':['id','name',_0xbd45('0x7'),_0xbd45('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x8c18=['getWhatsappQueues','strategy','User','Agents','name','online','whatsappPause','../client'];(function(_0x4eb4c1,_0x1c4ae4){var _0x210b9a=function(_0x4ee26a){while(--_0x4ee26a){_0x4eb4c1['push'](_0x4eb4c1['shift']());}};_0x210b9a(++_0x1c4ae4);}(_0x8c18,0xbf));var _0x88c1=function(_0x7f8a2a,_0x155731){_0x7f8a2a=_0x7f8a2a-0x0;var _0x543ef3=_0x8c18[_0x7f8a2a];return _0x543ef3;};'use strict';var client=require(_0x88c1('0x0'));exports[_0x88c1('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x88c1('0x2')],'include':[{'model':_0x88c1('0x3'),'as':_0x88c1('0x4'),'attributes':['id',_0x88c1('0x5'),_0x88c1('0x6'),_0x88c1('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 78b089f..417dcfc 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 _0xe356=['Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','create'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xe356,0x131));var _0x6e35=function(_0xea5623,_0x324fa0){_0xea5623=_0xea5623-0x0;var _0x37576d=_0xe356[_0xea5623];return _0x37576d;};'use strict';var client=require('../client');exports[_0x6e35('0x0')]=function(_0x19d079){return client[_0x6e35('0x1')](_0x6e35('0x2'),{'body':_0x19d079,'log':_0x6e35('0x2')});};exports[_0x6e35('0x3')]=function(_0x4ee5ac,_0x536989){return client[_0x6e35('0x1')]('UpdateWhatsappQueueReport',{'body':_0x536989,'options':{'where':{'uniqueid':_0x4ee5ac},'order':[['id',_0x6e35('0x4')]],'limit':0x1},'log':_0x6e35('0x5')});}; \ No newline at end of file +var _0xf839=['DESC','../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport'];(function(_0x3a1e86,_0x429dcc){var _0x5adfa5=function(_0x50377c){while(--_0x50377c){_0x3a1e86['push'](_0x3a1e86['shift']());}};_0x5adfa5(++_0x429dcc);}(_0xf839,0x103));var _0x9f83=function(_0x520c48,_0x15f040){_0x520c48=_0x520c48-0x0;var _0x5e60b5=_0xf839[_0x520c48];return _0x5e60b5;};'use strict';var client=require(_0x9f83('0x0'));exports[_0x9f83('0x1')]=function(_0x38041f){return client[_0x9f83('0x2')](_0x9f83('0x3'),{'body':_0x38041f,'log':_0x9f83('0x3')});};exports['update']=function(_0x53e044,_0x27ed29){return client[_0x9f83('0x2')](_0x9f83('0x4'),{'body':_0x27ed29,'options':{'where':{'uniqueid':_0x53e044},'order':[['id',_0x9f83('0x5')]],'limit':0x1},'log':_0x9f83('0x4')});}; \ 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 eae31d5..76dae80 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 _0xb983=['length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','info','[%s][AGENT]\x20ROUTING\x20END','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xb983,0xb1));var _0x3b98=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0xb983[_0x2ac4af];return _0x3a36df;};'use strict';var schema=require(_0x3b98('0x0'));var _=require(_0x3b98('0x1'));var util=require(_0x3b98('0x2'));var seqqueue=require(_0x3b98('0x3'));var logger=require(_0x3b98('0x4'))(_0x3b98('0x5'));var strategy=require(_0x3b98('0x6'));var queue=schema({'name':{'type':_0x3b98('0x7'),'required':!![],'message':_0x3b98('0x8')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x16495c,_0x267a12,_0xe9b513){return logger['info'](util[_0x3b98('0x9')](_0x3b98('0xa'),_0x16495c,_0x267a12['name'],_0xe9b513));}function handleFindAgent(_0x128eca){return function(_0x329e6c){return _0x329e6c[_0x3b98('0xb')][_0x3b98('0xc')]()===_0x128eca[_0x3b98('0xc')]();};}exports['consequence']=function(_0x1d60aa,_0x3cb13a,_0x12ea40,_0x314a8e){return function(_0x128a7b){try{var _0x125df1={'name':_0x3cb13a[0x0],'timeout':_0x3cb13a[0x1]};var _0x5bc5ff=queue[_0x3b98('0x0')](_0x125df1,{'typecast':!![]});if(_0x5bc5ff[_0x3b98('0xd')]){logger[_0x3b98('0xe')](_0x3b98('0xf'),_0x1d60aa,_[_0x3b98('0x10')](_0x5bc5ff,_0x3b98('0x11'))[_0x3b98('0x12')](',\x20'));_0x128a7b[_0x3b98('0x13')]();}else{var _0x218298=_[_0x3b98('0x14')](_0x12ea40[_0x3b98('0x15')],handleFindAgent(_0x125df1[_0x3b98('0xb')]));if(_0x218298){var _0x5f0f9b=(_0x125df1[_0x3b98('0x16')]||0xa)*0x3e8;var _0x43b760,_0x5c18f9;var _0x5b4825=seqqueue[_0x3b98('0x17')](_0x5f0f9b);_0x5b4825['id']=_0x1d60aa;_0x5b4825[_0x3b98('0x18')]=_0x5f0f9b;_0x5b4825[_0x3b98('0x19')]=_0x314a8e[_0x3b98('0x19')];writeLog(_0x1d60aa,_0x218298,util[_0x3b98('0x9')](_0x3b98('0x1a'),_0x5f0f9b));_0x12ea40[_0x3b98('0x1b')][_0x1d60aa]['on'](_0x3b98('0x1c'),function(){logger['info'](_0x3b98('0x1d'),_0x1d60aa);clearTimeout(_0x5c18f9);_0x5c18f9=undefined;_0x5b4825['close']();if(_0x12ea40[_0x3b98('0x1b')][_0x1d60aa]){delete _0x12ea40[_0x3b98('0x1b')][_0x1d60aa];}_0x128a7b['stop']();});_0x12ea40[_0x3b98('0x1b')][_0x1d60aa]['on'](_0x3b98('0x1e'),function(){if(_0x12ea40[_0x3b98('0x1b')][_0x1d60aa]){delete _0x12ea40[_0x3b98('0x1b')][_0x1d60aa];}});_0x5c18f9=setTimeout(function(){logger[_0x3b98('0x1f')](_0x3b98('0x20'),_0x1d60aa);clearTimeout(_0x5c18f9);_0x5b4825[_0x3b98('0x21')]();_0x128a7b['next']();},_0x5f0f9b);strategy['agent'](_0x5b4825,_0x218298,_0x12ea40,_0x314a8e);}else{logger['error'](_0x3b98('0x22'),_0x1d60aa,_0x125df1['name']);_0x128a7b[_0x3b98('0x13')]();}}}catch(_0x50f21d){console[_0x3b98('0x23')](_0x50f21d);logger[_0x3b98('0xe')](_0x3b98('0x24'),_0x1d60aa,_0x50f21d[_0x3b98('0x25')]);_0x128a7b[_0x3b98('0x13')]();}};}; \ No newline at end of file +var _0x244e=['close','rules','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','string','number','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','atimeout','channel','format','START:%s','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x3d04c4,_0x41d7b2){var _0xade1e0=function(_0x23a0f9){while(--_0x23a0f9){_0x3d04c4['push'](_0x3d04c4['shift']());}};_0xade1e0(++_0x41d7b2);}(_0x244e,0x132));var _0xe244=function(_0x286354,_0x1c8e54){_0x286354=_0x286354-0x0;var _0x1d6ff5=_0x244e[_0x286354];return _0x1d6ff5;};'use strict';var schema=require(_0xe244('0x0'));var _=require('lodash');var util=require(_0xe244('0x1'));var seqqueue=require(_0xe244('0x2'));var logger=require(_0xe244('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xe244('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe244('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5cf85f,_0x27509e,_0x47fce3){return logger['info'](util['format'](_0xe244('0x6'),_0x5cf85f,_0x27509e['name'],_0x47fce3));}function handleFindAgent(_0xf4310c){return function(_0x4caa39){return _0x4caa39[_0xe244('0x7')]['toLowerCase']()===_0xf4310c['toLowerCase']();};}exports[_0xe244('0x8')]=function(_0x5179d2,_0xb72a93,_0x613d61,_0x255831){return function(_0x2eca9b){try{var _0x4887bb={'name':_0xb72a93[0x0],'timeout':_0xb72a93[0x1]};var _0x459f24=queue[_0xe244('0x0')](_0x4887bb,{'typecast':!![]});if(_0x459f24[_0xe244('0x9')]){logger[_0xe244('0xa')](_0xe244('0xb'),_0x5179d2,_[_0xe244('0xc')](_0x459f24,_0xe244('0xd'))[_0xe244('0xe')](',\x20'));_0x2eca9b[_0xe244('0xf')]();}else{var _0x5794ba=_['find'](_0x613d61[_0xe244('0x10')],handleFindAgent(_0x4887bb['name']));if(_0x5794ba){var _0x3e0da6=(_0x4887bb['timeout']||0xa)*0x3e8;var _0xcacb4,_0x2e4dbb;var _0x2e32d1=seqqueue['createQueue'](_0x3e0da6);_0x2e32d1['id']=_0x5179d2;_0x2e32d1[_0xe244('0x11')]=_0x3e0da6;_0x2e32d1[_0xe244('0x12')]=_0x255831[_0xe244('0x12')];writeLog(_0x5179d2,_0x5794ba,util[_0xe244('0x13')](_0xe244('0x14'),_0x3e0da6));_0x613d61['rules'][_0x5179d2]['on'](_0xe244('0x15'),function(){logger[_0xe244('0x16')](_0xe244('0x17'),_0x5179d2);clearTimeout(_0x2e4dbb);_0x2e4dbb=undefined;_0x2e32d1[_0xe244('0x18')]();if(_0x613d61[_0xe244('0x19')][_0x5179d2]){delete _0x613d61[_0xe244('0x19')][_0x5179d2];}_0x2eca9b['stop']();});_0x613d61[_0xe244('0x19')][_0x5179d2]['on'](_0xe244('0x1a'),function(){if(_0x613d61['rules'][_0x5179d2]){delete _0x613d61[_0xe244('0x19')][_0x5179d2];}});_0x2e4dbb=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x5179d2);clearTimeout(_0x2e4dbb);_0x2e32d1[_0xe244('0x18')]();_0x2eca9b[_0xe244('0x1b')]();},_0x3e0da6);strategy[_0xe244('0x1c')](_0x2e32d1,_0x5794ba,_0x613d61,_0x255831);}else{logger[_0xe244('0xa')](_0xe244('0x1d'),_0x5179d2,_0x4887bb[_0xe244('0x7')]);_0x2eca9b[_0xe244('0xf')]();}}}catch(_0x10faea){console[_0xe244('0x1e')](_0x10faea);logger[_0xe244('0xa')](_0xe244('0x1f'),_0x5179d2,_0x10faea[_0xe244('0x20')]);_0x2eca9b[_0xe244('0xf')]();}};}; \ 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 d4a4d71..c616d71 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 _0x4952=['../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','stringify','dialogState','Failed','catch','error','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x4952,0xcd));var _0x2495=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x4952[_0x4b7e4d];return _0x38d6af;};'use strict';var _=require(_0x2495('0x0'));var moment=require(_0x2495('0x1'));var AWS=require(_0x2495('0x2'));var utils=require(_0x2495('0x3'));var logger=require(_0x2495('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2495('0x5')),'mailMessage':require(_0x2495('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2495('0x7'))};exports[_0x2495('0x8')]=function(_0x25ee5b,_0x195c19){return function(_0x27bfc6){try{if(!_[_0x2495('0x9')](this[_0x2495('0xa')][_0x2495('0xb')])){logger[_0x2495('0xc')]('[%s][AMAZONLEX]\x20%s',_0x25ee5b,_0x2495('0xd'));return _0x27bfc6[_0x2495('0xe')]();}var _0x3f958e={'ContactId':this[_0x2495('0xf')]['id'],'sentAt':moment()[_0x2495('0x10')](_0x2495('0x11')),'direction':_0x2495('0x12')};if(this[_0x2495('0x13')]===_0x2495('0x14')||this[_0x2495('0x13')]===_0x2495('0x15')){_0x3f958e['phone']=this[_0x2495('0xa')][_0x2495('0x16')];}var _0x27ed1f=this[_0x2495('0x13')];if(_0x27ed1f===_0x2495('0x17')){_0x3f958e[_0x2495('0x18')]=this[_0x2495('0x19')]['id'];}else{_0x3f958e[_[_0x2495('0x1a')](_0x27ed1f)+_0x2495('0x1b')]=this[_0x2495('0x19')]['id'];}_0x3f958e[_[_0x2495('0x1a')](_0x27ed1f)+_0x2495('0x1c')]=this[_0x2495('0xa')]['id'];if(this['interaction'][_0x2495('0x1d')]){var _0x10e67b=_0x195c19[0x4];if(!_[_0x2495('0x1e')](_0x10e67b)){_0x3f958e[_0x2495('0x1f')]=utils[_0x2495('0x20')](_0x10e67b,this);return rpc[_0x27ed1f+_0x2495('0x21')][_0x2495('0x22')](_0x3f958e)[_0x2495('0x23')](function(_0x1c2f1b){logger[_0x2495('0xc')](_0x2495('0x24'),_0x25ee5b,_0x3f958e[_0x2495('0x1f')]);})['catch'](function(_0x553992){logger['error'](_0x2495('0x24'),_0x25ee5b,JSON['stringify'](_0x553992));})[_0x2495('0x25')](function(){logger[_0x2495('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x25ee5b);_0x27bfc6[_0x2495('0x26')]();});}else{logger['info'](_0x2495('0x27'),_0x25ee5b);_0x27bfc6['stop']();}}else{var _0x381224=this;var _0x526662=new AWS[(_0x2495('0x28'))]({'accessKeyId':_0x195c19[0x0],'secretAccessKey':_0x195c19[0x1],'region':_0x195c19[0x2]});var _0x261aed={'botAlias':_0x2495('0x29'),'botName':_0x195c19[0x3],'inputText':this[_0x2495('0x2a')]['body'],'userId':this[_0x2495('0x13')]+':'+this[_0x2495('0xa')]['id'][_0x2495('0x2b')]()};_0x526662[_0x2495('0x2c')](_0x261aed,function(_0x14c1dd,_0x4fd23e){if(_0x14c1dd){logger['error']('[%s][AMAZONLEX]\x20%s',_0x25ee5b,_0x14c1dd[_0x2495('0x2a')]);_0x27bfc6[_0x2495('0xe')]();}else if(_0x4fd23e&&_0x4fd23e[_0x2495('0x2a')]){_0x381224['body']['amazonlex']=_0x4fd23e;_0x3f958e[_0x2495('0x1f')]=_0x4fd23e[_0x2495('0x2a')];_0x3f958e[_0x2495('0x2d')]=_0x2495('0x2e');_0x3f958e[_0x2495('0x2f')]=JSON[_0x2495('0x30')](_0x4fd23e);return rpc[_0x27ed1f+_0x2495('0x21')]['create'](_0x3f958e)[_0x2495('0x23')](function(_0x4191cb){logger[_0x2495('0xc')](_0x2495('0x24'),_0x25ee5b,_0x3f958e[_0x2495('0x1f')]);if(_0x4fd23e[_0x2495('0x31')]==_0x2495('0x32')){_0x27bfc6[_0x2495('0xe')]();}else{_0x27bfc6[_0x2495('0x26')]();}})[_0x2495('0x33')](function(_0x430079){logger['error']('[%s][AMAZONLEX]\x20%s',_0x25ee5b,JSON[_0x2495('0x30')](_0x430079));_0x27bfc6[_0x2495('0xe')]();});}else{_0x27bfc6['next']();}});}}catch(_0x47a4a3){logger[_0x2495('0x34')](_0x2495('0x24'),_0x25ee5b,JSON[_0x2495('0x30')](_0x47a4a3));_0x27bfc6[_0x2495('0x26')]();}};}; \ No newline at end of file +var _0xf8fe=['../../rpc/faxMessage','../../rpc/whatsappMessage','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','providerResponse','dialogState','Failed','catch','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x33e948,_0x774649){var _0x3ffb93=function(_0x3ebbea){while(--_0x3ebbea){_0x33e948['push'](_0x33e948['shift']());}};_0x3ffb93(++_0x774649);}(_0xf8fe,0x8c));var _0xef8f=function(_0x1ab894,_0x237c2f){_0x1ab894=_0x1ab894-0x0;var _0x1b2ab6=_0xf8fe[_0x1ab894];return _0x1b2ab6;};'use strict';var _=require(_0xef8f('0x0'));var moment=require('moment');var AWS=require(_0xef8f('0x1'));var utils=require(_0xef8f('0x2'));var logger=require(_0xef8f('0x3'))(_0xef8f('0x4'));var rpc={'chatMessage':require(_0xef8f('0x5')),'openchannelMessage':require(_0xef8f('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xef8f('0x7')),'whatsappMessage':require(_0xef8f('0x8'))};exports['consequence']=function(_0x5847d1,_0x1f58fd){return function(_0x43c939){try{if(!_['isNil'](this['interaction'][_0xef8f('0x9')])){logger[_0xef8f('0xa')]('[%s][AMAZONLEX]\x20%s',_0x5847d1,_0xef8f('0xb'));return _0x43c939[_0xef8f('0xc')]();}var _0x36f72f={'ContactId':this[_0xef8f('0xd')]['id'],'sentAt':moment()[_0xef8f('0xe')](_0xef8f('0xf')),'direction':_0xef8f('0x10')};if(this[_0xef8f('0x11')]===_0xef8f('0x12')||this[_0xef8f('0x11')]==='whatsapp'){_0x36f72f[_0xef8f('0x13')]=this['interaction'][_0xef8f('0x13')];}var _0x9bf66f=this[_0xef8f('0x11')];if(_0x9bf66f===_0xef8f('0x14')){_0x36f72f[_0xef8f('0x15')]=this[_0xef8f('0x16')]['id'];}else{_0x36f72f[_[_0xef8f('0x17')](_0x9bf66f)+_0xef8f('0x18')]=this[_0xef8f('0x16')]['id'];}_0x36f72f[_[_0xef8f('0x17')](_0x9bf66f)+_0xef8f('0x19')]=this[_0xef8f('0x1a')]['id'];if(this[_0xef8f('0x1a')][_0xef8f('0x1b')]){var _0x4bac7d=_0x1f58fd[0x4];if(!_[_0xef8f('0x1c')](_0x4bac7d)){_0x36f72f[_0xef8f('0x1d')]=utils[_0xef8f('0x1e')](_0x4bac7d,this);return rpc[_0x9bf66f+_0xef8f('0x1f')][_0xef8f('0x20')](_0x36f72f)[_0xef8f('0x21')](function(_0x3b439c){logger[_0xef8f('0xa')](_0xef8f('0x22'),_0x5847d1,_0x36f72f[_0xef8f('0x1d')]);})['catch'](function(_0x45bf99){logger['error'](_0xef8f('0x22'),_0x5847d1,JSON[_0xef8f('0x23')](_0x45bf99));})['finally'](function(){logger[_0xef8f('0xa')](_0xef8f('0x24'),_0x5847d1);_0x43c939[_0xef8f('0x25')]();});}else{logger[_0xef8f('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5847d1);_0x43c939[_0xef8f('0x25')]();}}else{var _0x17c140=this;var _0x49de6c=new AWS[(_0xef8f('0x26'))]({'accessKeyId':_0x1f58fd[0x0],'secretAccessKey':_0x1f58fd[0x1],'region':_0x1f58fd[0x2]});var _0x227bf1={'botAlias':_0xef8f('0x27'),'botName':_0x1f58fd[0x3],'inputText':this[_0xef8f('0x28')][_0xef8f('0x1d')],'userId':this[_0xef8f('0x11')]+':'+this[_0xef8f('0x1a')]['id'][_0xef8f('0x29')]()};_0x49de6c[_0xef8f('0x2a')](_0x227bf1,function(_0x4a69f7,_0x3c70f2){if(_0x4a69f7){logger[_0xef8f('0x2b')](_0xef8f('0x22'),_0x5847d1,_0x4a69f7['message']);_0x43c939['next']();}else if(_0x3c70f2&&_0x3c70f2[_0xef8f('0x28')]){_0x17c140['body'][_0xef8f('0x2c')]=_0x3c70f2;_0x36f72f[_0xef8f('0x1d')]=_0x3c70f2[_0xef8f('0x28')];_0x36f72f['providerName']=_0xef8f('0x2c');_0x36f72f[_0xef8f('0x2d')]=JSON[_0xef8f('0x23')](_0x3c70f2);return rpc[_0x9bf66f+_0xef8f('0x1f')][_0xef8f('0x20')](_0x36f72f)[_0xef8f('0x21')](function(_0x459122){logger[_0xef8f('0xa')]('[%s][AMAZONLEX]\x20%s',_0x5847d1,_0x36f72f[_0xef8f('0x1d')]);if(_0x3c70f2[_0xef8f('0x2e')]==_0xef8f('0x2f')){_0x43c939['next']();}else{_0x43c939['stop']();}})[_0xef8f('0x30')](function(_0x412272){logger['error'](_0xef8f('0x22'),_0x5847d1,JSON[_0xef8f('0x23')](_0x412272));_0x43c939['next']();});}else{_0x43c939[_0xef8f('0xc')]();}});}}catch(_0xc674e4){logger[_0xef8f('0x2b')](_0xef8f('0x22'),_0x5847d1,JSON[_0xef8f('0x23')](_0xc674e4));_0x43c939[_0xef8f('0x25')]();}};}; \ 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 aa140a2..40b335e 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 _0x8e63=['[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','service','Smtp','host','secure','authentication','auth','user','inReplyTo','messageId','html','','replace','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted'];(function(_0x967834,_0x20a84d){var _0x4ce58c=function(_0x3410f6){while(--_0x3410f6){_0x967834['push'](_0x967834['shift']());}};_0x4ce58c(++_0x20a84d);}(_0x8e63,0x75));var _0x38e6=function(_0x51dd15,_0x1439f0){_0x51dd15=_0x51dd15-0x0;var _0x592215=_0x8e63[_0x51dd15];return _0x592215;};'use strict';var _=require('lodash');var moment=require(_0x38e6('0x0'));var utils=require('./utils');var logger=require(_0x38e6('0x1'))('routing');var rpc={'chatMessage':require(_0x38e6('0x2')),'openchannelMessage':require(_0x38e6('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x38e6('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x38e6('0x5')),'openchannelInteraction':require(_0x38e6('0x6')),'mailInteraction':require(_0x38e6('0x7')),'smsInteraction':require(_0x38e6('0x8')),'faxInteraction':require(_0x38e6('0x9')),'whatsappInteraction':require(_0x38e6('0xa'))};var mailRpc=require(_0x38e6('0xb'));exports[_0x38e6('0xc')]=function(_0x22b2cb,_0x494d11,_0x1bfc96,_0x2c5e88){return function(_0x4866ef){try{var _0x28d33b=this[_0x38e6('0xd')];if(_0x28d33b===_0x38e6('0xe')&&_0x2c5e88['body']['isAutoreply']){logger[_0x38e6('0xf')](_0x38e6('0x10'),_0x22b2cb,_0x38e6('0x11'));return _0x4866ef[_0x38e6('0x12')]();}if(_0x494d11[0x0]==='1'&&(_[_0x38e6('0x13')](this[_0x38e6('0x14')][_0x38e6('0x15')])||!this[_0x38e6('0x14')]['created'])){logger[_0x38e6('0xf')](_0x38e6('0x10'),_0x22b2cb,'Autoreply\x20already\x20sent');return _0x4866ef[_0x38e6('0x12')]();}if(_0x494d11[0x0]==='2'&&this[_0x38e6('0x14')][_0x38e6('0x16')]){logger[_0x38e6('0xf')](_0x38e6('0x17'),_0x22b2cb,'One\x20Time\x20already\x20sent');return _0x4866ef[_0x38e6('0x12')]();}var _0x420cf6={'ContactId':this['contact']['id'],'sentAt':moment()[_0x38e6('0x18')](_0x38e6('0x19')),'direction':_0x38e6('0x1a')};if(this[_0x38e6('0xd')]==='mail'){_0x420cf6['body']=utils['getMustacheRender'](_0x494d11[0x2],this);}else{_0x420cf6[_0x38e6('0x1b')]=utils[_0x38e6('0x1c')](_0x494d11[0x1],this);}if(this[_0x38e6('0x1d')]){_0x420cf6['to']=this[_0x38e6('0x1d')]['from']||'';if(this['channel']===_0x38e6('0xe')&&_0x494d11[0x1]==='1'){_0x420cf6['cc']=this['message']['cc']||'';}_0x420cf6['from']=this['message']['to']||'';_0x420cf6[_0x38e6('0x1e')]=this['message'][_0x38e6('0x1e')]||'';_0x420cf6[_0x38e6('0x1f')]=!![];if(this[_0x38e6('0x1d')]['subject']){_0x420cf6[_0x38e6('0x20')]='';_0x420cf6[_0x38e6('0x20')]+=_[_0x38e6('0x21')](this[_0x38e6('0x1d')]['subject'],_0x38e6('0x22'))?'':_0x38e6('0x23');_0x420cf6[_0x38e6('0x20')]+=this[_0x38e6('0x1d')][_0x38e6('0x20')];}}if(this[_0x38e6('0xd')]==='chat'){_0x420cf6['ChatWebsiteId']=this[_0x38e6('0x24')]['id'];}else{_0x420cf6[_[_0x38e6('0x25')](this[_0x38e6('0xd')])+_0x38e6('0x26')]=this['account']['id'];}_0x420cf6[_[_0x38e6('0x25')](this[_0x38e6('0xd')])+_0x38e6('0x27')]=this[_0x38e6('0x14')]['id'];var _0x489715=this[_0x38e6('0x14')];if(rpc[this[_0x38e6('0xd')]+_0x38e6('0x28')]){if(this[_0x38e6('0xd')]===_0x38e6('0xe')){var _0xfa782a={'tls':{'rejectUnauthorized':![]}};if(this[_0x38e6('0x24')]['Smtp'][_0x38e6('0x29')]){_0xfa782a[_0x38e6('0x29')]=this[_0x38e6('0x24')][_0x38e6('0x2a')][_0x38e6('0x29')];}else{_0xfa782a['host']=this[_0x38e6('0x24')][_0x38e6('0x2a')][_0x38e6('0x2b')];_0xfa782a['port']=this[_0x38e6('0x24')][_0x38e6('0x2a')]['port'];_0xfa782a['secure']=this[_0x38e6('0x24')][_0x38e6('0x2a')][_0x38e6('0x2c')];}if(this['account'][_0x38e6('0x2a')][_0x38e6('0x2d')]){_0xfa782a[_0x38e6('0x2e')]={'user':this[_0x38e6('0x24')][_0x38e6('0x2a')][_0x38e6('0x2f')],'pass':this[_0x38e6('0x24')][_0x38e6('0x2a')]['pass']};}_0x420cf6[_0x38e6('0x30')]=this[_0x38e6('0x1d')][_0x38e6('0x31')];_0x420cf6[_0x38e6('0x32')]=_0x38e6('0x33')+_[_0x38e6('0x34')](_0x420cf6[_0x38e6('0x1b')],''+_[_0x4668('0x39')](_0x1be14d[_0x4668('0x1f')],_0x4668('0x3a'),_0x4668('0x3b'))+'';_0x1be14d['headers']={'Auto-Submitted':_0x4668('0x3c'),'X-Auto-Response-Suppress':'All','Precedence':_0x4668('0x3d')};return mailRpc[_0x4668('0x3e')](_0x1f4fad,_0x1be14d)[_0x4668('0x3f')](function(_0x3b9c37){logger[_0x4668('0x13')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x340512);_0x1be14d[_0x4668('0x40')]=_0x3b9c37[_0x4668('0x22')][_0x4668('0x40')];return rpc[_0xd2db85+_0x4668('0x2f')][_0x4668('0x41')](_0x1be14d);})[_0x4668('0x3f')](function(_0x24d899){logger['info'](_0x4668('0x14'),_0x340512,JSON[_0x4668('0x42')](_0x24d899));})['catch'](function(_0x337c0e){logger['error'](_0x4668('0x43'),_0x340512,JSON[_0x4668('0x42')](_0x337c0e));})[_0x4668('0x44')](function(){Promise['resolve']()[_0x4668('0x3f')](function(){if(_0x1fc289[0x0]!=='2'||_0x325693[_0x4668('0x1a')])return;return rpc[_0xd2db85+_0x4668('0x45')][_0x4668('0x46')](_0x325693['id'],{'autoreplyExecuted':!![]})['then'](function(_0x44e1ea){logger['info'](_0x4668('0x1b'),_0x340512,JSON['stringify'](_0x44e1ea));})[_0x4668('0x47')](function(_0x4c4c00){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x340512,JSON[_0x4668('0x42')](_0x4c4c00));});})[_0x4668('0x3f')](function(){_0x354206[_0x4668('0x16')]();});});}else{return rpc[this[_0x4668('0x10')]+_0x4668('0x2f')][_0x4668('0x41')](_0x1be14d)['then'](function(_0x362ded){logger[_0x4668('0x13')](_0x4668('0x14'),_0x340512,_0x1be14d[_0x4668('0x1f')]);})[_0x4668('0x47')](function(_0x4596c8){logger[_0x4668('0x48')](_0x4668('0x14'),_0x340512,JSON[_0x4668('0x42')](_0x4596c8));})[_0x4668('0x44')](function(){Promise[_0x4668('0x49')]()['then'](function(){if(_0x1fc289[0x0]!=='2'||_0x325693[_0x4668('0x1a')])return;return rpc[_0xd2db85+'Interaction']['update'](_0x325693['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1f24d2){logger[_0x4668('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x340512,JSON[_0x4668('0x42')](_0x1f24d2));})['catch'](function(_0x222f50){logger[_0x4668('0x48')](_0x4668('0x4a'),_0x340512,JSON['stringify'](_0x222f50));});})[_0x4668('0x3f')](function(){_0x354206[_0x4668('0x16')]();});});}}}catch(_0x4755cf){logger[_0x4668('0x48')](_0x4668('0x14'),_0x340512,JSON[_0x4668('0x42')](_0x4755cf));_0x354206['stop']();}};}; \ 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 b63b516..bc4bdb6 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 _0x139a=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','info'];(function(_0x2c386b,_0x19c2d7){var _0x20257c=function(_0x2a455d){while(--_0x2a455d){_0x2c386b['push'](_0x2c386b['shift']());}};_0x20257c(++_0x19c2d7);}(_0x139a,0xb5));var _0xa139=function(_0x134b4f,_0x145384){_0x134b4f=_0x134b4f-0x0;var _0x208f94=_0x139a[_0x134b4f];return _0x208f94;};'use strict';var moment=require(_0xa139('0x0'));var logger=require(_0xa139('0x1'))(_0xa139('0x2'));var rpc={'chatInteraction':require(_0xa139('0x3')),'openchannelInteraction':require(_0xa139('0x4')),'smsInteraction':require(_0xa139('0x5')),'mailInteraction':require(_0xa139('0x6')),'faxInteraction':require(_0xa139('0x7')),'whatsappInteraction':require(_0xa139('0x8'))};exports[_0xa139('0x9')]=function(_0x247b51,_0x47db0b,_0x1425aa,_0x31b6d9){return function(_0x25d36c){try{logger['info'](_0xa139('0xa'),_0x247b51,_0x47db0b[0x0]);var _0x149696={'closed':0x1,'closedAt':moment()[_0xa139('0xb')](_0xa139('0xc')),'closeReason':'system','disposition':_0x47db0b[0x0]};if(rpc[_0x31b6d9[_0xa139('0xd')]+'Interaction']){rpc[_0x31b6d9[_0xa139('0xd')]+_0xa139('0xe')][_0xa139('0xf')](_0x31b6d9[_0xa139('0x10')]['id'],_0x149696)[_0xa139('0x11')](function(_0x325541){logger[_0xa139('0x12')](_0xa139('0x13'),_0x247b51,_0x31b6d9['interaction']['id']);})[_0xa139('0x14')](function(_0x574966){logger[_0xa139('0x15')](_0xa139('0x16'),_0x247b51,JSON[_0xa139('0x17')](_0x574966));})['finally'](function(){_0x25d36c['stop']();});}}catch(_0x12f6aa){logger['error'](_0xa139('0x16'),_0x247b51,JSON[_0xa139('0x17')](_0x12f6aa));_0x25d36c[_0xa139('0x18')]();}};}; \ No newline at end of file +var _0xe004=['info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction'];(function(_0x2c27be,_0x2a4f85){var _0x1da496=function(_0x2f829b){while(--_0x2f829b){_0x2c27be['push'](_0x2c27be['shift']());}};_0x1da496(++_0x2a4f85);}(_0xe004,0xf6));var _0x4e00=function(_0x51bc48,_0x2b2105){_0x51bc48=_0x51bc48-0x0;var _0x482204=_0xe004[_0x51bc48];return _0x482204;};'use strict';var moment=require(_0x4e00('0x0'));var logger=require(_0x4e00('0x1'))(_0x4e00('0x2'));var rpc={'chatInteraction':require(_0x4e00('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x4e00('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x4e00('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x522666,_0x5f2e40,_0x16a931,_0x12dcf3){return function(_0x487a10){try{logger[_0x4e00('0x6')](_0x4e00('0x7'),_0x522666,_0x5f2e40[0x0]);var _0xaaaa2f={'closed':0x1,'closedAt':moment()['format'](_0x4e00('0x8')),'closeReason':_0x4e00('0x9'),'disposition':_0x5f2e40[0x0]};if(rpc[_0x12dcf3[_0x4e00('0xa')]+_0x4e00('0xb')]){rpc[_0x12dcf3[_0x4e00('0xa')]+_0x4e00('0xb')][_0x4e00('0xc')](_0x12dcf3['interaction']['id'],_0xaaaa2f)[_0x4e00('0xd')](function(_0x158434){logger[_0x4e00('0x6')](_0x4e00('0xe'),_0x522666,_0x12dcf3['interaction']['id']);})[_0x4e00('0xf')](function(_0x586e7f){logger[_0x4e00('0x10')](_0x4e00('0x11'),_0x522666,JSON['stringify'](_0x586e7f));})[_0x4e00('0x12')](function(){_0x487a10[_0x4e00('0x13')]();});}}catch(_0x43c4c6){logger['error'](_0x4e00('0x11'),_0x522666,JSON[_0x4e00('0x14')](_0x43c4c6));_0x487a10[_0x4e00('0x13')]();}};}; \ 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 b409038..49be9de 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 _0x5a5a=['speech','providerResponse','metadata','endConversation','error','stringify','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result'];(function(_0x123d23,_0x2b6282){var _0x183491=function(_0xbff35b){while(--_0xbff35b){_0x123d23['push'](_0x123d23['shift']());}};_0x183491(++_0x2b6282);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x1e3f11,_0x5d000a){_0x1e3f11=_0x1e3f11-0x0;var _0x268233=_0x5a5a[_0x1e3f11];return _0x268233;};'use strict';var _=require('lodash');var moment=require(_0xa5a5('0x0'));var apiai=require(_0xa5a5('0x1'));var md5=require(_0xa5a5('0x2'));var utils=require(_0xa5a5('0x3'));var logger=require(_0xa5a5('0x4'))('routing');var rpc={'chatMessage':require(_0xa5a5('0x5')),'openchannelMessage':require(_0xa5a5('0x6')),'mailMessage':require(_0xa5a5('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa5a5('0x8'))};exports[_0xa5a5('0x9')]=function(_0x5691f1,_0x3ea00f){return function(_0xf2ea20){try{if(!_[_0xa5a5('0xa')](this[_0xa5a5('0xb')][_0xa5a5('0xc')])){logger['info'](_0xa5a5('0xd'),_0x5691f1,_0xa5a5('0xe'));return _0xf2ea20[_0xa5a5('0xf')]();}var _0x2dace1={'ContactId':this[_0xa5a5('0x10')]['id'],'sentAt':moment()[_0xa5a5('0x11')](_0xa5a5('0x12')),'direction':_0xa5a5('0x13')};if(this[_0xa5a5('0x14')]===_0xa5a5('0x15')||this[_0xa5a5('0x14')]===_0xa5a5('0x16')){_0x2dace1['phone']=this[_0xa5a5('0xb')][_0xa5a5('0x17')];}var _0x3917b1=this[_0xa5a5('0x14')];if(_0x3917b1===_0xa5a5('0x18')){_0x2dace1[_0xa5a5('0x19')]=this['account']['id'];}else{_0x2dace1[_[_0xa5a5('0x1a')](_0x3917b1)+_0xa5a5('0x1b')]=this[_0xa5a5('0x1c')]['id'];}_0x2dace1[_[_0xa5a5('0x1a')](_0x3917b1)+_0xa5a5('0x1d')]=this[_0xa5a5('0xb')]['id'];if(this[_0xa5a5('0xb')][_0xa5a5('0x1e')]){var _0x48d369=_0x3ea00f[0x2];if(!_[_0xa5a5('0x1f')](_0x48d369)){_0x2dace1[_0xa5a5('0x20')]=utils[_0xa5a5('0x21')](_0x48d369,this);return rpc[_0x3917b1+_0xa5a5('0x22')][_0xa5a5('0x23')](_0x2dace1)[_0xa5a5('0x24')](function(_0x28c89f){logger['info'](_0xa5a5('0xd'),_0x5691f1,_0x2dace1[_0xa5a5('0x20')]);})[_0xa5a5('0x25')](function(_0x3776cb){logger['error'](_0xa5a5('0xd'),_0x5691f1,JSON['stringify'](_0x3776cb));})[_0xa5a5('0x26')](function(){logger[_0xa5a5('0x27')](_0xa5a5('0x28'),_0x5691f1);_0xf2ea20[_0xa5a5('0x29')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5691f1);_0xf2ea20[_0xa5a5('0x29')]();}}else{var _0x1a258f=this;var _0x417df3=apiai(_0x3ea00f[0x0],{'language':_0x3ea00f[0x1]||'en'});return _0x417df3['textRequest'](this[_0xa5a5('0x2a')]['body'],{'sessionId':md5(this[_0xa5a5('0xb')]['id'])})['then'](function(_0x4c0ff2){_0x1a258f[_0xa5a5('0x20')][_0xa5a5('0x2b')]=_0x4c0ff2;_0x2dace1[_0xa5a5('0x20')]=_0x4c0ff2[_0xa5a5('0x2c')]['fulfillment'][_0xa5a5('0x2d')];_0x2dace1['providerName']=_0xa5a5('0x2b');_0x2dace1[_0xa5a5('0x2e')]=JSON['stringify'](_0x4c0ff2);return rpc[_0x3917b1+'Message'][_0xa5a5('0x23')](_0x2dace1)[_0xa5a5('0x24')](function(_0x47992c){logger['info'](_0xa5a5('0xd'),_0x5691f1,_0x2dace1[_0xa5a5('0x20')]);if(_0x4c0ff2[_0xa5a5('0x2c')][_0xa5a5('0x2f')][_0xa5a5('0x30')]){_0xf2ea20[_0xa5a5('0xf')]();}else{_0xf2ea20['stop']();}})[_0xa5a5('0x25')](function(_0x4d1eef){logger[_0xa5a5('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x5691f1,JSON[_0xa5a5('0x32')](_0x4d1eef));_0xf2ea20[_0xa5a5('0xf')]();});})['catch'](function(_0x47ed1d){logger['error'](_0xa5a5('0xd'),_0x5691f1,_0x47ed1d['message']);_0xf2ea20[_0xa5a5('0xf')]();});}}catch(_0x378dda){logger['error'](_0xa5a5('0xd'),_0x5691f1,JSON[_0xa5a5('0x32')](_0x378dda));_0xf2ea20['stop']();}};}; \ No newline at end of file +var _0x5a99=['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','speech','providerResponse','Message','create','result','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','account','AccountId','upperFirst','created','isEmpty','getMustacheRender','then','body'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0x5a99,0xc9));var _0x95a9=function(_0x5e7859,_0x1145ce){_0x5e7859=_0x5e7859-0x0;var _0x47cfcb=_0x5a99[_0x5e7859];return _0x47cfcb;};'use strict';var _=require(_0x95a9('0x0'));var moment=require(_0x95a9('0x1'));var apiai=require(_0x95a9('0x2'));var md5=require('md5');var utils=require(_0x95a9('0x3'));var logger=require(_0x95a9('0x4'))(_0x95a9('0x5'));var rpc={'chatMessage':require(_0x95a9('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x95a9('0x7')),'smsMessage':require(_0x95a9('0x8')),'faxMessage':require(_0x95a9('0x9')),'whatsappMessage':require(_0x95a9('0xa'))};exports['consequence']=function(_0x438069,_0x45850f){return function(_0x108eb6){try{if(!_['isNil'](this[_0x95a9('0xb')]['UserId'])){logger[_0x95a9('0xc')](_0x95a9('0xd'),_0x438069,_0x95a9('0xe'));return _0x108eb6[_0x95a9('0xf')]();}var _0xc0e40d={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x95a9('0x10')),'direction':_0x95a9('0x11')};if(this['channel']===_0x95a9('0x12')||this['channel']===_0x95a9('0x13')){_0xc0e40d[_0x95a9('0x14')]=this[_0x95a9('0xb')][_0x95a9('0x14')];}var _0x395cd0=this['channel'];if(_0x395cd0==='chat'){_0xc0e40d['ChatWebsiteId']=this[_0x95a9('0x15')]['id'];}else{_0xc0e40d[_['upperFirst'](_0x395cd0)+_0x95a9('0x16')]=this[_0x95a9('0x15')]['id'];}_0xc0e40d[_[_0x95a9('0x17')](_0x395cd0)+'InteractionId']=this[_0x95a9('0xb')]['id'];if(this['interaction'][_0x95a9('0x18')]){var _0x43768a=_0x45850f[0x2];if(!_[_0x95a9('0x19')](_0x43768a)){_0xc0e40d['body']=utils[_0x95a9('0x1a')](_0x43768a,this);return rpc[_0x395cd0+'Message']['create'](_0xc0e40d)[_0x95a9('0x1b')](function(_0x3b6d30){logger[_0x95a9('0xc')](_0x95a9('0xd'),_0x438069,_0xc0e40d[_0x95a9('0x1c')]);})[_0x95a9('0x1d')](function(_0xe00f25){logger[_0x95a9('0x1e')](_0x95a9('0xd'),_0x438069,JSON[_0x95a9('0x1f')](_0xe00f25));})[_0x95a9('0x20')](function(){logger['info'](_0x95a9('0x21'),_0x438069);_0x108eb6[_0x95a9('0x22')]();});}else{logger[_0x95a9('0xc')](_0x95a9('0x23'),_0x438069);_0x108eb6['stop']();}}else{var _0x2f05a7=this;var _0x21b556=apiai(_0x45850f[0x0],{'language':_0x45850f[0x1]||'en'});return _0x21b556[_0x95a9('0x24')](this[_0x95a9('0x25')][_0x95a9('0x1c')],{'sessionId':md5(this[_0x95a9('0xb')]['id'])})[_0x95a9('0x1b')](function(_0x48de16){_0x2f05a7[_0x95a9('0x1c')][_0x95a9('0x26')]=_0x48de16;_0xc0e40d[_0x95a9('0x1c')]=_0x48de16['result']['fulfillment'][_0x95a9('0x27')];_0xc0e40d['providerName']='dialogflow';_0xc0e40d[_0x95a9('0x28')]=JSON['stringify'](_0x48de16);return rpc[_0x395cd0+_0x95a9('0x29')][_0x95a9('0x2a')](_0xc0e40d)[_0x95a9('0x1b')](function(_0xc6a07b){logger[_0x95a9('0xc')](_0x95a9('0xd'),_0x438069,_0xc0e40d[_0x95a9('0x1c')]);if(_0x48de16[_0x95a9('0x2b')][_0x95a9('0x2c')][_0x95a9('0x2d')]){_0x108eb6[_0x95a9('0xf')]();}else{_0x108eb6[_0x95a9('0x22')]();}})[_0x95a9('0x1d')](function(_0x2718ff){logger[_0x95a9('0x1e')](_0x95a9('0xd'),_0x438069,JSON[_0x95a9('0x1f')](_0x2718ff));_0x108eb6['next']();});})['catch'](function(_0x59087c){logger[_0x95a9('0x1e')](_0x95a9('0xd'),_0x438069,_0x59087c[_0x95a9('0x25')]);_0x108eb6['next']();});}}catch(_0xd981f0){logger[_0x95a9('0x1e')](_0x95a9('0xd'),_0x438069,JSON[_0x95a9('0x1f')](_0xd981f0));_0x108eb6[_0x95a9('0x22')]();}};}; \ 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 9df9687..99e4d06 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 _0x0ae0=['dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_QUERYTEXT','providerName','providerResponse','fulfillmentText','push','all','md5','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','upperFirst','AccountId','InteractionId','created','isEmpty','then','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','sessionPath','message','length'];(function(_0x103726,_0x40b6b8){var _0x2b0daa=function(_0x210e84){while(--_0x210e84){_0x103726['push'](_0x103726['shift']());}};_0x2b0daa(++_0x40b6b8);}(_0x0ae0,0x194));var _0x00ae=function(_0x5b61f4,_0x3a988e){_0x5b61f4=_0x5b61f4-0x0;var _0x43214e=_0x0ae0[_0x5b61f4];return _0x43214e;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x00ae('0x0'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x00ae('0x1'))(_0x00ae('0x2'));var utils=require(_0x00ae('0x3'));var rpc={'chatMessage':require(_0x00ae('0x4')),'openchannelMessage':require(_0x00ae('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x00ae('0x6')),'whatsappMessage':require(_0x00ae('0x7'))};function createMessage(_0x350950,_0x564c83,_0x36cc82,_0x910dda){return new Promise(function(_0x24c2d1,_0x42289f){var _0x1503fc=_[_0x00ae('0x8')](_0x36cc82);_0x1503fc[_0x00ae('0x9')]=_0x910dda;return rpc[_0x564c83+_0x00ae('0xa')][_0x00ae('0xb')](_0x1503fc)['then'](function(){logger[_0x00ae('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x350950,_0x1503fc[_0x00ae('0x9')]);_0x24c2d1();})[_0x00ae('0xd')](function(_0x47fa56){logger[_0x00ae('0xe')](_0x00ae('0xf'),_0x350950,JSON['stringify'](_0x47fa56));_0x42289f(_0x47fa56);});});}exports[_0x00ae('0x10')]=function(_0x55760e,_0xce9b04){return function(_0x1c87e3){try{if(!_[_0x00ae('0x11')](this[_0x00ae('0x12')][_0x00ae('0x13')])){logger[_0x00ae('0xc')](_0x00ae('0xf'),_0x55760e,_0x00ae('0x14'));return _0x1c87e3[_0x00ae('0x15')]();}var _0x2ef489={'ContactId':this[_0x00ae('0x16')]['id'],'sentAt':moment()[_0x00ae('0x17')](_0x00ae('0x18')),'direction':_0x00ae('0x19')};if(this['channel']===_0x00ae('0x1a')||this[_0x00ae('0x1b')]===_0x00ae('0x1c')){_0x2ef489['phone']=this[_0x00ae('0x12')][_0x00ae('0x1d')];}var _0x22f70d=this['channel'];if(_0x22f70d===_0x00ae('0x1e')){_0x2ef489['ChatWebsiteId']=this['account']['id'];}else{_0x2ef489[_[_0x00ae('0x1f')](_0x22f70d)+_0x00ae('0x20')]=this['account']['id'];}_0x2ef489[_[_0x00ae('0x1f')](_0x22f70d)+_0x00ae('0x21')]=this[_0x00ae('0x12')]['id'];if(this['interaction'][_0x00ae('0x22')]){var _0x1410d6=_0xce9b04[0x4];if(!_[_0x00ae('0x23')](_0x1410d6)){_0x2ef489['body']=utils['getMustacheRender'](_0x1410d6,this);return rpc[_0x22f70d+_0x00ae('0xa')][_0x00ae('0xb')](_0x2ef489)[_0x00ae('0x24')](function(_0x31ec91){logger['info'](_0x00ae('0xf'),_0x55760e,_0x2ef489[_0x00ae('0x9')]);})[_0x00ae('0xd')](function(_0x473f6e){logger['error'](_0x00ae('0xf'),_0x55760e,JSON[_0x00ae('0x25')](_0x473f6e));})[_0x00ae('0x26')](function(){logger[_0x00ae('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x55760e);_0x1c87e3['stop']();});}else{logger[_0x00ae('0xc')](_0x00ae('0x27'),_0x55760e);_0x1c87e3[_0x00ae('0x28')]();}}else{var _0x46a83b=this;var _0x2bd219=_0xce9b04[0x2]['replace'](/\\n/g,'\x0a');var _0x5a18f3={'credentials':{'private_key':_0x2bd219,'client_email':_0xce9b04[0x1]}};var _0x11fc20=new dialogflow['SessionsClient'](_0x5a18f3);var _0x22d342=_0x11fc20[_0x00ae('0x29')](_0xce9b04[0x0],md5(_0x46a83b[_0x00ae('0x12')]['id']));var _0x1b2410={'session':_0x22d342,'queryInput':{'text':{'text':_0x46a83b[_0x00ae('0x2a')][_0x00ae('0x9')],'languageCode':_0xce9b04[0x3]||'en'}}};return _0x11fc20['detectIntent'](_0x1b2410)['then'](function(_0x31a2c2){if(_0x31a2c2&&_0x31a2c2[_0x00ae('0x2b')]){_0x46a83b[_0x00ae('0x9')][_0x00ae('0x2c')]=_0x31a2c2;var _0x3c468b=_0x31a2c2[0x0];var _0x11895b=_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x2e')]&&_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x2e')][_0x00ae('0x2f')]?_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x2e')][_0x00ae('0x2f')][_0x00ae('0x30')][_0x00ae('0x31')]:![];_0x46a83b[_0x00ae('0x9')][_0x00ae('0x32')]=_0x3c468b[_0x00ae('0x2d')]['action'];_0x46a83b[_0x00ae('0x9')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x33')];_0x46a83b[_0x00ae('0x9')][_0x00ae('0x34')]=_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x2e')]&&_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x2e')]['fields']?_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x2e')][_0x00ae('0x2f')]['end_conversation'][_0x00ae('0x31')]:![];_0x46a83b['body'][_0x00ae('0x35')]=_0x3c468b['queryResult'][_0x00ae('0x36')][_0x00ae('0x37')];_0x46a83b[_0x00ae('0x9')][_0x00ae('0x38')]=_0x3c468b[_0x00ae('0x2d')][_0x00ae('0x36')][_0x00ae('0x39')];_0x46a83b[_0x00ae('0x9')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3c468b['queryResult']['intent']['isFallback'];_0x46a83b[_0x00ae('0x9')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3c468b[_0x00ae('0x2d')]['languageCode'];_0x46a83b[_0x00ae('0x9')][_0x00ae('0x3a')]=_0x3c468b[_0x00ae('0x2d')]['queryText'];_0x46a83b[_0x00ae('0x9')]['DIALOGFLOWV2_SCORE']=_0x3c468b[_0x00ae('0x2d')]['intentDetectionConfidence'];_0x2ef489[_0x00ae('0x3b')]=_0x00ae('0x2c');_0x2ef489[_0x00ae('0x3c')]=JSON[_0x00ae('0x25')](_0x31a2c2);var _0x82daee=[];for(var _0x50c4bc=0x0;_0x50c4bc<_0x31a2c2['length'];_0x50c4bc++){var _0x4223fa=_0x31a2c2[_0x50c4bc];if(_0x4223fa&&_0x4223fa[_0x00ae('0x2d')]&&_0x4223fa['queryResult'][_0x00ae('0x3d')]){_0x82daee[_0x00ae('0x3e')](createMessage(_0x55760e,_0x22f70d,_0x2ef489,_0x4223fa[_0x00ae('0x2d')][_0x00ae('0x3d')]));}}return Promise[_0x00ae('0x3f')](_0x82daee)[_0x00ae('0x24')](function(){if(_0x11895b){_0x1c87e3['next']();}else{_0x1c87e3[_0x00ae('0x28')]();}})['catch'](function(_0x1149a5){logger[_0x00ae('0xe')](_0x00ae('0xf'),_0x55760e,JSON['stringify'](_0x1149a5));_0x1c87e3[_0x00ae('0x15')]();});}})[_0x00ae('0xd')](function(_0x53984d){logger[_0x00ae('0xe')](_0x00ae('0xf'),_0x55760e,_0x53984d[_0x00ae('0x2a')]);_0x1c87e3['next']();});}}catch(_0x136287){logger[_0x00ae('0xe')](_0x00ae('0xf'),_0x55760e,JSON[_0x00ae('0x25')](_0x136287));_0x1c87e3[_0x00ae('0x28')]();}};}; \ No newline at end of file +var _0x2297=['UserId','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','interaction','channel','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','Message','error','finally','stop','replace','message','length','dialogflowV2','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','queryResult','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','lodash','dialogflow','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil'];(function(_0x2192bc,_0x16554f){var _0x5c3f74=function(_0x5cd99b){while(--_0x5cd99b){_0x2192bc['push'](_0x2192bc['shift']());}};_0x5c3f74(++_0x16554f);}(_0x2297,0x100));var _0x7229=function(_0x1dc3f9,_0xd96ac0){_0x1dc3f9=_0x1dc3f9-0x0;var _0x2731ee=_0x2297[_0x1dc3f9];return _0x2731ee;};'use strict';var _=require(_0x7229('0x0'));var dialogflow=require(_0x7229('0x1'));var md5=require('md5');var moment=require(_0x7229('0x2'));var Promise=require(_0x7229('0x3'));var logger=require('../../../../config/logger')(_0x7229('0x4'));var utils=require(_0x7229('0x5'));var rpc={'chatMessage':require(_0x7229('0x6')),'openchannelMessage':require(_0x7229('0x7')),'mailMessage':require(_0x7229('0x8')),'smsMessage':require(_0x7229('0x9')),'faxMessage':require(_0x7229('0xa')),'whatsappMessage':require(_0x7229('0xb'))};function createMessage(_0x13e8d1,_0x3e1765,_0x2e6f1b,_0x36b86d){return new Promise(function(_0x2111a8,_0x295ccc){var _0x23c692=_['clone'](_0x2e6f1b);_0x23c692[_0x7229('0xc')]=_0x36b86d;return rpc[_0x3e1765+'Message'][_0x7229('0xd')](_0x23c692)[_0x7229('0xe')](function(){logger['info'](_0x7229('0xf'),_0x13e8d1,_0x23c692[_0x7229('0xc')]);_0x2111a8();})[_0x7229('0x10')](function(_0x2658de){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x13e8d1,JSON[_0x7229('0x11')](_0x2658de));_0x295ccc(_0x2658de);});});}exports[_0x7229('0x12')]=function(_0x141ecd,_0x9cb537){return function(_0x412ac9){try{if(!_[_0x7229('0x13')](this['interaction'][_0x7229('0x14')])){logger[_0x7229('0x15')](_0x7229('0xf'),_0x141ecd,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x412ac9[_0x7229('0x16')]();}var _0x340bdb={'ContactId':this[_0x7229('0x17')]['id'],'sentAt':moment()['format'](_0x7229('0x18')),'direction':_0x7229('0x19')};if(this['channel']===_0x7229('0x1a')||this['channel']==='whatsapp'){_0x340bdb[_0x7229('0x1b')]=this[_0x7229('0x1c')][_0x7229('0x1b')];}var _0x19c2e5=this[_0x7229('0x1d')];if(_0x19c2e5==='chat'){_0x340bdb[_0x7229('0x1e')]=this[_0x7229('0x1f')]['id'];}else{_0x340bdb[_[_0x7229('0x20')](_0x19c2e5)+_0x7229('0x21')]=this['account']['id'];}_0x340bdb[_[_0x7229('0x20')](_0x19c2e5)+'InteractionId']=this[_0x7229('0x1c')]['id'];if(this[_0x7229('0x1c')][_0x7229('0x22')]){var _0x507511=_0x9cb537[0x4];if(!_[_0x7229('0x23')](_0x507511)){_0x340bdb[_0x7229('0xc')]=utils[_0x7229('0x24')](_0x507511,this);return rpc[_0x19c2e5+_0x7229('0x25')][_0x7229('0xd')](_0x340bdb)[_0x7229('0xe')](function(_0x27fd51){logger[_0x7229('0x15')](_0x7229('0xf'),_0x141ecd,_0x340bdb['body']);})[_0x7229('0x10')](function(_0x43c52a){logger[_0x7229('0x26')](_0x7229('0xf'),_0x141ecd,JSON[_0x7229('0x11')](_0x43c52a));})[_0x7229('0x27')](function(){logger[_0x7229('0x15')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x141ecd);_0x412ac9[_0x7229('0x28')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x141ecd);_0x412ac9['stop']();}}else{var _0x396203=this;var _0x57c548=_0x9cb537[0x2][_0x7229('0x29')](/\\n/g,'\x0a');var _0x10a486={'credentials':{'private_key':_0x57c548,'client_email':_0x9cb537[0x1]}};var _0x47daa0=new dialogflow['SessionsClient'](_0x10a486);var _0x118b22=_0x47daa0['sessionPath'](_0x9cb537[0x0],md5(_0x396203['interaction']['id']));var _0x203233={'session':_0x118b22,'queryInput':{'text':{'text':_0x396203[_0x7229('0x2a')][_0x7229('0xc')],'languageCode':_0x9cb537[0x3]||'en'}}};return _0x47daa0['detectIntent'](_0x203233)[_0x7229('0xe')](function(_0x4063c3){if(_0x4063c3&&_0x4063c3[_0x7229('0x2b')]){_0x396203['body'][_0x7229('0x2c')]=_0x4063c3;var _0x2e65a4=_0x4063c3[0x0];var _0x477698=_0x2e65a4['queryResult'][_0x7229('0x2d')]&&_0x2e65a4['queryResult'][_0x7229('0x2d')]['fields']?_0x2e65a4['queryResult'][_0x7229('0x2d')][_0x7229('0x2e')][_0x7229('0x2f')][_0x7229('0x30')]:![];_0x396203[_0x7229('0xc')][_0x7229('0x31')]=_0x2e65a4[_0x7229('0x32')]['action'];_0x396203[_0x7229('0xc')][_0x7229('0x33')]=_0x2e65a4[_0x7229('0x32')][_0x7229('0x34')];_0x396203[_0x7229('0xc')][_0x7229('0x35')]=_0x2e65a4[_0x7229('0x32')][_0x7229('0x2d')]&&_0x2e65a4[_0x7229('0x32')]['diagnosticInfo'][_0x7229('0x2e')]?_0x2e65a4['queryResult'][_0x7229('0x2d')]['fields'][_0x7229('0x2f')][_0x7229('0x30')]:![];_0x396203[_0x7229('0xc')][_0x7229('0x36')]=_0x2e65a4['queryResult'][_0x7229('0x37')]['name'];_0x396203[_0x7229('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2e65a4['queryResult']['intent'][_0x7229('0x38')];_0x396203['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x2e65a4[_0x7229('0x32')][_0x7229('0x37')][_0x7229('0x39')];_0x396203[_0x7229('0xc')][_0x7229('0x3a')]=_0x2e65a4[_0x7229('0x32')][_0x7229('0x3b')];_0x396203[_0x7229('0xc')][_0x7229('0x3c')]=_0x2e65a4[_0x7229('0x32')][_0x7229('0x3d')];_0x396203['body'][_0x7229('0x3e')]=_0x2e65a4['queryResult'][_0x7229('0x3f')];_0x340bdb[_0x7229('0x40')]=_0x7229('0x2c');_0x340bdb[_0x7229('0x41')]=JSON[_0x7229('0x11')](_0x4063c3);var _0xc88ad8=[];for(var _0x52a05b=0x0;_0x52a05b<_0x4063c3['length'];_0x52a05b++){var _0x173f8d=_0x4063c3[_0x52a05b];if(_0x173f8d&&_0x173f8d[_0x7229('0x32')]&&_0x173f8d[_0x7229('0x32')]['fulfillmentText']){_0xc88ad8[_0x7229('0x42')](createMessage(_0x141ecd,_0x19c2e5,_0x340bdb,_0x173f8d[_0x7229('0x32')][_0x7229('0x43')]));}}return Promise[_0x7229('0x44')](_0xc88ad8)[_0x7229('0xe')](function(){if(_0x477698){_0x412ac9['next']();}else{_0x412ac9[_0x7229('0x28')]();}})[_0x7229('0x10')](function(_0xa1d4a5){logger[_0x7229('0x26')](_0x7229('0xf'),_0x141ecd,JSON[_0x7229('0x11')](_0xa1d4a5));_0x412ac9['next']();});}})[_0x7229('0x10')](function(_0x15587c){logger[_0x7229('0x26')](_0x7229('0xf'),_0x141ecd,_0x15587c[_0x7229('0x2a')]);_0x412ac9[_0x7229('0x16')]();});}}catch(_0x53aad4){logger[_0x7229('0x26')]('[%s][DIALOGFLOWV2]\x20%s',_0x141ecd,JSON[_0x7229('0x11')](_0x53aad4));_0x412ac9[_0x7229('0x28')]();}};}; \ 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 d6d72a1..705552f 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 _0x930b=['length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','consequence','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x930b,0x1b5));var _0xb930=function(_0x533a07,_0x2dfa71){_0x533a07=_0x533a07-0x0;var _0x4c60f2=_0x930b[_0x533a07];return _0x4c60f2;};'use strict';var schema=require(_0xb930('0x0'));var _=require(_0xb930('0x1'));var htmlToText=require(_0xb930('0x2'));var utils=require(_0xb930('0x3'));var logger=require(_0xb930('0x4'))(_0xb930('0x5'));var gotoif=schema({'condition':{'type':_0xb930('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xb930('0x7'),'message':_0xb930('0x8')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xb930('0x9')]=function(_0x196c01,_0x4b02f0){return function(_0x3b516a){try{var _0x45f6e9={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x4b02f0[0x0],this),{'wordwrap':![]})[_0xb930('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4b02f0[0x1],'priorityFalse':_0x4b02f0[0x2]};var _0x247470=gotoif[_0xb930('0x0')](_0x45f6e9,{'typecast':!![]});if(_0x247470[_0xb930('0xb')]){logger[_0xb930('0xc')](_0xb930('0xd'),_0x196c01,_[_0xb930('0xe')](_0x247470,'message')[_0xb930('0xf')](',\x20'));_0x3b516a[_0xb930('0x10')]();}else{try{var _0x126cbd=eval('('+_0x45f6e9[_0xb930('0x11')]+')');var _0x36802e=_0x126cbd?_0x45f6e9[_0xb930('0x12')]:_0x45f6e9[_0xb930('0x13')];logger[_0xb930('0x14')](_0xb930('0x15'),_0x196c01,_0x45f6e9[_0xb930('0x11')],_0x126cbd,_0x36802e||_0xb930('0x16'));if(_0x36802e){var _0x4ab4c0=_[_0xb930('0x17')](_0x3b516a['rules'](),{'p':_0x36802e});if(_0x4ab4c0>=0x0){logger['info'](_0xb930('0x18'),_0x196c01,_0x36802e||_0xb930('0x16'),_0x4ab4c0);_0x3b516a[_0xb930('0x16')](_0x4ab4c0);}else{logger[_0xb930('0x14')](_0xb930('0x19'),_0x196c01,_0x36802e||_0xb930('0x16'));_0x3b516a[_0xb930('0x10')]();}}else{_0x3b516a['next']();}}catch(_0x2ef2e7){logger[_0xb930('0xc')](_0xb930('0x1a'),_0x196c01,_0x2ef2e7[_0xb930('0x1b')]);_0x3b516a[_0xb930('0x10')]();}}}catch(_0x2c6356){logger[_0xb930('0xc')]('[%s][GOTOIF]\x20%s',_0x196c01,JSON['stringify'](_0x2c6356));_0x3b516a[_0xb930('0x10')]();}};}; \ No newline at end of file +var _0x8c15=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','html-to-text','./utils','routing','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','[%s][GOTOIF]\x20%s','map','message','stop','priorityFalse','info','condition','next','findIndex','rules'];(function(_0x12982a,_0x3f19b2){var _0x5e1ca8=function(_0x381030){while(--_0x381030){_0x12982a['push'](_0x12982a['shift']());}};_0x5e1ca8(++_0x3f19b2);}(_0x8c15,0x148));var _0x58c1=function(_0x10279c,_0x3d5d8a){_0x10279c=_0x10279c-0x0;var _0x36c2b3=_0x8c15[_0x10279c];return _0x36c2b3;};'use strict';var schema=require(_0x58c1('0x0'));var _=require(_0x58c1('0x1'));var htmlToText=require(_0x58c1('0x2'));var utils=require(_0x58c1('0x3'));var logger=require('../../../../config/logger')(_0x58c1('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x58c1('0x5')},'priorityFalse':{'type':_0x58c1('0x6'),'message':_0x58c1('0x7')}});exports[_0x58c1('0x8')]=function(_0x31dce7,_0x547539){return function(_0x1e3b51){try{var _0x3c60c8={'condition':htmlToText[_0x58c1('0x9')](utils[_0x58c1('0xa')](_0x547539[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x547539[0x1],'priorityFalse':_0x547539[0x2]};var _0x277952=gotoif[_0x58c1('0x0')](_0x3c60c8,{'typecast':!![]});if(_0x277952[_0x58c1('0xb')]){logger['error'](_0x58c1('0xc'),_0x31dce7,_[_0x58c1('0xd')](_0x277952,_0x58c1('0xe'))['join'](',\x20'));_0x1e3b51[_0x58c1('0xf')]();}else{try{var _0x53d157=eval('('+_0x3c60c8['condition']+')');var _0xc2a27a=_0x53d157?_0x3c60c8['priorityTrue']:_0x3c60c8[_0x58c1('0x10')];logger[_0x58c1('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x31dce7,_0x3c60c8[_0x58c1('0x12')],_0x53d157,_0xc2a27a||_0x58c1('0x13'));if(_0xc2a27a){var _0x50d130=_[_0x58c1('0x14')](_0x1e3b51[_0x58c1('0x15')](),{'p':_0xc2a27a});if(_0x50d130>=0x0){logger[_0x58c1('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x31dce7,_0xc2a27a||_0x58c1('0x13'),_0x50d130);_0x1e3b51[_0x58c1('0x13')](_0x50d130);}else{logger[_0x58c1('0x11')](_0x58c1('0x16'),_0x31dce7,_0xc2a27a||'next');_0x1e3b51[_0x58c1('0xf')]();}}else{_0x1e3b51['next']();}}catch(_0x82536d){logger[_0x58c1('0x17')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x31dce7,_0x82536d['message']);_0x1e3b51[_0x58c1('0xf')]();}}}catch(_0x13a7e0){logger[_0x58c1('0x17')](_0x58c1('0xc'),_0x31dce7,JSON[_0x58c1('0x18')](_0x13a7e0));_0x1e3b51[_0x58c1('0xf')]();}};}; \ 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 4e6d7ce..9a4382f 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 _0x6e3f=['stop','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x6e3f,0x190));var _0xf6e3=function(_0x122187,_0x37eadd){_0x122187=_0x122187-0x0;var _0x3dee3e=_0x6e3f[_0x122187];return _0x3dee3e;};'use strict';var schema=require(_0xf6e3('0x0'));var _=require(_0xf6e3('0x1'));var logger=require(_0xf6e3('0x2'))(_0xf6e3('0x3'));var gotop=schema({'priority':{'type':_0xf6e3('0x4'),'required':!![],'message':_0xf6e3('0x5')}});exports[_0xf6e3('0x6')]=function(_0x16eaf3,_0x2a568a){return function(_0x15d3e0){try{var _0x18a196={'priority':_0x2a568a[0x0]};var _0x2be9b7=gotop[_0xf6e3('0x0')](_0x18a196,{'typecast':!![]});if(_0x2be9b7['length']){logger[_0xf6e3('0x7')](_0xf6e3('0x8'),_0x16eaf3,_[_0xf6e3('0x9')](_0x2be9b7,'message')['join'](',\x20'));_0x15d3e0['stop']();}else{logger[_0xf6e3('0xa')](_0xf6e3('0xb'),_0x16eaf3,_0x18a196[_0xf6e3('0xc')]);if(_0x18a196[_0xf6e3('0xc')]){var _0x47c6fc=_[_0xf6e3('0xd')](_0x15d3e0[_0xf6e3('0xe')](),{'p':_0x18a196[_0xf6e3('0xc')]});if(_0x47c6fc>=0x0){logger[_0xf6e3('0xa')](_0xf6e3('0xf'),_0x16eaf3,_0x18a196['priority']||_0xf6e3('0x10'),_0x47c6fc);_0x15d3e0[_0xf6e3('0x10')](_0x47c6fc);}else{logger[_0xf6e3('0xa')](_0xf6e3('0x11'),_0x16eaf3,_0x18a196[_0xf6e3('0xc')]||_0xf6e3('0x10'));_0x15d3e0[_0xf6e3('0x12')]();}}else{_0x15d3e0[_0xf6e3('0x10')]();}}}catch(_0x46be33){logger[_0xf6e3('0x7')](_0xf6e3('0x8'),_0x16eaf3,JSON['stringify'](_0x46be33));_0x15d3e0['stop']();}};}; \ No newline at end of file +var _0xfb5e=['priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules'];(function(_0x1040fe,_0x4ad510){var _0x3dfe3e=function(_0x1fd156){while(--_0x1fd156){_0x1040fe['push'](_0x1040fe['shift']());}};_0x3dfe3e(++_0x4ad510);}(_0xfb5e,0x10d));var _0xefb5=function(_0x93b411,_0x4263ca){_0x93b411=_0x93b411-0x0;var _0x14ce11=_0xfb5e[_0x93b411];return _0x14ce11;};'use strict';var schema=require('validate');var _=require(_0xefb5('0x0'));var logger=require(_0xefb5('0x1'))(_0xefb5('0x2'));var gotop=schema({'priority':{'type':_0xefb5('0x3'),'required':!![],'message':_0xefb5('0x4')}});exports[_0xefb5('0x5')]=function(_0x5240c5,_0x2f59cd){return function(_0x51055b){try{var _0xdb5050={'priority':_0x2f59cd[0x0]};var _0x244f1e=gotop[_0xefb5('0x6')](_0xdb5050,{'typecast':!![]});if(_0x244f1e[_0xefb5('0x7')]){logger[_0xefb5('0x8')](_0xefb5('0x9'),_0x5240c5,_[_0xefb5('0xa')](_0x244f1e,'message')[_0xefb5('0xb')](',\x20'));_0x51055b[_0xefb5('0xc')]();}else{logger[_0xefb5('0xd')](_0xefb5('0xe'),_0x5240c5,_0xdb5050['priority']);if(_0xdb5050['priority']){var _0x3842a7=_[_0xefb5('0xf')](_0x51055b[_0xefb5('0x10')](),{'p':_0xdb5050[_0xefb5('0x11')]});if(_0x3842a7>=0x0){logger[_0xefb5('0xd')](_0xefb5('0x12'),_0x5240c5,_0xdb5050[_0xefb5('0x11')]||_0xefb5('0x13'),_0x3842a7);_0x51055b[_0xefb5('0x13')](_0x3842a7);}else{logger['info'](_0xefb5('0x14'),_0x5240c5,_0xdb5050[_0xefb5('0x11')]||_0xefb5('0x13'));_0x51055b[_0xefb5('0xc')]();}}else{_0x51055b['next']();}}}catch(_0x47872d){logger[_0xefb5('0x8')](_0xefb5('0x9'),_0x5240c5,JSON[_0xefb5('0x15')](_0x47872d));_0x51055b['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 bc90555..674e0a3 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 _0xefdd=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','contact','chat','ChatWebsiteId','upperFirst','channel','account','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','routing'];(function(_0x364a3a,_0x5b4fe4){var _0x17fef8=function(_0x1e7ef9){while(--_0x1e7ef9){_0x364a3a['push'](_0x364a3a['shift']());}};_0x17fef8(++_0x5b4fe4);}(_0xefdd,0x75));var _0xdefd=function(_0xcab317,_0x52e70a){_0xcab317=_0xcab317-0x0;var _0x54e307=_0xefdd[_0xcab317];return _0x54e307;};'use strict';var _=require(_0xdefd('0x0'));var utils=require(_0xdefd('0x1'));var logger=require('../../../../config/logger')(_0xdefd('0x2'));var rpc={'chatMessage':require(_0xdefd('0x3')),'openchannelMessage':require(_0xdefd('0x4')),'mailMessage':require(_0xdefd('0x5')),'smsMessage':require(_0xdefd('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x5db2a,_0x27025e){return function(_0x34eb0a){try{var _0x525fc9={'body':utils['getMustacheRender'](_0x27025e[0x0],this),'ContactId':this[_0xdefd('0x7')]['id']};if(this['channel']===_0xdefd('0x8')){_0x525fc9[_0xdefd('0x9')]=this['account']['id'];}else{_0x525fc9[_[_0xdefd('0xa')](this[_0xdefd('0xb')])+'AccountId']=this[_0xdefd('0xc')]['id'];}_0x525fc9[_[_0xdefd('0xa')](this[_0xdefd('0xb')])+_0xdefd('0xd')]=this[_0xdefd('0xe')]['id'];if(rpc[this[_0xdefd('0xb')]+'Message']){return rpc[this['channel']+_0xdefd('0xf')][_0xdefd('0x10')](_0x525fc9)['then'](function(_0x33a25a){logger['info'](_0xdefd('0x11'),_0x5db2a,_0x525fc9[_0xdefd('0x12')]);_0x34eb0a[_0xdefd('0x13')]();})[_0xdefd('0x14')](function(_0x3dfb61){logger[_0xdefd('0x15')]('[%s][MESSAGE]\x20%s',_0x5db2a,JSON[_0xdefd('0x16')](_0x3dfb61));_0x34eb0a['stop']();});}}catch(_0x1f1fb){logger[_0xdefd('0x15')](_0xdefd('0x11'),_0x5db2a,JSON[_0xdefd('0x16')](_0x1f1fb));_0x34eb0a[_0xdefd('0x17')]();}};}; \ No newline at end of file +var _0x7462=['../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','catch','error','stop','stringify','lodash','./utils','../../rpc/chatMessage'];(function(_0x369d85,_0x344315){var _0x4801f8=function(_0x48040b){while(--_0x48040b){_0x369d85['push'](_0x369d85['shift']());}};_0x4801f8(++_0x344315);}(_0x7462,0x165));var _0x2746=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x7462[_0x602ca8];return _0x26e8ab;};'use strict';var _=require(_0x2746('0x0'));var utils=require(_0x2746('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x2746('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2746('0x3')),'faxMessage':require(_0x2746('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x2746('0x5')]=function(_0x2b4606,_0x1c3371){return function(_0x280dfb){try{var _0x2a2f42={'body':utils[_0x2746('0x6')](_0x1c3371[0x0],this),'ContactId':this[_0x2746('0x7')]['id']};if(this[_0x2746('0x8')]===_0x2746('0x9')){_0x2a2f42['ChatWebsiteId']=this[_0x2746('0xa')]['id'];}else{_0x2a2f42[_[_0x2746('0xb')](this['channel'])+_0x2746('0xc')]=this[_0x2746('0xa')]['id'];}_0x2a2f42[_[_0x2746('0xb')](this['channel'])+_0x2746('0xd')]=this[_0x2746('0xe')]['id'];if(rpc[this[_0x2746('0x8')]+_0x2746('0xf')]){return rpc[this[_0x2746('0x8')]+_0x2746('0xf')][_0x2746('0x10')](_0x2a2f42)[_0x2746('0x11')](function(_0x10c17d){logger[_0x2746('0x12')](_0x2746('0x13'),_0x2b4606,_0x2a2f42['body']);_0x280dfb['next']();})[_0x2746('0x14')](function(_0x38c1b3){logger[_0x2746('0x15')](_0x2746('0x13'),_0x2b4606,JSON['stringify'](_0x38c1b3));_0x280dfb[_0x2746('0x16')]();});}}catch(_0x1a1e02){logger['error']('[%s][MESSAGE]\x20%s',_0x2b4606,JSON[_0x2746('0x17')](_0x1a1e02));_0x280dfb[_0x2746('0x16')]();}};}; \ 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 8a8068a..990303b 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 _0x69e3=['[%s][NOOP]\x20%s','next','error','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x3855d6,_0x449749){var _0xb647e0=function(_0x38ce71){while(--_0x38ce71){_0x3855d6['push'](_0x3855d6['shift']());}};_0xb647e0(++_0x449749);}(_0x69e3,0xe5));var _0x369e=function(_0x29326f,_0x3f0a64){_0x29326f=_0x29326f-0x0;var _0x3f8ec4=_0x69e3[_0x29326f];return _0x3f8ec4;};'use strict';var utils=require(_0x369e('0x0'));var logger=require(_0x369e('0x1'))(_0x369e('0x2'));exports[_0x369e('0x3')]=function(_0x5d3fcb,_0x36e9c0){return function(_0x479f88){try{logger[_0x369e('0x4')](_0x369e('0x5'),_0x5d3fcb,utils['getMustacheRender'](_0x36e9c0[0x0],this));_0x479f88[_0x369e('0x6')]();}catch(_0x7de8e){logger[_0x369e('0x7')](_0x369e('0x5'),_0x5d3fcb,JSON['stringify'](_0x7de8e));_0x479f88[_0x369e('0x8')]();}};}; \ No newline at end of file +var _0x0774=['getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','../../../../config/logger','routing','consequence'];(function(_0x4f301a,_0x5e9d78){var _0x4eeae6=function(_0x48e18b){while(--_0x48e18b){_0x4f301a['push'](_0x4f301a['shift']());}};_0x4eeae6(++_0x5e9d78);}(_0x0774,0x105));var _0x4077=function(_0x28d0fb,_0xa684ff){_0x28d0fb=_0x28d0fb-0x0;var _0x852a10=_0x0774[_0x28d0fb];return _0x852a10;};'use strict';var utils=require('./utils');var logger=require(_0x4077('0x0'))(_0x4077('0x1'));exports[_0x4077('0x2')]=function(_0x1ccdec,_0x2bd275){return function(_0x4097e9){try{logger['info']('[%s][NOOP]\x20%s',_0x1ccdec,utils[_0x4077('0x3')](_0x2bd275[0x0],this));_0x4097e9[_0x4077('0x4')]();}catch(_0x51aac4){logger[_0x4077('0x5')](_0x4077('0x6'),_0x1ccdec,JSON[_0x4077('0x7')](_0x51aac4));_0x4097e9['stop']();}};}; \ 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 5a61303..d4c166a 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 _0xac0c=['format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','log','stack','lodash','moment','ioredis','../../../../config/environment','routing','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','emit','%sQueuesWaitingInteractions','pick'];(function(_0x6a0317,_0x14ac8b){var _0xa313a2=function(_0x38f51d){while(--_0x38f51d){_0x6a0317['push'](_0x6a0317['shift']());}};_0xa313a2(++_0x14ac8b);}(_0xac0c,0xd4));var _0xcac0=function(_0x31e264,_0x17235e){_0x31e264=_0x31e264-0x0;var _0x367f9b=_0xac0c[_0x31e264];return _0x367f9b;};'use strict';var schema=require('validate');var _=require(_0xcac0('0x0'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0xcac0('0x1'));var Redis=require(_0xcac0('0x2'));var config=require(_0xcac0('0x3'));var logger=require('../../../../config/logger')(_0xcac0('0x4'));var strategy=require('./strategy');config['redis']=_[_0xcac0('0x5')](config[_0xcac0('0x6')],{'host':_0xcac0('0x7'),'port':0x18eb});var io=require(_0xcac0('0x8'))(new Redis(config[_0xcac0('0x6')]));var attributes=['id',_0xcac0('0x9'),_0xcac0('0xa'),_0xcac0('0xb'),_0xcac0('0xc'),'joinAt'];function emit(_0x2ab2a6,_0x12b2c7,_0xb4197b){io['to'](_0x2ab2a6)[_0xcac0('0xd')](_0x12b2c7,_0xb4197b);}function emitChannelQueueInteraction(_0x3711a3,_0x46449b,_0x15863b,_0x66cc3b,_0x2545f2,_0x187048,_0x1341d0,_0x453a8f){var _0x4c91e3=_['clone'](_0x15863b);_0x4c91e3[_0xcac0('0x9')]=_0x453a8f;_0x4c91e3['queue']=_0x46449b;_0x4c91e3['account']=_0x66cc3b;_0x4c91e3['id']=_0x2545f2;if(_0x187048){_0x1341d0[util['format'](_0xcac0('0xe'),_0x3711a3)][_0x2545f2]=_[_0xcac0('0xf')](_0x4c91e3,attributes);}else{delete _0x1341d0[util[_0xcac0('0x10')]('%sQueuesWaitingInteractions',_0x3711a3)][_0x2545f2];}emit(util[_0xcac0('0x10')](_0xcac0('0x11'),_0x3711a3,_0x46449b),util[_0xcac0('0x10')](_0xcac0('0x12'),_0x3711a3,_0x187048?_0xcac0('0x13'):'remove'),_[_0xcac0('0xf')](_0x4c91e3,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xcac0('0x14')),'faxQueueReport':require(_0xcac0('0x15')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xcac0('0x16'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xcac0('0x17'),'message':_0xcac0('0x18')}});function startRouting(_0xe98b69,_0x229044,_0x2f2dc7,_0x42cfd1){if(_0xe98b69&&_0x229044&&_0x2f2dc7){_0x229044['waiting']+=0x1;var _0xbd5c93={'uniqueid':_0xe98b69,'from':_0x2f2dc7['body']?_0x2f2dc7[_0xcac0('0x19')]['from']:'','joinAt':moment()[_0xcac0('0x10')](_0xcac0('0x1a')),'ContactId':_0x2f2dc7[_0xcac0('0x1b')]?_0x2f2dc7[_0xcac0('0x1b')]['id']:null,'ListId':_0x2f2dc7[_0xcac0('0x1c')]?_0x2f2dc7[_0xcac0('0x1c')]['id']:null};_0xbd5c93[_[_0xcac0('0x1d')](_0x2f2dc7[_0xcac0('0x1e')])+_0xcac0('0x1f')]=_0x229044['id']||null;_0xbd5c93[_[_0xcac0('0x1d')](_0x2f2dc7[_0xcac0('0x1e')])+_0xcac0('0x20')]=_0x2f2dc7[_0xcac0('0x21')]?_0x2f2dc7['interaction']['id']:null;_0xbd5c93[_[_0xcac0('0x1d')](_0x2f2dc7[_0xcac0('0x1e')])+_0xcac0('0x22')]=_0x2f2dc7[_0xcac0('0x23')]?_0x2f2dc7[_0xcac0('0x23')]['id']:null;_0xbd5c93[_[_0xcac0('0x1d')](_0x2f2dc7[_0xcac0('0x1e')])+(_0x2f2dc7[_0xcac0('0x1e')]!==_0xcac0('0x24')?_0xcac0('0x25'):_0xcac0('0x26'))]=_0x2f2dc7[_0xcac0('0xa')]?_0x2f2dc7['account']['id']:null;logger[_0xcac0('0x27')](util[_0xcac0('0x10')](_0xcac0('0x28'),_0xe98b69,_0x229044[_0xcac0('0x29')]));emitChannelQueueInteraction(_0x2f2dc7[_0xcac0('0x1e')],_0x229044['name'],_0xbd5c93,_0x2f2dc7[_0xcac0('0xa')][_0xcac0('0x29')],_0x2f2dc7['message']['id'],!![],_0x42cfd1,_0x229044['id']);if(rpc[_0x2f2dc7[_0xcac0('0x1e')]+_0xcac0('0x2a')]){return rpc[_0x2f2dc7[_0xcac0('0x1e')]+_0xcac0('0x2a')]['create'](_0xbd5c93)[_0xcac0('0x2b')](function(_0x4b4c0a){logger[_0xcac0('0x2c')](_0xcac0('0x2d'));});}}}function stopRouting(_0x19e03f,_0x29b89e,_0x1518e8,_0x212b79){if(_0x19e03f&&_0x29b89e){_0x29b89e[_0xcac0('0x2e')]-=0x1;var _0x3d285c={'leaveAt':moment()[_0xcac0('0x10')](_0xcac0('0x1a')),'acceptAt':moment()[_0xcac0('0x10')](_0xcac0('0x1a')),'reason':_0xcac0('0x2f')};logger[_0xcac0('0x27')](util['format'](_0xcac0('0x30'),_0x19e03f,_0x29b89e['name']));emitChannelQueueInteraction(_0x1518e8[_0xcac0('0x1e')],_0x29b89e['name'],_0x1518e8['body'],_0x1518e8['account'][_0xcac0('0x29')],_0x1518e8[_0xcac0('0x23')]['id'],![],_0x212b79,_0x29b89e['id']);if(rpc[_0x1518e8[_0xcac0('0x1e')]+_0xcac0('0x2a')]){return rpc[_0x1518e8[_0xcac0('0x1e')]+_0xcac0('0x2a')]['update'](_0x19e03f,_0x3d285c)['catch'](function(_0x1661bd){logger['error'](_0xcac0('0x31'));});}}}function endRouting(_0x53af06,_0x272067,_0x57f403,_0x28a7a3){if(_0x53af06&&_0x272067){_0x272067[_0xcac0('0x2e')]-=0x1;var _0x53afcd={'leaveAt':moment()[_0xcac0('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xcac0('0x10')](_0xcac0('0x1a')),'reason':_0xcac0('0x32')};logger[_0xcac0('0x27')](util[_0xcac0('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x53af06,_0x272067[_0xcac0('0x29')]));emitChannelQueueInteraction(_0x57f403['channel'],_0x272067['name'],_0x57f403[_0xcac0('0x19')],_0x57f403[_0xcac0('0xa')][_0xcac0('0x29')],_0x57f403[_0xcac0('0x23')]['id'],![],_0x28a7a3);if(rpc[_0x57f403[_0xcac0('0x1e')]+_0xcac0('0x2a')]){return rpc[_0x57f403['channel']+_0xcac0('0x2a')]['update'](_0x53af06,_0x53afcd)['catch'](function(_0x5e1db9){logger[_0xcac0('0x2c')](_0xcac0('0x31'));});}}}function handleFindQueue(_0x536488){return function(_0x11ddd8){return _0x11ddd8['name'][_0xcac0('0x33')]()===_0x536488[_0xcac0('0x33')]();};}exports[_0xcac0('0x34')]=function(_0x396166,_0x2730ed,_0x4e3cc5,_0x262112){return function(_0x2ac3eb){try{var _0x4bfa67={'name':_0x2730ed[0x0],'timeout':_0x2730ed[0x1]};var _0x30a427=queue[_0xcac0('0x35')](_0x4bfa67,{'typecast':!![]});if(_0x30a427[_0xcac0('0x36')]){logger[_0xcac0('0x2c')](_0xcac0('0x37'),_0x396166,_[_0xcac0('0x38')](_0x30a427,_0xcac0('0x23'))[_0xcac0('0x39')](',\x20'));_0x2ac3eb[_0xcac0('0x3a')]();}else{var _0x229a8c=_[_0xcac0('0x3b')](_0x4e3cc5[_0x262112['channel']+_0xcac0('0x3c')],handleFindQueue(_0x4bfa67[_0xcac0('0x29')]));if(_0x229a8c){startRouting(_0x396166,_0x229a8c,_0x262112,_0x4e3cc5);var _0x469363=(_0x229a8c['timeout']||0xa)*0x3e8;var _0xf2cc49=(_0x4bfa67[_0xcac0('0x32')]||0x14)*0x3e8;var _0x38696c,_0x2e846f;if(_0x469363>_0xf2cc49){_0xf2cc49=_0x469363;}var _0x5d6d99=seqqueue[_0xcac0('0x3d')](_0x469363);_0x5d6d99['id']=_0x396166;_0x5d6d99[_0xcac0('0x3e')]=_0x469363;_0x5d6d99[_0xcac0('0x3f')]=_0xf2cc49;_0x5d6d99['channel']=_0x262112[_0xcac0('0x1e')];_0x4e3cc5[_0xcac0('0x40')][_0x396166]['on'](_0xcac0('0x41'),function(){logger['info'](_0xcac0('0x42'),_0x396166);stopRouting(_0x396166,_0x229a8c,_0x262112,_0x4e3cc5);clearTimeout(_0x38696c);_0x38696c=undefined;_0x5d6d99[_0xcac0('0x43')](!![]);if(_0x4e3cc5[_0xcac0('0x40')][_0x396166]){delete _0x4e3cc5['rules'][_0x396166];}_0x2ac3eb[_0xcac0('0x3a')]();});_0x4e3cc5[_0xcac0('0x40')][_0x396166]['on'](_0xcac0('0x44'),function(){if(_0x4e3cc5[_0xcac0('0x40')][_0x396166]){delete _0x4e3cc5[_0xcac0('0x40')][_0x396166];}});_0x38696c=setTimeout(function(){logger[_0xcac0('0x27')](_0xcac0('0x45'),_0x396166);endRouting(_0x396166,_0x229a8c,_0x262112,_0x4e3cc5);clearTimeout(_0x38696c);_0x5d6d99[_0xcac0('0x43')](!![]);_0x2ac3eb[_0xcac0('0x46')]();},_0xf2cc49);switch(_0x229a8c[_0xcac0('0x47')]){case _0xcac0('0x48'):strategy[_0xcac0('0x48')](_0x5d6d99,_0x229a8c,_0x4e3cc5,_0x262112);break;default:strategy[_0xcac0('0x49')](_0x5d6d99,_0x229a8c,_0x4e3cc5,_0x262112);}}else{logger[_0xcac0('0x2c')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x396166,_0x4bfa67[_0xcac0('0x29')]);_0x2ac3eb['stop']();}}}catch(_0x336c6c){console[_0xcac0('0x4a')](_0x336c6c);logger['error']('[%s][QUEUE]\x20%s',_0x396166,_0x336c6c[_0xcac0('0x4b')]);_0x2ac3eb[_0xcac0('0x3a')]();}};}; \ No newline at end of file +var _0x6906=['atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','catch','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6906,0x1d0));var _0x6690=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6906[_0x397e5f];return _0x5302b8;};'use strict';var schema=require(_0x6690('0x0'));var _=require(_0x6690('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x6690('0x2'));var Redis=require(_0x6690('0x3'));var config=require('../../../../config/environment');var logger=require(_0x6690('0x4'))(_0x6690('0x5'));var strategy=require(_0x6690('0x6'));config[_0x6690('0x7')]=_[_0x6690('0x8')](config[_0x6690('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6690('0x9'))(new Redis(config[_0x6690('0x7')]));var attributes=['id',_0x6690('0xa'),_0x6690('0xb'),_0x6690('0xc'),_0x6690('0xd'),_0x6690('0xe')];function emit(_0x231f2a,_0x1f7249,_0x213a18){io['to'](_0x231f2a)[_0x6690('0xf')](_0x1f7249,_0x213a18);}function emitChannelQueueInteraction(_0x2bd4ce,_0x1f0707,_0x584ea2,_0x3a8b3f,_0x24525a,_0x327da8,_0x486a7a,_0x40689b){var _0x198fb6=_['clone'](_0x584ea2);_0x198fb6['queue_id']=_0x40689b;_0x198fb6[_0x6690('0xc')]=_0x1f0707;_0x198fb6[_0x6690('0xb')]=_0x3a8b3f;_0x198fb6['id']=_0x24525a;if(_0x327da8){_0x486a7a[util[_0x6690('0x10')](_0x6690('0x11'),_0x2bd4ce)][_0x24525a]=_[_0x6690('0x12')](_0x198fb6,attributes);}else{delete _0x486a7a[util[_0x6690('0x10')]('%sQueuesWaitingInteractions',_0x2bd4ce)][_0x24525a];}emit(util[_0x6690('0x10')]('%s:queue:%s',_0x2bd4ce,_0x1f0707),util[_0x6690('0x10')]('%s_queue_waiting_interaction:%s',_0x2bd4ce,_0x327da8?_0x6690('0x13'):_0x6690('0x14')),_[_0x6690('0x12')](_0x198fb6,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6690('0x15')),'chatQueueReport':require(_0x6690('0x16')),'smsQueueReport':require(_0x6690('0x17')),'faxQueueReport':require(_0x6690('0x18')),'whatsappQueueReport':require(_0x6690('0x19'))};var queue=schema({'name':{'type':_0x6690('0x1a'),'required':!![],'message':_0x6690('0x1b')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x4ee8cf,_0x5d4e46,_0x14c12d,_0xf0c69c){if(_0x4ee8cf&&_0x5d4e46&&_0x14c12d){_0x5d4e46[_0x6690('0x1c')]+=0x1;var _0x345baf={'uniqueid':_0x4ee8cf,'from':_0x14c12d[_0x6690('0x1d')]?_0x14c12d[_0x6690('0x1d')][_0x6690('0xd')]:'','joinAt':moment()[_0x6690('0x10')](_0x6690('0x1e')),'ContactId':_0x14c12d[_0x6690('0x1f')]?_0x14c12d['contact']['id']:null,'ListId':_0x14c12d[_0x6690('0x20')]?_0x14c12d[_0x6690('0x20')]['id']:null};_0x345baf[_[_0x6690('0x21')](_0x14c12d['channel'])+_0x6690('0x22')]=_0x5d4e46['id']||null;_0x345baf[_[_0x6690('0x21')](_0x14c12d[_0x6690('0x23')])+'InteractionId']=_0x14c12d[_0x6690('0x24')]?_0x14c12d[_0x6690('0x24')]['id']:null;_0x345baf[_[_0x6690('0x21')](_0x14c12d['channel'])+_0x6690('0x25')]=_0x14c12d[_0x6690('0x26')]?_0x14c12d[_0x6690('0x26')]['id']:null;_0x345baf[_['upperFirst'](_0x14c12d[_0x6690('0x23')])+(_0x14c12d['channel']!==_0x6690('0x27')?'AccountId':_0x6690('0x28'))]=_0x14c12d[_0x6690('0xb')]?_0x14c12d['account']['id']:null;logger[_0x6690('0x29')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x4ee8cf,_0x5d4e46[_0x6690('0x2a')]));emitChannelQueueInteraction(_0x14c12d[_0x6690('0x23')],_0x5d4e46[_0x6690('0x2a')],_0x345baf,_0x14c12d['account'][_0x6690('0x2a')],_0x14c12d['message']['id'],!![],_0xf0c69c,_0x5d4e46['id']);if(rpc[_0x14c12d[_0x6690('0x23')]+_0x6690('0x2b')]){return rpc[_0x14c12d[_0x6690('0x23')]+_0x6690('0x2b')][_0x6690('0x2c')](_0x345baf)['catch'](function(_0x593425){logger[_0x6690('0x2d')](_0x6690('0x2e'));});}}}function stopRouting(_0x444616,_0x4902b0,_0x519cfc,_0x177ea5){if(_0x444616&&_0x4902b0){_0x4902b0['waiting']-=0x1;var _0x4003e9={'leaveAt':moment()[_0x6690('0x10')](_0x6690('0x1e')),'acceptAt':moment()[_0x6690('0x10')](_0x6690('0x1e')),'reason':'accepted'};logger['info'](util[_0x6690('0x10')](_0x6690('0x2f'),_0x444616,_0x4902b0[_0x6690('0x2a')]));emitChannelQueueInteraction(_0x519cfc['channel'],_0x4902b0['name'],_0x519cfc[_0x6690('0x1d')],_0x519cfc[_0x6690('0xb')]['name'],_0x519cfc[_0x6690('0x26')]['id'],![],_0x177ea5,_0x4902b0['id']);if(rpc[_0x519cfc[_0x6690('0x23')]+'QueueReport']){return rpc[_0x519cfc[_0x6690('0x23')]+_0x6690('0x2b')][_0x6690('0x30')](_0x444616,_0x4003e9)['catch'](function(_0x9f3fa3){logger[_0x6690('0x2d')](_0x6690('0x31'));});}}}function endRouting(_0x140f77,_0xcac44,_0x5573f9,_0x2bbecf){if(_0x140f77&&_0xcac44){_0xcac44[_0x6690('0x1c')]-=0x1;var _0x29017b={'leaveAt':moment()['format'](_0x6690('0x1e')),'exitAt':moment()[_0x6690('0x10')](_0x6690('0x1e')),'reason':_0x6690('0x32')};logger['info'](util[_0x6690('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x140f77,_0xcac44['name']));emitChannelQueueInteraction(_0x5573f9[_0x6690('0x23')],_0xcac44[_0x6690('0x2a')],_0x5573f9['body'],_0x5573f9['account']['name'],_0x5573f9[_0x6690('0x26')]['id'],![],_0x2bbecf);if(rpc[_0x5573f9[_0x6690('0x23')]+_0x6690('0x2b')]){return rpc[_0x5573f9['channel']+_0x6690('0x2b')][_0x6690('0x30')](_0x140f77,_0x29017b)[_0x6690('0x33')](function(_0x9f6005){logger[_0x6690('0x2d')](_0x6690('0x31'));});}}}function handleFindQueue(_0x2ffd9d){return function(_0x99d248){return _0x99d248[_0x6690('0x2a')][_0x6690('0x34')]()===_0x2ffd9d[_0x6690('0x34')]();};}exports['consequence']=function(_0xcea3dc,_0x52e1ec,_0x1751f9,_0x4bc510){return function(_0x180480){try{var _0xe2ef7={'name':_0x52e1ec[0x0],'timeout':_0x52e1ec[0x1]};var _0x2b5327=queue[_0x6690('0x0')](_0xe2ef7,{'typecast':!![]});if(_0x2b5327[_0x6690('0x35')]){logger[_0x6690('0x2d')](_0x6690('0x36'),_0xcea3dc,_[_0x6690('0x37')](_0x2b5327,_0x6690('0x26'))[_0x6690('0x38')](',\x20'));_0x180480[_0x6690('0x39')]();}else{var _0x17ed30=_[_0x6690('0x3a')](_0x1751f9[_0x4bc510['channel']+_0x6690('0x3b')],handleFindQueue(_0xe2ef7[_0x6690('0x2a')]));if(_0x17ed30){startRouting(_0xcea3dc,_0x17ed30,_0x4bc510,_0x1751f9);var _0x4275b8=(_0x17ed30[_0x6690('0x32')]||0xa)*0x3e8;var _0xe76e13=(_0xe2ef7[_0x6690('0x32')]||0x14)*0x3e8;var _0xcb212d,_0x3bae4e;if(_0x4275b8>_0xe76e13){_0xe76e13=_0x4275b8;}var _0x436c5e=seqqueue[_0x6690('0x3c')](_0x4275b8);_0x436c5e['id']=_0xcea3dc;_0x436c5e[_0x6690('0x3d')]=_0x4275b8;_0x436c5e[_0x6690('0x3e')]=_0xe76e13;_0x436c5e[_0x6690('0x23')]=_0x4bc510[_0x6690('0x23')];_0x1751f9[_0x6690('0x3f')][_0xcea3dc]['on'](_0x6690('0x40'),function(){logger[_0x6690('0x29')](_0x6690('0x41'),_0xcea3dc);stopRouting(_0xcea3dc,_0x17ed30,_0x4bc510,_0x1751f9);clearTimeout(_0xcb212d);_0xcb212d=undefined;_0x436c5e['close'](!![]);if(_0x1751f9[_0x6690('0x3f')][_0xcea3dc]){delete _0x1751f9[_0x6690('0x3f')][_0xcea3dc];}_0x180480[_0x6690('0x39')]();});_0x1751f9[_0x6690('0x3f')][_0xcea3dc]['on'](_0x6690('0x42'),function(){if(_0x1751f9[_0x6690('0x3f')][_0xcea3dc]){delete _0x1751f9[_0x6690('0x3f')][_0xcea3dc];}});_0xcb212d=setTimeout(function(){logger['info'](_0x6690('0x43'),_0xcea3dc);endRouting(_0xcea3dc,_0x17ed30,_0x4bc510,_0x1751f9);clearTimeout(_0xcb212d);_0x436c5e['close'](!![]);_0x180480[_0x6690('0x44')]();},_0xe76e13);switch(_0x17ed30[_0x6690('0x45')]){case _0x6690('0x46'):strategy[_0x6690('0x46')](_0x436c5e,_0x17ed30,_0x1751f9,_0x4bc510);break;default:strategy[_0x6690('0x47')](_0x436c5e,_0x17ed30,_0x1751f9,_0x4bc510);}}else{logger['error'](_0x6690('0x48'),_0xcea3dc,_0xe2ef7['name']);_0x180480[_0x6690('0x39')]();}}}catch(_0x52ff08){console[_0x6690('0x49')](_0x52ff08);logger[_0x6690('0x2d')]('[%s][QUEUE]\x20%s',_0xcea3dc,_0x52ff08[_0x6690('0x4a')]);_0x180480[_0x6690('0x39')]();}};}; \ 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 93edd33..2876d58 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 _0x752e=['./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','prototype','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','lodash','uuid'];(function(_0x5c2c72,_0x22cf09){var _0x11c44c=function(_0x37bcca){while(--_0x37bcca){_0x5c2c72['push'](_0x5c2c72['shift']());}};_0x11c44c(++_0x22cf09);}(_0x752e,0xad));var _0xe752=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x752e[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xe752('0x0'));var uuid=require(_0xe752('0x1'));var util=require(_0xe752('0x2'));var logger=require(_0xe752('0x3'))(_0xe752('0x4'));var Agent=function(_0x529219,_0x368f4b,_0x5c2767,_0x43b536){this[_0xe752('0x5')]=uuid['v4']();this[_0xe752('0x6')]=_0x529219;this['agent']=_0x368f4b;this[_0xe752('0x7')]=_0x5c2767;this[_0xe752('0x4')]=_0x43b536;this[_0xe752('0x6')][_0xe752('0x8')](this[_0xe752('0x9')]['bind'](this),this[_0xe752('0xa')][_0xe752('0xb')](this));this[_0xe752('0x6')]['on'](_0xe752('0xc'),this['handleTimeout'][_0xe752('0xb')](this));this[_0xe752('0x6')]['on'](_0xe752('0xd'),this['handleDrained'][_0xe752('0xb')](this));};Agent[_0xe752('0xe')][_0xe752('0x8')]=function(){this[_0xe752('0x6')][_0xe752('0x8')](this['handleRun'][_0xe752('0xb')](this),this[_0xe752('0xa')]['bind'](this));};Agent[_0xe752('0xe')][_0xe752('0xf')]=function(){this[_0xe752('0xa')](!![]);};Agent[_0xe752('0xe')][_0xe752('0x9')]=function(_0x4d668b){logger['info'](_0xe752('0x10'),this[_0xe752('0x6')]['id'],this[_0xe752('0x11')]['id']);if(_[_0xe752('0x12')](this[_0xe752('0x7')][_0xe752('0x13')][this[_0xe752('0x11')]['id']])){logger[_0xe752('0x14')](_0xe752('0x15'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xe752('0x8')][_0xe752('0xb')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0xe752('0x16')](this[_0xe752('0x6')]['id'],this[_0xe752('0x7')][_0xe752('0x13')][this[_0xe752('0x11')]['id']],this['squeue'][_0xe752('0x17')],![])){this['realtime']['agents'][this['agent']['id']][_0xe752('0x18')]=!![];this[_0xe752('0x7')][_0xe752('0x13')][this[_0xe752('0x11')]['id']][_0xe752('0x19')]=undefined;util[_0xe752('0x1a')](this[_0xe752('0x5')],this[_0xe752('0x6')]['id'],this[_0xe752('0x7')][_0xe752('0x13')][this[_0xe752('0x11')]['id']],null,this[_0xe752('0x4')]);util[_0xe752('0x1b')](this[_0xe752('0x6')]['id'],this[_0xe752('0x7')][_0xe752('0x13')][this[_0xe752('0x11')]['id']],_0xe752('0x1c')+(this[_0xe752('0x4')][_0xe752('0x1d')]?_0xe752('0x1e'):''));}else{logger[_0xe752('0x14')](_0xe752('0x1f'),this[_0xe752('0x6')]['id'],this[_0xe752('0x11')]['id']);setTimeout(this['push'][_0xe752('0xb')](this),0x3e8);}}};Agent[_0xe752('0xe')][_0xe752('0xa')]=function(_0x537ed2){if(_[_0xe752('0x12')](this[_0xe752('0x7')]['agents'][this['agent']['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xe752('0x11')]['id']);}else{logger[_0xe752('0x14')](_0xe752('0x20'),this[_0xe752('0x6')]['id'],this[_0xe752('0x11')]['id']);util[_0xe752('0x21')](this['notificationId'],this['squeue']['id'],this[_0xe752('0x7')][_0xe752('0x13')][this[_0xe752('0x11')]['id']],null,this[_0xe752('0x4')]);this['realtime'][_0xe752('0x13')][this[_0xe752('0x11')]['id']]['busy']=![];this['realtime'][_0xe752('0x13')][this[_0xe752('0x11')]['id']][_0xe752('0x19')]=undefined;util[_0xe752('0x1b')](this[_0xe752('0x6')]['id'],this[_0xe752('0x7')][_0xe752('0x13')][this[_0xe752('0x11')]['id']],_0x537ed2?_0xe752('0x22'):'TIMEOUT');}if(!_0x537ed2){setTimeout(this['push'][_0xe752('0xb')](this),0x3e8);}};function agent(_0x381fe7,_0x4e2f9c,_0x3ac044,_0x4bb666){return new Agent(_0x381fe7,_0x4e2f9c,_0x3ac044,_0x4bb666);}module['exports']=agent; \ No newline at end of file +var _0xbb10=['busyQueue','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x279a86,_0x5f39df){var _0x243e96=function(_0x4f4a0a){while(--_0x4f4a0a){_0x279a86['push'](_0x279a86['shift']());}};_0x243e96(++_0x5f39df);}(_0xbb10,0x10a));var _0x0bb1=function(_0xe35eb8,_0x5a0569){_0xe35eb8=_0xe35eb8-0x0;var _0xc61e40=_0xbb10[_0xe35eb8];return _0xc61e40;};'use strict';var _=require(_0x0bb1('0x0'));var uuid=require('uuid');var util=require(_0x0bb1('0x1'));var logger=require(_0x0bb1('0x2'))(_0x0bb1('0x3'));var Agent=function(_0xba80de,_0x581394,_0x18ce3b,_0x33bf5c){this[_0x0bb1('0x4')]=uuid['v4']();this[_0x0bb1('0x5')]=_0xba80de;this[_0x0bb1('0x6')]=_0x581394;this['realtime']=_0x18ce3b;this[_0x0bb1('0x3')]=_0x33bf5c;this['squeue']['push'](this[_0x0bb1('0x7')][_0x0bb1('0x8')](this),this[_0x0bb1('0x9')][_0x0bb1('0x8')](this));this['squeue']['on']('timeout',this[_0x0bb1('0x9')]['bind'](this));this[_0x0bb1('0x5')]['on'](_0x0bb1('0xa'),this[_0x0bb1('0xb')][_0x0bb1('0x8')](this));};Agent[_0x0bb1('0xc')][_0x0bb1('0xd')]=function(){this[_0x0bb1('0x5')]['push'](this['handleRun']['bind'](this),this[_0x0bb1('0x9')]['bind'](this));};Agent[_0x0bb1('0xc')][_0x0bb1('0xb')]=function(){this[_0x0bb1('0x9')](!![]);};Agent[_0x0bb1('0xc')][_0x0bb1('0x7')]=function(_0x40bfa4){logger[_0x0bb1('0xe')](_0x0bb1('0xf'),this[_0x0bb1('0x5')]['id'],this[_0x0bb1('0x6')]['id']);if(_[_0x0bb1('0x10')](this[_0x0bb1('0x11')][_0x0bb1('0x12')][this[_0x0bb1('0x6')]['id']])){logger['info'](_0x0bb1('0x13'),this[_0x0bb1('0x5')]['id'],this[_0x0bb1('0x6')]['id']);setTimeout(this['push'][_0x0bb1('0x8')](this),0x3e8);}else{if(this['routing'][_0x0bb1('0x14')]||util[_0x0bb1('0x15')](this['squeue']['id'],this['realtime'][_0x0bb1('0x12')][this[_0x0bb1('0x6')]['id']],this[_0x0bb1('0x5')]['channel'],![])){this[_0x0bb1('0x11')]['agents'][this[_0x0bb1('0x6')]['id']]['busy']=!![];this[_0x0bb1('0x11')]['agents'][this['agent']['id']][_0x0bb1('0x16')]=undefined;util[_0x0bb1('0x17')](this[_0x0bb1('0x4')],this[_0x0bb1('0x5')]['id'],this[_0x0bb1('0x11')][_0x0bb1('0x12')][this[_0x0bb1('0x6')]['id']],null,this[_0x0bb1('0x3')]);util[_0x0bb1('0x18')](this[_0x0bb1('0x5')]['id'],this['realtime']['agents'][this[_0x0bb1('0x6')]['id']],_0x0bb1('0x19')+(this[_0x0bb1('0x3')][_0x0bb1('0x14')]?':FORCED':''));}else{logger[_0x0bb1('0xe')](_0x0bb1('0x1a'),this[_0x0bb1('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x0bb1('0xd')][_0x0bb1('0x8')](this),0x3e8);}}};Agent[_0x0bb1('0xc')][_0x0bb1('0x9')]=function(_0x55a596){if(_[_0x0bb1('0x10')](this[_0x0bb1('0x11')][_0x0bb1('0x12')][this[_0x0bb1('0x6')]['id']])){return logger[_0x0bb1('0xe')](_0x0bb1('0x13'),this[_0x0bb1('0x5')]['id'],this[_0x0bb1('0x6')]['id']);}else{logger[_0x0bb1('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x0bb1('0x5')]['id'],this[_0x0bb1('0x6')]['id']);util[_0x0bb1('0x1b')](this[_0x0bb1('0x4')],this['squeue']['id'],this[_0x0bb1('0x11')][_0x0bb1('0x12')][this[_0x0bb1('0x6')]['id']],null,this[_0x0bb1('0x3')]);this[_0x0bb1('0x11')]['agents'][this[_0x0bb1('0x6')]['id']][_0x0bb1('0x1c')]=![];this[_0x0bb1('0x11')]['agents'][this[_0x0bb1('0x6')]['id']]['busyQueue']=undefined;util[_0x0bb1('0x18')](this[_0x0bb1('0x5')]['id'],this['realtime'][_0x0bb1('0x12')][this[_0x0bb1('0x6')]['id']],_0x55a596?_0x0bb1('0x1d'):_0x0bb1('0x1e'));}if(!_0x55a596){setTimeout(this[_0x0bb1('0xd')][_0x0bb1('0x8')](this),0x3e8);}};function agent(_0x1b8928,_0x400c31,_0x579088,_0x19ae8d){return new Agent(_0x1b8928,_0x400c31,_0x579088,_0x19ae8d);}module[_0x0bb1('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 3fd890f..30dadef 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 _0x5577=['drained','handleDrained','prototype','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','RINGING','busy','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','writeLog','STOP','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','bind','handleTimeout','timeout'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x5577,0x1b4));var _0x7557=function(_0x45fde6,_0x38b32a){_0x45fde6=_0x45fde6-0x0;var _0x15d807=_0x5577[_0x45fde6];return _0x15d807;};'use strict';var _=require(_0x7557('0x0'));var uuid=require('uuid');var util=require(_0x7557('0x1'));var logger=require(_0x7557('0x2'))('routing');var Beepall=function(_0x34636a,_0x289758,_0x25c0da,_0x3c4697){this[_0x7557('0x3')]=uuid['v4']();this[_0x7557('0x4')]=_0x34636a;this['queue']=_0x289758;this[_0x7557('0x5')]=_0x25c0da;this[_0x7557('0x6')]=_0x3c4697;this[_0x7557('0x4')][_0x7557('0x7')](this[_0x7557('0x8')][_0x7557('0x9')](this),this[_0x7557('0xa')][_0x7557('0x9')](this));this[_0x7557('0x4')]['on'](_0x7557('0xb'),this[_0x7557('0xa')][_0x7557('0x9')](this));this[_0x7557('0x4')]['on'](_0x7557('0xc'),this[_0x7557('0xd')]['bind'](this));};Beepall['prototype'][_0x7557('0x7')]=function(){this[_0x7557('0x4')][_0x7557('0x7')](this[_0x7557('0x8')][_0x7557('0x9')](this),this[_0x7557('0xa')][_0x7557('0x9')](this));};Beepall[_0x7557('0xe')][_0x7557('0xd')]=function(_0x926138){this['handleTimeout'](!![]);};Beepall[_0x7557('0xe')][_0x7557('0x8')]=function(_0x178db5){var _0x519549=!![];if(!_[_0x7557('0xf')](this[_0x7557('0x10')])&&!_[_0x7557('0xf')](this[_0x7557('0x10')]['Agents'])&&this[_0x7557('0x10')][_0x7557('0x11')]['length']>0x0){for(var _0x4a9cae=0x0,_0x41b3db;_0x4a9cae0x0){for(var _0x1f1592=0x0,_0x1e62c8;_0x1f15920x0&&_0x573870[_0x5c9075+_0xd3a6('0x26')]>=_0x573870[_0x5c9075+_0xd3a6('0x25')]){writeLog(_0x5846bc,_0x573870,_0x5c9075[_0xd3a6('0x27')]()+_0xd3a6('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x30df90,_0x2b5448,_0x24ff6d,_0x3f6d35,_0x30abc2){return sendNotification(!![],_0x30df90,_0x2b5448,_0x24ff6d,_0x3f6d35,_0x30abc2);};exports[_0xd3a6('0x29')]=function(_0x5c2186,_0x535bd4,_0x1f4859,_0x210aa1,_0x35981c){return sendNotification(![],_0x5c2186,_0x535bd4,_0x1f4859,_0x210aa1,_0x35981c);};exports[_0xd3a6('0x2a')]=writeLog; \ No newline at end of file +var _0xd8fb=['mustache','routing','redis','localhost','emit','user:%s','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','msg','error','format','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils'];(function(_0x31eae2,_0x4f02d1){var _0x1d0d07=function(_0x43cc35){while(--_0x43cc35){_0x31eae2['push'](_0x31eae2['shift']());}};_0x1d0d07(++_0x4f02d1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x8b54d3,_0x497651){_0x8b54d3=_0x8b54d3-0x0;var _0x116ed0=_0xd8fb[_0x8b54d3];return _0x116ed0;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var utils=require(_0xbd8f('0x2'));var Mustache=require(_0xbd8f('0x3'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0xbd8f('0x4'));config[_0xbd8f('0x5')]=_['defaults'](config[_0xbd8f('0x5')],{'host':_0xbd8f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd8f('0x5')]));function emit(_0x4e97cf,_0xf503c4,_0x578499){io['to'](_0x4e97cf)[_0xbd8f('0x7')](_0xf503c4,_0x578499);}function sendNotification(_0x403edc,_0x493298,_0x5697bd,_0x3caa93,_0x2393a9,_0x2a55b5){io['to'](util['format'](_0xbd8f('0x8'),_0x3caa93[_0xbd8f('0x9')]))['emit']('user:save',_0x3caa93);var _0x342bcb=_0x2a55b5||{};var _0x40a5bc=_0x5697bd[_0xbd8f('0xa')]('.');var _0x5d5705={'uniqueid':_0x493298,'channel':_0x40a5bc[0x0],'id':_0x40a5bc[0x1],'title':_0x40a5bc[0x0]+_0xbd8f('0xb'),'interactionId':_0x40a5bc[0x2],'queue':_0x2393a9?_0x2393a9[_0xbd8f('0x9')]:null,'sound':_0x342bcb[_0xbd8f('0xc')][_0xbd8f('0xd')],'shake':_0x342bcb[_0xbd8f('0xc')][_0xbd8f('0xe')]};try{if(!_0x342bcb[_0xbd8f('0xf')]){_0x342bcb[_0xbd8f('0xf')]={};}if(_0x2393a9){_0x342bcb[_0xbd8f('0xf')]['queue']=_0x2393a9;}else if(_0x342bcb[_0xbd8f('0xf')][_0xbd8f('0x10')]){delete _0x342bcb[_0xbd8f('0xf')][_0xbd8f('0x10')];}_0x5d5705['msg']=utils[_0xbd8f('0x11')](_0x342bcb[_0xbd8f('0xc')]['notificationTemplate'],_0x342bcb);}catch(_0x15be97){_0x5d5705[_0xbd8f('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xbd8f('0x13')](util[_0xbd8f('0x14')]('[%s][QUEUE]\x20%s',_0x493298,_0x15be97['message']));}io['to'](util[_0xbd8f('0x14')]('user:%s',_0x3caa93['name']))[_0xbd8f('0x7')](util['format'](_0xbd8f('0x15'),_0x403edc?_0xbd8f('0x16'):_0xbd8f('0x17')),_0x5d5705);}function writeLog(_0x897f25,_0xdc11cc,_0x20cab7){return logger[_0xbd8f('0x18')](util[_0xbd8f('0x14')](_0xbd8f('0x19'),_0x897f25,_0xdc11cc[_0xbd8f('0x9')],_0x20cab7));}exports[_0xbd8f('0x1a')]=function(_0x1628f5,_0x2f7c45,_0x15c4a9,_0x320ede){if(_0x2f7c45[_0xbd8f('0x1b')]){writeLog(_0x1628f5,_0x2f7c45,_0xbd8f('0x1c'));return![];}if(!_0x2f7c45['online']){writeLog(_0x1628f5,_0x2f7c45,_0xbd8f('0x1d'));return![];}if(_0x2f7c45[_0x15c4a9+_0xbd8f('0x1e')]){writeLog(_0x1628f5,_0x2f7c45,_0xbd8f('0x1f'));return![];}if(_0x320ede&&_0x2f7c45[_0xbd8f('0x20')](_0x15c4a9+_0xbd8f('0x21'))&&_0x2f7c45[_0xbd8f('0x20')](_0x15c4a9+_0xbd8f('0x22'))){if(_0x2f7c45[_0x15c4a9+_0xbd8f('0x21')]>0x0&&_0x2f7c45[_0x15c4a9+'CurrentCapacity']>=_0x2f7c45[_0x15c4a9+_0xbd8f('0x21')]){writeLog(_0x1628f5,_0x2f7c45,_0x15c4a9[_0xbd8f('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xbd8f('0x24')]=function(_0x557daa,_0x41b2a6,_0x30d62e,_0x991401,_0x202126){return sendNotification(!![],_0x557daa,_0x41b2a6,_0x30d62e,_0x991401,_0x202126);};exports[_0xbd8f('0x25')]=function(_0x247b07,_0x4c4431,_0x166de7,_0x14f3cb,_0x39714d){return sendNotification(![],_0x247b07,_0x4c4431,_0x166de7,_0x14f3cb,_0x39714d);};exports[_0xbd8f('0x26')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 1fc96cf..7f72357 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 _0xac52=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x1b2aa2,_0x351a0b){var _0x2b13c7=function(_0x3cdd78){while(--_0x3cdd78){_0x1b2aa2['push'](_0x1b2aa2['shift']());}};_0x2b13c7(++_0x351a0b);}(_0xac52,0x122));var _0x2ac5=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xac52[_0x484c03];return _0x294127;};'use strict';var schema=require('validate');var sh=require(_0x2ac5('0x0'));var _=require(_0x2ac5('0x1'));var utils=require(_0x2ac5('0x2'));var logger=require(_0x2ac5('0x3'))(_0x2ac5('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x2ac5('0x5')}});exports[_0x2ac5('0x6')]=function(_0x4a9ce3,_0x234508){return function(_0x443cc9){try{var _0x2ec614={'command':_0x234508[0x0]};var _0x4c7e0b=system['validate'](_0x2ec614,{'typecast':!![]});if(_0x4c7e0b[_0x2ac5('0x7')]){logger[_0x2ac5('0x8')](_0x2ac5('0x9'),_0x4a9ce3,_[_0x2ac5('0xa')](_0x4c7e0b,_0x2ac5('0xb'))[_0x2ac5('0xc')](',\x20'));logger[_0x2ac5('0xd')](_0x2ac5('0xe'),_0x4a9ce3);_0x443cc9[_0x2ac5('0xf')]();}else{var _0x14ad90=this;var _0x49a967=utils[_0x2ac5('0x10')](_0x234508[0x0],this);logger[_0x2ac5('0xd')](_0x2ac5('0x11'),_0x4a9ce3,_0x49a967);sh[_0x2ac5('0x12')](_['trim'](_0x49a967),function(_0x50f40b,_0x4ec3cd){logger[_0x2ac5('0xd')](_0x2ac5('0x13'),_0x4a9ce3,_0x50f40b);if(_0x50f40b==0x0){var _0x44749a=_0x4ec3cd[_0x2ac5('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x2ac5('0x15')](_0x234508[0x1])||_['isEmpty'](_0x234508[0x1])){logger[_0x2ac5('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x4a9ce3);_0x14ad90[_0x2ac5('0x16')][_0x234508[0x1]]=_0x44749a;}else{logger[_0x2ac5('0xd')](_0x2ac5('0x17'),_0x4a9ce3,_0x234508[0x1],_0x44749a);_0x14ad90['body'][_0x234508[0x1]]=_0x44749a;}}_0x443cc9['next']();});}}catch(_0x1135d9){logger[_0x2ac5('0x8')](_0x2ac5('0x9'),_0x4a9ce3,_[_0x2ac5('0x18')](_0x1135d9)?JSON[_0x2ac5('0x19')](_0x1135d9):_0x1135d9);logger[_0x2ac5('0xd')](_0x2ac5('0xe'),_0x4a9ce3);_0x443cc9[_0x2ac5('0xf')]();}};}; \ No newline at end of file +var _0x863a=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','../../../../config/logger','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x863a,0x107));var _0xa863=function(_0x648cf8,_0x3ad30c){_0x648cf8=_0x648cf8-0x0;var _0xfe594=_0x863a[_0x648cf8];return _0xfe594;};'use strict';var schema=require('validate');var sh=require(_0xa863('0x0'));var _=require(_0xa863('0x1'));var utils=require('./utils');var logger=require(_0xa863('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4549c0,_0x55705b){return function(_0x3264b4){try{var _0x1d820e={'command':_0x55705b[0x0]};var _0x366868=system['validate'](_0x1d820e,{'typecast':!![]});if(_0x366868['length']){logger[_0xa863('0x3')](_0xa863('0x4'),_0x4549c0,_[_0xa863('0x5')](_0x366868,'message')[_0xa863('0x6')](',\x20'));logger[_0xa863('0x7')](_0xa863('0x8'),_0x4549c0);_0x3264b4[_0xa863('0x9')]();}else{var _0x3fc1d7=this;var _0x241f3f=utils[_0xa863('0xa')](_0x55705b[0x0],this);logger['info'](_0xa863('0xb'),_0x4549c0,_0x241f3f);sh[_0xa863('0xc')](_[_0xa863('0xd')](_0x241f3f),function(_0x113041,_0x4f57e2){logger['info'](_0xa863('0xe'),_0x4549c0,_0x113041);if(_0x113041==0x0){var _0xad0cff=_0x4f57e2[_0xa863('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xa863('0x10')](_0x55705b[0x1])||_[_0xa863('0x11')](_0x55705b[0x1])){logger[_0xa863('0x7')](_0xa863('0x12'),_0x4549c0);_0x3fc1d7[_0xa863('0x13')][_0x55705b[0x1]]=_0xad0cff;}else{logger['info'](_0xa863('0x14'),_0x4549c0,_0x55705b[0x1],_0xad0cff);_0x3fc1d7[_0xa863('0x13')][_0x55705b[0x1]]=_0xad0cff;}}_0x3264b4['next']();});}}catch(_0x887f61){logger['error'](_0xa863('0x4'),_0x4549c0,_[_0xa863('0x15')](_0x887f61)?JSON[_0xa863('0x16')](_0x887f61):_0x887f61);logger[_0xa863('0x7')](_0xa863('0x8'),_0x4549c0);_0x3264b4[_0xa863('0x9')]();}};}; \ 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 f4c9b72..ac3fd93 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 _0x0f16=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','finally','isObject','stringify','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','message','join'];(function(_0x1ef91a,_0x21f90d){var _0x1dfa55=function(_0x343853){while(--_0x343853){_0x1ef91a['push'](_0x1ef91a['shift']());}};_0x1dfa55(++_0x21f90d);}(_0x0f16,0xc9));var _0x60f1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0f16[_0x4b369d];return _0x571a98;};'use strict';var schema=require('validate');var _=require(_0x60f1('0x0'));var rpc={'chatInteraction':require(_0x60f1('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x60f1('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x60f1('0x3'))};var logger=require(_0x60f1('0x4'))(_0x60f1('0x5'));var tag=schema({'tag':{'type':_0x60f1('0x6'),'required':!![],'message':_0x60f1('0x7')}});exports[_0x60f1('0x8')]=function(_0x4794ff,_0x357314,_0x23bd46,_0xf74bee){return function(_0x12b342){try{var _0x33f0c5={'tag':_0x357314[0x0]};var _0x3a06c1=tag[_0x60f1('0x9')](_0x33f0c5,{'typecast':!![]});if(_0x3a06c1['length']){logger[_0x60f1('0xa')](_0x60f1('0xb'),_0x4794ff,_[_0x60f1('0xc')](_0x3a06c1,_0x60f1('0xd'))[_0x60f1('0xe')](',\x20'));logger[_0x60f1('0xf')](_0x60f1('0x10'),_0x4794ff);_0x12b342[_0x60f1('0x11')]();}else{var _0x33d7ab={'ids':[_0x357314[0x0]]};if(rpc[_0xf74bee[_0x60f1('0x12')]+_0x60f1('0x13')]){rpc[_0xf74bee[_0x60f1('0x12')]+_0x60f1('0x13')][_0x60f1('0x14')](_0xf74bee[_0x60f1('0x15')]['id'],_0x33d7ab)[_0x60f1('0x16')](function(_0x4007ea){logger[_0x60f1('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x4794ff,_0x357314[0x1],_0xf74bee['channel'],_0xf74bee[_0x60f1('0x15')]['id']);})[_0x60f1('0x17')](function(_0x4fdcf4){logger['error'](_0x60f1('0xb'),_0x4794ff,JSON['stringify'](_0x4fdcf4));logger[_0x60f1('0xf')](_0x60f1('0x10'),_0x4794ff);})[_0x60f1('0x18')](function(){_0x12b342['next']();});}}}catch(_0x211c36){logger['error'](_0x60f1('0xb'),_0x4794ff,_[_0x60f1('0x19')](_0x211c36)?JSON[_0x60f1('0x1a')](_0x211c36):_0x211c36);logger[_0x60f1('0xf')](_0x60f1('0x10'),_0x4794ff);_0x12b342['next']();}};}; \ No newline at end of file +var _0xddb1=['interaction','catch','finally','next','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x42294e,_0x2cd843){var _0x4871ae=function(_0x4ea002){while(--_0x4ea002){_0x42294e['push'](_0x42294e['shift']());}};_0x4871ae(++_0x2cd843);}(_0xddb1,0x1ec));var _0x1ddb=function(_0x321832,_0x186759){_0x321832=_0x321832-0x0;var _0x8e0901=_0xddb1[_0x321832];return _0x8e0901;};'use strict';var schema=require(_0x1ddb('0x0'));var _=require(_0x1ddb('0x1'));var rpc={'chatInteraction':require(_0x1ddb('0x2')),'openchannelInteraction':require(_0x1ddb('0x3')),'smsInteraction':require(_0x1ddb('0x4')),'mailInteraction':require(_0x1ddb('0x5')),'faxInteraction':require(_0x1ddb('0x6')),'whatsappInteraction':require(_0x1ddb('0x7'))};var logger=require(_0x1ddb('0x8'))(_0x1ddb('0x9'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1ddb('0xa')}});exports['consequence']=function(_0x5229ec,_0x1e8b3c,_0x86a5c3,_0x201195){return function(_0x308cc4){try{var _0x1497b3={'tag':_0x1e8b3c[0x0]};var _0x8aacd0=tag['validate'](_0x1497b3,{'typecast':!![]});if(_0x8aacd0[_0x1ddb('0xb')]){logger[_0x1ddb('0xc')](_0x1ddb('0xd'),_0x5229ec,_['map'](_0x8aacd0,_0x1ddb('0xe'))['join'](',\x20'));logger[_0x1ddb('0xf')](_0x1ddb('0x10'),_0x5229ec);_0x308cc4['next']();}else{var _0x3b81d3={'ids':[_0x1e8b3c[0x0]]};if(rpc[_0x201195[_0x1ddb('0x11')]+_0x1ddb('0x12')]){rpc[_0x201195['channel']+_0x1ddb('0x12')][_0x1ddb('0x13')](_0x201195['interaction']['id'],_0x3b81d3)['then'](function(_0x27852b){logger[_0x1ddb('0xf')](_0x1ddb('0x14'),_0x5229ec,_0x1e8b3c[0x1],_0x201195['channel'],_0x201195[_0x1ddb('0x15')]['id']);})[_0x1ddb('0x16')](function(_0x48006f){logger[_0x1ddb('0xc')](_0x1ddb('0xd'),_0x5229ec,JSON['stringify'](_0x48006f));logger[_0x1ddb('0xf')](_0x1ddb('0x10'),_0x5229ec);})[_0x1ddb('0x17')](function(){_0x308cc4[_0x1ddb('0x18')]();});}}}catch(_0x1d107e){logger['error'](_0x1ddb('0xd'),_0x5229ec,_[_0x1ddb('0x19')](_0x1d107e)?JSON[_0x1ddb('0x1a')](_0x1d107e):_0x1d107e);logger['info'](_0x1ddb('0x10'),_0x5229ec);_0x308cc4['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 85058a1..f3f5d07 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 _0x0b7c=['title','2.0','method','login','stringify','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','replace','includes','push','urlOnAnswer','?params=','urlOnRing'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x0b7c,0xda));var _0xc0b7=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0x0b7c[_0x245c4f];return _0x3157a1;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require('lodash');var arr=[];exports['consequence']=function(_0x285fd1,_0x5b2ad2){return function(_0x11efbb){var _0x30be23=_0x5b2ad2[0xa];var _0x137bed=_0x5b2ad2[0xb];var _0x32376c=_0x5b2ad2[0xc];var _0x35d623=_0x5b2ad2[0xd];var _0x414600=_0x5b2ad2[0xe];var _0x2ebd9d=_0x5b2ad2[0xf][_0xc0b7('0x0')](/\n/g,'\x20-\x20');var _0x2ad9ad=_0x5b2ad2[0x10][_0xc0b7('0x0')](/\n/g,'\x20');if(!arr[_0xc0b7('0x1')](_0x137bed)){arr[_0xc0b7('0x2')](_0x137bed);var _0x291d0e=_0x5b2ad2[0x3];var _0x352a7e=_0x5b2ad2[0x4];var _0xd6da44=_0x5b2ad2[0x1];var _0x593278=_0x5b2ad2[0x0];var _0x4a51a5={};_0x4a51a5[_0xc0b7('0x3')]=_0x5b2ad2[0x8]+_0xc0b7('0x4')+_0x32376c+'|'+_0x30be23+'|'+_0x35d623+'|'+_0x137bed+'|'+_0x414600;_0x4a51a5[_0xc0b7('0x5')]=_0x5b2ad2[0x7]+_0xc0b7('0x4')+_0x32376c+'|'+_0x30be23+'|'+_0x35d623+'|'+_0x137bed+'|'+_0x414600+'|'+_0x2ebd9d+'|'+_0x2ad9ad;_0x4a51a5[_0xc0b7('0x6')]=_0x5b2ad2[0x9];var _0x36e468={};_0x36e468['jsonrpc']=_0xc0b7('0x7');_0x36e468[_0xc0b7('0x8')]=_0xc0b7('0x9');var _0x2ba2bc=[];_0x2ba2bc[_0xc0b7('0x2')](_0x5b2ad2[0x2]);_0x2ba2bc[_0xc0b7('0x2')](_0x5b2ad2[0x5]);_0x2ba2bc[_0xc0b7('0x2')](_0x5b2ad2[0x6]);_0x36e468['params']=_0x2ba2bc;_0x36e468['id']=0x1;var _0x34796a=JSON[_0xc0b7('0xa')](_0x36e468);var _0x525feb={'encoding':_0xc0b7('0xb'),'method':_0xc0b7('0xc'),'timeout':0x2710,'url':_0x291d0e,'headers':{'Content-Type':_0xc0b7('0xd')},'body':_0x34796a};return rp(_0x525feb)[_0xc0b7('0xe')](function(_0x1c6d5a){const _0x1fffec=JSON[_0xc0b7('0xf')](_0x1c6d5a);if(!_0x1fffec['result'][_0xc0b7('0x10')]){throw new Error(_0xc0b7('0x11'));}var _0x1eb7c7=_0x137bed;var _0x308f98=_0xc0b7('0x12')+_0xd6da44+_0xc0b7('0x13')+_0x593278+'&sessionId='+_0x1eb7c7+_0xc0b7('0x14')+JSON['stringify'](_0x4a51a5);var _0xfa96be=_0x352a7e+'?'+_0x308f98;return rp(_0xfa96be);})[_0xc0b7('0xe')](function(_0x313877){logger['info'](_0xc0b7('0x15'),_0x285fd1,_0x313877);_0x11efbb[_0xc0b7('0x16')]();})['catch'](function(_0x2b13b1){logger[_0xc0b7('0x17')](_0xc0b7('0x18'),_0x285fd1,_[_0xc0b7('0x19')](_0x2b13b1)?JSON['stringify'](_0x2b13b1):_0x2b13b1);_0x11efbb[_0xc0b7('0x16')]();});}else{logger['info'](_0xc0b7('0x1a'),_0x285fd1);_0x11efbb[_0xc0b7('0x1b')]();}};}; \ No newline at end of file +var _0xe2db=['jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing'];(function(_0x59ed4e,_0x58d4be){var _0x349fb2=function(_0x1089a9){while(--_0x1089a9){_0x59ed4e['push'](_0x59ed4e['shift']());}};_0x349fb2(++_0x58d4be);}(_0xe2db,0xa5));var _0xbe2d=function(_0x223a0e,_0x10b901){_0x223a0e=_0x223a0e-0x0;var _0x28a788=_0xe2db[_0x223a0e];return _0x28a788;};'use strict';var rp=require('request-promise');var logger=require(_0xbe2d('0x0'))('routing');var _=require(_0xbe2d('0x1'));var arr=[];exports[_0xbe2d('0x2')]=function(_0x55c879,_0x1d8166){return function(_0x155e63){var _0x126c7b=_0x1d8166[0xa];var _0x147307=_0x1d8166[0xb];var _0x24adc9=_0x1d8166[0xc];var _0x1c9c14=_0x1d8166[0xd];var _0x4fb935=_0x1d8166[0xe];var _0x4c27e1=_0x1d8166[0xf][_0xbe2d('0x3')](/\n/g,_0xbe2d('0x4'));var _0x430a97=_0x1d8166[0x10][_0xbe2d('0x3')](/\n/g,'\x20');if(!arr[_0xbe2d('0x5')](_0x147307)){arr[_0xbe2d('0x6')](_0x147307);var _0x480137=_0x1d8166[0x3];var _0x120ebb=_0x1d8166[0x4];var _0x3aaca0=_0x1d8166[0x1];var _0x48de5d=_0x1d8166[0x0];var _0x434c8a={};_0x434c8a[_0xbe2d('0x7')]=_0x1d8166[0x8]+_0xbe2d('0x8')+_0x24adc9+'|'+_0x126c7b+'|'+_0x1c9c14+'|'+_0x147307+'|'+_0x4fb935;_0x434c8a[_0xbe2d('0x9')]=_0x1d8166[0x7]+_0xbe2d('0x8')+_0x24adc9+'|'+_0x126c7b+'|'+_0x1c9c14+'|'+_0x147307+'|'+_0x4fb935+'|'+_0x4c27e1+'|'+_0x430a97;_0x434c8a['title']=_0x1d8166[0x9];var _0x274f60={};_0x274f60[_0xbe2d('0xa')]=_0xbe2d('0xb');_0x274f60[_0xbe2d('0xc')]=_0xbe2d('0xd');var _0x443863=[];_0x443863[_0xbe2d('0x6')](_0x1d8166[0x2]);_0x443863[_0xbe2d('0x6')](_0x1d8166[0x5]);_0x443863[_0xbe2d('0x6')](_0x1d8166[0x6]);_0x274f60[_0xbe2d('0xe')]=_0x443863;_0x274f60['id']=0x1;var _0x734b12=JSON[_0xbe2d('0xf')](_0x274f60);var _0x4f5cbb={'encoding':'utf8','method':_0xbe2d('0x10'),'timeout':0x2710,'url':_0x480137,'headers':{'Content-Type':_0xbe2d('0x11')},'body':_0x734b12};return rp(_0x4f5cbb)['then'](function(_0x4f482b){const _0x3c1e1c=JSON[_0xbe2d('0x12')](_0x4f482b);if(!_0x3c1e1c[_0xbe2d('0x13')][_0xbe2d('0x14')]){throw new Error(_0xbe2d('0x15'));}var _0x33afb2=_0x147307;var _0x5132f2=_0xbe2d('0x16')+_0x3aaca0+_0xbe2d('0x17')+_0x48de5d+'&sessionId='+_0x33afb2+_0xbe2d('0x18')+JSON[_0xbe2d('0xf')](_0x434c8a);var _0x137d90=_0x120ebb+'?'+_0x5132f2;return rp(_0x137d90);})[_0xbe2d('0x19')](function(_0x4e80ab){logger[_0xbe2d('0x1a')](_0xbe2d('0x1b'),_0x55c879,_0x4e80ab);_0x155e63[_0xbe2d('0x1c')]();})[_0xbe2d('0x1d')](function(_0xab07de){logger[_0xbe2d('0x1e')](_0xbe2d('0x1f'),_0x55c879,_[_0xbe2d('0x20')](_0xab07de)?JSON[_0xbe2d('0xf')](_0xab07de):_0xab07de);_0x155e63[_0xbe2d('0x1c')]();});}else{logger[_0xbe2d('0x1a')](_0xbe2d('0x21'),_0x55c879);_0x155e63[_0xbe2d('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 12a85ca..89dc0db 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x575855,_0xd4326f){var _0x3657e7=function(_0x215f56){while(--_0x215f56){_0x575855['push'](_0x575855['shift']());}};_0x3657e7(++_0xd4326f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x41ba4f,_0x448426){var _0x2c0180=function(_0x5490e1){while(--_0x5490e1){_0x41ba4f['push'](_0x41ba4f['shift']());}};_0x2c0180(++_0x448426);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 d6d74bd..27fe022 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 _0x26c2=['smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','log','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','interaction','applications','isArray','length','join','app','.js','appdata','mail','push','slice','split','amazonlex','message','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','rules','execute','Applications\x20executed','complete','stack','error','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues'];(function(_0x44c0f5,_0x14fa0){var _0x3875d2=function(_0xa81e63){while(--_0xa81e63){_0x44c0f5['push'](_0x44c0f5['shift']());}};_0x3875d2(++_0x14fa0);}(_0x26c2,0x130));var _0x226c=function(_0x18ed49,_0x34502c){_0x18ed49=_0x18ed49-0x0;var _0x22e649=_0x26c2[_0x18ed49];return _0x22e649;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x226c('0x0'));var BPromise=require(_0x226c('0x1'));var uuid=require(_0x226c('0x2'));var utils=require(_0x226c('0x3'));var config=require('../../../config/environment');var logger=require(_0x226c('0x4'))(_0x226c('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x226c('0x6')),'chatQueueReport':require(_0x226c('0x7')),'smsQueueReport':require(_0x226c('0x8')),'faxQueueReport':require(_0x226c('0x9')),'whatsappQueueReport':require(_0x226c('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x34cbc3,_0x461773,_0x335cab){return util[_0x226c('0xb')](_0x226c('0xc'),_0x34cbc3,_0x461773||0x0,_0x335cab||0x0);}function getIntervals(_0x51879f,_0x16cbbd){var _0x3280f8=[];if(!_['isNil'](_0x16cbbd['IntervalId'])&&!_[_0x226c('0xd')](_0x51879f[_0x16cbbd[_0x226c('0xe')]])&&!_[_0x226c('0xd')](_0x51879f[_0x16cbbd[_0x226c('0xe')]][_0x226c('0xf')])){_0x3280f8=_[_0x226c('0x10')](_0x51879f[_0x16cbbd[_0x226c('0xe')]]['Intervals'],'interval');}else if(!_[_0x226c('0xd')](_0x16cbbd[_0x226c('0x11')])){_0x3280f8=[_0x16cbbd[_0x226c('0x11')]];}return _0x3280f8;}exports[_0x226c('0x12')]=function(_0x4eb557){_0x4eb557['rules']={};return new BPromise(function(_0x21d61b,_0x3cff57){var _0x15e13b={'Start':function(_0x55697c){var _0x5d6c21=this;return new Promise(function(_0x694eef,_0x2e4a51){if(_0x55697c){try{var _0x30755=[];var _0x45a804=getId(_0x55697c[_0x226c('0x13')],_0x55697c['message']?_0x55697c['message']['id']:0x0,_0x55697c['interaction']?_0x55697c[_0x226c('0x14')]['id']:0x0);if(_0x55697c[_0x226c('0x15')]&&_[_0x226c('0x16')](_0x55697c[_0x226c('0x15')])&&_0x55697c['applications'][_0x226c('0x17')]){for(var _0xb6417f=0x0;_0xb6417f<_0x55697c[_0x226c('0x15')][_0x226c('0x17')];_0xb6417f+=0x1){var _0x11fa82=_0x55697c[_0x226c('0x15')][_0xb6417f];if(fs['existsSync'](path[_0x226c('0x18')](__dirname,_0x226c('0x15'),_0x11fa82[_0x226c('0x19')]+_0x226c('0x1a')))){var _0x272f26=[];switch(_0x11fa82['app']['toLowerCase']()){case'autoreply':var _0x1f1bf2=_0x11fa82[_0x226c('0x1b')]['split'](',');if(_0x55697c[_0x226c('0x13')]===_0x226c('0x1c')){_0x272f26[_0x226c('0x1d')](_0x1f1bf2[0x0]);_0x272f26[_0x226c('0x1d')](_0x1f1bf2[0x1]);_0x272f26[_0x226c('0x1d')](_0x1f1bf2['slice'](0x2,_0x1f1bf2[_0x226c('0x17')])['join'](','));}else{_0x272f26[_0x226c('0x1d')](_0x1f1bf2[0x0]);_0x272f26['push'](_0x1f1bf2[_0x226c('0x1e')](0x1,_0x1f1bf2[_0x226c('0x17')])[_0x226c('0x18')](','));}break;case'dialogflow':var _0x14c49b=_0x11fa82['appdata'][_0x226c('0x1f')](',');_0x272f26['push'](_0x14c49b[0x0]);_0x272f26[_0x226c('0x1d')](_0x14c49b[0x1]);_0x272f26['push'](_0x14c49b[_0x226c('0x1e')](0x2,_0x14c49b[_0x226c('0x17')])['join'](','));break;case'dialogflowv2':var _0x3b1e93=_0x11fa82[_0x226c('0x1b')][_0x226c('0x1f')](',');_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x0]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x1]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x2]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x3]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[_0x226c('0x1e')](0x4,_0x3b1e93[_0x226c('0x17')])[_0x226c('0x18')](','));break;case _0x226c('0x20'):var _0x49e901=_0x11fa82[_0x226c('0x1b')][_0x226c('0x1f')](',');_0x272f26[_0x226c('0x1d')](_0x49e901[0x0]);_0x272f26[_0x226c('0x1d')](_0x49e901[0x1]);_0x272f26[_0x226c('0x1d')](_0x49e901[0x2]);_0x272f26['push'](_0x49e901[0x3]);_0x272f26[_0x226c('0x1d')](_0x49e901[_0x226c('0x1e')](0x4,_0x49e901[_0x226c('0x17')])['join'](','));break;case _0x226c('0x21'):_0x272f26['push'](_0x11fa82[_0x226c('0x1b')]);break;case _0x226c('0x22'):_0x272f26[_0x226c('0x1d')](_0x11fa82[_0x226c('0x23')]);_0x272f26[_0x226c('0x1d')](_0x11fa82[_0x226c('0x1b')]);break;case _0x226c('0x24'):var _0x39e942=utils[_0x226c('0x25')](_0x55697c[_0x226c('0x26')][_0x226c('0x27')],_0x55697c);var _0x3062d7=_0x11fa82[_0x226c('0x1b')][_0x226c('0x1f')](',');_0x272f26['push'](_0x3062d7[0x0]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x1]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x2]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x3]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x4]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x5]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x6]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x7]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x8]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x9]);_0x272f26['push'](_0x3062d7[0xa]);_0x272f26['push'](_0x55697c[_0x226c('0x14')]['id']);_0x272f26[_0x226c('0x1d')](_0x55697c[_0x226c('0x21')]['id']);_0x272f26[_0x226c('0x1d')](_0x11fa82[_0x226c('0x28')]);_0x272f26[_0x226c('0x1d')](_0x55697c[_0x226c('0x14')][_0x226c('0x29')]);_0x272f26[_0x226c('0x1d')](_0x55697c['body'][_0x226c('0x2a')]);_0x272f26['push'](_0x39e942);break;default:_0x272f26=_[_0x226c('0xd')](_0x11fa82[_0x226c('0x1b')])?[]:_0x11fa82[_0x226c('0x1b')]['split'](',');}var _0x507aa8={'id':util[_0x226c('0xb')](_0x226c('0x2b'),_0x45a804,_0x11fa82['id'],_0x11fa82['app']),'condition':require(_0x226c('0x2c'))[_0x226c('0x2d')](_0x45a804,getIntervals(_0x4eb557[_0x226c('0x2e')],_0x11fa82),_0x4eb557),'consequence':require(_0x226c('0x2f')+_0x11fa82['app'])[_0x226c('0x30')](_0x45a804,_0x272f26,_0x4eb557,_0x55697c),'p':_0x11fa82[_0x226c('0x31')]||0x0};logger[_0x226c('0x32')]('Push\x20new\x20rule',_0x507aa8['id'],_0x226c('0x33'),getIntervals(_0x4eb557[_0x226c('0x2e')],_0x11fa82)[_0x226c('0x18')](_0x226c('0x34')));_0x30755[_0x226c('0x1d')](_0x507aa8);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x226c('0x15'),_0x11fa82[_0x226c('0x19')]+_0x226c('0x1a')));}}_0x4eb557[_0x226c('0x35')][_0x45a804]=new RuleEngine(_0x30755);_0x4eb557[_0x226c('0x35')][_0x45a804][_0x226c('0x36')](_0x55697c,function(_0x16ae23){logger[_0x226c('0x32')](_0x226c('0x37'),JSON['stringify'](_0x16ae23['matchPath']));if(_0x4eb557[_0x226c('0x35')][_0x45a804]){_0x4eb557[_0x226c('0x35')][_0x45a804]['emit'](_0x226c('0x38'));}});return _0x694eef({'code':0xc8,'message':_0x55697c});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x694eef({'code':0xc8,'message':_0x55697c});}}catch(_0x1b2338){logger['error'](_0x1b2338[_0x226c('0x39')]);return _0x2e4a51(_0x5d6c21[_0x226c('0x3a')](0x1f4,_0x1b2338));}}return _0x2e4a51(_0x226c('0x3b'));});},'AcceptMessage':function(_0x1c6618){var _0x89b599=this;return new Promise(function(_0x1e3cda,_0x4e705c){if(_0x1c6618[_0x226c('0x3c')]&&_0x1c6618['agent']['id']){if(_0x4eb557[_0x226c('0x3d')][_0x1c6618[_0x226c('0x3c')]['id']]){_0x4eb557[_0x226c('0x3d')][_0x1c6618[_0x226c('0x3c')]['id']]['busy']=![];_0x4eb557[_0x226c('0x3d')][_0x1c6618['agent']['id']][_0x226c('0x3e')]=undefined;}}if(_0x1c6618[_0x226c('0x21')]&&_0x1c6618[_0x226c('0x21')]['id']){try{var _0x707957=getId(_0x1c6618[_0x226c('0x13')],_0x1c6618[_0x226c('0x21')]?_0x1c6618['message']['id']:0x0,_0x1c6618[_0x226c('0x14')]?_0x1c6618[_0x226c('0x14')]['id']:0x0);if(_0x4eb557[_0x226c('0x35')][_0x707957]){_0x4eb557[_0x226c('0x35')][_0x707957][_0x226c('0x3f')](_0x226c('0x40'));if(rpc[_0x1c6618[_0x226c('0x13')]+_0x226c('0x41')]){rpc[_0x1c6618[_0x226c('0x13')]+_0x226c('0x41')][_0x226c('0x42')](_0x707957,{'UserId':_0x1c6618[_0x226c('0x21')]['UserId']})['catch'](function(_0x486510){logger[_0x226c('0x3a')](_0x226c('0x43'));});}}return _0x1e3cda({'code':0xc8,'message':_0x1c6618});}catch(_0x1cbf5d){logger['error'](_0x1cbf5d[_0x226c('0x39')]);return _0x4e705c(_0x89b599[_0x226c('0x3a')](0x1f4,_0x1cbf5d));}}logger['error'](_0x226c('0x44'));return _0x4e705c(_0x89b599[_0x226c('0x3a')](0x1f4,_0x226c('0x44')));});},'RejectMessage':function(_0x28d055){var _0x2a1d64=this;return new Promise(function(_0x3c0dfb,_0x3e60bf){if(_0x28d055[_0x226c('0x3c')]&&_0x28d055['agent']['id']){try{if(_0x4eb557[_0x226c('0x3d')][_0x28d055[_0x226c('0x3c')]['id']]){_0x4eb557['agents'][_0x28d055[_0x226c('0x3c')]['id']][_0x226c('0x45')]=![];_0x4eb557[_0x226c('0x3d')][_0x28d055[_0x226c('0x3c')]['id']][_0x226c('0x3e')]=undefined;}return _0x3c0dfb({'code':0xc8,'message':_0x28d055});}catch(_0x2a099a){logger['error'](_0x2a099a[_0x226c('0x39')]);return _0x3e60bf(_0x2a1d64['error'](0x1f4,_0x2a099a));}}logger['error'](_0x226c('0x44'));return _0x3e60bf(_0x2a1d64[_0x226c('0x3a')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3861be){var _0x17cfc1=this;return new Promise(function(_0x347be6,_0x54b6bc){if(_0x3861be[_0x226c('0x13')]&&_0x3861be[_0x226c('0x14')]&&_0x3861be[_0x226c('0x14')]['id']){try{var _0x24096f=getId(_0x3861be[_0x226c('0x13')],_0x3861be['message']?_0x3861be[_0x226c('0x21')]['id']:0x0,_0x3861be['interaction']?_0x3861be['interaction']['id']:0x0);if(_0x4eb557[_0x226c('0x35')][_0x24096f]){_0x4eb557[_0x226c('0x35')][_0x24096f][_0x226c('0x3f')]('end');}return _0x347be6({'code':0xc8,'message':_0x3861be});}catch(_0xb225d3){logger[_0x226c('0x3a')](_0xb225d3['stack']);return _0x54b6bc(_0x17cfc1[_0x226c('0x3a')](0x1f4,_0xb225d3));}}logger[_0x226c('0x3a')](_0x226c('0x44'));return _0x54b6bc(_0x17cfc1['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x26cfd5){var _0x55db16=this;return new Promise(function(_0x29d34c,_0xfb8c4b){if(_0x4eb557['agents']['hasOwnProperty'](_0x26cfd5['id'])){for(var _0x1790c7 in _0x26cfd5[_0x226c('0x46')]){if(_0x26cfd5[_0x226c('0x46')][_0x226c('0x47')](_0x1790c7)){if(_0x4eb557['agents'][_0x26cfd5['id']][_0x226c('0x47')](_0x1790c7+_0x226c('0x48'))){_0x4eb557[_0x226c('0x3d')][_0x26cfd5['id']][_0x1790c7+'CurrentCapacity']=parseInt(_0x26cfd5[_0x226c('0x46')][_0x1790c7],0xa);}}}_0x4eb557['agents'][_0x26cfd5['id']][_0x226c('0x49')]();return _0x29d34c({'code':0xc8,'message':_0x4eb557[_0x226c('0x3d')][_0x26cfd5['id']]});}else{return _0xfb8c4b(_0x55db16[_0x226c('0x3a')](0x1f4,_0x226c('0x4a')));}});},'Agents':function(_0x30ddc2){return new Promise(function(_0x3711c9,_0x222932){var _0x40ed3a=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x3d')]);_0x3711c9({'count':_0x40ed3a[_0x226c('0x17')],'rows':_0x40ed3a});});},'ChatQueues':function(_0x2268e6){return new Promise(function(_0x52605b,_0x435c42){var _0x3d128d=[];for(var _0x1c3973 in _0x4eb557[_0x226c('0x4c')]){if(_0x4eb557[_0x226c('0x4c')][_0x226c('0x47')](_0x1c3973)){var _0x29ff98=_0x4eb557['chatQueues'][_0x1c3973];var _0x2856f4={'id':_0x29ff98['id'],'available':_0x29ff98['available'],'loggedIn':_0x29ff98[_0x226c('0x4d')],'name':_0x29ff98['name'],'paused':_0x29ff98[_0x226c('0x4e')],'waiting':_0x29ff98[_0x226c('0x4f')]};_0x3d128d[_0x226c('0x1d')](_0x2856f4);}}_0x52605b({'count':_0x3d128d[_0x226c('0x17')],'rows':_0x3d128d});});},'MailQueues':function(_0x5645a7){return new Promise(function(_0x13a8d6,_0x2d447d){var _0x315ac6=[];for(var _0x57490f in _0x4eb557[_0x226c('0x50')]){if(_0x4eb557[_0x226c('0x50')][_0x226c('0x47')](_0x57490f)){var _0xb580f0=_0x4eb557[_0x226c('0x50')][_0x57490f];var _0x487451={'id':_0xb580f0['id'],'available':_0xb580f0[_0x226c('0x51')],'loggedIn':_0xb580f0['loggedIn'],'name':_0xb580f0[_0x226c('0x52')],'paused':_0xb580f0[_0x226c('0x4e')],'waiting':_0xb580f0[_0x226c('0x4f')]};_0x315ac6[_0x226c('0x1d')](_0x487451);}}_0x13a8d6({'count':_0x315ac6['length'],'rows':_0x315ac6});});},'OpenchannelQueues':function(_0xda4304){return new Promise(function(_0x33cd69,_0x50b481){var _0x19d927=[];for(var _0x3fc153 in _0x4eb557[_0x226c('0x53')]){if(_0x4eb557[_0x226c('0x53')][_0x226c('0x47')](_0x3fc153)){var _0x1a0aca=_0x4eb557['openchannelQueues'][_0x3fc153];var _0x389cb7={'id':_0x1a0aca['id'],'available':_0x1a0aca[_0x226c('0x51')],'loggedIn':_0x1a0aca[_0x226c('0x4d')],'name':_0x1a0aca[_0x226c('0x52')],'paused':_0x1a0aca['paused'],'waiting':_0x1a0aca[_0x226c('0x4f')]};_0x19d927['push'](_0x389cb7);}}_0x33cd69({'count':_0x19d927[_0x226c('0x17')],'rows':_0x19d927});});},'SmsQueues':function(_0xb756b9){return new Promise(function(_0x59c9c3,_0x2a00f9){var _0x501597=[];for(var _0x564d3a in _0x4eb557[_0x226c('0x54')]){if(_0x4eb557[_0x226c('0x54')][_0x226c('0x47')](_0x564d3a)){var _0x41d1fd=_0x4eb557[_0x226c('0x54')][_0x564d3a];var _0x4b7770={'id':_0x41d1fd['id'],'available':_0x41d1fd[_0x226c('0x51')],'loggedIn':_0x41d1fd[_0x226c('0x4d')],'name':_0x41d1fd[_0x226c('0x52')],'paused':_0x41d1fd['paused'],'waiting':_0x41d1fd['waiting']};_0x501597[_0x226c('0x1d')](_0x4b7770);}}_0x59c9c3({'count':_0x501597['length'],'rows':_0x501597});});},'FaxQueues':function(_0x1fb15d){return new Promise(function(_0x5a9c92,_0x4a94ad){var _0x5aa1bb=[];for(var _0x2246fd in _0x4eb557[_0x226c('0x55')]){if(_0x4eb557['faxQueues']['hasOwnProperty'](_0x2246fd)){var _0x5f3051=_0x4eb557['faxQueues'][_0x2246fd];var _0x23ab51={'id':_0x5f3051['id'],'available':_0x5f3051['available'],'loggedIn':_0x5f3051[_0x226c('0x4d')],'name':_0x5f3051[_0x226c('0x52')],'paused':_0x5f3051[_0x226c('0x4e')],'waiting':_0x5f3051[_0x226c('0x4f')]};_0x5aa1bb[_0x226c('0x1d')](_0x23ab51);}}_0x5a9c92({'count':_0x5aa1bb[_0x226c('0x17')],'rows':_0x5aa1bb});});},'WhatsappQueues':function(_0x3517fa){return new Promise(function(_0x882ec8,_0x58c2e1){var _0x3746c1=[];for(var _0x345ad9 in _0x4eb557[_0x226c('0x56')]){if(_0x4eb557[_0x226c('0x56')][_0x226c('0x47')](_0x345ad9)){var _0x3b9403=_0x4eb557[_0x226c('0x56')][_0x345ad9];var _0x3659d8={'id':_0x3b9403['id'],'available':_0x3b9403['available'],'loggedIn':_0x3b9403[_0x226c('0x4d')],'name':_0x3b9403[_0x226c('0x52')],'paused':_0x3b9403[_0x226c('0x4e')],'waiting':_0x3b9403[_0x226c('0x4f')]};_0x3746c1[_0x226c('0x1d')](_0x3659d8);}}_0x882ec8({'count':_0x3746c1[_0x226c('0x17')],'rows':_0x3746c1});});},'ChatQueuesWaitingInteractions':function(_0x2585cf){return new Promise(function(_0x5ef2a2,_0x19a525){var _0x357e86=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x57')]);_0x5ef2a2({'count':_0x357e86[_0x226c('0x17')],'rows':_0x357e86});});},'MailQueuesWaitingInteractions':function(_0x2ac44b){return new Promise(function(_0x5292cb,_0x2e1c6c){var _0xbf68ea=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x58')]);_0x5292cb({'count':_0xbf68ea[_0x226c('0x17')],'rows':_0xbf68ea});});},'OpenchannelQueuesWaitingInteractions':function(_0x868257){return new Promise(function(_0x20a47c,_0x5af32e){var _0x52b1c5=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x59')]);_0x20a47c({'count':_0x52b1c5['length'],'rows':_0x52b1c5});});},'SmsQueuesWaitingInteractions':function(_0xbd31d7){return new Promise(function(_0x5524c5,_0x48e0a6){var _0x2ad739=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x5a')]);_0x5524c5({'count':_0x2ad739[_0x226c('0x17')],'rows':_0x2ad739});});},'FaxQueuesWaitingInteractions':function(_0x6ef63d){return new Promise(function(_0x2d0155,_0x5aa822){var _0x15f1de=_[_0x226c('0x4b')](_0x4eb557['faxQueuesWaitingInteractions']);_0x2d0155({'count':_0x15f1de[_0x226c('0x17')],'rows':_0x15f1de});});},'WhatsappQueuesWaitingInteractions':function(_0x43088a){return new Promise(function(_0x13f463,_0x1558cc){var _0x454ee0=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x5b')]);_0x13f463({'count':_0x454ee0[_0x226c('0x17')],'rows':_0x454ee0});});}};var _0x28ede7=jayson[_0x226c('0x5c')](_0x15e13b)[_0x226c('0x5d')]();_0x28ede7['on'](_0x226c('0x3a'),function(_0x27fdbd){logger[_0x226c('0x3a')](JSON[_0x226c('0x5e')](_0x27fdbd));return _0x3cff57(_0x27fdbd);});_0x28ede7['listen'](0x232c,'127.0.0.1',function(){console[_0x226c('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x21d61b(_0x226c('0x60')+0x232c);});});}; \ No newline at end of file +var _0xb688=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync','join','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','priority','info','on\x20interval','\x20|\x20','error','app','.js','rules','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','UserId','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','openchannelQueues','name','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xb688,0xcf));var _0x8b68=function(_0xe26398,_0x53b942){_0xe26398=_0xe26398-0x0;var _0x14a409=_0xb688[_0xe26398];return _0x14a409;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var fs=require('fs');var jayson=require(_0x8b68('0x2'));var BPromise=require(_0x8b68('0x3'));var uuid=require(_0x8b68('0x4'));var utils=require(_0x8b68('0x5'));var config=require('../../../config/environment');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var rpc={'openchannelQueueReport':require(_0x8b68('0x8')),'mailQueueReport':require(_0x8b68('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x8b68('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x8b68('0xb'))};var RuleEngine=require(_0x8b68('0xc'));function getId(_0x130892,_0xa5571b,_0x132617){return util[_0x8b68('0xd')](_0x8b68('0xe'),_0x130892,_0xa5571b||0x0,_0x132617||0x0);}function getIntervals(_0x21d944,_0x24e0b0){var _0x2f2e3c=[];if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x10')])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0['IntervalId']])&&!_[_0x8b68('0xf')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')])){_0x2f2e3c=_[_0x8b68('0x12')](_0x21d944[_0x24e0b0[_0x8b68('0x10')]][_0x8b68('0x11')],_0x8b68('0x13'));}else if(!_[_0x8b68('0xf')](_0x24e0b0[_0x8b68('0x13')])){_0x2f2e3c=[_0x24e0b0['interval']];}return _0x2f2e3c;}exports[_0x8b68('0x14')]=function(_0x509033){_0x509033['rules']={};return new BPromise(function(_0x22f75b,_0x1554d6){var _0x27d717={'Start':function(_0x5d3468){var _0x5c8d0e=this;return new Promise(function(_0x23bd52,_0x5c1e44){if(_0x5d3468){try{var _0x136f1b=[];var _0xb44923=getId(_0x5d3468[_0x8b68('0x15')],_0x5d3468[_0x8b68('0x16')]?_0x5d3468['message']['id']:0x0,_0x5d3468[_0x8b68('0x17')]?_0x5d3468[_0x8b68('0x17')]['id']:0x0);if(_0x5d3468['applications']&&_[_0x8b68('0x18')](_0x5d3468[_0x8b68('0x19')])&&_0x5d3468[_0x8b68('0x19')][_0x8b68('0x1a')]){for(var _0x38b7a7=0x0;_0x38b7a7<_0x5d3468['applications'][_0x8b68('0x1a')];_0x38b7a7+=0x1){var _0x4b4b0f=_0x5d3468[_0x8b68('0x19')][_0x38b7a7];if(fs[_0x8b68('0x1b')](path[_0x8b68('0x1c')](__dirname,_0x8b68('0x19'),_0x4b4b0f['app']+'.js'))){var _0x23edc1=[];switch(_0x4b4b0f['app'][_0x8b68('0x1d')]()){case _0x8b68('0x1e'):var _0x13aee5=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');if(_0x5d3468[_0x8b68('0x15')]==='mail'){_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x0]);_0x23edc1[_0x8b68('0x21')](_0x13aee5[0x1]);_0x23edc1['push'](_0x13aee5[_0x8b68('0x22')](0x2,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}else{_0x23edc1['push'](_0x13aee5[0x0]);_0x23edc1['push'](_0x13aee5['slice'](0x1,_0x13aee5[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));}break;case _0x8b68('0x23'):var _0x583476=_0x4b4b0f[_0x8b68('0x1f')]['split'](',');_0x23edc1['push'](_0x583476[0x0]);_0x23edc1[_0x8b68('0x21')](_0x583476[0x1]);_0x23edc1['push'](_0x583476[_0x8b68('0x22')](0x2,_0x583476[_0x8b68('0x1a')])['join'](','));break;case'dialogflowv2':var _0x357635=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x357635[0x0]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x1]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x2]);_0x23edc1[_0x8b68('0x21')](_0x357635[0x3]);_0x23edc1['push'](_0x357635[_0x8b68('0x22')](0x4,_0x357635['length'])[_0x8b68('0x1c')](','));break;case _0x8b68('0x24'):var _0x4c276f=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x0]);_0x23edc1['push'](_0x4c276f[0x1]);_0x23edc1['push'](_0x4c276f[0x2]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[0x3]);_0x23edc1[_0x8b68('0x21')](_0x4c276f[_0x8b68('0x22')](0x4,_0x4c276f[_0x8b68('0x1a')])[_0x8b68('0x1c')](','));break;case _0x8b68('0x16'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x25'):_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x26')]);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x1f')]);break;case _0x8b68('0x27'):var _0x10aca9=utils[_0x8b68('0x28')](_0x5d3468[_0x8b68('0x29')][_0x8b68('0x2a')],_0x5d3468);var _0x120b34=_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');_0x23edc1[_0x8b68('0x21')](_0x120b34[0x0]);_0x23edc1['push'](_0x120b34[0x1]);_0x23edc1['push'](_0x120b34[0x2]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x3]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x4]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x5]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x6]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x7]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x8]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0x9]);_0x23edc1[_0x8b68('0x21')](_0x120b34[0xa]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x17')]['id']);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x16')]['id']);_0x23edc1[_0x8b68('0x21')](_0x4b4b0f[_0x8b68('0x2b')]);_0x23edc1[_0x8b68('0x21')](_0x5d3468[_0x8b68('0x17')][_0x8b68('0x2c')]);_0x23edc1['push'](_0x5d3468[_0x8b68('0x2d')][_0x8b68('0x2d')]);_0x23edc1[_0x8b68('0x21')](_0x10aca9);break;default:_0x23edc1=_[_0x8b68('0xf')](_0x4b4b0f[_0x8b68('0x1f')])?[]:_0x4b4b0f[_0x8b68('0x1f')][_0x8b68('0x20')](',');}var _0x50a9c6={'id':util[_0x8b68('0xd')](_0x8b68('0x2e'),_0xb44923,_0x4b4b0f['id'],_0x4b4b0f['app']),'condition':require(_0x8b68('0x2f'))[_0x8b68('0x30')](_0xb44923,getIntervals(_0x509033['intervals'],_0x4b4b0f),_0x509033),'consequence':require('./applications/'+_0x4b4b0f['app'])['consequence'](_0xb44923,_0x23edc1,_0x509033,_0x5d3468),'p':_0x4b4b0f[_0x8b68('0x31')]||0x0};logger[_0x8b68('0x32')]('Push\x20new\x20rule',_0x50a9c6['id'],_0x8b68('0x33'),getIntervals(_0x509033['intervals'],_0x4b4b0f)[_0x8b68('0x1c')](_0x8b68('0x34')));_0x136f1b['push'](_0x50a9c6);}else{logger[_0x8b68('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x4b4b0f[_0x8b68('0x36')]+_0x8b68('0x37')));}}_0x509033[_0x8b68('0x38')][_0xb44923]=new RuleEngine(_0x136f1b);_0x509033[_0x8b68('0x38')][_0xb44923]['execute'](_0x5d3468,function(_0x20162a){logger['info'](_0x8b68('0x39'),JSON[_0x8b68('0x3a')](_0x20162a['matchPath']));if(_0x509033[_0x8b68('0x38')][_0xb44923]){_0x509033[_0x8b68('0x38')][_0xb44923][_0x8b68('0x3b')](_0x8b68('0x3c'));}});return _0x23bd52({'code':0xc8,'message':_0x5d3468});}else{logger['info'](_0x8b68('0x3d'));return _0x23bd52({'code':0xc8,'message':_0x5d3468});}}catch(_0x478527){logger[_0x8b68('0x35')](_0x478527[_0x8b68('0x3e')]);return _0x5c1e44(_0x5c8d0e[_0x8b68('0x35')](0x1f4,_0x478527));}}return _0x5c1e44(_0x8b68('0x3f'));});},'AcceptMessage':function(_0x41d9a2){var _0x69fdbe=this;return new Promise(function(_0x29e265,_0x20df07){if(_0x41d9a2[_0x8b68('0x40')]&&_0x41d9a2[_0x8b68('0x40')]['id']){if(_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x41d9a2[_0x8b68('0x40')]['id']]['busyQueue']=undefined;}}if(_0x41d9a2[_0x8b68('0x16')]&&_0x41d9a2['message']['id']){try{var _0x58cf66=getId(_0x41d9a2['channel'],_0x41d9a2[_0x8b68('0x16')]?_0x41d9a2[_0x8b68('0x16')]['id']:0x0,_0x41d9a2[_0x8b68('0x17')]?_0x41d9a2[_0x8b68('0x17')]['id']:0x0);if(_0x509033['rules'][_0x58cf66]){_0x509033['rules'][_0x58cf66][_0x8b68('0x3b')](_0x8b68('0x42'));if(rpc[_0x41d9a2[_0x8b68('0x15')]+'QueueReport']){rpc[_0x41d9a2[_0x8b68('0x15')]+_0x8b68('0x43')]['update'](_0x58cf66,{'UserId':_0x41d9a2[_0x8b68('0x16')][_0x8b68('0x44')]})['catch'](function(_0x18a9ae){logger[_0x8b68('0x35')]('error\x20update\x20queue\x20report');});}}return _0x29e265({'code':0xc8,'message':_0x41d9a2});}catch(_0x3f7f89){logger[_0x8b68('0x35')](_0x3f7f89['stack']);return _0x20df07(_0x69fdbe['error'](0x1f4,_0x3f7f89));}}logger['error'](_0x8b68('0x45'));return _0x20df07(_0x69fdbe[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'RejectMessage':function(_0x3d4b4f){var _0x55aad3=this;return new Promise(function(_0x5a1711,_0x4492fd){if(_0x3d4b4f[_0x8b68('0x40')]&&_0x3d4b4f[_0x8b68('0x40')]['id']){try{if(_0x509033['agents'][_0x3d4b4f[_0x8b68('0x40')]['id']]){_0x509033[_0x8b68('0x41')][_0x3d4b4f[_0x8b68('0x40')]['id']]['busy']=![];_0x509033[_0x8b68('0x41')][_0x3d4b4f['agent']['id']][_0x8b68('0x46')]=undefined;}return _0x5a1711({'code':0xc8,'message':_0x3d4b4f});}catch(_0x3efb0e){logger['error'](_0x3efb0e[_0x8b68('0x3e')]);return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,_0x3efb0e));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x4492fd(_0x55aad3[_0x8b68('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x241166){var _0x3f3e43=this;return new Promise(function(_0x32cd05,_0x31a090){if(_0x241166[_0x8b68('0x15')]&&_0x241166[_0x8b68('0x17')]&&_0x241166[_0x8b68('0x17')]['id']){try{var _0x3096b3=getId(_0x241166['channel'],_0x241166[_0x8b68('0x16')]?_0x241166[_0x8b68('0x16')]['id']:0x0,_0x241166[_0x8b68('0x17')]?_0x241166[_0x8b68('0x17')]['id']:0x0);if(_0x509033[_0x8b68('0x38')][_0x3096b3]){_0x509033[_0x8b68('0x38')][_0x3096b3][_0x8b68('0x3b')](_0x8b68('0x42'));}return _0x32cd05({'code':0xc8,'message':_0x241166});}catch(_0x6d63cb){logger[_0x8b68('0x35')](_0x6d63cb[_0x8b68('0x3e')]);return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x6d63cb));}}logger[_0x8b68('0x35')](_0x8b68('0x45'));return _0x31a090(_0x3f3e43[_0x8b68('0x35')](0x1f4,_0x8b68('0x45')));});},'AgentCapacity':function(_0xf07a90){var _0x3da7b4=this;return new Promise(function(_0xae90f0,_0x1de9ce){if(_0x509033['agents'][_0x8b68('0x47')](_0xf07a90['id'])){for(var _0x51e17b in _0xf07a90['capacity']){if(_0xf07a90[_0x8b68('0x48')]['hasOwnProperty'](_0x51e17b)){if(_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x47')](_0x51e17b+_0x8b68('0x49'))){_0x509033['agents'][_0xf07a90['id']][_0x51e17b+_0x8b68('0x49')]=parseInt(_0xf07a90[_0x8b68('0x48')][_0x51e17b],0xa);}}}_0x509033[_0x8b68('0x41')][_0xf07a90['id']][_0x8b68('0x4a')]();return _0xae90f0({'code':0xc8,'message':_0x509033[_0x8b68('0x41')][_0xf07a90['id']]});}else{return _0x1de9ce(_0x3da7b4[_0x8b68('0x35')](0x1f4,_0x8b68('0x4b')));}});},'Agents':function(_0x4f0aff){return new Promise(function(_0x586a5e,_0x20aac1){var _0x4224f5=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x41')]);_0x586a5e({'count':_0x4224f5[_0x8b68('0x1a')],'rows':_0x4224f5});});},'ChatQueues':function(_0x37da34){return new Promise(function(_0x2d1519,_0x314f1e){var _0x3bf22b=[];for(var _0x36d47a in _0x509033[_0x8b68('0x4d')]){if(_0x509033[_0x8b68('0x4d')][_0x8b68('0x47')](_0x36d47a)){var _0x195f82=_0x509033[_0x8b68('0x4d')][_0x36d47a];var _0x414096={'id':_0x195f82['id'],'available':_0x195f82[_0x8b68('0x4e')],'loggedIn':_0x195f82[_0x8b68('0x4f')],'name':_0x195f82['name'],'paused':_0x195f82['paused'],'waiting':_0x195f82[_0x8b68('0x50')]};_0x3bf22b[_0x8b68('0x21')](_0x414096);}}_0x2d1519({'count':_0x3bf22b['length'],'rows':_0x3bf22b});});},'MailQueues':function(_0x48d57a){return new Promise(function(_0x574aca,_0x39a04e){var _0x3d6c17=[];for(var _0xd5f52e in _0x509033[_0x8b68('0x51')]){if(_0x509033[_0x8b68('0x51')]['hasOwnProperty'](_0xd5f52e)){var _0x1c358b=_0x509033[_0x8b68('0x51')][_0xd5f52e];var _0x5c24f8={'id':_0x1c358b['id'],'available':_0x1c358b[_0x8b68('0x4e')],'loggedIn':_0x1c358b['loggedIn'],'name':_0x1c358b['name'],'paused':_0x1c358b['paused'],'waiting':_0x1c358b[_0x8b68('0x50')]};_0x3d6c17[_0x8b68('0x21')](_0x5c24f8);}}_0x574aca({'count':_0x3d6c17[_0x8b68('0x1a')],'rows':_0x3d6c17});});},'OpenchannelQueues':function(_0x7269fd){return new Promise(function(_0x864b6b,_0x1fc24c){var _0x35b22b=[];for(var _0x34456d in _0x509033[_0x8b68('0x52')]){if(_0x509033[_0x8b68('0x52')]['hasOwnProperty'](_0x34456d)){var _0x3a8d15=_0x509033[_0x8b68('0x52')][_0x34456d];var _0x310ec9={'id':_0x3a8d15['id'],'available':_0x3a8d15['available'],'loggedIn':_0x3a8d15['loggedIn'],'name':_0x3a8d15[_0x8b68('0x53')],'paused':_0x3a8d15[_0x8b68('0x54')],'waiting':_0x3a8d15['waiting']};_0x35b22b[_0x8b68('0x21')](_0x310ec9);}}_0x864b6b({'count':_0x35b22b[_0x8b68('0x1a')],'rows':_0x35b22b});});},'SmsQueues':function(_0x29bff7){return new Promise(function(_0x2c2f6d,_0x50fd2c){var _0x96e526=[];for(var _0x4925a4 in _0x509033['smsQueues']){if(_0x509033[_0x8b68('0x55')]['hasOwnProperty'](_0x4925a4)){var _0xe9550=_0x509033[_0x8b68('0x55')][_0x4925a4];var _0x5e40f4={'id':_0xe9550['id'],'available':_0xe9550[_0x8b68('0x4e')],'loggedIn':_0xe9550[_0x8b68('0x4f')],'name':_0xe9550[_0x8b68('0x53')],'paused':_0xe9550[_0x8b68('0x54')],'waiting':_0xe9550[_0x8b68('0x50')]};_0x96e526['push'](_0x5e40f4);}}_0x2c2f6d({'count':_0x96e526[_0x8b68('0x1a')],'rows':_0x96e526});});},'FaxQueues':function(_0x2e6daf){return new Promise(function(_0xa0ed41,_0x2f87e8){var _0x34c7d8=[];for(var _0x49efb7 in _0x509033['faxQueues']){if(_0x509033[_0x8b68('0x56')]['hasOwnProperty'](_0x49efb7)){var _0x2d442a=_0x509033[_0x8b68('0x56')][_0x49efb7];var _0x16e769={'id':_0x2d442a['id'],'available':_0x2d442a[_0x8b68('0x4e')],'loggedIn':_0x2d442a[_0x8b68('0x4f')],'name':_0x2d442a[_0x8b68('0x53')],'paused':_0x2d442a[_0x8b68('0x54')],'waiting':_0x2d442a['waiting']};_0x34c7d8[_0x8b68('0x21')](_0x16e769);}}_0xa0ed41({'count':_0x34c7d8['length'],'rows':_0x34c7d8});});},'WhatsappQueues':function(_0x3aaaed){return new Promise(function(_0x2caa28,_0xc8c3c){var _0x4e0fb4=[];for(var _0x3141d3 in _0x509033['whatsappQueues']){if(_0x509033[_0x8b68('0x57')]['hasOwnProperty'](_0x3141d3)){var _0x3da555=_0x509033[_0x8b68('0x57')][_0x3141d3];var _0x644d83={'id':_0x3da555['id'],'available':_0x3da555['available'],'loggedIn':_0x3da555[_0x8b68('0x4f')],'name':_0x3da555[_0x8b68('0x53')],'paused':_0x3da555[_0x8b68('0x54')],'waiting':_0x3da555[_0x8b68('0x50')]};_0x4e0fb4[_0x8b68('0x21')](_0x644d83);}}_0x2caa28({'count':_0x4e0fb4[_0x8b68('0x1a')],'rows':_0x4e0fb4});});},'ChatQueuesWaitingInteractions':function(_0x33a02f){return new Promise(function(_0x3ae1f8,_0x395b82){var _0x5a807b=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x58')]);_0x3ae1f8({'count':_0x5a807b[_0x8b68('0x1a')],'rows':_0x5a807b});});},'MailQueuesWaitingInteractions':function(_0x1e4c28){return new Promise(function(_0x71095b,_0x543468){var _0x3dfd43=_['values'](_0x509033[_0x8b68('0x59')]);_0x71095b({'count':_0x3dfd43[_0x8b68('0x1a')],'rows':_0x3dfd43});});},'OpenchannelQueuesWaitingInteractions':function(_0x524763){return new Promise(function(_0x20c8b4,_0x75af51){var _0xa7890f=_['values'](_0x509033[_0x8b68('0x5a')]);_0x20c8b4({'count':_0xa7890f[_0x8b68('0x1a')],'rows':_0xa7890f});});},'SmsQueuesWaitingInteractions':function(_0x43a874){return new Promise(function(_0x3b260a,_0x115cb7){var _0x42464c=_['values'](_0x509033[_0x8b68('0x5b')]);_0x3b260a({'count':_0x42464c[_0x8b68('0x1a')],'rows':_0x42464c});});},'FaxQueuesWaitingInteractions':function(_0x3d38eb){return new Promise(function(_0x4e5d13,_0x45e75f){var _0xde4083=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5c')]);_0x4e5d13({'count':_0xde4083[_0x8b68('0x1a')],'rows':_0xde4083});});},'WhatsappQueuesWaitingInteractions':function(_0x377045){return new Promise(function(_0x320f42,_0x4e49ec){var _0x23cc54=_[_0x8b68('0x4c')](_0x509033[_0x8b68('0x5d')]);_0x320f42({'count':_0x23cc54['length'],'rows':_0x23cc54});});}};var _0x570629=jayson[_0x8b68('0x5e')](_0x27d717)[_0x8b68('0x5f')]();_0x570629['on'](_0x8b68('0x35'),function(_0x131a30){logger[_0x8b68('0x35')](JSON['stringify'](_0x131a30));return _0x1554d6(_0x131a30);});_0x570629[_0x8b68('0x14')](0x232c,_0x8b68('0x60'),function(){console[_0x8b68('0x61')](_0x8b68('0x62'),0x232c);return _0x22f75b('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3dcb0c6..bfcdfd8 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 _0x61dc=['Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x3ec2e1,_0x5d8f00){var _0x10ae56=function(_0x200024){while(--_0x200024){_0x3ec2e1['push'](_0x3ec2e1['shift']());}};_0x10ae56(++_0x5d8f00);}(_0x61dc,0x105));var _0xc61d=function(_0xf943eb,_0xa77db5){_0xf943eb=_0xf943eb-0x0;var _0x1f4ba7=_0x61dc[_0xf943eb];return _0x1f4ba7;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xc61d('0x0'));var _=require(_0xc61d('0x1'));var logger=require(_0xc61d('0x2'))(_0xc61d('0x3'));var client=jayson[_0xc61d('0x4')][_0xc61d('0x5')]({'port':0x232a});function request(_0x28d508,_0x141e51){return new BPromise(function(_0x20fd47,_0x5d13a5){return client[_0xc61d('0x6')](_0x28d508,_0x141e51)[_0xc61d('0x7')](function(_0x3ed9c0){if(_0x3ed9c0['error']){return _0x5d13a5(_0x3ed9c0['error'][_0xc61d('0x8')]);}else{return _0x20fd47(_0x3ed9c0[_0xc61d('0x9')]);}})[_0xc61d('0xa')](function(_0x205ada){return _0x5d13a5(_0x205ada);});});}exports[_0xc61d('0xb')]=function(_0x59684e,_0x2db6b6,_0x13cc36){return function(_0x1fcc79){if(_0x13cc36[_0xc61d('0xc')]&&!_0x13cc36['rules'][_0x59684e]){logger[_0xc61d('0xd')](_0xc61d('0xe'),_0x59684e);return _0x1fcc79[_0xc61d('0xf')]();}var _0x574ac1=[];for(var _0x2300d6=0x0;_0x2300d6<_0x2db6b6[_0xc61d('0x10')];_0x2300d6+=0x1){_0x574ac1[_0xc61d('0x11')](request(_0xc61d('0x12'),{'command':util[_0xc61d('0x13')](_0xc61d('0x14'),_0x2db6b6[_0x2300d6])})[_0xc61d('0x7')](function(_0x18f172){return _0x18f172&&_0x18f172[_0xc61d('0x8')]&&_0x18f172[_0xc61d('0x8')][_0xc61d('0x15')](_0xc61d('0x16'))>=0x0?!![]:![];})[_0xc61d('0xa')](function(_0x47d970){logger['error'](_0xc61d('0x17'),_0x59684e,_0x2db6b6[_0x2300d6]);}));}BPromise[_0xc61d('0x18')](_0x574ac1)[_0xc61d('0x7')](function(_0x32ac82){var _0x23b6f6=_[_0xc61d('0x19')](_0x32ac82);logger[_0xc61d('0xd')](_0xc61d('0x1a'),_0x59684e,_0x2db6b6['join'](_0xc61d('0x1b')),_0x23b6f6);_0x1fcc79[_0xc61d('0x1c')](_0x23b6f6);})[_0xc61d('0xa')](function(_0x39606e){console[_0xc61d('0x1d')](_0x39606e);logger['error'](_0xc61d('0x1a'),_0x59684e,_0x2db6b6[_0xc61d('0x1e')]('\x20|\x20'),_0x39606e['stack']);_0x1fcc79[_0xc61d('0xf')]();});};}; \ No newline at end of file +var _0xdd1a=['info','length','push','format','then','true','[%s][INTERVAL]\x20%s','join','\x20|\x20','when','log','stop','util','bluebird','jayson/promise','lodash','routing','client','http','request','error','message','result','catch','condition','rules'];(function(_0x5452f9,_0x4857eb){var _0x495d5a=function(_0x58708b){while(--_0x58708b){_0x5452f9['push'](_0x5452f9['shift']());}};_0x495d5a(++_0x4857eb);}(_0xdd1a,0xdc));var _0xadd1=function(_0x45731f,_0x59789b){_0x45731f=_0x45731f-0x0;var _0x1a8ab5=_0xdd1a[_0x45731f];return _0x1a8ab5;};'use strict';var util=require(_0xadd1('0x0'));var BPromise=require(_0xadd1('0x1'));var jayson=require(_0xadd1('0x2'));var _=require(_0xadd1('0x3'));var logger=require('../../../config/logger')(_0xadd1('0x4'));var client=jayson[_0xadd1('0x5')][_0xadd1('0x6')]({'port':0x232a});function request(_0x3901ef,_0x49bb21){return new BPromise(function(_0xeed2be,_0x3fa3bd){return client[_0xadd1('0x7')](_0x3901ef,_0x49bb21)['then'](function(_0x497f1f){if(_0x497f1f[_0xadd1('0x8')]){return _0x3fa3bd(_0x497f1f[_0xadd1('0x8')][_0xadd1('0x9')]);}else{return _0xeed2be(_0x497f1f[_0xadd1('0xa')]);}})[_0xadd1('0xb')](function(_0x31be1e){return _0x3fa3bd(_0x31be1e);});});}exports[_0xadd1('0xc')]=function(_0x432871,_0x54ec72,_0x5568c0){return function(_0x140099){if(_0x5568c0[_0xadd1('0xd')]&&!_0x5568c0[_0xadd1('0xd')][_0x432871]){logger[_0xadd1('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x432871);return _0x140099['stop']();}var _0x1f64f3=[];for(var _0x158792=0x0;_0x158792<_0x54ec72[_0xadd1('0xf')];_0x158792+=0x1){_0x1f64f3[_0xadd1('0x10')](request('Command',{'command':util[_0xadd1('0x11')]('iftime\x20%s',_0x54ec72[_0x158792])})[_0xadd1('0x12')](function(_0x130918){return _0x130918&&_0x130918[_0xadd1('0x9')]&&_0x130918[_0xadd1('0x9')]['indexOf'](_0xadd1('0x13'))>=0x0?!![]:![];})['catch'](function(_0xe27ea){logger[_0xadd1('0x8')](_0xadd1('0x14'),_0x432871,_0x54ec72[_0x158792]);}));}BPromise['all'](_0x1f64f3)[_0xadd1('0x12')](function(_0x1c7367){var _0x1c2717=_['some'](_0x1c7367);logger[_0xadd1('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x432871,_0x54ec72[_0xadd1('0x15')](_0xadd1('0x16')),_0x1c2717);_0x140099[_0xadd1('0x17')](_0x1c2717);})['catch'](function(_0x689500){console[_0xadd1('0x18')](_0x689500);logger[_0xadd1('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x432871,_0x54ec72[_0xadd1('0x15')](_0xadd1('0x16')),_0x689500['stack']);_0x140099[_0xadd1('0x19')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e0da510..4f3a666 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 _0x087b=['calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','diffTime','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','isNil','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone'];(function(_0x1cf7a3,_0x48ce25){var _0x453304=function(_0x277808){while(--_0x277808){_0x1cf7a3['push'](_0x1cf7a3['shift']());}};_0x453304(++_0x48ce25);}(_0x087b,0x11a));var _0xb087=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x087b[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f3606,_0x40e6d6){utils['info'](util[_0xb087('0x2')](_0xb087('0x3'),_0x5f3606[_0xb087('0x4')],_0x5f3606[_0xb087('0x5')],_0x5f3606[_0xb087('0x6')],_0x5f3606[_0xb087('0x7')],_0x5f3606[_0xb087('0x8')],_0x5f3606[_0xb087('0x9')],_0x5f3606[_0xb087('0xa')],_0x5f3606[_0xb087('0xb')]));if(_0x5f3606[_0xb087('0x6')]){utils[_0xb087('0xc')](_0x5f3606[_0xb087('0x6')])[_0xb087('0xd')](function(_0x2f14bc){if(_0x2f14bc){_0x5f3606[_0xb087('0xe')]=_0x2f14bc[_0xb087('0xe')];_0x5f3606['agentacw']=_0x5f3606[_0xb087('0xf')]?_0x2f14bc[_0xb087('0x10')]:![];_0x5f3606[_0xb087('0x11')]=_0x5f3606[_0xb087('0x12')]?_0x2f14bc[_0xb087('0x13')]:0x0;}utils[_0xb087('0x14')](_0xb087('0x15'),_0x5f3606);});}else{utils['request'](_0xb087('0x15'),_0x5f3606);}if(_0x40e6d6){delete transfers[_0x5f3606[_0xb087('0x4')]];}else{delete agents[_0x5f3606[_0xb087('0x16')]];}}exports['agentcalled']=function(_0x3001e3){try{utils[_0xb087('0x17')](util[_0xb087('0x2')](_0xb087('0x18'),_0x3001e3[_0xb087('0x4')]),_0x3001e3);agents[_0x3001e3[_0xb087('0x16')]]=_0x3001e3;agents[_0x3001e3[_0xb087('0x16')]][_0xb087('0x19')]=utils[_0xb087('0x1a')]();agents[_0x3001e3[_0xb087('0x16')]]['lastevent']=_0xb087('0x1b');agents[_0x3001e3[_0xb087('0x16')]]['connectedlinenum']=null;agents[_0x3001e3[_0xb087('0x16')]][_0xb087('0x1c')]=null;utils[_0xb087('0x1d')](util['format'](_0xb087('0x1e'),_0x3001e3[_0xb087('0x4')],agents[_0x3001e3[_0xb087('0x16')]][_0xb087('0x7')],_0x3001e3['destuniqueid']));}catch(_0x13d534){utils[_0xb087('0x1f')](util[_0xb087('0x2')](_0xb087('0x18'),_0x3001e3['uniqueid']),_0x13d534);}};exports['agentringnoanswer']=function(_0x5ea3dc){try{if(!_['isNil'](agents[_0x5ea3dc[_0xb087('0x16')]])){utils[_0xb087('0x17')](util[_0xb087('0x2')](_0xb087('0x20'),_0x5ea3dc[_0xb087('0x4')]),_0x5ea3dc);utils[_0xb087('0x1d')](util[_0xb087('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5ea3dc[_0xb087('0x4')],agents[_0x5ea3dc[_0xb087('0x16')]][_0xb087('0x7')],_0x5ea3dc[_0xb087('0x16')]));agents[_0x5ea3dc[_0xb087('0x16')]]['agentringnoanswer']=!![];agents[_0x5ea3dc[_0xb087('0x16')]][_0xb087('0x21')]=utils['now']();agents[_0x5ea3dc['destuniqueid']]['lastevent']='timeout';agents[_0x5ea3dc['destuniqueid']][_0xb087('0x22')]=_0xb087('0x23');agents[_0x5ea3dc[_0xb087('0x16')]][_0xb087('0x24')]=_0x5ea3dc[_0xb087('0x25')]?parseInt(_0x5ea3dc[_0xb087('0x25')])/0x3e8:0x0;agents[_0x5ea3dc[_0xb087('0x16')]][_0xb087('0x26')]=0x0;unanswered[_0xb087('0x27')](_0x5ea3dc[_0xb087('0x16')]);}}catch(_0x18058c){utils[_0xb087('0x1f')](util[_0xb087('0x2')](_0xb087('0x20'),_0x5ea3dc['uniqueid']),_0x18058c);}};exports[_0xb087('0x28')]=function(_0x1335d9){try{_[_0xb087('0x29')](agents,function(_0x15c9ac,_0x22d441){if(_0x15c9ac[_0xb087('0x4')]==_0x1335d9[_0xb087('0x4')]&&!_[_0xb087('0x2a')](unanswered,_0x15c9ac['destuniqueid'])){utils['debug'](util[_0xb087('0x2')](_0xb087('0x2b'),_0x1335d9['uniqueid']),_0x1335d9);utils[_0xb087('0x1d')](util[_0xb087('0x2')](_0xb087('0x2c'),_0x1335d9[_0xb087('0x4')],_0x15c9ac[_0xb087('0x7')],_0x15c9ac[_0xb087('0x16')]));_0x15c9ac[_0xb087('0x2d')]=!![];_0x15c9ac[_0xb087('0x21')]=utils[_0xb087('0x1a')]();_0x15c9ac[_0xb087('0xb')]=_0xb087('0x2e');_0x15c9ac[_0xb087('0x22')]='abandoned';_0x15c9ac[_0xb087('0x24')]=_0x1335d9['holdtime'];_0x15c9ac[_0xb087('0x26')]=0x0;writeDB(_0x15c9ac);}});}catch(_0x296e9b){utils[_0xb087('0x1f')](util[_0xb087('0x2')](_0xb087('0x2b'),_0x1335d9[_0xb087('0x4')]),_0x296e9b);}};exports[_0xb087('0x2f')]=function(_0x29df58){try{if(agents[_0x29df58[_0xb087('0x16')]]){utils['debug'](util['format'](_0xb087('0x30'),_0x29df58[_0xb087('0x4')]),_0x29df58);utils[_0xb087('0x1d')](util[_0xb087('0x2')](_0xb087('0x31'),_0x29df58['uniqueid'],agents[_0x29df58[_0xb087('0x16')]][_0xb087('0x7')],_0x29df58['destuniqueid']));agents[_0x29df58['destuniqueid']][_0xb087('0x32')]=utils[_0xb087('0x1a')]();agents[_0x29df58[_0xb087('0x16')]]['connectedlinenum']=_0x29df58[_0xb087('0xa')];agents[_0x29df58[_0xb087('0x16')]][_0xb087('0x1c')]=_0x29df58[_0xb087('0x1c')];agents[_0x29df58[_0xb087('0x16')]]['holdtime']=_0x29df58[_0xb087('0x25')];agents[_0x29df58['destuniqueid']][_0xb087('0xb')]='connect';_[_0xb087('0x29')](agents,function(_0xc9f9e9,_0x513332){if(_0xc9f9e9[_0xb087('0x16')]!=_0x29df58['destuniqueid']&&_0xc9f9e9[_0xb087('0x4')]==_0x29df58['uniqueid']){_0xc9f9e9[_0xb087('0x26')]=0x0;_0xc9f9e9[_0xb087('0x24')]=_0x29df58[_0xb087('0x25')];_0xc9f9e9[_0xb087('0x2d')]=!![];_0xc9f9e9[_0xb087('0x21')]=utils[_0xb087('0x1a')]();_0xc9f9e9[_0xb087('0xb')]='answered_elsewhere';_0xc9f9e9[_0xb087('0x22')]='answered_elsewhere';_0xc9f9e9[_0xb087('0x33')]=_0x29df58[_0xb087('0x16')];_0xc9f9e9['answeredelsewheremembername']=_0x29df58[_0xb087('0x7')];writeDB(_0xc9f9e9);}});}}catch(_0x45dc6f){utils[_0xb087('0x1f')](util['format'](_0xb087('0x30'),_0x29df58['uniqueid']),_0x45dc6f);}};exports[_0xb087('0xf')]=function(_0x32b9d3){try{if(!_['isNil'](agents[_0x32b9d3[_0xb087('0x16')]])){utils[_0xb087('0x17')](util['format'](_0xb087('0x34'),_0x32b9d3[_0xb087('0x4')]),_0x32b9d3);utils['info'](util[_0xb087('0x2')](_0xb087('0x35'),_0x32b9d3[_0xb087('0x4')],agents[_0x32b9d3[_0xb087('0x16')]]['membername'],_0x32b9d3['destuniqueid']));agents[_0x32b9d3[_0xb087('0x16')]][_0xb087('0xf')]=!![];agents[_0x32b9d3[_0xb087('0x16')]][_0xb087('0x36')]=utils[_0xb087('0x1a')]();agents[_0x32b9d3[_0xb087('0x16')]]['talktime']=utils['diffTime'](agents[_0x32b9d3[_0xb087('0x16')]]['agentcompleteAt'],agents[_0x32b9d3[_0xb087('0x16')]][_0xb087('0x32')]);agents[_0x32b9d3[_0xb087('0x16')]][_0xb087('0x22')]=_0x32b9d3['reason'];agents[_0x32b9d3[_0xb087('0x16')]]['lastevent']=_0xb087('0x37');writeDB(agents[_0x32b9d3[_0xb087('0x16')]]);}}catch(_0xcb56c7){utils[_0xb087('0x1f')](util[_0xb087('0x2')]('[%s][agents][agentcomplete]',_0x32b9d3[_0xb087('0x4')]),_0xcb56c7);}};exports[_0xb087('0x38')]=function(_0x588d96){try{if(!_['isNil'](agents[_0x588d96[_0xb087('0x39')]])){utils['debug'](util['format'](_0xb087('0x3a'),_0x588d96[_0xb087('0x4')]),_0x588d96);utils['info'](util[_0xb087('0x2')](_0xb087('0x3b'),_0x588d96[_0xb087('0x4')],agents[_0x588d96['transfereruniqueid']]['membername'],agents[_0x588d96[_0xb087('0x39')]]['uniqueid']));agents[_0x588d96['transfereruniqueid']][_0xb087('0x3c')]=!![];agents[_0x588d96[_0xb087('0x39')]][_0xb087('0x3d')]=_0xb087('0x3e');agents[_0x588d96[_0xb087('0x39')]][_0xb087('0x3f')]=_0x588d96[_0xb087('0x40')];agents[_0x588d96[_0xb087('0x39')]][_0xb087('0x41')]=agents[_0x588d96[_0xb087('0x39')]][_0xb087('0x4')];}}catch(_0x2cfc44){utils['error'](util[_0xb087('0x2')](_0xb087('0x3a'),_0x588d96['uniqueid']),_0x2cfc44);}};exports[_0xb087('0x42')]=function(_0x458301){try{utils[_0xb087('0x17')](util[_0xb087('0x2')](_0xb087('0x43'),_0x458301[_0xb087('0x44')]),_0x458301);if(_0x458301[_0xb087('0x44')]==_0x458301[_0xb087('0x45')]){if(!_[_0xb087('0x46')](agents[_0x458301[_0xb087('0x47')]])){utils[_0xb087('0x1d')](util['format'](_0xb087('0x48'),_0x458301['origtransfereruniqueid'],agents[_0x458301[_0xb087('0x47')]]['membername']));agents[_0x458301[_0xb087('0x47')]][_0xb087('0x3c')]=!![];agents[_0x458301[_0xb087('0x47')]][_0xb087('0x3d')]=_0xb087('0x49');agents[_0x458301[_0xb087('0x47')]][_0xb087('0x3f')]=_0x458301[_0xb087('0x4a')];agents[_0x458301[_0xb087('0x47')]][_0xb087('0x41')]=_0x458301[_0xb087('0x44')];}if(_0x458301[_0xb087('0x4b')]&&agents[_0x458301[_0xb087('0x4b')]]){agents[_0x458301[_0xb087('0x4b')]][_0xb087('0x4c')]=0x1;transfers[_0x458301[_0xb087('0x4b')]]=_[_0xb087('0x4d')](agents[_0x458301[_0xb087('0x4b')]]);transfers[_0x458301[_0xb087('0x4b')]][_0xb087('0x9')]=agents[_0x458301[_0xb087('0x47')]][_0xb087('0x9')];transfers[_0x458301['transfereeuniqueid']][_0xb087('0x4e')]=agents[_0x458301[_0xb087('0x47')]][_0xb087('0x4e')];transfers[_0x458301['transfereeuniqueid']][_0xb087('0x19')]=utils[_0xb087('0x1a')]();transfers[_0x458301['transfereeuniqueid']][_0xb087('0x32')]=utils[_0xb087('0x1a')]();transfers[_0x458301[_0xb087('0x4b')]]['holdtime']=0x0;transfers[_0x458301[_0xb087('0x4b')]][_0xb087('0x4c')]=0x2;}}else if(_0x458301[_0xb087('0x47')]==_0x458301[_0xb087('0x4f')]){if(!_[_0xb087('0x46')](agents[_0x458301[_0xb087('0x44')]])){utils[_0xb087('0x1d')](util[_0xb087('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x458301[_0xb087('0x44')],agents[_0x458301[_0xb087('0x44')]][_0xb087('0x7')]));agents[_0x458301['origtransfereruniqueid']][_0xb087('0x3c')]=!![];agents[_0x458301['origtransfereruniqueid']]['transfertype']=_0xb087('0x49');agents[_0x458301[_0xb087('0x44')]]['transferexten']=_0x458301[_0xb087('0x50')];agents[_0x458301['origtransfereruniqueid']][_0xb087('0x41')]=_0x458301[_0xb087('0x47')];}if(_0x458301['transfertargetuniqueid']&&agents[_0x458301['transfertargetuniqueid']]){agents[_0x458301[_0xb087('0x51')]]['agententerreason']=0x1;transfers[_0x458301['transfertargetuniqueid']]=_[_0xb087('0x4d')](agents[_0x458301['transfertargetuniqueid']]);transfers[_0x458301[_0xb087('0x51')]]['calleridnum']=agents[_0x458301[_0xb087('0x44')]][_0xb087('0x9')];transfers[_0x458301[_0xb087('0x51')]][_0xb087('0x4e')]=agents[_0x458301[_0xb087('0x44')]][_0xb087('0x4e')];transfers[_0x458301['transfertargetuniqueid']][_0xb087('0x19')]=utils['now']();transfers[_0x458301[_0xb087('0x51')]][_0xb087('0x32')]=utils[_0xb087('0x1a')]();transfers[_0x458301['transfertargetuniqueid']][_0xb087('0x24')]=0x0;transfers[_0x458301['transfertargetuniqueid']][_0xb087('0x4c')]=0x2;}}}catch(_0x3784f7){utils[_0xb087('0x1f')](util[_0xb087('0x2')](_0xb087('0x43'),_0x458301[_0xb087('0x44')]),_0x3784f7);}};exports['hangup']=function(_0x245d68){try{utils[_0xb087('0x17')](util['format'](_0xb087('0x52'),_0x245d68['uniqueid']),_0x245d68);if(agents[_0x245d68[_0xb087('0x4')]]&&agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x22')]===_0xb087('0x23')){if(_0x245d68[_0xb087('0x53')]==='21'){agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x22')]=_0xb087('0x54');agents[_0x245d68['uniqueid']]['lastevent']='rejected';}utils[_0xb087('0x1d')](util['format'](_0xb087('0x55'),_0x245d68['uniqueid'],agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x7')],agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x22')],agents[_0x245d68['uniqueid']][_0xb087('0xb')]));writeDB(agents[_0x245d68['uniqueid']]);var _0x185102=unanswered[_0xb087('0x56')](_0x245d68[_0xb087('0x4')]);if(_0x185102>-0x1){unanswered[_0xb087('0x57')](_0x185102,0x1);}}if(transfers[_0x245d68['uniqueid']]){transfers[_0x245d68['uniqueid']][_0xb087('0xf')]=!![];transfers[_0x245d68['uniqueid']][_0xb087('0x36')]=utils[_0xb087('0x1a')]();transfers[_0x245d68[_0xb087('0x4')]][_0xb087('0x26')]=utils['diffTime'](transfers[_0x245d68['uniqueid']][_0xb087('0x36')],transfers[_0x245d68['uniqueid']][_0xb087('0x32')]);transfers[_0x245d68[_0xb087('0x4')]][_0xb087('0x22')]=_0xb087('0x58');transfers[_0x245d68[_0xb087('0x4')]]['lastevent']=_0xb087('0x37');utils[_0xb087('0x1d')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x245d68['uniqueid'],transfers[_0x245d68[_0xb087('0x4')]][_0xb087('0x7')],transfers[_0x245d68[_0xb087('0x4')]][_0xb087('0x22')],transfers[_0x245d68[_0xb087('0x4')]][_0xb087('0xb')]));writeDB(transfers[_0x245d68['uniqueid']],!![]);}if(agents[_0x245d68[_0xb087('0x4')]]&&agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x32')]){agents[_0x245d68[_0xb087('0x4')]][_0xb087('0xf')]=!![];agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x36')]=utils['now']();agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x26')]=utils[_0xb087('0x59')](agents[_0x245d68['uniqueid']][_0xb087('0x36')],agents[_0x245d68['uniqueid']][_0xb087('0x32')]);agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x22')]=agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x3c')]?_0xb087('0x3c'):'agent';agents[_0x245d68['uniqueid']][_0xb087('0xb')]=_0xb087('0x37');utils['info'](util[_0xb087('0x2')](_0xb087('0x55'),_0x245d68[_0xb087('0x4')],agents[_0x245d68[_0xb087('0x4')]][_0xb087('0x7')],agents[_0x245d68[_0xb087('0x4')]]['reason'],agents[_0x245d68[_0xb087('0x4')]][_0xb087('0xb')]));writeDB(agents[_0x245d68[_0xb087('0x4')]]);}}catch(_0x3114ce){utils[_0xb087('0x1f')](util[_0xb087('0x2')](_0xb087('0x52'),_0x245d68[_0xb087('0x4')]),_0x3114ce);}}; \ No newline at end of file +var _0xbb53=['agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','holdtime','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentconnectAt','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','queue','type','agentcomplete','agentacw','acwTimeout','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','timeout','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned'];(function(_0x21a17f,_0x54149c){var _0x47cfcb=function(_0x958487){while(--_0x958487){_0x21a17f['push'](_0x21a17f['shift']());}};_0x47cfcb(++_0x54149c);}(_0xbb53,0x121));var _0x3bb5=function(_0x21dab3,_0x567bdb){_0x21dab3=_0x21dab3-0x0;var _0x4ee96f=_0xbb53[_0x21dab3];return _0x4ee96f;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var utils=require(_0x3bb5('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xa71c15,_0x20c8b6){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x5'),_0xa71c15[_0x3bb5('0x6')],_0xa71c15[_0x3bb5('0x7')],_0xa71c15['queue'],_0xa71c15['membername'],_0xa71c15[_0x3bb5('0x8')],_0xa71c15[_0x3bb5('0x9')],_0xa71c15[_0x3bb5('0xa')],_0xa71c15[_0x3bb5('0xb')]));if(_0xa71c15[_0x3bb5('0xc')]){utils['getVoiceQueueByName'](_0xa71c15['queue'])['then'](function(_0x10ddfb){if(_0x10ddfb){_0xa71c15[_0x3bb5('0xd')]=_0x10ddfb[_0x3bb5('0xd')];_0xa71c15['agentacw']=_0xa71c15[_0x3bb5('0xe')]?_0x10ddfb['acw']:![];_0xa71c15['acwtime']=_0xa71c15[_0x3bb5('0xf')]?_0x10ddfb[_0x3bb5('0x10')]:0x0;}utils['request'](_0x3bb5('0x11'),_0xa71c15);});}else{utils['request'](_0x3bb5('0x11'),_0xa71c15);}if(_0x20c8b6){delete transfers[_0xa71c15['uniqueid']];}else{delete agents[_0xa71c15['destuniqueid']];}}exports[_0x3bb5('0x12')]=function(_0x35a99b){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x14'),_0x35a99b[_0x3bb5('0x6')]),_0x35a99b);agents[_0x35a99b['destuniqueid']]=_0x35a99b;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x16')]=utils['now']();agents[_0x35a99b['destuniqueid']]['lastevent']=_0x3bb5('0x17');agents[_0x35a99b[_0x3bb5('0x15')]]['connectedlinenum']=null;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x18')]=null;utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x35a99b[_0x3bb5('0x6')],agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x35a99b['destuniqueid']));}catch(_0x5efea4){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x14'),_0x35a99b['uniqueid']),_0x5efea4);}};exports[_0x3bb5('0x1b')]=function(_0x2afe6e){try{if(!_[_0x3bb5('0x1c')](agents[_0x2afe6e[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentringnoanswer]',_0x2afe6e[_0x3bb5('0x6')]),_0x2afe6e);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x1d'),_0x2afe6e[_0x3bb5('0x6')],agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x2afe6e['destuniqueid']));agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1b')]=!![];agents[_0x2afe6e['destuniqueid']]['agentringnoanswerAt']=utils[_0x3bb5('0x1e')]();agents[_0x2afe6e[_0x3bb5('0x15')]]['lastevent']='timeout';agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x3bb5('0x20');agents[_0x2afe6e[_0x3bb5('0x15')]]['holdtime']=_0x2afe6e['ringtime']?parseInt(_0x2afe6e[_0x3bb5('0x21')])/0x3e8:0x0;agents[_0x2afe6e['destuniqueid']][_0x3bb5('0x22')]=0x0;unanswered[_0x3bb5('0x23')](_0x2afe6e[_0x3bb5('0x15')]);}}catch(_0x534b15){utils['error'](util[_0x3bb5('0x4')](_0x3bb5('0x24'),_0x2afe6e[_0x3bb5('0x6')]),_0x534b15);}};exports[_0x3bb5('0x25')]=function(_0x311680){try{_[_0x3bb5('0x26')](agents,function(_0x3ed2cc,_0x5ce225){if(_0x3ed2cc[_0x3bb5('0x6')]==_0x311680[_0x3bb5('0x6')]&&!_[_0x3bb5('0x27')](unanswered,_0x3ed2cc[_0x3bb5('0x15')])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680['uniqueid']),_0x311680);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x311680[_0x3bb5('0x6')],_0x3ed2cc[_0x3bb5('0x19')],_0x3ed2cc[_0x3bb5('0x15')]));_0x3ed2cc[_0x3bb5('0x1b')]=!![];_0x3ed2cc[_0x3bb5('0x29')]=utils['now']();_0x3ed2cc[_0x3bb5('0xb')]=_0x3bb5('0x2a');_0x3ed2cc[_0x3bb5('0x1f')]=_0x3bb5('0x2a');_0x3ed2cc['holdtime']=_0x311680['holdtime'];_0x3ed2cc[_0x3bb5('0x22')]=0x0;writeDB(_0x3ed2cc);}});}catch(_0xeeb452){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680[_0x3bb5('0x6')]),_0xeeb452);}};exports[_0x3bb5('0x2b')]=function(_0x2a0a19){try{if(agents[_0x2a0a19[_0x3bb5('0x15')]]){utils['debug'](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19['uniqueid']),_0x2a0a19);utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x2d'),_0x2a0a19[_0x3bb5('0x6')],agents[_0x2a0a19[_0x3bb5('0x15')]]['membername'],_0x2a0a19['destuniqueid']));agents[_0x2a0a19[_0x3bb5('0x15')]]['agentconnectAt']=utils[_0x3bb5('0x1e')]();agents[_0x2a0a19['destuniqueid']]['connectedlinenum']=_0x2a0a19[_0x3bb5('0xa')];agents[_0x2a0a19['destuniqueid']]['connectedlinename']=_0x2a0a19[_0x3bb5('0x18')];agents[_0x2a0a19[_0x3bb5('0x15')]][_0x3bb5('0x2e')]=_0x2a0a19['ringtime'];agents[_0x2a0a19[_0x3bb5('0x15')]]['lastevent']=_0x3bb5('0x2f');_['forIn'](agents,function(_0x235e3,_0x35bc81){if(_0x235e3[_0x3bb5('0x15')]!=_0x2a0a19[_0x3bb5('0x15')]&&_0x235e3[_0x3bb5('0x6')]==_0x2a0a19[_0x3bb5('0x6')]){_0x235e3['talktime']=0x0;_0x235e3[_0x3bb5('0x2e')]=_0x2a0a19[_0x3bb5('0x21')];_0x235e3['agentringnoanswer']=!![];_0x235e3[_0x3bb5('0x29')]=utils[_0x3bb5('0x1e')]();_0x235e3[_0x3bb5('0xb')]='answered_elsewhere';_0x235e3[_0x3bb5('0x1f')]=_0x3bb5('0x30');_0x235e3['answeredelsewheredestinationuniqueid']=_0x2a0a19[_0x3bb5('0x15')];_0x235e3[_0x3bb5('0x31')]=_0x2a0a19[_0x3bb5('0x19')];writeDB(_0x235e3);}});}}catch(_0x2291e9){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19[_0x3bb5('0x6')]),_0x2291e9);}};exports[_0x3bb5('0xe')]=function(_0x42676d){try{if(!_[_0x3bb5('0x1c')](agents[_0x42676d[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentcomplete]',_0x42676d[_0x3bb5('0x6')]),_0x42676d);utils[_0x3bb5('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x42676d[_0x3bb5('0x6')],agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x42676d[_0x3bb5('0x15')]));agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xe')]=!![];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x32')]=utils['now']();agents[_0x42676d['destuniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x42676d[_0x3bb5('0x15')]]['agentcompleteAt'],agents[_0x42676d[_0x3bb5('0x15')]]['agentconnectAt']);agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x42676d[_0x3bb5('0x1f')];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xb')]=_0x3bb5('0x34');writeDB(agents[_0x42676d['destuniqueid']]);}}catch(_0x2efd7c){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x35'),_0x42676d[_0x3bb5('0x6')]),_0x2efd7c);}};exports['blindtransfer']=function(_0x41edf7){try{if(!_[_0x3bb5('0x1c')](agents[_0x41edf7[_0x3bb5('0x36')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][blindtransfer]',_0x41edf7[_0x3bb5('0x6')]),_0x41edf7);utils[_0x3bb5('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x41edf7[_0x3bb5('0x6')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x19')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')]));agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x37')]=!![];agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x38')]=_0x3bb5('0x39');agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x3a')]=_0x41edf7[_0x3bb5('0x3b')];agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x3c')]=agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')];}}catch(_0x239a34){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x3d'),_0x41edf7[_0x3bb5('0x6')]),_0x239a34);}};exports[_0x3bb5('0x3e')]=function(_0x1ff862){try{utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862[_0x3bb5('0x40')]),_0x1ff862);if(_0x1ff862['origtransfereruniqueid']==_0x1ff862[_0x3bb5('0x41')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x42')]])){utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x43'),_0x1ff862['origtransfereruniqueid'],agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x37')]=!![];agents[_0x1ff862[_0x3bb5('0x42')]]['transfertype']=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x45')];agents[_0x1ff862['secondtransfereruniqueid']][_0x3bb5('0x3c')]=_0x1ff862[_0x3bb5('0x40')];}if(_0x1ff862[_0x3bb5('0x46')]&&agents[_0x1ff862[_0x3bb5('0x46')]]){agents[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x46')]]=_[_0x3bb5('0x48')](agents[_0x1ff862['transfereeuniqueid']]);transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x9')]=agents[_0x1ff862[_0x3bb5('0x42')]]['calleridnum'];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x49')]=agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x49')];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x16')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x1ff862[_0x3bb5('0x42')]==_0x1ff862[_0x3bb5('0x4b')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x40')]])){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1ff862[_0x3bb5('0x40')],agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x40')]]['transfer']=!![];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x38')]=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x4c')];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3c')]=_0x1ff862['secondtransfereruniqueid'];}if(_0x1ff862[_0x3bb5('0x4d')]&&agents[_0x1ff862[_0x3bb5('0x4d')]]){agents[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x4d')]]=_['clone'](agents[_0x1ff862[_0x3bb5('0x4d')]]);transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x9')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x9')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x49')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x49')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x16')]=utils['now']();transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x2;}}}catch(_0xc34441){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862['origtransfereruniqueid']),_0xc34441);}};exports['hangup']=function(_0x2b3ed8){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x4e'),_0x2b3ed8['uniqueid']),_0x2b3ed8);if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]===_0x3bb5('0x20')){if(_0x2b3ed8['cause']==='21'){agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]=_0x3bb5('0x4f');agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x4f');}utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')],agents[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(agents[_0x2b3ed8['uniqueid']]);var _0x5bfdf2=unanswered['indexOf'](_0x2b3ed8[_0x3bb5('0x6')]);if(_0x5bfdf2>-0x1){unanswered[_0x3bb5('0x51')](_0x5bfdf2,0x1);}}if(transfers[_0x2b3ed8[_0x3bb5('0x6')]]){transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xe')]=!![];transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]);transfers[_0x2b3ed8[_0x3bb5('0x6')]]['reason']=_0x3bb5('0x52');transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x34');utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')],transfers[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(transfers[_0x2b3ed8[_0x3bb5('0x6')]],!![]);}if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]){agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xe')]=!![];agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')],agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x4a')]);agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')]=agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x37')]?_0x3bb5('0x37'):_0x3bb5('0x52');agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xb')]='complete';utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]]['reason'],agents[_0x2b3ed8[_0x3bb5('0x6')]]['lastevent']));writeDB(agents[_0x2b3ed8[_0x3bb5('0x6')]]);}}catch(_0xb3572){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x4e'),_0x2b3ed8[_0x3bb5('0x6')]),_0xb3572);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 0cc21ee..82fef3f 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 _0xb4d9=['getUserByInternal','accountcode','then','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','channelstate','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','variable','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','noop','gotoif','lastapplication','lastdata','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent'];(function(_0x31c37a,_0x140cb4){var _0x29bd74=function(_0x3746f9){while(--_0x3746f9){_0x31c37a['push'](_0x31c37a['shift']());}};_0x29bd74(++_0x140cb4);}(_0xb4d9,0xce));var _0x9b4d=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb4d9[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var utils=require('./utils');var transfers=require(_0x9b4d('0x2'));var dispositions=[_0x9b4d('0x3'),_0x9b4d('0x4'),'FAILED',_0x9b4d('0x3'),_0x9b4d('0x3'),_0x9b4d('0x3'),_0x9b4d('0x5'),_0x9b4d('0x6'),_0x9b4d('0x4'),_0x9b4d('0x4'),_0x9b4d('0x4')];var channels={};function writeDB(_0x461cb1){var _0x14cb0b;if(transfers[_0x9b4d('0x7')][_0x461cb1['uniqueid']]){_0x14cb0b=_0x461cb1[_0x9b4d('0x8')];_0x461cb1['uniqueid']=transfers[_0x9b4d('0x7')][_0x461cb1['uniqueid']][_0x9b4d('0x9')];}utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')](_0x9b4d('0xc'),_0x461cb1[_0x9b4d('0x8')],_0x461cb1[_0x9b4d('0xd')],_0x461cb1[_0x9b4d('0xe')],_0x461cb1[_0x9b4d('0xf')],_0x461cb1[_0x9b4d('0x10')],_0x461cb1[_0x9b4d('0x11')],_0x461cb1[_0x9b4d('0x12')],_0x461cb1[_0x9b4d('0x13')]));if(_0x461cb1['accountcode']){utils[_0x9b4d('0x14')](_0x461cb1[_0x9b4d('0x15')])[_0x9b4d('0x16')](function(_0x3c4ae0){if(_0x3c4ae0){_0x461cb1['UserId']=_0x3c4ae0['id'];}utils[_0x9b4d('0x17')]('CreateVoiceCallReport',_0x461cb1);});}else{utils['request'](_0x9b4d('0x18'),_0x461cb1);}if(channels[_0x461cb1[_0x9b4d('0x8')]]){delete channels[_0x461cb1[_0x9b4d('0x8')]];}else if(_0x14cb0b&&channels[_0x14cb0b]){if(!transfers[_0x9b4d('0x7')][_0x14cb0b][_0x9b4d('0x19')])delete transfers[_0x9b4d('0x7')][_0x14cb0b];delete channels[_0x14cb0b];}}exports['newchannel']=function(_0x58bfc5){try{utils[_0x9b4d('0x1a')](util[_0x9b4d('0xb')](_0x9b4d('0x1b'),_0x58bfc5[_0x9b4d('0x8')]),_0x58bfc5);if(_0x58bfc5[_0x9b4d('0x8')]==_0x58bfc5[_0x9b4d('0x1c')]&&_0x58bfc5[_0x9b4d('0xd')]!=_0x9b4d('0x1d')){utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')](_0x9b4d('0x1e'),_0x58bfc5[_0x9b4d('0x8')],_0x58bfc5[_0x9b4d('0x1f')],_0x58bfc5[_0x9b4d('0x20')]));channels[_0x58bfc5[_0x9b4d('0x8')]]={'uniqueid':_0x58bfc5[_0x9b4d('0x8')],'accountcode':_0x58bfc5[_0x9b4d('0x15')],'source':_0x58bfc5[_0x9b4d('0x11')],'destination':_0x58bfc5[_0x9b4d('0x20')],'destinationcontext':_0x58bfc5[_0x9b4d('0x1f')],'channel':_0x58bfc5['channel'],'starttime':utils[_0x9b4d('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9b4d('0x3'),'amaflags':_0x9b4d('0x22')};}}catch(_0x495676){utils[_0x9b4d('0x23')](util['format']('[%s][calls][newchannel]',_0x58bfc5[_0x9b4d('0x8')]),_0x495676);}};exports['newstate']=function(_0x450972){try{utils[_0x9b4d('0x1a')](util['format'](_0x9b4d('0x24'),_0x450972[_0x9b4d('0x8')]),_0x450972);if(!_[_0x9b4d('0x25')](channels[_0x450972['uniqueid']])&&_0x450972['channelstate']==0x6){utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x450972[_0x9b4d('0x8')],_0x450972['context'],_0x450972[_0x9b4d('0xd')]));if(_['isNil'](channels[_0x450972[_0x9b4d('0x8')]]['systemanswertime'])){channels[_0x450972[_0x9b4d('0x8')]][_0x9b4d('0x26')]=utils['now']();}}else if(!_[_0x9b4d('0x25')](channels[_0x450972['linkedid']])&&_0x450972['channelstate']==0x6&&_0x450972[_0x9b4d('0x1f')]!=_0x9b4d('0x27')){utils['info'](util['format'](_0x9b4d('0x28'),_0x450972[_0x9b4d('0x8')],_0x450972[_0x9b4d('0x1c')],_0x450972[_0x9b4d('0x1f')],_0x450972[_0x9b4d('0xd')]));channels[_0x450972[_0x9b4d('0x1c')]][_0x9b4d('0x15')]=_0x450972[_0x9b4d('0x15')];channels[_0x450972[_0x9b4d('0x1c')]][_0x9b4d('0x29')]=_0x450972[_0x9b4d('0xd')];if(_[_0x9b4d('0x25')](channels[_0x450972[_0x9b4d('0x1c')]][_0x9b4d('0x2a')])){channels[_0x450972[_0x9b4d('0x1c')]]['answertime']=utils[_0x9b4d('0x21')]();}channels[_0x450972['linkedid']][_0x9b4d('0x2b')]=dispositions[_[_0x9b4d('0x2c')](_0x450972[_0x9b4d('0x2d')])]||_0x9b4d('0x5');}}catch(_0x148788){utils[_0x9b4d('0x23')](util[_0x9b4d('0xb')]('[%s][calls][newstate]',_0x450972[_0x9b4d('0x8')]),_0x148788);}};exports[_0x9b4d('0x2e')]=function(_0x25bb30){try{if(!_['isNil'](channels[_0x25bb30['uniqueid']])){utils[_0x9b4d('0x1a')](util['format']('[%s][calls][hangup]',_0x25bb30[_0x9b4d('0x8')]),_0x25bb30);if(_[_0x9b4d('0x25')](channels[_0x25bb30[_0x9b4d('0x8')]][_0x9b4d('0x2f')])){channels[_0x25bb30[_0x9b4d('0x8')]]['callerid']=_0x25bb30[_0x9b4d('0x30')]+'\x20<'+_0x25bb30[_0x9b4d('0x11')]+'>';}utils['info'](util[_0x9b4d('0xb')](_0x9b4d('0x31'),_0x25bb30[_0x9b4d('0x8')],channels[_0x25bb30[_0x9b4d('0x8')]][_0x9b4d('0x2f')],_0x25bb30['cause-txt']));channels[_0x25bb30['uniqueid']][_0x9b4d('0x32')]=utils['now']();channels[_0x25bb30[_0x9b4d('0x8')]][_0x9b4d('0x33')]=utils['diffTime'](channels[_0x25bb30[_0x9b4d('0x8')]]['endtime'],channels[_0x25bb30['uniqueid']][_0x9b4d('0x34')]);channels[_0x25bb30['uniqueid']][_0x9b4d('0x35')]=channels[_0x25bb30[_0x9b4d('0x8')]][_0x9b4d('0x2a')]?utils[_0x9b4d('0x36')](channels[_0x25bb30[_0x9b4d('0x8')]][_0x9b4d('0x32')],channels[_0x25bb30['uniqueid']][_0x9b4d('0x2a')]):0x0;writeDB(channels[_0x25bb30['uniqueid']]);}}catch(_0xa3d93d){utils[_0x9b4d('0x23')](util['format'](_0x9b4d('0x37'),_0x25bb30[_0x9b4d('0x8')]),_0xa3d93d);}};exports[_0x9b4d('0x38')]=function(_0x39f4bf){try{if(!_['isNil'](channels[_0x39f4bf['localtwolinkedid']])){utils[_0x9b4d('0x1a')](util['format']('[%s][calls][attendedtransfer]',_0x39f4bf['origtransfereruniqueid']),_0x39f4bf);if(channels[_0x39f4bf[_0x9b4d('0x39')]][_0x9b4d('0xd')]==_0x39f4bf['transfereechannel']){utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')](_0x9b4d('0x3a'),_0x39f4bf['origtransfereruniqueid'],_0x39f4bf[_0x9b4d('0x39')],_0x39f4bf[_0x9b4d('0x3b')]));channels[_0x39f4bf['localtwolinkedid']][_0x9b4d('0x29')]=_0x39f4bf[_0x9b4d('0x3b')];channels[_0x39f4bf['localtwolinkedid']][_0x9b4d('0x3c')]=_0x9b4d('0x3d');}else if(channels[_0x39f4bf['localtwolinkedid']][_0x9b4d('0xd')]=_0x39f4bf[_0x9b4d('0x3e')]){utils['info'](util[_0x9b4d('0xb')](_0x9b4d('0x3a'),_0x39f4bf[_0x9b4d('0x3f')],_0x39f4bf[_0x9b4d('0x39')],_0x39f4bf['origtransfererchannel']));channels[_0x39f4bf[_0x9b4d('0x39')]][_0x9b4d('0x29')]=_0x39f4bf[_0x9b4d('0x40')];channels[_0x39f4bf[_0x9b4d('0x39')]][_0x9b4d('0x3c')]=_0x9b4d('0x3d');}}}catch(_0x3695ef){utils[_0x9b4d('0x23')](util['format']('[%s][calls][attendedtransfer]',_0x39f4bf['origtransfereruniqueid']),_0x3695ef);}};exports[_0x9b4d('0x41')]=function(_0x51089b){try{if(!_[_0x9b4d('0x25')](channels[_0x51089b[_0x9b4d('0x8')]])){utils[_0x9b4d('0x1a')](util[_0x9b4d('0xb')]('[%s][calls][musiconholdstart]',_0x51089b[_0x9b4d('0x8')]),_0x51089b);channels[_0x51089b['uniqueid']]['musiconholdstartAt']=utils[_0x9b4d('0x21')]();utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')](_0x9b4d('0x42'),_0x51089b[_0x9b4d('0x8')],channels[_0x51089b[_0x9b4d('0x8')]][_0x9b4d('0x43')]));}}catch(_0x5d9429){utils['error'](util[_0x9b4d('0xb')](_0x9b4d('0x44'),_0x51089b[_0x9b4d('0x8')]),_0x5d9429);}};exports[_0x9b4d('0x45')]=function(_0x876878){try{if(!_[_0x9b4d('0x25')](channels[_0x876878[_0x9b4d('0x8')]])){utils[_0x9b4d('0x1a')](util[_0x9b4d('0xb')](_0x9b4d('0x46'),_0x876878[_0x9b4d('0x8')]),_0x876878);if(!_[_0x9b4d('0x25')](channels[_0x876878[_0x9b4d('0x8')]][_0x9b4d('0x43')])){channels[_0x876878['uniqueid']][_0x9b4d('0x47')]+=utils[_0x9b4d('0x36')](utils[_0x9b4d('0x21')](),channels[_0x876878[_0x9b4d('0x8')]][_0x9b4d('0x43')]);utils[_0x9b4d('0xa')](util['format'](_0x9b4d('0x48'),_0x876878[_0x9b4d('0x8')],channels[_0x876878[_0x9b4d('0x8')]][_0x9b4d('0x47')]));delete channels[_0x876878[_0x9b4d('0x8')]][_0x9b4d('0x43')];}}}catch(_0x4166ba){utils[_0x9b4d('0x23')](util[_0x9b4d('0xb')](_0x9b4d('0x46'),_0x876878[_0x9b4d('0x8')]),_0x4166ba);}};exports[_0x9b4d('0x49')]=function(_0x310011){try{if(!_[_0x9b4d('0x25')](channels[_0x310011[_0x9b4d('0x8')]])){utils[_0x9b4d('0x1a')](util['format']('[%s][calls][varset]',_0x310011['uniqueid']),_0x310011);if(!_[_0x9b4d('0x25')](_0x310011['variable'][_0x9b4d('0x4a')])){utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')](_0x9b4d('0x4b'),_0x310011[_0x9b4d('0x8')],_0x310011[_0x9b4d('0x4c')]));channels[_0x310011['uniqueid']][_0x9b4d('0x4d')]=_0x310011[_0x9b4d('0x4c')];}if(!_[_0x9b4d('0x25')](_0x310011['variable']['xmd-phone'])){utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')](_0x9b4d('0x4e'),_0x310011[_0x9b4d('0x8')],_0x310011[_0x9b4d('0x4c')]));channels[_0x310011[_0x9b4d('0x8')]]['destination']=_0x310011[_0x9b4d('0x4c')];channels[_0x310011[_0x9b4d('0x8')]][_0x9b4d('0x2f')]='\x22'+_0x310011[_0x9b4d('0x4c')]+_0x9b4d('0x4f')+_0x310011[_0x9b4d('0x4c')]+'>';}if(!_['isNil'](_0x310011['variable'][_0x9b4d('0x50')])||!_[_0x9b4d('0x25')](_0x310011[_0x9b4d('0x51')][_0x9b4d('0x52')])){utils[_0x9b4d('0xa')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x310011[_0x9b4d('0x8')],!_[_0x9b4d('0x25')](_0x310011['variable'][_0x9b4d('0x50')])?_0x9b4d('0x50'):_0x9b4d('0x52'),_0x310011[_0x9b4d('0x4c')]));channels[_0x310011[_0x9b4d('0x8')]][_0x9b4d('0x2f')]=_0x310011['value'];}if(!_[_0x9b4d('0x25')](_0x310011[_0x9b4d('0x51')]['xmd-queue'])||!_[_0x9b4d('0x25')](_0x310011[_0x9b4d('0x51')][_0x9b4d('0x53')])){utils[_0x9b4d('0xa')](util['format'](_0x9b4d('0x54'),_0x310011[_0x9b4d('0x8')],!_[_0x9b4d('0x25')](_0x310011[_0x9b4d('0x51')][_0x9b4d('0x55')])?_0x9b4d('0x55'):'xmcs-queue',_0x310011[_0x9b4d('0x4c')]));channels[_0x310011['uniqueid']]['lastapplication']=_0x9b4d('0x56');channels[_0x310011[_0x9b4d('0x8')]]['lastdata']=_0x310011[_0x9b4d('0x4c')];channels[_0x310011[_0x9b4d('0x8')]]['queue']=!![];}if(!_[_0x9b4d('0x25')](_0x310011[_0x9b4d('0x51')][_0x9b4d('0x57')])){utils['info'](util[_0x9b4d('0xb')](_0x9b4d('0x58'),_0x310011[_0x9b4d('0x8')],_0x310011[_0x9b4d('0x4c')]));channels[_0x310011[_0x9b4d('0x8')]][_0x9b4d('0x59')]=_0x310011[_0x9b4d('0x4c')];}if(!_[_0x9b4d('0x25')](_0x310011[_0x9b4d('0x51')]['xmd-cdrtype'])){utils[_0x9b4d('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x310011['uniqueid'],_0x310011[_0x9b4d('0x4c')]));channels[_0x310011['uniqueid']][_0x9b4d('0x5a')]=_0x310011[_0x9b4d('0x4c')];}if(!_[_0x9b4d('0x25')](_0x310011['variable'][_0x9b4d('0x5b')])){utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x310011['uniqueid'],_0x310011[_0x9b4d('0x4c')]));channels[_0x310011[_0x9b4d('0x8')]][_0x9b4d('0x5c')]=_0x310011['value'];}if(!_['isNil'](_0x310011[_0x9b4d('0x51')][_0x9b4d('0x5d')])){utils[_0x9b4d('0xa')](util['format'](_0x9b4d('0x5e'),_0x310011[_0x9b4d('0x8')],_0x310011[_0x9b4d('0x4c')]));channels[_0x310011[_0x9b4d('0x8')]]['sipcallid']=_0x310011[_0x9b4d('0x4c')];}}}catch(_0x4998f8){utils[_0x9b4d('0x23')](util[_0x9b4d('0xb')](_0x9b4d('0x5f'),_0x310011['uniqueid']),_0x4998f8);}};exports[_0x9b4d('0x60')]=function(_0x1ecc7b){try{if(!_[_0x9b4d('0x25')](channels[_0x1ecc7b[_0x9b4d('0x8')]])){utils[_0x9b4d('0x1a')](util[_0x9b4d('0xb')](_0x9b4d('0x61'),_0x1ecc7b[_0x9b4d('0x8')]),_0x1ecc7b);utils[_0x9b4d('0xa')](util[_0x9b4d('0xb')](_0x9b4d('0x62'),_0x1ecc7b[_0x9b4d('0x8')],_0x1ecc7b[_0x9b4d('0x63')],_0x1ecc7b['appdata']));if(_0x1ecc7b[_0x9b4d('0x63')][_0x9b4d('0x64')]()==_0x9b4d('0x65')&&_[_0x9b4d('0x66')](_0x1ecc7b['appdata'][_0x9b4d('0x64')](),_0x9b4d('0x67'))){var _0x52e943=_0x1ecc7b[_0x9b4d('0x68')][_0x9b4d('0x69')]('=');var _0x5d4907=_0x52e943[0x0][_0x9b4d('0x6a')](_0x52e943[0x0][_0x9b4d('0x6b')]('(')+0x1,_0x52e943[0x0]['lastIndexOf'](')'));var _0x26129a=_0x52e943[0x1];channels[_0x1ecc7b[_0x9b4d('0x8')]][_0x5d4907]=_0x26129a;}if(!_[_0x9b4d('0x6c')]([_0x9b4d('0x2e'),_0x9b4d('0x6d'),'execif',_0x9b4d('0x65'),_0x9b4d('0x6e')],_0x1ecc7b[_0x9b4d('0x63')]['toLowerCase']())){channels[_0x1ecc7b['uniqueid']][_0x9b4d('0x6f')]=_0x1ecc7b[_0x9b4d('0x63')];channels[_0x1ecc7b[_0x9b4d('0x8')]][_0x9b4d('0x70')]=_0x1ecc7b[_0x9b4d('0x68')];}}}catch(_0x4f4732){utils[_0x9b4d('0x23')](util[_0x9b4d('0xb')](_0x9b4d('0x61'),_0x1ecc7b[_0x9b4d('0x8')]),_0x4f4732);}}; \ No newline at end of file +var _0x4c4a=['[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','cdr','split','lastIndexOf','includes','execif','appdata','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','sipcallid'];(function(_0x2729d4,_0x621c56){var _0x308927=function(_0x4887e2){while(--_0x4887e2){_0x2729d4['push'](_0x2729d4['shift']());}};_0x308927(++_0x621c56);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x3c0be1,_0xb5860c){_0x3c0be1=_0x3c0be1-0x0;var _0x38c50f=_0x4c4a[_0x3c0be1];return _0x38c50f;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var utils=require(_0xa4c4('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xa4c4('0x3'),_0xa4c4('0x4'),_0xa4c4('0x4'),_0xa4c4('0x3'),'NO\x20ANSWER',_0xa4c4('0x3'),'ANSWERED',_0xa4c4('0x5'),_0xa4c4('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x11b498){var _0x553525;if(transfers[_0xa4c4('0x6')][_0x11b498[_0xa4c4('0x7')]]){_0x553525=_0x11b498[_0xa4c4('0x7')];_0x11b498['uniqueid']=transfers['blinds'][_0x11b498[_0xa4c4('0x7')]][_0xa4c4('0x8')];}utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0xb'),_0x11b498['uniqueid'],_0x11b498[_0xa4c4('0xc')],_0x11b498['queue'],_0x11b498[_0xa4c4('0xd')],_0x11b498[_0xa4c4('0xe')],_0x11b498[_0xa4c4('0xf')],_0x11b498[_0xa4c4('0x10')],_0x11b498[_0xa4c4('0x11')]));if(_0x11b498[_0xa4c4('0x12')]){utils[_0xa4c4('0x13')](_0x11b498[_0xa4c4('0x12')])[_0xa4c4('0x14')](function(_0x57ae15){if(_0x57ae15){_0x11b498[_0xa4c4('0x15')]=_0x57ae15['id'];}utils[_0xa4c4('0x16')](_0xa4c4('0x17'),_0x11b498);});}else{utils[_0xa4c4('0x16')](_0xa4c4('0x17'),_0x11b498);}if(channels[_0x11b498[_0xa4c4('0x7')]]){delete channels[_0x11b498[_0xa4c4('0x7')]];}else if(_0x553525&&channels[_0x553525]){if(!transfers['blinds'][_0x553525][_0xa4c4('0x18')])delete transfers[_0xa4c4('0x6')][_0x553525];delete channels[_0x553525];}}exports['newchannel']=function(_0x764792){try{utils[_0xa4c4('0x19')](util[_0xa4c4('0xa')](_0xa4c4('0x1a'),_0x764792[_0xa4c4('0x7')]),_0x764792);if(_0x764792[_0xa4c4('0x7')]==_0x764792[_0xa4c4('0x1b')]&&_0x764792[_0xa4c4('0xc')]!=_0xa4c4('0x1c')){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x1d'),_0x764792[_0xa4c4('0x7')],_0x764792[_0xa4c4('0x1e')],_0x764792[_0xa4c4('0x1f')]));channels[_0x764792[_0xa4c4('0x7')]]={'uniqueid':_0x764792[_0xa4c4('0x7')],'accountcode':_0x764792[_0xa4c4('0x12')],'source':_0x764792[_0xa4c4('0xf')],'destination':_0x764792['exten'],'destinationcontext':_0x764792['context'],'channel':_0x764792[_0xa4c4('0xc')],'starttime':utils[_0xa4c4('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa4c4('0x3'),'amaflags':_0xa4c4('0x21')};}}catch(_0xd56b75){utils[_0xa4c4('0x22')](util['format']('[%s][calls][newchannel]',_0x764792['uniqueid']),_0xd56b75);}};exports[_0xa4c4('0x23')]=function(_0x1410fa){try{utils[_0xa4c4('0x19')](util['format'](_0xa4c4('0x24'),_0x1410fa[_0xa4c4('0x7')]),_0x1410fa);if(!_[_0xa4c4('0x25')](channels[_0x1410fa['uniqueid']])&&_0x1410fa[_0xa4c4('0x26')]==0x6){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x27'),_0x1410fa[_0xa4c4('0x7')],_0x1410fa['context'],_0x1410fa[_0xa4c4('0xc')]));if(_[_0xa4c4('0x25')](channels[_0x1410fa[_0xa4c4('0x7')]][_0xa4c4('0x28')])){channels[_0x1410fa[_0xa4c4('0x7')]]['systemanswertime']=utils[_0xa4c4('0x20')]();}}else if(!_['isNil'](channels[_0x1410fa['linkedid']])&&_0x1410fa['channelstate']==0x6&&_0x1410fa['context']!=_0xa4c4('0x29')){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x2a'),_0x1410fa[_0xa4c4('0x7')],_0x1410fa['linkedid'],_0x1410fa['context'],_0x1410fa['channel']));channels[_0x1410fa[_0xa4c4('0x1b')]][_0xa4c4('0x12')]=_0x1410fa['accountcode'];channels[_0x1410fa[_0xa4c4('0x1b')]][_0xa4c4('0x2b')]=_0x1410fa['channel'];if(_[_0xa4c4('0x25')](channels[_0x1410fa[_0xa4c4('0x1b')]]['answertime'])){channels[_0x1410fa[_0xa4c4('0x1b')]][_0xa4c4('0x2c')]=utils[_0xa4c4('0x20')]();}channels[_0x1410fa[_0xa4c4('0x1b')]][_0xa4c4('0x2d')]=dispositions[_[_0xa4c4('0x2e')](_0x1410fa['channelstate'])]||_0xa4c4('0x2f');}}catch(_0x5bc148){utils[_0xa4c4('0x22')](util[_0xa4c4('0xa')](_0xa4c4('0x24'),_0x1410fa[_0xa4c4('0x7')]),_0x5bc148);}};exports[_0xa4c4('0x30')]=function(_0x3c0ac5){try{if(!_['isNil'](channels[_0x3c0ac5[_0xa4c4('0x7')]])){utils['debug'](util[_0xa4c4('0xa')](_0xa4c4('0x31'),_0x3c0ac5['uniqueid']),_0x3c0ac5);if(_[_0xa4c4('0x25')](channels[_0x3c0ac5[_0xa4c4('0x7')]][_0xa4c4('0x32')])){channels[_0x3c0ac5[_0xa4c4('0x7')]][_0xa4c4('0x32')]=_0x3c0ac5[_0xa4c4('0x33')]+'\x20<'+_0x3c0ac5['calleridnum']+'>';}utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3c0ac5[_0xa4c4('0x7')],channels[_0x3c0ac5[_0xa4c4('0x7')]][_0xa4c4('0x32')],_0x3c0ac5[_0xa4c4('0x34')]));channels[_0x3c0ac5[_0xa4c4('0x7')]][_0xa4c4('0x35')]=utils[_0xa4c4('0x20')]();channels[_0x3c0ac5[_0xa4c4('0x7')]][_0xa4c4('0x36')]=utils[_0xa4c4('0x37')](channels[_0x3c0ac5[_0xa4c4('0x7')]][_0xa4c4('0x35')],channels[_0x3c0ac5['uniqueid']][_0xa4c4('0x38')]);channels[_0x3c0ac5[_0xa4c4('0x7')]][_0xa4c4('0x39')]=channels[_0x3c0ac5[_0xa4c4('0x7')]]['answertime']?utils['diffTime'](channels[_0x3c0ac5['uniqueid']][_0xa4c4('0x35')],channels[_0x3c0ac5['uniqueid']][_0xa4c4('0x2c')]):0x0;writeDB(channels[_0x3c0ac5[_0xa4c4('0x7')]]);}}catch(_0x1c9fcb){utils[_0xa4c4('0x22')](util[_0xa4c4('0xa')](_0xa4c4('0x31'),_0x3c0ac5[_0xa4c4('0x7')]),_0x1c9fcb);}};exports[_0xa4c4('0x3a')]=function(_0x18c9f3){try{if(!_[_0xa4c4('0x25')](channels[_0x18c9f3['localtwolinkedid']])){utils[_0xa4c4('0x19')](util[_0xa4c4('0xa')]('[%s][calls][attendedtransfer]',_0x18c9f3[_0xa4c4('0x3b')]),_0x18c9f3);if(channels[_0x18c9f3[_0xa4c4('0x3c')]][_0xa4c4('0xc')]==_0x18c9f3[_0xa4c4('0x3d')]){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x3e'),_0x18c9f3['origtransfereruniqueid'],_0x18c9f3[_0xa4c4('0x3c')],_0x18c9f3[_0xa4c4('0x3f')]));channels[_0x18c9f3[_0xa4c4('0x3c')]][_0xa4c4('0x2b')]=_0x18c9f3[_0xa4c4('0x3f')];channels[_0x18c9f3[_0xa4c4('0x3c')]][_0xa4c4('0x40')]=_0xa4c4('0x41');}else if(channels[_0x18c9f3[_0xa4c4('0x3c')]][_0xa4c4('0xc')]=_0x18c9f3['transfertargetchannel']){utils[_0xa4c4('0x9')](util['format'](_0xa4c4('0x3e'),_0x18c9f3[_0xa4c4('0x3b')],_0x18c9f3[_0xa4c4('0x3c')],_0x18c9f3['origtransfererchannel']));channels[_0x18c9f3[_0xa4c4('0x3c')]][_0xa4c4('0x2b')]=_0x18c9f3[_0xa4c4('0x42')];channels[_0x18c9f3[_0xa4c4('0x3c')]][_0xa4c4('0x40')]=_0xa4c4('0x41');}}}catch(_0x1e3996){utils[_0xa4c4('0x22')](util[_0xa4c4('0xa')](_0xa4c4('0x43'),_0x18c9f3[_0xa4c4('0x3b')]),_0x1e3996);}};exports[_0xa4c4('0x44')]=function(_0x347f23){try{if(!_[_0xa4c4('0x25')](channels[_0x347f23[_0xa4c4('0x7')]])){utils[_0xa4c4('0x19')](util[_0xa4c4('0xa')](_0xa4c4('0x45'),_0x347f23[_0xa4c4('0x7')]),_0x347f23);channels[_0x347f23[_0xa4c4('0x7')]][_0xa4c4('0x46')]=utils['now']();utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x347f23[_0xa4c4('0x7')],channels[_0x347f23['uniqueid']]['musiconholdstartAt']));}}catch(_0x222429){utils[_0xa4c4('0x22')](util[_0xa4c4('0xa')](_0xa4c4('0x45'),_0x347f23[_0xa4c4('0x7')]),_0x222429);}};exports[_0xa4c4('0x47')]=function(_0x165776){try{if(!_[_0xa4c4('0x25')](channels[_0x165776[_0xa4c4('0x7')]])){utils[_0xa4c4('0x19')](util[_0xa4c4('0xa')](_0xa4c4('0x48'),_0x165776['uniqueid']),_0x165776);if(!_[_0xa4c4('0x25')](channels[_0x165776['uniqueid']][_0xa4c4('0x46')])){channels[_0x165776[_0xa4c4('0x7')]]['mohtime']+=utils[_0xa4c4('0x37')](utils[_0xa4c4('0x20')](),channels[_0x165776[_0xa4c4('0x7')]][_0xa4c4('0x46')]);utils['info'](util[_0xa4c4('0xa')](_0xa4c4('0x49'),_0x165776[_0xa4c4('0x7')],channels[_0x165776['uniqueid']][_0xa4c4('0x4a')]));delete channels[_0x165776['uniqueid']][_0xa4c4('0x46')];}}}catch(_0x1400fc){utils[_0xa4c4('0x22')](util['format'](_0xa4c4('0x48'),_0x165776[_0xa4c4('0x7')]),_0x1400fc);}};exports[_0xa4c4('0x4b')]=function(_0x5813f2){try{if(!_[_0xa4c4('0x25')](channels[_0x5813f2[_0xa4c4('0x7')]])){utils[_0xa4c4('0x19')](util[_0xa4c4('0xa')](_0xa4c4('0x4c'),_0x5813f2['uniqueid']),_0x5813f2);if(!_['isNil'](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x4e')])){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x4f'),_0x5813f2[_0xa4c4('0x7')],_0x5813f2[_0xa4c4('0x50')]));channels[_0x5813f2['uniqueid']][_0xa4c4('0x51')]=_0x5813f2[_0xa4c4('0x50')];}if(!_['isNil'](_0x5813f2[_0xa4c4('0x4d')]['xmd-phone'])){utils['info'](util[_0xa4c4('0xa')](_0xa4c4('0x52'),_0x5813f2['uniqueid'],_0x5813f2['value']));channels[_0x5813f2['uniqueid']][_0xa4c4('0x53')]=_0x5813f2['value'];channels[_0x5813f2['uniqueid']]['callerid']='\x22'+_0x5813f2[_0xa4c4('0x50')]+_0xa4c4('0x54')+_0x5813f2[_0xa4c4('0x50')]+'>';}if(!_[_0xa4c4('0x25')](_0x5813f2['variable']['xmd-callerid-preview'])||!_[_0xa4c4('0x25')](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x55')])){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x56'),_0x5813f2[_0xa4c4('0x7')],!_[_0xa4c4('0x25')](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x57')])?_0xa4c4('0x57'):'xmd-callerid',_0x5813f2[_0xa4c4('0x50')]));channels[_0x5813f2[_0xa4c4('0x7')]][_0xa4c4('0x32')]=_0x5813f2[_0xa4c4('0x50')];}if(!_[_0xa4c4('0x25')](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x58')])||!_[_0xa4c4('0x25')](_0x5813f2['variable'][_0xa4c4('0x59')])){utils[_0xa4c4('0x9')](util['format'](_0xa4c4('0x56'),_0x5813f2[_0xa4c4('0x7')],!_[_0xa4c4('0x25')](_0x5813f2['variable']['xmd-queue'])?_0xa4c4('0x58'):_0xa4c4('0x59'),_0x5813f2[_0xa4c4('0x50')]));channels[_0x5813f2[_0xa4c4('0x7')]][_0xa4c4('0x5a')]=_0xa4c4('0x5b');channels[_0x5813f2[_0xa4c4('0x7')]][_0xa4c4('0x5c')]=_0x5813f2['value'];channels[_0x5813f2[_0xa4c4('0x7')]][_0xa4c4('0x5d')]=!![];}if(!_['isNil'](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x5e')])){utils[_0xa4c4('0x9')](util['format'](_0xa4c4('0x5f'),_0x5813f2[_0xa4c4('0x7')],_0x5813f2[_0xa4c4('0x50')]));channels[_0x5813f2[_0xa4c4('0x7')]][_0xa4c4('0x60')]=_0x5813f2[_0xa4c4('0x50')];}if(!_['isNil'](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x61')])){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x62'),_0x5813f2[_0xa4c4('0x7')],_0x5813f2[_0xa4c4('0x50')]));channels[_0x5813f2['uniqueid']]['type']=_0x5813f2[_0xa4c4('0x50')];}if(!_[_0xa4c4('0x25')](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x63')])){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5813f2[_0xa4c4('0x7')],_0x5813f2[_0xa4c4('0x50')]));channels[_0x5813f2[_0xa4c4('0x7')]]['routeid']=_0x5813f2[_0xa4c4('0x50')];}if(!_[_0xa4c4('0x25')](_0x5813f2[_0xa4c4('0x4d')][_0xa4c4('0x64')])){utils[_0xa4c4('0x9')](util[_0xa4c4('0xa')](_0xa4c4('0x65'),_0x5813f2[_0xa4c4('0x7')],_0x5813f2['value']));channels[_0x5813f2[_0xa4c4('0x7')]][_0xa4c4('0x64')]=_0x5813f2[_0xa4c4('0x50')];}}}catch(_0x4d9809){utils['error'](util['format'](_0xa4c4('0x4c'),_0x5813f2['uniqueid']),_0x4d9809);}};exports[_0xa4c4('0x66')]=function(_0x3477cb){try{if(!_[_0xa4c4('0x25')](channels[_0x3477cb[_0xa4c4('0x7')]])){utils[_0xa4c4('0x19')](util['format'](_0xa4c4('0x67'),_0x3477cb[_0xa4c4('0x7')]),_0x3477cb);utils[_0xa4c4('0x9')](util['format'](_0xa4c4('0x68'),_0x3477cb['uniqueid'],_0x3477cb[_0xa4c4('0x69')],_0x3477cb['appdata']));if(_0x3477cb[_0xa4c4('0x69')]['toLowerCase']()==_0xa4c4('0x6a')&&_['startsWith'](_0x3477cb['appdata']['toLowerCase'](),_0xa4c4('0x6b'))){var _0x4ff1e5=_0x3477cb['appdata'][_0xa4c4('0x6c')]('=');var _0x2783a=_0x4ff1e5[0x0]['substring'](_0x4ff1e5[0x0][_0xa4c4('0x6d')]('(')+0x1,_0x4ff1e5[0x0][_0xa4c4('0x6d')](')'));var _0x47a9d2=_0x4ff1e5[0x1];channels[_0x3477cb[_0xa4c4('0x7')]][_0x2783a]=_0x47a9d2;}if(!_[_0xa4c4('0x6e')]([_0xa4c4('0x30'),'noop',_0xa4c4('0x6f'),'set','gotoif'],_0x3477cb['application']['toLowerCase']())){channels[_0x3477cb['uniqueid']][_0xa4c4('0x5a')]=_0x3477cb[_0xa4c4('0x69')];channels[_0x3477cb[_0xa4c4('0x7')]][_0xa4c4('0x5c')]=_0x3477cb[_0xa4c4('0x70')];}}}catch(_0x3560f4){utils['error'](util[_0xa4c4('0xa')](_0xa4c4('0x67'),_0x3477cb['uniqueid']),_0x3560f4);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ed8d3ca..bdf8f4a 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 _0x1f5d=['info','error','[core]\x20error','close','[core]\x20close','./utils','connect','[core]\x20connected','shutdown'];(function(_0xcfbb1d,_0x10f3b3){var _0x710ffd=function(_0x5a5cae){while(--_0x5a5cae){_0xcfbb1d['push'](_0xcfbb1d['shift']());}};_0x710ffd(++_0x10f3b3);}(_0x1f5d,0x1eb));var _0xd1f5=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x1f5d[_0x1139d0];return _0xcc01a6;};'use strict';var utils=require(_0xd1f5('0x0'));exports[_0xd1f5('0x1')]=function(){utils['info'](_0xd1f5('0x2'));};exports[_0xd1f5('0x3')]=function(){utils[_0xd1f5('0x4')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0xd1f5('0x4')]('[core]\x20fullybooted');};exports[_0xd1f5('0x5')]=function(_0x4b915e){utils[_0xd1f5('0x5')](_0xd1f5('0x6'),_0x4b915e);};exports[_0xd1f5('0x7')]=function(){utils[_0xd1f5('0x4')](_0xd1f5('0x8'));};exports['managerevent']=function(_0x3c3843){}; \ No newline at end of file +var _0x6778=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','managerevent','./utils','connect','info','shutdown'];(function(_0x3de1ef,_0x1b7a20){var _0x3d8477=function(_0x207752){while(--_0x207752){_0x3de1ef['push'](_0x3de1ef['shift']());}};_0x3d8477(++_0x1b7a20);}(_0x6778,0x1d2));var _0x8677=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x6778[_0x152136];return _0x20df44;};'use strict';var utils=require(_0x8677('0x0'));exports[_0x8677('0x1')]=function(){utils[_0x8677('0x2')]('[core]\x20connected');};exports[_0x8677('0x3')]=function(){utils['info'](_0x8677('0x4'));};exports[_0x8677('0x5')]=function(){utils[_0x8677('0x2')](_0x8677('0x6'));};exports[_0x8677('0x7')]=function(_0x3ed81a){utils[_0x8677('0x7')]('[core]\x20error',_0x3ed81a);};exports[_0x8677('0x8')]=function(){utils[_0x8677('0x2')]('[core]\x20close');};exports[_0x8677('0x9')]=function(_0x1904d3){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index debb8f6..876f090 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 _0xe321=['connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','duration','diffTime','endtime','holdtime','[%s][dials][hangup]','lodash','util','./utils','format','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','debug','info','application','appdata','startsWith','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','varset','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','answertime'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe321,0xdc));var _0x1e32=function(_0x58d499,_0x2f1ec1){_0x58d499=_0x58d499-0x0;var _0x13a0d9=_0xe321[_0x58d499];return _0x13a0d9;};'use strict';var _=require(_0x1e32('0x0'));var util=require(_0x1e32('0x1'));var utils=require(_0x1e32('0x2'));var dials={};function writeDB(_0x53bdd4){utils['info'](util[_0x1e32('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x53bdd4[_0x1e32('0x4')],_0x53bdd4[_0x1e32('0x5')],_0x53bdd4['dialstring'],_0x53bdd4[_0x1e32('0x6')],_0x53bdd4[_0x1e32('0x7')],_0x53bdd4[_0x1e32('0x8')]));utils['request'](_0x1e32('0x9'),_0x53bdd4);delete dials[_0x53bdd4[_0x1e32('0x4')]];}exports['newexten']=function(_0x1b5f20){try{utils[_0x1e32('0xa')](util[_0x1e32('0x3')]('[%s][dials][newexten]',_0x1b5f20[_0x1e32('0x4')]),_0x1b5f20);utils[_0x1e32('0xb')](util[_0x1e32('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1b5f20[_0x1e32('0x4')],_0x1b5f20[_0x1e32('0xc')],_0x1b5f20[_0x1e32('0xd')]));if(_0x1b5f20[_0x1e32('0xc')]['toLowerCase']()=='set'&&_[_0x1e32('0xe')](_0x1b5f20['appdata'][_0x1e32('0xf')](),_0x1e32('0x10'))){var _0x3b6aac=_0x1b5f20[_0x1e32('0xd')][_0x1e32('0x11')]('=');dials[_0x1b5f20[_0x1e32('0x4')]]={'routeId':_0x3b6aac[0x1]};}}catch(_0x49f66e){utils[_0x1e32('0x12')](util['format'](_0x1e32('0x13'),_0x1b5f20['uniqueid']),_0x49f66e);}};exports[_0x1e32('0x14')]=function(_0x58a265){try{utils['debug'](util[_0x1e32('0x3')]('[%s][dials][varset]',_0x58a265[_0x1e32('0x4')]),_0x58a265);if(!_[_0x1e32('0x15')](_0x58a265[_0x1e32('0x16')]['outboundrouteid'])){utils[_0x1e32('0xb')](util['format'](_0x1e32('0x17'),_0x58a265[_0x1e32('0x4')],_0x58a265[_0x1e32('0x18')]));dials[_0x58a265['uniqueid']]={'routeId':_0x58a265[_0x1e32('0x18')]};}}catch(_0x22310f){utils['error'](util[_0x1e32('0x3')]('[%s][dials][varset]',_0x58a265[_0x1e32('0x4')]),_0x22310f);}};exports['dialbegin']=function(_0x43ed3e){try{if(!_[_0x1e32('0x15')](dials[_0x43ed3e[_0x1e32('0x4')]])){utils[_0x1e32('0xa')](util[_0x1e32('0x3')]('[%s][dials][dialbegin]',_0x43ed3e[_0x1e32('0x4')]),_0x43ed3e);dials[_0x43ed3e['uniqueid']]=_[_0x1e32('0x19')](dials[_0x43ed3e[_0x1e32('0x4')]],_0x43ed3e);dials[_0x43ed3e['uniqueid']][_0x1e32('0x1a')]=utils[_0x1e32('0x1b')]();dials[_0x43ed3e[_0x1e32('0x4')]]['lastevent']=_0x1e32('0x1c');utils[_0x1e32('0xb')](util[_0x1e32('0x3')](_0x1e32('0x1d'),_0x43ed3e[_0x1e32('0x4')],dials[_0x43ed3e[_0x1e32('0x4')]][_0x1e32('0x1a')]));}}catch(_0x20f120){utils['error'](util[_0x1e32('0x3')]('[%s][dials][dialbegin]',_0x43ed3e[_0x1e32('0x4')]),_0x20f120);}};exports['dialend']=function(_0x1a1579){try{if(!_[_0x1e32('0x15')](dials[_0x1a1579[_0x1e32('0x4')]])){utils['debug'](util[_0x1e32('0x3')](_0x1e32('0x1e'),_0x1a1579[_0x1e32('0x4')]),_0x1a1579);dials[_0x1a1579[_0x1e32('0x4')]][_0x1e32('0x8')]=_0x1a1579[_0x1e32('0x8')];if(_0x1a1579[_0x1e32('0x8')]=='ANSWER'){dials[_0x1a1579[_0x1e32('0x4')]]=_[_0x1e32('0x19')](dials[_0x1a1579[_0x1e32('0x4')]],_0x1a1579);dials[_0x1a1579[_0x1e32('0x4')]][_0x1e32('0x1f')]=utils[_0x1e32('0x1b')]();dials[_0x1a1579[_0x1e32('0x4')]]['lastevent']=_0x1e32('0x20');utils['info'](util[_0x1e32('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1a1579['uniqueid'],_0x1a1579[_0x1e32('0x8')],dials[_0x1a1579[_0x1e32('0x4')]][_0x1e32('0x1f')]));}else{utils[_0x1e32('0xb')](util[_0x1e32('0x3')](_0x1e32('0x21'),_0x1a1579[_0x1e32('0x4')],_0x1a1579[_0x1e32('0x8')]));}}}catch(_0x3665c4){utils['error'](util[_0x1e32('0x3')](_0x1e32('0x1e'),_0x1a1579[_0x1e32('0x4')]),_0x3665c4);}};exports[_0x1e32('0x22')]=function(_0x43c7d4){try{if(!_[_0x1e32('0x15')](dials[_0x43c7d4[_0x1e32('0x4')]])){utils[_0x1e32('0xa')](util[_0x1e32('0x3')]('[%s][dials][hangup]',_0x43c7d4[_0x1e32('0x4')]),_0x43c7d4);utils[_0x1e32('0xb')](util[_0x1e32('0x3')](_0x1e32('0x23'),_0x43c7d4[_0x1e32('0x4')],_0x43c7d4[_0x1e32('0x6')],_0x43c7d4['calleridname'],_0x43c7d4['cause-txt']));dials[_0x43c7d4[_0x1e32('0x4')]]=_[_0x1e32('0x19')](dials[_0x43c7d4[_0x1e32('0x4')]],{'endtime':utils['now'](),'lastevent':_0x1e32('0x24')});dials[_0x43c7d4[_0x1e32('0x4')]][_0x1e32('0x25')]=utils[_0x1e32('0x26')](dials[_0x43c7d4[_0x1e32('0x4')]][_0x1e32('0x27')],dials[_0x43c7d4[_0x1e32('0x4')]][_0x1e32('0x1a')]);dials[_0x43c7d4['uniqueid']][_0x1e32('0x28')]=utils[_0x1e32('0x26')](dials[_0x43c7d4[_0x1e32('0x4')]][_0x1e32('0x1f')]||dials[_0x43c7d4[_0x1e32('0x4')]][_0x1e32('0x27')],dials[_0x43c7d4[_0x1e32('0x4')]]['starttime']);dials[_0x43c7d4[_0x1e32('0x4')]]['billableseconds']=dials[_0x43c7d4['uniqueid']]['answertime']?utils[_0x1e32('0x26')](dials[_0x43c7d4[_0x1e32('0x4')]][_0x1e32('0x27')],dials[_0x43c7d4[_0x1e32('0x4')]][_0x1e32('0x1f')]):0x0;writeDB(dials[_0x43c7d4[_0x1e32('0x4')]]);}}catch(_0x43c208){utils[_0x1e32('0x12')](util[_0x1e32('0x3')](_0x1e32('0x29'),_0x43c7d4[_0x1e32('0x4')]),_0x43c208);}}; \ No newline at end of file +var _0xd0dc=['variable','outboundrouteid','error','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','application','startsWith','appdata','toLowerCase','cdr(routeid)','split','[%s][dials][varset]','isNil'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0xd0dc,0xa0));var _0xcd0d=function(_0x4f1e23,_0x166b91){_0x4f1e23=_0x4f1e23-0x0;var _0x4354b1=_0xd0dc[_0x4f1e23];return _0x4354b1;};'use strict';var _=require(_0xcd0d('0x0'));var util=require('util');var utils=require(_0xcd0d('0x1'));var dials={};function writeDB(_0x3721f7){utils['info'](util[_0xcd0d('0x2')](_0xcd0d('0x3'),_0x3721f7[_0xcd0d('0x4')],_0x3721f7[_0xcd0d('0x5')],_0x3721f7[_0xcd0d('0x6')],_0x3721f7[_0xcd0d('0x7')],_0x3721f7[_0xcd0d('0x8')],_0x3721f7[_0xcd0d('0x9')]));utils[_0xcd0d('0xa')](_0xcd0d('0xb'),_0x3721f7);delete dials[_0x3721f7['uniqueid']];}exports[_0xcd0d('0xc')]=function(_0x103d6e){try{utils[_0xcd0d('0xd')](util['format'](_0xcd0d('0xe'),_0x103d6e[_0xcd0d('0x4')]),_0x103d6e);utils[_0xcd0d('0xf')](util[_0xcd0d('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x103d6e['uniqueid'],_0x103d6e[_0xcd0d('0x10')],_0x103d6e['appdata']));if(_0x103d6e[_0xcd0d('0x10')]['toLowerCase']()=='set'&&_[_0xcd0d('0x11')](_0x103d6e[_0xcd0d('0x12')][_0xcd0d('0x13')](),_0xcd0d('0x14'))){var _0x191118=_0x103d6e['appdata'][_0xcd0d('0x15')]('=');dials[_0x103d6e[_0xcd0d('0x4')]]={'routeId':_0x191118[0x1]};}}catch(_0x14655a){utils['error'](util[_0xcd0d('0x2')](_0xcd0d('0xe'),_0x103d6e['uniqueid']),_0x14655a);}};exports['varset']=function(_0x4528c2){try{utils['debug'](util[_0xcd0d('0x2')](_0xcd0d('0x16'),_0x4528c2[_0xcd0d('0x4')]),_0x4528c2);if(!_[_0xcd0d('0x17')](_0x4528c2[_0xcd0d('0x18')][_0xcd0d('0x19')])){utils[_0xcd0d('0xf')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x4528c2[_0xcd0d('0x4')],_0x4528c2['value']));dials[_0x4528c2[_0xcd0d('0x4')]]={'routeId':_0x4528c2['value']};}}catch(_0x4034a0){utils[_0xcd0d('0x1a')](util[_0xcd0d('0x2')](_0xcd0d('0x16'),_0x4528c2[_0xcd0d('0x4')]),_0x4034a0);}};exports[_0xcd0d('0x1b')]=function(_0x4cd6f0){try{if(!_['isNil'](dials[_0x4cd6f0[_0xcd0d('0x4')]])){utils[_0xcd0d('0xd')](util[_0xcd0d('0x2')]('[%s][dials][dialbegin]',_0x4cd6f0[_0xcd0d('0x4')]),_0x4cd6f0);dials[_0x4cd6f0[_0xcd0d('0x4')]]=_[_0xcd0d('0x1c')](dials[_0x4cd6f0[_0xcd0d('0x4')]],_0x4cd6f0);dials[_0x4cd6f0['uniqueid']][_0xcd0d('0x1d')]=utils[_0xcd0d('0x1e')]();dials[_0x4cd6f0[_0xcd0d('0x4')]][_0xcd0d('0x1f')]=_0xcd0d('0x20');utils[_0xcd0d('0xf')](util['format'](_0xcd0d('0x21'),_0x4cd6f0['uniqueid'],dials[_0x4cd6f0[_0xcd0d('0x4')]]['starttime']));}}catch(_0x3ac8ff){utils[_0xcd0d('0x1a')](util['format'](_0xcd0d('0x22'),_0x4cd6f0['uniqueid']),_0x3ac8ff);}};exports[_0xcd0d('0x23')]=function(_0x312612){try{if(!_[_0xcd0d('0x17')](dials[_0x312612['uniqueid']])){utils['debug'](util[_0xcd0d('0x2')](_0xcd0d('0x24'),_0x312612['uniqueid']),_0x312612);dials[_0x312612[_0xcd0d('0x4')]]['dialstatus']=_0x312612['dialstatus'];if(_0x312612['dialstatus']==_0xcd0d('0x25')){dials[_0x312612[_0xcd0d('0x4')]]=_['assign'](dials[_0x312612[_0xcd0d('0x4')]],_0x312612);dials[_0x312612['uniqueid']][_0xcd0d('0x26')]=utils['now']();dials[_0x312612[_0xcd0d('0x4')]][_0xcd0d('0x1f')]='connect';utils[_0xcd0d('0xf')](util[_0xcd0d('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x312612[_0xcd0d('0x4')],_0x312612['dialstatus'],dials[_0x312612[_0xcd0d('0x4')]][_0xcd0d('0x26')]));}else{utils['info'](util[_0xcd0d('0x2')](_0xcd0d('0x27'),_0x312612[_0xcd0d('0x4')],_0x312612[_0xcd0d('0x9')]));}}}catch(_0x3f7a12){utils[_0xcd0d('0x1a')](util[_0xcd0d('0x2')](_0xcd0d('0x24'),_0x312612[_0xcd0d('0x4')]),_0x3f7a12);}};exports['hangup']=function(_0x1e45bb){try{if(!_['isNil'](dials[_0x1e45bb[_0xcd0d('0x4')]])){utils['debug'](util[_0xcd0d('0x2')]('[%s][dials][hangup]',_0x1e45bb[_0xcd0d('0x4')]),_0x1e45bb);utils[_0xcd0d('0xf')](util[_0xcd0d('0x2')](_0xcd0d('0x28'),_0x1e45bb['uniqueid'],_0x1e45bb[_0xcd0d('0x7')],_0x1e45bb[_0xcd0d('0x29')],_0x1e45bb['cause-txt']));dials[_0x1e45bb[_0xcd0d('0x4')]]=_[_0xcd0d('0x1c')](dials[_0x1e45bb[_0xcd0d('0x4')]],{'endtime':utils[_0xcd0d('0x1e')](),'lastevent':_0xcd0d('0x2a')});dials[_0x1e45bb[_0xcd0d('0x4')]][_0xcd0d('0x2b')]=utils[_0xcd0d('0x2c')](dials[_0x1e45bb[_0xcd0d('0x4')]]['endtime'],dials[_0x1e45bb[_0xcd0d('0x4')]]['starttime']);dials[_0x1e45bb[_0xcd0d('0x4')]]['holdtime']=utils[_0xcd0d('0x2c')](dials[_0x1e45bb[_0xcd0d('0x4')]]['answertime']||dials[_0x1e45bb[_0xcd0d('0x4')]][_0xcd0d('0x2d')],dials[_0x1e45bb[_0xcd0d('0x4')]][_0xcd0d('0x1d')]);dials[_0x1e45bb['uniqueid']]['billableseconds']=dials[_0x1e45bb['uniqueid']]['answertime']?utils['diffTime'](dials[_0x1e45bb[_0xcd0d('0x4')]]['endtime'],dials[_0x1e45bb['uniqueid']][_0xcd0d('0x26')]):0x0;writeDB(dials[_0x1e45bb[_0xcd0d('0x4')]]);}}catch(_0x539d4f){utils[_0xcd0d('0x1a')](util[_0xcd0d('0x2')]('[%s][dials][hangup]',_0x1e45bb[_0xcd0d('0x4')]),_0x539d4f);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f71ee2e..f91edd4 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 _0x1b7a=['[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','username','password','xdr','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]'];(function(_0x3b6d58,_0xb29c70){var _0x64d7dc=function(_0x2ac5e4){while(--_0x2ac5e4){_0x3b6d58['push'](_0x3b6d58['shift']());}};_0x64d7dc(++_0xb29c70);}(_0x1b7a,0x143));var _0xa1b7=function(_0x12f53f,_0x53d681){_0x12f53f=_0x12f53f-0x0;var _0x3f45fe=_0x1b7a[_0x12f53f];return _0x3f45fe;};var AsteriskManager=require('asterisk-manager');var config=require(_0xa1b7('0x0'));var utils=require(_0xa1b7('0x1'));var util=require(_0xa1b7('0x2'));var ami=new AsteriskManager(config[_0xa1b7('0x3')][_0xa1b7('0x4')],config['asterisk']['ip'],config[_0xa1b7('0x3')][_0xa1b7('0x5')],config['asterisk'][_0xa1b7('0x6')],!![]);ami['keepConnected']();if(config[_0xa1b7('0x7')]&&config[_0xa1b7('0x7')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xa1b7('0x8'));var calls=require('./calls.controller');var queues=require(_0xa1b7('0x9'));var recordings=require(_0xa1b7('0xa'));var members=require(_0xa1b7('0xb'));var dials=require(_0xa1b7('0xc'));var transfers=require(_0xa1b7('0xd'));var core=require('./core.controller');ami['on'](_0xa1b7('0xe'),core[_0xa1b7('0xe')]);ami['on'](_0xa1b7('0xf'),core[_0xa1b7('0xf')]);ami['on'](_0xa1b7('0x10'),core[_0xa1b7('0x10')]);ami['on'](_0xa1b7('0x11'),core[_0xa1b7('0x11')]);ami['on'](_0xa1b7('0x12'),core[_0xa1b7('0x12')]);ami['on']('managerevent',core[_0xa1b7('0x13')]);ami['on']('devicestatechange',function(_0x1acc0c){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x16'),_0x1acc0c[_0xa1b7('0x17')]),_0x1acc0c);members['devicestatechange'](_0x1acc0c);}catch(_0x27750d){utils[_0xa1b7('0x11')](util['format']('[%s][index][devicestatechange]',_0x1acc0c[_0xa1b7('0x17')]),_0x27750d);}});ami['on'](_0xa1b7('0x18'),function(_0x226fdb){try{utils[_0xa1b7('0x14')](util['format'](_0xa1b7('0x19'),_0x226fdb[_0xa1b7('0x1a')]),_0x226fdb);agents[_0xa1b7('0x18')](_0x226fdb);}catch(_0x4fd3a5){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x19'),_0x226fdb['uniqueid']),_0x4fd3a5);}});ami['on'](_0xa1b7('0x1b'),function(_0x54c101){try{utils['debug'](util[_0xa1b7('0x15')]('[%s][index][agentringnoanswer]',_0x54c101[_0xa1b7('0x1a')]),_0x54c101);agents[_0xa1b7('0x1b')](_0x54c101);}catch(_0x289084){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x1c'),_0x54c101['uniqueid']),_0x289084);}});ami['on']('agentconnect',function(_0x45b81d){try{utils[_0xa1b7('0x14')](util['format']('[%s][index][agentconnect]',_0x45b81d[_0xa1b7('0x1a')]),_0x45b81d);agents['agentconnect'](_0x45b81d);queues[_0xa1b7('0x1d')](_0x45b81d);}catch(_0x14af55){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x1e'),_0x45b81d[_0xa1b7('0x1a')]),_0x14af55);}});ami['on'](_0xa1b7('0x1f'),function(_0x39908a){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x20'),_0x39908a['uniqueid']),_0x39908a);agents['agentcomplete'](_0x39908a);queues[_0xa1b7('0x1f')](_0x39908a);members[_0xa1b7('0x1f')](_0x39908a);}catch(_0x9acbdd){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x20'),_0x39908a['uniqueid']),_0x9acbdd);}});ami['on']('queuecallerabandon',function(_0x22722a){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x21'),_0x22722a[_0xa1b7('0x1a')]),_0x22722a);agents[_0xa1b7('0x22')](_0x22722a);queues[_0xa1b7('0x22')](_0x22722a);}catch(_0x2fa767){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x21'),_0x22722a[_0xa1b7('0x1a')]),_0x2fa767);}});ami['on'](_0xa1b7('0x23'),function(_0x7ee7d2){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')]('[%s][index][queuecallerjoin]',_0x7ee7d2[_0xa1b7('0x1a')]),_0x7ee7d2);queues[_0xa1b7('0x23')](_0x7ee7d2);recordings[_0xa1b7('0x23')](_0x7ee7d2);}catch(_0x3bfc82){utils['error'](util[_0xa1b7('0x15')](_0xa1b7('0x24'),_0x7ee7d2[_0xa1b7('0x1a')]),_0x3bfc82);}});ami['on'](_0xa1b7('0x25'),function(_0x4d749a){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x26'),_0x4d749a['uniqueid']),_0x4d749a);queues[_0xa1b7('0x25')](_0x4d749a);}catch(_0x481ba2){utils['error'](util[_0xa1b7('0x15')](_0xa1b7('0x26'),_0x4d749a[_0xa1b7('0x1a')]),_0x481ba2);}});ami['on'](_0xa1b7('0x27'),function(_0x578740){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x28'),_0x578740['uniqueid']),_0x578740);queues['musiconholdstart'](_0x578740);calls[_0xa1b7('0x27')](_0x578740);}catch(_0x25c4ac){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')]('[%s][index][musiconholdstart]',_0x578740[_0xa1b7('0x1a')]),_0x25c4ac);}});ami['on'](_0xa1b7('0x29'),function(_0x2c4417){try{utils['debug'](util[_0xa1b7('0x15')](_0xa1b7('0x2a'),_0x2c4417[_0xa1b7('0x1a')]),_0x2c4417);queues[_0xa1b7('0x29')](_0x2c4417);calls[_0xa1b7('0x29')](_0x2c4417);}catch(_0x47cd1a){utils['error'](util[_0xa1b7('0x15')](_0xa1b7('0x2a'),_0x2c4417[_0xa1b7('0x1a')]),_0x47cd1a);}});ami['on'](_0xa1b7('0x2b'),function(_0xb6b556){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x2c'),_0xb6b556[_0xa1b7('0x1a')]),_0xb6b556);calls[_0xa1b7('0x2b')](_0xb6b556);recordings[_0xa1b7('0x2b')](_0xb6b556);}catch(_0x53ceff){utils['error'](util[_0xa1b7('0x15')](_0xa1b7('0x2c'),_0xb6b556[_0xa1b7('0x1a')]),_0x53ceff);}});ami['on'](_0xa1b7('0x2d'),function(_0x51202f){try{utils['debug'](util[_0xa1b7('0x15')](_0xa1b7('0x2e'),_0x51202f[_0xa1b7('0x1a')]),_0x51202f);calls['hangup'](_0x51202f);recordings['hangup'](_0x51202f);dials[_0xa1b7('0x2d')](_0x51202f);agents[_0xa1b7('0x2d')](_0x51202f);queues[_0xa1b7('0x2d')](_0x51202f);}catch(_0x5df80a){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x2e'),_0x51202f['uniqueid']),_0x5df80a);}});ami['on']('cdr',function(_0x398d25){try{utils[_0xa1b7('0x14')](util['format']('[%s][index][cdr]',_0x398d25[_0xa1b7('0x1a')]),_0x398d25);members[_0xa1b7('0x2f')](_0x398d25);}catch(_0x2e7eed){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x30'),_0x398d25[_0xa1b7('0x1a')]),_0x2e7eed);}});ami['on'](_0xa1b7('0x31'),function(_0x2af38a){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x32'),_0x2af38a['uniqueid']),_0x2af38a);queues['blindtransfer'](_0x2af38a);agents['blindtransfer'](_0x2af38a);transfers['blindtransfer'](_0x2af38a);recordings[_0xa1b7('0x31')](_0x2af38a);}catch(_0x596b49){utils['error'](util[_0xa1b7('0x15')]('[%s][index][blindtransfer]',_0x2af38a[_0xa1b7('0x1a')]),_0x596b49);}});ami['on'](_0xa1b7('0x33'),function(_0x11144a){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x34'),_0x11144a[_0xa1b7('0x35')]),_0x11144a);queues[_0xa1b7('0x33')](_0x11144a);transfers[_0xa1b7('0x33')](_0x11144a);agents[_0xa1b7('0x33')](_0x11144a);calls['attendedtransfer'](_0x11144a);}catch(_0x3380c3){utils[_0xa1b7('0x11')](util['format']('[%s][index][attendedtransfer]',_0x11144a[_0xa1b7('0x35')]),_0x3380c3);}});ami['on'](_0xa1b7('0x36'),function(_0x58f04b){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x37'),_0x58f04b[_0xa1b7('0x1a')]),_0x58f04b);queues['varset'](_0x58f04b);recordings[_0xa1b7('0x36')](_0x58f04b);calls[_0xa1b7('0x36')](_0x58f04b);dials[_0xa1b7('0x36')](_0x58f04b);}catch(_0x3b0504){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')]('[%s][index][varset]',_0x58f04b[_0xa1b7('0x1a')]),_0x3b0504);}});ami['on'](_0xa1b7('0x38'),function(_0x55431e){try{utils[_0xa1b7('0x14')](util['format'](_0xa1b7('0x39'),_0x55431e[_0xa1b7('0x1a')]),_0x55431e);calls[_0xa1b7('0x38')](_0x55431e);recordings[_0xa1b7('0x38')](_0x55431e);dials[_0xa1b7('0x38')](_0x55431e);}catch(_0x59d3dd){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x39'),_0x55431e[_0xa1b7('0x1a')]),_0x59d3dd);}});ami['on'](_0xa1b7('0x3a'),function(_0x3f2a92){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')]('[%s][index][newchannel]',_0x3f2a92[_0xa1b7('0x1a')]),_0x3f2a92);calls[_0xa1b7('0x3a')](_0x3f2a92);recordings[_0xa1b7('0x3a')](_0x3f2a92);}catch(_0x1a7b05){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x3b'),_0x3f2a92[_0xa1b7('0x1a')]),_0x1a7b05);}});ami['on']('dialbegin',function(_0x12dc68){try{utils['debug'](util['format'](_0xa1b7('0x3c'),_0x12dc68[_0xa1b7('0x1a')]),_0x12dc68);dials['dialbegin'](_0x12dc68);}catch(_0x2b1ce0){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x3d'),_0x12dc68[_0xa1b7('0x1a')]),_0x2b1ce0);}});ami['on'](_0xa1b7('0x3e'),function(_0x2d2e95){try{utils[_0xa1b7('0x14')](util[_0xa1b7('0x15')](_0xa1b7('0x3f'),_0x2d2e95[_0xa1b7('0x1a')]),_0x2d2e95);dials[_0xa1b7('0x3e')](_0x2d2e95);}catch(_0x5429cb){utils[_0xa1b7('0x11')](util[_0xa1b7('0x15')](_0xa1b7('0x3f'),_0x2d2e95[_0xa1b7('0x1a')]),_0x5429cb);}});} \ No newline at end of file +var _0x128d=['cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.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]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x128d,0x1e6));var _0xd128=function(_0x529b4b,_0x25acf3){_0x529b4b=_0x529b4b-0x0;var _0x1fcab1=_0x128d[_0x529b4b];return _0x1fcab1;};var AsteriskManager=require(_0xd128('0x0'));var config=require(_0xd128('0x1'));var utils=require(_0xd128('0x2'));var util=require(_0xd128('0x3'));var ami=new AsteriskManager(config[_0xd128('0x4')]['port'],config[_0xd128('0x4')]['ip'],config['asterisk']['username'],config[_0xd128('0x4')]['password'],!![]);ami[_0xd128('0x5')]();if(config[_0xd128('0x6')]&&config[_0xd128('0x6')][_0xd128('0x7')]){utils[_0xd128('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0xd128('0x9'));var calls=require(_0xd128('0xa'));var queues=require(_0xd128('0xb'));var recordings=require(_0xd128('0xc'));var members=require(_0xd128('0xd'));var dials=require('./dials.controller');var transfers=require(_0xd128('0xe'));var core=require(_0xd128('0xf'));ami['on'](_0xd128('0x10'),core[_0xd128('0x10')]);ami['on'](_0xd128('0x11'),core['shutdown']);ami['on'](_0xd128('0x12'),core[_0xd128('0x12')]);ami['on']('error',core[_0xd128('0x13')]);ami['on'](_0xd128('0x14'),core[_0xd128('0x14')]);ami['on'](_0xd128('0x15'),core['managerevent']);ami['on'](_0xd128('0x16'),function(_0x2455d9){try{utils[_0xd128('0x17')](util['format'](_0xd128('0x18'),_0x2455d9[_0xd128('0x19')]),_0x2455d9);members[_0xd128('0x16')](_0x2455d9);}catch(_0x4a282f){utils[_0xd128('0x13')](util[_0xd128('0x1a')]('[%s][index][devicestatechange]',_0x2455d9['device']),_0x4a282f);}});ami['on'](_0xd128('0x1b'),function(_0x33f14a){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x1c'),_0x33f14a[_0xd128('0x1d')]),_0x33f14a);agents[_0xd128('0x1b')](_0x33f14a);}catch(_0x304047){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x1c'),_0x33f14a[_0xd128('0x1d')]),_0x304047);}});ami['on'](_0xd128('0x1e'),function(_0x212b96){try{utils[_0xd128('0x17')](util['format'](_0xd128('0x1f'),_0x212b96[_0xd128('0x1d')]),_0x212b96);agents[_0xd128('0x1e')](_0x212b96);}catch(_0x230f35){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x1f'),_0x212b96['uniqueid']),_0x230f35);}});ami['on'](_0xd128('0x20'),function(_0x263e41){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x21'),_0x263e41[_0xd128('0x1d')]),_0x263e41);agents[_0xd128('0x20')](_0x263e41);queues[_0xd128('0x20')](_0x263e41);}catch(_0x5d425f){utils[_0xd128('0x13')](util[_0xd128('0x1a')]('[%s][index][agentconnect]',_0x263e41[_0xd128('0x1d')]),_0x5d425f);}});ami['on'](_0xd128('0x22'),function(_0x1fbae8){try{utils['debug'](util[_0xd128('0x1a')]('[%s][index][agentcomplete]',_0x1fbae8[_0xd128('0x1d')]),_0x1fbae8);agents[_0xd128('0x22')](_0x1fbae8);queues[_0xd128('0x22')](_0x1fbae8);members[_0xd128('0x22')](_0x1fbae8);}catch(_0x120aae){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x23'),_0x1fbae8[_0xd128('0x1d')]),_0x120aae);}});ami['on'](_0xd128('0x24'),function(_0x491be7){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x25'),_0x491be7['uniqueid']),_0x491be7);agents[_0xd128('0x24')](_0x491be7);queues[_0xd128('0x24')](_0x491be7);}catch(_0x5d76b8){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x25'),_0x491be7['uniqueid']),_0x5d76b8);}});ami['on']('queuecallerjoin',function(_0x48c8e4){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')]('[%s][index][queuecallerjoin]',_0x48c8e4[_0xd128('0x1d')]),_0x48c8e4);queues['queuecallerjoin'](_0x48c8e4);recordings[_0xd128('0x26')](_0x48c8e4);}catch(_0x4c1ed2){utils['error'](util[_0xd128('0x1a')](_0xd128('0x27'),_0x48c8e4['uniqueid']),_0x4c1ed2);}});ami['on'](_0xd128('0x28'),function(_0x3e709d){try{utils['debug'](util[_0xd128('0x1a')](_0xd128('0x29'),_0x3e709d[_0xd128('0x1d')]),_0x3e709d);queues[_0xd128('0x28')](_0x3e709d);}catch(_0x4aa10b){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x29'),_0x3e709d['uniqueid']),_0x4aa10b);}});ami['on'](_0xd128('0x2a'),function(_0x4f4de5){try{utils[_0xd128('0x17')](util['format'](_0xd128('0x2b'),_0x4f4de5[_0xd128('0x1d')]),_0x4f4de5);queues[_0xd128('0x2a')](_0x4f4de5);calls[_0xd128('0x2a')](_0x4f4de5);}catch(_0x530adc){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x2b'),_0x4f4de5[_0xd128('0x1d')]),_0x530adc);}});ami['on']('musiconholdstop',function(_0x2fc5bc){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x2c'),_0x2fc5bc[_0xd128('0x1d')]),_0x2fc5bc);queues[_0xd128('0x2d')](_0x2fc5bc);calls[_0xd128('0x2d')](_0x2fc5bc);}catch(_0x58917c){utils['error'](util[_0xd128('0x1a')](_0xd128('0x2c'),_0x2fc5bc[_0xd128('0x1d')]),_0x58917c);}});ami['on'](_0xd128('0x2e'),function(_0x54a84d){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x2f'),_0x54a84d['uniqueid']),_0x54a84d);calls[_0xd128('0x2e')](_0x54a84d);recordings[_0xd128('0x2e')](_0x54a84d);}catch(_0x3b2088){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x2f'),_0x54a84d[_0xd128('0x1d')]),_0x3b2088);}});ami['on'](_0xd128('0x30'),function(_0x162615){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x31'),_0x162615[_0xd128('0x1d')]),_0x162615);calls[_0xd128('0x30')](_0x162615);recordings[_0xd128('0x30')](_0x162615);dials[_0xd128('0x30')](_0x162615);agents[_0xd128('0x30')](_0x162615);queues[_0xd128('0x30')](_0x162615);}catch(_0x10e4a9){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x31'),_0x162615[_0xd128('0x1d')]),_0x10e4a9);}});ami['on'](_0xd128('0x32'),function(_0x5b6e70){try{utils[_0xd128('0x17')](util['format'](_0xd128('0x33'),_0x5b6e70['uniqueid']),_0x5b6e70);members[_0xd128('0x32')](_0x5b6e70);}catch(_0x51b652){utils['error'](util[_0xd128('0x1a')](_0xd128('0x33'),_0x5b6e70['uniqueid']),_0x51b652);}});ami['on']('blindtransfer',function(_0x15cb94){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x34'),_0x15cb94[_0xd128('0x1d')]),_0x15cb94);queues['blindtransfer'](_0x15cb94);agents[_0xd128('0x35')](_0x15cb94);transfers[_0xd128('0x35')](_0x15cb94);recordings[_0xd128('0x35')](_0x15cb94);}catch(_0x376266){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x34'),_0x15cb94[_0xd128('0x1d')]),_0x376266);}});ami['on'](_0xd128('0x36'),function(_0x132882){try{utils['debug'](util[_0xd128('0x1a')](_0xd128('0x37'),_0x132882[_0xd128('0x38')]),_0x132882);queues[_0xd128('0x36')](_0x132882);transfers[_0xd128('0x36')](_0x132882);agents['attendedtransfer'](_0x132882);calls[_0xd128('0x36')](_0x132882);}catch(_0x7b757a){utils[_0xd128('0x13')](util[_0xd128('0x1a')]('[%s][index][attendedtransfer]',_0x132882[_0xd128('0x38')]),_0x7b757a);}});ami['on'](_0xd128('0x39'),function(_0x485368){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')]('[%s][index][varset]',_0x485368[_0xd128('0x1d')]),_0x485368);queues[_0xd128('0x39')](_0x485368);recordings[_0xd128('0x39')](_0x485368);calls[_0xd128('0x39')](_0x485368);dials[_0xd128('0x39')](_0x485368);}catch(_0x3e25d8){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x3a'),_0x485368[_0xd128('0x1d')]),_0x3e25d8);}});ami['on'](_0xd128('0x3b'),function(_0x275d15){try{utils[_0xd128('0x17')](util['format'](_0xd128('0x3c'),_0x275d15[_0xd128('0x1d')]),_0x275d15);calls[_0xd128('0x3b')](_0x275d15);recordings[_0xd128('0x3b')](_0x275d15);dials[_0xd128('0x3b')](_0x275d15);}catch(_0x2d1d3e){utils['error'](util[_0xd128('0x1a')]('[%s][index][newexten]',_0x275d15['uniqueid']),_0x2d1d3e);}});ami['on'](_0xd128('0x3d'),function(_0x1571e7){try{utils[_0xd128('0x17')](util['format'](_0xd128('0x3e'),_0x1571e7[_0xd128('0x1d')]),_0x1571e7);calls[_0xd128('0x3d')](_0x1571e7);recordings[_0xd128('0x3d')](_0x1571e7);}catch(_0x385812){utils[_0xd128('0x13')](util[_0xd128('0x1a')](_0xd128('0x3e'),_0x1571e7[_0xd128('0x1d')]),_0x385812);}});ami['on'](_0xd128('0x3f'),function(_0x109852){try{utils[_0xd128('0x17')](util['format'](_0xd128('0x40'),_0x109852[_0xd128('0x1d')]),_0x109852);dials[_0xd128('0x3f')](_0x109852);}catch(_0x23dd79){utils['error'](util[_0xd128('0x1a')]('[%s]dialbegin',_0x109852[_0xd128('0x1d')]),_0x23dd79);}});ami['on']('dialend',function(_0x2f1f13){try{utils[_0xd128('0x17')](util[_0xd128('0x1a')](_0xd128('0x41'),_0x2f1f13[_0xd128('0x1d')]),_0x2f1f13);dials[_0xd128('0x42')](_0x2f1f13);}catch(_0x23bceb){utils[_0xd128('0x13')](util['format'](_0xd128('0x41'),_0x2f1f13[_0xd128('0x1d')]),_0x23bceb);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 491f034..0e6dd9b 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 _0xe1a8=['data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','membername','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source'];(function(_0x5242ee,_0x4acbae){var _0x58ed48=function(_0x1333ec){while(--_0x1333ec){_0x5242ee['push'](_0x5242ee['shift']());}};_0x58ed48(++_0x4acbae);}(_0xe1a8,0x6f));var _0x8e1a=function(_0x36d22e,_0x6fc190){_0x36d22e=_0x36d22e-0x0;var _0x4fbd6a=_0xe1a8[_0x36d22e];return _0x4fbd6a;};'use strict';var _=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var utils=require(_0x8e1a('0x2'));var members={};var exclude=[_0x8e1a('0x3'),_0x8e1a('0x4')];function writeDB(_0x334ee3){utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x334ee3[_0x8e1a('0x7')],_0x334ee3['interface'],_0x334ee3[_0x8e1a('0x8')],_0x334ee3['data2'],_0x334ee3[_0x8e1a('0x9')],_0x334ee3['type']));if(_0x334ee3[_0x8e1a('0xa')]){utils[_0x8e1a('0xb')](_0x334ee3[_0x8e1a('0xa')])[_0x8e1a('0xc')](function(_0x1bda81){if(_0x1bda81){_0x334ee3[_0x8e1a('0x9')]=_0x1bda81['name'];_0x334ee3[_0x8e1a('0xd')]=_0x1bda81[_0x8e1a('0xd')];utils[_0x8e1a('0xe')](_0x8e1a('0xf'),_0x334ee3);}else{utils[_0x8e1a('0x10')](_0x334ee3['interface'][_0x8e1a('0x11')]('/')[0x1])[_0x8e1a('0xc')](function(_0x39efbb){if(_0x39efbb){_0x334ee3[_0x8e1a('0x9')]=_0x39efbb['name'];_0x334ee3[_0x8e1a('0xd')]=_0x39efbb[_0x8e1a('0xd')];utils['request']('CreateMemberReport',_0x334ee3);}});}})[_0x8e1a('0x12')](function(_0x2cf927){utils[_0x8e1a('0x13')](util[_0x8e1a('0x6')](_0x8e1a('0x14'),_0x334ee3[_0x8e1a('0x7')]),_0x2cf927);});}delete members[_0x334ee3[_0x8e1a('0xa')]];}function startsWith(_0x2df86d,_0x27b822){return _['some'](_0x2df86d,function(_0x2a6a5c){return _[_0x8e1a('0x15')](_0x27b822,_0x2a6a5c);});}exports[_0x8e1a('0x16')]=function(_0x34c777){try{utils[_0x8e1a('0x17')](util['format'](_0x8e1a('0x18'),members[_0x34c777[_0x8e1a('0x19')]]?members[_0x34c777['device']][_0x8e1a('0x7')]:_0x34c777[_0x8e1a('0x19')]),_0x34c777);utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x34c777['device']]?members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x7')]:_0x34c777['device'],_0x34c777[_0x8e1a('0x1a')],_0x34c777[_0x8e1a('0x19')]));switch(_0x34c777[_0x8e1a('0x1a')]){case _0x8e1a('0x1b'):case'BUSY':if(!startsWith(exclude,_0x34c777[_0x8e1a('0x19')])){members[_0x34c777[_0x8e1a('0x19')]]={'channel':_0x8e1a('0x1c'),'interface':_0x34c777['device'],'type':_0x8e1a('0x1d'),'enterAt':utils[_0x8e1a('0x1e')](),'role':_0x8e1a('0x1f')};}break;case _0x8e1a('0x20'):if(!_['isNil'](members[_0x34c777[_0x8e1a('0x19')]])){members[_0x34c777[_0x8e1a('0x19')]]['exitAt']=utils['now']();members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x21')]=utils[_0x8e1a('0x22')](members[_0x34c777['device']][_0x8e1a('0x23')],members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x24')]);if(members[_0x34c777[_0x8e1a('0x19')]][_0x8e1a('0x7')]){writeDB(members[_0x34c777[_0x8e1a('0x19')]]);}}break;default:break;}}catch(_0x4b501d){utils[_0x8e1a('0x13')](util[_0x8e1a('0x6')](_0x8e1a('0x18'),members[_0x34c777['device']]?members[_0x34c777[_0x8e1a('0x19')]]['uniqueid']:_0x34c777[_0x8e1a('0x19')]),_0x4b501d);}};exports[_0x8e1a('0x25')]=function(_0x5d104c){try{if(!_[_0x8e1a('0x26')](members[_0x5d104c[_0x8e1a('0xa')]])){utils[_0x8e1a('0x17')](util[_0x8e1a('0x6')](_0x8e1a('0x27'),_0x5d104c[_0x8e1a('0x7')]),_0x5d104c);utils[_0x8e1a('0x5')](util['format'](_0x8e1a('0x28'),_0x5d104c['uniqueid'],_0x5d104c[_0x8e1a('0xa')],_0x5d104c[_0x8e1a('0x29')]));members[_0x5d104c[_0x8e1a('0xa')]]=_[_0x8e1a('0x2a')](members[_0x5d104c[_0x8e1a('0xa')]],{'data4':_0x5d104c[_0x8e1a('0x29')],'uniqueid':_0x5d104c[_0x8e1a('0x7')]});}}catch(_0x980070){utils[_0x8e1a('0x13')](util[_0x8e1a('0x6')](_0x8e1a('0x27'),_0x5d104c['uniqueid']),_0x980070);}};exports[_0x8e1a('0x2b')]=function(_0x49a6c3){try{utils['debug'](util[_0x8e1a('0x6')](_0x8e1a('0x2c'),_0x49a6c3[_0x8e1a('0x7')]),_0x49a6c3);if(_0x49a6c3[_0x8e1a('0x8')]){var _0x42d22a=_0x49a6c3[_0x8e1a('0x8')][_0x8e1a('0x11')]('-')[0x0];if(!_[_0x8e1a('0x26')](members[_0x42d22a])){members[_0x42d22a]=_[_0x8e1a('0x2a')](members[_0x42d22a],{'data1':members[_0x42d22a][_0x8e1a('0x2d')]||_0x49a6c3['type'],'data2':members[_0x42d22a][_0x8e1a('0x2e')]||_0x49a6c3[_0x8e1a('0x2f')],'data3':members[_0x42d22a][_0x8e1a('0x30')]||_0x49a6c3[_0x8e1a('0x31')],'uniqueid':members[_0x42d22a]['uniqueid']||_0x49a6c3[_0x8e1a('0x7')]});utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')](_0x8e1a('0x32'),_0x49a6c3['uniqueid'],members[_0x42d22a][_0x8e1a('0x2d')],members[_0x42d22a][_0x8e1a('0x2e')],members[_0x42d22a]['data3']));if(members[_0x42d22a][_0x8e1a('0x23')]){writeDB(members[_0x42d22a]);}}}if(_0x49a6c3[_0x8e1a('0x33')]){var _0x4f241f=_0x49a6c3[_0x8e1a('0x33')]['split']('-')[0x0];if(!_[_0x8e1a('0x26')](members[_0x4f241f])){members[_0x4f241f]=_[_0x8e1a('0x2a')](members[_0x4f241f],{'data1':members[_0x4f241f][_0x8e1a('0x2d')]||_0x49a6c3[_0x8e1a('0x34')],'data2':members[_0x4f241f][_0x8e1a('0x2e')]||_0x49a6c3[_0x8e1a('0x2f')],'data3':members[_0x4f241f][_0x8e1a('0x30')]||_0x49a6c3[_0x8e1a('0x31')],'uniqueid':members[_0x4f241f][_0x8e1a('0x7')]||_0x49a6c3[_0x8e1a('0x7')]});utils[_0x8e1a('0x5')](util[_0x8e1a('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x49a6c3['uniqueid'],members[_0x4f241f][_0x8e1a('0x2d')],members[_0x4f241f][_0x8e1a('0x2e')],members[_0x4f241f][_0x8e1a('0x30')]));if(members[_0x4f241f][_0x8e1a('0x23')]){writeDB(members[_0x4f241f]);}}}}catch(_0x58ded5){utils[_0x8e1a('0x13')](util['format'](_0x8e1a('0x2c'),_0x49a6c3[_0x8e1a('0x7')]),_0x58ded5);}}; \ No newline at end of file +var _0xba47=['CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data2','lodash','util','./utils','Queue:','info','format','uniqueid','interface','membername','type','getUserByInterface','then','internal'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xba47,0x1ac));var _0x7ba4=function(_0x49de26,_0x11730b){_0x49de26=_0x49de26-0x0;var _0x5b203d=_0xba47[_0x49de26];return _0x5b203d;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var utils=require(_0x7ba4('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x7ba4('0x3')];function writeDB(_0xe54d37){utils[_0x7ba4('0x4')](util[_0x7ba4('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0xe54d37[_0x7ba4('0x6')],_0xe54d37[_0x7ba4('0x7')],_0xe54d37['channel'],_0xe54d37['data2'],_0xe54d37[_0x7ba4('0x8')],_0xe54d37[_0x7ba4('0x9')]));if(_0xe54d37[_0x7ba4('0x7')]){utils[_0x7ba4('0xa')](_0xe54d37[_0x7ba4('0x7')])[_0x7ba4('0xb')](function(_0xa58ac3){if(_0xa58ac3){_0xe54d37[_0x7ba4('0x8')]=_0xa58ac3['name'];_0xe54d37['internal']=_0xa58ac3[_0x7ba4('0xc')];utils['request'](_0x7ba4('0xd'),_0xe54d37);}else{utils[_0x7ba4('0xe')](_0xe54d37[_0x7ba4('0x7')][_0x7ba4('0xf')]('/')[0x1])['then'](function(_0x143384){if(_0x143384){_0xe54d37[_0x7ba4('0x8')]=_0x143384['name'];_0xe54d37[_0x7ba4('0xc')]=_0x143384[_0x7ba4('0xc')];utils[_0x7ba4('0x10')]('CreateMemberReport',_0xe54d37);}});}})[_0x7ba4('0x11')](function(_0x2a9dcb){utils[_0x7ba4('0x12')](util[_0x7ba4('0x5')](_0x7ba4('0x13'),_0xe54d37[_0x7ba4('0x6')]),_0x2a9dcb);});}delete members[_0xe54d37[_0x7ba4('0x7')]];}function startsWith(_0x1e16c5,_0x3197d9){return _['some'](_0x1e16c5,function(_0x4b0fb7){return _[_0x7ba4('0x14')](_0x3197d9,_0x4b0fb7);});}exports[_0x7ba4('0x15')]=function(_0x53c7b2){try{utils[_0x7ba4('0x16')](util[_0x7ba4('0x5')](_0x7ba4('0x17'),members[_0x53c7b2[_0x7ba4('0x18')]]?members[_0x53c7b2[_0x7ba4('0x18')]][_0x7ba4('0x6')]:_0x53c7b2[_0x7ba4('0x18')]),_0x53c7b2);utils[_0x7ba4('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x53c7b2[_0x7ba4('0x18')]]?members[_0x53c7b2[_0x7ba4('0x18')]]['uniqueid']:_0x53c7b2[_0x7ba4('0x18')],_0x53c7b2[_0x7ba4('0x19')],_0x53c7b2[_0x7ba4('0x18')]));switch(_0x53c7b2['state']){case'INUSE':case _0x7ba4('0x1a'):if(!startsWith(exclude,_0x53c7b2['device'])){members[_0x53c7b2['device']]={'channel':_0x7ba4('0x1b'),'interface':_0x53c7b2['device'],'type':'TALKING','enterAt':utils[_0x7ba4('0x1c')](),'role':_0x7ba4('0x1d')};}break;case _0x7ba4('0x1e'):if(!_[_0x7ba4('0x1f')](members[_0x53c7b2[_0x7ba4('0x18')]])){members[_0x53c7b2[_0x7ba4('0x18')]][_0x7ba4('0x20')]=utils['now']();members[_0x53c7b2[_0x7ba4('0x18')]][_0x7ba4('0x21')]=utils[_0x7ba4('0x22')](members[_0x53c7b2[_0x7ba4('0x18')]][_0x7ba4('0x20')],members[_0x53c7b2[_0x7ba4('0x18')]]['enterAt']);if(members[_0x53c7b2[_0x7ba4('0x18')]]['uniqueid']){writeDB(members[_0x53c7b2['device']]);}}break;default:break;}}catch(_0x5ae08d){utils[_0x7ba4('0x12')](util[_0x7ba4('0x5')](_0x7ba4('0x17'),members[_0x53c7b2[_0x7ba4('0x18')]]?members[_0x53c7b2[_0x7ba4('0x18')]]['uniqueid']:_0x53c7b2[_0x7ba4('0x18')]),_0x5ae08d);}};exports[_0x7ba4('0x23')]=function(_0xfb47a5){try{if(!_[_0x7ba4('0x1f')](members[_0xfb47a5[_0x7ba4('0x7')]])){utils[_0x7ba4('0x16')](util['format']('[%s][members][agentcomplete]',_0xfb47a5[_0x7ba4('0x6')]),_0xfb47a5);utils[_0x7ba4('0x4')](util[_0x7ba4('0x5')](_0x7ba4('0x24'),_0xfb47a5[_0x7ba4('0x6')],_0xfb47a5[_0x7ba4('0x7')],_0xfb47a5[_0x7ba4('0x25')]));members[_0xfb47a5[_0x7ba4('0x7')]]=_[_0x7ba4('0x26')](members[_0xfb47a5[_0x7ba4('0x7')]],{'data4':_0xfb47a5['queue'],'uniqueid':_0xfb47a5[_0x7ba4('0x6')]});}}catch(_0x955b65){utils['error'](util[_0x7ba4('0x5')](_0x7ba4('0x27'),_0xfb47a5['uniqueid']),_0x955b65);}};exports[_0x7ba4('0x28')]=function(_0x39688b){try{utils['debug'](util[_0x7ba4('0x5')]('[%s][members][cdr]',_0x39688b['uniqueid']),_0x39688b);if(_0x39688b[_0x7ba4('0x29')]){var _0x54db63=_0x39688b[_0x7ba4('0x29')][_0x7ba4('0xf')]('-')[0x0];if(!_[_0x7ba4('0x1f')](members[_0x54db63])){members[_0x54db63]=_[_0x7ba4('0x26')](members[_0x54db63],{'data1':members[_0x54db63][_0x7ba4('0x2a')]||_0x39688b[_0x7ba4('0x9')],'data2':members[_0x54db63]['data2']||_0x39688b[_0x7ba4('0x2b')],'data3':members[_0x54db63][_0x7ba4('0x2c')]||_0x39688b[_0x7ba4('0x2d')],'uniqueid':members[_0x54db63][_0x7ba4('0x6')]||_0x39688b['uniqueid']});utils[_0x7ba4('0x4')](util[_0x7ba4('0x5')](_0x7ba4('0x2e'),_0x39688b[_0x7ba4('0x6')],members[_0x54db63][_0x7ba4('0x2a')],members[_0x54db63]['data2'],members[_0x54db63][_0x7ba4('0x2c')]));if(members[_0x54db63][_0x7ba4('0x20')]){writeDB(members[_0x54db63]);}}}if(_0x39688b[_0x7ba4('0x2f')]){var _0x50c681=_0x39688b[_0x7ba4('0x2f')][_0x7ba4('0xf')]('-')[0x0];if(!_[_0x7ba4('0x1f')](members[_0x50c681])){members[_0x50c681]=_['assign'](members[_0x50c681],{'data1':members[_0x50c681][_0x7ba4('0x2a')]||_0x39688b['type'],'data2':members[_0x50c681][_0x7ba4('0x30')]||_0x39688b['source'],'data3':members[_0x50c681][_0x7ba4('0x2c')]||_0x39688b[_0x7ba4('0x2d')],'uniqueid':members[_0x50c681][_0x7ba4('0x6')]||_0x39688b[_0x7ba4('0x6')]});utils[_0x7ba4('0x4')](util[_0x7ba4('0x5')](_0x7ba4('0x2e'),_0x39688b[_0x7ba4('0x6')],members[_0x50c681][_0x7ba4('0x2a')],members[_0x50c681][_0x7ba4('0x30')],members[_0x50c681]['data3']));if(members[_0x50c681]['exitAt']){writeDB(members[_0x50c681]);}}}}catch(_0x482b81){utils[_0x7ba4('0x12')](util[_0x7ba4('0x5')]('[%s][members][cdr]',_0x39688b[_0x7ba4('0x6')]),_0x482b81);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7cc935a..435acc4 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 _0xe12f=['musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','mohtime','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','uniqueid','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','agentcomplete','membername','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xe12f,0xd8));var _0xfe12=function(_0x25d3c1,_0x1d8eec){_0x25d3c1=_0x25d3c1-0x0;var _0xe28f30=_0xe12f[_0x25d3c1];return _0xe28f30;};'use strict';var _=require(_0xfe12('0x0'));var util=require('util');var utils=require(_0xfe12('0x1'));var queues={};function writeDB(_0x4631db){utils['info'](util[_0xfe12('0x2')](_0xfe12('0x3'),_0x4631db['uniqueid'],_0x4631db[_0xfe12('0x4')],_0x4631db[_0xfe12('0x5')],_0x4631db[_0xfe12('0x6')],_0x4631db[_0xfe12('0x7')],_0x4631db[_0xfe12('0x8')],_0x4631db[_0xfe12('0x9')]));if(_0x4631db[_0xfe12('0x5')]){utils[_0xfe12('0xa')](_0x4631db[_0xfe12('0x5')])[_0xfe12('0xb')](function(_0x1a4ce0){if(_0x1a4ce0){_0x4631db[_0xfe12('0xc')]=_0x1a4ce0[_0xfe12('0xc')];}utils[_0xfe12('0xd')]('CreateVoiceQueueReport',_0x4631db);});}else{utils['request'](_0xfe12('0xe'),_0x4631db);}if(_0x4631db[_0xfe12('0xf')]){delete queues[_0x4631db['transfereduniqueid']];}else{delete queues[_0x4631db['uniqueid']];}}exports['queuecallerjoin']=function(_0x2417b1){try{utils[_0xfe12('0x10')](util[_0xfe12('0x2')](_0xfe12('0x11'),_0x2417b1['uniqueid']),_0x2417b1);utils[_0xfe12('0x12')](util[_0xfe12('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x2417b1[_0xfe12('0x13')],_0x2417b1[_0xfe12('0x5')],_0x2417b1['position']));queues[_0x2417b1[_0xfe12('0x13')]]=_[_0xfe12('0x14')](_0x2417b1,{'originalposition':_0x2417b1[_0xfe12('0x15')],'queuecallerjoinAt':utils[_0xfe12('0x16')](),'mohtime':0x0});}catch(_0x4de22e){utils[_0xfe12('0x17')](util['format'](_0xfe12('0x11'),_0x2417b1[_0xfe12('0x13')]),_0x4de22e);}};exports[_0xfe12('0x18')]=function(_0x4534be){try{if(!_[_0xfe12('0x19')](queues[_0x4534be['uniqueid']])){utils[_0xfe12('0x10')](util[_0xfe12('0x2')](_0xfe12('0x1a'),_0x4534be[_0xfe12('0x13')]),_0x4534be);if(queues[_0x4534be[_0xfe12('0x13')]]['queuecallerleaveAt']){if(!queues[_0x4534be[_0xfe12('0x13')]][_0xfe12('0x1b')]&&!queues[_0x4534be['uniqueid']][_0xfe12('0x1c')]){queues[_0x4534be[_0xfe12('0x13')]][_0xfe12('0x1d')]=!![];queues[_0x4534be[_0xfe12('0x13')]][_0xfe12('0x1e')]=utils[_0xfe12('0x16')]();queues[_0x4534be['uniqueid']][_0xfe12('0x9')]=_0xfe12('0x1f');}utils[_0xfe12('0x12')](util['format'](_0xfe12('0x20'),_0x4534be['uniqueid'],queues[_0x4534be['uniqueid']]['name'],queues[_0x4534be[_0xfe12('0x13')]][_0xfe12('0x9')]));writeDB(queues[_0x4534be[_0xfe12('0x13')]]);}else if(queues[_0x4534be['uniqueid']][_0xfe12('0xf')]){utils['info'](util[_0xfe12('0x2')](_0xfe12('0x21'),_0x4534be[_0xfe12('0x13')],queues[_0x4534be[_0xfe12('0x13')]][_0xfe12('0x22')],queues[_0x4534be['uniqueid']][_0xfe12('0xf')]));queues[queues[_0x4534be[_0xfe12('0x13')]][_0xfe12('0xf')]]=queues[_0x4534be[_0xfe12('0x13')]];queues[queues[_0x4534be['uniqueid']]['transfereduniqueid']][_0xfe12('0x23')]=0x2;delete queues[_0x4534be[_0xfe12('0x13')]];}}}catch(_0x2522ab){utils['error'](util[_0xfe12('0x2')]('[%s][queues][hangup]',_0x4534be[_0xfe12('0x13')]),_0x2522ab);}};exports[_0xfe12('0x24')]=function(_0x2b8ff8){try{utils[_0xfe12('0x10')](util['format']('[%s][queues][varset]',_0x2b8ff8[_0xfe12('0x13')]),_0x2b8ff8);if(!_['isNil'](_0x2b8ff8['variable']['queuestatus'])&&_0x2b8ff8[_0xfe12('0x25')][_0xfe12('0x26')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x2b8ff8[_0xfe12('0x13')]])){queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x1b')]=![];queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x27')]=null;queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x1c')]=!![];queues[_0x2b8ff8['uniqueid']][_0xfe12('0x28')]=utils[_0xfe12('0x16')]();queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x9')]=_0x2b8ff8[_0xfe12('0x25')][_0xfe12('0x26')]();utils[_0xfe12('0x12')](util[_0xfe12('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2b8ff8[_0xfe12('0x13')],queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x22')],_0x2b8ff8[_0xfe12('0x25')],queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x9')]));writeDB(queues[_0x2b8ff8[_0xfe12('0x13')]]);}}else if(!_['isNil'](_0x2b8ff8[_0xfe12('0x29')][_0xfe12('0x2a')])){if(!_[_0xfe12('0x19')](queues[_0x2b8ff8[_0xfe12('0x13')]])&&!queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x1b')]){queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x1b')]=![];queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x27')]=null;queues[_0x2b8ff8[_0xfe12('0x13')]]['queuecallerexit']=!![];queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x28')]=utils[_0xfe12('0x16')]();queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x9')]='EXITWITHKEY';utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x2b'),_0x2b8ff8[_0xfe12('0x13')],queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x22')],_0x2b8ff8[_0xfe12('0x25')],queues[_0x2b8ff8[_0xfe12('0x13')]][_0xfe12('0x9')]));}}}catch(_0x447ff0){utils[_0xfe12('0x17')](util[_0xfe12('0x2')](_0xfe12('0x2c'),_0x2b8ff8[_0xfe12('0x13')]),_0x447ff0);}};exports[_0xfe12('0x1b')]=function(_0x5ab000){try{if(!_['isNil'](queues[_0x5ab000[_0xfe12('0x13')]])){utils[_0xfe12('0x10')](util[_0xfe12('0x2')]('[%s][queues][queuecallerabandon]',_0x5ab000[_0xfe12('0x13')]),_0x5ab000);queues[_0x5ab000['uniqueid']][_0xfe12('0x1c')]=![];queues[_0x5ab000[_0xfe12('0x13')]]['queuecallerexitAt']=null;queues[_0x5ab000[_0xfe12('0x13')]][_0xfe12('0x1b')]=!![];queues[_0x5ab000[_0xfe12('0x13')]][_0xfe12('0x27')]=utils[_0xfe12('0x16')]();queues[_0x5ab000['uniqueid']][_0xfe12('0x9')]=_0xfe12('0x2d');utils[_0xfe12('0x12')](util['format'](_0xfe12('0x2e'),_0x5ab000['uniqueid'],queues[_0x5ab000[_0xfe12('0x13')]][_0xfe12('0x22')],queues[_0x5ab000[_0xfe12('0x13')]][_0xfe12('0x9')]));}}catch(_0x3851b3){utils[_0xfe12('0x17')](util[_0xfe12('0x2')](_0xfe12('0x2f'),_0x5ab000[_0xfe12('0x13')]),_0x3851b3);}};exports[_0xfe12('0x30')]=function(_0x4b1863){try{if(!_[_0xfe12('0x19')](queues[_0x4b1863[_0xfe12('0x13')]])){utils['debug'](util[_0xfe12('0x2')](_0xfe12('0x31'),_0x4b1863['uniqueid']),_0x4b1863);utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x32'),_0x4b1863[_0xfe12('0x13')],queues[_0x4b1863[_0xfe12('0x13')]][_0xfe12('0x22')],_0x4b1863['connectedlinenum'],_0x4b1863['connectedlinename']));queues[_0x4b1863[_0xfe12('0x13')]][_0xfe12('0x30')]=!![];queues[_0x4b1863[_0xfe12('0x13')]][_0xfe12('0x33')]=utils[_0xfe12('0x16')]();queues[_0x4b1863[_0xfe12('0x13')]][_0xfe12('0x34')]=utils['diffTime'](queues[_0x4b1863[_0xfe12('0x13')]][_0xfe12('0x33')],queues[_0x4b1863['uniqueid']][_0xfe12('0x35')]);queues[_0x4b1863['uniqueid']][_0xfe12('0x15')]=_0x4b1863['position'];queues[_0x4b1863[_0xfe12('0x13')]]['count']=_0x4b1863[_0xfe12('0x36')];queues[_0x4b1863['uniqueid']][_0xfe12('0x37')]=_0x4b1863[_0xfe12('0x37')];queues[_0x4b1863[_0xfe12('0x13')]][_0xfe12('0x38')]=_0x4b1863[_0xfe12('0x38')];}}catch(_0x30c5b9){utils['error'](util['format'](_0xfe12('0x31'),_0x4b1863['uniqueid']),_0x30c5b9);}};exports['agentconnect']=function(_0x2a9e0f){try{if(!_[_0xfe12('0x19')](queues[_0x2a9e0f['uniqueid']])){utils[_0xfe12('0x10')](util[_0xfe12('0x2')](_0xfe12('0x39'),_0x2a9e0f[_0xfe12('0x13')]),_0x2a9e0f);utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x3a'),_0x2a9e0f['uniqueid'],queues[_0x2a9e0f[_0xfe12('0x13')]]['name'],_0x2a9e0f['membername'],_0x2a9e0f[_0xfe12('0x3b')]));queues[_0x2a9e0f['uniqueid']][_0xfe12('0x1b')]=![];queues[_0x2a9e0f[_0xfe12('0x13')]][_0xfe12('0x1b')]=![];queues[_0x2a9e0f[_0xfe12('0x13')]][_0xfe12('0x27')]=null;queues[_0x2a9e0f['uniqueid']][_0xfe12('0x1c')]=![];queues[_0x2a9e0f[_0xfe12('0x13')]]['queuecallerexitreason']=null;queues[_0x2a9e0f[_0xfe12('0x13')]]['queuecallerexitAt']=null;queues[_0x2a9e0f['uniqueid']][_0xfe12('0x3c')]=!![];queues[_0x2a9e0f[_0xfe12('0x13')]][_0xfe12('0x8')]=_0x2a9e0f[_0xfe12('0x3b')];queues[_0x2a9e0f[_0xfe12('0x13')]][_0xfe12('0x6')]=_0x2a9e0f['membername'];}}catch(_0x52d555){utils[_0xfe12('0x17')](util[_0xfe12('0x2')](_0xfe12('0x39'),_0x2a9e0f[_0xfe12('0x13')]),_0x52d555);}};exports[_0xfe12('0x3d')]=function(_0x5d6da3){try{if(!_[_0xfe12('0x19')](queues[_0x5d6da3[_0xfe12('0x13')]])){if(queues[_0x5d6da3[_0xfe12('0x13')]][_0xfe12('0x33')]){utils[_0xfe12('0x10')](util[_0xfe12('0x2')]('[%s][queues][agentcomplete]',_0x5d6da3['uniqueid']),_0x5d6da3);queues[_0x5d6da3[_0xfe12('0x13')]]['queuecallerabandon']=![];queues[_0x5d6da3['uniqueid']]['queuecallerabandon']=![];queues[_0x5d6da3[_0xfe12('0x13')]][_0xfe12('0x27')]=null;queues[_0x5d6da3[_0xfe12('0x13')]]['queuecallerexit']=![];queues[_0x5d6da3['uniqueid']]['queuecallerexitAt']=null;queues[_0x5d6da3[_0xfe12('0x13')]][_0xfe12('0x3c')]=!![];queues[_0x5d6da3[_0xfe12('0x13')]][_0xfe12('0x6')]=_0x5d6da3[_0xfe12('0x3e')];queues[_0x5d6da3[_0xfe12('0x13')]]['queuecallercomplete']=!![];queues[_0x5d6da3[_0xfe12('0x13')]][_0xfe12('0x1e')]=utils[_0xfe12('0x16')]();if(_0x5d6da3[_0xfe12('0x3f')]==_0xfe12('0x40')){if(!queues[_0x5d6da3[_0xfe12('0x13')]][_0xfe12('0x40')]){queues[_0x5d6da3['uniqueid']][_0xfe12('0x9')]=_0xfe12('0x41');}}else{queues[_0x5d6da3['uniqueid']][_0xfe12('0x9')]=_0xfe12('0x42')+_0x5d6da3['reason'][_0xfe12('0x26')]();}utils[_0xfe12('0x12')](util['format'](_0xfe12('0x43'),_0x5d6da3[_0xfe12('0x13')],queues[_0x5d6da3['uniqueid']][_0xfe12('0x22')],_0x5d6da3['membername'],queues[_0x5d6da3[_0xfe12('0x13')]][_0xfe12('0x9')]));writeDB(queues[_0x5d6da3[_0xfe12('0x13')]]);}}}catch(_0x2e246b){utils[_0xfe12('0x17')](util[_0xfe12('0x2')]('[%s][queues][agentcomplete]',_0x5d6da3['uniqueid']),_0x2e246b);}};exports[_0xfe12('0x44')]=function(_0x3fe948){try{if(!_[_0xfe12('0x19')](queues[_0x3fe948[_0xfe12('0x45')]])){utils[_0xfe12('0x10')](util['format'](_0xfe12('0x46'),_0x3fe948[_0xfe12('0x13')]),_0x3fe948);queues[_0x3fe948[_0xfe12('0x45')]]['transfer']=!![];queues[_0x3fe948[_0xfe12('0x45')]][_0xfe12('0x47')]=_0xfe12('0x48');queues[_0x3fe948['transfereeuniqueid']][_0xfe12('0x49')]=_0x3fe948[_0xfe12('0x4a')];queues[_0x3fe948[_0xfe12('0x45')]]['transferuniqueid']=_0x3fe948[_0xfe12('0x45')];queues[_0x3fe948[_0xfe12('0x45')]][_0xfe12('0x9')]=_0xfe12('0x4b');utils[_0xfe12('0x12')](util[_0xfe12('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3fe948[_0xfe12('0x13')],queues[_0x3fe948['transfereeuniqueid']][_0xfe12('0x22')],_0x3fe948[_0xfe12('0x45')],_0x3fe948[_0xfe12('0x4a')]));}}catch(_0x3e904f){utils['error'](util[_0xfe12('0x2')]('[%s][queues][blindtransfer]',_0x3fe948[_0xfe12('0x13')]),_0x3e904f);}};exports[_0xfe12('0x4c')]=function(_0x23935d){try{utils['debug'](util['format'](_0xfe12('0x4d'),_0x23935d[_0xfe12('0x4e')]),_0x23935d);if(_0x23935d[_0xfe12('0x4e')]==_0x23935d['origtransfererlinkedid']){if(!_[_0xfe12('0x19')](queues[_0x23935d[_0xfe12('0x4f')]])){utils[_0xfe12('0x12')](util['format'](_0xfe12('0x50'),_0x23935d[_0xfe12('0x4e')],queues[_0x23935d[_0xfe12('0x4f')]][_0xfe12('0x22')],_0x23935d[_0xfe12('0x51')]));queues[_0x23935d[_0xfe12('0x4f')]][_0xfe12('0x40')]=!![];queues[_0x23935d[_0xfe12('0x4f')]][_0xfe12('0x47')]=_0xfe12('0x52');queues[_0x23935d['secondtransfererlinkedid']][_0xfe12('0x49')]=_0x23935d[_0xfe12('0x51')];queues[_0x23935d[_0xfe12('0x4f')]][_0xfe12('0x53')]=_0x23935d[_0xfe12('0x4e')];queues[_0x23935d['secondtransfererlinkedid']][_0xfe12('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x23935d[_0xfe12('0x54')]])){if(_0x23935d[_0xfe12('0x55')]&&queues[_0x23935d[_0xfe12('0x55')]]){queues[_0x23935d[_0xfe12('0x55')]][_0xfe12('0x23')]=0x1;queues[_0x23935d['transfereeuniqueid']]=_[_0xfe12('0x56')](queues[_0x23935d[_0xfe12('0x55')]]);queues[_0x23935d[_0xfe12('0x45')]][_0xfe12('0xf')]=_0x23935d[_0xfe12('0x57')];queues[_0x23935d[_0xfe12('0x45')]]['queuecallerenterreason']=0x2;queues[_0x23935d['transfereeuniqueid']][_0xfe12('0x7')]=queues[_0x23935d[_0xfe12('0x4f')]]['calleridnum'];queues[_0x23935d['transfereeuniqueid']][_0xfe12('0x58')]=queues[_0x23935d[_0xfe12('0x4f')]][_0xfe12('0x58')];queues[_0x23935d[_0xfe12('0x45')]]['queuecallerjoinAt']=utils[_0xfe12('0x16')]();queues[_0x23935d[_0xfe12('0x45')]]['queuecallerleaveAt']=utils[_0xfe12('0x16')]();queues[_0x23935d[_0xfe12('0x45')]]['holdtime']=0x0;queues[_0x23935d['transfereeuniqueid']]['mohtime']=0x0;utils[_0xfe12('0x12')](util[_0xfe12('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x23935d[_0xfe12('0x4e')],queues[_0x23935d[_0xfe12('0x45')]][_0xfe12('0x22')],queues[_0x23935d['transfereeuniqueid']][_0xfe12('0x7')],queues[_0x23935d[_0xfe12('0x45')]][_0xfe12('0x58')]));}else{utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x59'),_0x23935d[_0xfe12('0x4e')],queues[_0x23935d[_0xfe12('0x54')]][_0xfe12('0x22')],_0x23935d['secondtransfererlinkedid']));queues[_0x23935d[_0xfe12('0x54')]][_0xfe12('0xf')]=_0x23935d['secondtransfererlinkedid'];}}}else if(_0x23935d[_0xfe12('0x5a')]==_0x23935d[_0xfe12('0x4f')]){if(!_[_0xfe12('0x19')](queues[_0x23935d[_0xfe12('0x54')]])){utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x5b'),_0x23935d[_0xfe12('0x4e')],queues[_0x23935d[_0xfe12('0x54')]][_0xfe12('0x22')],_0x23935d['secondtransfereruniqueid'],_0x23935d['secondtransfererexten']));queues[_0x23935d[_0xfe12('0x54')]][_0xfe12('0x40')]=!![];queues[_0x23935d[_0xfe12('0x54')]][_0xfe12('0x47')]=_0xfe12('0x52');queues[_0x23935d[_0xfe12('0x54')]][_0xfe12('0x49')]=_0x23935d[_0xfe12('0x5c')];queues[_0x23935d[_0xfe12('0x54')]][_0xfe12('0x53')]=_0x23935d[_0xfe12('0x5a')];queues[_0x23935d['origtransfererlinkedid']][_0xfe12('0x9')]=_0xfe12('0x5d');}if(!_[_0xfe12('0x19')](queues[_0x23935d['secondtransfererlinkedid']])){if(_0x23935d[_0xfe12('0x5e')]&&queues[_0x23935d[_0xfe12('0x5e')]]){queues[_0x23935d[_0xfe12('0x5e')]][_0xfe12('0x23')]=0x1;queues[_0x23935d['transfertargetuniqueid']]=_[_0xfe12('0x56')](queues[_0x23935d[_0xfe12('0x5e')]]);queues[_0x23935d['transfertargetuniqueid']][_0xfe12('0xf')]=_0x23935d[_0xfe12('0x57')];queues[_0x23935d['transfertargetuniqueid']][_0xfe12('0x23')]=0x2;queues[_0x23935d[_0xfe12('0x57')]][_0xfe12('0x7')]=queues[_0x23935d['origtransfererlinkedid']][_0xfe12('0x7')];queues[_0x23935d[_0xfe12('0x57')]][_0xfe12('0x58')]=queues[_0x23935d[_0xfe12('0x54')]]['calleridname'];queues[_0x23935d[_0xfe12('0x57')]]['queuecallerjoinAt']=utils['now']();queues[_0x23935d[_0xfe12('0x57')]][_0xfe12('0x33')]=utils[_0xfe12('0x16')]();queues[_0x23935d[_0xfe12('0x57')]]['holdtime']=0x0;queues[_0x23935d[_0xfe12('0x57')]]['mohtime']=0x0;utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x5f'),_0x23935d[_0xfe12('0x4e')],queues[_0x23935d[_0xfe12('0x57')]]['name'],queues[_0x23935d['transfertargetuniqueid']][_0xfe12('0xf')],queues[_0x23935d['transfertargetuniqueid']][_0xfe12('0x7')],queues[_0x23935d[_0xfe12('0x57')]][_0xfe12('0x58')]));}else{utils[_0xfe12('0x12')](util['format'](_0xfe12('0x59'),_0x23935d[_0xfe12('0x4e')],queues[_0x23935d[_0xfe12('0x4f')]][_0xfe12('0x22')],_0x23935d['origtransfererlinkedid']));queues[_0x23935d[_0xfe12('0x4f')]][_0xfe12('0xf')]=_0x23935d[_0xfe12('0x54')];}}}}catch(_0x43f71f){utils[_0xfe12('0x17')](util[_0xfe12('0x2')]('[%s][queues][attendedtransfer]',_0x23935d[_0xfe12('0x4e')]),_0x43f71f);}};exports['musiconholdstart']=function(_0x10a071){try{if(!_[_0xfe12('0x19')](queues[_0x10a071['uniqueid']])){utils[_0xfe12('0x10')](util['format']('[%s][queues][musiconholdstart]',_0x10a071['uniqueid']),_0x10a071);queues[_0x10a071['uniqueid']][_0xfe12('0x60')]=utils[_0xfe12('0x16')]();utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x61'),_0x10a071[_0xfe12('0x13')],queues[_0x10a071[_0xfe12('0x13')]][_0xfe12('0x22')],queues[_0x10a071[_0xfe12('0x13')]][_0xfe12('0x60')]));}}catch(_0x3920e9){utils[_0xfe12('0x17')](util[_0xfe12('0x2')](_0xfe12('0x62'),_0x10a071[_0xfe12('0x13')]),_0x3920e9);}};exports[_0xfe12('0x63')]=function(_0xa69db3){try{if(!_[_0xfe12('0x19')](queues[_0xa69db3['uniqueid']])){if(!_['isNil'](queues[_0xa69db3[_0xfe12('0x13')]][_0xfe12('0x60')])){utils[_0xfe12('0x10')](util[_0xfe12('0x2')]('[%s][queues][musiconholdstop]',_0xa69db3[_0xfe12('0x13')]),_0xa69db3);queues[_0xa69db3['uniqueid']][_0xfe12('0x64')]+=utils[_0xfe12('0x65')](utils[_0xfe12('0x16')](),queues[_0xa69db3[_0xfe12('0x13')]][_0xfe12('0x60')]);utils[_0xfe12('0x12')](util[_0xfe12('0x2')](_0xfe12('0x66'),_0xa69db3[_0xfe12('0x13')],queues[_0xa69db3[_0xfe12('0x13')]][_0xfe12('0x22')],queues[_0xa69db3[_0xfe12('0x13')]][_0xfe12('0x64')]));delete queues[_0xa69db3[_0xfe12('0x13')]][_0xfe12('0x60')];}}}catch(_0x597ad3){utils[_0xfe12('0x17')](util[_0xfe12('0x2')](_0xfe12('0x67'),_0xa69db3[_0xfe12('0x13')]),_0x597ad3);}}; \ No newline at end of file +var _0x534e=['musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','name','queuecallerenterreason','error','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queueposition','queuecallerexitAt','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','accountcode','agentcomplete','assigned','membername','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridnum','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','transferuniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x534e,0xcd));var _0xe534=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x534e[_0x2f1114];return _0x2fe856;};'use strict';var _=require(_0xe534('0x0'));var util=require(_0xe534('0x1'));var utils=require(_0xe534('0x2'));var queues={};function writeDB(_0x2fb52b){utils['info'](util['format'](_0xe534('0x3'),_0x2fb52b[_0xe534('0x4')],_0x2fb52b[_0xe534('0x5')],_0x2fb52b[_0xe534('0x6')],_0x2fb52b[_0xe534('0x7')],_0x2fb52b['calleridnum'],_0x2fb52b['accountcode'],_0x2fb52b[_0xe534('0x8')]));if(_0x2fb52b[_0xe534('0x6')]){utils['getVoiceQueueByName'](_0x2fb52b[_0xe534('0x6')])[_0xe534('0x9')](function(_0x3b853c){if(_0x3b853c){_0x2fb52b['type']=_0x3b853c[_0xe534('0xa')];}utils[_0xe534('0xb')](_0xe534('0xc'),_0x2fb52b);});}else{utils[_0xe534('0xb')](_0xe534('0xc'),_0x2fb52b);}if(_0x2fb52b[_0xe534('0xd')]){delete queues[_0x2fb52b[_0xe534('0xd')]];}else{delete queues[_0x2fb52b[_0xe534('0x4')]];}}exports['queuecallerjoin']=function(_0x39dfdc){try{utils[_0xe534('0xe')](util[_0xe534('0xf')](_0xe534('0x10'),_0x39dfdc[_0xe534('0x4')]),_0x39dfdc);utils[_0xe534('0x11')](util[_0xe534('0xf')](_0xe534('0x12'),_0x39dfdc[_0xe534('0x4')],_0x39dfdc[_0xe534('0x6')],_0x39dfdc['position']));queues[_0x39dfdc[_0xe534('0x4')]]=_[_0xe534('0x13')](_0x39dfdc,{'originalposition':_0x39dfdc[_0xe534('0x14')],'queuecallerjoinAt':utils[_0xe534('0x15')](),'mohtime':0x0});}catch(_0x5072b9){utils['error'](util[_0xe534('0xf')](_0xe534('0x10'),_0x39dfdc[_0xe534('0x4')]),_0x5072b9);}};exports[_0xe534('0x16')]=function(_0x525f93){try{if(!_['isNil'](queues[_0x525f93[_0xe534('0x4')]])){utils[_0xe534('0xe')](util[_0xe534('0xf')](_0xe534('0x17'),_0x525f93[_0xe534('0x4')]),_0x525f93);if(queues[_0x525f93[_0xe534('0x4')]][_0xe534('0x18')]){if(!queues[_0x525f93[_0xe534('0x4')]][_0xe534('0x19')]&&!queues[_0x525f93[_0xe534('0x4')]][_0xe534('0x1a')]){queues[_0x525f93['uniqueid']][_0xe534('0x1b')]=!![];queues[_0x525f93[_0xe534('0x4')]][_0xe534('0x1c')]=utils[_0xe534('0x15')]();queues[_0x525f93[_0xe534('0x4')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0xe534('0x11')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x525f93['uniqueid'],queues[_0x525f93[_0xe534('0x4')]][_0xe534('0x1d')],queues[_0x525f93[_0xe534('0x4')]][_0xe534('0x8')]));writeDB(queues[_0x525f93[_0xe534('0x4')]]);}else if(queues[_0x525f93[_0xe534('0x4')]]['transfereduniqueid']){utils[_0xe534('0x11')](util[_0xe534('0xf')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x525f93[_0xe534('0x4')],queues[_0x525f93[_0xe534('0x4')]]['name'],queues[_0x525f93['uniqueid']][_0xe534('0xd')]));queues[queues[_0x525f93[_0xe534('0x4')]][_0xe534('0xd')]]=queues[_0x525f93[_0xe534('0x4')]];queues[queues[_0x525f93[_0xe534('0x4')]]['transfereduniqueid']][_0xe534('0x1e')]=0x2;delete queues[_0x525f93[_0xe534('0x4')]];}}}catch(_0x21f8d6){utils[_0xe534('0x1f')](util[_0xe534('0xf')](_0xe534('0x17'),_0x525f93['uniqueid']),_0x21f8d6);}};exports[_0xe534('0x20')]=function(_0x1053af){try{utils[_0xe534('0xe')](util[_0xe534('0xf')](_0xe534('0x21'),_0x1053af['uniqueid']),_0x1053af);if(!_[_0xe534('0x22')](_0x1053af[_0xe534('0x23')][_0xe534('0x24')])&&_0x1053af[_0xe534('0x25')][_0xe534('0x26')]()!=='CONTINUE'){if(!_[_0xe534('0x22')](queues[_0x1053af['uniqueid']])){queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x19')]=![];queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x27')]=null;queues[_0x1053af[_0xe534('0x4')]]['queuecallerexit']=!![];queues[_0x1053af[_0xe534('0x4')]]['queuecallerexitAt']=utils[_0xe534('0x15')]();queues[_0x1053af['uniqueid']][_0xe534('0x8')]=_0x1053af[_0xe534('0x25')]['toUpperCase']();utils[_0xe534('0x11')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x1053af[_0xe534('0x4')],queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x1d')],_0x1053af[_0xe534('0x25')],queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x8')]));writeDB(queues[_0x1053af[_0xe534('0x4')]]);}}else if(!_[_0xe534('0x22')](_0x1053af['variable'][_0xe534('0x28')])){if(!_[_0xe534('0x22')](queues[_0x1053af[_0xe534('0x4')]])&&!queues[_0x1053af['uniqueid']][_0xe534('0x19')]){queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x19')]=![];queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x27')]=null;queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x1a')]=!![];queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x29')]=utils[_0xe534('0x15')]();queues[_0x1053af['uniqueid']]['queuecallerexitreason']=_0xe534('0x2a');utils[_0xe534('0x11')](util[_0xe534('0xf')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1053af['uniqueid'],queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x1d')],_0x1053af[_0xe534('0x25')],queues[_0x1053af[_0xe534('0x4')]][_0xe534('0x8')]));}}}catch(_0x36479b){utils[_0xe534('0x1f')](util[_0xe534('0xf')]('[%s][queues][varset]',_0x1053af[_0xe534('0x4')]),_0x36479b);}};exports[_0xe534('0x19')]=function(_0x57e769){try{if(!_[_0xe534('0x22')](queues[_0x57e769[_0xe534('0x4')]])){utils[_0xe534('0xe')](util['format']('[%s][queues][queuecallerabandon]',_0x57e769[_0xe534('0x4')]),_0x57e769);queues[_0x57e769[_0xe534('0x4')]][_0xe534('0x1a')]=![];queues[_0x57e769[_0xe534('0x4')]][_0xe534('0x29')]=null;queues[_0x57e769[_0xe534('0x4')]][_0xe534('0x19')]=!![];queues[_0x57e769[_0xe534('0x4')]]['queuecallerabandonAt']=utils['now']();queues[_0x57e769[_0xe534('0x4')]][_0xe534('0x8')]=_0xe534('0x2b');utils[_0xe534('0x11')](util[_0xe534('0xf')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x57e769['uniqueid'],queues[_0x57e769['uniqueid']][_0xe534('0x1d')],queues[_0x57e769['uniqueid']][_0xe534('0x8')]));}}catch(_0x3c052d){utils[_0xe534('0x1f')](util['format'](_0xe534('0x2c'),_0x57e769[_0xe534('0x4')]),_0x3c052d);}};exports[_0xe534('0x2d')]=function(_0x131f8b){try{if(!_[_0xe534('0x22')](queues[_0x131f8b[_0xe534('0x4')]])){utils[_0xe534('0xe')](util[_0xe534('0xf')]('[%s][queues][queuecallerleave]',_0x131f8b[_0xe534('0x4')]),_0x131f8b);utils[_0xe534('0x11')](util['format'](_0xe534('0x2e'),_0x131f8b[_0xe534('0x4')],queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x1d')],_0x131f8b[_0xe534('0x2f')],_0x131f8b[_0xe534('0x30')]));queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x2d')]=!![];queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x18')]=utils['now']();queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x31')]=utils[_0xe534('0x32')](queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x18')],queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x33')]);queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x14')]=_0x131f8b['position'];queues[_0x131f8b['uniqueid']]['count']=_0x131f8b[_0xe534('0x34')];queues[_0x131f8b[_0xe534('0x4')]][_0xe534('0x2f')]=_0x131f8b['connectedlinenum'];queues[_0x131f8b['uniqueid']][_0xe534('0x30')]=_0x131f8b[_0xe534('0x30')];}}catch(_0x285da8){utils[_0xe534('0x1f')](util[_0xe534('0xf')]('[%s][queues][queuecallerleave]',_0x131f8b[_0xe534('0x4')]),_0x285da8);}};exports['agentconnect']=function(_0x2a825a){try{if(!_[_0xe534('0x22')](queues[_0x2a825a['uniqueid']])){utils[_0xe534('0xe')](util[_0xe534('0xf')]('[%s][queues][agentconnect]',_0x2a825a[_0xe534('0x4')]),_0x2a825a);utils[_0xe534('0x11')](util['format'](_0xe534('0x35'),_0x2a825a[_0xe534('0x4')],queues[_0x2a825a[_0xe534('0x4')]]['name'],_0x2a825a['membername'],_0x2a825a[_0xe534('0x36')]));queues[_0x2a825a[_0xe534('0x4')]][_0xe534('0x19')]=![];queues[_0x2a825a['uniqueid']]['queuecallerabandon']=![];queues[_0x2a825a[_0xe534('0x4')]][_0xe534('0x27')]=null;queues[_0x2a825a[_0xe534('0x4')]][_0xe534('0x1a')]=![];queues[_0x2a825a['uniqueid']][_0xe534('0x8')]=null;queues[_0x2a825a[_0xe534('0x4')]][_0xe534('0x29')]=null;queues[_0x2a825a[_0xe534('0x4')]]['assigned']=!![];queues[_0x2a825a[_0xe534('0x4')]][_0xe534('0x37')]=_0x2a825a[_0xe534('0x36')];queues[_0x2a825a[_0xe534('0x4')]][_0xe534('0x7')]=_0x2a825a['membername'];}}catch(_0x360d22){utils[_0xe534('0x1f')](util[_0xe534('0xf')]('[%s][queues][agentconnect]',_0x2a825a[_0xe534('0x4')]),_0x360d22);}};exports[_0xe534('0x38')]=function(_0x29635f){try{if(!_[_0xe534('0x22')](queues[_0x29635f[_0xe534('0x4')]])){if(queues[_0x29635f['uniqueid']]['queuecallerleaveAt']){utils[_0xe534('0xe')](util['format']('[%s][queues][agentcomplete]',_0x29635f[_0xe534('0x4')]),_0x29635f);queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x19')]=![];queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x19')]=![];queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x27')]=null;queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x1a')]=![];queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x29')]=null;queues[_0x29635f['uniqueid']][_0xe534('0x39')]=!![];queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x7')]=_0x29635f[_0xe534('0x3a')];queues[_0x29635f[_0xe534('0x4')]]['queuecallercomplete']=!![];queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x1c')]=utils['now']();if(_0x29635f[_0xe534('0x3b')]==_0xe534('0x3c')){if(!queues[_0x29635f[_0xe534('0x4')]]['transfer']){queues[_0x29635f['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x29635f['uniqueid']][_0xe534('0x8')]=_0xe534('0x3d')+_0x29635f['reason'][_0xe534('0x26')]();}utils[_0xe534('0x11')](util['format'](_0xe534('0x3e'),_0x29635f[_0xe534('0x4')],queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x1d')],_0x29635f[_0xe534('0x3a')],queues[_0x29635f[_0xe534('0x4')]][_0xe534('0x8')]));writeDB(queues[_0x29635f[_0xe534('0x4')]]);}}}catch(_0x5ec528){utils[_0xe534('0x1f')](util['format'](_0xe534('0x3f'),_0x29635f[_0xe534('0x4')]),_0x5ec528);}};exports[_0xe534('0x40')]=function(_0x438e65){try{if(!_[_0xe534('0x22')](queues[_0x438e65['transfereeuniqueid']])){utils[_0xe534('0xe')](util[_0xe534('0xf')]('[%s][queues][blindtransfer]',_0x438e65[_0xe534('0x4')]),_0x438e65);queues[_0x438e65[_0xe534('0x41')]][_0xe534('0x3c')]=!![];queues[_0x438e65[_0xe534('0x41')]][_0xe534('0x42')]=_0xe534('0x43');queues[_0x438e65['transfereeuniqueid']][_0xe534('0x44')]=_0x438e65[_0xe534('0x45')];queues[_0x438e65[_0xe534('0x41')]]['transferuniqueid']=_0x438e65[_0xe534('0x41')];queues[_0x438e65[_0xe534('0x41')]]['queuecallerexitreason']=_0xe534('0x46');utils['info'](util[_0xe534('0xf')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x438e65[_0xe534('0x4')],queues[_0x438e65[_0xe534('0x41')]][_0xe534('0x1d')],_0x438e65[_0xe534('0x41')],_0x438e65[_0xe534('0x45')]));}}catch(_0x487ad9){utils[_0xe534('0x1f')](util[_0xe534('0xf')]('[%s][queues][blindtransfer]',_0x438e65[_0xe534('0x4')]),_0x487ad9);}};exports[_0xe534('0x47')]=function(_0x5540a3){try{utils[_0xe534('0xe')](util[_0xe534('0xf')](_0xe534('0x48'),_0x5540a3[_0xe534('0x49')]),_0x5540a3);if(_0x5540a3[_0xe534('0x49')]==_0x5540a3[_0xe534('0x4a')]){if(!_[_0xe534('0x22')](queues[_0x5540a3[_0xe534('0x4b')]])){utils[_0xe534('0x11')](util[_0xe534('0xf')](_0xe534('0x4c'),_0x5540a3[_0xe534('0x49')],queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0x1d')],_0x5540a3[_0xe534('0x4d')]));queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0x3c')]=!![];queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0x42')]=_0xe534('0x4e');queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0x44')]=_0x5540a3[_0xe534('0x4d')];queues[_0x5540a3[_0xe534('0x4b')]]['transferuniqueid']=_0x5540a3[_0xe534('0x49')];queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xe534('0x22')](queues[_0x5540a3[_0xe534('0x4a')]])){if(_0x5540a3[_0xe534('0x4f')]&&queues[_0x5540a3[_0xe534('0x4f')]]){queues[_0x5540a3[_0xe534('0x4f')]]['queuecallerenterreason']=0x1;queues[_0x5540a3['transfereeuniqueid']]=_[_0xe534('0x50')](queues[_0x5540a3[_0xe534('0x4f')]]);queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0xd')]=_0x5540a3['transfertargetuniqueid'];queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0x1e')]=0x2;queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0x51')]=queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0x51')];queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0x52')]=queues[_0x5540a3['secondtransfererlinkedid']][_0xe534('0x52')];queues[_0x5540a3[_0xe534('0x41')]]['queuecallerjoinAt']=utils[_0xe534('0x15')]();queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0x18')]=utils[_0xe534('0x15')]();queues[_0x5540a3['transfereeuniqueid']][_0xe534('0x31')]=0x0;queues[_0x5540a3['transfereeuniqueid']][_0xe534('0x53')]=0x0;utils[_0xe534('0x11')](util['format'](_0xe534('0x54'),_0x5540a3[_0xe534('0x49')],queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0x1d')],queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0x51')],queues[_0x5540a3[_0xe534('0x41')]][_0xe534('0x52')]));}else{utils['info'](util['format'](_0xe534('0x55'),_0x5540a3['origtransfereruniqueid'],queues[_0x5540a3['origtransfererlinkedid']]['name'],_0x5540a3[_0xe534('0x4b')]));queues[_0x5540a3['origtransfererlinkedid']][_0xe534('0xd')]=_0x5540a3[_0xe534('0x4b')];}}}else if(_0x5540a3[_0xe534('0x56')]==_0x5540a3['secondtransfererlinkedid']){if(!_[_0xe534('0x22')](queues[_0x5540a3['origtransfererlinkedid']])){utils[_0xe534('0x11')](util[_0xe534('0xf')](_0xe534('0x57'),_0x5540a3[_0xe534('0x49')],queues[_0x5540a3[_0xe534('0x4a')]][_0xe534('0x1d')],_0x5540a3['secondtransfereruniqueid'],_0x5540a3[_0xe534('0x58')]));queues[_0x5540a3[_0xe534('0x4a')]]['transfer']=!![];queues[_0x5540a3[_0xe534('0x4a')]][_0xe534('0x42')]=_0xe534('0x4e');queues[_0x5540a3[_0xe534('0x4a')]][_0xe534('0x44')]=_0x5540a3[_0xe534('0x58')];queues[_0x5540a3[_0xe534('0x4a')]][_0xe534('0x59')]=_0x5540a3[_0xe534('0x56')];queues[_0x5540a3[_0xe534('0x4a')]][_0xe534('0x8')]=_0xe534('0x5a');}if(!_[_0xe534('0x22')](queues[_0x5540a3[_0xe534('0x4b')]])){if(_0x5540a3[_0xe534('0x5b')]&&queues[_0x5540a3['transfertargetlinkedid']]){queues[_0x5540a3[_0xe534('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x5540a3[_0xe534('0x5c')]]=_[_0xe534('0x50')](queues[_0x5540a3[_0xe534('0x5b')]]);queues[_0x5540a3[_0xe534('0x5c')]][_0xe534('0xd')]=_0x5540a3[_0xe534('0x5c')];queues[_0x5540a3[_0xe534('0x5c')]][_0xe534('0x1e')]=0x2;queues[_0x5540a3[_0xe534('0x5c')]]['calleridnum']=queues[_0x5540a3[_0xe534('0x4a')]][_0xe534('0x51')];queues[_0x5540a3[_0xe534('0x5c')]][_0xe534('0x52')]=queues[_0x5540a3[_0xe534('0x4a')]][_0xe534('0x52')];queues[_0x5540a3[_0xe534('0x5c')]]['queuecallerjoinAt']=utils['now']();queues[_0x5540a3[_0xe534('0x5c')]][_0xe534('0x18')]=utils[_0xe534('0x15')]();queues[_0x5540a3[_0xe534('0x5c')]]['holdtime']=0x0;queues[_0x5540a3['transfertargetuniqueid']][_0xe534('0x53')]=0x0;utils[_0xe534('0x11')](util['format'](_0xe534('0x5d'),_0x5540a3[_0xe534('0x49')],queues[_0x5540a3['transfertargetuniqueid']]['name'],queues[_0x5540a3['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x5540a3[_0xe534('0x5c')]][_0xe534('0x51')],queues[_0x5540a3[_0xe534('0x5c')]][_0xe534('0x52')]));}else{utils[_0xe534('0x11')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5540a3[_0xe534('0x49')],queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0x1d')],_0x5540a3[_0xe534('0x4a')]));queues[_0x5540a3[_0xe534('0x4b')]][_0xe534('0xd')]=_0x5540a3['origtransfererlinkedid'];}}}}catch(_0x113891){utils[_0xe534('0x1f')](util[_0xe534('0xf')](_0xe534('0x48'),_0x5540a3[_0xe534('0x49')]),_0x113891);}};exports[_0xe534('0x5e')]=function(_0x55a624){try{if(!_['isNil'](queues[_0x55a624[_0xe534('0x4')]])){utils[_0xe534('0xe')](util[_0xe534('0xf')](_0xe534('0x5f'),_0x55a624['uniqueid']),_0x55a624);queues[_0x55a624[_0xe534('0x4')]][_0xe534('0x60')]=utils['now']();utils[_0xe534('0x11')](util[_0xe534('0xf')](_0xe534('0x61'),_0x55a624[_0xe534('0x4')],queues[_0x55a624['uniqueid']][_0xe534('0x1d')],queues[_0x55a624['uniqueid']][_0xe534('0x60')]));}}catch(_0x38a9e3){utils['error'](util[_0xe534('0xf')](_0xe534('0x5f'),_0x55a624[_0xe534('0x4')]),_0x38a9e3);}};exports[_0xe534('0x62')]=function(_0x5d1826){try{if(!_[_0xe534('0x22')](queues[_0x5d1826[_0xe534('0x4')]])){if(!_[_0xe534('0x22')](queues[_0x5d1826['uniqueid']]['musiconholdstartAt'])){utils[_0xe534('0xe')](util[_0xe534('0xf')](_0xe534('0x63'),_0x5d1826[_0xe534('0x4')]),_0x5d1826);queues[_0x5d1826[_0xe534('0x4')]][_0xe534('0x53')]+=utils[_0xe534('0x32')](utils['now'](),queues[_0x5d1826['uniqueid']]['musiconholdstartAt']);utils[_0xe534('0x11')](util[_0xe534('0xf')](_0xe534('0x64'),_0x5d1826[_0xe534('0x4')],queues[_0x5d1826[_0xe534('0x4')]][_0xe534('0x1d')],queues[_0x5d1826[_0xe534('0x4')]][_0xe534('0x53')]));delete queues[_0x5d1826[_0xe534('0x4')]][_0xe534('0x60')];}}}catch(_0x1b0742){utils[_0xe534('0x1f')](util[_0xe534('0xf')](_0xe534('0x63'),_0x5d1826[_0xe534('0x4')]),_0x1b0742);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f8aef16..1687884 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 _0xb7f7=['.wav49','.WAV','find','monitors','push','error','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereruniqueid','recording','util','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','exten','[%s][recordings][newstate]','isNil','channelstate','context','channel','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0xce4604,_0x5e98ad){var _0x474352=function(_0x9074e8){while(--_0x9074e8){_0xce4604['push'](_0xce4604['shift']());}};_0x474352(++_0x5e98ad);}(_0xb7f7,0x13e));var _0x7b7f=function(_0x2e8acc,_0x4c2797){_0x2e8acc=_0x2e8acc-0x0;var _0x4924e4=_0xb7f7[_0x2e8acc];return _0x4924e4;};'use strict';var _=require('lodash');var util=require(_0x7b7f('0x0'));var utils=require(_0x7b7f('0x1'));var transfers=require(_0x7b7f('0x2'));var recordings={};function writeDB(_0x4aef21){var _0xc61756;utils[_0x7b7f('0x3')](util[_0x7b7f('0x4')]('[%s][recordings][writeDB]',_0x4aef21[_0x7b7f('0x5')]));if(transfers[_0x7b7f('0x6')][_0x4aef21['uniqueid']]){_0xc61756=_0x4aef21[_0x7b7f('0x5')];_0x4aef21[_0x7b7f('0x5')]=transfers[_0x7b7f('0x6')][_0x4aef21['uniqueid']][_0x7b7f('0x7')];}if(_0x4aef21[_0x7b7f('0x8')]){utils[_0x7b7f('0x9')](_0x4aef21[_0x7b7f('0x8')])[_0x7b7f('0xa')](function(_0x39fb3a){if(_0x39fb3a){_0x4aef21[_0x7b7f('0xb')]=_0x39fb3a[_0x7b7f('0xc')];_0x4aef21['UserId']=_0x39fb3a['id'];}utils[_0x7b7f('0xd')](_0x7b7f('0xe'),_0x4aef21);});}else{utils[_0x7b7f('0xd')](_0x7b7f('0xe'),_0x4aef21);}if(_0xc61756)delete transfers[_0x7b7f('0x6')][_0xc61756];}exports[_0x7b7f('0xf')]=function(_0x50bbe7){try{utils[_0x7b7f('0x10')](util[_0x7b7f('0x4')](_0x7b7f('0x11'),_0x50bbe7['uniqueid']),_0x50bbe7);if(_0x50bbe7[_0x7b7f('0x5')]==_0x50bbe7[_0x7b7f('0x12')]){utils[_0x7b7f('0x3')](util[_0x7b7f('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x50bbe7['uniqueid'],_0x50bbe7['context'],_0x50bbe7[_0x7b7f('0x13')]));recordings[_0x50bbe7['uniqueid']]={'uniqueid':_0x50bbe7[_0x7b7f('0x5')],'accountcode':_0x50bbe7[_0x7b7f('0x8')],'exten':_0x50bbe7[_0x7b7f('0x13')],'context':_0x50bbe7['context'],'channel':_0x50bbe7['channel'],'monitors':[]};}}catch(_0x4b028f){utils['error'](util[_0x7b7f('0x4')]('[%s][recordings][newchannel]',_0x50bbe7[_0x7b7f('0x5')]),_0x4b028f);}};exports['newstate']=function(_0x1346f3){try{utils[_0x7b7f('0x10')](util['format'](_0x7b7f('0x14'),_0x1346f3['uniqueid']),_0x1346f3);if(!_[_0x7b7f('0x15')](recordings[_0x1346f3[_0x7b7f('0x5')]])&&_0x1346f3[_0x7b7f('0x16')]==0x6){utils['info'](util[_0x7b7f('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x1346f3['uniqueid'],_0x1346f3[_0x7b7f('0x17')],_0x1346f3[_0x7b7f('0x18')]));}else if(!_['isNil'](recordings[_0x1346f3[_0x7b7f('0x12')]])&&_0x1346f3[_0x7b7f('0x16')]==0x6&&_0x1346f3[_0x7b7f('0x17')]!=_0x7b7f('0x19')){utils[_0x7b7f('0x3')](util[_0x7b7f('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1346f3[_0x7b7f('0x5')],_0x1346f3['linkedid'],_0x1346f3[_0x7b7f('0x17')],_0x1346f3[_0x7b7f('0x18')]));recordings[_0x1346f3['linkedid']]['accountcode']=_0x1346f3['accountcode'];}}catch(_0x53c2a6){utils['error'](util['format'](_0x7b7f('0x14'),_0x1346f3['uniqueid']),_0x53c2a6);}};exports[_0x7b7f('0x1a')]=function(_0x334567){try{if(!_[_0x7b7f('0x15')](_0x334567[_0x7b7f('0x1b')])&&!_[_0x7b7f('0x15')](_0x334567['variable'][_0x7b7f('0x1c')])){utils[_0x7b7f('0x10')](util[_0x7b7f('0x4')]('[%s][recordings][varset]',_0x334567['uniqueid']),_0x334567);utils[_0x7b7f('0x3')](util['format'](_0x7b7f('0x1d'),_0x334567[_0x7b7f('0x5')],_0x334567[_0x7b7f('0x1b')],_0x334567[_0x7b7f('0x1e')]));if(_[_0x7b7f('0x1f')](_0x334567[_0x7b7f('0x1e')],'.wav49')){_0x334567['value']=_0x334567[_0x7b7f('0x1e')]['replace'](_0x7b7f('0x20'),_0x7b7f('0x21'));}if(recordings[_0x334567[_0x7b7f('0x12')]]){var _0x45b1af=_[_0x7b7f('0x22')](recordings[_0x334567[_0x7b7f('0x12')]]['monitors'],{'value':_0x334567[_0x7b7f('0x1e')]});if(_['isNil'](_0x45b1af)){recordings[_0x334567[_0x7b7f('0x12')]][_0x7b7f('0x23')][_0x7b7f('0x24')]({'value':_0x334567['value']});}}}}catch(_0x30e16b){utils[_0x7b7f('0x25')](util[_0x7b7f('0x4')](_0x7b7f('0x26'),_0x334567['uniqueid']),_0x30e16b);}};exports['hangup']=function(_0x37249b){try{if(!_['isNil'](recordings[_0x37249b[_0x7b7f('0x5')]])){utils['debug'](util['format'](_0x7b7f('0x27'),_0x37249b[_0x7b7f('0x5')]),_0x37249b);utils['info'](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x37249b[_0x7b7f('0x5')],_0x37249b[_0x7b7f('0x28')],_0x37249b[_0x7b7f('0x29')],_0x37249b[_0x7b7f('0x2a')]));recordings[_0x37249b[_0x7b7f('0x5')]]['calleridnum']=_0x37249b[_0x7b7f('0x28')];recordings[_0x37249b['uniqueid']]['calleridname']=_0x37249b[_0x7b7f('0x29')];recordings[_0x37249b[_0x7b7f('0x5')]][_0x7b7f('0x2b')]=_0x37249b[_0x7b7f('0x2b')];recordings[_0x37249b[_0x7b7f('0x5')]]['connectedlinename']=_0x37249b[_0x7b7f('0x2c')];if(recordings[_0x37249b[_0x7b7f('0x5')]][_0x7b7f('0x2d')]==_0x7b7f('0x2e')&&recordings[_0x37249b[_0x7b7f('0x5')]][_0x7b7f('0x8')]){recordings[_0x37249b[_0x7b7f('0x5')]][_0x7b7f('0x2b')]=recordings[_0x37249b[_0x7b7f('0x5')]]['accountcode'];recordings[_0x37249b[_0x7b7f('0x5')]][_0x7b7f('0x2c')]='';}recordings[_0x37249b[_0x7b7f('0x5')]][_0x7b7f('0x23')][_0x7b7f('0x2f')](function(_0x451413){var _0x3499fb=_[_0x7b7f('0x30')](recordings[_0x37249b[_0x7b7f('0x5')]]);_0x3499fb['value']=_0x451413[_0x7b7f('0x1e')];writeDB(_0x3499fb);});delete recordings[_0x37249b[_0x7b7f('0x5')]];}}catch(_0x479851){utils['error'](util[_0x7b7f('0x4')](_0x7b7f('0x27'),_0x37249b['uniqueid']),_0x479851);}};exports[_0x7b7f('0x31')]=function(_0x1d17ff){try{if(!_[_0x7b7f('0x15')](recordings[_0x1d17ff[_0x7b7f('0x5')]])){utils[_0x7b7f('0x10')](util[_0x7b7f('0x4')](_0x7b7f('0x32'),_0x1d17ff[_0x7b7f('0x5')]),_0x1d17ff);utils['info'](util[_0x7b7f('0x4')](_0x7b7f('0x33'),_0x1d17ff['uniqueid'],_0x1d17ff[_0x7b7f('0x34')],_0x1d17ff['appdata']));if(_0x1d17ff[_0x7b7f('0x34')][_0x7b7f('0x35')]()==_0x7b7f('0x36')&&_[_0x7b7f('0x37')](_0x1d17ff['appdata'][_0x7b7f('0x35')](),_0x7b7f('0x38'))){var _0x2dd187=_0x1d17ff[_0x7b7f('0x39')]['split']('=');var _0x805a66=_0x2dd187[0x0][_0x7b7f('0x3a')](_0x2dd187[0x0][_0x7b7f('0x3b')]('(')+0x1,_0x2dd187[0x0][_0x7b7f('0x3b')](')'));var _0x518475=_0x2dd187[0x1];recordings[_0x1d17ff[_0x7b7f('0x5')]][_0x805a66]=_0x518475;}}}catch(_0x583b48){utils['error'](util['format']('[%s][recordings][newexten]',_0x1d17ff[_0x7b7f('0x5')]),_0x583b48);}};exports['queuecallerjoin']=function(_0x3b83ef){try{if(!_['isNil'](recordings[_0x3b83ef['uniqueid']])){utils[_0x7b7f('0x10')](util['format'](_0x7b7f('0x3c'),_0x3b83ef[_0x7b7f('0x5')]),_0x3b83ef);utils[_0x7b7f('0x3')](util[_0x7b7f('0x4')](_0x7b7f('0x3d'),_0x3b83ef[_0x7b7f('0x5')],_0x3b83ef['queue']));recordings[_0x3b83ef[_0x7b7f('0x5')]][_0x7b7f('0x3e')]=_0x3b83ef[_0x7b7f('0x3e')];}}catch(_0x329a2e){utils[_0x7b7f('0x25')](util[_0x7b7f('0x4')]('[%s][recordings][queuecallerjoin]',_0x3b83ef['uniqueid']),_0x329a2e);}};exports[_0x7b7f('0x3f')]=function(_0x3ede10){try{utils[_0x7b7f('0x10')](util[_0x7b7f('0x4')](_0x7b7f('0x40'),_0x3ede10[_0x7b7f('0x5')]),_0x3ede10);utils['info'](util['format'](_0x7b7f('0x41'),_0x3ede10[_0x7b7f('0x5')],_0x3ede10[_0x7b7f('0x42')],_0x3ede10['transferercalleridname'],_0x3ede10[_0x7b7f('0x43')],_0x3ede10['transfereecalleridname']));if(recordings[_0x3ede10[_0x7b7f('0x44')]]&&transfers[_0x7b7f('0x6')][_0x3ede10['transfereruniqueid']]){transfers['blinds'][_0x3ede10[_0x7b7f('0x44')]][_0x7b7f('0x45')]=!![];}}catch(_0x3c3933){utils[_0x7b7f('0x25')](util[_0x7b7f('0x4')](_0x7b7f('0x40'),_0x3ede10[_0x7b7f('0x5')]),_0x3c3933);}}; \ No newline at end of file +var _0x2998=['split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','info','[%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','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr'];(function(_0x3a727b,_0x59be12){var _0xeb6065=function(_0x20c6b1){while(--_0x20c6b1){_0x3a727b['push'](_0x3a727b['shift']());}};_0xeb6065(++_0x59be12);}(_0x2998,0x9e));var _0x8299=function(_0x359485,_0x36cb0c){_0x359485=_0x359485-0x0;var _0x2aaa41=_0x2998[_0x359485];return _0x2aaa41;};'use strict';var _=require(_0x8299('0x0'));var util=require(_0x8299('0x1'));var utils=require(_0x8299('0x2'));var transfers=require(_0x8299('0x3'));var recordings={};function writeDB(_0x494623){var _0x54337c;utils['info'](util[_0x8299('0x4')]('[%s][recordings][writeDB]',_0x494623[_0x8299('0x5')]));if(transfers[_0x8299('0x6')][_0x494623['uniqueid']]){_0x54337c=_0x494623[_0x8299('0x5')];_0x494623[_0x8299('0x5')]=transfers['blinds'][_0x494623[_0x8299('0x5')]][_0x8299('0x7')];}if(_0x494623[_0x8299('0x8')]){utils[_0x8299('0x9')](_0x494623[_0x8299('0x8')])['then'](function(_0xd4b777){if(_0xd4b777){_0x494623[_0x8299('0xa')]=_0xd4b777[_0x8299('0xb')];_0x494623[_0x8299('0xc')]=_0xd4b777['id'];}utils[_0x8299('0xd')](_0x8299('0xe'),_0x494623);});}else{utils[_0x8299('0xd')](_0x8299('0xe'),_0x494623);}if(_0x54337c)delete transfers['blinds'][_0x54337c];}exports[_0x8299('0xf')]=function(_0x26edd0){try{utils[_0x8299('0x10')](util[_0x8299('0x4')]('[%s][recordings][newchannel]',_0x26edd0['uniqueid']),_0x26edd0);if(_0x26edd0[_0x8299('0x5')]==_0x26edd0[_0x8299('0x11')]){utils[_0x8299('0x12')](util[_0x8299('0x4')](_0x8299('0x13'),_0x26edd0['uniqueid'],_0x26edd0[_0x8299('0x14')],_0x26edd0[_0x8299('0x15')]));recordings[_0x26edd0[_0x8299('0x5')]]={'uniqueid':_0x26edd0[_0x8299('0x5')],'accountcode':_0x26edd0[_0x8299('0x8')],'exten':_0x26edd0[_0x8299('0x15')],'context':_0x26edd0[_0x8299('0x14')],'channel':_0x26edd0[_0x8299('0x16')],'monitors':[]};}}catch(_0x417d8f){utils[_0x8299('0x17')](util[_0x8299('0x4')]('[%s][recordings][newchannel]',_0x26edd0['uniqueid']),_0x417d8f);}};exports[_0x8299('0x18')]=function(_0xe6fe35){try{utils['debug'](util['format'](_0x8299('0x19'),_0xe6fe35[_0x8299('0x5')]),_0xe6fe35);if(!_[_0x8299('0x1a')](recordings[_0xe6fe35[_0x8299('0x5')]])&&_0xe6fe35[_0x8299('0x1b')]==0x6){utils['info'](util[_0x8299('0x4')](_0x8299('0x1c'),_0xe6fe35[_0x8299('0x5')],_0xe6fe35['context'],_0xe6fe35[_0x8299('0x16')]));}else if(!_['isNil'](recordings[_0xe6fe35[_0x8299('0x11')]])&&_0xe6fe35[_0x8299('0x1b')]==0x6&&_0xe6fe35['context']!=_0x8299('0x1d')){utils[_0x8299('0x12')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xe6fe35[_0x8299('0x5')],_0xe6fe35[_0x8299('0x11')],_0xe6fe35[_0x8299('0x14')],_0xe6fe35['channel']));recordings[_0xe6fe35[_0x8299('0x11')]][_0x8299('0x8')]=_0xe6fe35[_0x8299('0x8')];}}catch(_0x5ddc15){utils[_0x8299('0x17')](util['format'](_0x8299('0x19'),_0xe6fe35[_0x8299('0x5')]),_0x5ddc15);}};exports[_0x8299('0x1e')]=function(_0x34f6a9){try{if(!_[_0x8299('0x1a')](_0x34f6a9[_0x8299('0x1f')])&&!_[_0x8299('0x1a')](_0x34f6a9[_0x8299('0x1f')][_0x8299('0x20')])){utils[_0x8299('0x10')](util[_0x8299('0x4')](_0x8299('0x21'),_0x34f6a9['uniqueid']),_0x34f6a9);utils['info'](util[_0x8299('0x4')](_0x8299('0x22'),_0x34f6a9[_0x8299('0x5')],_0x34f6a9[_0x8299('0x1f')],_0x34f6a9[_0x8299('0x23')]));if(_[_0x8299('0x24')](_0x34f6a9[_0x8299('0x23')],'.wav49')){_0x34f6a9[_0x8299('0x23')]=_0x34f6a9[_0x8299('0x23')][_0x8299('0x25')]('.wav49','.WAV');}if(recordings[_0x34f6a9['linkedid']]){var _0x60ddf8=_['find'](recordings[_0x34f6a9[_0x8299('0x11')]][_0x8299('0x26')],{'value':_0x34f6a9[_0x8299('0x23')]});if(_[_0x8299('0x1a')](_0x60ddf8)){recordings[_0x34f6a9[_0x8299('0x11')]][_0x8299('0x26')][_0x8299('0x27')]({'value':_0x34f6a9[_0x8299('0x23')]});}}}}catch(_0x430362){utils[_0x8299('0x17')](util[_0x8299('0x4')](_0x8299('0x21'),_0x34f6a9[_0x8299('0x5')]),_0x430362);}};exports['hangup']=function(_0x438dfe){try{if(!_[_0x8299('0x1a')](recordings[_0x438dfe[_0x8299('0x5')]])){utils[_0x8299('0x10')](util[_0x8299('0x4')](_0x8299('0x28'),_0x438dfe['uniqueid']),_0x438dfe);utils[_0x8299('0x12')](util[_0x8299('0x4')](_0x8299('0x29'),_0x438dfe['uniqueid'],_0x438dfe[_0x8299('0x2a')],_0x438dfe['calleridname'],_0x438dfe[_0x8299('0x2b')]));recordings[_0x438dfe[_0x8299('0x5')]]['calleridnum']=_0x438dfe[_0x8299('0x2a')];recordings[_0x438dfe[_0x8299('0x5')]][_0x8299('0x2c')]=_0x438dfe[_0x8299('0x2c')];recordings[_0x438dfe['uniqueid']][_0x8299('0x2d')]=_0x438dfe['connectedlinenum'];recordings[_0x438dfe['uniqueid']][_0x8299('0x2e')]=_0x438dfe[_0x8299('0x2e')];if(recordings[_0x438dfe[_0x8299('0x5')]][_0x8299('0x2f')]==_0x8299('0x30')&&recordings[_0x438dfe[_0x8299('0x5')]][_0x8299('0x8')]){recordings[_0x438dfe['uniqueid']][_0x8299('0x2d')]=recordings[_0x438dfe[_0x8299('0x5')]]['accountcode'];recordings[_0x438dfe[_0x8299('0x5')]]['connectedlinename']='';}recordings[_0x438dfe[_0x8299('0x5')]][_0x8299('0x26')][_0x8299('0x31')](function(_0x2edc19){var _0x580381=_[_0x8299('0x32')](recordings[_0x438dfe['uniqueid']]);_0x580381[_0x8299('0x23')]=_0x2edc19['value'];writeDB(_0x580381);});delete recordings[_0x438dfe[_0x8299('0x5')]];}}catch(_0xbe4c32){utils['error'](util['format']('[%s][recordings][hangup]',_0x438dfe[_0x8299('0x5')]),_0xbe4c32);}};exports[_0x8299('0x33')]=function(_0x1e2450){try{if(!_['isNil'](recordings[_0x1e2450[_0x8299('0x5')]])){utils[_0x8299('0x10')](util[_0x8299('0x4')](_0x8299('0x34'),_0x1e2450[_0x8299('0x5')]),_0x1e2450);utils[_0x8299('0x12')](util[_0x8299('0x4')](_0x8299('0x35'),_0x1e2450[_0x8299('0x5')],_0x1e2450[_0x8299('0x36')],_0x1e2450[_0x8299('0x37')]));if(_0x1e2450[_0x8299('0x36')][_0x8299('0x38')]()=='set'&&_['startsWith'](_0x1e2450[_0x8299('0x37')][_0x8299('0x38')](),_0x8299('0x39'))){var _0x8ec30a=_0x1e2450['appdata'][_0x8299('0x3a')]('=');var _0x295af4=_0x8ec30a[0x0][_0x8299('0x3b')](_0x8ec30a[0x0][_0x8299('0x3c')]('(')+0x1,_0x8ec30a[0x0][_0x8299('0x3c')](')'));var _0x5d2b54=_0x8ec30a[0x1];recordings[_0x1e2450[_0x8299('0x5')]][_0x295af4]=_0x5d2b54;}}}catch(_0x211da7){utils[_0x8299('0x17')](util[_0x8299('0x4')](_0x8299('0x34'),_0x1e2450[_0x8299('0x5')]),_0x211da7);}};exports[_0x8299('0x3d')]=function(_0x2eefd8){try{if(!_[_0x8299('0x1a')](recordings[_0x2eefd8[_0x8299('0x5')]])){utils[_0x8299('0x10')](util[_0x8299('0x4')](_0x8299('0x3e'),_0x2eefd8[_0x8299('0x5')]),_0x2eefd8);utils[_0x8299('0x12')](util[_0x8299('0x4')](_0x8299('0x3f'),_0x2eefd8['uniqueid'],_0x2eefd8[_0x8299('0x40')]));recordings[_0x2eefd8[_0x8299('0x5')]][_0x8299('0x40')]=_0x2eefd8[_0x8299('0x40')];}}catch(_0x1eacc8){utils['error'](util[_0x8299('0x4')](_0x8299('0x3e'),_0x2eefd8[_0x8299('0x5')]),_0x1eacc8);}};exports[_0x8299('0x41')]=function(_0x2cc92e){try{utils['debug'](util['format'](_0x8299('0x42'),_0x2cc92e[_0x8299('0x5')]),_0x2cc92e);utils[_0x8299('0x12')](util['format'](_0x8299('0x43'),_0x2cc92e[_0x8299('0x5')],_0x2cc92e[_0x8299('0x44')],_0x2cc92e['transferercalleridname'],_0x2cc92e[_0x8299('0x45')],_0x2cc92e[_0x8299('0x46')]));if(recordings[_0x2cc92e[_0x8299('0x47')]]&&transfers['blinds'][_0x2cc92e[_0x8299('0x47')]]){transfers['blinds'][_0x2cc92e['transfereruniqueid']]['recording']=!![];}}catch(_0x296363){utils[_0x8299('0x17')](util[_0x8299('0x4')](_0x8299('0x42'),_0x2cc92e['uniqueid']),_0x296363);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 448ef0b..bce0c18 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 _0xa207=['lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','type','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x344397,_0xc7ad91){var _0x44de4f=function(_0x46b04d){while(--_0x46b04d){_0x344397['push'](_0x344397['shift']());}};_0x44de4f(++_0xc7ad91);}(_0xa207,0x11f));var _0x7a20=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa207[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x7a20('0x0'));var util=require(_0x7a20('0x1'));var utils=require(_0x7a20('0x2'));function writeDB(_0x1cea63){utils[_0x7a20('0x3')](util[_0x7a20('0x4')](_0x7a20('0x5'),_0x1cea63['type']==='attended'?_0x1cea63[_0x7a20('0x6')]:_0x1cea63[_0x7a20('0x7')],_0x1cea63['type']));utils['request']('CreateVoiceTransferReport',_0x1cea63);}exports[_0x7a20('0x8')]={};exports['blindtransfer']=function(_0x1ab9cd){try{utils[_0x7a20('0x9')](util['format'](_0x7a20('0xa'),_0x1ab9cd[_0x7a20('0x7')]),_0x1ab9cd);utils[_0x7a20('0x3')](util[_0x7a20('0x4')](_0x7a20('0xb'),_0x1ab9cd['uniqueid'],_0x1ab9cd[_0x7a20('0xc')],_0x1ab9cd[_0x7a20('0xd')],_0x1ab9cd[_0x7a20('0xe')],_0x1ab9cd['transfereecalleridname']));_0x1ab9cd[_0x7a20('0xf')]=_0x7a20('0x10');exports['blinds'][_0x1ab9cd['transfereruniqueid']]=_0x1ab9cd;writeDB(_0x1ab9cd);}catch(_0x203f5d){utils[_0x7a20('0x11')](util[_0x7a20('0x4')](_0x7a20('0xa'),_0x1ab9cd[_0x7a20('0x7')]),_0x203f5d);}};exports[_0x7a20('0x12')]=function(_0x47f68c){try{utils['debug'](util[_0x7a20('0x4')](_0x7a20('0x13'),_0x47f68c[_0x7a20('0x6')]),_0x47f68c);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x47f68c[_0x7a20('0x6')],_0x47f68c[_0x7a20('0x14')],_0x47f68c[_0x7a20('0x15')],_0x47f68c['transfertargetcalleridnum'],_0x47f68c[_0x7a20('0x16')]));_0x47f68c=_[_0x7a20('0x17')](_0x47f68c,{'transfererchannel':_0x47f68c[_0x7a20('0x18')],'transferercalleridnum':_0x47f68c[_0x7a20('0x14')],'transferercalleridname':_0x47f68c[_0x7a20('0x15')],'transfererconnectedlinenum':_0x47f68c[_0x7a20('0x19')],'transfererconnectedlinename':_0x47f68c[_0x7a20('0x1a')],'transfereraccountcode':_0x47f68c[_0x7a20('0x1b')],'transferercontext':_0x47f68c[_0x7a20('0x1c')],'transfererexten':_0x47f68c[_0x7a20('0x1d')],'transfererlinkedid':_0x47f68c[_0x7a20('0x1e')],'context':_0x47f68c[_0x7a20('0x1f')],'extension':_0x47f68c[_0x7a20('0x20')],'type':_0x7a20('0x21')});if(_[_0x7a20('0x22')](_0x47f68c[_0x7a20('0x23')])){_0x47f68c=_['assign'](_0x47f68c,{'transfereechannel':_0x47f68c['transfertargetchannel'],'transfereecalleridnum':_0x47f68c['transfertargetcalleridnum'],'transfereecalleridname':_0x47f68c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x47f68c[_0x7a20('0x24')],'transfereeconnectedlinename':_0x47f68c[_0x7a20('0x25')],'transfereeaccountcode':_0x47f68c['transfertargetaccountcode'],'transfereecontext':_0x47f68c[_0x7a20('0x26')],'transfereeexten':_0x47f68c[_0x7a20('0x27')],'transfereelinkedid':_0x47f68c[_0x7a20('0x28')]});}writeDB(_0x47f68c);}catch(_0x50cc2f){utils['error'](util[_0x7a20('0x4')]('[%s][transfers][attendedtransfer]',_0x47f68c[_0x7a20('0x6')]),_0x50cc2f);}}; \ No newline at end of file +var _0xf4a2=['assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','request','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','type','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf4a2,0x65));var _0x2f4a=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0xf4a2[_0x12833b];return _0x3acad3;};'use strict';var _=require(_0x2f4a('0x0'));var util=require(_0x2f4a('0x1'));var utils=require('./utils');function writeDB(_0x2f8c28){utils[_0x2f4a('0x2')](util['format'](_0x2f4a('0x3'),_0x2f8c28['type']===_0x2f4a('0x4')?_0x2f8c28['origtransfereruniqueid']:_0x2f8c28[_0x2f4a('0x5')],_0x2f8c28['type']));utils[_0x2f4a('0x6')]('CreateVoiceTransferReport',_0x2f8c28);}exports[_0x2f4a('0x7')]={};exports[_0x2f4a('0x8')]=function(_0xcc803c){try{utils[_0x2f4a('0x9')](util[_0x2f4a('0xa')](_0x2f4a('0xb'),_0xcc803c['uniqueid']),_0xcc803c);utils[_0x2f4a('0x2')](util['format'](_0x2f4a('0xc'),_0xcc803c[_0x2f4a('0x5')],_0xcc803c[_0x2f4a('0xd')],_0xcc803c[_0x2f4a('0xe')],_0xcc803c['transfereecalleridnum'],_0xcc803c[_0x2f4a('0xf')]));_0xcc803c[_0x2f4a('0x10')]=_0x2f4a('0x11');exports[_0x2f4a('0x7')][_0xcc803c[_0x2f4a('0x12')]]=_0xcc803c;writeDB(_0xcc803c);}catch(_0x5bc155){utils[_0x2f4a('0x13')](util[_0x2f4a('0xa')](_0x2f4a('0xb'),_0xcc803c['uniqueid']),_0x5bc155);}};exports['attendedtransfer']=function(_0x2bee3f){try{utils[_0x2f4a('0x9')](util['format'](_0x2f4a('0x14'),_0x2bee3f[_0x2f4a('0x15')]),_0x2bee3f);utils[_0x2f4a('0x2')](util[_0x2f4a('0xa')](_0x2f4a('0x16'),_0x2bee3f[_0x2f4a('0x15')],_0x2bee3f[_0x2f4a('0x17')],_0x2bee3f['origtransferercalleridname'],_0x2bee3f['transfertargetcalleridnum'],_0x2bee3f[_0x2f4a('0x18')]));_0x2bee3f=_[_0x2f4a('0x19')](_0x2bee3f,{'transfererchannel':_0x2bee3f[_0x2f4a('0x1a')],'transferercalleridnum':_0x2bee3f['origtransferercalleridnum'],'transferercalleridname':_0x2bee3f['origtransferercalleridname'],'transfererconnectedlinenum':_0x2bee3f[_0x2f4a('0x1b')],'transfererconnectedlinename':_0x2bee3f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2bee3f['origtransfereraccountcode'],'transferercontext':_0x2bee3f[_0x2f4a('0x1c')],'transfererexten':_0x2bee3f[_0x2f4a('0x1d')],'transfererlinkedid':_0x2bee3f[_0x2f4a('0x1e')],'context':_0x2bee3f[_0x2f4a('0x1f')],'extension':_0x2bee3f[_0x2f4a('0x20')],'type':'attended'});if(_[_0x2f4a('0x21')](_0x2bee3f[_0x2f4a('0x22')])){_0x2bee3f=_[_0x2f4a('0x19')](_0x2bee3f,{'transfereechannel':_0x2bee3f[_0x2f4a('0x23')],'transfereecalleridnum':_0x2bee3f[_0x2f4a('0x24')],'transfereecalleridname':_0x2bee3f[_0x2f4a('0x18')],'transfereeconnectedlinenum':_0x2bee3f[_0x2f4a('0x25')],'transfereeconnectedlinename':_0x2bee3f[_0x2f4a('0x26')],'transfereeaccountcode':_0x2bee3f[_0x2f4a('0x27')],'transfereecontext':_0x2bee3f[_0x2f4a('0x28')],'transfereeexten':_0x2bee3f['transfertargetexten'],'transfereelinkedid':_0x2bee3f[_0x2f4a('0x29')]});}writeDB(_0x2bee3f);}catch(_0x2047c5){utils[_0x2f4a('0x13')](util[_0x2f4a('0xa')](_0x2f4a('0x14'),_0x2bee3f[_0x2f4a('0x15')]),_0x2047c5);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1ed4b96..85164f3 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 _0xa6ce=['then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','http','../../config/logger','info','inspect','debug','error','request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa6ce,0x15e));var _0xea6c=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0xa6ce[_0x16771d];return _0x386f11;};'use strict';var BPromise=require(_0xea6c('0x0'));var jayson=require('jayson/promise');var moment=require(_0xea6c('0x1'));var util=require(_0xea6c('0x2'));var client=jayson['client'][_0xea6c('0x3')]({'port':0x2329});var logger=require(_0xea6c('0x4'))('xdr');exports['info']=function(_0x2ac723,_0x1eea8f){logger[_0xea6c('0x5')](_0x2ac723,_0x1eea8f?util[_0xea6c('0x6')](_0x1eea8f,{'showHidden':![],'depth':null}):'');};exports[_0xea6c('0x7')]=function(_0x8a751f,_0x5c3ba1){logger[_0xea6c('0x7')](_0x8a751f,_0x5c3ba1?util[_0xea6c('0x6')](_0x5c3ba1,{'showHidden':![],'depth':null}):'');};exports[_0xea6c('0x8')]=function(_0x202528,_0x29b813){logger[_0xea6c('0x8')](_0x202528,_0x29b813?util[_0xea6c('0x6')](_0x29b813,{'showHidden':![],'depth':null}):'');};exports[_0xea6c('0x9')]=function(_0x2c414a,_0x3b70a4){return client[_0xea6c('0x9')](_0x2c414a,{'body':_0x3b70a4})[_0xea6c('0xa')](function(_0xfc7a5e){logger[_0xea6c('0x7')]('[utils][request]\x20name:%s',_0x2c414a,_0xfc7a5e?util[_0xea6c('0x6')](_0xfc7a5e,{'showHidden':![],'depth':null}):'');})[_0xea6c('0xb')](function(_0x36c0a8){logger['error'](_0xea6c('0xc'),_0x2c414a,_0x36c0a8?util[_0xea6c('0x6')](_0x36c0a8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4db782){return client[_0xea6c('0x9')](_0xea6c('0xd'),{'options':{'raw':!![],'attributes':['id',_0xea6c('0xe'),_0xea6c('0xf'),_0xea6c('0x10')],'where':_0x4db782,'limit':0x1}})[_0xea6c('0xa')](function(_0x5a51f9){logger[_0xea6c('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xea6c('0x11')](_0x4db782),_0x5a51f9?util[_0xea6c('0x6')](_0x5a51f9,{'showHidden':![],'depth':null}):'');return _0x5a51f9[_0xea6c('0x12')][_0xea6c('0x13')]?_0x5a51f9[_0xea6c('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x2dbbcb){return new BPromise(function(_0x2f4bd0,_0x254f8e){if(_0x2dbbcb){return getUser({'internal':_0x2dbbcb})[_0xea6c('0xa')](function(_0x9ba42b){logger[_0xea6c('0x5')](_0xea6c('0x14'),_0x2dbbcb,_0x9ba42b?_0xea6c('0x15'):_0xea6c('0x16'));return _0x2f4bd0(_0x9ba42b);})[_0xea6c('0xb')](function(_0x52a322){logger[_0xea6c('0x8')]('[utils][getUserByInternal]',_0x52a322?util[_0xea6c('0x6')](_0x52a322,{'showHidden':![],'depth':null}):'');return _0x2f4bd0(null);});}return _0x2f4bd0(null);});};exports['getUserByInterface']=function(_0x204e07){return new BPromise(function(_0x341139,_0x1d3eca){if(_0x204e07){return getUser({'interface':_0x204e07})['then'](function(_0x417cfa){logger[_0xea6c('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x204e07,_0x417cfa?'found':_0xea6c('0x16'));return _0x341139(_0x417cfa);})['catch'](function(_0x540406){logger[_0xea6c('0x8')](_0xea6c('0x17'),_0x540406?util[_0xea6c('0x6')](_0x540406,{'showHidden':![],'depth':null}):'');return _0x341139(null);});}return _0x341139(null);});};exports[_0xea6c('0x18')]=function(_0x303303){return new BPromise(function(_0x4fa0ea,_0x3bfe88){if(_0x303303){return getUser({'name':_0x303303})['then'](function(_0x5df5e9){logger[_0xea6c('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x303303,_0x5df5e9?_0xea6c('0x15'):_0xea6c('0x16'));return _0x4fa0ea(_0x5df5e9);})[_0xea6c('0xb')](function(_0x269b48){logger[_0xea6c('0x8')](_0xea6c('0x19'),_0x269b48?util[_0xea6c('0x6')](_0x269b48,{'showHidden':![],'depth':null}):'');return _0x4fa0ea(null);});}return _0x4fa0ea(null);});};exports[_0xea6c('0x1a')]=function(_0x348a38){return new BPromise(function(_0x118385,_0x15327f){if(_0x348a38){return client[_0xea6c('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xea6c('0xf'),_0xea6c('0x1b'),'acw','acwTimeout'],'where':{'name':_0x348a38},'limit':0x1}})['then'](function(_0x434fa7){logger[_0xea6c('0x7')](_0xea6c('0x1c'),_0x348a38,_0x434fa7?util[_0xea6c('0x6')](_0x434fa7,{'showHidden':![],'depth':null}):'');logger[_0xea6c('0x5')](_0xea6c('0x1d'),_0x348a38,_0x434fa7?_0xea6c('0x15'):_0xea6c('0x16'));return _0x118385(_0x434fa7[_0xea6c('0x12')]['length']?_0x434fa7[_0xea6c('0x12')][0x0]:null);})[_0xea6c('0xb')](function(_0x439013){logger[_0xea6c('0x8')](_0xea6c('0x1e'),_0x439013?util[_0xea6c('0x6')](_0x439013,{'showHidden':![],'depth':null}):'');return _0x118385(null);});}return _0x118385(null);});};exports['addTime']=function(_0xc0c5b9,_0x18c59e){return moment(_0xc0c5b9)['add'](_0x18c59e,_0xea6c('0x1f'))[_0xea6c('0x20')](_0xea6c('0x21'));};exports['subtractTime']=function(_0x5ef27c,_0x4fa399){return moment(_0x5ef27c)['subtract'](_0x4fa399,'seconds')[_0xea6c('0x20')](_0xea6c('0x21'));};exports[_0xea6c('0x22')]=function(_0x151c66,_0x507d35){return moment(_0x151c66)[_0xea6c('0x23')](moment(_0x507d35),_0xea6c('0x1f'));};exports[_0xea6c('0x24')]=function(_0x525861,_0x1d8794){return parseInt(_0x525861,0xa)+parseInt(_0x1d8794,0xa);};exports[_0xea6c('0x25')]=function(){return moment()['format'](_0xea6c('0x21'));};exports[_0xea6c('0x26')]=function(_0x3033da,_0x261082){if(_0x261082){return moment(_0x3033da)[_0xea6c('0x26')](_0x261082);}return!![];};exports[_0xea6c('0x27')]=function(_0x1fbb3d,_0x3259aa){if(_0x3259aa){return moment(_0x1fbb3d)[_0xea6c('0x27')](_0x3259aa);}else if(_0x1fbb3d){return!![];}return![];}; \ No newline at end of file +var _0xa0ab=['[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','http','../../config/logger','xdr','debug','error','inspect','request','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','length','then','info','notfound','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]'];(function(_0x258d61,_0x1ef707){var _0x2d8826=function(_0xafa84c){while(--_0xafa84c){_0x258d61['push'](_0x258d61['shift']());}};_0x2d8826(++_0x1ef707);}(_0xa0ab,0x1eb));var _0xba0a=function(_0x53b648,_0x2493d8){_0x53b648=_0x53b648-0x0;var _0xe6dcad=_0xa0ab[_0x53b648];return _0xe6dcad;};'use strict';var BPromise=require(_0xba0a('0x0'));var jayson=require('jayson/promise');var moment=require(_0xba0a('0x1'));var util=require(_0xba0a('0x2'));var client=jayson['client'][_0xba0a('0x3')]({'port':0x2329});var logger=require(_0xba0a('0x4'))(_0xba0a('0x5'));exports['info']=function(_0x5390c1,_0x28cd6b){logger['info'](_0x5390c1,_0x28cd6b?util['inspect'](_0x28cd6b,{'showHidden':![],'depth':null}):'');};exports[_0xba0a('0x6')]=function(_0x5d90b8,_0x345a3c){logger['debug'](_0x5d90b8,_0x345a3c?util['inspect'](_0x345a3c,{'showHidden':![],'depth':null}):'');};exports[_0xba0a('0x7')]=function(_0x4adcc2,_0x46a5d9){logger[_0xba0a('0x7')](_0x4adcc2,_0x46a5d9?util[_0xba0a('0x8')](_0x46a5d9,{'showHidden':![],'depth':null}):'');};exports[_0xba0a('0x9')]=function(_0x1d3cc1,_0x2e7ac9){return client[_0xba0a('0x9')](_0x1d3cc1,{'body':_0x2e7ac9})['then'](function(_0x35e1a6){logger[_0xba0a('0x6')](_0xba0a('0xa'),_0x1d3cc1,_0x35e1a6?util[_0xba0a('0x8')](_0x35e1a6,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1c6d1d){logger['error'](_0xba0a('0xa'),_0x1d3cc1,_0x1c6d1d?util[_0xba0a('0x8')](_0x1c6d1d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5dff25){return client[_0xba0a('0x9')](_0xba0a('0xb'),{'options':{'raw':!![],'attributes':['id',_0xba0a('0xc'),_0xba0a('0xd'),_0xba0a('0xe')],'where':_0x5dff25,'limit':0x1}})['then'](function(_0x166a0f){logger[_0xba0a('0x6')](_0xba0a('0xf'),JSON['stringify'](_0x5dff25),_0x166a0f?util[_0xba0a('0x8')](_0x166a0f,{'showHidden':![],'depth':null}):'');return _0x166a0f[_0xba0a('0x10')][_0xba0a('0x11')]?_0x166a0f[_0xba0a('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x3ed258){return new BPromise(function(_0x2af15b,_0x5372ab){if(_0x3ed258){return getUser({'internal':_0x3ed258})[_0xba0a('0x12')](function(_0x25fee3){logger[_0xba0a('0x13')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x3ed258,_0x25fee3?'found':_0xba0a('0x14'));return _0x2af15b(_0x25fee3);})[_0xba0a('0x15')](function(_0x3f0023){logger[_0xba0a('0x7')]('[utils][getUserByInternal]',_0x3f0023?util[_0xba0a('0x8')](_0x3f0023,{'showHidden':![],'depth':null}):'');return _0x2af15b(null);});}return _0x2af15b(null);});};exports[_0xba0a('0x16')]=function(_0xed25e5){return new BPromise(function(_0x100af0,_0x5ed698){if(_0xed25e5){return getUser({'interface':_0xed25e5})[_0xba0a('0x12')](function(_0x215721){logger[_0xba0a('0x13')](_0xba0a('0x17'),_0xed25e5,_0x215721?_0xba0a('0x18'):'notfound');return _0x100af0(_0x215721);})[_0xba0a('0x15')](function(_0x3ed6a9){logger['error'](_0xba0a('0x19'),_0x3ed6a9?util[_0xba0a('0x8')](_0x3ed6a9,{'showHidden':![],'depth':null}):'');return _0x100af0(null);});}return _0x100af0(null);});};exports['getUserByName']=function(_0xa5594c){return new BPromise(function(_0xb5849e,_0xa42145){if(_0xa5594c){return getUser({'name':_0xa5594c})['then'](function(_0x2a2ed4){logger[_0xba0a('0x13')](_0xba0a('0x1a'),_0xa5594c,_0x2a2ed4?_0xba0a('0x18'):'notfound');return _0xb5849e(_0x2a2ed4);})[_0xba0a('0x15')](function(_0x6d3d0c){logger['error'](_0xba0a('0x1b'),_0x6d3d0c?util[_0xba0a('0x8')](_0x6d3d0c,{'showHidden':![],'depth':null}):'');return _0xb5849e(null);});}return _0xb5849e(null);});};exports['getVoiceQueueByName']=function(_0x4aff6e){return new BPromise(function(_0x5b2731,_0x5946ef){if(_0x4aff6e){return client['request'](_0xba0a('0x1c'),{'options':{'raw':!![],'attributes':['id','name',_0xba0a('0x1d'),_0xba0a('0x1e'),_0xba0a('0x1f')],'where':{'name':_0x4aff6e},'limit':0x1}})[_0xba0a('0x12')](function(_0xf1147c){logger[_0xba0a('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4aff6e,_0xf1147c?util[_0xba0a('0x8')](_0xf1147c,{'showHidden':![],'depth':null}):'');logger[_0xba0a('0x13')](_0xba0a('0x20'),_0x4aff6e,_0xf1147c?_0xba0a('0x18'):_0xba0a('0x14'));return _0x5b2731(_0xf1147c[_0xba0a('0x10')][_0xba0a('0x11')]?_0xf1147c[_0xba0a('0x10')][0x0]:null);})[_0xba0a('0x15')](function(_0x535bb8){logger[_0xba0a('0x7')](_0xba0a('0x21'),_0x535bb8?util[_0xba0a('0x8')](_0x535bb8,{'showHidden':![],'depth':null}):'');return _0x5b2731(null);});}return _0x5b2731(null);});};exports[_0xba0a('0x22')]=function(_0x2c8852,_0x410255){return moment(_0x2c8852)[_0xba0a('0x23')](_0x410255,_0xba0a('0x24'))[_0xba0a('0x25')](_0xba0a('0x26'));};exports[_0xba0a('0x27')]=function(_0x50207c,_0x45d039){return moment(_0x50207c)[_0xba0a('0x28')](_0x45d039,'seconds')[_0xba0a('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xba0a('0x29')]=function(_0x29d8af,_0x402771){return moment(_0x29d8af)[_0xba0a('0x2a')](moment(_0x402771),_0xba0a('0x24'));};exports[_0xba0a('0x2b')]=function(_0xcf420e,_0x4ccf3c){return parseInt(_0xcf420e,0xa)+parseInt(_0x4ccf3c,0xa);};exports[_0xba0a('0x2c')]=function(){return moment()[_0xba0a('0x25')](_0xba0a('0x26'));};exports['isAfter']=function(_0x17cbc3,_0x4bb81f){if(_0x4bb81f){return moment(_0x17cbc3)[_0xba0a('0x2d')](_0x4bb81f);}return!![];};exports[_0xba0a('0x2e')]=function(_0x18ff2a,_0x3bbbcd){if(_0x3bbbcd){return moment(_0x18ff2a)[_0xba0a('0x2e')](_0x3bbbcd);}else if(_0x18ff2a){return!![];}return![];}; \ No newline at end of file